From 56691e1f6229e67a2f54660e662f1d5e9d738fdd Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Fri, 29 Jul 2016 17:14:59 +0100 Subject: [PATCH 001/312] Added undo define and checks --- .../source/gui/worldEditor/terrainEditor.cpp | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Engine/source/gui/worldEditor/terrainEditor.cpp b/Engine/source/gui/worldEditor/terrainEditor.cpp index cf80218e3..7588e5ac0 100644 --- a/Engine/source/gui/worldEditor/terrainEditor.cpp +++ b/Engine/source/gui/worldEditor/terrainEditor.cpp @@ -2857,14 +2857,21 @@ DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , " //------------------------------------------------------------------------------ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinSlope, F32 mMaxSlope, F32 mCoverage ) { - if (!mActiveTerrain) + +#define AUTOPAINT_UNDO + + if (!mActiveTerrain) return; S32 mat = getPaintMaterialIndex(); if (mat == -1) return; - - mUndoSel = new Selection; + + + #ifndef AUTOPAINT_UNDO + mUndoSel = new Selection; + #endif + U32 terrBlocks = mActiveTerrain->getBlockSize(); for (U32 y = 0; y < terrBlocks; y++) @@ -2906,19 +2913,23 @@ void TerrainEditor::autoMaterialLayer( F32 mMinHeight, F32 mMaxHeight, F32 mMinS if (norm.z < mSin(mDegToRad(90.0f - mMaxSlope))) continue; - gi.mMaterialChanged = true; - mUndoSel->add(gi); + gi.mMaterialChanged = true; + #ifndef AUTOPAINT_UNDO + mUndoSel->add(gi); + #endif gi.mMaterial = mat; setGridInfo(gi); } } + #ifndef AUTOPAINT_UNDO if(mUndoSel->size()) submitUndo( mUndoSel ); else delete mUndoSel; - mUndoSel = 0; + #endif + scheduleMaterialUpdate(); } From ace877b4099c0b5771a5ff69d5a43bf3aa2fa1cf Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 09:35:44 +0100 Subject: [PATCH 002/312] Add all new AFX files --- Engine/source/afx/afxCamera.cpp | 1189 ++++++++ Engine/source/afx/afxCamera.h | 189 ++ Engine/source/afx/afxChoreographer.cpp | 1084 +++++++ Engine/source/afx/afxChoreographer.h | 222 ++ Engine/source/afx/afxConstraint.cpp | 2613 ++++++++++++++++ Engine/source/afx/afxConstraint.h | 677 ++++ Engine/source/afx/afxEffectDefs.h | 114 + Engine/source/afx/afxEffectGroup.cpp | 270 ++ Engine/source/afx/afxEffectGroup.h | 103 + Engine/source/afx/afxEffectVector.cpp | 358 +++ Engine/source/afx/afxEffectVector.h | 86 + Engine/source/afx/afxEffectWrapper.cpp | 1193 ++++++++ Engine/source/afx/afxEffectWrapper.h | 392 +++ Engine/source/afx/afxEffectron.cpp | 1119 +++++++ Engine/source/afx/afxEffectron.h | 216 ++ Engine/source/afx/afxMagicMissile.cpp | 2116 +++++++++++++ Engine/source/afx/afxMagicMissile.h | 435 +++ Engine/source/afx/afxMagicSpell.cpp | 2709 +++++++++++++++++ Engine/source/afx/afxMagicSpell.h | 390 +++ Engine/source/afx/afxPhrase.cpp | 196 ++ Engine/source/afx/afxPhrase.h | 87 + Engine/source/afx/afxRenderHighlightMgr.cpp | 176 ++ Engine/source/afx/afxRenderHighlightMgr.h | 76 + Engine/source/afx/afxResidueMgr.cpp | 469 +++ Engine/source/afx/afxResidueMgr.h | 179 ++ Engine/source/afx/afxSelectron.cpp | 1173 +++++++ Engine/source/afx/afxSelectron.h | 258 ++ Engine/source/afx/afxSpellBook.cpp | 357 +++ Engine/source/afx/afxSpellBook.h | 142 + .../afx/afxZodiacGroundPlaneRenderer_T3D.cpp | 311 ++ .../afx/afxZodiacGroundPlaneRenderer_T3D.h | 91 + .../afx/afxZodiacMeshRoadRenderer_T3D.cpp | 302 ++ .../afx/afxZodiacMeshRoadRenderer_T3D.h | 92 + .../afx/afxZodiacPolysoupRenderer_T3D.cpp | 420 +++ .../afx/afxZodiacPolysoupRenderer_T3D.h | 92 + .../afx/afxZodiacTerrainRenderer_T3D.cpp | 344 +++ .../source/afx/afxZodiacTerrainRenderer_T3D.h | 92 + Engine/source/afx/arcaneFX.cpp | 959 ++++++ Engine/source/afx/arcaneFX.h | 214 ++ Engine/source/afx/ce/afxAnimClip.cpp | 217 ++ Engine/source/afx/ce/afxAnimClip.h | 81 + Engine/source/afx/ce/afxAnimLock.cpp | 95 + Engine/source/afx/ce/afxAnimLock.h | 48 + Engine/source/afx/ce/afxAreaDamage.cpp | 121 + Engine/source/afx/ce/afxAreaDamage.h | 62 + Engine/source/afx/ce/afxAudioBank.cpp | 246 ++ Engine/source/afx/ce/afxAudioBank.h | 67 + Engine/source/afx/ce/afxBillboard.cpp | 294 ++ Engine/source/afx/ce/afxBillboard.h | 131 + Engine/source/afx/ce/afxBillboard_T3D.cpp | 145 + Engine/source/afx/ce/afxCameraPuppet.cpp | 132 + Engine/source/afx/ce/afxCameraPuppet.h | 64 + Engine/source/afx/ce/afxCameraShake.cpp | 118 + Engine/source/afx/ce/afxCameraShake.h | 57 + Engine/source/afx/ce/afxCollisionEvent.cpp | 103 + Engine/source/afx/ce/afxCollisionEvent.h | 59 + Engine/source/afx/ce/afxComponentEffect.h | 41 + Engine/source/afx/ce/afxConsoleMessage.cpp | 93 + Engine/source/afx/ce/afxConsoleMessage.h | 54 + Engine/source/afx/ce/afxDamage.cpp | 140 + Engine/source/afx/ce/afxDamage.h | 63 + Engine/source/afx/ce/afxFootSwitch.cpp | 116 + Engine/source/afx/ce/afxFootSwitch.h | 56 + Engine/source/afx/ce/afxGuiController.cpp | 109 + Engine/source/afx/ce/afxGuiController.h | 58 + Engine/source/afx/ce/afxGuiText.cpp | 103 + Engine/source/afx/ce/afxGuiText.h | 57 + Engine/source/afx/ce/afxLight.cpp | 41 + Engine/source/afx/ce/afxLight.h | 38 + Engine/source/afx/ce/afxLightBase_T3D.cpp | 243 ++ Engine/source/afx/ce/afxLightBase_T3D.h | 73 + Engine/source/afx/ce/afxMachineGun.cpp | 127 + Engine/source/afx/ce/afxMachineGun.h | 59 + Engine/source/afx/ce/afxModel.cpp | 770 +++++ Engine/source/afx/ce/afxModel.h | 166 + Engine/source/afx/ce/afxModel_T3D.cpp | 71 + Engine/source/afx/ce/afxMooring.cpp | 278 ++ Engine/source/afx/ce/afxMooring.h | 102 + Engine/source/afx/ce/afxMooring_T3D.cpp | 88 + Engine/source/afx/ce/afxMultiLight.cpp | 40 + Engine/source/afx/ce/afxMultiLight.h | 38 + Engine/source/afx/ce/afxParticleEmitter.cpp | 1617 ++++++++++ Engine/source/afx/ce/afxParticleEmitter.h | 350 +++ Engine/source/afx/ce/afxPhraseEffect.cpp | 312 ++ Engine/source/afx/ce/afxPhraseEffect.h | 120 + Engine/source/afx/ce/afxPhysicalZone.cpp | 114 + Engine/source/afx/ce/afxPhysicalZone.h | 65 + Engine/source/afx/ce/afxPlayerMovement.cpp | 140 + Engine/source/afx/ce/afxPlayerMovement.h | 73 + Engine/source/afx/ce/afxPlayerPuppet.cpp | 122 + Engine/source/afx/ce/afxPlayerPuppet.h | 64 + Engine/source/afx/ce/afxPointLight_T3D.cpp | 103 + Engine/source/afx/ce/afxPointLight_T3D.h | 56 + Engine/source/afx/ce/afxProjectile.cpp | 371 +++ Engine/source/afx/ce/afxProjectile.h | 117 + Engine/source/afx/ce/afxScriptEvent.cpp | 94 + Engine/source/afx/ce/afxScriptEvent.h | 57 + Engine/source/afx/ce/afxSpotLight_T3D.cpp | 112 + Engine/source/afx/ce/afxSpotLight_T3D.h | 58 + Engine/source/afx/ce/afxStaticShape.cpp | 241 ++ Engine/source/afx/ce/afxStaticShape.h | 98 + Engine/source/afx/ce/afxVolumeLight.cpp | 40 + Engine/source/afx/ce/afxVolumeLight.h | 38 + Engine/source/afx/ce/afxZodiac.cpp | 418 +++ Engine/source/afx/ce/afxZodiac.h | 132 + Engine/source/afx/ce/afxZodiacDefs.h | 163 + Engine/source/afx/ce/afxZodiacMgr.cpp | 131 + Engine/source/afx/ce/afxZodiacMgr.h | 150 + Engine/source/afx/ce/afxZodiacMgr_T3D.cpp | 319 ++ Engine/source/afx/ce/afxZodiacPlane.cpp | 313 ++ Engine/source/afx/ce/afxZodiacPlane.h | 143 + Engine/source/afx/ce/afxZodiacPlane_T3D.cpp | 229 ++ Engine/source/afx/ea/afxEA_AnimClip.cpp | 200 ++ Engine/source/afx/ea/afxEA_AnimLock.cpp | 108 + Engine/source/afx/ea/afxEA_AreaDamage.cpp | 264 ++ Engine/source/afx/ea/afxEA_AudioBank.cpp | 178 ++ Engine/source/afx/ea/afxEA_Billboard.cpp | 199 ++ Engine/source/afx/ea/afxEA_CameraPuppet.cpp | 199 ++ Engine/source/afx/ea/afxEA_CameraShake.cpp | 196 ++ Engine/source/afx/ea/afxEA_CollisionEvent.cpp | 225 ++ Engine/source/afx/ea/afxEA_ConsoleMessage.cpp | 128 + Engine/source/afx/ea/afxEA_Damage.cpp | 201 ++ Engine/source/afx/ea/afxEA_Debris.cpp | 199 ++ Engine/source/afx/ea/afxEA_Explosion.cpp | 145 + Engine/source/afx/ea/afxEA_FootSwitch.cpp | 180 ++ Engine/source/afx/ea/afxEA_GuiController.cpp | 216 ++ Engine/source/afx/ea/afxEA_GuiText.cpp | 180 ++ Engine/source/afx/ea/afxEA_Light.cpp | 62 + Engine/source/afx/ea/afxEA_MachineGun.cpp | 207 ++ Engine/source/afx/ea/afxEA_Model.cpp | 255 ++ Engine/source/afx/ea/afxEA_Mooring.cpp | 188 ++ Engine/source/afx/ea/afxEA_MultiLight.cpp | 62 + .../source/afx/ea/afxEA_ParticleEmitter.cpp | 337 ++ Engine/source/afx/ea/afxEA_ParticleEmitter.h | 67 + Engine/source/afx/ea/afxEA_PhraseEffect.cpp | 385 +++ Engine/source/afx/ea/afxEA_PhysicalZone.cpp | 226 ++ Engine/source/afx/ea/afxEA_PlayerMovement.cpp | 170 ++ Engine/source/afx/ea/afxEA_PlayerPuppet.cpp | 184 ++ Engine/source/afx/ea/afxEA_PointLight_T3D.cpp | 289 ++ Engine/source/afx/ea/afxEA_Projectile.cpp | 315 ++ Engine/source/afx/ea/afxEA_ScriptEvent.cpp | 145 + Engine/source/afx/ea/afxEA_Sound.cpp | 214 ++ Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp | 293 ++ Engine/source/afx/ea/afxEA_StaticShape.cpp | 249 ++ Engine/source/afx/ea/afxEA_TLKLight.cpp | 79 + Engine/source/afx/ea/afxEA_VolumeLight.cpp | 61 + Engine/source/afx/ea/afxEA_Zodiac.cpp | 434 +++ Engine/source/afx/ea/afxEA_ZodiacPlane.cpp | 344 +++ Engine/source/afx/forces/afxEA_Force.cpp | 183 ++ Engine/source/afx/forces/afxF_Drag.cpp | 209 ++ Engine/source/afx/forces/afxF_Gravity.cpp | 171 ++ Engine/source/afx/forces/afxForce.cpp | 148 + Engine/source/afx/forces/afxForce.h | 97 + Engine/source/afx/forces/afxForceSet.cpp | 134 + Engine/source/afx/forces/afxForceSet.h | 80 + Engine/source/afx/forces/afxXM_Force.cpp | 274 ++ Engine/source/afx/rpg/afxRPGMagicSpell.cpp | 274 ++ Engine/source/afx/rpg/afxRPGMagicSpell.h | 105 + Engine/source/afx/ui/afxEventCatchAll.cpp | 147 + .../source/afx/ui/afxGuiSubstitutionField.cpp | 205 ++ .../source/afx/ui/afxGuiSubstitutionField.h | 66 + Engine/source/afx/ui/afxGuiTextHud.cpp | 328 ++ Engine/source/afx/ui/afxGuiTextHud.h | 87 + Engine/source/afx/ui/afxProgressBase.h | 37 + Engine/source/afx/ui/afxSpellButton.cpp | 393 +++ Engine/source/afx/ui/afxSpellButton.h | 103 + Engine/source/afx/ui/afxSpellCastBar.cpp | 162 + Engine/source/afx/ui/afxSpellCastBar.h | 24 + Engine/source/afx/ui/afxStatusBar.cpp | 202 ++ Engine/source/afx/ui/afxStatusBar.h | 24 + Engine/source/afx/ui/afxStatusBox.cpp | 52 + Engine/source/afx/ui/afxStatusBox.h | 50 + Engine/source/afx/ui/afxStatusLabel.cpp | 49 + Engine/source/afx/ui/afxStatusLabel.h | 49 + Engine/source/afx/ui/afxTSCtrl.cpp | 367 +++ Engine/source/afx/ui/afxTSCtrl.h | 96 + Engine/source/afx/util/afxAnimCurve.cpp | 280 ++ Engine/source/afx/util/afxAnimCurve.h | 82 + Engine/source/afx/util/afxCurve3D.cpp | 332 ++ Engine/source/afx/util/afxCurve3D.h | 92 + Engine/source/afx/util/afxCurveEval.cpp | 122 + Engine/source/afx/util/afxCurveEval.h | 62 + Engine/source/afx/util/afxEase.cpp | 98 + Engine/source/afx/util/afxEase.h | 41 + Engine/source/afx/util/afxParticlePool.cpp | 233 ++ Engine/source/afx/util/afxParticlePool.h | 143 + .../source/afx/util/afxParticlePool_T3D.cpp | 491 +++ Engine/source/afx/util/afxPath.cpp | 530 ++++ Engine/source/afx/util/afxPath.h | 102 + Engine/source/afx/util/afxPath3D.cpp | 342 +++ Engine/source/afx/util/afxPath3D.h | 101 + .../source/afx/util/afxTriBoxCheck2D_T3D.cpp | 115 + Engine/source/afx/util/afxTriBoxCheck2D_T3D.h | 45 + Engine/source/afx/xm/afxXM_Aim.cpp | 261 ++ .../source/afx/xm/afxXM_AltitudeConform.cpp | 262 ++ Engine/source/afx/xm/afxXM_BoxAdapt.cpp | 175 ++ Engine/source/afx/xm/afxXM_BoxConform.cpp | 175 ++ .../source/afx/xm/afxXM_BoxHeightOffset.cpp | 145 + Engine/source/afx/xm/afxXM_Freeze.cpp | 336 ++ Engine/source/afx/xm/afxXM_GroundConform.cpp | 212 ++ Engine/source/afx/xm/afxXM_HeightSampler.cpp | 146 + .../source/afx/xm/afxXM_MountedImageNode.cpp | 231 ++ Engine/source/afx/xm/afxXM_Offset.cpp | 489 +++ Engine/source/afx/xm/afxXM_Oscillate.cpp | 379 +++ .../afx/xm/afxXM_OscillateZodiacColor.cpp | 161 + Engine/source/afx/xm/afxXM_PathConform.cpp | 412 +++ .../source/afx/xm/afxXM_PivotNodeOffset.cpp | 180 ++ Engine/source/afx/xm/afxXM_RandomRot.cpp | 181 ++ Engine/source/afx/xm/afxXM_Scale.cpp | 155 + Engine/source/afx/xm/afxXM_Shockwave.cpp | 170 ++ Engine/source/afx/xm/afxXM_Spin.cpp | 241 ++ Engine/source/afx/xm/afxXM_VelocityOffset.cpp | 373 +++ Engine/source/afx/xm/afxXM_WaveBase.cpp | 610 ++++ Engine/source/afx/xm/afxXM_WaveBase.h | 314 ++ Engine/source/afx/xm/afxXM_WaveColor.cpp | 388 +++ Engine/source/afx/xm/afxXM_WaveScalar.cpp | 825 +++++ Engine/source/afx/xm/afxXfmMod.cpp | 333 ++ Engine/source/afx/xm/afxXfmMod.h | 176 ++ 218 files changed, 54970 insertions(+) create mode 100644 Engine/source/afx/afxCamera.cpp create mode 100644 Engine/source/afx/afxCamera.h create mode 100644 Engine/source/afx/afxChoreographer.cpp create mode 100644 Engine/source/afx/afxChoreographer.h create mode 100644 Engine/source/afx/afxConstraint.cpp create mode 100644 Engine/source/afx/afxConstraint.h create mode 100644 Engine/source/afx/afxEffectDefs.h create mode 100644 Engine/source/afx/afxEffectGroup.cpp create mode 100644 Engine/source/afx/afxEffectGroup.h create mode 100644 Engine/source/afx/afxEffectVector.cpp create mode 100644 Engine/source/afx/afxEffectVector.h create mode 100644 Engine/source/afx/afxEffectWrapper.cpp create mode 100644 Engine/source/afx/afxEffectWrapper.h create mode 100644 Engine/source/afx/afxEffectron.cpp create mode 100644 Engine/source/afx/afxEffectron.h create mode 100644 Engine/source/afx/afxMagicMissile.cpp create mode 100644 Engine/source/afx/afxMagicMissile.h create mode 100644 Engine/source/afx/afxMagicSpell.cpp create mode 100644 Engine/source/afx/afxMagicSpell.h create mode 100644 Engine/source/afx/afxPhrase.cpp create mode 100644 Engine/source/afx/afxPhrase.h create mode 100644 Engine/source/afx/afxRenderHighlightMgr.cpp create mode 100644 Engine/source/afx/afxRenderHighlightMgr.h create mode 100644 Engine/source/afx/afxResidueMgr.cpp create mode 100644 Engine/source/afx/afxResidueMgr.h create mode 100644 Engine/source/afx/afxSelectron.cpp create mode 100644 Engine/source/afx/afxSelectron.h create mode 100644 Engine/source/afx/afxSpellBook.cpp create mode 100644 Engine/source/afx/afxSpellBook.h create mode 100644 Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.cpp create mode 100644 Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h create mode 100644 Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.cpp create mode 100644 Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h create mode 100644 Engine/source/afx/afxZodiacPolysoupRenderer_T3D.cpp create mode 100644 Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h create mode 100644 Engine/source/afx/afxZodiacTerrainRenderer_T3D.cpp create mode 100644 Engine/source/afx/afxZodiacTerrainRenderer_T3D.h create mode 100644 Engine/source/afx/arcaneFX.cpp create mode 100644 Engine/source/afx/arcaneFX.h create mode 100644 Engine/source/afx/ce/afxAnimClip.cpp create mode 100644 Engine/source/afx/ce/afxAnimClip.h create mode 100644 Engine/source/afx/ce/afxAnimLock.cpp create mode 100644 Engine/source/afx/ce/afxAnimLock.h create mode 100644 Engine/source/afx/ce/afxAreaDamage.cpp create mode 100644 Engine/source/afx/ce/afxAreaDamage.h create mode 100644 Engine/source/afx/ce/afxAudioBank.cpp create mode 100644 Engine/source/afx/ce/afxAudioBank.h create mode 100644 Engine/source/afx/ce/afxBillboard.cpp create mode 100644 Engine/source/afx/ce/afxBillboard.h create mode 100644 Engine/source/afx/ce/afxBillboard_T3D.cpp create mode 100644 Engine/source/afx/ce/afxCameraPuppet.cpp create mode 100644 Engine/source/afx/ce/afxCameraPuppet.h create mode 100644 Engine/source/afx/ce/afxCameraShake.cpp create mode 100644 Engine/source/afx/ce/afxCameraShake.h create mode 100644 Engine/source/afx/ce/afxCollisionEvent.cpp create mode 100644 Engine/source/afx/ce/afxCollisionEvent.h create mode 100644 Engine/source/afx/ce/afxComponentEffect.h create mode 100644 Engine/source/afx/ce/afxConsoleMessage.cpp create mode 100644 Engine/source/afx/ce/afxConsoleMessage.h create mode 100644 Engine/source/afx/ce/afxDamage.cpp create mode 100644 Engine/source/afx/ce/afxDamage.h create mode 100644 Engine/source/afx/ce/afxFootSwitch.cpp create mode 100644 Engine/source/afx/ce/afxFootSwitch.h create mode 100644 Engine/source/afx/ce/afxGuiController.cpp create mode 100644 Engine/source/afx/ce/afxGuiController.h create mode 100644 Engine/source/afx/ce/afxGuiText.cpp create mode 100644 Engine/source/afx/ce/afxGuiText.h create mode 100644 Engine/source/afx/ce/afxLight.cpp create mode 100644 Engine/source/afx/ce/afxLight.h create mode 100644 Engine/source/afx/ce/afxLightBase_T3D.cpp create mode 100644 Engine/source/afx/ce/afxLightBase_T3D.h create mode 100644 Engine/source/afx/ce/afxMachineGun.cpp create mode 100644 Engine/source/afx/ce/afxMachineGun.h create mode 100644 Engine/source/afx/ce/afxModel.cpp create mode 100644 Engine/source/afx/ce/afxModel.h create mode 100644 Engine/source/afx/ce/afxModel_T3D.cpp create mode 100644 Engine/source/afx/ce/afxMooring.cpp create mode 100644 Engine/source/afx/ce/afxMooring.h create mode 100644 Engine/source/afx/ce/afxMooring_T3D.cpp create mode 100644 Engine/source/afx/ce/afxMultiLight.cpp create mode 100644 Engine/source/afx/ce/afxMultiLight.h create mode 100644 Engine/source/afx/ce/afxParticleEmitter.cpp create mode 100644 Engine/source/afx/ce/afxParticleEmitter.h create mode 100644 Engine/source/afx/ce/afxPhraseEffect.cpp create mode 100644 Engine/source/afx/ce/afxPhraseEffect.h create mode 100644 Engine/source/afx/ce/afxPhysicalZone.cpp create mode 100644 Engine/source/afx/ce/afxPhysicalZone.h create mode 100644 Engine/source/afx/ce/afxPlayerMovement.cpp create mode 100644 Engine/source/afx/ce/afxPlayerMovement.h create mode 100644 Engine/source/afx/ce/afxPlayerPuppet.cpp create mode 100644 Engine/source/afx/ce/afxPlayerPuppet.h create mode 100644 Engine/source/afx/ce/afxPointLight_T3D.cpp create mode 100644 Engine/source/afx/ce/afxPointLight_T3D.h create mode 100644 Engine/source/afx/ce/afxProjectile.cpp create mode 100644 Engine/source/afx/ce/afxProjectile.h create mode 100644 Engine/source/afx/ce/afxScriptEvent.cpp create mode 100644 Engine/source/afx/ce/afxScriptEvent.h create mode 100644 Engine/source/afx/ce/afxSpotLight_T3D.cpp create mode 100644 Engine/source/afx/ce/afxSpotLight_T3D.h create mode 100644 Engine/source/afx/ce/afxStaticShape.cpp create mode 100644 Engine/source/afx/ce/afxStaticShape.h create mode 100644 Engine/source/afx/ce/afxVolumeLight.cpp create mode 100644 Engine/source/afx/ce/afxVolumeLight.h create mode 100644 Engine/source/afx/ce/afxZodiac.cpp create mode 100644 Engine/source/afx/ce/afxZodiac.h create mode 100644 Engine/source/afx/ce/afxZodiacDefs.h create mode 100644 Engine/source/afx/ce/afxZodiacMgr.cpp create mode 100644 Engine/source/afx/ce/afxZodiacMgr.h create mode 100644 Engine/source/afx/ce/afxZodiacMgr_T3D.cpp create mode 100644 Engine/source/afx/ce/afxZodiacPlane.cpp create mode 100644 Engine/source/afx/ce/afxZodiacPlane.h create mode 100644 Engine/source/afx/ce/afxZodiacPlane_T3D.cpp create mode 100644 Engine/source/afx/ea/afxEA_AnimClip.cpp create mode 100644 Engine/source/afx/ea/afxEA_AnimLock.cpp create mode 100644 Engine/source/afx/ea/afxEA_AreaDamage.cpp create mode 100644 Engine/source/afx/ea/afxEA_AudioBank.cpp create mode 100644 Engine/source/afx/ea/afxEA_Billboard.cpp create mode 100644 Engine/source/afx/ea/afxEA_CameraPuppet.cpp create mode 100644 Engine/source/afx/ea/afxEA_CameraShake.cpp create mode 100644 Engine/source/afx/ea/afxEA_CollisionEvent.cpp create mode 100644 Engine/source/afx/ea/afxEA_ConsoleMessage.cpp create mode 100644 Engine/source/afx/ea/afxEA_Damage.cpp create mode 100644 Engine/source/afx/ea/afxEA_Debris.cpp create mode 100644 Engine/source/afx/ea/afxEA_Explosion.cpp create mode 100644 Engine/source/afx/ea/afxEA_FootSwitch.cpp create mode 100644 Engine/source/afx/ea/afxEA_GuiController.cpp create mode 100644 Engine/source/afx/ea/afxEA_GuiText.cpp create mode 100644 Engine/source/afx/ea/afxEA_Light.cpp create mode 100644 Engine/source/afx/ea/afxEA_MachineGun.cpp create mode 100644 Engine/source/afx/ea/afxEA_Model.cpp create mode 100644 Engine/source/afx/ea/afxEA_Mooring.cpp create mode 100644 Engine/source/afx/ea/afxEA_MultiLight.cpp create mode 100644 Engine/source/afx/ea/afxEA_ParticleEmitter.cpp create mode 100644 Engine/source/afx/ea/afxEA_ParticleEmitter.h create mode 100644 Engine/source/afx/ea/afxEA_PhraseEffect.cpp create mode 100644 Engine/source/afx/ea/afxEA_PhysicalZone.cpp create mode 100644 Engine/source/afx/ea/afxEA_PlayerMovement.cpp create mode 100644 Engine/source/afx/ea/afxEA_PlayerPuppet.cpp create mode 100644 Engine/source/afx/ea/afxEA_PointLight_T3D.cpp create mode 100644 Engine/source/afx/ea/afxEA_Projectile.cpp create mode 100644 Engine/source/afx/ea/afxEA_ScriptEvent.cpp create mode 100644 Engine/source/afx/ea/afxEA_Sound.cpp create mode 100644 Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp create mode 100644 Engine/source/afx/ea/afxEA_StaticShape.cpp create mode 100644 Engine/source/afx/ea/afxEA_TLKLight.cpp create mode 100644 Engine/source/afx/ea/afxEA_VolumeLight.cpp create mode 100644 Engine/source/afx/ea/afxEA_Zodiac.cpp create mode 100644 Engine/source/afx/ea/afxEA_ZodiacPlane.cpp create mode 100644 Engine/source/afx/forces/afxEA_Force.cpp create mode 100644 Engine/source/afx/forces/afxF_Drag.cpp create mode 100644 Engine/source/afx/forces/afxF_Gravity.cpp create mode 100644 Engine/source/afx/forces/afxForce.cpp create mode 100644 Engine/source/afx/forces/afxForce.h create mode 100644 Engine/source/afx/forces/afxForceSet.cpp create mode 100644 Engine/source/afx/forces/afxForceSet.h create mode 100644 Engine/source/afx/forces/afxXM_Force.cpp create mode 100644 Engine/source/afx/rpg/afxRPGMagicSpell.cpp create mode 100644 Engine/source/afx/rpg/afxRPGMagicSpell.h create mode 100644 Engine/source/afx/ui/afxEventCatchAll.cpp create mode 100644 Engine/source/afx/ui/afxGuiSubstitutionField.cpp create mode 100644 Engine/source/afx/ui/afxGuiSubstitutionField.h create mode 100644 Engine/source/afx/ui/afxGuiTextHud.cpp create mode 100644 Engine/source/afx/ui/afxGuiTextHud.h create mode 100644 Engine/source/afx/ui/afxProgressBase.h create mode 100644 Engine/source/afx/ui/afxSpellButton.cpp create mode 100644 Engine/source/afx/ui/afxSpellButton.h create mode 100644 Engine/source/afx/ui/afxSpellCastBar.cpp create mode 100644 Engine/source/afx/ui/afxSpellCastBar.h create mode 100644 Engine/source/afx/ui/afxStatusBar.cpp create mode 100644 Engine/source/afx/ui/afxStatusBar.h create mode 100644 Engine/source/afx/ui/afxStatusBox.cpp create mode 100644 Engine/source/afx/ui/afxStatusBox.h create mode 100644 Engine/source/afx/ui/afxStatusLabel.cpp create mode 100644 Engine/source/afx/ui/afxStatusLabel.h create mode 100644 Engine/source/afx/ui/afxTSCtrl.cpp create mode 100644 Engine/source/afx/ui/afxTSCtrl.h create mode 100644 Engine/source/afx/util/afxAnimCurve.cpp create mode 100644 Engine/source/afx/util/afxAnimCurve.h create mode 100644 Engine/source/afx/util/afxCurve3D.cpp create mode 100644 Engine/source/afx/util/afxCurve3D.h create mode 100644 Engine/source/afx/util/afxCurveEval.cpp create mode 100644 Engine/source/afx/util/afxCurveEval.h create mode 100644 Engine/source/afx/util/afxEase.cpp create mode 100644 Engine/source/afx/util/afxEase.h create mode 100644 Engine/source/afx/util/afxParticlePool.cpp create mode 100644 Engine/source/afx/util/afxParticlePool.h create mode 100644 Engine/source/afx/util/afxParticlePool_T3D.cpp create mode 100644 Engine/source/afx/util/afxPath.cpp create mode 100644 Engine/source/afx/util/afxPath.h create mode 100644 Engine/source/afx/util/afxPath3D.cpp create mode 100644 Engine/source/afx/util/afxPath3D.h create mode 100644 Engine/source/afx/util/afxTriBoxCheck2D_T3D.cpp create mode 100644 Engine/source/afx/util/afxTriBoxCheck2D_T3D.h create mode 100644 Engine/source/afx/xm/afxXM_Aim.cpp create mode 100644 Engine/source/afx/xm/afxXM_AltitudeConform.cpp create mode 100644 Engine/source/afx/xm/afxXM_BoxAdapt.cpp create mode 100644 Engine/source/afx/xm/afxXM_BoxConform.cpp create mode 100644 Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp create mode 100644 Engine/source/afx/xm/afxXM_Freeze.cpp create mode 100644 Engine/source/afx/xm/afxXM_GroundConform.cpp create mode 100644 Engine/source/afx/xm/afxXM_HeightSampler.cpp create mode 100644 Engine/source/afx/xm/afxXM_MountedImageNode.cpp create mode 100644 Engine/source/afx/xm/afxXM_Offset.cpp create mode 100644 Engine/source/afx/xm/afxXM_Oscillate.cpp create mode 100644 Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp create mode 100644 Engine/source/afx/xm/afxXM_PathConform.cpp create mode 100644 Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp create mode 100644 Engine/source/afx/xm/afxXM_RandomRot.cpp create mode 100644 Engine/source/afx/xm/afxXM_Scale.cpp create mode 100644 Engine/source/afx/xm/afxXM_Shockwave.cpp create mode 100644 Engine/source/afx/xm/afxXM_Spin.cpp create mode 100644 Engine/source/afx/xm/afxXM_VelocityOffset.cpp create mode 100644 Engine/source/afx/xm/afxXM_WaveBase.cpp create mode 100644 Engine/source/afx/xm/afxXM_WaveBase.h create mode 100644 Engine/source/afx/xm/afxXM_WaveColor.cpp create mode 100644 Engine/source/afx/xm/afxXM_WaveScalar.cpp create mode 100644 Engine/source/afx/xm/afxXfmMod.cpp create mode 100644 Engine/source/afx/xm/afxXfmMod.h diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp new file mode 100644 index 000000000..0a914ad11 --- /dev/null +++ b/Engine/source/afx/afxCamera.cpp @@ -0,0 +1,1189 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// afxCamera implements a modified camera for demonstrating a third person camera style +// which is more common to RPG games than the standard FPS style camera. For the most part, +// it is a hybrid of the standard TGE camera and the third person mode of the Advanced Camera +// resource, authored by Thomas "Man of Ice" Lund. This camera implements the bare minimum +// required for demonstrating an RPG style camera and leaves tons of room for improvement. +// It should be replaced with a better camera if possible. +// +// Advanced Camera Resource by Thomas "Man of Ice" Lund: +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5471 +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathUtils.h" +#include "math/mathIO.h" +#include "T3D/gameBase/gameConnection.h" +#include "T3D/camera.h" +#include "T3D/player.h" +#include "T3D/sfx/sfx3DWorld.h" + +#include "afx/afxCamera.h" + +#define MaxPitch 1.3962f +#define CameraRadius 0.05f; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxCameraData + +IMPLEMENT_CO_DATABLOCK_V1(afxCameraData); + +ConsoleDocClass( afxCameraData, + "@brief A datablock that describes an afxCamera.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +U32 afxCameraData::sCameraCollisionMask = TerrainObjectType | InteriorLikeObjectType | TerrainLikeObjectType; + +void afxCameraData::initPersistFields() +{ + Con::addVariable("pref::afxCamera::collisionMask", TypeS32, &sCameraCollisionMask); + + Parent::initPersistFields(); +} + +void afxCameraData::packData(BitStream* stream) +{ + Parent::packData(stream); +} + +void afxCameraData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxCamera + +IMPLEMENT_CO_NETOBJECT_V1(afxCamera); + +ConsoleDocClass( afxCamera, + "@brief A 3rd person camera object.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" +); + +afxCamera::afxCamera() +{ + mNetFlags.clear(Ghostable); + mTypeMask |= CameraObjectType; + delta.pos = Point3F(0,0,100); + delta.rot = Point3F(0,0,0); + delta.posVec = delta.rotVec = VectorF(0,0,0); + mObjToWorld.setColumn(3,delta.pos); + mRot = delta.rot; + + mMinOrbitDist = 0; + mMaxOrbitDist = 0; + mCurOrbitDist = 0; + mOrbitObject = NULL; + mPosition.set(0.f, 0.f, 0.f); + mObservingClientObject = false; + mode = FlyMode; + + cam_subject = NULL; + coi_offset.set(0, 0, 2); + cam_offset.set(0, 0, 0); + cam_distance = 0.0f; + cam_angle = 0.0f; + cam_dirty = false; + + flymode_saved = false; + third_person_snap_s = 1; + third_person_snap_c = 1; + flymode_saved_pos.zero(); + + mDamageState = Disabled; +} + +afxCamera::~afxCamera() +{ +} + +//---------------------------------------------------------------------------- + +void afxCamera::cam_update(F32 dt, bool on_server) +{ + if (mode == ThirdPersonMode && cam_subject) + cam_update_3pov(dt, on_server); +} + +void afxCamera::set_cam_pos(const Point3F& pos,const Point3F& rot) +{ + MatrixF xRot, zRot; + xRot.set(EulerF(rot.x, 0, 0)); + zRot.set(EulerF(0, 0, rot.z)); + MatrixF temp; + temp.mul(zRot, xRot); + temp.setColumn(3, pos); + Parent::setTransform(temp); + mRot = rot; +} + + +//---------------------------------------------------------------------------- + + + +//---------------------------------------------------------------------------- + +Point3F &afxCamera::getPosition() +{ + static Point3F position; + mObjToWorld.getColumn(3, &position); + return position; +} + +//---------------------------------------------------------------------------- + + +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +// NEW Observer Code +//---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +void afxCamera::setFlyMode() +{ + mode = FlyMode; + if (flymode_saved) + snapToPosition(flymode_saved_pos); + + if (bool(mOrbitObject)) + { + clearProcessAfter(); + clearNotify(mOrbitObject); + } + mOrbitObject = NULL; +} + +void afxCamera::setOrbitMode(GameBase *obj, Point3F &pos, AngAxisF &rot, F32 minDist, F32 maxDist, F32 curDist, bool ownClientObject) +{ + mObservingClientObject = ownClientObject; + + if(bool(mOrbitObject)) { + clearProcessAfter(); + clearNotify(mOrbitObject); + } + mOrbitObject = obj; + if(bool(mOrbitObject)) + { + processAfter(mOrbitObject); + deleteNotify(mOrbitObject); + mOrbitObject->getWorldBox().getCenter(&mPosition); + mode = OrbitObjectMode; + } + else + { + mode = OrbitPointMode; + mPosition = pos; + } + + QuatF q(rot); + MatrixF tempMat(true); + q.setMatrix(&tempMat); + Point3F dir; + tempMat.getColumn(1, &dir); + + set_cam_pos(mPosition, dir); + + mMinOrbitDist = minDist; + mMaxOrbitDist = maxDist; + mCurOrbitDist = curDist; +} + + +void afxCamera::validateEyePoint(F32 pos, MatrixF *mat) +{ + if (pos != 0) { + // Use the eye transform to orient the camera + Point3F dir; + mat->getColumn(1, &dir); + pos *= mMaxOrbitDist - mMinOrbitDist; + // Use the camera node's pos. + Point3F startPos; + Point3F endPos; + mObjToWorld.getColumn(3,&startPos); + + // Make sure we don't extend the camera into anything solid + if(mOrbitObject) + mOrbitObject->disableCollision(); + disableCollision(); + RayInfo collision; + + SceneContainer* pContainer = isServerObject() ? &gServerContainer : &gClientContainer; + if (!pContainer->castRay(startPos, startPos - dir * 2.5 * pos, afxCameraData::sCameraCollisionMask, &collision)) + endPos = startPos - dir * pos; + else + { + float dot = mDot(dir, collision.normal); + if(dot > 0.01) + { + float colDist = mDot(startPos - collision.point, dir) - (1 / dot) * CameraRadius; + if(colDist > pos) + colDist = pos; + if(colDist < 0) + colDist = 0; + endPos = startPos - dir * colDist; + } + else + endPos = startPos - dir * pos; + } + mat->setColumn(3,endPos); + enableCollision(); + if(mOrbitObject) + mOrbitObject->enableCollision(); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + + + + +// Sets the position and calculates rotation +void afxCamera::snapToPosition(const Point3F& tPos) +{ + MatrixF transMat; + + if (cam_subject) + { + // get the subject's transform + MatrixF objToWorld = cam_subject->getRenderTransform(); + + // transform the center-of-interest to world-space + Point3F objPos; + objToWorld.mulP(coi_offset, &objPos); + + // find normalized direction vector looking from camera to coi + VectorF dirVec = objPos - tPos; + dirVec.normalize(); + + MathUtils::getAnglesFromVector(dirVec, mRot.z, mRot.x); + mRot.x = 0 - mRot.x; + + transMat = MathUtils::createOrientFromDir(dirVec); + } + else + { + transMat.identity(); + } + + transMat.setColumn(3, tPos); + Parent::setTransform(transMat); +} + +void afxCamera::setCameraSubject(SceneObject* new_subject) +{ + // cleanup any existing chase subject + if (cam_subject) + { + if (dynamic_cast(cam_subject)) + clearProcessAfter(); + clearNotify(cam_subject); + } + + cam_subject = new_subject; + + // set associations with new chase subject + if (cam_subject) + { + if (dynamic_cast(cam_subject)) + processAfter((GameBase*)cam_subject); + deleteNotify(cam_subject); + } + + mode = (cam_subject) ? ThirdPersonMode : FlyMode; + setMaskBits(SubjectMask); +} + +void afxCamera::setThirdPersonOffset(const Point3F& offset) +{ + // new method + if (cam_distance > 0.0f) + { + if (isClientObject()) + { + GameConnection* conn = GameConnection::getConnectionToServer(); + if (conn) + { + // this auto switches to/from first person + if (conn->isFirstPerson()) + { + if (cam_distance >= 1.0f) + conn->setFirstPerson(false); + } + else + { + if (cam_distance < 1.0f) + conn->setFirstPerson(true); + } + } + } + + cam_offset = offset; + cam_dirty = true; + + return; + } + + // old backwards-compatible method + if (offset.y != cam_offset.y && isClientObject()) + { + GameConnection* conn = GameConnection::getConnectionToServer(); + if (conn) + { + // this auto switches to/from first person + if (conn->isFirstPerson()) + { + if (offset.y <= -1.0f) + conn->setFirstPerson(false); + } + else + { + if (offset.y > -1.0f) + conn->setFirstPerson(true); + } + } + } + + cam_offset = offset; + cam_dirty = true; +} + +void afxCamera::setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset) +{ + this->coi_offset = coi_offset; + setThirdPersonOffset(offset); +} + +void afxCamera::setThirdPersonDistance(F32 distance) +{ + cam_distance = distance; + cam_dirty = true; +} + +F32 afxCamera::getThirdPersonDistance() +{ + return cam_distance; +} + +void afxCamera::setThirdPersonAngle(F32 angle) +{ + cam_angle = angle; + cam_dirty = true; +} + +F32 afxCamera::getThirdPersonAngle() +{ + return cam_angle; +} + +void afxCamera::setThirdPersonMode() +{ + mode = ThirdPersonMode; + flymode_saved_pos = getPosition(); + flymode_saved = true; + cam_dirty = true; + third_person_snap_s++; +} + +void afxCamera::setThirdPersonSnap() +{ + if (mode == ThirdPersonMode) + third_person_snap_s += 2; +} + +void afxCamera::setThirdPersonSnapClient() +{ + if (mode == ThirdPersonMode) + third_person_snap_c++; +} + +const char* afxCamera::getMode() +{ + switch (mode) + { + case ThirdPersonMode: + return "ThirdPerson"; + case FlyMode: + return "Fly"; + case OrbitObjectMode: + return "Orbit"; + } + + return "Unknown"; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Console Methods + +static char buffer[100]; + +ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8, + "(GameBase orbitObject, transform mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" + "Set the camera to orbit around some given object.\n\n" + "@param orbitObject Object we want to orbit.\n" + "@param mat A set of fields: posX posY posZ aaX aaY aaZ aaTheta\n" + "@param minDistance Minimum distance to keep from object.\n" + "@param maxDistance Maximum distance to keep from object.\n" + "@param curDistance Distance to set initially from object.\n" + "@param ownClientObj Are we observing an object owned by us?") +{ + Point3F pos; + AngAxisF aa; + F32 minDis, maxDis, curDis; + + GameBase *orbitObject = NULL; + if(Sim::findObject(argv[2],orbitObject) == false) + { + Con::warnf("Cannot orbit non-existing object."); + object->setFlyMode(); + return; + } + + dSscanf(argv[3],"%f %f %f %f %f %f %f", + &pos.x,&pos.y,&pos.z,&aa.axis.x,&aa.axis.y,&aa.axis.z,&aa.angle); + minDis = dAtof(argv[4]); + maxDis = dAtof(argv[5]); + curDis = dAtof(argv[6]); + + object->setOrbitMode(orbitObject, pos, aa, minDis, maxDis, curDis, (argc == 8) ? dAtob(argv[7]) : false); +} + +ConsoleMethod( afxCamera, setFlyMode, void, 2, 2, "()" "Set the camera to be able to fly freely.") +{ + object->setFlyMode(); +} + +ConsoleMethod( afxCamera, getPosition, const char *, 2, 2, "()" + "Get the position of the camera.\n\n" + "@returns A string of form \"x y z\".") +{ + Point3F& pos = object->getPosition(); + dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); + return buffer; +} + +ConsoleMethod(afxCamera, setCameraSubject, bool, 3, 3, "") +{ + SceneObject* subject; + if (!Sim::findObject(argv[2], subject)) + { + Con::errorf("Camera subject \"%s\" not found.", argv[2].getStringValue()); + return false; + } + + object->setCameraSubject(subject); + + return true; +} + +ConsoleMethod(afxCamera, setThirdPersonDistance, bool, 3, 3, "") +{ + F32 distance; + dSscanf(argv[2], "%f", &distance); + + object->setThirdPersonDistance(distance); + + return true; +} + +ConsoleMethod(afxCamera, getThirdPersonDistance, F32, 2, 2, "") +{ + return object->getThirdPersonDistance(); +} + +ConsoleMethod(afxCamera, setThirdPersonAngle, bool, 3, 3, "") +{ + F32 angle; + dSscanf(argv[2], "%f", &angle); + + object->setThirdPersonAngle(angle); + + return true; +} + +ConsoleMethod(afxCamera, getThirdPersonAngle, F32, 2, 2, "") +{ + return object->getThirdPersonAngle(); +} + +ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, Point3f coi_offset])") +{ + Point3F offset; + dSscanf(argv[2], "%f %f %f", &offset.x, &offset.y, &offset.z); + if (argc > 3) + { + Point3F coi_offset; + dSscanf(argv[3], "%f %f %f", &coi_offset.x, &coi_offset.y, &coi_offset.z); + object->setThirdPersonOffset(offset, coi_offset); + } + else + object->setThirdPersonOffset(offset); +} + +ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()") +{ + const Point3F& pos = object->getThirdPersonOffset(); + dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); + return buffer; +} + +ConsoleMethod(afxCamera, getThirdPersonCOIOffset, const char *, 2, 2, "()") +{ + const Point3F& pos = object->getThirdPersonCOIOffset(); + dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); + return buffer; +} + +ConsoleMethod(afxCamera, setThirdPersonMode, void, 2, 2, "()") +{ + object->setThirdPersonMode(); +} + +ConsoleMethod(afxCamera, setThirdPersonSnap, void, 2, 2, "()") +{ + object->setThirdPersonSnap(); +} + +ConsoleMethod(afxCamera, getMode, const char *, 2, 2, "()") +{ + return object->getMode(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// 3POV SECTION + +void afxCamera::cam_update_3pov(F32 dt, bool on_server) +{ + Point3F goal_pos; + Point3F curr_pos = getRenderPosition(); + MatrixF xfm = cam_subject->getRenderTransform(); + Point3F coi = cam_subject->getRenderPosition() + coi_offset; + + // for player subjects, pitch is adjusted + Player* player_subj = dynamic_cast(cam_subject); + if (player_subj) + { + if (cam_distance > 0.0f) + { + // rotate xfm by amount of cam_angle + F32 look_yaw = player_subj->getHeadRotation().z + mDegToRad(-cam_angle); + MatrixF look_yaw_mtx(EulerF(0,0,look_yaw)); + xfm.mul(look_yaw_mtx); + + // rotate xfm by amount of head pitch in player + F32 head_pitch = player_subj->getHeadRotation().x; + MatrixF head_pitch_mtx(EulerF(head_pitch,0,0)); + xfm.mul(head_pitch_mtx); + + VectorF behind_vec(0, -cam_distance, 0); + xfm.mulP(behind_vec, &goal_pos); + goal_pos += cam_offset; + } + else // old backwards-compatible method + { + // rotate xfm by amount of head pitch in player + F32 head_pitch = player_subj->getHeadRotation().x; + MatrixF head_pitch_mtx(EulerF(head_pitch,0,0)); + xfm.mul(head_pitch_mtx); + + VectorF behind_vec(0, cam_offset.y, 0); + xfm.mulP(behind_vec, &goal_pos); + goal_pos.z += cam_offset.z; + } + } + // for non-player subjects, camera will follow, but pitch won't adjust. + else + { + xfm.mulP(cam_offset, &goal_pos); + } + + // avoid view occlusion + if (avoid_blocked_view(coi, goal_pos, goal_pos) && !on_server) + { + // snap to final position if path to goal is blocked + if (test_blocked_line(curr_pos, goal_pos)) + third_person_snap_c++; + } + + // place camera into its final position + + // speed factor values + // 15 -- tight + // 10 -- normal + // 5 -- loose + // 1 -- very loose + F32 speed_factor = 8.0f; + F32 time_inc = 1.0f/speed_factor; + + // snap to final position + if (on_server || (third_person_snap_c > 0 || dt > time_inc)) + { + snapToPosition(goal_pos); + if (!on_server && third_person_snap_c > 0) + third_person_snap_c--; + return; + } + // interpolate to final position + else + { + // interpretation: always move a proportion of the distance + // from current location to destination that would cover the + // entire distance in time_inc duration at constant velocity. + F32 t = (dt >= time_inc) ? 1.0f : dt*speed_factor; + snapToPosition(goal_pos*t + curr_pos*(1.0-t)); + } +} + +// See if the camera view is occluded by certain objects, +// and move the camera closer to the subject in that case +bool afxCamera::avoid_blocked_view(const Point3F& startpos, const Point3F& endpos, Point3F& newpos) +{ + // cast ray to check for intersection with potential blocker objects + RayInfo hit_info; + if (!getContainer()->castRay(startpos, endpos, afxCameraData::sCameraCollisionMask, &hit_info)) + { + // no hit: just return original endpos + newpos = endpos; + return false; + } + + // did hit: return the hit location nudged forward slightly + // to avoid seeing clipped portions of blocking object. + Point3F sight_line = startpos - hit_info.point; + sight_line.normalize(); + newpos = hit_info.point + sight_line*0.4f; + + return true; +} + +bool afxCamera::test_blocked_line(const Point3F& startpos, const Point3F& endpos) +{ + RayInfo hit_info; + return getContainer()->castRay(startpos, endpos, afxCameraData::sCameraCollisionMask, &hit_info); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// STD OVERRIDES SECTION + +bool afxCamera::onAdd() +{ + if(!Parent::onAdd()) + return false; + + mObjBox.maxExtents = mObjScale; + mObjBox.minExtents = mObjScale; + mObjBox.minExtents.neg(); + + resetWorldBox(); + + addToScene(); + + return true; +} + +void afxCamera::onRemove() +{ + removeFromScene(); + Parent::onRemove(); +} + +void afxCamera::onDeleteNotify(SimObject *obj) +{ + Parent::onDeleteNotify(obj); + + if (obj == (SimObject*)mOrbitObject) + { + mOrbitObject = NULL; + if (mode == OrbitObjectMode) + mode = OrbitPointMode; + } + + if (obj == cam_subject) + { + cam_subject = NULL; + } +} + +void afxCamera::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + if (gSFX3DWorld) + { + if (mode == ThirdPersonMode && cam_subject) + { + if (gSFX3DWorld->getListener() != cam_subject) + gSFX3DWorld->setListener(cam_subject); + } + else if (mode == FlyMode) + { + if (gSFX3DWorld->getListener() != this) + gSFX3DWorld->setListener(this); + } + } + + cam_update(dt, false); +} + +void afxCamera::processTick(const Move* move) +{ + Parent::processTick(move); + Point3F vec,pos; + + // move will be NULL unless camera becomes the control object as in FlyMode + if (move) + { + // UPDATE ORIENTATION // + delta.rotVec = mRot; + mObjToWorld.getColumn(3, &delta.posVec); + mRot.x = mClampF(mRot.x + move->pitch, -MaxPitch, MaxPitch); + mRot.z += move->yaw; + + // ORBIT MODE // + if (mode == OrbitObjectMode || mode == OrbitPointMode) + { + if(mode == OrbitObjectMode && bool(mOrbitObject)) + { + // If this is a shapebase, use its render eye transform + // to avoid jittering. + GameBase *castObj = mOrbitObject; + ShapeBase* shape = dynamic_cast(castObj); + if( shape != NULL ) { + MatrixF ret; + shape->getRenderEyeTransform( &ret ); + mPosition = ret.getPosition(); + } + else + { + // Hopefully this is a static object that doesn't move, + // because the worldbox doesn't get updated between ticks. + mOrbitObject->getWorldBox().getCenter(&mPosition); + } + } + set_cam_pos(mPosition, mRot); + validateEyePoint(1.0f, &mObjToWorld); + pos = mPosition; + } + + // NON-ORBIT MODE (FLY MODE) // + else // if (mode == FlyMode) + { + // Update pos + bool faster = move->trigger[0] || move->trigger[1]; + F32 scale = Camera::getMovementSpeed() * (faster + 1); + + mObjToWorld.getColumn(3,&pos); + mObjToWorld.getColumn(0,&vec); + pos += vec * move->x * TickSec * scale; + mObjToWorld.getColumn(1,&vec); + pos += vec * move->y * TickSec * scale; + mObjToWorld.getColumn(2,&vec); + pos += vec * move->z * TickSec * scale; + set_cam_pos(pos,mRot); + } + + // If on the client, calc delta for backstepping + if (isClientObject()) + { + delta.pos = pos; + delta.rot = mRot; + delta.posVec = delta.posVec - delta.pos; + delta.rotVec = delta.rotVec - delta.rot; + } + else + { + setMaskBits(MoveMask); + } + } + else // if (!move) + { + if (isServerObject()) + cam_update(1.0/32.0, true); + } + + if (getControllingClient() && mContainer) + updateContainer(); +} + +void afxCamera::interpolateTick(F32 dt) +{ + Parent::interpolateTick(dt); + + if (mode == ThirdPersonMode) + return; + + Point3F rot = delta.rot + delta.rotVec * dt; + + if(mode == OrbitObjectMode || mode == OrbitPointMode) + { + if(mode == OrbitObjectMode && bool(mOrbitObject)) + { + // If this is a shapebase, use its render eye transform + // to avoid jittering. + GameBase *castObj = mOrbitObject; + ShapeBase* shape = dynamic_cast(castObj); + if( shape != NULL ) + { + MatrixF ret; + shape->getRenderEyeTransform( &ret ); + mPosition = ret.getPosition(); + } + else + { + // Hopefully this is a static object that doesn't move, + // because the worldbox doesn't get updated between ticks. + mOrbitObject->getWorldBox().getCenter(&mPosition); + } + } + set_cam_pos(mPosition, rot); + validateEyePoint(1.0f, &mObjToWorld); + } + else + { + // NOTE - posVec is 0,0,0 unless cam is control-object and process tick is + // updating the delta + Point3F pos = delta.pos + delta.posVec * dt; + set_cam_pos(pos,rot); + } +} + +void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream) +{ + // Update client regardless of status flags. + Parent::writePacketData(connection, bstream); + + Point3F pos; mObjToWorld.getColumn(3, &pos); + bstream->setCompressionPoint(pos); // SET COMPRESSION POINT + mathWrite(*bstream, pos); // SND POS + bstream->write(mRot.x); // SND X ROT + bstream->write(mRot.z); // SND Z ROT + + if (bstream->writeFlag(cam_dirty)) + { + mathWrite(*bstream, cam_offset); // SND CAM_OFFSET + mathWrite(*bstream, coi_offset); // SND COI_OFFSET + bstream->write(cam_distance); + bstream->write(cam_angle); + cam_dirty = false; + } + + U32 writeMode = mode; + Point3F writePos = mPosition; + S32 gIndex = -1; + if (mode == OrbitObjectMode) + { + gIndex = bool(mOrbitObject) ? connection->getGhostIndex(mOrbitObject): -1; + if(gIndex == -1) + { + writeMode = OrbitPointMode; + mOrbitObject->getWorldBox().getCenter(&writePos); + } + } + + bstream->writeRangedU32(writeMode, CameraFirstMode, CameraLastMode); // SND MODE + if (writeMode == ThirdPersonMode) + { + bstream->write(third_person_snap_s > 0); // SND SNAP + if (third_person_snap_s > 0) + third_person_snap_s--; + } + + if (writeMode == OrbitObjectMode || writeMode == OrbitPointMode) + { + bstream->write(mMinOrbitDist); // SND ORBIT MIN DIST + bstream->write(mMaxOrbitDist); // SND ORBIT MAX DIST + bstream->write(mCurOrbitDist); // SND ORBIT CURR DIST + if(writeMode == OrbitObjectMode) + { + bstream->writeFlag(mObservingClientObject); // SND OBSERVING CLIENT OBJ + bstream->writeInt(gIndex, NetConnection::GhostIdBitSize); // SND ORBIT OBJ + } + if (writeMode == OrbitPointMode) + bstream->writeCompressedPoint(writePos); // WRITE COMPRESSION POINT + } +} + +void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream) +{ + Parent::readPacketData(connection, bstream); + + Point3F pos,rot; + mathRead(*bstream, &pos); // RCV POS + bstream->setCompressionPoint(pos); + bstream->read(&rot.x); // RCV X ROT + bstream->read(&rot.z); // RCV Z ROT + + if (bstream->readFlag()) + { + Point3F new_cam_offset, new_coi_offset; + mathRead(*bstream, &new_cam_offset); // RCV CAM_OFFSET + mathRead(*bstream, &new_coi_offset); // RCV COI_OFFSET + bstream->read(&cam_distance); + bstream->read(&cam_angle); + setThirdPersonOffset(new_cam_offset, new_coi_offset); + } + + GameBase* obj = 0; + mode = bstream->readRangedU32(CameraFirstMode, // RCV MODE + CameraLastMode); + if (mode == ThirdPersonMode) + { + bool snap; bstream->read(&snap); + if (snap) + third_person_snap_c++; + } + + mObservingClientObject = false; + if (mode == OrbitObjectMode || mode == OrbitPointMode) { + bstream->read(&mMinOrbitDist); + bstream->read(&mMaxOrbitDist); + bstream->read(&mCurOrbitDist); + + if(mode == OrbitObjectMode) + { + mObservingClientObject = bstream->readFlag(); + S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize); + obj = static_cast(connection->resolveGhost(gIndex)); + } + if (mode == OrbitPointMode) + bstream->readCompressedPoint(&mPosition); + } + if (obj != (GameBase*)mOrbitObject) { + if (mOrbitObject) { + clearProcessAfter(); + clearNotify(mOrbitObject); + } + mOrbitObject = obj; + if (mOrbitObject) { + processAfter(mOrbitObject); + deleteNotify(mOrbitObject); + } + } + + if (mode == ThirdPersonMode) + return; + + set_cam_pos(pos,rot); + delta.pos = pos; + delta.rot = rot; + delta.rotVec.set(0,0,0); + delta.posVec.set(0,0,0); +} + +U32 afxCamera::packUpdate(NetConnection* conn, U32 mask, BitStream *bstream) +{ + U32 retMask = Parent::packUpdate(conn,mask,bstream); + + // The rest of the data is part of the control object packet update. + // If we're controlled by this client, we don't need to send it. + //if(bstream->writeFlag(getControllingClient() == conn && !(mask & InitialUpdateMask))) + // return 0; + + if (bstream->writeFlag(mask & MoveMask)) { + Point3F pos; + mObjToWorld.getColumn(3,&pos); + bstream->write(pos.x); + bstream->write(pos.y); + bstream->write(pos.z); + bstream->write(mRot.x); + bstream->write(mRot.z); + } + + if (bstream->writeFlag(mask & SubjectMask)) + { + S32 ghost_id = (cam_subject) ? conn->getGhostIndex(cam_subject) : -1; + if (bstream->writeFlag(ghost_id != -1)) + bstream->writeRangedU32(U32(ghost_id), 0, NetConnection::MaxGhostCount); + else if (cam_subject) + retMask |= SubjectMask; + } + + return retMask; +} + +void afxCamera::unpackUpdate(NetConnection *conn, BitStream *bstream) +{ + Parent::unpackUpdate(conn,bstream); + + // controlled by the client? + //if(bstream->readFlag()) + // return; + + if (bstream->readFlag()) { + Point3F pos,rot; + bstream->read(&pos.x); + bstream->read(&pos.y); + bstream->read(&pos.z); + bstream->read(&rot.x); + bstream->read(&rot.z); + set_cam_pos(pos,rot); + + // New delta for client side interpolation + delta.pos = pos; + delta.rot = rot; + delta.posVec = delta.rotVec = VectorF(0,0,0); + } + + if (bstream->readFlag()) + { + if (bstream->readFlag()) + { + S32 ghost_id = bstream->readRangedU32(0, NetConnection::MaxGhostCount); + cam_subject = dynamic_cast(conn->resolveGhost(ghost_id)); + } + else + cam_subject = NULL; + } +} + +// Override to ensure both are kept in scope +void afxCamera::onCameraScopeQuery(NetConnection* conn, CameraScopeQuery* query) +{ + if (cam_subject) + conn->objectInScope(cam_subject); + Parent::onCameraScopeQuery(conn, query); +} + +//---------------------------------------------------------------------------- +// check if the object needs to be observed through its own camera... +void afxCamera::getCameraTransform(F32* pos, MatrixF* mat) +{ + // The camera doesn't support a third person mode, + // so we want to override the default ShapeBase behavior. + ShapeBase * obj = dynamic_cast(static_cast(mOrbitObject)); + if (obj && static_cast(obj->getDataBlock())->observeThroughObject) + obj->getCameraTransform(pos, mat); + else + getEyeTransform(mat); +} + +void afxCamera::setTransform(const MatrixF& mat) +{ + // This method should never be called on the client. + + // This currently converts all rotation in the mat into + // rotations around the z and x axis. + Point3F pos,vec; + mat.getColumn(1,&vec); + mat.getColumn(3,&pos); + Point3F rot(-mAtan2(vec.z, mSqrt(vec.x*vec.x + vec.y*vec.y)),0,-mAtan2(-vec.x,vec.y)); + set_cam_pos(pos,rot); +} + +void afxCamera::onEditorEnable() +{ + mNetFlags.set(Ghostable); +} + +void afxCamera::onEditorDisable() +{ + mNetFlags.clear(Ghostable); +} + +F32 afxCamera::getCameraFov() +{ + ShapeBase * obj = dynamic_cast(static_cast(mOrbitObject)); + if(obj && static_cast(obj->getDataBlock())->observeThroughObject) + return(obj->getCameraFov()); + else + return(Parent::getCameraFov()); +} + +F32 afxCamera::getDefaultCameraFov() +{ + ShapeBase * obj = dynamic_cast(static_cast(mOrbitObject)); + if(obj && static_cast(obj->getDataBlock())->observeThroughObject) + return(obj->getDefaultCameraFov()); + else + return(Parent::getDefaultCameraFov()); +} + +bool afxCamera::isValidCameraFov(F32 fov) +{ + ShapeBase * obj = dynamic_cast(static_cast(mOrbitObject)); + if(obj && static_cast(obj->getDataBlock())->observeThroughObject) + return(obj->isValidCameraFov(fov)); + else + return(Parent::isValidCameraFov(fov)); +} + +void afxCamera::setCameraFov(F32 fov) +{ + ShapeBase * obj = dynamic_cast(static_cast(mOrbitObject)); + if(obj && static_cast(obj->getDataBlock())->observeThroughObject) + obj->setCameraFov(fov); + else + Parent::setCameraFov(fov); +} + +F32 afxCamera::getDamageFlash() const +{ + if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) + { + const GameBase *castObj = mOrbitObject; + const ShapeBase* psb = dynamic_cast(castObj); + if (psb) + return psb->getDamageFlash(); + } + + return mDamageFlash; +} + +F32 afxCamera::getWhiteOut() const +{ + if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) + { + const GameBase *castObj = mOrbitObject; + const ShapeBase* psb = dynamic_cast(castObj); + if (psb) + return psb->getWhiteOut(); + } + + return mWhiteOut; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxCamera::setControllingClient( GameConnection* client ) +{ + GameBase::setControllingClient( client ); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxCamera.h b/Engine/source/afx/afxCamera.h new file mode 100644 index 000000000..934f293cf --- /dev/null +++ b/Engine/source/afx/afxCamera.h @@ -0,0 +1,189 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// afxCamera implements a modified camera for demonstrating a third person camera style +// which is more common to RPG games than the standard FPS style camera. For the most part, +// it is a hybrid of the standard TGE camera and the third person mode of the Advanced Camera +// resource, authored by Thomas "Man of Ice" Lund. This camera implements the bare minimum +// required for demonstrating an RPG style camera and leaves tons of room for improvement. +// It should be replaced with a better camera if possible. +// +// Advanced Camera Resource by Thomas "Man of Ice" Lund: +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5471 +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CAMERA_H_ +#define _AFX_CAMERA_H_ + +#ifndef _SHAPEBASE_H_ +#include "game/shapeBase.h" +#endif + +//---------------------------------------------------------------------------- +struct afxCameraData: public ShapeBaseData { + typedef ShapeBaseData Parent; + + static U32 sCameraCollisionMask; + + // + DECLARE_CONOBJECT(afxCameraData); + DECLARE_CATEGORY("AFX"); + static void initPersistFields(); + virtual void packData(BitStream* stream); + virtual void unpackData(BitStream* stream); +}; + + +//---------------------------------------------------------------------------- +// Implements a basic camera object. +class afxCamera: public ShapeBase +{ + typedef ShapeBase Parent; + + enum MaskBits { + MoveMask = Parent::NextFreeMask, + SubjectMask = Parent::NextFreeMask << 1, + NextFreeMask = Parent::NextFreeMask << 2 + }; + + struct StateDelta { + Point3F pos; + Point3F rot; + VectorF posVec; + VectorF rotVec; + }; + + enum + { + ThirdPersonMode = 1, + FlyMode = 2, + OrbitObjectMode = 3, + OrbitPointMode = 4, + CameraFirstMode = 0, + CameraLastMode = 4 + }; + +private: + int mode; + Point3F mRot; + StateDelta delta; + + SimObjectPtr mOrbitObject; + F32 mMinOrbitDist; + F32 mMaxOrbitDist; + F32 mCurOrbitDist; + Point3F mPosition; + bool mObservingClientObject; + + SceneObject* cam_subject; + Point3F cam_offset; + Point3F coi_offset; + F32 cam_distance; + F32 cam_angle; + bool cam_dirty; + + bool flymode_saved; + Point3F flymode_saved_pos; + S8 third_person_snap_c; + S8 third_person_snap_s; + + void set_cam_pos(const Point3F& pos, const Point3F& viewRot); + void cam_update(F32 dt, bool on_server); + +public: + /*C*/ afxCamera(); + /*D*/ ~afxCamera(); + + Point3F& getPosition(); + void setFlyMode(); + void setOrbitMode(GameBase* obj, Point3F& pos, AngAxisF& rot, F32 minDist, F32 maxDist, F32 curDist, bool ownClientObject); + void validateEyePoint(F32 pos, MatrixF *mat); + + GameBase* getOrbitObject() { return(mOrbitObject); } + bool isObservingClientObject() { return(mObservingClientObject); } + + void snapToPosition(const Point3F& pos); + void setCameraSubject(SceneObject* subject); + void setThirdPersonOffset(const Point3F& offset); + void setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset); + const Point3F& getThirdPersonOffset() const { return cam_offset; } + const Point3F& getThirdPersonCOIOffset() const { return coi_offset; } + void setThirdPersonDistance(F32 distance); + F32 getThirdPersonDistance(); + void setThirdPersonAngle(F32 angle); + F32 getThirdPersonAngle(); + void setThirdPersonMode(); + void setThirdPersonSnap(); + void setThirdPersonSnapClient(); + const char* getMode(); + + bool isCamera() const { return true; } + + DECLARE_CONOBJECT(afxCamera); + DECLARE_CATEGORY("AFX"); + +private: // 3POV SECTION + U32 blockers_mask_3pov; + + void cam_update_3pov(F32 dt, bool on_server); + bool avoid_blocked_view(const Point3F& start, const Point3F& end, Point3F& newpos); + bool test_blocked_line(const Point3F& start, const Point3F& end); + +public: // STD OVERRIDES SECTION + virtual bool onAdd(); + virtual void onRemove(); + virtual void onDeleteNotify(SimObject *obj); + + virtual void advanceTime(F32 dt); + virtual void processTick(const Move* move); + virtual void interpolateTick(F32 delta); + + virtual void writePacketData(GameConnection *conn, BitStream *stream); + virtual void readPacketData(GameConnection *conn, BitStream *stream); + virtual U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); + virtual void unpackUpdate(NetConnection *conn, BitStream *stream); + + virtual void onCameraScopeQuery(NetConnection* cr, CameraScopeQuery*); + virtual void getCameraTransform(F32* pos,MatrixF* mat); + virtual void setTransform(const MatrixF& mat); + + virtual void onEditorEnable(); + virtual void onEditorDisable(); + + virtual F32 getCameraFov(); + virtual F32 getDefaultCameraFov(); + virtual bool isValidCameraFov(F32 fov); + virtual void setCameraFov(F32 fov); + + virtual F32 getDamageFlash() const; + virtual F32 getWhiteOut() const; + + virtual void setControllingClient( GameConnection* connection ); +}; + + +#endif // _AFX_CAMERA_H_ diff --git a/Engine/source/afx/afxChoreographer.cpp b/Engine/source/afx/afxChoreographer.cpp new file mode 100644 index 000000000..581ba42ba --- /dev/null +++ b/Engine/source/afx/afxChoreographer.cpp @@ -0,0 +1,1084 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "T3D/gameBase/gameConnection.h" +#include "math/mathIO.h" +#include "console/compiler.h" + +#include "afx/afxConstraint.h" +#include "afx/afxChoreographer.h" +#include "afx/afxEffectWrapper.h" +#include "afx/util/afxParticlePool.h" +#include "afx/forces/afxForceSet.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxChoreographerData); + +ConsoleDocClass( afxChoreographerData, + "@brief Datablock base class used by choreographers.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxChoreographerData::afxChoreographerData() +{ + exec_on_new_clients = false; + echo_packet_usage = 100; + client_script_file = ST_NULLSTRING; + client_init_func = ST_NULLSTRING; +} + +afxChoreographerData::afxChoreographerData(const afxChoreographerData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + exec_on_new_clients = other.exec_on_new_clients; + echo_packet_usage = other.echo_packet_usage; + client_script_file = other.client_script_file; + client_init_func = other.client_init_func; +} + +#define myOffset(field) Offset(field, afxChoreographerData) + +void afxChoreographerData::initPersistFields() +{ + addField("execOnNewClients", TypeBool, myOffset(exec_on_new_clients), + "..."); + addField("echoPacketUsage", TypeS8, myOffset(echo_packet_usage), + "..."); + addField("clientScriptFile", TypeFilename, myOffset(client_script_file), + "..."); + addField("clientInitFunction", TypeString, myOffset(client_init_func), + "..."); + + Parent::initPersistFields(); +} + +void afxChoreographerData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(exec_on_new_clients); + stream->write(echo_packet_usage); + stream->writeString(client_script_file); + stream->writeString(client_init_func); +} + +void afxChoreographerData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&exec_on_new_clients); + stream->read(&echo_packet_usage); + client_script_file = stream->readSTString(); + client_init_func = stream->readSTString(); +} + +bool afxChoreographerData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + if (!server && client_script_file != ST_NULLSTRING) + { + Compiler::gSyntaxError = false; + Con::evaluate(avar("exec(\"%s\");", client_script_file), false, 0); + if (Compiler::gSyntaxError) + { + Con::errorf("afxChoreographerData: failed to exec clientScriptFile \"%s\" -- syntax error", client_script_file); + Compiler::gSyntaxError = false; + } + } + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxChoreographer); + +ConsoleDocClass( afxChoreographer, + "@brief Base class used by choreographers.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" +); + +afxChoreographer::afxChoreographer() +{ + datablock = 0; // datablock initializer (union these?) + exeblock = 0; // object to use in executef callouts + + // create the constraint manager + constraint_mgr = new afxConstraintMgr(); + + ranking = 0; + lod = 0; + exec_conds_mask = 0; + choreographer_id = 0; + extra = 0; + started_with_newop = false; + postpone_activation = false; + remapped_cons_sent = false; // CONSTRAINT REMAPPING + + dyn_cons_defs = &dc_defs_a; + dyn_cons_defs2 = &dc_defs_b; + + proc_after_obj = 0; + trigger_mask = 0; + + force_set_mgr = 0; + + mOrderGUID = 0x0FFFFFFF; +} + +afxChoreographer::~afxChoreographer() +{ + explicit_clients.clear(); + + for (S32 i = 0; i < dyn_cons_defs->size(); i++) + { + if ((*dyn_cons_defs)[i].cons_type == POINT_CONSTRAINT && (*dyn_cons_defs)[i].cons_obj.point != NULL) + delete (*dyn_cons_defs)[i].cons_obj.point; + else if ((*dyn_cons_defs)[i].cons_type == TRANSFORM_CONSTRAINT && (*dyn_cons_defs)[i].cons_obj.xfm != NULL) + delete (*dyn_cons_defs)[i].cons_obj.xfm; + } + + constraint_mgr->clearAllScopeableObjs(); + delete constraint_mgr; + + delete force_set_mgr; +} + +void afxChoreographer::initPersistFields() +{ + // conditionals + addField("extra", TYPEID(), Offset(extra, afxChoreographer), + "..."); + addField("postponeActivation", TypeBool, Offset(postpone_activation, afxChoreographer), + "..."); + + Parent::initPersistFields(); +} + +bool afxChoreographer::onAdd() +{ + if (!Parent::onAdd()) + return(false); + + if (isServerObject()) + choreographer_id = arcaneFX::registerChoreographer(this); + else + { + if (proc_after_obj) + { + processAfter(proc_after_obj); + proc_after_obj = 0; + } + + force_set_mgr = new afxForceSetMgr(); + + if (datablock && datablock->client_init_func != ST_NULLSTRING) + Con::executef(datablock->client_init_func, getIdString()); + } + + return(true); +} + +void afxChoreographer::onRemove() +{ + for (S32 i = 0; i < particle_pools.size(); i++) + if (particle_pools[i]) + particle_pools[i]->setChoreographer(0); + particle_pools.clear(); + + if (isServerObject()) + arcaneFX::unregisterChoreographer(this); + else + arcaneFX::unregisterClientChoreographer(this); + + choreographer_id = 0; + Parent::onRemove(); +} + +void afxChoreographer::onDeleteNotify(SimObject* obj) +{ + if (dynamic_cast(obj)) + { + SceneObject* scn_obj = (SceneObject*)(obj); + for (S32 i = 0; i < dyn_cons_defs->size(); i++) + if ((*dyn_cons_defs)[i].cons_type != OBJECT_CONSTRAINT || (*dyn_cons_defs)[i].cons_obj.object != scn_obj) + dyn_cons_defs2->push_back((*dyn_cons_defs)[i]); + + Vector* tmp = dyn_cons_defs; + dyn_cons_defs = dyn_cons_defs2; + dyn_cons_defs2 = tmp; + dyn_cons_defs2->clear(); + + if (isServerObject() && scn_obj->isScopeable()) + constraint_mgr->removeScopeableObject(scn_obj); + } + else if (dynamic_cast(obj)) + { + removeExplicitClient((NetConnection*)obj); + } + + Parent::onDeleteNotify(obj); +} + +bool afxChoreographer::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + datablock = dynamic_cast(dptr); + if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + exeblock = datablock; + + return true; +} + +void afxChoreographer::pack_constraint_info(NetConnection* conn, BitStream* stream) +{ + stream->write(dyn_cons_defs->size()); + for (S32 i = 0; i < dyn_cons_defs->size(); i++) + { + if ((*dyn_cons_defs)[i].cons_type == OBJECT_CONSTRAINT && (*dyn_cons_defs)[i].cons_obj.object != NULL) + { + stream->writeString((*dyn_cons_defs)[i].cons_name); + stream->write((*dyn_cons_defs)[i].cons_type); + SceneObject* object = (*dyn_cons_defs)[i].cons_obj.object; + S32 ghost_idx = conn->getGhostIndex(object); + if (stream->writeFlag(ghost_idx != -1)) + { + stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); + } + else + { + if (stream->writeFlag(object->getScopeId() > 0)) + { + stream->writeInt(object->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(object) != NULL); + } + } + } + else if ((*dyn_cons_defs)[i].cons_type == POINT_CONSTRAINT && (*dyn_cons_defs)[i].cons_obj.point != NULL) + { + stream->writeString((*dyn_cons_defs)[i].cons_name); + stream->write((*dyn_cons_defs)[i].cons_type); + mathWrite(*stream, *(*dyn_cons_defs)[i].cons_obj.point); + } + else if ((*dyn_cons_defs)[i].cons_type == TRANSFORM_CONSTRAINT && (*dyn_cons_defs)[i].cons_obj.xfm != NULL) + { + stream->writeString((*dyn_cons_defs)[i].cons_name); + stream->write((*dyn_cons_defs)[i].cons_type); + mathWrite(*stream, *(*dyn_cons_defs)[i].cons_obj.xfm); + } + } + + constraint_mgr->packConstraintNames(conn, stream); +} + +void afxChoreographer::unpack_constraint_info(NetConnection* conn, BitStream* stream) +{ + S32 n_defs; + stream->read(&n_defs); + dyn_cons_defs->clear(); + for (S32 i = 0; i < n_defs; i++) + { + StringTableEntry cons_name = stream->readSTString(); + U8 cons_type; stream->read(&cons_type); + if (cons_type == OBJECT_CONSTRAINT) + { + SceneObject* scn_obj = NULL; + if (stream->readFlag()) + { + S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); + scn_obj = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (scn_obj) + { + addObjectConstraint(scn_obj, cons_name); + } + else + Con::errorf("CANNOT RESOLVE GHOST %d %s", ghost_idx, cons_name); + } + else + { + if (stream->readFlag()) + { + U16 scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + bool is_shape = stream->readFlag(); + addObjectConstraint(scope_id, cons_name, is_shape); + } + } + } + else if (cons_type == POINT_CONSTRAINT) + { + Point3F point; + mathRead(*stream, &point); + addPointConstraint(point, cons_name); + } + else if (cons_type == TRANSFORM_CONSTRAINT) + { + MatrixF xfm; + mathRead(*stream, &xfm); + addTransformConstraint(xfm, cons_name); + } + } + + constraint_mgr->unpackConstraintNames(stream); +} + +void afxChoreographer::setup_dynamic_constraints() +{ + for (S32 i = 0; i < dyn_cons_defs->size(); i++) + { + switch ((*dyn_cons_defs)[i].cons_type) + { + case OBJECT_CONSTRAINT: + constraint_mgr->setReferenceObject((*dyn_cons_defs)[i].cons_name, (*dyn_cons_defs)[i].cons_obj.object); + break; + case POINT_CONSTRAINT: + constraint_mgr->setReferencePoint((*dyn_cons_defs)[i].cons_name, *(*dyn_cons_defs)[i].cons_obj.point); + break; + case TRANSFORM_CONSTRAINT: + constraint_mgr->setReferenceTransform((*dyn_cons_defs)[i].cons_name, *(*dyn_cons_defs)[i].cons_obj.xfm); + break; + case OBJECT_CONSTRAINT_SANS_OBJ: + constraint_mgr->setReferenceObjectByScopeId((*dyn_cons_defs)[i].cons_name, (*dyn_cons_defs)[i].cons_obj.scope_id, false); + break; + case OBJECT_CONSTRAINT_SANS_SHAPE: + constraint_mgr->setReferenceObjectByScopeId((*dyn_cons_defs)[i].cons_name, (*dyn_cons_defs)[i].cons_obj.scope_id, true); + break; + } + } +} + +afxChoreographer::dynConstraintDef* afxChoreographer::find_cons_def_by_name(const char* cons_name) +{ + StringTableEntry cons_name_ste = StringTable->insert(cons_name); + + for (S32 i = 0; i < dyn_cons_defs->size(); i++) + { + if ((*dyn_cons_defs)[i].cons_name == cons_name_ste) + return &((*dyn_cons_defs)[i]); + } + + return 0; +} + +void afxChoreographer::check_packet_usage(NetConnection* conn, BitStream* stream, S32 mark_stream_pos, const char* msg_tag) +{ + + S32 packed_size = stream->getCurPos() - mark_stream_pos; + S32 current_headroom = stream->getMaxWriteBitNum()-(stream->getStreamSize()<<3); + S32 max_headroom = stream->getMaxWriteBitNum()-(conn->getMaxRatePacketSize()<<3); + + if (packed_size > max_headroom) + { + Con::errorf("%s [%s] WARNING -- packed-bits (%d) > limit (%d) for max PacketSize settings. [%s]", + msg_tag, datablock->getName(), packed_size, max_headroom, "PACKET OVERRUN POSSIBLE"); + Con::errorf("getMaxRatePacketSize()=%d getCurRatePacketSize()=%d", conn->getMaxRatePacketSize(), conn->getCurRatePacketSize()); + } + // JTF Note: this current_headroom > 0 check is odd and occurs when object is created real early + // in the startup, such as when the dead orc gets fatal damage and we try to post a text effect. + else if (packed_size > current_headroom && current_headroom > 0) + { + Con::errorf("%s [%s] WARNING -- packed-bits (%d) > limit (%d) for current PacketSize settings. [%s]", + msg_tag, datablock->getName(), packed_size, current_headroom, "PACKET OVERRUN POSSIBLE"); + } + else + { + F32 percentage = 100.0f*((F32)packed_size/(F32)max_headroom); + if (percentage >= datablock->echo_packet_usage) + { + Con::warnf("%s [%s] -- packed-bits (%d) < limit (%d). [%.1f%% full]", msg_tag, datablock->getName(), + packed_size, max_headroom, percentage); + } + } +} + +SceneObject* afxChoreographer::get_camera(Point3F* cam_pos) const +{ + GameConnection* conn = GameConnection::getConnectionToServer(); + if (!conn) + { + if (cam_pos) + cam_pos->zero(); + return 0; + } + + SceneObject* cam_obj = conn->getCameraObject(); + if (cam_pos) + { + if (cam_obj) + { + MatrixF cam_mtx; + conn->getControlCameraTransform(0, &cam_mtx); + cam_mtx.getColumn(3, cam_pos); + } + else + cam_pos->zero(); + } + + return cam_obj; +} + +U32 afxChoreographer::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) +{ + U32 retMask = Parent::packUpdate(conn, mask, stream); + + if (stream->writeFlag(mask & InitialUpdateMask)) //-- INITIAL UPDATE ? + { + stream->write(ranking); + stream->write(lod); + stream->write(exec_conds_mask); + stream->write(choreographer_id); + + // write dynamic fields beginning with arcaneFX::sParameterFieldPrefix + SimFieldDictionaryIterator itr(getFieldDictionary()); + SimFieldDictionary::Entry* entry; + U32 prefix_len = dStrlen(arcaneFX::sParameterFieldPrefix); + if (prefix_len > 0) + { + while ((entry = *itr) != NULL) + { + if (dStrncmp(entry->slotName, arcaneFX::sParameterFieldPrefix, prefix_len) == 0) + { + stream->writeFlag(true); + stream->writeString(entry->slotName); + stream->writeLongString(1023, entry->value); + } + ++itr; + } + } + stream->writeFlag(false); + } + + if (stream->writeFlag(mask & TriggerMask)) + { + stream->write(trigger_mask); + } + + // CONSTRAINT REMAPPING << + if (stream->writeFlag((mask & RemapConstraintMask) && !remapped_cons_defs.empty())) + { + remapped_cons_sent = true; + //Con::errorf("PACKING CONS REMAP %d conn:%d", remapped_cons_defs.size(), (U32) conn); + + stream->write(remapped_cons_defs.size()); + for (S32 i = 0; i < remapped_cons_defs.size(); i++) + { + if (remapped_cons_defs[i]->cons_type == OBJECT_CONSTRAINT && remapped_cons_defs[i]->cons_obj.object != NULL) + { + //Con::errorf("PACKING CONS REMAP: name %s", remapped_cons_defs[i]->cons_name); + stream->writeString(remapped_cons_defs[i]->cons_name); + //Con::errorf("PACKING CONS REMAP: type %d", remapped_cons_defs[i]->cons_type); + stream->write(remapped_cons_defs[i]->cons_type); + SceneObject* object = remapped_cons_defs[i]->cons_obj.object; + S32 ghost_idx = conn->getGhostIndex(object); + //Con::errorf("PACKING CONS REMAP: ghost %d", ghost_idx); + if (stream->writeFlag(ghost_idx != -1)) + { + stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); + } + else + { + if (stream->writeFlag(object->getScopeId() > 0)) + { + stream->writeInt(object->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(object) != NULL); + } + } + } + else if (remapped_cons_defs[i]->cons_type == POINT_CONSTRAINT && remapped_cons_defs[i]->cons_obj.point != NULL) + { + stream->writeString(remapped_cons_defs[i]->cons_name); + stream->write(remapped_cons_defs[i]->cons_type); + mathWrite(*stream, *remapped_cons_defs[i]->cons_obj.point); + } + else if (remapped_cons_defs[i]->cons_type == TRANSFORM_CONSTRAINT && remapped_cons_defs[i]->cons_obj.xfm != NULL) + { + stream->writeString(remapped_cons_defs[i]->cons_name); + stream->write(remapped_cons_defs[i]->cons_type); + mathWrite(*stream, *remapped_cons_defs[i]->cons_obj.xfm); + } + } + } + // CONSTRAINT REMAPPING >> + + AssertISV(stream->isValid(), "afxChoreographer::packUpdate(): write failure occurred, possibly caused by packet-size overrun."); + + return retMask; +} + +void afxChoreographer::unpackUpdate(NetConnection * conn, BitStream * stream) +{ + Parent::unpackUpdate(conn, stream); + + // InitialUpdate Only + if (stream->readFlag()) + { + stream->read(&ranking); + stream->read(&lod); + stream->read(&exec_conds_mask); + stream->read(&choreographer_id); + + // read dynamic fields + while(stream->readFlag()) + { + char slotName[256]; + char value[1024]; + stream->readString(slotName); + stream->readLongString(1023, value); + setDataField(StringTable->insert(slotName), 0, value); + } + + arcaneFX::registerClientChoreographer(this); + } + + if (stream->readFlag()) // TriggerMask + { + stream->read(&trigger_mask); + } + + // CONSTRAINT REMAPPING << + if (stream->readFlag()) // RemapConstraintMask + { + S32 n_defs; + stream->read(&n_defs); + for (S32 i = 0; i < n_defs; i++) + { + StringTableEntry cons_name = stream->readSTString(); + U8 cons_type; stream->read(&cons_type); + if (cons_type == OBJECT_CONSTRAINT) + { + SceneObject* scn_obj = NULL; + if (stream->readFlag()) + { + S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); + scn_obj = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (scn_obj) + { + remapObjectConstraint(scn_obj, cons_name); + } + else + Con::errorf("CANNOT RESOLVE GHOST %d %s", ghost_idx, cons_name); + } + else + { + if (stream->readFlag()) + { + U16 scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + bool is_shape = stream->readFlag(); + remapObjectConstraint(scope_id, cons_name, is_shape); + } + } + } + else if (cons_type == POINT_CONSTRAINT) + { + Point3F point; + mathRead(*stream, &point); + remapPointConstraint(point, cons_name); + } + else if (cons_type == TRANSFORM_CONSTRAINT) + { + MatrixF xfm; + mathRead(*stream, &xfm); + remapTransformConstraint(xfm, cons_name); + } + } + } + // CONSTRAINT REMAPPING >> +} + +void afxChoreographer::executeScriptEvent(const char* method, afxConstraint* cons, + const MatrixF& xfm, const char* data) +{ + SceneObject* cons_obj = (cons) ? cons->getSceneObject() : NULL; + + char *arg_buf = Con::getArgBuffer(256); + Point3F pos; + xfm.getColumn(3,&pos); + AngAxisF aa(xfm); + dSprintf(arg_buf,256,"%g %g %g %g %g %g %g", + pos.x, pos.y, pos.z, + aa.axis.x, aa.axis.y, aa.axis.z, aa.angle); + + // CALL SCRIPT afxChoreographerData::method(%choreographer, %constraint, %transform, %data) + Con::executef(exeblock, method, + getIdString(), + (cons_obj) ? cons_obj->getIdString() : "", + arg_buf, + data); +} + +void afxChoreographer::addObjectConstraint(SceneObject* object, const char* cons_name) +{ + if (!object || !cons_name) + return; + + dynConstraintDef dyn_def; + dyn_def.cons_name = StringTable->insert(cons_name); + dyn_def.cons_type = OBJECT_CONSTRAINT; + dyn_def.cons_obj.object = object; + dyn_cons_defs->push_back(dyn_def); + +#if defined(AFX_CAP_SCOPE_TRACKING) + if (isServerObject() && object->isScopeable()) + constraint_mgr->addScopeableObject(object); +#endif + + constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, dyn_def.cons_name); + deleteNotify(object); +} + +void afxChoreographer::addObjectConstraint(U16 scope_id, const char* cons_name, bool is_shape) +{ + if (!cons_name) + return; + + dynConstraintDef dyn_def; + dyn_def.cons_name = StringTable->insert(cons_name); + dyn_def.cons_type = (is_shape) ? OBJECT_CONSTRAINT_SANS_SHAPE : OBJECT_CONSTRAINT_SANS_OBJ; + dyn_def.cons_obj.scope_id = scope_id; + dyn_cons_defs->push_back(dyn_def); + + constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, dyn_def.cons_name); +} + +void afxChoreographer::addPointConstraint(Point3F& point, const char* cons_name) +{ + dynConstraintDef dyn_def; + dyn_def.cons_name = StringTable->insert(cons_name); + dyn_def.cons_type = POINT_CONSTRAINT; + dyn_def.cons_obj.point = new Point3F(point); + dyn_cons_defs->push_back(dyn_def); + + constraint_mgr->defineConstraint(POINT_CONSTRAINT, dyn_def.cons_name); +} + +void afxChoreographer::addTransformConstraint(MatrixF& xfm, const char* cons_name) +{ + dynConstraintDef dyn_def; + dyn_def.cons_name = StringTable->insert(cons_name); + dyn_def.cons_type = TRANSFORM_CONSTRAINT; + dyn_def.cons_obj.xfm = new MatrixF(xfm); + dyn_cons_defs->push_back(dyn_def); + + constraint_mgr->defineConstraint(TRANSFORM_CONSTRAINT, dyn_def.cons_name); +} + +// CONSTRAINT REMAPPING << +static inline U32 resolve_cons_spec(const char* source_spec, Point3F& pos, MatrixF& xfm, SceneObject** scn_obj) +{ + AngAxisF aa; + + S32 args_n = dSscanf(source_spec, "%g %g %g %g %g %g %g", + &pos.x, &pos.y, &pos.z, + &aa.axis.x, &aa.axis.y, &aa.axis.z, &aa.angle); + + // TRANSFORM CONSTRAINT SRC + if (args_n == 7) + { + aa.setMatrix(&xfm); + xfm.setColumn(3,pos); + return afxEffectDefs::TRANSFORM_CONSTRAINT; + } + + // POINT CONSTRAINT SRC + if (args_n == 3) + { + return afxEffectDefs::POINT_CONSTRAINT; + } + + SimObject* cons_sim_obj = Sim::findObject(source_spec); + *scn_obj = dynamic_cast(cons_sim_obj); + if (*scn_obj) + { + return afxEffectDefs::OBJECT_CONSTRAINT; + } + + return afxEffectDefs::UNDEFINED_CONSTRAINT_TYPE; +} +// CONSTRAINT REMAPPING >> + +bool afxChoreographer::addConstraint(const char* source_spec, const char* cons_name) +{ + VectorF pos; + MatrixF xfm; + SceneObject* scn_obj; + + switch (resolve_cons_spec(source_spec, pos, xfm, &scn_obj)) + { + case TRANSFORM_CONSTRAINT: + addTransformConstraint(xfm, cons_name); + return true; + case POINT_CONSTRAINT: + addPointConstraint(pos, cons_name); + return true; + case OBJECT_CONSTRAINT: + addObjectConstraint(scn_obj, cons_name); + return true; + } + + return false; +} + +void afxChoreographer::addNamedEffect(afxEffectWrapper* ew) +{ + named_effects.addObject(ew); +} + +void afxChoreographer::removeNamedEffect(afxEffectWrapper* ew) +{ + named_effects.removeObject(ew); +} + +afxEffectWrapper* afxChoreographer::findNamedEffect(StringTableEntry name) +{ + return (afxEffectWrapper*) named_effects.findObject(name); +} + +void afxChoreographer::setGhostConstraintObject(SceneObject* obj, StringTableEntry cons_name) +{ + if (constraint_mgr) + constraint_mgr->setReferenceObject(cons_name, obj); +} + +void afxChoreographer::restoreScopedObject(SceneObject* obj) +{ + constraint_mgr->restoreScopedObject(obj, this); + constraint_mgr->adjustProcessOrdering(this); +} + +void afxChoreographer::addExplicitClient(NetConnection* conn) +{ + if (!conn) + return; + + for (S32 i = 0; i < explicit_clients.size(); i++) + { + if (explicit_clients[i] == conn) + return; + } + + explicit_clients.push_back(conn); + deleteNotify(conn); +} + +void afxChoreographer::removeExplicitClient(NetConnection* conn) +{ + if (!conn) + return; + + for (S32 i = 0; i < explicit_clients.size(); i++) + { + if (explicit_clients[i] == conn) + { + clearNotify(conn); + explicit_clients.erase_fast(i); + return; + } + } +} + +void afxChoreographer::postProcessAfterObject(GameBase* obj) +{ + proc_after_obj = obj; +} + +void afxChoreographer::setTriggerMask(U32 mask) +{ + if (mask != trigger_mask) + { + trigger_mask = mask; + setMaskBits(TriggerMask); + } +} + +afxParticlePool* afxChoreographer::findParticlePool(afxParticlePoolData* key_block, U32 key_index) +{ + for (S32 i = 0; i < particle_pools.size(); i++) + if (particle_pools[i] && particle_pools[i]->hasMatchingKeyBlock(key_block, key_index)) + return particle_pools[i]; + + return 0; +} + +void afxChoreographer::registerParticlePool(afxParticlePool* pool) +{ + particle_pools.push_back(pool); +} + +void afxChoreographer::unregisterParticlePool(afxParticlePool* pool) +{ + for (S32 i = 0; i < particle_pools.size(); i++) + if (particle_pools[i] == pool) + { + particle_pools.erase_fast(i); + return; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod( afxChoreographer, setRanking, void, ( unsigned int ranking ),, + "Set a ranking value (0-255) for the choreographer.\n" ) +{ + object->setRanking((U8)ranking); +} + +DefineEngineMethod( afxChoreographer, setLevelOfDetail, void, ( unsigned int lod ),, + "Set a level-of-detail value (0-255) for the choreographer.\n" ) +{ + object->setLevelOfDetail((U8)lod); +} + +DefineEngineMethod( afxChoreographer, setExecConditions, void, ( U32 mask ),, + "Set a bitmask to specifiy the state of exec-conditions.\n" ) +{ + object->setExecConditions(afxChoreographer::USER_EXEC_CONDS_MASK & mask); +} + +DefineEngineMethod( afxChoreographer, addConstraint, void, ( const char* source, const char* name),, + "Add a dynamic constraint consistiing of a source and name. The source can be a SceneObject, a 3-valued position, or a 7-valued transform.\n" ) +{ + if (!object->addConstraint(source, name)) + Con::errorf("afxChoreographer::addConstraint() -- failed to resolve constraint source [%s].", source); +} + +DefineEngineMethod( afxChoreographer, addExplicitClient, void, ( NetConnection* client ),, + "Add an explicit client.\n" ) +{ + if (!client) + { + Con::errorf(ConsoleLogEntry::General, "afxChoreographer::addExplicitClient: Failed to resolve client connection"); + return; + } + + object->addExplicitClient(client); +} + +DefineEngineMethod( afxChoreographer, setTriggerBit, void, ( U32 bit_num ),, + "Set a bit of the trigger-mask.\n" ) +{ + U32 set_bit = 1 << bit_num; + object->setTriggerMask(set_bit | object->getTriggerMask()); +} + +DefineEngineMethod( afxChoreographer, clearTriggerBit, void, ( U32 bit_num ),, + "Unset a bit of the trigger-mask.\n" ) +{ + U32 clear_bit = 1 << bit_num; + object->setTriggerMask(~clear_bit & object->getTriggerMask()); +} + +DefineEngineMethod( afxChoreographer, testTriggerBit, bool, ( U32 bit_num ),, + "Test state of a trigger-mask bit.\n" ) +{ + U32 test_bit = 1 << bit_num; + return ((test_bit & object->getTriggerMask()) != 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// CONSTRAINT REMAPPING << + +void afxChoreographer::remapObjectConstraint(SceneObject* object, const char* cons_name) +{ + if (!object || !cons_name) + return; + + // must be a constraint-def with a matching name in the list + dynConstraintDef* dyn_def = find_cons_def_by_name(cons_name); + if (!dyn_def) + { + Con::errorf("afxChoreographer::remapObjectConstraint() -- failed to find constraint name [%s].", cons_name); + return; + } + + // constraint-def must have matching name constraint-type + if (dyn_def->cons_type != OBJECT_CONSTRAINT) + { + Con::errorf("afxChoreographer::remapObjectConstraint() -- remapped contraint type does not match existing constraint type."); + return; + } + + // nothing to do if new object is same as old + if (dyn_def->cons_obj.object == object) + { +#ifdef TORQUE_DEBUG + Con::warnf("afxChoreographer::remapObjectConstraint() -- remapped contraint object is same as existing object."); +#endif + return; + } + + dyn_def->cons_obj.object = object; + deleteNotify(object); + + constraint_mgr->setReferenceObject(StringTable->insert(cons_name), object); + +#if defined(AFX_CAP_SCOPE_TRACKING) + if (isServerObject() && object->isScopeable()) + constraint_mgr->addScopeableObject(object); +#endif + + if (isServerObject()) + { + if (remapped_cons_sent) + { + remapped_cons_defs.clear(); + remapped_cons_sent = false; + } + remapped_cons_defs.push_back(dyn_def); + setMaskBits(RemapConstraintMask); + } +} + +void afxChoreographer::remapObjectConstraint(U16 scope_id, const char* cons_name, bool is_shape) +{ + if (!cons_name) + return; + + // must be a constraint-def with a matching name in the list + dynConstraintDef* dyn_def = find_cons_def_by_name(cons_name); + if (!dyn_def) + { + Con::errorf("afxChoreographer::remapObjectConstraint() -- failed to find constraint name [%s].", cons_name); + return; + } + + // constraint-def must have matching name constraint-type + if (dyn_def->cons_type != OBJECT_CONSTRAINT) + { + Con::errorf("afxChoreographer::remapObjectConstraint() -- remapped contraint type does not match existing constraint type."); + return; + } + + constraint_mgr->setReferenceObjectByScopeId(StringTable->insert(cons_name), scope_id, is_shape); +} + +void afxChoreographer::remapPointConstraint(Point3F& point, const char* cons_name) +{ + // must be a constraint-def with a matching name in the list + dynConstraintDef* dyn_def = find_cons_def_by_name(cons_name); + if (!dyn_def) + { + Con::errorf("afxChoreographer::remapPointConstraint() -- failed to find constraint name [%s].", cons_name); + return; + } + + // constraint-def must have matching name constraint-type + if (dyn_def->cons_type != POINT_CONSTRAINT) + { + Con::errorf("afxChoreographer::remapPointConstraint() -- remapped contraint type does not match existing constraint type."); + return; + } + + *dyn_def->cons_obj.point = point; + + constraint_mgr->setReferencePoint(StringTable->insert(cons_name), point); + + if (isServerObject()) + { + if (remapped_cons_sent) + { + remapped_cons_defs.clear(); + remapped_cons_sent = false; + } + remapped_cons_defs.push_back(dyn_def); + setMaskBits(RemapConstraintMask); + } +} + +void afxChoreographer::remapTransformConstraint(MatrixF& xfm, const char* cons_name) +{ + // must be a constraint-def with a matching name in the list + dynConstraintDef* dyn_def = find_cons_def_by_name(cons_name); + if (!dyn_def) + { + Con::errorf("afxChoreographer::remapTransformConstraint() -- failed to find constraint name [%s].", cons_name); + return; + } + + // constraint-def must have matching name constraint-type + if (dyn_def->cons_type != POINT_CONSTRAINT) + { + Con::errorf("afxChoreographer::remapTransformConstraint() -- remapped contraint type does not match existing constraint type."); + return; + } + + *dyn_def->cons_obj.xfm = xfm; + + constraint_mgr->setReferenceTransform(StringTable->insert(cons_name), xfm); + + if (isServerObject()) + { + if (remapped_cons_sent) + { + remapped_cons_defs.clear(); + remapped_cons_sent = false; + } + remapped_cons_defs.push_back(dyn_def); + setMaskBits(RemapConstraintMask); + } +} + +bool afxChoreographer::remapConstraint(const char* source_spec, const char* cons_name) +{ + SceneObject* scn_obj; + Point3F pos; + MatrixF xfm; + + switch (resolve_cons_spec(source_spec, pos, xfm, &scn_obj)) + { + case TRANSFORM_CONSTRAINT: + //addTransformConstraint(xfm, cons_name); + return true; + case POINT_CONSTRAINT: + //addPointConstraint(pos, cons_name); + return true; + case OBJECT_CONSTRAINT: + remapObjectConstraint(scn_obj, cons_name); + return true; + } + + return false; +} + +DefineEngineMethod( afxChoreographer, remapConstraint, void, ( const char* source, const char* name),, + "Remap a dynamic constraint to use a new source. The source can be a SceneObject, a 3-valued position, or a 7-valued transform. but must match type of existing source.\n" ) +{ + if (!object->remapConstraint(source, name)) + Con::errorf("afxChoreographer::remapConstraint() -- failed to resolve constraint source [%s].", source); +} + +// CONSTRAINT REMAPPING >> + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxChoreographer.h b/Engine/source/afx/afxChoreographer.h new file mode 100644 index 000000000..3665e1306 --- /dev/null +++ b/Engine/source/afx/afxChoreographer.h @@ -0,0 +1,222 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CHOREOGRAPHER_H_ +#define _AFX_CHOREOGRAPHER_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afxEffectDefs.h" +#include "afxEffectWrapper.h" +#include "afxMagicMissile.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxChoreographerData + +class afxChoreographerData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + bool exec_on_new_clients; + U8 echo_packet_usage; + StringTableEntry client_script_file; + StringTableEntry client_init_func; + +public: + /*C*/ afxChoreographerData(); + /*C*/ afxChoreographerData(const afxChoreographerData&, bool = false); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxChoreographerData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxChoreographer + +class afxConstraint; +class afxConstraintMgr; +class afxEffectWrapper; +class afxParticlePool; +class afxParticlePoolData; +class SimSet; +class afxForceSetMgr; + +class afxChoreographer : public GameBase, public afxEffectDefs, public afxMagicMissileCallback +{ + typedef GameBase Parent; + +public: + enum MaskBits + { + TriggerMask = Parent::NextFreeMask << 0, + RemapConstraintMask = Parent::NextFreeMask << 1, // CONSTRAINT REMAPPING + NextFreeMask = Parent::NextFreeMask << 2 + }; + + enum + { + USER_EXEC_CONDS_MASK = 0x00ffffff + }; + +protected: + struct dynConstraintDef + { + StringTableEntry cons_name; + U8 cons_type; + union + { + SceneObject* object; + Point3F* point; + MatrixF* xfm; + U16 scope_id; + } cons_obj; + }; + +private: + afxChoreographerData* datablock; + SimSet named_effects; + SimObject* exeblock; + afxForceSetMgr* force_set_mgr; + Vector particle_pools; + Vector dc_defs_a; + Vector dc_defs_b; + GameBase* proc_after_obj; + U32 trigger_mask; + +protected: + Vector* dyn_cons_defs; + Vector* dyn_cons_defs2; + afxConstraintMgr* constraint_mgr; + U32 choreographer_id; + U8 ranking; + U8 lod; + U32 exec_conds_mask; + SimObject* extra; + Vector explicit_clients; + bool started_with_newop; + bool postpone_activation; + + virtual void pack_constraint_info(NetConnection* conn, BitStream* stream); + virtual void unpack_constraint_info(NetConnection* conn, BitStream* stream); + void setup_dynamic_constraints(); + void check_packet_usage(NetConnection*, BitStream*, S32 mark_stream_pos, const char* msg_tag); + SceneObject* get_camera(Point3F* cam_pos=0) const; + +public: + /*C*/ afxChoreographer(); + virtual ~afxChoreographer(); + + static void initPersistFields(); + + virtual bool onAdd(); + virtual void onRemove(); + virtual void onDeleteNotify(SimObject*); + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + + virtual void sync_with_clients() { } + + afxConstraintMgr* getConstraintMgr() { return constraint_mgr; } + afxForceSetMgr* getForceSetMgr() { return force_set_mgr; } + + afxParticlePool* findParticlePool(afxParticlePoolData* key_block, U32 key_index); + void registerParticlePool(afxParticlePool*); + void unregisterParticlePool(afxParticlePool*); + + void setRanking(U8 value) { ranking = value; } + U8 getRanking() const { return ranking; } + bool testRanking(U8 low, U8 high) { return (ranking <= high && ranking >= low); } + void setLevelOfDetail(U8 value) { lod = value; } + U8 getLevelOfDetail() const { return lod; } + bool testLevelOfDetail(U8 low, U8 high) { return (lod <= high && lod >= low); } + void setExecConditions(U32 mask) { exec_conds_mask = mask; } + U32 getExecConditions() const { return exec_conds_mask; } + + virtual void executeScriptEvent(const char* method, afxConstraint*, + const MatrixF& xfm, const char* data); + + virtual void inflictDamage(const char * label, const char* flavor, SimObjectId target, + F32 amt, U8 count, F32 ad_amt, F32 rad, Point3F pos, F32 imp) { } + + void addObjectConstraint(SceneObject*, const char* cons_name); + void addObjectConstraint(U16 scope_id, const char* cons_name, bool is_shape); + void addPointConstraint(Point3F&, const char* cons_name); + void addTransformConstraint(MatrixF&, const char* cons_name); + bool addConstraint(const char* source_spec, const char* cons_name); + + void addNamedEffect(afxEffectWrapper*); + void removeNamedEffect(afxEffectWrapper*); + afxEffectWrapper* findNamedEffect(StringTableEntry); + + void clearChoreographerId() { choreographer_id = 0; } + U32 getChoreographerId() { return choreographer_id; } + void setGhostConstraintObject(SceneObject*, StringTableEntry cons_name); + void setExtra(SimObject* extra) { this->extra = extra; } + void addExplicitClient(NetConnection* conn); + void removeExplicitClient(NetConnection* conn); + U32 getExplicitClientCount() { return explicit_clients.size(); } + + void restoreScopedObject(SceneObject* obj); + virtual void restoreObject(SceneObject*) { }; + + void postProcessAfterObject(GameBase* obj); + U32 getTriggerMask() const { return trigger_mask; } + void setTriggerMask(U32 trigger_mask); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +// missile watcher callbacks +public: + virtual void impactNotify(const Point3F& p, const Point3F& n, SceneObject*) { } + + DECLARE_CONOBJECT(afxChoreographer); + DECLARE_CATEGORY("AFX"); + + // CONSTRAINT REMAPPING << +protected: + Vector remapped_cons_defs; + bool remapped_cons_sent; + virtual bool remap_builtin_constraint(SceneObject*, const char* cons_name) { return false; } + dynConstraintDef* find_cons_def_by_name(const char* cons_name); +public: + void remapObjectConstraint(SceneObject*, const char* cons_name); + void remapObjectConstraint(U16 scope_id, const char* cons_name, bool is_shape); + void remapPointConstraint(Point3F&, const char* cons_name); + void remapTransformConstraint(MatrixF&, const char* cons_name); + bool remapConstraint(const char* source_spec, const char* cons_name); + // CONSTRAINT REMAPPING >> +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_CHOREOGRAPHER_H_ diff --git a/Engine/source/afx/afxConstraint.cpp b/Engine/source/afx/afxConstraint.cpp new file mode 100644 index 000000000..78a506c02 --- /dev/null +++ b/Engine/source/afx/afxConstraint.cpp @@ -0,0 +1,2613 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "arcaneFX.h" + +#include "T3D/aiPlayer.h" +#include "T3D/tsStatic.h" +#include "sim/netConnection.h" +#include "ts/tsShapeInstance.h" + +#include "afxConstraint.h" +#include "afxChoreographer.h" +#include "afxEffectWrapper.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxConstraintDef + +// static +StringTableEntry afxConstraintDef::SCENE_CONS_KEY; +StringTableEntry afxConstraintDef::EFFECT_CONS_KEY; +StringTableEntry afxConstraintDef::GHOST_CONS_KEY; + +afxConstraintDef::afxConstraintDef() +{ + if (SCENE_CONS_KEY == 0) + { + SCENE_CONS_KEY = StringTable->insert("#scene"); + EFFECT_CONS_KEY = StringTable->insert("#effect"); + GHOST_CONS_KEY = StringTable->insert("#ghost"); + } + + reset(); +} + +bool afxConstraintDef::isDefined() +{ + return (def_type != CONS_UNDEFINED); +} + +bool afxConstraintDef::isArbitraryObject() +{ + return ((cons_src_name != ST_NULLSTRING) && (def_type == CONS_SCENE)); +} + +void afxConstraintDef::reset() +{ + cons_src_name = ST_NULLSTRING; + cons_node_name = ST_NULLSTRING; + def_type = CONS_UNDEFINED; + history_time = 0; + sample_rate = 30; + runs_on_server = false; + runs_on_client = false; + pos_at_box_center = false; + treat_as_camera = false; +} + +bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, + bool runs_on_client) +{ + reset(); + + if (spec == 0 || spec[0] == '\0') + return false; + + history_time = 0.0f; + sample_rate = 30; + + this->runs_on_server = runs_on_server; + this->runs_on_client = runs_on_client; + + // spec should be in one of these forms: + // CONSTRAINT_NAME (only) + // CONSTRAINT_NAME.NODE (shapeBase objects only) + // CONSTRAINT_NAME.#center + // object.OBJECT_NAME + // object.OBJECT_NAME.NODE (shapeBase objects only) + // object.OBJECT_NAME.#center + // effect.EFFECT_NAME + // effect.EFFECT_NAME.NODE + // effect.EFFECT_NAME.#center + // #ghost.EFFECT_NAME + // #ghost.EFFECT_NAME.NODE + // #ghost.EFFECT_NAME.#center + // + + // create scratch buffer by duplicating spec. + char special = '\b'; + char* buffer = dStrdup(spec); + + // substitute a dots not inside parens with special character + S32 n_nested = 0; + for (char* b = buffer; (*b) != '\0'; b++) + { + if ((*b) == '(') + n_nested++; + else if ((*b) == ')') + n_nested--; + else if ((*b) == '.' && n_nested == 0) + (*b) = special; + } + + // divide name into '.' separated tokens (up to 8) + char* words[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + char* dot = buffer; + int wdx = 0; + while (wdx < 8) + { + words[wdx] = dot; + dot = dStrchr(words[wdx++], special); + if (!dot) + break; + *(dot++) = '\0'; + if ((*dot) == '\0') + break; + } + + int n_words = wdx; + + // at this point the spec has been split into words. + // n_words indicates how many words we have. + + // no words found (must have been all whitespace) + if (n_words < 1) + { + dFree(buffer); + return false; + } + + char* hist_spec = 0; + char* words2[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + int n_words2 = 0; + + // move words to words2 while extracting #center and #history + for (S32 i = 0; i < n_words; i++) + { + if (dStrcmp(words[i], "#center") == 0) + pos_at_box_center = true; + else if (dStrncmp(words[i], "#history(", 9) == 0) + hist_spec = words[i]; + else + words2[n_words2++] = words[i]; + } + + // words2[] now contains just the constraint part + + // no words found (must have been all #center and #history) + if (n_words2 < 1) + { + dFree(buffer); + return false; + } + + if (hist_spec) + { + char* open_paren = dStrchr(hist_spec, '('); + if (open_paren) + { + hist_spec = open_paren+1; + if ((*hist_spec) != '\0') + { + char* close_paren = dStrchr(hist_spec, ')'); + if (close_paren) + (*close_paren) = '\0'; + char* slash = dStrchr(hist_spec, '/'); + if (slash) + (*slash) = ' '; + + F32 hist_age = 0.0; + U32 hist_rate = 30; + S32 args = dSscanf(hist_spec,"%g %d", &hist_age, &hist_rate); + + if (args > 0) + history_time = hist_age; + if (args > 1) + sample_rate = hist_rate; + } + } + } + + StringTableEntry cons_name_key = StringTable->insert(words2[0]); + + // must be in CONSTRAINT_NAME (only) form + if (n_words2 == 1) + { + // arbitrary object/effect constraints must have a name + if (cons_name_key == SCENE_CONS_KEY || cons_name_key == EFFECT_CONS_KEY) + { + dFree(buffer); + return false; + } + + cons_src_name = cons_name_key; + def_type = CONS_PREDEFINED; + dFree(buffer); + return true; + } + + // "#scene.NAME" or "#scene.NAME.NODE"" + if (cons_name_key == SCENE_CONS_KEY) + { + cons_src_name = StringTable->insert(words2[1]); + if (n_words2 > 2) + cons_node_name = StringTable->insert(words2[2]); + def_type = CONS_SCENE; + dFree(buffer); + return true; + } + + // "#effect.NAME" or "#effect.NAME.NODE" + if (cons_name_key == EFFECT_CONS_KEY) + { + cons_src_name = StringTable->insert(words2[1]); + if (n_words2 > 2) + cons_node_name = StringTable->insert(words2[2]); + def_type = CONS_EFFECT; + dFree(buffer); + return true; + } + + // "#ghost.NAME" or "#ghost.NAME.NODE" + if (cons_name_key == GHOST_CONS_KEY) + { + if (runs_on_server) + { + dFree(buffer); + return false; + } + + cons_src_name = StringTable->insert(words2[1]); + if (n_words2 > 2) + cons_node_name = StringTable->insert(words2[2]); + def_type = CONS_GHOST; + dFree(buffer); + return true; + } + + // "CONSTRAINT_NAME.NODE" + if (n_words2 == 2) + { + cons_src_name = cons_name_key; + cons_node_name = StringTable->insert(words2[1]); + def_type = CONS_PREDEFINED; + dFree(buffer); + return true; + } + + // must be in unsupported form + dFree(buffer); + return false; +} + +void afxConstraintDef::gather_cons_defs(Vector& defs, afxEffectList& fx) +{ + for (S32 i = 0; i < fx.size(); i++) + { + if (fx[i]) + fx[i]->gather_cons_defs(defs); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxConstraint + +afxConstraint::afxConstraint(afxConstraintMgr* mgr) +{ + this->mgr = mgr; + is_defined = false; + is_valid = false; + last_pos.zero(); + last_xfm.identity(); + history_time = 0.0f; + is_alive = true; + gone_missing = false; + change_code = 0; +} + +afxConstraint::~afxConstraint() +{ +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +inline afxPointConstraint* newPointCons(afxConstraintMgr* mgr, bool hist) +{ + return (hist) ? new afxPointHistConstraint(mgr) : new afxPointConstraint(mgr); +} + +inline afxTransformConstraint* newTransformCons(afxConstraintMgr* mgr, bool hist) +{ + return (hist) ? new afxTransformHistConstraint(mgr) : new afxTransformConstraint(mgr); +} + +inline afxShapeConstraint* newShapeCons(afxConstraintMgr* mgr, bool hist) +{ + return (hist) ? new afxShapeHistConstraint(mgr) : new afxShapeConstraint(mgr); +} + +inline afxShapeConstraint* newShapeCons(afxConstraintMgr* mgr, StringTableEntry name, bool hist) +{ + return (hist) ? new afxShapeHistConstraint(mgr, name) : new afxShapeConstraint(mgr, name); +} + +inline afxShapeNodeConstraint* newShapeNodeCons(afxConstraintMgr* mgr, StringTableEntry name, StringTableEntry node, bool hist) +{ + return (hist) ? new afxShapeNodeHistConstraint(mgr, name, node) : new afxShapeNodeConstraint(mgr, name, node); +} + +inline afxObjectConstraint* newObjectCons(afxConstraintMgr* mgr, bool hist) +{ + return (hist) ? new afxObjectHistConstraint(mgr) : new afxObjectConstraint(mgr); +} + +inline afxObjectConstraint* newObjectCons(afxConstraintMgr* mgr, StringTableEntry name, bool hist) +{ + return (hist) ? new afxObjectHistConstraint(mgr, name) : new afxObjectConstraint(mgr, name); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxConstraintMgr + +#define CONS_BY_ID(id) ((*constraints_v[(id).index])[(id).sub_index]) +#define CONS_BY_IJ(i,j) ((*constraints_v[(i)])[(j)]) + +afxConstraintMgr::afxConstraintMgr() +{ + starttime = 0; + on_server = false; + initialized = false; + scoping_dist_sq = 1000.0f*1000.0f; + missing_objs = &missing_objs_a; + missing_objs2 = &missing_objs_b; +} + +afxConstraintMgr::~afxConstraintMgr() +{ + for (S32 i = 0; i < constraints_v.size(); i++) + { + for (S32 j = 0; j < (*constraints_v[i]).size(); j++) + delete CONS_BY_IJ(i,j); + delete constraints_v[i]; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which) +{ + for (S32 i = 0; i < constraints_v.size(); i++) + { + afxConstraint* cons = CONS_BY_IJ(i,0); + if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.def_type && + which == cons->cons_def.cons_src_name) + { + return i; + } + } + + return -1; +} + +S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which) +{ + for (S32 i = 0; i < constraints_v.size(); i++) + { + afxConstraint* cons = CONS_BY_IJ(i,0); + if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.def_type && + which == cons->cons_def.cons_src_name) + { + return i; + } + } + + return -1; +} + +// Defines a predefined constraint with given name and type +void afxConstraintMgr::defineConstraint(U32 type, StringTableEntry name) +{ + preDef predef = { name, type }; + predefs.push_back(predef); +} + +afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point, + Point3F vector) +{ + S32 idx = find_cons_idx_from_name(which); + if (idx < 0) + return afxConstraintID(); + + afxConstraintID id = afxConstraintID(idx); + setReferencePoint(id, point, vector); + + return id; +} + +afxConstraintID afxConstraintMgr::setReferenceTransform(StringTableEntry which, MatrixF& xfm) +{ + S32 idx = find_cons_idx_from_name(which); + if (idx < 0) + return afxConstraintID(); + + afxConstraintID id = afxConstraintID(idx); + setReferenceTransform(id, xfm); + + return id; +} + +// Assigns an existing scene-object to the named constraint +afxConstraintID afxConstraintMgr::setReferenceObject(StringTableEntry which, SceneObject* obj) +{ + S32 idx = find_cons_idx_from_name(which); + if (idx < 0) + return afxConstraintID(); + + afxConstraintID id = afxConstraintID(idx); + setReferenceObject(id, obj); + + return id; +} + +// Assigns an un-scoped scene-object by scope_id to the named constraint +afxConstraintID afxConstraintMgr::setReferenceObjectByScopeId(StringTableEntry which, U16 scope_id, bool is_shape) +{ + S32 idx = find_cons_idx_from_name(which); + if (idx < 0) + return afxConstraintID(); + + afxConstraintID id = afxConstraintID(idx); + setReferenceObjectByScopeId(id, scope_id, is_shape); + + return id; +} + +afxConstraintID afxConstraintMgr::setReferenceEffect(StringTableEntry which, afxEffectWrapper* ew) +{ + S32 idx = find_effect_cons_idx_from_name(which); + + if (idx < 0) + return afxConstraintID(); + + afxConstraintID id = afxConstraintID(idx); + setReferenceEffect(id, ew); + + return id; +} + +afxConstraintID afxConstraintMgr::createReferenceEffect(StringTableEntry which, afxEffectWrapper* ew) +{ + afxEffectConstraint* cons = new afxEffectConstraint(this, which); + //cons->cons_def = def; + cons->cons_def.def_type = afxConstraintDef::CONS_EFFECT; + cons->cons_def.cons_src_name = which; + afxConstraintList* list = new afxConstraintList(); + list->push_back(cons); + constraints_v.push_back(list); + + return setReferenceEffect(which, ew); +} + +void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Point3F vector) +{ + afxPointConstraint* pt_cons = dynamic_cast(CONS_BY_ID(id)); + + // need to change type + if (!pt_cons) + { + afxConstraint* cons = CONS_BY_ID(id); + pt_cons = newPointCons(this, cons->cons_def.history_time > 0.0f); + pt_cons->cons_def = cons->cons_def; + CONS_BY_ID(id) = pt_cons; + delete cons; + } + + pt_cons->set(point, vector); + + // nullify all subnodes + for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + { + afxConstraint* cons = CONS_BY_IJ(id.index,j); + if (cons) + cons->unset(); + } +} + +void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm) +{ + afxTransformConstraint* xfm_cons = dynamic_cast(CONS_BY_ID(id)); + + // need to change type + if (!xfm_cons) + { + afxConstraint* cons = CONS_BY_ID(id); + xfm_cons = newTransformCons(this, cons->cons_def.history_time > 0.0f); + xfm_cons->cons_def = cons->cons_def; + CONS_BY_ID(id) = xfm_cons; + delete cons; + } + + xfm_cons->set(xfm); + + // nullify all subnodes + for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + { + afxConstraint* cons = CONS_BY_IJ(id.index,j); + if (cons) + cons->unset(); + } +} + +void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) +{ + id.sub_index = 0; + + afxShapeConstraint* shape_cons = dynamic_cast(CONS_BY_ID(id)); + + // need to change type + if (!shape_cons) + { + afxConstraint* cons = CONS_BY_ID(id); + shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f); + shape_cons->cons_def = cons->cons_def; + CONS_BY_ID(id) = shape_cons; + delete cons; + } + + // set new shape on root + shape_cons->set(shape); + + // update all subnodes + for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + { + afxConstraint* cons = CONS_BY_IJ(id.index,j); + if (cons) + { + if (dynamic_cast(cons)) + ((afxShapeNodeConstraint*)cons)->set(shape); + else if (dynamic_cast(cons)) + ((afxShapeConstraint*)cons)->set(shape); + else if (dynamic_cast(cons)) + ((afxObjectConstraint*)cons)->set(shape); + else + cons->unset(); + } + } +} + +void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) +{ + id.sub_index = 0; + + afxShapeConstraint* shape_cons = dynamic_cast(CONS_BY_ID(id)); + + // need to change type + if (!shape_cons) + { + afxConstraint* cons = CONS_BY_ID(id); + shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f); + shape_cons->cons_def = cons->cons_def; + CONS_BY_ID(id) = shape_cons; + delete cons; + } + + // set new shape on root + shape_cons->set_scope_id(scope_id); + + // update all subnodes + for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + { + afxConstraint* cons = CONS_BY_IJ(id.index,j); + if (cons) + cons->set_scope_id(scope_id); + } +} + +// Assigns an existing scene-object to the constraint matching the given constraint-id. +void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) +{ + if (!initialized) + Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); + + if (!CONS_BY_ID(id)->cons_def.treat_as_camera) + { + ShapeBase* shape = dynamic_cast(obj); + if (shape) + { + set_ref_shape(id, shape); + return; + } + } + + afxObjectConstraint* obj_cons = dynamic_cast(CONS_BY_ID(id)); + + // need to change type + if (!obj_cons) + { + afxConstraint* cons = CONS_BY_ID(id); + obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f); + obj_cons->cons_def = cons->cons_def; + CONS_BY_ID(id) = obj_cons; + delete cons; + } + + obj_cons->set(obj); + + // update all subnodes + for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + { + afxConstraint* cons = CONS_BY_IJ(id.index,j); + if (cons) + { + if (dynamic_cast(cons)) + ((afxObjectConstraint*)cons)->set(obj); + else + cons->unset(); + } + } +} + +// Assigns an un-scoped scene-object by scope_id to the constraint matching the +// given constraint-id. +void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope_id, bool is_shape) +{ + if (!initialized) + Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); + + if (is_shape) + { + set_ref_shape(id, scope_id); + return; + } + + afxObjectConstraint* obj_cons = dynamic_cast(CONS_BY_ID(id)); + + // need to change type + if (!obj_cons) + { + afxConstraint* cons = CONS_BY_ID(id); + obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f); + obj_cons->cons_def = cons->cons_def; + CONS_BY_ID(id) = obj_cons; + delete cons; + } + + obj_cons->set_scope_id(scope_id); + + // update all subnodes + for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + { + afxConstraint* cons = CONS_BY_IJ(id.index,j); + if (cons) + cons->set_scope_id(scope_id); + } +} + +void afxConstraintMgr::setReferenceEffect(afxConstraintID id, afxEffectWrapper* ew) +{ + afxEffectConstraint* eff_cons = dynamic_cast(CONS_BY_ID(id)); + if (!eff_cons) + return; + + eff_cons->set(ew); + + // update all subnodes + for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + { + afxConstraint* cons = CONS_BY_IJ(id.index,j); + if (cons) + { + if (dynamic_cast(cons)) + ((afxEffectNodeConstraint*)cons)->set(ew); + else if (dynamic_cast(cons)) + ((afxEffectConstraint*)cons)->set(ew); + else + cons->unset(); + } + } +} + +void afxConstraintMgr::invalidateReference(afxConstraintID id) +{ + afxConstraint* cons = CONS_BY_ID(id); + if (cons) + cons->is_valid = false; +} + +void afxConstraintMgr::create_constraint(const afxConstraintDef& def) +{ + if (def.def_type == afxConstraintDef::CONS_UNDEFINED) + return; + + //Con::printf("CON - %s [%s] [%s] h=%g", def.cons_type_name, def.cons_src_name, def.cons_node_name, def.history_time); + + bool want_history = (def.history_time > 0.0f); + + // constraint is an arbitrary named scene object + // + if (def.def_type == afxConstraintDef::CONS_SCENE) + { + if (def.cons_src_name == ST_NULLSTRING) + return; + + // find the arbitrary object by name + SceneObject* arb_obj; + if (on_server) + { + arb_obj = dynamic_cast(Sim::findObject(def.cons_src_name)); + if (!arb_obj) + Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on server.", + def.cons_src_name); + } + else + { + arb_obj = find_object_from_name(def.cons_src_name); + if (!arb_obj) + Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on client.", + def.cons_src_name); + } + + // if it's a shapeBase object, create a Shape or ShapeNode constraint + if (dynamic_cast(arb_obj)) + { + if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + { + afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history); + cons->cons_def = def; + cons->set((ShapeBase*)arb_obj); + afxConstraintList* list = new afxConstraintList(); + list->push_back(cons); + constraints_v.push_back(list); + } + else if (def.pos_at_box_center) + { + afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history); + cons->cons_def = def; + cons->set((ShapeBase*)arb_obj); + afxConstraintList* list = constraints_v[constraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center) + if (list && (*list)[0]) + list->push_back(cons); + } + else + { + afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.cons_src_name, def.cons_node_name, want_history); + sub->cons_def = def; + sub->set((ShapeBase*)arb_obj); + afxConstraintList* list = constraints_v[constraints_v.size()-1]; + if (list && (*list)[0]) + list->push_back(sub); + } + } + // if it's not a shapeBase object, create an Object constraint + else if (arb_obj) + { + if (!def.pos_at_box_center) + { + afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history); + cons->cons_def = def; + cons->set(arb_obj); + afxConstraintList* list = new afxConstraintList(); // OBJECT CONS-LIST (#scene) + list->push_back(cons); + constraints_v.push_back(list); + } + else // if (def.pos_at_box_center) + { + afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history); + cons->cons_def = def; + cons->set(arb_obj); + afxConstraintList* list = constraints_v[constraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center) + if (list && (*list)[0]) + list->push_back(cons); + } + } + } + + // constraint is an arbitrary named effect + // + else if (def.def_type == afxConstraintDef::CONS_EFFECT) + { + if (def.cons_src_name == ST_NULLSTRING) + return; + + // create an Effect constraint + if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + { + afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name); + cons->cons_def = def; + afxConstraintList* list = new afxConstraintList(); + list->push_back(cons); + constraints_v.push_back(list); + } + // create an Effect #center constraint + else if (def.pos_at_box_center) + { + afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name); + cons->cons_def = def; + afxConstraintList* list = constraints_v[constraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect) + if (list && (*list)[0]) + list->push_back(cons); + } + // create an EffectNode constraint + else + { + afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.cons_src_name, def.cons_node_name); + sub->cons_def = def; + afxConstraintList* list = constraints_v[constraints_v.size()-1]; + if (list && (*list)[0]) + list->push_back(sub); + } + } + + // constraint is a predefined constraint + // + else + { + afxConstraint* cons = 0; + afxConstraint* cons_ctr = 0; + afxConstraint* sub = 0; + + if (def.def_type == afxConstraintDef::CONS_GHOST) + { + for (S32 i = 0; i < predefs.size(); i++) + { + if (predefs[i].name == def.cons_src_name) + { + if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + { + cons = newShapeCons(this, want_history); + cons->cons_def = def; + } + else if (def.pos_at_box_center) + { + cons_ctr = newShapeCons(this, want_history); + cons_ctr->cons_def = def; + } + else + { + sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + sub->cons_def = def; + } + break; + } + } + } + else + { + for (S32 i = 0; i < predefs.size(); i++) + { + if (predefs[i].name == def.cons_src_name) + { + switch (predefs[i].type) + { + case POINT_CONSTRAINT: + cons = newPointCons(this, want_history); + cons->cons_def = def; + break; + case TRANSFORM_CONSTRAINT: + cons = newTransformCons(this, want_history); + cons->cons_def = def; + break; + case OBJECT_CONSTRAINT: + if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + { + cons = newShapeCons(this, want_history); + cons->cons_def = def; + } + else if (def.pos_at_box_center) + { + cons_ctr = newShapeCons(this, want_history); + cons_ctr->cons_def = def; + } + else + { + sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + sub->cons_def = def; + } + break; + case CAMERA_CONSTRAINT: + cons = newObjectCons(this, want_history); + cons->cons_def = def; + cons->cons_def.treat_as_camera = true; + break; + } + break; + } + } + } + + if (cons) + { + afxConstraintList* list = new afxConstraintList(); + list->push_back(cons); + constraints_v.push_back(list); + } + else if (cons_ctr && constraints_v.size() > 0) + { + afxConstraintList* list = constraints_v[constraints_v.size()-1]; // PREDEF-NODE CONS-LIST + if (list && (*list)[0]) + list->push_back(cons_ctr); + } + else if (sub && constraints_v.size() > 0) + { + afxConstraintList* list = constraints_v[constraints_v.size()-1]; + if (list && (*list)[0]) + list->push_back(sub); + } + else + Con::printf("predef not found %s", def.cons_src_name); + } +} + +afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) +{ + if (def.def_type == afxConstraintDef::CONS_UNDEFINED) + return afxConstraintID(); + + if (def.cons_src_name != ST_NULLSTRING) + { + for (S32 i = 0; i < constraints_v.size(); i++) + { + afxConstraintList* list = constraints_v[i]; + afxConstraint* cons = (*list)[0]; + if (def.cons_src_name == cons->cons_def.cons_src_name) + { + for (S32 j = 0; j < list->size(); j++) + { + afxConstraint* sub = (*list)[j]; + if (def.cons_node_name == sub->cons_def.cons_node_name && + def.pos_at_box_center == sub->cons_def.pos_at_box_center && + def.cons_src_name == sub->cons_def.cons_src_name) + { + return afxConstraintID(i, j); + } + } + + // if we're here, it means the root object name matched but the node name + // did not. + if (def.def_type == afxConstraintDef::CONS_PREDEFINED && !def.pos_at_box_center) + { + afxShapeConstraint* shape_cons = dynamic_cast(cons); + if (shape_cons) + { + //Con::errorf("Append a Node constraint [%s.%s] [%d,%d]", def.cons_src_name, def.cons_node_name, i, list->size()); + bool want_history = (def.history_time > 0.0f); + afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + sub->cons_def = def; + ((afxShapeConstraint*)sub)->set(shape_cons->shape); + list->push_back(sub); + + return afxConstraintID(i, list->size()-1); + } + } + + break; + } + } + } + + return afxConstraintID(); +} + +afxConstraint* afxConstraintMgr::getConstraint(afxConstraintID id) +{ + if (id.undefined()) + return 0; + + afxConstraint* cons = CONS_BY_IJ(id.index,id.sub_index); + if (cons && !cons->isDefined()) + return NULL; + + return cons; +} + +void afxConstraintMgr::sample(F32 dt, U32 now, const Point3F* cam_pos) +{ + U32 elapsed = now - starttime; + + for (S32 i = 0; i < constraints_v.size(); i++) + { + afxConstraintList* list = constraints_v[i]; + for (S32 j = 0; j < list->size(); j++) + (*list)[j]->sample(dt, elapsed, cam_pos); + } +} + +S32 QSORT_CALLBACK cmp_cons_defs(const void* a, const void* b) +{ + afxConstraintDef* def_a = (afxConstraintDef*) a; + afxConstraintDef* def_b = (afxConstraintDef*) b; + + if (def_a->def_type == def_b->def_type) + { + if (def_a->cons_src_name == def_b->cons_src_name) + { + if (def_a->pos_at_box_center == def_b->pos_at_box_center) + return (def_a->cons_node_name - def_b->cons_node_name); + else + return (def_a->pos_at_box_center) ? 1 : -1; + } + return (def_a->cons_src_name - def_b->cons_src_name); + } + + return (def_a->def_type - def_b->def_type); +} + +void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bool on_server, F32 scoping_dist) +{ + initialized = true; + this->on_server = on_server; + + if (scoping_dist > 0.0) + scoping_dist_sq = scoping_dist*scoping_dist; + else + { + SceneManager* sg = (on_server) ? gServerSceneGraph : gClientSceneGraph; + F32 vis_dist = (sg) ? sg->getVisibleDistance() : 1000.0f; + scoping_dist_sq = vis_dist*vis_dist; + } + + if (all_defs.size() < 1) + return; + + // find effect ghost constraints + if (!on_server) + { + Vector ghost_defs; + + for (S32 i = 0; i < all_defs.size(); i++) + if (all_defs[i].def_type == afxConstraintDef::CONS_GHOST && all_defs[i].cons_src_name != ST_NULLSTRING) + ghost_defs.push_back(all_defs[i]); + + if (ghost_defs.size() > 0) + { + // sort the defs + if (ghost_defs.size() > 1) + dQsort(ghost_defs.address(), ghost_defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); + + S32 last = 0; + defineConstraint(OBJECT_CONSTRAINT, ghost_defs[0].cons_src_name); + + for (S32 i = 1; i < ghost_defs.size(); i++) + { + if (ghost_defs[last].cons_src_name != ghost_defs[i].cons_src_name) + { + defineConstraint(OBJECT_CONSTRAINT, ghost_defs[i].cons_src_name); + last++; + } + } + } + } + + Vector defs; + + // collect defs that run here (server or client) + if (on_server) + { + for (S32 i = 0; i < all_defs.size(); i++) + if (all_defs[i].runs_on_server) + defs.push_back(all_defs[i]); + } + else + { + for (S32 i = 0; i < all_defs.size(); i++) + if (all_defs[i].runs_on_client) + defs.push_back(all_defs[i]); + } + + // create unique set of constraints. + // + if (defs.size() > 0) + { + // sort the defs + if (defs.size() > 1) + dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); + + Vector unique_defs; + S32 last = 0; + + // manufacture root-object def if absent + if (defs[0].cons_node_name != ST_NULLSTRING) + { + afxConstraintDef root_def = defs[0]; + root_def.cons_node_name = ST_NULLSTRING; + unique_defs.push_back(root_def); + last++; + } + else if (defs[0].pos_at_box_center) + { + afxConstraintDef root_def = defs[0]; + root_def.pos_at_box_center = false; + unique_defs.push_back(root_def); + last++; + } + + unique_defs.push_back(defs[0]); + + for (S32 i = 1; i < defs.size(); i++) + { + if (unique_defs[last].cons_node_name != defs[i].cons_node_name || + unique_defs[last].cons_src_name != defs[i].cons_src_name || + unique_defs[last].pos_at_box_center != defs[i].pos_at_box_center || + unique_defs[last].def_type != defs[i].def_type) + { + // manufacture root-object def if absent + if (defs[i].cons_src_name != ST_NULLSTRING && unique_defs[last].cons_src_name != defs[i].cons_src_name) + { + if (defs[i].cons_node_name != ST_NULLSTRING || defs[i].pos_at_box_center) + { + afxConstraintDef root_def = defs[i]; + root_def.cons_node_name = ST_NULLSTRING; + root_def.pos_at_box_center = false; + unique_defs.push_back(root_def); + last++; + } + } + unique_defs.push_back(defs[i]); + last++; + } + else + { + if (defs[i].history_time > unique_defs[last].history_time) + unique_defs[last].history_time = defs[i].history_time; + if (defs[i].sample_rate > unique_defs[last].sample_rate) + unique_defs[last].sample_rate = defs[i].sample_rate; + } + } + + //Con::printf("\nConstraints on %s", (on_server) ? "server" : "client"); + for (S32 i = 0; i < unique_defs.size(); i++) + create_constraint(unique_defs[i]); + } + + // collect the names of all the arbitrary object constraints + // that run on clients and store in names_on_server array. + // + if (on_server) + { + names_on_server.clear(); + defs.clear(); + + for (S32 i = 0; i < all_defs.size(); i++) + if (all_defs[i].runs_on_client && all_defs[i].isArbitraryObject()) + defs.push_back(all_defs[i]); + + if (defs.size() < 1) + return; + + // sort the defs + if (defs.size() > 1) + dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); + + S32 last = 0; + names_on_server.push_back(defs[0].cons_src_name); + + for (S32 i = 1; i < defs.size(); i++) + { + if (names_on_server[last] != defs[i].cons_src_name) + { + names_on_server.push_back(defs[i].cons_src_name); + last++; + } + } + } +} + +void afxConstraintMgr::packConstraintNames(NetConnection* conn, BitStream* stream) +{ + // pack any named constraint names and ghost indices + if (stream->writeFlag(names_on_server.size() > 0)) //-- ANY NAMED CONS_BY_ID? + { + stream->write(names_on_server.size()); + for (S32 i = 0; i < names_on_server.size(); i++) + { + stream->writeString(names_on_server[i]); + NetObject* obj = dynamic_cast(Sim::findObject(names_on_server[i])); + if (!obj) + { + //Con::printf("CONSTRAINT-OBJECT %s does not exist.", names_on_server[i]); + stream->write((S32)-1); + } + else + { + S32 ghost_id = conn->getGhostIndex(obj); + /* + if (ghost_id == -1) + Con::printf("CONSTRAINT-OBJECT %s does not have a ghost.", names_on_server[i]); + else + Con::printf("CONSTRAINT-OBJECT %s name to server.", names_on_server[i]); + */ + stream->write(ghost_id); + } + } + } +} + +void afxConstraintMgr::unpackConstraintNames(BitStream* stream) +{ + if (stream->readFlag()) //-- ANY NAMED CONS_BY_ID? + { + names_on_server.clear(); + S32 sz; stream->read(&sz); + for (S32 i = 0; i < sz; i++) + { + names_on_server.push_back(stream->readSTString()); + S32 ghost_id; stream->read(&ghost_id); + ghost_ids.push_back(ghost_id); + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +SceneObject* afxConstraintMgr::find_object_from_name(StringTableEntry name) +{ + if (names_on_server.size() > 0) + { + for (S32 i = 0; i < names_on_server.size(); i++) + if (names_on_server[i] == name) + { + if (ghost_ids[i] == -1) + return 0; + NetConnection* conn = NetConnection::getConnectionToServer(); + if (!conn) + return 0; + return dynamic_cast(conn->resolveGhost(ghost_ids[i])); + } + } + + return dynamic_cast(Sim::findObject(name)); +} + +void afxConstraintMgr::addScopeableObject(SceneObject* object) +{ + for (S32 i = 0; i < scopeable_objs.size(); i++) + { + if (scopeable_objs[i] == object) + return; + } + + object->addScopeRef(); + scopeable_objs.push_back(object); +} + +void afxConstraintMgr::removeScopeableObject(SceneObject* object) +{ + for (S32 i = 0; i < scopeable_objs.size(); i++) + if (scopeable_objs[i] == object) + { + object->removeScopeRef(); + scopeable_objs.erase_fast(i); + return; + } +} + +void afxConstraintMgr::clearAllScopeableObjs() +{ + for (S32 i = 0; i < scopeable_objs.size(); i++) + scopeable_objs[i]->removeScopeRef(); + scopeable_objs.clear(); +} + +void afxConstraintMgr::postMissingConstraintObject(afxConstraint* cons, bool is_deleting) +{ + if (cons->gone_missing) + return; + + if (!is_deleting) + { + SceneObject* obj = arcaneFX::findScopedObject(cons->getScopeId()); + if (obj) + { + cons->restoreObject(obj); + return; + } + } + + cons->gone_missing = true; + missing_objs->push_back(cons); +} + +void afxConstraintMgr::restoreScopedObject(SceneObject* obj, afxChoreographer* ch) +{ + for (S32 i = 0; i < missing_objs->size(); i++) + { + if ((*missing_objs)[i]->getScopeId() == obj->getScopeId()) + { + (*missing_objs)[i]->gone_missing = false; + (*missing_objs)[i]->restoreObject(obj); + if (ch) + ch->restoreObject(obj); + } + else + missing_objs2->push_back((*missing_objs)[i]); + } + + Vector* tmp = missing_objs; + missing_objs = missing_objs2; + missing_objs2 = tmp; + missing_objs2->clear(); +} + +void afxConstraintMgr::adjustProcessOrdering(afxChoreographer* ch) +{ + Vector cons_sources; + + // add choreographer to the list + cons_sources.push_back(ch); + + // collect all the ProcessObject related constraint sources + for (S32 i = 0; i < constraints_v.size(); i++) + { + afxConstraintList* list = constraints_v[i]; + afxConstraint* cons = (*list)[0]; + if (cons) + { + ProcessObject* pobj = dynamic_cast(cons->getSceneObject()); + if (pobj) + cons_sources.push_back(pobj); + } + } + + ProcessList* proc_list; + if (ch->isServerObject()) + proc_list = ServerProcessList::get(); + else + proc_list = ClientProcessList::get(); + if (!proc_list) + return; + + GameBase* nearest_to_end = dynamic_cast(proc_list->findNearestToEnd(cons_sources)); + GameBase* chor = (GameBase*) ch; + + // choreographer needs to be processed after the latest process object + if (chor != nearest_to_end && nearest_to_end != 0) + { + //Con::printf("Choreographer processing BEFORE some of its constraints... fixing. [%s] -- %s", + // (ch->isServerObject()) ? "S" : "C", nearest_to_end->getClassName()); + if (chor->isProperlyAdded()) + ch->processAfter(nearest_to_end); + else + ch->postProcessAfterObject(nearest_to_end); + } + else + { + //Con::printf("Choreographer processing AFTER its constraints... fine. [%s]", + // (ch->isServerObject()) ? "S" : "C"); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPointConstraint + +afxPointConstraint::afxPointConstraint(afxConstraintMgr* mgr) + : afxConstraint(mgr) +{ + point.zero(); + vector.set(0,0,1); +} + +afxPointConstraint::~afxPointConstraint() +{ +} + +void afxPointConstraint::set(Point3F point, Point3F vector) +{ + this->point = point; + this->vector = vector; + is_defined = true; + is_valid = true; + change_code++; + sample(0.0f, 0, 0); +} + +void afxPointConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + if (cam_pos) + { + Point3F dir = (*cam_pos) - point; + F32 dist_sq = dir.lenSquared(); + if (dist_sq > mgr->getScopingDistanceSquared()) + { + is_valid = false; + return; + } + is_valid = true; + } + + last_pos = point; + last_xfm.identity(); + last_xfm.setPosition(point); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxTransformConstraint + +afxTransformConstraint::afxTransformConstraint(afxConstraintMgr* mgr) + : afxConstraint(mgr) +{ + xfm.identity(); +} + +afxTransformConstraint::~afxTransformConstraint() +{ +} + +void afxTransformConstraint::set(const MatrixF& xfm) +{ + this->xfm = xfm; + is_defined = true; + is_valid = true; + change_code++; + sample(0.0f, 0, 0); +} + +void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + if (cam_pos) + { + Point3F dir = (*cam_pos) - xfm.getPosition(); + F32 dist_sq = dir.lenSquared(); + if (dist_sq > mgr->getScopingDistanceSquared()) + { + is_valid = false; + return; + } + is_valid = true; + } + + last_xfm = xfm; + last_pos = xfm.getPosition(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeConstraint + +afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr) + : afxConstraint(mgr) +{ + arb_name = ST_NULLSTRING; + shape = 0; + scope_id = 0; + clip_tag = 0; + lock_tag = 0; +} + +afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) + : afxConstraint(mgr) +{ + this->arb_name = arb_name; + shape = 0; + scope_id = 0; + clip_tag = 0; + lock_tag = 0; +} + +afxShapeConstraint::~afxShapeConstraint() +{ + if (shape) + clearNotify(shape); +} + +void afxShapeConstraint::set(ShapeBase* shape) +{ + if (this->shape) + { + scope_id = 0; + clearNotify(this->shape); + if (clip_tag > 0) + remapAnimation(clip_tag, shape); + if (lock_tag > 0) + unlockAnimation(lock_tag); + } + + this->shape = shape; + + if (this->shape) + { + deleteNotify(this->shape); + scope_id = this->shape->getScopeId(); + } + + if (this->shape != NULL) + { + is_defined = true; + is_valid = true; + change_code++; + sample(0.0f, 0, 0); + } + else + is_valid = false; +} + +void afxShapeConstraint::set_scope_id(U16 scope_id) +{ + if (shape) + clearNotify(shape); + + shape = 0; + this->scope_id = scope_id; + + is_defined = (this->scope_id > 0); + is_valid = false; + mgr->postMissingConstraintObject(this); +} + +void afxShapeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + if (gone_missing) + return; + + if (shape) + { + last_xfm = shape->getRenderTransform(); + if (cons_def.pos_at_box_center) + last_pos = shape->getBoxCenter(); + else + last_pos = shape->getRenderPosition(); + } +} + +void afxShapeConstraint::restoreObject(SceneObject* obj) +{ + if (this->shape) + { + scope_id = 0; + clearNotify(this->shape); + } + + this->shape = (ShapeBase* )obj; + + if (this->shape) + { + deleteNotify(this->shape); + scope_id = this->shape->getScopeId(); + } + + is_valid = (this->shape != NULL); +} + +void afxShapeConstraint::onDeleteNotify(SimObject* obj) +{ + if (shape == dynamic_cast(obj)) + { + shape = 0; + is_valid = false; + if (scope_id > 0) + mgr->postMissingConstraintObject(this, true); + } + + Parent::onDeleteNotify(obj); +} + +U32 afxShapeConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) +{ + if (!shape) + return 0; + + if (shape->isServerObject()) + { + AIPlayer* ai_player = dynamic_cast(shape); + if (ai_player && !ai_player->isBlendAnimation(clip)) + { + ai_player->saveMoveState(); + ai_player->stopMove(); + } + } + + clip_tag = shape->playAnimation(clip, pos, rate, trans, false/*hold*/, true/*wait*/, is_death_anim); + return clip_tag; +} + +void afxShapeConstraint::remapAnimation(U32 tag, ShapeBase* other_shape) +{ + if (clip_tag == 0) + return; + + if (!shape) + return; + + if (!other_shape) + { + resetAnimation(tag); + return; + } + + Con::errorf("remapAnimation -- Clip name, %s.", shape->getLastClipName(tag)); + + if (shape->isClientObject()) + { + shape->restoreAnimation(tag); + } + else + { + AIPlayer* ai_player = dynamic_cast(shape); + if (ai_player) + ai_player->restartMove(tag); + else + shape->restoreAnimation(tag); + } + + clip_tag = 0; +} + +void afxShapeConstraint::resetAnimation(U32 tag) +{ + if (clip_tag == 0) + return; + + if (!shape) + return; + + if (shape->isClientObject()) + { + shape->restoreAnimation(tag); + } + else + { + AIPlayer* ai_player = dynamic_cast(shape); + if (ai_player) + ai_player->restartMove(tag); + else + shape->restoreAnimation(tag); + } + + if ((tag & 0x80000000) == 0 && tag == clip_tag) + clip_tag = 0; +} + +U32 afxShapeConstraint::lockAnimation() +{ + if (!shape) + return 0; + + lock_tag = shape->lockAnimation(); + return lock_tag; +} + +void afxShapeConstraint::unlockAnimation(U32 tag) +{ + if (lock_tag == 0) + return; + + if (!shape) + return; + + shape->unlockAnimation(tag); + lock_tag = 0; +} + +F32 afxShapeConstraint::getAnimClipDuration(const char* clip) +{ + return (shape) ? shape->getAnimationDuration(clip) : 0.0f; +} + +S32 afxShapeConstraint::getDamageState() +{ + return (shape) ? shape->getDamageState() : -1; +} + +U32 afxShapeConstraint::getTriggers() +{ + return (shape) ? shape->getShapeInstance()->getTriggerStateMask() : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeNodeConstraint + +afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr) + : afxShapeConstraint(mgr) +{ + arb_node = ST_NULLSTRING; + shape_node_ID = -1; +} + +afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name, StringTableEntry arb_node) + : afxShapeConstraint(mgr, arb_name) +{ + this->arb_node = arb_node; + shape_node_ID = -1; +} + +void afxShapeNodeConstraint::set(ShapeBase* shape) +{ + if (shape) + { + shape_node_ID = shape->getShape()->findNode(arb_node); + if (shape_node_ID == -1) + Con::errorf("Failed to find node [%s]", arb_node); + } + else + shape_node_ID = -1; + + Parent::set(shape); +} + +void afxShapeNodeConstraint::set_scope_id(U16 scope_id) +{ + shape_node_ID = -1; + Parent::set_scope_id(scope_id); +} + +void afxShapeNodeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + if (shape && shape_node_ID != -1) + { + last_xfm = shape->getRenderTransform(); + last_xfm.scale(shape->getScale()); + last_xfm.mul(shape->getShapeInstance()->mNodeTransforms[shape_node_ID]); + last_pos = last_xfm.getPosition(); + } +} + +void afxShapeNodeConstraint::restoreObject(SceneObject* obj) +{ + ShapeBase* shape = dynamic_cast(obj); + if (shape) + { + shape_node_ID = shape->getShape()->findNode(arb_node); + if (shape_node_ID == -1) + Con::errorf("Failed to find node [%s]", arb_node); + } + else + shape_node_ID = -1; + Parent::restoreObject(obj); +} + +void afxShapeNodeConstraint::onDeleteNotify(SimObject* obj) +{ + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxObjectConstraint + +afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr) + : afxConstraint(mgr) +{ + arb_name = ST_NULLSTRING; + obj = 0; + scope_id = 0; + is_camera = false; +} + +afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) + : afxConstraint(mgr) +{ + this->arb_name = arb_name; + obj = 0; + scope_id = 0; + is_camera = false; +} + +afxObjectConstraint::~afxObjectConstraint() +{ + if (obj) + clearNotify(obj); +} + +void afxObjectConstraint::set(SceneObject* obj) +{ + if (this->obj) + { + scope_id = 0; + clearNotify(this->obj); + } + + this->obj = obj; + + if (this->obj) + { + deleteNotify(this->obj); + scope_id = this->obj->getScopeId(); + } + + if (this->obj != NULL) + { + is_camera = this->obj->isCamera(); + + is_defined = true; + is_valid = true; + change_code++; + sample(0.0f, 0, 0); + } + else + is_valid = false; +} + +void afxObjectConstraint::set_scope_id(U16 scope_id) +{ + if (obj) + clearNotify(obj); + + obj = 0; + this->scope_id = scope_id; + + is_defined = (scope_id > 0); + is_valid = false; + mgr->postMissingConstraintObject(this); +} + +void afxObjectConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + if (gone_missing) + return; + + if (obj) + { + if (!is_camera && cons_def.treat_as_camera && dynamic_cast(obj)) + { + ShapeBase* cam_obj = (ShapeBase*) obj; + F32 pov = 1.0f; + cam_obj->getCameraTransform(&pov, &last_xfm); + last_xfm.getColumn(3, &last_pos); + } + else + { + last_xfm = obj->getRenderTransform(); + if (cons_def.pos_at_box_center) + last_pos = obj->getBoxCenter(); + else + last_pos = obj->getRenderPosition(); + } + } +} + +void afxObjectConstraint::restoreObject(SceneObject* obj) +{ + if (this->obj) + { + scope_id = 0; + clearNotify(this->obj); + } + + this->obj = obj; + + if (this->obj) + { + deleteNotify(this->obj); + scope_id = this->obj->getScopeId(); + } + + is_valid = (this->obj != NULL); +} + +void afxObjectConstraint::onDeleteNotify(SimObject* obj) +{ + if (this->obj == dynamic_cast(obj)) + { + this->obj = 0; + is_valid = false; + if (scope_id > 0) + mgr->postMissingConstraintObject(this, true); + } + + Parent::onDeleteNotify(obj); +} + +U32 afxObjectConstraint::getTriggers() +{ + TSStatic* ts_static = dynamic_cast(obj); + if (ts_static) + { + TSShapeInstance* obj_inst = ts_static->getShapeInstance(); + return (obj_inst) ? obj_inst->getTriggerStateMask() : 0; + } + + ShapeBase* shape_base = dynamic_cast(obj); + if (shape_base) + { + TSShapeInstance* obj_inst = shape_base->getShapeInstance(); + return (obj_inst) ? obj_inst->getTriggerStateMask() : 0; + } + + return 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectConstraint + +afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr) + : afxConstraint(mgr) +{ + effect_name = ST_NULLSTRING; + effect = 0; +} + +afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr, StringTableEntry effect_name) + : afxConstraint(mgr) +{ + this->effect_name = effect_name; + effect = 0; +} + +afxEffectConstraint::~afxEffectConstraint() +{ +} + +bool afxEffectConstraint::getPosition(Point3F& pos, F32 hist) +{ + if (!effect || !effect->inScope()) + return false; + + if (cons_def.pos_at_box_center) + effect->getUpdatedBoxCenter(pos); + else + effect->getUpdatedPosition(pos); + + return true; +} + +bool afxEffectConstraint::getTransform(MatrixF& xfm, F32 hist) +{ + if (!effect || !effect->inScope()) + return false; + + effect->getUpdatedTransform(xfm); + return true; +} + +bool afxEffectConstraint::getAltitudes(F32& terrain_alt, F32& interior_alt) +{ + if (!effect) + return false; + + effect->getAltitudes(terrain_alt, interior_alt); + return true; +} + +void afxEffectConstraint::set(afxEffectWrapper* effect) +{ + this->effect = effect; + + if (this->effect != NULL) + { + is_defined = true; + is_valid = true; + change_code++; + } + else + is_valid = false; +} + +U32 afxEffectConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) +{ + return (effect) ? effect->setAnimClip(clip, pos, rate, trans) : 0; +} + +void afxEffectConstraint::resetAnimation(U32 tag) +{ + if (effect) + effect->resetAnimation(tag); +} + +F32 afxEffectConstraint::getAnimClipDuration(const char* clip) +{ + return (effect) ? getAnimClipDuration(clip) : 0; +} + +U32 afxEffectConstraint::getTriggers() +{ + return (effect) ? effect->getTriggers() : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectNodeConstraint + +afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr) + : afxEffectConstraint(mgr) +{ + effect_node = ST_NULLSTRING; + effect_node_ID = -1; +} + +afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr, StringTableEntry name, StringTableEntry node) +: afxEffectConstraint(mgr, name) +{ + this->effect_node = node; + effect_node_ID = -1; +} + + + +bool afxEffectNodeConstraint::getPosition(Point3F& pos, F32 hist) +{ + if (!effect || !effect->inScope()) + return false; + + TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance(); + if (!ts_shape_inst) + return false; + + if (effect_node_ID == -1) + { + TSShape* ts_shape = effect->getTSShape(); + effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + } + + if (effect_node_ID == -1) + return false; + + effect->getUpdatedTransform(last_xfm); + + Point3F scale; + effect->getUpdatedScale(scale); + + MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID]; + gag.setPosition( gag.getPosition()*scale ); + + MatrixF xfm; + xfm.mul(last_xfm, gag); + // + pos = xfm.getPosition(); + + return true; +} + +bool afxEffectNodeConstraint::getTransform(MatrixF& xfm, F32 hist) +{ + if (!effect || !effect->inScope()) + return false; + + TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance(); + if (!ts_shape_inst) + return false; + + if (effect_node_ID == -1) + { + TSShape* ts_shape = effect->getTSShape(); + effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + } + + if (effect_node_ID == -1) + return false; + + effect->getUpdatedTransform(last_xfm); + + Point3F scale; + effect->getUpdatedScale(scale); + + MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID]; + gag.setPosition( gag.getPosition()*scale ); + + xfm.mul(last_xfm, gag); + + return true; +} + +void afxEffectNodeConstraint::set(afxEffectWrapper* effect) +{ + if (effect) + { + TSShape* ts_shape = effect->getTSShape(); + effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + } + else + effect_node_ID = -1; + + Parent::set(effect); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSampleBuffer + +afxSampleBuffer::afxSampleBuffer() +{ + buffer_sz = 0; + buffer_ms = 0; + ms_per_sample = 33; + elapsed_ms = 0; + last_sample_ms = 0; + next_sample_num = 0; + n_samples = 0; +} + +afxSampleBuffer::~afxSampleBuffer() +{ +} + +void afxSampleBuffer::configHistory(F32 hist_len, U8 sample_rate) +{ + buffer_sz = mCeil(hist_len*sample_rate) + 1; + ms_per_sample = mCeil(1000.0f/sample_rate); + buffer_ms = buffer_sz*ms_per_sample; +} + +void afxSampleBuffer::recordSample(F32 dt, U32 elapsed_ms, void* data) +{ + this->elapsed_ms = elapsed_ms; + + if (!data) + return; + + U32 now_sample_num = elapsed_ms/ms_per_sample; + if (next_sample_num <= now_sample_num) + { + last_sample_ms = elapsed_ms; + while (next_sample_num <= now_sample_num) + { + recSample(next_sample_num % buffer_sz, data); + next_sample_num++; + n_samples++; + } + } +} + +inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx) +{ + bool in_bounds = true; + + U32 lag_ms = lag*1000.0f; + U32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms; + if (lag_ms > rec_ms) + { + // hasn't produced enough history + lag_ms = rec_ms; + in_bounds = false; + } + + U32 latest_sample_num = last_sample_ms/ms_per_sample; + U32 then_sample_num = (elapsed_ms - lag_ms)/ms_per_sample; + + if (then_sample_num > latest_sample_num) + { + // latest sample is older than lag + then_sample_num = latest_sample_num; + in_bounds = false; + } + + idx = then_sample_num % buffer_sz; + return in_bounds; +} + +inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, F32& t) +{ + bool in_bounds = true; + + F32 lag_ms = lag*1000.0f; + F32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms; + if (lag_ms > rec_ms) + { + // hasn't produced enough history + lag_ms = rec_ms; + in_bounds = false; + } + + F32 per_samp = ms_per_sample; + F32 latest_sample_num = last_sample_ms/per_samp; + F32 then_sample_num = (elapsed_ms - lag_ms)/per_samp; + + U32 latest_sample_num_i = latest_sample_num; + U32 then_sample_num_i = then_sample_num; + + if (then_sample_num_i >= latest_sample_num_i) + { + if (latest_sample_num_i < then_sample_num_i) + in_bounds = false; + t = 0.0; + idx1 = then_sample_num_i % buffer_sz; + idx2 = idx1; + } + else + { + t = then_sample_num - then_sample_num_i; + idx1 = then_sample_num_i % buffer_sz; + idx2 = (then_sample_num_i+1) % buffer_sz; + } + + return in_bounds; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSampleXfmBuffer + +afxSampleXfmBuffer::afxSampleXfmBuffer() +{ + xfm_buffer = 0; +} + +afxSampleXfmBuffer::~afxSampleXfmBuffer() +{ + delete [] xfm_buffer; +} + +void afxSampleXfmBuffer::configHistory(F32 hist_len, U8 sample_rate) +{ + if (!xfm_buffer) + { + afxSampleBuffer::configHistory(hist_len, sample_rate); + if (buffer_sz > 0) + xfm_buffer = new MatrixF[buffer_sz]; + } +} + +void afxSampleXfmBuffer::recSample(U32 idx, void* data) +{ + xfm_buffer[idx] = *((MatrixF*)data); +} + +void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds) +{ + U32 idx1, idx2; + F32 t; + in_bounds = compute_idx_from_lag(lag, idx1, idx2, t); + + if (idx1 == idx2) + { + MatrixF* m1 = &xfm_buffer[idx1]; + *((MatrixF*)data) = *m1; + } + else + { + MatrixF* m1 = &xfm_buffer[idx1]; + MatrixF* m2 = &xfm_buffer[idx2]; + + Point3F p1 = m1->getPosition(); + Point3F p2 = m2->getPosition(); + Point3F p; p.interpolate(p1, p2, t); + + if (t < 0.5f) + *((MatrixF*)data) = *m1; + else + *((MatrixF*)data) = *m2; + + ((MatrixF*)data)->setPosition(p); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPointHistConstraint + +afxPointHistConstraint::afxPointHistConstraint(afxConstraintMgr* mgr) + : afxPointConstraint(mgr) +{ + samples = 0; +} + +afxPointHistConstraint::~afxPointHistConstraint() +{ + delete samples; +} + +void afxPointHistConstraint::set(Point3F point, Point3F vector) +{ + if (!samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set(point, vector); +} + +void afxPointHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + Parent::sample(dt, elapsed_ms, cam_pos); + + if (isDefined()) + { + if (isValid()) + samples->recordSample(dt, elapsed_ms, &last_xfm); + else + samples->recordSample(dt, elapsed_ms, 0); + } +} + +bool afxPointHistConstraint::getPosition(Point3F& pos, F32 hist) +{ + bool in_bounds; + + MatrixF xfm; + samples->getSample(hist, &xfm, in_bounds); + + pos = xfm.getPosition(); + + return in_bounds; +} + +bool afxPointHistConstraint::getTransform(MatrixF& xfm, F32 hist) +{ + bool in_bounds; + + samples->getSample(hist, &xfm, in_bounds); + + return in_bounds; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPointHistConstraint + +afxTransformHistConstraint::afxTransformHistConstraint(afxConstraintMgr* mgr) + : afxTransformConstraint(mgr) +{ + samples = 0; +} + +afxTransformHistConstraint::~afxTransformHistConstraint() +{ + delete samples; +} + +void afxTransformHistConstraint::set(const MatrixF& xfm) +{ + if (!samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set(xfm); +} + +void afxTransformHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + Parent::sample(dt, elapsed_ms, cam_pos); + + if (isDefined()) + { + if (isValid()) + samples->recordSample(dt, elapsed_ms, &last_xfm); + else + samples->recordSample(dt, elapsed_ms, 0); + } +} + +bool afxTransformHistConstraint::getPosition(Point3F& pos, F32 hist) +{ + bool in_bounds; + + MatrixF xfm; + samples->getSample(hist, &xfm, in_bounds); + + pos = xfm.getPosition(); + + return in_bounds; +} + +bool afxTransformHistConstraint::getTransform(MatrixF& xfm, F32 hist) +{ + bool in_bounds; + + samples->getSample(hist, &xfm, in_bounds); + + return in_bounds; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeHistConstraint + +afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr) + : afxShapeConstraint(mgr) +{ + samples = 0; +} + +afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) + : afxShapeConstraint(mgr, arb_name) +{ + samples = 0; +} + +afxShapeHistConstraint::~afxShapeHistConstraint() +{ + delete samples; +} + +void afxShapeHistConstraint::set(ShapeBase* shape) +{ + if (shape && !samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set(shape); +} + +void afxShapeHistConstraint::set_scope_id(U16 scope_id) +{ + if (scope_id > 0 && !samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set_scope_id(scope_id); +} + +void afxShapeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + Parent::sample(dt, elapsed_ms, cam_pos); + + if (isDefined()) + { + if (isValid()) + samples->recordSample(dt, elapsed_ms, &last_xfm); + else + samples->recordSample(dt, elapsed_ms, 0); + } +} + +bool afxShapeHistConstraint::getPosition(Point3F& pos, F32 hist) +{ + bool in_bounds; + + MatrixF xfm; + samples->getSample(hist, &xfm, in_bounds); + + pos = xfm.getPosition(); + + return in_bounds; +} + +bool afxShapeHistConstraint::getTransform(MatrixF& xfm, F32 hist) +{ + bool in_bounds; + + samples->getSample(hist, &xfm, in_bounds); + + return in_bounds; +} + +void afxShapeHistConstraint::onDeleteNotify(SimObject* obj) +{ + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeNodeHistConstraint + +afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr) + : afxShapeNodeConstraint(mgr) +{ + samples = 0; +} + +afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name, + StringTableEntry arb_node) + : afxShapeNodeConstraint(mgr, arb_name, arb_node) +{ + samples = 0; +} + +afxShapeNodeHistConstraint::~afxShapeNodeHistConstraint() +{ + delete samples; +} + +void afxShapeNodeHistConstraint::set(ShapeBase* shape) +{ + if (shape && !samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set(shape); +} + +void afxShapeNodeHistConstraint::set_scope_id(U16 scope_id) +{ + if (scope_id > 0 && !samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set_scope_id(scope_id); +} + +void afxShapeNodeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + Parent::sample(dt, elapsed_ms, cam_pos); + + if (isDefined()) + { + if (isValid()) + samples->recordSample(dt, elapsed_ms, &last_xfm); + else + samples->recordSample(dt, elapsed_ms, 0); + } +} + +bool afxShapeNodeHistConstraint::getPosition(Point3F& pos, F32 hist) +{ + bool in_bounds; + + MatrixF xfm; + samples->getSample(hist, &xfm, in_bounds); + + pos = xfm.getPosition(); + + return in_bounds; +} + +bool afxShapeNodeHistConstraint::getTransform(MatrixF& xfm, F32 hist) +{ + bool in_bounds; + + samples->getSample(hist, &xfm, in_bounds); + + return in_bounds; +} + +void afxShapeNodeHistConstraint::onDeleteNotify(SimObject* obj) +{ + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxObjectHistConstraint + +afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr) + : afxObjectConstraint(mgr) +{ + samples = 0; +} + +afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) + : afxObjectConstraint(mgr, arb_name) +{ + samples = 0; +} + +afxObjectHistConstraint::~afxObjectHistConstraint() +{ + delete samples; +} + +void afxObjectHistConstraint::set(SceneObject* obj) +{ + if (obj && !samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set(obj); +} + +void afxObjectHistConstraint::set_scope_id(U16 scope_id) +{ + if (scope_id > 0 && !samples) + { + samples = new afxSampleXfmBuffer; + samples->configHistory(cons_def.history_time, cons_def.sample_rate); + } + + Parent::set_scope_id(scope_id); +} + +void afxObjectHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) +{ + Parent::sample(dt, elapsed_ms, cam_pos); + + if (isDefined()) + { + if (isValid()) + samples->recordSample(dt, elapsed_ms, &last_xfm); + else + samples->recordSample(dt, elapsed_ms, 0); + } +} + +bool afxObjectHistConstraint::getPosition(Point3F& pos, F32 hist) +{ + bool in_bounds; + + MatrixF xfm; + samples->getSample(hist, &xfm, in_bounds); + + pos = xfm.getPosition(); + + return in_bounds; +} + +bool afxObjectHistConstraint::getTransform(MatrixF& xfm, F32 hist) +{ + bool in_bounds; + + samples->getSample(hist, &xfm, in_bounds); + + return in_bounds; +} + +void afxObjectHistConstraint::onDeleteNotify(SimObject* obj) +{ + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/afxConstraint.h b/Engine/source/afx/afxConstraint.h new file mode 100644 index 000000000..d2ea324ae --- /dev/null +++ b/Engine/source/afx/afxConstraint.h @@ -0,0 +1,677 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CONSTRAINT_H_ +#define _AFX_CONSTRAINT_H_ + +#include "core/util/tVector.h" +#include "T3D/shapeBase.h" + +#include "afxEffectDefs.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxConstraintDef + +class afxEffectBaseData; + +struct afxConstraintDef : public afxEffectDefs +{ + enum DefType + { + CONS_UNDEFINED, + CONS_PREDEFINED, + CONS_SCENE, + CONS_EFFECT, + CONS_GHOST + }; + + DefType def_type; + + StringTableEntry cons_src_name; + StringTableEntry cons_node_name; + F32 history_time; + U8 sample_rate; + + bool runs_on_server; + bool runs_on_client; + bool pos_at_box_center; + bool treat_as_camera; + + /*C*/ afxConstraintDef(); + + bool isDefined(); + + bool isArbitraryObject(); + void reset(); + bool parseSpec(const char* spec, bool runs_on_server, bool runs_on_client); + + static void gather_cons_defs(Vector& defs, Vector& fx); + + static StringTableEntry SCENE_CONS_KEY; + static StringTableEntry EFFECT_CONS_KEY; + static StringTableEntry GHOST_CONS_KEY; +}; + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxConstraint +// Abstract base-class for a simple constraint mechanism used to constrain +// special effects to spell related objects such as the spellcaster, target, +// projectile, or impact location. +// +// note -- the direction vectors don't really fit... should probably consider separate +// constraint types for position, orientation, and possibly a look-at constraint. +// + +class SceneObject; +class afxConstraintMgr; + +class afxConstraint : public SimObject, public afxEffectDefs +{ + friend class afxConstraintMgr; + typedef SimObject Parent; + +protected: + afxConstraintMgr* mgr; + afxConstraintDef cons_def; + bool is_defined; + bool is_valid; + Point3F last_pos; + MatrixF last_xfm; + F32 history_time; + bool is_alive; + bool gone_missing; + U32 change_code; + +public: + /*C*/ afxConstraint(afxConstraintMgr*); + virtual ~afxConstraint(); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f) + { pos = last_pos; return is_valid; } + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f) + { xfm = last_xfm; return is_valid;} + virtual bool getAltitudes(F32& terrain_alt, F32& interior_alt) { return false; } + + virtual bool isDefined() { return is_defined; } + virtual bool isValid() { return is_valid; } + virtual U32 getChangeCode() { return change_code; } + + virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) + { return 0; }; + virtual void resetAnimation(U32 tag) { }; + virtual U32 lockAnimation() { return 0; } + virtual void unlockAnimation(U32 tag) { } + virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; } + + virtual S32 getDamageState() { return -1; } + virtual void setLivingState(bool state) { is_alive = state; }; + virtual bool getLivingState() { return is_alive; }; + + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)=0; + + virtual SceneObject* getSceneObject()=0; + virtual void restoreObject(SceneObject*)=0; + virtual U16 getScopeId()=0; + + virtual U32 getTriggers()=0; + + virtual void set_scope_id(U16 scope_id) { } + virtual void unset() { } +}; + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxConstraintMgr + +class ShapeBase; +class afxEffectWrapper; +class afxShapeConstraint; +class afxObjectConstraint; +class BitStream; +class NetConnection; + +struct afxConstraintID +{ + S16 index; + S16 sub_index; + + afxConstraintID() { index = -1; sub_index = 0; } + afxConstraintID(S16 idx, S16 sub=0) { index = idx; sub_index = sub; } + bool undefined() const { return (index < 0); } +}; + +typedef Vector afxConstraintList; + +class afxConstraintMgr : public afxEffectDefs +{ + typedef SimObject Parent; + + struct preDef + { + StringTableEntry name; + U32 type; + }; + + Vector constraints_v; + + Vector names_on_server; + Vector ghost_ids; + Vector predefs; + U32 starttime; + bool on_server; + bool initialized; + F32 scoping_dist_sq; + + SceneObject* find_object_from_name(StringTableEntry); + S32 find_cons_idx_from_name(StringTableEntry); + S32 find_effect_cons_idx_from_name(StringTableEntry); + + void create_constraint(const afxConstraintDef&); + void set_ref_shape(afxConstraintID which_id, ShapeBase*); + void set_ref_shape(afxConstraintID which_id, U16 scope_id); + +public: + /*C*/ afxConstraintMgr(); + /*D*/ ~afxConstraintMgr(); + + void defineConstraint(U32 type, StringTableEntry); + + afxConstraintID setReferencePoint(StringTableEntry which, Point3F point); + afxConstraintID setReferencePoint(StringTableEntry which, Point3F point, Point3F vector); + afxConstraintID setReferenceTransform(StringTableEntry which, MatrixF& xfm); + afxConstraintID setReferenceObject(StringTableEntry which, SceneObject*); + afxConstraintID setReferenceObjectByScopeId(StringTableEntry which, U16 scope_id, bool is_shape); + afxConstraintID setReferenceEffect(StringTableEntry which, afxEffectWrapper*); + afxConstraintID createReferenceEffect(StringTableEntry which, afxEffectWrapper*); + + void setReferencePoint(afxConstraintID which_id, Point3F point); + void setReferencePoint(afxConstraintID which_id, Point3F point, Point3F vector); + void setReferenceTransform(afxConstraintID which_id, MatrixF& xfm); + void setReferenceObject(afxConstraintID which_id, SceneObject*); + void setReferenceObjectByScopeId(afxConstraintID which_id, U16 scope_id, bool is_shape); + void setReferenceEffect(afxConstraintID which_id, afxEffectWrapper*); + + void invalidateReference(afxConstraintID which_id); + + afxConstraintID getConstraintId(const afxConstraintDef&); + afxConstraint* getConstraint(afxConstraintID cons_id); + + void sample(F32 dt, U32 now, const Point3F* cam_pos=0); + + void setStartTime(U32 timestamp) { starttime = timestamp; } + void initConstraintDefs(Vector&, bool on_server, F32 scoping_dist=-1.0f); + void packConstraintNames(NetConnection* conn, BitStream* stream); + void unpackConstraintNames(BitStream* stream); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +// scope-tracking +private: + Vector scopeable_objs; + Vector scopeable_ids; + Vector* missing_objs; + Vector* missing_objs2; + Vector missing_objs_a; + Vector missing_objs_b; + +public: + void addScopeableObject(SceneObject*); + void removeScopeableObject(SceneObject*); + void clearAllScopeableObjs(); + + void postMissingConstraintObject(afxConstraint*, bool is_deleting=false); + void restoreScopedObject(SceneObject*, afxChoreographer* ch); + void adjustProcessOrdering(afxChoreographer*); + + F32 getScopingDistanceSquared() const { return scoping_dist_sq; } +}; + +inline afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point) +{ + return setReferencePoint(which, point, Point3F(0,0,1)); +} + +inline void afxConstraintMgr::setReferencePoint(afxConstraintID which, Point3F point) +{ + setReferencePoint(which, point, Point3F(0,0,1)); +} + + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPointConstraint +// This constrains to a specific 3D position such as an impact location. +// + +class afxPointConstraint : public afxConstraint +{ + typedef afxConstraint Parent; + +protected: + Point3F point; + Point3F vector; + +public: + /*C*/ afxPointConstraint(afxConstraintMgr*); + virtual ~afxPointConstraint(); + + virtual void set(Point3F point, Point3F vector); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual SceneObject* getSceneObject() { return 0; } + virtual void restoreObject(SceneObject*) { } + virtual U16 getScopeId() { return 0; } + virtual U32 getTriggers() { return 0; } + + virtual void unset() { set(Point3F::Zero, Point3F(0,0,1)); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxTransformConstraint +// This constrains to a specific 3D transformation. +// + +class afxTransformConstraint : public afxConstraint +{ + typedef afxConstraint Parent; + +protected: + MatrixF xfm; + +public: + /*C*/ afxTransformConstraint(afxConstraintMgr*); + virtual ~afxTransformConstraint(); + + virtual void set(const MatrixF& xfm); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual SceneObject* getSceneObject() { return 0; } + virtual void restoreObject(SceneObject*) { } + virtual U16 getScopeId() { return 0; } + virtual U32 getTriggers() { return 0; } + + virtual void unset() { set(MatrixF::Identity); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeConstraint +// This constrains to a hierarchical shape (subclasses of ShapeBase), such as a +// Player or a Vehicle. You can also constrain to named sub-nodes of a shape. + +class ShapeBase; +class SceneObject; + +class afxShapeConstraint : public afxConstraint +{ + friend class afxConstraintMgr; + typedef afxConstraint Parent; + +protected: + StringTableEntry arb_name; + ShapeBase* shape; + U16 scope_id; + U32 clip_tag; + U32 lock_tag; + +public: + /*C*/ afxShapeConstraint(afxConstraintMgr*); + /*C*/ afxShapeConstraint(afxConstraintMgr*, StringTableEntry arb_name); + virtual ~afxShapeConstraint(); + + virtual void set(ShapeBase* shape); + virtual void set_scope_id(U16 scope_id); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim); + virtual void resetAnimation(U32 tag); + virtual U32 lockAnimation(); + virtual void unlockAnimation(U32 tag); + virtual F32 getAnimClipDuration(const char* clip); + + void remapAnimation(U32 tag, ShapeBase* other_shape); + + virtual S32 getDamageState(); + + virtual SceneObject* getSceneObject() { return shape; } + virtual void restoreObject(SceneObject*); + virtual U16 getScopeId() { return scope_id; } + virtual U32 getTriggers(); + + virtual void onDeleteNotify(SimObject*); + + virtual void unset() { set(0); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeNodeConstraint + +class afxShapeNodeConstraint : public afxShapeConstraint +{ + friend class afxConstraintMgr; + typedef afxShapeConstraint Parent; + +protected: + StringTableEntry arb_node; + S32 shape_node_ID; + +public: + /*C*/ afxShapeNodeConstraint(afxConstraintMgr*); + /*C*/ afxShapeNodeConstraint(afxConstraintMgr*, StringTableEntry arb_name, StringTableEntry arb_node); + + virtual void set(ShapeBase* shape); + virtual void set_scope_id(U16 scope_id); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + virtual void restoreObject(SceneObject*); + + S32 getNodeID() const { return shape_node_ID; } + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxObjectConstraint +// This constrains to a simple 3D object (subclasses of SceneObject), such as an +// afxMagicMissile or a Projectile. You cannot constrain to sub-nodes with an +// afxObjectConstraint, use afxShapeConstraint instead. + +class SceneObject; + +class afxObjectConstraint : public afxConstraint +{ + friend class afxConstraintMgr; + typedef afxConstraint Parent; + +protected: + StringTableEntry arb_name; + SceneObject* obj; + U16 scope_id; + bool is_camera; + +public: + afxObjectConstraint(afxConstraintMgr*); + afxObjectConstraint(afxConstraintMgr*, StringTableEntry arb_name); + virtual ~afxObjectConstraint(); + + virtual void set(SceneObject* obj); + virtual void set_scope_id(U16 scope_id); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual SceneObject* getSceneObject() { return obj; } + virtual void restoreObject(SceneObject*); + virtual U16 getScopeId() { return scope_id; } + virtual U32 getTriggers(); + + virtual void onDeleteNotify(SimObject*); + + virtual void unset() { set(0); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectConstraint +// This constrains to a hierarchical shape (subclasses of ShapeBase), such as a +// Player or a Vehicle. You can also constrain to named sub-nodes of a shape. + +class afxEffectWrapper; + +class afxEffectConstraint : public afxConstraint +{ + friend class afxConstraintMgr; + typedef afxConstraint Parent; + +protected: + StringTableEntry effect_name; + afxEffectWrapper* effect; + U32 clip_tag; + bool is_death_clip; + U32 lock_tag; + +public: + /*C*/ afxEffectConstraint(afxConstraintMgr*); + /*C*/ afxEffectConstraint(afxConstraintMgr*, StringTableEntry effect_name); + virtual ~afxEffectConstraint(); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f); + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f); + virtual bool getAltitudes(F32& terrain_alt, F32& interior_alt); + + virtual void set(afxEffectWrapper* effect); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { } + + virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim); + virtual void resetAnimation(U32 tag); + virtual F32 getAnimClipDuration(const char* clip); + + virtual SceneObject* getSceneObject() { return 0; } + virtual void restoreObject(SceneObject*) { } + virtual U16 getScopeId() { return 0; } + virtual U32 getTriggers(); + + virtual void unset() { set(0); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectNodeConstraint + +class afxEffectNodeConstraint : public afxEffectConstraint +{ + friend class afxConstraintMgr; + typedef afxEffectConstraint Parent; + +protected: + StringTableEntry effect_node; + S32 effect_node_ID; + +public: + /*C*/ afxEffectNodeConstraint(afxConstraintMgr*); + /*C*/ afxEffectNodeConstraint(afxConstraintMgr*, StringTableEntry name, StringTableEntry node); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f); + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f); + + virtual void set(afxEffectWrapper* effect); + + S32 getNodeID() const { return effect_node_ID; } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSampleBuffer + +class afxSampleBuffer +{ +protected: + U32 buffer_sz; + U32 buffer_ms; + U32 ms_per_sample; + U32 elapsed_ms; + U32 last_sample_ms; + U32 next_sample_num; + U32 n_samples; + + virtual void recSample(U32 idx, void* data) = 0; + bool compute_idx_from_lag(F32 lag, U32& idx); + bool compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, F32& t); + +public: + /*C*/ afxSampleBuffer(); + virtual ~afxSampleBuffer(); + + virtual void configHistory(F32 hist_len, U8 sample_rate); + void recordSample(F32 dt, U32 elapsed_ms, void* data); + virtual void getSample(F32 lag, void* data, bool& oob) = 0; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSampleXfmBuffer + +class afxSampleXfmBuffer : public afxSampleBuffer +{ + typedef afxSampleBuffer Parent; + +protected: + MatrixF* xfm_buffer; + + virtual void recSample(U32 idx, void* data); + +public: + /*C*/ afxSampleXfmBuffer(); + virtual ~afxSampleXfmBuffer(); + + virtual void configHistory(F32 hist_len, U8 sample_rate); + virtual void getSample(F32 lag, void* data, bool& oob); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPointHistConstraint +// This class extends afxPointConstraint to remember its values for a period of time. + +class afxPointHistConstraint : public afxPointConstraint +{ + friend class afxConstraintMgr; + typedef afxPointConstraint Parent; + +protected: + afxSampleBuffer* samples; + +public: + /*C*/ afxPointHistConstraint(afxConstraintMgr*); + virtual ~afxPointHistConstraint(); + + virtual void set(Point3F point, Point3F vector); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f); + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPointHistConstraint +// This class extends afxTransformConstraint to remember its values for a period of time. + +class afxTransformHistConstraint : public afxTransformConstraint +{ + friend class afxConstraintMgr; + typedef afxTransformConstraint Parent; + +protected: + afxSampleBuffer* samples; + +public: + /*C*/ afxTransformHistConstraint(afxConstraintMgr*); + virtual ~afxTransformHistConstraint(); + + virtual void set(const MatrixF& xfm); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f); + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeHistConstraint +// This class extends afxShapeConstraint to remember its values for a period of time. + +class afxShapeHistConstraint : public afxShapeConstraint +{ + friend class afxConstraintMgr; + typedef afxShapeConstraint Parent; + +protected: + afxSampleBuffer* samples; + +public: + /*C*/ afxShapeHistConstraint(afxConstraintMgr*); + /*C*/ afxShapeHistConstraint(afxConstraintMgr*, StringTableEntry arb_name); + virtual ~afxShapeHistConstraint(); + + virtual void set(ShapeBase* shape); + virtual void set_scope_id(U16 scope_id); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f); + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f); + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxShapeNodeHistConstraint +// This class extends afxShapeConstraint to remember its values for a period of time. + +class afxShapeNodeHistConstraint : public afxShapeNodeConstraint +{ + friend class afxConstraintMgr; + typedef afxShapeNodeConstraint Parent; + +protected: + afxSampleBuffer* samples; + +public: + /*C*/ afxShapeNodeHistConstraint(afxConstraintMgr*); + /*C*/ afxShapeNodeHistConstraint(afxConstraintMgr*, StringTableEntry arb_name, StringTableEntry arb_node); + virtual ~afxShapeNodeHistConstraint(); + + virtual void set(ShapeBase* shape); + virtual void set_scope_id(U16 scope_id); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f); + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f); + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxObjectHistConstraint +// This class extends afxObjectConstraint to remember its values for a period of time. + +class SceneObject; + +class afxObjectHistConstraint : public afxObjectConstraint +{ + friend class afxConstraintMgr; + typedef afxObjectConstraint Parent; + +protected: + afxSampleBuffer* samples; + +public: + afxObjectHistConstraint(afxConstraintMgr*); + afxObjectHistConstraint(afxConstraintMgr*, StringTableEntry arb_name); + virtual ~afxObjectHistConstraint(); + + virtual void set(SceneObject* obj); + virtual void set_scope_id(U16 scope_id); + virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); + + virtual bool getPosition(Point3F& pos, F32 hist=0.0f); + virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f); + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_CONSTRAINT_H_ + diff --git a/Engine/source/afx/afxEffectDefs.h b/Engine/source/afx/afxEffectDefs.h new file mode 100644 index 000000000..bbcf5cef2 --- /dev/null +++ b/Engine/source/afx/afxEffectDefs.h @@ -0,0 +1,114 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_EFFECT_DEFS_H_ +#define _AFX_EFFECT_DEFS_H_ + +#include "afx/arcaneFX.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectBASE + +class afxEffectDefs +{ +public: + + enum + { + MAX_EFFECTS_PER_PHRASE = 1023, + EFFECTS_PER_PHRASE_BITS = 10 + }; + + // effect networking + enum + { + SERVER_ONLY = BIT(0), + SCOPE_ALWAYS = BIT(1), + GHOSTABLE = BIT(2), + CLIENT_ONLY = BIT(3), + SERVER_AND_CLIENT = BIT(4) + }; + + // effect condititons + enum + { + DISABLED = BIT(0), + ENABLED = BIT(1), + FAILING = BIT(2), + ALIVE = ENABLED, + DEAD = DISABLED, + DYING = FAILING, + // + IMPACTED_SOMETHING = BIT(31), + IMPACTED_TARGET = BIT(30), + IMPACTED_PRIMARY = BIT(29), + IMPACT_IN_WATER = BIT(28), + CASTER_IN_WATER = BIT(27), + }; + + enum + { + REQUIRES_STOP = BIT(0), + RUNS_ON_SERVER = BIT(1), + RUNS_ON_CLIENT = BIT(2), + }; + + enum + { + MAX_XFM_MODIFIERS = 32, + INFINITE_LIFETIME = (24*60*60) + }; + + enum + { + POINT_CONSTRAINT, + TRANSFORM_CONSTRAINT, + OBJECT_CONSTRAINT, + CAMERA_CONSTRAINT, + OBJECT_CONSTRAINT_SANS_OBJ, + OBJECT_CONSTRAINT_SANS_SHAPE, + UNDEFINED_CONSTRAINT_TYPE + }; + + enum + { + DIRECT_DAMAGE, + DAMAGE_OVER_TIME, + AREA_DAMAGE + }; + + enum + { + TIMING_DELAY = BIT(0), + TIMING_LIFETIME = BIT(1), + TIMING_FADE_IN = BIT(2), + TIMING_FADE_OUT = BIT(3), + TIMING_BITS = 2 + }; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_EFFECT_DEFS_H_ diff --git a/Engine/source/afx/afxEffectGroup.cpp b/Engine/source/afx/afxEffectGroup.cpp new file mode 100644 index 000000000..a7e97f25e --- /dev/null +++ b/Engine/source/afx/afxEffectGroup.cpp @@ -0,0 +1,270 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" + +#include "afx/afxEffectGroup.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectGroupData::egValidator +// +// When an effect is added using "addEffect", this validator intercepts the value +// and adds it to the dynamic effects list. +// +void afxEffectGroupData::egValidator::validateType(SimObject* object, void* typePtr) +{ + afxEffectGroupData* eff_data = dynamic_cast(object); + afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); + + if (eff_data && ew) + { + eff_data->fx_list.push_back(*ew); + *ew = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectGroupData + +IMPLEMENT_CO_DATABLOCK_V1(afxEffectGroupData); + +ConsoleDocClass( afxEffectGroupData, + "@brief A datablock that describes an Effect Group.\n\n" + + "afxEffectGroupData provides a way for adding several effects to a choreographer as a " + "group and can be used wherever an afxEffectWrapperData is used. Basically, an " + "effect-group is a simple list of effect-wrappers. When an effect-group is added to a " + "choreographer, the end result is almost the same as adding all of the group's " + "effect-wrappers directly to the choreographer. The main difference is that the " + "grouped effects can be turned on and off collectively and created in multiples. " + "Effect-groups can also contain other effect-groups, forming a hierarchy of effects.\n\n" + + "A great strength of effect-groups is that they have a count setting that multiplies " + "the number of times the effects in the group are added to the owning choreographer " + "and this doesn't happen until the choreographer instance is created and launched. " + "This makes a big difference for certain kinds of effects, such as fireworks, that " + "tend to consist of small groupings of effects that are repeated many times with " + "slight variations. With groups, an effect like this has a very compact representation " + "for transmitting from server to clients, that only expands when actually used.\n\n" + + "Effect-groups with a count greater than one are extremely useful when some of the " + "effects use field substitutions. When an effect-group is expanded, it essentially runs " + "through a for-loop from 0 to count-1 and creates a new set of effect instances each " + "time through the loop. For each new set of effects, their group-index is set to the " + "index of this for-loop, which in turn replaces the ## token used in any field " + "substitutions in the child effects. In essence, the for-loop index becomes a parameter " + "of the child effects which can be used to vary the effects created in each loop.\n\n" + + "@see afxEffectBaseData\n\n" + "@see afxEffectWrapperData\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxEffectGroupData::afxEffectGroupData() +{ + group_enabled = true; + group_count = 1; + idx_offset = 0; + assign_idx = false; + + // dummy entry holds effect-wrapper pointer while a special validator + // grabs it and adds it to an appropriate effects list + dummy_fx_entry = NULL; + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; +} + +afxEffectGroupData::afxEffectGroupData(const afxEffectGroupData& other, bool temp_clone) : afxEffectBaseData(other, temp_clone) +{ + group_enabled = other.group_enabled; + group_count = other.group_count; + idx_offset = other.idx_offset; + assign_idx = other.assign_idx; + timing = other.timing; + dummy_fx_entry = other.dummy_fx_entry; + do_id_convert = other.do_id_convert; // -- + fx_list = other.fx_list; // -- +} + +void afxEffectGroupData::reloadReset() +{ + fx_list.clear(); +} + +void afxEffectGroupData::pack_fx(BitStream* stream, const afxEffectList& fx, bool packed) +{ + stream->writeInt(fx.size(), EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < fx.size(); i++) + writeDatablockID(stream, fx[i], packed); +} + +void afxEffectGroupData::unpack_fx(BitStream* stream, afxEffectList& fx) +{ + fx.clear(); + S32 n_fx = stream->readInt(EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < n_fx; i++) + fx.push_back((afxEffectWrapperData*)readDatablockID(stream)); +} + +#define myOffset(field) Offset(field, afxEffectGroupData) + +void afxEffectGroupData::initPersistFields() +{ + addField("groupEnabled", TypeBool, myOffset(group_enabled), + "..."); + addField("count", TypeS32, myOffset(group_count), + "..."); + addField("indexOffset", TypeS8, myOffset(idx_offset), + "..."); + addField("assignIndices", TypeBool, myOffset(assign_idx), + "..."); + + addField("delay", TypeF32, myOffset(timing.delay), + "..."); + addField("lifetime", TypeF32, myOffset(timing.lifetime), + "..."); + addField("fadeInTime", TypeF32, myOffset(timing.fade_in_time), + "..."); + addField("fadeOutTime", TypeF32, myOffset(timing.fade_out_time), + "..."); + + // effect lists + // for each of these, dummy_fx_entry is set and then a validator adds it to the appropriate effects list + static egValidator emptyValidator(0); + + addFieldV("addEffect", TYPEID(), myOffset(dummy_fx_entry), &emptyValidator, + "..."); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("addEffect"); +} + +void afxEffectGroupData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeFlag(group_enabled); + stream->write(group_count); + stream->write(idx_offset); + stream->writeFlag(assign_idx); + stream->write(timing.delay); + stream->write(timing.lifetime); + stream->write(timing.fade_in_time); + stream->write(timing.fade_out_time); + + pack_fx(stream, fx_list, packed); +} + +void afxEffectGroupData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + group_enabled = stream->readFlag(); + stream->read(&group_count); + stream->read(&idx_offset); + assign_idx = stream->readFlag(); + stream->read(&timing.delay); + stream->read(&timing.lifetime); + stream->read(&timing.fade_in_time); + stream->read(&timing.fade_out_time); + + do_id_convert = true; + unpack_fx(stream, fx_list); +} + +bool afxEffectGroupData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + for (S32 i = 0; i < fx_list.size(); i++) + { + SimObjectId db_id = SimObjectId((uintptr_t)fx_list[i]); + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, fx_list[i])) + { + Con::errorf(ConsoleLogEntry::General, + "afxEffectGroupData::preload() -- bad datablockId: 0x%x", + db_id); + } + } + } + do_id_convert = false; + } + } + + return true; +} + +void afxEffectGroupData::gather_cons_defs(Vector& defs) +{ + for (S32 i = 0; i < fx_list.size(); i++) + { + if (fx_list[i]) + fx_list[i]->gather_cons_defs(defs); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxEffectGroupData, reset, void, (),, + "Resets an effect-group datablock during reload.\n\n" + "@ingroup AFX") +{ + object->reloadReset(); +} + +DefineEngineMethod(afxEffectGroupData, addEffect, void, (afxEffectBaseData* effect),, + "Adds an effect (wrapper or group) to an effect-group.\n\n" + "@ingroup AFX") +{ + if (!effect) + { + Con::errorf("afxEffectGroupData::addEffect() -- missing afxEffectWrapperData."); + return; + } + + object->fx_list.push_back(effect); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/afxEffectGroup.h b/Engine/source/afx/afxEffectGroup.h new file mode 100644 index 000000000..2942bddb0 --- /dev/null +++ b/Engine/source/afx/afxEffectGroup.h @@ -0,0 +1,103 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_EFFECT_GROUP_H_ +#define _AFX_EFFECT_GROUP_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "console/typeValidators.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" + +class afxEffectWrapperData; + +struct afxGroupTimingData +{ + F32 delay; + F32 lifetime; + F32 fade_in_time; + F32 fade_out_time; + + afxGroupTimingData() + { + delay = 0.0f; + lifetime = 0.0f; + fade_in_time = 0.0f; + fade_out_time = 0.0f; + } +}; + +class afxEffectGroupData : public afxEffectBaseData +{ + typedef afxEffectBaseData Parent; + + class egValidator : public TypeValidator + { + U32 id; + public: + egValidator(U32 id) { this->id = id; } + void validateType(SimObject *object, void *typePtr); + }; + + bool do_id_convert; + +public: + afxEffectList fx_list; + bool group_enabled; + S32 group_count; + U8 idx_offset; + bool assign_idx; + afxGroupTimingData timing; + afxEffectBaseData* dummy_fx_entry; + +private: + void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); + void unpack_fx(BitStream* stream, afxEffectList& fx); + +public: + /*C*/ afxEffectGroupData(); + /*C*/ afxEffectGroupData(const afxEffectGroupData&, bool = false); + + virtual void reloadReset(); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + virtual void gather_cons_defs(Vector& defs); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxEffectGroupData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +#endif // _AFX_EFFECT_GROUP_H_ diff --git a/Engine/source/afx/afxEffectVector.cpp b/Engine/source/afx/afxEffectVector.cpp new file mode 100644 index 000000000..b3d03e4c6 --- /dev/null +++ b/Engine/source/afx/afxEffectVector.cpp @@ -0,0 +1,358 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afxChoreographer.h" +#include "afxEffectVector.h" +#include "afxConstraint.h" +#include "afxEffectWrapper.h" +#include "afxEffectGroup.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxEffectVector::filter_client_server() +{ + if (empty()) + return; + + for (S32 i = 0; i < fx_v->size(); i++) + { + if ((*fx_v)[i]->datablock->runsHere(on_server)) + fx_v2->push_back((*fx_v)[i]); + else + { + delete (*fx_v)[i]; + (*fx_v)[i] = 0; + } + } + + swap_vecs(); + + fx_v2->clear(); +} + +void afxEffectVector::calc_fx_dur_and_afterlife() +{ + total_fx_dur = 0.0f; + after_life = 0.0f; + + if (empty()) + return; + + for (S32 i = 0; i < fx_v->size(); i++) + { + afxEffectWrapper* ew = (*fx_v)[i]; + if (ew) + { + F32 ew_dur; + if (ew->ew_timing.lifetime < 0) + { + if (phrase_dur > ew->ew_timing.delay) + ew_dur = phrase_dur + ew->afterStopTime(); + else + ew_dur = ew->ew_timing.delay + ew->afterStopTime(); + } + else + ew_dur = ew->ew_timing.delay + ew->ew_timing.lifetime + ew->ew_timing.fade_out_time; + + if (ew_dur > total_fx_dur) + total_fx_dur = ew_dur; + + F32 after = ew->afterStopTime(); + if (after > after_life) + after_life = after; + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxEffectVector::afxEffectVector() +{ + fx_v = 0; + fx_v2 = 0; + active = false; + on_server = false; + total_fx_dur = 0; + after_life = 0; +} + +afxEffectVector::~afxEffectVector() +{ + stop(true); + delete fx_v; + delete fx_v2; +} + +void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effects, bool will_stop, F32 time_factor, + S32 group_index, const afxGroupTimingData* group_timing) +{ + afxConstraintMgr* cons_mgr = chor->getConstraintMgr(); + + for (S32 i = 0; i < effects.size(); i++) + { + if (dynamic_cast(effects[i])) + { + afxEffectGroupData* eg = (afxEffectGroupData*)effects[i]; + if (eg->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxEffectGroupData* orig_db = eg; + eg = new afxEffectGroupData(*orig_db, true); + orig_db->performSubstitutions(eg, chor, group_index); + } + + if (eg->group_enabled) + { + if (eg->assign_idx) + { + for (S32 j = 0; j < eg->group_count; j++) + effects_init(chor, eg->fx_list, will_stop, time_factor, j+eg->idx_offset, &eg->timing); + } + else + { + for (S32 j = 0; j < eg->group_count; j++) + effects_init(chor, eg->fx_list, will_stop, time_factor, group_index, &eg->timing); + } + } + + if (eg->isTempClone()) + delete eg; + } + else if (dynamic_cast(effects[i])) + { + afxEffectWrapperData* ewd = (afxEffectWrapperData*)effects[i]; + + if (ewd->getSubstitutionCount() > 0) + { + // clone the ewd and perform substitutions + afxEffectWrapperData* orig_db = ewd; + ewd = new afxEffectWrapperData(*orig_db, true); + orig_db->performSubstitutions(ewd, chor, group_index); + } + + if (ewd->effect_enabled) + { + static afxEffectTimingData inherited_timing; + bool use_inherited_timing = false; + if (ewd->inherit_timing != 0) + { + if (group_timing) + { + inherited_timing = ewd->ewd_timing; + if ((ewd->inherit_timing & afxEffectDefs::TIMING_DELAY) != 0) + inherited_timing.delay = group_timing->delay; + if ((ewd->inherit_timing & afxEffectDefs::TIMING_LIFETIME) != 0) + inherited_timing.lifetime = group_timing->lifetime; + if ((ewd->inherit_timing & afxEffectDefs::TIMING_FADE_IN) != 0) + inherited_timing.fade_in_time = group_timing->fade_in_time; + if ((ewd->inherit_timing & afxEffectDefs::TIMING_FADE_OUT) != 0) + inherited_timing.fade_out_time = group_timing->fade_out_time; + } + else + { + Con::warnf("afxEffectVector::effects_init() -- %s::inheritGroupTiming is non-zero but wrapper is not in a group."); + } + } + + const afxEffectTimingData& timing = (use_inherited_timing) ? inherited_timing : ewd->ewd_timing; + + if ( (will_stop || !ewd->requiresStop(timing)) && + (chor->testRanking(ewd->ranking_range.low, ewd->ranking_range.high)) && + (chor->testLevelOfDetail(ewd->lod_range.low, ewd->lod_range.high)) && + (ewd->testExecConditions(chor->getExecConditions())) + ) + { + afxEffectWrapper* effect; + effect = afxEffectWrapper::ew_create(chor, ewd, cons_mgr, time_factor, group_index); + if (effect) + fx_v->push_back(effect); + } + } + else + { + if (ewd->isTempClone()) + delete ewd; + } + + } + } +} + +void afxEffectVector::ev_init(afxChoreographer* chor, afxEffectList& effects, bool on_server, + bool will_stop, F32 time_factor, F32 phrase_dur, S32 group_index) +{ + this->on_server = on_server; + this->phrase_dur = phrase_dur; + + fx_v = new Vector; + + effects_init(chor, effects, will_stop, time_factor, group_index); + + fx_v2 = new Vector(fx_v->size()); +} + +void afxEffectVector::start(F32 timestamp) +{ + if (empty()) + return; + + // At this point both client and server effects are in the list. + // Timing adjustments are made during prestart(). + for (S32 i = 0; i < fx_v->size(); i++) + (*fx_v)[i]->prestart(); + + // duration and afterlife values are pre-calculated here + calc_fx_dur_and_afterlife(); + + // now we filter out client-only or server-only effects that + // don't belong here, + filter_client_server(); + + active = true; + + for (S32 j = 0; j < fx_v->size(); j++) + { + if ((*fx_v)[j]->start(timestamp)) + fx_v2->push_back((*fx_v)[j]); + else + { + delete (*fx_v)[j]; + (*fx_v)[j] = 0; + } + } + + swap_vecs(); + fx_v2->clear(); +} + +void afxEffectVector::update(F32 dt) +{ + if (empty()) + { + active = false; + return; + } + + for (int i = 0; i < fx_v->size(); i++) + { + (*fx_v)[i]->update(dt); + + if ((*fx_v)[i]->isDone() || (*fx_v)[i]->isAborted()) + { + // effect has ended, cleanup and delete + (*fx_v)[i]->cleanup(); + delete (*fx_v)[i]; + (*fx_v)[i] = 0; + } + else + { + // effect is still going, so keep it around + fx_v2->push_back((*fx_v)[i]); + } + } + + swap_vecs(); + + fx_v2->clear(); + + if (empty()) + { + active = false; + delete fx_v; fx_v =0; + delete fx_v2; fx_v2 = 0; + } +} + +void afxEffectVector::stop(bool force_cleanup) +{ + if (empty()) + { + active = false; + return; + } + + for (int i = 0; i < fx_v->size(); i++) + { + (*fx_v)[i]->stop(); + + if (force_cleanup || (*fx_v)[i]->deleteWhenStopped()) + { + // effect is over when stopped, cleanup and delete + (*fx_v)[i]->cleanup(); + delete (*fx_v)[i]; + (*fx_v)[i] = 0; + } + else + { + // effect needs to fadeout or something, so keep it around + fx_v2->push_back((*fx_v)[i]); + } + } + + swap_vecs(); + + fx_v2->clear(); + + if (empty()) + { + active = false; + delete fx_v; fx_v =0; + delete fx_v2; fx_v2 = 0; + } +} + +void afxEffectVector::interrupt() +{ + if (empty()) + { + active = false; + return; + } + + for (int i = 0; i < fx_v->size(); i++) + { + (*fx_v)[i]->stop(); + (*fx_v)[i]->cleanup(); + delete (*fx_v)[i]; + (*fx_v)[i] = 0; + } + + swap_vecs(); + + fx_v2->clear(); + + if (empty()) + { + active = false; + delete fx_v; fx_v =0; + delete fx_v2; fx_v2 = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + diff --git a/Engine/source/afx/afxEffectVector.h b/Engine/source/afx/afxEffectVector.h new file mode 100644 index 000000000..49dc11908 --- /dev/null +++ b/Engine/source/afx/afxEffectVector.h @@ -0,0 +1,86 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_EFFECT_VECTOR_H_ +#define _AFX_EFFECT_VECTOR_H_ + +#include "afx/afxEffectWrapper.h" +#include "afx/afxEffectGroup.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectVector + +class afxEffectWrapper; +class afxChoreographer; + +class afxEffectVector +{ + Vector* fx_v; + Vector* fx_v2; + + bool active; + bool on_server; + F32 phrase_dur; + F32 total_fx_dur; + F32 after_life; + + void swap_vecs(); + void filter_client_server(); + void calc_fx_dur_and_afterlife(); + + void effects_init(afxChoreographer*, afxEffectList&, bool will_stop, F32 time_factor, + S32 group_index, const afxGroupTimingData* group_timing=0); + +public: + /*C*/ afxEffectVector(); + /*D*/ ~afxEffectVector(); + + void ev_init(afxChoreographer*, afxEffectList&, bool on_server, bool will_stop, + F32 time_factor, F32 phrase_dur, S32 group_index=0); + + void start(F32 timestamp); + void update(F32 dt); + void stop(bool force_cleanup=false); + void interrupt(); + bool empty() { return (!fx_v || fx_v->empty()); } + bool isActive() { return active; } + S32 count() { return (fx_v) ? fx_v->size() : 0; } + + F32 getTotalDur() { return total_fx_dur; } + F32 getAfterLife() { return after_life; } + + Vector* getFX() { return fx_v; } +}; + +inline void afxEffectVector::swap_vecs() +{ + Vector* tmp = fx_v; + fx_v = fx_v2; + fx_v2 = tmp; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_EFFECT_VECTOR_H_ diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp new file mode 100644 index 000000000..7011b5f06 --- /dev/null +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -0,0 +1,1193 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" + +#include "afx/ce/afxComponentEffect.h" +#include "afx/afxResidueMgr.h" +#include "afx/afxChoreographer.h" +#include "afx/afxConstraint.h" +#include "afx/xm/afxXfmMod.h" +#include "afx/afxEffectWrapper.h" +#include "afx/util/afxAnimCurve.h" +#include "afx/util/afxEase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectWrapperData + +IMPLEMENT_CO_DATABLOCK_V1(afxEffectBaseData); + +ConsoleDocClass( afxEffectBaseData, + "@brief A datablock baseclass for afxEffectWrapperData and afxEffectGroupData.\n\n" + + "Not intended to be used directly, afxEffectBaseData exists to provide base member " + "variables and generic functionality for the derived classes afxEffectWrapperData and " + "afxEffectGroupData.\n\n" + + "@see afxEffectWrapperData\n\n" + "@see afxEffectGroupData\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +IMPLEMENT_CO_DATABLOCK_V1(afxEffectWrapperData); + +ConsoleDocClass( afxEffectWrapperData, + "@brief A datablock that describes an Effect Wrapper.\n\n" + + "Conceptually an effect wrapper encloses a building-block effect and acts " + "as a handle for adding the effect to a choreographer. Effect wrapper fields " + "primarily deal with effect timing, constraints, and conditional effect execution.\n\n" + + "@see afxEffectBaseData\n\n" + "@see afxEffectGroupData\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxEffectWrapperData::afxEffectWrapperData() +{ + effect_name = ST_NULLSTRING; + effect_data = 0; + effect_desc = 0; + data_ID = 0; + use_as_cons_obj = false; + use_ghost_as_cons_obj = false; + + // constraint data + cons_spec = ST_NULLSTRING; + pos_cons_spec = ST_NULLSTRING; + orient_cons_spec = ST_NULLSTRING; + aim_cons_spec = StringTable->insert("camera"); + life_cons_spec = ST_NULLSTRING; + + // conditional execution flags + effect_enabled = true; + ranking_range.set(0,255); + lod_range.set(0,255); + life_conds = 0; + for (S32 i = 0; i < MAX_CONDITION_STATES; i++) + { + exec_cond_on_bits[i] = 0; + exec_cond_off_bits[i] = 0; + exec_cond_bitmasks[i] = 0; + } + + ewd_timing.lifetime = -1; + + user_fade_out_time = 0.0; + + is_looping = false; + n_loops = 0; + loop_gap_time = 0.0f; + + ignore_time_factor = false; + propagate_time_factor = false; + + // residue settings + + // scaling factors + rate_factor = 1.0f; + scale_factor = 1.0f; + + dMemset(xfm_modifiers, 0, sizeof(xfm_modifiers)); + + forced_bbox.minExtents.set(1,1,1); + forced_bbox.maxExtents.set(-1,-1,-1); + + update_forced_bbox = false; + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; + + sort_priority = 0; + direction.set(0,1,0); + speed = 0.0f; + mass = 1.0f; + + borrow_altitudes = false; + vis_keys_spec = ST_NULLSTRING; + vis_keys = 0; + + group_index = -1; + inherit_timing = 0; +} + +afxEffectWrapperData::afxEffectWrapperData(const afxEffectWrapperData& other, bool temp_clone) : afxEffectBaseData(other, temp_clone) +{ + effect_name = other.effect_name; + effect_data = other.effect_data; + effect_desc = other.effect_desc; + data_ID = other.data_ID; + use_as_cons_obj = other.use_as_cons_obj; + use_ghost_as_cons_obj = other.use_ghost_as_cons_obj; + cons_spec = other.cons_spec; + pos_cons_spec = other.pos_cons_spec; + orient_cons_spec = other.orient_cons_spec; + aim_cons_spec = other.aim_cons_spec; + life_cons_spec = other.life_cons_spec; + cons_def = other.cons_def; + pos_cons_def = other.pos_cons_def; + orient_cons_def = other.orient_cons_def; + aim_cons_def = other.aim_cons_def; + life_cons_def = other.life_cons_def; + effect_enabled = other.effect_enabled; + ranking_range = other.ranking_range; + lod_range = other.lod_range; + life_conds = other.life_conds; + dMemcpy(exec_cond_on_bits, other.exec_cond_on_bits, sizeof(exec_cond_on_bits)); + dMemcpy(exec_cond_off_bits, other.exec_cond_off_bits, sizeof(exec_cond_off_bits)); + dMemcpy(exec_cond_bitmasks, other.exec_cond_bitmasks, sizeof(exec_cond_bitmasks)); + ewd_timing = other.ewd_timing; + user_fade_out_time = other.user_fade_out_time; + is_looping = other.is_looping; + n_loops = other.n_loops; + loop_gap_time = other.loop_gap_time; + ignore_time_factor = other.ignore_time_factor; + propagate_time_factor = other.propagate_time_factor; + rate_factor = other.rate_factor; + scale_factor = other.scale_factor; + dMemcpy(xfm_modifiers, other.xfm_modifiers, sizeof(xfm_modifiers)); + forced_bbox = other.forced_bbox; + update_forced_bbox = other.update_forced_bbox; + do_id_convert = other.do_id_convert; + sort_priority = other.sort_priority; + direction = other.direction; + speed = other.speed; + mass = other.mass; + borrow_altitudes = other.borrow_altitudes; + vis_keys_spec = other.vis_keys_spec; + vis_keys = other.vis_keys; + if (other.vis_keys) + { + vis_keys = new afxAnimCurve(); + for (S32 i = 0; i < other.vis_keys->numKeys(); i++) + { + F32 when = other.vis_keys->getKeyTime(i); + F32 what = other.vis_keys->getKeyValue(i); + vis_keys->addKey(when, what); + } + } + else + vis_keys = 0; + group_index = other.group_index; + inherit_timing = other.inherit_timing; +} + +afxEffectWrapperData::~afxEffectWrapperData() +{ + if (vis_keys) + delete vis_keys; +} + +#define myOffset(field) Offset(field, afxEffectWrapperData) + +void afxEffectWrapperData::initPersistFields() +{ + // the wrapped effect + addField("effect", TYPEID(), myOffset(effect_data), + "..."); + addField("effectName", TypeString, myOffset(effect_name), + "..."); + + // constraints + addField("constraint", TypeString, myOffset(cons_spec), + "..."); + addField("posConstraint", TypeString, myOffset(pos_cons_spec), + "..."); + addField("posConstraint2", TypeString, myOffset(aim_cons_spec), + "..."); + addField("orientConstraint", TypeString, myOffset(orient_cons_spec), + "..."); + addField("lifeConstraint", TypeString, myOffset(life_cons_spec), + "..."); + // + addField("isConstraintSrc", TypeBool, myOffset(use_as_cons_obj), + "..."); + addField("ghostIsConstraintSrc", TypeBool, myOffset(use_ghost_as_cons_obj), + "..."); + + addField("delay", TypeF32, myOffset(ewd_timing.delay), + "..."); + addField("lifetime", TypeF32, myOffset(ewd_timing.lifetime), + "..."); + addField("fadeInTime", TypeF32, myOffset(ewd_timing.fade_in_time), + "..."); + addField("residueLifetime", TypeF32, myOffset(ewd_timing.residue_lifetime), + "..."); + addField("fadeInEase", TypePoint2F, myOffset(ewd_timing.fadein_ease), + "..."); + addField("fadeOutEase", TypePoint2F, myOffset(ewd_timing.fadeout_ease), + "..."); + addField("lifetimeBias", TypeF32, myOffset(ewd_timing.life_bias), + "..."); + addField("fadeOutTime", TypeF32, myOffset(user_fade_out_time), + "..."); + + addField("rateFactor", TypeF32, myOffset(rate_factor), + "..."); + addField("scaleFactor", TypeF32, myOffset(scale_factor), + "..."); + + addField("isLooping", TypeBool, myOffset(is_looping), + "..."); + addField("loopCount", TypeS32, myOffset(n_loops), + "..."); + addField("loopGapTime", TypeF32, myOffset(loop_gap_time), + "..."); + + addField("ignoreTimeFactor", TypeBool, myOffset(ignore_time_factor), + "..."); + addField("propagateTimeFactor", TypeBool, myOffset(propagate_time_factor), + "..."); + + addField("effectEnabled", TypeBool, myOffset(effect_enabled), + "..."); + addField("rankingRange", TypeByteRange, myOffset(ranking_range), + "..."); + addField("levelOfDetailRange", TypeByteRange, myOffset(lod_range), + "..."); + addField("lifeConditions", TypeS32, myOffset(life_conds), + "..."); + addField("execConditions", TypeS32, myOffset(exec_cond_on_bits), MAX_CONDITION_STATES, + "..."); + addField("execOffConditions", TypeS32, myOffset(exec_cond_off_bits), MAX_CONDITION_STATES, + "..."); + + addField("xfmModifiers", TYPEID(), myOffset(xfm_modifiers), MAX_XFM_MODIFIERS, + "..."); + + addField("forcedBBox", TypeBox3F, myOffset(forced_bbox), + "..."); + addField("updateForcedBBox", TypeBool, myOffset(update_forced_bbox), + "..."); + + addField("sortPriority", TypeS8, myOffset(sort_priority), + "..."); + addField("direction", TypePoint3F, myOffset(direction), + "..."); + addField("speed", TypeF32, myOffset(speed), + "..."); + addField("mass", TypeF32, myOffset(mass), + "..."); + + addField("borrowAltitudes", TypeBool, myOffset(borrow_altitudes), + "..."); + addField("visibilityKeys", TypeString, myOffset(vis_keys_spec), + "..."); + + addField("groupIndex", TypeS32, myOffset(group_index), + "..."); + addField("inheritGroupTiming", TypeS32, myOffset(inherit_timing), + "..."); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("effect"); + onlyKeepClearSubstitutions("xfmModifiers"); // subs resolving to "~~", or "~0" are OK + + // Conditional Execution Flags + Con::setIntVariable("$afx::DISABLED", DISABLED); + Con::setIntVariable("$afx::ENABLED", ENABLED); + Con::setIntVariable("$afx::FAILING", FAILING); + Con::setIntVariable("$afx::DEAD", DEAD); + Con::setIntVariable("$afx::ALIVE", ALIVE); + Con::setIntVariable("$afx::DYING", DYING); +} + +bool afxEffectWrapperData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + if (!effect_data) + { + if (!Sim::findObject((SimObjectId)data_ID, effect_data)) + { + Con::errorf("afxEffectWrapperData::onAdd() -- bad datablockId: 0x%x", data_ID); + return false; + } + } + + if (effect_data) + { + if (!afxEffectAdapterDesc::identifyEffect(this)) + { + Con::errorf("afxEffectWrapperData::onAdd() -- unknown effect type."); + return false; + } + } + + parse_cons_specs(); + parse_vis_keys(); + + // figure out if fade-out is for effect of residue + if (ewd_timing.residue_lifetime > 0) + { + ewd_timing.residue_fadetime = user_fade_out_time; + ewd_timing.fade_out_time = 0.0f; + } + else + { + ewd_timing.residue_fadetime = 0.0f; + ewd_timing.fade_out_time = user_fade_out_time; + } + + // adjust fade-in time + if (ewd_timing.lifetime >= 0) + { + ewd_timing.fade_in_time = getMin(ewd_timing.lifetime, ewd_timing.fade_in_time); + } + + // adjust exec-conditions + for (S32 i = 0; i < MAX_CONDITION_STATES; i++) + exec_cond_bitmasks[i] = exec_cond_on_bits[i] | exec_cond_off_bits[i]; + + return true; +} + +void afxEffectWrapperData::packData(BitStream* stream) +{ + Parent::packData(stream); + + writeDatablockID(stream, effect_data, packed); + + stream->writeString(effect_name); + + stream->writeString(cons_spec); + stream->writeString(pos_cons_spec); + stream->writeString(orient_cons_spec); + stream->writeString(aim_cons_spec); + stream->writeString(life_cons_spec); + // + stream->write(use_as_cons_obj); + //stream->write(use_ghost_as_cons_obj); + + stream->writeFlag(effect_enabled); + stream->write(ranking_range.low); + stream->write(ranking_range.high); + stream->write(lod_range.low); + stream->write(lod_range.high); + + for (S32 i = 0; i < MAX_CONDITION_STATES; i++) + { + stream->write(exec_cond_on_bits[i]); + stream->write(exec_cond_off_bits[i]); + } + stream->write(life_conds); + stream->write(ewd_timing.delay); + stream->write(ewd_timing.lifetime); + stream->write(ewd_timing.fade_in_time); + stream->write(user_fade_out_time); + stream->write(is_looping); + stream->write(n_loops); + stream->write(loop_gap_time); + stream->write(ignore_time_factor); + stream->write(propagate_time_factor); + stream->write(ewd_timing.residue_lifetime); + stream->write(rate_factor); + stream->write(scale_factor); + + // modifiers + pack_mods(stream, xfm_modifiers, packed); + + mathWrite(*stream, forced_bbox); + stream->write(update_forced_bbox); + + stream->write(sort_priority); + mathWrite(*stream, direction); + stream->write(speed); + stream->write(mass); + + stream->write(borrow_altitudes); + if (stream->writeFlag(vis_keys_spec != ST_NULLSTRING)) + stream->writeLongString(1023, vis_keys_spec); + + if (stream->writeFlag(group_index != -1)) + stream->write(group_index); + + stream->writeInt(inherit_timing, TIMING_BITS); +} + +void afxEffectWrapperData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + data_ID = readDatablockID(stream); + + effect_name = stream->readSTString(); + + cons_spec = stream->readSTString(); + pos_cons_spec = stream->readSTString(); + orient_cons_spec = stream->readSTString(); + aim_cons_spec = stream->readSTString(); + life_cons_spec = stream->readSTString(); + // + stream->read(&use_as_cons_obj); + //stream->read(&use_ghost_as_cons_obj); + + effect_enabled = stream->readFlag(); + stream->read(&ranking_range.low); + stream->read(&ranking_range.high); + stream->read(&lod_range.low); + stream->read(&lod_range.high); + + for (S32 i = 0; i < MAX_CONDITION_STATES; i++) + { + stream->read(&exec_cond_on_bits[i]); + stream->read(&exec_cond_off_bits[i]); + } + stream->read(&life_conds); + stream->read(&ewd_timing.delay); + stream->read(&ewd_timing.lifetime); + stream->read(&ewd_timing.fade_in_time); + stream->read(&user_fade_out_time); + stream->read(&is_looping); + stream->read(&n_loops); + stream->read(&loop_gap_time); + stream->read(&ignore_time_factor); + stream->read(&propagate_time_factor); + stream->read(&ewd_timing.residue_lifetime); + stream->read(&rate_factor); + stream->read(&scale_factor); + + // modifiers + do_id_convert = true; + unpack_mods(stream, xfm_modifiers); + + mathRead(*stream, &forced_bbox); + stream->read(&update_forced_bbox); + + stream->read(&sort_priority); + mathRead(*stream, &direction); + stream->read(&speed); + stream->read(&mass); + + stream->read(&borrow_altitudes); + if (stream->readFlag()) + { + char buf[1024]; + stream->readLongString(1023, buf); + vis_keys_spec = StringTable->insert(buf); + } + else + vis_keys_spec = ST_NULLSTRING; + + if (stream->readFlag()) + stream->read(&group_index); + else + group_index = -1; + + inherit_timing = stream->readInt(TIMING_BITS); +} + +/* static*/ +S32 num_modifiers(afxXM_BaseData* mods[]) +{ + S32 n_mods = 0; + for (int i = 0; i < afxEffectDefs::MAX_XFM_MODIFIERS; i++) + { + if (mods[i]) + { + if (i != n_mods) + { + mods[n_mods] = mods[i]; + mods[i] = 0; + } + n_mods++; + } + } + + return n_mods; +} + +void afxEffectWrapperData::parse_cons_specs() +{ + // parse the constraint specifications + bool runs_on_s = runsOnServer(); + bool runs_on_c = runsOnClient(); + cons_def.parseSpec(cons_spec, runs_on_s, runs_on_c); + pos_cons_def.parseSpec(pos_cons_spec, runs_on_s, runs_on_c); + orient_cons_def.parseSpec(orient_cons_spec, runs_on_s, runs_on_c); + aim_cons_def.parseSpec(aim_cons_spec, runs_on_s, runs_on_c); + life_cons_def.parseSpec(life_cons_spec, runs_on_s, runs_on_c); + if (cons_def.isDefined()) + { + pos_cons_def = cons_def; + if (!orient_cons_def.isDefined()) + orient_cons_def = cons_def; + } +} + +void afxEffectWrapperData::parse_vis_keys() +{ + if (vis_keys_spec != ST_NULLSTRING) + { + if (vis_keys) + delete vis_keys; + vis_keys = new afxAnimCurve(); + + char* keys_buffer = dStrdup(vis_keys_spec); + + char* key_token = dStrtok(keys_buffer, " \t"); + while (key_token != NULL) + { + char* colon = dStrchr(key_token, ':'); + if (colon) + { + *colon = '\0'; + + F32 when = dAtof(key_token); + F32 what = dAtof(colon+1); + + vis_keys->addKey(when, what); + } + key_token = dStrtok(NULL, " \t"); + } + + dFree(keys_buffer); + vis_keys->sort(); + } +} + +void afxEffectWrapperData::gather_cons_defs(Vector& defs) +{ + if (pos_cons_def.isDefined()) + defs.push_back(pos_cons_def); + if (orient_cons_def.isDefined()) + defs.push_back(orient_cons_def); + if (aim_cons_def.isDefined()) + defs.push_back(aim_cons_def); + if (life_cons_def.isDefined()) + defs.push_back(life_cons_def); + + afxComponentEffectData* ce_data = dynamic_cast(effect_data); + if (ce_data) + ce_data->gather_cons_defs(defs); +} + +void afxEffectWrapperData::pack_mods(BitStream* stream, afxXM_BaseData* mods[], bool packed) +{ + S32 n_mods = num_modifiers(mods); + stream->writeInt(n_mods, 6); + for (int i = 0; i < n_mods; i++) + writeDatablockID(stream, mods[i], packed); +} + +void afxEffectWrapperData::unpack_mods(BitStream* stream, afxXM_BaseData* mods[]) +{ + S32 n_mods = stream->readInt(6); + for (int i = 0; i < n_mods; i++) + mods[i] = (afxXM_BaseData*) readDatablockID(stream); +} + +bool afxEffectWrapperData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + for (int i = 0; i < MAX_XFM_MODIFIERS; i++) + { + SimObjectId db_id = SimObjectId((uintptr_t)xfm_modifiers[i]); + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, xfm_modifiers[i])) + { + Con::errorf("afxEffectWrapperData::preload() -- bad datablockId: 0x%x (xfm_modifiers[%d])", + db_id, i); + } + } + do_id_convert = false; + } + } + } + + return true; +} + +void afxEffectWrapperData::onPerformSubstitutions() +{ + Parent::onPerformSubstitutions(); + + parse_cons_specs(); + parse_vis_keys(); + + if (ewd_timing.residue_lifetime > 0) + { + ewd_timing.residue_fadetime = user_fade_out_time; + ewd_timing.fade_out_time = 0.0f; + } + else + { + ewd_timing.residue_fadetime = 0.0f; + ewd_timing.fade_out_time = user_fade_out_time; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectWrapper + +IMPLEMENT_CONOBJECT(afxEffectWrapper); + +ConsoleDocClass( afxEffectWrapper, + "@brief An Effect Wrapper as defined by an afxEffectWrapperData datablock.\n\n" + + "Conceptually an effect wrapper encloses a building-block effect and acts " + "as a handle for adding the effect to a choreographer. Effect wrapper fields " + "primarily deal with effect timing, constraints, and conditional effect execution.\n\n" + + "Not intended to be used directly, afxEffectWrapper is an internal baseclass used to " + "implement effect-specific adapter classes.\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" +); + +afxEffectWrapper::afxEffectWrapper() +{ + choreographer = 0; + datablock = 0; + cons_mgr = 0; + + cond_alive = true; + elapsed = 0; + life_end = 0; + life_elapsed = 0; + stopped = false; + n_updates = 0; + fade_value = 1.0f; + last_fade_value = 0.0f; + fade_in_end = 0.0; + fade_out_start = 0.0f; + in_scope = true; + is_aborted = false; + do_fade_inout = false; + do_fades = false; + full_lifetime = 0; + + time_factor = 1.0f; + prop_time_factor = 1.0f; + + live_scale_factor = 1.0f; + live_fade_factor = 1.0f; + terrain_altitude = -1.0f; + interior_altitude = -1.0f; + + group_index = 0; + + dMemset(xfm_modifiers, 0, sizeof(xfm_modifiers)); +} + +afxEffectWrapper::~afxEffectWrapper() +{ + for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++) + if (xfm_modifiers[i]) + delete xfm_modifiers[i]; + + if (datablock && datablock->effect_name != ST_NULLSTRING) + { + choreographer->removeNamedEffect(this); + if (datablock->use_as_cons_obj && !effect_cons_id.undefined()) + cons_mgr->setReferenceEffect(effect_cons_id, 0); + } + + if (datablock && datablock->isTempClone()) + delete datablock; + datablock = 0; +} + +#undef myOffset +#define myOffset(field) Offset(field, afxEffectWrapper) + +void afxEffectWrapper::initPersistFields() +{ + addField("liveScaleFactor", TypeF32, myOffset(live_scale_factor), + "..."); + addField("liveFadeFactor", TypeF32, myOffset(live_fade_factor), + "..."); + + Parent::initPersistFields(); +} + +void afxEffectWrapper::ew_init(afxChoreographer* choreographer, + afxEffectWrapperData* datablock, + afxConstraintMgr* cons_mgr, + F32 time_factor) +{ + AssertFatal(choreographer != NULL, "Choreographer is missing."); + AssertFatal(datablock != NULL, "Datablock is missing."); + AssertFatal(cons_mgr != NULL, "Constraint manager is missing."); + + this->choreographer = choreographer; + this->datablock = datablock; + this->cons_mgr = cons_mgr; + ea_set_datablock(datablock->effect_data); + + ew_timing = datablock->ewd_timing; + if (ew_timing.life_bias != 1.0f) + { + if (ew_timing.lifetime > 0) + ew_timing.lifetime *= ew_timing.life_bias; + ew_timing.fade_in_time *= ew_timing.life_bias; + ew_timing.fade_out_time *= ew_timing.life_bias; + } + + pos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def); + orient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def); + aim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def); + life_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def); + + this->time_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor; + + if (datablock->propagate_time_factor) + prop_time_factor = time_factor; + + if (datablock->runsHere(choreographer->isServerObject())) + { + for (int i = 0; i < MAX_XFM_MODIFIERS && datablock->xfm_modifiers[i] != 0; i++) + { + xfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject()); + AssertFatal(xfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName())); + if (xfm_modifiers[i] == 0) + Con::errorf("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()); + } + } + + if (datablock->effect_name != ST_NULLSTRING) + { + assignName(datablock->effect_name); + choreographer->addNamedEffect(this); + if (datablock->use_as_cons_obj) + { + effect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this); + if (effect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject())) + effect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this); + } + } +} + +void afxEffectWrapper::prestart() +{ + // modify timing values by time_factor + if (ew_timing.lifetime > 0) + ew_timing.lifetime *= time_factor; + ew_timing.delay *= time_factor; + ew_timing.fade_in_time *= time_factor; + ew_timing.fade_out_time *= time_factor; + + if (ew_timing.lifetime < 0) + { + full_lifetime = INFINITE_LIFETIME; + life_end = INFINITE_LIFETIME; + } + else + { + full_lifetime = ew_timing.lifetime + ew_timing.fade_out_time; + life_end = ew_timing.delay + ew_timing.lifetime; + } + + if ((ew_timing.fade_in_time + ew_timing.fade_out_time) > 0.0f) + { + fade_in_end = ew_timing.delay + ew_timing.fade_in_time; + if (full_lifetime == INFINITE_LIFETIME) + fade_out_start = INFINITE_LIFETIME; + else + fade_out_start = ew_timing.delay + ew_timing.lifetime; + do_fade_inout = true; + } + + if (!do_fade_inout && datablock->vis_keys != NULL && datablock->vis_keys->numKeys() > 0) + { + //do_fades = true; + fade_out_start = ew_timing.delay + ew_timing.lifetime; + } +} + +bool afxEffectWrapper::start(F32 timestamp) +{ + if (!ea_is_enabled()) + { + Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", datablock->getName()); + return false; + } + + afxConstraint* life_constraint = getLifeConstraint(); + if (life_constraint) + cond_alive = life_constraint->getLivingState(); + + elapsed = timestamp; + + for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++) + { + if (!xfm_modifiers[i]) + break; + else + xfm_modifiers[i]->start(timestamp); + } + + if (!ea_start()) + { + // subclass should print error message if applicable, so no message here. + return false; + } + + update(0.0f); + return !isAborted(); +} + +bool afxEffectWrapper::test_life_conds() +{ + afxConstraint* life_constraint = getLifeConstraint(); + if (!life_constraint || datablock->life_conds == 0) + return true; + + S32 now_state = life_constraint->getDamageState(); + if ((datablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled) + return true; + if ((datablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled) + return true; + if ((datablock->life_conds & DYING) != 0) + return (cond_alive && now_state == ShapeBase::Disabled); + + return false; +} + +bool afxEffectWrapper::update(F32 dt) +{ + elapsed += dt; + + // life_elapsed won't exceed full_lifetime + life_elapsed = getMin(elapsed - ew_timing.delay, full_lifetime); + + // update() returns early if elapsed is outside of active timing range + // (delay <= elapsed <= delay+lifetime) + // note: execution is always allowed beyond this point at least once, + // even if elapsed exceeds the lifetime. + if (elapsed < ew_timing.delay) + { + setScopeStatus(false); + return false; + } + + if (!datablock->requiresStop(ew_timing) && ew_timing.lifetime < 0) + { + F32 afterlife = elapsed - ew_timing.delay; + if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0))) + { + setScopeStatus(ew_timing.residue_lifetime > 0.0f); + return false; + } + } + else + { + F32 afterlife = elapsed - (full_lifetime + ew_timing.delay); + if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0))) + { + setScopeStatus(ew_timing.residue_lifetime > 0.0f); + return false; + } + } + + // first time here, test if required conditions for effect are met + if (n_updates == 0) + { + if (!test_life_conds()) + { + elapsed = full_lifetime + ew_timing.delay; + setScopeStatus(false); + n_updates++; + return false; + } + } + + setScopeStatus(true); + n_updates++; + + + // calculate current fade value if enabled + if (do_fade_inout) + { + if (ew_timing.fade_in_time > 0 && elapsed <= fade_in_end) + { + F32 t = mClampF((elapsed-ew_timing.delay)/ew_timing.fade_in_time, 0.0f, 1.0f); + fade_value = afxEase::t(t, ew_timing.fadein_ease.x,ew_timing.fadein_ease.y); + do_fades = true; + } + else if (elapsed > fade_out_start) + { + if (ew_timing.fade_out_time == 0) + fade_value = 0.0f; + else + { + F32 t = mClampF(1.0f-(elapsed-fade_out_start)/ew_timing.fade_out_time, 0.0f, 1.0f); + fade_value = afxEase::t(t, ew_timing.fadeout_ease.x,ew_timing.fadeout_ease.y); + } + do_fades = true; + } + else + { + fade_value = 1.0f; + do_fades = false; + } + } + else + { + fade_value = 1.0; + do_fades = false; + } + + if (datablock->vis_keys && datablock->vis_keys->numKeys() > 0) + { + F32 vis = datablock->vis_keys->evaluate(elapsed-ew_timing.delay); + fade_value *= mClampF(vis, 0.0f, 1.0f); + do_fades = (fade_value < 1.0f); + } + + // DEAL WITH CONSTRAINTS + afxXM_Params params; + Point3F& CONS_POS = params.pos; + MatrixF& CONS_XFM = params.ori; + Point3F& CONS_AIM = params.pos2; + Point3F& CONS_SCALE = params.scale; + LinearColorF& CONS_COLOR = params.color; + + afxConstraint* pos_constraint = getPosConstraint(); + if (pos_constraint) + { + bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.history_time); + if (!valid) + getUnconstrainedPosition(CONS_POS); + setScopeStatus(valid); + if (valid && datablock->borrow_altitudes) + { + F32 terr_alt, inter_alt; + if (pos_constraint->getAltitudes(terr_alt, inter_alt)) + { + terrain_altitude = terr_alt; + interior_altitude = inter_alt; + } + } + } + else + { + getUnconstrainedPosition(CONS_POS); + setScopeStatus(false); + } + + afxConstraint* orient_constraint = getOrientConstraint(); + if (orient_constraint) + { + orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.history_time); + } + else + { + getUnconstrainedTransform(CONS_XFM); + } + + afxConstraint* aim_constraint = getAimConstraint(); + if (aim_constraint) + aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.history_time); + else + CONS_AIM.zero(); + + CONS_SCALE.set(datablock->scale_factor, datablock->scale_factor, datablock->scale_factor); + + /* + if (datablock->isPositional() && CONS_POS.isZero() && in_scope) + Con::errorf("#EFFECT AT ORIGIN [%s] time=%g", datablock->getName(), dt); + */ + + getBaseColor(CONS_COLOR); + + params.vis = fade_value; + + // apply modifiers + for (int i = 0; i < MAX_XFM_MODIFIERS; i++) + { + if (!xfm_modifiers[i]) + break; + else + xfm_modifiers[i]->updateParams(dt, life_elapsed, params); + } + + // final pos/orient is determined + updated_xfm = CONS_XFM; + updated_pos = CONS_POS; + updated_aim = CONS_AIM; + updated_xfm.setPosition(updated_pos); + updated_scale = CONS_SCALE; + updated_color = CONS_COLOR; + + if (params.vis > 1.0f) + fade_value = 1.0f; + else + fade_value = params.vis; + + if (last_fade_value != fade_value) + { + do_fades = true; + last_fade_value = fade_value; + } + else + { + do_fades = (fade_value < 1.0f); + } + + if (!ea_update(dt)) + { + is_aborted = true; + Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", datablock->getName()); + } + + return true; +} + +void afxEffectWrapper::stop() +{ + if (!datablock->requiresStop(ew_timing)) + return; + + stopped = true; + + // this resets full_lifetime so it starts to shrink or fade + if (full_lifetime == INFINITE_LIFETIME) + { + full_lifetime = (elapsed - ew_timing.delay) + afterStopTime(); + life_end = elapsed; + if (ew_timing.fade_out_time > 0) + fade_out_start = elapsed; + } +} + +void afxEffectWrapper::cleanup(bool was_stopped) +{ + ea_finish(was_stopped); + if (!effect_cons_id.undefined()) + { + cons_mgr->setReferenceEffect(effect_cons_id, 0); + effect_cons_id = afxConstraintID(); + } +} + +void afxEffectWrapper::setScopeStatus(bool in_scope) +{ + if (this->in_scope != in_scope) + { + this->in_scope = in_scope; + ea_set_scope_status(in_scope); + } +} + +bool afxEffectWrapper::isDone() +{ + if (!datablock->is_looping) + return (elapsed >= (life_end + ew_timing.fade_out_time)); + + return false; +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// static +afxEffectWrapper* afxEffectWrapper::ew_create(afxChoreographer* choreographer, + afxEffectWrapperData* datablock, + afxConstraintMgr* cons_mgr, + F32 time_factor, + S32 group_index) +{ + afxEffectWrapper* adapter = datablock->effect_desc->create(); + + if (adapter) + { + adapter->group_index = (datablock->group_index != -1) ? datablock->group_index : group_index; + adapter->ew_init(choreographer, datablock, cons_mgr, time_factor); + } + + return adapter; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +Vector* afxEffectAdapterDesc::adapters = 0; + +afxEffectAdapterDesc::afxEffectAdapterDesc() +{ + if (!adapters) + adapters = new Vector; + + adapters->push_back(this); +} + +bool afxEffectAdapterDesc::identifyEffect(afxEffectWrapperData* ew) +{ + if (!ew || !ew->effect_data) + { + Con::errorf("afxEffectAdapterDesc::identifyEffect() -- effect datablock was not specified."); + return false; + } + + if (!adapters) + { + Con::errorf("afxEffectAdapterDesc::identifyEffect() -- adapter registration list has not been allocated."); + return false; + } + + if (adapters->size() == 0) + { + Con::errorf("afxEffectAdapterDesc::identifyEffect() -- no effect adapters have been registered."); + return false; + } + + for (S32 i = 0; i < adapters->size(); i++) + { + if ((*adapters)[i]->testEffectType(ew->effect_data)) + { + ew->effect_desc = (*adapters)[i]; + (*adapters)[i]->prepEffect(ew); + return true; + } + } + + Con::errorf("afxEffectAdapterDesc::identifyEffect() -- effect %s has an undefined type. -- %d", + ew->effect_data->getName(), adapters->size()); + return false; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxEffectWrapper.h b/Engine/source/afx/afxEffectWrapper.h new file mode 100644 index 000000000..8d5ef646c --- /dev/null +++ b/Engine/source/afx/afxEffectWrapper.h @@ -0,0 +1,392 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_EFFECT_WRAPPER_H_ +#define _AFX_EFFECT_WRAPPER_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afxEffectDefs.h" +#include "afxConstraint.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +struct afxEffectTimingData +{ + F32 delay; + F32 lifetime; + F32 fade_in_time; + F32 fade_out_time; + F32 residue_lifetime; + F32 residue_fadetime; + F32 life_bias; + Point2F fadein_ease; + Point2F fadeout_ease; + + afxEffectTimingData() + { + delay = 0.0f; + lifetime = 0.0f; + fade_in_time = 0.0f; + fade_out_time = 0.0f; + residue_lifetime = 0.0f; + residue_fadetime = 0.0f; + life_bias = 1.0f; + fadein_ease.set(0.0f, 1.0f); + fadeout_ease.set(0.0f, 1.0f); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEffectWrapperData; +class afxAnimCurve; + +class afxEffectAdapterDesc +{ +private: + static Vector* adapters; + +public: + /*C*/ afxEffectAdapterDesc(); + + virtual bool testEffectType(const SimDataBlock*) const=0; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const=0; + virtual bool runsOnServer(const afxEffectWrapperData*) const=0; + virtual bool runsOnClient(const afxEffectWrapperData*) const=0; + virtual bool isPositional(const afxEffectWrapperData*) const { return true; } + virtual void prepEffect(afxEffectWrapperData*) const { } + + virtual afxEffectWrapper* create() const=0; + + static bool identifyEffect(afxEffectWrapperData*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_BaseData; + +class afxEffectBaseData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + /*C*/ afxEffectBaseData() { } + /*C*/ afxEffectBaseData(const afxEffectBaseData& other, bool temp=false) : GameBaseData(other, temp){ } + + virtual void gather_cons_defs(Vector& defs) { }; + + DECLARE_CONOBJECT(afxEffectBaseData); + DECLARE_CATEGORY("AFX"); +}; + +//class afxEffectWrapperData : public GameBaseData, public afxEffectDefs +class afxEffectWrapperData : public afxEffectBaseData +{ + //typedef GameBaseData Parent; + typedef afxEffectBaseData Parent; + + bool do_id_convert; + +public: + enum { MAX_CONDITION_STATES = 4 }; + +public: + StringTableEntry effect_name; + bool use_as_cons_obj; + bool use_ghost_as_cons_obj; + + StringTableEntry cons_spec; + StringTableEntry pos_cons_spec; + StringTableEntry orient_cons_spec; + StringTableEntry aim_cons_spec; + StringTableEntry life_cons_spec; + // + afxConstraintDef cons_def; + afxConstraintDef pos_cons_def; + afxConstraintDef orient_cons_def; + afxConstraintDef aim_cons_def; + afxConstraintDef life_cons_def; + + afxEffectTimingData ewd_timing; + U32 inherit_timing; + + F32 scale_factor; // scale size if applicable + F32 rate_factor; // scale rate if applicable + F32 user_fade_out_time; + + bool is_looping; + U32 n_loops; + F32 loop_gap_time; + + bool ignore_time_factor; + bool propagate_time_factor; + + ByteRange ranking_range; + ByteRange lod_range; + S32 life_conds; + bool effect_enabled; + U32 exec_cond_on_bits[MAX_CONDITION_STATES]; + U32 exec_cond_off_bits[MAX_CONDITION_STATES]; + U32 exec_cond_bitmasks[MAX_CONDITION_STATES]; + + S32 data_ID; + + afxXM_BaseData* xfm_modifiers[MAX_XFM_MODIFIERS]; + + Box3F forced_bbox; + bool update_forced_bbox; + + S8 sort_priority; + Point3F direction; + F32 speed; + F32 mass; + + bool borrow_altitudes; + StringTableEntry vis_keys_spec; + afxAnimCurve* vis_keys; + + SimDataBlock* effect_data; + afxEffectAdapterDesc* effect_desc; + + S32 group_index; + + void parse_cons_specs(); + void parse_vis_keys(); + void gather_cons_defs(Vector& defs); + void pack_mods(BitStream*, afxXM_BaseData* mods[], bool packed); + void unpack_mods(BitStream*, afxXM_BaseData* mods[]); + +public: + /*C*/ afxEffectWrapperData(); + /*C*/ afxEffectWrapperData(const afxEffectWrapperData&, bool = false); + /*D*/ ~afxEffectWrapperData(); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + virtual void onPerformSubstitutions(); + + bool requiresStop(const afxEffectTimingData& timing) { return effect_desc->requiresStop(this, timing); } + bool runsOnServer() { return effect_desc->runsOnServer(this); } + bool runsOnClient() { return effect_desc->runsOnClient(this); } + bool runsHere(bool server_here) { return (server_here) ? runsOnServer() : runsOnClient(); } + bool isPositional() { return effect_desc->isPositional(this); } + bool testExecConditions(U32 conditions); + + F32 afterStopTime() { return ewd_timing.fade_out_time; } + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxEffectWrapperData); + DECLARE_CATEGORY("AFX"); +}; + +inline bool afxEffectWrapperData::testExecConditions(U32 conditions) +{ + if (exec_cond_bitmasks[0] == 0) + return true; + + if ((exec_cond_bitmasks[0] & conditions) == exec_cond_on_bits[0]) + return true; + + for (S32 i = 1; i < MAX_CONDITION_STATES; i++) + { + if (exec_cond_bitmasks[i] == 0) + return false; + if ((exec_cond_bitmasks[i] & conditions) == exec_cond_on_bits[i]) + return true; + } + return false; +} + +typedef Vector afxEffectList; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectWrapper +// +// NOTE -- this not a subclass of GameBase... it is only meant to exist on +// the client-side. + +class ShapeBase; +class GameBase; +class TSShape; +class TSShapeInstance; +class SceneObject; +class afxConstraint; +class afxConstraintMgr; +class afxChoreographer; +class afxXM_Base; + +class afxEffectWrapper : public SimObject, public afxEffectDefs +{ + typedef SimObject Parent; + friend class afxEffectVector; + +private: + bool test_life_conds(); + +protected: + afxEffectWrapperData* datablock; + + afxEffectTimingData ew_timing; + + F32 fade_in_end; + F32 fade_out_start; + F32 full_lifetime; + + F32 time_factor; + F32 prop_time_factor; + + afxChoreographer* choreographer; + afxConstraintMgr* cons_mgr; + + afxConstraintID pos_cons_id; + afxConstraintID orient_cons_id; + afxConstraintID aim_cons_id; + afxConstraintID life_cons_id; + + afxConstraintID effect_cons_id; + + F32 elapsed; + F32 life_elapsed; + F32 life_end; + bool stopped; + bool cond_alive; + + U32 n_updates; + + MatrixF updated_xfm; + Point3F updated_pos; + Point3F updated_aim; + Point3F updated_scale; + LinearColorF updated_color; + + F32 fade_value; + F32 last_fade_value; + + bool do_fade_inout; + bool do_fades; + bool in_scope; + bool is_aborted; + + U8 effect_flags; + + afxXM_Base* xfm_modifiers[MAX_XFM_MODIFIERS]; + + F32 live_scale_factor; + F32 live_fade_factor; + F32 terrain_altitude; + F32 interior_altitude; + + S32 group_index; + +public: + /*C*/ afxEffectWrapper(); + virtual ~afxEffectWrapper(); + + void ew_init(afxChoreographer*, afxEffectWrapperData*, afxConstraintMgr*, + F32 time_factor); + + F32 getFullLifetime() { return ew_timing.lifetime + ew_timing.fade_out_time; } + F32 getTimeFactor() { return time_factor; } + afxConstraint* getPosConstraint() { return cons_mgr->getConstraint(pos_cons_id); } + afxConstraint* getOrientConstraint() { return cons_mgr->getConstraint(orient_cons_id); } + afxConstraint* getAimConstraint() { return cons_mgr->getConstraint(aim_cons_id); } + afxConstraint* getLifeConstraint() { return cons_mgr->getConstraint(life_cons_id); } + afxChoreographer* getChoreographer() { return choreographer; } + + virtual bool isDone(); + virtual bool deleteWhenStopped() { return false; } + F32 afterStopTime() { return ew_timing.fade_out_time; } + bool isAborted() const { return is_aborted; } + + void prestart(); + bool start(F32 timestamp); + bool update(F32 dt); + void stop(); + void cleanup(bool was_stopped=false); + void setScopeStatus(bool flag); + + virtual void ea_set_datablock(SimDataBlock*) { } + virtual bool ea_start() { return true; } + virtual bool ea_update(F32 dt) { return true; } + virtual void ea_finish(bool was_stopped) { } + virtual void ea_set_scope_status(bool flag) { } + virtual bool ea_is_enabled() { return true; } + virtual SceneObject* ea_get_scene_object() const { return 0; } + U32 ea_get_triggers() const { return 0; } + + void getUpdatedPosition(Point3F& pos) { pos = updated_pos;} + void getUpdatedTransform(MatrixF& xfm) { xfm = updated_xfm; } + void getUpdatedScale(Point3F& scale) { scale = updated_scale; } + void getUpdatedColor(LinearColorF& color) { color = updated_color; } + virtual void getUpdatedBoxCenter(Point3F& pos) { pos = updated_pos;} + + virtual void getUnconstrainedPosition(Point3F& pos) { pos.zero();} + virtual void getUnconstrainedTransform(MatrixF& xfm) { xfm.identity(); } + virtual void getBaseColor(LinearColorF& color) { color.set(1.0f, 1.0f, 1.0f, 1.0f); } + + SceneObject* getSceneObject() const { return ea_get_scene_object(); } + U32 getTriggers() const { return ea_get_triggers(); } + + F32 getMass() { return datablock->mass; } + Point3F getDirection() { return datablock->direction; } + F32 getSpeed() { return datablock->speed; } + + virtual TSShape* getTSShape() { return 0; } + virtual TSShapeInstance* getTSShapeInstance() { return 0; } + + virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans) { return 0; } + virtual void resetAnimation(U32 tag) { } + virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; } + + void setTerrainAltitude(F32 alt) { terrain_altitude = alt; } + void setInteriorAltitude(F32 alt) { interior_altitude = alt; } + void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = terrain_altitude; inter_alt = interior_altitude; } + + void setGroupIndex(S32 idx) { group_index = idx; } + S32 getGroupIndex() const { return group_index; } + + bool inScope() const { return in_scope; } + +public: + static void initPersistFields(); + + static afxEffectWrapper* ew_create(afxChoreographer*, afxEffectWrapperData*, afxConstraintMgr*, F32 time_factor, S32 group_index=0); + + DECLARE_CONOBJECT(afxEffectWrapper); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_EFFECT_WRAPPER_H_ diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp new file mode 100644 index 000000000..b33fd9d99 --- /dev/null +++ b/Engine/source/afx/afxEffectron.cpp @@ -0,0 +1,1119 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "T3D/gameBase/gameConnection.h" +#include "sfx/sfxSystem.h" +#include "math/mathIO.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxEffectron.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectronData::ewValidator +// +// When an effect is added using "addEffect", this validator intercepts the value +// and adds it to the dynamic effects list. +// +void afxEffectronData::ewValidator::validateType(SimObject* object, void* typePtr) +{ + afxEffectronData* eff_data = dynamic_cast(object); + afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); + + if (eff_data && ew) + { + eff_data->fx_list.push_back(*ew); + *ew = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class EffectronFinishStartupEvent : public SimEvent +{ +public: + void process(SimObject* obj) + { + afxEffectron* eff = dynamic_cast(obj); + if (eff) + eff->finish_startup(); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectronData + +IMPLEMENT_CO_DATABLOCK_V1(afxEffectronData); + +ConsoleDocClass( afxEffectronData, + "@brief Defines the properties of an afxEffectron.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxEffectronData::afxEffectronData() +{ + duration = 0.0f; + n_loops = 1; + + // dummy entry holds effect-wrapper pointer while a special validator + // grabs it and adds it to an appropriate effects list + dummy_fx_entry = NULL; + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; +} + +afxEffectronData::afxEffectronData(const afxEffectronData& other, bool temp_clone) : afxChoreographerData(other, temp_clone) +{ + duration = other.duration; + n_loops = other.n_loops; + dummy_fx_entry = other.dummy_fx_entry; + do_id_convert = other.do_id_convert; + fx_list = other.fx_list; +} + +void afxEffectronData::reloadReset() +{ + fx_list.clear(); +} + +#define myOffset(field) Offset(field, afxEffectronData) + +void afxEffectronData::initPersistFields() +{ + addField("duration", TypeF32, myOffset(duration), + "..."); + addField("numLoops", TypeS32, myOffset(n_loops), + "..."); + // effect lists + // for each of these, dummy_fx_entry is set and then a validator adds it to the appropriate effects list + static ewValidator emptyValidator(0); + + addFieldV("addEffect", TYPEID(), myOffset(dummy_fx_entry), &emptyValidator, + "..."); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("addEffect"); +} + +bool afxEffectronData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxEffectronData::pack_fx(BitStream* stream, const afxEffectList& fx, bool packed) +{ + stream->writeInt(fx.size(), EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < fx.size(); i++) + writeDatablockID(stream, fx[i], packed); +} + +void afxEffectronData::unpack_fx(BitStream* stream, afxEffectList& fx) +{ + fx.clear(); + S32 n_fx = stream->readInt(EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < n_fx; i++) + fx.push_back((afxEffectWrapperData*)readDatablockID(stream)); +} + +void afxEffectronData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(duration); + stream->write(n_loops); + + pack_fx(stream, fx_list, packed); +} + +void afxEffectronData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&duration); + stream->read(&n_loops); + + do_id_convert = true; + unpack_fx(stream, fx_list); +} + +bool afxEffectronData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + for (S32 i = 0; i < fx_list.size(); i++) + { + SimObjectId db_id = SimObjectId((uintptr_t)fx_list[i]); + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, fx_list[i])) + { + Con::errorf(ConsoleLogEntry::General, + "afxEffectronData::preload() -- bad datablockId: 0x%x", + db_id); + } + } + } + do_id_convert = false; + } + } + + return true; +} + +void afxEffectronData::gatherConstraintDefs(Vector& defs) +{ + afxConstraintDef::gather_cons_defs(defs, fx_list); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxEffectronData, reset, void, (),, + "Resets an effectron datablock during reload.\n\n" + "@ingroup AFX") +{ + object->reloadReset(); +} + +DefineEngineMethod(afxEffectronData, addEffect, void, (afxEffectBaseData* effect),, + "Adds an effect (wrapper or group) to an effectron's phase.\n\n" + "@ingroup AFX") +{ + if (!effect) + { + Con::errorf("afxEffectronData::addEffect() -- missing afxEffectWrapperData."); + return; + } + + object->fx_list.push_back(effect); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectron + +IMPLEMENT_CO_NETOBJECT_V1(afxEffectron); + +ConsoleDocClass( afxEffectron, + "@brief A basic effects choreographer.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" +); + +StringTableEntry afxEffectron::CAMERA_CONS; +StringTableEntry afxEffectron::LISTENER_CONS; + +void afxEffectron::init() +{ + // setup static predefined constraint names + if (CAMERA_CONS == 0) + { + CAMERA_CONS = StringTable->insert("camera"); + LISTENER_CONS = StringTable->insert("listener"); + } + + // afxEffectron is always in scope, however the effects used + // do their own scoping in that they will shut off if their + // position constraint leaves scope. + // + // note -- ghosting is delayed until constraint + // initialization is done. + // + //mNetFlags.set(Ghostable | ScopeAlways); + mNetFlags.clear(Ghostable | ScopeAlways); + + datablock = NULL; + exeblock = NULL; + + constraints_initialized = false; + scoping_initialized = false; + + effect_state = (U8) INACTIVE_STATE; + effect_elapsed = 0; + + // define named constraints + constraint_mgr->defineConstraint(CAMERA_CONSTRAINT, CAMERA_CONS); + constraint_mgr->defineConstraint(POINT_CONSTRAINT, LISTENER_CONS); + + active_phrase = NULL; + time_factor = 1.0f; + camera_cons_obj = 0; + + marks_mask = 0; +} + +afxEffectron::afxEffectron() +{ + started_with_newop = true; + init(); +} + +afxEffectron::afxEffectron(bool not_default) +{ + started_with_newop = false; + init(); +} + +afxEffectron::~afxEffectron() +{ + delete active_phrase; + + if (datablock && datablock->isTempClone()) + { + delete datablock; + datablock = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// STANDARD OVERLOADED METHODS // + +bool afxEffectron::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + datablock = dynamic_cast(dptr); + if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + if (isServerObject() && started_with_newop) + { + // copy dynamic fields from the datablock but + // don't replace fields with a value + assignDynamicFieldsFrom(dptr, arcaneFX::sParameterFieldPrefix, true); + } + + exeblock = datablock; + + if (isClientObject()) + { + // make a temp datablock clone if there are substitutions + if (datablock->getSubstitutionCount() > 0) + { + afxEffectronData* orig_db = datablock; + datablock = new afxEffectronData(*orig_db, true); + exeblock = orig_db; + // Don't perform substitutions yet, the effectrons's dynamic fields haven't + // arrived yet and the substitutions may refer to them. Hold off and do + // in in the onAdd() method. + } + } + else if (started_with_newop) + { + // make a temp datablock clone if there are substitutions + if (datablock->getSubstitutionCount() > 0) + { + afxEffectronData* orig_db = datablock; + datablock = new afxEffectronData(*orig_db, true); + exeblock = orig_db; + orig_db->performSubstitutions(datablock, this, ranking); + } + } + + return true; +} + +void afxEffectron::processTick(const Move* m) +{ + Parent::processTick(m); + + // don't process moves or client ticks + if (m != 0 || isClientObject()) + return; + + process_server(); +} + +void afxEffectron::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + process_client(dt); +} + +bool afxEffectron::onAdd() +{ + if (!Parent::onAdd()) + return false; + + if (isClientObject()) + { + if (datablock->isTempClone()) + { + afxEffectronData* orig_db = (afxEffectronData*)exeblock; + orig_db->performSubstitutions(datablock, this, ranking); + } + } + else if (started_with_newop && !postpone_activation) + { + if (!activationCallInit()) + return false; + activate(); + } + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +U32 afxEffectron::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) +{ + S32 mark_stream_pos = stream->getCurPos(); + + U32 retMask = Parent::packUpdate(conn, mask, stream); + + // InitialUpdate + if (stream->writeFlag(mask & InitialUpdateMask)) + { + // pack extra object's ghost index or scope id if not yet ghosted + if (stream->writeFlag(dynamic_cast(extra) != 0)) + { + NetObject* net_extra = (NetObject*)extra; + S32 ghost_idx = conn->getGhostIndex(net_extra); + if (stream->writeFlag(ghost_idx != -1)) + stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); + else + { + if (stream->writeFlag(net_extra->getScopeId() > 0)) + { + stream->writeInt(net_extra->getScopeId(), NetObject::SCOPE_ID_BITS); + } + } + } + + stream->write(time_factor); + + GameConnection* gconn = dynamic_cast(conn); + bool zoned_in = (gconn) ? gconn->isZonedIn() : false; + if (stream->writeFlag(zoned_in)) + pack_constraint_info(conn, stream); + } + + // StateEvent or SyncEvent + if (stream->writeFlag((mask & StateEventMask) || (mask & SyncEventMask))) + { + stream->write(marks_mask); + stream->write(effect_state); + stream->write(effect_elapsed); + } + + // SyncEvent + bool do_sync_event = ((mask & SyncEventMask) && !(mask & InitialUpdateMask)); + if (stream->writeFlag(do_sync_event)) + { + pack_constraint_info(conn, stream); + } + + check_packet_usage(conn, stream, mark_stream_pos, "afxEffectron:"); + AssertISV(stream->isValid(), "afxEffectron::packUpdate(): write failure occurred, possibly caused by packet-size overrun."); + + return retMask; +} + +//~~~~~~~~~~~~~~~~~~~~// + +void afxEffectron::unpackUpdate(NetConnection * conn, BitStream * stream) +{ + Parent::unpackUpdate(conn, stream); + + bool initial_update = false; + bool zoned_in = true; + bool do_sync_event = false; + U8 new_marks_mask = 0; + U8 new_state = INACTIVE_STATE; + F32 new_elapsed = 0; + + // InitialUpdate Only + if (stream->readFlag()) + { + initial_update = true; + + // extra sent + if (stream->readFlag()) + { + // cleanup? + if (stream->readFlag()) // is ghost_idx + { + S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); + extra = dynamic_cast(conn->resolveGhost(ghost_idx)); + } + else + { + if (stream->readFlag()) // has scope_id + { + // JTF NOTE: U16 extra_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + stream->readInt(NetObject::SCOPE_ID_BITS); + } + } + } + + stream->read(&time_factor); + + // if client is marked as fully zoned in + if ((zoned_in = stream->readFlag()) == true) + { + unpack_constraint_info(conn, stream); + init_constraints(); + } + } + + // StateEvent or SyncEvent + // this state data is sent for both state-events and + // sync-events + if (stream->readFlag()) + { + stream->read(&new_marks_mask); + stream->read(&new_state); + stream->read(&new_elapsed); + + marks_mask = new_marks_mask; + } + + // SyncEvent + do_sync_event = stream->readFlag(); + if (do_sync_event) + { + unpack_constraint_info(conn, stream); + init_constraints(); + } + + //~~~~~~~~~~~~~~~~~~~~// + + if (!zoned_in) + effect_state = LATE_STATE; + + // need to adjust state info to get all synced up with spell on server + if (do_sync_event && !initial_update) + sync_client(new_marks_mask, new_state, new_elapsed); +} + +void afxEffectron::sync_with_clients() +{ + setMaskBits(SyncEventMask); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +bool afxEffectron::state_expired() +{ + afxPhrase* phrase = (effect_state == ACTIVE_STATE) ? active_phrase : NULL; + + if (phrase) + { + if (phrase->expired(effect_elapsed)) + return (!phrase->recycle(effect_elapsed)); + return false; + } + + return true; +} + +void afxEffectron::init_constraints() +{ + if (constraints_initialized) + { + //Con::printf("CONSTRAINTS ALREADY INITIALIZED"); + return; + } + + Vector defs; + datablock->gatherConstraintDefs(defs); + + constraint_mgr->initConstraintDefs(defs, isServerObject()); + + if (isServerObject()) + { + // find local camera + camera_cons_obj = get_camera(); + if (camera_cons_obj) + camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + } + else // if (isClientObject()) + { + // find local camera + camera_cons_obj = get_camera(); + if (camera_cons_obj) + camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + + // find local listener + Point3F listener_pos; + listener_pos = SFX->getListener().getTransform().getPosition(); + listener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos); + } + + constraint_mgr->adjustProcessOrdering(this); + + constraints_initialized = true; +} + +void afxEffectron::init_scoping() +{ + if (scoping_initialized) + { + //Con::printf("SCOPING ALREADY INITIALIZED"); + return; + } + + if (isServerObject()) + { + if (explicit_clients.size() > 0) + { + for (U32 i = 0; i < explicit_clients.size(); i++) + explicit_clients[i]->objectLocalScopeAlways(this); + } + else + { + mNetFlags.set(Ghostable); + setScopeAlways(); + } + scoping_initialized = true; + } +} + +void afxEffectron::setup_active_fx() +{ + active_phrase = new afxPhrase(isServerObject(), /*willStop=*/true); + + if (active_phrase) + { + active_phrase->init(datablock->fx_list, datablock->duration, this, time_factor, datablock->n_loops); + } +} + +bool afxEffectron::cleanup_over() +{ + if (active_phrase && !active_phrase->isEmpty()) + return false; + + return true; +} + +void afxEffectron::inflictDamage(const char * label, const char* flavor, SimObjectId target_id, + F32 amount, U8 n, F32 ad_amount, F32 radius, Point3F pos, F32 impulse) +{ + char *posArg = Con::getArgBuffer(64); + dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); + Con::executef(exeblock, "onDamage", + getIdString(), + label, + flavor, + Con::getIntArg(target_id), + Con::getFloatArg(amount), + Con::getIntArg(n), + posArg, + Con::getFloatArg(ad_amount), + Con::getFloatArg(radius), + Con::getFloatArg(impulse)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +void afxEffectron::process_server() +{ + if (effect_state != INACTIVE_STATE) + effect_elapsed += TickSec; + + U8 pending_state = effect_state; + + // check for state changes + switch (effect_state) + { + case INACTIVE_STATE: + if (marks_mask & MARK_ACTIVATE) + pending_state = ACTIVE_STATE; + break; + case ACTIVE_STATE: + if (marks_mask & MARK_INTERRUPT) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_SHUTDOWN) + pending_state = CLEANUP_STATE; + else if (state_expired()) + pending_state = CLEANUP_STATE; + break; + case CLEANUP_STATE: + if (cleanup_over()) + pending_state = DONE_STATE; + break; + } + + if (effect_state != pending_state) + change_state_s(pending_state); + + if (effect_state == INACTIVE_STATE) + return; + + //--------------------------// + + // sample the constraints + constraint_mgr->sample(TickSec, Platform::getVirtualMilliseconds()); + + if (active_phrase) + active_phrase->update(TickSec, effect_elapsed); +} + +void afxEffectron::change_state_s(U8 pending_state) +{ + if (effect_state == pending_state) + return; + + switch (effect_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + leave_active_state_s(); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } + + effect_state = pending_state; + + switch (pending_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + enter_active_state_s(); + break; + case CLEANUP_STATE: + enter_cleanup_state_s(); + break; + case DONE_STATE: + enter_done_state_s(); + break; + } +} + +void afxEffectron::enter_done_state_s() +{ + postEvent(DEACTIVATE_EVENT); + + F32 done_time = effect_elapsed; + + if (active_phrase) + { + F32 phrase_done; + if (active_phrase->willStop() && active_phrase->isInfinite()) + phrase_done = effect_elapsed + active_phrase->calcAfterLife(); + else + phrase_done = active_phrase->calcDoneTime(); + if (phrase_done > done_time) + done_time = phrase_done; + } + + F32 time_left = done_time - effect_elapsed; + if (time_left < 0) + time_left = 0; + + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + time_left*1000 + 500); + + // CALL SCRIPT afxEffectronData::onDeactivate(%eff) + Con::executef(exeblock, "onDeactivate", getIdString()); +} + +void afxEffectron::enter_active_state_s() +{ + // stamp constraint-mgr starting time + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds()); + effect_elapsed = 0; + + setup_dynamic_constraints(); + + // start casting effects + setup_active_fx(); + if (active_phrase) + active_phrase->start(effect_elapsed, effect_elapsed); +} + +void afxEffectron::leave_active_state_s() +{ + if (active_phrase) + active_phrase->stop(effect_elapsed); +} + +void afxEffectron::enter_cleanup_state_s() +{ + postEvent(SHUTDOWN_EVENT); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +void afxEffectron::process_client(F32 dt) +{ + effect_elapsed += dt; + + U8 pending_state = effect_state; + + // check for state changes + switch (effect_state) + { + case INACTIVE_STATE: + if (marks_mask & MARK_ACTIVATE) + pending_state = ACTIVE_STATE; + break; + case ACTIVE_STATE: + if (marks_mask & MARK_INTERRUPT) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_SHUTDOWN) + pending_state = CLEANUP_STATE; + else if (state_expired()) + pending_state = CLEANUP_STATE; + break; + case CLEANUP_STATE: + if (cleanup_over()) + pending_state = DONE_STATE; + break; + } + + if (effect_state != pending_state) + change_state_c(pending_state); + + if (effect_state == INACTIVE_STATE) + return; + + //--------------------------// + + // update the listener constraint position + if (!listener_cons_id.undefined()) + { + Point3F listener_pos; + listener_pos = SFX->getListener().getTransform().getPosition(); + constraint_mgr->setReferencePoint(listener_cons_id, listener_pos); + } + + // find local camera position + Point3F cam_pos; + SceneObject* current_cam = get_camera(&cam_pos); + + // detect camera changes + if (!camera_cons_id.undefined() && current_cam != camera_cons_obj) + { + constraint_mgr->setReferenceObject(camera_cons_id, current_cam); + camera_cons_obj = current_cam; + } + + // sample the constraints + constraint_mgr->sample(dt, Platform::getVirtualMilliseconds(), (current_cam) ? &cam_pos : 0); + + // update active effects lists + if (active_phrase) + active_phrase->update(dt, effect_elapsed); +} + +void afxEffectron::change_state_c(U8 pending_state) +{ + if (effect_state == pending_state) + return; + + switch (effect_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + leave_active_state_c(); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } + + effect_state = pending_state; + + switch (pending_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + enter_active_state_c(effect_elapsed); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } +} + +void afxEffectron::enter_active_state_c(F32 starttime) +{ + // stamp constraint-mgr starting time + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds() - (U32)(effect_elapsed*1000)); + ///effect_elapsed = 0; + + setup_dynamic_constraints(); + + setup_active_fx(); + if (active_phrase) + active_phrase->start(starttime, effect_elapsed); +} + +void afxEffectron::leave_active_state_c() +{ + if (active_phrase) + active_phrase->stop(effect_elapsed); +} + +void afxEffectron::sync_client(U16 marks, U8 state, F32 elapsed) +{ + //Con::printf("SYNC marks=%d old_state=%d state=%d elapsed=%g", + // marks, effect_state, state, elapsed); + + if (effect_state != LATE_STATE) + return; + + marks_mask = marks; + + // don't want to be started on late zoning clients + if (!datablock->exec_on_new_clients) + { + effect_state = DONE_STATE; + } + + // it looks like we're ghosting pretty late and + // should just return to the inactive state. + else if (marks & (MARK_INTERRUPT | MARK_DEACTIVATE | MARK_SHUTDOWN)) + { + effect_state = DONE_STATE; + } + + // it looks like we should be in the active state. + else if (marks & MARK_ACTIVATE) + { + effect_state = ACTIVE_STATE; + effect_elapsed = elapsed; + enter_active_state_c(0.0); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// public: + +void afxEffectron::postEvent(U8 event) +{ + setMaskBits(StateEventMask); + + switch (event) + { + case ACTIVATE_EVENT: + marks_mask |= MARK_ACTIVATE; + break; + case SHUTDOWN_EVENT: + marks_mask |= MARK_SHUTDOWN; + break; + case DEACTIVATE_EVENT: + marks_mask |= MARK_DEACTIVATE; + break; + case INTERRUPT_EVENT: + marks_mask |= MARK_INTERRUPT; + break; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxEffectron::finish_startup() +{ + init_constraints(); + init_scoping(); + postEvent(afxEffectron::ACTIVATE_EVENT); +} + +// static +afxEffectron* +afxEffectron::start_effect(afxEffectronData* datablock, SimObject* extra) +{ + AssertFatal(datablock != NULL, "Datablock is missing."); + + afxEffectronData* exeblock = datablock; + + SimObject* param_holder = new SimObject(); + if (!param_holder->registerObject()) + { + Con::errorf("afxEffectron: failed to register parameter object."); + delete param_holder; + return 0; + } + + param_holder->assignDynamicFieldsFrom(datablock, arcaneFX::sParameterFieldPrefix); + if (extra) + { + // copy dynamic fields from the extra object to the param holder + param_holder->assignDynamicFieldsFrom(extra, arcaneFX::sParameterFieldPrefix); + } + + // CALL SCRIPT afxEffectronData::onPreactivate(%params, %extra) + const char* result = Con::executef(datablock, "onPreactivate", + Con::getIntArg(param_holder->getId()), + (extra) ? Con::getIntArg(extra->getId()) : ""); + if (result && result[0] != '\0' && !dAtob(result)) + { +#if defined(TORQUE_DEBUG) + Con::warnf("afxEffectron: onPreactivate() returned false, effect aborted."); +#endif + Sim::postEvent(param_holder, new ObjectDeleteEvent, Sim::getCurrentTime()); + return 0; + } + + // make a temp datablock clone if there are substitutions + if (datablock->getSubstitutionCount() > 0) + { + datablock = new afxEffectronData(*exeblock, true); + exeblock->performSubstitutions(datablock, param_holder); + } + + // create a new effectron instance + afxEffectron* eff = new afxEffectron(true); + eff->setDataBlock(datablock); + eff->exeblock = exeblock; + eff->setExtra(extra); + + // copy dynamic fields from the param holder to the effectron + eff->assignDynamicFieldsFrom(param_holder, arcaneFX::sParameterFieldPrefix); + Sim::postEvent(param_holder, new ObjectDeleteEvent, Sim::getCurrentTime()); + + // register + if (!eff->registerObject()) + { + Con::errorf("afxEffectron: failed to register effectron instance."); + Sim::postEvent(eff, new ObjectDeleteEvent, Sim::getCurrentTime()); + return 0; + } + registerForCleanup(eff); + + eff->activate(); + + return eff; +} + +bool afxEffectron::activationCallInit(bool postponed) +{ + if (postponed && (!started_with_newop || !postpone_activation)) + { + Con::errorf("afxEffectron::activate() -- activate() is only required when creating an effectron with the \"new\" operator " + "and the postponeActivation field is set to \"true\"."); + return false; + } + + return true; +} + +void afxEffectron::activate() +{ + // separating the final part of startup allows the calling script + // to make certain types of calls on the returned effectron that + // need to happen prior to constraint initialization. + Sim::postEvent(this, new EffectronFinishStartupEvent, Sim::getCurrentTime()); + + // CALL SCRIPT afxEffectronData::onActivate(%eff) + Con::executef(exeblock, "onActivate", getIdString()); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// console functions + +DefineEngineMethod(afxEffectron, setTimeFactor, void, (float factor),, + "Sets the time-factor for the effectron.\n\n" + "@ingroup AFX") +{ + object->setTimeFactor(factor); +} + +DefineEngineMethod(afxEffectron, interrupt, void, (),, + "Interrupts and deletes a running effectron.\n\n" + "@ingroup AFX") +{ + object->postEvent(afxEffectron::INTERRUPT_EVENT); +} + +DefineEngineMethod(afxEffectron, activate, void, (),, + "Activates an effectron that was started with postponeActivation=true.\n\n" + "@ingroup AFX") +{ + if (object->activationCallInit(true)) + object->activate(); +} + +DefineEngineFunction(startEffectron, S32, (afxEffectronData* datablock, const char* constraintSource, const char* constraintName, SimObject* extra), + (nullAsType(), nullAsType(), nullAsType(), nullAsType()), + + "Instantiates the effectron defined by datablock.\n\n" + "@ingroup AFX") +{ + if (!datablock) + { + Con::errorf("startEffectron() -- missing valid datablock."); + return 0; + } + + // + // Start the Effectron + // + afxEffectron* eff = afxEffectron::start_effect(datablock, extra); + + // + // Create a constraint from arguments (if specified). + // + if (eff) + { + if (constraintSource && constraintName) + { + if (!eff->addConstraint(constraintSource, constraintName)) + Con::errorf("startEffectron() -- failed to find constraint object [%s].", constraintSource); + } + } + + // + // Return the ID (or 0 if start failed). + // + return (eff) ? eff->getId() : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/afxEffectron.h b/Engine/source/afx/afxEffectron.h new file mode 100644 index 000000000..9c05a48b3 --- /dev/null +++ b/Engine/source/afx/afxEffectron.h @@ -0,0 +1,216 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_COMPOSITE_EFFECT_H_ +#define _AFX_COMPOSITE_EFFECT_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "console/typeValidators.h" + +#include "afxChoreographer.h" +#include "afxEffectWrapper.h" +#include "afxPhrase.h" + +class afxChoreographerData; +class afxEffectWrapperData; + +class afxEffectronData : public afxChoreographerData +{ + typedef afxChoreographerData Parent; + + class ewValidator : public TypeValidator + { + U32 id; + public: + ewValidator(U32 id) { this->id = id; } + void validateType(SimObject *object, void *typePtr); + }; + + bool do_id_convert; + +public: + F32 duration; + S32 n_loops; + + afxEffectBaseData* dummy_fx_entry; + + afxEffectList fx_list; + +private: + void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); + void unpack_fx(BitStream* stream, afxEffectList& fx); + +public: + /*C*/ afxEffectronData(); + /*C*/ afxEffectronData(const afxEffectronData&, bool = false); + + virtual void reloadReset(); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + void gatherConstraintDefs(Vector&); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxEffectronData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEffectron + +class afxEffectron : public afxChoreographer +{ + typedef afxChoreographer Parent; + +public: + enum MaskBits + { + StateEventMask = Parent::NextFreeMask << 0, + SyncEventMask = Parent::NextFreeMask << 1, + NextFreeMask = Parent::NextFreeMask << 2 + }; + + enum + { + NULL_EVENT, + ACTIVATE_EVENT, + SHUTDOWN_EVENT, + DEACTIVATE_EVENT, + INTERRUPT_EVENT + }; + + enum + { + INACTIVE_STATE, + ACTIVE_STATE, + CLEANUP_STATE, + DONE_STATE, + LATE_STATE + }; + + enum { + MARK_ACTIVATE = BIT(0), + MARK_SHUTDOWN = BIT(1), + MARK_DEACTIVATE = BIT(2), + MARK_INTERRUPT = BIT(3), + }; + + class ObjectDeleteEvent : public SimEvent + { + public: + void process(SimObject *obj) { if (obj) obj->deleteObject(); } + }; + +private: + static StringTableEntry CAMERA_CONS; + static StringTableEntry LISTENER_CONS; + +private: + afxEffectronData* datablock; + SimObject* exeblock; + + bool constraints_initialized; + bool scoping_initialized; + + U8 effect_state; + F32 effect_elapsed; + U8 marks_mask; + afxConstraintID listener_cons_id; + afxConstraintID camera_cons_id; + SceneObject* camera_cons_obj; + afxPhrase* active_phrase; + F32 time_factor; + +private: + void init(); + bool state_expired(); + void init_constraints(); + void init_scoping(); + void setup_active_fx(); + bool cleanup_over(); + +public: + /*C*/ afxEffectron(); + /*C*/ afxEffectron(bool not_default); + /*D*/ ~afxEffectron(); + + // STANDARD OVERLOADED METHODS // + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual void processTick(const Move*); + virtual void advanceTime(F32 dt); + virtual bool onAdd(); + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + + virtual void inflictDamage(const char * label, const char* flavor, SimObjectId target, + F32 amt, U8 count, F32 ad_amt, F32 rad, Point3F pos, F32 imp); + virtual void sync_with_clients(); + void finish_startup(); + + DECLARE_CONOBJECT(afxEffectron); + DECLARE_CATEGORY("AFX"); + +private: + void process_server(); + // + void change_state_s(U8 pending_state); + // + void enter_active_state_s(); + void leave_active_state_s(); + void enter_cleanup_state_s(); + void enter_done_state_s(); + +private: + void process_client(F32 dt); + // + void change_state_c(U8 pending_state); + // + void enter_active_state_c(F32 starttime); + void leave_active_state_c(); + + void sync_client(U16 marks, U8 state, F32 elapsed); + +public: + void postEvent(U8 event); + void setTimeFactor(F32 f) { time_factor = (f > 0) ? f : 1.0f; } + F32 getTimeFactor() { return time_factor; } + + bool activationCallInit(bool postponed=false); + void activate(); + +public: + static afxEffectron* start_effect(afxEffectronData*, SimObject* extra); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +#endif // _AFX_EFFECTRON_H_ diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp new file mode 100644 index 000000000..36ecd1777 --- /dev/null +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -0,0 +1,2116 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// afxMagicMissile is a heavily modified variation of the stock Projectile class. In +// addition to numerous AFX customizations, it also incorporates functionality based on +// the following TGE resources: +// +// Guided or Seeker Projectiles by Derk Adams +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6778 +// +// Projectile Ballistic Coefficients (drag factors) by Mark Owen +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5128 +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "scene/sceneRenderState.h" +#include "scene/sceneManager.h" +#include "core/resourceManager.h" +#include "ts/tsShapeInstance.h" +#include "sfx/sfxTrack.h" +#include "sfx/sfxSource.h" +#include "sfx/sfxSystem.h" +#include "sfx/sfxTypes.h" +#include "math/mathUtils.h" +#include "math/mathIO.h" +#include "sim/netConnection.h" +#include "T3D/fx/particleEmitter.h" +#include "T3D/fx/splash.h" +#include "T3D/physics/physicsPlugin.h" +#include "T3D/physics/physicsWorld.h" +#include "gfx/gfxTransformSaver.h" +#include "T3D/containerQuery.h" +#include "T3D/lightDescription.h" +#include "console/engineAPI.h" +#include "lighting/lightManager.h" + +#include "afx/util/afxEase.h" +#include "afx/afxMagicMissile.h" +#include "afx/afxMagicSpell.h" +#include "afx/afxChoreographer.h" + +class ObjectDeleteEvent : public SimEvent +{ +public: + void process(SimObject *object) + { + object->deleteObject(); + } +}; + +IMPLEMENT_CO_DATABLOCK_V1(afxMagicMissileData); + +ConsoleDocClass( afxMagicMissileData, + "@brief Defines a particular magic-missile type. (Use with afxMagicSpellData.)\n" + "@tsexample\n" + "datablock afxMagicMissileData(Fireball_MM)\n" + "{\n" + " muzzleVelocity = 50;\n" + " velInheritFactor = 0;\n" + " lifetime = 20000;\n" + " isBallistic = true;\n" + " ballisticCoefficient = 0.85;\n" + " gravityMod = 0.05;\n" + " isGuided = true;\n" + " precision = 30;\n" + " trackDelay = 7;\n" + " launchOffset = \"0 0 43.7965\";\n" + " launchOnServerSignal = true;\n" + "};\n" + "@endtsexample\n" + "@ingroup AFX\n" +); + +IMPLEMENT_CO_NETOBJECT_V1(afxMagicMissile); + +ConsoleDocClass( afxMagicMissile, + "@brief Magic-missile class used internally by afxMagicSpell. Properties of individual missile types are defined using afxMagicMissileData.\n" + "@ingroup AFX\n" +); + +/* From stock Projectile code... +IMPLEMENT_CALLBACK( ProjectileData, onExplode, void, ( Projectile* proj, Point3F pos, F32 fade ), + ( proj, pos, fade ), + "Called when a projectile explodes.\n" + "@param proj The projectile exploding.\n" + "@param pos The position of the explosion.\n" + "@param fade The currently fadeValue of the projectile, affects its visibility.\n" + "@see Projectile, ProjectileData\n" + ); + +IMPLEMENT_CALLBACK( ProjectileData, onCollision, void, ( Projectile* proj, SceneObject* col, F32 fade, Point3F pos, Point3F normal ), + ( proj, col, fade, pos, normal ), + "Called when a projectile collides with another object.\n" + "@param proj The projectile colliding.\n" + "@param col The object hit by the projectile.\n" + "@param fade The current fadeValue of the projectile, affects its visibility.\n" + "@param pos The collision position.\n" + "@param normal The collision normal.\n" + "@see Projectile, ProjectileData\n" + ); + +const U32 Projectile::csmStaticCollisionMask = TerrainObjectType | + InteriorObjectType | + StaticObjectType; + +const U32 Projectile::csmDynamicCollisionMask = PlayerObjectType | + VehicleObjectType | + DamagableItemObjectType; + +const U32 Projectile::csmDamageableMask = Projectile::csmDynamicCollisionMask; + +U32 Projectile::smProjectileWarpTicks = 5; +*/ + +//-------------------------------------------------------------------------- +// +afxMagicMissileData::afxMagicMissileData() +{ + projectileShapeName = ST_NULLSTRING; + + sound = NULL; + + /* From stock Projectile code... + explosion = NULL; + explosionId = 0; + + waterExplosion = NULL; + waterExplosionId = 0; + */ + + /* From stock Projectile code... + faceViewer = false; + */ + scale.set( 1.0f, 1.0f, 1.0f ); + + isBallistic = false; + + /* From stock Projectile code... + velInheritFactor = 1.0f; + */ + muzzleVelocity = 50; + /* From stock Projectile code... + impactForce = 0.0f; + + armingDelay = 0; + fadeDelay = 20000 / 32; + lifetime = 20000 / 32; + + activateSeq = -1; + maintainSeq = -1; + */ + + gravityMod = 1.0; + /* From stock Projectile code... + bounceElasticity = 0.999f; + bounceFriction = 0.3f; + */ + + particleEmitter = NULL; + particleEmitterId = 0; + + particleWaterEmitter = NULL; + particleWaterEmitterId = 0; + + splash = NULL; + splashId = 0; + + /* From stock Projectile code... + decal = NULL; + decalId = 0; + */ + + lightDesc = NULL; + lightDescId = 0; + + starting_vel_vec.zero(); + + isGuided = false; + precision = 0; + trackDelay = 0; + ballisticCoefficient = 1.0f; + + followTerrain = false; + followTerrainHeight = 0.1f; + followTerrainAdjustRate = 20.0f; + followTerrainAdjustDelay = 0; + + lifetime = MaxLifetimeTicks; + collision_mask = arcaneFX::sMissileCollisionMask; + + acceleration = 0; + accelDelay = 0; + accelLifetime = 0; + + launch_node = ST_NULLSTRING; + launch_offset.zero(); + launch_offset_server.zero(); + launch_offset_client.zero(); + launch_node_offset.zero(); + launch_pitch = 0; + launch_pan = 0; + launch_cons_s_spec = ST_NULLSTRING; + launch_cons_c_spec = ST_NULLSTRING; + + echo_launch_offset = false; + + wiggle_axis_string = ST_NULLSTRING; + wiggle_num_axis = 0; + wiggle_axis = 0; + + hover_altitude = 0; + hover_attack_distance = 0; + hover_attack_gradient = 0; + hover_time = 0; + + reverse_targeting = false; + + caster_safety_time = U32_MAX; +} + +afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + projectileShapeName = other.projectileShapeName; + projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName + sound = other.sound; + splash = other.splash; + splashId = other.splashId; // -- for pack/unpack of splash ptr + lightDesc = other.lightDesc; + lightDescId = other.lightDescId; // -- for pack/unpack of lightDesc ptr + scale = other.scale; + isBallistic = other.isBallistic; + muzzleVelocity = other.muzzleVelocity; + gravityMod = other.gravityMod; + particleEmitter = other.particleEmitter; + particleEmitterId = other.particleEmitterId; // -- for pack/unpack of particleEmitter ptr + particleWaterEmitter = other.particleWaterEmitter; + particleWaterEmitterId = other.particleWaterEmitterId; // -- for pack/unpack of particleWaterEmitter ptr + + collision_mask = other.collision_mask; + starting_vel_vec = other.starting_vel_vec; + isGuided = other.isGuided; + precision = other.precision; + trackDelay = other.trackDelay; + ballisticCoefficient = other.ballisticCoefficient; + followTerrain = other.followTerrain; + followTerrainHeight = other.followTerrainHeight; + followTerrainAdjustRate = other.followTerrainAdjustRate; + followTerrainAdjustDelay = other.followTerrainAdjustDelay; + lifetime = other.lifetime; + fadeDelay = other.fadeDelay; + acceleration = other.acceleration; + accelDelay = other.accelDelay; + accelLifetime = other.accelLifetime; + launch_node = other.launch_node; + launch_offset = other.launch_offset; + launch_offset_server = other.launch_offset_server; + launch_offset_client = other.launch_offset_client; + launch_node_offset = other.launch_node_offset; + launch_pitch = other.launch_pitch; + launch_pan = other.launch_pan; + launch_cons_s_spec = other.launch_cons_s_spec; + launch_cons_c_spec = other.launch_cons_c_spec; + launch_cons_s_def = other.launch_cons_s_def; + launch_cons_c_def = other.launch_cons_c_def; + echo_launch_offset = other.echo_launch_offset; + wiggle_magnitudes = other.wiggle_magnitudes; + wiggle_speeds = other.wiggle_speeds; + wiggle_axis_string = other.wiggle_axis_string; + wiggle_num_axis = other.wiggle_num_axis; + wiggle_axis = other.wiggle_axis; + hover_altitude = other.hover_altitude; + hover_attack_distance = other.hover_attack_distance; + hover_attack_gradient = other.hover_attack_gradient; + hover_time = other.hover_time; + reverse_targeting = other.reverse_targeting; + caster_safety_time = other.caster_safety_time; +} + +afxMagicMissileData::~afxMagicMissileData() +{ + if (wiggle_axis) + delete [] wiggle_axis; +} + +afxMagicMissileData* afxMagicMissileData::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + if (!owner || getSubstitutionCount() == 0) + return this; + + afxMagicMissileData* sub_missile_db = new afxMagicMissileData(*this, true); + performSubstitutions(sub_missile_db, owner, index); + + return sub_missile_db; +} + +//-------------------------------------------------------------------------- + +#define myOffset(field) Offset(field, afxMagicMissileData) + +FRangeValidator muzzleVelocityValidator(0, 10000); +FRangeValidator missilePrecisionValidator(0.f, 100.f); +FRangeValidator missileTrackDelayValidator(0, 100000); +FRangeValidator missileBallisticCoefficientValidator(0, 1); + +void afxMagicMissileData::initPersistFields() +{ + static IRangeValidatorScaled ticksFromMS(TickMs, 0, MaxLifetimeTicks); + + addField("particleEmitter", TYPEID(), Offset(particleEmitter, afxMagicMissileData)); + addField("particleWaterEmitter", TYPEID(), Offset(particleWaterEmitter, afxMagicMissileData)); + + addField("projectileShapeName", TypeFilename, Offset(projectileShapeName, afxMagicMissileData)); + addField("scale", TypePoint3F, Offset(scale, afxMagicMissileData)); + + addField("sound", TypeSFXTrackName, Offset(sound, afxMagicMissileData)); + + /* From stock Projectile code... + addField("explosion", TYPEID< ExplosionData >(), Offset(explosion, ProjectileData)); + addField("waterExplosion", TYPEID< ExplosionData >(), Offset(waterExplosion, ProjectileData)); + */ + + addField("splash", TYPEID(), Offset(splash, afxMagicMissileData)); + /* From stock Projectile code... + addField("decal", TYPEID< DecalData >(), Offset(decal, ProjectileData)); + */ + + addField("lightDesc", TYPEID< LightDescription >(), Offset(lightDesc, afxMagicMissileData)); + + addField("isBallistic", TypeBool, Offset(isBallistic, afxMagicMissileData)); + /* From stock Projectile code... + addField("velInheritFactor", TypeF32, Offset(velInheritFactor, ProjectileData)); + */ + addNamedFieldV(muzzleVelocity, TypeF32, afxMagicMissileData, &muzzleVelocityValidator); + /* From stock Projectile code... + addField("impactForce", TypeF32, Offset(impactForce, ProjectileData)); + */ + addNamedFieldV(lifetime, TypeS32, afxMagicMissileData, &ticksFromMS); + /* From stock Projectile code... + addProtectedField("armingDelay", TypeS32, Offset(armingDelay, ProjectileData), &setArmingDelay, &getScaledValue, + "The time in milliseconds before the projectile is armed and will cause damage or explode on impact." ); + + addProtectedField("fadeDelay", TypeS32, Offset(fadeDelay, ProjectileData), &setFadeDelay, &getScaledValue, + "The time in milliseconds when the projectile begins to fade out. Must be less than the lifetime to have an effect." ); + + addField("bounceElasticity", TypeF32, Offset(bounceElasticity, ProjectileData)); + addField("bounceFriction", TypeF32, Offset(bounceFriction, ProjectileData)); + */ + addField("gravityMod", TypeF32, Offset(gravityMod, afxMagicMissileData)); + + // FIELDS ADDED BY MAGIC-MISSILE + + addField("missileShapeName", TypeFilename, myOffset(projectileShapeName)); + addField("missileShapeScale", TypePoint3F, myOffset(scale)); + + addField("startingVelocityVector",TypePoint3F, myOffset(starting_vel_vec)); + + addNamedField(isGuided, TypeBool, afxMagicMissileData); + addNamedFieldV(precision, TypeF32, afxMagicMissileData, &missilePrecisionValidator); + addNamedFieldV(trackDelay, TypeS32, afxMagicMissileData, &missileTrackDelayValidator); + addNamedFieldV(ballisticCoefficient, TypeF32, afxMagicMissileData, &missileBallisticCoefficientValidator); + + addField("collisionMask", TypeS32, myOffset(collision_mask)); + + addField("followTerrain", TypeBool, myOffset(followTerrain)); + addField("followTerrainHeight", TypeF32, myOffset(followTerrainHeight)); + addField("followTerrainAdjustRate", TypeF32, myOffset(followTerrainAdjustRate)); + addFieldV("followTerrainAdjustDelay", TypeS32, myOffset(followTerrainAdjustDelay), &ticksFromMS); + + addNamedField(acceleration, TypeF32, afxMagicMissileData); + addNamedFieldV(accelDelay, TypeS32, afxMagicMissileData, &ticksFromMS); + addNamedFieldV(accelLifetime, TypeS32, afxMagicMissileData, &ticksFromMS); + + addField("launchNode", TypeString, myOffset(launch_node)); + addField("launchOffset", TypePoint3F, myOffset(launch_offset)); + addField("launchOffsetServer",TypePoint3F, myOffset(launch_offset_server)); + addField("launchOffsetClient",TypePoint3F, myOffset(launch_offset_client)); + addField("launchNodeOffset", TypePoint3F, myOffset(launch_node_offset)); + addField("launchAimPitch", TypeF32, myOffset(launch_pitch)); + addField("launchAimPan", TypeF32, myOffset(launch_pan)); + addField("launchConstraintServer", TypeString, myOffset(launch_cons_s_spec)); + addField("launchConstraintClient", TypeString, myOffset(launch_cons_c_spec)); + // + addField("echoLaunchOffset", TypeBool, myOffset(echo_launch_offset)); + + addField("wiggleMagnitudes", TypeF32Vector, myOffset(wiggle_magnitudes)); + addField("wiggleSpeeds", TypeF32Vector, myOffset(wiggle_speeds)); + addField("wiggleAxis", TypeString, myOffset(wiggle_axis_string)); + + addField("hoverAltitude", TypeF32, myOffset(hover_altitude)); + addField("hoverAttackDistance", TypeF32, myOffset(hover_attack_distance)); + addField("hoverAttackGradient", TypeF32, myOffset(hover_attack_gradient)); + addFieldV("hoverTime", TypeS32, myOffset(hover_time), &ticksFromMS); + + addField("reverseTargeting", TypeBool, myOffset(reverse_targeting)); + + addFieldV("casterSafetyTime", TypeS32, myOffset(caster_safety_time), &ticksFromMS); + + Parent::initPersistFields(); + + // disallow some field substitutions + onlyKeepClearSubstitutions("particleEmitter"); // subs resolving to "~~", or "~0" are OK + onlyKeepClearSubstitutions("particleWaterEmitter"); + onlyKeepClearSubstitutions("sound"); + onlyKeepClearSubstitutions("splash"); +} + + +//-------------------------------------------------------------------------- +bool afxMagicMissileData::onAdd() +{ + if(!Parent::onAdd()) + return false; + + // ADDED BY MAGIC-MISSILE + + // Wiggle axes //////////////////////////////////////////////////////////// + if (wiggle_axis_string != ST_NULLSTRING && wiggle_num_axis == 0) + { + // Tokenize input string and convert to Point3F array + // + Vector dataBlocks(__FILE__, __LINE__); + + // make a copy of points_string + char* tokCopy = new char[dStrlen(wiggle_axis_string) + 1]; + dStrcpy(tokCopy, wiggle_axis_string); + + // extract tokens one by one, adding them to dataBlocks + char* currTok = dStrtok(tokCopy, " \t"); + while (currTok != NULL) + { + dataBlocks.push_back(currTok); + currTok = dStrtok(NULL, " \t"); + } + + // bail if there were no tokens in the string + if (dataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxMagicMissileData(%s) invalid wiggle axis string. No tokens found", getName()); + delete [] tokCopy; + return false; + } + + // Find wiggle_num_axis (round up to multiple of 3) // WARNING here if not multiple of 3? + for (U32 i = 0; i < dataBlocks.size()%3; i++) + { + dataBlocks.push_back("0.0"); + } + + wiggle_num_axis = dataBlocks.size()/3; + wiggle_axis = new Point3F[wiggle_num_axis]; + + U32 p_i = 0; + for (U32 i = 0; i < dataBlocks.size(); i+=3, p_i++) + { + F32 x,y,z; + x = dAtof(dataBlocks[i]); // What about overflow? + y = dAtof(dataBlocks[i+1]); + z = dAtof(dataBlocks[i+2]); + wiggle_axis[p_i].set(x,y,z); + + wiggle_axis[p_i].normalizeSafe(); // sufficient???? + } + + delete [] tokCopy; + } + + launch_cons_s_def.parseSpec(launch_cons_s_spec, true, false); + launch_cons_c_def.parseSpec(launch_cons_c_spec, false, true); + + return true; +} + + +bool afxMagicMissileData::preload(bool server, String &errorStr) +{ + if (Parent::preload(server, errorStr) == false) + return false; + + if( !server ) + { + if (!particleEmitter && particleEmitterId != 0) + if (Sim::findObject(particleEmitterId, particleEmitter) == false) + Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockId(particleEmitter): %d", particleEmitterId); + + if (!particleWaterEmitter && particleWaterEmitterId != 0) + if (Sim::findObject(particleWaterEmitterId, particleWaterEmitter) == false) + Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockId(particleWaterEmitter): %d", particleWaterEmitterId); + + /* From stock Projectile code... + if (!explosion && explosionId != 0) + if (Sim::findObject(explosionId, explosion) == false) + Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(explosion): %d", explosionId); + + if (!waterExplosion && waterExplosionId != 0) + if (Sim::findObject(waterExplosionId, waterExplosion) == false) + Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(waterExplosion): %d", waterExplosionId); + */ + + if (!splash && splashId != 0) + if (Sim::findObject(splashId, splash) == false) + Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockId(splash): %d", splashId); + + /* From stock Projectile code... + if (!decal && decalId != 0) + if (Sim::findObject(decalId, decal) == false) + Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); + */ + + String errorStr; + if( !sfxResolve( &sound, errorStr ) ) + Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", errorStr.c_str()); + + if (!lightDesc && lightDescId != 0) + if (Sim::findObject(lightDescId, lightDesc) == false) + Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet, bad datablockid(lightDesc): %d", lightDescId); + } + + if (projectileShapeName != ST_NULLSTRING) + { + projectileShape = ResourceManager::get().load(projectileShapeName); + if (bool(projectileShape) == false) + { + errorStr = String::ToString("afxMagicMissileData::load: Couldn't load shape \"%s\"", projectileShapeName); + return false; + } + /* From stock Projectile code... + activateSeq = projectileShape->findSequence("activate"); + maintainSeq = projectileShape->findSequence("maintain"); + */ + } + + if (bool(projectileShape)) // create an instance to preload shape data + { + TSShapeInstance* pDummy = new TSShapeInstance(projectileShape, !server); + delete pDummy; + } + + return true; +} + +//-------------------------------------------------------------------------- +// Modified from floorPlanRes.cc +// Read a vector of items +template +bool readVector(Vector & vec, Stream & stream, const char * msg) +{ + U32 num, i; + bool Ok = true; + stream.read( & num ); + vec.setSize( num ); + for( i = 0; i < num && Ok; i++ ){ + Ok = stream.read(& vec[i]); + AssertISV( Ok, avar("math vec read error (%s) on elem %d", msg, i) ); + } + return Ok; +} +// Write a vector of items +template +bool writeVector(const Vector & vec, Stream & stream, const char * msg) +{ + bool Ok = true; + stream.write( vec.size() ); + for( U32 i = 0; i < vec.size() && Ok; i++ ) { + Ok = stream.write(vec[i]); + AssertISV( Ok, avar("vec write error (%s) on elem %d", msg, i) ); + } + return Ok; +} +//-------------------------------------------------------------------------- + +void afxMagicMissileData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(projectileShapeName); + /* From stock Projectile code... + stream->writeFlag(faceViewer); + */ + if(stream->writeFlag(scale.x != 1 || scale.y != 1 || scale.z != 1)) + { + stream->write(scale.x); + stream->write(scale.y); + stream->write(scale.z); + } + + stream->write(collision_mask); + + if (stream->writeFlag(particleEmitter != NULL)) + stream->writeRangedU32(particleEmitter->getId(), DataBlockObjectIdFirst, + DataBlockObjectIdLast); + + if (stream->writeFlag(particleWaterEmitter != NULL)) + stream->writeRangedU32(particleWaterEmitter->getId(), DataBlockObjectIdFirst, + DataBlockObjectIdLast); + + /* From stock Projectile code... + if (stream->writeFlag(explosion != NULL)) + stream->writeRangedU32(explosion->getId(), DataBlockObjectIdFirst, + DataBlockObjectIdLast); + + if (stream->writeFlag(waterExplosion != NULL)) + stream->writeRangedU32(waterExplosion->getId(), DataBlockObjectIdFirst, + DataBlockObjectIdLast); + */ + + if (stream->writeFlag(splash != NULL)) + stream->writeRangedU32(splash->getId(), DataBlockObjectIdFirst, + DataBlockObjectIdLast); + + /* From stock Projectile code... + if (stream->writeFlag(decal != NULL)) + stream->writeRangedU32(decal->getId(), DataBlockObjectIdFirst, + DataBlockObjectIdLast); + */ + + sfxWrite( stream, sound ); + + if ( stream->writeFlag(lightDesc != NULL)) + stream->writeRangedU32(lightDesc->getId(), DataBlockObjectIdFirst, + DataBlockObjectIdLast); + + /* From stock Projectile code... + stream->write(impactForce); + */ + + stream->write(lifetime); + /* From stock Projectile code... + stream->write(armingDelay); + stream->write(fadeDelay); + */ + + if(stream->writeFlag(isBallistic)) + { + stream->write(gravityMod); + /* From stock Projectile code... + stream->write(bounceElasticity); + stream->write(bounceFriction); + */ + stream->write(ballisticCoefficient); + } + + if(stream->writeFlag(isGuided)) + { + stream->write(precision); + stream->write(trackDelay); + } + + stream->write(muzzleVelocity); + mathWrite(*stream, starting_vel_vec); + stream->write(acceleration); + stream->write(accelDelay); + stream->write(accelLifetime); + + stream->writeString(launch_node); + mathWrite(*stream, launch_offset); + mathWrite(*stream, launch_offset_server); + mathWrite(*stream, launch_offset_client); + mathWrite(*stream, launch_node_offset); + stream->write(launch_pitch); + stream->write(launch_pan); + stream->writeString(launch_cons_c_spec); + stream->writeFlag(echo_launch_offset); + + writeVector(wiggle_magnitudes, *stream, "afxMagicMissile: wiggle_magnitudes"); + writeVector(wiggle_speeds, *stream, "afxMagicMissile: wiggle_speeds"); + + stream->write(wiggle_num_axis); + for (U32 i = 0; i < wiggle_num_axis; i++) + mathWrite(*stream, wiggle_axis[i]); + + stream->write(hover_altitude); + stream->write(hover_attack_distance); + stream->write(hover_attack_gradient); + stream->writeRangedU32(hover_time, 0, MaxLifetimeTicks); + + stream->writeFlag(reverse_targeting); + + stream->write(caster_safety_time); +} + +void afxMagicMissileData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + projectileShapeName = stream->readSTString(); + /* From stock Projectile code... + faceViewer = stream->readFlag(); + */ + if(stream->readFlag()) + { + stream->read(&scale.x); + stream->read(&scale.y); + stream->read(&scale.z); + } + else + scale.set(1,1,1); + + stream->read(&collision_mask); + + if (stream->readFlag()) + particleEmitterId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + + if (stream->readFlag()) + particleWaterEmitterId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + + /* From stock Projectile code... + if (stream->readFlag()) + explosionId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + + if (stream->readFlag()) + waterExplosionId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + */ + + if (stream->readFlag()) + splashId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + + /* From stock Projectile code... + if (stream->readFlag()) + decalId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + */ + + sfxRead( stream, &sound ); + + if (stream->readFlag()) + lightDescId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + + /* From stock Projectile code... + stream->read(&impactForce); + */ + + stream->read(&lifetime); + /* From stock Projectile code... + stream->read(&armingDelay); + stream->read(&fadeDelay); + */ + + isBallistic = stream->readFlag(); + if(isBallistic) + { + stream->read(&gravityMod); + /* From stock Projectile code... + stream->read(&bounceElasticity); + stream->read(&bounceFriction); + */ + stream->read(&ballisticCoefficient); + } + + isGuided = stream->readFlag(); + if(isGuided) + { + stream->read(&precision); + stream->read(&trackDelay); + } + + stream->read(&muzzleVelocity); + mathRead(*stream, &starting_vel_vec); + stream->read(&acceleration); + stream->read(&accelDelay); + stream->read(&accelLifetime); + + launch_node = stream->readSTString(); + mathRead(*stream, &launch_offset); + mathRead(*stream, &launch_offset_server); + mathRead(*stream, &launch_offset_client); + mathRead(*stream, &launch_node_offset); + stream->read(&launch_pitch); + stream->read(&launch_pan); + launch_cons_c_spec = stream->readSTString(); + echo_launch_offset = stream->readFlag(); + + readVector(wiggle_magnitudes, *stream, "afxMagicMissile: wiggle_magnitudes"); + readVector(wiggle_speeds, *stream, "afxMagicMissile: wiggle_speeds"); + + if (wiggle_axis) + delete [] wiggle_axis; + wiggle_axis = 0; + wiggle_num_axis = 0; + + stream->read(&wiggle_num_axis); + if (wiggle_num_axis > 0) + { + wiggle_axis = new Point3F[wiggle_num_axis]; + for (U32 i = 0; i < wiggle_num_axis; i++) + mathRead(*stream, &wiggle_axis[i]); + } + + stream->read(&hover_altitude); + stream->read(&hover_attack_distance); + stream->read(&hover_attack_gradient); + hover_time = stream->readRangedU32(0, MaxLifetimeTicks); + + reverse_targeting = stream->readFlag(); + + stream->read(&caster_safety_time); +} + +/* From stock Projectile code... +bool ProjectileData::setLifetime( void *obj, const char *index, const char *data ) +{ + S32 value = dAtoi(data); + value = scaleValue(value); + + ProjectileData *object = static_cast(obj); + object->lifetime = value; + + return false; +} + +bool ProjectileData::setArmingDelay( void *obj, const char *index, const char *data ) +{ + S32 value = dAtoi(data); + value = scaleValue(value); + + ProjectileData *object = static_cast(obj); + object->armingDelay = value; + + return false; +} + +bool ProjectileData::setFadeDelay( void *obj, const char *index, const char *data ) +{ + S32 value = dAtoi(data); + value = scaleValue(value); + + ProjectileData *object = static_cast(obj); + object->fadeDelay = value; + + return false; +} + +const char *ProjectileData::getScaledValue( void *obj, const char *data) +{ + + S32 value = dAtoi(data); + value = scaleValue(value, false); + + String stringData = String::ToString(value); + char *strBuffer = Con::getReturnBuffer(stringData.size()); + dMemcpy( strBuffer, stringData, stringData.size() ); + + return strBuffer; +} + +S32 ProjectileData::scaleValue( S32 value, bool down ) +{ + S32 minV = 0; + S32 maxV = Projectile::MaxLivingTicks; + + // scale down to ticks before we validate + if( down ) + value /= TickMs; + + if(value < minV || value > maxV) + { + Con::errorf("ProjectileData::scaleValue(S32 value = %d, bool down = %b) - Scaled value must be between %d and %d", value, down, minV, maxV); + if(value < minV) + value = minV; + else if(value > maxV) + value = maxV; + } + + // scale up from ticks after we validate + if( !down ) + value *= TickMs; + + return value; +} +*/ + +void afxMagicMissileData::gather_cons_defs(Vector& defs) +{ + if (launch_cons_s_def.isDefined()) + defs.push_back(launch_cons_s_def); + if (launch_cons_c_def.isDefined()) + defs.push_back(launch_cons_c_def); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicMissile + +afxMagicMissile::afxMagicMissile() +{ + init(true, true); +} + +afxMagicMissile::afxMagicMissile(bool on_server, bool on_client) +{ + init(on_server, on_client); +} + +//-------------------------------------------------------------------------- +//-------------------------------------- +// +void afxMagicMissile::init(bool on_server, bool on_client) +{ + mPhysicsWorld = NULL; + + mTypeMask |= ProjectileObjectType | LightObjectType; + + mLight = LightManager::createLightInfo(); + mLight->setType( LightInfo::Point ); + + mLightState.clear(); + mLightState.setLightInfo( mLight ); + + mCurrPosition.zero(); + mCurrVelocity.set(0, 0, 1); + + mCurrTick = 0; + + mParticleEmitter = NULL; + mParticleWaterEmitter = NULL; + mSound = 0; + + mProjectileShape = NULL; + + mDataBlock = NULL; + + choreographer = NULL; + + if (on_server != on_client) + { + client_only = on_client; + server_only = on_server; + mNetFlags.clear(Ghostable | ScopeAlways); + if (client_only) + mNetFlags.set(IsGhost); + } + else + { + // note -- setting neither server or client makes no sense so we + // treat as if both are set. + mNetFlags.set(Ghostable | ScopeAlways); + client_only = server_only = false; + } + + mCurrDeltaBase.zero(); + mCurrBackDelta.zero(); + collision_mask = 0; + prec_inc = 0.0f; + + did_launch = false; + did_impact = false; + + missile_target = NULL; + collide_exempt = NULL; + + use_accel = false; + + hover_attack_go = false; + hover_attack_tick = 0; + + starting_velocity = 0.0; + starting_vel_vec.zero(); + + ss_object = 0; + ss_index = 0; +} + +afxMagicMissile::~afxMagicMissile() +{ + SAFE_DELETE(mLight); + + delete mProjectileShape; + mProjectileShape = NULL; +} + +//-------------------------------------------------------------------------- +void afxMagicMissile::initPersistFields() +{ + addGroup("Physics"); + addField("initialPosition", TypePoint3F, Offset(mCurrPosition, afxMagicMissile) , + "Initial starting position for this missile."); + addField("initialVelocity", TypePoint3F, Offset(mCurrVelocity, afxMagicMissile) , + "Initial starting velocity for this missile."); + endGroup("Physics"); + + /* From stock Projectile code... + addGroup("Source"); + addField("sourceObject", TypeS32, Offset(mSourceObjectId, Projectile) ,"The object that fires this projectile. If this projectile was fired by a WeaponImage, it will be the object that owns the WeaponImage, usually the player."); + addField("sourceSlot", TypeS32, Offset(mSourceObjectSlot, Projectile) ,"Which weapon slot on the sourceObject that this projectile originates from."); + endGroup("Source"); + */ + + Parent::initPersistFields(); +} + +/* From stock Projectile code... +bool Projectile::calculateImpact(float, + Point3F& pointOfImpact, + float& impactTime) +{ + Con::warnf(ConsoleLogEntry::General, "Projectile::calculateImpact: Should never be called"); + + impactTime = 0; + pointOfImpact.set(0, 0, 0); + return false; +} + + +//-------------------------------------------------------------------------- +F32 Projectile::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 updateSkips) +{ + F32 ret = Parent::getUpdatePriority(camInfo, updateMask, updateSkips); + // if the camera "owns" this object, it should have a slightly higher priority + if(mSourceObject == camInfo->camera) + return ret + 0.2; + return ret; +} +*/ + +bool afxMagicMissile::onAdd() +{ + if(!Parent::onAdd()) + return false; + + if (isServerObject()) + { + /* From stock Projectile code... + ShapeBase* ptr; + if (Sim::findObject(mSourceObjectId, ptr)) + { + mSourceObject = ptr; + + // Since we later do processAfter( mSourceObject ) we must clearProcessAfter + // if it is deleted. SceneObject already handles this in onDeleteNotify so + // all we need to do is register for the notification. + deleteNotify( ptr ); + } + else + { + if (mSourceObjectId != -1) + Con::errorf(ConsoleLogEntry::General, "Projectile::onAdd: mSourceObjectId is invalid"); + mSourceObject = NULL; + } + + // If we're on the server, we need to inherit some of our parent's velocity + // + mCurrTick = 0; + */ + } + else + { + if (bool(mDataBlock->projectileShape)) + { + mProjectileShape = new TSShapeInstance(mDataBlock->projectileShape, true); + /* From stock Projectile code... + if (mDataBlock->activateSeq != -1) + { + mActivateThread = mProjectileShape->addThread(); + mProjectileShape->setTimeScale(mActivateThread, 1); + mProjectileShape->setSequence(mActivateThread, mDataBlock->activateSeq, 0); + } + */ + } + if (mDataBlock->particleEmitter != NULL) + { + ParticleEmitter* pEmitter = new ParticleEmitter; + //pEmitter->setDataBlock(mDataBlock->particleEmitter->cloneAndPerformSubstitutions(ss_object, ss_index)); + pEmitter->onNewDataBlock(mDataBlock->particleEmitter->cloneAndPerformSubstitutions(ss_object, ss_index), false); + if (pEmitter->registerObject() == false) + { + Con::warnf(ConsoleLogEntry::General, "Could not register particle emitter for particle of class: %s", mDataBlock->getName()); + delete pEmitter; + pEmitter = NULL; + } + mParticleEmitter = pEmitter; + } + + if (mDataBlock->particleWaterEmitter != NULL) + { + ParticleEmitter* pEmitter = new ParticleEmitter; + pEmitter->onNewDataBlock(mDataBlock->particleWaterEmitter->cloneAndPerformSubstitutions(ss_object, ss_index), false); + if (pEmitter->registerObject() == false) + { + Con::warnf(ConsoleLogEntry::General, "Could not register particle emitter for particle of class: %s", mDataBlock->getName()); + delete pEmitter; + pEmitter = NULL; + } + mParticleWaterEmitter = pEmitter; + } + } + /* From stock Projectile code... + if (mSourceObject.isValid()) + processAfter(mSourceObject); + */ + + // detect for acceleration + use_accel = (mDataBlock->acceleration != 0 && mDataBlock->accelLifetime > 0); + + // Setup our bounding box + if (bool(mDataBlock->projectileShape) == true) + mObjBox = mDataBlock->projectileShape->bounds; + else + mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); + resetWorldBox(); + addToScene(); + + if ( PHYSICSMGR ) + mPhysicsWorld = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" ); + + return true; +} + + +void afxMagicMissile::onRemove() +{ + if(mParticleEmitter) + { + mParticleEmitter->deleteWhenEmpty(); + mParticleEmitter = NULL; + } + + if(mParticleWaterEmitter) + { + mParticleWaterEmitter->deleteWhenEmpty(); + mParticleWaterEmitter = NULL; + } + + SFX_DELETE( mSound ); + + removeFromScene(); + Parent::onRemove(); +} + + +bool afxMagicMissile::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + starting_velocity = mDataBlock->muzzleVelocity; + starting_vel_vec = mDataBlock->starting_vel_vec; + collision_mask = mDataBlock->collision_mask; + + if ( isGhost() ) + { + // Create the sound ahead of time. This reduces runtime + // costs and makes the system easier to understand. + + SFX_DELETE( mSound ); + + if ( mDataBlock->sound ) + mSound = SFX->createSource( mDataBlock->sound ); + } + + return true; +} + + +//-------------------------------------------------------------------------- + +void afxMagicMissile::submitLights( LightManager *lm, bool staticLighting ) +{ + if ( staticLighting || isHidden() || !mDataBlock->lightDesc ) + return; + + mDataBlock->lightDesc->submitLight( &mLightState, getRenderTransform(), lm, this ); +} + +bool afxMagicMissile::pointInWater(const Point3F &point) +{ + // This is pretty much a hack so we can use the existing ContainerQueryInfo + // and findObject router. + + // We only care if we intersect with water at all + // so build a box at the point that has only 1 z extent. + // And test if water coverage is anything other than zero. + + Box3F boundsBox( point, point ); + boundsBox.maxExtents.z += 1.0f; + + ContainerQueryInfo info; + info.box = boundsBox; + info.mass = 0.0f; + + // Find and retreive physics info from intersecting WaterObject(s) + if(mContainer != NULL) + { + mContainer->findObjects( boundsBox, WaterObjectType, findRouter, &info ); + } + else + { + // Handle special case where the projectile has exploded prior to having + // called onAdd() on the client. This occurs when the projectile on the + // server is created and then explodes in the same network update tick. + // On the client end in NetConnection::ghostReadPacket() the ghost is + // created and then Projectile::unpackUpdate() is called prior to the + // projectile being registered. Within unpackUpdate() the explosion + // is triggered, but without being registered onAdd() isn't called and + // the container is not set. As all we're doing is checking if the + // given explosion point is within water, we should be able to use the + // global container here. We could likely always get away with this, + // but using the actual defined container when possible is the right + // thing to do. DAW + AssertFatal(isClientObject(), "Server projectile has not been properly added"); + gClientContainer.findObjects( boundsBox, WaterObjectType, findRouter, &info ); + } + + return ( info.waterCoverage > 0.0f ); +} + +//---------------------------------------------------------------------------- + +void afxMagicMissile::emitParticles(const Point3F& from, const Point3F& to, const Point3F& vel, const U32 ms) +{ + /* From stock Projectile code... + if ( isHidden() ) + return; + */ + + Point3F axis = -vel; + + if( axis.isZero() ) + axis.set( 0.0, 0.0, 1.0 ); + else + axis.normalize(); + + bool fromWater = pointInWater(from); + bool toWater = pointInWater(to); + + if (!fromWater && !toWater && bool(mParticleEmitter)) // not in water + mParticleEmitter->emitParticles(from, to, axis, vel, ms); + else if (fromWater && toWater && bool(mParticleWaterEmitter)) // in water + mParticleWaterEmitter->emitParticles(from, to, axis, vel, ms); + else if (!fromWater && toWater) // entering water + { + // cast the ray to get the surface point of the water + RayInfo rInfo; + if (gClientContainer.castRay(from, to, WaterObjectType, &rInfo)) + { + create_splash(rInfo.point); + + // create an emitter for the particles out of water and the particles in water + if (mParticleEmitter) + mParticleEmitter->emitParticles(from, rInfo.point, axis, vel, ms); + + if (mParticleWaterEmitter) + mParticleWaterEmitter->emitParticles(rInfo.point, to, axis, vel, ms); + } + } + else if (fromWater && !toWater) // leaving water + { + // cast the ray in the opposite direction since that point is out of the water, otherwise + // we hit water immediately and wont get the appropriate surface point + RayInfo rInfo; + if (gClientContainer.castRay(to, from, WaterObjectType, &rInfo)) + { + create_splash(rInfo.point); + + // create an emitter for the particles out of water and the particles in water + if (mParticleEmitter) + mParticleEmitter->emitParticles(rInfo.point, to, axis, vel, ms); + + if (mParticleWaterEmitter) + mParticleWaterEmitter->emitParticles(from, rInfo.point, axis, vel, ms); + } + } +} + +void afxMagicMissile::processTick(const Move* move) +{ + Parent::processTick( move ); + + // only active from launch to impact + if (!is_active()) + return; + + mCurrTick++; + + // missile fizzles out by exceeding lifetime + if ((isServerObject() || client_only) && mCurrTick >= mDataBlock->lifetime) + { + did_impact = true; + setMaskBits(ImpactMask); + if (choreographer) + { + Point3F n = mCurrVelocity; n.normalizeSafe(); + choreographer->impactNotify(mCurrPosition, n, 0); + } + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + 500); + return; + } + + static F32 dT = F32(TickMs)*0.001f; + + Point3F old_pos = mCurrPosition; + + // adjust missile velocity from gravity and drag influences + if (mDataBlock->isBallistic) + { + F32 dV = (1 - mDataBlock->ballisticCoefficient)*dT; + Point3F d(mCurrVelocity.x*dV, mCurrVelocity.y*dV, 9.81f*mDataBlock->gravityMod*dT); + mCurrVelocity -= d; + } + + // adjust missile velocity from acceleration + if (use_accel) + { + if (mCurrTick > mDataBlock->accelDelay && + mCurrTick <= mDataBlock->accelDelay + mDataBlock->accelLifetime) + { + Point3F d = mCurrVelocity; d.normalizeSafe(); + mCurrVelocity += d*mDataBlock->acceleration*dT; + } + } + + // adjust mCurrVelocity from guidance system influences + if (mDataBlock->isGuided && missile_target && mCurrTick > mDataBlock->trackDelay) + { + // get the position tracked by the guidance system + Point3F target_pos = missile_target->getBoxCenter(); + + Point3F target_vec = target_pos - mCurrPosition; + + F32 target_dist_sq = target_vec.lenSquared(); + if (target_dist_sq < 4.0f) + prec_inc += 1.0f; + + // hover + if (mDataBlock->hover_altitude > 0.0f) + { + Point3F target_vec_xy(target_vec.x, target_vec.y, 0); + F32 xy_dist = target_vec_xy.len(); + + if (xy_dist > mDataBlock->hover_attack_distance) + { + hover_attack_go = false; + + if (xy_dist > mDataBlock->hover_attack_distance + mDataBlock->hover_attack_gradient) + { + target_pos.z += mDataBlock->hover_altitude; + } + else + { + target_pos.z += afxEase::eq( (xy_dist-mDataBlock->hover_attack_distance)/mDataBlock->hover_attack_gradient, + 0.0f, mDataBlock->hover_altitude, + 0.25f, 0.75f); + } + target_vec = target_pos - mCurrPosition; + } + + else + { + if (!hover_attack_go) + { + hover_attack_go = true; + hover_attack_tick = 0; + } + hover_attack_tick++; + + if (hover_attack_tick < mDataBlock->hover_time) + { + target_pos.z += mDataBlock->hover_altitude; + target_vec = target_pos - mCurrPosition; + } + } + } + + // apply precision + + // extract speed + F32 speed = mCurrVelocity.len(); + + // normalize vectors + target_vec.normalizeSafe(); + mCurrVelocity.normalize(); + + F32 prec = mDataBlock->precision; + + // fade in precision gradually to avoid sudden turn + if (mCurrTick < mDataBlock->trackDelay + 16) + prec *= (mCurrTick - mDataBlock->trackDelay)/16.0f; + + prec += prec_inc; + if (prec > 100) + prec = 100; + + // apply precision weighting + target_vec *= prec; + mCurrVelocity *= (100 - prec); + + mCurrVelocity += target_vec; + mCurrVelocity.normalize(); + mCurrVelocity *= speed; + } + + // wiggle + for (U32 i = 0; i < mDataBlock->wiggle_num_axis; i++) + { + if (i >= mDataBlock->wiggle_magnitudes.size() || i >= mDataBlock->wiggle_speeds.size()) + break; + + F32 wiggle_mag = mDataBlock->wiggle_magnitudes[i]; + F32 wiggle_speed = mDataBlock->wiggle_speeds[i]; + Point3F wiggle_axis = mDataBlock->wiggle_axis[i]; + //wiggle_axis.normalizeSafe(); // sufficient???? + + F32 theta = wiggle_mag * mSin(wiggle_speed*(mCurrTick*TickSec)); + //Con::printf( "theta: %f", theta ); + AngAxisF thetaRot(wiggle_axis, theta); + MatrixF temp(true); + thetaRot.setMatrix(&temp); + temp.mulP(mCurrVelocity); + } + + Point3F new_pos = old_pos + mCurrVelocity*dT; + + // conform to terrain + if (mDataBlock->followTerrain && mCurrTick >= mDataBlock->followTerrainAdjustDelay) + { + U32 mask = TerrainObjectType | TerrainLikeObjectType; // | InteriorObjectType; + + F32 ht = mDataBlock->followTerrainHeight; + F32 ht_rate = mDataBlock->followTerrainAdjustRate; + F32 ht_min = 0.05f; + if (ht < ht_min) + ht = ht_min; + + SceneContainer* container = (isServerObject()) ? &gServerContainer : &gClientContainer; + Point3F above_pos = new_pos; above_pos.z += 10000; + Point3F below_pos = new_pos; below_pos.z -= 10000; + RayInfo rInfo; + if (container && container->castRay(above_pos, below_pos, mask, &rInfo)) + { + F32 terrain_z = rInfo.point.z; + F32 seek_z = terrain_z + ht; + if (new_pos.z < seek_z) + { + new_pos.z += ht_rate*dT; + if (new_pos.z > seek_z) + new_pos.z = seek_z; + } + else if (new_pos.z > seek_z) + { + new_pos.z -= ht_rate*dT; + if (new_pos.z < seek_z) + new_pos.z = seek_z; + } + + if (new_pos.z < terrain_z + ht_min) + new_pos.z = terrain_z + ht_min; + } + } + + // only check for impacts on server + if (isServerObject()) + { + // avoid collision with the spellcaster + if (collide_exempt && mCurrTick <= mDataBlock->caster_safety_time) + collide_exempt->disableCollision(); + + // check for collision along ray from old to new position + RayInfo rInfo; + bool did_hit = false; + + if (mPhysicsWorld) + { + // did_hit = mPhysicsWorld->castRay(old_pos, new_pos, &rInfo, Point3F(new_pos - old_pos) * mDataBlock->impactForce ); + // Impulse currently hardcoded for testing purposes + did_hit = mPhysicsWorld->castRay(old_pos, new_pos, &rInfo, Point3F(new_pos - old_pos) * 1000.0f ); + } + else + { + did_hit = getContainer()->castRay(old_pos, new_pos, collision_mask, &rInfo); + } + + // restore collisions on spellcaster + if (collide_exempt && mCurrTick <= mDataBlock->caster_safety_time) + collide_exempt->enableCollision(); + + // process impact + if (did_hit) + { + MatrixF xform(true); + xform.setColumn(3, rInfo.point); + setTransform(xform); + mCurrPosition = rInfo.point; + mCurrVelocity = Point3F(0, 0, 0); + did_impact = true; + setMaskBits(ImpactMask); + if (choreographer) + { + choreographer->impactNotify(rInfo.point, rInfo.normal, rInfo.object); + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + 500); + } + } + } + else // if (isClientObject()) + { + emitParticles(mCurrPosition, new_pos, mCurrVelocity, TickMs); + updateSound(); + } + + // interp values used in interpolateTick() + mCurrDeltaBase = new_pos; + mCurrBackDelta = mCurrPosition - new_pos; + + mCurrPosition = new_pos; + + MatrixF xform(true); + xform.setColumn(3, mCurrPosition); + setTransform(xform); +} + +void afxMagicMissile::interpolateTick(F32 delta) +{ + Parent::interpolateTick(delta); + + // only active from launch to impact + if (!is_active()) + return; + + Point3F interpPos = mCurrDeltaBase + mCurrBackDelta * delta; + Point3F dir = mCurrVelocity; + if(dir.isZero()) + dir.set(0,0,1); + else + dir.normalize(); + + MatrixF xform(true); + xform = MathUtils::createOrientFromDir(dir); + xform.setPosition(interpPos); + setRenderTransform(xform); + + updateSound(); +} + +//-------------------------------------------------------------------------- +U32 afxMagicMissile::packUpdate(NetConnection* con, U32 mask, BitStream* stream) +{ + U32 retMask = Parent::packUpdate( con, mask, stream ); + + const bool isInitalUpdate = mask & GameBase::InitialUpdateMask; + + // InitialUpdateMask + if ( stream->writeFlag( isInitalUpdate ) ) + { + Point3F pos; + getTransform().getColumn( 3, &pos ); + stream->writeCompressedPoint( pos ); + F32 len = mCurrVelocity.len(); + + if ( stream->writeFlag( len > 0.02 ) ) + { + Point3F outVel = mCurrVelocity; + outVel *= 1 / len; + stream->writeNormalVector( outVel, 10 ); + len *= 32.0; // 5 bits for fraction + + if ( len > 8191 ) + len = 8191; + + stream->writeInt( (S32)len, 13 ); + } + + stream->writeRangedU32( mCurrTick, 0, afxMagicMissileData::MaxLifetimeTicks ); + + if (choreographer) + { + S32 ghostIndex = con->getGhostIndex( choreographer ); + if ( stream->writeFlag( ghostIndex != -1 ) ) + { + stream->writeRangedU32( U32(ghostIndex), + 0, + NetConnection::MaxGhostCount ); + } + else + // have not recieved the ghost for the source object yet, try again later + retMask |= GameBase::InitialUpdateMask; + } + else + stream->writeFlag( false ); + } + + // impact update + if (stream->writeFlag(mask & ImpactMask)) + { + mathWrite(*stream, mCurrPosition); + mathWrite(*stream, mCurrVelocity); + stream->writeFlag(did_impact); + } + + // guided update + if (stream->writeFlag(mask & GuideMask)) + { + mathWrite(*stream, mCurrPosition); + mathWrite(*stream, mCurrVelocity); + } + + return retMask; +} + +void afxMagicMissile::unpackUpdate(NetConnection* con, BitStream* stream) +{ + Parent::unpackUpdate(con, stream); + + if ( stream->readFlag() ) // InitialUpdateMask + { + Point3F pos; + stream->readCompressedPoint( &pos ); + if ( stream->readFlag() ) + { + stream->readNormalVector( &mCurrVelocity, 10 ); + mCurrVelocity *= stream->readInt( 13 ) / 32.0f; + } + else + mCurrVelocity.zero(); + + mCurrDeltaBase = pos; + mCurrBackDelta = mCurrPosition - pos; + mCurrPosition = pos; + setPosition( mCurrPosition ); + + mCurrTick = stream->readRangedU32(0, afxMagicMissileData::MaxLifetimeTicks); + if ( stream->readFlag() ) + { + U32 id = stream->readRangedU32(0, NetConnection::MaxGhostCount); + choreographer = dynamic_cast(con->resolveGhost(id)); + if (choreographer) + { + deleteNotify(choreographer); + } + } + else + { + if (choreographer) + clearNotify(choreographer); + choreographer = 0; + } + } + + // impact update + if (stream->readFlag()) + { + mathRead(*stream, &mCurrPosition); + mathRead(*stream, &mCurrVelocity); + did_impact = stream->readFlag(); + + } + + if (stream->readFlag()) // guided update + { + mathRead( *stream, &mCurrPosition ); + mathRead( *stream, &mCurrVelocity ); + } +} + +//-------------------------------------------------------------------------- +void afxMagicMissile::prepRenderImage(SceneRenderState* state) +{ + if (!is_active()) + return; + + /* + if (isHidden() || mFadeValue <= (1.0/255.0)) + return; + */ + + if ( mDataBlock->lightDesc ) + { + mDataBlock->lightDesc->prepRender( state, &mLightState, getRenderTransform() ); + } + + /* + if ( mFlareData ) + { + mFlareState.fullBrightness = mDataBlock->lightDesc->mBrightness; + mFlareState.scale = mFlareScale; + mFlareState.lightInfo = mLight; + mFlareState.lightMat = getTransform(); + + mFlareData->prepRender( state, &mFlareState ); + } + */ + + prepBatchRender( state ); +} + +void afxMagicMissile::prepBatchRender(SceneRenderState* state) +{ + if ( !mProjectileShape ) + return; + + GFXTransformSaver saver; + + // Set up our TS render state. + TSRenderState rdata; + rdata.setSceneState( state ); + + // We might have some forward lit materials + // so pass down a query to gather lights. + LightQuery query; + query.init( getWorldSphere() ); + rdata.setLightQuery( &query ); + + MatrixF mat = getRenderTransform(); + mat.scale( mObjScale ); + mat.scale( mDataBlock->scale ); + GFX->setWorldMatrix( mat ); + + mProjectileShape->setDetailFromPosAndScale( state, mat.getPosition(), mObjScale ); + mProjectileShape->animate(); + + mProjectileShape->render( rdata ); +} + +void afxMagicMissile::onDeleteNotify(SimObject* obj) +{ + ShapeBase* shape_test = dynamic_cast(obj); + if (shape_test == collide_exempt) + { + collide_exempt = NULL; + Parent::onDeleteNotify(obj); + return; + } + + SceneObject* target_test = dynamic_cast(obj); + if (target_test == missile_target) + { + missile_target = NULL; + Parent::onDeleteNotify(obj); + return; + } + + afxChoreographer* ch = dynamic_cast(obj); + if (ch == choreographer) + { + choreographer = NULL; + Parent::onDeleteNotify(obj); + return; + } + + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private: + +void afxMagicMissile::create_splash(const Point3F& pos) +{ + if (!mDataBlock || !mDataBlock->splash) + return; + + MatrixF xfm = getTransform(); + xfm.setPosition(pos); + + Splash* splash = new Splash(); + splash->onNewDataBlock(mDataBlock->splash, false); + splash->setTransform(xfm); + splash->setInitialState(xfm.getPosition(), Point3F(0.0, 0.0, 1.0)); + if (!splash->registerObject()) + { + delete splash; + splash = NULL; + } +} + +void afxMagicMissile::get_launch_constraint_data(Point3F& pos, Point3F& vel) +{ + // need a choreographer + if (!choreographer) + { + Con::errorf("afxMagicMissile::get_launch_constraint_data(): missing choreographer."); + return; + } + + // need a constraint manager + afxConstraintMgr* cons_mgr = choreographer->getConstraintMgr(); + if (!cons_mgr) + { + Con::errorf("afxMagicMissile::get_launch_constraint_data(): missing constriant manager."); + return; + } + + // need a valid constraint + afxConstraintID launch_cons_id; + if (isServerObject()) + launch_cons_id = cons_mgr->getConstraintId(mDataBlock->launch_cons_s_def); + else + launch_cons_id = cons_mgr->getConstraintId(mDataBlock->launch_cons_c_def); + + afxConstraint* launch_cons = cons_mgr->getConstraint(launch_cons_id); + if (!launch_cons) + { + Con::errorf("afxMagicMissile::get_launch_constraint_data(): constraint undefined."); + return; + } + + MatrixF launch_xfm; + launch_cons->getTransform(launch_xfm); + + Point3F launch_pos; + launch_cons->getPosition(launch_pos); + + pos = launch_pos; + + // echo the actual launch position to the console + if (mDataBlock->echo_launch_offset) + { + SceneObject* default_launcher = get_default_launcher(); + if (default_launcher) + { + MatrixF launcher_xfm_inv = default_launcher->getWorldTransform(); + VectorF offset = pos - default_launcher->getRenderPosition(); + launcher_xfm_inv.mulV(offset); + if (isServerObject()) + Con::printf("launchOffsetServer = \"%g %g %g\";", offset.x, offset.y, offset.z); + else + Con::printf("launchOffsetClient = \"%g %g %g\";", offset.x, offset.y, offset.z); + } + } + + // setup aiming matrix to straight forward and level + MatrixF aim_mtx; + AngAxisF aim_aa(Point3F(0,1,0),0); + aim_aa.setMatrix(&aim_mtx); + + // calculate final aiming vector + MatrixF aim2_mtx; + aim2_mtx.mul(launch_xfm, aim_mtx); + + VectorF aim_vec; + aim2_mtx.getColumn(1,&aim_vec); + aim_vec.normalizeSafe(); + + // give velocity vector a magnitude + vel = aim_vec*mDataBlock->muzzleVelocity; +} + +// resolve the launch constraint object. normally it's the caster, but for +// reverse_targeting the target object us used. +SceneObject* afxMagicMissile::get_default_launcher() const +{ + SceneObject* launch_cons_obj = 0; + if (mDataBlock->reverse_targeting) + { + if (dynamic_cast(choreographer)) + launch_cons_obj = ((afxMagicSpell*)choreographer)->target; + if (!launch_cons_obj) + { + Con::errorf("afxMagicMissile::get_launch_data(): missing target constraint object for reverse targeted missile."); + return 0; + } + } + else + { + if (dynamic_cast(choreographer)) + launch_cons_obj = ((afxMagicSpell*)choreographer)->caster; + if (!launch_cons_obj) + { + Con::errorf("afxMagicMissile::get_launch_data(): missing launch constraint object missile."); + return 0; + } + } + + return launch_cons_obj; +} + +void afxMagicMissile::get_launch_data(Point3F& pos, Point3F& vel) +{ + bool use_constraint = (isServerObject()) ? mDataBlock->launch_cons_s_def.isDefined() : mDataBlock->launch_cons_c_def.isDefined(); + if (use_constraint) + { + get_launch_constraint_data(pos, vel); + return; + } + + // a choreographer pointer is required + if (!choreographer) + { + Con::errorf("afxMagicMissile::get_launch_data(): missing choreographer."); + return; + } + + SceneObject* launch_cons_obj = get_default_launcher(); + if (!launch_cons_obj) + return; + + MatrixF launch_xfm = launch_cons_obj->getRenderTransform(); + + // calculate launch position + Point3F offset_override = (isClientObject()) ? mDataBlock->launch_offset_client : + mDataBlock->launch_offset_server; + // override + if (!offset_override.isZero()) + { + launch_xfm.mulV(offset_override); + pos = launch_cons_obj->getRenderPosition() + offset_override; + } + // no override + else + { + // get transformed launch offset + VectorF launch_offset = mDataBlock->launch_offset; + launch_xfm.mulV(launch_offset); + + StringTableEntry launch_node = mDataBlock->launch_node; + + // calculate position of missile at launch + if (launch_node != ST_NULLSTRING) + { + ShapeBase* launch_cons_shape = dynamic_cast(launch_cons_obj); + TSShapeInstance* shape_inst = (launch_cons_shape) ? launch_cons_shape->getShapeInstance() : 0; + if (!shape_inst || !shape_inst->getShape()) + launch_node = ST_NULLSTRING; + else + { + S32 node_ID = shape_inst->getShape()->findNode(launch_node); + MatrixF node_xfm = launch_cons_obj->getRenderTransform(); + node_xfm.scale(launch_cons_obj->getScale()); + if (node_ID >= 0) + node_xfm.mul(shape_inst->mNodeTransforms[node_ID]); + + VectorF node_offset = mDataBlock->launch_node_offset; + node_xfm.mulV(node_offset); + + pos = node_xfm.getPosition() + launch_offset + node_offset; + } + } + // calculate launch position without launch node + else + pos = launch_cons_obj->getRenderPosition() + launch_offset; + } + + // echo the actual launch position to the console + if (mDataBlock->echo_launch_offset) + { + VectorF offset = pos - launch_cons_obj->getRenderPosition(); + MatrixF caster_xfm_inv = launch_xfm; + caster_xfm_inv.affineInverse(); + caster_xfm_inv.mulV(offset); + if (isServerObject()) + Con::printf("launchOffsetServer = \"%g %g %g\";", offset.x, offset.y, offset.z); + else + Con::printf("launchOffsetClient = \"%g %g %g\";", offset.x, offset.y, offset.z); + } + + // calculate launch velocity vector + if (starting_vel_vec.isZero()) + { + // setup aiming matrix to straight forward and level + MatrixF aim_mtx; + AngAxisF aim_aa(Point3F(0,1,0),0); + aim_aa.setMatrix(&aim_mtx); + + // setup pitch matrix + MatrixF pitch_mtx; + AngAxisF pitch_aa(Point3F(1,0,0),mDegToRad(mDataBlock->launch_pitch)); + pitch_aa.setMatrix(&pitch_mtx); + + // setup pan matrix + MatrixF pan_mtx; + AngAxisF pan_aa(Point3F(0,0,1),mDegToRad(mDataBlock->launch_pan)); + pan_aa.setMatrix(&pan_mtx); + + // calculate adjusted aiming matrix + aim_mtx.mul(pitch_mtx); + aim_mtx.mul(pan_mtx); + + // calculate final aiming vector + MatrixF aim2_mtx; + aim2_mtx.mul(launch_xfm, aim_mtx); + VectorF aim_vec; + aim2_mtx.getColumn(1,&aim_vec); + aim_vec.normalizeSafe(); + + // give velocity vector a magnitude + vel = aim_vec*mDataBlock->muzzleVelocity; + } + else + { + vel = starting_vel_vec*starting_velocity; + } +} + +void afxMagicMissile::updateSound() +{ + if (!mDataBlock->sound) + return; + + if ( mSound ) + { + if ( !mSound->isPlaying() ) + mSound->play(); + + mSound->setVelocity( getVelocity() ); + mSound->setTransform( getRenderTransform() ); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// public: + +void afxMagicMissile::launch() +{ + get_launch_data(mCurrPosition, mCurrVelocity); + + mCurrDeltaBase = mCurrPosition; + mCurrBackDelta.zero(); + + did_launch = true; + + setPosition(mCurrPosition); + + afxMagicSpell* spell = dynamic_cast(choreographer); + if (spell) + { + if (mDataBlock->reverse_targeting) + { + missile_target = spell->caster; + collide_exempt = spell->target; + } + else + { + missile_target = spell->target; + collide_exempt = spell->caster; + } + + if (spell->caster) + processAfter(spell->caster); + if (missile_target) + deleteNotify(missile_target); + if (collide_exempt) + deleteNotify(collide_exempt); + } + else + { + missile_target = 0; + collide_exempt = 0; + } +} + +void afxMagicMissile::setChoreographer(afxChoreographer* chor) +{ + if (choreographer) + clearNotify(choreographer); + choreographer = chor; + if (choreographer) + deleteNotify(choreographer); +} + +void afxMagicMissile::setStartingVelocityVector(const Point3F& vel_vec) +{ + starting_vel_vec = vel_vec; +} + +void afxMagicMissile::setStartingVelocity(const F32 vel) +{ + starting_velocity = vel; +} + +void afxMagicMissile::getStartingVelocityValues(F32& vel, Point3F& vel_vec) +{ + vel = starting_velocity; + vel_vec = starting_vel_vec; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +/* From stock Projectile code... +DefineEngineMethod(Projectile, presimulate, void, (F32 seconds), (1.0f), "Updates velocity and position, and performs collision testing.\n" + "@param seconds Amount of time, in seconds, since the simulation began, to start the simulation at.\n" + "@tsexample\n" + "// Tell the projectile object to process a simulation event, and provide the amount of time\n" + " in seconds that has passed since the simulation began.\n" + "%seconds = 2000;\n" + "%projectile.presimulate(%seconds);\n" + "@endtsexample\n") +{ + object->simulate( seconds ); +} +*/ + +DefineEngineMethod(afxMagicMissile, setStartingVelocityVector, void, (Point3F velocityVec),, + "Set the starting velocity-vector for a magic-missile.\n\n" + "@ingroup AFX") +{ + object->setStartingVelocityVector(velocityVec); +} + +DefineEngineMethod(afxMagicMissile, setStartingVelocity, void, (float velocity),, + "Set the starting velocity for a magic-missile.\n\n" + "@ingroup AFX") +{ + object->setStartingVelocity(velocity); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxMagicMissile.h b/Engine/source/afx/afxMagicMissile.h new file mode 100644 index 000000000..332d69d3c --- /dev/null +++ b/Engine/source/afx/afxMagicMissile.h @@ -0,0 +1,435 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// afxMagicMissile is a heavily modified variation of the stock Projectile class. In +// addition to numerous AFX customizations, it also incorporates functionality based on +// the following TGE resources: +// +// Guided or Seeker Projectiles by Derk Adams +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6778 +// +// Projectile Ballistic Coefficients (drag factors) by Mark Owen +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5128 +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_MAGIC_MISSILE_H_ +#define _AFX_MAGIC_MISSILE_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "T3D/lightDescription.h" +#include "T3D/fx/particleEmitter.h" + +#include "afx/afxConstraint.h" + +class SplashData; +class ShapeBase; +class TSShapeInstance; +class PhysicsWorld; +class SFXTrack; +class SFXSource; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicMissileData + +class afxMagicMissileData : public GameBaseData +{ + typedef GameBaseData Parent; + +protected: + bool onAdd(); + +public: + enum { MaxLifetimeTicks = 4095 }; + +public: + // variables set in datablock definition: + // Shape related + StringTableEntry projectileShapeName; + + //bool hasLight; + //F32 lightRadius; + //LinearColorF lightColor; + + //bool hasWaterLight; + //LinearColorF waterLightColor; + + /* + /// Set to true if it is a billboard and want it to always face the viewer, false otherwise + bool faceViewer; + */ + Point3F scale; + + /* + /// [0,1] scale of how much velocity should be inherited from the parent object + F32 velInheritFactor; + /// Speed of the projectile when fired + */ + F32 muzzleVelocity; + + /// Should it arc? + bool isBallistic; + + /* + /// How HIGH should it bounce (parallel to normal), [0,1] + F32 bounceElasticity; + /// How much momentum should be lost when it bounces (perpendicular to normal), [0,1] + F32 bounceFriction; + */ + + /// Should this projectile fall/rise different than a default object? + F32 gravityMod; + + /// How long the projectile should exist before deleting itself + U32 lifetime; // ticks + /* + /// How long it should not detonate on impact + S32 armingDelay; // the values are converted on initialization with + */ + S32 fadeDelay; // ticks + + /* + ExplosionData* explosion; // Explosion Datablock + S32 explosionId; // Explosion ID + ExplosionData* waterExplosion; // Water Explosion Datablock + S32 waterExplosionId; // Water Explosion ID + */ + + SplashData* splash; // Water Splash Datablock + S32 splashId; // Water splash ID + + SFXTrack* sound; // Projectile Sound + + LightDescription *lightDesc; + S32 lightDescId; + + /* + enum DecalConstants { // Number of decals constant + NumDecals = 6, + }; + DecalData* decals[NumDecals]; // Decal Datablocks + S32 decalId[NumDecals]; // Decal IDs + U32 decalCount; // # of loaded Decal Datablocks + */ + + // variables set on preload: + Resource projectileShape; + /* + S32 activateSeq; + S32 maintainSeq; + */ + + ParticleEmitterData* particleEmitter; + S32 particleEmitterId; + ParticleEmitterData* particleWaterEmitter; + S32 particleWaterEmitterId; + + U32 collision_mask; + + Point3F starting_vel_vec; + + // guidance behavior + bool isGuided; + F32 precision; + S32 trackDelay; + + // simple physics + F32 ballisticCoefficient; + + // terrain following + bool followTerrain; + F32 followTerrainHeight; + F32 followTerrainAdjustRate; + S32 followTerrainAdjustDelay; + + F32 acceleration; + S32 accelDelay; + U32 accelLifetime; + + StringTableEntry launch_node; + Point3F launch_offset; + Point3F launch_offset_server; + Point3F launch_offset_client; + Point3F launch_node_offset; + F32 launch_pitch; + F32 launch_pan; + bool echo_launch_offset; + + StringTableEntry launch_cons_s_spec; + afxConstraintDef launch_cons_s_def; + StringTableEntry launch_cons_c_spec; + afxConstraintDef launch_cons_c_def; + + // wiggle behavior + Vector wiggle_magnitudes; + Vector wiggle_speeds; + StringTableEntry wiggle_axis_string; + Point3F* wiggle_axis; + U32 wiggle_num_axis; + + // hover behavior + F32 hover_altitude; + F32 hover_attack_distance; + F32 hover_attack_gradient; + U32 hover_time; + + bool reverse_targeting; + + U32 caster_safety_time; + +public: + /*C*/ afxMagicMissileData(); + /*D*/ ~afxMagicMissileData(); + + void packData(BitStream*); + void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxMagicMissileData); + DECLARE_CATEGORY("AFX"); + +public: + /*C*/ afxMagicMissileData(const afxMagicMissileData&, bool = false); + + afxMagicMissileData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + virtual bool allowSubstitutions() const { return true; } + void gather_cons_defs(Vector& defs); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicMissile + +//class afxMagicSpell; +class afxChoreographer; + +class afxMagicMissile : public GameBase, public ISceneLight +{ + typedef GameBase Parent; + +public: + /* + // Initial conditions + enum ProjectileConstants { + SourceIdTimeoutTicks = 7, // = 231 ms + DeleteWaitTime = 500, ///< 500 ms delete timeout (for network transmission delays) + ExcessVelDirBits = 7, + MaxLivingTicks = 4095, + }; + */ + enum UpdateMasks { + /* + BounceMask = Parent::NextFreeMask, + ExplosionMask = Parent::NextFreeMask << 1, + */ + GuideMask = Parent::NextFreeMask << 0, + LaunchMask = Parent::NextFreeMask << 1, + ImpactMask = Parent::NextFreeMask << 2, + NextFreeMask = Parent::NextFreeMask << 3 + }; +protected: + PhysicsWorld *mPhysicsWorld; + + afxMagicMissileData* mDataBlock; + + ParticleEmitter* mParticleEmitter; + ParticleEmitter* mParticleWaterEmitter; + SFXSource* mSound; + + Point3F mCurrPosition; + Point3F mCurrVelocity; + /* + S32 mSourceObjectId; + S32 mSourceObjectSlot; + */ + + // Time related variables common to all projectiles, managed by processTick + + U32 mCurrTick; ///< Current time in ticks + /* + SimObjectPtr mSourceObject; ///< Actual pointer to the source object, times out after SourceIdTimeoutTicks + */ + + // Rendering related variables + TSShapeInstance* mProjectileShape; + /* + TSThread* mActivateThread; + TSThread* mMaintainThread; + + Point3F mLastRenderPos; + */ + + // ISceneLight + virtual void submitLights( LightManager *lm, bool staticLighting ); + virtual LightInfo* getLight() { return mLight; } + + LightInfo *mLight; + LightState mLightState; + + /* + bool mHidden; ///< set by the derived class, if true, projectile doesn't render + F32 mFadeValue; ///< set in processTick, interpolation between fadeDelay and lifetime + ///< in data block + */ + + /* + // Warping and back delta variables. Only valid on the client + // + Point3F mWarpStart; + Point3F mWarpEnd; + U32 mWarpTicksRemaining; + */ + + Point3F mCurrDeltaBase; + Point3F mCurrBackDelta; + + /* + Point3F mExplosionPosition; + Point3F mExplosionNormal; + U32 mCollideHitType; + */ + + bool onAdd(); + void onRemove(); + bool onNewDataBlock(GameBaseData *dptr, bool reload); + + // Rendering + virtual void prepRenderImage(SceneRenderState*); + void prepBatchRender( SceneRenderState *state); + + void processTick(const Move *move); + /* + void advanceTime(F32 dt); + */ + void interpolateTick(F32 delta); + + /* + /// What to do once this projectile collides with something + virtual void onCollision(const Point3F& p, const Point3F& n, SceneObject*); + + /// What to do when this projectile explodes + virtual void explode(const Point3F& p, const Point3F& n, const U32 collideType ); + + /// Returns the velocity of the projectile + Point3F getVelocity() const; + */ + + void emitParticles(const Point3F&, const Point3F&, const Point3F&, const U32); + void updateSound(); + + // Rendering + /* + void prepModelView ( SceneRenderState *state); + */ + + // These are stolen from the player class .. + bool pointInWater(const Point3F &point); + + U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); + void unpackUpdate(NetConnection *conn, BitStream *stream); + + afxChoreographer* choreographer; + + bool client_only; + bool server_only; + bool use_accel; + U32 collision_mask; + F32 prec_inc; + + bool did_launch; + bool did_impact; + + SceneObject* missile_target; + SceneObject* collide_exempt; + + bool hover_attack_go; + U32 hover_attack_tick; + + F32 starting_velocity; + Point3F starting_vel_vec; + + SimObject* ss_object; + S32 ss_index; + +private: + void init(bool on_server, bool on_client); + void create_splash(const Point3F& pos); + SceneObject* get_default_launcher() const; + void get_launch_constraint_data(Point3F& pos, Point3F& vel); + void get_launch_data(Point3F& pos, Point3F& vel); + bool is_active() const { return (did_launch && !did_impact); } + +public: + /* + F32 getUpdatePriority(CameraScopeQuery *focusObject, U32 updateMask, S32 updateSkips); + */ + /*C*/ afxMagicMissile(); + /*C*/ afxMagicMissile(bool on_server, bool on_client); + /*D*/ ~afxMagicMissile(); + virtual void onDeleteNotify(SimObject*); + + DECLARE_CONOBJECT(afxMagicMissile); + DECLARE_CATEGORY("AFX"); + + static void initPersistFields(); + + /* + virtual bool calculateImpact(float simTime, + Point3F& pointOfImpact, + float& impactTime); + + static U32 smProjectileWarpTicks; + +protected: + static const U32 csmStaticCollisionMask; + static const U32 csmDynamicCollisionMask; + static const U32 csmDamageableMask; + */ + + void launch(); + void setChoreographer(afxChoreographer*); + void setStartingVelocityVector(const Point3F& vel_vec); + void setStartingVelocity(const F32 vel); + void getStartingVelocityValues(F32& vel, Point3F& vel_vec); + void setSubstitutionData(SimObject* obj, S32 idx=0) { ss_object = obj; ss_index = idx; } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicMissileCallback + +class afxMagicMissileCallback +{ +public: + virtual void impactNotify(const Point3F& p, const Point3F& n, SceneObject*)=0; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_MAGIC_MISSILE_H_ + diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp new file mode 100644 index 000000000..7aeb93da8 --- /dev/null +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -0,0 +1,2709 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "T3D/gameBase/gameConnection.h" +#include "sfx/sfxSystem.h" +#include "math/mathIO.h" +#include "T3D/containerQuery.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxPhrase.h" +#include "afx/afxMagicSpell.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicSpellData::ewValidator +// +// When any of the effect list fields (addCastingEffect, etc.) are set, this validator +// intercepts the value and adds it to the appropriate effects list. One validator is +// created for each effect list and an id is used to identify which list to add the effect +// to. +// +void afxMagicSpellData::ewValidator::validateType(SimObject* object, void* typePtr) +{ + afxMagicSpellData* spelldata = dynamic_cast(object); + afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); + + if (spelldata && ew) + { + switch (id) + { + case CASTING_PHRASE: + spelldata->casting_fx_list.push_back(*ew); + break; + case LAUNCH_PHRASE: + spelldata->launch_fx_list.push_back(*ew); + break; + case DELIVERY_PHRASE: + spelldata->delivery_fx_list.push_back(*ew); + break; + case IMPACT_PHRASE: + spelldata->impact_fx_list.push_back(*ew); + break; + case LINGER_PHRASE: + spelldata->linger_fx_list.push_back(*ew); + break; + } + *ew = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class SpellFinishStartupEvent : public SimEvent +{ +public: + void process(SimObject* obj) + { + afxMagicSpell* spell = dynamic_cast(obj); + if (spell) + spell->finish_startup(); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicSpellData + +IMPLEMENT_CO_DATABLOCK_V1(afxMagicSpellData); + +ConsoleDocClass( afxMagicSpellData, + "@brief Defines the properties of an afxMagicSpell.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +IMPLEMENT_CALLBACK( afxMagicSpellData, onDamage, void, + (afxMagicSpell* spell, const char* label, const char* flaver, U32 target_id, F32 amount, U8 n, Point3F pos, F32 ad_amount, F32 radius, F32 impulse), + (spell, label, flaver, target_id, amount, n, pos, ad_amount, radius, impulse), + "Called when the spell deals damage.\n" + "@param spell the spell object\n" ); + +IMPLEMENT_CALLBACK( afxMagicSpellData, onDeactivate, void, (afxMagicSpell* spell), (spell), + "Called when the spell ends naturally.\n" + "@param spell the spell object\n" ); + +IMPLEMENT_CALLBACK( afxMagicSpellData, onInterrupt, void, (afxMagicSpell* spell, ShapeBase* caster), (spell, caster), + "Called when the spell ends unnaturally due to an interruption.\n" + "@param spell the spell object\n" ); + +IMPLEMENT_CALLBACK( afxMagicSpellData, onLaunch, void, + (afxMagicSpell* spell, ShapeBase* caster, SceneObject* target, afxMagicMissile* missile), + (spell, caster, target, missile), + "Called when the spell's casting stage ends and the delivery stage begins.\n" + "@param spell the spell object\n" ); + +IMPLEMENT_CALLBACK( afxMagicSpellData, onImpact, void, + (afxMagicSpell* spell, ShapeBase* caster, SceneObject* impacted, Point3F pos, Point3F normal), + (spell, caster, impacted, pos, normal), + "Called at the spell's missile impact marking the end of the deliver stage and the start of the linger stage.\n" + "@param spell the spell object\n" ); + +IMPLEMENT_CALLBACK( afxMagicSpellData, onPreactivate, bool, + (SimObject* param_holder, ShapeBase* caster, SceneObject* target, SimObject* extra), + (param_holder, caster, target, extra), + "Called during spell casting before spell instance is fully created.\n"); + +IMPLEMENT_CALLBACK( afxMagicSpellData, onActivate, void, + (afxMagicSpell* spell, ShapeBase* caster, SceneObject* target), + (spell, caster, target), + "Called when the spell starts.\n" + "@param spell the spell object\n" ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxMagicSpellData::afxMagicSpellData() +{ + casting_dur = 0.0f; + delivery_dur = 0.0f; + linger_dur = 0.0f; + + n_casting_loops = 1; + n_delivery_loops = 1; + n_linger_loops = 1; + + extra_casting_time = 0.0f; + extra_delivery_time = 0.0f; + extra_linger_time = 0.0f; + + // interrupt flags + do_move_interrupts = true; + move_interrupt_speed = 2.0f; + + // delivers projectile spells + missile_db = 0; + launch_on_server_signal = false; + primary_target_types = PlayerObjectType; + + // dummy entry holds effect-wrapper pointer while a special validator + // grabs it and adds it to an appropriate effects list + dummy_fx_entry = NULL; + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; +} + +afxMagicSpellData::afxMagicSpellData(const afxMagicSpellData& other, bool temp_clone) : afxChoreographerData(other, temp_clone) +{ + casting_dur = other.casting_dur; + delivery_dur = other.delivery_dur; + linger_dur = other.linger_dur; + n_casting_loops = other.n_casting_loops; + n_delivery_loops = other.n_delivery_loops; + n_linger_loops = other.n_linger_loops; + extra_casting_time = other.extra_casting_time; + extra_delivery_time = other.extra_delivery_time; + extra_linger_time = other.extra_linger_time; + do_move_interrupts = other.do_move_interrupts; + move_interrupt_speed = other.move_interrupt_speed; + missile_db = other.missile_db; + launch_on_server_signal = other.launch_on_server_signal; + primary_target_types = other.primary_target_types; + + dummy_fx_entry = other.dummy_fx_entry; + do_id_convert = other.do_id_convert; + + casting_fx_list = other.casting_fx_list; + launch_fx_list = other.launch_fx_list; + delivery_fx_list = other.delivery_fx_list; + impact_fx_list = other.impact_fx_list; + linger_fx_list = other.linger_fx_list; +} + +void afxMagicSpellData::reloadReset() +{ + casting_fx_list.clear(); + launch_fx_list.clear(); + delivery_fx_list.clear(); + impact_fx_list.clear(); + linger_fx_list.clear(); +} + +#define myOffset(field) Offset(field, afxMagicSpellData) + +void afxMagicSpellData::initPersistFields() +{ + static ewValidator _castingPhrase(CASTING_PHRASE); + static ewValidator _launchPhrase(LAUNCH_PHRASE); + static ewValidator _deliveryPhrase(DELIVERY_PHRASE); + static ewValidator _impactPhrase(IMPACT_PHRASE); + static ewValidator _lingerPhrase(LINGER_PHRASE); + + // for each effect list, dummy_fx_entry is set and then a validator adds it to the appropriate effects list + + addGroup("Casting Stage"); + addField("castingDur", TypeF32, myOffset(casting_dur), + "..."); + addField("numCastingLoops", TypeS32, myOffset(n_casting_loops), + "..."); + addField("extraCastingTime", TypeF32, myOffset(extra_casting_time), + "..."); + addFieldV("addCastingEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_castingPhrase, + "..."); + endGroup("Casting Stage"); + + addGroup("Delivery Stage"); + addField("deliveryDur", TypeF32, myOffset(delivery_dur), + "..."); + addField("numDeliveryLoops", TypeS32, myOffset(n_delivery_loops), + "..."); + addField("extraDeliveryTime", TypeF32, myOffset(extra_delivery_time), + "..."); + addFieldV("addLaunchEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_launchPhrase, + "..."); + addFieldV("addDeliveryEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_deliveryPhrase, + "..."); + endGroup("Delivery Stage"); + + addGroup("Linger Stage"); + addField("lingerDur", TypeF32, myOffset(linger_dur), + "..."); + addField("numLingerLoops", TypeS32, myOffset(n_linger_loops), + "..."); + addField("extraLingerTime", TypeF32, myOffset(extra_linger_time), + "..."); + addFieldV("addImpactEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_impactPhrase, + "..."); + addFieldV("addLingerEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_lingerPhrase, + "..."); + endGroup("Linger Stage"); + + // interrupt flags + addField("allowMovementInterrupts", TypeBool, myOffset(do_move_interrupts), + "..."); + addField("movementInterruptSpeed", TypeF32, myOffset(move_interrupt_speed), + "..."); + + // delivers projectile spells + addField("missile", TYPEID(), myOffset(missile_db), + "..."); + addField("launchOnServerSignal", TypeBool, myOffset(launch_on_server_signal), + "..."); + addField("primaryTargetTypes", TypeS32, myOffset(primary_target_types), + "..."); + + + Parent::initPersistFields(); + + // disallow some field substitutions + onlyKeepClearSubstitutions("missile"); // subs resolving to "~~", or "~0" are OK + disableFieldSubstitutions("addCastingEffect"); + disableFieldSubstitutions("addLaunchEffect"); + disableFieldSubstitutions("addDeliveryEffect"); + disableFieldSubstitutions("addImpactEffect"); + disableFieldSubstitutions("addLingerEffect"); +} + +bool afxMagicSpellData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + if (missile_db != NULL && delivery_dur == 0.0) + delivery_dur = -1; + + return true; +} + +void afxMagicSpellData::pack_fx(BitStream* stream, const afxEffectList& fx, bool packed) +{ + stream->writeInt(fx.size(), EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < fx.size(); i++) + writeDatablockID(stream, fx[i], packed); +} + +void afxMagicSpellData::unpack_fx(BitStream* stream, afxEffectList& fx) +{ + fx.clear(); + S32 n_fx = stream->readInt(EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < n_fx; i++) + fx.push_back((afxEffectWrapperData*)readDatablockID(stream)); +} + +void afxMagicSpellData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(casting_dur); + stream->write(delivery_dur); + stream->write(linger_dur); + // + stream->write(n_casting_loops); + stream->write(n_delivery_loops); + stream->write(n_linger_loops); + // + stream->write(extra_casting_time); + stream->write(extra_delivery_time); + stream->write(extra_linger_time); + + stream->writeFlag(do_move_interrupts); + stream->write(move_interrupt_speed); + + writeDatablockID(stream, missile_db, packed); + stream->write(launch_on_server_signal); + stream->write(primary_target_types); + + pack_fx(stream, casting_fx_list, packed); + pack_fx(stream, launch_fx_list, packed); + pack_fx(stream, delivery_fx_list, packed); + pack_fx(stream, impact_fx_list, packed); + pack_fx(stream, linger_fx_list, packed); +} + +void afxMagicSpellData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&casting_dur); + stream->read(&delivery_dur); + stream->read(&linger_dur); + // + stream->read(&n_casting_loops); + stream->read(&n_delivery_loops); + stream->read(&n_linger_loops); + // + stream->read(&extra_casting_time); + stream->read(&extra_delivery_time); + stream->read(&extra_linger_time); + + do_move_interrupts = stream->readFlag(); + stream->read(&move_interrupt_speed); + + missile_db = (afxMagicMissileData*) readDatablockID(stream); + stream->read(&launch_on_server_signal); + stream->read(&primary_target_types); + + do_id_convert = true; + unpack_fx(stream, casting_fx_list); + unpack_fx(stream, launch_fx_list); + unpack_fx(stream, delivery_fx_list); + unpack_fx(stream, impact_fx_list); + unpack_fx(stream, linger_fx_list); +} + +bool afxMagicSpellData::writeField(StringTableEntry fieldname, const char* value) +{ + if (!Parent::writeField(fieldname, value)) + return false; + + // don't write the dynamic array fields + if( fieldname == StringTable->insert("addCastingEffect") ) + return false; + if( fieldname == StringTable->insert("addLaunchEffect") ) + return false; + if( fieldname == StringTable->insert("addDeliveryEffect") ) + return false; + if( fieldname == StringTable->insert("addImpactEffect") ) + return false; + if( fieldname == StringTable->insert("addLingerEffect") ) + return false; + + return true; +} + +inline void expand_fx_list(afxEffectList& fx_list, const char* tag) +{ + for (S32 i = 0; i < fx_list.size(); i++) + { + SimObjectId db_id = SimObjectId((uintptr_t)fx_list[i]); + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, fx_list[i])) + { + Con::errorf(ConsoleLogEntry::General, + "afxMagicSpellData::preload() -- bad datablockId: 0x%x (%s)", + db_id, tag); + } + } + } +} + +bool afxMagicSpellData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + SimObjectId missile_id = SimObjectId((uintptr_t)missile_db); + if (missile_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(missile_id, missile_db)) + { + Con::errorf(ConsoleLogEntry::General, + "afxMagicSpellData::preload() -- bad datablockId: 0x%x (missile)", + missile_id); + } + } + expand_fx_list(casting_fx_list, "casting"); + expand_fx_list(launch_fx_list, "launch"); + expand_fx_list(delivery_fx_list, "delivery"); + expand_fx_list(impact_fx_list, "impact"); + expand_fx_list(linger_fx_list, "linger"); + do_id_convert = false; + } + } + + return true; +} + +void afxMagicSpellData::gatherConstraintDefs(Vector& defs) +{ + afxConstraintDef::gather_cons_defs(defs, casting_fx_list); + afxConstraintDef::gather_cons_defs(defs, launch_fx_list); + afxConstraintDef::gather_cons_defs(defs, delivery_fx_list); + afxConstraintDef::gather_cons_defs(defs, impact_fx_list); + afxConstraintDef::gather_cons_defs(defs, linger_fx_list); + + if (missile_db) + missile_db->gather_cons_defs(defs); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxMagicSpellData, reset, void, (),, + "Resets a spell datablock during reload.\n\n" + "@ingroup AFX") +{ + object->reloadReset(); +} + +DefineEngineMethod(afxMagicSpellData, addCastingEffect, void, (afxEffectBaseData* effect),, + "Adds an effect (wrapper or group) to a spell's casting phase.\n\n" + "@ingroup AFX") +{ + if (!effect) + { + Con::errorf(ConsoleLogEntry::General, + "afxMagicSpellData::addCastingEffect() -- " + "missing afxEffectWrapperData."); + return; + } + + object->casting_fx_list.push_back(effect); +} + +DefineEngineMethod(afxMagicSpellData, addLaunchEffect, void, (afxEffectBaseData* effect),, + "Adds an effect (wrapper or group) to a spell's launch phase.\n\n" + "@ingroup AFX") + +{ + if (!effect) + { + Con::errorf(ConsoleLogEntry::General, + "afxMagicSpellData::addLaunchEffect() -- " + "failed to find afxEffectWrapperData."); + return; + } + + object->launch_fx_list.push_back(effect); +} + +DefineEngineMethod(afxMagicSpellData, addDeliveryEffect, void, (afxEffectBaseData* effect),, + "Adds an effect (wrapper or group) to a spell's delivery phase.\n\n" + "@ingroup AFX") + +{ + if (!effect) + { + Con::errorf(ConsoleLogEntry::General, + "afxMagicSpellData::addDeliveryEffect() -- " + "missing afxEffectWrapperData."); + return; + } + + object->delivery_fx_list.push_back(effect); +} + +DefineEngineMethod(afxMagicSpellData, addImpactEffect, void, (afxEffectBaseData* effect),, + "Adds an effect (wrapper or group) to a spell's impact phase.\n\n" + "@ingroup AFX") + +{ + if (!effect) + { + Con::errorf(ConsoleLogEntry::General, + "afxMagicSpellData::addImpactEffect() -- " + "missing afxEffectWrapperData."); + return; + } + + object->impact_fx_list.push_back(effect); +} + +DefineEngineMethod(afxMagicSpellData, addLingerEffect, void, (afxEffectBaseData* effect),, + "Adds an effect (wrapper or group) to a spell's linger phase.\n\n" + "@ingroup AFX") + +{ + if (!effect) + { + Con::errorf(ConsoleLogEntry::General, + "afxMagicSpellData::addLingerEffect() -- " + "missing afxEffectWrapperData."); + return; + } + + object->linger_fx_list.push_back(effect); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicSpell + +IMPLEMENT_GLOBAL_CALLBACK( onCastingStart, void, (), (), + "A callout called on clients by spells when the casting stage begins.\n" + "@ingroup AFX\n" ); + +IMPLEMENT_GLOBAL_CALLBACK( onCastingProgressUpdate, void, (F32 frac), (frac), + "A callout called periodically on clients by spells to indicate casting progress.\n" + "@ingroup AFX\n" ); + +IMPLEMENT_GLOBAL_CALLBACK( onCastingEnd, void, (), (), + "A callout called on clients by spells when the casting stage ends.\n" + "@ingroup AFX\n" ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// CastingPhrase_C +// Subclass of afxPhrase for the client casting phrase. +// This subclass adds handling of the casting progress +// bar in cases where the caster is the client's control +// object. +// + +class CastingPhrase_C : public afxPhrase +{ + typedef afxPhrase Parent; + ShapeBase* caster; + bool notify_castbar; + F32 castbar_progress; +public: + /*C*/ CastingPhrase_C(ShapeBase* caster, bool notify_castbar); + virtual void start(F32 startstamp, F32 timestamp); + virtual void update(F32 dt, F32 timestamp); + virtual void stop(F32 timestamp); + virtual void interrupt(F32 timestamp); +}; + +CastingPhrase_C::CastingPhrase_C(ShapeBase* c, bool notify) + : afxPhrase(false, true) +{ + caster = c; + notify_castbar = notify; + castbar_progress = 0.0f; +} + +void CastingPhrase_C::start(F32 startstamp, F32 timestamp) +{ + Parent::start(startstamp, timestamp); //START + if (notify_castbar) + { + castbar_progress = 0.0f; + onCastingStart_callback(); + } +} + +void CastingPhrase_C::update(F32 dt, F32 timestamp) +{ + Parent::update(dt, timestamp); + + if (!notify_castbar) + return; + + if (dur > 0 && n_loops > 0) + { + F32 nfrac = (timestamp - starttime)/(dur*n_loops); + if (nfrac - castbar_progress > 1.0f/200.0f) + { + castbar_progress = (nfrac < 1.0f) ? nfrac : 1.0f; + onCastingProgressUpdate_callback(castbar_progress); + } + } +} + +void CastingPhrase_C::stop(F32 timestamp) +{ + Parent::stop(timestamp); + if (notify_castbar) + { + onCastingEnd_callback(); + notify_castbar = false; + } +} + +void CastingPhrase_C::interrupt(F32 timestamp) +{ + Parent::interrupt(timestamp); + if (notify_castbar) + { + onCastingEnd_callback(); + notify_castbar = false; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// some enum to name converters for debugging purposes + +#ifdef USE_FOR_DEBUG_MESSAGES +static char* name_from_state(U8 s) +{ + switch (s) + { + case afxMagicSpell::INACTIVE_STATE: + return "inactive"; + case afxMagicSpell::CASTING_STATE: + return "casting"; + case afxMagicSpell::DELIVERY_STATE: + return "delivery"; + case afxMagicSpell::LINGER_STATE: + return "linger"; + case afxMagicSpell::CLEANUP_STATE: + return "cleanup"; + case afxMagicSpell::DONE_STATE: + return "done"; + } + + return "unknown"; +} + +static char* name_from_event(U8 e) +{ + switch (e) + { + case afxMagicSpell::NULL_EVENT: + return "null"; + case afxMagicSpell::ACTIVATE_EVENT: + return "activate"; + case afxMagicSpell::LAUNCH_EVENT: + return "launch"; + case afxMagicSpell::IMPACT_EVENT: + return "impact"; + case afxMagicSpell::SHUTDOWN_EVENT: + return "shutdown"; + case afxMagicSpell::DEACTIVATE_EVENT: + return "deactivate"; + case afxMagicSpell::INTERRUPT_PHASE_EVENT: + return "interrupt_phase"; + case afxMagicSpell::INTERRUPT_SPELL_EVENT: + return "interrupt_spell"; + } + + return "unknown"; +} +#endif + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicSpell + +IMPLEMENT_CO_NETOBJECT_V1(afxMagicSpell); + +ConsoleDocClass( afxMagicSpell, + "@brief A magic spell effects choreographer.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" +); + +// static +StringTableEntry afxMagicSpell::CASTER_CONS; +StringTableEntry afxMagicSpell::TARGET_CONS; +StringTableEntry afxMagicSpell::MISSILE_CONS; +StringTableEntry afxMagicSpell::CAMERA_CONS; +StringTableEntry afxMagicSpell::LISTENER_CONS; +StringTableEntry afxMagicSpell::IMPACT_POINT_CONS; +StringTableEntry afxMagicSpell::IMPACTED_OBJECT_CONS; + +void afxMagicSpell::init() +{ + // setup static predefined constraint names + if (CASTER_CONS == 0) + { + CASTER_CONS = StringTable->insert("caster"); + TARGET_CONS = StringTable->insert("target"); + MISSILE_CONS = StringTable->insert("missile"); + CAMERA_CONS = StringTable->insert("camera"); + LISTENER_CONS = StringTable->insert("listener"); + IMPACT_POINT_CONS = StringTable->insert("impactPoint"); + IMPACTED_OBJECT_CONS = StringTable->insert("impactedObject"); + } + + // afxMagicSpell is always in scope, however effects + // do their own scoping in that they will shut off if + // their position constraint leaves scope. + // + // note -- ghosting is delayed until constraint + // initialization is done. + // + //mNetFlags.set(Ghostable | ScopeAlways); + mNetFlags.clear(Ghostable | ScopeAlways); + + datablock = NULL; + exeblock = NULL; + missile_db = NULL; + + caster = NULL; + target = NULL; + + caster_field = NULL; + target_field = NULL; + + caster_scope_id = 0; + target_scope_id = 0; + target_is_shape = false; + + constraints_initialized = false; + scoping_initialized = false; + + spell_state = (U8) INACTIVE_STATE; + spell_elapsed = 0; + + // define named constraints + constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, CASTER_CONS); + constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, TARGET_CONS); + constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, MISSILE_CONS); + constraint_mgr->defineConstraint(CAMERA_CONSTRAINT, CAMERA_CONS); + constraint_mgr->defineConstraint(POINT_CONSTRAINT, LISTENER_CONS); + constraint_mgr->defineConstraint(POINT_CONSTRAINT, IMPACT_POINT_CONS); + constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, IMPACTED_OBJECT_CONS); + + for (S32 i = 0; i < NUM_PHRASES; i++) + { + phrases[i] = NULL; + tfactors[i] = 1.0f; + } + + notify_castbar = false; + overall_time_factor = 1.0f; + + camera_cons_obj = 0; + + marks_mask = 0; + + missile = NULL; + missile_is_armed = false; + impacted_obj = NULL; + impact_pos.zero(); + impact_norm.set(0,0,1); + impacted_scope_id = 0; + impacted_is_shape = false; +} + +afxMagicSpell::afxMagicSpell() +{ + started_with_newop = true; + init(); +} + +afxMagicSpell::afxMagicSpell(ShapeBase* caster, SceneObject* target) +{ + started_with_newop = false; + init(); + + this->caster = caster; + if (caster) + { + caster_field = caster; + deleteNotify(caster); + processAfter(caster); + } + + this->target = target; + if (target) + { + target_field = target; + deleteNotify(target); + } +} + +afxMagicSpell::~afxMagicSpell() +{ + for (S32 i = 0; i < NUM_PHRASES; i++) + { + if (phrases[i]) + { + phrases[i]->interrupt(spell_elapsed); + delete phrases[i]; + } + } + + if (missile) + missile->deleteObject(); + + if (missile_db && missile_db->isTempClone()) + { + delete missile_db; + missile_db = 0; + } + + if (datablock && datablock->isTempClone()) + { + delete datablock; + datablock = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// STANDARD OVERLOADED METHODS // + +bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + datablock = dynamic_cast(dptr); + if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + if (isServerObject() && started_with_newop) + { + // copy dynamic fields from the datablock but + // don't replace fields with a value + assignDynamicFieldsFrom(dptr, arcaneFX::sParameterFieldPrefix, true); + } + + exeblock = datablock; + missile_db = datablock->missile_db; + + if (isClientObject()) + { + // make a temp datablock clone if there are substitutions + if (datablock->getSubstitutionCount() > 0) + { + afxMagicSpellData* orig_db = datablock; + datablock = new afxMagicSpellData(*orig_db, true); + exeblock = orig_db; + missile_db = datablock->missile_db; + // Don't perform substitutions yet, the spell's dynamic fields haven't + // arrived yet and the substitutions may refer to them. Hold off and do + // in in the onAdd() method. + } + } + else if (started_with_newop) + { + // make a temp datablock clone if there are substitutions + if (datablock->getSubstitutionCount() > 0) + { + afxMagicSpellData* orig_db = datablock; + datablock = new afxMagicSpellData(*orig_db, true); + exeblock = orig_db; + orig_db->performSubstitutions(datablock, this, ranking); + missile_db = datablock->missile_db; + } + } + + return true; +} + +void afxMagicSpell::processTick(const Move* m) +{ + Parent::processTick(m); + + // don't process moves or client ticks + if (m != 0 || isClientObject()) + return; + + process_server(); +} + +void afxMagicSpell::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + process_client(dt); +} + +bool afxMagicSpell::onAdd() +{ + if (!Parent::onAdd()) + return false ; + + if (isClientObject()) + { + if (datablock->isTempClone()) + { + afxMagicSpellData* orig_db = (afxMagicSpellData*)exeblock; + orig_db->performSubstitutions(datablock, this, ranking); + missile_db = datablock->missile_db; + notify_castbar = (notify_castbar && (datablock->casting_dur > 0.0f)); + } + } + else if (started_with_newop && !postpone_activation) + { + if (!activationCallInit()) + return false; + activate(); + } + + return true ; +} + +void afxMagicSpell::onRemove() +{ + Parent::onRemove(); +} + +void afxMagicSpell::onDeleteNotify(SimObject* obj) +{ + // caster deleted? + ShapeBase* shape = dynamic_cast(obj); + if (shape == caster) + { + clearProcessAfter(); + caster = NULL; + caster_field = NULL; + caster_scope_id = 0; + } + + // target deleted? + SceneObject* scene_obj = dynamic_cast(obj); + if (scene_obj == target) + { + target = NULL; + target_field = NULL; + target_scope_id = 0; + target_is_shape = false; + } + + // impacted_obj deleted? + if (scene_obj == impacted_obj) + { + impacted_obj = NULL; + impacted_scope_id = 0; + impacted_is_shape = false; + } + + // missile deleted? + afxMagicMissile* missile = dynamic_cast(obj); + if (missile != NULL && missile == this->missile) + { + this->missile = NULL; + } + + // something else + Parent::onDeleteNotify(obj); +} + +// static +void afxMagicSpell::initPersistFields() +{ + addField("caster", TYPEID(), Offset(caster_field, afxMagicSpell), + "..."); + addField("target", TYPEID(), Offset(target_field, afxMagicSpell), + "..."); + + Parent::initPersistFields(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxMagicSpell::pack_constraint_info(NetConnection* conn, BitStream* stream) +{ + // pack caster's ghost index or scope id if not yet ghosted + if (stream->writeFlag(caster != NULL)) + { + S32 ghost_idx = conn->getGhostIndex(caster); + if (stream->writeFlag(ghost_idx != -1)) + stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); + else + { + bool bit = (caster) ? (caster->getScopeId() > 0) : false; + if (stream->writeFlag(bit)) + stream->writeInt(caster->getScopeId(), NetObject::SCOPE_ID_BITS); + } + } + + // pack target's ghost index or scope id if not yet ghosted + if (stream->writeFlag(target != NULL)) + { + S32 ghost_idx = conn->getGhostIndex(target); + if (stream->writeFlag(ghost_idx != -1)) + stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); + else + { + if (stream->writeFlag(target->getScopeId() > 0)) + { + stream->writeInt(target->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(target) != NULL); // is shape? + } + } + } + + Parent::pack_constraint_info(conn, stream); +} + +void afxMagicSpell::unpack_constraint_info(NetConnection* conn, BitStream* stream) +{ + caster = NULL; + caster_field = NULL; + caster_scope_id = 0; + if (stream->readFlag()) // has caster + { + if (stream->readFlag()) // has ghost_idx + { + S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); + caster = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (caster) + { + caster_field = caster; + deleteNotify(caster); + processAfter(caster); + } + } + else + { + if (stream->readFlag()) // has scope_id (is always a shape) + caster_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + } + } + + target = NULL; + target_field = NULL; + target_scope_id = 0; + target_is_shape = false; + if (stream->readFlag()) // has target + { + if (stream->readFlag()) // has ghost_idx + { + S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); + target = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (target) + { + target_field = target; + deleteNotify(target); + } + } + else + { + if (stream->readFlag()) // has scope_id + { + target_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + target_is_shape = stream->readFlag(); // is shape? + } + } + } + + Parent::unpack_constraint_info(conn, stream); +} + +U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) +{ + S32 mark_stream_pos = stream->getCurPos(); + + U32 retMask = Parent::packUpdate(conn, mask, stream); + + // InitialUpdate + if (stream->writeFlag(mask & InitialUpdateMask)) + { + // pack extra object's ghost index or scope id if not yet ghosted + if (stream->writeFlag(dynamic_cast(extra) != 0)) + { + NetObject* net_extra = (NetObject*)extra; + S32 ghost_idx = conn->getGhostIndex(net_extra); + if (stream->writeFlag(ghost_idx != -1)) + stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); + else + { + if (stream->writeFlag(net_extra->getScopeId() > 0)) + { + stream->writeInt(net_extra->getScopeId(), NetObject::SCOPE_ID_BITS); + } + } + } + + // pack initial exec conditions + stream->write(exec_conds_mask); + + // flag if this client owns the spellcaster + bool client_owns_caster = is_caster_client(caster, dynamic_cast(conn)); + stream->writeFlag(client_owns_caster); + + // pack per-phrase time-factor values + for (S32 i = 0; i < NUM_PHRASES; i++) + stream->write(tfactors[i]); + + // flag if this conn is zoned-in yet + bool zoned_in = client_owns_caster; + if (!zoned_in) + { + GameConnection* gconn = dynamic_cast(conn); + zoned_in = (gconn) ? gconn->isZonedIn() : false; + } + if (stream->writeFlag(zoned_in)) + pack_constraint_info(conn, stream); + } + + // StateEvent or SyncEvent + if (stream->writeFlag((mask & StateEventMask) || (mask & SyncEventMask))) + { + stream->write(marks_mask); + stream->write(spell_state); + stream->write(state_elapsed()); + stream->write(spell_elapsed); + } + + // SyncEvent + if (stream->writeFlag((mask & SyncEventMask) && !(mask & InitialUpdateMask))) + { + pack_constraint_info(conn, stream); + } + + // LaunchEvent + if (stream->writeFlag((mask & LaunchEventMask) && (marks_mask & MARK_LAUNCH) && missile)) + { + F32 vel; Point3F vel_vec; + missile->getStartingVelocityValues(vel, vel_vec); + // pack launch vector and velocity + stream->write(vel); + mathWrite(*stream, vel_vec); + } + + // ImpactEvent + if (stream->writeFlag(((mask & ImpactEventMask) || (mask & SyncEventMask)) && (marks_mask & MARK_IMPACT))) + { + // pack impact objects's ghost index or scope id if not yet ghosted + if (stream->writeFlag(impacted_obj != NULL)) + { + S32 ghost_idx = conn->getGhostIndex(impacted_obj); + if (stream->writeFlag(ghost_idx != -1)) + stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); + else + { + if (stream->writeFlag(impacted_obj->getScopeId() > 0)) + { + stream->writeInt(impacted_obj->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(impacted_obj) != NULL); + } + } + } + + // pack impact position and normal + mathWrite(*stream, impact_pos); + mathWrite(*stream, impact_norm); + stream->write(exec_conds_mask); + + ShapeBase* temp_shape; + stream->writeFlag(caster != 0 && caster->getDamageState() == ShapeBase::Enabled); + temp_shape = dynamic_cast(target); + stream->writeFlag(temp_shape != 0 && temp_shape->getDamageState() == ShapeBase::Enabled); + temp_shape = dynamic_cast(impacted_obj); + stream->writeFlag(temp_shape != 0 && temp_shape->getDamageState() == ShapeBase::Enabled); + } + + check_packet_usage(conn, stream, mark_stream_pos, "afxMagicSpell:"); + + AssertISV(stream->isValid(), "afxMagicSpell::packUpdate(): write failure occurred, possibly caused by packet-size overrun."); + + return retMask; +} + +//~~~~~~~~~~~~~~~~~~~~// + + // CONSTRAINT REMAPPING << +bool afxMagicSpell::remap_builtin_constraint(SceneObject* obj, const char* cons_name) +{ + StringTableEntry cons_name_ste = StringTable->insert(cons_name); + + if (cons_name_ste == CASTER_CONS) + return true; + if (cons_name_ste == TARGET_CONS) + { + if (obj && target && obj != target && !target_cons_id.undefined()) + { + target = obj; + constraint_mgr->setReferenceObject(target_cons_id, target); + if (isServerObject()) + { + if (target->isScopeable()) + constraint_mgr->addScopeableObject(target); + } + } + return true; + } + if (cons_name_ste == MISSILE_CONS) + return true; + if (cons_name_ste == CAMERA_CONS) + return true; + if (cons_name_ste == LISTENER_CONS) + return true; + if (cons_name_ste == IMPACT_POINT_CONS) + return true; + if (cons_name_ste == IMPACTED_OBJECT_CONS) + return true; + + return false; +} + // CONSTRAINT REMAPPING >> + +void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) +{ + Parent::unpackUpdate(conn, stream); + + bool initial_update = false; + bool zoned_in = true; + bool do_sync_event = false; + U16 new_marks_mask = 0; + U8 new_spell_state = INACTIVE_STATE; + F32 new_state_elapsed = 0; + F32 new_spell_elapsed = 0;; + + // InitialUpdate + if (stream->readFlag()) + { + initial_update = true; + + // extra sent + if (stream->readFlag()) + { + // cleanup? + if (stream->readFlag()) // is ghost_idx + { + S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); + extra = dynamic_cast(conn->resolveGhost(ghost_idx)); + } + else + { + if (stream->readFlag()) // has scope_id + { + // JTF NOTE: U16 extra_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + stream->readInt(NetObject::SCOPE_ID_BITS); + } + } + } + + // unpack initial exec conditions + stream->read(&exec_conds_mask); + + // if this is controlling client for the caster, + // enable castbar updates + bool client_owns_caster = stream->readFlag(); + if (client_owns_caster) + notify_castbar = Con::isFunction("onCastingStart"); + + // unpack per-phrase time-factor values + for (S32 i = 0; i < NUM_PHRASES; i++) + stream->read(&tfactors[i]); + + // if client is marked as fully zoned in + if ((zoned_in = stream->readFlag()) == true) + { + unpack_constraint_info(conn, stream); + init_constraints(); + } + } + + // StateEvent or SyncEvent + // this state data is sent for both state-events and + // sync-events + if (stream->readFlag()) + { + stream->read(&new_marks_mask); + stream->read(&new_spell_state); + stream->read(&new_state_elapsed); + stream->read(&new_spell_elapsed); + marks_mask = new_marks_mask; + } + + // SyncEvent + if ((do_sync_event = stream->readFlag()) == true) + { + unpack_constraint_info(conn, stream); + init_constraints(); + } + + // LaunchEvent + if (stream->readFlag()) + { + F32 vel; Point3F vel_vec; + stream->read(&vel); + mathRead(*stream, &vel_vec); + if (missile) + { + missile->setStartingVelocity(vel); + missile->setStartingVelocityVector(vel_vec); + } + } + + // ImpactEvent + if (stream->readFlag()) + { + if (impacted_obj) + clearNotify(impacted_obj); + impacted_obj = NULL; + impacted_scope_id = 0; + impacted_is_shape = false; + if (stream->readFlag()) // is impacted_obj + { + if (stream->readFlag()) // is ghost_idx + { + S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); + impacted_obj = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (impacted_obj) + deleteNotify(impacted_obj); + } + else + { + if (stream->readFlag()) // has scope_id + { + impacted_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + impacted_is_shape = stream->readFlag(); // is shape? + } + } + } + + mathRead(*stream, &impact_pos); + mathRead(*stream, &impact_norm); + stream->read(&exec_conds_mask); + + bool caster_alive = stream->readFlag(); + bool target_alive = stream->readFlag(); + bool impacted_alive = stream->readFlag(); + + afxConstraint* cons; + if ((cons = constraint_mgr->getConstraint(caster_cons_id)) != 0) + cons->setLivingState(caster_alive); + if ((cons = constraint_mgr->getConstraint(target_cons_id)) != 0) + cons->setLivingState(target_alive); + if ((cons = constraint_mgr->getConstraint(impacted_cons_id)) != 0) + cons->setLivingState(impacted_alive); + } + + //~~~~~~~~~~~~~~~~~~~~// + + if (!zoned_in) + spell_state = LATE_STATE; + + // need to adjust state info to get all synced up with spell on server + if (do_sync_event && !initial_update) + sync_client(new_marks_mask, new_spell_state, new_state_elapsed, new_spell_elapsed); +} + +void afxMagicSpell::sync_with_clients() +{ + setMaskBits(SyncEventMask); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +bool afxMagicSpell::state_expired() +{ + afxPhrase* phrase = NULL; + + switch (spell_state) + { + case CASTING_STATE: + phrase = phrases[CASTING_PHRASE]; + break; + case DELIVERY_STATE: + phrase = phrases[DELIVERY_PHRASE]; + break; + case LINGER_STATE: + phrase = phrases[LINGER_PHRASE]; + break; + } + + if (phrase) + { + if (phrase->expired(spell_elapsed)) + return (!phrase->recycle(spell_elapsed)); + return false; + } + + return true; +} + +F32 afxMagicSpell::state_elapsed() +{ + afxPhrase* phrase = NULL; + + switch (spell_state) + { + case CASTING_STATE: + phrase = phrases[CASTING_PHRASE]; + break; + case DELIVERY_STATE: + phrase = phrases[DELIVERY_PHRASE]; + break; + case LINGER_STATE: + phrase = phrases[LINGER_PHRASE]; + break; + } + + return (phrase) ? phrase->elapsed(spell_elapsed) : 0.0f; +} + +void afxMagicSpell::init_constraints() +{ + if (constraints_initialized) + { + //Con::printf("CONSTRAINTS ALREADY INITIALIZED"); + return; + } + + Vector defs; + datablock->gatherConstraintDefs(defs); + + constraint_mgr->initConstraintDefs(defs, isServerObject()); + + if (isServerObject()) + { + caster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, caster); + target_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, target); +#if defined(AFX_CAP_SCOPE_TRACKING) + if (caster && caster->isScopeable()) + constraint_mgr->addScopeableObject(caster); + + if (target && target->isScopeable()) + constraint_mgr->addScopeableObject(target); +#endif + + // find local camera + camera_cons_obj = get_camera(); + if (camera_cons_obj) + camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + } + else // if (isClientObject()) + { + if (caster) + caster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, caster); + else if (caster_scope_id > 0) + caster_cons_id = constraint_mgr->setReferenceObjectByScopeId(CASTER_CONS, caster_scope_id, true); + + if (target) + target_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, target); + else if (target_scope_id > 0) + target_cons_id = constraint_mgr->setReferenceObjectByScopeId(TARGET_CONS, target_scope_id, target_is_shape); + + // find local camera + camera_cons_obj = get_camera(); + if (camera_cons_obj) + camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + + // find local listener + Point3F listener_pos; + listener_pos = SFX->getListener().getTransform().getPosition(); + listener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos); + } + + constraint_mgr->adjustProcessOrdering(this); + + constraints_initialized = true; +} + +void afxMagicSpell::init_scoping() +{ + if (scoping_initialized) + { + //Con::printf("SCOPING ALREADY INITIALIZED"); + return; + } + + if (isServerObject()) + { + if (explicit_clients.size() > 0) + { + for (U32 i = 0; i < explicit_clients.size(); i++) + explicit_clients[i]->objectLocalScopeAlways(this); + } + else + { + mNetFlags.set(Ghostable); + setScopeAlways(); + } + scoping_initialized = true; + } +} + +void afxMagicSpell::setup_casting_fx() +{ + if (isServerObject()) + phrases[CASTING_PHRASE] = new afxPhrase(isServerObject(), true); + else + phrases[CASTING_PHRASE] = new CastingPhrase_C(caster, notify_castbar); + + if (phrases[CASTING_PHRASE]) + phrases[CASTING_PHRASE]->init(datablock->casting_fx_list, datablock->casting_dur, this, + tfactors[CASTING_PHRASE], datablock->n_casting_loops, 0, + datablock->extra_casting_time); +} + +void afxMagicSpell::setup_launch_fx() +{ + phrases[LAUNCH_PHRASE] = new afxPhrase(isServerObject(), false); + if (phrases[LAUNCH_PHRASE]) + phrases[LAUNCH_PHRASE]->init(datablock->launch_fx_list, -1, this, + tfactors[LAUNCH_PHRASE], 1); +} + +void afxMagicSpell::setup_delivery_fx() +{ + phrases[DELIVERY_PHRASE] = new afxPhrase(isServerObject(), true); + if (phrases[DELIVERY_PHRASE]) + { + phrases[DELIVERY_PHRASE]->init(datablock->delivery_fx_list, datablock->delivery_dur, this, + tfactors[DELIVERY_PHRASE], datablock->n_delivery_loops, 0, + datablock->extra_delivery_time); + } +} + +void afxMagicSpell::setup_impact_fx() +{ + phrases[IMPACT_PHRASE] = new afxPhrase(isServerObject(), false); + if (phrases[IMPACT_PHRASE]) + { + phrases[IMPACT_PHRASE]->init(datablock->impact_fx_list, -1, this, + tfactors[IMPACT_PHRASE], 1); + } +} + +void afxMagicSpell::setup_linger_fx() +{ + phrases[LINGER_PHRASE] = new afxPhrase(isServerObject(), true); + if (phrases[LINGER_PHRASE]) + phrases[LINGER_PHRASE]->init(datablock->linger_fx_list, datablock->linger_dur, this, + tfactors[LINGER_PHRASE], datablock->n_linger_loops, 0, + datablock->extra_linger_time); +} + +bool afxMagicSpell::cleanup_over() +{ + for (S32 i = 0; i < NUM_PHRASES; i++) + if (phrases[i] && !phrases[i]->isEmpty()) + return false; + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private +// +// MISSILE STUFF +// + +void afxMagicSpell::init_missile_s(afxMagicMissileData* mm_db) +{ + if (missile) + clearNotify(missile); + + // create the missile + missile = new afxMagicMissile(true, false); + missile->setSubstitutionData(this, ranking); + missile->setDataBlock(mm_db); + missile->setChoreographer(this); + if (!missile->registerObject()) + { + Con::errorf("afxMagicSpell: failed to register missile instance."); + delete missile; + missile = NULL; + } + + if (missile) + { + deleteNotify(missile); + registerForCleanup(missile); + } +} + +void afxMagicSpell::launch_missile_s() +{ + if (missile) + { + missile->launch(); + constraint_mgr->setReferenceObject(MISSILE_CONS, missile); + } +} + +void afxMagicSpell::init_missile_c(afxMagicMissileData* mm_db) +{ + if (missile) + clearNotify(missile); + + // create the missile + missile = new afxMagicMissile(false, true); + missile->setSubstitutionData(this, ranking); + missile->setDataBlock(mm_db); + missile->setChoreographer(this); + if (!missile->registerObject()) + { + Con::errorf("afxMagicSpell: failed to register missile instance."); + delete missile; + missile = NULL; + } + + if (missile) + { + deleteNotify(missile); + registerForCleanup(missile); + } +} + +void afxMagicSpell::launch_missile_c() +{ + if (missile) + { + missile->launch(); + constraint_mgr->setReferenceObject(MISSILE_CONS, missile); + } +} + +bool afxMagicSpell::is_impact_in_water(SceneObject* obj, const Point3F& p) +{ + // AFX_T3D_BROKEN -- water impact detection is disabled. Look at projectile. + return false; +} + +void afxMagicSpell::impactNotify(const Point3F& p, const Point3F& n, SceneObject* obj) +{ + if (isClientObject()) + return; + + ///impact_time_ms = spell_elapsed_ms; + if (impacted_obj) + clearNotify(impacted_obj); + impacted_obj = obj; + impact_pos = p; + impact_norm = n; + + if (impacted_obj != NULL) + { + deleteNotify(impacted_obj); + exec_conds_mask |= IMPACTED_SOMETHING; + if (impacted_obj == target) + exec_conds_mask |= IMPACTED_TARGET; + if (impacted_obj->getTypeMask() & datablock->primary_target_types) + exec_conds_mask |= IMPACTED_PRIMARY; + } + + if (is_impact_in_water(obj, p)) + exec_conds_mask |= IMPACT_IN_WATER; + + postSpellEvent(IMPACT_EVENT); + + if (missile) + clearNotify(missile); + missile = NULL; +} + +void afxMagicSpell::executeScriptEvent(const char* method, afxConstraint* cons, + const MatrixF& xfm, const char* data) +{ + SceneObject* cons_obj = (cons) ? cons->getSceneObject() : NULL; + + char *arg_buf = Con::getArgBuffer(256); + Point3F pos; + xfm.getColumn(3,&pos); + AngAxisF aa(xfm); + dSprintf(arg_buf,256,"%g %g %g %g %g %g %g", + pos.x, pos.y, pos.z, + aa.axis.x, aa.axis.y, aa.axis.z, aa.angle); + + // CALL SCRIPT afxChoreographerData::method(%spell, %caster, %constraint, %transform, %data) + Con::executef(exeblock, method, + getIdString(), + (caster) ? caster->getIdString() : "", + (cons_obj) ? cons_obj->getIdString() : "", + arg_buf, + data); +} + +void afxMagicSpell::inflictDamage(const char * label, const char* flavor, SimObjectId target_id, + F32 amount, U8 n, F32 ad_amount, F32 radius, Point3F pos, F32 impulse) +{ + // Con::printf("INFLICT-DAMAGE label=%s flav=%s id=%d amt=%g n=%d rad=%g pos=(%g %g %g) imp=%g", + // label, flavor, target_id, amount, n, radius, pos.x, pos.y, pos.z, impulse); + + // CALL SCRIPT afxMagicSpellData::onDamage() + // onDamage(%spell, %label, %type, %damaged_obj, %amount, %count, %pos, %ad_amount, + // %radius, %impulse) + datablock->onDamage_callback(this, label, flavor, target_id, amount, n, pos, ad_amount, radius, impulse); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +void afxMagicSpell::process_server() +{ + if (spell_state != INACTIVE_STATE) + spell_elapsed += TickSec; + + U8 pending_state = spell_state; + + // check for state changes + switch (spell_state) + { + + case INACTIVE_STATE: + if (marks_mask & MARK_ACTIVATE) + pending_state = CASTING_STATE; + break; + + case CASTING_STATE: + if (datablock->casting_dur > 0.0f && datablock->do_move_interrupts && is_caster_moving()) + { + displayScreenMessage(caster, "SPELL INTERRUPTED."); + postSpellEvent(INTERRUPT_SPELL_EVENT); + } + if (marks_mask & MARK_INTERRUPT_CASTING) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_END_CASTING) + pending_state = DELIVERY_STATE; + else if (marks_mask & MARK_LAUNCH) + pending_state = DELIVERY_STATE; + else if (state_expired()) + pending_state = DELIVERY_STATE; + break; + + case DELIVERY_STATE: + if (marks_mask & MARK_INTERRUPT_DELIVERY) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_END_DELIVERY) + pending_state = LINGER_STATE; + else if (marks_mask & MARK_IMPACT) + pending_state = LINGER_STATE; + else if (state_expired()) + pending_state = LINGER_STATE; + break; + + case LINGER_STATE: + if (marks_mask & MARK_INTERRUPT_LINGER) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_END_LINGER) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_SHUTDOWN) + pending_state = CLEANUP_STATE; + else if (state_expired()) + pending_state = CLEANUP_STATE; + break; + + case CLEANUP_STATE: + if ((marks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) + pending_state = DONE_STATE; + break; + } + + if (spell_state != pending_state) + change_state_s(pending_state); + + if (spell_state == INACTIVE_STATE) + return; + + //--------------------------// + + // sample the constraints + constraint_mgr->sample(TickSec, Platform::getVirtualMilliseconds()); + + for (S32 i = 0; i < NUM_PHRASES; i++) + if (phrases[i]) + phrases[i]->update(TickSec, spell_elapsed); + + if (missile_is_armed) + { + launch_missile_s(); + missile_is_armed = false; + } +} + +void afxMagicSpell::change_state_s(U8 pending_state) +{ + if (spell_state == pending_state) + return; + + // LEAVING THIS STATE + switch (spell_state) + { + case INACTIVE_STATE: + break; + case CASTING_STATE: + leave_casting_state_s(); + break; + case DELIVERY_STATE: + leave_delivery_state_s(); + break; + case LINGER_STATE: + leave_linger_state_s(); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } + + spell_state = pending_state; + + // ENTERING THIS STATE + switch (pending_state) + { + case INACTIVE_STATE: + break; + case CASTING_STATE: + enter_casting_state_s(); + break; + case DELIVERY_STATE: + enter_delivery_state_s(); + break; + case LINGER_STATE: + enter_linger_state_s(); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + enter_done_state_s(); + break; + } +} + +void afxMagicSpell::enter_done_state_s() +{ + postSpellEvent(DEACTIVATE_EVENT); + + if (marks_mask & MARK_INTERRUPTS) + { + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + 500); + } + else + { + F32 done_time = spell_elapsed; + + for (S32 i = 0; i < NUM_PHRASES; i++) + { + if (phrases[i]) + { + F32 phrase_done; + if (phrases[i]->willStop() && phrases[i]->isInfinite()) + phrase_done = spell_elapsed + phrases[i]->calcAfterLife(); + else + phrase_done = phrases[i]->calcDoneTime(); + if (phrase_done > done_time) + done_time = phrase_done; + } + } + + F32 time_left = done_time - spell_elapsed; + if (time_left < 0) + time_left = 0; + + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + time_left*1000 + 500); + } + + // CALL SCRIPT afxMagicSpellData::onDeactivate(%spell) + datablock->onDeactivate_callback(this); +} + +void afxMagicSpell::enter_casting_state_s() +{ + // note - onActivate() is called in cast_spell() instead of here to make sure any + // new time-factor settings resolve before they are sent off to the clients. + + // stamp constraint-mgr starting time and reset spell timer + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds()); + spell_elapsed = 0; + + setup_dynamic_constraints(); + + // start casting effects + setup_casting_fx(); + if (phrases[CASTING_PHRASE]) + phrases[CASTING_PHRASE]->start(spell_elapsed, spell_elapsed); + + // initialize missile + if (missile_db) + { + missile_db = missile_db->cloneAndPerformSubstitutions(this, ranking); + init_missile_s(missile_db); + } +} + +void afxMagicSpell::leave_casting_state_s() +{ + if (phrases[CASTING_PHRASE]) + { + if (marks_mask & MARK_INTERRUPT_CASTING) + { + //Con::printf("INTERRUPT CASTING (S)"); + phrases[CASTING_PHRASE]->interrupt(spell_elapsed); + } + else + { + //Con::printf("LEAVING CASTING (S)"); + phrases[CASTING_PHRASE]->stop(spell_elapsed); + } + } + + if (marks_mask & MARK_INTERRUPT_CASTING) + { + // CALL SCRIPT afxMagicSpellData::onInterrupt(%spell, %caster) + datablock->onInterrupt_callback(this, caster); + } +} + +void afxMagicSpell::enter_delivery_state_s() +{ + // CALL SCRIPT afxMagicSpellData::onLaunch(%spell, %caster, %target, %missile) + datablock->onLaunch_callback(this, caster, target, missile); + + if (datablock->launch_on_server_signal) + postSpellEvent(LAUNCH_EVENT); + + missile_is_armed = true; + + // start launch effects + setup_launch_fx(); + if (phrases[LAUNCH_PHRASE]) + phrases[LAUNCH_PHRASE]->start(spell_elapsed, spell_elapsed); //START + + // start delivery effects + setup_delivery_fx(); + if (phrases[DELIVERY_PHRASE]) + phrases[DELIVERY_PHRASE]->start(spell_elapsed, spell_elapsed); //START +} + +void afxMagicSpell::leave_delivery_state_s() +{ + if (phrases[DELIVERY_PHRASE]) + { + if (marks_mask & MARK_INTERRUPT_DELIVERY) + { + //Con::printf("INTERRUPT DELIVERY (S)"); + phrases[DELIVERY_PHRASE]->interrupt(spell_elapsed); + } + else + { + //Con::printf("LEAVING DELIVERY (S)"); + phrases[DELIVERY_PHRASE]->stop(spell_elapsed); + } + } + + if (!missile && !(marks_mask & MARK_IMPACT)) + { + if (target) + { + Point3F p = afxMagicSpell::getShapeImpactPos(target); + Point3F n = Point3F(0,0,1); + impactNotify(p, n, target); + } + else + { + Point3F p = Point3F(0,0,0); + Point3F n = Point3F(0,0,1); + impactNotify(p, n, 0); + } + } +} + +void afxMagicSpell::enter_linger_state_s() +{ + if (impacted_obj) + { + impacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, impacted_obj); +#if defined(AFX_CAP_SCOPE_TRACKING) + if (impacted_obj->isScopeable()) + constraint_mgr->addScopeableObject(impacted_obj); +#endif + } + else + constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferenceObject(MISSILE_CONS, 0); + + // start impact effects + setup_impact_fx(); + if (phrases[IMPACT_PHRASE]) + phrases[IMPACT_PHRASE]->start(spell_elapsed, spell_elapsed); //START + + // start linger effects + setup_linger_fx(); + if (phrases[LINGER_PHRASE]) + phrases[LINGER_PHRASE]->start(spell_elapsed, spell_elapsed); //START + +#if 0 // code temporarily replaced with old callback technique in order to avoid engine bug. + // CALL SCRIPT afxMagicSpellData::onImpact(%spell, %caster, %impactedObj, %impactedPos, %impactedNorm) + datablock->onImpact_callback(this, caster, impacted_obj, impact_pos, impact_norm); +#else + char pos_buf[128]; + dSprintf(pos_buf, sizeof(pos_buf), "%g %g %g", impact_pos.x, impact_pos.y, impact_pos.z); + char norm_buf[128]; + dSprintf(norm_buf, sizeof(norm_buf), "%g %g %g", impact_norm.x, impact_norm.y, impact_norm.z); + Con::executef(exeblock, "onImpact", getIdString(), + (caster) ? caster->getIdString(): "", + (impacted_obj) ? impacted_obj->getIdString(): "", + pos_buf, norm_buf); +#endif +} + +void afxMagicSpell::leave_linger_state_s() +{ + if (phrases[LINGER_PHRASE]) + { + if (marks_mask & MARK_INTERRUPT_LINGER) + { + //Con::printf("INTERRUPT LINGER (S)"); + phrases[LINGER_PHRASE]->interrupt(spell_elapsed); + } + else + { + //Con::printf("LEAVING LINGER (S)"); + phrases[LINGER_PHRASE]->stop(spell_elapsed); + } + } +} + + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +void afxMagicSpell::process_client(F32 dt) +{ + spell_elapsed += dt; //SPELL_ELAPSED + + U8 pending_state = spell_state; + + // check for state changes + switch (spell_state) + { + case INACTIVE_STATE: + if (marks_mask & MARK_ACTIVATE) + pending_state = CASTING_STATE; + break; + case CASTING_STATE: + if (marks_mask & MARK_INTERRUPT_CASTING) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_END_CASTING) + pending_state = DELIVERY_STATE; + else if (datablock->launch_on_server_signal) + { + if (marks_mask & MARK_LAUNCH) + pending_state = DELIVERY_STATE; + } + else + { + if (state_expired()) + pending_state = DELIVERY_STATE; + } + break; + case DELIVERY_STATE: + if (marks_mask & MARK_INTERRUPT_DELIVERY) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_END_DELIVERY) + pending_state = LINGER_STATE; + else if (marks_mask & MARK_IMPACT) + pending_state = LINGER_STATE; + else + state_expired(); + break; + case LINGER_STATE: + if (marks_mask & MARK_INTERRUPT_LINGER) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_END_LINGER) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_SHUTDOWN) + pending_state = CLEANUP_STATE; + else if (state_expired()) + pending_state = CLEANUP_STATE; + break; + case CLEANUP_STATE: + if ((marks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) + pending_state = DONE_STATE; + break; + } + + if (spell_state != pending_state) + change_state_c(pending_state); + + if (spell_state == INACTIVE_STATE) + return; + + //--------------------------// + + // update the listener constraint position + if (!listener_cons_id.undefined()) + { + Point3F listener_pos; + listener_pos = SFX->getListener().getTransform().getPosition(); + constraint_mgr->setReferencePoint(listener_cons_id, listener_pos); + } + + // find local camera position + Point3F cam_pos; + SceneObject* current_cam = get_camera(&cam_pos); + + // detect camera changes + if (!camera_cons_id.undefined() && current_cam != camera_cons_obj) + { + constraint_mgr->setReferenceObject(camera_cons_id, current_cam); + camera_cons_obj = current_cam; + } + + // sample the constraints + constraint_mgr->sample(dt, Platform::getVirtualMilliseconds(), (current_cam) ? &cam_pos : 0); + + // update active effects lists + for (S32 i = 0; i < NUM_PHRASES; i++) + if (phrases[i]) + phrases[i]->update(dt, spell_elapsed); + + if (missile_is_armed) + { + launch_missile_c(); + missile_is_armed = false; + } +} + +void afxMagicSpell::change_state_c(U8 pending_state) +{ + if (spell_state == pending_state) + return; + + // LEAVING THIS STATE + switch (spell_state) + { + case INACTIVE_STATE: + break; + case CASTING_STATE: + leave_casting_state_c(); + break; + case DELIVERY_STATE: + leave_delivery_state_c(); + break; + case LINGER_STATE: + leave_linger_state_c(); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } + + spell_state = pending_state; + + // ENTERING THIS STATE + switch (pending_state) + { + case INACTIVE_STATE: + break; + case CASTING_STATE: + enter_casting_state_c(spell_elapsed); + break; + case DELIVERY_STATE: + enter_delivery_state_c(spell_elapsed); + break; + case LINGER_STATE: + enter_linger_state_c(spell_elapsed); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } +} + +void afxMagicSpell::enter_casting_state_c(F32 starttime) +{ + // stamp constraint-mgr starting time + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds() - (U32)(spell_elapsed*1000)); + //spell_elapsed = 0; //SPELL_ELAPSED + + setup_dynamic_constraints(); + + // start casting effects and castbar + setup_casting_fx(); + if (phrases[CASTING_PHRASE]) + phrases[CASTING_PHRASE]->start(starttime, spell_elapsed); //START + + // initialize missile + if (missile_db) + { + missile_db = missile_db->cloneAndPerformSubstitutions(this, ranking); + init_missile_c(missile_db); + } +} + +void afxMagicSpell::leave_casting_state_c() +{ + if (phrases[CASTING_PHRASE]) + { + if (marks_mask & MARK_INTERRUPT_CASTING) + { + //Con::printf("INTERRUPT CASTING (C)"); + phrases[CASTING_PHRASE]->interrupt(spell_elapsed); + } + else + { + //Con::printf("LEAVING CASTING (C)"); + phrases[CASTING_PHRASE]->stop(spell_elapsed); + } + } +} + +void afxMagicSpell::enter_delivery_state_c(F32 starttime) +{ + missile_is_armed = true; + + setup_launch_fx(); + if (phrases[LAUNCH_PHRASE]) + phrases[LAUNCH_PHRASE]->start(starttime, spell_elapsed); //START + + setup_delivery_fx(); + if (phrases[DELIVERY_PHRASE]) + phrases[DELIVERY_PHRASE]->start(starttime, spell_elapsed); //START +} + +void afxMagicSpell::leave_delivery_state_c() +{ + if (missile) + { + clearNotify(missile); + missile->deleteObject(); + missile = NULL; + } + + if (phrases[DELIVERY_PHRASE]) + { + if (marks_mask & MARK_INTERRUPT_DELIVERY) + { + //Con::printf("INTERRUPT DELIVERY (C)"); + phrases[DELIVERY_PHRASE]->interrupt(spell_elapsed); + } + else + { + //Con::printf("LEAVING DELIVERY (C)"); + phrases[DELIVERY_PHRASE]->stop(spell_elapsed); + } + } +} + +void afxMagicSpell::enter_linger_state_c(F32 starttime) +{ + if (impacted_obj) + impacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, impacted_obj); + else if (impacted_scope_id > 0) + impacted_cons_id = constraint_mgr->setReferenceObjectByScopeId(IMPACTED_OBJECT_CONS, impacted_scope_id, impacted_is_shape); + else + constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferenceObject(MISSILE_CONS, 0); + + setup_impact_fx(); + if (phrases[IMPACT_PHRASE]) + phrases[IMPACT_PHRASE]->start(starttime, spell_elapsed); //START + + setup_linger_fx(); + if (phrases[LINGER_PHRASE]) + { + phrases[LINGER_PHRASE]->start(starttime, spell_elapsed); //START + } +} + +void afxMagicSpell::leave_linger_state_c() +{ + if (phrases[LINGER_PHRASE]) + { + if (marks_mask & MARK_INTERRUPT_LINGER) + { + //Con::printf("INTERRUPT LINGER (C)"); + phrases[LINGER_PHRASE]->interrupt(spell_elapsed); + } + else + { + //Con::printf("LEAVING LINGER (C)"); + phrases[LINGER_PHRASE]->stop(spell_elapsed); + } + } +} + +void afxMagicSpell::sync_client(U16 marks, U8 state, F32 elapsed, F32 spell_elapsed) +{ + //Con::printf("SYNC marks=%d old_state=%s state=%s elapsed=%g spell_elapsed=%g", + // marks, name_from_state(spell_state), name_from_state(state), elapsed, + // spell_elapsed); + + if (spell_state != LATE_STATE) + return; + + marks_mask = marks; + + // don't want to be started on late zoning clients + if (!datablock->exec_on_new_clients) + { + spell_state = DONE_STATE; + } + + // it looks like we're ghosting pretty late and + // should just return to the inactive state. + else if ((marks & (MARK_INTERRUPTS | MARK_DEACTIVATE | MARK_SHUTDOWN)) || + (((marks & MARK_IMPACT) || (marks & MARK_END_DELIVERY)) && (marks & MARK_END_LINGER))) + { + spell_state = DONE_STATE; + } + + // it looks like we should be in the linger state. + else if ((marks & MARK_IMPACT) || + (((marks & MARK_LAUNCH) || (marks & MARK_END_CASTING)) && (marks & MARK_END_DELIVERY))) + { + spell_state = LINGER_STATE; + this->spell_elapsed = spell_elapsed; + enter_linger_state_c(spell_elapsed-elapsed); + } + + // it looks like we should be in the delivery state. + else if ((marks & MARK_LAUNCH) || (marks & MARK_END_CASTING)) + { + spell_state = DELIVERY_STATE; + this->spell_elapsed = spell_elapsed; + enter_delivery_state_c(spell_elapsed-elapsed); + } + + // it looks like we should be in the casting state. + else if (marks & MARK_ACTIVATE) + { + spell_state = CASTING_STATE; //SPELL_STATE + this->spell_elapsed = spell_elapsed; + enter_casting_state_c(spell_elapsed-elapsed); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// public: + +void afxMagicSpell::postSpellEvent(U8 event) +{ + setMaskBits(StateEventMask); + + switch (event) + { + case ACTIVATE_EVENT: + marks_mask |= MARK_ACTIVATE; + break; + case LAUNCH_EVENT: + marks_mask |= MARK_LAUNCH; + setMaskBits(LaunchEventMask); + break; + case IMPACT_EVENT: + marks_mask |= MARK_IMPACT; + setMaskBits(ImpactEventMask); + break; + case SHUTDOWN_EVENT: + marks_mask |= MARK_SHUTDOWN; + break; + case DEACTIVATE_EVENT: + marks_mask |= MARK_DEACTIVATE; + break; + case INTERRUPT_PHASE_EVENT: + if (spell_state == CASTING_STATE) + marks_mask |= MARK_END_CASTING; + else if (spell_state == DELIVERY_STATE) + marks_mask |= MARK_END_DELIVERY; + else if (spell_state == LINGER_STATE) + marks_mask |= MARK_END_LINGER; + break; + case INTERRUPT_SPELL_EVENT: + if (spell_state == CASTING_STATE) + marks_mask |= MARK_INTERRUPT_CASTING; + else if (spell_state == DELIVERY_STATE) + marks_mask |= MARK_INTERRUPT_DELIVERY; + else if (spell_state == LINGER_STATE) + marks_mask |= MARK_INTERRUPT_LINGER; + else if (spell_state == CLEANUP_STATE) + marks_mask |= MARK_INTERRUPT_CLEANUP; + break; + } +} + +void afxMagicSpell::resolveTimeFactors() +{ + for (S32 i = 0; i < NUM_PHRASES; i++) + tfactors[i] *= overall_time_factor; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxMagicSpell::finish_startup() +{ +#if !defined(BROKEN_POINT_IN_WATER) + // test if caster is in water + if (caster) + { + Point3F pos = caster->getPosition(); + if (caster->pointInWater(pos)) + exec_conds_mask |= CASTER_IN_WATER; + } +#endif + + resolveTimeFactors(); + + init_constraints(); + init_scoping(); + + postSpellEvent(afxMagicSpell::ACTIVATE_EVENT); +} + +// static +afxMagicSpell* +afxMagicSpell::cast_spell(afxMagicSpellData* datablock, ShapeBase* caster, SceneObject* target, SimObject* extra) +{ + AssertFatal(datablock != NULL, "Datablock is missing."); + AssertFatal(caster != NULL, "Caster is missing."); + + afxMagicSpellData* exeblock = datablock; + + SimObject* param_holder = new SimObject(); + if (!param_holder->registerObject()) + { + Con::errorf("afxMagicSpell: failed to register parameter object."); + delete param_holder; + return 0; + } + + param_holder->assignDynamicFieldsFrom(datablock, arcaneFX::sParameterFieldPrefix); + if (extra) + { + // copy dynamic fields from the extra object to the param holder + param_holder->assignDynamicFieldsFrom(extra, arcaneFX::sParameterFieldPrefix); + } + + if (datablock->isMethod("onPreactivate")) + { + // CALL SCRIPT afxMagicSpellData::onPreactivate(%params, %caster, %target, %extra) + bool result = datablock->onPreactivate_callback(param_holder, caster, target, extra); + if (!result) + { + #if defined(TORQUE_DEBUG) + Con::warnf("afxMagicSpell: onPreactivate() returned false, spell aborted."); + #endif + Sim::postEvent(param_holder, new ObjectDeleteEvent, Sim::getCurrentTime()); + return 0; + } + } + + // make a temp datablock clone if there are substitutions + if (datablock->getSubstitutionCount() > 0) + { + datablock = new afxMagicSpellData(*exeblock, true); + exeblock->performSubstitutions(datablock, param_holder); + } + + // create a new spell instance + afxMagicSpell* spell = new afxMagicSpell(caster, target); + spell->setDataBlock(datablock); + spell->exeblock = exeblock; + spell->setExtra(extra); + + // copy dynamic fields from the param holder to the spell + spell->assignDynamicFieldsFrom(param_holder, arcaneFX::sParameterFieldPrefix); + Sim::postEvent(param_holder, new ObjectDeleteEvent, Sim::getCurrentTime()); + + // register + if (!spell->registerObject()) + { + Con::errorf("afxMagicSpell: failed to register spell instance."); + Sim::postEvent(spell, new ObjectDeleteEvent, Sim::getCurrentTime()); + return 0; + } + registerForCleanup(spell); + + spell->activate(); + + return spell; +} + +IMPLEMENT_GLOBAL_CALLBACK( DisplayScreenMessage, void, (GameConnection* client, const char* message), (client, message), + "Called to display a screen message.\n" + "@ingroup AFX\n" ); + +void afxMagicSpell::displayScreenMessage(ShapeBase* caster, const char* msg) +{ + if (!caster) + return; + + GameConnection* client = caster->getControllingClient(); + if (client) + DisplayScreenMessage_callback(client, msg); +} + +Point3F afxMagicSpell::getShapeImpactPos(SceneObject* obj) +{ + Point3F pos = obj->getRenderPosition(); + if (obj->getTypeMask() & CorpseObjectType) + pos.z += 0.5f; + else + pos.z += (obj->getObjBox().len_z()/2); + return pos; +} + +void afxMagicSpell::restoreObject(SceneObject* obj) +{ + if (obj->getScopeId() == caster_scope_id && dynamic_cast(obj) != NULL) + { + caster_scope_id = 0; + caster = (ShapeBase*)obj; + caster_field = caster; + deleteNotify(caster); + processAfter(caster); + } + + if (obj->getScopeId() == target_scope_id) + { + target_scope_id = 0; + target = obj; + target_field = target; + deleteNotify(target); + } + + if (obj->getScopeId() == impacted_scope_id) + { + impacted_scope_id = 0; + impacted_obj = obj; + deleteNotify(impacted_obj); + } +} + +bool afxMagicSpell::activationCallInit(bool postponed) +{ + if (postponed && (!started_with_newop || !postpone_activation)) + { + Con::errorf("afxMagicSpell::activate() -- activate() is only required when creating a spell with the \"new\" operator " + "and the postponeActivation field is set to \"true\"."); + return false; + } + + if (!caster_field) + { + Con::errorf("afxMagicSpell::activate() -- no spellcaster specified."); + return false; + } + + caster = dynamic_cast(caster_field); + if (!caster) + { + Con::errorf("afxMagicSpell::activate() -- spellcaster is not a ShapeBase derived object."); + return false; + } + + if (target_field) + { + target = dynamic_cast(target_field); + if (!target) + Con::warnf("afxMagicSpell::activate() -- target is not a SceneObject derived object."); + } + + return true; +} + +void afxMagicSpell::activate() +{ + // separating the final part of startup allows the calling script + // to make certain types of calls on the returned spell that need + // to happen prior to object registration. + Sim::postEvent(this, new SpellFinishStartupEvent, Sim::getCurrentTime()); + + caster_field = caster; + target_field = target; + + // CALL SCRIPT afxMagicSpellData::onActivate(%spell, %caster, %target) + datablock->onActivate_callback(this, caster, target); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// console methods/functions + +DefineEngineMethod(afxMagicSpell, getCaster, S32, (),, + "Returns ID of the spell's caster object.\n\n" + "@ingroup AFX") +{ + ShapeBase* caster = object->getCaster(); + return (caster) ? caster->getId() : -1; +} + +DefineEngineMethod(afxMagicSpell, getTarget, S32, (),, + "Returns ID of the spell's target object.\n\n" + "@ingroup AFX") +{ + SceneObject* target = object->getTarget(); + return (target) ? target->getId() : -1; +} + +DefineEngineMethod(afxMagicSpell, getMissile, S32, (),, + "Returns ID of the spell's magic-missile object.\n\n" + "@ingroup AFX") +{ + afxMagicMissile* missile = object->getMissile(); + return (missile) ? missile->getId() : -1; +} + +DefineEngineMethod(afxMagicSpell, getImpactedObject, S32, (),, + "Returns ID of impacted-object for the spell.\n\n" + "@ingroup AFX") +{ + SceneObject* imp_obj = object->getImpactedObject(); + return (imp_obj) ? imp_obj->getId() : -1; +} + +ConsoleMethod(afxMagicSpell, setTimeFactor, void, 3, 4, "(F32 factor) or (string phase, F32 factor)" + "Sets the time-factor for the spell, either overall or for a specific phrase.\n\n" + "@ingroup AFX") +{ + if (argc == 3) + object->setTimeFactor(dAtof(argv[2])); + else + { + if (dStricmp(argv[2], "overall") == 0) + object->setTimeFactor(dAtof(argv[3])); + else if (dStricmp(argv[2], "casting") == 0) + object->setTimeFactor(afxMagicSpell::CASTING_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "launch") == 0) + object->setTimeFactor(afxMagicSpell::LAUNCH_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "delivery") == 0) + object->setTimeFactor(afxMagicSpell::DELIVERY_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "impact") == 0) + object->setTimeFactor(afxMagicSpell::IMPACT_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "linger") == 0) + object->setTimeFactor(afxMagicSpell::LINGER_PHRASE, dAtof(argv[3])); + else + Con::errorf("afxMagicSpell::setTimeFactor() -- unknown spell phrase [%s].", argv[2].getStringValue()); + } +} + +DefineEngineMethod(afxMagicSpell, interruptStage, void, (),, + "Interrupts the current stage of a magic spell causing it to move onto the next one.\n\n" + "@ingroup AFX") +{ + object->postSpellEvent(afxMagicSpell::INTERRUPT_PHASE_EVENT); +} + +DefineEngineMethod(afxMagicSpell, interrupt, void, (),, + "Interrupts and deletes a running magic spell.\n\n" + "@ingroup AFX") +{ + object->postSpellEvent(afxMagicSpell::INTERRUPT_SPELL_EVENT); +} + +DefineEngineMethod(afxMagicSpell, activate, void, (),, + "Activates a magic spell that was started with postponeActivation=true.\n\n" + "@ingroup AFX") +{ + if (object->activationCallInit(true)) + object->activate(); +} + +DefineEngineFunction(castSpell, S32, (afxMagicSpellData* datablock, ShapeBase* caster, SceneObject* target, SimObject* extra), + (nullAsType(), nullAsType(), nullAsType(), nullAsType()), + "Instantiates the magic spell defined by datablock and cast by caster.\n\n" + "@ingroup AFX") +{ + if (!datablock) + { + Con::errorf("castSpell() -- missing valid spell datablock."); + return 0; + } + + if (!caster) + { + Con::errorf("castSpell() -- missing valid spellcaster."); + return 0; + } + + // target is optional (depends on spell) + + // note -- we must examine all arguments prior to calling cast_spell because + // it calls Con::executef() which will overwrite the argument array. + afxMagicSpell* spell = afxMagicSpell::cast_spell(datablock, caster, target, extra); + + return (spell) ? spell->getId() : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxMagicSpell.h b/Engine/source/afx/afxMagicSpell.h new file mode 100644 index 000000000..1f760e48b --- /dev/null +++ b/Engine/source/afx/afxMagicSpell.h @@ -0,0 +1,390 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_MAGIC_SPELL_H_ +#define _AFX_MAGIC_SPELL_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "core/util/tVector.h" +#include "console/typeValidators.h" + +#include "afxChoreographer.h" +#include "afxEffectDefs.h" +#include "afxEffectWrapper.h" +#include "afxMagicMissile.h" + +class afxChoreographerData; +class afxMagicMissileData; +class afxEffectWrapperData; +class SceneObject; +class afxMagicSpell; + +class afxMagicSpellDefs +{ +public: + enum + { + CASTING_PHRASE, + LAUNCH_PHRASE, + DELIVERY_PHRASE, + IMPACT_PHRASE, + LINGER_PHRASE, + NUM_PHRASES + }; +}; + +class afxMagicSpellData : public afxChoreographerData, public afxMagicSpellDefs +{ + typedef afxChoreographerData Parent; + + class ewValidator : public TypeValidator + { + U32 id; + public: + ewValidator(U32 id) { this->id = id; } + void validateType(SimObject *object, void *typePtr); + }; + + bool do_id_convert; + +public: + F32 casting_dur; + F32 delivery_dur; + F32 linger_dur; + // + S32 n_casting_loops; + S32 n_delivery_loops; + S32 n_linger_loops; + // + F32 extra_casting_time; + F32 extra_delivery_time; + F32 extra_linger_time; + // + bool do_move_interrupts; + F32 move_interrupt_speed; + // + afxMagicMissileData* missile_db; + bool launch_on_server_signal; + U32 primary_target_types; + // + afxEffectWrapperData* dummy_fx_entry; + + // various effects lists + afxEffectList casting_fx_list; + afxEffectList launch_fx_list; + afxEffectList delivery_fx_list; + afxEffectList impact_fx_list; + afxEffectList linger_fx_list; + + void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); + void unpack_fx(BitStream* stream, afxEffectList& fx); + +public: + /*C*/ afxMagicSpellData(); + /*C*/ afxMagicSpellData(const afxMagicSpellData&, bool = false); + + virtual void reloadReset(); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + virtual bool writeField(StringTableEntry fieldname, const char* value); + + bool preload(bool server, String &errorStr); + + void gatherConstraintDefs(Vector&); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxMagicSpellData); + DECLARE_CATEGORY("AFX"); + + /// @name Callbacks + /// @{ + DECLARE_CALLBACK( void, onDamage, (afxMagicSpell* spell, const char* label, const char* flaver, U32 target_id, F32 amount, U8 n, Point3F pos, F32 ad_amount, F32 radius, F32 impulse) ); + DECLARE_CALLBACK( void, onDeactivate, (afxMagicSpell* spell) ); + DECLARE_CALLBACK( void, onInterrupt, (afxMagicSpell* spell, ShapeBase* caster) ); + DECLARE_CALLBACK( void, onLaunch, (afxMagicSpell* spell, ShapeBase* caster, SceneObject* target, afxMagicMissile* missile) ); + DECLARE_CALLBACK( void, onImpact, (afxMagicSpell* spell, ShapeBase* caster, SceneObject* impacted, Point3F pos, Point3F normal) ); + DECLARE_CALLBACK( bool, onPreactivate, (SimObject* param_holder, ShapeBase* caster, SceneObject* target, SimObject* extra) ); + DECLARE_CALLBACK( void, onActivate, (afxMagicSpell* spell, ShapeBase* caster, SceneObject* target) ); + /// @} +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMagicSpell + +class ShapeBase; +class GameConnection; +class afxEffectVector; +class afxConstraint; +class afxConstraintMgr; +class afxMagicMissile; +class afxChoreographer; +class afxPhrase; + +class afxMagicSpell : public afxChoreographer, public afxMagicSpellDefs +{ + typedef afxChoreographer Parent; + friend class afxMagicMissile; + + enum MaskBits + { + MagicMissileMask = Parent::NextFreeMask << 0, + StateEventMask = Parent::NextFreeMask << 1, + LaunchEventMask = Parent::NextFreeMask << 2, + ImpactEventMask = Parent::NextFreeMask << 3, + SyncEventMask = Parent::NextFreeMask << 4, + RemapConstraintMask = Parent::NextFreeMask << 5, // CONSTRAINT REMAPPING + NextFreeMask = Parent::NextFreeMask << 6 + }; + +public: + enum + { + NULL_EVENT, + ACTIVATE_EVENT, + LAUNCH_EVENT, + IMPACT_EVENT, + SHUTDOWN_EVENT, + DEACTIVATE_EVENT, + INTERRUPT_PHASE_EVENT, + INTERRUPT_SPELL_EVENT + }; + + enum + { + INACTIVE_STATE, + CASTING_STATE, + DELIVERY_STATE, + LINGER_STATE, + CLEANUP_STATE, + DONE_STATE, + LATE_STATE + }; + + enum { + MARK_ACTIVATE = BIT(0), + MARK_LAUNCH = BIT(1), + MARK_IMPACT = BIT(2), + MARK_SHUTDOWN = BIT(3), + MARK_DEACTIVATE = BIT(4), + MARK_END_CASTING = BIT(5), + MARK_END_DELIVERY = BIT(6), + MARK_END_LINGER = BIT(7), + MARK_INTERRUPT_CASTING = BIT(8), + MARK_INTERRUPT_DELIVERY = BIT(9), + MARK_INTERRUPT_LINGER = BIT(10), + MARK_INTERRUPT_CLEANUP = BIT(11), + // + MARK_ENDINGS = MARK_END_CASTING | MARK_END_DELIVERY | MARK_END_LINGER, + MARK_INTERRUPTS = MARK_INTERRUPT_CASTING | MARK_INTERRUPT_DELIVERY | MARK_INTERRUPT_LINGER | MARK_INTERRUPT_CLEANUP + }; + + class ObjectDeleteEvent : public SimEvent + { + public: + void process(SimObject *obj) { if (obj) obj->deleteObject(); } + }; + +private: + static StringTableEntry CASTER_CONS; + static StringTableEntry TARGET_CONS; + static StringTableEntry MISSILE_CONS; + static StringTableEntry CAMERA_CONS; + static StringTableEntry LISTENER_CONS; + static StringTableEntry IMPACT_POINT_CONS; + static StringTableEntry IMPACTED_OBJECT_CONS; + +private: + afxMagicSpellData* datablock; + SimObject* exeblock; + afxMagicMissileData* missile_db; + + ShapeBase* caster; + SceneObject* target; + SimObject* caster_field; + SimObject* target_field; + + U16 caster_scope_id; + U16 target_scope_id; + bool target_is_shape; + + bool constraints_initialized; + bool scoping_initialized; + + U8 spell_state; + F32 spell_elapsed; + + afxConstraintID listener_cons_id; + afxConstraintID caster_cons_id; + afxConstraintID target_cons_id; + afxConstraintID impacted_cons_id; + afxConstraintID camera_cons_id; + SceneObject* camera_cons_obj; + + afxPhrase* phrases[NUM_PHRASES]; + F32 tfactors[NUM_PHRASES]; + + bool notify_castbar; + F32 overall_time_factor; + + U16 marks_mask; + +private: + void init(); + bool state_expired(); + F32 state_elapsed(); + void init_constraints(); + void init_scoping(); + void setup_casting_fx(); + void setup_launch_fx(); + void setup_delivery_fx(); + void setup_impact_fx(); + void setup_linger_fx(); + bool cleanup_over(); + bool is_caster_moving(); + bool is_caster_client(ShapeBase* caster, GameConnection* conn); + bool is_impact_in_water(SceneObject* obj, const Point3F& p); + +protected: + virtual bool remap_builtin_constraint(SceneObject*, const char* cons_name); // CONSTRAINT REMAPPING + virtual void pack_constraint_info(NetConnection* conn, BitStream* stream); + virtual void unpack_constraint_info(NetConnection* conn, BitStream* stream); + +private: + afxMagicMissile* missile; + bool missile_is_armed; + SceneObject* impacted_obj; + Point3F impact_pos; + Point3F impact_norm; + U16 impacted_scope_id; + bool impacted_is_shape; + + void init_missile_s(afxMagicMissileData* mm); + void launch_missile_s(); + + void init_missile_c(afxMagicMissileData* mm); + void launch_missile_c(); + +public: + virtual void impactNotify(const Point3F& p, const Point3F& n, SceneObject*); + virtual void executeScriptEvent(const char* method, afxConstraint*, + const MatrixF& pos, const char* data); + virtual void inflictDamage(const char * label, const char* flavor, SimObjectId target, + F32 amt, U8 count, F32 ad_amt, F32 rad, Point3F pos, F32 imp); + +public: + /*C*/ afxMagicSpell(); + /*C*/ afxMagicSpell(ShapeBase* caster, SceneObject* target); + /*D*/ ~afxMagicSpell(); + + // STANDARD OVERLOADED METHODS // + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual void processTick(const Move*); + virtual void advanceTime(F32 dt); + virtual bool onAdd(); + virtual void onRemove(); + virtual void onDeleteNotify(SimObject*); + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + + virtual void sync_with_clients(); + void finish_startup(); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxMagicSpell); + DECLARE_CATEGORY("AFX"); + +private: + void process_server(); + // + void change_state_s(U8 pending_state); + // + void enter_casting_state_s(); + void leave_casting_state_s(); + void enter_delivery_state_s(); + void leave_delivery_state_s(); + void enter_linger_state_s(); + void leave_linger_state_s(); + void enter_done_state_s(); + +private: + void process_client(F32 dt); + // + void change_state_c(U8 pending_state); + // + void enter_casting_state_c(F32 starttime); + void leave_casting_state_c(); + void enter_delivery_state_c(F32 starttime); + void leave_delivery_state_c(); + void enter_linger_state_c(F32 starttime); + void leave_linger_state_c(); + // + void sync_client(U16 marks, U8 state, F32 state_elapsed, F32 spell_elapsed); + +public: + void postSpellEvent(U8 event); + void resolveTimeFactors(); + + void setTimeFactor(F32 f) { overall_time_factor = (f > 0) ? f : 1.0f; } + F32 getTimeFactor() { return overall_time_factor; } + void setTimeFactor(U8 phase, F32 f) { tfactors[phase] = (f > 0) ? f : 1.0f; } + F32 getTimeFactor(U8 phase) { return tfactors[phase]; } + + ShapeBase* getCaster() const { return caster; } + SceneObject* getTarget() const { return target; } + afxMagicMissile* getMissile() const { return missile; } + SceneObject* getImpactedObject() const { return impacted_obj; } + + virtual void restoreObject(SceneObject*); + + bool activationCallInit(bool postponed=false); + void activate(); + +public: + static afxMagicSpell* cast_spell(afxMagicSpellData*, ShapeBase* caster, SceneObject* target, SimObject* extra); + + static void displayScreenMessage(ShapeBase* caster, const char* msg); + static Point3F getShapeImpactPos(SceneObject*); +}; + +inline bool afxMagicSpell::is_caster_moving() +{ + return (caster) ? (caster->getVelocity().len() > datablock->move_interrupt_speed) : false; +} + +inline bool afxMagicSpell::is_caster_client(ShapeBase* caster, GameConnection* conn) +{ + return (caster) ? (caster->getControllingClient() == conn) : false; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_MAGIC_SPELL_H_ diff --git a/Engine/source/afx/afxPhrase.cpp b/Engine/source/afx/afxPhrase.cpp new file mode 100644 index 000000000..3e0a2bee0 --- /dev/null +++ b/Engine/source/afx/afxPhrase.cpp @@ -0,0 +1,196 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectVector.h" +#include "afx/afxPhrase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPhrase + +void +afxPhrase::init_fx(S32 group_index) +{ + fx->ev_init(init_chor, *init_fx_list, on_server, will_stop, init_time_factor, init_dur, group_index); +} + +//~~~~~~~~~~~~~~~~~~~~// + +afxPhrase::afxPhrase(bool on_server, bool will_stop) +{ + this->on_server = on_server; + this->will_stop = will_stop; + + init_fx_list = NULL; + init_dur = 0.0f; + init_chor = NULL; + init_time_factor = 1.0f; + + fx = new afxEffectVector; + fx2 = NULL; + starttime = 0; + dur = 0; + + n_loops = 1; + loop_cnt = 1; + + extra_time = 0.0f; + extra_stoptime = 0.0f; +} + +afxPhrase::~afxPhrase() +{ + delete fx; + delete fx2; +}; + +void +afxPhrase::init(afxEffectList& fx_list, F32 dur, afxChoreographer* chor, F32 time_factor, + S32 n_loops, S32 group_index, F32 extra_time) +{ + init_fx_list = &fx_list; + init_dur = dur; + init_chor = chor; + init_time_factor = time_factor; + + this->n_loops = n_loops; + this->extra_time = extra_time; + this->dur = (init_dur < 0) ? init_dur : init_dur*init_time_factor; + + init_fx(group_index); +} + +void +afxPhrase::start(F32 startstamp, F32 timestamp) +{ + starttime = startstamp; + + F32 loopstart = timestamp - startstamp; + + if (dur > 0 && loopstart > dur) + { + loop_cnt += (S32) (loopstart/dur); + loopstart = mFmod(loopstart, dur); + } + + if (!fx->empty()) + fx->start(loopstart); +} + +void +afxPhrase::update(F32 dt, F32 timestamp) +{ + if (fx->isActive()) + fx->update(dt); + + if (fx2 && fx2->isActive()) + fx2->update(dt); + + if (extra_stoptime > 0 && timestamp > extra_stoptime) + { + stop(timestamp); + } +} + +void +afxPhrase::stop(F32 timestamp) +{ + if (extra_time > 0 && !(extra_stoptime > 0)) + { + extra_stoptime = timestamp + extra_time; + return; + } + + if (fx->isActive()) + fx->stop(); + + if (fx2 && fx2->isActive()) + fx2->stop(); +} + +bool +afxPhrase::expired(F32 timestamp) +{ + if (dur < 0) + return false; + + return ((timestamp - starttime) > loop_cnt*dur); +} + +F32 +afxPhrase::elapsed(F32 timestamp) +{ + return (timestamp - starttime); +} + +bool +afxPhrase::recycle(F32 timestamp) +{ + if (n_loops < 0 || loop_cnt < n_loops) + { + if (fx2) + delete fx2; + + fx2 = fx; + + fx = new afxEffectVector; + init_fx(); + + if (fx2 && !fx2->empty()) + fx2->stop(); + + if (!fx->empty()) + fx->start(0.0F); + + loop_cnt++; + return true; + } + + return false; +} + +void +afxPhrase::interrupt(F32 timestamp) +{ + if (fx->isActive()) + fx->interrupt(); + + if (fx2 && fx2->isActive()) + fx2->interrupt(); +} + +F32 afxPhrase::calcDoneTime() +{ + return starttime + fx->getTotalDur(); +} + +F32 afxPhrase::calcAfterLife() +{ + return fx->getAfterLife(); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/afxPhrase.h b/Engine/source/afx/afxPhrase.h new file mode 100644 index 000000000..2525c2656 --- /dev/null +++ b/Engine/source/afx/afxPhrase.h @@ -0,0 +1,87 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PHRASE_H_ +#define _AFX_PHRASE_H_ + +#include "afxEffectVector.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPhrase + +class afxChoreographer; +class afxConstraintMgr; +class afxEffectVector; + +class afxPhrase +{ +protected: + afxEffectList* init_fx_list; + F32 init_dur; + afxChoreographer* init_chor; + F32 init_time_factor; + F32 extra_time; + + afxEffectVector* fx; + afxEffectVector* fx2; + + bool on_server; + bool will_stop; + + F32 starttime; + F32 dur; + S32 n_loops; + S32 loop_cnt; + F32 extra_stoptime; + + void init_fx(S32 group_index=0); + +public: + /*C*/ afxPhrase(bool on_server, bool will_stop); + virtual ~afxPhrase(); + + virtual void init(afxEffectList&, F32 dur, afxChoreographer*, F32 time_factor, + S32 n_loops, S32 group_index=0, F32 extra_time=0.0f); + + virtual void start(F32 startstamp, F32 timestamp); + virtual void update(F32 dt, F32 timestamp); + virtual void stop(F32 timestamp); + virtual void interrupt(F32 timestamp); + virtual bool expired(F32 timestamp); + virtual bool recycle(F32 timestamp); + virtual F32 elapsed(F32 timestamp); + + bool isEmpty() { return fx->empty(); } + bool isInfinite() { return (init_dur < 0); } + F32 calcDoneTime(); + F32 calcAfterLife(); + bool willStop() { return will_stop; } + bool onServer() { return on_server; } + S32 count() { return fx->count(); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PHRASE_H_ diff --git a/Engine/source/afx/afxRenderHighlightMgr.cpp b/Engine/source/afx/afxRenderHighlightMgr.cpp new file mode 100644 index 000000000..28e875eb9 --- /dev/null +++ b/Engine/source/afx/afxRenderHighlightMgr.cpp @@ -0,0 +1,176 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// The afxRenderHighlightMgr class is adapted from the resource, +// "Silhoute selection via postFX for Torque3D" posted by Konrad Kiss. +// http://www.garagegames.com/community/resources/view/17821 +// Supporting code mods in other areas of the engine are marked as +// "(selection-highlight)". +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "platform/platform.h" +#include "afxRenderHighlightMgr.h" + +#include "scene/sceneManager.h" +#include "scene/sceneRenderState.h" +#include "materials/sceneData.h" +#include "materials/matInstance.h" +//#include "materials/materialFeatureTypes.h" +#include "materials/processedMaterial.h" +#include "postFx/postEffect.h" +#include "gfx/gfxTransformSaver.h" +#include "gfx/gfxDebugEvent.h" +#include "math/util/matrixSet.h" + +IMPLEMENT_CONOBJECT( afxRenderHighlightMgr ); + +afxRenderHighlightMgr::afxRenderHighlightMgr() + : RenderTexTargetBinManager( RenderPassManager::RIT_Mesh, + 1.0f, + 1.0f, + GFXFormatR8G8B8A8, + Point2I( 512, 512 ) ) +{ + mNamedTarget.registerWithName( "highlight" ); + mTargetSizeType = WindowSize; +} + +afxRenderHighlightMgr::~afxRenderHighlightMgr() +{ +} + +PostEffect* afxRenderHighlightMgr::getSelectionEffect() +{ + if ( !mSelectionEffect ) + mSelectionEffect = dynamic_cast( Sim::findObject( "afxHighlightPostFX" ) ); + + return mSelectionEffect; +} + +bool afxRenderHighlightMgr::isSelectionEnabled() +{ + return getSelectionEffect() && getSelectionEffect()->isEnabled(); +} + +void afxRenderHighlightMgr::addElement( RenderInst *inst ) +{ + // Skip out if we don't have the selection post + // effect enabled at this time. + if ( !isSelectionEnabled() ) + return; + + // Skip it if we don't have a selection material. + BaseMatInstance *matInst = getMaterial( inst ); + if ( !matInst || !matInst->needsSelectionHighlighting() ) + return; + + internalAddElement(inst); +} + +void afxRenderHighlightMgr::render( SceneRenderState *state ) +{ + PROFILE_SCOPE( RenderSelectionMgr_Render ); + + if ( !isSelectionEnabled() ) + return; + + const U32 binSize = mElementList.size(); + + // If this is a non-diffuse pass or we have no objects to + // render then tell the effect to skip rendering. + if ( !state->isDiffusePass() || binSize == 0 ) + { + getSelectionEffect()->setSkip( true ); + return; + } + + GFXDEBUGEVENT_SCOPE( RenderSelectionMgr_Render, ColorI::GREEN ); + + GFXTransformSaver saver; + + // Tell the superclass we're about to render, preserve contents + const bool isRenderingToTarget = _onPreRender( state, true ); + + // Clear all the buffers to black. + //GFX->clear( GFXClearTarget, ColorI::BLACK, 1.0f, 0); + GFX->clear( GFXClearTarget, ColorI::ZERO, 1.0f, 0); + + // Restore transforms + MatrixSet &matrixSet = getRenderPass()->getMatrixSet(); + matrixSet.restoreSceneViewProjection(); + + // init loop data + SceneData sgData; + sgData.init( state, SceneData::HighlightBin ); + + for( U32 j=0; j(mElementList[j].inst); + + setupSGData( ri, sgData ); + + BaseMatInstance *mat = ri->matInst; + + U32 matListEnd = j; + + while( mat && mat->setupPass( state, sgData ) ) + { + U32 a; + for( a=j; a(mElementList[a].inst); + + if ( newPassNeeded( ri, passRI ) ) + break; + + matrixSet.setWorld(*passRI->objectToWorld); + matrixSet.setView(*passRI->worldToCamera); + matrixSet.setProjection(*passRI->projection); + mat->setTransforms(matrixSet, state); + + mat->setSceneInfo(state, sgData); + mat->setBuffers(passRI->vertBuff, passRI->primBuff); + + if ( passRI->prim ) + GFX->drawPrimitive( *passRI->prim ); + else + GFX->drawPrimitive( passRI->primBuffIndex ); + } + matListEnd = a; + setupSGData( ri, sgData ); + } + + // force increment if none happened, otherwise go to end of batch + j = ( j == matListEnd ) ? j+1 : matListEnd; + } + + // Finish up. + if ( isRenderingToTarget ) + _onPostRender(); + + // Make sure the effect is gonna render. + getSelectionEffect()->setSkip( false ); +} \ No newline at end of file diff --git a/Engine/source/afx/afxRenderHighlightMgr.h b/Engine/source/afx/afxRenderHighlightMgr.h new file mode 100644 index 000000000..406997f90 --- /dev/null +++ b/Engine/source/afx/afxRenderHighlightMgr.h @@ -0,0 +1,76 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// The afxRenderHighlightMgr class is adapted from the resource, +// "Silhoute selection via postFX for Torque3D" posted by Konrad Kiss. +// http://www.garagegames.com/community/resources/view/17821 +// Supporting code mods in other areas of the engine are marked as +// "(selection-highlight)". +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _afxRENDERHIGHLIGHTMGR_H_ +#define _afxRENDERHIGHLIGHTMGR_H_ + +#ifndef _TEXTARGETBIN_MGR_H_ +#include "renderInstance/renderTexTargetBinManager.h" +#endif + + +class PostEffect; + + +/// +class afxRenderHighlightMgr : public RenderTexTargetBinManager +{ + typedef RenderTexTargetBinManager Parent; + +public: + + afxRenderHighlightMgr(); + virtual ~afxRenderHighlightMgr(); + + /// Returns the selection post effect. + PostEffect* getSelectionEffect(); + + /// Returns true if the highlight post effect is + /// enabled and the selection buffer should be updated. + bool isSelectionEnabled(); + + // RenderBinManager + virtual void addElement( RenderInst *inst ); + virtual void render( SceneRenderState *state ); + + // ConsoleObject + DECLARE_CONOBJECT( afxRenderHighlightMgr ); + +protected: + + SimObjectPtr mSelectionEffect; + +}; + + +#endif // _afxRENDERHIGHLIGHTMGR_H_ diff --git a/Engine/source/afx/afxResidueMgr.cpp b/Engine/source/afx/afxResidueMgr.cpp new file mode 100644 index 000000000..2c36a9559 --- /dev/null +++ b/Engine/source/afx/afxResidueMgr.cpp @@ -0,0 +1,469 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "ts/tsShapeInstance.h" + +#include "afx/ce/afxZodiacMgr.h" +#include "afx/ce/afxModel.h" +#include "afx/afxResidueMgr.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +int QSORT_CALLBACK afxResidueMgr::ResidueList::compare_residue(const void* p1, const void* p2) +{ + const afxResidueMgr::Residue** pd1 = (const afxResidueMgr::Residue**)p1; + const afxResidueMgr::Residue** pd2 = (const afxResidueMgr::Residue**)p2; + + return int(((char*)(*pd1)->data.simobject) - ((char*)(*pd2)->data.simobject)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +inline void afxResidueMgr::ResidueList::swap_array_ptrs() +{ + Vector* tmp = m_array; + m_array = m_scratch_array; + m_scratch_array = tmp; +} + +void afxResidueMgr::ResidueList::free_residue(Residue* residue) +{ + if (the_mgr == NULL) + return; + + if (the_mgr->requires_delete_tracking(residue)) + the_mgr->disable_delete_tracking(residue); + the_mgr->free_residue(residue); +} + +afxResidueMgr::ResidueList::ResidueList() +{ + VECTOR_SET_ASSOCIATION(m_array_a); + VECTOR_SET_ASSOCIATION(m_array_b); + + m_array = &m_array_a; + m_scratch_array = &m_array_b ; + + m_dirty = false; + m_pending = -1; +} + +afxResidueMgr::ResidueList::~ResidueList() +{ + clear(); +} + +void afxResidueMgr::ResidueList::clear() +{ + if (the_mgr) + { + for (S32 i = 0; i < m_array->size(); i++) + { + Residue* r = (*m_array)[i]; + the_mgr->free_residue(r); + } + } + + m_array_a.clear(); + m_array_b.clear(); +} + +void afxResidueMgr::ResidueList::sort() +{ + dQsort(m_array->address(), m_array->size(), sizeof(Residue*), compare_residue); + m_dirty = false; +} + +void afxResidueMgr::ResidueList::fadeAndCull(U32 now) +{ + for (S32 i = 0; i < m_array->size(); i++) + { + Residue* r = (*m_array)[i]; + + // done + if (now >= r->stop_time) + { + free_residue(r); + } + // fading + else if (now >= r->fade_time) + { + r->fade = 1.0f - ((F32)(now - r->fade_time))/((F32)(r->stop_time - r->fade_time)); + m_scratch_array->push_back(r); + } + // opaque + else + { + r->fade = 1.0f; + m_scratch_array->push_back(r); + } + } + + m_array->clear(); + swap_array_ptrs(); +} + +// removes all residue with datablock matching obj +void afxResidueMgr::ResidueList::stripMatchingObjects(SimObject* db, bool del_notify) +{ + if (del_notify) + { + for (S32 i = 0; i < m_array->size(); i++) + { + Residue* r = (*m_array)[i]; + if (db == r->data.simobject && the_mgr != NULL) + the_mgr->free_residue(r); + else + m_scratch_array->push_back(r); + } + } + else + { + for (S32 i = 0; i < m_array->size(); i++) + { + Residue* r = (*m_array)[i]; + if (db == r->data.simobject) + free_residue(r); + else + m_scratch_array->push_back(r); + } + } + + m_array->clear(); + swap_array_ptrs(); +} + +void afxResidueMgr::ResidueList::add(Residue* residue) +{ + m_array->push_back(residue); + m_dirty = true; +} + +void afxResidueMgr::manage_residue(const Residue* r) +{ + if (r == NULL || r->fade < 0.01f) + return; + + if (r->type == ZODIAC) + { + LinearColorF zode_color = ColorI(r->params.zodiac.r, r->params.zodiac.g, r->params.zodiac.b, r->params.zodiac.a); + + afxZodiacData* zd = (afxZodiacData*) r->data.zodiac; + if (zd->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) + zode_color *= r->fade; + else + zode_color.alpha *= r->fade; + + Point3F zode_pos(r->params.zodiac.pos_x, r->params.zodiac.pos_y, r->params.zodiac.pos_z); + Point2F zode_vrange(r->params.zodiac.vrange_dn, r->params.zodiac.vrange_dn); + if (r->params.zodiac.on_terrain) + { + afxZodiacMgr::addTerrainZodiac(zode_pos, r->params.zodiac.rad, zode_color, r->params.zodiac.ang, zd); + } + else + { + afxZodiacMgr::addInteriorZodiac(zode_pos, r->params.zodiac.rad, zode_vrange, zode_color, r->params.zodiac.ang, zd); + } + } + else if (r->type == MODEL) + { + r->data.model->setFadeAmount(r->fade); + } +} + +void afxResidueMgr::ResidueList::manage() +{ + if (the_mgr == NULL) + return; + + S32 n_residue = m_array->size(); + + for (S32 x = 0; x < n_residue; x++) + the_mgr->manage_residue((*m_array)[x]); +} + +U32 afxResidueMgr::ResidueList::findPendingBestBump(U32 look_max) +{ + U32 soonest = 1000*60*60*24; + m_pending = -1; + + U32 n = m_array->size(); + for (U32 i = 0; i < n && i < look_max; i++) + { + Residue* r = (*m_array)[i]; + if (r->stop_time < soonest) + { + soonest = r->stop_time; + m_pending = i; + } + } + + return soonest; +} + +void afxResidueMgr::ResidueList::bumpPending() +{ + if (m_pending >= 0 && m_pending < m_array->size()) + { + Residue* r = (*m_array)[m_pending]; + m_array->erase(m_pending); + free_residue(r); + } + + m_pending = -1; +} + +bool afxResidueMgr::requires_delete_tracking(Residue* r) +{ + return (r->type == MODEL); +} + +void afxResidueMgr::enable_delete_tracking(Residue* r) +{ + deleteNotify(r->data.simobject); +} + +void afxResidueMgr::disable_delete_tracking(Residue* r) +{ + clearNotify(r->data.simobject); + r->data.simobject->deleteObject(); + r->data.simobject = 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxResidueMgr* afxResidueMgr::the_mgr = NULL; +U32 afxResidueMgr::m_max_residue_objs = 256; +bool afxResidueMgr::enabled = true; + +IMPLEMENT_CONOBJECT(afxResidueMgr); + +ConsoleDocClass( afxResidueMgr, + "@brief A class that manages certain AFX effects that can persist for long durations.\n\n" + + "A class that manages certain AFX effects that can persist much longer than the duration of choreographers.\n" + + "@ingroup AFX\n" +); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// free-list management + +afxResidueMgr::Residue* afxResidueMgr::alloc_free_pool_block() +{ + // allocate new block for the free-list + m_free_pool_blocks.push_back(new Residue[FREE_POOL_BLOCK_SIZE]); + + // link them onto the free-list + Residue* new_block = m_free_pool_blocks.last(); + for (U32 i = 0; i < FREE_POOL_BLOCK_SIZE - 1; i++) + new_block[i].next = &new_block[i + 1]; + + // tail of free-list points to NULL + new_block[FREE_POOL_BLOCK_SIZE - 1].next = NULL; + + return new_block; +} + +afxResidueMgr::Residue* afxResidueMgr::alloc_residue() +{ + // need new free-list-block if m_next_free is null + if (!m_next_free) + m_next_free = alloc_free_pool_block(); + + // pop new residue from head of free-list + Residue* residue = m_next_free; + m_next_free = residue->next; + residue->next = NULL; + + return residue; +} + +void afxResidueMgr::free_residue(Residue* residue) +{ + if (residue && residue->type == ZODIAC) + { + if (residue->data.zodiac && residue->data.zodiac->isTempClone()) + { + delete residue->data.zodiac; + residue->data.zodiac = 0; + } + } + + // push residue onto head of free-list + residue->next = m_next_free; + m_next_free = residue; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxResidueMgr::deleteResidueObject(SimObject* obj, bool del_notify) +{ + m_managed.stripMatchingObjects(obj, del_notify); +} + +void afxResidueMgr::bump_residue() +{ + if (m_managed.findPendingBestBump()) + m_managed.bumpPending(); +} + +void afxResidueMgr::add_residue(Residue* residue) +{ + AssertFatal(residue != NULL, "residue pointer is NULL."); + + if (m_managed.size() >= m_max_residue_objs) + bump_residue(); + + m_managed.add(residue); + manage_residue(residue); + + if (requires_delete_tracking(residue)) + enable_delete_tracking(residue); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxResidueMgr::afxResidueMgr() +{ + mObjBox.minExtents.set(-1e7, -1e7, -1e7); + mObjBox.maxExtents.set( 1e7, 1e7, 1e7); + mWorldBox.minExtents.set(-1e7, -1e7, -1e7); + mWorldBox.maxExtents.set( 1e7, 1e7, 1e7); + + m_next_free = NULL; + + VECTOR_SET_ASSOCIATION(m_free_pool_blocks); +} + +afxResidueMgr::~afxResidueMgr() +{ + cleanup(); +} + +void afxResidueMgr::cleanup() +{ + m_managed.clear(); + + m_next_free = NULL; + + for (S32 i = 0; i < m_free_pool_blocks.size(); i++) + delete [] m_free_pool_blocks[i]; + + m_free_pool_blocks.clear(); +} + +void afxResidueMgr::onDeleteNotify(SimObject* obj) +{ + deleteResidueObject(obj, true); + Parent::onDeleteNotify(obj); +} + +void afxResidueMgr::residueAdvanceTime() +{ + U32 now = Platform::getVirtualMilliseconds(); + m_managed.fadeAndCull(now); + m_managed.sortIfDirty(); + m_managed.manage(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +// add ZODIAC residue +void afxResidueMgr::add_interior_zodiac(F32 dur, F32 fade_dur, afxZodiacData* zode, const Point3F& pos, + F32 rad, const Point2F& vrange, const LinearColorF& col, F32 ang) +{ + add_zodiac(dur, fade_dur, zode, pos, rad, vrange, col, ang, false); +} + +void afxResidueMgr::add_terrain_zodiac(F32 dur, F32 fade_dur, afxZodiacData* zode, const Point3F& pos, + F32 rad, const LinearColorF& col, F32 ang) +{ + static Point2F vrange(0.0, 0.0); + add_zodiac(dur, fade_dur, zode, pos, rad, vrange, col, ang, true); +} + +void afxResidueMgr::add_zodiac(F32 dur, F32 fade_dur, afxZodiacData* zode, const Point3F& pos, + F32 rad, const Point2F& vrange, const LinearColorF& col, F32 ang, bool on_terrain) +{ + if (m_max_residue_objs == 0 || dur <= 0 || the_mgr == NULL) + return; + + ColorI col_i = LinearColorF(col).toColorI(); + U32 now = Platform::getVirtualMilliseconds(); + + Residue* residue = the_mgr->alloc_residue(); + // + residue->type = ZODIAC; + residue->data.zodiac = zode; + residue->fade_time = now + (U32)(dur*1000); + residue->stop_time = residue->fade_time + (U32)(fade_dur*1000); + residue->fade = 1.0f; + // + residue->params.zodiac.pos_x = pos.x; + residue->params.zodiac.pos_y = pos.y; + residue->params.zodiac.pos_z = pos.z; + residue->params.zodiac.rad = rad; + residue->params.zodiac.vrange_dn = vrange.x; + residue->params.zodiac.vrange_up = vrange.y; + residue->params.zodiac.r = col_i.red; + residue->params.zodiac.g = col_i.green; + residue->params.zodiac.b = col_i.blue; + residue->params.zodiac.a = col_i.alpha; + residue->params.zodiac.ang = ang; + residue->params.zodiac.on_terrain = on_terrain; + // + residue->next = 0; + + the_mgr->add_residue(residue); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +// add MODEL residue + +void afxResidueMgr::add(F32 dur, F32 fade_dur, afxModel* model) +{ + if (m_max_residue_objs == 0 || dur <= 0 || the_mgr == NULL) + return; + + U32 now = Platform::getVirtualMilliseconds(); + + Residue* residue = the_mgr->alloc_residue(); + // + residue->type = MODEL; + residue->data.model = model; + residue->fade_time = now + (U32)(dur*1000); + residue->stop_time = residue->fade_time + (U32)(fade_dur*1000); + residue->fade = 1.0f; + // + residue->next = 0; + + the_mgr->add_residue(residue); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxResidueMgr.h b/Engine/source/afx/afxResidueMgr.h new file mode 100644 index 000000000..5219f331b --- /dev/null +++ b/Engine/source/afx/afxResidueMgr.h @@ -0,0 +1,179 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_RESIDUE_MGR_H_ +#define _AFX_RESIDUE_MGR_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxZodiacData; +class afxModel; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxResidueMgr +// +// Manage transient objects in the world. + +class afxResidueMgr : public GameBase +{ + + typedef GameBase Parent; + + enum { + ZODIAC, + MODEL + }; + + struct Residue + { + struct ZodiacParams + { + F32 pos_x, pos_y, pos_z; + F32 rad, vrange_dn, vrange_up; + U8 r,g,b,a; + F32 ang; + bool on_terrain; + }; + + union ResidueParams + { + ZodiacParams zodiac; + }; + + union ResidueData + { + afxZodiacData* zodiac; + afxModel* model; + SimObject* simobject; + }; + + + U32 type; + ResidueData data; + ResidueParams params; + U32 fade_time; + U32 stop_time; + F32 fade; + + Residue* next; + }; + + class ResidueList + { + Vector m_array_a; + Vector m_array_b; + + Vector* m_array; + Vector* m_scratch_array; + bool m_dirty; + S32 m_pending; + + void swap_array_ptrs(); + void free_residue(Residue*); + + public: + /*C*/ ResidueList(); + /*D*/ ~ResidueList(); + + void clear(); + S32 size() { return m_array->size(); } + bool empty() { return m_array->empty(); } + void sortIfDirty() { if (m_dirty) sort(); } + + void sort(); + void fadeAndCull(U32 now); + void stripMatchingObjects(SimObject* db, bool del_notify=false); + void add(Residue*); + + void manage(); + + U32 findPendingBestBump(U32 look_max=256); + void bumpPending(); + + static int QSORT_CALLBACK compare_residue(const void* p1, const void* p2); + }; + + friend class ResidueList; + +private: + enum { FREE_POOL_BLOCK_SIZE = 256 }; + + static afxResidueMgr* the_mgr; + + static U32 m_max_residue_objs; + static bool enabled; + + ResidueList m_managed; + + Vector m_free_pool_blocks; + Residue* m_next_free; + + Residue* alloc_free_pool_block(); + Residue* alloc_residue(); + void free_residue(Residue*); + + void bump_residue(); + void add_residue(Residue*); + static void add_zodiac(F32 dur, F32 fade_dur, afxZodiacData*, const Point3F& pos, F32 rad, + const Point2F& vrange, const LinearColorF& col, F32 ang, bool on_terrain); + +protected: + void deleteResidueObject(SimObject* obj, bool del_notify=false); + + void manage_residue(const Residue* r); + + bool requires_delete_tracking(Residue*); + void enable_delete_tracking(Residue*); + void disable_delete_tracking(Residue*); + +public: + /*C*/ afxResidueMgr(); + /*D*/ ~afxResidueMgr(); + + void cleanup(); + virtual void onDeleteNotify(SimObject *obj); + +public: + void residueAdvanceTime(); + + // ZODIAC + static void add_terrain_zodiac(F32 dur, F32 fade_dur, afxZodiacData*, const Point3F& pos, F32 rad, + const LinearColorF& col, F32 ang); + static void add_interior_zodiac(F32 dur, F32 fade_dur, afxZodiacData*, const Point3F& pos, F32 rad, + const Point2F& vrange, const LinearColorF& col, F32 ang); + + // MODEL + static void add(F32 dur, F32 fade_dur, afxModel*); + + static afxResidueMgr* getMaster() { return the_mgr; } + static void setMaster(afxResidueMgr* m) { the_mgr = m; } + + DECLARE_CONOBJECT(afxResidueMgr); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_RESIDUE_MGR_H_ diff --git a/Engine/source/afx/afxSelectron.cpp b/Engine/source/afx/afxSelectron.cpp new file mode 100644 index 000000000..148bcceca --- /dev/null +++ b/Engine/source/afx/afxSelectron.cpp @@ -0,0 +1,1173 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "T3D/gameBase/gameConnection.h" +#include "sfx/sfxSystem.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxSelectron.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSelectronData::ewValidator +// +// When an effect is added using "addEffect", this validator intercepts the value +// and adds it to the dynamic effects list. +// +void afxSelectronData::ewValidator::validateType(SimObject* object, void* typePtr) +{ + afxSelectronData* sele_data = dynamic_cast(object); + afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); + + if (sele_data && ew) + { + switch (id) + { + case MAIN_PHRASE: + sele_data->main_fx_list.push_back(*ew); + break; + case SELECT_PHRASE: + sele_data->select_fx_list.push_back(*ew); + break; + case DESELECT_PHRASE: + sele_data->deselect_fx_list.push_back(*ew); + break; + } + *ew = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class SelectronFinishStartupEvent : public SimEvent +{ +public: + void process(SimObject* obj) + { + afxSelectron* selectron = dynamic_cast(obj); + if (selectron) + selectron->finish_startup(); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSelectronData + +IMPLEMENT_CO_DATABLOCK_V1(afxSelectronData); + +ConsoleDocClass( afxSelectronData, + "@brief Defines the properties of an afxSelectronData.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxSelectronData::afxSelectronData() +{ + main_dur = 0.0f; + select_dur = 0.0f; + deselect_dur = 0.0f; + + n_main_loops = 1; + n_select_loops = 1; + n_deselect_loops = 1; + + registered = false; + + obj_type_style = 0; + obj_type_mask = 0; + + // dummy entry holds effect-wrapper pointer while a special validator + // grabs it and adds it to an appropriate effects list + dummy_fx_entry = NULL; + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; +} + +afxSelectronData::afxSelectronData(const afxSelectronData& other, bool temp_clone) : afxChoreographerData(other, temp_clone) +{ + main_dur = other.main_dur; + select_dur = other.select_dur; + deselect_dur = other.deselect_dur; + n_main_loops = other.n_main_loops; + n_select_loops = other.n_select_loops; + n_deselect_loops = other.n_deselect_loops; + registered = false; + obj_type_style = other.obj_type_style; + obj_type_mask = other.obj_type_mask; + dummy_fx_entry = other.dummy_fx_entry; + do_id_convert = other.do_id_convert; + + main_fx_list = other.main_fx_list; + select_fx_list = other.select_fx_list; + deselect_fx_list = other.deselect_fx_list; +} + +afxSelectronData::~afxSelectronData() +{ + if (registered && !isTempClone()) + arcaneFX::unregisterSelectronData(this); +} + +void afxSelectronData::reloadReset() +{ + main_fx_list.clear(); + select_fx_list.clear(); + deselect_fx_list.clear(); +} + +#define myOffset(field) Offset(field, afxSelectronData) + +void afxSelectronData::initPersistFields() +{ + static ewValidator _mainPhrase(MAIN_PHRASE); + static ewValidator _selectPhrase(SELECT_PHRASE); + static ewValidator _deselectPhrase(DESELECT_PHRASE); + + addField("mainDur", TypeF32, myOffset(main_dur), + "..."); + addField("selectDur", TypeF32, myOffset(select_dur), + "..."); + addField("deselectDur", TypeF32, myOffset(deselect_dur), + "..."); + addField("mainRepeats", TypeS32, myOffset(n_main_loops), + "..."); + addField("selectRepeats", TypeS32, myOffset(n_select_loops), + "..."); + addField("deselectRepeats", TypeS32, myOffset(n_deselect_loops), + "..."); + addField("selectionTypeMask", TypeS32, myOffset(obj_type_mask), + "..."); + addField("selectionTypeStyle", TypeS8, myOffset(obj_type_style), + "..."); + + // effect lists + // for each of these, dummy_fx_entry is set and then a validator adds it to the appropriate effects list + addFieldV("addMainEffect", TYPEID(), myOffset(dummy_fx_entry), &_mainPhrase, + "..."); + addFieldV("addSelectEffect", TYPEID(), myOffset(dummy_fx_entry), &_selectPhrase, + "..."); + addFieldV("addDeselectEffect", TYPEID(), myOffset(dummy_fx_entry), &_deselectPhrase, + "..."); + + // deprecated + addField("numMainLoops", TypeS32, myOffset(n_main_loops), + "..."); + addField("numSelectLoops", TypeS32, myOffset(n_select_loops), + "..."); + addField("numDeselectLoops", TypeS32, myOffset(n_deselect_loops), + "..."); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("addMainEffect"); + disableFieldSubstitutions("addSelectEffect"); + disableFieldSubstitutions("addDeselectEffect"); +} + +bool afxSelectronData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxSelectronData::pack_fx(BitStream* stream, const afxEffectList& fx, bool packed) +{ + stream->writeInt(fx.size(), EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < fx.size(); i++) + writeDatablockID(stream, fx[i], packed); +} + +void afxSelectronData::unpack_fx(BitStream* stream, afxEffectList& fx) +{ + fx.clear(); + S32 n_fx = stream->readInt(EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < n_fx; i++) + fx.push_back((afxEffectWrapperData*)readDatablockID(stream)); +} + +void afxSelectronData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(main_dur); + stream->write(select_dur); + stream->write(deselect_dur); + stream->write(n_main_loops); + stream->write(n_select_loops); + stream->write(n_deselect_loops); + stream->write(obj_type_style); + stream->write(obj_type_mask); + + pack_fx(stream, main_fx_list, packed); + pack_fx(stream, select_fx_list, packed); + pack_fx(stream, deselect_fx_list, packed); +} + +void afxSelectronData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&main_dur); + stream->read(&select_dur); + stream->read(&deselect_dur); + stream->read(&n_main_loops); + stream->read(&n_select_loops); + stream->read(&n_deselect_loops); + stream->read(&obj_type_style); + stream->read(&obj_type_mask); + + do_id_convert = true; + unpack_fx(stream, main_fx_list); + unpack_fx(stream, select_fx_list); + unpack_fx(stream, deselect_fx_list); +} + +inline void expand_fx_list(afxEffectList& fx_list, const char* tag) +{ + for (S32 i = 0; i < fx_list.size(); i++) + { + SimObjectId db_id = SimObjectId((uintptr_t)fx_list[i]); + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, fx_list[i])) + { + Con::errorf(ConsoleLogEntry::General, + "afxSelectronData::preload() -- bad datablockId: 0x%x (%s)", + db_id, tag); + } + } + } +} + +bool afxSelectronData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + expand_fx_list(main_fx_list, "main"); + expand_fx_list(select_fx_list, "select"); + expand_fx_list(deselect_fx_list, "deselect"); + do_id_convert = false; + } + + // this is where a selectron registers itself with the rest of AFX + if (!registered) + { + arcaneFX::registerSelectronData(this); + registered = true; + } + } + + return true; +} + +void afxSelectronData::gatherConstraintDefs(Vector& defs) +{ + afxConstraintDef::gather_cons_defs(defs, main_fx_list); + afxConstraintDef::gather_cons_defs(defs, select_fx_list); + afxConstraintDef::gather_cons_defs(defs, deselect_fx_list); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxSelectronData, reset, void, (),, + "Resets a selectron datablock during reload.\n\n" + "@ingroup AFX") +{ + object->reloadReset(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSelectron + +IMPLEMENT_CO_NETOBJECT_V1(afxSelectron); + +ConsoleDocClass( afxSelectron, + "@brief A choreographer for selection effects.\n\n" + + "@ingroup afxChoreographers\n" + "@ingroup AFX\n" +); + +StringTableEntry afxSelectron::CAMERA_CONS; +StringTableEntry afxSelectron::LISTENER_CONS; +StringTableEntry afxSelectron::FREE_TARGET_CONS; + +void afxSelectron::init() +{ + client_only = true; + mNetFlags.clear(Ghostable | ScopeAlways); + mNetFlags.set(IsGhost); + + // setup static predefined constraint names + if (CAMERA_CONS == 0) + { + CAMERA_CONS = StringTable->insert("camera"); + LISTENER_CONS = StringTable->insert("listener"); + FREE_TARGET_CONS = StringTable->insert("freeTarget"); + } + + datablock = NULL; + exeblock = NULL; + + constraints_initialized = false; + + effect_state = (U8) INACTIVE_STATE; + effect_elapsed = 0; + + // define named constraints + constraint_mgr->defineConstraint(CAMERA_CONSTRAINT, CAMERA_CONS); + constraint_mgr->defineConstraint(POINT_CONSTRAINT, LISTENER_CONS); + constraint_mgr->defineConstraint(POINT_CONSTRAINT, FREE_TARGET_CONS); + + for (S32 i = 0; i < NUM_PHRASES; i++) + phrases[i] = NULL; + + time_factor = 1.0f; + camera_cons_obj = 0; + + marks_mask = 0; +} + +afxSelectron::afxSelectron() +{ + started_with_newop = true; + init(); +} + +afxSelectron::afxSelectron(bool not_default) +{ + started_with_newop = false; + init(); +} + +afxSelectron::~afxSelectron() +{ + for (S32 i = 0; i < NUM_PHRASES; i++) + { + if (phrases[i]) + { + phrases[i]->interrupt(effect_elapsed); + delete phrases[i]; + } + } + + if (datablock && datablock->isTempClone()) + { + delete datablock; + datablock = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// STANDARD OVERLOADED METHODS // + +bool afxSelectron::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + datablock = dynamic_cast(dptr); + if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + exeblock = datablock; + + return true; +} + +void afxSelectron::processTick(const Move* m) +{ + Parent::processTick(m); + + // don't process moves or client ticks + if (m != 0 || isClientObject()) + return; + + process_server(); +} + +void afxSelectron::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + process_client(dt); +} + +bool afxSelectron::onAdd() +{ + if (started_with_newop) + { + Con::errorf("afxSelectron::onAdd() -- selectrons cannot be created with the \"new\" operator. Use startSelectron() instead."); + return false; + } + + NetConnection* conn = NetConnection::getConnectionToServer(); + if (!conn || !Parent::onAdd()) + return false; + + conn->addObject(this); + + return true; +} + +void afxSelectron::onRemove() +{ + getContainer()->removeObject(this); + Parent::onRemove(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +U32 afxSelectron::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) +{ + U32 retMask = Parent::packUpdate(conn, mask, stream); + + // InitialUpdate + if (stream->writeFlag(mask & InitialUpdateMask)) + { + stream->write(time_factor); + + GameConnection* gconn = dynamic_cast(conn); + bool zoned_in = (gconn) ? gconn->isZonedIn() : false; + if (stream->writeFlag(zoned_in)) + pack_constraint_info(conn, stream); + } + + // StateEvent or SyncEvent + if (stream->writeFlag((mask & StateEventMask) || (mask & SyncEventMask))) + { + stream->write(marks_mask); + stream->write(effect_state); + stream->write(effect_elapsed); + } + + // SyncEvent + bool do_sync_event = ((mask & SyncEventMask) && !(mask & InitialUpdateMask)); + if (stream->writeFlag(do_sync_event)) + { + pack_constraint_info(conn, stream); + } + + return retMask; +} + +//~~~~~~~~~~~~~~~~~~~~// + +void afxSelectron::unpackUpdate(NetConnection * conn, BitStream * stream) +{ + Parent::unpackUpdate(conn, stream); + + bool initial_update = false; + bool zoned_in = true; + bool do_sync_event = false; + U8 new_marks_mask = 0; + U8 new_state = INACTIVE_STATE; + F32 new_elapsed = 0; + + // InitialUpdate Only + if (stream->readFlag()) + { + initial_update = true; + + stream->read(&time_factor); + + // if client is marked as fully zoned in + if ((zoned_in = stream->readFlag()) == true) + { + unpack_constraint_info(conn, stream); + init_constraints(); + } + } + + // StateEvent or SyncEvent + // this state data is sent for both state-events and + // sync-events + if (stream->readFlag()) + { + stream->read(&new_marks_mask); + stream->read(&new_state); + stream->read(&new_elapsed); + + marks_mask = new_marks_mask; + } + + // SyncEvent + do_sync_event = stream->readFlag(); + if (do_sync_event) + { + unpack_constraint_info(conn, stream); + init_constraints(); + } + + //~~~~~~~~~~~~~~~~~~~~// + + if (!zoned_in) + effect_state = LATE_STATE; + + // need to adjust state info to get all synced up with spell on server + if (do_sync_event && !initial_update) + sync_client(new_marks_mask, new_state, new_elapsed); +} + +void afxSelectron::sync_with_clients() +{ + setMaskBits(SyncEventMask); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +bool afxSelectron::state_expired() +{ + afxPhrase* phrase = (effect_state == ACTIVE_STATE) ? phrases[MAIN_PHRASE] : NULL; + + if (phrase) + { + if (phrase->expired(effect_elapsed)) + return (!phrase->recycle(effect_elapsed)); + return false; + } + + return true; +} + +void afxSelectron::init_constraints() +{ + if (constraints_initialized) + { + //Con::printf("CONSTRAINTS ALREADY INITIALIZED"); + return; + } + + Vector defs; + datablock->gatherConstraintDefs(defs); + + constraint_mgr->initConstraintDefs(defs, isServerObject()); + + if (isClientObject()) + { + // find local camera + camera_cons_obj = get_camera(); + if (camera_cons_obj) + camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + + // find local listener + Point3F listener_pos; + listener_pos = SFX->getListener().getTransform().getPosition(); + listener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos); + + // find free target + free_target_cons_id = constraint_mgr->setReferencePoint(FREE_TARGET_CONS, arcaneFX::sFreeTargetPos); + } + + constraint_mgr->adjustProcessOrdering(this); + + constraints_initialized = true; +} + +void afxSelectron::setup_main_fx() +{ + phrases[MAIN_PHRASE] = new afxPhrase(isServerObject(), true); + + if (phrases[MAIN_PHRASE]) + phrases[MAIN_PHRASE]->init(datablock->main_fx_list, datablock->main_dur, this, time_factor, + datablock->n_main_loops); +} + +void afxSelectron::setup_select_fx() +{ + phrases[SELECT_PHRASE] = new afxPhrase(isServerObject(), true); + + if (phrases[SELECT_PHRASE]) + phrases[SELECT_PHRASE]->init(datablock->select_fx_list, -1, this, time_factor, 1); +} + +void afxSelectron::setup_deselect_fx() +{ + phrases[DESELECT_PHRASE] = new afxPhrase(isServerObject(), true); + + if (phrases[DESELECT_PHRASE]) + phrases[DESELECT_PHRASE]->init(datablock->deselect_fx_list, -1, this, time_factor, 1); +} + +bool afxSelectron::cleanup_over() +{ + for (S32 i = 0; i < NUM_PHRASES; i++) + if (phrases[i] && !phrases[i]->isEmpty()) + return false; + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +void afxSelectron::process_server() +{ + if (effect_state != INACTIVE_STATE) + effect_elapsed += TickSec; + + U8 pending_state = effect_state; + + // check for state changes + switch (effect_state) + { + case INACTIVE_STATE: + if (marks_mask & MARK_ACTIVATE) + pending_state = ACTIVE_STATE; + break; + case ACTIVE_STATE: + if (marks_mask & MARK_INTERRUPT) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_SHUTDOWN) + pending_state = CLEANUP_STATE; + else if (state_expired()) + pending_state = CLEANUP_STATE; + break; + case CLEANUP_STATE: + if (cleanup_over()) + pending_state = DONE_STATE; + break; + } + + if (effect_state != pending_state) + change_state_s(pending_state); + + if (effect_state == INACTIVE_STATE) + return; + + //--------------------------// + + // sample the constraints + constraint_mgr->sample(TickSec, Platform::getVirtualMilliseconds()); + + for (S32 i = 0; i < NUM_PHRASES; i++) + if (phrases[i]) + phrases[i]->update(TickSec, effect_elapsed); +} + +void afxSelectron::change_state_s(U8 pending_state) +{ + if (effect_state == pending_state) + return; + + switch (effect_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + leave_active_state_s(); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } + + effect_state = pending_state; + + switch (pending_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + enter_active_state_s(); + break; + case CLEANUP_STATE: + enter_cleanup_state_s(); + break; + case DONE_STATE: + enter_done_state_s(); + break; + } +} + +void afxSelectron::enter_done_state_s() +{ + postEvent(DEACTIVATE_EVENT); + + F32 done_time = effect_elapsed; + + for (S32 i = 0; i < NUM_PHRASES; i++) + { + if (phrases[i]) + { + F32 phrase_done; + if (phrases[i]->willStop() && phrases[i]->isInfinite()) + phrase_done = effect_elapsed + phrases[i]->calcAfterLife(); + else + phrase_done = phrases[i]->calcDoneTime(); + if (phrase_done > done_time) + done_time = phrase_done; + } + } + + F32 time_left = done_time - effect_elapsed; + if (time_left < 0) + time_left = 0; + + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + time_left*1000 + 500); + + // CALL SCRIPT afxSelectronData::onDeactivate(%sele) + Con::executef(datablock, "onDeactivate", getIdString()); +} + +void afxSelectron::enter_active_state_s() +{ + // stamp constraint-mgr starting time + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds()); + effect_elapsed = 0; + + setup_dynamic_constraints(); + + // start casting effects + setup_main_fx(); + if (phrases[MAIN_PHRASE]) + phrases[MAIN_PHRASE]->start(effect_elapsed, effect_elapsed); + + setup_select_fx(); + if (phrases[SELECT_PHRASE]) + phrases[SELECT_PHRASE]->start(effect_elapsed, effect_elapsed); +} + +void afxSelectron::leave_active_state_s() +{ + if (phrases[MAIN_PHRASE]) + phrases[MAIN_PHRASE]->stop(effect_elapsed); +} + +void afxSelectron::enter_cleanup_state_s() +{ + // start deselect effects + setup_deselect_fx(); + if (phrases[SELECT_PHRASE]) + phrases[SELECT_PHRASE]->interrupt(effect_elapsed); + if (phrases[DESELECT_PHRASE]) + phrases[DESELECT_PHRASE]->start(effect_elapsed, effect_elapsed); + + postEvent(SHUTDOWN_EVENT); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// private + +void afxSelectron::process_client(F32 dt) +{ + effect_elapsed += dt; + + U8 pending_state = effect_state; + + // check for state changes + switch (effect_state) + { + case INACTIVE_STATE: + if (marks_mask & MARK_ACTIVATE) + pending_state = ACTIVE_STATE; + break; + case ACTIVE_STATE: + if (marks_mask & MARK_INTERRUPT) + pending_state = CLEANUP_STATE; + else if (marks_mask & MARK_SHUTDOWN) + pending_state = CLEANUP_STATE; + else if (state_expired()) + pending_state = CLEANUP_STATE; + break; + case CLEANUP_STATE: + if (cleanup_over()) + pending_state = DONE_STATE; + break; + } + + if (effect_state != pending_state) + change_state_c(pending_state); + + if (effect_state == INACTIVE_STATE) + return; + + //--------------------------// + + // update the listener constraint position + if (!listener_cons_id.undefined()) + { + Point3F listener_pos; + listener_pos = SFX->getListener().getTransform().getPosition(); + constraint_mgr->setReferencePoint(listener_cons_id, listener_pos); + } + + // update the free target constraint position + if (!free_target_cons_id.undefined()) + { + if (!arcaneFX::sFreeTargetPosValid) + constraint_mgr->invalidateReference(free_target_cons_id); + else + constraint_mgr->setReferencePoint(free_target_cons_id, arcaneFX::sFreeTargetPos); + } + + // find local camera position + Point3F cam_pos; + SceneObject* current_cam = get_camera(&cam_pos); + + // detect camera changes + if (!camera_cons_id.undefined() && current_cam != camera_cons_obj) + { + constraint_mgr->setReferenceObject(camera_cons_id, current_cam); + camera_cons_obj = current_cam; + } + + // sample the constraints + constraint_mgr->sample(dt, Platform::getVirtualMilliseconds(), (current_cam) ? &cam_pos : 0); + + // update active effects lists + for (S32 i = 0; i < NUM_PHRASES; i++) + if (phrases[i]) + phrases[i]->update(dt, effect_elapsed); + +} + +void afxSelectron::change_state_c(U8 pending_state) +{ + if (effect_state == pending_state) + return; + + switch (effect_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + leave_active_state_c(); + break; + case CLEANUP_STATE: + break; + case DONE_STATE: + break; + } + + effect_state = pending_state; + + switch (pending_state) + { + case INACTIVE_STATE: + break; + case ACTIVE_STATE: + enter_active_state_c(effect_elapsed); + break; + case CLEANUP_STATE: + enter_cleanup_state_c(); + break; + case DONE_STATE: + enter_done_state_c(); + break; + } +} + +void afxSelectron::enter_active_state_c(F32 starttime) +{ + // stamp constraint-mgr starting time + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds() - (U32)(effect_elapsed*1000)); + ///effect_elapsed = 0; + + setup_dynamic_constraints(); + + setup_main_fx(); + if (phrases[MAIN_PHRASE]) + phrases[MAIN_PHRASE]->start(starttime, effect_elapsed); + + setup_select_fx(); + if (phrases[SELECT_PHRASE]) + phrases[SELECT_PHRASE]->start(starttime, effect_elapsed); +} + +void afxSelectron::leave_active_state_c() +{ + if (phrases[MAIN_PHRASE]) + { + //if (marks_mask & MARK_INTERRUPT) + // active_phrase->interrupt(effect_elapsed); + //else + phrases[MAIN_PHRASE]->stop(effect_elapsed); + } +} + +void afxSelectron::enter_cleanup_state_c() +{ + if (!client_only) + return; + + // start deselect effects + setup_deselect_fx(); + if (phrases[DESELECT_PHRASE]) + phrases[DESELECT_PHRASE]->start(effect_elapsed, effect_elapsed); + + postEvent(SHUTDOWN_EVENT); +} + +void afxSelectron::enter_done_state_c() +{ + if (!client_only) + return; + + postEvent(DEACTIVATE_EVENT); + + F32 done_time = effect_elapsed; + + for (S32 i = 0; i < NUM_PHRASES; i++) + { + if (phrases[i]) + { + F32 phrase_done; + if (phrases[i]->willStop() && phrases[i]->isInfinite()) + phrase_done = effect_elapsed + phrases[i]->calcAfterLife(); + else + phrase_done = phrases[i]->calcDoneTime(); + if (phrase_done > done_time) + done_time = phrase_done; + } + } + + F32 time_left = done_time - effect_elapsed; + if (time_left < 0) + time_left = 0; + + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + time_left*1000 + 500); + + // CALL SCRIPT afxSelectronData::onDeactivate(%selectron) + Con::executef(datablock, "onDeactivate", getIdString()); +} + +void afxSelectron::sync_client(U16 marks, U8 state, F32 elapsed) +{ + //Con::printf("SYNC marks=%d old_state=%d state=%d elapsed=%g", + // marks, effect_state, state, elapsed); + + if (effect_state != LATE_STATE) + return; + + marks_mask = marks; + + // don't want to be started on late zoning clients + if (!datablock->exec_on_new_clients) + { + effect_state = DONE_STATE; + } + + // it looks like we're ghosting pretty late and + // should just return to the inactive state. + else if (marks & (MARK_INTERRUPT | MARK_DEACTIVATE | MARK_SHUTDOWN)) + { + effect_state = DONE_STATE; + } + + // it looks like we should be in the active state. + else if (marks & MARK_ACTIVATE) + { + effect_state = ACTIVE_STATE; + effect_elapsed = elapsed; + enter_active_state_c(0.0); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// public: + +void afxSelectron::postEvent(U8 event) +{ + setMaskBits(StateEventMask); + + switch (event) + { + case ACTIVATE_EVENT: + marks_mask |= MARK_ACTIVATE; + break; + case SHUTDOWN_EVENT: + marks_mask |= MARK_SHUTDOWN; + break; + case DEACTIVATE_EVENT: + marks_mask |= MARK_DEACTIVATE; + break; + case INTERRUPT_EVENT: + marks_mask |= MARK_INTERRUPT; + break; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxSelectron::finish_startup() +{ + init_constraints(); + postEvent(afxSelectron::ACTIVATE_EVENT); +} + +// static +afxSelectron* +afxSelectron::start_selectron(SceneObject* picked, U8 subcode, SimObject* extra) +{ + U32 picked_type = (picked) ? picked->getTypeMask() : 0; + + afxSelectronData* datablock = arcaneFX::findSelectronData(picked_type, subcode); + if (!datablock) + { + Con::errorf("startSelectron() -- failed to match object-type (%x/%d) to a selection-effect.", + picked_type, subcode); + return 0; + } + + afxSelectronData* exeblock = datablock; + + SimObject* param_holder = new SimObject(); + if (!param_holder->registerObject()) + { + Con::errorf("afxSelectron: failed to register parameter object."); + delete param_holder; + return 0; + } + + param_holder->assignDynamicFieldsFrom(datablock, arcaneFX::sParameterFieldPrefix); + if (extra) + { + // copy dynamic fields from the extra object to the param holder + param_holder->assignDynamicFieldsFrom(extra, arcaneFX::sParameterFieldPrefix); + } + + // CALL SCRIPT afxSelectronData::onPreactivate(%params, %extra) + const char* result = Con::executef(datablock, "onPreactivate", + Con::getIntArg(param_holder->getId()), + (extra) ? Con::getIntArg(extra->getId()) : ""); + if (result && result[0] != '\0' && !dAtob(result)) + { +#if defined(TORQUE_DEBUG) + Con::warnf("afxSelectron: onPreactivate() returned false, effect aborted."); +#endif + Sim::postEvent(param_holder, new ObjectDeleteEvent, Sim::getCurrentTime()); + return 0; + } + + // make a temp datablock clone if there are substitutions + if (datablock->getSubstitutionCount() > 0) + { + datablock = new afxSelectronData(*exeblock, true); + exeblock->performSubstitutions(datablock, param_holder); + } + + // create a new selectron instance + afxSelectron* selectron = new afxSelectron(true); + selectron->setDataBlock(datablock); + selectron->exeblock = exeblock; + selectron->setExtra(extra); + + // copy dynamic fields from the param holder to the selectron + selectron->assignDynamicFieldsFrom(param_holder, arcaneFX::sParameterFieldPrefix); + Sim::postEvent(param_holder, new ObjectDeleteEvent, Sim::getCurrentTime()); + + // register + if (!selectron->registerObject()) + { + Con::errorf("afxSelectron: failed to register selectron instance."); + Sim::postEvent(selectron, new ObjectDeleteEvent, Sim::getCurrentTime()); + return 0; + } + + selectron->activate(); + + return selectron; +} + +void afxSelectron::activate() +{ + // separating the final part of startup allows the calling script + // to make certain types of calls on the returned effectron that + // need to happen prior to constraint initialization. + Sim::postEvent(this, new SelectronFinishStartupEvent, Sim::getCurrentTime()); + + // CALL SCRIPT afxEffectronData::onActivate(%eff) + Con::executef(exeblock, "onActivate", getIdString()); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// console functions + +DefineEngineMethod(afxSelectron, setTimeFactor, void, (float factor), (1.0f), + "Sets the time factor of the selectron.\n\n" + "@ingroup AFX") +{ + object->setTimeFactor(factor); +} + +DefineEngineMethod(afxSelectron, interrupt, void, (),, + "Interrupts and deletes a running selectron.\n\n" + "@ingroup AFX") +{ + object->postEvent(afxSelectron::INTERRUPT_EVENT); +} + +DefineEngineMethod(afxSelectron, stopSelectron, void, (),, + "Stops and deletes a running selectron.\n\n" + "@ingroup AFX") +{ + object->postEvent(afxSelectron::INTERRUPT_EVENT); +} + +DefineEngineFunction(startSelectron, S32, (SceneObject* selectedObj, unsigned int subcode, SimObject* extra), + (nullAsType(), 0, nullAsType()), + "Instantiates a selectron.\n\n" + "@ingroup AFX") +{ + // + // Start the Selectron + // + afxSelectron* selectron = afxSelectron::start_selectron(selectedObj, (U8)subcode, extra); + + // + // Return the ID (or 0 if start failed). + // + return (selectron) ? selectron->getId() : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + + + + + + + + diff --git a/Engine/source/afx/afxSelectron.h b/Engine/source/afx/afxSelectron.h new file mode 100644 index 000000000..f7b0c4e50 --- /dev/null +++ b/Engine/source/afx/afxSelectron.h @@ -0,0 +1,258 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_SELECTION_EFFECT_H_ +#define _AFX_SELECTION_EFFECT_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "console/typeValidators.h" + +#include "afxChoreographer.h" +#include "afxEffectWrapper.h" +#include "afxPhrase.h" + +class afxChoreographerData; +class afxEffectBaseData; + +class afxSelectronDefs +{ +public: + enum { + MAIN_PHRASE, + SELECT_PHRASE, + DESELECT_PHRASE, + NUM_PHRASES + }; +}; + +class afxSelectronData : public afxChoreographerData, public afxSelectronDefs +{ + typedef afxChoreographerData Parent; + + class ewValidator : public TypeValidator + { + U32 id; + public: + ewValidator(U32 id) { this->id = id; } + void validateType(SimObject *object, void *typePtr); + }; + + bool do_id_convert; + +public: + F32 main_dur; + F32 select_dur; + F32 deselect_dur; + + S32 n_main_loops; + S32 n_select_loops; + S32 n_deselect_loops; + + bool registered; + U8 obj_type_style; + U32 obj_type_mask; + + afxEffectBaseData* dummy_fx_entry; + + afxEffectList main_fx_list; + afxEffectList select_fx_list; + afxEffectList deselect_fx_list; + +private: + void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); + void unpack_fx(BitStream* stream, afxEffectList& fx); + +public: + /*C*/ afxSelectronData(); + /*C*/ afxSelectronData(const afxSelectronData&, bool = false); + /*D*/ ~afxSelectronData(); + + virtual void reloadReset(); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + bool matches(U32 mask, U8 style); + void gatherConstraintDefs(Vector&); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxSelectronData); + DECLARE_CATEGORY("AFX"); +}; + +inline bool afxSelectronData::matches(U32 mask, U8 style) +{ + if (obj_type_style != style) + return false; + + if (obj_type_mask == 0 && mask == 0) + return true; + + return ((obj_type_mask & mask) != 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSelectron + +class afxSelectron : public afxChoreographer, public afxSelectronDefs +{ + typedef afxChoreographer Parent; + friend class arcaneFX; + +public: + enum MaskBits + { + StateEventMask = Parent::NextFreeMask << 0, + SyncEventMask = Parent::NextFreeMask << 1, + NextFreeMask = Parent::NextFreeMask << 2 + }; + + enum + { + NULL_EVENT, + ACTIVATE_EVENT, + SHUTDOWN_EVENT, + DEACTIVATE_EVENT, + INTERRUPT_EVENT + }; + + enum + { + INACTIVE_STATE, + ACTIVE_STATE, + CLEANUP_STATE, + DONE_STATE, + LATE_STATE + }; + + enum { + MARK_ACTIVATE = BIT(0), + MARK_SHUTDOWN = BIT(1), + MARK_DEACTIVATE = BIT(2), + MARK_INTERRUPT = BIT(3), + }; + + class ObjectDeleteEvent : public SimEvent + { + public: + void process(SimObject *obj) { if (obj) obj->deleteObject(); } + }; + +private: + static StringTableEntry CAMERA_CONS; + static StringTableEntry LISTENER_CONS; + static StringTableEntry FREE_TARGET_CONS; + +private: + afxSelectronData* datablock; + SimObject* exeblock; + + bool constraints_initialized; + bool client_only; + + U8 effect_state; + F32 effect_elapsed; + + afxConstraintID listener_cons_id; + afxConstraintID free_target_cons_id; + afxConstraintID camera_cons_id; + SceneObject* camera_cons_obj; + + afxPhrase* phrases[NUM_PHRASES]; + + F32 time_factor; + U8 marks_mask; + +private: + void init(); + bool state_expired(); + void init_constraints(); + void setup_main_fx(); + void setup_select_fx(); + void setup_deselect_fx(); + bool cleanup_over(); + +public: + /*C*/ afxSelectron(); + /*C*/ afxSelectron(bool not_default); + /*D*/ ~afxSelectron(); + + // STANDARD OVERLOADED METHODS // + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual void processTick(const Move*); + virtual void advanceTime(F32 dt); + virtual bool onAdd(); + virtual void onRemove(); + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + + virtual void sync_with_clients(); + void finish_startup(); + + DECLARE_CONOBJECT(afxSelectron); + DECLARE_CATEGORY("AFX"); + +private: + void process_server(); + // + void change_state_s(U8 pending_state); + // + void enter_active_state_s(); + void leave_active_state_s(); + void enter_cleanup_state_s(); + void enter_done_state_s(); + +private: + void process_client(F32 dt); + // + void change_state_c(U8 pending_state); + // + void enter_active_state_c(F32 starttime); + void enter_cleanup_state_c(); + void enter_done_state_c(); + void leave_active_state_c(); + + void sync_client(U16 marks, U8 state, F32 elapsed); + +public: + void postEvent(U8 event); + void setTimeFactor(F32 f) { time_factor = (f > 0) ? f : 1.0f; } + F32 getTimeFactor() { return time_factor; } + + void activate(); + +public: + static afxSelectron* start_selectron(SceneObject* picked, U8 subcode, SimObject* extra); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +#endif // _AFX_SELECTION_EFFECT_H_ diff --git a/Engine/source/afx/afxSpellBook.cpp b/Engine/source/afx/afxSpellBook.cpp new file mode 100644 index 000000000..42d28d550 --- /dev/null +++ b/Engine/source/afx/afxSpellBook.cpp @@ -0,0 +1,357 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "T3D/gameBase/gameBase.h" + +#include "afx/afxSpellBook.h" +#include "afx/afxMagicSpell.h" +#include "afx/rpg/afxRPGMagicSpell.h" +#include "afx/ui/afxSpellButton.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSpellBookData + +IMPLEMENT_CO_DATABLOCK_V1(afxSpellBookData); + +ConsoleDocClass( afxSpellBookData, + "@brief A spellbook datablock.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxSpellBookData::afxSpellBookData() +{ + spells_per_page = 12; + pages_per_book = 12; + dMemset(spells, 0, sizeof(spells)); + dMemset(rpg_spells, 0, sizeof(rpg_spells)); + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; +} + +#define myOffset(field) Offset(field, afxSpellBookData) + +void afxSpellBookData::initPersistFields() +{ + addField("spellsPerPage", TypeS8, myOffset(spells_per_page), + "..."); + addField("pagesPerBook", TypeS8, myOffset(pages_per_book), + "..."); + + addField("spells", TYPEID(), myOffset(spells), MAX_PAGES_PER_BOOK*MAX_SPELLS_PER_PAGE, + "..."); + addField("rpgSpells", TYPEID(), myOffset(rpg_spells), MAX_PAGES_PER_BOOK*MAX_SPELLS_PER_PAGE, + "..."); + + Parent::initPersistFields(); +} + +bool afxSpellBookData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + for (S32 i = 0; i < pages_per_book*spells_per_page; i++) + { + SimObjectId db_id = SimObjectId((uintptr_t)rpg_spells[i]); + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, rpg_spells[i])) + { + Con::errorf(ConsoleLogEntry::General, + "afxSpellBookData::preload() -- bad datablockId: 0x%x (afxRPGMagicSpellData)", + db_id); + } + } + } + do_id_convert = false; + } + } + + return true; +} + +void afxSpellBookData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(spells_per_page); + stream->write(pages_per_book); + + for (S32 i = 0; i < pages_per_book*spells_per_page; i++) + writeDatablockID(stream, rpg_spells[i], packed); +} + +void afxSpellBookData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&spells_per_page); + stream->read(&pages_per_book); + + do_id_convert = true; + for (S32 i = 0; i < pages_per_book*spells_per_page; i++) + rpg_spells[i] = (afxRPGMagicSpellData*) readDatablockID(stream); +} + +DefineEngineMethod(afxSpellBookData, getPageSlotIndex, S32, (Point2I bookSlot),, + "...\n\n" + "@ingroup AFX") +{ + return object->getPageSlotIndex(bookSlot.x, bookSlot.y); +} + +DefineEngineMethod(afxSpellBookData, getCapacity, S32, (),, + "Get the capacity (total number of spell slots) in a spellbook.\n\n" + "@ingroup AFX") +{ + return object->spells_per_page*object->pages_per_book; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxSpellBook + +IMPLEMENT_CO_NETOBJECT_V1(afxSpellBook); + +ConsoleDocClass( afxSpellBook, + "@brief A spellbook object.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" +); + +afxSpellBook::afxSpellBook() +{ + mNetFlags.set(Ghostable | ScopeAlways); + mDataBlock = NULL; + all_spell_cooldown = 1.0f; +} + +afxSpellBook::~afxSpellBook() +{ +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +void afxSpellBook::initPersistFields() +{ + Parent::initPersistFields(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +void afxSpellBook::processTick(const Move* m) +{ + Parent::processTick(m); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +void afxSpellBook::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + if (all_spell_cooldown < 1.0f) + { + all_spell_cooldown += dt/2.0f; + if (all_spell_cooldown > 1.0f) + all_spell_cooldown = 1.0f; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxSpellBook::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + scriptOnNewDataBlock(); + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxSpellBook::onAdd() +{ + if (!Parent::onAdd()) + return(false); + + return(true); +} + +void afxSpellBook::onRemove() +{ + Parent::onRemove(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +U32 afxSpellBook::packUpdate(NetConnection * con, U32 mask, BitStream * stream) +{ + U32 retMask = Parent::packUpdate(con, mask, stream); + + if (stream->writeFlag(mask & InitialUpdateMask)) + { + } + + // AllSpellCooldown + if (stream->writeFlag(mask & AllSpellCooldownMask)) + { + } + + return(retMask); +} + +void afxSpellBook::unpackUpdate(NetConnection * con, BitStream * stream) +{ + Parent::unpackUpdate(con, stream); + + // InitialUpdate + if (stream->readFlag()) + { + } + + // AllSpellCooldown + if (stream->readFlag()) + { + all_spell_cooldown = 0.0f; + } +} + +#define SPELL_DATA_NOT_FOUND "\n** Spell data not found **\n\n\n\n" + +char* afxSpellBook::formatDesc(char* buffer, int len, S32 page, S32 slot) const +{ + S32 idx = mDataBlock->getPageSlotIndex(page, slot); + if (idx < 0 || !mDataBlock->rpg_spells[idx]) + return SPELL_DATA_NOT_FOUND; + + return mDataBlock->rpg_spells[idx]->formatDesc(buffer, len); +} + +const char* afxSpellBook::getSpellIcon(S32 page, S32 slot) const +{ + S32 idx = mDataBlock->getPageSlotIndex(page, slot); + if (idx < 0 || !mDataBlock->rpg_spells[idx]) + return 0; + + return mDataBlock->rpg_spells[idx]->icon_name; +} + +bool afxSpellBook::isPlaceholder(S32 page, S32 slot) const +{ + S32 idx = mDataBlock->getPageSlotIndex(page, slot); + if (idx < 0 || !mDataBlock->rpg_spells[idx]) + return false; + + return mDataBlock->rpg_spells[idx]->is_placeholder; +} + + +afxMagicSpellData* afxSpellBook::getSpellData(S32 page, S32 slot) +{ + S32 idx = mDataBlock->getPageSlotIndex(page, slot); + if (idx < 0 || !mDataBlock->spells[idx]) + return 0; + + return mDataBlock->spells[idx]; +} + +afxRPGMagicSpellData* afxSpellBook::getSpellRPGData(S32 page, S32 slot) +{ + S32 idx = mDataBlock->getPageSlotIndex(page, slot); + if (idx < 0 || !mDataBlock->rpg_spells[idx]) + return 0; + + return mDataBlock->rpg_spells[idx]; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxSpellBook::startAllSpellCooldown() +{ + //all_spell_cooldown = 0.0f; + setMaskBits(AllSpellCooldownMask); +} + +F32 afxSpellBook::getCooldownFactor(S32 page, S32 slot) +{ + return all_spell_cooldown; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxSpellBook, getPageSlotIndex, S32, (Point2I bookSlot),, + "...\n\n" + "@ingroup AFX") +{ + return object->getPageSlotIndex(bookSlot.x, bookSlot.y); +} + +DefineEngineMethod(afxSpellBook, getSpellData, S32, (Point2I bookSlot),, + "Get spell datablock for spell stored at spellbook index, (page, slot).\n\n" + "@ingroup AFX") +{ + afxMagicSpellData* spell_data = object->getSpellData(bookSlot.x, bookSlot.y); + return (spell_data) ? spell_data->getId() : 0; +} + +DefineEngineMethod(afxSpellBook, getSpellRPGData, S32, (Point2I bookSlot),, + "Get spell RPG datablock for spell stored at spellbook index, (page, slot).\n\n" + "@ingroup AFX") +{ + afxRPGMagicSpellData* spell_data = object->getSpellRPGData(bookSlot.x, bookSlot.y); + return (spell_data) ? spell_data->getId() : 0; +} + +DefineEngineMethod(afxSpellBook, startAllSpellCooldown, void, (),, + "...\n\n" + "@ingroup AFX") +{ + object->startAllSpellCooldown(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + + diff --git a/Engine/source/afx/afxSpellBook.h b/Engine/source/afx/afxSpellBook.h new file mode 100644 index 000000000..d802c37ce --- /dev/null +++ b/Engine/source/afx/afxSpellBook.h @@ -0,0 +1,142 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_SPELL_BOOK_H_ +#define _AFX_SPELL_BOOK_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "T3D/gameBase/gameBase.h" + +class afxSpellBookDefs +{ +public: + enum { + MAX_SPELLS_PER_PAGE = 12, + MAX_PAGES_PER_BOOK = 12 + }; +}; + +class afxMagicSpellData; +class afxRPGMagicSpellData; + +class afxSpellBookData : public GameBaseData, public afxSpellBookDefs +{ + typedef GameBaseData Parent; + + bool do_id_convert; + +public: + U8 spells_per_page; + U8 pages_per_book; + afxMagicSpellData* spells[MAX_PAGES_PER_BOOK*MAX_SPELLS_PER_PAGE]; + afxRPGMagicSpellData* rpg_spells[MAX_PAGES_PER_BOOK*MAX_SPELLS_PER_PAGE]; + +public: + /*C*/ afxSpellBookData(); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + bool verifyPageSlot(S32 page, S32 slot); + S32 getPageSlotIndex(S32 page, S32 slot); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxSpellBookData); + DECLARE_CATEGORY("AFX"); +}; + +inline bool afxSpellBookData::verifyPageSlot(S32 page, S32 slot) +{ + return (page >= 0 && page < pages_per_book && slot >= 0 && slot < spells_per_page); +} + +inline S32 afxSpellBookData::getPageSlotIndex(S32 page, S32 slot) +{ + return (verifyPageSlot(page, slot)) ? page*spells_per_page + slot : -1; +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxMagicSpellData; +class afxSpellButton; + +class afxSpellBook : public GameBase, public afxSpellBookDefs +{ + typedef GameBase Parent; + + enum MaskBits + { + AllSpellCooldownMask = Parent::NextFreeMask << 0, + NextFreeMask = Parent::NextFreeMask << 1 + }; + +private: + afxSpellBookData* mDataBlock; + F32 all_spell_cooldown; + +public: + /*C*/ afxSpellBook(); + /*D*/ ~afxSpellBook(); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual void processTick(const Move*); + virtual void advanceTime(F32 dt); + + virtual bool onAdd(); + virtual void onRemove(); + + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + + static void initPersistFields(); + + S32 getPageSlotIndex(S32 page, S32 slot); + char* formatDesc(char* buffer, int len, S32 page, S32 slot) const; + const char* getSpellIcon(S32 page, S32 slot) const; + bool isPlaceholder(S32 page, S32 slot) const; + afxMagicSpellData* getSpellData(S32 page, S32 slot); + afxRPGMagicSpellData* getSpellRPGData(S32 page, S32 slot); + + void startAllSpellCooldown(); + F32 getCooldownFactor(S32 page, S32 slot); + + DECLARE_CONOBJECT(afxSpellBook); + DECLARE_CATEGORY("AFX"); +}; + +inline S32 afxSpellBook::getPageSlotIndex(S32 page, S32 slot) +{ + return (mDataBlock) ? mDataBlock->getPageSlotIndex(page, slot) : -1; +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_SPELL_BOOK_H_ diff --git a/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.cpp b/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.cpp new file mode 100644 index 000000000..442751a1f --- /dev/null +++ b/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.cpp @@ -0,0 +1,311 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "materials/shaderData.h" +#include "gfx/gfxTransformSaver.h" +#include "scene/sceneRenderState.h" +#include "collision/concretePolyList.h" +#include "T3D/tsStatic.h" +#include "gfx/primBuilder.h" + +#include "afx/ce/afxZodiacMgr.h" +#include "afx/afxZodiacGroundPlaneRenderer_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +const RenderInstType afxZodiacGroundPlaneRenderer::RIT_GroundPlaneZodiac("GroundPlaneZodiac"); + +afxZodiacGroundPlaneRenderer* afxZodiacGroundPlaneRenderer::master = 0; + +IMPLEMENT_CONOBJECT(afxZodiacGroundPlaneRenderer); + +ConsoleDocClass( afxZodiacGroundPlaneRenderer, + "@brief A render bin for zodiac rendering on GroundPlane objects.\n\n" + + "This bin renders instances of AFX zodiac effects onto GroundPlane surfaces.\n\n" + + "@ingroup RenderBin\n" + "@ingroup AFX\n" +); + +afxZodiacGroundPlaneRenderer::afxZodiacGroundPlaneRenderer() +: RenderBinManager(RIT_GroundPlaneZodiac, 1.0f, 1.0f) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacGroundPlaneRenderer::afxZodiacGroundPlaneRenderer(F32 renderOrder, F32 processAddOrder) +: RenderBinManager(RIT_GroundPlaneZodiac, renderOrder, processAddOrder) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacGroundPlaneRenderer::~afxZodiacGroundPlaneRenderer() +{ + if (this == master) + master = 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxZodiacGroundPlaneRenderer::initShader() +{ + if (shader_initialized) + return; + + shader_initialized = true; + + shader_consts = 0; + norm_norefl_zb_SB = norm_refl_zb_SB; + add_norefl_zb_SB = add_refl_zb_SB; + sub_norefl_zb_SB = sub_refl_zb_SB; + + zodiac_shader = afxZodiacMgr::getGroundPlaneZodiacShader(); + if (!zodiac_shader) + return; + + GFXStateBlockDesc d; + + d.cullDefined = true; + d.ffLighting = false; + d.blendDefined = true; + d.blendEnable = true; + d.zDefined = false; + d.zEnable = true; + d.zWriteEnable = false; + d.zFunc = GFXCmpLessEqual; + d.zSlopeBias = 0; + d.alphaDefined = true; + d.alphaTestEnable = true; + d.alphaTestRef = 0; + d.alphaTestFunc = GFXCmpGreater; + d.samplersDefined = true; + d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); + + // normal + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendInvSrcAlpha; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + norm_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + norm_refl_zb_SB = GFX->createStateBlock(d); + + // additive + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendOne; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + add_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + add_refl_zb_SB = GFX->createStateBlock(d); + + // subtractive + d.blendSrc = GFXBlendZero; + d.blendDest = GFXBlendInvSrcColor; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + sub_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + sub_refl_zb_SB = GFX->createStateBlock(d); + + shader_consts = zodiac_shader->getShader()->allocConstBuffer(); + projection_sc = zodiac_shader->getShader()->getShaderConstHandle("$modelView"); + color_sc = zodiac_shader->getShader()->getShaderConstHandle("$zodiacColor"); +} + +void afxZodiacGroundPlaneRenderer::clear() +{ + Parent::clear(); + groundPlane_zodiacs.clear(); +} + +void afxZodiacGroundPlaneRenderer::addZodiac(U32 zode_idx, const Point3F& pos, F32 ang, const GroundPlane* gp, F32 camDist) +{ + groundPlane_zodiacs.increment(); + GroundPlaneZodiacElem& elem = groundPlane_zodiacs.last(); + + elem.gp = gp; + elem.zode_idx = zode_idx; + elem.ang = ang; + elem.camDist = camDist; +} + +afxZodiacGroundPlaneRenderer* afxZodiacGroundPlaneRenderer::getMaster() +{ + if (!master) + master = new afxZodiacGroundPlaneRenderer; + return master; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +GFXStateBlock* afxZodiacGroundPlaneRenderer::chooseStateBlock(U32 blend, bool isReflectPass) +{ + GFXStateBlock* sb = 0; + + switch (blend) + { + case afxZodiacData::BLEND_ADDITIVE: + sb = (isReflectPass) ? add_refl_zb_SB : add_norefl_zb_SB; + break; + case afxZodiacData::BLEND_SUBTRACTIVE: + sb = (isReflectPass) ? sub_refl_zb_SB : sub_norefl_zb_SB; + break; + default: // afxZodiacData::BLEND_NORMAL: + sb = (isReflectPass) ? norm_refl_zb_SB : norm_norefl_zb_SB; + break; + } + + return sb; +} + +void afxZodiacGroundPlaneRenderer::render(SceneRenderState* state) +{ + PROFILE_SCOPE(afxRenderZodiacGroundPlaneMgr_render); + + // Early out if no ground-plane zodiacs to draw. + if (groundPlane_zodiacs.size() == 0) + return; + + initShader(); + if (!zodiac_shader) + return; + + bool is_reflect_pass = state->isReflectPass(); + + // Automagically save & restore our viewport and transforms. + GFXTransformSaver saver; + + MatrixF proj = GFX->getProjectionMatrix(); + + // Set up world transform + MatrixF world = GFX->getWorldMatrix(); + proj.mul(world); + shader_consts->set(projection_sc, proj); + + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + // RENDER EACH ZODIAC + // + for (S32 zz = 0; zz < groundPlane_zodiacs.size(); zz++) + { + GroundPlaneZodiacElem& elem = groundPlane_zodiacs[zz]; + + afxZodiacMgr::ZodiacSpec* zode = &afxZodiacMgr::terr_zodes[elem.zode_idx]; + if (!zode) + continue; + + if (is_reflect_pass) + { + //if ((zode->zflags & afxZodiacData::SHOW_IN_REFLECTIONS) == 0) + continue; + } + else + { + if ((zode->zflags & afxZodiacData::SHOW_IN_NON_REFLECTIONS) == 0) + continue; + } + + F32 fadebias = zode->calcDistanceFadeBias(elem.camDist); + if (fadebias < 0.01f) + continue; + + F32 cos_ang = mCos(elem.ang); + F32 sin_ang = mSin(elem.ang); + + GFXStateBlock* sb = chooseStateBlock(zode->zflags & afxZodiacData::BLEND_MASK, is_reflect_pass); + + GFX->setShader(zodiac_shader->getShader()); + GFX->setStateBlock(sb); + GFX->setShaderConstBuffer(shader_consts); + + // set the texture + GFX->setTexture(0, *zode->txr); + LinearColorF zode_color = (LinearColorF)zode->color; + zode_color.alpha *= fadebias; + shader_consts->set(color_sc, zode_color); + + F32 rad_xy = zode->radius_xy; + F32 inv_radius = 1.0f/rad_xy; + F32 offset_xy = mSqrt(2*rad_xy*rad_xy); + + F32 zx = zode->pos.x; + F32 zy = zode->pos.y; + F32 z = 0.00001f; + + Point3F verts[4]; + verts[0].set(zx+offset_xy, zy+offset_xy, z); + verts[1].set(zx-offset_xy, zy+offset_xy, z); + verts[2].set(zx-offset_xy, zy-offset_xy, z); + verts[3].set(zx+offset_xy, zy-offset_xy, z); + + S32 vertind[6]; + vertind[0] = 2; + vertind[1] = 1; + vertind[2] = 0; + vertind[3] = 3; + vertind[4] = 2; + vertind[5] = 0; + + PrimBuild::begin(GFXTriangleList, 6); + for (U32 i = 0; i < 2; i++) + { + for (U32 j = 0; j < 3; j++) + { + const Point3F& vtx = verts[vertind[i*3+j]]; + + // compute UV + F32 u1 = (vtx.x - zode->pos.x)*inv_radius; + F32 v1 = (vtx.y - zode->pos.y)*inv_radius; + F32 ru1 = u1*cos_ang - v1*sin_ang; + F32 rv1 = u1*sin_ang + v1*cos_ang; + + F32 uu = (ru1 + 1.0f)/2.0f; + F32 vv = 1.0f - (rv1 + 1.0f)/2.0f; + + PrimBuild::texCoord2f(uu, vv); + PrimBuild::vertex3fv(vtx); + } + } + PrimBuild::end(false); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h b/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h new file mode 100644 index 000000000..862c2bc86 --- /dev/null +++ b/Engine/source/afx/afxZodiacGroundPlaneRenderer_T3D.h @@ -0,0 +1,91 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_GROUNDPLANE_RENDERER_H_ +#define _AFX_ZODIAC_GROUNDPLANE_RENDERER_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "renderInstance/renderBinManager.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class ConcretePolyList; +class GroundPlane; + +class afxZodiacGroundPlaneRenderer : public RenderBinManager +{ + typedef RenderBinManager Parent; + + struct GroundPlaneZodiacElem + { + const GroundPlane* gp; + U32 zode_idx; + F32 ang; + F32 camDist; + }; + + Vector groundPlane_zodiacs; + static afxZodiacGroundPlaneRenderer* master; + + GFXStateBlockRef norm_norefl_zb_SB, norm_refl_zb_SB; + GFXStateBlockRef add_norefl_zb_SB, add_refl_zb_SB; + GFXStateBlockRef sub_norefl_zb_SB, sub_refl_zb_SB; + + ShaderData* zodiac_shader; + GFXShaderConstBufferRef shader_consts; + GFXShaderConstHandle* projection_sc; + GFXShaderConstHandle* color_sc; + + bool shader_initialized; + + GFXStateBlock* chooseStateBlock(U32 blend, bool isReflectPass); + +public: + static const RenderInstType RIT_GroundPlaneZodiac; + + /*C*/ afxZodiacGroundPlaneRenderer(); + /*C*/ afxZodiacGroundPlaneRenderer(F32 renderOrder, F32 processAddOrder); + /*D*/ ~afxZodiacGroundPlaneRenderer(); + + // RenderBinManager + virtual void sort(){} // don't sort them + virtual void clear(); + + void initShader(); + void addZodiac(U32 zode_idx, const Point3F& pos, F32 ang, const GroundPlane*, F32 camDist); + + virtual void render(SceneRenderState* state); + + static afxZodiacGroundPlaneRenderer* getMaster(); + + // ConsoleObject + DECLARE_CONOBJECT(afxZodiacGroundPlaneRenderer); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_GROUNDPLANE_RENDERER_H_ diff --git a/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.cpp b/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.cpp new file mode 100644 index 000000000..cafb3dca7 --- /dev/null +++ b/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.cpp @@ -0,0 +1,302 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "materials/shaderData.h" +#include "gfx/gfxTransformSaver.h" +#include "scene/sceneRenderState.h" +#include "collision/concretePolyList.h" +#include "T3D/tsStatic.h" +#include "gfx/primBuilder.h" + +#include "afx/ce/afxZodiacMgr.h" +#include "afx/afxZodiacMeshRoadRenderer_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +const RenderInstType afxZodiacMeshRoadRenderer::RIT_MeshRoadZodiac("MeshRoadZodiac"); + +afxZodiacMeshRoadRenderer* afxZodiacMeshRoadRenderer::master = 0; + +IMPLEMENT_CONOBJECT(afxZodiacMeshRoadRenderer); + +ConsoleDocClass( afxZodiacMeshRoadRenderer, + "@brief A render bin for zodiac rendering on MeshRoad objects.\n\n" + + "This bin renders instances of AFX zodiac effects onto MeshRoad surfaces.\n\n" + + "@ingroup RenderBin\n" + "@ingroup AFX\n" +); + +afxZodiacMeshRoadRenderer::afxZodiacMeshRoadRenderer() +: RenderBinManager(RIT_MeshRoadZodiac, 1.0f, 1.0f) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacMeshRoadRenderer::afxZodiacMeshRoadRenderer(F32 renderOrder, F32 processAddOrder) +: RenderBinManager(RIT_MeshRoadZodiac, renderOrder, processAddOrder) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacMeshRoadRenderer::~afxZodiacMeshRoadRenderer() +{ + if (this == master) + master = 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxZodiacMeshRoadRenderer::initShader() +{ + if (shader_initialized) + return; + + shader_initialized = true; + + shader_consts = 0; + norm_norefl_zb_SB = norm_refl_zb_SB; + add_norefl_zb_SB = add_refl_zb_SB; + sub_norefl_zb_SB = sub_refl_zb_SB; + + zodiac_shader = afxZodiacMgr::getMeshRoadZodiacShader(); + if (!zodiac_shader) + return; + + GFXStateBlockDesc d; + + d.cullDefined = true; + d.ffLighting = false; + d.blendDefined = true; + d.blendEnable = true; + d.zDefined = false; + d.zEnable = true; + d.zWriteEnable = false; + d.zFunc = GFXCmpLessEqual; + d.zSlopeBias = 0; + d.alphaDefined = true; + d.alphaTestEnable = true; + d.alphaTestRef = 0; + d.alphaTestFunc = GFXCmpGreater; + d.samplersDefined = true; + d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); + + // normal + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendInvSrcAlpha; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + norm_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + norm_refl_zb_SB = GFX->createStateBlock(d); + + // additive + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendOne; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + add_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + add_refl_zb_SB = GFX->createStateBlock(d); + + // subtractive + d.blendSrc = GFXBlendZero; + d.blendDest = GFXBlendInvSrcColor; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + sub_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + sub_refl_zb_SB = GFX->createStateBlock(d); + + shader_consts = zodiac_shader->getShader()->allocConstBuffer(); + projection_sc = zodiac_shader->getShader()->getShaderConstHandle("$modelView"); + color_sc = zodiac_shader->getShader()->getShaderConstHandle("$zodiacColor"); +} + +void afxZodiacMeshRoadRenderer::clear() +{ + Parent::clear(); + for (S32 i = 0; i < meshRoad_zodiacs.size(); i++) + if (meshRoad_zodiacs[i].polys) + delete meshRoad_zodiacs[i].polys; + meshRoad_zodiacs.clear(); +} + +void afxZodiacMeshRoadRenderer::addZodiac(U32 zode_idx, ConcretePolyList* polys, const Point3F& pos, F32 ang, const MeshRoad* road, F32 camDist) +{ + meshRoad_zodiacs.increment(); + MeshRoadZodiacElem& elem = meshRoad_zodiacs.last(); + + elem.road = road; + elem.polys = polys; + elem.zode_idx = zode_idx; + elem.ang = ang; + elem.camDist = camDist; +} + +afxZodiacMeshRoadRenderer* afxZodiacMeshRoadRenderer::getMaster() +{ + if (!master) + master = new afxZodiacMeshRoadRenderer; + return master; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +GFXStateBlock* afxZodiacMeshRoadRenderer::chooseStateBlock(U32 blend, bool isReflectPass) +{ + GFXStateBlock* sb = 0; + + switch (blend) + { + case afxZodiacData::BLEND_ADDITIVE: + sb = (isReflectPass) ? add_refl_zb_SB : add_norefl_zb_SB; + break; + case afxZodiacData::BLEND_SUBTRACTIVE: + sb = (isReflectPass) ? sub_refl_zb_SB : sub_norefl_zb_SB; + break; + default: // afxZodiacData::BLEND_NORMAL: + sb = (isReflectPass) ? norm_refl_zb_SB : norm_norefl_zb_SB; + break; + } + + return sb; +} + +void afxZodiacMeshRoadRenderer::render(SceneRenderState* state) +{ + PROFILE_SCOPE(afxRenderZodiacMeshRoadMgr_render); + + // Early out if no ground-plane zodiacs to draw. + if (meshRoad_zodiacs.size() == 0) + return; + + initShader(); + if (!zodiac_shader) + return; + + bool is_reflect_pass = state->isReflectPass(); + + // Automagically save & restore our viewport and transforms. + GFXTransformSaver saver; + + MatrixF proj = GFX->getProjectionMatrix(); + + // Set up world transform + MatrixF world = GFX->getWorldMatrix(); + proj.mul(world); + shader_consts->set(projection_sc, proj); + + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + // RENDER EACH ZODIAC + // + for (S32 zz = 0; zz < meshRoad_zodiacs.size(); zz++) + { + MeshRoadZodiacElem& elem = meshRoad_zodiacs[zz]; + + afxZodiacMgr::ZodiacSpec* zode = &afxZodiacMgr::terr_zodes[elem.zode_idx]; + if (!zode) + continue; + + if (is_reflect_pass) + { + if ((zode->zflags & afxZodiacData::SHOW_IN_REFLECTIONS) == 0) + continue; + } + else + { + if ((zode->zflags & afxZodiacData::SHOW_IN_NON_REFLECTIONS) == 0) + continue; + } + + F32 fadebias = zode->calcDistanceFadeBias(elem.camDist); + if (fadebias < 0.01f) + continue; + + F32 cos_ang = mCos(elem.ang); + F32 sin_ang = mSin(elem.ang); + + GFXStateBlock* sb = chooseStateBlock(zode->zflags & afxZodiacData::BLEND_MASK, is_reflect_pass); + + GFX->setShader(zodiac_shader->getShader()); + GFX->setStateBlock(sb); + GFX->setShaderConstBuffer(shader_consts); + + // set the texture + GFX->setTexture(0, *zode->txr); + LinearColorF zode_color = (LinearColorF)zode->color; + zode_color.alpha *= fadebias; + shader_consts->set(color_sc, zode_color); + + F32 inv_radius = 1.0f/zode->radius_xy; + + PrimBuild::begin(GFXTriangleList, 3*elem.polys->mPolyList.size()); + for (U32 i = 0; i < elem.polys->mPolyList.size(); i++) + { + ConcretePolyList::Poly* poly = &elem.polys->mPolyList[i]; + + S32 vertind[3]; + vertind[0] = elem.polys->mIndexList[poly->vertexStart]; + vertind[1] = elem.polys->mIndexList[poly->vertexStart + 1]; + vertind[2] = elem.polys->mIndexList[poly->vertexStart + 2]; + + for (U32 j = 0; j < 3; j++) + { + Point3F vtx = elem.polys->mVertexList[vertind[j]]; + + // compute UV + F32 u1 = (vtx.x - zode->pos.x)*inv_radius; + F32 v1 = (vtx.y - zode->pos.y)*inv_radius; + F32 ru1 = u1*cos_ang - v1*sin_ang; + F32 rv1 = u1*sin_ang + v1*cos_ang; + + F32 uu = (ru1 + 1.0f)/2.0f; + F32 vv = 1.0f - (rv1 + 1.0f)/2.0f; + + PrimBuild::texCoord2f(uu, vv); + PrimBuild::vertex3fv(vtx); + } + } + PrimBuild::end(false); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h b/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h new file mode 100644 index 000000000..bc8477bef --- /dev/null +++ b/Engine/source/afx/afxZodiacMeshRoadRenderer_T3D.h @@ -0,0 +1,92 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_MESHROAD_RENDERER_H_ +#define _AFX_ZODIAC_MESHROAD_RENDERER_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "renderInstance/renderBinManager.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class ConcretePolyList; +class MeshRoad; + +class afxZodiacMeshRoadRenderer : public RenderBinManager +{ + typedef RenderBinManager Parent; + + struct MeshRoadZodiacElem + { + const MeshRoad* road; + U32 zode_idx; + ConcretePolyList* polys; + F32 ang; + F32 camDist; + }; + + Vector meshRoad_zodiacs; + static afxZodiacMeshRoadRenderer* master; + + GFXStateBlockRef norm_norefl_zb_SB, norm_refl_zb_SB; + GFXStateBlockRef add_norefl_zb_SB, add_refl_zb_SB; + GFXStateBlockRef sub_norefl_zb_SB, sub_refl_zb_SB; + + ShaderData* zodiac_shader; + GFXShaderConstBufferRef shader_consts; + GFXShaderConstHandle* projection_sc; + GFXShaderConstHandle* color_sc; + + bool shader_initialized; + + GFXStateBlock* chooseStateBlock(U32 blend, bool isReflectPass); + +public: + static const RenderInstType RIT_MeshRoadZodiac; + + /*C*/ afxZodiacMeshRoadRenderer(); + /*C*/ afxZodiacMeshRoadRenderer(F32 renderOrder, F32 processAddOrder); + /*D*/ ~afxZodiacMeshRoadRenderer(); + + // RenderBinManager + virtual void sort(){} // don't sort them + virtual void clear(); + + void initShader(); + void addZodiac(U32 zode_idx, ConcretePolyList*, const Point3F& pos, F32 ang, const MeshRoad*, F32 camDist); + + virtual void render(SceneRenderState*); + + static afxZodiacMeshRoadRenderer* getMaster(); + + // ConsoleObject + DECLARE_CONOBJECT(afxZodiacMeshRoadRenderer); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_MESHROAD_RENDERER_H_ diff --git a/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.cpp b/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.cpp new file mode 100644 index 000000000..84d55a092 --- /dev/null +++ b/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.cpp @@ -0,0 +1,420 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "materials/shaderData.h" +#include "gfx/gfxTransformSaver.h" +#include "scene/sceneRenderState.h" +#include "collision/concretePolyList.h" +#include "T3D/tsStatic.h" +#include "gfx/primBuilder.h" + +#include "afx/ce/afxZodiacMgr.h" +#include "afx/afxZodiacPolysoupRenderer_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +const RenderInstType afxZodiacPolysoupRenderer::RIT_PolysoupZodiac("PolysoupZodiac"); + +afxZodiacPolysoupRenderer* afxZodiacPolysoupRenderer::master = 0; + +IMPLEMENT_CONOBJECT(afxZodiacPolysoupRenderer); + +ConsoleDocClass( afxZodiacPolysoupRenderer, + "@brief A render bin for zodiac rendering on polysoup TSStatic objects.\n\n" + + "This bin renders instances of AFX zodiac effects onto polysoup TSStatic surfaces.\n\n" + + "@ingroup RenderBin\n" + "@ingroup AFX\n" +); + +afxZodiacPolysoupRenderer::afxZodiacPolysoupRenderer() +: RenderBinManager(RIT_PolysoupZodiac, 1.0f, 1.0f) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacPolysoupRenderer::afxZodiacPolysoupRenderer(F32 renderOrder, F32 processAddOrder) +: RenderBinManager(RIT_PolysoupZodiac, renderOrder, processAddOrder) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacPolysoupRenderer::~afxZodiacPolysoupRenderer() +{ + if (this == master) + master = 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxZodiacPolysoupRenderer::initShader() +{ + if (shader_initialized) + return; + + shader_initialized = true; + + shader_consts = 0; + norm_norefl_zb_SB = norm_refl_zb_SB; + add_norefl_zb_SB = add_refl_zb_SB; + sub_norefl_zb_SB = sub_refl_zb_SB; + + zodiac_shader = afxZodiacMgr::getPolysoupZodiacShader(); + if (!zodiac_shader) + return; + + GFXStateBlockDesc d; + + d.cullDefined = true; + d.ffLighting = false; + d.blendDefined = true; + d.blendEnable = true; + d.zDefined = false; + d.zEnable = true; + d.zWriteEnable = false; + d.zFunc = GFXCmpLessEqual; + d.zSlopeBias = 0; + d.alphaDefined = true; + d.alphaTestEnable = true; + d.alphaTestRef = 0; + d.alphaTestFunc = GFXCmpGreater; + d.samplersDefined = true; + d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); + + // normal + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendInvSrcAlpha; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + norm_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + norm_refl_zb_SB = GFX->createStateBlock(d); + + // additive + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendOne; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + add_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + add_refl_zb_SB = GFX->createStateBlock(d); + + // subtractive + d.blendSrc = GFXBlendZero; + d.blendDest = GFXBlendInvSrcColor; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + sub_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sPolysoupZodiacZBias; + sub_refl_zb_SB = GFX->createStateBlock(d); + + shader_consts = zodiac_shader->getShader()->allocConstBuffer(); + projection_sc = zodiac_shader->getShader()->getShaderConstHandle("$modelView"); + color_sc = zodiac_shader->getShader()->getShaderConstHandle("$zodiacColor"); +} + +void afxZodiacPolysoupRenderer::clear() +{ + Parent::clear(); + for (S32 i = 0; i < polysoup_zodes.size(); i++) + if (polysoup_zodes[i].polys) + delete polysoup_zodes[i].polys; + polysoup_zodes.clear(); +} + +void afxZodiacPolysoupRenderer::addZodiac(U32 zode_idx, ConcretePolyList* polys, const Point3F& pos, F32 ang, const TSStatic* tss, F32 camDist) +{ + polysoup_zodes.increment(); + PolysoupZodiacElem& elem = polysoup_zodes.last(); + + elem.tss = tss; + elem.polys = polys; + elem.zode_idx = zode_idx; + elem.ang = ang; + elem.camDist = camDist; +} + +afxZodiacPolysoupRenderer* afxZodiacPolysoupRenderer::getMaster() +{ + if (!master) + master = new afxZodiacPolysoupRenderer; + return master; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +GFXStateBlock* afxZodiacPolysoupRenderer::chooseStateBlock(U32 blend, bool isReflectPass) +{ + GFXStateBlock* sb = 0; + + switch (blend) + { + case afxZodiacData::BLEND_ADDITIVE: + sb = (isReflectPass) ? add_refl_zb_SB : add_norefl_zb_SB; + break; + case afxZodiacData::BLEND_SUBTRACTIVE: + sb = (isReflectPass) ? sub_refl_zb_SB : sub_norefl_zb_SB; + break; + default: // afxZodiacData::BLEND_NORMAL: + sb = (isReflectPass) ? norm_refl_zb_SB : norm_norefl_zb_SB; + break; + } + + return sb; +} + +void afxZodiacPolysoupRenderer::render(SceneRenderState* state) +{ + PROFILE_SCOPE(afxRenderZodiacPolysoupMgr_render); + + // Early out if no polysoup zodiacs to draw. + if (polysoup_zodes.size() == 0) + return; + + initShader(); + if (!zodiac_shader) + return; + + bool is_reflect_pass = state->isReflectPass(); + + // Automagically save & restore our viewport and transforms. + GFXTransformSaver saver; + + MatrixF proj = GFX->getProjectionMatrix(); + + // Set up world transform + MatrixF world = GFX->getWorldMatrix(); + proj.mul(world); + shader_consts->set(projection_sc, proj); + + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + // RENDER EACH ZODIAC + // + for (S32 zz = 0; zz < polysoup_zodes.size(); zz++) + { + PolysoupZodiacElem& elem = polysoup_zodes[zz]; + + afxZodiacMgr::ZodiacSpec* zode = &afxZodiacMgr::inter_zodes[elem.zode_idx]; + if (!zode) + continue; + + if (is_reflect_pass) + { + if ((zode->zflags & afxZodiacData::SHOW_IN_REFLECTIONS) == 0) + continue; + } + else + { + if ((zode->zflags & afxZodiacData::SHOW_IN_NON_REFLECTIONS) == 0) + continue; + } + + F32 fadebias = zode->calcDistanceFadeBias(elem.camDist); + if (fadebias < 0.01f) + continue; + + F32 cos_ang = mCos(elem.ang); + F32 sin_ang = mSin(elem.ang); + + GFXStateBlock* sb = chooseStateBlock(zode->zflags & afxZodiacData::BLEND_MASK, is_reflect_pass); + + GFX->setShader(zodiac_shader->getShader()); + GFX->setStateBlock(sb); + GFX->setShaderConstBuffer(shader_consts); + + // set the texture + GFX->setTexture(0, *zode->txr); + LinearColorF zode_color = (LinearColorF)zode->color; + zode_color.alpha *= fadebias; + shader_consts->set(color_sc, zode_color); + + F32 inv_radius = 1.0f/zode->radius_xy; + + // FILTER USING GRADIENT RANGE + if ((zode->zflags & afxZodiacData::USE_GRADE_RANGE) != 0) + { + bool skip_oob; + F32 grade_min, grade_max; + if (elem.tss->mHasGradients && ((zode->zflags & afxZodiacData::PREFER_DEST_GRADE) != 0)) + { + skip_oob = (elem.tss->mInvertGradientRange == false); + grade_min = elem.tss->mGradientRange.x; + grade_max = elem.tss->mGradientRange.y; + } + else + { + skip_oob = ((zode->zflags & afxZodiacData::INVERT_GRADE_RANGE) == 0); + grade_min = zode->grade_range.x; + grade_max = zode->grade_range.y; + } + + PrimBuild::begin(GFXTriangleList, 3*elem.polys->mPolyList.size()); + for (U32 i = 0; i < elem.polys->mPolyList.size(); i++) + { + ConcretePolyList::Poly* poly = &elem.polys->mPolyList[i]; + + const PlaneF& plane = poly->plane; + + bool oob = (plane.z > grade_max || plane.z < grade_min); + if (oob == skip_oob) + continue; + + S32 vertind[3]; + vertind[0] = elem.polys->mIndexList[poly->vertexStart]; + vertind[1] = elem.polys->mIndexList[poly->vertexStart + 1]; + vertind[2] = elem.polys->mIndexList[poly->vertexStart + 2]; + + for (U32 j = 0; j < 3; j++) + { + Point3F vtx = elem.polys->mVertexList[vertind[j]]; + + // compute UV + F32 u1 = (vtx.x - zode->pos.x)*inv_radius; + F32 v1 = (vtx.y - zode->pos.y)*inv_radius; + F32 ru1 = u1*cos_ang - v1*sin_ang; + F32 rv1 = u1*sin_ang + v1*cos_ang; + + F32 uu = (ru1 + 1.0f)/2.0f; + F32 vv = 1.0f - (rv1 + 1.0f)/2.0f; + + PrimBuild::texCoord2f(uu, vv); + PrimBuild::vertex3fv(vtx); + } + } + PrimBuild::end(false); + } + + // FILTER USING OTHER FILTERS + else if (zode->zflags & afxZodiacData::INTERIOR_FILTERS) + { + PrimBuild::begin(GFXTriangleList, 3*elem.polys->mPolyList.size()); + for (U32 i = 0; i < elem.polys->mPolyList.size(); i++) + { + ConcretePolyList::Poly* poly = &elem.polys->mPolyList[i]; + + const PlaneF& plane = poly->plane; + if (zode->zflags & afxZodiacData::INTERIOR_HORIZ_ONLY) + { + if (!plane.isHorizontal()) + continue; + + if (zode->zflags & afxZodiacData::INTERIOR_BACK_IGNORE) + { + if (plane.whichSide(zode->pos) == PlaneF::Back) + continue; + } + } + else + { + if (zode->zflags & afxZodiacData::INTERIOR_VERT_IGNORE) + { + if (plane.isVertical()) + continue; + } + + if (zode->zflags & afxZodiacData::INTERIOR_BACK_IGNORE) + { + if (plane.whichSide(zode->pos) == PlaneF::Back) + continue; + } + } + + S32 vertind[3]; + vertind[0] = elem.polys->mIndexList[poly->vertexStart]; + vertind[1] = elem.polys->mIndexList[poly->vertexStart + 1]; + vertind[2] = elem.polys->mIndexList[poly->vertexStart + 2]; + + for (U32 j = 0; j < 3; j++) + { + Point3F vtx = elem.polys->mVertexList[vertind[j]]; + + // compute UV + F32 u1 = (vtx.x - zode->pos.x)*inv_radius; + F32 v1 = (vtx.y - zode->pos.y)*inv_radius; + F32 ru1 = u1*cos_ang - v1*sin_ang; + F32 rv1 = u1*sin_ang + v1*cos_ang; + + F32 uu = (ru1 + 1.0f)/2.0f; + F32 vv = 1.0f - (rv1 + 1.0f)/2.0f; + + PrimBuild::texCoord2f(uu, vv); + PrimBuild::vertex3fv(vtx); + } + } + PrimBuild::end(false); + } + + // NO FILTERING + else + { + PrimBuild::begin(GFXTriangleList, 3*elem.polys->mPolyList.size()); + for (U32 i = 0; i < elem.polys->mPolyList.size(); i++) + { + ConcretePolyList::Poly* poly = &elem.polys->mPolyList[i]; + + S32 vertind[3]; + vertind[0] = elem.polys->mIndexList[poly->vertexStart]; + vertind[1] = elem.polys->mIndexList[poly->vertexStart + 1]; + vertind[2] = elem.polys->mIndexList[poly->vertexStart + 2]; + + for (U32 j = 0; j < 3; j++) + { + Point3F vtx = elem.polys->mVertexList[vertind[j]]; + + // compute UV + F32 u1 = (vtx.x - zode->pos.x)*inv_radius; + F32 v1 = (vtx.y - zode->pos.y)*inv_radius; + F32 ru1 = u1*cos_ang - v1*sin_ang; + F32 rv1 = u1*sin_ang + v1*cos_ang; + + F32 uu = (ru1 + 1.0f)/2.0f; + F32 vv = 1.0f - (rv1 + 1.0f)/2.0f; + + PrimBuild::texCoord2f(uu, vv); + PrimBuild::vertex3fv(vtx); + } + } + PrimBuild::end(false); + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h b/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h new file mode 100644 index 000000000..a01dffd34 --- /dev/null +++ b/Engine/source/afx/afxZodiacPolysoupRenderer_T3D.h @@ -0,0 +1,92 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_POLYSOUP_RENDERER_H_ +#define _AFX_ZODIAC_POLYSOUP_RENDERER_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "renderInstance/renderBinManager.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class ConcretePolyList; +class TSStatic; + +class afxZodiacPolysoupRenderer : public RenderBinManager +{ + typedef RenderBinManager Parent; + + struct PolysoupZodiacElem + { + const TSStatic* tss; + U32 zode_idx; + ConcretePolyList* polys; + F32 ang; + F32 camDist; + }; + + Vector polysoup_zodes; + static afxZodiacPolysoupRenderer* master; + + GFXStateBlockRef norm_norefl_zb_SB, norm_refl_zb_SB; + GFXStateBlockRef add_norefl_zb_SB, add_refl_zb_SB; + GFXStateBlockRef sub_norefl_zb_SB, sub_refl_zb_SB; + + ShaderData* zodiac_shader; + GFXShaderConstBufferRef shader_consts; + GFXShaderConstHandle* projection_sc; + GFXShaderConstHandle* color_sc; + + bool shader_initialized; + + GFXStateBlock* chooseStateBlock(U32 blend, bool isReflectPass); + +public: + static const RenderInstType RIT_PolysoupZodiac; + + /*C*/ afxZodiacPolysoupRenderer(); + /*C*/ afxZodiacPolysoupRenderer(F32 renderOrder, F32 processAddOrder); + /*D*/ ~afxZodiacPolysoupRenderer(); + + // RenderBinManager + virtual void sort(){} // don't sort them + virtual void clear(); + + void initShader(); + void addZodiac(U32 zode_idx, ConcretePolyList*, const Point3F& pos, F32 ang, const TSStatic*, F32 camDist); + + virtual void render(SceneRenderState*); + + static afxZodiacPolysoupRenderer* getMaster(); + + // ConsoleObject + DECLARE_CONOBJECT(afxZodiacPolysoupRenderer); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_POLYSOUP_RENDERER_H_ diff --git a/Engine/source/afx/afxZodiacTerrainRenderer_T3D.cpp b/Engine/source/afx/afxZodiacTerrainRenderer_T3D.cpp new file mode 100644 index 000000000..651a0fad0 --- /dev/null +++ b/Engine/source/afx/afxZodiacTerrainRenderer_T3D.cpp @@ -0,0 +1,344 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "materials/shaderData.h" +#include "gfx/gfxTransformSaver.h" +#include "scene/sceneRenderState.h" +#include "terrain/terrData.h" +#include "terrain/terrCell.h" + +#include "gfx/primBuilder.h" + +#include "afx/ce/afxZodiacMgr.h" +#include "afx/afxZodiacTerrainRenderer_T3D.h" +#include "afx/util/afxTriBoxCheck2D_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class TerrCellSpy : public TerrCell +{ +public: + static const U32 getMinCellSize() { return smMinCellSize; } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +const RenderInstType afxZodiacTerrainRenderer::RIT_TerrainZodiac("TerrainZodiac"); + +afxZodiacTerrainRenderer* afxZodiacTerrainRenderer::master = 0; + +IMPLEMENT_CONOBJECT(afxZodiacTerrainRenderer); + +ConsoleDocClass( afxZodiacTerrainRenderer, + "@brief A render bin for zodiac rendering on Terrain objects.\n\n" + + "This bin renders instances of AFX zodiac effects onto Terrain surfaces.\n\n" + + "@ingroup RenderBin\n" + "@ingroup AFX\n" +); + +afxZodiacTerrainRenderer::afxZodiacTerrainRenderer() +: RenderBinManager(RIT_TerrainZodiac, 1.0f, 1.0f) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacTerrainRenderer::afxZodiacTerrainRenderer(F32 renderOrder, F32 processAddOrder) +: RenderBinManager(RIT_TerrainZodiac, renderOrder, processAddOrder) +{ + if (!master) + master = this; + shader_initialized = false; +} + +afxZodiacTerrainRenderer::~afxZodiacTerrainRenderer() +{ + if (this == master) + master = 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxZodiacTerrainRenderer::initShader() +{ + if (shader_initialized) + return; + + shader_initialized = true; + + shader_consts = 0; + norm_norefl_zb_SB = norm_refl_zb_SB; + add_norefl_zb_SB = add_refl_zb_SB; + sub_norefl_zb_SB = sub_refl_zb_SB; + + zodiac_shader = afxZodiacMgr::getTerrainZodiacShader(); + if (!zodiac_shader) + return; + + GFXStateBlockDesc d; + + d.cullDefined = true; + d.ffLighting = false; + d.blendDefined = true; + d.blendEnable = true; + d.zDefined = false; + d.zEnable = true; + d.zWriteEnable = false; + d.zFunc = GFXCmpLessEqual; + d.zSlopeBias = 0; + d.alphaDefined = true; + d.alphaTestEnable = true; + d.alphaTestRef = 0; + d.alphaTestFunc = GFXCmpGreater; + d.samplersDefined = true; + d.samplers[0] = GFXSamplerStateDesc::getClampLinear(); + + // normal + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendInvSrcAlpha; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sTerrainZodiacZBias; + norm_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sTerrainZodiacZBias; + norm_refl_zb_SB = GFX->createStateBlock(d); + + // additive + d.blendSrc = GFXBlendSrcAlpha; + d.blendDest = GFXBlendOne; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sTerrainZodiacZBias; + add_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sTerrainZodiacZBias; + add_refl_zb_SB = GFX->createStateBlock(d); + + // subtractive + d.blendSrc = GFXBlendZero; + d.blendDest = GFXBlendInvSrcColor; + // + d.cullMode = GFXCullCCW; + d.zBias = arcaneFX::sTerrainZodiacZBias; + sub_norefl_zb_SB = GFX->createStateBlock(d); + // + d.cullMode = GFXCullCW; + d.zBias = arcaneFX::sTerrainZodiacZBias; + sub_refl_zb_SB = GFX->createStateBlock(d); + + shader_consts = zodiac_shader->getShader()->allocConstBuffer(); + projection_sc = zodiac_shader->getShader()->getShaderConstHandle("$modelView"); + color_sc = zodiac_shader->getShader()->getShaderConstHandle("$zodiacColor"); +} + +void afxZodiacTerrainRenderer::clear() +{ + Parent::clear(); + + terrain_zodes.clear(); +} + +void afxZodiacTerrainRenderer::addZodiac(U32 zode_idx, const Point3F& pos, F32 ang, + const TerrainBlock* block, const TerrCell* cell, + const MatrixF& mRenderObjToWorld, F32 camDist) +{ + terrain_zodes.increment(); + TerrainZodiacElem& elem = terrain_zodes.last(); + + elem.block = block; + elem.cell = cell; + elem.zode_idx = zode_idx; + elem.ang = ang; + elem.mRenderObjToWorld = mRenderObjToWorld; + elem.camDist = camDist; +} + +afxZodiacTerrainRenderer* afxZodiacTerrainRenderer::getMaster() +{ + if (!master) + master = new afxZodiacTerrainRenderer; + return master; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +GFXStateBlock* afxZodiacTerrainRenderer::chooseStateBlock(U32 blend, bool isReflectPass) +{ + GFXStateBlock* sb = 0; + + switch (blend) + { + case afxZodiacData::BLEND_ADDITIVE: + sb = (isReflectPass) ? add_refl_zb_SB : add_norefl_zb_SB; + break; + case afxZodiacData::BLEND_SUBTRACTIVE: + sb = (isReflectPass) ? sub_refl_zb_SB : sub_norefl_zb_SB; + break; + default: // afxZodiacData::BLEND_NORMAL: + sb = (isReflectPass) ? norm_refl_zb_SB : norm_norefl_zb_SB; + break; + } + + return sb; +} + +void afxZodiacTerrainRenderer::render(SceneRenderState* state) +{ + PROFILE_SCOPE(afxRenderZodiacTerrainMgr_render); + + // Early out if no terrain zodiacs to draw. + if (terrain_zodes.size() == 0) + return; + + initShader(); + if (!zodiac_shader) + return; + + bool is_reflect_pass = state->isReflectPass(); + + // Automagically save & restore our viewport and transforms. + GFXTransformSaver saver; + + MatrixF proj = GFX->getProjectionMatrix(); + + // Set up world transform + MatrixF world = GFX->getWorldMatrix(); + proj.mul(world); + shader_consts->set(projection_sc, proj); + + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + // RENDER EACH ZODIAC + // + for (S32 zz = 0; zz < terrain_zodes.size(); zz++) + { + TerrainZodiacElem& elem = terrain_zodes[zz]; + + TerrainBlock* block = (TerrainBlock*) elem.block; + + afxZodiacMgr::ZodiacSpec* zode = &afxZodiacMgr::terr_zodes[elem.zode_idx]; + if (!zode) + continue; + + if (is_reflect_pass) + { + if ((zode->zflags & afxZodiacData::SHOW_IN_REFLECTIONS) == 0) + continue; + } + else + { + if ((zode->zflags & afxZodiacData::SHOW_IN_NON_REFLECTIONS) == 0) + continue; + } + + F32 fadebias = zode->calcDistanceFadeBias(elem.camDist); + if (fadebias < 0.01f) + continue; + + F32 cos_ang = mCos(elem.ang); + F32 sin_ang = mSin(elem.ang); + + GFXStateBlock* sb = chooseStateBlock(zode->zflags & afxZodiacData::BLEND_MASK, is_reflect_pass); + + GFX->setShader(zodiac_shader->getShader()); + GFX->setStateBlock(sb); + GFX->setShaderConstBuffer(shader_consts); + + // set the texture + GFX->setTexture(0, *zode->txr); + LinearColorF zode_color = (LinearColorF)zode->color; + zode_color.alpha *= fadebias; + shader_consts->set(color_sc, zode_color); + + Point3F half_size(zode->radius_xy,zode->radius_xy,zode->radius_xy); + + F32 inv_radius = 1.0f/zode->radius_xy; + + GFXPrimitive cell_prim; + GFXVertexBufferHandle cell_verts; + GFXPrimitiveBufferHandle primBuff; + elem.cell->getRenderPrimitive(&cell_prim, &cell_verts, &primBuff); + + U32 n_nonskirt_tris = TerrCellSpy::getMinCellSize()*TerrCellSpy::getMinCellSize()*2; + + const Point3F* verts = ((TerrCell*)elem.cell)->getZodiacVertexBuffer(); + const U16 *tris = block->getZodiacPrimitiveBuffer(); + if (!tris) + continue; + + PrimBuild::begin(GFXTriangleList, 3*n_nonskirt_tris); + + ///////////////////////////////// + U32 n_overlapping_tris = 0; + U32 idx = 0; + for (U32 i = 0; i < n_nonskirt_tris; i++) + { + Point3F tri_v[3]; + tri_v[0] = verts[tris[idx++]]; + tri_v[1] = verts[tris[idx++]]; + tri_v[2] = verts[tris[idx++]]; + + elem.mRenderObjToWorld.mulP(tri_v[0]); + elem.mRenderObjToWorld.mulP(tri_v[1]); + elem.mRenderObjToWorld.mulP(tri_v[2]); + + if (!afxTriBoxOverlap2D(zode->pos, half_size, tri_v[0], tri_v[1], tri_v[2])) + continue; + + n_overlapping_tris++; + + for (U32 j = 0; j < 3; j++) + { + // compute UV + F32 u1 = (tri_v[j].x - zode->pos.x)*inv_radius; + F32 v1 = (tri_v[j].y - zode->pos.y)*inv_radius; + F32 ru1 = u1*cos_ang - v1*sin_ang; + F32 rv1 = u1*sin_ang + v1*cos_ang; + + F32 uu = (ru1 + 1.0f)/2.0f; + F32 vv = 1.0f - (rv1 + 1.0f)/2.0f; + + PrimBuild::texCoord2f(uu, vv); + PrimBuild::vertex3fv(tri_v[j]); + } + } + + ///////////////////////////////// + + PrimBuild::end(false); + } + // + // RENDER EACH ZODIAC + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxZodiacTerrainRenderer_T3D.h b/Engine/source/afx/afxZodiacTerrainRenderer_T3D.h new file mode 100644 index 000000000..cf93ded16 --- /dev/null +++ b/Engine/source/afx/afxZodiacTerrainRenderer_T3D.h @@ -0,0 +1,92 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_TERRAIN_RENDERER_H_ +#define _AFX_ZODIAC_TERRAIN_RENDERER_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "renderInstance/renderBinManager.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class TerrCell; + +class afxZodiacTerrainRenderer : public RenderBinManager +{ + typedef RenderBinManager Parent; + + struct TerrainZodiacElem + { + const TerrainBlock* block; + const TerrCell* cell; + U32 zode_idx; + F32 ang; + MatrixF mRenderObjToWorld; + F32 camDist; + }; + + Vector terrain_zodes; + static afxZodiacTerrainRenderer* master; + + GFXStateBlockRef norm_norefl_zb_SB, norm_refl_zb_SB; + GFXStateBlockRef add_norefl_zb_SB, add_refl_zb_SB; + GFXStateBlockRef sub_norefl_zb_SB, sub_refl_zb_SB; + + ShaderData* zodiac_shader; + GFXShaderConstBufferRef shader_consts; + GFXShaderConstHandle* projection_sc; + GFXShaderConstHandle* color_sc; + + bool shader_initialized; + + GFXStateBlock* chooseStateBlock(U32 blend, bool isReflectPass); + +public: + static const RenderInstType RIT_TerrainZodiac; + + /*C*/ afxZodiacTerrainRenderer(); + /*C*/ afxZodiacTerrainRenderer(F32 renderOrder, F32 processAddOrder); + /*D*/ ~afxZodiacTerrainRenderer(); + + // RenderBinManager + virtual void sort(){} // don't sort them + virtual void clear(); + + void initShader(); + void addZodiac(U32 zode_idx, const Point3F& pos, F32 ang, const TerrainBlock*, const TerrCell*, const MatrixF& mRenderObjToWorld, F32 camDist); + + virtual void render(SceneRenderState*); + + static afxZodiacTerrainRenderer* getMaster(); + + // ConsoleObject + DECLARE_CONOBJECT(afxZodiacTerrainRenderer); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_TERRAIN_RENDERER_H_ diff --git a/Engine/source/afx/arcaneFX.cpp b/Engine/source/afx/arcaneFX.cpp new file mode 100644 index 000000000..59da040ea --- /dev/null +++ b/Engine/source/afx/arcaneFX.cpp @@ -0,0 +1,959 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "scene/sceneObject.h" +#include "scene/sceneManager.h" +#include "T3D/gameBase/gameConnection.h" +#include "T3D/gameBase/gameProcess.h" +#include "T3D/player.h" +#include "math/mathUtils.h" +#include "console/compiler.h" +#include "console/engineAPI.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxSelectron.h" +#include "afx/afxResidueMgr.h" +#include "afx/ce/afxZodiacMgr.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#define N_LIGHTING_MODELS 6 +// +// "SG - Original Advanced (Lighting Pack)" +// "SG - Original Stock (Lighting Pack)" +// "SG - Inverse Square (Lighting Pack)" +// "SG - Inverse Square Fast Falloff (Lighting Pack)" +// "SG - Near Linear (Lighting Pack)" +// "SG - Near Linear Fast Falloff (Lighting Pack)" +static StringTableEntry lm_old_names[N_LIGHTING_MODELS]; +// +// "Original Advanced" +// "Original Stock" +// "Inverse Square" +// "Inverse Square Fast Falloff" +// "Near Linear" +// "Near Linear Fast Falloff" +static StringTableEntry lm_new_names[N_LIGHTING_MODELS]; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class ClientZoneInEvent : public NetEvent +{ + typedef NetEvent Parent; +public: + ClientZoneInEvent() { mGuaranteeType = Guaranteed; } + ~ClientZoneInEvent() { } + + virtual void pack(NetConnection*, BitStream*bstream) { } + virtual void write(NetConnection*, BitStream *bstream) { } + virtual void unpack(NetConnection* /*ps*/, BitStream *bstream) { } + + virtual void process(NetConnection* conn) + { + GameConnection* game_conn = dynamic_cast(conn); + if (game_conn && !game_conn->isZonedIn()) + { + arcaneFX::syncToNewConnection(game_conn); + } + } + + DECLARE_CONOBJECT(ClientZoneInEvent); + DECLARE_CATEGORY("AFX"); +}; +IMPLEMENT_CO_SERVEREVENT_V1(ClientZoneInEvent); + +ConsoleDocClass( ClientZoneInEvent, + "@brief Event posted when player is fully loaded into the game and ready for interaction.\n\n" + "@internal"); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +Vector arcaneFX::active_choreographers; +Vector arcaneFX::client_choreographers; +Vector arcaneFX::selectrons; +Vector arcaneFX::scoped_objs; + +StringTableEntry arcaneFX::NULLSTRING = 0; +U32 arcaneFX::sTargetSelectionMask = 0; +U32 arcaneFX::sFreeTargetSelectionMask = 0; +bool arcaneFX::sIsFreeTargeting = false; +Point3F arcaneFX::sFreeTargetPos = Point3F(0.0f, 0.0f, 0.0f); +bool arcaneFX::sFreeTargetPosValid = false; +F32 arcaneFX::sTargetSelectionRange = 200.0f; +U32 arcaneFX::sTargetSelectionTimeoutMS = 500; +bool arcaneFX::sClickToTargetSelf = false; +U32 arcaneFX::sMissileCollisionMask = 0; +StringTableEntry arcaneFX::sParameterFieldPrefix = 0; +F32 arcaneFX::sTerrainZodiacZBias = -0.00025f; +F32 arcaneFX::sInteriorZodiacZBias = -0.0001f; +F32 arcaneFX::sPolysoupZodiacZBias = -0.0001f; +U32 arcaneFX::master_choreographer_id = 1; +U16 arcaneFX::master_scope_id = 1; +bool arcaneFX::is_shutdown = true; + +bool arcaneFX::sUsePlayerCentricListener = false; + +void arcaneFX::init() +{ + NULLSTRING = StringTable->insert(""); + sParameterFieldPrefix = StringTable->insert("_"); + +#if defined(TORQUE_OS_MAC) + arcaneFX::sTerrainZodiacZBias = -0.00025f; + arcaneFX::sInteriorZodiacZBias = -0.00025f; + arcaneFX::sPolysoupZodiacZBias = -0.00025f; +#endif + + Con::addVariable( "pref::AFX::targetSelectionMask", TypeS32, &sTargetSelectionMask); + Con::addVariable( "pref::AFX::freeTargetSelectionMask", TypeS32, &sFreeTargetSelectionMask); + Con::addVariable( "pref::AFX::targetSelectionRange", TypeF32, &sTargetSelectionRange); + Con::addVariable( "pref::AFX::targetSelectionTimeoutMS", TypeS32, &sTargetSelectionTimeoutMS); + Con::addVariable( "pref::AFX::missileCollisionMask", TypeS32, &sMissileCollisionMask); + Con::addVariable( "pref::AFX::clickToTargetSelf", TypeBool, &sClickToTargetSelf); + Con::addVariable( "Pref::Server::AFX::parameterFieldPrefix", TypeString, &sParameterFieldPrefix); + + Con::addVariable( "pref::AFX::terrainZodiacZBias", TypeF32, &sTerrainZodiacZBias); + Con::addVariable( "pref::AFX::interiorZodiacZBias", TypeF32, &sInteriorZodiacZBias); + Con::addVariable( "pref::AFX::polysoupZodiacZBias", TypeF32, &sPolysoupZodiacZBias); + + Con::setIntVariable( "$AFX::TARGETING_OFF", TARGETING_OFF); + Con::setIntVariable( "$AFX::TARGETING_STANDARD", TARGETING_STANDARD); + Con::setIntVariable( "$AFX::TARGETING_FREE", TARGETING_FREE); + Con::setIntVariable( "$AFX::TARGET_CHECK_POLL", TARGET_CHECK_POLL); + Con::setIntVariable( "$AFX::TARGET_CHECK_ON_MOUSE_MOVE", TARGET_CHECK_ON_MOUSE_MOVE); + + Con::setIntVariable( "$AFX::IMPACTED_SOMETHING", afxEffectDefs::IMPACTED_SOMETHING); + Con::setIntVariable( "$AFX::IMPACTED_TARGET", afxEffectDefs::IMPACTED_TARGET); + Con::setIntVariable( "$AFX::IMPACTED_PRIMARY", afxEffectDefs::IMPACTED_PRIMARY); + Con::setIntVariable( "$AFX::IMPACT_IN_WATER", afxEffectDefs::IMPACT_IN_WATER); + Con::setIntVariable( "$AFX::CASTER_IN_WATER", afxEffectDefs::CASTER_IN_WATER); + + Con::setIntVariable( "$AFX::SERVER_ONLY", afxEffectDefs::SERVER_ONLY); + Con::setIntVariable( "$AFX::SCOPE_ALWAYS", afxEffectDefs::SCOPE_ALWAYS); + Con::setIntVariable( "$AFX::GHOSTABLE", afxEffectDefs::GHOSTABLE); + Con::setIntVariable( "$AFX::CLIENT_ONLY", afxEffectDefs::CLIENT_ONLY); + Con::setIntVariable( "$AFX::SERVER_AND_CLIENT", afxEffectDefs::SERVER_AND_CLIENT); + + Con::setIntVariable( "$AFX::DELAY", afxEffectDefs::TIMING_DELAY); + Con::setIntVariable( "$AFX::LIFETIME", afxEffectDefs::TIMING_LIFETIME); + Con::setIntVariable( "$AFX::FADE_IN_TIME", afxEffectDefs::TIMING_FADE_IN); + Con::setIntVariable( "$AFX::FADE_OUT_TIME", afxEffectDefs::TIMING_FADE_OUT); + + Con::setFloatVariable( "$AFX::INFINITE_TIME", -1.0f); + Con::setIntVariable( "$AFX::INFINITE_REPEATS", -1); + + Con::setIntVariable( "$AFX::PLAYER_MOVE_TRIGGER_0", Player::PLAYER_MOVE_TRIGGER_0); + Con::setIntVariable( "$AFX::PLAYER_MOVE_TRIGGER_1", Player::PLAYER_MOVE_TRIGGER_1); + Con::setIntVariable( "$AFX::PLAYER_MOVE_TRIGGER_2", Player::PLAYER_MOVE_TRIGGER_2); + Con::setIntVariable( "$AFX::PLAYER_MOVE_TRIGGER_3", Player::PLAYER_MOVE_TRIGGER_3); + Con::setIntVariable( "$AFX::PLAYER_MOVE_TRIGGER_4", Player::PLAYER_MOVE_TRIGGER_4); + Con::setIntVariable( "$AFX::PLAYER_MOVE_TRIGGER_5", Player::PLAYER_MOVE_TRIGGER_5); + + Con::setIntVariable( "$AFX::PLAYER_FIRE_S_TRIGGER", Player::PLAYER_FIRE_S_TRIGGER); + Con::setIntVariable( "$AFX::PLAYER_FIRE_ALT_S_TRIGGER", Player::PLAYER_FIRE_ALT_S_TRIGGER); + Con::setIntVariable( "$AFX::PLAYER_JUMP_S_TRIGGER", Player::PLAYER_JUMP_S_TRIGGER); + Con::setIntVariable( "$AFX::PLAYER_LANDING_S_TRIGGER", Player::PLAYER_LANDING_S_TRIGGER); + + Con::setIntVariable( "$AFX::PLAYER_LF_FOOT_C_TRIGGER", Player::PLAYER_LF_FOOT_C_TRIGGER); + Con::setIntVariable( "$AFX::PLAYER_RT_FOOT_C_TRIGGER", Player::PLAYER_RT_FOOT_C_TRIGGER); + Con::setIntVariable( "$AFX::PLAYER_LANDING_C_TRIGGER", Player::PLAYER_LANDING_C_TRIGGER); + Con::setIntVariable( "$AFX::PLAYER_IDLE_C_TRIGGER", Player::PLAYER_IDLE_C_TRIGGER); + + Con::setIntVariable( "$AFX::ILLUM_TERRAIN", 0); + Con::setIntVariable( "$AFX::ILLUM_ATLAS", 0); + Con::setIntVariable( "$AFX::ILLUM_DIF", 0); + Con::setIntVariable( "$AFX::ILLUM_DTS", 0); + Con::setIntVariable( "$AFX::ILLUM_ALL", 0); + + Con::setIntVariable("$TypeMasks::TerrainLikeObjectType", TerrainLikeObjectType); + Con::setIntVariable("$TypeMasks::InteriorLikeObjectType", InteriorLikeObjectType); + Con::setIntVariable("$TypeMasks::PolysoupObjectType", InteriorLikeObjectType); // deprecated + + Con::addVariable("$pref::Audio::usePlayerCentricListener", TypeBool, &sUsePlayerCentricListener); + + afxResidueMgr* residue_mgr = new afxResidueMgr; + afxResidueMgr::setMaster(residue_mgr); + + master_scope_id = 1; + master_choreographer_id = 1; + is_shutdown = false; + + if (lm_old_names[0] == 0) + { + lm_old_names[0] = StringTable->insert("SG - Original Advanced (Lighting Pack)"); + lm_old_names[1] = StringTable->insert("SG - Original Stock (Lighting Pack)"); + lm_old_names[2] = StringTable->insert("SG - Inverse Square (Lighting Pack)"); + lm_old_names[3] = StringTable->insert("SG - Inverse Square Fast Falloff (Lighting Pack)"); + lm_old_names[4] = StringTable->insert("SG - Near Linear (Lighting Pack)"); + lm_old_names[5] = StringTable->insert("SG - Near Linear Fast Falloff (Lighting Pack)"); + // + lm_new_names[0] = StringTable->insert("Original Advanced"); + lm_new_names[1] = StringTable->insert("Original Stock"); + lm_new_names[2] = StringTable->insert("Inverse Square"); + lm_new_names[3] = StringTable->insert("Inverse Square Fast Falloff"); + lm_new_names[4] = StringTable->insert("Near Linear"); + lm_new_names[5] = StringTable->insert("Near Linear Fast Falloff"); + } +} + +void arcaneFX::shutdown() +{ + is_shutdown = true; + + for (S32 i = 0; i < scoped_objs.size(); i++) + if (scoped_objs[i]) + scoped_objs[i]->setScopeRegistered(false); + scoped_objs.clear(); + + for (S32 i = 0; i < client_choreographers.size(); i++) + if (client_choreographers[i]) + client_choreographers[i]->clearChoreographerId(); + client_choreographers.clear(); + + for (S32 i = 0; i < selectrons.size(); i++) + if (selectrons[i]) + selectrons[i]->registered = false; + selectrons.clear(); + + afxResidueMgr* residue_mgr = afxResidueMgr::getMaster(); + delete residue_mgr; + afxResidueMgr::setMaster(NULL); +} + +MODULE_BEGIN( arcaneFX ) + + MODULE_INIT + { + arcaneFX::init(); + } + + MODULE_SHUTDOWN + { + arcaneFX::shutdown(); + } + +MODULE_END; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void arcaneFX::advanceTime(U32 delta) +{ + GameConnection* conn = GameConnection::getConnectionToServer(); + if (conn && !conn->isZonedIn() && conn->getCameraObject() != 0) + { + conn->setZonedIn(); + conn->postNetEvent(new ClientZoneInEvent()); + } + + afxZodiacMgr::frameReset(); + afxResidueMgr::getMaster()->residueAdvanceTime(); +} + +// + +U32 arcaneFX::registerChoreographer(afxChoreographer* ch) +{ + if (!ch) + return 0; + + active_choreographers.push_back(ch); + + //Con::printf("registerChoreographer() -- size=%d %s", active_choreographers.size(), + // (ch->isServerObject()) ? "server" : "client"); + + return master_choreographer_id++; +} + +void arcaneFX::unregisterChoreographer(afxChoreographer* ch) +{ + if (!ch) + return; + + for (U32 i = 0; i < active_choreographers.size(); i++) + { + if (ch == active_choreographers[i]) + { + active_choreographers.erase_fast(i); + //Con::printf("unregisterChoreographer() -- size=%d %s", active_choreographers.size(), + // (ch->isServerObject()) ? "server" : "client"); + return; + } + } + + Con::errorf("arcaneFX::unregisterChoreographer() -- failed to find choreographer in list."); +} + +void arcaneFX::registerClientChoreographer(afxChoreographer* ch) +{ + if (!ch || ch->getChoreographerId() == 0) + return; + + client_choreographers.push_back(ch); +} + +void arcaneFX::unregisterClientChoreographer(afxChoreographer* ch) +{ + if (!ch || ch->getChoreographerId() == 0) + return; + + for (U32 i = 0; i < client_choreographers.size(); i++) + { + if (ch == client_choreographers[i]) + { + client_choreographers.erase_fast(i); + return; + } + } + + Con::errorf("arcaneFX::unregisterClientChoreographer() -- failed to find choreographer in list."); +} + +afxChoreographer* arcaneFX::findClientChoreographer(U32 id) +{ + for (U32 i = 0; i < client_choreographers.size(); i++) + { + if (id == client_choreographers[i]->getChoreographerId()) + return client_choreographers[i]; + } + + return 0; +} + +// + +void arcaneFX::registerSelectronData(afxSelectronData* selectron) +{ + if (!selectron) + return; + + selectrons.push_back(selectron); +} + +void arcaneFX::unregisterSelectronData(afxSelectronData* selectron) +{ + if (!selectron) + return; + + for (U32 i = 0; i < selectrons.size(); i++) + { + if (selectron == selectrons[i]) + { + selectrons.erase_fast(i); + return; + } + } + + Con::errorf("arcaneFX::unregisterSelectronData() -- failed to find selectron in list."); +} + +afxSelectronData* arcaneFX::findSelectronData(U32 mask, U8 style) +{ + for (U32 i = 0; i < selectrons.size(); i++) + if (selectrons[i]->matches(mask, style)) + return selectrons[i]; + + return 0; +} + +U16 arcaneFX::generateScopeId() +{ + U16 ret_id = master_scope_id++; + if (master_scope_id >= BIT(GameBase::SCOPE_ID_BITS)) + master_scope_id = 1; + return ret_id; +} + +void arcaneFX::registerScopedObject(SceneObject* object) +{ + scoped_objs.push_back(object); + object->setScopeRegistered(true); + + for (S32 i = 0; i < client_choreographers.size(); i++) + if (client_choreographers[i]) + client_choreographers[i]->restoreScopedObject(object); +} + +SceneObject* arcaneFX::findScopedObject(U16 scope_id) +{ + if (scoped_objs.size() > 0) + { + for (S32 i = scoped_objs.size()-1; i >= 0; i--) + if (scoped_objs[i] && scoped_objs[i]->getScopeId() == scope_id) + return scoped_objs[i]; + } + return 0; +} + +void arcaneFX::unregisterScopedObject(SceneObject* object) +{ + if (scoped_objs.size() > 0) + { + for (S32 i = scoped_objs.size()-1; i >= 0; i--) + if (scoped_objs[i] == object) + { + scoped_objs.erase_fast(i); + if (object) + object->setScopeRegistered(false); + return; + } + } +} + +void arcaneFX::syncToNewConnection(GameConnection* conn) +{ + if (conn) + conn->setZonedIn(); + + for (U32 i = 0; i < active_choreographers.size(); i++) + { + if (active_choreographers[i]) + active_choreographers[i]->sync_with_clients(); + } +} + +void arcaneFX::endMissionNotify() +{ + for (S32 i = 0; i < scoped_objs.size(); i++) + if (scoped_objs[i]) + scoped_objs[i]->setScopeRegistered(false); + scoped_objs.clear(); + + for (S32 i = 0; i < client_choreographers.size(); i++) + if (client_choreographers[i]) + client_choreographers[i]->clearChoreographerId(); + client_choreographers.clear(); + + for (S32 i = 0; i < selectrons.size(); i++) + if (selectrons[i]) + selectrons[i]->registered = false; + selectrons.clear(); + + if (afxResidueMgr::getMaster()) + afxResidueMgr::getMaster()->cleanup(); + afxZodiacMgr::missionCleanup(); +} + +S32 arcaneFX::rolloverRayCast(Point3F start, Point3F end, U32 mask) +{ + sIsFreeTargeting = false; +#if !defined(AFX_CAP_ROLLOVER_RAYCASTS) + return -1; +#else + GameConnection* conn = GameConnection::getConnectionToServer(); + SceneObject* ctrl_obj = NULL; + + if (!arcaneFX::sClickToTargetSelf && conn != NULL) + ctrl_obj = conn->getControlObject(); + + if (ctrl_obj) + ctrl_obj->disableCollision(); + + SceneObject* rollover_obj = (conn) ? conn->getRolloverObj() : 0; + SceneObject* picked_obj = 0; + + RayInfo hit_info; + if (gClientContainer.castRay(start, end, mask, &hit_info)) + picked_obj = dynamic_cast(hit_info.object); + + if (ctrl_obj) + ctrl_obj->enableCollision(); + + if (picked_obj != rollover_obj) + { + if (rollover_obj) + rollover_obj->setSelectionFlags(rollover_obj->getSelectionFlags() & ~SceneObject::PRE_SELECTED); + if (picked_obj) + picked_obj->setSelectionFlags(picked_obj->getSelectionFlags() | SceneObject::PRE_SELECTED); + rollover_obj = picked_obj; + + if (conn) + conn->setRolloverObj(rollover_obj); + } + + return (picked_obj) ? picked_obj->getId() : -1; +#endif +} + +bool arcaneFX::freeTargetingRayCast(Point3F start, Point3F end, U32 mask) +{ + sIsFreeTargeting = true; + + RayInfo hit_info; + if (!gClientContainer.castRay(start, end, mask, &hit_info)) + { + sFreeTargetPosValid = false; + return false; + } + + sFreeTargetPosValid = true; + sFreeTargetPos = hit_info.point; + + return true; +} + +StringTableEntry arcaneFX::convertLightingModelName(StringTableEntry lm_name) +{ + for (U32 i = 0; i < N_LIGHTING_MODELS; i++) + { + if (lm_name == lm_old_names[i]) + return lm_new_names[i]; + } + + return lm_name; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Console Functions + +DefineEngineFunction(afxEndMissionNotify, void, (),, + "...\n\n" + "@ingroup AFX") +{ + arcaneFX::endMissionNotify(); +} + +DefineEngineFunction(afxGetVersion, const char*, (),, + "...\n\n" + "@ingroup AFX") +{ + return AFX_VERSION_STRING; +} + +DefineEngineFunction(afxGetEngine, const char*, (),, + "...\n\n" + "@ingroup AFX") +{ + return "T3D"; +} + +#if defined(AFX_CAP_ROLLOVER_RAYCASTS) +DefineEngineFunction(rolloverRayCast, S32, (Point3F start, Point3F end, U32 mask),, + "Performs a raycast from points start to end and returns the ID of nearest " + "intersecting object with a type found in the specified mask. " + "Returns -1 if no object is found.\n\n" + "@ingroup AFX") +{ + return arcaneFX::rolloverRayCast(start, end, mask); +} +#endif + +DefineEngineFunction(getRandomF, F32, (float a, float b), (F32_MAX, F32_MAX), + "Get a random float number between a and b.\n\n" + "@ingroup AFX") +{ + if (b == F32_MAX) + { + if (a == F32_MAX) + return gRandGen.randF(); + + return gRandGen.randF(0.0f, a); + } + + return (a + (b-a)*gRandGen.randF()); +} + +DefineEngineFunction(getRandomDir, Point3F, (Point3F axis, float thetaMin, float thetaMax, float phiMin, float phiMax), + (Point3F(0.0f,0.0f,0.0f), 0.0f, 180.0f, 0.0f, 360.0f), + "Get a random direction vector.\n\n" + "@ingroup AFX") +{ + return MathUtils::randomDir(axis, thetaMin, thetaMax, phiMin, phiMax); +} + +ConsoleFunction( MatrixInverseMulVector, const char*, 3, 3, "(MatrixF xfrm, Point3F vector)" + "@brief Multiply the vector by the affine inverse of the transform.\n\n" + "@ingroup AFX") +{ + Point3F pos1(0.0f,0.0f,0.0f); + AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f); + dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle); + + MatrixF temp1(true); + aa1.setMatrix(&temp1); + temp1.setColumn(3, pos1); + + Point3F vec1(0.0f,0.0f,0.0f); + dSscanf(argv[2], "%g %g %g", &vec1.x, &vec1.y, &vec1.z); + + temp1.affineInverse(); + + Point3F result; + temp1.mulV(vec1, &result); + + char* ret = Con::getReturnBuffer(256); + dSprintf(ret, 255, "%g %g %g", result.x, result.y, result.z); + return ret; +} + +ConsoleFunction(moveTransformAbs, const char*, 3, 3, "(MatrixF xfrm, Point3F pos)" + "@brief Move the transform to the new absolute position.\n\n" + "@ingroup AFX") +{ + Point3F pos1(0.0f,0.0f,0.0f); + AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f); + dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle); + + Point3F pos2(0.0f,0.0f,0.0f); + dSscanf(argv[2], "%g %g %g", &pos2.x, &pos2.y, &pos2.z); + + char* returnBuffer = Con::getReturnBuffer(256); + dSprintf(returnBuffer, 255, "%g %g %g %g %g %g %g", + pos2.x, pos2.y, pos2.z, + aa1.axis.x, aa1.axis.y, aa1.axis.z, + aa1.angle); + return returnBuffer; +} + +ConsoleFunction(moveTransformRel, const char*, 3, 3, "(MatrixF xfrm, Point3F pos)" + "@brief Move the transform to the new relative position.\n\n" + "@ingroup AFX") +{ + Point3F pos1(0.0f,0.0f,0.0f); + AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f); + dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle); + + Point3F pos2(0.0f,0.0f,0.0f); + dSscanf(argv[2], "%g %g %g", &pos2.x, &pos2.y, &pos2.z); + + pos2 += pos1; + + char* returnBuffer = Con::getReturnBuffer(256); + dSprintf(returnBuffer, 255, "%g %g %g %g %g %g %g", + pos2.x, pos2.y, pos2.z, + aa1.axis.x, aa1.axis.y, aa1.axis.z, + aa1.angle); + return returnBuffer; +} + +DefineEngineFunction(getFreeTargetPosition, Point3F, (),, + "@brief Returns the current location of the free target.\n\n" + "@ingroup AFX") +{ + if (!arcaneFX::sFreeTargetPosValid) + return Point3F(0.0f, 0.0f, 0.0f); + return arcaneFX::sFreeTargetPos; +} + +DefineEngineMethod(SceneObject, getSpeed, F32, (),, + "Returns the velocity of a scene-object.\n\n" + "@ingroup AFX") +{ + return object->getVelocity().len(); +} + +static S32 mark_modkey = -1; + +DefineEngineFunction(markDataBlocks, void, (),, + "@brief Called before a series of datablocks are reloaded to " + "help distinguish reloaded datablocks from already loaded ones.\n\n" + "@ingroup AFX") +{ + mark_modkey = SimDataBlock::getNextModifiedKey(); +} + +DefineEngineFunction(touchDataBlocks, void, (),, + "@brief Called after a series of datablocks are reloaded to " + "trigger some important actions on the reloaded datablocks.\n\n" + "@ingroup AFX") +{ + if (mark_modkey < 0) + return; + + SimDataBlockGroup* g = Sim::getDataBlockGroup(); + + U32 groupCount = g->size(); + for (S32 i = groupCount-1; i >= 0; i--) + { + SimDataBlock* simdb = (SimDataBlock*)(*g)[i]; + if (simdb->getModifiedKey() > mark_modkey) + { + simdb->unregisterObject(); + simdb->registerObject(); + } + } + + mark_modkey = -1; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +// Syntax Error Checking +// (for checking eval() and compile() calls) + +DefineEngineFunction(wasSyntaxError, bool, (),, + "@brief Returns true if script compiler had a syntax error. Useful " + "for detecting syntax errors after reloading a script.\n\n" + "@ingroup AFX") +{ + return Compiler::gSyntaxError; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +// Network Object Identification + +// These useful console methods come from the following code resource: +// +// How to Identify Objects from Client to Server or Server to Client by Nathan Davies +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4852 +// + +DefineEngineMethod(NetConnection, GetGhostIndex, S32, (NetObject* obj),, + "Returns the ghost-index for an object.\n\n" + "@ingroup AFX") +{ + if (obj) + return object->getGhostIndex(obj); + return 0; +} + +DefineEngineMethod(NetConnection, ResolveGhost, S32, (int ghostIndex),, + "Resolves a ghost-index into an object ID.\n\n" + "@ingroup AFX") +{ + if (ghostIndex != -1) + { + NetObject* pObject = NULL; + if( object->isGhostingTo()) + pObject = object->resolveGhost(ghostIndex); + else if( object->isGhostingFrom()) + pObject = object->resolveObjectFromGhostIndex(ghostIndex); + if (pObject) + return pObject->getId(); + } + return 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +////////////////////////////////////////////////////////////////////////// +// TypeByteRange +////////////////////////////////////////////////////////////////////////// + +IMPLEMENT_STRUCT( ByteRange, ByteRange,, + "" ) +END_IMPLEMENT_STRUCT; + +ConsoleType( ByteRange, TypeByteRange, ByteRange, "") +ConsoleType( ByteRange, TypeByteRange2, ByteRange, "") + +ConsoleGetType( TypeByteRange ) +{ + ByteRange* pt = (ByteRange *) dptr; + char* returnBuffer = Con::getReturnBuffer(256); + dSprintf(returnBuffer, 256, "%u %u", pt->low, pt->high); + return returnBuffer; +} + +ConsoleSetType( TypeByteRange ) +{ + if(argc == 1) + { + ByteRange* range = (ByteRange*) dptr; + U32 lo, hi; + S32 args = dSscanf(argv[0], "%u %u", &lo, &hi); + range->low = (args > 0) ? lo : 0; + range->high = (args > 1) ? hi : 255; + } + else + Con::printf("ByteRange must be set as \"low\" or \"low high\""); +} + +ConsoleGetType( TypeByteRange2 ) +{ + ByteRange* pt = (ByteRange *) dptr; + char* returnBuffer = Con::getReturnBuffer(256); + dSprintf(returnBuffer, 256, "%u %u", pt->low, pt->high); + return returnBuffer; +} + +ConsoleSetType( TypeByteRange2 ) +{ + if(argc == 1) + { + ByteRange* range = (ByteRange*) dptr; + U32 lo, hi; + S32 args = dSscanf(argv[0], "%u %u", &lo, &hi); + range->low = (args > 0) ? lo : 0; + range->high = (args > 1) ? hi : lo; + } + else + Con::printf("ByteRange must be set as \"low\" or \"low high\""); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +static void HSVtoRGB(F32 h, F32 s, F32 v, F32& r, F32& g, F32& b) +{ + h = mFmod(h, 360.0f); + + if (v == 0.0f) + r = g = b = 0.0f; + else if (s == 0.0f) + r = g = b = v; + else + { + F32 hf = h/60.0f; + S32 i = (S32) mFloor(hf); + F32 f = hf - i; + + F32 pv = v*(1.0f - s); + F32 qv = v*(1.0f - s*f); + F32 tv = v*(1.0f - s*(1.0f - f)); + + switch (i) + { + case 0: + r = v; g = tv; b = pv; + break; + case 1: + r = qv; g = v; b = pv; + break; + case 2: + r = pv; g = v; b = tv; + break; + case 3: + r = pv; g = qv; b = v; + break; + case 4: + r = tv; g = pv; b = v; + break; + case 5: + r = v; g = pv; b = qv; + break; + default: + r = g = b = 0.0f; + break; + } + } +} + +DefineEngineFunction(getColorFromHSV, const char*, (float hue, float sat, float val, float alpha), (0.0, 0.0, 1.0, 1.0), + "Coverts an HSV formatted color into an RBG color.\n\n" + "@param hue The hue of the color (0-360).\n" + "@param sat The saturation of the color (0-1).\n" + "@param val The value of the color (0-1).\n" + "@param alpha The alpha of the color (0-1).\n" + "@ingroup AFX") +{ + LinearColorF rgb; + HSVtoRGB(hue, sat, val, rgb.red, rgb.green, rgb.blue); + rgb.alpha = alpha; + + char* returnBuffer = Con::getReturnBuffer(256); + dSprintf(returnBuffer, 256, "%g %g %g %g", rgb.red, rgb.green, rgb.blue, rgb.alpha); + + return returnBuffer; +} + +DefineEngineFunction(ColorScale, const char*, ( LinearColorF color, float scalar ),, + "Returns color scaled by scalar (color*scalar).\n\n" + "@param color The color to be scaled.\n" + "@param scalar The amount to scale the color.\n" + "@ingroup AFX") +{ + color *= scalar; + + char* returnBuffer = Con::getReturnBuffer(256); + dSprintf(returnBuffer, 256, "%g %g %g %g", color.red, color.green, color.blue, color.alpha); + + return returnBuffer; +} + +DefineEngineFunction(getMinF, F32, (float a, float b),, + "Returns the lesser of the two arguments.\n\n" + "@ingroup AFX") +{ + return getMin(a, b); +} + +DefineEngineFunction(getMaxF, F32, (float a, float b),, + "Returns the greater of the two arguments.\n\n" + "@ingroup AFX") +{ + return getMax(a, b); +} + +ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)" + "Like echo(), but first argument is returned.\n" + "@ingroup AFX") +{ + U32 len = 0; + S32 i; + for(i = 2; i < argc; i++) + len += dStrlen(argv[i]); + + char *ret = Con::getReturnBuffer(len + 1); + ret[0] = 0; + for(i = 2; i < argc; i++) + dStrcat(ret, argv[i]); + + Con::printf("%s -- [%s]", ret, argv[1].getStringValue()); + ret[0] = 0; + + return argv[1]; +} + +ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)" + "Like warn(), but first argument is returned.\n" + "@ingroup AFX") +{ + U32 len = 0; + S32 i; + for(i = 2; i < argc; i++) + len += dStrlen(argv[i]); + + char *ret = Con::getReturnBuffer(len + 1); + ret[0] = 0; + for(i = 2; i < argc; i++) + dStrcat(ret, argv[i]); + + Con::warnf("%s -- [%s]", ret, argv[1].getStringValue()); + ret[0] = 0; + + return argv[1]; +} + +ConsoleFunction(errorThru, const char*, 2, 0, "(string passthru, string text...)" + "Like error(), but first argument is returned.\n" + "@ingroup AFX") +{ + U32 len = 0; + S32 i; + for(i = 2; i < argc; i++) + len += dStrlen(argv[i]); + + char *ret = Con::getReturnBuffer(len + 1); + ret[0] = 0; + for(i = 2; i < argc; i++) + dStrcat(ret, argv[i]); + + Con::errorf("%s -- [%s]", ret, argv[1].getStringValue()); + ret[0] = 0; + + return argv[1]; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/arcaneFX.h b/Engine/source/afx/arcaneFX.h new file mode 100644 index 000000000..19e78d29a --- /dev/null +++ b/Engine/source/afx/arcaneFX.h @@ -0,0 +1,214 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _ARCANE_FX_H_ +#define _ARCANE_FX_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _PLATFORM_H_ +#include "platform/platform.h" +#endif + +#define AFX_VERSION_STRING "2.0" +#define AFX_VERSION 2.0 + +// #define AFX_CUSTOMIZED_BRANCH + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +#if defined(AFX_CUSTOMIZED_BRANCH) + +#elif (TORQUE_GAME_ENGINE == 1100 || TORQUE_GAME_ENGINE >= 3000) + +#define AFX_CAP_SCOPE_TRACKING +#define AFX_CAP_ROLLOVER_RAYCASTS +//#define AFX_CAP_AFXMODEL_TYPE +//#define BROKEN_POINT_IN_WATER +#define BROKEN_DAMAGEFLASH_WHITEOUT_BLACKOUT + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +#else + +// This version of AFX source only supports T3D 1.1 + +#endif + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _ENGINEAPI_H_ +#include "console/engineAPI.h" +#endif + +#ifndef _SIMBASE_H_ +#include "console/simBase.h" +#endif + +#ifndef _BITSTREAM_H_ +#include "core/stream/bitStream.h" +#endif + +#ifndef _GAMEBASE_H_ +#include "T3D/gameBase/gameBase.h" +#endif + +#if defined(DGL_GRAPHICS_LAYER) +#ifndef _DGL_H_ +#include "dgl/dgl.h" +#endif +#endif + +class afxChoreographer; +class afxSelectronData; +class GameConnection; +class SceneObject; + +class arcaneFX +{ +public: + enum { + TARGETING_OFF, + TARGETING_STANDARD, + TARGETING_FREE + }; + enum { + TARGET_CHECK_POLL, + TARGET_CHECK_ON_MOUSE_MOVE + }; + +private: + static Vector active_choreographers; + static Vector client_choreographers; + static Vector selectrons; + static Vector scoped_objs; + static bool is_shutdown; + +public: + static StringTableEntry NULLSTRING; + static U32 sTargetSelectionMask; + static U32 sFreeTargetSelectionMask; + static bool sIsFreeTargeting; + static Point3F sFreeTargetPos; + static bool sFreeTargetPosValid; + static F32 sTargetSelectionRange; + static U32 sTargetSelectionTimeoutMS; + static bool sClickToTargetSelf; + static U32 sMissileCollisionMask; + static StringTableEntry sParameterFieldPrefix; + static F32 sTerrainZodiacZBias; + static F32 sInteriorZodiacZBias; + static F32 sPolysoupZodiacZBias; + static U32 master_choreographer_id; + static U16 master_scope_id; + +public: + static void init(); + static void shutdown(); + static void advanceTime(U32 delta); + + static U32 registerChoreographer(afxChoreographer*); + static void unregisterChoreographer(afxChoreographer*); + static void registerClientChoreographer(afxChoreographer*); + static void unregisterClientChoreographer(afxChoreographer*); + static afxChoreographer* findClientChoreographer(U32 id); + + static void registerSelectronData(afxSelectronData*); + static void unregisterSelectronData(afxSelectronData*); + static afxSelectronData* findSelectronData(U32 obj_type_mask, U8 code); + + static U16 generateScopeId(); + static void registerScopedObject(SceneObject*); + static SceneObject* findScopedObject(U16 scope_id); + static void unregisterScopedObject(SceneObject*); + + static void syncToNewConnection(GameConnection* conn); + static void endMissionNotify(); + static S32 rolloverRayCast(Point3F start, Point3F end, U32 mask); + static bool freeTargetingRayCast(Point3F start, Point3F end, U32 mask); + + static bool isShutdown() { return is_shutdown; } + static StringTableEntry convertLightingModelName(StringTableEntry lm_name); + +private: + static bool sUsePlayerCentricListener; +public: + static bool usePlayerCentricListener() { return sUsePlayerCentricListener; } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class ByteRange +{ +public: + U8 low; + U8 high; + +public: + /*C*/ ByteRange() { low = 0; high = 255; } + /*C*/ ByteRange(U8 l, U8 h=255) { low = l; high = h; } + + void set(U8 l, U8 h=255) { low = l; high = h; } + bool outOfRange(U8 v) { return (v < low || v > high); } + bool inRange(U8 v) { return !outOfRange(v); } + S32 getSpan() const { return high - low; } +}; + +DefineConsoleType(TypeByteRange, ByteRange) +DefineConsoleType(TypeByteRange2, ByteRange) + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +inline void writeDatablockID(BitStream* s, SimObject* simobj, bool packed=false) +{ + if (s->writeFlag(simobj)) + s->writeRangedU32(packed ? SimObjectId((uintptr_t)simobj) : simobj->getId(), + DataBlockObjectIdFirst, DataBlockObjectIdLast); +} + +inline S32 readDatablockID(BitStream* s) +{ + return (!s->readFlag()) ? 0 : ((S32)s->readRangedU32(DataBlockObjectIdFirst, + DataBlockObjectIdLast)); +} + +inline void registerForCleanup(SimObject* obj) +{ + SimGroup* cleanup_grp = dynamic_cast(Sim::findObject("MissionCleanup")); + if (cleanup_grp) + cleanup_grp->addObject(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +#define ST_NULLSTRING (arcaneFX::NULLSTRING) + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _ARCANE_FX_H_ + diff --git a/Engine/source/afx/ce/afxAnimClip.cpp b/Engine/source/afx/ce/afxAnimClip.cpp new file mode 100644 index 000000000..ed9561f2b --- /dev/null +++ b/Engine/source/afx/ce/afxAnimClip.cpp @@ -0,0 +1,217 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxAnimClip.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxAnimClipData + +IMPLEMENT_CO_DATABLOCK_V1(afxAnimClipData); + +ConsoleDocClass( afxAnimClipData, + "@brief A datablock that specifies an Animation Clip effect.\n\n" + + "An Animation Clip forces a target ShapeBase-derived object, such as Player or AIPlayer, to perform a particular " + "animation sequence. Animation Clip does not supply any new animation data, but simply selects, by name, a " + "sequence that is already defined in the target. Animation Clip can also target afxModel effects within the same " + "choreographer." + "\n\n" + + "The target of an Animation Clip is the constraint source object specified by the posConstraint field of the enclosing " + "effect wrapper. The target must be a ShapeBase-derived object, or an afxModel and it must contain an animation " + "sequence with the same name as the clipName field." + "\n\n" + + "Animation Clip controls the rate of animation playback and can even play a sequence in reverse. When an Animation " + "Clip selects a blended animation sequence, it is mixed with the current animation instead of replacing it. Animation " + "Clips can be used to activate multiple, overlapping blend sequences." + "\n\n" + + "Normally when an Animation Clip is applied to a user-controlled Player, any interactive user actions will override the " + "animation selected by the clip, but Animation Clips can be configured to temporarily block out some user actions for " + "the duration of the clip." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxAnimClipData::afxAnimClipData() +{ + clip_name = ST_NULLSTRING; + rate = 1.0f; + pos_offset = 0.0; + trans = 0.12f; + flags = 0; + + ignore_disabled = false; + ignore_enabled = false; + is_death_anim = false; + lock_anim = false; + ignore_first_person = false; + ignore_third_person = false; +} + +afxAnimClipData::afxAnimClipData(const afxAnimClipData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + clip_name = other.clip_name; + rate = other.rate; + pos_offset = other.pos_offset; + trans = other.trans; + flags = other.flags; + + expand_flags(); +} + +void afxAnimClipData::onStaticModified(const char* slot, const char* newValue) +{ + Parent::onStaticModified(slot, newValue); + merge_flags(); +} + +#define myOffset(field) Offset(field, afxAnimClipData) + +void afxAnimClipData::initPersistFields() +{ + addField("clipName", TYPEID< StringTableEntry >(), myOffset(clip_name), + "The name of an animation sequence to be played by a ShapeBase-derived object to which this effect is " + "constrained. Also works on afxModel effects.\n" + "default: \"\"\n"); + addField("rate", TYPEID< F32 >(), myOffset(rate), + "The desired playback speed for the sequence. A value of 1.0 indicates forward playback at a normal rate. Negative " + "values cause the sequence to play backwards.\n" + "default: 1.0\n"); + addField("posOffset", TYPEID< F32 >(), myOffset(pos_offset), + "Sets a starting offset for the selected animation clip. It directly specifies an animation thread position in the 0.0 to " + "1.0 range as a fraction of the clip's duration.\n" + "default: 1.0\n"); + addField("transitionTime", TYPEID< F32 >(), myOffset(trans), + "The duration in which the active animation overlaps and blends into the sequence selected by the animation clip.\n" + "default: 0.12\n"); + addField("ignoreCorpse", TYPEID< bool >(), myOffset(ignore_disabled), + "Specifies if the animation clip should not be applied to corpses or anything else with a disabled damage state.\n" + "default: false\n"); + addField("ignoreLiving", TYPEID< bool >(), myOffset(ignore_enabled), + "Specifies if the animation clip should not be applied to living objects or anything else with an enabled damage " + "state.\n" + "default: false\n"); + addField("treatAsDeathAnim", TYPEID< bool >(), myOffset(is_death_anim), + "Indicates if the animation clip is a death animation. If the target object dies during the effect, this will prevent " + "the object from playing another standard death animation after this clip finishes.\n" + "default: false\n"); + addField("lockAnimation", TYPEID< bool >(), myOffset(lock_anim), + "Indicates if user control of a Player should be temporarily blocked during the clip. (See afxAnimLockData.)\n" + "default: false\n"); + addField("ignoreFirstPerson", TYPEID< bool >(), myOffset(ignore_first_person), + "If true, the clip will not be played on targets that are the control object and the camera is in first person mode.\n" + "default: false\n"); + addField("ignoreThirdPerson", TYPEID< bool >(), myOffset(ignore_third_person), + "If true, the clip will not be played on targets that are the control object and the camera is in third person mode.\n" + "default: false\n"); + + // synonyms + addField("ignoreDisabled", TYPEID< bool >(), myOffset(ignore_disabled), + "A synonym for ignoreLiving."); + addField("ignoreEnabled", TYPEID< bool >(), myOffset(ignore_enabled), + "A synonym for ignoreCorpse."); + + Parent::initPersistFields(); +} + +bool afxAnimClipData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxAnimClipData::packData(BitStream* stream) +{ + Parent::packData(stream); + + merge_flags(); + + stream->writeString(clip_name); + stream->write(rate); + stream->write(pos_offset); + stream->write(trans); + stream->write(flags); +} + +void afxAnimClipData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + clip_name = stream->readSTString(); + stream->read(&rate); + stream->read(&pos_offset); + stream->read(&trans); + stream->read(&flags); + + expand_flags(); +} + +bool afxAnimClipData::writeField(StringTableEntry fieldname, const char* value) +{ + if (!Parent::writeField(fieldname, value)) + return false; + + // don't write the synonyms + if( fieldname == StringTable->insert("ignoreDisabled") ) + return false; + if( fieldname == StringTable->insert("ignoreEnabled") ) + return false; + + return true; +} + +void afxAnimClipData::expand_flags() +{ + ignore_disabled = ((flags & IGNORE_DISABLED) != 0); + ignore_enabled = ((flags & IGNORE_ENABLED) != 0); + lock_anim = ((flags & BLOCK_USER_CONTROL) != 0); + is_death_anim = ((flags & IS_DEATH_ANIM) != 0); + ignore_first_person = ((flags & IGNORE_FIRST_PERSON) != 0); + ignore_third_person = ((flags & IGNORE_THIRD_PERSON) != 0); +} + +void afxAnimClipData::merge_flags() +{ + flags = (((ignore_disabled) ? IGNORE_DISABLED : 0) | + ((ignore_enabled) ? IGNORE_ENABLED : 0) | + ((lock_anim) ? BLOCK_USER_CONTROL : 0) | + ((ignore_first_person) ? IGNORE_FIRST_PERSON : 0) | + ((ignore_third_person) ? IGNORE_THIRD_PERSON : 0) | + ((is_death_anim) ? IS_DEATH_ANIM : 0)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxAnimClip.h b/Engine/source/afx/ce/afxAnimClip.h new file mode 100644 index 000000000..4b1dbb0f3 --- /dev/null +++ b/Engine/source/afx/ce/afxAnimClip.h @@ -0,0 +1,81 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ANIM_CLIP_H_ +#define _AFX_ANIM_CLIP_H_ + +class afxAnimClipData : public GameBaseData +{ + typedef GameBaseData Parent; + + enum + { + IGNORE_DISABLED = BIT(0), + IGNORE_ENABLED = BIT(1), + IS_DEATH_ANIM = BIT(2), + BLOCK_USER_CONTROL = BIT(3), + IGNORE_FIRST_PERSON = BIT(4), + IGNORE_THIRD_PERSON = BIT(5) + }; + +public: + StringTableEntry clip_name; + F32 rate; + F32 pos_offset; + F32 trans; + U8 flags; + + bool ignore_disabled; + bool ignore_enabled; + bool is_death_anim; + bool lock_anim; + bool ignore_first_person; + bool ignore_third_person; + + void expand_flags(); + void merge_flags(); + +public: + /*C*/ afxAnimClipData(); + /*C*/ afxAnimClipData(const afxAnimClipData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + virtual bool writeField(StringTableEntry fieldname, const char* value); + + virtual void onStaticModified(const char* slotName, const char* newValue = NULL); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxAnimClipData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ANIM_CLIP_H_ diff --git a/Engine/source/afx/ce/afxAnimLock.cpp b/Engine/source/afx/ce/afxAnimLock.cpp new file mode 100644 index 000000000..cd5da6654 --- /dev/null +++ b/Engine/source/afx/ce/afxAnimLock.cpp @@ -0,0 +1,95 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxAnimLock.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxAnimLockData + +IMPLEMENT_CO_DATABLOCK_V1(afxAnimLockData); + +ConsoleDocClass( afxAnimLockData, + "@brief A datablock that specifies an Animation Lock effect.\n\n" + + "Animation Lock is used to temporarily lock out user-controlled Player actions, usually while an Animation Clip is " + "concurrently playing. Animation Clips can already do this, but must lock out user actions for the entire clip length. " + "Sometimes you only want to block user actions for a short section of a longer playing animation, such as the part where " + "the Player is thrown into the air from an impact. With Animation Lock, you can set a specific timespan for when user " + "actions are blocked, independent of any Animation Clip timing." + "\n\n" + + "The target of an Animation Lock is the constraint source object specified by the posConstraint field of the enclosing effect " + "wrapper. The target must be a Player, a subclass of Player, or an afxModel." + "\n\n" + + "The timing of the Animation Lock is determined by the timing fields of the enclosing effect wrapper." + "\n\n" + + "Locking behavior timing is set by fields of the enclosing effect wrapper, so afxAnimLockData does not require any fields. " + "However, TorqueScript syntax disallows the declaration of an empty datablock. Therefore, it is recommended that you set " + "a dynamic field named 'priority' to zero in the body of the datablock as a workaround to this limitation." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxAnimLockData::afxAnimLockData() +{ +} + +#define myOffset(field) Offset(field, afxAnimLockData) + +void afxAnimLockData::initPersistFields() +{ + Parent::initPersistFields(); +} + +bool afxAnimLockData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxAnimLockData::packData(BitStream* stream) +{ + Parent::packData(stream); +} + +void afxAnimLockData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxAnimLock.h b/Engine/source/afx/ce/afxAnimLock.h new file mode 100644 index 000000000..fea98194b --- /dev/null +++ b/Engine/source/afx/ce/afxAnimLock.h @@ -0,0 +1,48 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ANIM_LOCK_H_ +#define _AFX_ANIM_LOCK_H_ + +class afxAnimLockData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + /*C*/ afxAnimLockData(); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxAnimLockData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ANIM_LOCK_H_ diff --git a/Engine/source/afx/ce/afxAreaDamage.cpp b/Engine/source/afx/ce/afxAreaDamage.cpp new file mode 100644 index 000000000..bd63045c4 --- /dev/null +++ b/Engine/source/afx/ce/afxAreaDamage.cpp @@ -0,0 +1,121 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/ce/afxAreaDamage.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxAreaDamageData + +IMPLEMENT_CO_DATABLOCK_V1(afxAreaDamageData); + +ConsoleDocClass( afxAreaDamageData, + "@brief A datablock that specifies an Area Damage effect.\n\n" + + "An Area Damage effect is useful for assigning area damage with unusual timing that must be synchronized with other " + "effects. Negative damage amounts can be used for healing effects." + "\n\n" + + "The primary difference between afxAreaDamageData and afxDamageData, which is also capable of inflicting area damage, " + "is that afxAreaDamageData effects calculate the area damage in C++ code rather than calling out to the script function " + "radiusDamage(). In cases where area damage needs to be inflicted repeatedly or in areas crowded with many targets, " + "afxAreaDamageData is likely to get better performance." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxAreaDamageData::afxAreaDamageData() +{ + flavor = ST_NULLSTRING; + amount = 0; + radius = 0; + impulse = 0; + notify_damage_src = false; + exclude_cons_obj = false; +} + +afxAreaDamageData::afxAreaDamageData(const afxAreaDamageData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + flavor = other.flavor; + amount = other.amount; + radius = other.radius; + impulse = other.impulse; + notify_damage_src = other.notify_damage_src; + exclude_cons_obj = other.exclude_cons_obj; +} + +#define myOffset(field) Offset(field, afxAreaDamageData) + +void afxAreaDamageData::initPersistFields() +{ + addField("flavor", TypeString, myOffset(flavor), + "An arbitrary string which is passed as an argument to a spell's onDamage() script " + "method. It is used to classify a type of damage such as 'melee', 'magical', or " + "'fire'."); + addField("damage", TypeF32, myOffset(amount), + "An amount of area damage to inflict on a target. Objects within half the radius " + "receive full damage which then diminishes out to the full distance of the specified " + "radius."); + addField("radius", TypeF32, myOffset(radius), + "Radius centered at the effect position in which damage will be applied."); + addField("impulse", TypeF32, myOffset(impulse), + "Specifies an amount of force to apply to damaged objects. Objects within half the " + "radius receive full impulse which then diminishes out to the full distance of the " + "specified radius."); + addField("notifyDamageSource", TypeBool, myOffset(notify_damage_src), + "When true, the onInflictedAreaDamage() method of the damaged object will be called " + "to notify it of the damage. This is useful for starting some effects or action that " + "responds to the damage."); + addField("excludeConstraintObject", TypeBool, myOffset(exclude_cons_obj), + "When true, the object specified as the effect's primary position constraint will not " + "receive any damage."); + + Parent::initPersistFields(); +} + +bool afxAreaDamageData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxAreaDamageData::packData(BitStream* stream) +{ + Parent::packData(stream); +} + +void afxAreaDamageData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxAreaDamage.h b/Engine/source/afx/ce/afxAreaDamage.h new file mode 100644 index 000000000..4386acd4e --- /dev/null +++ b/Engine/source/afx/ce/afxAreaDamage.h @@ -0,0 +1,62 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_AREA_DAMAGE_H_ +#define _AFX_AREA_DAMAGE_H_ + +#include "afx/afxEffectDefs.h" + +class afxAreaDamageData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + StringTableEntry flavor; + + F32 amount; + F32 radius; + F32 impulse; + bool notify_damage_src; + bool exclude_cons_obj; + +public: + /*C*/ afxAreaDamageData(); + /*C*/ afxAreaDamageData(const afxAreaDamageData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxAreaDamageData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_AREA_DAMAGE_H_ diff --git a/Engine/source/afx/ce/afxAudioBank.cpp b/Engine/source/afx/ce/afxAudioBank.cpp new file mode 100644 index 000000000..2aa148474 --- /dev/null +++ b/Engine/source/afx/ce/afxAudioBank.cpp @@ -0,0 +1,246 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "sim/netConnection.h" +#include "sfx/sfxDescription.h" + +#include "afx/ce/afxAudioBank.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxAudioBank); + +ConsoleDocClass( afxAudioBank, + "@brief A datablock that specifies an Audio Bank effect.\n\n" + + "afxAudioBank is very similar to the stock Torque SFXProfile datablock but it allows specification of up to 32 different sound " + "files. The sound that actually plays is determined by the playIndex field." + "\n\n" + + "afxAudioBank is most useful when used in combination with field substitutions, whereby a substitution statement " + "assigned to playIndex selects a different sound (perhaps randomly) each time the effect is used." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxAudioBank::afxAudioBank() +{ + mPath = ST_NULLSTRING; + mDescriptionObjectID = 0; + mDescriptionObject = NULL; + mPreload = false; + play_index = -1; + + for (S32 i = 0; i < 32; i++) + mFilenames[i] = ST_NULLSTRING; +} + +afxAudioBank::afxAudioBank(const afxAudioBank& other, bool temp_clone) : SimDataBlock(other, temp_clone) +{ + mPath = other.mPath; + mDescriptionObject = other.mDescriptionObject; + mDescriptionObjectID = other.mDescriptionObjectID; // -- for pack/unpack of mDescriptionObject ptr + mPreload = other.mPreload; + play_index = other.play_index; + + for (S32 i = 0; i < 32; i++) + mFilenames[i] = other.mFilenames[i]; +} + +afxAudioBank::~afxAudioBank() +{ + if (!isTempClone()) + return; + + if (mDescriptionObject && mDescriptionObject->isTempClone()) + { + delete mDescriptionObject; + mDescriptionObject = 0; + } +} + +afxAudioBank* afxAudioBank::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + if (!owner) + return this; + + afxAudioBank* sub_profile_db = this; + + SFXDescription* desc_db; + if (mDescriptionObject && mDescriptionObject->getSubstitutionCount() > 0) + { + SFXDescription* orig_db = mDescriptionObject; + desc_db = new SFXDescription(*orig_db, true); + orig_db->performSubstitutions(desc_db, owner, index); + } + else + desc_db = 0; + + if (this->getSubstitutionCount() > 0 || desc_db) + { + sub_profile_db = new afxAudioBank(*this, true); + performSubstitutions(sub_profile_db, owner, index); + if (desc_db) + sub_profile_db->mDescriptionObject = desc_db; + } + + return sub_profile_db; +} + +void afxAudioBank::onPerformSubstitutions() +{ +} + +void afxAudioBank::initPersistFields() +{ + addField("path", TypeFilename, Offset(mPath, afxAudioBank), + "A filesystem path to the folder containing the sound files specified by the " + "filenames[] field. All sound files used in a single AudioBank must be located in " + "the same folder."); + addField("filenames", TypeString, Offset(mFilenames, afxAudioBank), 32, + "Up to 32 names of sound files found in the path folder. The sound that is actually " + "played by an Audio Bank effect is determined by the playIndex field."); + addField("description", TYPEID(), Offset(mDescriptionObject, afxAudioBank), + "SFXDescription datablock to use with this set of sounds."); + addField("preload", TypeBool, Offset(mPreload, afxAudioBank), + "If set to true, file is pre-loaded, otherwise it is loaded on-demand."); + addField("playIndex", TypeS32, Offset(play_index, afxAudioBank), + "An array index that selects a sound to play from the filenames[] field. Values " + "outside of the range of assigned filename[] entries will not play any sound."); + + Parent::initPersistFields(); +} + +bool afxAudioBank::preload(bool server, String &errorStr) +{ + if(!Parent::preload(server, errorStr)) + return false; + + return true; +} + +bool afxAudioBank::onAdd() +{ + if (!Parent::onAdd()) + return false; + + if (!mDescriptionObject && mDescriptionObjectID) + Sim::findObject(mDescriptionObjectID , mDescriptionObject); + + // if this is client side, make sure that description is as well + if(mDescriptionObject) + { // client side dataBlock id's are not in the dataBlock id range + if (getId() >= DataBlockObjectIdFirst && getId() <= DataBlockObjectIdLast) + { + SimObjectId pid = mDescriptionObject->getId(); + if (pid < DataBlockObjectIdFirst || pid > DataBlockObjectIdLast) + { + Con::errorf(ConsoleLogEntry::General,"afxAudioBank: data dataBlock not networkable (use datablock to create)."); + return false; + } + } + } + + return(true); +} + +void afxAudioBank::packData(BitStream* stream) +{ + Parent::packData(stream); + + if (stream->writeFlag(mDescriptionObject)) + stream->writeRangedU32(mDescriptionObject->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); + + /* + char buffer[256]; + if(!mFilename) + buffer[0] = 0; + else + dStrcpy(buffer, mFilename); + stream->writeString(buffer); + */ + + stream->writeString(mPath); + + for (S32 i = 0; i < 32; i++) + { + stream->writeString(mFilenames[i]); + if (mFilenames[i] == ST_NULLSTRING) + break; + } + + stream->writeFlag(mPreload); + + if (stream->writeFlag(play_index >= 0 && play_index < 32)) + stream->writeInt(play_index, 5); +} + +void afxAudioBank::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + if (stream->readFlag()) // AudioDescription + { + SimObjectId id = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + mDescriptionObjectID = id; + Sim::findObject(id, mDescriptionObject); + } + + // Filename + /* + char buffer[256]; + stream->readString(buffer); + mFilename = StringTable->insert(buffer); + */ + + char buffer[256]; + + stream->readString(buffer); + mPath = StringTable->insert(buffer); + + for (S32 i = 0; i < 32; i++) + { + stream->readString(buffer); + mFilenames[i] = StringTable->insert(buffer); + if (mFilenames[i] == ST_NULLSTRING) + break; + } + + mPreload = stream->readFlag(); // Preload + + if (stream->readFlag()) + play_index = stream->readInt(5); + else + play_index = -1; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/ce/afxAudioBank.h b/Engine/source/afx/ce/afxAudioBank.h new file mode 100644 index 000000000..e7f9ee4d3 --- /dev/null +++ b/Engine/source/afx/ce/afxAudioBank.h @@ -0,0 +1,67 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_AUDIO_BANK_H_ +#define _AFX_AUDIO_BANK_H_ + +class SFXDescription; + +class afxAudioBank: public SimDataBlock +{ +private: + typedef SimDataBlock Parent; + +public: + SFXDescription* mDescriptionObject; + U32 mDescriptionObjectID; + StringTableEntry mPath; + StringTableEntry mFilenames[32]; + bool mPreload; + S32 play_index; + +public: + /*C*/ afxAudioBank(); + /*C*/ afxAudioBank(const afxAudioBank&, bool = false); + /*D*/ ~afxAudioBank(); + + static void initPersistFields(); + + virtual bool onAdd(); + virtual void packData(BitStream* stream); + virtual void unpackData(BitStream* stream); + + bool preload(bool server, String &errorStr); + + afxAudioBank* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } + + DECLARE_CONOBJECT(afxAudioBank); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_AUDIO_BANK_H_ diff --git a/Engine/source/afx/ce/afxBillboard.cpp b/Engine/source/afx/ce/afxBillboard.cpp new file mode 100644 index 000000000..f7f4db780 --- /dev/null +++ b/Engine/source/afx/ce/afxBillboard.cpp @@ -0,0 +1,294 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "gfx/gfxAPI.h" +#include "math/mathIO.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxBillboard.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxBillboardData + +IMPLEMENT_CO_DATABLOCK_V1(afxBillboardData); + +ConsoleDocClass( afxBillboardData, + "@brief A datablock that specifies a Billboard effect.\n\n" + + "A Billboard effect is a textured quadrangle which is always aligned to face towards the camera. It is much like a single " + "static particle and is rendered in a similar fashion." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxBillboardData::afxBillboardData() +{ + color.set(1.0f, 1.0f, 1.0f, 1.0f); + txr_name = ST_NULLSTRING; + dimensions.set(1.0f, 1.0f); + texCoords[0].set(0.0f, 0.0f); + texCoords[1].set(0.0f, 1.0f); + texCoords[2].set(1.0f, 1.0f); + texCoords[3].set(1.0f, 0.0f); + blendStyle = BlendUndefined; + srcBlendFactor = BLEND_UNDEFINED; + dstBlendFactor = BLEND_UNDEFINED; + texFunc = TexFuncModulate; +} + +afxBillboardData::afxBillboardData(const afxBillboardData& other, bool temp_clone) + : GameBaseData(other, temp_clone) +{ + color = other.color; + txr_name = other.txr_name; + txr = other.txr; + dimensions = other.dimensions; + texCoords[0] = other.texCoords[0]; + texCoords[1] = other.texCoords[1]; + texCoords[2] = other.texCoords[2]; + texCoords[3] = other.texCoords[3]; + blendStyle = other.blendStyle; + srcBlendFactor = other.srcBlendFactor; + dstBlendFactor = other.dstBlendFactor; + texFunc = other.texFunc; +} + +#define myOffset(field) Offset(field, afxBillboardData) + +extern EnumTable srcBlendFactorTable; +extern EnumTable dstBlendFactorTable; + +ImplementEnumType( afxBillboard_BlendStyle, "Possible blending types.\n" "@ingroup afxBillboard\n\n" ) + { afxBillboardData::BlendNormal, "NORMAL", "..." }, + { afxBillboardData::BlendAdditive, "ADDITIVE", "..." }, + { afxBillboardData::BlendSubtractive, "SUBTRACTIVE", "..." }, + { afxBillboardData::BlendPremultAlpha, "PREMULTALPHA", "..." }, +EndImplementEnumType; + +ImplementEnumType( afxBillboard_TexFuncType, "Possible texture function types.\n" "@ingroup afxBillboard\n\n" ) + { afxBillboardData::TexFuncReplace, "replace", "..." }, + { afxBillboardData::TexFuncModulate, "modulate", "..." }, + { afxBillboardData::TexFuncAdd, "add", "..." }, +EndImplementEnumType; + +void afxBillboardData::initPersistFields() +{ + addField("color", TypeColorF, myOffset(color), + "The color assigned to the quadrangle geometry. The way it combines with the given " + "texture varies according to the setting of the textureFunction field."); + addField("texture", TypeFilename, myOffset(txr_name), + "An image to use as the billboard's texture."); + addField("dimensions", TypePoint2F, myOffset(dimensions), + "A value-pair that specifies the horizontal and vertical dimensions of the billboard " + "in scene units."); + addField("textureCoords", TypePoint2F, myOffset(texCoords), 4, + "An array of four value-pairs that specify the UV texture coordinates for the four " + "corners of the billboard's quadrangle."); + + addField("blendStyle", TYPEID(), myOffset(blendStyle), + "Selects a common blend factor preset. When set to 'user', srcBlendFactor and " + "dstBlendFactor can be used to set additional blend factor combinations.\n" + "Possible values: normal, additive, subtractive, premultalpha, or user."); + addField("srcBlendFactor", TYPEID(), myOffset(srcBlendFactor), + "Specifies source blend factor when blendStyle is set to 'user'.\n" + "Possible values: GFXBlendZero, GFXBlendOne, GFXBlendDestColor, GFXBlendInvDestColor, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha, GFXBlendDestAlpha, GFXBlendInvDestAlpha, or GFXBlendSrcAlphaSat"); + addField("dstBlendFactor", TYPEID(), myOffset(dstBlendFactor), + "Specifies destination blend factor when blendStyle is set to 'user'.\n" + "Possible values: GFXBlendZero, GFXBlendOne, GFXBlendSrcColor, GFXBlendInvSrcColor, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha, GFXBlendDestAlpha, or GFXBlendInvDestAlpha"); + + addField("textureFunction", TYPEID(), myOffset(texFunc), + "Selects a texture function that determines how the texture pixels are combined " + "with the shaded color of the billboard's quadrangle geometry.\n" + "Possible values: replace, modulate, or add."); + + Parent::initPersistFields(); +} + +void afxBillboardData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(color); + stream->writeString(txr_name); + mathWrite(*stream, dimensions); + mathWrite(*stream, texCoords[0]); + mathWrite(*stream, texCoords[1]); + mathWrite(*stream, texCoords[2]); + mathWrite(*stream, texCoords[3]); + + stream->writeInt(srcBlendFactor, 4); + stream->writeInt(dstBlendFactor, 4); + stream->writeInt(texFunc, 4); +} + +void afxBillboardData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&color); + txr_name = stream->readSTString(); + txr = GFXTexHandle(); + mathRead(*stream, &dimensions); + mathRead(*stream, &texCoords[0]); + mathRead(*stream, &texCoords[1]); + mathRead(*stream, &texCoords[2]); + mathRead(*stream, &texCoords[3]); + + srcBlendFactor = (GFXBlend) stream->readInt(4); + dstBlendFactor = (GFXBlend) stream->readInt(4); + texFunc = stream->readInt(4); +} + +bool afxBillboardData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + if (!server) + { + if (txr_name && txr_name[0] != '\0') + { + txr.set(txr_name, &GFXStaticTextureSRGBProfile, "Billboard Texture"); + } + } + + // if blend-style is set to User, check for defined blend-factors + if (blendStyle == BlendUser && (srcBlendFactor == BLEND_UNDEFINED || dstBlendFactor == BLEND_UNDEFINED)) + { + blendStyle = BlendUndefined; + Con::warnf(ConsoleLogEntry::General, "afxBillboardData(%s) incomplete blend factor specification.", getName()); + } + + // silently switch Undefined blend-style to User if blend factors are both defined + if (blendStyle == BlendUndefined && srcBlendFactor != BLEND_UNDEFINED && dstBlendFactor != BLEND_UNDEFINED) + { + blendStyle = BlendUser; + } + + // set pre-defined blend-factors + switch (blendStyle) + { + case BlendNormal: + srcBlendFactor = GFXBlendSrcAlpha; + dstBlendFactor = GFXBlendInvSrcAlpha; + break; + case BlendSubtractive: + srcBlendFactor = GFXBlendZero; + dstBlendFactor = GFXBlendInvSrcColor; + break; + case BlendPremultAlpha: + srcBlendFactor = GFXBlendOne; + dstBlendFactor = GFXBlendInvSrcAlpha; + break; + case BlendUser: + break; + case BlendAdditive: + srcBlendFactor = GFXBlendSrcAlpha; + dstBlendFactor = GFXBlendOne; + break; + case BlendUndefined: + default: + blendStyle = BlendNormal; + srcBlendFactor = GFXBlendSrcAlpha; + dstBlendFactor = GFXBlendInvSrcAlpha; + break; + } + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxBillboard + +IMPLEMENT_CO_NETOBJECT_V1(afxBillboard); + +ConsoleDocClass( afxBillboard, + "@brief A Billboard effect as defined by an afxBillboardData datablock.\n\n" + + "A Billboard effect is a textured quadrangle which is always aligned to " + "face towards the camera. It is much like a single static particle and is rendered " + "in a similar fashion.\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" +); + +afxBillboard::afxBillboard() +{ + mNetFlags.clear(); + mNetFlags.set(IsGhost); + + mDataBlock = 0; + fade_amt = 1.0f; + is_visible = true; + sort_priority = 0; + live_color.set(1.0f, 1.0f, 1.0f, 1.0f); +} + +afxBillboard::~afxBillboard() +{ +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxBillboard::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + live_color = mDataBlock->color; + + return true; +} + +bool afxBillboard::onAdd() +{ + if(!Parent::onAdd()) + return false; + + F32 width = mDataBlock->dimensions.x * 0.5f; + F32 height = mDataBlock->dimensions.y * 0.5f; + mObjBox = Box3F(Point3F(-width, -0.01f, -height), Point3F(width, 0.01f, height)); + + addToScene(); + + return true; +} + +void afxBillboard::onRemove() +{ + removeFromScene(); + + Parent::onRemove(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxBillboard.h b/Engine/source/afx/ce/afxBillboard.h new file mode 100644 index 000000000..1c5d2e36b --- /dev/null +++ b/Engine/source/afx/ce/afxBillboard.h @@ -0,0 +1,131 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_BILLBOARD_H_ +#define _AFX_BILLBOARD_H_ + +#include "afx/afxEffectDefs.h" + +#define BLEND_UNDEFINED GFXBlend_COUNT + +class afxBillboardData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + // This enum specifies common blend settings with predefined values + // for src/dst blend factors. + enum BlendStyle { + BlendUndefined, + BlendNormal, + BlendAdditive, + BlendSubtractive, + BlendPremultAlpha, + BlendUser, + }; + + enum TexFuncType { + TexFuncReplace, + TexFuncModulate, + TexFuncAdd, + }; + +public: + StringTableEntry txr_name; + GFXTexHandle txr; + + LinearColorF color; + Point2F texCoords[4]; + Point2F dimensions; + S32 blendStyle; + GFXBlend srcBlendFactor; + GFXBlend dstBlendFactor; + S32 texFunc; + +public: + /*C*/ afxBillboardData(); + /*C*/ afxBillboardData(const afxBillboardData&, bool = false); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxBillboardData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxBillboardData::BlendStyle afxBillboard_BlendStyle; +DefineEnumType( afxBillboard_BlendStyle ); + +typedef afxBillboardData::TexFuncType afxBillboard_TexFuncType; +DefineEnumType( afxBillboard_TexFuncType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxBillboard + +class afxBillboard : public GameBase, public afxEffectDefs +{ + typedef GameBase Parent; + friend class afxEA_Billboard; + +private: + afxBillboardData* mDataBlock; + + F32 fade_amt; + bool is_visible; + S8 sort_priority; + LinearColorF live_color; + + GFXStateBlockRef normal_sb; + GFXStateBlockRef reflected_sb; + +public: + /*C*/ afxBillboard(); + /*D*/ ~afxBillboard(); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual bool onAdd(); + virtual void onRemove(); + + void setFadeAmount(F32 amt) { fade_amt = amt; } + void setSortPriority(S8 priority) { sort_priority = priority; } + void setVisibility(bool flag) { is_visible = flag; } + + virtual void prepRenderImage(SceneRenderState*); + + void _renderBillboard(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*); + + DECLARE_CONOBJECT(afxBillboard); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_BILLBOARD_H_ diff --git a/Engine/source/afx/ce/afxBillboard_T3D.cpp b/Engine/source/afx/ce/afxBillboard_T3D.cpp new file mode 100644 index 000000000..429a4f51a --- /dev/null +++ b/Engine/source/afx/ce/afxBillboard_T3D.cpp @@ -0,0 +1,145 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "gfx/gfxTransformSaver.h" +#include "gfx/primBuilder.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxBillboard.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxBillboard::prepRenderImage(SceneRenderState* state) +{ + if (!is_visible) + return; + + ObjectRenderInst *ri = state->getRenderPass()->allocInst(); + ri->renderDelegate.bind(this, &afxBillboard::_renderBillboard); + ri->type = RenderPassManager::RIT_ObjectTranslucent; + ri->translucentSort = true; + ri->defaultKey = (U32)(dsize_t)mDataBlock; + ri->sortDistSq = getWorldBox().getSqDistanceToPoint( state->getCameraPosition() ); + state->getRenderPass()->addInst(ri); +} + +void afxBillboard::_renderBillboard(ObjectRenderInst *ri, SceneRenderState* state, BaseMatInstance* overrideMat) +{ + if (overrideMat) + return; + + // predraw + if (normal_sb.isNull()) + { + GFXStateBlockDesc desc; + + // Culling -- it's a billboard, so no backfaces + desc.setCullMode(GFXCullCW); + + // Blending + desc.setBlend(true, mDataBlock->srcBlendFactor, mDataBlock->dstBlendFactor); + desc.alphaTestEnable = (desc.blendSrc == GFXBlendSrcAlpha && + (desc.blendDest == GFXBlendInvSrcAlpha || desc.blendDest == GFXBlendOne)); + desc.alphaTestRef = 1; + desc.alphaTestFunc = GFXCmpGreaterEqual; + + desc.setZReadWrite(true); + desc.zFunc = GFXCmpLessEqual; + desc.zWriteEnable = false; + + desc.samplersDefined = true; + switch (mDataBlock->texFunc) + { + case afxBillboardData::TexFuncReplace: + desc.samplers[0].textureColorOp = GFXTOPDisable; + break; + case afxBillboardData::TexFuncModulate: + desc.samplers[0].textureColorOp = GFXTOPModulate; + break; + case afxBillboardData::TexFuncAdd: + desc.samplers[0].textureColorOp = GFXTOPAdd; + break; + } + + desc.samplers[1].textureColorOp = GFXTOPDisable; + + normal_sb = GFX->createStateBlock(desc); + + desc.setCullMode(GFXCullCCW); + reflected_sb = GFX->createStateBlock(desc); + } + + if (state->isReflectPass()) + GFX->setStateBlock(reflected_sb); + else + GFX->setStateBlock(normal_sb); + + GFXTransformSaver saver; + GFX->multWorld(getRenderTransform()); + + GFX->setTexture(0, mDataBlock->txr); + + MatrixF worldmod = GFX->getWorldMatrix(); + MatrixF viewmod = GFX->getViewMatrix(); + + Point4F Position; + MatrixF ModelView; + ModelView.mul(viewmod, worldmod); + ModelView.getColumn(3, &Position); + ModelView.identity(); + ModelView.setColumn(3, Position); + + GFX->setWorldMatrix(ModelView); + MatrixF ident; + ident.identity(); + GFX->setViewMatrix(ident); + + F32 width = mDataBlock->dimensions.x * 0.5f * mObjScale.x; + F32 height = mDataBlock->dimensions.y * 0.5f * mObjScale.z; + + Point3F points[4]; + points[0].set( width, 0.0f, -height); + points[1].set(-width, 0.0f, -height); + points[2].set(-width, 0.0f, height); + points[3].set( width, 0.0f, height); + + PrimBuild::begin(GFXTriangleStrip, 4); + { + PrimBuild::color4f(live_color.red, live_color.green, live_color.blue, live_color.alpha*fade_amt); + PrimBuild::texCoord2f(mDataBlock->texCoords[1].x, mDataBlock->texCoords[1].y); + PrimBuild::vertex3fv(points[1]); + PrimBuild::texCoord2f(mDataBlock->texCoords[2].x, mDataBlock->texCoords[2].y); + PrimBuild::vertex3fv(points[0]); + PrimBuild::texCoord2f(mDataBlock->texCoords[0].x, mDataBlock->texCoords[0].y); + PrimBuild::vertex3fv(points[2]); + PrimBuild::texCoord2f(mDataBlock->texCoords[3].x, mDataBlock->texCoords[3].y); + PrimBuild::vertex3fv(points[3]); + } + PrimBuild::end(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxCameraPuppet.cpp b/Engine/source/afx/ce/afxCameraPuppet.cpp new file mode 100644 index 000000000..14b578494 --- /dev/null +++ b/Engine/source/afx/ce/afxCameraPuppet.cpp @@ -0,0 +1,132 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "scene/sceneRenderState.h" +#include "math/mathIO.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxCameraPuppet.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxCameraPuppetData + +IMPLEMENT_CO_DATABLOCK_V1(afxCameraPuppetData); + +ConsoleDocClass( afxCameraPuppetData, + "@brief A datablock that specifies a Camera Puppet effect.\n\n" + + "A Camera Puppet effect is used to control the position and orientation of the camera using the AFX constraint system. " + "Camera Puppet effects are useful for creating small cut-scenes and can add a lot of visual drama to a spell or effectron " + "effect." + "\n\n" + + "Effective use of Camera Puppet effects require a fairly advanced understanding of how Torque cameras work in a " + "server-client context. Care must be taken to prevent client cameras from drifting too far out of sync from the server camera. " + "Otherwise, obvious discontinuities in the motion will result when the Camera Puppet ends and control is restored to the " + "server camera. Scoping problems can also result if a client camera is moved to a location that is inconsistent with the " + "scene scoping done by the server camera." + "\n\n" + + "Often it is useful to manage camera controlling in an isolated effectron rather than directly incorporated into a magic-spell. " + "This way the camera controlling effectron can target the specific client associated with the spellcaster. The spellcasting " + "player observes the spell in a dramatic cut-scene-like fashion while other players continue to observe from their own " + "viewing locations." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxCameraPuppetData::afxCameraPuppetData() +{ + cam_spec = ST_NULLSTRING; + networking = SERVER_AND_CLIENT; +} + +afxCameraPuppetData::afxCameraPuppetData(const afxCameraPuppetData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + cam_spec = other.cam_spec; + networking = other.networking; +} + +#define myOffset(field) Offset(field, afxCameraPuppetData) + +void afxCameraPuppetData::initPersistFields() +{ + addField("cameraSpec", TypeString, myOffset(cam_spec), + "This field is like the effect-wrapper fields for specifying constraint sources, " + "but here it specifies a target for the camera-puppet effect."); + addField("networking", TypeS8, myOffset(networking), + "Specifies the networking model used for the camerapuppet effect. The effect can " + "puppet just the server camera, just the client camera, or both.\n" + "Possible values: $AFX::SERVER_ONLY, $AFX::CLIENT_ONLY, or $AFX::SERVER_AND_CLIENT."); + + // disallow some field substitutions + disableFieldSubstitutions("cameraSpec"); + disableFieldSubstitutions("networking"); + + Parent::initPersistFields(); +} + +bool afxCameraPuppetData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + bool runs_on_s = ((networking & (SERVER_ONLY | SERVER_AND_CLIENT)) != 0); + bool runs_on_c = ((networking & (CLIENT_ONLY | SERVER_AND_CLIENT)) != 0); + cam_def.parseSpec(cam_spec, runs_on_s, runs_on_c); + + return true; +} + +void afxCameraPuppetData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(cam_spec); + stream->write(networking); +} + +void afxCameraPuppetData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + cam_spec = stream->readSTString(); + stream->read(&networking); +} + +void afxCameraPuppetData::gather_cons_defs(Vector& defs) +{ + if (cam_def.isDefined()) + defs.push_back(cam_def); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxCameraPuppet.h b/Engine/source/afx/ce/afxCameraPuppet.h new file mode 100644 index 000000000..4226e1242 --- /dev/null +++ b/Engine/source/afx/ce/afxCameraPuppet.h @@ -0,0 +1,64 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CAMERA_PUPPET_H_ +#define _AFX_CAMERA_PUPPET_H_ + +#include "afx/ce/afxComponentEffect.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxConstraint.h" + +class afxCameraPuppetData : public GameBaseData, public afxEffectDefs, public afxComponentEffectData +{ + typedef GameBaseData Parent; + +public: + StringTableEntry cam_spec; + afxConstraintDef cam_def; + + U8 networking; + + virtual void gather_cons_defs(Vector& defs); + +public: + /*C*/ afxCameraPuppetData(); + /*C*/ afxCameraPuppetData(const afxCameraPuppetData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxCameraPuppetData); + DECLARE_CATEGORY("AFX"); +}; + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_CAMERA_PUPPET_H_ diff --git a/Engine/source/afx/ce/afxCameraShake.cpp b/Engine/source/afx/ce/afxCameraShake.cpp new file mode 100644 index 000000000..152deaff2 --- /dev/null +++ b/Engine/source/afx/ce/afxCameraShake.cpp @@ -0,0 +1,118 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxCameraShake.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxCameraShakeData + +IMPLEMENT_CO_DATABLOCK_V1(afxCameraShakeData); + +ConsoleDocClass( afxCameraShakeData, + "@brief A datablock that specifies a Camera Shake effect.\n\n" + + "Camera Shake internally utilizes the standard Torque CameraShake class to implement a shaken camera effect." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxCameraShakeData::afxCameraShakeData() +{ + camShakeFreq.set( 10.0, 10.0, 10.0 ); + camShakeAmp.set( 1.0, 1.0, 1.0 ); + camShakeRadius = 10.0; + camShakeFalloff = 10.0; +} + +afxCameraShakeData::afxCameraShakeData(const afxCameraShakeData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + camShakeFreq = other.camShakeFreq; + camShakeAmp = other.camShakeAmp; + camShakeRadius = other.camShakeRadius; + camShakeFalloff = other.camShakeFalloff; +} + +#define myOffset(field) Offset(field, afxCameraShakeData) + +void afxCameraShakeData::initPersistFields() +{ + addField("frequency", TypePoint3F, Offset(camShakeFreq, afxCameraShakeData), + "The camera shake frequencies for all three axes: X, Y, Z."); + addField("amplitude", TypePoint3F, Offset(camShakeAmp, afxCameraShakeData), + "The camera shake amplitudes for all three axes: X, Y, Z."); + addField("radius", TypeF32, Offset(camShakeRadius, afxCameraShakeData), + "Radius about the effect position in which shaking will be applied."); + addField("falloff", TypeF32, Offset(camShakeFalloff, afxCameraShakeData), + "Magnitude by which shaking decreases over distance to radius."); + + Parent::initPersistFields(); +} + +bool afxCameraShakeData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxCameraShakeData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(camShakeFreq.x); + stream->write(camShakeFreq.y); + stream->write(camShakeFreq.z); + stream->write(camShakeAmp.x); + stream->write(camShakeAmp.y); + stream->write(camShakeAmp.z); + stream->write(camShakeRadius); + stream->write(camShakeFalloff); +} + +void afxCameraShakeData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&camShakeFreq.x); + stream->read(&camShakeFreq.y); + stream->read(&camShakeFreq.z); + stream->read(&camShakeAmp.x); + stream->read(&camShakeAmp.y); + stream->read(&camShakeAmp.z); + stream->read(&camShakeRadius); + stream->read(&camShakeFalloff); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxCameraShake.h b/Engine/source/afx/ce/afxCameraShake.h new file mode 100644 index 000000000..ca0bfb439 --- /dev/null +++ b/Engine/source/afx/ce/afxCameraShake.h @@ -0,0 +1,57 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CAMERA_SHAKE_H_ +#define _AFX_CAMERA_SHAKE_H_ + +class afxCameraShakeData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + VectorF camShakeFreq; + VectorF camShakeAmp; + F32 camShakeRadius; + F32 camShakeFalloff; + +public: + /*C*/ afxCameraShakeData(); + /*C*/ afxCameraShakeData(const afxCameraShakeData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxCameraShakeData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_CAMERA_SHAKE_H_ diff --git a/Engine/source/afx/ce/afxCollisionEvent.cpp b/Engine/source/afx/ce/afxCollisionEvent.cpp new file mode 100644 index 000000000..9b51e2dc7 --- /dev/null +++ b/Engine/source/afx/ce/afxCollisionEvent.cpp @@ -0,0 +1,103 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxCollisionEvent.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxCollisionEventData + +IMPLEMENT_CO_DATABLOCK_V1(afxCollisionEventData); + +ConsoleDocClass( afxCollisionEventData, + "@brief A datablock that specifies a Collision Event effect.\n\n" + + "MORE NEEDED HERE.\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxCollisionEventData::afxCollisionEventData() +{ + method_name = ST_NULLSTRING; + script_data = ST_NULLSTRING; + gen_trigger = false; + trigger_bit = 0; +} + +afxCollisionEventData::afxCollisionEventData(const afxCollisionEventData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + method_name = other.method_name; + script_data = other.script_data; + gen_trigger = other.gen_trigger; + trigger_bit = other.trigger_bit; +} + +#define myOffset(field) Offset(field, afxCollisionEventData) + +void afxCollisionEventData::initPersistFields() +{ + addField("methodName", TypeString, myOffset(method_name), + "..."); + addField("scriptData", TypeString, myOffset(script_data), + "..."); + addField("generateTrigger", TypeBool, myOffset(gen_trigger), + "..."); + addField("triggerBit", TypeS8, myOffset(trigger_bit), + "..."); + + Parent::initPersistFields(); +} + +void afxCollisionEventData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(method_name); + stream->writeString(script_data); + if (stream->writeFlag(gen_trigger)) + stream->write(trigger_bit); +} + +void afxCollisionEventData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + method_name = stream->readSTString(); + script_data = stream->readSTString(); + gen_trigger = stream->readFlag(); + if (gen_trigger) + stream->read(&trigger_bit); + else + trigger_bit = 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxCollisionEvent.h b/Engine/source/afx/ce/afxCollisionEvent.h new file mode 100644 index 000000000..31f6e09a1 --- /dev/null +++ b/Engine/source/afx/ce/afxCollisionEvent.h @@ -0,0 +1,59 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_COLLISION_EVENT_H_ +#define _AFX_COLLISION_EVENT_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxCollisionEventData + +struct afxCollisionEventData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + StringTableEntry method_name; + StringTableEntry script_data; + bool gen_trigger; + U8 trigger_bit; + +public: + /*C*/ afxCollisionEventData(); + /*C*/ afxCollisionEventData(const afxCollisionEventData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxCollisionEventData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_COLLISION_EVENT_H_ diff --git a/Engine/source/afx/ce/afxComponentEffect.h b/Engine/source/afx/ce/afxComponentEffect.h new file mode 100644 index 000000000..5491b7891 --- /dev/null +++ b/Engine/source/afx/ce/afxComponentEffect.h @@ -0,0 +1,41 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_COMPONENT_EFFECT_H_ +#define _AFX_COMPONENT_EFFECT_H_ + +#include "core/util/tVector.h" + +#include "afx/afxConstraint.h" + +class afxComponentEffectData +{ +public: + virtual void gather_cons_defs(Vector& defs) { }; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_COMPONENT_EFFECT_H_ diff --git a/Engine/source/afx/ce/afxConsoleMessage.cpp b/Engine/source/afx/ce/afxConsoleMessage.cpp new file mode 100644 index 000000000..4854eef48 --- /dev/null +++ b/Engine/source/afx/ce/afxConsoleMessage.cpp @@ -0,0 +1,93 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxConsoleMessage.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxConsoleMessageData + +IMPLEMENT_CO_DATABLOCK_V1(afxConsoleMessageData); + +ConsoleDocClass( afxConsoleMessageData, + "@brief A datablock that specifies a Console Message effect.\n\n" + + "Console Message effects are useful for debugging purposes when you want to make sure that an effect with a certain kind " + "of timing is actually getting executed and for evaluating some kinds of field substitutions." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxConsoleMessageData::afxConsoleMessageData() +{ + message_str = ST_NULLSTRING; +} + +afxConsoleMessageData::afxConsoleMessageData(const afxConsoleMessageData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + message_str = other.message_str; +} + +#define myOffset(field) Offset(field, afxConsoleMessageData) + +void afxConsoleMessageData::initPersistFields() +{ + addField("message", TypeString, myOffset(message_str), + "A text message to be displayed when the effect is executed."); + + Parent::initPersistFields(); +} + +bool afxConsoleMessageData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxConsoleMessageData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(message_str); +} + +void afxConsoleMessageData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + message_str = stream->readSTString(); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxConsoleMessage.h b/Engine/source/afx/ce/afxConsoleMessage.h new file mode 100644 index 000000000..224107181 --- /dev/null +++ b/Engine/source/afx/ce/afxConsoleMessage.h @@ -0,0 +1,54 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CONSOLE_MESSAGE_H_ +#define _AFX_CONSOLE_MESSAGE_H_ + +class afxConsoleMessageData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + StringTableEntry message_str; + +public: + /*C*/ afxConsoleMessageData(); + /*C*/ afxConsoleMessageData(const afxConsoleMessageData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxConsoleMessageData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_CONSOLE_MESSAGE_H_ diff --git a/Engine/source/afx/ce/afxDamage.cpp b/Engine/source/afx/ce/afxDamage.cpp new file mode 100644 index 000000000..4d8ca412a --- /dev/null +++ b/Engine/source/afx/ce/afxDamage.cpp @@ -0,0 +1,140 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxDamage.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxDamageData + +IMPLEMENT_CO_DATABLOCK_V1(afxDamageData); + +ConsoleDocClass( afxDamageData, + "@brief A datablock that specifies a Damage effect.\n\n" + + "A Damage effect is useful for assigning damage with unusual timing that must be synchronized with other effects. They " + "can be used to deal direct damage, radius damage, and damage over time. Negative damage amounts can be used for " + "healing effects." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxDamageData::afxDamageData() +{ + label = ST_NULLSTRING; + flavor = ST_NULLSTRING; + amount = 0; + repeats = 1; + ad_amount = 0; + radius = 0; + impulse = 0; +} + +afxDamageData::afxDamageData(const afxDamageData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + label = other.label; + flavor = other.flavor; + amount = other.amount; + repeats = other.repeats; + ad_amount = other.ad_amount; + radius = other.radius; + impulse = other.impulse; +} + +#define myOffset(field) Offset(field, afxDamageData) + +void afxDamageData::initPersistFields() +{ + addField("label", TypeString, myOffset(label), + "An arbitrary string which is passed as an argument to a spell's onDamage() script " + "method. It can be used to identify which damage effect the damage came from in " + "cases where more than one damage effect is used in a single spell."); + addField("flavor", TypeString, myOffset(flavor), + "An arbitrary string which is passed as an argument to a spell's onDamage() script " + "method. It is used to classify a type of damage such as 'melee', 'magical', or " + "'fire'."); + addField("directDamage", TypeF32, myOffset(amount), + "An amount of direct damage to inflict on a target."); + addField("directDamageRepeats", TypeS8, myOffset(repeats), + "The number of times to inflict the damage specified by directDamage. Values " + "greater than 1 inflict damage over time, with the amount of directDamage " + "repeatedly dealt at evenly spaced intervals over the lifetime of the effect."); + addField("areaDamage", TypeF32, myOffset(ad_amount), + "An amount of area damage to inflict on a target. Objects within half the radius " + "receive full damage which then diminishes out to the full distance of " + "areaDamageRadius."); + addField("areaDamageRadius", TypeF32, myOffset(radius), + "Radius centered at the effect position in which damage will be applied."); + addField("areaDamageImpulse", TypeF32, myOffset(impulse), + "Specifies an amount of force to apply to damaged objects. Objects within half the " + "radius receive full impulse which then diminishes out to the full distance of " + "areaDamageRadius."); + + Parent::initPersistFields(); +} + +bool afxDamageData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxDamageData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(label); + stream->writeString(flavor); + stream->write(amount); + stream->write(repeats); + stream->write(ad_amount); + stream->write(radius); + stream->write(impulse); +} + +void afxDamageData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + label = stream->readSTString(); + flavor = stream->readSTString(); + stream->read(&amount); + stream->read(&repeats); + stream->read(&ad_amount); + stream->read(&radius); + stream->read(&impulse); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxDamage.h b/Engine/source/afx/ce/afxDamage.h new file mode 100644 index 000000000..19b6e7943 --- /dev/null +++ b/Engine/source/afx/ce/afxDamage.h @@ -0,0 +1,63 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_DAMAGE_H_ +#define _AFX_DAMAGE_H_ + +#include "afx/afxEffectDefs.h" + +class afxDamageData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + StringTableEntry label; + StringTableEntry flavor; + + F32 amount; + U8 repeats; + F32 ad_amount; + F32 radius; + F32 impulse; + +public: + /*C*/ afxDamageData(); + /*C*/ afxDamageData(const afxDamageData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxDamageData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_DAMAGE_H_ diff --git a/Engine/source/afx/ce/afxFootSwitch.cpp b/Engine/source/afx/ce/afxFootSwitch.cpp new file mode 100644 index 000000000..45d273b90 --- /dev/null +++ b/Engine/source/afx/ce/afxFootSwitch.cpp @@ -0,0 +1,116 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxFootSwitch.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxFootSwitchData + +IMPLEMENT_CO_DATABLOCK_V1(afxFootSwitchData); + +ConsoleDocClass( afxFootSwitchData, + "@brief A datablock that specifies a Foot Switch effect.\n\n" + + "A Foot Switch effect is used to disable some or all of the standard built-in footstep effects generated by Player objects." + "\n\n" + + "Stock Player objects generate footprint decals, footstep sounds, and puffs of particle dust in response to special " + "animation triggers embedded in the Player's dts model. With the help of Phase Effects, AFX can substitute alternatives for " + "these built-in effects. When this is done, it is often preferable to turn off some or all of the built-in footstep effects." + "\n\n" + + "Foot Switch effects are only meaningful when the primary position constraint is a Player or Player-derived object." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxFootSwitchData::afxFootSwitchData() +{ + override_all = false; + override_decals = false; + override_sounds = false; + override_dust = false; +} + +afxFootSwitchData::afxFootSwitchData(const afxFootSwitchData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + override_all = other.override_all; + override_decals = other.override_decals; + override_sounds = other.override_sounds; + override_dust = other.override_dust; +} + +#define myOffset(field) Offset(field, afxFootSwitchData) + +void afxFootSwitchData::initPersistFields() +{ + addField("overrideAll", TypeBool, myOffset(override_all), + "When true, all of a Player's footstep effects are turned off for the duration of " + "the foot-switch effect."); + addField("overrideDecals", TypeBool, myOffset(override_decals), + "Specifically selects whether the Player's footprint decals are enabled."); + addField("overrideSounds", TypeBool, myOffset(override_sounds), + "Specifically selects whether the Player's footstep sounds are enabled."); + addField("overrideDust", TypeBool, myOffset(override_dust), + "Specifically selects whether the Player's footstep puffs of dust are enabled."); + + Parent::initPersistFields(); +} + +void afxFootSwitchData::packData(BitStream* stream) +{ + Parent::packData(stream); + + if (!stream->writeFlag(override_all)) + { + stream->writeFlag(override_decals); + stream->writeFlag(override_sounds); + stream->writeFlag(override_dust); + } +} + +void afxFootSwitchData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + override_all = stream->readFlag(); + if (!override_all) + { + override_decals = stream->readFlag(); + override_sounds = stream->readFlag(); + override_dust = stream->readFlag(); + } +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxFootSwitch.h b/Engine/source/afx/ce/afxFootSwitch.h new file mode 100644 index 000000000..6420756e9 --- /dev/null +++ b/Engine/source/afx/ce/afxFootSwitch.h @@ -0,0 +1,56 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_FOOT_SWITCH_H_ +#define _AFX_FOOT_SWITCH_H_ + +class afxFootSwitchData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + bool override_all; + bool override_decals; + bool override_sounds; + bool override_dust; + +public: + /*C*/ afxFootSwitchData(); + /*C*/ afxFootSwitchData(const afxFootSwitchData&, bool = false); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxFootSwitchData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_FOOT_SWITCH_H_ diff --git a/Engine/source/afx/ce/afxGuiController.cpp b/Engine/source/afx/ce/afxGuiController.cpp new file mode 100644 index 000000000..094cd0f5b --- /dev/null +++ b/Engine/source/afx/ce/afxGuiController.cpp @@ -0,0 +1,109 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "core/stream/bitStream.h" + +#include "afx/ce/afxGuiController.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxGuiControllerData + +IMPLEMENT_CO_DATABLOCK_V1(afxGuiControllerData); + +ConsoleDocClass( afxGuiControllerData, + "@brief A datablock that specifies a Gui Controller effect.\n\n" + + "A Gui Controller enables effect manipulation of pre-existing gui controls. With a Gui Controller effect, a regular gui control " + "is located by name, made visible during the lifetime of the effect, and potentially repositioned by projecting 3D constraint " + "positions into 2D screen space. In addition, when used with a progress-bar control, (GuiProgressCtrl, afxSpellCastBar, " + "afxStatusBar), the progress-bar will continuously reflect the elapsed progress of the effect over its lifetime." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxGuiControllerData::afxGuiControllerData() +{ + control_name = ST_NULLSTRING; + preserve_pos = false; + ctrl_client_only = false; +} + +afxGuiControllerData::afxGuiControllerData(const afxGuiControllerData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + control_name = other.control_name; + preserve_pos = other.preserve_pos; + ctrl_client_only = other.ctrl_client_only; +} + +#define myOffset(field) Offset(field, afxGuiControllerData) + +void afxGuiControllerData::initPersistFields() +{ + addField("controlName", TypeString, myOffset(control_name), + "Specifies the name of an existing gui-control."); + addField("preservePosition", TypeBool, myOffset(preserve_pos), + "When true, the gui-control will retain its initial position, otherwise the " + "gui-control position will be continuously updated using a projection of the " + "3D constraint position into 2D screen coordinates."); + addField("controllingClientOnly", TypeBool, myOffset(ctrl_client_only), + "If true, the effect will only be applied to a gui-control on the client that " + "matches the controlling-client of the primary position constraint object."); + + Parent::initPersistFields(); +} + +bool afxGuiControllerData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxGuiControllerData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(control_name); + stream->writeFlag(preserve_pos); + stream->writeFlag(ctrl_client_only); +} + +void afxGuiControllerData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + control_name = stream->readSTString(); + preserve_pos = stream->readFlag(); + ctrl_client_only = stream->readFlag(); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxGuiController.h b/Engine/source/afx/ce/afxGuiController.h new file mode 100644 index 000000000..90db3249c --- /dev/null +++ b/Engine/source/afx/ce/afxGuiController.h @@ -0,0 +1,58 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_GUI_CONTROLLER_H_ +#define _AFX_GUI_CONTROLLER_H_ + +#include "afx/afxEffectDefs.h" + +class afxGuiControllerData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + StringTableEntry control_name; + bool preserve_pos; + bool ctrl_client_only; + +public: + /*C*/ afxGuiControllerData(); + /*C*/ afxGuiControllerData(const afxGuiControllerData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxGuiControllerData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_GUI_CONTROLLER_H_ diff --git a/Engine/source/afx/ce/afxGuiText.cpp b/Engine/source/afx/ce/afxGuiText.cpp new file mode 100644 index 000000000..2b733f3f4 --- /dev/null +++ b/Engine/source/afx/ce/afxGuiText.cpp @@ -0,0 +1,103 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "core/stream/bitStream.h" + +#include "afx/ce/afxGuiText.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxGuiTextData + +IMPLEMENT_CO_DATABLOCK_V1(afxGuiTextData); + +ConsoleDocClass( afxGuiTextData, + "@brief A datablock that specifies a Gui Text effect.\n\n" + + "A Gui Text effect, with the help of an existing afxGuiTextHud, can be used to display 2D text effects on the Gui Canvas. " + "Essentially, using Gui Text effects with an afxGuiTextHud is like using the stock GuiShapeNameHud, but with the ability " + "to make additional text elements come and go as effects constrained to the projection of 3D positions onto the 2D screen." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxGuiTextData::afxGuiTextData() +{ + text_str = ST_NULLSTRING; + text_clr.set(1,1,1,1); +} + +afxGuiTextData::afxGuiTextData(const afxGuiTextData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + text_str = other.text_str; + text_clr = other.text_clr; +} + +#define myOffset(field) Offset(field, afxGuiTextData) + +void afxGuiTextData::initPersistFields() +{ + addField("text", TypeString, myOffset(text_str), + "The literal text to display on the afxGuiTextHud. The center of the text will be " + "placed at the projection of the 3D constraint position into 2D screen space.\n" + "If the text field is set to the special string, '#shapeName', the shape name of the " + "primary position constraint object will be used. (This is only meaningful if the " + "constraint source is a ShapeBase-derived object.)"); + addField("color", TypeColorF, myOffset(text_clr), + "A color value for the text label."); + + Parent::initPersistFields(); +} + +bool afxGuiTextData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxGuiTextData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(text_str); + stream->write(text_clr); +} + +void afxGuiTextData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + text_str = stream->readSTString(); + stream->read(&text_clr); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxGuiText.h b/Engine/source/afx/ce/afxGuiText.h new file mode 100644 index 000000000..fa03de46c --- /dev/null +++ b/Engine/source/afx/ce/afxGuiText.h @@ -0,0 +1,57 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_GUI_TEXT_H_ +#define _AFX_GUI_TEXT_H_ + +#include "afx/afxEffectDefs.h" + +class afxGuiTextData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + StringTableEntry text_str; + LinearColorF text_clr; + +public: + /*C*/ afxGuiTextData(); + /*C*/ afxGuiTextData(const afxGuiTextData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxGuiTextData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_GUI_TEXT_H_ diff --git a/Engine/source/afx/ce/afxLight.cpp b/Engine/source/afx/ce/afxLight.cpp new file mode 100644 index 000000000..79a0f8d7b --- /dev/null +++ b/Engine/source/afx/ce/afxLight.cpp @@ -0,0 +1,41 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/ce/afxLight.h" +IMPLEMENT_CO_DATABLOCK_V1(afxLightData); + +ConsoleDocClass( afxLightData, + "@brief afxLightData is a legacy datablock which is not supported for T3D.\n\n" + + "In T3D, instead of afxLightData, use afxT3DPointLightData or afxT3DSpotLightData.\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxLight.h b/Engine/source/afx/ce/afxLight.h new file mode 100644 index 000000000..11181fdc5 --- /dev/null +++ b/Engine/source/afx/ce/afxLight.h @@ -0,0 +1,38 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_LIGHT_H_ +#define _AFX_LIGHT_H_ + +struct afxLightData : public GameBaseData +{ + typedef GameBaseData Parent; + DECLARE_CONOBJECT(afxLightData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_LIGHT_H_ diff --git a/Engine/source/afx/ce/afxLightBase_T3D.cpp b/Engine/source/afx/ce/afxLightBase_T3D.cpp new file mode 100644 index 000000000..209bc7426 --- /dev/null +++ b/Engine/source/afx/ce/afxLightBase_T3D.cpp @@ -0,0 +1,243 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "T3D/lightAnimData.h" + +#include "afx/ce/afxLightBase_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxT3DLightBaseData + +IMPLEMENT_CO_DATABLOCK_V1(afxT3DLightBaseData); + +ConsoleDocClass( afxT3DLightBaseData, + "@brief A datablock baseclass for afxT3DPointLightData and afxT3DSpotLightData.\n\n" + + "Not intended to be used directly, afxT3DLightBaseData exists to provide base member variables and generic functionality " + "for the derived classes afxT3DPointLightData and afxT3DSpotLightData." + "\n\n" + + "@see afxT3DPointLightData\n\n" + "@see afxT3DSpotLightData\n\n" + "@see PointLight\n\n" + "@see SpotLight\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxT3DLightBaseData::afxT3DLightBaseData() + : mIsEnabled( true ), + mColor( LinearColorF::WHITE ), + mBrightness( 1.0f ), + mCastShadows( false ), + mPriority( 1.0f ), + mAnimationData( NULL ), + mFlareData( NULL ), + mFlareScale( 1.0f ) +{ + + mLocalRenderViz = false; + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; +} + +afxT3DLightBaseData::afxT3DLightBaseData(const afxT3DLightBaseData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + mIsEnabled = other.mIsEnabled; + mColor = other.mColor; + mBrightness = other.mBrightness; + mCastShadows = other.mCastShadows; + mPriority = other.mPriority; + mAnimationData = other.mAnimationData; + mAnimState = other.mAnimState; + mFlareData = other.mFlareData; + mFlareScale = other.mFlareScale; + + mLocalRenderViz = other.mLocalRenderViz; + + do_id_convert = other.do_id_convert; +} + +// +// NOTE: keep this as consistent as possible with LightBase::initPersistFields() +// +void afxT3DLightBaseData::initPersistFields() +{ + // We only add the basic lighting options that all lighting + // systems would use... the specific lighting system options + // are injected at runtime by the lighting system itself. + + addGroup( "Light" ); + + addField( "isEnabled", TypeBool, Offset( mIsEnabled, afxT3DLightBaseData ), + "Enables/Disables the object rendering and functionality in the scene."); + addField( "color", TypeColorF, Offset( mColor, afxT3DLightBaseData ), + "Changes the base color hue of the light."); + addField( "brightness", TypeF32, Offset( mBrightness, afxT3DLightBaseData ), + "Adjusts the lights power, 0 being off completely."); + addField( "castShadows", TypeBool, Offset( mCastShadows, afxT3DLightBaseData ), + "Enables/disables shadow casts by this light."); + addField( "priority", TypeF32, Offset( mPriority, afxT3DLightBaseData ), + "Used for sorting of lights by the light manager. Priority determines if a light " + "has a stronger effect than, those with a lower value"); + addField( "localRenderViz", TypeBool, Offset( mLocalRenderViz, afxT3DLightBaseData ), + "Enables/disables a semi-transparent geometry to help visualize the light's " + "range and placement."); + + endGroup( "Light" ); + + addGroup( "Light Animation" ); + + addField( "animate", TypeBool, Offset( mAnimState.active, afxT3DLightBaseData ), + "Toggles animation for the light on and off"); + addField( "animationType", TYPEID(), Offset( mAnimationData, afxT3DLightBaseData ), + "Datablock containing light animation information (LightAnimData)"); + addField( "animationPeriod", TypeF32, Offset( mAnimState.animationPeriod, afxT3DLightBaseData ), + "The length of time in seconds for a single playback of the light animation"); + addField( "animationPhase", TypeF32, Offset( mAnimState.animationPhase, afxT3DLightBaseData ), + "The phase used to offset the animation start time to vary the animation of " + "nearby lights."); + + endGroup( "Light Animation" ); + + addGroup( "Misc" ); + + addField( "flareType", TYPEID(), Offset( mFlareData, afxT3DLightBaseData ), + "Datablock containing light flare information (LightFlareData)"); + addField( "flareScale", TypeF32, Offset( mFlareScale, afxT3DLightBaseData ), + "Globally scales all features of the light flare"); + + endGroup( "Misc" ); + + /* + // Now inject any light manager specific fields. + LightManager::initLightFields(); + */ + + // We do the parent fields at the end so that + // they show up that way in the inspector. + Parent::initPersistFields(); +} + +bool afxT3DLightBaseData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxT3DLightBaseData::packData(BitStream* stream) +{ + Parent::packData(stream); + + // note: BitStream's overloaded write() for LinearColorF will convert + // to ColorI for transfer and then back to LinearColorF. This is fine + // for most color usage but for lighting colors we want to preserve + // "pushed" color values which may be greater than 1.0 so the color + // is instead sent as individual color primaries. + stream->write( mColor.red ); + stream->write( mColor.green ); + stream->write( mColor.blue ); + + stream->write( mBrightness ); + stream->writeFlag( mCastShadows ); + stream->write( mAnimState.animationPeriod ); + stream->write( mAnimState.animationPhase ); + stream->write( mFlareScale ); + + writeDatablockID(stream, mAnimationData, packed); + writeDatablockID(stream, mFlareData, packed); +} + +void afxT3DLightBaseData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read( &mColor.red ); + stream->read( &mColor.green ); + stream->read( &mColor.blue ); + mColor.alpha = 1.0f; + + stream->read( &mBrightness ); + mCastShadows = stream->readFlag(); + stream->read( &mAnimState.animationPeriod ); + stream->read( &mAnimState.animationPhase ); + stream->read( &mFlareScale ); + + mAnimationData = (LightAnimData*) readDatablockID(stream); + mFlareData = (LightFlareData*) readDatablockID(stream); + + do_id_convert = true; +} + +bool afxT3DLightBaseData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + SimObjectId anim_id = SimObjectId((uintptr_t)mAnimationData); + if (anim_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(anim_id, mAnimationData)) + { + Con::errorf(ConsoleLogEntry::General, + "afxT3DLightBaseData::preload() -- bad datablockId: 0x%x (animationType)", + anim_id); + } + } + SimObjectId flare_id = SimObjectId((uintptr_t)mFlareData); + if (flare_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(flare_id, mFlareData)) + { + Con::errorf(ConsoleLogEntry::General, + "afxT3DLightBaseData::preload() -- bad datablockId: 0x%x (flareType)", + flare_id); + } + } + do_id_convert = false; + } + } + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxLightBase_T3D.h b/Engine/source/afx/ce/afxLightBase_T3D.h new file mode 100644 index 000000000..1a517d02d --- /dev/null +++ b/Engine/source/afx/ce/afxLightBase_T3D.h @@ -0,0 +1,73 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_T3D_LIGHT_BASE_H_ +#define _AFX_T3D_LIGHT_BASE_H_ + +#include "T3D/lightBase.h" + +class LightAnimData; +class LightFlareData; + +class afxT3DLightBaseData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + bool mIsEnabled; + LinearColorF mColor; + F32 mBrightness; + bool mCastShadows; + F32 mPriority; + + LightAnimData* mAnimationData; + LightAnimState mAnimState; + + bool mLocalRenderViz; + + LightFlareData* mFlareData; + F32 mFlareScale; + + bool do_id_convert; + +public: + /*C*/ afxT3DLightBaseData(); + /*C*/ afxT3DLightBaseData(const afxT3DLightBaseData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxT3DLightBaseData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_T3D_LIGHT_BASE_H_ diff --git a/Engine/source/afx/ce/afxMachineGun.cpp b/Engine/source/afx/ce/afxMachineGun.cpp new file mode 100644 index 000000000..6b040ff5b --- /dev/null +++ b/Engine/source/afx/ce/afxMachineGun.cpp @@ -0,0 +1,127 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "lighting/lightInfo.h" +#include "T3D/projectile.h" + +#include "afx/ce/afxMachineGun.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMachineGunData + +IMPLEMENT_CO_DATABLOCK_V1(afxMachineGunData); + +ConsoleDocClass( afxMachineGunData, + "@brief A datablock that specifies a Machine Gun effect.\n\n" + + "Machine Gun is a simple but useful effect for rapidly shooting standard Torque Projectile objects. For performance " + "reasons, keep in mind that each bullet is a separate Projectile object, which is not a very lightweight object." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxMachineGunData::afxMachineGunData() +{ + projectile_data = 0; + rounds_per_minute = 60; +} + +afxMachineGunData::afxMachineGunData(const afxMachineGunData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + projectile_data = other.projectile_data; + rounds_per_minute = other.rounds_per_minute; +} + +#define myOffset(field) Offset(field, afxMachineGunData) + +void afxMachineGunData::initPersistFields() +{ + addField("projectile", TYPEID(), myOffset(projectile_data), + "A ProjectileData datablock describing the projectile to be launched."); + addField("roundsPerMinute", TypeS32, myOffset(rounds_per_minute), + "Specifies the number of projectiles fired over a minute of time. A value of 1200 " + "will create 20 projectiles per second.\n" + "Sample values for real machine guns:\n" + " AK-47 = 600, M16 = 750-900, UZI = 600"); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("projectile"); +} + +bool afxMachineGunData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + if (projectile_data) + { + if (getId() >= DataBlockObjectIdFirst && getId() <= DataBlockObjectIdLast) + { + SimObjectId pid = projectile_data->getId(); + if (pid < DataBlockObjectIdFirst || pid > DataBlockObjectIdLast) + { + Con::errorf(ConsoleLogEntry::General,"afxMachineGunData: bad ProjectileData datablock."); + return false; + } + } + } + + return true; +} + +void afxMachineGunData::packData(BitStream* stream) +{ + Parent::packData(stream); + + if (stream->writeFlag(projectile_data)) + stream->writeRangedU32(projectile_data->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); + + stream->write(rounds_per_minute); +} + +void afxMachineGunData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + if (stream->readFlag()) + { + SimObjectId id = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + Sim::findObject(id, projectile_data); + } + + stream->read(&rounds_per_minute); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxMachineGun.h b/Engine/source/afx/ce/afxMachineGun.h new file mode 100644 index 000000000..f01941f55 --- /dev/null +++ b/Engine/source/afx/ce/afxMachineGun.h @@ -0,0 +1,59 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_MACHINE_GUN_H_ +#define _AFX_MACHINE_GUN_H_ + +#include "afx/afxEffectDefs.h" + +class ProjectileData; + +class afxMachineGunData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + ProjectileData* projectile_data; + S32 rounds_per_minute; + +public: + /*C*/ afxMachineGunData(); + /*C*/ afxMachineGunData(const afxMachineGunData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxMachineGunData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_MACHINE_GUN_H_ diff --git a/Engine/source/afx/ce/afxModel.cpp b/Engine/source/afx/ce/afxModel.cpp new file mode 100644 index 000000000..688cd08ad --- /dev/null +++ b/Engine/source/afx/ce/afxModel.cpp @@ -0,0 +1,770 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "T3D/objectTypes.h" +#include "T3D/gameBase/gameProcess.h" +#include "core/resourceManager.h" +#include "sim/netConnection.h" +#include "scene/sceneRenderState.h" +#include "scene/sceneManager.h" +#include "ts/tsShapeInstance.h" +#include "ts/tsMaterialList.h" + +#include "afx/ce/afxModel.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxModelData + +IMPLEMENT_CO_DATABLOCK_V1(afxModelData); + +ConsoleDocClass( afxModelData, + "@brief A datablock that specifies a Model effect.\n\n" + + "A Model effect is a lightweight client-only geometry object useful for effect-driven props." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxModelData::afxModelData() +{ + shapeName = ST_NULLSTRING; + sequence = ST_NULLSTRING; + seq_rate = 1.0f; + seq_offset = 0.0f; + alpha_mult = 1.0f; + use_vertex_alpha = false; + force_on_material_flags = 0; + force_off_material_flags = 0; + texture_filtering = true; + fog_mult = 1.0f; + remap_txr_tags = ST_NULLSTRING; + remap_buffer = 0; + + overrideLightingOptions = false; + receiveSunLight = true; + receiveLMLighting = true; + useAdaptiveSelfIllumination = false; + useCustomAmbientLighting = false; + customAmbientForSelfIllumination = false; + customAmbientLighting = LinearColorF(0.0f, 0.0f, 0.0f); + shadowEnable = false; + + shadowSize = 128; + shadowMaxVisibleDistance = 80.0f; + shadowProjectionDistance = 10.0f; + shadowSphereAdjust = 1.0; +} + +afxModelData::afxModelData(const afxModelData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + shapeName = other.shapeName; + shape = other.shape; // -- + sequence = other.sequence; + seq_rate = other.seq_rate; + seq_offset = other.seq_offset; + alpha_mult = other.alpha_mult; + use_vertex_alpha = other.use_vertex_alpha; + force_on_material_flags = other.force_on_material_flags; + force_off_material_flags = other.force_off_material_flags; + texture_filtering = other.texture_filtering; + fog_mult = other.fog_mult; + remap_txr_tags = other.remap_txr_tags; + remap_buffer = other.remap_buffer; + overrideLightingOptions = other.overrideLightingOptions; + receiveSunLight = other.receiveSunLight; + receiveLMLighting = other.receiveLMLighting; + useAdaptiveSelfIllumination = other.useAdaptiveSelfIllumination; + useCustomAmbientLighting = other.useCustomAmbientLighting; + customAmbientForSelfIllumination = other.customAmbientForSelfIllumination; + customAmbientLighting = other.customAmbientLighting; + shadowEnable = other.shadowEnable; +} + +afxModelData::~afxModelData() +{ + if (remap_buffer) + dFree(remap_buffer); +} + +bool afxModelData::preload(bool server, String &errorStr) +{ + if (Parent::preload(server, errorStr) == false) + return false; + + // don't need to do this stuff on the server + if (server) + return true; + + if (shapeName != ST_NULLSTRING && !shape) + { + shape = ResourceManager::get().load(shapeName); + if (!shape) + { + errorStr = String::ToString("afxModelData::load: Failed to load shape \"%s\"", shapeName); + return false; + } + + // just parse up the string and collect the remappings in txr_tag_remappings. + if (remap_txr_tags != ST_NULLSTRING) + { + txr_tag_remappings.clear(); + if (remap_buffer) + dFree(remap_buffer); + + remap_buffer = dStrdup(remap_txr_tags); + + char* remap_token = dStrtok(remap_buffer, " \t"); + while (remap_token != NULL) + { + char* colon = dStrchr(remap_token, ':'); + if (colon) + { + *colon = '\0'; + txr_tag_remappings.increment(); + txr_tag_remappings.last().old_tag = remap_token; + txr_tag_remappings.last().new_tag = colon+1; + } + remap_token = dStrtok(NULL, " \t"); + } + } + + // this little hack messes things up when remapping texture tags + if (txr_tag_remappings.size() == 0) + { + // this little hack forces the textures to preload + TSShapeInstance* pDummy = new TSShapeInstance(shape); + delete pDummy; + } + } + + return true; +} + +#define myOffset(field) Offset(field, afxModelData) + +void afxModelData::initPersistFields() +{ + addField("shapeFile", TypeFilename, myOffset(shapeName), + "The name of a .dts format file to use for the model."); + addField("sequence", TypeFilename, myOffset(sequence), + "The name of an animation sequence to play in the model."); + addField("sequenceRate", TypeF32, myOffset(seq_rate), + "The rate of playback for the sequence."); + addField("sequenceOffset", TypeF32, myOffset(seq_offset), + "An offset in seconds indicating a starting point for the animation sequence " + "specified by the sequence field. A rate of 1.0 (rather than sequenceRate) is used " + "to convert from seconds to the thread offset."); + addField("alphaMult", TypeF32, myOffset(alpha_mult), + "An alpha multiplier used to set maximum opacity of the model."); + + addField("fogMult", TypeF32, myOffset(fog_mult), + ""); + addField("remapTextureTags", TypeString, myOffset(remap_txr_tags), + "Rename one or more texture tags in the model. Texture tags are what link a " + "model's textures to materials.\n" + "Field should be a string containing space-separated remapping tokens. A remapping " + "token is two names separated by a colon, ':'. The first name should be a texture-tag " + "that exists in the model, while the second is a new name to replace it. The string " + "can have any number of remapping tokens as long as the total string length does not " + "exceed 255."); + addField("shadowEnable", TypeBool, myOffset(shadowEnable), + "Sets whether the model casts a shadow."); + + addField("useVertexAlpha", TypeBool, myOffset(use_vertex_alpha), + "deprecated"); + addField("forceOnMaterialFlags", TypeS32, myOffset(force_on_material_flags), + "deprecated"); + addField("forceOffMaterialFlags", TypeS32, myOffset(force_off_material_flags), + "deprecated"); + addField("textureFiltering", TypeBool, myOffset(texture_filtering), + "deprecated"); + addField("overrideLightingOptions", TypeBool, myOffset(overrideLightingOptions), + "deprecated"); + addField("receiveSunLight", TypeBool, myOffset(receiveSunLight), + ""); + addField("receiveLMLighting", TypeBool, myOffset(receiveLMLighting), + "deprecated"); + addField("useAdaptiveSelfIllumination", TypeBool, myOffset(useAdaptiveSelfIllumination), + "deprecated"); + addField("useCustomAmbientLighting", TypeBool, myOffset(useCustomAmbientLighting), + "deprecated"); + addField("customAmbientSelfIllumination", TypeBool, myOffset(customAmbientForSelfIllumination), + "deprecated"); + addField("customAmbientLighting", TypeColorF, myOffset(customAmbientLighting), + "deprecated"); + addField("shadowSize", TypeS32, myOffset(shadowSize), + "deprecated"); + addField("shadowMaxVisibleDistance", TypeF32, myOffset(shadowMaxVisibleDistance), + "deprecated"); + addField("shadowProjectionDistance", TypeF32, myOffset(shadowProjectionDistance), + "deprecated"); + addField("shadowSphereAdjust", TypeF32, myOffset(shadowSphereAdjust), + "deprecated"); + + Parent::initPersistFields(); + + // Material Flags + Con::setIntVariable("$MaterialFlags::S_Wrap", TSMaterialList::S_Wrap); + Con::setIntVariable("$MaterialFlags::T_Wrap", TSMaterialList::T_Wrap); + Con::setIntVariable("$MaterialFlags::Translucent", TSMaterialList::Translucent); + Con::setIntVariable("$MaterialFlags::Additive", TSMaterialList::Additive); + Con::setIntVariable("$MaterialFlags::Subtractive", TSMaterialList::Subtractive); + Con::setIntVariable("$MaterialFlags::SelfIlluminating", TSMaterialList::SelfIlluminating); + Con::setIntVariable("$MaterialFlags::NeverEnvMap", TSMaterialList::NeverEnvMap); + Con::setIntVariable("$MaterialFlags::NoMipMap", TSMaterialList::NoMipMap); + Con::setIntVariable("$MaterialFlags::MipMap_ZeroBorder", TSMaterialList::MipMap_ZeroBorder); + Con::setIntVariable("$MaterialFlags::AuxiliaryMap", TSMaterialList::AuxiliaryMap); + +#if defined(AFX_CAP_AFXMODEL_TYPE) + Con::setIntVariable("$TypeMasks::afxModelObjectType", afxModelObjectType); +#endif +} + +void afxModelData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(shapeName); + stream->writeString(sequence); + stream->write(seq_rate); + stream->write(seq_offset); + stream->write(alpha_mult); + stream->write(use_vertex_alpha); + stream->write(force_on_material_flags); + stream->write(force_off_material_flags); + stream->writeFlag(texture_filtering); + stream->write(fog_mult); + + stream->writeString(remap_txr_tags); + + stream->writeFlag(overrideLightingOptions); + stream->writeFlag(receiveSunLight); + stream->writeFlag(useAdaptiveSelfIllumination); + stream->writeFlag(useCustomAmbientLighting); + stream->writeFlag(customAmbientForSelfIllumination); + stream->write(customAmbientLighting); + stream->writeFlag(receiveLMLighting); + stream->writeFlag(shadowEnable); + + stream->write(shadowSize); + stream->write(shadowMaxVisibleDistance); + stream->write(shadowProjectionDistance); + stream->write(shadowSphereAdjust); +} + +void afxModelData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + shapeName = stream->readSTString(); + sequence = stream->readSTString(); + stream->read(&seq_rate); + stream->read(&seq_offset); + stream->read(&alpha_mult); + stream->read(&use_vertex_alpha); + stream->read(&force_on_material_flags); + stream->read(&force_off_material_flags); + texture_filtering = stream->readFlag(); + stream->read(&fog_mult); + + remap_txr_tags = stream->readSTString(); + + overrideLightingOptions = stream->readFlag(); + receiveSunLight = stream->readFlag(); + useAdaptiveSelfIllumination = stream->readFlag(); + useCustomAmbientLighting = stream->readFlag(); + customAmbientForSelfIllumination = stream->readFlag(); + stream->read(&customAmbientLighting); + receiveLMLighting = stream->readFlag(); + shadowEnable = stream->readFlag(); + + stream->read(&shadowSize); + stream->read(&shadowMaxVisibleDistance); + stream->read(&shadowProjectionDistance); + stream->read(&shadowSphereAdjust); +} + +void afxModelData::onPerformSubstitutions() +{ + if (shapeName != ST_NULLSTRING) + { + shape = ResourceManager::get().load(shapeName); + if (!shape) + { + Con::errorf("afxModelData::onPerformSubstitutions: Failed to load shape \"%s\"", shapeName); + return; + } + + // REMAP-TEXTURE-TAGS ISSUES? + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxModel + +IMPLEMENT_CO_NETOBJECT_V1(afxModel); + +ConsoleDocClass( afxModel, + "@brief A Model effect as defined by an afxModelData datablock.\n\n" + + "A Model effect is a lightweight client-only geometry object useful for effect-driven " + "props.\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" +); + +afxModel::afxModel() +{ + mTypeMask |= DynamicShapeObjectType; +#if defined(AFX_CAP_AFXMODEL_TYPE) + mTypeMask |= afxModelObjectType; +#endif + + shape_inst = 0; + + main_seq_thread = 0; + main_seq_id = -1; + seq_rate_factor = 1.0f; + last_anim_tag = 0; + + seq_animates_vis = false; + fade_amt = 1.0f; + is_visible = true; + sort_priority = 0; + + mNetFlags.set( IsGhost ); +} + +afxModel::~afxModel() +{ + delete shape_inst; +} + +void afxModel::setSequenceRateFactor(F32 factor) +{ + seq_rate_factor = factor; + if (shape_inst != NULL && main_seq_thread != NULL) + shape_inst->setTimeScale(main_seq_thread, seq_rate_factor*mDataBlock->seq_rate); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxModel::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + return true; +} + +bool afxModel::onAdd() +{ + // first check if we have a server connection, if we don't then this is on the server + // and we should exit, then check if the parent fails to add the object + NetConnection* conn = NetConnection::getConnectionToServer(); + if (!conn || !Parent::onAdd()) + return false; + + // setup our bounding box + if (mDataBlock->shape) + mObjBox = mDataBlock->shape->bounds; + else + mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); + + // setup the shape instance and sequence + if (mDataBlock->shape) + { + if (/*isClientObject() && */mDataBlock->txr_tag_remappings.size() > 0) + { + // temporarily substitute material tags with alternates + TSMaterialList* mat_list = mDataBlock->shape->materialList; + if (mat_list) + { + for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) + { + afxModelData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i]; + Vector & mat_names = (Vector&) mat_list->getMaterialNameList(); + for (S32 j = 0; j < mat_names.size(); j++) + { + if (mat_names[j].compare(remap->old_tag, dStrlen(remap->old_tag), String::NoCase) == 0) + { + //Con::printf("REMAP TEXTURE TAG [%s] TO [%s]", remap->old_tag, remap->new_tag); + mat_names[j] = String(remap->new_tag); + mat_names[j].insert(0,'#'); + break; + } + } + } + } + } + + shape_inst = new TSShapeInstance(mDataBlock->shape); + + if (true) // isClientObject()) + { + shape_inst->cloneMaterialList(); + + // restore the material tags to original form + if (mDataBlock->txr_tag_remappings.size() > 0) + { + TSMaterialList* mat_list = mDataBlock->shape->materialList; + if (mat_list) + { + for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) + { + afxModelData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i]; + Vector & mat_names = (Vector&) mat_list->getMaterialNameList(); + for (S32 j = 0; j < mat_names.size(); j++) + { + if (mat_names[j].compare(remap->new_tag, dStrlen(remap->new_tag)) == 0) + { + //Con::printf("UNREMAP TEXTURE TAG [%s] TO [%s]", remap->new_tag, remap->old_tag); + mat_names[j] = String(remap->old_tag); + break; + } + } + } + } + } + } + + if (mDataBlock->sequence == ST_NULLSTRING) + { + main_seq_thread = 0; + main_seq_id = -1; + } + else + { + // here we start the default animation sequence + TSShape* shape = shape_inst->getShape(); + main_seq_id = shape->findSequence(mDataBlock->sequence); + if (main_seq_id != -1) + { + main_seq_thread = shape_inst->addThread(); + + F32 seq_pos = 0.0f; + if (mDataBlock->seq_offset > 0.0f && mDataBlock->seq_offset < shape_inst->getDuration(main_seq_thread)) + seq_pos = mDataBlock->seq_offset / shape_inst->getDuration(main_seq_thread); + + shape_inst->setTimeScale(main_seq_thread, seq_rate_factor*mDataBlock->seq_rate); + shape_inst->setSequence(main_seq_thread, main_seq_id, seq_pos); + seq_animates_vis = shape->sequences[main_seq_id].visMatters.testAll(); + } + } + + // deal with material changes + if (shape_inst && (mDataBlock->force_on_material_flags | mDataBlock->force_off_material_flags)) + { + shape_inst->cloneMaterialList(); + TSMaterialList* mats = shape_inst->getMaterialList(); + if (mDataBlock->force_on_material_flags != 0) + { + for (U32 i = 0; i < mats->size(); i++) + mats->setFlags(i, mats->getFlags(i) | mDataBlock->force_on_material_flags); + } + + if (mDataBlock->force_off_material_flags != 0) + { + for (U32 i = 0; i < mats->size(); i++) + mats->setFlags(i, mats->getFlags(i) & ~mDataBlock->force_off_material_flags); + } + } + } + + resetWorldBox(); + + if (mDataBlock->shape) + { + // Scan out the collision hulls... + static const String sCollisionStr( "collision-" ); + + for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) + { + const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; + + if (name.compare( sCollisionStr, sCollisionStr.length(), String::NoCase ) == 0) + { + mCollisionDetails.push_back(i); + + // The way LOS works is that it will check to see if there is a LOS detail that matches + // the the collision detail + 1 + MaxCollisionShapes (this variable name should change in + // the future). If it can't find a matching LOS it will simply use the collision instead. + // We check for any "unmatched" LOS's further down + mLOSDetails.increment(); + + char buff[128]; + dSprintf(buff, sizeof(buff), "LOS-%d", i + 1 + 8/*MaxCollisionShapes*/); + U32 los = mDataBlock->shape->findDetail(buff); + if (los == -1) + mLOSDetails.last() = i; + else + mLOSDetails.last() = los; + } + } + + // Snag any "unmatched" LOS details + static const String sLOSStr( "LOS-" ); + + for (U32 i = 0; i < mDataBlock->shape->details.size(); i++) + { + const String &name = mDataBlock->shape->names[mDataBlock->shape->details[i].nameIndex]; + + if (name.compare( sLOSStr, sLOSStr.length(), String::NoCase ) == 0) + { + // See if we already have this LOS + bool found = false; + for (U32 j = 0; j < mLOSDetails.size(); j++) + { + if (mLOSDetails[j] == i) + { + found = true; + break; + } + } + + if (!found) + mLOSDetails.push_back(i); + } + } + + // Compute the hull accelerators (actually, just force the shape to compute them) + for (U32 i = 0; i < mCollisionDetails.size(); i++) + shape_inst->getShape()->getAccelerator(mCollisionDetails[i]); + } + + // tell engine the model exists + gClientSceneGraph->addObjectToScene(this); + removeFromProcessList(); + ClientProcessList::get()->addObject(this); + conn->addObject(this); + + return true; +} + +void afxModel::onRemove() +{ + mSceneManager->removeObjectFromScene(this); + getContainer()->removeObject(this); + Parent::onRemove(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +void afxModel::advanceTime(F32 dt) +{ + if (main_seq_thread) + shape_inst->advanceTime(dt, main_seq_thread); + + for (S32 i = 0; i < blend_clips.size(); i++) + shape_inst->advanceTime(dt, blend_clips[i].thread); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +void afxModel::prepRenderImage(SceneRenderState* state) +{ + if (!is_visible || !shape_inst) + return; + + // calculate distance to camera + Point3F cameraOffset; + getRenderTransform().getColumn(3, &cameraOffset); + cameraOffset -= state->getCameraPosition(); + F32 dist = cameraOffset.len(); + if (dist < 0.01f) + dist = 0.01f; + + F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z)); + shape_inst->setDetailFromDistance(state, dist*invScale); + if ( shape_inst->getCurrentDetail() < 0 ) + return; + + renderObject(state); +} + +bool afxModel::castRay(const Point3F &start, const Point3F &end, RayInfo* info) +{ + if (shape_inst) + { + RayInfo shortest; + shortest.t = 1e8; + + info->object = NULL; + if (mLOSDetails.size() > 0) + { + for (U32 i = 0; i < mLOSDetails.size(); i++) + { + shape_inst->animate(mLOSDetails[i]); + if (shape_inst->castRay(start, end, info, mLOSDetails[i])) + { + info->object = this; + if (info->t < shortest.t) + shortest = *info; + } + } + } + else + { + if (mCollisionDetails.size() > 0) + { + for (U32 i = 0; i < mCollisionDetails.size(); i++) + { + shape_inst->animate(mCollisionDetails[i]); + if (shape_inst->castRay(start, end, info, mCollisionDetails[i])) + { + info->object = this; + if (info->t < shortest.t) + shortest = *info; + } + } + } + } + + if (info->object == this) + { + // Copy out the shortest time... + *info = shortest; + return true; + } + } + + return false; +} + +U32 afxModel::unique_anim_tag_counter = 1; +#define BAD_ANIM_ID 999999999 + +U32 afxModel::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans) +{ + if (!shape_inst) + return 0; + + TSShape* shape = shape_inst->getShape(); + + S32 seq_id = shape->findSequence(clip); + if (seq_id == -1) + { + Con::errorf("afxModel::setAnimClip() -- failed to find a sequence matching the name, \"%s\".", clip); + return 0; + } + + // JTF Note: test if this blend implementation is working + if (shape->sequences[seq_id].isBlend()) + { + BlendThread blend_clip; + blend_clip.tag = ((unique_anim_tag_counter++) | 0x80000000); + + blend_clip.thread = shape_inst->addThread(); + shape_inst->setSequence(blend_clip.thread, seq_id, pos); + shape_inst->setTimeScale(blend_clip.thread, rate); + + blend_clips.push_back(blend_clip); + + return blend_clip.tag; + } + + if (!main_seq_thread) + { + main_seq_thread = shape_inst->addThread(); + shape_inst->setTimeScale(main_seq_thread, seq_rate_factor*rate); + shape_inst->setSequence(main_seq_thread, seq_id, pos); + seq_animates_vis = shape->sequences[seq_id].visMatters.testAll(); + } + else + { + shape_inst->setTimeScale(main_seq_thread, seq_rate_factor*rate); + + F32 transTime = (trans < 0) ? 0.25 : trans; + if (transTime > 0.0f) + shape_inst->transitionToSequence(main_seq_thread, seq_id, pos, transTime, true); + else + shape_inst->setSequence(main_seq_thread, seq_id, pos); + + seq_animates_vis = shape->sequences[seq_id].visMatters.testAll(); + } + + last_anim_tag = unique_anim_tag_counter++; + + return last_anim_tag; +} + +void afxModel::resetAnimation(U32 tag) +{ + // check if this is a blended clip + if ((tag & 0x80000000) != 0) + { + for (S32 i = 0; i < blend_clips.size(); i++) + { + if (blend_clips[i].tag == tag) + { + if (blend_clips[i].thread) + { + //Con::printf("DESTROY THREAD %d of %d tag=%d" , i, blend_clips.size(), tag & 0x7fffffff); + shape_inst->destroyThread(blend_clips[i].thread); + } + blend_clips.erase_fast(i); + break; + } + } + return; + } + + if (tag != 0 && tag == last_anim_tag) + { + // restore original non-animated state + if (main_seq_id == -1) + { + shape_inst->destroyThread(main_seq_thread); + main_seq_thread = 0; + } + // restore original sequence + else + { + shape_inst->setTimeScale(main_seq_thread, seq_rate_factor*mDataBlock->seq_rate); + shape_inst->transitionToSequence(main_seq_thread, main_seq_id , 0.0f, 0.25f, true); + } + last_anim_tag = 0; + } +} + +F32 afxModel::getAnimClipDuration(const char* clip) +{ + if (!shape_inst) + return 0.0f; + + TSShape* shape = shape_inst->getShape(); + S32 seq_id = shape->findSequence(clip); + return (seq_id != -1) ? shape->sequences[seq_id].duration : 0.0f; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxModel.h b/Engine/source/afx/ce/afxModel.h new file mode 100644 index 000000000..931f89287 --- /dev/null +++ b/Engine/source/afx/ce/afxModel.h @@ -0,0 +1,166 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_MODEL_H_ +#define _AFX_MODEL_H_ + +#include "renderInstance/renderPassManager.h" + +class ParticleEmitterData; +class ParticleEmitter; +class ExplosionData; +class TSPartInstance; +class TSShapeInstance; +class TSShape; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxModel Data + +struct afxModelData : public GameBaseData +{ + typedef GameBaseData Parent; + + StringTableEntry shapeName; + StringTableEntry sequence; + F32 seq_rate; + F32 seq_offset; + F32 alpha_mult; + bool use_vertex_alpha; + U32 force_on_material_flags; + U32 force_off_material_flags; + bool texture_filtering; + F32 fog_mult; + + struct TextureTagRemapping + { + char* old_tag; + char* new_tag; + }; + char* remap_buffer; + Vector txr_tag_remappings; + + StringTableEntry remap_txr_tags; + + Resource shape; + + bool overrideLightingOptions; + bool receiveSunLight; + bool receiveLMLighting; + bool useAdaptiveSelfIllumination; + bool useCustomAmbientLighting; + bool customAmbientForSelfIllumination; + LinearColorF customAmbientLighting; + bool shadowEnable; + + U32 shadowSize; + F32 shadowMaxVisibleDistance; + F32 shadowProjectionDistance; + F32 shadowSphereAdjust; + +public: + /*C*/ afxModelData(); + /*C*/ afxModelData(const afxModelData&, bool = false); + /*D*/ ~afxModelData(); + + bool preload(bool server, String &errorStr); + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxModelData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxModel + +class afxModel : public GameBase +{ + typedef GameBase Parent; + +private: + afxModelData* mDataBlock; + TSShapeInstance* shape_inst; + TSThread* main_seq_thread; + S32 main_seq_id; + F32 seq_rate_factor; + bool seq_animates_vis; + U32 last_anim_tag; + F32 fade_amt; + bool is_visible; + S8 sort_priority; + + struct BlendThread + { + TSThread* thread; + U32 tag; + }; + Vector blend_clips; + static U32 unique_anim_tag_counter; + +protected: + Vector mCollisionDetails; + Vector mLOSDetails; + bool castRay(const Point3F &start, const Point3F &end, RayInfo* info); + + virtual void advanceTime(F32 dt); + + virtual void prepRenderImage(SceneRenderState*); + + void renderObject(SceneRenderState*); + + virtual bool onAdd(); + virtual void onRemove(); + +public: + /*C*/ afxModel(); + /*D*/ ~afxModel(); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + + void setFadeAmount(F32 amt) { fade_amt = amt; } + void setSequenceRateFactor(F32 factor); + void setSortPriority(S8 priority) { sort_priority = priority; } + + const char* getShapeFileName() const { return mDataBlock->shapeName; } + void setVisibility(bool flag) { is_visible = flag; } + TSShape* getTSShape() { return mDataBlock->shape; } + TSShapeInstance* getTSShapeInstance() { return shape_inst; } + + U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans); + void resetAnimation(U32 tag); + F32 getAnimClipDuration(const char* clip); + + DECLARE_CONOBJECT(afxModel); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_MODEL_H_ diff --git a/Engine/source/afx/ce/afxModel_T3D.cpp b/Engine/source/afx/ce/afxModel_T3D.cpp new file mode 100644 index 000000000..be804f949 --- /dev/null +++ b/Engine/source/afx/ce/afxModel_T3D.cpp @@ -0,0 +1,71 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "scene/sceneRenderState.h" +#include "scene/sceneManager.h" +#include "ts/tsShapeInstance.h" +#include "lighting/lightQuery.h" + +#include "afx/ce/afxModel.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxModel::renderObject(SceneRenderState* state) +{ + MatrixF proj = GFX->getProjectionMatrix(); + RectI viewport = GFX->getViewport(); + + MatrixF world = GFX->getWorldMatrix(); + + GFX->pushWorldMatrix(); + + TSRenderState rdata; + rdata.setSceneState( state ); + rdata.setFadeOverride(fade_amt*mDataBlock->alpha_mult); + + // We might have some forward lit materials + // so pass down a query to gather lights. + LightQuery query; + query.init( getWorldSphere() ); + rdata.setLightQuery( &query ); + + MatrixF mat = getRenderTransform(); + mat.scale( mObjScale ); + GFX->setWorldMatrix( mat ); + + shape_inst->animate(); + + shape_inst->render(rdata); + + GFX->popWorldMatrix(); + + GFX->setProjectionMatrix( proj ); + GFX->setViewport( viewport ); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxMooring.cpp b/Engine/source/afx/ce/afxMooring.cpp new file mode 100644 index 000000000..b9cda9ec7 --- /dev/null +++ b/Engine/source/afx/ce/afxMooring.cpp @@ -0,0 +1,278 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxMooring.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMooringData + +IMPLEMENT_CO_DATABLOCK_V1(afxMooringData); + +ConsoleDocClass( afxMooringData, + "@brief A datablock that specifies a Mooring effect.\n\n" + + "A Mooring is an invisible effect object which can be positioned and oriented within a scene like other objects. Its main " + "purpose is to serve as a common mount point for other effects within the same choreographer. Typically one uses AFX " + "animation features to create movement for a Mooring and then other effects are bound to it using effect-to-effect " + "constraints (#effect)." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxMooringData::afxMooringData() +{ + track_pos_only = false; + networking = SCOPE_ALWAYS; + display_axis_marker = false; +} + +afxMooringData::afxMooringData(const afxMooringData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + track_pos_only = other.track_pos_only; + networking = other.networking; + display_axis_marker = other.display_axis_marker; +} + +#define myOffset(field) Offset(field, afxMooringData) + +void afxMooringData::initPersistFields() +{ + addField("displayAxisMarker", TypeBool, myOffset(display_axis_marker), + "Specifies whether to display an axis to help visualize the position and orientation " + "of the mooring."); + addField("trackPosOnly", TypeBool, myOffset(track_pos_only), + "This field is only meaningful for networking settings of SCOPE_ALWAYS and GHOSTABLE. " + "In these cases, client moorings are ghosting a mooring on the server, and " + "trackPosOnly determines if the client moorings need to be updated with the server " + "mooring's complete transform or just its position. If only the position needs to be " + "tracked, setting trackPosOnly to true will reduce the network traffic."); + addField("networking", TypeS8, myOffset(networking), + "Specifies the networking model used for the mooring and should be one of: " + "$AFX::SCOPE_ALWAYS, $AFX::GHOSTABLE, $AFX::SERVER_ONLY, or $AFX::CLIENT_ONLY"); + + Parent::initPersistFields(); +} + +bool afxMooringData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxMooringData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(display_axis_marker); + stream->write(track_pos_only); + stream->write(networking); +} + +void afxMooringData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&display_axis_marker); + stream->read(&track_pos_only); + stream->read(&networking); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMooring + +IMPLEMENT_CO_NETOBJECT_V1(afxMooring); + +ConsoleDocClass( afxMooring, + "@brief A Mooring effect as defined by an afxMooringData datablock.\n\n" + + "A Mooring is an invisible effect object which can be positioned and oriented within " + "a scene like other objects. Its main purpose is to serve as a common mount point for " + "other effects within the same choreographer. Typically one uses AFX animation " + "features to create movement for a Mooring and then other effects are bound to it " + "using effect-to-effect constraints (#effect).\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" +); + +afxMooring::afxMooring() +{ + mNetFlags.set(Ghostable | ScopeAlways); + + chor_id = 0; + hookup_with_chor = false; + ghost_cons_name = ST_NULLSTRING; +} + +afxMooring::afxMooring(U32 networking, U32 chor_id, StringTableEntry cons_name) +{ + if (networking & SCOPE_ALWAYS) + { + mNetFlags.clear(); + mNetFlags.set(Ghostable | ScopeAlways); + } + else if (networking & GHOSTABLE) + { + mNetFlags.clear(); + mNetFlags.set(Ghostable); + } + else if (networking & SERVER_ONLY) + { + mNetFlags.clear(); + } + else // if (networking & CLIENT_ONLY) + { + mNetFlags.clear(); + mNetFlags.set(IsGhost); + } + + this->chor_id = chor_id; + hookup_with_chor = false; + this->ghost_cons_name = cons_name; +} + +afxMooring::~afxMooring() +{ +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxMooring::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + return true; +} + +void afxMooring::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + if (hookup_with_chor) + { + afxChoreographer* chor = arcaneFX::findClientChoreographer(chor_id); + if (chor) + { + chor->setGhostConstraintObject(this, ghost_cons_name); + hookup_with_chor = false; + } + } + + Point3F pos = getRenderPosition(); +} + +U32 afxMooring::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) +{ + U32 retMask = Parent::packUpdate(conn, mask, stream); + + // InitialUpdate + if (stream->writeFlag(mask & InitialUpdateMask)) + { + stream->write(chor_id); + stream->writeString(ghost_cons_name); + } + + if (stream->writeFlag(mask & PositionMask)) + { + if (mDataBlock->track_pos_only) + mathWrite(*stream, mObjToWorld.getPosition()); + else + stream->writeAffineTransform(mObjToWorld); + } + + return retMask; +} + +//~~~~~~~~~~~~~~~~~~~~// + +void afxMooring::unpackUpdate(NetConnection * conn, BitStream * stream) +{ + Parent::unpackUpdate(conn, stream); + + // InitialUpdate + if (stream->readFlag()) + { + stream->read(&chor_id); + ghost_cons_name = stream->readSTString(); + + if (chor_id != 0 && ghost_cons_name != ST_NULLSTRING) + hookup_with_chor = true; + } + + if (stream->readFlag()) + { + if (mDataBlock->track_pos_only) + { + Point3F pos; + mathRead(*stream, &pos); + setPosition(pos); + } + else + { + MatrixF mat; + stream->readAffineTransform(&mat); + setTransform(mat); + setRenderTransform(mat); + } + } +} + +void afxMooring::setTransform(const MatrixF& mat) +{ + Parent::setTransform(mat); + setMaskBits(PositionMask); +} + +bool afxMooring::onAdd() +{ + if(!Parent::onAdd()) + return false; + + mObjBox = Box3F(Point3F(-0.5, -0.5, -0.5), Point3F(0.5, 0.5, 0.5)); + + addToScene(); + + return true; +} + +void afxMooring::onRemove() +{ + removeFromScene(); + + Parent::onRemove(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxMooring.h b/Engine/source/afx/ce/afxMooring.h new file mode 100644 index 000000000..d6cfb0b77 --- /dev/null +++ b/Engine/source/afx/ce/afxMooring.h @@ -0,0 +1,102 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_MOORING_H_ +#define _AFX_MOORING_H_ + +#include "renderInstance/renderPassManager.h" + +#include "afx/afxEffectDefs.h" + +class afxMooringData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; + +public: + U8 networking; + bool track_pos_only; + bool display_axis_marker; + +public: + /*C*/ afxMooringData(); + /*C*/ afxMooringData(const afxMooringData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxMooringData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxMooring + +class afxMooring : public GameBase, public afxEffectDefs +{ + typedef GameBase Parent; + +private: + afxMooringData* mDataBlock; + U32 chor_id; + bool hookup_with_chor; + StringTableEntry ghost_cons_name; + + GFXStateBlockRef axis_sb; + void _renderAxisLines(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*); + +protected: + enum MaskBits + { + PositionMask = Parent::NextFreeMask, + NextFreeMask = Parent::NextFreeMask << 1 + }; + +public: + /*C*/ afxMooring(); + /*C*/ afxMooring(U32 networking, U32 chor_id, StringTableEntry cons_name); + /*D*/ ~afxMooring(); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual void advanceTime(F32 dt); + virtual bool onAdd(); + virtual void onRemove(); + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + virtual void setTransform(const MatrixF&); + + virtual void prepRenderImage(SceneRenderState*); + + DECLARE_CONOBJECT(afxMooring); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_MOORING_H_ diff --git a/Engine/source/afx/ce/afxMooring_T3D.cpp b/Engine/source/afx/ce/afxMooring_T3D.cpp new file mode 100644 index 000000000..cf1512cfe --- /dev/null +++ b/Engine/source/afx/ce/afxMooring_T3D.cpp @@ -0,0 +1,88 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "gfx/gfxTransformSaver.h" +#include "gfx/primBuilder.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxMooring.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxMooring::prepRenderImage(SceneRenderState* state) +{ + if (!mDataBlock->display_axis_marker) + return; + + ObjectRenderInst *ri = state->getRenderPass()->allocInst(); + ri->renderDelegate.bind(this, &afxMooring::_renderAxisLines); + ri->type = RenderPassManager::RIT_ObjectTranslucent; + ri->translucentSort = true; + ri->defaultKey = (U32)(dsize_t)mDataBlock; + ri->sortDistSq = getWorldBox().getSqDistanceToPoint( state->getCameraPosition() ); + state->getRenderPass()->addInst(ri); +} + +void afxMooring::_renderAxisLines(ObjectRenderInst *ri, SceneRenderState* state, BaseMatInstance* overrideMat) +{ + if (overrideMat) + return; + + if (axis_sb.isNull()) + { + GFXStateBlockDesc desc; + + desc.blendDefined = true; + desc.blendEnable = false; + desc.cullDefined = true; + desc.cullMode = GFXCullNone; + desc.ffLighting = false; + desc.zDefined = true; + desc.zWriteEnable = false; + + axis_sb = GFX->createStateBlock(desc); + } + + GFX->setStateBlock(axis_sb); + + GFXTransformSaver saver; + GFX->multWorld(getRenderTransform()); + + PrimBuild::begin(GFXLineList, 6); + PrimBuild::color(LinearColorF(1.0, 0.0, 0.0)); + PrimBuild::vertex3f(-0.5, 0.0, 0.0); + PrimBuild::vertex3f( 0.5, 0.0, 0.0); + PrimBuild::color(LinearColorF(0.0, 1.0, 0.0)); + PrimBuild::vertex3f( 0.0, -0.5, 0.0); + PrimBuild::vertex3f( 0.0, 0.5, 0.0); + PrimBuild::color(LinearColorF(0.0, 0.0, 1.0)); + PrimBuild::vertex3f( 0.0, 0.0, -0.5); + PrimBuild::vertex3f( 0.0, 0.0, 0.5); + PrimBuild::end(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxMultiLight.cpp b/Engine/source/afx/ce/afxMultiLight.cpp new file mode 100644 index 000000000..6dc5f3a72 --- /dev/null +++ b/Engine/source/afx/ce/afxMultiLight.cpp @@ -0,0 +1,40 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/ce/afxMultiLight.h" + +IMPLEMENT_CO_DATABLOCK_V1(afxMultiLightData); + +ConsoleDocClass( afxMultiLightData, + "@brief afxMultiLightData is a legacy datablock which is not supported for T3D.\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxMultiLight.h b/Engine/source/afx/ce/afxMultiLight.h new file mode 100644 index 000000000..9a2261909 --- /dev/null +++ b/Engine/source/afx/ce/afxMultiLight.h @@ -0,0 +1,38 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_MULTI_LIGHT_H_ +#define _AFX_MULTI_LIGHT_H_ + +struct afxMultiLightData : public GameBaseData +{ + typedef GameBaseData Parent; + DECLARE_CONOBJECT(afxMultiLightData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_MULTI_LIGHT_H_ diff --git a/Engine/source/afx/ce/afxParticleEmitter.cpp b/Engine/source/afx/ce/afxParticleEmitter.cpp new file mode 100644 index 000000000..3983b27ba --- /dev/null +++ b/Engine/source/afx/ce/afxParticleEmitter.cpp @@ -0,0 +1,1617 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "scene/sceneManager.h" +#include "T3D/gameBase/gameProcess.h" + +#include "afx/util/afxPath.h" +#include "afx/util/afxPath3D.h" +#include "afx/ce/afxParticleEmitter.h" + +IMPLEMENT_CO_DATABLOCK_V1(afxParticleEmitterData); + +ConsoleDocClass( afxParticleEmitterData, + "@brief A base datablock inherited by AFX Particle Emitter effects.\n\n" + + "A base datablock inherited by AFX Particle Emitter effects." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxParticleEmitterData::afxParticleEmitterData() +{ + fade_velocity = false; // coordinate velocity amount with fade amout + fade_offset = false; // coordinate ejection-offset amount with fade amount + pe_vector.set(0.0,0.0,0.0); + pe_vector_is_world = false; + tpaths_string = ST_NULLSTRING; + tPathDataBlocks.clear(); + tPathDataBlockIds.clear(); +} + +afxParticleEmitterData::afxParticleEmitterData(const afxParticleEmitterData& other, bool temp_clone) : ParticleEmitterData(other, temp_clone) +{ + fade_velocity = other.fade_velocity; + fade_offset = other.fade_offset; + pe_vector = other.pe_vector; + pe_vector_is_world = other.pe_vector_is_world; + tpaths_string = other.tpaths_string; + tPathDataBlocks = other.tPathDataBlocks; + //tPathDataBlockIds = other.tPathDataBlockIds; +} + +void afxParticleEmitterData::initPersistFields() +{ + addField("fadeVelocity", TypeBool, Offset(fade_velocity, afxParticleEmitterData), + "If true, the initial velocity of emitted particles is multiplied by the fade amount " + "of the containing effect wrapper. As the effect fades-in and out, so does the " + "initial velocity of new particles."); + addField("fadeOffset", TypeBool, Offset(fade_offset, afxParticleEmitterData), + "If true, the ejection offset of emitted particles is multiplied by the fade amount " + "of the containing effect wrapper. As the effect fades-in and out, so does the " + "ejection offset of new particles."); + addField("vector", TypePoint3F, Offset(pe_vector, afxParticleEmitterData), + "General direction vector used for emitting particles. Its exact interpretation is " + "determined by the particle emitter subclass."); + addField("vectorIsWorld", TypeBool, Offset(pe_vector_is_world, afxParticleEmitterData), + "Sets whether the vector field should be interpreted as a vector in the world " + "coordinate system."); + addField("pathsTransform", TypeString, Offset(tpaths_string, afxParticleEmitterData), + "A string of paths to be used as transform paths. Each path name must reference an " + "afxPathData datablock. Transform paths are used to translate particles along a given " + "path or series of paths."); + + Parent::initPersistFields(); +} + +void afxParticleEmitterData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeFlag(fade_velocity); + stream->writeFlag(fade_offset); + mathWrite(*stream, pe_vector); + stream->writeFlag(pe_vector_is_world); + + stream->write(tPathDataBlockIds.size()); + for (int i = 0; i < tPathDataBlockIds.size(); i++) + stream->write(tPathDataBlockIds[i]); +} + +void afxParticleEmitterData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + fade_velocity = stream->readFlag(); + fade_offset = stream->readFlag(); + mathRead(*stream, &pe_vector); + pe_vector_is_world = stream->readFlag(); + + U32 n_db; stream->read(&n_db); + tPathDataBlockIds.setSize(n_db); + for (U32 i = 0; i < n_db; i++) + stream->read(&tPathDataBlockIds[i]); +} + +bool afxParticleEmitterData::onAdd() +{ + if( Parent::onAdd() == false ) + return false; + + if (tpaths_string != ST_NULLSTRING && tpaths_string[0] == '\0') + { + Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) empty transform paths string.", getName()); + return false; + } + + if (tpaths_string != ST_NULLSTRING && dStrlen(tpaths_string) > 255) + { + Con::errorf(ConsoleLogEntry::General, "ParticleEmitterData(%s) transform paths string too long [> 255 chars].", getName()); + return false; + } + + if (tpaths_string != ST_NULLSTRING) + { + Vector dataBlocks(__FILE__, __LINE__); + char* tokCopy = new char[dStrlen(tpaths_string) + 1]; + dStrcpy(tokCopy, tpaths_string); + + char* currTok = dStrtok(tokCopy, " \t"); + while (currTok != NULL) + { + dataBlocks.push_back(currTok); + currTok = dStrtok(NULL, " \t"); + } + if (dataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) invalid transform paths string. No datablocks found", getName()); + delete [] tokCopy; + return false; + } + tPathDataBlocks.clear(); + tPathDataBlockIds.clear(); + + for (U32 i = 0; i < dataBlocks.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(dataBlocks[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) unable to find transform path datablock: %s", getName(), dataBlocks[i]); + } + else + { + tPathDataBlocks.push_back(pData); + tPathDataBlockIds.push_back(pData->getId()); + } + } + delete [] tokCopy; + if (tPathDataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) unable to find any transform path datablocks", getName()); + return false; + } + } + + return true; +} + +bool afxParticleEmitterData::preload(bool server, String &errorStr) +{ + if (Parent::preload(server, errorStr) == false) + return false; + + tPathDataBlocks.clear(); + for (U32 i = 0; i < tPathDataBlockIds.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(tPathDataBlockIds[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, + "ParticleEmitterData(%s) unable to find transform path datablock: %d", + getName(), tPathDataBlockIds[i]); + } + else + tPathDataBlocks.push_back(pData); + } + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// VECTOR + +IMPLEMENT_CO_DATABLOCK_V1(afxParticleEmitterVectorData); + +ConsoleDocClass( afxParticleEmitterVectorData, + "@brief An AFX customized particle emitter that emits particles along a 3D vector.\n\n" + + "An AFX customized particle emitter that emits particles along a 3D vector." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxParticleEmitterVectorData::afxParticleEmitterVectorData() +{ +} + +afxParticleEmitterVectorData::afxParticleEmitterVectorData(const afxParticleEmitterVectorData& other, bool temp_clone) : afxParticleEmitterData(other, temp_clone) +{ +} + +void afxParticleEmitterVectorData::initPersistFields() +{ + Parent::initPersistFields(); +} + +void afxParticleEmitterVectorData::packData(BitStream* stream) +{ + Parent::packData(stream); +} + +void afxParticleEmitterVectorData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); +} + +bool afxParticleEmitterVectorData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + return true; +} + +bool afxParticleEmitterVectorData::preload(bool server, String &errorStr) +{ + if (Parent::preload(server, errorStr) == false) + return false; + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// CONE + +IMPLEMENT_CO_DATABLOCK_V1(afxParticleEmitterConeData); + +ConsoleDocClass( afxParticleEmitterConeData, + "@brief An AFX customized particle emitter that emits particles within a cone shape.\n\n" + + "An AFX customized particle emitter that emits particles within a cone shape." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxParticleEmitterConeData::afxParticleEmitterConeData() +{ + spread_min = 0.0f; + spread_max = 90.0f; +} + +afxParticleEmitterConeData::afxParticleEmitterConeData(const afxParticleEmitterConeData& other, bool temp_clone) : afxParticleEmitterData(other, temp_clone) +{ + spread_min = other.spread_min; + spread_max = other.spread_max; +} + +void afxParticleEmitterConeData::initPersistFields() +{ + addField("spreadMin", TypeF32, Offset(spread_min, afxParticleEmitterConeData), + "..."); + addField("spreadMax", TypeF32, Offset(spread_max, afxParticleEmitterConeData), + "..."); + + Parent::initPersistFields(); +} + +void afxParticleEmitterConeData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeRangedU32((U32)spread_min, 0, 180); + stream->writeRangedU32((U32)spread_max, 0, 180); +} + +void afxParticleEmitterConeData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + spread_min = stream->readRangedU32(0, 180); + spread_max = stream->readRangedU32(0, 180); +} + +bool afxParticleEmitterConeData::onAdd() +{ + if( Parent::onAdd() == false ) + return false; + + if (spread_min < 0.0f) + { + Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) spreadMin < 0.0", getName()); + spread_min = 0.0f; + } + if (spread_max > 180.0f) + { + Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) spreadMax > 180.0f", getName()); + spread_max = 180.0f; + } + + if (spread_max > 179.5f) + spread_max = 179.5f; + if (spread_min > 179.5f) + spread_min = 179.5f; + + if (spread_min > spread_max) + { + Con::warnf(ConsoleLogEntry::General, "ParticleEmitterData(%s) spreadMin > spreadMax", getName()); + spread_min = spread_max; + } + + return true; +} + +bool afxParticleEmitterConeData::preload(bool server, String &errorStr) +{ + if (Parent::preload(server, errorStr) == false) + return false; + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// PATH + +IMPLEMENT_CO_DATABLOCK_V1(afxParticleEmitterPathData); + +ConsoleDocClass( afxParticleEmitterPathData, + "@brief An AFX customized particle emitter that emits particles along a path.\n\n" + + "An AFX customized particle emitter that emits particles along a path." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxParticleEmitterPathData::afxParticleEmitterPathData() +{ + epaths_string = ST_NULLSTRING; + epathDataBlocks.clear(); + epathDataBlockIds.clear(); + path_origin_type = PATHEMIT_ORIGIN; + ground_conform = false; + ground_conform_terrain = true; + ground_conform_interiors = true; + ground_conform_height = 0.0f; +} + +afxParticleEmitterPathData::afxParticleEmitterPathData(const afxParticleEmitterPathData& other, bool temp_clone) : afxParticleEmitterData(other, temp_clone) +{ + epaths_string = other.epaths_string; + epathDataBlocks = other.epathDataBlocks; + //epathDataBlockIds = other.epathDataBlockIds; + path_origin_type = other.path_origin_type; + ground_conform = other.ground_conform; + ground_conform_terrain = other.ground_conform_terrain; + ground_conform_interiors = other.ground_conform_interiors; + ground_conform_height = other.ground_conform_height; +} + +ImplementEnumType( afxParticleEmitterPath_OriginType, "Possible particle emitter path origin types.\n" "@ingroup afxParticleEmitterPath\n\n" ) + { afxParticleEmitterPathData::PATHEMIT_ORIGIN, "origin", "..." }, + { afxParticleEmitterPathData::PATHEMIT_POINT, "point", "..." }, + { afxParticleEmitterPathData::PATHEMIT_VECTOR, "vector", "..." }, + { afxParticleEmitterPathData::PATHEMIT_TANGENT, "tangent", "..." }, +EndImplementEnumType; + +void afxParticleEmitterPathData::initPersistFields() +{ + addField("paths", TypeString, Offset(epaths_string, afxParticleEmitterPathData), + "..."); + + addField("pathOrigin", TYPEID(), Offset(path_origin_type, afxParticleEmitterPathData), + "..."); + + // JTF Note: take a look at these and make sure they are ok. + addField("groundConform", TypeBool, Offset(ground_conform, afxParticleEmitterPathData), + "..."); + addField("groundConformTerrain", TypeBool, Offset(ground_conform_terrain, afxParticleEmitterPathData), + "..."); + addField("groundConformInteriors", TypeBool, Offset(ground_conform_interiors, afxParticleEmitterPathData), + "..."); + addField("groundConformHeight", TypeF32, Offset(ground_conform_height, afxParticleEmitterPathData), + "..."); + + Parent::initPersistFields(); +} + +void afxParticleEmitterPathData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(epathDataBlockIds.size()); + for (int i = 0; i < epathDataBlockIds.size(); i++) + stream->write(epathDataBlockIds[i]); + stream->write(path_origin_type); + stream->writeFlag(ground_conform); + stream->writeFlag(ground_conform_terrain); + stream->writeFlag(ground_conform_interiors); + stream->write(ground_conform_height); +} + +void afxParticleEmitterPathData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + U32 n_db; stream->read(&n_db); + epathDataBlockIds.setSize(n_db); + for (U32 i = 0; i < n_db; i++) + stream->read(&epathDataBlockIds[i]); + stream->read(&path_origin_type); + ground_conform = stream->readFlag(); + ground_conform_terrain = stream->readFlag(); + ground_conform_interiors = stream->readFlag(); + stream->read(&ground_conform_height); +} + +bool afxParticleEmitterPathData::onAdd() +{ + if( Parent::onAdd() == false ) + return false; + + // path + if (epaths_string != ST_NULLSTRING && epaths_string[0] == '\0') + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) empty paths string.", getName()); + return false; + } + + if (epaths_string != ST_NULLSTRING && dStrlen(epaths_string) > 255) + { + Con::errorf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) paths string too long [> 255 chars].", getName()); + return false; + } + + if (epaths_string != ST_NULLSTRING) + { + Vector dataBlocks(__FILE__, __LINE__); + char* tokCopy = new char[dStrlen(epaths_string) + 1]; + dStrcpy(tokCopy, epaths_string); + + char* currTok = dStrtok(tokCopy, " \t"); + while (currTok != NULL) + { + dataBlocks.push_back(currTok); + currTok = dStrtok(NULL, " \t"); + } + if (dataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) invalid paths string. No datablocks found", getName()); + delete [] tokCopy; + return false; + } + epathDataBlocks.clear(); + epathDataBlockIds.clear(); + + for (U32 i = 0; i < dataBlocks.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(dataBlocks[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) unable to find path datablock: %s", getName(), dataBlocks[i]); + } + else + { + epathDataBlocks.push_back(pData); + epathDataBlockIds.push_back(pData->getId()); + } + } + delete [] tokCopy; + if (epathDataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) unable to find any path datablocks", getName()); + return false; + } + } + + return true; +} + +bool afxParticleEmitterPathData::preload(bool server, String &errorStr) +{ + if (Parent::preload(server, errorStr) == false) + return false; + + epathDataBlocks.clear(); + for (U32 i = 0; i < epathDataBlockIds.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(epathDataBlockIds[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, + "afxParticleEmitterPathData(%s) unable to find path datablock: %d", + getName(), epathDataBlockIds[i]); + } + else + epathDataBlocks.push_back(pData); + } + parts_per_eject = epathDataBlocks.size(); + + return true; +} + +void afxParticleEmitterPathData::onPerformSubstitutions() +{ + Parent::onPerformSubstitutions(); + + + if (epaths_string != ST_NULLSTRING && epaths_string[0] == '\0') + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) empty paths string.", getName()); + return;// false; + } + + if (epaths_string != ST_NULLSTRING && dStrlen(epaths_string) > 255) + { + Con::errorf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) paths string too long [> 255 chars].", getName()); + return;// false; + } + + if (epaths_string != ST_NULLSTRING) + { + Vector dataBlocks(__FILE__, __LINE__); + char* tokCopy = new char[dStrlen(epaths_string) + 1]; + dStrcpy(tokCopy, epaths_string); + + char* currTok = dStrtok(tokCopy, " \t"); + while (currTok != NULL) + { + dataBlocks.push_back(currTok); + currTok = dStrtok(NULL, " \t"); + } + if (dataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) invalid paths string. No datablocks found", getName()); + delete [] tokCopy; + return;// false; + } + epathDataBlocks.clear(); + epathDataBlockIds.clear(); + + for (U32 i = 0; i < dataBlocks.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(dataBlocks[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) unable to find path datablock: %s", getName(), dataBlocks[i]); + } + else + { + epathDataBlocks.push_back(pData); + epathDataBlockIds.push_back(pData->getId()); + } + } + delete [] tokCopy; + if (epathDataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxParticleEmitterPathData(%s) unable to find any path datablocks", getName()); + return;// false; + } + } + + + /*epathDataBlocks.clear(); + for (U32 i = 0; i < epathDataBlockIds.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(epathDataBlockIds[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, + "afxParticleEmitterPathData(%s) unable to find path datablock: %d", + getName(), epathDataBlockIds[i]); + } + else + epathDataBlocks.push_back(pData); + } + */ + parts_per_eject = epathDataBlocks.size(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// DISC + +IMPLEMENT_CO_DATABLOCK_V1(afxParticleEmitterDiscData); + +ConsoleDocClass( afxParticleEmitterDiscData, + "@brief An AFX customized particle emitter that emits particles within a disc shape.\n\n" + + "An AFX customized particle emitter that emits particles within a disc shape." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxParticleEmitterDiscData::afxParticleEmitterDiscData() +{ + pe_radius_min = 0.0f; + pe_radius_max = 1.0f; +} + +afxParticleEmitterDiscData::afxParticleEmitterDiscData(const afxParticleEmitterDiscData& other, bool temp_clone) : afxParticleEmitterData(other, temp_clone) +{ + pe_radius_min = other.pe_radius_min; + pe_radius_max = other.pe_radius_max; +} + +void afxParticleEmitterDiscData::initPersistFields() +{ + addField("radiusMin", TypeF32, Offset(pe_radius_min, afxParticleEmitterDiscData), + "..."); + addField("radiusMax", TypeF32, Offset(pe_radius_max, afxParticleEmitterDiscData), + "..."); + + Parent::initPersistFields(); +} + +void afxParticleEmitterDiscData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeInt((S32)(pe_radius_min * 100), 16); + stream->writeInt((S32)(pe_radius_max * 100), 16); +} + +void afxParticleEmitterDiscData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + pe_radius_min = stream->readInt(16) / 100.0f; + pe_radius_max = stream->readInt(16) / 100.0f; +} + +bool afxParticleEmitterDiscData::onAdd() +{ + if( Parent::onAdd() == false ) + return false; + + return true; +} + +bool afxParticleEmitterDiscData::preload(bool server, String &errorStr) +{ + if (Parent::preload(server, errorStr) == false) + return false; + + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxParticleEmitter::afxParticleEmitter() +{ + pe_vector.set(0,0,1); + pe_vector_norm.set(0,0,1); + tpaths.clear(); + tpath_mults.clear(); + n_tpath_points = 0; + tpath_points = NULL; + afx_owner = 0; +} + +afxParticleEmitter::~afxParticleEmitter() +{ +} + +bool afxParticleEmitter::onAdd() +{ + if( !Parent::onAdd() ) + return false; + + if (dynamic_cast(mDataBlock)) + init_paths(); + + return true; +} + +void afxParticleEmitter::onRemove() +{ + if (dynamic_cast(mDataBlock)) + cleanup_paths(); + + Parent::onRemove(); +} + +void afxParticleEmitter::init_paths() +{ + if (!mDataBlock) + { + n_tpath_points = 0; + tpath_points = NULL; + return; + } + + if (mDataBlock->tPathDataBlocks.size() < 1) + { + n_tpath_points = 0; + tpath_points = NULL; + } + else + { + n_tpath_points = mDataBlock->tPathDataBlocks.size(); + tpath_points = new Point3F*[n_tpath_points]; + + for (U32 i=0; i < n_tpath_points; i++) + { + afxPathData* pd = mDataBlock->tPathDataBlocks[i]; + if (!pd) + continue; + + if (pd->getSubstitutionCount() > 0 && afx_owner) + { + afxPathData* orig_db = pd; + pd = new afxPathData(*orig_db, true); + orig_db->performSubstitutions(pd, afx_owner); + } + + if (pd->num_points > 0) + { + afxPath3D* path = new afxPath3D(); + if (pd->times) + path->buildPath( pd->num_points, pd->points, pd->times, pd->delay, 1.0f ); + else if (pd->lifetime == 0) + path->buildPath( pd->num_points, pd->points, pd->delay, 1.0f ); + else + path->buildPath( pd->num_points, pd->points, pd->delay, pd->delay+pd->lifetime ); + path->setLoopType( pd->loop_type ); + tpaths.push_back(path); + + tpath_mults.push_back( pd->mult ); + + tpath_points[i] = new Point3F[pd->num_points]; + for (U32 j=0; jnum_points; j++) + tpath_points[i][j] = pd->points[j]; + } + else + { + Con::warnf("afxParticleEmitter::init_paths() -- pathsTransform datablock (%d) has no points.", i); + } + + if (pd->isTempClone()) + delete pd; + } + } +} + +void afxParticleEmitter::cleanup_paths() +{ + if (n_tpath_points < 1) + return; + + for (U32 i=0; i < tpaths.size(); i++) + { + if (tpaths[i]) + delete tpaths[i]; + } + tpaths.clear(); + + if (tpath_points) + { + if (mDataBlock) + { + for (U32 i=0; i < n_tpath_points; i++) + { + if (tpath_points[i]) + delete [] tpath_points[i]; + } + } + + delete [] tpath_points; + tpath_points = 0; + } +} + +void afxParticleEmitter::sub_particleUpdate(Particle* part) +{ + if (tpaths.size() < 1) + return; + + F32 t = ((F32)part->currentAge)/((F32)part->totalLifetime); + for (U32 i=0; i < tpaths.size(); i++) + { + F32 t_last = part->t_last; + Point3F path_delta = (t_last <= 0.0f) ? tpaths[i]->evaluateAtTime(t) : tpaths[i]->evaluateAtTime(t_last, t); + + if (mDataBlock->tPathDataBlocks[i]->concentric) + { + // scale radial vector by x-component of path + part->pos_local += part->radial_v*path_delta.x; + // scale axis vector by z-component of path + part->pos_local += pe_vector_norm*path_delta.z; + // y-component is ignored + } + else + { + part->pos_local += path_delta; + } + } + + part->t_last = t; +} + +void afxParticleEmitter::preCompute(const MatrixF& mat) +{ + // Put vector into the space of the input matrix + pe_vector = mDataBlock->pe_vector; + if (!mDataBlock->pe_vector_is_world) + mat.mulV(pe_vector); + + pe_vector_norm = pe_vector; + pe_vector_norm.normalize(); + + // Transform Paths: rebuild with current matrix + for( U32 i=0; i < tpaths.size(); i++ ) + { + for( U32 j=0; j < tpaths[i]->getNumPoints(); j++ ) + { + Point3F p = tpath_points[i][j]; + mat.mulV(p); + tpaths[i]->setPointPosition(j, p); + } + + tpaths[i]->reBuildPath(); + } + + sub_preCompute(mat); +} + +void afxParticleEmitter::afx_emitParticles(const Point3F& point, const bool useLastPosition, const Point3F& velocity, const U32 numMilliseconds) +{ + if (mDead) return; + + // lifetime over - no more particles + if (mLifetimeMS > 0 && mElapsedTimeMS > mLifetimeMS) + return; + + Point3F realStart; + if (useLastPosition && mHasLastPosition) + realStart = mLastPosition; + else + realStart = point; + + afx_emitParticles(realStart, point, velocity, numMilliseconds); +} + +void afxParticleEmitter::afx_emitParticles(const Point3F& start, const Point3F& end, const Point3F& velocity, const U32 numMilliseconds) +{ + if (mDead) return; + + // lifetime over - no more particles + if (mLifetimeMS > 0 && mElapsedTimeMS > mLifetimeMS) + return; + + U32 currTime = 0; + bool particlesAdded = false; + + if (mNextParticleTime != 0) + { + // Need to handle next particle + // + if (mNextParticleTime > numMilliseconds) + { + // Defer to next update + // (Note that this introduces a potential spatial irregularity if the owning + // object is accelerating, and updating at a low frequency) + // + mNextParticleTime -= numMilliseconds; + mInternalClock += numMilliseconds; + mLastPosition = end; + mHasLastPosition = true; + return; + } + else + { + currTime += mNextParticleTime; + mInternalClock += mNextParticleTime; + // Emit particle at curr time + + // Create particle at the correct position + Point3F pos; + pos.interpolate(start, end, F32(currTime) / F32(numMilliseconds)); + + for (S32 p = 0; p < mDataBlock->parts_per_eject; p++) + { + sub_addParticle(pos, velocity, numMilliseconds-currTime, p); + particlesAdded = true; + } + mNextParticleTime = 0; + } + } + + while (currTime < numMilliseconds) + { + S32 nextTime = mDataBlock->ejectionPeriodMS; + if (mDataBlock->periodVarianceMS != 0) + { + nextTime += S32(gRandGen.randI() % (2 * mDataBlock->periodVarianceMS + 1)) - + S32(mDataBlock->periodVarianceMS); + } + AssertFatal(nextTime > 0, "Error, next particle ejection time must always be greater than 0"); + + if (currTime + nextTime > numMilliseconds) + { + mNextParticleTime = (currTime + nextTime) - numMilliseconds; + mInternalClock += numMilliseconds - currTime; + AssertFatal(mNextParticleTime > 0, "Error, should not have deferred this particle!"); + break; + } + + currTime += nextTime; + mInternalClock += nextTime; + + // Create particle at the correct position + Point3F pos; + pos.interpolate(start, end, F32(currTime) / F32(numMilliseconds)); + + U32 advanceMS = numMilliseconds - currTime; + if (mDataBlock->overrideAdvance == false && advanceMS != 0) + { + for (S32 p = 0; p < mDataBlock->parts_per_eject; p++) + { + sub_addParticle(pos, velocity, numMilliseconds-currTime, p); + particlesAdded = true; + + Particle* last_part = part_list_head.next; + if (last_part) + { + if (advanceMS > last_part->totalLifetime) + { + part_list_head.next = last_part->next; + n_parts--; + last_part->next = part_freelist; + part_freelist = last_part; + } + else + { + F32 t = F32(advanceMS) / 1000.0; + + Point3F a = last_part->acc; + a -= last_part->vel*last_part->dataBlock->dragCoefficient; + a -= mWindVelocity*last_part->dataBlock->windCoefficient; + //a += Point3F(0, 0, -9.81) * last_part->dataBlock->gravityCoefficient; + a.z += -9.81f*last_part->dataBlock->gravityCoefficient; // as long as gravity is a constant, this is faster + + last_part->vel += a * t; + last_part->pos_local += last_part->vel * t; + + // allow subclasses to adjust the particle params here + sub_particleUpdate(last_part); + + if (last_part->dataBlock->constrain_pos) + last_part->pos = last_part->pos_local + this->pos_pe; + else + last_part->pos = last_part->pos_local; + + updateKeyData(last_part); + } + } + } + } + else + { + for (S32 p = 0; p < mDataBlock->parts_per_eject; p++) + { + sub_addParticle(pos, velocity, numMilliseconds-currTime, p); + particlesAdded = true; + } + } + } + + if( particlesAdded == true ) + updateBBox(); + + if( n_parts > 0 && mSceneManager == NULL ) + { + gClientSceneGraph->addObjectToScene(this); + ClientProcessList::get()->addObject(this); + } + + mLastPosition = end; + mHasLastPosition = true; +} + +Particle* afxParticleEmitter::alloc_particle() +{ + n_parts++; + + // this should happen rarely + if (n_parts > n_part_capacity) + { + Particle* store_block = new Particle[16]; + part_store.push_back(store_block); + n_part_capacity += 16; + for (S32 i = 0; i < 16; i++) + { + store_block[i].next = part_freelist; + part_freelist = &store_block[i]; + } + mDataBlock->allocPrimBuffer(n_part_capacity); + } + + Particle* pNew = part_freelist; + part_freelist = pNew->next; + pNew->next = part_list_head.next; + part_list_head.next = pNew; + + return pNew; +} + +ParticleData* afxParticleEmitter::pick_particle_type() +{ + U32 dBlockIndex = (U32)(mCeil(gRandGen.randF() * F32(mDataBlock->particleDataBlocks.size())) - 1); + return mDataBlock->particleDataBlocks[dBlockIndex]; +} + +bool afxParticleEmitter::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if( !mDataBlock || !Parent::onNewDataBlock(dptr, reload) ) + return false; + + if (mDataBlock->isTempClone()) + return true; + + scriptOnNewDataBlock(); + return true; +} + +void afxParticleEmitter::emitParticlesExt(const MatrixF& xfm, const Point3F& point, const Point3F& velocity, const U32 numMilliseconds) +{ + if (mDataBlock->use_emitter_xfm) + { + Point3F zero_point(0.0f, 0.0f, 0.0f); + pos_pe = zero_point; + setTransform(xfm); + + preCompute(xfm); + afx_emitParticles(zero_point, true, velocity, numMilliseconds); + } + else + { + pos_pe = point; + preCompute(xfm); + afx_emitParticles(point, true, velocity, numMilliseconds); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// VECTOR + +afxParticleEmitterVector::afxParticleEmitterVector() +{ +} + +afxParticleEmitterVector::~afxParticleEmitterVector() +{ +} + +bool afxParticleEmitterVector::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if( !mDataBlock || !Parent::onNewDataBlock(dptr, reload) ) + return false; + + if (mDataBlock->isTempClone()) + return true; + + scriptOnNewDataBlock(); + return true; +} + +void afxParticleEmitterVector::sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx) +{ + Particle* pNew = alloc_particle(); + ParticleData* part_db = pick_particle_type(); + + Point3F pos_start = pos; + if (part_db->constrain_pos) + pos_start.set(0,0,0); + + F32 initialVel = mDataBlock->ejectionVelocity; + initialVel += (mDataBlock->velocityVariance * 2.0f * gRandGen.randF()) - mDataBlock->velocityVariance; + if(mDataBlock->fade_velocity) + initialVel *= fade_amt; + + F32 ejection_offset = mDataBlock->ejectionOffset; + if(mDataBlock->fade_offset) + ejection_offset *= fade_amt; + + pNew->pos = pos_start + (pe_vector_norm * ejection_offset); + pNew->pos_local = pNew->pos; + + pNew->vel = pe_vector_norm * initialVel; + if (mDataBlock->orientParticles) + pNew->orientDir = pe_vector_norm; + else + // note -- for non-oriented particles, we use orientDir.x to store the billboard start angle. + pNew->orientDir.x = mDegToRad(part_db->start_angle + part_db->angle_variance*2.0f*gRandGen.randF() - part_db->angle_variance); + pNew->acc.set(0, 0, 0); + pNew->currentAge = age_offset; + pNew->t_last = 0.0f; + + pNew->radial_v.set(0.0f, 0.0f, 0.0f); + + part_db->initializeParticle(pNew, vel); + updateKeyData( pNew ); +} + +void afxParticleEmitterVector::sub_preCompute(const MatrixF& mat) +{ +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// CONE + +afxParticleEmitterCone::afxParticleEmitterCone() +{ + cone_v.set(0,0,1); + cone_s0.set(0,0,1); + cone_s1.set(0,0,1); +} + +afxParticleEmitterCone::~afxParticleEmitterCone() +{ +} + +bool afxParticleEmitterCone::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if( !mDataBlock || !Parent::onNewDataBlock(dptr, reload) ) + return false; + + if (mDataBlock->isTempClone()) + return true; + + scriptOnNewDataBlock(); + return true; +} + +void afxParticleEmitterCone::sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx) +{ + Particle* pNew = alloc_particle(); + ParticleData* part_db = pick_particle_type(); + + Point3F pos_start = pos; + if (part_db->constrain_pos) + pos_start.set(0,0,0); + + F32 initialVel = mDataBlock->ejectionVelocity; + initialVel += (mDataBlock->velocityVariance * 2.0f * gRandGen.randF()) - mDataBlock->velocityVariance; + if(mDataBlock->fade_velocity) + initialVel *= fade_amt; + + // Randomly choose a vector between cone_s0 and cone_s1 and normalize: + Point3F vec; + F32 t = mRandF(0.0f, 1.0f); + vec.interpolate(cone_s0, cone_s1, t); + vec.normalize(); + + // Randomly rotate about cone_v + F32 theta = mRandF(0.0f, M_2PI_F); + AngAxisF thetaRot(cone_v, theta); + MatrixF temp(true); + thetaRot.setMatrix(&temp); + temp.mulP(vec); + + F32 ejection_offset = mDataBlock->ejectionOffset; + if(mDataBlock->fade_offset) + ejection_offset *= fade_amt; + + pNew->pos = pos_start + (vec * ejection_offset); + pNew->pos_local = pNew->pos; + + pNew->vel = mDataBlock->ejectionInvert ? vec * -initialVel : vec * initialVel; + if (mDataBlock->orientParticles) + pNew->orientDir = vec; + else + // note -- for non-oriented particles, we use orientDir.x to store the billboard start angle. + pNew->orientDir.x = mDegToRad(part_db->start_angle + part_db->angle_variance*2.0f*gRandGen.randF() - part_db->angle_variance); + pNew->acc.set(0, 0, 0); + pNew->currentAge = age_offset; + pNew->t_last = 0.0f; + + pNew->radial_v.set(0.0f, 0.0f, 0.0f); + + part_db->initializeParticle(pNew, vel); + updateKeyData( pNew ); +} + +void afxParticleEmitterCone::sub_preCompute(const MatrixF& mat) +{ + // Find vectors on the XZ plane corresponding to the inner and outer spread angles: + // (tan is infinite at PI/4 or 90 degrees) + cone_v.set( 0.0f, 0.0f, 1.0f ); + + cone_s0.x = mTan( mDegToRad( ((afxParticleEmitterConeData*)mDataBlock)->spread_min / 2.0f )); + cone_s0.y = 0.0f; + cone_s0.z = 1.0f; + + cone_s1.x = mTan( mDegToRad(((afxParticleEmitterConeData*)mDataBlock)->spread_max / 2.0f )); + cone_s1.y = 0.0f; + cone_s1.z = 1.0f; + + Point3F axis; + F32 theta = mAcos( mDot(cone_v, pe_vector_norm) ); + + if( M_PI_F-theta < POINT_EPSILON ) + { + cone_v.neg(); + cone_s0.neg(); + cone_s1.neg(); + } + else if( theta > POINT_EPSILON ) + { + mCross(pe_vector_norm, cone_v, &axis); + axis.normalize(); + + AngAxisF thetaRot(axis, theta); + MatrixF temp(true); + thetaRot.setMatrix(&temp); + + temp.mulP(cone_v); + temp.mulP(cone_s0); + temp.mulP(cone_s1); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// PATH + +afxParticleEmitterPath::afxParticleEmitterPath() +{ + epaths.clear(); + epath_mults.clear(); + n_epath_points = 0; + epath_points = NULL; +} + +afxParticleEmitterPath::~afxParticleEmitterPath() +{ +} + +bool afxParticleEmitterPath::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if( !mDataBlock || !Parent::onNewDataBlock(dptr, reload) ) + return false; + + if (mDataBlock->isTempClone()) + return true; + + scriptOnNewDataBlock(); + return true; +} + +bool afxParticleEmitterPath::onAdd() +{ + if( !Parent::onAdd() ) + return false; + + if (dynamic_cast(mDataBlock)) + init_paths(); + + return true; +} + +void afxParticleEmitterPath::onRemove() +{ + if (dynamic_cast(mDataBlock)) + cleanup_paths(); + + Parent::onRemove(); +} + +void afxParticleEmitterPath::init_paths() +{ + if (!mDataBlock || ((afxParticleEmitterPathData*)mDataBlock)->epathDataBlocks.size() < 1) + { + n_epath_points = 0; + epath_points = NULL; + return; + } + + n_epath_points = ((afxParticleEmitterPathData*)mDataBlock)->epathDataBlocks.size(); + epath_points = new Point3F*[n_epath_points]; + dMemset(epath_points, 0, n_epath_points*sizeof(Point3F*)); + + for (U32 i=0; i < n_epath_points; i++) + { + afxPathData* pd = ((afxParticleEmitterPathData*)mDataBlock)->epathDataBlocks[i]; + if (!pd) + continue; + + if (pd->getSubstitutionCount() > 0 && afx_owner) + { + afxPathData* orig_db = pd; + pd = new afxPathData(*orig_db, true); + orig_db->performSubstitutions(pd, afx_owner); + } + + if (pd->num_points > 0) + { + afxPath3D* path = new afxPath3D(); + if (pd->times) + path->buildPath( pd->num_points, pd->points, pd->times, 0.0f, 1.0f ); + else + path->buildPath( pd->num_points, pd->points, 0.0f, 1.0f ); + epaths.push_back(path); + + epath_mults.push_back( pd->mult ); + + epath_points[i] = new Point3F[pd->num_points]; + for (U32 j=0; jnum_points; j++) + epath_points[i][j] = pd->points[j]; + } + else + { + Con::warnf("afxParticleEmitterPath::init_paths() -- paths datablock (%d) has no points.", i); + } + + if (pd->isTempClone()) + delete pd; + } +} + +void afxParticleEmitterPath::cleanup_paths() +{ + if (n_epath_points < 1) + return; + + for (U32 i=0; i < epaths.size(); i++) + { + if (epaths[i]) + delete epaths[i]; + } + epaths.clear(); + + if (epath_points) + { + if (mDataBlock) + { + for (U32 i=0; i < n_epath_points; i++) + { + if (epath_points[i]) + delete [] epath_points[i]; + } + } + + delete [] epath_points; + epath_points = 0; + } +} + +void afxParticleEmitterPath::sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx) +{ + if (part_idx >= epaths.size() || !epaths[part_idx]) + return; + + Particle* pNew = alloc_particle(); + ParticleData* part_db = pick_particle_type(); + + Point3F pos_start = pos; + if (part_db->constrain_pos) + pos_start.set(0,0,0); + + F32 initialVel = mDataBlock->ejectionVelocity; + initialVel += (mDataBlock->velocityVariance * 2.0f * gRandGen.randF()) - mDataBlock->velocityVariance; + if(mDataBlock->fade_velocity) + initialVel *= fade_amt; + + // Randomly choose a curve parameter between [0.0,1.0] and evaluate the curve there + F32 param = mRandF(0.0f, 1.0f); + + Point3F curve_pos = epaths[part_idx]->evaluateAtTime(param); + + Point3F vec; + switch (((afxParticleEmitterPathData*)mDataBlock)->path_origin_type) + { + case afxParticleEmitterPathData::PATHEMIT_ORIGIN : + vec = curve_pos; + vec.normalize(); + break; + case afxParticleEmitterPathData::PATHEMIT_POINT : + vec = curve_pos-pe_vector; + vec.normalize(); + break; + case afxParticleEmitterPathData::PATHEMIT_VECTOR : + vec = pe_vector_norm; + break; + case afxParticleEmitterPathData::PATHEMIT_TANGENT : + vec = epaths[part_idx]->evaluateTangentAtTime(param); + vec.normalize(); + break; + } + + F32 ejection_offset = mDataBlock->ejectionOffset; + if(mDataBlock->fade_offset) + ejection_offset *= fade_amt; + + pNew->pos = pos_start + curve_pos + (vec * ejection_offset); + pNew->pos_local = pNew->pos; + + pNew->vel = mDataBlock->ejectionInvert ? vec * -initialVel : vec * initialVel; + if (mDataBlock->orientParticles) + pNew->orientDir = vec; + else + // note -- for non-oriented particles, we use orientDir.x to store the billboard start angle. + pNew->orientDir.x = mDegToRad(part_db->start_angle + part_db->angle_variance*2.0f*gRandGen.randF() - part_db->angle_variance); + pNew->acc.set(0, 0, 0); + pNew->currentAge = age_offset; + pNew->t_last = 0.0f; + + pNew->radial_v.set(0.0f, 0.0f, 0.0f); + + part_db->initializeParticle(pNew, vel); + updateKeyData( pNew ); +} + +void afxParticleEmitterPath::sub_preCompute(const MatrixF& mat) +{ + for( U32 i=0; i < epaths.size(); i++ ) + { + for( U32 j=0; j < epaths[i]->getNumPoints(); j++ ) + { + Point3F p = epath_points[i][j]; + mat.mulV(p); + + p *= epath_mults[i]; + if(mDataBlock->ground_conform) { + groundConformPoint(p, mat); + } + + epaths[i]->setPointPosition(j, p); + } + + epaths[i]->reBuildPath(); + } +} + +void afxParticleEmitterPath::groundConformPoint(Point3F& point, const MatrixF& mat) +{ + point += mat.getPosition(); + + RayInfo rInfo; + bool hit = false; + + if (mDataBlock->ground_conform_interiors) + { + U32 mask = InteriorLikeObjectType; + if (mDataBlock->ground_conform_terrain) + { + mask |= TerrainObjectType | TerrainLikeObjectType; + } + + Point3F above_pos(point); above_pos.z += 0.1f; + Point3F below_pos(point); below_pos.z -= 10000; + hit = gClientContainer.castRay(above_pos, below_pos, mask, &rInfo); + if (!hit) + { + above_pos.z = point.z + 10000; + below_pos.z = point.z - 0.1f; + hit = gClientContainer.castRay(below_pos, above_pos, mask, &rInfo); + } + } + else if (mDataBlock->ground_conform_terrain) + { + U32 mask = TerrainObjectType | TerrainLikeObjectType; + Point3F above_pos(point); above_pos.z += 10000; + Point3F below_pos(point); below_pos.z -= 10000; + hit = gClientContainer.castRay(above_pos, below_pos, mask, &rInfo); + } + + if (hit) + { + F32 terrain_z = rInfo.point.z; + F32 new_z = terrain_z + mDataBlock->ground_conform_height; + point.z = new_z; + } + + point -= mat.getPosition(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// DISC + +afxParticleEmitterDisc::afxParticleEmitterDisc() +{ + disc_v.set(0,0,1); + disc_r.set(1,0,0); +} + +afxParticleEmitterDisc::~afxParticleEmitterDisc() +{ +} + +bool afxParticleEmitterDisc::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if( !mDataBlock || !Parent::onNewDataBlock(dptr, reload) ) + return false; + + if (mDataBlock->isTempClone()) + return true; + + return true; +} + +void afxParticleEmitterDisc::sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx) +{ + Particle* pNew = alloc_particle(); + ParticleData* part_db = pick_particle_type(); + + Point3F pos_start = pos; + if (part_db->constrain_pos) + pos_start.set(0,0,0); + + F32 initialVel = mDataBlock->ejectionVelocity; + initialVel += (mDataBlock->velocityVariance * 2.0f * gRandGen.randF()) - mDataBlock->velocityVariance; + if(mDataBlock->fade_velocity) + initialVel *= fade_amt; + + // Randomly choose a radius vector + Point3F r( disc_r ); + F32 radius = mRandF(((afxParticleEmitterDiscData*)mDataBlock)->pe_radius_min, ((afxParticleEmitterDiscData*)mDataBlock)->pe_radius_max); + r *= radius; + + // Randomly rotate r about disc_v + F32 theta = mRandF(0.0f, M_2PI_F); + AngAxisF thetaRot(disc_v, theta); + MatrixF temp(true); + thetaRot.setMatrix(&temp); + temp.mulP(r); + + F32 ejection_offset = mDataBlock->ejectionOffset; + if(mDataBlock->fade_offset) + ejection_offset *= fade_amt; + + pNew->pos = pos_start + r + (disc_v * ejection_offset); + pNew->pos_local = pNew->pos; + + pNew->vel = (mDataBlock->ejectionInvert) ? (disc_v * -initialVel) : (disc_v * initialVel); + if (mDataBlock->orientParticles) + pNew->orientDir = disc_v; + else + // note -- for non-oriented particles, we use orientDir.x to store the billboard start angle. + pNew->orientDir.x = mDegToRad(part_db->start_angle + part_db->angle_variance*2.0f*gRandGen.randF() - part_db->angle_variance); + pNew->acc.set(0, 0, 0); + pNew->currentAge = age_offset; + pNew->t_last = 0.0f; + + pNew->radial_v = r; + + part_db->initializeParticle(pNew, vel); + updateKeyData( pNew ); +} + +void afxParticleEmitterDisc::sub_preCompute(const MatrixF& mat) +{ + disc_v.set(0.0f, 0.0f, 1.0f); + disc_r.set(1.0f, 0.0f, 0.0f); + + Point3F axis; + F32 theta = mAcos( mDot(disc_v, pe_vector_norm) ); + + if( M_PI_F-theta < POINT_EPSILON ) + { + disc_v.neg(); + } + else if( theta > POINT_EPSILON ) + { + mCross(pe_vector_norm, disc_v, &axis); + axis.normalize(); + + AngAxisF thetaRot(axis, theta); + MatrixF temp(true); + thetaRot.setMatrix(&temp); + + temp.mulP(disc_v); + temp.mulP(disc_r); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/ce/afxParticleEmitter.h b/Engine/source/afx/ce/afxParticleEmitter.h new file mode 100644 index 000000000..a7053a12b --- /dev/null +++ b/Engine/source/afx/ce/afxParticleEmitter.h @@ -0,0 +1,350 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_EMITTER_PARTICLE_H_ +#define _AFX_EMITTER_PARTICLE_H_ + +#include "T3D/fx/particleEmitter.h" + +class afxPathData; +class afxPath3D; + +class afxParticleEmitterData : public ParticleEmitterData +{ + typedef ParticleEmitterData Parent; + +public: + // The afx enhanced particle emitter allows fading + // of particle color, size, velocity, and/or offset. + // Fading is controlled by a common value which is + // set externally using setFadeAmount(). + // + bool fade_velocity; + bool fade_offset; + Point3F pe_vector; + // new -- consider vector in world space? + bool pe_vector_is_world; + + // new -- transform paths? + StringTableEntry tpaths_string; // + Vector tPathDataBlocks; // datablocks for paths + Vector tPathDataBlockIds; // datablock IDs which correspond to the pathDataBlocks + +public: + /*C*/ afxParticleEmitterData(); + /*C*/ afxParticleEmitterData(const afxParticleEmitterData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + bool preload(bool server, String &errorStr); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxParticleEmitterData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// VECTOR + +class afxParticleEmitterVectorData : public afxParticleEmitterData +{ + typedef afxParticleEmitterData Parent; + +public: + /*C*/ afxParticleEmitterVectorData(); + /*C*/ afxParticleEmitterVectorData(const afxParticleEmitterVectorData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + bool preload(bool server, String &errorStr); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxParticleEmitterVectorData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// CONE + +class afxParticleEmitterConeData : public afxParticleEmitterData +{ + typedef afxParticleEmitterData Parent; + +public: + F32 spread_min; + F32 spread_max; + +public: + /*C*/ afxParticleEmitterConeData(); + /*C*/ afxParticleEmitterConeData(const afxParticleEmitterConeData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + bool preload(bool server, String &errorStr); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxParticleEmitterConeData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// PATH + +class afxParticleEmitterPathData : public afxParticleEmitterData +{ + typedef afxParticleEmitterData Parent; + +public: + enum PathOriginType + { + PATHEMIT_ORIGIN, + PATHEMIT_POINT, + PATHEMIT_VECTOR, + PATHEMIT_TANGENT + }; + StringTableEntry epaths_string; // + Vector epathDataBlocks; // datablocks for paths + Vector epathDataBlockIds; // datablock IDs which correspond to the pathDataBlocks + U32 path_origin_type; + + bool ground_conform; + bool ground_conform_terrain; + bool ground_conform_interiors; + F32 ground_conform_height; + +public: + /*C*/ afxParticleEmitterPathData(); + /*C*/ afxParticleEmitterPathData(const afxParticleEmitterPathData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + bool preload(bool server, String &errorStr); + + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxParticleEmitterPathData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxParticleEmitterPathData::PathOriginType afxParticleEmitterPath_OriginType; +DefineEnumType( afxParticleEmitterPath_OriginType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// DISC + +class afxParticleEmitterDiscData : public afxParticleEmitterData +{ + typedef afxParticleEmitterData Parent; + +public: + F32 pe_radius_min; + F32 pe_radius_max; + +public: + /*C*/ afxParticleEmitterDiscData(); + /*C*/ afxParticleEmitterDiscData(const afxParticleEmitterDiscData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + bool preload(bool server, String &errorStr); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxParticleEmitterDiscData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxParticleEmitter : public ParticleEmitter +{ + typedef ParticleEmitter Parent; + +private: + afxParticleEmitterData* mDataBlock; + +protected: + Point3F pe_vector, pe_vector_norm; + + // these go with the "pathsTransform" field + Vector tpaths; + Vector tpath_mults; + U32 n_tpath_points; + Point3F** tpath_points; + + const SimObject* afx_owner; + + void init_paths(); + void cleanup_paths(); + + Particle* alloc_particle(); + ParticleData* pick_particle_type(); + void afx_emitParticles(const Point3F& point, const bool useLastPosition, const Point3F& velocity, const U32 numMilliseconds); + void afx_emitParticles(const Point3F& start, const Point3F& end, const Point3F& velocity, const U32 numMilliseconds); + void preCompute(const MatrixF& mat); + + virtual void sub_particleUpdate(Particle*); + virtual void sub_preCompute(const MatrixF& mat)=0; + virtual void sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx)=0; + +public: + /*C*/ afxParticleEmitter(); + /*D*/ ~afxParticleEmitter(); + + virtual void emitParticlesExt(const MatrixF& xfm, const Point3F& point, const Point3F& velocity, const U32 numMilliseconds); + + afxParticleEmitterData* getDataBlock(){ return mDataBlock; } + void setAFXOwner(const SimObject* owner) { afx_owner = owner; } + bool onNewDataBlock(GameBaseData* dptr, bool reload); + bool onAdd(); + void onRemove(); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// VECTOR + +class afxParticleEmitterVector : public afxParticleEmitter +{ + typedef afxParticleEmitter Parent; + +private: + afxParticleEmitterVectorData* mDataBlock; + +public: + /*C*/ afxParticleEmitterVector(); + /*D*/ ~afxParticleEmitterVector(); + + bool onNewDataBlock(GameBaseData* dptr, bool reload); + +protected: + void sub_preCompute(const MatrixF& mat); + void sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offse, S32 part_idxt); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// CONE + +class afxParticleEmitterCone : public afxParticleEmitter +{ + typedef afxParticleEmitter Parent; + +private: + afxParticleEmitterData* mDataBlock; + Point3F cone_v, cone_s0, cone_s1; + +public: + /*C*/ afxParticleEmitterCone(); + /*D*/ ~afxParticleEmitterCone(); + + bool onNewDataBlock(GameBaseData* dptr, bool reload); + +protected: + void sub_preCompute(const MatrixF& mat); + void sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// PATH + +class afxParticleEmitterPath : public afxParticleEmitter +{ + typedef afxParticleEmitter Parent; + +private: + afxParticleEmitterPathData* mDataBlock; + + Vector epaths; + Vector epath_mults; + U32 n_epath_points; + Point3F** epath_points; + + void init_paths(); + void cleanup_paths(); + + void groundConformPoint(Point3F& point, const MatrixF& mat); + +public: + /*C*/ afxParticleEmitterPath(); + /*D*/ ~afxParticleEmitterPath(); + + bool onNewDataBlock(GameBaseData* dptr, bool reload); + +protected: + bool onAdd(); + void onRemove(); + void sub_preCompute(const MatrixF& mat); + void sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// DISC + +class afxParticleEmitterDisc : public afxParticleEmitter +{ + typedef afxParticleEmitter Parent; + +private: + afxParticleEmitterDiscData* mDataBlock; + Point3F disc_v, disc_r; + +public: + /*C*/ afxParticleEmitterDisc(); + /*D*/ ~afxParticleEmitterDisc(); + + bool onNewDataBlock(GameBaseData* dptr, bool reload); + +protected: + void sub_preCompute(const MatrixF& mat); + void sub_addParticle(const Point3F& pos, const Point3F& vel, const U32 age_offset, S32 part_idx); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_EMITTER_PARTICLE_H_ diff --git a/Engine/source/afx/ce/afxPhraseEffect.cpp b/Engine/source/afx/ce/afxPhraseEffect.cpp new file mode 100644 index 000000000..3710e2fe6 --- /dev/null +++ b/Engine/source/afx/ce/afxPhraseEffect.cpp @@ -0,0 +1,312 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/ce/afxPhraseEffect.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPhraseEffectData::ewValidator +// +// When an effect is added using "addEffect", this validator intercepts the value +// and adds it to the dynamic effects list. +// +void afxPhraseEffectData::ewValidator::validateType(SimObject* object, void* typePtr) +{ + afxPhraseEffectData* eff_data = dynamic_cast(object); + afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); + + if (eff_data && ew) + { + eff_data->fx_list.push_back(*ew); + *ew = 0; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPhraseEffectData + +IMPLEMENT_CO_DATABLOCK_V1(afxPhraseEffectData); + +ConsoleDocClass( afxPhraseEffectData, + "@brief A datablock that specifies a Phrase Effect, a grouping of other effects.\n\n" + + "A Phrase Effect is a grouping or phrase of effects that do nothing until certain trigger events occur. It's like having a whole " + "Effectron organized as an individual effect." + "\n\n" + + "Phrase effects can respond to a number of different kinds of triggers:\n" + " -- Player triggers such as footsteps, jumps, landings, and idle triggers.\n" + " -- Arbitrary animation triggers on dts-based scene objects.\n" + " -- Arbitrary trigger bits assigned to active choreographer objects." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxPhraseEffectData::afxPhraseEffectData() +{ + duration = 0.0f; + n_loops = 1; + + // dummy entry holds effect-wrapper pointer while a special validator + // grabs it and adds it to an appropriate effects list + dummy_fx_entry = NULL; + + // marked true if datablock ids need to + // be converted into pointers + do_id_convert = false; + + trigger_mask = 0; + match_type = MATCH_ANY; + match_state = STATE_ON; + phrase_type = PHRASE_TRIGGERED; + + no_choreographer_trigs = false; + no_cons_trigs = false; + no_player_trigs = false; + + on_trig_cmd = ST_NULLSTRING; +} + +afxPhraseEffectData::afxPhraseEffectData(const afxPhraseEffectData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + duration = other.duration; + n_loops = other.n_loops; + dummy_fx_entry = other.dummy_fx_entry; + do_id_convert = other.do_id_convert; // -- + trigger_mask = other.trigger_mask; + match_type = other.match_type; + match_state = other.match_state; + phrase_type = other.phrase_type; + no_choreographer_trigs = other.no_choreographer_trigs; + no_cons_trigs = other.no_cons_trigs; + no_player_trigs = other.no_player_trigs; + on_trig_cmd = other.on_trig_cmd; + + // fx_list; // -- ?? +} + +void afxPhraseEffectData::reloadReset() +{ + fx_list.clear(); +} + +ImplementEnumType( afxPhraseEffect_MatchType, "Possible phrase effect match types.\n" "@ingroup afxPhraseEffect\n\n" ) + { afxPhraseEffectData::MATCH_ANY, "any", "..." }, + { afxPhraseEffectData::MATCH_ALL, "all", "..." }, +EndImplementEnumType; + +ImplementEnumType( afxPhraseEffect_StateType, "Possible phrase effect state types.\n" "@ingroup afxPhraseEffect\n\n" ) + { afxPhraseEffectData::STATE_ON, "on", "..." }, + { afxPhraseEffectData::STATE_OFF, "off", "..." }, + { afxPhraseEffectData::STATE_ON_AND_OFF, "both", "..." }, +EndImplementEnumType; + +ImplementEnumType( afxPhraseEffect_PhraseType, "Possible phrase effect types.\n" "@ingroup afxPhraseEffect\n\n" ) + { afxPhraseEffectData::PHRASE_TRIGGERED, "triggered", "..." }, + { afxPhraseEffectData::PHRASE_CONTINUOUS, "continuous", "..." }, +EndImplementEnumType; + +#define myOffset(field) Offset(field, afxPhraseEffectData) + +void afxPhraseEffectData::initPersistFields() +{ + addField("duration", TypeF32, myOffset(duration), + "Specifies a duration for the phrase-effect. If set to infinity, the phrase-effect " + "needs to have a phraseType of continuous. Set infinite duration using " + "$AFX::INFINITE_TIME."); + addField("numLoops", TypeS32, myOffset(n_loops), + "Specifies the number of times the phrase-effect should loop. If set to infinity, " + "the phrase-effect needs to have a phraseType of continuous. Set infinite looping " + "using $AFX::INFINITE_REPEATS."); + addField("triggerMask", TypeS32, myOffset(trigger_mask), + "Sets which bits to consider in the current trigger-state which consists of 32 " + "trigger-bits combined from (possibly overlapping) player trigger bits, constraint " + "trigger bits, and choreographer trigger bits."); + + addField("matchType", TYPEID(), myOffset(match_type), + "Selects what combination of bits in triggerMask lead to a trigger. When set to " + "'any', any bit in triggerMask matching the current trigger-state will cause a " + "trigger. If set to 'all', every bit in triggerMask must match the trigger-state. " + "Possible values: any or all."); + addField("matchState", TYPEID(), myOffset(match_state), + "Selects which bit-state(s) of bits in the triggerMask to consider when comparing to " + "the current trigger-state. Possible values: on, off, or both."); + addField("phraseType", TYPEID(), myOffset(phrase_type), + "Selects between triggered and continuous types of phrases. When set to 'triggered', " + "the phrase-effect is triggered when the relevant trigger-bits change state. When set " + "to 'continuous', the phrase-effect will stay active as long as the trigger-bits " + "remain in a matching state. Possible values: triggered or continuous."); + + addField("ignoreChoreographerTriggers", TypeBool, myOffset(no_choreographer_trigs), + "When true, trigger-bits on the choreographer will be ignored."); + addField("ignoreConstraintTriggers", TypeBool, myOffset(no_cons_trigs), + "When true, animation triggers from dts-based constraint source objects will be " + "ignored."); + addField("ignorePlayerTriggers", TypeBool, myOffset(no_player_trigs), + "When true, Player-specific triggers from Player-derived constraint source objects " + "will be ignored."); + + addField("onTriggerCommand", TypeString, myOffset(on_trig_cmd), + "Like a field substitution statement without the leading '$$' token, this eval " + "statement will be executed when a trigger occurs. Any '%%' and '##' tokens will be " + "substituted."); + + // effect lists + // for each of these, dummy_fx_entry is set and then a validator adds it to the appropriate effects list + static ewValidator emptyValidator(0); + addFieldV("addEffect", TYPEID< afxEffectBaseData >(), myOffset(dummy_fx_entry), &emptyValidator, + "A field macro which adds an effect wrapper datablock to a list of effects associated " + "with the phrase-effect's single phrase. Unlike other fields, addEffect follows an " + "unusual syntax. Order is important since the effects will resolve in the order they " + "are added to each list."); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("addEffect"); +} + +bool afxPhraseEffectData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxPhraseEffectData::pack_fx(BitStream* stream, const afxEffectList& fx, bool packed) +{ + stream->writeInt(fx.size(), EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < fx.size(); i++) + writeDatablockID(stream, fx[i], packed); +} + +void afxPhraseEffectData::unpack_fx(BitStream* stream, afxEffectList& fx) +{ + fx.clear(); + S32 n_fx = stream->readInt(EFFECTS_PER_PHRASE_BITS); + for (int i = 0; i < n_fx; i++) + fx.push_back((afxEffectWrapperData*)readDatablockID(stream)); +} + +void afxPhraseEffectData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(duration); + stream->write(n_loops); + stream->write(trigger_mask); + stream->writeInt(match_type, 1); + stream->writeInt(match_state, 2); + stream->writeInt(phrase_type, 1); + + stream->writeFlag(no_choreographer_trigs); + stream->writeFlag(no_cons_trigs); + stream->writeFlag(no_player_trigs); + + stream->writeString(on_trig_cmd); + + pack_fx(stream, fx_list, packed); +} + +void afxPhraseEffectData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&duration); + stream->read(&n_loops); + stream->read(&trigger_mask); + match_type = stream->readInt(1); + match_state = stream->readInt(2); + phrase_type = stream->readInt(1); + + no_choreographer_trigs = stream->readFlag(); + no_cons_trigs = stream->readFlag(); + no_player_trigs = stream->readFlag(); + + on_trig_cmd = stream->readSTString(); + + do_id_convert = true; + unpack_fx(stream, fx_list); +} + +bool afxPhraseEffectData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + // Resolve objects transmitted from server + if (!server) + { + if (do_id_convert) + { + for (S32 i = 0; i < fx_list.size(); i++) + { + SimObjectId db_id = SimObjectId((uintptr_t)fx_list[i]); + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, fx_list[i])) + { + Con::errorf(ConsoleLogEntry::General, + "afxPhraseEffectData::preload() -- bad datablockId: 0x%x", + db_id); + } + } + } + do_id_convert = false; + } + } + + return true; +} + +void afxPhraseEffectData::gather_cons_defs(Vector& defs) +{ + afxConstraintDef::gather_cons_defs(defs, fx_list); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod( afxPhraseEffectData, addEffect, void, ( afxEffectBaseData* effectData ),, + "Add a child effect to a phrase effect datablock. Argument can be an afxEffectWrappperData or an afxEffectGroupData.\n" ) +{ + if (!effectData) + { + Con::errorf("afxPhraseEffectData::addEffect() -- failed to resolve effect datablock."); + return; + } + + object->fx_list.push_back(effectData); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxPhraseEffect.h b/Engine/source/afx/ce/afxPhraseEffect.h new file mode 100644 index 000000000..ad189d787 --- /dev/null +++ b/Engine/source/afx/ce/afxPhraseEffect.h @@ -0,0 +1,120 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PHRASE_EFFECT_H_ +#define _AFX_PHRASE_EFFECT_H_ + +#include "console/typeValidators.h" + +#include "afx/ce/afxComponentEffect.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxPhrase.h" + +class afxPhraseEffectData : public GameBaseData, public afxEffectDefs, public afxComponentEffectData +{ + typedef GameBaseData Parent; + + class ewValidator : public TypeValidator + { + U32 id; + public: + ewValidator(U32 id) { this->id = id; } + void validateType(SimObject *object, void *typePtr); + }; + + bool do_id_convert; + +public: + enum MatchType { + MATCH_ANY = 0, + MATCH_ALL = 1 + }; + enum StateType { + STATE_ON = 1, + STATE_OFF = 2, + STATE_ON_AND_OFF = STATE_ON | STATE_OFF + }; + enum PhraseType + { + PHRASE_TRIGGERED = 0, + PHRASE_CONTINUOUS = 1 + }; + +public: + afxEffectList fx_list; + F32 duration; + S32 n_loops; + U32 trigger_mask; + U32 match_type; + U32 match_state; + U32 phrase_type; + + bool no_choreographer_trigs; + bool no_cons_trigs; + bool no_player_trigs; + + StringTableEntry on_trig_cmd; + + afxEffectBaseData* dummy_fx_entry; + +private: + void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); + void unpack_fx(BitStream* stream, afxEffectList& fx); + +public: + /*C*/ afxPhraseEffectData(); + /*C*/ afxPhraseEffectData(const afxPhraseEffectData&, bool = false); + + virtual void reloadReset(); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + virtual void gather_cons_defs(Vector& defs); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxPhraseEffectData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxPhraseEffectData::MatchType afxPhraseEffect_MatchType; +DefineEnumType( afxPhraseEffect_MatchType ); + +typedef afxPhraseEffectData::StateType afxPhraseEffect_StateType; +DefineEnumType( afxPhraseEffect_StateType ); + +typedef afxPhraseEffectData::PhraseType afxPhraseEffect_PhraseType; +DefineEnumType( afxPhraseEffect_PhraseType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PHRASE_EFFECT_H_ diff --git a/Engine/source/afx/ce/afxPhysicalZone.cpp b/Engine/source/afx/ce/afxPhysicalZone.cpp new file mode 100644 index 000000000..2ed7ca6b6 --- /dev/null +++ b/Engine/source/afx/ce/afxPhysicalZone.cpp @@ -0,0 +1,114 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "T3D/physicalZone.h" + +#include "afx/ce/afxPhysicalZone.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPhysicalZoneData + +IMPLEMENT_CO_DATABLOCK_V1(afxPhysicalZoneData); + +ConsoleDocClass( afxPhysicalZoneData, + "@brief A datablock that specifies a PhysicalZone effect.\n\n" + + "A Physical Zone is a Torque effect that applies physical forces to Players and other movable objects that enter a specific " + "region of influence. AFX has enhanced Physical Zones by allowing orientation of vector forces and adding radial forces. " + "AFX has also optimized Physical Zone networking so that they can be constrained to moving objects for a variety of " + "effects including repelling and flying." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxPhysicalZoneData::afxPhysicalZoneData() +{ + mVelocityMod = 1.0f; + mGravityMod = 1.0f; + mAppliedForce.zero(); + mPolyhedron = ST_NULLSTRING; + force_type = PhysicalZone::VECTOR; + orient_force = false; + exclude_cons_obj = false; +} + +afxPhysicalZoneData::afxPhysicalZoneData(const afxPhysicalZoneData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + mVelocityMod = other.mVelocityMod; + mGravityMod = other.mGravityMod; + mAppliedForce = other.mAppliedForce; + mPolyhedron = other.mPolyhedron; + force_type = other.force_type; + orient_force = other.orient_force; + exclude_cons_obj = other.exclude_cons_obj; +} + +#define myOffset(field) Offset(field, afxPhysicalZoneData) + +void afxPhysicalZoneData::initPersistFields() +{ + addField("velocityMod", TypeF32, myOffset(mVelocityMod), + "A multiplier that biases the velocity of an object every tick it is within the " + "zone."); + addField("gravityMod", TypeF32, myOffset(mGravityMod), + "A multiplier that biases the influence of gravity on objects within the zone."); + addField("appliedForce", TypePoint3F, myOffset(mAppliedForce), + "A three-valued vector representing a directional force applied to objects withing " + "the zone."); + addField("polyhedron", TypeString, myOffset(mPolyhedron), + "Floating point values describing the outer bounds of the PhysicalZone's region of " + "influence."); + + addField("forceType", TYPEID(), myOffset(force_type), + "This enumerated attribute defines the type of force used in the PhysicalZone. " + "Possible values: vector, sphere, or cylinder."); + + addField("orientForce", TypeBool, myOffset(orient_force), + "Determines if the force can be oriented by the PhysicalZone's transform matrix."); + addField("excludeConstraintObject", TypeBool, myOffset(exclude_cons_obj), + "When true, an object used as the primary position constraint of a physical-zone " + "effect will not be influenced by the forces of the zone."); + + Parent::initPersistFields(); +} + +void afxPhysicalZoneData::packData(BitStream* stream) +{ + Parent::packData(stream); +} + +void afxPhysicalZoneData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxPhysicalZone.h b/Engine/source/afx/ce/afxPhysicalZone.h new file mode 100644 index 000000000..379e25b12 --- /dev/null +++ b/Engine/source/afx/ce/afxPhysicalZone.h @@ -0,0 +1,65 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PHYSICAL_ZONE_H_ +#define _AFX_PHYSICAL_ZONE_H_ + +#include "T3D/gameBase/gameBase.h" +#include "T3D/trigger.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPhysicalZoneData + +class afxPhysicalZoneData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + F32 mVelocityMod; + F32 mGravityMod; + Point3F mAppliedForce; + StringTableEntry mPolyhedron; + S32 force_type; + bool orient_force; + bool exclude_cons_obj; + +public: + /*C*/ afxPhysicalZoneData(); + /*C*/ afxPhysicalZoneData(const afxPhysicalZoneData&, bool = false); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxPhysicalZoneData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PHYSICAL_ZONE_H_ diff --git a/Engine/source/afx/ce/afxPlayerMovement.cpp b/Engine/source/afx/ce/afxPlayerMovement.cpp new file mode 100644 index 000000000..bd5161cc8 --- /dev/null +++ b/Engine/source/afx/ce/afxPlayerMovement.cpp @@ -0,0 +1,140 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "scene/sceneRenderState.h" +#include "math/mathIO.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxPlayerMovement.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPlayerMovementData + +IMPLEMENT_CO_DATABLOCK_V1(afxPlayerMovementData); + +ConsoleDocClass( afxPlayerMovementData, + "@brief A datablock that specifies a Player Movement effect.\n\n" + + "Player Movement effects are used to directly alter the speed and/or movement direction of Player objects. The Player " + "Movement effect is similar to the Player Puppet effect, but where puppet effects totally take over a Player's transformation " + "using the AFX constraint system, Player Movement effects 'steer' the player using the same mechanisms that allow " + "Player control from mouse and keyboard input. Another difference is that Player Movement effects only influence the " + "server instance of a Player. Puppet effects can influence both the Player's server instance and its client ghosts." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +static Point3F default_movement(F32_MAX, F32_MAX, F32_MAX); + +afxPlayerMovementData::afxPlayerMovementData() +{ + speed_bias = 1.0f; + movement = default_movement; + movement_op = OP_MULTIPLY; +} + +afxPlayerMovementData::afxPlayerMovementData(const afxPlayerMovementData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + speed_bias = other.speed_bias; + movement = other.movement; + movement_op = other.movement_op; +} + +ImplementEnumType( afxPlayerMovement_OpType, "Possible player movement operation types.\n" "@ingroup afxPlayerMovemen\n\n" ) + { afxPlayerMovementData::OP_ADD, "add", "..." }, + { afxPlayerMovementData::OP_MULTIPLY, "multiply", "..." }, + { afxPlayerMovementData::OP_REPLACE, "replace", "..." }, + { afxPlayerMovementData::OP_MULTIPLY, "mult", "..." }, +EndImplementEnumType; + +#define myOffset(field) Offset(field, afxPlayerMovementData) + +void afxPlayerMovementData::initPersistFields() +{ + addField("speedBias", TypeF32, myOffset(speed_bias), + "A floating-point multiplier that scales the constraint Player's movement speed."); + addField("movement", TypePoint3F, myOffset(movement), + ""); + addField("movementOp", TYPEID(), myOffset(movement_op), + "Possible values: add, multiply, or replace."); + + Parent::initPersistFields(); +} + +bool afxPlayerMovementData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxPlayerMovementData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(speed_bias); + if (stream->writeFlag(movement != default_movement)) + { + stream->write(movement.x); + stream->write(movement.y); + stream->write(movement.z); + stream->writeInt(movement_op, OP_BITS); + } +} + +void afxPlayerMovementData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&speed_bias); + if (stream->readFlag()) + { + stream->read(&movement.x); + stream->read(&movement.y); + stream->read(&movement.z); + movement_op = stream->readInt(OP_BITS); + } + else + { + movement = default_movement; + movement_op = OP_MULTIPLY; + } +} + +bool afxPlayerMovementData::hasMovementOverride() +{ + return (movement != default_movement); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxPlayerMovement.h b/Engine/source/afx/ce/afxPlayerMovement.h new file mode 100644 index 000000000..725f388e3 --- /dev/null +++ b/Engine/source/afx/ce/afxPlayerMovement.h @@ -0,0 +1,73 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PLAYER_MOVEMENT_H_ +#define _AFX_PLAYER_MOVEMENT_H_ + +#include "afx/ce/afxComponentEffect.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxConstraint.h" + +class afxPlayerMovementData : public GameBaseData, public afxEffectDefs +{ + typedef GameBaseData Parent; +public: + enum OpType + { + OP_ADD = 0, + OP_MULTIPLY, + OP_REPLACE, + OP_BITS = 2, + }; + +public: + F32 speed_bias; + Point3F movement; + U32 movement_op; + +public: + /*C*/ afxPlayerMovementData(); + /*C*/ afxPlayerMovementData(const afxPlayerMovementData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool hasMovementOverride(); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxPlayerMovementData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxPlayerMovementData::OpType afxPlayerMovement_OpType; +DefineEnumType( afxPlayerMovement_OpType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PLAYER_MOVEMENT_H_ diff --git a/Engine/source/afx/ce/afxPlayerPuppet.cpp b/Engine/source/afx/ce/afxPlayerPuppet.cpp new file mode 100644 index 000000000..b9ec4f090 --- /dev/null +++ b/Engine/source/afx/ce/afxPlayerPuppet.cpp @@ -0,0 +1,122 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "scene/sceneRenderState.h" +#include "math/mathIO.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxPlayerPuppet.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPlayerPuppetData + +IMPLEMENT_CO_DATABLOCK_V1(afxPlayerPuppetData); + +ConsoleDocClass( afxPlayerPuppetData, + "@brief A datablock that specifies a Player Puppet effect.\n\n" + + "Player Puppet effects are defined using the afxPlayerPuppetData datablock and are used to control the movement of " + "Player objects with the AFX constraint system. The Player Puppet effect is similar to the Player Movement effect, but " + "where movement effects 'steer' the player using the same mechanisms that allow Player control from mouse and keyboard " + "input, Player Puppet effects totally take over a Player's transformation using the AFX constraint system." + "\n\n" + + "Player Puppet can be configured to directly move a Player's client ghosts as well as its server instance. When doing this, " + "it is important to keep the general motion of the Player object and its ghosts somewhat consistent. Otherwise, obvious " + "discontinuities in the motion will result when the Player Puppet ends and control is restored to the server Player." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxPlayerPuppetData::afxPlayerPuppetData() +{ + obj_spec = ST_NULLSTRING; + networking = SERVER_ONLY; +} + +afxPlayerPuppetData::afxPlayerPuppetData(const afxPlayerPuppetData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + obj_spec = other.obj_spec; + networking = other.networking; +} + +#define myOffset(field) Offset(field, afxPlayerPuppetData) + +void afxPlayerPuppetData::initPersistFields() +{ + addField("objectSpec", TypeString, myOffset(obj_spec), + "..."); + addField("networking", TypeS8, myOffset(networking), + "..."); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("objectSpec"); + disableFieldSubstitutions("networking"); +} + +bool afxPlayerPuppetData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + bool runs_on_s = ((networking & (SERVER_ONLY | SERVER_AND_CLIENT)) != 0); + bool runs_on_c = ((networking & (CLIENT_ONLY | SERVER_AND_CLIENT)) != 0); + obj_def.parseSpec(obj_spec, runs_on_s, runs_on_c); + + return true; +} + +void afxPlayerPuppetData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(obj_spec); + stream->write(networking); +} + +void afxPlayerPuppetData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + obj_spec = stream->readSTString(); + stream->read(&networking); +} + +void afxPlayerPuppetData::gather_cons_defs(Vector& defs) +{ + if (obj_def.isDefined()) + defs.push_back(obj_def); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxPlayerPuppet.h b/Engine/source/afx/ce/afxPlayerPuppet.h new file mode 100644 index 000000000..ca6624bd9 --- /dev/null +++ b/Engine/source/afx/ce/afxPlayerPuppet.h @@ -0,0 +1,64 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PLAYER_PUPPET_H_ +#define _AFX_PLAYER_PUPPET_H_ + +#include "afx/ce/afxComponentEffect.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxConstraint.h" + +class afxPlayerPuppetData : public GameBaseData, public afxEffectDefs, public afxComponentEffectData +{ + typedef GameBaseData Parent; + +public: + StringTableEntry obj_spec; + afxConstraintDef obj_def; + + U8 networking; + + virtual void gather_cons_defs(Vector& defs); + +public: + /*C*/ afxPlayerPuppetData(); + /*C*/ afxPlayerPuppetData(const afxPlayerPuppetData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxPlayerPuppetData); + DECLARE_CATEGORY("AFX"); +}; + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PLAYER_PUPPET_H_ diff --git a/Engine/source/afx/ce/afxPointLight_T3D.cpp b/Engine/source/afx/ce/afxPointLight_T3D.cpp new file mode 100644 index 000000000..748ecf26c --- /dev/null +++ b/Engine/source/afx/ce/afxPointLight_T3D.cpp @@ -0,0 +1,103 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxPointLight_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxT3DPointLightData + +IMPLEMENT_CO_DATABLOCK_V1(afxT3DPointLightData); + +ConsoleDocClass( afxT3DPointLightData, + "@brief A datablock that specifies a dynamic Point Light effect.\n\n" + + "A Point Light effect that uses the T3D PointLight object. afxT3DPointLightData has the same fields found in PointLight but " + "in a datablock structure." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxT3DPointLightData::afxT3DPointLightData() + : mRadius( 5.0f ) +{ +} + +afxT3DPointLightData::afxT3DPointLightData(const afxT3DPointLightData& other, bool temp_clone) : afxT3DLightBaseData(other, temp_clone) +{ + mRadius = other.mRadius; +} + +// +// NOTE: keep this as consistent as possible with PointLight::initPersistFields() +// +void afxT3DPointLightData::initPersistFields() +{ + addGroup( "Light" ); + + addField( "radius", TypeF32, Offset( mRadius, afxT3DPointLightData ), + "Controls the falloff of the light emission"); + + endGroup( "Light" ); + + // We do the parent fields at the end so that + // they show up that way in the inspector. + Parent::initPersistFields(); + + // Remove the scale field... it's already + // defined by the light radius. + removeField( "scale" ); +} + +bool afxT3DPointLightData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxT3DPointLightData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write( mRadius ); +} + +void afxT3DPointLightData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read( &mRadius ); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxPointLight_T3D.h b/Engine/source/afx/ce/afxPointLight_T3D.h new file mode 100644 index 000000000..0f40ba199 --- /dev/null +++ b/Engine/source/afx/ce/afxPointLight_T3D.h @@ -0,0 +1,56 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_T3D_POINT_LIGHT_H_ +#define _AFX_T3D_POINT_LIGHT_H_ + +#include "afx/ce/afxLightBase_T3D.h" + +class afxT3DPointLightData : public afxT3DLightBaseData +{ + typedef afxT3DLightBaseData Parent; + +public: + F32 mRadius; + +public: + /*C*/ afxT3DPointLightData(); + /*C*/ afxT3DPointLightData(const afxT3DPointLightData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxT3DPointLightData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_T3D_POINT_LIGHT_H_ diff --git a/Engine/source/afx/ce/afxProjectile.cpp b/Engine/source/afx/ce/afxProjectile.cpp new file mode 100644 index 000000000..581e16d3c --- /dev/null +++ b/Engine/source/afx/ce/afxProjectile.cpp @@ -0,0 +1,371 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "T3D/shapeBase.h" + +#include "afx/ce/afxProjectile.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxProjectileData + +IMPLEMENT_CO_DATABLOCK_V1(afxProjectileData); + +ConsoleDocClass( afxProjectileData, + "@brief A datablock that specifies a Projectile effect.\n\n" + + "afxProjectileData inherits from ProjectileData and adds some AFX specific fields." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxProjectileData::afxProjectileData() +{ + networking = GHOSTABLE; + launch_pos_spec = ST_NULLSTRING; + launch_dir_bias.zero(); + ignore_src_timeout = false; + dynamicCollisionMask = 0; + staticCollisionMask = 0; + override_collision_masks = false; + launch_dir_method = TowardPos2Constraint; +} + +afxProjectileData::afxProjectileData(const afxProjectileData& other, bool temp_clone) : ProjectileData(other, temp_clone) +{ + networking = other.networking; + launch_pos_spec = other.launch_pos_spec; + launch_pos_def = other.launch_pos_def; + launch_dir_bias = other.launch_dir_bias; + ignore_src_timeout = other.ignore_src_timeout; + dynamicCollisionMask = other.dynamicCollisionMask; + staticCollisionMask = other.staticCollisionMask; + override_collision_masks = other.override_collision_masks; + launch_dir_method = other.launch_dir_method; +} + +ImplementEnumType( afxProjectile_LaunchDirType, "Possible projectile launch direction types.\n" "@ingroup afxProjectile\n\n" ) + { afxProjectileData::TowardPos2Constraint, "towardPos2Constraint", "..." }, + { afxProjectileData::OrientConstraint, "orientConstraint", "..." }, + { afxProjectileData::LaunchDirField, "launchDirField", "..." }, +EndImplementEnumType; + +#define myOffset(field) Offset(field, afxProjectileData) + +void afxProjectileData::initPersistFields() +{ + addField("networking", TypeS8, myOffset(networking), + "..."); + addField("launchPosSpec", TypeString, myOffset(launch_pos_spec), + "..."); + addField("launchDirBias", TypePoint3F, myOffset(launch_dir_bias), + "..."); + addField("ignoreSourceTimeout", TypeBool, myOffset(ignore_src_timeout), + "..."); + addField("dynamicCollisionMask", TypeS32, myOffset(dynamicCollisionMask), + "..."); + addField("staticCollisionMask", TypeS32, myOffset(staticCollisionMask), + "..."); + addField("overrideCollisionMasks", TypeBool, myOffset(override_collision_masks), + "..."); + + addField("launchDirMethod", TYPEID(), myOffset(launch_dir_method), + "Possible values: towardPos2Constraint, orientConstraint, or launchDirField."); + + Parent::initPersistFields(); +} + +bool afxProjectileData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + bool runs_on_s = ((networking & (SERVER_ONLY | SERVER_AND_CLIENT)) != 0); + bool runs_on_c = ((networking & (CLIENT_ONLY | SERVER_AND_CLIENT)) != 0); + launch_pos_def.parseSpec(launch_pos_spec, runs_on_s, runs_on_c); + + return true; +} + +void afxProjectileData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(networking); + stream->writeString(launch_pos_spec); + if (stream->writeFlag(!launch_dir_bias.isZero())) + { + stream->write(launch_dir_bias.x); + stream->write(launch_dir_bias.y); + stream->write(launch_dir_bias.z); + } + stream->writeFlag(ignore_src_timeout); + if (stream->writeFlag(override_collision_masks)) + { + stream->write(dynamicCollisionMask); + stream->write(staticCollisionMask); + } + + stream->writeInt(launch_dir_method, 2); +} + +void afxProjectileData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&networking); + launch_pos_spec = stream->readSTString(); + if (stream->readFlag()) + { + stream->read(&launch_dir_bias.x); + stream->read(&launch_dir_bias.y); + stream->read(&launch_dir_bias.z); + } + else + launch_dir_bias.zero(); + ignore_src_timeout = stream->readFlag(); + if ((override_collision_masks = stream->readFlag()) == true) + { + stream->read(&dynamicCollisionMask); + stream->read(&staticCollisionMask); + } + else + { + dynamicCollisionMask = 0; + staticCollisionMask = 0; + } + + launch_dir_method = (U32) stream->readInt(2); +} + +void afxProjectileData::gather_cons_defs(Vector& defs) +{ + if (launch_pos_def.isDefined()) + defs.push_back(launch_pos_def); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxProjectile + +IMPLEMENT_CO_NETOBJECT_V1(afxProjectile); + +ConsoleDocClass( afxProjectile, + "@brief A Projectile effect as defined by an afxProjectileData datablock.\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" +); + +afxProjectile::afxProjectile() +{ + chor_id = 0; + hookup_with_chor = false; + ghost_cons_name = ST_NULLSTRING; + client_only = false; +} + +afxProjectile::afxProjectile(U32 networking, U32 chor_id, StringTableEntry cons_name) +{ + if (networking & SCOPE_ALWAYS) + { + mNetFlags.clear(); + mNetFlags.set(Ghostable | ScopeAlways); + client_only = false; + } + else if (networking & GHOSTABLE) + { + mNetFlags.clear(); + mNetFlags.set(Ghostable); + client_only = false; + } + else if (networking & SERVER_ONLY) + { + mNetFlags.clear(); + client_only = false; + } + else // if (networking & CLIENT_ONLY) + { + mNetFlags.clear(); + mNetFlags.set(IsGhost); + client_only = true; + } + + this->chor_id = chor_id; + hookup_with_chor = false; + this->ghost_cons_name = cons_name; +} + +afxProjectile::~afxProjectile() +{ +} + +void afxProjectile::init(Point3F& pos, Point3F& vel, ShapeBase* src_obj) +{ + mCurrPosition = pos; + mCurrVelocity = vel; + if (src_obj) + { + mSourceObject = src_obj; + mSourceObjectId = src_obj->getId(); + mSourceObjectSlot = 0; + } + + setPosition(mCurrPosition); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxProjectile::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + return Parent::onNewDataBlock(dptr, reload); +} + +void afxProjectile::processTick(const Move* move) +{ + // note: this deletion test must occur before calling to the parent's + // processTick() because if this is a server projectile, the parent + // might decide to delete it and then client_only will no longer be + // valid after the return. + bool do_delete = (client_only && mCurrTick >= mDataBlock->lifetime); + + Parent::processTick(move); + + if (do_delete) + deleteObject(); +} + +void afxProjectile::interpolateTick(F32 delta) +{ + if (client_only) + return; + + Parent::interpolateTick(delta); +} + +void afxProjectile::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + if (hookup_with_chor) + { + afxChoreographer* chor = arcaneFX::findClientChoreographer(chor_id); + if (chor) + { + chor->setGhostConstraintObject(this, ghost_cons_name); + hookup_with_chor = false; + } + } +} + +bool afxProjectile::onAdd() +{ + if(!Parent::onAdd()) + return false; + + if (isClientObject()) + { + // add to client side mission cleanup + SimGroup *cleanup = dynamic_cast( Sim::findObject( "ClientMissionCleanup") ); + if( cleanup != NULL ) + { + cleanup->addObject( this ); + } + else + { + AssertFatal( false, "Error, could not find ClientMissionCleanup group" ); + return false; + } + } + + return true; +} + +void afxProjectile::onRemove() +{ + Parent::onRemove(); +} + +//~~~~~~~~~~~~~~~~~~~~ + +U32 afxProjectile::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) +{ + U32 retMask = Parent::packUpdate(conn, mask, stream); + + // InitialUpdate + if (stream->writeFlag(mask & InitialUpdateMask)) + { + stream->write(chor_id); + stream->writeString(ghost_cons_name); + } + + return retMask; +} + +//~~~~~~~~~~~~~~~~~~~~// + +void afxProjectile::unpackUpdate(NetConnection * conn, BitStream * stream) +{ + Parent::unpackUpdate(conn, stream); + + // InitialUpdate + if (stream->readFlag()) + { + stream->read(&chor_id); + ghost_cons_name = stream->readSTString(); + + if (chor_id != 0 && ghost_cons_name != ST_NULLSTRING) + hookup_with_chor = true; + } +} + +class afxProjectileDeleteEvent : public SimEvent +{ +public: + void process(SimObject *object) + { + object->deleteObject(); + } +}; + +void afxProjectile::explode(const Point3F& p, const Point3F& n, const U32 collideType) +{ + // Make sure we don't explode twice... + if ( isHidden() ) + return; + + Parent::explode(p, n, collideType); + + if (isClientObject() && client_only) + Sim::postEvent(this, new afxProjectileDeleteEvent, Sim::getCurrentTime() + DeleteWaitTime); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxProjectile.h b/Engine/source/afx/ce/afxProjectile.h new file mode 100644 index 000000000..74609a4d3 --- /dev/null +++ b/Engine/source/afx/ce/afxProjectile.h @@ -0,0 +1,117 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PROJECTILE_H_ +#define _AFX_PROJECTILE_H_ + +#include "lighting/lightInfo.h" +#include "T3D/projectile.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxConstraint.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxProjectileData + +class afxProjectileData : public ProjectileData, public afxEffectDefs +{ + typedef ProjectileData Parent; + +public: + enum LaunchDirType { + TowardPos2Constraint, + OrientConstraint, + LaunchDirField + }; + +public: + U8 networking; + StringTableEntry launch_pos_spec; + afxConstraintDef launch_pos_def; + Point3F launch_dir_bias; + bool ignore_src_timeout; + U32 dynamicCollisionMask; + U32 staticCollisionMask; + bool override_collision_masks; + U32 launch_dir_method; + + virtual void gather_cons_defs(Vector& defs); + +public: + /*C*/ afxProjectileData(); + /*C*/ afxProjectileData(const afxProjectileData&, bool = false); + + virtual bool onAdd(); + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxProjectileData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxProjectileData::LaunchDirType afxProjectile_LaunchDirType; +DefineEnumType( afxProjectile_LaunchDirType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxProjectile + +class afxProjectile : public Projectile, public afxEffectDefs +{ + typedef Projectile Parent; + +private: + U32 chor_id; + bool hookup_with_chor; + StringTableEntry ghost_cons_name; + bool client_only; + +public: + /*C*/ afxProjectile(); + /*C*/ afxProjectile(U32 networking, U32 chor_id, StringTableEntry cons_name); + /*D*/ ~afxProjectile(); + + void init(Point3F& pos, Point3F& vel, ShapeBase* src_obj); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual void processTick(const Move *move); + virtual void interpolateTick(F32 delta); + virtual void advanceTime(F32 dt); + virtual bool onAdd(); + virtual void onRemove(); + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + virtual void explode(const Point3F& p, const Point3F& n, const U32 collideType); + + DECLARE_CONOBJECT(afxProjectile); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PROJECTILE_H_ diff --git a/Engine/source/afx/ce/afxScriptEvent.cpp b/Engine/source/afx/ce/afxScriptEvent.cpp new file mode 100644 index 000000000..762652119 --- /dev/null +++ b/Engine/source/afx/ce/afxScriptEvent.cpp @@ -0,0 +1,94 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxScriptEvent.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxScriptEventData + +IMPLEMENT_CO_DATABLOCK_V1(afxScriptEventData); + +ConsoleDocClass( afxScriptEventData, + "@brief A datablock that specifies a Script Event effect.\n\n" + + "Arbitrary script functions can be called as an AFX effect using afxScriptEventData. They are useful for implementing " + "high-level scripted side-effects such as character resurrection or teleportation." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxScriptEventData::afxScriptEventData() +{ + method_name = ST_NULLSTRING; + script_data = ST_NULLSTRING; +} + +afxScriptEventData::afxScriptEventData(const afxScriptEventData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + method_name = other.method_name; + script_data = other.script_data; +} + +#define myOffset(field) Offset(field, afxScriptEventData) + +void afxScriptEventData::initPersistFields() +{ + addField("methodName", TypeString, myOffset(method_name), + "The name of a script method defined for the instance class of an effects " + "choreographer. The arguments used to call this method are determined by the type " + "of choreographer."); + addField("scriptData", TypeString, myOffset(script_data), + "An arbitrary blind data value which is passed in as an argument of the script event " + "method. The value of scriptData can be used to differentiate uses when handling " + "different script event effects with a single method."); + + Parent::initPersistFields(); +} + +void afxScriptEventData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(method_name); + stream->writeString(script_data); +} + +void afxScriptEventData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + method_name = stream->readSTString(); + script_data = stream->readSTString(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxScriptEvent.h b/Engine/source/afx/ce/afxScriptEvent.h new file mode 100644 index 000000000..234e50cf3 --- /dev/null +++ b/Engine/source/afx/ce/afxScriptEvent.h @@ -0,0 +1,57 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_SCRIPT_EVENT_H_ +#define _AFX_SCRIPT_EVENT_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxScriptEventData + +struct afxScriptEventData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + StringTableEntry method_name; + StringTableEntry script_data; + +public: + /*C*/ afxScriptEventData(); + /*C*/ afxScriptEventData(const afxScriptEventData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxScriptEventData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_SCRIPT_EVENT_H_ diff --git a/Engine/source/afx/ce/afxSpotLight_T3D.cpp b/Engine/source/afx/ce/afxSpotLight_T3D.cpp new file mode 100644 index 000000000..aa21e50a5 --- /dev/null +++ b/Engine/source/afx/ce/afxSpotLight_T3D.cpp @@ -0,0 +1,112 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" + +#include "afx/ce/afxSpotLight_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxT3DSpotLightData + +IMPLEMENT_CO_DATABLOCK_V1(afxT3DSpotLightData); + +ConsoleDocClass( afxT3DSpotLightData, + "@brief A datablock that specifies a dynamic Spot Light effect.\n\n" + + "A Spot Light effect that uses the T3D SpotLight object. afxT3DSpotLightData has the same fields found in SpotLight but in " + "a datablock structure." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxT3DSpotLightData::afxT3DSpotLightData() + : mRange( 10.0f ), + mInnerConeAngle( 40.0f ), + mOuterConeAngle( 45.0f ) +{ +} + +afxT3DSpotLightData::afxT3DSpotLightData(const afxT3DSpotLightData& other, bool temp_clone) : afxT3DLightBaseData(other, temp_clone) +{ + mRange = other.mRange; + mInnerConeAngle = other.mInnerConeAngle; + mOuterConeAngle = other.mOuterConeAngle; +} + +// +// NOTE: keep this as consistent as possible with PointLight::initPersistFields() +// +void afxT3DSpotLightData::initPersistFields() +{ + addGroup( "Light" ); + + addField( "range", TypeF32, Offset( mRange, afxT3DSpotLightData ), + "..."); + addField( "innerAngle", TypeF32, Offset( mInnerConeAngle, afxT3DSpotLightData ), + "..."); + addField( "outerAngle", TypeF32, Offset( mOuterConeAngle, afxT3DSpotLightData ), + "..."); + + endGroup( "Light" ); + + // We do the parent fields at the end so that + // they show up that way in the inspector. + Parent::initPersistFields(); +} + +bool afxT3DSpotLightData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxT3DSpotLightData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write( mRange ); + stream->write( mInnerConeAngle ); + stream->write( mOuterConeAngle ); +} + +void afxT3DSpotLightData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read( &mRange ); + stream->read( &mInnerConeAngle ); + stream->read( &mOuterConeAngle ); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxSpotLight_T3D.h b/Engine/source/afx/ce/afxSpotLight_T3D.h new file mode 100644 index 000000000..077850784 --- /dev/null +++ b/Engine/source/afx/ce/afxSpotLight_T3D.h @@ -0,0 +1,58 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_T3D_SPOT_LIGHT_H_ +#define _AFX_T3D_SPOT_LIGHT_H_ + +#include "afx/ce/afxLightBase_T3D.h" + +class afxT3DSpotLightData : public afxT3DLightBaseData +{ + typedef afxT3DLightBaseData Parent; + +public: + F32 mRange; + F32 mInnerConeAngle; + F32 mOuterConeAngle; + +public: + /*C*/ afxT3DSpotLightData(); + /*C*/ afxT3DSpotLightData(const afxT3DSpotLightData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxT3DSpotLightData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_T3D_SPOT_LIGHT_H_ diff --git a/Engine/source/afx/ce/afxStaticShape.cpp b/Engine/source/afx/ce/afxStaticShape.cpp new file mode 100644 index 000000000..5eb4fb815 --- /dev/null +++ b/Engine/source/afx/ce/afxStaticShape.cpp @@ -0,0 +1,241 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "ts/tsShapeInstance.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxStaticShape.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxStaticShapeData + +IMPLEMENT_CO_DATABLOCK_V1(afxStaticShapeData); + +ConsoleDocClass( afxStaticShapeData, + "@brief A datablock that specifies a StaticShape effect.\n\n" + + "afxStaticShapeData inherits from StaticShapeData and adds some AFX specific fields. StaticShape effects should be " + "specified using afxStaticShapeData rather than StaticShapeData datablocks." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxStaticShapeData::afxStaticShapeData() +{ + sequence = ST_NULLSTRING; + ignore_scene_amb = false; + use_custom_scene_amb = false; + custom_scene_amb.set(0.5f, 0.5f, 0.5f); + do_spawn = false; +} + +afxStaticShapeData::afxStaticShapeData(const afxStaticShapeData& other, bool temp_clone) : StaticShapeData(other, temp_clone) +{ + sequence = other.sequence; + ignore_scene_amb = other.ignore_scene_amb; + use_custom_scene_amb = other.use_custom_scene_amb; + custom_scene_amb = other.custom_scene_amb; + do_spawn = other.do_spawn; +} + +#define myOffset(field) Offset(field, afxStaticShapeData) + +void afxStaticShapeData::initPersistFields() +{ + addField("sequence", TypeFilename, myOffset(sequence), + "An animation sequence in the StaticShape to play."); + addField("ignoreSceneAmbient", TypeBool, myOffset(ignore_scene_amb), + "..."); + addField("useCustomSceneAmbient", TypeBool, myOffset(use_custom_scene_amb), + "..."); + addField("customSceneAmbient", TypeColorF, myOffset(custom_scene_amb), + "..."); + addField("doSpawn", TypeBool, myOffset(do_spawn), + "When true, the StaticShape effect will leave behind the StaticShape object as a " + "permanent part of the scene."); + + Parent::initPersistFields(); +} + +void afxStaticShapeData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(sequence); + stream->writeFlag(ignore_scene_amb); + if (stream->writeFlag(use_custom_scene_amb)) + stream->write(custom_scene_amb); + stream->writeFlag(do_spawn); +} + +void afxStaticShapeData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + sequence = stream->readSTString(); + ignore_scene_amb = stream->readFlag(); + if ((use_custom_scene_amb = stream->readFlag()) == true) + stream->read(&custom_scene_amb); + do_spawn = stream->readFlag(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxStaticShape + +IMPLEMENT_CO_NETOBJECT_V1(afxStaticShape); + +ConsoleDocClass( afxStaticShape, + "@brief A StaticShape effect as defined by an afxStaticShapeData datablock.\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" +); + +afxStaticShape::afxStaticShape() +{ + afx_data = 0; + is_visible = true; + chor_id = 0; + hookup_with_chor = false; + ghost_cons_name = ST_NULLSTRING; +} + +afxStaticShape::~afxStaticShape() +{ +} + +void afxStaticShape::init(U32 chor_id, StringTableEntry cons_name) +{ + this->chor_id = chor_id; + ghost_cons_name = cons_name; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxStaticShape::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + afx_data = dynamic_cast(mDataBlock); + + if (!mShapeInstance) + return true; + + const char* seq_name = 0; + + // if datablock is afxStaticShapeData we get the sequence setting + // directly from the datablock on the client-side only + if (afx_data) + { + if (isClientObject()) + seq_name = afx_data->sequence; + } + // otherwise datablock is stock StaticShapeData and we look for + // a sequence name on a dynamic field on the server. + else + { + if (isServerObject()) + seq_name = mDataBlock->getDataField(StringTable->insert("sequence"),0); + } + + // if we have a sequence name, attempt to start a thread + if (seq_name) + { + TSShape* shape = mShapeInstance->getShape(); + if (shape) + { + S32 seq = shape->findSequence(seq_name); + if (seq != -1) + setThreadSequence(0,seq); + } + } + + return true; +} + +void afxStaticShape::advanceTime(F32 dt) +{ + Parent::advanceTime(dt); + + if (hookup_with_chor) + { + afxChoreographer* chor = arcaneFX::findClientChoreographer(chor_id); + if (chor) + { + chor->setGhostConstraintObject(this, ghost_cons_name); + hookup_with_chor = false; + } + } +} + +U32 afxStaticShape::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) +{ + U32 retMask = Parent::packUpdate(conn, mask, stream); + + // InitialUpdate + if (stream->writeFlag(mask & InitialUpdateMask)) + { + stream->write(chor_id); + stream->writeString(ghost_cons_name); + } + + return retMask; +} + +//~~~~~~~~~~~~~~~~~~~~// + +void afxStaticShape::unpackUpdate(NetConnection * conn, BitStream * stream) +{ + Parent::unpackUpdate(conn, stream); + + // InitialUpdate + if (stream->readFlag()) + { + stream->read(&chor_id); + ghost_cons_name = stream->readSTString(); + + if (chor_id != 0 && ghost_cons_name != ST_NULLSTRING) + hookup_with_chor = true; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +void afxStaticShape::prepRenderImage(SceneRenderState* state) +{ + if (is_visible) + Parent::prepRenderImage(state); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxStaticShape.h b/Engine/source/afx/ce/afxStaticShape.h new file mode 100644 index 000000000..ed84e0774 --- /dev/null +++ b/Engine/source/afx/ce/afxStaticShape.h @@ -0,0 +1,98 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_STATIC_SHAPE_H_ +#define _AFX_STATIC_SHAPE_H_ + +#include "T3D/staticShape.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxStaticShapeData + +class afxStaticShapeData : public StaticShapeData +{ + typedef StaticShapeData Parent; + +public: + StringTableEntry sequence; + bool ignore_scene_amb; + bool use_custom_scene_amb; + LinearColorF custom_scene_amb; + bool do_spawn; + +public: + /*C*/ afxStaticShapeData(); + /*C*/ afxStaticShapeData(const afxStaticShapeData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxStaticShapeData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxStaticShape + +class afxStaticShape : public StaticShape +{ + typedef StaticShape Parent; + +private: + StaticShapeData* mDataBlock; + afxStaticShapeData* afx_data; + bool is_visible; + U32 chor_id; + bool hookup_with_chor; + StringTableEntry ghost_cons_name; + +protected: + virtual void prepRenderImage(SceneRenderState*); + +public: + /*C*/ afxStaticShape(); + /*D*/ ~afxStaticShape(); + + void init(U32 chor_id, StringTableEntry cons_name); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual void advanceTime(F32 dt); + virtual U32 packUpdate(NetConnection*, U32, BitStream*); + virtual void unpackUpdate(NetConnection*, BitStream*); + + const char* getShapeFileName() const { return mDataBlock->shapeName; } + void setVisibility(bool flag) { is_visible = flag; } + + DECLARE_CONOBJECT(afxStaticShape); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_STATIC_SHAPE_H_ diff --git a/Engine/source/afx/ce/afxVolumeLight.cpp b/Engine/source/afx/ce/afxVolumeLight.cpp new file mode 100644 index 000000000..ace374935 --- /dev/null +++ b/Engine/source/afx/ce/afxVolumeLight.cpp @@ -0,0 +1,40 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/ce/afxVolumeLight.h" + +IMPLEMENT_CO_DATABLOCK_V1(afxVolumeLightData); + +ConsoleDocClass( afxVolumeLightData, + "@brief afxVolumeLightData is a legacy datablock which is not supported for T3D.\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxVolumeLight.h b/Engine/source/afx/ce/afxVolumeLight.h new file mode 100644 index 000000000..9b56c4f27 --- /dev/null +++ b/Engine/source/afx/ce/afxVolumeLight.h @@ -0,0 +1,38 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_VOLUME_LIGHT_H_ +#define _AFX_VOLUME_LIGHT_H_ + +struct afxVolumeLightData : public GameBaseData +{ + typedef GameBaseData Parent; + DECLARE_CONOBJECT(afxVolumeLightData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_VOLUME_LIGHT_H_ diff --git a/Engine/source/afx/ce/afxZodiac.cpp b/Engine/source/afx/ce/afxZodiac.cpp new file mode 100644 index 000000000..3b1e976d2 --- /dev/null +++ b/Engine/source/afx/ce/afxZodiac.cpp @@ -0,0 +1,418 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "core/frameAllocator.h" +#include "terrain/terrRender.h" +#include "gfx/primBuilder.h" + +#include "afx/ce/afxZodiac.h" + +GFX_ImplementTextureProfile(AFX_GFXZodiacTextureProfile, + GFXTextureProfile::DiffuseMap, + GFXTextureProfile::Static | GFXTextureProfile::NoMipmap | GFXTextureProfile::PreserveSize, + GFXTextureProfile::NONE); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxZodiacData::convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg) +{ + F32 x = mCos(mDegToRad(gradrange_deg.x)); + F32 y = mCos(mDegToRad(gradrange_deg.y)); + if (y > x) + gradrange.set(x, y); + else + gradrange.set(y, x); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxZodiacData + +IMPLEMENT_CO_DATABLOCK_V1(afxZodiacData); + +ConsoleDocClass( afxZodiacData, + "@brief A datablock that specifies a decal-like Zodiac effect.\n\n" + + "Zodiacs are special-purpose decal textures, often circular, that are always projected vertically onto the ground. Parameters " + "control dynamic rotation and scale as well as texture, color, and blending style." + "\n\n" + + "Zodiacs render on objects of type TerrainBlock, InteriorInstance, GroundPlane, MeshRoad, and TSStatic. They are very " + "effective as spellcasting lighting rings, explosion shockwaves, scorched earth decals, and selection indicators." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +StringTableEntry afxZodiacData::GradientRangeSlot; +bool afxZodiacData::sPreferDestinationGradients = false; + +afxZodiacData::afxZodiacData() +{ + txr_name = ST_NULLSTRING; + radius_xy = 1; + vert_range.set(0.0f, 0.0f); + start_ang = 0; + ang_per_sec = 0; + color.set(1,1,1,1); + grow_in_time = 0.0f; + shrink_out_time = 0.0f; + growth_rate = 0.0f; + blend_flags = BLEND_NORMAL; + terrain_ok = true; + interiors_ok = true; + reflected_ok = false; + non_reflected_ok = true; + respect_ori_cons = false; + scale_vert_range = true; + + interior_h_only = false; + interior_v_ignore = false; + interior_back_ignore = false; + interior_opaque_ignore = false; + interior_transp_ignore = true; + + altitude_max = 0.0f; + altitude_falloff = 0.0f; + altitude_shrinks = false; + altitude_fades = false; + + distance_max = 75.0f; + distance_falloff = 30.0f; + + use_grade_range = false; + prefer_dest_grade = sPreferDestinationGradients; + grade_range_user.set(0.0f, 45.0f); + afxZodiacData::convertGradientRangeFromDegrees(grade_range, grade_range_user); + inv_grade_range = false; +} + +afxZodiacData::afxZodiacData(const afxZodiacData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + txr_name = other.txr_name; + txr = other.txr; + radius_xy = other.radius_xy; + vert_range = other.vert_range; + start_ang = other.start_ang; + ang_per_sec = other.ang_per_sec; + grow_in_time = other.grow_in_time; + shrink_out_time = other.shrink_out_time; + growth_rate = other.growth_rate; + color = other.color; + + altitude_max = other.altitude_max; + altitude_falloff = other.altitude_falloff; + altitude_shrinks = other.altitude_shrinks; + altitude_fades = other.altitude_fades; + + distance_max = other.distance_max; + distance_falloff = other.distance_falloff; + + use_grade_range = other.use_grade_range; + prefer_dest_grade = other.prefer_dest_grade; + grade_range = other.grade_range; + inv_grade_range = other.inv_grade_range; + + zflags = other.zflags; + expand_zflags(); +} + +ImplementEnumType( afxZodiac_BlendType, "Possible zodiac blend types.\n" "@ingroup afxZodiac\n\n" ) + { afxZodiacData::BLEND_NORMAL, "normal", "..." }, + { afxZodiacData::BLEND_ADDITIVE, "additive", "..." }, + { afxZodiacData::BLEND_SUBTRACTIVE, "subtractive", "..." }, +EndImplementEnumType; + +void afxZodiacData::initPersistFields() +{ + addField("texture", TypeFilename, Offset(txr_name, afxZodiacData), + "An image to use as the zodiac's texture."); + addField("radius", TypeF32, Offset(radius_xy, afxZodiacData), + "The zodiac's radius in scene units."); + addField("verticalRange", TypePoint2F, Offset(vert_range, afxZodiacData), + "For interior zodiacs only, verticalRange specifies distances above and below the " + "zodiac's position. If both values are 0.0, the radius is used."); + addField("scaleVerticalRange", TypeBool, Offset(scale_vert_range, afxZodiacData), + "Specifies if the zodiac's verticalRange should scale according to changes in the " + "radius. When a zodiacs is used as an expanding shockwave, this value should be set " + "to false, otherwise the zodiac can expand to cover an entire interior."); + addField("startAngle", TypeF32, Offset(start_ang, afxZodiacData), + "The starting angle in degrees of the zodiac's rotation."); + addField("rotationRate", TypeF32, Offset(ang_per_sec, afxZodiacData), + "The rate of rotation in degrees-per-second. Zodiacs with a positive rotationRate " + "rotate clockwise, while those with negative values turn counter-clockwise."); + addField("growInTime", TypeF32, Offset(grow_in_time, afxZodiacData), + "A duration of time in seconds over which the zodiac grows from a zero size to its " + "full size as specified by the radius."); + addField("shrinkOutTime", TypeF32, Offset(shrink_out_time, afxZodiacData), + "A duration of time in seconds over which the zodiac shrinks from full size to " + "invisible."); + addField("growthRate", TypeF32, Offset(growth_rate, afxZodiacData), + "A rate in meters-per-second at which the zodiac grows in size. A negative value will " + "shrink the zodiac."); + addField("color", TypeColorF, Offset(color, afxZodiacData), + "A color value for the zodiac."); + + addField("blend", TYPEID(), Offset(blend_flags, afxZodiacData), + "A blending style for the zodiac. Possible values: normal, additive, or subtractive."); + + addField("showOnTerrain", TypeBool, Offset(terrain_ok, afxZodiacData), + "Specifies if the zodiac should be rendered on terrain or terrain-like surfaces."); + addField("showOnInteriors", TypeBool, Offset(interiors_ok, afxZodiacData), + "Specifies if the zodiac should be rendered on interior or interior-like surfaces."); + addField("showInReflections", TypeBool, Offset(reflected_ok, afxZodiacData), + "Specifies if the zodiac should be rendered on the reflection rendering pass of the " + "object it will be projected onto."); + addField("showInNonReflections", TypeBool, Offset(non_reflected_ok, afxZodiacData), + "Specifies if the zodiac should be rendered on the non-reflection rendering pass of " + "the object it will be projected onto."); + addField("trackOrientConstraint", TypeBool, Offset(respect_ori_cons, afxZodiacData), + "Specifies if the zodiac's rotation should be defined by its constrained " + "transformation."); + + addField("interiorHorizontalOnly", TypeBool, Offset(interior_h_only, afxZodiacData), + "Specifies if interior zodiacs should be rendered exclusively on perfectly horizontal " + "interior surfaces."); + addField("interiorIgnoreVertical", TypeBool, Offset(interior_v_ignore, afxZodiacData), + "Specifies if interior zodiacs should not be rendered on perfectly vertical interior " + "surfaces."); + addField("interiorIgnoreBackfaces", TypeBool, Offset(interior_back_ignore, afxZodiacData), + "Specifies if interior zodiacs should not be rendered on interior surface which are " + "backfacing to the zodiac's center."); + addField("interiorIgnoreOpaque", TypeBool, Offset(interior_opaque_ignore, afxZodiacData), + ""); + addField("interiorIgnoreTransparent", TypeBool, Offset(interior_transp_ignore, afxZodiacData), + ""); + + addField("altitudeMax", TypeF32, Offset(altitude_max, afxZodiacData), + "The altitude at which zodiac becomes invisible as the result of fading out or " + "becoming too small."); + addField("altitudeFalloff", TypeF32, Offset(altitude_falloff, afxZodiacData), + "The altitude at which zodiac begins to fade and/or shrink."); + addField("altitudeShrinks", TypeBool, Offset(altitude_shrinks, afxZodiacData), + "When true, zodiac becomes smaller as altitude increases."); + addField("altitudeFades", TypeBool, Offset(altitude_fades, afxZodiacData), + "When true, zodiac fades out as altitude increases."); + + addField("distanceMax", TypeF32, Offset(distance_max, afxZodiacData), + "The distance from camera at which the zodiac becomes invisible as the result of " + "fading out."); + addField("distanceFalloff", TypeF32, Offset(distance_falloff, afxZodiacData), + "The distance from camera at which the zodiac begins to fade out."); + + addField("useGradientRange", TypeBool, Offset(use_grade_range, afxZodiacData), + "When true, gradientRange will be used to determine on which polygons the zodiac will " + "render."); + addField("preferDestinationGradients", TypeBool, Offset(prefer_dest_grade, afxZodiacData), + "When true, a gradientRange specified on an InteriorInstance or TSStatic will be used " + "instead of the zodiac's gradientRange."); + addField("gradientRange", TypePoint2F, Offset(grade_range_user, afxZodiacData), + "Zodiac will render on polygons with gradients within the range specified by " + "gradientRange. 0 for floor polys, 90 for wall polys, 180 for ceiling polys."); + addField("invertGradientRange", TypeBool, Offset(inv_grade_range, afxZodiacData), + "When true, the zodiac will render on polygons with gradients outside of the range " + "specified by gradientRange."); + + Parent::initPersistFields(); + + GradientRangeSlot = StringTable->lookup("gradientRange"); + Con::addVariable("pref::afxZodiac::preferDestinationGradients", TypeBool, &sPreferDestinationGradients); +} + +bool afxZodiacData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + if (altitude_falloff > altitude_max) + altitude_falloff = altitude_max; + + if (distance_falloff > distance_max) + distance_falloff = distance_max; + + return true; +} + +void afxZodiacData::packData(BitStream* stream) +{ + Parent::packData(stream); + + merge_zflags(); + + stream->writeString(txr_name); + stream->write(radius_xy); + stream->write(vert_range.x); + stream->write(vert_range.y); + stream->write(grade_range.x); + stream->write(grade_range.y); + stream->write(start_ang); + stream->write(ang_per_sec); + stream->write(grow_in_time); + stream->write(shrink_out_time); + stream->write(growth_rate); + stream->write(color); + stream->write(zflags); + stream->write(altitude_max); + stream->write(altitude_falloff); + stream->writeFlag(altitude_shrinks); + stream->writeFlag(altitude_fades); + stream->write(distance_max); + stream->write(distance_falloff); +} + +void afxZodiacData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + txr_name = stream->readSTString(); + txr = GFXTexHandle(); + stream->read(&radius_xy); + stream->read(&vert_range.x); + stream->read(&vert_range.y); + stream->read(&grade_range.x); + stream->read(&grade_range.y); + stream->read(&start_ang); + stream->read(&ang_per_sec); + stream->read(&grow_in_time); + stream->read(&shrink_out_time); + stream->read(&growth_rate); + stream->read(&color); + stream->read(&zflags); + stream->read(&altitude_max); + stream->read(&altitude_falloff); + altitude_shrinks = stream->readFlag(); + altitude_fades = stream->readFlag(); + stream->read(&distance_max); + stream->read(&distance_falloff); + + expand_zflags(); +} + +bool afxZodiacData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + if (!server) + { + if (txr_name && txr_name[0] != '\0') + { + txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); + } + } + + if (vert_range.x == 0.0f && vert_range.y == 0.0f) + vert_range.x = vert_range.y = radius_xy; + + return true; +} + +void afxZodiacData::onStaticModified(const char* slot, const char* newValue) +{ + Parent::onStaticModified(slot, newValue); + if (slot == GradientRangeSlot) + { + convertGradientRangeFromDegrees(grade_range, grade_range_user); + return; + } + merge_zflags(); +} + +void afxZodiacData::onPerformSubstitutions() +{ + if (txr_name && txr_name[0] != '\0') + { + txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); + } +} + +F32 afxZodiacData::calcRotationAngle(F32 elapsed, F32 rate_factor) +{ + F32 angle = start_ang + elapsed*ang_per_sec*rate_factor; + angle = mFmod(angle, 360.0f); + + return angle; +} + +void afxZodiacData::expand_zflags() +{ + blend_flags = (zflags & BLEND_MASK); + terrain_ok = ((zflags & SHOW_ON_TERRAIN) != 0); + interiors_ok = ((zflags & SHOW_ON_INTERIORS) != 0); + reflected_ok = ((zflags & SHOW_IN_REFLECTIONS) != 0); + non_reflected_ok = ((zflags & SHOW_IN_NON_REFLECTIONS) != 0); + respect_ori_cons = ((zflags & RESPECT_ORIENTATION) != 0); + scale_vert_range = ((zflags & SCALE_VERT_RANGE) != 0); + interior_h_only = ((zflags & INTERIOR_HORIZ_ONLY) != 0); + interior_v_ignore = ((zflags & INTERIOR_VERT_IGNORE) != 0); + interior_back_ignore = ((zflags & INTERIOR_BACK_IGNORE) != 0); + interior_opaque_ignore = ((zflags & INTERIOR_OPAQUE_IGNORE) != 0); + interior_transp_ignore = ((zflags & INTERIOR_TRANSP_IGNORE) != 0); + use_grade_range = ((zflags & USE_GRADE_RANGE) != 0); + prefer_dest_grade = ((zflags & PREFER_DEST_GRADE) != 0); + inv_grade_range = ((zflags & INVERT_GRADE_RANGE) != 0); +} + +void afxZodiacData::merge_zflags() +{ + zflags = (blend_flags & BLEND_MASK); + if (terrain_ok) + zflags |= SHOW_ON_TERRAIN; + if (interiors_ok) + zflags |= SHOW_ON_INTERIORS; + if (reflected_ok) + zflags |= SHOW_IN_REFLECTIONS; + if (non_reflected_ok) + zflags |= SHOW_IN_NON_REFLECTIONS; + if (respect_ori_cons) + zflags |= RESPECT_ORIENTATION; + if (scale_vert_range) + zflags |= SCALE_VERT_RANGE; + if (interior_h_only) + zflags |= INTERIOR_HORIZ_ONLY; + if (interior_v_ignore) + zflags |= INTERIOR_VERT_IGNORE; + if (interior_back_ignore) + zflags |= INTERIOR_BACK_IGNORE; + if (interior_opaque_ignore) + zflags |= INTERIOR_OPAQUE_IGNORE; + if (interior_transp_ignore) + zflags |= INTERIOR_TRANSP_IGNORE; + if (use_grade_range) + zflags |= USE_GRADE_RANGE; + if (prefer_dest_grade) + zflags |= PREFER_DEST_GRADE; + if (inv_grade_range) + zflags |= INVERT_GRADE_RANGE; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxZodiac.h b/Engine/source/afx/ce/afxZodiac.h new file mode 100644 index 000000000..c6adb7625 --- /dev/null +++ b/Engine/source/afx/ce/afxZodiac.h @@ -0,0 +1,132 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_H_ +#define _AFX_ZODIAC_H_ + +#ifndef _ARCANE_FX_H_ +#include "afx/arcaneFX.h" +#endif +#ifndef _AFX_ZODIAC_DEFS_H_ +#include "afx/ce/afxZodiacDefs.h" +#endif + +#include "console/typeValidators.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxZodiacData + +class afxZodiacData : public GameBaseData, public afxZodiacDefs +{ + typedef GameBaseData Parent; + +public: + enum BlendType + { + BLEND_NORMAL = 0x0, + BLEND_ADDITIVE = 0x1, + BLEND_SUBTRACTIVE = 0x2, + BLEND_RESERVED = 0x3, + BLEND_MASK = 0x3 + }; + + static void convertGradientRangeFromDegrees(Point2F& gradrange, const Point2F& gradrange_deg); + +public: + StringTableEntry txr_name; + GFXTexHandle txr; + F32 radius_xy; + Point2F vert_range; + F32 start_ang; + F32 ang_per_sec; + F32 grow_in_time; + F32 shrink_out_time; + F32 growth_rate; + LinearColorF color; + U32 blend_flags; + bool terrain_ok; + bool interiors_ok; + bool reflected_ok; + bool non_reflected_ok; + bool respect_ori_cons; + bool scale_vert_range; + bool interior_h_only; + bool interior_v_ignore; + bool interior_back_ignore; + bool interior_opaque_ignore; + bool interior_transp_ignore; + U32 zflags; + + F32 altitude_max; + F32 altitude_falloff; + bool altitude_shrinks; + bool altitude_fades; + + F32 distance_max; + F32 distance_falloff; + + bool use_grade_range; + bool prefer_dest_grade; + Point2F grade_range_user; + Point2F grade_range; + bool inv_grade_range; + + static StringTableEntry GradientRangeSlot; + static bool sPreferDestinationGradients; + + void expand_zflags(); + void merge_zflags(); + +public: + /*C*/ afxZodiacData(); + /*C*/ afxZodiacData(const afxZodiacData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + virtual void onStaticModified(const char* slotName, const char* newValue = NULL); + + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } + + F32 calcRotationAngle(F32 elapsed, F32 rate_factor=1.0f); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxZodiacData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxZodiacData::BlendType afxZodiac_BlendType; +DefineEnumType( afxZodiac_BlendType ); + +GFX_DeclareTextureProfile(AFX_GFXZodiacTextureProfile); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_H_ diff --git a/Engine/source/afx/ce/afxZodiacDefs.h b/Engine/source/afx/ce/afxZodiacDefs.h new file mode 100644 index 000000000..1222ca69e --- /dev/null +++ b/Engine/source/afx/ce/afxZodiacDefs.h @@ -0,0 +1,163 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_DEFS_H_ +#define _AFX_ZODIAC_DEFS_H_ + +class afxZodiacDefs +{ +public: + enum + { + MAX_ZODIACS = 256, + N_ZODIAC_FIELD_INTS = (MAX_ZODIACS - 1) / 32 + 1, + }; + + enum + { + BLEND_NORMAL = 0x0, + BLEND_ADDITIVE = 0x1, + BLEND_SUBTRACTIVE = 0x2, + BLEND_RESERVED = 0x3, + BLEND_MASK = 0x3 + }; + + enum + { + SHOW_ON_TERRAIN = BIT(2), + SHOW_ON_INTERIORS = BIT(3), + SHOW_ON_WATER = BIT(4), + SHOW_ON_MODELS = BIT(5), + // + SHOW_IN_NON_REFLECTIONS = BIT(6), + SHOW_IN_REFLECTIONS = BIT(7), + // + RESPECT_ORIENTATION = BIT(8), + SCALE_VERT_RANGE = BIT(9), + INVERT_GRADE_RANGE = BIT(10), + USE_GRADE_RANGE = BIT(11), + PREFER_DEST_GRADE = BIT(12), + // + INTERIOR_VERT_IGNORE = BIT(13), + INTERIOR_HORIZ_ONLY = BIT(14), + INTERIOR_BACK_IGNORE = BIT(15), + INTERIOR_OPAQUE_IGNORE = BIT(16), + INTERIOR_TRANSP_IGNORE = BIT(17), + // + INTERIOR_FILTERS = INTERIOR_VERT_IGNORE | INTERIOR_HORIZ_ONLY | INTERIOR_BACK_IGNORE + }; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxZodiacBitmask : public afxZodiacDefs +{ + U32 mBits[N_ZODIAC_FIELD_INTS]; + +public: + afxZodiacBitmask() { clear(); } + afxZodiacBitmask(const afxZodiacBitmask& field) { *this = field; } + + bool test(U32 index) + { + U32 word = index / 32; + U32 bit = index % 32; + return mBits[word] & (1 << bit); + } + + void set(U32 index) + { + U32 word = index / 32; + U32 bit = index % 32; + mBits[word] |= 1 << bit; + } + + void unset(U32 index) + { + U32 word = index / 32; + U32 bit = index % 32; + mBits[word] &= ~(1 << bit); + } + + S32 findLastSetBit(U32 startbit=(MAX_ZODIACS-1)) + { + U32 word = startbit / 32; + U32 bit = startbit % 32; + + if (mBits[word] != 0) + { + U32 mask = mBits[word] << (31-bit); + for (U32 j = bit; j >= 0; j--) + { + if (mask & 0x80000000) + return word*32 + j; + mask <<= 1; + } + } + + for (U32 k = word-1; k >= 0; k--) + { + if (mBits[k] != 0) + { + U32 mask = mBits[k]; + for (U32 j = 31; j >= 0; j--) + { + if (mask & 0x80000000) + return k*32 + j; + mask <<= 1; + } + } + } + + return -1; + } + + void clear() + { + for (U32 k = 0; k < N_ZODIAC_FIELD_INTS; k++) + mBits[k] = 0x00000000; + } + + bool isEmpty() + { + for (U32 k = 0; k < N_ZODIAC_FIELD_INTS; k++) + if (mBits[k] != 0) + return false; + return true; + } + + afxZodiacBitmask& operator=(const afxZodiacBitmask& field) + { + for (U32 k = 0; k < N_ZODIAC_FIELD_INTS; k++) + mBits[k] = field.mBits[k]; + return *this; + } + + operator bool() { return !isEmpty(); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_DEFS_H_ diff --git a/Engine/source/afx/ce/afxZodiacMgr.cpp b/Engine/source/afx/ce/afxZodiacMgr.cpp new file mode 100644 index 000000000..abc8c38e2 --- /dev/null +++ b/Engine/source/afx/ce/afxZodiacMgr.cpp @@ -0,0 +1,131 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "terrain/terrRender.h" + +#include "afx/ce/afxZodiac.h" +#include "afx/ce/afxZodiacMgr.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxZodiacMgr + +Vector afxZodiacMgr::terr_zodes; +Vector afxZodiacMgr::inter_zodes; + +afxZodiacMgr::ZodiacTriangle* afxZodiacMgr::zode_tris_head = NULL; +afxZodiacMgr::ZodiacTriangle* afxZodiacMgr::zode_tris_tail = NULL; +afxZodiacMgr::ZodiacTriangle* afxZodiacMgr::zode_tris = NULL; +U32 afxZodiacMgr::zode_tris_idx = 0; +U32 afxZodiacMgr::n_zode_tris = 0; + +afxZodiacMgr::ZodiacSpec* afxZodiacMgr::live_zodiac = 0; +ShaderData* afxZodiacMgr::terrain_zode_shader = 0; +ShaderData* afxZodiacMgr::atlas_zode_shader = 0; +ShaderData* afxZodiacMgr::interior_zode_shader = 0; +ShaderData* afxZodiacMgr::polysoup_zode_shader = 0; + +void afxZodiacMgr::addTerrainZodiac(Point3F& pos, F32 radius, LinearColorF& color, F32 angle, afxZodiacData* zode) +{ + if (radius < 0.001f) + return; + + ZodiacSpec z; + z.pos = pos; + z.radius_xy = radius; + z.vert_range.set(0.0f, 0.0f); + z.grade_range.set(0.0f, 1.0f); + z.color = color.toColorI(); + z.angle = mDegToRad(angle); + z.zflags = zode->zflags; + z.txr = &zode->txr; + + z.distance_max = zode->distance_max*zode->distance_max; + z.distance_falloff = zode->distance_falloff*zode->distance_falloff; + z.distance_delta = z.distance_max - z.distance_falloff; + + if (terr_zodes.size() < MAX_ZODIACS) + terr_zodes.push_back(z); +} + +void afxZodiacMgr::addInteriorZodiac(Point3F& pos, F32 radius, Point2F& vert_range, LinearColorF& color, F32 angle, afxZodiacData* zode) +{ + if (radius < 0.001f) + return; + + ZodiacSpec z; + z.pos = pos; + z.radius_xy = radius; + z.vert_range = vert_range; + z.grade_range = zode->grade_range; + z.color = color.toColorI(); + z.angle = mDegToRad(angle); + z.zflags = zode->zflags; + z.txr = &zode->txr; + + z.distance_max = zode->distance_max*zode->distance_max; + z.distance_falloff = zode->distance_falloff*zode->distance_falloff; + z.distance_delta = z.distance_max - z.distance_falloff; + + if (inter_zodes.size() < MAX_ZODIACS) + inter_zodes.push_back(z); +} + +void afxZodiacMgr::frameReset() +{ + terr_zodes.clear(); + inter_zodes.clear(); +} + +void afxZodiacMgr::missionCleanup() +{ + terrain_zode_shader = 0; + atlas_zode_shader = 0; + interior_zode_shader = 0; + polysoup_zode_shader = 0; +} + +// REGULAR TERRAIN ZODIACS // + +void afxZodiacMgr::transformTerrainZodiacs(const MatrixF& world_xfm) +{ + VectorF facing_vec; + world_xfm.getColumn(1, &facing_vec); + F32 yaw = mAtan2(facing_vec.x, facing_vec.y); + while (yaw < 0.0) yaw += M_2PI_F; + + for (S32 i = 0; i < terr_zodes.size(); i++) + { + world_xfm.mulP(terr_zodes[i].pos, &terr_zodes[i].loc_pos); + F32 ang = terr_zodes[i].angle + yaw; + terr_zodes[i].loc_cos_ang = mCos(ang); + terr_zodes[i].loc_sin_ang = mSin(ang); + } + + zode_tris_head = zode_tris_tail = NULL; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ce/afxZodiacMgr.h b/Engine/source/afx/ce/afxZodiacMgr.h new file mode 100644 index 000000000..0141b3ed4 --- /dev/null +++ b/Engine/source/afx/ce/afxZodiacMgr.h @@ -0,0 +1,150 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_MGR_H_ +#define _AFX_ZODIAC_MGR_H_ + +#ifndef _ARCANE_FX_H_ +#include "afx/arcaneFX.h" +#endif +#ifndef _AFX_ZODIAC_DEFS_H_ +#include "afx/ce/afxZodiacDefs.h" +#endif +#ifndef _AFX_ZODIAC_H_ +#include "afx/ce/afxZodiac.h" +#endif + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +struct GridSquare; + +class ShaderData; +class TSStatic; + +class GroundPlane; +class MeshRoad; +class TerrainBlock; +class TerrCell; + +class afxZodiacMgr : public afxZodiacDefs +{ + friend class afxZodiacTerrainRenderer; + friend class afxZodiacPolysoupRenderer; + friend class afxZodiacGroundPlaneRenderer; + friend class afxZodiacMeshRoadRenderer; + + friend struct TerrainRender; + +private: + struct ZodiacSpec + { + Point3F pos; //12// world position + F32 radius_xy; // 4// radius of zodiac + Point2F vert_range; // 8// vertical range + Point2F grade_range; // 8// plane gradient range + ColorI color; // 4// color of zodiac + F32 angle; // 4// angle in radians + U32 zflags; // 4// 0=normal,1=additive,2=subtractive + GFXTexHandle* txr; // 4// zodiac texture + + F32 distance_max; + F32 distance_falloff; + F32 distance_delta; + + Point3F loc_pos; //12// transformed to local position + F32 loc_cos_ang; // 4// cosine of local rotation angle + F32 loc_sin_ang; // 4// sine of local rotation angle + + F32 calcDistanceFadeBias(F32 camDist) const + { + if (camDist < distance_falloff) + return 1.0f; + if (camDist < distance_max) + return (1.0f - (camDist - distance_falloff)/distance_delta); + return 0.0f; + } + }; + + struct ZodiacTriangle + { + ColorI color; + Point2F texco1; + Point3F point1; + Point2F texco2; + Point3F point2; + Point2F texco3; + Point3F point3; + U32 zflags; // 0=normal,1=additive,2=subtractive + GFXTexHandle* txr; + ZodiacTriangle* next; + }; + + static Vector terr_zodes; + static Vector inter_zodes; + + static ZodiacTriangle* zode_tris_head; + static ZodiacTriangle* zode_tris_tail; + static ZodiacTriangle* zode_tris; + static U32 zode_tris_idx; + static U32 n_zode_tris; + +public: + static ZodiacSpec* live_zodiac; +private: + static ShaderData* terrain_zode_shader; + static ShaderData* atlas_zode_shader; + static ShaderData* interior_zode_shader; + static ShaderData* polysoup_zode_shader; +public: + static void addTerrainZodiac(Point3F& pos, F32 rad, LinearColorF&, F32 ang, afxZodiacData*); + static void addInteriorZodiac(Point3F& pos, F32 rad, Point2F& vrange, LinearColorF&, F32 ang, afxZodiacData*); + static void frameReset(); + static void missionCleanup(); + + static S32 numTerrainZodiacs() { return terr_zodes.size(); } + static S32 numInteriorZodiacs() { return inter_zodes.size(); } + + static void transformTerrainZodiacs(const MatrixF& world_xfm); + static void testTerrainOverlap(GridSquare*, S32 level, Point2I sq_pos, afxZodiacBitmask&); + + static bool doesBoxOverlapZodiac(const Box3F& box, const ZodiacSpec& zode); + static bool doesBlockContainZodiacs(SceneRenderState*, TerrainBlock* block_); + + static bool renderTerrainZodiacs(SceneRenderState*, TerrainBlock*, TerrCell*); + static ShaderData* getTerrainZodiacShader(); + + static void renderPolysoupZodiacs(SceneRenderState*, TSStatic*); + static ShaderData* getPolysoupZodiacShader(); + + static void renderGroundPlaneZodiacs(SceneRenderState*, GroundPlane*); + static ShaderData* getGroundPlaneZodiacShader(); + + static void renderMeshRoadZodiacs(SceneRenderState*, MeshRoad*); + static ShaderData* getMeshRoadZodiacShader(); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_MGR_H_ diff --git a/Engine/source/afx/ce/afxZodiacMgr_T3D.cpp b/Engine/source/afx/ce/afxZodiacMgr_T3D.cpp new file mode 100644 index 000000000..f1b7f8ade --- /dev/null +++ b/Engine/source/afx/ce/afxZodiacMgr_T3D.cpp @@ -0,0 +1,319 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "scene/sceneRenderState.h" +#include "materials/shaderData.h" +#include "core/frameAllocator.h" +#include "terrain/terrRender.h" +#include "T3D/tsStatic.h" +#include "T3D/groundPlane.h" +#include "environment/meshRoad.h" +#include "collision/concretePolyList.h" +#include "gfx/primBuilder.h" +#include "terrain/terrCell.h" + +#include "afx/ce/afxZodiac.h" +#include "afx/ce/afxZodiacMgr.h" +#include "afx/afxZodiacTerrainRenderer_T3D.h" +#include "afx/afxZodiacGroundPlaneRenderer_T3D.h" +#include "afx/afxZodiacMeshRoadRenderer_T3D.h" +#include "afx/afxZodiacPolysoupRenderer_T3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +// POLYSOUP INTERIOR ZODIACS // + +void afxZodiacMgr::renderPolysoupZodiacs(SceneRenderState* state, TSStatic* tss) +{ + // check for active interior zodiacs + S32 n_zodes = inter_zodes.size(); + if (n_zodes <= 0) + return; + + static SphereF dummy_sphere; + const Box3F& mWorldBox = tss->getWorldBox(); + const Point3F& cam_pos = state->getCameraPosition(); + + // loop through the interior zodiacs + for (U32 i = 0; i < n_zodes; i++) + { + // calculate zodiac extents + F32 radius = inter_zodes[i].radius_xy; + Box3F box_w; box_w.minExtents = box_w.maxExtents = inter_zodes[i].pos; + box_w.minExtents -= Point3F(radius, radius, inter_zodes[i].vert_range.x); + box_w.maxExtents += Point3F(radius, radius, inter_zodes[i].vert_range.y); + + // skip zodiacs not overlapping this object + if (mWorldBox.isOverlapped(box_w) == false) + continue; + + // collect list of zodiac-intersecting polygons + ConcretePolyList* poly_list = new ConcretePolyList(); + ((SceneObject*)tss)->buildPolyList(PLC_Decal, poly_list, box_w, dummy_sphere); + + // render the polys if we get any + if (!poly_list->mPolyList.empty()) + { + // calculate zodiac distance from camera + Point3F cam_vec = cam_pos - inter_zodes[i].pos; + F32 cam_dist = cam_vec.lenSquared(); + + // render zodiacs + afxZodiacPolysoupRenderer::getMaster()->addZodiac(i, poly_list, inter_zodes[i].pos, inter_zodes[i].angle, tss, cam_dist); + // note: poly_list will be deleted by render-manager after rendering is done. + } + else + { + delete poly_list; // avoids crash when overlapping box but not polygons + } + } +} + +ShaderData* afxZodiacMgr::getPolysoupZodiacShader() +{ + if (!polysoup_zode_shader) + { + if( !Sim::findObject("afxZodiacPolysoupShader", polysoup_zode_shader)) + { + Con::errorf("afxZodiacMgr::getPolysoupZodiacShader() - failed to find shader 'afxZodiacPolysoupShader'."); + return 0; + } + } + + return polysoup_zode_shader; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +bool afxZodiacMgr::doesBoxOverlapZodiac(const Box3F& box, const afxZodiacMgr::ZodiacSpec& zode) +{ + if ((zode.pos.x - zode.radius_xy) > box.maxExtents.x || + (zode.pos.y - zode.radius_xy) > box.maxExtents.y) + return false; + if ((zode.pos.x + zode.radius_xy) < box.minExtents.x || + ( zode.pos.y + zode.radius_xy) < box.minExtents.y) + return false; + return true; +} + +static U32 last_terr_zode_idx = 0; + +bool afxZodiacMgr::doesBlockContainZodiacs(SceneRenderState* state, TerrainBlock* block) +{ + // for now, only look at diffuse-passes + if (!state->isDiffusePass()) + return false; + + // check for active terrain zodiacs + S32 n_zodes = terr_zodes.size(); + if (n_zodes <= 0) + return false; + + const Box3F& block_box = block->getWorldBox(); + + last_terr_zode_idx = 0; + for (U32 i = 0; i < n_zodes; i++) + { + if (doesBoxOverlapZodiac(block_box, terr_zodes[i])) + { + last_terr_zode_idx = i; + return true; + } + } + + return false; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +bool afxZodiacMgr::renderTerrainZodiacs(SceneRenderState* state, TerrainBlock* block, TerrCell* cell) +{ + // we assume here that afxZodiacMgr::doesBlockContainZodiacs() was recently called to + // determine that at least one zodiac intersects the block and its index is last_terr_zode_idx. + + bool cell_has_zodiacs = false; + + const Point3F& cam_pos = state->getCameraPosition(); + const Box3F& block_box = block->getWorldBox(); + + S32 n_zodes = terr_zodes.size(); + for (U32 i = last_terr_zode_idx; i < n_zodes; i++) + { + // first test against block's box + if (!doesBoxOverlapZodiac(block_box, terr_zodes[i])) + continue; + + const MatrixF& mRenderObjToWorld = block->getRenderTransform(); + Box3F cell_box = cell->getBounds(); + mRenderObjToWorld.mul(cell_box); + if (!doesBoxOverlapZodiac(cell_box, terr_zodes[i])) + continue; + + // at this point we know the zodiac overlaps AABB of cell... + + // calculate zodiac distance from camera + Point3F cam_vec = cam_pos - terr_zodes[i].pos; + F32 cam_dist = cam_vec.lenSquared(); + //if (cam_dist > 2500) + // continue; + + // render zodiacs + afxZodiacTerrainRenderer::getMaster()->addZodiac(i, terr_zodes[i].pos, terr_zodes[i].angle, block, cell, mRenderObjToWorld, cam_dist); + + cell_has_zodiacs = true; + } + + last_terr_zode_idx = 0; + + return cell_has_zodiacs; +} + +ShaderData* afxZodiacMgr::getTerrainZodiacShader() +{ + if (!terrain_zode_shader) + { + if (!Sim::findObject("afxZodiacTerrainShader", terrain_zode_shader)) + { + Con::errorf("afxZodiacMgr::getTerrainZodiacShader() - failed to find shader 'afxZodiacTerrainShader'."); + return 0; + } + } + + return terrain_zode_shader; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxZodiacMgr::renderGroundPlaneZodiacs(SceneRenderState* state, GroundPlane* ground_plane) +{ + // check for active terrain zodiacs + S32 n_zodes = terr_zodes.size(); + if (n_zodes <= 0) + return; + + // we currently expect gound-plane to be infinite + if (!ground_plane->isGlobalBounds()) + { + return; + } + + static SphereF dummy_sphere; + static Box3F dummy_box; + + const Point3F& cam_pos = state->getCameraPosition(); + + // loop through the terrain zodiacs + for (U32 i = 0; i < n_zodes; i++) + { + // calculate zodiac distance from camera + Point3F cam_vec = cam_pos - terr_zodes[i].pos; + F32 cam_dist = cam_vec.lenSquared(); + + // render zodiacs + afxZodiacGroundPlaneRenderer::getMaster()->addZodiac(i, terr_zodes[i].pos, terr_zodes[i].angle, ground_plane, cam_dist); + } +} + +ShaderData* afxZodiacMgr::getGroundPlaneZodiacShader() +{ + if (!terrain_zode_shader) + { + if (!Sim::findObject("afxZodiacTerrainShader", terrain_zode_shader)) + { + Con::errorf("afxZodiacMgr::getTerrainZodiacShader() - failed to find shader 'afxZodiacTerrainShader'."); + return 0; + } + } + + return terrain_zode_shader; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxZodiacMgr::renderMeshRoadZodiacs(SceneRenderState* state, MeshRoad* mesh_road) +{ + // check for active terrain zodiacs + S32 n_zodes = terr_zodes.size(); + if (n_zodes <= 0) + return; + + const Box3F& mWorldBox = mesh_road->getWorldBox(); + const Point3F& cam_pos = state->getCameraPosition(); + + // loop through the terrain zodiacs + for (U32 i = 0; i < n_zodes; i++) + { + // calculate zodiac extents + F32 radius = terr_zodes[i].radius_xy; + Box3F box_w; box_w.minExtents = box_w.maxExtents = terr_zodes[i].pos; + box_w.minExtents -= Point3F(radius, radius, terr_zodes[i].vert_range.x); + box_w.maxExtents += Point3F(radius, radius, terr_zodes[i].vert_range.y); + + // skip zodiacs not overlapping this object + if (mWorldBox.isOverlapped(box_w) == false) + continue; + + // collect list of zodiac-intersecting polygons + ConcretePolyList* poly_list = new ConcretePolyList(); + + mesh_road->buildTopPolyList(PLC_Decal, poly_list); + + // render the polys if we get any + if (!poly_list->mPolyList.empty()) + { + // calculate zodiac distance from camera + Point3F cam_vec = cam_pos - terr_zodes[i].pos; + F32 cam_dist = cam_vec.lenSquared(); + + // render zodiacs + afxZodiacMeshRoadRenderer::getMaster()->addZodiac(i, poly_list, terr_zodes[i].pos, terr_zodes[i].angle, mesh_road, cam_dist); + // note: poly_list will be deleted by render-manager after rendering is done. + } + else + { + delete poly_list; // avoids crash when overlapping box but not polygons + } + } +} + +ShaderData* afxZodiacMgr::getMeshRoadZodiacShader() +{ + if (!terrain_zode_shader) + { + if (!Sim::findObject("afxZodiacTerrainShader", terrain_zode_shader)) + { + Con::errorf("afxZodiacMgr::getTerrainZodiacShader() - failed to find shader 'afxZodiacTerrainShader'."); + return 0; + } + } + + return terrain_zode_shader; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxZodiacPlane.cpp b/Engine/source/afx/ce/afxZodiacPlane.cpp new file mode 100644 index 000000000..2a4740298 --- /dev/null +++ b/Engine/source/afx/ce/afxZodiacPlane.cpp @@ -0,0 +1,313 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "renderInstance/renderPassManager.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxZodiac.h" +#include "afx/ce/afxZodiacPlane.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxZodiacPlaneData + +IMPLEMENT_CO_DATABLOCK_V1(afxZodiacPlaneData); + +ConsoleDocClass( afxZodiacPlaneData, + "@brief A datablock that specifies a Zodiac Plane effect.\n\n" + + "afxZodiacData describes a zodiac-like effect called a zodiac plane. It reproduces most of the behavior of normal zodiacs " + "but unlike zodiac decals, it is represented as a flat plane of geometry that can be more flexibly positioned and oriented." + "\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxZodiacPlaneData::afxZodiacPlaneData() +{ + txr_name = ST_NULLSTRING; + radius_xy = 1; + start_ang = 0; + ang_per_sec = 0; + grow_in_time = 0.0f; + shrink_out_time = 0.0f; + growth_rate = 0.0f; + color.set(1,1,1,1); + blend_flags = BLEND_NORMAL; + respect_ori_cons = false; + + double_sided = true; + face_dir = FACES_UP; + use_full_xfm = false; +} + +afxZodiacPlaneData::afxZodiacPlaneData(const afxZodiacPlaneData& other, bool temp_clone) + : GameBaseData(other, temp_clone) +{ + txr_name = other.txr_name; + txr = other.txr; + radius_xy = other.radius_xy; + start_ang = other.start_ang; + ang_per_sec = other.ang_per_sec; + grow_in_time = other.grow_in_time; + shrink_out_time = other.shrink_out_time; + growth_rate = other.growth_rate; + color = other.color; + + double_sided = other.double_sided; + face_dir = other.face_dir; + use_full_xfm = other.use_full_xfm; + + zflags = other.zflags; + expand_zflags(); +} + +ImplementEnumType( afxZodiacPlane_BlendType, "Possible zodiac blend types.\n" "@ingroup afxZodiacPlane\n\n" ) + { afxZodiacData::BLEND_NORMAL, "normal", "..." }, + { afxZodiacData::BLEND_ADDITIVE, "additive", "..." }, + { afxZodiacData::BLEND_SUBTRACTIVE, "subtractive", "..." }, +EndImplementEnumType; + +ImplementEnumType( afxZodiacPlane_FacingType, "Possible zodiac plane facing types.\n" "@ingroup afxZodiacPlane\n\n" ) + { afxZodiacPlaneData::FACES_UP, "up", "..." }, + { afxZodiacPlaneData::FACES_DOWN, "down", "..." }, + { afxZodiacPlaneData::FACES_FORWARD, "forward", "..." }, + { afxZodiacPlaneData::FACES_BACK, "backward", "..." }, + { afxZodiacPlaneData::FACES_RIGHT, "right", "..." }, + { afxZodiacPlaneData::FACES_LEFT, "left", "..." }, + + { afxZodiacPlaneData::FACES_FORWARD, "front", "..." }, + { afxZodiacPlaneData::FACES_BACK, "back", "..." }, +EndImplementEnumType; + +#define myOffset(field) Offset(field, afxZodiacPlaneData) + +void afxZodiacPlaneData::initPersistFields() +{ + addField("texture", TypeFilename, myOffset(txr_name), + "An image to use as the zodiac's texture."); + addField("radius", TypeF32, myOffset(radius_xy), + "The zodiac's radius in scene units."); + addField("startAngle", TypeF32, myOffset(start_ang), + "The starting angle in degrees of the zodiac's rotation."); + addField("rotationRate", TypeF32, myOffset(ang_per_sec), + "The rate of rotation in degrees-per-second. Zodiacs with a positive rotationRate " + "rotate clockwise, while those with negative values turn counter-clockwise."); + addField("growInTime", TypeF32, myOffset(grow_in_time), + "A duration of time in seconds over which the zodiac grows from a zero size to its " + "full size as specified by the radius."); + addField("shrinkOutTime", TypeF32, myOffset(shrink_out_time), + "A duration of time in seconds over which the zodiac shrinks from full size to " + "invisible."); + addField("growthRate", TypeF32, myOffset(growth_rate), + "A rate in meters-per-second at which the zodiac grows in size. A negative value will " + "shrink the zodiac."); + addField("color", TypeColorF, myOffset(color), + "A color value for the zodiac."); + + addField("blend", TYPEID(), myOffset(blend_flags), + "A blending style for the zodiac. Possible values: normal, additive, or subtractive."); + + addField("trackOrientConstraint", TypeBool, myOffset(respect_ori_cons), + "Specifies if the zodiac's rotation should be defined by its constrained " + "transformation."); + + addField("doubleSided", TypeBool, myOffset(double_sided), + "Controls whether the zodiac-plane's polygons are rendered when viewed from either " + "side. If set to false, the zodiac-plane will only be seen when viewed from the " + "direction it is facing (according to faceDir)."); + + addField("faceDir", TYPEID(), myOffset(face_dir), + "Specifies which direction the zodiac-plane's polygons face. Possible values: " + "up, down, front, back, right, or left."); + + addField("useFullTransform", TypeBool, myOffset(use_full_xfm), + "Normal zodiacs have only one degree of freedom, a rotation around the z-axis. " + "Depending on the setting for trackOrientConstraint, this means that the effect's " + "orientation is either ignored or is limited to influencing the zodiac's angle of " + "rotation. By default, zodiac-plane reproduces this limited behavior in order to " + "match normal zodiacs. When useFullTransform is set to true, the zodiac can be " + "arbitrarily oriented."); + + Parent::initPersistFields(); +} + +void afxZodiacPlaneData::packData(BitStream* stream) +{ + Parent::packData(stream); + + merge_zflags(); + + stream->writeString(txr_name); + stream->write(radius_xy); + stream->write(start_ang); + stream->write(ang_per_sec); + stream->write(grow_in_time); + stream->write(shrink_out_time); + stream->write(growth_rate); + stream->write(color); + stream->write(zflags); + stream->write(double_sided); + stream->writeFlag(use_full_xfm); + stream->writeInt(face_dir, FACES_BITS); +} + +void afxZodiacPlaneData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + txr_name = stream->readSTString(); + txr = GFXTexHandle(); + stream->read(&radius_xy); + stream->read(&start_ang); + stream->read(&ang_per_sec); + stream->read(&grow_in_time); + stream->read(&shrink_out_time); + stream->read(&growth_rate); + stream->read(&color); + stream->read(&zflags); + stream->read(&double_sided); + use_full_xfm = stream->readFlag(); + face_dir = stream->readInt(FACES_BITS); + + expand_zflags(); +} + +bool afxZodiacPlaneData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + if (!server) + { + if (txr_name && txr_name[0] != '\0') + { + txr.set(txr_name, &AFX_GFXZodiacTextureProfile, "Zodiac Texture"); + } + } + + return true; +} + +F32 afxZodiacPlaneData::calcRotationAngle(F32 elapsed, F32 rate_factor) +{ + F32 angle = start_ang + elapsed*ang_per_sec*rate_factor; + angle = mFmod(angle, 360.0f); + + return angle; +} + +void afxZodiacPlaneData::expand_zflags() +{ + blend_flags = (zflags & BLEND_MASK); + respect_ori_cons = ((zflags & RESPECT_ORIENTATION) != 0); +} + +void afxZodiacPlaneData::merge_zflags() +{ + zflags = (blend_flags & BLEND_MASK); + if (respect_ori_cons) + zflags |= RESPECT_ORIENTATION; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxZodiacPlane + +IMPLEMENT_CO_NETOBJECT_V1(afxZodiacPlane); + +ConsoleDocClass( afxZodiacPlane, + "@brief A ZodiacPlane effect as defined by an afxZodiacPlaneData datablock.\n\n" + + "@ingroup afxEffects\n" + "@ingroup AFX\n" +); + +afxZodiacPlane::afxZodiacPlane() +{ + mNetFlags.clear(); + mNetFlags.set(IsGhost); + + mDataBlock = 0; + color.set(1,1,1,1); + radius = 1; + is_visible = true; +} + +afxZodiacPlane::~afxZodiacPlane() +{ +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +bool afxZodiacPlane::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + return true; +} + +bool afxZodiacPlane::onAdd() +{ + if(!Parent::onAdd()) + return false; + + F32 len = mDataBlock->radius_xy; + + switch (mDataBlock->face_dir) + { + case afxZodiacPlaneData::FACES_UP: + case afxZodiacPlaneData::FACES_DOWN: + mObjBox = Box3F(Point3F(-len, -len, -0.01f), Point3F(len, len, 0.01f)); + break; + case afxZodiacPlaneData::FACES_FORWARD: + case afxZodiacPlaneData::FACES_BACK: + mObjBox = Box3F(Point3F(-len, -0.01f, -len), Point3F(len, 0.01f, len)); + break; + case afxZodiacPlaneData::FACES_RIGHT: + case afxZodiacPlaneData::FACES_LEFT: + mObjBox = Box3F(Point3F(-0.01f, -len, -len), Point3F(0.01f, len, len)); + break; + } + + addToScene(); + + return true; +} + +void afxZodiacPlane::onRemove() +{ + removeFromScene(); + + Parent::onRemove(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ce/afxZodiacPlane.h b/Engine/source/afx/ce/afxZodiacPlane.h new file mode 100644 index 000000000..05b7ad56f --- /dev/null +++ b/Engine/source/afx/ce/afxZodiacPlane.h @@ -0,0 +1,143 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ZODIAC_PLANE_H_ +#define _AFX_ZODIAC_PLANE_H_ + +#include "afx/ce/afxZodiacDefs.h" + +class afxZodiacPlaneData : public GameBaseData, public afxZodiacDefs +{ + typedef GameBaseData Parent; + +public: + enum BlendType + { + BLEND_NORMAL = 0x0, + BLEND_ADDITIVE = 0x1, + BLEND_SUBTRACTIVE = 0x2, + BLEND_RESERVED = 0x3, + BLEND_MASK = 0x3 + }; + enum FacingType + { + FACES_UP = 0, + FACES_DOWN, + FACES_FORWARD, + FACES_BACK, + FACES_RIGHT, + FACES_LEFT, + FACES_BITS = 3 + }; + +public: + StringTableEntry txr_name; + GFXTexHandle txr; + F32 radius_xy; + F32 start_ang; + F32 ang_per_sec; + F32 grow_in_time; + F32 shrink_out_time; + F32 growth_rate; + LinearColorF color; + U32 blend_flags; + bool respect_ori_cons; + bool use_full_xfm; + U32 zflags; + U32 face_dir; + + bool double_sided; + + void expand_zflags(); + void merge_zflags(); + +public: + /*C*/ afxZodiacPlaneData(); + /*C*/ afxZodiacPlaneData(const afxZodiacPlaneData&, bool = false); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + virtual bool allowSubstitutions() const { return true; } + + F32 calcRotationAngle(F32 elapsed, F32 rate_factor=1.0f); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxZodiacPlaneData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxZodiacPlaneData::BlendType afxZodiacPlane_BlendType; +DefineEnumType( afxZodiacPlane_BlendType ); + +typedef afxZodiacPlaneData::FacingType afxZodiacPlane_FacingType; +DefineEnumType( afxZodiacPlane_FacingType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxZodiacPlane + +class afxZodiacPlane : public GameBase, public afxZodiacDefs +{ + typedef GameBase Parent; + +private: + afxZodiacPlaneData* mDataBlock; + LinearColorF color; + F32 radius; + bool is_visible; + + void preDraw(); + void draw(); + void postDraw(); + + GFXStateBlockRef normal_sb; + GFXStateBlockRef reflected_sb; + +public: + /*C*/ afxZodiacPlane(); + /*D*/ ~afxZodiacPlane(); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + virtual bool onAdd(); + virtual void onRemove(); + + void setRadius(F32 rad) { radius = rad; } + void setColor(const LinearColorF& clr) { color = clr; } + void setVisibility(bool flag) { is_visible = flag; } + + virtual void prepRenderImage(SceneRenderState*); + + void _renderZodiacPlane(ObjectRenderInst*, SceneRenderState*, BaseMatInstance*); + + DECLARE_CONOBJECT(afxZodiacPlane); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ZODIAC_PLANE_H_ diff --git a/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp b/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp new file mode 100644 index 000000000..2bf0bcfbc --- /dev/null +++ b/Engine/source/afx/ce/afxZodiacPlane_T3D.cpp @@ -0,0 +1,229 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "gfx/gfxTransformSaver.h" +#include "gfx/primBuilder.h" + +#include "afx/afxChoreographer.h" +#include "afx/ce/afxZodiacPlane.h" + +void afxZodiacPlane::prepRenderImage(SceneRenderState* state) +{ + if (!is_visible) + return; + + ObjectRenderInst *ri = state->getRenderPass()->allocInst(); + ri->renderDelegate.bind(this, &afxZodiacPlane::_renderZodiacPlane); + ri->type = RenderPassManager::RIT_ObjectTranslucent; + ri->translucentSort = true; + ri->defaultKey = (U32)(dsize_t)mDataBlock; + + if (false) + { + ri->sortDistSq = getWorldBox().getSqDistanceToPoint( state->getCameraPosition() ); + } + else // (sort by radius distance) + { + Point3F xyz_scale = getScale(); + F32 uni_scalar = getMax(xyz_scale.x, xyz_scale.y); + uni_scalar = getMax(uni_scalar, xyz_scale.z); + Point3F uni_scale(uni_scalar, uni_scalar, uni_scalar); + + Point3F local_cam_pos = state->getCameraPosition(); + getRenderWorldTransform().mulP(local_cam_pos); + local_cam_pos.convolveInverse(uni_scale); + + switch (mDataBlock->face_dir) + { + case afxZodiacPlaneData::FACES_UP: + case afxZodiacPlaneData::FACES_DOWN: + local_cam_pos.z = 0; + break; + case afxZodiacPlaneData::FACES_FORWARD: + case afxZodiacPlaneData::FACES_BACK: + local_cam_pos.y = 0; + break; + case afxZodiacPlaneData::FACES_RIGHT: + case afxZodiacPlaneData::FACES_LEFT: + local_cam_pos.x = 0; + break; + } + + /* AFX_T3D_BROKEN -- enhanced transparency sorting of ZodiacPlanes JTF Note: evaluate this + if (local_cam_pos.lenSquared() <= radius*radius) + { + ri->sortPoint = local_cam_pos; + } + else + { + local_cam_pos.normalize(); + ri->sortPoint = local_cam_pos*radius; + } + + ri->sortPoint.convolve(uni_scale); + getRenderTransform().mulP(ri->sortPoint); + */ + } + state->getRenderPass()->addInst(ri); +} + +void afxZodiacPlane::_renderZodiacPlane(ObjectRenderInst *ri, SceneRenderState* state, BaseMatInstance* overrideMat) +{ + if (overrideMat) + return; + + // projection + + // predraw + if (normal_sb.isNull()) + { + GFXStateBlockDesc desc; + + // Culling + desc.setCullMode((mDataBlock->double_sided) ? GFXCullNone : GFXCullCW); + + // Blending + U32 blend = (mDataBlock->zflags & BLEND_MASK); + switch (blend) + { + case BLEND_ADDITIVE: + desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendOne); + break; + case BLEND_SUBTRACTIVE: + desc.setBlend(true, GFXBlendZero, GFXBlendInvSrcColor); + break; + case BLEND_NORMAL: + desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha); + break; + } + + // JTF Note: check this desc.setAlphaTest((blend != BLEND_SUBTRACTIVE), GFXCmpGreater, 0); + desc.setAlphaTest(true, GFXCmpGreater, 0); + + desc.setZReadWrite(true); + desc.zFunc = GFXCmpLessEqual; + desc.zWriteEnable = false; + desc.samplersDefined = true; + desc.samplers[0].textureColorOp = GFXTOPModulate; + desc.samplers[1].textureColorOp = GFXTOPDisable; + + normal_sb = GFX->createStateBlock(desc); + if (mDataBlock->double_sided) + reflected_sb = normal_sb; + else + { + desc.setCullMode(GFXCullCCW); + reflected_sb = GFX->createStateBlock(desc); + } + } + + if (state->isReflectPass()) + GFX->setStateBlock(reflected_sb); + else + GFX->setStateBlock(normal_sb); + + Point3F basePoints[4]; + + switch (mDataBlock->face_dir) + { + case afxZodiacPlaneData::FACES_UP: + basePoints[0].set( 0.5f, -0.5f, 0.0f); + basePoints[1].set(-0.5f, -0.5f, 0.0f); + basePoints[2].set(-0.5f, 0.5f, 0.0f); + basePoints[3].set( 0.5f, 0.5f, 0.0f); + break; + case afxZodiacPlaneData::FACES_DOWN: + basePoints[3].set(-0.5f, 0.5f, 0.0f); + basePoints[2].set( 0.5f, 0.5f, 0.0f); + basePoints[1].set( 0.5f, -0.5f, 0.0f); + basePoints[0].set(-0.5f, -0.5f, 0.0f); + break; + case afxZodiacPlaneData::FACES_FORWARD: + basePoints[0].set( 0.5f, 0.0f, -0.5f); + basePoints[1].set(-0.5f, 0.0f, -0.5f); + basePoints[2].set(-0.5f, 0.0f, 0.5f); + basePoints[3].set( 0.5f, 0.0f, 0.5f); + break; + case afxZodiacPlaneData::FACES_BACK: + basePoints[3].set(-0.5f, 0.0f, 0.5f); + basePoints[2].set( 0.5f, 0.0f, 0.5f); + basePoints[1].set( 0.5f, 0.0f, -0.5f); + basePoints[0].set(-0.5f, 0.0f, -0.5f); + break; + case afxZodiacPlaneData::FACES_RIGHT: + basePoints[0].set(0.0f, 0.5f, -0.5f); + basePoints[1].set(0.0f, -0.5f, -0.5f); + basePoints[2].set(0.0f, -0.5f, 0.5f); + basePoints[3].set(0.0f, 0.5f, 0.5f); + break; + case afxZodiacPlaneData::FACES_LEFT: + basePoints[3].set(0.0f, -0.5f, 0.5f); + basePoints[2].set(0.0f, 0.5f, 0.5f); + basePoints[1].set(0.0f, 0.5f, -0.5f); + basePoints[0].set(0.0f, -0.5f, -0.5f); + break; + } + + F32 len = 2*radius; + + Point3F points[4]; + + Point2F texCoords[4]; // default: {{0.0,0.0}, {0.0,1.0}, {1.0,1.0}, {1.0,0.0}} + texCoords[0].set(1.0,1.0); + texCoords[1].set(0.0,1.0); + texCoords[2].set(0.0,0.0); + texCoords[3].set(1.0,0.0); + + for( int i=0; i<4; i++ ) + { + points[i].x = basePoints[i].x; + points[i].y = basePoints[i].y; + points[i].z = basePoints[i].z; + points[i] *= len; + } + + GFXTransformSaver saver; + GFX->multWorld(getRenderTransform()); + + GFX->setTexture(0, mDataBlock->txr); + + PrimBuild::begin(GFXTriangleStrip, 4); + { + PrimBuild::color4f(color.red, color.green, color.blue, color.alpha); + PrimBuild::texCoord2f(texCoords[1].x, texCoords[1].y); + PrimBuild::vertex3f(points[1].x, points[1].y, points[1].z); + PrimBuild::texCoord2f(texCoords[0].x, texCoords[0].y); + PrimBuild::vertex3f(points[0].x, points[0].y, points[0].z); + PrimBuild::texCoord2f(texCoords[2].x, texCoords[2].y); + PrimBuild::vertex3f(points[2].x, points[2].y, points[2].z); + PrimBuild::texCoord2f(texCoords[3].x, texCoords[3].y); + PrimBuild::vertex3f(points[3].x, points[3].y, points[3].z); + } + PrimBuild::end(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ea/afxEA_AnimClip.cpp b/Engine/source/afx/ea/afxEA_AnimClip.cpp new file mode 100644 index 000000000..4e635a1db --- /dev/null +++ b/Engine/source/afx/ea/afxEA_AnimClip.cpp @@ -0,0 +1,200 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxAnimClip.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_AnimClip + +class afxEA_AnimClip : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxAnimClipData* clip_data; + bool started; + F32 anim_lifetime; + U32 anim_tag; + U32 lock_tag; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_AnimClip(); + /*C*/ ~afxEA_AnimClip(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_AnimClip::afxEA_AnimClip() +{ + clip_data = 0; + started = false; + anim_lifetime = 0; + anim_tag = 0; + lock_tag = 0; +} + +afxEA_AnimClip::~afxEA_AnimClip() +{ + if (clip_data && clip_data->isTempClone()) + delete clip_data; + clip_data = 0; +} + +void afxEA_AnimClip::ea_set_datablock(SimDataBlock* db) +{ + clip_data = dynamic_cast(db); +} + +bool afxEA_AnimClip::ea_start() +{ + if (!clip_data) + { + Con::errorf("afxEA_AnimClip::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + afxConstraint* pos_constraint = getPosConstraint(); + if (full_lifetime == INFINITE_LIFETIME && pos_constraint != 0) + anim_lifetime = pos_constraint->getAnimClipDuration(clip_data->clip_name); + else + anim_lifetime = full_lifetime; + + anim_tag = 0; + lock_tag = 0; + + return true; +} + +bool afxEA_AnimClip::ea_update(F32 dt) +{ + afxConstraint* pos_constraint = getPosConstraint(); + if (!started && pos_constraint != 0) + { + bool go_for_it = true; + + if (pos_constraint->getDamageState() == ShapeBase::Enabled) + go_for_it = !clip_data->ignore_enabled; + else if (pos_constraint->getDamageState() == ShapeBase::Disabled) + go_for_it = !clip_data->ignore_disabled; + + if (go_for_it && (clip_data->ignore_first_person || clip_data->ignore_third_person)) + { + ShapeBase* shape = dynamic_cast(pos_constraint->getSceneObject()); + if (shape) + { + bool is_first_person = shape->isFirstPerson(); + if (clip_data->ignore_first_person && is_first_person) + go_for_it = false; + if (clip_data->ignore_third_person && !is_first_person) + go_for_it = false; + } + } + + if (go_for_it) + { + F32 rate = clip_data->rate/prop_time_factor; + F32 pos = mFmod(life_elapsed, anim_lifetime)/anim_lifetime; + pos = mFmod(pos + clip_data->pos_offset, 1.0); + if (clip_data->rate < 0) + pos = 1.0f - pos; + anim_tag = pos_constraint->setAnimClip(clip_data->clip_name, pos, rate, clip_data->trans, + clip_data->is_death_anim); + if (clip_data->lock_anim) + lock_tag = pos_constraint->lockAnimation(); + } + started = true; + } + + return true; +} + +void afxEA_AnimClip::ea_finish(bool was_stopped) +{ + afxConstraint* pos_constraint = getPosConstraint(); + if (pos_constraint && anim_tag != 0) + { + pos_constraint->resetAnimation(anim_tag); + } + if (pos_constraint && lock_tag != 0) + pos_constraint->unlockAnimation(lock_tag); + + started = false; +} + +void afxEA_AnimClip::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (clip_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxAnimClipData* orig_db = clip_data; + clip_data = new afxAnimClipData(*orig_db, true); + orig_db->performSubstitutions(clip_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_AnimClipDesc + +class afxEA_AnimClipDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_AnimClipDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + virtual bool isPositional(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_AnimClip; } +}; + +afxEA_AnimClipDesc afxEA_AnimClipDesc::desc; + +bool afxEA_AnimClipDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxAnimClipData) == typeid(*db)); +} + +bool afxEA_AnimClipDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_AnimLock.cpp b/Engine/source/afx/ea/afxEA_AnimLock.cpp new file mode 100644 index 000000000..3f6fd5597 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_AnimLock.cpp @@ -0,0 +1,108 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/ce/afxAnimLock.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_AnimLock + +class afxEA_AnimLock : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + bool started; + U32 lock_tag; + +public: + /*C*/ afxEA_AnimLock(); + + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_AnimLock::afxEA_AnimLock() +{ + started = false; + lock_tag = 0; +} + +bool afxEA_AnimLock::ea_update(F32 dt) +{ + afxConstraint* pos_constraint = getPosConstraint(); + if (!started && pos_constraint != 0) + { + lock_tag = pos_constraint->lockAnimation(); + started = true; + } + + return true; +} + +void afxEA_AnimLock::ea_finish(bool was_stopped) +{ + afxConstraint* pos_constraint = getPosConstraint(); + if (pos_constraint && lock_tag != 0) + { + pos_constraint->unlockAnimation(lock_tag); + } + + started = false; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_AnimLockDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_AnimLockDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + virtual bool isPositional(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_AnimLock; } +}; + +afxEA_AnimLockDesc afxEA_AnimLockDesc::desc; + +bool afxEA_AnimLockDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxAnimLockData) == typeid(*db)); +} + +bool afxEA_AnimLockDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_AreaDamage.cpp b/Engine/source/afx/ea/afxEA_AreaDamage.cpp new file mode 100644 index 000000000..3c5d26aae --- /dev/null +++ b/Engine/source/afx/ea/afxEA_AreaDamage.cpp @@ -0,0 +1,264 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxAreaDamage.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_AreaDamage + +class afxEA_AreaDamage : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxAreaDamageData* damage_data; + Point3F impact_pos; + bool damage_is_done; + SceneObject* cons_obj; + + void do_runtime_substitutions(); + void deal_area_damage(); + void apply_damage(ShapeBase*, F32 damage, const char* flavor, Point3F& pos); + void apply_impulse(ShapeBase*, F32 impulse, Point3F& pos); + void notify_damage_source(ShapeBase* damaged, F32 damage, const char* flavor, Point3F& pos); + +public: + /*C*/ afxEA_AreaDamage(); + /*C*/ ~afxEA_AreaDamage(); + + virtual bool isDone(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_AreaDamage::afxEA_AreaDamage() +{ + damage_data = 0; + impact_pos.zero(); + damage_is_done = false; + cons_obj = 0; +} + +afxEA_AreaDamage::~afxEA_AreaDamage() +{ + if (damage_data && damage_data->isTempClone()) + delete damage_data; + damage_data = 0; +} + +bool afxEA_AreaDamage::isDone() +{ + return damage_is_done; +} + +void afxEA_AreaDamage::ea_set_datablock(SimDataBlock* db) +{ + damage_data = dynamic_cast(db); +} + +bool afxEA_AreaDamage::ea_start() +{ + if (!damage_data) + { + Con::errorf("afxEA_AreaDamage::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + return true; +} + +bool afxEA_AreaDamage::ea_update(F32 dt) +{ + if (!damage_is_done) + { + afxConstraint* pos_cons = getPosConstraint(); + if (pos_cons) + { + pos_cons->getPosition(impact_pos); + cons_obj = pos_cons->getSceneObject(); + } + + deal_area_damage(); + + damage_is_done = true; + } + + return true; +} + +void afxEA_AreaDamage::ea_finish(bool was_stopped) +{ + damage_is_done = false; +} + +void afxEA_AreaDamage::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (damage_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxAreaDamageData* orig_db = damage_data; + damage_data = new afxAreaDamageData(*orig_db, true); + orig_db->performSubstitutions(damage_data, choreographer, group_index); + } +} + +// radiusDamage(%sourceObject, %position, %radius, %damage, %damageType, %impulse, %excluded) + +void afxEA_AreaDamage::deal_area_damage() +{ + // initContainerRadiusSearch -- afterwards Container::mSearchList contains objects within radius sorted by distance + gServerContainer.initRadiusSearch(impact_pos, damage_data->radius, ShapeBaseObjectType); + + F32 halfradius = damage_data->radius*0.5f; + + const Vector*>& list = gServerContainer.getRadiusSearchList(); + for (S32 i = 0; i < list.size(); i++) + { + if (!list[i]->isNull()) + { + ShapeBase* shape = dynamic_cast((SceneObject*)(*list[i])); + if (!shape || (shape->getTypeMask() & CameraObjectType)) + continue; + + if (damage_data->exclude_cons_obj && cons_obj == *list[i]) + continue; + +#if 0 // AFX_T3D_DISABLED -- calcExplosionCoverage() is a script function + // so we currently assign a coverage value of 1.0. + + U32 mask = InteriorObjectType | TerrainObjectType | VehicleObjectType; + F32 coverage = calcExplosionCoverage(impact_pos, shape, mask); + if (coverage == 0.0f) + continue; +#else + F32 coverage = 1.0f; +#endif + + // calulate distance + Point3F pos; + shape->getWorldBox().getCenter(&pos); + F32 dist = (pos - impact_pos).len(); + + F32 min_dist = shape->getWorldBox().len_x(); + if (shape->getWorldBox().len_y() < min_dist) + min_dist = shape->getWorldBox().len_y(); + if (shape->getWorldBox().len_z() < min_dist) + min_dist = shape->getWorldBox().len_z(); + + dist -= min_dist; + if (dist < 0) + dist = 0; + + F32 dist_scale = (dist < halfradius) ? 1.0f : 1.0f - ((dist - halfradius)/halfradius); + + F32 damage = damage_data->amount*coverage*dist_scale; + apply_damage(shape, damage, damage_data->flavor, impact_pos); + apply_impulse(shape, damage_data->impulse*dist_scale, impact_pos); + + if (damage_data->notify_damage_src) + notify_damage_source(shape, damage, damage_data->flavor, impact_pos); + } + } +} + +void afxEA_AreaDamage::notify_damage_source(ShapeBase* damaged, F32 damage, const char* flavor, Point3F& pos) +{ + if (mIsZero(damage)) + return; + + char *posArg = Con::getArgBuffer(64); + dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); + + Con::executef(choreographer->getDataBlock(), "onInflictedAreaDamage", + choreographer->getIdString(), + damaged->getIdString(), + Con::getFloatArg(damage), + flavor, + posArg); +} + +void afxEA_AreaDamage::apply_damage(ShapeBase* shape, F32 damage, const char* flavor, Point3F& pos) +{ + if (mIsZero(damage)) + return; + + char *posArg = Con::getArgBuffer(64); + dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); + + Con::executef(shape, "damage", + choreographer->getIdString(), + posArg, + Con::getFloatArg(damage), + flavor); +} + +void afxEA_AreaDamage::apply_impulse(ShapeBase* shape, F32 impulse, Point3F& pos) +{ + if (impulse <= 0.0f) + return; + + Point3F center; shape->getWorldBox().getCenter(¢er); + VectorF impulse_vec = center - pos; + impulse_vec.normalizeSafe(); + impulse_vec *= impulse; + shape->applyImpulse(pos, impulse_vec); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_AreaDamageDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_AreaDamageDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const { return false; } + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_AreaDamage; } +}; + +afxEA_AreaDamageDesc afxEA_AreaDamageDesc::desc; + +bool afxEA_AreaDamageDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxAreaDamageData) == typeid(*db)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_AudioBank.cpp b/Engine/source/afx/ea/afxEA_AudioBank.cpp new file mode 100644 index 000000000..3cf7bd912 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_AudioBank.cpp @@ -0,0 +1,178 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "sfx/sfxSystem.h" +#include "sfx/sfxSource.h" +#include "sfx/sfxProfile.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxAudioBank.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_AudioBank + +class afxEA_AudioBank : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + SFXSource* sound_handle; + afxAudioBank* sound_bank; + + S32 play_index; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_AudioBank(); + /*D*/ ~afxEA_AudioBank(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_AudioBank::afxEA_AudioBank() +{ + sound_handle = 0; + sound_bank = 0; + play_index = -1; +} + +afxEA_AudioBank::~afxEA_AudioBank() +{ + if (sound_bank && sound_bank->isTempClone()) + delete sound_bank; + sound_bank = 0; + sound_handle = 0; +} + +void afxEA_AudioBank::ea_set_datablock(SimDataBlock* db) +{ + sound_bank = dynamic_cast(db); +} + +bool afxEA_AudioBank::ea_start() +{ + if (!sound_bank) + { + Con::errorf("afxEA_AudioBank::ea_start() -- missing or incompatible afxAudioBank."); + return false; + } + + do_runtime_substitutions(); + + if (sound_bank->mPath == ST_NULLSTRING) + return false; + + play_index = sound_bank->play_index; + + return true; +} + +bool afxEA_AudioBank::ea_update(F32 dt) +{ + if (!sound_handle) + { + if (play_index >= 0 && play_index < 32 && sound_bank->mFilenames[play_index] != ST_NULLSTRING) + { + SFXProfile* temp_prof = new SFXProfile(sound_bank->mDescriptionObject, + avar("%s/%s", sound_bank->mPath, sound_bank->mFilenames[play_index]), + true); + if (!temp_prof->registerObject()) + { + Con::errorf( "afxEA_AudioBank::ea_update() -- unable to create profile"); + delete temp_prof; + } + else + { + sound_handle = SFX->createSource(temp_prof); + if (sound_handle) + sound_handle->play(); + temp_prof->setAutoDelete(true); + } + } + } + + if (sound_handle) + { + sound_handle->setTransform(updated_xfm); + sound_handle->setVolume(updated_scale.x*fade_value); + } + + return true; +} + +void afxEA_AudioBank::ea_finish(bool was_stopped) +{ + if (sound_handle) + { + sound_handle->stop(); + SFX_DELETE(sound_handle); + } +} + +void afxEA_AudioBank::do_runtime_substitutions() +{ + sound_bank = sound_bank->cloneAndPerformSubstitutions(choreographer, group_index); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_SoundBankDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_SoundBankDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + //virtual void prepEffect(afxEffectWrapperData*) const; + + virtual afxEffectWrapper* create() const { return new afxEA_AudioBank; } +}; + +afxEA_SoundBankDesc afxEA_SoundBankDesc::desc; + +bool afxEA_SoundBankDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxAudioBank) == typeid(*db)); +} + +bool afxEA_SoundBankDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + SFXDescription* desc = ((SFXProfile*)ew->effect_data)->getDescription(); + return (desc && desc->mIsLooping) ? (timing.lifetime < 0) : false; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Billboard.cpp b/Engine/source/afx/ea/afxEA_Billboard.cpp new file mode 100644 index 000000000..254dab1d6 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Billboard.cpp @@ -0,0 +1,199 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/afxResidueMgr.h" +#include "afx/ce/afxBillboard.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Billboard -- This is the adapter for geometry primitives. + +class afxEA_Billboard : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxBillboardData* bb_data; + afxBillboard* bb; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Billboard(); + /*D*/ ~afxEA_Billboard(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void ea_set_scope_status(bool flag); + virtual void onDeleteNotify(SimObject*); + virtual void getUpdatedBoxCenter(Point3F& pos); + virtual void getBaseColor(LinearColorF& color) { if (bb_data) color = bb_data->color; } +}; + + +afxEA_Billboard::afxEA_Billboard() +{ + bb_data = 0; + bb = 0; +} + +afxEA_Billboard::~afxEA_Billboard() +{ + if (bb) + bb->deleteObject(); + if (bb_data && bb_data->isTempClone()) + delete bb_data; + bb_data = 0; +} + +void afxEA_Billboard::ea_set_datablock(SimDataBlock* db) +{ + bb_data = dynamic_cast(db); +} + +bool afxEA_Billboard::ea_start() +{ + if (!bb_data) + { + Con::errorf("afxEA_Billboard::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + return true; +} + +bool afxEA_Billboard::ea_update(F32 dt) +{ + if (!bb) + { + // create and register effect + bb = new afxBillboard(); + bb->onNewDataBlock(bb_data, false); + if (!bb->registerObject()) + { + delete bb; + bb = 0; + Con::errorf("afxEA_Billboard::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(bb); + + ///bb->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); + bb->setSortPriority(datablock->sort_priority); + } + + if (bb) + { + bb->live_color = updated_color; + if (do_fades) + { + bb->setFadeAmount(fade_value); + } + bb->setTransform(updated_xfm); + bb->setScale(updated_scale); + } + + return true; +} + +void afxEA_Billboard::ea_finish(bool was_stopped) +{ + if (!bb) + return; + + bb->deleteObject(); + bb = 0; +} + +void afxEA_Billboard::ea_set_scope_status(bool in_scope) +{ + if (bb) + bb->setVisibility(in_scope); +} + +void afxEA_Billboard::onDeleteNotify(SimObject* obj) +{ + if (bb == dynamic_cast(obj)) + bb = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_Billboard::getUpdatedBoxCenter(Point3F& pos) +{ + if (bb) + pos = bb->getBoxCenter(); +} + +void afxEA_Billboard::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (bb_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxBillboardData* orig_db = bb_data; + bb_data = new afxBillboardData(*orig_db, true); + orig_db->performSubstitutions(bb_data, choreographer, group_index); + } +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_BillboardDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_BillboardDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_Billboard; } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_BillboardDesc afxEA_BillboardDesc::desc; + +bool afxEA_BillboardDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxBillboardData) == typeid(*db)); +} + +bool afxEA_BillboardDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_CameraPuppet.cpp b/Engine/source/afx/ea/afxEA_CameraPuppet.cpp new file mode 100644 index 000000000..b307bcb2f --- /dev/null +++ b/Engine/source/afx/ea/afxEA_CameraPuppet.cpp @@ -0,0 +1,199 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/gameBase/gameConnection.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxCamera.h" +#include "afx/ce/afxCameraPuppet.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_CameraPuppet + +class afxEA_CameraPuppet : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxCameraPuppetData* puppet_data; + afxConstraint* cam_cons; + bool was_1st_person; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_CameraPuppet(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual void getUnconstrainedPosition(Point3F& pos); + virtual void getUnconstrainedTransform(MatrixF& xfm); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_CameraPuppet::afxEA_CameraPuppet() +{ + puppet_data = 0; + cam_cons = 0; + was_1st_person = false; +} + +void afxEA_CameraPuppet::ea_set_datablock(SimDataBlock* db) +{ + puppet_data = dynamic_cast(db); +} + +bool afxEA_CameraPuppet::ea_start() +{ + if (!puppet_data) + { + Con::errorf("afxEA_CameraPuppet::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + afxConstraintID obj_id = cons_mgr->getConstraintId(puppet_data->cam_def); + cam_cons = cons_mgr->getConstraint(obj_id); + + SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; + if (obj && obj->isClientObject()) + { + GameConnection* conn = GameConnection::getConnectionToServer(); + if (conn) + { + was_1st_person = conn->isFirstPerson(); + if (was_1st_person) + conn->setFirstPerson(false); + } + } + + return true; +} + +bool afxEA_CameraPuppet::ea_update(F32 dt) +{ + SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; + + if (obj && in_scope) + { + obj->setTransform(updated_xfm); + } + + return true; +} + +void afxEA_CameraPuppet::ea_finish(bool was_stopped) +{ + afxCamera* afx_cam = dynamic_cast((cam_cons) ? cam_cons->getSceneObject() : 0); + if (afx_cam && afx_cam->isClientObject()) + afx_cam->setThirdPersonSnapClient(); + + if (was_1st_person) + { + GameConnection* conn = GameConnection::getConnectionToServer(); + if (conn) + conn->setFirstPerson(true); + } +} + +void afxEA_CameraPuppet::getUnconstrainedPosition(Point3F& pos) +{ + SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; + if (obj) + pos = obj->getRenderPosition(); + else + pos.zero(); +} + +void afxEA_CameraPuppet::getUnconstrainedTransform(MatrixF& xfm) +{ + SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; + if (obj) + xfm = obj->getRenderTransform(); + else + xfm.identity(); +} + +void afxEA_CameraPuppet::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (puppet_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxCameraPuppetData* orig_db = puppet_data; + puppet_data = new afxCameraPuppetData(*orig_db, true); + orig_db->performSubstitutions(puppet_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_CameraPuppetDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_CameraPuppetDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const; + virtual bool runsOnClient(const afxEffectWrapperData*) const; + + virtual afxEffectWrapper* create() const { return new afxEA_CameraPuppet; } +}; + +afxEA_CameraPuppetDesc afxEA_CameraPuppetDesc::desc; + +bool afxEA_CameraPuppetDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxCameraPuppetData) == typeid(*db)); +} + +bool afxEA_CameraPuppetDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +bool afxEA_CameraPuppetDesc::runsOnServer(const afxEffectWrapperData* ew) const +{ + U8 networking = ((const afxCameraPuppetData*)ew->effect_data)->networking; + return ((networking & (SERVER_ONLY | SERVER_AND_CLIENT)) != 0); +} + +bool afxEA_CameraPuppetDesc::runsOnClient(const afxEffectWrapperData* ew) const +{ + U8 networking = ((const afxCameraPuppetData*)ew->effect_data)->networking; + return ((networking & (CLIENT_ONLY | SERVER_AND_CLIENT)) != 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_CameraShake.cpp b/Engine/source/afx/ea/afxEA_CameraShake.cpp new file mode 100644 index 000000000..9c26e32b6 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_CameraShake.cpp @@ -0,0 +1,196 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/fx/cameraFXMgr.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxCameraShake.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_CameraShake + +class afxEA_CameraShake : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxCameraShakeData* shake_data; + CameraShake* camera_shake; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_CameraShake(); + /*D*/ ~afxEA_CameraShake(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_CameraShake::afxEA_CameraShake() +{ + shake_data = 0; + camera_shake = 0; +} + +afxEA_CameraShake::~afxEA_CameraShake() +{ + delete camera_shake; + if (shake_data && shake_data->isTempClone()) + delete shake_data; + shake_data = 0; +} + +void afxEA_CameraShake::ea_set_datablock(SimDataBlock* db) +{ + shake_data = dynamic_cast(db); +} + +bool afxEA_CameraShake::ea_start() +{ + if (!shake_data) + { + Con::errorf("afxEA_CameraShake::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + afxConstraint* pos_constraint = getPosConstraint(); + afxConstraint* aim_constraint = getAimConstraint(); + + if (aim_constraint && pos_constraint) + { + if (full_lifetime <= 0 || full_lifetime == INFINITE_LIFETIME) + { + Con::errorf("afxEA_CameraShake::ea_start() -- effect requires a finite lifetime."); + return false; + } + + SceneObject* shaken = aim_constraint->getSceneObject(); + if (shaken) + { + Point3F pos; pos_constraint->getPosition(pos); + VectorF diff = shaken->getPosition() - pos; + F32 dist = diff.len(); + if (dist < shake_data->camShakeRadius) + { + camera_shake = new CameraShake; + camera_shake->setDuration(full_lifetime); + camera_shake->setFrequency(shake_data->camShakeFreq); + + F32 falloff = dist/shake_data->camShakeRadius; + falloff = 1 + falloff*10.0; + falloff = 1.0 / (falloff*falloff); + + VectorF shakeAmp = shake_data->camShakeAmp*falloff; + camera_shake->setAmplitude(shakeAmp); + camera_shake->setFalloff(shake_data->camShakeFalloff); + camera_shake->init(); + } + } + } + + return true; +} + +bool afxEA_CameraShake::ea_update(F32 dt) +{ + afxConstraint* aim_constraint = getAimConstraint(); + if (camera_shake && aim_constraint) + { + camera_shake->update(dt); + + SceneObject* shaken = aim_constraint->getSceneObject(); + if (shaken) + { + MatrixF fxTrans = camera_shake->getTrans(); + MatrixF curTrans = shaken->getRenderTransform(); + curTrans.mul(fxTrans); + + Point3F cameraPosWorld; + curTrans.getColumn(3,&cameraPosWorld); + shaken->setPosition(cameraPosWorld); + } + } + + return true; +} + +void afxEA_CameraShake::ea_finish(bool was_stopped) +{ + delete camera_shake; + camera_shake = 0; +} + +void afxEA_CameraShake::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (shake_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxCameraShakeData* orig_db = shake_data; + shake_data = new afxCameraShakeData(*orig_db, true); + orig_db->performSubstitutions(shake_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_CameraShakeDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_CameraShakeDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + virtual bool isPositional(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_CameraShake; } +}; + +afxEA_CameraShakeDesc afxEA_CameraShakeDesc::desc; + +bool afxEA_CameraShakeDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxCameraShakeData) == typeid(*db)); +} + +bool afxEA_CameraShakeDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_CollisionEvent.cpp b/Engine/source/afx/ea/afxEA_CollisionEvent.cpp new file mode 100644 index 000000000..b06492acc --- /dev/null +++ b/Engine/source/afx/ea/afxEA_CollisionEvent.cpp @@ -0,0 +1,225 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxCollisionEvent.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_CollisionEvent + +class afxEA_CollisionEvent : public afxEffectWrapper, ShapeBase::CollisionEventCallback +{ + typedef afxEffectWrapper Parent; + + afxCollisionEventData* script_data; + ShapeBase* shape; + U32 trigger_mask; + bool triggered; + + void do_runtime_substitutions(); + void set_shape(ShapeBase*); + +public: + /*C*/ afxEA_CollisionEvent(); + /*D*/ ~afxEA_CollisionEvent(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual void collisionNotify(SceneObject* obj0, SceneObject* obj1, const VectorF& vel); + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_CollisionEvent::afxEA_CollisionEvent() +{ + script_data = 0; + shape = 0; + trigger_mask = 0; + triggered = false; +} + +afxEA_CollisionEvent::~afxEA_CollisionEvent() +{ + if (shape) + clearNotify(shape); + if (script_data && script_data->isTempClone()) + delete script_data; + script_data = 0; +} + +void afxEA_CollisionEvent::ea_set_datablock(SimDataBlock* db) +{ + script_data = dynamic_cast(db); +} + +bool afxEA_CollisionEvent::ea_start() +{ + if (!script_data) + { + Con::errorf("afxEA_CollisionEvent::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + if (script_data->gen_trigger && script_data->trigger_bit < 32) + trigger_mask = 1 << script_data->trigger_bit; + else + trigger_mask = 0; + + triggered = false; + + return true; +} + +bool afxEA_CollisionEvent::ea_update(F32 dt) +{ + afxConstraint* pos_constraint = getPosConstraint(); + set_shape((pos_constraint) ? dynamic_cast(pos_constraint->getSceneObject()) : 0); + + if (choreographer && trigger_mask != 0) + { + if (triggered) + { + choreographer->setTriggerMask(trigger_mask | choreographer->getTriggerMask()); + triggered = false; + } + else + { + choreographer->setTriggerMask(~trigger_mask & choreographer->getTriggerMask()); + } + } + + return true; +} + +void afxEA_CollisionEvent::ea_finish(bool was_stopped) +{ + set_shape(0); +} + +void afxEA_CollisionEvent::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (script_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxCollisionEventData* orig_db = script_data; + script_data = new afxCollisionEventData(*orig_db, true); + orig_db->performSubstitutions(script_data, choreographer, group_index); + } +} + +void afxEA_CollisionEvent::set_shape(ShapeBase* new_shape) +{ + if (shape == new_shape) + return; + + if (shape) + { + shape->unregisterCollisionCallback(this); + clearNotify(shape); + } + + shape = new_shape; + + if (shape) + { + deleteNotify(shape); + shape->registerCollisionCallback(this); + } +} + +void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, const VectorF& vel) +{ + if (obj0 != shape || !choreographer || !choreographer->getDataBlock()) + return; + + if (script_data->method_name != ST_NULLSTRING) + { + char *arg_buf = Con::getArgBuffer(64); + dSprintf(arg_buf, 256, "%g %g %g", vel.x, vel.y, vel.z); + + // CALL SCRIPT afxChoreographerData::method(%spell, %obj0, %obj1, %velocity) + Con::executef(choreographer->getDataBlock(), script_data->method_name, + choreographer->getIdString(), + (obj0) ? obj0->getIdString() : "", + (obj1) ? obj1->getIdString() : "", + arg_buf, + script_data->script_data); + } + + if (!triggered && trigger_mask != 0) + triggered = true; +} + +void afxEA_CollisionEvent::onDeleteNotify(SimObject* obj) +{ + if (obj == shape) + { + shape->unregisterCollisionCallback(this); + shape = 0; + } + + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_CollisionEventDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_CollisionEventDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + virtual bool isPositional(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_CollisionEvent; } +}; + +afxEA_CollisionEventDesc afxEA_CollisionEventDesc::desc; + +bool afxEA_CollisionEventDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxCollisionEventData) == typeid(*db)); +} + +bool afxEA_CollisionEventDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp b/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp new file mode 100644 index 000000000..cb08cfa72 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp @@ -0,0 +1,128 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxConsoleMessage.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_ConsoleMessage + +class afxEA_ConsoleMessage : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxConsoleMessageData* message_data; + bool displayed; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_ConsoleMessage(); + + virtual bool isDone() { return displayed; } + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_ConsoleMessage::afxEA_ConsoleMessage() +{ + message_data = 0; + displayed = false; +} + +void afxEA_ConsoleMessage::ea_set_datablock(SimDataBlock* db) +{ + message_data = dynamic_cast(db); +} + +bool afxEA_ConsoleMessage::ea_start() +{ + if (!message_data) + { + Con::errorf("afxEA_ConsoleMessage::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + return true; +} + +bool afxEA_ConsoleMessage::ea_update(F32 dt) +{ + if (!displayed) + { + if (message_data->message_str != ST_NULLSTRING) + Con::printf("ConsoleMessage: \"%s\"", message_data->message_str); + displayed = true; + } + + return true; +} + +void afxEA_ConsoleMessage::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (message_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxConsoleMessageData* orig_db = message_data; + message_data = new afxConsoleMessageData(*orig_db, true); + orig_db->performSubstitutions(message_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ConsoleMessageDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ConsoleMessageDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const { return false; } + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + virtual bool isPositional(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_ConsoleMessage; } +}; + +afxEA_ConsoleMessageDesc afxEA_ConsoleMessageDesc::desc; + +bool afxEA_ConsoleMessageDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxConsoleMessageData) == typeid(*db)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Damage.cpp b/Engine/source/afx/ea/afxEA_Damage.cpp new file mode 100644 index 000000000..e0691eae3 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Damage.cpp @@ -0,0 +1,201 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxDamage.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Damage + +class afxEA_Damage : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxDamageData* damage_data; + bool started; + U8 repeat_cnt; + U32 dot_delta_ms; + U32 next_dot_time; + Point3F impact_pos; + SimObjectId impacted_obj_id; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Damage(); + /*C*/ ~afxEA_Damage(); + + virtual bool isDone(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_Damage::afxEA_Damage() +{ + damage_data = 0; + started = false; + repeat_cnt = 0; + dot_delta_ms = 0; + next_dot_time = 0; + impact_pos.zero(); + impacted_obj_id = 0; +} + +afxEA_Damage::~afxEA_Damage() +{ + if (damage_data && damage_data->isTempClone()) + delete damage_data; + damage_data = 0; +} + +bool afxEA_Damage::isDone() +{ + return (damage_data) ? (repeat_cnt >= damage_data->repeats) : true; +} + +void afxEA_Damage::ea_set_datablock(SimDataBlock* db) +{ + damage_data = dynamic_cast(db); +} + +bool afxEA_Damage::ea_start() +{ + if (!damage_data) + { + Con::errorf("afxEA_Damage::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + if (damage_data->repeats > 1) + { + dot_delta_ms = full_lifetime/(damage_data->repeats - 1); + next_dot_time = dot_delta_ms; + } + + return true; +} + +bool afxEA_Damage::ea_update(F32 dt) +{ + if (!started) + { + started = true; + + afxConstraint* pos_cons = getPosConstraint(); + if (pos_cons) + pos_cons->getPosition(impact_pos); + + afxConstraint* aim_cons = getAimConstraint(); + if (aim_cons && aim_cons->getSceneObject()) + impacted_obj_id = aim_cons->getSceneObject()->getId(); + + if (choreographer) + choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + repeat_cnt, damage_data->ad_amount, damage_data->radius, impact_pos, + damage_data->impulse); + repeat_cnt++; + } + else if (repeat_cnt < damage_data->repeats) + { + if (next_dot_time <= life_elapsed) + { + // CONSTRAINT REMAPPING << + afxConstraint* aim_cons = getAimConstraint(); + if (aim_cons && aim_cons->getSceneObject()) + impacted_obj_id = aim_cons->getSceneObject()->getId(); + // CONSTRAINT REMAPPING >> + + if (choreographer) + choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + repeat_cnt, 0, 0, impact_pos, 0); + next_dot_time += dot_delta_ms; + repeat_cnt++; + } + } + + return true; +} + +void afxEA_Damage::ea_finish(bool was_stopped) +{ + if (started && (repeat_cnt < damage_data->repeats)) + { + if (next_dot_time <= life_elapsed) + { + if (choreographer) + choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + repeat_cnt, 0, 0, impact_pos, 0); + } + } + + started = false; +} + +void afxEA_Damage::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (damage_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxDamageData* orig_db = damage_data; + damage_data = new afxDamageData(*orig_db, true); + orig_db->performSubstitutions(damage_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_DamageDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_DamageDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const { return false; } + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_Damage; } +}; + +afxEA_DamageDesc afxEA_DamageDesc::desc; + +bool afxEA_DamageDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxDamageData) == typeid(*db)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Debris.cpp b/Engine/source/afx/ea/afxEA_Debris.cpp new file mode 100644 index 000000000..e4a46fc6b --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Debris.cpp @@ -0,0 +1,199 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/debris.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Debris + +class afxEA_Debris : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + DebrisData* debris_data; + Debris* debris; + bool exploded; + bool debris_done; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Debris(); + /*D*/ ~afxEA_Debris(); + + virtual bool isDone(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_Debris::afxEA_Debris() +{ + debris_data = 0; + debris = 0; + exploded = false; + debris_done = false; +} + +afxEA_Debris::~afxEA_Debris() +{ + if (debris) + clearNotify(debris); +} + +bool afxEA_Debris::isDone() +{ + return (datablock->use_as_cons_obj) ? debris_done : exploded; +} + +void afxEA_Debris::ea_set_datablock(SimDataBlock* db) +{ + debris_data = dynamic_cast(db); +} + +bool afxEA_Debris::ea_start() +{ + if (!debris_data) + { + Con::errorf("afxEA_Debris::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + debris = new Debris(); + debris->onNewDataBlock(debris_data, false); + + return true; +} + +bool afxEA_Debris::ea_update(F32 dt) +{ + if (exploded && debris) + { + if (in_scope) + { + updated_xfm = debris->getRenderTransform(); + updated_xfm.getColumn(3, &updated_pos); + } + } + + if (!exploded && debris) + { + if (in_scope) + { + Point3F dir_vec(0,1,0); + updated_xfm.mulV(dir_vec); + + debris->init(updated_pos, dir_vec); + if (!debris->registerObject()) + { + delete debris; + debris = 0; + Con::errorf("afxEA_Debris::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(debris); + } + exploded = true; + } + + return true; +} + +void afxEA_Debris::ea_finish(bool was_stopped) +{ + if (debris) + { + clearNotify(debris); + debris = 0; + } + exploded = false; +} + +void afxEA_Debris::onDeleteNotify(SimObject* obj) +{ + // debris deleted? + Debris* del_debris = dynamic_cast(obj); + if (del_debris == debris) + { + debris = NULL; + debris_done = true; + } +} + +void afxEA_Debris::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (debris_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + DebrisData* orig_db = debris_data; + debris_data = new DebrisData(*orig_db, true); + orig_db->performSubstitutions(debris_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_DebrisDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_DebrisDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_Debris; } +}; + +afxEA_DebrisDesc afxEA_DebrisDesc::desc; + +bool afxEA_DebrisDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(DebrisData) == typeid(*db)); +} + +bool afxEA_DebrisDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (ew->use_as_cons_obj && timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Explosion.cpp b/Engine/source/afx/ea/afxEA_Explosion.cpp new file mode 100644 index 000000000..f8e424f84 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Explosion.cpp @@ -0,0 +1,145 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/fx/explosion.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Explosion + +class afxEA_Explosion : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + ExplosionData* explosion_data; + Explosion* explosion; + bool exploded; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Explosion(); + + virtual bool isDone() { return exploded; } + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_Explosion::afxEA_Explosion() +{ + explosion_data = 0; + explosion = 0; + exploded = false; +} + +void afxEA_Explosion::ea_set_datablock(SimDataBlock* db) +{ + explosion_data = dynamic_cast(db); +} + +bool afxEA_Explosion::ea_start() +{ + if (!explosion_data) + { + Con::errorf("afxEA_Explosion::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + explosion = new Explosion(); + explosion->setSubstitutionData(choreographer, group_index); + explosion->setDataBlock(explosion_data); + + return true; +} + +bool afxEA_Explosion::ea_update(F32 dt) +{ + if (!exploded && explosion) + { + if (in_scope) + { + Point3F norm(0,0,1); updated_xfm.mulV(norm); + explosion->setInitialState(updated_pos, norm); + if (!explosion->registerObject()) + { + delete explosion; + explosion = 0; + Con::errorf("afxEA_Explosion::ea_update() -- effect failed to register."); + return false; + } + } + exploded = true; + } + + return true; +} + +void afxEA_Explosion::ea_finish(bool was_stopped) +{ + explosion = 0; + exploded = false; +} + +void afxEA_Explosion::do_runtime_substitutions() +{ + explosion_data = explosion_data->cloneAndPerformSubstitutions(choreographer, group_index); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ExplosionDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ExplosionDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const { return false; } + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_Explosion; } +}; + +afxEA_ExplosionDesc afxEA_ExplosionDesc::desc; + +bool afxEA_ExplosionDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(ExplosionData) == typeid(*db)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_FootSwitch.cpp b/Engine/source/afx/ea/afxEA_FootSwitch.cpp new file mode 100644 index 000000000..822dfb1e4 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_FootSwitch.cpp @@ -0,0 +1,180 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/player.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/ce/afxFootSwitch.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_FootSwitch + +class afxEA_FootSwitch : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxFootSwitchData* footfall_data; + Player* player; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_FootSwitch(); + + void set_overrides(Player*); + void clear_overrides(Player*); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_FootSwitch::afxEA_FootSwitch() +{ + footfall_data = 0; + player = 0; +} + +inline void afxEA_FootSwitch::set_overrides(Player* player) +{ + if (footfall_data->override_all) + player->overrideFootfallFX(); + else + player->overrideFootfallFX(footfall_data->override_decals, + footfall_data->override_sounds, + footfall_data->override_dust); +} + +inline void afxEA_FootSwitch::clear_overrides(Player* player) +{ + if (footfall_data->override_all) + player->restoreFootfallFX(); + else + player->restoreFootfallFX(footfall_data->override_decals, + footfall_data->override_sounds, + footfall_data->override_dust); +} + +void afxEA_FootSwitch::ea_set_datablock(SimDataBlock* db) +{ + footfall_data = dynamic_cast(db); +} + +bool afxEA_FootSwitch::ea_start() +{ + if (!footfall_data) + { + Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + afxConstraint* pos_cons = getPosConstraint(); + player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; + if (player) + set_overrides(player); + + return true; +} + +bool afxEA_FootSwitch::ea_update(F32 dt) +{ + if (!player) + return true; + + afxConstraint* pos_cons = getPosConstraint(); + Player* temp_player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; + if (temp_player && temp_player != player) + { + player = temp_player; + if (player) + set_overrides(player); + } + + return true; +} + +void afxEA_FootSwitch::ea_finish(bool was_stopped) +{ + if (!player) + return; + + afxConstraint* pos_cons = getPosConstraint(); + Player* temp_player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; + if (temp_player == player) + clear_overrides(player); +} + +void afxEA_FootSwitch::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (footfall_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxFootSwitchData* orig_db = footfall_data; + footfall_data = new afxFootSwitchData(*orig_db, true); + orig_db->performSubstitutions(footfall_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_FootfallSwitchDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_FootfallSwitchDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + virtual bool isPositional(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_FootSwitch; } +}; + +afxEA_FootfallSwitchDesc afxEA_FootfallSwitchDesc::desc; + +bool afxEA_FootfallSwitchDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxFootSwitchData) == typeid(*db)); +} + +bool afxEA_FootfallSwitchDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_GuiController.cpp b/Engine/source/afx/ea/afxEA_GuiController.cpp new file mode 100644 index 000000000..9387278e7 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_GuiController.cpp @@ -0,0 +1,216 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "gui/core/guiControl.h" +#include "gui/3d/guiTSControl.h" +#include "T3D/gameBase/gameConnection.h" +#include "gui/game/guiProgressCtrl.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/ce/afxGuiController.h" +#include "afx/ui/afxProgressBase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_GuiController + +class afxEA_GuiController : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxGuiControllerData* controller_data; + GuiControl* gui_control; + GuiTSCtrl* ts_ctrl; + afxProgressBase* progress_base; + GuiProgressCtrl* progress_ctrl; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_GuiController(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_GuiController::afxEA_GuiController() +{ + controller_data = 0; + gui_control = 0; + ts_ctrl = 0; + progress_base = 0; + progress_ctrl = 0; +} + +void afxEA_GuiController::ea_set_datablock(SimDataBlock* db) +{ + controller_data = dynamic_cast(db); +} + +bool afxEA_GuiController::ea_start() +{ + if (!controller_data) + { + Con::errorf("afxEA_GuiController::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + if (controller_data->ctrl_client_only) + { + afxConstraint* pos_cons = getPosConstraint(); + if (!pos_cons) + return false; // not an error condition + GameBase* gamebase_obj = dynamic_cast(pos_cons->getSceneObject()); + if (!gamebase_obj || !gamebase_obj->getControllingClient()) + return false; // not an error condition + } + + if (controller_data->control_name == ST_NULLSTRING || controller_data->control_name[0] == '\0') + { + Con::errorf("afxEA_GuiController::ea_start() -- empty control name."); + return false; + } + + gui_control = dynamic_cast(Sim::findObject(controller_data->control_name)); + if (!gui_control) + { + Con::errorf("afxEA_GuiController::ea_start() -- failed to find control \"%s\".", controller_data->control_name); + return false; + } + + gui_control->setVisible(true); + + progress_base = dynamic_cast(gui_control); + if (progress_base) + { + progress_base->setProgress(0.0f); + progress_ctrl = 0; + } + else + { + progress_ctrl = (GuiProgressCtrl*)gui_control; + if (progress_ctrl) + { + progress_ctrl->setScriptValue(0); + progress_base = 0; + } + } + + ts_ctrl = 0; + for (GuiControl* ctrl = gui_control->getParent(); ctrl != 0; ctrl->getParent()) + { + if (dynamic_cast(ctrl)) + { + ts_ctrl = (GuiTSCtrl*) ctrl; + break; + } + } + + return true; +} + +bool afxEA_GuiController::ea_update(F32 dt) +{ + if (ts_ctrl && !controller_data->preserve_pos) + { + Point3F screen_pos; + if (ts_ctrl->project(updated_pos, &screen_pos)) + { + const Point2I ext = gui_control->getExtent(); + Point2I newpos(screen_pos.x - ext.x/2, screen_pos.y - ext.y/2); + gui_control->setPosition(newpos); + } + } + + if (progress_base) + progress_base->setProgress((ew_timing.lifetime > 0.0) ? life_elapsed/ew_timing.lifetime : 0.0f); + else if (progress_ctrl) + progress_ctrl->setScriptValue((ew_timing.lifetime > 0.0) ? avar("%g", life_elapsed/ew_timing.lifetime) : 0); + + if (do_fades) + gui_control->setFadeAmount(fade_value); + + return true; +} + +void afxEA_GuiController::ea_finish(bool was_stopped) +{ + if (progress_base) + progress_base->setProgress(1.0f); + else if (progress_ctrl) + progress_ctrl->setScriptValue("1"); + gui_control->setVisible(false); +} + +void afxEA_GuiController::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (controller_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxGuiControllerData* orig_db = controller_data; + controller_data = new afxGuiControllerData(*orig_db, true); + orig_db->performSubstitutions(controller_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_GuiControllerDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_GuiControllerDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_GuiController; } +}; + +afxEA_GuiControllerDesc afxEA_GuiControllerDesc::desc; + +bool afxEA_GuiControllerDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxGuiControllerData) == typeid(*db)); +} + +bool afxEA_GuiControllerDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_GuiText.cpp b/Engine/source/afx/ea/afxEA_GuiText.cpp new file mode 100644 index 000000000..7dfc77422 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_GuiText.cpp @@ -0,0 +1,180 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxChoreographer.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/ce/afxGuiText.h" +#include "afx/ui/afxGuiTextHud.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_GuiText + +class afxEA_GuiText : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + enum { + UNDEFINED, + USER_TEXT, + SHAPE_NAME + }; + + afxGuiTextData* text_data; + S32 text_src; + LinearColorF text_clr; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_GuiText(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_GuiText::afxEA_GuiText() +{ + text_data = 0; + text_src = UNDEFINED; + text_clr.set(1,1,1,1); +} + +void afxEA_GuiText::ea_set_datablock(SimDataBlock* db) +{ + text_data = dynamic_cast(db); +} + +bool afxEA_GuiText::ea_start() +{ + if (!text_data) + { + Con::errorf("afxEA_GuiText::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + if (text_data->text_str == ST_NULLSTRING || text_data->text_str[0] == '\0') + { + Con::errorf("afxEA_GuiText::ea_start() -- empty text string."); + return false; + } + + text_clr = text_data->text_clr; + + if (dStricmp("#shapeName", text_data->text_str) == 0) + text_src = SHAPE_NAME; + else + text_src = USER_TEXT; + + return true; +} + +bool afxEA_GuiText::ea_update(F32 dt) +{ + switch (text_src) + { + case USER_TEXT: + { + LinearColorF temp_clr = text_clr; + if (do_fades) + temp_clr.alpha = fade_value; + afxGuiTextHud::addTextItem(updated_pos, text_data->text_str, temp_clr); + } + break; + case SHAPE_NAME: + { + const char* name = 0; + SceneObject* cons_obj = 0; + afxConstraint* pos_cons = getPosConstraint(); + if (pos_cons) + { + ShapeBase* shape = dynamic_cast(pos_cons->getSceneObject()); + if (shape) + { + name = shape->getShapeName(); + cons_obj = shape; + } + } + if (name && name[0] != '\0') + { + LinearColorF temp_clr = text_clr; + if (do_fades) + temp_clr.alpha = fade_value; + afxGuiTextHud::addTextItem(updated_pos, name, temp_clr, cons_obj); + } + } + break; + } + + return true; +} + +void afxEA_GuiText::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (text_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxGuiTextData* orig_db = text_data; + text_data = new afxGuiTextData(*orig_db, true); + orig_db->performSubstitutions(text_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_GuiTextDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_GuiTextDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_GuiText; } +}; + +afxEA_GuiTextDesc afxEA_GuiTextDesc::desc; + +bool afxEA_GuiTextDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxGuiTextData) == typeid(*db)); +} + +bool afxEA_GuiTextDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Light.cpp b/Engine/source/afx/ea/afxEA_Light.cpp new file mode 100644 index 000000000..fbb3c4c42 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Light.cpp @@ -0,0 +1,62 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "afx/ce/afxLight.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_LightDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_LightDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return 0; } +}; + +afxEA_LightDesc afxEA_LightDesc::desc; + +bool afxEA_LightDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxLightData) == typeid(*db)); +} + +bool afxEA_LightDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_MachineGun.cpp b/Engine/source/afx/ea/afxEA_MachineGun.cpp new file mode 100644 index 000000000..0db257b87 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_MachineGun.cpp @@ -0,0 +1,207 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxProjectile.h" +#include "afx/ce/afxMachineGun.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_MachineGun + +class afxEA_MachineGun : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxMachineGunData* gun_data; + ProjectileData* bullet_data; + + bool shooting; + F32 start_time; + F32 shot_gap; + S32 shot_count; + + void launch_projectile(); + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_MachineGun(); + /*D*/ ~afxEA_MachineGun(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_MachineGun::afxEA_MachineGun() +{ + gun_data = 0; + bullet_data = 0; + shooting = false; + start_time = 0.0f; + shot_count = 0; + shot_gap = 0.2f; +} + +afxEA_MachineGun::~afxEA_MachineGun() +{ + if (gun_data && gun_data->isTempClone()) + delete gun_data; + gun_data = 0; +} + +void afxEA_MachineGun::ea_set_datablock(SimDataBlock* db) +{ + gun_data = dynamic_cast(db); + if (gun_data) + bullet_data = gun_data->projectile_data; +} + +bool afxEA_MachineGun::ea_start() +{ + if (!gun_data) + { + Con::errorf("afxEA_MachineGun::ea_start() -- missing or incompatible datablock."); + return false; + } + if (!bullet_data) + { + Con::errorf("afxEA_MachineGun::ea_start() -- missing or incompatible ProjectileData."); + return false; + } + + do_runtime_substitutions(); + + if (gun_data->rounds_per_minute > 0) + shot_gap = 60.0f/gun_data->rounds_per_minute; + + return true; +} + +bool afxEA_MachineGun::ea_update(F32 dt) +{ + if (!shooting) + { + start_time = elapsed; + shooting = true; + } + else + { + F32 next_shot = start_time + (shot_count+1)*shot_gap; + while (next_shot < elapsed) + { + if (in_scope) + launch_projectile(); + next_shot += shot_gap; + shot_count++; + } + } + + return true; +} + +void afxEA_MachineGun::ea_finish(bool was_stopped) +{ +} + +void afxEA_MachineGun::launch_projectile() +{ + afxProjectile* projectile = new afxProjectile(); + + ProjectileData* next_bullet = bullet_data; + + if (bullet_data->getSubstitutionCount() > 0) + { + next_bullet = new ProjectileData(*bullet_data, true); + bullet_data->performSubstitutions(next_bullet, choreographer, group_index); + } + + projectile->onNewDataBlock(next_bullet, false); + + F32 muzzle_vel = next_bullet->muzzleVelocity; + + afxConstraint* pos_cons = getPosConstraint(); + ShapeBase* src_obj = (pos_cons) ? (dynamic_cast(pos_cons->getSceneObject())) : 0; + + Point3F dir_vec = updated_aim - updated_pos; + dir_vec.normalizeSafe(); + dir_vec *= muzzle_vel; + projectile->init(updated_pos, dir_vec, src_obj); + if (!projectile->registerObject()) + { + delete projectile; + projectile = 0; + Con::errorf("afxEA_MachineGun::launch_projectile() -- projectile failed to register."); + } + if (projectile) + projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); +} + +void afxEA_MachineGun::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (gun_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxMachineGunData* orig_db = gun_data; + gun_data = new afxMachineGunData(*orig_db, true); + orig_db->performSubstitutions(gun_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_MachineGunDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_MachineGunDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_MachineGun; } +}; + +afxEA_MachineGunDesc afxEA_MachineGunDesc::desc; + +bool afxEA_MachineGunDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxMachineGunData) == typeid(*db)); +} + +bool afxEA_MachineGunDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Model.cpp b/Engine/source/afx/ea/afxEA_Model.cpp new file mode 100644 index 000000000..23179ebe4 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Model.cpp @@ -0,0 +1,255 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "ts/tsShapeInstance.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/afxResidueMgr.h" +#include "afx/ce/afxModel.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Model -- This is the adapter for afxModel, a lightweight animated model effect. + +class afxEA_Model : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxModelData* model_data; + afxModel* model; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Model(); + /*D*/ ~afxEA_Model(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void ea_set_scope_status(bool flag); + virtual void onDeleteNotify(SimObject*); + + virtual void getUpdatedBoxCenter(Point3F& pos); + + virtual TSShape* getTSShape(); + virtual TSShapeInstance* getTSShapeInstance(); + virtual SceneObject* ea_get_scene_object() const; + virtual U32 ea_get_triggers() const; + + virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans); + virtual void resetAnimation(U32 tag); + virtual F32 getAnimClipDuration(const char* clip); +}; + + +afxEA_Model::afxEA_Model() +{ + model_data = 0; + model = 0; +} + +afxEA_Model::~afxEA_Model() +{ + if (model) + model->deleteObject(); + if (model_data && model_data->isTempClone()) + delete model_data; + model_data = 0; +} + +void afxEA_Model::ea_set_datablock(SimDataBlock* db) +{ + model_data = dynamic_cast(db); +} + +bool afxEA_Model::ea_start() +{ + if (!model_data) + { + Con::errorf("afxEA_Model::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + return true; +} + +bool afxEA_Model::ea_update(F32 dt) +{ + if (!model) + { + // create and register effect + model = new afxModel(); + model->onNewDataBlock(model_data, false); + if (!model->registerObject()) + { + delete model; + model = 0; + Con::errorf("afxEA_Model::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(model); + + model->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); + model->setSortPriority(datablock->sort_priority); + } + + if (model) + { + if (do_fades) + { + model->setFadeAmount(fade_value); + } + model->setTransform(updated_xfm); + model->setScale(updated_scale); + } + + return true; +} + +void afxEA_Model::ea_finish(bool was_stopped) +{ + if (!model) + return; + + if (in_scope && ew_timing.residue_lifetime > 0) + { + clearNotify(model); + afxResidueMgr::add(ew_timing.residue_lifetime, ew_timing.residue_fadetime, model); + model = 0; + } + else + { + model->deleteObject(); + model = 0; + } +} + +void afxEA_Model::ea_set_scope_status(bool in_scope) +{ + if (model) + model->setVisibility(in_scope); +} + +void afxEA_Model::onDeleteNotify(SimObject* obj) +{ + if (model == dynamic_cast(obj)) + model = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_Model::getUpdatedBoxCenter(Point3F& pos) +{ + if (model) + pos = model->getBoxCenter(); +} + +TSShape* afxEA_Model::getTSShape() +{ + return (model) ? model->getTSShape() : 0; +} + +TSShapeInstance* afxEA_Model::getTSShapeInstance() +{ + return (model) ? model->getTSShapeInstance() : 0; +} + +SceneObject* afxEA_Model::ea_get_scene_object() const +{ + return model; +} + +U32 afxEA_Model::ea_get_triggers() const +{ + TSShapeInstance* shape_inst = model->getTSShapeInstance(); + return (shape_inst) ? shape_inst->getTriggerStateMask() : 0; +} + +void afxEA_Model::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (model_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxModelData* orig_db = model_data; + model_data = new afxModelData(*orig_db, true); + orig_db->performSubstitutions(model_data, choreographer, group_index); + } +} + +U32 afxEA_Model::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans) +{ + return (model) ? model->setAnimClip(clip, pos, rate, trans) : 0; +} + +void afxEA_Model::resetAnimation(U32 tag) +{ + if (model) + model->resetAnimation(tag); +} + +F32 afxEA_Model::getAnimClipDuration(const char* clip) +{ + return (model) ? model->getAnimClipDuration(clip) : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ModelDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ModelDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_Model; } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_ModelDesc afxEA_ModelDesc::desc; + +bool afxEA_ModelDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxModelData) == typeid(*db)); +} + +bool afxEA_ModelDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Mooring.cpp b/Engine/source/afx/ea/afxEA_Mooring.cpp new file mode 100644 index 000000000..a4e8743ee --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Mooring.cpp @@ -0,0 +1,188 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxMooring.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Mooring + +class afxEA_Mooring : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxMooringData* mooring_data; + afxMooring* obj; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Mooring(); + /*D*/ ~afxEA_Mooring(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_Mooring::afxEA_Mooring() +{ + mooring_data = 0; + obj = 0; +} + +afxEA_Mooring::~afxEA_Mooring() +{ + if (obj) + obj->deleteObject(); + if (mooring_data && mooring_data->isTempClone()) + delete mooring_data; + mooring_data = 0; +} + +void afxEA_Mooring::ea_set_datablock(SimDataBlock* db) +{ + mooring_data = dynamic_cast(db); +} + +bool afxEA_Mooring::ea_start() +{ + if (!mooring_data) + { + Con::errorf("afxEA_Mooring::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + return true; +} + +bool afxEA_Mooring::ea_update(F32 dt) +{ + if (!obj) + { + if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) + { + obj = new afxMooring(mooring_data->networking, + choreographer->getChoreographerId(), + datablock->effect_name); + } + else + { + obj = new afxMooring(mooring_data->networking, 0, ST_NULLSTRING); + } + + obj->onNewDataBlock(mooring_data, false); + if (!obj->registerObject()) + { + delete obj; + obj = 0; + Con::errorf("afxEA_Mooring::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(obj); + } + + if (obj) + { + obj->setTransform(updated_xfm); + } + + return true; +} + +void afxEA_Mooring::ea_finish(bool was_stopped) +{ +} + +void afxEA_Mooring::onDeleteNotify(SimObject* obj) +{ + if (this->obj == obj) + obj = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_Mooring::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (mooring_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxMooringData* orig_db = mooring_data; + mooring_data = new afxMooringData(*orig_db, true); + orig_db->performSubstitutions(mooring_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_MooringDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_MooringDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const; + virtual bool runsOnClient(const afxEffectWrapperData*) const; + + virtual afxEffectWrapper* create() const { return new afxEA_Mooring; } +}; + +afxEA_MooringDesc afxEA_MooringDesc::desc; + +bool afxEA_MooringDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxMooringData) == typeid(*db)); +} + +bool afxEA_MooringDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +bool afxEA_MooringDesc::runsOnServer(const afxEffectWrapperData* ew) const +{ + U8 networking = ((const afxMooringData*)ew->effect_data)->networking; + return ((networking & CLIENT_ONLY) == 0); +} + +bool afxEA_MooringDesc::runsOnClient(const afxEffectWrapperData* ew) const +{ + U8 networking = ((const afxMooringData*)ew->effect_data)->networking; + return ((networking & CLIENT_ONLY) != 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_MultiLight.cpp b/Engine/source/afx/ea/afxEA_MultiLight.cpp new file mode 100644 index 000000000..b42a37cd5 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_MultiLight.cpp @@ -0,0 +1,62 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "afx/ce/afxLight.h" +#include "afx/ce/afxMultiLight.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_MultiLightDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_MultiLightDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return 0; } +}; + +afxEA_MultiLightDesc afxEA_MultiLightDesc::desc; + +bool afxEA_MultiLightDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxMultiLightData) == typeid(*db)); +} + +bool afxEA_MultiLightDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp b/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp new file mode 100644 index 000000000..7f289b893 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp @@ -0,0 +1,337 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#if defined(STOCK_TGE_PARTICLES) +#include "game/fx/particleEngine.h" +#else +#include "afx/ce/afxParticleEmitter.h" +#endif + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ea/afxEA_ParticleEmitter.h" +#include "afx/util/afxParticlePool.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_ParticleEmitter + +afxEA_ParticleEmitter::afxEA_ParticleEmitter() +{ + emitter_data = 0; + emitter = 0; + do_bbox_update = false; +} + +afxEA_ParticleEmitter::~afxEA_ParticleEmitter() +{ + if (emitter) + { + clearNotify(emitter); + emitter->deleteWhenEmpty(); + emitter = 0; + } +} + +void afxEA_ParticleEmitter::ea_set_datablock(SimDataBlock* db) +{ + emitter_data = dynamic_cast(db); +} + +bool afxEA_ParticleEmitter::ea_start() +{ + if (!emitter_data) + { + Con::errorf("afxEA_ParticleEmitter::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + +#if defined(STOCK_TGE_PARTICLES) + emitter = new ParticleEmitter(); + emitter->onNewDataBlock(emitter_data); +#else + afxParticleEmitterData* afx_emitter_db = dynamic_cast(emitter_data); + if (afx_emitter_db) + { + if (dynamic_cast(emitter_data)) + { + afxParticleEmitterVector* pe = new afxParticleEmitterVector(); + pe->onNewDataBlock(afx_emitter_db, false); + pe->setAFXOwner(choreographer); + emitter = pe; + } + else if (dynamic_cast(emitter_data)) + { + afxParticleEmitterCone* pe = new afxParticleEmitterCone(); + pe->onNewDataBlock(afx_emitter_db, false); + pe->setAFXOwner(choreographer); + emitter = pe; + } + else if (dynamic_cast(emitter_data)) + { + afxParticleEmitterPath* pe = new afxParticleEmitterPath(); + pe->onNewDataBlock(afx_emitter_db, false); + pe->setAFXOwner(choreographer); + emitter = pe; + } + else if (dynamic_cast(emitter_data)) + { + afxParticleEmitterDisc* pe = new afxParticleEmitterDisc(); + pe->onNewDataBlock(afx_emitter_db, false); + pe->setAFXOwner(choreographer); + emitter = pe; + } + } + else + { + emitter = new ParticleEmitter(); + emitter->onNewDataBlock(emitter_data, false); + } +#endif + +#if defined(AFX_CAP_PARTICLE_POOLS) + // here we find or create any required particle-pools + if (emitter_data->pool_datablock) + { + afxParticlePool* pool = choreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index); + if (!pool) + { + afxParticlePoolData* pool_data = emitter_data->pool_datablock; + if (pool_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxParticlePoolData* orig_db = pool_data; + pool_data = new afxParticlePoolData(*orig_db, true); + orig_db->performSubstitutions(pool_data, choreographer, group_index); + } + + pool = new afxParticlePool(); + pool->onNewDataBlock(pool_data, false); + pool->setKeyBlock(emitter_data->pool_datablock, emitter_data->pool_index); + if (!pool->registerObject()) + { + Con::errorf("afxEA_ParticleEmitter::ea_start() -- Failed to register Particle Pool."); + delete pool; + pool = 0; + } + if (pool) + { + pool->setChoreographer(choreographer); + choreographer->registerParticlePool(pool); + } + } + if (pool) + emitter->setPool(pool); + } +#endif + + if (!emitter->registerObject()) + { + delete emitter; + emitter = NULL; + Con::errorf("afxEA_ParticleEmitter::ea_start() -- effect failed to register."); + return false; + } + + if (datablock->forced_bbox.isValidBox()) + { + do_bbox_update = true; + } + + emitter->setSortPriority(datablock->sort_priority); + deleteNotify(emitter); + + return true; +} + +bool afxEA_ParticleEmitter::ea_update(F32 dt) +{ + if (emitter && in_scope) + { + if (do_bbox_update) + { + Box3F bbox = emitter->getObjBox(); + + bbox.minExtents = updated_pos + datablock->forced_bbox.minExtents; + bbox.maxExtents = updated_pos + datablock->forced_bbox.maxExtents; + + emitter->setForcedObjBox(bbox); + emitter->setTransform(emitter->getTransform()); + + if (!datablock->update_forced_bbox) + do_bbox_update = false; + } + + if (do_fades) + emitter->setFadeAmount(fade_value); + + emitter->emitParticlesExt(updated_xfm, updated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000)); + } + + return true; +} + +void afxEA_ParticleEmitter::ea_finish(bool was_stopped) +{ + if (arcaneFX::isShutdown()) + return; + + if (emitter) + { + // make sure particles are fully faded. + // note - fully faded particles are not always + // invisible, so they are still kept alive and + // deleted via deleteWhenEmpty(). + if (ew_timing.fade_out_time > 0.0f) + emitter->setFadeAmount(0.0f); + if (dynamic_cast(emitter)) + ((afxParticleEmitter*)emitter)->setAFXOwner(0); + clearNotify(emitter); + emitter->deleteWhenEmpty(); + emitter = 0; + } +} + +void afxEA_ParticleEmitter::do_runtime_substitutions() +{ + bool clone_particles = false; + for (S32 i = 0; i < emitter_data->particleDataBlocks.size(); i++) + { + if (emitter_data->particleDataBlocks[i] && (emitter_data->particleDataBlocks[i]->getSubstitutionCount() > 0)) + { + clone_particles = true; + break; + } + } + + if (clone_particles || (emitter_data->getSubstitutionCount() > 0)) + { + afxParticleEmitterData* afx_emitter_db = dynamic_cast(emitter_data); + if (afx_emitter_db) + { + if (dynamic_cast(emitter_data)) + { + afxParticleEmitterVectorData* orig_db = (afxParticleEmitterVectorData*)emitter_data; + emitter_data = new afxParticleEmitterVectorData(*orig_db, true); + orig_db->performSubstitutions(emitter_data, choreographer, group_index); + } + else if (dynamic_cast(emitter_data)) + { + afxParticleEmitterConeData* orig_db = (afxParticleEmitterConeData*)emitter_data; + emitter_data = new afxParticleEmitterConeData(*orig_db, true); + orig_db->performSubstitutions(emitter_data, choreographer, group_index); + } + else if (dynamic_cast(emitter_data)) + { + afxParticleEmitterPathData* orig_db = (afxParticleEmitterPathData*)emitter_data; + emitter_data = new afxParticleEmitterPathData(*orig_db, true); + orig_db->performSubstitutions(emitter_data, choreographer, group_index); + } + else if (dynamic_cast(emitter_data)) + { + afxParticleEmitterDiscData* orig_db = (afxParticleEmitterDiscData*)emitter_data; + emitter_data = new afxParticleEmitterDiscData(*orig_db, true); + orig_db->performSubstitutions(emitter_data, choreographer, group_index); + } + } + else + { + ParticleEmitterData* orig_db = emitter_data; + emitter_data = new ParticleEmitterData(*orig_db, true); + orig_db->performSubstitutions(emitter_data, choreographer, group_index); + } + + if (clone_particles) + { + for (S32 i = 0; i < emitter_data->particleDataBlocks.size(); i++) + { + if (emitter_data->particleDataBlocks[i] && (emitter_data->particleDataBlocks[i]->getSubstitutionCount() > 0)) + { + // clone the datablock and perform substitutions + ParticleData* orig_db = emitter_data->particleDataBlocks[i]; + emitter_data->particleDataBlocks[i] = new ParticleData(*orig_db, true); + orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], choreographer, group_index); + } + } + } + } +} + +void afxEA_ParticleEmitter::onDeleteNotify(SimObject* obj) +{ + if (emitter == dynamic_cast(obj)) + emitter = 0; + + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ParticleEmitterDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ParticleEmitterDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_ParticleEmitter; } +}; + +afxEA_ParticleEmitterDesc afxEA_ParticleEmitterDesc::desc; + +bool afxEA_ParticleEmitterDesc::testEffectType(const SimDataBlock* db) const +{ +#if defined(STOCK_TGE_PARTICLES) + return (typeid(ParticleEmitterData) == typeid(*db)); +#else + if (typeid(ParticleEmitterData) == typeid(*db)) + return true; + if (typeid(afxParticleEmitterVectorData) == typeid(*db)) + return true; + if (typeid(afxParticleEmitterConeData) == typeid(*db)) + return true; + if (typeid(afxParticleEmitterPathData) == typeid(*db)) + return true; + if (typeid(afxParticleEmitterDiscData) == typeid(*db)) + return true; + + return false; +#endif +} + +bool afxEA_ParticleEmitterDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_ParticleEmitter.h b/Engine/source/afx/ea/afxEA_ParticleEmitter.h new file mode 100644 index 000000000..cf16f2c98 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_ParticleEmitter.h @@ -0,0 +1,67 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_EA_PARTICLE_EMITTER_H_ +#define _AFX_EA_PARTICLE_EMITTER_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/afxEffectWrapper.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_ParticleEmitter + +class ParticleEmitter; +class ParticleEmitterData; + +class afxEA_ParticleEmitter : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + bool do_bbox_update; + ParticleEmitterData* emitter_data; + + void do_runtime_substitutions(); + +public: + ParticleEmitter* emitter; + + /*C*/ afxEA_ParticleEmitter(); + /*D*/ ~afxEA_ParticleEmitter(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual bool ea_is_enabled() { return true; } + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + +#endif // _AFX_EA_PARTICLE_EMITTER_H_ diff --git a/Engine/source/afx/ea/afxEA_PhraseEffect.cpp b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp new file mode 100644 index 000000000..4448e1967 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp @@ -0,0 +1,385 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "console/compiler.h" +#include "T3D/player.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxPhrase.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxPhraseEffect.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_PhraseEffect + +class afxEA_PhraseEffect : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxPhraseEffectData* phrase_fx_data; + Vector* active_phrases; + U32 last_trigger_mask; + + Vector _phrases_a; + Vector _phrases_b; + + void grab_constraint_triggers(U32& trigger_mask); + void grab_player_triggers(U32& trigger_mask); + + void do_runtime_substitutions(); + void trigger_new_phrase(); + void update_active_phrases(F32 dt); + void cleanup_finished_phrases(); + +public: + /*C*/ afxEA_PhraseEffect(); + /*D*/ ~afxEA_PhraseEffect(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual bool ea_is_enabled() { return true; } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_PhraseEffect::afxEA_PhraseEffect() +{ + phrase_fx_data = 0; + active_phrases = &_phrases_a; +} + +afxEA_PhraseEffect::~afxEA_PhraseEffect() +{ + if (phrase_fx_data && phrase_fx_data->isTempClone()) + delete phrase_fx_data; + phrase_fx_data = 0; + + for (S32 i = 0; i < _phrases_a.size(); i++) + { + if (_phrases_a[i]) + delete _phrases_a[i]; + } + + for (S32 i = 0; i < _phrases_b.size(); i++) + { + if (_phrases_b[i]) + delete _phrases_b[i]; + } +} + +void afxEA_PhraseEffect::ea_set_datablock(SimDataBlock* db) +{ + phrase_fx_data = dynamic_cast(db); +} + +bool afxEA_PhraseEffect::ea_start() +{ + if (!phrase_fx_data) + { + Con::errorf("afxEA_PhraseEffect::ea_start() -- missing or incompatible datablock."); + return false; + } + + //last_trigger_mask = choreographer->getTriggerMask(); + last_trigger_mask = 0xffffffff; + + return true; +} + +void afxEA_PhraseEffect::grab_constraint_triggers(U32& trigger_mask) +{ + afxConstraint* pos_cons = getPosConstraint(); + if (pos_cons) + trigger_mask |= pos_cons->getTriggers(); +} + +void afxEA_PhraseEffect::grab_player_triggers(U32& trigger_mask) +{ + afxConstraint* pos_cons = getPosConstraint(); + Player* player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; + if (player) + { + if (player->isClientObject()) + trigger_mask |= player->getClientEventTriggers(); + else + trigger_mask |= player->getServerEventTriggers(); + } +} + +bool afxEA_PhraseEffect::ea_update(F32 dt) +{ + if (fade_value >= 1.0f) + { + // + // Choreographer Triggers: + // These triggers can come from the choreographer owning this effect. + // They must be set explicitly by calls to afxChoreographer + // console-methods, setTriggerBit(), or clearTriggerBit(). + // + U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : choreographer->getTriggerMask(); + + // + // Constraint Triggers: + // These triggers can come from the position contraint if it is: + // -- a TSStatic or ShapeBase derived object with dts triggers. + // -- a trigger producing effect such as afxModel. + // + if (!phrase_fx_data->no_cons_trigs) + grab_constraint_triggers(trigger_mask); + + // + // Player Triggers: + // These triggers can come from the position contraint if it is + // a Player or Player-derived object. + // + if (!phrase_fx_data->no_player_trigs) + grab_player_triggers(trigger_mask); + + // any change in the triggers? + if (trigger_mask != last_trigger_mask) + { + if (phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS) + { + bool last_state, new_state; + if (phrase_fx_data->match_type == afxPhraseEffectData::MATCH_ANY) + { + last_state = ((last_trigger_mask & phrase_fx_data->trigger_mask) != 0); + new_state = ((trigger_mask & phrase_fx_data->trigger_mask) != 0); + } + else + { + last_state = ((last_trigger_mask & phrase_fx_data->trigger_mask) == phrase_fx_data->trigger_mask); + new_state = ((trigger_mask & phrase_fx_data->trigger_mask) == phrase_fx_data->trigger_mask); + } + if (new_state != last_state) + { + bool state_on = phrase_fx_data->match_state & afxPhraseEffectData::STATE_ON; + if (new_state == state_on) // start trigger + { + trigger_new_phrase(); + } + else // stop trigger + { + for (S32 i = 0; i < active_phrases->size(); i++) + { + (*active_phrases)[i]->stop(life_elapsed); + } + } + } + } + else // if (phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_TRIGGERED) + { + bool did_trigger = false; + U32 changed_bits = (last_trigger_mask ^ trigger_mask); + + if ((phrase_fx_data->match_state & afxPhraseEffectData::STATE_ON) != 0) + { + // check for trigger bits that just switched to on state + U32 changed_on_bits = (changed_bits & trigger_mask); + if (phrase_fx_data->match_type == afxPhraseEffectData::MATCH_ANY) + did_trigger = ((changed_on_bits & phrase_fx_data->trigger_mask) != 0); + else + did_trigger = ((changed_on_bits & phrase_fx_data->trigger_mask) == phrase_fx_data->trigger_mask); + } + + if (!did_trigger && ((phrase_fx_data->match_state & afxPhraseEffectData::STATE_OFF) != 0)) + { + // check for trigger bits that just switched to off state + U32 changed_off_bits = (changed_bits & last_trigger_mask); + if (phrase_fx_data->match_type == afxPhraseEffectData::MATCH_ANY) + did_trigger = ((changed_off_bits & phrase_fx_data->trigger_mask) != 0); + else + did_trigger = ((changed_off_bits & phrase_fx_data->trigger_mask) == phrase_fx_data->trigger_mask); + } + + if (did_trigger) + trigger_new_phrase(); + } + + last_trigger_mask = trigger_mask; + } + } + + update_active_phrases(dt); + + cleanup_finished_phrases(); + + return true; +} + +void afxEA_PhraseEffect::ea_finish(bool was_stopped) +{ + for (S32 i = 0; i < active_phrases->size(); i++) + { + (*active_phrases)[i]->stop(life_elapsed); + } +} + +void afxEA_PhraseEffect::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (phrase_fx_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxPhraseEffectData* orig_db = phrase_fx_data; + phrase_fx_data = new afxPhraseEffectData(*orig_db, true); + orig_db->performSubstitutions(phrase_fx_data, choreographer, group_index); + } +} + +void afxEA_PhraseEffect::trigger_new_phrase() +{ + //afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), /*willStop=*/false); + bool will_stop = phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS; + afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), will_stop); + phrase->init(phrase_fx_data->fx_list, datablock->ewd_timing.lifetime, choreographer, time_factor, phrase_fx_data->n_loops, group_index); + phrase->start(0, 0); + if (phrase->isEmpty()) + { + delete phrase; + return; + } + + if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING) + { + char obj_str[32]; + dStrcpy(obj_str, Con::getIntArg(choreographer->getId())); + + char index_str[32]; + dStrcpy(index_str, Con::getIntArg(group_index)); + + char buffer[1024]; + char* b = buffer; + const char* v = phrase_fx_data->on_trig_cmd; + while (*v != '\0') + { + if (v[0] == '%' && v[1] == '%') + { + const char* s = obj_str; + while (*s != '\0') + { + b[0] = s[0]; + b++; + s++; + } + v += 2; + } + else if (v[0] == '#' && v[1] == '#') + { + const char* s = index_str; + while (*s != '\0') + { + b[0] = s[0]; + b++; + s++; + } + v += 2; + } + else + { + b[0] = v[0]; + b++; + v++; + } + } + b[0] = '\0'; + + Compiler::gSyntaxError = false; + //Con::errorf("EVAL [%s]", avar("%s;", buffer)); + Con::evaluate(avar("%s;", buffer), false, 0); + if (Compiler::gSyntaxError) + { + Con::errorf("onTriggerCommand \"%s\" -- syntax error", phrase_fx_data->on_trig_cmd); + Compiler::gSyntaxError = false; + } + } + + active_phrases->push_back(phrase); +} + +void afxEA_PhraseEffect::update_active_phrases(F32 dt) +{ + for (S32 i = 0; i < active_phrases->size(); i++) + { + afxPhrase* phrase = (*active_phrases)[i]; + if (phrase->expired(life_elapsed)) + phrase->recycle(life_elapsed); + phrase->update(dt, life_elapsed); + } +} + +void afxEA_PhraseEffect::cleanup_finished_phrases() +{ + Vector* surviving_phrases = (active_phrases == &_phrases_a) ? &_phrases_b : &_phrases_a; + + surviving_phrases->clear(); + for (S32 i = 0; i < active_phrases->size(); i++) + { + afxPhrase* phrase = (*active_phrases)[i]; + if (!phrase->isEmpty()) + surviving_phrases->push_back(phrase); + else + delete phrase; + } + + active_phrases->clear(); + active_phrases = surviving_phrases; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_PhraseEffectDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_PhraseEffectDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_PhraseEffect; } +}; + +afxEA_PhraseEffectDesc afxEA_PhraseEffectDesc::desc; + +bool afxEA_PhraseEffectDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxPhraseEffectData) == typeid(*db)); +} + +bool afxEA_PhraseEffectDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_PhysicalZone.cpp b/Engine/source/afx/ea/afxEA_PhysicalZone.cpp new file mode 100644 index 000000000..02012c358 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_PhysicalZone.cpp @@ -0,0 +1,226 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/physicalZone.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxPhysicalZone.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_PhysicalZone + +class afxEA_PhysicalZone : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxPhysicalZoneData* zone_data; + PhysicalZone* physical_zone; + SceneObject* cons_obj; + + void do_runtime_substitutions(); + void set_cons_object(SceneObject*); + +public: + /*C*/ afxEA_PhysicalZone(); + /*D*/ ~afxEA_PhysicalZone(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void ea_set_scope_status(bool flag); + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_PhysicalZone::afxEA_PhysicalZone() +{ + zone_data = 0; + physical_zone = 0; + cons_obj = 0; +} + +afxEA_PhysicalZone::~afxEA_PhysicalZone() +{ + if (physical_zone) + physical_zone->deleteObject(); + if (zone_data && zone_data->isTempClone()) + delete zone_data; + zone_data = 0; +} + +void afxEA_PhysicalZone::ea_set_datablock(SimDataBlock* db) +{ + zone_data = dynamic_cast(db); +} + +bool afxEA_PhysicalZone::ea_start() +{ + if (!zone_data) + { + Con::errorf("afxEA_PhysicalZone::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + return true; +} + +bool afxEA_PhysicalZone::ea_update(F32 dt) +{ + if (!physical_zone) + { + // create and register effect + physical_zone = new PhysicalZone(); + physical_zone->mVelocityMod = zone_data->mVelocityMod; + physical_zone->mGravityMod = zone_data->mGravityMod; + physical_zone->mAppliedForce = zone_data->mAppliedForce; + physical_zone->force_type = zone_data->force_type; + physical_zone->orient_force = zone_data->orient_force; + physical_zone->setField("polyhedron", zone_data->mPolyhedron); + + if (!physical_zone->registerObject()) + { + delete physical_zone; + physical_zone = 0; + Con::errorf("afxEA_PhysicalZone::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(physical_zone); + physical_zone->activate(); + } + + if (physical_zone) + { + if (zone_data->exclude_cons_obj) + { + afxConstraint* pos_constraint = getPosConstraint(); + set_cons_object((pos_constraint) ? pos_constraint->getSceneObject() : 0); + } + + if (do_fades) + physical_zone->setFadeAmount(fade_value); + physical_zone->setTransform(updated_xfm); + } + + return true; +} + +void afxEA_PhysicalZone::ea_finish(bool was_stopped) +{ + if (physical_zone) + { + set_cons_object(0); + physical_zone->deleteObject(); + physical_zone = 0; + } +} + +void afxEA_PhysicalZone::ea_set_scope_status(bool in_scope) +{ + if (physical_zone) + { + if (in_scope && !physical_zone->isActive()) + physical_zone->activate(); + else if (!in_scope && physical_zone->isActive()) + physical_zone->deactivate(); + } +} + +void afxEA_PhysicalZone::onDeleteNotify(SimObject* obj) +{ + if (physical_zone == dynamic_cast(obj)) + physical_zone = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_PhysicalZone::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (zone_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxPhysicalZoneData* orig_db = zone_data; + zone_data = new afxPhysicalZoneData(*orig_db, true); + orig_db->performSubstitutions(zone_data, choreographer, group_index); + } +} + +void afxEA_PhysicalZone::set_cons_object(SceneObject* new_obj) +{ + if (cons_obj == new_obj) + return; + + if (cons_obj) + { + physical_zone->unregisterExcludedObject(cons_obj); + //clearNotify(shape); + } + + cons_obj = new_obj; + + if (cons_obj) + { + //deleteNotify(shape); + physical_zone->registerExcludedObject(cons_obj); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_PhysicalZoneDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_PhysicalZoneDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_PhysicalZone; } +}; + +afxEA_PhysicalZoneDesc afxEA_PhysicalZoneDesc::desc; + +bool afxEA_PhysicalZoneDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxPhysicalZoneData) == typeid(*db)); +} + +bool afxEA_PhysicalZoneDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_PlayerMovement.cpp b/Engine/source/afx/ea/afxEA_PlayerMovement.cpp new file mode 100644 index 000000000..03aac77b2 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_PlayerMovement.cpp @@ -0,0 +1,170 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/player.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/ce/afxPlayerMovement.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_PlayerMovement + +class afxEA_PlayerMovement : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxPlayerMovementData* movement_data; + U32 tag; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_PlayerMovement(); + /*C*/ ~afxEA_PlayerMovement(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_PlayerMovement::afxEA_PlayerMovement() +{ + movement_data = 0; + tag = 0; +} + +afxEA_PlayerMovement::~afxEA_PlayerMovement() +{ + if (movement_data && movement_data->isTempClone()) + delete movement_data; + movement_data = 0; +} + +void afxEA_PlayerMovement::ea_set_datablock(SimDataBlock* db) +{ + movement_data = dynamic_cast(db); +} + +bool afxEA_PlayerMovement::ea_start() +{ + if (!movement_data) + { + Con::errorf("afxEA_PlayerMovement::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + tag = 0; + + afxConstraint* pos_cons = getPosConstraint(); + if (!pos_cons) + { + Con::warnf("afxEA_PlayerMovement::ea_start() -- missing position constraint."); + return false; + } + + Player* player = dynamic_cast(pos_cons->getSceneObject()); + if (!player) + { + Con::warnf("afxEA_PlayerMovement::ea_start() -- position constraint is not a Player."); + return false; + } + + // setup player overrides + if (movement_data->hasMovementOverride()) + tag = player->setMovementOverride(movement_data->speed_bias, &movement_data->movement, movement_data->movement_op); + else + tag = player->setMovementOverride(movement_data->speed_bias); + + return true; +} + +bool afxEA_PlayerMovement::ea_update(F32 dt) +{ + return true; +} + +void afxEA_PlayerMovement::ea_finish(bool was_stopped) +{ + afxConstraint* pos_cons = getPosConstraint(); + if (!pos_cons) + return; + + Player* player = dynamic_cast(pos_cons->getSceneObject()); + if (!player) + return; + + // restore player overrides + player->restoreMovement(tag); +} + +void afxEA_PlayerMovement::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (movement_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxPlayerMovementData* orig_db = movement_data; + movement_data = new afxPlayerMovementData(*orig_db, true); + orig_db->performSubstitutions(movement_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_PlayerMovementDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_PlayerMovementDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_PlayerMovement; } +}; + +afxEA_PlayerMovementDesc afxEA_PlayerMovementDesc::desc; + +bool afxEA_PlayerMovementDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxPlayerMovementData) == typeid(*db)); +} + +bool afxEA_PlayerMovementDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp b/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp new file mode 100644 index 000000000..08c446956 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp @@ -0,0 +1,184 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/player.h" + +#include "afx/afxChoreographer.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/ce/afxPlayerPuppet.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_PlayerPuppet + +class afxEA_PlayerPuppet : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxPlayerPuppetData* mover_data; + afxConstraint* obj_cons; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_PlayerPuppet(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual void getUnconstrainedPosition(Point3F& pos); + virtual void getUnconstrainedTransform(MatrixF& xfm); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_PlayerPuppet::afxEA_PlayerPuppet() +{ + mover_data = 0; + obj_cons = 0; +} + +void afxEA_PlayerPuppet::ea_set_datablock(SimDataBlock* db) +{ + mover_data = dynamic_cast(db); +} + +bool afxEA_PlayerPuppet::ea_start() +{ + if (!mover_data) + { + Con::errorf("afxEA_PlayerPuppet::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + afxConstraintID obj_id = cons_mgr->getConstraintId(mover_data->obj_def); + obj_cons = cons_mgr->getConstraint(obj_id); + + Player* player = dynamic_cast((obj_cons) ? obj_cons->getSceneObject() : 0); + if (player) + player->ignore_updates = true; + + return true; +} + +bool afxEA_PlayerPuppet::ea_update(F32 dt) +{ + SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0; + + if (obj && in_scope) + { + obj->setTransform(updated_xfm); + } + + return true; +} + +void afxEA_PlayerPuppet::ea_finish(bool was_stopped) +{ + Player* player = dynamic_cast((obj_cons) ? obj_cons->getSceneObject() : 0); + if (player) + { + player->resetContactTimer(); + player->ignore_updates = false; + } +} + +void afxEA_PlayerPuppet::getUnconstrainedPosition(Point3F& pos) +{ + SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0; + if (obj) + pos = obj->getRenderPosition(); + else + pos.zero(); +} + +void afxEA_PlayerPuppet::getUnconstrainedTransform(MatrixF& xfm) +{ + SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0; + if (obj) + xfm = obj->getRenderTransform(); + else + xfm.identity(); +} + +void afxEA_PlayerPuppet::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (mover_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxPlayerPuppetData* orig_db = mover_data; + mover_data = new afxPlayerPuppetData(*orig_db, true); + orig_db->performSubstitutions(mover_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_PlayerPuppetDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_PlayerPuppetDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const; + virtual bool runsOnClient(const afxEffectWrapperData*) const; + + virtual afxEffectWrapper* create() const { return new afxEA_PlayerPuppet; } +}; + +afxEA_PlayerPuppetDesc afxEA_PlayerPuppetDesc::desc; + +bool afxEA_PlayerPuppetDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxPlayerPuppetData) == typeid(*db)); +} + +bool afxEA_PlayerPuppetDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +bool afxEA_PlayerPuppetDesc::runsOnServer(const afxEffectWrapperData* ew) const +{ + U8 networking = ((const afxPlayerPuppetData*)ew->effect_data)->networking; + return ((networking & (SERVER_ONLY | SERVER_AND_CLIENT)) != 0); +} + +bool afxEA_PlayerPuppetDesc::runsOnClient(const afxEffectWrapperData* ew) const +{ + U8 networking = ((const afxPlayerPuppetData*)ew->effect_data)->networking; + return ((networking & (CLIENT_ONLY | SERVER_AND_CLIENT)) != 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp new file mode 100644 index 000000000..3035da8d3 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp @@ -0,0 +1,289 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/pointLight.h" + +#include "afx/ce/afxPointLight_T3D.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_T3DPointLight + +class PointLightProxy; + +class afxEA_T3DPointLight : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxT3DPointLightData* light_data; + PointLightProxy* light; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_T3DPointLight(); + /*D*/ ~afxEA_T3DPointLight(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void ea_set_scope_status(bool flag); + virtual void onDeleteNotify(SimObject*); + virtual void getBaseColor(LinearColorF& color); + + virtual bool ea_is_enabled() { return true; } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class PointLightProxy : public PointLight +{ + F32 fade_amt; + +public: + PointLightProxy() { fade_amt = 1.0f; } + + void force_ghost() + { + mNetFlags.clear(Ghostable | ScopeAlways); + mNetFlags.set(IsGhost); + } + + void setFadeAmount(F32 fade_amt) + { + this->fade_amt = fade_amt; + mLight->setBrightness(mBrightness*fade_amt); + } + + void updateTransform(const MatrixF& xfm) + { + mLight->setTransform(xfm); + LightBase::setTransform(xfm); + } + + void initWithDataBlock(const afxT3DPointLightData* db) + { + mRadius = db->mRadius; + + mColor = db->mColor; + mBrightness = db->mBrightness; + mCastShadows = db->mCastShadows; + mPriority = db->mPriority; + mFlareData = db->mFlareData; + mAnimationData = db->mAnimationData; + mAnimState.active = (mAnimationData != 0); + + mLocalRenderViz = db->mLocalRenderViz; + + mLight->setType( LightInfo::Point ); + mLight->setBrightness( db->mBrightness ); + mLight->setRange( db->mRadius ); + mLight->setColor( db->mColor ); + mLight->setCastShadows( db->mCastShadows ); + mLight->setPriority( db->mPriority ); + + // Update the bounds and scale to fit our light. + mObjBox.minExtents.set( -1, -1, -1 ); + mObjBox.maxExtents.set( 1, 1, 1 ); + mObjScale.set( db->mRadius, db->mRadius, db->mRadius ); + + //_conformLights(); + } + + void setLiveColor(const LinearColorF& live_color) + { + mLight->setColor(live_color); + } + + void submitLights(LightManager* lm, bool staticLighting) + { + if (mAnimState.active && mAnimationData && fade_amt < 1.0f) + { + F32 mBrightness_save = mBrightness; + mBrightness *= fade_amt; + PointLight::submitLights(lm, staticLighting); + mBrightness = mBrightness_save; + return; + } + + PointLight::submitLights(lm, staticLighting); + } + +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_T3DPointLight::afxEA_T3DPointLight() +{ + light_data = 0; + light = 0; +} + +afxEA_T3DPointLight::~afxEA_T3DPointLight() +{ + if (light) + light->deleteObject(); + if (light_data && light_data->isTempClone()) + delete light_data; + light_data = 0; +} + +void afxEA_T3DPointLight::ea_set_datablock(SimDataBlock* db) +{ + light_data = dynamic_cast(db); +} + +bool afxEA_T3DPointLight::ea_start() +{ + if (!light_data) + { + Con::errorf("afxEA_T3DPointLight::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + // create and register effect + light = new PointLightProxy(); + light->force_ghost(); + if (!light->registerObject()) + { + delete light; + light = 0; + Con::errorf("afxEA_T3DPointLight::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(light); + + light->initWithDataBlock(light_data); + + return true; +} + +bool afxEA_T3DPointLight::ea_update(F32 dt) +{ + if (light) + { +#if 0 // AFX_T3D_DISABLED + // With sgLightObject lights, the following code block would hook + // the constraint object up to the light in case the light was + // configured to exclude it from flare occusions. The code remains + // here in case we need to implement the same feature for T3D light. + + afxConstraint* pos_cons = getPosConstraint(); + SceneObject* cons_obj = (pos_cons) ? pos_cons->getSceneObject() : 0; + light->setConstraintObject(cons_obj); +#endif + + light->setLiveColor(updated_color); + + if (do_fades) + light->setFadeAmount(fade_value*updated_scale.x); + + light->updateTransform(updated_xfm); + + // scale should not be updated this way. It messes up the culling. + //light->setScale(updated_scale); + } + + return true; +} + +void afxEA_T3DPointLight::ea_finish(bool was_stopped) +{ + if (light) + { + light->deleteObject(); + light = 0; + } +} + +void afxEA_T3DPointLight::ea_set_scope_status(bool in_scope) +{ + if (light) + light->setLightEnabled(in_scope); +} + +void afxEA_T3DPointLight::onDeleteNotify(SimObject* obj) +{ + if (light == dynamic_cast(obj)) + light = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_T3DPointLight::getBaseColor(LinearColorF& color) +{ + if (light_data) + color = light_data->mColor; +} + +void afxEA_T3DPointLight::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (light_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxT3DPointLightData* orig_db = light_data; + light_data = new afxT3DPointLightData(*orig_db, true); + orig_db->performSubstitutions(light_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_T3DPointLightDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_T3DPointLightDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_T3DPointLight; } +}; + +afxEA_T3DPointLightDesc afxEA_T3DPointLightDesc::desc; + +bool afxEA_T3DPointLightDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxT3DPointLightData) == typeid(*db)); +} + +bool afxEA_T3DPointLightDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Projectile.cpp b/Engine/source/afx/ea/afxEA_Projectile.cpp new file mode 100644 index 000000000..104d5abb2 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Projectile.cpp @@ -0,0 +1,315 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "lighting/lightInfo.h" +#include "T3D/projectile.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxProjectile.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Projectile + +class afxEA_Projectile : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + ProjectileData* projectile_data; + afxProjectileData* afx_projectile_data; + afxProjectile* projectile; + bool launched; + bool impacted; + bool projectile_done; + afxConstraint* launch_cons; + Point3F launch_dir_bias; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Projectile(); + /*D*/ ~afxEA_Projectile(); + + virtual bool isDone(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_Projectile::afxEA_Projectile() +{ + projectile_data = 0; + afx_projectile_data = 0; + projectile = 0; + launched = false; + impacted = false; + projectile_done = false; + launch_cons = 0; + launch_dir_bias.zero(); +} + +afxEA_Projectile::~afxEA_Projectile() +{ + if (projectile) + clearNotify(projectile); + //if (projectile_data && projectile_data->isTempClone()) + // delete projectile_data; + projectile_data = 0; + afx_projectile_data = 0; +} + +bool afxEA_Projectile::isDone() +{ + return (datablock->use_as_cons_obj || datablock->use_ghost_as_cons_obj) ? projectile_done : impacted; +} + +void afxEA_Projectile::ea_set_datablock(SimDataBlock* db) +{ + projectile_data = dynamic_cast(db); + afx_projectile_data = dynamic_cast(projectile_data); +} + +bool afxEA_Projectile::ea_start() +{ + if (!projectile_data) + { + Con::errorf("afxEA_Projectile::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + if (!afx_projectile_data) + { + projectile = new afxProjectile(); + } + else + { + if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) + projectile = new afxProjectile(afx_projectile_data->networking, choreographer->getChoreographerId(), datablock->effect_name); + else + projectile = new afxProjectile(afx_projectile_data->networking, 0, ST_NULLSTRING); + projectile->ignoreSourceTimeout = afx_projectile_data->ignore_src_timeout; + if (afx_projectile_data->override_collision_masks) + { + projectile->dynamicCollisionMask = afx_projectile_data->dynamicCollisionMask; + projectile->staticCollisionMask = afx_projectile_data->staticCollisionMask; + } + afxConstraintID launch_pos_id = cons_mgr->getConstraintId(afx_projectile_data->launch_pos_def); + launch_cons = cons_mgr->getConstraint(launch_pos_id); + launch_dir_bias = afx_projectile_data->launch_dir_bias; + } + + projectile->onNewDataBlock(projectile_data, false); + + return true; +} + +bool afxEA_Projectile::ea_update(F32 dt) +{ + if (!launched && projectile) + { + if (in_scope) + { + afxConstraint* pos_cons = getPosConstraint(); + ShapeBase* src_obj = (pos_cons) ? (dynamic_cast(pos_cons->getSceneObject())) : 0; + + F32 muzzle_vel = projectile_data->muzzleVelocity; + + Point3F dir_vec; + if (afx_projectile_data) + { + switch (afx_projectile_data->launch_dir_method) + { + case afxProjectileData::OrientConstraint: + dir_vec.set(0,0,1); + updated_xfm.mulV(dir_vec); + break; + case afxProjectileData::LaunchDirField: + dir_vec.set(0,0,1); + break; + case afxProjectileData::TowardPos2Constraint: + default: + dir_vec = updated_aim - updated_pos; + break; + } + } + else + dir_vec = updated_aim - updated_pos; + + dir_vec.normalizeSafe(); + if (!launch_dir_bias.isZero()) + { + dir_vec += launch_dir_bias; + dir_vec.normalizeSafe(); + } + dir_vec *= muzzle_vel; + + Point3F launch_pos; + if (launch_cons && launch_cons->getPosition(launch_pos)) + { + ShapeBase* launch_obj = (launch_cons) ? (dynamic_cast(launch_cons->getSceneObject())) : 0; + projectile->init(launch_pos, dir_vec, (launch_obj) ? launch_obj : src_obj); + } + else + projectile->init(updated_pos, dir_vec, src_obj); + + if (!projectile->registerObject()) + { + delete projectile; + projectile = 0; + Con::errorf("afxEA_Projectile::ea_update() -- effect failed to register."); + return false; + } + + deleteNotify(projectile); + + if (projectile) + projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); + + } + launched = true; + } + + if (launched && projectile) + { + if (in_scope) + { + updated_xfm = projectile->getRenderTransform(); + updated_xfm.getColumn(3, &updated_pos); + } + } + + return true; +} + +void afxEA_Projectile::ea_finish(bool was_stopped) +{ + if (projectile) + { + clearNotify(projectile); + projectile = 0; + } + launched = false; + impacted = false; +} + +void afxEA_Projectile::onDeleteNotify(SimObject* obj) +{ + // projectile deleted? + Projectile* del_projectile = dynamic_cast(obj); + if (del_projectile == projectile) + { + projectile = NULL; + projectile_done = true; + } +} + +void afxEA_Projectile::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (projectile_data->getSubstitutionCount() > 0) + { + if (typeid(afxProjectileData) == typeid(*projectile_data)) + { + afxProjectileData* orig_db = (afxProjectileData*)projectile_data; + afx_projectile_data = new afxProjectileData(*orig_db, true); + projectile_data = afx_projectile_data; + orig_db->performSubstitutions(projectile_data, choreographer, group_index); + } + else + { + // clone the datablock and perform substitutions + ProjectileData* orig_db = projectile_data; + afx_projectile_data = 0; + projectile_data = new ProjectileData(*orig_db, true); + orig_db->performSubstitutions(projectile_data, choreographer, group_index); + } + } +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ProjectileDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ProjectileDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const; + virtual bool runsOnClient(const afxEffectWrapperData*) const; + + virtual afxEffectWrapper* create() const { return new afxEA_Projectile; } +}; + +afxEA_ProjectileDesc afxEA_ProjectileDesc::desc; + +bool afxEA_ProjectileDesc::testEffectType(const SimDataBlock* db) const +{ + if (typeid(ProjectileData) == typeid(*db)) + return true; + if (typeid(afxProjectileData) == typeid(*db)) + return true; + return false; +} + +bool afxEA_ProjectileDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return ((ew->use_as_cons_obj || ew->use_ghost_as_cons_obj) && timing.lifetime < 0); +} + +bool afxEA_ProjectileDesc::runsOnServer(const afxEffectWrapperData* ew) const +{ + afxProjectileData* afx_projectile_data = dynamic_cast(ew->effect_data); + if (!afx_projectile_data) + return true; + + U8 networking = ((const afxProjectileData*)ew->effect_data)->networking; + return ((networking & CLIENT_ONLY) == 0); +} + +bool afxEA_ProjectileDesc::runsOnClient(const afxEffectWrapperData* ew) const +{ + afxProjectileData* afx_projectile_data = dynamic_cast(ew->effect_data); + if (!afx_projectile_data) + return false; + + U8 networking = ((const afxProjectileData*)ew->effect_data)->networking; + return ((networking & CLIENT_ONLY) != 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_ScriptEvent.cpp b/Engine/source/afx/ea/afxEA_ScriptEvent.cpp new file mode 100644 index 000000000..ca5de9966 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_ScriptEvent.cpp @@ -0,0 +1,145 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxScriptEvent.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_ScriptEvent + +class afxEA_ScriptEvent : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxScriptEventData* script_data; + bool ran_script; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_ScriptEvent(); + /*D*/ ~afxEA_ScriptEvent(); + + virtual bool isDone() { return ran_script; } + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_ScriptEvent::afxEA_ScriptEvent() +{ + script_data = 0; + ran_script = false; +} + +afxEA_ScriptEvent::~afxEA_ScriptEvent() +{ + if (script_data && script_data->isTempClone()) + delete script_data; + script_data = 0; +} + +void afxEA_ScriptEvent::ea_set_datablock(SimDataBlock* db) +{ + script_data = dynamic_cast(db); +} + +bool afxEA_ScriptEvent::ea_start() +{ + if (!script_data) + { + Con::errorf("afxEA_ScriptEvent::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + ran_script = (script_data->method_name == ST_NULLSTRING); + + return true; +} + +bool afxEA_ScriptEvent::ea_update(F32 dt) +{ + if (!ran_script && choreographer != NULL) + { + afxConstraint* pos_constraint = getPosConstraint(); + choreographer->executeScriptEvent(script_data->method_name, pos_constraint, updated_xfm, + script_data->script_data); + ran_script = true; + } + + return true; +} + +void afxEA_ScriptEvent::ea_finish(bool was_stopped) +{ + ran_script = false; +} + +void afxEA_ScriptEvent::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (script_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxScriptEventData* orig_db = script_data; + script_data = new afxScriptEventData(*orig_db, true); + orig_db->performSubstitutions(script_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ScriptEventDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ScriptEventDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const { return false; } + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + virtual bool isPositional(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_ScriptEvent; } +}; + +afxEA_ScriptEventDesc afxEA_ScriptEventDesc::desc; + +bool afxEA_ScriptEventDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxScriptEventData) == typeid(*db)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Sound.cpp b/Engine/source/afx/ea/afxEA_Sound.cpp new file mode 100644 index 000000000..3b7f69a88 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Sound.cpp @@ -0,0 +1,214 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "sfx/sfxSystem.h" +#include "sfx/sfxSource.h" +#include "sfx/sfxProfile.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Sound + +class afxEA_Sound : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + SFXProfile* sound_prof; + SFXDescription* sound_desc; + SFXSource* sound_handle; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Sound(); + /*D*/ ~afxEA_Sound(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual bool ea_is_enabled() { return true; } + + virtual void onDeleteNotify(SimObject*); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_Sound::afxEA_Sound() +{ + sound_prof = 0; + sound_desc = 0; + sound_handle = 0; +} + +afxEA_Sound::~afxEA_Sound() +{ + if (sound_prof && sound_prof->isTempClone()) + delete sound_prof; + sound_prof = 0; + sound_desc = 0; + sound_handle = 0; +} + +void afxEA_Sound::ea_set_datablock(SimDataBlock* db) +{ + sound_prof = dynamic_cast(db); + if (sound_prof) + sound_desc = sound_prof->getDescription(); +} + +bool afxEA_Sound::ea_start() +{ + if (!sound_prof) + { + Con::errorf("afxEA_Sound::ea_start() -- missing or incompatible AudioProfile."); + return false; + } + if (!sound_desc) + { + Con::errorf("afxEA_Sound::ea_start() -- missing or incompatible AudioDescriptor."); + return false; + } + + do_runtime_substitutions(); + + return true; +} + +bool afxEA_Sound::ea_update(F32 dt) +{ + if (!sound_handle) + { + sound_handle = SFX->createSource(sound_prof, &updated_xfm, 0); + if (sound_handle) + sound_handle->play(); + } + + if (sound_handle) + { + sound_handle->setTransform(updated_xfm); + sound_handle->setVolume((in_scope) ? updated_scale.x*fade_value : 0.0f); + deleteNotify(sound_handle); + } + + return true; +} + +void afxEA_Sound::ea_finish(bool was_stopped) +{ + if (sound_handle) + { + sound_handle->stop(); + SFX_DELETE(sound_handle); + } +} + +void afxEA_Sound::do_runtime_substitutions() +{ + sound_prof = sound_prof->cloneAndPerformSubstitutions(choreographer, group_index); + sound_desc = sound_prof->getDescription(); +} + +void afxEA_Sound::onDeleteNotify(SimObject* obj) +{ + if (sound_handle == dynamic_cast(obj)) + sound_handle = 0; + + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_SoundDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_SoundDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + virtual void prepEffect(afxEffectWrapperData*) const; + + virtual afxEffectWrapper* create() const { return new afxEA_Sound; } +}; + +afxEA_SoundDesc afxEA_SoundDesc::desc; + +bool afxEA_SoundDesc::testEffectType(const SimDataBlock* db) const +{ + // dynamic cast used here so that both SFXProfile and AudioProfile match + return (dynamic_cast(db) != 0); +} + +bool afxEA_SoundDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + SFXDescription* desc = ((SFXProfile*)ew->effect_data)->getDescription(); + return (desc && desc->mIsLooping) ? (timing.lifetime < 0) : false; +} + +void afxEA_SoundDesc::prepEffect(afxEffectWrapperData* ew) const +{ + if (ew->ewd_timing.lifetime < 0) + { + SFXProfile* snd = (SFXProfile*) ew->effect_data; + SFXDescription* desc = snd->getDescription(); + if (desc && !desc->mIsLooping) + { + static bool test_for_audio = true; + static bool can_get_audio_len = false; + + if (test_for_audio) + { + can_get_audio_len = true; + test_for_audio = false; + } + + if (can_get_audio_len) + { + SFXResource* sfx_rsrc = snd->getResource(); + if (sfx_rsrc) + { + ew->ewd_timing.lifetime = 0.001f*sfx_rsrc->getDuration(); + //Con::printf("SFX (%s) duration=%g", snd->mFilename, timing.lifetime); + } + } + else + { + ew->ewd_timing.lifetime = 0; + Con::printf("afxEA_SoundDesc::prepEffect() -- cannot get audio length from sound file."); + } + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp new file mode 100644 index 000000000..eebab60c8 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp @@ -0,0 +1,293 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "T3D/spotLight.h" + +#include "afx/ce/afxSpotLight_T3D.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_T3DSpotLight + +class SpotLightProxy; + +class afxEA_T3DSpotLight : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxT3DSpotLightData* light_data; + SpotLightProxy* light; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_T3DSpotLight(); + /*D*/ ~afxEA_T3DSpotLight(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void ea_set_scope_status(bool flag); + virtual void onDeleteNotify(SimObject*); + virtual void getBaseColor(LinearColorF& color); + + virtual bool ea_is_enabled() { return true; } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class SpotLightProxy : public SpotLight +{ + F32 fade_amt; + +public: + SpotLightProxy() { fade_amt = 1.0f; } + + void force_ghost() + { + mNetFlags.clear(Ghostable | ScopeAlways); + mNetFlags.set(IsGhost); + } + + void setFadeAmount(F32 fade_amt) + { + this->fade_amt = fade_amt; + mLight->setBrightness(mBrightness*fade_amt); + } + + void updateTransform(const MatrixF& xfm) + { + mLight->setTransform(xfm); + LightBase::setTransform(xfm); + } + + void initWithDataBlock(const afxT3DSpotLightData* db) + { + mRange = getMax(db->mRange, 0.05f); + mInnerConeAngle = db->mInnerConeAngle; + mOuterConeAngle = db->mOuterConeAngle; + + mColor = db->mColor; + mBrightness = db->mBrightness; + mCastShadows = db->mCastShadows; + mPriority = db->mPriority; + mFlareData = db->mFlareData; + mAnimationData = db->mAnimationData; + mAnimState.active = (mAnimationData != 0); + + mLocalRenderViz = db->mLocalRenderViz; + + mLight->setType( LightInfo::Spot ); + mLight->setBrightness( db->mBrightness ); + mLight->setRange( db->mRange ); + mLight->setColor( db->mColor ); + mLight->setCastShadows( db->mCastShadows ); + mLight->setPriority( db->mPriority ); + mLight->setInnerConeAngle( db->mInnerConeAngle ); + mLight->setOuterConeAngle( db->mOuterConeAngle ); + + // Update the bounds and scale to fit our light. + F32 radius = mRange * mSin( mDegToRad( mOuterConeAngle ) * 0.5f ); + mObjBox.minExtents.set( -1, -1, -1 ); + mObjBox.maxExtents.set( 1, 1, 1 ); + mObjScale.set( radius, mRange, radius ); + + //_conformLights(); + } + + void setLiveColor(const LinearColorF& live_color) + { + mLight->setColor(live_color); + } + + void submitLights(LightManager* lm, bool staticLighting) + { + if (mAnimState.active && mAnimationData && fade_amt < 1.0f) + { + F32 mBrightness_save = mBrightness; + mBrightness *= fade_amt; + SpotLight::submitLights(lm, staticLighting); + mBrightness = mBrightness_save; + return; + } + + SpotLight::submitLights(lm, staticLighting); + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_T3DSpotLight::afxEA_T3DSpotLight() +{ + light_data = 0; + light = 0; +} + +afxEA_T3DSpotLight::~afxEA_T3DSpotLight() +{ + if (light) + light->deleteObject(); + if (light_data && light_data->isTempClone()) + delete light_data; + light_data = 0; +} + +void afxEA_T3DSpotLight::ea_set_datablock(SimDataBlock* db) +{ + light_data = dynamic_cast(db); +} + +bool afxEA_T3DSpotLight::ea_start() +{ + if (!light_data) + { + Con::errorf("afxEA_T3DSpotLight::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + // create and register effect + light = new SpotLightProxy(); + light->force_ghost(); + if (!light->registerObject()) + { + delete light; + light = 0; + Con::errorf("afxEA_T3DSpotLight::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(light); + + light->initWithDataBlock(light_data); + + return true; +} + +bool afxEA_T3DSpotLight::ea_update(F32 dt) +{ + if (light) + { +#if 0 // AFX_T3D_DISABLED + // With sgLightObject lights, the following code block would hook + // the constraint object up to the light in case the light was + // configured to exclude it from flare occusions. The code remains + // here in case we need to implement the same feature for T3D light. + + afxConstraint* pos_cons = getPosConstraint(); + SceneObject* cons_obj = (pos_cons) ? pos_cons->getSceneObject() : 0; + light->setConstraintObject(cons_obj); +#endif + + light->setLiveColor(updated_color); + + if (do_fades) + light->setFadeAmount(fade_value); + + light->updateTransform(updated_xfm); + + // scale should not be updated this way. It messes up the culling. + //light->setScale(updated_scale); + } + + return true; +} + +void afxEA_T3DSpotLight::ea_finish(bool was_stopped) +{ + if (light) + { + light->deleteObject(); + light = 0; + } +} + +void afxEA_T3DSpotLight::ea_set_scope_status(bool in_scope) +{ + if (light) + light->setLightEnabled(in_scope); +} + +void afxEA_T3DSpotLight::onDeleteNotify(SimObject* obj) +{ + if (light == dynamic_cast(obj)) + light = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_T3DSpotLight::getBaseColor(LinearColorF& color) +{ + if (light_data) + color = light_data->mColor; +} + +void afxEA_T3DSpotLight::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (light_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxT3DSpotLightData* orig_db = light_data; + light_data = new afxT3DSpotLightData(*orig_db, true); + orig_db->performSubstitutions(light_data, choreographer, group_index); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_T3DSpotLightDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_T3DSpotLightDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_T3DSpotLight; } +}; + +afxEA_T3DSpotLightDesc afxEA_T3DSpotLightDesc::desc; + +bool afxEA_T3DSpotLightDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxT3DSpotLightData) == typeid(*db)); +} + +bool afxEA_T3DSpotLightDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_StaticShape.cpp b/Engine/source/afx/ea/afxEA_StaticShape.cpp new file mode 100644 index 000000000..7f0b35351 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_StaticShape.cpp @@ -0,0 +1,249 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxStaticShape.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_StaticShape + +class afxEA_StaticShape : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + StaticShapeData* shape_data; + afxStaticShape* static_shape; + bool fade_out_started; + bool do_spawn; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_StaticShape(); + /*D*/ ~afxEA_StaticShape(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void ea_set_scope_status(bool flag); + virtual void onDeleteNotify(SimObject*); + + virtual void getUpdatedBoxCenter(Point3F& pos); + virtual TSShape* getTSShape(); + virtual TSShapeInstance* getTSShapeInstance(); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_StaticShape::afxEA_StaticShape() +{ + shape_data = 0; + static_shape = 0; + fade_out_started = false; + do_spawn = true; +} + +afxEA_StaticShape::~afxEA_StaticShape() +{ + if (static_shape) + static_shape->deleteObject(); + if (shape_data && shape_data->isTempClone()) + delete shape_data; + shape_data = 0; +} + +void afxEA_StaticShape::ea_set_datablock(SimDataBlock* db) +{ + shape_data = dynamic_cast(db); + afxStaticShapeData* afx_shape_data = dynamic_cast(shape_data); + do_spawn = (afx_shape_data) ? afx_shape_data->do_spawn : false; +} + +bool afxEA_StaticShape::ea_start() +{ + if (!shape_data) + { + Con::errorf("afxEA_StaticShape::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + // fades are handled using startFade() calls. + do_fades = false; + + return true; +} + +bool afxEA_StaticShape::ea_update(F32 dt) +{ + if (!static_shape) + { + // create and register effect + static_shape = new afxStaticShape(); + if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) + static_shape->init(choreographer->getChoreographerId(), datablock->effect_name); + + static_shape->onNewDataBlock(shape_data, false); + if (!static_shape->registerObject()) + { + delete static_shape; + static_shape = 0; + Con::errorf("afxEA_StaticShape::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(static_shape); + registerForCleanup(static_shape); + + if (ew_timing.fade_in_time > 0.0f) + static_shape->startFade(ew_timing.fade_in_time, 0, false); + } + + if (static_shape) + { + if (!fade_out_started && elapsed > fade_out_start) + { + if (!do_spawn) + { + if (ew_timing.fade_out_time > 0.0f) + static_shape->startFade(ew_timing.fade_out_time, 0, true); + } + fade_out_started = true; + } + + if (in_scope) + { + static_shape->setTransform(updated_xfm); + static_shape->setScale(updated_scale); + } + } + + return true; +} + +void afxEA_StaticShape::ea_finish(bool was_stopped) +{ + if (!static_shape) + return; + + if (do_spawn) + { + Con::executef(shape_data, "onSpawn", static_shape->getIdString(), datablock->effect_name); + clearNotify(static_shape); + } + else + static_shape->deleteObject(); + + static_shape = 0; +} + +void afxEA_StaticShape::ea_set_scope_status(bool in_scope) +{ + if (static_shape) + static_shape->setVisibility(do_spawn || in_scope); +} + +void afxEA_StaticShape::onDeleteNotify(SimObject* obj) +{ + if (static_shape == dynamic_cast(obj)) + static_shape = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_StaticShape::getUpdatedBoxCenter(Point3F& pos) +{ + if (static_shape) + pos = static_shape->getBoxCenter(); +} + + +TSShape* afxEA_StaticShape::getTSShape() +{ + return (static_shape) ? ((TSShape*)static_shape->getShape()) : 0; +} + +TSShapeInstance* afxEA_StaticShape::getTSShapeInstance() +{ + return (static_shape) ? static_shape->getShapeInstance() : 0; +} + +void afxEA_StaticShape::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (shape_data->getSubstitutionCount() > 0) + { + if (typeid(afxStaticShapeData) == typeid(*shape_data)) + { + afxStaticShapeData* orig_db = (afxStaticShapeData*)shape_data; + shape_data = new afxStaticShapeData(*orig_db, true); + orig_db->performSubstitutions(shape_data, choreographer, group_index); + } + else + { + StaticShapeData* orig_db = shape_data; + shape_data = new StaticShapeData(*orig_db, true); + orig_db->performSubstitutions(shape_data, choreographer, group_index); + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_StaticShapeDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_StaticShapeDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return true; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return false; } + + virtual afxEffectWrapper* create() const { return new afxEA_StaticShape; } +}; + +afxEA_StaticShapeDesc afxEA_StaticShapeDesc::desc; + +bool afxEA_StaticShapeDesc::testEffectType(const SimDataBlock* db) const +{ + if (typeid(StaticShapeData) == typeid(*db)) + return true; + if (typeid(afxStaticShapeData) == typeid(*db)) + return true; + return false; +} + +bool afxEA_StaticShapeDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_TLKLight.cpp b/Engine/source/afx/ea/afxEA_TLKLight.cpp new file mode 100644 index 000000000..160558cd9 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_TLKLight.cpp @@ -0,0 +1,79 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" + +struct sgLightObjectData : public GameBaseData +{ + typedef GameBaseData Parent; + DECLARE_CONOBJECT(sgLightObjectData); + DECLARE_CATEGORY("AFX"); +}; + +IMPLEMENT_CO_DATABLOCK_V1(sgLightObjectData); + +ConsoleDocClass( sgLightObjectData, + "@brief Allows legacy sgLightObjectData datablocks to appear in scripts.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_TLKLightDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_TLKLightDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return 0; } +}; + +afxEA_TLKLightDesc afxEA_TLKLightDesc::desc; + +//class sgUniversalStaticLightData; + +bool afxEA_TLKLightDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(sgLightObjectData) == typeid(*db)); +} + +bool afxEA_TLKLightDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_VolumeLight.cpp b/Engine/source/afx/ea/afxEA_VolumeLight.cpp new file mode 100644 index 000000000..194052f95 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_VolumeLight.cpp @@ -0,0 +1,61 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/ea/afxEA_ParticleEmitter.h" +#include "afx/afxChoreographer.h" +#include "afx/ce/afxVolumeLight.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_VolumeLightDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_VolumeLightDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return 0; } +}; + +afxEA_VolumeLightDesc afxEA_VolumeLightDesc::desc; + +bool afxEA_VolumeLightDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxVolumeLightData) == typeid(*db)); +} + +bool afxEA_VolumeLightDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_Zodiac.cpp b/Engine/source/afx/ea/afxEA_Zodiac.cpp new file mode 100644 index 000000000..d5fb5dd9c --- /dev/null +++ b/Engine/source/afx/ea/afxEA_Zodiac.cpp @@ -0,0 +1,434 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "math/mathUtils.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/afxResidueMgr.h" +#include "afx/util/afxEase.h" +#include "afx/ce/afxZodiacMgr.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Zodiac + +class afxEA_Zodiac : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxZodiacData* zode_data; + Point3F zode_pos; + F32 zode_radius; + Point2F zode_vrange; + LinearColorF zode_color; + F32 zode_angle; + F32 zode_angle_offset; + + F32 live_color_factor; + LinearColorF live_color; + bool became_residue; + bool do_altitude_bias; + F32 altitude_falloff_range; + + F32 calc_facing_angle(); + F32 calc_terrain_alt_bias(); + F32 calc_interior_alt_bias(); + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Zodiac(); + /*C*/ ~afxEA_Zodiac(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + + virtual bool ea_is_enabled() { return true; } + + virtual void getBaseColor(LinearColorF& color) { color = zode_data->color; } + + static void initPersistFields(); + + //DECLARE_CONOBJECT(afxEA_Zodiac); + DECLARE_CATEGORY("AFX"); +}; + +//IMPLEMENT_CONOBJECT(afxEA_Zodiac); + +//~~~~~~~~~~~~~~~~~~~~// + +F32 afxEA_Zodiac::calc_facing_angle() +{ + // get direction player is facing + VectorF shape_vec; + MatrixF shape_xfm; + + afxConstraint* orient_constraint = getOrientConstraint(); + if (orient_constraint) + orient_constraint->getTransform(shape_xfm); + else + shape_xfm.identity(); + + shape_xfm.getColumn(1, &shape_vec); + shape_vec.z = 0.0f; + shape_vec.normalize(); + + F32 pitch, yaw; + MathUtils::getAnglesFromVector(shape_vec, yaw, pitch); + + return mRadToDeg(yaw); +} + +inline F32 afxEA_Zodiac::calc_terrain_alt_bias() +{ + if (terrain_altitude >= zode_data->altitude_max) + return 0.0f; + return 1.0f - (terrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range; +} + +inline F32 afxEA_Zodiac::calc_interior_alt_bias() +{ + if (interior_altitude >= zode_data->altitude_max) + return 0.0f; + return 1.0f - (interior_altitude - zode_data->altitude_falloff)/altitude_falloff_range; +} + +afxEA_Zodiac::afxEA_Zodiac() +{ + zode_data = 0; + zode_pos.zero(); + zode_radius = 1; + zode_vrange.set(1,1); + zode_color.set(1,1,1,1); + zode_angle = 0; + zode_angle_offset = 0; + live_color.set(1,1,1,1); + live_color_factor = 0.0f; + do_altitude_bias = false; + altitude_falloff_range = 0.0f; + became_residue = false; +} + +afxEA_Zodiac::~afxEA_Zodiac() +{ + if (!became_residue && zode_data && zode_data->isTempClone()) + delete zode_data; + zode_data = 0; +} + +void afxEA_Zodiac::ea_set_datablock(SimDataBlock* db) +{ + zode_data = dynamic_cast(db); + if (zode_data) + { + do_altitude_bias = (zode_data->altitude_max > 0.0f && (zode_data->altitude_shrinks || zode_data->altitude_fades)); + altitude_falloff_range = zode_data->altitude_max - zode_data->altitude_falloff; + } +} + +bool afxEA_Zodiac::ea_start() +{ + if (!zode_data) + { + Con::errorf("afxEA_Zodiac::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + zode_angle_offset = calc_facing_angle(); + + return true; +} + +bool afxEA_Zodiac::ea_update(F32 dt) +{ + if (!in_scope) + return true; + + //~~~~~~~~~~~~~~~~~~~~// + // Zodiac Color + + zode_color = updated_color; + + if (live_color_factor > 0.0) + { + zode_color.interpolate(zode_color, live_color, live_color_factor); + //Con::printf("LIVE-COLOR %g %g %g %g FACTOR is %g", + // live_color.red, live_color.green, live_color.blue, live_color.alpha, + // live_color_factor); + } + else + { + //Con::printf("LIVE-COLOR-FACTOR is ZERO"); + } + + if (do_fades) + { + if (fade_value < 0.01f) + return true; // too transparent + + if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) + zode_color *= fade_value*live_fade_factor; + else + zode_color.alpha *= fade_value*live_fade_factor; + } + + if (zode_color.alpha < 0.01f) + return true; + + //~~~~~~~~~~~~~~~~~~~~// + // Zodiac + + // scale and grow zode + zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate; + + // zode is growing + if (life_elapsed < zode_data->grow_in_time) + { + F32 t = life_elapsed/zode_data->grow_in_time; + zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f); + } + // zode is shrinking + else if (full_lifetime - life_elapsed < zode_data->shrink_out_time) + { + F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time; + zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f); + } + + zode_radius *= live_scale_factor; + + if (zode_radius < 0.001f) + return true; // too small + + zode_vrange = zode_data->vert_range; + if (zode_data->scale_vert_range) + { + F32 scale_factor = zode_radius/zode_data->radius_xy; + zode_vrange *= scale_factor; + } + + //~~~~~~~~~~~~~~~~~~~~// + // Zodiac Position + + zode_pos = updated_pos; + + //~~~~~~~~~~~~~~~~~~~~// + // Zodiac Rotation + + if (zode_data->respect_ori_cons) + { + afxConstraint* orient_constraint = getOrientConstraint(); + if (orient_constraint) + { + VectorF shape_vec; + updated_xfm.getColumn(1, &shape_vec); + shape_vec.z = 0.0f; + shape_vec.normalize(); + F32 pitch, yaw; + MathUtils::getAnglesFromVector(shape_vec, yaw, pitch); + zode_angle_offset = mRadToDeg(yaw); + } + } + + zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor); + zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f); + + //~~~~~~~~~~~~~~~~~~~~// + // post zodiac + if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) + { + if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff) + { + F32 alt_bias = calc_terrain_alt_bias(); + if (alt_bias > 0.0f) + { + F32 alt_rad = zode_radius; + if (zode_data->altitude_shrinks) + alt_rad *= alt_bias; + LinearColorF alt_clr(zode_color.red, zode_color.green, zode_color.blue, zode_color.alpha); + if (zode_data->altitude_fades) + alt_clr.alpha *= alt_bias; + afxZodiacMgr::addTerrainZodiac(zode_pos, alt_rad, alt_clr, zode_angle, zode_data); + } + } + else + { + afxZodiacMgr::addTerrainZodiac(zode_pos, zode_radius, zode_color, zode_angle, zode_data); + } + } + + if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0) + { + if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff) + { + F32 alt_bias = calc_interior_alt_bias(); + if (alt_bias > 0.0f) + { + F32 alt_rad = zode_radius; + if (zode_data->altitude_shrinks) + alt_rad *= alt_bias; + LinearColorF alt_clr(zode_color.red, zode_color.green, zode_color.blue, zode_color.alpha); + if (zode_data->altitude_fades) + alt_clr.alpha *= alt_bias; + afxZodiacMgr::addInteriorZodiac(zode_pos, alt_rad, zode_vrange, alt_clr, zode_angle, zode_data); + } + } + else + afxZodiacMgr::addInteriorZodiac(zode_pos, zode_radius, zode_vrange, zode_color, zode_angle, zode_data); + } + + return true; +} + +void afxEA_Zodiac::ea_finish(bool was_stopped) +{ + if (in_scope && ew_timing.residue_lifetime > 0) + { + if (do_fades) + { + if (fade_value < 0.01f) + return; + zode_color.alpha *= fade_value; + } + if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) + { + if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff) + { + F32 alt_bias = calc_terrain_alt_bias(); + if (alt_bias > 0.0f) + { + F32 alt_rad = zode_radius; + if (zode_data->altitude_shrinks) + alt_rad *= alt_bias; + LinearColorF alt_clr(zode_color.red, zode_color.green, zode_color.blue, zode_color.alpha); + if (zode_data->altitude_fades) + zode_color.alpha *= alt_bias; + became_residue = true; + afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, alt_rad, + alt_clr, zode_angle); + } + } + else + { + became_residue = true; + afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, zode_radius, + zode_color, zode_angle); + } + } + if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0) + { + if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff) + { + F32 alt_bias = calc_interior_alt_bias(); + if (alt_bias > 0.0f) + { + F32 alt_rad = zode_radius; + if (zode_data->altitude_shrinks) + alt_rad *= alt_bias; + LinearColorF alt_clr(zode_color.red, zode_color.green, zode_color.blue, zode_color.alpha); + if (zode_data->altitude_fades) + zode_color.alpha *= alt_bias; + + afxZodiacData* temp_zode = zode_data; + if (became_residue) + temp_zode = new afxZodiacData(*zode_data, true); + became_residue = true; + afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, alt_rad, + zode_vrange, alt_clr, zode_angle); + } + + } + else + { + afxZodiacData* temp_zode = zode_data; + if (became_residue) + temp_zode = new afxZodiacData(*zode_data, true); + became_residue = true; + afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, zode_radius, + zode_vrange, zode_color, zode_angle); + } + } + } +} + +void afxEA_Zodiac::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (zode_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxZodiacData* orig_db = zode_data; + zode_data = new afxZodiacData(*orig_db, true); + orig_db->performSubstitutions(zode_data, choreographer, group_index); + } +} + +#undef myOffset +#define myOffset(field) Offset(field, afxEA_Zodiac) + +void afxEA_Zodiac::initPersistFields() +{ + addField("liveColor", TypeColorF, myOffset(live_color), + "..."); + addField("liveColorFactor", TypeF32, myOffset(live_color_factor), + "..."); + + Parent::initPersistFields(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ZodiacDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ZodiacDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_Zodiac; } +}; + +afxEA_ZodiacDesc afxEA_ZodiacDesc::desc; + +bool afxEA_ZodiacDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxZodiacData) == typeid(*db)); +} + +bool afxEA_ZodiacDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp b/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp new file mode 100644 index 000000000..ca4271860 --- /dev/null +++ b/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp @@ -0,0 +1,344 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "math/mathUtils.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/util/afxEase.h" +#include "afx/afxResidueMgr.h" +#include "afx/ce/afxZodiacPlane.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_ZodiacPlane + +class afxEA_ZodiacPlane : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxZodiacPlaneData* zode_data; + afxZodiacPlane* pzode; + + F32 zode_angle_offset; + AngAxisF aa_rot; + + F32 live_color_factor; + LinearColorF live_color; + + F32 calc_facing_angle(); + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_ZodiacPlane(); + /*D*/ ~afxEA_ZodiacPlane(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); + virtual void ea_set_scope_status(bool flag); + virtual void onDeleteNotify(SimObject*); + virtual void getUpdatedBoxCenter(Point3F& pos); + virtual void getBaseColor(LinearColorF& color) { color = zode_data->color; } +}; + +F32 afxEA_ZodiacPlane::calc_facing_angle() +{ + // get direction player is facing + VectorF shape_vec; + MatrixF shape_xfm; + + afxConstraint* orient_constraint = getOrientConstraint(); + if (orient_constraint) + orient_constraint->getTransform(shape_xfm); + else + shape_xfm.identity(); + + shape_xfm.getColumn(1, &shape_vec); + shape_vec.z = 0.0f; + shape_vec.normalize(); + + F32 pitch, yaw; + MathUtils::getAnglesFromVector(shape_vec, yaw, pitch); + + return mRadToDeg(yaw); +} + +afxEA_ZodiacPlane::afxEA_ZodiacPlane() +{ + zode_data = 0; + pzode = 0; + zode_angle_offset = 0; + live_color.set(1,1,1,1); + live_color_factor = 0.0f; +} + +afxEA_ZodiacPlane::~afxEA_ZodiacPlane() +{ + if (pzode) + pzode->deleteObject(); + if (zode_data && zode_data->isTempClone()) + delete zode_data; + zode_data = 0; +} + +void afxEA_ZodiacPlane::ea_set_datablock(SimDataBlock* db) +{ + zode_data = dynamic_cast(db); +} + +bool afxEA_ZodiacPlane::ea_start() +{ + if (!zode_data) + { + Con::errorf("afxEA_ZodiacPlane::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + if (!zode_data->use_full_xfm) + zode_angle_offset = calc_facing_angle(); + + switch (zode_data->face_dir) + { + case afxZodiacPlaneData::FACES_UP: + aa_rot.set(Point3F(0.0f,0.0f,1.0f),0.0f); + break; + case afxZodiacPlaneData::FACES_DOWN: + aa_rot.set(Point3F(0.0f,0.0f,-1.0f),0.0f); + break; + case afxZodiacPlaneData::FACES_FORWARD: + aa_rot.set(Point3F(0.0f,1.0f,0.0f),0.0f); + break; + case afxZodiacPlaneData::FACES_BACK: + aa_rot.set(Point3F(0.0f,-1.0f,0.0f),0.0f); + break; + case afxZodiacPlaneData::FACES_RIGHT: + aa_rot.set(Point3F(1.0f,0.0f,0.0f),0.0f); + break; + case afxZodiacPlaneData::FACES_LEFT: + aa_rot.set(Point3F(-1.0f,0.0f,0.0f),0.0f); + break; + } + + return true; +} + +bool afxEA_ZodiacPlane::ea_update(F32 dt) +{ + if (!pzode) + { + // create and register effect + pzode = new afxZodiacPlane(); + pzode->onNewDataBlock(zode_data, false); + if (!pzode->registerObject()) + { + delete pzode; + pzode = 0; + Con::errorf("afxEA_ZodiacPlane::ea_update() -- effect failed to register."); + return false; + } + deleteNotify(pzode); + + ///pzode->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); + ///pzode->setSortPriority(datablock->sort_priority); + } + + if (pzode) + { + //LinearColorF zode_color = zode_data->color; + LinearColorF zode_color = updated_color; + + if (live_color_factor > 0.0) + zode_color.interpolate(zode_color, live_color, live_color_factor); + + if (do_fades) + { + if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) + zode_color *= fade_value*live_fade_factor; + else + zode_color.alpha *= fade_value*live_fade_factor; + } + + // scale and grow zode + //F32 zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate; + F32 zode_radius = zode_data->radius_xy + life_elapsed*zode_data->growth_rate; + + // zode is growing + if (life_elapsed < zode_data->grow_in_time) + { + F32 t = life_elapsed/zode_data->grow_in_time; + zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f); + } + // zode is shrinking + else if (full_lifetime - life_elapsed < zode_data->shrink_out_time) + { + F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time; + zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f); + } + + zode_radius *= live_scale_factor; + + if (zode_data->respect_ori_cons && !zode_data->use_full_xfm) + { + VectorF shape_vec; + updated_xfm.getColumn(1, &shape_vec); + shape_vec.normalize(); + + F32 ang; + + switch (zode_data->face_dir) + { + case afxZodiacPlaneData::FACES_FORWARD: + case afxZodiacPlaneData::FACES_BACK: + ang = mAtan2(shape_vec.x, shape_vec.z); + break; + case afxZodiacPlaneData::FACES_RIGHT: + case afxZodiacPlaneData::FACES_LEFT: + ang = mAtan2(shape_vec.y, shape_vec.z); + break; + case afxZodiacPlaneData::FACES_UP: + case afxZodiacPlaneData::FACES_DOWN: + default: + ang = mAtan2(shape_vec.x, shape_vec.y); + break; + } + + if (ang < 0.0f) + ang += M_2PI_F; + + switch (zode_data->face_dir) + { + case afxZodiacPlaneData::FACES_DOWN: + case afxZodiacPlaneData::FACES_BACK: + case afxZodiacPlaneData::FACES_LEFT: + ang = -ang; + break; + } + + zode_angle_offset = mRadToDeg(ang); + } + + F32 zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor); + zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f); + aa_rot.angle = mDegToRad(zode_angle); + + MatrixF spin_xfm; + aa_rot.setMatrix(&spin_xfm); + + // set color, radius + pzode->setColor(zode_color); + pzode->setRadius(zode_radius); + if (zode_data->use_full_xfm) + { + updated_xfm.mul(spin_xfm); + pzode->setTransform(updated_xfm); + } + else + pzode->setTransform(spin_xfm); + pzode->setPosition(updated_pos); + pzode->setScale(updated_scale); + } + + return true; +} + +void afxEA_ZodiacPlane::ea_finish(bool was_stopped) +{ + if (!pzode) + return; + + pzode->deleteObject(); + pzode = 0; +} + +void afxEA_ZodiacPlane::ea_set_scope_status(bool in_scope) +{ + if (pzode) + pzode->setVisibility(in_scope); +} + +void afxEA_ZodiacPlane::onDeleteNotify(SimObject* obj) +{ + if (pzode == dynamic_cast(obj)) + pzode = 0; + + Parent::onDeleteNotify(obj); +} + +void afxEA_ZodiacPlane::getUpdatedBoxCenter(Point3F& pos) +{ + if (pzode) + pos = pzode->getBoxCenter(); +} + +void afxEA_ZodiacPlane::do_runtime_substitutions() +{ + // only clone the datablock if there are substitutions + if (zode_data->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxZodiacPlaneData* orig_db = zode_data; + zode_data = new afxZodiacPlaneData(*orig_db, true); + orig_db->performSubstitutions(zode_data, choreographer, group_index); + } +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ZodiacPlaneDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ZodiacPlaneDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_ZodiacPlane; } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_ZodiacPlaneDesc afxEA_ZodiacPlaneDesc::desc; + +bool afxEA_ZodiacPlaneDesc::testEffectType(const SimDataBlock* db) const +{ + return (typeid(afxZodiacPlaneData) == typeid(*db)); +} + +bool afxEA_ZodiacPlaneDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/forces/afxEA_Force.cpp b/Engine/source/afx/forces/afxEA_Force.cpp new file mode 100644 index 000000000..7ec2332f1 --- /dev/null +++ b/Engine/source/afx/forces/afxEA_Force.cpp @@ -0,0 +1,183 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afx/afxChoreographer.h" +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/forces/afxForce.h" +#include "afx/forces/afxForceSet.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxEA_Force + +class afxEA_Force : public afxEffectWrapper +{ + typedef afxEffectWrapper Parent; + + afxForceData* force_data; + afxForce* force; + afxForceSetMgr* force_set_mgr; + + void do_runtime_substitutions(); + +public: + /*C*/ afxEA_Force(); + /*D*/ ~afxEA_Force(); + + virtual void ea_set_datablock(SimDataBlock*); + virtual bool ea_start(); + virtual bool ea_update(F32 dt); + virtual void ea_finish(bool was_stopped); +}; + +//~~~~~~~~~~~~~~~~~~~~// + +afxEA_Force::afxEA_Force() +{ + force_data = 0; + force = 0; + force_set_mgr = 0; +} + +afxEA_Force::~afxEA_Force() +{ + if (force) + { + if (force_set_mgr) + force_set_mgr->unregisterForce(force_data->force_set_name, force); + delete force; + } + + if (force_data && force_data->isTempClone()) + { + delete force_data; + force_data = 0; + } + + force_set_mgr = 0; +} + +void afxEA_Force::ea_set_datablock(SimDataBlock* db) +{ + force_data = dynamic_cast(db); +} + +bool afxEA_Force::ea_start() +{ + if (!force_data) + { + Con::errorf("afxEA_Force::ea_start() -- missing or incompatible datablock."); + return false; + } + + do_runtime_substitutions(); + + force_set_mgr = choreographer->getForceSetMgr(); + + return true; +} + +bool afxEA_Force::ea_update(F32 dt) +{ + if (!force) + { + force = (force_data->force_desc) ? force_data->force_desc->create() : 0; + if (!force) + { + delete force; + force = 0; + Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", datablock->getName()); + return false; + } + force->onNewDataBlock(force_data, false); + + if (force) + { + force_set_mgr->registerForce(force_data->force_set_name, force); + force->start(); + } + } + + if (force) // && in_scope) + { + if (do_fades) + force->setFadeAmount(fade_value); + + force->update(dt); + } + + return true; +} + +void afxEA_Force::ea_finish(bool was_stopped) +{ + if (!force) + return; + + if (force_set_mgr) + force_set_mgr->unregisterForce(force_data->force_set_name, force); + delete force; + force = 0; +} + +void afxEA_Force::do_runtime_substitutions() +{ + force_data = force_data->cloneAndPerformSubstitutions(choreographer, group_index); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxEA_ForceDesc : public afxEffectAdapterDesc, public afxEffectDefs +{ + static afxEA_ForceDesc desc; + +public: + virtual bool testEffectType(const SimDataBlock*) const; + virtual bool requiresStop(const afxEffectWrapperData*, const afxEffectTimingData&) const; + virtual bool runsOnServer(const afxEffectWrapperData*) const { return false; } + virtual bool runsOnClient(const afxEffectWrapperData*) const { return true; } + + virtual afxEffectWrapper* create() const { return new afxEA_Force; } +}; + +afxEA_ForceDesc afxEA_ForceDesc::desc; + +bool afxEA_ForceDesc::testEffectType(const SimDataBlock* db) const +{ + if (dynamic_cast(db) != 0) + return afxForceDesc::identifyForce((afxForceData*) db); + + return false; +} + +bool afxEA_ForceDesc::requiresStop(const afxEffectWrapperData* ew, const afxEffectTimingData& timing) const +{ + return (timing.lifetime < 0); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + diff --git a/Engine/source/afx/forces/afxF_Drag.cpp b/Engine/source/afx/forces/afxF_Drag.cpp new file mode 100644 index 000000000..7fb52deb1 --- /dev/null +++ b/Engine/source/afx/forces/afxF_Drag.cpp @@ -0,0 +1,209 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "afx/forces/afxForce.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxF_DragData : public afxForceData +{ + typedef afxForceData Parent; + +public: + F32 drag_coefficient; + F32 air_density; + F32 cross_sectional_area; + +public: + /*C*/ afxF_DragData(); + /*C*/ afxF_DragData(const afxF_DragData&, bool = false); + + virtual void packData(BitStream* stream); + virtual void unpackData(BitStream* stream); + virtual afxForceData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxF_DragData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxF_Drag : public afxForce +{ + typedef afxForce Parent; + +private: + afxF_DragData* datablock; + F32 air_friction_constant; + +public: + /*C*/ afxF_Drag(); + + virtual bool onNewDataBlock(afxForceData* dptr, bool reload); + + virtual void start(); + virtual Point3F evaluate(Point3F pos, Point3F v, F32 mass); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxDragData + +IMPLEMENT_CO_DATABLOCK_V1(afxF_DragData); + +ConsoleDocClass( afxF_DragData, + "@brief A datablock for specifiying AFX drag forces.\n\n" + + "@ingroup afxExperimental\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxF_DragData::afxF_DragData() +{ + air_density = 1.2250f; + cross_sectional_area = 0.75f; // this variable isn't exposed to the user to keep things simple + drag_coefficient = 1.0f; +} + +afxF_DragData::afxF_DragData(const afxF_DragData& other, bool temp_clone) : afxForceData(other, temp_clone) +{ + air_density = other.air_density; + cross_sectional_area = other.cross_sectional_area; + drag_coefficient = other.drag_coefficient; +} + +#define myOffset(field) Offset(field, afxF_DragData) + +void afxF_DragData::initPersistFields() +{ + addField("drag", TypeF32, myOffset(drag_coefficient), + "..."); + addField("airDensity", TypeF32, myOffset(air_density), + "..."); + addField("crossSectionalArea", TypeF32, myOffset(cross_sectional_area), + "..."); + + Parent::initPersistFields(); +} + +void afxF_DragData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(drag_coefficient); + stream->write(air_density); + stream->write(cross_sectional_area); +} + +void afxF_DragData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&drag_coefficient); + stream->read(&air_density); + stream->read(&cross_sectional_area); +} + +afxForceData* afxF_DragData::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + afxF_DragData* drag_data = this; + + // only clone the datablock if there are substitutions + if (this->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxF_DragData* orig_db = this; + drag_data = new afxF_DragData(*orig_db, true); + orig_db->performSubstitutions(drag_data, owner, index); + } + + return drag_data; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxF_Drag::afxF_Drag() : afxForce() +{ + air_friction_constant = 1.0f; +} + +bool afxF_Drag::onNewDataBlock(afxForceData* dptr, bool reload) +{ + datablock = dynamic_cast(dptr); + if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + return true; +} + +void afxF_Drag::start() +{ + air_friction_constant = 0.5f * datablock->drag_coefficient + * datablock->air_density + * datablock->cross_sectional_area; + //Con::printf("Air Friction: %f", air_friction_constant); +} + +Point3F afxF_Drag::evaluate(Point3F pos, Point3F velocity, F32 mass) +{ + // This implements the standard drag equation for object's at high speeds. + // F-drag = 1/2pACv^2 + // p = medium (air) density + // A = cross-sectional area of moving object (plane perpendicular to direction of motion) + // C = coefficient of drag + + // -- Velocity here should actually be relative to the velocity of the fluid... (relative speed) + // (is it already?) + F32 drag = air_friction_constant*velocity.magnitudeSafe(); + + // Here, velocity is normalized just to get a direction vector. + // Drag is in the direction opposite velocity. Is this right? + velocity.normalizeSafe(); + + return (velocity*-drag*mass); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxF_DragDesc : public afxForceDesc +{ + static afxF_DragDesc desc; + +public: + virtual bool testForceType(const SimDataBlock*) const; + virtual afxForce* create() const { return new afxF_Drag; } +}; + +afxF_DragDesc afxF_DragDesc::desc; + +bool afxF_DragDesc::testForceType(const SimDataBlock* db) const +{ + return (typeid(afxF_DragData) == typeid(*db)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/forces/afxF_Gravity.cpp b/Engine/source/afx/forces/afxF_Gravity.cpp new file mode 100644 index 000000000..fc5ed1d80 --- /dev/null +++ b/Engine/source/afx/forces/afxF_Gravity.cpp @@ -0,0 +1,171 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include +#include "afx/arcaneFX.h" + +#include "afx/forces/afxForce.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxF_GravityData : public afxForceData +{ + typedef afxForceData Parent; + +public: + F32 gravity; + +public: + /*C*/ afxF_GravityData(); + /*C*/ afxF_GravityData(const afxF_GravityData&, bool = false); + + virtual void packData(BitStream* stream); + virtual void unpackData(BitStream* stream); + virtual afxForceData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxF_GravityData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxF_Gravity : public afxForce +{ + typedef afxForce Parent; + +private: + afxF_GravityData* datablock; + +public: + /*C*/ afxF_Gravity(); + + virtual bool onNewDataBlock(afxForceData* dptr, bool reload); + + virtual Point3F evaluate(Point3F pos, Point3F v, F32 mass); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxForceData + +IMPLEMENT_CO_DATABLOCK_V1(afxF_GravityData); + +ConsoleDocClass( afxF_GravityData, + "@brief A datablock for specifiying AFX gravity forces.\n\n" + + "@ingroup afxExperimental\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxF_GravityData::afxF_GravityData() +{ + gravity = 9.807f; +} + +afxF_GravityData::afxF_GravityData(const afxF_GravityData& other, bool temp_clone) : afxForceData(other, temp_clone) +{ + gravity = other.gravity; +} + +#define myOffset(field) Offset(field, afxF_GravityData) + +void afxF_GravityData::initPersistFields() +{ + addField("gravity", TypeF32, myOffset(gravity), + "..."); + + Parent::initPersistFields(); +} + +void afxF_GravityData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(gravity); +} + +void afxF_GravityData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&gravity); +} + +afxForceData* afxF_GravityData::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + afxF_GravityData* grav_data = this; + + // only clone the datablock if there are substitutions + if (this->getSubstitutionCount() > 0) + { + // clone the datablock and perform substitutions + afxF_GravityData* orig_db = this; + grav_data = new afxF_GravityData(*orig_db, true); + orig_db->performSubstitutions(grav_data, owner, index); + } + + return grav_data; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxF_Gravity::afxF_Gravity() : afxForce() +{ +} + +bool afxF_Gravity::onNewDataBlock(afxForceData* dptr, bool reload) +{ + datablock = dynamic_cast(dptr); + if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + return true; +} + +Point3F afxF_Gravity::evaluate(Point3F pos, Point3F v, F32 mass) +{ + return Point3F(0,0,-datablock->gravity)*mass; +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxF_GravityDesc : public afxForceDesc +{ + static afxF_GravityDesc desc; + +public: + virtual bool testForceType(const SimDataBlock*) const; + virtual afxForce* create() const { return new afxF_Gravity; } +}; + +afxF_GravityDesc afxF_GravityDesc::desc; + +bool afxF_GravityDesc::testForceType(const SimDataBlock* db) const +{ + return (typeid(afxF_GravityData) == typeid(*db)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/forces/afxForce.cpp b/Engine/source/afx/forces/afxForce.cpp new file mode 100644 index 000000000..935ef7174 --- /dev/null +++ b/Engine/source/afx/forces/afxForce.cpp @@ -0,0 +1,148 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "scene/sceneRenderState.h" +#include "math/mathIO.h" + +#include "afx/afxChoreographer.h" +#include "afx/forces/afxForce.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxForceData + +afxForceData::afxForceData() +{ + force_set_name = ST_NULLSTRING; + force_desc = 0; +} + +afxForceData::afxForceData(const afxForceData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + force_set_name = other.force_set_name; + force_desc = other.force_desc; +} + +#define myOffset(field) Offset(field, afxForceData) + +void afxForceData::initPersistFields() +{ + addField("forceSetName", TypeString, myOffset(force_set_name), + "..."); + + Parent::initPersistFields(); +} + +bool afxForceData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + return true; +} + +void afxForceData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->writeString(force_set_name); +} + +void afxForceData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + force_set_name = stream->readSTString(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxForce + +afxForce::afxForce() +{ + datablock = 0; + fade_amt = 1.0f; +} + +afxForce::~afxForce() +{ +} + +bool afxForce::onNewDataBlock(afxForceData* dptr, bool reload) +{ + datablock = dptr; + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +Vector* afxForceDesc::forces = 0; + +afxForceDesc::afxForceDesc() +{ + if (!forces) + forces = new Vector; + + forces->push_back(this); +} + +bool afxForceDesc::identifyForce(afxForceData* force_data) +{ + if (!force_data) + { + Con::errorf("afxForceDesc::identifyForce() -- force datablock was not specified."); + return false; + } + + if (!forces) + { + Con::errorf("afxForceDesc::identifyForce() -- force registration list has not been allocated."); + return false; + } + + if (forces->size() == 0) + { + Con::errorf("afxForceDesc::identifyForce() -- no forces have been registered."); + return false; + } + + for (S32 i = 0; i < forces->size(); i++) + { + if ((*forces)[i]->testForceType(force_data)) + { + force_data->force_desc = (*forces)[i]; + return true; + } + } + + Con::errorf("afxForceDesc::identifyForce() -- force %s has an undefined type. -- %d", + force_data, forces->size()); + return false; +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/forces/afxForce.h b/Engine/source/afx/forces/afxForce.h new file mode 100644 index 000000000..5050d17d8 --- /dev/null +++ b/Engine/source/afx/forces/afxForce.h @@ -0,0 +1,97 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_FORCE_H_ +#define _AFX_FORCE_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxForce Data +class afxForceDesc; + +class afxForceData : public GameBaseData +{ + typedef GameBaseData Parent; + +public: + StringTableEntry force_set_name; + afxForceDesc* force_desc; + +public: + /*C*/ afxForceData(); + /*C*/ afxForceData(const afxForceData&, bool = false); + + virtual bool onAdd(); + virtual void packData(BitStream* stream); + virtual void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + virtual afxForceData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0)=0; + + static void initPersistFields(); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxForce + +class afxForce +{ + afxForceData* datablock; + +protected: + F32 fade_amt; + +public: + /*C*/ afxForce(); + /*D*/ ~afxForce(); + + virtual bool onNewDataBlock(afxForceData* dptr, bool reload); + void setFadeAmount(F32 amt) { fade_amt = amt; } + + virtual void start() {}; + virtual void update(F32 dt) {}; + virtual Point3F evaluate(Point3F pos, Point3F v, F32 mass) { return Point3F(0,0,0); }; //=0; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxForceDesc +{ +private: + static Vector* forces; + +public: + /*C*/ afxForceDesc(); + + virtual bool testForceType(const SimDataBlock*) const=0; + + virtual afxForce* create() const=0; + + static bool identifyForce(afxForceData*); +}; + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_FORCE_H_ diff --git a/Engine/source/afx/forces/afxForceSet.cpp b/Engine/source/afx/forces/afxForceSet.cpp new file mode 100644 index 000000000..49658022f --- /dev/null +++ b/Engine/source/afx/forces/afxForceSet.cpp @@ -0,0 +1,134 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/forces/afxForceSet.h" +#include "afx/forces/afxForce.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxForceSet::afxForceSet(const char* name) +{ + this->name = (name) ? StringTable->insert(name) : ST_NULLSTRING; + update_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it. + elapsed_dt = 0.0f; + elapsed_ms = 0; + num_updates = 0; + last_num_updates = 0; +} + +void afxForceSet::remove(afxForce* force) +{ + for (S32 i = 0; i < force_v.size(); i++) + { + if (force_v[i] == force) + { + force_v.erase(i); + return; + } + } +} + +S32 afxForceSet::updateDT(F32 dt) +{ + U32 now = Platform::getVirtualMilliseconds(); + + if (elapsed_ms == now) + return last_num_updates; + + elapsed_ms = now; + elapsed_dt += dt; + + if (elapsed_dt < update_dt) + { + last_num_updates = 0; + return 0; + } + + num_updates = mFloor(elapsed_dt/update_dt); + elapsed_dt -= update_dt*num_updates; + last_num_updates = num_updates; + + return num_updates; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxForceSetMgr::afxForceSetMgr() +{ +} + +afxForceSetMgr::~afxForceSetMgr() +{ + for (S32 i = 0; i < forces_sets.size(); i++) + { + if (forces_sets[i]) + delete forces_sets[i]; + } +} + +afxForceSet* afxForceSetMgr::findForceSet(StringTableEntry forces_set_name) +{ + for (S32 i = 0; i < forces_sets.size(); i++) + { + if (forces_sets[i] && forces_sets[i]->getName() == forces_set_name) + return forces_sets[i]; + } + + return 0; +} + +void afxForceSetMgr::registerForce(StringTableEntry forces_set_name, afxForce* force) +{ + if (!force) + return; + + // find forceSet by name + afxForceSet* fset = findForceSet(forces_set_name); + + // create forceSet if it does not already exist + if (!fset) + { + fset = new afxForceSet(forces_set_name); + forces_sets.push_back(fset); + } + + // add force to set + fset->add(force); +} + +void afxForceSetMgr::unregisterForce(StringTableEntry forces_set_name, afxForce* force) +{ + if (!force) + return; + + afxForceSet* fset = findForceSet(forces_set_name); + if (!fset) + return; + + fset->remove(force); +} + diff --git a/Engine/source/afx/forces/afxForceSet.h b/Engine/source/afx/forces/afxForceSet.h new file mode 100644 index 000000000..8c42a2dd3 --- /dev/null +++ b/Engine/source/afx/forces/afxForceSet.h @@ -0,0 +1,80 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_FORCE_SET_H_ +#define _AFX_FORCE_SET_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxForce; + +class afxForceSet +{ + Vector force_v; + StringTableEntry name; + + // tick-based updating + F32 update_dt; // constant update interval, in seconds + F32 elapsed_dt; // runtime elapsed delta, in seconds + U32 elapsed_ms; + S32 num_updates; + S32 last_num_updates; + +public: + /*C*/ afxForceSet(const char* name=0); + + void add(afxForce* force) { force_v.push_back(force); } + void remove(afxForce* force); + + S32 count() { return force_v.size(); } + afxForce* getForce(S32 idx) { return force_v[idx]; } + const char* getName() const { return name; } + + void setUpdateDT(F32 update_dt) { this->update_dt = update_dt; } + F32 getUpdateDT() { return update_dt; } + + S32 updateDT(F32 dt); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxForceSetMgr +{ + Vector forces_sets; + +public: + /*C*/ afxForceSetMgr(); + /*D*/ ~afxForceSetMgr(); + + afxForceSet* findForceSet(StringTableEntry name); + S32 numForceSets() const { return forces_sets.size(); } + + void registerForce(StringTableEntry forces_set_name, afxForce* force); + void unregisterForce(StringTableEntry forces_set_name, afxForce* force); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_FORCE_SET_H_ diff --git a/Engine/source/afx/forces/afxXM_Force.cpp b/Engine/source/afx/forces/afxXM_Force.cpp new file mode 100644 index 000000000..cfe534dd8 --- /dev/null +++ b/Engine/source/afx/forces/afxXM_Force.cpp @@ -0,0 +1,274 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +#include "afx/afxEffectDefs.h" +#include "afx/forces/afxForce.h" +#include "afx/forces/afxForceSet.h" + +//#define ECHO_DEBUG_INFO + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_ForceData : public afxXM_WeightedBaseData, public afxEffectDefs +{ + typedef afxXM_WeightedBaseData Parent; + +public: + StringTableEntry force_set_name; + F32 update_dt; + +public: + /*C*/ afxXM_ForceData(); + /*C*/ afxXM_ForceData(const afxXM_ForceData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + bool preload(bool server, String &errorStr); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_ForceData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_Force : public afxXM_WeightedBase, public afxEffectDefs +{ + typedef afxXM_WeightedBase Parent; + + afxForceSet* force_set; + + Point3F pos_local; + Point3F velocity; + + bool first; + + F32 mass; + F32 mass_inverse; + + afxXM_ForceData* db; + +public: + /*C*/ afxXM_Force(afxXM_ForceData*, afxEffectWrapper*); + + virtual void start(F32 timestamp); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_ForceData); + +ConsoleDocClass( afxXM_ForceData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxExperimental\n" + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_ForceData::afxXM_ForceData() +{ + force_set_name = ST_NULLSTRING; + update_dt = -1.0f; +} + +afxXM_ForceData::afxXM_ForceData(const afxXM_ForceData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + force_set_name = other.force_set_name; + update_dt = other.update_dt; +} + + +void afxXM_ForceData::initPersistFields() +{ + addField("forceSetName", TypeString, Offset(force_set_name, afxXM_ForceData), + "..."); + addField("updateDT", TypeF32, Offset(update_dt, afxXM_ForceData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_ForceData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeString(force_set_name); + if (stream->writeFlag(update_dt < 0.0f)) + stream->write(update_dt); +} + +void afxXM_ForceData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + force_set_name = stream->readSTString(); + if (stream->readFlag()) + stream->read(&update_dt); + else + update_dt = -1.0f; +} + +bool afxXM_ForceData::preload(bool server, String &errorStr) +{ + if(!Parent::preload(server, errorStr)) + return false; + + return true; +} + +afxXM_Base* afxXM_ForceData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_ForceData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_ForceData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_Force(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Force::afxXM_Force(afxXM_ForceData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; + + force_set = 0; + + pos_local.zero(); + velocity.zero(); + + mass = 1.0f; + mass_inverse = 1.0f; + + first = true; +} + +void afxXM_Force::start(F32 timestamp) +{ + Parent::start(timestamp); + + afxForceSetMgr* force_set_mgr = fx_wrapper->getChoreographer()->getForceSetMgr(); + force_set = (force_set_mgr) ? force_set_mgr->findForceSet(db->force_set_name) : 0; + if (!force_set) + { + Con::errorf(ConsoleLogEntry::General, + "afxXM_Force::start() -- unable to find afxForceSet %s", db->force_set_name); + return; + } + + mass = fx_wrapper->getMass(); + + // compute mass_inverse safely + mass_inverse = (mass > 0.0001f) ? (1.0f/mass) : 1.0f/0.0001f; + + F32 update_dt = (db->update_dt < 0.0f) ? 1.0f/30.0f : db->update_dt; + if (force_set->getUpdateDT() > update_dt) + force_set->setUpdateDT(update_dt); +} + +// JTF Note: answer these questions? +// Can mass be removed from the force and acceleration calculations? +// XFM Weight is not accounted for (yet). +void afxXM_Force::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (!force_set) + return; + +#ifdef ECHO_DEBUG_INFO + Con::printf("afxXM_Force: elapsed=%f (dt=%f)", elapsed,dt); +#endif + + if (first) + { + velocity = fx_wrapper->getDirection(); + velocity.normalizeSafe(); + params.ori.mulP(velocity); + velocity *= fx_wrapper->getSpeed(); + +#ifdef ECHO_DEBUG_INFO + Con::printf("INITIAL VELOCITY : %f %f %f", velocity.x, velocity.y, velocity.z); + Con::printf("MASS : %f %f", mass, mass_inverse ); +#endif + + first = false; + } + + S32 num_updates = force_set->updateDT(dt); + if (num_updates == 0) + { + params.pos += pos_local; + return; + } + + for (S32 j = 0; j < num_updates; j++) + { + Point3F F_net(0,0,0); + for (S32 i = 0; i < force_set->count(); i++) + { + afxForce* force = force_set->getForce(i); +#ifdef ECHO_DEBUG_INFO + Point3F F = force->evaluate(params.pos+pos_local, velocity, mass); + F_net += F; + Con::printf("(%d) F %i: %f %f %f", this, i, F.x, F.y, F.z); +#else + F_net += force->evaluate(params.pos+pos_local, velocity, mass); +#endif + } + + Point3F acceleration = F_net * mass_inverse * force_set->getUpdateDT(); + velocity += acceleration; + + pos_local += velocity; + } + params.pos += pos_local; + +#ifdef ECHO_DEBUG_INFO + Con::printf("velocity : %f %f %f", velocity.x, velocity.y, velocity.z); + Con::printf("pos: %f %f %f", params.pos.x, params.pos.y, params.pos.z); +#endif +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/rpg/afxRPGMagicSpell.cpp b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp new file mode 100644 index 000000000..dae982fa8 --- /dev/null +++ b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp @@ -0,0 +1,274 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afxRPGMagicSpell.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxRPGMagicSpellData + +IMPLEMENT_CO_DATABLOCK_V1(afxRPGMagicSpellData); + +ConsoleDocClass( afxRPGMagicSpellData, + "@brief A datablock for defining RPG aspects of a spell.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxRPGMagicSpellData::afxRPGMagicSpellData() +{ + // spell parameters + spell_name = ST_NULLSTRING; + spell_desc = ST_NULLSTRING; + spell_target = TARGET_NOTHING; + spell_range = 0.0f; + mana_cost = 0; + + n_reagents = 0; + for (S32 i = 0; i < MAX_REAGENTS_PER_SPELL; i++) + { + reagent_cost[i] = 1; + reagent_name[i] = ST_NULLSTRING; + } + + // spell phase timing + casting_dur = 0.0f; + + // interface elements + icon_name = ST_NULLSTRING; + source_pack = ST_NULLSTRING; + + is_placeholder = false; + + free_target_style = 0; + target_optional = false; +} + +ImplementEnumType( afxRPGMagicSpell_TargetType, "Possible RPG spell target types.\n" "@ingroup afxRPGMagicSpell\n\n" ) + { afxRPGMagicSpellData::TARGET_NOTHING, "nothing", "..." }, + { afxRPGMagicSpellData::TARGET_SELF, "self", "..." }, + { afxRPGMagicSpellData::TARGET_FRIEND, "friend", "..." }, + { afxRPGMagicSpellData::TARGET_ENEMY, "enemy", "..." }, + { afxRPGMagicSpellData::TARGET_CORPSE, "corpse", "..." }, + { afxRPGMagicSpellData::TARGET_FREE, "free", "..." }, +EndImplementEnumType; + +#define myOffset(field) Offset(field, afxRPGMagicSpellData) + +void afxRPGMagicSpellData::initPersistFields() +{ + // spell parameters + addField("spellName", TypeString, myOffset(spell_name), + "..."); + addField("desc", TypeString, myOffset(spell_desc), + "..."); + + addField("target", TYPEID< afxRPGMagicSpellData::TargetType >(), myOffset(spell_target), + "..."); + + addField("range", TypeF32, myOffset(spell_range), + "..."); + addField("manaCost", TypeS32, myOffset(mana_cost), + "..."); + addField("reagentCost", TypeS8, myOffset(reagent_cost), MAX_REAGENTS_PER_SPELL, + "..."); + addField("reagentName", TypeString, myOffset(reagent_name), MAX_REAGENTS_PER_SPELL, + "..."); + + // spell phase timing + addField("castingDur", TypeF32, myOffset(casting_dur)); + + // interface elements + addField("iconBitmap", TypeFilename, myOffset(icon_name)); + addField("sourcePack", TypeString, myOffset(source_pack)); + addField("isPlaceholder", TypeBool, myOffset(is_placeholder)); + addField("freeTargetStyle", TypeS8, myOffset(free_target_style)); + addField("targetOptional", TypeBool, myOffset(target_optional)); + + Parent::initPersistFields(); +} + +bool afxRPGMagicSpellData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + n_reagents = 0; + for (S32 i = 0; i < MAX_REAGENTS_PER_SPELL && reagent_name[i] != ST_NULLSTRING; i++) + n_reagents++; + + return true; +} + +void afxRPGMagicSpellData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(spell_target); + stream->write(spell_range); + stream->write(mana_cost); + stream->write(n_reagents); + for (S32 i = 0; i < n_reagents; i++) + { + stream->write(reagent_cost[i]); + stream->writeString(reagent_name[i]); + } + + stream->write(casting_dur); + + stream->writeString(spell_name); + stream->writeLongString(511, spell_desc); + stream->writeString(icon_name); + stream->writeString(source_pack); + stream->writeFlag(is_placeholder); + stream->writeFlag(target_optional); + stream->write(free_target_style); +} + +void afxRPGMagicSpellData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&spell_target); + stream->read(&spell_range); + stream->read(&mana_cost); + stream->read(&n_reagents); + for (S32 i = 0; i < n_reagents; i++) + { + stream->read(&reagent_cost[i]); + reagent_name[i] = stream->readSTString(); + } + + stream->read(&casting_dur); + + spell_name = stream->readSTString(); + { + char value[512]; + stream->readLongString(511, value); + spell_desc = StringTable->insert(value); + } + icon_name = stream->readSTString(); + source_pack = stream->readSTString(); + is_placeholder = stream->readFlag(); + target_optional = stream->readFlag(); + stream->read(&free_target_style); +} + +#define NAME_FMT "" +#define TARGET_FMT "" +#define MANACOST_FMT "" +#define RANGE_FMT "" +#define CASTLEN_FMT "" +#define DESC_FMT "" +#define SMALL_BR "\n" +#define BR "\n" +#define PACK_FMT "" +#define PACK_NAME_FMT "" + + +char* afxRPGMagicSpellData::fmt_placeholder_desc(char* buffer, int len) const +{ + char pack_str[32]; + if (source_pack == ST_NULLSTRING) + dStrcpy(pack_str, "unknown"); + else + dSprintf(pack_str, 32, "%s", source_pack); + + dSprintf(buffer, len, + NAME_FMT "%s" BR + SMALL_BR + DESC_FMT "%s" BR + SMALL_BR SMALL_BR + PACK_FMT "source: " PACK_NAME_FMT "%s", + spell_name, spell_desc, pack_str); + + return buffer; +} + +char* afxRPGMagicSpellData::formatDesc(char* buffer, int len) const +{ + if (is_placeholder) + return fmt_placeholder_desc(buffer, len); + + char target_str[32]; target_str[0] = '\0'; + + // CAUTION: The following block of code is fragile and tricky since it depends + // on the underlying structures defined by ImplementEnumType/EndImplementEnumType. + // This done so the enum strings can be used directly in the spell description text. + for (unsigned int i = 0; i < _afxRPGMagicSpell_TargetType::_sEnumTable.getNumValues(); i++) + { + if (_afxRPGMagicSpell_TargetType::_sEnumTable[i].mInt == spell_target) + { + if (spell_target != TARGET_NOTHING) + { + dStrcpy(target_str, _afxRPGMagicSpell_TargetType::_sEnumTable[i].mName); + if (spell_target != TARGET_FREE && target_optional) + dStrcat(target_str, " (opt)"); + } + break; + } + } + + + char range_str[32]; range_str[0] = '\0'; + if (spell_range > 0) + { + if (spell_range == ((F32)((S32)spell_range))) + dSprintf(range_str, 32, "%d meter range", (S32) spell_range); + else + dSprintf(range_str, 32, "%.1f meter range", spell_range); + } + + char casting_str[32]; + if (casting_dur <= 0) + dStrcpy(casting_str, "instant"); + else + dSprintf(casting_str, 32, "%.1f sec cast", casting_dur); + + char pack_str[32]; + if (source_pack == ST_NULLSTRING) + dStrcpy(pack_str, "unknown"); + else + dSprintf(pack_str, 32, "%s", source_pack); + + dSprintf(buffer, len, + NAME_FMT "%s" TARGET_FMT "%s" BR + SMALL_BR + MANACOST_FMT "%d Mana" RANGE_FMT "%s" BR + CASTLEN_FMT "%s" BR + SMALL_BR SMALL_BR + DESC_FMT "%s" BR SMALL_BR + PACK_FMT "source: " PACK_NAME_FMT "%s", + spell_name, target_str, + mana_cost, range_str, + casting_str, + spell_desc, pack_str); + + return buffer; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/rpg/afxRPGMagicSpell.h b/Engine/source/afx/rpg/afxRPGMagicSpell.h new file mode 100644 index 000000000..832898547 --- /dev/null +++ b/Engine/source/afx/rpg/afxRPGMagicSpell.h @@ -0,0 +1,105 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_RPG_MAGIC_SPELL_H_ +#define _AFX_RPG_MAGIC_SPELL_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "core/util/tVector.h" +#include "T3D/gameBase/gameBase.h" +#include "console/typeValidators.h" + +#include "afx/afxEffectDefs.h" +#include "afx/afxEffectWrapper.h" +#include "afx/afxMagicMissile.h" + +class afxMagicMissileData; +class afxEffectWrapperData; +class SceneObject; + +class afxRPGMagicSpellDefs +{ +public: + // Migrate this stuff to RPG Magic-System + enum TargetType { + TARGET_NOTHING, + TARGET_SELF, + TARGET_FRIEND, + TARGET_ENEMY, + TARGET_CORPSE, + TARGET_FREE, + }; + + enum { + MAX_REAGENTS_PER_SPELL = 8, + }; +}; + +typedef afxRPGMagicSpellDefs::TargetType afxRPGMagicSpell_TargetType; +DefineEnumType( afxRPGMagicSpell_TargetType ); + +class afxRPGMagicSpellData : public GameBaseData, public afxRPGMagicSpellDefs +{ + typedef GameBaseData Parent; + +public: + F32 casting_dur; + StringTableEntry spell_name; + StringTableEntry spell_desc; + S32 spell_target; + F32 spell_range; + S32 mana_cost; + U8 n_reagents; + S8 reagent_cost[MAX_REAGENTS_PER_SPELL]; + StringTableEntry reagent_name[MAX_REAGENTS_PER_SPELL]; + StringTableEntry icon_name; + StringTableEntry source_pack; + bool is_placeholder; + U8 free_target_style; + bool target_optional; + +private: + char* fmt_placeholder_desc(char* buffer, int len) const; + +public: + /*C*/ afxRPGMagicSpellData(); + + char* formatDesc(char* buffer, int len) const; + bool requiresTarget() { return (spell_target == TARGET_ENEMY || spell_target == TARGET_CORPSE || spell_target == TARGET_FRIEND); } + + virtual bool onAdd(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxRPGMagicSpellData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_RPG_MAGIC_SPELL_H_ diff --git a/Engine/source/afx/ui/afxEventCatchAll.cpp b/Engine/source/afx/ui/afxEventCatchAll.cpp new file mode 100644 index 000000000..7f3da32b3 --- /dev/null +++ b/Engine/source/afx/ui/afxEventCatchAll.cpp @@ -0,0 +1,147 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "gui/3d/guiTSControl.h" + +class afxEventCatchAll : public GuiControl +{ + typedef GuiControl Parent; + +public: + /* C */ afxEventCatchAll() { } + + virtual void getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent); + + virtual void onMouseUp(const GuiEvent&); + virtual void onMouseDown(const GuiEvent&); + virtual void onMouseMove(const GuiEvent&); + virtual void onMouseDragged(const GuiEvent&); + virtual void onMouseEnter(const GuiEvent&); + virtual void onMouseLeave(const GuiEvent&); + + virtual bool onMouseWheelUp(const GuiEvent&); + virtual bool onMouseWheelDown(const GuiEvent&); + + virtual void onRightMouseDown(const GuiEvent&); + virtual void onRightMouseUp(const GuiEvent&); + virtual void onRightMouseDragged(const GuiEvent&); + + DECLARE_CONOBJECT(afxEventCatchAll); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CONOBJECT(afxEventCatchAll); + +ConsoleDocClass( afxEventCatchAll, + "@brief A simple but useful GUI control that propagates all events to its parent " + "control.\n\n" + + "afxEventCatchAll is useful when you want certain events to be handled by its parent " + "afxTSCtrl and not get consumed by certain non-interactive controls like a text " + "HUD.\n\n" + + "@ingroup afxGUI\n" + "@ingroup AFX\n" +); + +void afxEventCatchAll::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->getCursor(cursor, showCursor, lastGuiEvent); +} + +void afxEventCatchAll::onMouseUp(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onMouseUp(evt); +} + +void afxEventCatchAll::onMouseDown(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onMouseDown(evt); +} + +void afxEventCatchAll::onMouseMove(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onMouseMove(evt); +} + +void afxEventCatchAll::onMouseDragged(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onMouseDragged(evt); +} + +void afxEventCatchAll::onMouseEnter(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onMouseEnter(evt); +} + +void afxEventCatchAll::onMouseLeave(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onMouseLeave(evt); +} + +bool afxEventCatchAll::onMouseWheelUp(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + return (parent) ? parent->onMouseWheelUp(evt) : false; +} + +bool afxEventCatchAll::onMouseWheelDown(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + return (parent) ? parent->onMouseWheelDown(evt) : false; +} + +void afxEventCatchAll::onRightMouseDown(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onRightMouseDown(evt); +} + +void afxEventCatchAll::onRightMouseUp(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onRightMouseUp(evt); +} + +void afxEventCatchAll::onRightMouseDragged(const GuiEvent& evt) +{ + GuiTSCtrl* parent = dynamic_cast(getParent()); + if (parent) parent->onRightMouseDragged(evt); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + diff --git a/Engine/source/afx/ui/afxGuiSubstitutionField.cpp b/Engine/source/afx/ui/afxGuiSubstitutionField.cpp new file mode 100644 index 000000000..44ec97c84 --- /dev/null +++ b/Engine/source/afx/ui/afxGuiSubstitutionField.cpp @@ -0,0 +1,205 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "gui/editor/inspector/customField.h" +#include "gui/editor/guiInspector.h" + +#include "afx/ui/afxGuiSubstitutionField.h" + +IMPLEMENT_CONOBJECT( afxGuiSubstitutionField ); + +ConsoleDocClass( afxGuiSubstitutionField, + "@brief A customized variation of GuiInspectorField.\n\n" + + "A customized variation of GuiInspectorField.\n" + + "@ingroup AFX\n" +); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxGuiSubstitutionField::afxGuiSubstitutionField( GuiInspector* inspector, + GuiInspectorGroup* parent, + SimFieldDictionary::Entry* field) +{ + mInspector = inspector; + mParent = parent; + setBounds(0,0,100,20); + + subs_string = StringTable->insert(""); +} + +afxGuiSubstitutionField::afxGuiSubstitutionField() +{ + mInspector = NULL; + mParent = NULL; + subs_string = StringTable->insert(""); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxGuiSubstitutionField::setData( const char* data, bool callbacks ) +{ + if ( mField == NULL) + return; + + const U32 numTargets = mInspector->getNumInspectObjects(); + + //if( callbacks && numTargets > 1 ) + // Con::executef( mInspector, "beginCompoundUndo" ); + + if (data[0] != '$' && data[1] != '$') + { + data = StringTable->insert(avar("$$ %s", data), true); + } + else + { + data = StringTable->insert(data, true); + } + + for( U32 i = 0; i < numTargets; ++ i ) + { + SimObject* target = mInspector->getInspectObject( i ); + SimDataBlock* datablock = dynamic_cast(target); + if (datablock) + datablock->addSubstitution(mField->pFieldname, 0, data); + } + + //if( callbacks && numTargets > 1 ) + // Con::executef( mInspector, "endCompoundUndo" ); + + // Force our edit to update + updateValue(); +} + +const char* afxGuiSubstitutionField::getData( U32 inspectObjectIndex ) +{ + if( mField == NULL) + return ""; + + SimObject* target = mInspector->getInspectObject(inspectObjectIndex); + SimDataBlock* datablock = dynamic_cast(target); + if (datablock) + { + const char* current_subs = datablock->getSubstitution(mField->pFieldname, 0); + if (current_subs) + return StringTable->insert(avar("$$ %s", current_subs)); + } + + return StringTable->insert( "" ); +} + +/// Update this controls value to reflect that of the inspected field. +void afxGuiSubstitutionField::updateValue() +{ + if( mInspector->getNumInspectObjects() > 1 ) + { + // ?? + return; + } + + SimObject* target = mInspector->getInspectObject(0); + SimDataBlock* datablock = dynamic_cast(target); + if (datablock) + { + const char* current_subs = datablock->getSubstitution(mField->pFieldname, 0); + if (current_subs) + { + setValue(StringTable->insert(avar("$$ %s", current_subs))); + return; + } + } + + setValue(StringTable->insert("$$ -- undefined --")); +} + +void afxGuiSubstitutionField::setToolTip( StringTableEntry data ) +{ + mEdit->setDataField( StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile" ); + mEdit->setDataField( StringTable->insert("hovertime"), NULL, "1000" ); + mEdit->setDataField( StringTable->insert("tooltip"), NULL, data ); +} + +bool afxGuiSubstitutionField::onAdd() +{ + if( !Parent::onAdd() ) + return false; + + return true; +} + +GuiControl* afxGuiSubstitutionField::constructEditControl() +{ + if (mField->doNotSubstitute) + { + GuiTextEditCtrl* retCtrl = new GuiTextEditCtrl(); + + retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" ); + + // Register the object + retCtrl->registerObject(); + + retCtrl->setText( StringTable->insert("n/a") ); + retCtrl->setActive(false); + + return retCtrl; + } + + GuiControl* retCtrl = new GuiTextEditCtrl(); + + retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" ); + + // Register the object + retCtrl->registerObject(); + + char szBuffer[512]; + dSprintf( szBuffer, 512, "%d.apply(%d.getText());",getId(), retCtrl->getId() ); + retCtrl->setField("AltCommand", szBuffer ); + retCtrl->setField("Validate", szBuffer ); + + return retCtrl; +} + +void afxGuiSubstitutionField::setValue( const char* newValue ) +{ + if (!mField->doNotSubstitute) + { + GuiTextEditCtrl *ctrl = dynamic_cast( mEdit ); + if ( ctrl != NULL ) + ctrl->setText( newValue ); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// protected: + +void afxGuiSubstitutionField::_executeSelectedCallback() +{ + Con::executef( mInspector, "onFieldSelected", mCaption, ConsoleBaseType::getType(mField->type)->getTypeName(), "Substitution Statement" ); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ui/afxGuiSubstitutionField.h b/Engine/source/afx/ui/afxGuiSubstitutionField.h new file mode 100644 index 000000000..a9cd7b141 --- /dev/null +++ b/Engine/source/afx/ui/afxGuiSubstitutionField.h @@ -0,0 +1,66 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_GUI_SUBSTITUTION_FIELD_H_ +#define _AFX_GUI_SUBSTITUTION_FIELD_H_ + +#include "console/simFieldDictionary.h" +#include "gui/editor/inspector/field.h" + +class afxGuiSubstitutionField : public GuiInspectorField +{ + typedef GuiInspectorField Parent; + +public: + + afxGuiSubstitutionField(GuiInspector *inspector, GuiInspectorGroup* parent, SimFieldDictionary::Entry* field); + afxGuiSubstitutionField(); + ~afxGuiSubstitutionField() {}; + + DECLARE_CONOBJECT(afxGuiSubstitutionField); + DECLARE_CATEGORY("AFX"); + + virtual void setData( const char* data, bool callbacks = true ); + virtual const char* getData( U32 inspectObjectIndex = 0 ); + virtual void updateValue(); + + virtual void setToolTip( StringTableEntry data ); + + virtual bool onAdd(); + + virtual GuiControl* constructEditControl(); + + virtual void setValue( const char* newValue ); + +protected: + + virtual void _executeSelectedCallback(); + +protected: + + String subs_string; +}; + +#endif // _AFX_SUBSTITUTION_FIELD_H_ diff --git a/Engine/source/afx/ui/afxGuiTextHud.cpp b/Engine/source/afx/ui/afxGuiTextHud.cpp new file mode 100644 index 000000000..90bc24b00 --- /dev/null +++ b/Engine/source/afx/ui/afxGuiTextHud.cpp @@ -0,0 +1,328 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "gui/3d/guiTSControl.h" +#include "gfx/gfxDrawUtil.h" +#include "T3D/gameBase/gameConnection.h" +#include "T3D/shapeBase.h" + +#include "afx/ui/afxGuiTextHud.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +Vector afxGuiTextHud::text_items; + +IMPLEMENT_CONOBJECT(afxGuiTextHud); + +ConsoleDocClass( afxGuiTextHud, + "@brief Similar to GuiShapeNameHud, afxGuiTextHud displays ShapeBase object names but " + "also allows Gui Text effects.\n\n" + + "@ingroup GuiGame\n" +); + +afxGuiTextHud::afxGuiTextHud() +{ + mFillColor.set( 0.25f, 0.25f, 0.25f, 0.25f ); + mFrameColor.set( 0, 0, 0, 1 ); + mTextColor.set( 0, 1, 0, 1 ); + mShowFill = false; + mShowFrame = true; + mVerticalOffset = 0.5f; + mDistanceFade = 0.1f; + mLabelAllShapes = false; + mEnableControlObjectOcclusion = false; +} + +void afxGuiTextHud::initPersistFields() +{ + addGroup("Colors"); + addField( "fillColor", TypeColorF, Offset( mFillColor, afxGuiTextHud ), + "..."); + addField( "frameColor", TypeColorF, Offset( mFrameColor, afxGuiTextHud ), + "..."); + addField( "textColor", TypeColorF, Offset( mTextColor, afxGuiTextHud ), + "..."); + endGroup("Colors"); + + addGroup("Misc"); + addField( "showFill", TypeBool, Offset( mShowFill, afxGuiTextHud ), + "..."); + addField( "showFrame", TypeBool, Offset( mShowFrame, afxGuiTextHud ), + "..."); + addField( "verticalOffset", TypeF32, Offset( mVerticalOffset, afxGuiTextHud ), + "..."); + addField( "distanceFade", TypeF32, Offset( mDistanceFade, afxGuiTextHud ), + "..."); + addField( "labelAllShapes", TypeBool, Offset( mLabelAllShapes, afxGuiTextHud ), + "..."); + addField( "enableControlObjectOcclusion", TypeBool, Offset( mEnableControlObjectOcclusion, afxGuiTextHud ), + "..."); + endGroup("Misc"); + + Parent::initPersistFields(); +} + +//---------------------------------------------------------------------------- +/// Core rendering method for this control. +/// +/// This method scans through all the current client ShapeBase objects. +/// If one is named, it displays the name and damage information for it. +/// +/// Information is offset from the center of the object's bounding box, +/// unless the object is a PlayerObjectType, in which case the eye point +/// is used. +/// +/// @param updateRect Extents of control. +void afxGuiTextHud::onRender( Point2I, const RectI &updateRect) +{ + // Background fill first + if (mShowFill) + GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor.toColorI()); + + // Must be in a TS Control + GuiTSCtrl *parent = dynamic_cast(getParent()); + if (!parent) return; + + // Must have a connection and control object + GameConnection* conn = GameConnection::getConnectionToServer(); + if (!conn) + return; + + GameBase * control = dynamic_cast(conn->getControlObject()); + if (!control) + return; + + // Get control camera info + MatrixF cam; + Point3F camPos; + VectorF camDir; + conn->getControlCameraTransform(0,&cam); + cam.getColumn(3, &camPos); + cam.getColumn(1, &camDir); + + F32 camFovCos; + conn->getControlCameraFov(&camFovCos); + camFovCos = mCos(mDegToRad(camFovCos) / 2); + + // Visible distance info & name fading + F32 visDistance = gClientSceneGraph->getVisibleDistance(); + F32 visDistanceSqr = visDistance * visDistance; + F32 fadeDistance = visDistance * mDistanceFade; + + // Collision info. We're going to be running LOS tests and we + // don't want to collide with the control object. + static U32 losMask = TerrainObjectType | TerrainLikeObjectType | ShapeBaseObjectType; + + if (!mEnableControlObjectOcclusion) + control->disableCollision(); + + if (mLabelAllShapes) + { + // This section works just like GuiShapeNameHud and renders labels for + // all the shapes. + + // All ghosted objects are added to the server connection group, + // so we can find all the shape base objects by iterating through + // our current connection. + for (SimSetIterator itr(conn); *itr; ++itr) + { + ///if ((*itr)->getTypeMask() & ShapeBaseObjectType) + ///{ + ShapeBase* shape = dynamic_cast(*itr); + if ( shape ) { + if (shape != control && shape->getShapeName()) + { + + // Target pos to test, if it's a player run the LOS to his eye + // point, otherwise we'll grab the generic box center. + Point3F shapePos; + if (shape->getTypeMask() & PlayerObjectType) + { + MatrixF eye; + + // Use the render eye transform, otherwise we'll see jittering + shape->getRenderEyeTransform(&eye); + eye.getColumn(3, &shapePos); + } + else + { + // Use the render transform instead of the box center + // otherwise it'll jitter. + MatrixF srtMat = shape->getRenderTransform(); + srtMat.getColumn(3, &shapePos); + } + + VectorF shapeDir = shapePos - camPos; + + // Test to see if it's in range + F32 shapeDist = shapeDir.lenSquared(); + if (shapeDist == 0 || shapeDist > visDistanceSqr) + continue; + shapeDist = mSqrt(shapeDist); + + // Test to see if it's within our viewcone, this test doesn't + // actually match the viewport very well, should consider + // projection and box test. + shapeDir.normalize(); + F32 dot = mDot(shapeDir, camDir); + if (dot < camFovCos) + continue; + + // Test to see if it's behind something, and we want to + // ignore anything it's mounted on when we run the LOS. + RayInfo info; + shape->disableCollision(); + SceneObject *mount = shape->getObjectMount(); + if (mount) + mount->disableCollision(); + bool los = !gClientContainer.castRay(camPos, shapePos,losMask, &info); + shape->enableCollision(); + if (mount) + mount->enableCollision(); + + if (!los) + continue; + + // Project the shape pos into screen space and calculate + // the distance opacity used to fade the labels into the + // distance. + Point3F projPnt; + shapePos.z += mVerticalOffset; + if (!parent->project(shapePos, &projPnt)) + continue; + F32 opacity = (shapeDist < fadeDistance)? 1.0: + 1.0 - (shapeDist - fadeDistance) / (visDistance - fadeDistance); + + // Render the shape's name + drawName(Point2I((S32)projPnt.x, (S32)projPnt.y),shape->getShapeName(),opacity); + } + } + } + } + + // This section renders all text added by afxGuiText effects. + for (S32 i = 0; i < text_items.size(); i++) + { + HudTextSpec* spec = &text_items[i]; + if (spec->text && spec->text[0] != '\0') + { + VectorF shapeDir = spec->pos - camPos; + + // do range test + F32 shapeDist = shapeDir.lenSquared(); + if (shapeDist == 0 || shapeDist > visDistanceSqr) + continue; + shapeDist = mSqrt(shapeDist); + + // Test to see if it's within our viewcone, this test doesn't + // actually match the viewport very well, should consider + // projection and box test. + shapeDir.normalize(); + F32 dot = mDot(shapeDir, camDir); + if (dot < camFovCos) + continue; + + // Test to see if it's behind something, and we want to + // ignore anything it's mounted on when we run the LOS. + RayInfo info; + if (spec->obj) + spec->obj->disableCollision(); + bool los = !gClientContainer.castRay(camPos, spec->pos, losMask, &info); + if (spec->obj) + spec->obj->enableCollision(); + if (!los) + continue; + + // Project the shape pos into screen space. + Point3F projPnt; + if (!parent->project(spec->pos, &projPnt)) + continue; + + // Calculate the distance opacity used to fade text into the distance. + F32 opacity = (shapeDist < fadeDistance)? 1.0 : 1.0 - (shapeDist - fadeDistance) / (25.0f); + if (opacity > 0.01f) + drawName(Point2I((S32)projPnt.x, (S32)projPnt.y), spec->text, opacity, &spec->text_clr); + } + } + + // Restore control object collision + if (!mEnableControlObjectOcclusion) + control->enableCollision(); + + // Border last + if (mShowFrame) + GFX->getDrawUtil()->drawRect(updateRect, mFrameColor.toColorI()); + + reset(); +} + +//---------------------------------------------------------------------------- +/// Render object names. +/// +/// Helper function for GuiShapeNameHud::onRender +/// +/// @param offset Screen coordinates to render name label. (Text is centered +/// horizontally about this location, with bottom of text at +/// specified y position.) +/// @param name String name to display. +/// @param opacity Opacity of name (a fraction). +void afxGuiTextHud::drawName(Point2I offset, const char *name, F32 opacity, LinearColorF* color) +{ + // Center the name + offset.x -= mProfile->mFont->getStrWidth((const UTF8 *)name) / 2; + offset.y -= mProfile->mFont->getHeight(); + + // Deal with opacity and draw. + LinearColorF draw_color = (color) ? *color : mTextColor; + draw_color.alpha *= opacity; + GFX->getDrawUtil()->setBitmapModulation(draw_color.toColorI()); + GFX->getDrawUtil()->drawText(mProfile->mFont, offset, name); + GFX->getDrawUtil()->clearBitmapModulation(); +} + +void afxGuiTextHud::addTextItem(const Point3F& pos, const char* text, LinearColorF& color, SceneObject* obj) +{ + if (!text || text[0] == '\0') + return; + + HudTextSpec spec; + spec.pos = pos; + spec.text = text; + spec.text_clr = color; + spec.obj = obj; + + text_items.push_back(spec); +} + +void afxGuiTextHud::reset() +{ + text_items.clear(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/ui/afxGuiTextHud.h b/Engine/source/afx/ui/afxGuiTextHud.h new file mode 100644 index 000000000..285f74193 --- /dev/null +++ b/Engine/source/afx/ui/afxGuiTextHud.h @@ -0,0 +1,87 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_GUI_TEXT_HUD_H_ +#define _AFX_GUI_TEXT_HUD_H_ + +#include "gui/core/guiControl.h" + +//---------------------------------------------------------------------------- +/// Displays name & damage above shape objects. +/// +/// This control displays the name and damage value of all named +/// ShapeBase objects on the client. The name and damage of objects +/// within the control's display area are overlayed above the object. +/// +/// This GUI control must be a child of a TSControl, and a server connection +/// and control object must be present. +/// +/// This is a stand-alone control and relies only on the standard base GuiControl. +class afxGuiTextHud : public GuiControl +{ + typedef GuiControl Parent; + + struct HudTextSpec + { + Point3F pos; + const char* text; + LinearColorF text_clr; + SceneObject* obj; + }; + + static Vector text_items; + + // field data + LinearColorF mFillColor; + LinearColorF mFrameColor; + LinearColorF mTextColor; + + F32 mVerticalOffset; + F32 mDistanceFade; + bool mShowFrame; + bool mShowFill; + bool mLabelAllShapes; + bool mEnableControlObjectOcclusion; + +protected: + void drawName( Point2I offset, const char *buf, F32 opacity, LinearColorF* color=0); + +public: + afxGuiTextHud(); + + // GuiControl + virtual void onRender(Point2I offset, const RectI &updateRect); + + static void initPersistFields(); + static void addTextItem(const Point3F& pos, const char* text, LinearColorF& color, SceneObject* obj=0); + static void reset(); + + DECLARE_CONOBJECT( afxGuiTextHud ); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif //_AFX_GUI_TEXT_HUD_H_ diff --git a/Engine/source/afx/ui/afxProgressBase.h b/Engine/source/afx/ui/afxProgressBase.h new file mode 100644 index 000000000..70f777002 --- /dev/null +++ b/Engine/source/afx/ui/afxProgressBase.h @@ -0,0 +1,37 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PROGRESS_BASE_H_ +#define _AFX_PROGRESS_BASE_H_ + +class afxProgressBase +{ +public: + virtual void setProgress(F32 value)=0; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif //_AFX_PROGRESS_BASE_H_ diff --git a/Engine/source/afx/ui/afxSpellButton.cpp b/Engine/source/afx/ui/afxSpellButton.cpp new file mode 100644 index 000000000..149423dd0 --- /dev/null +++ b/Engine/source/afx/ui/afxSpellButton.cpp @@ -0,0 +1,393 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +//------------------------------------- +// +// Bitmap Button Contrl +// Set 'bitmap' comsole field to base name of bitmaps to use. This control will +// append '_n' for normal +// append '_h' for hilighted +// append '_d' for depressed +// +// if bitmap cannot be found it will use the default bitmap to render. +// +// if the extent is set to (0,0) in the gui editor and appy hit, this control will +// set it's extent to be exactly the size of the normal bitmap (if present) +// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "gfx/gfxDrawUtil.h" + +#include "afx/ui/afxSpellButton.h" +#include "afx/afxSpellBook.h" +#include "afx/afxMagicSpell.h" +#include "afx/rpg/afxRPGMagicSpell.h" + +IMPLEMENT_CONOBJECT(afxSpellButton); + +ConsoleDocClass( afxSpellButton, + "@brief A GUI button with some special features that are useful for casting AFX spells.\n\n" + + "@ingroup afxGUI\n" + "@ingroup AFX\n" +); + +#define COOLDOWN_PROFILE &GFXDefaultGUIProfile, avar("%s() - Cooldown Texture (line %d)", __FUNCTION__, __LINE__) + +StringTableEntry afxSpellButton::sUnknownSpellBitmap = ""; +StringTableEntry afxSpellButton::sSpellCooldownBitmaps = ""; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxSpellButton::afxSpellButton() +{ + if (sUnknownSpellBitmap == NULL) + sUnknownSpellBitmap = ST_NULLSTRING; + if (sSpellCooldownBitmaps == NULL) + sSpellCooldownBitmaps = ST_NULLSTRING; + mBitmapName = ST_NULLSTRING; + setExtent(140, 30); + spellbook = NULL; + book_slot.set(0, 0); +} + +afxSpellButton::~afxSpellButton() +{ +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxSpellButton::initPersistFields() +{ + addField("bitmap", TypeFilename, Offset(mBitmapName, afxSpellButton), + "..."); + addField("book_slot", TypePoint2I, Offset(book_slot, afxSpellButton), + "..."); + + Parent::initPersistFields(); + + Con::addVariable("pref::afxSpellButton::unknownSpellBitmap", TypeFilename, &sUnknownSpellBitmap); + Con::addVariable("pref::afxSpellButton::spellCooldownBitmaps", TypeFilename, &sSpellCooldownBitmaps); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +bool afxSpellButton::onAdd() +{ + if (!Parent::onAdd()) + return false; + + if (sSpellCooldownBitmaps != NULL) + { + char buffer[256]; + for (int i = 0; i < NUM_COOLDOWN_FRAMES; i++) + { + dSprintf(buffer, 256, "%s_%.2d", sSpellCooldownBitmaps, i); + cooldown_txrs[i].set(buffer, COOLDOWN_PROFILE); + } + } + + return true; +} + +bool afxSpellButton::onWake() +{ + if (! Parent::onWake()) + return false; + + setActive(true); + + update_bitmap(); + + return true; +} + +void afxSpellButton::onSleep() +{ + mTextureNormal = NULL; + mTextureHilight = NULL; + mTextureDepressed = NULL; + Parent::onSleep(); +} + +void afxSpellButton::onMouseEnter(const GuiEvent &event) +{ + Parent::onMouseEnter(event); + Con::executef(this, "onMouseEnter"); +} + +void afxSpellButton::onMouseLeave(const GuiEvent &event) +{ + Parent::onMouseLeave(event); + Con::executef(this, "onMouseLeave"); +} + +void afxSpellButton::inspectPostApply() +{ + // if the extent is set to (0,0) in the gui editor and apply hit, this control will + // set it's extent to be exactly the size of the normal bitmap (if present) + Parent::inspectPostApply(); + + if ((getWidth() == 0) && (getHeight() == 0) && mTextureNormal) + { + setExtent(mTextureNormal->getWidth(), mTextureNormal->getHeight()); + } +} + +void afxSpellButton::setBitmap(const char *name, bool placeholder) +{ + mBitmapName = (name) ? StringTable->insert(name) : ST_NULLSTRING; + if (!isAwake()) + return; + + if (mBitmapName != ST_NULLSTRING) + { + char buffer[1024]; + char *p; + + if (placeholder) + { + dStrcpy(buffer, name); + p = buffer + dStrlen(buffer); + + dStrcpy(p, "_i"); + mTextureInactive.set(buffer, COOLDOWN_PROFILE); + mTextureNormal = mTextureInactive; + mTextureHilight = mTextureInactive; + mTextureDepressed = mTextureInactive; + setActive(false); + } + else + { + dStrcpy(buffer, name); + p = buffer + dStrlen(buffer); + dStrcpy(p, "_n"); + mTextureNormal.set(buffer, COOLDOWN_PROFILE); + dStrcpy(p, "_h"); + mTextureHilight.set(buffer, COOLDOWN_PROFILE); + if (!mTextureHilight) + mTextureHilight = mTextureNormal; + dStrcpy(p, "_d"); + mTextureDepressed.set(buffer, COOLDOWN_PROFILE); + if (!mTextureDepressed) + mTextureDepressed = mTextureHilight; + dStrcpy(p, "_i"); + mTextureInactive.set(buffer, COOLDOWN_PROFILE); + if (!mTextureInactive) + mTextureInactive = mTextureNormal; + setActive(true); + } + } + else + { + mTextureNormal = NULL; + mTextureHilight = NULL; + mTextureDepressed = NULL; + mTextureInactive = NULL; + } + + setUpdate(); +} + +void afxSpellButton::onRender(Point2I offset, const RectI& updateRect) +{ + enum { NORMAL, HILIGHT, DEPRESSED, INACTIVE } state = NORMAL; + + if (mActive) + { + if (mMouseOver) state = HILIGHT; + if (mDepressed || mStateOn) state = DEPRESSED; + } + else + state = INACTIVE; + + switch (state) + { + case NORMAL: renderButton(mTextureNormal, offset, updateRect); break; + case HILIGHT: renderButton(mTextureHilight ? mTextureHilight : mTextureNormal, offset, updateRect); break; + case DEPRESSED: renderButton(mTextureDepressed, offset, updateRect); break; + case INACTIVE: renderButton(mTextureInactive ? mTextureInactive : mTextureNormal, offset, updateRect); break; + } +} + +void afxSpellButton::onDeleteNotify(SimObject* obj) +{ + // Handle Shape Deletion + afxSpellBook* book = dynamic_cast(obj); + if (book != NULL) + { + if (book == spellbook) + { + spellbook = NULL; + setBitmap(""); + setVisible(false); + return; + } + } + + Parent::onDeleteNotify(obj); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// protected: + +void afxSpellButton::renderButton(GFXTexHandle &texture, Point2I &offset, + const RectI& updateRect) +{ + if (texture) + { + RectI rect(offset, getExtent()); + GFX->getDrawUtil()->clearBitmapModulation(); + GFX->getDrawUtil()->drawBitmapStretch(texture, rect); + + if (spellbook) + { + F32 cooldown = spellbook->getCooldownFactor(book_slot.x, book_slot.y); + if (cooldown < 1.0f) + { + + if (cooldown_txrs[(int)(36.0f*cooldown)]) + GFX->getDrawUtil()->drawBitmapStretch(cooldown_txrs[(int)(36.0f*cooldown)], rect); + } + } + + renderChildControls( offset, updateRect); + } + else + Parent::onRender(offset, updateRect); +} + +void afxSpellButton::update_bitmap() +{ + const char* icon_name = 0; + + bool is_placeholder = false; + if (spellbook) + { + icon_name = spellbook->getSpellIcon(book_slot.x, book_slot.y); + is_placeholder = spellbook->isPlaceholder(book_slot.x, book_slot.y); + if (icon_name && icon_name[0] == '\0') + icon_name = sUnknownSpellBitmap; + } + + if (icon_name) + { + setBitmap(icon_name, is_placeholder); + setVisible(true); + } + else + { + setBitmap(""); + setVisible(false); + } +} + +void afxSpellButton::setSpellBook(afxSpellBook* book, U8 page) +{ + book_slot.x = page; + + if (spellbook) + clearNotify(spellbook); + + spellbook = book; + update_bitmap(); + + if (spellbook) + deleteNotify(spellbook); +} + +void afxSpellButton::setPage(U8 page) +{ + book_slot.x = page; + update_bitmap(); +} + +char* afxSpellButton::formatDesc(char* buffer, int len) const +{ + return (spellbook) ? spellbook->formatDesc(buffer, len, book_slot.x, book_slot.y) : (char*)""; +} + +afxMagicSpellData* afxSpellButton::getSpellDataBlock() const +{ + return (spellbook) ? spellbook->getSpellData(book_slot.x, book_slot.y) : 0; +} + +afxRPGMagicSpellData* afxSpellButton::getSpellRPGDataBlock() const +{ + return (spellbook) ? spellbook->getSpellRPGData(book_slot.x, book_slot.y) : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod( afxSpellButton, onSpellbookChange, void, ( afxSpellBook* spellbook, unsigned int page ),, + "Notify an afxSpellButton when its associated spellbook has changed.\n" ) +{ + object->setSpellBook(spellbook, (U8)page); +} + +DefineEngineMethod( afxSpellButton, onTurnPage, void, ( unsigned int page ),, + "Notify an afxSpellButton when the spellbook turns to a new page.\n" ) +{ + object->setPage((U8)page); +} + +DefineEngineMethod( afxSpellButton, getSpellDescription, const char*, (),, + "Get the text description of a spell.\n" ) +{ + char buf[1024]; + return object->formatDesc(buf, 1024); +} + +DefineEngineMethod( afxSpellButton, getSpellDataBlock, S32, (),, + "Get the spell's datablock.\n" ) +{ + afxMagicSpellData* spell_data = object->getSpellDataBlock(); + return (spell_data) ? spell_data->getId() : -1; +} + +DefineEngineMethod( afxSpellButton, getSpellRPGDataBlock, S32, (),, + "Get the spell's RPG datablock.\n" ) +{ + afxRPGMagicSpellData* spell_rpg_data = object->getSpellRPGDataBlock(); + return (spell_rpg_data) ? spell_rpg_data->getId() : -1; +} + +DefineEngineMethod( afxSpellButton, useFreeTargeting, bool, (),, + "Test if spell uses free targeting.\n" ) +{ + afxRPGMagicSpellData* spell_rpg_data = object->getSpellRPGDataBlock(); + return (spell_rpg_data) ? (spell_rpg_data->spell_target == afxRPGMagicSpellData::TARGET_FREE) : false; +} + +DefineEngineMethod( afxSpellButton, getFreeTargetStyle, S32, (),, + "Get the free targeting style used by the spell.\n" ) +{ + afxRPGMagicSpellData* spell_rpg_data = object->getSpellRPGDataBlock(); + return (spell_rpg_data) ? spell_rpg_data->free_target_style : 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ui/afxSpellButton.h b/Engine/source/afx/ui/afxSpellButton.h new file mode 100644 index 000000000..02db1e3cc --- /dev/null +++ b/Engine/source/afx/ui/afxSpellButton.h @@ -0,0 +1,103 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_SPELL_BUTTON_H_ +#define _AFX_SPELL_BUTTON_H_ + +#include "gui/buttons/guiButtonCtrl.h" + +///------------------------------------- +/// Bitmap Button Contrl +/// Set 'bitmap' comsole field to base name of bitmaps to use. This control will +/// append '_n' for normal +/// append '_h' for hilighted +/// append '_d' for depressed +/// +/// if bitmap cannot be found it will use the default bitmap to render. +/// +/// if the extent is set to (0,0) in the gui editor and appy hit, this control will +/// set it's extent to be exactly the size of the normal bitmap (if present) +/// + +class afxSpellBook; +class afxMagicSpellData; +class afxRPGMagicSpellData; + +class afxSpellButton : public GuiButtonCtrl +{ +private: + typedef GuiButtonCtrl Parent; + + enum { NUM_COOLDOWN_FRAMES = 36 }; + +protected: + static StringTableEntry sUnknownSpellBitmap; + static StringTableEntry sSpellCooldownBitmaps; + + StringTableEntry mBitmapName; + GFXTexHandle mTextureNormal; + GFXTexHandle mTextureHilight; + GFXTexHandle mTextureDepressed; + GFXTexHandle mTextureInactive; + + afxSpellBook* spellbook; + Point2I book_slot; + + GFXTexHandle cooldown_txrs[NUM_COOLDOWN_FRAMES]; + + void update_bitmap(); + void renderButton(GFXTexHandle &texture, Point2I &offset, const RectI& updateRect); + +public: + /*C*/ afxSpellButton(); + /*D*/ ~afxSpellButton(); + + void setBitmap(const char *name, bool placholder=false); + void setSpellBook(afxSpellBook*, U8 page); + void setPage(U8 page); + char* formatDesc(char* buffer, int len) const; + + afxMagicSpellData* getSpellDataBlock() const; + afxRPGMagicSpellData* getSpellRPGDataBlock() const; + + virtual bool onAdd(); + virtual bool onWake(); + virtual void onSleep(); + virtual void inspectPostApply(); + virtual void onMouseEnter(const GuiEvent &event); + virtual void onMouseLeave(const GuiEvent &event); + virtual void onRender(Point2I offset, const RectI &updateRect); + + virtual void onDeleteNotify(SimObject*); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxSpellButton); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif //_GUI_BITMAP_BUTTON_CTRL_H diff --git a/Engine/source/afx/ui/afxSpellCastBar.cpp b/Engine/source/afx/ui/afxSpellCastBar.cpp new file mode 100644 index 000000000..f08740743 --- /dev/null +++ b/Engine/source/afx/ui/afxSpellCastBar.cpp @@ -0,0 +1,162 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "gui/core/guiControl.h" +#include "gfx/gfxDrawUtil.h" + +#include "afx/ui/afxProgressBase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxSpellCastBar : public GuiControl, public afxProgressBase +{ + typedef GuiControl Parent; + + bool want_border; + bool want_background; + bool use_alt_final_color; + LinearColorF rgba_background; + LinearColorF rgba_border; + LinearColorF rgba_fill; + LinearColorF rgba_fill_final; + + F32 fraction; + +public: + /*C*/ afxSpellCastBar(); + + virtual void onRender(Point2I, const RectI&); + + void setFraction(F32 frac); + F32 getFraction() const { return fraction; } + + virtual void setProgress(F32 value) { setFraction(value); } + virtual void onStaticModified(const char* slotName, const char* newValue = NULL); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxSpellCastBar); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CONOBJECT(afxSpellCastBar); + +ConsoleDocClass( afxSpellCastBar, + "@brief A GUI progress bar useful as a spell casting bar.\n\n" + + "@ingroup afxGUI\n" + "@ingroup AFX\n" +); + +afxSpellCastBar::afxSpellCastBar() +{ + want_border = true; + want_background = true; + use_alt_final_color = false; + rgba_background.set(0.0f, 0.0f, 0.0f, 0.5f); + rgba_border.set(0.5f, 0.5f, 0.5f, 1.0f); + rgba_fill.set(0.0f, 1.0f, 1.0f, 1.0f); + rgba_fill_final.set(0.0f, 1.0f, 1.0f, 1.0f); + + fraction = 0.5f; +} + +void afxSpellCastBar::setFraction(F32 frac) +{ + fraction = mClampF(frac, 0.0f, 1.0f); +} + +void afxSpellCastBar::onStaticModified(const char* slotName, const char* newValue) +{ + Parent::onStaticModified(slotName, newValue); + if (dStricmp(slotName, "fillColorFinal") == 0) + use_alt_final_color = true; +} + +// STATIC +void afxSpellCastBar::initPersistFields() +{ + addGroup("Colors"); + addField( "backgroundColor", TypeColorF, Offset(rgba_background, afxSpellCastBar), + "..."); + addField( "borderColor", TypeColorF, Offset(rgba_border, afxSpellCastBar), + "..."); + addField( "fillColor", TypeColorF, Offset(rgba_fill, afxSpellCastBar), + "..."); + addField( "fillColorFinal", TypeColorF, Offset(rgba_fill_final, afxSpellCastBar), + "..."); + endGroup("Colors"); + + Parent::initPersistFields(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +void afxSpellCastBar::onRender(Point2I offset, const RectI &updateRect) +{ + LinearColorF color; + + // draw the background + if (want_background) + { + color.set(rgba_background.red, rgba_background.green, rgba_background.blue, rgba_background.alpha*fade_amt); + GFX->getDrawUtil()->drawRectFill(updateRect, color.toColorI()); + } + + // calculate the rectangle dimensions + RectI rect(updateRect); + rect.extent.x = (S32)(rect.extent.x * fraction); + + // draw the filled part of bar + if (fraction >= 1.0f && use_alt_final_color) + color.set(rgba_fill_final.red, rgba_fill_final.green, rgba_fill_final.blue, rgba_fill_final.alpha*fade_amt); + else + color.set(rgba_fill.red, rgba_fill.green, rgba_fill.blue, rgba_fill.alpha*fade_amt); + + GFX->getDrawUtil()->drawRectFill(rect, color.toColorI()); + + // draw the border + if (want_border) + { + color.set(rgba_border.red, rgba_border.green, rgba_border.blue, rgba_border.alpha*fade_amt); + GFX->getDrawUtil()->drawRect(updateRect, color.toColorI()); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxSpellCastBar, setProgress, void, (float percentDone),, + "Set the progress percentage on the progress-bar.\n\n" + "@ingroup AFX") +{ + object->setFraction(percentDone); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ui/afxSpellCastBar.h b/Engine/source/afx/ui/afxSpellCastBar.h new file mode 100644 index 000000000..c4e948cd8 --- /dev/null +++ b/Engine/source/afx/ui/afxSpellCastBar.h @@ -0,0 +1,24 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ui/afxStatusBar.cpp b/Engine/source/afx/ui/afxStatusBar.cpp new file mode 100644 index 000000000..b2e79e69c --- /dev/null +++ b/Engine/source/afx/ui/afxStatusBar.cpp @@ -0,0 +1,202 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "gui/core/guiControl.h" +#include "T3D/gameBase/gameConnection.h" +#include "T3D/shapeBase.h" +#include "gfx/gfxDrawUtil.h" + +#include "afx/ui/afxProgressBase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxStatusBar : public GuiControl, public afxProgressBase +{ + typedef GuiControl Parent; + + LinearColorF rgba_fill; + + F32 fraction; + ShapeBase* shape; + bool show_energy; + bool monitor_player; + +public: + /*C*/ afxStatusBar(); + + virtual void onRender(Point2I, const RectI&); + + void setFraction(F32 frac); + F32 getFraction() const { return fraction; } + + virtual void setProgress(F32 value) { setFraction(value); } + + void setShape(ShapeBase* s); + void clearShape() { setShape(NULL); } + + virtual bool onWake(); + virtual void onSleep(); + virtual void onMouseDown(const GuiEvent &event); + virtual void onDeleteNotify(SimObject*); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxStatusBar); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CONOBJECT(afxStatusBar); + +ConsoleDocClass( afxStatusBar, + "@brief A GUI status bar for tracking and displaying health and energy of ShapeBase " + "objects.\n\n" + + "@ingroup afxGUI\n" + "@ingroup AFX\n" +); + +afxStatusBar::afxStatusBar() +{ + rgba_fill.set(0.0f, 1.0f, 1.0f, 1.0f); + + fraction = 1.0f; + shape = 0; + show_energy = false; + monitor_player = false; +} + +void afxStatusBar::setFraction(F32 frac) +{ + fraction = mClampF(frac, 0.0f, 1.0f); +} + +void afxStatusBar::setShape(ShapeBase* s) +{ + if (shape) + clearNotify(shape); + shape = s; + if (shape) + deleteNotify(shape); +} + +void afxStatusBar::onDeleteNotify(SimObject* obj) +{ + if (shape == (ShapeBase*)obj) + { + shape = NULL; + return; + } + + Parent::onDeleteNotify(obj); +} + +bool afxStatusBar::onWake() +{ + if (!Parent::onWake()) + return false; + + return true; +} + +void afxStatusBar::onSleep() +{ + //clearShape(); + Parent::onSleep(); +} + +// STATIC +void afxStatusBar::initPersistFields() +{ + addField("fillColor", TypeColorF, Offset(rgba_fill, afxStatusBar), + "..."); + addField("displayEnergy", TypeBool, Offset(show_energy, afxStatusBar), + "..."); + addField("monitorPlayer", TypeBool, Offset(monitor_player, afxStatusBar), + "..."); + + Parent::initPersistFields(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + + +void afxStatusBar::onRender(Point2I offset, const RectI &updateRect) +{ + if (!shape) + return; + + if (shape->getDamageState() != ShapeBase::Enabled) + fraction = 0.0f; + else + fraction = (show_energy) ? shape->getEnergyValue() : (1.0f - shape->getDamageValue()); + + // set alpha value for the fill area + rgba_fill.alpha = 1.0f; + + // calculate the rectangle dimensions + RectI rect(updateRect); + rect.extent.x = (S32)(rect.extent.x*fraction); + + // draw the filled part of bar + GFX->getDrawUtil()->drawRectFill(rect, rgba_fill.toColorI()); +} + +void afxStatusBar::onMouseDown(const GuiEvent &event) +{ + GuiControl *parent = getParent(); + if (parent) + parent->onMouseDown(event); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxStatusBar, setProgress, void, (float percentDone),, + "Set the progress percentage on the status-bar.\n\n" + "@ingroup AFX") +{ + object->setFraction(percentDone); +} + +DefineEngineMethod(afxStatusBar, setShape, void, (ShapeBase* shape),, + "Associate a ShapeBase-derived object with the status-bar.\n\n" + "@ingroup AFX") +{ + object->setShape(shape); +} + +DefineEngineMethod(afxStatusBar, clearShape, void, (),, + "Clear out any ShapeBase-derived object associated with the status-bar.\n\n" + "@ingroup AFX") +{ + object->clearShape(); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ui/afxStatusBar.h b/Engine/source/afx/ui/afxStatusBar.h new file mode 100644 index 000000000..c4e948cd8 --- /dev/null +++ b/Engine/source/afx/ui/afxStatusBar.h @@ -0,0 +1,24 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ui/afxStatusBox.cpp b/Engine/source/afx/ui/afxStatusBox.cpp new file mode 100644 index 000000000..80344e8f7 --- /dev/null +++ b/Engine/source/afx/ui/afxStatusBox.cpp @@ -0,0 +1,52 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/ui/afxStatusBox.h" + +IMPLEMENT_CONOBJECT(afxStatusBox); + +ConsoleDocClass( afxStatusBox, + "@brief A simple GUI control used to contain player status bars and a label.\n\n" + + "@ingroup afxGUI\n" + "@ingroup AFX\n" +); + +afxStatusBox::afxStatusBox() +{ +} + +void afxStatusBox::onMouseDown(const GuiEvent &event) +{ + Parent::onMouseDown(event); + Con::executef(this, "onMouseDown"); +} + +void afxStatusBox::onSleep() +{ + Parent::onSleep(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ui/afxStatusBox.h b/Engine/source/afx/ui/afxStatusBox.h new file mode 100644 index 000000000..f048cef2f --- /dev/null +++ b/Engine/source/afx/ui/afxStatusBox.h @@ -0,0 +1,50 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_STATUS_BOX_H_ +#define _AFX_STATUS_BOX_H_ + +#include "afx/arcaneFX.h" + +#include "gui/controls/guiBitmapCtrl.h" + +class afxStatusBox : public GuiBitmapCtrl +{ +private: + typedef GuiBitmapCtrl Parent; + +public: + /*C*/ afxStatusBox(); + + virtual void onMouseDown(const GuiEvent &event); + virtual void onSleep(); + + DECLARE_CONOBJECT(afxStatusBox); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif //_AFX_STATUS_BOX_H_ diff --git a/Engine/source/afx/ui/afxStatusLabel.cpp b/Engine/source/afx/ui/afxStatusLabel.cpp new file mode 100644 index 000000000..bc3628f2e --- /dev/null +++ b/Engine/source/afx/ui/afxStatusLabel.cpp @@ -0,0 +1,49 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/ui/afxStatusLabel.h" + +IMPLEMENT_CONOBJECT(afxStatusLabel); + +ConsoleDocClass( afxStatusLabel, + "@brief A simple GUI control used for a player status label.\n\n" + + "@ingroup afxGUI\n" + "@ingroup AFX\n" +); + +afxStatusLabel::afxStatusLabel() +{ +} + +void afxStatusLabel::onMouseDown(const GuiEvent &event) +{ + GuiControl *parent = getParent(); + if (parent) + parent->onMouseDown(event); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ui/afxStatusLabel.h b/Engine/source/afx/ui/afxStatusLabel.h new file mode 100644 index 000000000..a81c92d86 --- /dev/null +++ b/Engine/source/afx/ui/afxStatusLabel.h @@ -0,0 +1,49 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_STATUS_LABEL_H_ +#define _AFX_STATUS_LABEL_H_ + +#include "afx/arcaneFX.h" + +#include "gui/controls/guiMLTextCtrl.h" + +class afxStatusLabel : public GuiMLTextCtrl +{ +private: + typedef GuiMLTextCtrl Parent; + +public: + /*C*/ afxStatusLabel(); + + virtual void onMouseDown(const GuiEvent &event); + + DECLARE_CONOBJECT(afxStatusLabel); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif //_AFX_STATUS_LABEL_H_ diff --git a/Engine/source/afx/ui/afxTSCtrl.cpp b/Engine/source/afx/ui/afxTSCtrl.cpp new file mode 100644 index 000000000..5766b43a4 --- /dev/null +++ b/Engine/source/afx/ui/afxTSCtrl.cpp @@ -0,0 +1,367 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Some of the object selection code in this file is based on functionality described +// in the following resource: +// +// Object Selection in Torque by Dave Myers +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7335 +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/engineAPI.h" +#include "gui/core/guiCanvas.h" +#include "T3D/gameBase/gameConnection.h" +#include "T3D/gameFunctions.h" + +#include "afx/ui/afxTSCtrl.h" +#include "afx/afxSpellBook.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CONOBJECT(afxTSCtrl); + +ConsoleDocClass( afxTSCtrl, + "@brief A customized variation of GameTSCtrl.\n\n" + + "@ingroup afxGUI\n" + "@ingroup AFX\n" +); + +afxTSCtrl::afxTSCtrl() +{ + mMouse3DVec.zero(); + mMouse3DPos.zero(); + mouse_dn_timestamp = 0; + spellbook = NULL; + + clearTargetingMode(); +} + +bool afxTSCtrl::processCameraQuery(CameraQuery *camq) +{ + GameUpdateCameraFov(); + return GameProcessCameraQuery(camq); +} + +void afxTSCtrl::renderWorld(const RectI &updateRect) +{ + GameRenderWorld(); +} + +void afxTSCtrl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent) +{ + Parent::getCursor(cursor, showCursor, lastGuiEvent); + + GameConnection* conn = GameConnection::getConnectionToServer(); + if (!conn || !conn->getRolloverObj()) + return; + + GuiCanvas *pRoot = getRoot(); + if( !pRoot ) + return; + + PlatformWindow* pWindow = pRoot->getPlatformWindow(); + AssertFatal(pWindow != NULL, "GuiControl without owning platform window! This should not be possible."); + PlatformCursorController* pController = pWindow->getCursorController(); + AssertFatal(pController != NULL, "PlatformWindow without an owned CursorController!"); + + if(pRoot->mCursorChanged != PlatformCursorController::curHand) + { + // We've already changed the cursor, so set it back before we change it again. + if(pRoot->mCursorChanged != -1) + pController->popCursor(); + + // Now change the cursor shape + pController->pushCursor(PlatformCursorController::curHand); + pRoot->mCursorChanged = PlatformCursorController::curHand; + } + else if(pRoot->mCursorChanged != -1) + { + // Restore the cursor we changed + pController->popCursor(); + pRoot->mCursorChanged = -1; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxTSCtrl::onMouseDown(const GuiEvent &evt) +{ + //Con::printf("#### afxTSCtrl::onLeftMouseDown() ####"); + + // save a timestamp so we can measure how long the button is down + mouse_dn_timestamp = Platform::getRealMilliseconds(); + + GuiCanvas* Canvas = getRoot(); + + // clear button down status because the ActionMap is going to capture + // the mouse and the button up will never happen + Canvas->clearMouseButtonDown(); + + // indicate that processing of event should continue (pass down to ActionMap) + Canvas->setConsumeLastInputEvent(false); +} + +void afxTSCtrl::onRightMouseDown(const GuiEvent& evt) +{ + //Con::printf("#### afxTSCtrl::onRightMouseDown() ####"); + + GuiCanvas* Canvas = getRoot(); + + // clear right button down status because the ActionMap is going to capture + // the mouse and the right button up will never happen + Canvas->clearMouseRightButtonDown(); + + // indicate that processing of event should continue (pass down to ActionMap) + Canvas->setConsumeLastInputEvent(false); +} + +void afxTSCtrl::onMouseMove(const GuiEvent& evt) +{ + AssertFatal(!targeting_mode.empty(), "Error, undefined targeting mode."); + + Targeting targeting = targeting_mode.last(); + if (targeting.mode == arcaneFX::TARGETING_OFF || targeting.check != arcaneFX::TARGET_CHECK_ON_MOUSE_MOVE) + return; + + performTargeting(evt.mousePoint, targeting.mode); +} + +void afxTSCtrl::onRender(Point2I offset, const RectI &updateRect) +{ + GameConnection* con = GameConnection::getConnectionToServer(); +#if defined(BROKEN_DAMAGEFLASH_WHITEOUT_BLACKOUT) + bool skipRender = (!con); +#else + bool skipRender = (!con || + (con->getWhiteOut() >= 1.f) || + (con->getDamageFlash() >= 1.f) || + (con->getBlackOut() >= 1.f)); +#endif + + if (!skipRender) + Parent::onRender(offset, updateRect); + + GFX->setViewport(updateRect); +} + +void afxTSCtrl::advanceTime(F32 dt) +{ + AssertFatal(!targeting_mode.empty(), "Error, undefined targeting mode."); + + Targeting targeting = targeting_mode.last(); + if (targeting.mode == arcaneFX::TARGETING_OFF || targeting.check != arcaneFX::TARGET_CHECK_POLL) + return; + + GuiCanvas* Canvas = getRoot(); + + Point2I cursor_pos; + if (Canvas && Canvas->getLastCursorPoint(cursor_pos)) + { + performTargeting(cursor_pos, targeting.mode); + } +}; + +void afxTSCtrl::performTargeting(const Point2I& mousePoint, U8 mode) +{ + GuiCanvas* Canvas = getRoot(); + + if (mode != arcaneFX::TARGETING_FREE && !Canvas->isCursorON()) + return; + + MatrixF cam_xfm; + Point3F dummy_pt; + if (GameGetCameraTransform(&cam_xfm, &dummy_pt)) + { + // get cam pos + Point3F cameraPoint; cam_xfm.getColumn(3,&cameraPoint); + + // construct 3D screen point from mouse coords + Point3F screen_pt((F32)mousePoint.x, (F32)mousePoint.y, 1.0f); + + // convert screen point to world point + bool bad_cam = mIsZero(mLastCameraQuery.farPlane); + Point3F world_pt; + if (!bad_cam && unproject(screen_pt, &world_pt)) + { + Point3F mouseVec = world_pt - cameraPoint; + mouseVec.normalizeSafe(); + + mMouse3DPos = cameraPoint; + mMouse3DVec = mouseVec; + + F32 selectRange = arcaneFX::sTargetSelectionRange; + Point3F mouseScaled = mouseVec*selectRange; + Point3F rangeEnd = cameraPoint + mouseScaled; + + if (mode == arcaneFX::TARGETING_STANDARD) + arcaneFX::rolloverRayCast(cameraPoint, rangeEnd, arcaneFX::sTargetSelectionMask); + else if (mode == arcaneFX::TARGETING_FREE) + arcaneFX::freeTargetingRayCast(cameraPoint, rangeEnd, arcaneFX::sFreeTargetSelectionMask); + } + } +} + +void afxTSCtrl::onMouseEnter(const GuiEvent& evt) +{ + //Con::printf("#### afxTSCtrl::onMouseEnter() ####"); +} + +void afxTSCtrl::onMouseDragged(const GuiEvent& evt) +{ + //Con::printf("#### afxTSCtrl::onMouseDragged() ####"); +} + + +void afxTSCtrl::onMouseLeave(const GuiEvent& evt) +{ + //Con::printf("#### afxTSCtrl::onMouseLeave() ####"); +} + +bool afxTSCtrl::onMouseWheelUp(const GuiEvent& evt) +{ + //Con::printf("#### afxTSCtrl::onMouseWheelUp() ####"); + Con::executef(this, "onMouseWheelUp"); + return true; +} + +bool afxTSCtrl::onMouseWheelDown(const GuiEvent& evt) +{ + //Con::printf("#### afxTSCtrl::onMouseWheelDown() ####"); + Con::executef(this, "onMouseWheelDown"); + return true; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxTSCtrl::setSpellBook(afxSpellBook* book) +{ + if (book != spellbook) + { + spellbook = book; + Con::executef(this, "onSpellbookChange", (spellbook) ? spellbook->getIdString() : ""); + } +} + +void afxTSCtrl::clearTargetingMode() +{ + targeting_mode.clear(); + pushTargetingMode(arcaneFX::TARGETING_OFF, arcaneFX::TARGET_CHECK_POLL); +} + +void afxTSCtrl::pushTargetingMode(U8 mode, U8 check) +{ + switch (mode) + { + case arcaneFX::TARGETING_OFF: + case arcaneFX::TARGETING_STANDARD: + case arcaneFX::TARGETING_FREE: + break; + default: + Con::errorf("afxTSCtrl::setTargetingMode() -- unknown targeting mode [%d].", mode); + return; + } + + switch (check) + { + case arcaneFX::TARGET_CHECK_POLL: + case arcaneFX::TARGET_CHECK_ON_MOUSE_MOVE: + break; + default: + Con::errorf("afxTSCtrl::setTargetingMode() -- unknown targeting check method [%d].", check); + return; + } + + Targeting targeting = { mode, check }; + targeting_mode.push_back(targeting); +} + +void afxTSCtrl::popTargetingMode() +{ + if (targeting_mode.size() <= 1) + return ; + + targeting_mode.pop_back(); +} + +U8 afxTSCtrl::getTargetingMode() +{ + return (targeting_mode.size() > 0) ? targeting_mode.last().mode : arcaneFX::TARGETING_OFF; +} + +U8 afxTSCtrl::getTargetingCheckMethod() +{ + return (targeting_mode.size() > 0) ? targeting_mode.last().check : arcaneFX::TARGET_CHECK_POLL; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +DefineEngineMethod(afxTSCtrl, setSpellBook, void, (afxSpellBook* spellbook),, + "Associate a spellbook with an afxTSCtrl.\n\n" + "@ingroup AFX") +{ + object->setSpellBook(spellbook); +} + +DefineEngineMethod(afxTSCtrl, pushTargetingMode, void, (unsigned int mode, unsigned int checkMethod), ((U32)arcaneFX::TARGETING_OFF, (U32)arcaneFX::TARGET_CHECK_POLL), + "Push a new targeting-mode onto a statck of modes.\n\n" + "@ingroup AFX") +{ + object->pushTargetingMode((U8)mode, (U8)checkMethod); +} + +DefineEngineMethod(afxTSCtrl, popTargetingMode, void, (),, + "Pop the targeting-mode off a statck of modes.\n\n" + "@ingroup AFX") +{ + object->popTargetingMode(); +} + +DefineEngineMethod(afxTSCtrl, getTargetingMode, S32, (),, + "Get the current targeting-mode.\n\n" + "@ingroup AFX") +{ + return object->getTargetingMode(); +} + +DefineEngineMethod(afxTSCtrl, getMouse3DVec, Point3F, (),, + "Get the 3D direction vector for the mouse cursor.\n\n" + "@ingroup AFX") +{ + return object->getMouse3DVec(); +} + +DefineEngineMethod(afxTSCtrl, getMouse3DPos, Point3F, (),, + "Get the 3D position of the mouse cursor.\n\n" + "@ingroup AFX") +{ + return object->getMouse3DPos(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/ui/afxTSCtrl.h b/Engine/source/afx/ui/afxTSCtrl.h new file mode 100644 index 000000000..b45322b70 --- /dev/null +++ b/Engine/source/afx/ui/afxTSCtrl.h @@ -0,0 +1,96 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_TS_CTRL_H_ +#define _AFX_TS_CTRL_H_ + +#include "app/game.h" +#include "gui/3d/guiTSControl.h" +#include "core/iTickable.h" + +class GameBase; +class afxSpellBook; + +//---------------------------------------------------------------------------- +class afxTSCtrl : public GuiTSCtrl, public virtual ITickable +{ +private: + struct Targeting + { + U8 mode; + U8 check; + }; + + typedef GuiTSCtrl Parent; + + Point3F mMouse3DVec; + Point3F mMouse3DPos; + + U32 mouse_dn_timestamp; + afxSpellBook* spellbook; + Vector targeting_mode; + +public: + /*C*/ afxTSCtrl(); + + virtual bool processCameraQuery(CameraQuery *query); + virtual void renderWorld(const RectI &updateRect); + virtual void onRender(Point2I offset, const RectI &updateRect); + + virtual void getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent); + + virtual void onMouseDown(const GuiEvent&); + virtual void onMouseMove(const GuiEvent&); + virtual void onMouseDragged(const GuiEvent&); + virtual void onMouseEnter(const GuiEvent&); + virtual void onMouseLeave(const GuiEvent&); + + virtual bool onMouseWheelUp(const GuiEvent&); + virtual bool onMouseWheelDown(const GuiEvent&); + + virtual void onRightMouseDown(const GuiEvent&); + + Point3F getMouse3DVec() {return mMouse3DVec;}; + Point3F getMouse3DPos() {return mMouse3DPos;}; + + void setSpellBook(afxSpellBook* book); + void clearTargetingMode(); + void pushTargetingMode(U8 mode, U8 check); + void popTargetingMode(); + U8 getTargetingMode(); + U8 getTargetingCheckMethod(); + void performTargeting(const Point2I& mousePoint, U8 mode); + + virtual void interpolateTick( F32 delta ) {}; + virtual void processTick() {}; + virtual void advanceTime( F32 timeDelta ); + + DECLARE_CONOBJECT(afxTSCtrl); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_TS_CTRL_H_ diff --git a/Engine/source/afx/util/afxAnimCurve.cpp b/Engine/source/afx/util/afxAnimCurve.cpp new file mode 100644 index 000000000..4074c15d7 --- /dev/null +++ b/Engine/source/afx/util/afxAnimCurve.cpp @@ -0,0 +1,280 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afx/util/afxAnimCurve.h" + +afxAnimCurve::afxAnimCurve() : usable( false ), final_value( 0.0f ), start_value( 0.0f ) +{ + evaluator = new afxHermiteEval(); +} + +afxAnimCurve::~afxAnimCurve() +{ + delete evaluator; +} + +void afxAnimCurve::addKey( Point2F &v ) +{ + Key k; + k.time = v.x; + k.value = v.y; + + keys.push_back( k ); + + usable = false; +} + +void afxAnimCurve::addKey( F32 time, F32 value ) +{ + Key k; + k.time = time; + k.value = value; + + keys.push_back( k ); + + usable = false; +} + +void afxAnimCurve::setKeyTime( int index, F32 t ) +{ + if( ( index < 0 ) || ( index >= keys.size() ) ) + return; + + Key &k = keys[index]; + k.time = t; + + usable = false; +} + +void afxAnimCurve::setKeyValue( int index, F32 v ) +{ + if( ( index < 0 ) || ( index >= keys.size() ) ) + return; + + Key &k = keys[index]; + k.value = v; + + if( index == 0 ) + start_value = v; + else if( index == keys.size()-1 ) + final_value = v; +} + +//bool afxAnimCurve::compare_Key( const afxAnimCurve::Key &a, const afxAnimCurve::Key &b ) +//{ +// return a.time < b.time; +//} + +S32 QSORT_CALLBACK afxAnimCurve::compare_Key( const void* a, const void* b ) +{ + const Key *key_a = (Key *)a; + const Key *key_b = (Key *)b; + + //Con::printf( "*** %f %f", key_a->time, key_b->time ); + + //return key_a->time < key_b->time; + + + if (key_a->time > key_b->time) + return 1; + else if (key_a->time < key_b->time) + return -1; + else + return 0; +} + +void afxAnimCurve::sort( ) +{ + if( keys.size() == 0 ) + return; + + //std::sort( keys.begin(), keys.end(), afxAnimCurve::compare_Key ); + dQsort( keys.address(), keys.size(), sizeof(Key), afxAnimCurve::compare_Key ); + + start_value = keys[0].value; + final_value = keys[keys.size()-1].value; + + start_time = keys[0].time; + final_time = keys[keys.size()-1].time; + + usable = true; +} + +int afxAnimCurve::numKeys() +{ + return keys.size(); +} + +F32 afxAnimCurve::getKeyTime( int index ) +{ + if( ( index < 0 ) || ( index >= keys.size() ) ) + return 0.0f; + + Key &k = keys[index]; + return k.time; +} + +F32 afxAnimCurve::getKeyValue( int index ) +{ + if( ( index < 0 ) || ( index >= keys.size() ) ) + return 0.0f; + + Key &k = keys[index]; + return k.value; +} + +Point2F afxAnimCurve::getSegment( F32 time ) +{ + Point2F segment( 0, 0 ); + + if( keys.size() == 0 ) + return segment; + + int start_index = 0; + for( ; start_index < keys.size()-1; start_index++ ) + { + if( time < keys[start_index+1].time ) + break; + } + int end_index = start_index+1; + + segment.x = (F32)start_index; + segment.y = (F32)end_index; + + return segment; +} + +F32 afxAnimCurve::evaluate( F32 time ) +{ + if( !usable ) + return 0.0f; + + if( time <= start_time ) + return start_value; + + if( time >= final_time ) + return final_value; + + if( keys.size() == 1 ) + return start_value; + + int start_index = 0; + for( ; start_index < keys.size()-1; start_index++ ) + { + if( time < keys[start_index+1].time ) + break; + } + int end_index = start_index+1; + + Key k0 = keys[start_index]; + Key k1 = keys[end_index]; + + Point2F v0( (F32) k0.time, k0.value ); + Point2F v1( (F32) k1.time, k1.value ); + + // Compute tangents + Point2F tan0 = computeTangentK0( v0, v1, start_index ); + Point2F tan1 = computeTangentK1( v0, v1, end_index ); + + F32 time_perc = (F32)( time - k0.time ) / (F32)( k1.time - k0.time ); + + Point2F vnew = evaluator->evaluateCurve( v0, + v1, + tan0, + tan1, + time_perc ); + + return vnew.y; +} + +Point2F afxAnimCurve::computeTangentK0( Point2F &k0, Point2F &k1, int start_index ) +{ + Point2F tan0; + + Point2F k_prev; + Point2F k_next; + + // tangent for k0 + if( start_index == 0 ) + { + k_prev = k0; // Setting previous point to k0, creating a hidden point in + // the same spot + k_next = k1; + } + else + { + Key &k = keys[start_index-1]; + k_prev.set( k.time, k.value ); + k_next = k1; + } + tan0 = k_next-k_prev; //k_next.subtract( k_prev ); + tan0 *= .5f; + + return tan0; +} + +Point2F afxAnimCurve::computeTangentK1( Point2F &k0, Point2F &k1, int end_index ) +{ + Point2F tan1; + + Point2F k_prev; + Point2F k_next; + + // tangent for k1 + if( end_index == keys.size()-1 ) + { + k_prev = k0; + k_next = k1; // Setting next point to k1, creating a hidden point in + // the same spot + } + else + { + k_prev = k0; + Key &k = keys[end_index+1]; + k_next.set( k.time, k.value ); + } + tan1 = k_next-k_prev; //k_next.subtract( k_prev ); + tan1 *= .5f; + + return tan1; +} + +void afxAnimCurve::print() +{ + Con::printf( "afxAnimCurve -------------------------" ); + for( int i = 0; i < keys.size(); i++ ) + { + Key &k = keys[i]; + Con::printf( "%f: %f", k.time, k.value ); + } + Con::printf( "-----------------------------------" ); +} + +void afxAnimCurve::printKey( int index ) +{ + Key &k = keys[index]; + Con::printf( "%f: %f", k.time, k.value ); +} \ No newline at end of file diff --git a/Engine/source/afx/util/afxAnimCurve.h b/Engine/source/afx/util/afxAnimCurve.h new file mode 100644 index 000000000..158203b44 --- /dev/null +++ b/Engine/source/afx/util/afxAnimCurve.h @@ -0,0 +1,82 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_ANIM_CURVE_H_ +#define _AFX_ANIM_CURVE_H_ + +#include "core/util/tVector.h" + +#include "afx/util/afxCurveEval.h" + +class afxAnimCurve +{ + class Key + { + public: + F32 time; + F32 value; + }; + + private: + afxCurveEval* evaluator; + + F32 final_value; + F32 start_value; + F32 final_time; + F32 start_time; + bool usable; + + //std::vector keys; + Vector keys; + + //static bool compare_Key( const Key &a, const Key &b ); + static S32 QSORT_CALLBACK compare_Key( const void* a, const void* b ); + + public: + afxAnimCurve(); + ~afxAnimCurve(); + + void addKey( Point2F &v ); + void addKey( F32 time, F32 value ); + void setKeyTime( int index, F32 t ); + void setKeyValue( int index, F32 v ); + void sort( ); + int numKeys(); + F32 getKeyTime( int index ); + F32 getKeyValue( int index ); + Point2F getSegment( F32 time ); + F32 evaluate( F32 time ); + + void print(); + void printKey( int index ); + + private: + Point2F computeTangentK0( Point2F &k0, Point2F &k1, int start_index ); + Point2F computeTangentK1( Point2F &k0, Point2F &k1, int end_index ); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_ANIM_CURVE_H_ \ No newline at end of file diff --git a/Engine/source/afx/util/afxCurve3D.cpp b/Engine/source/afx/util/afxCurve3D.cpp new file mode 100644 index 000000000..860cb4c4a --- /dev/null +++ b/Engine/source/afx/util/afxCurve3D.cpp @@ -0,0 +1,332 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afx/util/afxCurveEval.h" +#include "afx/util/afxCurve3D.h" + +afxCurve3D::afxCurve3D() : usable( false ), default_vector( 0, 0, 0 ) +{ + evaluator = new afxHermiteEval(); +} + +afxCurve3D::~afxCurve3D() +{ + delete evaluator; +} + +void afxCurve3D::addPoint( F32 param, Point3F &v ) +{ + if( param < 0.0f || param > 1.0f ) + return; + + CurvePoint p; + p.parameter = param; + p.point.set( v ); + + points.push_back( p ); + + usable = false; +} + +void afxCurve3D::setPoint( int index, Point3F &v ) +{ + if( ( index < 0 ) || ( index >= points.size() ) ) + return; + + CurvePoint &p = points[index]; + p.point = v; + + if( index == 0 ) + start_value = v; + else if( index == points.size()-1 ) + final_value = v; +} + +//bool afxCurve3D::compare_CurvePoint( const afxCurve3D::CurvePoint &a, const afxCurve3D::CurvePoint &b ) +//{ +// return a.parameter < b.parameter; +//} + +S32 QSORT_CALLBACK afxCurve3D::compare_CurvePoint( const void* a, const void* b ) +{ + //CurvePoint *cp_a = *((CurvePoint **)a); + //CurvePoint *cp_b = *((CurvePoint **)b); + + const CurvePoint *cp_a = (CurvePoint *)a; + const CurvePoint *cp_b = (CurvePoint *)b; + + //Con::printf( "*** %f %f", cp_a->parameter, cp_b->parameter ); + + //return cp_a->parameter < cp_b->parameter; + //return 1; + + if (cp_a->parameter > cp_b->parameter) + return 1; + else if (cp_a->parameter < cp_b->parameter) + return -1; + else + return 0; +} + +void afxCurve3D::sort( ) +{ + if( points.size() == 0 ) + return; + + if( points.size() == 1 ) + { + start_value = points[0].point; + final_value = start_value; + usable = true; + return; + } + + //Con::printf( "*** pre-sort" ); + //std::sort( points.begin(), points.end(), afxCurve3D::compare_CurvePoint ); + dQsort( points.address(), points.size(), sizeof(CurvePoint), afxCurve3D::compare_CurvePoint ); + //Con::printf( "*** post-sort" ); + + start_value = points[0].point; + final_value = points[points.size()-1].point; + + usable = true; + + start_tangent = evaluateTangent( 0.0f ); + final_tangent = evaluateTangent( 1.0f ); +} + +int afxCurve3D::numPoints() +{ + return points.size(); +} + +F32 afxCurve3D::getParameter( int index ) +{ + if( ( index < 0 ) || ( index >= points.size() ) ) + return 0.0f; + + return points[index].parameter; +} + +Point3F afxCurve3D::getPoint( int index ) +{ + if( ( index < 0 ) || ( index >= points.size() ) ) + return default_vector; + + return points[index].point; +} + +Point3F afxCurve3D::evaluate( F32 param ) +{ + if( !usable ) + return default_vector; + + if( param <= 0.0f ) + return start_value; + + if( param >= 1.0f ) + return final_value; + + if( points.size() == 1 ) + return start_value; + + int start_index = 0; + for( ; start_index < points.size()-1; start_index++ ) + { + if( param < points[start_index+1].parameter ) + break; + } + int end_index = start_index+1; + + CurvePoint p0 = points[start_index]; + CurvePoint p1 = points[end_index]; + + // Compute tangents + //Point3F tan0 = computeTangentP0( p0.point, p1.point, start_index ); + //Point3F tan1 = computeTangentP1( p0.point, p1.point, end_index ); + + + F32 local_param = ( param - p0.parameter ) / ( p1.parameter - p0.parameter ); + + //Point3F vnew = evaluator->evaluateCurve( p0.point, + // p1.point, + // tan0, + // tan1, + // local_param ); + + Point3F vnew = evaluator->evaluateCurve( p0.point, p1.point, + p0.tangent, p1.tangent, + local_param ); + return vnew; +} + +Point3F afxCurve3D::evaluateTangent( F32 param ) +{ + if( !usable ) + return default_vector; + + if( param < 0.0f ) + return start_tangent; + + if( param > 1.0f ) + return final_tangent; + + if( points.size() == 1 ) + return start_tangent; + + int start_index = 0; + for( ; start_index < points.size()-1; start_index++ ) + { + if( param < points[start_index+1].parameter ) + break; + } + int end_index = start_index+1; + + if( param == 1.0f ) + { + end_index = points.size()-1; + start_index = end_index - 1; + } + + CurvePoint p0 = points[start_index]; + CurvePoint p1 = points[end_index]; + + // Compute tangents + //Point3F tan0 = computeTangentP0( p0.point, p1.point, start_index ); + //Point3F tan1 = computeTangentP1( p0.point, p1.point, end_index ); + + F32 local_param = ( param - p0.parameter ) / ( p1.parameter - p0.parameter ); + + //Point3F vnew = evaluator->evaluateCurveTangent( p0.point, + // p1.point, + // tan0, + // tan1, + // local_param ); + Point3F vnew = evaluator->evaluateCurveTangent( p0.point, p1.point, + p0.tangent, p1.tangent, + local_param ); + + return vnew; +} + +Point3F afxCurve3D::computeTangentP0( Point3F &p0, Point3F &p1, int start_index ) +{ + Point3F tan0; + + Point3F p_prev; + Point3F p_next; + + // tangent for p0 + if( start_index == 0 ) + { + p_prev = p0; // Setting previous point to p0, creating a hidden point in + // the same spot + p_next = p1; + } + else + { + CurvePoint &p = points[start_index-1]; + p_prev = p.point; + p_next = p1; + } + tan0 = p_next-p_prev; //p_next.subtract( p_prev ); + tan0 *= .5f; //= tan0.scale( .5f ); + + return tan0; +} + +Point3F afxCurve3D::computeTangentP1( Point3F &p0, Point3F &p1, int end_index ) +{ + Point3F tan1; + + Point3F p_prev; + Point3F p_next; + + // tangent for p1 + if( end_index == points.size()-1 ) + { + p_prev = p0; + p_next = p1; // Setting next point to p1, creating a hidden point in + // the same spot + } + else + { + p_prev = p0; + CurvePoint &p = points[end_index+1]; + p_next = p.point; + } + tan1 = p_next-p_prev; //p_next.subtract( p_prev ); + tan1 *= .5f; //= tan1.scale( .5f ); + + //Con::printf("UPDATE"); + return tan1; +} + +void afxCurve3D::computeTangents() +{ + CurvePoint *p_prev; + CurvePoint *p_next; + + for( int i = 0; i < points.size(); i++ ) + { + CurvePoint *p = &points[i]; + + if( i == 0 ) + { + p_prev = p; // Setting previous point to p0, creating a hidden point in + // the same spot + p_next = &points[i+1]; + } + else if( i == points.size()-1 ) + { + p_prev = &points[i-1]; + p_next = p; // Setting next point to p1, creating a hidden point in + // the same spot + } + else + { + p_prev = &points[i-1]; + p_next = &points[i+1]; + } + + p->tangent = p_next->point - p_prev->point; + //(p->tangent).normalize(); + p->tangent *= .5f; + + //Con::printf( "%d: %f %f %f", i, p->tangent.x, p->tangent.y, p->tangent.z ); + } +} + +void afxCurve3D::print() +{ + Con::printf( "afxCurve3D -------------------------" ); + for( int i = 0; i < points.size(); i++ ) + { + CurvePoint &p = points[i]; + Con::printf( "%f: %f %f %f", p.parameter, p.point.x, p.point.y, p.point.z ); + } + Con::printf( "---------------------------------" ); +} \ No newline at end of file diff --git a/Engine/source/afx/util/afxCurve3D.h b/Engine/source/afx/util/afxCurve3D.h new file mode 100644 index 000000000..5ddfdfecf --- /dev/null +++ b/Engine/source/afx/util/afxCurve3D.h @@ -0,0 +1,92 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CURVE_3D_H_ +#define _AFX_CURVE_3D_H_ + +#include "core/util/tVector.h" +#include "math/mPoint3.h" + +class afxCurveEval; + +class afxCurve3D +{ + class CurvePoint + { + public: + F32 parameter; + Point3F point; + + // new: + Point3F tangent; + }; + + private: + afxCurveEval* evaluator; + Point3F start_value; + Point3F final_value; + Point3F start_tangent; + Point3F final_tangent; + bool usable; + + //std::vector points; + Vector points; + + Point3F default_vector; + + //static bool compare_CurvePoint( const CurvePoint &a, const CurvePoint &b ); + static S32 QSORT_CALLBACK compare_CurvePoint( const void* a, const void* b ); + + // new + Point3F last_tangent; + bool flip; + + public: + afxCurve3D(); + ~afxCurve3D(); + + void addPoint( F32 param, Point3F &v ); + void setPoint( int index, Point3F &v ); + void sort( ); + int numPoints(); + F32 getParameter( int index ); + Point3F getPoint( int index ); + Point3F evaluate( F32 param ); + Point3F evaluateTangent( F32 param ); + + void print(); + + void computeTangents(); + + //MatrixF createOrientFromDir( Point3F &direction ); + + private: + Point3F computeTangentP0( Point3F &p0, Point3F &p1, int start_index ); + Point3F computeTangentP1( Point3F &p0, Point3F &p1, int end_index ); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_CURVE_3D_H_ \ No newline at end of file diff --git a/Engine/source/afx/util/afxCurveEval.cpp b/Engine/source/afx/util/afxCurveEval.cpp new file mode 100644 index 000000000..d45b646f9 --- /dev/null +++ b/Engine/source/afx/util/afxCurveEval.cpp @@ -0,0 +1,122 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afx/util/afxCurveEval.h" + +Point2F afxHermiteEval::evaluateCurve( Point2F &v0, Point2F &v1, + Point2F &t0, Point2F &t1, F32 t ) +{ + F32 t_3 = t*t*t; + F32 t_2 = t*t; + F32 h1 = ( 2.0f * t_3 ) - ( 3.0f * t_2 ) + 1; + F32 h2 = (-2.0f * t_3 ) + ( 3.0f * t_2 ); + F32 h3 = t_3 - ( 2.0f * t_2 ) + t; + F32 h4 = t_3 - t_2; + + Point2F v( + (h1*v0.x)+(h2*v1.x)+(h3*t0.x)+(h4*t1.x), + (h1*v0.y)+(h2*v1.y)+(h3*t0.y)+(h4*t1.y) ); + + return v; +} + +Point2F afxHermiteEval::evaluateCurve( Point2F &v0, Point2F &v1, F32 t ) +{ + Point2F tangent( 1, 0 ); + return( evaluateCurve( v0, v1, tangent, tangent, t ) ); +} + +Point2F afxHermiteEval::evaluateCurveTangent( Point2F &v0, Point2F &v1, + Point2F &t0, Point2F &t1, F32 t ) +{ + F32 t_2 = t*t; + F32 h1_der = ( 6.0f * t_2 ) - ( 6.0f * t ); + F32 h2_der = (-6.0f * t_2 ) + ( 6.0f * t ); + F32 h3_der = ( 3.0f * t_2 ) - ( 4.0f * t ) + 1; + F32 h4_der = ( 3.0f * t_2 ) - ( 2.0f * t ); + + Point2F tangent( + (h1_der*v0.x)+(h2_der*v1.x)+(h3_der*t0.x)+(h4_der*t1.x), + (h1_der*v0.y)+(h2_der*v1.y)+(h3_der*t0.y)+(h4_der*t1.y) ); + + return tangent; +} + +Point2F afxHermiteEval::evaluateCurveTangent( Point2F &v0, Point2F &v1, F32 t ) +{ + Point2F tangent( 1, 0 ); + return( evaluateCurveTangent( v0, v1, tangent, tangent, t ) ); +} + +Point3F afxHermiteEval::evaluateCurve( Point3F &v0, Point3F &v1, + Point3F &t0, Point3F &t1, F32 t ) +{ + F32 t_3 = t*t*t; + F32 t_2 = t*t; + F32 h1 = ( 2.0f * t_3 ) - ( 3.0f * t_2 ) + 1; + F32 h2 = (-2.0f * t_3 ) + ( 3.0f * t_2 ); + F32 h3 = t_3 - ( 2.0f * t_2 ) + t; + F32 h4 = t_3 - t_2; + + Point3F v( + (h1*v0.x)+(h2*v1.x)+(h3*t0.x)+(h4*t1.x), + (h1*v0.y)+(h2*v1.y)+(h3*t0.y)+(h4*t1.y), + (h1*v0.z)+(h2*v1.z)+(h3*t0.z)+(h4*t1.z) ); + + return v; +} + +Point3F afxHermiteEval::evaluateCurve( Point3F &v0, Point3F &v1, F32 t ) +{ + Point3F tangent( 1, 0, 0 ); + return( evaluateCurve( v0, v1, tangent, tangent, t ) ); +} + +Point3F afxHermiteEval::evaluateCurveTangent( Point3F &v0, Point3F &v1, + Point3F &t0, Point3F &t1, F32 t ) +{ + F32 t_2 = t*t; + F32 h1_der = ( 6.0f * t_2 ) - ( 6.0f * t ); + F32 h2_der = (-6.0f * t_2 ) + ( 6.0f * t ); + F32 h3_der = ( 3.0f * t_2 ) - ( 4.0f * t ) + 1; + F32 h4_der = ( 3.0f * t_2 ) - ( 2.0f * t ); + + Point3F tangent( + (h1_der*v0.x)+(h2_der*v1.x)+(h3_der*t0.x)+(h4_der*t1.x), + (h1_der*v0.y)+(h2_der*v1.y)+(h3_der*t0.y)+(h4_der*t1.y), + (h1_der*v0.z)+(h2_der*v1.z)+(h3_der*t0.z)+(h4_der*t1.z) ); + + return tangent; +} + +Point3F afxHermiteEval::evaluateCurveTangent( Point3F &v0, Point3F &v1, F32 t ) +{ + Point3F tangent( 1, 0, 0 ); + return( evaluateCurveTangent( v0, v1, tangent, tangent, t ) ); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/util/afxCurveEval.h b/Engine/source/afx/util/afxCurveEval.h new file mode 100644 index 000000000..0a8765c19 --- /dev/null +++ b/Engine/source/afx/util/afxCurveEval.h @@ -0,0 +1,62 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_CURVE_EVAL_BASE_H_ +#define _AFX_CURVE_EVAL_BASE_H_ + +#include "math/mPoint2.h" +#include "math/mPoint3.h" + +class afxCurveEval +{ +public: + virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, F32 t)=0; + virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t)=0; + virtual Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, F32 t)=0; + virtual Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t)=0; + + virtual Point3F evaluateCurve(Point3F& v0, Point3F& v1, F32 t)=0; + virtual Point3F evaluateCurve(Point3F& v0, Point3F& v1, Point3F& t0, Point3F& t1, F32 t)=0; + virtual Point3F evaluateCurveTangent(Point3F& v0, Point3F& v1, F32 t)=0; + virtual Point3F evaluateCurveTangent(Point3F& v0, Point3F& v1, Point3F& t0, Point3F& t1, F32 t)=0; +}; + +class afxHermiteEval : public afxCurveEval +{ +public: + Point2F evaluateCurve(Point2F& v0, Point2F& v1, F32 t); + Point2F evaluateCurve(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t); + Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, F32 t); + Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t); + + Point3F evaluateCurve(Point3F& v0, Point3F& v1, F32 t); + Point3F evaluateCurve(Point3F& v0, Point3F& v1, Point3F& t0, Point3F& t1, F32 t); + Point3F evaluateCurveTangent(Point3F& v0, Point3F& v1, F32 t); + Point3F evaluateCurveTangent(Point3F& v0, Point3F& v1, Point3F& t0, Point3F& t1, F32 t); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_CURVE_EVAL_BASE_H_ diff --git a/Engine/source/afx/util/afxEase.cpp b/Engine/source/afx/util/afxEase.cpp new file mode 100644 index 000000000..7c7e1341e --- /dev/null +++ b/Engine/source/afx/util/afxEase.cpp @@ -0,0 +1,98 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afxEase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +F32 +afxEase::t(F32 t, F32 ein, F32 eout) +{ + if (t == 0.0) + return 0.0; + + if (t == 1.0) + return 1.0; + + F32 ee = eout - ein + 1.0; + + // ease in section + if (t <= ein) + { + F32 tin = t/ein; + return (mSin(M_PI_F*(tin - 1.0)) + M_PI_F*tin)*ein*(1.0/M_PI_F)/ee; + } + + // middle linear section + else if (t <= eout) + { + return (2.0*t - ein)/ee; + } + + // ease out section + else + { + F32 iout = 1.0 - eout; + F32 g = (t - eout)*M_PI_F/iout; + return ((mSin(g) + g)*(iout)/M_PI_F + 2.0*eout - ein)*1.0/ee + 0.0; + } +} + +F32 +afxEase::eq(F32 t, F32 a, F32 b, F32 ein, F32 eout) +{ + if (t == 0.0) + return a; + + if (t == 1.0) + return b; + + F32 ab = b - a; + F32 ee = eout - ein + 1.0; + + // ease in section + if (t <= ein) + { + F32 tin = t/ein; + return a + (mSin(M_PI_F*(tin - 1.0)) + M_PI_F*tin)*ab*ein*(1.0/M_PI_F)/ee; + } + + // middle linear section + else if (t <= eout) + { + return a + ab*(2.0*t - ein)/ee; + } + + // ease out section + else + { + F32 iout = 1.0 - eout; + F32 g = (t - eout)*M_PI_F/iout; + return ((mSin(g) + g)*(iout)/M_PI_F + 2.0*eout - ein)*ab/ee + a; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxEase.h b/Engine/source/afx/util/afxEase.h new file mode 100644 index 000000000..80b6d95af --- /dev/null +++ b/Engine/source/afx/util/afxEase.h @@ -0,0 +1,41 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_EASE_H_ +#define _AFX_EASE_H_ + +#include "platform/platform.h" + +class afxEase +{ +public: + static F32 t(F32 t, F32 ein, F32 eout); + static F32 eq(F32 t, F32 a, F32 b, F32 ein, F32 eout); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_EASE_H_ + diff --git a/Engine/source/afx/util/afxParticlePool.cpp b/Engine/source/afx/util/afxParticlePool.cpp new file mode 100644 index 000000000..37647f294 --- /dev/null +++ b/Engine/source/afx/util/afxParticlePool.cpp @@ -0,0 +1,233 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "T3D/fx/particleEmitter.h" + +#include "afx/afxChoreographer.h" +#include "afx/util/afxParticlePool.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxParticlePoolData); + +ConsoleDocClass( afxParticlePoolData, + "@brief A ParticlePool datablock.\n\n" + + "@ingroup afxUtil\n" + "@ingroup AFX\n" +); + +Vector afxParticlePool::orderedVector; + +afxParticlePoolData::afxParticlePoolData() +{ + pool_type = POOL_NORMAL; + base_color.set(0.0f, 0.0f, 0.0f, 1.0f); + blend_weight = 1.0f; +} + +afxParticlePoolData::afxParticlePoolData(const afxParticlePoolData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + pool_type = other.pool_type; + base_color = other.base_color; + blend_weight = other.blend_weight; +} + +ImplementEnumType( afxParticlePool_PoolType, "Possible particle pool types.\n" "@ingroup afxParticlePool\n\n" ) + { afxParticlePoolData::POOL_NORMAL, "normal", "..." }, + { afxParticlePoolData::POOL_TWOPASS, "two-pass", "..." }, +EndImplementEnumType; + +afxParticlePoolData::~afxParticlePoolData() +{ +} + +void afxParticlePoolData::initPersistFields() +{ + addField("poolType", TYPEID< afxParticlePoolData::PoolType >(), Offset(pool_type, afxParticlePoolData), + "..."); + addField("baseColor", TypeColorF, Offset(base_color, afxParticlePoolData), + "..."); + addField("blendWeight", TypeF32, Offset(blend_weight, afxParticlePoolData), + "..."); + + Parent::initPersistFields(); +}; + +void afxParticlePoolData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(pool_type); + stream->write(base_color); + stream->write(blend_weight); +}; + +void afxParticlePoolData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&pool_type); + stream->read(&base_color); + stream->read(&blend_weight); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_NETOBJECT_V1(afxParticlePool); + +ConsoleDocClass( afxParticlePool, + "@brief A ParticlePool object as defined by an afxParticlePoolData datablock.\n\n" + + "@ingroup afxUtil\n" + "@ingroup AFX\n" +); + +afxParticlePool::afxParticlePool() +{ + mDataBlock = 0; + key_block = 0; + key_index = 0; + choreographer = 0; + sort_priority = S8_MAX; + + mNetFlags.set(IsGhost); + mTypeMask |= StaticObjectType; + + mCurBuffSize = mCurBuffSize2 = 0; +}; + +afxParticlePool::~afxParticlePool() +{ + for (S32 i = 0; i < emitters.size(); i++) + if (emitters[i]) + emitters[i]->clearPool(); + + if (choreographer) + choreographer->unregisterParticlePool(this); + + if (mDataBlock && mDataBlock->isTempClone()) + { + delete mDataBlock; + mDataBlock = 0; + } +} + +bool afxParticlePool::onNewDataBlock(GameBaseData* dptr, bool reload) +{ + mDataBlock = dynamic_cast(dptr); + if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) + return false; + + return true; +} + +bool afxParticlePool::onAdd() +{ + if (!Parent::onAdd()) + return false; + + mObjBox.minExtents.set(-0.5, -0.5, -0.5); + mObjBox.maxExtents.set( 0.5, 0.5, 0.5); + + resetWorldBox(); + + addToScene(); + + return true; +}; + +void afxParticlePool::onRemove() +{ + removeFromScene(); + + Parent::onRemove(); +}; + +void afxParticlePool::addParticleEmitter(ParticleEmitter* emitter) +{ + emitters.push_back(emitter); +} + +void afxParticlePool::removeParticleEmitter(ParticleEmitter* emitter) +{ + for (U32 i=0; i < emitters.size(); i++) + if (emitters[i] == emitter) + { + emitters.erase(i); + break; + } + + if (emitters.empty()) + { + if (choreographer) + { + choreographer->unregisterParticlePool(this); + choreographer = 0; + } + Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + 500); + } +} + +void afxParticlePool::updatePoolBBox(ParticleEmitter* emitter) +{ + if (emitter->mObjBox.minExtents.x < mObjBox.minExtents.x) + mObjBox.minExtents.x = emitter->mObjBox.minExtents.x; + if (emitter->mObjBox.minExtents.y < mObjBox.minExtents.y) + mObjBox.minExtents.y = emitter->mObjBox.minExtents.y; + if (emitter->mObjBox.minExtents.z < mObjBox.minExtents.z) + mObjBox.minExtents.z = emitter->mObjBox.minExtents.z; + if (emitter->mObjBox.maxExtents.x > mObjBox.maxExtents.x) + mObjBox.maxExtents.x = emitter->mObjBox.maxExtents.x; + if (emitter->mObjBox.maxExtents.y > mObjBox.maxExtents.y) + mObjBox.maxExtents.y = emitter->mObjBox.maxExtents.y; + if (emitter->mObjBox.maxExtents.z > mObjBox.maxExtents.z) + mObjBox.maxExtents.z = emitter->mObjBox.maxExtents.z; + + resetWorldBox(); +} + +void afxParticlePool::setSortPriority(S8 priority) +{ + if (priority < sort_priority) + sort_priority = (priority == 0) ? 1 : priority; +} + +int QSORT_CALLBACK afxParticlePool::cmpSortParticlePool(const void* p1, const void* p2) +{ + const SortParticlePool* sp1 = (const SortParticlePool*)p1; + const SortParticlePool* sp2 = (const SortParticlePool*)p2; + if (sp2->k > sp1->k) + return 1; + else if (sp2->k == sp1->k) + return 0; + else + return -1; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/util/afxParticlePool.h b/Engine/source/afx/util/afxParticlePool.h new file mode 100644 index 000000000..d09b0dcd7 --- /dev/null +++ b/Engine/source/afx/util/afxParticlePool.h @@ -0,0 +1,143 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PARTICLE_POOL_H_ +#define _AFX_PARTICLE_POOL_H_ + +class afxParticlePoolData : public GameBaseData +{ +private: + typedef GameBaseData Parent; + +public: + enum PoolType + { + POOL_NORMAL, + POOL_TWOPASS + }; + + U32 pool_type; + LinearColorF base_color; + F32 blend_weight; + +public: + /*C*/ afxParticlePoolData(); + /*C*/ afxParticlePoolData(const afxParticlePoolData&, bool = false); + /*D*/ ~afxParticlePoolData(); + + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxParticlePoolData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxParticlePoolData::PoolType afxParticlePool_PoolType; +DefineEnumType( afxParticlePool_PoolType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +struct Particle; +class ParticleEmitter; +class afxChoreographer; + +typedef Vector ParticleEmitterList; + +class afxParticlePool : public GameBase +{ + typedef GameBase Parent; + + class ObjectDeleteEvent : public SimEvent + { + public: + void process(SimObject *obj) { if (obj) obj->deleteObject(); } + }; + + struct SortParticlePool + { + Particle* p; + F32 k; // interpreted differently depending on rendering method + ParticleEmitter* emitter; + }; + +private: + afxParticlePoolData* mDataBlock; + afxParticlePoolData* key_block; + U32 key_index; + ParticleEmitterList emitters; + afxChoreographer* choreographer; + S8 sort_priority; + + static Vector orderedVector; + static int QSORT_CALLBACK cmpSortParticlePool(const void* p1, const void* p2); + + S32 mCurBuffSize; + GFXVertexBufferHandle mVertBuff; + S32 mCurBuffSize2; + GFXVertexBufferHandle mVertBuff2; + +protected: + virtual void prepRenderImage(SceneRenderState*); + + void pool_prepBatchRender(RenderPassManager*, const Point3F &camPos, const LinearColorF &ambientColor); + void pool_renderObject_Normal(RenderPassManager*, const Point3F &camPos, const LinearColorF &ambientColor); + void pool_renderObject_TwoPass(RenderPassManager*, const Point3F &camPos, const LinearColorF &ambientColor); + + virtual bool onAdd(); + virtual void onRemove(); + + void renderBillboardParticle_blend(Particle&, const Point3F* basePnts, const MatrixF& camView, const F32 spinFactor, + const F32 blend_factor, ParticleEmitter*); + void renderBillboardParticle_color(Particle&, const Point3F* basePnts, const MatrixF& camView, const F32 spinFactor, + const LinearColorF& color, ParticleEmitter*); + +public: + /*C*/ afxParticlePool(); + /*D*/ ~afxParticlePool(); + + virtual bool onNewDataBlock(GameBaseData* dptr, bool reload); + + void addParticleEmitter(ParticleEmitter*); + void removeParticleEmitter(ParticleEmitter*); + + void setChoreographer(afxChoreographer* ch) { choreographer = ch; } + void setKeyBlock(afxParticlePoolData* db, U32 idx) { key_block = db; key_index = idx; } + bool hasMatchingKeyBlock(const afxParticlePoolData* db, U32 idx) const { return (db == key_block && idx == key_index); } + + void updatePoolBBox(ParticleEmitter*); + + void setSortPriority(S8 priority); + + DECLARE_CONOBJECT(afxParticlePool); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PARTICLE_POOL_H_ diff --git a/Engine/source/afx/util/afxParticlePool_T3D.cpp b/Engine/source/afx/util/afxParticlePool_T3D.cpp new file mode 100644 index 000000000..6689326cd --- /dev/null +++ b/Engine/source/afx/util/afxParticlePool_T3D.cpp @@ -0,0 +1,491 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "scene/sceneRenderState.h" +#include "T3D/fx/particleEmitter.h" +#include "renderInstance/renderPassManager.h" +#include "lighting/lightinfo.h" +#include "lighting/lightManager.h" + +#include "afx/util/afxParticlePool.h" + +void afxParticlePool::prepRenderImage(SceneRenderState* state) +{ + const LightInfo *sunlight = LIGHTMGR->getSpecialLight( LightManager::slSunLightType ); + pool_prepBatchRender(state->getRenderPass(), state->getCameraPosition(), sunlight->getAmbient()); +}; + +void afxParticlePool::pool_prepBatchRender(RenderPassManager *renderManager, const Point3F &camPos, const LinearColorF &ambientColor) +{ + if (emitters.empty()) + return; + + switch (mDataBlock->pool_type) + { + case afxParticlePoolData::POOL_TWOPASS : + pool_renderObject_TwoPass(renderManager, camPos, ambientColor); + break; + case afxParticlePoolData::POOL_NORMAL : + default: + pool_renderObject_Normal(renderManager, camPos, ambientColor); + } +} + +void afxParticlePool::pool_renderObject_Normal(RenderPassManager *renderManager, const Point3F &camPos, const LinearColorF &ambientColor) +{ + S32 n_parts = 0; + for (S32 i = 0; i < emitters.size(); i++) + n_parts += emitters[i]->n_parts; + + if (n_parts == 0) + return; + + ParticleEmitterData* main_emitter_data = emitters[0]->mDataBlock; + + main_emitter_data->allocPrimBuffer(n_parts); + + orderedVector.clear(); + + MatrixF modelview = GFX->getWorldMatrix(); + Point3F viewvec; modelview.getRow(1, &viewvec); + + for (U32 i=0; i < emitters.size(); i++) + { + // add each particle and a distance based sort key to orderedVector + for (Particle* pp = emitters[i]->part_list_head.next; pp != NULL; pp = pp->next) + { + orderedVector.increment(); + orderedVector.last().p = pp; + orderedVector.last().k = mDot(pp->pos, viewvec); + orderedVector.last().emitter = emitters[i]; + } + } + + // qsort the list into far to near ordering + dQsort(orderedVector.address(), orderedVector.size(), sizeof(SortParticlePool), cmpSortParticlePool); + + static Vector tempBuff(2048); + tempBuff.reserve(n_parts*4 + 64); // make sure tempBuff is big enough + GFXVertexPCT *buffPtr = tempBuff.address(); // use direct pointer (faster) + + Point3F basePoints[4]; + basePoints[0] = Point3F(-1.0, 0.0, -1.0); + basePoints[1] = Point3F( 1.0, 0.0, -1.0); + basePoints[2] = Point3F( 1.0, 0.0, 1.0); + basePoints[3] = Point3F(-1.0, 0.0, 1.0); + + MatrixF camView = GFX->getWorldMatrix(); + camView.transpose(); // inverse - this gets the particles facing camera + + for (U32 i = 0; i < orderedVector.size(); i++) + { + Particle* particle = orderedVector[i].p; + ParticleEmitter* emitter = orderedVector[i].emitter; + + if (emitter->mDataBlock->orientParticles) + emitter->setupOriented(particle, camPos, ambientColor, buffPtr); + else + emitter->setupBillboard(particle, basePoints, camView, ambientColor, buffPtr); + buffPtr+=4; + } + + // create new VB if emitter size grows + if( !mVertBuff || n_parts > mCurBuffSize ) + { + mCurBuffSize = n_parts; + mVertBuff.set(GFX, n_parts*4, GFXBufferTypeDynamic); + } + // lock and copy tempBuff to video RAM + GFXVertexPCT *verts = mVertBuff.lock(); + dMemcpy( verts, tempBuff.address(), n_parts * 4 * sizeof(GFXVertexPCT) ); + mVertBuff.unlock(); + + //MeshRenderInst *ri = gRenderInstManager->allocInst(); + ParticleRenderInst *ri = renderManager->allocInst(); + ri->vertBuff = &mVertBuff; + ri->primBuff = &main_emitter_data->primBuff; + ri->translucentSort = true; + ri->type = RenderPassManager::RIT_Particle; + ri->sortDistSq = getWorldBox().getSqDistanceToPoint( camPos ); + + ri->defaultKey = (-sort_priority*100); + + ri->modelViewProj = renderManager->allocUniqueXform( GFX->getProjectionMatrix() * + GFX->getViewMatrix() * + GFX->getWorldMatrix() ); + + ri->count = n_parts; + + ri->blendStyle = main_emitter_data->blendStyle; + + // use first particle's texture unless there is an emitter texture to override it + if (main_emitter_data->textureHandle) + ri->diffuseTex = &*(main_emitter_data->textureHandle); + else + ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->textureHandle); + + ri->softnessDistance = main_emitter_data->softnessDistance; + + // Sort by texture too. + //ri->defaultKey = ri->diffuseTex ? (U32)ri->diffuseTex : (U32)ri->vertBuff; + + renderManager->addInst( ri ); +} + +void afxParticlePool::pool_renderObject_TwoPass(RenderPassManager *renderManager, const Point3F &camPos, const LinearColorF &ambientColor) +{ + S32 n_parts = 0; + for (S32 i = 0; i < emitters.size(); i++) + n_parts += emitters[i]->n_parts; + + if (n_parts == 0) + return; + + ParticleEmitterData* main_emitter_data = emitters[0]->mDataBlock; + + main_emitter_data->allocPrimBuffer(n_parts); + + orderedVector.clear(); + + F32 min_d=0.0f, max_d=0.0f; + + for (U32 i=0; i < emitters.size(); i++) + { + if (!emitters[i]->mDataBlock->pool_depth_fade || !emitters[i]->mDataBlock->pool_radial_fade) + continue; + + // add particles to orderedVector and calc distance and min/max distance + for (Particle* pp = emitters[i]->part_list_head.next; pp != NULL; pp = pp->next) + { + F32 dist = (pp->pos-camPos).len(); + if (dist > max_d) + max_d = dist; + else if (dist < min_d) + min_d = dist; + + orderedVector.increment(); + orderedVector.last().p = pp; + orderedVector.last().k = dist; + orderedVector.last().emitter = emitters[i]; + } + } + + // Add remaining emitters particles to the orderedVector that do not participate in the + // above depth computations: + for (U32 i=0; i < emitters.size(); i++) + { + if (emitters[i]->mDataBlock->pool_depth_fade || emitters[i]->mDataBlock->pool_radial_fade) + continue; + + for (Particle* pp = emitters[i]->part_list_head.next; pp != NULL; pp = pp->next) + { + orderedVector.increment(); + orderedVector.last().p = pp; + orderedVector.last().k = 0; // no need to compute depth here + orderedVector.last().emitter = emitters[i]; + } + } + + static Vector tempBuff(2048); + tempBuff.reserve(n_parts*4 + 64); // make sure tempBuff is big enough + GFXVertexPCT *buffPtr = tempBuff.address(); // use direct pointer (faster) + + Point3F basePoints[4]; + basePoints[0] = Point3F(-1.0, 0.0, -1.0); + basePoints[1] = Point3F( 1.0, 0.0, -1.0); + basePoints[2] = Point3F( 1.0, 0.0, 1.0); + basePoints[3] = Point3F(-1.0, 0.0, 1.0); + + MatrixF camView = GFX->getWorldMatrix(); + camView.transpose(); // inverse - this gets the particles facing camera + + //~~~~~~~~~~~~~~~~~~~~// + + Point3F bbox_center; mObjBox.getCenter(&bbox_center); + F32 d_range = max_d - min_d; + bool d_safe = (d_range>0.0001); + F32 d_half = min_d + (d_range*0.5f); + + //~~~~~~~~~~~~~~~~~~~~// + + for (U32 i = 0; i < orderedVector.size(); i++) + { + Particle* particle = orderedVector[i].p; + ParticleEmitter* emitter = orderedVector[i].emitter; + + LinearColorF color_save = particle->color; + particle->color.set(mDataBlock->base_color.red, mDataBlock->base_color.green, mDataBlock->base_color.blue, mDataBlock->base_color.alpha*particle->color.alpha); + emitter->setupBillboard(particle, basePoints, camView, ambientColor, buffPtr); + particle->color = color_save; + + buffPtr+=4; + } + + // create new VB if emitter size grows + if( !mVertBuff || n_parts > mCurBuffSize ) + { + mCurBuffSize = n_parts; + mVertBuff.set(GFX, n_parts*4, GFXBufferTypeDynamic); + } + // lock and copy tempBuff to video RAM + GFXVertexPCT *verts = mVertBuff.lock(); + dMemcpy( verts, tempBuff.address(), n_parts * 4 * sizeof(GFXVertexPCT) ); + mVertBuff.unlock(); + + ParticleRenderInst *ri = renderManager->allocInst(); + ri->vertBuff = &mVertBuff; + ri->primBuff = &main_emitter_data->primBuff; + ri->translucentSort = true; + ri->type = RenderPassManager::RIT_Particle; + ri->sortDistSq = getWorldBox().getSqDistanceToPoint( camPos ); + + ri->defaultKey = (-sort_priority*100); + + ri->modelViewProj = renderManager->allocUniqueXform( GFX->getProjectionMatrix() * + GFX->getViewMatrix() * + GFX->getWorldMatrix() ); + + ri->count = n_parts; + + ri->blendStyle = ParticleRenderInst::BlendNormal; + + // use first particle's texture unless there is an emitter texture to override it + //if (main_emitter_data->textureHandle) + // ri->diffuseTex = &*(main_emitter_data->textureHandle); + //else + ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->textureExtHandle); + + F32 save_sort_dist = ri->sortDistSq; + + ri->softnessDistance = main_emitter_data->softnessDistance; + + renderManager->addInst( ri ); + + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + // 2nd-pass + + buffPtr = tempBuff.address(); + + bbox_center.z = mObjBox.minExtents.z; + F32 max_radius = (max_d-min_d)*0.5f; + + // gather fade settings + bool do_mixed_fades = false; + bool do_radial_fades = (emitters[0]->mDataBlock->pool_radial_fade && (max_radius>0.0001f)); + bool do_depth_fades = (emitters[0]->mDataBlock->pool_depth_fade && d_safe); + for (U32 i = 1; i < emitters.size(); i++) + { + if ( (do_radial_fades != (emitters[i]->mDataBlock->pool_radial_fade && (max_radius>0.0001f))) || + (do_depth_fades != (emitters[i]->mDataBlock->pool_depth_fade && d_safe))) + { + do_mixed_fades = true; + break; + } + } + + if (do_mixed_fades) + { + for (U32 i = 0; i < orderedVector.size(); i++) + { + Particle* particle = orderedVector[i].p; + ParticleEmitter* emitter = orderedVector[i].emitter; + + F32 bf = 1.0; // blend factor + + // blend factor due to radius + if (emitter->mDataBlock->pool_radial_fade && (max_radius>0.0001f)) + { + F32 p_radius = (particle->pos-bbox_center).len(); + F32 bf_radius = p_radius/max_radius; + if (bf_radius>1.0f) bf_radius = 1.0f; + bf *= bf_radius*bf_radius; // quadratic for faster falloff + } + + // blend factor, depth based + if (emitter->mDataBlock->pool_depth_fade && d_safe && (orderedVector[i].k > d_half)) + { + F32 bf_depth = ((max_d-orderedVector[i].k) / (d_range*0.5f)); + bf *= bf_depth; + } + + // overall blend factor weight + bf *= mDataBlock->blend_weight; + + LinearColorF color_save = particle->color; + particle->color = particle->color*bf; + emitter->setupBillboard(particle, basePoints, camView, ambientColor, buffPtr); + particle->color = color_save; + + buffPtr+=4; + } + } + else if (do_radial_fades && do_depth_fades) + { + for (U32 i = 0; i < orderedVector.size(); i++) + { + Particle* particle = orderedVector[i].p; + ParticleEmitter* emitter = orderedVector[i].emitter; + + F32 bf = 1.0; // blend factor + + // blend factor due to radius + F32 p_radius = (particle->pos-bbox_center).len(); + F32 bf_radius = p_radius/max_radius; + if (bf_radius>1.0f) bf_radius = 1.0f; + bf *= bf_radius*bf_radius; // quadratic for faster falloff + + // blend factor, depth based + if (orderedVector[i].k > d_half) + { + F32 bf_depth = ((max_d-orderedVector[i].k) / (d_range*0.5f)); + bf *= bf_depth; + } + + // overall blend factor weight + bf *= mDataBlock->blend_weight; + + LinearColorF color_save = particle->color; + particle->color = particle->color*bf; + emitter->setupBillboard(particle, basePoints, camView, ambientColor, buffPtr); + particle->color = color_save; + + buffPtr+=4; + } + } + else if (do_radial_fades) // && !do_depth_fades + { + for (U32 i = 0; i < orderedVector.size(); i++) + { + Particle* particle = orderedVector[i].p; + ParticleEmitter* emitter = orderedVector[i].emitter; + + F32 bf = 1.0; // blend factor + + // blend factor due to radius + F32 p_radius = (particle->pos-bbox_center).len(); + F32 bf_radius = p_radius/max_radius; + if (bf_radius>1.0f) bf_radius = 1.0f; + bf *= bf_radius*bf_radius; // quadratic for faster falloff + + // overall blend factor weight + bf *= mDataBlock->blend_weight; + + LinearColorF color_save = particle->color; + particle->color = particle->color*bf; + emitter->setupBillboard(particle, basePoints, camView, ambientColor, buffPtr); + particle->color = color_save; + + buffPtr+=4; + } + } + else if (do_depth_fades) // && !do_radial_fades + { + for (U32 i = 0; i < orderedVector.size(); i++) + { + Particle* particle = orderedVector[i].p; + ParticleEmitter* emitter = orderedVector[i].emitter; + + F32 bf = 1.0; // blend factor + + // blend factor, depth based + if (orderedVector[i].k > d_half) + { + F32 bf_depth = ((max_d-orderedVector[i].k) / (d_range*0.5f)); + bf *= bf_depth; + } + + // overall blend factor weight + bf *= mDataBlock->blend_weight; + + LinearColorF color_save = particle->color; + particle->color = particle->color*bf; + emitter->setupBillboard(particle, basePoints, camView, ambientColor, buffPtr); + particle->color = color_save; + + buffPtr+=4; + } + } + else // (no fades) + { + for (U32 i = 0; i < orderedVector.size(); i++) + { + Particle* particle = orderedVector[i].p; + ParticleEmitter* emitter = orderedVector[i].emitter; + + F32 bf = mDataBlock->blend_weight; // blend factor + + LinearColorF color_save = particle->color; + particle->color = particle->color*bf; + emitter->setupBillboard(particle, basePoints, camView, ambientColor, buffPtr); + particle->color = color_save; + + buffPtr+=4; + } + } + + // create new VB if emitter size grows + if( !mVertBuff2 || n_parts > mCurBuffSize2 ) + { + mCurBuffSize2 = n_parts; + mVertBuff2.set(GFX, n_parts*4, GFXBufferTypeDynamic); + } + + // lock and copy tempBuff to video RAM + verts = mVertBuff2.lock(); + dMemcpy( verts, tempBuff.address(), n_parts * 4 * sizeof(GFXVertexPCT) ); + mVertBuff2.unlock(); + + ri = renderManager->allocInst(); + ri->vertBuff = &mVertBuff2; + ri->primBuff = &main_emitter_data->primBuff; + ri->translucentSort = true; + ri->type = RenderPassManager::RIT_Particle; + ri->sortDistSq = save_sort_dist; + + ri->defaultKey = (-sort_priority*100) + 1; + + ri->modelViewProj = renderManager->allocUniqueXform( GFX->getProjectionMatrix() * + GFX->getViewMatrix() * + GFX->getWorldMatrix() ); + + ri->count = n_parts; + + ri->blendStyle = ParticleRenderInst::BlendAdditive; + + // use first particle's texture unless there is an emitter texture to override it + if (main_emitter_data->textureHandle) + ri->diffuseTex = &*(main_emitter_data->textureHandle); + else + ri->diffuseTex = &*(main_emitter_data->particleDataBlocks[0]->textureHandle); + + ri->softnessDistance = main_emitter_data->softnessDistance; + + renderManager->addInst( ri ); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxPath.cpp b/Engine/source/afx/util/afxPath.cpp new file mode 100644 index 000000000..1a9ecc4af --- /dev/null +++ b/Engine/source/afx/util/afxPath.cpp @@ -0,0 +1,530 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/consoleTypes.h" +#include "core/stream/bitStream.h" +#include "math/mathIO.h" + +#include "afx/util/afxPath.h" +#include "afx/util/afxPath3D.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// afxPathData + +IMPLEMENT_CO_DATABLOCK_V1(afxPathData); + +ConsoleDocClass( afxPathData, + "@brief A datablock for specifiying a 3D path for use with AFX.\n\n" + + "@ingroup afxUtil\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +StringTableEntry afxPathData::POINTS_FIELD; +StringTableEntry afxPathData::ROLL_FIELD; +StringTableEntry afxPathData::TIMES_FIELD; + +ImplementEnumType( afxPath3DLoopType, "Possible loop types for an afxPath.\n" "@ingroup afxPath\n\n" ) + { afxPath3D::LOOP_CONSTANT, "constant", "..." }, + { afxPath3D::LOOP_CYCLE, "cycle", "..." }, + { afxPath3D::LOOP_OSCILLATE, "oscillate", "..." }, +EndImplementEnumType; + +afxPathData::afxPathData() +{ + if (POINTS_FIELD == 0) + { + POINTS_FIELD = StringTable->insert("points"); + ROLL_FIELD = StringTable->insert("roll"); + TIMES_FIELD = StringTable->insert("times"); + } + + loop_string = ST_NULLSTRING; + delay = 0; + lifetime = 0; + loop_type = 0; + mult = 1.0f; + time_offset = 0.0f; + resolved = false; + reverse = false; + offset.zero(); + echo = false; + concentric = false; + + points_string = ST_NULLSTRING; + points = 0; + num_points = 0; + update_points = true; + + roll_string = ST_NULLSTRING; + rolls = 0; + update_rolls = true; + + times_string = ST_NULLSTRING; + times = 0; + update_times = true; +} + +afxPathData::afxPathData(const afxPathData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + points_string = other.points_string; + roll_string = other.roll_string; + loop_string = other.loop_string; + delay = other.delay; + lifetime = other.lifetime; + loop_type = other.loop_type; // -- + mult = other.mult; + time_offset = other.time_offset; + resolved = other.resolved; // -- + reverse = other.reverse; + offset = other.offset; + echo = other.echo; + concentric = other.concentric; + times_string = other.times_string; + + num_points = other.num_points; // -- + if (other.points && num_points > 0) + { + points = new Point3F[num_points]; + dMemcpy(points, other.points, sizeof(Point3F)*num_points); // -- + } + else + points = 0; + if (other.rolls && num_points > 0) + { + rolls = new F32[num_points]; + dMemcpy(rolls, other.rolls, sizeof(F32)*num_points); // -- + } + else + rolls = 0; + if (other.times && num_points > 0) + { + times = new F32[num_points]; + dMemcpy(times, other.times, sizeof(F32)*num_points); // -- + } + else + times = 0; + + update_points = other.update_points; // -- + update_rolls = other.update_rolls; // -- + update_times = other.update_times; // -- +} + +afxPathData::~afxPathData() +{ + clear_arrays(); +} + +void afxPathData::initPersistFields() +{ + addField("points", TypeString, Offset(points_string, afxPathData), + "..."); + addField("roll", TypeString, Offset(roll_string, afxPathData), + "..."); + addField("times", TypeString, Offset(times_string, afxPathData), + "..."); + addField("loop", TypeString, Offset(loop_string, afxPathData), + "..."); + addField("mult", TypeF32, Offset(mult, afxPathData), + "..."); + addField("delay", TypeF32, Offset(delay, afxPathData), + "..."); + addField("lifetime", TypeF32, Offset(lifetime, afxPathData), + "..."); + addField("timeOffset", TypeF32, Offset(time_offset, afxPathData), + "..."); + addField("reverse", TypeBool, Offset(reverse, afxPathData), + "..."); + addField("offset", TypePoint3F, Offset(offset, afxPathData), + "..."); + addField("echo", TypeBool, Offset(echo, afxPathData), + "..."); + addField("concentric", TypeBool, Offset(concentric, afxPathData), + "..."); + + Parent::initPersistFields(); +} + +bool afxPathData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + update_derived_values(); + + return true; +} + +void afxPathData::onRemove() +{ + clear_arrays(); + loop_type = 0; + + Parent::onRemove(); +} + +void afxPathData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(num_points); + if (num_points > 0) + { + for (U32 i = 0; i < num_points; i++) + mathWrite(*stream, points[i]); + if (stream->writeFlag(rolls != 0)) + { + for (U32 i = 0; i < num_points; i++) + stream->write(rolls[i]); + } + if (stream->writeFlag(times != 0)) + { + for (U32 i = 0; i < num_points; i++) + stream->write(times[i]); + } + } + + stream->writeString(loop_string); + stream->write(delay); + stream->write(lifetime); + stream->write(time_offset); + stream->write(mult); + stream->writeFlag(reverse); + mathWrite(*stream, offset); + stream->writeFlag(echo); + stream->writeFlag(concentric); +} + +void afxPathData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + clear_arrays(); + + // read the points and rolls + stream->read(&num_points); + if (num_points > 0) + { + points = new Point3F[num_points]; + for (U32 i = 0; i < num_points; i++) + mathRead(*stream, &points[i]); + update_points = false; + if (stream->readFlag()) + { + rolls = new F32[num_points]; + for (U32 i = 0; i < num_points; i++) + stream->read(&rolls[i]); + update_rolls = false; + } + if (stream->readFlag()) + { + times = new F32[num_points]; + for (U32 i = 0; i < num_points; i++) + stream->read(×[i]); + update_times = false; + } + } + + loop_string = stream->readSTString(); + stream->read(&delay); + stream->read(&lifetime); + stream->read(&time_offset); + stream->read(&mult); + reverse = stream->readFlag(); + mathRead(*stream, &offset); + echo = stream->readFlag(); + concentric = stream->readFlag(); +} + +void afxPathData::update_derived_values() +{ + U32 num_rolls = (rolls != 0) ? num_points : 0; + U32 num_times = (times != 0) ? num_points : 0; + + if (update_points) + { + derive_points_array(); + update_points = false; + } + + if (update_rolls || num_rolls != num_points) + { + derive_rolls_array(); + update_rolls = false; + } + + if (update_times || num_times != num_points) + { + derive_times_array(); + update_times = false; + } + + // CAUTION: The following block of code is fragile and tricky since it depends + // on the underlying structures defined by ImplementEnumType/EndImplementEnumType. + // This done because the enum text is parsed from a longer string. + if (loop_string != ST_NULLSTRING) + { + for (unsigned int i = 0; i < _afxPath3DLoopType::_sEnumTable.getNumValues(); i++) + { + if (dStricmp(_afxPath3DLoopType::_sEnumTable[i].mName, loop_string) == 0) + { + loop_type = _afxPath3DLoopType::_sEnumTable[i].mInt; + break; + } + } + } + else + { + loop_string = _afxPath3DLoopType::_sEnumTable[0].mName; + loop_type = _afxPath3DLoopType::_sEnumTable[0].mInt; + } +} + +bool afxPathData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + update_derived_values(); + + return true; +} + +void afxPathData::onStaticModified(const char* slot, const char* newValue) +{ + Parent::onStaticModified(slot, newValue); + + if (slot == POINTS_FIELD) + { + update_points = true; + return; + } + if (slot == ROLL_FIELD) + { + update_rolls = true; + return; + } + if (slot == TIMES_FIELD) + { + update_times = true; + return; + } +} + +void afxPathData::extract_floats_from_string(Vector& values, const char* points_str) +{ + values.clear(); + + if (!points_str) + return; + + // make a copy of points_str for tokenizing + char* tokCopy = dStrdup(points_str); + + // extract each token, convert to float, add to values[] + char* currTok = dStrtok(tokCopy, " \t"); + while (currTok != NULL) + { + F32 value = dAtof(currTok); + values.push_back(value); + currTok = dStrtok(NULL, " \t"); + } + + dFree(tokCopy); +} + +Point3F* afxPathData::build_points_array(Vector& values, U32& n_points, bool reverse) +{ + AssertFatal(values.size() > 0, "Values array is empty."); + AssertFatal(values.size()%3 == 0, "Values array is not a multiple of 3."); + + n_points = values.size()/3; + Point3F* points = new Point3F[n_points]; + + if (reverse) + { + U32 p_i = 0; + for (S32 i = values.size()-1; i > 1; i-=3) + points[p_i++].set(values[i-2], values[i-1], values[i]); + } + else + { + U32 p_i = 0; + for (U32 i = 0; i < values.size(); i+=3) + points[p_i++].set(values[i], values[i+1], values[i+2]); + } + + return points; +} + +F32* afxPathData::build_floats_array(Vector& values, U32& n_floats, bool reverse) +{ + AssertFatal(values.size() > 0, "Values array is empty."); + + n_floats = values.size(); + F32* floats = new F32[n_floats]; + + if (reverse) + { + F32* f = floats; + for (S32 i = values.size()-1; i >= 0; i--) + { + *f = values[i]; + f++; + } + } + else + { + for (U32 i = 0; i < values.size(); i++) + floats[i] = values[i]; + } + + return floats; +} + +void afxPathData::clear_arrays() +{ + num_points = 0; + if (points) + { + delete [] points; + points = 0; + } + if (rolls) + { + delete [] rolls; + rolls = 0; + } + if (times) + { + delete [] times; + times = 0; + } + update_points = true; + update_rolls = true; + update_times = true; +} + +void afxPathData::derive_points_array() +{ + if (points_string == ST_NULLSTRING) + return; + + if (points) + { + delete [] points; + points = 0; + } + num_points = 0; + + Vector values; + extract_floats_from_string(values, points_string); + if (values.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxPathData(%s) empty points field, datablock is invalid.", getName()); + return; + } + if (values.size()%3 != 0) + { + Con::warnf(ConsoleLogEntry::General, "afxPathData(%s) total points values is not a multiple of 3, datablock is invalid.", getName()); + return; + } + + points = build_points_array(values, num_points, reverse); + + if (offset.x != 0.0f || offset.y != 0.0f || offset.z != 0.0f) + { + // add offset here for efficiency (saves an addition from afxXM_PathConform) + for (U32 i = 0; i < num_points; i++) + points[i] += offset; + } +} + +void afxPathData::derive_rolls_array() +{ + if (roll_string == ST_NULLSTRING) + return; + + if (rolls) + { + delete [] rolls; + rolls = 0; + } + + Vector values; + extract_floats_from_string(values, roll_string); + if (values.size() == 0) + return; + + if (values.size() != num_points) + { + Con::warnf(ConsoleLogEntry::General, "afxPathData(%s) total roll values is not equal to total points, rolls ignored.", getName()); + return; + } + + U32 num_rolls = 0; + rolls = build_floats_array(values, num_rolls, reverse); + + AssertFatal(num_rolls == num_points, "Unexpected error: num_rolls disagrees with num_points."); +} + +void afxPathData::derive_times_array() +{ + if (times_string == ST_NULLSTRING) + return; + + if (times) + { + delete [] times; + times = 0; + } + + Vector values; + extract_floats_from_string(values, times_string); + if (values.size() == 0) + return; + + if (values.size() != num_points) + { + Con::warnf(ConsoleLogEntry::General, "afxPathData(%s) total time values is not equal to total points, times ignored", getName()); + return; + } + + U32 num_times = 0; + times = build_floats_array(values, num_times, reverse); + + AssertFatal(num_times == num_points, "Unexpected error: num_times disagrees with num_points."); +} + +void afxPathData::onPerformSubstitutions() +{ + Parent::onPerformSubstitutions(); + update_derived_values(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxPath.h b/Engine/source/afx/util/afxPath.h new file mode 100644 index 000000000..50ce218e8 --- /dev/null +++ b/Engine/source/afx/util/afxPath.h @@ -0,0 +1,102 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PATH_H_ +#define _AFX_PATH_H_ + +#include "core/util/tVector.h" + +class afxPathData : public GameBaseData +{ + typedef GameBaseData Parent; + + static StringTableEntry POINTS_FIELD; + static StringTableEntry ROLL_FIELD; + static StringTableEntry TIMES_FIELD; + + bool resolved; + bool update_points; + bool update_rolls; + bool update_times; + + void update_derived_values(); + + void clear_arrays(); + void derive_points_array(); + void derive_rolls_array(); + void derive_times_array(); + + static void extract_floats_from_string(Vector& values, const char* points_str); + static Point3F* build_points_array(Vector& values, U32& n_points, bool reverse=false); + static F32* build_floats_array(Vector& values, U32& n_floats, bool reverse=false); + +public: + U32 num_points; + StringTableEntry points_string; + Point3F* points; + + StringTableEntry roll_string; + F32* rolls; + + StringTableEntry times_string; + F32* times; + + StringTableEntry loop_string; + F32 delay; + F32 lifetime; + + U32 loop_type; + F32 mult; + F32 time_offset; + bool reverse; + Point3F offset; + bool echo; + bool concentric; + +public: + /*C*/ afxPathData(); + /*C*/ afxPathData(const afxPathData&, bool = false); + /*D*/ ~afxPathData(); + + virtual bool onAdd(); + virtual void onRemove(); + virtual void packData(BitStream*); + virtual void unpackData(BitStream*); + + bool preload(bool server, String &errorStr); + + virtual void onStaticModified(const char* slotName, const char* newValue = NULL); + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxPathData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PATH_H_ diff --git a/Engine/source/afx/util/afxPath3D.cpp b/Engine/source/afx/util/afxPath3D.cpp new file mode 100644 index 000000000..f37b141d9 --- /dev/null +++ b/Engine/source/afx/util/afxPath3D.cpp @@ -0,0 +1,342 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "console/console.h" + +#include "afx/util/afxPath3D.h" + +afxPath3D::afxPath3D() : start_time(0), num_points(0), loop_type(LOOP_CONSTANT) +{ +} + +afxPath3D::~afxPath3D() +{ +} + +void afxPath3D::sortAll() +{ + curve.sort(); + curve_parameters.sort(); +} + +void afxPath3D::setStartTime( F32 time ) +{ + start_time = time; +} + +void afxPath3D::setLoopType( U32 loop_type ) +{ + this->loop_type = loop_type; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +F32 afxPath3D::getEndTime() +{ + return end_time; +} + +int afxPath3D::getNumPoints() +{ + return num_points; +} + +Point3F afxPath3D::getPointPosition( int index ) +{ + if (index < 0 || index >= num_points) + return Point3F(0.0f, 0.0f, 0.0f); + + return curve.getPoint(index); +} + +F32 afxPath3D::getPointTime( int index ) +{ + if (index < 0 || index >= num_points) + return 0.0f; + + return curve_parameters.getKeyTime(index); +} + +F32 afxPath3D::getPointParameter( int index ) +{ + if (index < 0 || index >= num_points) + return 0.0f; + + return curve_parameters.getKeyValue(index); +} + +Point2F afxPath3D::getParameterSegment( F32 time ) +{ + return curve_parameters.getSegment(time); +} + +void afxPath3D::setPointPosition( int index, Point3F &p ) +{ + if (index < 0 || index >= num_points) + return; + + curve.setPoint(index, p); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +F32 afxPath3D::calcCurveTime( F32 time ) +{ + if( time <= start_time ) + return 0.0f; + if( time <= end_time ) + return time-start_time; + + switch( loop_type ) + { + case LOOP_CYCLE : + { + return mFmod( time-start_time, end_time-start_time ); + } + case LOOP_OSCILLATE : + { + F32 t1 = time-start_time; + F32 t2 = end_time-start_time; + + if( (int)(t1/t2) % 2 ) // odd segment + return t2 - mFmod( t1, t2 ); + else // even segment + return mFmod( t1, t2 ); + } + case LOOP_CONSTANT : + default: + return end_time; + } +} + +Point3F afxPath3D::evaluateAtTime( F32 time ) +{ + F32 ctime = calcCurveTime( time ); + F32 param = curve_parameters.evaluate( ctime ); + return curve.evaluate(param); +} + +Point3F afxPath3D::evaluateAtTime(F32 t0, F32 t1) +{ + F32 ctime = calcCurveTime(t0); + F32 param = curve_parameters.evaluate( ctime ); + Point3F p0 = curve.evaluate(param); + + ctime = calcCurveTime(t1); + param = curve_parameters.evaluate( ctime ); + Point3F p1 = curve.evaluate(param); + + return p1-p0; +} + +Point3F afxPath3D::evaluateTangentAtTime( F32 time ) +{ + F32 ctime = calcCurveTime( time ); + F32 param = curve_parameters.evaluate( ctime ); + return curve.evaluateTangent(param); +} + +Point3F afxPath3D::evaluateTangentAtPoint( int index ) +{ + F32 param = curve_parameters.getKeyValue(index); + return curve.evaluateTangent(param); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_time, F32 end_time ) +{ + this->num_points = num_points; + + // Add points to path + F32 param_inc = 1.0f / (F32)(num_points - 1); + F32 param = 0.0f; + for( int i = 0; i < num_points; i++, param += param_inc ) + { + if( i == num_points-1 ) + param = 1.0f; + curve.addPoint( param, curve_points[i] ); + } + + curve.computeTangents(); + + initPathParametersNEW( curve_points, start_time, end_time ); + + sortAll(); +} + +void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed ) +{ + this->num_points = num_points; + + // Add points to path + F32 param_inc = 1.0f / (F32)(num_points - 1); + F32 param = 0.0f; + for( int i = 0; i < num_points; i++, param += param_inc ) + { + if( i == num_points-1 ) + param = 1.0f; + curve.addPoint( param, curve_points[i] ); + } + + initPathParameters( curve_points, speed ); + + sortAll(); +} + +void afxPath3D::buildPath( int num_points, Point3F curve_points[], + F32 point_times[], F32 time_offset, F32 time_factor ) +{ + this->num_points = num_points; + + // Add points to path + F32 param_inc = 1.0f / (F32)(num_points - 1); + F32 param = 0.0f; + for( int i = 0; i < num_points; i++, param += param_inc ) + { + if( i == num_points-1 ) + param = 1.0f; + curve.addPoint( param, curve_points[i] ); + + curve_parameters.addKey( (point_times[i]+time_offset)*time_factor, param ); + } + + // Set end time + end_time = (point_times[num_points-1]+time_offset)*time_factor; + + sortAll(); +} + +void afxPath3D::buildPath( int num_points, Point3F curve_points[], Point2F curve_params[] ) +{ + this->num_points = num_points; + + // Add points to path + F32 param_inc = 1.0f / (F32)(num_points - 1); + F32 param = 0.0f; + for( int i = 0; i < num_points; i++, param += param_inc ) + { + if( i == num_points-1 ) + param = 1.0f; + curve.addPoint( param, curve_points[i] ); + } + + // + for (int i = 0; i < num_points; i++) + curve_parameters.addKey( curve_params[i] ); + + // Set end time + end_time = curve_params[num_points - 1].x; + + sortAll(); +} + +void afxPath3D::reBuildPath() +{ + curve.computeTangents(); + sortAll(); +} + +void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed ) +{ + // Compute the time for each point dependent on the speed of the character and the + // distance it must travel (approximately!) + int num_segments = num_points - 1; + F32 *point_distances = new F32[num_segments]; + for( int i = 0; i < num_segments; i++ ) + { + Point3F p1 = curve_points[i+1]; + Point3F p0 = curve_points[i]; + + point_distances[i] = (p1-p0).len(); + } + + F32 *times = new F32[num_segments]; + F32 last_time = 0;//start_time; + for( int i = 0; i < num_segments; i++ ) + { + times[i] = last_time + (point_distances[i] / speed); + last_time = times[i]; + } + + curve_parameters.addKey( 0, 0.0f );//start_time, 0.0f ); + F32 param_inc = 1.0f / (F32)(num_points - 1); + F32 param = 0.0f + param_inc; + for( int i = 0; i < num_segments; i++, param += param_inc ) + curve_parameters.addKey( times[i], param ); + + // Set end time + end_time = times[num_segments-1]; + + if (point_distances) + delete [] point_distances; + if (times) + delete [] times; +} + +void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F32 end_time ) +{ + int num_segments = num_points - 1; + F32 *point_distances = new F32[num_segments]; + F32 total_distance = 0.0f; + for( int i = 0; i < num_segments; i++ ) + { + Point3F p1 = curve_points[i+1]; + Point3F p0 = curve_points[i]; + + point_distances[i] = (p1-p0).len(); + total_distance += point_distances[i]; + } + + F32 duration = end_time - start_time; + + F32 time = 0.0f; //start_time; + curve_parameters.addKey( time, 0.0f ); + F32 param_inc = 1.0f / (F32)(num_points - 1); + F32 param = 0.0f + param_inc; + for( int i=0; i < num_segments; i++, param += param_inc ) + { + time += (point_distances[i]/total_distance) * duration; + curve_parameters.addKey( time, param ); + } + + // Set end time ???? + //end_time = time; + this->start_time = start_time; + this->end_time = end_time; + + if (point_distances) + delete [] point_distances; +} + +void afxPath3D::print() +{ + // curve.print(); + curve_parameters.print(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxPath3D.h b/Engine/source/afx/util/afxPath3D.h new file mode 100644 index 000000000..77d2e2ad2 --- /dev/null +++ b/Engine/source/afx/util/afxPath3D.h @@ -0,0 +1,101 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_PATH3D_UTIL_H_ +#define _AFX_PATH3D_UTIL_H_ + +#include "afx/util/afxCurve3D.h" +#include "afx/util/afxAnimCurve.h" + +#include "math/mMatrix.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxPath3D : public EngineObject +{ +private: + // Path-related data + afxCurve3D curve; + afxAnimCurve curve_parameters; + int num_points; + + // Time data + F32 start_time; + F32 end_time; + +public: + /*C*/ afxPath3D( ); + /*D*/ ~afxPath3D(); + + void sortAll(); + + void setStartTime(F32 time); + + F32 getEndTime(); + int getNumPoints(); + Point3F getPointPosition(int index); + F32 getPointTime(int index); + F32 getPointParameter(int index); + Point2F getParameterSegment(F32 time); + + void setPointPosition(int index, Point3F &p); + + Point3F evaluateAtTime(F32 time); + Point3F evaluateAtTime(F32 t0, F32 t1); // returns delta + Point3F evaluateTangentAtTime(F32 time); + Point3F evaluateTangentAtPoint(int index); + + void buildPath(int num_points, Point3F curve_points[], F32 start_time, F32 end_time); + void buildPath(int num_points, Point3F curve_points[], F32 speed); + void buildPath(int num_points, Point3F curve_points[], F32 point_times[], F32 time_offset, F32 time_factor); + void buildPath(int num_points, Point3F curve_points[], Point2F curve_params[]); + + void reBuildPath(); + + void print(); + + enum LoopType + { + LOOP_CONSTANT, + LOOP_CYCLE, + LOOP_OSCILLATE + }; + + U32 loop_type; + void setLoopType(U32); + +private: + void initPathParameters(Point3F curve_points[], F32 speed); + void initPathParametersNEW(Point3F curve_points[], F32 start_time, F32 end_time); + + F32 calcCurveTime(F32 time); +}; + +typedef afxPath3D::LoopType afxPath3DLoopType; +DefineEnumType( afxPath3DLoopType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_PATH3D_UTIL_H_ diff --git a/Engine/source/afx/util/afxTriBoxCheck2D_T3D.cpp b/Engine/source/afx/util/afxTriBoxCheck2D_T3D.cpp new file mode 100644 index 000000000..1802fe9b6 --- /dev/null +++ b/Engine/source/afx/util/afxTriBoxCheck2D_T3D.cpp @@ -0,0 +1,115 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Adapted to a 2D test for intersecting atlas triangles with zodiacs. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +//----------------------------------------------------------------------------- +// AABB-triangle overlap test code originally by Tomas Akenine-Möller +// Assisted by Pierre Terdiman and David Hunt +// http://www.cs.lth.se/home/Tomas_Akenine_Moller/code/ +// Ported to TSE by BJG, 2005-4-14 +//----------------------------------------------------------------------------- + +#include "afx/arcaneFX.h" +#include "afx/util/afxTriBoxCheck2D_T3D.h" + +#define FINDMINMAX(x0,x1,x2,min,max) \ + min = max = x0; \ + if(x1max) max=x1;\ + if(x2max) max=x2; + +/*======================== Z-tests ========================*/ + +#define AXISTEST_Z12(a, b, fa, fb) \ + p1 = a*v1.x - b*v1.y; \ + p2 = a*v2.x - b*v2.y; \ + if(p2rad || max<-rad) return false; + +#define AXISTEST_Z0(a, b, fa, fb) \ + p0 = a*v0.x - b*v0.y; \ + p1 = a*v1.x - b*v1.y; \ + if(p0rad || max<-rad) return false; + +bool afxTriBoxOverlap2D(const Point3F& boxcenter, const Point3F& boxhalfsize, const Point3F& a, const Point3F& b, const Point3F& c) +{ + /* use separating axis theorem to test overlap between triangle and box */ + /* need to test for overlap in these directions: */ + /* 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle */ + /* we do not even need to test these) */ + /* 2) normal of the triangle */ + /* 3) crossproduct(edge from tri, {x,y,z}-directin) */ + /* this gives 3x3=9 more tests */ + + F32 min,max,p0,p1,p2,rad; + + /* move everything so that the boxcenter is in (0,0,0) */ + Point3F v0 = a - boxcenter; + Point3F v1 = b - boxcenter; + Point3F v2 = c - boxcenter; + + /* compute triangle edges */ + Point3F e0 = v1 - v0; /* tri edge 0 */ + Point3F e1 = v2 - v1; /* tri edge 1 */ + Point3F e2 = v0 - v2; /* tri edge 2 */ + + /* Bullet 3: */ + /* test the 3 tests first */ + F32 fex = mFabs(e0.x); + F32 fey = mFabs(e0.y); + AXISTEST_Z12(e0.y, e0.x, fey, fex); + + fex = mFabs(e1.x); + fey = mFabs(e1.y); + AXISTEST_Z0(e1.y, e1.x, fey, fex); + + fex = mFabs(e2.x); + fey = mFabs(e2.y); + AXISTEST_Z12(e2.y, e2.x, fey, fex); + + /* Bullet 1: */ + /* first test overlap in the {x,y,z}-directions */ + /* find min, max of the triangle each direction, and test for overlap in */ + /* that direction -- this is equivalent to testing a minimal AABB around */ + /* the triangle against the AABB */ + + /* test in X-direction */ + FINDMINMAX(v0.x,v1.x,v2.x,min,max); + if(min>boxhalfsize.x || max<-boxhalfsize.x) return false; + + /* test in Y-direction */ + FINDMINMAX(v0.y,v1.y,v2.y,min,max); + if(min>boxhalfsize.y || max<-boxhalfsize.y) return false; + + return true; /* box and triangle overlaps */ +} + diff --git a/Engine/source/afx/util/afxTriBoxCheck2D_T3D.h b/Engine/source/afx/util/afxTriBoxCheck2D_T3D.h new file mode 100644 index 000000000..34b64adea --- /dev/null +++ b/Engine/source/afx/util/afxTriBoxCheck2D_T3D.h @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Adapted to a 2D test for intersecting atlas triangles with zodiacs. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +//----------------------------------------------------------------------------- +// AABB-triangle overlap test code originally by Tomas Akenine-Möller +// Assisted by Pierre Terdiman and David Hunt +// http://www.cs.lth.se/home/Tomas_Akenine_Moller/code/ +// Ported to TSE by BJG, 2005-4-14 +//----------------------------------------------------------------------------- + +#ifndef _AFX_TRIBOXCHECK_2D_H_ +#define _AFX_TRIBOXCHECK_2D_H_ + +#include "math/mPoint3.h" +#include "math/mBox.h" + +bool afxTriBoxOverlap2D(const Point3F& boxcenter, const Point3F& boxhalfsize, const Point3F& a, const Point3F& b, const Point3F& c); + +#endif // _AFX_TRIBOXCHECK_2D_H_ \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_Aim.cpp b/Engine/source/afx/xm/afxXM_Aim.cpp new file mode 100644 index 000000000..5e52823b7 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_Aim.cpp @@ -0,0 +1,261 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_AimData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + bool aim_z_only; + +public: + /*C*/ afxXM_AimData(); + /*C*/ afxXM_AimData(const afxXM_AimData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_AimData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxConstraint; + +class afxXM_Aim_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + +public: + /*C*/ afxXM_Aim_weighted(afxXM_AimData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Aim_weighted_z : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + +public: + /*C*/ afxXM_Aim_weighted_z(afxXM_AimData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Aim_fixed : public afxXM_Base +{ + typedef afxXM_Base Parent; + +public: + /*C*/ afxXM_Aim_fixed(afxXM_AimData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Aim_fixed_z : public afxXM_Base +{ + typedef afxXM_Base Parent; + +public: + /*C*/ afxXM_Aim_fixed_z(afxXM_AimData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_AimData); + +ConsoleDocClass( afxXM_AimData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_AimData::afxXM_AimData() +{ + aim_z_only = false; +} + +afxXM_AimData::afxXM_AimData(const afxXM_AimData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + aim_z_only = other.aim_z_only; +} + +void afxXM_AimData::initPersistFields() +{ + addField("aimZOnly", TypeBool, Offset(aim_z_only, afxXM_AimData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_AimData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->writeFlag(aim_z_only); +} + +void afxXM_AimData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + aim_z_only = stream->readFlag(); +} + +afxXM_Base* afxXM_AimData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_AimData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_AimData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->aim_z_only) + { + if (datablock->hasFixedWeight()) + return new afxXM_Aim_fixed_z(datablock, fx); + else + return new afxXM_Aim_weighted_z(datablock, fx); + } + else + { + if (datablock->hasFixedWeight()) + return new afxXM_Aim_fixed(datablock, fx); + else + return new afxXM_Aim_weighted(datablock, fx); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Aim_weighted::afxXM_Aim_weighted(afxXM_AimData* db, afxEffectWrapper* fxw) + : afxXM_WeightedBase(db, fxw) +{ +} + +void afxXM_Aim_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + VectorF line_of_sight = params.pos2 - params.pos; + line_of_sight.normalize(); + + F32 wt_factor = calc_weight_factor(elapsed); + + QuatF qt_ori_incoming(params.ori); + + MatrixF ori_outgoing = MathUtils::createOrientFromDir(line_of_sight); + QuatF qt_ori_outgoing(ori_outgoing); + + QuatF qt_ori = qt_ori_incoming.slerp(qt_ori_outgoing, wt_factor); + + qt_ori.setMatrix(¶ms.ori); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Aim_weighted_z::afxXM_Aim_weighted_z(afxXM_AimData* db, afxEffectWrapper* fxw) + : afxXM_WeightedBase(db, fxw) +{ +} + +void afxXM_Aim_weighted_z::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + Point3F aim_at_pos = params.pos2; + aim_at_pos.z = params.pos.z; + + VectorF line_of_sight = aim_at_pos - params.pos; + line_of_sight.normalize(); + + F32 wt_factor = calc_weight_factor(elapsed); + + QuatF qt_ori_incoming(params.ori); + + MatrixF ori_outgoing = MathUtils::createOrientFromDir(line_of_sight); + QuatF qt_ori_outgoing( ori_outgoing ); + + QuatF qt_ori = qt_ori_incoming.slerp(qt_ori_outgoing, wt_factor); + + qt_ori.setMatrix(¶ms.ori); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Aim_fixed::afxXM_Aim_fixed(afxXM_AimData* db, afxEffectWrapper* fxw) + : afxXM_Base(db, fxw) +{ +} + +void afxXM_Aim_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + VectorF line_of_sight = params.pos2 - params.pos; + line_of_sight.normalize(); + params.ori = MathUtils::createOrientFromDir(line_of_sight); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Aim_fixed_z::afxXM_Aim_fixed_z(afxXM_AimData* db, afxEffectWrapper* fxw) + : afxXM_Base(db, fxw) +{ +} + +void afxXM_Aim_fixed_z::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + Point3F aim_at_pos = params.pos2; + aim_at_pos.z = params.pos.z; + + VectorF line_of_sight = aim_at_pos - params.pos; + line_of_sight.normalize(); + + params.ori = MathUtils::createOrientFromDir(line_of_sight); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp new file mode 100644 index 000000000..02ce4634b --- /dev/null +++ b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp @@ -0,0 +1,262 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_AltitudeConformData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + F32 height; + bool do_terrain; + bool do_interiors; + U32 interior_types; + U32 terrain_types; + bool do_freeze; + +public: + /*C*/ afxXM_AltitudeConformData(); + /*C*/ afxXM_AltitudeConformData(const afxXM_AltitudeConformData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_AltitudeConformData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_AltitudeConform : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_AltitudeConformData* db; + SceneContainer* container; + bool do_freeze; + bool is_frozen; + F32 terrain_alt; + F32 interior_alt; + Point3F conformed_pos; + +public: + /*C*/ afxXM_AltitudeConform(afxXM_AltitudeConformData*, afxEffectWrapper*, bool on_server); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_AltitudeConformData); + +ConsoleDocClass( afxXM_AltitudeConformData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_AltitudeConformData::afxXM_AltitudeConformData() +{ + height = 0.0f; + do_terrain = false; + do_interiors = true; + do_freeze = false; + interior_types = InteriorLikeObjectType; + terrain_types = TerrainObjectType | TerrainLikeObjectType; +} + +afxXM_AltitudeConformData::afxXM_AltitudeConformData(const afxXM_AltitudeConformData& other, bool temp_clone) + : afxXM_WeightedBaseData(other, temp_clone) +{ + height = other.height; + do_terrain = other.do_terrain; + do_interiors = other.do_interiors; + do_freeze = other.do_freeze; + interior_types = other.interior_types; + terrain_types = other.terrain_types; +} + +void afxXM_AltitudeConformData::initPersistFields() +{ + addField("height", TypeF32, Offset(height, afxXM_AltitudeConformData), + "..."); + addField("conformToTerrain", TypeBool, Offset(do_terrain, afxXM_AltitudeConformData), + "..."); + addField("conformToInteriors", TypeBool, Offset(do_interiors, afxXM_AltitudeConformData), + "..."); + addField("freeze", TypeBool, Offset(do_freeze, afxXM_AltitudeConformData), + "..."); + addField("interiorTypes", TypeS32, Offset(interior_types, afxXM_AltitudeConformData), + "..."); + addField("terrainTypes", TypeS32, Offset(terrain_types, afxXM_AltitudeConformData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_AltitudeConformData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(height); + stream->writeFlag(do_terrain); + stream->writeFlag(do_interiors); + stream->writeFlag(do_freeze); + stream->write(interior_types); + stream->write(terrain_types); +} + +void afxXM_AltitudeConformData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&height); + do_terrain = stream->readFlag(); + do_interiors = stream->readFlag(); + do_freeze = stream->readFlag(); + stream->read(&interior_types); + stream->read(&terrain_types); +} + +afxXM_Base* afxXM_AltitudeConformData::create(afxEffectWrapper* fx, bool on_server) +{ + return new afxXM_AltitudeConform(this, fx, on_server); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_AltitudeConform::afxXM_AltitudeConform(afxXM_AltitudeConformData* db, afxEffectWrapper* fxw, bool on_server) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; + container = (on_server) ? &gServerContainer : &gClientContainer; + do_freeze = db->do_freeze; + is_frozen = false; + terrain_alt = -1.0f; + interior_alt = -1.0f; + conformed_pos.zero(); +} + +void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (is_frozen) + { + if (terrain_alt >= 0.0f) + fx_wrapper->setTerrainAltitude(terrain_alt); + if (interior_alt >= 0.0f) + fx_wrapper->setInteriorAltitude(interior_alt); + params.pos = conformed_pos; + return; + } + + RayInfo rInfo1, rInfo2; + bool hit1 = false, hit2 = false; + bool hit1_is_interior = false; + + // find primary ground + Point3F above_pos(params.pos); above_pos.z += 0.1f; + Point3F below_pos(params.pos); below_pos.z -= 10000; + hit1 = container->castRay(above_pos, below_pos, db->interior_types | db->terrain_types, &rInfo1); + + // find secondary ground + if (hit1 && rInfo1.object) + { + hit1_is_interior = ((rInfo1.object->getTypeMask() & db->interior_types) != 0); + U32 mask = (hit1_is_interior) ? db->terrain_types : db->interior_types; + Point3F above_pos(params.pos); above_pos.z += 0.1f; + Point3F below_pos(params.pos); below_pos.z -= 10000; + hit2 = container->castRay(above_pos, below_pos, mask, &rInfo2); + } + + if (hit1) + { + F32 wt_factor = calc_weight_factor(elapsed); + F32 incoming_z = params.pos.z; + F32 ground1_z = rInfo1.point.z + db->height; + F32 pos_z = ground1_z + (1.0f - wt_factor)*(incoming_z - ground1_z); + + if (hit1_is_interior) + { + interior_alt = incoming_z - pos_z; + fx_wrapper->setInteriorAltitude(interior_alt); + if (db->do_interiors) + params.pos.z = pos_z; + } + else + { + terrain_alt = incoming_z - pos_z; + fx_wrapper->setTerrainAltitude(terrain_alt); + if (db->do_terrain) + params.pos.z = pos_z; + } + + if (hit2) + { + F32 ground2_z = rInfo2.point.z + db->height; + F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z); + if (hit1_is_interior) + { + terrain_alt = incoming_z - z2; + fx_wrapper->setTerrainAltitude(terrain_alt); + } + else + { + interior_alt = incoming_z - z2; + fx_wrapper->setInteriorAltitude(interior_alt); + } + } + + // check for case where interior is underground + else if (hit1_is_interior) + { + RayInfo rInfo0; + Point3F lookup_from_pos(params.pos); lookup_from_pos.z -= 0.1f; + Point3F lookup_to_pos(params.pos); lookup_to_pos.z += 10000; + if (container->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0)) + { + F32 ground2_z = rInfo0.point.z + db->height; + F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z); + terrain_alt = z2 - incoming_z; + fx_wrapper->setTerrainAltitude(terrain_alt); + } + } + + if (do_freeze) + { + conformed_pos = params.pos; + is_frozen = true; + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/xm/afxXM_BoxAdapt.cpp b/Engine/source/afx/xm/afxXM_BoxAdapt.cpp new file mode 100644 index 000000000..14df4b399 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_BoxAdapt.cpp @@ -0,0 +1,175 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_BoxAdaptData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + F32 scale_factor; + Point2F dim_range; + +public: + /*C*/ afxXM_BoxAdaptData(); + /*C*/ afxXM_BoxAdaptData(const afxXM_BoxAdaptData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_BoxAdaptData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxConstraint; + +class afxXM_BoxAdapt : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + F32 scale_factor; + Point2F dim_range; + +public: + /*C*/ afxXM_BoxAdapt(afxXM_BoxAdaptData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_BoxAdaptData); + +ConsoleDocClass( afxXM_BoxAdaptData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_BoxAdaptData::afxXM_BoxAdaptData() +{ + scale_factor = 1.0f; + dim_range.set(0.1f, 1000.0f); +} + +afxXM_BoxAdaptData::afxXM_BoxAdaptData(const afxXM_BoxAdaptData& other, bool temp_clone) + : afxXM_WeightedBaseData(other, temp_clone) +{ + scale_factor = other.scale_factor; + dim_range = other.dim_range; +} + +void afxXM_BoxAdaptData::initPersistFields() +{ + addField("scaleFactor", TypeF32, Offset(scale_factor, afxXM_BoxAdaptData), + "..."); + addField("dimensionRange", TypePoint2F, Offset(dim_range, afxXM_BoxAdaptData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_BoxAdaptData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(scale_factor); + mathWrite(*stream, dim_range); +} + +void afxXM_BoxAdaptData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&scale_factor); + mathRead(*stream, &dim_range); +} + +afxXM_Base* afxXM_BoxAdaptData::create(afxEffectWrapper* fx, bool on_server) +{ + return new afxXM_BoxAdapt(this, fx); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_BoxAdapt::afxXM_BoxAdapt(afxXM_BoxAdaptData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + scale_factor = db->scale_factor; + + dim_range = db->dim_range; + + dim_range.x = getMax(0.001f, dim_range.x); + dim_range.y = getMax(0.001f, dim_range.y); + + if (dim_range.x > dim_range.y) + { + F32 tmp = dim_range.y; + dim_range.y = dim_range.x; + dim_range.x = tmp; + } +} + +void afxXM_BoxAdapt::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + afxConstraint* pos_cons = fx_wrapper->getPosConstraint(); + if (!pos_cons) + return; + + SceneObject* obj = pos_cons->getSceneObject(); + if (!obj) + return; + + F32 wt_factor = calc_weight_factor(elapsed); + + const Box3F& obj_box = obj->getObjBox(); + const VectorF obj_scale = obj->getScale(); + + F32 x_dim = obj_box.len_x()*obj_scale.x; + F32 y_dim = obj_box.len_y()*obj_scale.y; + + F32 dim = mClampF(getMax(x_dim, y_dim), dim_range.x, dim_range.y); + dim *= scale_factor*wt_factor*0.5f; + + //Con::printf("SET liveScaleFactor=%g x_dim=%g, y_dim=%g", dim, obj_box.len_x(), obj_box.len_y()); + fx_wrapper->setField("liveScaleFactor", avar("%g", dim)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_BoxConform.cpp b/Engine/source/afx/xm/afxXM_BoxConform.cpp new file mode 100644 index 000000000..3ae897446 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_BoxConform.cpp @@ -0,0 +1,175 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +enum afxXM_BoxConformType +{ + X_POS, X_NEG, Y_POS, Y_NEG, Z_POS, Z_NEG +}; +DefineEnumType( afxXM_BoxConformType ); + +class afxXM_BoxConformData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + S32 aabb_alignment; + +public: + /*C*/ afxXM_BoxConformData(); + /*C*/ afxXM_BoxConformData(const afxXM_BoxConformData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_BoxConformData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_BoxConform : public afxXM_Base +{ + typedef afxXM_Base Parent; + + afxXM_BoxConformData* db; + +public: + /*C*/ afxXM_BoxConform(afxXM_BoxConformData*, afxEffectWrapper*, bool on_server); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_BoxConformData); + +ConsoleDocClass( afxXM_BoxConformData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_BoxConformData::afxXM_BoxConformData() +{ + aabb_alignment = Z_NEG; +} + +afxXM_BoxConformData::afxXM_BoxConformData(const afxXM_BoxConformData& other, bool temp_clone) + : afxXM_BaseData(other, temp_clone) +{ + aabb_alignment = other.aabb_alignment; +} + +ImplementEnumType( afxXM_BoxConformType, "Possible box conform alignment types.\n" "@ingroup afxXM_BoxConform\n\n" ) + { X_POS, "+x", "..." }, + { X_NEG, "-x", "..." }, + { Y_POS, "+y", "..." }, + { Y_NEG, "-y", "..." }, + { Z_POS, "+z", "..." }, + { Z_NEG, "-z", "..." }, + { X_POS, "x", "..." }, + { Y_POS, "y", "..." }, + { Z_POS, "z", "..." }, +EndImplementEnumType; + +void afxXM_BoxConformData::initPersistFields() +{ + addField("boxAlignment", TYPEID< afxXM_BoxConformType >(), Offset(aabb_alignment, afxXM_BoxConformData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_BoxConformData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(aabb_alignment); +} + +void afxXM_BoxConformData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&aabb_alignment); +} + +afxXM_Base* afxXM_BoxConformData::create(afxEffectWrapper* fx, bool on_server) +{ + return new afxXM_BoxConform(this, fx, on_server); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_BoxConform::afxXM_BoxConform(afxXM_BoxConformData* db, afxEffectWrapper* fxw, bool on_server) +: afxXM_Base(db, fxw) +{ + this->db = db; +} + +void afxXM_BoxConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + afxConstraint* pos_cons = fx_wrapper->getPosConstraint(); + if (!pos_cons) + return; + + SceneObject* obj = pos_cons->getSceneObject(); + if (!obj) + return; + + const Box3F& box = obj->getWorldBox(); + + switch (db->aabb_alignment) + { + case X_POS: + params.pos.x = box.maxExtents.x; + break; + case X_NEG: + params.pos.x = box.minExtents.x; + break; + case Y_POS: + params.pos.y = box.maxExtents.y; + break; + case Y_NEG: + params.pos.y = box.minExtents.y; + break; + case Z_POS: + params.pos.z = box.maxExtents.z; + break; + case Z_NEG: + params.pos.z = box.minExtents.z; + break; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp b/Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp new file mode 100644 index 000000000..d8fccb013 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_BoxHeightOffset.cpp @@ -0,0 +1,145 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// BOX HEIGHT OFFSET + +class afxXM_BoxHeightOffsetData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + Point3F offset; + +public: + /*C*/ afxXM_BoxHeightOffsetData(); + /*C*/ afxXM_BoxHeightOffsetData(const afxXM_BoxHeightOffsetData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + static void initPersistFields(); + +#if defined(AFX_VERSION) + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); +#else + afxXM_Base* create(afxEffectWrapper* fx); +#endif + + DECLARE_CONOBJECT(afxXM_BoxHeightOffsetData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_BoxHeightOffset : public afxXM_Base +{ + typedef afxXM_Base Parent; + Point3F offset; + +public: + /*C*/ afxXM_BoxHeightOffset(afxXM_BoxHeightOffsetData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// BOX HEIGHT OFFSET + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_BoxHeightOffsetData); + +ConsoleDocClass( afxXM_BoxHeightOffsetData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_BoxHeightOffsetData::afxXM_BoxHeightOffsetData() +{ + offset.zero(); +} + +afxXM_BoxHeightOffsetData::afxXM_BoxHeightOffsetData(const afxXM_BoxHeightOffsetData& other, bool temp_clone) + : afxXM_BaseData(other, temp_clone) +{ + offset = other.offset; +} + +void afxXM_BoxHeightOffsetData::initPersistFields() +{ + addField("offset", TypePoint3F, Offset(offset, afxXM_BoxHeightOffsetData)); + + Parent::initPersistFields(); +} + +void afxXM_BoxHeightOffsetData::packData(BitStream* stream) +{ + Parent::packData(stream); + mathWrite(*stream, offset); +} + +void afxXM_BoxHeightOffsetData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + mathRead(*stream, &offset); +} + +#if defined(AFX_VERSION) +afxXM_Base* afxXM_BoxHeightOffsetData::create(afxEffectWrapper* fx, bool on_server) +#else +afxXM_Base* afxXM_BoxHeightOffsetData::create(afxEffectWrapper* fx) +#endif +{ + return new afxXM_BoxHeightOffset(this, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_BoxHeightOffset::afxXM_BoxHeightOffset(afxXM_BoxHeightOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + offset = db->offset; +} + +void afxXM_BoxHeightOffset::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + afxConstraint* pos_cons = fx_wrapper->getPosConstraint(); + SceneObject* scn_obj = (pos_cons) ? pos_cons->getSceneObject() : 0; + + if (scn_obj) + params.pos.z += scn_obj->getWorldBox().maxExtents.z - scn_obj->getWorldBox().minExtents.z; + + params.pos += offset; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_Freeze.cpp b/Engine/source/afx/xm/afxXM_Freeze.cpp new file mode 100644 index 000000000..4476c6090 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_Freeze.cpp @@ -0,0 +1,336 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_FreezeData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + U32 mask; + F32 delay; + +public: + /*C*/ afxXM_FreezeData() : mask(POSITION | ORIENTATION | POSITION2), delay(0.0f) { } + /*C*/ afxXM_FreezeData(const afxXM_FreezeData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_FreezeData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Freeze : public afxXM_Base +{ + typedef afxXM_Base Parent; + + U32 mask; + bool first; + Point3F frozen_pos; + MatrixF frozen_ori; + Point3F frozen_aim; + F32 delay; + +public: + /*C*/ afxXM_Freeze(afxXM_FreezeData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Freeze_all_but_scale : public afxXM_Base +{ + typedef afxXM_Base Parent; + + bool first; + Point3F frozen_pos; + MatrixF frozen_ori; + Point3F frozen_aim; + F32 delay; + +public: + /*C*/ afxXM_Freeze_all_but_scale(afxXM_FreezeData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Freeze_pos : public afxXM_Base +{ + typedef afxXM_Base Parent; + + bool first; + Point3F frozen_pos; + F32 delay; + +public: + /*C*/ afxXM_Freeze_pos(afxXM_FreezeData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Freeze_pos2 : public afxXM_Base +{ + typedef afxXM_Base Parent; + + bool first; + Point3F frozen_pos2; + F32 delay; + +public: + /*C*/ afxXM_Freeze_pos2(afxXM_FreezeData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Freeze_ori : public afxXM_Base +{ + typedef afxXM_Base Parent; + + bool first; + MatrixF frozen_ori; + F32 delay; + +public: + /*C*/ afxXM_Freeze_ori(afxXM_FreezeData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_FreezeData); + +ConsoleDocClass( afxXM_FreezeData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_FreezeData::afxXM_FreezeData(const afxXM_FreezeData& other, bool temp_clone) : afxXM_BaseData(other, temp_clone) +{ + mask = other.mask; + delay = other.delay; +} + +void afxXM_FreezeData::initPersistFields() +{ + addField("mask", TypeS32, Offset(mask, afxXM_FreezeData), + "..."); + addField("delay", TypeF32, Offset(delay, afxXM_FreezeData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_FreezeData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(mask); + stream->write(delay); +} + +void afxXM_FreezeData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&mask); + stream->read(&delay); +} + +afxXM_Base* afxXM_FreezeData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_FreezeData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_FreezeData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->mask == ALL_BUT_SCALE) + return new afxXM_Freeze_all_but_scale(datablock, fx); + if (datablock->mask == POSITION) + return new afxXM_Freeze_pos(datablock, fx); + if (datablock->mask == ORIENTATION) + return new afxXM_Freeze_ori(datablock, fx); + if (datablock->mask == POSITION2) + return new afxXM_Freeze_pos2(datablock, fx); + return new afxXM_Freeze(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Freeze::afxXM_Freeze(afxXM_FreezeData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + mask = db->mask; + first = true; + delay = db->delay; +} + +void afxXM_Freeze::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (elapsed < delay) return; + + if (first) + { + if (mask & POSITION) + frozen_pos = params.pos; + if (mask & ORIENTATION) + frozen_ori = params.ori; + if (mask & POSITION2) + frozen_aim = params.pos2; + first = false; + } + else + { + if (mask & POSITION) + params.pos = frozen_pos; + if (mask & ORIENTATION) + params.ori = frozen_ori; + if (mask & POSITION2) + params.pos2 = frozen_aim; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Freeze_all_but_scale::afxXM_Freeze_all_but_scale(afxXM_FreezeData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + first = true; + delay = db->delay; +} + +void afxXM_Freeze_all_but_scale::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (elapsed < delay) return; + + if (first) + { + frozen_pos = params.pos; + frozen_ori = params.ori; + frozen_aim = params.pos2; + first = false; + } + else + { + params.pos = frozen_pos; + params.ori = frozen_ori; + params.pos2 = frozen_aim; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Freeze_pos::afxXM_Freeze_pos(afxXM_FreezeData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + first = true; + delay = db->delay; +} + +void afxXM_Freeze_pos::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (elapsed < delay) return; + + if (first) + { + frozen_pos = params.pos; + first = false; + } + else + params.pos = frozen_pos; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Freeze_pos2::afxXM_Freeze_pos2(afxXM_FreezeData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + first = true; + delay = db->delay; +} + +void afxXM_Freeze_pos2::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (elapsed < delay) return; + + if (first) + { + frozen_pos2 = params.pos2; + first = false; + } + else + params.pos2 = frozen_pos2; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Freeze_ori::afxXM_Freeze_ori(afxXM_FreezeData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + first = true; + delay = db->delay; +} + +void afxXM_Freeze_ori::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (elapsed < delay) return; + + if (first) + { + frozen_ori = params.ori; + first = false; + } + else + params.ori = frozen_ori; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_GroundConform.cpp b/Engine/source/afx/xm/afxXM_GroundConform.cpp new file mode 100644 index 000000000..f31509b41 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_GroundConform.cpp @@ -0,0 +1,212 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_GroundConformData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + F32 height; + bool do_terrain; + bool do_interiors; + bool do_orientation; + +public: + /*C*/ afxXM_GroundConformData(); + /*C*/ afxXM_GroundConformData(const afxXM_GroundConformData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_GroundConformData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_GroundConform : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_GroundConformData* db; + SceneContainer* container; + +public: + /*C*/ afxXM_GroundConform(afxXM_GroundConformData*, afxEffectWrapper*, bool on_server); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_GroundConformData); + +ConsoleDocClass( afxXM_GroundConformData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_GroundConformData::afxXM_GroundConformData() +{ + height = 0.0f; + do_terrain = true; + do_interiors = true; + do_orientation = false; +} + +afxXM_GroundConformData::afxXM_GroundConformData(const afxXM_GroundConformData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + height = other.height; + do_terrain = other.do_terrain; + do_interiors = other.do_interiors; + do_orientation = other.do_orientation; +} + +void afxXM_GroundConformData::initPersistFields() +{ + addField("height", TypeF32, Offset(height, afxXM_GroundConformData), + "..."); + addField("conformToTerrain", TypeBool, Offset(do_terrain, afxXM_GroundConformData), + "..."); + addField("conformToInteriors", TypeBool, Offset(do_interiors, afxXM_GroundConformData), + "..."); + addField("conformOrientation", TypeBool, Offset(do_orientation, afxXM_GroundConformData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_GroundConformData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(height); + stream->write(do_terrain); + stream->write(do_interiors); + stream->write(do_orientation); +} + +void afxXM_GroundConformData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&height); + stream->read(&do_terrain); + stream->read(&do_interiors); + stream->read(&do_orientation); +} + +afxXM_Base* afxXM_GroundConformData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_GroundConformData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_GroundConformData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_GroundConform(datablock, fx, on_server); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_GroundConform::afxXM_GroundConform(afxXM_GroundConformData* db, afxEffectWrapper* fxw, bool on_server) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; + this->container = (on_server) ? &gServerContainer : &gClientContainer; +} + +void afxXM_GroundConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + RayInfo rInfo; + bool hit = false; + + if (db->do_interiors) + { + U32 mask = InteriorLikeObjectType; + if (db->do_terrain) + { + mask |= TerrainObjectType | TerrainLikeObjectType; + } + + Point3F above_pos(params.pos); above_pos.z += 0.1f; + Point3F below_pos(params.pos); below_pos.z -= 10000; + hit = container->castRay(above_pos, below_pos, mask, &rInfo); + if (!hit) + { + above_pos.z = params.pos.z + 10000; + below_pos.z = params.pos.z - 0.1f; + hit = container->castRay(below_pos, above_pos, mask, &rInfo); + } + } + else if (db->do_terrain) + { + U32 mask = TerrainObjectType | TerrainLikeObjectType; + Point3F above_pos(params.pos); above_pos.z += 10000; + Point3F below_pos(params.pos); below_pos.z -= 10000; + hit = container->castRay(above_pos, below_pos, mask, &rInfo); + } + + if (hit) + { + F32 terrain_z = rInfo.point.z; + F32 wt_factor = calc_weight_factor(elapsed); + F32 old_z = params.pos.z; + F32 new_z = terrain_z + db->height; + params.pos.z = ((1-wt_factor)*old_z) + ((wt_factor)*new_z); + + if (db->do_orientation) + { + Point3F x,y,z; + z = rInfo.normal; + z.normalize(); + params.ori.getColumn(1,&y); + mCross(y,z,&x); + x.normalize(); + mCross(z,x,&y); + params.ori.setColumn(0,x); + params.ori.setColumn(1,y); + params.ori.setColumn(2,z); + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/xm/afxXM_HeightSampler.cpp b/Engine/source/afx/xm/afxXM_HeightSampler.cpp new file mode 100644 index 000000000..2a627bb12 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_HeightSampler.cpp @@ -0,0 +1,146 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_HeightSamplerData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + /*C*/ afxXM_HeightSamplerData(); + /*C*/ afxXM_HeightSamplerData(const afxXM_HeightSamplerData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_HeightSamplerData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxConstraint; + +class afxXM_HeightSampler : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + +public: + /*C*/ afxXM_HeightSampler(afxXM_HeightSamplerData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_HeightSamplerData); + +ConsoleDocClass( afxXM_HeightSamplerData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_HeightSamplerData::afxXM_HeightSamplerData() +{ +} + +afxXM_HeightSamplerData::afxXM_HeightSamplerData(const afxXM_HeightSamplerData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ +} + +void afxXM_HeightSamplerData::initPersistFields() +{ + Parent::initPersistFields(); +} + +void afxXM_HeightSamplerData::packData(BitStream* stream) +{ + Parent::packData(stream); +} + +void afxXM_HeightSamplerData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); +} + +afxXM_Base* afxXM_HeightSamplerData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_HeightSamplerData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_HeightSamplerData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_HeightSampler(datablock, fx); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_HeightSampler::afxXM_HeightSampler(afxXM_HeightSamplerData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ +} + +void afxXM_HeightSampler::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + afxConstraint* pos_cons = fx_wrapper->getPosConstraint(); + if (!pos_cons) + return; + + Point3F base_pos; + pos_cons->getPosition(base_pos); + + F32 range = 0.5f; + F32 height = (base_pos.z > params.pos.z) ? (base_pos.z - params.pos.z) : 0.0f; + F32 factor = mClampF(1.0f - (height/range), 0.0f, 1.0f); + + //Con::printf("SET height=%g liveScaleFactor=%g", height, factor); + fx_wrapper->setField("liveScaleFactor", avar("%g", factor)); + fx_wrapper->setField("liveFadeFactor", avar("%g", factor)); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_MountedImageNode.cpp b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp new file mode 100644 index 000000000..8f54f2d9d --- /dev/null +++ b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp @@ -0,0 +1,231 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_MountedImageNodeData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + StringTableEntry node_name; // name of a mounted-image node + U32 image_slot; // which mounted-image? + // (0 <= image_slot < MaxMountedImages) +public: + /*C*/ afxXM_MountedImageNodeData(); + /*C*/ afxXM_MountedImageNodeData(const afxXM_MountedImageNodeData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_MountedImageNodeData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_MountedImageNode : public afxXM_Base +{ + typedef afxXM_Base Parent; + + StringTableEntry node_name; + U32 image_slot; + S32 node_ID; + ShapeBase* shape; + afxConstraint* cons; + + afxConstraint* find_constraint(); + +public: + /*C*/ afxXM_MountedImageNode(afxXM_MountedImageNodeData*, afxEffectWrapper*); + + virtual void start(F32 timestamp); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_MountedImageNodeData); + +ConsoleDocClass( afxXM_MountedImageNodeData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_MountedImageNodeData::afxXM_MountedImageNodeData() +{ + image_slot = 0; + node_name = ST_NULLSTRING; +} + +afxXM_MountedImageNodeData::afxXM_MountedImageNodeData(const afxXM_MountedImageNodeData& other, bool temp_clone) : afxXM_BaseData(other, temp_clone) +{ + image_slot = other.image_slot; + node_name = other.node_name; +} + +void afxXM_MountedImageNodeData::initPersistFields() +{ + addField("imageSlot", TypeS32, Offset(image_slot, afxXM_MountedImageNodeData), + "..."); + addField("nodeName", TypeString, Offset(node_name, afxXM_MountedImageNodeData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_MountedImageNodeData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(image_slot); + stream->writeString(node_name); +} + +void afxXM_MountedImageNodeData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&image_slot); + node_name = stream->readSTString(); +} + +bool afxXM_MountedImageNodeData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + if (image_slot >= ShapeBase::MaxMountedImages) + { + // datablock will not be added if imageSlot is out-of-bounds + Con::errorf(ConsoleLogEntry::General, + "afxXM_MountedImageNodeData(%s): imageSlot (%u) >= MaxMountedImages (%d)", + getName(), + image_slot, + ShapeBase::MaxMountedImages); + return false; + } + + return true; +} + +afxXM_Base* afxXM_MountedImageNodeData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_MountedImageNodeData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_MountedImageNodeData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_MountedImageNode(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_MountedImageNode::afxXM_MountedImageNode(afxXM_MountedImageNodeData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + image_slot = db->image_slot; + node_name = db->node_name; + cons = 0; + node_ID = -1; + shape = 0; +} + +// find the first constraint with a shape by checking pos +// then orient constraints in that order. +afxConstraint* afxXM_MountedImageNode::find_constraint() +{ + afxConstraint* cons = fx_wrapper->getOrientConstraint(); + if (cons && dynamic_cast(cons->getSceneObject())) + return cons; + + cons = fx_wrapper->getPosConstraint(); + if (cons && dynamic_cast(cons->getSceneObject())) + return cons; + + return 0; +} + +void afxXM_MountedImageNode::start(F32 timestamp) +{ + // constraint won't change over the modifier's + // lifetime so we find it here in start(). + cons = find_constraint(); + if (!cons) + Con::errorf(ConsoleLogEntry::General, + "afxXM_MountedImageNode: failed to find a ShapeBase derived constraint source."); +} + +void afxXM_MountedImageNode::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (!cons) + return; + + // validate shape + // The shape must be validated in case it gets deleted + // of goes out scope. + SceneObject* scene_object = cons->getSceneObject(); + if (scene_object != (SceneObject*)shape) + { + shape = dynamic_cast(scene_object); + if (shape && node_name != ST_NULLSTRING) + { + node_ID = shape->getNodeIndex(image_slot, node_name); + if (node_ID < 0) + { + Con::errorf(ConsoleLogEntry::General, + "afxXM_MountedImageNode: failed to find nodeName, \"%s\".", + node_name); + } + } + else + node_ID = -1; + } + + if (shape) + { + shape->getImageTransform(image_slot, node_ID, ¶ms.ori); + params.pos = params.ori.getPosition(); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_Offset.cpp b/Engine/source/afx/xm/afxXM_Offset.cpp new file mode 100644 index 000000000..d4547c05b --- /dev/null +++ b/Engine/source/afx/xm/afxXM_Offset.cpp @@ -0,0 +1,489 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" +#include "afx/util/afxPath3D.h" +#include "afx/util/afxPath.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// LOCAL OFFSET + +class afxXM_LocalOffsetData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + Point3F local_offset; + bool offset_pos2; + +public: + /*C*/ afxXM_LocalOffsetData(); + /*C*/ afxXM_LocalOffsetData(const afxXM_LocalOffsetData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_LocalOffsetData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_LocalOffset_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + Point3F local_offset; + +public: + /*C*/ afxXM_LocalOffset_weighted(afxXM_LocalOffsetData*, afxEffectWrapper*); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +// this fixed variation is used when +// the weight factors are constant. + +class afxXM_LocalOffset_fixed : public afxXM_Base +{ + typedef afxXM_Base Parent; + + Point3F local_offset; + +public: + /*C*/ afxXM_LocalOffset_fixed(afxXM_LocalOffsetData*, afxEffectWrapper*); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_LocalOffset2_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + Point3F local_offset; + +public: + /*C*/ afxXM_LocalOffset2_weighted(afxXM_LocalOffsetData*, afxEffectWrapper*); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +// this fixed variation is used when +// the weight factors are constant. + +class afxXM_LocalOffset2_fixed : public afxXM_Base +{ + typedef afxXM_Base Parent; + + Point3F local_offset; + +public: + /*C*/ afxXM_LocalOffset2_fixed(afxXM_LocalOffsetData*, afxEffectWrapper*); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WORLD OFFSET + +class afxXM_WorldOffsetData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + Point3F world_offset; + bool offset_pos2; + +public: + /*C*/ afxXM_WorldOffsetData(); + /*C*/ afxXM_WorldOffsetData(const afxXM_WorldOffsetData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_WorldOffsetData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WorldOffset_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + Point3F world_offset; + +public: + /*C*/ afxXM_WorldOffset_weighted(afxXM_WorldOffsetData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +// this fixed variation is used when +// the weight factors are constant. + +class afxXM_WorldOffset_fixed : public afxXM_Base +{ + typedef afxXM_WeightedBase Parent; + Point3F world_offset; + +public: + /*C*/ afxXM_WorldOffset_fixed(afxXM_WorldOffsetData*, afxEffectWrapper*); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WorldOffset2_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + Point3F world_offset; + +public: + /*C*/ afxXM_WorldOffset2_weighted(afxXM_WorldOffsetData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +// this fixed variation is used when +// the weight factors are constant. + +class afxXM_WorldOffset2_fixed : public afxXM_Base +{ + typedef afxXM_WeightedBase Parent; + Point3F world_offset; + +public: + /*C*/ afxXM_WorldOffset2_fixed(afxXM_WorldOffsetData*, afxEffectWrapper*); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// LOCAL OFFSET + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_LocalOffsetData); + +ConsoleDocClass( afxXM_LocalOffsetData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_LocalOffsetData::afxXM_LocalOffsetData() +{ + local_offset.zero(); + offset_pos2 = false; +} + +afxXM_LocalOffsetData::afxXM_LocalOffsetData(const afxXM_LocalOffsetData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + local_offset = other.local_offset; + offset_pos2 = other.offset_pos2; +} + +void afxXM_LocalOffsetData::initPersistFields() +{ + addField("localOffset", TypePoint3F, Offset(local_offset, afxXM_LocalOffsetData), + "..."); + addField("offsetPos2", TypeBool, Offset(offset_pos2, afxXM_LocalOffsetData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_LocalOffsetData::packData(BitStream* stream) +{ + Parent::packData(stream); + mathWrite(*stream, local_offset); + stream->writeFlag(offset_pos2); +} + +void afxXM_LocalOffsetData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + mathRead(*stream, &local_offset); + offset_pos2 = stream->readFlag(); +} + +afxXM_Base* afxXM_LocalOffsetData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_LocalOffsetData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_LocalOffsetData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->offset_pos2) + { + if (datablock->hasFixedWeight()) + return new afxXM_LocalOffset2_fixed(datablock, fx); + else + return new afxXM_LocalOffset2_weighted(datablock, fx); + } + else + { + if (datablock->hasFixedWeight()) + return new afxXM_LocalOffset_fixed(datablock, fx); + else + return new afxXM_LocalOffset_weighted(datablock, fx); + } +} + +//~~~~~~~~~~~~~~~~~~~~// + +afxXM_LocalOffset_weighted::afxXM_LocalOffset_weighted(afxXM_LocalOffsetData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + local_offset = db->local_offset*db->getWeightFactor(); +} + +void afxXM_LocalOffset_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + Point3F offset(local_offset*wt_factor); + params.ori.mulV(offset); + params.pos += offset; +} + +//~~~~~~~~~~~~~~~~~~~~// + +afxXM_LocalOffset_fixed::afxXM_LocalOffset_fixed(afxXM_LocalOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + local_offset = db->local_offset*db->getWeightFactor(); +} + +void afxXM_LocalOffset_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + Point3F offset(local_offset); + params.ori.mulV(offset); + params.pos += offset; +} + +//~~~~~~~~~~~~~~~~~~~~// + +afxXM_LocalOffset2_weighted::afxXM_LocalOffset2_weighted(afxXM_LocalOffsetData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + local_offset = db->local_offset*db->getWeightFactor(); +} + +void afxXM_LocalOffset2_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + Point3F offset(local_offset*wt_factor); + + afxConstraint* pos2_cons = fx_wrapper->getAimConstraint(); + if (pos2_cons) + { + MatrixF ori2; + pos2_cons->getTransform(ori2); + ori2.mulV(offset); + } + + params.pos2 += offset; +} + +//~~~~~~~~~~~~~~~~~~~~// + +afxXM_LocalOffset2_fixed::afxXM_LocalOffset2_fixed(afxXM_LocalOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + local_offset = db->local_offset*db->getWeightFactor(); +} + +void afxXM_LocalOffset2_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + Point3F offset(local_offset); + + afxConstraint* pos2_cons = fx_wrapper->getAimConstraint(); + if (pos2_cons) + { + MatrixF ori2; + pos2_cons->getTransform(ori2); + ori2.mulV(offset); + } + + params.pos2 += offset; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WORLD OFFSET + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WorldOffsetData); + +ConsoleDocClass( afxXM_WorldOffsetData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_WorldOffsetData::afxXM_WorldOffsetData() +{ + world_offset.zero(); + offset_pos2 = false; +} + +afxXM_WorldOffsetData::afxXM_WorldOffsetData(const afxXM_WorldOffsetData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + world_offset = other.world_offset; + offset_pos2 = other.offset_pos2; +} + +void afxXM_WorldOffsetData::initPersistFields() +{ + addField("worldOffset", TypePoint3F, Offset(world_offset, afxXM_WorldOffsetData), + "..."); + addField("offsetPos2", TypeBool, Offset(offset_pos2, afxXM_WorldOffsetData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WorldOffsetData::packData(BitStream* stream) +{ + Parent::packData(stream); + mathWrite(*stream, world_offset); + stream->writeFlag(offset_pos2); +} + +void afxXM_WorldOffsetData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + mathRead(*stream, &world_offset); + offset_pos2 = stream->readFlag(); +} + +afxXM_Base* afxXM_WorldOffsetData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_WorldOffsetData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_WorldOffsetData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->offset_pos2) + { + if (datablock->hasFixedWeight()) + return new afxXM_WorldOffset2_fixed(datablock, fx); + else + return new afxXM_WorldOffset2_weighted(datablock, fx); + } + else + { + if (datablock->hasFixedWeight()) + return new afxXM_WorldOffset_fixed(datablock, fx); + else + return new afxXM_WorldOffset_weighted(datablock, fx); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_WorldOffset_weighted::afxXM_WorldOffset_weighted(afxXM_WorldOffsetData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + world_offset = db->world_offset*db->getWeightFactor(); +} + +void afxXM_WorldOffset_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + params.pos += world_offset*wt_factor; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_WorldOffset_fixed::afxXM_WorldOffset_fixed(afxXM_WorldOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + world_offset = db->world_offset*db->getWeightFactor(); +} + +void afxXM_WorldOffset_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + params.pos += world_offset; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_WorldOffset2_weighted::afxXM_WorldOffset2_weighted(afxXM_WorldOffsetData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + world_offset = db->world_offset*db->getWeightFactor(); +} + +void afxXM_WorldOffset2_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + params.pos2 += world_offset*wt_factor; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_WorldOffset2_fixed::afxXM_WorldOffset2_fixed(afxXM_WorldOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + world_offset = db->world_offset*db->getWeightFactor(); +} + +void afxXM_WorldOffset2_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + params.pos2 += world_offset; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_Oscillate.cpp b/Engine/source/afx/xm/afxXM_Oscillate.cpp new file mode 100644 index 000000000..049d84b12 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_Oscillate.cpp @@ -0,0 +1,379 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_OscillateData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + U32 mask; + Point3F min; + Point3F max; + F32 speed; + Point3F axis; + bool additive_scale; + bool local_offset; + +public: + /*C*/ afxXM_OscillateData(); + /*C*/ afxXM_OscillateData(const afxXM_OscillateData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_OscillateData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_Oscillate_rot : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_OscillateData* db; + +public: + /*C*/ afxXM_Oscillate_rot(afxXM_OscillateData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +class afxXM_Oscillate_scale : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_OscillateData* db; + +public: + /*C*/ afxXM_Oscillate_scale(afxXM_OscillateData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +class afxXM_Oscillate_position : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_OscillateData* db; + +public: + /*C*/ afxXM_Oscillate_position(afxXM_OscillateData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +class afxXM_Oscillate_position2 : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_OscillateData* db; + +public: + /*C*/ afxXM_Oscillate_position2(afxXM_OscillateData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +class afxXM_Oscillate : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_OscillateData* db; + +public: + /*C*/ afxXM_Oscillate(afxXM_OscillateData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_OscillateData); + +ConsoleDocClass( afxXM_OscillateData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_OscillateData::afxXM_OscillateData() +{ + mask = POSITION; + min.set(0,0,0); + max.set(1,1,1); + speed = 1.0f; + axis.set(0,0,1); + additive_scale = false; + local_offset = true; +} + +afxXM_OscillateData::afxXM_OscillateData(const afxXM_OscillateData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + mask = other.mask; + min = other.min; + max = other.max; + speed = other.speed; + axis = other.axis; + additive_scale = other.additive_scale; + local_offset = other.local_offset; +} + +void afxXM_OscillateData::initPersistFields() +{ + addField("mask", TypeS32, Offset(mask, afxXM_OscillateData), + "..."); + addField("min", TypePoint3F, Offset(min, afxXM_OscillateData), + "..."); + addField("max", TypePoint3F, Offset(max, afxXM_OscillateData), + "..."); + addField("speed", TypeF32, Offset(speed, afxXM_OscillateData), + "..."); + addField("axis", TypePoint3F, Offset(axis, afxXM_OscillateData), + "..."); + addField("additiveScale", TypeBool, Offset(additive_scale, afxXM_OscillateData), + "..."); + addField("localOffset", TypeBool, Offset(local_offset, afxXM_OscillateData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_OscillateData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(mask); + mathWrite(*stream, min); + mathWrite(*stream, max); + stream->write(speed); + mathWrite(*stream, axis); + stream->writeFlag(additive_scale); + stream->writeFlag(local_offset); +} + +void afxXM_OscillateData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&mask); + mathRead(*stream, &min); + mathRead(*stream, &max); + stream->read(&speed); + mathRead(*stream, &axis); + additive_scale = stream->readFlag(); + local_offset = stream->readFlag(); +} + +afxXM_Base* afxXM_OscillateData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_OscillateData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_OscillateData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->mask == ORIENTATION) + return new afxXM_Oscillate_rot(datablock, fx); + if (datablock->mask == SCALE) + return new afxXM_Oscillate_scale(datablock, fx); + if (datablock->mask == POSITION) + return new afxXM_Oscillate_position(datablock, fx); + if (datablock->mask == POSITION2) + return new afxXM_Oscillate_position2(datablock, fx); + return new afxXM_Oscillate(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +inline F32 lerp(F32 t, F32 a, F32 b) +{ + return a + t * (b - a); +} + +inline Point3F lerpV(F32 t, const Point3F& a, const Point3F& b) +{ + return Point3F( a.x + t * (b.x - a.x), + a.y + t * (b.y - a.y), + a.z + t * (b.z - a.z) ); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Oscillate_rot::afxXM_Oscillate_rot(afxXM_OscillateData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; +} + +void afxXM_Oscillate_rot::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + + F32 t = mSin(db->speed*elapsed); // [-1,1] + F32 theta = lerp((t+1)/2, db->min.x*wt_factor, db->max.x*wt_factor); + theta = mDegToRad(theta); + + AngAxisF rot_aa(db->axis, theta); + MatrixF rot_xfm; rot_aa.setMatrix(&rot_xfm); + + params.ori.mul(rot_xfm); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Oscillate_scale::afxXM_Oscillate_scale(afxXM_OscillateData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; +} + +void afxXM_Oscillate_scale::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + + F32 t = mSin(db->speed*elapsed); // [-1,1] + F32 s = lerp((t+1)/2, db->min.x*wt_factor, db->max.x*wt_factor); + Point3F xm_scale = db->axis*s; + + if (db->additive_scale) + params.scale += xm_scale; + else + params.scale *= xm_scale; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Oscillate_position::afxXM_Oscillate_position(afxXM_OscillateData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; +} + +void afxXM_Oscillate_position::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + + F32 t = mSin(db->speed*elapsed); // [-1,1] + Point3F offset = lerpV(t, db->min*wt_factor, db->max*wt_factor); + + if (db->local_offset) + { + params.ori.mulV(offset); + params.pos += offset; + } + else + params.pos += offset; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Oscillate_position2::afxXM_Oscillate_position2(afxXM_OscillateData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; +} + +void afxXM_Oscillate_position2::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + + F32 t = mSin(db->speed*elapsed); // [-1,1] + Point3F offset = lerpV(t, db->min*wt_factor, db->max*wt_factor); + + params.pos2 += offset; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Oscillate::afxXM_Oscillate(afxXM_OscillateData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + this->db = db; +} + +void afxXM_Oscillate::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + + F32 t = mSin(db->speed*elapsed); // [-1,1] + + if (db->mask & POSITION) + { + Point3F offset = lerpV(t, db->min*wt_factor, db->max*wt_factor); + if (db->local_offset) + { + params.ori.mulV(offset); + params.pos += offset; + } + else + params.pos += offset; + } + + if (db->mask & POSITION2) + { + Point3F offset = lerpV(t, db->min*wt_factor, db->max*wt_factor); + params.pos2 += offset; + } + + if (db->mask & SCALE) + { + F32 s = lerp((t+1)/2, db->min.x*wt_factor, db->max.x*wt_factor); + Point3F xm_scale = db->axis*s; + if (db->additive_scale) + params.scale += xm_scale; + else + params.scale *= xm_scale; + } + + if (db->mask & ORIENTATION) + { + F32 theta = lerp((t+1)/2, db->min.x*wt_factor, db->max.x*wt_factor); + theta = mDegToRad(theta); + AngAxisF rot_aa(db->axis, theta); + MatrixF rot_xfm; rot_aa.setMatrix(&rot_xfm); + params.ori.mul(rot_xfm); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + diff --git a/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp b/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp new file mode 100644 index 000000000..28fc98eb6 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_OscillateZodiacColor.cpp @@ -0,0 +1,161 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" +#include "afx/afxEffectWrapper.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_OscillateZodiacColorData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + LinearColorF color_a; + LinearColorF color_b; + F32 speed; + +public: + /*C*/ afxXM_OscillateZodiacColorData(); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_OscillateZodiacColorData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_OscillateZodiacColor : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + LinearColorF color_a; + LinearColorF color_b; + F32 speed; + + LinearColorF* liveColor_ptr; + F32* liveColorFactor_ptr; + +public: + /*C*/ afxXM_OscillateZodiacColor(afxXM_OscillateZodiacColorData*, afxEffectWrapper*); + + virtual void update(F32 dt, F32 elapsed, Point3F& pos, MatrixF& ori, Point3F& pos2, + Point3F& scale); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_OscillateZodiacColorData); + +ConsoleDocClass( afxXM_OscillateZodiacColorData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_OscillateZodiacColorData::afxXM_OscillateZodiacColorData() +{ + color_a.set(0.0f, 0.0f, 0.0f, 0.0f); + color_b.set(1.0f, 1.0f, 1.0f, 1.0f); + speed = 1.0f; +} + +void afxXM_OscillateZodiacColorData::initPersistFields() +{ + addField("colorA", TypeColorF, Offset(color_a, afxXM_OscillateZodiacColorData), + "..."); + addField("colorB", TypeColorF, Offset(color_b, afxXM_OscillateZodiacColorData), + "..."); + addField("speed", TypeF32, Offset(speed, afxXM_OscillateZodiacColorData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_OscillateZodiacColorData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(color_a); + stream->write(color_b); + stream->write(speed); +} + +void afxXM_OscillateZodiacColorData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&color_a); + stream->read(&color_b); + stream->read(&speed); +} + +afxXM_Base* afxXM_OscillateZodiacColorData::create(afxEffectWrapper* fx, bool on_server) +{ + return new afxXM_OscillateZodiacColor(this, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_OscillateZodiacColor::afxXM_OscillateZodiacColor(afxXM_OscillateZodiacColorData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + color_a = db->color_a; + color_b = db->color_b; + speed = db->speed; + + const AbstractClassRep::Field* field; + field = fxw->getClassRep()->findField(StringTable->insert("liveColor")); + if (field && field->type == TypeColorF) + liveColor_ptr = (LinearColorF*)(((const char *)(fxw)) + field->offset); + else + liveColor_ptr = 0; + + field = fxw->getClassRep()->findField(StringTable->insert("liveColorFactor")); + if (field && field->type == TypeF32) + liveColorFactor_ptr = (F32*)(((const char *)(fxw)) + field->offset); + else + liveColorFactor_ptr = 0; +} + +void afxXM_OscillateZodiacColor::update(F32 dt, F32 elapsed, Point3F& pos, MatrixF& ori, Point3F& pos2, Point3F& scale) +{ + F32 wt_factor = calc_weight_factor(elapsed); + + if (liveColor_ptr) + { + F32 t = (1.0f + mSin((3.0f*M_PI_F)/2.0f + speed*elapsed*M_2PI_F))*0.5f; + liveColor_ptr->interpolate(color_a, color_b, t); + } + + if (liveColorFactor_ptr) + *liveColorFactor_ptr = wt_factor; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_PathConform.cpp b/Engine/source/afx/xm/afxXM_PathConform.cpp new file mode 100644 index 000000000..af9b7869f --- /dev/null +++ b/Engine/source/afx/xm/afxXM_PathConform.cpp @@ -0,0 +1,412 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" +#include "afx/util/afxPath3D.h" +#include "afx/util/afxPath.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// PATH CONFORM + +class afxPathData; + +class afxXM_PathConformData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + StringTableEntry paths_string; // + Vector pathDataBlocks; // datablocks for paths + Vector pathDataBlockIds; // datablock IDs which correspond to the pathDataBlocks + F32 path_mult; + F32 path_time_offset; + bool orient_to_path; + +public: + /*C*/ afxXM_PathConformData(); + /*C*/ afxXM_PathConformData(const afxXM_PathConformData&, bool = false); + + bool onAdd(); + bool preload(bool server, String &errorStr); + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_PathConformData); + DECLARE_CATEGORY("AFX"); +}; + +class afxPath3D; +class afxAnimCurve; + +class afxXM_PathConform : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxXM_PathConformData* db; + + Vector paths; + Vector path_mults; + Vector path_time_offsets; + Vector rolls; + + void init_paths(F32 lifetime); + +public: + /*C*/ afxXM_PathConform(afxXM_PathConformData*, afxEffectWrapper*); + /*D*/ ~afxXM_PathConform(); + + virtual void start(F32 timestamp); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_PathConformData); + +ConsoleDocClass( afxXM_PathConformData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_PathConformData::afxXM_PathConformData() +{ + paths_string = ST_NULLSTRING; + pathDataBlocks.clear(); + pathDataBlockIds.clear(); + path_mult = 1.0f; + path_time_offset = 0.0f; + orient_to_path = false; +} + +afxXM_PathConformData::afxXM_PathConformData(const afxXM_PathConformData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + paths_string = other.paths_string; + pathDataBlocks = other.pathDataBlocks; + pathDataBlockIds = other.pathDataBlockIds; + path_mult = other.path_mult; + path_time_offset = other.path_time_offset; + orient_to_path = other.orient_to_path; +} + +void afxXM_PathConformData::initPersistFields() +{ + addField("paths", TypeString, Offset(paths_string, afxXM_PathConformData), + "..."); + addField("pathMult", TypeF32, Offset(path_mult, afxXM_PathConformData), + "..."); + addField("pathTimeOffset", TypeF32, Offset(path_time_offset, afxXM_PathConformData), + "..."); + addField("orientToPath", TypeBool, Offset(orient_to_path, afxXM_PathConformData), + "..."); + + Parent::initPersistFields(); + + // disallow some field substitutions + disableFieldSubstitutions("paths"); +} + +void afxXM_PathConformData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(pathDataBlockIds.size()); + for (int i = 0; i < pathDataBlockIds.size(); i++) + stream->write(pathDataBlockIds[i]); + stream->write(path_mult); + stream->write(path_time_offset); + stream->write(orient_to_path); +} + +void afxXM_PathConformData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + U32 n_db; + stream->read(&n_db); + pathDataBlockIds.setSize(n_db); + for (U32 i = 0; i < n_db; i++) + stream->read(&pathDataBlockIds[i]); + stream->read(&path_mult); + stream->read(&path_time_offset); + stream->read(&orient_to_path); +} + +bool afxXM_PathConformData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + if (paths_string != ST_NULLSTRING) + { + //Con::printf("afxEffectWrapperData: Path string found: %s", paths_string); + } + + if (paths_string != ST_NULLSTRING && paths_string[0] == '\0') + { + Con::warnf(ConsoleLogEntry::General, "afxEffectWrapperData(%s) empty paths string, invalid datablock", getName()); + return false; + } + + if (paths_string != ST_NULLSTRING && dStrlen(paths_string) > 255) + { + Con::errorf(ConsoleLogEntry::General, "afxEffectWrapperData(%s) paths string too long [> 255 chars]", getName()); + return false; + } + + if (paths_string != ST_NULLSTRING) + { + Vector dataBlocks(__FILE__, __LINE__); + char* tokCopy = new char[dStrlen(paths_string) + 1]; + dStrcpy(tokCopy, paths_string); + + char* currTok = dStrtok(tokCopy, " \t"); + while (currTok != NULL) + { + dataBlocks.push_back(currTok); + currTok = dStrtok(NULL, " \t"); + } + if (dataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxEffectWrapperData(%s) invalid paths string. No datablocks found", getName()); + delete [] tokCopy; + return false; + } + pathDataBlocks.clear(); + pathDataBlockIds.clear(); + + for (U32 i = 0; i < dataBlocks.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(dataBlocks[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, "afxEffectWrapperData(%s) unable to find path datablock: %s", getName(), dataBlocks[i]); + } + else + { + pathDataBlocks.push_back(pData); + pathDataBlockIds.push_back(pData->getId()); + } + } + delete [] tokCopy; + if (pathDataBlocks.size() == 0) + { + Con::warnf(ConsoleLogEntry::General, "afxEffectWrapperData(%s) unable to find any path datablocks", getName()); + return false; + } + } + + + return true; +} + +bool afxXM_PathConformData::preload(bool server, String &errorStr) +{ + if (!Parent::preload(server, errorStr)) + return false; + + pathDataBlocks.clear(); + for (U32 i = 0; i < pathDataBlockIds.size(); i++) + { + afxPathData* pData = NULL; + if (Sim::findObject(pathDataBlockIds[i], pData) == false) + { + Con::warnf(ConsoleLogEntry::General, + "afxEffectWrapperData(%s) unable to find path datablock: %d", + getName(), pathDataBlockIds[i]); + } + else + pathDataBlocks.push_back(pData); + } + + return true; +} + +afxXM_Base* afxXM_PathConformData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_PathConformData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_PathConformData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_PathConform(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_PathConform::afxXM_PathConform(afxXM_PathConformData* db, afxEffectWrapper* fxw) + : afxXM_WeightedBase(db, fxw) +{ + this->db = db; +} + +afxXM_PathConform::~afxXM_PathConform() +{ + for (S32 i = 0; i < paths.size(); i++) + if (paths[i]) + delete paths[i]; + + for (S32 j = 0; j < paths.size(); j++) + if (rolls[j]) + delete rolls[j]; +} + +void afxXM_PathConform::start(F32 timestamp) +{ + init_paths(fx_wrapper->getFullLifetime()); +} + +void afxXM_PathConform::init_paths(F32 lifetime) +{ + for( U32 i=0; i < db->pathDataBlocks.size(); i++ ) + { + afxPathData* pd = db->pathDataBlocks[i]; + if (!pd) + continue; + + if (pd->getSubstitutionCount() > 0) + { + afxPathData* orig_db = pd; + pd = new afxPathData(*orig_db, true); + orig_db->performSubstitutions(pd, fx_wrapper->getChoreographer(), fx_wrapper->getGroupIndex()); + } + + if (pd->num_points > 0) + { + if (pd->lifetime == 0) + { + if (lifetime <= 0) + { + // Is this possible or is the lifetime always inherited properly??? + } + else + { + pd->lifetime = lifetime; + } + } + + F32 pd_delay = pd->delay*time_factor; + F32 pd_lifetime = pd->lifetime*time_factor; + F32 pd_time_offset = pd->time_offset*time_factor; + + afxPath3D* path = new afxPath3D(); + if (pd->times) + path->buildPath( pd->num_points, pd->points, pd->times, pd_delay, time_factor ); + else + path->buildPath( pd->num_points, pd->points, pd_delay, pd_delay+pd_lifetime ); + + path->setLoopType( pd->loop_type ); + + paths.push_back(path); + // path->print(); + + path_mults.push_back( db->path_mult * pd->mult ); + + path_time_offsets.push_back( db->path_time_offset + pd_time_offset ); + + if (pd->roll_string != ST_NULLSTRING && pd->rolls != NULL) + { + afxAnimCurve* roll_curve = new afxAnimCurve(); + for (U32 j=0; jnum_points; j++ ) + { + roll_curve->addKey( path->getPointTime(j), pd->rolls[j] ); + } + roll_curve->sort(); + // roll_curve->print(); + + rolls.push_back(roll_curve); + } + else + { + rolls.push_back( NULL ); + } + } + else + { + Con::warnf("afxXM_PathConform::init_paths() -- paths datablock (%d) has no points.", i); + } + + if (pd->isTempClone()) + delete pd; + } +} + +void afxXM_PathConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + + // compute path offset + VectorF path_offset(0,0,0); + for( U32 i=0; i < paths.size(); i++ ) + path_offset += path_mults[i]*paths[i]->evaluateAtTime(elapsed + path_time_offsets[i])*wt_factor; + + params.ori.mulV(path_offset); + params.pos += path_offset; + + if (db->orient_to_path && paths.size()) + { + VectorF path_v = paths[0]->evaluateTangentAtTime(elapsed+path_time_offsets[0]); + path_v.normalize(); + + MatrixF mat(true); + + if( rolls[0] ) + { + F32 roll_angle = rolls[0]->evaluate(elapsed+path_time_offsets[0]); + roll_angle = mDegToRad( roll_angle ); + //Con::printf( "roll: %f", roll_angle ); + + Point3F roll_axis = path_v; + AngAxisF rollRot(roll_axis, roll_angle); + MatrixF roll_mat(true); + rollRot.setMatrix(&roll_mat); + + mat.mul(roll_mat); + } + + mat.mul(MathUtils::createOrientFromDir(path_v)); + params.ori.mul(mat); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp b/Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp new file mode 100644 index 000000000..9d1c73270 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_PivotNodeOffset.cpp @@ -0,0 +1,180 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "ts/tsShapeInstance.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_PivotNodeOffsetData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + StringTableEntry node_name; + bool node_is_static; + +public: + /*C*/ afxXM_PivotNodeOffsetData(); + /*C*/ afxXM_PivotNodeOffsetData(const afxXM_PivotNodeOffsetData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_PivotNodeOffsetData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_PivotNodeOffset : public afxXM_Base +{ + typedef afxXM_Base Parent; + + StringTableEntry node_name; + bool node_is_static; + S32 node_ID; + Point3F pivot_offset; + bool offset_calculated; + +public: + /*C*/ afxXM_PivotNodeOffset(afxXM_PivotNodeOffsetData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_PivotNodeOffsetData); + +ConsoleDocClass( afxXM_PivotNodeOffsetData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_PivotNodeOffsetData::afxXM_PivotNodeOffsetData() +{ + node_name = ST_NULLSTRING; + node_is_static = true; +} + +afxXM_PivotNodeOffsetData::afxXM_PivotNodeOffsetData(const afxXM_PivotNodeOffsetData& other, bool temp_clone) : afxXM_BaseData(other, temp_clone) +{ + node_name = other.node_name; + node_is_static = other.node_is_static; +} + +void afxXM_PivotNodeOffsetData::initPersistFields() +{ + addField("nodeName", TypeString, Offset(node_name, afxXM_PivotNodeOffsetData), + "..."); + addField("nodeIsStatic", TypeBool, Offset(node_is_static, afxXM_PivotNodeOffsetData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_PivotNodeOffsetData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->writeString(node_name); + stream->writeFlag(node_is_static); +} + +void afxXM_PivotNodeOffsetData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + node_name = stream->readSTString(); + node_is_static = stream->readFlag(); +} + +afxXM_Base* afxXM_PivotNodeOffsetData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_PivotNodeOffsetData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_PivotNodeOffsetData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_PivotNodeOffset(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_PivotNodeOffset::afxXM_PivotNodeOffset(afxXM_PivotNodeOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + node_name = db->node_name; + node_is_static = db->node_is_static; + node_ID = -1; + pivot_offset.set(0,0,0); + offset_calculated = false; +} + +void afxXM_PivotNodeOffset::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (node_ID < 0) + { + TSShape* ts_shape = fx_wrapper->getTSShape(); + node_ID = (ts_shape) ? ts_shape->findNode(node_name) : -1; + } + + if (node_ID >= 0) + { + if (!node_is_static || !offset_calculated) + { + TSShapeInstance* ts_shape_inst = fx_wrapper->getTSShapeInstance(); + if (ts_shape_inst) + { + const MatrixF& pivot_xfm = ts_shape_inst->mNodeTransforms[node_ID]; + pivot_offset = -pivot_xfm.getPosition(); + offset_calculated = true; + } + } + } + + // re-orient pivot offset then add to position + Point3F pivot_offset_temp; + params.ori.mulV(pivot_offset, &pivot_offset_temp); + params.pos += pivot_offset_temp; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_RandomRot.cpp b/Engine/source/afx/xm/afxXM_RandomRot.cpp new file mode 100644 index 000000000..f7534a214 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_RandomRot.cpp @@ -0,0 +1,181 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_RandomRotData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + Point3F axis; + F32 theta_min; + F32 theta_max; + F32 phi_min; + F32 phi_max; + +public: + /*C*/ afxXM_RandomRotData(); + /*C*/ afxXM_RandomRotData(const afxXM_RandomRotData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_RandomRotData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_RandomRot : public afxXM_Base +{ + typedef afxXM_Base Parent; + + MatrixF rand_ori; + +public: + /*C*/ afxXM_RandomRot(afxXM_RandomRotData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_RandomRotData); + +ConsoleDocClass( afxXM_RandomRotData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_RandomRotData::afxXM_RandomRotData() +{ + axis.set(0,0,1); + theta_min = 0.0f; + theta_max = 360.0f; + phi_min = 0.0f; + phi_max = 360.0f; +} + +afxXM_RandomRotData::afxXM_RandomRotData(const afxXM_RandomRotData& other, bool temp_clone) : afxXM_BaseData(other, temp_clone) +{ + axis = other.axis; + theta_min = other.theta_min; + theta_max = other.theta_max; + phi_min = other.phi_min; + phi_max = other.phi_max; +} + +void afxXM_RandomRotData::initPersistFields() +{ + addField("axis", TypePoint3F, Offset(axis, afxXM_RandomRotData), + "..."); + addField("thetaMin", TypeF32, Offset(theta_min, afxXM_RandomRotData), + "..."); + addField("thetaMax", TypeF32, Offset(theta_max, afxXM_RandomRotData), + "..."); + addField("phiMin", TypeF32, Offset(phi_min, afxXM_RandomRotData), + "..."); + addField("phiMax", TypeF32, Offset(phi_max, afxXM_RandomRotData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_RandomRotData::packData(BitStream* stream) +{ + Parent::packData(stream); + mathWrite(*stream, axis); + stream->write(theta_min); + stream->write(theta_max); + stream->write(phi_min); + stream->write(phi_max); +} + +void afxXM_RandomRotData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + mathRead(*stream, &axis); + stream->read(&theta_min); + stream->read(&theta_max); + stream->read(&phi_min); + stream->read(&phi_max); +} + +bool afxXM_RandomRotData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + axis.normalizeSafe(); + + return true; +} + +afxXM_Base* afxXM_RandomRotData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_RandomRotData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_RandomRotData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_RandomRot(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_RandomRot::afxXM_RandomRot(afxXM_RandomRotData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + Point3F rand_dir = MathUtils::randomDir(db->axis, db->theta_min, db->theta_max, db->phi_min, db->phi_max); + rand_ori = MathUtils::createOrientFromDir(rand_dir); +} + +void afxXM_RandomRot::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + params.ori = rand_ori; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_Scale.cpp b/Engine/source/afx/xm/afxXM_Scale.cpp new file mode 100644 index 000000000..109051087 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_Scale.cpp @@ -0,0 +1,155 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" +#include "afx/util/afxPath3D.h" +#include "afx/util/afxPath.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_ScaleData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + Point3F scale; + +public: + /*C*/ afxXM_ScaleData(); + /*C*/ afxXM_ScaleData(const afxXM_ScaleData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_ScaleData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Scale_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + Point3F xm_scale; + +public: + /*C*/ afxXM_Scale_weighted(afxXM_ScaleData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_ScaleData); + +ConsoleDocClass( afxXM_ScaleData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_ScaleData::afxXM_ScaleData() +{ + scale.set(0,0,0); +} + +afxXM_ScaleData::afxXM_ScaleData(const afxXM_ScaleData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + scale = other.scale; +} + +void afxXM_ScaleData::initPersistFields() +{ + addField("scale", TypePoint3F, Offset(scale, afxXM_ScaleData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_ScaleData::packData(BitStream* stream) +{ + Parent::packData(stream); + mathWrite(*stream, scale); +} + +void afxXM_ScaleData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + mathRead(*stream, &scale); +} + +afxXM_Base* afxXM_ScaleData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_ScaleData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_ScaleData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->hasFixedWeight()) + return new afxXM_Scale_weighted(datablock, fx); + else + return new afxXM_Scale_weighted(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Scale_weighted::afxXM_Scale_weighted(afxXM_ScaleData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + xm_scale = db->scale; +} + +void afxXM_Scale_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + params.scale += xm_scale*wt_factor; + if (params.scale.x < 0.00001f) + params.scale.x = 0.00001f; + if (params.scale.y < 0.00001f) + params.scale.y = 0.00001f; + if (params.scale.z < 0.00001f) + params.scale.z = 0.00001f; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_Shockwave.cpp b/Engine/source/afx/xm/afxXM_Shockwave.cpp new file mode 100644 index 000000000..47c6e5eb2 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_Shockwave.cpp @@ -0,0 +1,170 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" +#include "afx/util/afxPath3D.h" +#include "afx/util/afxPath.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_ShockwaveData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + F32 rate; + bool aim_z_only; + +public: + /*C*/ afxXM_ShockwaveData(); + /*C*/ afxXM_ShockwaveData(const afxXM_ShockwaveData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_ShockwaveData); + DECLARE_CATEGORY("AFX"); +}; + +class afxConstraint; + +class afxXM_Shockwave : public afxXM_Base +{ + typedef afxXM_Base Parent; + + afxXM_ShockwaveData* db; + bool first; + Point3F fixed_pos; + +public: + /*C*/ afxXM_Shockwave(afxXM_ShockwaveData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_ShockwaveData); + +ConsoleDocClass( afxXM_ShockwaveData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_ShockwaveData::afxXM_ShockwaveData() +{ + rate = 1.0f; + aim_z_only = false; +} + +afxXM_ShockwaveData::afxXM_ShockwaveData(const afxXM_ShockwaveData& other, bool temp_clone) : afxXM_BaseData(other, temp_clone) +{ + rate = other.rate; + aim_z_only = other.aim_z_only; +} + +void afxXM_ShockwaveData::initPersistFields() +{ + addField("rate", TypeF32, Offset(rate, afxXM_ShockwaveData), + "..."); + addField("aimZOnly", TypeBool, Offset(aim_z_only, afxXM_ShockwaveData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_ShockwaveData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(rate); + stream->write(aim_z_only); +} + +void afxXM_ShockwaveData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&rate); + stream->read(&aim_z_only); +} + +afxXM_Base* afxXM_ShockwaveData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_ShockwaveData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_ShockwaveData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + return new afxXM_Shockwave(datablock, fx); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Shockwave::afxXM_Shockwave(afxXM_ShockwaveData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + this->db = db; + first = true; + fixed_pos.zero(); +} + +void afxXM_Shockwave::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (first) + { + fixed_pos = params.pos; + first = false; + } + + Point3F aim_at_pos = params.pos2; + if (db->aim_z_only) + aim_at_pos.z = fixed_pos.z; + + VectorF line_of_sight = aim_at_pos - fixed_pos; + line_of_sight.normalize(); + + params.pos = fixed_pos + line_of_sight*(elapsed*db->rate); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_Spin.cpp b/Engine/source/afx/xm/afxXM_Spin.cpp new file mode 100644 index 000000000..753835c1a --- /dev/null +++ b/Engine/source/afx/xm/afxXM_Spin.cpp @@ -0,0 +1,241 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" +#include "afx/util/afxPath3D.h" +#include "afx/util/afxPath.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_SpinData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + Point3F spin_axis; + F32 spin_angle; + F32 spin_angle_var; + F32 spin_rate; + F32 spin_rate_var; + +public: + /*C*/ afxXM_SpinData() : spin_axis(0,0,1), spin_angle(0), spin_angle_var(0), spin_rate(0), spin_rate_var(0) { } + /*C*/ afxXM_SpinData(const afxXM_SpinData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + bool onAdd(); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_SpinData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Spin_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + Point3F spin_axis; + F32 spin_rate; + F32 theta; + +public: + /*C*/ afxXM_Spin_weighted(afxXM_SpinData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_Spin_fixed : public afxXM_Base +{ + typedef afxXM_Base Parent; + + Point3F spin_axis; + F32 spin_rate; + F32 theta; + +public: + /*C*/ afxXM_Spin_fixed(afxXM_SpinData*, afxEffectWrapper*); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_SpinData); + +ConsoleDocClass( afxXM_SpinData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_SpinData::afxXM_SpinData(const afxXM_SpinData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + spin_axis = other.spin_axis; + spin_angle = other.spin_angle; + spin_angle_var = other.spin_angle_var; + spin_rate = other.spin_rate; + spin_rate_var = other.spin_rate_var; +} + +void afxXM_SpinData::initPersistFields() +{ + addField("spinAxis", TypePoint3F, Offset(spin_axis, afxXM_SpinData), + "..."); + addField("spinAngle", TypeF32, Offset(spin_angle, afxXM_SpinData), + "..."); + addField("spinAngleVariance", TypeF32, Offset(spin_angle_var, afxXM_SpinData), + "..."); + addField("spinRate", TypeF32, Offset(spin_rate, afxXM_SpinData), + "..."); + addField("spinRateVariance", TypeF32, Offset(spin_rate_var, afxXM_SpinData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_SpinData::packData(BitStream* stream) +{ + Parent::packData(stream); + mathWrite(*stream, spin_axis); + stream->write(spin_angle); + stream->write(spin_angle_var); + stream->write(spin_rate); + stream->write(spin_rate_var); +} + +void afxXM_SpinData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + mathRead(*stream, &spin_axis); + stream->read(&spin_angle); + stream->read(&spin_angle_var); + stream->read(&spin_rate); + stream->read(&spin_rate_var); +} + +bool afxXM_SpinData::onAdd() +{ + if (Parent::onAdd() == false) + return false; + + spin_axis.normalizeSafe(); + + return true; +} + +afxXM_Base* afxXM_SpinData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_SpinData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_SpinData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->hasFixedWeight()) + return new afxXM_Spin_fixed(datablock, fx); + else + return new afxXM_Spin_weighted(datablock, fx); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Spin_weighted::afxXM_Spin_weighted(afxXM_SpinData* db, afxEffectWrapper* fxw) + : afxXM_WeightedBase(db, fxw) +{ + spin_axis = db->spin_axis; + + spin_rate = db->spin_rate; + if (db->spin_rate_var != 0.0f) + spin_rate += gRandGen.randF()*2.0f*db->spin_rate_var - db->spin_rate_var; + spin_rate *= db->getWeightFactor()/time_factor; + + F32 spin_angle = db->spin_angle; + if (db->spin_angle_var != 0.0f) + spin_angle += gRandGen.randF()*2.0f*db->spin_angle_var - db->spin_angle_var; + theta = mDegToRad(spin_angle); +} + +void afxXM_Spin_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + F32 wt_factor = calc_weight_factor(elapsed); + F32 rate = spin_rate*wt_factor; + theta += mDegToRad(dt*rate); + + AngAxisF spin_aa(spin_axis, theta); + MatrixF spin_xfm; spin_aa.setMatrix(&spin_xfm); + + params.ori.mul(spin_xfm); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Spin_fixed::afxXM_Spin_fixed(afxXM_SpinData* db, afxEffectWrapper* fxw) + : afxXM_Base(db, fxw) +{ + spin_axis = db->spin_axis; + + spin_rate = db->spin_rate; + if (db->spin_rate_var != 0.0f) + spin_rate += gRandGen.randF()*2.0f*db->spin_rate_var - db->spin_rate_var; + spin_rate *= db->getWeightFactor()/time_factor; + + F32 spin_angle = db->spin_angle; + if (db->spin_angle_var != 0.0f) + spin_angle += gRandGen.randF()*2.0f*db->spin_angle_var - db->spin_angle_var; + theta = mDegToRad(spin_angle); +} + +void afxXM_Spin_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + theta += mDegToRad(dt*spin_rate); + + AngAxisF spin_aa(spin_axis, theta); + MatrixF spin_xfm; spin_aa.setMatrix(&spin_xfm); + + params.ori.mul(spin_xfm); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_VelocityOffset.cpp b/Engine/source/afx/xm/afxXM_VelocityOffset.cpp new file mode 100644 index 000000000..38fce9e7d --- /dev/null +++ b/Engine/source/afx/xm/afxXM_VelocityOffset.cpp @@ -0,0 +1,373 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" +#include "math/mathUtils.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXfmMod.h" +#include "afx/util/afxPath3D.h" +#include "afx/util/afxPath.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// VELOCITY OFFSET + +class afxXM_VelocityOffsetData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + F32 offset_factor; + bool offset_pos2; + bool normalize; + +public: + /*C*/ afxXM_VelocityOffsetData(); + /*C*/ afxXM_VelocityOffsetData(const afxXM_VelocityOffsetData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_VelocityOffsetData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_VelocityOffset_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxConstraint* cons; + F32 offset_factor; + bool normalize; + +public: + /*C*/ afxXM_VelocityOffset_weighted(afxXM_VelocityOffsetData*, afxEffectWrapper*); + + virtual void start(F32 timestamp); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +// this fixed variation is used when +// the weight factors are constant. + +class afxXM_VelocityOffset_fixed : public afxXM_Base +{ + typedef afxXM_Base Parent; + + afxConstraint* cons; + F32 offset_factor; + bool normalize; + +public: + /*C*/ afxXM_VelocityOffset_fixed(afxXM_VelocityOffsetData*, afxEffectWrapper*); + + virtual void start(F32 timestamp); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_VelocityOffset2_weighted : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + + afxConstraint* cons; + F32 offset_factor; + bool normalize; + +public: + /*C*/ afxXM_VelocityOffset2_weighted(afxXM_VelocityOffsetData*, afxEffectWrapper*); + + virtual void start(F32 timestamp); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +// this fixed variation is used when +// the weight factors are constant. + +class afxXM_VelocityOffset2_fixed : public afxXM_Base +{ + typedef afxXM_Base Parent; + + afxConstraint* cons; + F32 offset_factor; + bool normalize; + +public: + /*C*/ afxXM_VelocityOffset2_fixed(afxXM_VelocityOffsetData*, afxEffectWrapper*); + + virtual void start(F32 timestamp); + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// VELOCITY OFFSET + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_VelocityOffsetData); + +ConsoleDocClass( afxXM_VelocityOffsetData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_VelocityOffsetData::afxXM_VelocityOffsetData() +{ + offset_factor = 1.0f; + offset_pos2 = false; + normalize = false; +} + +afxXM_VelocityOffsetData::afxXM_VelocityOffsetData(const afxXM_VelocityOffsetData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + offset_factor = other.offset_factor; + offset_pos2 = other.offset_pos2; + normalize = other.normalize; +} + +void afxXM_VelocityOffsetData::initPersistFields() +{ + addField("offsetFactor", TypeF32, Offset(offset_factor, afxXM_VelocityOffsetData), + "..."); + addField("offsetPos2", TypeBool, Offset(offset_pos2, afxXM_VelocityOffsetData), + "..."); + addField("normalize", TypeBool, Offset(normalize, afxXM_VelocityOffsetData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_VelocityOffsetData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(offset_factor); + stream->write(offset_pos2); +} + +void afxXM_VelocityOffsetData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&offset_factor); + stream->read(&offset_pos2); +} + +afxXM_Base* afxXM_VelocityOffsetData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_VelocityOffsetData* datablock = this; + + if (getSubstitutionCount() > 0) + { + datablock = new afxXM_VelocityOffsetData(*this, true); + this->performSubstitutions(datablock, fx->getChoreographer(), fx->getGroupIndex()); + } + + if (datablock->offset_pos2) + { + if (datablock->hasFixedWeight()) + return new afxXM_VelocityOffset2_fixed(datablock, fx); + else + return new afxXM_VelocityOffset2_weighted(datablock, fx); + } + else + { + if (datablock->hasFixedWeight()) + return new afxXM_VelocityOffset_fixed(datablock, fx); + else + return new afxXM_VelocityOffset_weighted(datablock, fx); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_VelocityOffset_weighted::afxXM_VelocityOffset_weighted(afxXM_VelocityOffsetData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + cons = 0; + offset_factor = db->offset_factor*db->getWeightFactor(); + normalize = db->normalize; +} + +void afxXM_VelocityOffset_weighted::start(F32 timestamp) +{ + Parent::start(timestamp); + + cons = fx_wrapper->getPosConstraint(); + if (!cons) + Con::errorf(ConsoleLogEntry::General, + "afxXM_VelocityOffset: failed to find a SceneObject derived constraint source."); +} + +void afxXM_VelocityOffset_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (!cons) + return; + + SceneObject* scene_obj = cons->getSceneObject(); + if (scene_obj) + { + Point3F vel_vec = scene_obj->getVelocity(); + if (!vel_vec.isZero()) + { + if (normalize) + vel_vec.normalize(); + F32 wt_factor = calc_weight_factor(elapsed); + params.pos += vel_vec*offset_factor*wt_factor; + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_VelocityOffset_fixed::afxXM_VelocityOffset_fixed(afxXM_VelocityOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + cons = 0; + offset_factor = db->offset_factor*db->getWeightFactor(); + normalize = db->normalize; +} + +void afxXM_VelocityOffset_fixed::start(F32 timestamp) +{ + Parent::start(timestamp); + + cons = fx_wrapper->getPosConstraint(); + if (!cons) + Con::errorf(ConsoleLogEntry::General, + "afxXM_VelocityOffset: failed to find a SceneObject derived constraint source."); +} + +void afxXM_VelocityOffset_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (!cons) + return; + + SceneObject* scene_obj = cons->getSceneObject(); + if (scene_obj) + { + Point3F vel_vec = scene_obj->getVelocity(); + if (!vel_vec.isZero()) + { + if (normalize) + vel_vec.normalize(offset_factor); + params.pos += vel_vec*offset_factor; + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_VelocityOffset2_weighted::afxXM_VelocityOffset2_weighted(afxXM_VelocityOffsetData* db, afxEffectWrapper* fxw) +: afxXM_WeightedBase(db, fxw) +{ + cons = 0; + offset_factor = db->offset_factor*db->getWeightFactor(); + normalize = db->normalize; +} + +void afxXM_VelocityOffset2_weighted::start(F32 timestamp) +{ + Parent::start(timestamp); + + cons = fx_wrapper->getAimConstraint(); + if (!cons) + Con::errorf(ConsoleLogEntry::General, + "afxXM_VelocityOffset: failed to find a SceneObject derived constraint source."); +} + +void afxXM_VelocityOffset2_weighted::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (!cons) + return; + + SceneObject* scene_obj = cons->getSceneObject(); + if (scene_obj) + { + Point3F vel_vec = scene_obj->getVelocity(); + if (!vel_vec.isZero()) + { + if (normalize) + vel_vec.normalize(); + F32 wt_factor = calc_weight_factor(elapsed); + params.pos2 += vel_vec*offset_factor*wt_factor; + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_VelocityOffset2_fixed::afxXM_VelocityOffset2_fixed(afxXM_VelocityOffsetData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + cons = 0; + offset_factor = db->offset_factor*db->getWeightFactor(); + normalize = db->normalize; +} + +void afxXM_VelocityOffset2_fixed::start(F32 timestamp) +{ + Parent::start(timestamp); + + cons = fx_wrapper->getAimConstraint(); + if (!cons) + Con::errorf(ConsoleLogEntry::General, + "afxXM_VelocityOffset: failed to find a SceneObject derived constraint source."); +} + +void afxXM_VelocityOffset2_fixed::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (!cons) + return; + + SceneObject* scene_obj = cons->getSceneObject(); + if (scene_obj) + { + Point3F vel_vec = scene_obj->getVelocity(); + if (!vel_vec.isZero()) + { + if (normalize) + vel_vec.normalize(offset_factor); + params.pos2 += vel_vec*offset_factor; + } + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_WaveBase.cpp b/Engine/source/afx/xm/afxXM_WaveBase.cpp new file mode 100644 index 000000000..514daf641 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_WaveBase.cpp @@ -0,0 +1,610 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "math/mathIO.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXM_WaveBase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WaveBaseData); + +ConsoleDocClass( afxXM_WaveBaseData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_WaveBaseData::afxXM_WaveBaseData() +{ + waveform_type = WAVEFORM_SINE; + parameter = PARAM_NONE; + op = OP_ADD; + speed = 1.0f; + speed_vari = 0.0; + accel = 0.0f; + phase_shift = 0.0f; + duty_cycle = 1.0f; + duty_shift = 0.0f; + off_duty_t = 0.0f; + + waves_per_pulse.set(1,1); + waves_per_rest.set(0,0); + rest_dur = 0.0f; + rest_dur_vari = 0.0f; + + axis.zero(); + local_axis = true; +} + +afxXM_WaveBaseData::afxXM_WaveBaseData(const afxXM_WaveBaseData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + waveform_type = other.waveform_type; + parameter = other.parameter; + op = other.op; + speed = other.speed; + speed_vari = other.speed; + accel = other.accel; + phase_shift = other.phase_shift; + duty_cycle = other.duty_cycle; + duty_shift = other.duty_shift; + off_duty_t = other.off_duty_t; + + waves_per_pulse = other.waves_per_pulse; + waves_per_rest = other.waves_per_rest; + rest_dur = other.rest_dur; + rest_dur_vari = other.rest_dur_vari; + + axis = other.axis; + local_axis = true; +} + +ImplementEnumType( afxXM_WaveFormType, "Possible waveform types.\n" "@ingroup afxXM_WaveBase\n\n" ) + { afxXM_WaveBaseData::WAVEFORM_NONE, "none", "..." }, + { afxXM_WaveBaseData::WAVEFORM_SINE, "sine", "..." }, + { afxXM_WaveBaseData::WAVEFORM_SQUARE, "square", "..." }, + { afxXM_WaveBaseData::WAVEFORM_TRIANGLE, "triangle", "..." }, + { afxXM_WaveBaseData::WAVEFORM_SAWTOOTH, "sawtooth", "..." }, + { afxXM_WaveBaseData::WAVEFORM_NOISE, "noise", "..." }, + { afxXM_WaveBaseData::WAVEFORM_ONE, "one", "..." }, +EndImplementEnumType; + +ImplementEnumType( afxXM_WaveParamType, "Possible wave parameter types.\n" "@ingroup afxXM_WaveBase\n\n" ) + { afxXM_WaveBaseData::PARAM_NONE, "none", "..." }, + { afxXM_WaveBaseData::PARAM_POS, "pos", "..." }, + { afxXM_WaveBaseData::PARAM_POS_X, "pos.x", "..." }, + { afxXM_WaveBaseData::PARAM_POS_Y, "pos.y", "..." }, + { afxXM_WaveBaseData::PARAM_POS_Z, "pos.z", "..." }, + { afxXM_WaveBaseData::PARAM_ORI, "ori", "..." }, + { afxXM_WaveBaseData::PARAM_POS2, "pos2", "..." }, + { afxXM_WaveBaseData::PARAM_POS2_X, "pos2.x", "..." }, + { afxXM_WaveBaseData::PARAM_POS2_Y, "pos2.y", "..." }, + { afxXM_WaveBaseData::PARAM_POS2_Z, "pos2.z", "..." }, + { afxXM_WaveBaseData::PARAM_SCALE, "scale", "..." }, + { afxXM_WaveBaseData::PARAM_SCALE_X, "scale.x", "..." }, + { afxXM_WaveBaseData::PARAM_SCALE_Y, "scale.y", "..." }, + { afxXM_WaveBaseData::PARAM_SCALE_Z, "scale.z", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR, "color", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_R, "color.red", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_G, "color.green", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_B, "color.blue", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_A, "color.alpha", "..." }, + { afxXM_WaveBaseData::PARAM_VIS, "vis", "..." }, + { afxXM_WaveBaseData::PARAM_POS, "position", "..." }, + { afxXM_WaveBaseData::PARAM_POS_X, "position.x", "..." }, + { afxXM_WaveBaseData::PARAM_POS_Y, "position.y", "..." }, + { afxXM_WaveBaseData::PARAM_POS_Z, "position.z", "..." }, + { afxXM_WaveBaseData::PARAM_ORI, "orientation", "..." }, + { afxXM_WaveBaseData::PARAM_POS2, "position2", "..." }, + { afxXM_WaveBaseData::PARAM_POS2_X, "position2.x", "..." }, + { afxXM_WaveBaseData::PARAM_POS2_Y, "position2.y", "..." }, + { afxXM_WaveBaseData::PARAM_POS2_Z, "position2.z", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_R, "color.r", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_G, "color.g", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_B, "color.b", "..." }, + { afxXM_WaveBaseData::PARAM_COLOR_A, "color.a", "..." }, + { afxXM_WaveBaseData::PARAM_VIS, "visibility", "..." }, +EndImplementEnumType; + +ImplementEnumType( afxXM_WaveOpType, "Possible wave operation types.\n" "@ingroup afxXM_WaveBase\n\n" ) + { afxXM_WaveBaseData::OP_ADD, "add", "..." }, + { afxXM_WaveBaseData::OP_MULTIPLY, "multiply", "..." }, + { afxXM_WaveBaseData::OP_REPLACE, "replace", "..." }, + { afxXM_WaveBaseData::OP_MULTIPLY, "mult", "..." }, +EndImplementEnumType; + +void afxXM_WaveBaseData::initPersistFields() +{ + addField("waveform", TYPEID< afxXM_WaveBaseData::WaveFormType >(), Offset(waveform_type, afxXM_WaveBaseData), + "..."); + addField("parameter", TYPEID< afxXM_WaveBaseData::WaveParamType >(), Offset(parameter, afxXM_WaveBaseData), + "..."); + addField("op", TYPEID< afxXM_WaveBaseData::WaveOpType >(), Offset(op, afxXM_WaveBaseData), + "..."); + + addField("speed", TypeF32, Offset(speed, afxXM_WaveBaseData), + "waves per second"); + addField("speedVariance", TypeF32, Offset(speed_vari, afxXM_WaveBaseData), + "..."); + addField("acceleration", TypeF32, Offset(accel, afxXM_WaveBaseData), + "..."); + addField("phaseShift", TypeF32, Offset(phase_shift, afxXM_WaveBaseData), + "..."); + addField("dutyCycle", TypeF32, Offset(duty_cycle, afxXM_WaveBaseData), + "..."); + addField("dutyShift", TypeF32, Offset(duty_shift, afxXM_WaveBaseData), + "..."); + addField("offDutyT", TypeF32, Offset(off_duty_t, afxXM_WaveBaseData), + "..."); + + addField("wavesPerPulse", TypeByteRange2, Offset(waves_per_pulse, afxXM_WaveBaseData), + "..."); + addField("wavesPerRest", TypeByteRange2, Offset(waves_per_rest, afxXM_WaveBaseData), + "..."); + addField("restDuration", TypeF32, Offset(rest_dur, afxXM_WaveBaseData), + "..."); + addField("restDurationVariance", TypeF32, Offset(rest_dur_vari, afxXM_WaveBaseData), + "..."); + + addField("axis", TypePoint3F, Offset(axis, afxXM_WaveBaseData), + "..."); + addField("axisIsLocal", TypeBool, Offset(local_axis, afxXM_WaveBaseData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WaveBaseData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeInt(waveform_type, WAVEFORM_BITS); + stream->writeInt(parameter, PARAM_BITS); + stream->writeInt(op, OP_BITS); + stream->write(speed); + stream->write(speed_vari); + stream->write(accel); + stream->write(phase_shift); + stream->write(duty_cycle); + stream->write(duty_shift); + stream->write(off_duty_t); + + stream->write(waves_per_pulse.low); + stream->write(waves_per_pulse.high); + stream->write(waves_per_rest.low); + stream->write(waves_per_rest.high); + + stream->write(rest_dur); + stream->write(rest_dur_vari); + + mathWrite(*stream, axis); + stream->writeFlag(local_axis); +} + +void afxXM_WaveBaseData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + waveform_type = stream->readInt(WAVEFORM_BITS); + parameter = stream->readInt(PARAM_BITS); + op = stream->readInt(OP_BITS); + stream->read(&speed); + stream->read(&speed_vari); + stream->read(&accel); + stream->read(&phase_shift); + stream->read(&duty_cycle); + stream->read(&duty_shift); + stream->read(&off_duty_t); + + stream->read(&waves_per_pulse.low); + stream->read(&waves_per_pulse.high); + stream->read(&waves_per_rest.low); + stream->read(&waves_per_rest.high); + + stream->read(&rest_dur); + stream->read(&rest_dur_vari); + + mathRead(*stream, &axis); + local_axis = stream->readFlag(); +} + +void afxXM_WaveBaseData::initParamInfo(U32 parameter, U32& parambit, S32& component) +{ + switch (parameter) + { + case PARAM_POS: + parambit = POSITION; + component = -1; + break; + case PARAM_POS_X: + parambit = POSITION; + component = 0; + break; + case PARAM_POS_Y: + parambit = POSITION; + component = 1; + break; + case PARAM_POS_Z: + parambit = POSITION; + component = 2; + break; + + case PARAM_ORI: + parambit = ORIENTATION; + component = -1; + break; + + case PARAM_POS2: + parambit = POSITION2; + component = -1; + break; + case PARAM_POS2_X: + parambit = POSITION2; + component = 0; + break; + case PARAM_POS2_Y: + parambit = POSITION2; + component = 1; + break; + case PARAM_POS2_Z: + parambit = POSITION2; + component = 2; + break; + + case PARAM_SCALE: + parambit = SCALE; + component = -1; + break; + case PARAM_SCALE_X: + parambit = SCALE; + component = 0; + break; + case PARAM_SCALE_Y: + parambit = SCALE; + component = 1; + break; + case PARAM_SCALE_Z: + parambit = SCALE; + component = 2; + break; + + case PARAM_COLOR: + parambit = COLOR; + component = -1; + break; + case PARAM_COLOR_R: + parambit = COLOR; + component = 0; + break; + case PARAM_COLOR_G: + parambit = COLOR; + component = 1; + break; + case PARAM_COLOR_B: + parambit = COLOR; + component = 2; + break; + case PARAM_COLOR_A: + parambit = COLOR; + component = 3; + break; + + case PARAM_VIS: + parambit = VISIBILITY; + component = -1; + break; + + default: + parambit = 0; + component = -1; + break; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WaveRiderBaseData); + +ConsoleDocClass( afxXM_WaveRiderBaseData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_WaveRiderBaseData::afxXM_WaveRiderBaseData() +{ + waveform_type = afxXM_WaveBaseData::WAVEFORM_NONE; + parameter = afxXM_WaveBaseData::PARAM_NONE; + op = afxXM_WaveBaseData::OP_ADD; + off_duty_t = 0.0f; + + axis.zero(); + local_axis = true; +} + +afxXM_WaveRiderBaseData::afxXM_WaveRiderBaseData(const afxXM_WaveRiderBaseData& other, bool temp_clone) : afxXM_WeightedBaseData(other, temp_clone) +{ + waveform_type = other.waveform_type; + parameter = other.parameter; + op = other.op; + off_duty_t = other.off_duty_t; + + axis = other.axis; + local_axis = true; +} + +void afxXM_WaveRiderBaseData::initPersistFields() +{ + addField("waveform", TYPEID< afxXM_WaveBaseData::WaveFormType >(), Offset(waveform_type, afxXM_WaveRiderBaseData), + "..."); + addField("parameter", TYPEID< afxXM_WaveBaseData::WaveParamType >(), Offset(parameter, afxXM_WaveRiderBaseData), + "..."); + addField("op", TYPEID< afxXM_WaveBaseData::WaveOpType >(), Offset(op, afxXM_WaveRiderBaseData), + "..."); + + addField("offDutyT", TypeF32, Offset(off_duty_t, afxXM_WaveRiderBaseData), + "..."); + + addField("axis", TypePoint3F, Offset(axis, afxXM_WaveRiderBaseData), + "..."); + addField("axisIsLocal", TypeBool, Offset(local_axis, afxXM_WaveRiderBaseData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WaveRiderBaseData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->writeInt(waveform_type, afxXM_WaveBaseData::WAVEFORM_BITS); + stream->writeInt(parameter, afxXM_WaveBaseData::PARAM_BITS); + stream->writeInt(op, afxXM_WaveBaseData::OP_BITS); + stream->write(off_duty_t); + + mathWrite(*stream, axis); + stream->writeFlag(local_axis); +} + +void afxXM_WaveRiderBaseData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + waveform_type = stream->readInt(afxXM_WaveBaseData::WAVEFORM_BITS); + parameter = stream->readInt(afxXM_WaveBaseData::PARAM_BITS); + op = stream->readInt(afxXM_WaveBaseData::OP_BITS); + stream->read(&off_duty_t); + + mathRead(*stream, &axis); + local_axis = stream->readFlag(); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// +// WAVEFORMS + +F32 afxXM_WaveformSine::evaluate(F32 t) +{ + t = (0.75f + t)*Float_2Pi; + return 0.5f*(1.0f + mSin(t)); +} + +F32 afxXM_WaveformSquare::evaluate(F32 t) +{ + return (t < 0.25f || t >= 0.75) ? 0.0f : 1.0f; +} + +F32 afxXM_WaveformTriangle::evaluate(F32 t) +{ + return (t < 0.5f) ? 2.0f*t : 2.0f*(1.0f - t); +} + +//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Waveform* afxXM_WaveBaseData::getWaveform(U32 waveform_type) +{ + static afxXM_WaveformSine sine; + static afxXM_WaveformSquare square; + static afxXM_WaveformTriangle triangle; + static afxXM_WaveformSawtooth sawtooth; + static afxXM_WaveformNoise noise; + static afxXM_WaveformOne one; + + switch (waveform_type) + { + case WAVEFORM_SINE: + return &sine; + case WAVEFORM_SQUARE: + return □ + case WAVEFORM_TRIANGLE: + return ▵ + case WAVEFORM_SAWTOOTH: + return &sawtooth; + case WAVEFORM_NOISE: + return &noise; + case WAVEFORM_ONE: + return &one; + default: + // error condition + return &sine; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +bool afxXM_WaveBase::last_was_pulsed = false; +bool afxXM_WaveBase::last_was_off_duty = true; +F32 afxXM_WaveBase::last_t = 0.0f; +F32 afxXM_WaveBase::last_wave_t = 0.0f; + +afxXM_WaveBase::afxXM_WaveBase(afxXM_WaveBaseData* db, afxEffectWrapper* fxw, afxXM_WaveInterp* interp) + : afxXM_WeightedBase(db, fxw) +{ + this->db = db; + interpolator = interp; + waveform = afxXM_WaveBaseData::getWaveform(db->waveform_type); + + speed_is_randomized = !mIsZero(db->speed_vari); + speed = calc_initial_speed(); + + fixed_weight = db->hasFixedWeight(); + + is_resting = false; + cur_pulse_time = db->delay; + next_pulse_time = cur_pulse_time + ((F32)calc_new_wavesPerPulse())/speed; + interpolator->pulse(); + + last_was_pulsed = false; + last_was_off_duty = true; + last_t = 0.0f; + last_wave_t = 0.0f; +} + +afxXM_WaveBase::~afxXM_WaveBase() +{ + delete interpolator; +} + +void afxXM_WaveBase::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + elapsed -= db->delay; + + if (elapsed > next_pulse_time) + { + is_resting = !is_resting; + cur_pulse_time = next_pulse_time; + + if (is_resting) + { + F32 rest_dt = ((F32)(calc_new_wavesPerRest())/speed) + calc_new_restDur(); + if (rest_dt < 0.01) + is_resting = false; + else + next_pulse_time = cur_pulse_time + rest_dt; + } + + if (!is_resting) + { + speed = calc_new_speed(); + next_pulse_time = cur_pulse_time + ((F32)calc_new_wavesPerPulse())/speed; + interpolator->pulse(); + last_was_pulsed = true; + } + } + + if (is_resting) + { + last_was_off_duty = true; + interpolator->interpolate(db->off_duty_t, params); + return; + } + + F32 n_waves = db->phase_shift + (elapsed - cur_pulse_time)*speed; + F32 wave_t = (n_waves - mFloor(n_waves))/db->duty_cycle; + + // we are beyond the duty portion of the wave, use off_duty_t + if (wave_t > 1.0f) + { + last_was_off_duty = true; + interpolator->interpolate(db->off_duty_t, params); + return; + } + + if (db->duty_shift > 0.0f) + { + wave_t += db->duty_shift; + if (wave_t > 1.0) + wave_t -= 1.0f; + } + + last_was_off_duty = false; + last_wave_t = wave_t; + + last_t = waveform->evaluate(wave_t); + + if (fixed_weight) + { + interpolator->interpolate(last_t, params); + } + else + { + F32 wt_factor = calc_weight_factor(elapsed); + F32 final_t = afxXM_WaveInterp::lerp(wt_factor, db->off_duty_t, last_t); + interpolator->interpolate(final_t, params); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxXM_WaveRiderBase::afxXM_WaveRiderBase(afxXM_WaveRiderBaseData* db, afxEffectWrapper* fxw, afxXM_WaveInterp* interp) + : afxXM_WeightedBase(db, fxw) +{ + this->db = db; + interpolator = interp; + waveform = afxXM_WaveBaseData::getWaveform(db->waveform_type); + fixed_weight = db->hasFixedWeight(); + interpolator->pulse(); +} + +afxXM_WaveRiderBase::~afxXM_WaveRiderBase() +{ + delete interpolator; +} + +void afxXM_WaveRiderBase::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) +{ + if (afxXM_WaveBase::last_was_pulsed) + interpolator->pulse(); + + if (afxXM_WaveBase::last_was_off_duty) + { + interpolator->interpolate(db->off_duty_t, params); + return; + } + + F32 t; + if (db->waveform_type != afxXM_WaveBaseData::WAVEFORM_NONE) + t = waveform->evaluate(afxXM_WaveBase::last_wave_t); + else + t = afxXM_WaveBase::last_t; + + if (fixed_weight) + interpolator->interpolate(t, params); + else + { + F32 wt_factor = calc_weight_factor(elapsed); + F32 final_t = afxXM_WaveInterp::lerp(wt_factor, db->off_duty_t, t); + interpolator->interpolate(final_t, params); + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file diff --git a/Engine/source/afx/xm/afxXM_WaveBase.h b/Engine/source/afx/xm/afxXM_WaveBase.h new file mode 100644 index 000000000..f7dd26f31 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_WaveBase.h @@ -0,0 +1,314 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_XFM_WAVE_BASE_H_ +#define _AFX_XFM_WAVE_BASE_H_ + +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVEFORM + +class afxXM_Waveform +{ +public: + virtual F32 evaluate(F32 t) = 0; +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveformSine : public afxXM_Waveform +{ +public: + virtual F32 evaluate(F32 t); +}; + +class afxXM_WaveformSquare : public afxXM_Waveform +{ +public: + virtual F32 evaluate(F32 t); +}; + +class afxXM_WaveformTriangle : public afxXM_Waveform +{ +public: + virtual F32 evaluate(F32 t); +}; + +class afxXM_WaveformSawtooth : public afxXM_Waveform +{ +public: + virtual F32 evaluate(F32 t) { return t; } +}; + +class afxXM_WaveformNoise : public afxXM_Waveform +{ +public: + virtual F32 evaluate(F32 t) { return gRandGen.randF(); }; +}; + +class afxXM_WaveformOne : public afxXM_Waveform +{ +public: + virtual F32 evaluate(F32 t) { return 1.0f; }; +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE INTERPOLATOR + +class afxXM_WaveInterp +{ +public: + virtual void interpolate(F32 t, afxXM_Params& params)=0; + virtual void pulse()=0; + + static F32 lerp(F32 t, F32 a, F32 b) { return a + t * (b - a); } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE BASE DATABLOCK + +class afxXM_WaveBaseData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + friend class afxXM_WaveRiderBaseData; + +public: + enum WaveFormType + { + WAVEFORM_NONE = 0, + WAVEFORM_SINE, + WAVEFORM_SQUARE, + WAVEFORM_TRIANGLE, + WAVEFORM_SAWTOOTH, + WAVEFORM_NOISE, + WAVEFORM_ONE, + WAVEFORM_BITS = 3 + }; + + enum WaveOpType + { + OP_ADD = 0, + OP_MULTIPLY, + OP_REPLACE, + OP_BITS = 2 + }; + + enum WaveParamType + { + PARAM_NONE = 0, + PARAM_POS, + PARAM_POS_X, + PARAM_POS_Y, + PARAM_POS_Z, + PARAM_ORI, + PARAM_POS2, + PARAM_POS2_X, + PARAM_POS2_Y, + PARAM_POS2_Z, + PARAM_SCALE, + PARAM_SCALE_X, + PARAM_SCALE_Y, + PARAM_SCALE_Z, + PARAM_COLOR, + PARAM_COLOR_R, + PARAM_COLOR_G, + PARAM_COLOR_B, + PARAM_COLOR_A, + PARAM_VIS, + PARAM_BITS = 5, + }; + + U32 waveform_type; + U32 parameter; + U32 op; + F32 speed; + F32 speed_vari; + F32 accel; + F32 phase_shift; + F32 duty_cycle; + F32 duty_shift; + F32 off_duty_t; + + ByteRange waves_per_pulse; + ByteRange waves_per_rest; + F32 rest_dur; + F32 rest_dur_vari; + + Point3F axis; + bool local_axis; + +public: + /*C*/ afxXM_WaveBaseData(); + /*C*/ afxXM_WaveBaseData(const afxXM_WaveBaseData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + static void initPersistFields(); + + static void initParamInfo(U32 parameter, U32& parambit, S32& component); + static afxXM_Waveform* getWaveform(U32 waveform_type); + + DECLARE_CONOBJECT(afxXM_WaveBaseData); + DECLARE_CATEGORY("AFX"); +}; + +typedef afxXM_WaveBaseData::WaveFormType afxXM_WaveFormType; +DefineEnumType( afxXM_WaveFormType ); + +typedef afxXM_WaveBaseData::WaveOpType afxXM_WaveOpType; +DefineEnumType( afxXM_WaveOpType ); + +typedef afxXM_WaveBaseData::WaveParamType afxXM_WaveParamType; +DefineEnumType( afxXM_WaveParamType ); + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE RIDER BASE DATABLOCK + +class afxXM_WaveRiderBaseData : public afxXM_WeightedBaseData +{ + typedef afxXM_WeightedBaseData Parent; + +public: + U32 waveform_type; + F32 off_duty_t; + U32 parameter; + U32 op; + + Point3F axis; + bool local_axis; + +public: + /*C*/ afxXM_WaveRiderBaseData(); + /*C*/ afxXM_WaveRiderBaseData(const afxXM_WaveRiderBaseData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxXM_WaveRiderBaseData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE BASE + +class afxXM_WaveBase : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + friend class afxXM_WaveRiderBase; + +protected: + static bool last_was_pulsed; + static bool last_was_off_duty; + static F32 last_t; + static F32 last_wave_t; + + afxXM_WaveInterp* interpolator; + +protected: + afxXM_Waveform* waveform; + + afxXM_WaveBaseData* db; + F32 speed; + bool fixed_weight; + + bool speed_is_randomized; + bool is_resting; + F32 cur_pulse_time; + F32 next_pulse_time; + + F32 calc_initial_speed(); + F32 calc_new_speed(); + F32 calc_new_restDur(); + S32 calc_new_wavesPerPulse(); + S32 calc_new_wavesPerRest(); + +public: + /*C*/ afxXM_WaveBase(afxXM_WaveBaseData*, afxEffectWrapper*, afxXM_WaveInterp*); + /*D*/ ~afxXM_WaveBase(); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +inline F32 afxXM_WaveBase::calc_initial_speed() +{ + return (!speed_is_randomized) ? + db->speed : + (db->speed + gRandGen.randF()*2.0f*db->speed_vari - db->speed_vari); +} + +inline F32 afxXM_WaveBase::calc_new_speed() +{ + return mClampF((!speed_is_randomized) ? + (speed + speed*db->accel) : + (db->speed + gRandGen.randF()*2.0f*db->speed_vari - db->speed_vari), 0.001f, 200.0f); +} + +inline F32 afxXM_WaveBase::calc_new_restDur() +{ + return db->rest_dur + gRandGen.randF()*2.0f*db->rest_dur_vari - db->rest_dur_vari; +} + +inline S32 afxXM_WaveBase::calc_new_wavesPerPulse() +{ + return (db->waves_per_pulse.getSpan() == 0) ? + db->waves_per_pulse.low : + gRandGen.randI(db->waves_per_pulse.low, db->waves_per_pulse.high); +} + +inline S32 afxXM_WaveBase::calc_new_wavesPerRest() +{ + return (db->waves_per_rest.getSpan() == 0) ? + db->waves_per_rest.low : + gRandGen.randI(db->waves_per_rest.low, db->waves_per_rest.high); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE RIDER BASE + +class afxXM_WaveRiderBase : public afxXM_WeightedBase +{ + typedef afxXM_WeightedBase Parent; + +protected: + afxXM_WaveInterp* interpolator; + afxXM_WaveRiderBaseData* db; + afxXM_Waveform* waveform; + bool fixed_weight; + +public: + /*C*/ afxXM_WaveRiderBase(afxXM_WaveRiderBaseData*, afxEffectWrapper*, afxXM_WaveInterp*); + /*D*/ ~afxXM_WaveRiderBase(); + + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_XFM_WAVE_BASE_H_ + diff --git a/Engine/source/afx/xm/afxXM_WaveColor.cpp b/Engine/source/afx/xm/afxXM_WaveColor.cpp new file mode 100644 index 000000000..851ccfc4d --- /dev/null +++ b/Engine/source/afx/xm/afxXM_WaveColor.cpp @@ -0,0 +1,388 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXM_WaveBase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE COLOR INTERPOLATORS + +class afxXM_WaveInterp_Color : public afxXM_WaveInterp +{ +protected: + LinearColorF a_set, b_set; + LinearColorF a_var, b_var; + LinearColorF a, b; + bool sync_var; + +public: + afxXM_WaveInterp_Color(); + + void set(LinearColorF& a, LinearColorF& b, LinearColorF& a_var, LinearColorF& b_var, bool sync_var); + + virtual void interpolate(F32 t, afxXM_Params& params)=0; + virtual void pulse(); +}; + +afxXM_WaveInterp_Color::afxXM_WaveInterp_Color() +{ + a_set.set(0.0f, 0.0f, 0.0f, 0.0f); + b_set.set(1.0f, 1.0f, 1.0f, 1.0f); + a_var.set(0.0f, 0.0f, 0.0f, 0.0f); + b_var.set(0.0f, 0.0f, 0.0f, 0.0f); + sync_var = false; + a.set(0.0f, 0.0f, 0.0f, 0.0f); + b.set(1.0f, 1.0f, 1.0f, 1.0f); +} + +void afxXM_WaveInterp_Color::set(LinearColorF& a, LinearColorF& b, LinearColorF& a_var, LinearColorF& b_var, bool sync_var) +{ + a_set = a; + b_set = b; + this->a_var = a_var; + this->b_var = b_var; + this->sync_var = sync_var; + this->a = a; + this->b = b; +} + +inline void afxXM_WaveInterp_Color::pulse() +{ + LinearColorF temp_color; + F32 rand_t = gRandGen.randF()*2.0f; + temp_color.interpolate(-a_var, a_var, rand_t); + a = a_set + temp_color; + if (!sync_var) + rand_t = gRandGen.randF()*2.0f; + temp_color.interpolate(-b_var, b_var, rand_t); + b = b_set + temp_color; +} + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Color_Add : public afxXM_WaveInterp_Color +{ +public: + virtual void interpolate(F32 t, afxXM_Params& params) + { + LinearColorF temp_color; + temp_color.interpolate(a, b, t); + params.color += temp_color; + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Color_Mul : public afxXM_WaveInterp_Color +{ +public: + virtual void interpolate(F32 t, afxXM_Params& params) + { + LinearColorF temp_color; + temp_color.interpolate(a, b, t); + params.color *= temp_color; + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Color_Rep : public afxXM_WaveInterp_Color +{ +public: + virtual void interpolate(F32 t, afxXM_Params& params) + { + params.color.interpolate(a, b, t); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE SCALAR BASE DATABLOCK + +class afxXM_WaveColorData_Common : public virtual afxXM_Defs +{ +protected: + static afxXM_WaveInterp_Color* createInterp(U32 op, afxXM_BaseData*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxXM_WaveInterp_Color* +afxXM_WaveColorData_Common::createInterp(U32 op, afxXM_BaseData* db) +{ + afxXM_WaveInterp_Color* interpolator = 0; + + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Color_Add(); + return 0; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Color_Mul(); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Color_Rep(); + break; + } + + if (!interpolator) + Con::errorf("%s::%s -- failed to allocate wave color interpolator.", db->getClassName(), db->getName()); + + return interpolator; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE COLOR DATABLOCK + +class afxXM_WaveColorData : public afxXM_WaveBaseData, afxXM_WaveColorData_Common +{ + typedef afxXM_WaveBaseData Parent; + +public: + LinearColorF a, b; + LinearColorF a_var, b_var; + bool sync_var; + +public: + /*C*/ afxXM_WaveColorData(); + /*C*/ afxXM_WaveColorData(const afxXM_WaveColorData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_WaveColorData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WaveColorData); + +ConsoleDocClass( afxXM_WaveColorData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_WaveColorData::afxXM_WaveColorData() +{ + a.set(0.0f, 0.0f, 0.0f, 0.0f); + b.set(1.0f, 1.0f, 1.0f, 1.0f); + a_var.set(0.0f, 0.0f, 0.0f, 0.0f); + b_var.set(0.0f, 0.0f, 0.0f, 0.0f); + sync_var = false; +} + +afxXM_WaveColorData::afxXM_WaveColorData(const afxXM_WaveColorData& other, bool temp_clone) : afxXM_WaveBaseData(other, temp_clone) +{ + a = other.a; + b = other.b; + a_var = other.a_var; + b_var = other.b_var; + sync_var = other.sync_var; +} + +void afxXM_WaveColorData::initPersistFields() +{ + addField("a", TypeColorF, Offset(a, afxXM_WaveColorData), + "..."); + addField("b", TypeColorF, Offset(b, afxXM_WaveColorData), + "..."); + addField("aVariance", TypeColorF, Offset(a_var, afxXM_WaveColorData), + "..."); + addField("bVariance", TypeColorF, Offset(b_var, afxXM_WaveColorData), + "..."); + addField("syncVariances", TypeBool, Offset(sync_var, afxXM_WaveColorData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WaveColorData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(a); + stream->write(b); + stream->write(a_var); + stream->write(b_var); + stream->writeFlag(sync_var); +} + +void afxXM_WaveColorData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&a); + stream->read(&b); + stream->read(&a_var); + stream->read(&b_var); + sync_var = stream->readFlag(); +} + +afxXM_Base* afxXM_WaveColorData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_WaveColorData* dblock = this; + + if (getSubstitutionCount() > 0) + { + dblock = new afxXM_WaveColorData(*this, true); + this->performSubstitutions(dblock, fx->getChoreographer(), fx->getGroupIndex()); + } + + afxXM_WaveInterp_Color* interp; + interp = createInterp(dblock->op, dblock); + if (!interp) + return 0; + + interp->set(dblock->a, dblock->b, dblock->a_var, dblock->b_var, dblock->sync_var); + + return new afxXM_WaveBase(dblock, fx, interp); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE RIDER COLOR DATABLOCK + +class afxXM_WaveRiderColorData : public afxXM_WaveRiderBaseData, afxXM_WaveColorData_Common +{ + typedef afxXM_WaveRiderBaseData Parent; + +public: + LinearColorF a, b; + LinearColorF a_var, b_var; + bool sync_var; + +public: + /*C*/ afxXM_WaveRiderColorData(); + /*C*/ afxXM_WaveRiderColorData(const afxXM_WaveRiderColorData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_WaveRiderColorData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WaveRiderColorData); + +ConsoleDocClass( afxXM_WaveRiderColorData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_WaveRiderColorData::afxXM_WaveRiderColorData() +{ + a.set(0.0f, 0.0f, 0.0f, 0.0f); + b.set(1.0f, 1.0f, 1.0f, 1.0f); + a_var.set(0.0f, 0.0f, 0.0f, 0.0f); + b_var.set(0.0f, 0.0f, 0.0f, 0.0f); + sync_var = false; +} + +afxXM_WaveRiderColorData::afxXM_WaveRiderColorData(const afxXM_WaveRiderColorData& other, bool temp_clone) : afxXM_WaveRiderBaseData(other, temp_clone) +{ + a = other.a; + b = other.b; + a_var = other.a_var; + b_var = other.b_var; + sync_var = other.sync_var; +} + +void afxXM_WaveRiderColorData::initPersistFields() +{ + addField("a", TypeColorF, Offset(a, afxXM_WaveRiderColorData), + "..."); + addField("b", TypeColorF, Offset(b, afxXM_WaveRiderColorData), + "..."); + addField("aVariance", TypeColorF, Offset(a_var, afxXM_WaveRiderColorData), + "..."); + addField("bVariance", TypeColorF, Offset(b_var, afxXM_WaveRiderColorData), + "..."); + addField("syncVariances", TypeBool, Offset(sync_var, afxXM_WaveRiderColorData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WaveRiderColorData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(a); + stream->write(b); + stream->write(a_var); + stream->write(b_var); + stream->writeFlag(sync_var); +} + +void afxXM_WaveRiderColorData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&a); + stream->read(&b); + stream->read(&a_var); + stream->read(&b_var); + sync_var = stream->readFlag(); +} + +afxXM_Base* afxXM_WaveRiderColorData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_WaveRiderColorData* dblock = this; + + if (getSubstitutionCount() > 0) + { + dblock = new afxXM_WaveRiderColorData(*this, true); + this->performSubstitutions(dblock, fx->getChoreographer(), fx->getGroupIndex()); + } + + afxXM_WaveInterp_Color* interp; + interp = createInterp(dblock->op, dblock); + if (!interp) + return 0; + + interp->set(dblock->a, dblock->b, dblock->a_var, dblock->b_var, dblock->sync_var); + + return new afxXM_WaveRiderBase(dblock, fx, interp); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_WaveScalar.cpp b/Engine/source/afx/xm/afxXM_WaveScalar.cpp new file mode 100644 index 000000000..d05b1d579 --- /dev/null +++ b/Engine/source/afx/xm/afxXM_WaveScalar.cpp @@ -0,0 +1,825 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/afxChoreographer.h" +#include "afx/xm/afxXM_WaveBase.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE SCALAR INTERPOLATORS + +class afxXM_WaveInterp_Scalar : public afxXM_WaveInterp +{ +protected: + F32 a_set, b_set; + F32 a_var, b_var; + F32 a, b; + bool sync_var; + +public: + afxXM_WaveInterp_Scalar(); + + void set(F32 a, F32 b, F32 a_var, F32 b_var, bool sync_var); + + virtual void interpolate(F32 t, afxXM_Params& params)=0; + virtual void pulse(); +}; + +afxXM_WaveInterp_Scalar::afxXM_WaveInterp_Scalar() +{ + a_set = 0.0f; + b_set = 1.0f; + a_var = 0.0f; + b_var = 0.0; + sync_var = false; + a = 0.0f; + b = 1.0f; +} + +void afxXM_WaveInterp_Scalar::set(F32 a, F32 b, F32 a_var, F32 b_var, bool sync_var) +{ + a_set = a; + b_set = b; + this->a_var = a_var; + this->b_var = b_var; + this->sync_var = sync_var; + this->a = a; + this->b = b; +} + +inline void afxXM_WaveInterp_Scalar::pulse() +{ + F32 rand_t = gRandGen.randF()*2.0f; + a = a_set + rand_t*a_var - a_var; + if (!sync_var) + rand_t = gRandGen.randF()*2.0f; + b = b_set + rand_t*b_var - b_var; +} + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_Add : public afxXM_WaveInterp_Scalar +{ +protected: + U32 offset; +public: + afxXM_WaveInterp_Scalar_Add(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + *((F32*)(((char*)(¶ms)) + offset)) += lerp(t, a, b); + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_Mul : public afxXM_WaveInterp_Scalar +{ +protected: + U32 offset; +public: + afxXM_WaveInterp_Scalar_Mul(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + *((F32*)(((char*)(¶ms)) + offset)) *= lerp(t, a, b); + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_Rep : public afxXM_WaveInterp_Scalar +{ +protected: + U32 offset; +public: + afxXM_WaveInterp_Scalar_Rep(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + *((F32*)(((char*)(¶ms)) + offset)) = lerp(t, a, b); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_PointAdd : public afxXM_WaveInterp_Scalar +{ +protected: + U32 offset; +public: + afxXM_WaveInterp_Scalar_PointAdd(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + F32 scalar_at_t = lerp(t, a, b); + Point3F point_at_t(scalar_at_t, scalar_at_t, scalar_at_t); + *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_PointMul : public afxXM_WaveInterp_Scalar +{ +protected: + U32 offset; +public: + afxXM_WaveInterp_Scalar_PointMul(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + *((Point3F*)(((char*)(¶ms)) + offset)) *= lerp(t, a, b); + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_PointRep : public afxXM_WaveInterp_Scalar +{ +protected: + U32 offset; +public: + afxXM_WaveInterp_Scalar_PointRep(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + F32 scalar_at_t = lerp(t, a, b); + Point3F point_at_t(scalar_at_t, scalar_at_t, scalar_at_t); + *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_Axis_PointAdd : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; + U32 offset; +public: + afxXM_WaveInterp_Scalar_Axis_PointAdd(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + Point3F point_at_t = axis*lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; + } +}; + +class afxXM_WaveInterp_Scalar_LocalAxis_PointAdd : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; + U32 offset; +public: + afxXM_WaveInterp_Scalar_LocalAxis_PointAdd(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + Point3F local_axis(axis); + params.ori.mulV(local_axis); + Point3F point_at_t = local_axis*lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_Axis_PointMul : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; + U32 offset; +public: + afxXM_WaveInterp_Scalar_Axis_PointMul(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + Point3F point_at_t = axis*lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) *= point_at_t; + } +}; + +class afxXM_WaveInterp_Scalar_LocalAxis_PointMul : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; + U32 offset; +public: + afxXM_WaveInterp_Scalar_LocalAxis_PointMul(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + Point3F local_axis(axis); + params.ori.mulV(local_axis); + Point3F point_at_t = local_axis*lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) *= point_at_t; + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_Axis_PointRep : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; + U32 offset; +public: + afxXM_WaveInterp_Scalar_Axis_PointRep(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + Point3F point_at_t = axis*lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; + } +}; + +class afxXM_WaveInterp_Scalar_LocalAxis_PointRep : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; + U32 offset; +public: + afxXM_WaveInterp_Scalar_LocalAxis_PointRep(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + Point3F local_axis(axis); + params.ori.mulV(local_axis); + Point3F point_at_t = local_axis*lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_ColorAdd : public afxXM_WaveInterp_Scalar +{ +public: + afxXM_WaveInterp_Scalar_ColorAdd() : afxXM_WaveInterp_Scalar() { } + virtual void interpolate(F32 t, afxXM_Params& params) + { + F32 scalar_at_t = lerp(t, a, b); + LinearColorF color_at_t(scalar_at_t, scalar_at_t, scalar_at_t, scalar_at_t); + params.color += color_at_t; + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_ColorMul : public afxXM_WaveInterp_Scalar +{ +public: + afxXM_WaveInterp_Scalar_ColorMul() : afxXM_WaveInterp_Scalar() { } + virtual void interpolate(F32 t, afxXM_Params& params) + { + params.color *= lerp(t, a, b); + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_ColorRep : public afxXM_WaveInterp_Scalar +{ +public: + afxXM_WaveInterp_Scalar_ColorRep() : afxXM_WaveInterp_Scalar() { } + virtual void interpolate(F32 t, afxXM_Params& params) + { + F32 scalar_at_t = lerp(t, a, b); + params.color.set(scalar_at_t, scalar_at_t, scalar_at_t, scalar_at_t); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_OriMul : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; +public: + afxXM_WaveInterp_Scalar_OriMul(Point3F& ax) : afxXM_WaveInterp_Scalar() { axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + F32 theta = mDegToRad(lerp(t, a, b)); + AngAxisF rot_aa(axis, theta); + MatrixF rot_xfm; rot_aa.setMatrix(&rot_xfm); + params.ori.mul(rot_xfm); + } +}; + +//~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WaveInterp_Scalar_OriRep : public afxXM_WaveInterp_Scalar +{ +protected: + Point3F axis; +public: + afxXM_WaveInterp_Scalar_OriRep(Point3F& ax) : afxXM_WaveInterp_Scalar() { axis = ax; } + virtual void interpolate(F32 t, afxXM_Params& params) + { + F32 theta = mDegToRad(lerp(t, a, b)); + AngAxisF rot_aa(axis, theta); + rot_aa.setMatrix(¶ms.ori); + } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE SCALAR BASE DATABLOCK + +class afxXM_WaveScalarData_Common : public virtual afxXM_Defs +{ + static afxXM_WaveInterp_Scalar* alloc_interp(U32 param, S32 comp, U32 op, U32 off, + Point3F& axis, bool loc_axis, afxXM_BaseData*); + static bool needs_offset(U32 param, S32 component); + static bool needs_axis(U32 param, S32 component); + +protected: + static afxXM_WaveInterp_Scalar* createInterp(U32 param, U32 op, Point3F axis, bool loc_axis, + afxXM_BaseData*); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +bool afxXM_WaveScalarData_Common::needs_offset(U32 param, S32 component) +{ + switch (param) + { + case ORIENTATION: + return false; + + case POSITION: + case POSITION2: + case SCALE: + case VISIBILITY: + return true; + + case COLOR: + return (component != -1); + } + + return false; +} + +bool afxXM_WaveScalarData_Common::needs_axis(U32 param, S32 component) +{ + switch (param) + { + case ORIENTATION: + return true; + + case POSITION: + case POSITION2: + case SCALE: + case COLOR: + case VISIBILITY: + return false; + } + + return true; +} + +afxXM_WaveInterp_Scalar* +afxXM_WaveScalarData_Common::alloc_interp(U32 param, S32 component, U32 op, U32 offset, Point3F& axis, bool loc_axis, afxXM_BaseData* db) +{ + afxXM_WaveInterp_Scalar* interpolator = 0; + + switch (param) + { + case ORIENTATION: + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + Con::errorf("%s::%s -- invalid orientation op.", db->getClassName(), db->getName()); + return 0; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_OriMul(axis); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_OriRep(axis); + break; + } + break; + case POSITION: + case POSITION2: + case SCALE: + if (component == -1) + { + if (axis.isZero()) + { + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Scalar_PointAdd(offset); + break; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_PointMul(offset); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_PointRep(offset); + break; + } + } + else if (loc_axis) + { + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Scalar_LocalAxis_PointAdd(offset, axis); + break; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_LocalAxis_PointMul(offset, axis); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_LocalAxis_PointRep(offset, axis); + break; + } + } + else + { + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Scalar_Axis_PointAdd(offset, axis); + break; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_Axis_PointMul(offset, axis); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_Axis_PointRep(offset, axis); + break; + } + } + } + else + { + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Scalar_Add(offset); + break; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_Mul(offset); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_Rep(offset); + break; + } + } + break; + + case COLOR: + if (component == -1) + { + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Scalar_ColorAdd(); + break; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_ColorMul(); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_ColorRep(); + break; + } + } + else + { + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Scalar_Add(offset); + break; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_Mul(offset); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_Rep(offset); + break; + } + } + break; + + case VISIBILITY: + switch (op) + { + case afxXM_WaveBaseData::OP_ADD: + interpolator = new afxXM_WaveInterp_Scalar_Add(offset); + break; + case afxXM_WaveBaseData::OP_MULTIPLY: + interpolator = new afxXM_WaveInterp_Scalar_Mul(offset); + break; + case afxXM_WaveBaseData::OP_REPLACE: + interpolator = new afxXM_WaveInterp_Scalar_Rep(offset); + break; + } + } + + if (!interpolator) + Con::errorf("%s::%s -- failed to allocate wave interpolator.", db->getClassName(), db->getName()); + + return interpolator; +} + +afxXM_WaveInterp_Scalar* +afxXM_WaveScalarData_Common::createInterp(U32 parameter, U32 op, Point3F axis, bool loc_axis, afxXM_BaseData* db) +{ + S32 component; U32 param_bit; + afxXM_WaveBaseData::initParamInfo(parameter, param_bit, component); + + if (param_bit == 0) + { + Con::errorf("%s::%s -- unknown parameter specified.", db->getClassName(), db->getName()); + return 0; + } + + if (axis.isZero() && needs_axis(param_bit, component)) + { + Con::errorf("%s::%s -- axis required.", db->getClassName(), db->getName()); + return 0; + } + + if (!axis.isZero()) + axis.normalize(); + + U32 offset = afxXM_Params::BAD_OFFSET; + if (needs_offset(param_bit, component)) + { + offset = afxXM_Params::getParameterOffset(param_bit, component); + if (offset == afxXM_Params::BAD_OFFSET) + { + Con::errorf("%s::%s -- bad component offset.", db->getClassName(), db->getName()); + return 0; + } + } + + return alloc_interp(param_bit, component, op, offset, axis, loc_axis, db); +} + + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE SCALAR DATABLOCK + +class afxXM_WaveScalarData : public afxXM_WaveBaseData, afxXM_WaveScalarData_Common +{ + typedef afxXM_WaveBaseData Parent; + +public: + F32 a, b; + F32 a_var, b_var; + bool sync_var; + +public: + /*C*/ afxXM_WaveScalarData(); + /*C*/ afxXM_WaveScalarData(const afxXM_WaveScalarData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_WaveScalarData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WaveScalarData); + +ConsoleDocClass( afxXM_WaveScalarData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_WaveScalarData::afxXM_WaveScalarData() +{ + a = 0.0f; + b = 1.0f; + a_var = 0.0f; + b_var = 0.0f; + sync_var = false; +} + +afxXM_WaveScalarData::afxXM_WaveScalarData(const afxXM_WaveScalarData& other, bool temp_clone) : afxXM_WaveBaseData(other, temp_clone) +{ + a = other.a; + b = other.b; + a_var = other.a_var; + b_var = other.b_var; + sync_var = other.sync_var; +} + +void afxXM_WaveScalarData::initPersistFields() +{ + addField("a", TypeF32, Offset(a, afxXM_WaveScalarData), + "..."); + addField("b", TypeF32, Offset(b, afxXM_WaveScalarData), + "..."); + addField("aVariance", TypeF32, Offset(a_var, afxXM_WaveScalarData), + "..."); + addField("bVariance", TypeF32, Offset(b_var, afxXM_WaveScalarData), + "..."); + addField("syncVariances", TypeBool, Offset(sync_var, afxXM_WaveScalarData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WaveScalarData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(a); + stream->write(b); + if (stream->writeFlag(a_var != 0.0f || b_var != 0.0f)) + { + stream->write(a_var); + stream->write(b_var); + stream->writeFlag(sync_var); + } +} + +void afxXM_WaveScalarData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&a); + stream->read(&b); + if (stream->readFlag()) + { + stream->read(&a_var); + stream->read(&b_var); + sync_var = stream->readFlag(); + } + else + { + a_var = b_var = 0.0f; + sync_var = false; + } +} + +afxXM_Base* afxXM_WaveScalarData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_WaveScalarData* dblock = this; + + if (getSubstitutionCount() > 0) + { + dblock = new afxXM_WaveScalarData(*this, true); + this->performSubstitutions(dblock, fx->getChoreographer(), fx->getGroupIndex()); + } + + afxXM_WaveInterp_Scalar* interp; + interp = createInterp(dblock->parameter, dblock->op, dblock->axis, dblock->local_axis, dblock); + if (!interp) + return 0; + + interp->set(dblock->a, dblock->b, dblock->a_var, dblock->b_var, dblock->sync_var); + + return new afxXM_WaveBase(dblock, fx, interp); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// WAVE RIDER SCALAR DATABLOCK + +class afxXM_WaveRiderScalarData : public afxXM_WaveRiderBaseData, afxXM_WaveScalarData_Common +{ + typedef afxXM_WaveRiderBaseData Parent; + +public: + F32 a, b; + F32 a_var, b_var; + bool sync_var; + +public: + /*C*/ afxXM_WaveRiderScalarData(); + /*C*/ afxXM_WaveRiderScalarData(const afxXM_WaveRiderScalarData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + virtual bool allowSubstitutions() const { return true; } + + static void initPersistFields(); + + afxXM_Base* create(afxEffectWrapper* fx, bool on_server); + + DECLARE_CONOBJECT(afxXM_WaveRiderScalarData); + DECLARE_CATEGORY("AFX"); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WaveRiderScalarData); + +ConsoleDocClass( afxXM_WaveRiderScalarData, + "@brief An xmod datablock.\n\n" + + "@ingroup afxXMods\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + +afxXM_WaveRiderScalarData::afxXM_WaveRiderScalarData() +{ + a = 0.0f; + b = 1.0f; + a_var = 0.0f; + b_var = 0.0f; + sync_var = false; +} + +afxXM_WaveRiderScalarData::afxXM_WaveRiderScalarData(const afxXM_WaveRiderScalarData& other, bool temp_clone) : afxXM_WaveRiderBaseData(other, temp_clone) +{ + a = other.a; + b = other.b; + a_var = other.a_var; + b_var = other.b_var; + sync_var = other.sync_var; +} + +void afxXM_WaveRiderScalarData::initPersistFields() +{ + addField("a", TypeF32, Offset(a, afxXM_WaveRiderScalarData), + "..."); + addField("b", TypeF32, Offset(b, afxXM_WaveRiderScalarData), + "..."); + addField("aVariance", TypeF32, Offset(a_var, afxXM_WaveRiderScalarData), + "..."); + addField("bVariance", TypeF32, Offset(b_var, afxXM_WaveRiderScalarData), + "..."); + addField("syncVariances", TypeBool, Offset(sync_var, afxXM_WaveRiderScalarData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WaveRiderScalarData::packData(BitStream* stream) +{ + Parent::packData(stream); + stream->write(a); + stream->write(b); + if (stream->writeFlag(a_var != 0.0f || b_var != 0.0f)) + { + stream->write(a_var); + stream->write(b_var); + stream->writeFlag(sync_var); + } +} + +void afxXM_WaveRiderScalarData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + stream->read(&a); + stream->read(&b); + if (stream->readFlag()) + { + stream->read(&a_var); + stream->read(&b_var); + sync_var = stream->readFlag(); + } + else + { + a_var = b_var = 0.0f; + sync_var = false; + } +} + +afxXM_Base* afxXM_WaveRiderScalarData::create(afxEffectWrapper* fx, bool on_server) +{ + afxXM_WaveRiderScalarData* dblock = this; + + if (getSubstitutionCount() > 0) + { + dblock = new afxXM_WaveRiderScalarData(*this, true); + this->performSubstitutions(dblock, fx->getChoreographer(), fx->getGroupIndex()); + } + + afxXM_WaveInterp_Scalar* interp; + interp = createInterp(dblock->parameter, dblock->op, dblock->axis, dblock->local_axis, dblock); + if (!interp) + return 0; + + interp->set(dblock->a, dblock->b, dblock->a_var, dblock->b_var, dblock->sync_var); + + return new afxXM_WaveRiderBase(dblock, fx, interp); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXfmMod.cpp b/Engine/source/afx/xm/afxXfmMod.cpp new file mode 100644 index 000000000..896cc06d0 --- /dev/null +++ b/Engine/source/afx/xm/afxXfmMod.cpp @@ -0,0 +1,333 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "afx/arcaneFX.h" + +#include "afx/afxEffectWrapper.h" +#include "afx/util/afxEase.h" +#include "afx/xm/afxXfmMod.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +afxXM_Params::afxXM_Params() +{ + pos.zero(); + ori.identity(); + scale.set(1.0f,1.0f,1.0f); + pos2.zero(); + color.set(0.0f,0.0f,0.0f,0.0f); + vis = 0.0; +} + +U32 afxXM_Params::getParameterOffset(U32 param, S32 component) +{ + switch (param) + { + + case POSITION: + switch (component) + { + case 0: + return Offset(pos.x, afxXM_Params); + case 1: + return Offset(pos.y, afxXM_Params); + case 2: + return Offset(pos.z, afxXM_Params); + default: + return Offset(pos, afxXM_Params); + } + break; + + case ORIENTATION: + return Offset(ori, afxXM_Params); + + case POSITION2: + switch (component) + { + case 0: + return Offset(pos2.x, afxXM_Params); + case 1: + return Offset(pos2.y, afxXM_Params); + case 2: + return Offset(pos2.z, afxXM_Params); + default: + return Offset(pos2, afxXM_Params); + } + break; + + case SCALE: + switch (component) + { + case 0: + return Offset(scale.x, afxXM_Params); + case 1: + return Offset(scale.y, afxXM_Params); + case 2: + return Offset(scale.z, afxXM_Params); + default: + return Offset(scale, afxXM_Params); + } + break; + + case COLOR: + switch (component) + { + case 0: + return Offset(color.red, afxXM_Params); + case 1: + return Offset(color.green, afxXM_Params); + case 2: + return Offset(color.blue, afxXM_Params); + case 3: + return Offset(color.alpha, afxXM_Params); + default: + return Offset(color, afxXM_Params); + } + break; + + case VISIBILITY: + return Offset(vis, afxXM_Params); + } + + return BAD_OFFSET; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// BASE CLASSES +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_BaseData); + +afxXM_BaseData::afxXM_BaseData() +{ + ignore_time_factor = false; +} + +afxXM_BaseData::afxXM_BaseData(const afxXM_BaseData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + ignore_time_factor = other.ignore_time_factor; +} + +void afxXM_BaseData::initPersistFields() +{ + addField("ignoreTimeFactor", TypeBool, Offset(ignore_time_factor, afxXM_BaseData), + "..."); + + Parent::initPersistFields(); + + Con::setIntVariable("$afxXfmMod::POS", POSITION); + Con::setIntVariable("$afxXfmMod::ORI", ORIENTATION); + Con::setIntVariable("$afxXfmMod::POS2", POSITION2); + Con::setIntVariable("$afxXfmMod::SCALE", SCALE); + Con::setIntVariable("$afxXfmMod::ALL_BUT_SCALE", ALL_BUT_SCALE); + Con::setIntVariable("$afxXfmMod::ALL", ALL); +} + +void afxXM_BaseData::packData(BitStream* stream) +{ + Parent::packData(stream); + + stream->write(ignore_time_factor); +} + +void afxXM_BaseData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + stream->read(&ignore_time_factor); +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_Base::afxXM_Base(afxXM_BaseData* db, afxEffectWrapper* fxw) +{ + fx_wrapper = fxw; + time_factor = (db->ignore_time_factor) ? 1.0f : fxw->getTimeFactor(); + datablock = db; +} + +afxXM_Base::~afxXM_Base() +{ + if (datablock && datablock->isTempClone()) + delete datablock; + datablock = 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +IMPLEMENT_CO_DATABLOCK_V1(afxXM_WeightedBaseData); + +afxXM_WeightedBaseData::afxXM_WeightedBaseData() +{ + delay = 0; + lifetime = afxEffectDefs::INFINITE_LIFETIME; + fade_in_time = 0; + fade_out_time = 0; + fadein_ease.set(0.0f, 1.0f); + fadeout_ease.set(0.0f, 1.0f); + life_bias = 1.0f; +} + +afxXM_WeightedBaseData::afxXM_WeightedBaseData(const afxXM_WeightedBaseData& other, bool temp_clone) : afxXM_BaseData(other, temp_clone) +{ + delay = other.delay; + lifetime = other.lifetime; + fade_in_time = other.fade_in_time; + fade_out_time = other.fade_out_time; + fadein_ease = other.fadein_ease; + fadeout_ease = other.fadeout_ease; + life_bias = other.life_bias; +} + +bool afxXM_WeightedBaseData::hasFixedWeight() const +{ + return (delay == 0.0f && lifetime == afxEffectDefs::INFINITE_LIFETIME && fade_in_time == 0.0f && fade_out_time == 0.0f); +} + +F32 afxXM_WeightedBaseData::getWeightFactor() const +{ + return 1.0f; +} + +void afxXM_WeightedBaseData::initPersistFields() +{ + addField("delay", TypeF32, Offset(delay, afxXM_WeightedBaseData), + "..."); + addField("lifetime", TypeF32, Offset(lifetime, afxXM_WeightedBaseData), + "..."); + addField("fadeInTime", TypeF32, Offset(fade_in_time, afxXM_WeightedBaseData), + "..."); + addField("fadeOutTime", TypeF32, Offset(fade_out_time, afxXM_WeightedBaseData), + "..."); + addField("fadeInEase", TypePoint2F, Offset(fadein_ease, afxXM_WeightedBaseData), + "..."); + addField("fadeOutEase", TypePoint2F, Offset(fadeout_ease, afxXM_WeightedBaseData), + "..."); + addField("lifetimeBias", TypeF32, Offset(life_bias, afxXM_WeightedBaseData), + "..."); + + Parent::initPersistFields(); +} + +void afxXM_WeightedBaseData::packData(BitStream* stream) +{ + Parent::packData(stream); + + if (stream->writeFlag(!hasFixedWeight())) + { + stream->write(delay); + stream->write(lifetime); + stream->write(fade_in_time); + stream->write(fade_out_time); + if (stream->writeFlag(fadein_ease.x != 0.0f || fadein_ease.y != 1.0f)) + { + stream->writeFloat(fadein_ease.x, 16); + stream->writeFloat(fadein_ease.y, 16); + } + if (stream->writeFlag(fadeout_ease.x != 0.0f || fadeout_ease.y != 1.0f)) + { + stream->writeFloat(fadeout_ease.x, 16); + stream->writeFloat(fadeout_ease.y, 16); + } + stream->write(life_bias); + } +} + +void afxXM_WeightedBaseData::unpackData(BitStream* stream) +{ + Parent::unpackData(stream); + + if (stream->readFlag()) // WEIGHTED? + { + stream->read(&delay); + stream->read(&lifetime); + stream->read(&fade_in_time); + stream->read(&fade_out_time); + if (stream->readFlag()) // FADE-IN EASED? + { + fadein_ease.x = stream->readFloat(16); + fadein_ease.y = stream->readFloat(16); + } + else + fadein_ease.set(0.0f, 1.0f); + if (stream->readFlag()) // FADE-OUT EASED? + { + fadeout_ease.x = stream->readFloat(16); + fadeout_ease.y = stream->readFloat(16); + } + else + fadeout_ease.set(0.0f, 1.0f); + stream->read(&life_bias); + } + else + { + delay = 0.0f; + lifetime = afxEffectDefs::INFINITE_LIFETIME; + fade_in_time = 0.0f; + fade_out_time = 0.0f; + fadein_ease.set(0.0f, 1.0f); + fadeout_ease.set(0.0f, 1.0f); + life_bias = 1.0f; + } +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// + +afxXM_WeightedBase::afxXM_WeightedBase(afxXM_WeightedBaseData* db, afxEffectWrapper* fxw) +: afxXM_Base(db, fxw) +{ + wt_fadein = db->fade_in_time*db->life_bias; + wt_fadeout = db->fade_out_time*db->life_bias; + wt_fadein_ease = db->fadein_ease; + wt_fadeout_ease = db->fadeout_ease; + wt_start_time = db->delay; + wt_full_time = wt_start_time + wt_fadein; + wt_fade_time = wt_start_time + db->lifetime*db->life_bias; + wt_done_time = wt_fade_time + wt_fadeout; +} + +F32 afxXM_WeightedBase::calc_weight_factor(F32 elapsed) +{ + if (elapsed < wt_start_time) // pre + return 0.0f; + else if (elapsed < wt_full_time) // fade-in + { + F32 t = (elapsed - wt_start_time)/wt_fadein; + return afxEase::t(t, wt_fadein_ease.x, wt_fadein_ease.y); + } + else if (elapsed < wt_fade_time) // full + return 1.0f; + else if (elapsed < wt_done_time) // fade-out + { + F32 t = (wt_done_time - elapsed)/wt_fadeout; + return afxEase::t(t, wt_fadeout_ease.x, wt_fadeout_ease.y); + } + else // post + return 0; +} + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + + diff --git a/Engine/source/afx/xm/afxXfmMod.h b/Engine/source/afx/xm/afxXfmMod.h new file mode 100644 index 000000000..7c7eaa41d --- /dev/null +++ b/Engine/source/afx/xm/afxXfmMod.h @@ -0,0 +1,176 @@ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +// +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#ifndef _AFX_XFM_MOD_BASE_H_ +#define _AFX_XFM_MOD_BASE_H_ + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "math/mPoint3.h" +#include "math/mMatrix.h" +#include "math/mMathFn.h" + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// BASE CLASSES +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class BitStream; +class afxEffectWrapper; + +class afxXM_Defs +{ +public: + enum + { + POSITION = BIT(0), + ORIENTATION = BIT(1), + POSITION2 = BIT(2), + SCALE = BIT(3), + COLOR = BIT(4), + VISIBILITY = BIT(5), + ALL_BUT_SCALE = (POSITION | ORIENTATION | POSITION2), + ALL = (ALL_BUT_SCALE | SCALE), + }; +}; + +struct afxXM_Params : public afxXM_Defs +{ + Point3F pos; + MatrixF ori; + Point3F scale; + Point3F pos2; + LinearColorF color; + F32 vis; + + enum { BAD_OFFSET = S32_MAX }; + + static U32 getParameterOffset(U32 param, S32 component=-1); + afxXM_Params(); +}; + +class afxXM_Base; + +class afxXM_BaseData : public GameBaseData, public afxXM_Defs +{ + typedef GameBaseData Parent; + +public: + bool ignore_time_factor; + +public: + /*C*/ afxXM_BaseData(); + /*C*/ afxXM_BaseData(const afxXM_BaseData&, bool = false); + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + static void initPersistFields(); + + virtual afxXM_Base* create(afxEffectWrapper* fx, bool on_server) { return 0; } + + DECLARE_CONOBJECT(afxXM_BaseData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_Base : public afxXM_Defs +{ +protected: + afxEffectWrapper* fx_wrapper; + afxXM_BaseData* datablock; + F32 time_factor; + +public: + /*C*/ afxXM_Base(afxXM_BaseData*, afxEffectWrapper*); + virtual ~afxXM_Base(); + + virtual void start(F32 timestamp) { } + virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& p); + + // old update form for backwards compatibility (deprecated) + virtual void update(F32 dt, F32 elapsed, Point3F& pos, MatrixF& ori, Point3F& pos2, Point3F& scale) { }; +}; + +// New subclasses should define own updateParams() and should *not* call this thru Parent. +// This calls old form of update() for backwards compatibility. +inline void afxXM_Base::updateParams(F32 dt, F32 elapsed, afxXM_Params& p) +{ + update(dt, elapsed, p.pos, p.ori, p.pos2, p.scale); +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +class afxXM_WeightedBaseData : public afxXM_BaseData +{ + typedef afxXM_BaseData Parent; + +public: + F32 lifetime; + F32 delay; + F32 fade_in_time; + F32 fade_out_time; + Point2F fadein_ease; + Point2F fadeout_ease; + F32 life_bias; + +public: + /*C*/ afxXM_WeightedBaseData(); + /*C*/ afxXM_WeightedBaseData(const afxXM_WeightedBaseData&, bool = false); + + bool hasFixedWeight() const; + F32 getWeightFactor() const; + + void packData(BitStream* stream); + void unpackData(BitStream* stream); + + static void initPersistFields(); + + DECLARE_CONOBJECT(afxXM_WeightedBaseData); + DECLARE_CATEGORY("AFX"); +}; + +class afxXM_WeightedBase : public afxXM_Base +{ + typedef afxXM_Base Parent; + +protected: + F32 wt_fadein; + F32 wt_fadeout; + Point2F wt_fadein_ease; + Point2F wt_fadeout_ease; + F32 wt_start_time; + F32 wt_full_time; + F32 wt_fade_time; + F32 wt_done_time; + + F32 calc_weight_factor(F32 elapsed); + +public: + /*C*/ afxXM_WeightedBase(afxXM_WeightedBaseData*, afxEffectWrapper*); + virtual ~afxXM_WeightedBase() { } +}; + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#endif // _AFX_XFM_MOD_BASE_H_ From 9391fcad4e836039042108415e098a0cab737425 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 20:01:44 +0100 Subject: [PATCH 003/312] core -- heartbeat call to arcaneFX::advanceTime() from within clientProcess(). misc -- various other function references --- Engine/source/T3D/fx/particle.h | 8 ++++ Engine/source/T3D/player.cpp | 72 +++++++++++++++++++++++++++++++++ Engine/source/T3D/player.h | 10 +++++ Engine/source/app/game.cpp | 10 +++++ 4 files changed, 100 insertions(+) diff --git a/Engine/source/T3D/fx/particle.h b/Engine/source/T3D/fx/particle.h index 35a0c9792..36b8dd11a 100644 --- a/Engine/source/T3D/fx/particle.h +++ b/Engine/source/T3D/fx/particle.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _PARTICLE_H_ #define _PARTICLE_H_ @@ -97,6 +102,9 @@ class ParticleData : public SimDataBlock static void initPersistFields(); bool reload(char errorBuffer[256]); + public: + bool loadParameters(); + bool reload(String &errorStr); }; //***************************************************************************** diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 6b4e00aef..832937f0e 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/player.h" @@ -1656,6 +1660,8 @@ Player::Player() mLastAbsoluteYaw = 0.0f; mLastAbsolutePitch = 0.0f; mLastAbsoluteRoll = 0.0f; + + afx_init(); } Player::~Player() @@ -6188,6 +6194,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream) mArmAnimation.action != mDataBlock->lookAction))) { stream->writeInt(mArmAnimation.action,PlayerData::ActionAnimBits); } + retMask = afx_packUpdate(con, mask, stream, retMask); // The rest of the data is part of the control object packet update. // If we're controlled by this client, we don't need to send it. @@ -6292,6 +6299,7 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) mArmAnimation.action = action; } + afx_unpackUpdate(con, stream); // Done if controlled by client ( and not initial update ) if(stream->readFlag()) return; @@ -6819,6 +6827,7 @@ void Player::consoleInit() Con::addVariable("$player::extendedMoveHeadPosRotIndex", TypeS32, &smExtendedMoveHeadPosRotIndex, "@brief The ExtendedMove position/rotation index used for head movements.\n\n" "@ingroup GameObjects\n"); + afx_consoleInit(); } //-------------------------------------------------------------------------- @@ -7172,6 +7181,69 @@ void Player::renderConvex( ObjectRenderInst *ri, SceneRenderState *state, BaseMa GFX->leaveDebugEvent(); } +// static +bool Player::sCorpsesHiddenFromRayCast = true; // this default matches stock Torque behavior. + +// static +void Player::afx_consoleInit() +{ + Con::addVariable("pref::Player::corpsesHiddenFromRayCast", TypeBool, &sCorpsesHiddenFromRayCast); +} + +void Player::afx_init() +{ + overrideLookAnimation = false; + armLookOverridePos = 0.5f; + headVLookOverridePos = 0.5f; + headHLookOverridePos = 0.5f; + ignore_updates = false; + fx_c_triggers = 0; + mark_fx_c_triggers = 0; + fx_s_triggers = 0; + move_trigger_states = 0; + z_velocity = 0.0f; + mark_idle = false; + idle_timer = 0.0f; + mark_s_landing = false; + speed_bias = 1.0f; + speed_bias_goal = 1.0f; + override_movement = 0; + movement_data.zero(); + movement_op = 1; + last_movement_tag = 0; + footfallDecalOverride = 0; + footfallSoundOverride = 0; + footfallDustOverride = 0; + noFootfallFX = false; +} + +U32 Player::afx_packUpdate(NetConnection* con, U32 mask, BitStream* stream, U32 retMask) +{ +#if 0 + if (stream->writeFlag(mask & LookOverrideMask)) +#else + if (stream->writeFlag(mask & ActionMask)) +#endif + stream->writeFlag(overrideLookAnimation); + + if (stream->writeFlag(mask & TriggerMask)) + stream->write(fx_s_triggers); + + return retMask; +} + +void Player::afx_unpackUpdate(NetConnection* con, BitStream* stream) +{ + if (stream->readFlag()) // LookOverrideMask + overrideLookAnimation = stream->readFlag(); + + if (stream->readFlag()) // TriggerMask + { + U32 mask; + stream->read(&mask); + mark_fx_c_triggers = mask; + } +} #ifdef TORQUE_OPENVR void Player::setControllers(Vector controllerList) { diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index ac10f2db9..a49f3baf4 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _PLAYER_H_ #define _PLAYER_H_ @@ -780,6 +785,11 @@ public: virtual void prepRenderImage( SceneRenderState* state ); virtual void renderConvex( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat ); virtual void renderMountedImage( U32 imageSlot, TSRenderState &rstate, SceneRenderState *state ); +private: + static void afx_consoleInit(); + void afx_init(); + U32 afx_packUpdate(NetConnection*, U32 mask, BitStream*, U32 retMask); + void afx_unpackUpdate(NetConnection*, BitStream*); }; typedef Player::Pose PlayerPose; diff --git a/Engine/source/app/game.cpp b/Engine/source/app/game.cpp index 5b2070887..b2b107d8c 100644 --- a/Engine/source/app/game.cpp +++ b/Engine/source/app/game.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "platform/platformInput.h" @@ -49,6 +54,8 @@ #include "gfx/gfxTextureManager.h" #include "sfx/sfxSystem.h" +// Including this header provides access to certain system-level AFX methods. +#include "afx/arcaneFX.h" #ifdef TORQUE_PLAYER // See matching #ifdef in editor/editor.cpp bool gEditingMission = false; @@ -235,6 +242,9 @@ ConsoleFunctionGroupEnd(Platform); bool clientProcess(U32 timeDelta) { + // Required heartbeat call on the client side which must come + // before the advanceTime() calls are made to the scene objects. + arcaneFX::advanceTime(timeDelta); bool ret = true; #ifndef TORQUE_TGB_ONLY From 0b84fccdd26358b5d5b047e7da1899b402b0ec5e Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 20:18:27 +0100 Subject: [PATCH 004/312] substitutions -- Implementation of special substitution statements on datablock fields. --- Engine/source/T3D/debris.cpp | 7 + Engine/source/T3D/fx/explosion.cpp | 10 + Engine/source/T3D/fx/particleEmitter.cpp | 7 + Engine/source/T3D/projectile.cpp | 11 + Engine/source/T3D/shapeBase.cpp | 8 + Engine/source/console/compiledEval.cpp | 13 + Engine/source/console/consoleObject.cpp | 37 +++ Engine/source/console/consoleObject.h | 10 + Engine/source/console/simDatablock.cpp | 291 ++++++++++++++++++++++- Engine/source/console/simDatablock.h | 30 +++ Engine/source/console/simObject.cpp | 37 +++ Engine/source/sfx/sfxProfile.cpp | 7 + 12 files changed, 464 insertions(+), 4 deletions(-) diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 61ec9c3b6..3d7554f26 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/debris.h" @@ -269,6 +273,9 @@ void DebrisData::initPersistFields() addField("ignoreWater", TypeBool, Offset(ignoreWater, DebrisData), "If true, this debris object will not collide with water, acting as if the water is not there."); endGroup("Behavior"); + // disallow some field substitutions + onlyKeepClearSubstitutions("emitters"); // subs resolving to "~~", or "~0" are OK + onlyKeepClearSubstitutions("explosion"); Parent::initPersistFields(); } diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index e4daaf077..7eca7f532 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/fx/explosion.h" @@ -412,6 +416,12 @@ void ExplosionData::initPersistFields() "Distance (in the explosion normal direction) of the PointLight position " "from the explosion center." ); + // disallow some field substitutions + onlyKeepClearSubstitutions("debris"); // subs resolving to "~~", or "~0" are OK + onlyKeepClearSubstitutions("emitter"); + onlyKeepClearSubstitutions("particleEmitter"); + onlyKeepClearSubstitutions("soundProfile"); + onlyKeepClearSubstitutions("subExplosion"); Parent::initPersistFields(); } diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index 63d590bad..0f164f42b 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/fx/particleEmitter.h" @@ -293,6 +297,9 @@ void ParticleEmitterData::initPersistFields() endGroup( "ParticleEmitterData" ); + // disallow some field substitutions + disableFieldSubstitutions("particles"); + onlyKeepClearSubstitutions("poolData"); // subs resolving to "~~", or "~0" are OK Parent::initPersistFields(); } diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index 61821cbde..f5003c1e5 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/projectile.h" @@ -274,6 +278,13 @@ void ProjectileData::initPersistFields() "A value of 1.0 will assume \"normal\" influence upon it.\n" "The magnitude of gravity is assumed to be 9.81 m/s/s\n\n" "@note ProjectileData::isBallistic must be true for this to have any affect."); + // disallow some field substitutions + onlyKeepClearSubstitutions("explosion"); + onlyKeepClearSubstitutions("particleEmitter"); + onlyKeepClearSubstitutions("particleWaterEmitter"); + onlyKeepClearSubstitutions("sound"); + onlyKeepClearSubstitutions("splash"); + onlyKeepClearSubstitutions("waterExplosion"); Parent::initPersistFields(); } diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index e612aa148..445ca4b90 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/shapeBase.h" @@ -586,6 +590,10 @@ void ShapeBaseData::initPersistFields() endGroup( "Reflection" ); + // disallow some field substitutions + onlyKeepClearSubstitutions("debris"); // subs resolving to "~~", or "~0" are OK + onlyKeepClearSubstitutions("explosion"); + onlyKeepClearSubstitutions("underwaterExplosion"); Parent::initPersistFields(); } diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index f189d6268..38f1ec589 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "console/console.h" @@ -858,6 +862,7 @@ breakContinue: Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-datablock class %s.", getFileLine(ip), (const char*)callArgv[1]); // Clean up... delete object; + currentNewObject = NULL; ip = failJump; break; } @@ -893,6 +898,14 @@ breakContinue: currentNewObject->setCopySource( parent ); currentNewObject->assignFieldsFrom( parent ); + // copy any substitution statements + SimDataBlock* parent_db = dynamic_cast(parent); + if (parent_db) + { + SimDataBlock* currentNewObject_db = dynamic_cast(currentNewObject); + if (currentNewObject_db) + currentNewObject_db->copySubstitutionsFrom(parent_db); + } } else { diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 2d9ba2a1e..d75405376 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "console/consoleObject.h" @@ -681,6 +685,39 @@ AbstractClassRep* ConsoleObject::getClassRep() const return NULL; } +bool ConsoleObject::disableFieldSubstitutions(const char* fieldname) +{ + StringTableEntry slotname = StringTable->insert(fieldname); + + for (U32 i = 0; i < sg_tempFieldList.size(); i++) + { + if (sg_tempFieldList[i].pFieldname == slotname) + { + sg_tempFieldList[i].doNotSubstitute = true; + sg_tempFieldList[i].keepClearSubsOnly = false; + return true; + } + } + + return false; +} + +bool ConsoleObject::onlyKeepClearSubstitutions(const char* fieldname) +{ + StringTableEntry slotname = StringTable->insert(fieldname); + + for (U32 i = 0; i < sg_tempFieldList.size(); i++) + { + if (sg_tempFieldList[i].pFieldname == slotname) + { + sg_tempFieldList[i].doNotSubstitute = false; + sg_tempFieldList[i].keepClearSubsOnly = true; + return true; + } + } + + return false; +} String ConsoleObject::_getLogMessage(const char* fmt, va_list args) const { String objClass = "UnknownClass"; diff --git a/Engine/source/console/consoleObject.h b/Engine/source/console/consoleObject.h index adef30e77..36ec5d718 100644 --- a/Engine/source/console/consoleObject.h +++ b/Engine/source/console/consoleObject.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _CONSOLEOBJECT_H_ #define _CONSOLEOBJECT_H_ @@ -492,6 +496,7 @@ public: setDataFn( NULL ), getDataFn( NULL ) { + doNotSubstitute = keepClearSubsOnly = false; } StringTableEntry pFieldname; ///< Name of the field. @@ -509,6 +514,8 @@ public: TypeValidator *validator; ///< Validator, if any. SetDataNotify setDataFn; ///< Set data notify Fn GetDataNotify getDataFn; ///< Get data notify Fn + bool doNotSubstitute; + bool keepClearSubsOnly; WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not. }; typedef Vector FieldList; @@ -1054,6 +1061,9 @@ public: static ConsoleObject* __findObject( const char* ) { return NULL; } static const char* __getObjectId( ConsoleObject* ) { return ""; } +protected: + static bool disableFieldSubstitutions(const char* in_pFieldname); + static bool onlyKeepClearSubstitutions(const char* in_pFieldname); }; #define addNamedField(fieldName,type,className) addField(#fieldName, type, Offset(fieldName,className)) diff --git a/Engine/source/console/simDatablock.cpp b/Engine/source/console/simDatablock.cpp index a10ba1761..ce689c054 100644 --- a/Engine/source/console/simDatablock.cpp +++ b/Engine/source/console/simDatablock.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "console/simDatablock.h" @@ -29,6 +33,8 @@ #include "T3D/gameBase/gameConnectionEvents.h" #include "T3D/gameBase/gameConnection.h" +#include "core/stream/bitStream.h" +#include "console/compiler.h" IMPLEMENT_CO_DATABLOCK_V1(SimDataBlock); SimObjectId SimDataBlock::sNextObjectId = DataBlockObjectIdFirst; @@ -52,6 +58,260 @@ SimDataBlock::SimDataBlock() setModDynamicFields(true); setModStaticFields(true); } +// this implements a simple structure for managing substitution statements. + +SimDataBlock::SubstitutionStatement::SubstitutionStatement(StringTableEntry slot, S32 idx, const char* value) +{ + this->slot = slot; + this->idx = idx; + this->value = dStrdup(value); +} + +SimDataBlock::SubstitutionStatement::~SubstitutionStatement() +{ + dFree(value); +} + +void SimDataBlock::SubstitutionStatement::replaceValue(const char* value) +{ + dFree(this->value); + this->value = dStrdup(value); +} + +// this is the copy-constructor for creating temp-clones. +SimDataBlock::SimDataBlock(const SimDataBlock& other, bool temp_clone) : SimObject(other, temp_clone) +{ + modifiedKey = other.modifiedKey; +} + +// a destructor is added to SimDataBlock so that we can delete any substitutions. +SimDataBlock::~SimDataBlock() +{ + clear_substitutions(); +} + +void SimDataBlock::clear_substitutions() +{ + for (S32 i = 0; i < substitutions.size(); i++) + delete substitutions[i]; + substitutions.clear(); +} + +void SimDataBlock::addSubstitution(StringTableEntry slot, S32 idx, const char* subst) +{ + AssertFatal(subst != 0 && subst[0] == '$' && subst[1] == '$', "Bad substition statement string added"); + + subst += 2; + while (dIsspace(*subst)) + subst++; + + bool empty_subs = (*subst == '\0'); + + for (S32 i = 0; i < substitutions.size(); i++) + { + if (substitutions[i] && substitutions[i]->slot == slot && substitutions[i]->idx == idx) + { + if (empty_subs) + { + delete substitutions[i]; + substitutions[i] = 0; + onRemoveSubstitution(slot, idx); + } + else + { + substitutions[i]->replaceValue(subst); + onAddSubstitution(slot, idx, subst); + } + return; + } + } + + if (!empty_subs) + { + substitutions.push_back(new SubstitutionStatement(slot, idx, subst)); + onAddSubstitution(slot, idx, subst); + } +} + +const char* SimDataBlock::getSubstitution(StringTableEntry slot, S32 idx) +{ + for (S32 i = 0; i < substitutions.size(); i++) + { + if (substitutions[i] && substitutions[i]->slot == slot && substitutions[i]->idx == idx) + return substitutions[i]->value; + } + + return 0; +} + +bool SimDataBlock::fieldHasSubstitution(StringTableEntry slot) +{ + for (S32 i = 0; i < substitutions.size(); i++) + if (substitutions[i] && substitutions[i]->slot == slot) + return true; + return false; +} + +void SimDataBlock::printSubstitutions() +{ + for (S32 i = 0; i < substitutions.size(); i++) + if (substitutions[i]) + Con::errorf("SubstitutionStatement[%s] = \"%s\" -- %d", substitutions[i]->slot, substitutions[i]->value, i); +} + +void SimDataBlock::copySubstitutionsFrom(SimDataBlock* other) +{ + clear_substitutions(); + if (!other) + return; + + for (S32 i = 0; i < other->substitutions.size(); i++) + { + if (other->substitutions[i]) + { + SubstitutionStatement* subs = other->substitutions[i]; + substitutions.push_back(new SubstitutionStatement(subs->slot, subs->idx, subs->value)); + } + } +} + + +// This is the method that evaluates any substitution statements on a datablock and does the +// actual replacement of substituted datablock fields. +// +// Much of the work is done by passing the statement to Con::evaluate() but first there are +// some key operations performed on the statement. +// -- Instances of "%%" in the statement are replaced with the id of the object. +// -- Instances of "##" are replaced with the value of . +// +// There are also some return values that get special treatment. +// -- An empty result will produce a realtime error message. +// -- A result of "~~" will leave the original field value unchanged. +// -- A result of "~0" will clear the original field to "" without producing an error message. +// +void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* obj, S32 index) +{ + if (!dblock || !dblock->getClassRep()) + { + // error message + return; + } + + char obj_str[32]; + dStrcpy(obj_str, Con::getIntArg(obj->getId())); + + char index_str[32]; + dStrcpy(index_str, Con::getIntArg(index)); + + for (S32 i = 0; i < substitutions.size(); i++) + { + if (substitutions[i]) + { + static char buffer[1024]; + static char* b_oob = &buffer[1024]; + char* b = buffer; + + // perform special token expansion (%% and ##) + const char* v = substitutions[i]->value; + while (*v != '\0') + { + // identify "%%" tokens and replace with id + if (v[0] == '%' && v[1] == '%') + { + const char* s = obj_str; + while (*s != '\0') + { + b[0] = s[0]; + b++; + s++; + } + v += 2; + } + // identify "##" tokens and replace with value + else if (v[0] == '#' && v[1] == '#') + { + const char* s = index_str; + while (*s != '\0') + { + b[0] = s[0]; + b++; + s++; + } + v += 2; + } + else + { + b[0] = v[0]; + b++; + v++; + } + } + + AssertFatal((uintptr_t)b < (uintptr_t)b_oob, "Substitution buffer overflowed"); + + b[0] = '\0'; + + // perform the statement evaluation + Compiler::gSyntaxError = false; + //Con::errorf("EVAL [%s]", avar("return %s;", buffer)); + const char *result = Con::evaluate(avar("return %s;", buffer), false, 0); + if (Compiler::gSyntaxError) + { + Con::errorf("Field Substitution Failed: field=\"%s\" substitution=\"%s\" -- syntax error", + substitutions[i]->slot, substitutions[i]->value); + Compiler::gSyntaxError = false; + return; + } + + // output a runtime console error when a substitution produces and empty result. + if (result == 0 || result[0] == '\0') + { + Con::errorf("Field Substitution Failed: field=\"%s\" substitution=\"%s\" -- empty result", + substitutions[i]->slot, substitutions[i]->value); + return; + } + + // handle special return values + if (result[0] == '~') + { + // if value is "~~" then keep the existing value + if (result[1] == '~' && result[2] == '\0') + continue; + // if "~0" then clear it + if (result[1] == '0' && result[2] == '\0') + result = ""; + } + + const AbstractClassRep::Field* field = dblock->getClassRep()->findField(substitutions[i]->slot); + if (!field) + { + // this should be very unlikely... + Con::errorf("Field Substitution Failed: unknown field, \"%s\".", substitutions[i]->slot); + continue; + } + + if (field->keepClearSubsOnly && result[0] != '\0') + { + Con::errorf("Field Substitution Failed: field \"%s\" of datablock %s only allows \"$$ ~~\" (keep) and \"$$ ~0\" (clear) field substitutions. [%s]", + substitutions[i]->slot, this->getClassName(), this->getName()); + continue; + } + + // substitute the field value with its replacement + Con::setData(field->type, (void*)(((const char*)(dblock)) + field->offset), substitutions[i]->idx, 1, &result, field->table, field->flag); + + //dStrncpy(buffer, result, 255); + //Con::errorf("SUBSTITUTION %s.%s[%d] = %s idx=%s", Con::getIntArg(getId()), substitutions[i]->slot, substitutions[i]->idx, buffer, index_str); + + // notify subclasses of a field modification + dblock->onStaticModified(substitutions[i]->slot); + } + } + + // notify subclasses of substitution operation + if (substitutions.size() > 0) + dblock->onPerformSubstitutions(); +} //----------------------------------------------------------------------------- @@ -96,14 +356,37 @@ void SimDataBlock::onStaticModified(const char* slotName, const char* newValue) //----------------------------------------------------------------------------- -void SimDataBlock::packData(BitStream*) +// packData() and unpackData() do nothing in the stock implementation, but here +// they've been modified to pack and unpack any substitution statements. +// +void SimDataBlock::packData(BitStream* stream) { + for (S32 i = 0; i < substitutions.size(); i++) + { + if (substitutions[i]) + { + stream->writeFlag(true); + stream->writeString(substitutions[i]->slot); + stream->write(substitutions[i]->idx); + stream->writeString(substitutions[i]->value); + } + } + stream->writeFlag(false); } -//----------------------------------------------------------------------------- - -void SimDataBlock::unpackData(BitStream*) +void SimDataBlock::unpackData(BitStream* stream) { + clear_substitutions(); + while(stream->readFlag()) + { + char slotName[256]; + S32 idx; + char value[256]; + stream->readString(slotName); + stream->read(&idx); + stream->readString(value); + substitutions.push_back(new SubstitutionStatement(StringTable->insert(slotName), idx, value)); + } } //----------------------------------------------------------------------------- diff --git a/Engine/source/console/simDatablock.h b/Engine/source/console/simDatablock.h index 3d7acc777..d6a7dcd52 100644 --- a/Engine/source/console/simDatablock.h +++ b/Engine/source/console/simDatablock.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _SIMDATABLOCK_H_ #define _SIMDATABLOCK_H_ @@ -172,6 +176,32 @@ public: /// Used by the console system to automatically tell datablock classes apart /// from non-datablock classes. static const bool __smIsDatablock = true; +protected: + struct SubstitutionStatement + { + StringTableEntry slot; + S32 idx; + char* value; + SubstitutionStatement(StringTableEntry slot, S32 idx, const char* value); + ~SubstitutionStatement(); + void replaceValue(const char* value); + }; + Vector substitutions; + void clear_substitutions(); +public: + /*C*/ SimDataBlock(const SimDataBlock&, bool = false); + /*D*/ ~SimDataBlock(); + + void addSubstitution(StringTableEntry field, S32 idx, const char* subst); + const char* getSubstitution(StringTableEntry field, S32 idx); + S32 getSubstitutionCount() { return substitutions.size(); } + void performSubstitutions(SimDataBlock*, const SimObject*, S32 index=0); + void copySubstitutionsFrom(SimDataBlock* other); + void printSubstitutions(); + bool fieldHasSubstitution(StringTableEntry slot); + virtual void onAddSubstitution(StringTableEntry, S32 idx, const char* subst) { } + virtual void onRemoveSubstitution(StringTableEntry, S32 idx) { } + virtual void onPerformSubstitutions() { } }; //--------------------------------------------------------------------------- diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 73a1ffa3d..22e496bbf 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "platform/platformMemory.h" #include "console/simObject.h" @@ -915,6 +919,29 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const S32 array1 = array ? dAtoi(array) : 0; + // Here we check to see if is a datablock and if + // starts with "$$". If both true than save value as a runtime substitution. + if (dynamic_cast(this) && value[0] == '$' && value[1] == '$') + { + if (!this->allowSubstitutions()) + { + Con::errorf("Substitution Error: %s datablocks do not allow \"$$\" field substitutions. [%s]", + this->getClassName(), this->getName()); + return; + } + + if (fld->doNotSubstitute) + { + Con::errorf("Substitution Error: field \"%s\" of datablock %s prohibits \"$$\" field substitutions. [%s]", + slotName, this->getClassName(), this->getName()); + return; + } + + // add the substitution + ((SimDataBlock*)this)->addSubstitution(slotName, array1, value); + return; + } + if(array1 >= 0 && array1 < fld->elementCount && fld->elementCount >= 1) { // If the set data notify callback returns true, then go ahead and @@ -2612,6 +2639,16 @@ DefineEngineMethod( SimObject, dump, void, ( bool detailed ), ( false ), } } + // If the object is a datablock with substitution statements, + // they get printed out as part of the dump. + if (dynamic_cast(object)) + { + if (((SimDataBlock*)object)->getSubstitutionCount() > 0) + { + Con::printf("Substitution Fields:"); + ((SimDataBlock*)object)->printSubstitutions(); + } + } Con::printf( "Dynamic Fields:" ); if(object->getFieldDictionary()) object->getFieldDictionary()->printFields(object); diff --git a/Engine/source/sfx/sfxProfile.cpp b/Engine/source/sfx/sfxProfile.cpp index bbb40c249..2fff6854d 100644 --- a/Engine/source/sfx/sfxProfile.cpp +++ b/Engine/source/sfx/sfxProfile.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "sfx/sfxProfile.h" @@ -114,6 +118,9 @@ void SFXProfile::initPersistFields() endGroup( "Sound" ); + // disallow some field substitutions + disableFieldSubstitutions("description"); + Parent::initPersistFields(); } From f9f05f154f62f51beeeac4eaf9807008dce70af0 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 21:10:43 +0100 Subject: [PATCH 005/312] datablock-temp-clone -- Implements creation of temporary datablock clones to allow late substitution of datablock fields. --- Engine/source/T3D/debris.cpp | 94 ++++++++++++++- Engine/source/T3D/debris.h | 16 +++ Engine/source/T3D/fx/explosion.cpp | 140 ++++++++++++++++++++- Engine/source/T3D/fx/explosion.h | 17 +++ Engine/source/T3D/fx/particle.cpp | 80 ++++++++++++ Engine/source/T3D/fx/particle.h | 4 + Engine/source/T3D/fx/particleEmitter.cpp | 147 +++++++++++++++++++++++ Engine/source/T3D/fx/particleEmitter.h | 9 ++ Engine/source/T3D/gameBase/gameBase.cpp | 13 ++ Engine/source/T3D/gameBase/gameBase.h | 6 + Engine/source/T3D/projectile.cpp | 41 +++++++ Engine/source/T3D/projectile.h | 7 ++ Engine/source/T3D/shapeBase.cpp | 60 +++++++++ Engine/source/T3D/shapeBase.h | 6 + Engine/source/T3D/staticShape.cpp | 12 ++ Engine/source/T3D/staticShape.h | 9 ++ Engine/source/console/simObject.cpp | 42 +++++++ Engine/source/console/simObject.h | 10 ++ Engine/source/sfx/sfxDescription.cpp | 35 ++++++ Engine/source/sfx/sfxDescription.h | 7 ++ Engine/source/sfx/sfxProfile.cpp | 96 ++++++++++++++- Engine/source/sfx/sfxProfile.h | 10 ++ Engine/source/sfx/sfxTrack.cpp | 9 ++ Engine/source/sfx/sfxTrack.h | 6 + 24 files changed, 865 insertions(+), 11 deletions(-) diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 3d7554f26..02b475c80 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -117,6 +117,85 @@ DebrisData::DebrisData() ignoreWater = true; } +//#define TRACK_DEBRIS_DATA_CLONES + +#ifdef TRACK_DEBRIS_DATA_CLONES +static int debris_data_clones = 0; +#endif + +DebrisData::DebrisData(const DebrisData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ +#ifdef TRACK_DEBRIS_DATA_CLONES + debris_data_clones++; + if (debris_data_clones == 1) + Con::errorf("DebrisData -- Clones are on the loose!"); +#endif + velocity = other.velocity; + velocityVariance = other.velocityVariance; + friction = other.friction; + elasticity = other.elasticity; + lifetime = other.lifetime; + lifetimeVariance = other.lifetimeVariance; + numBounces = other.numBounces; + bounceVariance = other.bounceVariance; + minSpinSpeed = other.minSpinSpeed; + maxSpinSpeed = other.maxSpinSpeed; + explodeOnMaxBounce = other.explodeOnMaxBounce; + staticOnMaxBounce = other.staticOnMaxBounce; + snapOnMaxBounce = other.snapOnMaxBounce; + fade = other.fade; + useRadiusMass = other.useRadiusMass; + baseRadius = other.baseRadius; + gravModifier = other.gravModifier; + terminalVelocity = other.terminalVelocity; + ignoreWater = other.ignoreWater; + shapeName = other.shapeName; + shape = other.shape; // -- TSShape loaded using shapeName + textureName = other.textureName; + explosionId = other.explosionId; // -- for pack/unpack of explosion ptr + explosion = other.explosion; + dMemcpy( emitterList, other.emitterList, sizeof( emitterList ) ); + dMemcpy( emitterIDList, other.emitterIDList, sizeof( emitterIDList ) ); // -- for pack/unpack of emitterList ptrs +} + +DebrisData::~DebrisData() +{ + if (!isTempClone()) + return; + +#ifdef TRACK_DEBRIS_DATA_CLONES + if (debris_data_clones > 0) + { + debris_data_clones--; + if (debris_data_clones == 0) + Con::errorf("DebrisData -- Clones eliminated!"); + } + else + Con::errorf("DebrisData -- Too many clones deleted!"); +#endif +} + +DebrisData* DebrisData::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + if (!owner || getSubstitutionCount() == 0) + return this; + + DebrisData* sub_debris_db = new DebrisData(*this, true); + performSubstitutions(sub_debris_db, owner, index); + + return sub_debris_db; +} + +void DebrisData::onPerformSubstitutions() +{ + if( shapeName && shapeName[0] != '\0') + { + shape = ResourceManager::get().load(shapeName); + if( bool(shape) == false ) + Con::errorf("DebrisData::onPerformSubstitutions(): failed to load shape \"%s\"", shapeName); + } +} + bool DebrisData::onAdd() { if(!Parent::onAdd()) @@ -458,6 +537,8 @@ Debris::Debris() // Only allocated client side. mNetFlags.set( IsGhost ); + ss_object = 0; + ss_index = 0; } Debris::~Debris() @@ -473,6 +554,12 @@ Debris::~Debris() delete mPart; mPart = NULL; } + + if (mDataBlock && mDataBlock->isTempClone()) + { + delete mDataBlock; + mDataBlock = 0; + } } void Debris::initPersistFields() @@ -502,6 +589,8 @@ bool Debris::onNewDataBlock( GameBaseData *dptr, bool reload ) if( !mDataBlock || !Parent::onNewDataBlock( dptr, reload ) ) return false; + if (mDataBlock->isTempClone()) + return true; scriptOnNewDataBlock(); return true; @@ -526,7 +615,7 @@ bool Debris::onAdd() if( mDataBlock->emitterList[i] != NULL ) { ParticleEmitter * pEmitter = new ParticleEmitter; - pEmitter->onNewDataBlock( mDataBlock->emitterList[i], false ); + pEmitter->onNewDataBlock(mDataBlock->emitterList[i]->cloneAndPerformSubstitutions(ss_object, ss_index), false); if( !pEmitter->registerObject() ) { Con::warnf( ConsoleLogEntry::General, "Could not register emitter for particle of class: %s", mDataBlock->getName() ); @@ -805,7 +894,8 @@ void Debris::explode() Point3F explosionPos = getPosition(); Explosion* pExplosion = new Explosion; - pExplosion->onNewDataBlock(mDataBlock->explosion, false); + pExplosion->setSubstitutionData(ss_object, ss_index); + pExplosion->onNewDataBlock(mDataBlock->explosion->cloneAndPerformSubstitutions(ss_object, ss_index), false); MatrixF trans( true ); trans.setPosition( getPosition() ); diff --git a/Engine/source/T3D/debris.h b/Engine/source/T3D/debris.h index 14cbd5e9f..87dcff2e9 100644 --- a/Engine/source/T3D/debris.h +++ b/Engine/source/T3D/debris.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _DEBRIS_H_ #define _DEBRIS_H_ @@ -97,6 +102,12 @@ struct DebrisData : public GameBaseData DECLARE_CONOBJECT(DebrisData); +public: + /*C*/ DebrisData(const DebrisData&, bool = false); + /*D*/ ~DebrisData(); + DebrisData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } }; //************************************************************************** @@ -165,6 +176,11 @@ public: DECLARE_CONOBJECT(Debris); +private: + SimObject* ss_object; + S32 ss_index; +public: + void setSubstitutionData(SimObject* obj, S32 idx=0) { ss_object = obj; ss_index = idx; } }; diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index 7eca7f532..0236da6e9 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/fx/explosion.h" @@ -54,6 +55,8 @@ #include "renderInstance/renderPassManager.h" #include "console/engineAPI.h" +#include "sfx/sfxProfile.h" + IMPLEMENT_CONOBJECT(Explosion); ConsoleDocClass( Explosion, @@ -285,6 +288,105 @@ ExplosionData::ExplosionData() lightNormalOffset = 0.1f; } +//#define TRACK_EXPLOSION_DATA_CLONES + +#ifdef TRACK_EXPLOSION_DATA_CLONES +static int explosion_data_clones = 0; +#endif + +ExplosionData::ExplosionData(const ExplosionData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ +#ifdef TRACK_EXPLOSION_DATA_CLONES + explosion_data_clones++; + if (explosion_data_clones == 1) + Con::errorf("ExplosionData -- Clones are on the loose!"); +#endif + + dtsFileName = other.dtsFileName; + faceViewer = other.faceViewer; + particleDensity = other.particleDensity; + particleRadius = other.particleRadius; + soundProfile = other.soundProfile; + particleEmitter = other.particleEmitter; + particleEmitterId = other.particleEmitterId; // -- for pack/unpack of particleEmitter ptr + explosionScale = other.explosionScale; + playSpeed = other.playSpeed; + explosionShape = other.explosionShape; // -- TSShape loaded using dtsFileName + explosionAnimation = other.explosionAnimation; // -- from explosionShape sequence "ambient" + dMemcpy( emitterList, other.emitterList, sizeof( emitterList ) ); + dMemcpy( emitterIDList, other.emitterIDList, sizeof( emitterIDList ) ); // -- for pack/unpack of emitterList ptrs + dMemcpy( debrisList, other.debrisList, sizeof( debrisList ) ); + dMemcpy( debrisIDList, other.debrisIDList, sizeof( debrisIDList ) ); // -- for pack/unpack of debrisList ptrs + debrisThetaMin = other.debrisThetaMin; + debrisThetaMax = other.debrisThetaMax; + debrisPhiMin = other.debrisPhiMin; + debrisPhiMax = other.debrisPhiMax; + debrisNum = other.debrisNum; + debrisNumVariance = other.debrisNumVariance; + debrisVelocity = other.debrisVelocity; + debrisVelocityVariance = other.debrisVelocityVariance; + dMemcpy( explosionList, other.explosionList, sizeof( explosionList ) ); + dMemcpy( explosionIDList, other.explosionIDList, sizeof( explosionIDList ) ); // -- for pack/unpack of explosionList ptrs + delayMS = other.delayMS; + delayVariance = other.delayVariance; + lifetimeMS = other.lifetimeMS; + lifetimeVariance = other.lifetimeVariance; + offset = other.offset; + dMemcpy( sizes, other.times, sizeof( sizes ) ); + dMemcpy( times, other.times, sizeof( times ) ); + shakeCamera = other.shakeCamera; + camShakeFreq = other.camShakeFreq; + camShakeAmp = other.camShakeAmp; + camShakeDuration = other.camShakeDuration; + camShakeRadius = other.camShakeRadius; + camShakeFalloff = other.camShakeFalloff; + lightStartRadius = other.lightStartRadius; + lightEndRadius = other.lightEndRadius; + lightStartColor = other.lightStartColor; + lightEndColor = other.lightEndColor; + lightStartBrightness = other.lightStartBrightness; + lightEndBrightness = other.lightEndBrightness; + lightNormalOffset = other.lightNormalOffset; + // Note - Explosion calls mDataBlock->getName() in warning messages but + // that should be safe. +} + +ExplosionData::~ExplosionData() +{ + if (!isTempClone()) + return; + + if (soundProfile && soundProfile->isTempClone()) + { + delete soundProfile; + soundProfile = 0; + } + + // particleEmitter, emitterList[*], debrisList[*], explosionList[*] will delete themselves + +#ifdef TRACK_EXPLOSION_DATA_CLONES + if (explosion_data_clones > 0) + { + explosion_data_clones--; + if (explosion_data_clones == 0) + Con::errorf("ExplosionData -- Clones eliminated!"); + } + else + Con::errorf("ExplosionData -- Too many clones deleted!"); +#endif +} + +ExplosionData* ExplosionData::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + if (!owner || getSubstitutionCount() == 0) + return this; + + ExplosionData* sub_explosion_db = new ExplosionData(*this, true); + performSubstitutions(sub_explosion_db, owner, index); + + return sub_explosion_db; +} + void ExplosionData::initPersistFields() { addField( "explosionShape", TypeShapeFilename, Offset(dtsFileName, ExplosionData), @@ -818,6 +920,10 @@ Explosion::Explosion() mLight = LIGHTMGR->createLightInfo(); mNetFlags.set( IsGhost ); + ss_object = 0; + ss_index = 0; + mDataBlock = 0; + soundProfile_clone = 0; } Explosion::~Explosion() @@ -830,6 +936,18 @@ Explosion::~Explosion() } SAFE_DELETE(mLight); + + if (soundProfile_clone) + { + delete soundProfile_clone; + soundProfile_clone = 0; + } + + if (mDataBlock && mDataBlock->isTempClone()) + { + delete mDataBlock; + mDataBlock = 0; + } } @@ -988,6 +1106,8 @@ bool Explosion::onNewDataBlock( GameBaseData *dptr, bool reload ) if (!mDataBlock || !Parent::onNewDataBlock( dptr, reload )) return false; + if (mDataBlock->isTempClone()) + return true; scriptOnNewDataBlock(); return true; } @@ -1200,7 +1320,8 @@ void Explosion::launchDebris( Point3F &axis ) launchDir *= debrisVel; Debris *debris = new Debris; - debris->setDataBlock( mDataBlock->debrisList[0] ); + debris->setSubstitutionData(ss_object, ss_index); + debris->setDataBlock(mDataBlock->debrisList[0]->cloneAndPerformSubstitutions(ss_object, ss_index)); debris->setTransform( getTransform() ); debris->init( pos, launchDir ); @@ -1228,7 +1349,8 @@ void Explosion::spawnSubExplosions() { MatrixF trans = getTransform(); Explosion* pExplosion = new Explosion; - pExplosion->setDataBlock( mDataBlock->explosionList[i] ); + pExplosion->setSubstitutionData(ss_object, ss_index); + pExplosion->setDataBlock(mDataBlock->explosionList[i]->cloneAndPerformSubstitutions(ss_object, ss_index)); pExplosion->setTransform( trans ); pExplosion->setInitialState( trans.getPosition(), mInitialNormal, 1); if (!pExplosion->registerObject()) @@ -1266,12 +1388,18 @@ bool Explosion::explode() resetWorldBox(); } - if (mDataBlock->soundProfile) - SFX->playOnce( mDataBlock->soundProfile, &getTransform() ); + SFXProfile* sound_prof = dynamic_cast(mDataBlock->soundProfile); + if (sound_prof) + { + soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index); + SFX->playOnce( soundProfile_clone, &getTransform() ); + if (!soundProfile_clone->isTempClone()) + soundProfile_clone = 0; + } if (mDataBlock->particleEmitter) { mMainEmitter = new ParticleEmitter; - mMainEmitter->setDataBlock(mDataBlock->particleEmitter); + mMainEmitter->setDataBlock(mDataBlock->particleEmitter->cloneAndPerformSubstitutions(ss_object, ss_index)); mMainEmitter->registerObject(); mMainEmitter->emitParticles(getPosition(), mInitialNormal, mDataBlock->particleRadius, @@ -1283,7 +1411,7 @@ bool Explosion::explode() if( mDataBlock->emitterList[i] != NULL ) { ParticleEmitter * pEmitter = new ParticleEmitter; - pEmitter->setDataBlock( mDataBlock->emitterList[i] ); + pEmitter->setDataBlock(mDataBlock->emitterList[i]->cloneAndPerformSubstitutions(ss_object, ss_index)); if( !pEmitter->registerObject() ) { Con::warnf( ConsoleLogEntry::General, "Could not register emitter for particle of class: %s", mDataBlock->getName() ); diff --git a/Engine/source/T3D/fx/explosion.h b/Engine/source/T3D/fx/explosion.h index a030776fe..df4396a76 100644 --- a/Engine/source/T3D/fx/explosion.h +++ b/Engine/source/T3D/fx/explosion.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _EXPLOSION_H_ #define _EXPLOSION_H_ @@ -42,6 +47,7 @@ class TSThread; class SFXTrack; struct DebrisData; +class SFXProfile; //-------------------------------------------------------------------------- class ExplosionData : public GameBaseData { public: @@ -126,6 +132,11 @@ class ExplosionData : public GameBaseData { static void initPersistFields(); virtual void packData(BitStream* stream); virtual void unpackData(BitStream* stream); +public: + /*C*/ ExplosionData(const ExplosionData&, bool = false); + /*D*/ ~ExplosionData(); + ExplosionData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + virtual bool allowSubstitutions() const { return true; } }; @@ -188,6 +199,12 @@ class Explosion : public GameBase, public ISceneLight DECLARE_CONOBJECT(Explosion); static void initPersistFields(); +private: + SimObject* ss_object; + S32 ss_index; + SFXProfile* soundProfile_clone; +public: + void setSubstitutionData(SimObject* obj, S32 idx=0) { ss_object = obj; ss_index = idx; } }; #endif // _H_EXPLOSION diff --git a/Engine/source/T3D/fx/particle.cpp b/Engine/source/T3D/fx/particle.cpp index cb307ccbb..f887a021e 100644 --- a/Engine/source/T3D/fx/particle.cpp +++ b/Engine/source/T3D/fx/particle.cpp @@ -19,6 +19,11 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "particle.h" #include "console/consoleTypes.h" #include "console/typeValidators.h" @@ -653,3 +658,78 @@ DefineEngineMethod(ParticleData, reload, void, (),, char errorBuffer[256]; object->reload(errorBuffer); } +//#define TRACK_PARTICLE_DATA_CLONES + +#ifdef TRACK_PARTICLE_DATA_CLONES +static int particle_data_clones = 0; +#endif + +ParticleData::ParticleData(const ParticleData& other, bool temp_clone) : SimDataBlock(other, temp_clone) +{ +#ifdef TRACK_PARTICLE_DATA_CLONES + particle_data_clones++; + if (particle_data_clones == 1) + Con::errorf("ParticleData -- Clones are on the loose!"); +#endif + + dragCoefficient = other.dragCoefficient; + windCoefficient = other.windCoefficient; + gravityCoefficient = other.gravityCoefficient; + inheritedVelFactor = other.inheritedVelFactor; + constantAcceleration = other.constantAcceleration; + lifetimeMS = other.lifetimeMS; + lifetimeVarianceMS = other.lifetimeVarianceMS; + spinSpeed = other.spinSpeed; + spinRandomMin = other.spinRandomMin; + spinRandomMax = other.spinRandomMax; + useInvAlpha = other.useInvAlpha; + animateTexture = other.animateTexture; + numFrames = other.numFrames; // -- calc from other fields + framesPerSec = other.framesPerSec; + dMemcpy( colors, other.colors, sizeof( colors ) ); + dMemcpy( sizes, other.sizes, sizeof( sizes ) ); + dMemcpy( times, other.times, sizeof( times ) ); + animTexUVs = other.animTexUVs; // -- calc from other fields + dMemcpy( texCoords, other.texCoords, sizeof( texCoords ) ); + animTexTiling = other.animTexTiling; + animTexFramesString = other.animTexFramesString; + animTexFrames = other.animTexFrames; // -- parsed from animTexFramesString + textureName = other.textureName; + textureHandle = other.textureHandle; + spinBias = other.spinBias; + randomizeSpinDir = other.randomizeSpinDir; + textureExtName = other.textureExtName; + textureExtHandle = other.textureExtHandle; + constrain_pos = other.constrain_pos; + start_angle = other.start_angle; + angle_variance = other.angle_variance; + sizeBias = other.sizeBias; +} + +ParticleData::~ParticleData() +{ + if (animTexUVs) + { + delete [] animTexUVs; + } + + if (!isTempClone()) + return; + +#ifdef TRACK_PARTICLE_DATA_CLONES + if (particle_data_clones > 0) + { + particle_data_clones--; + if (particle_data_clones == 0) + Con::errorf("ParticleData -- Clones eliminated!"); + } + else + Con::errorf("ParticleData -- Too many clones deleted!"); +#endif +} + +void ParticleData::onPerformSubstitutions() +{ + char errorBuffer[256]; + reload(errorBuffer); +} diff --git a/Engine/source/T3D/fx/particle.h b/Engine/source/T3D/fx/particle.h index 36b8dd11a..17c173e67 100644 --- a/Engine/source/T3D/fx/particle.h +++ b/Engine/source/T3D/fx/particle.h @@ -102,6 +102,10 @@ class ParticleData : public SimDataBlock static void initPersistFields(); bool reload(char errorBuffer[256]); + public: + /*C*/ ParticleData(const ParticleData&, bool = false); + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } public: bool loadParameters(); bool reload(String &errorStr); diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index 0f164f42b..d59bef4e3 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -712,6 +712,134 @@ void ParticleEmitterData::allocPrimBuffer( S32 overrideSize ) delete [] indices; } +//#define TRACK_PARTICLE_EMITTER_DATA_CLONES + +#ifdef TRACK_PARTICLE_EMITTER_DATA_CLONES +static int emitter_data_clones = 0; +#endif + +ParticleEmitterData::ParticleEmitterData(const ParticleEmitterData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ +#ifdef TRACK_PARTICLE_EMITTER_DATA_CLONES + emitter_data_clones++; + if (emitter_data_clones == 1) + Con::errorf("ParticleEmitterData -- Clones are on the loose!"); +#endif + + ejectionPeriodMS = other.ejectionPeriodMS; + periodVarianceMS = other.periodVarianceMS; + ejectionVelocity = other.ejectionVelocity; + velocityVariance = other.velocityVariance; + ejectionOffset = other.ejectionOffset; + ejectionOffsetVariance = other.ejectionOffsetVariance; + thetaMin = other.thetaMin; + thetaMax = other.thetaMax; + phiReferenceVel = other.phiReferenceVel; + phiVariance = other.phiVariance; + softnessDistance = other.softnessDistance; + ambientFactor = other.ambientFactor; + lifetimeMS = other.lifetimeMS; + lifetimeVarianceMS = other.lifetimeVarianceMS; + overrideAdvance = other.overrideAdvance; + orientParticles = other.orientParticles; + orientOnVelocity = other.orientOnVelocity; + useEmitterSizes = other.useEmitterSizes; + useEmitterColors = other.useEmitterColors; + alignParticles = other.alignParticles; + alignDirection = other.alignDirection; + particleString = other.particleString; + particleDataBlocks = other.particleDataBlocks; // -- derived from particleString + dataBlockIds = other.dataBlockIds; // -- derived from particleString + partListInitSize = other.partListInitSize; // -- approx calc from other fields + primBuff = other.primBuff; + blendStyle = other.blendStyle; + sortParticles = other.sortParticles; + reverseOrder = other.reverseOrder; + textureName = other.textureName; + textureHandle = other.textureHandle; // -- TextureHandle loads using textureName + highResOnly = other.highResOnly; + renderReflection = other.renderReflection; + fade_color = other.fade_color; + fade_size = other.fade_size; + fade_alpha = other.fade_alpha; + ejectionInvert = other.ejectionInvert; + parts_per_eject = other.parts_per_eject; // -- set to 1 (used by subclasses) + use_emitter_xfm = other.use_emitter_xfm; +#if defined(AFX_CAP_PARTICLE_POOLS) + pool_datablock = other.pool_datablock; + pool_index = other.pool_index; + pool_depth_fade = other.pool_depth_fade; + pool_radial_fade = other.pool_radial_fade; + do_pool_id_convert = other.do_pool_id_convert; // -- flags pool id conversion need +#endif +} + +ParticleEmitterData::~ParticleEmitterData() +{ + if (!isTempClone()) + return; + + for (S32 i = 0; i < particleDataBlocks.size(); i++) + { + if (particleDataBlocks[i] && particleDataBlocks[i]->isTempClone()) + { + delete particleDataBlocks[i]; + particleDataBlocks[i] = 0; + } + } + +#ifdef TRACK_PARTICLE_EMITTER_DATA_CLONES + if (emitter_data_clones > 0) + { + emitter_data_clones--; + if (emitter_data_clones == 0) + Con::errorf("ParticleEmitterData -- Clones eliminated!"); + } + else + Con::errorf("ParticleEmitterData -- Too many clones deleted!"); +#endif +} + +ParticleEmitterData* ParticleEmitterData::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + if (!owner) + return this; + + bool clone_parts_db = false; + + // note -- this could be checked when the particle blocks are evaluated + for (S32 i = 0; i < this->particleDataBlocks.size(); i++) + { + if (this->particleDataBlocks[i] && (this->particleDataBlocks[i]->getSubstitutionCount() > 0)) + { + clone_parts_db = true; + break; + } + } + + ParticleEmitterData* sub_emitter_db = this; + + if (this->getSubstitutionCount() > 0 || clone_parts_db) + { + sub_emitter_db = new ParticleEmitterData(*this, true); + performSubstitutions(sub_emitter_db, owner, index); + + if (clone_parts_db) + { + for (S32 i = 0; i < sub_emitter_db->particleDataBlocks.size(); i++) + { + if (sub_emitter_db->particleDataBlocks[i] && (sub_emitter_db->particleDataBlocks[i]->getSubstitutionCount() > 0)) + { + ParticleData* orig_db = sub_emitter_db->particleDataBlocks[i]; + sub_emitter_db->particleDataBlocks[i] = new ParticleData(*orig_db, true); + orig_db->performSubstitutions(sub_emitter_db->particleDataBlocks[i], owner, index); + } + } + } + } + + return sub_emitter_db; +} //----------------------------------------------------------------------------- // ParticleEmitter @@ -743,6 +871,7 @@ ParticleEmitter::ParticleEmitter() // ParticleEmitter should be allocated on the client only. mNetFlags.set( IsGhost ); + mDataBlock = 0; } //----------------------------------------------------------------------------- @@ -754,6 +883,19 @@ ParticleEmitter::~ParticleEmitter() { delete [] part_store[i]; } + if (db_temp_clone && mDataBlock && mDataBlock->isTempClone()) + { + for (S32 i = 0; i < mDataBlock->particleDataBlocks.size(); i++) + { + if (mDataBlock->particleDataBlocks[i] && mDataBlock->particleDataBlocks[i]->isTempClone()) + { + delete mDataBlock->particleDataBlocks[i]; + mDataBlock->particleDataBlocks[i] = 0; + } + } + delete mDataBlock; + mDataBlock = 0; + } } //----------------------------------------------------------------------------- @@ -832,6 +974,11 @@ bool ParticleEmitter::onNewDataBlock( GameBaseData *dptr, bool reload ) part_list_head.next = NULL; n_parts = 0; } + if (mDataBlock->isTempClone()) + { + db_temp_clone = true; + return true; + } scriptOnNewDataBlock(); return true; diff --git a/Engine/source/T3D/fx/particleEmitter.h b/Engine/source/T3D/fx/particleEmitter.h index 122dbcb00..f4da1ed53 100644 --- a/Engine/source/T3D/fx/particleEmitter.h +++ b/Engine/source/T3D/fx/particleEmitter.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _H_PARTICLE_EMITTER #define _H_PARTICLE_EMITTER @@ -113,6 +117,11 @@ class ParticleEmitterData : public GameBaseData bool glow; ///< Renders this emitter into the glow buffer. bool reload(); +public: + /*C*/ ParticleEmitterData(const ParticleEmitterData&, bool = false); + /*D*/ ~ParticleEmitterData(); + virtual ParticleEmitterData* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + virtual bool allowSubstitutions() const { return true; } }; //***************************************************************************** diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index 5c7e76695..903187ac3 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "T3D/gameBase/gameBase.h" #include "console/consoleTypes.h" @@ -122,6 +126,12 @@ GameBaseData::GameBaseData() category = ""; packed = false; } +GameBaseData::GameBaseData(const GameBaseData& other, bool temp_clone) : SimDataBlock(other, temp_clone) +{ + packed = other.packed; + category = other.category; + //mReloadSignal = other.mReloadSignal; // DO NOT copy the mReloadSignal member. +} void GameBaseData::inspectPostApply() { @@ -290,6 +300,9 @@ bool GameBase::onNewDataBlock( GameBaseData *dptr, bool reload ) if ( !mDataBlock ) return false; + // Don't set mask when new datablock is a temp-clone. + if (mDataBlock->isTempClone()) + return true; setMaskBits(DataBlockMask); return true; diff --git a/Engine/source/T3D/gameBase/gameBase.h b/Engine/source/T3D/gameBase/gameBase.h index 3623603fa..be9094e85 100644 --- a/Engine/source/T3D/gameBase/gameBase.h +++ b/Engine/source/T3D/gameBase/gameBase.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _GAMEBASE_H_ #define _GAMEBASE_H_ @@ -113,6 +117,8 @@ public: DECLARE_CALLBACK( void, onMount, ( SceneObject* obj, SceneObject* mountObj, S32 node ) ); DECLARE_CALLBACK( void, onUnmount, ( SceneObject* obj, SceneObject* mountObj, S32 node ) ); /// @} +public: + GameBaseData(const GameBaseData&, bool = false); }; //---------------------------------------------------------------------------- diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index f5003c1e5..eba9cb9d2 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -194,6 +194,40 @@ ProjectileData::ProjectileData() lightDescId = 0; } +ProjectileData::ProjectileData(const ProjectileData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + projectileShapeName = other.projectileShapeName; + faceViewer = other.faceViewer; // -- always set to false + scale = other.scale; + velInheritFactor = other.velInheritFactor; + muzzleVelocity = other.muzzleVelocity; + impactForce = other.impactForce; + isBallistic = other.isBallistic; + bounceElasticity = other.bounceElasticity; + bounceFriction = other.bounceFriction; + gravityMod = other.gravityMod; + lifetime = other.lifetime; + armingDelay = other.armingDelay; + fadeDelay = other.fadeDelay; + explosion = other.explosion; + explosionId = other.explosionId; // -- for pack/unpack of explosion ptr + waterExplosion = other.waterExplosion; + waterExplosionId = other.waterExplosionId; // -- for pack/unpack of waterExplosion ptr + splash = other.splash; + splashId = other.splashId; // -- for pack/unpack of splash ptr + decal = other.decal; + decalId = other.decalId; // -- for pack/unpack of decal ptr + sound = other.sound; + lightDesc = other.lightDesc; + lightDescId = other.lightDescId; // -- for pack/unpack of lightDesc ptr + projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName + activateSeq = other.activateSeq; // -- from projectileShape sequence "activate" + maintainSeq = other.maintainSeq; // -- from projectileShape sequence "maintain" + particleEmitter = other.particleEmitter; + particleEmitterId = other.particleEmitterId; // -- for pack/unpack of particleEmitter ptr + particleWaterEmitter = other.particleWaterEmitter; + particleWaterEmitterId = other.particleWaterEmitterId; // -- for pack/unpack of particleWaterEmitter ptr +} //-------------------------------------------------------------------------- void ProjectileData::initPersistFields() @@ -585,6 +619,8 @@ Projectile::Projectile() mLightState.clear(); mLightState.setLightInfo( mLight ); + + mDataBlock = 0; } Projectile::~Projectile() @@ -593,6 +629,11 @@ Projectile::~Projectile() delete mProjectileShape; mProjectileShape = NULL; + if (mDataBlock && mDataBlock->isTempClone()) + { + delete mDataBlock; + mDataBlock = 0; + } } //-------------------------------------------------------------------------- diff --git a/Engine/source/T3D/projectile.h b/Engine/source/T3D/projectile.h index 17c90cfbc..72f2eac4f 100644 --- a/Engine/source/T3D/projectile.h +++ b/Engine/source/T3D/projectile.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _PROJECTILE_H_ #define _PROJECTILE_H_ @@ -144,6 +148,9 @@ public: DECLARE_CALLBACK( void, onExplode, ( Projectile* proj, Point3F pos, F32 fade ) ); DECLARE_CALLBACK( void, onCollision, ( Projectile* proj, SceneObject* col, F32 fade, Point3F pos, Point3F normal ) ); +public: + ProjectileData(const ProjectileData&, bool = false); + virtual bool allowSubstitutions() const { return true; } }; diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 445ca4b90..0419682ae 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -200,6 +200,66 @@ ShapeBaseData::ShapeBaseData() dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints ); } +ShapeBaseData::ShapeBaseData(const ShapeBaseData& other, bool temp_clone) : GameBaseData(other, temp_clone) +{ + shadowEnable = other.shadowEnable; + shadowSize = other.shadowSize; + shadowMaxVisibleDistance = other.shadowMaxVisibleDistance; + shadowProjectionDistance = other.shadowProjectionDistance; + shadowSphereAdjust = other.shadowSphereAdjust; + shapeName = other.shapeName; + cloakTexName = other.cloakTexName; + cubeDescName = other.cubeDescName; + cubeDescId = other.cubeDescId; + reflectorDesc = other.reflectorDesc; + debris = other.debris; + debrisID = other.debrisID; // -- for pack/unpack of debris ptr + debrisShapeName = other.debrisShapeName; + debrisShape = other.debrisShape; // -- TSShape loaded using debrisShapeName + explosion = other.explosion; + explosionID = other.explosionID; // -- for pack/unpack of explosion ptr + underwaterExplosion = other.underwaterExplosion; + underwaterExplosionID = other.underwaterExplosionID; // -- for pack/unpack of underwaterExplosion ptr + mass = other.mass; + drag = other.drag; + density = other.density; + maxEnergy = other.maxEnergy; + maxDamage = other.maxDamage; + repairRate = other.repairRate; + disabledLevel = other.disabledLevel; + destroyedLevel = other.destroyedLevel; + cameraMaxDist = other.cameraMaxDist; + cameraMinDist = other.cameraMinDist; + cameraDefaultFov = other.cameraDefaultFov; + cameraMinFov = other.cameraMinFov; + cameraMaxFov = other.cameraMaxFov; + cameraCanBank = other.cameraCanBank; + mountedImagesBank = other.mountedImagesBank; + mShape = other.mShape; // -- TSShape loaded using shapeName + mCRC = other.mCRC; // -- from shape, used to verify client shape + computeCRC = other.computeCRC; + eyeNode = other.eyeNode; // -- from shape node "eye" + earNode = other.earNode; // -- from shape node "ear" + cameraNode = other.cameraNode; // -- from shape node "cam" + dMemcpy(mountPointNode, other.mountPointNode, sizeof(mountPointNode)); // -- from shape nodes "mount#" 0-31 + debrisDetail = other.debrisDetail; // -- from shape detail "Debris-17" + damageSequence = other.damageSequence; // -- from shape sequence "Damage" + hulkSequence = other.hulkSequence; // -- from shape sequence "Visibility" + observeThroughObject = other.observeThroughObject; + collisionDetails = other.collisionDetails; // -- calc from shape (this is a Vector copy) + collisionBounds = other.collisionBounds; // -- calc from shape (this is a Vector copy) + LOSDetails = other.LOSDetails; // -- calc from shape (this is a Vector copy) + firstPersonOnly = other.firstPersonOnly; + useEyePoint = other.useEyePoint; + isInvincible = other.isInvincible; + renderWhenDestroyed = other.renderWhenDestroyed; + inheritEnergyFromMount = other.inheritEnergyFromMount; + remap_txr_tags = other.remap_txr_tags; + remap_buffer = other.remap_buffer; + txr_tag_remappings = other.txr_tag_remappings; + silent_bbox_check = other.silent_bbox_check; +} + struct ShapeBaseDataProto { F32 mass; diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 98a42f73b..213a808e4 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _SHAPEBASE_H_ #define _SHAPEBASE_H_ @@ -654,6 +658,8 @@ public: DECLARE_CALLBACK(void, onEndSequence, (ShapeBase* obj, S32 slot, const char* name)); DECLARE_CALLBACK( void, onForceUncloak, ( ShapeBase* obj, const char* reason ) ); /// @} +public: + ShapeBaseData(const ShapeBaseData&, bool = false); }; diff --git a/Engine/source/T3D/staticShape.cpp b/Engine/source/T3D/staticShape.cpp index 6548e2161..874e31059 100644 --- a/Engine/source/T3D/staticShape.cpp +++ b/Engine/source/T3D/staticShape.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "core/dnet.h" #include "core/stream/bitStream.h" @@ -97,6 +101,14 @@ StaticShapeData::StaticShapeData() noIndividualDamage = false; } +StaticShapeData::StaticShapeData(const StaticShapeData& other, bool temp_clone) : ShapeBaseData(other, temp_clone) +{ + noIndividualDamage = other.noIndividualDamage; + dynamicTypeField = other.dynamicTypeField; + isShielded = other.isShielded; // -- uninitialized, unused + energyPerDamagePoint = other.energyPerDamagePoint; // -- uninitialized, unused +} + void StaticShapeData::initPersistFields() { addField("noIndividualDamage", TypeBool, Offset(noIndividualDamage, StaticShapeData), "Deprecated\n\n @internal"); diff --git a/Engine/source/T3D/staticShape.h b/Engine/source/T3D/staticShape.h index 737a2e335..292260c72 100644 --- a/Engine/source/T3D/staticShape.h +++ b/Engine/source/T3D/staticShape.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _STATICSHAPE_H_ #define _STATICSHAPE_H_ @@ -38,12 +43,16 @@ struct StaticShapeData: public ShapeBaseData { bool noIndividualDamage; S32 dynamicTypeField; bool isShielded; + F32 energyPerDamagePoint; // Re-added for AFX // DECLARE_CONOBJECT(StaticShapeData); static void initPersistFields(); virtual void packData(BitStream* stream); virtual void unpackData(BitStream* stream); +public: + StaticShapeData(const StaticShapeData&, bool = false); + virtual bool allowSubstitutions() const { return true; } }; diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 22e496bbf..b1dbb8f13 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -92,12 +92,17 @@ SimObject::SimObject() mCopySource = NULL; mPersistentId = NULL; + is_temp_clone = false; } //----------------------------------------------------------------------------- SimObject::~SimObject() { + // if this is a temp-clone, we don't delete any members that were shallow-copied + // over from the source datablock. + if (is_temp_clone) + return; if( mFieldDictionary ) { delete mFieldDictionary; @@ -1327,6 +1332,43 @@ void SimObject::setDataFieldType(const char *typeName, StringTableEntry slotName } } +// This is the copy-constructor used to create temporary datablock clones. +// The argument is added to distinguish this copy-constructor +// from any general-purpose copy-constructor that might be needed in the +// future. should always be true when creating temporary +// datablock clones. +// +SimObject::SimObject(const SimObject& other, bool temp_clone) +{ + is_temp_clone = temp_clone; + + objectName = other.objectName; + mOriginalName = other.mOriginalName; + nextNameObject = other.nextNameObject; + nextManagerNameObject = other.nextManagerNameObject; + nextIdObject = other.nextIdObject; + mGroup = other.mGroup; + mFlags = other.mFlags; + mCopySource = other.mCopySource; + mFieldDictionary = other.mFieldDictionary; + //mIdString = other.mIdString; // special treatment (see below) + mFilename = other.mFilename; + mDeclarationLine = other.mDeclarationLine; + mNotifyList = other.mNotifyList; + mId = other.mId; + mInternalName = other.mInternalName; + mCanSaveFieldDictionary = other.mCanSaveFieldDictionary; + mPersistentId = other.mPersistentId; + mNameSpace = other.mNameSpace; + mClassName = other.mClassName; + mSuperClassName = other.mSuperClassName; + preventNameChanging = other.preventNameChanging; + + if (mId) + dSprintf( mIdString, sizeof( mIdString ), "%u", mId ); + else + mIdString[ 0 ] = '\0'; +} //----------------------------------------------------------------------------- void SimObject::dumpClassHierarchy() diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 6cba1beff..0585eda45 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _SIMOBJECT_H_ #define _SIMOBJECT_H_ @@ -970,6 +974,12 @@ class SimObject: public ConsoleObject, public TamlCallbacks // EngineObject. virtual void destroySelf(); +protected: + bool is_temp_clone; +public: + /*C*/ SimObject(const SimObject&, bool = false); + bool isTempClone() const { return is_temp_clone; } + virtual bool allowSubstitutions() const { return false; } }; diff --git a/Engine/source/sfx/sfxDescription.cpp b/Engine/source/sfx/sfxDescription.cpp index 1b4e0dead..c3d9f54cf 100644 --- a/Engine/source/sfx/sfxDescription.cpp +++ b/Engine/source/sfx/sfxDescription.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "sfx/sfxDescription.h" @@ -176,6 +180,37 @@ SFXDescription::SFXDescription( const SFXDescription& desc ) //----------------------------------------------------------------------------- +SFXDescription::SFXDescription(const SFXDescription& other, bool temp_clone) + : SimDataBlock(other, temp_clone), + mVolume( other.mVolume ), + mPitch( other.mPitch ), + mIsLooping( other.mIsLooping ), + mIsStreaming( other.mIsStreaming ), + mIs3D( other.mIs3D ), + mUseHardware( other.mUseHardware ), + mMinDistance( other.mMinDistance ), + mMaxDistance( other.mMaxDistance ), + mConeInsideAngle( other.mConeInsideAngle ), + mConeOutsideAngle( other.mConeOutsideAngle ), + mConeOutsideVolume( other.mConeOutsideVolume ), + mRolloffFactor( other.mRolloffFactor ), + mSourceGroup( other.mSourceGroup ), + mFadeInTime( other.mFadeInTime ), + mFadeOutTime( other.mFadeOutTime ), + mFadeInEase( other.mFadeInEase ), + mFadeOutEase( other.mFadeOutEase ), + mFadeLoops( other.mFadeLoops ), + mStreamPacketSize( other.mStreamPacketSize ), + mStreamReadAhead( other.mStreamReadAhead ), + mUseReverb( other.mUseReverb ), + mReverb( other.mReverb ), + mPriority( other.mPriority ), + mScatterDistance( other.mScatterDistance ) +{ + for( U32 i = 0; i < MaxNumParameters; ++ i ) + mParameters[ i ] = other.mParameters[ i ]; +} + void SFXDescription::initPersistFields() { addGroup( "Playback" ); diff --git a/Engine/source/sfx/sfxDescription.h b/Engine/source/sfx/sfxDescription.h index 8bac79467..003faee27 100644 --- a/Engine/source/sfx/sfxDescription.h +++ b/Engine/source/sfx/sfxDescription.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _SFXDESCRIPTION_H_ #define _SFXDESCRIPTION_H_ @@ -192,6 +196,9 @@ class SFXDescription : public SimDataBlock /// Validates the description fixing any /// parameters that are out of range. void validate(); + public: + SFXDescription(const SFXDescription&, bool); + virtual bool allowSubstitutions() const { return true; } }; diff --git a/Engine/source/sfx/sfxProfile.cpp b/Engine/source/sfx/sfxProfile.cpp index 2fff6854d..ef5b9dd42 100644 --- a/Engine/source/sfx/sfxProfile.cpp +++ b/Engine/source/sfx/sfxProfile.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "sfx/sfxProfile.h" @@ -96,9 +97,6 @@ SFXProfile::SFXProfile( SFXDescription* desc, const String& filename, bool prelo //----------------------------------------------------------------------------- -SFXProfile::~SFXProfile() -{ -} //----------------------------------------------------------------------------- @@ -380,3 +378,95 @@ DefineEngineMethod( SFXProfile, getSoundDuration, F32, (),, { return ( F32 ) object->getSoundDuration() * 0.001f; } + +// enable this to help verify that temp-clones of AudioProfile are being deleted +//#define TRACK_AUDIO_PROFILE_CLONES + +#ifdef TRACK_AUDIO_PROFILE_CLONES +static int audio_prof_clones = 0; +#endif + +SFXProfile::SFXProfile(const SFXProfile& other, bool temp_clone) : SFXTrack(other, temp_clone) +{ +#ifdef TRACK_AUDIO_PROFILE_CLONES + audio_prof_clones++; + if (audio_prof_clones == 1) + Con::errorf("SFXProfile -- Clones are on the loose!"); +#endif + mResource = other.mResource; + mFilename = other.mFilename; + mPreload = other.mPreload; + mBuffer = other.mBuffer; // -- AudioBuffer loaded using mFilename + mChangedSignal = other.mChangedSignal; +} + +SFXProfile::~SFXProfile() +{ + if (!isTempClone()) + return; + + // cleanup after a temp-clone + + if (mDescription && mDescription->isTempClone()) + { + delete mDescription; + mDescription = 0; + } + +#ifdef TRACK_AUDIO_PROFILE_CLONES + if (audio_prof_clones > 0) + { + audio_prof_clones--; + if (audio_prof_clones == 0) + Con::errorf("SFXProfile -- Clones eliminated!"); + } + else + Con::errorf("SFXProfile -- Too many clones deleted!"); +#endif +} + +// Clone and perform substitutions on the SFXProfile and on any SFXDescription +// it references. +SFXProfile* SFXProfile::cloneAndPerformSubstitutions(const SimObject* owner, S32 index) +{ + if (!owner) + return this; + + SFXProfile* sub_profile_db = this; + + // look for mDescriptionObject subs + SFXDescription* desc_db; + if (mDescription && mDescription->getSubstitutionCount() > 0) + { + SFXDescription* orig_db = mDescription; + desc_db = new SFXDescription(*orig_db, true); + orig_db->performSubstitutions(desc_db, owner, index); + } + else + desc_db = 0; + + if (this->getSubstitutionCount() > 0 || desc_db) + { + sub_profile_db = new SFXProfile(*this, true); + performSubstitutions(sub_profile_db, owner, index); + if (desc_db) + sub_profile_db->mDescription = desc_db; + } + + return sub_profile_db; +} + +void SFXProfile::onPerformSubstitutions() +{ + if ( SFX ) + { + // If preload is enabled we load the resource + // and device buffer now to avoid a delay on + // first playback. + if ( mPreload && !_preloadBuffer() ) + Con::errorf( "SFXProfile(%s)::onPerformSubstitutions: The preload failed!", getName() ); + + // We need to get device change notifications. + SFX->getEventSignal().notify( this, &SFXProfile::_onDeviceEvent ); + } +} diff --git a/Engine/source/sfx/sfxProfile.h b/Engine/source/sfx/sfxProfile.h index 70ac4f097..ab1a4b1f0 100644 --- a/Engine/source/sfx/sfxProfile.h +++ b/Engine/source/sfx/sfxProfile.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _SFXPROFILE_H_ #define _SFXPROFILE_H_ @@ -175,6 +180,11 @@ class SFXProfile : public SFXTrack /// ChangedSignal& getChangedSignal() { return mChangedSignal; } + public: + /*C*/ SFXProfile(const SFXProfile&, bool = false); + SFXProfile* cloneAndPerformSubstitutions(const SimObject*, S32 index=0); + virtual void onPerformSubstitutions(); + virtual bool allowSubstitutions() const { return true; } }; diff --git a/Engine/source/sfx/sfxTrack.cpp b/Engine/source/sfx/sfxTrack.cpp index dde11bb26..067a202ca 100644 --- a/Engine/source/sfx/sfxTrack.cpp +++ b/Engine/source/sfx/sfxTrack.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "sfx/sfxTrack.h" #include "sfx/sfxTypes.h" #include "sfx/sfxDescription.h" @@ -65,6 +69,11 @@ SFXTrack::SFXTrack( SFXDescription* description ) dMemset( mParameters, 0, sizeof( mParameters ) ); } +SFXTrack::SFXTrack(const SFXTrack& other, bool temp_clone) : SimDataBlock(other, temp_clone) +{ + mDescription = other.mDescription; + dMemcpy(mParameters, other.mParameters, sizeof(mParameters)); +} //----------------------------------------------------------------------------- void SFXTrack::initPersistFields() diff --git a/Engine/source/sfx/sfxTrack.h b/Engine/source/sfx/sfxTrack.h index 13221dbb8..e30acd007 100644 --- a/Engine/source/sfx/sfxTrack.h +++ b/Engine/source/sfx/sfxTrack.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _SFXTRACK_H_ #define _SFXTRACK_H_ @@ -92,6 +96,8 @@ class SFXTrack : public SimDataBlock DECLARE_CONOBJECT( SFXTrack ); DECLARE_CATEGORY( "SFX" ); DECLARE_DESCRIPTION( "Abstract base class for any kind of data that can be turned into SFXSources." ); + public: + /*C*/ SFXTrack(const SFXTrack&, bool = false); }; #endif // !_SFXTRACK_H_ From 39b62b146116c25273f07b846f2f1ebfb6c25338 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 21:40:27 +0100 Subject: [PATCH 006/312] copy-on-reload -- The datablock copy op, ":" is modified to copy on reload as well as on creation. reload-reset -- adds virtual method that is called when a datablock is reloaded. --- Engine/source/console/compiledEval.cpp | 33 ++++++++++++++++++++++++++ Engine/source/console/simObject.h | 2 ++ 2 files changed, 35 insertions(+) diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 38f1ec589..1d872df8a 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "console/console.h" @@ -965,6 +966,38 @@ breakContinue: currentNewObject->setModDynamicFields(true); } } + else + { + currentNewObject->reloadReset(); // AFX (reload-reset) + // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) + if(*objParent) + { + // Find it! + SimObject *parent; + if(Sim::findObject(objParent, parent)) + { + // Con::printf(" - Parent object found: %s", parent->getClassName()); + + // temporarily block name change + SimObject::preventNameChanging = true; + currentNewObject->setCopySource( parent ); + currentNewObject->assignFieldsFrom(parent); + // restore name changing + SimObject::preventNameChanging = false; + + // copy any substitution statements + SimDataBlock* parent_db = dynamic_cast(parent); + if (parent_db) + { + SimDataBlock* currentNewObject_db = dynamic_cast(currentNewObject); + if (currentNewObject_db) + currentNewObject_db->copySubstitutionsFrom(parent_db); + } + } + else + Con::errorf(ConsoleLogEntry::General, "%d: Unable to find parent object %s for %s.", lineNumber, objParent, (const char*)callArgv[1]); + } + } // Advance the IP past the create info... ip += 7; diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 0585eda45..1261afd55 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -980,6 +980,8 @@ public: /*C*/ SimObject(const SimObject&, bool = false); bool isTempClone() const { return is_temp_clone; } virtual bool allowSubstitutions() const { return false; } +public: + virtual void reloadReset() { } }; From 8436dff732badfb3f98e109e24058005fc4a78d2 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 21:49:45 +0100 Subject: [PATCH 007/312] enhanced-field-mgmt -- Enhancements to dynamic field handling that allow for name filtering and replacement limiting --- Engine/source/console/simFieldDictionary.cpp | 64 +++++++++++++++++++- Engine/source/console/simFieldDictionary.h | 7 +++ Engine/source/console/simObject.cpp | 17 ++++++ Engine/source/console/simObject.h | 5 ++ 4 files changed, 92 insertions(+), 1 deletion(-) diff --git a/Engine/source/console/simFieldDictionary.cpp b/Engine/source/console/simFieldDictionary.cpp index 9615c59d0..7cf3deb94 100644 --- a/Engine/source/console/simFieldDictionary.cpp +++ b/Engine/source/console/simFieldDictionary.cpp @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #include "platform/platform.h" #include "console/simFieldDictionary.h" @@ -361,4 +365,62 @@ SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator++() SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator*() { return(mEntry); -} \ No newline at end of file +} +// A variation of the stock SimFieldDictionary::setFieldValue(), this method adds the +// argument which, when true, prohibits the replacement of fields that +// already have a value. +// +// AFX uses this when an effects-choreographer (afxMagicSpell, afxEffectron) is created +// using the new operator. It prevents any in-line effect parameters from being overwritten +// by default parameters that are copied over later. +void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *value, ConsoleBaseType *type, bool no_replace) +{ + if (!no_replace) + { + setFieldValue(slotName, value); + return; + } + + if (!value || !*value) + return; + + U32 bucket = getHashValue(slotName); + Entry **walk = &mHashTable[bucket]; + while(*walk && (*walk)->slotName != slotName) + walk = &((*walk)->next); + + Entry *field = *walk; + if (field) + return; + + addEntry( bucket, slotName, type, dStrdup( value ) ); +} +// A variation of the stock SimFieldDictionary::assignFrom(), this method adds +// and arguments. When true, prohibits the replacement of fields that already +// have a value. When is specified, only fields with leading characters that exactly match +// the characters in are copied. +void SimFieldDictionary::assignFrom(SimFieldDictionary *dict, const char* filter, bool no_replace) +{ + dsize_t filter_len = (filter) ? dStrlen(filter) : 0; + if (filter_len == 0 && !no_replace) + { + assignFrom(dict); + return; + } + + mVersion++; + + if (filter_len == 0) + { + for(U32 i = 0; i < HashTableSize; i++) + for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) + setFieldValue(walk->slotName, walk->value, walk->type, no_replace); + } + else + { + for(U32 i = 0; i < HashTableSize; i++) + for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) + if (dStrncmp(walk->slotName, filter, filter_len) == 0) + setFieldValue(walk->slotName, walk->value, walk->type, no_replace); + } +} diff --git a/Engine/source/console/simFieldDictionary.h b/Engine/source/console/simFieldDictionary.h index bc865398c..4849be563 100644 --- a/Engine/source/console/simFieldDictionary.h +++ b/Engine/source/console/simFieldDictionary.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _SIMFIELDDICTIONARY_H_ #define _SIMFIELDDICTIONARY_H_ @@ -90,6 +95,8 @@ public: U32 getNumFields() const { return mNumFields; } Entry *operator[](U32 index); + void setFieldValue(StringTableEntry slotName, const char *value, ConsoleBaseType *type, bool no_replace); + void assignFrom(SimFieldDictionary *dict, const char* filter, bool no_replace); }; class SimFieldDictionaryIterator diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index b1dbb8f13..c12a12f19 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "platform/platformMemory.h" #include "console/simObject.h" @@ -52,6 +53,7 @@ ConsoleDocClass( SimObject, bool SimObject::smForceId = false; SimObjectId SimObject::smForcedId = 0; +bool SimObject::preventNameChanging = false; namespace Sim { @@ -221,6 +223,19 @@ String SimObject::describeSelf() const return desc; } +// Copies dynamic fields from one object to another, optionally limited by the settings for +// and . When true, prohibits the replacement of fields that +// already have a value. When is specified, only fields with leading characters that +// exactly match the characters in are copied. +void SimObject::assignDynamicFieldsFrom(SimObject* from, const char* filter, bool no_replace) +{ + if (from->mFieldDictionary) + { + if( mFieldDictionary == NULL ) + mFieldDictionary = new SimFieldDictionary; + mFieldDictionary->assignFrom(from->mFieldDictionary, filter, no_replace); + } +} //============================================================================= // Persistence. //============================================================================= @@ -2185,6 +2200,8 @@ bool SimObject::setProtectedParent( void *obj, const char *index, const char *da bool SimObject::setProtectedName(void *obj, const char *index, const char *data) { + if (preventNameChanging) + return false; SimObject *object = static_cast(obj); if ( object->isProperlyAdded() ) diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 1261afd55..2119ea6a9 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -980,6 +980,11 @@ public: /*C*/ SimObject(const SimObject&, bool = false); bool isTempClone() const { return is_temp_clone; } virtual bool allowSubstitutions() const { return false; } + +public: + static bool preventNameChanging; + void assignDynamicFieldsFrom(SimObject*, const char* filter, bool no_replace=false); + public: virtual void reloadReset() { } }; From 32197350873801a5ec572224f6943ade52348a1e Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 22:05:04 +0100 Subject: [PATCH 008/312] meshroad-zodiacs -- MeshRoad customizations for rendering zodiacs on them. enhanced-meshroad -- adds option for building top-surface-only PolyList. polysoup-zodiacs -- Changes made for rendering zodiacs on polysoup objects. groundplane-zodiacs -- groundPlane customizations for rendering zodiacs on them. special-types -- defines type bits for interior-like and terrain-like types. special-types -- defines a type bit for polysoup objects. --- Engine/source/T3D/groundPlane.cpp | 8 + Engine/source/T3D/objectTypes.h | 6 + Engine/source/T3D/tsStatic.cpp | 81 ++ Engine/source/T3D/tsStatic.cpp.orig | 1330 ------------------------ Engine/source/T3D/tsStatic.h | 18 + Engine/source/environment/meshRoad.cpp | 27 + Engine/source/environment/meshRoad.h | 9 + 7 files changed, 149 insertions(+), 1330 deletions(-) delete mode 100644 Engine/source/T3D/tsStatic.cpp.orig diff --git a/Engine/source/T3D/groundPlane.cpp b/Engine/source/T3D/groundPlane.cpp index bb8f82503..5e23a28ce 100644 --- a/Engine/source/T3D/groundPlane.cpp +++ b/Engine/source/T3D/groundPlane.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/groundPlane.h" @@ -40,6 +45,7 @@ #include "T3D/physics/physicsBody.h" #include "T3D/physics/physicsCollision.h" +#include "afx/ce/afxZodiacMgr.h" /// Minimum square size allowed. This is a cheap way to limit the amount /// of geometry possibly generated by the GroundPlane (vertex buffers have a @@ -77,6 +83,7 @@ GroundPlane::GroundPlane() mNetFlags.set( Ghostable | ScopeAlways ); mConvexList = new Convex; + mTypeMask |= TerrainLikeObjectType; } GroundPlane::~GroundPlane() @@ -356,6 +363,7 @@ void GroundPlane::prepRenderImage( SceneRenderState* state ) if( mVertexBuffer.isNull() ) return; + afxZodiacMgr::renderGroundPlaneZodiacs(state, this); // Add a render instance. RenderPassManager* pass = state->getRenderPass(); diff --git a/Engine/source/T3D/objectTypes.h b/Engine/source/T3D/objectTypes.h index 8c9b3c84c..c27479b7f 100644 --- a/Engine/source/T3D/objectTypes.h +++ b/Engine/source/T3D/objectTypes.h @@ -20,6 +20,10 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// #ifndef _OBJECTTYPES_H_ #define _OBJECTTYPES_H_ @@ -149,6 +153,8 @@ enum SceneObjectTypes EntityObjectType = BIT(23), /// @} + InteriorLikeObjectType = BIT(24), + TerrainLikeObjectType = BIT(25), }; enum SceneObjectTypeMasks : U32 diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 84b3b0797..84b07566f 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/tsStatic.h" @@ -54,6 +59,8 @@ using namespace Torque; extern bool gEditingMission; +#include "afx/ce/afxZodiacMgr.h" + IMPLEMENT_CO_NETOBJECT_V1(TSStatic); ConsoleDocClass( TSStatic, @@ -124,6 +131,12 @@ TSStatic::TSStatic() mCollisionType = CollisionMesh; mDecalType = CollisionMesh; + + mIgnoreZodiacs = false; + mHasGradients = false; + mInvertGradientRange = false; + mGradientRangeUser.set(0.0f, 180.0f); + afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser); } TSStatic::~TSStatic() @@ -222,6 +235,12 @@ void TSStatic::initPersistFields() endGroup("Debug"); + addGroup("AFX"); + addField("ignoreZodiacs", TypeBool, Offset(mIgnoreZodiacs, TSStatic)); + addField("useGradientRange", TypeBool, Offset(mHasGradients, TSStatic)); + addField("gradientRange", TypePoint2F, Offset(mGradientRangeUser, TSStatic)); + addField("invertGradientRange", TypeBool, Offset(mInvertGradientRange, TSStatic)); + endGroup("AFX"); Parent::initPersistFields(); } @@ -323,6 +342,8 @@ bool TSStatic::_createShape() { // Cleanup before we create. mCollisionDetails.clear(); + mDecalDetails.clear(); + mDecalDetailsPtr = 0; mLOSDetails.clear(); SAFE_DELETE( mPhysicsRep ); SAFE_DELETE( mShapeInstance ); @@ -396,11 +417,29 @@ void TSStatic::prepCollision() // Cleanup any old collision data mCollisionDetails.clear(); + mDecalDetails.clear(); + mDecalDetailsPtr = 0; mLOSDetails.clear(); mConvexList->nukeList(); if ( mCollisionType == CollisionMesh || mCollisionType == VisibleMesh ) + { mShape->findColDetails( mCollisionType == VisibleMesh, &mCollisionDetails, &mLOSDetails ); + if ( mDecalType == mCollisionType ) + { + mDecalDetailsPtr = &mCollisionDetails; + } + else if ( mDecalType == CollisionMesh || mDecalType == VisibleMesh ) + { + mShape->findColDetails( mDecalType == VisibleMesh, &mDecalDetails, 0 ); + mDecalDetailsPtr = &mDecalDetails; + } + } + else if ( mDecalType == CollisionMesh || mDecalType == VisibleMesh ) + { + mShape->findColDetails( mDecalType == VisibleMesh, &mDecalDetails, 0 ); + mDecalDetailsPtr = &mDecalDetails; + } _updatePhysics(); } @@ -681,6 +720,8 @@ void TSStatic::prepRenderImage( SceneRenderState* state ) } mShapeInstance->render( rdata ); + if (!mIgnoreZodiacs && mDecalDetailsPtr != 0) + afxZodiacMgr::renderPolysoupZodiacs(state, this); if ( mRenderNormalScalar > 0 ) { ObjectRenderInst *ri = state->getRenderPass()->allocInst(); @@ -786,6 +827,13 @@ U32 TSStatic::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->write(mInvertAlphaFade); } + stream->writeFlag(mIgnoreZodiacs); + if (stream->writeFlag(mHasGradients)) + { + stream->writeFlag(mInvertGradientRange); + stream->write(mGradientRange.x); + stream->write(mGradientRange.y); + } if ( mLightPlugin ) retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream); @@ -870,6 +918,14 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream) stream->read(&mInvertAlphaFade); } + mIgnoreZodiacs = stream->readFlag(); + mHasGradients = stream->readFlag(); + if (mHasGradients) + { + mInvertGradientRange = stream->readFlag(); + stream->read(&mGradientRange.x); + stream->read(&mGradientRange.y); + } if ( mLightPlugin ) { mLightPlugin->unpackUpdate(this, con, stream); @@ -882,6 +938,7 @@ void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream) if ( isProperlyAdded() ) _updateShouldTick(); + set_special_typing(); } //---------------------------------------------------------------------------- @@ -992,6 +1049,11 @@ bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList polyList->addBox( mObjBox ); else if ( meshType == VisibleMesh ) mShapeInstance->buildPolyList( polyList, 0 ); + else if (context == PLC_Decal && mDecalDetailsPtr != 0) + { + for ( U32 i = 0; i < mDecalDetailsPtr->size(); i++ ) + mShapeInstance->buildPolyListOpcode( (*mDecalDetailsPtr)[i], polyList, box ); + } else { // Everything else is done from the collision meshes @@ -1324,3 +1386,22 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),, { return object->getShapeFileName(); } + +void TSStatic::set_special_typing() +{ + if (mCollisionType == VisibleMesh || mCollisionType == CollisionMesh) + mTypeMask |= InteriorLikeObjectType; + else + mTypeMask &= ~InteriorLikeObjectType; +} + +void TSStatic::onStaticModified(const char* slotName, const char*newValue) +{ + if (slotName == afxZodiacData::GradientRangeSlot) + { + afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser); + return; + } + + set_special_typing(); +} diff --git a/Engine/source/T3D/tsStatic.cpp.orig b/Engine/source/T3D/tsStatic.cpp.orig deleted file mode 100644 index 11848499e..000000000 --- a/Engine/source/T3D/tsStatic.cpp.orig +++ /dev/null @@ -1,1330 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/platform.h" -#include "T3D/tsStatic.h" - -#include "core/resourceManager.h" -#include "core/stream/bitStream.h" -#include "scene/sceneRenderState.h" -#include "scene/sceneManager.h" -#include "scene/sceneObjectLightingPlugin.h" -#include "lighting/lightManager.h" -#include "math/mathIO.h" -#include "ts/tsShapeInstance.h" -#include "ts/tsMaterialList.h" -#include "console/consoleTypes.h" -#include "T3D/shapeBase.h" -#include "sim/netConnection.h" -#include "gfx/gfxDevice.h" -#include "gfx/gfxTransformSaver.h" -#include "ts/tsRenderState.h" -#include "collision/boxConvex.h" -#include "T3D/physics/physicsPlugin.h" -#include "T3D/physics/physicsBody.h" -#include "T3D/physics/physicsCollision.h" -#include "materials/materialDefinition.h" -#include "materials/materialManager.h" -#include "materials/matInstance.h" -#include "materials/materialFeatureData.h" -#include "materials/materialFeatureTypes.h" -#include "console/engineAPI.h" -#include "T3D/accumulationVolume.h" - -using namespace Torque; - -extern bool gEditingMission; - -IMPLEMENT_CO_NETOBJECT_V1(TSStatic); - -ConsoleDocClass( TSStatic, - "@brief A static object derived from a 3D model file and placed within the game world.\n\n" - - "TSStatic is the most basic 3D shape in Torque. Unlike StaticShape it doesn't make use of " - "a datablock. It derrives directly from SceneObject. This makes TSStatic extremely light " - "weight, which is why the Tools use this class when you want to drop in a DTS or DAE object.\n\n" - - "While a TSStatic doesn't provide any motion -- it stays were you initally put it -- it does allow for " - "a single ambient animation sequence to play when the object is first added to the scene.\n\n" - - "@tsexample\n" - "new TSStatic(Team1Base) {\n" - " shapeName = \"art/shapes/desertStructures/station01.dts\";\n" - " playAmbient = \"1\";\n" - " receiveSunLight = \"1\";\n" - " receiveLMLighting = \"1\";\n" - " useCustomAmbientLighting = \"0\";\n" - " customAmbientLighting = \"0 0 0 1\";\n" - " collisionType = \"Visible Mesh\";\n" - " decalType = \"Collision Mesh\";\n" - " allowPlayerStep = \"1\";\n" - " renderNormals = \"0\";\n" - " forceDetail = \"-1\";\n" - " position = \"315.18 -180.418 244.313\";\n" - " rotation = \"0 0 1 195.952\";\n" - " scale = \"1 1 1\";\n" - " isRenderEnabled = \"true\";\n" - " canSaveDynamicFields = \"1\";\n" - "};\n" - "@endtsexample\n" - - "@ingroup gameObjects\n" -); - -TSStatic::TSStatic() -: - cubeDescId( 0 ), - reflectorDesc( NULL ) -{ - mNetFlags.set(Ghostable | ScopeAlways); - - mTypeMask |= StaticObjectType | StaticShapeObjectType; - - mShapeName = ""; - mShapeInstance = NULL; - - mPlayAmbient = true; - mAmbientThread = NULL; - - mAllowPlayerStep = false; - - mConvexList = new Convex; - - mRenderNormalScalar = 0; - mForceDetail = -1; - - mMeshCulling = false; - mUseOriginSort = false; - - mUseAlphaFade = false; - mAlphaFadeStart = 100.0f; - mAlphaFadeEnd = 150.0f; - mInvertAlphaFade = false; - mAlphaFade = 1.0f; - mPhysicsRep = NULL; - - mCollisionType = CollisionMesh; - mDecalType = CollisionMesh; -} - -TSStatic::~TSStatic() -{ - delete mConvexList; - mConvexList = NULL; -} - -ImplementEnumType( TSMeshType, - "Type of mesh data available in a shape.\n" - "@ingroup gameObjects" ) - { TSStatic::None, "None", "No mesh data." }, - { TSStatic::Bounds, "Bounds", "Bounding box of the shape." }, - { TSStatic::CollisionMesh, "Collision Mesh", "Specifically desingated \"collision\" meshes." }, - { TSStatic::VisibleMesh, "Visible Mesh", "Rendered mesh polygons." }, -EndImplementEnumType; - - -void TSStatic::initPersistFields() -{ - addGroup("Media"); - - addField("shapeName", TypeShapeFilename, Offset( mShapeName, TSStatic ), - "%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic." ); - - addProtectedField( "skin", TypeRealString, Offset( mAppliedSkinName, TSStatic ), &_setFieldSkin, &_getFieldSkin, - "@brief The skin applied to the shape.\n\n" - - "'Skinning' the shape effectively renames the material targets, allowing " - "different materials to be used on different instances of the same model.\n\n" - - "Any material targets that start with the old skin name have that part " - "of the name replaced with the new skin name. The initial old skin name is " - "\"base\". For example, if a new skin of \"blue\" was applied to a model " - "that had material targets base_body and face, the new targets " - "would be blue_body and face. Note that face was not " - "renamed since it did not start with the old skin name of \"base\".\n\n" - - "To support models that do not use the default \"base\" naming convention, " - "you can also specify the part of the name to replace in the skin field " - "itself. For example, if a model had a material target called shapemat, " - "we could apply a new skin \"shape=blue\", and the material target would be " - "renamed to bluemat (note \"shape\" has been replaced with \"blue\").\n\n" - - "Multiple skin updates can also be applied at the same time by separating " - "them with a semicolon. For example: \"base=blue;face=happy_face\".\n\n" - - "Material targets are only renamed if an existing Material maps to that " - "name, or if there is a diffuse texture in the model folder with the same " - "name as the new target.\n\n" ); - - endGroup("Media"); - - addGroup("Rendering"); - - addField( "playAmbient", TypeBool, Offset( mPlayAmbient, TSStatic ), - "Enables automatic playing of the animation sequence named \"ambient\" (if it exists) when the TSStatic is loaded."); - addField( "meshCulling", TypeBool, Offset( mMeshCulling, TSStatic ), - "Enables detailed culling of meshes within the TSStatic. Should only be used " - "with large complex shapes like buildings which contain many submeshes." ); - addField( "originSort", TypeBool, Offset( mUseOriginSort, TSStatic ), - "Enables translucent sorting of the TSStatic by its origin instead of the bounds." ); - - endGroup("Rendering"); - - addGroup( "Reflection" ); - addField( "cubeReflectorDesc", TypeRealString, Offset( cubeDescName, TSStatic ), - "References a ReflectorDesc datablock that defines performance and quality properties for dynamic reflections.\n"); - endGroup( "Reflection" ); - - addGroup("Collision"); - - addField( "collisionType", TypeTSMeshType, Offset( mCollisionType, TSStatic ), - "The type of mesh data to use for collision queries." ); - addField( "decalType", TypeTSMeshType, Offset( mDecalType, TSStatic ), - "The type of mesh data used to clip decal polygons against." ); - addField( "allowPlayerStep", TypeBool, Offset( mAllowPlayerStep, TSStatic ), - "@brief Allow a Player to walk up sloping polygons in the TSStatic (based on the collisionType).\n\n" - "When set to false, the slightest bump will stop the player from walking on top of the object.\n"); - - endGroup("Collision"); - - addGroup( "AlphaFade" ); - addField( "alphaFadeEnable", TypeBool, Offset(mUseAlphaFade, TSStatic), "Turn on/off Alpha Fade" ); - addField( "alphaFadeStart", TypeF32, Offset(mAlphaFadeStart, TSStatic), "Distance of start Alpha Fade" ); - addField( "alphaFadeEnd", TypeF32, Offset(mAlphaFadeEnd, TSStatic), "Distance of end Alpha Fade" ); - addField( "alphaFadeInverse", TypeBool, Offset(mInvertAlphaFade, TSStatic), "Invert Alpha Fade's Start & End Distance" ); - endGroup( "AlphaFade" ); - - addGroup("Debug"); - - addField( "renderNormals", TypeF32, Offset( mRenderNormalScalar, TSStatic ), - "Debug rendering mode shows the normals for each point in the TSStatic's mesh." ); - addField( "forceDetail", TypeS32, Offset( mForceDetail, TSStatic ), - "Forces rendering to a particular detail level." ); - - endGroup("Debug"); - - Parent::initPersistFields(); -} - -bool TSStatic::_setFieldSkin( void *object, const char *index, const char *data ) -{ - TSStatic *ts = static_cast( object ); - if ( ts ) - ts->setSkinName( data ); - return false; -} - -const char *TSStatic::_getFieldSkin( void *object, const char *data ) -{ - TSStatic *ts = static_cast( object ); - return ts ? ts->mSkinNameHandle.getString() : ""; -} - -void TSStatic::inspectPostApply() -{ - // Apply any transformations set in the editor - Parent::inspectPostApply(); - - if(isServerObject()) - { - setMaskBits(AdvancedStaticOptionsMask); - prepCollision(); - } - - _updateShouldTick(); -} - -bool TSStatic::onAdd() -{ - PROFILE_SCOPE(TSStatic_onAdd); - - if ( isServerObject() ) - { - // Handle the old "usePolysoup" field - SimFieldDictionary* fieldDict = getFieldDictionary(); - - if ( fieldDict ) - { - StringTableEntry slotName = StringTable->insert( "usePolysoup" ); - - SimFieldDictionary::Entry * entry = fieldDict->findDynamicField( slotName ); - - if ( entry ) - { - // Was "usePolysoup" set? - bool usePolysoup = dAtob( entry->value ); - - // "usePolysoup" maps to the new VisibleMesh type - if ( usePolysoup ) - mCollisionType = VisibleMesh; - - // Remove the field in favor on the new "collisionType" field - fieldDict->setFieldValue( slotName, "" ); - } - } - } - - if ( !Parent::onAdd() ) - return false; - - // Setup the shape. - if ( !_createShape() ) - { - Con::errorf( "TSStatic::onAdd() - Shape creation failed!" ); - return false; - } - - setRenderTransform(mObjToWorld); - - // Register for the resource change signal. - ResourceManager::get().getChangedSignal().notify( this, &TSStatic::_onResourceChanged ); - - addToScene(); - - if ( isClientObject() ) - { - mCubeReflector.unregisterReflector(); - - if ( reflectorDesc ) - mCubeReflector.registerReflector( this, reflectorDesc ); - } - - _updateShouldTick(); - - // Accumulation and environment mapping - if (isClientObject() && mShapeInstance) - { - AccumulationVolume::addObject(this); - } - - return true; -} - -bool TSStatic::_createShape() -{ - // Cleanup before we create. - mCollisionDetails.clear(); - mLOSDetails.clear(); - SAFE_DELETE( mPhysicsRep ); - SAFE_DELETE( mShapeInstance ); - mAmbientThread = NULL; - mShape = NULL; - - if (!mShapeName || mShapeName[0] == '\0') - { - Con::errorf( "TSStatic::_createShape() - No shape name!" ); - return false; - } - - mShapeHash = _StringTable::hashString(mShapeName); - - mShape = ResourceManager::get().load(mShapeName); - if ( bool(mShape) == false ) - { - Con::errorf( "TSStatic::_createShape() - Unable to load shape: %s", mShapeName ); - return false; - } - - if ( isClientObject() && - !mShape->preloadMaterialList(mShape.getPath()) && - NetConnection::filesWereDownloaded() ) - return false; - - mObjBox = mShape->bounds; - resetWorldBox(); - - mShapeInstance = new TSShapeInstance( mShape, isClientObject() ); - - if( isGhost() ) - { - // Reapply the current skin - mAppliedSkinName = ""; - reSkin(); - } - - prepCollision(); - - // Find the "ambient" animation if it exists - S32 ambientSeq = mShape->findSequence("ambient"); - - if ( ambientSeq > -1 && !mAmbientThread ) - mAmbientThread = mShapeInstance->addThread(); - - if ( mAmbientThread ) - mShapeInstance->setSequence( mAmbientThread, ambientSeq, 0); - - // Resolve CubeReflectorDesc. - if ( cubeDescName.isNotEmpty() ) - { - Sim::findObject( cubeDescName, reflectorDesc ); - } - else if( cubeDescId > 0 ) - { - Sim::findObject( cubeDescId, reflectorDesc ); - } - - return true; -} - -void TSStatic::prepCollision() -{ - // Let the client know that the collision was updated - setMaskBits( UpdateCollisionMask ); - - // Allow the ShapeInstance to prep its collision if it hasn't already - if ( mShapeInstance ) - mShapeInstance->prepCollision(); - - // Cleanup any old collision data - mCollisionDetails.clear(); - mLOSDetails.clear(); - mConvexList->nukeList(); - - if ( mCollisionType == CollisionMesh || mCollisionType == VisibleMesh ) - mShape->findColDetails( mCollisionType == VisibleMesh, &mCollisionDetails, &mLOSDetails ); - - _updatePhysics(); -} - -void TSStatic::_updatePhysics() -{ - SAFE_DELETE( mPhysicsRep ); - - if ( !PHYSICSMGR || mCollisionType == None ) - return; - - PhysicsCollision *colShape = NULL; - if ( mCollisionType == Bounds ) - { - MatrixF offset( true ); - offset.setPosition( mShape->center ); - colShape = PHYSICSMGR->createCollision(); - colShape->addBox( getObjBox().getExtents() * 0.5f * mObjScale, offset ); - } - else - colShape = mShape->buildColShape( mCollisionType == VisibleMesh, getScale() ); - - if ( colShape ) - { - PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" ); - mPhysicsRep = PHYSICSMGR->createBody(); - mPhysicsRep->init( colShape, 0, 0, this, world ); - mPhysicsRep->setTransform( getTransform() ); - } -} - -void TSStatic::onRemove() -{ - SAFE_DELETE( mPhysicsRep ); - - // Accumulation - if ( isClientObject() && mShapeInstance ) - { - if ( mShapeInstance->hasAccumulation() ) - AccumulationVolume::removeObject(this); - } - - mConvexList->nukeList(); - - removeFromScene(); - - // Remove the resource change signal. - ResourceManager::get().getChangedSignal().remove( this, &TSStatic::_onResourceChanged ); - - delete mShapeInstance; - mShapeInstance = NULL; - - mAmbientThread = NULL; - if ( isClientObject() ) - mCubeReflector.unregisterReflector(); - - Parent::onRemove(); -} - -void TSStatic::_onResourceChanged( const Torque::Path &path ) -{ - if ( path != Path( mShapeName ) ) - return; - - _createShape(); - _updateShouldTick(); -} - -void TSStatic::setSkinName( const char *name ) -{ - if ( !isGhost() ) - { - if ( name[0] != '\0' ) - { - // Use tags for better network performance - // Should be a tag, but we'll convert to one if it isn't. - if ( name[0] == StringTagPrefixByte ) - mSkinNameHandle = NetStringHandle( U32(dAtoi(name + 1)) ); - else - mSkinNameHandle = NetStringHandle( name ); - } - else - mSkinNameHandle = NetStringHandle(); - - setMaskBits( SkinMask ); - } -} - -void TSStatic::reSkin() -{ - if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) - { - Vector skins; - String(mSkinNameHandle.getString()).split( ";", skins ); - - for (S32 i = 0; i < skins.size(); i++) - { - String oldSkin( mAppliedSkinName.c_str() ); - String newSkin( skins[i] ); - - // Check if the skin handle contains an explicit "old" base string. This - // allows all models to support skinning, even if they don't follow the - // "base_xxx" material naming convention. - S32 split = newSkin.find( '=' ); // "old=new" format skin? - if ( split != String::NPos ) - { - oldSkin = newSkin.substr( 0, split ); - newSkin = newSkin.erase( 0, split+1 ); - } - - mShapeInstance->reSkin( newSkin, oldSkin ); - mAppliedSkinName = newSkin; - } - } -} - -void TSStatic::processTick( const Move *move ) -{ - if ( isServerObject() && mPlayAmbient && mAmbientThread ) - mShapeInstance->advanceTime( TickSec, mAmbientThread ); - - if ( isMounted() ) - { - MatrixF mat( true ); - mMount.object->getMountTransform(mMount.node, mMount.xfm, &mat ); - setTransform( mat ); - } -} - -void TSStatic::interpolateTick( F32 delta ) -{ -} - -void TSStatic::advanceTime( F32 dt ) -{ - if ( mPlayAmbient && mAmbientThread ) - mShapeInstance->advanceTime( dt, mAmbientThread ); - - if ( isMounted() ) - { - MatrixF mat( true ); - mMount.object->getRenderMountTransform( dt, mMount.node, mMount.xfm, &mat ); - setRenderTransform( mat ); - } -} - -void TSStatic::_updateShouldTick() -{ - bool shouldTick = (mPlayAmbient && mAmbientThread) || isMounted(); - - if ( isTicking() != shouldTick ) - setProcessTick( shouldTick ); -} - -void TSStatic::prepRenderImage( SceneRenderState* state ) -{ - if( !mShapeInstance ) - return; - - Point3F cameraOffset; - getRenderTransform().getColumn(3,&cameraOffset); - cameraOffset -= state->getDiffuseCameraPosition(); - F32 dist = cameraOffset.len(); - if (dist < 0.01f) - dist = 0.01f; - - if (mUseAlphaFade) - { - mAlphaFade = 1.0f; - if ((mAlphaFadeStart < mAlphaFadeEnd) && mAlphaFadeStart > 0.1f) - { - if (mInvertAlphaFade) - { - if (dist <= mAlphaFadeStart) - { - return; - } - if (dist < mAlphaFadeEnd) - { - mAlphaFade = ((dist - mAlphaFadeStart) / (mAlphaFadeEnd - mAlphaFadeStart)); - } - } - else - { - if (dist >= mAlphaFadeEnd) - { - return; - } - if (dist > mAlphaFadeStart) - { - mAlphaFade -= ((dist - mAlphaFadeStart) / (mAlphaFadeEnd - mAlphaFadeStart)); - } - } - } - } - - F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z)); - - // If we're currently rendering our own reflection we - // don't want to render ourselves into it. - if ( mCubeReflector.isRendering() ) - return; - - - if ( mForceDetail == -1 ) - mShapeInstance->setDetailFromDistance( state, dist * invScale ); - else - mShapeInstance->setCurrentDetail( mForceDetail ); - - if ( mShapeInstance->getCurrentDetail() < 0 ) - return; - - GFXTransformSaver saver; - - // Set up our TS render state. - TSRenderState rdata; - rdata.setSceneState( state ); - rdata.setFadeOverride( 1.0f ); - rdata.setOriginSort( mUseOriginSort ); - - if ( mCubeReflector.isEnabled() ) - rdata.setCubemap( mCubeReflector.getCubemap() ); - - // Acculumation - rdata.setAccuTex(mAccuTex); - - // If we have submesh culling enabled then prepare - // the object space frustum to pass to the shape. - Frustum culler; - if ( mMeshCulling ) - { - culler = state->getCullingFrustum(); - MatrixF xfm( true ); - xfm.scale( Point3F::One / getScale() ); - xfm.mul( getRenderWorldTransform() ); - xfm.mul( culler.getTransform() ); - culler.setTransform( xfm ); - rdata.setCuller( &culler ); - } - - // We might have some forward lit materials - // so pass down a query to gather lights. - LightQuery query; - query.init( getWorldSphere() ); - rdata.setLightQuery( &query ); - - MatrixF mat = getRenderTransform(); - mat.scale( mObjScale ); - GFX->setWorldMatrix( mat ); - - if ( state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery() ) - { - RenderPassManager *pass = state->getRenderPass(); - OccluderRenderInst *ri = pass->allocInst(); - - ri->type = RenderPassManager::RIT_Occluder; - ri->query = mCubeReflector.getOcclusionQuery(); - mObjToWorld.mulP( mObjBox.getCenter(), &ri->position ); - ri->scale.set( mObjBox.getExtents() ); - ri->orientation = pass->allocUniqueXform( mObjToWorld ); - ri->isSphere = false; - state->getRenderPass()->addInst( ri ); - } - - mShapeInstance->animate(); - if(mShapeInstance) - { - if (mUseAlphaFade) - { - mShapeInstance->setAlphaAlways(mAlphaFade); - S32 s = mShapeInstance->mMeshObjects.size(); - - for(S32 x = 0; x < s; x++) - { - mShapeInstance->mMeshObjects[x].visible = mAlphaFade; - } - } - } - mShapeInstance->render( rdata ); - - if ( mRenderNormalScalar > 0 ) - { - ObjectRenderInst *ri = state->getRenderPass()->allocInst(); - ri->renderDelegate.bind( this, &TSStatic::_renderNormals ); - ri->type = RenderPassManager::RIT_Editor; - state->getRenderPass()->addInst( ri ); - } -} - -void TSStatic::_renderNormals( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat ) -{ - PROFILE_SCOPE( TSStatic_RenderNormals ); - - GFXTransformSaver saver; - - MatrixF mat = getRenderTransform(); - mat.scale( mObjScale ); - GFX->multWorld( mat ); - - S32 dl = mShapeInstance->getCurrentDetail(); - mShapeInstance->renderDebugNormals( mRenderNormalScalar, dl ); -} - -void TSStatic::onScaleChanged() -{ - Parent::onScaleChanged(); - - if ( mPhysicsRep ) - { - // If the editor is enabled delay the scale operation - // by a few milliseconds so that we're not rebuilding - // during an active scale drag operation. - if ( gEditingMission ) - mPhysicsRep->queueCallback( 500, Delegate( this, &TSStatic::_updatePhysics ) ); - else - _updatePhysics(); - } - - setMaskBits( ScaleMask ); -} - -void TSStatic::setTransform(const MatrixF & mat) -{ - Parent::setTransform(mat); - if ( !isMounted() ) - setMaskBits( TransformMask ); - - if ( mPhysicsRep ) - mPhysicsRep->setTransform( mat ); - - // Accumulation - if ( isClientObject() && mShapeInstance ) - { - if ( mShapeInstance->hasAccumulation() ) - AccumulationVolume::updateObject(this); - } - - // Since this is a static it's render transform changes 1 - // to 1 with it's collision transform... no interpolation. - setRenderTransform(mat); -} - -U32 TSStatic::packUpdate(NetConnection *con, U32 mask, BitStream *stream) -{ - U32 retMask = Parent::packUpdate(con, mask, stream); - - if ( stream->writeFlag( mask & TransformMask ) ) - mathWrite( *stream, getTransform() ); - - if ( stream->writeFlag( mask & ScaleMask ) ) - { - // Only write one bit if the scale is one. - if ( stream->writeFlag( mObjScale != Point3F::One ) ) - mathWrite( *stream, mObjScale ); - } - - if ( stream->writeFlag( mask & UpdateCollisionMask ) ) - stream->write( (U32)mCollisionType ); - - if ( stream->writeFlag( mask & SkinMask ) ) - con->packNetStringHandleU( stream, mSkinNameHandle ); - - if (stream->writeFlag(mask & AdvancedStaticOptionsMask)) - { - stream->writeString(mShapeName); - stream->write((U32)mDecalType); - - stream->writeFlag(mAllowPlayerStep); - stream->writeFlag(mMeshCulling); - stream->writeFlag(mUseOriginSort); - - stream->write(mRenderNormalScalar); - - stream->write(mForceDetail); - - stream->writeFlag(mPlayAmbient); - } - - if ( stream->writeFlag(mUseAlphaFade) ) - { - stream->write(mAlphaFadeStart); - stream->write(mAlphaFadeEnd); - stream->write(mInvertAlphaFade); - } - - if ( mLightPlugin ) - retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream); - - if( stream->writeFlag( reflectorDesc != NULL ) ) - { - stream->writeRangedU32( reflectorDesc->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast ); - } - return retMask; -} - -void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream) -{ - Parent::unpackUpdate(con, stream); - - if ( stream->readFlag() ) // TransformMask - { - MatrixF mat; - mathRead( *stream, &mat ); - setTransform(mat); - setRenderTransform(mat); - } - - if ( stream->readFlag() ) // ScaleMask - { - if ( stream->readFlag() ) - { - VectorF scale; - mathRead( *stream, &scale ); - setScale( scale ); - } - else - setScale( Point3F::One ); - } - - if ( stream->readFlag() ) // UpdateCollisionMask - { - U32 collisionType = CollisionMesh; - - stream->read( &collisionType ); - - // Handle it if we have changed CollisionType's - if ( (MeshType)collisionType != mCollisionType ) - { - mCollisionType = (MeshType)collisionType; - - if ( isProperlyAdded() && mShapeInstance ) - prepCollision(); - } - } - - if (stream->readFlag()) // SkinMask - { - NetStringHandle skinDesiredNameHandle = con->unpackNetStringHandleU(stream);; - if (mSkinNameHandle != skinDesiredNameHandle) - { - mSkinNameHandle = skinDesiredNameHandle; - reSkin(); - } - } - - if (stream->readFlag()) // AdvancedStaticOptionsMask - { - mShapeName = stream->readSTString(); - - stream->read((U32*)&mDecalType); - - mAllowPlayerStep = stream->readFlag(); - mMeshCulling = stream->readFlag(); - mUseOriginSort = stream->readFlag(); - - stream->read(&mRenderNormalScalar); - - stream->read(&mForceDetail); - mPlayAmbient = stream->readFlag(); - } - - mUseAlphaFade = stream->readFlag(); - if (mUseAlphaFade) - { - stream->read(&mAlphaFadeStart); - stream->read(&mAlphaFadeEnd); - stream->read(&mInvertAlphaFade); - } - - if ( mLightPlugin ) - { - mLightPlugin->unpackUpdate(this, con, stream); - } - - if( stream->readFlag() ) - { - cubeDescId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast ); - } - - if ( isProperlyAdded() ) - _updateShouldTick(); -} - -//---------------------------------------------------------------------------- -bool TSStatic::castRay(const Point3F &start, const Point3F &end, RayInfo* info) -{ - if ( mCollisionType == None ) - return false; - - if ( !mShapeInstance ) - return false; - - if ( mCollisionType == Bounds ) - { - F32 fst; - if (!mObjBox.collideLine(start, end, &fst, &info->normal)) - return false; - - info->t = fst; - info->object = this; - info->point.interpolate( start, end, fst ); - info->material = NULL; - return true; - } - else - { - RayInfo shortest = *info; - RayInfo localInfo; - shortest.t = 1e8f; - localInfo.generateTexCoord = info->generateTexCoord; - - for ( U32 i = 0; i < mLOSDetails.size(); i++ ) - { - mShapeInstance->animate( mLOSDetails[i] ); - - if ( mShapeInstance->castRayOpcode( mLOSDetails[i], start, end, &localInfo ) ) - { - localInfo.object = this; - - if (localInfo.t < shortest.t) - shortest = localInfo; - } - } - - if (shortest.object == this) - { - // Copy out the shortest time... - *info = shortest; - return true; - } - } - - return false; -} - -bool TSStatic::castRayRendered(const Point3F &start, const Point3F &end, RayInfo *info) -{ - if ( !mShapeInstance ) - return false; - - // Cast the ray against the currently visible detail - RayInfo localInfo; - bool res = mShapeInstance->castRayOpcode( mShapeInstance->getCurrentDetail(), start, end, &localInfo ); - - if ( res ) - { - *info = localInfo; - info->object = this; - return true; - } - - return false; -} - -bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF &) -{ - if ( !mShapeInstance ) - return false; - - // This is safe to set even if we're not outputing - polyList->setTransform( &mObjToWorld, mObjScale ); - polyList->setObject( this ); - - if ( context == PLC_Export ) - { - // Use highest detail level - S32 dl = 0; - - // Try to call on the client so we can export materials - if ( isServerObject() && getClientObject() ) - dynamic_cast(getClientObject())->mShapeInstance->buildPolyList( polyList, dl ); - else - mShapeInstance->buildPolyList( polyList, dl ); - } - else if ( context == PLC_Selection ) - { - // Use the last rendered detail level - S32 dl = mShapeInstance->getCurrentDetail(); - mShapeInstance->buildPolyListOpcode( dl, polyList, box ); - } - else - { - // Figure out the mesh type we're looking for. - MeshType meshType = ( context == PLC_Decal ) ? mDecalType : mCollisionType; - - if ( meshType == None ) - return false; - else if ( meshType == Bounds ) - polyList->addBox( mObjBox ); - else if ( meshType == VisibleMesh ) - mShapeInstance->buildPolyList( polyList, 0 ); - else - { - // Everything else is done from the collision meshes - // which may be built from either the visual mesh or - // special collision geometry. - for ( U32 i = 0; i < mCollisionDetails.size(); i++ ) - mShapeInstance->buildPolyListOpcode( mCollisionDetails[i], polyList, box ); - } - } - - return true; -} - -void TSStatic::buildConvex(const Box3F& box, Convex* convex) -{ - if ( mCollisionType == None ) - return; - - if ( mShapeInstance == NULL ) - return; - - // These should really come out of a pool - mConvexList->collectGarbage(); - - if ( mCollisionType == Bounds ) - { - // Just return a box convex for the entire shape... - Convex* cc = 0; - CollisionWorkingList& wl = convex->getWorkingList(); - for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) - { - if (itr->mConvex->getType() == BoxConvexType && - itr->mConvex->getObject() == this) - { - cc = itr->mConvex; - break; - } - } - if (cc) - return; - - // Create a new convex. - BoxConvex* cp = new BoxConvex; - mConvexList->registerObject(cp); - convex->addToWorkingList(cp); - cp->init(this); - - mObjBox.getCenter(&cp->mCenter); - cp->mSize.x = mObjBox.len_x() / 2.0f; - cp->mSize.y = mObjBox.len_y() / 2.0f; - cp->mSize.z = mObjBox.len_z() / 2.0f; - } - else // CollisionMesh || VisibleMesh - { - TSStaticPolysoupConvex::smCurObject = this; - - for (U32 i = 0; i < mCollisionDetails.size(); i++) - mShapeInstance->buildConvexOpcode( mObjToWorld, mObjScale, mCollisionDetails[i], box, convex, mConvexList ); - - TSStaticPolysoupConvex::smCurObject = NULL; - } -} - -SceneObject* TSStaticPolysoupConvex::smCurObject = NULL; - -TSStaticPolysoupConvex::TSStaticPolysoupConvex() -: box( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ), - normal( 0.0f, 0.0f, 0.0f, 0.0f ), - idx( 0 ), - mesh( NULL ) -{ - mType = TSPolysoupConvexType; - - for ( U32 i = 0; i < 4; ++i ) - { - verts[i].set( 0.0f, 0.0f, 0.0f ); - } -} - -Point3F TSStaticPolysoupConvex::support(const VectorF& vec) const -{ - F32 bestDot = mDot( verts[0], vec ); - - const Point3F *bestP = &verts[0]; - for(S32 i=1; i<4; i++) - { - F32 newD = mDot(verts[i], vec); - if(newD > bestDot) - { - bestDot = newD; - bestP = &verts[i]; - } - } - - return *bestP; -} - -Box3F TSStaticPolysoupConvex::getBoundingBox() const -{ - Box3F wbox = box; - wbox.minExtents.convolve( mObject->getScale() ); - wbox.maxExtents.convolve( mObject->getScale() ); - mObject->getTransform().mul(wbox); - return wbox; -} - -Box3F TSStaticPolysoupConvex::getBoundingBox(const MatrixF& mat, const Point3F& scale) const -{ - AssertISV(false, "TSStaticPolysoupConvex::getBoundingBox(m,p) - Not implemented. -- XEA"); - return box; -} - -void TSStaticPolysoupConvex::getPolyList(AbstractPolyList *list) -{ - // Transform the list into object space and set the pointer to the object - MatrixF i( mObject->getTransform() ); - Point3F iS( mObject->getScale() ); - list->setTransform(&i, iS); - list->setObject(mObject); - - // Add only the original collision triangle - S32 base = list->addPoint(verts[0]); - list->addPoint(verts[2]); - list->addPoint(verts[1]); - - list->begin(0, (U32)idx ^ (uintptr_t)mesh); - list->vertex(base + 2); - list->vertex(base + 1); - list->vertex(base + 0); - list->plane(base + 0, base + 1, base + 2); - list->end(); -} - -void TSStaticPolysoupConvex::getFeatures(const MatrixF& mat,const VectorF& n, ConvexFeature* cf) -{ - cf->material = 0; - cf->object = mObject; - - // For a tetrahedron this is pretty easy... first - // convert everything into world space. - Point3F tverts[4]; - mat.mulP(verts[0], &tverts[0]); - mat.mulP(verts[1], &tverts[1]); - mat.mulP(verts[2], &tverts[2]); - mat.mulP(verts[3], &tverts[3]); - - // points... - S32 firstVert = cf->mVertexList.size(); - cf->mVertexList.increment(); cf->mVertexList.last() = tverts[0]; - cf->mVertexList.increment(); cf->mVertexList.last() = tverts[1]; - cf->mVertexList.increment(); cf->mVertexList.last() = tverts[2]; - cf->mVertexList.increment(); cf->mVertexList.last() = tverts[3]; - - // edges... - cf->mEdgeList.increment(); - cf->mEdgeList.last().vertex[0] = firstVert+0; - cf->mEdgeList.last().vertex[1] = firstVert+1; - - cf->mEdgeList.increment(); - cf->mEdgeList.last().vertex[0] = firstVert+1; - cf->mEdgeList.last().vertex[1] = firstVert+2; - - cf->mEdgeList.increment(); - cf->mEdgeList.last().vertex[0] = firstVert+2; - cf->mEdgeList.last().vertex[1] = firstVert+0; - - cf->mEdgeList.increment(); - cf->mEdgeList.last().vertex[0] = firstVert+3; - cf->mEdgeList.last().vertex[1] = firstVert+0; - - cf->mEdgeList.increment(); - cf->mEdgeList.last().vertex[0] = firstVert+3; - cf->mEdgeList.last().vertex[1] = firstVert+1; - - cf->mEdgeList.increment(); - cf->mEdgeList.last().vertex[0] = firstVert+3; - cf->mEdgeList.last().vertex[1] = firstVert+2; - - // triangles... - cf->mFaceList.increment(); - cf->mFaceList.last().normal = PlaneF(tverts[2], tverts[1], tverts[0]); - cf->mFaceList.last().vertex[0] = firstVert+2; - cf->mFaceList.last().vertex[1] = firstVert+1; - cf->mFaceList.last().vertex[2] = firstVert+0; - - cf->mFaceList.increment(); - cf->mFaceList.last().normal = PlaneF(tverts[1], tverts[0], tverts[3]); - cf->mFaceList.last().vertex[0] = firstVert+1; - cf->mFaceList.last().vertex[1] = firstVert+0; - cf->mFaceList.last().vertex[2] = firstVert+3; - - cf->mFaceList.increment(); - cf->mFaceList.last().normal = PlaneF(tverts[2], tverts[1], tverts[3]); - cf->mFaceList.last().vertex[0] = firstVert+2; - cf->mFaceList.last().vertex[1] = firstVert+1; - cf->mFaceList.last().vertex[2] = firstVert+3; - - cf->mFaceList.increment(); - cf->mFaceList.last().normal = PlaneF(tverts[0], tverts[2], tverts[3]); - cf->mFaceList.last().vertex[0] = firstVert+0; - cf->mFaceList.last().vertex[1] = firstVert+2; - cf->mFaceList.last().vertex[2] = firstVert+3; - - // All done! -} - -void TSStatic::onMount( SceneObject *obj, S32 node ) -{ - Parent::onMount(obj, node); - _updateShouldTick(); -} - -void TSStatic::onUnmount( SceneObject *obj, S32 node ) -{ - Parent::onUnmount( obj, node ); - setMaskBits( TransformMask ); - _updateShouldTick(); -} - -//------------------------------------------------------------------------ -//These functions are duplicated in tsStatic and shapeBase. -//They each function a little differently; but achieve the same purpose of gathering -//target names/counts without polluting simObject. - -DefineEngineMethod( TSStatic, getTargetName, const char*, ( S32 index ),(0), - "Get the name of the indexed shape material.\n" - "@param index index of the material to get (valid range is 0 - getTargetCount()-1).\n" - "@return the name of the indexed material.\n" - "@see getTargetCount()\n") -{ - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); - - return obj->getShapeInstance()->getTargetName(index); - } - - return ""; -} - -DefineEngineMethod( TSStatic, getTargetCount, S32,(),, - "Get the number of materials in the shape.\n" - "@return the number of materials in the shape.\n" - "@see getTargetName()\n") -{ - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); - - return obj->getShapeInstance()->getTargetCount(); - } - - return -1; -} - -// This method is able to change materials per map to with others. The material that is being replaced is being mapped to -// unmapped_mat as a part of this transition - -DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Material* oldMat, Material* newMat ),("",nullAsType(),nullAsType()), - "@brief Change one of the materials on the shape.\n\n" - - "This method changes materials per mapTo with others. The material that " - "is being replaced is mapped to unmapped_mat as a part of this transition.\n" - - "@note Warning, right now this only sort of works. It doesn't do a live " - "update like it should.\n" - - "@param mapTo the name of the material target to remap (from getTargetName)\n" - "@param oldMat the old Material that was mapped \n" - "@param newMat the new Material to map\n\n" - - "@tsexample\n" - "// remap the first material in the shape\n" - "%mapTo = %obj.getTargetName( 0 );\n" - "%obj.changeMaterial( %mapTo, 0, MyMaterial );\n" - "@endtsexample\n" ) -{ - // if no valid new material, theres no reason for doing this - if( !newMat ) - { - Con::errorf("TSShape::changeMaterial failed: New material does not exist!"); - return; - } - - TSMaterialList* shapeMaterialList = object->getShape()->materialList; - - // Check the mapTo name exists for this shape - S32 matIndex = shapeMaterialList->getMaterialNameList().find_next(String(mapTo)); - if (matIndex < 0) - { - Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo); - return; - } - - // Lets remap the old material off, so as to let room for our current material room to claim its spot - if( oldMat ) - oldMat->mMapTo = String("unmapped_mat"); - - newMat->mMapTo = mapTo; - - // Map the material by name in the matmgr - MATMGR->mapMaterial( mapTo, newMat->getName() ); - - // Replace instances with the new material being traded in. Lets make sure that we only - // target the specific targets per inst, this is actually doing more than we thought - delete shapeMaterialList->mMatInstList[matIndex]; - shapeMaterialList->mMatInstList[matIndex] = newMat->createMatInstance(); - - // Finish up preparing the material instances for rendering - const GFXVertexFormat *flags = getGFXVertexFormat(); - FeatureSet features = MATMGR->getDefaultFeatures(); - shapeMaterialList->getMaterialInst(matIndex)->init(features, flags); -} - -DefineEngineMethod( TSStatic, getModelFile, const char *, (),, - "@brief Get the model filename used by this shape.\n\n" - - "@return the shape filename\n\n" - "@tsexample\n" - "// Acquire the model filename used on this shape.\n" - "%modelFilename = %obj.getModelFile();\n" - "@endtsexample\n" - ) -{ -<<<<<<< HEAD - return object->getShapeFileName(); -======= - return object->getShapeFileName(); ->>>>>>> garagegames/development -} diff --git a/Engine/source/T3D/tsStatic.h b/Engine/source/T3D/tsStatic.h index db1ff138c..40e89c0fc 100644 --- a/Engine/source/T3D/tsStatic.h +++ b/Engine/source/T3D/tsStatic.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _TSSTATIC_H_ #define _TSSTATIC_H_ @@ -236,6 +241,19 @@ public: const Vector& getLOSDetails() const { return mLOSDetails; } +private: + virtual void onStaticModified(const char* slotName, const char*newValue = NULL); +protected: + Vector mDecalDetails; + Vector* mDecalDetailsPtr; +public: + bool mIgnoreZodiacs; + bool mHasGradients; + bool mInvertGradientRange; + Point2F mGradientRangeUser; + Point2F mGradientRange; +private: + void set_special_typing(); }; typedef TSStatic::MeshType TSMeshType; diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index 7fef4a217..fc1619afb 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "environment/meshRoad.h" @@ -52,6 +57,8 @@ #include "T3D/physics/physicsCollision.h" #include "environment/nodeListManager.h" +#include "afx/ce/afxZodiacMgr.h" + #define MIN_METERS_PER_SEGMENT 1.0f #define MIN_NODE_DEPTH 0.25f #define MAX_NODE_DEPTH 50.0f @@ -620,6 +627,7 @@ MeshRoad::MeshRoad() mMatInst[Top] = NULL; mMatInst[Bottom] = NULL; mMatInst[Side] = NULL; + mTypeMask |= TerrainLikeObjectType; } MeshRoad::~MeshRoad() @@ -821,6 +829,7 @@ void MeshRoad::prepRenderImage( SceneRenderState* state ) // otherwise obey the smShowRoad flag if ( smShowRoad || !smEditorOpen ) { + afxZodiacMgr::renderMeshRoadZodiacs(state, this); MeshRenderInst coreRI; coreRI.clear(); coreRI.objectToWorld = &MatrixF::Identity; @@ -1379,6 +1388,11 @@ bool MeshRoad::buildSegmentPolyList( AbstractPolyList* polyList, U32 startSegIdx ddraw->setLastTTL( 0 ); } + if (buildPolyList_TopSurfaceOnly) + { + offset += 4; + continue; + } // Left Face polyList->begin( 0,0 ); @@ -2454,3 +2468,16 @@ DefineEngineMethod( MeshRoad, postApply, void, (),, { object->inspectPostApply(); } +bool MeshRoad::buildPolyList_TopSurfaceOnly = false; + +bool MeshRoad::buildTopPolyList(PolyListContext plc, AbstractPolyList* polyList) +{ + static Box3F box_prox; static SphereF ball_prox; + + buildPolyList_TopSurfaceOnly = true; + bool result = buildPolyList(plc, polyList, box_prox, ball_prox); + buildPolyList_TopSurfaceOnly = false; + + return result; +} + diff --git a/Engine/source/environment/meshRoad.h b/Engine/source/environment/meshRoad.h index ed47984b1..06157b343 100644 --- a/Engine/source/environment/meshRoad.h +++ b/Engine/source/environment/meshRoad.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _MESHROAD_H_ #define _MESHROAD_H_ @@ -560,6 +565,10 @@ protected: Convex* mConvexList; Vector mDebugConvex; PhysicsBody *mPhysicsRep; +private: + static bool buildPolyList_TopSurfaceOnly; +public: + bool buildTopPolyList(PolyListContext, AbstractPolyList*); }; From 00e3eb6ba8d2286108e7a216e9c1823c009f4bfc Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 22:10:56 +0100 Subject: [PATCH 009/312] terrain-zodiacs -- Changes made for rendering zodiacs on regular terrain. --- Engine/source/terrain/terrCell.cpp | 119 +++++++++++++++++++++++++++ Engine/source/terrain/terrCell.h | 12 +++ Engine/source/terrain/terrData.cpp | 30 +++++++ Engine/source/terrain/terrData.h | 12 +++ Engine/source/terrain/terrRender.cpp | 10 +++ Engine/source/terrain/terrRender.h | 11 +++ 6 files changed, 194 insertions(+) diff --git a/Engine/source/terrain/terrCell.cpp b/Engine/source/terrain/terrCell.cpp index d96811f45..ba1262df1 100644 --- a/Engine/source/terrain/terrCell.cpp +++ b/Engine/source/terrain/terrCell.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "terrain/terrCell.h" @@ -56,6 +61,7 @@ TerrCell::TerrCell() mIsInteriorOnly( false ) { dMemset( mChildren, 0, sizeof( mChildren ) ); + zode_vertexBuffer = 0; } TerrCell::~TerrCell() @@ -64,6 +70,7 @@ TerrCell::~TerrCell() for ( U32 i=0; i < 4; i++ ) SAFE_DELETE( mChildren[i] ); + deleteZodiacVertexBuffer(); } void TerrCell::createPrimBuffer( GFXPrimitiveBufferHandle *primBuffer ) @@ -582,6 +589,7 @@ void TerrCell::_updateVertexBuffer() AssertFatal( vbcounter == smVBSize, "bad" ); mVertexBuffer.unlock(); + deleteZodiacVertexBuffer(); } void TerrCell::_updatePrimitiveBuffer() @@ -1089,3 +1097,114 @@ void TerrCell::deleteMaterials() if ( mChildren[i] ) mChildren[i]->deleteMaterials(); } + +const Point3F* TerrCell::getZodiacVertexBuffer() +{ + if (!zode_vertexBuffer) + createZodiacVertexBuffer(); + return zode_vertexBuffer; +} + +void TerrCell::createZodiacPrimBuffer(U16** zode_primBuffer) +{ + if (*zode_primBuffer != 0) + delete [] *zode_primBuffer; + + *zode_primBuffer = new U16[TerrCell::smMinCellSize*TerrCell::smMinCellSize*6]; + + // Lock and fill it up! + U16* idxBuff = *zode_primBuffer; + U32 counter = 0; + U32 maxIndex = 0; + + for ( U32 y = 0; y < smMinCellSize; y++ ) + { + const U32 yTess = y % 2; + + for ( U32 x = 0; x < smMinCellSize; x++ ) + { + U32 index = ( y * smVBStride ) + x; + + const U32 xTess = x % 2; + + if ( ( xTess == 0 && yTess == 0 ) || + ( xTess != 0 && yTess != 0 ) ) + { + idxBuff[0] = index + 0; + idxBuff[1] = index + smVBStride; + idxBuff[2] = index + smVBStride + 1; + + idxBuff[3] = index + 0; + idxBuff[4] = index + smVBStride + 1; + idxBuff[5] = index + 1; + } + else + { + idxBuff[0] = index + 1; + idxBuff[1] = index; + idxBuff[2] = index + smVBStride; + + idxBuff[3] = index + 1; + idxBuff[4] = index + smVBStride; + idxBuff[5] = index + smVBStride + 1; + } + + idxBuff += 6; + maxIndex = index + 1 + smVBStride; + counter += 6; + } + } +} + +void TerrCell::createZodiacVertexBuffer() +{ + const F32 squareSize = mTerrain->getSquareSize(); + const U32 blockSize = mTerrain->getBlockSize(); + const U32 stepSize = mSize / smMinCellSize; + + if (zode_vertexBuffer) + delete [] zode_vertexBuffer; + + zode_vertexBuffer = new Point3F[smVBStride*smVBStride]; + + Point3F* vert = zode_vertexBuffer; + + Point2I gridPt; + Point2F point; + F32 height; + + const TerrainFile *file = mTerrain->getFile(); + + for ( U32 y = 0; y < smVBStride; y++ ) + { + for ( U32 x = 0; x < smVBStride; x++ ) + { + // We clamp here to keep the geometry from reading across + // one side of the height map to the other causing walls + // around the edges of the terrain. + gridPt.x = mClamp( mPoint.x + x * stepSize, 0, blockSize - 1 ); + gridPt.y = mClamp( mPoint.y + y * stepSize, 0, blockSize - 1 ); + + // Setup this point. + point.x = (F32)gridPt.x * squareSize; + point.y = (F32)gridPt.y * squareSize; + height = fixedToFloat( file->getHeight( gridPt.x, gridPt.y ) ); + + vert->x = point.x; + vert->y = point.y; + vert->z = height; + + ++vert; + } + } +} + +void TerrCell::deleteZodiacVertexBuffer() +{ + if (zode_vertexBuffer) + { + delete [] zode_vertexBuffer; + zode_vertexBuffer = 0; + } +} + diff --git a/Engine/source/terrain/terrCell.h b/Engine/source/terrain/terrCell.h index f736c2915..0b948cedd 100644 --- a/Engine/source/terrain/terrCell.h +++ b/Engine/source/terrain/terrCell.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _TERRCELL_H_ #define _TERRCELL_H_ @@ -226,6 +231,13 @@ public: void renderBounds() const; /// @} +protected: + Point3F* zode_vertexBuffer; + void createZodiacVertexBuffer(); +public: + const Point3F* getZodiacVertexBuffer(); + void deleteZodiacVertexBuffer(); + static void createZodiacPrimBuffer(U16** primBuffer); }; inline F32 TerrCell::getDistanceTo( const Point3F &pt ) const diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index eff266385..a97ec7e98 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "terrain/terrData.h" @@ -200,6 +205,8 @@ TerrainBlock::TerrainBlock() { mTypeMask = TerrainObjectType | StaticObjectType | StaticShapeObjectType; mNetFlags.set(Ghostable | ScopeAlways); + mIgnoreZodiacs = false; + zode_primBuffer = 0; } @@ -218,6 +225,7 @@ TerrainBlock::~TerrainBlock() if (editor) editor->detachTerrain(this); #endif + deleteZodiacPrimitiveBuffer(); } void TerrainBlock::_onTextureEvent( GFXTexCallbackCode code ) @@ -1006,6 +1014,7 @@ void TerrainBlock::_rebuildQuadtree() // Build the shared PrimitiveBuffer. mCell->createPrimBuffer( &mPrimBuffer ); + deleteZodiacPrimitiveBuffer(); } void TerrainBlock::_updatePhysics() @@ -1148,6 +1157,9 @@ void TerrainBlock::initPersistFields() endGroup( "Misc" ); + addGroup("AFX"); + addField("ignoreZodiacs", TypeBool, Offset(mIgnoreZodiacs, TerrainBlock)); + endGroup("AFX"); Parent::initPersistFields(); removeField( "scale" ); @@ -1198,6 +1210,7 @@ U32 TerrainBlock::packUpdate(NetConnection* con, U32 mask, BitStream *stream) stream->write( mScreenError ); stream->writeInt(mBaseTexFormat, 32); + stream->writeFlag(mIgnoreZodiacs); return retMask; } @@ -1267,6 +1280,7 @@ void TerrainBlock::unpackUpdate(NetConnection* con, BitStream *stream) stream->read( &mScreenError ); mBaseTexFormat = (BaseTexFormat)stream->readInt(32); + mIgnoreZodiacs = stream->readFlag(); } void TerrainBlock::getMinMaxHeight( F32 *minHeight, F32 *maxHeight ) const @@ -1405,3 +1419,19 @@ DefineConsoleFunction( getTerrainHeightBelowPosition, F32, (const char* ptOrX, c return height; } +const U16* TerrainBlock::getZodiacPrimitiveBuffer() +{ + if (!zode_primBuffer && !mIgnoreZodiacs) + TerrCell::createZodiacPrimBuffer(&zode_primBuffer); + return zode_primBuffer; +} + +void TerrainBlock::deleteZodiacPrimitiveBuffer() +{ + if (zode_primBuffer != 0) + { + delete [] zode_primBuffer; + zode_primBuffer = 0; + } +} + diff --git a/Engine/source/terrain/terrData.h b/Engine/source/terrain/terrData.h index f7b3fb179..87f994a03 100644 --- a/Engine/source/terrain/terrData.h +++ b/Engine/source/terrain/terrData.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _TERRDATA_H_ #define _TERRDATA_H_ @@ -457,6 +462,13 @@ public: U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream); void unpackUpdate(NetConnection *conn, BitStream *stream); void inspectPostApply(); + +protected: + bool mIgnoreZodiacs; + U16* zode_primBuffer; + void deleteZodiacPrimitiveBuffer(); +public: + const U16* getZodiacPrimitiveBuffer(); }; #endif // _TERRDATA_H_ diff --git a/Engine/source/terrain/terrRender.cpp b/Engine/source/terrain/terrRender.cpp index be67d58eb..15c294611 100644 --- a/Engine/source/terrain/terrRender.cpp +++ b/Engine/source/terrain/terrRender.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "terrain/terrRender.h" @@ -45,6 +50,8 @@ #include "gfx/gfxDrawUtil.h" +#include "afx/arcaneFX.h" +#include "afx/ce/afxZodiacMgr.h" #include "gfx/gfxTransformSaver.h" #include "gfx/bitmap/gBitmap.h" #include "gfx/bitmap/ddsFile.h" @@ -421,6 +428,7 @@ void TerrainBlock::_renderBlock( SceneRenderState *state ) if ( isColorDrawPass ) lm = LIGHTMGR; + bool has_zodiacs = afxZodiacMgr::doesBlockContainZodiacs(state, this); for ( U32 i=0; i < renderCells.size(); i++ ) { TerrCell *cell = renderCells[i]; @@ -483,6 +491,8 @@ void TerrainBlock::_renderBlock( SceneRenderState *state ) inst->defaultKey = (U32)cell->getMaterials(); + if (has_zodiacs) + afxZodiacMgr::renderTerrainZodiacs(state, this, cell); // Submit it for rendering. renderPass->addInst( inst ); } diff --git a/Engine/source/terrain/terrRender.h b/Engine/source/terrain/terrRender.h index 0f4bfbc9a..ea67c0ca2 100644 --- a/Engine/source/terrain/terrRender.h +++ b/Engine/source/terrain/terrRender.h @@ -20,6 +20,16 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +// +// The terrain implementation of zodiacs is largely contained in +// afxZodiac.[h,cpp], however, some changes are required to the terrain +// code. Structures EmitChunk and SquareStackNode now contain an +// afxZodiacBitmask for keeping track of zodiac intersections. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _TERRRENDER_H_ #define _TERRRENDER_H_ @@ -27,6 +37,7 @@ #include "terrain/terrData.h" #endif +#include "afx/ce/afxZodiacDefs.h" enum TerrConstants : U32 { MaxClipPlanes = 8, ///< left, right, top, bottom - don't need far tho... From 9d547537fdd384ff0eccbd72a83237ab5589a6e2 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 22:20:43 +0100 Subject: [PATCH 010/312] canvas -- Added a way for a child control to handle an event but still have GuiCanvas::processInputEvent() return false, therefore allowing the event to also be handled by the ActionMap. (see DemoGame::processInputEvent()) . Also added methods for clearing "down" status of mouse buttons in cases where ActionMap grabs the mouse for dragging and masks the up events from GuiCanvas. fade-gui-ctrl -- adds fading capability to GuiControl. --- Engine/source/gui/core/guiCanvas.cpp | 55 ++++++++++++++++++++------- Engine/source/gui/core/guiCanvas.h | 12 ++++++ Engine/source/gui/core/guiControl.cpp | 6 +++ Engine/source/gui/core/guiControl.h | 9 +++++ 4 files changed, 68 insertions(+), 14 deletions(-) diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index f00cf6cca..82c0475f0 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "gui/core/guiCanvas.h" @@ -605,10 +610,11 @@ bool GuiCanvas::tabPrev(void) bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent) { + mConsumeLastInputEvent = true; // First call the general input handler (on the extremely off-chance that it will be handled): if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent)) { - return(true); + return mConsumeLastInputEvent; } switch (inputEvent.deviceType) @@ -664,7 +670,7 @@ bool GuiCanvas::processKeyboardEvent(InputEventInfo &inputEvent) if (mFirstResponder) { if(mFirstResponder->onKeyDown(mLastEvent)) - return true; + return mConsumeLastInputEvent; } //see if we should tab next/prev @@ -675,12 +681,12 @@ bool GuiCanvas::processKeyboardEvent(InputEventInfo &inputEvent) if (inputEvent.modifier & SI_SHIFT) { if(tabPrev()) - return true; + return mConsumeLastInputEvent; } else if (inputEvent.modifier == 0) { if(tabNext()) - return true; + return mConsumeLastInputEvent; } } } @@ -691,14 +697,14 @@ bool GuiCanvas::processKeyboardEvent(InputEventInfo &inputEvent) if ((U32)mAcceleratorMap[i].keyCode == (U32)inputEvent.objInst && (U32)mAcceleratorMap[i].modifier == eventModifier) { mAcceleratorMap[i].ctrl->acceleratorKeyPress(mAcceleratorMap[i].index); - return true; + return mConsumeLastInputEvent; } } } else if(inputEvent.action == SI_BREAK) { if(mFirstResponder && mFirstResponder->onKeyUp(mLastEvent)) - return true; + return mConsumeLastInputEvent; //see if there's an accelerator for (U32 i = 0; i < mAcceleratorMap.size(); i++) @@ -706,7 +712,7 @@ bool GuiCanvas::processKeyboardEvent(InputEventInfo &inputEvent) if ((U32)mAcceleratorMap[i].keyCode == (U32)inputEvent.objInst && (U32)mAcceleratorMap[i].modifier == eventModifier) { mAcceleratorMap[i].ctrl->acceleratorKeyRelease(mAcceleratorMap[i].index); - return true; + return mConsumeLastInputEvent; } } } @@ -718,13 +724,14 @@ bool GuiCanvas::processKeyboardEvent(InputEventInfo &inputEvent) if ((U32)mAcceleratorMap[i].keyCode == (U32)inputEvent.objInst && (U32)mAcceleratorMap[i].modifier == eventModifier) { mAcceleratorMap[i].ctrl->acceleratorKeyPress(mAcceleratorMap[i].index); - return true; + return mConsumeLastInputEvent; } } if(mFirstResponder) { - return mFirstResponder->onKeyRepeat(mLastEvent); + bool ret = mFirstResponder->onKeyRepeat(mLastEvent); + return ret && mConsumeLastInputEvent; } } return false; @@ -801,7 +808,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent) rootMiddleMouseDragged(mLastEvent); else rootMouseMove(mLastEvent); - return true; + return mConsumeLastInputEvent; } else if ( inputEvent.objInst == SI_ZAXIS || inputEvent.objInst == SI_RZAXIS ) @@ -860,7 +867,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent) rootMouseUp(mLastEvent); } - return true; + return mConsumeLastInputEvent; } else if(inputEvent.objInst == KEY_BUTTON1) // right button { @@ -891,7 +898,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent) else // it was a mouse up rootRightMouseUp(mLastEvent); - return true; + return mConsumeLastInputEvent; } else if(inputEvent.objInst == KEY_BUTTON2) // middle button { @@ -922,7 +929,7 @@ bool GuiCanvas::processMouseEvent(InputEventInfo &inputEvent) else // it was a mouse up rootMiddleMouseUp(mLastEvent); - return true; + return mConsumeLastInputEvent; } } return false; @@ -1801,7 +1808,7 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */) if (GuiOffscreenCanvas::sList.size() != 0) { // Reset the entire state since oculus shit will have barfed it. - GFX->disableShaders(true); + //GFX->disableShaders(true); GFX->updateStates(true); for (Vector::iterator itr = GuiOffscreenCanvas::sList.begin(); itr != GuiOffscreenCanvas::sList.end(); itr++) @@ -2815,3 +2822,23 @@ ConsoleMethod( GuiCanvas, cursorNudge, void, 4, 4, "x, y" ) { object->cursorNudge(dAtof(argv[2]), dAtof(argv[3])); } +// This function allows resetting of the video-mode from script. It was motivated by +// the need to temporarily disable vsync during datablock cache load to avoid a +// significant slowdown. +bool AFX_forceVideoReset = false; + +ConsoleMethod( GuiCanvas, resetVideoMode, void, 2,2, "()") +{ + PlatformWindow* window = object->getPlatformWindow(); + if( window ) + { + GFXWindowTarget* gfx_target = window->getGFXTarget(); + if ( gfx_target ) + { + AFX_forceVideoReset = true; + gfx_target->resetMode(); + AFX_forceVideoReset = false; + } + } +} + diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index fa213f56a..7775b8af0 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _GUICANVAS_H_ #define _GUICANVAS_H_ @@ -446,6 +451,13 @@ public: private: static const U32 MAX_GAMEPADS = 4; ///< The maximum number of supported gamepads + protected: + bool mConsumeLastInputEvent; + public: + void clearMouseRightButtonDown(void) { mMouseRightButtonDown = false; } + void clearMouseButtonDown(void) { mMouseButtonDown = false; } + void setConsumeLastInputEvent(bool flag) { mConsumeLastInputEvent = flag; } + bool getLastCursorPoint(Point2I& pt) const { pt = mLastCursorPt; return mLastCursorEnabled; } }; #endif diff --git a/Engine/source/gui/core/guiControl.cpp b/Engine/source/gui/core/guiControl.cpp index fb833ca7b..968fc9a16 100644 --- a/Engine/source/gui/core/guiControl.cpp +++ b/Engine/source/gui/core/guiControl.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "gui/core/guiControl.h" @@ -224,6 +229,7 @@ GuiControl::GuiControl() : mAddGroup( NULL ), mCanSaveFieldDictionary = false; mNotifyChildrenResized = true; + fade_amt = 1.0f; } //----------------------------------------------------------------------------- diff --git a/Engine/source/gui/core/guiControl.h b/Engine/source/gui/core/guiControl.h index fa3a327dd..eae37a8df 100644 --- a/Engine/source/gui/core/guiControl.h +++ b/Engine/source/gui/core/guiControl.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _GUICONTROL_H_ #define _GUICONTROL_H_ @@ -822,6 +827,10 @@ class GuiControl : public SimGroup void inspectPostApply(); void inspectPreApply(); +protected: + F32 fade_amt; +public: + void setFadeAmount(F32 amt) { fade_amt = amt; } }; typedef GuiControl::horizSizingOptions GuiHorizontalSizing; From fc449307f992d18b7cbba92623ef1d5355fd91c2 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 22:22:23 +0100 Subject: [PATCH 011/312] packet-overflow-checks -- Monitor packet sizes to avoid packet overflow, especially when dynamic variables are used for AFX effect parameterization. --- Engine/source/core/stream/bitStream.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Engine/source/core/stream/bitStream.h b/Engine/source/core/stream/bitStream.h index 7f6fe82ca..93287b938 100644 --- a/Engine/source/core/stream/bitStream.h +++ b/Engine/source/core/stream/bitStream.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _BITSTREAM_H_ #define _BITSTREAM_H_ @@ -254,6 +259,7 @@ public: U32 getPosition() const; bool setPosition(const U32 in_newPosition); U32 getStreamSize(); + S32 getMaxWriteBitNum() const { return maxWriteBitNum; } }; class ResizeBitStream : public BitStream From 43d2399aea7e4c04094721edec0f12763dcaa4e6 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 22:45:10 +0100 Subject: [PATCH 012/312] enhanced-emitter -- numerous enhancements to ParticleEmitter class. pooled-particles -- optional support for pooled particles which combines multiple emitters in a common sorting pool. --- Engine/source/T3D/fx/particleEmitter.cpp | 271 ++++++++++++++++++++--- Engine/source/T3D/fx/particleEmitter.h | 57 ++++- 2 files changed, 297 insertions(+), 31 deletions(-) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index d59bef4e3..4005607d7 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/fx/particleEmitter.h" @@ -42,6 +43,10 @@ #include "lighting/lightInfo.h" #include "console/engineAPI.h" +#if defined(AFX_CAP_PARTICLE_POOLS) +#include "afx/util/afxParticlePool.h" +#endif + Point3F ParticleEmitter::mWindVelocity( 0.0, 0.0, 0.0 ); const F32 ParticleEmitter::AgedSpinToRadians = (1.0f/1000.0f) * (1.0f/360.0f) * M_PI_F * 2.0f; @@ -153,6 +158,21 @@ ParticleEmitterData::ParticleEmitterData() alignParticles = false; alignDirection = Point3F(0.0f, 1.0f, 0.0f); + + ejectionInvert = false; + fade_color = false; + fade_alpha = false; + fade_size = false; + parts_per_eject = 1; + use_emitter_xfm = false; + +#if defined(AFX_CAP_PARTICLE_POOLS) + pool_datablock = 0; + pool_index = 0; + pool_depth_fade = false; + pool_radial_fade = false; + do_pool_id_convert = false; +#endif } @@ -297,6 +317,23 @@ void ParticleEmitterData::initPersistFields() endGroup( "ParticleEmitterData" ); + addGroup("AFX"); + addField("ejectionInvert", TypeBool, Offset(ejectionInvert, ParticleEmitterData)); + addField("fadeColor", TypeBool, Offset(fade_color, ParticleEmitterData)); + addField("fadeAlpha", TypeBool, Offset(fade_alpha, ParticleEmitterData)); + addField("fadeSize", TypeBool, Offset(fade_size, ParticleEmitterData)); + // useEmitterTransform currently does not work in TGEA or T3D + addField("useEmitterTransform", TypeBool, Offset(use_emitter_xfm, ParticleEmitterData)); + endGroup("AFX"); + +#if defined(AFX_CAP_PARTICLE_POOLS) + addGroup("AFX Pooled Particles"); + addField("poolData", TYPEID(), Offset(pool_datablock, ParticleEmitterData)); + addField("poolIndex", TypeS32, Offset(pool_index, ParticleEmitterData)); + addField("poolDepthFade", TypeBool, Offset(pool_depth_fade, ParticleEmitterData)); + addField("poolRadialFade", TypeBool, Offset(pool_radial_fade, ParticleEmitterData)); + endGroup("AFX Pooled Particles"); +#endif // disallow some field substitutions disableFieldSubstitutions("particles"); onlyKeepClearSubstitutions("poolData"); // subs resolving to "~~", or "~0" are OK @@ -365,6 +402,22 @@ void ParticleEmitterData::packData(BitStream* stream) stream->writeFlag(renderReflection); stream->writeFlag(glow); stream->writeInt( blendStyle, 4 ); + + stream->writeFlag(ejectionInvert); + stream->writeFlag(fade_color); + stream->writeFlag(fade_alpha); + stream->writeFlag(fade_size); + stream->writeFlag(use_emitter_xfm); + +#if defined(AFX_CAP_PARTICLE_POOLS) + if (stream->writeFlag(pool_datablock)) + { + stream->writeRangedU32(packed ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); + stream->write(pool_index); + stream->writeFlag(pool_depth_fade); + stream->writeFlag(pool_radial_fade); + } +#endif } //----------------------------------------------------------------------------- @@ -428,6 +481,22 @@ void ParticleEmitterData::unpackData(BitStream* stream) renderReflection = stream->readFlag(); glow = stream->readFlag(); blendStyle = stream->readInt( 4 ); + ejectionInvert = stream->readFlag(); + fade_color = stream->readFlag(); + fade_alpha = stream->readFlag(); + fade_size = stream->readFlag(); + use_emitter_xfm = stream->readFlag(); + +#if defined(AFX_CAP_PARTICLE_POOLS) + if (stream->readFlag()) + { + pool_datablock = (afxParticlePoolData*)stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); + stream->read(&pool_index); + pool_depth_fade = stream->readFlag(); + pool_radial_fade = stream->readFlag(); + do_pool_id_convert = true; + } +#endif } //----------------------------------------------------------------------------- @@ -607,6 +676,22 @@ bool ParticleEmitterData::preload(bool server, String &errorStr) if (!server) { +#if defined(AFX_CAP_PARTICLE_POOLS) + if (do_pool_id_convert) + { + SimObjectId db_id = (SimObjectId)(uintptr_t)pool_datablock; + if (db_id != 0) + { + // try to convert id to pointer + if (!Sim::findObject(db_id, pool_datablock)) + { + Con::errorf("ParticleEmitterData::reload() -- bad datablockId: 0x%x (poolData)", db_id); + } + } + do_pool_id_convert = false; + } +#endif + // load emitter texture if specified if (textureName && textureName[0]) { @@ -676,6 +761,8 @@ void ParticleEmitterData::allocPrimBuffer( S32 overrideSize ) partListInitSize = maxPartLife / (ejectionPeriodMS - periodVarianceMS); partListInitSize += 8; // add 8 as "fudge factor" to make sure it doesn't realloc if it goes over by 1 + if (parts_per_eject > 1) + partListInitSize *= parts_per_eject; // if override size is specified, then the emitter overran its buffer and needs a larger allocation if( overrideSize != -1 ) @@ -871,7 +958,16 @@ ParticleEmitter::ParticleEmitter() // ParticleEmitter should be allocated on the client only. mNetFlags.set( IsGhost ); + fade_amt = 1.0f; + forced_bbox = false; + db_temp_clone = false; + pos_pe.set(0,0,0); + sort_priority = 0; mDataBlock = 0; + +#if defined(AFX_CAP_PARTICLE_POOLS) + pool = 0; +#endif } //----------------------------------------------------------------------------- @@ -920,6 +1016,11 @@ bool ParticleEmitter::onAdd() mObjBox.maxExtents = Point3F(radius, radius, radius); resetWorldBox(); +#if defined(AFX_CAP_PARTICLE_POOLS) + if (pool) + pool->addParticleEmitter(this); +#endif + return true; } @@ -929,6 +1030,14 @@ bool ParticleEmitter::onAdd() //----------------------------------------------------------------------------- void ParticleEmitter::onRemove() { +#if defined(AFX_CAP_PARTICLE_POOLS) + if (pool) + { + pool->removeParticleEmitter(this); + pool = 0; + } +#endif + removeFromScene(); Parent::onRemove(); } @@ -1015,6 +1124,11 @@ LinearColorF ParticleEmitter::getCollectiveColor() //----------------------------------------------------------------------------- void ParticleEmitter::prepRenderImage(SceneRenderState* state) { +#if defined(AFX_CAP_PARTICLE_POOLS) + if (pool) + return; +#endif + if( state->isReflectPass() && !getDataBlock()->renderReflection ) return; @@ -1043,6 +1157,7 @@ void ParticleEmitter::prepRenderImage(SceneRenderState* state) ri->translucentSort = true; ri->type = RenderPassManager::RIT_Particle; ri->sortDistSq = getRenderWorldBox().getSqDistanceToPoint( camPos ); + ri->defaultKey = (-sort_priority*100); // Draw the system offscreen unless the highResOnly flag is set on the datablock ri->systemState = ( getDataBlock()->highResOnly ? PSS_AwaitingHighResDraw : PSS_AwaitingOffscreenDraw ); @@ -1146,6 +1261,7 @@ void ParticleEmitter::emitParticles(const Point3F& point, return; } + pos_pe = point; Point3F realStart; if( useLastPosition && mHasLastPosition ) realStart = mLastPosition; @@ -1213,7 +1329,8 @@ void ParticleEmitter::emitParticles(const Point3F& start, // Create particle at the correct position Point3F pos; pos.interpolate(start, end, F32(currTime) / F32(numMilliseconds)); - addParticle(pos, axis, velocity, axisx); + addParticle(pos, axis, velocity, axisx, numMilliseconds-currTime); + particlesAdded = true; mNextParticleTime = 0; } @@ -1243,7 +1360,7 @@ void ParticleEmitter::emitParticles(const Point3F& start, // Create particle at the correct position Point3F pos; pos.interpolate(start, end, F32(currTime) / F32(numMilliseconds)); - addParticle(pos, axis, velocity, axisx); + addParticle(pos, axis, velocity, axisx, numMilliseconds-currTime); particlesAdded = true; // This override-advance code is restored in order to correctly adjust @@ -1268,17 +1385,27 @@ void ParticleEmitter::emitParticles(const Point3F& start, { if (advanceMS != 0) { - F32 t = F32(advanceMS) / 1000.0; + F32 t = F32(advanceMS) / 1000.0; - Point3F a = last_part->acc; - a -= last_part->vel * last_part->dataBlock->dragCoefficient; - a -= mWindVelocity * last_part->dataBlock->windCoefficient; - a += Point3F(0.0f, 0.0f, -9.81f) * last_part->dataBlock->gravityCoefficient; + Point3F a = last_part->acc; + a -= last_part->vel * last_part->dataBlock->dragCoefficient; + a -= mWindVelocity * last_part->dataBlock->windCoefficient; + //a += Point3F(0.0f, 0.0f, -9.81f) * last_part->dataBlock->gravityCoefficient; + a.z += -9.81f*last_part->dataBlock->gravityCoefficient; // as long as gravity is a constant, this is faster - last_part->vel += a * t; - last_part->pos += last_part->vel * t; + last_part->vel += a * t; + //last_part->pos += last_part->vel * t; + last_part->pos_local += last_part->vel * t; - updateKeyData( last_part ); + // AFX -- allow subclasses to adjust the particle params here + sub_particleUpdate(last_part); + + if (last_part->dataBlock->constrain_pos) + last_part->pos = last_part->pos_local + this->pos_pe; + else + last_part->pos = last_part->pos_local; + + updateKeyData( last_part ); } } } @@ -1350,7 +1477,7 @@ void ParticleEmitter::emitParticles(const Point3F& rCenter, axis.normalize(); pos += rCenter; - addParticle(pos, axis, velocity, axisz); + addParticle(pos, axis, velocity, axisz, 0); } // Set world bounding box @@ -1373,6 +1500,8 @@ void ParticleEmitter::emitParticles(const Point3F& rCenter, //----------------------------------------------------------------------------- void ParticleEmitter::updateBBox() { + if (forced_bbox) + return; Point3F minPt(1e10, 1e10, 1e10); Point3F maxPt(-1e10, -1e10, -1e10); @@ -1393,15 +1522,18 @@ void ParticleEmitter::updateBBox() boxScale.y = getMax(boxScale.y, 1.0f); boxScale.z = getMax(boxScale.z, 1.0f); mBBObjToWorld.scale(boxScale); + +#if defined(AFX_CAP_PARTICLE_POOLS) + if (pool) + pool->updatePoolBBox(this); +#endif } //----------------------------------------------------------------------------- // addParticle //----------------------------------------------------------------------------- -void ParticleEmitter::addParticle(const Point3F& pos, - const Point3F& axis, - const Point3F& vel, - const Point3F& axisx) +void ParticleEmitter::addParticle(const Point3F& pos, const Point3F& axis, const Point3F& vel, + const Point3F& axisx, const U32 age_offset) { n_parts++; if (n_parts > n_part_capacity || n_parts > mDataBlock->partListInitSize) @@ -1423,6 +1555,16 @@ void ParticleEmitter::addParticle(const Point3F& pos, pNew->next = part_list_head.next; part_list_head.next = pNew; + // for earlier access to constrain_pos, the ParticleData datablock is chosen here instead + // of later in the method. + U32 dBlockIndex = gRandGen.randI() % mDataBlock->particleDataBlocks.size(); + ParticleData* part_db = mDataBlock->particleDataBlocks[dBlockIndex]; + // set start position to world or local space + Point3F pos_start; + if (part_db->constrain_pos) + pos_start.set(0,0,0); + else + pos_start = pos; Point3F ejectionAxis = axis; F32 theta = (mDataBlock->thetaMax - mDataBlock->thetaMin) * gRandGen.randF() + mDataBlock->thetaMin; @@ -1444,14 +1586,17 @@ void ParticleEmitter::addParticle(const Point3F& pos, F32 initialVel = mDataBlock->ejectionVelocity; initialVel += (mDataBlock->velocityVariance * 2.0f * gRandGen.randF()) - mDataBlock->velocityVariance; - pNew->pos = pos + (ejectionAxis * (mDataBlock->ejectionOffset + mDataBlock->ejectionOffsetVariance* gRandGen.randF()) ); - pNew->vel = ejectionAxis * initialVel; - pNew->orientDir = ejectionAxis; + pNew->pos = pos_start + (ejectionAxis * (mDataBlock->ejectionOffset + mDataBlock->ejectionOffsetVariance* gRandGen.randF()) ); + pNew->pos_local = pNew->pos; + pNew->vel = mDataBlock->ejectionInvert ? ejectionAxis * -initialVel : ejectionAxis * initialVel; + if (mDataBlock->orientParticles) + pNew->orientDir = ejectionAxis; + else + // note -- for non-oriented particles, we use orientDir.x to store the billboard start angle. + pNew->orientDir.x = mDegToRad(part_db->start_angle + part_db->angle_variance*2.0f*gRandGen.randF() - part_db->angle_variance); pNew->acc.set(0, 0, 0); - pNew->currentAge = 0; - - // Choose a new particle datablack randomly from the list - U32 dBlockIndex = gRandGen.randI() % mDataBlock->particleDataBlocks.size(); + pNew->currentAge = age_offset; + pNew->t_last = 0.0f; mDataBlock->particleDataBlocks[dBlockIndex]->initializeParticle(pNew, vel); updateKeyData( pNew ); @@ -1533,8 +1678,10 @@ void ParticleEmitter::updateKeyData( Particle *part ) if( part->totalLifetime < 1 ) part->totalLifetime = 1; - F32 t = F32(part->currentAge) / F32(part->totalLifetime); - AssertFatal(t <= 1.0f, "Out out bounds filter function for particle."); + if (part->currentAge > part->totalLifetime) + part->currentAge = part->totalLifetime; + F32 t = (F32)part->currentAge / (F32)part->totalLifetime; + for( U32 i = 1; i < ParticleData::PDC_NUM_KEYS; i++ ) { @@ -1566,7 +1713,25 @@ void ParticleEmitter::updateKeyData( Particle *part ) { part->size = (part->dataBlock->sizes[i-1] * (1.0 - firstPart)) + (part->dataBlock->sizes[i] * firstPart); + part->size *= part->dataBlock->sizeBias; } + + if (mDataBlock->fade_color) + { + if (mDataBlock->fade_alpha) + part->color *= fade_amt; + else + { + part->color.red *= fade_amt; + part->color.green *= fade_amt; + part->color.blue *= fade_amt; + } + } + else if (mDataBlock->fade_alpha) + part->color.alpha *= fade_amt; + + if (mDataBlock->fade_size) + part->size *= fade_amt; break; } @@ -1578,19 +1743,25 @@ void ParticleEmitter::updateKeyData( Particle *part ) //----------------------------------------------------------------------------- void ParticleEmitter::update( U32 ms ) { - // TODO: Prefetch + F32 t = F32(ms)/1000.0f; // AFX -- moved outside loop, no need to recalculate this for every particle for (Particle* part = part_list_head.next; part != NULL; part = part->next) { - F32 t = F32(ms) / 1000.0; - Point3F a = part->acc; - a -= part->vel * part->dataBlock->dragCoefficient; + a -= part->vel * part->dataBlock->dragCoefficient; a -= mWindVelocity * part->dataBlock->windCoefficient; - a += Point3F(0.0f, 0.0f, -9.81f) * part->dataBlock->gravityCoefficient; + a.z += -9.81f*part->dataBlock->gravityCoefficient; // AFX -- as long as gravity is a constant, this is faster part->vel += a * t; - part->pos += part->vel * t; + part->pos_local += part->vel * t; + + // AFX -- allow subclasses to adjust the particle params here + sub_particleUpdate(part); + + if (part->dataBlock->constrain_pos) + part->pos = part->pos_local + this->pos_pe; + else + part->pos = part->pos_local; updateKeyData( part ); } @@ -2153,3 +2324,43 @@ DefineEngineMethod(ParticleEmitterData, reload, void,(),, { object->reload(); } +void ParticleEmitter::emitParticlesExt(const MatrixF& xfm, const Point3F& point, + const Point3F& velocity, const U32 numMilliseconds) +{ + if (mDataBlock->use_emitter_xfm) + { + Point3F zero_point(0.0f, 0.0f, 0.0f); + this->pos_pe = zero_point; + this->setTransform(xfm); + Point3F axis(0.0,0.0,1.0); + xfm.mulV(axis); + emitParticles(zero_point, true, axis, velocity, numMilliseconds); + } + else + { + this->pos_pe = point; + Point3F axis(0.0,0.0,1.0); + xfm.mulV(axis); + emitParticles(point, true, axis, velocity, numMilliseconds); + } +} + +void ParticleEmitter::setForcedObjBox(Box3F& box) +{ + mObjBox = box; + forced_bbox = true; +#if defined(AFX_CAP_PARTICLE_POOLS) + if (pool) + pool->updatePoolBBox(this); +#endif +} + +void ParticleEmitter::setSortPriority(S8 priority) +{ + sort_priority = (priority == 0) ? 1 : priority; +#if defined(AFX_CAP_PARTICLE_POOLS) + if (pool) + pool->setSortPriority(sort_priority); +#endif +} + diff --git a/Engine/source/T3D/fx/particleEmitter.h b/Engine/source/T3D/fx/particleEmitter.h index f4da1ed53..0750ab864 100644 --- a/Engine/source/T3D/fx/particleEmitter.h +++ b/Engine/source/T3D/fx/particleEmitter.h @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _H_PARTICLE_EMITTER #define _H_PARTICLE_EMITTER @@ -46,6 +47,12 @@ class RenderPassManager; class ParticleData; +#define AFX_CAP_PARTICLE_POOLS +#if defined(AFX_CAP_PARTICLE_POOLS) +class afxParticlePoolData; +class afxParticlePool; +#endif + //***************************************************************************** // Particle Emitter Data //***************************************************************************** @@ -117,6 +124,21 @@ class ParticleEmitterData : public GameBaseData bool glow; ///< Renders this emitter into the glow buffer. bool reload(); +public: + bool fade_color; + bool fade_size; + bool fade_alpha; + bool ejectionInvert; + U8 parts_per_eject; + bool use_emitter_xfm; +#if defined(AFX_CAP_PARTICLE_POOLS) +public: + afxParticlePoolData* pool_datablock; + U32 pool_index; + bool pool_depth_fade; + bool pool_radial_fade; + bool do_pool_id_convert; +#endif public: /*C*/ ParticleEmitterData(const ParticleEmitterData&, bool = false); /*D*/ ~ParticleEmitterData(); @@ -130,6 +152,9 @@ public: class ParticleEmitter : public GameBase { typedef GameBase Parent; +#if defined(AFX_CAP_PARTICLE_POOLS) + friend class afxParticlePool; +#endif public: @@ -199,7 +224,7 @@ class ParticleEmitter : public GameBase /// @param axis /// @param vel Initial velocity /// @param axisx - void addParticle(const Point3F &pos, const Point3F &axis, const Point3F &vel, const Point3F &axisx); + void addParticle(const Point3F &pos, const Point3F &axis, const Point3F &vel, const Point3F &axisx, const U32 age_offset); inline void setupBillboard( Particle *part, @@ -236,7 +261,12 @@ class ParticleEmitter : public GameBase // PEngine interface private: + // AFX subclasses to ParticleEmitter require access to some members and methods of + // ParticleEmitter which are normally declared with private scope. In this section, + // protected and private scope statements have been inserted inline with the original + // code to expose the necessary members and methods. void update( U32 ms ); +protected: inline void updateKeyData( Particle *part ); @@ -248,25 +278,30 @@ class ParticleEmitter : public GameBase ParticleEmitterData* mDataBlock; +protected: U32 mInternalClock; U32 mNextParticleTime; Point3F mLastPosition; bool mHasLastPosition; +private: MatrixF mBBObjToWorld; bool mDeleteWhenEmpty; bool mDeleteOnTick; +protected: S32 mLifetimeMS; S32 mElapsedTimeMS; +private: F32 sizes[ ParticleData::PDC_NUM_KEYS ]; LinearColorF colors[ ParticleData::PDC_NUM_KEYS ]; GFXVertexBufferHandle mVertBuff; +protected: // These members are for implementing a link-list of the active emitter // particles. Member part_store contains blocks of particles that can be // chained in a link-list. Usually the first part_store block is large @@ -277,8 +312,28 @@ class ParticleEmitter : public GameBase Particle part_list_head; S32 n_part_capacity; S32 n_parts; +private: S32 mCurBuffSize; + protected: + F32 fade_amt; + bool forced_bbox; + bool db_temp_clone; + Point3F pos_pe; + S8 sort_priority; + virtual void sub_particleUpdate(Particle*) { } + public: + virtual void emitParticlesExt(const MatrixF& xfm, const Point3F& point, const Point3F& velocity, const U32 numMilliseconds); + void setFadeAmount(F32 amt) { fade_amt = amt; } + void setForcedObjBox(Box3F& box); + void setSortPriority(S8 priority); +#if defined(AFX_CAP_PARTICLE_POOLS) + protected: + afxParticlePool* pool; + public: + void clearPool() { pool = 0; } + void setPool(afxParticlePool* p) { pool = p; } +#endif }; #endif // _H_PARTICLE_EMITTER From 706d717ef6eb22673779d12321246186091f7006 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 23:24:08 +0100 Subject: [PATCH 013/312] enhanced-particle -- Accounts for larger number of particle size keys. --- Engine/source/T3D/debris.cpp | 7 +- Engine/source/T3D/fx/particle.cpp | 121 +++++++++++++++++++++++++----- Engine/source/T3D/fx/particle.h | 18 ++++- 3 files changed, 123 insertions(+), 23 deletions(-) diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 02b475c80..57d9a0577 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/debris.h" @@ -633,7 +634,8 @@ bool Debris::onAdd() { sizeList[0] = mSize * 0.5; sizeList[1] = mSize; - sizeList[2] = mSize * 1.5; + for (U32 i = 2; i < ParticleData::PDC_NUM_KEYS; i++) + sizeList[i] = mSize * 1.5; mEmitterList[0]->setSizes( sizeList ); } @@ -642,7 +644,8 @@ bool Debris::onAdd() { sizeList[0] = 0.0; sizeList[1] = mSize * 0.5; - sizeList[2] = mSize; + for (U32 i = 2; i < ParticleData::PDC_NUM_KEYS; i++) + sizeList[i] = mSize; mEmitterList[1]->setSizes( sizeList ); } diff --git a/Engine/source/T3D/fx/particle.cpp b/Engine/source/T3D/fx/particle.cpp index f887a021e..823376fc7 100644 --- a/Engine/source/T3D/fx/particle.cpp +++ b/Engine/source/T3D/fx/particle.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "particle.h" #include "console/consoleTypes.h" #include "console/typeValidators.h" @@ -77,6 +78,8 @@ static const F32 sgDefaultSpinSpeed = 1.f; static const F32 sgDefaultSpinRandomMin = 0.f; static const F32 sgDefaultSpinRandomMax = 0.f; +static const F32 sgDefaultSpinBias = 1.0f; +static const F32 sgDefaultSizeBias = 1.0f; //----------------------------------------------------------------------------- // Constructor @@ -107,9 +110,9 @@ ParticleData::ParticleData() } times[0] = 0.0f; - times[1] = 0.33f; - times[2] = 0.66f; - times[3] = 1.0f; + times[1] = 1.0f; + for (i = 2; i < PDC_NUM_KEYS; i++) + times[i] = -1.0f; texCoords[0].set(0.0,0.0); // texture coords at 4 corners texCoords[1].set(0.0,1.0); // of particle quad @@ -120,18 +123,20 @@ ParticleData::ParticleData() animTexUVs = NULL; // array of tile vertex UVs textureName = NULL; // texture filename textureHandle = NULL; // loaded texture handle + textureExtName = NULL; + textureExtHandle = NULL; + constrain_pos = false; + start_angle = 0.0f; + angle_variance = 0.0f; + sizeBias = sgDefaultSizeBias; + spinBias = sgDefaultSpinBias; + randomizeSpinDir = false; } //----------------------------------------------------------------------------- // Destructor //----------------------------------------------------------------------------- -ParticleData::~ParticleData() -{ - if (animTexUVs) - { - delete [] animTexUVs; - } -} + FRangeValidator dragCoefFValidator(0.f, 5.f); FRangeValidator gravCoefFValidator(-10.f, 10.f); @@ -219,6 +224,15 @@ void ParticleData::initPersistFields() "@brief Time keys used with the colors and sizes keyframes.\n\n" "Values are from 0.0 (particle creation) to 1.0 (end of lifespace)." ); + addGroup("AFX"); + addField("textureExtName", TypeFilename, Offset(textureExtName, ParticleData)); + addField("constrainPos", TypeBool, Offset(constrain_pos, ParticleData)); + addField("angle", TypeF32, Offset(start_angle, ParticleData)); + addField("angleVariance", TypeF32, Offset(angle_variance, ParticleData)); + addField("sizeBias", TypeF32, Offset(sizeBias, ParticleData)); + addField("spinBias", TypeF32, Offset(spinBias, ParticleData)); + addField("randomizeSpinDir", TypeBool, Offset(randomizeSpinDir, ParticleData)); + endGroup("AFX"); Parent::initPersistFields(); } @@ -248,18 +262,22 @@ void ParticleData::packData(BitStream* stream) stream->writeInt((S32)(spinRandomMin + 1000), 11); stream->writeInt((S32)(spinRandomMax + 1000), 11); } + if(stream->writeFlag(spinBias != sgDefaultSpinBias)) + stream->write(spinBias); + stream->writeFlag(randomizeSpinDir); stream->writeFlag(useInvAlpha); S32 i, count; // see how many frames there are: - for(count = 0; count < 3; count++) + for(count = 0; count < ParticleData::PDC_NUM_KEYS-1; count++) if(times[count] >= 1) break; count++; - stream->writeInt(count-1, 2); + // An extra bit is needed for 8 keys. + stream->writeInt(count-1, 3); for( i=0; iwriteFloat( colors[i].green, 7); stream->writeFloat( colors[i].blue, 7); stream->writeFloat( colors[i].alpha, 7); - stream->writeFloat( sizes[i]/MaxParticleSize, 14); + // AFX bits raised from 14 to 16 to allow larger sizes + stream->writeFloat( sizes[i]/MaxParticleSize, 16); stream->writeFloat( times[i], 8); } @@ -284,6 +303,13 @@ void ParticleData::packData(BitStream* stream) mathWrite(*stream, animTexTiling); stream->writeInt(framesPerSec, 8); } + if (stream->writeFlag(textureExtName && textureExtName[0])) + stream->writeString(textureExtName); + stream->writeFlag(constrain_pos); + stream->writeFloat(start_angle/360.0f, 11); + stream->writeFloat(angle_variance/180.0f, 10); + if(stream->writeFlag(sizeBias != sgDefaultSizeBias)) + stream->write(sizeBias); } //----------------------------------------------------------------------------- @@ -327,17 +353,24 @@ void ParticleData::unpackData(BitStream* stream) spinRandomMax = sgDefaultSpinRandomMax; } + if(stream->readFlag()) + stream->read(&spinBias); + else + spinBias = sgDefaultSpinBias; + randomizeSpinDir = stream->readFlag(); useInvAlpha = stream->readFlag(); S32 i; - S32 count = stream->readInt(2) + 1; + // An extra bit is needed for 8 keys. + S32 count = stream->readInt(3) + 1; for(i = 0;i < count; i++) { colors[i].red = stream->readFloat(7); colors[i].green = stream->readFloat(7); colors[i].blue = stream->readFloat(7); colors[i].alpha = stream->readFloat(7); - sizes[i] = stream->readFloat(14) * MaxParticleSize; + // AFX bits raised from 14 to 16 to allow larger sizes + sizes[i] = stream->readFloat(16) * MaxParticleSize; times[i] = stream->readFloat(8); } textureName = (stream->readFlag()) ? stream->readSTString() : 0; @@ -351,6 +384,14 @@ void ParticleData::unpackData(BitStream* stream) mathRead(*stream, &animTexTiling); framesPerSec = stream->readInt(8); } + textureExtName = (stream->readFlag()) ? stream->readSTString() : 0; + constrain_pos = stream->readFlag(); + start_angle = 360.0f*stream->readFloat(11); + angle_variance = 180.0f*stream->readFloat(10); + if(stream->readFlag()) + stream->read(&sizeBias); + else + sizeBias = sgDefaultSizeBias; } bool ParticleData::protectedSetSizes( void *object, const char *index, const char *data) @@ -432,11 +473,33 @@ bool ParticleData::onAdd() } times[0] = 0.0f; - for (U32 i = 1; i < 4; i++) { - if (times[i] < times[i-1]) { - Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) times[%d] < times[%d]", getName(), i, i-1); - times[i] = times[i-1]; - } + for (U32 i = 1; i < PDC_NUM_KEYS; i++) + { + if (times[i] < 0.0f) + break; + if (times[i] < times[i-1]) + { + Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) times[%d] < times[%d]", getName(), i, i-1); + times[i] = times[i-1]; + } + } + + times[0] = 0.0f; + + U32 last_idx = 0; + for (U32 i = 1; i < PDC_NUM_KEYS; i++) + { + if (times[i] < 0.0f) + break; + else + last_idx = i; + } + + for (U32 i = last_idx+1; i < PDC_NUM_KEYS; i++) + { + times[i] = times[last_idx]; + colors[i] = colors[last_idx]; + sizes[i] = sizes[last_idx]; } // Here we validate parameters @@ -475,6 +538,10 @@ bool ParticleData::onAdd() } } + start_angle = mFmod(start_angle, 360.0f); + if (start_angle < 0.0f) + start_angle += 360.0f; + angle_variance = mClampF(angle_variance, -180.0f, 180.0f); return true; } @@ -500,6 +567,15 @@ bool ParticleData::preload(bool server, String &errorStr) error = true; } } + if (textureExtName && textureExtName[0]) + { + textureExtHandle = GFXTexHandle(textureExtName, &GFXStaticTextureSRGBProfile, avar("%s() - textureExtHandle (line %d)", __FUNCTION__, __LINE__)); + if (!textureExtHandle) + { + errorStr = String::ToString("Missing particle texture: %s", textureName); + error = true; + } + } if (animateTexture) { @@ -611,6 +687,11 @@ void ParticleData::initializeParticle(Particle* init, const Point3F& inheritVelo // assign spin amount init->spinSpeed = spinSpeed * gRandGen.randF( spinRandomMin, spinRandomMax ); + // apply spin bias + init->spinSpeed *= spinBias; + // randomize spin direction + if (randomizeSpinDir && (gRandGen.randI( 0, 1 ) == 1)) + init->spinSpeed = -init->spinSpeed; } bool ParticleData::reload(char errorBuffer[256]) diff --git a/Engine/source/T3D/fx/particle.h b/Engine/source/T3D/fx/particle.h index 17c173e67..b1c25f7f3 100644 --- a/Engine/source/T3D/fx/particle.h +++ b/Engine/source/T3D/fx/particle.h @@ -49,7 +49,9 @@ class ParticleData : public SimDataBlock public: enum PDConst { - PDC_NUM_KEYS = 4, + // This increase the keyframes from 4 to 8. Especially useful for premult-alpha blended particles + // for which 4 keyframes is often not enough. + PDC_NUM_KEYS = 8, }; F32 dragCoefficient; @@ -106,6 +108,16 @@ class ParticleData : public SimDataBlock /*C*/ ParticleData(const ParticleData&, bool = false); virtual void onPerformSubstitutions(); virtual bool allowSubstitutions() const { return true; } + protected: + F32 spinBias; + bool randomizeSpinDir; + StringTableEntry textureExtName; + public: + GFXTexHandle textureExtHandle; + bool constrain_pos; + F32 start_angle; + F32 angle_variance; + F32 sizeBias; public: bool loadParameters(); bool reload(String &errorStr); @@ -135,6 +147,10 @@ struct Particle F32 spinSpeed; Particle * next; + Point3F pos_local; + F32 t_last; + Point3F radial_v; // radial vector for concentric effects + // note -- for non-oriented particles, we use orientDir.x to store the billboard start angle. }; From 64d1b06866e14d1ba8374aa36856a8f05b42d8ba Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 23:41:57 +0100 Subject: [PATCH 014/312] db-cache -- implementation of datablock caching system. --- Engine/source/T3D/gameBase/gameConnection.cpp | 434 +++++++++++++++++- Engine/source/T3D/gameBase/gameConnection.h | 38 ++ .../T3D/gameBase/gameConnectionEvents.cpp | 21 + 3 files changed, 492 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index 08125c261..989c9fd56 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/gameBase/gameConnection.h" @@ -52,6 +57,10 @@ #include "T3D/gameBase/std/stdMoveList.h" #endif +#ifdef AFX_CAP_DATABLOCK_CACHE +#include "core/stream/fileStream.h" +#endif + //---------------------------------------------------------------------------- #define MAX_MOVE_PACKET_SENDS 4 @@ -173,9 +182,20 @@ IMPLEMENT_CALLBACK( GameConnection, onFlash, void, (bool state), (state), "either is on or both are off. Typically this is used to enable the flash postFx.\n\n" "@param state Set to true if either the damage flash or white out conditions are active.\n\n"); +#ifdef AFX_CAP_DATABLOCK_CACHE +StringTableEntry GameConnection::server_cache_filename = ""; +StringTableEntry GameConnection::client_cache_filename = ""; +bool GameConnection::server_cache_on = false; +bool GameConnection::client_cache_on = false; +#endif //---------------------------------------------------------------------------- GameConnection::GameConnection() { + +#ifdef AFX_CAP_DATABLOCK_CACHE + client_db_stream = new InfiniteBitStream; + server_cache_CRC = 0xffffffff; +#endif mLagging = false; mControlObject = NULL; mCameraObject = NULL; @@ -246,6 +266,10 @@ GameConnection::~GameConnection() dFree(mConnectArgv[i]); dFree(mJoinPassword); delete mMoveList; + +#ifdef AFX_CAP_DATABLOCK_CACHE + delete client_db_stream; +#endif } //---------------------------------------------------------------------------- @@ -1608,6 +1632,14 @@ void GameConnection::preloadNextDataBlock(bool hadNewFiles) sendConnectionMessage(DataBlocksDownloadDone, mDataBlockSequence); // gResourceManager->setMissingFileLogging(false); + +#ifdef AFX_CAP_DATABLOCK_CACHE + // This should be the last of the datablocks. An argument of false + // indicates that this is a client save. + if (clientCacheEnabled()) + saveDatablockCache(false); +#endif + return; } mFilesWereDownloaded = hadNewFiles; @@ -1771,7 +1803,11 @@ DefineEngineMethod( GameConnection, transmitDataBlocks, void, (S32 sequence),, const U32 iCount = pGroup->size(); // If this is the local client... +#ifdef AFX_CAP_DATABLOCK_CACHE + if (GameConnection::getLocalClientConnection() == object && !GameConnection::serverCacheEnabled()) +#else if (GameConnection::getLocalClientConnection() == object) +#endif { // Set up a pointer to the datablock. SimDataBlock* pDataBlock = 0; @@ -2166,6 +2202,13 @@ void GameConnection::consoleInit() "@ingroup Networking\n"); // Con::addVariable("specialFog", TypeBool, &SceneGraph::useSpecial); + +#ifdef AFX_CAP_DATABLOCK_CACHE + Con::addVariable("$Pref::Server::DatablockCacheFilename", TypeString, &server_cache_filename); + Con::addVariable("$pref::Client::DatablockCacheFilename", TypeString, &client_cache_filename); + Con::addVariable("$Pref::Server::EnableDatablockCache", TypeBool, &server_cache_on); + Con::addVariable("$pref::Client::EnableDatablockCache", TypeBool, &client_cache_on); +#endif } DefineEngineMethod( GameConnection, startRecording, void, (const char* fileName),, @@ -2360,4 +2403,393 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),, ) { return object->getVisibleGhostDistance(); -} \ No newline at end of file +} + +#ifdef AFX_CAP_DATABLOCK_CACHE + +void GameConnection::tempDisableStringBuffering(BitStream* bs) const +{ + bs->setStringBuffer(0); +} + +void GameConnection::restoreStringBuffering(BitStream* bs) const +{ + bs->clearStringBuffer(); +} + +// rewind to stream postion and then move raw bytes into client_db_stream +// for caching purposes. +void GameConnection::repackClientDatablock(BitStream* bstream, S32 start_pos) +{ + static U8 bit_buffer[Net::MaxPacketDataSize]; + + if (!clientCacheEnabled() || !client_db_stream) + return; + + S32 cur_pos = bstream->getCurPos(); + S32 n_bits = cur_pos - start_pos; + if (n_bits <= 0) + return; + + bstream->setCurPos(start_pos); + bstream->readBits(n_bits, bit_buffer); + bstream->setCurPos(cur_pos); + + //S32 start_pos2 = client_db_stream->getCurPos(); + client_db_stream->writeBits(n_bits, bit_buffer); +} + +#define CLIENT_CACHE_VERSION_CODE 47241113 + +void GameConnection::saveDatablockCache(bool on_server) +{ + InfiniteBitStream bit_stream; + BitStream* bstream = 0; + + if (on_server) + { + SimDataBlockGroup *g = Sim::getDataBlockGroup(); + + // find the first one we haven't sent: + U32 i, groupCount = g->size(); + S32 key = this->getDataBlockModifiedKey(); + for (i = 0; i < groupCount; i++) + if (((SimDataBlock*)(*g)[i])->getModifiedKey() > key) + break; + + // nothing to save + if (i == groupCount) + return; + + bstream = &bit_stream; + + for (;i < groupCount; i++) + { + SimDataBlock* obj = (SimDataBlock*)(*g)[i]; + GameConnection* gc = this; + NetConnection* conn = this; + SimObjectId id = obj->getId(); + + if (bstream->writeFlag(gc->getDataBlockModifiedKey() < obj->getModifiedKey())) // A - flag + { + if (obj->getModifiedKey() > gc->getMaxDataBlockModifiedKey()) + gc->setMaxDataBlockModifiedKey(obj->getModifiedKey()); + + bstream->writeInt(id - DataBlockObjectIdFirst,DataBlockObjectIdBitSize); // B - int + + S32 classId = obj->getClassId(conn->getNetClassGroup()); + bstream->writeClassId(classId, NetClassTypeDataBlock, conn->getNetClassGroup()); // C - id + bstream->writeInt(i, DataBlockObjectIdBitSize); // D - int + bstream->writeInt(groupCount, DataBlockObjectIdBitSize + 1); // E - int + obj->packData(bstream); + } + } + } + else + { + bstream = client_db_stream; + } + + if (bstream->getPosition() <= 0) + return; + + // zero out any leftover bits short of an even byte count + U32 n_leftover_bits = (bstream->getPosition()*8) - bstream->getCurPos(); + if (n_leftover_bits >= 0 && n_leftover_bits <= 8) + { + // note - an unusual problem regarding setCurPos() results when there + // are no leftover bytes. Adding a buffer byte in this case avoids the problem. + if (n_leftover_bits == 0) + n_leftover_bits = 8; + U8 bzero = 0; + bstream->writeBits(n_leftover_bits, &bzero); + } + + // this is where we actually save the file + const char* filename = (on_server) ? server_cache_filename : client_cache_filename; + if (filename && filename[0] != '\0') + { + FileStream* f_stream; + if((f_stream = FileStream::createAndOpen(filename, Torque::FS::File::Write )) == NULL) + { + Con::printf("Failed to open file '%s'.", filename); + return; + } + + U32 save_sz = bstream->getPosition(); + + if (!on_server) + { + f_stream->write((U32)CLIENT_CACHE_VERSION_CODE); + f_stream->write(save_sz); + f_stream->write(server_cache_CRC); + f_stream->write((U32)CLIENT_CACHE_VERSION_CODE); + } + + f_stream->write(save_sz, bstream->getBuffer()); + + // zero out any leftover bytes short of a 4-byte multiple + while ((save_sz % 4) != 0) + { + f_stream->write((U8)0); + save_sz++; + } + + delete f_stream; + } + + if (!on_server) + client_db_stream->clear(); +} + +static bool afx_saved_db_cache = false; +static U32 afx_saved_db_cache_CRC = 0xffffffff; + +void GameConnection::resetDatablockCache() +{ + afx_saved_db_cache = false; + afx_saved_db_cache_CRC = 0xffffffff; +} + +ConsoleFunction(resetDatablockCache, void, 1, 1, "resetDatablockCache()") +{ + GameConnection::resetDatablockCache(); +} + +ConsoleFunction(isDatablockCacheSaved, bool, 1, 1, "resetDatablockCache()") +{ + return afx_saved_db_cache; +} + +ConsoleFunction(getDatablockCacheCRC, S32, 1, 1, "getDatablockCacheCRC()") +{ + return (S32)afx_saved_db_cache_CRC; +} + +ConsoleFunction(extractDatablockCacheCRC, S32, 2, 2, "extractDatablockCacheCRC(filename)") +{ + FileStream f_stream; + const char* fileName = argv[1]; + if(!f_stream.open(fileName, Torque::FS::File::Read)) + { + Con::errorf("Failed to open file '%s'.", fileName); + return -1; + } + + U32 stream_sz = f_stream.getStreamSize(); + if (stream_sz < 4*32) + { + Con::errorf("File '%s' is not a valid datablock cache.", fileName); + f_stream.close(); + return -1; + } + + U32 pre_code; f_stream.read(&pre_code); + U32 save_sz; f_stream.read(&save_sz); + U32 crc_code; f_stream.read(&crc_code); + U32 post_code; f_stream.read(&post_code); + + f_stream.close(); + + if (pre_code != post_code) + { + Con::errorf("File '%s' is not a valid datablock cache.", fileName); + return -1; + } + + if (pre_code != (U32)CLIENT_CACHE_VERSION_CODE) + { + Con::errorf("Version of datablock cache file '%s' does not match version of running software.", fileName); + return -1; + } + + return (S32)crc_code; +} + +ConsoleFunction(setDatablockCacheCRC, void, 2, 2, "setDatablockCacheCRC(crc)") +{ + GameConnection *conn = GameConnection::getConnectionToServer(); + if(!conn) + return; + + U32 crc_u = (U32)dAtoi(argv[1]); + conn->setServerCacheCRC(crc_u); +} + +ConsoleMethod( GameConnection, saveDatablockCache, void, 2, 2, "saveDatablockCache()") +{ + if (GameConnection::serverCacheEnabled() && !afx_saved_db_cache) + { + // Save the datablocks to a cache file. An argument + // of true indicates that this is a server save. + object->saveDatablockCache(true); + afx_saved_db_cache = true; + afx_saved_db_cache_CRC = 0xffffffff; + + static char filename_buffer[1024]; + String filename(Torque::Path::CleanSeparators(object->serverCacheFilename())); + Con::expandScriptFilename(filename_buffer, sizeof(filename_buffer), filename.c_str()); + Torque::Path givenPath(Torque::Path::CompressPath(filename_buffer)); + Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(givenPath); + if ( fileRef == NULL ) + Con::errorf("saveDatablockCache() failed to get CRC for file '%s'.", filename.c_str()); + else + afx_saved_db_cache_CRC = (S32)fileRef->getChecksum(); + } +} + +ConsoleMethod( GameConnection, loadDatablockCache, void, 2, 2, "loadDatablockCache()") +{ + if (GameConnection::clientCacheEnabled()) + { + object->loadDatablockCache(); + } +} + +ConsoleMethod( GameConnection, loadDatablockCache_Begin, bool, 2, 2, "loadDatablockCache_Begin()") +{ + if (GameConnection::clientCacheEnabled()) + { + return object->loadDatablockCache_Begin(); + } + + return false; +} + +ConsoleMethod( GameConnection, loadDatablockCache_Continue, bool, 2, 2, "loadDatablockCache_Continue()") +{ + if (GameConnection::clientCacheEnabled()) + { + return object->loadDatablockCache_Continue(); + } + + return false; +} + +static char* afx_db_load_buf = 0; +static U32 afx_db_load_buf_sz = 0; +static BitStream* afx_db_load_bstream = 0; + +void GameConnection::loadDatablockCache() +{ + if (!loadDatablockCache_Begin()) + return; + + while (loadDatablockCache_Continue()) + ; +} + +bool GameConnection::loadDatablockCache_Begin() +{ + if (!client_cache_filename || client_cache_filename[0] == '\0') + { + Con::errorf("No filename was specified for the client datablock cache."); + return false; + } + + // open cache file + FileStream f_stream; + if(!f_stream.open(client_cache_filename, Torque::FS::File::Read)) + { + Con::errorf("Failed to open file '%s'.", client_cache_filename); + return false; + } + + // get file size + U32 stream_sz = f_stream.getStreamSize(); + if (stream_sz <= 4*4) + { + Con::errorf("File '%s' is too small to be a valid datablock cache.", client_cache_filename); + f_stream.close(); + return false; + } + + // load header data + U32 pre_code; f_stream.read(&pre_code); + U32 save_sz; f_stream.read(&save_sz); + U32 crc_code; f_stream.read(&crc_code); + U32 post_code; f_stream.read(&post_code); + + // validate header info + if (pre_code != post_code) + { + Con::errorf("File '%s' is not a valid datablock cache.", client_cache_filename); + f_stream.close(); + return false; + } + if (pre_code != (U32)CLIENT_CACHE_VERSION_CODE) + { + Con::errorf("Version of datablock cache file '%s' does not match version of running software.", client_cache_filename); + f_stream.close(); + return false; + } + + // allocated the in-memory buffer + afx_db_load_buf_sz = stream_sz - (4*4); + afx_db_load_buf = new char[afx_db_load_buf_sz]; + + // load data from file into memory + if (!f_stream.read(stream_sz, afx_db_load_buf)) + { + Con::errorf("Failed to read data from file '%s'.", client_cache_filename); + f_stream.close(); + delete [] afx_db_load_buf; + afx_db_load_buf = 0; + afx_db_load_buf_sz = 0; + return false; + } + + // close file + f_stream.close(); + + // At this point we have the whole cache in memory + + // create a bitstream from the in-memory buffer + afx_db_load_bstream = new BitStream(afx_db_load_buf, afx_db_load_buf_sz); + + return true; +} + +bool GameConnection::loadDatablockCache_Continue() +{ + if (!afx_db_load_bstream) + return false; + + // prevent repacking of datablocks during load + BitStream* save_client_db_stream = client_db_stream; + client_db_stream = 0; + + bool all_finished = false; + + // loop through at most 16 datablocks + BitStream *bstream = afx_db_load_bstream; + for (S32 i = 0; i < 16; i++) + { + S32 save_pos = bstream->getCurPos(); + if (!bstream->readFlag()) + { + all_finished = true; + break; + } + bstream->setCurPos(save_pos); + SimDataBlockEvent evt; + evt.unpack(this, bstream); + evt.process(this); + } + + client_db_stream = save_client_db_stream; + + if (all_finished) + { + delete afx_db_load_bstream; + afx_db_load_bstream = 0; + delete [] afx_db_load_buf; + afx_db_load_buf = 0; + afx_db_load_buf_sz = 0; + return false; + } + + return true; +} + +#endif diff --git a/Engine/source/T3D/gameBase/gameConnection.h b/Engine/source/T3D/gameBase/gameConnection.h index 13084a637..a234960b0 100644 --- a/Engine/source/T3D/gameBase/gameConnection.h +++ b/Engine/source/T3D/gameBase/gameConnection.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _GAMECONNECTION_H_ #define _GAMECONNECTION_H_ @@ -55,6 +60,14 @@ class MoveList; struct Move; struct AuthInfo; +// To disable datablock caching, remove or comment out the AFX_CAP_DATABLOCK_CACHE define below. +// Also, at a minimum, the following script preferences should be set to false: +// $pref::Client::EnableDatablockCache = false; (in arcane.fx/client/defaults.cs) +// $Pref::Server::EnableDatablockCache = false; (in arcane.fx/server/defaults.cs) +// Alternatively, all script code marked with "DATABLOCK CACHE CODE" can be removed or +// commented out. +// +#define AFX_CAP_DATABLOCK_CACHE const F32 MinCameraFov = 1.f; ///< min camera FOV const F32 MaxCameraFov = 179.f; ///< max camera FOV @@ -372,6 +385,31 @@ protected: DECLARE_CALLBACK( void, setLagIcon, (bool state) ); DECLARE_CALLBACK( void, onDataBlocksDone, (U32 sequence) ); DECLARE_CALLBACK( void, onFlash, (bool state) ); + +#ifdef AFX_CAP_DATABLOCK_CACHE +private: + static StringTableEntry server_cache_filename; + static StringTableEntry client_cache_filename; + static bool server_cache_on; + static bool client_cache_on; + BitStream* client_db_stream; + U32 server_cache_CRC; +public: + void repackClientDatablock(BitStream*, S32 start_pos); + void saveDatablockCache(bool on_server); + void loadDatablockCache(); + bool loadDatablockCache_Begin(); + bool loadDatablockCache_Continue(); + void tempDisableStringBuffering(BitStream* bs) const; + void restoreStringBuffering(BitStream* bs) const; + void setServerCacheCRC(U32 crc) { server_cache_CRC = crc; } + + static void resetDatablockCache(); + static bool serverCacheEnabled() { return server_cache_on; } + static bool clientCacheEnabled() { return client_cache_on; } + static const char* serverCacheFilename() { return server_cache_filename; } + static const char* clientCacheFilename() { return client_cache_filename; } +#endif }; #endif diff --git a/Engine/source/T3D/gameBase/gameConnectionEvents.cpp b/Engine/source/T3D/gameBase/gameConnectionEvents.cpp index ddc7b1674..e79e55c45 100644 --- a/Engine/source/T3D/gameBase/gameConnectionEvents.cpp +++ b/Engine/source/T3D/gameBase/gameConnectionEvents.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "core/dnet.h" #include "core/stream/bitStream.h" @@ -136,6 +141,9 @@ void SimDataBlockEvent::notifyDelivered(NetConnection *conn, bool ) void SimDataBlockEvent::pack(NetConnection *conn, BitStream *bstream) { +#ifdef AFX_CAP_DATABLOCK_CACHE + ((GameConnection *)conn)->tempDisableStringBuffering(bstream); +#endif SimDataBlock* obj; Sim::findObject(id,obj); GameConnection *gc = (GameConnection *) conn; @@ -157,10 +165,18 @@ void SimDataBlockEvent::pack(NetConnection *conn, BitStream *bstream) bstream->writeInt(classId ^ DebugChecksum, 32); #endif } +#ifdef AFX_CAP_DATABLOCK_CACHE + ((GameConnection *)conn)->restoreStringBuffering(bstream); +#endif } void SimDataBlockEvent::unpack(NetConnection *cptr, BitStream *bstream) { +#ifdef AFX_CAP_DATABLOCK_CACHE + // stash the stream position prior to unpacking + S32 start_pos = bstream->getCurPos(); + ((GameConnection *)cptr)->tempDisableStringBuffering(bstream); +#endif if(bstream->readFlag()) { mProcess = true; @@ -215,6 +231,11 @@ void SimDataBlockEvent::unpack(NetConnection *cptr, BitStream *bstream) #endif } +#ifdef AFX_CAP_DATABLOCK_CACHE + // rewind to stream position and then process raw bytes for caching + ((GameConnection *)cptr)->repackClientDatablock(bstream, start_pos); + ((GameConnection *)cptr)->restoreStringBuffering(bstream); +#endif } void SimDataBlockEvent::write(NetConnection *cptr, BitStream *bstream) From d4c2eeea98cdd4684eb618d442d36f453129c12b Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 23:48:29 +0100 Subject: [PATCH 015/312] Selection Highlighting --- Engine/source/T3D/shapeBase.cpp | 19 +++++++++++++++++++ Engine/source/T3D/shapeBase.h | 2 ++ Engine/source/T3D/tsStatic.cpp | 21 +++++++++++++++++++++ Engine/source/T3D/tsStatic.h | 1 + Engine/source/materials/baseMatInstance.h | 5 +++++ Engine/source/materials/matInstance.cpp | 1 + Engine/source/materials/sceneData.h | 3 +++ 7 files changed, 52 insertions(+) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 0419682ae..e0ce47cec 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -5013,3 +5013,22 @@ DefineEngineMethod( ShapeBase, getModelFile, const char *, (),, const char *fieldName = StringTable->insert( String("shapeFile") ); return datablock->getDataField( fieldName, NULL ); } + +void ShapeBase::setSelectionFlags(U8 flags) +{ + Parent::setSelectionFlags(flags); + + if (!mShapeInstance || !isClientObject()) + return; + + if (!mShapeInstance->ownMaterialList()) + return; + + TSMaterialList* pMatList = mShapeInstance->getMaterialList(); + for (S32 j = 0; j < pMatList->size(); j++) + { + BaseMatInstance * bmi = pMatList->getMaterialInst(j); + bmi->setSelectionHighlighting(needsSelectionHighlighting()); + } +} + diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 213a808e4..e32eb0d0b 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -1852,6 +1852,8 @@ public: protected: DECLARE_CALLBACK( F32, validateCameraFov, (F32 fov) ); + + virtual void setSelectionFlags(U8 flags); }; diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 84b07566f..b2f33f44a 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -375,6 +375,8 @@ bool TSStatic::_createShape() mShapeInstance = new TSShapeInstance( mShape, isClientObject() ); + if (isClientObject()) + mShapeInstance->cloneMaterialList(); if( isGhost() ) { // Reapply the current skin @@ -1405,3 +1407,22 @@ void TSStatic::onStaticModified(const char* slotName, const char*newValue) set_special_typing(); } + +void TSStatic::setSelectionFlags(U8 flags) +{ + Parent::setSelectionFlags(flags); + + if (!mShapeInstance || !isClientObject()) + return; + + if (!mShapeInstance->ownMaterialList()) + return; + + TSMaterialList* pMatList = mShapeInstance->getMaterialList(); + for (S32 j = 0; j < pMatList->size(); j++) + { + BaseMatInstance * bmi = pMatList->getMaterialInst(j); + bmi->setSelectionHighlighting(needsSelectionHighlighting()); + } +} + diff --git a/Engine/source/T3D/tsStatic.h b/Engine/source/T3D/tsStatic.h index 40e89c0fc..224086c71 100644 --- a/Engine/source/T3D/tsStatic.h +++ b/Engine/source/T3D/tsStatic.h @@ -254,6 +254,7 @@ public: Point2F mGradientRange; private: void set_special_typing(); + virtual void setSelectionFlags(U8 flags); }; typedef TSStatic::MeshType TSMeshType; diff --git a/Engine/source/materials/baseMatInstance.h b/Engine/source/materials/baseMatInstance.h index 6a2bee0a1..bca878dc2 100644 --- a/Engine/source/materials/baseMatInstance.h +++ b/Engine/source/materials/baseMatInstance.h @@ -252,6 +252,11 @@ public: virtual const GFXStateBlockDesc &getUserStateBlock() const = 0; +protected: + bool needsHighlighting; +public: + bool needsSelectionHighlighting() { return needsHighlighting; }; + void setSelectionHighlighting(bool flag) { needsHighlighting = flag; }; }; #endif /// _BASEMATINSTANCE_H_ diff --git a/Engine/source/materials/matInstance.cpp b/Engine/source/materials/matInstance.cpp index 33b6357c9..e242a2059 100644 --- a/Engine/source/materials/matInstance.cpp +++ b/Engine/source/materials/matInstance.cpp @@ -253,6 +253,7 @@ void MatInstance::construct() mIsForwardLit = false; mIsValid = false; mIsHardwareSkinned = false; + needsHighlighting = false; MATMGR->_track(this); } diff --git a/Engine/source/materials/sceneData.h b/Engine/source/materials/sceneData.h index 99fc8ef52..fd8b01633 100644 --- a/Engine/source/materials/sceneData.h +++ b/Engine/source/materials/sceneData.h @@ -52,6 +52,9 @@ struct SceneData /// The deferred render bin. /// @RenderDeferredMgr DeferredBin, + /// The selection-highlight render bin. + /// @afxRenderHighlightMgr + HighlightBin, }; /// This defines when we're rendering a special bin From fcce9be33c6b5110d057c5005ae95a44b80d513c Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 26 Jul 2017 23:59:44 +0100 Subject: [PATCH 016/312] obj-select -- object selection functionality is-camera -- Adds a test for determining if object is a camera. cam-speed -- added method for getting the camera movement speed. zoned-in -- connection is flagged as "zoned-in" when client is fully connected and user can interact with it. --- Engine/source/T3D/camera.h | 7 + Engine/source/T3D/gameBase/gameConnection.cpp | 176 ++++++++++++++++++ Engine/source/T3D/gameBase/gameConnection.h | 30 +++ Engine/source/T3D/player.cpp | 7 +- Engine/source/T3D/player.h | 3 + Engine/source/scene/sceneObject.cpp | 6 + Engine/source/scene/sceneObject.h | 22 +++ 7 files changed, 250 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/camera.h b/Engine/source/T3D/camera.h index 5e760e61f..484cb2c92 100644 --- a/Engine/source/T3D/camera.h +++ b/Engine/source/T3D/camera.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _CAMERA_H_ #define _CAMERA_H_ @@ -246,6 +251,8 @@ class Camera: public ShapeBase DECLARE_CONOBJECT( Camera ); DECLARE_CATEGORY( "Game" ); DECLARE_DESCRIPTION( "Represents a position, direction and field of view to render a scene from." ); + static F32 getMovementSpeed() { return smMovementSpeed; } + bool isCamera() const { return true; } }; typedef Camera::CameraMotionMode CameraMotionMode; diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index 989c9fd56..d39b5c249 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -61,6 +61,7 @@ #include "core/stream/fileStream.h" #endif +#include "afx/arcaneFX.h" //---------------------------------------------------------------------------- #define MAX_MOVE_PACKET_SENDS 4 @@ -191,6 +192,12 @@ bool GameConnection::client_cache_on = false; //---------------------------------------------------------------------------- GameConnection::GameConnection() { + mRolloverObj = NULL; + mPreSelectedObj = NULL; + mSelectedObj = NULL; + mChangedSelectedObj = false; + mPreSelectTimestamp = 0; + zoned_in = false; #ifdef AFX_CAP_DATABLOCK_CACHE client_db_stream = new InfiniteBitStream; @@ -1168,6 +1175,17 @@ void GameConnection::readPacket(BitStream *bstream) { mMoveList->clientReadMovePacket(bstream); + // selected object - do we have a change in status? + if (bstream->readFlag()) + { + if (bstream->readFlag()) + { + S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize); + setSelectedObj(static_cast(resolveGhost(gIndex))); + } + else + setSelectedObj(NULL); + } bool hadFlash = mDamageFlash > 0 || mWhiteOut > 0; mDamageFlash = 0; mWhiteOut = 0; @@ -1411,6 +1429,35 @@ void GameConnection::writePacket(BitStream *bstream, PacketNotify *note) // all the damage flash & white out S32 gIndex = -1; + if (mChangedSelectedObj) + { + S32 gidx; + // send NULL player + if ((mSelectedObj == NULL) || mSelectedObj.isNull()) + { + bstream->writeFlag(true); + bstream->writeFlag(false); + mChangedSelectedObj = false; + } + // send ghost-idx + else if ((gidx = getGhostIndex(mSelectedObj)) != -1) + { + Con::printf("SEND OBJECT SELECTION"); + bstream->writeFlag(true); + bstream->writeFlag(true); + bstream->writeInt(gidx, NetConnection::GhostIdBitSize); + mChangedSelectedObj = false; + } + // not fully changed yet + else + { + bstream->writeFlag(false); + mChangedSelectedObj = true; + } + } + else + bstream->writeFlag(false); + if (!mControlObject.isNull()) { gIndex = getGhostIndex(mControlObject); @@ -2405,6 +2452,135 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),, return object->getVisibleGhostDistance(); } +// The object selection code here is, in part, based, on functionality described +// in the following resource: +// Object Selection in Torque by Dave Myers +// http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7335 + +ConsoleMethod(GameConnection, setSelectedObj, bool, 3, 4, "(object, [propagate_to_client])") +{ + SceneObject* pending_selection; + if (!Sim::findObject(argv[2], pending_selection)) + return false; + + bool propagate_to_client = (argc > 3) ? dAtob(argv[3]) : false; + object->setSelectedObj(pending_selection, propagate_to_client); + + return true; +} + +ConsoleMethod(GameConnection, getSelectedObj, S32, 2, 2, "()") +{ + SimObject* selected = object->getSelectedObj(); + return (selected) ? selected->getId(): -1; +} + +ConsoleMethod(GameConnection, clearSelectedObj, void, 2, 3, "([propagate_to_client])") +{ + bool propagate_to_client = (argc > 2) ? dAtob(argv[2]) : false; + object->setSelectedObj(NULL, propagate_to_client); +} + +ConsoleMethod(GameConnection, setPreSelectedObjFromRollover, void, 2, 2, "()") +{ + object->setPreSelectedObjFromRollover(); +} + +ConsoleMethod(GameConnection, clearPreSelectedObj, void, 2, 2, "()") +{ + object->clearPreSelectedObj(); +} + +ConsoleMethod(GameConnection, setSelectedObjFromPreSelected, void, 2, 2, "()") +{ + object->setSelectedObjFromPreSelected(); +} + +void GameConnection::setSelectedObj(SceneObject* so, bool propagate_to_client) +{ + if (!isConnectionToServer()) + { + // clear previously selected object + if (mSelectedObj) + clearNotify(mSelectedObj); + + // save new selection + mSelectedObj = so; + + // mark selected object + if (mSelectedObj) + deleteNotify(mSelectedObj); + + // mark selection dirty + if (propagate_to_client) + mChangedSelectedObj = true; + + return; + } + + // clear previously selected object + if (mSelectedObj) + { + mSelectedObj->setSelectionFlags(mSelectedObj->getSelectionFlags() & ~SceneObject::SELECTED); + clearNotify(mSelectedObj); + Con::executef(this, "onObjectDeselected", mSelectedObj->getIdString()); + } + + // save new selection + mSelectedObj = so; + + // mark selected object + if (mSelectedObj) + { + mSelectedObj->setSelectionFlags(mSelectedObj->getSelectionFlags() | SceneObject::SELECTED); + deleteNotify(mSelectedObj); + } + + // mark selection dirty + //mChangedSelectedObj = true; + + // notify appropriate script of the change + if (mSelectedObj) + Con::executef(this, "onObjectSelected", mSelectedObj->getIdString()); +} + +void GameConnection::setRolloverObj(SceneObject* so) +{ + // save new selection + mRolloverObj = so; + + // notify appropriate script of the change + Con::executef(this, "onObjectRollover", (mRolloverObj) ? mRolloverObj->getIdString() : ""); +} + +void GameConnection::setPreSelectedObjFromRollover() +{ + mPreSelectedObj = mRolloverObj; + mPreSelectTimestamp = Platform::getRealMilliseconds(); +} + +void GameConnection::clearPreSelectedObj() +{ + mPreSelectedObj = 0; + mPreSelectTimestamp = 0; +} + +void GameConnection::setSelectedObjFromPreSelected() +{ + U32 now = Platform::getRealMilliseconds(); + if (now - mPreSelectTimestamp < arcaneFX::sTargetSelectionTimeoutMS) + setSelectedObj(mPreSelectedObj); + mPreSelectedObj = 0; +} + +void GameConnection::onDeleteNotify(SimObject* obj) +{ + if (obj == mSelectedObj) + setSelectedObj(NULL); + + Parent::onDeleteNotify(obj); +} + #ifdef AFX_CAP_DATABLOCK_CACHE void GameConnection::tempDisableStringBuffering(BitStream* bs) const diff --git a/Engine/source/T3D/gameBase/gameConnection.h b/Engine/source/T3D/gameBase/gameConnection.h index a234960b0..427c8ce8d 100644 --- a/Engine/source/T3D/gameBase/gameConnection.h +++ b/Engine/source/T3D/gameBase/gameConnection.h @@ -386,6 +386,36 @@ protected: DECLARE_CALLBACK( void, onDataBlocksDone, (U32 sequence) ); DECLARE_CALLBACK( void, onFlash, (bool state) ); + // GameConnection is modified to keep track of object selections which are used in + // spell targeting. This code stores the current object selection as well as the + // current rollover object beneath the cursor. The rollover object is treated as a + // pending object selection and actual object selection is usually made by promoting + // the rollover object to the current object selection. +private: + SimObjectPtr mRolloverObj; + SimObjectPtr mPreSelectedObj; + SimObjectPtr mSelectedObj; + bool mChangedSelectedObj; + U32 mPreSelectTimestamp; +protected: + virtual void onDeleteNotify(SimObject*); +public: + void setRolloverObj(SceneObject*); + SceneObject* getRolloverObj() { return mRolloverObj; } + void setSelectedObj(SceneObject*, bool propagate_to_client=false); + SceneObject* getSelectedObj() { return mSelectedObj; } + void setPreSelectedObjFromRollover(); + void clearPreSelectedObj(); + void setSelectedObjFromPreSelected(); + // Flag is added to indicate when a client is fully connected or "zoned-in". + // This information determines when AFX will startup active effects on a newly + // added client. +private: + bool zoned_in; +public: + bool isZonedIn() const { return zoned_in; } + void setZonedIn() { zoned_in = true; } + #ifdef AFX_CAP_DATABLOCK_CACHE private: static StringTableEntry server_cache_filename; diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 832937f0e..6b4d4ae0d 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -5885,7 +5885,12 @@ void Player::applyImpulse(const Point3F&,const VectorF& vec) bool Player::castRay(const Point3F &start, const Point3F &end, RayInfo* info) { - if (getDamageState() != Enabled) + // In standard Torque there's a rather brute force culling of all + // non-enabled players (corpses) from the ray cast. But, to + // demonstrate a resurrection spell, we need corpses to be + // selectable, so this code change allows consideration of corpses + // in the ray cast if corpsesHiddenFromRayCast is set to false. + if (sCorpsesHiddenFromRayCast && getDamageState() != Enabled) return false; // Collide against bounding box. Need at least this for the editor. diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index a49f3baf4..367536058 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -790,6 +790,9 @@ private: void afx_init(); U32 afx_packUpdate(NetConnection*, U32 mask, BitStream*, U32 retMask); void afx_unpackUpdate(NetConnection*, BitStream*); +private: + static bool sCorpsesHiddenFromRayCast; + }; typedef Player::Pose PlayerPose; diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index 6bd796607..550ee80b4 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "scene/sceneObject.h" @@ -144,6 +149,7 @@ SceneObject::SceneObject() mIsScopeAlways = false; mAccuTex = NULL; + mSelectionFlags = 0; mPathfindingIgnore = false; } diff --git a/Engine/source/scene/sceneObject.h b/Engine/source/scene/sceneObject.h index 3985d372c..bf04ea4c4 100644 --- a/Engine/source/scene/sceneObject.h +++ b/Engine/source/scene/sceneObject.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _SCENEOBJECT_H_ #define _SCENEOBJECT_H_ @@ -778,6 +783,23 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce // Note: This was placed in SceneObject to both ShapeBase and TSStatic could support it. public: GFXTextureObject* mAccuTex; + // mSelectionFlags field keeps track of flags related to object selection. + // PRE_SELECTED marks an object as pre-selected (object under cursor) + // SELECTED marks an object as selected (a target) + protected: + U8 mSelectionFlags; + public: + enum { + SELECTED = BIT(0), + PRE_SELECTED = BIT(1), + }; + virtual void setSelectionFlags(U8 flags) { mSelectionFlags = flags; } + U8 getSelectionFlags() const { return mSelectionFlags; } + bool needsSelectionHighlighting() const { return (mSelectionFlags != 0); } + // This should only return true if the object represents an independent camera + // as opposed to something like a Player that has a built-in camera that requires + // special calculations to determine the view transform. + virtual bool isCamera() const { return false; } }; #endif // _SCENEOBJECT_H_ From b70f89afa2236e29d1efe7079192f2c317216002 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 00:03:53 +0100 Subject: [PATCH 017/312] sfx-legacy --- Engine/source/sfx/sfxDescription.cpp | 21 +++++++++++++++++++++ Engine/source/sfx/sfxPlayList.h | 2 +- Engine/source/sfx/sfxProfile.cpp | 21 +++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Engine/source/sfx/sfxDescription.cpp b/Engine/source/sfx/sfxDescription.cpp index c3d9f54cf..1c82ba6a5 100644 --- a/Engine/source/sfx/sfxDescription.cpp +++ b/Engine/source/sfx/sfxDescription.cpp @@ -687,3 +687,24 @@ void SFXDescription::inspectPostApply() if( SFX ) SFX->notifyDescriptionChanged( this ); } +// This allows legacy AudioDescription datablocks to be recognized as an alias +// for SFXDescription. It is intended to ease the transition from older scripts +// especially those that still need to support pre-1.7 applications. +// (This maybe removed in future releases so treat as deprecated.) +class AudioDescription : public SFXDescription +{ + typedef SFXDescription Parent; +public: + DECLARE_CONOBJECT(AudioDescription); +}; + +IMPLEMENT_CO_DATABLOCK_V1(AudioDescription); + +ConsoleDocClass( AudioDescription, + "@brief Allows legacy AudioDescription datablocks to be treated as SFXDescription datablocks.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + diff --git a/Engine/source/sfx/sfxPlayList.h b/Engine/source/sfx/sfxPlayList.h index 0d9acf5c3..6bde33734 100644 --- a/Engine/source/sfx/sfxPlayList.h +++ b/Engine/source/sfx/sfxPlayList.h @@ -81,7 +81,7 @@ class SFXPlayList : public SFXTrack /// /// @note To have longer playlists, simply cascade playlists and use /// wait behaviors. - NUM_SLOTS = 16, + NUM_SLOTS = 12, // AFX (was 16) NUM_TRANSITION_MODE_BITS = 3, NUM_LOOP_MODE_BITS = 1, diff --git a/Engine/source/sfx/sfxProfile.cpp b/Engine/source/sfx/sfxProfile.cpp index ef5b9dd42..d9cc3d56f 100644 --- a/Engine/source/sfx/sfxProfile.cpp +++ b/Engine/source/sfx/sfxProfile.cpp @@ -470,3 +470,24 @@ void SFXProfile::onPerformSubstitutions() SFX->getEventSignal().notify( this, &SFXProfile::_onDeviceEvent ); } } +// This allows legacy AudioProfile datablocks to be recognized as an alias +// for SFXProfile. It is intended to ease the transition from older scripts +// especially those that still need to support pre-1.7 applications. +// (This maybe removed in future releases so treat as deprecated.) +class AudioProfile : public SFXProfile +{ + typedef SFXProfile Parent; +public: + DECLARE_CONOBJECT(AudioProfile); +}; + +IMPLEMENT_CO_DATABLOCK_V1(AudioProfile); + +ConsoleDocClass( AudioProfile, + "@brief Allows legacy AudioProfile datablocks to be treated as SFXProfile datablocks.\n\n" + + "@ingroup afxMisc\n" + "@ingroup AFX\n" + "@ingroup Datablocks\n" +); + From 5a1405d4bb63246adae9ad2157d9224d4b54c80c Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 00:09:36 +0100 Subject: [PATCH 018/312] packet-size-checking -- Methods for querying packet-size settings. Used for detecting when spells or effects overrun the packet buffer from networked dynamic field usage. scope-tracking -- changes related to the tracking of AFX constraint objects as they move in and out of scope. --- Engine/source/T3D/gameBase/gameBase.cpp | 28 +++++++++++++++++++-- Engine/source/T3D/gameBase/gameBase.h | 6 ++++- Engine/source/sim/netConnection.cpp | 5 +++- Engine/source/sim/netConnection.h | 8 ++++++ Engine/source/sim/netObject.cpp | 33 +++++++++++++++++++++++++ Engine/source/sim/netObject.h | 17 +++++++++++++ 6 files changed, 93 insertions(+), 4 deletions(-) diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index 903187ac3..4a98742c1 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/gameBase/gameBase.h" #include "console/consoleTypes.h" @@ -40,6 +41,7 @@ #include "T3D/aiConnection.h" #endif +#include "afx/arcaneFX.h" //---------------------------------------------------------------------------- // Ghost update relative priority values @@ -254,6 +256,8 @@ GameBase::GameBase() GameBase::~GameBase() { + if (scope_registered) + arcaneFX::unregisterScopedObject(this); } @@ -266,8 +270,16 @@ bool GameBase::onAdd() // Datablock must be initialized on the server. // Client datablock are initialized by the initial update. - if ( isServerObject() && mDataBlock && !onNewDataBlock( mDataBlock, false ) ) - return false; + if (isClientObject()) + { + if (scope_id > 0 && !scope_registered) + arcaneFX::registerScopedObject(this); + } + else + { + if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) ) + return false; + } setProcessTick( true ); @@ -276,6 +288,8 @@ bool GameBase::onAdd() void GameBase::onRemove() { + if (scope_registered) + arcaneFX::unregisterScopedObject(this); // EDITOR FEATURE: Remove us from the reload signal of our datablock. if ( mDataBlock ) mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified ); @@ -556,6 +570,11 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream stream->writeFlag(mIsAiControlled); #endif + if (stream->writeFlag(mask & ScopeIdMask)) + { + if (stream->writeFlag(scope_refs > 0)) + stream->writeInt(scope_id, SCOPE_ID_BITS); + } return retMask; } @@ -594,6 +613,11 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream) mTicksSinceLastMove = 0; mIsAiControlled = stream->readFlag(); #endif + if (stream->readFlag()) + { + scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; + scope_refs = 0; + } } void GameBase::onMount( SceneObject *obj, S32 node ) diff --git a/Engine/source/T3D/gameBase/gameBase.h b/Engine/source/T3D/gameBase/gameBase.h index be9094e85..e6cf5c973 100644 --- a/Engine/source/T3D/gameBase/gameBase.h +++ b/Engine/source/T3D/gameBase/gameBase.h @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _GAMEBASE_H_ #define _GAMEBASE_H_ @@ -235,7 +236,8 @@ public: enum GameBaseMasks { DataBlockMask = Parent::NextFreeMask << 0, ExtendedInfoMask = Parent::NextFreeMask << 1, - NextFreeMask = Parent::NextFreeMask << 2 + ScopeIdMask = Parent::NextFreeMask << 2, + NextFreeMask = Parent::NextFreeMask << 3, }; // net flags added by game base @@ -459,6 +461,8 @@ private: /// within this callback. /// void _onDatablockModified(); +protected: + void onScopeIdChange() { setMaskBits(ScopeIdMask); } }; diff --git a/Engine/source/sim/netConnection.cpp b/Engine/source/sim/netConnection.cpp index f12c8cde6..c952a0258 100644 --- a/Engine/source/sim/netConnection.cpp +++ b/Engine/source/sim/netConnection.cpp @@ -316,7 +316,10 @@ void NetConnection::checkMaxRate() { packetRateToServer = 128; packetRateToClient = 128; - packetSize = 1024; + // These changes introduced in T3D 1.1 Preview reduce the packet headroom which leads + // to some spells and effects running out of room when dynamic variables are used + // to send launch-time parameters to clients. + packetSize = 512; } gPacketUpdateDelayToServer = 1024 / packetRateToServer; diff --git a/Engine/source/sim/netConnection.h b/Engine/source/sim/netConnection.h index c2e106fa3..55422f9eb 100644 --- a/Engine/source/sim/netConnection.h +++ b/Engine/source/sim/netConnection.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _NETCONNECTION_H_ #define _NETCONNECTION_H_ @@ -1050,6 +1055,9 @@ public: virtual bool readDemoStartBlock(BitStream *stream); virtual void demoPlaybackComplete(); /// @} +public: + S32 getCurRatePacketSize() const { return mCurRate.packetSize; } + S32 getMaxRatePacketSize() const { return mMaxRate.packetSize; } }; diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index cd432d717..76564fb16 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "console/simBase.h" #include "core/dnet.h" @@ -28,6 +33,8 @@ #include "console/consoleTypes.h" #include "console/engineAPI.h" +#include "afx/arcaneFX.h" + IMPLEMENT_CONOBJECT(NetObject); // More information can be found in the Torque Manual (CHM) @@ -46,6 +53,9 @@ NetObject::NetObject() mPrevDirtyList = NULL; mNextDirtyList = NULL; mDirtyMaskBits = 0; + scope_id = 0; + scope_refs = 0; + scope_registered = false; } NetObject::~NetObject() @@ -460,3 +470,26 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),, //{ // return object->isServerObject(); //} +U16 NetObject::addScopeRef() +{ + if (scope_refs == 0) + { + scope_id = arcaneFX::generateScopeId(); + onScopeIdChange(); + } + scope_refs++; + return scope_id; +} + +void NetObject::removeScopeRef() +{ + if (scope_refs == 0) + return; + scope_refs--; + if (scope_refs == 0) + { + scope_id = 0; + onScopeIdChange(); + } +} + diff --git a/Engine/source/sim/netObject.h b/Engine/source/sim/netObject.h index ced8a2cf3..a486936be 100644 --- a/Engine/source/sim/netObject.h +++ b/Engine/source/sim/netObject.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _NETOBJECT_H_ #define _NETOBJECT_H_ @@ -405,6 +410,18 @@ public: static T* getClientObject( T *netObj ) { return static_cast( netObj->getClientObject() ); } /// @} +protected: + U16 scope_id; + U16 scope_refs; + bool scope_registered; + virtual void onScopeIdChange() { } +public: + enum { SCOPE_ID_BITS = 14 }; + U16 getScopeId() const { return scope_id; } + U16 addScopeRef(); + void removeScopeRef(); + void setScopeRegistered(bool flag) { scope_registered = flag; } + bool getScopeRegistered() const { return scope_registered; } }; //----------------------------------------------------------------------------- From a64a2c9793ac2fef46ca0eb32f74ddf62ad29ba1 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 00:15:01 +0100 Subject: [PATCH 019/312] remap-txr-tags -- runtime reassignment of texture tag names. (Useful for splitting up tags with the same name in order to map different materials to them.) bbox-check -- a change that allows disabling of a confusing error message. --- Engine/source/T3D/shapeBase.cpp | 87 ++++++++++++++++++++++++ Engine/source/T3D/shapeBase.h | 9 +++ Engine/source/materials/materialList.cpp | 12 +++- 3 files changed, 107 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index e0ce47cec..1aebe6755 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -198,6 +198,9 @@ ShapeBaseData::ShapeBaseData() inheritEnergyFromMount( false ) { dMemset( mountPointNode, -1, sizeof( S32 ) * SceneObject::NumMountPoints ); + remap_txr_tags = NULL; + remap_buffer = NULL; + silent_bbox_check = false; } ShapeBaseData::ShapeBaseData(const ShapeBaseData& other, bool temp_clone) : GameBaseData(other, temp_clone) @@ -292,6 +295,8 @@ static ShapeBaseDataProto gShapeBaseDataProto; ShapeBaseData::~ShapeBaseData() { + if (remap_buffer && !isTempClone()) + dFree(remap_buffer); } bool ShapeBaseData::preload(bool server, String &errorStr) @@ -401,11 +406,13 @@ bool ShapeBaseData::preload(bool server, String &errorStr) if (!mShape->bounds.isContained(collisionBounds.last())) { + if (!silent_bbox_check) Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last()); collisionBounds.last() = mShape->bounds; } else if (collisionBounds.last().isValidBox() == false) { + if (!silent_bbox_check) Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last()); collisionBounds.last() = mShape->bounds; } @@ -477,6 +484,29 @@ bool ShapeBaseData::preload(bool server, String &errorStr) F32 w = mShape->bounds.len_y() / 2; if (cameraMaxDist < w) cameraMaxDist = w; + // just parse up the string and collect the remappings in txr_tag_remappings. + if (!server && remap_txr_tags != NULL && remap_txr_tags != StringTable->insert("")) + { + txr_tag_remappings.clear(); + if (remap_buffer) + dFree(remap_buffer); + + remap_buffer = dStrdup(remap_txr_tags); + + char* remap_token = dStrtok(remap_buffer, " \t"); + while (remap_token != NULL) + { + char* colon = dStrchr(remap_token, ':'); + if (colon) + { + *colon = '\0'; + txr_tag_remappings.increment(); + txr_tag_remappings.last().old_tag = remap_token; + txr_tag_remappings.last().new_tag = colon+1; + } + remap_token = dStrtok(NULL, " \t"); + } + } } if(!server) @@ -650,6 +680,8 @@ void ShapeBaseData::initPersistFields() endGroup( "Reflection" ); + addField("remapTextureTags", TypeString, Offset(remap_txr_tags, ShapeBaseData)); + addField("silentBBoxValidation", TypeBool, Offset(silent_bbox_check, ShapeBaseData)); // disallow some field substitutions onlyKeepClearSubstitutions("debris"); // subs resolving to "~~", or "~0" are OK onlyKeepClearSubstitutions("explosion"); @@ -806,6 +838,8 @@ void ShapeBaseData::packData(BitStream* stream) //stream->write(reflectMinDist); //stream->write(reflectMaxDist); //stream->write(reflectDetailAdjust); + stream->writeString(remap_txr_tags); + stream->writeFlag(silent_bbox_check); } void ShapeBaseData::unpackData(BitStream* stream) @@ -907,6 +941,8 @@ void ShapeBaseData::unpackData(BitStream* stream) //stream->read(&reflectMinDist); //stream->read(&reflectMaxDist); //stream->read(&reflectDetailAdjust); + remap_txr_tags = stream->readSTString(); + silent_bbox_check = stream->readFlag(); } @@ -1166,10 +1202,61 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) // a shape assigned to this object. if (bool(mDataBlock->mShape)) { delete mShapeInstance; + if (isClientObject() && mDataBlock->txr_tag_remappings.size() > 0) + { + // temporarily substitute material tags with alternates + TSMaterialList* mat_list = mDataBlock->mShape->materialList; + if (mat_list) + { + for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) + { + ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i]; + Vector & mat_names = (Vector&) mat_list->getMaterialNameList(); + for (S32 j = 0; j < mat_names.size(); j++) + { + if (mat_names[j].compare(remap->old_tag, dStrlen(remap->old_tag), String::NoCase) == 0) + { + mat_names[j] = String(remap->new_tag); + mat_names[j].insert(0,'#'); + break; + } + } + } + } + } mShapeInstance = new TSShapeInstance(mDataBlock->mShape, isClientObject()); if (isClientObject()) + { mShapeInstance->cloneMaterialList(); + // restore the material tags to original form + if (mDataBlock->txr_tag_remappings.size() > 0) + { + TSMaterialList* mat_list = mDataBlock->mShape->materialList; + if (mat_list) + { + for (S32 i = 0; i < mDataBlock->txr_tag_remappings.size(); i++) + { + ShapeBaseData::TextureTagRemapping* remap = &mDataBlock->txr_tag_remappings[i]; + Vector & mat_names = (Vector&) mat_list->getMaterialNameList(); + for (S32 j = 0; j < mat_names.size(); j++) + { + String::SizeType len = mat_names[j].length(); + if (len > 1) + { + String temp_name = mat_names[j].substr(1,len-1); + if (temp_name.compare(remap->new_tag, dStrlen(remap->new_tag)) == 0) + { + mat_names[j] = String(remap->old_tag); + break; + } + } + } + } + } + } + } + mObjBox = mDataBlock->mShape->bounds; resetWorldBox(); diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index e32eb0d0b..163fa956b 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -658,6 +658,15 @@ public: DECLARE_CALLBACK(void, onEndSequence, (ShapeBase* obj, S32 slot, const char* name)); DECLARE_CALLBACK( void, onForceUncloak, ( ShapeBase* obj, const char* reason ) ); /// @} + struct TextureTagRemapping + { + char* old_tag; + char* new_tag; + }; + StringTableEntry remap_txr_tags; + char* remap_buffer; + Vector txr_tag_remappings; + bool silent_bbox_check; public: ShapeBaseData(const ShapeBaseData&, bool = false); }; diff --git a/Engine/source/materials/materialList.cpp b/Engine/source/materials/materialList.cpp index 65aade9e5..4ddb75bbb 100644 --- a/Engine/source/materials/materialList.cpp +++ b/Engine/source/materials/materialList.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "materials/materialList.h" @@ -309,7 +314,12 @@ void MaterialList::mapMaterial( U32 i ) return; } - String materialName = MATMGR->getMapEntry(matName); + String materialName; + // Skip past a leading '#' marker. + if (matName.compare("#", 1) == 0) + materialName = MATMGR->getMapEntry(matName.substr(1, matName.length()-1)); + else + materialName = MATMGR->getMapEntry(matName); // IF we didn't find it, then look for a PolyStatic generated Material // [a little cheesy, but we need to allow for user override of generated Materials] From ae2bedccee297da4325fbe19a9f6aa0ae292fac9 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 00:16:13 +0100 Subject: [PATCH 020/312] radius-search -- Expose search-list used for determining area damage. --- Engine/source/scene/sceneContainer.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Engine/source/scene/sceneContainer.h b/Engine/source/scene/sceneContainer.h index 0033d7cab..a98548964 100644 --- a/Engine/source/scene/sceneContainer.h +++ b/Engine/source/scene/sceneContainer.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _SCENECONTAINER_H_ #define _SCENECONTAINER_H_ @@ -304,6 +309,8 @@ class SceneContainer void _findSpecialObjects( const Vector< SceneObject* >& vector, const Box3F &box, U32 mask, FindCallback callback, void *key = NULL ); static void getBinRange( const F32 min, const F32 max, U32& minBin, U32& maxBin ); +public: + Vector*>& getRadiusSearchList() { return mSearchList; } }; //----------------------------------------------------------------------------- From 62500487f1c106a616f2fca412b1023b73a96c54 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 00:18:38 +0100 Subject: [PATCH 021/312] ground-cover -- Adds an ambient modulation bias to control how much the foliage images are modulated by the sun's ambient light setting. full modulation -- 1.0 (default) no modulation -- 0.0 --- Engine/source/T3D/fx/fxFoliageReplicator.cpp | 17 ++++++++++++++++- Engine/source/T3D/fx/fxFoliageReplicator.h | 7 +++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/fx/fxFoliageReplicator.cpp b/Engine/source/T3D/fx/fxFoliageReplicator.cpp index b62644eb0..bd8389486 100644 --- a/Engine/source/T3D/fx/fxFoliageReplicator.cpp +++ b/Engine/source/T3D/fx/fxFoliageReplicator.cpp @@ -43,6 +43,11 @@ // POTENTIAL TODO LIST: // TODO: Clamp item alpha to fog alpha +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/fx/fxFoliageReplicator.h" @@ -402,6 +407,9 @@ void fxFoliageReplicator::initPersistFields() addField( "AllowedTerrainSlope", TypeS32, Offset( mFieldData.mAllowedTerrainSlope, fxFoliageReplicator ), "Maximum surface angle allowed for foliage instances." ); endGroup( "Restrictions" ); // MM: Added Group Footer. + addGroup( "AFX" ); + addField( "AmbientModulationBias", TypeF32, Offset( mFieldData.mAmbientModulationBias,fxFoliageReplicator ), "Multiplier controling amount foliage is modulated by sun's ambient." ); + endGroup( "AFX" ); // Initialise parents' persistent fields. Parent::initPersistFields(); } @@ -1564,7 +1572,12 @@ void fxFoliageReplicator::renderObject(ObjectRenderInst *ri, SceneRenderState *s mFoliageShaderConsts->setSafe(mFoliageShaderGroundAlphaSC, Point4F(mFieldData.mGroundAlpha, mFieldData.mGroundAlpha, mFieldData.mGroundAlpha, mFieldData.mGroundAlpha)); if (mFoliageShaderAmbientColorSC->isValid()) - mFoliageShaderConsts->set(mFoliageShaderAmbientColorSC, state->getAmbientLightColor()); + { + LinearColorF ambient = state->getAmbientLightColor(); + LinearColorF ambient_inv(1.0f-ambient.red, 1.0f-ambient.green, 1.0f-ambient.blue, 0.0f); + ambient += ambient_inv*(1.0f - mFieldData.mAmbientModulationBias); + mFoliageShaderConsts->set(mFoliageShaderAmbientColorSC, ambient); + } GFX->setShaderConstBuffer(mFoliageShaderConsts); @@ -1705,6 +1718,7 @@ U32 fxFoliageReplicator::packUpdate(NetConnection * con, U32 mask, BitStream * s stream->writeFlag(mFieldData.mShowPlacementArea); // Show Placement Area Flag. stream->write(mFieldData.mPlacementBandHeight); // Placement Area Height. stream->write(mFieldData.mPlaceAreaColour); // Placement Area Colour. + stream->write(mFieldData.mAmbientModulationBias); } // Were done ... @@ -1782,6 +1796,7 @@ void fxFoliageReplicator::unpackUpdate(NetConnection * con, BitStream * stream) stream->read(&mFieldData.mPlacementBandHeight); // Placement Area Height. stream->read(&mFieldData.mPlaceAreaColour); + stream->read(&mFieldData.mAmbientModulationBias); // Calculate Fade-In/Out Gradients. mFadeInGradient = 1.0f / mFieldData.mFadeInRegion; mFadeOutGradient = 1.0f / mFieldData.mFadeOutRegion; diff --git a/Engine/source/T3D/fx/fxFoliageReplicator.h b/Engine/source/T3D/fx/fxFoliageReplicator.h index 9b7bad58f..0d8224652 100644 --- a/Engine/source/T3D/fx/fxFoliageReplicator.h +++ b/Engine/source/T3D/fx/fxFoliageReplicator.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _FOLIAGEREPLICATOR_H_ #define _FOLIAGEREPLICATOR_H_ @@ -319,6 +324,7 @@ public: U32 mPlacementBandHeight; LinearColorF mPlaceAreaColour; + F32 mAmbientModulationBias; tagFieldData() { // Set Defaults. @@ -377,6 +383,7 @@ public: mShowPlacementArea = true; mPlacementBandHeight = 25; mPlaceAreaColour .set(0.4f, 0, 0.8f); + mAmbientModulationBias = 1.0f; } } mFieldData; From 8c654676976eccace9c38da7b1a565e94e55a5e3 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 00:21:47 +0100 Subject: [PATCH 022/312] process-order -- code to help positioning of objects in the process lists. --- Engine/source/T3D/gameBase/processList.cpp | 20 ++++++++++++++++++++ Engine/source/T3D/gameBase/processList.h | 8 ++++++++ 2 files changed, 28 insertions(+) diff --git a/Engine/source/T3D/gameBase/processList.cpp b/Engine/source/T3D/gameBase/processList.cpp index 8e524a205..1fef84fc2 100644 --- a/Engine/source/T3D/gameBase/processList.cpp +++ b/Engine/source/T3D/gameBase/processList.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/gameBase/processList.h" @@ -284,5 +289,20 @@ void ProcessList::advanceObjects() PROFILE_END(); } +ProcessObject* ProcessList::findNearestToEnd(Vector& objs) const +{ + if (objs.empty()) + return 0; + for (ProcessObject* obj = mHead.mProcessLink.prev; obj != &mHead; obj = obj->mProcessLink.prev) + { + for (S32 i = 0; i < objs.size(); i++) + { + if (obj == objs[i]) + return obj; + } + } + + return 0; +} diff --git a/Engine/source/T3D/gameBase/processList.h b/Engine/source/T3D/gameBase/processList.h index 67c769e70..0ac4ecb2c 100644 --- a/Engine/source/T3D/gameBase/processList.h +++ b/Engine/source/T3D/gameBase/processList.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _PROCESSLIST_H_ #define _PROCESSLIST_H_ @@ -188,6 +193,9 @@ protected: PreTickSignal mPreTick; PostTickSignal mPostTick; + // JTF: still needed? +public: + ProcessObject* findNearestToEnd(Vector& objs) const; }; #endif // _PROCESSLIST_H_ \ No newline at end of file From ab88b8f48962b8a2bbc6e907737e19e0d3340f6e Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 00:31:43 +0100 Subject: [PATCH 023/312] anim-clip -- sequence selection by afx effects --- Engine/source/T3D/aiPlayer.cpp | 76 ++++++++++-- Engine/source/T3D/aiPlayer.h | 17 +++ Engine/source/T3D/player.cpp | 187 +++++++++++++++++++++++++++++- Engine/source/T3D/player.h | 11 ++ Engine/source/T3D/shapeBase.cpp | 197 ++++++++++++++++++++++++++++++++ Engine/source/T3D/shapeBase.h | 37 ++++++ 6 files changed, 511 insertions(+), 14 deletions(-) diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index 38a3133e6..6e1c39328 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/aiPlayer.h" @@ -97,6 +102,9 @@ AIPlayer::AIPlayer() mMoveSlowdown = true; mMoveState = ModeStop; + // This new member saves the movement state of the AI so that + // it can be restored after a substituted animation is finished. + mMoveState_saved = -1; mAimObject = 0; mAimLocationSet = false; mTargetInLOS = false; @@ -547,23 +555,27 @@ bool AIPlayer::getAIMove(Move *movePtr) mMoveState = ModeMove; } - if (mMoveStuckTestCountdown > 0) - --mMoveStuckTestCountdown; - else - { - // We should check to see if we are stuck... - F32 locationDelta = (location - mLastLocation).len(); + // Don't check for ai stuckness if animation during + // an anim-clip effect override. + if (mDamageState == Enabled && !(anim_clip_flags & ANIM_OVERRIDDEN) && !isAnimationLocked()) { + if (mMoveStuckTestCountdown > 0) + --mMoveStuckTestCountdown; + else + { + // We should check to see if we are stuck... + F32 locationDelta = (location - mLastLocation).len(); if (locationDelta < mMoveStuckTolerance && mDamageState == Enabled) { // If we are slowing down, then it's likely that our location delta will be less than // our move stuck tolerance. Because we can be both slowing and stuck // we should TRY to check if we've moved. This could use better detection. if ( mMoveState != ModeSlowing || locationDelta == 0 ) - { - mMoveState = ModeStuck; - onStuck(); - } - } + { + mMoveState = ModeStuck; + onStuck(); + } + } + } } } } @@ -626,6 +638,7 @@ bool AIPlayer::getAIMove(Move *movePtr) } #endif // TORQUE_NAVIGATION_ENABLED + if (!(anim_clip_flags & ANIM_OVERRIDDEN) && !isAnimationLocked()) mLastLocation = location; return true; @@ -1415,6 +1428,47 @@ DefineEngineMethod( AIPlayer, clearMoveTriggers, void, ( ),, object->clearMoveTriggers(); } +// These changes coordinate with anim-clip mods to parent class, Player. + +// New method, restartMove(), restores the AIPlayer to its normal move-state +// following animation overrides from AFX. The tag argument is used to match +// the latest override and prevents interruption of overlapping animation +// overrides. See related anim-clip changes in Player.[h,cc]. +void AIPlayer::restartMove(U32 tag) +{ + if (tag != 0 && tag == last_anim_tag) + { + if (mMoveState_saved != -1) + { + mMoveState = (MoveState) mMoveState_saved; + mMoveState_saved = -1; + } + + bool is_death_anim = ((anim_clip_flags & IS_DEATH_ANIM) != 0); + + last_anim_tag = 0; + anim_clip_flags &= ~(ANIM_OVERRIDDEN | IS_DEATH_ANIM); + + if (mDamageState != Enabled) + { + if (!is_death_anim) + { + // this is a bit hardwired and desperate, + // but if he's dead he needs to look like it. + setActionThread("death10", false, false, false); + } + } + } +} + +// New method, saveMoveState(), stores the current movement state +// so that it can be restored when restartMove() is called. +void AIPlayer::saveMoveState() +{ + if (mMoveState_saved == -1) + mMoveState_saved = (S32) mMoveState; +} + F32 AIPlayer::getTargetDistance(GameBase* target, bool _checkEnabled) { if (!isServerObject()) return false; diff --git a/Engine/source/T3D/aiPlayer.h b/Engine/source/T3D/aiPlayer.h index a8430575c..524b0ba16 100644 --- a/Engine/source/T3D/aiPlayer.h +++ b/Engine/source/T3D/aiPlayer.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _AIPLAYER_H_ #define _AIPLAYER_H_ @@ -225,6 +230,18 @@ public: /// @} #endif // TORQUE_NAVIGATION_ENABLED + // New method, restartMove(), restores the AIPlayer to its normal move-state + // following animation overrides from AFX. The tag argument is used to match + // the latest override and prevents interruption of overlapping animation + // overrides. + // New method, saveMoveState(), stores the current movement state + // so that it can be restored when restartMove() is called. + // See related anim-clip changes in Player.[h,cc]. +private: + S32 mMoveState_saved; +public: + void restartMove(U32 tag); + void saveMoveState(); }; #endif diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 6b4d4ae0d..41cf55c03 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -2746,7 +2746,12 @@ void Player::updateMove(const Move* move) // Desired move direction & speed VectorF moveVec; F32 moveSpeed; - if ((mState == MoveState || (mState == RecoverState && mDataBlock->recoverRunForceScale > 0.0f)) && mDamageState == Enabled) + // If BLOCK_USER_CONTROL is set in anim_clip_flags, the user won't be able to + // resume control over the player character. This generally happens for + // short periods of time synchronized with script driven animation at places + // where it makes sense that user motion is prohibited, such as when the + // player is lifted off the ground or knocked down. + if ((mState == MoveState || (mState == RecoverState && mDataBlock->recoverRunForceScale > 0.0f)) && mDamageState == Enabled && !isAnimationLocked()) { zRot.getColumn(0,&moveVec); moveVec *= (move->x * (mPose == SprintPose ? mDataBlock->sprintStrafeScale : 1.0f)); @@ -3031,7 +3036,9 @@ void Player::updateMove(const Move* move) mContactTimer++; // Acceleration from Jumping - if (move->trigger[sJumpTrigger] && canJump())// !isMounted() && + // While BLOCK_USER_CONTROL is set in anim_clip_flags, the user won't be able to + // make the player character jump. + if (move->trigger[sJumpTrigger] && canJump() && !isAnimationLocked()) { // Scale the jump impulse base on maxJumpSpeed F32 zSpeedScale = mVelocity.z; @@ -3539,6 +3546,8 @@ void Player::updateLookAnimation(F32 dt) bool Player::inDeathAnim() { + if ((anim_clip_flags & ANIM_OVERRIDDEN) != 0 && (anim_clip_flags & IS_DEATH_ANIM) == 0) + return false; if (mActionAnimation.thread && mActionAnimation.action >= 0) if (mActionAnimation.action < mDataBlock->actionCount) return mDataBlock->actionList[mActionAnimation.action].death; @@ -3748,6 +3757,8 @@ bool Player::setArmThread(U32 action) bool Player::setActionThread(const char* sequence,bool hold,bool wait,bool fsp) { + if (anim_clip_flags & ANIM_OVERRIDDEN) + return false; for (U32 i = 1; i < mDataBlock->actionCount; i++) { PlayerData::ActionAnimation &anim = mDataBlock->actionList[i]; @@ -3947,8 +3958,10 @@ void Player::updateActionThread() pickActionAnimation(); } + // prevent scaling of AFX picked actions if ( (mActionAnimation.action != PlayerData::LandAnim) && - (mActionAnimation.action != PlayerData::NullAnimation) ) + (mActionAnimation.action != PlayerData::NullAnimation) && + !(anim_clip_flags & ANIM_OVERRIDDEN)) { // Update action animation time scale to match ground velocity PlayerData::ActionAnimation &anim = @@ -4566,6 +4579,10 @@ void Player::updateAnimation(F32 dt) if (mImageStateThread) mShapeInstance->advanceTime(dt,mImageStateThread); + // update any active blend clips + if (isGhost()) + for (S32 i = 0; i < blend_clips.size(); i++) + mShapeInstance->advanceTime(dt, blend_clips[i].thread); // If we are the client's player on this machine, then we need // to make sure the transforms are up to date as they are used // to setup the camera. @@ -4579,6 +4596,11 @@ void Player::updateAnimation(F32 dt) else { updateAnimationTree(false); + // This addition forces recently visible players to animate their + // skeleton now rather than in pre-render so that constrained effects + // get up-to-date node transforms. + if (didRenderLastRender()) + mShapeInstance->animate(); } } } @@ -7249,6 +7271,165 @@ void Player::afx_unpackUpdate(NetConnection* con, BitStream* stream) mark_fx_c_triggers = mask; } } + +// Code for overriding player's animation with sequences selected by the +// anim-clip component effect. + +void Player::restoreAnimation(U32 tag) +{ + // check if this is a blended clip + if ((tag & BLENDED_CLIP) != 0) + { + restoreBlendAnimation(tag); + return; + } + + if (tag != 0 && tag == last_anim_tag) + { + bool is_death_anim = ((anim_clip_flags & IS_DEATH_ANIM) != 0); + + anim_clip_flags &= ~(ANIM_OVERRIDDEN | IS_DEATH_ANIM); + + if (isClientObject()) + { + if (mDamageState != Enabled) + { + if (!is_death_anim) + { + // this is a bit hardwired and desperate, + // but if he's dead he needs to look like it. + setActionThread("death10", false, false, false); + } + } + else if (mState != MoveState) + { + // not sure what happens here + } + else + { + pickActionAnimation(); + } + } + + last_anim_tag = 0; + last_anim_id = -1; + } +} + +U32 Player::getAnimationID(const char* name) +{ + for (U32 i = 0; i < mDataBlock->actionCount; i++) + { + PlayerData::ActionAnimation &anim = mDataBlock->actionList[i]; + if (dStricmp(anim.name, name) == 0) + return i; + } + + Con::errorf("Player::getAnimationID() -- Player does not contain a sequence that matches the name, %s.", name); + return BAD_ANIM_ID; +} + +U32 Player::playAnimationByID(U32 anim_id, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim) +{ + if (anim_id == BAD_ANIM_ID) + return 0; + + S32 seq_id = mDataBlock->actionList[anim_id].sequence; + if (seq_id == -1) + { + Con::errorf("Player::playAnimation() problem. BAD_SEQ_ID"); + return 0; + } + + if (mShapeInstance->getShape()->sequences[seq_id].isBlend()) + return playBlendAnimation(seq_id, pos, rate); + + if (isClientObject()) + { + PlayerData::ActionAnimation &anim = mDataBlock->actionList[anim_id]; + if (anim.sequence != -1) + { + mActionAnimation.action = anim_id; + mActionAnimation.forward = (rate >= 0); + mActionAnimation.firstPerson = false; + mActionAnimation.holdAtEnd = hold; + mActionAnimation.waitForEnd = hold? true: wait; + mActionAnimation.animateOnServer = false; + mActionAnimation.atEnd = false; + mActionAnimation.delayTicks = (S32)sNewAnimationTickTime; + + F32 transTime = (trans < 0) ? sAnimationTransitionTime : trans; + + mShapeInstance->setTimeScale(mActionAnimation.thread, rate); + mShapeInstance->transitionToSequence(mActionAnimation.thread,anim.sequence, + pos, transTime, true); + } + } + + if (is_death_anim) + anim_clip_flags |= IS_DEATH_ANIM; + else + anim_clip_flags &= ~IS_DEATH_ANIM; + + anim_clip_flags |= ANIM_OVERRIDDEN; + last_anim_tag = unique_anim_tag_counter++; + last_anim_id = anim_id; + + return last_anim_tag; +} + +F32 Player::getAnimationDurationByID(U32 anim_id) +{ + if (anim_id == BAD_ANIM_ID) + return 0.0f; + S32 seq_id = mDataBlock->actionList[anim_id].sequence; + if (seq_id >= 0 && seq_id < mDataBlock->mShape->sequences.size()) + return mDataBlock->mShape->sequences[seq_id].duration; + + return 0.0f; +} + +bool Player::isBlendAnimation(const char* name) +{ + U32 anim_id = getAnimationID(name); + if (anim_id == BAD_ANIM_ID) + return false; + + S32 seq_id = mDataBlock->actionList[anim_id].sequence; + if (seq_id >= 0 && seq_id < mDataBlock->mShape->sequences.size()) + return mDataBlock->mShape->sequences[seq_id].isBlend(); + + return false; +} + +const char* Player::getLastClipName(U32 clip_tag) +{ + if (clip_tag != last_anim_tag || last_anim_id >= PlayerData::NumActionAnims) + return ""; + + return mDataBlock->actionList[last_anim_id].name; +} + +void Player::unlockAnimation(U32 tag, bool force) +{ + if ((tag != 0 && tag == last_anim_lock_tag) || force) + anim_clip_flags &= ~BLOCK_USER_CONTROL; +} + +U32 Player::lockAnimation() +{ + anim_clip_flags |= BLOCK_USER_CONTROL; + last_anim_lock_tag = unique_anim_tag_counter++; + + return last_anim_lock_tag; +} + +ConsoleMethod(Player, isAnimationLocked, bool, 2, 2, "isAnimationLocked()") +{ + return object->isAnimationLocked(); +} + + #ifdef TORQUE_OPENVR void Player::setControllers(Vector controllerList) { diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index 367536058..ec9bf3569 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -793,6 +793,17 @@ private: private: static bool sCorpsesHiddenFromRayCast; +public: + virtual void restoreAnimation(U32 tag); + virtual U32 getAnimationID(const char* name); + virtual U32 playAnimationByID(U32 anim_id, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim); + virtual F32 getAnimationDurationByID(U32 anim_id); + virtual bool isBlendAnimation(const char* name); + virtual const char* getLastClipName(U32 clip_tag); + virtual void unlockAnimation(U32 tag, bool force=false); + virtual U32 lockAnimation(); + virtual bool isAnimationLocked() const { return ((anim_clip_flags & BLOCK_USER_CONTROL) != 0); } + }; typedef Player::Pose PlayerPose; diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 1aebe6755..53f4509ed 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -1045,6 +1045,13 @@ ShapeBase::ShapeBase() for (i = 0; i < MaxTriggerKeys; i++) mTrigger[i] = false; + anim_clip_flags = 0; + last_anim_id = -1; + last_anim_tag = 0; + last_anim_lock_tag = 0; + saved_seq_id = -1; + saved_pos = 0.0f; + saved_rate = 1.0f; } @@ -1183,6 +1190,16 @@ void ShapeBase::onSceneRemove() bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) { + // need to destroy blend-clips or we crash + if (isGhost()) + { + for (S32 i = 0; i < blend_clips.size(); i++) + { + if (blend_clips[i].thread) + mShapeInstance->destroyThread(blend_clips[i].thread); + blend_clips.erase_fast(i); + } + } ShapeBaseData *prevDB = dynamic_cast( mDataBlock ); bool isInitialDataBlock = ( mDataBlock == 0 ); @@ -5101,6 +5118,186 @@ DefineEngineMethod( ShapeBase, getModelFile, const char *, (),, return datablock->getDataField( fieldName, NULL ); } + +U32 ShapeBase::unique_anim_tag_counter = 1; + +U32 ShapeBase::playBlendAnimation(S32 seq_id, F32 pos, F32 rate) +{ + BlendThread blend_clip; + blend_clip.tag = ((unique_anim_tag_counter++) | BLENDED_CLIP); + blend_clip.thread = 0; + + if (isClientObject()) + { + blend_clip.thread = mShapeInstance->addThread(); + mShapeInstance->setSequence(blend_clip.thread, seq_id, pos); + mShapeInstance->setTimeScale(blend_clip.thread, rate); + } + + blend_clips.push_back(blend_clip); + + return blend_clip.tag; +} + +void ShapeBase::restoreBlendAnimation(U32 tag) +{ + for (S32 i = 0; i < blend_clips.size(); i++) + { + if (blend_clips[i].tag == tag) + { + if (blend_clips[i].thread) + { + mShapeInstance->destroyThread(blend_clips[i].thread); + } + blend_clips.erase_fast(i); + break; + } + } +} + +// + +void ShapeBase::restoreAnimation(U32 tag) +{ + if (!isClientObject()) + return; + + // check if this is a blended clip + if ((tag & BLENDED_CLIP) != 0) + { + restoreBlendAnimation(tag); + return; + } + + if (tag != 0 && tag == last_anim_tag) + { + anim_clip_flags &= ~(ANIM_OVERRIDDEN | IS_DEATH_ANIM); + + stopThread(0); + + if (saved_seq_id != -1) + { + setThreadSequence(0, saved_seq_id); + setThreadPosition(0, saved_pos); + setThreadTimeScale(0, saved_rate); + setThreadDir(0, (saved_rate >= 0)); + playThread(0); + + saved_seq_id = -1; + saved_pos = 0.0f; + saved_rate = 1.0f; + } + + last_anim_tag = 0; + last_anim_id = -1; + } +} + +U32 ShapeBase::getAnimationID(const char* name) +{ + const TSShape* ts_shape = getShape(); + S32 seq_id = (ts_shape) ? ts_shape->findSequence(name) : -1; + return (seq_id >= 0) ? (U32) seq_id : BAD_ANIM_ID; +} + +U32 ShapeBase::playAnimationByID(U32 anim_id, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim) +{ + if (!isClientObject()) + return 0; + + if (anim_id == BAD_ANIM_ID) + return 0; + + const TSShape* ts_shape = getShape(); + if (!ts_shape) + return 0; + + S32 seq_id = (S32) anim_id; + if (mShapeInstance->getShape()->sequences[seq_id].isBlend()) + return playBlendAnimation(seq_id, pos, rate); + + if (last_anim_tag == 0) + { + // try to save state of playing animation + Thread& st = mScriptThread[0]; + if (st.sequence != -1) + { + saved_seq_id = st.sequence; + saved_pos = st.position; + saved_rate = st.timescale; + } + } + + // START OR TRANSITION TO SEQUENCE HERE + setThreadSequence(0, seq_id); + setThreadPosition(0, pos); + setThreadTimeScale(0, rate); + setThreadDir(0, (rate >= 0)); + playThread(0); + + if (is_death_anim) + anim_clip_flags |= IS_DEATH_ANIM; + else + anim_clip_flags &= ~IS_DEATH_ANIM; + + anim_clip_flags |= ANIM_OVERRIDDEN; + last_anim_tag = unique_anim_tag_counter++; + last_anim_id = anim_id; + + return last_anim_tag; +} + +F32 ShapeBase::getAnimationDurationByID(U32 anim_id) +{ + if (anim_id == BAD_ANIM_ID) + return 0.0f; + + S32 seq_id = (S32) anim_id; + if (seq_id >= 0 && seq_id < mDataBlock->mShape->sequences.size()) + return mDataBlock->mShape->sequences[seq_id].duration; + + return 0.0f; +} + +bool ShapeBase::isBlendAnimation(const char* name) +{ + U32 anim_id = getAnimationID(name); + if (anim_id == BAD_ANIM_ID) + return false; + + S32 seq_id = (S32) anim_id; + if (seq_id >= 0 && seq_id < mDataBlock->mShape->sequences.size()) + return mDataBlock->mShape->sequences[seq_id].isBlend(); + + return false; +} + +const char* ShapeBase::getLastClipName(U32 clip_tag) +{ + if (clip_tag != last_anim_tag) + return ""; + + S32 seq_id = (S32) last_anim_id; + + S32 idx = mDataBlock->mShape->sequences[seq_id].nameIndex; + if (idx < 0 || idx >= mDataBlock->mShape->names.size()) + return 0; + + return mDataBlock->mShape->names[idx]; +} + +// + +U32 ShapeBase::playAnimation(const char* name, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim) +{ + return playAnimationByID(getAnimationID(name), pos, rate, trans, hold, wait, is_death_anim); +} + +F32 ShapeBase::getAnimationDuration(const char* name) +{ + return getAnimationDurationByID(getAnimationID(name)); +} + void ShapeBase::setSelectionFlags(U8 flags) { Parent::setSelectionFlags(flags); diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 163fa956b..9276cfb98 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -1861,6 +1861,43 @@ public: protected: DECLARE_CALLBACK( F32, validateCameraFov, (F32 fov) ); +protected: + enum { + ANIM_OVERRIDDEN = BIT(0), + BLOCK_USER_CONTROL = BIT(1), + IS_DEATH_ANIM = BIT(2), + BAD_ANIM_ID = 999999999, + BLENDED_CLIP = 0x80000000, + }; + struct BlendThread + { + TSThread* thread; + U32 tag; + }; + Vector blend_clips; + static U32 unique_anim_tag_counter; + U8 anim_clip_flags; + S32 last_anim_id; + U32 last_anim_tag; + U32 last_anim_lock_tag; + S32 saved_seq_id; + F32 saved_pos; + F32 saved_rate; + U32 playBlendAnimation(S32 seq_id, F32 pos, F32 rate); + void restoreBlendAnimation(U32 tag); +public: + U32 playAnimation(const char* name, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim); + F32 getAnimationDuration(const char* name); + + virtual void restoreAnimation(U32 tag); + virtual U32 getAnimationID(const char* name); + virtual U32 playAnimationByID(U32 anim_id, F32 pos, F32 rate, F32 trans, bool hold, bool wait, bool is_death_anim); + virtual F32 getAnimationDurationByID(U32 anim_id); + virtual bool isBlendAnimation(const char* name); + virtual const char* getLastClipName(U32 clip_tag); + virtual void unlockAnimation(U32 tag, bool force=false) { } + virtual U32 lockAnimation() { return 0; } + virtual bool isAnimationLocked() const { return false; } virtual void setSelectionFlags(U8 flags); }; From a7c7b67c852ade5f4d5b2526592b060692b73256 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:10:20 +0100 Subject: [PATCH 024/312] enhanced-physical-zone -- PhysicalZone object enhanced to allow orientation add radial forces. pz-opt -- PhysicalZone network optimizations. --- Engine/source/T3D/containerQuery.cpp | 9 +- Engine/source/T3D/physicalZone.cpp | 226 ++++++++++++++++++++++++--- Engine/source/T3D/physicalZone.h | 37 ++++- 3 files changed, 244 insertions(+), 28 deletions(-) diff --git a/Engine/source/T3D/containerQuery.cpp b/Engine/source/T3D/containerQuery.cpp index 1c3f34609..1c5f1bc90 100644 --- a/Engine/source/T3D/containerQuery.cpp +++ b/Engine/source/T3D/containerQuery.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/containerQuery.h" @@ -91,7 +96,9 @@ void physicalZoneFind(SceneObject* obj, void *key) if (pz->isActive()) { info->gravityScale *= pz->getGravityMod(); - info->appliedForce += pz->getForce(); + Point3F center; + info->box.getCenter(¢er); + info->appliedForce += pz->getForce(¢er); } } diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index f7307ef21..b9301d0da 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "T3D/physicalZone.h" #include "core/stream/bitStream.h" #include "collision/boxConvex.h" @@ -33,6 +38,8 @@ #include "gfx/gfxDrawUtil.h" #include "console/engineAPI.h" +//#include "console/engineTypes.h" +#include "sim/netConnection.h" IMPLEMENT_CO_NETOBJECT_V1(PhysicalZone); ConsoleDocClass( PhysicalZone, @@ -103,6 +110,10 @@ PhysicalZone::PhysicalZone() mConvexList = new Convex; mActive = true; + force_type = VECTOR; + force_mag = 0.0f; + orient_force = false; + fade_amt = 1.0f; } PhysicalZone::~PhysicalZone() @@ -111,6 +122,16 @@ PhysicalZone::~PhysicalZone() mConvexList = NULL; } + +ImplementEnumType( PhysicalZone_ForceType, "Possible physical zone force types.\n" "@ingroup PhysicalZone\n\n" ) + { PhysicalZone::VECTOR, "vector", "..." }, + { PhysicalZone::SPHERICAL, "spherical", "..." }, + { PhysicalZone::CYLINDRICAL, "cylindrical", "..." }, + // aliases + { PhysicalZone::SPHERICAL, "sphere", "..." }, + { PhysicalZone::CYLINDRICAL, "cylinder", "..." }, +EndImplementEnumType; + //-------------------------------------------------------------------------- void PhysicalZone::consoleInit() { @@ -129,6 +150,10 @@ void PhysicalZone::initPersistFields() "point followed by three vectors representing the edges extending from the corner." ); endGroup("Misc"); + addGroup("AFX"); + addField("forceType", TYPEID(), Offset(force_type, PhysicalZone)); + addField("orientForce", TypeBool, Offset(orient_force, PhysicalZone)); + endGroup("AFX"); Parent::initPersistFields(); } @@ -158,6 +183,19 @@ bool PhysicalZone::onAdd() Polyhedron temp = mPolyhedron; setPolyhedron(temp); + switch (force_type) + { + case SPHERICAL: + force_mag = mAppliedForce.magnitudeSafe(); + break; + case CYLINDRICAL: + { + Point3F force_vec = mAppliedForce; + force_vec.z = 0.0; + force_mag = force_vec.magnitudeSafe(); + } + break; + } addToScene(); return true; @@ -191,7 +229,7 @@ void PhysicalZone::setTransform(const MatrixF & mat) mClippedList.setBaseTransform(base); if (isServerObject()) - setMaskBits(InitialUpdateMask); + setMaskBits(MoveMask); } @@ -242,12 +280,8 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream) U32 i; U32 retMask = Parent::packUpdate(con, mask, stream); - if (stream->writeFlag((mask & InitialUpdateMask) != 0)) { - // Note that we don't really care about efficiency here, since this is an - // edit-only ghost... - mathWrite(*stream, mObjToWorld); - mathWrite(*stream, mObjScale); - + if (stream->writeFlag(mask & PolyhedronMask)) + { // Write the polyhedron stream->write(mPolyhedron.pointList.size()); for (i = 0; i < mPolyhedron.pointList.size(); i++) @@ -266,15 +300,33 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream) stream->write(rEdge.vertex[0]); stream->write(rEdge.vertex[1]); } + } + if (stream->writeFlag(mask & MoveMask)) + { + stream->writeAffineTransform(mObjToWorld); + mathWrite(*stream, mObjScale); + } + + if (stream->writeFlag(mask & SettingsMask)) + { stream->write(mVelocityMod); stream->write(mGravityMod); mathWrite(*stream, mAppliedForce); - stream->writeFlag(mActive); - } else { - stream->writeFlag(mActive); + stream->writeInt(force_type, FORCE_TYPE_BITS); + stream->writeFlag(orient_force); } + if (stream->writeFlag(mask & FadeMask)) + { + U8 fade_byte = (U8)(fade_amt*255.0f); + stream->write(fade_byte); + } + + stream->writeFlag(mActive); + + // AFX CODE BLOCK (enhanced-physical-zone)(pz-opt) >> + return retMask; } @@ -282,16 +334,12 @@ void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream) { Parent::unpackUpdate(con, stream); - if (stream->readFlag()) { + bool new_ph = false; + if (stream->readFlag()) // PolyhedronMask + { U32 i, size; - MatrixF temp; - Point3F tempScale; Polyhedron tempPH; - // Transform - mathRead(*stream, &temp); - mathRead(*stream, &tempScale); - // Read the polyhedron stream->read(&size); tempPH.pointList.setSize(size); @@ -314,17 +362,46 @@ void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream) stream->read(&rEdge.vertex[1]); } + setPolyhedron(tempPH); + new_ph = true; + } + + if (stream->readFlag()) // MoveMask + { + MatrixF temp; + stream->readAffineTransform(&temp); + + Point3F tempScale; + mathRead(*stream, &tempScale); + + //if (!new_ph) + //{ + // Polyhedron rPolyhedron = mPolyhedron; + // setPolyhedron(rPolyhedron); + //} + setScale(tempScale); + setTransform(temp); + } + + if (stream->readFlag()) //SettingsMask + { stream->read(&mVelocityMod); stream->read(&mGravityMod); mathRead(*stream, &mAppliedForce); - - setPolyhedron(tempPH); - setScale(tempScale); - setTransform(temp); - mActive = stream->readFlag(); - } else { - mActive = stream->readFlag(); + force_type = stream->readInt(FORCE_TYPE_BITS); // AFX + orient_force = stream->readFlag(); // AFX } + + if (stream->readFlag()) //FadeMask + { + U8 fade_byte; + stream->read(&fade_byte); + fade_amt = ((F32)fade_byte)/255.0f; + } + else + fade_amt = 1.0f; + + mActive = stream->readFlag(); } @@ -443,3 +520,104 @@ void PhysicalZone::deactivate() mActive = false; } +void PhysicalZone::onStaticModified(const char* slotName, const char*newValue) +{ + if (dStricmp(slotName, "appliedForce") == 0 || dStricmp(slotName, "forceType") == 0) + { + switch (force_type) + { + case SPHERICAL: + force_mag = mAppliedForce.magnitudeSafe(); + break; + case CYLINDRICAL: + { + Point3F force_vec = mAppliedForce; + force_vec.z = 0.0; + force_mag = force_vec.magnitudeSafe(); + } + break; + } + } +} + +const Point3F& PhysicalZone::getForce(const Point3F* center) const +{ + static Point3F force_vec; + + if (force_type == VECTOR) + { + if (orient_force) + { + getTransform().mulV(mAppliedForce, &force_vec); + force_vec *= fade_amt; + return force_vec; + } + force_vec = mAppliedForce; + force_vec *= fade_amt; + return force_vec; + } + + if (!center) + { + force_vec.zero(); + return force_vec; + } + + if (force_type == SPHERICAL) + { + force_vec = *center - getPosition(); + force_vec.normalizeSafe(); + force_vec *= force_mag*fade_amt; + return force_vec; + } + + if (orient_force) + { + force_vec = *center - getPosition(); + getWorldTransform().mulV(force_vec); + force_vec.z = 0.0f; + force_vec.normalizeSafe(); + force_vec *= force_mag; + force_vec.z = mAppliedForce.z; + getTransform().mulV(force_vec); + force_vec *= fade_amt; + return force_vec; + } + + force_vec = *center - getPosition(); + force_vec.z = 0.0f; + force_vec.normalizeSafe(); + force_vec *= force_mag; + force_vec *= fade_amt; + return force_vec; +} + +bool PhysicalZone::isExcludedObject(SceneObject* obj) const +{ + for (S32 i = 0; i < excluded_objects.size(); i++) + if (excluded_objects[i] == obj) + return true; + + return false; +} + +void PhysicalZone::registerExcludedObject(SceneObject* obj) +{ + if (isExcludedObject(obj)) + return; + + excluded_objects.push_back(obj); + setMaskBits(FadeMask); +} + +void PhysicalZone::unregisterExcludedObject(SceneObject* obj) +{ + for (S32 i = 0; i < excluded_objects.size(); i++) + if (excluded_objects[i] == obj) + { + excluded_objects.erase(i); + setMaskBits(FadeMask); + return; + } +} + diff --git a/Engine/source/T3D/physicalZone.h b/Engine/source/T3D/physicalZone.h index 2f1d72593..004ce6cb3 100644 --- a/Engine/source/T3D/physicalZone.h +++ b/Engine/source/T3D/physicalZone.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _H_PHYSICALZONE #define _H_PHYSICALZONE @@ -40,9 +45,14 @@ class PhysicalZone : public SceneObject { typedef SceneObject Parent; - enum UpdateMasks { + enum UpdateMasks { ActiveMask = Parent::NextFreeMask << 0, - NextFreeMask = Parent::NextFreeMask << 1 + SettingsMask = Parent::NextFreeMask << 1, + FadeMask = Parent::NextFreeMask << 2, + PolyhedronMask = Parent::NextFreeMask << 3, + MoveMask = Parent::NextFreeMask << 4, + ExclusionMask = Parent::NextFreeMask << 5, + NextFreeMask = Parent::NextFreeMask << 6 }; protected: @@ -83,7 +93,10 @@ class PhysicalZone : public SceneObject inline F32 getVelocityMod() const { return mVelocityMod; } inline F32 getGravityMod() const { return mGravityMod; } - inline const Point3F& getForce() const { return mAppliedForce; } + // the scene object is now passed in to getForce() where + // it is needed to calculate the applied force when the + // force is radial. + const Point3F& getForce(const Point3F* center=0) const; void setPolyhedron(const Polyhedron&); bool testObject(SceneObject*); @@ -96,7 +109,25 @@ class PhysicalZone : public SceneObject void deactivate(); inline bool isActive() const { return mActive; } +protected: + friend class afxPhysicalZoneData; + friend class afxEA_PhysicalZone; + Vector excluded_objects; + S32 force_type; + F32 force_mag; + bool orient_force; + F32 fade_amt; + void setFadeAmount(F32 amt) { fade_amt = amt; if (fade_amt < 1.0f) setMaskBits(FadeMask); } +public: + enum ForceType { VECTOR, SPHERICAL, CYLINDRICAL }; + enum { FORCE_TYPE_BITS = 2 }; + virtual void onStaticModified(const char* slotName, const char*newValue = NULL); + bool isExcludedObject(SceneObject*) const; + void registerExcludedObject(SceneObject*); + void unregisterExcludedObject(SceneObject*); }; +typedef PhysicalZone::ForceType PhysicalZone_ForceType; +DefineEnumType( PhysicalZone_ForceType ); #endif // _H_PHYSICALZONE From 19092c368a8e9bae4e27e01f6efc2e24dff31976 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:15:57 +0100 Subject: [PATCH 025/312] localRenderViz -- Implements per-light renderViz setting. --- Engine/source/T3D/lightBase.cpp | 8 +++++++- Engine/source/T3D/lightBase.h | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/lightBase.cpp b/Engine/source/T3D/lightBase.cpp index 76c0298c0..6cc739ed3 100644 --- a/Engine/source/T3D/lightBase.cpp +++ b/Engine/source/T3D/lightBase.cpp @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/lightBase.h" @@ -73,6 +78,7 @@ LightBase::LightBase() mLight = LightManager::createLightInfo(); mFlareState.clear(); + mLocalRenderViz = false; } LightBase::~LightBase() @@ -206,7 +212,7 @@ void LightBase::prepRenderImage( SceneRenderState *state ) // If the light is selected or light visualization // is enabled then register the callback. - if ( smRenderViz || isSelectedInEditor ) + if ( mLocalRenderViz || smRenderViz || isSelectedInEditor ) { ObjectRenderInst *ri = state->getRenderPass()->allocInst(); ri->renderDelegate.bind( this, &LightBase::_onRenderViz ); diff --git a/Engine/source/T3D/lightBase.h b/Engine/source/T3D/lightBase.h index af2c35071..bdaf38b15 100644 --- a/Engine/source/T3D/lightBase.h +++ b/Engine/source/T3D/lightBase.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _LIGHTBASE_H_ #define _LIGHTBASE_H_ @@ -132,6 +137,8 @@ public: virtual void pauseAnimation( void ); virtual void playAnimation( void ); virtual void playAnimation( LightAnimData *animData ); +protected: + bool mLocalRenderViz; }; #endif // _LIGHTBASE_H_ From d78f5bc4e9adc07c3cbf389b115867f9f9a2b498 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:18:57 +0100 Subject: [PATCH 026/312] afxModel-type -- defines a type bit for afxModel objects. --- Engine/source/T3D/objectTypes.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Engine/source/T3D/objectTypes.h b/Engine/source/T3D/objectTypes.h index c27479b7f..2b27a7171 100644 --- a/Engine/source/T3D/objectTypes.h +++ b/Engine/source/T3D/objectTypes.h @@ -24,11 +24,15 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _OBJECTTYPES_H_ #define _OBJECTTYPES_H_ #include "platform/types.h" +// Uncomment the AFX_CAP_AFXMODEL_TYPE define below to enable a type flag +// for afxModel objects. +//#define AFX_CAP_AFXMODEL_TYPE /// Types used for SceneObject type masks (SceneObject::mTypeMask) /// /// @note If a new object type is added, don't forget to add it to @@ -155,6 +159,9 @@ enum SceneObjectTypes /// @} InteriorLikeObjectType = BIT(24), TerrainLikeObjectType = BIT(25), +#if defined(AFX_CAP_AFXMODEL_TYPE) + afxModelObjectType = BIT(26) +#endif }; enum SceneObjectTypeMasks : U32 From c32c9557ab6f9ef64c9d96317cc7cba9e2086e7f Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:27:13 +0100 Subject: [PATCH 027/312] enhanced-projectile --- Engine/source/T3D/projectile.cpp | 13 ++++++++++--- Engine/source/T3D/projectile.h | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index eba9cb9d2..7e77385a2 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/projectile.h" @@ -621,6 +622,9 @@ Projectile::Projectile() mLightState.setLightInfo( mLight ); mDataBlock = 0; + ignoreSourceTimeout = false; + dynamicCollisionMask = csmDynamicCollisionMask; + staticCollisionMask = csmStaticCollisionMask; } Projectile::~Projectile() @@ -661,6 +665,7 @@ void Projectile::initPersistFields() addField("sourceSlot", TypeS32, Offset(mSourceObjectSlot, Projectile), "@brief The sourceObject's weapon slot that the projectile originates from.\n\n"); + addField("ignoreSourceTimeout", TypeBool, Offset(ignoreSourceTimeout, Projectile)); endGroup("Source"); @@ -1140,7 +1145,7 @@ void Projectile::simulate( F32 dt ) // disable the source objects collision reponse for a short time while we // determine if the projectile is capable of moving from the old position // to the new position, otherwise we'll hit ourself - bool disableSourceObjCollision = (mSourceObject.isValid() && mCurrTick <= SourceIdTimeoutTicks); + bool disableSourceObjCollision = (mSourceObject.isValid() && (ignoreSourceTimeout || mCurrTick <= SourceIdTimeoutTicks)); if ( disableSourceObjCollision ) mSourceObject->disableCollision(); disableCollision(); @@ -1157,12 +1162,12 @@ void Projectile::simulate( F32 dt ) if ( mPhysicsWorld ) hit = mPhysicsWorld->castRay( oldPosition, newPosition, &rInfo, Point3F( newPosition - oldPosition) * mDataBlock->impactForce ); else - hit = getContainer()->castRay(oldPosition, newPosition, csmDynamicCollisionMask | csmStaticCollisionMask, &rInfo); + hit = getContainer()->castRay(oldPosition, newPosition, dynamicCollisionMask | staticCollisionMask, &rInfo); if ( hit ) { // make sure the client knows to bounce - if ( isServerObject() && ( rInfo.object->getTypeMask() & csmStaticCollisionMask ) == 0 ) + if(isServerObject() && (rInfo.object->getTypeMask() & staticCollisionMask) == 0) setMaskBits( BounceMask ); MatrixF xform( true ); @@ -1353,6 +1358,7 @@ U32 Projectile::packUpdate( NetConnection *con, U32 mask, BitStream *stream ) stream->writeRangedU32( U32(mSourceObjectSlot), 0, ShapeBase::MaxMountedImages - 1 ); + stream->writeFlag(ignoreSourceTimeout); } else // have not recieved the ghost for the source object yet, try again later @@ -1396,6 +1402,7 @@ void Projectile::unpackUpdate(NetConnection* con, BitStream* stream) mSourceObjectId = stream->readRangedU32( 0, NetConnection::MaxGhostCount ); mSourceObjectSlot = stream->readRangedU32( 0, ShapeBase::MaxMountedImages - 1 ); + ignoreSourceTimeout = stream->readFlag(); NetObject* pObject = con->resolveGhost( mSourceObjectId ); if ( pObject != NULL ) mSourceObject = dynamic_cast( pObject ); diff --git a/Engine/source/T3D/projectile.h b/Engine/source/T3D/projectile.h index 72f2eac4f..f6c3870c1 100644 --- a/Engine/source/T3D/projectile.h +++ b/Engine/source/T3D/projectile.h @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _PROJECTILE_H_ #define _PROJECTILE_H_ @@ -286,6 +287,10 @@ protected: Point3F mExplosionPosition; Point3F mExplosionNormal; U32 mCollideHitType; +public: + bool ignoreSourceTimeout; + U32 dynamicCollisionMask; + U32 staticCollisionMask; }; #endif // _PROJECTILE_H_ From eeac02545a9efb587b9dbaa93f2230d4118b6bdb Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:34:44 +0100 Subject: [PATCH 028/312] triggers -- exposes trigger states to other code. --- Engine/source/T3D/player.cpp | 77 +++++++++++++++++++++++++++++- Engine/source/ts/tsShapeInstance.h | 7 +++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 41cf55c03..d5933900e 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -2076,6 +2076,32 @@ void Player::processTick(const Move* move) } Parent::processTick(move); + // Check for state changes in the standard move triggers and + // set bits for any triggers that switched on this tick in + // the fx_s_triggers mask. Flag any changes to be packed to + // clients. + if (isServerObject()) + { + fx_s_triggers = 0; + if (move) + { + U8 on_bits = 0; + for (S32 i = 0; i < MaxTriggerKeys; i++) + if (move->trigger[i]) + on_bits |= BIT(i); + + if (on_bits != move_trigger_states) + { + U8 switched_on_bits = (on_bits & ~move_trigger_states); + if (switched_on_bits) + { + fx_s_triggers |= (U32)switched_on_bits; + setMaskBits(TriggerMask); + } + move_trigger_states = on_bits; + } + } + } // Warp to catch up to server if (delta.warpTicks > 0) { delta.warpTicks--; @@ -2214,6 +2240,9 @@ void Player::advanceTime(F32 dt) { // Client side animations Parent::advanceTime(dt); + // Increment timer for triggering idle events. + if (idle_timer >= 0.0f) + idle_timer += dt; updateActionThread(); updateAnimation(dt); updateSplash(); @@ -3089,6 +3118,9 @@ void Player::updateMove(const Move* move) setActionThread( seq, true, false, true ); mJumpSurfaceLastContact = JumpSkipContactsMax; + // Flag the jump event trigger. + fx_s_triggers |= PLAYER_JUMP_S_TRIGGER; + setMaskBits(TriggerMask); } } else @@ -3783,6 +3815,11 @@ void Player::setActionThread(U32 action,bool forward,bool hold,bool wait,bool fs return; } + if (isClientObject()) + { + mark_idle = (action == PlayerData::RootAnim); + idle_timer = (mark_idle) ? 0.0f : -1.0f; + } PlayerData::ActionAnimation &anim = mDataBlock->actionList[action]; if (anim.sequence != -1) { @@ -3875,7 +3912,8 @@ void Player::updateActionThread() offset = mDataBlock->decalOffset * getScale().x; } - if( triggeredLeft || triggeredRight ) + process_client_triggers(triggeredLeft, triggeredRight); + if ((triggeredLeft || triggeredRight) && !noFootfallFX) { Point3F rot, pos; RayInfo rInfo; @@ -4906,6 +4944,11 @@ Point3F Player::_move( const F32 travelTime, Collision *outCol ) // we can use it to do impacts // and query collision. *outCol = *collision; + if (isServerObject() && bd > 6.8f && collision->normal.z > 0.7f) + { + fx_s_triggers |= PLAYER_LANDING_S_TRIGGER; + setMaskBits(TriggerMask); + } // Subtract out velocity VectorF dv = collision->normal * (bd + sNormalElasticity); @@ -7430,6 +7473,38 @@ ConsoleMethod(Player, isAnimationLocked, bool, 2, 2, "isAnimationLocked()") } +void Player::process_client_triggers(bool triggeredLeft, bool triggeredRight) +{ + bool mark_landing = false; + Point3F my_vel = getVelocity(); + if (my_vel.z > 5.0f) + z_velocity = 1; + else if (my_vel.z < -5.0f) + z_velocity = -1; + else + { + if (z_velocity < 0) + mark_landing = true; + z_velocity = 0.0f; + } + + fx_c_triggers = mark_fx_c_triggers; + if (triggeredLeft) + fx_c_triggers |= PLAYER_LF_FOOT_C_TRIGGER; + if (triggeredRight) + fx_c_triggers |= PLAYER_RT_FOOT_C_TRIGGER; + if (mark_landing) + fx_c_triggers |= PLAYER_LANDING_C_TRIGGER; + if (idle_timer > 10.0f) + { + fx_c_triggers |= PLAYER_IDLE_C_TRIGGER; + idle_timer = 0.0f; + } + if (fx_c_triggers & PLAYER_LANDING_S_TRIGGER) + { + fx_c_triggers &= ~(PLAYER_LANDING_S_TRIGGER); + } +} #ifdef TORQUE_OPENVR void Player::setControllers(Vector controllerList) { diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index 48b253358..d29a2a420 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -20,6 +20,11 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #ifndef _TSSHAPEINSTANCE_H_ #define _TSSHAPEINSTANCE_H_ @@ -690,6 +695,8 @@ protected: //------------------------------------------------------------------------------------- bool hasAccumulation(); + // provides access to full mTriggerStates mask. + U32 getTriggerStateMask() const { return mTriggerStates; } }; From 2a96c946b77cb2e57663eda188a70c30bcfdcc4a Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:40:12 +0100 Subject: [PATCH 029/312] triggers -- --- Engine/source/T3D/player.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index ec9bf3569..40ab357c9 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -804,6 +804,39 @@ public: virtual U32 lockAnimation(); virtual bool isAnimationLocked() const { return ((anim_clip_flags & BLOCK_USER_CONTROL) != 0); } +private: + U8 move_trigger_states; + U32 fx_s_triggers; + U32 mark_fx_c_triggers; + U32 fx_c_triggers; + F32 z_velocity; + bool mark_idle; + F32 idle_timer; + bool mark_s_landing; + void process_client_triggers(bool triggeredLeft, bool triggeredRight); +public: + enum { + // server events + PLAYER_MOVE_TRIGGER_0 = BIT(0), + PLAYER_MOVE_TRIGGER_1 = BIT(1), + PLAYER_MOVE_TRIGGER_2 = BIT(2), + PLAYER_MOVE_TRIGGER_3 = BIT(3), + PLAYER_MOVE_TRIGGER_4 = BIT(4), + PLAYER_MOVE_TRIGGER_5 = BIT(5), + PLAYER_LANDING_S_TRIGGER = BIT(6), + + PLAYER_FIRE_S_TRIGGER = PLAYER_MOVE_TRIGGER_0, + PLAYER_FIRE_ALT_S_TRIGGER = PLAYER_MOVE_TRIGGER_1, + PLAYER_JUMP_S_TRIGGER = BIT(7), + + // client events + PLAYER_LF_FOOT_C_TRIGGER = BIT(16), + PLAYER_RT_FOOT_C_TRIGGER = BIT(17), + PLAYER_LANDING_C_TRIGGER = BIT(18), + PLAYER_IDLE_C_TRIGGER = BIT(19), + }; + U32 getClientEventTriggers() const { return fx_c_triggers; } + U32 getServerEventTriggers() const { return fx_s_triggers; } }; typedef Player::Pose PlayerPose; From 8aaed004f1cd8301b5587c73502c6799beac5de2 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:41:40 +0100 Subject: [PATCH 030/312] Collision events --- Engine/source/T3D/shapeBase.cpp | 26 ++++++++++++++++++++++++++ Engine/source/T3D/shapeBase.h | 12 ++++++++++++ 2 files changed, 38 insertions(+) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 53f4509ed..5f71a7eb9 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -24,6 +24,7 @@ // Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames // Copyright (C) 2015 Faust Logic, Inc. //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + #include "platform/platform.h" #include "T3D/shapeBase.h" @@ -3722,6 +3723,31 @@ void ShapeBase::setCurrentWaterObject( WaterObject *obj ) mCurrentWaterObject = obj; } +void ShapeBase::notifyCollisionCallbacks(SceneObject* obj, const VectorF& vel) +{ + for (S32 i = 0; i < collision_callbacks.size(); i++) + if (collision_callbacks[i]) + collision_callbacks[i]->collisionNotify(this, obj, vel); +} + +void ShapeBase::registerCollisionCallback(CollisionEventCallback* ce_cb) +{ + for (S32 i = 0; i < collision_callbacks.size(); i++) + if (collision_callbacks[i] == ce_cb) + return; + + collision_callbacks.push_back(ce_cb); +} + +void ShapeBase::unregisterCollisionCallback(CollisionEventCallback* ce_cb) +{ + for (S32 i = 0; i < collision_callbacks.size(); i++) + if (collision_callbacks[i] == ce_cb) + { + collision_callbacks.erase(i); + return; + } +} //-------------------------------------------------------------------------- //---------------------------------------------------------------------------- DefineEngineMethod( ShapeBase, setHidden, void, ( bool show ),, diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 9276cfb98..067ef7cbf 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -1860,6 +1860,18 @@ public: protected: DECLARE_CALLBACK( F32, validateCameraFov, (F32 fov) ); +public: + class CollisionEventCallback + { + public: + virtual void collisionNotify(SceneObject* shape0, SceneObject* shape1, const VectorF& vel)=0; + }; +private: + Vector collision_callbacks; + void notifyCollisionCallbacks(SceneObject*, const VectorF& vel); +public: + void registerCollisionCallback(CollisionEventCallback*); + void unregisterCollisionCallback(CollisionEventCallback*); protected: enum { From 25b780ccaf9b76b207366c95dcd32ff74ae594f0 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:48:16 +0100 Subject: [PATCH 031/312] player-look -- modified player head and arm control player-movement -- mods allowing manipulation of player movement. player-puppet -- mods allowing manipulation of player via contraints. foot-switch -- mods for overriding built-in footstep sounds, decals, and dust. --- Engine/source/T3D/player.cpp | 146 +++++++++++++++++++++++++++++++++-- Engine/source/T3D/player.h | 34 +++++++- 2 files changed, 171 insertions(+), 9 deletions(-) diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index d5933900e..15b57046a 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -2117,7 +2117,10 @@ void Player::processTick(const Move* move) else if (delta.rot.z > M_PI_F) delta.rot.z -= M_2PI_F; - setPosition(delta.pos,delta.rot); + if (!ignore_updates) + { + setPosition(delta.pos,delta.rot); + } updateDeathOffsets(); updateLookAnimation(); @@ -2215,7 +2218,8 @@ void Player::interpolateTick(F32 dt) Point3F pos = delta.pos + delta.posVec * dt; Point3F rot = delta.rot + delta.rotVec * dt; - setRenderPosition(pos,rot,dt); + if (!ignore_updates) + setRenderPosition(pos,rot,dt); /* // apply camera effects - is this the best place? - bramage @@ -2533,6 +2537,30 @@ AngAxisF gPlayerMoveRot; void Player::updateMove(const Move* move) { + struct Move my_move; + if (override_movement && movement_op < 3) + { + my_move = *move; + switch (movement_op) + { + case 0: // add + my_move.x += movement_data.x; + my_move.y += movement_data.y; + my_move.z += movement_data.z; + break; + case 1: // mult + my_move.x *= movement_data.x; + my_move.y *= movement_data.y; + my_move.z *= movement_data.z; + break; + case 2: // replace + my_move.x = movement_data.x; + my_move.y = movement_data.y; + my_move.z = movement_data.z; + break; + } + move = &my_move; + } delta.move = *move; #ifdef TORQUE_OPENVR @@ -2839,6 +2867,9 @@ void Player::updateMove(const Move* move) moveSpeed = 0.0f; } + // apply speed bias here. + speed_bias = speed_bias + (speed_bias_goal - speed_bias)*0.1f; + moveSpeed *= speed_bias; // Acceleration due to gravity VectorF acc(0.0f, 0.0f, mGravity * mGravityMod * TickSec); @@ -3538,6 +3569,19 @@ void Player::updateDamageState() void Player::updateLookAnimation(F32 dt) { + // If the preference setting overrideLookAnimation is true, the player's + // arm and head no longer animate according to the view direction. They + // are instead given fixed positions. + if (overrideLookAnimation) + { + if (mArmAnimation.thread) + mShapeInstance->setPos(mArmAnimation.thread, armLookOverridePos); + if (mHeadVThread) + mShapeInstance->setPos(mHeadVThread, headVLookOverridePos); + if (mHeadHThread) + mShapeInstance->setPos(mHeadHThread, headHLookOverridePos); + return; + } // Calculate our interpolated head position. Point3F renderHead = delta.head + delta.headVec * dt; @@ -3930,7 +3974,7 @@ void Player::updateActionThread() // Put footprints on surface, if appropriate for material. if( material && material->mShowFootprints - && mDataBlock->decalData ) + && mDataBlock->decalData && !footfallDecalOverride ) { Point3F normal; Point3F tangent; @@ -3941,8 +3985,8 @@ void Player::updateActionThread() // Emit footpuffs. - if( rInfo.t <= 0.5 && mWaterCoverage == 0.0 - && material && material->mShowDust ) + if (!footfallDustOverride && rInfo.t <= 0.5f && mWaterCoverage == 0.0f + && material && material->mShowDust ) { // New emitter every time for visibility reasons ParticleEmitter * emitter = new ParticleEmitter; @@ -3975,6 +4019,7 @@ void Player::updateActionThread() // Play footstep sound. + if (footfallSoundOverride <= 0) playFootstepSound( triggeredLeft, material, rInfo.object ); } } @@ -6222,7 +6267,8 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream) stream->read(&mHead.z); stream->read(&rot.z); rot.x = rot.y = 0; - setPosition(pos,rot); + if (!ignore_updates) + setPosition(pos,rot); delta.head = mHead; delta.rot = rot; @@ -6469,7 +6515,8 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) } delta.pos = pos; delta.rot = rot; - setPosition(pos,rot); + if (!ignore_updates) + setPosition(pos,rot); } } else @@ -6481,7 +6528,8 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) delta.rotVec.set(0.0f, 0.0f, 0.0f); delta.warpTicks = 0; delta.dt = 0.0f; - setPosition(pos,rot); + if (!ignore_updates) + setPosition(pos,rot); } } F32 energy = stream->readFloat(EnergyLevelBits) * mDataBlock->maxEnergy; @@ -6942,6 +6990,8 @@ void Player::calcClassRenderData() void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, SceneObject* contactObject ) { + if (footfallSoundOverride > 0) + return; MatrixF footMat = getTransform(); if( mWaterCoverage > 0.0 ) { @@ -7473,6 +7523,27 @@ ConsoleMethod(Player, isAnimationLocked, bool, 2, 2, "isAnimationLocked()") } +void Player::setLookAnimationOverride(bool flag) +{ + overrideLookAnimation = flag; +#if 0 + setMaskBits(LookOverrideMask); +#else + setMaskBits(ActionMask); +#endif +} + +ConsoleMethod(Player, setLookAnimationOverride, void, 3, 3, "setLookAnimationOverride(flag)") +{ + object->setLookAnimationOverride(dAtob(argv[2])); +} + +ConsoleMethod(Player, copyHeadRotation, void, 3, 3, "copyHeadRotation(other_player)") +{ + Player* other_player = dynamic_cast(Sim::findObject(argv[2])); + if (other_player) + object->copyHeadRotation(other_player); +} void Player::process_client_triggers(bool triggeredLeft, bool triggeredRight) { bool mark_landing = false; @@ -7505,6 +7576,65 @@ void Player::process_client_triggers(bool triggeredLeft, bool triggeredRight) fx_c_triggers &= ~(PLAYER_LANDING_S_TRIGGER); } } +U32 Player::unique_movement_tag_counter = 1; + +void Player::setMovementSpeedBias(F32 bias) +{ + speed_bias_goal = bias; +} + +U32 Player::setMovementOverride(F32 bias, const Point3F* mov, U32 op) +{ + if (mov) + { + movement_data = *mov; + override_movement = true; + movement_op = (U8)op; + } + else + override_movement = false; + + speed_bias_goal = bias; + + last_movement_tag = unique_movement_tag_counter++; + return last_movement_tag; +} + +void Player::restoreMovement(U32 tag) +{ + if (tag != 0 && tag == last_movement_tag) + { + speed_bias_goal = 1.0; + override_movement = false; + } +} + +ConsoleMethod(Player, setMovementSpeedBias, void, 3, 3, "setMovementSpeedBias(F32 bias)") +{ + object->setMovementSpeedBias(dAtof(argv[2])); +} + +void Player::overrideFootfallFX(bool decals, bool sounds, bool dust) +{ + if (decals) + footfallDecalOverride++; + if (sounds) + footfallSoundOverride++; + if (dust) + footfallDustOverride++; + noFootfallFX = (footfallDecalOverride > 0 && footfallSoundOverride > 0 && footfallDustOverride > 0); +} + +void Player::restoreFootfallFX(bool decals, bool sounds, bool dust) +{ + if (decals && footfallDecalOverride) + footfallDecalOverride--; + if (sounds && footfallSoundOverride) + footfallSoundOverride--; + if (dust && footfallDustOverride) + footfallDustOverride--; + noFootfallFX = (footfallDecalOverride > 0 && footfallSoundOverride > 0 && footfallDustOverride > 0); +} #ifdef TORQUE_OPENVR void Player::setControllers(Vector controllerList) { diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index 40ab357c9..0b4545114 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -406,7 +406,8 @@ protected: ActionMask = Parent::NextFreeMask << 0, MoveMask = Parent::NextFreeMask << 1, ImpactMask = Parent::NextFreeMask << 2, - NextFreeMask = Parent::NextFreeMask << 3 + TriggerMask = Parent::NextFreeMask << 3, + NextFreeMask = Parent::NextFreeMask << 4 }; SimObjectPtr mSplashEmitter[PlayerData::NUM_SPLASH_EMITTERS]; @@ -804,6 +805,17 @@ public: virtual U32 lockAnimation(); virtual bool isAnimationLocked() const { return ((anim_clip_flags & BLOCK_USER_CONTROL) != 0); } +protected: + bool overrideLookAnimation; + F32 armLookOverridePos; + F32 headVLookOverridePos; + F32 headHLookOverridePos; +public: + void setLookAnimationOverride(bool flag); + void copyHeadRotation(const Player* p) { mHead = p->mHead; } +public: + bool ignore_updates; + void resetContactTimer() { mContactTimer = 0; } private: U8 move_trigger_states; U32 fx_s_triggers; @@ -837,6 +849,26 @@ public: }; U32 getClientEventTriggers() const { return fx_c_triggers; } U32 getServerEventTriggers() const { return fx_s_triggers; } +private: + F32 speed_bias; + F32 speed_bias_goal; + bool override_movement; + Point3F movement_data; + U8 movement_op; + U32 last_movement_tag; + static U32 unique_movement_tag_counter; +public: + void setMovementSpeedBias(F32 bias); + U32 setMovementOverride(F32 bias, const Point3F* mov=0, U32 op=1); + void restoreMovement(U32 tag); +private: + S32 footfallDecalOverride; + S32 footfallSoundOverride; + S32 footfallDustOverride; + bool noFootfallFX; +public: + void overrideFootfallFX(bool decals=true, bool sounds=true, bool dust=true); + void restoreFootfallFX(bool decals=true, bool sounds=true, bool dust=true); }; typedef Player::Pose PlayerPose; From 51df59092d69d66b1439340172f3c2fe9b7cbfa9 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:50:52 +0100 Subject: [PATCH 032/312] Assorted bug fixes --- Engine/source/T3D/physicalZone.cpp | 4 +--- Engine/source/T3D/turret/aiTurretShape.h | 20 +++++++++++++++++++ .../windowManager/mac/macCursorController.mm | 5 +++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index b9301d0da..f8454be5b 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -325,9 +325,7 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream) stream->writeFlag(mActive); - // AFX CODE BLOCK (enhanced-physical-zone)(pz-opt) >> - - return retMask; + return retMask; } void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream) diff --git a/Engine/source/T3D/turret/aiTurretShape.h b/Engine/source/T3D/turret/aiTurretShape.h index 4aa13ba44..138389691 100644 --- a/Engine/source/T3D/turret/aiTurretShape.h +++ b/Engine/source/T3D/turret/aiTurretShape.h @@ -151,16 +151,36 @@ public: //---------------------------------------------------------------------------- +// As shipped, AITurretShape plus the chain of classes it inherits from, consumes +// all 32 mask-bits. AFX uses one additional mask-bit in GameBase, which pushes +// AITurretShape over the mask-bit limit which will cause runtime crashes. As +// a workaround, AFX modifies AITurretShape so that it reuses the TurretUpdateMask +// defined by TurretShape rather than adding a unique TurretStateMask. This will +// make AITurretShape's network updates slightly less efficient, but should be +// acceptable for most uses of AITurretShape. If you plan to populate your levels +// with many AITurretShape objects, consider restoring it to use of a unique +// bit-mask, but if you do that, you will have to eliminate at use of at least one +// bit by one of it's parent classes. (FYI ShapeBase uses 20 bits.) +// +// Comment out this define if you want AITurretShape to define it's own bit-mask. +#define AFX_REUSE_TURRETSHAPE_MASKBITS class AITurretShape: public TurretShape { typedef TurretShape Parent; protected: +#ifdef AFX_REUSE_TURRETSHAPE_MASKBITS + enum MaskBits { + TurretStateMask = Parent::TurretUpdateMask, + NextFreeMask = Parent::NextFreeMask + }; +#else // ORIGINAL CODE enum MaskBits { TurretStateMask = Parent::NextFreeMask, NextFreeMask = Parent::NextFreeMask << 1 }; +#endif struct TargetInfo { diff --git a/Engine/source/windowManager/mac/macCursorController.mm b/Engine/source/windowManager/mac/macCursorController.mm index 9e92c0f33..14754191b 100644 --- a/Engine/source/windowManager/mac/macCursorController.mm +++ b/Engine/source/windowManager/mac/macCursorController.mm @@ -127,6 +127,11 @@ void MacCursorController::setCursorShape(U32 cursorID) case PlatformCursorController::curResizeHorz: [[NSCursor resizeUpDownCursor] set]; break; + // This sets an appropriate value for the standard hand cursor. + // In AFX this is used for rollover feedback. + case PlatformCursorController::curHand: + [[NSCursor pointingHandCursor] set]; + break; } } From 1a17496c28622190f58e701b3cc9d828a7e8d510 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Thu, 27 Jul 2017 01:51:54 +0100 Subject: [PATCH 033/312] Cmake file to build AFX --- Tools/CMake/modules/module_afx.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Tools/CMake/modules/module_afx.cmake diff --git a/Tools/CMake/modules/module_afx.cmake b/Tools/CMake/modules/module_afx.cmake new file mode 100644 index 000000000..177af6e6d --- /dev/null +++ b/Tools/CMake/modules/module_afx.cmake @@ -0,0 +1,27 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) 2014 GarageGames, LLC +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# ----------------------------------------------------------------------------- + +option(TORQUE_AFX "Enable AFX module" ON) +if(TORQUE_AFX) +# files +addPathRec( "${srcDir}/afx" ) +endif() \ No newline at end of file From bc898e115007f43e2286d4c3678e3daa45b51709 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 21 Sep 2017 00:10:44 -0500 Subject: [PATCH 034/312] Initial implementation of the EditorTool class and world editor hook-in. --- .../gui/worldEditor/tools/editorTool.cpp | 136 ++++++++++++++++++ .../source/gui/worldEditor/tools/editorTool.h | 88 ++++++++++++ Engine/source/gui/worldEditor/worldEditor.cpp | 47 ++++++ Engine/source/gui/worldEditor/worldEditor.h | 8 +- Tools/CMake/torque3d.cmake | 1 + 5 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 Engine/source/gui/worldEditor/tools/editorTool.cpp create mode 100644 Engine/source/gui/worldEditor/tools/editorTool.h diff --git a/Engine/source/gui/worldEditor/tools/editorTool.cpp b/Engine/source/gui/worldEditor/tools/editorTool.cpp new file mode 100644 index 000000000..1af6c5421 --- /dev/null +++ b/Engine/source/gui/worldEditor/tools/editorTool.cpp @@ -0,0 +1,136 @@ +#include "editorTool.h" + +IMPLEMENT_CONOBJECT(EditorTool); + +EditorTool::EditorTool() +{ + mWorldEditor = NULL; + + mUseMouseDown = true; + mUseMouseUp = true; + mUseMouseMove = true; + + mUseRightMouseDown = false; + mUseRightMouseUp = false; + mUseRightMouseMove = false; + + mUseMiddleMouseDown = true; + mUseMiddleMouseUp = true; + mUseMiddleMouseMove = true; + + mUseKeyInput = true; +} + +bool EditorTool::onAdd() +{ + return Parent::onAdd(); +} + +void EditorTool::onRemove() +{ + Parent::onRemove(); +} + +//Called when the tool is activated on the World Editor +void EditorTool::onActivated(WorldEditor* editor) +{ + mWorldEditor = editor; + Con::executef(this, "onActivated"); +} + +//Called when the tool is deactivated on the World Editor +void EditorTool::onDeactivated() +{ + mWorldEditor = NULL; + Con::executef(this, "onDeactivated"); +} + +// +bool EditorTool::onMouseMove(const Gui3DMouseEvent &e) +{ + if (!mUseMouseDown) + return false; + + Con::executef(this, "onMouseMove", e.mousePoint); + return true; +} +bool EditorTool::onMouseDown(const Gui3DMouseEvent &e) +{ + if (!mUseMouseDown) + return false; + + Con::executef(this, "onMouseDown", e.mousePoint); + return true; +} +bool EditorTool::onMouseDragged(const Gui3DMouseEvent &e) +{ + Con::executef(this, "onMouseDragged", e.mousePoint); + return true; +} +bool EditorTool::onMouseUp(const Gui3DMouseEvent &e) +{ + if (!mUseMouseDown) + return false; + + Con::executef(this, "onMouseUp", e.mousePoint); + return true; +} + +// +bool EditorTool::onRightMouseDown(const Gui3DMouseEvent &e) +{ + if (!mUseRightMouseDown) + return false; + + Con::executef(this, "onRightMouseDown", e.mousePoint); + return true; +} +bool EditorTool::onRightMouseDragged(const Gui3DMouseEvent &e) +{ + Con::executef(this, "onRightMouseDragged", e.mousePoint); + return true; +} +bool EditorTool::onRightMouseUp(const Gui3DMouseEvent &e) +{ + if (!mUseRightMouseDown) + return false; + + Con::executef(this, "onRightMouseUp", e.mousePoint); + return true; +} + +// +bool EditorTool::onMiddleMouseDown(const Gui3DMouseEvent &e) +{ + if (!mUseMiddleMouseDown) + return false; + + Con::executef(this, "onMiddleMouseDown", e.mousePoint); + return true; +} +bool EditorTool::onMiddleMouseDragged(const Gui3DMouseEvent &e) +{ + Con::executef(this, "onMiddleMouseDragged", e.mousePoint); + return true; +} +bool EditorTool::onMiddleMouseUp(const Gui3DMouseEvent &e) +{ + if (!mUseMiddleMouseDown) + return false; + + Con::executef(this, "onMiddleMouseUp", e.mousePoint); + return true; +} + +// +bool EditorTool::onInputEvent(const InputEventInfo &e) +{ + if (!mUseKeyInput) + return false; + + Con::executef(this, "onKeyPress", e.ascii, e.modifier); + return true; +} + +// +void render(SceneRenderState *); \ No newline at end of file diff --git a/Engine/source/gui/worldEditor/tools/editorTool.h b/Engine/source/gui/worldEditor/tools/editorTool.h new file mode 100644 index 000000000..4b872fe6b --- /dev/null +++ b/Engine/source/gui/worldEditor/tools/editorTool.h @@ -0,0 +1,88 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _EDITOR_TOOL_ +#define _EDITOR_TOOL_ + +#ifndef _WORLDEDITOR_H_ +#include "gui/worldEditor/worldEditor.h" +#endif + +class EditorTool : public SimObject +{ + typedef SimObject Parent; + +protected: + WorldEditor* mWorldEditor; + bool mUseMouseDown; + bool mUseMouseUp; + bool mUseMouseMove; + + bool mUseRightMouseDown; + bool mUseRightMouseUp; + bool mUseRightMouseMove; + + bool mUseMiddleMouseDown; + bool mUseMiddleMouseUp; + bool mUseMiddleMouseMove; + + bool mUseKeyInput; + +public: + EditorTool(); + ~EditorTool(){} + + DECLARE_CONOBJECT(EditorTool); + + bool onAdd(); + void onRemove(); + + //Called when the tool is activated on the World Editor + virtual void onActivated(WorldEditor*); + + //Called when the tool is deactivated on the World Editor + virtual void onDeactivated(); + + // + virtual bool onMouseMove(const Gui3DMouseEvent &); + virtual bool onMouseDown(const Gui3DMouseEvent &); + virtual bool onMouseDragged(const Gui3DMouseEvent &); + virtual bool onMouseUp(const Gui3DMouseEvent &); + + // + virtual bool onRightMouseDown(const Gui3DMouseEvent &); + virtual bool onRightMouseDragged(const Gui3DMouseEvent &); + virtual bool onRightMouseUp(const Gui3DMouseEvent &); + + // + virtual bool onMiddleMouseDown(const Gui3DMouseEvent &); + virtual bool onMiddleMouseDragged(const Gui3DMouseEvent &); + virtual bool onMiddleMouseUp(const Gui3DMouseEvent &); + + // + virtual bool onInputEvent(const InputEventInfo &); + + // + virtual void render(){} +}; + +#endif \ No newline at end of file diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index d4c4c55ab..7846ec094 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -49,6 +49,7 @@ #include "math/mEase.h" #include "T3D/tsStatic.h" +#include "tools/editorTool.h" IMPLEMENT_CONOBJECT( WorldEditor ); @@ -1823,6 +1824,8 @@ WorldEditor::WorldEditor() mUseGroupCenter = true; mFadeIcons = true; mFadeIconsDist = 8.f; + + mActiveEditorTool = nullptr; } WorldEditor::~WorldEditor() @@ -1915,6 +1918,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event) setCursor(PlatformCursorController::curArrow); mHitObject = NULL; + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseMove(event)) + return; + // mUsingAxisGizmo = false; @@ -1943,6 +1950,10 @@ void WorldEditor::on3DMouseMove(const Gui3DMouseEvent & event) void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event) { + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDown(event)) + return; + mMouseDown = true; mMouseDragged = false; mPerformedDragCopy = false; @@ -2010,6 +2021,10 @@ void WorldEditor::on3DMouseDown(const Gui3DMouseEvent & event) void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event ) { + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseUp(event)) + return; + const bool wasUsingAxisGizmo = mUsingAxisGizmo; mMouseDown = false; @@ -2165,6 +2180,10 @@ void WorldEditor::on3DMouseUp( const Gui3DMouseEvent &event ) void WorldEditor::on3DMouseDragged(const Gui3DMouseEvent & event) { + //If we have an active tool and it's intercepted our input, bail out + if (mActiveEditorTool != nullptr && mActiveEditorTool->onMouseDragged(event)) + return; + if ( !mMouseDown ) return; @@ -2400,6 +2419,9 @@ void WorldEditor::renderScene( const RectI &updateRect ) GFXDEBUGEVENT_SCOPE( Editor_renderScene, ColorI::RED ); smRenderSceneSignal.trigger(this); + + if (mActiveEditorTool != nullptr) + mActiveEditorTool->render(); // Grab this before anything here changes it. Frustum frustum; @@ -3190,6 +3212,19 @@ void WorldEditor::resetSelectedScale() //------------------------------------------------------------------------------ +void WorldEditor::setEditorTool(EditorTool* newTool) +{ + if (mActiveEditorTool) + mActiveEditorTool->onDeactivated(); + + mActiveEditorTool = newTool; + + if (mActiveEditorTool) + mActiveEditorTool->onActivated(this); +} + +//------------------------------------------------------------------------------ + ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)") { object->ignoreObjClass(argc, argv); @@ -4175,3 +4210,15 @@ DefineEngineMethod( WorldEditor, createConvexShapeFrom, ConvexShape*, ( SceneObj return shape; } + +DefineEngineMethod(WorldEditor, setEditorTool, void, (EditorTool* newEditorTool), (nullAsType()), + "Sets the active Editor Tool for the world editor.") +{ + object->setEditorTool(newEditorTool); +} + +DefineEngineMethod(WorldEditor, getActiveEditorTool, EditorTool*, (),, + "Gets the active Editor Tool for the world editor.") +{ + return object->getActiveEditorTool(); +} diff --git a/Engine/source/gui/worldEditor/worldEditor.h b/Engine/source/gui/worldEditor/worldEditor.h index fb125daf5..5bdd8f0f2 100644 --- a/Engine/source/gui/worldEditor/worldEditor.h +++ b/Engine/source/gui/worldEditor/worldEditor.h @@ -58,7 +58,7 @@ class SceneObject; class WorldEditorSelection; - +class EditorTool; /// class WorldEditor : public EditTSCtrl @@ -285,6 +285,9 @@ class WorldEditor : public EditTSCtrl ClassInfo::Entry * getClassEntry(const SimObject * obj); bool addClassEntry(ClassInfo::Entry * entry); + + EditorTool* mActiveEditorTool; + // persist field data public: @@ -411,6 +414,9 @@ class WorldEditor : public EditTSCtrl DECLARE_CONOBJECT(WorldEditor); static Signal smRenderSceneSignal; + + void setEditorTool(EditorTool*); + EditorTool* getActiveEditorTool() { return mActiveEditorTool; } }; typedef WorldEditor::DropType WorldEditorDropType; diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 1850e4751..63209ae97 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -418,6 +418,7 @@ endif() # Include tools for non-tool builds (or define player if a tool build) if(TORQUE_TOOLS) addPath("${srcDir}/gui/worldEditor") + addPath("${srcDir}/gui/worldEditor/tools") addPath("${srcDir}/environment/editors") addPath("${srcDir}/forest/editor") addPath("${srcDir}/gui/editor") From 9b83e47302974f195e202a8a1ac9ddbb1798fc66 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 23 Sep 2017 12:37:55 -0500 Subject: [PATCH 035/312] Adds some filtering options to the console log gui so you can specify if you wish to be able to see errors, warnings and regular messages. It also denotes how many errors and warnings are currently in the log. --- Engine/source/gui/controls/guiConsole.cpp | 190 +++++++++++--- Engine/source/gui/controls/guiConsole.h | 27 ++ .../BaseGame/game/core/console/console.gui | 206 +++++++++++++--- Templates/BaseGame/game/core/console/main.cs | 30 +++ Templates/Full/game/core/art/gui/console.gui | 232 +++++++++++++++--- 5 files changed, 580 insertions(+), 105 deletions(-) diff --git a/Engine/source/gui/controls/guiConsole.cpp b/Engine/source/gui/controls/guiConsole.cpp index 0a1e2459d..19cdf6b3d 100644 --- a/Engine/source/gui/controls/guiConsole.cpp +++ b/Engine/source/gui/controls/guiConsole.cpp @@ -50,6 +50,12 @@ IMPLEMENT_CALLBACK( GuiConsole, onMessageSelected, void, ( ConsoleLogEntry::Leve "@param level Diagnostic level of the message.\n" "@param message Message text.\n" ); +IMPLEMENT_CALLBACK(GuiConsole, onNewMessage, void, (U32 errorCount, U32 warnCount, U32 normalCount), (errorCount, warnCount, normalCount), + "Called when a new message is logged.\n\n" + "@param errorCount The number of error messages logged.\n" + "@param warnCount The number of warning messages logged.\n" + "@param normalCount The number of normal messages logged.\n"); + //----------------------------------------------------------------------------- @@ -58,6 +64,10 @@ GuiConsole::GuiConsole() setExtent(64, 64); mCellSize.set(1, 1); mSize.set(1, 0); + + mDisplayErrors = true; + mDisplayWarnings = true; + mDisplayNormalMessages = true; } //----------------------------------------------------------------------------- @@ -81,56 +91,98 @@ S32 GuiConsole::getMaxWidth(S32 startIndex, S32 endIndex) U32 size; ConsoleLogEntry *log; - Con::getLockLog(log, size); - - if(startIndex < 0 || (U32)endIndex >= size || startIndex > endIndex) + if (startIndex < 0 || (U32)endIndex >= mFilteredLog.size() || startIndex > endIndex) return 0; S32 result = 0; for(S32 i = startIndex; i <= endIndex; i++) - result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)log[i].mString))); - - Con::unlockLog(); + result = getMax(result, (S32)(mFont->getStrWidth((const UTF8 *)mFilteredLog[i].mString))); return(result + 6); } +void GuiConsole::refreshLogText() +{ + U32 size; + ConsoleLogEntry *log; + + Con::getLockLog(log, size); + + if (mFilteredLog.size() != size) + { + mFilteredLog.clear(); + + U32 errorCount = 0; + U32 warnCount = 0; + U32 normalCount = 0; + + //Filter the log if needed + for (U32 i = 0; i < size; ++i) + { + ConsoleLogEntry &entry = log[i]; + + if (entry.mLevel == ConsoleLogEntry::Error) + { + errorCount++; + if (mDisplayErrors) + { + mFilteredLog.push_back(entry); + } + } + else if (entry.mLevel == ConsoleLogEntry::Warning) + { + warnCount++; + if (mDisplayWarnings) + { + mFilteredLog.push_back(entry); + } + } + else if (entry.mLevel == ConsoleLogEntry::Normal) + { + normalCount++; + if (mDisplayNormalMessages) + { + mFilteredLog.push_back(entry); + } + } + } + + onNewMessage_callback(errorCount, warnCount, normalCount); + } + + Con::unlockLog(); +} + //----------------------------------------------------------------------------- void GuiConsole::onPreRender() { //see if the size has changed U32 prevSize = getHeight() / mCellSize.y; - U32 size; - ConsoleLogEntry *log; - Con::getLockLog(log, size); - Con::unlockLog(); // we unlock immediately because we only use size here, not log. + refreshLogText(); - if(size != prevSize) - { - //first, find out if the console was scrolled up - bool scrolled = false; - GuiScrollCtrl *parent = dynamic_cast(getParent()); + //first, find out if the console was scrolled up + bool scrolled = false; + GuiScrollCtrl *parent = dynamic_cast(getParent()); - if(parent) - scrolled = parent->isScrolledToBottom(); + if(parent) + scrolled = parent->isScrolledToBottom(); - //find the max cell width for the new entries - S32 newMax = getMaxWidth(prevSize, size - 1); - if(newMax > mCellSize.x) - mCellSize.set(newMax, mFont->getHeight()); + //find the max cell width for the new entries + S32 newMax = getMaxWidth(prevSize, mFilteredLog.size() - 1); + if(newMax > mCellSize.x) + mCellSize.set(newMax, mFont->getHeight()); - //set the array size - mSize.set(1, size); + //set the array size + mSize.set(1, mFilteredLog.size()); - //resize the control - setExtent( Point2I(mCellSize.x, mCellSize.y * size)); + //resize the control + setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size())); - //if the console was not scrolled, make the last entry visible - if (scrolled) - scrollCellVisible(Point2I(0,mSize.y - 1)); - } + //if the console was not scrolled, make the last entry visible + if (scrolled) + scrollCellVisible(Point2I(0,mSize.y - 1)); } //----------------------------------------------------------------------------- @@ -139,10 +191,8 @@ void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool /*selected*/, b { U32 size; ConsoleLogEntry *log; - - Con::getLockLog(log, size); - - ConsoleLogEntry &entry = log[cell.y]; + + ConsoleLogEntry &entry = mFilteredLog[cell.y]; switch (entry.mLevel) { case ConsoleLogEntry::Normal: GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor); break; @@ -151,8 +201,6 @@ void GuiConsole::onRenderCell(Point2I offset, Point2I cell, bool /*selected*/, b default: AssertFatal(false, "GuiConsole::onRenderCell - Unrecognized ConsoleLogEntry type, update this."); } GFX->getDrawUtil()->drawText(mFont, Point2I(offset.x + 3, offset.y), entry.mString, mProfile->mFontColors); - - Con::unlockLog(); } //----------------------------------------------------------------------------- @@ -164,10 +212,72 @@ void GuiConsole::onCellSelected( Point2I cell ) U32 size; ConsoleLogEntry* log; - Con::getLockLog(log, size); - - ConsoleLogEntry& entry = log[ cell.y ]; + ConsoleLogEntry& entry = mFilteredLog[cell.y]; onMessageSelected_callback( entry.mLevel, entry.mString ); - - Con::unlockLog(); } + +void GuiConsole::setDisplayFilters(bool errors, bool warns, bool normal) +{ + mDisplayErrors = errors; + mDisplayWarnings = warns; + mDisplayNormalMessages = normal; + + refreshLogText(); + + //find the max cell width for the new entries + S32 newMax = getMaxWidth(0, mFilteredLog.size() - 1); + mCellSize.set(newMax, mFont->getHeight()); + + //set the array size + mSize.set(1, mFilteredLog.size()); + + //resize the control + setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size())); + + scrollCellVisible(Point2I(0, mSize.y - 1)); +} + +DefineEngineMethod(GuiConsole, setDisplayFilters, void, (bool errors, bool warns, bool normal), (true, true, true), + "Sets the current display filters for the console gui. Allows you to indicate if it should display errors, warns and/or normal messages.\n\n" + "@param errors If true, the console gui will display any error messages that were emitted.\n\n" + "@param warns If true, the console gui will display any warning messages that were emitted.\n\n" + "@param normal If true, the console gui will display any regular messages that were emitted.\n\n") +{ + object->setDisplayFilters(errors, warns, normal); +} + +DefineEngineMethod(GuiConsole, getErrorFilter, bool, (), , + "Returns if the error filter is on or not.") +{ + return object->getErrorFilter(); +} + +DefineEngineMethod(GuiConsole, getWarnFilter, bool, (), , + "Returns if the warning filter is on or not.") +{ + return object->getWarnFilter(); +} + +DefineEngineMethod(GuiConsole, getNormalFilter, bool, (), , + "Returns if the normal message filter is on or not.") +{ + return object->getNormalFilter(); +} + +DefineEngineMethod(GuiConsole, toggleErrorFilter, void, (), , + "Toggles the error filter.") +{ + object->toggleErrorFilter(); +} + +DefineEngineMethod(GuiConsole, toggleWarnFilter, void, (), , + "Toggles the warning filter.") +{ + object->toggleWarnFilter(); +} + +DefineEngineMethod(GuiConsole, toggleNormalFilter, void, (), , + "Toggles the normal messages filter.") +{ + object->toggleNormalFilter(); +} \ No newline at end of file diff --git a/Engine/source/gui/controls/guiConsole.h b/Engine/source/gui/controls/guiConsole.h index 8f67573e1..217fe8d6a 100644 --- a/Engine/source/gui/controls/guiConsole.h +++ b/Engine/source/gui/controls/guiConsole.h @@ -39,14 +39,21 @@ class GuiConsole : public GuiArrayCtrl Resource mFont; + bool mDisplayErrors; + bool mDisplayWarnings; + bool mDisplayNormalMessages; + S32 getMaxWidth(S32 startIndex, S32 endIndex); + Vector mFilteredLog; + protected: /// @name Callbacks /// @{ DECLARE_CALLBACK( void, onMessageSelected, ( ConsoleLogEntry::Level level, const char* message ) ); + DECLARE_CALLBACK(void, onNewMessage, (U32 errorCount, U32 warnCount, U32 normalCount)); /// @} @@ -63,6 +70,26 @@ class GuiConsole : public GuiArrayCtrl virtual bool onWake(); virtual void onPreRender(); virtual void onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver); + + void setDisplayFilters(bool errors, bool warns, bool normal); + bool getErrorFilter() { return mDisplayErrors; } + bool getWarnFilter() { return mDisplayWarnings; } + bool getNormalFilter() { return mDisplayNormalMessages; } + + void toggleErrorFilter() + { + setDisplayFilters(!mDisplayErrors, mDisplayWarnings, mDisplayNormalMessages); + } + void toggleWarnFilter() + { + setDisplayFilters(mDisplayErrors, !mDisplayWarnings, mDisplayNormalMessages); + } + void toggleNormalFilter() + { + setDisplayFilters(mDisplayErrors, mDisplayWarnings, !mDisplayNormalMessages); + } + + void refreshLogText(); }; #endif diff --git a/Templates/BaseGame/game/core/console/console.gui b/Templates/BaseGame/game/core/console/console.gui index 8c6c7f63a..1286ed85c 100644 --- a/Templates/BaseGame/game/core/console/console.gui +++ b/Templates/BaseGame/game/core/console/console.gui @@ -1,51 +1,191 @@ -new GuiControl(ConsoleDlg) { - profile = "GuiDefaultProfile"; +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(ConsoleDlg) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; - position = "0 0"; - extent = "640 480"; - minExtent = "8 8"; + profile = "GuiDefaultProfile"; visible = "1"; - helpTag = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + helpTag = "0"; new GuiConsoleEditCtrl(ConsoleEntry) { - profile = "ConsoleTextEditProfile"; - horizSizing = "width"; - vertSizing = "top"; - position = "0 462"; - extent = "640 18"; - minExtent = "8 8"; - visible = "1"; - altCommand = "ConsoleEntry::eval();"; - helpTag = "0"; - maxLength = "255"; + useSiblingScroller = "1"; historySize = "40"; - password = "0"; tabComplete = "0"; sinkAllKeyEvents = "1"; - useSiblingScroller = "1"; + password = "0"; + passwordMask = "*"; + maxLength = "255"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 750"; + extent = "1024 18"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "top"; + profile = "ConsoleTextEditProfile"; + visible = "1"; + active = "1"; + altCommand = "ConsoleEntry::eval();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 728"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl() { + bitmap = "data/ui/art/hudfill.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgErrorFilterBtn) { + text = "Errors"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "2 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgWarnFilterBtn) { + text = "Warnings"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "119 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgNormalFilterBtn) { + text = "Normal Messages"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "236 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; new GuiScrollCtrl() { - internalName = "Scroll"; - profile = "ConsoleScrollProfile"; - horizSizing = "width"; - vertSizing = "height"; - position = "0 0"; - extent = "640 462"; - minExtent = "8 8"; - visible = "1"; - helpTag = "0"; willFirstRespond = "1"; hScrollBar = "alwaysOn"; vScrollBar = "alwaysOn"; - lockHorizScroll = "false"; - lockVertScroll = "false"; + lockHorizScroll = "0"; + lockVertScroll = "0"; constantThumbHeight = "0"; childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "1024 730"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ConsoleScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "Scroll"; + canSave = "1"; + canSaveDynamicFields = "0"; - new GuiConsole( ConsoleMessageLogView ) { - profile = "GuiConsoleProfile"; - position = "0 0"; - }; + new GuiConsole(ConsoleMessageLogView) { + position = "1 1"; + extent = "622 324"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiConsoleProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; }; + }; }; +//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/BaseGame/game/core/console/main.cs b/Templates/BaseGame/game/core/console/main.cs index b36dafd24..47894f7e4 100644 --- a/Templates/BaseGame/game/core/console/main.cs +++ b/Templates/BaseGame/game/core/console/main.cs @@ -99,6 +99,13 @@ function ConsoleDlg::showWindow(%this) %this-->Scroll.setVisible(true); } +function ConsoleDlg::onWake(%this) +{ + ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); + ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); + ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); +} + function ConsoleDlg::setAlpha( %this, %alpha) { if (%alpha $= "") @@ -106,3 +113,26 @@ function ConsoleDlg::setAlpha( %this, %alpha) else ConsoleScrollProfile.fillColor = getWords($ConsoleDefaultFillColor, 0, 2) SPC %alpha * 255.0; } + +function ConsoleDlgErrorFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleErrorFilter(); +} + +function ConsoleDlgWarnFilterBtn::onClick(%this) +{ + + ConsoleMessageLogView.toggleWarnFilter(); +} + +function ConsoleDlgNormalFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleNormalFilter(); +} + +function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount) +{ + ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors"); + ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings"); + ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages"); +} \ No newline at end of file diff --git a/Templates/Full/game/core/art/gui/console.gui b/Templates/Full/game/core/art/gui/console.gui index 70e5fb61b..c1627fafb 100644 --- a/Templates/Full/game/core/art/gui/console.gui +++ b/Templates/Full/game/core/art/gui/console.gui @@ -1,54 +1,192 @@ //--- OBJECT WRITE BEGIN --- %guiContent = new GuiControl(ConsoleDlg) { - profile = "GuiDefaultProfile"; + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; - position = "0 0"; - extent = "640 480"; - minExtent = "8 8"; + profile = "GuiDefaultProfile"; visible = "1"; - helpTag = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + helpTag = "0"; new GuiConsoleEditCtrl(ConsoleEntry) { - profile = "ConsoleTextEditProfile"; - horizSizing = "width"; - vertSizing = "top"; - position = "0 462"; - extent = "640 18"; - minExtent = "8 8"; - visible = "1"; - altCommand = "ConsoleEntry::eval();"; - helpTag = "0"; - maxLength = "255"; + useSiblingScroller = "1"; historySize = "40"; - password = "0"; tabComplete = "0"; sinkAllKeyEvents = "1"; - useSiblingScroller = "1"; + password = "0"; + passwordMask = "*"; + maxLength = "255"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 750"; + extent = "1024 18"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "top"; + profile = "ConsoleTextEditProfile"; + visible = "1"; + active = "1"; + altCommand = "ConsoleEntry::eval();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 728"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "top"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapCtrl() { + bitmap = "data/ui/art/hudfill.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "1024 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgErrorFilterBtn) { + text = "Errors"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "2 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgWarnFilterBtn) { + text = "Warnings"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "119 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiToggleButtonCtrl(ConsoleDlgNormalFilterBtn) { + text = "Normal Messages"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "236 2"; + extent = "113 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; new GuiScrollCtrl() { - internalName = "Scroll"; - profile = "ConsoleScrollProfile"; - horizSizing = "width"; - vertSizing = "height"; - position = "0 0"; - extent = "640 462"; - minExtent = "8 8"; - visible = "1"; - helpTag = "0"; willFirstRespond = "1"; hScrollBar = "alwaysOn"; vScrollBar = "alwaysOn"; - lockHorizScroll = "false"; - lockVertScroll = "false"; + lockHorizScroll = "0"; + lockVertScroll = "0"; constantThumbHeight = "0"; childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "1024 730"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ConsoleScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "Scroll"; + canSave = "1"; + canSaveDynamicFields = "0"; - new GuiConsole( ConsoleMessageLogView ) { - profile = "GuiConsoleProfile"; - position = "0 0"; - }; + new GuiConsole(ConsoleMessageLogView) { + position = "1 1"; + extent = "622 324"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiConsoleProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; }; + }; }; //--- OBJECT WRITE END --- @@ -173,3 +311,33 @@ function ConsoleMessageLogView::onMessageSelected( %this, %level, %message ) EditorOpenFileInTorsion( %fileName, %lineNumber ); } + +function ConsoleDlg::onWake(%this) +{ + ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); + ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); + ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); +} + +function ConsoleDlgErrorFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleErrorFilter(); +} + +function ConsoleDlgWarnFilterBtn::onClick(%this) +{ + + ConsoleMessageLogView.toggleWarnFilter(); +} + +function ConsoleDlgNormalFilterBtn::onClick(%this) +{ + ConsoleMessageLogView.toggleNormalFilter(); +} + +function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount) +{ + ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors"); + ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings"); + ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages"); +} \ No newline at end of file From 41e7e32cf5505d5707aa8a1a22b4929f1cf92ea8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 29 Sep 2017 15:54:55 -0500 Subject: [PATCH 036/312] adds fallbacks to the aiTurret's scannode to operate similar to the aimNode, letting folks skip out on adding either and just using pitch (or failing that, heading) --- Engine/source/T3D/turret/aiTurretShape.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/turret/aiTurretShape.cpp b/Engine/source/T3D/turret/aiTurretShape.cpp index b0c903950..d4bbd70eb 100644 --- a/Engine/source/T3D/turret/aiTurretShape.cpp +++ b/Engine/source/T3D/turret/aiTurretShape.cpp @@ -249,14 +249,11 @@ bool AITurretShapeData::preload(bool server, String &errorStr) // We have mShape at this point. Resolve nodes. scanNode = mShape->findNode("scanPoint"); aimNode = mShape->findNode("aimPoint"); - if (aimNode == -1) - { - aimNode = pitchNode; - } - if (aimNode == -1) - { - aimNode = headingNode; - } + + if (scanNode == -1) scanNode = pitchNode; + if (scanNode == -1) scanNode = headingNode; + if (aimNode == -1) aimNode = pitchNode; + if (aimNode == -1) aimNode = headingNode; // Resolve state sequence names & emitter nodes isAnimated = false; From 950723eb51502f35dde72a8a0c550fab383a4001 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 14 Oct 2017 22:10:42 -0500 Subject: [PATCH 037/312] Implements support of autoloaded assets. --- Engine/source/assets/assetManager.cpp | 62 +++++++++++++++++++++ Engine/source/assets/assetManager.h | 1 + Engine/source/assets/autoloadAssets.cpp | 45 +++++++++++++++ Engine/source/assets/autoloadAssets.h | 74 +++++++++++++++++++++++++ Engine/source/module/moduleDefinition.h | 2 + 5 files changed, 184 insertions(+) create mode 100644 Engine/source/assets/autoloadAssets.cpp create mode 100644 Engine/source/assets/autoloadAssets.h diff --git a/Engine/source/assets/assetManager.cpp b/Engine/source/assets/assetManager.cpp index 2ed7b19ae..805c52c01 100644 --- a/Engine/source/assets/assetManager.cpp +++ b/Engine/source/assets/assetManager.cpp @@ -54,6 +54,14 @@ #include "console/consoleTypes.h" #endif +#ifndef _AUTOLOAD_ASSETS_H_ +#include "assets/autoloadAssets.h" +#endif + +#ifndef COMPONENTASSET_H +#include "T3D/assets/ComponentAsset.h" +#endif + // Script bindings. #include "assetManager_ScriptBinding.h" @@ -202,6 +210,57 @@ bool AssetManager::addModuleDeclaredAssets( ModuleDefinition* pModuleDefinition return true; } +bool AssetManager::loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition) +{ + // Debug Profiling. + PROFILE_SCOPE(AssetManager_loadModuleAutoLoadAssets); + + // Sanity! + AssertFatal(pModuleDefinition != NULL, "Cannot auto load assets using a NULL module definition"); + + // Does the module have any assets associated with it? + if (pModuleDefinition->getModuleAssets().empty()) + { + // Yes, so warn. + Con::warnf("Asset Manager: Cannot auto load assets to module '%s' as it has no existing assets.", pModuleDefinition->getSignature()); + return false; + } + + U32 assetCount = pModuleDefinition->getModuleAssets().size(); + + // Iterate the module definition children. + for (SimSet::iterator itr = pModuleDefinition->begin(); itr != pModuleDefinition->end(); ++itr) + { + // Fetch the declared assets. + AutoloadAssets* pAutoloadAssets = dynamic_cast(*itr); + + // Skip if it's not a declared assets location. + if (pAutoloadAssets == NULL) + continue; + + for (U32 i = 0; i < assetCount; ++i) + { + AssetDefinition* assetDef = pModuleDefinition->getModuleAssets()[i]; + + if (assetDef->mAssetType == pAutoloadAssets->getAssetType()) + { + //TODO: this is stupid and ugly, need to properly automagically parse the class for registration + AssetBase* assetBase = nullptr; + + if (assetDef->mAssetType == StringTable->insert("ComponentAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } + + //load the asset now if valid + if (assetBase) + addPrivateAsset(assetBase); + } + } + } + + return true; +} //----------------------------------------------------------------------------- bool AssetManager::addDeclaredAsset( ModuleDefinition* pModuleDefinition, const char* pAssetFilePath ) @@ -2974,6 +3033,9 @@ void AssetManager::onModulePreLoad( ModuleDefinition* pModuleDefinition ) // Add module declared assets. addModuleDeclaredAssets( pModuleDefinition ); + // Load any auto-loaded asset types + loadModuleAutoLoadAssets(pModuleDefinition); + // Is an asset tags manifest specified? if ( pModuleDefinition->getAssetTagsManifest() != StringTable->EmptyString() ) { diff --git a/Engine/source/assets/assetManager.h b/Engine/source/assets/assetManager.h index fbf1522f3..a8ac792a2 100644 --- a/Engine/source/assets/assetManager.h +++ b/Engine/source/assets/assetManager.h @@ -127,6 +127,7 @@ public: bool removeDeclaredAssets( ModuleDefinition* pModuleDefinition ); bool removeDeclaredAsset( const char* pAssetId ); bool renameDeclaredAsset( const char* pAssetIdFrom, const char* pAssetIdTo ); + bool loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition); StringTableEntry getAssetName( const char* pAssetId ); StringTableEntry getAssetDescription( const char* pAssetId ); StringTableEntry getAssetCategory( const char* pAssetId ); diff --git a/Engine/source/assets/autoloadAssets.cpp b/Engine/source/assets/autoloadAssets.cpp new file mode 100644 index 000000000..e5b3ca53f --- /dev/null +++ b/Engine/source/assets/autoloadAssets.cpp @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _AUTOLOAD_ASSETS_H_ +#include "assets/autoloadAssets.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(AutoloadAssets); + +//----------------------------------------------------------------------------- + +void AutoloadAssets::initPersistFields() +{ + // Call Parent. + Parent::initPersistFields(); + + addField("Path", TypeString, Offset(mPath, AutoloadAssets), ""); + addField("AssetType", TypeString, Offset(mAssetType, AutoloadAssets), ""); + addField("Recurse", TypeBool, Offset(mRecurse, AutoloadAssets), ""); +} diff --git a/Engine/source/assets/autoloadAssets.h b/Engine/source/assets/autoloadAssets.h new file mode 100644 index 000000000..5a33e57c1 --- /dev/null +++ b/Engine/source/assets/autoloadAssets.h @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _AUTOLOAD_ASSETS_H_ +#define _AUTOLOAD_ASSETS_H_ + +#ifndef _SIM_H_ +#include "console/sim.h" +#endif + +#ifndef _SIMOBJECT_H_ +#include "console/simObject.h" +#endif + +#ifndef _CONSOLEOBJECT_H_ +#include "console/consoleObject.h" +#endif + +//----------------------------------------------------------------------------- + +class AutoloadAssets : public SimObject +{ + friend class AssetManager; + +private: + typedef SimObject Parent; + + StringTableEntry mPath; + StringTableEntry mAssetType; + bool mRecurse; + +public: + AutoloadAssets() : + mPath(StringTable->EmptyString()), + mAssetType(StringTable->EmptyString()), + mRecurse(false) + {} + virtual ~AutoloadAssets() {} + + static void initPersistFields(); + + inline void setPath(const char* pPath) { mPath = StringTable->insert(pPath); } + inline StringTableEntry getPath(void) const { return mPath; } + inline void setAssetType(const char* pPath) { mAssetType = StringTable->insert(pPath); } + inline StringTableEntry getAssetType(void) const { return mAssetType; } + inline void setRecurse(const bool recurse) { mRecurse = recurse; } + inline bool getRecurse(void) const { return mRecurse; } + + /// Declare Console Object. + DECLARE_CONOBJECT(AutoloadAssets); +}; + +#endif // _DECLARED_ASSETS_H_ + +#pragma once diff --git a/Engine/source/module/moduleDefinition.h b/Engine/source/module/moduleDefinition.h index 2ebb3f99a..42deff44d 100644 --- a/Engine/source/module/moduleDefinition.h +++ b/Engine/source/module/moduleDefinition.h @@ -166,6 +166,8 @@ public: inline void setAssetTagsManifest( const char* pTagsAssetManifest ) { if ( checkUnlocked() ) { mAssetTagsManifest = StringTable->insert(pTagsAssetManifest); } } inline StringTableEntry getAssetTagsManifest( void ) const { return mAssetTagsManifest; } inline typeModuleAssetsVector& getModuleAssets( void ) { return mModuleAssets; } + void addDeclaredAsset(AssetDefinition* asset) { mModuleAssets.push_back(asset); } + /// Module location. inline void setModulePath( const char* pModulePath ) { if ( checkUnlocked() ) { mModulePath = StringTable->insert(pModulePath); } } From 1407f3953cb884f1fc2218db660e004097f3f27b Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 15 Oct 2017 03:41:26 -0500 Subject: [PATCH 038/312] Tweaks the asMatrixF for RotationF, as well as exposes additional console methods for rotation manipulation --- Engine/source/math/mRotation.cpp | 71 +++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index fad915888..8fe8228ae 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -252,14 +252,29 @@ MatrixF RotationF::asMatrixF() const MatrixF returnMat; if (mRotationType == Euler) { - returnMat.set(EulerF(x, y, z)); + MatrixF imat, xmat, ymat, zmat; + xmat.set(EulerF(x, 0, 0)); + ymat.set(EulerF(0.0f, y, 0.0f)); + zmat.set(EulerF(0, 0, z)); + imat.mul(zmat, xmat); + returnMat.mul(imat, ymat); } else { AngAxisF aa; aa.set(Point3F(x, y, z), w); - aa.setMatrix(&returnMat); + MatrixF tempMat; + aa.setMatrix(&tempMat); + + EulerF eul = tempMat.toEuler(); + + MatrixF imat, xmat, ymat, zmat; + xmat.set(EulerF(eul.x, 0, 0)); + ymat.set(EulerF(0.0f, eul.y, 0.0f)); + zmat.set(EulerF(0, 0, eul.z)); + imat.mul(zmat, xmat); + returnMat.mul(imat, ymat); } return returnMat; @@ -357,6 +372,58 @@ DefineConsoleStaticMethod(rotation, LookAt, RotationF, (Point3F origin, Point3F return result; } +DefineConsoleStaticMethod(rotation, setRightVector, RotationF, (RotationF a, VectorF rightVec), , + "Subtracts two rotations.\n" + "@param a Rotation one." + "@param b Rotation two." + "@returns v difference of both rotations." + "@ingroup Math") +{ + a.asMatrixF().setColumn(0, rightVec); + return a; +} + +DefineConsoleStaticMethod(rotation, setUpVector, RotationF, (RotationF a, VectorF upVec), , + "Subtracts two rotations.\n" + "@param a Rotation one." + "@param b Rotation two." + "@returns v difference of both rotations." + "@ingroup Math") +{ + a.asMatrixF().setColumn(2, upVec); + return a; +} + +DefineConsoleStaticMethod(rotation, getForwardVector, VectorF, (RotationF a), , + "Subtracts two rotations.\n" + "@param a Rotation one." + "@param b Rotation two." + "@returns v difference of both rotations." + "@ingroup Math") +{ + return a.asMatrixF().getForwardVector(); +} + +DefineConsoleStaticMethod(rotation, getRightVector, VectorF, (RotationF a), , + "Subtracts two rotations.\n" + "@param a Rotation one." + "@param b Rotation two." + "@returns v difference of both rotations." + "@ingroup Math") +{ + return a.asMatrixF().getRightVector(); +} + +DefineConsoleStaticMethod(rotation, getUpVector, VectorF, (RotationF a), , + "Subtracts two rotations.\n" + "@param a Rotation one." + "@param b Rotation two." + "@returns v difference of both rotations." + "@ingroup Math") +{ + return a.asMatrixF().getUpVector(); +} + DefineConsoleStaticMethod(rotation, getDirection, Point3F, (RotationF rot),, "Takes the angles of the provided rotation and returns a direction vector.\n" "@param rot Our rotation." From bdac9286eea73b8309ecf60ef8f658da65feb18e Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 15 Oct 2017 03:49:18 -0500 Subject: [PATCH 039/312] Enables setting the forward vector of a Scene Object --- Engine/source/scene/sceneObject.cpp | 65 +++++++++++++++++++++++++++++ Engine/source/scene/sceneObject.h | 3 ++ 2 files changed, 68 insertions(+) diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index 550ee80b4..f2f7963a0 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -433,6 +433,64 @@ void SceneObject::setScale( const VectorF &scale ) setMaskBits( ScaleMask ); } +void SceneObject::setForwardVector(VectorF newForward, VectorF upVector) +{ + MatrixF mat = getTransform(); + + VectorF up(0.0f, 0.0f, 1.0f); + VectorF axisX; + VectorF axisY = newForward; + VectorF axisZ; + + if (upVector != VectorF::Zero) + up = upVector; + + // Validate and normalize input: + F32 lenSq; + lenSq = axisY.lenSquared(); + if (lenSq < 0.000001f) + { + axisY.set(0.0f, 1.0f, 0.0f); + Con::errorf("SceneObject::setForwardVector() - degenerate forward vector"); + } + else + { + axisY /= mSqrt(lenSq); + } + + + lenSq = up.lenSquared(); + if (lenSq < 0.000001f) + { + up.set(0.0f, 0.0f, 1.0f); + Con::errorf("SceneObject::setForwardVector() - degenerate up vector - too small"); + } + else + { + up /= mSqrt(lenSq); + } + + if (fabsf(mDot(up, axisY)) > 0.9999f) + { + Con::errorf("SceneObject::setForwardVector() - degenerate up vector - same as forward"); + // I haven't really tested this, but i think it generates something which should be not parallel to the previous vector: + F32 tmp = up.x; + up.x = -up.y; + up.y = up.z; + up.z = tmp; + } + + // construct the remaining axes: + mCross(axisY, up, &axisX); + mCross(axisX, axisY, &axisZ); + + mat.setColumn(0, axisX); + mat.setColumn(1, axisY); + mat.setColumn(2, axisZ); + + setTransform(mat); +} + //----------------------------------------------------------------------------- void SceneObject::resetWorldBox() @@ -1458,3 +1516,10 @@ DefineEngineMethod( SceneObject, isGlobalBounds, bool, (),, { return object->isGlobalBounds(); } + +DefineConsoleMethod(SceneObject, setForwardVector, void, (VectorF newForward, VectorF upVector), (VectorF(0, 0, 0), VectorF(0, 0, 1)), + "Get the number of static fields on the object.\n" + "@return The number of static fields defined on the object.") +{ + object->setForwardVector(newForward, upVector); +} \ No newline at end of file diff --git a/Engine/source/scene/sceneObject.h b/Engine/source/scene/sceneObject.h index bf04ea4c4..549246c9e 100644 --- a/Engine/source/scene/sceneObject.h +++ b/Engine/source/scene/sceneObject.h @@ -504,6 +504,9 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce /// @param scale Scaling values virtual void setScale( const VectorF &scale ); + /// Sets the forward vector of the object + void setForwardVector(VectorF newForward, VectorF upVector = VectorF(0, 0, 1)); + /// This sets the render transform for this object /// @param mat New render transform virtual void setRenderTransform(const MatrixF &mat); From 57253daeef8456c06df7eb7208286f8041780d54 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 15 Oct 2017 03:59:13 -0500 Subject: [PATCH 040/312] Adds a engine method to clear the scopeAlways flag on netObjects --- Engine/source/sim/netObject.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index 76564fb16..64f112c54 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -493,3 +493,8 @@ void NetObject::removeScopeRef() } } +DefineEngineMethod(NetObject, clearScopeAlways, void, (), , + "@brief Clears the scope always flag on this object.\n\n") +{ + object->clearScopeAlways(); +} \ No newline at end of file From 4ea3c90b5b08cd4ff54cb65b4b2842f665eec29a Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 15 Oct 2017 04:02:43 -0500 Subject: [PATCH 041/312] Adds a function to get the cursor position in local coords --- Engine/source/gui/core/guiCanvas.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index 7775b8af0..dfc98da38 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -334,6 +334,9 @@ public: /// Returns the point, in screenspace, at which the cursor is located. virtual Point2I getCursorPos(); + /// Returns the point, in local coordinates, at which the cursor is located + virtual Point2I getCursorPosLocal() { return Point2I(S32(mCursorPt.x), S32(mCursorPt.y)); } + /// Enable/disable rendering of the cursor. /// @param state True if we should render cursor virtual void showCursor(bool state); From 1fdbc6594ed750aeb88d41927da53f501746a5a0 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 15 Oct 2017 04:42:30 -0500 Subject: [PATCH 042/312] Fixes up various parts of the entity and component classes. --- Engine/source/T3D/components/component.cpp | 85 +++- Engine/source/T3D/components/component.h | 16 +- .../T3D/components/render/meshComponent.cpp | 1 - Engine/source/T3D/entity.cpp | 396 +++++++----------- Engine/source/T3D/entity.h | 26 +- 5 files changed, 259 insertions(+), 265 deletions(-) diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index 47784d4b2..cbb2305c1 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -42,13 +42,13 @@ Component::Component() { - mFriendlyName = StringTable->lookup(""); - mFromResource = StringTable->lookup(""); - mComponentType = StringTable->lookup(""); - mComponentGroup = StringTable->lookup(""); - mNetworkType = StringTable->lookup(""); - mTemplateName = StringTable->lookup(""); - //mDependency = StringTable->lookup(""); + mFriendlyName = StringTable->EmptyString(); + mFromResource = StringTable->EmptyString(); + mComponentType = StringTable->EmptyString(); + mComponentGroup = StringTable->EmptyString(); + mNetworkType = StringTable->EmptyString(); + mTemplateName = StringTable->EmptyString(); + //mDependency = StringTable->EmptyString(); mNetworked = false; @@ -64,6 +64,8 @@ Component::Component() mCanSaveFieldDictionary = false; + mOriginatingAssetId = StringTable->EmptyString(); + mNetFlags.set(Ghostable); } @@ -97,6 +99,10 @@ void Component::initPersistFields() //addField("hidden", TypeBool, Offset(mHidden, Component), "Flags if this behavior is shown in the editor or not", AbstractClassRep::FieldFlags::FIELD_HideInInspectors); addProtectedField("enabled", TypeBool, Offset(mEnabled, Component), &_setEnabled, &defaultProtectedGetFn, ""); + + addField("originatingAsset", TypeComponentAssetPtr, Offset(mOriginatingAsset, Component), + "Asset that spawned this component, used for tracking/housekeeping", AbstractClassRep::FieldFlags::FIELD_HideInInspectors); + endGroup("Component"); Parent::initPersistFields(); @@ -149,6 +155,7 @@ bool Component::onAdd() return false; setMaskBits(UpdateMask); + setMaskBits(NamespaceMask); return true; } @@ -274,6 +281,19 @@ U32 Component::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->writeFlag(mEnabled); } + /*if (stream->writeFlag(mask & NamespaceMask)) + { + const char* name = getName(); + if (stream->writeFlag(name && name[0])) + stream->writeString(String(name)); + + if (stream->writeFlag(mSuperClassName && mSuperClassName[0])) + stream->writeString(String(mSuperClassName)); + + if (stream->writeFlag(mClassName && mClassName[0])) + stream->writeString(String(mClassName)); + }*/ + return retMask; } @@ -303,6 +323,32 @@ void Component::unpackUpdate(NetConnection *con, BitStream *stream) { mEnabled = stream->readFlag(); } + + /*if (stream->readFlag()) + { + if (stream->readFlag()) + { + char name[256]; + stream->readString(name); + assignName(name); + } + + if (stream->readFlag()) + { + char superClassname[256]; + stream->readString(superClassname); + mSuperClassName = superClassname; + } + + if (stream->readFlag()) + { + char classname[256]; + stream->readString(classname); + mClassName = classname; + } + + linkNamespaces(); + }*/ } void Component::packToStream(Stream &stream, U32 tabStop, S32 behaviorID, U32 flags /* = 0 */) @@ -346,6 +392,10 @@ void Component::setDataField(StringTableEntry slotName, const char *array, const onDataSet.trigger(this, slotName, value); } +StringTableEntry Component::getComponentName() +{ + return getNamespace()->getName(); +} //catch any behavior field updates void Component::onStaticModified(const char* slotName, const char* newValue) @@ -426,6 +476,16 @@ void Component::addComponentField(const char *fieldName, const char *desc, const fieldTypeMask = TypeBool; else if (fieldType == StringTable->insert("object")) fieldTypeMask = TypeSimObjectPtr; + else if (fieldType == StringTable->insert("string")) + fieldTypeMask = TypeString; + else if (fieldType == StringTable->insert("colorI")) + fieldTypeMask = TypeColorI; + else if (fieldType == StringTable->insert("colorF")) + fieldTypeMask = TypeColorF; + else if (fieldType == StringTable->insert("ease")) + fieldTypeMask = TypeEaseF; + else if (fieldType == StringTable->insert("gameObject")) + fieldTypeMask = TypeGameObjectAssetPtr; else fieldTypeMask = TypeString; @@ -603,6 +663,17 @@ ConsoleMethod(Component, setComponentield, const char *, 3, 3, "(int index) - Ge return buf; } +DefineConsoleMethod(Component, getComponentFieldType, const char *, (String fieldName), , + "Get the number of static fields on the object.\n" + "@return The number of static fields defined on the object.") +{ + ComponentField *field = object->getComponentField(fieldName); + if (field == NULL) + return ""; + + return field->mFieldTypeName;; +} + ConsoleMethod(Component, getBehaviorFieldUserData, const char *, 3, 3, "(int index) - Gets the UserData associated with a field by index in the field list\n" "@param index The index of the behavior\n" "@return Returns a string representing the user data of this field\n") diff --git a/Engine/source/T3D/components/component.h b/Engine/source/T3D/components/component.h index 0259bacd0..4f84de17f 100644 --- a/Engine/source/T3D/components/component.h +++ b/Engine/source/T3D/components/component.h @@ -32,14 +32,22 @@ #ifndef CORE_INTERFACES_H #include "T3D/components/coreInterfaces.h" #endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif +#ifndef COMPONENT_ASSET_H +#include "T3D/assets/ComponentAsset.h" +#endif class Entity; +class Namespace; struct ComponentField { StringTableEntry mFieldName; StringTableEntry mFieldDescription; + StringTableEntry mFieldTypeName; S32 mFieldType; StringTableEntry mUserData; @@ -81,6 +89,9 @@ protected: bool mHidden; bool mEnabled; + StringTableEntry mOriginatingAssetId; + AssetPtr mOriginatingAsset; + public: Component(); virtual ~Component(); @@ -175,7 +186,8 @@ public: OwnerMask = BIT(1), UpdateMask = BIT(2), EnableMask = BIT(3), - NextFreeMask = BIT(4) + NamespaceMask = BIT(4), + NextFreeMask = BIT(5) }; virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream); @@ -192,6 +204,8 @@ public: void checkComponentFieldModified(const char* slotName, const char* newValue); virtual void checkDependencies(){} + + StringTableEntry getComponentName(); }; #endif // COMPONENT_H diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index 708a48ae1..c9eeee3c3 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -34,7 +34,6 @@ #include "lighting/lightQuery.h" #include "scene/sceneManager.h" #include "gfx/bitmap/ddsFile.h" -#include "gfx/bitmap/ddsUtils.h" #include "gfx/gfxTextureManager.h" #include "materials/materialFeatureTypes.h" #include "renderInstance/renderImposterMgr.h" diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index 00ecedad0..b81974cfe 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -51,6 +51,7 @@ // #include "gfx/sim/debugDraw.h" // +#include "T3D/sfx/sfx3DWorld.h" extern bool gEditingMission; @@ -117,6 +118,8 @@ Entity::Entity() mInitialized = false; + mGameObjectAssetId = StringTable->insert(""); + } Entity::~Entity() @@ -143,6 +146,11 @@ void Entity::initPersistFields() addField("LocalRotation", TypeMatrixRotation, Offset(mMount.xfm, Entity), "Rotation we are mounted at ( object space of our mount object )."); endGroup("Transform"); + + addGroup("GameObject"); + addProtectedField("gameObjectName", TypeGameObjectAssetPtr, Offset(mGameObjectAsset, Entity), &_setGameObject, &defaultProtectedGetFn, + "The asset Id used for the game object this entity is based on."); + endGroup("GameObject"); } // @@ -215,8 +223,8 @@ bool Entity::onAdd() if (!Parent::onAdd()) return false; - mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); - + mObjBox = Box3F(Point3F(-0.5, -0.5, -0.5), Point3F(0.5, 0.5, 0.5)); + resetWorldBox(); setObjectBox(mObjBox); @@ -224,6 +232,7 @@ bool Entity::onAdd() //Make sure we get positioned setMaskBits(TransformMask); + setMaskBits(NamespaceMask); return true; } @@ -253,6 +262,16 @@ void Entity::onPostAdd() Con::executef(this, "onAdd"); } +bool Entity::_setGameObject(void *object, const char *index, const char *data) +{ + Entity *e = static_cast(object); + + // Sanity! + AssertFatal(data != NULL, "Cannot use a NULL asset Id."); + + return true; //rbI->setMeshAsset(data); +} + void Entity::setDataField(StringTableEntry slotName, const char *array, const char *value) { Parent::setDataField(slotName, array, value); @@ -363,8 +382,20 @@ void Entity::processTick(const Move* move) } } - if (isMethod("processTick")) + // Save current rigid state interpolation + mDelta.posVec = getPosition(); + mDelta.rot[0] = mRot.asQuatF(); + + //Handle any script updates, which can include physics stuff + if (isServerObject() && isMethod("processTick")) Con::executef(this, "processTick"); + + // Wrap up interpolation info + mDelta.pos = getPosition(); + mDelta.posVec -= getPosition(); + mDelta.rot[1] = mRot.asQuatF(); + + setTransform(getPosition(), mRot); } } @@ -402,11 +433,6 @@ U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream) if (stream->writeFlag(mask & TransformMask)) { - //mathWrite( *stream, getScale() ); - //stream->writeAffineTransform(mObjToWorld); - //mathWrite(*stream, getPosition()); - //mathWrite(*stream, mPos); - stream->writeCompressedPoint(mPos); mathWrite(*stream, getRotation()); @@ -415,12 +441,6 @@ U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->writeFlag(!(mask & NoWarpMask)); } - /*if (stream->writeFlag(mask & MountedMask)) - { - mathWrite(*stream, mMount.xfm.getPosition()); - mathWrite(*stream, mMount.xfm.toEuler()); - }*/ - if (stream->writeFlag(mask & BoundsMask)) { mathWrite(*stream, mObjBox); @@ -483,6 +503,19 @@ U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream) else stream->writeFlag(false); + /*if (stream->writeFlag(mask & NamespaceMask)) + { + const char* name = getName(); + if (stream->writeFlag(name && name[0])) + stream->writeString(String(name)); + + if (stream->writeFlag(mSuperClassName && mSuperClassName[0])) + stream->writeString(String(mSuperClassName)); + + if (stream->writeFlag(mClassName && mClassName[0])) + stream->writeString(String(mClassName)); + }*/ + return retMask; } @@ -492,20 +525,10 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) if (stream->readFlag()) { - /*Point3F scale; - mathRead( *stream, &scale ); - setScale( scale);*/ - - //MatrixF objToWorld; - //stream->readAffineTransform(&objToWorld); - Point3F pos; - stream->readCompressedPoint(&pos); - //mathRead(*stream, &pos); RotationF rot; - mathRead(*stream, &rot); mDelta.move.unpack(stream); @@ -514,72 +537,6 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) { // Determine number of ticks to warp based on the average // of the client and server velocities. - /*mDelta.warpOffset = pos - mDelta.pos; - - F32 dt = mDelta.warpOffset.len() / (0.5f * TickSec); - - mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - - //F32 as = (speed + mVelocity.len()) * 0.5f * TickSec; - //F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as : sMaxWarpTicks; - //mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - - //mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - - //mDelta.warpTicks = sMaxWarpTicks; - - mDelta.warpTicks = 0; - - if (mDelta.warpTicks) - { - // Setup the warp to start on the next tick. - if (mDelta.warpTicks > sMaxWarpTicks) - mDelta.warpTicks = sMaxWarpTicks; - mDelta.warpOffset /= (F32)mDelta.warpTicks; - - mDelta.rot[0] = rot.asQuatF(); - mDelta.rot[1] = rot.asQuatF(); - - mDelta.rotOffset = rot.asEulerF() - mDelta.rot.asEulerF(); - - // Ignore small rotation differences - if (mFabs(mDelta.rotOffset.x) < 0.001f) - mDelta.rotOffset.x = 0; - - if (mFabs(mDelta.rotOffset.y) < 0.001f) - mDelta.rotOffset.y = 0; - - if (mFabs(mDelta.rotOffset.z) < 0.001f) - mDelta.rotOffset.z = 0; - - mDelta.rotOffset /= (F32)mDelta.warpTicks; - } - else - { - // Going to skip the warp, server and client are real close. - // Adjust the frame interpolation to move smoothly to the - // new position within the current tick. - Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; - if (mDelta.dt == 0) - { - mDelta.posVec.set(0.0f, 0.0f, 0.0f); - mDelta.rotVec.set(0.0f, 0.0f, 0.0f); - } - else - { - F32 dti = 1.0f / mDelta.dt; - mDelta.posVec = (cp - pos) * dti; - mDelta.rotVec.z = mRot.z - rot.z; - - mDelta.rotVec.z *= dti; - } - - mDelta.pos = pos; - mDelta.rot = rot; - - setTransform(pos, rot); - }*/ - Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; mDelta.warpOffset = pos - cp; @@ -631,20 +588,6 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) } } - /*if (stream->readFlag()) - { - Point3F mountOffset; - EulerF mountRot; - mathRead(*stream, &mountOffset); - mathRead(*stream, &mountRot); - - RotationF rot = RotationF(mountRot); - mountRot = rot.asEulerF(RotationF::Degrees); - - setMountOffset(mountOffset); - setMountRotation(mountRot); - }*/ - if (stream->readFlag()) { mathRead(*stream, &mObjBox); @@ -669,13 +612,38 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) } } } + + /*if (stream->readFlag()) + { + if (stream->readFlag()) + { + char name[256]; + stream->readString(name); + assignName(name); + } + + if (stream->readFlag()) + { + char superClassname[256]; + stream->readString(superClassname); + mSuperClassName = superClassname; + } + + if (stream->readFlag()) + { + char classname[256]; + stream->readString(classname); + mClassName = classname; + } + + linkNamespaces(); + }*/ } //Manipulation void Entity::setTransform(const MatrixF &mat) { - //setMaskBits(TransformMask); - setMaskBits(TransformMask | NoWarpMask); + MatrixF oldTransform = getTransform(); if (isMounted()) { @@ -687,25 +655,20 @@ void Entity::setTransform(const MatrixF &mat) if (!newOffset.isZero()) { - //setMountOffset(newOffset); mPos = newOffset; } Point3F matEul = mat.toEuler(); - //mRot = Point3F(mRadToDeg(matEul.x), mRadToDeg(matEul.y), mRadToDeg(matEul.z)); - if (matEul != Point3F(0, 0, 0)) { Point3F mountEul = mMount.object->getTransform().toEuler(); Point3F diff = matEul - mountEul; - //setMountRotation(Point3F(mRadToDeg(diff.x), mRadToDeg(diff.y), mRadToDeg(diff.z))); mRot = diff; } else { - //setMountRotation(Point3F(0, 0, 0)); mRot = Point3F(0, 0, 0); } @@ -714,6 +677,9 @@ void Entity::setTransform(const MatrixF &mat) transf.setPosition(mPos + mMount.object->getPosition()); Parent::setTransform(transf); + + if (transf != oldTransform) + setMaskBits(TransformMask); } else { @@ -744,6 +710,8 @@ void Entity::setTransform(const MatrixF &mat) void Entity::setTransform(Point3F position, RotationF rotation) { + MatrixF oldTransform = getTransform(); + if (isMounted()) { mPos = position; @@ -755,7 +723,8 @@ void Entity::setTransform(Point3F position, RotationF rotation) Parent::setTransform(transf); - setMaskBits(TransformMask); + if (transf != oldTransform) + setMaskBits(TransformMask); } else { @@ -774,7 +743,6 @@ void Entity::setTransform(Point3F position, RotationF rotation) mPos = position; mRot = rotation; - setMaskBits(TransformMask); //if (isServerObject()) // setMaskBits(TransformMask); @@ -788,19 +756,18 @@ void Entity::setTransform(Point3F position, RotationF rotation) //PROFILE_SCOPE(Entity_setTransform); // Update the transforms. - Parent::setTransform(newMat); onTransformSet.trigger(&newMat); - /*mObjToWorld = mWorldToObj = newMat; - mWorldToObj.affineInverse(); - // Update the world-space AABB. - resetWorldBox(); - // If we're in a SceneManager, sync our scene state. - if (mSceneManager != NULL) - mSceneManager->notifyObjectDirty(this); - setRenderTransform(newMat);*/ + Point3F newPos = newMat.getPosition(); + RotationF newRot = newMat; + + Point3F oldPos = oldTransform.getPosition(); + RotationF oldRot = oldTransform; + + if (newPos != oldPos || newRot != oldRot) + setMaskBits(TransformMask); } } @@ -887,7 +854,7 @@ void Entity::setMountRotation(EulerF rotOffset) temp.setColumn(3, mMount.xfm.getPosition()); mMount.xfm = temp; - //mRot = RotationF(temp); + setMaskBits(MountedMask); } } @@ -964,63 +931,6 @@ void Entity::getRenderMountTransform(F32 delta, S32 index, const MatrixF &xfm, M Parent::getMountTransform(index, xfm, outMat); } -void Entity::setForwardVector(VectorF newForward, VectorF upVector) -{ - MatrixF mat = getTransform(); - - VectorF up(0.0f, 0.0f, 1.0f); - VectorF axisX; - VectorF axisY = newForward; - VectorF axisZ; - - if (upVector != VectorF::Zero) - up = upVector; - - // Validate and normalize input: - F32 lenSq; - lenSq = axisY.lenSquared(); - if (lenSq < 0.000001f) - { - axisY.set(0.0f, 1.0f, 0.0f); - Con::errorf("Entity::setForwardVector() - degenerate forward vector"); - } - else - { - axisY /= mSqrt(lenSq); - } - - - lenSq = up.lenSquared(); - if (lenSq < 0.000001f) - { - up.set(0.0f, 0.0f, 1.0f); - Con::errorf("SceneObject::setForwardVector() - degenerate up vector - too small"); - } - else - { - up /= mSqrt(lenSq); - } - - if (fabsf(mDot(up, axisY)) > 0.9999f) - { - Con::errorf("SceneObject::setForwardVector() - degenerate up vector - same as forward"); - // i haven't really tested this, but i think it generates something which should be not parallel to the previous vector: - F32 tmp = up.x; - up.x = -up.y; - up.y = up.z; - up.z = tmp; - } - - // construct the remaining axes: - mCross(axisY, up, &axisX); - mCross(axisX, axisY, &axisZ); - - mat.setColumn(0, axisX); - mat.setColumn(1, axisY); - mat.setColumn(2, axisZ); - - setTransform(mat); -} // //These basically just redirect to any collision behaviors we have bool Entity::castRay(const Point3F &start, const Point3F &end, RayInfo* info) @@ -1117,6 +1027,28 @@ void Entity::onUnmount(SceneObject *obj, S32 node) } } +void Entity::setControllingClient(GameConnection* client) +{ + if (isGhost() && gSFX3DWorld) + { + if (gSFX3DWorld->getListener() == this && !client && getControllingClient() && getControllingClient()->isConnectionToServer()) + { + // We are the current listener and are no longer a controller object on the + // connection, so clear our listener status. + + gSFX3DWorld->setListener(NULL); + } + else if (client && client->isConnectionToServer() && !getControllingObject()) + { + // We're on the local client and not controlled by another object, so make + // us the current SFX listener. + + gSFX3DWorld->setListener(this); + } + } + Parent::setControllingClient(client); +} + //Heirarchy stuff void Entity::addObject(SimObject* object) { @@ -1261,9 +1193,8 @@ bool Entity::removeComponent(Component *comp, bool deleteComponent) onComponentRemoved.trigger(comp); - comp->setOwner(NULL); - comp->onComponentRemove(); //in case the behavior needs to do cleanup on the owner + comp->setOwner(NULL); if (deleteComponent) comp->safeDeleteObject(); @@ -1364,72 +1295,6 @@ void Entity::onInspect() { (*it)->onInspect(); } - - GuiTreeViewCtrl *editorTree = dynamic_cast(Sim::findObject("EditorTree")); - if (!editorTree) - return; - - GuiTreeViewCtrl::Item *newItem, *parentItem; - - parentItem = editorTree->getItem(editorTree->findItemByObjectId(getId())); - - S32 componentID = editorTree->insertItem(parentItem->getID(), "Components"); - - newItem = editorTree->getItem(componentID); - newItem->mState.set(GuiTreeViewCtrl::Item::VirtualParent); - newItem->mState.set(GuiTreeViewCtrl::Item::DenyDrag); - //newItem->mState.set(GuiTreeViewCtrl::Item::InspectorData); - newItem->mState.set(GuiTreeViewCtrl::Item::ForceItemName); - //newItem->mInspectorInfo.mObject = this; - - AssetManager *assetDB = dynamic_cast(Sim::findObject("AssetDatabase")); - if (!assetDB) - return; - - //This is used in the event of script-created assets, which likely only have - //the name and other 'friendly' properties stored in a ComponentAsset. - //So we'll do a query for those assets and find the asset based on the component's - //class name - AssetQuery* qry = new AssetQuery(); - qry->registerObject(); - - assetDB->findAssetType(qry, "ComponentAsset"); - - for (U32 i = 0; i < mComponents.size(); ++i) - { - String compName = mComponents[i]->getFriendlyName(); - - if (compName == String("")) - { - String componentClass = mComponents[i]->getClassNamespace(); - - //Means that it's a script-derived component and we should consult the asset to try - //to get the info for it - S32 compAssetCount = qry->mAssetList.size(); - for (U32 c = 0; c < compAssetCount; ++c) - { - StringTableEntry assetID = qry->mAssetList[c]; - - ComponentAsset* compAsset = assetDB->acquireAsset(assetID); - - String compAssetClass = compAsset->getComponentName(); - if (componentClass == compAssetClass) - { - compName = compAsset->getFriendlyName(); - break; - } - } - } - - S32 compID = editorTree->insertItem(componentID, compName); - newItem = editorTree->getItem(compID); - newItem->mInspectorInfo.mObject = mComponents[i]; - newItem->mState.set(GuiTreeViewCtrl::Item::ForceItemName); - newItem->mState.set(GuiTreeViewCtrl::Item::DenyDrag); - newItem->mState.set(GuiTreeViewCtrl::Item::InspectorData); - } - - editorTree->buildVisibleTree(true); } void Entity::onEndInspect() @@ -1615,6 +1480,21 @@ void Entity::updateContainer() } // +void Entity::notifyComponents(String signalFunction, String argA, String argB, String argC, String argD, String argE) +{ + for (U32 i = 0; i < mComponents.size(); i++) + { + // We can do this because both are in the string table + Component *comp = mComponents[i]; + + if (comp->isActive()) + { + if (comp->isMethod(signalFunction)) + Con::executef(comp, signalFunction, argA, argB, argC, argD, argE); + } + } +} + void Entity::setComponentsDirty() { if (mToLoadComponents.empty()) @@ -1833,7 +1713,6 @@ DefineConsoleMethod(Entity, getComponent, S32, (String componentName), (""), Component *comp = object->getComponent(componentName); return (comp != NULL) ? comp->getId() : 0; - return 0; } /*ConsoleMethod(Entity, getBehaviorByType, S32, 3, 3, "(string BehaviorTemplateName) - gets a behavior\n" @@ -1917,6 +1796,15 @@ DefineConsoleMethod(Entity, getMoveTrigger, bool, (S32 triggerNum), (0), return false; } +DefineEngineMethod(Entity, getForwardVector, VectorF, (), , + "Get the direction this object is facing.\n" + "@return a vector indicating the direction this object is facing.\n" + "@note This is the object's y axis.") +{ + VectorF forVec = object->getTransform().getForwardVector(); + return forVec; +} + DefineConsoleMethod(Entity, setForwardVector, void, (VectorF newForward), (VectorF(0,0,0)), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") @@ -1936,4 +1824,14 @@ DefineConsoleMethod(Entity, rotateTo, void, (Point3F lookPosition, F32 degreePer "@return The number of static fields defined on the object.") { //object->setForwardVector(newForward); +} + +DefineConsoleMethod(Entity, notify, void, (String signalFunction, String argA, String argB, String argC, String argD, String argE), +("", "", "", "", "", ""), +"Triggers a signal call to all components for a certain function.") +{ + if (signalFunction == String("")) + return; + + object->notifyComponents(signalFunction, argA, argB, argC, argD, argE); } \ No newline at end of file diff --git a/Engine/source/T3D/entity.h b/Engine/source/T3D/entity.h index 52818f6f9..1f160e5a9 100644 --- a/Engine/source/T3D/entity.h +++ b/Engine/source/T3D/entity.h @@ -35,6 +35,12 @@ #ifndef _CONTAINERQUERY_H_ #include "T3D/containerQuery.h" #endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif +#ifndef GAME_OBJECT_ASSET_H +#include "T3D/assets/GameObjectAsset.h" +#endif class Component; @@ -56,6 +62,9 @@ private: bool mStartComponentUpdate; + StringTableEntry mGameObjectAssetId; + AssetPtr mGameObjectAsset; + ContainerQueryInfo containerInfo; bool mInitialized; @@ -98,7 +107,8 @@ public: BoundsMask = Parent::NextFreeMask << 1, ComponentsMask = Parent::NextFreeMask << 2, NoWarpMask = Parent::NextFreeMask << 3, - NextFreeMask = Parent::NextFreeMask << 4 + NamespaceMask = Parent::NextFreeMask << 4, + NextFreeMask = Parent::NextFreeMask << 5 }; StateDelta mDelta; @@ -123,16 +133,14 @@ public: virtual MatrixF getTransform(); virtual Point3F getPosition() const { return mPos; } - //void setTransform(Point3F position, RotationF rot); - - //void setRotation(RotationF rotation); - void setRotation(RotationF rotation) { mRot = rotation; setMaskBits(TransformMask); }; RotationF getRotation() { return mRot; } + static bool _setGameObject(void *object, const char *index, const char *data); + void setMountOffset(Point3F posOffset); void setMountRotation(EulerF rotOffset); @@ -146,13 +154,15 @@ public: virtual void getMountTransform(S32 index, const MatrixF &xfm, MatrixF *outMat); virtual void getRenderMountTransform(F32 delta, S32 index, const MatrixF &xfm, MatrixF *outMat); - void setForwardVector(VectorF newForward, VectorF upVector = VectorF::Zero); - virtual void mountObject(SceneObject *obj, S32 node, const MatrixF &xfm = MatrixF::Identity); void mountObject(SceneObject* objB, MatrixF txfm); void onMount(SceneObject *obj, S32 node); void onUnmount(SceneObject *obj, S32 node); + /// Sets the client controlling this object + /// @param client Client that is now controlling this object + virtual void setControllingClient(GameConnection *client); + // NetObject U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); void unpackUpdate(NetConnection *conn, BitStream *stream); @@ -163,6 +173,8 @@ public: //Components virtual bool deferAddingComponents() const { return true; } + void notifyComponents(String signalFunction, String argA, String argB, String argC, String argD, String argE); + template T* getComponent(); template From 0c21ef1b459ea8e4b38870dcb91e38b648498384 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 15 Oct 2017 06:03:59 -0500 Subject: [PATCH 043/312] Removes Entity/Component stuff from being behind an experimental flag. --- Engine/source/T3D/gameBase/gameConnection.cpp | 20 +- Engine/source/T3D/gameBase/processList.cpp | 4 - .../T3D/gameBase/std/stdGameProcess.cpp | 6 - .../source/gui/controls/guiTreeViewCtrl.cpp | 11 +- Engine/source/gui/editor/guiInspector.cpp | 4 - .../gui/editor/inspector/dynamicGroup.cpp | 5 +- Engine/source/scene/sceneRenderState.cpp | 4 - .../BaseGame/game/core/CoreComponents.module | 16 ++ .../components/RigidBodyComponent.asset.taml | 8 + .../components/animationComponent.asset.taml | 8 + .../cameraOrbiterComponent.asset.taml | 5 +- .../components/collisionComponent.asset.taml | 5 +- .../core}/components/game/camera.asset.taml | 6 +- .../game/core}/components/game/camera.cs | 153 +++++------ .../components/game/controlObject.asset.taml | 5 +- .../core}/components/game/controlObject.cs | 0 .../components/game/itemRotate.asset.taml | 5 +- .../game/core}/components/game/itemRotate.cs | 0 .../components/game/playerSpawner.asset.taml | 5 +- .../core}/components/game/playerSpawner.cs | 32 ++- .../components/input/fpsControls.asset.taml | 4 +- .../core}/components/input/fpsControls.cs | 0 .../core}/components/input/inputManager.cs | 0 .../core/components/meshComponent.asset.taml | 8 + .../playerControllerComponent.asset.taml | 5 +- .../core/components/soundComponent.asset.taml | 8 + .../stateMachineComponent.asset.taml | 5 +- Templates/Full/game/art/art.module.taml | 13 - .../shapes/actors/Soldier/soldier.asset.taml | 3 - .../Full/game/scripts/scripts.module.taml | 13 - .../components/animationComponent.asset.taml | 7 - .../components/meshComponent.asset.taml | 7 - .../server/gameObjects/GameObjectManager.cs | 123 --------- .../ThirdPersonPlayerObject.asset.taml | 5 - .../gameObjects/ThirdPersonPlayerObject.cs | 247 ------------------ .../gameObjects/ThirdPersonPlayerObject.taml | 98 ------- .../Full/game/scripts/server/scriptExec.cs | 20 -- Tools/CMake/torque3d.cmake | 50 +--- 38 files changed, 181 insertions(+), 737 deletions(-) create mode 100644 Templates/BaseGame/game/core/CoreComponents.module create mode 100644 Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml create mode 100644 Templates/BaseGame/game/core/components/animationComponent.asset.taml rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/cameraOrbiterComponent.asset.taml (58%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/collisionComponent.asset.taml (57%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/camera.asset.taml (65%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/camera.cs (56%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/controlObject.asset.taml (68%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/controlObject.cs (100%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/itemRotate.asset.taml (68%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/itemRotate.cs (100%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/playerSpawner.asset.taml (62%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/game/playerSpawner.cs (78%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/input/fpsControls.asset.taml (62%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/input/fpsControls.cs (100%) rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/input/inputManager.cs (100%) create mode 100644 Templates/BaseGame/game/core/components/meshComponent.asset.taml rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/playerControllerComponent.asset.taml (80%) create mode 100644 Templates/BaseGame/game/core/components/soundComponent.asset.taml rename Templates/{Full/game/scripts/server => BaseGame/game/core}/components/stateMachineComponent.asset.taml (59%) delete mode 100644 Templates/Full/game/art/art.module.taml delete mode 100644 Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml delete mode 100644 Templates/Full/game/scripts/scripts.module.taml delete mode 100644 Templates/Full/game/scripts/server/components/animationComponent.asset.taml delete mode 100644 Templates/Full/game/scripts/server/components/meshComponent.asset.taml delete mode 100644 Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs delete mode 100644 Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml delete mode 100644 Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs delete mode 100644 Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index d39b5c249..a0632511e 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -44,10 +44,8 @@ #include "console/engineAPI.h" #include "math/mTransform.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/entity.h" #include "T3D/components/coreInterfaces.h" -#endif #ifdef TORQUE_HIFI_NET #include "T3D/gameBase/hifi/hifiMoveList.h" @@ -785,7 +783,6 @@ bool GameConnection::getControlCameraFov(F32 * fov) } if (cObj) { -#ifdef TORQUE_EXPERIMENTAL_EC if (Entity* ent = dynamic_cast(cObj)) { if (CameraInterface* camInterface = ent->getComponent()) @@ -795,11 +792,9 @@ bool GameConnection::getControlCameraFov(F32 * fov) } else { - *fov = cObj->getCameraFov(); + *fov = cObj->getCameraFov(); } -#else - *fov = cObj->getCameraFov(); -#endif + return(true); } @@ -819,7 +814,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov) if (cObj) { -#ifdef TORQUE_EXPERIMENTAL_EC if (Entity* ent = dynamic_cast(cObj)) { if (CameraInterface* camInterface = ent->getComponent()) @@ -831,9 +825,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov) { return cObj->isValidCameraFov(fov); } -#else - return cObj->isValidCameraFov(fov); -#endif } return NULL; @@ -851,8 +842,6 @@ bool GameConnection::setControlCameraFov(F32 fov) } if (cObj) { - -#ifdef TORQUE_EXPERIMENTAL_EC F32 newFov = 90.f; if (Entity* ent = dynamic_cast(cObj)) { @@ -872,11 +861,6 @@ bool GameConnection::setControlCameraFov(F32 fov) cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov)); newFov = cObj->getCameraFov(); } -#else - // allow shapebase to clamp fov to its datablock values - cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov)); - F32 newFov = cObj->getCameraFov(); -#endif // server fov of client has 1degree resolution if( S32(newFov) != S32(mCameraFov) || newFov != fov ) diff --git a/Engine/source/T3D/gameBase/processList.cpp b/Engine/source/T3D/gameBase/processList.cpp index 1fef84fc2..13285caa1 100644 --- a/Engine/source/T3D/gameBase/processList.cpp +++ b/Engine/source/T3D/gameBase/processList.cpp @@ -32,10 +32,8 @@ #include "platform/profiler.h" #include "console/consoleTypes.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/coreInterfaces.h" #include "T3D/components/component.h" -#endif //---------------------------------------------------------------------------- ProcessObject::ProcessObject() @@ -277,12 +275,10 @@ void ProcessList::advanceObjects() onTickObject(pobj); } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { UpdateInterface::all[i]->processTick(); } -#endif mTotalTicks++; diff --git a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp index b9c3a27f1..1e9166316 100644 --- a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp +++ b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp @@ -37,10 +37,8 @@ #include "T3D/gameBase/std/stdMoveList.h" #include "T3D/fx/cameraFXMgr.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/coreInterfaces.h" #include "T3D/components/component.h" -#endif MODULE_BEGIN( ProcessList ) @@ -137,7 +135,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast(UpdateInterface::all[i]); @@ -147,7 +144,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) UpdateInterface::all[i]->interpolateTick(mLastDelta); } -#endif // Inform objects of total elapsed delta so they can advance // client side animations. @@ -163,7 +159,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast(UpdateInterface::all[i]); @@ -176,7 +171,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) UpdateInterface::all[i]->advanceTime(dt); } -#endif return ret; } diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 1c6343f04..9835c9858 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -36,9 +36,7 @@ #include "gui/editor/editorFunctions.h" #endif #include "console/engineAPI.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/entity.h" -#endif IMPLEMENT_CONOBJECT(GuiTreeViewCtrl); @@ -647,7 +645,6 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf) bool GuiTreeViewCtrl::Item::isParent() const { -#ifdef TORQUE_EXPERIMENTAL_EC //We might have a special case with entities //So if our entity either has children, or has some component with the EditorInspect interface, we return true if (mInspectorInfo.mObject) @@ -659,7 +656,6 @@ bool GuiTreeViewCtrl::Item::isParent() const return true; } } -#endif if(mState.test(VirtualParent)) { @@ -3790,7 +3786,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) if( !item->isInspectorData() && item->mState.test(Item::VirtualParent) ) onVirtualParentExpand(item); -#ifdef TORQUE_EXPERIMENTAL_EC //Slightly hacky, but I'm not sure of a better setup until we get major update to the editors //We check if our object is an entity, and if it is, we call a 'onInspect' function. //This function is pretty much a special notifier to the entity so if it has any behaviors that do special @@ -3810,7 +3805,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) } } } -#endif mFlags.set( RebuildVisible ); scrollVisible(item); @@ -4558,12 +4552,10 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item ) if ( !pItem ) continue; -#ifdef TORQUE_EXPERIMENTAL_EC //A bit hackish, but we make a special exception here for items that are named 'Components', as they're merely //virtual parents to act as a container to an Entity's components if (pItem->mScriptInfo.mText == StringTable->insert("Components")) continue; -#endif SimObject *pObj = pItem->getObject(); @@ -4628,11 +4620,10 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate) // Go through our items and purge those that have disappeared from // the set. -#ifdef TORQUE_EXPERIMENTAL_EC + //Entities will be a special case here, if we're an entity, skip this step if (dynamic_cast(srcObj)) return true; -#endif for( Item* ptr = item->mChild; ptr != NULL; ) { diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 77ab67365..086995529 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -29,11 +29,9 @@ #include "gui/containers/guiScrollCtrl.h" #include "gui/editor/inspector/customField.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "gui/editor/inspector/entityGroup.h" #include "gui/editor/inspector/mountingGroup.h" #include "gui/editor/inspector/componentGroup.h" -#endif IMPLEMENT_CONOBJECT(GuiInspector); @@ -589,7 +587,6 @@ void GuiInspector::refresh() mGroups.push_back(general); addObject(general); -#ifdef TORQUE_EXPERIMENTAL_EC //Entity inspector group if (mTargets.first()->getClassRep()->isSubclassOf("Entity")) { @@ -624,7 +621,6 @@ void GuiInspector::refresh() addObject(compGroup); } } -#endif // Create the inspector groups for static fields. diff --git a/Engine/source/gui/editor/inspector/dynamicGroup.cpp b/Engine/source/gui/editor/inspector/dynamicGroup.cpp index 78d8c4bd8..3d9879919 100644 --- a/Engine/source/gui/editor/inspector/dynamicGroup.cpp +++ b/Engine/source/gui/editor/inspector/dynamicGroup.cpp @@ -26,9 +26,7 @@ #include "gui/editor/inspector/dynamicField.h" #include "console/engineAPI.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/component.h" -#endif IMPLEMENT_CONOBJECT(GuiInspectorDynamicGroup); @@ -126,7 +124,6 @@ bool GuiInspectorDynamicGroup::inspectGroup() SimFieldDictionary * fieldDictionary = target->getFieldDictionary(); for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr) { -#ifdef TORQUE_EXPERIMENTAL_EC if (target->getClassRep()->isSubclassOf("Component")) { Component* compTarget = dynamic_cast(target); @@ -135,7 +132,7 @@ bool GuiInspectorDynamicGroup::inspectGroup() if (compField) continue; } -#endif + if( i == 0 ) { flist.increment(); diff --git a/Engine/source/scene/sceneRenderState.cpp b/Engine/source/scene/sceneRenderState.cpp index 325ba6a76..fa1966ab8 100644 --- a/Engine/source/scene/sceneRenderState.cpp +++ b/Engine/source/scene/sceneRenderState.cpp @@ -26,10 +26,8 @@ #include "renderInstance/renderPassManager.h" #include "math/util/matrixSet.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/render/renderComponentInterface.h" #include "T3D/components/component.h" -#endif //----------------------------------------------------------------------------- @@ -108,7 +106,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects ) object->prepRenderImage( this ); } -#ifdef TORQUE_EXPERIMENTAL_EC U32 interfaceCount = RenderComponentInterface::all.size(); for (U32 i = 0; i < RenderComponentInterface::all.size(); i++) { @@ -119,7 +116,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects ) RenderComponentInterface::all[i]->prepRenderImage(this); } } -#endif PROFILE_END(); diff --git a/Templates/BaseGame/game/core/CoreComponents.module b/Templates/BaseGame/game/core/CoreComponents.module new file mode 100644 index 000000000..7ca29196a --- /dev/null +++ b/Templates/BaseGame/game/core/CoreComponents.module @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml new file mode 100644 index 000000000..8e60db364 --- /dev/null +++ b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/BaseGame/game/core/components/animationComponent.asset.taml b/Templates/BaseGame/game/core/components/animationComponent.asset.taml new file mode 100644 index 000000000..771d38e02 --- /dev/null +++ b/Templates/BaseGame/game/core/components/animationComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml similarity index 58% rename from Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml rename to Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml index e03081564..b615f2348 100644 --- a/Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml @@ -1,7 +1,8 @@ + description="Acts as a boon arm for a camera component." /> diff --git a/Templates/Full/game/scripts/server/components/collisionComponent.asset.taml b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml similarity index 57% rename from Templates/Full/game/scripts/server/components/collisionComponent.asset.taml rename to Templates/BaseGame/game/core/components/collisionComponent.asset.taml index 9796df18d..1a4f99a0d 100644 --- a/Templates/Full/game/scripts/server/components/collisionComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables an entity to collide with things." /> diff --git a/Templates/Full/game/scripts/server/components/game/camera.asset.taml b/Templates/BaseGame/game/core/components/game/camera.asset.taml similarity index 65% rename from Templates/Full/game/scripts/server/components/game/camera.asset.taml rename to Templates/BaseGame/game/core/components/game/camera.asset.taml index 5d00d1170..0d55a74b4 100644 --- a/Templates/Full/game/scripts/server/components/game/camera.asset.taml +++ b/Templates/BaseGame/game/core/components/game/camera.asset.taml @@ -1,7 +1,9 @@ + scriptFile="core/components/game/camera.cs" + description="Allows the component owner to operate as a camera." /> diff --git a/Templates/Full/game/scripts/server/components/game/camera.cs b/Templates/BaseGame/game/core/components/game/camera.cs similarity index 56% rename from Templates/Full/game/scripts/server/components/game/camera.cs rename to Templates/BaseGame/game/core/components/game/camera.cs index 24363bd82..b6f510c9d 100644 --- a/Templates/Full/game/scripts/server/components/game/camera.cs +++ b/Templates/BaseGame/game/core/components/game/camera.cs @@ -100,97 +100,86 @@ function CameraComponent::onClientDisconnect(%this, %client) } } -//move to the editor later -GlobalActionMap.bind("keyboard", "alt c", "toggleEditorCam"); +/// +/// +/// -function switchCamera(%client, %newCamEntity) +function VRCameraComponent::onAdd(%this) { - if(!isObject(%client) || !isObject(%newCamEntity)) - return error("SwitchCamera: No client or target camera!"); - - %cam = %newCamEntity.getComponent(CameraComponent); - - if(!isObject(%cam)) - return error("SwitchCamera: Target camera doesn't have a camera behavior!"); - - //TODO: Cleanup clientOwner for previous camera! - if(%cam.clientOwner == 0 || %cam.clientOwner $= "") - %cam.clientOwner = 0; - - %cam.scopeToClient(%client); - %cam.setDirty(); - - %client.setCameraObject(%newCamEntity); - %client.setControlCameraFov(%cam.FOV); - - %client.camera = %newCamEntity; -} + %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", ""); -function buildEditorCamera() -{ - if(isObject("EditorCamera")) - return EditorCamera; - - %camObj = SGOManager.spawn("SpectatorObject", false); - - %camObj.name = "EditorCamera"; - - %client = ClientGroup.getObject(0); - - %camObj.getComponent(SpectatorControls).setupControls(%client); - - MissionCleanup.add(%camObj); - - return %camObj; -} + %test = %this.clientOwner; -//TODO: Move this somewhere else! -function toggleEditorCam(%val) -{ - if(!%val) - return; - - %client = ClientGroup.getObject(0); + %barf = ClientGroup.getCount(); - if(!isObject(%client.camera)) - return error("ToggleEditorCam: no existing camera!"); - - %editorCam = buildEditorCamera(); - - //if this is our first switch, just go to the editor camera - if(%client.lastCam $= "" || %client.camera.getId() != %editorCam.getId()) + %clientID = %this.getClientID(); + if(%clientID && !isObject(%clientID.camera)) { - if(%client.lastCam $= "") - { - //set up the position - %editorCam.position = %client.camera.position; - %editorCam.rotation = %client.camera.rotation; - } - - %client.lastCam = %client.camera; - %client.lastController = %client.getControlObject(); - switchCamera(%client, %editorCam); - switchControlObject(%client, %editorCam); - } - else - { - switchCamera(%client, %client.lastCam); - switchControlObject(%client, %client.lastController); - %client.lastCam = %editorCam; - %client.lastController = %editorCam; + %this.scopeToClient(%clientID); + %this.setDirty(); + + %clientID.setCameraObject(%this.owner); + %clientID.setControlCameraFov(%this.FOV); + + %clientID.camera = %this.owner; } + + %res = $pref::Video::mode; + %derp = 0; } -function serverCmdSetClientAspectRatio(%client, %width, %height) +function VRCameraComponent::onRemove(%this) { - echo("Client: " @ %client SPC "changing screen res to: " @ %width SPC %height); - %client.screenExtent = %width SPC %height; - %cam = %client.getCameraObject(); - - if(!isObject(%cam)) - return; - - %cameraComp = %cam.getComponent(CameraComponent); + %clientID = %this.getClientID(); + if(%clientID) + %clientID.clearCameraObject(); +} - %cameraComp.ScreenAspect = %width SPC %height; +function CameraComponent::onInspectorUpdate(%this) +{ + //if(%this.clientOwner) + //%this.clientOwner.setCameraObject(%this.owner); +} + +function VRCameraComponent::getClientID(%this) +{ + return ClientGroup.getObject(%this.clientOwner-1); +} + +function VRCameraComponent::isClientCamera(%this, %client) +{ + %clientID = ClientGroup.getObject(%this.clientOwner-1); + + if(%client.getID() == %clientID) + return true; + else + return false; +} + +function VRCameraComponent::onClientConnect(%this, %client) +{ + //if(%this.isClientCamera(%client) && !isObject(%client.camera)) + //{ + %this.scopeToClient(%client); + %this.setDirty(); + + %client.setCameraObject(%this.owner); + %client.setControlCameraFov(%this.FOV); + + %client.camera = %this.owner; + //} + //else + //{ + // echo("CONNECTED CLIENT IS NOT CAMERA OWNER!"); + //} +} + +function VRCameraComponent::onClientDisconnect(%this, %client) +{ + Parent::onClientDisconnect(%this, %client); + + if(isClientCamera(%client)){ + %this.clearScopeToClient(%client); + %client.clearCameraObject(); + } } \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/components/game/controlObject.asset.taml b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml similarity index 68% rename from Templates/Full/game/scripts/server/components/game/controlObject.asset.taml rename to Templates/BaseGame/game/core/components/game/controlObject.asset.taml index 2c9d48e1c..93f58119f 100644 --- a/Templates/Full/game/scripts/server/components/game/controlObject.asset.taml +++ b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml @@ -1,7 +1,10 @@ + scriptFile="core/components/game/controlObject.cs" + description="Allows the component owner to be controlled by a client." /> diff --git a/Templates/Full/game/scripts/server/components/game/controlObject.cs b/Templates/BaseGame/game/core/components/game/controlObject.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/game/controlObject.cs rename to Templates/BaseGame/game/core/components/game/controlObject.cs diff --git a/Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml similarity index 68% rename from Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml rename to Templates/BaseGame/game/core/components/game/itemRotate.asset.taml index 8068b49f3..806d0db19 100644 --- a/Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml +++ b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml @@ -1,7 +1,10 @@ + scriptFile="core/components/game/itemRotate.cs" + description="Rotates the entity around an axis, like an item pickup." /> diff --git a/Templates/Full/game/scripts/server/components/game/itemRotate.cs b/Templates/BaseGame/game/core/components/game/itemRotate.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/game/itemRotate.cs rename to Templates/BaseGame/game/core/components/game/itemRotate.cs diff --git a/Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml similarity index 62% rename from Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml rename to Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml index d181a86b4..bf2b872ef 100644 --- a/Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml +++ b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml @@ -1,7 +1,10 @@ + scriptFile="core/components/game/playerSpawner.cs" + description="When a client connects, it spawns a player object for them and attaches them to it." /> diff --git a/Templates/Full/game/scripts/server/components/game/playerSpawner.cs b/Templates/BaseGame/game/core/components/game/playerSpawner.cs similarity index 78% rename from Templates/Full/game/scripts/server/components/game/playerSpawner.cs rename to Templates/BaseGame/game/core/components/game/playerSpawner.cs index fb6507d08..a7387eaf1 100644 --- a/Templates/Full/game/scripts/server/components/game/playerSpawner.cs +++ b/Templates/BaseGame/game/core/components/game/playerSpawner.cs @@ -29,32 +29,40 @@ function PlayerSpawner::onAdd(%this) %this.friendlyName = "Player Spawner"; %this.componentType = "Spawner"; - %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", string, "PlayerObject"); + %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject"); } function PlayerSpawner::onClientConnect(%this, %client) { - %playerObj = SGOManager.spawn(%this.GameObjectName); + %playerObj = spawnGameObject(%this.GameObjectName, false); if(!isObject(%playerObj)) return; %playerObj.position = %this.owner.position; - MissionCleanup.add(%playerObj); - - for(%b = 0; %b < %playerObj.getComponentCount(); %b++) - { - %comp = %playerObj.getComponentByIndex(%b); - - if(%comp.isMethod("onClientConnect")) - %comp.onClientConnect(%client); - } + %playerObj.notify("onClientConnect", %client); switchControlObject(%client, %playerObj); switchCamera(%client, %playerObj); - //%playerObj.getComponent(FPSControls).setupControls(%client); + %client.player = %playerObj; + %client.camera = %playerObj; + + %inventory = %playerObj.getComponent(InventoryController); + + if(isObject(%inventory)) + { + for(%i=0; %i<5; %i++) + { + %arrow = spawnGameObject(ArrowProjectile, false); + + %inventory.addItem(%arrow); + } + } + + %playerObj.position = %this.owner.position; + %playerObj.rotation = "0 0 0"; %this.clientCount++; } diff --git a/Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml similarity index 62% rename from Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml rename to Templates/BaseGame/game/core/components/input/fpsControls.asset.taml index 34f31f181..cd0440055 100644 --- a/Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml +++ b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml @@ -1,7 +1,9 @@ + description="First Person Shooter-type controls." /> diff --git a/Templates/Full/game/scripts/server/components/input/fpsControls.cs b/Templates/BaseGame/game/core/components/input/fpsControls.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/input/fpsControls.cs rename to Templates/BaseGame/game/core/components/input/fpsControls.cs diff --git a/Templates/Full/game/scripts/server/components/input/inputManager.cs b/Templates/BaseGame/game/core/components/input/inputManager.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/input/inputManager.cs rename to Templates/BaseGame/game/core/components/input/inputManager.cs diff --git a/Templates/BaseGame/game/core/components/meshComponent.asset.taml b/Templates/BaseGame/game/core/components/meshComponent.asset.taml new file mode 100644 index 000000000..b41de171a --- /dev/null +++ b/Templates/BaseGame/game/core/components/meshComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml similarity index 80% rename from Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml rename to Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml index d5174644b..417f409e0 100644 --- a/Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables an entity to move like a player object." /> diff --git a/Templates/BaseGame/game/core/components/soundComponent.asset.taml b/Templates/BaseGame/game/core/components/soundComponent.asset.taml new file mode 100644 index 000000000..a29bcc9ff --- /dev/null +++ b/Templates/BaseGame/game/core/components/soundComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml similarity index 59% rename from Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml rename to Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml index a261bb194..ff1d53cd8 100644 --- a/Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables a state machine on the entity." /> diff --git a/Templates/Full/game/art/art.module.taml b/Templates/Full/game/art/art.module.taml deleted file mode 100644 index 73855c09e..000000000 --- a/Templates/Full/game/art/art.module.taml +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml b/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml deleted file mode 100644 index 4ba732205..000000000 --- a/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/Full/game/scripts/scripts.module.taml b/Templates/Full/game/scripts/scripts.module.taml deleted file mode 100644 index e1a6b57be..000000000 --- a/Templates/Full/game/scripts/scripts.module.taml +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/components/animationComponent.asset.taml b/Templates/Full/game/scripts/server/components/animationComponent.asset.taml deleted file mode 100644 index 62f15cdf9..000000000 --- a/Templates/Full/game/scripts/server/components/animationComponent.asset.taml +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/components/meshComponent.asset.taml b/Templates/Full/game/scripts/server/components/meshComponent.asset.taml deleted file mode 100644 index d019cd893..000000000 --- a/Templates/Full/game/scripts/server/components/meshComponent.asset.taml +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs b/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs deleted file mode 100644 index f0b618920..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- -function execGameObjects() -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(isFile(%gameObjectAsset.scriptFilePath)) - exec(%gameObjectAsset.scriptFilePath); - } -} - -function findGameObject(%name) -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return 0; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(%gameObjectAsset.gameObjectName $= %name) - { - if(isFile(%gameObjectAsset.TAMLFilePath)) - { - return %gameObjectAsset; - } - } - } - - return 0; -} - -function spawnGameObject(%name, %addToMissionGroup) -{ - if(%addToMissionGroup $= "") - %addToMissionGroup = true; - - %gameObjectAsset = findGameObject(%name); - - if(isObject(%gameObjectAsset)) - { - %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); - - if(%addToMissionGroup == true) //save instance when saving level - MissionGroup.add(%newSGOObject); - else // clear instance on level exit - MissionCleanup.add(%newSGOObject); - - return %newSGOObject; - } - - return 0; -} - -function saveGameObject(%name, %tamlPath, %scriptPath) -{ - %gameObjectAsset = findGameObject(%name); - - //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset - if(isObject(%gameObjectAsset)) - { - %assetID = %gameObjectAsset.getAssetId(); - - %gameObjectAsset.TAMLFilePath = %tamlPath; - %gameObjectAsset.scriptFilePath = %scriptPath; - - TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); - AssetDatabase.refreshAsset(%assetID); - } - else - { - //Doesn't exist, so make a new one - %gameObjectAsset = new GameObjectAsset() - { - assetName = %name @ "Asset"; - gameObjectName = %name; - TAMLFilePath = %tamlPath; - scriptFilePath = %scriptPath; - }; - - //Save it alongside the taml file - %path = filePath(%tamlPath); - - TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); - AssetDatabase.refreshAllAssets(true); - } -} \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml deleted file mode 100644 index 2d593a50b..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs deleted file mode 100644 index 3ab05a79d..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs +++ /dev/null @@ -1,247 +0,0 @@ -function ThirdPersonPlayerObject::onAdd(%this) -{ - %this.turnRate = 0.3; - - %this.phys = %this.getComponent("PlayerControllerComponent"); - %this.collision = %this.getComponent("CollisionComponent"); - %this.cam = %this.getComponent("CameraComponent"); - %this.camArm = %this.getComponent("CameraOrbiterComponent"); - %this.animation = %this.getComponent("AnimationComponent"); - %this.stateMachine = %this.getComponent("StateMachineComponent"); - %this.mesh = %this.getComponent("MeshComponent"); - - %this.stateMachine.forwardVector = 0; - - %this.crouch = false; - - %this.firstPerson = false; - - %this.crouchSpeedMod = 0.5; - - %this.aimOrbitDist = 1.5; - %this.regularOrbitDist = 5; - - %this.regularOrbitMaxPitch = 70; - %this.regularOrbitMinPitch = -10; - - %this.aimedMaxPitch = 90; - %this.aimedMinPitch = -90; -} - -function ThirdPersonPlayerObject::onRemove(%this) -{ - -} - -function ThirdPersonPlayerObject::moveVectorEvent(%this) -{ - %moveVector = %this.getMoveVector(); - - // forward of the camera on the x-z plane - %cameraForward = %this.cam.getForwardVector(); - - %cameraRight = %this.cam.getRightVector(); - - %moveVec = VectorAdd(VectorScale(%cameraRight, %moveVector.x), VectorScale(%cameraForward, %moveVector.y)); - - if(%this.aiming || %this.firstPerson) - { - %forMove = "0 0 0"; - - if(%moveVector.x != 0) - { - %this.phys.inputVelocity.x = %moveVector.x * 10; - } - else - { - %this.phys.inputVelocity.x = 0; - } - - if(%moveVector.y != 0) - { - - %this.phys.inputVelocity.y = %moveVector.y * 10; - } - else - { - %this.phys.inputVelocity.y = 0; - } - } - else - { - if(%moveVec.x == 0 && %moveVec.y == 0) - { - %this.phys.inputVelocity = "0 0 0"; - %this.stateMachine.forwardVector = 0; - } - else - { - %moveVec.z = 0; - - %curForVec = %this.getForwardVector(); - - %newForVec = VectorLerp(%curForVec, %moveVec, %this.turnRate); - - %this.setForwardVector(%newForVec); - - %this.phys.inputVelocity.y = 10; - - %this.stateMachine.forwardVector = 1; - } - } - - if(%this.crouch) - %this.phys.inputVelocity = VectorScale(%this.phys.inputVelocity, %this.crouchSpeedMod); -} - -function ThirdPersonPlayerObject::moveYawEvent(%this) -{ - %moveRotation = %this.getMoveRotation(); - - %camOrb = %this.getComponent("CameraOrbiterComponent"); - - if(%this.aiming || %this.firstPerson) - { - %this.rotation.z += %moveRotation.z * 10; - } - - %camOrb.rotation.z += %moveRotation.z * 10; -} - -function ThirdPersonPlayerObject::movePitchEvent(%this) -{ - %moveRotation = %this.getMoveRotation(); - - %camOrb = %this.getComponent("CameraOrbiterComponent"); - - %camOrb.rotation.x += %moveRotation.x * 10; -} - -function ThirdPersonPlayerObject::moveRollEvent(%this){} - -function ThirdPersonPlayerObject::moveTriggerEvent(%this, %triggerNum, %triggerValue) -{ - if(%triggerNum == 3 && %triggerValue) - { - if(%triggerValue) - { - %this.firstPerson = !%this.firstPerson; - - if(%this.firstPerson) - { - %this.rotation.z = %this.cam.rotationOffset.z; - %this.camArm.orbitDistance = 0; - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - - %this.cam.positionOffset = "0 0 0"; - %this.cam.rotationOffset = "0 0 0"; - } - else if(%this.aiming) - { - %this.camArm.orbitDistance = %this.aimOrbitDist; - - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - } - else - { - %this.camArm.orbitDistance = %this.regularOrbitDist; - - %this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch; - %this.camArm.minPitchAngle = %this.regularOrbitMinPitch; - } - - commandToClient(localclientConnection, 'SetClientRenderShapeVisibility', - localclientConnection.getGhostID(%this.getComponent("MeshComponent")), !%this.firstPerson); - } - } - else if(%triggerNum == 2 && %triggerValue == true) - { - //get our best collision assuming up is 0 0 1 - %collisionAngle = %this.collision.getBestCollisionAngle("0 0 1"); - - if(%collisionAngle >= 80) - { - %surfaceNormal = %this.collision.getCollisionNormal(0); - %jumpVector = VectorScale(%surfaceNormal, 200); - echo("Jump surface Angle is at: " @ %surfaceNormal); - - %this.phys.applyImpulse(%this.position, %jumpVector); - %this.setForwardVector(%jumpVector); - } - else - %this.phys.applyImpulse(%this.position, "0 0 300"); - } - else if(%triggerNum == 4) - { - %this.crouch = %triggerValue; - } - else if(%triggerNum == 1) - { - %this.aiming = %triggerValue; - - if(%this.aiming) - { - %this.rotation.z = %this.cam.rotationOffset.z; - %this.camArm.orbitDistance = %this.aimOrbitDist; - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - } - else - { - %this.camArm.orbitDistance = %this.regularOrbitDist; - %this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch; - %this.camArm.minPitchAngle = %this.regularOrbitMinPitch; - } - } -} - -function ThirdPersonPlayerObject::onCollisionEvent(%this, %colObject, %colNormal, %colPoint, %colMatID, %velocity) -{ - if(!%this.phys.isContacted()) - echo(%this @ " collided with " @ %colObject); -} - -function ThirdPersonPlayerObject::processTick(%this) -{ - %moveVec = %this.getMoveVector(); - %bestFit = ""; - - if(%this.crouch) - { - if(%moveVec.x != 0 || %moveVec.y != 0) - %bestFit = "Crouch_Forward"; - else - %bestFit = "Crouch_Root"; - } - else - { - if(%moveVec.x != 0 || %moveVec.y != 0) - %bestFit = "Run"; - else - %bestFit = "Root"; - } - - if(%this.animation.getThreadAnimation(0) !$= %bestFit) - %this.animation.playThread(0, %bestFit); -} - -//Used for first person mode -function clientCmdSetClientRenderShapeVisibility(%id, %visiblilty) -{ - %localID = ServerConnection.resolveGhostID(%id); - %localID.enabled = %visiblilty; -} - -function serverToClientObject( %serverObject ) -{ - assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); - assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); - - %ghostId = LocalClientConnection.getGhostId( %serverObject ); - if ( %ghostId == -1 ) - return 0; - - return ServerConnection.resolveGhostID( %ghostId ); -} \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml deleted file mode 100644 index df2397bb5..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - diff --git a/Templates/Full/game/scripts/server/scriptExec.cs b/Templates/Full/game/scripts/server/scriptExec.cs index f6eb29b7d..a61204040 100644 --- a/Templates/Full/game/scripts/server/scriptExec.cs +++ b/Templates/Full/game/scripts/server/scriptExec.cs @@ -58,23 +58,3 @@ exec("./turret.cs"); // Load our gametypes exec("./gameCore.cs"); // This is the 'core' of the gametype functionality. exec("./gameDM.cs"); // Overrides GameCore with DeathMatch functionality. - -//Entity/Component stuff -if(isFile("./components/game/camera.cs")) - exec("./components/game/camera.cs"); -if(isFile("./components/game/controlObject.cs")) - exec("./components/game/controlObject.cs"); -if(isFile("./components/game/itemRotate.cs")) - exec("./components/game/itemRotate.cs"); -if(isFile("./components/game/playerSpawner.cs")) - exec("./components/game/playerSpawner.cs"); -if(isFile("./components/input/fpsControls.cs")) - exec("./components/input/fpsControls.cs"); -if(isFile("./components/input/inputManager.cs")) - exec("./components/input/inputManager.cs"); - -if(isFile("./gameObjects/GameObjectManager.cs")) -{ - exec("./gameObjects/GameObjectManager.cs"); - execGameObjects(); -} diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 63209ae97..80b6e60b0 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -143,9 +143,6 @@ if(WIN32) option(TORQUE_D3D11 "Allow Direct3D 11 render" ON) endif() -option(TORQUE_EXPERIMENTAL_EC "Experimental Entity/Component systems" OFF) -mark_as_advanced(TORQUE_EXPERIMENTAL_EC) - option(TORQUE_DEDICATED "Torque dedicated" OFF) mark_as_advanced(TORQUE_DEDICATED) @@ -316,9 +313,6 @@ addPath("${srcDir}/physics") addPath("${srcDir}/gui/3d") addPath("${srcDir}/postFx") -if(NOT TORQUE_EXPERIMENTAL_EC) - set(BLACKLIST "entity.cpp;entity.h" ) -endif() addPath("${srcDir}/T3D") set(BLACKLIST "" ) @@ -331,16 +325,13 @@ addPath("${srcDir}/T3D/decal") addPath("${srcDir}/T3D/sfx") addPath("${srcDir}/T3D/gameBase") addPath("${srcDir}/T3D/turret") - -if( TORQUE_EXPERIMENTAL_EC ) - addPath("${srcDir}/T3D/components/") - addPath("${srcDir}/T3D/components/animation") - addPath("${srcDir}/T3D/components/camera") - addPath("${srcDir}/T3D/components/collision") - addPath("${srcDir}/T3D/components/game") - addPath("${srcDir}/T3D/components/physics") - addPath("${srcDir}/T3D/components/render") -endif() +addPath("${srcDir}/T3D/components/") +addPath("${srcDir}/T3D/components/animation") +addPath("${srcDir}/T3D/components/camera") +addPath("${srcDir}/T3D/components/collision") +addPath("${srcDir}/T3D/components/game") +addPath("${srcDir}/T3D/components/physics") +addPath("${srcDir}/T3D/components/render") addPath("${srcDir}/main/") addPath("${srcDir}/assets") @@ -422,9 +413,6 @@ if(TORQUE_TOOLS) addPath("${srcDir}/environment/editors") addPath("${srcDir}/forest/editor") addPath("${srcDir}/gui/editor") - if(NOT TORQUE_EXPERIMENTAL_EC) - set(BLACKLIST "entityGroup.cpp;entityGroup.h;mountingGroup.cpp;mountingGroup.h;componentGroup.cpp;componentGroup.h" ) - endif() addPath("${srcDir}/gui/editor/inspector") set(BLACKLIST "" ) endif() @@ -502,10 +490,6 @@ if(TORQUE_DEDICATED) addDef(TORQUE_DEDICATED) endif() -if(TORQUE_EXPERIMENTAL_EC) - addDef(TORQUE_EXPERIMENTAL_EC) -endif() - #modules dir file(GLOB modules "modules/*.cmake") foreach(module ${modules}) @@ -855,26 +839,6 @@ if(TORQUE_TEMPLATE) message("Prepare Template(${TORQUE_TEMPLATE}) install...") file(GLOB_RECURSE INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/*") - IF( NOT TORQUE_EXPERIMENTAL_EC) - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/art.module.taml") - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/shapes/actors/Soldier/soldier.asset.taml") - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/scripts.module.taml") - - foreach(ITEM ${INSTALL_FILES_AND_DIRS}) - get_filename_component( dir ${ITEM} DIRECTORY ) - get_filename_component( fileName ${ITEM} NAME ) - if( ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/game - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/input - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/gameObjects - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/gui - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/scripts ) - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS ${dir}/${fileName}) - ENDIF() - endforeach() - ENDIF() - foreach(ITEM ${INSTALL_FILES_AND_DIRS}) get_filename_component( dir ${ITEM} DIRECTORY ) STRING(REGEX REPLACE "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/" "${TORQUE_APP_DIR}/" INSTALL_DIR ${dir}) From e6755c4b611bd92eee4763f67e919e56f3e237e5 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 17 Oct 2017 14:55:57 -0500 Subject: [PATCH 044/312] Update libPNG to latest build. --- Engine/lib/lpng/ANNOUNCE | 83 +++++-- Engine/lib/lpng/CHANGES | 293 ++++++++++++++++++++++++- Engine/lib/lpng/CMakeLists.txt | 233 ++++++++++++++++---- Engine/lib/lpng/INSTALL | 71 +++++- Engine/lib/lpng/LICENSE | 9 +- Engine/lib/lpng/README | 18 +- Engine/lib/lpng/TODO | 4 +- Engine/lib/lpng/configure | 19 -- Engine/lib/lpng/libpng-manual.txt | 137 ++++++++---- Engine/lib/lpng/libpng.3 | 174 ++++++++++----- Engine/lib/lpng/libpng.pc.in | 1 + Engine/lib/lpng/libpngpf.3 | 8 +- Engine/lib/lpng/png.5 | 10 +- Engine/lib/lpng/png.c | 159 ++++++++++---- Engine/lib/lpng/png.h | 74 ++++--- Engine/lib/lpng/pngconf.h | 6 +- Engine/lib/lpng/pngerror.c | 10 +- Engine/lib/lpng/pngget.c | 35 ++- Engine/lib/lpng/pnginfo.h | 8 + Engine/lib/lpng/pngmem.c | 4 +- Engine/lib/lpng/pngpread.c | 12 +- Engine/lib/lpng/pngpriv.h | 345 +++++++++++++++++++++--------- Engine/lib/lpng/pngread.c | 89 ++++---- Engine/lib/lpng/pngrtran.c | 54 +++-- Engine/lib/lpng/pngrutil.c | 325 ++++++++++++++++++++-------- Engine/lib/lpng/pngset.c | 101 +++++++-- Engine/lib/lpng/pngstruct.h | 8 +- Engine/lib/lpng/pngtest.c | 199 +++++++++++------ Engine/lib/lpng/pngtrans.c | 42 ++-- Engine/lib/lpng/pngwrite.c | 75 ++++--- Engine/lib/lpng/pngwtran.c | 4 +- Engine/lib/lpng/pngwutil.c | 83 ++++--- 32 files changed, 1974 insertions(+), 719 deletions(-) diff --git a/Engine/lib/lpng/ANNOUNCE b/Engine/lib/lpng/ANNOUNCE index 330fd1078..3cbe5a926 100644 --- a/Engine/lib/lpng/ANNOUNCE +++ b/Engine/lib/lpng/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.25 - September 1, 2016 +Libpng 1.6.32 - August 24, 2017 This is a public release of libpng, intended for use in production codes. @@ -7,30 +7,81 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.6.25.tar.xz (LZMA-compressed, recommended) - libpng-1.6.25.tar.gz + libpng-1.6.32.tar.xz (LZMA-compressed, recommended) + libpng-1.6.32.tar.gz Source files with CRLF line endings (for Windows), without the "configure" script - lpng1625.7z (LZMA-compressed, recommended) - lpng1625.zip + lpng1632.7z (LZMA-compressed, recommended) + lpng1632.zip Other information: - libpng-1.6.25-README.txt - libpng-1.6.25-LICENSE.txt - libpng-1.6.25-*.asc (armored detached GPG signatures) + libpng-1.6.32-README.txt + libpng-1.6.32-LICENSE.txt + libpng-1.6.32-*.asc (armored detached GPG signatures) -Changes since the last public release (1.6.24): - Reject oversized iCCP profile immediately. - Cleaned up PNG_DEBUG compile of pngtest.c. - Conditionally compile png_inflate(). - Don't install pngcp; it conflicts with pngcp in the pngtools package. - Minor editing of INSTALL, (whitespace, added copyright line) - Added MIPS support (Mandar Sahastrabuddhe ). - Rebased contrib/intel/intel_sse.patch after the MIPS implementation. +Changes since the last public release (1.6.31): + Avoid possible NULL dereference in png_handle_eXIf when benign_errors + are allowed. Avoid leaking the input buffer "eXIf_buf". + Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif + to arguments for png_get_eXIf() and png_set_eXIf(). + Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in + pngwrite.c, and made various other fixes to png_write_eXIf(). + Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and + png_set_eXIf_1(), respectively, to avoid breaking API compatibility + with libpng-1.6.31. + Updated contrib/libtests/pngunknown.c with eXIf chunk. + Initialized btoa[] in pngstest.c + Stop memory leak when returning from png_handle_eXIf() with an error + (Bug report from the OSS-fuzz project). + Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Update libpng.3 and libpng-manual.txt about eXIf functions. + Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. + Removed png_get_eXIf_1() and png_set_eXIf_1(). + Check length of all chunks except IDAT against user limit to fix an + OSS-fuzz issue. + Check length of IDAT against maximum possible IDAT size, accounting + for height, rowbytes, interlacing and zlib/deflate overhead. + Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf) + does not work (the eXIf chunk data can contain zeroes). + Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation, + no longer using deprecated cmake LOCATION feature (Clifford Yapp). + Fixed five-byte error in the calculation of IDAT maximum possible size. + Moved chunk-length check into a png_check_chunk_length() private + function (Suggested by Max Stepin). + Moved bad pngs from tests to contrib/libtests/crashers + Moved testing of bad pngs into a separate tests/pngtest-badpngs script + Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL + in the output but PASS for the libpng test. + Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp). + Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the + num_exif argument to png_get_eXIf_1() (Github Issue 171). + Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks(). + Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers. + Make pngtest --strict, --relax, --xfail options imply -m (multiple). + Removed unused chunk_name parameter from png_check_chunk_length(). + Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak. + Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue. + Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR. + Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue. + Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account + for the minimum 'deflate' stream, and relocate the test to a point + after the keyword has been read. + Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM". + Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers, + one for each known chunk type, with length = 2GB-1. + Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts + in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706, + and 162707). + Renamed chunks in contrib/testpngs/crashers to avoid having files whose + names differ only in case; this causes problems with some platforms + (github issue #172). + Added contrib/oss-fuzz directory which contains files used by the oss-fuzz + project (https://github.com/google/oss-fuzz/tree/master/projects/libpng). +Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe) diff --git a/Engine/lib/lpng/CHANGES b/Engine/lib/lpng/CHANGES index 923fc5054..14e60dd26 100644 --- a/Engine/lib/lpng/CHANGES +++ b/Engine/lib/lpng/CHANGES @@ -593,7 +593,7 @@ Version 1.0.5e [November 30, 1999] with trailing compressed parts easier in the future, and added new functions png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP, png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond). - NOTE: Applications that write text chunks MUST define png_text->lang + NOTE: Applications that write text chunks MUST define png_text->lang before calling png_set_text(). It must be set to NULL if you want to write tEXt or zTXt chunks. If you want your application to be able to run with older versions of libpng, use @@ -5703,6 +5703,297 @@ Version 1.6.25rc05 [August 30, 2016] Version 1.6.25 [September 1, 2016] No changes. +Version 1.6.26beta01 [September 26, 2016] + Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo, + bugfix by John Bowler). + Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL + has allocated memory that libpng needs to free. + Conditionally compile png_set_benign_errors() in pngread.c and pngtest.c + Issue a png_benign_error instead of a png_error on ADLER32 mismatch + while decoding compressed data chunks. + Changed PNG_ZLIB_VERNUM to ZLIB_VERNUM in pngpriv.h, pngstruct.h, and + pngrutil.c. + If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE, + ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs. + Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error(). + Add tests/badcrc.png and tests/badadler.png to tests/pngtest. + Merged pngtest.c with libpng-1.7.0beta84/pngtest.c + +Version 1.6.26beta02 [October 1, 2016] + Updated the documentation about CRC and ADLER32 handling. + Quieted 117 warnings from clang-3.8 in pngtrans.c, pngread.c, + pngwrite.c, pngunknown.c, and pngvalid.c. + Quieted 58 (out of 144) -Wconversion compiler warnings by changing + flag definitions in pngpriv.h from 0xnnnn to 0xnnnnU and trivial changes + in png.c, pngread.c, and pngwutil.c. + +Version 1.6.26beta03 [October 2, 2016] + Removed contrib/libtests/*.orig and *.rej that slipped into the tarballs. + Quieted the 86 remaining -Wconversion compiler warnings by + revising the png_isaligned() macro and trivial changes in png.c, + pngerror.c, pngget.c, pngmem.c, pngset.c, pngrtran.c, pngrutil.c, + pngwtran.c, pngwrite.c, and pngwutil.c. + +Version 1.6.26beta04 [October 3, 2016] + Quieted (bogus?) clang warnings about "absolute value has no effect" + when PNG_USE_ABS is defined. + Fixed offsets in contrib/intel/intel_sse.patch + +Version 1.6.26beta05 [October 6, 2016] + Changed integer constant 4294967294 to unsigned 4294967294U in pngconf.h + to avoid a signed/unsigned compare in the preprocessor. + +Version 1.6.26beta06 [October 7, 2016] + Use zlib-1.2.8.1 inflateValidate() instead of inflateReset2() to + optionally avoid ADLER32 evaluation. + +Version 1.6.26rc01 [October 12, 2016] + No changes. + +Version 1.6.26 [October 20, 2016] + Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c + Despammed email addresses (replaced "@" with " at "). + +Version 1.6.27beta01 [November 2, 2016] + Restrict the new ADLER32-skipping to IDAT chunks. It broke iCCP chunk + handling: an erroneous iCCP chunk would throw a png_error and reject the + entire PNG image instead of rejecting just the iCCP chunk with a warning, + if built with zlib-1.2.8.1. + +Version 1.6.27rc01 [December 27, 2016] + Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Fixes + an endless loop when handling erroneous ADLER32 checksums; bug + introduced in libpng-1.6.26. + Removed the use of a macro containing the pre-processor 'defined' + operator. It is unclear whether this is valid; a macro that + "generates" 'defined' is not permitted, but the use of the word + "generates" within the C90 standard seems to imply more than simple + substitution of an expression itself containing a well-formed defined + operation. + Added ARM support to CMakeLists.txt (Andreas Franek). + +Version 1.6.27 [December 29, 2016] + Fixed a potential null pointer dereference in png_set_text_2() (bug report + and patch by Patrick Keshishian, CVE-2016-10087). + +Version 1.6.28rc01 [January 3, 2017] + Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna). + Added option to Cmake build allowing a custom location of zlib to be + specified in a scenario where libpng is being built as a subproject + alongside zlib by another project (Sam Serrels). + Changed png_ptr->options from a png_byte to png_uint_32, to accomodate + up to 16 options. + +Version 1.6.28rc02 [January 4, 2017] + Added "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna). + Moved SSE2 optimization code into the main libpng source directory. + Configure libpng with "configure --enable-intel-sse" or compile + libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it. + +Version 1.6.28rc03 [January 4, 2017] + Backed out the SSE optimization and last CMakeLists.txt to allow time for QA. + +Version 1.6.28 [January 5, 2017] + No changes. + +Version 1.6.29beta01 [January 12, 2017] + Readded "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna). + Moved SSE2 optimization code into the main libpng source directory. + Configure libpng with "configure --enable-intel-sse" or compile + libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it. + Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt). + +Version 1.6.29beta02 [February 22, 2017] + Avoid conditional directives that break statements in pngrutil.c (Romero + Malaquias) + The contrib/examples/pngtopng.c recovery code was in the wrong "if" + branches; the comments were correct. + Added code for PowerPC VSX optimisation (Vadim Barkov). + +Version 1.6.29beta03 [March 1, 2017] + Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer). + Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c + because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1, + as suggested in zlib FAQ, item 24. + Suppress clang warnings about implicit sign changes in png.c + +Version 1.6.29 [March 16, 2017] + No changes. + +Version 1.6.30beta01 [April 1, 2017] + Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in + makefile.linux and makefile.solaris-x86 (Cosmin). + Revised documentation of png_get_error_ptr() in the libpng manual. + Silence clang -Wcomma and const drop warnings (Viktor Szakats). + Update Sourceforge URLs in documentation (https instead of http). + +Version 1.6.30beta02 [April 22, 2017] + Document need to check for integer overflow when allocating a pixel + buffer for multiple rows in contrib/gregbook, contrib/pngminus, + example.c, and in the manual (suggested by Jaeseung Choi). This + is similar to the bug reported against pngquant in CVE-2016-5735. + Removed reference to the obsolete PNG_SAFE_LIMITS macro in the documentation. + +Version 1.6.30beta03 [May 22, 2017] + Check for integer overflow in contrib/visupng and contrib/tools/genpng. + Do not double evaluate CMAKE_SYSTEM_PROCESSOR in CMakeLists.txt. + Test CMAKE_HOST_WIN32 instead of WIN32 in CMakeLists.txt. + Fix some URL in documentation. + +Version 1.6.30beta04 [June 7, 2017] + Avoid writing an empty IDAT when the last IDAT exactly fills the + compression buffer (bug report by Brian Baird). This bug was + introduced in libpng-1.6.0. + +Version 1.6.30rc01 [June 14, 2017] + No changes. + +Version 1.6.30rc02 [June 25, 2017] + Update copyright year in pnglibconf.h, make ltmain.sh executable. + Add a reference to the libpng.download site in README. + +Version 1.6.30 [June 28, 2017] + No changes. + +Version 1.6.31beta01 [July 5, 2017] + Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it; + bug report by Michael Felt). + Revised pngpriv.h to work around failure to compile arm/filter_neon.S + ("typedef" directive is unrecognized by the assembler). The problem + was introduced in libpng-1.6.30beta01. + Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx). + Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish). + +Version 1.6.31beta02 [July 8, 2017] + Added instructions for disabling hardware optimizations in INSTALL. + Added "--enable-hardware-optimizations" configuration flag to enable + or disable all hardware optimizations with one flag. + +Version 1.6.31beta03 [July 9, 2017] + Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms. + Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent + possible integer overflow (Bug report by John Bowler). + Quieted "declaration after statement" warnings in intel/filter_sse2.c. + Added scripts/makefile-linux-opt, which has hardware optimizations enabled. + +Version 1.6.31beta04 [July 11, 2017] + Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when + integers appear on both sides of a compare. Worked around the others by + forcing the strict-overflow setting in the relevant functions to a level + where they are not reported (John Bowler). + Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like + the space. + Worked around some C-style casts from (void*) because g++ 5.4.0 objects + to them. + Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint + overflow' check that is on by default with -Wall -Wextra. + +Version 1.6.31beta05 [July 13, 2017] + Added eXIf chunk support. + +Version 1.6.31beta06 [July 17, 2017] + Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm + tags) to pngtest.png. + +Version 1.6.31beta07 [July 18, 2017] + Revised the eXIf chunk in pngtest.png to fix "Bad IFD1 Directory" warning. + +Version 1.6.31rc01 [July 19, 2017] + No changes. + +Version 1.6.31rc02 [July 25, 2017] + Fixed typo in example.c (png_free_image should be png_image_free) (Bug + report by John Smith) + +Version 1.6.31 [July 27, 2017] + No changes. + +Version 1.6.32beta01 [July 31, 2017] + Avoid possible NULL dereference in png_handle_eXIf when benign_errors + are allowed. Avoid leaking the input buffer "eXIf_buf". + Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif + to arguments for png_get_eXIf() and png_set_eXIf(). + Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in + pngwrite.c, and made various other fixes to png_write_eXIf(). + Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and + png_set_eXIf_1(), respectively, to avoid breaking API compatibility + with libpng-1.6.31. + +Version 1.6.32beta02 [August 1, 2017] + Updated contrib/libtests/pngunknown.c with eXIf chunk. + +Version 1.6.32beta03 [August 2, 2017] + Initialized btoa[] in pngstest.c + Stop memory leak when returning from png_handle_eXIf() with an error + (Bug report from the OSS-fuzz project). + +Version 1.6.32beta04 [August 2, 2017] + Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). + Update libpng.3 and libpng-manual.txt about eXIf functions. + +Version 1.6.32beta05 [August 2, 2017] + Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. + +Version 1.6.32beta06 [August 2, 2017] + Removed png_get_eXIf_1() and png_set_eXIf_1(). + +Version 1.6.32beta07 [August 3, 2017] + Check length of all chunks except IDAT against user limit to fix an + OSS-fuzz issue. + +Version 1.6.32beta08 [August 3, 2017] + Check length of IDAT against maximum possible IDAT size, accounting + for height, rowbytes, interlacing and zlib/deflate overhead. + Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf) + does not work (the eXIf chunk data can contain zeroes). + +Version 1.6.32beta09 [August 3, 2017] + Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation, + no longer using deprecated cmake LOCATION feature (Clifford Yapp). + Fixed five-byte error in the calculation of IDAT maximum possible size. + +Version 1.6.32beta10 [August 5, 2017] + Moved chunk-length check into a png_check_chunk_length() private + function (Suggested by Max Stepin). + Moved bad pngs from tests to contrib/libtests/crashers + Moved testing of bad pngs into a separate tests/pngtest-badpngs script + Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL + in the output but PASS for the libpng test. + Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp). + Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the + num_exif argument to png_get_eXIf_1() (Github Issue 171). + +Version 1.6.32beta11 [August 7, 2017] + Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks(). + Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers. + Make pngtest --strict, --relax, --xfail options imply -m (multiple). + Removed unused chunk_name parameter from png_check_chunk_length(). + Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak. + Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue. + Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR. + Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue. + Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account + for the minimum 'deflate' stream, and relocate the test to a point + after the keyword has been read. + Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM". + +Version 1.6.32rc01 [August 18, 2017] + Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers, + one for each known chunk type, with length = 2GB-1. + Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts + in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706, + and 162707). + Renamed chunks in contrib/testpngs/crashers to avoid having files whose + names differ only in case; this causes problems with some platforms + (github issue #172). + +Version 1.6.32rc02 [August 22, 2017] + Added contrib/oss-fuzz directory which contains files used by the oss-fuzz + project (https://github.com/google/oss-fuzz/tree/master/projects/libpng). + +Version 1.6.32 [August 24, 2017] + No changes. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/Engine/lib/lpng/CMakeLists.txt b/Engine/lib/lpng/CMakeLists.txt index eb63b2bfe..7a51f0064 100644 --- a/Engine/lib/lpng/CMakeLists.txt +++ b/Engine/lib/lpng/CMakeLists.txt @@ -1,17 +1,18 @@ # CMakeLists.txt -# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson +# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson # Written by Christian Ehrlicher, 2007 # Revised by Roger Lowman, 2009-2010 # Revised by Clifford Yapp, 2011-2012 # Revised by Roger Leigh, 2016 +# Revised by Andreas Franek, 2016 # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer # and license in png.h -cmake_minimum_required(VERSION 2.8.3) -cmake_policy(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.0.2) +cmake_policy(VERSION 3.0.2) # Set MacOSX @rpath usage globally. if (POLICY CMP0020) @@ -35,13 +36,22 @@ enable_testing() set(PNGLIB_MAJOR 1) set(PNGLIB_MINOR 6) -set(PNGLIB_RELEASE 25) +set(PNGLIB_RELEASE 32) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) +include(GNUInstallDirs) + # needed packages -find_package(ZLIB REQUIRED) -include_directories(${ZLIB_INCLUDE_DIR}) + +#Allow users to specify location of Zlib, +# Useful if zlib is being built alongside this as a sub-project +option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" OFF) + +IF(NOT PNG_BUILD_ZLIB) + find_package(ZLIB REQUIRED) + include_directories(${ZLIB_INCLUDE_DIR}) +ENDIF(NOT PNG_BUILD_ZLIB) if(NOT WIN32) find_library(M_LIBRARY @@ -66,9 +76,116 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF) option(PNG_DEBUG "Build with debug output" OFF) option(PNGARG "Disable ANSI-C prototypes" OFF) +option(PNG_HARDWARE_OPTIMIZATIONS "Enable Hardware Optimizations" ON) + + set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names") set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings") +if(PNG_HARDWARE_OPTIMIZATIONS) +# set definitions and sources for arm +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") + set(PNG_ARM_NEON_POSSIBLE_VALUES check on off) + set(PNG_ARM_NEON "check" CACHE STRING "Enable ARM NEON optimizations: + check: (default) use internal checking code; + off: disable the optimizations; + on: turn on unconditionally.") + set_property(CACHE PNG_ARM_NEON PROPERTY STRINGS + ${PNG_ARM_NEON_POSSIBLE_VALUES}) + list(FIND PNG_ARM_NEON_POSSIBLE_VALUES ${PNG_ARM_NEON} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_ARM_NEON must be one of [${PNG_ARM_NEON_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_ARM_NEON} STREQUAL "no") + set(libpng_arm_sources + arm/arm_init.c + arm/filter_neon.S + arm/filter_neon_intrinsics.c) + + if(${PNG_ARM_NEON} STREQUAL "on") + add_definitions(-DPNG_ARM_NEON_OPT=2) + elseif(${PNG_ARM_NEON} STREQUAL "check") + add_definitions(-DPNG_ARM_NEON_CHECK_SUPPORTED) + endif() + else() + add_definitions(-DPNG_ARM_NEON_OPT=0) + endif() +endif() + +# set definitions and sources for powerpc +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*" ) + set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off) + set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations: + off: disable the optimizations.") + set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS + ${PNG_POWERPC_VSX_POSSIBLE_VALUES}) + list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_POWERPC_VSX must be one of [${PNG_POWERPC_VSX_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_POWERPC_VSX} STREQUAL "no") + set(libpng_powerpc_sources + powerpc/powerpc_init.c + powerpc/filter_vsx_intrinsics.c) + if(${PNG_POWERPC_VSX} STREQUAL "on") + add_definitions(-DPNG_POWERPC_VSX_OPT=2) + endif() + else() + add_definitions(-DPNG_POWERPC_VSX_OPT=0) + endif() +endif() + +# set definitions and sources for intel +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*" ) + set(PNG_INTEL_SSE_POSSIBLE_VALUES on off) + set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations: + off: disable the optimizations") + set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS + ${PNG_INTEL_SSE_POSSIBLE_VALUES}) + list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_INTEL_SSE} STREQUAL "no") + set(libpng_intel_sources + intel/intel_init.c + intel/filter_sse2_intrinsics.c) + if(${PNG_INTEL_SSE} STREQUAL "on") + add_definitions(-DPNG_INTEL_SSE_OPT=1) + endif() + else() + add_definitions(-DPNG_INTEL_SSE_OPT=0) + endif() +endif() + +# set definitions and sources for MIPS +if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*" ) + set(PNG_MIPS_MSA_POSSIBLE_VALUES on off) + set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations: + off: disable the optimizations") + set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS + ${PNG_MIPS_MSA_POSSIBLE_VALUES}) + list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_MIPS_MSA} STREQUAL "no") + set(libpng_mips_sources + mips/mips_init.c + mips/filter_msa_intrinsics.c) + if(${PNG_MIPS_MSA} STREQUAL "on") + add_definitions(-DPNG_MIPS_MSA_OPT=2) + endif() + else() + add_definitions(-DPNG_MIPS_MSA_OPT=0) + endif() +endif() +endif(PNG_HARDWARE_OPTIMIZATIONS) + # SET LIBNAME set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) @@ -359,6 +476,10 @@ set(libpng_sources pngwrite.c pngwtran.c pngwutil.c + ${libpng_arm_sources} + ${libpng_intel_sources} + ${libpng_mips_sources} + ${libpng_powerpc_sources} ) set(pngtest_sources pngtest.c @@ -634,31 +755,58 @@ if(PNG_SHARED) list(APPEND PNG_BIN_TARGETS png-fix-itxt) endif() -# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set -IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib") -ENDIF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) - # Set a variable with CMake code which: # Creates a symlink from src to dest (if possible) or alternatively # copies if different. -macro(CREATE_SYMLINK SRC_FILE DEST_FILE) - FILE(REMOVE ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}) - if(WIN32 AND NOT CYGWIN AND NOT MSYS) - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SRC_FILE}" ${CMAKE_CURRENT_BINARY_DIR}/${DEST_FILE} - DEPENDS ${PNG_LIB_TARGETS} - ) - ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}) - else(WIN32 AND NOT CYGWIN AND NOT MSYS) - get_filename_component(LINK_TARGET "${SRC_FILE}" NAME) - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif(WIN32 AND NOT CYGWIN AND NOT MSYS) -endmacro() +include(CMakeParseArguments) + +function(CREATE_SYMLINK DEST_FILE) + + cmake_parse_arguments(S "" "FILE;TARGET" "" ${ARGN}) + + if(NOT S_TARGET AND NOT S_FILE) + message(FATAL_ERROR "Specify either a TARGET or a FILE for CREATE_SYMLINK to link to.") + endif(NOT S_TARGET AND NOT S_FILE) + + if(S_TARGET AND S_FILE) + message(FATAL_ERROR "CREATE_SYMLINK called with both source file ${S_FILE} and build target ${S_TARGET} arguments - can only handle 1 type per call.") + endif(S_TARGET AND S_FILE) + + if(S_FILE) + # If we don't need to symlink something that's coming from a build target, + # we can go ahead and symlink/copy at configure time. + + if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + execute_process( + COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${S_FILE} ${DEST_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ) + else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + execute_process( + COMMAND ${CMAKE_COMMAND} -E create_symlink ${S_FILE} ${DEST_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + ) + endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + endif(S_FILE) + + if(S_TARGET) + # We need to use generator expressions, which can be a bit tricky, so for + # simplicity make the symlink a POST_BUILD step and use the TARGET + # signature of add_custom_command. + + if(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + add_custom_command(TARGET ${S_TARGET} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ $/${DEST_FILE} + ) + else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + add_custom_command(TARGET ${S_TARGET} POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E create_symlink $ $/${DEST_FILE} + ) + endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) + + endif(S_TARGET) + +endfunction() # Create source generation scripts. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in @@ -686,17 +834,17 @@ if(NOT WIN32 OR CYGWIN OR MINGW) set(LIBS "-lz -lm") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY) - CREATE_SYMLINK(${PNGLIB_NAME}.pc libpng.pc) + CREATE_SYMLINK(libpng.pc FILE ${PNGLIB_NAME}.pc) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY) - CREATE_SYMLINK(${PNGLIB_NAME}-config libpng-config) + CREATE_SYMLINK(libpng-config FILE ${PNGLIB_NAME}-config) endif(NOT WIN32 OR CYGWIN OR MINGW) # SET UP LINKS if(PNG_SHARED) set_target_properties(png PROPERTIES -# VERSION 16.${PNGLIB_RELEASE}.1.6.25 +# VERSION 16.${PNGLIB_RELEASE}.1.6.32 VERSION 16.${PNGLIB_RELEASE}.0 SOVERSION 16 CLEAN_DIRECT_OUTPUT 1) @@ -723,26 +871,20 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) if(PNG_SHARED) # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin if(CYGWIN OR MINGW) - get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE}) - CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + CREATE_SYMLINK(libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} TARGET png) + install(FILES $/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(CYGWIN OR MINGW) if(NOT WIN32) - get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE}) - CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + CREATE_SYMLINK(libpng${CMAKE_SHARED_LIBRARY_SUFFIX} TARGET png) + install(FILES $/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(NOT WIN32) endif(PNG_SHARED) if(PNG_STATIC) if(NOT WIN32 OR CYGWIN OR MINGW) - get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE}) - CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) + CREATE_SYMLINK( libpng${CMAKE_STATIC_LIBRARY_SUFFIX} TARGET png_static) + install(FILES $/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif(NOT WIN32 OR CYGWIN OR MINGW) endif() endif() @@ -772,7 +914,7 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3) install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5) # Install pkg-config files - if(NOT WIN32 OR CYGWIN OR MINGW) + if(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config @@ -781,7 +923,7 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) - endif(NOT WIN32 OR CYGWIN OR MINGW) + endif(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) endif() # On versions of CMake that support it, create an export file CMake @@ -801,4 +943,3 @@ endif() # to create msvc import lib for mingw compiled shared lib # pexports libpng.dll > libpng.def # lib /def:libpng.def /machine:x86 - diff --git a/Engine/lib/lpng/INSTALL b/Engine/lib/lpng/INSTALL index 58ec0b60a..e8edb7240 100644 --- a/Engine/lib/lpng/INSTALL +++ b/Engine/lib/lpng/INSTALL @@ -16,10 +16,11 @@ Contents XI. Prepending a prefix to exported symbols XII. Configuring for compiler xxx: XIII. Removing unwanted object code - XIV. Changes to the build and configuration of libpng in libpng-1.5.x - XV. Setjmp/longjmp issues - XVI. Common linking failures - XVII. Other sources of information about libpng + XIV. Enabling or disabling hardware optimizations + XV. Changes to the build and configuration of libpng in libpng-1.5.x + XVI. Setjmp/longjmp issues + XVII. Common linking failures + XVIII. Other sources of information about libpng I. Simple installation @@ -78,8 +79,8 @@ Or you can use one of the "projects" in the "projects" directory. Before installing libpng, you must first install zlib, if it is not already on your system. zlib can usually be found -wherever you got libpng; otherwise go to http://zlib.net. You can place -zlib in the same directory as libpng or in another directory. +wherever you got libpng; otherwise go to https://zlib.net/. You can +place zlib in the same directory as libpng or in another directory. If your system already has a preinstalled zlib you will still need to have access to the zlib.h and zconf.h include files that @@ -281,7 +282,57 @@ library to fail if they call functions not available in your library. The size of the library itself should not be an issue, because only those sections that are actually used will be loaded into memory. -XIV. Changes to the build and configuration of libpng in libpng-1.5.x +XIV. Enabling or disabling hardware optimizations + +Certain hardware capabilites, such as the Intel SSE instructions, +are normally detected at run time. Enable them with configure options +such as one of + + --enable-arm-neon=yes + --enable-mips-msa=yes + --enable-intel-sse=yes + --enable-powerpc-vsx=yes + +or enable them all at once with + + --enable-hardware-optimizations=yes + +or, if you are not using "configure", you can use one +or more of + + CPPFLAGS += "-DPNG_ARM_NEON" + CPPFLAGS += "-DPNG_MIPS_MSA" + CPPFLAGS += "-DPNG_INTEL_SSE" + CPPFLAGS += "-DPNG_POWERPC_VSX" + +See for example scripts/makefile.linux-opt + +If you wish to avoid using them, +you can disable them via the configure option + + --disable-hardware-optimizations + +to disable them all, or + + --enable-intel-sse=no + +to disable a particular one, +or via compiler-command options such as + + CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0, + -DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0" + +If you are using cmake, hardware optimizations are "on" +by default. To disable them, use + + cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \ + -DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no + +or disable them all at once with + + cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no + +XV. Changes to the build and configuration of libpng in libpng-1.5.x Details of internal changes to the library code can be found in the CHANGES file and in the GIT repository logs. These will be of no concern to the vast @@ -372,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built libpng, because than the settings would not accurately reflect the settings that were used to build libpng. -XV. Setjmp/longjmp issues +XVI. Setjmp/longjmp issues Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() is known to be not thread-safe on some platforms and we don't know of @@ -390,7 +441,7 @@ This requires setjmp/longjmp, so you must either build the library with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined. -XVI. Common linking failures +XVII. Common linking failures If your application fails to find libpng or zlib entries while linking: @@ -402,7 +453,7 @@ If your application fails to find libpng or zlib entries while linking: If you are using the vstudio project, observe the WARNING in project/vstudio/README.txt. -XVII. Other sources of information about libpng: +XVIII. Other sources of information about libpng: Further information can be found in the README and libpng-manual.txt files, in the individual makefiles, in png.h, and the manual pages diff --git a/Engine/lib/lpng/LICENSE b/Engine/lib/lpng/LICENSE index d48a293cd..e803911d3 100644 --- a/Engine/lib/lpng/LICENSE +++ b/Engine/lib/lpng/LICENSE @@ -10,8 +10,8 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are -Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are +libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are +Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: @@ -22,6 +22,9 @@ added to the list of Contributing Authors: Cosmin Truta Gilles Vollant James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: @@ -127,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and Glenn Randers-Pehrson glennrp at users.sourceforge.net -September 1, 2016 +April 1, 2017 diff --git a/Engine/lib/lpng/README b/Engine/lib/lpng/README index 17bca9a5f..71292715e 100644 --- a/Engine/lib/lpng/README +++ b/Engine/lib/lpng/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.25 - September 1, 2016 (shared library 16.0) +README for libpng version 1.6.32 - August 24, 2017 (shared library 16.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. @@ -23,7 +23,7 @@ earlier versions if you are using a shared library. The type of the png_uint_32, which will affect shared-library applications that use this function. -To avoid problems with changes to the internals of png info_struct, +To avoid problems with changes to the internals of the png info_struct, new APIs have been made available in 0.95 to avoid direct application access to info_ptr. These functions are the png_set_ and png_get_ functions. These functions should be used when @@ -88,11 +88,11 @@ zlib should be available at the same place that libpng is, or at zlib.net. You may also want a copy of the PNG specification. It is available as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find -these at http://www.libpng.org/pub/png/documents/ +these at http://www.libpng.org/pub/png/pngdocs.html . -This code is currently being archived at libpng.sf.net in the -[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it -in any of those places, e-mail me, and I'll help you find it. +This code is currently being archived at libpng.sourceforge.io in the +[DOWNLOAD] area, and at http://libpng.download/src . If you +can't find it in any of those places, e-mail me, and I'll help you find it. I am not a lawyer, but I believe that the Export Control Classification Number (ECCN) for libpng is EAR99, which means not subject to export @@ -179,14 +179,16 @@ Files in this distribution: pngwtran.c => Write data transformations pngwutil.c => Write utility functions arm => Contains optimized code for the ARM platform + powerpc => Contains optimized code for the PowerPC platform contrib => Contributions arm-neon => Optimized code for ARM-NEON platform + powerpc-vsx => Optimized code for POWERPC-VSX platform examples => Example programs gregbook => source code for PNG reading and writing, from Greg Roelofs' "PNG: The Definitive Guide", O'Reilly, 1999 - intel => Optimized code for INTEL-SSE2 platform libtests => Test programs + mips-msa => Optimized code for MIPS-MSA platform pngminim => Minimal decoder, encoder, and progressive decoder programs demonstrating use of pngusr.dfa pngminus => Simple pnm2png and png2pnm programs @@ -194,6 +196,8 @@ Files in this distribution: testpngs tools => Various tools visupng => Contains a MSVC workspace for VisualPng + intel => Optimized code for INTEL-SSE2 platform + mips => Optimized code for MIPS platform projects => Contains project files and workspaces for building a DLL owatcom => Contains a WATCOM project for building libpng diff --git a/Engine/lib/lpng/TODO b/Engine/lib/lpng/TODO index cdb9e1fa8..36d6092a2 100644 --- a/Engine/lib/lpng/TODO +++ b/Engine/lib/lpng/TODO @@ -7,7 +7,7 @@ Fix problem with C++ and EXTERN "C". cHRM transformation. Remove setjmp/longjmp usage in favor of returning error codes. As a start on this, minimize the use of png_error(), replacing them with - png_warning(); return(0; or similar. + png_warning(); return(0); or similar. Palette creation. Add "grayscale->palette" transformation and "palette->grayscale" detection. Improved dithering. @@ -24,7 +24,7 @@ Use greater precision when changing to linear gamma for compositing against background and doing rgb-to-gray transformation. Investigate pre-incremented loop counters and other loop constructions. Add interpolated method of handling interlacing. -Switch to the simpler zlib (zlib/libpng) license if legally possible. Extend pngvalid.c to validate more of the libpng transformations. +Refactor preprocessor conditionals to compile entire statements */ diff --git a/Engine/lib/lpng/configure b/Engine/lib/lpng/configure index 010a4cb5e..e69de29bb 100644 --- a/Engine/lib/lpng/configure +++ b/Engine/lib/lpng/configure @@ -1,19 +0,0 @@ - -echo " - There is no \"configure\" script in this distribution (*.zip or *.7z) of - libpng-1.6.25. - - Instead, please copy the appropriate makefile for your system from the - \"scripts\" directory. Read the INSTALL file for more details. - - Update, July 2004: you can get a \"configure\" based distribution - from the libpng distribution sites. Download the file - libpng-1.6.25.tar.gz or libpng-1.6.25.tar.xz. - - If the line endings in the files look funny, which is likely to be the - case if you were trying to run \"configure\" on a Linux machine, you may - wish to get the other distribution of libpng. It is available in both - tar.gz/tar.xz (UNIX style line endings, with \"configure\") and .7z/.zip - (DOS style line endings, without \"configure\") formats. -" - diff --git a/Engine/lib/lpng/libpng-manual.txt b/Engine/lib/lpng/libpng-manual.txt index d969f96d3..e34b1436f 100644 --- a/Engine/lib/lpng/libpng-manual.txt +++ b/Engine/lib/lpng/libpng-manual.txt @@ -1,9 +1,9 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.25 - September 1, 2016 + libpng version 1.6.32 - August 24, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson This document is released under the libpng license. For conditions of distribution and use, see the disclaimer @@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.25 - September 1, 2016 + libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson libpng 1.0 beta 6 - version 0.96 - May 28, 1997 Updated and distributed by Andreas Dilger @@ -66,17 +66,17 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at -. +. It is technically equivalent to the PNG specification (second edition) but has some additional material. -The PNG-1.0 specification is available as RFC 2083 - and as a -W3C Recommendation . +The PNG-1.0 specification is available as RFC 2083 + and as a +W3C Recommendation . Some additional chunks are described in the special-purpose public chunks documents at @@ -101,7 +101,7 @@ majority of the needs of its users. Libpng uses zlib for its compression and decompression of PNG files. Further information about zlib, and the latest version of zlib, can -be found at the zlib home page, . +be found at the zlib home page, . The zlib compression utility is a general purpose utility that is useful for more than PNG files, and can be used without libpng. See the documentation delivered with zlib for more details. @@ -467,8 +467,9 @@ the default, use The values for png_set_crc_action() say how libpng is to handle CRC errors in ancillary and critical chunks, and whether to use the data contained -therein. Note that it is impossible to "discard" data in a critical -chunk. +therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error +is handled while reading the IDAT chunk. Note that it is impossible to +"discard" data in a critical chunk. Choices for (int) crit_action are PNG_CRC_DEFAULT 0 error/quit @@ -485,6 +486,9 @@ Choices for (int) ancil_action are PNG_CRC_QUIET_USE 4 quiet/use data PNG_CRC_NO_CHANGE 5 use the current value +When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32 +checksums are not only ignored, but they are not evaluated. + Setting up callback code You can set up a callback function to handle any unknown chunks in the @@ -684,8 +688,9 @@ where 0x7fffffffL means unlimited. You can retrieve this limit with chunk_cache_max = png_get_chunk_cache_max(png_ptr); Libpng imposes a limit of 8 Megabytes (8,000,000 bytes) on the amount of -memory that a compressed chunk other than IDAT can occupy, when decompressed. -You can change this limit with +memory that any chunk other than IDAT can occupy, originally or when +decompressed (prior to libpng-1.6.32 the limit was only applied to compressed +chunks after decompression). You can change this limit with png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); @@ -1186,7 +1191,20 @@ row_pointers prior to calling png_read_png() with png_set_rows(png_ptr, info_ptr, &row_pointers); Alternatively you could allocate your image in one big block and define -row_pointers[i] to point into the proper places in your block. +row_pointers[i] to point into the proper places in your block, but first +be sure that your platform is able to allocate such a large buffer: + + /* Guard against integer overflow */ + if (height > PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + + png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size); + + for (int i=0; i PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + Remember: Before you call png_read_update_info(), the png_get_*() functions return the values corresponding to the original PNG image. After you call png_read_update_info the values refer to the image @@ -2466,6 +2504,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_eXIf, PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_pCAL, PNG_INFO_sRGB, @@ -3065,6 +3104,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); + + exif - Exif profile (array of + png_byte) (PNG_INFO_eXIf) + png_set_hIST(png_ptr, info_ptr, hist); hist - histogram of palette (array of @@ -3820,7 +3864,7 @@ PNG_FORMAT_FLAG_LINEAR flag below. When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. When an alpha channel is present it is expected to denote pixel coverage @@ -4084,7 +4128,7 @@ READ APIs When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. WRITE APIS @@ -4242,8 +4286,6 @@ functions after png_create_*_struct() has been called by calling: png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn); - png_voidp error_ptr = png_get_error_ptr(png_ptr); - If NULL is supplied for either error_fn or warning_fn, then the libpng default function will be used, calling fprintf() and/or longjmp() if a problem is encountered. The replacement error functions should have @@ -4255,6 +4297,11 @@ parameters as follows: void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg); +Then, within your user_error_fn or user_warning_fn, you can retrieve +the error_ptr if you need it, by calling + + png_voidp error_ptr = png_get_error_ptr(png_ptr); + The motivation behind using setjmp() and longjmp() is the C++ throw and catch exception handling methods. This makes the code much easier to write, as there is no need to check every return code of every function call. @@ -4262,7 +4309,7 @@ However, there are some uncertainties about the status of local variables after a longjmp, so the user may want to be careful about doing anything after setjmp returns non-zero besides returning itself. Consult your compiler documentation for more details. For an alternative approach, you -may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net), +may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/), which is illustrated in pngvalid.c and in contrib/visupng. Beginning in libpng-1.4.0, the png_set_benign_errors() API became available. @@ -4490,7 +4537,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature and the MHDR and MEND chunks. Libpng does not provide support for these or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at -http://www.libmng.com) instead. +https://www.libmng.com/) instead. VIII. Changes to Libpng from version 0.88 @@ -4913,18 +4960,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said that it could be used to override them. Now this function will reduce or increase the limits. -Starting in libpng-1.5.10, the user limits can be set en masse with the -configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled, -a set of "safe" limits is applied in pngpriv.h. These can be overridden by -application calls to png_set_user_limits(), png_set_user_chunk_cache_max(), -and/or png_set_user_malloc_max() that increase or decrease the limits. Also, -in libpng-1.5.10 the default width and height limits were increased -from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the -limits are now - default safe +Starting in libpng-1.5.22, default user limits were established. These +can be overridden by application calls to png_set_user_limits(), +png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max(). +The limits are now + max possible default png_user_width_max 0x7fffffff 1,000,000 png_user_height_max 0x7fffffff 1,000,000 - png_user_chunk_cache_max 0 (unlimited) 128 + png_user_chunk_cache_max 0 (unlimited) 1000 png_user_chunk_malloc_max 0 (unlimited) 8,000,000 The png_set_option() function (and the "options" member of the png struct) was @@ -5174,6 +5217,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length PLTE chunk found in an input PNG is silently truncated. +Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not +attempt to decode the Exif profile; it simply returns a byte array +containing the profile to the calling application which must do its own +decoding. + XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never @@ -5190,27 +5238,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only) at - git://git.code.sf.net/p/libpng/code + https://github.com/glennrp/libpng or + https://git.code.sf.net/p/libpng/code.git -or you can browse it with a web browser by selecting the "code" button at +or you can browse it with a web browser at - https://sourceforge.net/projects/libpng + https://github.com/glennrp/libpng or + https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to glennrp at users.sourceforge.net or to png-mng-implement at lists.sourceforge.net or you can upload them to the libpng bug tracker at - http://libpng.sourceforge.net + https://libpng.sourceforge.io/ + +or as a "pull request" to + + https://github.com/glennrp/libpng/pulls We also accept patches built from the tar or zip distributions, and simple verbal discriptions of bug fixes, reported either to the SourceForge bug tracker, to the png-mng-implement at lists.sf.net -mailing list, or directly to glennrp. +mailing list, as github issues, or directly to glennrp. XV. Coding style Our coding style is similar to the "Allman" style -(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly +(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly braces on separate lines: if (condition) @@ -5311,7 +5365,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as though it were a function. Control keywords if, for, while, and switch are always followed by a space -to distinguish them from function calls, which have no trailing space. +to distinguish them from function calls, which have no trailing space. We put a space after each comma and after each semicolon in "for" statements, and we put spaces before and after each @@ -5335,8 +5389,9 @@ with an even number of lower-case hex digits, and to make them unsigned We prefer to use underscores rather than camelCase in names, except for a few type names that we inherit from zlib.h. -We prefer "if (something != 0)" and "if (something == 0)" -over "if (something)" and if "(!something)", respectively. +We prefer "if (something != 0)" and "if (something == 0)" over +"if (something)" and if "(!something)", respectively, and for pointers +we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)". We do not use the TAB character for indentation in the C sources. @@ -5350,7 +5405,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.25 are Y2K compliant. It is my belief that earlier +upward through 1.6.32 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer diff --git a/Engine/lib/lpng/libpng.3 b/Engine/lib/lpng/libpng.3 index 4893dc9d7..899d8eacc 100644 --- a/Engine/lib/lpng/libpng.3 +++ b/Engine/lib/lpng/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "September 1, 2016" +.TH LIBPNG 3 "August 24, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32 .SH SYNOPSIS \fB #include \fP @@ -97,6 +97,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 \fBpng_byte png_get_header_version (png_const_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_eXIf (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fI*exif\fP\fB);\fP + +\fBpng_uint_32 png_get_eXIf_1 (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_unit_32 \fP\fI*num_exif\fP\fB, png_bytep \fI*exif\fP\fB);\fP + \fBpng_uint_32 png_get_hIST (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP \fBpng_uint_32 png_get_iCCP (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_bytepp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP @@ -347,6 +351,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 \fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP +\fBvoid png_set_eXIf (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fIexif\fP\fB);\fP + +\fBvoid png_set_eXIf_1 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, const png_uint_32 \fP\fInum_exif\fP\fB, png_bytep \fIexif\fP\fB);\fP + \fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP \fBvoid png_set_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_const_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_const_bytep \fP\fIprofile\fP\fB, png_uint_32 \fIproflen\fP\fB);\fP @@ -510,10 +518,10 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.25 - September 1, 2016 + libpng version 1.6.32 - August 24, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson This document is released under the libpng license. For conditions of distribution and use, see the disclaimer @@ -521,9 +529,9 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.25 - September 1, 2016 + libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2016 Glenn Randers-Pehrson + Copyright (c) 1998-2017 Glenn Randers-Pehrson libpng 1.0 beta 6 - version 0.96 - May 28, 1997 Updated and distributed by Andreas Dilger @@ -576,17 +584,17 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at -. +. It is technically equivalent to the PNG specification (second edition) but has some additional material. -The PNG-1.0 specification is available as RFC 2083 - and as a -W3C Recommendation . +The PNG-1.0 specification is available as RFC 2083 + and as a +W3C Recommendation . Some additional chunks are described in the special-purpose public chunks documents at @@ -611,7 +619,7 @@ majority of the needs of its users. Libpng uses zlib for its compression and decompression of PNG files. Further information about zlib, and the latest version of zlib, can -be found at the zlib home page, . +be found at the zlib home page, . The zlib compression utility is a general purpose utility that is useful for more than PNG files, and can be used without libpng. See the documentation delivered with zlib for more details. @@ -977,8 +985,9 @@ the default, use The values for png_set_crc_action() say how libpng is to handle CRC errors in ancillary and critical chunks, and whether to use the data contained -therein. Note that it is impossible to "discard" data in a critical -chunk. +therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error +is handled while reading the IDAT chunk. Note that it is impossible to +"discard" data in a critical chunk. Choices for (int) crit_action are PNG_CRC_DEFAULT 0 error/quit @@ -995,6 +1004,9 @@ Choices for (int) ancil_action are PNG_CRC_QUIET_USE 4 quiet/use data PNG_CRC_NO_CHANGE 5 use the current value +When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32 +checksums are not only ignored, but they are not evaluated. + .SS Setting up callback code You can set up a callback function to handle any unknown chunks in the @@ -1194,8 +1206,9 @@ where 0x7fffffffL means unlimited. You can retrieve this limit with chunk_cache_max = png_get_chunk_cache_max(png_ptr); Libpng imposes a limit of 8 Megabytes (8,000,000 bytes) on the amount of -memory that a compressed chunk other than IDAT can occupy, when decompressed. -You can change this limit with +memory that any chunk other than IDAT can occupy, originally or when +decompressed (prior to libpng-1.6.32 the limit was only applied to compressed +chunks after decompression). You can change this limit with png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); @@ -1696,7 +1709,20 @@ row_pointers prior to calling png_read_png() with png_set_rows(png_ptr, info_ptr, &row_pointers); Alternatively you could allocate your image in one big block and define -row_pointers[i] to point into the proper places in your block. +row_pointers[i] to point into the proper places in your block, but first +be sure that your platform is able to allocate such a large buffer: + + /* Guard against integer overflow */ + if (height > PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + + png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size); + + for (int i=0; i PNG_SIZE_MAX/(width*pixel_size)) { + png_error(png_ptr,"image_data buffer would be too large"); + } + Remember: Before you call png_read_update_info(), the png_get_*() functions return the values corresponding to the original PNG image. After you call png_read_update_info the values refer to the image @@ -2976,6 +3022,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_eXIf, PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_pCAL, PNG_INFO_sRGB, @@ -3575,6 +3622,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif); + + exif - Exif profile (array of + png_byte) (PNG_INFO_eXIf) + png_set_hIST(png_ptr, info_ptr, hist); hist - histogram of palette (array of @@ -4330,7 +4382,7 @@ PNG_FORMAT_FLAG_LINEAR flag below. When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. When an alpha channel is present it is expected to denote pixel coverage @@ -4594,7 +4646,7 @@ READ APIs When the simplified API needs to convert between sRGB and linear colorspaces, the actual sRGB transfer curve defined in the sRGB specification (see the -article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 +article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 approximation used elsewhere in libpng. WRITE APIS @@ -4752,8 +4804,6 @@ functions after png_create_*_struct() has been called by calling: png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn); - png_voidp error_ptr = png_get_error_ptr(png_ptr); - If NULL is supplied for either error_fn or warning_fn, then the libpng default function will be used, calling fprintf() and/or longjmp() if a problem is encountered. The replacement error functions should have @@ -4765,6 +4815,11 @@ parameters as follows: void user_warning_fn(png_structp png_ptr, png_const_charp warning_msg); +Then, within your user_error_fn or user_warning_fn, you can retrieve +the error_ptr if you need it, by calling + + png_voidp error_ptr = png_get_error_ptr(png_ptr); + The motivation behind using setjmp() and longjmp() is the C++ throw and catch exception handling methods. This makes the code much easier to write, as there is no need to check every return code of every function call. @@ -4772,7 +4827,7 @@ However, there are some uncertainties about the status of local variables after a longjmp, so the user may want to be careful about doing anything after setjmp returns non-zero besides returning itself. Consult your compiler documentation for more details. For an alternative approach, you -may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net), +may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/), which is illustrated in pngvalid.c and in contrib/visupng. Beginning in libpng-1.4.0, the png_set_benign_errors() API became available. @@ -5000,7 +5055,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature and the MHDR and MEND chunks. Libpng does not provide support for these or any other MNG chunks; your application must provide its own support for them. You may wish to consider using libmng (available at -http://www.libmng.com) instead. +https://www.libmng.com/) instead. .SH VIII. Changes to Libpng from version 0.88 @@ -5423,18 +5478,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said that it could be used to override them. Now this function will reduce or increase the limits. -Starting in libpng-1.5.10, the user limits can be set en masse with the -configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled, -a set of "safe" limits is applied in pngpriv.h. These can be overridden by -application calls to png_set_user_limits(), png_set_user_chunk_cache_max(), -and/or png_set_user_malloc_max() that increase or decrease the limits. Also, -in libpng-1.5.10 the default width and height limits were increased -from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the -limits are now - default safe +Starting in libpng-1.5.22, default user limits were established. These +can be overridden by application calls to png_set_user_limits(), +png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max(). +The limits are now + max possible default png_user_width_max 0x7fffffff 1,000,000 png_user_height_max 0x7fffffff 1,000,000 - png_user_chunk_cache_max 0 (unlimited) 128 + png_user_chunk_cache_max 0 (unlimited) 1000 png_user_chunk_malloc_max 0 (unlimited) 8,000,000 The png_set_option() function (and the "options" member of the png struct) was @@ -5684,6 +5735,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length PLTE chunk found in an input PNG is silently truncated. +Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not +attempt to decode the Exif profile; it simply returns a byte array +containing the profile to the calling application which must do its own +decoding. + .SH XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never @@ -5700,27 +5756,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files going back to version 0.70. You can access the git repository (read only) at - git://git.code.sf.net/p/libpng/code + https://github.com/glennrp/libpng or + https://git.code.sf.net/p/libpng/code.git -or you can browse it with a web browser by selecting the "code" button at +or you can browse it with a web browser at - https://sourceforge.net/projects/libpng + https://github.com/glennrp/libpng or + https://sourceforge.net/p/libpng/code/ci/libpng16/tree/ Patches can be sent to glennrp at users.sourceforge.net or to png-mng-implement at lists.sourceforge.net or you can upload them to the libpng bug tracker at - http://libpng.sourceforge.net + https://libpng.sourceforge.io/ + +or as a "pull request" to + + https://github.com/glennrp/libpng/pulls We also accept patches built from the tar or zip distributions, and simple verbal discriptions of bug fixes, reported either to the SourceForge bug tracker, to the png-mng-implement at lists.sf.net -mailing list, or directly to glennrp. +mailing list, as github issues, or directly to glennrp. .SH XV. Coding style Our coding style is similar to the "Allman" style -(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly +(See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly braces on separate lines: if (condition) @@ -5821,7 +5883,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as though it were a function. Control keywords if, for, while, and switch are always followed by a space -to distinguish them from function calls, which have no trailing space. +to distinguish them from function calls, which have no trailing space. We put a space after each comma and after each semicolon in "for" statements, and we put spaces before and after each @@ -5845,8 +5907,9 @@ with an even number of lower-case hex digits, and to make them unsigned We prefer to use underscores rather than camelCase in names, except for a few type names that we inherit from zlib.h. -We prefer "if (something != 0)" and "if (something == 0)" -over "if (something)" and if "(!something)", respectively. +We prefer "if (something != 0)" and "if (something == 0)" over +"if (something)" and if "(!something)", respectively, and for pointers +we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)". We do not use the TAB character for indentation in the C sources. @@ -5860,7 +5923,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.25 are Y2K compliant. It is my belief that earlier +upward through 1.6.32 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer @@ -5958,11 +6021,11 @@ the first widely used release: ... 1.0.19 10 10019 10.so.0.19[.0] ... - 1.2.56 13 10256 12.so.0.56[.0] + 1.2.57 13 10257 12.so.0.56[.0] ... - 1.5.27 15 10527 15.so.15.27[.0] + 1.5.28 15 10528 15.so.15.28[.0] ... - 1.6.25 16 10625 16.so.16.25[.0] + 1.6.32 16 10632 16.so.16.32[.0] Henceforth the source version will match the shared-library minor and patch numbers; the shared-library major version number will be @@ -5979,7 +6042,7 @@ release number plus "betaNN" or "rcNN". .LP .IR libpng : .IP -http://libpng.sourceforge.net (follow the [DOWNLOAD] link) +https://libpng.sourceforge.io/ (follow the [DOWNLOAD] link) http://www.libpng.org/pub/png .LP @@ -5989,7 +6052,7 @@ http://www.libpng.org/pub/png .I libpng or at .br -ftp://ftp.info-zip.org/pub/infozip/zlib +https://zlib.net/ .LP .IR PNG specification: RFC 2083 @@ -5998,11 +6061,11 @@ ftp://ftp.info-zip.org/pub/infozip/zlib .I libpng or at .br -ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt +https://www.ietf.org/rfc/rfc2083.txt .br or (as a W3C Recommendation) at .br -http://www.w3.org/TR/REC-png.html +https://www.w3.org/TR/REC-png.html .LP In the case of any inconsistency between the PNG specification @@ -6018,7 +6081,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.6.25 - September 1, 2016: +Libpng version 1.6.32 - August 24, 2017: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6043,8 +6106,8 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are -Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are +libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are +Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals added to the list of Contributing Authors: @@ -6055,6 +6118,9 @@ added to the list of Contributing Authors: Cosmin Truta Gilles Vollant James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov and with the following additions to the disclaimer: @@ -6168,7 +6234,7 @@ files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). Glenn Randers-Pehrson glennrp at users.sourceforge.net -September 1, 2016 +August 24, 2017 .\" end of man page diff --git a/Engine/lib/lpng/libpng.pc.in b/Engine/lib/lpng/libpng.pc.in index 3e7e2c58a..9708e9af2 100644 --- a/Engine/lib/lpng/libpng.pc.in +++ b/Engine/lib/lpng/libpng.pc.in @@ -6,6 +6,7 @@ includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ Name: libpng Description: Loads and saves PNG files Version: @PNGLIB_VERSION@ +Requires: zlib Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ Libs.private: @LIBS@ Cflags: -I${includedir} diff --git a/Engine/lib/lpng/libpngpf.3 b/Engine/lib/lpng/libpngpf.3 index 3d6eab5dc..ab84577e4 100644 --- a/Engine/lib/lpng/libpngpf.3 +++ b/Engine/lib/lpng/libpngpf.3 @@ -1,11 +1,11 @@ -.TH LIBPNGPF 3 "September 1, 2016" +.TH LIBPNGPF 3 "April 1, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.25 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32 (private functions) .SH SYNOPSIS -\fB#include \fI"pngpriv.h" +\fB\fB#include \fI\fI"pngpriv.h" -\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer \fP\fImaintained\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fIfunction. +\fB\fBAs of libpng version \fP\fI\fP\fI1.5.1\fP\fB\fP\fB, this section is no longer \fP\fI\fP\fImaintained\fP\fB\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fI\fIfunction. .SH DESCRIPTION The functions previously listed here are used privately by libpng and are not diff --git a/Engine/lib/lpng/png.5 b/Engine/lib/lpng/png.5 index 16d213cc5..b0cbd2cfa 100644 --- a/Engine/lib/lpng/png.5 +++ b/Engine/lib/lpng/png.5 @@ -1,4 +1,4 @@ -.TH PNG 5 "September 1, 2016" +.TH PNG 5 "April 1, 2017" .SH NAME png \- Portable Network Graphics (PNG) format .SH DESCRIPTION @@ -23,11 +23,11 @@ platforms. PNG specification (second edition), November 2003: .IP .br - text != 0 && + if (info_ptr->text != NULL && ((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0) { if (num != -1) @@ -477,6 +497,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, png_free(png_ptr, info_ptr->text); info_ptr->text = NULL; info_ptr->num_text = 0; + info_ptr->max_text = 0; } } #endif @@ -541,7 +562,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, #ifdef PNG_sPLT_SUPPORTED /* Free a given sPLT entry, or (if num == -1) all sPLT entries */ - if (info_ptr->splt_palettes != 0 && + if (info_ptr->splt_palettes != NULL && ((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0) { if (num != -1) @@ -571,7 +592,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, #endif #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED - if (info_ptr->unknown_chunks != 0 && + if (info_ptr->unknown_chunks != NULL && ((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0) { if (num != -1) @@ -594,6 +615,26 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, } #endif +#ifdef PNG_eXIf_SUPPORTED + /* Free any eXIf entry */ + if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0) + { +# ifdef PNG_READ_eXIf_SUPPORTED + if (info_ptr->eXIf_buf) + { + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; + } +# endif + if (info_ptr->exif) + { + png_free(png_ptr, info_ptr->exif); + info_ptr->exif = NULL; + } + info_ptr->valid &= ~PNG_INFO_eXIf; + } +#endif + #ifdef PNG_hIST_SUPPORTED /* Free any hIST entry */ if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0) @@ -617,7 +658,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, /* Free any image bits attached to the info structure */ if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0) { - if (info_ptr->row_pointers != 0) + if (info_ptr->row_pointers != NULL) { png_uint_32 row; for (row = 0; row < info_ptr->height; row++) @@ -684,7 +725,7 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp) void PNGAPI png_save_int_32(png_bytep buf, png_int_32 i) { - png_save_uint_32(buf, i); + png_save_uint_32(buf, (png_uint_32)i); } # endif @@ -775,15 +816,15 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.25 - September 1, 2016" PNG_STRING_NEWLINE \ - "Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \ + "libpng version 1.6.32 - August 24, 2017" PNG_STRING_NEWLINE \ + "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.25 - September 1, 2016\ - Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\ + return "libpng version 1.6.32 - August 24, 2017\ + Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; # endif @@ -2529,7 +2570,7 @@ png_check_IHDR(png_const_structrp png_ptr, error = 1; } - if (png_gt(((width + 7) & (~7)), + if (png_gt(((width + 7) & (~7U)), ((PNG_SIZE_MAX - 48 /* big_row_buf hack */ - 1) /* filter byte */ @@ -2831,7 +2872,7 @@ png_pow10(int power) if (power < 0) { if (power < DBL_MIN_10_EXP) return 0; - recip = 1, power = -power; + recip = 1; power = -power; } if (power > 0) @@ -2856,6 +2897,14 @@ png_pow10(int power) /* Function to format a floating point value in ASCII with a given * precision. */ +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic push +/* The problem arises below with exp_b10, which can never overflow because it + * comes, originally, from frexp and is therefore limited to a range which is + * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)). + */ +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ void /* PRIVATE */ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double fp, unsigned int precision) @@ -2909,7 +2958,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double test = png_pow10(exp_b10+1); if (test <= DBL_MAX) - ++exp_b10, base = test; + { + ++exp_b10; base = test; + } else break; @@ -2923,7 +2974,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * test on DBL_MAX above. */ fp /= base; - while (fp >= 1) fp /= 10, ++exp_b10; + while (fp >= 1) + { + fp /= 10; ++exp_b10; + } /* Because of the code above fp may, at this point, be * less than .1, this is ok because the code below can @@ -2940,7 +2994,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */ { - czero = -exp_b10; /* PLUS 2 digits: TOTAL 3 */ + czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */ exp_b10 = 0; /* Dot added below before first output. */ } else @@ -2974,7 +3028,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Rounding up to 10, handle that here. */ if (czero > 0) { - --czero, d = 1; + --czero; d = 1; if (cdigits == 0) --clead; } else @@ -2988,7 +3042,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, else if (ch == 46) { - ch = *--ascii, ++size; + ch = *--ascii; ++size; /* Advance exp_b10 to '1', so that the * decimal point happens after the * previous digit. @@ -3015,7 +3069,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, int ch = *--ascii; if (ch == 46) - ++size, exp_b10 = 1; + { + ++size; exp_b10 = 1; + } /* Else lost a leading zero, so 'exp_b10' is * still ok at (-1) @@ -3051,21 +3107,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ if (exp_b10 != (-1)) { - if (exp_b10 == 0) *ascii++ = 46, --size; + if (exp_b10 == 0) + { + *ascii++ = 46; --size; + } /* PLUS 1: TOTAL 4 */ --exp_b10; } - *ascii++ = 48, --czero; + *ascii++ = 48; --czero; } if (exp_b10 != (-1)) { if (exp_b10 == 0) - *ascii++ = 46, --size; /* counted above */ + { + *ascii++ = 46; --size; /* counted above */ + } --exp_b10; } - *ascii++ = (char)(48 + (int)d), ++cdigits; + *ascii++ = (char)(48 + (int)d); ++cdigits; } } while (cdigits+czero < precision+clead && fp > DBL_MIN); @@ -3074,7 +3135,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Check for an exponent, if we don't need one we are * done and just need to terminate the string. At - * this point exp_b10==(-1) is effectively if flag - it got + * this point exp_b10==(-1) is effectively a flag - it got * to '-1' because of the decrement after outputting * the decimal point above (the exponent required is * *not* -1!) @@ -3088,7 +3149,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * zeros were *not* output, so this doesn't increase * the output count. */ - while (--exp_b10 >= 0) *ascii++ = 48; + while (exp_b10-- > 0) *ascii++ = 48; *ascii = 0; @@ -3106,7 +3167,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ size -= cdigits; - *ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */ + *ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */ /* The following use of an unsigned temporary avoids ambiguities in * the signed arithmetic on exp_b10 and permits GCC at least to do @@ -3117,12 +3178,12 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, if (exp_b10 < 0) { - *ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */ - uexp_b10 = -exp_b10; + *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */ + uexp_b10 = 0U-exp_b10; } else - uexp_b10 = exp_b10; + uexp_b10 = 0U+exp_b10; cdigits = 0; @@ -3165,6 +3226,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ # endif /* FLOATING_POINT */ @@ -3184,9 +3248,11 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, /* Avoid overflow here on the minimum integer. */ if (fp < 0) - *ascii++ = 45, num = -fp; + { + *ascii++ = 45; num = (png_uint_32)(-fp); + } else - num = fp; + num = (png_uint_32)fp; if (num <= 0x80000000) /* else overflowed */ { @@ -3222,7 +3288,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii, * then ndigits digits to first: */ i = 5; - while (ndigits < i) *ascii++ = 48, --i; + while (ndigits < i) + { + *ascii++ = 48; --i; + } while (ndigits >= first) *ascii++ = digits[--ndigits]; /* Don't output the trailing zeros! */ } @@ -3273,6 +3342,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text) * the nearest .00001). Overflow and divide by zero are signalled in * the result, a boolean - true on success, false on overflow. */ +#if GCC_STRICT_OVERFLOW /* from above */ +/* It is not obvious which comparison below gets optimized in such a way that + * signed overflow would change the result; looking through the code does not + * reveal any tests which have the form GCC complains about, so presumably the + * optimizer is moving an add or subtract into the 'if' somewhere. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ int png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, png_int_32 divisor) @@ -3387,6 +3465,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, return 0; } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ #endif /* READ_GAMMA || INCH_CONVERSIONS */ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) @@ -4259,13 +4340,13 @@ png_set_option(png_structrp png_ptr, int option, int onoff) if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT && (option & 1) == 0) { - int mask = 3 << option; - int setting = (2 + (onoff != 0)) << option; - int current = png_ptr->options; + png_uint_32 mask = 3U << option; + png_uint_32 setting = (2U + (onoff != 0)) << option; + png_uint_32 current = png_ptr->options; - png_ptr->options = (png_byte)(((current & ~mask) | setting) & 0xff); + png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff); - return (current & mask) >> option; + return (int)(current & mask) >> option; } return PNG_OPTION_INVALID; @@ -4277,7 +4358,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff) defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) /* sRGB conversion tables; these are machine generated with the code in * contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the - * specification (see the article at http://en.wikipedia.org/wiki/SRGB) + * specification (see the article at https://en.wikipedia.org/wiki/SRGB) * is used, not the gamma=1/2.2 approximation use elsewhere in libpng. * The sRGB to linear table is exact (to the nearest 16-bit linear fraction). * The inverse (linear to sRGB) table has accuracies as follows: diff --git a/Engine/lib/lpng/png.h b/Engine/lib/lpng/png.h index e1f59c310..51ac8abe7 100644 --- a/Engine/lib/lpng/png.h +++ b/Engine/lib/lpng/png.h @@ -1,9 +1,9 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.25, September 1, 2016 + * libpng version 1.6.32, August 24, 2017 * - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.25, September 1, 2016: + * libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,12 +25,8 @@ * * This code is released under the libpng license. * - * Some files in the "contrib" directory and some configure-generated - * files that are distributed with libpng have other copyright owners and - * are released under other open source licenses. - * - * libpng versions 1.0.7, July 1, 2000 through 1.6.25, September 1, 2016 are - * Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are + * libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are + * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals * added to the list of Contributing Authors: @@ -42,6 +38,8 @@ * Gilles Vollant * James Yu * Mandar Sahastrabuddhe + * Google Inc. + * Vadim Barkov * * and with the following additions to the disclaimer: * @@ -52,10 +50,10 @@ * risk of satisfactory quality, performance, accuracy, and effort is with * the user. * - * Some files in the "contrib" directory have other copyright owners and + * Some files in the "contrib" directory and some configure-generated + * files that are distributed with libpng have other copyright owners and * are released under other open source licenses. * - * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from * libpng-0.96, and are distributed according to the same disclaimer and @@ -66,9 +64,6 @@ * Glenn Randers-Pehrson * Willem van Schaik * - * Some files in the "scripts" directory have different copyright owners - * but are also released under this license. - * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, * and are distributed according to the same disclaimer and license as @@ -214,11 +209,11 @@ * ... * 1.0.19 10 10019 10.so.0.19[.0] * ... - * 1.2.56 13 10256 12.so.0.56[.0] + * 1.2.57 13 10257 12.so.0.57[.0] * ... - * 1.5.27 15 10527 15.so.15.27[.0] + * 1.5.28 15 10527 15.so.15.28[.0] * ... - * 1.6.25 16 10625 16.so.16.25[.0] + * 1.6.32 16 10632 16.so.16.32[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -239,20 +234,20 @@ * * See libpng.txt or libpng.3 for more information. The PNG specification * is available as a W3C Recommendation and as an ISO Specification, - * 4294967294 +#if UINT_MAX > 4294967294U typedef unsigned int png_uint_32; -#elif ULONG_MAX > 4294967294 +#elif ULONG_MAX > 4294967294U typedef unsigned long int png_uint_32; #else # error "libpng requires an unsigned 32-bit (or more) type" diff --git a/Engine/lib/lpng/pngerror.c b/Engine/lib/lpng/pngerror.c index f13b76443..ad48bfb98 100644 --- a/Engine/lib/lpng/pngerror.c +++ b/Engine/lib/lpng/pngerror.c @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02u: /* Expects at least 2 digits. */ mincount = 2; - /* FALL THROUGH */ + /* FALLTHROUGH */ case PNG_NUMBER_FORMAT_u: *--end = digits[number % 10]; @@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02x: /* This format expects at least two digits */ mincount = 2; - /* FALL THROUGH */ + /* FALLTHROUGH */ case PNG_NUMBER_FORMAT_x: *--end = digits[number & 0xf]; @@ -573,7 +573,7 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN) { # define fixed_message "fixed point overflow in " # define fixed_message_ln ((sizeof fixed_message)-1) - int iin; + unsigned int iin; char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT]; memcpy(msg, fixed_message, fixed_message_ln); iin = 0; diff --git a/Engine/lib/lpng/pngget.c b/Engine/lib/lpng/pngget.c index b3c6863f4..26e9fb1c3 100644 --- a/Engine/lib/lpng/pngget.c +++ b/Engine/lib/lpng/pngget.c @@ -1,8 +1,8 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -338,7 +338,7 @@ ppi_from_ppm(png_uint_32 ppm) png_fixed_point result; if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127, 5000) != 0) - return result; + return (png_uint_32)result; /* Overflow. */ return 0; @@ -773,6 +773,35 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, } #endif +#ifdef PNG_eXIf_SUPPORTED +png_uint_32 PNGAPI +png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + png_bytep *exif) +{ + png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1"); + PNG_UNUSED(info_ptr) + PNG_UNUSED(exif) + return 0; +} + +png_uint_32 PNGAPI +png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr, + png_uint_32 *num_exif, png_bytep *exif) +{ + png_debug1(1, "in %s retrieval function", "eXIf"); + + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL) + { + *num_exif = info_ptr->num_exif; + *exif = info_ptr->exif; + return (PNG_INFO_eXIf); + } + + return (0); +} +#endif + #ifdef PNG_hIST_SUPPORTED png_uint_32 PNGAPI png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, diff --git a/Engine/lib/lpng/pnginfo.h b/Engine/lib/lpng/pnginfo.h index 361ed8be7..d5f6149db 100644 --- a/Engine/lib/lpng/pnginfo.h +++ b/Engine/lib/lpng/pnginfo.h @@ -185,6 +185,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ #endif +#ifdef PNG_eXIf_SUPPORTED + int num_exif; /* Added at libpng-1.6.31 */ + png_bytep exif; +# ifdef PNG_READ_eXIf_SUPPORTED + png_bytep eXIf_buf; /* Added at libpng-1.6.32 */ +# endif +#endif + #ifdef PNG_hIST_SUPPORTED /* The hIST chunk contains the relative frequency or importance of the * various palette entries, so that a viewer can intelligently select a diff --git a/Engine/lib/lpng/pngmem.c b/Engine/lib/lpng/pngmem.c index 7053ec96f..ff3ef7e88 100644 --- a/Engine/lib/lpng/pngmem.c +++ b/Engine/lib/lpng/pngmem.c @@ -1,7 +1,7 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.6.24 [August 4, 2016%] + * Last changed in libpng 1.6.26 [October 20, 2016] * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -109,7 +109,7 @@ static png_voidp png_malloc_array_checked(png_const_structrp png_ptr, int nelements, size_t element_size) { - png_alloc_size_t req = nelements; /* known to be > 0 */ + png_alloc_size_t req = (png_alloc_size_t)nelements; /* known to be > 0 */ if (req <= PNG_SIZE_MAX/element_size) return png_malloc_base(png_ptr, req * element_size); diff --git a/Engine/lib/lpng/pngpread.c b/Engine/lib/lpng/pngpread.c index 794352f42..fbe361dc3 100644 --- a/Engine/lib/lpng/pngpread.c +++ b/Engine/lib/lpng/pngpread.c @@ -1,8 +1,8 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -189,6 +189,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr) png_crc_read(png_ptr, chunk_tag, 4); png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_check_chunk_name(png_ptr, png_ptr->chunk_name); + png_check_chunk_length(png_ptr, png_ptr->push_length); png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; } @@ -684,7 +685,12 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, png_warning(png_ptr, "Truncated compressed data in IDAT"); else - png_error(png_ptr, "Decompression error in IDAT"); + { + if (ret == Z_DATA_ERROR) + png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch"); + else + png_error(png_ptr, "Decompression error in IDAT"); + } /* Skip the check on unprocessed input */ return; diff --git a/Engine/lib/lpng/pngpriv.h b/Engine/lib/lpng/pngpriv.h index bed1cabe7..1f2e90f2b 100644 --- a/Engine/lib/lpng/pngpriv.h +++ b/Engine/lib/lpng/pngpriv.h @@ -1,8 +1,8 @@ /* pngpriv.h - private declarations for use inside libpng * - * Last changed in libpng 1.6.25 [September 1, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -35,7 +35,9 @@ * Windows/Visual Studio) there is no effect; the OS specific tests below are * still required (as of 2011-05-02.) */ -#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#endif #ifndef PNG_VERSION_INFO_ONLY /* Standard library headers not required by png.h: */ @@ -190,6 +192,50 @@ # endif #endif +#ifndef PNG_POWERPC_VSX_OPT +# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__) +# define PNG_POWERPC_VSX_OPT 2 +# else +# define PNG_POWERPC_VSX_OPT 0 +# endif +#endif + +#ifndef PNG_INTEL_SSE_OPT +# ifdef PNG_INTEL_SSE + /* Only check for SSE if the build configuration has been modified to + * enable SSE optimizations. This means that these optimizations will + * be off by default. See contrib/intel for more details. + */ +# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \ + defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_OPT 1 +# endif +# endif +#endif + +#if PNG_INTEL_SSE_OPT > 0 +# ifndef PNG_INTEL_SSE_IMPLEMENTATION +# if defined(__SSE4_1__) || defined(__AVX__) + /* We are not actually using AVX, but checking for AVX is the best + way we can detect SSE4.1 and SSSE3 on MSVC. + */ +# define PNG_INTEL_SSE_IMPLEMENTATION 3 +# elif defined(__SSSE3__) +# define PNG_INTEL_SSE_IMPLEMENTATION 2 +# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_IMPLEMENTATION 1 +# else +# define PNG_INTEL_SSE_IMPLEMENTATION 0 +# endif +# endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2 +# endif +#endif + #if PNG_MIPS_MSA_OPT > 0 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa # ifndef PNG_MIPS_MSA_IMPLEMENTATION @@ -210,6 +256,11 @@ # endif #endif /* PNG_MIPS_MSA_OPT > 0 */ +#if PNG_POWERPC_VSX_OPT > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx +# define PNG_POWERPC_VSX_IMPLEMENTATION 1 +#endif + /* Is this a build of a DLL where compilation of the object modules requires * different preprocessor settings to those required for a simple library? If @@ -403,25 +454,6 @@ # define png_fixed_error(s1,s2) png_err(s1) #endif -/* C allows up-casts from (void*) to any pointer and (const void*) to any - * pointer to a const object. C++ regards this as a type error and requires an - * explicit, static, cast and provides the static_cast<> rune to ensure that - * const is not cast away. - */ -#ifdef __cplusplus -# define png_voidcast(type, value) static_cast(value) -# define png_constcast(type, value) const_cast(value) -# define png_aligncast(type, value) \ - static_cast(static_cast(value)) -# define png_aligncastconst(type, value) \ - static_cast(static_cast(value)) -#else -# define png_voidcast(type, value) (value) -# define png_constcast(type, value) ((type)(value)) -# define png_aligncast(type, value) ((void*)(value)) -# define png_aligncastconst(type, value) ((const void*)(value)) -#endif /* __cplusplus */ - /* Some fixed point APIs are still required even if not exported because * they get used by the corresponding floating point APIs. This magic * deals with this: @@ -436,6 +468,35 @@ /* Other defines specific to compilers can go here. Try to keep * them inside an appropriate ifdef/endif pair for portability. */ + +/* C allows up-casts from (void*) to any pointer and (const void*) to any + * pointer to a const object. C++ regards this as a type error and requires an + * explicit, static, cast and provides the static_cast<> rune to ensure that + * const is not cast away. + */ +#ifdef __cplusplus +# define png_voidcast(type, value) static_cast(value) +# define png_constcast(type, value) const_cast(value) +# define png_aligncast(type, value) \ + static_cast(static_cast(value)) +# define png_aligncastconst(type, value) \ + static_cast(static_cast(value)) +#else +# define png_voidcast(type, value) (value) +# ifdef _WIN64 +# ifdef __GNUC__ + typedef unsigned long long png_ptruint; +# else + typedef unsigned __int64 png_ptruint; +# endif +# else + typedef unsigned long png_ptruint; +# endif +# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value)) +# define png_aligncast(type, value) ((void*)(value)) +# define png_aligncastconst(type, value) ((const void*)(value)) +#endif /* __cplusplus */ + #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) /* png.c requires the following ANSI-C constants if the conversion of @@ -533,7 +594,8 @@ /* This implicitly assumes alignment is always to a power of 2. */ #ifdef png_alignof # define png_isaligned(ptr, type)\ - ((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0) + (((type)((const char*)ptr-(const char*)0) & \ + (type)(png_alignof(type)-1)) == 0) #else # define png_isaligned(ptr, type) 0 #endif @@ -550,92 +612,92 @@ * are defined in png.h because they need to be visible to applications * that call png_set_unknown_chunk(). */ -/* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */ -/* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */ -#define PNG_HAVE_IDAT 0x04 -/* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */ -#define PNG_HAVE_IEND 0x10 - /* 0x20 (unused) */ - /* 0x40 (unused) */ - /* 0x80 (unused) */ -#define PNG_HAVE_CHUNK_HEADER 0x100 -#define PNG_WROTE_tIME 0x200 -#define PNG_WROTE_INFO_BEFORE_PLTE 0x400 -#define PNG_BACKGROUND_IS_GRAY 0x800 -#define PNG_HAVE_PNG_SIGNATURE 0x1000 -#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */ - /* 0x4000 (unused) */ -#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */ +/* #define PNG_HAVE_IHDR 0x01U (defined in png.h) */ +/* #define PNG_HAVE_PLTE 0x02U (defined in png.h) */ +#define PNG_HAVE_IDAT 0x04U +/* #define PNG_AFTER_IDAT 0x08U (defined in png.h) */ +#define PNG_HAVE_IEND 0x10U + /* 0x20U (unused) */ + /* 0x40U (unused) */ + /* 0x80U (unused) */ +#define PNG_HAVE_CHUNK_HEADER 0x100U +#define PNG_WROTE_tIME 0x200U +#define PNG_WROTE_INFO_BEFORE_PLTE 0x400U +#define PNG_BACKGROUND_IS_GRAY 0x800U +#define PNG_HAVE_PNG_SIGNATURE 0x1000U +#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */ + /* 0x4000U (unused) */ +#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */ /* Flags for the transformations the PNG library does on the image data */ -#define PNG_BGR 0x0001 -#define PNG_INTERLACE 0x0002 -#define PNG_PACK 0x0004 -#define PNG_SHIFT 0x0008 -#define PNG_SWAP_BYTES 0x0010 -#define PNG_INVERT_MONO 0x0020 -#define PNG_QUANTIZE 0x0040 -#define PNG_COMPOSE 0x0080 /* Was PNG_BACKGROUND */ -#define PNG_BACKGROUND_EXPAND 0x0100 -#define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */ -#define PNG_16_TO_8 0x0400 /* Becomes 'chop' in 1.5.4 */ -#define PNG_RGBA 0x0800 -#define PNG_EXPAND 0x1000 -#define PNG_GAMMA 0x2000 -#define PNG_GRAY_TO_RGB 0x4000 -#define PNG_FILLER 0x8000 -#define PNG_PACKSWAP 0x10000 -#define PNG_SWAP_ALPHA 0x20000 -#define PNG_STRIP_ALPHA 0x40000 -#define PNG_INVERT_ALPHA 0x80000 -#define PNG_USER_TRANSFORM 0x100000 -#define PNG_RGB_TO_GRAY_ERR 0x200000 -#define PNG_RGB_TO_GRAY_WARN 0x400000 -#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */ -#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */ -#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */ -#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */ -#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */ - /* 0x8000000 unused */ - /* 0x10000000 unused */ - /* 0x20000000 unused */ - /* 0x40000000 unused */ +#define PNG_BGR 0x0001U +#define PNG_INTERLACE 0x0002U +#define PNG_PACK 0x0004U +#define PNG_SHIFT 0x0008U +#define PNG_SWAP_BYTES 0x0010U +#define PNG_INVERT_MONO 0x0020U +#define PNG_QUANTIZE 0x0040U +#define PNG_COMPOSE 0x0080U /* Was PNG_BACKGROUND */ +#define PNG_BACKGROUND_EXPAND 0x0100U +#define PNG_EXPAND_16 0x0200U /* Added to libpng 1.5.2 */ +#define PNG_16_TO_8 0x0400U /* Becomes 'chop' in 1.5.4 */ +#define PNG_RGBA 0x0800U +#define PNG_EXPAND 0x1000U +#define PNG_GAMMA 0x2000U +#define PNG_GRAY_TO_RGB 0x4000U +#define PNG_FILLER 0x8000U +#define PNG_PACKSWAP 0x10000U +#define PNG_SWAP_ALPHA 0x20000U +#define PNG_STRIP_ALPHA 0x40000U +#define PNG_INVERT_ALPHA 0x80000U +#define PNG_USER_TRANSFORM 0x100000U +#define PNG_RGB_TO_GRAY_ERR 0x200000U +#define PNG_RGB_TO_GRAY_WARN 0x400000U +#define PNG_RGB_TO_GRAY 0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */ +#define PNG_ENCODE_ALPHA 0x800000U /* Added to libpng-1.5.4 */ +#define PNG_ADD_ALPHA 0x1000000U /* Added to libpng-1.2.7 */ +#define PNG_EXPAND_tRNS 0x2000000U /* Added to libpng-1.2.9 */ +#define PNG_SCALE_16_TO_8 0x4000000U /* Added to libpng-1.5.4 */ + /* 0x8000000U unused */ + /* 0x10000000U unused */ + /* 0x20000000U unused */ + /* 0x40000000U unused */ /* Flags for png_create_struct */ -#define PNG_STRUCT_PNG 0x0001 -#define PNG_STRUCT_INFO 0x0002 +#define PNG_STRUCT_PNG 0x0001U +#define PNG_STRUCT_INFO 0x0002U /* Flags for the png_ptr->flags rather than declaring a byte for each one */ -#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001 -#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */ - /* 0x0004 unused */ -#define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */ - /* 0x0010 unused */ - /* 0x0020 unused */ -#define PNG_FLAG_ROW_INIT 0x0040 -#define PNG_FLAG_FILLER_AFTER 0x0080 -#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100 -#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200 -#define PNG_FLAG_CRC_CRITICAL_USE 0x0400 -#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800 -#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */ -#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */ -#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */ -/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 */ -/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 */ -#define PNG_FLAG_LIBRARY_MISMATCH 0x20000 -#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000 -#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000 -#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000 /* Added to libpng-1.4.0 */ -#define PNG_FLAG_APP_WARNINGS_WARN 0x200000 /* Added to libpng-1.6.0 */ -#define PNG_FLAG_APP_ERRORS_WARN 0x400000 /* Added to libpng-1.6.0 */ - /* 0x800000 unused */ - /* 0x1000000 unused */ - /* 0x2000000 unused */ - /* 0x4000000 unused */ - /* 0x8000000 unused */ - /* 0x10000000 unused */ - /* 0x20000000 unused */ - /* 0x40000000 unused */ +#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001U +#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002U /* Added to libpng-1.6.0 */ + /* 0x0004U unused */ +#define PNG_FLAG_ZSTREAM_ENDED 0x0008U /* Added to libpng-1.6.0 */ + /* 0x0010U unused */ + /* 0x0020U unused */ +#define PNG_FLAG_ROW_INIT 0x0040U +#define PNG_FLAG_FILLER_AFTER 0x0080U +#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100U +#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200U +#define PNG_FLAG_CRC_CRITICAL_USE 0x0400U +#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800U +#define PNG_FLAG_ASSUME_sRGB 0x1000U /* Added to libpng-1.5.4 */ +#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000U /* Added to libpng-1.5.4 */ +#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000U /* Added to libpng-1.5.4 */ +/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000U */ +/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000U */ +#define PNG_FLAG_LIBRARY_MISMATCH 0x20000U +#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000U +#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U +#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U /* Added to libpng-1.4.0 */ +#define PNG_FLAG_APP_WARNINGS_WARN 0x200000U /* Added to libpng-1.6.0 */ +#define PNG_FLAG_APP_ERRORS_WARN 0x400000U /* Added to libpng-1.6.0 */ + /* 0x800000U unused */ + /* 0x1000000U unused */ + /* 0x2000000U unused */ + /* 0x4000000U unused */ + /* 0x8000000U unused */ + /* 0x10000000U unused */ + /* 0x20000000U unused */ + /* 0x40000000U unused */ #define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \ PNG_FLAG_CRC_ANCILLARY_NOWARN) @@ -669,6 +731,24 @@ ((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \ (( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) ) +/* This returns the number of trailing bits in the last byte of a row, 0 if the + * last byte is completely full of pixels. It is, in principle, (pixel_bits x + * width) % 8, but that would overflow for large 'width'. The second macro is + * the same except that it returns the number of unused bits in the last byte; + * (8-TRAILBITS), but 0 when TRAILBITS is 0. + * + * NOTE: these macros are intended to be self-evidently correct and never + * overflow on the assumption that pixel_bits is in the range 0..255. The + * arguments are evaluated only once and they can be signed (e.g. as a result of + * the integral promotions). The result of the expression always has type + * (png_uint_32), however the compiler always knows it is in the range 0..7. + */ +#define PNG_TRAILBITS(pixel_bits, width) \ + (((pixel_bits) * ((width) % (png_uint_32)8)) % 8) + +#define PNG_PADBITS(pixel_bits, width) \ + ((8 - PNG_TRAILBITS(pixel_bits, width)) % 8) + /* PNG_OUT_OF_RANGE returns true if value is outside the range * ideal-delta..ideal+delta. Each argument is evaluated twice. * "ideal" and "delta" should be constants, normally simple @@ -762,6 +842,7 @@ #define png_PLTE PNG_U32( 80, 76, 84, 69) #define png_bKGD PNG_U32( 98, 75, 71, 68) #define png_cHRM PNG_U32( 99, 72, 82, 77) +#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */ #define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */ #define png_gAMA PNG_U32(103, 65, 77, 65) #define png_gIFg PNG_U32(103, 73, 70, 103) @@ -1062,6 +1143,11 @@ PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr, int intent),PNG_EMPTY); #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED +PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr, + png_bytep exif, int num_exif),PNG_EMPTY); +#endif + #ifdef PNG_WRITE_iCCP_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr, png_const_charp name, png_const_bytep profile), PNG_EMPTY); @@ -1237,6 +1323,38 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); #endif +#if PNG_POWERPC_VSX_OPT > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info, + png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + +#if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + /* Choose the best filter to use and filter the row data */ PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY); @@ -1263,7 +1381,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr), /* Initialize the row buffers, etc. */ PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY); -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush), PNG_EMPTY); # define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush) @@ -1329,6 +1447,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); #endif +#ifdef PNG_READ_eXIf_SUPPORTED +PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr, + png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); @@ -1404,8 +1527,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); #endif -PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr, - png_uint_32 chunk_name),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr, + const png_uint_32 chunk_name),PNG_EMPTY); + +PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr, + const png_uint_32 chunk_length),PNG_EMPTY); PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); @@ -1972,6 +2098,11 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon, PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); #endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, + (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); +# endif #endif PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, diff --git a/Engine/lib/lpng/pngread.c b/Engine/lib/lpng/pngread.c index 100032692..e34ddd99a 100644 --- a/Engine/lib/lpng/pngread.c +++ b/Engine/lib/lpng/pngread.c @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -175,6 +175,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr) png_handle_cHRM(png_ptr, info_ptr, length); #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (chunk_name == png_eXIf) + png_handle_eXIf(png_ptr, info_ptr, length); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED else if (chunk_name == png_gAMA) png_handle_gAMA(png_ptr, info_ptr, length); @@ -359,9 +364,9 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) { - png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1); - png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3); - png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5); + png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1); + png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3); + png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5); png_uint_32 red = (s0 + s1 + 65536) & 0xffff; png_uint_32 blue = (s2 + s1 + 65536) & 0xffff; *(rp ) = (png_byte)((red >> 8) & 0xff); @@ -534,6 +539,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row) png_error(png_ptr, "Invalid attempt to read row data"); /* Fill the row with IDAT data: */ + png_ptr->row_buf[0]=255; /* to force error if no data was found */ png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1); if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) @@ -842,6 +848,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr) png_handle_cHRM(png_ptr, info_ptr, length); #endif +#ifdef PNG_READ_eXIf_SUPPORTED + else if (chunk_name == png_eXIf) + png_handle_eXIf(png_ptr, info_ptr, length); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED else if (chunk_name == png_gAMA) png_handle_gAMA(png_ptr, info_ptr, length); @@ -1393,7 +1404,9 @@ png_image_read_header(png_voidp argument) png_structrp png_ptr = image->opaque->png_ptr; png_inforp info_ptr = image->opaque->info_ptr; +#ifdef PNG_BENIGN_ERRORS_SUPPORTED png_set_benign_errors(png_ptr, 1/*warn*/); +#endif png_read_info(png_ptr, info_ptr); /* Do this the fast way; just read directly out of png_struct. */ @@ -1431,7 +1444,7 @@ png_image_read_header(png_voidp argument) break; case PNG_COLOR_TYPE_PALETTE: - cmap_entries = png_ptr->num_palette; + cmap_entries = (png_uint_32)png_ptr->num_palette; break; default: @@ -1881,7 +1894,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: if (alpha < 65535) @@ -1903,7 +1916,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: if (alpha < 65535) @@ -1932,6 +1945,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_byte)alpha; + /* FALLTHROUGH */ case 3: entry[afirst + (2 ^ bgr)] = (png_byte)blue; entry[afirst + 1] = (png_byte)green; @@ -1940,6 +1954,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_byte)alpha; + /* FALLTHROUGH */ case 1: entry[afirst] = (png_byte)green; break; @@ -1966,7 +1981,7 @@ make_gray_file_colormap(png_image_read_control *display) for (i=0; i<256; ++i) png_create_colormap_entry(display, i, i, i, i, 255, P_FILE); - return i; + return (int)i; } static int @@ -1977,7 +1992,7 @@ make_gray_colormap(png_image_read_control *display) for (i=0; i<256; ++i) png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB); - return i; + return (int)i; } #define PNG_GRAY_COLORMAP_ENTRIES 256 @@ -2031,7 +2046,7 @@ make_ga_colormap(png_image_read_control *display) P_sRGB); } - return i; + return (int)i; } #define PNG_GA_COLORMAP_ENTRIES 256 @@ -2056,7 +2071,7 @@ make_rgb_colormap(png_image_read_control *display) } } - return i; + return (int)i; } #define PNG_RGB_COLORMAP_ENTRIES 216 @@ -2249,7 +2264,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "gray[16] color-map: too few entries"); - cmap_entries = make_gray_colormap(display); + cmap_entries = (unsigned int)make_gray_colormap(display); if (png_ptr->num_trans > 0) { @@ -2347,7 +2362,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "gray+alpha color-map: too few entries"); - cmap_entries = make_ga_colormap(display); + cmap_entries = (unsigned int)make_ga_colormap(display); background_index = PNG_CMAP_GA_BACKGROUND; output_processing = PNG_CMAP_GA; @@ -2381,7 +2396,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "gray-alpha color-map: too few entries"); - cmap_entries = make_gray_colormap(display); + cmap_entries = (unsigned int)make_gray_colormap(display); if (output_encoding == P_LINEAR) { @@ -2520,7 +2535,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "rgb[ga] color-map: too few entries"); - cmap_entries = make_ga_colormap(display); + cmap_entries = (unsigned int)make_ga_colormap(display); background_index = PNG_CMAP_GA_BACKGROUND; output_processing = PNG_CMAP_GA; } @@ -2546,12 +2561,12 @@ png_image_read_colormap(png_voidp argument) png_ptr->num_trans > 0) && png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0) { - cmap_entries = make_gray_file_colormap(display); + cmap_entries = (unsigned int)make_gray_file_colormap(display); data_encoding = P_FILE; } else - cmap_entries = make_gray_colormap(display); + cmap_entries = (unsigned int)make_gray_colormap(display); /* But if the input has alpha or transparency it must be removed */ @@ -2639,7 +2654,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries) png_error(png_ptr, "rgb+alpha color-map: too few entries"); - cmap_entries = make_rgb_colormap(display); + cmap_entries = (unsigned int)make_rgb_colormap(display); /* Add a transparent entry. */ png_create_colormap_entry(display, cmap_entries, 255, 255, @@ -2688,7 +2703,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries) png_error(png_ptr, "rgb-alpha color-map: too few entries"); - cmap_entries = make_rgb_colormap(display); + cmap_entries = (unsigned int)make_rgb_colormap(display); png_create_colormap_entry(display, cmap_entries, back_r, back_g, back_b, 0/*unused*/, output_encoding); @@ -2773,7 +2788,7 @@ png_image_read_colormap(png_voidp argument) if (PNG_RGB_COLORMAP_ENTRIES > image->colormap_entries) png_error(png_ptr, "rgb color-map: too few entries"); - cmap_entries = make_rgb_colormap(display); + cmap_entries = (unsigned int)make_rgb_colormap(display); output_processing = PNG_CMAP_RGB; } } @@ -2797,11 +2812,11 @@ png_image_read_colormap(png_voidp argument) output_processing = PNG_CMAP_NONE; data_encoding = P_FILE; /* Don't change from color-map indices */ - cmap_entries = png_ptr->num_palette; + cmap_entries = (unsigned int)png_ptr->num_palette; if (cmap_entries > 256) cmap_entries = 256; - if (cmap_entries > image->colormap_entries) + if (cmap_entries > (unsigned int)image->colormap_entries) png_error(png_ptr, "palette color-map: too few entries"); for (i=0; i < cmap_entries; ++i) @@ -2859,7 +2874,7 @@ png_image_read_colormap(png_voidp argument) case P_sRGB: /* Change to 8-bit sRGB */ png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB); - /* FALL THROUGH */ + /* FALLTHROUGH */ case P_FILE: if (png_ptr->bit_depth > 8) @@ -2913,7 +2928,7 @@ png_image_read_colormap(png_voidp argument) png_error(png_ptr, "bad background index (internal error)"); } - display->colormap_processing = output_processing; + display->colormap_processing = (int)output_processing; return 1/*ok*/; } @@ -3177,8 +3192,7 @@ png_image_read_colormapped(png_voidp argument) image->colormap_entries == 244 /* 216 + 1 + 27 */) break; - /* goto bad_output; */ - /* FALL THROUGH */ + goto bad_output; default: bad_output: @@ -3222,14 +3236,14 @@ png_image_read_colormapped(png_voidp argument) else { - png_alloc_size_t row_bytes = display->row_bytes; + png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes; while (--passes >= 0) { png_uint_32 y = image->height; png_bytep row = png_voidcast(png_bytep, display->first_row); - while (y-- > 0) + for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); row += row_bytes; @@ -3557,8 +3571,9 @@ png_image_read_background(png_voidp argument) * stride which was multiplied by 2 (below) to get row_bytes. */ ptrdiff_t step_row = display->row_bytes / 2; - int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0; - unsigned int outchannels = 1+preserve_alpha; + unsigned int preserve_alpha = (image->format & + PNG_FORMAT_FLAG_ALPHA) != 0; + unsigned int outchannels = 1U+preserve_alpha; int swap_alpha = 0; # ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED @@ -4055,14 +4070,14 @@ png_image_read_direct(png_voidp argument) else { - png_alloc_size_t row_bytes = display->row_bytes; + png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes; while (--passes >= 0) { png_uint_32 y = image->height; png_bytep row = png_voidcast(png_bytep, display->first_row); - while (y-- > 0) + for (; y > 0; --y) { png_read_row(png_ptr, row, NULL); row += row_bytes; @@ -4091,7 +4106,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, * bits; this is just to verify that the 'row_stride' argument can be * represented. */ - if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */ + if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; const png_uint_32 png_row_stride = image->width * channels; @@ -4100,10 +4115,10 @@ png_image_finish_read(png_imagep image, png_const_colorp background, row_stride = (png_int_32)/*SAFE*/png_row_stride; if (row_stride < 0) - check = -row_stride; + check = (png_uint_32)(-row_stride); else - check = row_stride; + check = (png_uint_32)row_stride; /* This verifies 'check', the absolute value of the actual stride * passed in and detects overflow in the application calculation (i.e. @@ -4128,7 +4143,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background, * accomodated on 64-bit systems. */ if (image->height <= - 0xFFFFFFFFU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check) + 0xffffffffU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check) { if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 || (image->colormap_entries > 0 && colormap != NULL)) diff --git a/Engine/lib/lpng/pngrtran.c b/Engine/lib/lpng/pngrtran.c index 748ffb3ed..9a30ddf22 100644 --- a/Engine/lib/lpng/pngrtran.c +++ b/Engine/lib/lpng/pngrtran.c @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action) case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */ png_warning(png_ptr, "Can't discard critical data on CRC error"); + /* FALLTHROUGH */ case PNG_CRC_ERROR_QUIT: /* Error/quit */ case PNG_CRC_DEFAULT: @@ -429,7 +430,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, int i; png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); for (i = 0; i < num_palette; i++) png_ptr->quantize_index[i] = (png_byte)i; } @@ -446,7 +447,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize an array to sort colors */ png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); /* Initialize the quantize_sort array */ for (i = 0; i < num_palette; i++) @@ -580,9 +581,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize palette index arrays */ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)(num_palette * (sizeof (png_byte)))); + (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); /* Initialize the sort array */ for (i = 0; i < num_palette; i++) @@ -1253,7 +1254,7 @@ png_init_rgb_transformations(png_structrp png_ptr) default: case 8: - /* FALL THROUGH (Already 8 bits) */ + /* FALLTHROUGH */ /* (Already 8 bits) */ case 16: /* Already a full 16 bits */ @@ -2150,7 +2151,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row) { png_bytep sp = row + (png_size_t)((row_width - 1) >> 3); png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07); + png_uint_32 shift = 7U - ((row_width + 7U) & 0x07); for (i = 0; i < row_width; i++) { *dp = (png_byte)((*sp >> shift) & 0x01); @@ -2174,7 +2175,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row) png_bytep sp = row + (png_size_t)((row_width - 1) >> 2); png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1); + png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1); for (i = 0; i < row_width; i++) { *dp = (png_byte)((*sp >> shift) & 0x03); @@ -2197,7 +2198,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row) { png_bytep sp = row + (png_size_t)((row_width - 1) >> 1); png_bytep dp = row + (png_size_t)row_width - 1; - png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2); + png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2); for (i = 0; i < row_width; i++) { *dp = (png_byte)((*sp >> shift) & 0x0f); @@ -2934,7 +2935,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row) * using the equation given in Poynton's ColorFAQ of 1998-01-04 at * (THIS LINK IS DEAD June 2008 but * versions dated 1998 through November 2002 have been archived at - * http://web.archive.org/web/20000816232553/http://www.inforamp.net/ + * https://web.archive.org/web/20000816232553/www.inforamp.net/ * ~poynton/notes/colour_and_gamma/ColorFAQ.txt ) * Charles Poynton poynton at poynton.com * @@ -3223,7 +3224,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x7f7f >> (7 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3252,7 +3254,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x3f3f >> (6 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)png_ptr->background.gray << shift; *sp = (png_byte)(tmp & 0xff); } @@ -3262,7 +3265,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) unsigned int g = (gamma_table [p | (p << 2) | (p << 4) | (p << 6)] >> 6) & 0x03; unsigned int tmp = *sp & (0x3f3f >> (6 - shift)); - tmp |= g << shift; + tmp |= (unsigned int)(g << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3288,7 +3291,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x3f3f >> (6 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)png_ptr->background.gray << shift; *sp = (png_byte)(tmp & 0xff); } @@ -3318,7 +3322,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3328,7 +3333,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) unsigned int g = (gamma_table[p | (p << 4)] >> 4) & 0x0f; unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= g << shift; + tmp |= (unsigned int)(g << shift); *sp = (png_byte)(tmp & 0xff); } @@ -3354,7 +3359,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= png_ptr->background.gray << shift; + tmp |= + (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } @@ -4297,7 +4303,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, if (num_trans > 0) { sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { @@ -4458,7 +4464,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, { gray = gray & 0xff; sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 1) - 1; + dp = row + ((png_size_t)row_width << 1) - 1; for (i = 0; i < row_width; i++) { @@ -4514,7 +4520,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green = (png_byte)(trans_color->green & 0xff); png_byte blue = (png_byte)(trans_color->blue & 0xff); sp = row + (png_size_t)row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) @@ -4537,7 +4543,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green_low = (png_byte)(trans_color->green & 0xff); png_byte blue_low = (png_byte)(trans_color->blue & 0xff); sp = row + row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 3) - 1; + dp = row + ((png_size_t)row_width << 3) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 5) == red_high && @@ -4596,7 +4602,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row) png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */ png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */ while (dp > sp) - dp[-2] = dp[-1] = *--sp, dp -= 2; + { + dp[-2] = dp[-1] = *--sp; dp -= 2; + } row_info->rowbytes *= 2; row_info->bit_depth = 16; diff --git a/Engine/lib/lpng/pngrutil.c b/Engine/lib/lpng/pngrutil.c index 3eaa635ad..a4fa71457 100644 --- a/Engine/lib/lpng/pngrutil.c +++ b/Engine/lib/lpng/pngrutil.c @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.25 [September 1, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -86,7 +86,7 @@ png_get_int_32)(png_const_bytep buf) { png_uint_32 uval = png_get_uint_32(buf); if ((uval & 0x80000000) == 0) /* non-negative */ - return uval; + return (png_int_32)uval; uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */ if ((uval & 0x80000000) == 0) /* no overflow */ @@ -181,6 +181,9 @@ png_read_chunk_header(png_structrp png_ptr) /* Check to see if chunk name is valid. */ png_check_chunk_name(png_ptr, png_ptr->chunk_name); + /* Check for too-large chunk length */ + png_check_chunk_length(png_ptr, length); + #ifdef PNG_IO_STATE_SUPPORTED png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA; #endif @@ -370,11 +373,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) */ { int ret; /* zlib return code */ -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 + int window_bits = 0; # if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW) - int window_bits; - if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) == PNG_OPTION_ON) { @@ -384,13 +386,11 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) else { - window_bits = 0; png_ptr->zstream_start = 1; } -# else -# define window_bits 0 # endif -#endif + +#endif /* ZLIB_VERNUM >= 0x1240 */ /* Set this for safety, just in case the previous owner left pointers to * memory allocations. @@ -402,25 +402,32 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0) { -#if PNG_ZLIB_VERNUM < 0x1240 - ret = inflateReset(&png_ptr->zstream); -#else +#if ZLIB_VERNUM >= 0x1240 ret = inflateReset2(&png_ptr->zstream, window_bits); +#else + ret = inflateReset(&png_ptr->zstream); #endif } else { -#if PNG_ZLIB_VERNUM < 0x1240 - ret = inflateInit(&png_ptr->zstream); -#else +#if ZLIB_VERNUM >= 0x1240 ret = inflateInit2(&png_ptr->zstream, window_bits); +#else + ret = inflateInit(&png_ptr->zstream); #endif if (ret == Z_OK) png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED; } +#if ZLIB_VERNUM >= 0x1290 && \ + defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) + if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON) + /* Turn off validation of the ADLER32 checksum in IDAT chunks */ + ret = inflateValidate(&png_ptr->zstream, 0); +#endif + if (ret == Z_OK) png_ptr->zowner = owner; @@ -435,7 +442,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) #endif } -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 /* Handle the start of the inflate stream if we called inflateInit2(strm,0); * in this case some zlib versions skip validation of the CINFO field and, in * certain circumstances, libpng may end up displaying an invalid image, in @@ -713,7 +720,7 @@ png_decompress_chunk(png_structrp png_ptr, * the extra space may otherwise be used as a Trojan Horse. */ if (ret == Z_STREAM_END && - chunklength - prefix_size != lzsize) + chunklength - prefix_size != lzsize) png_chunk_benign_error(png_ptr, "extra compressed data"); } @@ -823,7 +830,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size, return Z_STREAM_ERROR; } } -#endif +#endif /* READ_iCCP */ /* Read and check the IDHR chunk */ @@ -1011,7 +1018,7 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) #endif { - png_crc_finish(png_ptr, (int) length - num * 3); + png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3)); } #ifndef PNG_READ_OPT_PLTE_SUPPORTED @@ -1373,11 +1380,13 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) * chunk is just ignored, so does not invalidate the color space. An * alternative is to set the 'invalid' flags at the start of this routine * and only clear them in they were not set before and all the tests pass. - * The minimum 'deflate' stream is assumed to be just the 2 byte header and - * 4 byte checksum. The keyword must be at least one character and there is - * a terminator (0) byte and the compression method. */ - if (length < 9) + + /* The keyword must be at least one character and there is a + * terminator (0) byte and the compression method byte, and the + * 'zlib' datastream is at least 11 bytes. + */ + if (length < 14) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, "too short"); @@ -1409,6 +1418,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) png_crc_read(png_ptr, (png_bytep)keyword, read_length); length -= read_length; + /* The minimum 'zlib' stream is assumed to be just the 2 byte header, + * 5 bytes minimum 'deflate' stream, and the 4 byte checksum. + */ + if (length < 11) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "too short"); + return; + } + keyword_length = 0; while (keyword_length < 80 && keyword_length < read_length && keyword[keyword_length] != 0) @@ -1427,7 +1446,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK) { - Byte profile_header[132]; + Byte profile_header[132]={0}; Byte local_buffer[PNG_INFLATE_BUF_SIZE]; png_alloc_size_t size = (sizeof profile_header); @@ -1717,13 +1736,13 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) data_length = length - (png_uint_32)(entry_start - buffer); /* Integrity-check the data length */ - if ((data_length % entry_size) != 0) + if ((data_length % (unsigned int)entry_size) != 0) { png_warning(png_ptr, "sPLT chunk has bad length"); return; } - dl = (png_int_32)(data_length / entry_size); + dl = (png_uint_32)(data_length / (unsigned int)entry_size); max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry)); if (dl > max_dl) @@ -1732,10 +1751,10 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) return; } - new_palette.nentries = (png_int_32)(data_length / entry_size); + new_palette.nentries = (png_int_32)(data_length / (unsigned int)entry_size); - new_palette.entries = (png_sPLT_entryp)png_malloc_warn( - png_ptr, new_palette.nentries * (sizeof (png_sPLT_entry))); + new_palette.entries = (png_sPLT_entryp)png_malloc_warn(png_ptr, + (png_alloc_size_t) new_palette.nentries * (sizeof (png_sPLT_entry))); if (new_palette.entries == NULL) { @@ -2005,6 +2024,69 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) } #endif +#ifdef PNG_READ_eXIf_SUPPORTED +void /* PRIVATE */ +png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) +{ + unsigned int i; + + png_debug(1, "in png_handle_eXIf"); + + if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) + png_chunk_error(png_ptr, "missing IHDR"); + + if (length < 2) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "too short"); + return; + } + + else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "duplicate"); + return; + } + + info_ptr->free_me |= PNG_FREE_EXIF; + + info_ptr->eXIf_buf = png_voidcast(png_bytep, + png_malloc_warn(png_ptr, length)); + + if (info_ptr->eXIf_buf == NULL) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "out of memory"); + return; + } + + for (i = 0; i < length; i++) + { + png_byte buf[1]; + png_crc_read(png_ptr, buf, 1); + info_ptr->eXIf_buf[i] = buf[0]; + if (i == 1 && buf[0] != 'M' && buf[0] != 'I' + && info_ptr->eXIf_buf[0] != buf[0]) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "incorrect byte-order specifier"); + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; + return; + } + } + + if (png_crc_finish(png_ptr, 0) != 0) + return; + + png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf); + + png_free(png_ptr, info_ptr->eXIf_buf); + info_ptr->eXIf_buf = NULL; +} +#endif + #ifdef PNG_READ_hIST_SUPPORTED void /* PRIVATE */ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) @@ -2533,6 +2615,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) png_ptr->mode |= PNG_AFTER_IDAT; + /* Note, "length" is sufficient here; we won't be adding + * a null terminator later. + */ buffer = png_read_buffer(png_ptr, length, 2/*silent*/); if (buffer == NULL) @@ -2579,23 +2664,28 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_text text; - /* It worked; png_ptr->read_buffer now looks like a tEXt chunk except - * for the extra compression type byte and the fact that it isn't - * necessarily '\0' terminated. - */ - buffer = png_ptr->read_buffer; - buffer[uncompressed_length+(keyword_length+2)] = 0; + if (png_ptr->read_buffer == NULL) + errmsg="Read failure in png_handle_zTXt"; + else + { + /* It worked; png_ptr->read_buffer now looks like a tEXt chunk + * except for the extra compression type byte and the fact that + * it isn't necessarily '\0' terminated. + */ + buffer = png_ptr->read_buffer; + buffer[uncompressed_length+(keyword_length+2)] = 0; - text.compression = PNG_TEXT_COMPRESSION_zTXt; - text.key = (png_charp)buffer; - text.text = (png_charp)(buffer + keyword_length+2); - text.text_length = uncompressed_length; - text.itxt_length = 0; - text.lang = NULL; - text.lang_key = NULL; + text.compression = PNG_TEXT_COMPRESSION_zTXt; + text.key = (png_charp)buffer; + text.text = (png_charp)(buffer + keyword_length+2); + text.text_length = uncompressed_length; + text.itxt_length = 0; + text.lang = NULL; + text.lang_key = NULL; - if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) - errmsg = "insufficient memory"; + if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) + errmsg = "insufficient memory"; + } } else @@ -2971,7 +3061,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, case 2: png_ptr->user_chunk_cache_max = 1; png_chunk_benign_error(png_ptr, "no space in chunk cache"); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: /* NOTE: prior to 1.6.0 this case resulted in an unknown critical * chunk being skipped, now there will be a hard error below. @@ -2980,7 +3070,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, default: /* not at limit */ --(png_ptr->user_chunk_cache_max); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 0: /* no limit */ # endif /* USER_LIMITS */ /* Here when the limit isn't reached or when limits are compiled @@ -3031,20 +3121,58 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, */ void /* PRIVATE */ -png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name) +png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name) { int i; + png_uint_32 cn=chunk_name; png_debug(1, "in png_check_chunk_name"); for (i=1; i<=4; ++i) { - int c = chunk_name & 0xff; + int c = cn & 0xff; if (c < 65 || c > 122 || (c > 90 && c < 97)) png_chunk_error(png_ptr, "invalid chunk type"); - chunk_name >>= 8; + cn >>= 8; + } +} + +void /* PRIVATE */ +png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) +{ + png_alloc_size_t limit = PNG_UINT_31_MAX; + + if (png_ptr->chunk_name != png_IDAT) + { +# ifdef PNG_SET_USER_LIMITS_SUPPORTED + if (png_ptr->user_chunk_malloc_max > 0 && + png_ptr->user_chunk_malloc_max < limit) + limit = png_ptr->user_chunk_malloc_max; +# elif PNG_USER_CHUNK_MALLOC_MAX > 0 + if (PNG_USER_CHUNK_MALLOC_MAX < limit) + limit = PNG_USER_CHUNK_MALLOC_MAX; +# endif + } + else + { + size_t row_factor = + (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1) + + 1 + (png_ptr->interlaced? 6: 0)); + if (png_ptr->height > PNG_UINT_32_MAX/row_factor) + limit=PNG_UINT_31_MAX; + else + limit = png_ptr->height * row_factor; + limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */ + limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX; + } + + if (length > limit) + { + png_debug2(0," length = %lu, limit = %lu", + (unsigned long)length,(unsigned long)limit); + png_chunk_error(png_ptr, "chunk data is too large"); } } @@ -3099,7 +3227,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) # ifdef PNG_READ_PACKSWAP_SUPPORTED if ((png_ptr->transformations & PNG_PACKSWAP) != 0) /* little-endian byte */ - end_mask = 0xff << end_mask; + end_mask = (unsigned int)(0xff << end_mask); else /* big-endian byte */ # endif @@ -3373,7 +3501,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */ do { - dp[0] = sp[0], dp[1] = sp[1]; + dp[0] = sp[0]; dp[1] = sp[1]; if (row_width <= bytes_to_jump) return; @@ -3394,7 +3522,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display) */ for (;;) { - dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2]; + dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2]; if (row_width <= bytes_to_jump) return; @@ -3545,7 +3673,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Offset to next interlace block */ - static PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; + static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; png_debug(1, "in png_do_read_interlace"); if (row != NULL && row_info != NULL) @@ -3560,9 +3688,10 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3); png_bytep dp = row + (png_size_t)((final_width - 1) >> 3); - int sshift, dshift; - int s_start, s_end, s_inc; - int jstop = png_pass_inc[pass]; + unsigned int sshift, dshift; + unsigned int s_start, s_end; + int s_inc; + int jstop = (int)png_pass_inc[pass]; png_byte v; png_uint_32 i; int j; @@ -3570,8 +3699,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, #ifdef PNG_READ_PACKSWAP_SUPPORTED if ((transformations & PNG_PACKSWAP) != 0) { - sshift = (int)((row_info->width + 7) & 0x07); - dshift = (int)((final_width + 7) & 0x07); + sshift = ((row_info->width + 7) & 0x07); + dshift = ((final_width + 7) & 0x07); s_start = 7; s_end = 0; s_inc = -1; @@ -3580,8 +3709,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = 7 - (int)((row_info->width + 7) & 0x07); - dshift = 7 - (int)((final_width + 7) & 0x07); + sshift = 7 - ((row_info->width + 7) & 0x07); + dshift = 7 - ((final_width + 7) & 0x07); s_start = 0; s_end = 7; s_inc = 1; @@ -3593,7 +3722,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, for (j = 0; j < jstop; j++) { unsigned int tmp = *dp & (0x7f7f >> (7 - dshift)); - tmp |= v << dshift; + tmp |= (unsigned int)(v << dshift); *dp = (png_byte)(tmp & 0xff); if (dshift == s_end) @@ -3603,7 +3732,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - dshift += s_inc; + dshift = (unsigned int)((int)dshift + s_inc); } if (sshift == s_end) @@ -3613,7 +3742,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - sshift += s_inc; + sshift = (unsigned int)((int)sshift + s_inc); } break; } @@ -3622,16 +3751,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2); png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2); - int sshift, dshift; - int s_start, s_end, s_inc; - int jstop = png_pass_inc[pass]; + unsigned int sshift, dshift; + unsigned int s_start, s_end; + int s_inc; + int jstop = (int)png_pass_inc[pass]; png_uint_32 i; #ifdef PNG_READ_PACKSWAP_SUPPORTED if ((transformations & PNG_PACKSWAP) != 0) { - sshift = (int)(((row_info->width + 3) & 0x03) << 1); - dshift = (int)(((final_width + 3) & 0x03) << 1); + sshift = (((row_info->width + 3) & 0x03) << 1); + dshift = (((final_width + 3) & 0x03) << 1); s_start = 6; s_end = 0; s_inc = -2; @@ -3640,8 +3770,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1); - dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1); + sshift = ((3 - ((row_info->width + 3) & 0x03)) << 1); + dshift = ((3 - ((final_width + 3) & 0x03)) << 1); s_start = 0; s_end = 6; s_inc = 2; @@ -3656,7 +3786,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, for (j = 0; j < jstop; j++) { unsigned int tmp = *dp & (0x3f3f >> (6 - dshift)); - tmp |= v << dshift; + tmp |= (unsigned int)(v << dshift); *dp = (png_byte)(tmp & 0xff); if (dshift == s_end) @@ -3666,7 +3796,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - dshift += s_inc; + dshift = (unsigned int)((int)dshift + s_inc); } if (sshift == s_end) @@ -3676,7 +3806,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - sshift += s_inc; + sshift = (unsigned int)((int)sshift + s_inc); } break; } @@ -3685,16 +3815,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, { png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1); png_bytep dp = row + (png_size_t)((final_width - 1) >> 1); - int sshift, dshift; - int s_start, s_end, s_inc; + unsigned int sshift, dshift; + unsigned int s_start, s_end; + int s_inc; png_uint_32 i; - int jstop = png_pass_inc[pass]; + int jstop = (int)png_pass_inc[pass]; #ifdef PNG_READ_PACKSWAP_SUPPORTED if ((transformations & PNG_PACKSWAP) != 0) { - sshift = (int)(((row_info->width + 1) & 0x01) << 2); - dshift = (int)(((final_width + 1) & 0x01) << 2); + sshift = (((row_info->width + 1) & 0x01) << 2); + dshift = (((final_width + 1) & 0x01) << 2); s_start = 4; s_end = 0; s_inc = -4; @@ -3703,8 +3834,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, else #endif { - sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2); - dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2); + sshift = ((1 - ((row_info->width + 1) & 0x01)) << 2); + dshift = ((1 - ((final_width + 1) & 0x01)) << 2); s_start = 0; s_end = 4; s_inc = 4; @@ -3718,7 +3849,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, for (j = 0; j < jstop; j++) { unsigned int tmp = *dp & (0xf0f >> (4 - dshift)); - tmp |= v << dshift; + tmp |= (unsigned int)(v << dshift); *dp = (png_byte)(tmp & 0xff); if (dshift == s_end) @@ -3728,7 +3859,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - dshift += s_inc; + dshift = (unsigned int)((int)dshift + s_inc); } if (sshift == s_end) @@ -3738,7 +3869,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, } else - sshift += s_inc; + sshift = (unsigned int)((int)sshift + s_inc); } break; } @@ -3752,7 +3883,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass, png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; - int jstop = png_pass_inc[pass]; + int jstop = (int)png_pass_inc[pass]; png_uint_32 i; for (i = 0; i < row_info->width; i++) @@ -3880,7 +4011,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row, /* Find the best predictor, the least of pa, pb, pc favoring the earlier * ones in the case of a tie. */ - if (pb < pa) pa = pb, a = b; + if (pb < pa) + { + pa = pb; a = b; + } if (pc < pa) a = c; /* Calculate the current pixel in a, and move the previous row pixel to c @@ -3896,7 +4030,7 @@ static void png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, png_const_bytep prev_row) { - int bpp = (row_info->pixel_depth + 7) >> 3; + unsigned int bpp = (row_info->pixel_depth + 7) >> 3; png_bytep rp_end = row + bpp; /* Process the first pixel in the row completely (this is the same as 'up' @@ -3909,7 +4043,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, } /* Remainder */ - rp_end += row_info->rowbytes - bpp; + rp_end = rp_end + (row_info->rowbytes - bpp); while (row < rp_end) { @@ -3932,7 +4066,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row, pc = (p + pc) < 0 ? -(p + pc) : p + pc; #endif - if (pb < pa) pa = pb, a = b; + if (pb < pa) + { + pa = pb; a = b; + } if (pc < pa) a = c; a += *row; @@ -4254,7 +4391,7 @@ png_read_start_row(png_structrp png_ptr) /* Offset to next interlace block in the y direction */ static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; - int max_pixel_depth; + unsigned int max_pixel_depth; png_size_t row_bytes; png_debug(1, "in png_read_start_row"); @@ -4283,7 +4420,7 @@ png_read_start_row(png_structrp png_ptr) png_ptr->iwidth = png_ptr->width; } - max_pixel_depth = png_ptr->pixel_depth; + max_pixel_depth = (unsigned int)png_ptr->pixel_depth; /* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of * calculations to calculate the final pixel depth, then @@ -4418,7 +4555,7 @@ png_read_start_row(png_structrp png_ptr) defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0) { - int user_pixel_depth = png_ptr->user_transform_depth * + unsigned int user_pixel_depth = png_ptr->user_transform_depth * png_ptr->user_transform_channels; if (user_pixel_depth > max_pixel_depth) @@ -4440,7 +4577,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) * for safety's sake */ row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) + - 1 + ((max_pixel_depth + 7) >> 3); + 1 + ((max_pixel_depth + 7) >> 3U); #ifdef PNG_MAX_MALLOC_64K if (row_bytes > (png_uint_32)65536L) @@ -4509,7 +4646,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) * does not, so free the read buffer now regardless; the sequential reader * reallocates it on demand. */ - if (png_ptr->read_buffer != 0) + if (png_ptr->read_buffer != NULL) { png_bytep buffer = png_ptr->read_buffer; diff --git a/Engine/lib/lpng/pngset.c b/Engine/lib/lpng/pngset.c index cccd9cdc7..6f3a1ee11 100644 --- a/Engine/lib/lpng/pngset.c +++ b/Engine/lib/lpng/pngset.c @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -134,6 +134,53 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #endif /* cHRM */ +#ifdef PNG_eXIf_SUPPORTED +void PNGAPI +png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + const png_bytep eXIf_buf) +{ + png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1"); + PNG_UNUSED(info_ptr) + PNG_UNUSED(eXIf_buf) +} + +void PNGAPI +png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr, + const png_uint_32 num_exif, const png_bytep eXIf_buf) +{ + int i; + + png_debug1(1, "in %s storage function", "eXIf"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + if (info_ptr->exif) + { + png_free(png_ptr, info_ptr->exif); + info_ptr->exif = NULL; + } + + info_ptr->num_exif = num_exif; + + info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, + info_ptr->num_exif)); + + if (info_ptr->exif == NULL) + { + png_warning(png_ptr, "Insufficient memory for eXIf chunk data"); + return; + } + + info_ptr->free_me |= PNG_FREE_EXIF; + + for (i = 0; i < (int) info_ptr->num_exif; i++) + info_ptr->exif[i] = eXIf_buf[i]; + + info_ptr->valid |= PNG_INFO_eXIf; +} +#endif /* eXIf */ + #ifdef PNG_gAMA_SUPPORTED void PNGFAPI png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr, @@ -283,17 +330,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, /* Check that the type matches the specification. */ if (type < 0 || type > 3) - png_error(png_ptr, "Invalid pCAL equation type"); + { + png_chunk_report(png_ptr, "Invalid pCAL equation type", + PNG_CHUNK_WRITE_ERROR); + return; + } if (nparams < 0 || nparams > 255) - png_error(png_ptr, "Invalid pCAL parameter count"); + { + png_chunk_report(png_ptr, "Invalid pCAL parameter count", + PNG_CHUNK_WRITE_ERROR); + return; + } /* Validate params[nparams] */ for (i=0; ipcal_purpose = png_voidcast(png_charp, @@ -301,8 +360,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, if (info_ptr->pcal_purpose == NULL) { - png_warning(png_ptr, "Insufficient memory for pCAL purpose"); - + png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose", + PNG_CHUNK_WRITE_ERROR); return; } @@ -331,7 +390,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, memcpy(info_ptr->pcal_units, units, length); info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr, - (png_size_t)((nparams + 1) * (sizeof (png_charp))))); + (png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp))))); if (info_ptr->pcal_params == NULL) { @@ -340,7 +399,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr, return; } - memset(info_ptr->pcal_params, 0, (nparams + 1) * (sizeof (png_charp))); + memset(info_ptr->pcal_params, 0, ((unsigned int)nparams + 1) * + (sizeof (png_charp))); for (i = 0; i < nparams; i++) { @@ -563,7 +623,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr, PNG_MAX_PALETTE_LENGTH * (sizeof (png_color)))); if (num_palette > 0) - memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color))); + memcpy(png_ptr->palette, palette, (unsigned int)num_palette * + (sizeof (png_color))); info_ptr->palette = png_ptr->palette; info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette; @@ -1080,7 +1141,7 @@ png_set_sPLT(png_const_structrp png_ptr, * checked it when doing the allocation. */ memcpy(np->entries, entries->entries, - entries->nentries * sizeof (png_sPLT_entry)); + (unsigned int)entries->nentries * sizeof (png_sPLT_entry)); /* Note that 'continue' skips the advance of the out pointer and out * count, so an invalid entry is not added. @@ -1088,8 +1149,9 @@ png_set_sPLT(png_const_structrp png_ptr, info_ptr->valid |= PNG_INFO_sPLT; ++(info_ptr->splt_palettes_num); ++np; + ++entries; } - while (++entries, --nentries); + while (--nentries); if (nentries > 0) png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR); @@ -1249,7 +1311,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr, { png_app_error(png_ptr, "invalid unknown chunk location"); /* Fake out the pre 1.6.0 behavior: */ - if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */ + if (((unsigned int)location & PNG_HAVE_IDAT) != 0) /* undocumented! */ location = PNG_AFTER_IDAT; else @@ -1340,6 +1402,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, static PNG_CONST png_byte chunks_to_ignore[] = { 98, 75, 71, 68, '\0', /* bKGD */ 99, 72, 82, 77, '\0', /* cHRM */ + 101, 88, 73, 102, '\0', /* eXIf */ 103, 65, 77, 65, '\0', /* gAMA */ 104, 73, 83, 84, '\0', /* hIST */ 105, 67, 67, 80, '\0', /* iCCP */ @@ -1373,7 +1436,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep, return; } - num_chunks = num_chunks_in; + num_chunks = (unsigned int)num_chunks_in; } old_num_chunks = png_ptr->num_chunk_list; @@ -1563,7 +1626,7 @@ void PNGAPI png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask) { if (png_ptr != NULL && info_ptr != NULL) - info_ptr->valid &= ~mask; + info_ptr->valid &= (unsigned int)(~mask); } @@ -1682,14 +1745,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) png_byte ch = (png_byte)*key++; if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/)) - *new_key++ = ch, ++key_len, space = 0; + { + *new_key++ = ch; ++key_len; space = 0; + } else if (space == 0) { /* A space or an invalid character when one wasn't seen immediately * before; output just a space. */ - *new_key++ = 32, ++key_len, space = 1; + *new_key++ = 32; ++key_len; space = 1; /* If the character was not a space then it is invalid. */ if (ch != 32) @@ -1702,7 +1767,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key) if (key_len > 0 && space != 0) /* trailing space */ { - --key_len, --new_key; + --key_len; --new_key; if (bad_character == 0) bad_character = 32; } diff --git a/Engine/lib/lpng/pngstruct.h b/Engine/lib/lpng/pngstruct.h index 2b0eb4902..d83f97125 100644 --- a/Engine/lib/lpng/pngstruct.h +++ b/Engine/lib/lpng/pngstruct.h @@ -1,8 +1,8 @@ /* pngstruct.h - header file for PNG reference library * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -263,7 +263,7 @@ struct png_struct_def /* pixel depth used for the row buffers */ png_byte transformed_pixel_depth; /* pixel depth after read/write transforms */ -#if PNG_ZLIB_VERNUM >= 0x1240 +#if ZLIB_VERNUM >= 0x1240 png_byte zstream_start; /* at start of an input zlib stream */ #endif /* Zlib >= 1.2.4 */ #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) @@ -353,7 +353,7 @@ struct png_struct_def /* Options */ #ifdef PNG_SET_OPTION_SUPPORTED - png_byte options; /* On/off state (up to 4 options) */ + png_uint_32 options; /* On/off state (up to 16 options) */ #endif #if PNG_LIBPNG_VER < 10700 diff --git a/Engine/lib/lpng/pngtest.c b/Engine/lib/lpng/pngtest.c index 9034d16fc..ce53345e1 100644 --- a/Engine/lib/lpng/pngtest.c +++ b/Engine/lib/lpng/pngtest.c @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.6.25 [September 1, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -43,15 +43,6 @@ #include "png.h" -/* 1.6.1 added support for the configure test harness, which uses 77 to indicate - * a skipped test, in earlier versions we need to succeed on a skipped test, so: - */ -#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H) -# define SKIP 77 -#else -# define SKIP 0 -#endif - /* Known chunks that exist in pngtest.png must be supported or pngtest will fail * simply as a result of re-ordering them. This may be fixed in 1.7 * @@ -153,6 +144,7 @@ tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t) static int verbose = 0; static int strict = 0; static int relaxed = 0; +static int xfail = 0; static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */ static int error_count = 0; /* count calls to png_error */ static int warning_count = 0; /* count calls to png_warning */ @@ -472,7 +464,7 @@ pngtest_warning(png_structp png_ptr, png_const_charp message) if (test != NULL && test->file_name != NULL) name = test->file_name; - fprintf(STDERR, "%s: libpng warning: %s\n", name, message); + fprintf(STDERR, "\n%s: libpng warning: %s\n", name, message); } /* This is the default error handling function. Note that replacements for @@ -514,10 +506,10 @@ typedef struct memory_information typedef memory_information *memory_infop; static memory_infop pinformation = NULL; -static png_alloc_size_t current_allocation = 0; -static png_alloc_size_t maximum_allocation = 0; -static png_alloc_size_t total_allocation = 0; -static png_alloc_size_t num_allocations = 0; +static int current_allocation = 0; +static int maximum_allocation = 0; +static int total_allocation = 0; +static int num_allocations = 0; png_voidp PNGCBAPI png_debug_malloc PNGARG((png_structp png_ptr, png_alloc_size_t size)); @@ -604,10 +596,9 @@ png_debug_free(png_structp png_ptr, png_voidp ptr) if (pinfo->pointer == ptr) { *ppinfo = pinfo->next; - if (current_allocation < pinfo->size) + current_allocation -= pinfo->size; + if (current_allocation < 0) fprintf(STDERR, "Duplicate free of memory\n"); - else - current_allocation -= pinfo->size; /* We must free the list element too, but first kill the memory that is to be freed. */ memset(ptr, 0x55, pinfo->size); @@ -939,12 +930,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) read_user_chunk_callback); #endif -#ifdef PNG_SET_USER_LIMITS_SUPPORTED -# ifdef CHUNK_LIMIT /* from the build, for testing */ - png_set_chunk_malloc_max(read_ptr, CHUNK_LIMIT); -# endif /* CHUNK_LIMIT */ -#endif - #ifdef PNG_SETJMP_SUPPORTED pngtest_debug("Setting jmpbuf for read struct"); if (setjmp(png_jmpbuf(read_ptr))) @@ -952,8 +937,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); png_free(read_ptr, row_buf); row_buf = NULL; + if (verbose != 0) + fprintf(STDERR, " destroy read structs\n"); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); #ifdef PNG_WRITE_SUPPORTED + if (verbose != 0) + fprintf(STDERR, " destroy write structs\n"); png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_write_struct(&write_ptr, &write_info_ptr); #endif @@ -968,11 +957,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) if (setjmp(png_jmpbuf(write_ptr))) { fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname); + if (verbose != 0) + fprintf(STDERR, " destroying read structs\n"); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); + if (verbose != 0) + fprintf(STDERR, " destroying write structs\n"); png_destroy_info_struct(write_ptr, &write_end_info_ptr); -#ifdef PNG_WRITE_SUPPORTED png_destroy_write_struct(&write_ptr, &write_info_ptr); -#endif FCLOSE(fpin); FCLOSE(fpout); return (1); @@ -980,15 +971,16 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) #endif #endif +#ifdef PNG_BENIGN_ERRORS_SUPPORTED if (strict != 0) { /* Treat png_benign_error() as errors on read */ png_set_benign_errors(read_ptr, 0); -#ifdef PNG_WRITE_SUPPORTED +# ifdef PNG_WRITE_SUPPORTED /* Treat them as errors on write */ png_set_benign_errors(write_ptr, 0); -#endif +# endif /* if strict is not set, then app warnings and errors are treated as * warnings in release builds, but not in unstable builds; this can be @@ -1001,10 +993,20 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) /* Allow application (pngtest) errors and warnings to pass */ png_set_benign_errors(read_ptr, 1); -#ifdef PNG_WRITE_SUPPORTED - png_set_benign_errors(write_ptr, 1); + /* Turn off CRC checking while reading */ + png_set_crc_action(read_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE); + +#ifdef PNG_IGNORE_ADLER32 + /* Turn off ADLER32 checking while reading */ + png_set_option(read_ptr, PNG_IGNORE_ADLER32, PNG_OPTION_ON); #endif + +# ifdef PNG_WRITE_SUPPORTED + png_set_benign_errors(write_ptr, 1); +# endif + } +#endif /* BENIGN_ERRORS */ pngtest_debug("Initializing input and output streams"); #ifdef PNG_STDIO_SUPPORTED @@ -1197,6 +1199,22 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif +#ifdef PNG_READ_eXIf_SUPPORTED + { + png_bytep exif=NULL; + png_uint_32 exif_length; + + if (png_get_eXIf_1(read_ptr, read_info_ptr, &exif_length, &exif) != 0) + { + if (exif_length > 1) + fprintf(STDERR," eXIf type %c%c, %lu bytes\n",exif[0],exif[1], + (unsigned long)exif_length); +# ifdef PNG_WRITE_eXIf_SUPPORTED + png_set_eXIf_1(write_ptr, write_info_ptr, exif_length, exif); +# endif + } + } +#endif #ifdef PNG_hIST_SUPPORTED { png_uint_16p hist; @@ -1307,10 +1325,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) { int i; - printf("\n"); + fprintf(STDERR,"\n"); for (i=0; i 1) + fprintf(STDERR," eXIf type %c%c, %lu bytes\n",exif[0],exif[1], + (unsigned long)exif_length); +# ifdef PNG_WRITE_eXIf_SUPPORTED + png_set_eXIf_1(write_ptr, write_end_info_ptr, exif_length, exif); +# endif + } + } +#endif #ifdef PNG_tIME_SUPPORTED { png_timep mod_time; @@ -1845,6 +1888,7 @@ main(int argc, char *argv[]) inname = argv[2]; strict++; relaxed = 0; + multiple=1; } else if (strcmp(argv[1], "--relaxed") == 0) @@ -1854,6 +1898,17 @@ main(int argc, char *argv[]) inname = argv[2]; strict = 0; relaxed++; + multiple=1; + } + else if (strcmp(argv[1], "--xfail") == 0) + { + status_dots_requested = 0; + verbose = 1; + inname = argv[2]; + strict = 0; + xfail++; + relaxed++; + multiple=1; } else @@ -1883,7 +1938,7 @@ main(int argc, char *argv[]) { int i; #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG - png_alloc_size_t allocation_now = current_allocation; + int allocation_now = current_allocation; #endif for (i=2; ipixel_depth = 8; } @@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ sp += 2; else /* Skip initial channel and, for sp, the filler */ - sp += 4, dp += 2; + { + sp += 4; dp += 2; + } while (sp < ep) - *dp++ = *sp++, *dp++ = *sp, sp += 3; + { + *dp++ = *sp++; *dp++ = *sp; sp += 3; + } row_info->pixel_depth = 16; } @@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ ++sp; else /* Skip initial channels and, for sp, the filler */ - sp += 4, dp += 3; + { + sp += 4; dp += 3; + } /* Note that the loop adds 3 to dp and 4 to sp each time. */ while (sp < ep) - *dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2; + { + *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2; + } row_info->pixel_depth = 24; } @@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) if (at_start != 0) /* Skip initial filler */ sp += 2; else /* Skip initial channels and, for sp, the filler */ - sp += 8, dp += 6; + { + sp += 8; dp += 6; + } while (sp < ep) { /* Copy 6 bytes, skip 2 */ - *dp++ = *sp++, *dp++ = *sp++; - *dp++ = *sp++, *dp++ = *sp++; - *dp++ = *sp++, *dp++ = *sp, sp += 3; + *dp++ = *sp++; *dp++ = *sp++; + *dp++ = *sp++; *dp++ = *sp++; + *dp++ = *sp++; *dp++ = *sp; sp += 3; } row_info->pixel_depth = 48; @@ -595,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) return; /* The filler channel has gone already */ /* Fix the rowbytes value. */ - row_info->rowbytes = dp-row; + row_info->rowbytes = (unsigned int)(dp-row); } #endif @@ -693,7 +707,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) * and this calculation is used because it avoids warnings that other * forms produced on either GCC or MSVC. */ - int padding = (-row_info->pixel_depth * row_info->width) & 7; + int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width); png_bytep rp = png_ptr->row_buf + row_info->rowbytes; switch (row_info->bit_depth) diff --git a/Engine/lib/lpng/pngwrite.c b/Engine/lib/lpng/pngwrite.c index aaa2b017d..a7662acb7 100644 --- a/Engine/lib/lpng/pngwrite.c +++ b/Engine/lib/lpng/pngwrite.c @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -237,6 +237,11 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr) png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED + if ((info_ptr->valid & PNG_INFO_eXIf) != 0) + png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); +#endif + #ifdef PNG_WRITE_hIST_SUPPORTED if ((info_ptr->valid & PNG_INFO_hIST) != 0) png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); @@ -432,6 +437,12 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr) } } #endif + +#ifdef PNG_WRITE_eXIf_SUPPORTED + if ((info_ptr->valid & PNG_INFO_eXIf) != 0) + png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif); +#endif + #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT); #endif @@ -666,9 +677,9 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) { - png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1); - png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3); - png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5); + png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1); + png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3); + png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5); png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL); png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL); *(rp ) = (png_byte)(red >> 8); @@ -901,7 +912,7 @@ png_set_flush(png_structrp png_ptr, int nrows) if (png_ptr == NULL) return; - png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); + png_ptr->flush_dist = (nrows < 0 ? 0 : (png_uint_32)nrows); } /* Flush the current output buffers now */ @@ -1007,8 +1018,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters) case 5: case 6: case 7: png_app_error(png_ptr, "Unknown row filter for method 0"); - /* FALL THROUGH */ #endif /* WRITE_FILTER */ + /* FALLTHROUGH */ case PNG_FILTER_VALUE_NONE: png_ptr->do_filter = PNG_FILTER_NONE; break; @@ -1525,7 +1536,8 @@ png_write_image_16bit(png_voidp argument) display->first_row); png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row); png_uint_16p row_end; - const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; + const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + 3 : 1; int aindex = 0; png_uint_32 y = image->height; @@ -1539,9 +1551,9 @@ png_write_image_16bit(png_voidp argument) ++output_row; } else - aindex = channels; + aindex = (int)channels; # else - aindex = channels; + aindex = (int)channels; # endif } @@ -1554,7 +1566,7 @@ png_write_image_16bit(png_voidp argument) */ row_end = output_row + image->width * (channels+1); - while (y-- > 0) + for (; y > 0; --y) { png_const_uint_16p in_ptr = input_row; png_uint_16p out_ptr = output_row; @@ -1575,7 +1587,7 @@ png_write_image_16bit(png_voidp argument) if (alpha > 0 && alpha < 65535) reciprocal = ((0xffff<<15)+(alpha>>1))/alpha; - c = channels; + c = (int)channels; do /* always at least one channel */ { png_uint_16 component = *in_ptr++; @@ -1610,7 +1622,7 @@ png_write_image_16bit(png_voidp argument) } png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row)); - input_row += display->row_bytes/(sizeof (png_uint_16)); + input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16)); } return 1; @@ -1683,7 +1695,8 @@ png_write_image_8bit(png_voidp argument) display->first_row); png_bytep output_row = png_voidcast(png_bytep, display->local_row); png_uint_32 y = image->height; - const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1; + const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? + 3 : 1; if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0) { @@ -1700,12 +1713,12 @@ png_write_image_8bit(png_voidp argument) else # endif - aindex = channels; + aindex = (int)channels; /* Use row_end in place of a loop counter: */ row_end = output_row + image->width * (channels+1); - while (y-- > 0) + for (; y > 0; --y) { png_const_uint_16p in_ptr = input_row; png_bytep out_ptr = output_row; @@ -1723,7 +1736,7 @@ png_write_image_8bit(png_voidp argument) if (alphabyte > 0 && alphabyte < 255) reciprocal = UNP_RECIPROCAL(alpha); - c = channels; + c = (int)channels; do /* always at least one channel */ *out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal); while (--c > 0); @@ -1735,7 +1748,7 @@ png_write_image_8bit(png_voidp argument) png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row)); - input_row += display->row_bytes/(sizeof (png_uint_16)); + input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16)); } /* while y */ } @@ -1746,7 +1759,7 @@ png_write_image_8bit(png_voidp argument) */ png_bytep row_end = output_row + image->width * channels; - while (y-- > 0) + for (; y > 0; --y) { png_const_uint_16p in_ptr = input_row; png_bytep out_ptr = output_row; @@ -1760,7 +1773,7 @@ png_write_image_8bit(png_voidp argument) } png_write_row(png_ptr, output_row); - input_row += display->row_bytes/(sizeof (png_uint_16)); + input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16)); } } @@ -1777,7 +1790,7 @@ png_image_set_PLTE(png_image_write_control *display) /* NOTE: the caller must check for cmap != NULL and entries != 0 */ const png_uint_32 format = image->format; - const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); + const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format); # if defined(PNG_FORMAT_BGR_SUPPORTED) &&\ defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED) @@ -1809,7 +1822,7 @@ png_image_set_PLTE(png_image_write_control *display) { png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap); - entry += i * channels; + entry += (unsigned int)i * channels; if ((channels & 1) != 0) /* no alpha */ { @@ -1865,7 +1878,7 @@ png_image_set_PLTE(png_image_write_control *display) { png_const_bytep entry = png_voidcast(png_const_bytep, cmap); - entry += i * channels; + entry += (unsigned int)i * channels; switch (channels) { @@ -1873,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[afirst ? 0 : 3]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: palette[i].blue = entry[afirst + (2 ^ bgr)]; palette[i].green = entry[afirst + 1]; @@ -1884,7 +1897,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[1 ^ afirst]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: palette[i].blue = palette[i].red = palette[i].green = entry[afirst]; @@ -1910,7 +1923,7 @@ png_image_set_PLTE(png_image_write_control *display) png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS, num_trans, NULL); - image->colormap_entries = entries; + image->colormap_entries = (png_uint_32)entries; } static int @@ -1940,7 +1953,7 @@ png_image_write_main(png_voidp argument) { const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format); - if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */ + if (image->width <= 0x7fffffffU/channels) /* no overflow */ { png_uint_32 check; const png_uint_32 png_row_stride = image->width * channels; @@ -1949,10 +1962,10 @@ png_image_write_main(png_voidp argument) display->row_stride = (png_int_32)/*SAFE*/png_row_stride; if (display->row_stride < 0) - check = -display->row_stride; + check = (png_uint_32)(-display->row_stride); else - check = display->row_stride; + check = (png_uint_32)display->row_stride; if (check >= png_row_stride) { @@ -1960,7 +1973,7 @@ png_image_write_main(png_voidp argument) * limits the whole image size to 32 bits for API compatibility with * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro. */ - if (image->height > 0xFFFFFFFF/png_row_stride) + if (image->height > 0xffffffffU/png_row_stride) png_error(image->opaque->png_ptr, "memory image too large"); } @@ -2136,7 +2149,7 @@ png_image_write_main(png_voidp argument) ptrdiff_t row_bytes = display->row_bytes; png_uint_32 y = image->height; - while (y-- > 0) + for (; y > 0; --y) { png_write_row(png_ptr, row); row += row_bytes; diff --git a/Engine/lib/lpng/pngwtran.c b/Engine/lib/lpng/pngwtran.c index 423fb2d5b..377b43e5c 100644 --- a/Engine/lib/lpng/pngwtran.c +++ b/Engine/lib/lpng/pngwtran.c @@ -1,7 +1,7 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.6.24 [August 4, 2016] + * Last changed in libpng 1.6.26 [October 20, 2016] * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -177,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, if (row_info->color_type != PNG_COLOR_TYPE_PALETTE) { int shift_start[4], shift_dec[4]; - int channels = 0; + unsigned int channels = 0; if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0) { diff --git a/Engine/lib/lpng/pngwutil.c b/Engine/lib/lpng/pngwutil.c index 3f1ed0cc8..0d4fb1336 100644 --- a/Engine/lib/lpng/pngwutil.c +++ b/Engine/lib/lpng/pngwutil.c @@ -1,8 +1,8 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.32 [August 24, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -408,7 +408,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner, png_ptr->zstream.avail_out = 0; /* Now initialize if required, setting the new parameters, otherwise just - * to a simple reset to the previous parameters. + * do a simple reset to the previous parameters. */ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0) ret = deflateReset(&png_ptr->zstream); @@ -675,6 +675,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, int interlace_type) { png_byte buf[13]; /* Buffer to store the IHDR info */ + int is_invalid_depth; png_debug(1, "in png_write_IHDR"); @@ -700,11 +701,11 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_RGB: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGB image"); png_ptr->channels = 3; @@ -726,18 +727,22 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_GRAY_ALPHA: - if (bit_depth != 8 && bit_depth != 16) + is_invalid_depth = (bit_depth != 8); +#ifdef PNG_WRITE_16BIT_SUPPORTED + is_invalid_depth = (is_invalid_depth && bit_depth != 16); +#endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); png_ptr->channels = 2; break; case PNG_COLOR_TYPE_RGB_ALPHA: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGBA image"); png_ptr->channels = 4; @@ -998,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size > 0) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->zstream.next_out = data; @@ -1044,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size > 0) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->zstream.avail_out = 0; png_ptr->zstream.next_out = NULL; png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT; @@ -1176,7 +1183,7 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette) png_byte new_name[80]; png_byte entrybuf[10]; png_size_t entry_size = (spalette->depth == 8 ? 6 : 10); - png_size_t palette_size = entry_size * spalette->nentries; + png_size_t palette_size = entry_size * (png_size_t)spalette->nentries; png_sPLT_entryp ep; #ifndef PNG_POINTER_INDEXING_SUPPORTED int i; @@ -1466,6 +1473,28 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type) } #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED +/* Write the Exif data */ +void /* PRIVATE */ +png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif) +{ + int i; + png_byte buf[1]; + + png_debug(1, "in png_write_eXIf"); + + png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif)); + + for (i = 0; i < num_exif; i++) + { + buf[0] = exif[i]; + png_write_chunk_data(png_ptr, buf, (png_size_t)1); + } + + png_write_chunk_end(png_ptr); +} +#endif + #ifdef PNG_WRITE_hIST_SUPPORTED /* Write the histogram */ void /* PRIVATE */ @@ -1743,7 +1772,7 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0, total_len = purpose_len + units_len + 10; params_len = (png_size_tp)png_malloc(png_ptr, - (png_alloc_size_t)(nparams * (sizeof (png_size_t)))); + (png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (png_size_t)))); /* Find the length of each parameter, making sure we don't count the * null terminator for the last parameter. @@ -2255,7 +2284,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, png_bytep rp, dp, lp; png_size_t i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB; @@ -2264,7 +2293,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, { v = *dp = *rp; #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2275,7 +2304,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp, { v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2316,7 +2345,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes, png_bytep rp, dp, pp; png_size_t i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_UP; @@ -2326,7 +2355,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes, { v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2360,7 +2389,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, png_bytep rp, dp, pp, lp; png_uint_32 i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG; @@ -2370,7 +2399,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2382,7 +2411,7 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp, & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2422,7 +2451,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, png_bytep rp, dp, pp, cp, lp; png_size_t i; png_size_t sum = 0; - int v; + unsigned int v; png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH; @@ -2432,7 +2461,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2465,7 +2494,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp, v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff); #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif @@ -2588,14 +2617,14 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info) png_bytep rp; png_size_t sum = 0; png_size_t i; - int v; + unsigned int v; { for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++) { v = *rp; #ifdef PNG_USE_ABS - sum += 128 - abs(v - 128); + sum += 128 - abs((int)v - 128); #else sum += (v < 128) ? v : 256 - v; #endif From d6ccaa7fe8cf6d9bd43d4573429c87d53a6c302b Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 17 Oct 2017 21:00:42 -0500 Subject: [PATCH 045/312] Corrected documentation. --- Engine/source/scene/sceneObject.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index f2f7963a0..6605f5407 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -1518,8 +1518,9 @@ DefineEngineMethod( SceneObject, isGlobalBounds, bool, (),, } DefineConsoleMethod(SceneObject, setForwardVector, void, (VectorF newForward, VectorF upVector), (VectorF(0, 0, 0), VectorF(0, 0, 1)), - "Get the number of static fields on the object.\n" - "@return The number of static fields defined on the object.") + "Sets the forward vector of a scene object, making it face Y+ along the new vector.\n" + "@param The new forward vector to set.\n" + "@param (Optional) The up vector to use to help orient the rotation.") { object->setForwardVector(newForward, upVector); } \ No newline at end of file From 0fde97f2543a27d4839ce569eb93ef05fc340cbf Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 17 Oct 2017 21:50:53 -0500 Subject: [PATCH 046/312] Corrects the documentation. --- Engine/source/math/mRotation.cpp | 74 ++++++++++++++------------------ 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index 8fe8228ae..6d9bc3b35 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -325,7 +325,7 @@ TEST(Maths, RotationF_Calculations) }; #endif -DefineConsoleStaticMethod(rotation, Add, RotationF, (RotationF a, RotationF b), , +DefineConsoleFunction(AddRotation, RotationF, (RotationF a, RotationF b), , "Adds two rotations together.\n" "@param a Rotation one." "@param b Rotation two." @@ -335,7 +335,7 @@ DefineConsoleStaticMethod(rotation, Add, RotationF, (RotationF a, RotationF b), return a + b; } -DefineConsoleStaticMethod(rotation, Subtract, RotationF, (RotationF a, RotationF b), , +DefineConsoleFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , "Subtracts two rotations.\n" "@param a Rotation one." "@param b Rotation two." @@ -345,7 +345,7 @@ DefineConsoleStaticMethod(rotation, Subtract, RotationF, (RotationF a, RotationF return a - b; } -DefineConsoleStaticMethod(rotation, Interpolate, RotationF, (RotationF a, RotationF b, F32 factor), , +DefineConsoleFunction(InterpolateRotation, RotationF, (RotationF a, RotationF b, F32 factor), , "Interpolates between two rotations.\n" "@param a Rotation one." "@param b Rotation two." @@ -358,7 +358,7 @@ DefineConsoleStaticMethod(rotation, Interpolate, RotationF, (RotationF a, Rotati return result; } -DefineConsoleStaticMethod(rotation, LookAt, RotationF, (Point3F origin, Point3F target, Point3F up), +DefineConsoleFunction(RotationLookAt, RotationF, (Point3F origin, Point3F target, Point3F up), (Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)), "Provides a rotation orientation to look at a target from a given position.\n" "@param origin Position of the object doing the looking." @@ -372,63 +372,55 @@ DefineConsoleStaticMethod(rotation, LookAt, RotationF, (Point3F origin, Point3F return result; } -DefineConsoleStaticMethod(rotation, setRightVector, RotationF, (RotationF a, VectorF rightVec), , - "Subtracts two rotations.\n" - "@param a Rotation one." - "@param b Rotation two." - "@returns v difference of both rotations." +DefineConsoleFunction(setRotationRightVector, RotationF, (RotationF rot, VectorF rightVec), , + "Sets the right vector of the rotation.\n" + "@param Starting rotation." + "@param New up vector." + "@returns New rotation with the set right vector." "@ingroup Math") { - a.asMatrixF().setColumn(0, rightVec); - return a; + rot.asMatrixF().setColumn(0, rightVec); + return rot; } -DefineConsoleStaticMethod(rotation, setUpVector, RotationF, (RotationF a, VectorF upVec), , - "Subtracts two rotations.\n" - "@param a Rotation one." - "@param b Rotation two." - "@returns v difference of both rotations." +DefineConsoleFunction(setRotationUpVector, RotationF, (RotationF rot, VectorF upVec), , + "Sets the up vector of the rotation.\n" + "@param Starting rotation." + "@param New up vector." + "@returns New rotation with the set up vector." "@ingroup Math") { - a.asMatrixF().setColumn(2, upVec); - return a; + rot.asMatrixF().setColumn(2, upVec); + return rot; } -DefineConsoleStaticMethod(rotation, getForwardVector, VectorF, (RotationF a), , - "Subtracts two rotations.\n" - "@param a Rotation one." - "@param b Rotation two." - "@returns v difference of both rotations." +DefineConsoleFunction(getRotationForwardVector, VectorF, (RotationF rot), , + "Get the forward vector of a rotation.\n" "@ingroup Math") { - return a.asMatrixF().getForwardVector(); + return rot.asMatrixF().getForwardVector(); } -DefineConsoleStaticMethod(rotation, getRightVector, VectorF, (RotationF a), , - "Subtracts two rotations.\n" - "@param a Rotation one." - "@param b Rotation two." - "@returns v difference of both rotations." +DefineConsoleFunction(getRotationRightVector, VectorF, (RotationF rot), , + "Gets the right vector of a rotation.\n" + "@param Our rotation." "@ingroup Math") { - return a.asMatrixF().getRightVector(); + return rot.asMatrixF().getRightVector(); } -DefineConsoleStaticMethod(rotation, getUpVector, VectorF, (RotationF a), , - "Subtracts two rotations.\n" - "@param a Rotation one." - "@param b Rotation two." - "@returns v difference of both rotations." +DefineConsoleFunction(getRotationUpVector, VectorF, (RotationF rot), , + "Gets the up vector of a rotation.\n" + "@param Our rotation." "@ingroup Math") { - return a.asMatrixF().getUpVector(); + return rot.asMatrixF().getUpVector(); } -DefineConsoleStaticMethod(rotation, getDirection, Point3F, (RotationF rot),, -"Takes the angles of the provided rotation and returns a direction vector.\n" -"@param rot Our rotation." -"@returns v Direction vector result." -"@ingroup Math") +DefineConsoleFunction(getRotationDirection, Point3F, (RotationF rot),, + "Gets the direction from the rotation's angles.\n" + "@param Our rotation." + "@ingroup Math") { return rot.getDirection(); } From 9359b72b93d6f37a8696fdc36da2be6739cd2d17 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 18 Oct 2017 00:26:57 -0500 Subject: [PATCH 047/312] Removes EXTENDED_MOVE block because that's mostly for VR and we'll be implementing a separate VR controller. --- .../physics/playerControllerComponent.cpp | 87 ------------------- .../T3D/components/render/meshComponent.cpp | 1 - 2 files changed, 88 deletions(-) diff --git a/Engine/source/T3D/components/physics/playerControllerComponent.cpp b/Engine/source/T3D/components/physics/playerControllerComponent.cpp index 60945f68e..2c6cea6e9 100644 --- a/Engine/source/T3D/components/physics/playerControllerComponent.cpp +++ b/Engine/source/T3D/components/physics/playerControllerComponent.cpp @@ -330,93 +330,6 @@ void PlayerControllerComponent::updateMove() bool doStandardMove = true; GameConnection* con = mOwner->getControllingClient(); -#ifdef TORQUE_EXTENDED_MOVE - // Work with an absolute rotation from the ExtendedMove class? - if (con && con->getControlSchemeAbsoluteRotation()) - { - doStandardMove = false; - const ExtendedMove* emove = dynamic_cast(move); - U32 emoveIndex = smExtendedMoveHeadPosRotIndex; - if (emoveIndex >= ExtendedMove::MaxPositionsRotations) - emoveIndex = 0; - - if (emove->EulerBasedRotation[emoveIndex]) - { - // Head pitch - mHead.x += (emove->rotX[emoveIndex] - mLastAbsolutePitch); - - // Do we also include the relative yaw value? - if (con->getControlSchemeAddPitchToAbsRot()) - { - F32 x = move->pitch; - if (x > M_PI_F) - x -= M_2PI_F; - - mHead.x += x; - } - - // Constrain the range of mHead.x - while (mHead.x < -M_PI_F) - mHead.x += M_2PI_F; - while (mHead.x > M_PI_F) - mHead.x -= M_2PI_F; - - // Rotate (heading) head or body? - if (move->freeLook && ((isMounted() && getMountNode() == 0) || (con && !con->isFirstPerson()))) - { - // Rotate head - mHead.z += (emove->rotZ[emoveIndex] - mLastAbsoluteYaw); - - // Do we also include the relative yaw value? - if (con->getControlSchemeAddYawToAbsRot()) - { - F32 z = move->yaw; - if (z > M_PI_F) - z -= M_2PI_F; - - mHead.z += z; - } - - // Constrain the range of mHead.z - while (mHead.z < 0.0f) - mHead.z += M_2PI_F; - while (mHead.z > M_2PI_F) - mHead.z -= M_2PI_F; - } - else - { - // Rotate body - mRot.z += (emove->rotZ[emoveIndex] - mLastAbsoluteYaw); - - // Do we also include the relative yaw value? - if (con->getControlSchemeAddYawToAbsRot()) - { - F32 z = move->yaw; - if (z > M_PI_F) - z -= M_2PI_F; - - mRot.z += z; - } - - // Constrain the range of mRot.z - while (mRot.z < 0.0f) - mRot.z += M_2PI_F; - while (mRot.z > M_2PI_F) - mRot.z -= M_2PI_F; - } - mLastAbsoluteYaw = emove->rotZ[emoveIndex]; - mLastAbsolutePitch = emove->rotX[emoveIndex]; - - // Head bank - mHead.y = emove->rotY[emoveIndex]; - - // Constrain the range of mHead.y - while (mHead.y > M_PI_F) - mHead.y -= M_2PI_F; - } - } -#endif - MatrixF zRot; zRot.set(EulerF(0.0f, 0.0f, mOwner->getRotation().asEulerF().z)); diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index 708a48ae1..c9eeee3c3 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -34,7 +34,6 @@ #include "lighting/lightQuery.h" #include "scene/sceneManager.h" #include "gfx/bitmap/ddsFile.h" -#include "gfx/bitmap/ddsUtils.h" #include "gfx/gfxTextureManager.h" #include "materials/materialFeatureTypes.h" #include "renderInstance/renderImposterMgr.h" From 526d4ea31a3bde413ca43acfa2576ab07a4fae69 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 18 Oct 2017 00:35:37 -0500 Subject: [PATCH 048/312] Remove unneeded isParent handling for entities in the GuiTreeViewCtrl --- Engine/source/gui/controls/guiTreeViewCtrl.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 9835c9858..ca499a758 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -645,18 +645,6 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf) bool GuiTreeViewCtrl::Item::isParent() const { - //We might have a special case with entities - //So if our entity either has children, or has some component with the EditorInspect interface, we return true - if (mInspectorInfo.mObject) - { - Entity* e = dynamic_cast(mInspectorInfo.mObject.getObject()); - if (e) - { - if (e->size() > 0 || e->getComponentCount() != 0) - return true; - } - } - if(mState.test(VirtualParent)) { if( !isInspectorData() ) From 4310ab3b27ec49be478eb0768721f9ed146f6bb2 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Wed, 18 Oct 2017 03:25:05 -0400 Subject: [PATCH 049/312] Sets scale for collision primitives created in the shape editor. --- Engine/source/ts/tsCollision.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 1d04b409e..6fe935bbe 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1044,6 +1044,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // We need the default mesh transform. MatrixF localXfm; getNodeWorldTransform( object.nodeIndex, &localXfm ); + Point3F t = localXfm.getPosition(); + t.convolve(scale); + localXfm.setPosition(t); // We have some sort of collision shape... so allocate it. if ( !colShape ) @@ -1053,12 +1056,14 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & if ( dStrStartsWith( meshName, "Colbox" ) ) { // The bounds define the box extents directly. - Point3F halfWidth = mesh->getBounds().getExtents() * 0.5f; + Point3F halfWidth = mesh->getBounds().getExtents() * scale * 0.5f; // Add the offset to the center of the bounds // into the local space transform. MatrixF centerXfm( true ); - centerXfm.setPosition( mesh->getBounds().getCenter() ); + Point3F t = mesh->getBounds().getCenter(); + t.convolve(scale); + centerXfm.setPosition(t); localXfm.mul( centerXfm ); colShape->addBox( halfWidth, localXfm ); @@ -1066,12 +1071,15 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & else if ( dStrStartsWith( meshName, "Colsphere" ) ) { // Get a sphere inscribed to the bounds. - F32 radius = mesh->getBounds().len_min() * 0.5f; + Point3F extents = mesh->getBounds().getExtents() * scale; + F32 radius = extents.least() * 0.5f; - // Add the offset to the center of the bounds + // Add the offset to the center of the bounds // into the local space transform. MatrixF primXfm( true ); - primXfm.setPosition( mesh->getBounds().getCenter() ); + Point3F t = mesh->getBounds().getCenter(); + t.convolve(scale); + primXfm.setPosition(t); localXfm.mul( primXfm ); colShape->addSphere( radius, localXfm ); @@ -1079,12 +1087,14 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & else if ( dStrStartsWith( meshName, "Colcapsule" ) ) { // Use the smallest extent as the radius for the capsule. - Point3F extents = mesh->getBounds().getExtents(); + Point3F extents = mesh->getBounds().getExtents() * scale; F32 radius = extents.least() * 0.5f; // We need to center the capsule and align it to the Y axis. MatrixF primXfm( true ); - primXfm.setPosition( mesh->getBounds().getCenter() ); + Point3F t = mesh->getBounds().getCenter(); + t.convolve(scale); + primXfm.setPosition(t); // Use the longest axis as the capsule height. F32 height = -radius * 2.0f; @@ -1139,10 +1149,6 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & VertexPolyList polyList; MatrixF meshMat( localXfm ); - Point3F t = meshMat.getPosition(); - t.convolve( scale ); - meshMat.setPosition( t ); - polyList.setTransform( &MatrixF::Identity, scale ); mesh->buildPolyList( 0, &polyList, surfaceKey, NULL ); colShape->addConvex( polyList.getVertexList().address(), From b8959e2bbbb1a8d6693231f673c49d1b2b086e78 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Mon, 23 Oct 2017 17:00:16 -0400 Subject: [PATCH 050/312] Fixed a typo where the value of outBytesWritten was being clamped incorrectly. --- Engine/source/platform/platformNet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 061b22942..a77d29474 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -1672,7 +1672,7 @@ Net::Error Net::send(NetSocket handleFd, const U8 *buffer, S32 bufferSize, S32 * if (outBytesWritten) { - *outBytesWritten = outBytesWritten < 0 ? 0 : bytesWritten; + *outBytesWritten = *outBytesWritten < 0 ? 0 : bytesWritten; } return PlatformNetState::getLastError(); From 9e435a3f34d5e9d5a34d86a189fa92d3fcc379cb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 24 Oct 2017 19:15:54 -0500 Subject: [PATCH 051/312] allows arbitrary material name string replacement, rather than forcing folks to start with base. ie: an entry of skin = "blue; area=fire"; would replace base_area_grid with blue_fire_grid as the used material --- Engine/source/ts/tsShapeInstance.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index 98d6b39ea..7010371bc 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -307,12 +307,9 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName ) { // Try changing base const String &pName = materialNames[i]; - if ( pName.compare( oldBaseName, oldBaseNameLength, String::NoCase ) == 0 ) - { - String newName( pName ); - newName.replace( 0, oldBaseNameLength, newBaseName ); - pMatList->renameMaterial( i, newName ); - } + String newName( pName ); + newName.replace( oldBaseName, newBaseName ); + pMatList->renameMaterial( i, newName ); } // Initialize the material instances From a36192ffd8f9489c8541e67f109facb83b0302d3 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 26 Oct 2017 20:11:35 -0500 Subject: [PATCH 052/312] Makes it properly force an update of the filter via a dirty flag. --- Engine/source/gui/controls/guiConsole.cpp | 6 +++++- Engine/source/gui/controls/guiConsole.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Engine/source/gui/controls/guiConsole.cpp b/Engine/source/gui/controls/guiConsole.cpp index 19cdf6b3d..b8987e8df 100644 --- a/Engine/source/gui/controls/guiConsole.cpp +++ b/Engine/source/gui/controls/guiConsole.cpp @@ -68,6 +68,7 @@ GuiConsole::GuiConsole() mDisplayErrors = true; mDisplayWarnings = true; mDisplayNormalMessages = true; + mFiltersDirty = true; } //----------------------------------------------------------------------------- @@ -108,7 +109,7 @@ void GuiConsole::refreshLogText() Con::getLockLog(log, size); - if (mFilteredLog.size() != size) + if (mFilteredLog.size() != size || mFiltersDirty) { mFilteredLog.clear(); @@ -221,6 +222,7 @@ void GuiConsole::setDisplayFilters(bool errors, bool warns, bool normal) mDisplayErrors = errors; mDisplayWarnings = warns; mDisplayNormalMessages = normal; + mFiltersDirty = true; refreshLogText(); @@ -235,6 +237,8 @@ void GuiConsole::setDisplayFilters(bool errors, bool warns, bool normal) setExtent(Point2I(mCellSize.x, mCellSize.y * mFilteredLog.size())); scrollCellVisible(Point2I(0, mSize.y - 1)); + + mFiltersDirty = false; } DefineEngineMethod(GuiConsole, setDisplayFilters, void, (bool errors, bool warns, bool normal), (true, true, true), diff --git a/Engine/source/gui/controls/guiConsole.h b/Engine/source/gui/controls/guiConsole.h index 217fe8d6a..8b9450e09 100644 --- a/Engine/source/gui/controls/guiConsole.h +++ b/Engine/source/gui/controls/guiConsole.h @@ -42,6 +42,7 @@ class GuiConsole : public GuiArrayCtrl bool mDisplayErrors; bool mDisplayWarnings; bool mDisplayNormalMessages; + bool mFiltersDirty; S32 getMaxWidth(S32 startIndex, S32 endIndex); From ce9c28dc5d6655e4eac74ce30d29b1a4608a8ef2 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 30 Oct 2017 13:53:12 -0500 Subject: [PATCH 053/312] Corrects an include's case sensitivity being wrong, causing issues on linux. --- Engine/source/afx/util/afxParticlePool_T3D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/afx/util/afxParticlePool_T3D.cpp b/Engine/source/afx/util/afxParticlePool_T3D.cpp index 6689326cd..d6c4847f9 100644 --- a/Engine/source/afx/util/afxParticlePool_T3D.cpp +++ b/Engine/source/afx/util/afxParticlePool_T3D.cpp @@ -28,7 +28,7 @@ #include "scene/sceneRenderState.h" #include "T3D/fx/particleEmitter.h" #include "renderInstance/renderPassManager.h" -#include "lighting/lightinfo.h" +#include "lighting/lightInfo.h" #include "lighting/lightManager.h" #include "afx/util/afxParticlePool.h" From d666322a1b2589afc57e891fda1e5b2f2763aaf5 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 5 Nov 2017 22:33:32 -0600 Subject: [PATCH 054/312] Merging --- Engine/source/app/mainLoop.cpp | 4 + Engine/source/console/CMDgram.y | 6 +- Engine/source/console/CMDscan.cpp | 2473 ++++++------ Engine/source/console/ast.h | 156 +- Engine/source/console/astAlloc.cpp | 182 +- Engine/source/console/astNodes.cpp | 1407 ++++--- Engine/source/console/cmdgram.cpp | 3618 +++++++++--------- Engine/source/console/cmdgram.h | 144 +- Engine/source/console/codeBlock.cpp | 686 ++-- Engine/source/console/codeBlock.h | 13 +- Engine/source/console/codeInterpreter.cpp | 2979 ++++++++++++++ Engine/source/console/codeInterpreter.h | 262 ++ Engine/source/console/compiledEval.cpp | 2148 +---------- Engine/source/console/compiler.cpp | 133 +- Engine/source/console/compiler.h | 102 +- Engine/source/console/console.h | 272 +- Engine/source/console/consoleInternal.cpp | 1120 +++--- Engine/source/console/consoleInternal.h | 461 ++- Engine/source/console/simDictionary.cpp | 130 +- Engine/source/console/simFieldDictionary.cpp | 330 +- Engine/source/console/simFieldDictionary.h | 21 +- Engine/source/console/simObject.cpp | 10 +- Engine/source/persistence/taml/taml.cpp | 23 +- 23 files changed, 9203 insertions(+), 7477 deletions(-) create mode 100644 Engine/source/console/codeInterpreter.cpp create mode 100644 Engine/source/console/codeInterpreter.h diff --git a/Engine/source/app/mainLoop.cpp b/Engine/source/app/mainLoop.cpp index c77c33552..5fc4aa8c0 100644 --- a/Engine/source/app/mainLoop.cpp +++ b/Engine/source/app/mainLoop.cpp @@ -45,6 +45,7 @@ #include "console/debugOutputConsumer.h" #include "console/consoleTypes.h" #include "console/engineAPI.h" +#include "console/codeInterpreter.h" #include "gfx/bitmap/gBitmap.h" #include "gfx/gFont.h" @@ -227,6 +228,9 @@ void StandardMainLoop::init() ManagedSingleton< ThreadManager >::createSingleton(); FrameAllocator::init(TORQUE_FRAME_SIZE); // See comments in torqueConfig.h + // Initialize the TorqueScript interpreter. + CodeInterpreter::init(); + // Yell if we can't initialize the network. if(!Net::init()) { diff --git a/Engine/source/console/CMDgram.y b/Engine/source/console/CMDgram.y index 5ebd9492b..6cfbf3311 100644 --- a/Engine/source/console/CMDgram.y +++ b/Engine/source/console/CMDgram.y @@ -496,9 +496,9 @@ class_name_expr assign_op_struct : opPLUSPLUS - { $$.lineNumber = $1.lineNumber; $$.token = '+'; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } + { $$.lineNumber = $1.lineNumber; $$.token = opPLUSPLUS; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } | opMINUSMINUS - { $$.lineNumber = $1.lineNumber; $$.token = '-'; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } + { $$.lineNumber = $1.lineNumber; $$.token = opMINUSMINUS; $$.expr = FloatNode::alloc( $1.lineNumber, 1 ); } | opPLASN expr { $$.lineNumber = $1.lineNumber; $$.token = '+'; $$.expr = $2; } | opMIASN expr @@ -551,6 +551,8 @@ funcall_expr { $$ = FuncCallExprNode::alloc( $1.lineNumber, $3.value, $1.value, $5, false); } | expr '.' IDENT '(' expr_list_decl ')' { $1->append($5); $$ = FuncCallExprNode::alloc( $1->dbgLineNumber, $3.value, NULL, $1, true); } + | expr '(' expr_list_decl ')' + { $$ = FuncPointerCallExprNode::alloc( $1->dbgLineNumber, $1, $3); } ; assert_expr diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 4a1c132b9..733460b09 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -20,8 +20,8 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $ - */ +* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47 vern Exp $ +*/ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 @@ -49,19 +49,19 @@ /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use +#pragma warn -rch +#pragma warn -use #include #include #define YY_USE_CONST @@ -85,22 +85,22 @@ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ +* integer for use as an array index. If the signed char is negative, +* we want to instead treat it as an 8-bit unsigned char, hence the +* double cast. +*/ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ +* but we do it the disgusting crufty way forced on us by the ()-less +* definition of BEGIN. +*/ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ +* to BEGIN to return to the state. The YYSTATE alias is for lex +* compatibility. +*/ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START @@ -125,419 +125,419 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ +* int a single C statement (which needs a semi-colon terminator). This +* avoids problems with code like: +* +* if ( condition_holds ) +* yyless( 5 ); +* else +* do_something_else(); +* +* Prior to using the do-while the compiler would get upset at the +* "else" because it interpreted the "if" statement as being all +* done when it reached the ';' after the yyless() call. +*/ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ +* (without autoconf's help, which isn't available because we want +* flex-generated scanners to compile on their own). +*/ typedef unsigned int yy_size_t; struct yy_buffer_state - { +{ FILE *yy_input_file; - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ + * characters. + */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ + * and can realloc() it to grow it, and should free() it to + * delete it. + */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ + * If so, '^' rules will be active on the next match, otherwise + * not. + */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the - * end of it. - */ + * end of it. + */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; +}; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ +* future we want to put the buffer states in a more general +* "scanner state". +*/ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static char *yy_c_buf_p = (char *)0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ + /* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void yyrestart YY_PROTO((FILE *input_file)); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_switch_to_buffer YY_PROTO((YY_BUFFER_STATE new_buffer)); +void yy_load_buffer_state YY_PROTO((void)); +YY_BUFFER_STATE yy_create_buffer YY_PROTO((FILE *file, int size)); +void yy_delete_buffer YY_PROTO((YY_BUFFER_STATE b)); +void yy_init_buffer YY_PROTO((YY_BUFFER_STATE b, FILE *file)); +void yy_flush_buffer YY_PROTO((YY_BUFFER_STATE b)); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +YY_BUFFER_STATE yy_scan_buffer YY_PROTO((char *base, yy_size_t size)); +YY_BUFFER_STATE yy_scan_string YY_PROTO((yyconst char *str)); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO((yyconst char *bytes, int len)); -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +static void *yy_flex_alloc YY_PROTO((yy_size_t)); +static void *yy_flex_realloc YY_PROTO((void *, yy_size_t)); +static void yy_flex_free YY_PROTO((void *)); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +FILE *yyin = (FILE *)0, *yyout = (FILE *)0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +static yy_state_type yy_get_previous_state YY_PROTO((void)); +static yy_state_type yy_try_NUL_trans YY_PROTO((yy_state_type current_state)); +static int yy_get_next_buffer YY_PROTO((void)); +static void yy_fatal_error YY_PROTO((yyconst char msg[])); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ +* corresponding action - sets up yytext. +*/ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define YY_NUM_RULES 94 #define YY_END_OF_BUFFER 95 static yyconst short int yy_accept[224] = - { 0, - 0, 0, 95, 93, 1, 5, 4, 51, 93, 93, - 58, 57, 93, 41, 42, 45, 43, 56, 44, 50, - 46, 90, 90, 52, 53, 47, 61, 48, 38, 36, - 88, 88, 88, 88, 39, 40, 59, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, - 88, 54, 49, 55, 60, 1, 0, 9, 0, 6, - 0, 0, 17, 87, 25, 12, 26, 0, 7, 0, - 23, 16, 21, 15, 22, 31, 91, 37, 3, 24, - 0, 90, 0, 0, 14, 19, 11, 8, 10, 20, - 88, 33, 88, 88, 27, 88, 88, 88, 88, 88, +{ 0, +0, 0, 95, 93, 1, 5, 4, 51, 93, 93, +58, 57, 93, 41, 42, 45, 43, 56, 44, 50, +46, 90, 90, 52, 53, 47, 61, 48, 38, 36, +88, 88, 88, 88, 39, 40, 59, 88, 88, 88, +88, 88, 88, 88, 88, 88, 88, 88, 88, 88, +88, 54, 49, 55, 60, 1, 0, 9, 0, 6, +0, 0, 17, 87, 25, 12, 26, 0, 7, 0, +23, 16, 21, 15, 22, 31, 91, 37, 3, 24, +0, 90, 0, 0, 14, 19, 11, 8, 10, 20, +88, 33, 88, 88, 27, 88, 88, 88, 88, 88, - 88, 69, 88, 88, 88, 88, 70, 62, 88, 88, - 63, 88, 88, 88, 88, 88, 88, 28, 13, 18, - 92, 87, 0, 32, 3, 3, 91, 0, 91, 89, - 29, 30, 35, 34, 88, 88, 88, 88, 88, 88, - 88, 88, 73, 88, 88, 76, 88, 88, 88, 88, - 88, 88, 92, 0, 3, 2, 88, 88, 79, 88, - 88, 88, 66, 88, 88, 88, 88, 88, 88, 88, - 88, 85, 88, 3, 0, 88, 64, 88, 88, 88, - 86, 88, 88, 88, 88, 88, 88, 88, 68, 0, - 67, 88, 88, 88, 88, 88, 88, 88, 65, 88, +88, 69, 88, 88, 88, 88, 70, 62, 88, 88, +63, 88, 88, 88, 88, 88, 88, 28, 13, 18, +92, 87, 0, 32, 3, 3, 91, 0, 91, 89, +29, 30, 35, 34, 88, 88, 88, 88, 88, 88, +88, 88, 73, 88, 88, 76, 88, 88, 88, 88, +88, 88, 92, 0, 3, 2, 88, 88, 79, 88, +88, 88, 66, 88, 88, 88, 88, 88, 88, 88, +88, 85, 88, 3, 0, 88, 64, 88, 88, 88, +86, 88, 88, 88, 88, 88, 88, 88, 68, 0, +67, 88, 88, 88, 88, 88, 88, 88, 65, 88, - 81, 0, 88, 88, 82, 72, 88, 88, 83, 88, - 80, 0, 74, 88, 71, 75, 88, 88, 0, 78, - 84, 77, 0 - } ; +81, 0, 88, 88, 82, 72, 88, 88, 83, 88, +80, 0, 74, 88, 71, 75, 88, 88, 0, 78, +84, 77, 0 +}; static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 2, 2, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 5, 6, 1, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 31, - 33, 33, 33, 33, 33, 34, 33, 35, 33, 36, - 33, 33, 37, 38, 33, 33, 33, 39, 33, 33, - 40, 41, 42, 43, 33, 1, 44, 45, 46, 47, +{ 0, +1, 1, 1, 1, 1, 1, 1, 1, 2, 3, +2, 2, 4, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 2, 5, 6, 1, 7, 8, 9, 10, 11, +12, 13, 14, 15, 16, 17, 18, 19, 20, 20, +20, 20, 20, 20, 20, 20, 20, 21, 22, 23, +24, 25, 26, 27, 28, 29, 30, 31, 32, 31, +33, 33, 33, 33, 33, 34, 33, 35, 33, 36, +33, 33, 37, 38, 33, 33, 33, 39, 33, 33, +40, 41, 42, 43, 33, 1, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 33, 53, 54, 55, 56, - 57, 58, 33, 59, 60, 61, 62, 33, 63, 39, - 33, 33, 64, 65, 66, 67, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +48, 49, 50, 51, 52, 33, 53, 54, 55, 56, +57, 58, 33, 59, 60, 61, 62, 33, 63, 39, +33, 33, 64, 65, 66, 67, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1 +}; static yyconst int yy_meta[68] = - { 0, - 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 4, 4, - 5, 1, 1, 6, 1, 1, 1, 4, 4, 4, - 4, 4, 7, 7, 7, 7, 7, 7, 7, 1, - 1, 1, 1, 4, 4, 4, 4, 4, 4, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 1, 1, 1, 1 - } ; +{ 0, +1, 1, 2, 2, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 3, 4, 4, +5, 1, 1, 6, 1, 1, 1, 4, 4, 4, +4, 4, 7, 7, 7, 7, 7, 7, 7, 1, +1, 1, 1, 4, 4, 4, 4, 4, 4, 7, +7, 7, 7, 7, 7, 7, 7, 7, 7, 7, +7, 7, 7, 1, 1, 1, 1 +}; static yyconst short int yy_base[237] = - { 0, - 0, 0, 337, 338, 334, 338, 338, 61, 63, 51, - 53, 65, 66, 338, 338, 311, 64, 338, 66, 60, - 68, 76, 80, 313, 338, 60, 309, 77, 338, 338, - 0, 298, 295, 302, 338, 338, 305, 268, 268, 54, - 61, 272, 59, 38, 62, 266, 280, 275, 62, 263, - 270, 338, 89, 338, 338, 318, 295, 338, 111, 338, - 314, 100, 338, 296, 338, 338, 338, 112, 338, 312, - 338, 338, 338, 290, 338, 338, 107, 338, 296, 338, - 110, 114, 121, 0, 338, 289, 338, 338, 338, 288, - 0, 0, 281, 281, 338, 249, 260, 247, 250, 244, +{ 0, +0, 0, 337, 338, 334, 338, 338, 61, 63, 51, +53, 65, 66, 338, 338, 311, 64, 338, 66, 60, +68, 76, 80, 313, 338, 60, 309, 77, 338, 338, +0, 298, 295, 302, 338, 338, 305, 268, 268, 54, +61, 272, 59, 38, 62, 266, 280, 275, 62, 263, +270, 338, 89, 338, 338, 318, 295, 338, 111, 338, +314, 100, 338, 296, 338, 338, 338, 112, 338, 312, +338, 338, 338, 290, 338, 338, 107, 338, 296, 338, +110, 114, 121, 0, 338, 289, 338, 338, 338, 288, +0, 0, 281, 281, 338, 249, 260, 247, 250, 244, - 255, 0, 243, 248, 242, 244, 0, 0, 244, 235, - 0, 251, 235, 239, 242, 231, 240, 338, 338, 338, - 270, 269, 268, 338, 0, 139, 119, 125, 128, 0, - 338, 338, 0, 0, 240, 243, 238, 224, 240, 239, - 234, 221, 232, 233, 230, 0, 224, 214, 225, 213, - 225, 218, 250, 249, 146, 152, 210, 215, 0, 215, - 221, 203, 0, 216, 219, 201, 201, 216, 200, 204, - 211, 0, 208, 155, 237, 193, 0, 197, 198, 197, - 0, 204, 197, 190, 197, 190, 197, 193, 0, 225, - 0, 180, 184, 179, 177, 153, 158, 151, 0, 134, +255, 0, 243, 248, 242, 244, 0, 0, 244, 235, +0, 251, 235, 239, 242, 231, 240, 338, 338, 338, +270, 269, 268, 338, 0, 139, 119, 125, 128, 0, +338, 338, 0, 0, 240, 243, 238, 224, 240, 239, +234, 221, 232, 233, 230, 0, 224, 214, 225, 213, +225, 218, 250, 249, 146, 152, 210, 215, 0, 215, +221, 203, 0, 216, 219, 201, 201, 216, 200, 204, +211, 0, 208, 155, 237, 193, 0, 197, 198, 197, +0, 204, 197, 190, 197, 190, 197, 193, 0, 225, +0, 180, 184, 179, 177, 153, 158, 151, 0, 134, - 187, 157, 143, 144, 0, 176, 123, 126, 0, 112, - 338, 160, 0, 115, 338, 0, 88, 76, 162, 0, - 0, 0, 338, 170, 174, 181, 185, 189, 193, 200, - 119, 204, 211, 218, 225, 232 - } ; +187, 157, 143, 144, 0, 176, 123, 126, 0, 112, +338, 160, 0, 115, 338, 0, 88, 76, 162, 0, +0, 0, 338, 170, 174, 181, 185, 189, 193, 200, +119, 204, 211, 218, 225, 232 +}; static yyconst short int yy_def[237] = - { 0, - 223, 1, 223, 223, 223, 223, 223, 223, 224, 225, - 225, 223, 226, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 227, 227, 227, 227, 223, 223, 223, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 223, 223, 223, 223, 223, 223, 223, 224, 223, - 224, 228, 223, 229, 223, 223, 223, 226, 223, 226, - 223, 223, 223, 223, 223, 223, 223, 223, 230, 223, - 223, 223, 223, 231, 223, 223, 223, 223, 223, 223, - 227, 227, 227, 227, 223, 227, 227, 227, 227, 227, +{ 0, +223, 1, 223, 223, 223, 223, 223, 223, 224, 225, +225, 223, 226, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +227, 227, 227, 227, 223, 223, 223, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 223, 223, 223, 223, 223, 223, 223, 224, 223, +224, 228, 223, 229, 223, 223, 223, 226, 223, 226, +223, 223, 223, 223, 223, 223, 223, 223, 230, 223, +223, 223, 223, 231, 223, 223, 223, 223, 223, 223, +227, 227, 227, 227, 223, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 223, 223, 223, - 232, 229, 229, 223, 230, 233, 223, 223, 223, 231, - 223, 223, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 232, 232, 234, 223, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 227, 234, 223, 227, 227, 227, 227, 227, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 223, - 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 223, 223, 223, +232, 229, 229, 223, 230, 233, 223, 223, 223, 231, +223, 223, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 232, 232, 234, 223, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, +227, 227, 227, 234, 223, 227, 227, 227, 227, 227, +227, 227, 227, 227, 227, 227, 227, 227, 227, 223, +227, 227, 227, 227, 227, 227, 227, 227, 227, 227, - 227, 235, 227, 227, 227, 227, 227, 227, 227, 227, - 223, 236, 227, 227, 223, 227, 227, 227, 236, 227, - 227, 227, 0, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223 - } ; +227, 235, 227, 227, 227, 227, 227, 227, 227, 227, +223, 236, 227, 227, 223, 227, 227, 227, 236, 227, +227, 227, 0, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223 +}; static yyconst short int yy_nxt[406] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 31, 31, - 31, 31, 31, 31, 32, 31, 33, 34, 31, 35, - 4, 36, 37, 38, 39, 40, 41, 42, 43, 31, - 31, 44, 31, 31, 31, 45, 46, 47, 48, 49, - 50, 31, 51, 52, 53, 54, 55, 57, 60, 62, - 62, 62, 62, 66, 63, 69, 65, 72, 77, 77, - 78, 74, 86, 87, 58, 79, 107, 73, 67, 75, - 76, 80, 81, 108, 82, 82, 81, 98, 82, 82, +{ 0, +4, 5, 6, 7, 8, 9, 10, 11, 12, 13, +14, 15, 16, 17, 18, 19, 20, 21, 22, 23, +24, 25, 26, 27, 28, 29, 30, 31, 31, 31, +31, 31, 31, 31, 32, 31, 33, 34, 31, 35, +4, 36, 37, 38, 39, 40, 41, 42, 43, 31, +31, 44, 31, 31, 31, 45, 46, 47, 48, 49, +50, 31, 51, 52, 53, 54, 55, 57, 60, 62, +62, 62, 62, 66, 63, 69, 65, 72, 77, 77, +78, 74, 86, 87, 58, 79, 107, 73, 67, 75, +76, 80, 81, 108, 82, 82, 81, 98, 82, 82, - 89, 90, 104, 61, 100, 109, 70, 83, 101, 110, - 99, 83, 118, 114, 84, 105, 60, 102, 62, 62, - 106, 69, 130, 83, 115, 77, 77, 83, 127, 127, - 81, 222, 82, 82, 128, 221, 128, 127, 127, 129, - 129, 156, 156, 129, 129, 83, 129, 129, 156, 156, - 83, 61, 70, 119, 156, 156, 125, 156, 156, 156, - 156, 83, 156, 156, 156, 156, 83, 220, 218, 175, - 59, 217, 59, 59, 59, 59, 59, 64, 216, 64, - 64, 68, 215, 68, 68, 68, 68, 68, 91, 214, - 213, 91, 121, 211, 210, 121, 122, 122, 209, 122, +89, 90, 104, 61, 100, 109, 70, 83, 101, 110, +99, 83, 118, 114, 84, 105, 60, 102, 62, 62, +106, 69, 130, 83, 115, 77, 77, 83, 127, 127, +81, 222, 82, 82, 128, 221, 128, 127, 127, 129, +129, 156, 156, 129, 129, 83, 129, 129, 156, 156, +83, 61, 70, 119, 156, 156, 125, 156, 156, 156, +156, 83, 156, 156, 156, 156, 83, 220, 218, 175, +59, 217, 59, 59, 59, 59, 59, 64, 216, 64, +64, 68, 215, 68, 68, 68, 68, 68, 91, 214, +213, 91, 121, 211, 210, 121, 122, 122, 209, 122, - 125, 208, 125, 125, 125, 125, 125, 153, 153, 207, - 153, 155, 155, 155, 155, 155, 155, 155, 174, 174, - 174, 174, 174, 174, 174, 212, 212, 206, 212, 212, - 212, 212, 219, 219, 219, 219, 219, 219, 219, 205, - 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, - 194, 193, 192, 191, 190, 189, 188, 187, 186, 185, - 184, 183, 182, 181, 180, 179, 178, 177, 176, 154, - 154, 173, 172, 171, 170, 169, 168, 167, 166, 165, - 164, 163, 162, 161, 160, 159, 158, 157, 123, 123, - 154, 152, 151, 150, 149, 148, 147, 146, 145, 144, +125, 208, 125, 125, 125, 125, 125, 153, 153, 207, +153, 155, 155, 155, 155, 155, 155, 155, 174, 174, +174, 174, 174, 174, 174, 212, 212, 206, 212, 212, +212, 212, 219, 219, 219, 219, 219, 219, 219, 205, +204, 203, 202, 201, 200, 199, 198, 197, 196, 195, +194, 193, 192, 191, 190, 189, 188, 187, 186, 185, +184, 183, 182, 181, 180, 179, 178, 177, 176, 154, +154, 173, 172, 171, 170, 169, 168, 167, 166, 165, +164, 163, 162, 161, 160, 159, 158, 157, 123, 123, +154, 152, 151, 150, 149, 148, 147, 146, 145, 144, - 143, 142, 141, 140, 139, 138, 137, 136, 135, 134, - 133, 132, 131, 126, 124, 68, 123, 59, 120, 56, - 117, 116, 113, 112, 111, 103, 97, 96, 95, 94, - 93, 92, 88, 85, 71, 56, 223, 3, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +143, 142, 141, 140, 139, 138, 137, 136, 135, 134, +133, 132, 131, 126, 124, 68, 123, 59, 120, 56, +117, 116, 113, 112, 111, 103, 97, 96, 95, 94, +93, 92, 88, 85, 71, 56, 223, 3, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223 - } ; +223, 223, 223, 223, 223 +}; static yyconst short int yy_chk[406] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 8, 9, 10, - 10, 11, 11, 12, 10, 13, 11, 17, 20, 20, - 21, 19, 26, 26, 8, 21, 44, 17, 12, 19, - 19, 21, 22, 44, 22, 22, 23, 40, 23, 23, +{ 0, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 8, 9, 10, +10, 11, 11, 12, 10, 13, 11, 17, 20, 20, +21, 19, 26, 26, 8, 21, 44, 17, 12, 19, +19, 21, 22, 44, 22, 22, 23, 40, 23, 23, - 28, 28, 43, 9, 41, 45, 13, 22, 41, 45, - 40, 23, 53, 49, 22, 43, 59, 41, 62, 62, - 43, 68, 231, 22, 49, 77, 77, 23, 81, 81, - 82, 218, 82, 82, 83, 217, 83, 127, 127, 83, - 83, 126, 126, 128, 128, 82, 129, 129, 155, 155, - 127, 59, 68, 53, 156, 156, 126, 174, 174, 202, - 202, 82, 212, 212, 219, 219, 127, 214, 210, 156, - 224, 208, 224, 224, 224, 224, 224, 225, 207, 225, - 225, 226, 206, 226, 226, 226, 226, 226, 227, 204, - 203, 227, 228, 201, 200, 228, 229, 229, 198, 229, +28, 28, 43, 9, 41, 45, 13, 22, 41, 45, +40, 23, 53, 49, 22, 43, 59, 41, 62, 62, +43, 68, 231, 22, 49, 77, 77, 23, 81, 81, +82, 218, 82, 82, 83, 217, 83, 127, 127, 83, +83, 126, 126, 128, 128, 82, 129, 129, 155, 155, +127, 59, 68, 53, 156, 156, 126, 174, 174, 202, +202, 82, 212, 212, 219, 219, 127, 214, 210, 156, +224, 208, 224, 224, 224, 224, 224, 225, 207, 225, +225, 226, 206, 226, 226, 226, 226, 226, 227, 204, +203, 227, 228, 201, 200, 228, 229, 229, 198, 229, - 230, 197, 230, 230, 230, 230, 230, 232, 232, 196, - 232, 233, 233, 233, 233, 233, 233, 233, 234, 234, - 234, 234, 234, 234, 234, 235, 235, 195, 235, 235, - 235, 235, 236, 236, 236, 236, 236, 236, 236, 194, - 193, 192, 190, 188, 187, 186, 185, 184, 183, 182, - 180, 179, 178, 176, 175, 173, 171, 170, 169, 168, - 167, 166, 165, 164, 162, 161, 160, 158, 157, 154, - 153, 152, 151, 150, 149, 148, 147, 145, 144, 143, - 142, 141, 140, 139, 138, 137, 136, 135, 123, 122, - 121, 117, 116, 115, 114, 113, 112, 110, 109, 106, +230, 197, 230, 230, 230, 230, 230, 232, 232, 196, +232, 233, 233, 233, 233, 233, 233, 233, 234, 234, +234, 234, 234, 234, 234, 235, 235, 195, 235, 235, +235, 235, 236, 236, 236, 236, 236, 236, 236, 194, +193, 192, 190, 188, 187, 186, 185, 184, 183, 182, +180, 179, 178, 176, 175, 173, 171, 170, 169, 168, +167, 166, 165, 164, 162, 161, 160, 158, 157, 154, +153, 152, 151, 150, 149, 148, 147, 145, 144, 143, +142, 141, 140, 139, 138, 137, 136, 135, 123, 122, +121, 117, 116, 115, 114, 113, 112, 110, 109, 106, - 105, 104, 103, 101, 100, 99, 98, 97, 96, 94, - 93, 90, 86, 79, 74, 70, 64, 61, 57, 56, - 51, 50, 48, 47, 46, 42, 39, 38, 37, 34, - 33, 32, 27, 24, 16, 5, 3, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +105, 104, 103, 101, 100, 99, 98, 97, 96, 94, +93, 90, 86, 79, 74, 70, 64, 61, 57, 56, +51, 50, 48, 47, 46, 42, 39, 38, 37, 34, +33, 32, 27, 24, 16, 5, 3, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, +223, 223, 223, 223, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223 - } ; +223, 223, 223, 223, 223 +}; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ +* any uses of REJECT which flex missed. +*/ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 @@ -568,7 +568,7 @@ struct Token // Can't have ctors in structs used in unions, so we have this. template< typename T > -inline Token< T > MakeToken( T value, U32 lineNumber ) +inline Token< T > MakeToken(T value, U32 lineNumber) { Token< T > result; result.value = value; @@ -617,7 +617,7 @@ inline int isatty(int) { return 0; } buf[n++] = (char) c; \ result = n; \ } - + // General helper stuff. static int lineIndex; @@ -634,30 +634,30 @@ void CMDrestart(FILE *in); #line 635 "CMDscan.cpp" /* Macros after this point can all be overridden by user definitions in - * section 1. - */ +* section 1. +*/ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int yywrap YY_PROTO((void)); #else -extern int yywrap YY_PROTO(( void )); +extern int yywrap YY_PROTO((void)); #endif #endif #ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); +static void yyunput YY_PROTO((int c, char *buf_ptr)); #endif #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy YY_PROTO((char *, yyconst char *, int)); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput YY_PROTO((void)); #else -static int input YY_PROTO(( void )); +static int input YY_PROTO((void)); #endif #endif @@ -666,13 +666,13 @@ static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); +static void yy_push_state YY_PROTO((int new_state)); #endif #ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); +static void yy_pop_state YY_PROTO((void)); #endif #ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); +static int yy_top_state YY_PROTO((void)); #endif #else @@ -690,9 +690,9 @@ YY_MALLOC_DECL #endif #else /* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ +* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) +* or sizeof(void*) != sizeof(int). +*/ #endif #endif @@ -705,37 +705,37 @@ YY_MALLOC_DECL #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ +* we now use fwrite(). +*/ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ +* is returned in "result". +*/ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ +* we don't want an extra ';' after the "return" because that will cause +* some compilers to complain about unreachable statements. +*/ #ifndef yyterminate #define yyterminate() return YY_NULL #endif @@ -751,15 +751,15 @@ YY_MALLOC_DECL #endif /* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ +* easily add parameters. +*/ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ +* have been set up. +*/ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif @@ -770,778 +770,777 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION YY_DECL - { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; +{ + register yy_state_type yy_current_state; +register char *yy_cp, *yy_bp; +register int yy_act; #line 105 "CMDscan.l" - ; +; #line 785 "CMDscan.cpp" - if ( yy_init ) - { - yy_init = 0; +if (yy_init) +{ + yy_init = 0; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if (!yy_start) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if (!yyin) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if (!yyout) + yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if (!yy_current_buffer) + yy_current_buffer = + yy_create_buffer(yyin, YY_BUF_SIZE); - yy_load_buffer_state(); - } + yy_load_buffer_state(); +} - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; +while (1) /* loops until end-of-file is reached */ +{ + yy_cp = yy_c_buf_p; - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of yytext. */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 338 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if (yy_accept[yy_current_state]) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) + { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 224) + yy_c = yy_meta[(unsigned int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; + ++yy_cp; + } while (yy_base[yy_current_state] != 338); yy_find_action: + yy_act = yy_accept[yy_current_state]; + if (yy_act == 0) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; -do_action: /* This label is used only to access EOF actions. */ +do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) + switch (yy_act) { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; -case 1: -YY_RULE_SETUP + case 1: + YY_RULE_SETUP #line 107 "CMDscan.l" -{ } - YY_BREAK -case 2: -YY_RULE_SETUP + {} + YY_BREAK + case 2: + YY_RULE_SETUP #line 108 "CMDscan.l" -{ return(Sc_ScanDocBlock()); } - YY_BREAK -case 3: -YY_RULE_SETUP + { return(Sc_ScanDocBlock()); } + YY_BREAK + case 3: + YY_RULE_SETUP #line 109 "CMDscan.l" -; - YY_BREAK -case 4: -YY_RULE_SETUP + ; + YY_BREAK + case 4: + YY_RULE_SETUP #line 110 "CMDscan.l" -; - YY_BREAK -case 5: -YY_RULE_SETUP + ; + YY_BREAK + case 5: + YY_RULE_SETUP #line 111 "CMDscan.l" -{lineIndex++;} - YY_BREAK -case 6: -YY_RULE_SETUP + { lineIndex++; } + YY_BREAK + case 6: + YY_RULE_SETUP #line 112 "CMDscan.l" -{ return(Sc_ScanString(STRATOM)); } - YY_BREAK -case 7: -YY_RULE_SETUP + { return(Sc_ScanString(STRATOM)); } + YY_BREAK + case 7: + YY_RULE_SETUP #line 113 "CMDscan.l" -{ return(Sc_ScanString(TAGATOM)); } - YY_BREAK -case 8: -YY_RULE_SETUP + { return(Sc_ScanString(TAGATOM)); } + YY_BREAK + case 8: + YY_RULE_SETUP #line 114 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opEQ, lineIndex ); return opEQ; } - YY_BREAK -case 9: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opEQ, lineIndex); return opEQ; } + YY_BREAK + case 9: + YY_RULE_SETUP #line 115 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opNE, lineIndex ); return opNE; } - YY_BREAK -case 10: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opNE, lineIndex); return opNE; } + YY_BREAK + case 10: + YY_RULE_SETUP #line 116 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opGE, lineIndex ); return opGE; } - YY_BREAK -case 11: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opGE, lineIndex); return opGE; } + YY_BREAK + case 11: + YY_RULE_SETUP #line 117 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opLE, lineIndex ); return opLE; } - YY_BREAK -case 12: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opLE, lineIndex); return opLE; } + YY_BREAK + case 12: + YY_RULE_SETUP #line 118 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opAND, lineIndex ); return opAND; } - YY_BREAK -case 13: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opAND, lineIndex); return opAND; } + YY_BREAK + case 13: + YY_RULE_SETUP #line 119 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opOR, lineIndex ); return opOR; } - YY_BREAK -case 14: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opOR, lineIndex); return opOR; } + YY_BREAK + case 14: + YY_RULE_SETUP #line 120 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opCOLONCOLON, lineIndex ); return opCOLONCOLON; } - YY_BREAK -case 15: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opCOLONCOLON, lineIndex); return opCOLONCOLON; } + YY_BREAK + case 15: + YY_RULE_SETUP #line 121 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMINUSMINUS, lineIndex ); return opMINUSMINUS; } - YY_BREAK -case 16: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMINUSMINUS, lineIndex); return opMINUSMINUS; } + YY_BREAK + case 16: + YY_RULE_SETUP #line 122 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opPLUSPLUS, lineIndex ); return opPLUSPLUS; } - YY_BREAK -case 17: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opPLUSPLUS, lineIndex); return opPLUSPLUS; } + YY_BREAK + case 17: + YY_RULE_SETUP #line 123 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSTREQ, lineIndex ); return opSTREQ; } - YY_BREAK -case 18: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSTREQ, lineIndex); return opSTREQ; } + YY_BREAK + case 18: + YY_RULE_SETUP #line 124 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSTRNE, lineIndex ); return opSTRNE; } - YY_BREAK -case 19: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSTRNE, lineIndex); return opSTRNE; } + YY_BREAK + case 19: + YY_RULE_SETUP #line 125 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSHL, lineIndex ); return opSHL; } - YY_BREAK -case 20: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSHL, lineIndex); return opSHL; } + YY_BREAK + case 20: + YY_RULE_SETUP #line 126 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSHR, lineIndex ); return opSHR; } - YY_BREAK -case 21: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSHR, lineIndex); return opSHR; } + YY_BREAK + case 21: + YY_RULE_SETUP #line 127 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opPLASN, lineIndex ); return opPLASN; } - YY_BREAK -case 22: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opPLASN, lineIndex); return opPLASN; } + YY_BREAK + case 22: + YY_RULE_SETUP #line 128 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMIASN, lineIndex ); return opMIASN; } - YY_BREAK -case 23: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMIASN, lineIndex); return opMIASN; } + YY_BREAK + case 23: + YY_RULE_SETUP #line 129 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMLASN, lineIndex ); return opMLASN; } - YY_BREAK -case 24: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMLASN, lineIndex); return opMLASN; } + YY_BREAK + case 24: + YY_RULE_SETUP #line 130 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opDVASN, lineIndex ); return opDVASN; } - YY_BREAK -case 25: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opDVASN, lineIndex); return opDVASN; } + YY_BREAK + case 25: + YY_RULE_SETUP #line 131 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opMODASN, lineIndex ); return opMODASN; } - YY_BREAK -case 26: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opMODASN, lineIndex); return opMODASN; } + YY_BREAK + case 26: + YY_RULE_SETUP #line 132 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opANDASN, lineIndex ); return opANDASN; } - YY_BREAK -case 27: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opANDASN, lineIndex); return opANDASN; } + YY_BREAK + case 27: + YY_RULE_SETUP #line 133 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opXORASN, lineIndex ); return opXORASN; } - YY_BREAK -case 28: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opXORASN, lineIndex); return opXORASN; } + YY_BREAK + case 28: + YY_RULE_SETUP #line 134 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opORASN, lineIndex ); return opORASN; } - YY_BREAK -case 29: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opORASN, lineIndex); return opORASN; } + YY_BREAK + case 29: + YY_RULE_SETUP #line 135 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSLASN, lineIndex ); return opSLASN; } - YY_BREAK -case 30: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSLASN, lineIndex); return opSLASN; } + YY_BREAK + case 30: + YY_RULE_SETUP #line 136 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opSRASN, lineIndex ); return opSRASN; } - YY_BREAK -case 31: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opSRASN, lineIndex); return opSRASN; } + YY_BREAK + case 31: + YY_RULE_SETUP #line 137 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opINTNAME, lineIndex ); return opINTNAME; } - YY_BREAK -case 32: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opINTNAME, lineIndex); return opINTNAME; } + YY_BREAK + case 32: + YY_RULE_SETUP #line 138 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( opINTNAMER, lineIndex ); return opINTNAMER; } - YY_BREAK -case 33: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(opINTNAMER, lineIndex); return opINTNAMER; } + YY_BREAK + case 33: + YY_RULE_SETUP #line 139 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( '\n', lineIndex ); return '@'; } - YY_BREAK -case 34: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >('\n', lineIndex); return '@'; } + YY_BREAK + case 34: + YY_RULE_SETUP #line 140 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( '\t', lineIndex ); return '@'; } - YY_BREAK -case 35: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >('\t', lineIndex); return '@'; } + YY_BREAK + case 35: + YY_RULE_SETUP #line 141 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( ' ', lineIndex ); return '@'; } - YY_BREAK -case 36: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(' ', lineIndex); return '@'; } + YY_BREAK + case 36: + YY_RULE_SETUP #line 142 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( 0, lineIndex ); return '@'; } - YY_BREAK -case 37: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(0, lineIndex); return '@'; } + YY_BREAK + case 37: + YY_RULE_SETUP #line 143 "CMDscan.l" -{ /* this comment stops syntax highlighting from getting messed up when editing the lexer in TextPad */ - int c = 0, l; - for ( ; ; ) + { /* this comment stops syntax highlighting from getting messed up when editing the lexer in TextPad */ + int c = 0, l; + for (; ; ) { l = c; c = yyinput(); // Is this an open comment? - if ( c == EOF ) + if (c == EOF) { - CMDerror( "unexpected end of file found in comment" ); + CMDerror("unexpected end of file found in comment"); break; } // Increment line numbers. - else if ( c == '\n' ) + else if (c == '\n') lineIndex++; // Did we find the end of the comment? - else if ( l == '*' && c == '/' ) + else if (l == '*' && c == '/') break; } - } - YY_BREAK -case 38: + } + YY_BREAK + case 38: #line 167 "CMDscan.l" -case 39: + case 39: #line 168 "CMDscan.l" -case 40: + case 40: #line 169 "CMDscan.l" -case 41: + case 41: #line 170 "CMDscan.l" -case 42: + case 42: #line 171 "CMDscan.l" -case 43: + case 43: #line 172 "CMDscan.l" -case 44: + case 44: #line 173 "CMDscan.l" -case 45: + case 45: #line 174 "CMDscan.l" -case 46: + case 46: #line 175 "CMDscan.l" -case 47: + case 47: #line 176 "CMDscan.l" -case 48: + case 48: #line 177 "CMDscan.l" -case 49: + case 49: #line 178 "CMDscan.l" -case 50: + case 50: #line 179 "CMDscan.l" -case 51: + case 51: #line 180 "CMDscan.l" -case 52: + case 52: #line 181 "CMDscan.l" -case 53: + case 53: #line 182 "CMDscan.l" -case 54: + case 54: #line 183 "CMDscan.l" -case 55: + case 55: #line 184 "CMDscan.l" -case 56: + case 56: #line 185 "CMDscan.l" -case 57: + case 57: #line 186 "CMDscan.l" -case 58: + case 58: #line 187 "CMDscan.l" -case 59: + case 59: #line 188 "CMDscan.l" -case 60: + case 60: #line 189 "CMDscan.l" -case 61: -YY_RULE_SETUP + case 61: + YY_RULE_SETUP #line 189 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( CMDtext[ 0 ], lineIndex ); return CMDtext[ 0 ]; } - YY_BREAK -case 62: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(CMDtext[0], lineIndex); return CMDtext[0]; } + YY_BREAK + case 62: + YY_RULE_SETUP #line 190 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwIN, lineIndex ); return(rwIN); } - YY_BREAK -case 63: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwIN, lineIndex); return(rwIN); } + YY_BREAK + case 63: + YY_RULE_SETUP #line 191 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwCASEOR, lineIndex ); return(rwCASEOR); } - YY_BREAK -case 64: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwCASEOR, lineIndex); return(rwCASEOR); } + YY_BREAK + case 64: + YY_RULE_SETUP #line 192 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwBREAK, lineIndex ); return(rwBREAK); } - YY_BREAK -case 65: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwBREAK, lineIndex); return(rwBREAK); } + YY_BREAK + case 65: + YY_RULE_SETUP #line 193 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwRETURN, lineIndex ); return(rwRETURN); } - YY_BREAK -case 66: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwRETURN, lineIndex); return(rwRETURN); } + YY_BREAK + case 66: + YY_RULE_SETUP #line 194 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwELSE, lineIndex ); return(rwELSE); } - YY_BREAK -case 67: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwELSE, lineIndex); return(rwELSE); } + YY_BREAK + case 67: + YY_RULE_SETUP #line 195 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwASSERT, lineIndex ); return(rwASSERT); } - YY_BREAK -case 68: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwASSERT, lineIndex); return(rwASSERT); } + YY_BREAK + case 68: + YY_RULE_SETUP #line 196 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwWHILE, lineIndex ); return(rwWHILE); } - YY_BREAK -case 69: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwWHILE, lineIndex); return(rwWHILE); } + YY_BREAK + case 69: + YY_RULE_SETUP #line 197 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDO, lineIndex ); return(rwDO); } - YY_BREAK -case 70: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDO, lineIndex); return(rwDO); } + YY_BREAK + case 70: + YY_RULE_SETUP #line 198 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwIF, lineIndex ); return(rwIF); } - YY_BREAK -case 71: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwIF, lineIndex); return(rwIF); } + YY_BREAK + case 71: + YY_RULE_SETUP #line 199 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwFOREACHSTR, lineIndex ); return(rwFOREACHSTR); } - YY_BREAK -case 72: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwFOREACHSTR, lineIndex); return(rwFOREACHSTR); } + YY_BREAK + case 72: + YY_RULE_SETUP #line 200 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwFOREACH, lineIndex ); return(rwFOREACH); } - YY_BREAK -case 73: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwFOREACH, lineIndex); return(rwFOREACH); } + YY_BREAK + case 73: + YY_RULE_SETUP #line 201 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwFOR, lineIndex ); return(rwFOR); } - YY_BREAK -case 74: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwFOR, lineIndex); return(rwFOR); } + YY_BREAK + case 74: + YY_RULE_SETUP #line 202 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwCONTINUE, lineIndex ); return(rwCONTINUE); } - YY_BREAK -case 75: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwCONTINUE, lineIndex); return(rwCONTINUE); } + YY_BREAK + case 75: + YY_RULE_SETUP #line 203 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDEFINE, lineIndex ); return(rwDEFINE); } - YY_BREAK -case 76: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDEFINE, lineIndex); return(rwDEFINE); } + YY_BREAK + case 76: + YY_RULE_SETUP #line 204 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDECLARE, lineIndex ); return(rwDECLARE); } - YY_BREAK -case 77: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDECLARE, lineIndex); return(rwDECLARE); } + YY_BREAK + case 77: + YY_RULE_SETUP #line 205 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDECLARESINGLETON, lineIndex ); return(rwDECLARESINGLETON); } - YY_BREAK -case 78: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDECLARESINGLETON, lineIndex); return(rwDECLARESINGLETON); } + YY_BREAK + case 78: + YY_RULE_SETUP #line 206 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDATABLOCK, lineIndex ); return(rwDATABLOCK); } - YY_BREAK -case 79: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDATABLOCK, lineIndex); return(rwDATABLOCK); } + YY_BREAK + case 79: + YY_RULE_SETUP #line 207 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwCASE, lineIndex ); return(rwCASE); } - YY_BREAK -case 80: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwCASE, lineIndex); return(rwCASE); } + YY_BREAK + case 80: + YY_RULE_SETUP #line 208 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwSWITCHSTR, lineIndex ); return(rwSWITCHSTR); } - YY_BREAK -case 81: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwSWITCHSTR, lineIndex); return(rwSWITCHSTR); } + YY_BREAK + case 81: + YY_RULE_SETUP #line 209 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwSWITCH, lineIndex ); return(rwSWITCH); } - YY_BREAK -case 82: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwSWITCH, lineIndex); return(rwSWITCH); } + YY_BREAK + case 82: + YY_RULE_SETUP #line 210 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwDEFAULT, lineIndex ); return(rwDEFAULT); } - YY_BREAK -case 83: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwDEFAULT, lineIndex); return(rwDEFAULT); } + YY_BREAK + case 83: + YY_RULE_SETUP #line 211 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwPACKAGE, lineIndex ); return(rwPACKAGE); } - YY_BREAK -case 84: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwPACKAGE, lineIndex); return(rwPACKAGE); } + YY_BREAK + case 84: + YY_RULE_SETUP #line 212 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( rwNAMESPACE, lineIndex ); return(rwNAMESPACE); } - YY_BREAK -case 85: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(rwNAMESPACE, lineIndex); return(rwNAMESPACE); } + YY_BREAK + case 85: + YY_RULE_SETUP #line 213 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( 1, lineIndex ); return INTCONST; } - YY_BREAK -case 86: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(1, lineIndex); return INTCONST; } + YY_BREAK + case 86: + YY_RULE_SETUP #line 214 "CMDscan.l" -{ CMDlval.i = MakeToken< int >( 0, lineIndex ); return INTCONST; } - YY_BREAK -case 87: -YY_RULE_SETUP + { CMDlval.i = MakeToken< int >(0, lineIndex); return INTCONST; } + YY_BREAK + case 87: + YY_RULE_SETUP #line 215 "CMDscan.l" -{ return(Sc_ScanVar()); } - YY_BREAK -case 88: -YY_RULE_SETUP + { return(Sc_ScanVar()); } + YY_BREAK + case 88: + YY_RULE_SETUP #line 216 "CMDscan.l" -{ return Sc_ScanIdent(); } - YY_BREAK -case 89: -YY_RULE_SETUP + { return Sc_ScanIdent(); } + YY_BREAK + case 89: + YY_RULE_SETUP #line 217 "CMDscan.l" -return(Sc_ScanHex()); - YY_BREAK -case 90: -YY_RULE_SETUP + return(Sc_ScanHex()); + YY_BREAK + case 90: + YY_RULE_SETUP #line 218 "CMDscan.l" -{ CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >( dAtoi(CMDtext), lineIndex ); return INTCONST; } - YY_BREAK -case 91: -YY_RULE_SETUP + { CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >(dAtoi(CMDtext), lineIndex); return INTCONST; } + YY_BREAK + case 91: + YY_RULE_SETUP #line 219 "CMDscan.l" -return Sc_ScanNum(); - YY_BREAK -case 92: -YY_RULE_SETUP + return Sc_ScanNum(); + YY_BREAK + case 92: + YY_RULE_SETUP #line 220 "CMDscan.l" -return(ILLEGAL_TOKEN); - YY_BREAK -case 93: -YY_RULE_SETUP + return(ILLEGAL_TOKEN); + YY_BREAK + case 93: + YY_RULE_SETUP #line 221 "CMDscan.l" -return(ILLEGAL_TOKEN); - YY_BREAK -case 94: -YY_RULE_SETUP + return(ILLEGAL_TOKEN); + YY_BREAK + case 94: + YY_RULE_SETUP #line 222 "CMDscan.l" -ECHO; - YY_BREAK + ECHO; + YY_BREAK #line 1291 "CMDscan.cpp" -case YY_STATE_EOF(INITIAL): - yyterminate(); + case YY_STATE_EOF(INITIAL): + yyterminate(); - case YY_END_OF_BUFFER: + case YY_END_OF_BUFFER: { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if (yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW) { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if (yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars]) { /* This was really a NUL. */ - yy_state_type yy_next_state; + yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans(yy_current_state); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = yytext_ptr + YY_MORE_ADJ; - if ( yy_next_state ) + if (yy_next_state) { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; } - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch (yy_get_next_buffer()) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if (yywrap()) { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; } - break; + + else + { + if (!yy_did_buffer_switch_on_eof) + YY_NEW_FILE; + } + break; } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; } - break; + break; } - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found"); } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ +} /* end of scanning one token */ +} /* end of yylex */ -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ + /* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ -static int yy_get_next_buffer() - { - char *dest = yy_current_buffer->yy_ch_buf; - char *source = yytext_ptr; - int number_to_move, i; + static int yy_get_next_buffer() +{ + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if (yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1]) YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + "fatal flex scanner internal error--end of buffer missed"); - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { + if (yy_current_buffer->yy_fill_buffer == 0) + { /* Don't try to fill the buffer, so this is an EOF. */ + if (yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1) + { /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ + * treat this as a final EOF. + */ return EOB_ACT_END_OF_FILE; - } + } else - { + { /* We matched some text prior to the EOB, first - * process it. - */ + * process it. + */ return EOB_ACT_LAST_MATCH; - } } + } /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int)(yy_c_buf_p - yytext_ptr) - 1; - for ( i = 0; i < number_to_move; ++i ) + for (i = 0; i < number_to_move; ++i) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if (yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING) /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ + * just force an EOF + */ yy_n_chars = 0; else - { + { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + while (num_to_read <= 0) + { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + "input buffer overflow, can't enlarge buffer because scanner uses REJECT"); #else - /* just a shorter name for the current buffer */ + /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int)(yy_c_buf_p - b->yy_ch_buf); - if ( b->yy_is_our_buffer ) - { + if (b->yy_is_our_buffer) + { int new_size = b->yy_buf_size * 2; - if ( new_size <= 0 ) + if (new_size <= 0) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } + yy_flex_realloc((void *)b->yy_ch_buf, + b->yy_buf_size + 2); + } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; - if ( ! b->yy_ch_buf ) + if (!b->yy_ch_buf) YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + "fatal error - scanner input buffer overflow"); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; + number_to_move - 1; #endif - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) + if (num_to_read > YY_READ_BUF_SIZE) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT((&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read); + } + + if (yy_n_chars == 0) + { + if (number_to_move == YY_MORE_ADJ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin); } - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - else - { + { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; - } } + } else ret_val = EOB_ACT_CONTINUE_SCAN; @@ -1553,116 +1552,116 @@ static int yy_get_next_buffer() yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; - } +} /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() - { - yy_state_type yy_current_state; - char *yy_cp; +{ + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = yy_start; - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for (yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if (yy_accept[yy_current_state]) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) + { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 224) + yy_c = yy_meta[(unsigned int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; + } return yy_current_state; - } +} /* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ +* +* synopsis +* next_state = yy_try_NUL_trans( current_state ); +*/ #ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state) #else -static yy_state_type yy_try_NUL_trans( yy_current_state ) +static yy_state_type yy_try_NUL_trans(yy_current_state) yy_state_type yy_current_state; #endif - { - int yy_is_jam; - char *yy_cp = yy_c_buf_p; +{ + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { + register YY_CHAR yy_c = 1; + if (yy_accept[yy_current_state]) + { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) + { + yy_current_state = (int)yy_def[yy_current_state]; + if (yy_current_state >= 224) + yy_c = yy_meta[(unsigned int)yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c]; yy_is_jam = (yy_current_state == 223); return yy_is_jam ? 0 : yy_current_state; - } +} #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS -static void yyunput( int c, char *yy_bp ) +static void yyunput(int c, register char *yy_bp) #else -static void yyunput( c, yy_bp ) +static void yyunput(c, yy_bp) int c; -char *yy_bp; +register char *yy_bp; #endif - { - char *yy_cp = yy_c_buf_p; +{ + register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = yy_n_chars + 2; - char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + if (yy_cp < yy_current_buffer->yy_ch_buf + 2) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) + while (source > yy_current_buffer->yy_ch_buf) *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); + yy_cp += (int)(dest - source); + yy_bp += (int)(dest - source); yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if (yy_cp < yy_current_buffer->yy_ch_buf + 2) + YY_FATAL_ERROR("flex scanner push-back overflow"); + } - *--yy_cp = (char) c; + *--yy_cp = (char)c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ +} +#endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus @@ -1670,45 +1669,45 @@ static int yyinput() #else static int input() #endif - { +{ int c; *yy_c_buf_p = yy_hold_char; - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { + if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR) + { /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if (yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars]) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else - { /* need more input */ + { /* need more input */ yytext_ptr = yy_c_buf_p; ++yy_c_buf_p; - switch ( yy_get_next_buffer() ) - { + switch (yy_get_next_buffer()) + { case EOB_ACT_END_OF_FILE: + { + if (yywrap()) { - if ( yywrap() ) - { yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; + yytext_ptr + YY_MORE_ADJ; return EOF; - } + } - if ( ! yy_did_buffer_switch_on_eof ) + if (!yy_did_buffer_switch_on_eof) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif - } + } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; @@ -1717,150 +1716,150 @@ static int input() case EOB_ACT_LAST_MATCH: #ifdef __cplusplus YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); + "unexpected last match in yyinput()"); #else YY_FATAL_ERROR( - "unexpected last match in input()" ); + "unexpected last match in input()"); #endif - } } } + } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ + c = *(unsigned char *)yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; - } +} #ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) +void yyrestart(FILE *input_file) #else -void yyrestart( input_file ) +void yyrestart(input_file) FILE *input_file; #endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); +{ + if (!yy_current_buffer) + yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE); - yy_init_buffer( yy_current_buffer, input_file ); + yy_init_buffer(yy_current_buffer, input_file); yy_load_buffer_state(); - } +} #ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer) #else -void yy_switch_to_buffer( new_buffer ) +void yy_switch_to_buffer(new_buffer) YY_BUFFER_STATE new_buffer; #endif - { - if ( yy_current_buffer == new_buffer ) +{ + if (yy_current_buffer == new_buffer) return; - if ( yy_current_buffer ) - { + if (yy_current_buffer) + { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; - } + } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ yy_did_buffer_switch_on_eof = 1; - } +} #ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) +void yy_load_buffer_state(void) #else void yy_load_buffer_state() #endif - { +{ yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; - } +} #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +YY_BUFFER_STATE yy_create_buffer(FILE *file, int size) #else -YY_BUFFER_STATE yy_create_buffer( file, size ) +YY_BUFFER_STATE yy_create_buffer(file, size) FILE *file; int size; #endif - { +{ YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state)); + if (!b) + YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *)yy_flex_alloc(b->yy_buf_size + 2); + if (!b->yy_ch_buf) + YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()"); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b, file); return b; - } +} #ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) +void yy_delete_buffer(YY_BUFFER_STATE b) #else -void yy_delete_buffer( b ) +void yy_delete_buffer(b) YY_BUFFER_STATE b; #endif - { - if ( ! b ) +{ + if (!b) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if (b == yy_current_buffer) + yy_current_buffer = (YY_BUFFER_STATE)0; - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + if (b->yy_is_our_buffer) + yy_flex_free((void *)b->yy_ch_buf); - yy_flex_free( (void *) b ); - } + yy_flex_free((void *)b); +} #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); +extern int isatty YY_PROTO((int)); #endif #endif #ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +void yy_init_buffer(YY_BUFFER_STATE b, FILE *file) #else -void yy_init_buffer( b, file ) +void yy_init_buffer(b, file) YY_BUFFER_STATE b; FILE *file; #endif - { - yy_flush_buffer( b ); +{ + yy_flush_buffer(b); b->yy_input_file = file; b->yy_fill_buffer = 1; @@ -1871,26 +1870,26 @@ FILE *file; #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0; #endif #endif - } +} #ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) +void yy_flush_buffer(YY_BUFFER_STATE b) #else -void yy_flush_buffer( b ) +void yy_flush_buffer(b) YY_BUFFER_STATE b; #endif - { +{ b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; @@ -1899,33 +1898,33 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) + if (b == yy_current_buffer) yy_load_buffer_state(); - } +} #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size) #else -YY_BUFFER_STATE yy_scan_buffer( base, size ) +YY_BUFFER_STATE yy_scan_buffer(base, size) char *base; yy_size_t size; #endif - { +{ YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) + if (size < 2 || + base[size - 2] != YY_END_OF_BUFFER_CHAR || + base[size - 1] != YY_END_OF_BUFFER_CHAR) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + b = (YY_BUFFER_STATE)yy_flex_alloc(sizeof(struct yy_buffer_state)); + if (!b) + YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()"); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; @@ -1935,39 +1934,39 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b); return b; - } +} #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *str ) +YY_BUFFER_STATE yy_scan_string(yyconst char *str) #else -YY_BUFFER_STATE yy_scan_string( str ) +YY_BUFFER_STATE yy_scan_string(str) yyconst char *str; #endif - { +{ int len; - for ( len = 0; str[len]; ++len ) + for (len = 0; str[len]; ++len) ; - return yy_scan_bytes( str, len ); - } + return yy_scan_bytes(str, len); +} #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +YY_BUFFER_STATE yy_scan_bytes(yyconst char *bytes, int len) #else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +YY_BUFFER_STATE yy_scan_bytes(bytes, len) yyconst char *bytes; int len; #endif - { +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; @@ -1975,79 +1974,79 @@ int len; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + buf = (char *)yy_flex_alloc(n); + if (!buf) + YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()"); - for ( i = 0; i < len; ++i ) + for (i = 0; i < len; ++i) buf[i] = bytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len + 1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + b = yy_scan_buffer(buf, n); + if (!b) + YY_FATAL_ERROR("bad buffer in yy_scan_bytes()"); /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ + * away when we're done. + */ b->yy_is_our_buffer = 1; return b; - } +} #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) +static void yy_push_state(int new_state) #else -static void yy_push_state( new_state ) +static void yy_push_state(new_state) int new_state; #endif +{ + if (yy_start_stack_ptr >= yy_start_stack_depth) { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + new_size = yy_start_stack_depth * sizeof(int); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if (!yy_start_stack) + yy_start_stack = (int *)yy_flex_alloc(new_size); else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + yy_start_stack = (int *)yy_flex_realloc( + (void *)yy_start_stack, new_size); - if ( ! yy_start_stack ) + if (!yy_start_stack) YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } + "out of memory expanding start-condition stack"); + } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); - } +} #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); +{ + if (--yy_start_stack_ptr < 0) + YY_FATAL_ERROR("start-condition stack underflow"); BEGIN(yy_start_stack[yy_start_stack_ptr]); - } +} #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() - { +{ return yy_start_stack[yy_start_stack_ptr - 1]; - } +} #endif #ifndef YY_EXIT_FAILURE @@ -2055,15 +2054,15 @@ static int yy_top_state() #endif #ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) +static void yy_fatal_error(yyconst char msg[]) #else -static void yy_fatal_error( msg ) +static void yy_fatal_error(msg) char msg[]; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } +{ + (void)fprintf(stderr, "%s\n", msg); + exit(YY_EXIT_FAILURE); +} @@ -2071,81 +2070,81 @@ char msg[]; #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +static void yy_flex_strncpy(char *s1, yyconst char *s2, int n) #else -static void yy_flex_strncpy( s1, s2, n ) +static void yy_flex_strncpy(s1, s2, n) char *s1; yyconst char *s2; int n; #endif - { - int i; - for ( i = 0; i < n; ++i ) +{ + register int i; + for (i = 0; i < n; ++i) s1[i] = s2[i]; - } +} #endif #ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) +static void *yy_flex_alloc(yy_size_t size) #else -static void *yy_flex_alloc( size ) +static void *yy_flex_alloc(size) yy_size_t size; #endif - { - return (void *) malloc( size ); - } +{ + return (void *)malloc(size); +} #ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) +static void *yy_flex_realloc(void *ptr, yy_size_t size) #else -static void *yy_flex_realloc( ptr, size ) +static void *yy_flex_realloc(ptr, size) void *ptr; yy_size_t size; #endif - { +{ /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *)realloc((char *)ptr, size); +} #ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) +static void yy_flex_free(void *ptr) #else -static void yy_flex_free( ptr ) +static void yy_flex_free(ptr) void *ptr; #endif - { - free( ptr ); - } +{ + free(ptr); +} #if YY_MAIN int main() - { +{ yylex(); return 0; - } +} #endif #line 222 "CMDscan.l" @@ -2173,59 +2172,59 @@ void CMDerror(char *format, ...) const int BUFMAX = 1024; char tempBuf[BUFMAX]; va_list args; - va_start( args, format ); + va_start(args, format); #ifdef TORQUE_OS_WIN - _vsnprintf( tempBuf, BUFMAX, format, args ); + _vsnprintf(tempBuf, BUFMAX, format, args); #else - vsnprintf( tempBuf, BUFMAX, format, args ); + vsnprintf(tempBuf, BUFMAX, format, args); #endif - va_end(args); + va_end(args); - if(fileName) + if (fileName) { Con::errorf(ConsoleLogEntry::Script, "%s Line: %d - %s", fileName, lineIndex, tempBuf); #ifndef NO_ADVANCED_ERROR_REPORT // dhc - lineIndex is bogus. let's try to add some sanity back in. - int i,j,n; + int i, j, n; char c; int linediv = 1; // first, walk the buffer, trying to detect line ending type. // this is imperfect, if inconsistant line endings exist... - for (i=0; iBUFMAX>>2) break; // at least get a little data + c = scanBuffer[scanIndex - i]; + if ((c == '\r' || c == '\n') && i>BUFMAX >> 2) break; // at least get a little data n++; i++; } // find next lineending - while (n>1) // cap at half-buf-size forward + while (n>1) // cap at half-buf-size forward { - c = scanBuffer[scanIndex+j]; - if (c==0) break; - if ((c=='\r' || c=='\n') && j>BUFMAX>>2) break; // at least get a little data + c = scanBuffer[scanIndex + j]; + if (c == 0) break; + if ((c == '\r' || c == '\n') && j>BUFMAX >> 2) break; // at least get a little data n++; j++; } if (i) i--; // chop off extra linefeed. if (j) j--; // chop off extra linefeed. - // build our little text block - if (i) dStrncpy(tempBuf,scanBuffer+scanIndex-i,i); - dStrncpy(tempBuf+i,"##", 2); // bracketing. - tempBuf[i+2] = scanBuffer[scanIndex]; // copy the halt character. - dStrncpy(tempBuf+i+3,"##", 2); // bracketing. - if (j) dStrncpy(tempBuf+i+5,scanBuffer+scanIndex+1,j); // +1 to go past current char. - tempBuf[i+j+5] = 0; // null terminate - for(n=0; n>> Advanced script error report. Line %d.", lineIndex); Con::warnf(ConsoleLogEntry::Script, ">>> Some error context, with ## on sides of error halt:"); @@ -2242,7 +2241,7 @@ void CMDerror(char *format, ...) Con::setVariable("$ScriptError", tempBuf); // We also need to mark that we came up with a new error. - static S32 sScriptErrorHash=1000; + static S32 sScriptErrorHash = 1000; Con::setIntVariable("$ScriptErrorHash", sScriptErrorHash++); } else @@ -2260,7 +2259,7 @@ void CMDSetScanBuffer(const char *sb, const char *fn) int CMDgetc() { int ret = scanBuffer[scanIndex]; - if(ret) + if (ret) scanIndex++; else ret = -1; @@ -2278,13 +2277,13 @@ static int Sc_ScanVar() CMDtext[CMDleng] = 0; // Make it a stringtable string! - CMDlval.s = MakeToken< StringTableEntry >( StringTable->insert(CMDtext), lineIndex ); + CMDlval.s = MakeToken< StringTableEntry >(StringTable->insert(CMDtext), lineIndex); return(VAR); } static int charConv(int in) { - switch(in) + switch (in) { case 'r': return '\r'; @@ -2299,11 +2298,11 @@ static int charConv(int in) static int getHexDigit(char c) { - if(c >= '0' && c <= '9') + if (c >= '0' && c <= '9') return c - '0'; - if(c >= 'A' && c <= 'F') + if (c >= 'A' && c <= 'F') return c - 'A' + 10; - if(c >= 'a' && c <= 'f') + if (c >= 'a' && c <= 'f') return c - 'a' + 10; return -1; } @@ -2311,40 +2310,40 @@ static int getHexDigit(char c) static int Sc_ScanDocBlock() { S32 len = dStrlen(CMDtext); - char* text = (char *) consoleAlloc(len + 1); + char* text = (char *)consoleAlloc(len + 1); S32 line = lineIndex; - for( S32 i = 0, j = 0; j <= len; j++ ) + for (S32 i = 0, j = 0; j <= len; j++) { - if( ( j <= (len - 2) ) && ( CMDtext[j] == '/' ) && ( CMDtext[j + 1] == '/' ) && ( CMDtext[j + 2] == '/' ) ) + if ((j <= (len - 2)) && (CMDtext[j] == '/') && (CMDtext[j + 1] == '/') && (CMDtext[j + 2] == '/')) { j += 2; continue; } - if( CMDtext[j] == '\r' ) + if (CMDtext[j] == '\r') continue; - if( CMDtext[j] == '\n' ) + if (CMDtext[j] == '\n') lineIndex++; text[i++] = CMDtext[j]; } - CMDlval.str = MakeToken< char* >( text, line ); + CMDlval.str = MakeToken< char* >(text, line); return(DOCBLOCK); } static int Sc_ScanString(int ret) { CMDtext[CMDleng - 1] = 0; - if(!collapseEscape(CMDtext+1)) + if (!collapseEscape(CMDtext + 1)) return -1; - - char* buffer = ( char* ) consoleAlloc( dStrlen( CMDtext ) ); - dStrcpy( buffer, CMDtext + 1 ); - - CMDlval.str = MakeToken< char* >( buffer, lineIndex ); + + char* buffer = (char*)consoleAlloc(dStrlen(CMDtext)); + dStrcpy(buffer, CMDtext + 1); + + CMDlval.str = MakeToken< char* >(buffer, lineIndex); return ret; } @@ -2354,96 +2353,96 @@ static int Sc_ScanIdent() CMDtext[CMDleng] = 0; - if((type = ConsoleBaseType::getTypeByName(CMDtext)) != NULL) + if ((type = ConsoleBaseType::getTypeByName(CMDtext)) != NULL) { /* It's a type */ - CMDlval.i = MakeToken< int >( type->getTypeID(), lineIndex ); + CMDlval.i = MakeToken< int >(type->getTypeID(), lineIndex); return TYPEIDENT; } /* It's an identifier */ - CMDlval.s = MakeToken< StringTableEntry >( StringTable->insert(CMDtext), lineIndex ); + CMDlval.s = MakeToken< StringTableEntry >(StringTable->insert(CMDtext), lineIndex); return IDENT; } void expandEscape(char *dest, const char *src) { U8 c; - while((c = (U8) *src++) != 0) + while ((c = (U8)*src++) != 0) { - if(c == '\"') + if (c == '\"') { *dest++ = '\\'; *dest++ = '\"'; } - else if(c == '\\') + else if (c == '\\') { *dest++ = '\\'; *dest++ = '\\'; } - else if(c == '\r') + else if (c == '\r') { *dest++ = '\\'; *dest++ = 'r'; } - else if(c == '\n') + else if (c == '\n') { *dest++ = '\\'; *dest++ = 'n'; } - else if(c == '\t') + else if (c == '\t') { *dest++ = '\\'; *dest++ = 't'; } - else if(c == '\'') + else if (c == '\'') { *dest++ = '\\'; *dest++ = '\''; } - else if((c >= 1 && c <= 7) || - (c >= 11 && c <= 12) || - (c >= 14 && c <= 15)) + else if ((c >= 1 && c <= 7) || + (c >= 11 && c <= 12) || + (c >= 14 && c <= 15)) { - /* Remap around: \b = 0x8, \t = 0x9, \n = 0xa, \r = 0xd */ - static U8 expandRemap[15] = { 0x0, - 0x0, - 0x1, - 0x2, - 0x3, - 0x4, - 0x5, - 0x6, - 0x0, - 0x0, - 0x0, - 0x7, - 0x8, - 0x0, - 0x9 }; + /* Remap around: \b = 0x8, \t = 0x9, \n = 0xa, \r = 0xd */ + static U8 expandRemap[15] = { 0x0, + 0x0, + 0x1, + 0x2, + 0x3, + 0x4, + 0x5, + 0x6, + 0x0, + 0x0, + 0x0, + 0x7, + 0x8, + 0x0, + 0x9 }; *dest++ = '\\'; *dest++ = 'c'; - if(c == 15) + if (c == 15) *dest++ = 'r'; - else if(c == 16) + else if (c == 16) *dest++ = 'p'; - else if(c == 17) + else if (c == 17) *dest++ = 'o'; else *dest++ = expandRemap[c] + '0'; } - else if(c < 32) + else if (c < 32) { *dest++ = '\\'; *dest++ = 'x'; S32 dig1 = c >> 4; S32 dig2 = c & 0xf; - if(dig1 < 10) + if (dig1 < 10) dig1 += '0'; else dig1 += 'A' - 10; - if(dig2 < 10) + if (dig2 < 10) dig2 += '0'; else dig2 += 'A' - 10; @@ -2459,56 +2458,56 @@ void expandEscape(char *dest, const char *src) bool collapseEscape(char *buf) { S32 len = dStrlen(buf) + 1; - for(S32 i = 0; i < len;) + for (S32 i = 0; i < len;) { - if(buf[i] == '\\') + if (buf[i] == '\\') { - if(buf[i+1] == 'x') + if (buf[i + 1] == 'x') { - S32 dig1 = getHexDigit(buf[i+2]); - if(dig1 == -1) + S32 dig1 = getHexDigit(buf[i + 2]); + if (dig1 == -1) return false; - S32 dig2 = getHexDigit(buf[i+3]); - if(dig2 == -1) + S32 dig2 = getHexDigit(buf[i + 3]); + if (dig2 == -1) return false; buf[i] = dig1 * 16 + dig2; dMemmove(buf + i + 1, buf + i + 4, len - i - 3); len -= 3; i++; } - else if(buf[i+1] == 'c') + else if (buf[i + 1] == 'c') { /* Remap around: \b = 0x8, \t = 0x9, \n = 0xa, \r = 0xd */ static U8 collapseRemap[10] = { 0x1, - 0x2, - 0x3, - 0x4, - 0x5, - 0x6, - 0x7, - 0xb, - 0xc, - 0xe }; + 0x2, + 0x3, + 0x4, + 0x5, + 0x6, + 0x7, + 0xb, + 0xc, + 0xe }; - if(buf[i+2] == 'r') - buf[i] = 15; - else if(buf[i+2] == 'p') + if (buf[i + 2] == 'r') + buf[i] = 15; + else if (buf[i + 2] == 'p') buf[i] = 16; - else if(buf[i+2] == 'o') + else if (buf[i + 2] == 'o') buf[i] = 17; else { - int dig1 = buf[i+2] - '0'; - if(dig1 < 0 || dig1 > 9) - return false; - buf[i] = collapseRemap[dig1]; + int dig1 = buf[i + 2] - '0'; + if (dig1 < 0 || dig1 > 9) + return false; + buf[i] = collapseRemap[dig1]; } // Make sure we don't put 0x1 at the beginning of the string. if ((buf[i] == 0x1) && (i == 0)) { buf[i] = 0x2; - buf[i+1] = 0x1; + buf[i + 1] = 0x1; dMemmove(buf + i + 2, buf + i + 3, len - i - 1); len -= 1; } @@ -2521,7 +2520,7 @@ bool collapseEscape(char *buf) } else { - buf[i] = charConv(buf[i+1]); + buf[i] = charConv(buf[i + 1]); dMemmove(buf + i + 1, buf + i + 2, len - i - 1); len--; i++; @@ -2536,7 +2535,7 @@ bool collapseEscape(char *buf) static int Sc_ScanNum() { CMDtext[CMDleng] = 0; - CMDlval.f = MakeToken< double >( dAtof(CMDtext), lineIndex ); + CMDlval.f = MakeToken< double >(dAtof(CMDtext), lineIndex); return(FLTCONST); } @@ -2544,7 +2543,7 @@ static int Sc_ScanHex() { S32 val = 0; dSscanf(CMDtext, "%x", &val); - CMDlval.i = MakeToken< int >( val, lineIndex ); + CMDlval.i = MakeToken< int >(val, lineIndex); return INTCONST; } diff --git a/Engine/source/console/ast.h b/Engine/source/console/ast.h index f1327a75a..65b20a926 100644 --- a/Engine/source/console/ast.h +++ b/Engine/source/console/ast.h @@ -56,7 +56,7 @@ struct StmtNode StmtNode(); virtual ~StmtNode() {} - + /// @name next Accessors /// @{ @@ -99,17 +99,17 @@ struct StmtNode struct BreakStmtNode : StmtNode { - static BreakStmtNode *alloc( S32 lineNumber ); + static BreakStmtNode *alloc(S32 lineNumber); + - U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(BreakStmtNode); }; struct ContinueStmtNode : StmtNode { - static ContinueStmtNode *alloc( S32 lineNumber ); - + static ContinueStmtNode *alloc(S32 lineNumber); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(ContinueStmtNode); }; @@ -117,7 +117,7 @@ struct ContinueStmtNode : StmtNode /// A mathematical expression. struct ExprNode : StmtNode { - + U32 compileStmt(CodeStream &codeStream, U32 ip); virtual U32 compile(CodeStream &codeStream, U32 ip, TypeReq type) = 0; @@ -128,8 +128,8 @@ struct ReturnStmtNode : StmtNode { ExprNode *expr; - static ReturnStmtNode *alloc( S32 lineNumber, ExprNode *expr ); - + static ReturnStmtNode *alloc(S32 lineNumber, ExprNode *expr); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(ReturnStmtNode); }; @@ -143,10 +143,10 @@ struct IfStmtNode : StmtNode bool integer; bool propagate; - static IfStmtNode *alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagateThrough ); + static IfStmtNode *alloc(S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagateThrough); void propagateSwitchExpr(ExprNode *left, bool string); ExprNode *getSwitchOR(ExprNode *left, ExprNode *list, bool string); - + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(IfStmtNode); }; @@ -163,8 +163,8 @@ struct LoopStmtNode : StmtNode U32 loopBlockStartOffset; bool integer; - static LoopStmtNode *alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *initExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop ); - + static LoopStmtNode *alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *initExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(LoopStmtNode); }; @@ -174,22 +174,22 @@ struct IterStmtNode : StmtNode { /// Local variable name to use for the container element. StringTableEntry varName; - + /// Expression evaluating to a SimSet object. ExprNode* containerExpr; - + /// The statement body. StmtNode* body; - + /// If true, this is a 'foreach$'. bool isStringIter; - + /// Bytecode size of body statement. Set by precompileStmt. U32 bodySize; - - static IterStmtNode* alloc( S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter ); - - U32 compileStmt( CodeStream &codeStream, U32 ip ); + + static IterStmtNode* alloc(S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter); + + U32 compileStmt(CodeStream &codeStream, U32 ip); }; /// A binary mathematical expression (ie, left op right). @@ -202,8 +202,8 @@ struct BinaryExprNode : ExprNode struct FloatBinaryExprNode : BinaryExprNode { - static FloatBinaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ); - + static FloatBinaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FloatBinaryExprNode); @@ -215,8 +215,8 @@ struct ConditionalExprNode : ExprNode ExprNode *trueExpr; ExprNode *falseExpr; bool integer; - static ConditionalExprNode *alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr ); - + static ConditionalExprNode *alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr); + virtual U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); virtual TypeReq getPreferredType(); DBG_STMT_TYPE(ConditionalExprNode); @@ -227,10 +227,10 @@ struct IntBinaryExprNode : BinaryExprNode TypeReq subType; U32 operand; - static IntBinaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ); + static IntBinaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right); void getSubTypeOperand(); - + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(IntBinaryExprNode); @@ -239,8 +239,8 @@ struct IntBinaryExprNode : BinaryExprNode struct StreqExprNode : BinaryExprNode { bool eq; - static StreqExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, bool eq ); - + static StreqExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right, bool eq); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(StreqExprNode); @@ -249,8 +249,8 @@ struct StreqExprNode : BinaryExprNode struct StrcatExprNode : BinaryExprNode { S32 appendChar; - static StrcatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar ); - + static StrcatExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(StrcatExprNode); @@ -258,9 +258,9 @@ struct StrcatExprNode : BinaryExprNode struct CommaCatExprNode : BinaryExprNode { - static CommaCatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right ); + static CommaCatExprNode *alloc(S32 lineNumber, ExprNode *left, ExprNode *right); + - U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(CommaCatExprNode); @@ -272,8 +272,8 @@ struct IntUnaryExprNode : ExprNode ExprNode *expr; bool integer; - static IntUnaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *expr ); - + static IntUnaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(IntUnaryExprNode); @@ -284,8 +284,8 @@ struct FloatUnaryExprNode : ExprNode S32 op; ExprNode *expr; - static FloatUnaryExprNode *alloc( S32 lineNumber, S32 op, ExprNode *expr ); - + static FloatUnaryExprNode *alloc(S32 lineNumber, S32 op, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FloatUnaryExprNode); @@ -296,8 +296,8 @@ struct VarNode : ExprNode StringTableEntry varName; ExprNode *arrayIndex; - static VarNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex ); - + static VarNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(VarNode); @@ -308,8 +308,8 @@ struct IntNode : ExprNode S32 value; U32 index; // if it's converted to float/string - static IntNode *alloc( S32 lineNumber, S32 value ); - + static IntNode *alloc(S32 lineNumber, S32 value); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(IntNode); @@ -320,8 +320,8 @@ struct FloatNode : ExprNode F64 value; U32 index; - static FloatNode *alloc( S32 lineNumber, F64 value ); - + static FloatNode *alloc(S32 lineNumber, F64 value); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FloatNode); @@ -335,8 +335,8 @@ struct StrConstNode : ExprNode bool tag; bool doc; // Specifies that this string is a documentation block. - static StrConstNode *alloc( S32 lineNumber, char *str, bool tag, bool doc = false ); - + static StrConstNode *alloc(S32 lineNumber, char *str, bool tag, bool doc = false); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(StrConstNode); @@ -348,8 +348,8 @@ struct ConstantNode : ExprNode F64 fVal; U32 index; - static ConstantNode *alloc( S32 lineNumber, StringTableEntry value ); - + static ConstantNode *alloc(S32 lineNumber, StringTableEntry value); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(ConstantNode); @@ -362,8 +362,8 @@ struct AssignExprNode : ExprNode ExprNode *arrayIndex; TypeReq subType; - static AssignExprNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr ); - + static AssignExprNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(AssignExprNode); @@ -386,8 +386,8 @@ struct AssignOpExprNode : ExprNode U32 operand; TypeReq subType; - static AssignOpExprNode *alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op ); - + static AssignOpExprNode *alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(AssignOpExprNode); @@ -399,8 +399,8 @@ struct TTagSetStmtNode : StmtNode ExprNode *valueExpr; ExprNode *stringExpr; - static TTagSetStmtNode *alloc( S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr ); - + static TTagSetStmtNode *alloc(S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr); + U32 compileStmt(CodeStream &codeStream, U32 ip); DBG_STMT_TYPE(TTagSetStmtNode); }; @@ -409,8 +409,8 @@ struct TTagDerefNode : ExprNode { ExprNode *expr; - static TTagDerefNode *alloc( S32 lineNumber, ExprNode *expr ); - + static TTagDerefNode *alloc(S32 lineNumber, ExprNode *expr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(TTagDerefNode); @@ -420,8 +420,8 @@ struct TTagExprNode : ExprNode { StringTableEntry tag; - static TTagExprNode *alloc( S32 lineNumber, StringTableEntry tag ); - + static TTagExprNode *alloc(S32 lineNumber, StringTableEntry tag); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(TTagExprNode); @@ -439,21 +439,33 @@ struct FuncCallExprNode : ExprNode ParentCall }; - static FuncCallExprNode *alloc( S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot ); - + static FuncCallExprNode *alloc(S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(FuncCallExprNode); }; +struct FuncPointerCallExprNode : ExprNode +{ + ExprNode *funcPointer; + ExprNode *args; + + static FuncPointerCallExprNode *alloc(S32 lineNumber, ExprNode *stmt, ExprNode *args); + + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); + TypeReq getPreferredType(); + DBG_STMT_TYPE(FuncPointerCallExprNode); +}; + struct AssertCallExprNode : ExprNode { ExprNode *testExpr; const char *message; U32 messageIndex; - static AssertCallExprNode *alloc( S32 lineNumber, ExprNode *testExpr, const char *message ); - + static AssertCallExprNode *alloc(S32 lineNumber, ExprNode *testExpr, const char *message); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(AssertCallExprNode); @@ -472,8 +484,8 @@ struct SlotAccessNode : ExprNode ExprNode *objectExpr, *arrayExpr; StringTableEntry slotName; - static SlotAccessNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName ); - + static SlotAccessNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(SlotAccessNode); @@ -492,8 +504,8 @@ struct InternalSlotAccessNode : ExprNode ExprNode *objectExpr, *slotExpr; bool recurse; - static InternalSlotAccessNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse ); - + static InternalSlotAccessNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(InternalSlotAccessNode); @@ -506,8 +518,8 @@ struct SlotAssignNode : ExprNode ExprNode *valueExpr; U32 typeID; - static SlotAssignNode *alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID = -1 ); - + static SlotAssignNode *alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID = -1); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(SlotAssignNode); @@ -522,8 +534,8 @@ struct SlotAssignOpNode : ExprNode U32 operand; TypeReq subType; - static SlotAssignOpNode *alloc( S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr ); - + static SlotAssignOpNode *alloc(S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr); + U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); TypeReq getPreferredType(); DBG_STMT_TYPE(SlotAssignOpNode); @@ -542,8 +554,8 @@ struct ObjectDeclNode : ExprNode bool isClassNameInternal; bool isSingleton; - static ObjectDeclNode *alloc( S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton ); - + static ObjectDeclNode *alloc(S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton); + U32 precompileSubObject(bool); U32 compile(CodeStream &codeStream, U32 ip, TypeReq type); U32 compileSubObject(CodeStream &codeStream, U32 ip, bool); @@ -567,8 +579,8 @@ struct FunctionDeclStmtNode : StmtNode U32 endOffset; U32 argc; - static FunctionDeclStmtNode *alloc( S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts ); - + static FunctionDeclStmtNode *alloc(S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts); + U32 compileStmt(CodeStream &codeStream, U32 ip); void setPackage(StringTableEntry packageName); DBG_STMT_TYPE(FunctionDeclStmtNode); diff --git a/Engine/source/console/astAlloc.cpp b/Engine/source/console/astAlloc.cpp index fb69f49d5..75fbe151c 100644 --- a/Engine/source/console/astAlloc.cpp +++ b/Engine/source/console/astAlloc.cpp @@ -38,25 +38,25 @@ using namespace Compiler; //------------------------------------------------------------ -BreakStmtNode *BreakStmtNode::alloc( S32 lineNumber ) +BreakStmtNode *BreakStmtNode::alloc(S32 lineNumber) { - BreakStmtNode *ret = (BreakStmtNode *) consoleAlloc(sizeof(BreakStmtNode)); + BreakStmtNode *ret = (BreakStmtNode *)consoleAlloc(sizeof(BreakStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; return ret; } -ContinueStmtNode *ContinueStmtNode::alloc( S32 lineNumber ) +ContinueStmtNode *ContinueStmtNode::alloc(S32 lineNumber) { - ContinueStmtNode *ret = (ContinueStmtNode *) consoleAlloc(sizeof(ContinueStmtNode)); + ContinueStmtNode *ret = (ContinueStmtNode *)consoleAlloc(sizeof(ContinueStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; return ret; } -ReturnStmtNode *ReturnStmtNode::alloc( S32 lineNumber, ExprNode *expr) +ReturnStmtNode *ReturnStmtNode::alloc(S32 lineNumber, ExprNode *expr) { - ReturnStmtNode *ret = (ReturnStmtNode *) consoleAlloc(sizeof(ReturnStmtNode)); + ReturnStmtNode *ret = (ReturnStmtNode *)consoleAlloc(sizeof(ReturnStmtNode)); constructInPlace(ret); ret->expr = expr; ret->dbgLineNumber = lineNumber; @@ -64,9 +64,9 @@ ReturnStmtNode *ReturnStmtNode::alloc( S32 lineNumber, ExprNode *expr) return ret; } -IfStmtNode *IfStmtNode::alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagate ) +IfStmtNode *IfStmtNode::alloc(S32 lineNumber, ExprNode *testExpr, StmtNode *ifBlock, StmtNode *elseBlock, bool propagate) { - IfStmtNode *ret = (IfStmtNode *) consoleAlloc(sizeof(IfStmtNode)); + IfStmtNode *ret = (IfStmtNode *)consoleAlloc(sizeof(IfStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; @@ -78,9 +78,9 @@ IfStmtNode *IfStmtNode::alloc( S32 lineNumber, ExprNode *testExpr, StmtNode *ifB return ret; } -LoopStmtNode *LoopStmtNode::alloc( S32 lineNumber, ExprNode *initExpr, ExprNode *testExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop ) +LoopStmtNode *LoopStmtNode::alloc(S32 lineNumber, ExprNode *initExpr, ExprNode *testExpr, ExprNode *endLoopExpr, StmtNode *loopBlock, bool isDoLoop) { - LoopStmtNode *ret = (LoopStmtNode *) consoleAlloc(sizeof(LoopStmtNode)); + LoopStmtNode *ret = (LoopStmtNode *)consoleAlloc(sizeof(LoopStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->testExpr = testExpr; @@ -92,28 +92,28 @@ LoopStmtNode *LoopStmtNode::alloc( S32 lineNumber, ExprNode *initExpr, ExprNode // Deal with setting some dummy constant nodes if we weren't provided with // info... This allows us to play nice with missing parts of for(;;) for // instance. - if(!ret->testExpr) ret->testExpr = IntNode::alloc( lineNumber, 1 ); + if (!ret->testExpr) ret->testExpr = IntNode::alloc(lineNumber, 1); return ret; } -IterStmtNode* IterStmtNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter ) +IterStmtNode* IterStmtNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode* containerExpr, StmtNode* body, bool isStringIter) { - IterStmtNode* ret = ( IterStmtNode* ) consoleAlloc( sizeof( IterStmtNode ) ); - constructInPlace( ret ); - + IterStmtNode* ret = (IterStmtNode*)consoleAlloc(sizeof(IterStmtNode)); + constructInPlace(ret); + ret->dbgLineNumber = lineNumber; ret->varName = varName; ret->containerExpr = containerExpr; ret->body = body; ret->isStringIter = isStringIter; - + return ret; } -FloatBinaryExprNode *FloatBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ) +FloatBinaryExprNode *FloatBinaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right) { - FloatBinaryExprNode *ret = (FloatBinaryExprNode *) consoleAlloc(sizeof(FloatBinaryExprNode)); + FloatBinaryExprNode *ret = (FloatBinaryExprNode *)consoleAlloc(sizeof(FloatBinaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; @@ -124,9 +124,9 @@ FloatBinaryExprNode *FloatBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNod return ret; } -IntBinaryExprNode *IntBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *left, ExprNode *right ) +IntBinaryExprNode *IntBinaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *left, ExprNode *right) { - IntBinaryExprNode *ret = (IntBinaryExprNode *) consoleAlloc(sizeof(IntBinaryExprNode)); + IntBinaryExprNode *ret = (IntBinaryExprNode *)consoleAlloc(sizeof(IntBinaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; @@ -137,9 +137,9 @@ IntBinaryExprNode *IntBinaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *l return ret; } -StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, bool eq ) +StreqExprNode *StreqExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right, bool eq) { - StreqExprNode *ret = (StreqExprNode *) consoleAlloc(sizeof(StreqExprNode)); + StreqExprNode *ret = (StreqExprNode *)consoleAlloc(sizeof(StreqExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->left = left; @@ -149,9 +149,9 @@ StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *r return ret; } -StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar ) +StrcatExprNode *StrcatExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar) { - StrcatExprNode *ret = (StrcatExprNode *) consoleAlloc(sizeof(StrcatExprNode)); + StrcatExprNode *ret = (StrcatExprNode *)consoleAlloc(sizeof(StrcatExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->left = left; @@ -161,9 +161,9 @@ StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode return ret; } -CommaCatExprNode *CommaCatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right ) +CommaCatExprNode *CommaCatExprNode::alloc(S32 lineNumber, ExprNode *left, ExprNode *right) { - CommaCatExprNode *ret = (CommaCatExprNode *) consoleAlloc(sizeof(CommaCatExprNode)); + CommaCatExprNode *ret = (CommaCatExprNode *)consoleAlloc(sizeof(CommaCatExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->left = left; @@ -172,9 +172,9 @@ CommaCatExprNode *CommaCatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprN return ret; } -IntUnaryExprNode *IntUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *expr ) +IntUnaryExprNode *IntUnaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *expr) { - IntUnaryExprNode *ret = (IntUnaryExprNode *) consoleAlloc(sizeof(IntUnaryExprNode)); + IntUnaryExprNode *ret = (IntUnaryExprNode *)consoleAlloc(sizeof(IntUnaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->op = op; @@ -182,9 +182,9 @@ IntUnaryExprNode *IntUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *exp return ret; } -FloatUnaryExprNode *FloatUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode *expr ) +FloatUnaryExprNode *FloatUnaryExprNode::alloc(S32 lineNumber, S32 op, ExprNode *expr) { - FloatUnaryExprNode *ret = (FloatUnaryExprNode *) consoleAlloc(sizeof(FloatUnaryExprNode)); + FloatUnaryExprNode *ret = (FloatUnaryExprNode *)consoleAlloc(sizeof(FloatUnaryExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->op = op; @@ -192,9 +192,9 @@ FloatUnaryExprNode *FloatUnaryExprNode::alloc( S32 lineNumber, S32 op, ExprNode return ret; } -VarNode *VarNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex ) +VarNode *VarNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex) { - VarNode *ret = (VarNode *) consoleAlloc(sizeof(VarNode)); + VarNode *ret = (VarNode *)consoleAlloc(sizeof(VarNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->varName = varName; @@ -202,18 +202,18 @@ VarNode *VarNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arr return ret; } -IntNode *IntNode::alloc( S32 lineNumber, S32 value ) +IntNode *IntNode::alloc(S32 lineNumber, S32 value) { - IntNode *ret = (IntNode *) consoleAlloc(sizeof(IntNode)); + IntNode *ret = (IntNode *)consoleAlloc(sizeof(IntNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->value = value; return ret; } -ConditionalExprNode *ConditionalExprNode::alloc( S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr ) +ConditionalExprNode *ConditionalExprNode::alloc(S32 lineNumber, ExprNode *testExpr, ExprNode *trueExpr, ExprNode *falseExpr) { - ConditionalExprNode *ret = (ConditionalExprNode *) consoleAlloc(sizeof(ConditionalExprNode)); + ConditionalExprNode *ret = (ConditionalExprNode *)consoleAlloc(sizeof(ConditionalExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->testExpr = testExpr; @@ -223,22 +223,22 @@ ConditionalExprNode *ConditionalExprNode::alloc( S32 lineNumber, ExprNode *testE return ret; } -FloatNode *FloatNode::alloc( S32 lineNumber, F64 value ) +FloatNode *FloatNode::alloc(S32 lineNumber, F64 value) { - FloatNode *ret = (FloatNode *) consoleAlloc(sizeof(FloatNode)); + FloatNode *ret = (FloatNode *)consoleAlloc(sizeof(FloatNode)); constructInPlace(ret); - + ret->dbgLineNumber = lineNumber; ret->value = value; return ret; } -StrConstNode *StrConstNode::alloc( S32 lineNumber, char *str, bool tag, bool doc ) +StrConstNode *StrConstNode::alloc(S32 lineNumber, char *str, bool tag, bool doc) { - StrConstNode *ret = (StrConstNode *) consoleAlloc(sizeof(StrConstNode)); + StrConstNode *ret = (StrConstNode *)consoleAlloc(sizeof(StrConstNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; - ret->str = (char *) consoleAlloc(dStrlen(str) + 1); + ret->str = (char *)consoleAlloc(dStrlen(str) + 1); ret->tag = tag; ret->doc = doc; dStrcpy(ret->str, str); @@ -246,18 +246,18 @@ StrConstNode *StrConstNode::alloc( S32 lineNumber, char *str, bool tag, bool doc return ret; } -ConstantNode *ConstantNode::alloc( S32 lineNumber, StringTableEntry value ) +ConstantNode *ConstantNode::alloc(S32 lineNumber, StringTableEntry value) { - ConstantNode *ret = (ConstantNode *) consoleAlloc(sizeof(ConstantNode)); + ConstantNode *ret = (ConstantNode *)consoleAlloc(sizeof(ConstantNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->value = value; return ret; } -AssignExprNode *AssignExprNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr ) +AssignExprNode *AssignExprNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr) { - AssignExprNode *ret = (AssignExprNode *) consoleAlloc(sizeof(AssignExprNode)); + AssignExprNode *ret = (AssignExprNode *)consoleAlloc(sizeof(AssignExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->varName = varName; @@ -267,9 +267,9 @@ AssignExprNode *AssignExprNode::alloc( S32 lineNumber, StringTableEntry varName, return ret; } -AssignOpExprNode *AssignOpExprNode::alloc( S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op ) +AssignOpExprNode *AssignOpExprNode::alloc(S32 lineNumber, StringTableEntry varName, ExprNode *arrayIndex, ExprNode *expr, S32 op) { - AssignOpExprNode *ret = (AssignOpExprNode *) consoleAlloc(sizeof(AssignOpExprNode)); + AssignOpExprNode *ret = (AssignOpExprNode *)consoleAlloc(sizeof(AssignOpExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->varName = varName; @@ -279,9 +279,9 @@ AssignOpExprNode *AssignOpExprNode::alloc( S32 lineNumber, StringTableEntry varN return ret; } -TTagSetStmtNode *TTagSetStmtNode::alloc( S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr ) +TTagSetStmtNode *TTagSetStmtNode::alloc(S32 lineNumber, StringTableEntry tag, ExprNode *valueExpr, ExprNode *stringExpr) { - TTagSetStmtNode *ret = (TTagSetStmtNode *) consoleAlloc(sizeof(TTagSetStmtNode)); + TTagSetStmtNode *ret = (TTagSetStmtNode *)consoleAlloc(sizeof(TTagSetStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->tag = tag; @@ -290,37 +290,37 @@ TTagSetStmtNode *TTagSetStmtNode::alloc( S32 lineNumber, StringTableEntry tag, E return ret; } -TTagDerefNode *TTagDerefNode::alloc( S32 lineNumber, ExprNode *expr ) +TTagDerefNode *TTagDerefNode::alloc(S32 lineNumber, ExprNode *expr) { - TTagDerefNode *ret = (TTagDerefNode *) consoleAlloc(sizeof(TTagDerefNode)); + TTagDerefNode *ret = (TTagDerefNode *)consoleAlloc(sizeof(TTagDerefNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->expr = expr; return ret; } -TTagExprNode *TTagExprNode::alloc( S32 lineNumber, StringTableEntry tag ) +TTagExprNode *TTagExprNode::alloc(S32 lineNumber, StringTableEntry tag) { - TTagExprNode *ret = (TTagExprNode *) consoleAlloc(sizeof(TTagExprNode)); + TTagExprNode *ret = (TTagExprNode *)consoleAlloc(sizeof(TTagExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->tag = tag; return ret; } -FuncCallExprNode *FuncCallExprNode::alloc( S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot ) +FuncCallExprNode *FuncCallExprNode::alloc(S32 lineNumber, StringTableEntry funcName, StringTableEntry nameSpace, ExprNode *args, bool dot) { - FuncCallExprNode *ret = (FuncCallExprNode *) consoleAlloc(sizeof(FuncCallExprNode)); + FuncCallExprNode *ret = (FuncCallExprNode *)consoleAlloc(sizeof(FuncCallExprNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->funcName = funcName; ret->nameSpace = nameSpace; ret->args = args; - if(dot) + if (dot) ret->callType = MethodCall; else { - if(nameSpace && !dStricmp(nameSpace, "Parent")) + if (nameSpace && !dStricmp(nameSpace, "Parent")) ret->callType = ParentCall; else ret->callType = FunctionCall; @@ -328,27 +328,37 @@ FuncCallExprNode *FuncCallExprNode::alloc( S32 lineNumber, StringTableEntry func return ret; } -AssertCallExprNode *AssertCallExprNode::alloc( S32 lineNumber, ExprNode *testExpr, const char *message ) +FuncPointerCallExprNode *FuncPointerCallExprNode::alloc(S32 lineNumber, ExprNode *funcPointer, ExprNode *args) { - #ifdef TORQUE_ENABLE_SCRIPTASSERTS - - AssertCallExprNode *ret = (AssertCallExprNode *) consoleAlloc(sizeof(FuncCallExprNode)); - constructInPlace(ret); - ret->dbgLineNumber = lineNumber; - ret->testExpr = testExpr; - ret->message = message ? message : "TorqueScript assert!"; - return ret; - - #else - - return NULL; - - #endif + FuncPointerCallExprNode *ret = (FuncPointerCallExprNode *)consoleAlloc(sizeof(FuncPointerCallExprNode)); + constructInPlace(ret); + ret->dbgLineNumber = lineNumber; + ret->funcPointer = funcPointer; + ret->args = args; + return ret; } -SlotAccessNode *SlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName ) +AssertCallExprNode *AssertCallExprNode::alloc(S32 lineNumber, ExprNode *testExpr, const char *message) { - SlotAccessNode *ret = (SlotAccessNode *) consoleAlloc(sizeof(SlotAccessNode)); +#ifdef TORQUE_ENABLE_SCRIPTASSERTS + + AssertCallExprNode *ret = (AssertCallExprNode *)consoleAlloc(sizeof(FuncCallExprNode)); + constructInPlace(ret); + ret->dbgLineNumber = lineNumber; + ret->testExpr = testExpr; + ret->message = message ? message : "TorqueScript assert!"; + return ret; + +#else + + return NULL; + +#endif +} + +SlotAccessNode *SlotAccessNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName) +{ + SlotAccessNode *ret = (SlotAccessNode *)consoleAlloc(sizeof(SlotAccessNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -357,9 +367,9 @@ SlotAccessNode *SlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, Exp return ret; } -InternalSlotAccessNode *InternalSlotAccessNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse ) +InternalSlotAccessNode *InternalSlotAccessNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *slotExpr, bool recurse) { - InternalSlotAccessNode *ret = (InternalSlotAccessNode *) consoleAlloc(sizeof(InternalSlotAccessNode)); + InternalSlotAccessNode *ret = (InternalSlotAccessNode *)consoleAlloc(sizeof(InternalSlotAccessNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -368,9 +378,9 @@ InternalSlotAccessNode *InternalSlotAccessNode::alloc( S32 lineNumber, ExprNode return ret; } -SlotAssignNode *SlotAssignNode::alloc( S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID /* = -1 */ ) +SlotAssignNode *SlotAssignNode::alloc(S32 lineNumber, ExprNode *objectExpr, ExprNode *arrayExpr, StringTableEntry slotName, ExprNode *valueExpr, U32 typeID /* = -1 */) { - SlotAssignNode *ret = (SlotAssignNode *) consoleAlloc(sizeof(SlotAssignNode)); + SlotAssignNode *ret = (SlotAssignNode *)consoleAlloc(sizeof(SlotAssignNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -381,9 +391,9 @@ SlotAssignNode *SlotAssignNode::alloc( S32 lineNumber, ExprNode *objectExpr, Exp return ret; } -SlotAssignOpNode *SlotAssignOpNode::alloc( S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr ) +SlotAssignOpNode *SlotAssignOpNode::alloc(S32 lineNumber, ExprNode *objectExpr, StringTableEntry slotName, ExprNode *arrayExpr, S32 op, ExprNode *valueExpr) { - SlotAssignOpNode *ret = (SlotAssignOpNode *) consoleAlloc(sizeof(SlotAssignOpNode)); + SlotAssignOpNode *ret = (SlotAssignOpNode *)consoleAlloc(sizeof(SlotAssignOpNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->objectExpr = objectExpr; @@ -394,9 +404,9 @@ SlotAssignOpNode *SlotAssignOpNode::alloc( S32 lineNumber, ExprNode *objectExpr, return ret; } -ObjectDeclNode *ObjectDeclNode::alloc( S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton ) +ObjectDeclNode *ObjectDeclNode::alloc(S32 lineNumber, ExprNode *classNameExpr, ExprNode *objectNameExpr, ExprNode *argList, StringTableEntry parentObject, SlotAssignNode *slotDecls, ObjectDeclNode *subObjects, bool isDatablock, bool classNameInternal, bool isSingleton) { - ObjectDeclNode *ret = (ObjectDeclNode *) consoleAlloc(sizeof(ObjectDeclNode)); + ObjectDeclNode *ret = (ObjectDeclNode *)consoleAlloc(sizeof(ObjectDeclNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->classNameExpr = classNameExpr; @@ -408,16 +418,16 @@ ObjectDeclNode *ObjectDeclNode::alloc( S32 lineNumber, ExprNode *classNameExpr, ret->isClassNameInternal = classNameInternal; ret->isSingleton = isSingleton; ret->failOffset = 0; - if(parentObject) + if (parentObject) ret->parentObject = parentObject; else ret->parentObject = StringTable->EmptyString(); return ret; } -FunctionDeclStmtNode *FunctionDeclStmtNode::alloc( S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts ) +FunctionDeclStmtNode *FunctionDeclStmtNode::alloc(S32 lineNumber, StringTableEntry fnName, StringTableEntry nameSpace, VarNode *args, StmtNode *stmts) { - FunctionDeclStmtNode *ret = (FunctionDeclStmtNode *) consoleAlloc(sizeof(FunctionDeclStmtNode)); + FunctionDeclStmtNode *ret = (FunctionDeclStmtNode *)consoleAlloc(sizeof(FunctionDeclStmtNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; ret->fnName = fnName; diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index 3fc8c04c9..53e666176 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -42,15 +42,89 @@ struct Token }; #include "console/cmdgram.h" - namespace Compiler { U32 compileBlock(StmtNode *block, CodeStream &codeStream, U32 ip) { - for(StmtNode *walk = block; walk; walk = walk->getNext()) + for (StmtNode *walk = block; walk; walk = walk->getNext()) ip = walk->compileStmt(codeStream, ip); return codeStream.tell(); } + + inline bool isSimpleVarLookup(ExprNode *arrayExpr, StringTableEntry &varName) + { + if (arrayExpr == nullptr) + { + varName = StringTable->insert(""); + return false; + } + + // No double arrays allowed for optimization. + VarNode *var = dynamic_cast(arrayExpr); + if (var && !var->arrayIndex) + { + StringTableEntry arrayVar = StringTable->insert(var->varName); + precompileIdent(arrayVar); + varName = arrayVar; + return true; + } + return false; + } + + // Do not allow 'recursive' %this optimizations. It can lead to weird bytecode + // generation since we can only optimize one expression at a time. + static bool OnlyOneThisOptimization = false; + + inline bool isThisVar(ExprNode *objectExpr) + { + // If we are currently optimizing a this var, don't allow extra optimization. + if (objectExpr == nullptr || OnlyOneThisOptimization) + return false; + + VarNode *thisVar = dynamic_cast(objectExpr); + if (thisVar && thisVar->varName == StringTable->insert("%this")) + return true; + return false; + } + + inline void optimizeThisPointer(CodeStream &codeStream, ExprNode *arrayExpr, U32 &ip, StringTableEntry slotName) + { + OnlyOneThisOptimization = true; + + // Is the array a simple variable? If so, we can optimize that. + StringTableEntry varName = nullptr; + bool simple = false; + + if (arrayExpr) + { + simple = isSimpleVarLookup(arrayExpr, varName); + if (!simple) + { + // Less optimized array setting. + codeStream.emit(OP_ADVANCE_STR); + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + } + } + + codeStream.emit(OP_SETCURFIELD_THIS); + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + if (simple) + { + codeStream.emit(OP_SETCURFIELD_ARRAY_VAR); + codeStream.emitSTE(varName); + } + else + { + codeStream.emit(OP_SETCURFIELD_ARRAY); + codeStream.emit(OP_TERMINATE_REWIND_STR); + } + } + + OnlyOneThisOptimization = false; + } } using namespace Compiler; @@ -77,7 +151,7 @@ void StmtNode::setPackage(StringTableEntry) void StmtNode::append(StmtNode *next) { StmtNode *walk = this; - while(walk->next) + while (walk->next) walk = walk->next; walk->next = next; } @@ -96,68 +170,68 @@ void FunctionDeclStmtNode::setPackage(StringTableEntry packageName) static U32 conversionOp(TypeReq src, TypeReq dst) { - if(src == TypeReqString) + if (src == TypeReqString) { - switch(dst) + switch (dst) { - case TypeReqUInt: - return OP_STR_TO_UINT; - case TypeReqFloat: - return OP_STR_TO_FLT; - case TypeReqNone: - return OP_STR_TO_NONE; - case TypeReqVar: - return OP_SAVEVAR_STR; - default: - break; + case TypeReqUInt: + return OP_STR_TO_UINT; + case TypeReqFloat: + return OP_STR_TO_FLT; + case TypeReqNone: + return OP_STR_TO_NONE; + case TypeReqVar: + return OP_SAVEVAR_STR; + default: + break; } } - else if(src == TypeReqFloat) + else if (src == TypeReqFloat) { - switch(dst) + switch (dst) { - case TypeReqUInt: - return OP_FLT_TO_UINT; - case TypeReqString: - return OP_FLT_TO_STR; - case TypeReqNone: - return OP_FLT_TO_NONE; - case TypeReqVar: - return OP_SAVEVAR_FLT; - default: - break; + case TypeReqUInt: + return OP_FLT_TO_UINT; + case TypeReqString: + return OP_FLT_TO_STR; + case TypeReqNone: + return OP_FLT_TO_NONE; + case TypeReqVar: + return OP_SAVEVAR_FLT; + default: + break; } } - else if(src == TypeReqUInt) + else if (src == TypeReqUInt) { - switch(dst) + switch (dst) { - case TypeReqFloat: - return OP_UINT_TO_FLT; - case TypeReqString: - return OP_UINT_TO_STR; - case TypeReqNone: - return OP_UINT_TO_NONE; - case TypeReqVar: - return OP_SAVEVAR_UINT; - default: - break; + case TypeReqFloat: + return OP_UINT_TO_FLT; + case TypeReqString: + return OP_UINT_TO_STR; + case TypeReqNone: + return OP_UINT_TO_NONE; + case TypeReqVar: + return OP_SAVEVAR_UINT; + default: + break; } } - else if(src == TypeReqVar) + else if (src == TypeReqVar) { - switch(dst) + switch (dst) { - case TypeReqUInt: - return OP_LOADVAR_UINT; - case TypeReqFloat: - return OP_LOADVAR_FLT; - case TypeReqString: - return OP_LOADVAR_STR; - case TypeReqNone: - return OP_COPYVAR_TO_NONE; - default: - break; + case TypeReqUInt: + return OP_LOADVAR_UINT; + case TypeReqFloat: + return OP_LOADVAR_FLT; + case TypeReqString: + return OP_LOADVAR_STR; + case TypeReqNone: + return OP_COPYVAR_TO_NONE; + default: + break; } } return OP_INVALID; @@ -167,7 +241,7 @@ static U32 conversionOp(TypeReq src, TypeReq dst) U32 BreakStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { - if(codeStream.inLoop()) + if (codeStream.inLoop()) { addBreakLine(codeStream); codeStream.emit(OP_JMP); @@ -184,7 +258,7 @@ U32 BreakStmtNode::compileStmt(CodeStream &codeStream, U32 ip) U32 ContinueStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { - if(codeStream.inLoop()) + if (codeStream.inLoop()) { addBreakLine(codeStream); codeStream.emit(OP_JMP); @@ -210,7 +284,7 @@ U32 ExprNode::compileStmt(CodeStream &codeStream, U32 ip) U32 ReturnStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { addBreakLine(codeStream); - if(!expr) + if (!expr) codeStream.emit(OP_RETURN_VOID); else { @@ -220,15 +294,15 @@ U32 ReturnStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // Return the correct type switch (walkType) { - case TypeReqUInt: - codeStream.emit(OP_RETURN_UINT); - break; - case TypeReqFloat: - codeStream.emit(OP_RETURN_FLT); - break; - default: - codeStream.emit(OP_RETURN); - break; + case TypeReqUInt: + codeStream.emit(OP_RETURN_UINT); + break; + case TypeReqFloat: + codeStream.emit(OP_RETURN_FLT); + break; + default: + codeStream.emit(OP_RETURN); + break; } } return codeStream.tell(); @@ -238,30 +312,30 @@ U32 ReturnStmtNode::compileStmt(CodeStream &codeStream, U32 ip) ExprNode *IfStmtNode::getSwitchOR(ExprNode *left, ExprNode *list, bool string) { - ExprNode *nextExpr = (ExprNode *) list->getNext(); + ExprNode *nextExpr = (ExprNode *)list->getNext(); ExprNode *test; - if(string) - test = StreqExprNode::alloc( left->dbgLineNumber, left, list, true ); + if (string) + test = StreqExprNode::alloc(left->dbgLineNumber, left, list, true); else - test = IntBinaryExprNode::alloc( left->dbgLineNumber, opEQ, left, list ); - if(!nextExpr) + test = IntBinaryExprNode::alloc(left->dbgLineNumber, opEQ, left, list); + if (!nextExpr) return test; - return IntBinaryExprNode::alloc( test->dbgLineNumber, opOR, test, getSwitchOR( left, nextExpr, string ) ); + return IntBinaryExprNode::alloc(test->dbgLineNumber, opOR, test, getSwitchOR(left, nextExpr, string)); } void IfStmtNode::propagateSwitchExpr(ExprNode *left, bool string) { testExpr = getSwitchOR(left, testExpr, string); - if(propagate && elseBlock) - ((IfStmtNode *) elseBlock)->propagateSwitchExpr(left, string); + if (propagate && elseBlock) + ((IfStmtNode *)elseBlock)->propagateSwitchExpr(left, string); } U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { U32 endifIp, elseIp; addBreakLine(codeStream); - - if(testExpr->getPreferredType() == TypeReqUInt) + + if (testExpr->getPreferredType() == TypeReqUInt) { integer = true; } @@ -273,14 +347,14 @@ U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT); - if(elseBlock) + if (elseBlock) { elseIp = codeStream.emit(0); elseOffset = compileBlock(ifBlock, codeStream, ip) + 2; codeStream.emit(OP_JMP); endifIp = codeStream.emit(0); endifOffset = compileBlock(elseBlock, codeStream, ip); - + codeStream.patch(endifIp, endifOffset); codeStream.patch(elseIp, elseOffset); } @@ -288,10 +362,10 @@ U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { endifIp = codeStream.emit(0); endifOffset = compileBlock(ifBlock, codeStream, ip); - + codeStream.patch(endifIp, endifOffset); } - + // Resolve fixes return codeStream.tell(); } @@ -300,7 +374,7 @@ U32 IfStmtNode::compileStmt(CodeStream &codeStream, U32 ip) U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { - if(testExpr->getPreferredType() == TypeReqUInt) + if (testExpr->getPreferredType() == TypeReqUInt) { integer = true; } @@ -308,7 +382,7 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { integer = false; } - + // if it's a for loop or a while loop it goes: // initExpr // testExpr @@ -320,7 +394,7 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // testExpr // OP_JMPIF loopStartPoint // breakPoint: - + // otherwise if it's a do ... while() it goes: // initExpr // loopStartPoint: @@ -330,19 +404,19 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // testExpr // OP_JMPIF loopStartPoint // breakPoint: - + // loopBlockStart == start of loop block // continue == skip to end // break == exit loop - - + + addBreakLine(codeStream); codeStream.pushFixScope(true); - - if(initExpr) + + if (initExpr) ip = initExpr->compile(codeStream, ip, TypeReqNone); - if(!isDoLoop) + if (!isDoLoop) { ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT); @@ -353,25 +427,25 @@ U32 LoopStmtNode::compileStmt(CodeStream &codeStream, U32 ip) loopBlockStartOffset = codeStream.tell(); continueOffset = compileBlock(loopBlock, codeStream, ip); - if(endLoopExpr) + if (endLoopExpr) ip = endLoopExpr->compile(codeStream, ip, TypeReqNone); ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIF : OP_JMPIFF); codeStream.emitFix(CodeStream::FIXTYPE_LOOPBLOCKSTART); - + breakOffset = codeStream.tell(); // exit loop - + codeStream.fixLoop(loopBlockStartOffset, breakOffset, continueOffset); codeStream.popFixScope(); - + return codeStream.tell(); } //------------------------------------------------------------ -U32 IterStmtNode::compileStmt( CodeStream &codeStream, U32 ip ) +U32 IterStmtNode::compileStmt(CodeStream &codeStream, U32 ip) { // Instruction sequence: // @@ -384,33 +458,33 @@ U32 IterStmtNode::compileStmt( CodeStream &codeStream, U32 ip ) // .break: // OP_ITER_END // .fail: - + addBreakLine(codeStream); - + codeStream.pushFixScope(true); - + const U32 startIp = ip; - containerExpr->compile( codeStream, startIp, TypeReqString ); - + containerExpr->compile(codeStream, startIp, TypeReqString); + codeStream.emit(isStringIter ? OP_ITER_BEGIN_STR : OP_ITER_BEGIN); - codeStream.emitSTE( varName ); + codeStream.emitSTE(varName); const U32 finalFix = codeStream.emit(0); const U32 continueIp = codeStream.emit(OP_ITER); codeStream.emitFix(CodeStream::FIXTYPE_BREAK); const U32 bodyIp = codeStream.tell(); - - const U32 jmpIp = compileBlock( body, codeStream, bodyIp); + + const U32 jmpIp = compileBlock(body, codeStream, bodyIp); const U32 breakIp = jmpIp + 2; const U32 finalIp = breakIp + 1; - + codeStream.emit(OP_JMP); codeStream.emitFix(CodeStream::FIXTYPE_CONTINUE); codeStream.emit(OP_ITER_END); - + codeStream.patch(finalFix, finalIp); codeStream.fixLoop(bodyIp, breakIp, continueIp); codeStream.popFixScope(); - + return codeStream.tell(); } @@ -423,7 +497,7 @@ U32 ConditionalExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // trueExpr // JMP end // falseExpr - if(testExpr->getPreferredType() == TypeReqUInt) + if (testExpr->getPreferredType() == TypeReqUInt) { integer = true; } @@ -431,10 +505,10 @@ U32 ConditionalExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { integer = false; } - + ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT); - + U32 jumpElseIp = codeStream.emit(0); ip = trueExpr->compile(codeStream, ip, type); codeStream.emit(OP_JMP); @@ -442,7 +516,7 @@ U32 ConditionalExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) codeStream.patch(jumpElseIp, codeStream.tell()); ip = falseExpr->compile(codeStream, ip, type); codeStream.patch(jumpEndIp, codeStream.tell()); - + return codeStream.tell(); } @@ -458,23 +532,23 @@ U32 FloatBinaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) ip = right->compile(codeStream, ip, TypeReqFloat); ip = left->compile(codeStream, ip, TypeReqFloat); U32 operand = OP_INVALID; - switch(op) + switch (op) { - case '+': - operand = OP_ADD; - break; - case '-': - operand = OP_SUB; - break; - case '/': - operand = OP_DIV; - break; - case '*': - operand = OP_MUL; - break; + case '+': + operand = OP_ADD; + break; + case '-': + operand = OP_SUB; + break; + case '/': + operand = OP_DIV; + break; + case '*': + operand = OP_MUL; + break; } codeStream.emit(operand); - if(type != TypeReqFloat) + if (type != TypeReqFloat) codeStream.emit(conversionOp(TypeReqFloat, type)); return codeStream.tell(); } @@ -489,64 +563,64 @@ TypeReq FloatBinaryExprNode::getPreferredType() void IntBinaryExprNode::getSubTypeOperand() { subType = TypeReqUInt; - switch(op) + switch (op) { - case '^': - operand = OP_XOR; - break; - case '%': - operand = OP_MOD; - break; - case '&': - operand = OP_BITAND; - break; - case '|': - operand = OP_BITOR; - break; - case '<': - operand = OP_CMPLT; - subType = TypeReqFloat; - break; - case '>': - operand = OP_CMPGR; - subType = TypeReqFloat; - break; - case opGE: - operand = OP_CMPGE; - subType = TypeReqFloat; - break; - case opLE: - operand = OP_CMPLE; - subType = TypeReqFloat; - break; - case opEQ: - operand = OP_CMPEQ; - subType = TypeReqFloat; - break; - case opNE: - operand = OP_CMPNE; - subType = TypeReqFloat; - break; - case opOR: - operand = OP_OR; - break; - case opAND: - operand = OP_AND; - break; - case opSHR: - operand = OP_SHR; - break; - case opSHL: - operand = OP_SHL; - break; + case '^': + operand = OP_XOR; + break; + case '%': + operand = OP_MOD; + break; + case '&': + operand = OP_BITAND; + break; + case '|': + operand = OP_BITOR; + break; + case '<': + operand = OP_CMPLT; + subType = TypeReqFloat; + break; + case '>': + operand = OP_CMPGR; + subType = TypeReqFloat; + break; + case opGE: + operand = OP_CMPGE; + subType = TypeReqFloat; + break; + case opLE: + operand = OP_CMPLE; + subType = TypeReqFloat; + break; + case opEQ: + operand = OP_CMPEQ; + subType = TypeReqFloat; + break; + case opNE: + operand = OP_CMPNE; + subType = TypeReqFloat; + break; + case opOR: + operand = OP_OR; + break; + case opAND: + operand = OP_AND; + break; + case opSHR: + operand = OP_SHR; + break; + case opSHL: + operand = OP_SHL; + break; } } U32 IntBinaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { getSubTypeOperand(); - - if(operand == OP_OR || operand == OP_AND) + + if (operand == OP_OR || operand == OP_AND) { ip = left->compile(codeStream, ip, subType); codeStream.emit(operand == OP_OR ? OP_JMPIF_NP : OP_JMPIFNOT_NP); @@ -560,7 +634,7 @@ U32 IntBinaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) ip = left->compile(codeStream, ip, subType); codeStream.emit(operand); } - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -579,14 +653,14 @@ U32 StreqExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // eval str right // OP_COMPARE_STR // optional conversion - + ip = left->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_ADVANCE_STR_NUL); ip = right->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_COMPARE_STR); - if(!eq) + if (!eq) codeStream.emit(OP_NOT); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -601,7 +675,7 @@ TypeReq StreqExprNode::getPreferredType() U32 StrcatExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { ip = left->compile(codeStream, ip, TypeReqString); - if(!appendChar) + if (!appendChar) codeStream.emit(OP_ADVANCE_STR); else { @@ -610,9 +684,9 @@ U32 StrcatExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) } ip = right->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_REWIND_STR); - if(type == TypeReqUInt) + if (type == TypeReqUInt) codeStream.emit(OP_STR_TO_UINT); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) codeStream.emit(OP_STR_TO_FLT); return codeStream.tell(); } @@ -634,11 +708,11 @@ U32 CommaCatExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // At this point the stack has the concatenated string. // But we're paranoid, so accept (but whine) if we get an oddity... - if(type == TypeReqUInt || type == TypeReqFloat) + if (type == TypeReqUInt || type == TypeReqFloat) Con::warnf(ConsoleLogEntry::General, "%s (%d): converting comma string to a number... probably wrong.", dbgFileName, dbgLineNumber); - if(type == TypeReqUInt) + if (type == TypeReqUInt) codeStream.emit(OP_STR_TO_UINT); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) codeStream.emit(OP_STR_TO_FLT); return codeStream.tell(); } @@ -654,15 +728,15 @@ U32 IntUnaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { integer = true; TypeReq prefType = expr->getPreferredType(); - if(op == '!' && (prefType == TypeReqFloat || prefType == TypeReqString)) + if (op == '!' && (prefType == TypeReqFloat || prefType == TypeReqString)) integer = false; - + ip = expr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat); - if(op == '!') + if (op == '!') codeStream.emit(integer ? OP_NOT : OP_NOTF); - else if(op == '~') + else if (op == '~') codeStream.emit(OP_ONESCOMPLEMENT); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -678,7 +752,7 @@ U32 FloatUnaryExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { ip = expr->compile(codeStream, ip, TypeReqFloat); codeStream.emit(OP_NEG); - if(type != TypeReqFloat) + if (type != TypeReqFloat) codeStream.emit(conversionOp(TypeReqFloat, type)); return codeStream.tell(); } @@ -692,53 +766,95 @@ TypeReq FloatUnaryExprNode::getPreferredType() U32 VarNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - // if this has an arrayIndex... - // OP_LOADIMMED_IDENT - // varName - // OP_ADVANCE_STR - // evaluate arrayIndex TypeReqString - // OP_REWIND_STR - // OP_SETCURVAR_ARRAY - // OP_LOADVAR (type) - + // if this has an arrayIndex and we are not short circuiting from a constant. + // if we are a var node + // OP_SETCURVAR_ARRAY_VARLOOKUP + // varName + // varNodeVarName + + // else + // OP_LOADIMMED_IDENT + // varName + // OP_ADVANCE_STR + // evaluate arrayIndex TypeReqString + // OP_REWIND_STR + // OP_SETCURVAR_ARRAY + // OP_LOADVAR (type) + // else // OP_SETCURVAR // varName // OP_LOADVAR (type) - - if(type == TypeReqNone) + + if (type == TypeReqNone) return codeStream.tell(); - + + bool shortCircuit = false; + if (arrayIndex) + { + // If we have a constant, shortcircuit the array logic. + + IntNode *intNode = dynamic_cast(arrayIndex); + StrConstNode *strNode = dynamic_cast(arrayIndex); + if (intNode) + { + varName = StringTable->insert(avar("%s%d", varName, intNode->value)); + shortCircuit = true; + } + else if (strNode) + { + varName = StringTable->insert(avar("%s%s", varName, strNode->str)); + shortCircuit = true; + } + } + precompileIdent(varName); - codeStream.emit(arrayIndex ? OP_LOADIMMED_IDENT : OP_SETCURVAR); - codeStream.emitSTE(varName); - - if(arrayIndex) + if (arrayIndex && !shortCircuit) { - codeStream.emit(OP_ADVANCE_STR); - ip = arrayIndex->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_REWIND_STR); - codeStream.emit(OP_SETCURVAR_ARRAY); + // Ok, lets try to optimize %var[%someothervar] as this is + // a common case for array usage. + StringTableEntry varNodeVarName; + if (isSimpleVarLookup(arrayIndex, varNodeVarName)) + { + codeStream.emit(OP_SETCURVAR_ARRAY_VARLOOKUP); + codeStream.emitSTE(varName); + codeStream.emitSTE(varNodeVarName); + } + else + { + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(varName); + codeStream.emit(OP_ADVANCE_STR); + ip = arrayIndex->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_REWIND_STR); + codeStream.emit(OP_SETCURVAR_ARRAY); + } } - switch(type) + else { - case TypeReqUInt: - codeStream.emit(OP_LOADVAR_UINT); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADVAR_FLT); - break; - case TypeReqString: - codeStream.emit(OP_LOADVAR_STR); - break; - case TypeReqVar: - codeStream.emit(OP_LOADVAR_VAR); - break; - case TypeReqNone: - break; - default: - break; + codeStream.emit(OP_SETCURVAR); + codeStream.emitSTE(varName); + } + + switch (type) + { + case TypeReqUInt: + codeStream.emit(OP_LOADVAR_UINT); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADVAR_FLT); + break; + case TypeReqString: + codeStream.emit(OP_LOADVAR_STR); + break; + case TypeReqVar: + codeStream.emit(OP_LOADVAR_VAR); + break; + case TypeReqNone: + break; + default: + break; } return codeStream.tell(); } @@ -752,27 +868,27 @@ TypeReq VarNode::getPreferredType() U32 IntNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqString) + if (type == TypeReqString) index = getCurrentStringTable()->addIntString(value); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) index = getCurrentFloatTable()->add(value); - - switch(type) + + switch (type) { - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(value); - break; - case TypeReqString: - codeStream.emit(OP_LOADIMMED_STR); - codeStream.emit(index); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(value); + break; + case TypeReqString: + codeStream.emit(OP_LOADIMMED_STR); + codeStream.emit(index); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return codeStream.tell(); } @@ -786,27 +902,27 @@ TypeReq IntNode::getPreferredType() U32 FloatNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqString) + if (type == TypeReqString) index = getCurrentStringTable()->addFloatString(value); - else if(type == TypeReqFloat) + else if (type == TypeReqFloat) index = getCurrentFloatTable()->add(value); - - switch(type) + + switch (type) { - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(U32(value)); - break; - case TypeReqString: - codeStream.emit(OP_LOADIMMED_STR); - codeStream.emit(index); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(U32(value)); + break; + case TypeReqString: + codeStream.emit(OP_LOADIMMED_STR); + codeStream.emit(index); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return codeStream.tell(); } @@ -821,25 +937,25 @@ TypeReq FloatNode::getPreferredType() U32 StrConstNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // Early out for documentation block. - if( doc ) + if (doc) { index = getCurrentStringTable()->add(str, true, tag); } - else if(type == TypeReqString) + else if (type == TypeReqString) { index = getCurrentStringTable()->add(str, true, tag); } else if (type != TypeReqNone) { fVal = consoleStringToNumber(str, dbgFileName, dbgLineNumber); - if(type == TypeReqFloat) + if (type == TypeReqFloat) { index = getCurrentFloatTable()->add(fVal); } } - + // If this is a DOCBLOCK, then process w/ appropriate op... - if( doc ) + if (doc) { codeStream.emit(OP_DOCBLOCK_STR); codeStream.emit(index); @@ -847,22 +963,22 @@ U32 StrConstNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) } // Otherwise, deal with it normally as a string literal case. - switch(type) + switch (type) { - case TypeReqString: - codeStream.emit(tag ? OP_TAG_TO_STR : OP_LOADIMMED_STR); - codeStream.emit(index); - break; - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(U32(fVal)); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqString: + codeStream.emit(tag ? OP_TAG_TO_STR : OP_LOADIMMED_STR); + codeStream.emit(index); + break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(U32(fVal)); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return codeStream.tell(); } @@ -876,33 +992,33 @@ TypeReq StrConstNode::getPreferredType() U32 ConstantNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqString) + if (type == TypeReqString) { precompileIdent(value); } else if (type != TypeReqNone) { fVal = consoleStringToNumber(value, dbgFileName, dbgLineNumber); - if(type == TypeReqFloat) + if (type == TypeReqFloat) index = getCurrentFloatTable()->add(fVal); } - - switch(type) + + switch (type) { - case TypeReqString: - codeStream.emit(OP_LOADIMMED_IDENT); - codeStream.emitSTE(value); - break; - case TypeReqUInt: - codeStream.emit(OP_LOADIMMED_UINT); - codeStream.emit(U32(fVal)); - break; - case TypeReqFloat: - codeStream.emit(OP_LOADIMMED_FLT); - codeStream.emit(index); - break; - case TypeReqNone: - break; + case TypeReqString: + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(value); + break; + case TypeReqUInt: + codeStream.emit(OP_LOADIMMED_UINT); + codeStream.emit(U32(fVal)); + break; + case TypeReqFloat: + codeStream.emit(OP_LOADIMMED_FLT); + codeStream.emit(index); + break; + case TypeReqNone: + break; } return ip; } @@ -917,9 +1033,9 @@ TypeReq ConstantNode::getPreferredType() U32 AssignExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { subType = expr->getPreferredType(); - if(subType == TypeReqNone) + if (subType == TypeReqNone) subType = type; - if(subType == TypeReqNone) + if (subType == TypeReqNone) { // What we need to do in this case is turn it into a VarNode reference. // Unfortunately other nodes such as field access (SlotAccessNode) @@ -934,41 +1050,87 @@ U32 AssignExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) subType = TypeReqString; } } - // if it's an array expr, the formula is: + + //if we are an array index and we are gonna short circuit + // eval expr + // compute new varName + // OP_SETCURVAR_CREATE + // varName + // OP_SAVEVAR + + //else if it's an array expr and we don't short circuit, the formula is: // eval expr // (push and pop if it's TypeReqString) OP_ADVANCE_STR - // OP_LOADIMMED_IDENT - // varName - // OP_ADVANCE_STR - // eval array - // OP_REWIND_STR - // OP_SETCURVAR_ARRAY_CREATE + // if array lookup is varnode + // OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP + // varName + // varNodeVarName + // else + // OP_LOADIMMED_IDENT + // varName + // OP_ADVANCE_STR + // eval array + // OP_REWIND_STR + // OP_SETCURVAR_ARRAY_CREATE + // endif // OP_TERMINATE_REWIND_STR // OP_SAVEVAR - + //else // eval expr // OP_SETCURVAR_CREATE // varname // OP_SAVEVAR - - precompileIdent(varName); - + ip = expr->compile(codeStream, ip, subType); - if(arrayIndex) + bool shortCircuit = false; + if (arrayIndex) { - if(subType == TypeReqString) + // If we have a constant, shortcircuit the array logic. + + IntNode *intNode = dynamic_cast(arrayIndex); + StrConstNode *strNode = dynamic_cast(arrayIndex); + if (intNode) + { + varName = StringTable->insert(avar("%s%d", varName, intNode->value)); + shortCircuit = true; + } + else if (strNode) + { + varName = StringTable->insert(avar("%s%s", varName, strNode->str)); + shortCircuit = true; + } + } + + precompileIdent(varName); + + if (arrayIndex && !shortCircuit) + { + if (subType == TypeReqString) codeStream.emit(OP_ADVANCE_STR); - codeStream.emit(OP_LOADIMMED_IDENT); - codeStream.emitSTE(varName); - - codeStream.emit(OP_ADVANCE_STR); - ip = arrayIndex->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_REWIND_STR); - codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); - if(subType == TypeReqString) + // Ok, lets try to optimize %var[%someothervar] as this is + // a common case for array usage. + StringTableEntry varNodeVarName; + if (isSimpleVarLookup(arrayIndex, varNodeVarName)) + { + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP); + codeStream.emitSTE(varName); + codeStream.emitSTE(varNodeVarName); + } + else + { + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(varName); + + codeStream.emit(OP_ADVANCE_STR); + ip = arrayIndex->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_REWIND_STR); + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); + } + + if (subType == TypeReqString) codeStream.emit(OP_TERMINATE_REWIND_STR); } else @@ -976,24 +1138,24 @@ U32 AssignExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) codeStream.emit(OP_SETCURVAR_CREATE); codeStream.emitSTE(varName); } - switch(subType) + switch (subType) { - case TypeReqString: - codeStream.emit(OP_SAVEVAR_STR); - break; - case TypeReqUInt: - codeStream.emit(OP_SAVEVAR_UINT); - break; - case TypeReqFloat: - codeStream.emit(OP_SAVEVAR_FLT); - break; - case TypeReqVar: - codeStream.emit(OP_SAVEVAR_VAR); - break; - case TypeReqNone: - break; + case TypeReqString: + codeStream.emit(OP_SAVEVAR_STR); + break; + case TypeReqUInt: + codeStream.emit(OP_SAVEVAR_UINT); + break; + case TypeReqFloat: + codeStream.emit(OP_SAVEVAR_FLT); + break; + case TypeReqVar: + codeStream.emit(OP_SAVEVAR_VAR); + break; + case TypeReqNone: + break; } - if(type != subType) + if (type != subType) codeStream.emit(conversionOp(subType, type)); return ip; } @@ -1007,97 +1169,178 @@ TypeReq AssignExprNode::getPreferredType() static void getAssignOpTypeOp(S32 op, TypeReq &type, U32 &operand) { - switch(op) + switch (op) { - case '+': - type = TypeReqFloat; - operand = OP_ADD; - break; - case '-': - type = TypeReqFloat; - operand = OP_SUB; - break; - case '*': - type = TypeReqFloat; - operand = OP_MUL; - break; - case '/': - type = TypeReqFloat; - operand = OP_DIV; - break; - case '%': - type = TypeReqUInt; - operand = OP_MOD; - break; - case '&': - type = TypeReqUInt; - operand = OP_BITAND; - break; - case '^': - type = TypeReqUInt; - operand = OP_XOR; - break; - case '|': - type = TypeReqUInt; - operand = OP_BITOR; - break; - case opSHL: - type = TypeReqUInt; - operand = OP_SHL; - break; - case opSHR: - type = TypeReqUInt; - operand = OP_SHR; - break; - } + case '+': + case opPLUSPLUS: + type = TypeReqFloat; + operand = OP_ADD; + break; + case '-': + case opMINUSMINUS: + type = TypeReqFloat; + operand = OP_SUB; + break; + case '*': + type = TypeReqFloat; + operand = OP_MUL; + break; + case '/': + type = TypeReqFloat; + operand = OP_DIV; + break; + case '%': + type = TypeReqUInt; + operand = OP_MOD; + break; + case '&': + type = TypeReqUInt; + operand = OP_BITAND; + break; + case '^': + type = TypeReqUInt; + operand = OP_XOR; + break; + case '|': + type = TypeReqUInt; + operand = OP_BITOR; + break; + case opSHL: + type = TypeReqUInt; + operand = OP_SHL; + break; + case opSHR: + type = TypeReqUInt; + operand = OP_SHR; + break; + } } U32 AssignOpExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - + // goes like this... - // eval expr as float or int - // if there's an arrayIndex - - // OP_LOADIMMED_IDENT - // varName - // OP_ADVANCE_STR - // eval arrayIndex stringwise - // OP_REWIND_STR - // OP_SETCURVAR_ARRAY_CREATE - - // else - // OP_SETCURVAR_CREATE - // varName - - // OP_LOADVAR_FLT or UINT - // operand - // OP_SAVEVAR_FLT or UINT - + // + // IF no array index && (op == OPPLUSPLUS or op == OPMINUSMINUS) + // if op == OPPLUSPLUS + // OP_INC + // varName + // else if op == OPMINUSMINUS + // OP_DEC + // varName + // else + // OP_INVALID + // endif + // ELSE + // eval expr as float or int + // if there's an arrayIndex and we don't short circuit + // if arrayIndex is a var node + // OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP + // varName + // varNodeVarName + // else + // OP_LOADIMMED_IDENT + // varName + // OP_ADVANCE_STR + // eval arrayIndex stringwise + // OP_REWIND_STR + // OP_SETCURVAR_ARRAY_CREATE + // endif + // else + // OP_SETCURVAR_CREATE + // varName + // endif + // OP_LOADVAR_FLT or UINT + // operand + // OP_SAVEVAR_FLT or UINT + // ENDIF + // + // if subtype != type + // convert type + // endif + // conversion OP if necessary. getAssignOpTypeOp(op, subType, operand); - precompileIdent(varName); - - ip = expr->compile(codeStream, ip, subType); - if(!arrayIndex) + + // ++ or -- optimization support for non indexed variables. + if ((!arrayIndex) && (op == opPLUSPLUS || op == opMINUSMINUS)) { - codeStream.emit(OP_SETCURVAR_CREATE); - codeStream.emitSTE(varName); + precompileIdent(varName); + + if (op == opPLUSPLUS) + { + codeStream.emit(OP_INC); + codeStream.emitSTE(varName); + } + else if (op == opMINUSMINUS) + { + codeStream.emit(OP_DEC); + codeStream.emitSTE(varName); + } + else + { + // This should NEVER happen. This is just for sanity. + AssertISV(false, "Tried to use ++ or -- but something weird happened."); + codeStream.emit(OP_INVALID); + } } else { - codeStream.emit(OP_LOADIMMED_IDENT); - codeStream.emitSTE(varName); - - codeStream.emit(OP_ADVANCE_STR); - ip = arrayIndex->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_REWIND_STR); - codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); + ip = expr->compile(codeStream, ip, subType); + + bool shortCircuit = false; + if (arrayIndex) + { + // If we have a constant, shortcircuit the array logic. + + IntNode *intNode = dynamic_cast(arrayIndex); + StrConstNode *strNode = dynamic_cast(arrayIndex); + if (intNode) + { + varName = StringTable->insert(avar("%s%d", varName, intNode->value)); + shortCircuit = true; + } + else if (strNode) + { + varName = StringTable->insert(avar("%s%s", varName, strNode->str)); + shortCircuit = true; + } + } + + precompileIdent(varName); + + if (!arrayIndex || shortCircuit) + { + codeStream.emit(OP_SETCURVAR_CREATE); + codeStream.emitSTE(varName); + } + else + { + // Ok, lets try to optimize %var[%someothervar] as this is + // a common case for array usage. + StringTableEntry varNodeVarName; + if (isSimpleVarLookup(arrayIndex, varNodeVarName)) + { + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP); + codeStream.emitSTE(varName); + codeStream.emitSTE(varNodeVarName); + } + else + { + codeStream.emit(OP_LOADIMMED_IDENT); + codeStream.emitSTE(varName); + + codeStream.emit(OP_ADVANCE_STR); + ip = arrayIndex->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_REWIND_STR); + codeStream.emit(OP_SETCURVAR_ARRAY_CREATE); + } + } + codeStream.emit((subType == TypeReqFloat) ? OP_LOADVAR_FLT : OP_LOADVAR_UINT); + codeStream.emit(operand); + codeStream.emit((subType == TypeReqFloat) ? OP_SAVEVAR_FLT : OP_SAVEVAR_UINT); } - codeStream.emit((subType == TypeReqFloat) ? OP_LOADVAR_FLT : OP_LOADVAR_UINT); - codeStream.emit(operand); - codeStream.emit((subType == TypeReqFloat) ? OP_SAVEVAR_FLT : OP_SAVEVAR_UINT); - if(subType != type) + if (subType != type) codeStream.emit(conversionOp(subType, type)); return codeStream.tell(); } @@ -1146,17 +1389,42 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // OP_PUSH_FRAME // arg OP_PUSH arg OP_PUSH arg OP_PUSH // eval all the args, then call the function. - + // OP_CALLFUNC // function // namespace // isDot - + precompileIdent(funcName); precompileIdent(nameSpace); - + codeStream.emit(OP_PUSH_FRAME); - for(ExprNode *walk = args; walk; walk = (ExprNode *) walk->getNext()) + + bool isThisCall = false; + + // Try to optimize the this pointer call if it is a variable + // that we are loading. + if (callType == MethodCall) + { + // We cannot optimize array indices because it can have quite + // a bit of code to figure out the array index. + VarNode *var = dynamic_cast(args); + if (var && !var->arrayIndex) + { + precompileIdent(var->varName); + + // Are we a %this call? + isThisCall = (var->varName == StringTable->insert("%this")); + + codeStream.emit(OP_PUSH_THIS); + codeStream.emitSTE(var->varName); + + // inc args since we took care of first arg. + args = static_cast(args->getNext()); + } + } + + for (ExprNode *walk = args; walk; walk = (ExprNode *)walk->getNext()) { TypeReq walkType = walk->getPreferredType(); if (walkType == TypeReqNone) walkType = TypeReqString; @@ -1174,16 +1442,25 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) break; } } - if(callType == MethodCall || callType == ParentCall) - codeStream.emit(OP_CALLFUNC); - else - codeStream.emit(OP_CALLFUNC_RESOLVE); - codeStream.emitSTE(funcName); - codeStream.emitSTE(nameSpace); - - codeStream.emit(callType); - if(type != TypeReqString) + if (isThisCall) + { + codeStream.emit(OP_CALLFUNC_THIS); + codeStream.emitSTE(funcName); + } + else + { + if (callType == MethodCall || callType == ParentCall) + codeStream.emit(OP_CALLFUNC); + else + codeStream.emit(OP_CALLFUNC_RESOLVE); + + codeStream.emitSTE(funcName); + codeStream.emitSTE(nameSpace); + codeStream.emit(callType); + } + + if (type != TypeReqString) codeStream.emit(conversionOp(TypeReqString, type)); return codeStream.tell(); } @@ -1193,20 +1470,63 @@ TypeReq FuncCallExprNode::getPreferredType() return TypeReqString; } +//------------------------------------------------------------ + +U32 FuncPointerCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) +{ + // OP_PUSH_FRAME + // arg OP_PUSH arg OP_PUSH arg OP_PUSH + // eval all the args, then call the function. + + // eval fn pointer + // OP_CALLFUNC_POINTER + + codeStream.emit(OP_PUSH_FRAME); + for (ExprNode *walk = args; walk; walk = (ExprNode *)walk->getNext()) + { + TypeReq walkType = walk->getPreferredType(); + if (walkType == TypeReqNone) walkType = TypeReqString; + ip = walk->compile(codeStream, ip, walkType); + switch (walk->getPreferredType()) + { + case TypeReqFloat: + codeStream.emit(OP_PUSH_FLT); + break; + case TypeReqUInt: + codeStream.emit(OP_PUSH_UINT); + break; + default: + codeStream.emit(OP_PUSH); + break; + } + } + + ip = funcPointer->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_CALLFUNC_POINTER); + + if (type != TypeReqString) + codeStream.emit(conversionOp(TypeReqString, type)); + return codeStream.tell(); +} + +TypeReq FuncPointerCallExprNode::getPreferredType() +{ + return TypeReqString; +} //------------------------------------------------------------ -U32 AssertCallExprNode::compile( CodeStream &codeStream, U32 ip, TypeReq type ) +U32 AssertCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - #ifdef TORQUE_ENABLE_SCRIPTASSERTS - - messageIndex = getCurrentStringTable()->add( message, true, false ); - - ip = testExpr->compile( codeStream, ip, TypeReqUInt ); - codeStream.emit(OP_ASSERT); - codeStream.emit(messageIndex); +#ifdef TORQUE_ENABLE_SCRIPTASSERTS - #endif + messageIndex = getCurrentStringTable()->add(message, true, false); + + ip = testExpr->compile(codeStream, ip, TypeReqUInt); + codeStream.emit(OP_ASSERT); + codeStream.emit(messageIndex); + +#endif return codeStream.tell(); } @@ -1220,37 +1540,45 @@ TypeReq AssertCallExprNode::getPreferredType() U32 SlotAccessNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqNone) + if (type == TypeReqNone) return ip; - + precompileIdent(slotName); - if(arrayExpr) + // check if object is %this. If we are, we can do additional optimizations. + if (isThisVar(objectExpr)) { - // eval array - // OP_ADVANCE_STR - // evaluate object expression sub (OP_SETCURFIELD) - // OP_TERMINATE_REWIND_STR - // OP_SETCURFIELDARRAY - // total add of 4 + array precomp - - ip = arrayExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); + optimizeThisPointer(codeStream, arrayExpr, ip, slotName); } - ip = objectExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_SETCUROBJECT); - - codeStream.emit(OP_SETCURFIELD); - - codeStream.emitSTE(slotName); + else + { + if (arrayExpr) + { + // eval array + // OP_ADVANCE_STR + // evaluate object expression sub (OP_SETCURFIELD) + // OP_TERMINATE_REWIND_STR + // OP_SETCURFIELDARRAY + // total add of 4 + array precomp - if(arrayExpr) - { - codeStream.emit(OP_TERMINATE_REWIND_STR); - codeStream.emit(OP_SETCURFIELD_ARRAY); + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_ADVANCE_STR); + } + ip = objectExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_SETCUROBJECT); + + codeStream.emit(OP_SETCURFIELD); + + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + codeStream.emit(OP_TERMINATE_REWIND_STR); + codeStream.emit(OP_SETCURFIELD_ARRAY); + } } - - switch(type) + + switch (type) { case TypeReqUInt: codeStream.emit(OP_LOADFIELD_UINT); @@ -1276,7 +1604,7 @@ TypeReq SlotAccessNode::getPreferredType() U32 InternalSlotAccessNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { - if(type == TypeReqNone) + if (type == TypeReqNone) return ip; ip = objectExpr->compile(codeStream, ip, TypeReqString); @@ -1286,7 +1614,7 @@ U32 InternalSlotAccessNode::compile(CodeStream &codeStream, U32 ip, TypeReq type codeStream.emit(OP_SETCUROBJECT_INTERNAL); codeStream.emit(recurse); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -1301,22 +1629,22 @@ TypeReq InternalSlotAccessNode::getPreferredType() U32 SlotAssignNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // first eval the expression TypeReqString - + // if it's an array: - + // if OP_ADVANCE_STR 1 // eval array - + // OP_ADVANCE_STR 1 // evaluate object expr // OP_SETCUROBJECT 1 // OP_SETCURFIELD 1 // fieldName 1 // OP_TERMINATE_REWIND_STR 1 - + // OP_SETCURFIELDARRAY 1 // OP_TERMINATE_REWIND_STR 1 - + // else // OP_ADVANCE_STR // evaluate object expr @@ -1324,45 +1652,54 @@ U32 SlotAssignNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // OP_SETCURFIELD // fieldName // OP_TERMINATE_REWIND_STR - + // OP_SAVEFIELD // convert to return type if necessary. - + precompileIdent(slotName); - + ip = valueExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); - if(arrayExpr) + + if (isThisVar(objectExpr)) { - ip = arrayExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); - } - if(objectExpr) - { - ip = objectExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_SETCUROBJECT); + optimizeThisPointer(codeStream, arrayExpr, ip, slotName); } else - codeStream.emit(OP_SETCUROBJECT_NEW); - codeStream.emit(OP_SETCURFIELD); - codeStream.emitSTE(slotName); - - if(arrayExpr) { + codeStream.emit(OP_ADVANCE_STR); + if (arrayExpr) + { + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_ADVANCE_STR); + } + if (objectExpr) + { + ip = objectExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_SETCUROBJECT); + } + else + codeStream.emit(OP_SETCUROBJECT_NEW); + codeStream.emit(OP_SETCURFIELD); + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + codeStream.emit(OP_TERMINATE_REWIND_STR); + codeStream.emit(OP_SETCURFIELD_ARRAY); + } + codeStream.emit(OP_TERMINATE_REWIND_STR); - codeStream.emit(OP_SETCURFIELD_ARRAY); } - codeStream.emit(OP_TERMINATE_REWIND_STR); codeStream.emit(OP_SAVEFIELD_STR); - if(typeID != -1) + if (typeID != -1) { codeStream.emit(OP_SETCURFIELD_TYPE); codeStream.emit(typeID); } - if(type != TypeReqString) + if (type != TypeReqString) codeStream.emit(conversionOp(TypeReqString, type)); return codeStream.tell(); } @@ -1377,7 +1714,7 @@ TypeReq SlotAssignNode::getPreferredType() U32 SlotAssignOpNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // first eval the expression as its type - + // if it's an array: // eval array // OP_ADVANCE_STR @@ -1387,41 +1724,49 @@ U32 SlotAssignOpNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) // fieldName // OP_TERMINATE_REWIND_STR // OP_SETCURFIELDARRAY - + // else // evaluate object expr // OP_SETCUROBJECT // OP_SETCURFIELD // fieldName - + // OP_LOADFIELD of appropriate type // operand // OP_SAVEFIELD of appropriate type // convert to return type if necessary. - + getAssignOpTypeOp(op, subType, operand); precompileIdent(slotName); - + ip = valueExpr->compile(codeStream, ip, subType); - if(arrayExpr) + + if (isThisVar(objectExpr)) { - ip = arrayExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_ADVANCE_STR); + optimizeThisPointer(codeStream, arrayExpr, ip, slotName); } - ip = objectExpr->compile(codeStream, ip, TypeReqString); - codeStream.emit(OP_SETCUROBJECT); - codeStream.emit(OP_SETCURFIELD); - codeStream.emitSTE(slotName); - - if(arrayExpr) + else { - codeStream.emit(OP_TERMINATE_REWIND_STR); - codeStream.emit(OP_SETCURFIELD_ARRAY); + if (arrayExpr) + { + ip = arrayExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_ADVANCE_STR); + } + ip = objectExpr->compile(codeStream, ip, TypeReqString); + codeStream.emit(OP_SETCUROBJECT); + codeStream.emit(OP_SETCURFIELD); + codeStream.emitSTE(slotName); + + if (arrayExpr) + { + codeStream.emit(OP_TERMINATE_REWIND_STR); + codeStream.emit(OP_SETCURFIELD_ARRAY); + } } codeStream.emit((subType == TypeReqFloat) ? OP_LOADFIELD_FLT : OP_LOADFIELD_UINT); codeStream.emit(operand); codeStream.emit((subType == TypeReqFloat) ? OP_SAVEFIELD_FLT : OP_SAVEFIELD_UINT); - if(subType != type) + if (subType != type) codeStream.emit(conversionOp(subType, type)); return codeStream.tell(); } @@ -1437,7 +1782,7 @@ TypeReq SlotAssignOpNode::getPreferredType() U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) { // goes - + // OP_PUSHFRAME 1 // name expr // OP_PUSH 1 @@ -1449,17 +1794,17 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) // isSingleton 1 // lineNumber 1 // fail point 1 - + // for each field, eval // OP_ADD_OBJECT (to UINT[0]) 1 // root? 1 - + // add all the sub objects. // OP_END_OBJECT 1 // root? 1 // To fix the stack issue [7/9/2007 Black] // OP_FINISH_OBJECT <-- fail point jumps to this opcode - + codeStream.emit(OP_PUSH_FRAME); ip = classNameExpr->compile(codeStream, ip, TypeReqString); @@ -1467,7 +1812,7 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) ip = objectNameExpr->compile(codeStream, ip, TypeReqString); codeStream.emit(OP_PUSH); - for(ExprNode *exprWalk = argList; exprWalk; exprWalk = (ExprNode *) exprWalk->getNext()) + for (ExprNode *exprWalk = argList; exprWalk; exprWalk = (ExprNode *)exprWalk->getNext()) { TypeReq walkType = exprWalk->getPreferredType(); if (walkType == TypeReqNone) walkType = TypeReqString; @@ -1482,7 +1827,7 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) break; default: codeStream.emit(OP_PUSH); - break; + break; } } codeStream.emit(OP_CREATE_OBJECT); @@ -1493,35 +1838,35 @@ U32 ObjectDeclNode::compileSubObject(CodeStream &codeStream, U32 ip, bool root) codeStream.emit(isSingleton); codeStream.emit(dbgLineNumber); const U32 failIp = codeStream.emit(0); - for(SlotAssignNode *slotWalk = slotDecls; slotWalk; slotWalk = (SlotAssignNode *) slotWalk->getNext()) + for (SlotAssignNode *slotWalk = slotDecls; slotWalk; slotWalk = (SlotAssignNode *)slotWalk->getNext()) ip = slotWalk->compile(codeStream, ip, TypeReqNone); codeStream.emit(OP_ADD_OBJECT); codeStream.emit(root); - for(ObjectDeclNode *objectWalk = subObjects; objectWalk; objectWalk = (ObjectDeclNode *) objectWalk->getNext()) + for (ObjectDeclNode *objectWalk = subObjects; objectWalk; objectWalk = (ObjectDeclNode *)objectWalk->getNext()) ip = objectWalk->compileSubObject(codeStream, ip, false); codeStream.emit(OP_END_OBJECT); codeStream.emit(root || isDatablock); // Added to fix the object creation issue [7/9/2007 Black] failOffset = codeStream.emit(OP_FINISH_OBJECT); - + codeStream.patch(failIp, failOffset); - + return codeStream.tell(); } U32 ObjectDeclNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) { // root object decl does: - + // push 0 onto the UINT stack OP_LOADIMMED_UINT // precompiles the subObject(true) // UINT stack now has object id // type conv to type - + codeStream.emit(OP_LOADIMMED_UINT); codeStream.emit(0); ip = compileSubObject(codeStream, ip, true); - if(type != TypeReqUInt) + if (type != TypeReqUInt) codeStream.emit(conversionOp(TypeReqUInt, type)); return codeStream.tell(); } @@ -1547,31 +1892,31 @@ U32 FunctionDeclStmtNode::compileStmt(CodeStream &codeStream, U32 ip) // OP_RETURN_VOID setCurrentStringTable(&getFunctionStringTable()); setCurrentFloatTable(&getFunctionFloatTable()); - + argc = 0; - for(VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) + for (VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) { precompileIdent(walk->varName); argc++; } - + CodeBlock::smInFunction = true; - + precompileIdent(fnName); precompileIdent(nameSpace); precompileIdent(package); - + CodeBlock::smInFunction = false; - + codeStream.emit(OP_FUNC_DECL); codeStream.emitSTE(fnName); codeStream.emitSTE(nameSpace); codeStream.emitSTE(package); - - codeStream.emit(U32( bool(stmts != NULL) ? 1 : 0 ) + U32( dbgLineNumber << 1 )); + + codeStream.emit(U32(bool(stmts != NULL) ? 1 : 0) + U32(dbgLineNumber << 1)); const U32 endIp = codeStream.emit(0); codeStream.emit(argc); - for(VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) + for (VarNode *walk = args; walk; walk = (VarNode *)((StmtNode*)walk)->getNext()) { codeStream.emitSTE(walk->varName); } @@ -1584,11 +1929,11 @@ U32 FunctionDeclStmtNode::compileStmt(CodeStream &codeStream, U32 ip) CodeBlock::smInFunction = false; codeStream.emit(OP_RETURN_VOID); - + codeStream.patch(endIp, codeStream.tell()); - + setCurrentStringTable(&getGlobalStringTable()); setCurrentFloatTable(&getGlobalFloatTable()); - + return ip; } diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 39fe8d3c3..b5051786b 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -1,6 +1,6 @@ /* A Bison parser, made from cmdgram.y with Bison version GNU Bison version 1.24 - */ +*/ #define YYBISON 1 /* Identify Bison output. */ @@ -11,78 +11,78 @@ #define yychar CMDchar #define yydebug CMDdebug #define yynerrs CMDnerrs -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 #line 1 "cmdgram.y" @@ -129,13 +129,13 @@ struct Token #line 44 "cmdgram.y" - /* Reserved Word Definitions */ +/* Reserved Word Definitions */ #line 55 "cmdgram.y" - /* Constants and Identifier Definitions */ +/* Constants and Identifier Definitions */ #line 69 "cmdgram.y" - /* Operator Definitions */ +/* Operator Definitions */ #line 82 "cmdgram.y" typedef union { @@ -158,16 +158,16 @@ typedef union { #ifndef YYLTYPE typedef - struct yyltype - { - int timestamp; - int first_line; - int first_column; - int last_line; - int last_column; - char *text; - } - yyltype; +struct yyltype +{ + int timestamp; + int first_line; + int first_column; + int last_line; + int last_column; + char *text; +} +yyltype; #define YYLTYPE yyltype #endif @@ -182,165 +182,165 @@ typedef -#define YYFINAL 388 -#define YYFLAG -32768 -#define YYNTBASE 100 +#define YYFINAL 391 +#define YYFLAG -32768 +#define YYNTBASE 100 #define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140) -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 64, 2, 2, 2, 54, 53, 2, 55, - 56, 46, 44, 57, 45, 51, 47, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 58, 59, 48, - 50, 49, 96, 65, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 92, 2, 99, 62, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 60, 52, 61, 63, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 93, 94, 95, 97, 98 +static const char yytranslate[] = { 0, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 64, 2, 2, 2, 54, 53, 2, 55, +56, 46, 44, 57, 45, 51, 47, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 58, 59, 48, +50, 49, 96, 65, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +92, 2, 99, 62, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 60, 52, 61, 63, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 2, 1, 2, 3, 4, 5, +6, 7, 8, 9, 10, 11, 12, 13, 14, 15, +16, 17, 18, 19, 20, 21, 22, 23, 24, 25, +26, 27, 28, 29, 30, 31, 32, 33, 34, 35, +36, 37, 38, 39, 40, 41, 42, 43, 66, 67, +68, 69, 70, 71, 72, 73, 74, 75, 76, 77, +78, 79, 80, 81, 82, 83, 84, 85, 86, 87, +88, 89, 90, 91, 93, 94, 95, 97, 98 }; #if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 3, 6, 8, 10, 12, 19, 21, 24, - 25, 28, 30, 32, 34, 36, 38, 40, 43, 46, - 49, 53, 56, 61, 68, 70, 79, 90, 91, 93, - 95, 99, 110, 121, 129, 142, 152, 163, 171, 172, - 175, 176, 178, 179, 182, 183, 185, 187, 190, 193, - 197, 201, 203, 211, 219, 224, 232, 238, 240, 244, - 250, 258, 264, 271, 281, 290, 299, 307, 316, 324, - 332, 339, 347, 355, 357, 359, 363, 367, 371, 375, - 379, 383, 387, 391, 395, 398, 401, 403, 409, 413, - 417, 421, 425, 429, 433, 437, 441, 445, 449, 453, - 457, 461, 464, 467, 469, 471, 473, 475, 477, 479, - 481, 483, 485, 490, 498, 502, 509, 513, 517, 519, - 523, 525, 527, 530, 533, 536, 539, 542, 545, 548, - 551, 554, 557, 559, 561, 563, 567, 574, 577, 583, - 586, 590, 596, 601, 608, 615, 620, 627, 628, 630, - 632, 636, 637, 639, 641, 644, 649, 655, 660, 668, - 677, 679 +static const short yyprhs[] = { 0, +0, 2, 3, 6, 8, 10, 12, 19, 21, 24, +25, 28, 30, 32, 34, 36, 38, 40, 43, 46, +49, 53, 56, 61, 68, 70, 79, 90, 91, 93, +95, 99, 110, 121, 129, 142, 152, 163, 171, 172, +175, 176, 178, 179, 182, 183, 185, 187, 190, 193, +197, 201, 203, 211, 219, 224, 232, 238, 240, 244, +250, 258, 264, 271, 281, 290, 299, 307, 316, 324, +332, 339, 347, 355, 357, 359, 363, 367, 371, 375, +379, 383, 387, 391, 395, 398, 401, 403, 409, 413, +417, 421, 425, 429, 433, 437, 441, 445, 449, 453, +457, 461, 464, 467, 469, 471, 473, 475, 477, 479, +481, 483, 485, 490, 498, 502, 509, 513, 517, 519, +523, 525, 527, 530, 533, 536, 539, 542, 545, 548, +551, 554, 557, 559, 561, 563, 567, 574, 577, 583, +586, 590, 596, 601, 608, 615, 620, 625, 632, 633, +635, 637, 641, 642, 644, 646, 649, 654, 660, 665, +673, 682, 684 }; -static const short yyrhs[] = { 101, - 0, 0, 101, 102, 0, 106, 0, 107, 0, 103, - 0, 29, 38, 60, 104, 61, 59, 0, 107, 0, - 104, 107, 0, 0, 105, 106, 0, 121, 0, 122, - 0, 123, 0, 124, 0, 110, 0, 118, 0, 7, - 59, 0, 9, 59, 0, 13, 59, 0, 13, 126, - 59, 0, 125, 59, 0, 36, 50, 126, 59, 0, - 36, 50, 126, 57, 126, 59, 0, 40, 0, 3, - 38, 55, 108, 56, 60, 105, 61, 0, 3, 38, - 91, 38, 55, 108, 56, 60, 105, 61, 0, 0, - 109, 0, 37, 0, 109, 57, 37, 0, 24, 129, - 55, 126, 112, 56, 60, 136, 61, 59, 0, 5, - 129, 55, 113, 112, 114, 56, 60, 115, 61, 0, - 5, 129, 55, 113, 112, 114, 56, 0, 5, 129, - 55, 92, 113, 99, 112, 114, 56, 60, 115, 61, - 0, 5, 129, 55, 92, 113, 99, 112, 114, 56, - 0, 6, 129, 55, 113, 112, 114, 56, 60, 115, - 61, 0, 6, 129, 55, 113, 112, 114, 56, 0, - 0, 58, 38, 0, 0, 126, 0, 0, 57, 135, - 0, 0, 137, 0, 116, 0, 137, 116, 0, 111, - 59, 0, 116, 111, 59, 0, 60, 105, 61, 0, - 106, 0, 25, 55, 126, 56, 60, 119, 61, 0, - 27, 55, 126, 56, 60, 119, 61, 0, 26, 120, - 58, 105, 0, 26, 120, 58, 105, 19, 58, 105, - 0, 26, 120, 58, 105, 119, 0, 126, 0, 120, - 28, 126, 0, 11, 55, 126, 56, 117, 0, 11, - 55, 126, 56, 117, 8, 117, 0, 14, 55, 126, - 56, 117, 0, 15, 117, 14, 55, 126, 56, 0, - 20, 55, 126, 59, 126, 59, 126, 56, 117, 0, - 20, 55, 126, 59, 126, 59, 56, 117, 0, 20, - 55, 126, 59, 59, 126, 56, 117, 0, 20, 55, - 126, 59, 59, 56, 117, 0, 20, 55, 59, 126, - 59, 126, 56, 117, 0, 20, 55, 59, 126, 59, - 56, 117, 0, 20, 55, 59, 59, 126, 56, 117, - 0, 20, 55, 59, 59, 56, 117, 0, 21, 55, - 37, 23, 126, 56, 117, 0, 22, 55, 37, 23, - 126, 56, 117, 0, 131, 0, 131, 0, 55, 126, - 56, 0, 126, 62, 126, 0, 126, 54, 126, 0, - 126, 53, 126, 0, 126, 52, 126, 0, 126, 44, - 126, 0, 126, 45, 126, 0, 126, 46, 126, 0, - 126, 47, 126, 0, 45, 126, 0, 46, 126, 0, - 36, 0, 126, 96, 126, 58, 126, 0, 126, 48, - 126, 0, 126, 49, 126, 0, 126, 86, 126, 0, - 126, 87, 126, 0, 126, 84, 126, 0, 126, 85, - 126, 0, 126, 89, 126, 0, 126, 71, 126, 0, - 126, 72, 126, 0, 126, 88, 126, 0, 126, 90, - 126, 0, 126, 97, 126, 0, 126, 65, 126, 0, - 64, 126, 0, 63, 126, 0, 42, 0, 43, 0, - 35, 0, 7, 0, 127, 0, 128, 0, 38, 0, - 41, 0, 37, 0, 37, 92, 139, 99, 0, 3, - 55, 108, 56, 60, 105, 61, 0, 126, 51, 38, - 0, 126, 51, 38, 92, 139, 99, 0, 126, 66, - 129, 0, 126, 67, 129, 0, 38, 0, 55, 126, - 56, 0, 69, 0, 68, 0, 73, 126, 0, 74, - 126, 0, 75, 126, 0, 76, 126, 0, 77, 126, - 0, 78, 126, 0, 79, 126, 0, 80, 126, 0, - 81, 126, 0, 82, 126, 0, 132, 0, 133, 0, - 111, 0, 37, 50, 126, 0, 37, 92, 139, 99, - 50, 126, 0, 37, 130, 0, 37, 92, 139, 99, - 130, 0, 127, 130, 0, 127, 50, 126, 0, 127, - 50, 60, 135, 61, 0, 38, 55, 134, 56, 0, - 38, 91, 38, 55, 134, 56, 0, 126, 51, 38, - 55, 134, 56, 0, 32, 55, 126, 56, 0, 32, - 55, 126, 57, 41, 56, 0, 0, 135, 0, 126, - 0, 135, 57, 126, 0, 0, 137, 0, 138, 0, - 137, 138, 0, 38, 50, 126, 59, 0, 39, 38, - 50, 126, 59, 0, 24, 50, 126, 59, 0, 38, - 92, 139, 99, 50, 126, 59, 0, 39, 38, 92, - 139, 99, 50, 126, 59, 0, 126, 0, 139, 57, - 126, 0 +static const short yyrhs[] = { 101, +0, 0, 101, 102, 0, 106, 0, 107, 0, 103, +0, 29, 38, 60, 104, 61, 59, 0, 107, 0, +104, 107, 0, 0, 105, 106, 0, 121, 0, 122, +0, 123, 0, 124, 0, 110, 0, 118, 0, 7, +59, 0, 9, 59, 0, 13, 59, 0, 13, 126, +59, 0, 125, 59, 0, 36, 50, 126, 59, 0, +36, 50, 126, 57, 126, 59, 0, 40, 0, 3, +38, 55, 108, 56, 60, 105, 61, 0, 3, 38, +91, 38, 55, 108, 56, 60, 105, 61, 0, 0, +109, 0, 37, 0, 109, 57, 37, 0, 24, 129, +55, 126, 112, 56, 60, 136, 61, 59, 0, 5, +129, 55, 113, 112, 114, 56, 60, 115, 61, 0, +5, 129, 55, 113, 112, 114, 56, 0, 5, 129, +55, 92, 113, 99, 112, 114, 56, 60, 115, 61, +0, 5, 129, 55, 92, 113, 99, 112, 114, 56, +0, 6, 129, 55, 113, 112, 114, 56, 60, 115, +61, 0, 6, 129, 55, 113, 112, 114, 56, 0, +0, 58, 38, 0, 0, 126, 0, 0, 57, 135, +0, 0, 137, 0, 116, 0, 137, 116, 0, 111, +59, 0, 116, 111, 59, 0, 60, 105, 61, 0, +106, 0, 25, 55, 126, 56, 60, 119, 61, 0, +27, 55, 126, 56, 60, 119, 61, 0, 26, 120, +58, 105, 0, 26, 120, 58, 105, 19, 58, 105, +0, 26, 120, 58, 105, 119, 0, 126, 0, 120, +28, 126, 0, 11, 55, 126, 56, 117, 0, 11, +55, 126, 56, 117, 8, 117, 0, 14, 55, 126, +56, 117, 0, 15, 117, 14, 55, 126, 56, 0, +20, 55, 126, 59, 126, 59, 126, 56, 117, 0, +20, 55, 126, 59, 126, 59, 56, 117, 0, 20, +55, 126, 59, 59, 126, 56, 117, 0, 20, 55, +126, 59, 59, 56, 117, 0, 20, 55, 59, 126, +59, 126, 56, 117, 0, 20, 55, 59, 126, 59, +56, 117, 0, 20, 55, 59, 59, 126, 56, 117, +0, 20, 55, 59, 59, 56, 117, 0, 21, 55, +37, 23, 126, 56, 117, 0, 22, 55, 37, 23, +126, 56, 117, 0, 131, 0, 131, 0, 55, 126, +56, 0, 126, 62, 126, 0, 126, 54, 126, 0, +126, 53, 126, 0, 126, 52, 126, 0, 126, 44, +126, 0, 126, 45, 126, 0, 126, 46, 126, 0, +126, 47, 126, 0, 45, 126, 0, 46, 126, 0, +36, 0, 126, 96, 126, 58, 126, 0, 126, 48, +126, 0, 126, 49, 126, 0, 126, 86, 126, 0, +126, 87, 126, 0, 126, 84, 126, 0, 126, 85, +126, 0, 126, 89, 126, 0, 126, 71, 126, 0, +126, 72, 126, 0, 126, 88, 126, 0, 126, 90, +126, 0, 126, 97, 126, 0, 126, 65, 126, 0, +64, 126, 0, 63, 126, 0, 42, 0, 43, 0, +35, 0, 7, 0, 127, 0, 128, 0, 38, 0, +41, 0, 37, 0, 37, 92, 139, 99, 0, 3, +55, 108, 56, 60, 105, 61, 0, 126, 51, 38, +0, 126, 51, 38, 92, 139, 99, 0, 126, 66, +129, 0, 126, 67, 129, 0, 38, 0, 55, 126, +56, 0, 69, 0, 68, 0, 73, 126, 0, 74, +126, 0, 75, 126, 0, 76, 126, 0, 77, 126, +0, 78, 126, 0, 79, 126, 0, 80, 126, 0, +81, 126, 0, 82, 126, 0, 132, 0, 133, 0, +111, 0, 37, 50, 126, 0, 37, 92, 139, 99, +50, 126, 0, 37, 130, 0, 37, 92, 139, 99, +130, 0, 127, 130, 0, 127, 50, 126, 0, 127, +50, 60, 135, 61, 0, 38, 55, 134, 56, 0, +38, 91, 38, 55, 134, 56, 0, 126, 51, 38, +55, 134, 56, 0, 126, 55, 134, 56, 0, 32, +55, 126, 56, 0, 32, 55, 126, 57, 41, 56, +0, 0, 135, 0, 126, 0, 135, 57, 126, 0, +0, 137, 0, 138, 0, 137, 138, 0, 38, 50, +126, 59, 0, 39, 38, 50, 126, 59, 0, 24, +50, 126, 59, 0, 38, 92, 139, 99, 50, 126, +59, 0, 39, 38, 92, 139, 99, 50, 126, 59, +0, 126, 0, 139, 57, 126, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, - 161, 166, 168, 173, 175, 177, 182, 187, 189, 194, - 196, 201, 202, 203, 204, 205, 206, 207, 209, 211, - 213, 215, 217, 219, 221, 226, 228, 233, 235, 240, - 242, 247, 252, 254, 256, 258, 260, 262, 267, 269, - 274, 276, 281, 283, 288, 290, 292, 294, 299, 301, - 306, 308, 313, 315, 320, 322, 324, 329, 331, 336, - 338, 343, 345, 350, 352, 354, 356, 358, 360, 362, - 364, 369, 371, 376, 381, 383, 385, 387, 389, 391, - 393, 395, 397, 399, 401, 403, 405, 407, 409, 411, - 413, 415, 417, 419, 421, 423, 425, 427, 429, 431, - 433, 435, 437, 439, 441, 443, 445, 447, 449, 451, - 453, 455, 457, 459, 477, 479, 484, 486, 491, 493, - 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, - 518, 520, 525, 527, 529, 531, 533, 535, 537, 539, - 541, 543, 548, 550, 552, 557, 559, 564, 566, 571, - 573, 578, 580, 585, 587, 592, 594, 596, 598, 600, - 605, 607 +161, 166, 168, 173, 175, 177, 182, 187, 189, 194, +196, 201, 202, 203, 204, 205, 206, 207, 209, 211, +213, 215, 217, 219, 221, 226, 228, 233, 235, 240, +242, 247, 252, 254, 256, 258, 260, 262, 267, 269, +274, 276, 281, 283, 288, 290, 292, 294, 299, 301, +306, 308, 313, 315, 320, 322, 324, 329, 331, 336, +338, 343, 345, 350, 352, 354, 356, 358, 360, 362, +364, 369, 371, 376, 381, 383, 385, 387, 389, 391, +393, 395, 397, 399, 401, 403, 405, 407, 409, 411, +413, 415, 417, 419, 421, 423, 425, 427, 429, 431, +433, 435, 437, 439, 441, 443, 445, 447, 449, 451, +453, 455, 457, 459, 477, 479, 484, 486, 491, 493, +498, 500, 502, 504, 506, 508, 510, 512, 514, 516, +518, 520, 525, 527, 529, 531, 533, 535, 537, 539, +541, 543, 548, 550, 552, 554, 559, 561, 566, 568, +573, 575, 580, 582, 587, 589, 594, 596, 598, 600, +602, 607, 609 }; -static const char * const yytname[] = { "$","error","$undefined.","rwDEFINE", +static const char * const yytname[] = { "$","error","$undefined.","rwDEFINE", "rwENDDEF","rwDECLARE","rwDECLARESINGLETON","rwBREAK","rwELSE","rwCONTINUE", "rwGLOBAL","rwIF","rwNIL","rwRETURN","rwWHILE","rwDO","rwENDIF","rwENDWHILE", "rwENDFOR","rwDEFAULT","rwFOR","rwFOREACH","rwFOREACHSTR","rwIN","rwDATABLOCK", @@ -363,787 +363,805 @@ static const char * const yytname[] = { "$","error","$undefined.","rwDEFINE", }; #endif -static const short yyr1[] = { 0, - 100, 101, 101, 102, 102, 102, 103, 104, 104, 105, - 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, - 106, 106, 106, 106, 106, 107, 107, 108, 108, 109, - 109, 110, 111, 111, 111, 111, 111, 111, 112, 112, - 113, 113, 114, 114, 115, 115, 115, 115, 116, 116, - 117, 117, 118, 118, 119, 119, 119, 120, 120, 121, - 121, 122, 122, 123, 123, 123, 123, 123, 123, 123, - 123, 124, 124, 125, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 127, 127, 128, 128, 129, 129, - 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, - 130, 130, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 132, 132, 132, 133, 133, 134, 134, 135, - 135, 136, 136, 137, 137, 138, 138, 138, 138, 138, - 139, 139 +static const short yyr1[] = { 0, +100, 101, 101, 102, 102, 102, 103, 104, 104, 105, +105, 106, 106, 106, 106, 106, 106, 106, 106, 106, +106, 106, 106, 106, 106, 107, 107, 108, 108, 109, +109, 110, 111, 111, 111, 111, 111, 111, 112, 112, +113, 113, 114, 114, 115, 115, 115, 115, 116, 116, +117, 117, 118, 118, 119, 119, 119, 120, 120, 121, +121, 122, 122, 123, 123, 123, 123, 123, 123, 123, +123, 124, 124, 125, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 126, 126, 126, 126, 126, 126, +126, 126, 126, 126, 127, 127, 128, 128, 129, 129, +130, 130, 130, 130, 130, 130, 130, 130, 130, 130, +130, 130, 131, 131, 131, 131, 131, 131, 131, 131, +131, 131, 132, 132, 132, 132, 133, 133, 134, 134, +135, 135, 136, 136, 137, 137, 138, 138, 138, 138, +138, 139, 139 }; -static const short yyr2[] = { 0, - 1, 0, 2, 1, 1, 1, 6, 1, 2, 0, - 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, - 3, 2, 4, 6, 1, 8, 10, 0, 1, 1, - 3, 10, 10, 7, 12, 9, 10, 7, 0, 2, - 0, 1, 0, 2, 0, 1, 1, 2, 2, 3, - 3, 1, 7, 7, 4, 7, 5, 1, 3, 5, - 7, 5, 6, 9, 8, 8, 7, 8, 7, 7, - 6, 7, 7, 1, 1, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 1, 5, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 7, 3, 6, 3, 3, 1, 3, - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 1, 1, 3, 6, 2, 5, 2, - 3, 5, 4, 6, 6, 4, 6, 0, 1, 1, - 3, 0, 1, 1, 2, 4, 5, 4, 7, 8, - 1, 3 +static const short yyr2[] = { 0, +1, 0, 2, 1, 1, 1, 6, 1, 2, 0, +2, 1, 1, 1, 1, 1, 1, 2, 2, 2, +3, 2, 4, 6, 1, 8, 10, 0, 1, 1, +3, 10, 10, 7, 12, 9, 10, 7, 0, 2, +0, 1, 0, 2, 0, 1, 1, 2, 2, 3, +3, 1, 7, 7, 4, 7, 5, 1, 3, 5, +7, 5, 6, 9, 8, 8, 7, 8, 7, 7, +6, 7, 7, 1, 1, 3, 3, 3, 3, 3, +3, 3, 3, 3, 2, 2, 1, 5, 3, 3, +3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +3, 2, 2, 1, 1, 1, 1, 1, 1, 1, +1, 1, 4, 7, 3, 6, 3, 3, 1, 3, +1, 1, 2, 2, 2, 2, 2, 2, 2, 2, +2, 2, 1, 1, 1, 3, 6, 2, 5, 2, +3, 5, 4, 6, 6, 4, 4, 6, 0, 1, +1, 3, 0, 1, 1, 2, 4, 5, 4, 7, +8, 1, 3 }; -static const short yydefact[] = { 2, - 1, 0, 0, 0, 107, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 106, 87, - 112, 110, 25, 111, 104, 105, 0, 0, 0, 0, - 0, 3, 6, 4, 5, 16, 135, 17, 12, 13, - 14, 15, 0, 0, 108, 109, 75, 133, 134, 0, - 28, 119, 0, 0, 0, 18, 19, 0, 0, 107, - 87, 20, 0, 75, 0, 10, 52, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 122, 121, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 138, 148, 0, 85, 86, 0, 103, 102, 22, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 140, 28, 0, 30, - 0, 29, 0, 41, 41, 0, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 136, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 161, 0, 150, 0, 149, 0, 76, 81, 82, - 83, 84, 89, 90, 115, 80, 79, 78, 77, 101, - 117, 118, 96, 97, 93, 94, 91, 92, 98, 95, - 99, 0, 100, 0, 141, 0, 0, 0, 0, 120, - 41, 39, 42, 39, 0, 0, 51, 11, 0, 0, - 0, 0, 0, 0, 39, 0, 0, 0, 0, 8, - 146, 0, 0, 23, 0, 113, 143, 0, 148, 148, - 0, 0, 0, 0, 28, 10, 31, 0, 0, 43, - 43, 60, 62, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 9, 0, 0, 162, 0, - 139, 151, 0, 0, 0, 88, 142, 10, 0, 0, - 39, 40, 0, 0, 0, 0, 63, 71, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 147, 24, 137, 144, 145, 116, 0, 0, 114, - 43, 44, 34, 38, 61, 70, 69, 0, 67, 0, - 0, 0, 72, 73, 152, 0, 58, 53, 54, 26, - 10, 0, 45, 45, 68, 66, 65, 0, 0, 0, - 0, 0, 153, 154, 0, 10, 0, 36, 0, 0, - 47, 46, 0, 64, 0, 0, 0, 0, 0, 155, - 59, 55, 27, 45, 49, 33, 0, 48, 37, 0, - 0, 0, 0, 0, 32, 0, 57, 0, 50, 158, - 156, 0, 0, 0, 10, 35, 0, 157, 0, 56, - 0, 0, 159, 0, 160, 0, 0, 0 +static const short yydefact[] = { 2, +1, 0, 0, 0, 107, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 106, 87, +112, 110, 25, 111, 104, 105, 0, 0, 0, 0, +0, 3, 6, 4, 5, 16, 135, 17, 12, 13, +14, 15, 0, 0, 108, 109, 75, 133, 134, 0, +28, 119, 0, 0, 0, 18, 19, 0, 0, 107, +87, 20, 0, 75, 0, 10, 52, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 122, 121, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 138, 149, 0, 85, 86, 0, 103, 102, 22, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +149, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 140, 28, 0, +30, 0, 29, 0, 41, 41, 0, 21, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 136, 123, 124, 125, 126, 127, 128, 129, 130, +131, 132, 162, 0, 151, 0, 150, 0, 76, 81, +82, 83, 84, 89, 90, 115, 80, 79, 78, 0, +77, 101, 117, 118, 96, 97, 93, 94, 91, 92, +98, 95, 99, 0, 100, 0, 141, 0, 0, 0, +0, 120, 41, 39, 42, 39, 0, 0, 51, 11, +0, 0, 0, 0, 0, 0, 39, 0, 0, 0, +0, 8, 147, 0, 0, 23, 0, 113, 143, 0, +149, 149, 0, 146, 0, 0, 0, 28, 10, 31, +0, 0, 43, 43, 60, 62, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 9, 0, +0, 163, 0, 139, 152, 0, 0, 0, 88, 142, +10, 0, 0, 39, 40, 0, 0, 0, 0, 63, +71, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 7, 148, 24, 137, 144, 145, 116, +0, 0, 114, 43, 44, 34, 38, 61, 70, 69, +0, 67, 0, 0, 0, 72, 73, 153, 0, 58, +53, 54, 26, 10, 0, 45, 45, 68, 66, 65, +0, 0, 0, 0, 0, 154, 155, 0, 10, 0, +36, 0, 0, 47, 46, 0, 64, 0, 0, 0, +0, 0, 156, 59, 55, 27, 45, 49, 33, 0, +48, 37, 0, 0, 0, 0, 0, 32, 0, 57, +0, 50, 159, 157, 0, 0, 0, 10, 35, 0, +158, 0, 56, 0, 0, 160, 0, 161, 0, 0, +0 }; -static const short yydefgoto[] = { 386, - 1, 32, 33, 219, 139, 67, 35, 131, 132, 36, - 37, 240, 202, 274, 340, 341, 68, 38, 289, 316, - 39, 40, 41, 42, 43, 44, 45, 46, 54, 92, - 64, 48, 49, 165, 166, 332, 342, 334, 163 +static const short yydefgoto[] = { 389, +1, 32, 33, 221, 140, 67, 35, 132, 133, 36, +37, 243, 204, 277, 343, 344, 68, 38, 292, 319, +39, 40, 41, 42, 43, 44, 45, 46, 54, 92, +64, 48, 49, 166, 167, 335, 345, 337, 164 }; -static const short yypact[] = {-32768, - 210, -14, -2, -2, -38, -28, -11, 829, 4, 418, - 13, 64, 69, -2, 70, 71, 85, 72,-32768, 52, - 462, -40,-32768,-32768,-32768,-32768, 1225, 1225, 1225, 1225, - 1225,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 75, 2688, 560,-32768, 76,-32768,-32768, -22, - 92,-32768, 1225, 81, 86,-32768,-32768, 1225, 88,-32768, --32768,-32768, 1338,-32768, 1225,-32768,-32768, 116, 873, 103, - 107, 90, 1225, 1225, 96, 1225, 1225, 1225,-32768,-32768, - 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, 1225, - 1225,-32768, 1225, 93, 30, 30, 1392, 30, 30,-32768, - 1225, 1225, 1225, 1225, 1225, 1225, 108, 1225, 1225, 1225, - 1225, 1225, -2, -2, 1225, 1225, 1225, 1225, 1225, 1225, - 1225, 1225, 1225, 1225, 1225, 917,-32768, 92, 110,-32768, - 98, 95, 1446, 20, 1225, 1500,-32768, 1554, 550, 105, - 961, 1608, 138, 139, 1225, 1662, 1716, 164, 1230, 1284, - 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, 2688, - 2688, 2688, -39, 2688, 117, 115, 119,-32768, 47, 47, - 30, 30, 2945, 2945, -25, 2829, 2887, 30, 2858, 257, --32768,-32768, 421, 421, 2916, 2916, 2945, 2945, 2800, 2771, - 257, 1770, 257, 1225, 2688, 121, 120, 118, 151,-32768, - 1225, 133, 2688, 133, 418, 418,-32768,-32768, 1225, 1005, - 1824, 1049, 1225, 1225, 1878, 132, 134, 155, 11,-32768, --32768, 154, 1225,-32768, 1225, 2950,-32768, 1225, 1225, 1225, - 1225, 1225, -15, 136, 92,-32768,-32768, 101, 159, 141, - 141, 193,-32768, 1932, 418, 1986, 1093, 1137, 2040, 2094, - 2148, 146, 177, 177, 147,-32768, 153, 2202, 2688, 1225, --32768, 2688, 156, 158, -35, 2742,-32768,-32768, 162, 650, - 133,-32768, 1225, 166, 170, 418,-32768,-32768, 418, 418, - 2256, 418, 2310, 1181, 418, 418, 150, 1225, 167, 168, --32768,-32768,-32768, 2688,-32768,-32768,-32768, 695, 160,-32768, - 141, 115, 173, 176,-32768,-32768,-32768, 418,-32768, 418, - 418, 2364,-32768,-32768, 68, 12, 2688,-32768,-32768,-32768, --32768, 171, 94, 94,-32768,-32768,-32768, 418, 161, -21, - 200, 179, 68,-32768, 1225,-32768, 740, 181, 184, 188, - 99, 94, 196,-32768, 1225, 1225, 1225, -18, 195,-32768, - 2688, 144,-32768, 94,-32768,-32768, 199, 99,-32768, 2418, - 2472, -9, 1225, 1225,-32768, 201,-32768, 202,-32768,-32768, --32768, 211, 2526, -8,-32768,-32768, 1225,-32768, 212, 785, - 2580, 1225,-32768, 2634,-32768, 260, 264,-32768 +static const short yypact[] = { -32768, +213, -7, 55, 55, -37, -25, -18, 490, -13, 422, +5, 14, 41, 55, 47, 49, 9, 51,-32768, 57, +566, -23,-32768,-32768,-32768,-32768, 1187, 1187, 1187, 1187, +1187,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, -5, 2650, 3021,-32768, 35,-32768,-32768, -12, +62,-32768, 1187, 67, 68,-32768,-32768, 1187, 69,-32768, +-32768,-32768, 1300,-32768, 1187,-32768,-32768, 103, 835, 88, +89, 77, 1187, 1187, 73, 1187, 1187, 1187,-32768,-32768, +1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1187, +1187,-32768, 1187, 96, 219, 219, 1354, 219, 219,-32768, +1187, 1187, 1187, 1187, 1187, 1187, 97, 1187, 1187, 1187, +1187, 1187, 1187, 55, 55, 1187, 1187, 1187, 1187, 1187, +1187, 1187, 1187, 1187, 1187, 1187, 879,-32768, 62, 98, +-32768, 81, 91, 1408, 21, 1187, 1462,-32768, 1516, 556, +95, 923, 1570, 123, 131, 1187, 1624, 1678, 152, 1192, +1246, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, 2650, +2650, 2650, 2650, -38, 2650, 100, 104, 111,-32768, 145, +145, 219, 219, 3015, 3015, -40, 2845, 2939, 219, 112, +2892, 143,-32768,-32768, 277, 277, 2986, 2986, 3015, 3015, +2798, 2751, 143, 1732, 143, 1187, 2650, 113, 116, 107, +135,-32768, 1187, 119, 2650, 119, 422, 422,-32768,-32768, +1187, 967, 1786, 1011, 1187, 1187, 1840, 122, 126, 157, +13,-32768,-32768, 162, 1187,-32768, 1187, 3041,-32768, 1187, +1187, 1187, 1187,-32768, 1187, 44, 144, 62,-32768,-32768, +106, 170, 156, 156, 209,-32768, 1894, 422, 1948, 1055, +1099, 2002, 2056, 2110, 165, 197, 197, 166,-32768, 173, +2164, 2650, 1187,-32768, 2650, 174, 175, -28, 2704,-32768, +-32768, 176, 656, 119,-32768, 1187, 180, 183, 422,-32768, +-32768, 422, 422, 2218, 422, 2272, 1143, 422, 422, 181, +1187, 182, 185,-32768,-32768,-32768, 2650,-32768,-32768,-32768, +701, 184,-32768, 156, 104, 192, 200,-32768,-32768,-32768, +422,-32768, 422, 422, 2326,-32768,-32768, 76, 12, 2650, +-32768,-32768,-32768,-32768, 201, 92, 92,-32768,-32768,-32768, +422, 211, -20, 224, 202, 76,-32768, 1187,-32768, 746, +204, 206, 205, 39, 92, 208,-32768, 1187, 1187, 1187, +-17, 212,-32768, 2650, 138,-32768, 92,-32768,-32768, 216, +39,-32768, 2380, 2434, -21, 1187, 1187,-32768, 221,-32768, +222,-32768,-32768,-32768, 217, 2488, -8,-32768,-32768, 1187, +-32768, 230, 791, 2542, 1187,-32768, 2596,-32768, 289, 290, +-32768 }; -static const short yypgoto[] = {-32768, --32768,-32768,-32768,-32768, -233, 0, -132, -120,-32768,-32768, - -304, -176, -123, -228, -277, -76, -200,-32768, -243,-32768, --32768,-32768,-32768,-32768,-32768, 285,-32768,-32768, 3, -43, - -1,-32768,-32768, -108, -184,-32768, -48, -299, -227 +static const short yypgoto[] = { -32768, +-32768,-32768,-32768,-32768, -236, 0, -132, -118,-32768,-32768, +-306, -192, -113, -231, -262, -54, -202,-32768, -247,-32768, +-32768,-32768,-32768,-32768,-32768, 288,-32768,-32768, 4, -43, +-1,-32768,-32768, -104, -184,-32768, -26, -295, -229 }; -#define YYLAST 3042 +#define YYLAST 3123 -static const short yytable[] = { 47, - 34, 127, 270, 265, 242, 243, 55, 196, 47, 233, - 290, 204, 275, 218, 93, 220, 72, 225, 339, 339, - 56, 225, 59, 50, 3, 4, 60, 241, 346, 230, - 57, 363, 128, 350, 298, 52, 357, 339, 252, 335, - 51, 228, 350, 58, 278, 267, 343, 225, 225, 339, - 94, 18, 53, 357, 19, 61, 21, 22, 65, 226, - 24, 25, 26, 297, 27, 28, 231, 69, 129, 336, - 347, 255, 322, 364, 29, 305, 368, 238, 306, 307, - 107, 309, 30, 31, 313, 314, 256, 337, 302, 372, - 379, 329, 103, 104, 301, 113, 114, 107, 3, 4, - 110, 77, 352, 3, 4, 330, 331, 325, 367, 326, - 327, 201, 113, 114, 269, 181, 182, 329, 70, 362, - 263, 264, 75, 71, 73, 74, 76, 344, 130, 140, - 167, 330, 331, 100, -74, 134, 374, 47, 208, 143, - 135, 380, 51, 144, 145, 175, 59, 197, 3, 4, - 5, 199, 6, 198, 7, 148, 8, 9, 10, 209, - 213, 214, 366, 11, 12, 13, 218, 14, 15, 288, - 16, 228, 227, 229, 235, 18, 234, 236, 19, 20, - 21, 22, 261, 23, 24, 25, 26, 237, 27, 28, - 239, 253, 50, 254, 257, 268, 272, 273, 29, 271, - 276, 287, 288, 47, 47, 291, 30, 31, 292, 315, - 345, 295, 2, 296, 3, 4, 5, 299, 6, 321, - 7, 303, 8, 9, 10, 304, 338, 318, 319, 11, - 12, 13, 323, 14, 15, 324, 16, 348, 17, 349, - 354, 18, 355, 47, 19, 20, 21, 22, 356, 23, - 24, 25, 26, 365, 27, 28, 359, 369, 375, 387, - 377, 382, 376, 388, 29, 358, 333, 0, 47, 208, - 0, 0, 30, 31, 47, 0, 0, 47, 47, 0, - 47, 0, 0, 47, 47, 0, 0, 0, 0, 0, - 0, 0, 63, 0, 0, 0, 47, 208, 0, 0, - 101, 102, 103, 104, 0, 0, 47, 107, 47, 47, - 110, 95, 96, 97, 98, 99, 0, 0, 0, 0, - 0, 0, 113, 114, 0, 0, 47, 115, 116, 0, - 0, 0, 0, 0, 0, 47, 208, 133, 0, 0, - 0, 0, 136, 0, 0, 0, 0, 0, 0, 138, - 47, 208, 0, 142, 0, 0, 0, 146, 147, 0, - 149, 150, 151, 0, 0, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 0, 164, 47, 208, - 0, 0, 0, 0, 0, 169, 170, 171, 172, 173, - 174, 0, 176, 177, 178, 179, 180, 0, 0, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 195, 0, 0, 0, 0, 0, 0, 0, 203, 203, - 59, 0, 3, 4, 5, 211, 6, 0, 7, 215, - 8, 9, 10, 0, 0, 0, 0, 11, 12, 13, - 0, 14, 15, 0, 16, 0, 0, 0, 0, 18, - 0, 0, 19, 20, 21, 22, 0, 23, 24, 25, - 26, 0, 27, 28, 101, 102, 103, 104, 0, 0, - 0, 107, 29, 0, 110, 0, 0, 66, 164, 0, - 30, 31, 0, 0, 0, 203, 113, 114, 0, 0, - 0, 0, 0, 244, 246, 0, 249, 250, 251, 0, - 0, 0, 0, 0, 0, 0, 0, 258, 0, 259, - 0, 78, 262, 164, 164, 162, 266, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, - 80, 281, 283, 0, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 294, 0, 0, 0, 0, 0, - 0, 0, 59, 91, 3, 4, 5, 164, 6, 0, - 7, 0, 8, 9, 10, 0, 0, 0, 312, 11, - 12, 13, 317, 14, 15, 0, 16, 0, 0, 0, - 0, 18, 0, 0, 19, 20, 21, 22, 0, 23, - 24, 25, 26, 0, 27, 28, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 0, 0, 0, 0, 126, - 207, 0, 30, 31, 0, 0, 0, 0, 0, 351, - 0, 0, 0, 0, 0, 0, 0, 79, 80, 360, - 361, 162, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 0, 0, 0, 0, 0, 373, 162, 0, - 0, 0, 59, 0, 3, 4, 5, 0, 6, 0, - 7, 381, 8, 9, 10, 0, 384, 0, 0, 11, - 12, 13, 0, 14, 15, 0, 16, 0, 0, 0, - 0, 18, 0, 0, 19, 20, 21, 22, 0, 23, - 24, 25, 26, 0, 27, 28, 0, 59, 0, 3, - 4, 5, 0, 6, 29, 7, 0, 8, 9, 10, - 300, 0, 30, 31, 11, 12, 13, 0, 14, 15, - 0, 16, 0, 0, 0, 0, 18, 0, 0, 19, - 20, 21, 22, 0, 23, 24, 25, 26, 0, 27, - 28, 0, 59, 0, 3, 4, 5, 0, 6, 29, - 7, 0, 8, 9, 10, 320, 0, 30, 31, 11, - 12, 13, 0, 14, 15, 0, 16, 0, 0, 0, - 0, 18, 0, 0, 19, 20, 21, 22, 0, 23, - 24, 25, 26, 0, 27, 28, 0, 59, 0, 3, - 4, 5, 0, 6, 29, 7, 0, 8, 9, 10, - 353, 0, 30, 31, 11, 12, 13, 0, 14, 15, - 0, 16, 0, 0, 0, 0, 18, 0, 0, 19, - 20, 21, 22, 0, 23, 24, 25, 26, 0, 27, - 28, 59, 0, 3, 4, 60, 0, 0, 0, 29, - 0, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 0, 0, 19, 61, 21, 22, 0, 0, 24, - 25, 26, 0, 27, 28, 59, 0, 3, 4, 60, - 0, 0, 0, 29, 0, 0, 0, 62, 0, 0, - 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 0, 0, 19, 61, 21, - 22, 0, 0, 24, 25, 26, 0, 27, 28, 59, - 0, 3, 4, 60, 0, 0, 0, 29, 0, 0, - 0, 141, 0, 0, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, - 0, 19, 61, 21, 22, 0, 0, 24, 25, 26, - 0, 27, 28, 59, 0, 3, 4, 60, 0, 0, - 0, 29, 0, 0, 0, 0, 194, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 0, 0, 19, 61, 21, 22, 0, - 0, 24, 25, 26, 0, 27, 28, 59, 0, 3, - 4, 60, 0, 0, 0, 29, 0, 0, 0, 210, - 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 19, - 61, 21, 22, 0, 0, 24, 25, 26, 0, 27, - 28, 59, 0, 3, 4, 60, 0, 0, 0, 29, - 245, 0, 0, 0, 0, 0, 0, 30, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 0, 0, 19, 61, 21, 22, 0, 0, 24, - 25, 26, 0, 27, 28, 59, 0, 3, 4, 60, - 0, 0, 0, 29, 0, 0, 0, 248, 0, 0, - 0, 30, 31, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 0, 0, 19, 61, 21, - 22, 0, 0, 24, 25, 26, 0, 27, 28, 59, - 0, 3, 4, 60, 0, 0, 0, 29, 280, 0, - 0, 0, 0, 0, 0, 30, 31, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, - 0, 19, 61, 21, 22, 0, 0, 24, 25, 26, - 0, 27, 28, 59, 0, 3, 4, 60, 0, 0, - 0, 29, 282, 0, 0, 0, 0, 0, 0, 30, - 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 18, 0, 0, 19, 61, 21, 22, 0, - 0, 24, 25, 26, 0, 27, 28, 59, 0, 3, - 4, 60, 0, 0, 0, 29, 311, 0, 0, 0, - 0, 0, 0, 30, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 19, - 61, 21, 22, 0, 0, 24, 25, 26, 0, 27, - 28, 0, 0, 101, 102, 103, 104, 105, 106, 29, - 107, 108, 109, 110, 0, 221, 222, 30, 31, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 0, - 223, 0, 224, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 137, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 168, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 200, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 205, 0, 0, 0, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 206, - 0, 0, 0, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 212, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 216, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 217, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 0, 0, 232, 0, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 0, - 0, 0, 247, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 239, 0, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 277, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 279, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 0, 0, 0, 284, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 285, - 0, 0, 0, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 286, 0, 0, 0, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 0, 0, 0, - 293, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 308, 0, 0, 0, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 310, 0, 0, 0, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 328, - 0, 0, 0, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 370, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 0, 0, 0, - 371, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 117, 118, 119, 120, 121, - 122, 123, 0, 0, 0, 0, 0, 124, 125, 101, - 102, 103, 104, 105, 106, 0, 107, 108, 109, 110, - 0, 0, 0, 0, 378, 0, 0, 111, 0, 0, - 112, 113, 114, 0, 0, 0, 115, 116, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, - 118, 119, 120, 121, 122, 123, 0, 0, 0, 0, - 0, 124, 125, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 0, 0, 0, 0, 383, 0, - 0, 111, 0, 0, 112, 113, 114, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 117, 118, 119, 120, 121, 122, 123, - 0, 0, 0, 0, 0, 124, 125, 101, 102, 103, - 104, 105, 106, 0, 107, 108, 109, 110, 0, 0, - 0, 0, 385, 0, 0, 111, 0, 0, 112, 113, - 114, 0, 0, 0, 115, 116, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, - 120, 121, 122, 123, 0, 0, 0, 0, 0, 124, - 125, 101, 102, 103, 104, 105, 106, 0, 107, 108, - 109, 110, 0, 0, 0, 0, 0, 0, 0, 111, - 0, 0, 112, 113, 114, 0, 0, 0, 115, 116, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 118, 119, 120, 121, 122, 123, 0, 0, - 0, 0, 0, 124, 125, 101, 102, 103, 104, 105, - 106, 0, 107, 108, 109, 110, 0, 0, 0, 0, - 0, 0, 0, 111, 0, 0, 112, 113, 114, 0, - 0, 0, 115, 116, 101, 102, 103, 104, 105, 106, - 0, 107, 108, 109, 110, 117, 118, 119, 120, 121, - 122, 123, 111, 0, 0, 112, 113, 114, 125, 0, - 0, 115, 116, 101, 102, 103, 104, 105, 106, 0, - 107, 108, 109, 110, 117, 118, 119, 120, 121, 0, - 123, 111, 0, 0, 112, 113, 114, 125, 0, 0, - 115, 116, 101, 102, 103, 104, 105, 106, 0, 107, - 0, 109, 110, 117, 118, 119, 120, 0, 0, 123, - 111, 0, 0, 112, 113, 114, 125, 0, 0, 115, - 116, 101, 102, 103, 104, 105, 106, 0, 107, 0, - 109, 110, 117, 118, 119, 120, 0, 0, 123, 0, - 0, 0, 112, 113, 114, 125, 0, 0, 115, 116, - 101, 102, 103, 104, 105, 106, 0, 107, 0, 0, - 110, 117, 118, 119, 120, 0, 0, 123, 0, 0, - 0, 112, 113, 114, 125, 0, 0, 115, 116, 101, - 102, 103, 104, 105, 106, 0, 107, 0, 0, 110, - 117, 118, 119, 120, 0, 0, 123, 0, 0, 0, - 112, 113, 114, 125, 0, 0, 115, 116, 101, 102, - 103, 104, 0, 0, 0, 107, 0, 0, 110, 260, - 0, 119, 120, 0, 0, 123, 0, 0, 0, 112, - 113, 114, 125, 0, 0, 115, 116, 79, 80, 0, - 0, 0, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 0, 0, 123, 0, 0, 0, 0, 0, - 0, 125 +static const short yytable[] = { 47, +34, 128, 273, 268, 245, 246, 180, 55, 47, 293, +198, 236, 278, 244, 232, 220, 222, 72, 227, 342, +342, 56, 206, 59, 255, 3, 4, 60, 227, 349, +50, 93, 366, 57, 301, 227, 58, 360, 342, 338, +353, 65, 129, 3, 4, 281, 75, 51, 227, 353, +342, 233, 18, 100, 360, 19, 61, 21, 22, 69, +228, 24, 25, 26, 346, 27, 28, 94, 70, 339, +300, 350, 325, 258, 367, 29, 308, 375, 130, 309, +310, 304, 312, 30, 31, 316, 317, 340, 259, 241, +382, 305, 52, -74, 371, 71, 3, 4, 131, 332, +230, 73, 355, 74, 270, 76, 77, 370, 328, 53, +329, 330, 203, 333, 334, 332, 141, 183, 184, 272, +365, 135, 136, 51, 144, 145, 266, 267, 347, 333, +334, 146, 149, 168, 176, 199, 200, 377, 47, 210, +59, 383, 3, 4, 5, 215, 6, 201, 7, 211, +8, 9, 10, 216, 220, 229, 369, 11, 12, 13, +230, 14, 15, 291, 16, 231, 239, 234, 237, 18, +238, 240, 19, 20, 21, 22, 242, 23, 24, 25, +26, 256, 27, 28, 264, 257, 101, 102, 103, 104, +103, 104, 29, 107, 50, 107, 110, 111, 110, 111, +30, 31, 260, 271, 274, 47, 47, 275, 114, 115, +114, 115, 276, 116, 117, 2, 279, 3, 4, 5, +290, 6, 291, 7, 294, 8, 9, 10, 295, 298, +299, 302, 11, 12, 13, 306, 14, 15, 307, 16, +318, 17, 321, 324, 18, 322, 47, 19, 20, 21, +22, 326, 23, 24, 25, 26, 341, 27, 28, 327, +348, 351, 352, 357, 358, 359, 380, 29, 362, 107, +368, 47, 210, 111, 372, 30, 31, 47, 378, 385, +47, 47, 379, 47, 114, 115, 47, 47, 390, 391, +361, 336, 0, 0, 0, 63, 0, 0, 0, 47, +210, 0, 0, 0, 0, 0, 0, 0, 0, 47, +0, 47, 47, 0, 95, 96, 97, 98, 99, 0, +101, 102, 103, 104, 0, 0, 0, 107, 0, 47, +110, 111, 0, 0, 0, 0, 0, 0, 47, 210, +134, 0, 114, 115, 0, 137, 0, 0, 0, 0, +0, 0, 139, 47, 210, 0, 143, 0, 0, 0, +147, 148, 0, 150, 151, 152, 0, 0, 153, 154, +155, 156, 157, 158, 159, 160, 161, 162, 163, 0, +165, 47, 210, 0, 0, 0, 0, 0, 170, 171, +172, 173, 174, 175, 0, 177, 178, 179, 165, 181, +182, 0, 0, 185, 186, 187, 188, 189, 190, 191, +192, 193, 194, 195, 197, 0, 0, 0, 0, 0, +0, 0, 205, 205, 59, 0, 3, 4, 5, 213, +6, 0, 7, 217, 8, 9, 10, 0, 0, 0, +0, 11, 12, 13, 0, 14, 15, 0, 16, 0, +0, 0, 0, 18, 0, 0, 19, 20, 21, 22, +0, 23, 24, 25, 26, 0, 27, 28, 0, 0, +0, 0, 0, 0, 0, 0, 29, 0, 0, 0, +0, 66, 0, 165, 30, 31, 0, 0, 0, 0, +205, 0, 59, 0, 3, 4, 60, 0, 247, 249, +0, 252, 253, 254, 0, 0, 0, 0, 0, 0, +0, 0, 261, 0, 262, 0, 0, 265, 165, 165, +163, 18, 269, 0, 19, 61, 21, 22, 0, 0, +24, 25, 26, 0, 27, 28, 0, 284, 286, 0, +0, 0, 0, 0, 29, 0, 0, 0, 62, 0, +297, 0, 30, 31, 0, 0, 0, 0, 59, 0, +3, 4, 5, 165, 6, 0, 7, 0, 8, 9, +10, 0, 0, 0, 315, 11, 12, 13, 320, 14, +15, 0, 16, 0, 0, 0, 0, 18, 0, 0, +19, 20, 21, 22, 0, 23, 24, 25, 26, 0, +27, 28, 0, 0, 0, 0, 0, 0, 0, 0, +29, 0, 0, 0, 0, 78, 209, 0, 30, 31, +0, 0, 0, 0, 0, 354, 0, 0, 0, 0, +0, 0, 0, 79, 80, 363, 364, 163, 81, 82, +83, 84, 85, 86, 87, 88, 89, 90, 0, 0, +0, 0, 0, 376, 163, 0, 0, 91, 59, 0, +3, 4, 5, 0, 6, 0, 7, 384, 8, 9, +10, 0, 387, 0, 0, 11, 12, 13, 0, 14, +15, 0, 16, 0, 0, 0, 0, 18, 0, 0, +19, 20, 21, 22, 0, 23, 24, 25, 26, 0, +27, 28, 0, 59, 0, 3, 4, 5, 0, 6, +29, 7, 0, 8, 9, 10, 303, 0, 30, 31, +11, 12, 13, 0, 14, 15, 0, 16, 0, 0, +0, 0, 18, 0, 0, 19, 20, 21, 22, 0, +23, 24, 25, 26, 0, 27, 28, 0, 59, 0, +3, 4, 5, 0, 6, 29, 7, 0, 8, 9, +10, 323, 0, 30, 31, 11, 12, 13, 0, 14, +15, 0, 16, 0, 0, 0, 0, 18, 0, 0, +19, 20, 21, 22, 0, 23, 24, 25, 26, 0, +27, 28, 0, 59, 0, 3, 4, 5, 0, 6, +29, 7, 0, 8, 9, 10, 356, 0, 30, 31, +11, 12, 13, 0, 14, 15, 0, 16, 0, 0, +0, 0, 18, 0, 0, 19, 20, 21, 22, 0, +23, 24, 25, 26, 0, 27, 28, 59, 0, 3, +4, 60, 0, 0, 0, 29, 0, 0, 0, 0, +0, 0, 0, 30, 31, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 18, 0, 0, 19, +61, 21, 22, 0, 0, 24, 25, 26, 0, 27, +28, 59, 0, 3, 4, 60, 0, 0, 0, 29, +0, 0, 0, 142, 0, 0, 0, 30, 31, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +18, 0, 0, 19, 61, 21, 22, 0, 0, 24, +25, 26, 0, 27, 28, 59, 0, 3, 4, 60, +0, 0, 0, 29, 0, 0, 0, 0, 196, 0, +0, 30, 31, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 18, 0, 0, 19, 61, 21, +22, 0, 0, 24, 25, 26, 0, 27, 28, 59, +0, 3, 4, 60, 0, 0, 0, 29, 0, 0, +0, 212, 0, 0, 0, 30, 31, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 18, 0, +0, 19, 61, 21, 22, 0, 0, 24, 25, 26, +0, 27, 28, 59, 0, 3, 4, 60, 0, 0, +0, 29, 248, 0, 0, 0, 0, 0, 0, 30, +31, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 18, 0, 0, 19, 61, 21, 22, 0, +0, 24, 25, 26, 0, 27, 28, 59, 0, 3, +4, 60, 0, 0, 0, 29, 0, 0, 0, 251, +0, 0, 0, 30, 31, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 18, 0, 0, 19, +61, 21, 22, 0, 0, 24, 25, 26, 0, 27, +28, 59, 0, 3, 4, 60, 0, 0, 0, 29, +283, 0, 0, 0, 0, 0, 0, 30, 31, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +18, 0, 0, 19, 61, 21, 22, 0, 0, 24, +25, 26, 0, 27, 28, 59, 0, 3, 4, 60, +0, 0, 0, 29, 285, 0, 0, 0, 0, 0, +0, 30, 31, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 18, 0, 0, 19, 61, 21, +22, 0, 0, 24, 25, 26, 0, 27, 28, 59, +0, 3, 4, 60, 0, 0, 0, 29, 314, 0, +0, 0, 0, 0, 0, 30, 31, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 18, 0, +0, 19, 61, 21, 22, 0, 0, 24, 25, 26, +0, 27, 28, 0, 0, 101, 102, 103, 104, 105, +106, 29, 107, 108, 109, 110, 111, 223, 224, 30, +31, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 0, 225, 0, 226, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 138, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 169, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 202, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 207, 0, 0, +0, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 208, 0, 0, 0, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 214, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 218, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 219, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 0, 0, 235, +0, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 0, 0, 0, 250, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 242, 0, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 280, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 282, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 0, 0, 0, +287, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 288, 0, 0, 0, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 289, 0, 0, 0, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 0, +0, 0, 296, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 311, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 313, 0, 0, +0, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 331, 0, 0, 0, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 373, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 0, +0, 0, 374, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 0, 0, 0, 0, 0, 125, +126, 101, 102, 103, 104, 105, 106, 0, 107, 108, +109, 110, 111, 0, 0, 0, 381, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 122, 123, 124, 0, 0, +0, 0, 0, 125, 126, 101, 102, 103, 104, 105, +106, 0, 107, 108, 109, 110, 111, 0, 0, 0, +386, 0, 0, 112, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 122, +123, 124, 0, 0, 0, 0, 0, 125, 126, 101, +102, 103, 104, 105, 106, 0, 107, 108, 109, 110, +111, 0, 0, 0, 388, 0, 0, 112, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 118, +119, 120, 121, 122, 123, 124, 0, 0, 0, 0, +0, 125, 126, 101, 102, 103, 104, 105, 106, 0, +107, 108, 109, 110, 111, 0, 0, 0, 0, 0, +0, 112, 0, 0, 113, 114, 115, 0, 0, 0, +116, 117, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 118, 119, 120, 121, 122, 123, 124, +0, 0, 0, 0, 0, 125, 126, 101, 102, 103, +104, 105, 106, 0, 107, 108, 109, 110, 111, 0, +0, 0, 0, 0, 0, 112, 0, 0, 113, 114, +115, 0, 0, 0, 116, 117, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 118, 119, 120, +121, 122, 123, 124, 101, 102, 103, 104, 105, 106, +126, 107, 108, 109, 110, 111, 0, 0, 0, 0, +0, 0, 112, 0, 0, 113, 114, 115, 0, 0, +0, 116, 117, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 118, 119, 120, 121, 122, 0, +124, 101, 102, 103, 104, 105, 106, 126, 107, 108, +109, 110, 111, 0, 0, 0, 0, 0, 0, 112, +0, 0, 113, 114, 115, 0, 0, 0, 116, 117, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 118, 119, 120, 121, 0, 0, 124, 101, 102, +103, 104, 105, 106, 126, 107, 0, 109, 110, 111, +0, 0, 0, 0, 0, 0, 112, 0, 0, 113, +114, 115, 0, 0, 0, 116, 117, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 118, 119, +120, 121, 0, 0, 124, 101, 102, 103, 104, 105, +106, 126, 107, 0, 109, 110, 111, 0, 0, 0, +0, 0, 0, 0, 0, 0, 113, 114, 115, 0, +0, 0, 116, 117, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 118, 119, 120, 121, 0, +0, 124, 101, 102, 103, 104, 105, 106, 126, 107, +0, 0, 110, 111, 0, 0, 0, 0, 0, 0, +0, 0, 0, 113, 114, 115, 0, 0, 0, 116, +117, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 118, 119, 120, 121, 0, 0, 124, 101, +102, 103, 104, 105, 106, 126, 107, 0, 0, 110, +111, 0, 0, 0, 0, 0, 0, 0, 0, 0, +113, 114, 115, 0, 0, 0, 116, 117, 101, 102, +103, 104, 0, 0, 0, 107, 0, 0, 110, 111, +127, 120, 121, 0, 0, 124, 0, 0, 0, 113, +114, 115, 126, 0, 0, 116, 117, 0, 79, 80, +263, 0, 0, 81, 82, 83, 84, 85, 86, 87, +88, 89, 90, 0, 124, 0, 0, 0, 79, 80, +0, 126, 0, 81, 82, 83, 84, 85, 86, 87, +88, 89, 90 }; -static const short yycheck[] = { 1, - 1, 45, 236, 231, 205, 206, 4, 128, 10, 194, - 254, 135, 241, 3, 55, 148, 14, 57, 323, 324, - 59, 57, 3, 38, 5, 6, 7, 204, 50, 55, - 59, 50, 55, 333, 268, 38, 341, 342, 215, 28, - 55, 57, 342, 55, 245, 61, 324, 57, 57, 354, - 91, 32, 55, 358, 35, 36, 37, 38, 55, 99, - 41, 42, 43, 99, 45, 46, 92, 55, 91, 58, - 92, 61, 301, 92, 55, 276, 354, 201, 279, 280, - 51, 282, 63, 64, 285, 286, 219, 321, 273, 99, - 99, 24, 46, 47, 271, 66, 67, 51, 5, 6, - 54, 50, 336, 5, 6, 38, 39, 308, 352, 310, - 311, 92, 66, 67, 235, 113, 114, 24, 55, 347, - 229, 230, 38, 55, 55, 55, 55, 328, 37, 14, - 38, 38, 39, 59, 59, 55, 364, 139, 139, 37, - 55, 375, 55, 37, 55, 38, 3, 38, 5, 6, - 7, 57, 9, 56, 11, 60, 13, 14, 15, 55, - 23, 23, 19, 20, 21, 22, 3, 24, 25, 26, - 27, 57, 56, 55, 55, 32, 56, 60, 35, 36, - 37, 38, 226, 40, 41, 42, 43, 37, 45, 46, - 58, 60, 38, 60, 41, 60, 38, 57, 55, 99, - 8, 56, 26, 205, 206, 59, 63, 64, 56, 60, - 50, 56, 3, 56, 5, 6, 7, 56, 9, 60, - 11, 56, 13, 14, 15, 56, 56, 61, 61, 20, - 21, 22, 60, 24, 25, 60, 27, 38, 29, 61, - 60, 32, 59, 245, 35, 36, 37, 38, 61, 40, - 41, 42, 43, 59, 45, 46, 61, 59, 58, 0, - 50, 50, 61, 0, 55, 342, 315, -1, 270, 270, - -1, -1, 63, 64, 276, -1, -1, 279, 280, -1, - 282, -1, -1, 285, 286, -1, -1, -1, -1, -1, - -1, -1, 8, -1, -1, -1, 298, 298, -1, -1, - 44, 45, 46, 47, -1, -1, 308, 51, 310, 311, - 54, 27, 28, 29, 30, 31, -1, -1, -1, -1, - -1, -1, 66, 67, -1, -1, 328, 71, 72, -1, - -1, -1, -1, -1, -1, 337, 337, 53, -1, -1, - -1, -1, 58, -1, -1, -1, -1, -1, -1, 65, - 352, 352, -1, 69, -1, -1, -1, 73, 74, -1, - 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 91, -1, 93, 380, 380, - -1, -1, -1, -1, -1, 101, 102, 103, 104, 105, - 106, -1, 108, 109, 110, 111, 112, -1, -1, 115, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, -1, -1, -1, -1, -1, -1, -1, 134, 135, - 3, -1, 5, 6, 7, 141, 9, -1, 11, 145, - 13, 14, 15, -1, -1, -1, -1, 20, 21, 22, - -1, 24, 25, -1, 27, -1, -1, -1, -1, 32, - -1, -1, 35, 36, 37, 38, -1, 40, 41, 42, - 43, -1, 45, 46, 44, 45, 46, 47, -1, -1, - -1, 51, 55, -1, 54, -1, -1, 60, 194, -1, - 63, 64, -1, -1, -1, 201, 66, 67, -1, -1, - -1, -1, -1, 209, 210, -1, 212, 213, 214, -1, - -1, -1, -1, -1, -1, -1, -1, 223, -1, 225, - -1, 50, 228, 229, 230, 231, 232, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, - 69, 247, 248, -1, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 260, -1, -1, -1, -1, -1, - -1, -1, 3, 92, 5, 6, 7, 273, 9, -1, - 11, -1, 13, 14, 15, -1, -1, -1, 284, 20, - 21, 22, 288, 24, 25, -1, 27, -1, -1, -1, - -1, 32, -1, -1, 35, 36, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, -1, -1, -1, -1, - -1, -1, -1, -1, 55, -1, -1, -1, -1, 50, - 61, -1, 63, 64, -1, -1, -1, -1, -1, 335, - -1, -1, -1, -1, -1, -1, -1, 68, 69, 345, - 346, 347, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, -1, -1, -1, -1, -1, 363, 364, -1, - -1, -1, 3, -1, 5, 6, 7, -1, 9, -1, - 11, 377, 13, 14, 15, -1, 382, -1, -1, 20, - 21, 22, -1, 24, 25, -1, 27, -1, -1, -1, - -1, 32, -1, -1, 35, 36, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, -1, 3, -1, 5, - 6, 7, -1, 9, 55, 11, -1, 13, 14, 15, - 61, -1, 63, 64, 20, 21, 22, -1, 24, 25, - -1, 27, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, 40, 41, 42, 43, -1, 45, - 46, -1, 3, -1, 5, 6, 7, -1, 9, 55, - 11, -1, 13, 14, 15, 61, -1, 63, 64, 20, - 21, 22, -1, 24, 25, -1, 27, -1, -1, -1, - -1, 32, -1, -1, 35, 36, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, -1, 3, -1, 5, - 6, 7, -1, 9, 55, 11, -1, 13, 14, 15, - 61, -1, 63, 64, 20, 21, 22, -1, 24, 25, - -1, 27, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, 40, 41, 42, 43, -1, 45, - 46, 3, -1, 5, 6, 7, -1, -1, -1, 55, - -1, -1, -1, -1, -1, -1, -1, 63, 64, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 32, -1, -1, 35, 36, 37, 38, -1, -1, 41, - 42, 43, -1, 45, 46, 3, -1, 5, 6, 7, - -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, - -1, 63, 64, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 32, -1, -1, 35, 36, 37, - 38, -1, -1, 41, 42, 43, -1, 45, 46, 3, - -1, 5, 6, 7, -1, -1, -1, 55, -1, -1, - -1, 59, -1, -1, -1, 63, 64, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, - -1, 35, 36, 37, 38, -1, -1, 41, 42, 43, - -1, 45, 46, 3, -1, 5, 6, 7, -1, -1, - -1, 55, -1, -1, -1, -1, 60, -1, -1, 63, - 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 32, -1, -1, 35, 36, 37, 38, -1, - -1, 41, 42, 43, -1, 45, 46, 3, -1, 5, - 6, 7, -1, -1, -1, 55, -1, -1, -1, 59, - -1, -1, -1, 63, 64, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, -1, 41, 42, 43, -1, 45, - 46, 3, -1, 5, 6, 7, -1, -1, -1, 55, - 56, -1, -1, -1, -1, -1, -1, 63, 64, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 32, -1, -1, 35, 36, 37, 38, -1, -1, 41, - 42, 43, -1, 45, 46, 3, -1, 5, 6, 7, - -1, -1, -1, 55, -1, -1, -1, 59, -1, -1, - -1, 63, 64, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 32, -1, -1, 35, 36, 37, - 38, -1, -1, 41, 42, 43, -1, 45, 46, 3, - -1, 5, 6, 7, -1, -1, -1, 55, 56, -1, - -1, -1, -1, -1, -1, 63, 64, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 32, -1, - -1, 35, 36, 37, 38, -1, -1, 41, 42, 43, - -1, 45, 46, 3, -1, 5, 6, 7, -1, -1, - -1, 55, 56, -1, -1, -1, -1, -1, -1, 63, - 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 32, -1, -1, 35, 36, 37, 38, -1, - -1, 41, 42, 43, -1, 45, 46, 3, -1, 5, - 6, 7, -1, -1, -1, 55, 56, -1, -1, -1, - -1, -1, -1, 63, 64, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 32, -1, -1, 35, - 36, 37, 38, -1, -1, 41, 42, 43, -1, 45, - 46, -1, -1, 44, 45, 46, 47, 48, 49, 55, - 51, 52, 53, 54, -1, 56, 57, 63, 64, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, -1, - 57, -1, 59, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, 59, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, 56, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, 56, -1, -1, -1, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, 56, - -1, -1, -1, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, 59, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, 56, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, -1, -1, 58, -1, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, -1, - -1, -1, 59, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, 58, -1, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, 56, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, -1, -1, -1, 59, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, 56, - -1, -1, -1, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, 56, -1, -1, -1, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, -1, -1, -1, - 59, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, 56, -1, -1, -1, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, 56, - -1, -1, -1, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, 59, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, -1, -1, -1, - 59, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 84, 85, 86, 87, 88, - 89, 90, -1, -1, -1, -1, -1, 96, 97, 44, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - -1, -1, -1, -1, 59, -1, -1, 62, -1, -1, - 65, 66, 67, -1, -1, -1, 71, 72, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, 97, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, -1, -1, -1, -1, 59, -1, - -1, 62, -1, -1, 65, 66, 67, -1, -1, -1, - 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, 96, 97, 44, 45, 46, - 47, 48, 49, -1, 51, 52, 53, 54, -1, -1, - -1, -1, 59, -1, -1, 62, -1, -1, 65, 66, - 67, -1, -1, -1, 71, 72, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, 86, - 87, 88, 89, 90, -1, -1, -1, -1, -1, 96, - 97, 44, 45, 46, 47, 48, 49, -1, 51, 52, - 53, 54, -1, -1, -1, -1, -1, -1, -1, 62, - -1, -1, 65, 66, 67, -1, -1, -1, 71, 72, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, 85, 86, 87, 88, 89, 90, -1, -1, - -1, -1, -1, 96, 97, 44, 45, 46, 47, 48, - 49, -1, 51, 52, 53, 54, -1, -1, -1, -1, - -1, -1, -1, 62, -1, -1, 65, 66, 67, -1, - -1, -1, 71, 72, 44, 45, 46, 47, 48, 49, - -1, 51, 52, 53, 54, 84, 85, 86, 87, 88, - 89, 90, 62, -1, -1, 65, 66, 67, 97, -1, - -1, 71, 72, 44, 45, 46, 47, 48, 49, -1, - 51, 52, 53, 54, 84, 85, 86, 87, 88, -1, - 90, 62, -1, -1, 65, 66, 67, 97, -1, -1, - 71, 72, 44, 45, 46, 47, 48, 49, -1, 51, - -1, 53, 54, 84, 85, 86, 87, -1, -1, 90, - 62, -1, -1, 65, 66, 67, 97, -1, -1, 71, - 72, 44, 45, 46, 47, 48, 49, -1, 51, -1, - 53, 54, 84, 85, 86, 87, -1, -1, 90, -1, - -1, -1, 65, 66, 67, 97, -1, -1, 71, 72, - 44, 45, 46, 47, 48, 49, -1, 51, -1, -1, - 54, 84, 85, 86, 87, -1, -1, 90, -1, -1, - -1, 65, 66, 67, 97, -1, -1, 71, 72, 44, - 45, 46, 47, 48, 49, -1, 51, -1, -1, 54, - 84, 85, 86, 87, -1, -1, 90, -1, -1, -1, - 65, 66, 67, 97, -1, -1, 71, 72, 44, 45, - 46, 47, -1, -1, -1, 51, -1, -1, 54, 50, - -1, 86, 87, -1, -1, 90, -1, -1, -1, 65, - 66, 67, 97, -1, -1, 71, 72, 68, 69, -1, - -1, -1, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, -1, -1, 90, -1, -1, -1, -1, -1, - -1, 97 +static const short yycheck[] = { 1, +1, 45, 239, 233, 207, 208, 111, 4, 10, 257, +129, 196, 244, 206, 55, 3, 149, 14, 57, 326, +327, 59, 136, 3, 217, 5, 6, 7, 57, 50, +38, 55, 50, 59, 271, 57, 55, 344, 345, 28, +336, 55, 55, 5, 6, 248, 38, 55, 57, 345, +357, 92, 32, 59, 361, 35, 36, 37, 38, 55, +99, 41, 42, 43, 327, 45, 46, 91, 55, 58, +99, 92, 304, 61, 92, 55, 279, 99, 91, 282, +283, 274, 285, 63, 64, 288, 289, 324, 221, 203, +99, 276, 38, 59, 357, 55, 5, 6, 37, 24, +57, 55, 339, 55, 61, 55, 50, 355, 311, 55, +313, 314, 92, 38, 39, 24, 14, 114, 115, 238, +350, 55, 55, 55, 37, 37, 231, 232, 331, 38, +39, 55, 60, 38, 38, 38, 56, 367, 140, 140, +3, 378, 5, 6, 7, 23, 9, 57, 11, 55, +13, 14, 15, 23, 3, 56, 19, 20, 21, 22, +57, 24, 25, 26, 27, 55, 60, 56, 56, 32, +55, 37, 35, 36, 37, 38, 58, 40, 41, 42, +43, 60, 45, 46, 228, 60, 44, 45, 46, 47, +46, 47, 55, 51, 38, 51, 54, 55, 54, 55, +63, 64, 41, 60, 99, 207, 208, 38, 66, 67, +66, 67, 57, 71, 72, 3, 8, 5, 6, 7, +56, 9, 26, 11, 59, 13, 14, 15, 56, 56, +56, 56, 20, 21, 22, 56, 24, 25, 56, 27, +60, 29, 61, 60, 32, 61, 248, 35, 36, 37, +38, 60, 40, 41, 42, 43, 56, 45, 46, 60, +50, 38, 61, 60, 59, 61, 50, 55, 61, 51, +59, 273, 273, 55, 59, 63, 64, 279, 58, 50, +282, 283, 61, 285, 66, 67, 288, 289, 0, 0, +345, 318, -1, -1, -1, 8, -1, -1, -1, 301, +301, -1, -1, -1, -1, -1, -1, -1, -1, 311, +-1, 313, 314, -1, 27, 28, 29, 30, 31, -1, +44, 45, 46, 47, -1, -1, -1, 51, -1, 331, +54, 55, -1, -1, -1, -1, -1, -1, 340, 340, +53, -1, 66, 67, -1, 58, -1, -1, -1, -1, +-1, -1, 65, 355, 355, -1, 69, -1, -1, -1, +73, 74, -1, 76, 77, 78, -1, -1, 81, 82, +83, 84, 85, 86, 87, 88, 89, 90, 91, -1, +93, 383, 383, -1, -1, -1, -1, -1, 101, 102, +103, 104, 105, 106, -1, 108, 109, 110, 111, 112, +113, -1, -1, 116, 117, 118, 119, 120, 121, 122, +123, 124, 125, 126, 127, -1, -1, -1, -1, -1, +-1, -1, 135, 136, 3, -1, 5, 6, 7, 142, +9, -1, 11, 146, 13, 14, 15, -1, -1, -1, +-1, 20, 21, 22, -1, 24, 25, -1, 27, -1, +-1, -1, -1, 32, -1, -1, 35, 36, 37, 38, +-1, 40, 41, 42, 43, -1, 45, 46, -1, -1, +-1, -1, -1, -1, -1, -1, 55, -1, -1, -1, +-1, 60, -1, 196, 63, 64, -1, -1, -1, -1, +203, -1, 3, -1, 5, 6, 7, -1, 211, 212, +-1, 214, 215, 216, -1, -1, -1, -1, -1, -1, +-1, -1, 225, -1, 227, -1, -1, 230, 231, 232, +233, 32, 235, -1, 35, 36, 37, 38, -1, -1, +41, 42, 43, -1, 45, 46, -1, 250, 251, -1, +-1, -1, -1, -1, 55, -1, -1, -1, 59, -1, +263, -1, 63, 64, -1, -1, -1, -1, 3, -1, +5, 6, 7, 276, 9, -1, 11, -1, 13, 14, +15, -1, -1, -1, 287, 20, 21, 22, 291, 24, +25, -1, 27, -1, -1, -1, -1, 32, -1, -1, +35, 36, 37, 38, -1, 40, 41, 42, 43, -1, +45, 46, -1, -1, -1, -1, -1, -1, -1, -1, +55, -1, -1, -1, -1, 50, 61, -1, 63, 64, +-1, -1, -1, -1, -1, 338, -1, -1, -1, -1, +-1, -1, -1, 68, 69, 348, 349, 350, 73, 74, +75, 76, 77, 78, 79, 80, 81, 82, -1, -1, +-1, -1, -1, 366, 367, -1, -1, 92, 3, -1, +5, 6, 7, -1, 9, -1, 11, 380, 13, 14, +15, -1, 385, -1, -1, 20, 21, 22, -1, 24, +25, -1, 27, -1, -1, -1, -1, 32, -1, -1, +35, 36, 37, 38, -1, 40, 41, 42, 43, -1, +45, 46, -1, 3, -1, 5, 6, 7, -1, 9, +55, 11, -1, 13, 14, 15, 61, -1, 63, 64, +20, 21, 22, -1, 24, 25, -1, 27, -1, -1, +-1, -1, 32, -1, -1, 35, 36, 37, 38, -1, +40, 41, 42, 43, -1, 45, 46, -1, 3, -1, +5, 6, 7, -1, 9, 55, 11, -1, 13, 14, +15, 61, -1, 63, 64, 20, 21, 22, -1, 24, +25, -1, 27, -1, -1, -1, -1, 32, -1, -1, +35, 36, 37, 38, -1, 40, 41, 42, 43, -1, +45, 46, -1, 3, -1, 5, 6, 7, -1, 9, +55, 11, -1, 13, 14, 15, 61, -1, 63, 64, +20, 21, 22, -1, 24, 25, -1, 27, -1, -1, +-1, -1, 32, -1, -1, 35, 36, 37, 38, -1, +40, 41, 42, 43, -1, 45, 46, 3, -1, 5, +6, 7, -1, -1, -1, 55, -1, -1, -1, -1, +-1, -1, -1, 63, 64, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, 32, -1, -1, 35, +36, 37, 38, -1, -1, 41, 42, 43, -1, 45, +46, 3, -1, 5, 6, 7, -1, -1, -1, 55, +-1, -1, -1, 59, -1, -1, -1, 63, 64, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +32, -1, -1, 35, 36, 37, 38, -1, -1, 41, +42, 43, -1, 45, 46, 3, -1, 5, 6, 7, +-1, -1, -1, 55, -1, -1, -1, -1, 60, -1, +-1, 63, 64, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, 32, -1, -1, 35, 36, 37, +38, -1, -1, 41, 42, 43, -1, 45, 46, 3, +-1, 5, 6, 7, -1, -1, -1, 55, -1, -1, +-1, 59, -1, -1, -1, 63, 64, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, 32, -1, +-1, 35, 36, 37, 38, -1, -1, 41, 42, 43, +-1, 45, 46, 3, -1, 5, 6, 7, -1, -1, +-1, 55, 56, -1, -1, -1, -1, -1, -1, 63, +64, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, 32, -1, -1, 35, 36, 37, 38, -1, +-1, 41, 42, 43, -1, 45, 46, 3, -1, 5, +6, 7, -1, -1, -1, 55, -1, -1, -1, 59, +-1, -1, -1, 63, 64, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, 32, -1, -1, 35, +36, 37, 38, -1, -1, 41, 42, 43, -1, 45, +46, 3, -1, 5, 6, 7, -1, -1, -1, 55, +56, -1, -1, -1, -1, -1, -1, 63, 64, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +32, -1, -1, 35, 36, 37, 38, -1, -1, 41, +42, 43, -1, 45, 46, 3, -1, 5, 6, 7, +-1, -1, -1, 55, 56, -1, -1, -1, -1, -1, +-1, 63, 64, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, 32, -1, -1, 35, 36, 37, +38, -1, -1, 41, 42, 43, -1, 45, 46, 3, +-1, 5, 6, 7, -1, -1, -1, 55, 56, -1, +-1, -1, -1, -1, -1, 63, 64, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, 32, -1, +-1, 35, 36, 37, 38, -1, -1, 41, 42, 43, +-1, 45, 46, -1, -1, 44, 45, 46, 47, 48, +49, 55, 51, 52, 53, 54, 55, 56, 57, 63, +64, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, -1, 57, -1, 59, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, 59, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, 56, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, 56, -1, -1, +-1, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, 56, -1, -1, -1, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, 59, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, 56, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, -1, -1, 58, +-1, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, -1, -1, -1, 59, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, 58, -1, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, 56, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, -1, -1, -1, +59, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, 56, -1, -1, -1, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, 56, -1, -1, -1, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, -1, +-1, -1, 59, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, 56, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, 56, -1, -1, +-1, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, 56, -1, -1, -1, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, 59, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, -1, +-1, -1, 59, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, -1, -1, -1, -1, -1, 96, +97, 44, 45, 46, 47, 48, 49, -1, 51, 52, +53, 54, 55, -1, -1, -1, 59, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, 88, 89, 90, -1, -1, +-1, -1, -1, 96, 97, 44, 45, 46, 47, 48, +49, -1, 51, 52, 53, 54, 55, -1, -1, -1, +59, -1, -1, 62, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, 88, +89, 90, -1, -1, -1, -1, -1, 96, 97, 44, +45, 46, 47, 48, 49, -1, 51, 52, 53, 54, +55, -1, -1, -1, 59, -1, -1, 62, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, -1, 84, +85, 86, 87, 88, 89, 90, -1, -1, -1, -1, +-1, 96, 97, 44, 45, 46, 47, 48, 49, -1, +51, 52, 53, 54, 55, -1, -1, -1, -1, -1, +-1, 62, -1, -1, 65, 66, 67, -1, -1, -1, +71, 72, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 84, 85, 86, 87, 88, 89, 90, +-1, -1, -1, -1, -1, 96, 97, 44, 45, 46, +47, 48, 49, -1, 51, 52, 53, 54, 55, -1, +-1, -1, -1, -1, -1, 62, -1, -1, 65, 66, +67, -1, -1, -1, 71, 72, -1, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, 84, 85, 86, +87, 88, 89, 90, 44, 45, 46, 47, 48, 49, +97, 51, 52, 53, 54, 55, -1, -1, -1, -1, +-1, -1, 62, -1, -1, 65, 66, 67, -1, -1, +-1, 71, 72, -1, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, 84, 85, 86, 87, 88, -1, +90, 44, 45, 46, 47, 48, 49, 97, 51, 52, +53, 54, 55, -1, -1, -1, -1, -1, -1, 62, +-1, -1, 65, 66, 67, -1, -1, -1, 71, 72, +-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, 84, 85, 86, 87, -1, -1, 90, 44, 45, +46, 47, 48, 49, 97, 51, -1, 53, 54, 55, +-1, -1, -1, -1, -1, -1, 62, -1, -1, 65, +66, 67, -1, -1, -1, 71, 72, -1, -1, -1, +-1, -1, -1, -1, -1, -1, -1, -1, 84, 85, +86, 87, -1, -1, 90, 44, 45, 46, 47, 48, +49, 97, 51, -1, 53, 54, 55, -1, -1, -1, +-1, -1, -1, -1, -1, -1, 65, 66, 67, -1, +-1, -1, 71, 72, -1, -1, -1, -1, -1, -1, +-1, -1, -1, -1, -1, 84, 85, 86, 87, -1, +-1, 90, 44, 45, 46, 47, 48, 49, 97, 51, +-1, -1, 54, 55, -1, -1, -1, -1, -1, -1, +-1, -1, -1, 65, 66, 67, -1, -1, -1, 71, +72, -1, -1, -1, -1, -1, -1, -1, -1, -1, +-1, -1, 84, 85, 86, 87, -1, -1, 90, 44, +45, 46, 47, 48, 49, 97, 51, -1, -1, 54, +55, -1, -1, -1, -1, -1, -1, -1, -1, -1, +65, 66, 67, -1, -1, -1, 71, 72, 44, 45, +46, 47, -1, -1, -1, 51, -1, -1, 54, 55, +50, 86, 87, -1, -1, 90, -1, -1, -1, 65, +66, 67, 97, -1, -1, 71, 72, -1, 68, 69, +50, -1, -1, 73, 74, 75, 76, 77, 78, 79, +80, 81, 82, -1, 90, -1, -1, -1, 68, 69, +-1, 97, -1, 73, 74, 75, 76, 77, 78, 79, +80, 81, 82 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "bison.simple" /* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. +Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +Bison output file, you may use that output file without restriction. +This special exception was added by the Free Software Foundation +in version 1.24 of Bison. */ #ifndef alloca #ifdef __GNUC__ @@ -1157,15 +1175,15 @@ static const short yycheck[] = { 1, #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) #include - #pragma alloca +#pragma alloca #else /* not MSDOS, __TURBOC__, or _AIX */ #ifdef __hpux #ifdef __cplusplus extern "C" { -void *alloca (unsigned int); + void *alloca(unsigned int); }; #else /* not __cplusplus */ -void *alloca (); +void *alloca(); #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ @@ -1175,58 +1193,58 @@ void *alloca (); #endif /* alloca not defined. */ /* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ +when the %semantic_parser declaration is not specified in the grammar. +It was written by Richard Stallman by simplifying the hairy parser +used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ +It is replaced by the list of actions, each action +as one case of the switch. */ -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab +This remains here temporarily to ease the +transition to the new meaning of YYERROR, for GCC. +Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 #ifndef YYPURE -#define YYLEX yylex() +#define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval, &yylloc) +#define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +#define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif @@ -1235,32 +1253,32 @@ while (0) #ifndef YYPURE -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ #ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ #endif -int yynerrs; /* number of parse errors so far */ +int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ +int yydebug; /* nonzero means print parse trace */ + /* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ #endif -/* YYINITDEPTH indicates the initial size of the parser's stacks */ + /* YYINITDEPTH indicates the initial size of the parser's stacks */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ + /* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH @@ -1270,57 +1288,57 @@ int yydebug; /* nonzero means print parse trace */ #define YYMAXDEPTH 10000 #endif -/* Prevent warning if -Wstrict-prototypes. */ + /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ -int yyparse (void); +int yyparse(void); #endif - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +in available built-in functions on various systems. */ static void -__yy_memcpy (from, to, count) - char *from; - char *to; - int count; +__yy_memcpy(from, to, count) +char *from; +char *to; +int count; { - char *f = from; - char *t = to; - int i = count; + register char *f = from; + register char *t = to; + register int i = count; - while (i-- > 0) - *t++ = *f++; + while (i-- > 0) + *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ +in available built-in functions on various systems. */ static void -__yy_memcpy (char *from, char *to, int count) +__yy_memcpy(char *from, char *to, int count) { - char *f = from; - char *t = to; - int i = count; + register char *f = from; + register char *t = to; + register int i = count; - while (i-- > 0) - *t++ = *f++; + while (i-- > 0) + *t++ = *f++; } #endif #endif - + #line 192 "bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +into yyparse. The argument should have type void *. +It should actually point to an object. +Grammar actions can access the variable by casting it +to the proper pointer type. */ #ifdef YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; @@ -1331,78 +1349,78 @@ __yy_memcpy (char *from, char *to, int count) int yyparse(YYPARSE_PARAM) - YYPARSE_PARAM_DECL +YYPARSE_PARAM_DECL { - int yystate; - int yyn; - short *yyssp; - YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif - int yystacksize = YYINITDEPTH; + int yystacksize = YYINITDEPTH; #ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; + int yychar; + YYSTYPE yylval; + int yynerrs; #ifdef YYLSP_NEEDED - YYLTYPE yylloc; + YYLTYPE yylloc; #endif #endif - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ - int yylen; + int yylen; #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); + if (yydebug) + fprintf(stderr, "Starting parse\n"); #endif - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ - yyssp = yyss - 1; - yyvsp = yyvs; + yyssp = yyss - 1; + yyvsp = yyvs; #ifdef YYLSP_NEEDED - yylsp = yyls; + yylsp = yyls; #endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks + /* Push a new state, which is found in yystate . */ + /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: - *++yyssp = yystate; + *++yyssp = yystate; - if (yyssp >= yyss + yystacksize - 1) - { + if (yyssp >= yyss + yystacksize - 1) + { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; @@ -1416,20 +1434,20 @@ yynewstate: #ifdef yyoverflow /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ + the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ + but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); + &yyss1, size * sizeof(*yyssp), + &yyvs1, size * sizeof(*yyvsp), + &yyls1, size * sizeof(*yylsp), + &yystacksize); #else yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); + &yyss1, size * sizeof(*yyssp), + &yyvs1, size * sizeof(*yyvsp), + &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; @@ -1439,20 +1457,20 @@ yynewstate: #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } + { + yyerror("parser stack overflow"); + return 2; + } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); + yystacksize = YYMAXDEPTH; + yyss = (short *)alloca(yystacksize * sizeof(*yyssp)); + __yy_memcpy((char *)yyss1, (char *)yyss, size * sizeof(*yyssp)); + yyvs = (YYSTYPE *)alloca(yystacksize * sizeof(*yyvsp)); + __yy_memcpy((char *)yyvs1, (char *)yyvs, size * sizeof(*yyvsp)); #ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); + yyls = (YYLTYPE *)alloca(yystacksize * sizeof(*yylsp)); + __yy_memcpy((char *)yyls1, (char *)yyls, size * sizeof(*yylsp)); #endif #endif /* no yyoverflow */ @@ -1464,989 +1482,995 @@ yynewstate: #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); + fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } + YYABORT; + } #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); #endif - goto yybackup; - yybackup: + goto yybackup; +yybackup: -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. */ + /* Read a lookahead token if we need one and don't already have one. */ + /* yyresume: */ - /* First try to decide what to do without reference to lookahead token. */ + /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ - if (yychar == YYEMPTY) - { + if (yychar == YYEMPTY) + { #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Reading a token: "); + fprintf(stderr, "Reading a token: "); #endif yychar = YYLEX; - } + } - /* Convert token to internal form (in yychar1) for indexing tables with */ + /* Convert token to internal form (in yychar1) for indexing tables with */ - if (yychar <= 0) /* This means end of input. */ - { + if (yychar <= 0) /* This means end of input. */ + { yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ + yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Now at end of input.\n"); + fprintf(stderr, "Now at end of input.\n"); #endif - } - else - { + } + else + { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ + { + fprintf(stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ #ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); + YYPRINT(stderr, yychar, yylval); +#endif + fprintf(stderr, ")\n"); + } #endif - fprintf (stderr, ")\n"); } -#endif - } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; - yyn = yytable[yyn]; + yyn = yytable[yyn]; - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ - if (yyn < 0) - { + if (yyn < 0) + { if (yyn == YYFLAG) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; + } + else if (yyn == 0) + goto yyerrlab; - if (yyn == YYFINAL) - YYACCEPT; + if (yyn == YYFINAL) + YYACCEPT; - /* Shift the lookahead token. */ + /* Shift the lookahead token. */ #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; - *++yyvsp = yylval; + *++yyvsp = yylval; #ifdef YYLSP_NEEDED - *++yylsp = yylloc; + *++yylsp = yylloc; #endif - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; - yystate = yyn; - goto yynewstate; + yystate = yyn; + goto yynewstate; -/* Do the default action for the current state. */ + /* Do the default action for the current state. */ yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; -/* Do a reduction. yyn is the number of a rule to reduce with. */ + /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1 - yylen]; /* implement default value of the action */ #if YYDEBUG != 0 - if (yydebug) - { + if (yydebug) + { int i; - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + fprintf(stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } + fprintf(stderr, "%s ", yytname[yyrhs[i]]); + fprintf(stderr, " -> %s\n", yytname[yyr1[yyn]]); + } #endif - switch (yyn) { + switch (yyn) { -case 1: + case 1: #line 162 "cmdgram.y" -{ ; - break;} -case 2: + {; + break; } + case 2: #line 167 "cmdgram.y" -{ yyval.stmt = nil; ; - break;} -case 3: + { yyval.stmt = nil; ; + break; } + case 3: #line 169 "cmdgram.y" -{ if(!gStatementList) { gStatementList = yyvsp[0].stmt; } else { gStatementList->append(yyvsp[0].stmt); } ; - break;} -case 4: + { if (!gStatementList) { gStatementList = yyvsp[0].stmt; } + else { gStatementList->append(yyvsp[0].stmt); }; + break; } + case 4: #line 174 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 5: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 5: #line 176 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 6: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 6: #line 178 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 7: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 7: #line 183 "cmdgram.y" -{ yyval.stmt = yyvsp[-2].stmt; for(StmtNode *walk = (yyvsp[-2].stmt);walk;walk = walk->getNext() ) walk->setPackage(yyvsp[-4].s.value); ; - break;} -case 8: + { yyval.stmt = yyvsp[-2].stmt; for (StmtNode *walk = (yyvsp[-2].stmt); walk; walk = walk->getNext()) walk->setPackage(yyvsp[-4].s.value); ; + break; } + case 8: #line 188 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 9: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 9: #line 190 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].stmt; (yyvsp[-1].stmt)->append(yyvsp[0].stmt); ; - break;} -case 10: + { yyval.stmt = yyvsp[-1].stmt; (yyvsp[-1].stmt)->append(yyvsp[0].stmt); ; + break; } + case 10: #line 195 "cmdgram.y" -{ yyval.stmt = nil; ; - break;} -case 11: + { yyval.stmt = nil; ; + break; } + case 11: #line 197 "cmdgram.y" -{ if(!yyvsp[-1].stmt) { yyval.stmt = yyvsp[0].stmt; } else { (yyvsp[-1].stmt)->append(yyvsp[0].stmt); yyval.stmt = yyvsp[-1].stmt; } ; - break;} -case 18: + { if (!yyvsp[-1].stmt) { yyval.stmt = yyvsp[0].stmt; } + else { (yyvsp[-1].stmt)->append(yyvsp[0].stmt); yyval.stmt = yyvsp[-1].stmt; }; + break; } + case 18: #line 208 "cmdgram.y" -{ yyval.stmt = BreakStmtNode::alloc( yyvsp[-1].i.lineNumber ); ; - break;} -case 19: + { yyval.stmt = BreakStmtNode::alloc(yyvsp[-1].i.lineNumber); ; + break; } + case 19: #line 210 "cmdgram.y" -{ yyval.stmt = ContinueStmtNode::alloc( yyvsp[-1].i.lineNumber ); ; - break;} -case 20: + { yyval.stmt = ContinueStmtNode::alloc(yyvsp[-1].i.lineNumber); ; + break; } + case 20: #line 212 "cmdgram.y" -{ yyval.stmt = ReturnStmtNode::alloc( yyvsp[-1].i.lineNumber, NULL ); ; - break;} -case 21: + { yyval.stmt = ReturnStmtNode::alloc(yyvsp[-1].i.lineNumber, NULL); ; + break; } + case 21: #line 214 "cmdgram.y" -{ yyval.stmt = ReturnStmtNode::alloc( yyvsp[-2].i.lineNumber, yyvsp[-1].expr ); ; - break;} -case 22: + { yyval.stmt = ReturnStmtNode::alloc(yyvsp[-2].i.lineNumber, yyvsp[-1].expr); ; + break; } + case 22: #line 216 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].stmt; ; - break;} -case 23: + { yyval.stmt = yyvsp[-1].stmt; ; + break; } + case 23: #line 218 "cmdgram.y" -{ yyval.stmt = TTagSetStmtNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr, NULL ); ; - break;} -case 24: + { yyval.stmt = TTagSetStmtNode::alloc(yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr, NULL); ; + break; } + case 24: #line 220 "cmdgram.y" -{ yyval.stmt = TTagSetStmtNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[-1].expr ); ; - break;} -case 25: + { yyval.stmt = TTagSetStmtNode::alloc(yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[-1].expr); ; + break; } + case 25: #line 222 "cmdgram.y" -{ yyval.stmt = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, false, true ); ; - break;} -case 26: + { yyval.stmt = StrConstNode::alloc(yyvsp[0].str.lineNumber, yyvsp[0].str.value, false, true); ; + break; } + case 26: #line 227 "cmdgram.y" -{ yyval.stmt = FunctionDeclStmtNode::alloc( yyvsp[-7].i.lineNumber, yyvsp[-6].s.value, NULL, yyvsp[-4].var, yyvsp[-1].stmt ); ; - break;} -case 27: + { yyval.stmt = FunctionDeclStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-6].s.value, NULL, yyvsp[-4].var, yyvsp[-1].stmt); ; + break; } + case 27: #line 229 "cmdgram.y" -{ yyval.stmt = FunctionDeclStmtNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-6].s.value, yyvsp[-8].s.value, yyvsp[-4].var, yyvsp[-1].stmt ); ; - break;} -case 28: + { yyval.stmt = FunctionDeclStmtNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-6].s.value, yyvsp[-8].s.value, yyvsp[-4].var, yyvsp[-1].stmt); ; + break; } + case 28: #line 234 "cmdgram.y" -{ yyval.var = NULL; ; - break;} -case 29: + { yyval.var = NULL; ; + break; } + case 29: #line 236 "cmdgram.y" -{ yyval.var = yyvsp[0].var; ; - break;} -case 30: + { yyval.var = yyvsp[0].var; ; + break; } + case 30: #line 241 "cmdgram.y" -{ yyval.var = VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL ); ; - break;} -case 31: + { yyval.var = VarNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL); ; + break; } + case 31: #line 243 "cmdgram.y" -{ yyval.var = yyvsp[-2].var; ((StmtNode*)(yyvsp[-2].var))->append((StmtNode*)VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL ) ); ; - break;} -case 32: + { yyval.var = yyvsp[-2].var; ((StmtNode*)(yyvsp[-2].var))->append((StmtNode*)VarNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL)); ; + break; } + case 32: #line 248 "cmdgram.y" -{ yyval.stmt = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, NULL, yyvsp[-5].s.value, yyvsp[-2].slist, NULL, true, false, false); ; - break;} -case 33: + { yyval.stmt = ObjectDeclNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, NULL, yyvsp[-5].s.value, yyvsp[-2].slist, NULL, true, false, false); ; + break; } + case 33: #line 253 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, false); ; - break;} -case 34: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, false); ; + break; } + case 34: #line 255 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, false); ; - break;} -case 35: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, false); ; + break; } + case 35: #line 257 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-11].i.lineNumber, yyvsp[-10].expr, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, true, false); ; - break;} -case 36: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-11].i.lineNumber, yyvsp[-10].expr, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, true, false); ; + break; } + case 36: #line 259 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-8].i.lineNumber, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, true, false); ; - break;} -case 37: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-8].i.lineNumber, yyvsp[-7].expr, yyvsp[-4].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, true, false); ; + break; } + case 37: #line 261 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, true); ; - break;} -case 38: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-9].i.lineNumber, yyvsp[-8].expr, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-5].s.value, yyvsp[-1].odcl.slots, yyvsp[-1].odcl.decls, false, false, true); ; + break; } + case 38: #line 263 "cmdgram.y" -{ yyval.od = ObjectDeclNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, true); ; - break;} -case 39: + { yyval.od = ObjectDeclNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, yyvsp[-1].expr, yyvsp[-2].s.value, NULL, NULL, false, false, true); ; + break; } + case 39: #line 268 "cmdgram.y" -{ yyval.s.value = NULL; ; - break;} -case 40: + { yyval.s.value = NULL; ; + break; } + case 40: #line 270 "cmdgram.y" -{ yyval.s = yyvsp[0].s; ; - break;} -case 41: + { yyval.s = yyvsp[0].s; ; + break; } + case 41: #line 275 "cmdgram.y" -{ yyval.expr = StrConstNode::alloc( CodeBlock::smCurrentParser->getCurrentLine(), "", false); ; - break;} -case 42: + { yyval.expr = StrConstNode::alloc(CodeBlock::smCurrentParser->getCurrentLine(), "", false); ; + break; } + case 42: #line 277 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 43: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 43: #line 282 "cmdgram.y" -{ yyval.expr = NULL; ; - break;} -case 44: + { yyval.expr = NULL; ; + break; } + case 44: #line 284 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 45: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 45: #line 289 "cmdgram.y" -{ yyval.odcl.slots = NULL; yyval.odcl.decls = NULL; ; - break;} -case 46: + { yyval.odcl.slots = NULL; yyval.odcl.decls = NULL; ; + break; } + case 46: #line 291 "cmdgram.y" -{ yyval.odcl.slots = yyvsp[0].slist; yyval.odcl.decls = NULL; ; - break;} -case 47: + { yyval.odcl.slots = yyvsp[0].slist; yyval.odcl.decls = NULL; ; + break; } + case 47: #line 293 "cmdgram.y" -{ yyval.odcl.slots = NULL; yyval.odcl.decls = yyvsp[0].od; ; - break;} -case 48: + { yyval.odcl.slots = NULL; yyval.odcl.decls = yyvsp[0].od; ; + break; } + case 48: #line 295 "cmdgram.y" -{ yyval.odcl.slots = yyvsp[-1].slist; yyval.odcl.decls = yyvsp[0].od; ; - break;} -case 49: + { yyval.odcl.slots = yyvsp[-1].slist; yyval.odcl.decls = yyvsp[0].od; ; + break; } + case 49: #line 300 "cmdgram.y" -{ yyval.od = yyvsp[-1].od; ; - break;} -case 50: + { yyval.od = yyvsp[-1].od; ; + break; } + case 50: #line 302 "cmdgram.y" -{ yyvsp[-2].od->append(yyvsp[-1].od); yyval.od = yyvsp[-2].od; ; - break;} -case 51: + { yyvsp[-2].od->append(yyvsp[-1].od); yyval.od = yyvsp[-2].od; ; + break; } + case 51: #line 307 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].stmt; ; - break;} -case 52: + { yyval.stmt = yyvsp[-1].stmt; ; + break; } + case 52: #line 309 "cmdgram.y" -{ yyval.stmt = yyvsp[0].stmt; ; - break;} -case 53: + { yyval.stmt = yyvsp[0].stmt; ; + break; } + case 53: #line 314 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, false); ; - break;} -case 54: + { yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, false); ; + break; } + case 54: #line 316 "cmdgram.y" -{ yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, true); ; - break;} -case 55: + { yyval.stmt = yyvsp[-1].ifnode; yyvsp[-1].ifnode->propagateSwitchExpr(yyvsp[-4].expr, true); ; + break; } + case 55: #line 321 "cmdgram.y" -{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-3].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; - break;} -case 56: + { yyval.ifnode = IfStmtNode::alloc(yyvsp[-3].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; + break; } + case 56: #line 323 "cmdgram.y" -{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].stmt, yyvsp[0].stmt, false); ; - break;} -case 57: + { yyval.ifnode = IfStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].stmt, yyvsp[0].stmt, false); ; + break; } + case 57: #line 325 "cmdgram.y" -{ yyval.ifnode = IfStmtNode::alloc( yyvsp[-4].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].stmt, yyvsp[0].ifnode, true); ; - break;} -case 58: + { yyval.ifnode = IfStmtNode::alloc(yyvsp[-4].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].stmt, yyvsp[0].ifnode, true); ; + break; } + case 58: #line 330 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr;; - break;} -case 59: + { yyval.expr = yyvsp[0].expr;; + break; } + case 59: #line 332 "cmdgram.y" -{ (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr=yyvsp[-2].expr; ; - break;} -case 60: + { (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr = yyvsp[-2].expr; ; + break; } + case 60: #line 337 "cmdgram.y" -{ yyval.stmt = IfStmtNode::alloc(yyvsp[-4].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; - break;} -case 61: + { yyval.stmt = IfStmtNode::alloc(yyvsp[-4].i.lineNumber, yyvsp[-2].expr, yyvsp[0].stmt, NULL, false); ; + break; } + case 61: #line 339 "cmdgram.y" -{ yyval.stmt = IfStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt, false); ; - break;} -case 62: + { yyval.stmt = IfStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt, false); ; + break; } + case 62: #line 344 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-4].i.lineNumber, nil, yyvsp[-2].expr, nil, yyvsp[0].stmt, false); ; - break;} -case 63: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-4].i.lineNumber, nil, yyvsp[-2].expr, nil, yyvsp[0].stmt, false); ; + break; } + case 63: #line 346 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-3].i.lineNumber, nil, yyvsp[-1].expr, nil, yyvsp[-4].stmt, true); ; - break;} -case 64: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-3].i.lineNumber, nil, yyvsp[-1].expr, nil, yyvsp[-4].stmt, true); ; + break; } + case 64: #line 351 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-8].i.lineNumber, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 65: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-8].i.lineNumber, yyvsp[-6].expr, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 65: #line 353 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; - break;} -case 66: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; + break; } + case 66: #line 355 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 67: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, yyvsp[-5].expr, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 67: #line 357 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, NULL, NULL, yyvsp[0].stmt, false); ; - break;} -case 68: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].expr, NULL, NULL, yyvsp[0].stmt, false); ; + break; } + case 68: #line 359 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 69: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 69: #line 361 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; - break;} -case 70: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, yyvsp[-3].expr, NULL, yyvsp[0].stmt, false); ; + break; } + case 70: #line 363 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; - break;} -case 71: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-6].i.lineNumber, NULL, NULL, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 71: #line 365 "cmdgram.y" -{ yyval.stmt = LoopStmtNode::alloc(yyvsp[-5].i.lineNumber, NULL, NULL, NULL, yyvsp[0].stmt, false); ; - break;} -case 72: + { yyval.stmt = LoopStmtNode::alloc(yyvsp[-5].i.lineNumber, NULL, NULL, NULL, yyvsp[0].stmt, false); ; + break; } + case 72: #line 370 "cmdgram.y" -{ yyval.stmt = IterStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, false ); ; - break;} -case 73: + { yyval.stmt = IterStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, false); ; + break; } + case 73: #line 372 "cmdgram.y" -{ yyval.stmt = IterStmtNode::alloc( yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, true ); ; - break;} -case 74: + { yyval.stmt = IterStmtNode::alloc(yyvsp[-6].i.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].stmt, true); ; + break; } + case 74: #line 377 "cmdgram.y" -{ yyval.stmt = yyvsp[0].expr; ; - break;} -case 75: + { yyval.stmt = yyvsp[0].expr; ; + break; } + case 75: #line 382 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 76: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 76: #line 384 "cmdgram.y" -{ yyval.expr = yyvsp[-1].expr; ; - break;} -case 77: + { yyval.expr = yyvsp[-1].expr; ; + break; } + case 77: #line 386 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 78: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 78: #line 388 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 79: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 79: #line 390 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 80: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 80: #line 392 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 81: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 81: #line 394 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 82: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 82: #line 396 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 83: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 83: #line 398 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 84: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 84: #line 400 "cmdgram.y" -{ yyval.expr = FloatBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 85: + { yyval.expr = FloatBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 85: #line 402 "cmdgram.y" -{ yyval.expr = FloatUnaryExprNode::alloc( yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; - break;} -case 86: + { yyval.expr = FloatUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; + break; } + case 86: #line 404 "cmdgram.y" -{ yyval.expr = TTagDerefNode::alloc( yyvsp[-1].i.lineNumber, yyvsp[0].expr ); ; - break;} -case 87: + { yyval.expr = TTagDerefNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[0].expr); ; + break; } + case 87: #line 406 "cmdgram.y" -{ yyval.expr = TTagExprNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ; - break;} -case 88: + { yyval.expr = TTagExprNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value); ; + break; } + case 88: #line 408 "cmdgram.y" -{ yyval.expr = ConditionalExprNode::alloc( yyvsp[-4].expr->dbgLineNumber, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 89: + { yyval.expr = ConditionalExprNode::alloc(yyvsp[-4].expr->dbgLineNumber, yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 89: #line 410 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 90: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 90: #line 412 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 91: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 91: #line 414 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 92: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 92: #line 416 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 93: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 93: #line 418 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 94: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 94: #line 420 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 95: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 95: #line 422 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 96: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 96: #line 424 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 97: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 97: #line 426 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 98: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 98: #line 428 "cmdgram.y" -{ yyval.expr = IntBinaryExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -case 99: + { yyval.expr = IntBinaryExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-1].i.value, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + case 99: #line 430 "cmdgram.y" -{ yyval.expr = StreqExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, true); ; - break;} -case 100: + { yyval.expr = StreqExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, true); ; + break; } + case 100: #line 432 "cmdgram.y" -{ yyval.expr = StreqExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, false); ; - break;} -case 101: + { yyval.expr = StreqExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, false); ; + break; } + case 101: #line 434 "cmdgram.y" -{ yyval.expr = StrcatExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].i.value); ; - break;} -case 102: + { yyval.expr = StrcatExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].i.value); ; + break; } + case 102: #line 436 "cmdgram.y" -{ yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; - break;} -case 103: + { yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; + break; } + case 103: #line 438 "cmdgram.y" -{ yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; - break;} -case 104: + { yyval.expr = IntUnaryExprNode::alloc(yyvsp[-1].i.lineNumber, yyvsp[-1].i.value, yyvsp[0].expr); ; + break; } + case 104: #line 440 "cmdgram.y" -{ yyval.expr = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, true); ; - break;} -case 105: + { yyval.expr = StrConstNode::alloc(yyvsp[0].str.lineNumber, yyvsp[0].str.value, true); ; + break; } + case 105: #line 442 "cmdgram.y" -{ yyval.expr = FloatNode::alloc( yyvsp[0].f.lineNumber, yyvsp[0].f.value ); ; - break;} -case 106: + { yyval.expr = FloatNode::alloc(yyvsp[0].f.lineNumber, yyvsp[0].f.value); ; + break; } + case 106: #line 444 "cmdgram.y" -{ yyval.expr = IntNode::alloc( yyvsp[0].i.lineNumber, yyvsp[0].i.value ); ; - break;} -case 107: + { yyval.expr = IntNode::alloc(yyvsp[0].i.lineNumber, yyvsp[0].i.value); ; + break; } + case 107: #line 446 "cmdgram.y" -{ yyval.expr = ConstantNode::alloc( yyvsp[0].i.lineNumber, StringTable->insert("break")); ; - break;} -case 108: + { yyval.expr = ConstantNode::alloc(yyvsp[0].i.lineNumber, StringTable->insert("break")); ; + break; } + case 108: #line 448 "cmdgram.y" -{ yyval.expr = SlotAccessNode::alloc( yyvsp[0].slot.lineNumber, yyvsp[0].slot.object, yyvsp[0].slot.array, yyvsp[0].slot.slotName ); ; - break;} -case 109: + { yyval.expr = SlotAccessNode::alloc(yyvsp[0].slot.lineNumber, yyvsp[0].slot.object, yyvsp[0].slot.array, yyvsp[0].slot.slotName); ; + break; } + case 109: #line 450 "cmdgram.y" -{ yyval.expr = InternalSlotAccessNode::alloc( yyvsp[0].intslot.lineNumber, yyvsp[0].intslot.object, yyvsp[0].intslot.slotExpr, yyvsp[0].intslot.recurse); ; - break;} -case 110: + { yyval.expr = InternalSlotAccessNode::alloc(yyvsp[0].intslot.lineNumber, yyvsp[0].intslot.object, yyvsp[0].intslot.slotExpr, yyvsp[0].intslot.recurse); ; + break; } + case 110: #line 452 "cmdgram.y" -{ yyval.expr = ConstantNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ; - break;} -case 111: + { yyval.expr = ConstantNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value); ; + break; } + case 111: #line 454 "cmdgram.y" -{ yyval.expr = StrConstNode::alloc( yyvsp[0].str.lineNumber, yyvsp[0].str.value, false); ; - break;} -case 112: + { yyval.expr = StrConstNode::alloc(yyvsp[0].str.lineNumber, yyvsp[0].str.value, false); ; + break; } + case 112: #line 456 "cmdgram.y" -{ yyval.expr = (ExprNode*)VarNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL); ; - break;} -case 113: + { yyval.expr = (ExprNode*)VarNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value, NULL); ; + break; } + case 113: #line 458 "cmdgram.y" -{ yyval.expr = (ExprNode*)VarNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr ); ; - break;} -case 114: + { yyval.expr = (ExprNode*)VarNode::alloc(yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, yyvsp[-1].expr); ; + break; } + case 114: #line 460 "cmdgram.y" -{ + { const U32 bufLen = 64; UTF8 buffer[bufLen]; dSprintf(buffer, bufLen, "__anonymous_function%d", gAnonFunctionID++); StringTableEntry fName = StringTable->insert(buffer); StmtNode *fndef = FunctionDeclStmtNode::alloc(yyvsp[-6].i.lineNumber, fName, NULL, yyvsp[-4].var, yyvsp[-1].stmt); - if(!gAnonFunctionList) + if (!gAnonFunctionList) gAnonFunctionList = fndef; else gAnonFunctionList->append(fndef); - yyval.expr = StrConstNode::alloc( yyvsp[-6].i.lineNumber, (UTF8*)fName, false ); - ; - break;} -case 115: + yyval.expr = StrConstNode::alloc(yyvsp[-6].i.lineNumber, (UTF8*)fName, false); + ; + break; } + case 115: #line 478 "cmdgram.y" -{ yyval.slot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.slot.object = yyvsp[-2].expr; yyval.slot.slotName = yyvsp[0].s.value; yyval.slot.array = NULL; ; - break;} -case 116: + { yyval.slot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.slot.object = yyvsp[-2].expr; yyval.slot.slotName = yyvsp[0].s.value; yyval.slot.array = NULL; ; + break; } + case 116: #line 480 "cmdgram.y" -{ yyval.slot.lineNumber = yyvsp[-5].expr->dbgLineNumber; yyval.slot.object = yyvsp[-5].expr; yyval.slot.slotName = yyvsp[-3].s.value; yyval.slot.array = yyvsp[-1].expr; ; - break;} -case 117: + { yyval.slot.lineNumber = yyvsp[-5].expr->dbgLineNumber; yyval.slot.object = yyvsp[-5].expr; yyval.slot.slotName = yyvsp[-3].s.value; yyval.slot.array = yyvsp[-1].expr; ; + break; } + case 117: #line 485 "cmdgram.y" -{ yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = false; ; - break;} -case 118: + { yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = false; ; + break; } + case 118: #line 487 "cmdgram.y" -{ yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = true; ; - break;} -case 119: + { yyval.intslot.lineNumber = yyvsp[-2].expr->dbgLineNumber; yyval.intslot.object = yyvsp[-2].expr; yyval.intslot.slotExpr = yyvsp[0].expr; yyval.intslot.recurse = true; ; + break; } + case 119: #line 492 "cmdgram.y" -{ yyval.expr = ConstantNode::alloc( yyvsp[0].s.lineNumber, yyvsp[0].s.value ); ; - break;} -case 120: + { yyval.expr = ConstantNode::alloc(yyvsp[0].s.lineNumber, yyvsp[0].s.value); ; + break; } + case 120: #line 494 "cmdgram.y" -{ yyval.expr = yyvsp[-1].expr; ; - break;} -case 121: + { yyval.expr = yyvsp[-1].expr; ; + break; } + case 121: #line 499 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = '+'; yyval.asn.expr = FloatNode::alloc( yyvsp[0].i.lineNumber, 1 ); ; - break;} -case 122: + { yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = opPLUSPLUS; yyval.asn.expr = FloatNode::alloc(yyvsp[0].i.lineNumber, 1); ; + break; } + case 122: #line 501 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = '-'; yyval.asn.expr = FloatNode::alloc( yyvsp[0].i.lineNumber, 1 ); ; - break;} -case 123: + { yyval.asn.lineNumber = yyvsp[0].i.lineNumber; yyval.asn.token = opMINUSMINUS; yyval.asn.expr = FloatNode::alloc(yyvsp[0].i.lineNumber, 1); ; + break; } + case 123: #line 503 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '+'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 124: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '+'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 124: #line 505 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '-'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 125: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '-'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 125: #line 507 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '*'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 126: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '*'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 126: #line 509 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '/'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 127: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '/'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 127: #line 511 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '%'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 128: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '%'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 128: #line 513 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '&'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 129: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '&'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 129: #line 515 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '^'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 130: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '^'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 130: #line 517 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '|'; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 131: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = '|'; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 131: #line 519 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHL; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 132: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHL; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 132: #line 521 "cmdgram.y" -{ yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHR; yyval.asn.expr = yyvsp[0].expr; ; - break;} -case 133: + { yyval.asn.lineNumber = yyvsp[-1].i.lineNumber; yyval.asn.token = opSHR; yyval.asn.expr = yyvsp[0].expr; ; + break; } + case 133: #line 526 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 134: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 134: #line 528 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 135: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 135: #line 530 "cmdgram.y" -{ yyval.expr = yyvsp[0].od; ; - break;} -case 136: + { yyval.expr = yyvsp[0].od; ; + break; } + case 136: #line 532 "cmdgram.y" -{ yyval.expr = AssignExprNode::alloc( yyvsp[-2].s.lineNumber, yyvsp[-2].s.value, NULL, yyvsp[0].expr); ; - break;} -case 137: + { yyval.expr = AssignExprNode::alloc(yyvsp[-2].s.lineNumber, yyvsp[-2].s.value, NULL, yyvsp[0].expr); ; + break; } + case 137: #line 534 "cmdgram.y" -{ yyval.expr = AssignExprNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[0].expr); ; - break;} -case 138: + { yyval.expr = AssignExprNode::alloc(yyvsp[-5].s.lineNumber, yyvsp[-5].s.value, yyvsp[-3].expr, yyvsp[0].expr); ; + break; } + case 138: #line 536 "cmdgram.y" -{ yyval.expr = AssignOpExprNode::alloc( yyvsp[-1].s.lineNumber, yyvsp[-1].s.value, NULL, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; - break;} -case 139: + { yyval.expr = AssignOpExprNode::alloc(yyvsp[-1].s.lineNumber, yyvsp[-1].s.value, NULL, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; + break; } + case 139: #line 538 "cmdgram.y" -{ yyval.expr = AssignOpExprNode::alloc( yyvsp[-4].s.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; - break;} -case 140: + { yyval.expr = AssignOpExprNode::alloc(yyvsp[-4].s.lineNumber, yyvsp[-4].s.value, yyvsp[-2].expr, yyvsp[0].asn.expr, yyvsp[0].asn.token); ; + break; } + case 140: #line 540 "cmdgram.y" -{ yyval.expr = SlotAssignOpNode::alloc( yyvsp[-1].slot.lineNumber, yyvsp[-1].slot.object, yyvsp[-1].slot.slotName, yyvsp[-1].slot.array, yyvsp[0].asn.token, yyvsp[0].asn.expr); ; - break;} -case 141: + { yyval.expr = SlotAssignOpNode::alloc(yyvsp[-1].slot.lineNumber, yyvsp[-1].slot.object, yyvsp[-1].slot.slotName, yyvsp[-1].slot.array, yyvsp[0].asn.token, yyvsp[0].asn.expr); ; + break; } + case 141: #line 542 "cmdgram.y" -{ yyval.expr = SlotAssignNode::alloc( yyvsp[-2].slot.lineNumber, yyvsp[-2].slot.object, yyvsp[-2].slot.array, yyvsp[-2].slot.slotName, yyvsp[0].expr); ; - break;} -case 142: + { yyval.expr = SlotAssignNode::alloc(yyvsp[-2].slot.lineNumber, yyvsp[-2].slot.object, yyvsp[-2].slot.array, yyvsp[-2].slot.slotName, yyvsp[0].expr); ; + break; } + case 142: #line 544 "cmdgram.y" -{ yyval.expr = SlotAssignNode::alloc( yyvsp[-4].slot.lineNumber, yyvsp[-4].slot.object, yyvsp[-4].slot.array, yyvsp[-4].slot.slotName, yyvsp[-1].expr); ; - break;} -case 143: + { yyval.expr = SlotAssignNode::alloc(yyvsp[-4].slot.lineNumber, yyvsp[-4].slot.object, yyvsp[-4].slot.array, yyvsp[-4].slot.slotName, yyvsp[-1].expr); ; + break; } + case 143: #line 549 "cmdgram.y" -{ yyval.expr = FuncCallExprNode::alloc( yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, NULL, yyvsp[-1].expr, false); ; - break;} -case 144: + { yyval.expr = FuncCallExprNode::alloc(yyvsp[-3].s.lineNumber, yyvsp[-3].s.value, NULL, yyvsp[-1].expr, false); ; + break; } + case 144: #line 551 "cmdgram.y" -{ yyval.expr = FuncCallExprNode::alloc( yyvsp[-5].s.lineNumber, yyvsp[-3].s.value, yyvsp[-5].s.value, yyvsp[-1].expr, false); ; - break;} -case 145: + { yyval.expr = FuncCallExprNode::alloc(yyvsp[-5].s.lineNumber, yyvsp[-3].s.value, yyvsp[-5].s.value, yyvsp[-1].expr, false); ; + break; } + case 145: #line 553 "cmdgram.y" -{ yyvsp[-5].expr->append(yyvsp[-1].expr); yyval.expr = FuncCallExprNode::alloc( yyvsp[-5].expr->dbgLineNumber, yyvsp[-3].s.value, NULL, yyvsp[-5].expr, true); ; - break;} -case 146: -#line 558 "cmdgram.y" -{ yyval.expr = AssertCallExprNode::alloc( yyvsp[-3].i.lineNumber, yyvsp[-1].expr, NULL ); ; - break;} -case 147: + { yyvsp[-5].expr->append(yyvsp[-1].expr); yyval.expr = FuncCallExprNode::alloc(yyvsp[-5].expr->dbgLineNumber, yyvsp[-3].s.value, NULL, yyvsp[-5].expr, true); ; + break; } + case 146: +#line 555 "cmdgram.y" + { yyval.expr = FuncPointerCallExprNode::alloc(yyvsp[-3].expr->dbgLineNumber, yyvsp[-3].expr, yyvsp[-1].expr); ; + break; } + case 147: #line 560 "cmdgram.y" -{ yyval.expr = AssertCallExprNode::alloc( yyvsp[-5].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].str.value ); ; - break;} -case 148: -#line 565 "cmdgram.y" -{ yyval.expr = NULL; ; - break;} -case 149: + { yyval.expr = AssertCallExprNode::alloc(yyvsp[-3].i.lineNumber, yyvsp[-1].expr, NULL); ; + break; } + case 148: +#line 562 "cmdgram.y" + { yyval.expr = AssertCallExprNode::alloc(yyvsp[-5].i.lineNumber, yyvsp[-3].expr, yyvsp[-1].str.value); ; + break; } + case 149: #line 567 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 150: -#line 572 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 151: + { yyval.expr = NULL; ; + break; } + case 150: +#line 569 "cmdgram.y" + { yyval.expr = yyvsp[0].expr; ; + break; } + case 151: #line 574 "cmdgram.y" -{ (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr = yyvsp[-2].expr; ; - break;} -case 152: -#line 579 "cmdgram.y" -{ yyval.slist = NULL; ; - break;} -case 153: + { yyval.expr = yyvsp[0].expr; ; + break; } + case 152: +#line 576 "cmdgram.y" + { (yyvsp[-2].expr)->append(yyvsp[0].expr); yyval.expr = yyvsp[-2].expr; ; + break; } + case 153: #line 581 "cmdgram.y" -{ yyval.slist = yyvsp[0].slist; ; - break;} -case 154: -#line 586 "cmdgram.y" -{ yyval.slist = yyvsp[0].slist; ; - break;} -case 155: + { yyval.slist = NULL; ; + break; } + case 154: +#line 583 "cmdgram.y" + { yyval.slist = yyvsp[0].slist; ; + break; } + case 155: #line 588 "cmdgram.y" -{ yyvsp[-1].slist->append(yyvsp[0].slist); yyval.slist = yyvsp[-1].slist; ; - break;} -case 156: -#line 593 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-3].s.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr); ; - break;} -case 157: + { yyval.slist = yyvsp[0].slist; ; + break; } + case 156: +#line 590 "cmdgram.y" + { yyvsp[-1].slist->append(yyvsp[0].slist); yyval.slist = yyvsp[-1].slist; ; + break; } + case 157: #line 595 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-4].i.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr, yyvsp[-4].i.value); ; - break;} -case 158: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-3].s.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr); ; + break; } + case 158: #line 597 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-3].i.lineNumber, NULL, NULL, StringTable->insert("datablock"), yyvsp[-1].expr); ; - break;} -case 159: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-4].i.lineNumber, NULL, NULL, yyvsp[-3].s.value, yyvsp[-1].expr, yyvsp[-4].i.value); ; + break; } + case 159: #line 599 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-6].s.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr); ; - break;} -case 160: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-3].i.lineNumber, NULL, NULL, StringTable->insert("datablock"), yyvsp[-1].expr); ; + break; } + case 160: #line 601 "cmdgram.y" -{ yyval.slist = SlotAssignNode::alloc( yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr, yyvsp[-7].i.value); ; - break;} -case 161: -#line 606 "cmdgram.y" -{ yyval.expr = yyvsp[0].expr; ; - break;} -case 162: + { yyval.slist = SlotAssignNode::alloc(yyvsp[-6].s.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr); ; + break; } + case 161: +#line 603 "cmdgram.y" + { yyval.slist = SlotAssignNode::alloc(yyvsp[-7].i.lineNumber, NULL, yyvsp[-4].expr, yyvsp[-6].s.value, yyvsp[-1].expr, yyvsp[-7].i.value); ; + break; } + case 162: #line 608 "cmdgram.y" -{ yyval.expr = CommaCatExprNode::alloc( yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr); ; - break;} -} + { yyval.expr = yyvsp[0].expr; ; + break; } + case 163: +#line 610 "cmdgram.y" + { yyval.expr = CommaCatExprNode::alloc(yyvsp[-2].expr->dbgLineNumber, yyvsp[-2].expr, yyvsp[0].expr); ; + break; } + } /* the action file gets copied in in place of this dollarsign */ #line 487 "bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; + + yyvsp -= yylen; + yyssp -= yylen; #ifdef YYLSP_NEEDED - yylsp -= yylen; + yylsp -= yylen; #endif #if YYDEBUG != 0 - if (yydebug) - { + if (yydebug) + { short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); + fprintf(stderr, "state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } + fprintf(stderr, " %d", *++ssp1); + fprintf(stderr, "\n"); + } #endif - *++yyvsp = yyval; + *++yyvsp = yyval; #ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { + yylsp++; + if (yylen == 0) + { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; + yylsp->last_line = (yylsp - 1)->last_line; + yylsp->last_column = (yylsp - 1)->last_column; yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } + } + else + { + yylsp->last_line = (yylsp + yylen - 1)->last_line; + yylsp->last_column = (yylsp + yylen - 1)->last_column; + } #endif - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ - yyn = yyr1[yyn]; + yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; - goto yynewstate; + goto yynewstate; yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { + if (!yyerrstatus) + /* If not already recovering from an error, report this error. */ + { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *)malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } } + yyerror(msg); + free(msg); + } + else + yyerror("parse error; also virtual memory exceeded"); } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } + yyerror("parse error"); + } - goto yyerrlab1; + goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ - if (yyerrstatus == 3) - { + if (yyerrstatus == 3) + { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) - YYABORT; + YYABORT; #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; - } + } - /* Else will try to reuse lookahead token - after shifting the error token. */ + /* Else will try to reuse lookahead token + after shifting the error token. */ - yyerrstatus = 3; /* Each real token shifted decrements this */ + yyerrstatus = 3; /* Each real token shifted decrements this */ - goto yyerrhandle; + goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; #ifdef YYLSP_NEEDED - yylsp--; + yylsp--; #endif #if YYDEBUG != 0 - if (yydebug) - { + if (yydebug) + { short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); + fprintf(stderr, "Error: state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } + fprintf(stderr, " %d", *++ssp1); + fprintf(stderr, "\n"); + } #endif yyerrhandle: - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; - yyn = yytable[yyn]; - if (yyn < 0) - { + yyn = yytable[yyn]; + if (yyn < 0) + { if (yyn == YYFLAG) - goto yyerrpop; + goto yyerrpop; yyn = -yyn; goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; + } + else if (yyn == 0) + goto yyerrpop; - if (yyn == YYFINAL) - YYACCEPT; + if (yyn == YYFINAL) + YYACCEPT; #if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); + if (yydebug) + fprintf(stderr, "Shifting error token, "); #endif - *++yyvsp = yylval; + *++yyvsp = yylval; #ifdef YYLSP_NEEDED - *++yylsp = yylloc; + *++yylsp = yylloc; #endif - yystate = yyn; - goto yynewstate; + yystate = yyn; + goto yynewstate; } -#line 610 "cmdgram.y" +#line 612 "cmdgram.y" diff --git a/Engine/source/console/cmdgram.h b/Engine/source/console/cmdgram.h index fc22f3df2..83736a565 100644 --- a/Engine/source/console/cmdgram.h +++ b/Engine/source/console/cmdgram.h @@ -15,78 +15,78 @@ typedef union { AssignDecl asn; IfStmtNode* ifnode; } YYSTYPE; -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 extern YYSTYPE CMDlval; diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index 192b50f0f..3f5c3f292 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -63,11 +63,11 @@ CodeBlock::~CodeBlock() // Make sure we aren't lingering in the current code block... AssertFatal(smCurrentCodeBlock != this, "CodeBlock::~CodeBlock - Caught lingering in smCurrentCodeBlock!"); - if(name) + if (name) removeFromCodeList(); delete[] const_cast(globalStrings); delete[] const_cast(functionStrings); - + functionStringsMaxLen = 0; globalStringsMaxLen = 0; @@ -85,7 +85,7 @@ StringTableEntry CodeBlock::getCurrentCodeBlockName() return CodeBlock::getCurrentBlock()->name; else return NULL; -} +} StringTableEntry CodeBlock::getCurrentCodeBlockFullPath() { @@ -105,8 +105,8 @@ StringTableEntry CodeBlock::getCurrentCodeBlockModName() CodeBlock *CodeBlock::find(StringTableEntry name) { - for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) - if(walk->name == name) + for (CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile) + if (walk->name == name) return walk; return NULL; } @@ -116,9 +116,9 @@ CodeBlock *CodeBlock::find(StringTableEntry name) void CodeBlock::addToCodeList() { // remove any code blocks with my name - for(CodeBlock **walk = &smCodeBlockList; *walk;walk = &((*walk)->nextFile)) + for (CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile)) { - if((*walk)->name == name) + if ((*walk)->name == name) { *walk = (*walk)->nextFile; break; @@ -130,9 +130,9 @@ void CodeBlock::addToCodeList() void CodeBlock::clearAllBreaks() { - if(!lineBreakPairs) + if (!lineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; code[p[1]] = p[0] & 0xFF; @@ -141,12 +141,12 @@ void CodeBlock::clearAllBreaks() void CodeBlock::clearBreakpoint(U32 lineNumber) { - if(!lineBreakPairs) + if (!lineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; - if((p[0] >> 8) == lineNumber) + if ((p[0] >> 8) == lineNumber) { code[p[1]] = p[0] & 0xFF; return; @@ -156,9 +156,9 @@ void CodeBlock::clearBreakpoint(U32 lineNumber) void CodeBlock::setAllBreaks() { - if(!lineBreakPairs) + if (!lineBreakPairs) return; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; code[p[1]] = OP_BREAK; @@ -167,13 +167,13 @@ void CodeBlock::setAllBreaks() bool CodeBlock::setBreakpoint(U32 lineNumber) { - if(!lineBreakPairs) + if (!lineBreakPairs) return false; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; - if((p[0] >> 8) == lineNumber) + if ((p[0] >> 8) == lineNumber) { code[p[1]] = OP_BREAK; return true; @@ -185,15 +185,15 @@ bool CodeBlock::setBreakpoint(U32 lineNumber) U32 CodeBlock::findFirstBreakLine(U32 lineNumber) { - if(!lineBreakPairs) + if (!lineBreakPairs) return 0; - for(U32 i = 0; i < lineBreakPairCount; i++) + for (U32 i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; U32 line = (p[0] >> 8); - if( lineNumber <= line ) + if (lineNumber <= line) return line; } @@ -210,35 +210,35 @@ void CodeBlock::findBreakLine(U32 ip, U32 &line, U32 &instruction) { U32 min = 0; U32 max = lineBreakPairCount - 1; - LinePair *p = (LinePair *) lineBreakPairs; + LinePair *p = (LinePair *)lineBreakPairs; U32 found; - if(!lineBreakPairCount || p[min].ip > ip || p[max].ip < ip) + if (!lineBreakPairCount || p[min].ip > ip || p[max].ip < ip) { line = 0; instruction = OP_INVALID; return; } - else if(p[min].ip == ip) + else if (p[min].ip == ip) found = min; - else if(p[max].ip == ip) + else if (p[max].ip == ip) found = max; else { - for(;;) + for (;;) { - if(min == max - 1) + if (min == max - 1) { found = min; break; } U32 mid = (min + max) >> 1; - if(p[mid].ip == ip) + if (p[mid].ip == ip) { found = mid; break; } - else if(p[mid].ip > ip) + else if (p[mid].ip > ip) max = mid; else min = mid; @@ -260,9 +260,9 @@ const char *CodeBlock::getFileLine(U32 ip) void CodeBlock::removeFromCodeList() { - for(CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile)) + for (CodeBlock **walk = &smCodeBlockList; *walk; walk = &((*walk)->nextFile)) { - if(*walk == this) + if (*walk == this) { *walk = nextFile; @@ -275,8 +275,8 @@ void CodeBlock::removeFromCodeList() // Let the telnet debugger know that this code // block has been unloaded and that it needs to // remove references to it. - if ( TelDebugger ) - TelDebugger->clearCodeBlockPointers( this ); + if (TelDebugger) + TelDebugger->clearCodeBlockPointers(this); } void CodeBlock::calcBreakList() @@ -285,21 +285,21 @@ void CodeBlock::calcBreakList() S32 line = -1; U32 seqCount = 0; U32 i; - for(i = 0; i < lineBreakPairCount; i++) + for (i = 0; i < lineBreakPairCount; i++) { U32 lineNumber = lineBreakPairs[i * 2]; - if(lineNumber == U32(line + 1)) + if (lineNumber == U32(line + 1)) seqCount++; else { - if(seqCount) + if (seqCount) size++; size++; seqCount = 1; } line = lineNumber; } - if(seqCount) + if (seqCount) size++; breakList = new U32[size]; @@ -308,15 +308,15 @@ void CodeBlock::calcBreakList() seqCount = 0; size = 0; - for(i = 0; i < lineBreakPairCount; i++) + for (i = 0; i < lineBreakPairCount; i++) { U32 lineNumber = lineBreakPairs[i * 2]; - if(lineNumber == U32(line + 1)) + if (lineNumber == U32(line + 1)) seqCount++; else { - if(seqCount) + if (seqCount) breakList[size++] = seqCount; breakList[size++] = lineNumber - getMax(0, line) - 1; seqCount = 1; @@ -325,10 +325,10 @@ void CodeBlock::calcBreakList() line = lineNumber; } - if(seqCount) + if (seqCount) breakList[size++] = seqCount; - for(i = 0; i < lineBreakPairCount; i++) + for (i = 0; i < lineBreakPairCount; i++) { U32 *p = lineBreakPairs + i * 2; p[0] = (p[0] << 8) | code[p[1]]; @@ -337,8 +337,8 @@ void CodeBlock::calcBreakList() // Let the telnet debugger know that this code // block has been loaded and that it can add break // points it has for it. - if ( TelDebugger ) - TelDebugger->addAllBreakpoints( this ); + if (TelDebugger) + TelDebugger->addAllBreakpoints(this); } bool CodeBlock::read(StringTableEntry fileName, Stream &st) @@ -348,19 +348,19 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) name = fileName; - if(fileName) + if (fileName) { fullPath = NULL; - if(Platform::isFullPath(fileName)) + if (Platform::isFullPath(fileName)) fullPath = fileName; - if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) + if (dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) name = StringTable->insert(fileName + dStrlen(exePath) + 1, true); - else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) + else if (dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) name = StringTable->insert(fileName + dStrlen(cwd) + 1, true); - if(fullPath == NULL) + if (fullPath == NULL) { char buf[1024]; fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); @@ -368,13 +368,13 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) modPath = Con::getModNameFromPath(fileName); } - + // addToCodeList(); - U32 globalSize,size,i; + U32 globalSize, size, i; st.read(&size); - if(size) + if (size) { globalStrings = new char[size]; globalStringsMaxLen = size; @@ -382,24 +382,24 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) } globalSize = size; st.read(&size); - if(size) + if (size) { functionStrings = new char[size]; functionStringsMaxLen = size; st.read(size, functionStrings); } st.read(&size); - if(size) + if (size) { globalFloats = new F64[size]; - for(U32 i = 0; i < size; i++) + for (U32 i = 0; i < size; i++) st.read(&globalFloats[i]); } st.read(&size); - if(size) + if (size) { functionFloats = new F64[size]; - for(U32 i = 0; i < size; i++) + for (U32 i = 0; i < size; i++) st.read(&functionFloats[i]); } U32 codeLength; @@ -409,17 +409,17 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) U32 totSize = codeLength + lineBreakPairCount * 2; code = new U32[totSize]; - for(i = 0; i < codeLength; i++) + for (i = 0; i < codeLength; i++) { U8 b; st.read(&b); - if(b == 0xFF) + if (b == 0xFF) st.read(&code[i]); else code[i] = b; } - for(i = codeLength; i < totSize; i++) + for (i = codeLength; i < totSize; i++) st.read(&code[i]); lineBreakPairs = code + codeLength; @@ -427,26 +427,26 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) // StringTable-ize our identifiers. U32 identCount; st.read(&identCount); - while(identCount--) + while (identCount--) { U32 offset; st.read(&offset); StringTableEntry ste; - if(offset < globalSize) + if (offset < globalSize) ste = StringTable->insert(globalStrings + offset); else ste = StringTable->EmptyString(); U32 count; st.read(&count); - while(count--) + while (count--) { U32 ip; st.read(&ip); - code[ip] = *((U32 *) &ste); + code[ip] = *((U32 *)&ste); } } - if(lineBreakPairCount) + if (lineBreakPairCount) calcBreakList(); return true; @@ -456,11 +456,11 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, const char *inScript, bool overrideNoDso) { AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); - + // This will return true, but return value is ignored char *script; - chompUTF8BOM( inScript, &script ); - + chompUTF8BOM(inScript, &script); + gSyntaxError = false; consoleAllocReset(); @@ -490,19 +490,19 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con } - if(gSyntaxError) + if (gSyntaxError) { consoleAllocReset(); return false; - } + } #ifdef TORQUE_NO_DSO_GENERATION - if(!overrideNoDso) + if (!overrideNoDso) return false; #endif // !TORQUE_NO_DSO_GENERATION FileStream st; - if(!st.open(codeFileName, Torque::FS::File::Write)) + if (!st.open(codeFileName, Torque::FS::File::Write)) return false; st.write(U32(Con::DSOVersion)); @@ -513,7 +513,7 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con CodeStream codeStream; U32 lastIp; - if(gStatementList) + if (gStatementList) { lastIp = compileBlock(gStatementList, codeStream, 0) + 1; } @@ -522,10 +522,10 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con codeSize = 1; lastIp = 0; } - + codeStream.emit(OP_RETURN); codeStream.emitCodeStream(&codeSize, &code, &lineBreakPairs); - + lineBreakPairCount = codeStream.getNumLineBreaks(); // Write string table data... @@ -536,18 +536,18 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con getGlobalFloatTable().write(st); getFunctionFloatTable().write(st); - if(lastIp != codeSize) + if (lastIp != codeSize) Con::errorf(ConsoleLogEntry::General, "CodeBlock::compile - precompile size mismatch, a precompile/compile function pair is probably mismatched."); - + U32 totSize = codeSize + codeStream.getNumLineBreaks() * 2; st.write(codeSize); st.write(lineBreakPairCount); // Write out our bytecode, doing a bit of compression for low numbers. - U32 i; - for(i = 0; i < codeSize; i++) + U32 i; + for (i = 0; i < codeSize; i++) { - if(code[i] < 0xFF) + if (code[i] < 0xFF) st.write(U8(code[i])); else { @@ -557,7 +557,7 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con } // Write the break info... - for(i = codeSize; i < totSize; i++) + for (i = codeSize; i < totSize; i++) st.write(code[i]); getIdentTable().write(st); @@ -573,32 +573,32 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, S32 setFrame) { AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread"); - + // Check for a UTF8 script file char *string; - chompUTF8BOM( inString, &string ); + chompUTF8BOM(inString, &string); STEtoCode = evalSTEtoCode; consoleAllocReset(); name = fileName; - if(fileName) + if (fileName) { const StringTableEntry exePath = Platform::getMainDotCsDir(); const StringTableEntry cwd = Platform::getCurrentDirectory(); fullPath = NULL; - - if(Platform::isFullPath(fileName)) + + if (Platform::isFullPath(fileName)) fullPath = fileName; - if(dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) + if (dStrnicmp(exePath, fileName, dStrlen(exePath)) == 0) name = StringTable->insert(fileName + dStrlen(exePath) + 1, true); - else if(dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) + else if (dStrnicmp(cwd, fileName, dStrlen(cwd)) == 0) name = StringTable->insert(fileName + dStrlen(cwd) + 1, true); - if(fullPath == NULL) + if (fullPath == NULL) { char buf[1024]; fullPath = StringTable->insert(Platform::makeFullPathName(fileName, buf, sizeof(buf)), true); @@ -607,9 +607,9 @@ ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *in modPath = Con::getModNameFromPath(fileName); } - if(name) + if (name) addToCodeList(); - + gStatementList = NULL; gAnonFunctionList = NULL; @@ -632,7 +632,7 @@ ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *in } } - if(!gStatementList) + if (!gStatementList) { delete this; return ConsoleValueRef(); @@ -641,32 +641,32 @@ ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *in resetTables(); smInFunction = false; - + CodeStream codeStream; U32 lastIp = compileBlock(gStatementList, codeStream, 0); lineBreakPairCount = codeStream.getNumLineBreaks(); - globalStrings = getGlobalStringTable().build(); + globalStrings = getGlobalStringTable().build(); globalStringsMaxLen = getGlobalStringTable().totalLen; functionStrings = getFunctionStringTable().build(); functionStringsMaxLen = getFunctionStringTable().totalLen; - globalFloats = getGlobalFloatTable().build(); - functionFloats = getFunctionFloatTable().build(); - + globalFloats = getGlobalFloatTable().build(); + functionFloats = getFunctionFloatTable().build(); + codeStream.emit(OP_RETURN); codeStream.emitCodeStream(&codeSize, &code, &lineBreakPairs); - + //dumpInstructions(0, false); - + consoleAllocReset(); - if(lineBreakPairCount && fileName) + if (lineBreakPairCount && fileName) calcBreakList(); - if(lastIp+1 != codeSize) + if (lastIp + 1 != codeSize) Con::warnf(ConsoleLogEntry::General, "precompile size mismatch, precompile: %d compile: %d", codeSize, lastIp); return exec(0, fileName, NULL, 0, 0, noCalls, NULL, setFrame); @@ -682,85 +682,85 @@ void CodeBlock::incRefCount() void CodeBlock::decRefCount() { refCount--; - if(!refCount) + if (!refCount) delete this; } //------------------------------------------------------------------------- -String CodeBlock::getFunctionArgs( U32 ip ) +String CodeBlock::getFunctionArgs(U32 ip) { StringBuilder str; - - U32 fnArgc = code[ ip + 5 ]; - for( U32 i = 0; i < fnArgc; ++ i ) - { - StringTableEntry var = CodeToSTE(code, ip + (i*2) + 6); - - if( i != 0 ) - str.append( ", " ); - str.append( "string " ); + U32 fnArgc = code[ip + 5]; + for (U32 i = 0; i < fnArgc; ++i) + { + StringTableEntry var = CodeToSTE(code, ip + (i * 2) + 6); + + if (i != 0) + str.append(", "); + + str.append("string "); // Try to capture junked parameters - if( var[ 0 ] ) - str.append( var + 1 ); + if (var[0]) + str.append(var + 1); else - str.append( "JUNK" ); + str.append("JUNK"); } - + return str.end(); } //------------------------------------------------------------------------- -void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) +void CodeBlock::dumpInstructions(U32 startIp, bool upToReturn) { U32 ip = startIp; smInFunction = false; U32 endFuncIp = 0; - - while( ip < codeSize ) + + while (ip < codeSize) { if (ip > endFuncIp) { smInFunction = false; } - - switch( code[ ip ++ ] ) + + switch (code[ip++]) { - + case OP_FUNC_DECL: { - StringTableEntry fnName = CodeToSTE(code, ip); - StringTableEntry fnNamespace = CodeToSTE(code, ip+2); - StringTableEntry fnPackage = CodeToSTE(code, ip+4); - bool hasBody = bool(code[ip+6]); - U32 newIp = code[ ip + 7 ]; - U32 argc = code[ ip + 8 ]; + StringTableEntry fnName = CodeToSTE(code, ip); + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnPackage = CodeToSTE(code, ip + 4); + bool hasBody = bool(code[ip + 6]); + U32 newIp = code[ip + 7]; + U32 argc = code[ip + 8]; endFuncIp = newIp; - - Con::printf( "%i: OP_FUNC_DECL name=%s nspace=%s package=%s hasbody=%i newip=%i argc=%i", - ip - 1, fnName, fnNamespace, fnPackage, hasBody, newIp, argc ); - + + Con::printf("%i: OP_FUNC_DECL name=%s nspace=%s package=%s hasbody=%i newip=%i argc=%i", + ip - 1, fnName, fnNamespace, fnPackage, hasBody, newIp, argc); + // Skip args. - + ip += 9 + (argc * 2); smInFunction = true; break; } - + case OP_CREATE_OBJECT: { StringTableEntry objParent = CodeToSTE(code, ip); - bool isDataBlock = code[ip + 2]; - bool isInternal = code[ip + 3]; - bool isSingleton = code[ip + 4]; - U32 lineNumber = code[ip + 5]; - U32 failJump = code[ip + 6]; - - Con::printf( "%i: OP_CREATE_OBJECT objParent=%s isDataBlock=%i isInternal=%i isSingleton=%i lineNumber=%i failJump=%i", - ip - 1, objParent, isDataBlock, isInternal, isSingleton, lineNumber, failJump ); + bool isDataBlock = code[ip + 2]; + bool isInternal = code[ip + 3]; + bool isSingleton = code[ip + 4]; + U32 lineNumber = code[ip + 5]; + U32 failJump = code[ip + 6]; + + Con::printf("%i: OP_CREATE_OBJECT objParent=%s isDataBlock=%i isInternal=%i isSingleton=%i lineNumber=%i failJump=%i", + ip - 1, objParent, isDataBlock, isInternal, isSingleton, lineNumber, failJump); ip += 7; break; @@ -769,87 +769,87 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ADD_OBJECT: { bool placeAtRoot = code[ip++]; - Con::printf( "%i: OP_ADD_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot ); + Con::printf("%i: OP_ADD_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot); break; } - + case OP_END_OBJECT: { bool placeAtRoot = code[ip++]; - Con::printf( "%i: OP_END_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot ); + Con::printf("%i: OP_END_OBJECT placeAtRoot=%i", ip - 1, placeAtRoot); break; } - + case OP_FINISH_OBJECT: { - Con::printf( "%i: OP_FINISH_OBJECT", ip - 1 ); + Con::printf("%i: OP_FINISH_OBJECT", ip - 1); break; } - + case OP_JMPIFFNOT: { - Con::printf( "%i: OP_JMPIFFNOT ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFFNOT ip=%i", ip - 1, code[ip]); + ++ip; break; } - + case OP_JMPIFNOT: { - Con::printf( "%i: OP_JMPIFNOT ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFNOT ip=%i", ip - 1, code[ip]); + ++ip; break; } - + case OP_JMPIFF: { - Con::printf( "%i: OP_JMPIFF ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFF ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMPIF: { - Con::printf( "%i: OP_JMPIF ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIF ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMPIFNOT_NP: { - Con::printf( "%i: OP_JMPIFNOT_NP ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIFNOT_NP ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMPIF_NP: { - Con::printf( "%i: OP_JMPIF_NP ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMPIF_NP ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_JMP: { - Con::printf( "%i: OP_JMP ip=%i", ip - 1, code[ ip ] ); - ++ ip; + Con::printf("%i: OP_JMP ip=%i", ip - 1, code[ip]); + ++ip; break; } case OP_RETURN: { - Con::printf( "%i: OP_RETURN", ip - 1 ); - - if( upToReturn ) + Con::printf("%i: OP_RETURN", ip - 1); + + if (upToReturn) return; - + break; } case OP_RETURN_VOID: { - Con::printf( "%i: OP_RETURNVOID", ip - 1 ); + Con::printf("%i: OP_RETURNVOID", ip - 1); - if( upToReturn ) + if (upToReturn) return; break; @@ -857,9 +857,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_RETURN_UINT: { - Con::printf( "%i: OP_RETURNUINT", ip - 1 ); + Con::printf("%i: OP_RETURNUINT", ip - 1); - if( upToReturn ) + if (upToReturn) return; break; @@ -867,9 +867,9 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_RETURN_FLT: { - Con::printf( "%i: OP_RETURNFLT", ip - 1 ); + Con::printf("%i: OP_RETURNFLT", ip - 1); - if( upToReturn ) + if (upToReturn) return; break; @@ -877,521 +877,593 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_CMPEQ: { - Con::printf( "%i: OP_CMPEQ", ip - 1 ); + Con::printf("%i: OP_CMPEQ", ip - 1); break; } case OP_CMPGR: { - Con::printf( "%i: OP_CMPGR", ip - 1 ); + Con::printf("%i: OP_CMPGR", ip - 1); break; } case OP_CMPGE: { - Con::printf( "%i: OP_CMPGE", ip - 1 ); + Con::printf("%i: OP_CMPGE", ip - 1); break; } case OP_CMPLT: { - Con::printf( "%i: OP_CMPLT", ip - 1 ); + Con::printf("%i: OP_CMPLT", ip - 1); break; } case OP_CMPLE: { - Con::printf( "%i: OP_CMPLE", ip - 1 ); + Con::printf("%i: OP_CMPLE", ip - 1); break; } case OP_CMPNE: { - Con::printf( "%i: OP_CMPNE", ip - 1 ); + Con::printf("%i: OP_CMPNE", ip - 1); break; } case OP_XOR: { - Con::printf( "%i: OP_XOR", ip - 1 ); + Con::printf("%i: OP_XOR", ip - 1); break; } case OP_MOD: { - Con::printf( "%i: OP_MOD", ip - 1 ); + Con::printf("%i: OP_MOD", ip - 1); break; } case OP_BITAND: { - Con::printf( "%i: OP_BITAND", ip - 1 ); + Con::printf("%i: OP_BITAND", ip - 1); break; } case OP_BITOR: { - Con::printf( "%i: OP_BITOR", ip - 1 ); + Con::printf("%i: OP_BITOR", ip - 1); break; } case OP_NOT: { - Con::printf( "%i: OP_NOT", ip - 1 ); + Con::printf("%i: OP_NOT", ip - 1); break; } case OP_NOTF: { - Con::printf( "%i: OP_NOTF", ip - 1 ); + Con::printf("%i: OP_NOTF", ip - 1); break; } case OP_ONESCOMPLEMENT: { - Con::printf( "%i: OP_ONESCOMPLEMENT", ip - 1 ); + Con::printf("%i: OP_ONESCOMPLEMENT", ip - 1); break; } case OP_SHR: { - Con::printf( "%i: OP_SHR", ip - 1 ); + Con::printf("%i: OP_SHR", ip - 1); break; } case OP_SHL: { - Con::printf( "%i: OP_SHL", ip - 1 ); + Con::printf("%i: OP_SHL", ip - 1); break; } case OP_AND: { - Con::printf( "%i: OP_AND", ip - 1 ); + Con::printf("%i: OP_AND", ip - 1); break; } case OP_OR: { - Con::printf( "%i: OP_OR", ip - 1 ); + Con::printf("%i: OP_OR", ip - 1); break; } case OP_ADD: { - Con::printf( "%i: OP_ADD", ip - 1 ); + Con::printf("%i: OP_ADD", ip - 1); break; } case OP_SUB: { - Con::printf( "%i: OP_SUB", ip - 1 ); + Con::printf("%i: OP_SUB", ip - 1); break; } case OP_MUL: { - Con::printf( "%i: OP_MUL", ip - 1 ); + Con::printf("%i: OP_MUL", ip - 1); break; } case OP_DIV: { - Con::printf( "%i: OP_DIV", ip - 1 ); + Con::printf("%i: OP_DIV", ip - 1); break; } case OP_NEG: { - Con::printf( "%i: OP_NEG", ip - 1 ); + Con::printf("%i: OP_NEG", ip - 1); + break; + } + + case OP_INC: + { + Con::printf("%i: OP_INC varName=%s", ip - 1, CodeToSTE(code, ip)); + ip += 2; + break; + } + + case OP_DEC: + { + Con::printf("%i: OP_DEC varName=%s", ip - 1, CodeToSTE(code, ip)); + ip += 2; break; } case OP_SETCURVAR: { StringTableEntry var = CodeToSTE(code, ip); - - Con::printf( "%i: OP_SETCURVAR var=%s", ip - 1, var ); + + Con::printf("%i: OP_SETCURVAR var=%s", ip - 1, var); ip += 2; break; } - + case OP_SETCURVAR_CREATE: { StringTableEntry var = CodeToSTE(code, ip); - - Con::printf( "%i: OP_SETCURVAR_CREATE var=%s", ip - 1, var ); + + Con::printf("%i: OP_SETCURVAR_CREATE var=%s", ip - 1, var); ip += 2; break; } - + case OP_SETCURVAR_ARRAY: { - Con::printf( "%i: OP_SETCURVAR_ARRAY", ip - 1 ); + Con::printf("%i: OP_SETCURVAR_ARRAY", ip - 1); break; } - + + case OP_SETCURVAR_ARRAY_VARLOOKUP: + { + StringTableEntry arrayName = CodeToSTE(code, ip); + StringTableEntry arrayLookup = CodeToSTE(code, ip + 2); + + Con::printf("%i: OP_SETCURVAR_ARRAY_VARLOOKUP arrayName=%s arrayLookup=%s", ip - 1, arrayName, arrayLookup); + ip += 4; + break; + } + case OP_SETCURVAR_ARRAY_CREATE: { - Con::printf( "%i: OP_SETCURVAR_ARRAY_CREATE", ip - 1 ); + Con::printf("%i: OP_SETCURVAR_ARRAY_CREATE", ip - 1); break; } - + + case OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP: + { + StringTableEntry arrayName = CodeToSTE(code, ip); + StringTableEntry arrayLookup = CodeToSTE(code, ip + 2); + + Con::printf("%i: OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP arrayName=%s arrayLookup=%s", ip - 1, arrayName, arrayLookup); + ip += 4; + break; + } + case OP_LOADVAR_UINT: { - Con::printf( "%i: OP_LOADVAR_UINT", ip - 1 ); + Con::printf("%i: OP_LOADVAR_UINT", ip - 1); break; } - + case OP_LOADVAR_FLT: { - Con::printf( "%i: OP_LOADVAR_FLT", ip - 1 ); + Con::printf("%i: OP_LOADVAR_FLT", ip - 1); break; } case OP_LOADVAR_STR: { - Con::printf( "%i: OP_LOADVAR_STR", ip - 1 ); + Con::printf("%i: OP_LOADVAR_STR", ip - 1); break; } case OP_LOADVAR_VAR: { - Con::printf( "%i: OP_LOADVAR_VAR", ip - 1 ); + Con::printf("%i: OP_LOADVAR_VAR", ip - 1); break; } case OP_SAVEVAR_UINT: { - Con::printf( "%i: OP_SAVEVAR_UINT", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_UINT", ip - 1); break; } case OP_SAVEVAR_FLT: { - Con::printf( "%i: OP_SAVEVAR_FLT", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_FLT", ip - 1); break; } case OP_SAVEVAR_STR: { - Con::printf( "%i: OP_SAVEVAR_STR", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_STR", ip - 1); break; } case OP_SAVEVAR_VAR: { - Con::printf( "%i: OP_SAVEVAR_VAR", ip - 1 ); + Con::printf("%i: OP_SAVEVAR_VAR", ip - 1); break; } case OP_SETCUROBJECT: { - Con::printf( "%i: OP_SETCUROBJECT", ip - 1 ); + Con::printf("%i: OP_SETCUROBJECT", ip - 1); break; } case OP_SETCUROBJECT_NEW: { - Con::printf( "%i: OP_SETCUROBJECT_NEW", ip - 1 ); + Con::printf("%i: OP_SETCUROBJECT_NEW", ip - 1); break; } - + case OP_SETCUROBJECT_INTERNAL: { - Con::printf( "%i: OP_SETCUROBJECT_INTERNAL", ip - 1 ); - ++ ip; + Con::printf("%i: OP_SETCUROBJECT_INTERNAL", ip - 1); + ++ip; break; } - + case OP_SETCURFIELD: { StringTableEntry curField = CodeToSTE(code, ip); - Con::printf( "%i: OP_SETCURFIELD field=%s", ip - 1, curField ); + Con::printf("%i: OP_SETCURFIELD field=%s", ip - 1, curField); ip += 2; break; } - + case OP_SETCURFIELD_ARRAY: { - Con::printf( "%i: OP_SETCURFIELD_ARRAY", ip - 1 ); + Con::printf("%i: OP_SETCURFIELD_ARRAY", ip - 1); + break; + } + + case OP_SETCURFIELD_ARRAY_VAR: + { + StringTableEntry var = CodeToSTE(code, ip); + Con::printf("%i: OP_SETCURFIELD_ARRAY_VAR var=%s", ip - 1, var); + ip += 2; + break; + } + + case OP_SETCURFIELD_THIS: + { + StringTableEntry curField = CodeToSTE(code, ip); + Con::printf("%i: OP_SETCURFIELD_THIS field=%s", ip - 1, curField); + ip += 2; break; } case OP_SETCURFIELD_TYPE: { - U32 type = code[ ip ]; - Con::printf( "%i: OP_SETCURFIELD_TYPE type=%i", ip - 1, type ); - ++ ip; + U32 type = code[ip]; + Con::printf("%i: OP_SETCURFIELD_TYPE type=%i", ip - 1, type); + ++ip; break; } case OP_LOADFIELD_UINT: { - Con::printf( "%i: OP_LOADFIELD_UINT", ip - 1 ); + Con::printf("%i: OP_LOADFIELD_UINT", ip - 1); break; } case OP_LOADFIELD_FLT: { - Con::printf( "%i: OP_LOADFIELD_FLT", ip - 1 ); + Con::printf("%i: OP_LOADFIELD_FLT", ip - 1); break; } case OP_LOADFIELD_STR: { - Con::printf( "%i: OP_LOADFIELD_STR", ip - 1 ); + Con::printf("%i: OP_LOADFIELD_STR", ip - 1); break; } case OP_SAVEFIELD_UINT: { - Con::printf( "%i: OP_SAVEFIELD_UINT", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_UINT", ip - 1); break; } case OP_SAVEFIELD_FLT: { - Con::printf( "%i: OP_SAVEFIELD_FLT", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_FLT", ip - 1); break; } case OP_SAVEFIELD_STR: { - Con::printf( "%i: OP_SAVEFIELD_STR", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_STR", ip - 1); break; } case OP_STR_TO_UINT: { - Con::printf( "%i: OP_STR_TO_UINT", ip - 1 ); + Con::printf("%i: OP_STR_TO_UINT", ip - 1); break; } case OP_STR_TO_FLT: { - Con::printf( "%i: OP_STR_TO_FLT", ip - 1 ); + Con::printf("%i: OP_STR_TO_FLT", ip - 1); break; } case OP_STR_TO_NONE: { - Con::printf( "%i: OP_STR_TO_NONE", ip - 1 ); + Con::printf("%i: OP_STR_TO_NONE", ip - 1); break; } case OP_FLT_TO_UINT: { - Con::printf( "%i: OP_FLT_TO_UINT", ip - 1 ); + Con::printf("%i: OP_FLT_TO_UINT", ip - 1); break; } case OP_FLT_TO_STR: { - Con::printf( "%i: OP_FLT_TO_STR", ip - 1 ); + Con::printf("%i: OP_FLT_TO_STR", ip - 1); break; } case OP_FLT_TO_NONE: { - Con::printf( "%i: OP_FLT_TO_NONE", ip - 1 ); + Con::printf("%i: OP_FLT_TO_NONE", ip - 1); break; } case OP_UINT_TO_FLT: { - Con::printf( "%i: OP_SAVEFIELD_STR", ip - 1 ); + Con::printf("%i: OP_SAVEFIELD_STR", ip - 1); break; } case OP_UINT_TO_STR: { - Con::printf( "%i: OP_UINT_TO_STR", ip - 1 ); + Con::printf("%i: OP_UINT_TO_STR", ip - 1); break; } case OP_UINT_TO_NONE: { - Con::printf( "%i: OP_UINT_TO_NONE", ip - 1 ); + Con::printf("%i: OP_UINT_TO_NONE", ip - 1); break; } case OP_COPYVAR_TO_NONE: { - Con::printf( "%i: OP_COPYVAR_TO_NONE", ip - 1 ); + Con::printf("%i: OP_COPYVAR_TO_NONE", ip - 1); break; } case OP_LOADIMMED_UINT: { - U32 val = code[ ip ]; - Con::printf( "%i: OP_LOADIMMED_UINT val=%i", ip - 1, val ); - ++ ip; + U32 val = code[ip]; + Con::printf("%i: OP_LOADIMMED_UINT val=%i", ip - 1, val); + ++ip; break; } case OP_LOADIMMED_FLT: { - F64 val = (smInFunction ? functionFloats : globalFloats)[ code[ ip ] ]; - Con::printf( "%i: OP_LOADIMMED_FLT val=%f", ip - 1, val ); - ++ ip; + F64 val = (smInFunction ? functionFloats : globalFloats)[code[ip]]; + Con::printf("%i: OP_LOADIMMED_FLT val=%f", ip - 1, val); + ++ip; break; } case OP_TAG_TO_STR: { - const char* str = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_TAG_TO_STR str=%s", ip - 1, str ); - ++ ip; + const char* str = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_TAG_TO_STR str=%s", ip - 1, str); + ++ip; break; } - + case OP_LOADIMMED_STR: { - const char* str = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_LOADIMMED_STR str=%s", ip - 1, str ); - ++ ip; + const char* str = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_LOADIMMED_STR str=%s", ip - 1, str); + ++ip; break; } case OP_DOCBLOCK_STR: { - const char* str = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_DOCBLOCK_STR str=%s", ip - 1, str ); - ++ ip; + const char* str = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_DOCBLOCK_STR str=%s", ip - 1, str); + ++ip; break; } - + case OP_LOADIMMED_IDENT: { StringTableEntry str = CodeToSTE(code, ip); - Con::printf( "%i: OP_LOADIMMED_IDENT str=%s", ip - 1, str ); + Con::printf("%i: OP_LOADIMMED_IDENT str=%s", ip - 1, str); ip += 2; break; } case OP_CALLFUNC_RESOLVE: { - StringTableEntry fnNamespace = CodeToSTE(code, ip+2); - StringTableEntry fnName = CodeToSTE(code, ip); - U32 callType = code[ip+2]; + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnName = CodeToSTE(code, ip); + U32 callType = code[ip + 2]; - Con::printf( "%i: OP_CALLFUNC_RESOLVE name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, + Con::printf("%i: OP_CALLFUNC_RESOLVE name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, callType == FuncCallExprNode::FunctionCall ? "FunctionCall" - : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall" ); - + : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall"); + ip += 5; break; } - + case OP_CALLFUNC: { - StringTableEntry fnNamespace = CodeToSTE(code, ip+2); - StringTableEntry fnName = CodeToSTE(code, ip); - U32 callType = code[ip+4]; + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnName = CodeToSTE(code, ip); + U32 callType = code[ip + 4]; - Con::printf( "%i: OP_CALLFUNC name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, + Con::printf("%i: OP_CALLFUNC name=%s nspace=%s callType=%s", ip - 1, fnName, fnNamespace, callType == FuncCallExprNode::FunctionCall ? "FunctionCall" - : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall" ); - + : callType == FuncCallExprNode::MethodCall ? "MethodCall" : "ParentCall"); + ip += 5; break; } + case OP_CALLFUNC_POINTER: + { + Con::printf("%i: OP_CALLFUNC_POINTER", ip - 1); + break; + } + + case OP_CALLFUNC_THIS: + { + StringTableEntry fnName = CodeToSTE(code, ip); + Con::printf("%i: OP_CALLFUNC_THIS name=%s ", ip - 1, fnName); + + ip += 2; + break; + } + case OP_ADVANCE_STR: { - Con::printf( "%i: OP_ADVANCE_STR", ip - 1 ); + Con::printf("%i: OP_ADVANCE_STR", ip - 1); break; } case OP_ADVANCE_STR_APPENDCHAR: { - char ch = code[ ip ]; - Con::printf( "%i: OP_ADVANCE_STR_APPENDCHAR char=%c", ip - 1, ch ); - ++ ip; + char ch = code[ip]; + Con::printf("%i: OP_ADVANCE_STR_APPENDCHAR char=%c", ip - 1, ch); + ++ip; break; } case OP_ADVANCE_STR_COMMA: { - Con::printf( "%i: OP_ADVANCE_STR_COMMA", ip - 1 ); + Con::printf("%i: OP_ADVANCE_STR_COMMA", ip - 1); break; } case OP_ADVANCE_STR_NUL: { - Con::printf( "%i: OP_ADVANCE_STR_NUL", ip - 1 ); + Con::printf("%i: OP_ADVANCE_STR_NUL", ip - 1); break; } case OP_REWIND_STR: { - Con::printf( "%i: OP_REWIND_STR", ip - 1 ); + Con::printf("%i: OP_REWIND_STR", ip - 1); break; } case OP_TERMINATE_REWIND_STR: { - Con::printf( "%i: OP_TERMINATE_REWIND_STR", ip - 1 ); + Con::printf("%i: OP_TERMINATE_REWIND_STR", ip - 1); break; } case OP_COMPARE_STR: { - Con::printf( "%i: OP_COMPARE_STR", ip - 1 ); + Con::printf("%i: OP_COMPARE_STR", ip - 1); break; } case OP_PUSH: { - Con::printf( "%i: OP_PUSH", ip - 1 ); + Con::printf("%i: OP_PUSH", ip - 1); break; } case OP_PUSH_UINT: { - Con::printf( "%i: OP_PUSH_UINT", ip - 1 ); + Con::printf("%i: OP_PUSH_UINT", ip - 1); break; } case OP_PUSH_FLT: { - Con::printf( "%i: OP_PUSH_FLT", ip - 1 ); + Con::printf("%i: OP_PUSH_FLT", ip - 1); break; } case OP_PUSH_VAR: { - Con::printf( "%i: OP_PUSH_VAR", ip - 1 ); + Con::printf("%i: OP_PUSH_VAR", ip - 1); + break; + } + + case OP_PUSH_THIS: + { + Con::printf("%i: OP_PUSH_THIS varName=%s", ip - 1, CodeToSTE(code, ip)); + ip += 2; break; } case OP_PUSH_FRAME: { - Con::printf( "%i: OP_PUSH_FRAME", ip - 1 ); + Con::printf("%i: OP_PUSH_FRAME", ip - 1); break; } case OP_ASSERT: { - const char* message = (smInFunction ? functionStrings : globalStrings) + code[ ip ]; - Con::printf( "%i: OP_ASSERT message=%s", ip - 1, message ); - ++ ip; + const char* message = (smInFunction ? functionStrings : globalStrings) + code[ip]; + Con::printf("%i: OP_ASSERT message=%s", ip - 1, message); + ++ip; break; } case OP_BREAK: { - Con::printf( "%i: OP_BREAK", ip - 1 ); + Con::printf("%i: OP_BREAK", ip - 1); break; } - + case OP_ITER_BEGIN: { StringTableEntry varName = CodeToSTE(code, ip); - U32 failIp = code[ ip + 2 ]; - - Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp ); + U32 failIp = code[ip + 2]; + + Con::printf("%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp); ip += 3; break; @@ -1400,35 +1472,35 @@ void CodeBlock::dumpInstructions( U32 startIp, bool upToReturn ) case OP_ITER_BEGIN_STR: { StringTableEntry varName = CodeToSTE(code, ip); - U32 failIp = code[ ip + 2 ]; - - Con::printf( "%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp ); + U32 failIp = code[ip + 2]; + + Con::printf("%i: OP_ITER_BEGIN varName=%s failIp=%i", ip - 1, varName, failIp); ip += 3; break; } - + case OP_ITER: { - U32 breakIp = code[ ip ]; - - Con::printf( "%i: OP_ITER breakIp=%i", ip - 1, breakIp ); + U32 breakIp = code[ip]; - ++ ip; + Con::printf("%i: OP_ITER breakIp=%i", ip - 1, breakIp); + + ++ip; break; } - + case OP_ITER_END: { - Con::printf( "%i: OP_ITER_END", ip - 1 ); + Con::printf("%i: OP_ITER_END", ip - 1); break; } default: - Con::printf( "%i: !!INVALID!!", ip - 1 ); + Con::printf("%i: !!INVALID!!", ip - 1); break; } } - + smInFunction = false; } diff --git a/Engine/source/console/codeBlock.h b/Engine/source/console/codeBlock.h index 71f15c95e..f789f1a92 100644 --- a/Engine/source/console/codeBlock.h +++ b/Engine/source/console/codeBlock.h @@ -35,10 +35,11 @@ class ConsoleValueRef; /// This class represents a block of code, usually mapped directly to a file. class CodeBlock { + friend class CodeInterpreter; private: static CodeBlock* smCodeBlockList; static CodeBlock* smCurrentCodeBlock; - + public: static bool smInFunction; static Compiler::ConsoleParser * smCurrentParser; @@ -89,7 +90,7 @@ public: void calcBreakList(); void clearAllBreaks(); void setAllBreaks(); - void dumpInstructions( U32 startIp = 0, bool upToReturn = false ); + void dumpInstructions(U32 startIp = 0, bool upToReturn = false); /// Returns the first breakable line or 0 if none was found. /// @param lineNumber The one based line number. @@ -106,7 +107,7 @@ public: const char *getFileLine(U32 ip); /// - String getFunctionArgs( U32 offset ); + String getFunctionArgs(U32 offset); bool read(StringTableEntry fileName, Stream &st); bool compile(const char *dsoName, StringTableEntry fileName, const char *script, bool overrideNoDso = false); @@ -129,8 +130,8 @@ public: /// with, zero being the top of the stack. If the the index is /// -1 a new frame is created. If the index is out of range the /// top stack frame is used. - ConsoleValueRef compileExec(StringTableEntry fileName, const char *script, - bool noCalls, S32 setFrame = -1 ); + ConsoleValueRef compileExec(StringTableEntry fileName, const char *script, + bool noCalls, S32 setFrame = -1); /// Executes the existing code in the CodeBlock. The return string is any /// result of the code executed, if any, or an empty string. @@ -147,7 +148,7 @@ public: /// -1 a new frame is created. If the index is out of range the /// top stack frame is used. /// @param packageName The code package name or null. - ConsoleValueRef exec(U32 offset, const char *fnName, Namespace *ns, U32 argc, + ConsoleValueRef exec(U32 offset, const char *fnName, Namespace *ns, U32 argc, ConsoleValueRef *argv, bool noCalls, StringTableEntry packageName, S32 setFrame = -1); }; diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp new file mode 100644 index 000000000..a0e13502f --- /dev/null +++ b/Engine/source/console/codeInterpreter.cpp @@ -0,0 +1,2979 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// +// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames +// Copyright (C) 2015 Faust Logic, Inc. +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// + +#include "console/codeInterpreter.h" +#include "console/compiler.h" +#include "console/simBase.h" +#include "console/telnetDebugger.h" +#include "sim/netStringTable.h" +#include "console/ICallMethod.h" +#include "console/stringStack.h" +#include "util/messaging/message.h" +#include "core/strings/findMatch.h" +#include "core/strings/stringUnit.h" +#include "console/console.h" +#include "console/consoleInternal.h" + +//#define TORQUE_VALIDATE_STACK + +using namespace Compiler; + +enum EvalConstants +{ + MaxStackSize = 1024, + FieldBufferSizeString = 2048, + FieldBufferSizeNumeric = 128, + MethodOnComponent = -2 +}; + +namespace Con +{ + // Current script file name and root, these are registered as + // console variables. + extern StringTableEntry gCurrentFile; + extern StringTableEntry gCurrentRoot; + extern S32 gObjectCopyFailures; +} + +// Gets a component of an object's field value or a variable and returns it +// in val. +static void getFieldComponent(SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField, char val[]) +{ + const char* prevVal = NULL; + + // Grab value from object. + if (object && field) + prevVal = object->getDataField(field, array); + + // Otherwise, grab from the string stack. The value coming in will always + // be a string because that is how multicomponent variables are handled. + else + prevVal = STR.getStringValue(); + + // Make sure we got a value. + if (prevVal && *prevVal) + { + static const StringTableEntry xyzw[] = + { + StringTable->insert("x"), + StringTable->insert("y"), + StringTable->insert("z"), + StringTable->insert("w") + }; + + static const StringTableEntry rgba[] = + { + StringTable->insert("r"), + StringTable->insert("g"), + StringTable->insert("b"), + StringTable->insert("a") + }; + + // Translate xyzw and rgba into the indexed component + // of the variable or field. + // + // Review: Should we use strncpy to prevent a buffer overflow? + if (subField == xyzw[0] || subField == rgba[0]) + dStrcpy(val, StringUnit::getUnit(prevVal, 0, " \t\n")); + + else if (subField == xyzw[1] || subField == rgba[1]) + dStrcpy(val, StringUnit::getUnit(prevVal, 1, " \t\n")); + + else if (subField == xyzw[2] || subField == rgba[2]) + dStrcpy(val, StringUnit::getUnit(prevVal, 2, " \t\n")); + + else if (subField == xyzw[3] || subField == rgba[3]) + dStrcpy(val, StringUnit::getUnit(prevVal, 3, " \t\n")); + + else + val[0] = 0; + } + else + val[0] = 0; +} + +// Sets a component of an object's field value based on the sub field. 'x' will +// set the first field, 'y' the second, and 'z' the third. +static void setFieldComponent(SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField) +{ + // Copy the current string value + char strValue[1024]; + dStrncpy(strValue, STR.getStringValue(), 1024); + + char val[1024] = ""; + const char* prevVal = NULL; + + // Set the value on an object field. + if (object && field) + prevVal = object->getDataField(field, array); + + // Set the value on a variable. + else if (gEvalState.currentVariable) + prevVal = gEvalState.getStringVariable(); + + // Ensure that the variable has a value + if (!prevVal) + return; + + static const StringTableEntry xyzw[] = + { + StringTable->insert("x"), + StringTable->insert("y"), + StringTable->insert("z"), + StringTable->insert("w") + }; + + static const StringTableEntry rgba[] = + { + StringTable->insert("r"), + StringTable->insert("g"), + StringTable->insert("b"), + StringTable->insert("a") + }; + + // Insert the value into the specified + // component of the string. + // + // Review: Should we use strncpy to prevent a buffer overflow? + if (subField == xyzw[0] || subField == rgba[0]) + dStrcpy(val, StringUnit::setUnit(prevVal, 0, strValue, " \t\n")); + + else if (subField == xyzw[1] || subField == rgba[1]) + dStrcpy(val, StringUnit::setUnit(prevVal, 1, strValue, " \t\n")); + + else if (subField == xyzw[2] || subField == rgba[2]) + dStrcpy(val, StringUnit::setUnit(prevVal, 2, strValue, " \t\n")); + + else if (subField == xyzw[3] || subField == rgba[3]) + dStrcpy(val, StringUnit::setUnit(prevVal, 3, strValue, " \t\n")); + + if (val[0] != 0) + { + // Update the field or variable. + if (object && field) + object->setDataField(field, 0, val); + else if (gEvalState.currentVariable) + gEvalState.setStringVariable(val); + } +} +extern ExprEvalState gEvalState; + +char sTraceBuffer[1024]; + +StringStack STR; +ConsoleValueStack CSTK; + +U32 _FLT = 0; ///< Stack pointer for floatStack. +U32 _UINT = 0; ///< Stack pointer for intStack. +U32 _ITER = 0; ///< Stack pointer for iterStack. + +IterStackRecord iterStack[MaxStackSize]; + +F64 floatStack[MaxStackSize]; +S64 intStack[MaxStackSize]; + +char curFieldArray[256]; +char prevFieldArray[256]; + +typedef OPCodeReturn(CodeInterpreter::*OpFn)(U32&); + +static OpFn gOpCodeArray[MAX_OP_CODELEN]; + +CodeInterpreter::CodeInterpreter(CodeBlock *cb) : + mCodeBlock(cb), + mIterDepth(0), + mCurFloatTable(nullptr), + mCurStringTable(nullptr), + mThisFunctionName(nullptr), + mPopFrame(false), + mObjectCreationStackIndex(0), + mCurrentNewObject(nullptr), + mFailJump(0), + mPrevField(nullptr), + mCurField(nullptr), + mPrevObject(nullptr), + mCurObject(nullptr), + mSaveObject(nullptr), + mThisObject(nullptr), + mNSEntry(nullptr), + mCurFNDocBlock(nullptr), + mCurNSDocBlock(nullptr), + mCallArgc(0), + mCallArgv(nullptr), + mSaveCodeBlock(nullptr), + mCurrentInstruction(0) +{ +} + +CodeInterpreter::~CodeInterpreter() +{ +} + +void CodeInterpreter::init() +{ + gOpCodeArray[OP_FUNC_DECL] = &CodeInterpreter::op_func_decl; + gOpCodeArray[OP_CREATE_OBJECT] = &CodeInterpreter::op_create_object; + gOpCodeArray[OP_ADD_OBJECT] = &CodeInterpreter::op_add_object; + gOpCodeArray[OP_END_OBJECT] = &CodeInterpreter::op_end_object; + gOpCodeArray[OP_FINISH_OBJECT] = &CodeInterpreter::op_finish_object; + gOpCodeArray[OP_JMPIFFNOT] = &CodeInterpreter::op_jmpiffnot; + gOpCodeArray[OP_JMPIFNOT] = &CodeInterpreter::op_jmpifnot; + gOpCodeArray[OP_JMPIFF] = &CodeInterpreter::op_jmpiff; + gOpCodeArray[OP_JMPIF] = &CodeInterpreter::op_jmpif; + gOpCodeArray[OP_JMPIFNOT_NP] = &CodeInterpreter::op_jmpifnot_np; + gOpCodeArray[OP_JMPIF_NP] = &CodeInterpreter::op_jmpif_np; + gOpCodeArray[OP_JMP] = &CodeInterpreter::op_jmp; + gOpCodeArray[OP_RETURN] = &CodeInterpreter::op_return; + gOpCodeArray[OP_RETURN_VOID] = &CodeInterpreter::op_return_void; + gOpCodeArray[OP_RETURN_FLT] = &CodeInterpreter::op_return_flt; + gOpCodeArray[OP_RETURN_UINT] = &CodeInterpreter::op_return_uint; + gOpCodeArray[OP_CMPEQ] = &CodeInterpreter::op_cmpeq; + gOpCodeArray[OP_CMPGR] = &CodeInterpreter::op_cmpgr; + gOpCodeArray[OP_CMPGE] = &CodeInterpreter::op_cmpge; + gOpCodeArray[OP_CMPLT] = &CodeInterpreter::op_cmplt; + gOpCodeArray[OP_CMPLE] = &CodeInterpreter::op_cmple; + gOpCodeArray[OP_CMPNE] = &CodeInterpreter::op_cmpne; + gOpCodeArray[OP_XOR] = &CodeInterpreter::op_xor; + gOpCodeArray[OP_MOD] = &CodeInterpreter::op_mod; + gOpCodeArray[OP_BITAND] = &CodeInterpreter::op_bitand; + gOpCodeArray[OP_BITOR] = &CodeInterpreter::op_bitor; + gOpCodeArray[OP_NOT] = &CodeInterpreter::op_not; + gOpCodeArray[OP_NOTF] = &CodeInterpreter::op_notf; + gOpCodeArray[OP_ONESCOMPLEMENT] = &CodeInterpreter::op_onescomplement; + gOpCodeArray[OP_SHR] = &CodeInterpreter::op_shr; + gOpCodeArray[OP_SHL] = &CodeInterpreter::op_shl; + gOpCodeArray[OP_AND] = &CodeInterpreter::op_and; + gOpCodeArray[OP_OR] = &CodeInterpreter::op_or; + gOpCodeArray[OP_ADD] = &CodeInterpreter::op_add; + gOpCodeArray[OP_SUB] = &CodeInterpreter::op_sub; + gOpCodeArray[OP_MUL] = &CodeInterpreter::op_mul; + gOpCodeArray[OP_DIV] = &CodeInterpreter::op_div; + gOpCodeArray[OP_NEG] = &CodeInterpreter::op_neg; + gOpCodeArray[OP_INC] = &CodeInterpreter::op_inc; + gOpCodeArray[OP_DEC] = &CodeInterpreter::op_dec; + gOpCodeArray[OP_SETCURVAR] = &CodeInterpreter::op_setcurvar; + gOpCodeArray[OP_SETCURVAR_CREATE] = &CodeInterpreter::op_setcurvar_create; + gOpCodeArray[OP_SETCURVAR_ARRAY] = &CodeInterpreter::op_setcurvar_array; + gOpCodeArray[OP_SETCURVAR_ARRAY_VARLOOKUP] = &CodeInterpreter::op_setcurvar_array_varlookup; + gOpCodeArray[OP_SETCURVAR_ARRAY_CREATE] = &CodeInterpreter::op_setcurvar_array_create; + gOpCodeArray[OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP] = &CodeInterpreter::op_setcurvar_array_create_varlookup; + gOpCodeArray[OP_LOADVAR_UINT] = &CodeInterpreter::op_loadvar_uint; + gOpCodeArray[OP_LOADVAR_FLT] = &CodeInterpreter::op_loadvar_flt; + gOpCodeArray[OP_LOADVAR_STR] = &CodeInterpreter::op_loadvar_str; + gOpCodeArray[OP_LOADVAR_VAR] = &CodeInterpreter::op_loadvar_var; + gOpCodeArray[OP_SAVEVAR_UINT] = &CodeInterpreter::op_savevar_uint; + gOpCodeArray[OP_SAVEVAR_FLT] = &CodeInterpreter::op_savevar_flt; + gOpCodeArray[OP_SAVEVAR_STR] = &CodeInterpreter::op_savevar_str; + gOpCodeArray[OP_SAVEVAR_VAR] = &CodeInterpreter::op_savevar_var; + gOpCodeArray[OP_SETCUROBJECT] = &CodeInterpreter::op_setcurobject; + gOpCodeArray[OP_SETCUROBJECT_INTERNAL] = &CodeInterpreter::op_setcurobject_internal; + gOpCodeArray[OP_SETCUROBJECT_NEW] = &CodeInterpreter::op_setcurobject_new; + gOpCodeArray[OP_SETCURFIELD] = &CodeInterpreter::op_setcurfield; + gOpCodeArray[OP_SETCURFIELD_ARRAY] = &CodeInterpreter::op_setcurfield_array; + gOpCodeArray[OP_SETCURFIELD_TYPE] = &CodeInterpreter::op_setcurfield_type; + gOpCodeArray[OP_SETCURFIELD_ARRAY_VAR] = &CodeInterpreter::op_setcurfield_array_var; + gOpCodeArray[OP_SETCURFIELD_THIS] = &CodeInterpreter::op_setcurfield_this; + gOpCodeArray[OP_LOADFIELD_UINT] = &CodeInterpreter::op_loadfield_uint; + gOpCodeArray[OP_LOADFIELD_FLT] = &CodeInterpreter::op_loadfield_flt; + gOpCodeArray[OP_LOADFIELD_STR] = &CodeInterpreter::op_loadfield_str; + gOpCodeArray[OP_SAVEFIELD_UINT] = &CodeInterpreter::op_savefield_uint; + gOpCodeArray[OP_SAVEFIELD_FLT] = &CodeInterpreter::op_savefield_flt; + gOpCodeArray[OP_SAVEFIELD_STR] = &CodeInterpreter::op_savefield_str; + gOpCodeArray[OP_STR_TO_UINT] = &CodeInterpreter::op_str_to_uint; + gOpCodeArray[OP_STR_TO_FLT] = &CodeInterpreter::op_str_to_flt; + gOpCodeArray[OP_STR_TO_NONE] = &CodeInterpreter::op_str_to_none; + gOpCodeArray[OP_FLT_TO_UINT] = &CodeInterpreter::op_flt_to_uint; + gOpCodeArray[OP_FLT_TO_STR] = &CodeInterpreter::op_flt_to_str; + gOpCodeArray[OP_FLT_TO_NONE] = &CodeInterpreter::op_flt_to_none; + gOpCodeArray[OP_UINT_TO_FLT] = &CodeInterpreter::op_uint_to_flt; + gOpCodeArray[OP_UINT_TO_STR] = &CodeInterpreter::op_uint_to_str; + gOpCodeArray[OP_UINT_TO_NONE] = &CodeInterpreter::op_uint_to_none; + gOpCodeArray[OP_COPYVAR_TO_NONE] = &CodeInterpreter::op_copyvar_to_none; + gOpCodeArray[OP_LOADIMMED_UINT] = &CodeInterpreter::op_loadimmed_uint; + gOpCodeArray[OP_LOADIMMED_FLT] = &CodeInterpreter::op_loadimmed_flt; + gOpCodeArray[OP_TAG_TO_STR] = &CodeInterpreter::op_tag_to_str; + gOpCodeArray[OP_LOADIMMED_STR] = &CodeInterpreter::op_loadimmed_str; + gOpCodeArray[OP_DOCBLOCK_STR] = &CodeInterpreter::op_docblock_str; + gOpCodeArray[OP_LOADIMMED_IDENT] = &CodeInterpreter::op_loadimmed_ident; + gOpCodeArray[OP_CALLFUNC_RESOLVE] = &CodeInterpreter::op_callfunc_resolve; + gOpCodeArray[OP_CALLFUNC] = &CodeInterpreter::op_callfunc; + gOpCodeArray[OP_CALLFUNC_POINTER] = &CodeInterpreter::op_callfunc_pointer; + gOpCodeArray[OP_CALLFUNC_THIS] = &CodeInterpreter::op_callfunc_this; + gOpCodeArray[OP_ADVANCE_STR] = &CodeInterpreter::op_advance_str; + gOpCodeArray[OP_ADVANCE_STR_APPENDCHAR] = &CodeInterpreter::op_advance_str_appendchar; + gOpCodeArray[OP_ADVANCE_STR_COMMA] = &CodeInterpreter::op_advance_str_comma; + gOpCodeArray[OP_ADVANCE_STR_NUL] = &CodeInterpreter::op_advance_str_nul; + gOpCodeArray[OP_REWIND_STR] = &CodeInterpreter::op_rewind_str; + gOpCodeArray[OP_TERMINATE_REWIND_STR] = &CodeInterpreter::op_terminate_rewind_str; + gOpCodeArray[OP_COMPARE_STR] = &CodeInterpreter::op_compare_str; + gOpCodeArray[OP_PUSH] = &CodeInterpreter::op_push; + gOpCodeArray[OP_PUSH_UINT] = &CodeInterpreter::op_push_uint; + gOpCodeArray[OP_PUSH_FLT] = &CodeInterpreter::op_push_flt; + gOpCodeArray[OP_PUSH_VAR] = &CodeInterpreter::op_push_var; + gOpCodeArray[OP_PUSH_THIS] = &CodeInterpreter::op_push_this; + gOpCodeArray[OP_PUSH_FRAME] = &CodeInterpreter::op_push_frame; + gOpCodeArray[OP_ASSERT] = &CodeInterpreter::op_assert; + gOpCodeArray[OP_BREAK] = &CodeInterpreter::op_break; + gOpCodeArray[OP_ITER_BEGIN_STR] = &CodeInterpreter::op_iter_begin_str; + gOpCodeArray[OP_ITER_BEGIN] = &CodeInterpreter::op_iter_begin; + gOpCodeArray[OP_ITER] = &CodeInterpreter::op_iter; + gOpCodeArray[OP_ITER_END] = &CodeInterpreter::op_iter_end; + gOpCodeArray[OP_INVALID] = &CodeInterpreter::op_invalid; +} + +ConsoleValueRef CodeInterpreter::exec(U32 ip, + StringTableEntry functionName, + Namespace *thisNamespace, + U32 argc, + ConsoleValueRef *argv, + bool noCalls, + StringTableEntry packageName, + S32 setFrame) +{ + mExec.functionName = functionName; + mExec.thisNamespace = thisNamespace; + mExec.argc = argc; + mExec.argv = argv; + mExec.noCalls = noCalls; + mExec.packageName = packageName; + mExec.setFrame = setFrame; + + mCodeBlock->incRefCount(); + + mPopFrame = false; + +#ifdef TORQUE_VALIDATE_STACK + U32 stackStart = STR.mStartStackSize; +#endif + + STR.clearFunctionOffset(); // ensures arg buffer offset is back to 0 + + // Lets load up our function arguments. + parseArgs(ip); + + // Grab the state of the telenet debugger here once + // so that the push and pop frames are always balanced. + const bool telDebuggerOn = TelDebugger && TelDebugger->isConnected(); + if (telDebuggerOn && setFrame < 0) + TelDebugger->pushStackFrame(); + + mSaveCodeBlock = CodeBlock::smCurrentCodeBlock; + CodeBlock::smCurrentCodeBlock = mCodeBlock; + if (mCodeBlock->name) + { + Con::gCurrentFile = mCodeBlock->name; + Con::gCurrentRoot = mCodeBlock->modPath; + } + + U32 *code = mCodeBlock->code; + + while (true) + { + mCurrentInstruction = code[ip++]; + mNSEntry = nullptr; + +#ifdef TORQUE_VALIDATE_STACK + // OP Code check. + AssertFatal(mCurrentInstruction < MAX_OP_CODELEN, "Invalid OP code in script interpreter"); +#endif + + breakContinueLabel: + OPCodeReturn ret = (this->*gOpCodeArray[mCurrentInstruction])(ip); + if (ret == OPCodeReturn::exitCode) + goto exitLabel; + else if (ret == OPCodeReturn::breakContinue) + goto breakContinueLabel; + } +exitLabel: + if (telDebuggerOn && setFrame < 0) + TelDebugger->popStackFrame(); + + if (mPopFrame) + gEvalState.popFrame(); + + if (argv) + { + if (gEvalState.traceOn) + { + sTraceBuffer[0] = 0; + dStrcat(sTraceBuffer, "Leaving "); + + if (packageName) + { + dStrcat(sTraceBuffer, "["); + dStrcat(sTraceBuffer, packageName); + dStrcat(sTraceBuffer, "]"); + } + if (thisNamespace && thisNamespace->mName) + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s::%s() - return %s", thisNamespace->mName, mThisFunctionName, STR.getStringValue()); + } + else + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s() - return %s", mThisFunctionName, STR.getStringValue()); + } + Con::printf("%s", sTraceBuffer); + } + } + + CodeBlock::smCurrentCodeBlock = mSaveCodeBlock; + if (mSaveCodeBlock && mSaveCodeBlock->name) + { + Con::gCurrentFile = mSaveCodeBlock->name; + Con::gCurrentRoot = mSaveCodeBlock->modPath; + } + + mCodeBlock->decRefCount(); + +#ifdef TORQUE_VALIDATE_STACK + AssertFatal(!(STR.mStartStackSize > stackStart), "String stack not popped enough in script exec"); + AssertFatal(!(STR.mStartStackSize < stackStart), "String stack popped too much in script exec"); +#endif + + return mReturnValue; +} + +void CodeInterpreter::parseArgs(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + if (mExec.argv) + { + U32 fnArgc = code[ip + 2 + 6]; + mThisFunctionName = Compiler::CodeToSTE(code, ip); + S32 wantedArgc = getMin(mExec.argc - 1, fnArgc); // argv[0] is func name + if (gEvalState.traceOn) + { + sTraceBuffer[0] = 0; + dStrcat(sTraceBuffer, "Entering "); + + if (mExec.packageName) + { + dStrcat(sTraceBuffer, "["); + dStrcat(sTraceBuffer, mExec.packageName); + dStrcat(sTraceBuffer, "]"); + } + if (mExec.thisNamespace && mExec.thisNamespace->mName) + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s::%s(", mExec.thisNamespace->mName, mThisFunctionName); + } + else + { + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + "%s(", mThisFunctionName); + } + for (S32 i = 0; i < wantedArgc; i++) + { + dStrcat(sTraceBuffer, mExec.argv[i + 1]); + if (i != wantedArgc - 1) + dStrcat(sTraceBuffer, ", "); + } + dStrcat(sTraceBuffer, ")"); + Con::printf("%s", sTraceBuffer); + } + + gEvalState.pushFrame(mThisFunctionName, mExec.thisNamespace); + mPopFrame = true; + + StringTableEntry thisPointer = StringTable->insert("%this"); + + for (S32 i = 0; i < wantedArgc; i++) + { + StringTableEntry var = Compiler::CodeToSTE(code, ip + (2 + 6 + 1) + (i * 2)); + gEvalState.setCurVarNameCreate(var); + + ConsoleValueRef ref = mExec.argv[i + 1]; + + switch (ref.getType()) + { + case ConsoleValue::TypeInternalInt: + gEvalState.setIntVariable(ref); + break; + case ConsoleValue::TypeInternalFloat: + gEvalState.setFloatVariable(ref); + break; + case ConsoleValue::TypeInternalStringStackPtr: + gEvalState.setStringStackPtrVariable(ref.getStringStackPtrValue()); + break; + case ConsoleValue::TypeInternalStackString: + case ConsoleValue::TypeInternalString: + default: + gEvalState.setStringVariable(ref); + break; + } + + if (var == thisPointer) + { + // %this gets optimized as it is flagged as a constant. + // Since it is guarenteed to be constant, we can then perform optimizations. + gEvalState.currentVariable->mIsConstant = true; + + // Store a reference to the this pointer object. + mThisObject = Sim::findObject(gEvalState.getStringVariable()); + } + } + + ip = ip + (fnArgc * 2) + (2 + 6 + 1); + mCurFloatTable = mCodeBlock->functionFloats; + mCurStringTable = mCodeBlock->functionStrings; + } + else + { + mCurFloatTable = mCodeBlock->globalFloats; + mCurStringTable = mCodeBlock->globalStrings; + + // If requested stack frame isn't available, request a new one + // (this prevents assert failures when creating local + // variables without a stack frame) + if (gEvalState.getStackDepth() <= mExec.setFrame) + mExec.setFrame = -1; + + // Do we want this code to execute using a new stack frame? + if (mExec.setFrame < 0) + { + gEvalState.pushFrame(NULL, NULL); + mPopFrame = true; + } + else + { + // We want to copy a reference to an existing stack frame + // on to the top of the stack. Any change that occurs to + // the locals during this new frame will also occur in the + // original frame. + S32 stackIndex = gEvalState.getStackDepth() - mExec.setFrame - 1; + gEvalState.pushFrameRef(stackIndex); + mPopFrame = true; + } + } +} + +OPCodeReturn CodeInterpreter::op_func_decl(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + if (!mExec.noCalls) + { + StringTableEntry fnName = CodeToSTE(code, ip); + StringTableEntry fnNamespace = CodeToSTE(code, ip + 2); + StringTableEntry fnPackage = CodeToSTE(code, ip + 4); + bool hasBody = (code[ip + 6] & 0x01) != 0; + U32 lineNumber = code[ip + 6] >> 1; + + Namespace::unlinkPackages(); + Namespace *ns = Namespace::find(fnNamespace, fnPackage); + ns->addFunction(fnName, mCodeBlock, hasBody ? ip : 0, mCurFNDocBlock ? dStrdup(mCurFNDocBlock) : NULL, lineNumber);// if no body, set the IP to 0 + if (mCurNSDocBlock) + { + // If we have a docblock before we declare the function in the script file, + // this will attempt to set the doc block to the function. + // See OP_DOCBLOCK_STR + if (fnNamespace == StringTable->lookup(mNSDocBlockClass)) + { + char *usageStr = dStrdup(mCurNSDocBlock); + usageStr[dStrlen(usageStr)] = '\0'; + ns->mUsage = usageStr; + ns->mCleanUpUsage = true; + mCurNSDocBlock = NULL; + } + } + Namespace::relinkPackages(); + + // If we had a docblock, it's definitely not valid anymore, so clear it out. + mCurFNDocBlock = NULL; + + //Con::printf("Adding function %s::%s (%d)", fnNamespace, fnName, ip); + } + ip = code[ip + 7]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_create_object(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + // Read some useful info. + StringTableEntry objParent = CodeToSTE(code, ip); + bool isDataBlock = code[ip + 2]; + bool isInternal = code[ip + 3]; + bool isSingleton = code[ip + 4]; + U32 lineNumber = code[ip + 5]; + mFailJump = code[ip + 6]; + + // If we don't allow calls, we certainly don't allow creating objects! + // Moved this to after failJump is set. Engine was crashing when + // noCalls = true and an object was being created at the beginning of + // a file. ADL. + if (mExec.noCalls) + { + ip = mFailJump; + return OPCodeReturn::success; + } + + // Push the old info to the stack + //Assert( objectCreationStackIndex < objectCreationStackSize ); + mObjectCreationStack[mObjectCreationStackIndex].newObject = mCurrentNewObject; + mObjectCreationStack[mObjectCreationStackIndex++].failJump = mFailJump; + + // Get the constructor information off the stack. + CSTK.getArgcArgv(NULL, &mCallArgc, &mCallArgv); + const char *objectName = mCallArgv[2]; + + // Con::printf("Creating object..."); + + // objectName = argv[1]... + mCurrentNewObject = NULL; + + // Are we creating a datablock? If so, deal with case where we override + // an old one. + if (isDataBlock) + { + // Con::printf(" - is a datablock"); + + // Find the old one if any. + SimObject *db = Sim::getDataBlockGroup()->findObject(objectName); + + // Make sure we're not changing types on ourselves... + if (db && dStricmp(db->getClassName(), mCallArgv[1])) + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare data block %s with a different class.", mCodeBlock->getFileLine(ip), objectName); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + // If there was one, set the currentNewObject and move on. + if (db) + mCurrentNewObject = db; + } + else if (!isInternal) + { + // IF we aren't looking at a local/internal object, then check if + // this object already exists in the global space + + AbstractClassRep* rep = AbstractClassRep::findClassRep(objectName); + if (rep != NULL) { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot name object [%s] the same name as a script class.", + mCodeBlock->getFileLine(ip), objectName); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + SimObject *obj = Sim::findObject((const char*)objectName); + if (obj /*&& !obj->isLocalName()*/) + { + if (isSingleton) + { + // Make sure we're not trying to change types + if (dStricmp(obj->getClassName(), (const char*)mCallArgv[1]) != 0) + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s] with a different class [%s] - was [%s].", + mCodeBlock->getFileLine(ip), objectName, (const char*)mCallArgv[1], obj->getClassName()); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + // We're creating a singleton, so use the found object + // instead of creating a new object. + mCurrentNewObject = obj; + } + else + { + const char* redefineBehavior = Con::getVariable("$Con::redefineBehavior"); + + if (dStricmp(redefineBehavior, "replaceExisting") == 0) + { + // Save our constructor args as the argv vector is stored on the + // string stack and may get stomped if deleteObject triggers + // script execution. + + ConsoleValueRef savedArgv[StringStack::MaxArgs]; + for (int i = 0; i< mCallArgc; i++) { + savedArgv[i] = mCallArgv[i]; + } + //dMemcpy( savedArgv, callArgv, sizeof( savedArgv[ 0 ] ) * callArgc ); + + // Prevent stack value corruption + CSTK.pushFrame(); + STR.pushFrame(); + // -- + + obj->deleteObject(); + obj = NULL; + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + + //dMemcpy( callArgv, savedArgv, sizeof( callArgv[ 0 ] ) * callArgc ); + for (int i = 0; iinsert(newName); + break; + } + } + } + else if (dStricmp(redefineBehavior, "unnameNew") == 0) + { + objectName = StringTable->insert(""); + } + else if (dStricmp(redefineBehavior, "postfixNew") == 0) + { + const char* postfix = Con::getVariable("$Con::redefineBehaviorPostfix"); + String newName = String::ToString("%s%s", objectName, postfix); + + if (Sim::findObject(newName)) + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object with postfix [%s].", + mCodeBlock->getFileLine(ip), newName.c_str()); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + else + objectName = StringTable->insert(newName); + } + else + { + Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s].", + mCodeBlock->getFileLine(ip), objectName); + ip = mFailJump; + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + } + } + } + + STR.popFrame(); + CSTK.popFrame(); + + if (!mCurrentNewObject) + { + // Well, looks like we have to create a new object. + ConsoleObject *object = ConsoleObject::create((const char*)mCallArgv[1]); + + // Deal with failure! + if (!object) + { + Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-conobject class %s.", mCodeBlock->getFileLine(ip), (const char*)mCallArgv[1]); + ip = mFailJump; + return OPCodeReturn::success; + } + + // Do special datablock init if appropros + if (isDataBlock) + { + SimDataBlock *dataBlock = dynamic_cast(object); + if (dataBlock) + { + dataBlock->assignId(); + } + else + { + // They tried to make a non-datablock with a datablock keyword! + Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-datablock class %s.", mCodeBlock->getFileLine(ip), (const char*)mCallArgv[1]); + // Clean up... + delete object; + mCurrentNewObject = NULL; + ip = mFailJump; + return OPCodeReturn::success; + } + } + + // Finally, set currentNewObject to point to the new one. + mCurrentNewObject = dynamic_cast(object); + + // Deal with the case of a non-SimObject. + if (!mCurrentNewObject) + { + Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-SimObject class %s.", mCodeBlock->getFileLine(ip), (const char*)mCallArgv[1]); + delete object; + mCurrentNewObject = NULL; + ip = mFailJump; + return OPCodeReturn::success; + } + + // Set the declaration line + mCurrentNewObject->setDeclarationLine(lineNumber); + + // Set the file that this object was created in + mCurrentNewObject->setFilename(mCodeBlock->name); + + // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) + if (*objParent) + { + // Find it! + SimObject *parent; + if (Sim::findObject(objParent, parent)) + { + // Con::printf(" - Parent object found: %s", parent->getClassName()); + + mCurrentNewObject->setCopySource(parent); + mCurrentNewObject->assignFieldsFrom(parent); + + // copy any substitution statements + SimDataBlock* parent_db = dynamic_cast(parent); + if (parent_db) + { + SimDataBlock* currentNewObject_db = dynamic_cast(mCurrentNewObject); + if (currentNewObject_db) + currentNewObject_db->copySubstitutionsFrom(parent_db); + } + } + else + { + if (Con::gObjectCopyFailures == -1) + Con::errorf(ConsoleLogEntry::General, "%s: Unable to find parent object %s for %s.", mCodeBlock->getFileLine(ip), objParent, (const char*)mCallArgv[1]); + else + ++Con::gObjectCopyFailures; + + // Fail to create the object. + delete object; + mCurrentNewObject = NULL; + ip = mFailJump; + return OPCodeReturn::success; + } + } + + // If a name was passed, assign it. + if (objectName[0]) + { + if (!isInternal) + mCurrentNewObject->assignName(objectName); + else + mCurrentNewObject->setInternalName(objectName); + + // Set the original name + mCurrentNewObject->setOriginalName(objectName); + } + + // Prevent stack value corruption + CSTK.pushFrame(); + STR.pushFrame(); + // -- + + // Do the constructor parameters. + if (!mCurrentNewObject->processArguments(mCallArgc - 3, mCallArgv + 3)) + { + delete mCurrentNewObject; + mCurrentNewObject = NULL; + ip = mFailJump; + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; + } + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + + // If it's not a datablock, allow people to modify bits of it. + if (!isDataBlock) + { + mCurrentNewObject->setModStaticFields(true); + mCurrentNewObject->setModDynamicFields(true); + } + } + else + { + mCurrentNewObject->reloadReset(); // AFX (reload-reset) + // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) + if (*objParent) + { + // Find it! + SimObject *parent; + if (Sim::findObject(objParent, parent)) + { + // Con::printf(" - Parent object found: %s", parent->getClassName()); + + // temporarily block name change + SimObject::preventNameChanging = true; + mCurrentNewObject->setCopySource(parent); + mCurrentNewObject->assignFieldsFrom(parent); + // restore name changing + SimObject::preventNameChanging = false; + + // copy any substitution statements + SimDataBlock* parent_db = dynamic_cast(parent); + if (parent_db) + { + SimDataBlock* currentNewObject_db = dynamic_cast(mCurrentNewObject); + if (currentNewObject_db) + currentNewObject_db->copySubstitutionsFrom(parent_db); + } + } + else + Con::errorf(ConsoleLogEntry::General, "%d: Unable to find parent object %s for %s.", lineNumber, objParent, (const char*)mCallArgv[1]); + } + } + + // Advance the IP past the create info... + ip += 7; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_add_object(U32 &ip) +{ + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + // Do we place this object at the root? + bool placeAtRoot = mCodeBlock->code[ip++]; + + // Con::printf("Adding object %s", currentNewObject->getName()); + + // Prevent stack value corruption + CSTK.pushFrame(); + STR.pushFrame(); + // -- + + // Make sure it wasn't already added, then add it. + if (mCurrentNewObject->isProperlyAdded() == false) + { + bool ret = false; + + Message *msg = dynamic_cast(mCurrentNewObject); + if (msg) + { + SimObjectId id = Message::getNextMessageID(); + if (id != 0xffffffff) + ret = mCurrentNewObject->registerObject(id); + else + Con::errorf("%s: No more object IDs available for messages", mCodeBlock->getFileLine(ip)); + } + else + ret = mCurrentNewObject->registerObject(); + + if (!ret) + { + // This error is usually caused by failing to call Parent::initPersistFields in the class' initPersistFields(). + Con::warnf(ConsoleLogEntry::General, "%s: Register object failed for object %s of class %s.", mCodeBlock->getFileLine(ip), mCurrentNewObject->getName(), mCurrentNewObject->getClassName()); + delete mCurrentNewObject; + mCurrentNewObject = NULL; + ip = mFailJump; + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; + } + } + + // Are we dealing with a datablock? + SimDataBlock *dataBlock = dynamic_cast(mCurrentNewObject); + static String errorStr; + + // If so, preload it. + if (dataBlock && !dataBlock->preload(true, errorStr)) + { + Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", mCodeBlock->getFileLine(ip), + mCurrentNewObject->getName(), errorStr.c_str()); + dataBlock->deleteObject(); + mCurrentNewObject = NULL; + ip = mFailJump; + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; + } + + // What group will we be added to, if any? + U32 groupAddId = intStack[_UINT]; + SimGroup *grp = NULL; + SimSet *set = NULL; + bool isMessage = dynamic_cast(mCurrentNewObject) != NULL; + + if (!placeAtRoot || !mCurrentNewObject->getGroup()) + { + if (!isMessage) + { + if (!placeAtRoot) + { + // Otherwise just add to the requested group or set. + if (!Sim::findObject(groupAddId, grp)) + Sim::findObject(groupAddId, set); + } + + if (placeAtRoot) + { + // Deal with the instantGroup if we're being put at the root or we're adding to a component. + if (Con::gInstantGroup.isEmpty() + || !Sim::findObject(Con::gInstantGroup, grp)) + grp = Sim::getRootGroup(); + } + } + + // If we didn't get a group, then make sure we have a pointer to + // the rootgroup. + if (!grp) + grp = Sim::getRootGroup(); + + // add to the parent group + grp->addObject(mCurrentNewObject); + + // If for some reason the add failed, add the object to the + // root group so it won't leak. + if (!mCurrentNewObject->getGroup()) + Sim::getRootGroup()->addObject(mCurrentNewObject); + + // add to any set we might be in + if (set) + set->addObject(mCurrentNewObject); + } + + // store the new object's ID on the stack (overwriting the group/set + // id, if one was given, otherwise getting pushed) + if (placeAtRoot) + intStack[_UINT] = mCurrentNewObject->getId(); + else + intStack[++_UINT] = mCurrentNewObject->getId(); + + // Prevent stack value corruption + CSTK.popFrame(); + STR.popFrame(); + // -- + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_end_object(U32 &ip) +{ + // If we're not to be placed at the root, make sure we clean up + // our group reference. + bool placeAtRoot = mCodeBlock->code[ip++]; + if (!placeAtRoot) + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_finish_object(U32 &ip) +{ + if (mCurrentNewObject) + mCurrentNewObject->onPostAdd(); + + //Assert( objectCreationStackIndex >= 0 ); + // Restore the object info from the stack [7/9/2007 Black] + mCurrentNewObject = mObjectCreationStack[--mObjectCreationStackIndex].newObject; + mFailJump = mObjectCreationStack[mObjectCreationStackIndex].failJump; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpiffnot(U32 &ip) +{ + if (floatStack[_FLT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + + +OPCodeReturn CodeInterpreter::op_jmpifnot(U32 &ip) +{ + if (intStack[_UINT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpiff(U32 &ip) +{ + if (!floatStack[_FLT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpif(U32 &ip) +{ + if (!intStack[_UINT--]) + { + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpifnot_np(U32 &ip) +{ + if (intStack[_UINT]) + { + _UINT--; + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmpif_np(U32 &ip) +{ + if (!intStack[_UINT]) + { + _UINT--; + ip++; + return OPCodeReturn::success; + } + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_jmp(U32 &ip) +{ + ip = mCodeBlock->code[ip]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_return_void(U32 &ip) +{ + STR.setStringValue(""); + // We're falling thru here on purpose. + + OPCodeReturn ret = op_return(ip); + + return ret; +} + +OPCodeReturn CodeInterpreter::op_return(U32 &ip) +{ + StringStackPtr retValue = STR.getStringValuePtr(); + + if (mIterDepth > 0) + { + // Clear iterator state. + while (mIterDepth > 0) + { + iterStack[--_ITER].mIsStringIter = false; + --mIterDepth; + } + + STR.rewind(); + STR.setStringValue(StringStackPtrRef(retValue).getPtr(&STR)); // Not nice but works. + retValue = STR.getStringValuePtr(); + } + + // Previously the return value was on the stack and would be returned using STR.getStringValue(). + // Now though we need to wrap it in a ConsoleValueRef + mReturnValue.value = CSTK.pushStringStackPtr(retValue); + + return OPCodeReturn::exitCode; +} + +OPCodeReturn CodeInterpreter::op_return_flt(U32 &ip) +{ + if (mIterDepth > 0) + { + // Clear iterator state. + while (mIterDepth > 0) + { + iterStack[--_ITER].mIsStringIter = false; + --mIterDepth; + } + + } + + mReturnValue.value = CSTK.pushFLT(floatStack[_FLT]); + _FLT--; + + return OPCodeReturn::exitCode; +} + +OPCodeReturn CodeInterpreter::op_return_uint(U32 &ip) +{ + if (mIterDepth > 0) + { + // Clear iterator state. + while (mIterDepth > 0) + { + iterStack[--_ITER].mIsStringIter = false; + --mIterDepth; + } + } + + mReturnValue.value = CSTK.pushUINT(intStack[_UINT]); + _UINT--; + + return OPCodeReturn::exitCode; +} + +OPCodeReturn CodeInterpreter::op_cmpeq(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] == floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmpgr(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] > floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmpge(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] >= floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmplt(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] < floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmple(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] <= floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_cmpne(U32 &ip) +{ + intStack[_UINT + 1] = bool(floatStack[_FLT] != floatStack[_FLT - 1]); + _UINT++; + _FLT -= 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_xor(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] ^ intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_mod(U32 &ip) +{ + if (intStack[_UINT - 1] != 0) + intStack[_UINT - 1] = intStack[_UINT] % intStack[_UINT - 1]; + else + intStack[_UINT - 1] = 0; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_bitand(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] & intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_bitor(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] | intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_not(U32 &ip) +{ + intStack[_UINT] = !intStack[_UINT]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_notf(U32 &ip) +{ + intStack[_UINT + 1] = !floatStack[_FLT]; + _FLT--; + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_onescomplement(U32 &ip) +{ + intStack[_UINT] = ~intStack[_UINT]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_shr(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] >> intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_shl(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] << intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_and(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] && intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_or(U32 &ip) +{ + intStack[_UINT - 1] = intStack[_UINT] || intStack[_UINT - 1]; + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_add(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] + floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_sub(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] - floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_mul(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] * floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_div(U32 &ip) +{ + floatStack[_FLT - 1] = floatStack[_FLT] / floatStack[_FLT - 1]; + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_neg(U32 &ip) +{ + floatStack[_FLT] = -floatStack[_FLT]; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_inc(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + F64 val = gEvalState.getFloatVariable() + 1.0; + gEvalState.setFloatVariable(val); + + // We gotta push val onto the stack. What if we have + // more expressions that have to use this. + // If we don't, we send out an op code to pop it. + floatStack[_FLT + 1] = val; + _FLT++; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_dec(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + F64 val = gEvalState.getFloatVariable() - 1.0; + gEvalState.setFloatVariable(val); + + // We gotta push val onto the stack. What if we have + // more expressions that have to use this. + // If we don't, we send out an op code to pop it. + floatStack[_FLT + 1] = val; + _FLT++; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarName(var); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_create(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array(U32 &ip) +{ + StringTableEntry var = STR.getSTValue(); + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarName(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array_varlookup(U32 &ip) +{ + StringTableEntry arrayName = CodeToSTE(mCodeBlock->code, ip); + StringTableEntry arrayLookup = CodeToSTE(mCodeBlock->code, ip + 2); + ip += 4; + + STR.setStringValue(arrayName); + STR.advance(); + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + // resolve arrayLookup to get the 'value' + // Note: we have to setCurVarNameCreate in case the var doesn't exist. + // this won't cause much of a performance hit since vars are hashed. + gEvalState.setCurVarNameCreate(arrayLookup); + StringTableEntry hash = gEvalState.getStringVariable(); + + STR.setStringValue(hash); + STR.rewind(); + + // Generate new array name. + StringTableEntry var = STR.getSTValue(); + gEvalState.setCurVarName(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array_create(U32 &ip) +{ + StringTableEntry var = STR.getSTValue(); + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarNameCreate(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurvar_array_create_varlookup(U32 &ip) +{ + StringTableEntry arrayName = CodeToSTE(mCodeBlock->code, ip); + StringTableEntry arrayLookup = CodeToSTE(mCodeBlock->code, ip + 2); + ip += 4; + + // See OP_SETCURVAR + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + STR.setStringValue(arrayName); + STR.advance(); + + // resolve arrayLookup to get the 'value' + // Note: we have to setCurVarNameCreate in case the var doesn't exist. + // this won't cause much of a performance hit since vars are hashed. + gEvalState.setCurVarNameCreate(arrayLookup); + StringTableEntry hash = gEvalState.getStringVariable(); + + STR.setStringValue(hash); + STR.rewind(); + + // Generate new array name. + StringTableEntry var = STR.getSTValue(); + gEvalState.setCurVarNameCreate(var); + + // See OP_SETCURVAR for why we do this. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_uint(U32 &ip) +{ + intStack[_UINT + 1] = gEvalState.getIntVariable(); + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_flt(U32 &ip) +{ + floatStack[_FLT + 1] = gEvalState.getFloatVariable(); + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_str(U32 &ip) +{ + StringTableEntry val = gEvalState.getStringVariable(); + STR.setStringValue(val); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadvar_var(U32 &ip) +{ + // Sets current source of OP_SAVEVAR_VAR + gEvalState.copyVariable = gEvalState.currentVariable; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_uint(U32 &ip) +{ + gEvalState.setIntVariable(intStack[_UINT]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_flt(U32 &ip) +{ + gEvalState.setFloatVariable(floatStack[_FLT]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_str(U32 &ip) +{ + gEvalState.setStringVariable(STR.getStringValue()); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savevar_var(U32 &ip) +{ + // this basically handles %var1 = %var2 + gEvalState.setCopyVariable(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurobject(U32 &ip) +{ + // Save the previous object for parsing vector fields. + mPrevObject = mCurObject; + StringTableEntry val = STR.getStringValue(); + + // Sim::findObject will sometimes find valid objects from + // multi-component strings. This makes sure that doesn't + // happen. + for (const char* check = val; *check; check++) + { + if (*check == ' ') + { + val = ""; + break; + } + } + mCurObject = Sim::findObject(val); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurobject_internal(U32 &ip) +{ + ++ip; // To skip the recurse flag if the object wasn't found + if (mCurObject) + { + SimSet *set = dynamic_cast(mCurObject); + if (set) + { + StringTableEntry intName = StringTable->insert(STR.getStringValue()); + bool recurse = mCodeBlock->code[ip - 1]; + SimObject *obj = set->findObjectByInternalName(intName, recurse); + intStack[_UINT + 1] = obj ? obj->getId() : 0; + _UINT++; + } + else + { + Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-set %s of class %s.", mCodeBlock->getFileLine(ip - 2), mCurObject->getName(), mCurObject->getClassName()); + intStack[_UINT] = 0; + } + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurobject_new(U32 &ip) +{ + mCurObject = mCurrentNewObject; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield(U32 &ip) +{ + // Save the previous field for parsing vector fields. + mPrevField = mCurField; + dStrcpy(prevFieldArray, curFieldArray); + mCurField = CodeToSTE(mCodeBlock->code, ip); + curFieldArray[0] = 0; + ip += 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_array(U32 &ip) +{ + dStrcpy(curFieldArray, STR.getStringValue()); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_type(U32 &ip) +{ + if (mCurObject) + mCurObject->setDataFieldType(mCodeBlock->code[ip], mCurField, curFieldArray); + ip++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_array_var(U32 &ip) +{ + StringTableEntry var = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // We set the current var name (create it as well in case if it doesn't exist, + // otherwise we will crash). + gEvalState.setCurVarNameCreate(var); + + // Then load the var and copy the contents to the current field array + dStrncpy(curFieldArray, gEvalState.currentVariable->getStringValue(), sizeof(curFieldArray)); + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_setcurfield_this(U32 &ip) +{ + // set the 'this pointer' as the current object. + mCurObject = mThisObject; + + mPrevField = mCurField; + dStrcpy(prevFieldArray, curFieldArray); + mCurField = CodeToSTE(mCodeBlock->code, ip); + curFieldArray[0] = 0; + ip += 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadfield_uint(U32 &ip) +{ + if (mCurObject) + intStack[_UINT + 1] = U32(dAtoi(mCurObject->getDataField(mCurField, curFieldArray))); + else + { + // The field is not being retrieved from an object. Maybe it's + // a special accessor? + char buff[FieldBufferSizeNumeric]; + memset(buff, 0, sizeof(buff)); + getFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField, buff); + intStack[_UINT + 1] = dAtoi(buff); + } + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadfield_flt(U32 &ip) +{ + if (mCurObject) + floatStack[_FLT + 1] = dAtof(mCurObject->getDataField(mCurField, curFieldArray)); + else + { + // The field is not being retrieved from an object. Maybe it's + // a special accessor? + char buff[FieldBufferSizeNumeric]; + memset(buff, 0, sizeof(buff)); + getFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField, buff); + floatStack[_FLT + 1] = dAtof(buff); + } + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadfield_str(U32 &ip) +{ + if (mCurObject) + { + StringTableEntry val = mCurObject->getDataField(mCurField, curFieldArray); + STR.setStringValue(val); + } + else + { + // The field is not being retrieved from an object. Maybe it's + // a special accessor? + char buff[FieldBufferSizeString]; + memset(buff, 0, sizeof(buff)); + getFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField, buff); + STR.setStringValue(buff); + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savefield_uint(U32 &ip) +{ + STR.setIntValue(intStack[_UINT]); + if (mCurObject) + mCurObject->setDataField(mCurField, curFieldArray, STR.getStringValue()); + else + { + // The field is not being set on an object. Maybe it's + // a special accessor? + setFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField); + mPrevObject = NULL; + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savefield_flt(U32 &ip) +{ + STR.setFloatValue(floatStack[_FLT]); + if (mCurObject) + mCurObject->setDataField(mCurField, curFieldArray, STR.getStringValue()); + else + { + // The field is not being set on an object. Maybe it's + // a special accessor? + setFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField); + mPrevObject = NULL; + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_savefield_str(U32 &ip) +{ + if (mCurObject) + mCurObject->setDataField(mCurField, curFieldArray, STR.getStringValue()); + else + { + // The field is not being set on an object. Maybe it's + // a special accessor? + setFieldComponent(mPrevObject, mPrevField, prevFieldArray, mCurField); + mPrevObject = NULL; + } + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_str_to_uint(U32 &ip) +{ + intStack[_UINT + 1] = STR.getIntValue(); + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_str_to_flt(U32 &ip) +{ + floatStack[_FLT + 1] = STR.getFloatValue(); + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_str_to_none(U32 &ip) +{ + // This exists simply to deal with certain typecast situations. + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_flt_to_uint(U32 &ip) +{ + intStack[_UINT + 1] = (S64)floatStack[_FLT]; + _FLT--; + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_flt_to_str(U32 &ip) +{ + STR.setFloatValue(floatStack[_FLT]); + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_flt_to_none(U32 &ip) +{ + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_uint_to_flt(U32 &ip) +{ + floatStack[_FLT + 1] = (F32)intStack[_UINT]; + _UINT--; + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_uint_to_str(U32 &ip) +{ + STR.setIntValue(intStack[_UINT]); + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_uint_to_none(U32 &ip) +{ + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_copyvar_to_none(U32 &ip) +{ + gEvalState.copyVariable = NULL; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_uint(U32 &ip) +{ + intStack[_UINT + 1] = mCodeBlock->code[ip++]; + _UINT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_flt(U32 &ip) +{ + floatStack[_FLT + 1] = mCurFloatTable[mCodeBlock->code[ip]]; + ip++; + _FLT++; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_tag_to_str(U32 &ip) +{ + mCodeBlock->code[ip - 1] = OP_LOADIMMED_STR; + // it's possible the string has already been converted + if (U8(mCurStringTable[mCodeBlock->code[ip]]) != StringTagPrefixByte) + { + U32 id = GameAddTaggedString(mCurStringTable + mCodeBlock->code[ip]); + dSprintf(mCurStringTable + mCodeBlock->code[ip] + 1, 7, "%d", id); + *(mCurStringTable + mCodeBlock->code[ip]) = StringTagPrefixByte; + } + + // Fallthrough + OPCodeReturn ret = op_loadimmed_str(ip); + + return ret; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_str(U32 &ip) +{ + STR.setStringValue(mCurStringTable + mCodeBlock->code[ip++]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_docblock_str(U32 &ip) +{ + // If the first word of the doc is '\class' or '@class', then this + // is a namespace doc block, otherwise it is a function doc block. + const char* docblock = mCurStringTable + mCodeBlock->code[ip++]; + + const char* sansClass = dStrstr(docblock, "@class"); + if (!sansClass) + sansClass = dStrstr(docblock, "\\class"); + + if (sansClass) + { + // Don't save the class declaration. Scan past the 'class' + // keyword and up to the first whitespace. + sansClass += 7; + S32 index = 0; + while ((*sansClass != ' ') && (*sansClass != '\n') && *sansClass && (index < (nsDocLength - 1))) + { + mNSDocBlockClass[index++] = *sansClass; + sansClass++; + } + mNSDocBlockClass[index] = '\0'; + + mCurNSDocBlock = sansClass + 1; + } + else + mCurFNDocBlock = docblock; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_loadimmed_ident(U32 &ip) +{ + STR.setStringValue(CodeToSTE(mCodeBlock->code, ip)); + ip += 2; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_callfunc_resolve(U32 &ip) +{ + // This deals with a function that is potentially living in a namespace. + StringTableEntry fnNamespace = CodeToSTE(mCodeBlock->code, ip + 2); + StringTableEntry fnName = CodeToSTE(mCodeBlock->code, ip); + + // Try to look it up. + mNSEntry = Namespace::find(fnNamespace)->lookup(fnName); + if (!mNSEntry) + { + ip += 5; + Con::warnf(ConsoleLogEntry::General, + "%s: Unable to find function %s%s%s", + mCodeBlock->getFileLine(ip - 7), fnNamespace ? fnNamespace : "", + fnNamespace ? "::" : "", fnName); + STR.popFrame(); + CSTK.popFrame(); + return OPCodeReturn::success; + } + + // Fallthrough to op_callfunc_resolve + OPCodeReturn ret = op_callfunc(ip); + + return ret; +} + +OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) +{ + // This routingId is set when we query the object as to whether + // it handles this method. It is set to an enum from the table + // above indicating whether it handles it on a component it owns + // or just on the object. + S32 routingId = 0; + + U32 *code = mCodeBlock->code; + + StringTableEntry fnName = CodeToSTE(code, ip); + + //if this is called from inside a function, append the ip and codeptr + if (gEvalState.getStackDepth() > 0) + { + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + } + + U32 callType = code[ip + 4]; + + ip += 5; + CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); + + const char *componentReturnValue = ""; + Namespace *ns = NULL; + + if (callType == FuncCallExprNode::FunctionCall) + { + if (!mNSEntry) + mNSEntry = Namespace::global()->lookup(fnName); + } + else if (callType == FuncCallExprNode::MethodCall) + { + mSaveObject = gEvalState.thisObject; + gEvalState.thisObject = Sim::findObject((const char*)mCallArgv[1]); + if (!gEvalState.thisObject) + { + // Go back to the previous saved object. + gEvalState.thisObject = mSaveObject; + + Con::warnf(ConsoleLogEntry::General, "%s: Unable to find object: '%s' attempting to call function '%s'", mCodeBlock->getFileLine(ip - 4), (const char*)mCallArgv[1], fnName); + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + return OPCodeReturn::success; + } + + bool handlesMethod = gEvalState.thisObject->handlesConsoleMethod(fnName, &routingId); + if (handlesMethod && routingId == MethodOnComponent) + { + ICallMethod *pComponent = dynamic_cast(gEvalState.thisObject); + if (pComponent) + componentReturnValue = pComponent->callMethodArgList(mCallArgc, mCallArgv, false); + } + + ns = gEvalState.thisObject->getNamespace(); + if (ns) + mNSEntry = ns->lookup(fnName); + else + mNSEntry = NULL; + } + else // it's a ParentCall + { + if (mExec.thisNamespace) + { + ns = mExec.thisNamespace->mParent; + if (ns) + mNSEntry = ns->lookup(fnName); + else + mNSEntry = NULL; + } + else + { + ns = NULL; + mNSEntry = NULL; + } + } + + Namespace::Entry::CallbackUnion * nsCb = NULL; + const char * nsUsage = NULL; + if (mNSEntry) + { + nsCb = &mNSEntry->cb; + nsUsage = mNSEntry->mUsage; + routingId = 0; + } + if (!mNSEntry || mExec.noCalls) + { + if (!mExec.noCalls && !(routingId == MethodOnComponent)) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + if (callType == FuncCallExprNode::MethodCall) + { + Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", + gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", + gEvalState.thisObject->getId(), Con::getNamespaceList(ns)); + } + } + STR.popFrame(); + CSTK.popFrame(); + + if (routingId == MethodOnComponent) + STR.setStringValue(componentReturnValue); + else + STR.setStringValue(""); + return OPCodeReturn::success; + } + + // ConsoleFunctionType is for any function defined by script. + // Any 'callback' type is an engine function that is exposed to script. + if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType) + { + ConsoleValueRef ret; + if (mNSEntry->mFunctionOffset) + ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage); + + STR.popFrame(); + // Functions are assumed to return strings, so look ahead to see if we can skip the conversion + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (U32)((S32)ret); + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = (F32)ret; + } + else if (code[ip] == OP_STR_TO_NONE) + { + STR.setStringValue(ret.getStringValue()); + ip++; + } + else + STR.setStringValue((const char*)ret); + + // This will clear everything including returnValue + CSTK.popFrame(); + //STR.clearFunctionOffset(); + } + else + { + const char* nsName = ns ? ns->mName : ""; +#ifndef TORQUE_DEBUG + // [tom, 12/13/2006] This stops tools functions from working in the console, + // which is useful behavior when debugging so I'm ifdefing this out for debug builds. + if (mNSEntry->mToolOnly && !Con::isCurrentScriptToolScript()) + { + Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", mCodeBlock->getFileLine(ip - 6), nsName, fnName); + } + else +#endif + if ((mNSEntry->mMinArgs && S32(mCallArgc) < mNSEntry->mMinArgs) || (mNSEntry->mMaxArgs && S32(mCallArgc) > mNSEntry->mMaxArgs)) + { + Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", + mCodeBlock->getFileLine(ip - 6), nsName, fnName, + mCallArgc, mNSEntry->mMinArgs, mNSEntry->mMaxArgs); + Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", mCodeBlock->getFileLine(ip - 6), mNSEntry->mUsage); + STR.popFrame(); + CSTK.popFrame(); + } + else + { + switch (mNSEntry->mType) + { + case Namespace::Entry::StringCallbackType: + { + const char *ret = mNSEntry->cb.mStringCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (ret != STR.getStringValue()) + STR.setStringValue(ret); + //else + // sSTR.setLen(dStrlen(ret)); + break; + } + case Namespace::Entry::IntCallbackType: + { + S32 result = mNSEntry->cb.mIntCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + case Namespace::Entry::FloatCallbackType: + { + F64 result = mNSEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (S64)result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setFloatValue(result); + break; + } + case Namespace::Entry::VoidCallbackType: + mNSEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + if (code[ip] != OP_STR_TO_NONE && Con::getBoolVariable("$Con::warnVoidAssignment", true)) + Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", mCodeBlock->getFileLine(ip - 6), fnName, mExec.functionName); + + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + break; + case Namespace::Entry::BoolCallbackType: + { + bool result = mNSEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + } + } + } + + if (callType == FuncCallExprNode::MethodCall) + gEvalState.thisObject = mSaveObject; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip) +{ + // get function name. This is the 'function pointer'. + StringTableEntry fnName = StringTable->insert(STR.getStringValue()); + + U32 *code = mCodeBlock->code; + + mNSEntry = Namespace::global()->lookup(fnName); + + //if this is called from inside a function, append the ip and codeptr + if (gEvalState.getStackDepth() > 0) + { + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + } + + CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); + + + if (!mNSEntry || mExec.noCalls) + { + if (!mExec.noCalls) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + } + STR.popFrame(); + CSTK.popFrame(); + + STR.setStringValue(""); + return OPCodeReturn::success; + } + + // ConsoleFunctionType is for any function defined by script. + // Any 'callback' type is an engine function that is exposed to script. + if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType) + { + ConsoleValueRef ret; + if (mNSEntry->mFunctionOffset) + ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage); + + STR.popFrame(); + // Functions are assumed to return strings, so look ahead to see if we can skip the conversion + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (U32)((S32)ret); + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = (F32)ret; + } + else if (code[ip] == OP_STR_TO_NONE) + { + STR.setStringValue(ret.getStringValue()); + ip++; + } + else + STR.setStringValue((const char*)ret); + + // This will clear everything including returnValue + CSTK.popFrame(); + //STR.clearFunctionOffset(); + } + else + { + const char* nsName = ""; + + Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; + const char * nsUsage = mNSEntry->mUsage; + +#ifndef TORQUE_DEBUG + // [tom, 12/13/2006] This stops tools functions from working in the console, + // which is useful behavior when debugging so I'm ifdefing this out for debug builds. + if (mNSEntry->mToolOnly && !Con::isCurrentScriptToolScript()) + { + Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", mCodeBlock->getFileLine(ip - 6), nsName, fnName); + } + else +#endif + if ((mNSEntry->mMinArgs && S32(mCallArgc) < mNSEntry->mMinArgs) || (mNSEntry->mMaxArgs && S32(mCallArgc) > mNSEntry->mMaxArgs)) + { + Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", + mCodeBlock->getFileLine(ip - 6), nsName, fnName, + mCallArgc, mNSEntry->mMinArgs, mNSEntry->mMaxArgs); + Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", mCodeBlock->getFileLine(ip - 6), mNSEntry->mUsage); + STR.popFrame(); + CSTK.popFrame(); + } + else + { + switch (mNSEntry->mType) + { + case Namespace::Entry::StringCallbackType: + { + const char *ret = mNSEntry->cb.mStringCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (ret != STR.getStringValue()) + STR.setStringValue(ret); + //else + // sSTR.setLen(dStrlen(ret)); + break; + } + case Namespace::Entry::IntCallbackType: + { + S32 result = mNSEntry->cb.mIntCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + case Namespace::Entry::FloatCallbackType: + { + F64 result = mNSEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (S64)result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setFloatValue(result); + break; + } + case Namespace::Entry::VoidCallbackType: + mNSEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + if (code[ip] != OP_STR_TO_NONE && Con::getBoolVariable("$Con::warnVoidAssignment", true)) + Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", mCodeBlock->getFileLine(ip - 6), fnName, mExec.functionName); + + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + break; + case Namespace::Entry::BoolCallbackType: + { + bool result = mNSEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + } + } + } + + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) +{ + U32 *code = mCodeBlock->code; + + StringTableEntry fnName = CodeToSTE(code, ip); + + //if this is called from inside a function, append the ip and codeptr + if (gEvalState.getStackDepth() > 0) + { + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + } + + ip += 2; + CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); + + Namespace *ns = mThisObject->getNamespace(); + if (ns) + mNSEntry = ns->lookup(fnName); + else + mNSEntry = NULL; + + if (!mNSEntry || mExec.noCalls) + { + if (!mExec.noCalls) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", + mThisObject->getName() ? mThisObject->getName() : "", + mThisObject->getId(), Con::getNamespaceList(ns)); + } + STR.popFrame(); + CSTK.popFrame(); + + STR.setStringValue(""); + return OPCodeReturn::success; + } + + // ConsoleFunctionType is for any function defined by script. + // Any 'callback' type is an engine function that is exposed to script. + if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType) + { + ConsoleValueRef ret; + if (mNSEntry->mFunctionOffset) + ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage); + + STR.popFrame(); + // Functions are assumed to return strings, so look ahead to see if we can skip the conversion + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (U32)((S32)ret); + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = (F32)ret; + } + else if (code[ip] == OP_STR_TO_NONE) + { + STR.setStringValue(ret.getStringValue()); + ip++; + } + else + STR.setStringValue((const char*)ret); + + // This will clear everything including returnValue + CSTK.popFrame(); + //STR.clearFunctionOffset(); + } + else + { + Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; + const char * nsUsage = mNSEntry->mUsage; + const char* nsName = ns ? ns->mName : ""; +#ifndef TORQUE_DEBUG + // [tom, 12/13/2006] This stops tools functions from working in the console, + // which is useful behavior when debugging so I'm ifdefing this out for debug builds. + if (mNSEntry->mToolOnly && !Con::isCurrentScriptToolScript()) + { + Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", mCodeBlock->getFileLine(ip - 6), nsName, fnName); + } + else +#endif + if ((mNSEntry->mMinArgs && S32(mCallArgc) < mNSEntry->mMinArgs) || (mNSEntry->mMaxArgs && S32(mCallArgc) > mNSEntry->mMaxArgs)) + { + Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", + mCodeBlock->getFileLine(ip - 6), nsName, fnName, + mCallArgc, mNSEntry->mMinArgs, mNSEntry->mMaxArgs); + Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", mCodeBlock->getFileLine(ip - 6), mNSEntry->mUsage); + STR.popFrame(); + CSTK.popFrame(); + } + else + { + switch (mNSEntry->mType) + { + case Namespace::Entry::StringCallbackType: + { + const char *ret = mNSEntry->cb.mStringCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (ret != STR.getStringValue()) + STR.setStringValue(ret); + //else + // sSTR.setLen(dStrlen(ret)); + break; + } + case Namespace::Entry::IntCallbackType: + { + S32 result = mNSEntry->cb.mIntCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + case Namespace::Entry::FloatCallbackType: + { + F64 result = mNSEntry->cb.mFloatCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = (S64)result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setFloatValue(result); + break; + } + case Namespace::Entry::VoidCallbackType: + mNSEntry->cb.mVoidCallbackFunc(mThisObject, mCallArgc, mCallArgv); + if (code[ip] != OP_STR_TO_NONE && Con::getBoolVariable("$Con::warnVoidAssignment", true)) + Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", mCodeBlock->getFileLine(ip - 6), fnName, mExec.functionName); + + STR.popFrame(); + CSTK.popFrame(); + STR.setStringValue(""); + break; + case Namespace::Entry::BoolCallbackType: + { + bool result = mNSEntry->cb.mBoolCallbackFunc(mThisObject, mCallArgc, mCallArgv); + STR.popFrame(); + CSTK.popFrame(); + if (code[ip] == OP_STR_TO_UINT) + { + ip++; + intStack[++_UINT] = result; + break; + } + else if (code[ip] == OP_STR_TO_FLT) + { + ip++; + floatStack[++_FLT] = result; + break; + } + else if (code[ip] == OP_STR_TO_NONE) + ip++; + else + STR.setIntValue(result); + break; + } + } + } + } + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str(U32 &ip) +{ + STR.advance(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str_appendchar(U32 &ip) +{ + STR.advanceChar(mCodeBlock->code[ip++]); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str_comma(U32 &ip) +{ + STR.advanceChar('_'); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_advance_str_nul(U32 &ip) +{ + STR.advanceChar(0); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_rewind_str(U32 &ip) +{ + STR.rewind(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_terminate_rewind_str(U32 &ip) +{ + STR.rewindTerminate(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_compare_str(U32 &ip) +{ + intStack[++_UINT] = STR.compare(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push(U32 &ip) +{ + STR.push(); + CSTK.pushStringStackPtr(STR.getPreviousStringValuePtr()); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_uint(U32 &ip) +{ + CSTK.pushUINT(intStack[_UINT]); + _UINT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_flt(U32 &ip) +{ + CSTK.pushFLT(floatStack[_FLT]); + _FLT--; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_var(U32 &ip) +{ + if (gEvalState.currentVariable) + CSTK.pushValue(gEvalState.currentVariable->value); + else + CSTK.pushString(""); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_this(U32 &ip) +{ + StringTableEntry varName = CodeToSTE(mCodeBlock->code, ip); + ip += 2; + + // shorthand OP_SETCURVAR + + // If a variable is set, then these must be NULL. It is necessary + // to set this here so that the vector parser can appropriately + // identify whether it's dealing with a vector. + mPrevField = NULL; + mPrevObject = NULL; + mCurObject = NULL; + + gEvalState.setCurVarName(varName); + + // In order to let docblocks work properly with variables, we have + // clear the current docblock when we do an assign. This way it + // won't inappropriately carry forward to following function decls. + mCurFNDocBlock = NULL; + mCurNSDocBlock = NULL; + + // shorthand OP_LOADVAR_STR (since objs can be by name we can't assume uint) + STR.setStringValue(gEvalState.getStringVariable()); + + // shorthand OP_PUSH + STR.push(); + CSTK.pushStringStackPtr(STR.getPreviousStringValuePtr()); + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_push_frame(U32 &ip) +{ + STR.pushFrame(); + CSTK.pushFrame(); + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_assert(U32 &ip) +{ + if (!intStack[_UINT--]) + { + const char *message = mCurStringTable + mCodeBlock->code[ip]; + + U32 breakLine, inst; + mCodeBlock->findBreakLine(ip - 1, breakLine, inst); + + if (PlatformAssert::processAssert(PlatformAssert::Fatal, + mCodeBlock->name ? mCodeBlock->name : "eval", + breakLine, + message)) + { + if (TelDebugger && TelDebugger->isConnected() && breakLine > 0) + { + TelDebugger->breakProcess(); + } + else + Platform::debugBreak(); + } + } + + ip++; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_break(U32 &ip) +{ + //append the ip and codeptr before managing the breakpoint! + AssertFatal(gEvalState.getStackDepth() > 0, "Empty eval stack on break!"); + gEvalState.getCurrentFrame().code = mCodeBlock; + gEvalState.getCurrentFrame().ip = ip - 1; + + U32 breakLine; + mCodeBlock->findBreakLine(ip - 1, breakLine, mCurrentInstruction); + if (!breakLine) + return OPCodeReturn::breakContinue; + TelDebugger->executionStopped(mCodeBlock, breakLine); + return OPCodeReturn::breakContinue; +} + +OPCodeReturn CodeInterpreter::op_iter_begin_str(U32 &ip) +{ + iterStack[_ITER].mIsStringIter = true; + + // Emulate fallthrough: + OPCodeReturn fallthrough = op_iter_begin(ip); + + return fallthrough; +} + +OPCodeReturn CodeInterpreter::op_iter_begin(U32 &ip) +{ + StringTableEntry varName = CodeToSTE(mCodeBlock->code, ip); + U32 failIp = mCodeBlock->code[ip + 2]; + + IterStackRecord& iter = iterStack[_ITER]; + + iter.mVariable = gEvalState.getCurrentFrame().add(varName); + + if (iter.mIsStringIter) + { + iter.mData.mStr.mString = STR.getStringValuePtr(); + iter.mData.mStr.mIndex = 0; + } + else + { + // Look up the object. + + SimSet* set; + if (!Sim::findObject(STR.getStringValue(), set)) + { + Con::errorf(ConsoleLogEntry::General, "No SimSet object '%s'", STR.getStringValue()); + Con::errorf(ConsoleLogEntry::General, "Did you mean to use 'foreach$' instead of 'foreach'?"); + ip = failIp; + return OPCodeReturn::success; + } + + // Set up. + + iter.mData.mObj.mSet = set; + iter.mData.mObj.mIndex = 0; + } + + _ITER++; + mIterDepth++; + + STR.push(); + + ip += 3; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_iter(U32 &ip) +{ + U32 breakIp = mCodeBlock->code[ip]; + IterStackRecord& iter = iterStack[_ITER - 1]; + + if (iter.mIsStringIter) + { + const char* str = StringStackPtrRef(iter.mData.mStr.mString).getPtr(&STR); + + U32 startIndex = iter.mData.mStr.mIndex; + U32 endIndex = startIndex; + + // Break if at end. + + if (!str[startIndex]) + { + ip = breakIp; + return OPCodeReturn::success; // continue in old interpreter + } + + // Find right end of current component. + + if (!dIsspace(str[endIndex])) + do ++endIndex; + while (str[endIndex] && !dIsspace(str[endIndex])); + + // Extract component. + + if (endIndex != startIndex) + { + char savedChar = str[endIndex]; + const_cast< char* >(str)[endIndex] = '\0'; // We are on the string stack so this is okay. + iter.mVariable->setStringValue(&str[startIndex]); + const_cast< char* >(str)[endIndex] = savedChar; + } + else + iter.mVariable->setStringValue(""); + + // Skip separator. + if (str[endIndex] != '\0') + ++endIndex; + + iter.mData.mStr.mIndex = endIndex; + } + else + { + U32 index = iter.mData.mObj.mIndex; + SimSet* set = iter.mData.mObj.mSet; + + if (index >= set->size()) + { + ip = breakIp; + return OPCodeReturn::success; // continue in old interpreter + } + + iter.mVariable->setIntValue(set->at(index)->getId()); + iter.mData.mObj.mIndex = index + 1; + } + + ++ip; + + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_iter_end(U32 &ip) +{ + --_ITER; + --mIterDepth; + STR.rewind(); + iterStack[_ITER].mIsStringIter = false; + return OPCodeReturn::success; +} + +OPCodeReturn CodeInterpreter::op_invalid(U32 &ip) +{ + // Invalid does nothing. + return OPCodeReturn::exitCode; +} diff --git a/Engine/source/console/codeInterpreter.h b/Engine/source/console/codeInterpreter.h new file mode 100644 index 000000000..133222726 --- /dev/null +++ b/Engine/source/console/codeInterpreter.h @@ -0,0 +1,262 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _CODEINTERPRETER_H_ +#define _CODEINTERPRETER_H_ + +#include "console/codeBlock.h" +#include "console/console.h" +#include "console/consoleInternal.h" + +/// Frame data for a foreach/foreach$ loop. +struct IterStackRecord +{ + /// If true, this is a foreach$ loop; if not, it's a foreach loop. + bool mIsStringIter; + + /// The iterator variable. + Dictionary::Entry* mVariable; + + /// Information for an object iterator loop. + struct ObjectPos + { + /// The set being iterated over. + SimSet* mSet; + + /// Current index in the set. + U32 mIndex; + }; + + /// Information for a string iterator loop. + struct StringPos + { + /// The raw string data on the string stack. + StringStackPtr mString; + + /// Current parsing position. + U32 mIndex; + }; + + union + { + ObjectPos mObj; + StringPos mStr; + } mData; +}; + +enum OPCodeReturn +{ + exitCode = -1, + success = 0, + breakContinue = 1 +}; + +class CodeInterpreter +{ +public: + CodeInterpreter(CodeBlock *cb); + ~CodeInterpreter(); + + ConsoleValueRef exec(U32 ip, + StringTableEntry functionName, + Namespace *thisNamespace, + U32 argc, + ConsoleValueRef *argv, + bool noCalls, + StringTableEntry packageName, + S32 setFrame); + + static void init(); + + // Methods +private: + void parseArgs(U32 &ip); + + /// Group op codes + /// @{ + + OPCodeReturn op_func_decl(U32 &ip); + OPCodeReturn op_create_object(U32 &ip); + OPCodeReturn op_add_object(U32 &ip); + OPCodeReturn op_end_object(U32 &ip); + OPCodeReturn op_finish_object(U32 &ip); + OPCodeReturn op_jmpiffnot(U32 &ip); + OPCodeReturn op_jmpifnot(U32 &ip); + OPCodeReturn op_jmpiff(U32 &ip); + OPCodeReturn op_jmpif(U32 &ip); + OPCodeReturn op_jmpifnot_np(U32 &ip); + OPCodeReturn op_jmpif_np(U32 &ip); + OPCodeReturn op_jmp(U32 &ip); + OPCodeReturn op_return_void(U32 &ip); + OPCodeReturn op_return(U32 &ip); + OPCodeReturn op_return_flt(U32 &ip); + OPCodeReturn op_return_uint(U32 &ip); + OPCodeReturn op_cmpeq(U32 &ip); + OPCodeReturn op_cmpgr(U32 &ip); + OPCodeReturn op_cmpge(U32 &ip); + OPCodeReturn op_cmplt(U32 &ip); + OPCodeReturn op_cmple(U32 &ip); + OPCodeReturn op_cmpne(U32 &ip); + OPCodeReturn op_xor(U32 &ip); + OPCodeReturn op_mod(U32 &ip); + OPCodeReturn op_bitand(U32 &ip); + OPCodeReturn op_bitor(U32 &ip); + OPCodeReturn op_not(U32 &ip); + OPCodeReturn op_notf(U32 &ip); + OPCodeReturn op_onescomplement(U32 &ip); + OPCodeReturn op_shr(U32 &ip); + OPCodeReturn op_shl(U32 &ip); + OPCodeReturn op_and(U32 &ip); + OPCodeReturn op_or(U32 &ip); + OPCodeReturn op_add(U32 &ip); + OPCodeReturn op_sub(U32 &ip); + OPCodeReturn op_mul(U32 &ip); + OPCodeReturn op_div(U32 &ip); + OPCodeReturn op_neg(U32 &ip); + OPCodeReturn op_inc(U32 &ip); + OPCodeReturn op_dec(U32 &ip); + OPCodeReturn op_setcurvar(U32 &ip); + OPCodeReturn op_setcurvar_create(U32 &ip); + OPCodeReturn op_setcurvar_array(U32 &ip); + OPCodeReturn op_setcurvar_array_varlookup(U32 &ip); + OPCodeReturn op_setcurvar_array_create(U32 &ip); + OPCodeReturn op_setcurvar_array_create_varlookup(U32 &ip); + OPCodeReturn op_loadvar_uint(U32 &ip); + OPCodeReturn op_loadvar_flt(U32 &ip); + OPCodeReturn op_loadvar_str(U32 &ip); + OPCodeReturn op_loadvar_var(U32 &ip); + OPCodeReturn op_savevar_uint(U32 &ip); + OPCodeReturn op_savevar_flt(U32 &ip); + OPCodeReturn op_savevar_str(U32 &ip); + OPCodeReturn op_savevar_var(U32 &ip); + OPCodeReturn op_setcurobject(U32 &ip); + OPCodeReturn op_setcurobject_internal(U32 &ip); + OPCodeReturn op_setcurobject_new(U32 &ip); + OPCodeReturn op_setcurfield(U32 &ip); + OPCodeReturn op_setcurfield_array(U32 &ip); + OPCodeReturn op_setcurfield_type(U32 &ip); + OPCodeReturn op_setcurfield_this(U32 &ip); + OPCodeReturn op_setcurfield_array_var(U32 &ip); + OPCodeReturn op_loadfield_uint(U32 &ip); + OPCodeReturn op_loadfield_flt(U32 &ip); + OPCodeReturn op_loadfield_str(U32 &ip); + OPCodeReturn op_savefield_uint(U32 &ip); + OPCodeReturn op_savefield_flt(U32 &ip); + OPCodeReturn op_savefield_str(U32 &ip); + OPCodeReturn op_str_to_uint(U32 &ip); + OPCodeReturn op_str_to_flt(U32 &ip); + OPCodeReturn op_str_to_none(U32 &ip); + OPCodeReturn op_flt_to_uint(U32 &ip); + OPCodeReturn op_flt_to_str(U32 &ip); + OPCodeReturn op_flt_to_none(U32 &ip); + OPCodeReturn op_uint_to_flt(U32 &ip); + OPCodeReturn op_uint_to_str(U32 &ip); + OPCodeReturn op_uint_to_none(U32 &ip); + OPCodeReturn op_copyvar_to_none(U32 &ip); + OPCodeReturn op_loadimmed_uint(U32 &ip); + OPCodeReturn op_loadimmed_flt(U32 &ip); + OPCodeReturn op_tag_to_str(U32 &ip); + OPCodeReturn op_loadimmed_str(U32 &ip); + OPCodeReturn op_docblock_str(U32 &ip); + OPCodeReturn op_loadimmed_ident(U32 &ip); + OPCodeReturn op_callfunc_resolve(U32 &ip); + OPCodeReturn op_callfunc(U32 &ip); + OPCodeReturn op_callfunc_pointer(U32 &ip); + OPCodeReturn op_callfunc_this(U32 &ip); + OPCodeReturn op_advance_str(U32 &ip); + OPCodeReturn op_advance_str_appendchar(U32 &ip); + OPCodeReturn op_advance_str_comma(U32 &ip); + OPCodeReturn op_advance_str_nul(U32 &ip); + OPCodeReturn op_rewind_str(U32 &ip); + OPCodeReturn op_terminate_rewind_str(U32 &ip); + OPCodeReturn op_compare_str(U32 &ip); + OPCodeReturn op_push(U32 &ip); + OPCodeReturn op_push_uint(U32 &ip); + OPCodeReturn op_push_flt(U32 &ip); + OPCodeReturn op_push_var(U32 &ip); + OPCodeReturn op_push_this(U32 &ip); + OPCodeReturn op_push_frame(U32 &ip); + OPCodeReturn op_assert(U32 &ip); + OPCodeReturn op_break(U32 &ip); + OPCodeReturn op_iter_begin_str(U32 &ip); + OPCodeReturn op_iter_begin(U32 &ip); + OPCodeReturn op_iter(U32 &ip); + OPCodeReturn op_iter_end(U32 &ip); + OPCodeReturn op_invalid(U32 &ip); + + /// @} + +private: + CodeBlock *mCodeBlock; + + /// Group exec arguments. + struct + { + StringTableEntry functionName; + Namespace *thisNamespace; + U32 argc; + ConsoleValueRef *argv; + bool noCalls; + StringTableEntry packageName; + S32 setFrame; + } mExec; + + U32 mIterDepth; + F64 *mCurFloatTable; + char *mCurStringTable; + StringTableEntry mThisFunctionName; + bool mPopFrame; + + // Add local object creation stack [7/9/2007 Black] + static const U32 objectCreationStackSize = 32; + U32 mObjectCreationStackIndex; + struct + { + SimObject *newObject; + U32 failJump; + } mObjectCreationStack[objectCreationStackSize]; + + SimObject *mCurrentNewObject; + U32 mFailJump; + StringTableEntry mPrevField; + StringTableEntry mCurField; + SimObject *mPrevObject; + SimObject *mCurObject; + SimObject *mSaveObject; + SimObject *mThisObject; + Namespace::Entry *mNSEntry; + StringTableEntry mCurFNDocBlock; + StringTableEntry mCurNSDocBlock; + U32 mCallArgc; + ConsoleValueRef *mCallArgv; + CodeBlock *mSaveCodeBlock; + + // note: anything returned is pushed to CSTK and will be invalidated on the next exec() + ConsoleValueRef mReturnValue; + + U32 mCurrentInstruction; + + static const S32 nsDocLength = 128; + char mNSDocBlockClass[nsDocLength]; +}; + +#endif \ No newline at end of file diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 1d872df8a..dc6f8a5f5 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -20,11 +20,6 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// -// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames -// Copyright (C) 2015 Faust Logic, Inc. -//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// - #include "platform/platform.h" #include "console/console.h" @@ -45,95 +40,38 @@ #include "util/messaging/message.h" #include "core/frameAllocator.h" +#include "console/codeInterpreter.h" + #ifndef TORQUE_TGB_ONLY #include "materials/materialDefinition.h" #include "materials/materialManager.h" #endif -// Uncomment to optimize function calls at the expense of potential invalid package lookups -//#define COMPILER_OPTIMIZE_FUNCTION_CALLS - using namespace Compiler; -enum EvalConstants { - MaxStackSize = 1024, - MethodOnComponent = -2 -}; - namespace Con { -// Current script file name and root, these are registered as -// console variables. -extern StringTableEntry gCurrentFile; -extern StringTableEntry gCurrentRoot; -extern S32 gObjectCopyFailures; + // Current script file name and root, these are registered as + // console variables. + extern StringTableEntry gCurrentFile; + extern StringTableEntry gCurrentRoot; + extern S32 gObjectCopyFailures; } -/// Frame data for a foreach/foreach$ loop. -struct IterStackRecord -{ - /// If true, this is a foreach$ loop; if not, it's a foreach loop. - bool mIsStringIter; - - /// The iterator variable. - Dictionary::Entry* mVariable; - - /// Information for an object iterator loop. - struct ObjectPos - { - /// The set being iterated over. - SimSet* mSet; - - /// Current index in the set. - U32 mIndex; - }; - - /// Information for a string iterator loop. - struct StringPos - { - /// The raw string data on the string stack. - StringStackPtr mString; - - /// Current parsing position. - U32 mIndex; - }; - - union - { - ObjectPos mObj; - StringPos mStr; - } mData; -}; - -IterStackRecord iterStack[ MaxStackSize ]; - -F64 floatStack[MaxStackSize]; -S64 intStack[MaxStackSize]; - - - - -StringStack STR; -ConsoleValueStack CSTK; - -U32 _FLT = 0; ///< Stack pointer for floatStack. -U32 _UINT = 0; ///< Stack pointer for intStack. -U32 _ITER = 0; ///< Stack pointer for iterStack. - namespace Con { const char *getNamespaceList(Namespace *ns) { U32 size = 1; Namespace * walk; - for(walk = ns; walk; walk = walk->mParent) + for (walk = ns; walk; walk = walk->mParent) size += dStrlen(walk->mName) + 4; char *ret = Con::getReturnBuffer(size); ret[0] = 0; - for(walk = ns; walk; walk = walk->mParent) + for (walk = ns; walk; walk = walk->mParent) { dStrcat(ret, walk->mName); - if(walk->mParent) + if (walk->mParent) dStrcat(ret, " -> "); } return ret; @@ -145,13 +83,13 @@ namespace Con F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line) { F64 val = dAtof(str); - if(val != 0) + if (val != 0) return val; - else if(!dStricmp(str, "true")) + else if (!dStricmp(str, "true")) return 1; - else if(!dStricmp(str, "false")) + else if (!dStricmp(str, "false")) return 0; - else if(file) + else if (file) { Con::warnf(ConsoleLogEntry::General, "%s (%d): string always evaluates to 0.", file, line); return 0; @@ -170,28 +108,28 @@ namespace Con return STR.getReturnBuffer(bufferSize); } - char *getReturnBuffer( const char *stringToCopy ) + char *getReturnBuffer(const char *stringToCopy) { - U32 len = dStrlen( stringToCopy ) + 1; - char *ret = STR.getReturnBuffer( len); - dMemcpy( ret, stringToCopy, len ); + U32 len = dStrlen(stringToCopy) + 1; + char *ret = STR.getReturnBuffer(len); + dMemcpy(ret, stringToCopy, len); return ret; } - char* getReturnBuffer( const String& str ) + char* getReturnBuffer(const String& str) { const U32 size = str.size(); - char* ret = STR.getReturnBuffer( size ); - dMemcpy( ret, str.c_str(), size ); + char* ret = STR.getReturnBuffer(size); + dMemcpy(ret, str.c_str(), size); return ret; } - char* getReturnBuffer( const StringBuilder& str ) + char* getReturnBuffer(const StringBuilder& str) { - char* buffer = Con::getReturnBuffer( str.length() + 1 ); - str.copy( buffer ); - buffer[ str.length() ] = '\0'; - + char* buffer = Con::getReturnBuffer(str.length() + 1); + str.copy(buffer); + buffer[str.length()] = '\0'; + return buffer; } @@ -221,40 +159,40 @@ namespace Con return ret; } - char *getStringArg( const char *arg ) + char *getStringArg(const char *arg) { - U32 len = dStrlen( arg ) + 1; - char *ret = STR.getArgBuffer( len ); - dMemcpy( ret, arg, len ); + U32 len = dStrlen(arg) + 1; + char *ret = STR.getArgBuffer(len); + dMemcpy(ret, arg, len); return ret; } - char* getStringArg( const String& arg ) + char* getStringArg(const String& arg) { const U32 size = arg.size(); - char* ret = STR.getArgBuffer( size ); - dMemcpy( ret, arg.c_str(), size ); + char* ret = STR.getArgBuffer(size); + dMemcpy(ret, arg.c_str(), size); return ret; } } //------------------------------------------------------------ -inline void ExprEvalState::setCurVarName(StringTableEntry name) +void ExprEvalState::setCurVarName(StringTableEntry name) { - if(name[0] == '$') + if (name[0] == '$') currentVariable = globalVars.lookup(name); - else if( getStackDepth() > 0 ) + else if (getStackDepth() > 0) currentVariable = getCurrentFrame().lookup(name); - if(!currentVariable && gWarnUndefinedScriptVariables) + if (!currentVariable && gWarnUndefinedScriptVariables) Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name); } -inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name) +void ExprEvalState::setCurVarNameCreate(StringTableEntry name) { - if(name[0] == '$') + if (name[0] == '$') currentVariable = globalVars.add(name); - else if( getStackDepth() > 0 ) + else if (getStackDepth() > 0) currentVariable = getCurrentFrame().add(name); else { @@ -265,48 +203,48 @@ inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name) //------------------------------------------------------------ -inline S32 ExprEvalState::getIntVariable() +S32 ExprEvalState::getIntVariable() { return currentVariable ? currentVariable->getIntValue() : 0; } -inline F64 ExprEvalState::getFloatVariable() +F64 ExprEvalState::getFloatVariable() { return currentVariable ? currentVariable->getFloatValue() : 0; } -inline const char *ExprEvalState::getStringVariable() +const char *ExprEvalState::getStringVariable() { return currentVariable ? currentVariable->getStringValue() : ""; } //------------------------------------------------------------ -inline void ExprEvalState::setIntVariable(S32 val) +void ExprEvalState::setIntVariable(S32 val) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setIntValue(val); } -inline void ExprEvalState::setFloatVariable(F64 val) +void ExprEvalState::setFloatVariable(F64 val) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setFloatValue(val); } -inline void ExprEvalState::setStringVariable(const char *val) +void ExprEvalState::setStringVariable(const char *val) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setStringValue(val); } -inline void ExprEvalState::setStringStackPtrVariable(StringStackPtr str) +void ExprEvalState::setStringStackPtrVariable(StringStackPtr str) { AssertFatal(currentVariable != NULL, "Invalid evaluator state - trying to set null variable!"); currentVariable->setStringStackPtrValue(str); } -inline void ExprEvalState::setCopyVariable() +void ExprEvalState::setCopyVariable() { if (copyVariable) { @@ -314,2004 +252,24 @@ inline void ExprEvalState::setCopyVariable() { case ConsoleValue::TypeInternalInt: currentVariable->setIntValue(copyVariable->getIntValue()); - break; + break; case ConsoleValue::TypeInternalFloat: currentVariable->setFloatValue(copyVariable->getFloatValue()); - break; + break; default: currentVariable->setStringValue(copyVariable->getStringValue()); - break; + break; } } } //------------------------------------------------------------ -// Gets a component of an object's field value or a variable and returns it -// in val. -static void getFieldComponent( SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField, char val[] ) -{ - const char* prevVal = NULL; - - // Grab value from object. - if( object && field ) - prevVal = object->getDataField( field, array ); - - // Otherwise, grab from the string stack. The value coming in will always - // be a string because that is how multicomponent variables are handled. - else - prevVal = STR.getStringValue(); - - // Make sure we got a value. - if ( prevVal && *prevVal ) - { - static const StringTableEntry xyzw[] = - { - StringTable->insert( "x" ), - StringTable->insert( "y" ), - StringTable->insert( "z" ), - StringTable->insert( "w" ) - }; - - static const StringTableEntry rgba[] = - { - StringTable->insert( "r" ), - StringTable->insert( "g" ), - StringTable->insert( "b" ), - StringTable->insert( "a" ) - }; - - // Translate xyzw and rgba into the indexed component - // of the variable or field. - if ( subField == xyzw[0] || subField == rgba[0] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 0, " \t\n") ); - - else if ( subField == xyzw[1] || subField == rgba[1] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 1, " \t\n") ); - - else if ( subField == xyzw[2] || subField == rgba[2] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 2, " \t\n") ); - - else if ( subField == xyzw[3] || subField == rgba[3] ) - dStrcpy( val, StringUnit::getUnit( prevVal, 3, " \t\n") ); - - else - val[0] = 0; - } - else - val[0] = 0; -} - -// Sets a component of an object's field value based on the sub field. 'x' will -// set the first field, 'y' the second, and 'z' the third. -static void setFieldComponent( SimObject* object, StringTableEntry field, const char* array, StringTableEntry subField ) -{ - // Copy the current string value - char strValue[1024]; - dStrncpy( strValue, STR.getStringValue(), 1024 ); - - char val[1024] = ""; - const char* prevVal = NULL; - - // Set the value on an object field. - if( object && field ) - prevVal = object->getDataField( field, array ); - - // Set the value on a variable. - else if( gEvalState.currentVariable ) - prevVal = gEvalState.getStringVariable(); - - // Ensure that the variable has a value - if (!prevVal) - return; - - static const StringTableEntry xyzw[] = - { - StringTable->insert( "x" ), - StringTable->insert( "y" ), - StringTable->insert( "z" ), - StringTable->insert( "w" ) - }; - - static const StringTableEntry rgba[] = - { - StringTable->insert( "r" ), - StringTable->insert( "g" ), - StringTable->insert( "b" ), - StringTable->insert( "a" ) - }; - - // Insert the value into the specified - // component of the string. - if ( subField == xyzw[0] || subField == rgba[0] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") ); - - else if ( subField == xyzw[1] || subField == rgba[1] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 1, strValue, " \t\n") ); - - else if ( subField == xyzw[2] || subField == rgba[2] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 2, strValue, " \t\n") ); - - else if ( subField == xyzw[3] || subField == rgba[3] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 3, strValue, " \t\n") ); - - if ( val[0] != 0 ) - { - // Update the field or variable. - if( object && field ) - object->setDataField( field, 0, val ); - else if( gEvalState.currentVariable ) - gEvalState.setStringVariable( val ); - } -} ConsoleValueRef CodeBlock::exec(U32 ip, const char *functionName, Namespace *thisNamespace, U32 argc, ConsoleValueRef *argv, bool noCalls, StringTableEntry packageName, S32 setFrame) { - -#ifdef TORQUE_VALIDATE_STACK - U32 stackStart = STR.mStartStackSize; - U32 consoleStackStart = CSTK.mStackPos; -#endif - - //Con::printf("CodeBlock::exec(%s,%u)", functionName ? functionName : "??", ip); - - static char traceBuffer[1024]; - S32 i; - - U32 iterDepth = 0; - - incRefCount(); - F64 *curFloatTable; - char *curStringTable; - S32 curStringTableLen = 0; //clint to ensure we dont overwrite it - STR.clearFunctionOffset(); // ensures arg buffer offset is back to 0 - StringTableEntry thisFunctionName = NULL; - bool popFrame = false; - if(argv) - { - // assume this points into a function decl: - U32 fnArgc = code[ip + 2 + 6]; - thisFunctionName = CodeToSTE(code, ip); - S32 wantedArgc = getMin(argc-1, fnArgc); // argv[0] is func name - if(gEvalState.traceOn) - { - traceBuffer[0] = 0; - dStrcat(traceBuffer, "Entering "); - if(packageName) - { - dStrcat(traceBuffer, "["); - dStrcat(traceBuffer, packageName); - dStrcat(traceBuffer, "]"); - } - if(thisNamespace && thisNamespace->mName) - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s::%s(", thisNamespace->mName, thisFunctionName); - } - else - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s(", thisFunctionName); - } - for(i = 0; i < wantedArgc; i++) - { - dStrcat(traceBuffer, argv[i+1]); - if(i != wantedArgc - 1) - dStrcat(traceBuffer, ", "); - } - dStrcat(traceBuffer, ")"); - Con::printf("%s", traceBuffer); - } - gEvalState.pushFrame(thisFunctionName, thisNamespace); - popFrame = true; - - for(i = 0; i < wantedArgc; i++) - { - StringTableEntry var = CodeToSTE(code, ip + (2 + 6 + 1) + (i * 2)); - gEvalState.setCurVarNameCreate(var); - - ConsoleValueRef ref = argv[i+1]; - - switch(argv[i+1].getType()) - { - case ConsoleValue::TypeInternalInt: - gEvalState.setIntVariable(argv[i+1]); - break; - case ConsoleValue::TypeInternalFloat: - gEvalState.setFloatVariable(argv[i+1]); - break; - case ConsoleValue::TypeInternalStringStackPtr: - gEvalState.setStringStackPtrVariable(argv[i+1].getStringStackPtrValue()); - break; - case ConsoleValue::TypeInternalStackString: - case ConsoleValue::TypeInternalString: - default: - gEvalState.setStringVariable(argv[i+1]); - break; - } - } - - ip = ip + (fnArgc * 2) + (2 + 6 + 1); - curFloatTable = functionFloats; - curStringTable = functionStrings; - curStringTableLen = functionStringsMaxLen; - } - else - { - curFloatTable = globalFloats; - curStringTable = globalStrings; - curStringTableLen = globalStringsMaxLen; - - // If requested stack frame isn't available, request a new one - // (this prevents assert failures when creating local - // variables without a stack frame) - if (gEvalState.getStackDepth() <= setFrame) - setFrame = -1; - - // Do we want this code to execute using a new stack frame? - if (setFrame < 0) - { - gEvalState.pushFrame(NULL, NULL); - popFrame = true; - } - else - { - // We want to copy a reference to an existing stack frame - // on to the top of the stack. Any change that occurs to - // the locals during this new frame will also occur in the - // original frame. - S32 stackIndex = gEvalState.getStackDepth() - setFrame - 1; - gEvalState.pushFrameRef( stackIndex ); - popFrame = true; - } - } - - // Grab the state of the telenet debugger here once - // so that the push and pop frames are always balanced. - const bool telDebuggerOn = TelDebugger && TelDebugger->isConnected(); - if ( telDebuggerOn && setFrame < 0 ) - TelDebugger->pushStackFrame(); - - StringTableEntry var, objParent; - StringTableEntry fnName; - StringTableEntry fnNamespace, fnPackage; - - // Add local object creation stack [7/9/2007 Black] - static const U32 objectCreationStackSize = 32; - U32 objectCreationStackIndex = 0; - struct { - SimObject *newObject; - U32 failJump; - } objectCreationStack[ objectCreationStackSize ]; - - SimObject *currentNewObject = 0; - U32 failJump = 0; - StringTableEntry prevField = NULL; - StringTableEntry curField = NULL; - SimObject *prevObject = NULL; - SimObject *curObject = NULL; - SimObject *saveObject=NULL; - Namespace::Entry *nsEntry; - Namespace *ns; - const char* curFNDocBlock = NULL; - const char* curNSDocBlock = NULL; - const S32 nsDocLength = 128; - char nsDocBlockClass[nsDocLength]; - - U32 callArgc; - ConsoleValueRef *callArgv; - - static char curFieldArray[256]; - static char prevFieldArray[256]; - - CodeBlock *saveCodeBlock = smCurrentCodeBlock; - smCurrentCodeBlock = this; - if(this->name) - { - Con::gCurrentFile = this->name; - Con::gCurrentRoot = this->modPath; - } - const char * val; - StringStackPtr retValue; - - // note: anything returned is pushed to CSTK and will be invalidated on the next exec() - ConsoleValueRef returnValue; - - // The frame temp is used by the variable accessor ops (OP_SAVEFIELD_* and - // OP_LOADFIELD_*) to store temporary values for the fields. - static S32 VAL_BUFFER_SIZE = 1024; - FrameTemp valBuffer( VAL_BUFFER_SIZE ); - - for(;;) - { - U32 instruction = code[ip++]; - nsEntry = NULL; -breakContinue: - switch(instruction) - { - case OP_FUNC_DECL: - if(!noCalls) - { - fnName = CodeToSTE(code, ip); - fnNamespace = CodeToSTE(code, ip+2); - fnPackage = CodeToSTE(code, ip+4); - bool hasBody = ( code[ ip + 6 ] & 0x01 ) != 0; - U32 lineNumber = code[ ip + 6 ] >> 1; - - Namespace::unlinkPackages(); - ns = Namespace::find(fnNamespace, fnPackage); - ns->addFunction(fnName, this, hasBody ? ip : 0, curFNDocBlock ? dStrdup( curFNDocBlock ) : NULL, lineNumber );// if no body, set the IP to 0 - if( curNSDocBlock ) - { - if( fnNamespace == StringTable->lookup( nsDocBlockClass ) ) - { - char *usageStr = dStrdup( curNSDocBlock ); - usageStr[dStrlen(usageStr)] = '\0'; - ns->mUsage = usageStr; - ns->mCleanUpUsage = true; - curNSDocBlock = NULL; - } - } - Namespace::relinkPackages(); - - // If we had a docblock, it's definitely not valid anymore, so clear it out. - curFNDocBlock = NULL; - - //Con::printf("Adding function %s::%s (%d)", fnNamespace, fnName, ip); - } - ip = code[ip + 7]; - break; - - case OP_CREATE_OBJECT: - { - // Read some useful info. - objParent = CodeToSTE(code, ip); - bool isDataBlock = code[ip + 2]; - bool isInternal = code[ip + 3]; - bool isSingleton = code[ip + 4]; - U32 lineNumber = code[ip + 5]; - failJump = code[ip + 6]; - - // If we don't allow calls, we certainly don't allow creating objects! - // Moved this to after failJump is set. Engine was crashing when - // noCalls = true and an object was being created at the beginning of - // a file. ADL. - if(noCalls) - { - ip = failJump; - break; - } - - // Push the old info to the stack - //Assert( objectCreationStackIndex < objectCreationStackSize ); - objectCreationStack[ objectCreationStackIndex ].newObject = currentNewObject; - objectCreationStack[ objectCreationStackIndex++ ].failJump = failJump; - - // Get the constructor information off the stack. - CSTK.getArgcArgv(NULL, &callArgc, &callArgv); - const char *objectName = callArgv[ 2 ]; - - // Con::printf("Creating object..."); - - // objectName = argv[1]... - currentNewObject = NULL; - - // Are we creating a datablock? If so, deal with case where we override - // an old one. - if(isDataBlock) - { - // Con::printf(" - is a datablock"); - - // Find the old one if any. - SimObject *db = Sim::getDataBlockGroup()->findObject( objectName ); - - // Make sure we're not changing types on ourselves... - if(db && dStricmp(db->getClassName(), callArgv[1])) - { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare data block %s with a different class.", getFileLine(ip), objectName); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - - // If there was one, set the currentNewObject and move on. - if(db) - currentNewObject = db; - } - else if (!isInternal) - { - // IF we aren't looking at a local/internal object, then check if - // this object already exists in the global space - - AbstractClassRep* rep = AbstractClassRep::findClassRep( objectName ); - if (rep != NULL) { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot name object [%s] the same name as a script class.", - getFileLine(ip), objectName); - ip = failJump; - STR.popFrame(); - break; - } - - SimObject *obj = Sim::findObject( (const char*)objectName ); - if (obj /*&& !obj->isLocalName()*/) - { - if ( isSingleton ) - { - // Make sure we're not trying to change types - if ( dStricmp( obj->getClassName(), (const char*)callArgv[1] ) != 0 ) - { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s] with a different class [%s] - was [%s].", - getFileLine(ip), objectName, (const char*)callArgv[1], obj->getClassName()); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - - // We're creating a singleton, so use the found object - // instead of creating a new object. - currentNewObject = obj; - } - else - { - const char* redefineBehavior = Con::getVariable( "$Con::redefineBehavior" ); - - if( dStricmp( redefineBehavior, "replaceExisting" ) == 0 ) - { - // Save our constructor args as the argv vector is stored on the - // string stack and may get stomped if deleteObject triggers - // script execution. - - ConsoleValueRef savedArgv[ StringStack::MaxArgs ]; - for (int i=0; ideleteObject(); - obj = NULL; - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - - //dMemcpy( callArgv, savedArgv, sizeof( callArgv[ 0 ] ) * callArgc ); - for (int i=0; iinsert( newName ); - break; - } - } - } - else if( dStricmp( redefineBehavior, "unnameNew" ) == 0 ) - { - objectName = StringTable->insert( "" ); - } - else if( dStricmp( redefineBehavior, "postfixNew" ) == 0 ) - { - const char* postfix = Con::getVariable( "$Con::redefineBehaviorPostfix" ); - String newName = String::ToString( "%s%s", objectName, postfix ); - - if( Sim::findObject( newName ) ) - { - Con::errorf( ConsoleLogEntry::General, "%s: Cannot re-declare object with postfix [%s].", - getFileLine(ip), newName.c_str() ); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - else - objectName = StringTable->insert( newName ); - } - else - { - Con::errorf(ConsoleLogEntry::General, "%s: Cannot re-declare object [%s].", - getFileLine(ip), objectName); - ip = failJump; - STR.popFrame(); - CSTK.popFrame(); - break; - } - } - } - } - - STR.popFrame(); - CSTK.popFrame(); - - if(!currentNewObject) - { - // Well, looks like we have to create a new object. - ConsoleObject *object = ConsoleObject::create((const char*)callArgv[1]); - - // Deal with failure! - if(!object) - { - Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-conobject class %s.", getFileLine(ip), (const char*)callArgv[1]); - ip = failJump; - break; - } - - // Do special datablock init if appropros - if(isDataBlock) - { - SimDataBlock *dataBlock = dynamic_cast(object); - if(dataBlock) - { - dataBlock->assignId(); - } - else - { - // They tried to make a non-datablock with a datablock keyword! - Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-datablock class %s.", getFileLine(ip), (const char*)callArgv[1]); - // Clean up... - delete object; - currentNewObject = NULL; - ip = failJump; - break; - } - } - - // Finally, set currentNewObject to point to the new one. - currentNewObject = dynamic_cast(object); - - // Deal with the case of a non-SimObject. - if(!currentNewObject) - { - Con::errorf(ConsoleLogEntry::General, "%s: Unable to instantiate non-SimObject class %s.", getFileLine(ip), (const char*)callArgv[1]); - delete object; - currentNewObject = NULL; - ip = failJump; - break; - } - - // Set the declaration line - currentNewObject->setDeclarationLine(lineNumber); - - // Set the file that this object was created in - currentNewObject->setFilename(name); - - // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) - if(*objParent) - { - // Find it! - SimObject *parent; - if(Sim::findObject(objParent, parent)) - { - // Con::printf(" - Parent object found: %s", parent->getClassName()); - - currentNewObject->setCopySource( parent ); - currentNewObject->assignFieldsFrom( parent ); - // copy any substitution statements - SimDataBlock* parent_db = dynamic_cast(parent); - if (parent_db) - { - SimDataBlock* currentNewObject_db = dynamic_cast(currentNewObject); - if (currentNewObject_db) - currentNewObject_db->copySubstitutionsFrom(parent_db); - } - } - else - { - if ( Con::gObjectCopyFailures == -1 ) - Con::errorf(ConsoleLogEntry::General, "%s: Unable to find parent object %s for %s.", getFileLine(ip), objParent, (const char*)callArgv[1]); - else - ++Con::gObjectCopyFailures; - - // Fail to create the object. - delete object; - currentNewObject = NULL; - ip = failJump; - break; - } - } - - // If a name was passed, assign it. - if( objectName[ 0 ] ) - { - if( !isInternal ) - currentNewObject->assignName( objectName ); - else - currentNewObject->setInternalName( objectName ); - - // Set the original name - currentNewObject->setOriginalName( objectName ); - } - - // Prevent stack value corruption - CSTK.pushFrame(); - STR.pushFrame(); - // -- - - // Do the constructor parameters. - if(!currentNewObject->processArguments(callArgc-3, callArgv+3)) - { - delete currentNewObject; - currentNewObject = NULL; - ip = failJump; - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - - // If it's not a datablock, allow people to modify bits of it. - if(!isDataBlock) - { - currentNewObject->setModStaticFields(true); - currentNewObject->setModDynamicFields(true); - } - } - else - { - currentNewObject->reloadReset(); // AFX (reload-reset) - // Does it have a parent object? (ie, the copy constructor : syntax, not inheriance) - if(*objParent) - { - // Find it! - SimObject *parent; - if(Sim::findObject(objParent, parent)) - { - // Con::printf(" - Parent object found: %s", parent->getClassName()); - - // temporarily block name change - SimObject::preventNameChanging = true; - currentNewObject->setCopySource( parent ); - currentNewObject->assignFieldsFrom(parent); - // restore name changing - SimObject::preventNameChanging = false; - - // copy any substitution statements - SimDataBlock* parent_db = dynamic_cast(parent); - if (parent_db) - { - SimDataBlock* currentNewObject_db = dynamic_cast(currentNewObject); - if (currentNewObject_db) - currentNewObject_db->copySubstitutionsFrom(parent_db); - } - } - else - Con::errorf(ConsoleLogEntry::General, "%d: Unable to find parent object %s for %s.", lineNumber, objParent, (const char*)callArgv[1]); - } - } - - // Advance the IP past the create info... - ip += 7; - break; - } - - case OP_ADD_OBJECT: - { - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - - // Do we place this object at the root? - bool placeAtRoot = code[ip++]; - - // Con::printf("Adding object %s", currentNewObject->getName()); - - // Prevent stack value corruption - CSTK.pushFrame(); - STR.pushFrame(); - // -- - - // Make sure it wasn't already added, then add it. - if(currentNewObject->isProperlyAdded() == false) - { - bool ret = false; - - Message *msg = dynamic_cast(currentNewObject); - if(msg) - { - SimObjectId id = Message::getNextMessageID(); - if(id != 0xffffffff) - ret = currentNewObject->registerObject(id); - else - Con::errorf("%s: No more object IDs available for messages", getFileLine(ip)); - } - else - ret = currentNewObject->registerObject(); - - if(! ret) - { - // This error is usually caused by failing to call Parent::initPersistFields in the class' initPersistFields(). - Con::warnf(ConsoleLogEntry::General, "%s: Register object failed for object %s of class %s.", getFileLine(ip), currentNewObject->getName(), currentNewObject->getClassName()); - delete currentNewObject; - currentNewObject = NULL; - ip = failJump; - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - } - - // Are we dealing with a datablock? - SimDataBlock *dataBlock = dynamic_cast(currentNewObject); - static String errorStr; - - - - // If so, preload it. - if(dataBlock && !dataBlock->preload(true, errorStr)) - { - Con::errorf(ConsoleLogEntry::General, "%s: preload failed for %s: %s.", getFileLine(ip), - currentNewObject->getName(), errorStr.c_str()); - dataBlock->deleteObject(); - currentNewObject = NULL; - ip = failJump; - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - - // What group will we be added to, if any? - U32 groupAddId = intStack[_UINT]; - SimGroup *grp = NULL; - SimSet *set = NULL; - bool isMessage = dynamic_cast(currentNewObject) != NULL; - - if(!placeAtRoot || !currentNewObject->getGroup()) - { - if(! isMessage) - { - if(! placeAtRoot) - { - // Otherwise just add to the requested group or set. - if(!Sim::findObject(groupAddId, grp)) - Sim::findObject(groupAddId, set); - } - - if(placeAtRoot) - { - // Deal with the instantGroup if we're being put at the root or we're adding to a component. - if( Con::gInstantGroup.isEmpty() - || !Sim::findObject( Con::gInstantGroup, grp ) ) - grp = Sim::getRootGroup(); - } - } - - // If we didn't get a group, then make sure we have a pointer to - // the rootgroup. - if(!grp) - grp = Sim::getRootGroup(); - - // add to the parent group - grp->addObject(currentNewObject); - - // If for some reason the add failed, add the object to the - // root group so it won't leak. - if( !currentNewObject->getGroup() ) - Sim::getRootGroup()->addObject( currentNewObject ); - - // add to any set we might be in - if(set) - set->addObject(currentNewObject); - } - - // store the new object's ID on the stack (overwriting the group/set - // id, if one was given, otherwise getting pushed) - if(placeAtRoot) - intStack[_UINT] = currentNewObject->getId(); - else - intStack[++_UINT] = currentNewObject->getId(); - - // Prevent stack value corruption - CSTK.popFrame(); - STR.popFrame(); - // -- - break; - } - - case OP_END_OBJECT: - { - // If we're not to be placed at the root, make sure we clean up - // our group reference. - bool placeAtRoot = code[ip++]; - if(!placeAtRoot) - _UINT--; - break; - } - - case OP_FINISH_OBJECT: - { - if (currentNewObject) - currentNewObject->onPostAdd(); - - //Assert( objectCreationStackIndex >= 0 ); - // Restore the object info from the stack [7/9/2007 Black] - currentNewObject = objectCreationStack[ --objectCreationStackIndex ].newObject; - failJump = objectCreationStack[ objectCreationStackIndex ].failJump; - break; - } - - case OP_JMPIFFNOT: - if(floatStack[_FLT--]) - { - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIFNOT: - if(intStack[_UINT--]) - { - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIFF: - if(!floatStack[_FLT--]) - { - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIF: - if(!intStack[_UINT--]) - { - ip ++; - break; - } - ip = code[ip]; - break; - case OP_JMPIFNOT_NP: - if(intStack[_UINT]) - { - _UINT--; - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMPIF_NP: - if(!intStack[_UINT]) - { - _UINT--; - ip++; - break; - } - ip = code[ip]; - break; - case OP_JMP: - ip = code[ip]; - break; - - // This fixes a bug when not explicitly returning a value. - case OP_RETURN_VOID: - STR.setStringValue(""); - // We're falling thru here on purpose. - - case OP_RETURN: - retValue = STR.getStringValuePtr(); - - if( iterDepth > 0 ) - { - // Clear iterator state. - while( iterDepth > 0 ) - { - iterStack[ -- _ITER ].mIsStringIter = false; - -- iterDepth; - } - - STR.rewind(); - STR.setStringValue( StringStackPtrRef(retValue).getPtr(&STR) ); // Not nice but works. - retValue = STR.getStringValuePtr(); - } - - // Previously the return value was on the stack and would be returned using STR.getStringValue(). - // Now though we need to wrap it in a ConsoleValueRef - returnValue.value = CSTK.pushStringStackPtr(retValue); - - goto execFinished; - - case OP_RETURN_FLT: - - if( iterDepth > 0 ) - { - // Clear iterator state. - while( iterDepth > 0 ) - { - iterStack[ -- _ITER ].mIsStringIter = false; - -- iterDepth; - } - - } - - returnValue.value = CSTK.pushFLT(floatStack[_FLT]); - _FLT--; - - goto execFinished; - - case OP_RETURN_UINT: - - if( iterDepth > 0 ) - { - // Clear iterator state. - while( iterDepth > 0 ) - { - iterStack[ -- _ITER ].mIsStringIter = false; - -- iterDepth; - } - } - - returnValue.value = CSTK.pushUINT(intStack[_UINT]); - _UINT--; - - goto execFinished; - - case OP_CMPEQ: - intStack[_UINT+1] = bool(floatStack[_FLT] == floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPGR: - intStack[_UINT+1] = bool(floatStack[_FLT] > floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPGE: - intStack[_UINT+1] = bool(floatStack[_FLT] >= floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPLT: - intStack[_UINT+1] = bool(floatStack[_FLT] < floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPLE: - intStack[_UINT+1] = bool(floatStack[_FLT] <= floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_CMPNE: - intStack[_UINT+1] = bool(floatStack[_FLT] != floatStack[_FLT-1]); - _UINT++; - _FLT -= 2; - break; - - case OP_XOR: - intStack[_UINT-1] = intStack[_UINT] ^ intStack[_UINT-1]; - _UINT--; - break; - - case OP_MOD: - if( intStack[_UINT-1] != 0 ) - intStack[_UINT-1] = intStack[_UINT] % intStack[_UINT-1]; - else - intStack[_UINT-1] = 0; - _UINT--; - break; - - case OP_BITAND: - intStack[_UINT-1] = intStack[_UINT] & intStack[_UINT-1]; - _UINT--; - break; - - case OP_BITOR: - intStack[_UINT-1] = intStack[_UINT] | intStack[_UINT-1]; - _UINT--; - break; - - case OP_NOT: - intStack[_UINT] = !intStack[_UINT]; - break; - - case OP_NOTF: - intStack[_UINT+1] = !floatStack[_FLT]; - _FLT--; - _UINT++; - break; - - case OP_ONESCOMPLEMENT: - intStack[_UINT] = ~intStack[_UINT]; - break; - - case OP_SHR: - intStack[_UINT-1] = intStack[_UINT] >> intStack[_UINT-1]; - _UINT--; - break; - - case OP_SHL: - intStack[_UINT-1] = intStack[_UINT] << intStack[_UINT-1]; - _UINT--; - break; - - case OP_AND: - intStack[_UINT-1] = intStack[_UINT] && intStack[_UINT-1]; - _UINT--; - break; - - case OP_OR: - intStack[_UINT-1] = intStack[_UINT] || intStack[_UINT-1]; - _UINT--; - break; - - case OP_ADD: - floatStack[_FLT-1] = floatStack[_FLT] + floatStack[_FLT-1]; - _FLT--; - break; - - case OP_SUB: - floatStack[_FLT-1] = floatStack[_FLT] - floatStack[_FLT-1]; - _FLT--; - break; - - case OP_MUL: - floatStack[_FLT-1] = floatStack[_FLT] * floatStack[_FLT-1]; - _FLT--; - break; - case OP_DIV: - floatStack[_FLT-1] = floatStack[_FLT] / floatStack[_FLT-1]; - _FLT--; - break; - case OP_NEG: - floatStack[_FLT] = -floatStack[_FLT]; - break; - - case OP_SETCURVAR: - var = CodeToSTE(code, ip); - ip += 2; - - // If a variable is set, then these must be NULL. It is necessary - // to set this here so that the vector parser can appropriately - // identify whether it's dealing with a vector. - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarName(var); - - // In order to let docblocks work properly with variables, we have - // clear the current docblock when we do an assign. This way it - // won't inappropriately carry forward to following function decls. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_SETCURVAR_CREATE: - var = CodeToSTE(code, ip); - ip += 2; - - // See OP_SETCURVAR - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarNameCreate(var); - - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_SETCURVAR_ARRAY: - var = STR.getSTValue(); - - // See OP_SETCURVAR - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarName(var); - - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_SETCURVAR_ARRAY_CREATE: - var = STR.getSTValue(); - - // See OP_SETCURVAR - prevField = NULL; - prevObject = NULL; - curObject = NULL; - - gEvalState.setCurVarNameCreate(var); - - // See OP_SETCURVAR for why we do this. - curFNDocBlock = NULL; - curNSDocBlock = NULL; - break; - - case OP_LOADVAR_UINT: - intStack[_UINT+1] = gEvalState.getIntVariable(); - _UINT++; - break; - - case OP_LOADVAR_FLT: - floatStack[_FLT+1] = gEvalState.getFloatVariable(); - _FLT++; - break; - - case OP_LOADVAR_STR: - val = gEvalState.getStringVariable(); - STR.setStringValue(val); - break; - - case OP_LOADVAR_VAR: - // Sets current source of OP_SAVEVAR_VAR - gEvalState.copyVariable = gEvalState.currentVariable; - break; - - case OP_SAVEVAR_UINT: - gEvalState.setIntVariable(intStack[_UINT]); - break; - - case OP_SAVEVAR_FLT: - gEvalState.setFloatVariable(floatStack[_FLT]); - break; - - case OP_SAVEVAR_STR: - gEvalState.setStringVariable(STR.getStringValue()); - break; - - case OP_SAVEVAR_VAR: - // this basically handles %var1 = %var2 - gEvalState.setCopyVariable(); - break; - - case OP_SETCUROBJECT: - // Save the previous object for parsing vector fields. - prevObject = curObject; - val = STR.getStringValue(); - - // Sim::findObject will sometimes find valid objects from - // multi-component strings. This makes sure that doesn't - // happen. - for( const char* check = val; *check; check++ ) - { - if( *check == ' ' ) - { - val = ""; - break; - } - } - curObject = Sim::findObject(val); - break; - - case OP_SETCUROBJECT_INTERNAL: - ++ip; // To skip the recurse flag if the object wasn't found - if(curObject) - { - SimSet *set = dynamic_cast(curObject); - if(set) - { - StringTableEntry intName = StringTable->insert(STR.getStringValue()); - bool recurse = code[ip-1]; - SimObject *obj = set->findObjectByInternalName(intName, recurse); - intStack[_UINT+1] = obj ? obj->getId() : 0; - _UINT++; - } - else - { - Con::errorf(ConsoleLogEntry::Script, "%s: Attempt to use -> on non-set %s of class %s.", getFileLine(ip-2), curObject->getName(), curObject->getClassName()); - intStack[_UINT] = 0; - } - } - break; - - case OP_SETCUROBJECT_NEW: - curObject = currentNewObject; - break; - - case OP_SETCURFIELD: - // Save the previous field for parsing vector fields. - prevField = curField; - dStrcpy( prevFieldArray, curFieldArray ); - curField = CodeToSTE(code, ip); - curFieldArray[0] = 0; - ip += 2; - break; - - case OP_SETCURFIELD_ARRAY: - dStrcpy(curFieldArray, STR.getStringValue()); - break; - - case OP_SETCURFIELD_TYPE: - if(curObject) - curObject->setDataFieldType(code[ip], curField, curFieldArray); - ip++; - break; - - case OP_LOADFIELD_UINT: - if(curObject) - intStack[_UINT+1] = U32(dAtoi(curObject->getDataField(curField, curFieldArray))); - else - { - // The field is not being retrieved from an object. Maybe it's - // a special accessor? - getFieldComponent( prevObject, prevField, prevFieldArray, curField, valBuffer ); - intStack[_UINT+1] = dAtoi( valBuffer ); - } - _UINT++; - break; - - case OP_LOADFIELD_FLT: - if(curObject) - floatStack[_FLT+1] = dAtof(curObject->getDataField(curField, curFieldArray)); - else - { - // The field is not being retrieved from an object. Maybe it's - // a special accessor? - getFieldComponent( prevObject, prevField, prevFieldArray, curField, valBuffer ); - floatStack[_FLT+1] = dAtof( valBuffer ); - } - _FLT++; - break; - - case OP_LOADFIELD_STR: - if(curObject) - { - val = curObject->getDataField(curField, curFieldArray); - STR.setStringValue( val ); - } - else - { - // The field is not being retrieved from an object. Maybe it's - // a special accessor? - getFieldComponent( prevObject, prevField, prevFieldArray, curField, valBuffer ); - STR.setStringValue( valBuffer ); - } - break; - - case OP_SAVEFIELD_UINT: - STR.setIntValue(intStack[_UINT]); - if(curObject) - curObject->setDataField(curField, curFieldArray, STR.getStringValue()); - else - { - // The field is not being set on an object. Maybe it's - // a special accessor? - setFieldComponent( prevObject, prevField, prevFieldArray, curField ); - prevObject = NULL; - } - break; - - case OP_SAVEFIELD_FLT: - STR.setFloatValue(floatStack[_FLT]); - if(curObject) - curObject->setDataField(curField, curFieldArray, STR.getStringValue()); - else - { - // The field is not being set on an object. Maybe it's - // a special accessor? - setFieldComponent( prevObject, prevField, prevFieldArray, curField ); - prevObject = NULL; - } - break; - - case OP_SAVEFIELD_STR: - if(curObject) - curObject->setDataField(curField, curFieldArray, STR.getStringValue()); - else - { - // The field is not being set on an object. Maybe it's - // a special accessor? - setFieldComponent( prevObject, prevField, prevFieldArray, curField ); - prevObject = NULL; - } - break; - - case OP_STR_TO_UINT: - intStack[_UINT+1] = STR.getIntValue(); - _UINT++; - break; - - case OP_STR_TO_FLT: - floatStack[_FLT+1] = STR.getFloatValue(); - _FLT++; - break; - - case OP_STR_TO_NONE: - // This exists simply to deal with certain typecast situations. - break; - - case OP_FLT_TO_UINT: - intStack[_UINT+1] = (S64)floatStack[_FLT]; - _FLT--; - _UINT++; - break; - - case OP_FLT_TO_STR: - STR.setFloatValue(floatStack[_FLT]); - _FLT--; - break; - - case OP_FLT_TO_NONE: - _FLT--; - break; - - case OP_UINT_TO_FLT: - floatStack[_FLT+1] = (F32)intStack[_UINT]; - _UINT--; - _FLT++; - break; - - case OP_UINT_TO_STR: - STR.setIntValue(intStack[_UINT]); - _UINT--; - break; - - case OP_UINT_TO_NONE: - _UINT--; - break; - - case OP_COPYVAR_TO_NONE: - gEvalState.copyVariable = NULL; - break; - - case OP_LOADIMMED_UINT: - intStack[_UINT+1] = code[ip++]; - _UINT++; - break; - - case OP_LOADIMMED_FLT: - floatStack[_FLT+1] = curFloatTable[code[ip]]; - ip++; - _FLT++; - break; - - case OP_TAG_TO_STR: - code[ip-1] = OP_LOADIMMED_STR; - // it's possible the string has already been converted - if(U8(curStringTable[code[ip]]) != StringTagPrefixByte) - { - U32 id = GameAddTaggedString(curStringTable + code[ip]); - dSprintf(curStringTable + code[ip] + 1, 7, "%d", id); - *(curStringTable + code[ip]) = StringTagPrefixByte; - } - case OP_LOADIMMED_STR: - STR.setStringValue(curStringTable + code[ip++]); - break; - - case OP_DOCBLOCK_STR: - { - // If the first word of the doc is '\class' or '@class', then this - // is a namespace doc block, otherwise it is a function doc block. - const char* docblock = curStringTable + code[ip++]; - - const char* sansClass = dStrstr( docblock, "@class" ); - if( !sansClass ) - sansClass = dStrstr( docblock, "\\class" ); - - if( sansClass ) - { - // Don't save the class declaration. Scan past the 'class' - // keyword and up to the first whitespace. - sansClass += 7; - S32 index = 0; - while( ( *sansClass != ' ' ) && ( *sansClass != '\n' ) && *sansClass && ( index < ( nsDocLength - 1 ) ) ) - { - nsDocBlockClass[index++] = *sansClass; - sansClass++; - } - nsDocBlockClass[index] = '\0'; - - curNSDocBlock = sansClass + 1; - } - else - curFNDocBlock = docblock; - } - - break; - - case OP_LOADIMMED_IDENT: - STR.setStringValue(CodeToSTE(code, ip)); - ip += 2; - break; - - case OP_CALLFUNC_RESOLVE: - // This deals with a function that is potentially living in a namespace. - fnNamespace = CodeToSTE(code, ip+2); - fnName = CodeToSTE(code, ip); - - // Try to look it up. - ns = Namespace::find(fnNamespace); - nsEntry = ns->lookup(fnName); - if(!nsEntry) - { - ip+= 5; - Con::warnf(ConsoleLogEntry::General, - "%s: Unable to find function %s%s%s", - getFileLine(ip-7), fnNamespace ? fnNamespace : "", - fnNamespace ? "::" : "", fnName); - STR.popFrame(); - CSTK.popFrame(); - break; - } - -#ifdef COMPILER_OPTIMIZE_FUNCTION_CALLS - // Now fall through to OP_CALLFUNC... - // Now, rewrite our code a bit (ie, avoid future lookups) and fall - // through to OP_CALLFUNC -#ifdef TORQUE_CPU_X64 - *((U64*)(code+ip+2)) = ((U64)nsEntry); -#else - code[ip+2] = ((U32)nsEntry); -#endif - code[ip-1] = OP_CALLFUNC; -#endif - - case OP_CALLFUNC: - { - // This routingId is set when we query the object as to whether - // it handles this method. It is set to an enum from the table - // above indicating whether it handles it on a component it owns - // or just on the object. - S32 routingId = 0; - - fnName = CodeToSTE(code, ip); - - //if this is called from inside a function, append the ip and codeptr - if( gEvalState.getStackDepth() > 0 ) - { - gEvalState.getCurrentFrame().code = this; - gEvalState.getCurrentFrame().ip = ip - 1; - } - - U32 callType = code[ip+4]; - - ip += 5; - CSTK.getArgcArgv(fnName, &callArgc, &callArgv); - - const char *componentReturnValue = ""; - - if(callType == FuncCallExprNode::FunctionCall) - { - if( !nsEntry ) - { -#ifdef COMPILER_OPTIMIZE_FUNCTION_CALLS -#ifdef TORQUE_CPU_X64 - nsEntry = ((Namespace::Entry *) *((U64*)(code+ip-3))); -#else - nsEntry = ((Namespace::Entry *) *(code+ip-3)); -#endif -#else - nsEntry = Namespace::global()->lookup( fnName ); -#endif - ns = NULL; - } - ns = NULL; - } - else if(callType == FuncCallExprNode::MethodCall) - { - saveObject = gEvalState.thisObject; - gEvalState.thisObject = Sim::findObject((const char*)callArgv[1]); - if(!gEvalState.thisObject) - { - // Go back to the previous saved object. - gEvalState.thisObject = saveObject; - - Con::warnf(ConsoleLogEntry::General,"%s: Unable to find object: '%s' attempting to call function '%s'", getFileLine(ip-4), (const char*)callArgv[1], fnName); - STR.popFrame(); - CSTK.popFrame(); - STR.setStringValue(""); - break; - } - - bool handlesMethod = gEvalState.thisObject->handlesConsoleMethod(fnName,&routingId); - if( handlesMethod && routingId == MethodOnComponent ) - { - ICallMethod *pComponent = dynamic_cast( gEvalState.thisObject ); - if( pComponent ) - componentReturnValue = pComponent->callMethodArgList( callArgc, callArgv, false ); - } - - ns = gEvalState.thisObject->getNamespace(); - if(ns) - nsEntry = ns->lookup(fnName); - else - nsEntry = NULL; - } - else // it's a ParentCall - { - if(thisNamespace) - { - ns = thisNamespace->mParent; - if(ns) - nsEntry = ns->lookup(fnName); - else - nsEntry = NULL; - } - else - { - ns = NULL; - nsEntry = NULL; - } - } - - Namespace::Entry::CallbackUnion * nsCb = NULL; - const char * nsUsage = NULL; - if (nsEntry) - { - nsCb = &nsEntry->cb; - nsUsage = nsEntry->mUsage; - routingId = 0; - } - if(!nsEntry || noCalls) - { - if(!noCalls && !( routingId == MethodOnComponent ) ) - { - Con::warnf(ConsoleLogEntry::General,"%s: Unknown command %s.", getFileLine(ip-6), fnName); - if(callType == FuncCallExprNode::MethodCall) - { - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", - gEvalState.thisObject->getId(), Con::getNamespaceList(ns) ); - } - } - STR.popFrame(); - CSTK.popFrame(); - - if( routingId == MethodOnComponent ) - STR.setStringValue( componentReturnValue ); - else - STR.setStringValue( "" ); - - break; - } - if(nsEntry->mType == Namespace::Entry::ConsoleFunctionType) - { - ConsoleValueRef ret; - if(nsEntry->mFunctionOffset) - ret = nsEntry->mCode->exec(nsEntry->mFunctionOffset, fnName, nsEntry->mNamespace, callArgc, callArgv, false, nsEntry->mPackage); - - STR.popFrame(); - // Functions are assumed to return strings, so look ahead to see if we can skip the conversion - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = (U32)((S32)ret); - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = (F32)ret; - } - else if(code[ip] == OP_STR_TO_NONE) - { - STR.setStringValue(ret.getStringValue()); - ip++; - } - else - STR.setStringValue((const char*)ret); - - // This will clear everything including returnValue - CSTK.popFrame(); - //STR.clearFunctionOffset(); - } - else - { - const char* nsName = ns? ns->mName: ""; -#ifndef TORQUE_DEBUG - // [tom, 12/13/2006] This stops tools functions from working in the console, - // which is useful behavior when debugging so I'm ifdefing this out for debug builds. - if(nsEntry->mToolOnly && ! Con::isCurrentScriptToolScript()) - { - Con::errorf(ConsoleLogEntry::Script, "%s: %s::%s - attempting to call tools only function from outside of tools.", getFileLine(ip-6), nsName, fnName); - } - else -#endif - if((nsEntry->mMinArgs && S32(callArgc) < nsEntry->mMinArgs) || (nsEntry->mMaxArgs && S32(callArgc) > nsEntry->mMaxArgs)) - { - Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments (got %i, expected min %i and max %i).", - getFileLine(ip-6), nsName, fnName, - callArgc, nsEntry->mMinArgs, nsEntry->mMaxArgs); - Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", getFileLine(ip-6), nsEntry->mUsage); - STR.popFrame(); - CSTK.popFrame(); - } - else - { - switch(nsEntry->mType) - { - case Namespace::Entry::StringCallbackType: - { - const char *ret = nsEntry->cb.mStringCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(ret != STR.getStringValue()) - STR.setStringValue(ret); - //else - // STR.setLen(dStrlen(ret)); - break; - } - case Namespace::Entry::IntCallbackType: - { - S32 result = nsEntry->cb.mIntCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = result; - break; - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = result; - break; - } - else if(code[ip] == OP_STR_TO_NONE) - ip++; - else - STR.setIntValue(result); - break; - } - case Namespace::Entry::FloatCallbackType: - { - F64 result = nsEntry->cb.mFloatCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = (S64)result; - break; - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = result; - break; - } - else if(code[ip] == OP_STR_TO_NONE) - ip++; - else - STR.setFloatValue(result); - break; - } - case Namespace::Entry::VoidCallbackType: - nsEntry->cb.mVoidCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - if( code[ ip ] != OP_STR_TO_NONE && Con::getBoolVariable( "$Con::warnVoidAssignment", true ) ) - Con::warnf(ConsoleLogEntry::General, "%s: Call to %s in %s uses result of void function call.", getFileLine(ip-6), fnName, functionName); - - STR.popFrame(); - CSTK.popFrame(); - STR.setStringValue(""); - break; - case Namespace::Entry::BoolCallbackType: - { - bool result = nsEntry->cb.mBoolCallbackFunc(gEvalState.thisObject, callArgc, callArgv); - STR.popFrame(); - CSTK.popFrame(); - if(code[ip] == OP_STR_TO_UINT) - { - ip++; - intStack[++_UINT] = result; - break; - } - else if(code[ip] == OP_STR_TO_FLT) - { - ip++; - floatStack[++_FLT] = result; - break; - } - else if(code[ip] == OP_STR_TO_NONE) - ip++; - else - STR.setIntValue(result); - break; - } - } - } - } - - if(callType == FuncCallExprNode::MethodCall) - gEvalState.thisObject = saveObject; - break; - } - case OP_ADVANCE_STR: - STR.advance(); - break; - case OP_ADVANCE_STR_APPENDCHAR: - STR.advanceChar(code[ip++]); - break; - - case OP_ADVANCE_STR_COMMA: - STR.advanceChar('_'); - break; - - case OP_ADVANCE_STR_NUL: - STR.advanceChar(0); - break; - - case OP_REWIND_STR: - STR.rewind(); - break; - - case OP_TERMINATE_REWIND_STR: - STR.rewindTerminate(); - break; - - case OP_COMPARE_STR: - intStack[++_UINT] = STR.compare(); - break; - case OP_PUSH: - STR.push(); - CSTK.pushStringStackPtr(STR.getPreviousStringValuePtr()); - break; - case OP_PUSH_UINT: - CSTK.pushUINT(intStack[_UINT]); - _UINT--; - break; - case OP_PUSH_FLT: - CSTK.pushFLT(floatStack[_FLT]); - _FLT--; - break; - case OP_PUSH_VAR: - if (gEvalState.currentVariable) - CSTK.pushValue(gEvalState.currentVariable->value); - else - CSTK.pushString(""); - break; - - case OP_PUSH_FRAME: - STR.pushFrame(); - CSTK.pushFrame(); - break; - - case OP_ASSERT: - { - if( !intStack[_UINT--] ) - { - const char *message = curStringTable + code[ip]; - - U32 breakLine, inst; - findBreakLine( ip - 1, breakLine, inst ); - - if ( PlatformAssert::processAssert( PlatformAssert::Fatal, - name ? name : "eval", - breakLine, - message ) ) - { - if ( TelDebugger && TelDebugger->isConnected() && breakLine > 0 ) - { - TelDebugger->breakProcess(); - } - else - Platform::debugBreak(); - } - } - - ip++; - break; - } - - case OP_BREAK: - { - //append the ip and codeptr before managing the breakpoint! - AssertFatal( gEvalState.getStackDepth() > 0, "Empty eval stack on break!"); - gEvalState.getCurrentFrame().code = this; - gEvalState.getCurrentFrame().ip = ip - 1; - - U32 breakLine; - findBreakLine(ip-1, breakLine, instruction); - if(!breakLine) - goto breakContinue; - TelDebugger->executionStopped(this, breakLine); - goto breakContinue; - } - - case OP_ITER_BEGIN_STR: - { - iterStack[ _ITER ].mIsStringIter = true; - /* fallthrough */ - } - - case OP_ITER_BEGIN: - { - StringTableEntry varName = CodeToSTE(code, ip); - U32 failIp = code[ ip + 2 ]; - - IterStackRecord& iter = iterStack[ _ITER ]; - - iter.mVariable = gEvalState.getCurrentFrame().add( varName ); - - if( iter.mIsStringIter ) - { - iter.mData.mStr.mString = STR.getStringValuePtr(); - iter.mData.mStr.mIndex = 0; - } - else - { - // Look up the object. - - SimSet* set; - if( !Sim::findObject( STR.getStringValue(), set ) ) - { - Con::errorf( ConsoleLogEntry::General, "No SimSet object '%s'", STR.getStringValue() ); - Con::errorf( ConsoleLogEntry::General, "Did you mean to use 'foreach$' instead of 'foreach'?" ); - ip = failIp; - continue; - } - - // Set up. - - iter.mData.mObj.mSet = set; - iter.mData.mObj.mIndex = 0; - } - - _ITER ++; - iterDepth ++; - - STR.push(); - - ip += 3; - break; - } - - case OP_ITER: - { - U32 breakIp = code[ ip ]; - IterStackRecord& iter = iterStack[ _ITER - 1 ]; - - if( iter.mIsStringIter ) - { - const char* str = StringStackPtrRef(iter.mData.mStr.mString).getPtr(&STR); - - U32 startIndex = iter.mData.mStr.mIndex; - U32 endIndex = startIndex; - - // Break if at end. - - if( !str[ startIndex ] ) - { - ip = breakIp; - continue; - } - - // Find right end of current component. - - if( !dIsspace( str[ endIndex ] ) ) - do ++ endIndex; - while( str[ endIndex ] && !dIsspace( str[ endIndex ] ) ); - - // Extract component. - - if( endIndex != startIndex ) - { - char savedChar = str[ endIndex ]; - const_cast< char* >( str )[ endIndex ] = '\0'; // We are on the string stack so this is okay. - iter.mVariable->setStringValue( &str[ startIndex ] ); - const_cast< char* >( str )[ endIndex ] = savedChar; - } - else - iter.mVariable->setStringValue( "" ); - - // Skip separator. - if( str[ endIndex ] != '\0' ) - ++ endIndex; - - iter.mData.mStr.mIndex = endIndex; - } - else - { - U32 index = iter.mData.mObj.mIndex; - SimSet* set = iter.mData.mObj.mSet; - - if( index >= set->size() ) - { - ip = breakIp; - continue; - } - - iter.mVariable->setIntValue( set->at( index )->getId() ); - iter.mData.mObj.mIndex = index + 1; - } - - ++ ip; - break; - } - - case OP_ITER_END: - { - -- _ITER; - -- iterDepth; - - STR.rewind(); - - iterStack[ _ITER ].mIsStringIter = false; - break; - } - - case OP_INVALID: - - default: - // error! - goto execFinished; - } - } -execFinished: - - if ( telDebuggerOn && setFrame < 0 ) - TelDebugger->popStackFrame(); - - if ( popFrame ) - gEvalState.popFrame(); - - if(argv) - { - if(gEvalState.traceOn) - { - traceBuffer[0] = 0; - dStrcat(traceBuffer, "Leaving "); - - if(packageName) - { - dStrcat(traceBuffer, "["); - dStrcat(traceBuffer, packageName); - dStrcat(traceBuffer, "]"); - } - if(thisNamespace && thisNamespace->mName) - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s::%s() - return %s", thisNamespace->mName, thisFunctionName, STR.getStringValue()); - } - else - { - dSprintf(traceBuffer + dStrlen(traceBuffer), sizeof(traceBuffer) - dStrlen(traceBuffer), - "%s() - return %s", thisFunctionName, STR.getStringValue()); - } - Con::printf("%s", traceBuffer); - } - } - - smCurrentCodeBlock = saveCodeBlock; - if(saveCodeBlock && saveCodeBlock->name) - { - Con::gCurrentFile = saveCodeBlock->name; - Con::gCurrentRoot = saveCodeBlock->modPath; - } - - decRefCount(); - -#ifdef TORQUE_VALIDATE_STACK - AssertFatal(!(STR.mStartStackSize > stackStart), "String stack not popped enough in script exec"); - AssertFatal(!(STR.mStartStackSize < stackStart), "String stack popped too much in script exec"); -#endif - - return returnValue; + CodeInterpreter interpreter(this); + return interpreter.exec(ip, functionName, thisNamespace, argc, argv, noCalls, packageName, setFrame); } //------------------------------------------------------------ diff --git a/Engine/source/console/compiler.cpp b/Engine/source/console/compiler.cpp index fd871c036..0330f4d59 100644 --- a/Engine/source/console/compiler.cpp +++ b/Engine/source/console/compiler.cpp @@ -40,13 +40,13 @@ namespace Compiler F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line) { F64 val = dAtof(str); - if(val != 0) + if (val != 0) return val; - else if(!dStricmp(str, "true")) + else if (!dStricmp(str, "true")) return 1; - else if(!dStricmp(str, "false")) + else if (!dStricmp(str, "false")) return 0; - else if(file) + else if (file) { Con::warnf(ConsoleLogEntry::General, "%s (%d): string always evaluates to 0.", file, line); return 0; @@ -57,7 +57,7 @@ namespace Compiler //------------------------------------------------------------ CompilerStringTable *gCurrentStringTable, gGlobalStringTable, gFunctionStringTable; - CompilerFloatTable *gCurrentFloatTable, gGlobalFloatTable, gFunctionFloatTable; + CompilerFloatTable *gCurrentFloatTable, gGlobalFloatTable, gFunctionFloatTable; DataChunker gConsoleAllocator; CompilerIdentTable gIdentTable; @@ -71,16 +71,16 @@ namespace Compiler *ptr = (U32)ste; #endif } - + void compileSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr) { - if(ste) + if (ste) getIdentTable().add(ste, ip); *ptr = 0; - *(ptr+1) = 0; + *(ptr + 1) = 0; } - - void (*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr) = evalSTEtoCode; + + void(*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr) = evalSTEtoCode; //------------------------------------------------------------ @@ -88,23 +88,23 @@ namespace Compiler //------------------------------------------------------------ - CompilerStringTable *getCurrentStringTable() { return gCurrentStringTable; } - CompilerStringTable &getGlobalStringTable() { return gGlobalStringTable; } + CompilerStringTable *getCurrentStringTable() { return gCurrentStringTable; } + CompilerStringTable &getGlobalStringTable() { return gGlobalStringTable; } CompilerStringTable &getFunctionStringTable() { return gFunctionStringTable; } - void setCurrentStringTable (CompilerStringTable* cst) { gCurrentStringTable = cst; } + void setCurrentStringTable(CompilerStringTable* cst) { gCurrentStringTable = cst; } - CompilerFloatTable *getCurrentFloatTable() { return gCurrentFloatTable; } - CompilerFloatTable &getGlobalFloatTable() { return gGlobalFloatTable; } - CompilerFloatTable &getFunctionFloatTable() { return gFunctionFloatTable; } + CompilerFloatTable *getCurrentFloatTable() { return gCurrentFloatTable; } + CompilerFloatTable &getGlobalFloatTable() { return gGlobalFloatTable; } + CompilerFloatTable &getFunctionFloatTable() { return gFunctionFloatTable; } - void setCurrentFloatTable (CompilerFloatTable* cst) { gCurrentFloatTable = cst; } + void setCurrentFloatTable(CompilerFloatTable* cst) { gCurrentFloatTable = cst; } CompilerIdentTable &getIdentTable() { return gIdentTable; } void precompileIdent(StringTableEntry ident) { - if(ident) + if (ident) gGlobalStringTable.add(ident); } @@ -119,8 +119,8 @@ namespace Compiler getIdentTable().reset(); } - void *consoleAlloc(U32 size) { return gConsoleAllocator.alloc(size); } - void consoleAllocReset() { gConsoleAllocator.freeBlocks(); } + void *consoleAlloc(U32 size) { return gConsoleAllocator.alloc(size); } + void consoleAllocReset() { gConsoleAllocator.freeBlocks(); } } @@ -135,36 +135,40 @@ U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag) { // Is it already in? Entry **walk; - for(walk = &list; *walk; walk = &((*walk)->next)) + for (walk = &list; *walk; walk = &((*walk)->next)) { - if((*walk)->tag != tag) + if ((*walk)->tag != tag) continue; - if(caseSens) + if (caseSens) { - if(!dStrcmp((*walk)->string, str)) + if (!dStrcmp((*walk)->string, str)) return (*walk)->start; } else { - if(!dStricmp((*walk)->string, str)) + if (!dStricmp((*walk)->string, str)) return (*walk)->start; } } // Write it out. - Entry *newStr = (Entry *) consoleAlloc(sizeof(Entry)); + Entry *newStr = (Entry *)consoleAlloc(sizeof(Entry)); *walk = newStr; newStr->next = NULL; newStr->start = totalLen; U32 len = dStrlen(str) + 1; - if(tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul + if (tag && len < 7) // alloc space for the numeric tag 1 for tag, 5 for # and 1 for nul len = 7; totalLen += len; - newStr->string = (char *) consoleAlloc(len); + newStr->string = (char *)consoleAlloc(len); newStr->len = len; newStr->tag = tag; dStrcpy(newStr->string, str); + + // Put into the hash table. + hashTable[str] = newStr; + return newStr->start; } @@ -189,7 +193,8 @@ void CompilerStringTable::reset() char *CompilerStringTable::build() { char *ret = new char[totalLen]; - for(Entry *walk = list; walk; walk = walk->next) + dMemset(ret, 0, totalLen); + for (Entry *walk = list; walk; walk = walk->next) dStrcpy(ret + walk->start, walk->string); return ret; } @@ -197,7 +202,7 @@ char *CompilerStringTable::build() void CompilerStringTable::write(Stream &st) { st.write(totalLen); - for(Entry *walk = list; walk; walk = walk->next) + for (Entry *walk = list; walk; walk = walk->next) st.write(walk->len, walk->string); } @@ -207,15 +212,15 @@ U32 CompilerFloatTable::add(F64 value) { Entry **walk; U32 i = 0; - for(walk = &list; *walk; walk = &((*walk)->next), i++) - if(value == (*walk)->val) + for (walk = &list; *walk; walk = &((*walk)->next), i++) + if (value == (*walk)->val) return i; - Entry *newFloat = (Entry *) consoleAlloc(sizeof(Entry)); + Entry *newFloat = (Entry *)consoleAlloc(sizeof(Entry)); newFloat->val = value; newFloat->next = NULL; count++; *walk = newFloat; - return count-1; + return count - 1; } void CompilerFloatTable::reset() { @@ -226,7 +231,7 @@ F64 *CompilerFloatTable::build() { F64 *ret = new F64[count]; U32 i = 0; - for(Entry *walk = list; walk; walk = walk->next, i++) + for (Entry *walk = list; walk; walk = walk->next, i++) ret[i] = walk->val; return ret; } @@ -234,7 +239,7 @@ F64 *CompilerFloatTable::build() void CompilerFloatTable::write(Stream &st) { st.write(count); - for(Entry *walk = list; walk; walk = walk->next) + for (Entry *walk = list; walk; walk = walk->next) st.write(walk->val); } @@ -248,12 +253,12 @@ void CompilerIdentTable::reset() void CompilerIdentTable::add(StringTableEntry ste, U32 ip) { U32 index = gGlobalStringTable.add(ste, false); - Entry *newEntry = (Entry *) consoleAlloc(sizeof(Entry)); + Entry *newEntry = (Entry *)consoleAlloc(sizeof(Entry)); newEntry->offset = index; newEntry->ip = ip; - for(Entry *walk = list; walk; walk = walk->next) + for (Entry *walk = list; walk; walk = walk->next) { - if(walk->offset == index) + if (walk->offset == index) { newEntry->nextIdent = walk->nextIdent; walk->nextIdent = newEntry; @@ -269,24 +274,24 @@ void CompilerIdentTable::write(Stream &st) { U32 count = 0; Entry * walk; - for(walk = list; walk; walk = walk->next) + for (walk = list; walk; walk = walk->next) count++; st.write(count); - for(walk = list; walk; walk = walk->next) + for (walk = list; walk; walk = walk->next) { U32 ec = 0; Entry * el; - for(el = walk; el; el = el->nextIdent) + for (el = walk; el; el = el->nextIdent) ec++; st.write(walk->offset); st.write(ec); - for(el = walk; el; el = el->nextIdent) + for (el = walk; el; el = el->nextIdent) st.write(el->ip); } } //------------------------------------------------------------------------- - + U8 *CodeStream::allocCode(U32 sz) { U8 *ptr = NULL; @@ -300,12 +305,12 @@ U8 *CodeStream::allocCode(U32 sz) return ptr; } } - + CodeData *data = new CodeData; data->data = (U8*)dMalloc(BlockSize); data->size = sz; data->next = NULL; - + if (mCodeHead) mCodeHead->next = data; mCodeHead = data; @@ -313,21 +318,21 @@ U8 *CodeStream::allocCode(U32 sz) mCode = data; return data->data; } - + //------------------------------------------------------------------------- - + void CodeStream::fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint) { AssertFatal(mFixStack.size() > 0, "Fix stack mismatch"); - - U32 fixStart = mFixStack[mFixStack.size()-1]; - for (U32 i=fixStart; inext : NULL; while (itr != NULL) @@ -403,7 +408,7 @@ void CodeStream::reset() delete(itr); itr = next; } - + if (mCode) { mCode->size = 0; diff --git a/Engine/source/console/compiler.h b/Engine/source/console/compiler.h index 3f1fb5339..df69d0819 100644 --- a/Engine/source/console/compiler.h +++ b/Engine/source/console/compiler.h @@ -30,6 +30,9 @@ #include #endif +#include +#include + class Stream; class DataChunker; @@ -91,10 +94,15 @@ namespace Compiler OP_DIV, OP_NEG, + OP_INC, + OP_DEC, + OP_SETCURVAR, OP_SETCURVAR_CREATE, OP_SETCURVAR_ARRAY, + OP_SETCURVAR_ARRAY_VARLOOKUP, OP_SETCURVAR_ARRAY_CREATE, + OP_SETCURVAR_ARRAY_CREATE_VARLOOKUP, OP_LOADVAR_UINT,// 40 OP_LOADVAR_FLT, @@ -113,6 +121,8 @@ namespace Compiler OP_SETCURFIELD, OP_SETCURFIELD_ARRAY, // 50 OP_SETCURFIELD_TYPE, + OP_SETCURFIELD_ARRAY_VAR, + OP_SETCURFIELD_THIS, OP_LOADFIELD_UINT, OP_LOADFIELD_FLT, @@ -142,6 +152,8 @@ namespace Compiler OP_CALLFUNC_RESOLVE, OP_CALLFUNC, + OP_CALLFUNC_POINTER, + OP_CALLFUNC_THIS, OP_ADVANCE_STR, OP_ADVANCE_STR_APPENDCHAR, @@ -155,23 +167,26 @@ namespace Compiler OP_PUSH_UINT, // Integer OP_PUSH_FLT, // Float OP_PUSH_VAR, // Variable + OP_PUSH_THIS, // This pointer OP_PUSH_FRAME, // Frame OP_ASSERT, OP_BREAK, - + OP_ITER_BEGIN, ///< Prepare foreach iterator. OP_ITER_BEGIN_STR, ///< Prepare foreach$ iterator. OP_ITER, ///< Enter foreach loop. OP_ITER_END, ///< End foreach loop. - OP_INVALID // 90 + OP_INVALID, // 90 + + MAX_OP_CODELEN ///< The amount of op codes. }; //------------------------------------------------------------ F64 consoleStringToNumber(const char *str, StringTableEntry file = 0, U32 line = 0); - + U32 compileBlock(StmtNode *block, CodeStream &codeStream, U32 ip); //------------------------------------------------------------ @@ -207,6 +222,7 @@ namespace Compiler Entry *list; char buf[256]; + std::unordered_map hashTable; U32 add(const char *str, bool caseSens = true, bool tag = false); U32 addIntString(U32 value); @@ -239,14 +255,14 @@ namespace Compiler inline StringTableEntry CodeToSTE(U32 *code, U32 ip) { #ifdef TORQUE_CPU_X64 - return (StringTableEntry)(*((U64*)(code+ip))); + return (StringTableEntry)(*((U64*)(code + ip))); #else - return (StringTableEntry)(*(code+ip)); + return (StringTableEntry)(*(code + ip)); #endif } - extern void (*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr); - + extern void(*STEtoCode)(StringTableEntry ste, U32 ip, U32 *ptr); + void evalSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr); void compileSTEtoCode(StringTableEntry ste, U32 ip, U32 *ptr); @@ -254,13 +270,13 @@ namespace Compiler CompilerStringTable &getGlobalStringTable(); CompilerStringTable &getFunctionStringTable(); - void setCurrentStringTable (CompilerStringTable* cst); + void setCurrentStringTable(CompilerStringTable* cst); CompilerFloatTable *getCurrentFloatTable(); CompilerFloatTable &getGlobalFloatTable(); CompilerFloatTable &getFunctionFloatTable(); - void setCurrentFloatTable (CompilerFloatTable* cst); + void setCurrentFloatTable(CompilerFloatTable* cst); CompilerIdentTable &getIdentTable(); @@ -280,7 +296,7 @@ namespace Compiler class CodeStream { public: - + enum FixType { // For loops @@ -288,37 +304,37 @@ public: FIXTYPE_BREAK, FIXTYPE_CONTINUE }; - + enum Constants { BlockSize = 16384, }; - + protected: - + typedef struct PatchEntry { U32 addr; ///< Address to patch U32 value; ///< Value to place at addr - - PatchEntry() {;} - PatchEntry(U32 a, U32 v) : addr(a), value(v) {;} + + PatchEntry() { ; } + PatchEntry(U32 a, U32 v) : addr(a), value(v) { ; } } PatchEntry; - + typedef struct CodeData { U8 *data; ///< Allocated data (size is BlockSize) U32 size; ///< Bytes used in data CodeData *next; ///< Next block } CodeData; - + /// @name Emitted code /// { CodeData *mCode; CodeData *mCodeHead; U32 mCodePos; /// } - + /// @name Code fixing stacks /// { Vector mFixList; @@ -326,28 +342,28 @@ protected: Vector mFixLoopStack; Vector mPatchList; /// } - + Vector mBreakLines; ///< Line numbers - + public: CodeStream() : mCode(0), mCodeHead(NULL), mCodePos(0) { } - + ~CodeStream() { reset(); - + if (mCode) { dFree(mCode->data); delete mCode; } } - + U8 *allocCode(U32 sz); - + inline U32 emit(U32 code) { U32 *ptr = (U32*)allocCode(4); @@ -357,7 +373,7 @@ public: #endif return mCodePos++; } - + inline void patch(U32 addr, U32 code) { #ifdef DEBUG_CODESTREAM @@ -365,7 +381,7 @@ public: #endif mPatchList.push_back(PatchEntry(addr, code)); } - + inline U32 emitSTE(const char *code) { U64 *ptr = (U64*)allocCode(8); @@ -375,70 +391,70 @@ public: printf("code[%u] = %s\n", mCodePos, code); #endif mCodePos += 2; - return mCodePos-2; + return mCodePos - 2; } - + inline U32 tell() { return mCodePos; } - + inline bool inLoop() { - for (U32 i=0; i 0, "Fix stack mismatch"); - - U32 newSize = mFixStack[mFixStack.size()-1]; + + U32 newSize = mFixStack[mFixStack.size() - 1]; while (mFixList.size() > newSize) mFixList.pop_back(); mFixStack.pop_back(); mFixLoopStack.pop_back(); } - + void fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint); - + inline void addBreakLine(U32 lineNumber, U32 ip) { mBreakLines.push_back(lineNumber); mBreakLines.push_back(ip); } - + inline U32 getNumLineBreaks() { return mBreakLines.size() / 2; } - + void emitCodeStream(U32 *size, U32 **stream, U32 **lineBreaks); - + void reset(); }; diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 303c19fed..4009a5393 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -24,13 +24,13 @@ #define _CONSOLE_H_ #ifndef _PLATFORM_H_ - #include "platform/platform.h" +#include "platform/platform.h" #endif #ifndef _BITSET_H_ - #include "core/bitSet.h" +#include "core/bitSet.h" #endif #ifndef _REFBASE_H_ - #include "core/util/refBase.h" +#include "core/util/refBase.h" #endif #include @@ -95,8 +95,8 @@ struct ConsoleLogEntry Script, GUI, Network, - GGConnect, - NUM_TYPE + GGConnect, + NUM_TYPE } mType; /// Indicates the actual log entry. @@ -120,7 +120,7 @@ extern char *typeValueEmpty; class ConsoleValue { public: - + enum { TypeInternalInt = -5, @@ -129,17 +129,17 @@ public: TypeInternalStackString = -2, TypeInternalString = -1, }; - + S32 type; - + public: - + // NOTE: This is protected to ensure no one outside // of this structure is messing with it. - + #pragma warning( push ) #pragma warning( disable : 4201 ) // warning C4201: nonstandard extension used : nameless struct/union - + // An variable is either a real dynamic type or // its one exposed from C++ using a data pointer. // @@ -154,24 +154,24 @@ public: F32 fval; U32 bufferLen; }; - + struct { /// The real data pointer. void *dataPtr; - + /// The enum lookup table for enumerated types. const EnumTable *enumTable; }; }; - + U32 getIntValue(); S32 getSignedIntValue(); F32 getFloatValue(); const char *getStringValue(); StringStackPtr getStringStackPtr(); bool getBoolValue(); - + void setIntValue(U32 val); void setIntValue(S32 val); void setFloatValue(F32 val); @@ -179,7 +179,7 @@ public: void setStackStringValue(const char *value); void setStringStackPtrValue(StringStackPtr ptr); void setBoolValue(bool val); - + void init() { ival = 0; @@ -188,7 +188,7 @@ public: bufferLen = 0; type = TypeInternalString; } - + void cleanup() { if ((type <= TypeInternalString) && (bufferLen > 0)) @@ -201,8 +201,8 @@ public: ival = 0; fval = 0; } - ConsoleValue(){ init(); }; - ~ConsoleValue(){ cleanup(); }; + ConsoleValue() { init(); }; + ~ConsoleValue() { cleanup(); }; }; // Proxy class for console variables @@ -234,7 +234,7 @@ public: inline operator S32() { return getSignedIntValue(); } inline operator F32() { return getFloatValue(); } inline operator bool() { return getBoolValue(); } - + inline bool isStringStackPtr() { return value ? value->type == ConsoleValue::TypeInternalStringStackPtr : false; } inline bool isString() { return value ? value->type >= ConsoleValue::TypeInternalStringStackPtr : true; } inline bool isInt() { return value ? value->type == ConsoleValue::TypeInternalInt : false; } @@ -320,12 +320,12 @@ public: /// typedef const char * (*StringCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef S32 (*IntCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef F32 (*FloatCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef void (*VoidCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); // We have it return a value so things don't break.. -typedef bool (*BoolCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); +typedef S32(*IntCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); +typedef F32(*FloatCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); +typedef void(*VoidCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); // We have it return a value so things don't break.. +typedef bool(*BoolCallback)(SimObject *obj, S32 argc, ConsoleValueRef argv[]); -typedef void (*ConsumerCallback)(U32 level, const char *consoleLine); +typedef void(*ConsumerCallback)(U32 level, const char *consoleLine); /// @} /// @defgroup console_types Scripting Engine Type Functions @@ -333,7 +333,7 @@ typedef void (*ConsumerCallback)(U32 level, const char *consoleLine); /// @see Con::registerType /// @{ typedef const char* (*GetDataFunction)(void *dptr, EnumTable *tbl, BitSet32 flag); -typedef void (*SetDataFunction)(void *dptr, S32 argc, const char **argv, EnumTable *tbl, BitSet32 flag); +typedef void(*SetDataFunction)(void *dptr, S32 argc, const char **argv, EnumTable *tbl, BitSet32 flag); /// @} /// This namespace contains the core of the console functionality. @@ -347,7 +347,7 @@ typedef void (*SetDataFunction)(void *dptr, S32 argc, const char **argv, namespace Con { /// Various configuration constants. - enum Constants + enum Constants { /// This is the version number associated with DSO files. /// @@ -361,20 +361,22 @@ namespace Con /// 12/29/04 - BJG - 33->34 Removed some opcodes, part of namespace upgrade. /// 12/30/04 - BJG - 34->35 Reordered some things, further general shuffling. /// 11/03/05 - BJG - 35->36 Integrated new debugger code. - // 09/08/06 - THB - 36->37 New opcode for internal names - // 09/15/06 - THB - 37->38 Added unit conversions - // 11/23/06 - THB - 38->39 Added recursive internal name operator - // 02/15/07 - THB - 39->40 Bumping to 40 for TGB since the console has been - // majorly hacked without the version number being bumped - // 02/16/07 - THB - 40->41 newmsg operator - // 06/15/07 - THB - 41->42 script types + /// 09/08/06 - THB - 36->37 New opcode for internal names + /// 09/15/06 - THB - 37->38 Added unit conversions + /// 11/23/06 - THB - 38->39 Added recursive internal name operator + /// 02/15/07 - THB - 39->40 Bumping to 40 for TGB since the console has been + /// majorly hacked without the version number being bumped + /// 02/16/07 - THB - 40->41 newmsg operator + /// 06/15/07 - THB - 41->42 script types /// 07/31/07 - THB - 42->43 Patch from Andreas Kirsch: Added opcode to support nested new declarations. /// 09/12/07 - CAF - 43->44 remove newmsg operator /// 09/27/07 - RDB - 44->45 Patch from Andreas Kirsch: Added opcode to support correct void return /// 01/13/09 - TMS - 45->46 Added script assert /// 09/07/14 - jamesu - 46->47 64bit support /// 10/14/14 - jamesu - 47->48 Added opcodes to reduce reliance on strings in function calls - DSOVersion = 48, + /// 10/07/17 - JTH - 48->49 Added opcode for function pointers and revamp of interpreter + /// from switch to function calls. + DSOVersion = 49, MaxLineLength = 512, ///< Maximum length of a line of console input. MaxDataTypes = 256 ///< Maximum number of registered data types. @@ -552,11 +554,11 @@ namespace Con /// @param usage Documentation string. /// /// @see ConsoleDynamicTypes - void addVariable( const char *name, - S32 type, - void *pointer, - const char* usage = NULL ); - + void addVariable(const char *name, + S32 type, + void *pointer, + const char* usage = NULL); + /// Add a console constant that references the value of a constant in C++ code. /// /// @param name Global console constant name to create. @@ -565,11 +567,11 @@ namespace Con /// @param usage Documentation string. /// /// @see ConsoleDynamicTypes - void addConstant( const char *name, - S32 type, - const void *pointer, - const char* usage = NULL ); - + void addConstant(const char *name, + S32 type, + const void *pointer, + const char* usage = NULL); + /// Remove a console variable. /// /// @param name Global console variable name to remove @@ -582,14 +584,14 @@ namespace Con /// @param name An existing global console variable name. /// @param callback The notification delegate function. /// - void addVariableNotify( const char *name, const NotifyDelegate &callback ); + void addVariableNotify(const char *name, const NotifyDelegate &callback); /// Remove an existing variable assignment notification callback. /// /// @param name An existing global console variable name. /// @param callback The notification delegate function. /// - void removeVariableNotify( const char *name, const NotifyDelegate &callback ); + void removeVariableNotify(const char *name, const NotifyDelegate &callback); /// Assign a string value to a locally scoped console variable /// @@ -628,31 +630,31 @@ namespace Con const char* getObjectField(const char* name); /// Same as setVariable(), but for bools. - void setBoolVariable (const char* name,bool var); + void setBoolVariable(const char* name, bool var); /// Same as getVariable(), but for bools. /// /// @param name Name of the variable. /// @param def Default value to supply if no matching variable is found. - bool getBoolVariable (const char* name,bool def = false); + bool getBoolVariable(const char* name, bool def = false); /// Same as setVariable(), but for ints. - void setIntVariable (const char* name,S32 var); + void setIntVariable(const char* name, S32 var); /// Same as getVariable(), but for ints. /// /// @param name Name of the variable. /// @param def Default value to supply if no matching variable is found. - S32 getIntVariable (const char* name,S32 def = 0); + S32 getIntVariable(const char* name, S32 def = 0); /// Same as setVariable(), but for floats. - void setFloatVariable(const char* name,F32 var); + void setFloatVariable(const char* name, F32 var); /// Same as getVariable(), but for floats. /// /// @param name Name of the variable. /// @param def Default value to supply if no matching variable is found. - F32 getFloatVariable(const char* name,F32 def = .0f); + F32 getFloatVariable(const char* name, F32 def = .0f); /// @} @@ -668,52 +670,52 @@ namespace Con /// @param maxArgs Maximum number of arguments this function accepts /// @param toolOnly Wether this is a TORQUE_TOOLS only function. /// @param header The extended function header. - void addCommand( const char* name, StringCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + void addCommand(const char* name, StringCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); - void addCommand( const char* name, IntCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand( const char* name, FloatCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand( const char* name, VoidCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand( const char* name, BoolCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - - /// @} + void addCommand(const char* name, IntCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char* name, FloatCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char* name, VoidCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char* name, BoolCallback cb, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - /// @name Namespace Function Registration - /// @{ + /// @} - /// Register a C++ function with the console making it callable - /// as a method of the given namespace from the scripting engine. - /// - /// @param nameSpace Name of the namespace to associate the new function with; this is usually the name of a class. - /// @param name Name of the new function. - /// @param cb Pointer to the function implementing the scripting call; a console callback function returning a specific type value. - /// @param usage Documentation for this function. @ref console_autodoc - /// @param minArgs Minimum number of arguments this function accepts - /// @param maxArgs Maximum number of arguments this function accepts - /// @param toolOnly Wether this is a TORQUE_TOOLS only function. - /// @param header The extended function header. - void addCommand(const char *nameSpace, const char *name,StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + /// @name Namespace Function Registration + /// @{ - void addCommand(const char *nameSpace, const char *name,IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand(const char *nameSpace, const char *name,FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand(const char *nameSpace, const char *name,VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - void addCommand(const char *nameSpace, const char *name,BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + /// Register a C++ function with the console making it callable + /// as a method of the given namespace from the scripting engine. + /// + /// @param nameSpace Name of the namespace to associate the new function with; this is usually the name of a class. + /// @param name Name of the new function. + /// @param cb Pointer to the function implementing the scripting call; a console callback function returning a specific type value. + /// @param usage Documentation for this function. @ref console_autodoc + /// @param minArgs Minimum number of arguments this function accepts + /// @param maxArgs Maximum number of arguments this function accepts + /// @param toolOnly Wether this is a TORQUE_TOOLS only function. + /// @param header The extended function header. + void addCommand(const char *nameSpace, const char *name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); - /// @} + void addCommand(const char *nameSpace, const char *name, IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char *nameSpace, const char *name, FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char *nameSpace, const char *name, VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) + void addCommand(const char *nameSpace, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); ///< @copydoc addCommand( const char*, const char *, StringCallback, const char *, S32, S32, bool, ConsoleFunctionHeader* ) - /// @name Special Purpose Registration - /// - /// These are special-purpose functions that exist to allow commands to be grouped, so - /// that when we generate console docs, they can be more meaningfully presented. - /// - /// @ref console_autodoc "Click here for more information about console docs and grouping." - /// - /// @{ + /// @} - void markCommandGroup (const char * nsName, const char *name, const char* usage=NULL); + /// @name Special Purpose Registration + /// + /// These are special-purpose functions that exist to allow commands to be grouped, so + /// that when we generate console docs, they can be more meaningfully presented. + /// + /// @ref console_autodoc "Click here for more information about console docs and grouping." + /// + /// @{ + + void markCommandGroup(const char * nsName, const char *name, const char* usage = NULL); void beginCommandGroup(const char * nsName, const char *name, const char* usage); - void endCommandGroup (const char * nsName, const char *name); + void endCommandGroup(const char * nsName, const char *name); - void noteScriptCallback( const char *className, const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL ); + void noteScriptCallback(const char *className, const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL); /// @} @@ -841,15 +843,15 @@ namespace Con /// char* getReturnBuffer(U32 bufferSize); char* getReturnBuffer(const char *stringToCopy); - char* getReturnBuffer( const String& str ); - char* getReturnBuffer( const StringBuilder& str ); + char* getReturnBuffer(const String& str); + char* getReturnBuffer(const StringBuilder& str); char* getArgBuffer(U32 bufferSize); char* getFloatArg(F64 arg); - char* getIntArg (S32 arg); + char* getIntArg(S32 arg); char* getBoolArg(bool arg); - char* getStringArg( const char* arg ); - char* getStringArg( const String& arg ); + char* getStringArg(const char* arg); + char* getStringArg(const String& arg); /// @} /// @name Namespaces @@ -877,7 +879,7 @@ namespace Con /// @name Instant Group /// @{ - void pushInstantGroup( String name = String() ); + void pushInstantGroup(String name = String()); void popInstantGroup(); /// @} @@ -915,7 +917,7 @@ namespace Con template ConsoleValueRef executef(R r, ArgTs ...argTs) { - _EngineConsoleExecCallbackHelper callback( r ); + _EngineConsoleExecCallbackHelper callback(r); return callback.template call(argTs...); } /// } @@ -931,25 +933,25 @@ struct ConsoleFunctionHeader { /// Return type string. const char* mReturnString; - + /// List of arguments taken by the function. Used for documentation. const char* mArgString; - + /// List of default argument values. Used for documentation. const char* mDefaultArgString; - + /// Whether this is a static method in a class. bool mIsStatic; - + ConsoleFunctionHeader( const char* returnString, const char* argString, const char* defaultArgString, - bool isStatic = false ) - : mReturnString( returnString ), - mArgString( argString ), - mDefaultArgString( defaultArgString ), - mIsStatic( isStatic ) {} + bool isStatic = false) + : mReturnString(returnString), + mArgString(argString), + mDefaultArgString(defaultArgString), + mIsStatic(isStatic) {} }; @@ -969,7 +971,7 @@ public: /// /// @ref console_autodoc /// @{ - + StringCallback sc; ///< A function/method that returns a string. IntCallback ic; ///< A function/method that returns an int. FloatCallback fc; ///< A function/method that returns a float. @@ -979,18 +981,18 @@ public: bool ns; ///< Indicates that this is a namespace marker. /// @deprecated Unused. bool callback; ///< Is this a callback into script? - - /// @} - /// Minimum number of arguments expected by the function. + /// @} + + /// Minimum number of arguments expected by the function. S32 mina; - + /// Maximum number of arguments accepted by the funtion. Zero for varargs. S32 maxa; - + /// Name of the function/method. const char* funcName; - + /// Name of the class namespace to which to add the method. const char* className; @@ -999,10 +1001,10 @@ public: /// Whether this is a TORQUE_TOOLS only function. bool toolOnly; - + /// The extended function header. ConsoleFunctionHeader* header; - + /// @name ConsoleConstructor Innards /// /// The ConsoleConstructor class is used as the backend for the ConsoleFunction() and @@ -1067,7 +1069,7 @@ public: ConsoleConstructor *next; static ConsoleConstructor *first; - void init( const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); static void setup(); @@ -1079,12 +1081,12 @@ public: /// @name Basic Console Constructors /// @{ - ConsoleConstructor( const char* className, const char* funcName, StringCallback sfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, IntCallback ifunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, FloatCallback ffunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, VoidCallback vfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - ConsoleConstructor( const char* className, const char* funcName, BoolCallback bfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - + ConsoleConstructor(const char* className, const char* funcName, StringCallback sfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, IntCallback ifunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, FloatCallback ffunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, VoidCallback vfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + ConsoleConstructor(const char* className, const char* funcName, BoolCallback bfunc, const char* usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + /// @} /// @name Magic Console Constructors @@ -1097,10 +1099,10 @@ public: /// /// @see Con::markCommandGroup /// @ref console_autodoc - ConsoleConstructor( const char *className, const char *groupName, const char* usage ); + ConsoleConstructor(const char *className, const char *groupName, const char* usage); /// Indicates a callback declared with the DECLARE_SCRIPT_CALLBACK macro and friends. - ConsoleConstructor( const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header ); + ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header); /// @} }; @@ -1112,25 +1114,25 @@ struct ConsoleDocFragment /// The class in which to put the fragment. If NULL, the fragment /// will be placed globally. const char* mClass; - + /// The definition to output for this fragment. NULL for fragments /// not associated with a definition. const char* mDefinition; - + /// The documentation text. const char* mText; - + /// Next fragment in the global link chain. ConsoleDocFragment* mNext; - + /// First fragment in the global link chain. static ConsoleDocFragment* smFirst; - - ConsoleDocFragment( const char* text, const char* inClass = NULL, const char* definition = NULL ) - : mClass( inClass ), - mDefinition( definition ), - mText( text ), - mNext( smFirst ) + + ConsoleDocFragment(const char* text, const char* inClass = NULL, const char* definition = NULL) + : mClass(inClass), + mDefinition(definition), + mText(text), + mNext(smFirst) { smFirst = this; } @@ -1229,7 +1231,7 @@ public: # define ConsoleMethodGroupEnd(className, groupName) \ static ConsoleConstructor cc_##className##_##groupName##_GroupEnd(#className,#groupName,NULL) - + /// Add a fragment of auto-doc text to the console API reference. /// @note There can only be one ConsoleDoc per source file. # define ConsoleDoc( text ) \ diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index c9016e8dc..1d1477325 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -20,6 +20,8 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- +#include + #include "platform/platform.h" #include "console/console.h" @@ -43,28 +45,42 @@ DataChunker Namespace::mAllocator; Namespace *Namespace::mNamespaceList = NULL; Namespace *Namespace::mGlobalNamespace = NULL; +namespace std +{ + template<> struct hash> + { + typedef std::pair argument_type; + typedef size_t result_type; + result_type operator()(argument_type const& s) const + { + return HashPointer(s.first) ^ (HashPointer(s.second) << 1); + } + }; +}; + +std::unordered_map, Namespace*> gNamespaceCache; bool canTabComplete(const char *prevText, const char *bestMatch, - const char *newText, S32 baseLen, bool fForward) + const char *newText, S32 baseLen, bool fForward) { // test if it matches the first baseLen chars: - if(dStrnicmp(newText, prevText, baseLen)) + if (dStrnicmp(newText, prevText, baseLen)) return false; if (fForward) { - if(!bestMatch) + if (!bestMatch) return dStricmp(newText, prevText) > 0; else return (dStricmp(newText, prevText) > 0) && - (dStricmp(newText, bestMatch) < 0); + (dStricmp(newText, bestMatch) < 0); } else { - if (dStrlen(prevText) == (U32) baseLen) + if (dStrlen(prevText) == (U32)baseLen) { // look for the 'worst match' - if(!bestMatch) + if (!bestMatch) return dStricmp(newText, prevText) > 0; else return dStricmp(newText, bestMatch) > 0; @@ -75,7 +91,7 @@ bool canTabComplete(const char *prevText, const char *bestMatch, return (dStricmp(newText, prevText) < 0); else return (dStricmp(newText, prevText) < 0) && - (dStricmp(newText, bestMatch) > 0); + (dStricmp(newText, bestMatch) > 0); } } } @@ -100,7 +116,7 @@ struct StringValue StringValue & StringValue::operator=(const char *string) { - if(!val) + if (!val) { val = dStrdup(string); size = dStrlen(val); @@ -108,7 +124,7 @@ StringValue & StringValue::operator=(const char *string) else { S32 len = dStrlen(string); - if(len < size) + if (len < size) dStrcpy(val, string); else { @@ -120,9 +136,9 @@ StringValue & StringValue::operator=(const char *string) return *this; } -static S32 QSORT_CALLBACK varCompare(const void* a,const void* b) +static S32 QSORT_CALLBACK varCompare(const void* a, const void* b) { - return dStricmp( (*((Dictionary::Entry **) a))->name, (*((Dictionary::Entry **) b))->name ); + return dStricmp((*((Dictionary::Entry **) a))->name, (*((Dictionary::Entry **) b))->name); } void Dictionary::exportVariables(const char *varString, const char *fileName, bool append) @@ -130,44 +146,44 @@ void Dictionary::exportVariables(const char *varString, const char *fileName, bo const char *searchStr = varString; Vector sortList(__FILE__, __LINE__); - for(S32 i = 0; i < hashTable->size;i ++) + for (S32 i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while(walk) + while (walk) { - if(FindMatch::isMatch((char *) searchStr, (char *) walk->name)) + if (FindMatch::isMatch((char *)searchStr, (char *)walk->name)) sortList.push_back(walk); walk = walk->nextEntry; } } - if(!sortList.size()) + if (!sortList.size()) return; - dQsort((void *) &sortList[0], sortList.size(), sizeof(Entry *), varCompare); + dQsort((void *)&sortList[0], sortList.size(), sizeof(Entry *), varCompare); Vector::iterator s; char expandBuffer[1024]; FileStream *strm = NULL; - if(fileName) + if (fileName) { - if((strm = FileStream::createAndOpen( fileName, append ? Torque::FS::File::ReadWrite : Torque::FS::File::Write )) == NULL) + if ((strm = FileStream::createAndOpen(fileName, append ? Torque::FS::File::ReadWrite : Torque::FS::File::Write)) == NULL) { Con::errorf(ConsoleLogEntry::General, "Unable to open file '%s for writing.", fileName); return; } - if(append) + if (append) strm->setPosition(strm->getStreamSize()); } char buffer[1024]; const char *cat = fileName ? "\r\n" : ""; - for(s = sortList.begin(); s != sortList.end(); s++) + for (s = sortList.begin(); s != sortList.end(); s++) { - switch((*s)->value.type) + switch ((*s)->value.type) { case ConsoleValue::TypeInternalInt: dSprintf(buffer, sizeof(buffer), "%s = %d;%s", (*s)->name, (*s)->value.ival, cat); @@ -180,65 +196,65 @@ void Dictionary::exportVariables(const char *varString, const char *fileName, bo dSprintf(buffer, sizeof(buffer), "%s = \"%s\";%s", (*s)->name, expandBuffer, cat); break; } - if(strm) + if (strm) strm->write(dStrlen(buffer), buffer); else Con::printf("%s", buffer); } - if(strm) + if (strm) delete strm; } -void Dictionary::exportVariables( const char *varString, Vector *names, Vector *values ) +void Dictionary::exportVariables(const char *varString, Vector *names, Vector *values) { const char *searchStr = varString; Vector sortList(__FILE__, __LINE__); - for ( S32 i = 0; i < hashTable->size; i++ ) + for (S32 i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while ( walk ) + while (walk) { - if ( FindMatch::isMatch( (char*)searchStr, (char*)walk->name ) ) - sortList.push_back( walk ); + if (FindMatch::isMatch((char*)searchStr, (char*)walk->name)) + sortList.push_back(walk); walk = walk->nextEntry; } } - if ( !sortList.size() ) + if (!sortList.size()) return; - dQsort((void *) &sortList[0], sortList.size(), sizeof(Entry *), varCompare); + dQsort((void *)&sortList[0], sortList.size(), sizeof(Entry *), varCompare); - if ( names ) - names->reserve( sortList.size() ); - if ( values ) - values->reserve( sortList.size() ); + if (names) + names->reserve(sortList.size()); + if (values) + values->reserve(sortList.size()); char expandBuffer[1024]; Vector::iterator s; - for ( s = sortList.begin(); s != sortList.end(); s++ ) + for (s = sortList.begin(); s != sortList.end(); s++) { - if ( names ) - names->push_back( String( (*s)->name ) ); + if (names) + names->push_back(String((*s)->name)); - if ( values ) + if (values) { - switch ( (*s)->value.type ) + switch ((*s)->value.type) { - case ConsoleValue::TypeInternalInt: - values->push_back( String::ToString( (*s)->value.ival ) ); - break; - case ConsoleValue::TypeInternalFloat: - values->push_back( String::ToString( (*s)->value.fval ) ); - break; - default: - expandEscape( expandBuffer, (*s)->getStringValue() ); - values->push_back( expandBuffer ); - break; + case ConsoleValue::TypeInternalInt: + values->push_back(String::ToString((*s)->value.ival)); + break; + case ConsoleValue::TypeInternalFloat: + values->push_back(String::ToString((*s)->value.fval)); + break; + default: + expandEscape(expandBuffer, (*s)->getStringValue()); + values->push_back(expandBuffer); + break; } } } @@ -248,12 +264,12 @@ void Dictionary::deleteVariables(const char *varString) { const char *searchStr = varString; - for(S32 i = 0; i < hashTable->size; i++) + for (S32 i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while(walk) + while (walk) { - Entry *matchedEntry = (FindMatch::isMatch((char *) searchStr, (char *) walk->name)) ? walk : NULL; + Entry *matchedEntry = (FindMatch::isMatch((char *)searchStr, (char *)walk->name)) ? walk : NULL; walk = walk->nextEntry; if (matchedEntry) remove(matchedEntry); // assumes remove() is a stable remove (will not reorder entries on remove) @@ -269,9 +285,9 @@ U32 HashPointer(StringTableEntry ptr) Dictionary::Entry *Dictionary::lookup(StringTableEntry name) { Entry *walk = hashTable->data[HashPointer(name) % hashTable->size]; - while(walk) + while (walk) { - if(walk->name == name) + if (walk->name == name) return walk; else walk = walk->nextEntry; @@ -284,56 +300,56 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name) { // Try to find an existing match. //printf("Add Variable %s\n", name); - - Entry* ret = lookup( name ); - if( ret ) + + Entry* ret = lookup(name); + if (ret) return ret; - + // Rehash if the table get's too crowded. Be aware that this might // modify a table that we don't own. - hashTable->count ++; - if( hashTable->count > hashTable->size * 2 ) + hashTable->count++; + if (hashTable->count > hashTable->size * 2) { // Allocate a new table. - + const U32 newTableSize = hashTable->size * 4 - 1; - Entry** newTableData = new Entry*[ newTableSize ]; - dMemset( newTableData, 0, newTableSize * sizeof( Entry* ) ); - + Entry** newTableData = new Entry*[newTableSize]; + dMemset(newTableData, 0, newTableSize * sizeof(Entry*)); + // Move the entries over. - - for( U32 i = 0; i < hashTable->size; ++ i ) - for( Entry* entry = hashTable->data[ i ]; entry != NULL; ) + + for (U32 i = 0; i < hashTable->size; ++i) + for (Entry* entry = hashTable->data[i]; entry != NULL; ) { Entry* next = entry->nextEntry; - U32 index = HashPointer( entry->name ) % newTableSize; - - entry->nextEntry = newTableData[ index ]; - newTableData[ index ] = entry; - + U32 index = HashPointer(entry->name) % newTableSize; + + entry->nextEntry = newTableData[index]; + newTableData[index] = entry; + entry = next; } - + // Switch the tables. - + delete[] hashTable->data; hashTable->data = newTableData; hashTable->size = newTableSize; } - - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Adding entry '%s'", name ); - #endif - + +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Adding entry '%s'", name); +#endif + // Add the new entry. ret = hashTable->mChunker.alloc(); - constructInPlace( ret, name ); + constructInPlace(ret, name); U32 idx = HashPointer(name) % hashTable->size; ret->nextEntry = hashTable->data[idx]; hashTable->data[idx] = ret; - + return ret; } @@ -341,88 +357,88 @@ Dictionary::Entry *Dictionary::add(StringTableEntry name) void Dictionary::remove(Dictionary::Entry *ent) { Entry **walk = &hashTable->data[HashPointer(ent->name) % hashTable->size]; - while(*walk != ent) + while (*walk != ent) walk = &((*walk)->nextEntry); - - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Removing entry '%s'", ent->name ); - #endif + +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Removing entry '%s'", ent->name); +#endif *walk = (ent->nextEntry); - destructInPlace( ent ); - hashTable->mChunker.free( ent ); + destructInPlace(ent); + hashTable->mChunker.free(ent); hashTable->count--; } Dictionary::Dictionary() - : hashTable( NULL ), + : hashTable(NULL), #pragma warning( disable : 4355 ) - ownHashTable( this ), // Warning with VC++ but this is safe. + ownHashTable(this), // Warning with VC++ but this is safe. #pragma warning( default : 4355 ) - exprState( NULL ), - scopeName( NULL ), - scopeNamespace( NULL ), - code( NULL ), - ip( 0 ) + exprState(NULL), + scopeName(NULL), + scopeNamespace(NULL), + code(NULL), + ip(0) { } void Dictionary::setState(ExprEvalState *state, Dictionary* ref) { exprState = state; - - if( ref ) + + if (ref) { hashTable = ref->hashTable; return; } - if( !ownHashTable.data ) + if (!ownHashTable.data) { ownHashTable.count = 0; ownHashTable.size = ST_INIT_SIZE; - ownHashTable.data = new Entry *[ ownHashTable.size ]; - - dMemset( ownHashTable.data, 0, ownHashTable.size * sizeof( Entry* ) ); + ownHashTable.data = new Entry *[ownHashTable.size]; + + dMemset(ownHashTable.data, 0, ownHashTable.size * sizeof(Entry*)); } - + hashTable = &ownHashTable; } Dictionary::~Dictionary() { reset(); - if( ownHashTable.data ) - delete [] ownHashTable.data; + if (ownHashTable.data) + delete[] ownHashTable.data; } void Dictionary::reset() { - if( hashTable && hashTable->owner != this ) + if (hashTable && hashTable->owner != this) { hashTable = NULL; return; } - - for( U32 i = 0; i < ownHashTable.size; ++ i ) + + for (U32 i = 0; i < ownHashTable.size; ++i) { Entry* walk = ownHashTable.data[i]; - while( walk ) + while (walk) { Entry* temp = walk->nextEntry; - destructInPlace( walk ); + destructInPlace(walk); walk = temp; } } - dMemset( ownHashTable.data, 0, ownHashTable.size * sizeof( Entry* ) ); - ownHashTable.mChunker.freeBlocks( true ); - + dMemset(ownHashTable.data, 0, ownHashTable.size * sizeof(Entry*)); + ownHashTable.mChunker.freeBlocks(true); + ownHashTable.count = 0; hashTable = NULL; - + scopeName = NULL; scopeNamespace = NULL; code = NULL; @@ -435,12 +451,12 @@ const char *Dictionary::tabComplete(const char *prevText, S32 baseLen, bool fFor S32 i; const char *bestMatch = NULL; - for(i = 0; i < hashTable->size; i++) + for (i = 0; i < hashTable->size; i++) { Entry *walk = hashTable->data[i]; - while(walk) + while (walk) { - if(canTabComplete(prevText, bestMatch, walk->name, baseLen, fForward)) + if (canTabComplete(prevText, bestMatch, walk->name, baseLen, fForward)) bestMatch = walk->name; walk = walk->nextEntry; } @@ -469,24 +485,24 @@ Dictionary::Entry::~Entry() { value.cleanup(); - if ( notify ) + if (notify) delete notify; } const char *Dictionary::getVariable(StringTableEntry name, bool *entValid) { Entry *ent = lookup(name); - if(ent) + if (ent) { - if(entValid) + if (entValid) *entValid = true; return ent->getStringValue(); } - if(entValid) + if (entValid) *entValid = false; // Warn users when they access a variable that isn't defined. - if(gWarnUndefinedScriptVariables) + if (gWarnUndefinedScriptVariables) Con::warnf(" *** Accessed undefined variable '%s'", name); return ""; @@ -496,20 +512,20 @@ void ConsoleValue::setStringValue(const char * value) { if (value == NULL) value = typeValueEmpty; - if(type <= ConsoleValue::TypeInternalString) + if (type <= ConsoleValue::TypeInternalString) { // Let's not remove empty-string-valued global vars from the dict. // If we remove them, then they won't be exported, and sometimes // it could be necessary to export such a global. There are very // few empty-string global vars so there's no performance-related // need to remove them from the dict. -/* + /* if(!value[0] && name[0] == '$') { - gEvalState.globalVars.remove(this); - return; + gEvalState.globalVars.remove(this); + return; } -*/ + */ if (value == typeValueEmpty) { if (bufferLen > 0) @@ -531,7 +547,7 @@ void ConsoleValue::setStringValue(const char * value) // // (This decision may come back to haunt you. Shame on you if it // does.) - if(stringLen < 256) + if (stringLen < 256) { fval = dAtof(value); ival = dAtoi(value); @@ -544,11 +560,11 @@ void ConsoleValue::setStringValue(const char * value) // may as well pad to the next cache line U32 newLen = ((stringLen + 1) + 15) & ~15; - - if(bufferLen == 0) - sval = (char *) dMalloc(newLen); - else if(newLen > bufferLen) - sval = (char *) dRealloc(sval, newLen); + + if (bufferLen == 0) + sval = (char *)dMalloc(newLen); + else if (newLen > bufferLen) + sval = (char *)dRealloc(sval, newLen); type = TypeInternalString; @@ -556,7 +572,7 @@ void ConsoleValue::setStringValue(const char * value) dStrcpy(sval, value); } else - Con::setData(type, dataPtr, 0, 1, &value, enumTable); + Con::setData(type, dataPtr, 0, 1, &value, enumTable); } @@ -564,7 +580,7 @@ void ConsoleValue::setStackStringValue(const char *value) { if (value == NULL) value = typeValueEmpty; - if(type <= ConsoleValue::TypeInternalString) + if (type <= ConsoleValue::TypeInternalString) { // sval might still be temporarily present so we need to check and free it if (bufferLen > 0) @@ -583,7 +599,7 @@ void ConsoleValue::setStackStringValue(const char *value) } U32 stringLen = dStrlen(value); - if(stringLen < 256) + if (stringLen < 256) { fval = dAtof(value); ival = dAtoi(value); @@ -599,12 +615,12 @@ void ConsoleValue::setStackStringValue(const char *value) bufferLen = 0; } else - Con::setData(type, dataPtr, 0, 1, &value, enumTable); + Con::setData(type, dataPtr, 0, 1, &value, enumTable); } void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) { - if(type <= ConsoleValue::TypeInternalString) + if (type <= ConsoleValue::TypeInternalString) { const char *value = StringStackPtrRef(ptrValue).getPtr(&STR); if (bufferLen > 0) @@ -614,7 +630,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) } U32 stringLen = dStrlen(value); - if(stringLen < 256) + if (stringLen < 256) { fval = dAtof(value); ival = dAtoi(value); @@ -632,37 +648,37 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) else { const char *value = StringStackPtrRef(ptrValue).getPtr(&STR); - Con::setData(type, dataPtr, 0, 1, &value, enumTable); + Con::setData(type, dataPtr, 0, 1, &value, enumTable); } } S32 Dictionary::getIntVariable(StringTableEntry name, bool *entValid) { Entry *ent = lookup(name); - if(ent) + if (ent) { - if(entValid) + if (entValid) *entValid = true; return ent->getIntValue(); } - if(entValid) + if (entValid) *entValid = false; - return 0; + return 0; } F32 Dictionary::getFloatVariable(StringTableEntry name, bool *entValid) { Entry *ent = lookup(name); - if(ent) + if (ent) { - if(entValid) + if (entValid) *entValid = true; return ent->getFloatValue(); } - if(entValid) + if (entValid) *entValid = false; return 0; @@ -671,19 +687,19 @@ F32 Dictionary::getFloatVariable(StringTableEntry name, bool *entValid) void Dictionary::setVariable(StringTableEntry name, const char *value) { Entry *ent = add(name); - if(!value) + if (!value) value = ""; ent->setStringValue(value); } -Dictionary::Entry* Dictionary::addVariable( const char *name, - S32 type, - void *dataPtr, - const char* usage ) +Dictionary::Entry* Dictionary::addVariable(const char *name, + S32 type, + void *dataPtr, + const char* usage) { - AssertFatal( type >= 0, "Dictionary::addVariable - Got bad type!" ); + AssertFatal(type >= 0, "Dictionary::addVariable - Got bad type!"); - if(name[0] != '$') + if (name[0] != '$') { scratchBuffer[0] = '$'; dStrcpy(scratchBuffer + 1, name); @@ -691,142 +707,142 @@ Dictionary::Entry* Dictionary::addVariable( const char *name, } Entry *ent = add(StringTable->insert(name)); - - if ( ent->value.type <= ConsoleValue::TypeInternalString && - ent->value.bufferLen > 0 ) + + if (ent->value.type <= ConsoleValue::TypeInternalString && + ent->value.bufferLen > 0) dFree(ent->value.sval); ent->value.type = type; ent->value.dataPtr = dataPtr; ent->mUsage = usage; - + // Fetch enum table, if any. - - ConsoleBaseType* conType = ConsoleBaseType::getType( type ); - AssertFatal( conType, "Dictionary::addVariable - invalid console type" ); + + ConsoleBaseType* conType = ConsoleBaseType::getType(type); + AssertFatal(conType, "Dictionary::addVariable - invalid console type"); ent->value.enumTable = conType->getEnumTable(); - + return ent; } bool Dictionary::removeVariable(StringTableEntry name) { - if( Entry *ent = lookup(name) ) + if (Entry *ent = lookup(name)) { - remove( ent ); + remove(ent); return true; } return false; } -void Dictionary::addVariableNotify( const char *name, const Con::NotifyDelegate &callback ) +void Dictionary::addVariableNotify(const char *name, const Con::NotifyDelegate &callback) { Entry *ent = lookup(StringTable->insert(name)); - if ( !ent ) - return; + if (!ent) + return; - if ( !ent->notify ) + if (!ent->notify) ent->notify = new Entry::NotifySignal(); - ent->notify->notify( callback ); + ent->notify->notify(callback); } -void Dictionary::removeVariableNotify( const char *name, const Con::NotifyDelegate &callback ) +void Dictionary::removeVariableNotify(const char *name, const Con::NotifyDelegate &callback) { Entry *ent = lookup(StringTable->insert(name)); - if ( ent && ent->notify ) - ent->notify->remove( callback ); + if (ent && ent->notify) + ent->notify->remove(callback); } void Dictionary::validate() { - AssertFatal( ownHashTable.owner == this, - "Dictionary::validate() - Dictionary not owner of own hashtable!" ); + AssertFatal(ownHashTable.owner == this, + "Dictionary::validate() - Dictionary not owner of own hashtable!"); } void ExprEvalState::pushFrame(StringTableEntry frameName, Namespace *ns) -{ - #ifdef DEBUG_SPEW +{ +#ifdef DEBUG_SPEW validate(); - Platform::outputDebugString( "[ConsoleInternal] Pushing new frame for '%s' at %i", - frameName, mStackDepth ); - #endif - - if( mStackDepth + 1 > stack.size() ) + Platform::outputDebugString("[ConsoleInternal] Pushing new frame for '%s' at %i", + frameName, mStackDepth); +#endif + + if (mStackDepth + 1 > stack.size()) { - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Growing stack by one frame" ); - #endif - - stack.push_back( new Dictionary ); +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Growing stack by one frame"); +#endif + + stack.push_back(new Dictionary); } - - Dictionary& newFrame = *( stack[ mStackDepth ] ); - newFrame.setState( this ); - + + Dictionary& newFrame = *(stack[mStackDepth]); + newFrame.setState(this); + newFrame.scopeName = frameName; newFrame.scopeNamespace = ns; - mStackDepth ++; + mStackDepth++; currentVariable = NULL; - - AssertFatal( !newFrame.getCount(), "ExprEvalState::pushFrame - Dictionary not empty!" ); - - #ifdef DEBUG_SPEW + + AssertFatal(!newFrame.getCount(), "ExprEvalState::pushFrame - Dictionary not empty!"); + +#ifdef DEBUG_SPEW validate(); - #endif +#endif } void ExprEvalState::popFrame() { - AssertFatal( mStackDepth > 0, "ExprEvalState::popFrame - Stack Underflow!" ); - - #ifdef DEBUG_SPEW - validate(); - - Platform::outputDebugString( "[ConsoleInternal] Popping %sframe at %i", - getCurrentFrame().isOwner() ? "" : "shared ", mStackDepth - 1 ); - #endif + AssertFatal(mStackDepth > 0, "ExprEvalState::popFrame - Stack Underflow!"); - mStackDepth --; - stack[ mStackDepth ]->reset(); +#ifdef DEBUG_SPEW + validate(); + + Platform::outputDebugString("[ConsoleInternal] Popping %sframe at %i", + getCurrentFrame().isOwner() ? "" : "shared ", mStackDepth - 1); +#endif + + mStackDepth--; + stack[mStackDepth]->reset(); currentVariable = NULL; - #ifdef DEBUG_SPEW +#ifdef DEBUG_SPEW validate(); - #endif +#endif } void ExprEvalState::pushFrameRef(S32 stackIndex) { - AssertFatal( stackIndex >= 0 && stackIndex < stack.size(), "You must be asking for a valid frame!" ); + AssertFatal(stackIndex >= 0 && stackIndex < stack.size(), "You must be asking for a valid frame!"); - #ifdef DEBUG_SPEW +#ifdef DEBUG_SPEW validate(); - - Platform::outputDebugString( "[ConsoleInternal] Cloning frame from %i to %i", - stackIndex, mStackDepth ); - #endif - if( mStackDepth + 1 > stack.size() ) + Platform::outputDebugString("[ConsoleInternal] Cloning frame from %i to %i", + stackIndex, mStackDepth); +#endif + + if (mStackDepth + 1 > stack.size()) { - #ifdef DEBUG_SPEW - Platform::outputDebugString( "[ConsoleInternal] Growing stack by one frame" ); - #endif - - stack.push_back( new Dictionary ); +#ifdef DEBUG_SPEW + Platform::outputDebugString("[ConsoleInternal] Growing stack by one frame"); +#endif + + stack.push_back(new Dictionary); } - Dictionary& newFrame = *( stack[ mStackDepth ] ); - newFrame.setState( this, stack[ stackIndex ] ); - - mStackDepth ++; + Dictionary& newFrame = *(stack[mStackDepth]); + newFrame.setState(this, stack[stackIndex]); + + mStackDepth++; currentVariable = NULL; - - #ifdef DEBUG_SPEW + +#ifdef DEBUG_SPEW validate(); - #endif +#endif } ExprEvalState::ExprEvalState() @@ -837,7 +853,7 @@ ExprEvalState::ExprEvalState() traceOn = false; currentVariable = NULL; mStackDepth = 0; - stack.reserve( 64 ); + stack.reserve(64); mShouldReset = false; mResetLocked = false; } @@ -845,8 +861,8 @@ ExprEvalState::ExprEvalState() ExprEvalState::~ExprEvalState() { // Delete callframes. - - while( !stack.empty() ) + + while (!stack.empty()) { delete stack.last(); stack.decrement(); @@ -855,14 +871,14 @@ ExprEvalState::~ExprEvalState() void ExprEvalState::validate() { - AssertFatal( mStackDepth <= stack.size(), - "ExprEvalState::validate() - Stack depth pointing beyond last stack frame!" ); - - for( U32 i = 0; i < stack.size(); ++ i ) - stack[ i ]->validate(); + AssertFatal(mStackDepth <= stack.size(), + "ExprEvalState::validate() - Stack depth pointing beyond last stack frame!"); + + for (U32 i = 0; i < stack.size(); ++i) + stack[i]->validate(); } -DefineEngineFunction(backtrace, void, ( ),, +DefineEngineFunction(backtrace, void, (), , "@brief Prints the scripting call stack to the console log.\n\n" "Used to trace functions called from within functions. Can help discover what functions were called " "(and not yet exited) before the current point in scripts.\n\n" @@ -870,34 +886,34 @@ DefineEngineFunction(backtrace, void, ( ),, { U32 totalSize = 1; - for(U32 i = 0; i < gEvalState.getStackDepth(); i++) + for (U32 i = 0; i < gEvalState.getStackDepth(); i++) { - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) - totalSize += dStrlen(gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + 2; - if(gEvalState.stack[i]->scopeName) - totalSize += dStrlen(gEvalState.stack[i]->scopeName) + 3; - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + totalSize += dStrlen(gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + 2; + if (gEvalState.stack[i]->scopeName) + totalSize += dStrlen(gEvalState.stack[i]->scopeName) + 3; + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) totalSize += dStrlen(gEvalState.stack[i]->scopeNamespace->mName) + 2; } char *buf = Con::getReturnBuffer(totalSize); buf[0] = 0; - for(U32 i = 0; i < gEvalState.getStackDepth(); i++) + for (U32 i = 0; i < gEvalState.getStackDepth(); i++) { dStrcat(buf, "->"); - - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) - { - dStrcat(buf, "["); - dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage); - dStrcat(buf, "]"); - } - if(gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) + + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) + { + dStrcat(buf, "["); + dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage); + dStrcat(buf, "]"); + } + if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) { dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mName); dStrcat(buf, "::"); } - if(gEvalState.stack[i]->scopeName) + if (gEvalState.stack[i]->scopeName) dStrcat(buf, gEvalState.stack[i]->scopeName); } @@ -915,14 +931,14 @@ Namespace::Entry::Entry() void Namespace::Entry::clear() { - if(mCode) + if (mCode) { mCode->decRefCount(); mCode = NULL; } // Clean up usage strings generated for script functions. - if( ( mType == Namespace::Entry::ConsoleFunctionType ) && mUsage ) + if ((mType == Namespace::Entry::ConsoleFunctionType) && mUsage) { dFree(mUsage); mUsage = NULL; @@ -948,7 +964,7 @@ Namespace::Namespace() Namespace::~Namespace() { clearEntries(); - if( mUsage && mCleanUpUsage ) + if (mUsage && mCleanUpUsage) { dFree(mUsage); mUsage = NULL; @@ -958,33 +974,36 @@ Namespace::~Namespace() void Namespace::clearEntries() { - for(Entry *walk = mEntryList; walk; walk = walk->mNext) + for (Entry *walk = mEntryList; walk; walk = walk->mNext) walk->clear(); } Namespace *Namespace::find(StringTableEntry name, StringTableEntry package) { - if ( name == NULL && package == NULL ) + if (name == NULL && package == NULL) return mGlobalNamespace; - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) - { - if(walk->mName == name && walk->mPackage == package) - return walk; - } + auto pair = std::make_pair(name, package); + auto pos = gNamespaceCache.find(pair); + if (pos != gNamespaceCache.end()) + return pos->second; - Namespace *ret = (Namespace *) mAllocator.alloc(sizeof(Namespace)); + Namespace *ret = (Namespace *)mAllocator.alloc(sizeof(Namespace)); constructInPlace(ret); ret->mPackage = package; ret->mName = name; ret->mNext = mNamespaceList; mNamespaceList = ret; + + // insert into namespace cache. + gNamespaceCache[pair] = ret; + return ret; } -bool Namespace::unlinkClass( Namespace *parent ) +bool Namespace::unlinkClass(Namespace *parent) { - AssertFatal( mPackage == NULL, "Namespace::unlinkClass - Must not be called on a namespace coming from a package!" ); + AssertFatal(mPackage == NULL, "Namespace::unlinkClass - Must not be called on a namespace coming from a package!"); // Skip additions to this namespace coming from packages. @@ -992,7 +1011,7 @@ bool Namespace::unlinkClass( Namespace *parent ) // Make sure "parent" is the direct parent namespace. - if( parent != NULL && walk->mParent && walk->mParent != parent ) + if (parent != NULL && walk->mParent && walk->mParent != parent) { Con::errorf(ConsoleLogEntry::General, "Namespace::unlinkClass - cannot unlink namespace parent linkage for %s for %s.", walk->mName, walk->mParent->mName); @@ -1003,12 +1022,12 @@ bool Namespace::unlinkClass( Namespace *parent ) // the bottom-most namespace, i.e. the one guaranteed not // to come from a package. - mRefCountToParent --; - AssertFatal( mRefCountToParent >= 0, "Namespace::unlinkClass - reference count to parent is less than 0" ); + mRefCountToParent--; + AssertFatal(mRefCountToParent >= 0, "Namespace::unlinkClass - reference count to parent is less than 0"); // Unlink if the count dropped to zero. - if( mRefCountToParent == 0 ) + if (mRefCountToParent == 0) { walk->mParent = NULL; trashCache(); @@ -1022,7 +1041,7 @@ bool Namespace::classLinkTo(Namespace *parent) { Namespace* walk = getPackageRoot(); - if(walk->mParent && walk->mParent != parent) + if (walk->mParent && walk->mParent != parent) { Con::errorf(ConsoleLogEntry::General, "Error: cannot change namespace parent linkage of %s from %s to %s.", walk->mName, walk->mParent->mName, parent->mName); @@ -1039,10 +1058,10 @@ bool Namespace::classLinkTo(Namespace *parent) void Namespace::buildHashTable() { - if(mHashSequence == mCacheSequence) + if (mHashSequence == mCacheSequence) return; - if(!mEntryList && mParent) + if (!mEntryList && mParent) { mParent->buildHashTable(); mHashTable = mParent->mHashTable; @@ -1053,33 +1072,33 @@ void Namespace::buildHashTable() U32 entryCount = 0; Namespace * ns; - for(ns = this; ns; ns = ns->mParent) - for(Entry *walk = ns->mEntryList; walk; walk = walk->mNext) - if(lookupRecursive(walk->mFunctionName) == walk) + for (ns = this; ns; ns = ns->mParent) + for (Entry *walk = ns->mEntryList; walk; walk = walk->mNext) + if (lookupRecursive(walk->mFunctionName) == walk) entryCount++; mHashSize = entryCount + (entryCount >> 1) + 1; - if(!(mHashSize & 1)) + if (!(mHashSize & 1)) mHashSize++; - mHashTable = (Entry **) mCacheAllocator.alloc(sizeof(Entry *) * mHashSize); - for(U32 i = 0; i < mHashSize; i++) + mHashTable = (Entry **)mCacheAllocator.alloc(sizeof(Entry *) * mHashSize); + for (U32 i = 0; i < mHashSize; i++) mHashTable[i] = NULL; - for(ns = this; ns; ns = ns->mParent) + for (ns = this; ns; ns = ns->mParent) { - for(Entry *walk = ns->mEntryList; walk; walk = walk->mNext) + for (Entry *walk = ns->mEntryList; walk; walk = walk->mNext) { U32 index = HashPointer(walk->mFunctionName) % mHashSize; - while(mHashTable[index] && mHashTable[index]->mFunctionName != walk->mFunctionName) + while (mHashTable[index] && mHashTable[index]->mFunctionName != walk->mFunctionName) { index++; - if(index >= mHashSize) + if (index >= mHashSize) index = 0; } - if(!mHashTable[index]) + if (!mHashTable[index]) mHashTable[index] = walk; } } @@ -1087,15 +1106,15 @@ void Namespace::buildHashTable() mHashSequence = mCacheSequence; } -void Namespace::getUniqueEntryLists( Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList ) +void Namespace::getUniqueEntryLists(Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList) { // All namespace entries in the common ACR should be // ignored when checking for duplicate entry names. static VectorPtr commonEntries; commonEntries.clear(); - AbstractClassRep *commonACR = mClassRep->getCommonParent( other->mClassRep ); - commonACR->getNameSpace()->getEntryList( &commonEntries ); + AbstractClassRep *commonACR = mClassRep->getCommonParent(other->mClassRep); + commonACR->getNameSpace()->getEntryList(&commonEntries); // Make life easier VectorPtr &thisEntries = *outThisList; @@ -1105,29 +1124,29 @@ void Namespace::getUniqueEntryLists( Namespace *other, VectorPtr *outTh thisEntries.clear(); compEntries.clear(); - getEntryList( &thisEntries ); - other->getEntryList( &compEntries ); + getEntryList(&thisEntries); + other->getEntryList(&compEntries); // Run through all of the entries in the common ACR, and remove them from // the other two entry lists - for( NamespaceEntryListIterator itr = commonEntries.begin(); itr != commonEntries.end(); itr++ ) + for (NamespaceEntryListIterator itr = commonEntries.begin(); itr != commonEntries.end(); itr++) { // Check this entry list - for( NamespaceEntryListIterator thisItr = thisEntries.begin(); thisItr != thisEntries.end(); thisItr++ ) + for (NamespaceEntryListIterator thisItr = thisEntries.begin(); thisItr != thisEntries.end(); thisItr++) { - if( *thisItr == *itr ) + if (*thisItr == *itr) { - thisEntries.erase( thisItr ); + thisEntries.erase(thisItr); break; } } // Same check for component entry list - for( NamespaceEntryListIterator compItr = compEntries.begin(); compItr != compEntries.end(); compItr++ ) + for (NamespaceEntryListIterator compItr = compEntries.begin(); compItr != compEntries.end(); compItr++) { - if( *compItr == *itr ) + if (*compItr == *itr) { - compEntries.erase( compItr ); + compEntries.erase(compItr); break; } } @@ -1137,12 +1156,15 @@ void Namespace::getUniqueEntryLists( Namespace *other, VectorPtr *outTh void Namespace::init() { // create the global namespace - mGlobalNamespace = (Namespace *) mAllocator.alloc(sizeof(Namespace)); + mGlobalNamespace = (Namespace *)mAllocator.alloc(sizeof(Namespace)); constructInPlace(mGlobalNamespace); mGlobalNamespace->mPackage = NULL; mGlobalNamespace->mName = NULL; mGlobalNamespace->mNext = NULL; mNamespaceList = mGlobalNamespace; + + // Insert into namespace cache. + gNamespaceCache[std::make_pair(mGlobalNamespace->mName, mGlobalNamespace->mPackage)] = mGlobalNamespace; } Namespace *Namespace::global() @@ -1155,7 +1177,7 @@ void Namespace::shutdown() // The data chunker will release all memory in one go // without calling destructors, so we do this manually here. - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) walk->~Namespace(); } @@ -1167,21 +1189,21 @@ void Namespace::trashCache() const char *Namespace::tabComplete(const char *prevText, S32 baseLen, bool fForward) { - if(mHashSequence != mCacheSequence) + if (mHashSequence != mCacheSequence) buildHashTable(); const char *bestMatch = NULL; - for(U32 i = 0; i < mHashSize; i++) - if(mHashTable[i] && canTabComplete(prevText, bestMatch, mHashTable[i]->mFunctionName, baseLen, fForward)) + for (U32 i = 0; i < mHashSize; i++) + if (mHashTable[i] && canTabComplete(prevText, bestMatch, mHashTable[i]->mFunctionName, baseLen, fForward)) bestMatch = mHashTable[i]->mFunctionName; return bestMatch; } Namespace::Entry *Namespace::lookupRecursive(StringTableEntry name) { - for(Namespace *ns = this; ns; ns = ns->mParent) - for(Entry *walk = ns->mEntryList; walk; walk = walk->mNext) - if(walk->mFunctionName == name) + for (Namespace *ns = this; ns; ns = ns->mParent) + for (Entry *walk = ns->mEntryList; walk; walk = walk->mNext) + if (walk->mFunctionName == name) return walk; return NULL; @@ -1189,20 +1211,20 @@ Namespace::Entry *Namespace::lookupRecursive(StringTableEntry name) Namespace::Entry *Namespace::lookup(StringTableEntry name) { - if(mHashSequence != mCacheSequence) + if (mHashSequence != mCacheSequence) buildHashTable(); U32 index = HashPointer(name) % mHashSize; - while(mHashTable[index] && mHashTable[index]->mFunctionName != name) + while (mHashTable[index] && mHashTable[index]->mFunctionName != name) { index++; - if(index >= mHashSize) + if (index >= mHashSize) index = 0; } return mHashTable[index]; } -static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b) +static S32 QSORT_CALLBACK compareEntries(const void* a, const void* b) { const Namespace::Entry* fa = *((Namespace::Entry**)a); const Namespace::Entry* fb = *((Namespace::Entry**)b); @@ -1212,28 +1234,28 @@ static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b) void Namespace::getEntryList(VectorPtr *vec) { - if(mHashSequence != mCacheSequence) + if (mHashSequence != mCacheSequence) buildHashTable(); - for(U32 i = 0; i < mHashSize; i++) - if(mHashTable[i]) + for (U32 i = 0; i < mHashSize; i++) + if (mHashTable[i]) vec->push_back(mHashTable[i]); - dQsort(vec->address(),vec->size(),sizeof(Namespace::Entry *),compareEntries); + dQsort(vec->address(), vec->size(), sizeof(Namespace::Entry *), compareEntries); } Namespace::Entry *Namespace::createLocalEntry(StringTableEntry name) { - for(Entry *walk = mEntryList; walk; walk = walk->mNext) + for (Entry *walk = mEntryList; walk; walk = walk->mNext) { - if(walk->mFunctionName == name) + if (walk->mFunctionName == name) { walk->clear(); return walk; } } - Entry *ent = (Entry *) mAllocator.alloc(sizeof(Entry)); + Entry *ent = (Entry *)mAllocator.alloc(sizeof(Entry)); constructInPlace(ent); ent->mNamespace = this; @@ -1245,7 +1267,7 @@ Namespace::Entry *Namespace::createLocalEntry(StringTableEntry name) return ent; } -void Namespace::addFunction( StringTableEntry name, CodeBlock *cb, U32 functionOffset, const char* usage, U32 lineNumber ) +void Namespace::addFunction(StringTableEntry name, CodeBlock *cb, U32 functionOffset, const char* usage, U32 lineNumber) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1255,10 +1277,10 @@ void Namespace::addFunction( StringTableEntry name, CodeBlock *cb, U32 functionO ent->mFunctionOffset = functionOffset; ent->mCode->incRefCount(); ent->mType = Entry::ConsoleFunctionType; - ent->mFunctionLineNumber = lineNumber; + ent->mFunctionLineNumber = lineNumber; } -void Namespace::addCommand( StringTableEntry name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1273,7 +1295,7 @@ void Namespace::addCommand( StringTableEntry name, StringCallback cb, const char ent->cb.mStringCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, IntCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1288,7 +1310,7 @@ void Namespace::addCommand( StringTableEntry name, IntCallback cb, const char *u ent->cb.mIntCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, VoidCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1303,7 +1325,7 @@ void Namespace::addCommand( StringTableEntry name, VoidCallback cb, const char * ent->cb.mVoidCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, FloatCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1318,7 +1340,7 @@ void Namespace::addCommand( StringTableEntry name, FloatCallback cb, const char ent->cb.mFloatCallbackFunc = cb; } -void Namespace::addCommand( StringTableEntry name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) +void Namespace::addCommand(StringTableEntry name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header) { Entry *ent = createLocalEntry(name); trashCache(); @@ -1333,16 +1355,16 @@ void Namespace::addCommand( StringTableEntry name, BoolCallback cb, const char * ent->cb.mBoolCallbackFunc = cb; } -void Namespace::addScriptCallback( const char *funcName, const char *usage, ConsoleFunctionHeader* header ) +void Namespace::addScriptCallback(const char *funcName, const char *usage, ConsoleFunctionHeader* header) { - static U32 uid=0; + static U32 uid = 0; char buffer[1024]; char lilBuffer[32]; dStrcpy(buffer, funcName); dSprintf(lilBuffer, 32, "_%d_cb", uid++); dStrcat(buffer, lilBuffer); - Entry *ent = createLocalEntry(StringTable->insert( buffer )); + Entry *ent = createLocalEntry(StringTable->insert(buffer)); trashCache(); ent->mUsage = usage; @@ -1356,17 +1378,17 @@ void Namespace::addScriptCallback( const char *funcName, const char *usage, Cons void Namespace::markGroup(const char* name, const char* usage) { - static U32 uid=0; + static U32 uid = 0; char buffer[1024]; char lilBuffer[32]; dStrcpy(buffer, name); dSprintf(lilBuffer, 32, "_%d", uid++); dStrcat(buffer, lilBuffer); - Entry *ent = createLocalEntry(StringTable->insert( buffer )); + Entry *ent = createLocalEntry(StringTable->insert(buffer)); trashCache(); - if(usage != NULL) + if (usage != NULL) lastUsage = (char*)(ent->mUsage = usage); else ent->mUsage = lastUsage; @@ -1384,9 +1406,9 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE { STR.clearFunctionOffset(); - if(mType == ConsoleFunctionType) + if (mType == ConsoleFunctionType) { - if(mFunctionOffset) + if (mFunctionOffset) { return mCode->exec(mFunctionOffset, argv[0], mNamespace, argc, argv, false, mPackage); } @@ -1399,35 +1421,35 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE #ifndef TORQUE_DEBUG // [tom, 12/13/2006] This stops tools functions from working in the console, // which is useful behavior when debugging so I'm ifdefing this out for debug builds. - if(mToolOnly && ! Con::isCurrentScriptToolScript()) + if (mToolOnly && !Con::isCurrentScriptToolScript()) { Con::errorf(ConsoleLogEntry::Script, "%s::%s - attempting to call tools only function from outside of tools", mNamespace->mName, mFunctionName); return ConsoleValueRef(); } #endif - if((mMinArgs && argc < mMinArgs) || (mMaxArgs && argc > mMaxArgs)) + if ((mMinArgs && argc < mMinArgs) || (mMaxArgs && argc > mMaxArgs)) { Con::warnf(ConsoleLogEntry::Script, "%s::%s - wrong number of arguments.", mNamespace->mName, mFunctionName); Con::warnf(ConsoleLogEntry::Script, "usage: %s", mUsage); return ConsoleValueRef(); } - switch(mType) + switch (mType) { case StringCallbackType: return ConsoleValueRef::fromValue(CSTK.pushStackString(cb.mStringCallbackFunc(state->thisObject, argc, argv))); case IntCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case FloatCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case VoidCallbackType: cb.mVoidCallbackFunc(state->thisObject, argc, argv); return ConsoleValueRef(); case BoolCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); } - + return ConsoleValueRef(); } @@ -1439,181 +1461,181 @@ namespace { /// Scan the given usage string for an argument list description. With the /// old console macros, these were usually included as the first part of the /// usage string. - bool sFindArgumentListSubstring( const char* usage, const char*& start, const char*& end ) + bool sFindArgumentListSubstring(const char* usage, const char*& start, const char*& end) { - if( !usage ) + if (!usage) return false; - + const char* ptr = usage; - while( *ptr && *ptr != '(' && *ptr != '\n' ) // Only scan first line of usage string. + while (*ptr && *ptr != '(' && *ptr != '\n') // Only scan first line of usage string. { // Stop on the first alphanumeric character as we expect // argument lists to precede descriptions. - if( dIsalnum( *ptr ) ) + if (dIsalnum(*ptr)) return false; - - ptr ++; + + ptr++; } - - if( *ptr != '(' ) + + if (*ptr != '(') return false; start = ptr; - ptr ++; - + ptr++; + bool inString = false; U32 nestingCount = 0; - - while( *ptr && ( *ptr != ')' || nestingCount > 0 || inString ) ) + + while (*ptr && (*ptr != ')' || nestingCount > 0 || inString)) { - if( *ptr == '(' ) - nestingCount ++; - else if( *ptr == ')' ) - nestingCount --; - else if( *ptr == '"' ) + if (*ptr == '(') + nestingCount++; + else if (*ptr == ')') + nestingCount--; + else if (*ptr == '"') inString = !inString; - else if( *ptr == '\\' && ptr[ 1 ] == '"' ) - ptr ++; - ptr ++; + else if (*ptr == '\\' && ptr[1] == '"') + ptr++; + ptr++; } - - if( *ptr ) - ptr ++; + + if (*ptr) + ptr++; end = ptr; - + return true; } - + /// - void sParseList( const char* str, Vector< String >& outList ) + void sParseList(const char* str, Vector< String >& outList) { // Skip the initial '( '. - + const char* ptr = str; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; - - if( *ptr == '(' ) + while (*ptr && dIsspace(*ptr)) + ptr++; + + if (*ptr == '(') { - ptr ++; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; + ptr++; + while (*ptr && dIsspace(*ptr)) + ptr++; } - + // Parse out list items. - - while( *ptr && *ptr != ')' ) + + while (*ptr && *ptr != ')') { // Find end of element. - + const char* start = ptr; bool inString = false; U32 nestingCount = 0; - while( *ptr && ( ( *ptr != ')' && *ptr != ',' ) || nestingCount > 0 || inString ) ) + while (*ptr && ((*ptr != ')' && *ptr != ',') || nestingCount > 0 || inString)) { - if( *ptr == '(' ) - nestingCount ++; - else if( *ptr == ')' ) - nestingCount --; - else if( *ptr == '"' ) + if (*ptr == '(') + nestingCount++; + else if (*ptr == ')') + nestingCount--; + else if (*ptr == '"') inString = !inString; - else if( *ptr == '\\' && ptr[ 1 ] == '"' ) - ptr ++; - ptr ++; + else if (*ptr == '\\' && ptr[1] == '"') + ptr++; + ptr++; } - + // Backtrack to remove trailing whitespace. - + const char* end = ptr; - if( *end == ',' || *end == ')' ) - end --; - while( end > start && dIsspace( *end ) ) - end --; - if( *end ) - end ++; - + if (*end == ',' || *end == ')') + end--; + while (end > start && dIsspace(*end)) + end--; + if (*end) + end++; + // Add to list. - - if( start != end ) - outList.push_back( String( start, end - start ) ); - + + if (start != end) + outList.push_back(String(start, end - start)); + // Skip comma and whitespace. - - if( *ptr == ',' ) - ptr ++; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; + + if (*ptr == ',') + ptr++; + while (*ptr && dIsspace(*ptr)) + ptr++; } } - + /// - void sGetArgNameAndType( const String& str, String& outType, String& outName ) + void sGetArgNameAndType(const String& str, String& outType, String& outName) { - if( !str.length() ) + if (!str.length()) { outType = String::EmptyString; outName = String::EmptyString; return; } - + // Find first non-ID character from right. - + S32 index = str.length() - 1; - while( index >= 0 && ( dIsalnum( str[ index ] ) || str[ index ] == '_' ) ) - index --; - + while (index >= 0 && (dIsalnum(str[index]) || str[index] == '_')) + index--; + const U32 nameStartIndex = index + 1; - + // Find end of type name by skipping rightmost whitespace inwards. - - while( index >= 0 && dIsspace( str[ index ] ) ) - index --; - + + while (index >= 0 && dIsspace(str[index])) + index--; + // - - outName = String( &( ( const char* ) str )[ nameStartIndex ] ); - outType = String( str, index + 1 ); + + outName = String(&((const char*)str)[nameStartIndex]); + outType = String(str, index + 1); } - + /// Return the type name to show in documentation for the given C++ type. - const char* sGetDocTypeString( const char* nativeType ) + const char* sGetDocTypeString(const char* nativeType) { - if( dStrncmp( nativeType, "const ", 6 ) == 0 ) + if (dStrncmp(nativeType, "const ", 6) == 0) nativeType += 6; - if( dStrcmp( nativeType, "char*" ) == 0 || dStrcmp( nativeType, "char *" ) == 0 ) + if (dStrcmp(nativeType, "char*") == 0 || dStrcmp(nativeType, "char *") == 0) return "string"; - else if( dStrcmp( nativeType, "S32" ) == 0 || dStrcmp( nativeType, "U32" ) == 0 ) + else if (dStrcmp(nativeType, "S32") == 0 || dStrcmp(nativeType, "U32") == 0) return "int"; - else if( dStrcmp( nativeType, "F32" ) == 0 ) + else if (dStrcmp(nativeType, "F32") == 0) return "float"; - - const U32 length = dStrlen( nativeType ); - if( nativeType[ length - 1 ] == '&' || nativeType[ length - 1 ] == '*' ) - return StringTable->insertn( nativeType, length - 1 ); - + + const U32 length = dStrlen(nativeType); + if (nativeType[length - 1] == '&' || nativeType[length - 1] == '*') + return StringTable->insertn(nativeType, length - 1); + return nativeType; } } -String Namespace::Entry::getBriefDescription( String* outRemainingDocText ) const +String Namespace::Entry::getBriefDescription(String* outRemainingDocText) const { String docString = getDocString(); - - S32 newline = docString.find( '\n' ); - if( newline == -1 ) + + S32 newline = docString.find('\n'); + if (newline == -1) { - if( outRemainingDocText ) + if (outRemainingDocText) *outRemainingDocText = String(); return docString; } - - String brief = docString.substr( 0, newline ); - if( outRemainingDocText ) - *outRemainingDocText = docString.substr( newline + 1 ); - + + String brief = docString.substr(0, newline); + if (outRemainingDocText) + *outRemainingDocText = docString.substr(newline + 1); + return brief; } @@ -1621,92 +1643,92 @@ String Namespace::Entry::getDocString() const { const char* argListStart; const char* argListEnd; - - if( sFindArgumentListSubstring( mUsage, argListStart, argListEnd ) ) + + if (sFindArgumentListSubstring(mUsage, argListStart, argListEnd)) { // Skip the " - " part present in some old doc strings. - + const char* ptr = argListEnd; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; - - if( *ptr == '-' ) + while (*ptr && dIsspace(*ptr)) + ptr++; + + if (*ptr == '-') { - ptr ++; - while( *ptr && dIsspace( *ptr ) ) - ptr ++; + ptr++; + while (*ptr && dIsspace(*ptr)) + ptr++; } - + return ptr; } - + return mUsage; } String Namespace::Entry::getArgumentsString() const { StringBuilder str; - - if( mHeader ) + + if (mHeader) { // Parse out the argument list string supplied with the extended // function header and add default arguments as we go. - + Vector< String > argList; Vector< String > defaultArgList; - - sParseList( mHeader->mArgString, argList ); - sParseList( mHeader->mDefaultArgString, defaultArgList ); - - str.append( '(' ); - + + sParseList(mHeader->mArgString, argList); + sParseList(mHeader->mDefaultArgString, defaultArgList); + + str.append('('); + const U32 numArgs = argList.size(); const U32 numDefaultArgs = defaultArgList.size(); const U32 firstDefaultArgIndex = numArgs - numDefaultArgs; - - for( U32 i = 0; i < numArgs; ++ i ) + + for (U32 i = 0; i < numArgs; ++i) { // Add separator if not first arg. - - if( i > 0 ) - str.append( ',' ); - + + if (i > 0) + str.append(','); + // Add type and name. - + String name; String type; - - sGetArgNameAndType( argList[ i ], type, name ); - - str.append( ' ' ); - str.append( sGetDocTypeString( type ) ); - str.append( ' ' ); - str.append( name ); - + + sGetArgNameAndType(argList[i], type, name); + + str.append(' '); + str.append(sGetDocTypeString(type)); + str.append(' '); + str.append(name); + // Add default value, if any. - - if( i >= firstDefaultArgIndex ) + + if (i >= firstDefaultArgIndex) { - str.append( '=' ); - str.append( defaultArgList[ i - firstDefaultArgIndex ] ); + str.append('='); + str.append(defaultArgList[i - firstDefaultArgIndex]); } } - - if( numArgs > 0 ) - str.append( ' ' ); - str.append( ')' ); + + if (numArgs > 0) + str.append(' '); + str.append(')'); } else { // No extended function header. Try to parse out the argument // list from the usage string. - + const char* argListStart; const char* argListEnd; - - if( sFindArgumentListSubstring( mUsage, argListStart, argListEnd ) ) - str.append( argListStart, argListEnd - argListStart ); - else if( mType == ConsoleFunctionType && mCode ) + + if (sFindArgumentListSubstring(mUsage, argListStart, argListEnd)) + str.append(argListStart, argListEnd - argListStart); + else if (mType == ConsoleFunctionType && mCode) { // This isn't correct but the nonsense console stuff is set up such that all // functions that have no function bodies are keyed to offset 0 to indicate "no code." @@ -1714,70 +1736,70 @@ String Namespace::Entry::getArgumentsString() const // tell here what the actual prototype is except if we searched though the entire opcode // stream for the corresponding OP_FUNC_DECL (which would require dealing with the // variable-size instructions). - - if( !mFunctionOffset ) + + if (!mFunctionOffset) return "()"; - - String args = mCode->getFunctionArgs( mFunctionOffset ); - if( args.isEmpty() ) + + String args = mCode->getFunctionArgs(mFunctionOffset); + if (args.isEmpty()) return "()"; - - str.append( "( " ); - str.append( args ); - str.append( " )" ); + + str.append("( "); + str.append(args); + str.append(" )"); } } - + return str.end(); } String Namespace::Entry::getPrototypeString() const { StringBuilder str; - + // Start with return type. - - if( mHeader && mHeader->mReturnString ) + + if (mHeader && mHeader->mReturnString) { - str.append( sGetDocTypeString( mHeader->mReturnString ) ); - str.append( ' ' ); + str.append(sGetDocTypeString(mHeader->mReturnString)); + str.append(' '); } else - switch( mType ) + switch (mType) { case StringCallbackType: - str.append( "string " ); + str.append("string "); break; - + case IntCallbackType: - str.append( "int " ); + str.append("int "); break; case FloatCallbackType: - str.append( "float " ); + str.append("float "); break; case VoidCallbackType: - str.append( "void " ); + str.append("void "); break; case BoolCallbackType: - str.append( "bool " ); + str.append("bool "); break; - + case ScriptCallbackType: break; } - + // Add function name and arguments. - if( mType == ScriptCallbackType ) - str.append( cb.mCallbackName ); + if (mType == ScriptCallbackType) + str.append(cb.mCallbackName); else - str.append( mFunctionName ); - - str.append( getArgumentsString() ); - + str.append(mFunctionName); + + str.append(getArgumentsString()); + return str.end(); } @@ -1789,8 +1811,8 @@ U32 Namespace::mOldNumActivePackages = 0; bool Namespace::isPackage(StringTableEntry name) { - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) - if(walk->mPackage == name) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + if (walk->mPackage == name) return true; return false; } @@ -1802,7 +1824,7 @@ U32 Namespace::getActivePackagesCount() StringTableEntry Namespace::getActivePackage(U32 index) { - if( index >= mNumActivePackages ) + if (index >= mNumActivePackages) return StringTable->EmptyString(); return mActivePackages[index]; @@ -1810,26 +1832,26 @@ StringTableEntry Namespace::getActivePackage(U32 index) void Namespace::activatePackage(StringTableEntry name) { - if(mNumActivePackages == MaxActivePackages) + if (mNumActivePackages == MaxActivePackages) { Con::printf("ActivatePackage(%s) failed - Max package limit reached: %d", name, MaxActivePackages); return; } - if(!name) + if (!name) return; // see if this one's already active - for(U32 i = 0; i < mNumActivePackages; i++) - if(mActivePackages[i] == name) + for (U32 i = 0; i < mNumActivePackages; i++) + if (mActivePackages[i] == name) return; // kill the cache trashCache(); // find all the package namespaces... - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) { - if(walk->mPackage == name) + if (walk->mPackage == name) { Namespace *parent = Namespace::find(walk->mName); // hook the parent @@ -1838,10 +1860,10 @@ void Namespace::activatePackage(StringTableEntry name) // now swap the entries: Entry *ew; - for(ew = parent->mEntryList; ew; ew = ew->mNext) + for (ew = parent->mEntryList; ew; ew = ew->mNext) ew->mNamespace = walk; - for(ew = walk->mEntryList; ew; ew = ew->mNext) + for (ew = walk->mEntryList; ew; ew = ew->mNext) ew->mNamespace = parent; ew = walk->mEntryList; @@ -1857,33 +1879,33 @@ void Namespace::deactivatePackage(StringTableEntry name) U32 oldNumActivePackages = mNumActivePackages; // Remove all packages down to the given one - deactivatePackageStack( name ); + deactivatePackageStack(name); // Now add back all packages that followed the given one - if(!oldNumActivePackages) + if (!oldNumActivePackages) return; - for(U32 i = mNumActivePackages+1; i < oldNumActivePackages; i++) + for (U32 i = mNumActivePackages + 1; i < oldNumActivePackages; i++) activatePackage(mActivePackages[i]); } void Namespace::deactivatePackageStack(StringTableEntry name) { S32 i, j; - for(i = 0; i < mNumActivePackages; i++) - if(mActivePackages[i] == name) + for (i = 0; i < mNumActivePackages; i++) + if (mActivePackages[i] == name) break; - if(i == mNumActivePackages) + if (i == mNumActivePackages) return; trashCache(); // Remove all packages down to the given one - for(j = mNumActivePackages - 1; j >= i; j--) + for (j = mNumActivePackages - 1; j >= i; j--) { // gotta unlink em in reverse order... - for(Namespace *walk = mNamespaceList; walk; walk = walk->mNext) + for (Namespace *walk = mNamespaceList; walk; walk = walk->mNext) { - if(walk->mPackage == mActivePackages[j]) + if (walk->mPackage == mActivePackages[j]) { Namespace *parent = Namespace::find(walk->mName); // hook the parent @@ -1892,10 +1914,10 @@ void Namespace::deactivatePackageStack(StringTableEntry name) // now swap the entries: Entry *ew; - for(ew = parent->mEntryList; ew; ew = ew->mNext) + for (ew = parent->mEntryList; ew; ew = ew->mNext) ew->mNamespace = walk; - for(ew = walk->mEntryList; ew; ew = ew->mNext) + for (ew = walk->mEntryList; ew; ew = ew->mNext) ew->mNamespace = parent; ew = walk->mEntryList; @@ -1910,21 +1932,21 @@ void Namespace::deactivatePackageStack(StringTableEntry name) void Namespace::unlinkPackages() { mOldNumActivePackages = mNumActivePackages; - if(!mNumActivePackages) + if (!mNumActivePackages) return; deactivatePackageStack(mActivePackages[0]); } void Namespace::relinkPackages() { - if(!mOldNumActivePackages) + if (!mOldNumActivePackages) return; - for(U32 i = 0; i < mOldNumActivePackages; i++) + for (U32 i = 0; i < mOldNumActivePackages; i++) activatePackage(mActivePackages[i]); } -DefineEngineFunction(isPackage, bool, ( String identifier ),, +DefineEngineFunction(isPackage, bool, (String identifier), , "@brief Returns true if the identifier is the name of a declared package.\n\n" "@ingroup Packages\n") { @@ -1932,7 +1954,7 @@ DefineEngineFunction(isPackage, bool, ( String identifier ),, return Namespace::isPackage(name); } -DefineEngineFunction(activatePackage, void, ( String packageName ),, +DefineEngineFunction(activatePackage, void, (String packageName), , "@brief Activates an existing package.\n\n" "The activation occurs by updating the namespace linkage of existing functions and methods. " "If the package is already activated the function does nothing.\n" @@ -1942,7 +1964,7 @@ DefineEngineFunction(activatePackage, void, ( String packageName ),, Namespace::activatePackage(name); } -DefineEngineFunction(deactivatePackage, void, ( String packageName ),, +DefineEngineFunction(deactivatePackage, void, (String packageName), , "@brief Deactivates a previously activated package.\n\n" "The package is deactivated by removing its namespace linkages to any function or method. " "If there are any packages above this one in the stack they are deactivated as well. " @@ -1953,16 +1975,16 @@ DefineEngineFunction(deactivatePackage, void, ( String packageName ),, Namespace::deactivatePackage(name); } -DefineEngineFunction(getPackageList, const char*, (),, +DefineEngineFunction(getPackageList, const char*, (), , "@brief Returns a space delimited list of the active packages in stack order.\n\n" "@ingroup Packages\n") { - if( Namespace::getActivePackagesCount() == 0 ) + if (Namespace::getActivePackagesCount() == 0) return ""; // Determine size of return buffer dsize_t buffersize = 0; - for( U32 i = 0; i < Namespace::getActivePackagesCount(); ++i ) + for (U32 i = 0; i < Namespace::getActivePackagesCount(); ++i) { buffersize += dStrlen(Namespace::getActivePackage(i)) + 1; } @@ -1970,7 +1992,7 @@ DefineEngineFunction(getPackageList, const char*, (),, U32 maxBufferSize = buffersize + 1; char* returnBuffer = Con::getReturnBuffer(maxBufferSize); U32 returnLen = 0; - for( U32 i = 0; i < Namespace::getActivePackagesCount(); ++i ) + for (U32 i = 0; i < Namespace::getActivePackagesCount(); ++i) { dSprintf(returnBuffer + returnLen, maxBufferSize - returnLen, "%s ", Namespace::getActivePackage(i)); returnLen = dStrlen(returnBuffer); diff --git a/Engine/source/console/consoleInternal.h b/Engine/source/console/consoleInternal.h index 35ebff800..d673bb39c 100644 --- a/Engine/source/console/consoleInternal.h +++ b/Engine/source/console/consoleInternal.h @@ -24,22 +24,21 @@ #define _CONSOLEINTERNAL_H_ #ifndef _STRINGFUNCTIONS_H_ - #include "core/strings/stringFunctions.h" +#include "core/strings/stringFunctions.h" #endif #ifndef _STRINGTABLE_H_ - #include "core/stringTable.h" +#include "core/stringTable.h" #endif #ifndef _CONSOLETYPES_H - #include "console/consoleTypes.h" +#include "console/consoleTypes.h" #endif #ifndef _CONSOLEOBJECT_H_ - #include "console/simObject.h" +#include "console/simObject.h" #endif #ifndef _DATACHUNKER_H_ - #include "core/dataChunker.h" +#include "core/dataChunker.h" #endif - /// @ingroup console_system Console System /// @{ @@ -55,222 +54,222 @@ class AbstractClassRep; /// Namespaces are used for dispatching calls in the console system. class Namespace { - enum { - MaxActivePackages = 512, + enum { + MaxActivePackages = 512, + }; + + static U32 mNumActivePackages; + static U32 mOldNumActivePackages; + static StringTableEntry mActivePackages[MaxActivePackages]; + +public: + StringTableEntry mName; + StringTableEntry mPackage; + + Namespace *mParent; + Namespace *mNext; + AbstractClassRep *mClassRep; + U32 mRefCountToParent; + + const char* mUsage; + + /// Script defined usage strings need to be cleaned up. This + /// field indicates whether or not the usage was set from script. + bool mCleanUpUsage; + + /// A function entry in the namespace. + struct Entry + { + enum + { + ScriptCallbackType = -3, + GroupMarker = -2, + InvalidFunctionType = -1, + ConsoleFunctionType, + StringCallbackType, + IntCallbackType, + FloatCallbackType, + VoidCallbackType, + BoolCallbackType }; - static U32 mNumActivePackages; - static U32 mOldNumActivePackages; - static StringTableEntry mActivePackages[MaxActivePackages]; + /// Link back to the namespace to which the entry belongs. + Namespace* mNamespace; - public: - StringTableEntry mName; + /// Next function entry in the hashtable link chain of the namespace. + Entry* mNext; + + /// Name of this function. + StringTableEntry mFunctionName; + + /// + S32 mType; + + /// Min number of arguments expected by this function. + S32 mMinArgs; + + /// Max number of arguments expected by this function. If zero, + /// function takes an arbitrary number of arguments. + S32 mMaxArgs; + + /// Name of the package to which this function belongs. StringTableEntry mPackage; - Namespace *mParent; - Namespace *mNext; - AbstractClassRep *mClassRep; - U32 mRefCountToParent; - + /// Whether this function is included only in TORQUE_TOOLS builds. + bool mToolOnly; + + /// Usage string for documentation. const char* mUsage; - - /// Script defined usage strings need to be cleaned up. This - /// field indicates whether or not the usage was set from script. - bool mCleanUpUsage; - /// A function entry in the namespace. - struct Entry - { - enum - { - ScriptCallbackType = -3, - GroupMarker = -2, - InvalidFunctionType = -1, - ConsoleFunctionType, - StringCallbackType, - IntCallbackType, - FloatCallbackType, - VoidCallbackType, - BoolCallbackType - }; + /// Extended console function information. + ConsoleFunctionHeader* mHeader; - /// Link back to the namespace to which the entry belongs. - Namespace* mNamespace; - - /// Next function entry in the hashtable link chain of the namespace. - Entry* mNext; - - /// Name of this function. - StringTableEntry mFunctionName; - - /// - S32 mType; - - /// Min number of arguments expected by this function. - S32 mMinArgs; - - /// Max number of arguments expected by this function. If zero, - /// function takes an arbitrary number of arguments. - S32 mMaxArgs; - - /// Name of the package to which this function belongs. - StringTableEntry mPackage; - - /// Whether this function is included only in TORQUE_TOOLS builds. - bool mToolOnly; + /// The compiled script code if this is a script function. + CodeBlock* mCode; - /// Usage string for documentation. - const char* mUsage; - - /// Extended console function information. - ConsoleFunctionHeader* mHeader; + /// The offset in the compiled script code at which this function begins. + U32 mFunctionOffset; - /// The compiled script code if this is a script function. - CodeBlock* mCode; - - /// The offset in the compiled script code at which this function begins. - U32 mFunctionOffset; + /// If it's a script function, this is the line of the declaration in code. + /// @note 0 for functions read from legacy DSOs that have no line number information. + U32 mFunctionLineNumber; - /// If it's a script function, this is the line of the declaration in code. - /// @note 0 for functions read from legacy DSOs that have no line number information. - U32 mFunctionLineNumber; - - union CallbackUnion { - StringCallback mStringCallbackFunc; - IntCallback mIntCallbackFunc; - VoidCallback mVoidCallbackFunc; - FloatCallback mFloatCallbackFunc; - BoolCallback mBoolCallbackFunc; - const char *mGroupName; - const char *mCallbackName; - } cb; - - Entry(); - - /// - void clear(); + union CallbackUnion { + StringCallback mStringCallbackFunc; + IntCallback mIntCallbackFunc; + VoidCallback mVoidCallbackFunc; + FloatCallback mFloatCallbackFunc; + BoolCallback mBoolCallbackFunc; + const char *mGroupName; + const char *mCallbackName; + } cb; - /// - ConsoleValueRef execute( S32 argc, ConsoleValueRef* argv, ExprEvalState* state ); - - /// Return a one-line documentation text string for the function. - String getBriefDescription( String* outRemainingDocText = NULL ) const; - - /// Get the auto-doc string for this function. This string does not included prototype information. - String getDocString() const; - - /// Return a string describing the arguments the function takes including default argument values. - String getArgumentsString() const; + Entry(); - /// Return a full prototype string for the function including return type, function name, - /// and arguments. - String getPrototypeString() const; - }; - - Entry* mEntryList; + /// + void clear(); - Entry** mHashTable; - - U32 mHashSize; - U32 mHashSequence; ///< @note The hash sequence is used by the autodoc console facility - /// as a means of testing reference state. + /// + ConsoleValueRef execute(S32 argc, ConsoleValueRef* argv, ExprEvalState* state); - Namespace(); - ~Namespace(); + /// Return a one-line documentation text string for the function. + String getBriefDescription(String* outRemainingDocText = NULL) const; - void addFunction( StringTableEntry name, CodeBlock* cb, U32 functionOffset, const char* usage = NULL, U32 lineNumber = 0 ); - void addCommand( StringTableEntry name, StringCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, IntCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, FloatCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, VoidCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); - void addCommand( StringTableEntry name, BoolCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL ); + /// Get the auto-doc string for this function. This string does not included prototype information. + String getDocString() const; - void addScriptCallback( const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL ); + /// Return a string describing the arguments the function takes including default argument values. + String getArgumentsString() const; - void markGroup(const char* name, const char* usage); - char * lastUsage; + /// Return a full prototype string for the function including return type, function name, + /// and arguments. + String getPrototypeString() const; + }; - /// Returns true if this namespace represents an engine defined - /// class and is not just a script defined class namespace. - bool isClass() const { return mClassRep && mClassRep->getNameSpace() == this; } + Entry* mEntryList; - void getEntryList(VectorPtr *); + Entry** mHashTable; - /// Return the name of this namespace. - StringTableEntry getName() const { return mName; } + U32 mHashSize; + U32 mHashSequence; ///< @note The hash sequence is used by the autodoc console facility + /// as a means of testing reference state. - /// Return the superordinate namespace to this namespace. Symbols are inherited from - /// this namespace. - Namespace* getParent() const { return mParent; } + Namespace(); + ~Namespace(); - /// Return the topmost package in the parent hierarchy of this namespace - /// that still refers to the same namespace. If packages are active and - /// adding to this namespace, then they will be linked in-between the namespace - /// they are adding to and its real parent namespace. - Namespace* getPackageRoot() - { - Namespace* walk = this; - while( walk->mParent && walk->mParent->mName == mName ) - walk = walk->mParent; + void addFunction(StringTableEntry name, CodeBlock* cb, U32 functionOffset, const char* usage = NULL, U32 lineNumber = 0); + void addCommand(StringTableEntry name, StringCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, IntCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, FloatCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, VoidCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); + void addCommand(StringTableEntry name, BoolCallback, const char *usage, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); - return walk; - } + void addScriptCallback(const char *funcName, const char *usage, ConsoleFunctionHeader* header = NULL); - /// Return the package in which this namespace is defined. - StringTableEntry getPackage() const { return mPackage; } + void markGroup(const char* name, const char* usage); + char * lastUsage; - /// Increase the count on the reference that this namespace - /// holds to its parent. - /// @note Must not be called on namespaces coming from packages. - void incRefCountToParent() - { - AssertFatal( mPackage == NULL, "Namespace::incRefCountToParent - Must not be called on a namespace coming from a package!" ); - mRefCountToParent ++; - } + /// Returns true if this namespace represents an engine defined + /// class and is not just a script defined class namespace. + bool isClass() const { return mClassRep && mClassRep->getNameSpace() == this; } - /// Decrease the count on the reference that this namespace - /// holds to its parent. - /// @note Must not be called on namespaces coming from packages. - void decRefCountToParent() - { - unlinkClass( NULL ); - } + void getEntryList(VectorPtr *); - Entry *lookup(StringTableEntry name); - Entry *lookupRecursive(StringTableEntry name); - Entry *createLocalEntry(StringTableEntry name); - void buildHashTable(); - void clearEntries(); - bool classLinkTo(Namespace *parent); - bool unlinkClass(Namespace *parent); - void getUniqueEntryLists( Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList ); + /// Return the name of this namespace. + StringTableEntry getName() const { return mName; } - const char *tabComplete(const char *prevText, S32 baseLen, bool fForward); + /// Return the superordinate namespace to this namespace. Symbols are inherited from + /// this namespace. + Namespace* getParent() const { return mParent; } - static U32 mCacheSequence; - static DataChunker mCacheAllocator; - static DataChunker mAllocator; - static void trashCache(); - static Namespace *mNamespaceList; - static Namespace *mGlobalNamespace; + /// Return the topmost package in the parent hierarchy of this namespace + /// that still refers to the same namespace. If packages are active and + /// adding to this namespace, then they will be linked in-between the namespace + /// they are adding to and its real parent namespace. + Namespace* getPackageRoot() + { + Namespace* walk = this; + while (walk->mParent && walk->mParent->mName == mName) + walk = walk->mParent; - static void init(); - static void shutdown(); - static Namespace *global(); + return walk; + } - static Namespace *find(StringTableEntry name, StringTableEntry package=NULL); + /// Return the package in which this namespace is defined. + StringTableEntry getPackage() const { return mPackage; } - static void activatePackage(StringTableEntry name); - static void deactivatePackage(StringTableEntry name); - static void deactivatePackageStack(StringTableEntry name); - static void dumpClasses( bool dumpScript = true, bool dumpEngine = true ); - static void dumpFunctions( bool dumpScript = true, bool dumpEngine = true ); - static void printNamespaceEntries(Namespace * g, bool dumpScript = true, bool dumpEngine = true); - static void unlinkPackages(); - static void relinkPackages(); - static bool isPackage(StringTableEntry name); - static U32 getActivePackagesCount(); - static StringTableEntry getActivePackage(U32 index); + /// Increase the count on the reference that this namespace + /// holds to its parent. + /// @note Must not be called on namespaces coming from packages. + void incRefCountToParent() + { + AssertFatal(mPackage == NULL, "Namespace::incRefCountToParent - Must not be called on a namespace coming from a package!"); + mRefCountToParent++; + } + + /// Decrease the count on the reference that this namespace + /// holds to its parent. + /// @note Must not be called on namespaces coming from packages. + void decRefCountToParent() + { + unlinkClass(NULL); + } + + Entry *lookup(StringTableEntry name); + Entry *lookupRecursive(StringTableEntry name); + Entry *createLocalEntry(StringTableEntry name); + void buildHashTable(); + void clearEntries(); + bool classLinkTo(Namespace *parent); + bool unlinkClass(Namespace *parent); + void getUniqueEntryLists(Namespace *other, VectorPtr *outThisList, VectorPtr *outOtherList); + + const char *tabComplete(const char *prevText, S32 baseLen, bool fForward); + + static U32 mCacheSequence; + static DataChunker mCacheAllocator; + static DataChunker mAllocator; + static void trashCache(); + static Namespace *mNamespaceList; + static Namespace *mGlobalNamespace; + + static void init(); + static void shutdown(); + static Namespace *global(); + + static Namespace *find(StringTableEntry name, StringTableEntry package = NULL); + + static void activatePackage(StringTableEntry name); + static void deactivatePackage(StringTableEntry name); + static void deactivatePackageStack(StringTableEntry name); + static void dumpClasses(bool dumpScript = true, bool dumpEngine = true); + static void dumpFunctions(bool dumpScript = true, bool dumpEngine = true); + static void printNamespaceEntries(Namespace * g, bool dumpScript = true, bool dumpEngine = true); + static void unlinkPackages(); + static void relinkPackages(); + static bool isPackage(StringTableEntry name); + static U32 getActivePackagesCount(); + static StringTableEntry getActivePackage(U32 index); }; typedef VectorPtr::iterator NamespaceEntryListIterator; @@ -292,10 +291,10 @@ public: /// The optional notification signal called when /// a value is assigned to this variable. NotifySignal *notify; - + /// Usage doc string. const char* mUsage; - + /// Whether this is a constant that cannot be assigned to. bool mIsConstant; @@ -309,16 +308,16 @@ public: mIsConstant = false; value.init(); } - + Entry(StringTableEntry name); ~Entry(); - + Entry *mNext; - + void reset() { name = NULL; value.cleanup(); - if ( notify ) + if (notify) delete notify; } @@ -339,63 +338,63 @@ public: void setIntValue(U32 val) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setIntValue(val); // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } void setFloatValue(F32 val) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setFloatValue(val); // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } void setStringStackPtrValue(StringStackPtr newValue) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setStringStackPtrValue(newValue); - - + + // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } void setStringValue(const char *newValue) { - if( mIsConstant ) + if (mIsConstant) { - Con::errorf( "Cannot assign value to constant '%s'.", name ); + Con::errorf("Cannot assign value to constant '%s'.", name); return; } - + value.setStringValue(newValue); - - + + // Fire off the notification if we have one. - if ( notify ) + if (notify) notify->trigger(); } }; @@ -407,9 +406,9 @@ public: S32 count; Entry **data; FreeListChunker< Entry > mChunker; - - HashTableData( Dictionary* owner ) - : owner( owner ), size( 0 ), count( 0 ), data( NULL ) {} + + HashTableData(Dictionary* owner) + : owner(owner), size(0), count(0), data(NULL) {} }; HashTableData* hashTable; @@ -426,13 +425,13 @@ public: Entry *lookup(StringTableEntry name); Entry *add(StringTableEntry name); - void setState(ExprEvalState *state, Dictionary* ref=NULL); + void setState(ExprEvalState *state, Dictionary* ref = NULL); void remove(Entry *); void reset(); - void exportVariables( const char *varString, const char *fileName, bool append ); - void exportVariables( const char *varString, Vector *names, Vector *values ); - void deleteVariables( const char *varString ); + void exportVariables(const char *varString, const char *fileName, bool append); + void exportVariables(const char *varString, Vector *names, Vector *values); + void deleteVariables(const char *varString); void setVariable(StringTableEntry name, const char *value); const char *getVariable(StringTableEntry name, bool *valid = NULL); @@ -449,19 +448,19 @@ public: } /// @see Con::addVariable - Entry* addVariable( const char *name, - S32 type, - void *dataPtr, - const char* usage ); + Entry* addVariable(const char *name, + S32 type, + void *dataPtr, + const char* usage); /// @see Con::removeVariable bool removeVariable(StringTableEntry name); /// @see Con::addVariableNotify - void addVariableNotify( const char *name, const Con::NotifyDelegate &callback ); + void addVariableNotify(const char *name, const Con::NotifyDelegate &callback); /// @see Con::removeVariableNotify - void removeVariableNotify( const char *name, const Con::NotifyDelegate &callback ); + void removeVariableNotify(const char *name, const Con::NotifyDelegate &callback); /// Return the best tab completion for prevText, with the length /// of the pre-tab string in baseLen. @@ -520,15 +519,15 @@ public: /// Puts a reference to an existing stack frame /// on the top of the stack. void pushFrameRef(S32 stackIndex); - + U32 getStackDepth() const { return mStackDepth; } - + Dictionary& getCurrentFrame() { - return *( stack[ mStackDepth - 1 ] ); + return *(stack[mStackDepth - 1]); } /// @} diff --git a/Engine/source/console/simDictionary.cpp b/Engine/source/console/simDictionary.cpp index ce923ac49..b733d9fcc 100644 --- a/Engine/source/console/simDictionary.cpp +++ b/Engine/source/console/simDictionary.cpp @@ -45,7 +45,7 @@ SimNameDictionary::~SimNameDictionary() void SimNameDictionary::insert(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; SimObject* checkForDup = find(obj->objectName); @@ -55,47 +55,47 @@ void SimNameDictionary::insert(SimObject* obj) Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - if(!hashTable) + if (!hashTable) { hashTable = new SimObject *[DefaultTableSize]; hashTableSize = DefaultTableSize; hashEntryCount = 0; - - dMemset( hashTable, 0, sizeof( *hashTable ) * DefaultTableSize ); + + dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize); } - + S32 idx = HashPointer(obj->objectName) % hashTableSize; obj->nextNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; - + // Rehash if necessary. - if( hashEntryCount > hashTableSize ) + if (hashEntryCount > hashTableSize) { // Allocate new table. - + U32 newHashTableSize = hashTableSize * 2 + 1; - SimObject** newHashTable = new SimObject *[ newHashTableSize ]; - dMemset( newHashTable, 0, sizeof( newHashTable[ 0 ] ) * newHashTableSize ); - + SimObject** newHashTable = new SimObject *[newHashTableSize]; + dMemset(newHashTable, 0, sizeof(newHashTable[0]) * newHashTableSize); + // Move entries over. - for( U32 i = 0; i < hashTableSize; ++ i ) - for( SimObject* object = hashTable[ i ]; object != NULL; ) + for (U32 i = 0; i < hashTableSize; ++i) + for (SimObject* object = hashTable[i]; object != NULL; ) { SimObject* next = object->nextNameObject; - idx = HashPointer( object->objectName ) % newHashTableSize; - object->nextNameObject = newHashTable[ idx ]; - newHashTable[ idx ] = object; - + idx = HashPointer(object->objectName) % newHashTableSize; + object->nextNameObject = newHashTable[idx]; + newHashTable[idx] = object; + object = next; } - + // Switch tables. - - delete [] hashTable; + + delete[] hashTable; hashTable = newHashTable; hashTableSize = newHashTableSize; } @@ -109,16 +109,16 @@ SimObject* SimNameDictionary::find(StringTableEntry name) { #ifndef USE_NEW_SIMDICTIONARY // NULL is a valid lookup - it will always return NULL - if(!hashTable) + if (!hashTable) return NULL; - + Mutex::lockMutex(mutex); S32 idx = HashPointer(name) % hashTableSize; SimObject *walk = hashTable[idx]; - while(walk) + while (walk) { - if(walk->objectName == name) + if (walk->objectName == name) { Mutex::unlockMutex(mutex); return walk; @@ -129,28 +129,28 @@ SimObject* SimNameDictionary::find(StringTableEntry name) Mutex::unlockMutex(mutex); return NULL; #else - Mutex::lockMutex(mutex); - StringDictDef::iterator it = root.find(name); - SimObject* f = (it == root.end() ? NULL : it->second); - Mutex::unlockMutex(mutex); - return f; + Mutex::lockMutex(mutex); + StringDictDef::iterator it = root.find(name); + SimObject* f = (it == root.end() ? NULL : it->second); + Mutex::unlockMutex(mutex); + return f; #endif } void SimNameDictionary::remove(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; - while(*walk) + while (*walk) { - if(*walk == obj) + if (*walk == obj) { *walk = obj->nextNameObject; - obj->nextNameObject = (SimObject*)-1; + obj->nextNameObject = nullptr; hashEntryCount--; Mutex::unlockMutex(mutex); @@ -164,7 +164,7 @@ void SimNameDictionary::remove(SimObject* obj) root.erase(name); #endif Mutex::unlockMutex(mutex); -} +} //---------------------------------------------------------------------------- @@ -174,8 +174,8 @@ SimManagerNameDictionary::SimManagerNameDictionary() hashTable = new SimObject *[DefaultTableSize]; hashTableSize = DefaultTableSize; hashEntryCount = 0; - - dMemset( hashTable, 0, sizeof( hashTable[ 0 ] ) * hashTableSize ); + + dMemset(hashTable, 0, sizeof(hashTable[0]) * hashTableSize); #endif mutex = Mutex::createMutex(); } @@ -190,7 +190,7 @@ SimManagerNameDictionary::~SimManagerNameDictionary() void SimManagerNameDictionary::insert(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; Mutex::lockMutex(mutex); @@ -199,34 +199,34 @@ void SimManagerNameDictionary::insert(SimObject* obj) obj->nextManagerNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; - + // Rehash if necessary. - if( hashEntryCount > hashTableSize ) + if (hashEntryCount > hashTableSize) { // Allocate new table. - + U32 newHashTableSize = hashTableSize * 2 + 1; - SimObject** newHashTable = new SimObject *[ newHashTableSize ]; - dMemset( newHashTable, 0, sizeof( newHashTable[ 0 ] ) * newHashTableSize ); - + SimObject** newHashTable = new SimObject *[newHashTableSize]; + dMemset(newHashTable, 0, sizeof(newHashTable[0]) * newHashTableSize); + // Move entries over. - for( U32 i = 0; i < hashTableSize; ++ i ) - for( SimObject* object = hashTable[ i ]; object != NULL; ) + for (U32 i = 0; i < hashTableSize; ++i) + for (SimObject* object = hashTable[i]; object != NULL; ) { SimObject* next = object->nextManagerNameObject; - idx = HashPointer( object->objectName ) % newHashTableSize; - object->nextManagerNameObject = newHashTable[ idx ]; - newHashTable[ idx ] = object; - + idx = HashPointer(object->objectName) % newHashTableSize; + object->nextManagerNameObject = newHashTable[idx]; + newHashTable[idx] = object; + object = next; } - + // Switch tables. - - delete [] hashTable; + + delete[] hashTable; hashTable = newHashTable; hashTableSize = newHashTableSize; } @@ -245,9 +245,9 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) #ifndef USE_NEW_SIMDICTIONARY S32 idx = HashPointer(name) % hashTableSize; SimObject *walk = hashTable[idx]; - while(walk) + while (walk) { - if(walk->objectName == name) + if (walk->objectName == name) { Mutex::unlockMutex(mutex); return walk; @@ -267,19 +267,19 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) void SimManagerNameDictionary::remove(SimObject* obj) { - if(!obj || !obj->objectName) + if (!obj || !obj->objectName) return; #ifndef USE_NEW_SIMDICTIONARY Mutex::lockMutex(mutex); SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; - while(*walk) + while (*walk) { - if(*walk == obj) + if (*walk == obj) { *walk = obj->nextManagerNameObject; - obj->nextManagerNameObject = (SimObject*)-1; + obj->nextManagerNameObject = nullptr; hashEntryCount--; Mutex::unlockMutex(mutex); @@ -293,7 +293,7 @@ void SimManagerNameDictionary::remove(SimObject* obj) root.erase(name); #endif Mutex::unlockMutex(mutex); -} +} //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- @@ -301,7 +301,7 @@ void SimManagerNameDictionary::remove(SimObject* obj) SimIdDictionary::SimIdDictionary() { #ifndef USE_NEW_SIMDICTIONARY - dMemset( table, 0, sizeof( table[ 0 ] ) * DefaultTableSize ); + dMemset(table, 0, sizeof(table[0]) * DefaultTableSize); #endif mutex = Mutex::createMutex(); } @@ -322,7 +322,7 @@ void SimIdDictionary::insert(SimObject* obj) #ifndef USE_NEW_SIMDICTIONARY S32 idx = obj->getId() & TableBitMask; obj->nextIdObject = table[idx]; - AssertFatal( obj->nextIdObject != obj, "SimIdDictionary::insert - Creating Infinite Loop linking to self!" ); + AssertFatal(obj->nextIdObject != obj, "SimIdDictionary::insert - Creating Infinite Loop linking to self!"); table[idx] = obj; #else root[obj->getId()] = obj; @@ -336,9 +336,9 @@ SimObject* SimIdDictionary::find(S32 id) #ifndef USE_NEW_SIMDICTIONARY S32 idx = id & TableBitMask; SimObject *walk = table[idx]; - while(walk) + while (walk) { - if(walk->getId() == U32(id)) + if (walk->getId() == U32(id)) { Mutex::unlockMutex(mutex); return walk; @@ -364,9 +364,9 @@ void SimIdDictionary::remove(SimObject* obj) Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY SimObject **walk = &table[obj->getId() & TableBitMask]; - while(*walk && *walk != obj) + while (*walk && *walk != obj) walk = &((*walk)->nextIdObject); - if(*walk) + if (*walk) *walk = obj->nextIdObject; #else root.erase(obj->getId()); diff --git a/Engine/source/console/simFieldDictionary.cpp b/Engine/source/console/simFieldDictionary.cpp index 7cf3deb94..2deb56bf9 100644 --- a/Engine/source/console/simFieldDictionary.cpp +++ b/Engine/source/console/simFieldDictionary.cpp @@ -32,79 +32,60 @@ #include "console/consoleInternal.h" #include "core/frameAllocator.h" -SimFieldDictionary::Entry *SimFieldDictionary::smFreeList = NULL; - -static Chunker fieldChunker; - -U32 SimFieldDictionary::getHashValue( StringTableEntry slotName ) +U32 SimFieldDictionary::getHashValue(StringTableEntry slotName) { - return HashPointer( slotName ) % HashTableSize; + return HashPointer(slotName) % HashTableSize; } -U32 SimFieldDictionary::getHashValue( const String& fieldName ) +U32 SimFieldDictionary::getHashValue(const String& fieldName) { - return getHashValue( StringTable->insert( fieldName ) ); + return getHashValue(StringTable->insert(fieldName)); } -SimFieldDictionary::Entry *SimFieldDictionary::addEntry( U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value ) +SimFieldDictionary::Entry *SimFieldDictionary::addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value) { - Entry* ret; - if(smFreeList) - { - ret = smFreeList; - smFreeList = ret->next; - } - else - ret = fieldChunker.alloc(); + Entry ret; + ret.slotName = slotName; + ret.type = type; + ret.value = value; - ret->next = mHashTable[ bucket ]; - ret->slotName = slotName; - ret->type = type; - ret->value = value; + mNumFields++; + mVersion++; - mHashTable[ bucket ] = ret; - mNumFields ++; - mVersion ++; - - return ret; + mHashTable[bucket].push_back(std::move(ret)); + return &mHashTable[bucket].back(); } void SimFieldDictionary::freeEntry(SimFieldDictionary::Entry *ent) { - ent->next = smFreeList; - smFreeList = ent; + auto &vec = mHashTable[getHashValue(ent->slotName)]; - mNumFields --; + // Find the slot. + auto iter = std::find_if(vec.begin(), vec.end(), [&](const Entry &ref) -> bool { + return ref.slotName == ent->slotName; + }); + if (iter != vec.end()) + { + vec.erase(iter); + mNumFields--; + } } SimFieldDictionary::SimFieldDictionary() -: mNumFields( 0 ), - mVersion( 0 ) + : mNumFields(0), + mVersion(0) { - dMemset( mHashTable, 0, sizeof( mHashTable ) ); + } SimFieldDictionary::~SimFieldDictionary() { - for(U32 i = 0; i < HashTableSize; i++) - { - for(Entry *walk = mHashTable[i]; walk;) - { - Entry *temp = walk; - walk = temp->next; - if( temp->value ) - dFree(temp->value); - freeEntry(temp); - } - } - - AssertFatal( mNumFields == 0, "Incorrect count on field dictionary" ); } void SimFieldDictionary::setFieldType(StringTableEntry slotName, const char *typeString) { - ConsoleBaseType *cbt = ConsoleBaseType::getTypeByName( typeString ); + ConsoleBaseType *cbt = ConsoleBaseType::getTypeByName(typeString); setFieldType(slotName, cbt); } @@ -117,56 +98,66 @@ void SimFieldDictionary::setFieldType(StringTableEntry slotName, const U32 typeI void SimFieldDictionary::setFieldType(StringTableEntry slotName, ConsoleBaseType *type) { // If the field exists on the object, set the type - U32 bucket = getHashValue( slotName ); + U32 bucket = getHashValue(slotName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) + for (Entry &ref : mHashTable[bucket]) { - if( walk->slotName == slotName ) + if (ref.slotName == slotName) { // Found and type assigned, let's bail - walk->type = type; + ref.type = type; return; } } // Otherwise create the field, and set the type. Assign a null value. - addEntry( bucket, slotName, type ); + addEntry(bucket, slotName, type); } U32 SimFieldDictionary::getFieldType(StringTableEntry slotName) const { - U32 bucket = getHashValue( slotName ); + U32 bucket = getHashValue(slotName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) - if( walk->slotName == slotName ) - return walk->type ? walk->type->getTypeID() : TypeString; + const std::vector &vec = mHashTable[bucket]; + size_t size = vec.size(); + for (size_t i = 0; i < size; ++i) + { + const Entry &ref = vec[i]; + if (ref.slotName == slotName) + return ref.type ? ref.type->getTypeID() : TypeString; + } return TypeString; } SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(const String &fieldName) const { - U32 bucket = getHashValue( fieldName ); + U32 bucket = getHashValue(fieldName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) + const std::vector &vec = mHashTable[bucket]; + size_t size = vec.size(); + for (size_t i = 0; i < size; ++i) { - if( fieldName.equal(walk->slotName, String::NoCase) ) - return walk; + const Entry &ref = vec[i]; + if (fieldName.equal(ref.slotName, String::NoCase)) + return const_cast(&ref); } return NULL; } -SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField( StringTableEntry fieldName) const +SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(StringTableEntry fieldName) const { - U32 bucket = getHashValue( fieldName ); + U32 bucket = getHashValue(fieldName); - for( Entry *walk = mHashTable[bucket]; walk; walk = walk->next ) + const std::vector &vec = mHashTable[bucket]; + size_t size = vec.size(); + for (size_t i = 0; i < size; ++i) { - if( walk->slotName == fieldName ) - { - return walk; - } + if (vec[i].slotName == fieldName) + { + return const_cast(&vec[i]); + } } return NULL; @@ -176,45 +167,43 @@ SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField( StringTableEntr void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *value) { U32 bucket = getHashValue(slotName); - Entry **walk = &mHashTable[bucket]; - while(*walk && (*walk)->slotName != slotName) - walk = &((*walk)->next); - Entry *field = *walk; - if( !value || !*value ) + for (Entry &ref : mHashTable[bucket]) { - if(field) + if (ref.slotName == slotName) { - mVersion++; + if (!value || !*value) + { + mVersion++; - if( field->value ) - dFree(field->value); + if (ref.value) + dFree(ref.value); - *walk = field->next; - freeEntry(field); + freeEntry(&ref); + } + else + { + if (ref.value) + dFree(ref.value); + + ref.value = dStrdup(value); + } + + return; } } - else - { - if(field) - { - if( field->value ) - dFree(field->value); - field->value = dStrdup(value); - } - else - addEntry( bucket, slotName, 0, dStrdup( value ) ); - } + // no field, add entry. + addEntry(bucket, slotName, 0, dStrdup(value)); } const char *SimFieldDictionary::getFieldValue(StringTableEntry slotName) { U32 bucket = getHashValue(slotName); - for(Entry *walk = mHashTable[bucket];walk;walk = walk->next) - if(walk->slotName == slotName) - return walk->value; + for (const Entry &ref : mHashTable[bucket]) + if (ref.slotName == slotName) + return ref.value; return NULL; } @@ -223,43 +212,43 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict) { mVersion++; - for(U32 i = 0; i < HashTableSize; i++) + for (U32 i = 0; i < HashTableSize; i++) { - for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) + for (const Entry &ref : mHashTable[i]) { - setFieldValue(walk->slotName, walk->value); - setFieldType(walk->slotName, walk->type); + setFieldValue(ref.slotName, ref.value); + setFieldType(ref.slotName, ref.type); } } } -static S32 QSORT_CALLBACK compareEntries(const void* a,const void* b) +static S32 QSORT_CALLBACK compareEntries(const void* a, const void* b) { - SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a); - SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b); + const SimFieldDictionary::Entry *fa = reinterpret_cast(a); + const SimFieldDictionary::Entry *fb = reinterpret_cast(b); return dStricmp(fa->slotName, fb->slotName); } void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop) { const AbstractClassRep::FieldList &list = obj->getFieldList(); - Vector flist(__FILE__, __LINE__); + Vector flist(__FILE__, __LINE__); - for(U32 i = 0; i < HashTableSize; i++) + for (U32 i = 0; i < HashTableSize; i++) { - for(Entry *walk = mHashTable[i];walk; walk = walk->next) + for (const Entry &walk : mHashTable[i]) { // make sure we haven't written this out yet: - U32 i; - for(i = 0; i < list.size(); i++) - if(list[i].pFieldname == walk->slotName) + U32 j; + for (j = 0; j < list.size(); j++) + if (list[j].pFieldname == walk.slotName) break; - if(i != list.size()) + if (j != list.size()) continue; - if (!obj->writeField(walk->slotName, walk->value)) + if (!obj->writeField(walk.slotName, walk.value)) continue; flist.push_back(walk); @@ -267,23 +256,23 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop } // Sort Entries to prevent version control conflicts - dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries); + dQsort(flist.address(), flist.size(), sizeof(Entry), compareEntries); // Save them out - for(Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) + for (const Entry &ref : flist) { - U32 nBufferSize = (dStrlen( (*itr)->value ) * 2) + dStrlen( (*itr)->slotName ) + 16; - FrameTemp expandedBuffer( nBufferSize ); + U32 nBufferSize = (dStrlen(ref.value) * 2) + dStrlen(ref.slotName) + 16; + FrameTemp expandedBuffer(nBufferSize); - stream.writeTabs(tabStop+1); + stream.writeTabs(tabStop + 1); - const char *typeName = (*itr)->type && (*itr)->type->getTypeID() != TypeString ? (*itr)->type->getTypeName() : ""; - dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", (*itr)->slotName); - if ( (*itr)->value ) - expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value); + const char *typeName = ref.type && ref.type->getTypeID() != TypeString ? ref.type->getTypeName() : ""; + dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", ref.slotName); + if (ref.value) + expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), ref.value); dStrcat(expandedBuffer, "\";\r\n"); - stream.write(dStrlen(expandedBuffer),expandedBuffer); + stream.write(dStrlen(expandedBuffer), expandedBuffer); } } @@ -291,44 +280,44 @@ void SimFieldDictionary::printFields(SimObject *obj) { const AbstractClassRep::FieldList &list = obj->getFieldList(); char expandedBuffer[4096]; - Vector flist(__FILE__, __LINE__); + Vector flist(__FILE__, __LINE__); - for(U32 i = 0; i < HashTableSize; i++) + for (U32 i = 0; i < HashTableSize; i++) { - for(Entry *walk = mHashTable[i];walk; walk = walk->next) + for (const Entry &walk : mHashTable[i]) { // make sure we haven't written this out yet: - U32 i; - for(i = 0; i < list.size(); i++) - if(list[i].pFieldname == walk->slotName) + U32 j; + for (j = 0; j < list.size(); j++) + if (list[i].pFieldname == walk.slotName) break; - if(i != list.size()) + if (j != list.size()) continue; flist.push_back(walk); } } - dQsort(flist.address(),flist.size(),sizeof(Entry *),compareEntries); + dQsort(flist.address(), flist.size(), sizeof(Entry), compareEntries); - for(Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) + for (const Entry &ref : flist) { const char* type = "string"; - if( ( *itr )->type ) - type = ( *itr )->type->getTypeClassName(); - - dSprintf( expandedBuffer, sizeof( expandedBuffer ), " %s %s = \"", type, ( *itr )->slotName ); - if ( (*itr)->value ) - expandEscape(expandedBuffer + dStrlen(expandedBuffer), (*itr)->value); + if (ref.type) + type = ref.type->getTypeClassName(); + + dSprintf(expandedBuffer, sizeof(expandedBuffer), " %s %s = \"", type, ref.slotName); + if (ref.value) + expandEscape(expandedBuffer + dStrlen(expandedBuffer), ref.value); Con::printf("%s\"", expandedBuffer); } } SimFieldDictionary::Entry *SimFieldDictionary::operator[](U32 index) { - AssertFatal ( index < mNumFields, "out of range" ); + AssertFatal(index < mNumFields, "out of range"); - if ( index > mNumFields ) + if (index > mNumFields) return NULL; SimFieldDictionaryIterator itr(this); @@ -343,29 +332,44 @@ SimFieldDictionary::Entry *SimFieldDictionary::operator[](U32 index) SimFieldDictionaryIterator::SimFieldDictionaryIterator(SimFieldDictionary * dictionary) { mDictionary = dictionary; - mHashIndex = -1; - mEntry = 0; + mHashIndex = 0; + mVecIndex = -1; // -1 since we immediately call operator++ + mEntry = NULL; operator++(); } SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator++() { - if(!mDictionary) - return(mEntry); + if (!mDictionary || mHashIndex >= SimFieldDictionary::HashTableSize) + { + mEntry = NULL; + return NULL; + } - if(mEntry) - mEntry = mEntry->next; + std::vector &vec = mDictionary->mHashTable[mHashIndex]; - while(!mEntry && (mHashIndex < (SimFieldDictionary::HashTableSize-1))) - mEntry = mDictionary->mHashTable[++mHashIndex]; + while (vec.size() == 0 && mHashIndex < (SimFieldDictionary::HashTableSize - 1)) + { + vec = mDictionary->mHashTable[++mHashIndex]; + mVecIndex = 0; + } - return(mEntry); + if (mVecIndex >= vec.size() || mHashIndex >= SimFieldDictionary::HashTableSize) + { + mEntry = NULL; + return NULL; + } + + mEntry = &vec[mVecIndex]; + ++mVecIndex; + return mEntry; } SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator*() { - return(mEntry); + return mEntry; } + // A variation of the stock SimFieldDictionary::setFieldValue(), this method adds the // argument which, when true, prohibits the replacement of fields that // already have a value. @@ -385,15 +389,15 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va return; U32 bucket = getHashValue(slotName); - Entry **walk = &mHashTable[bucket]; - while(*walk && (*walk)->slotName != slotName) - walk = &((*walk)->next); + for (const Entry &walk : mHashTable[bucket]) + { + if (walk.slotName == slotName) + { + return; + } + } - Entry *field = *walk; - if (field) - return; - - addEntry( bucket, slotName, type, dStrdup( value ) ); + addEntry(bucket, slotName, type, dStrdup(value)); } // A variation of the stock SimFieldDictionary::assignFrom(), this method adds // and arguments. When true, prohibits the replacement of fields that already @@ -412,15 +416,23 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict, const char* filter if (filter_len == 0) { - for(U32 i = 0; i < HashTableSize; i++) - for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) - setFieldValue(walk->slotName, walk->value, walk->type, no_replace); + for (U32 i = 0; i < HashTableSize; i++) + { + for (const Entry &walk : dict->mHashTable[i]) + { + setFieldValue(walk.slotName, walk.value, walk.type, no_replace); + } + } } else { - for(U32 i = 0; i < HashTableSize; i++) - for(Entry *walk = dict->mHashTable[i];walk; walk = walk->next) - if (dStrncmp(walk->slotName, filter, filter_len) == 0) - setFieldValue(walk->slotName, walk->value, walk->type, no_replace); + for (U32 i = 0; i < HashTableSize; i++) + { + for (const Entry &walk : dict->mHashTable[i]) + { + if (dStrncmp(walk.slotName, filter, filter_len) == 0) + setFieldValue(walk.slotName, walk.value, walk.type, no_replace); + } + } } -} +} \ No newline at end of file diff --git a/Engine/source/console/simFieldDictionary.h b/Engine/source/console/simFieldDictionary.h index 4849be563..4c9d86e4e 100644 --- a/Engine/source/console/simFieldDictionary.h +++ b/Engine/source/console/simFieldDictionary.h @@ -32,6 +32,9 @@ class ConsoleBaseType; class SimObject; +#include +#include + #include "core/stringTable.h" #include "core/stream/stream.h" @@ -47,27 +50,26 @@ class SimFieldDictionary public: struct Entry { - Entry() : type( NULL ) {}; + Entry() : type(NULL) {}; StringTableEntry slotName; char *value; - Entry *next; ConsoleBaseType *type; }; enum { HashTableSize = 19 }; - Entry *mHashTable[HashTableSize]; + //Entry *mHashTable[HashTableSize]; + + std::vector mHashTable[HashTableSize]; private: - static Entry *smFreeList; - void freeEntry(Entry *entry); - Entry* addEntry( U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value = 0 ); + Entry* addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value = 0); - static U32 getHashValue( StringTableEntry slotName ); - static U32 getHashValue( const String& fieldName ); + static U32 getHashValue(StringTableEntry slotName); + static U32 getHashValue(const String& fieldName); U32 mNumFields; @@ -88,7 +90,7 @@ public: const char *getFieldValue(StringTableEntry slotName); U32 getFieldType(StringTableEntry slotName) const; Entry *findDynamicField(const String &fieldName) const; - Entry *findDynamicField( StringTableEntry fieldName) const; + Entry *findDynamicField(StringTableEntry fieldName) const; void writeFields(SimObject *obj, Stream &strem, U32 tabStop); void printFields(SimObject *obj); void assignFrom(SimFieldDictionary *dict); @@ -103,6 +105,7 @@ class SimFieldDictionaryIterator { SimFieldDictionary * mDictionary; S32 mHashIndex; + S32 mVecIndex; SimFieldDictionary::Entry * mEntry; public: diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index c12a12f19..0583606b0 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -72,8 +72,8 @@ SimObject::SimObject() objectName = NULL; mOriginalName = NULL; mInternalName = NULL; - nextNameObject = (SimObject*)-1; - nextManagerNameObject = (SimObject*)-1; + nextNameObject = nullptr; + nextManagerNameObject = nullptr; nextIdObject = NULL; mFilename = NULL; @@ -86,6 +86,8 @@ SimObject::SimObject() mNotifyList = NULL; mFlags.set( ModStaticFields | ModDynamicFields ); + mProgenitorFile = StringTable->EmptyString(); + mFieldDictionary = NULL; mCanSaveFieldDictionary = true; @@ -122,10 +124,10 @@ SimObject::~SimObject() if( mCopySource ) mCopySource->unregisterReference( &mCopySource ); - AssertFatal(nextNameObject == (SimObject*)-1,avar( + AssertFatal(nextNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from dictionary: name %s, id %i", objectName, mId)); - AssertFatal(nextManagerNameObject == (SimObject*)-1,avar( + AssertFatal(nextManagerNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from manager dictionary: name %s, id %i", objectName,mId)); AssertFatal(mFlags.test(Added) == 0, "SimObject::object " diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index 21e1e3d0b..762edcb94 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -774,18 +774,18 @@ void Taml::compileDynamicFields( TamlWriteNode* pTamlWriteNode ) // Fetch field count. const U32 fieldCount = fieldList.size(); - Vector dynamicFieldList(__FILE__, __LINE__); + Vector dynamicFieldList(__FILE__, __LINE__); // Ensure the dynamic field doesn't conflict with static field. for( U32 hashIndex = 0; hashIndex < SimFieldDictionary::HashTableSize; ++hashIndex ) { - for( SimFieldDictionary::Entry* pEntry = pFieldDictionary->mHashTable[hashIndex]; pEntry; pEntry = pEntry->next ) - { + for (const SimFieldDictionary::Entry &pEntry : pFieldDictionary->mHashTable[hashIndex]) + { // Iterate static fields. U32 fieldIndex; for( fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex ) { - if( fieldList[fieldIndex].pFieldname == pEntry->slotName) + if (fieldList[fieldIndex].pFieldname == pEntry.slotName) break; } @@ -794,7 +794,7 @@ void Taml::compileDynamicFields( TamlWriteNode* pTamlWriteNode ) continue; // Skip if not writing field. - if ( !pSimObject->writeField( pEntry->slotName, pEntry->value) ) + if (!pSimObject->writeField(pEntry.slotName, pEntry.value)) continue; dynamicFieldList.push_back( pEntry ); @@ -803,17 +803,14 @@ void Taml::compileDynamicFields( TamlWriteNode* pTamlWriteNode ) // Sort Entries to prevent version control conflicts if ( dynamicFieldList.size() > 1 ) - dQsort(dynamicFieldList.address(), dynamicFieldList.size(), sizeof(SimFieldDictionary::Entry*), compareFieldEntries); + dQsort(dynamicFieldList.address(), dynamicFieldList.size(), sizeof(SimFieldDictionary::Entry), compareFieldEntries); // Save the fields. - for( Vector::iterator entryItr = dynamicFieldList.begin(); entryItr != dynamicFieldList.end(); ++entryItr ) + for (const SimFieldDictionary::Entry &pEntry : dynamicFieldList) { - // Fetch entry. - SimFieldDictionary::Entry* pEntry = *entryItr; - - // Save field/value. - TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair( pEntry->slotName, pEntry->value ); - pTamlWriteNode->mFields.push_back( pFieldValuePair ); + // Save field/value. + TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(pEntry.slotName, pEntry.value); + pTamlWriteNode->mFields.push_back(pFieldValuePair); } } From 2ca6af8e4843a76add7094b11853a1cae9e7fc21 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 11 Nov 2017 01:21:48 -0600 Subject: [PATCH 055/312] Refactors the Popup menus and GuiMenuBars to remove unneeded duplication and platform-specific/deprecated code. --- Engine/source/gui/core/guiCanvas.cpp | 61 +- Engine/source/gui/core/guiCanvas.h | 1 + Engine/source/gui/editor/guiMenuBar.cpp | 912 ++--- Engine/source/gui/editor/guiMenuBar.h | 172 +- Engine/source/gui/editor/guiPopupMenuCtrl.cpp | 106 +- Engine/source/gui/editor/guiPopupMenuCtrl.h | 18 +- Engine/source/gui/editor/popupMenu.cpp | 506 +++ .../menus => gui/editor}/popupMenu.h | 119 +- Engine/source/platform/menus/menuBar.cpp | 127 - Engine/source/platform/menus/menuBar.h | 71 - Engine/source/platform/menus/popupMenu.cpp | 269 -- .../menus/PlatformSDLPopupMenuData.h | 35 - .../menus/guiPlatformGenericMenuBar.h | 51 - .../source/platformSDL/menus/menuBarSDL.cpp | 200 -- .../source/platformSDL/menus/popupMenuSDL.cpp | 393 --- .../platformWin32/menus/menuBarWin32.cpp | 177 - .../platformWin32/menus/popupMenuWin32.cpp | 746 ---- Engine/source/windowManager/sdl/sdlWindow.cpp | 1 - .../BaseGame/game/tools/gui/guiDialogs.ed.cs | 1 - .../tools/gui/guiPlatformGenericMenubar.ed.cs | 19 - .../gui/guiPlatformGenericMenubar.ed.gui | 14 - .../guiEditor/scripts/guiEditorCanvas.ed.cs | 6 +- .../tools/worldEditor/scripts/EditorGui.ed.cs | 2 +- .../tools/worldEditor/scripts/menus.ed.cs | 31 +- .../Full/game/tools/gui/guiDialogs.ed.cs | 1 - .../tools/gui/guiPlatformGenericMenubar.ed.cs | 19 - .../gui/guiPlatformGenericMenubar.ed.gui | 14 - .../guiEditor/scripts/guiEditorCanvas.ed.cs | 6 +- .../tools/worldEditor/scripts/EditorGui.ed.cs | 3135 ++--------------- 29 files changed, 1343 insertions(+), 5870 deletions(-) create mode 100644 Engine/source/gui/editor/popupMenu.cpp rename Engine/source/{platform/menus => gui/editor}/popupMenu.h (69%) delete mode 100644 Engine/source/platform/menus/menuBar.cpp delete mode 100644 Engine/source/platform/menus/menuBar.h delete mode 100644 Engine/source/platform/menus/popupMenu.cpp delete mode 100644 Engine/source/platformSDL/menus/PlatformSDLPopupMenuData.h delete mode 100644 Engine/source/platformSDL/menus/guiPlatformGenericMenuBar.h delete mode 100644 Engine/source/platformSDL/menus/menuBarSDL.cpp delete mode 100644 Engine/source/platformSDL/menus/popupMenuSDL.cpp delete mode 100644 Engine/source/platformWin32/menus/menuBarWin32.cpp delete mode 100644 Engine/source/platformWin32/menus/popupMenuWin32.cpp delete mode 100644 Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.cs delete mode 100644 Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.gui delete mode 100644 Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.cs delete mode 100644 Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.gui diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 82c0475f0..5202e57bf 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -276,8 +276,6 @@ bool GuiCanvas::onAdd() // Define the menu bar for this canvas (if any) Con::executef(this, "onCreateMenu"); - Sim::findObject("PlatformGenericMenubar", mMenuBarCtrl); - return parentRet; } @@ -302,21 +300,39 @@ void GuiCanvas::setMenuBar(SimObject *obj) Parent::removeObject( oldMenuBar ); // set new menubar - if( mMenuBarCtrl ) - Parent::addObject(mMenuBarCtrl); + if (mMenuBarCtrl) + { + //Add a wrapper control so that the menubar sizes correctly + GuiControlProfile* profile; + Sim::findObject("GuiModelessDialogProfile", profile); + + if (!profile) + { + Con::errorf("GuiCanvas::setMenuBar: Unable to find the GuiModelessDialogProfile profile!"); + return; + } + + GuiControl* menuBackground = new GuiControl(); + menuBackground->registerObject(); + + menuBackground->setControlProfile(profile); + + menuBackground->addObject(mMenuBarCtrl); + + Parent::addObject(menuBackground); + } // update window accelerator keys if( oldMenuBar != mMenuBarCtrl ) { - StringTableEntry ste = StringTable->insert("menubar"); - GuiMenuBar* menu = NULL; - menu = !oldMenuBar ? NULL : dynamic_cast(oldMenuBar->findObjectByInternalName( ste, true)); - if( menu ) - menu->removeWindowAcceleratorMap( *getPlatformWindow()->getInputGenerator() ); + GuiMenuBar* oldMenu = dynamic_cast(oldMenuBar); + GuiMenuBar* newMenu = dynamic_cast(mMenuBarCtrl); - menu = !mMenuBarCtrl ? NULL : dynamic_cast(mMenuBarCtrl->findObjectByInternalName( ste, true)); - if( menu ) - menu->buildWindowAcceleratorMap( *getPlatformWindow()->getInputGenerator() ); + if(oldMenu) + oldMenu->removeWindowAcceleratorMap(*getPlatformWindow()->getInputGenerator()); + + if(newMenu) + newMenu->buildWindowAcceleratorMap(*getPlatformWindow()->getInputGenerator()); } } @@ -1633,27 +1649,26 @@ void GuiCanvas::maintainSizing() Point2I newPos = screenRect.point; // if menubar is active displace content gui control - if( mMenuBarCtrl && (ctrl == getContentControl()) ) - { - const SimObject *menu = mMenuBarCtrl->findObjectByInternalName( StringTable->insert("menubar"), true); + if (mMenuBarCtrl && (ctrl == getContentControl())) + { + /*const SimObject *menu = mMenuBarCtrl->findObjectByInternalName( StringTable->insert("menubar"), true); - if( !menu ) - continue; + if( !menu ) + continue; - AssertFatal( dynamic_cast(menu), ""); + AssertFatal( dynamic_cast(menu), "");*/ - const U32 yOffset = static_cast(menu)->getExtent().y; - newPos.y += yOffset; - newExt.y -= yOffset; + const U32 yOffset = static_cast(mMenuBarCtrl)->mMenubarHeight; + newPos.y += yOffset; + newExt.y -= yOffset; } - if(pos != newPos || ext != newExt) + if (pos != newPos || ext != newExt) { ctrl->resize(newPos, newExt); resetUpdateRegions(); } } - } void GuiCanvas::setupFences() diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index dfc98da38..b193bfbf1 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -210,6 +210,7 @@ public: virtual void onRemove(); void setMenuBar(SimObject *obj); + SimObject* getMenuBar() { return mMenuBarCtrl; } static void initPersistFields(); diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index 688531a87..0fe8c3c71 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -142,24 +142,11 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char "@see GuiTickCtrl\n\n" ); -IMPLEMENT_CALLBACK( GuiMenuBar, onSubmenuSelect, void, ( S32 submenuId, const char* submenuText ),( submenuId, submenuText ), - "@brief Called whenever a submenu is selected.\n\n" - "@param submenuId Id of the selected submenu\n" - "@param submenuText Text of the selected submenu\n\n" - "@tsexample\n" - "GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText)\n" - "{\n" - " // Code to run when the callback occurs\n" - "}\n" - "@endtsexample\n\n" - "@see GuiTickCtrl\n\n" -); - //------------------------------------------------------------------------------ // console methods //------------------------------------------------------------------------------ -DefineEngineMethod( GuiMenuBar, clearMenus, void, (),, +/*DefineEngineMethod( GuiMenuBar, clearMenus, void, (),, "@brief Clears all the menus from the menu bar.\n\n" "@tsexample\n" "// Inform the GuiMenuBar control to clear all menus from itself.\n" @@ -818,14 +805,14 @@ GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu) { U32 id = dAtoi(menu); for (U32 i = 0; i < mMenuList.size(); ++i) - if (id == mMenuList[i]->id) + if (id == mMenuList[i].id) return mMenuList[i]; return NULL; } else { for (U32 i = 0; i < mMenuList.size(); ++i) - if (!dStricmp(menu, mMenuList[i]->text)) + if (!dStricmp(menu, mMenuList[i].text)) return mMenuList[i]; return NULL; } @@ -1093,19 +1080,18 @@ void GuiMenuBar::clearSubmenuItems(MenuItem *menuitem) while(menuitem->submenu->firstMenuItem) removeSubmenuItem(menuitem, menuitem->submenu->firstMenuItem); } - +*/ //------------------------------------------------------------------------------ // initialization, input and render methods //------------------------------------------------------------------------------ GuiMenuBar::GuiMenuBar() { - mMenuList.clear(); + //mMenuList.clear(); menuBarDirty = true; mouseDownMenu = NULL; mouseOverMenu = NULL; mCurAcceleratorIndex = 0; - mBackground = NULL; mPadding = 0; mCheckmarkBitmapIndex = 0; // Default to the first image in the bitmap array for the check mark @@ -1114,21 +1100,28 @@ GuiMenuBar::GuiMenuBar() mVerticalMargin = 1; // Default number of pixels on the top and bottom of a menu's text mBitmapMargin = 2; // Default number of pixels between a menu's bitmap and text + mMenubarHeight = 20; + // Added: mouseDownSubmenu = NULL; mouseOverSubmenu = NULL; - mSubmenuBackground = NULL; - mSubmenuTextList = NULL; - mMouseOverCounter = 0; - mCountMouseOver = false; - mMouseHoverAmount = 30; + + mMouseInMenu = false; + setProcessTicks(false); } +void GuiMenuBar::onRemove() +{ + Parent::onRemove(); +} + void GuiMenuBar::initPersistFields() { addField("padding", TypeS32, Offset( mPadding, GuiMenuBar ),"Extra padding to add to the bounds of the control.\n"); + addField("menubarHeight", TypeS32, Offset(mMenubarHeight, GuiMenuBar), "Sets the height of the menubar when attached to the canvas.\n"); + Parent::initPersistFields(); } @@ -1153,52 +1146,75 @@ bool GuiMenuBar::onWake() return true; } -GuiMenuBar::Menu *GuiMenuBar::findHitMenu(Point2I mousePoint) +void GuiMenuBar::addObject(SimObject* object) +{ + PopupMenu* popup = dynamic_cast(object); + + if (!popup) + { + //if it's not a popup, handle it normally + Parent::addObject(object); + } + else + { + //otherwise, if it IS a popup, don't add it as a child object, but instead just insert it as a menu entry + insert(object, -1); + } +} + +GuiMenuBar::MenuEntry *GuiMenuBar::findHitMenu(Point2I mousePoint) { Point2I pos = globalToLocalCoord(mousePoint); for (U32 i = 0; i < mMenuList.size(); ++i) - if (mMenuList[i]->visible && mMenuList[i]->bounds.pointInRect(pos)) - return mMenuList[i]; + { + if (mMenuList[i].visible && mMenuList[i].bounds.pointInRect(pos)) + return &mMenuList[i]; + } + return NULL; } void GuiMenuBar::onPreRender() { + setHeight(mMenubarHeight); + Parent::onPreRender(); - if(menuBarDirty) + if (menuBarDirty) { menuBarDirty = false; U32 curX = mPadding; for (U32 i = 0; i < mMenuList.size(); ++i) { - if (!mMenuList[i]->visible) + if (!mMenuList[i].visible) continue; - // Bounds depends on if there is a bitmap to be drawn or not - if (mMenuList[i]->bitmapIndex == -1) - { - // Text only - mMenuList[i]->bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2)); - - } else - { - // Will the bitmap and text be draw? - if (!mMenuList[i]->drawBitmapOnly) + // Bounds depends on if there is a bitmap to be drawn or not + if (mMenuList[i].bitmapIndex == -1) { + // Text only + mMenuList[i].bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i].text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2)); + + } + else + { + // Will the bitmap and text be draw? + if (!mMenuList[i].drawBitmapOnly) + { // Draw the bitmap and the text RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); - mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); + mMenuList[i].bounds.set(curX, 0, bitmapBounds[mMenuList[i].bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i].text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); - } else - { + } + else + { // Only the bitmap will be drawn RectI *bitmapBounds = mProfile->mBitmapArrayRects.address(); - mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); + mMenuList[i].bounds.set(curX, 0, bitmapBounds[mMenuList[i].bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2)); + } } - } - curX += mMenuList[i]->bounds.extent.x; + curX += mMenuList[i].bounds.extent.x; } mouseOverMenu = NULL; mouseDownMenu = NULL; @@ -1207,12 +1223,12 @@ void GuiMenuBar::onPreRender() void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event) { - Menu *hit = findHitMenu(event.mousePoint); + MenuEntry *hit = findHitMenu(event.mousePoint); if(hit && hit != mouseDownMenu) { // gotta close out the current menu... - mTextList->setSelectedCell(Point2I(-1, -1)); - closeMenu(); + mouseDownMenu->popupMenu->hidePopup(); + mouseOverMenu = mouseDownMenu = hit; setUpdate(); onAction(); @@ -1221,87 +1237,63 @@ void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event) void GuiMenuBar::onMouseMove(const GuiEvent &event) { - Menu *hit = findHitMenu(event.mousePoint); - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) - mMouseOverCounter = 0; - if(!mCountMouseOver) - { - // We've never started the counter, so start it. - if(hit) - mCountMouseOver = true; - } + MenuEntry *hit = findHitMenu(event.mousePoint); - mouseOverMenu = hit; + if (mouseDownMenu != nullptr && hit != nullptr) + { + //we have a standing click, so just update and go + mouseDownMenu = mouseOverMenu = hit; setUpdate(); + onAction(); + + return; } + + mouseOverMenu = hit; + setUpdate(); +} + +void GuiMenuBar::onMouseEnter(const GuiEvent &event) +{ + onMouseInMenu_callback(true); + mMouseInMenu = true; } void GuiMenuBar::onMouseLeave(const GuiEvent &event) { if(mouseOverMenu) setUpdate(); - mouseOverMenu = NULL; - // As we've left the control, don't track how long the mouse has been - // within it. - if(mCountMouseOver && mMouseOverCounter >= mMouseHoverAmount) - { - onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu - } - mCountMouseOver = false; - mMouseOverCounter = 0; + mouseOverMenu = NULL; + mMouseInMenu = false; } void GuiMenuBar::onMouseDragged(const GuiEvent &event) { - Menu *hit = findHitMenu(event.mousePoint); - - if(hit != mouseOverMenu) - { - // If we need to, reset the mouse over menu counter and indicate - // that we should track it. - if(hit) - mMouseOverCounter = 0; - if(!mCountMouseOver) - { - // We've never started the counter, so start it. - if(hit) - mCountMouseOver = true; - } - - mouseOverMenu = hit; - mouseDownMenu = hit; - setUpdate(); - onAction(); - } } void GuiMenuBar::onMouseDown(const GuiEvent &event) +{ +} + +void GuiMenuBar::onMouseUp(const GuiEvent &event) { mouseDownMenu = mouseOverMenu = findHitMenu(event.mousePoint); setUpdate(); onAction(); } -void GuiMenuBar::onMouseUp(const GuiEvent &event) -{ - mouseDownMenu = NULL; - setUpdate(); -} - void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) { - RectI ctrlRect(offset, getExtent()); + Point2I extent = getExtent(); + + RectI ctrlRect(offset, extent); GFXDrawUtil* drawUtil = GFX->getDrawUtil(); //if opaque, fill the update rect with the fill color if (mProfile->mOpaque) - drawUtil->drawRectFill(RectI(offset, getExtent()), mProfile->mFillColor); + drawUtil->drawRectFill(RectI(offset, extent), mProfile->mFillColor); //if there's a border, draw the border if (mProfile->mBorder) @@ -1309,63 +1301,65 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect) for (U32 i = 0; i < mMenuList.size(); ++i) { - if (!mMenuList[i]->visible) + if (!mMenuList[i].visible) continue; + ColorI fontColor = mProfile->mFontColor; - RectI bounds = mMenuList[i]->bounds; + RectI bounds = mMenuList[i].bounds; bounds.point += offset; - + Point2I start; - start.x = mMenuList[i]->bounds.point.x + mHorizontalMargin; - start.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - mProfile->mFont->getHeight()) / 2; + start.x = mMenuList[i].bounds.point.x + mHorizontalMargin; + start.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - mProfile->mFont->getHeight()) / 2; - // Draw the border - if (mMenuList[i]->drawBorder) - { - RectI highlightBounds = bounds; - highlightBounds.inset(1,1); - if (mMenuList[i] == mouseDownMenu) - renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL ); - else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) - renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); - } + // Draw the border + if (mMenuList[i].drawBorder) + { + RectI highlightBounds = bounds; + highlightBounds.inset(1, 1); + if (&mMenuList[i] == mouseDownMenu) + renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); + else if (&mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) + renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL); + } - // Do we draw a bitmap? - if (mMenuList[i]->bitmapIndex != -1) - { - S32 index = mMenuList[i]->bitmapIndex * 3; - if (mMenuList[i] == mouseDownMenu) + // Do we draw a bitmap? + if (mMenuList[i].bitmapIndex != -1) + { + S32 index = mMenuList[i].bitmapIndex * 3; + if (&mMenuList[i] == mouseDownMenu) ++index; - else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) + else if (&mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL) index += 2; RectI rect = mProfile->mBitmapArrayRects[index]; - Point2I bitmapstart(start); - bitmapstart.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - rect.extent.y) / 2; + Point2I bitmapstart(start); + bitmapstart.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - rect.extent.y) / 2; drawUtil->clearBitmapModulation(); - drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect); + drawUtil->drawBitmapSR(mProfile->mTextureObject, offset + bitmapstart, rect); - // Should we also draw the text? - if (!mMenuList[i]->drawBitmapOnly) - { + // Should we also draw the text? + if (!mMenuList[i].drawBitmapOnly) + { start.x += mBitmapMargin; - drawUtil->setBitmapModulation( fontColor ); - drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } - } else - { - drawUtil->setBitmapModulation( fontColor ); - drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors); - } + drawUtil->setBitmapModulation(fontColor); + drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i].text, mProfile->mFontColors); + } + } + else + { + drawUtil->setBitmapModulation(fontColor); + drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i].text, mProfile->mFontColors); + } } - renderChildControls( offset, updateRect ); + renderChildControls(offset, updateRect); } -void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator ) +void GuiMenuBar::buildWindowAcceleratorMap(WindowInputGenerator &inputGenerator) { // ok, accelerator map is cleared... // add all our keys: @@ -1373,20 +1367,21 @@ void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator for (U32 i = 0; i < mMenuList.size(); ++i) { - for (MenuItem *item = mMenuList[i]->firstMenuItem; item; item = item->nextMenuItem) + for (U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if(!item->accelerator) + if (!mMenuList[i].popupMenu->mMenuItems[item].accelerator) { - item->accelerator = 0; + mMenuList[i].popupMenu->mMenuItems[item].accelerator = 0; continue; } - EventDescriptor accelEvent; - ActionMap::createEventDescriptor(item->accelerator, &accelEvent); - - //now we have a modifier, and a key, add them to the canvas - inputGenerator.addAcceleratorKey( this, item->cmd, accelEvent.eventCode, accelEvent.flags); - item->acceleratorIndex = mCurAcceleratorIndex; + EventDescriptor accelEvent; + ActionMap::createEventDescriptor(mMenuList[i].popupMenu->mMenuItems[item].accelerator, &accelEvent); + + //now we have a modifier, and a key, add them to the canvas + inputGenerator.addAcceleratorKey(this, mMenuList[i].popupMenu->mMenuItems[item].cmd, accelEvent.eventCode, accelEvent.flags); + + mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex = mCurAcceleratorIndex; mCurAcceleratorIndex++; } } @@ -1403,591 +1398,112 @@ void GuiMenuBar::acceleratorKeyPress(U32 index) // and find the item that corresponds to the accelerator index for (U32 i = 0; i < mMenuList.size(); ++i) { - if (!mMenuList[i]->visible) + if (!mMenuList[i].visible) continue; - for (MenuItem *item = mMenuList[i]->firstMenuItem; item; item = item->nextMenuItem) + for(U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if(item->acceleratorIndex == index) + if(mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex == index) { // first, call the script callback for menu selection: - onMenuSelect_callback(mMenuList[i]->id, mMenuList[i]->text); - - if(item->visible) - menuItemSelected(mMenuList[i], item); + onMenuSelect_callback(mMenuList[i].popupMenu->getId(), mMenuList[i].text); return; } } } } -//------------------------------------------------------------------------------ -// Menu display class methods -//------------------------------------------------------------------------------ - -GuiMenuBackgroundCtrl::GuiMenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl *textList) -{ - mMenuBarCtrl = ctrl; - mTextList = textList; -} - -void GuiMenuBackgroundCtrl::onMouseDown(const GuiEvent &event) -{ - mTextList->setSelectedCell(Point2I(-1,-1)); - mMenuBarCtrl->closeMenu(); -} - -void GuiMenuBackgroundCtrl::onMouseMove(const GuiEvent &event) -{ - GuiCanvas *root = getRoot(); - GuiControl *ctrlHit = root->findHitControl(event.mousePoint, mLayer - 1); - if(ctrlHit == mMenuBarCtrl) // see if the current mouse over menu is right... - mMenuBarCtrl->checkMenuMouseMove(event); -} - -void GuiMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event) -{ - GuiCanvas *root = getRoot(); - GuiControl *ctrlHit = root->findHitControl(event.mousePoint, mLayer - 1); - if(ctrlHit == mMenuBarCtrl) // see if the current mouse over menu is right... - mMenuBarCtrl->checkMenuMouseMove(event); -} - -GuiMenuTextListCtrl::GuiMenuTextListCtrl(GuiMenuBar *ctrl) -{ - mMenuBarCtrl = ctrl; - isSubMenu = false; // Added -} - -void GuiMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver) -{ - if(dStrcmp(mList[cell.y].text + 3, "-\t")) // Was: dStrcmp(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag - Parent::onRenderCell(offset, cell, selected, mouseOver); - else - { - S32 yp = offset.y + mCellSize.y / 2; - GFX->getDrawUtil()->drawLine(offset.x, yp, offset.x + mCellSize.x, yp, ColorI(128,128,128)); - GFX->getDrawUtil()->drawLine(offset.x, yp+1, offset.x + mCellSize.x, yp+1, ColorI(255,255,255)); - } - // now see if there's a bitmap... - U8 idx = mList[cell.y].text[0]; - if(idx != 1) - { - // there's a bitmap... - U32 index = U32(idx - 2) * 3; - if(!mList[cell.y].active) - index += 2; - else if(selected || mouseOver) - index ++; - - RectI rect = mProfile->mBitmapArrayRects[index]; - Point2I off = mMenuBarCtrl->maxBitmapSize - rect.extent; - off /= 2; - - GFX->getDrawUtil()->clearBitmapModulation(); - GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, offset + off, rect); - } - - // Check if this is a submenu - idx = mList[cell.y].text[1]; - if(idx != 1) - { - // This is a submenu, so draw an arrow - S32 left = offset.x + mCellSize.x - 12; - S32 right = left + 8; - S32 top = mCellSize.y / 2 + offset.y - 4; - S32 bottom = top + 8; - S32 middle = top + 4; - - PrimBuild::begin( GFXTriangleList, 3 ); - if( selected || mouseOver ) - PrimBuild::color( mProfile->mFontColorHL ); - else - PrimBuild::color( mProfile->mFontColor ); - - PrimBuild::vertex2i( left, top ); - PrimBuild::vertex2i( right, middle ); - PrimBuild::vertex2i( left, bottom ); - PrimBuild::end(); - } -} - -bool GuiMenuTextListCtrl::onKeyDown(const GuiEvent &event) -{ - //if the control is a dead end, don't process the input: - if ( !mVisible || !mActive || !mAwake ) - return false; - - //see if the key down is a or not - if ( event.modifier == 0 ) - { - if ( event.keyCode == KEY_RETURN ) - { - mMenuBarCtrl->closeMenu(); - return true; - } - else if ( event.keyCode == KEY_ESCAPE ) - { - mSelectedCell.set( -1, -1 ); - mMenuBarCtrl->closeMenu(); - return true; - } - } - - //otherwise, pass the event to it's parent - return Parent::onKeyDown(event); -} - -void GuiMenuTextListCtrl::onMouseDown(const GuiEvent &event) -{ - Parent::onMouseDown(event); -} - -void GuiMenuTextListCtrl::onMouseUp(const GuiEvent &event) -{ - Parent::onMouseUp(event); - mMenuBarCtrl->closeMenu(); -} - -void GuiMenuTextListCtrl::onCellHighlighted(Point2I cell) -{ - // If this text list control is part of a submenu, then don't worry about - // passing this along - if(!isSubMenu) - { - RectI globalbounds(getBounds()); - Point2I globalpoint = localToGlobalCoord(globalbounds.point); - globalbounds.point = globalpoint; - mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize); - } -} - -//------------------------------------------------------------------------------ -// Submenu display class methods -//------------------------------------------------------------------------------ - -GuiSubmenuBackgroundCtrl::GuiSubmenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl *textList) : GuiMenuBackgroundCtrl(ctrl, textList) -{ -} - -void GuiSubmenuBackgroundCtrl::onMouseDown(const GuiEvent &event) -{ - mTextList->setSelectedCell(Point2I(-1,-1)); - mMenuBarCtrl->closeMenu(); -} - -bool GuiSubmenuBackgroundCtrl::pointInControl(const Point2I& parentCoordPoint) -{ - S32 xt = parentCoordPoint.x - getLeft(); - S32 yt = parentCoordPoint.y - getTop(); - - if(findHitControl(Point2I(xt,yt)) == this) - return false; - else - return true; -// return xt >= 0 && yt >= 0 && xt < getWidth() && yt < getHeight(); -} - -//------------------------------------------------------------------------------ - -void GuiMenuBar::menuItemSelected(GuiMenuBar::Menu *menu, GuiMenuBar::MenuItem *item) -{ - if(item->enabled) - onMenuItemSelect_callback(menu->id, menu->text, item->id, item->text); -} - void GuiMenuBar::onSleep() { - if(mBackground) // a menu is up? - { - mTextList->setSelectedCell(Point2I(-1, -1)); - closeMenu(); - } Parent::onSleep(); } -void GuiMenuBar::closeMenu() -{ - // First close any open submenu - closeSubmenu(); - - // Get the selection from the text list: - S32 selectionIndex = mTextList->getSelectedCell().y; - - // Pop the background: - if( getRoot() ) - getRoot()->popDialogControl(mBackground); - else - return; - - // Kill the popup: - mBackground->deleteObject(); - mBackground = NULL; - - // Now perform the popup action: - if ( selectionIndex != -1 ) - { - MenuItem *list = mouseDownMenu->firstMenuItem; - - while(selectionIndex && list) - { - list = list->nextMenuItem; - selectionIndex--; - } - if(list) - menuItemSelected(mouseDownMenu, list); - } - mouseDownMenu = NULL; -} - -// Called when a menu item is highlighted by the mouse -void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize) -{ - S32 selstore = selectionIndex; - - // Now perform the popup action: - if ( selectionIndex != -1 ) - { - MenuItem *list = mouseDownMenu->firstMenuItem; - - while(selectionIndex && list) - { - list = list->nextMenuItem; - selectionIndex--; - } - - if(list) - { - // If the highlighted item has changed... - if(mouseOverSubmenu != list) - { - closeSubmenu(); - mouseOverSubmenu = NULL; - - // Check if this is a submenu. If so, open the submenu. - if(list->isSubmenu) - { - // If there are submenu items, then open the submenu - if(list->submenu->firstMenuItem) - { - mouseOverSubmenu = list; - onSubmenuAction(selstore, bounds, cellSize); - } - } - } - } - } -} - //------------------------------------------------------------------------------ void GuiMenuBar::onAction() { if(!mouseDownMenu) return; - // first, call the script callback for menu selection: - onMenuSelect_callback(mouseDownMenu->id, mouseDownMenu->text); - - MenuItem *visWalk = mouseDownMenu->firstMenuItem; - while(visWalk) - { - if(visWalk->visible) - break; - visWalk = visWalk->nextMenuItem; - } - if(!visWalk) - { - mouseDownMenu = NULL; - return; - } - - mTextList = new GuiMenuTextListCtrl(this); - mTextList->setControlProfile(mProfile); - - mBackground = new GuiMenuBackgroundCtrl(this, mTextList); - - GuiCanvas *root = getRoot(); - Point2I windowExt = root->getExtent(); - - mBackground->resize( Point2I(0,0), root->getExtent()); - S32 textWidth = 0, width = 0; - S32 acceleratorWidth = 0; - - GFont *font = mProfile->mFont; - - for(MenuItem *walk = mouseDownMenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - S32 iTextWidth = font->getStrWidth(walk->text); - S32 iAcceleratorWidth = walk->accelerator ? font->getStrWidth(walk->accelerator) : 0; - - if(iTextWidth > textWidth) - textWidth = iTextWidth; - if(iAcceleratorWidth > acceleratorWidth) - acceleratorWidth = iAcceleratorWidth; - } - width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; - - mTextList->setCellSize(Point2I(width, font->getHeight()+2)); - mTextList->clearColumnOffsets(); - mTextList->addColumnOffset(-1); // add an empty column in for the bitmap index. - mTextList->addColumnOffset(maxBitmapSize.x + 1); - mTextList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); - - U32 entryCount = 0; - - for(MenuItem *walk = mouseDownMenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - char buf[512]; - - // If this menu item is a submenu, then set the isSubmenu to 2 to indicate - // an arrow should be drawn. Otherwise set the isSubmenu normally. - char isSubmenu = 1; - if(walk->isSubmenu) - isSubmenu = 2; - - char bitmapIndex = 1; - if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) - bitmapIndex = walk->bitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, walk->text, walk->accelerator ? walk->accelerator : ""); - mTextList->addEntry(entryCount, buf); - - if(!walk->enabled) - mTextList->setEntryActive(entryCount, false); - - entryCount++; - } - Point2I menuPoint = localToGlobalCoord(mouseDownMenu->bounds.point); - menuPoint.y += mouseDownMenu->bounds.extent.y; // Used to have this at the end: + 2; - - GuiControl *ctrl = new GuiControl; - RectI ctrlBounds( menuPoint, mTextList->getExtent() + Point2I(6, 6)); - - ctrl->setControlProfile(mProfile); - mTextList->setPosition( mTextList->getPosition() + Point2I(3,3) ); - - // Make sure the menu doesn't go beyond the Canvas' bottom edge. - if((ctrlBounds.point.y + ctrlBounds.extent.y) > windowExt.y) - { - // Pop the menu above the menu bar - Point2I menuBar = localToGlobalCoord(mouseDownMenu->bounds.point); - ctrlBounds.point.y = menuBar.y - ctrl->getHeight(); - } - - ctrl->resize(ctrlBounds.point, ctrlBounds.extent); - //mTextList->setPosition(Point2I(3,3)); - - mTextList->registerObject(); - mBackground->registerObject(); - ctrl->registerObject(); - - mBackground->addObject( ctrl ); - ctrl->addObject( mTextList ); - - root->pushDialogControl(mBackground, mLayer + 1); - mTextList->setFirstResponder(); -} - -//------------------------------------------------------------------------------ -// Performs an action when a menu item that is a submenu is selected/highlighted -void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize) -{ - if(!mouseOverSubmenu) - return; + mouseDownMenu->popupMenu->hidePopup(); // first, call the script callback for menu selection: - onSubmenuSelect_callback(mouseOverSubmenu->id, mouseOverSubmenu->text); + onMenuSelect_callback(mouseDownMenu->popupMenu->getId(), mouseDownMenu->text); - MenuItem *visWalk = mouseOverSubmenu->submenu->firstMenuItem; - while(visWalk) - { - if(visWalk->visible) - break; - visWalk = visWalk->nextMenuItem; - } - if(!visWalk) - { - mouseOverSubmenu = NULL; - return; - } - - mSubmenuTextList = new GuiMenuTextListCtrl(this); - mSubmenuTextList->setControlProfile(mProfile); - mSubmenuTextList->isSubMenu = true; // Indicate that this text list is part of a submenu - - mSubmenuBackground = new GuiSubmenuBackgroundCtrl(this, mSubmenuTextList); + mouseDownMenu->popupMenu->mMenuBarCtrl = this; GuiCanvas *root = getRoot(); - Point2I windowExt = root->getExtent(); - - mSubmenuBackground->resize( Point2I(0,0), root->getExtent()); - S32 textWidth = 0, width = 0; - S32 acceleratorWidth = 0; - - GFont *font = mProfile->mFont; - - for(MenuItem *walk = mouseOverSubmenu->submenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - S32 iTextWidth = font->getStrWidth(walk->text); - S32 iAcceleratorWidth = walk->accelerator ? font->getStrWidth(walk->accelerator) : 0; - - if(iTextWidth > textWidth) - textWidth = iTextWidth; - if(iAcceleratorWidth > acceleratorWidth) - acceleratorWidth = iAcceleratorWidth; - } - width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; - - mSubmenuTextList->setCellSize(Point2I(width, font->getHeight()+3)); - mSubmenuTextList->clearColumnOffsets(); - mSubmenuTextList->addColumnOffset(-1); // add an empty column in for the bitmap index. - mSubmenuTextList->addColumnOffset(maxBitmapSize.x + 1); - mSubmenuTextList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); - - U32 entryCount = 0; - - for(MenuItem *walk = mouseOverSubmenu->submenu->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if(!walk->visible) - continue; - - char buf[512]; - - // Can't have submenus within submenus. - char isSubmenu = 1; - - char bitmapIndex = 1; - if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size())) - bitmapIndex = walk->bitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, walk->text, walk->accelerator ? walk->accelerator : ""); - mSubmenuTextList->addEntry(entryCount, buf); - - if(!walk->enabled) - mSubmenuTextList->setEntryActive(entryCount, false); - - entryCount++; - } - Point2I menuPoint = bounds.point; //localToGlobalCoord(bounds.point); - menuPoint.x += bounds.extent.x; - menuPoint.y += cellSize.y * selectionIndex - 6; - - GuiControl *ctrl = new GuiControl; - RectI ctrlBounds(menuPoint, mSubmenuTextList->getExtent() + Point2I(6, 6)); - ctrl->setControlProfile(mProfile); - mSubmenuTextList->setPosition( getPosition() + Point2I(3,3)); - - // Make sure the menu doesn't go beyond the Canvas' bottom edge. - if((ctrlBounds.point.y + ctrlBounds.extent.y ) > windowExt.y) - { - // Pop the menu above the menu bar - ctrlBounds.point.y -= mSubmenuTextList->getHeight() - cellSize.y - 6 - 3; - } - - // And the same for the right edge - if((ctrlBounds.point.x + ctrlBounds.extent.x) > windowExt.x) - { - // Pop the submenu to the left of the menu - ctrlBounds.point.x -= mSubmenuTextList->getWidth() + cellSize.x + 6; - } - ctrl->resize(ctrlBounds.point, ctrlBounds.extent); - - //mSubmenuTextList->setPosition(Point2I(3,3)); - - mSubmenuTextList->registerObject(); - mSubmenuBackground->registerObject(); - ctrl->registerObject(); - - mSubmenuBackground->addObject( ctrl ); - ctrl->addObject( mSubmenuTextList ); - - root->pushDialogControl(mSubmenuBackground, mLayer + 1); - mSubmenuTextList->setFirstResponder(); -} - -// Close down the submenu controls -void GuiMenuBar::closeSubmenu() -{ - if(!mSubmenuBackground || !mSubmenuTextList) - return; - - // Get the selection from the text list: - S32 selectionIndex = mSubmenuTextList->getSelectedCell().y; - - // Pop the background: - if( getRoot() ) - getRoot()->popDialogControl(mSubmenuBackground); - - // Kill the popup: - mSubmenuBackground->deleteObject(); - mSubmenuBackground = NULL; - mSubmenuTextList = NULL; - - // Now perform the popup action: - if ( selectionIndex != -1 ) - { - MenuItem *list = NULL; - if(mouseOverSubmenu) - { - list = mouseOverSubmenu->submenu->firstMenuItem; - - while(selectionIndex && list) - { - list = list->nextMenuItem; - selectionIndex--; - } - } - if(list) - menuItemSelected(list->submenuParentMenu, list); - } - mouseOverSubmenu = NULL; -} - -// Find if the mouse pointer is within a menu item -GuiMenuBar::MenuItem *GuiMenuBar::findHitMenuItem(Point2I mousePoint) -{ - -// for(Menu *walk = menuList; walk; walk = walk->nextMenu) -// if(walk->visible && walk->bounds.pointInRect(pos)) -// return walk; - return NULL; -} - -// Checks if the mouse has been moved to a new menu item -void GuiMenuBar::checkSubmenuMouseMove(const GuiEvent &event) -{ - MenuItem *hit = findHitMenuItem(event.mousePoint); - if(hit && hit != mouseOverSubmenu) - { - // gotta close out the current menu... - mSubmenuTextList->setSelectedCell(Point2I(-1, -1)); -// closeSubmenu(); - setUpdate(); - } + Point2I pos = Point2I(mouseDownMenu->bounds.point.x, mouseDownMenu->bounds.point.y + mouseDownMenu->bounds.extent.y); + mouseDownMenu->popupMenu->showPopup(root, pos.x, pos.y); } // Process a tick void GuiMenuBar::processTick() { - // If we are to track a tick, then do so. - if(mCountMouseOver) - { - // If we're at a particular number of ticks, notify the script function - if(mMouseOverCounter < mMouseHoverAmount) - { - ++mMouseOverCounter; + if(mMouseInMenu) + onMouseInMenu_callback(true); +} - } else if(mMouseOverCounter == mMouseHoverAmount) - { - ++mMouseOverCounter; - onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu - } +void GuiMenuBar::insert(SimObject* pObject, S32 pos) +{ + PopupMenu* menu = dynamic_cast(pObject); + if (menu == nullptr) + return; + + MenuEntry newMenu; + newMenu.pos = pos >= mMenuList.size() || pos == -1 ? pos = mMenuList.size() : pos; + newMenu.drawBitmapOnly = false; + newMenu.drawBorder = true; + newMenu.bitmapIndex = -1; + newMenu.text = menu->barTitle; + newMenu.visible = true; + newMenu.popupMenu = menu; + + if (pos >= mMenuList.size() || pos == -1) + mMenuList.push_back(newMenu); + else + mMenuList.insert(pos, newMenu); +} + +PopupMenu* GuiMenuBar::getMenu(U32 index) +{ + if (index >= mMenuList.size()) + return nullptr; + + return mMenuList[index].popupMenu; +} + +//----------------------------------------------------------------------------- +// Console Methods +//----------------------------------------------------------------------------- +DefineConsoleMethod(GuiMenuBar, attachToCanvas, void, (const char *canvas, S32 pos), , "(GuiCanvas, pos)") +{ + GuiCanvas* canv = dynamic_cast(Sim::findObject(canvas)); + if (canv) + { + canv->setMenuBar(object); } } + +DefineConsoleMethod(GuiMenuBar, removeFromCanvas, void, (), , "()") +{ + GuiCanvas* canvas = object->getRoot(); + + if(canvas) + canvas->setMenuBar(nullptr); +} + +DefineConsoleMethod(GuiMenuBar, getMenuCount, S32, (), , "()") +{ + return object->getMenuListCount(); +} + +DefineConsoleMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)") +{ + return object->getMenu(index)->getId(); +} + +//----------------------------------------------------------------------------- +DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType(), -1), "(object, pos) insert object at position") +{ + object->insert(pObject, pos); +} \ No newline at end of file diff --git a/Engine/source/gui/editor/guiMenuBar.h b/Engine/source/gui/editor/guiMenuBar.h index a41455a16..d266378e3 100644 --- a/Engine/source/gui/editor/guiMenuBar.h +++ b/Engine/source/gui/editor/guiMenuBar.h @@ -23,119 +23,43 @@ #ifndef _GUIMENUBAR_H_ #define _GUIMENUBAR_H_ -#ifndef _GUITEXTLISTCTRL_H_ -#include "gui/controls/guiTextListCtrl.h" -#endif #ifndef _GUITICKCTRL_H_ #include "gui/shiny/guiTickCtrl.h" #endif +#ifndef _POPUPMENU_H_ +#include "gui/editor/popupMenu.h" +#endif + class GuiMenuBar; -class GuiMenuTextListCtrl; class WindowInputGenerator; -class GuiMenuBackgroundCtrl : public GuiControl -{ - typedef GuiControl Parent; - -protected: - GuiMenuBar *mMenuBarCtrl; - GuiMenuTextListCtrl *mTextList; -public: - GuiMenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl* textList); - void onMouseDown(const GuiEvent &event); - void onMouseMove(const GuiEvent &event); - void onMouseDragged(const GuiEvent &event); -}; - -class GuiSubmenuBackgroundCtrl : public GuiMenuBackgroundCtrl -{ - typedef GuiMenuBackgroundCtrl Parent; - -public: - GuiSubmenuBackgroundCtrl(GuiMenuBar *ctrl, GuiMenuTextListCtrl* textList); - bool pointInControl(const Point2I & parentCoordPoint); - void onMouseDown(const GuiEvent &event); -}; - //------------------------------------------------------------------------------ - -class GuiMenuTextListCtrl : public GuiTextListCtrl -{ - private: - typedef GuiTextListCtrl Parent; - - protected: - GuiMenuBar *mMenuBarCtrl; - - public: - bool isSubMenu; // Indicates that this text list is in a submenu - - GuiMenuTextListCtrl(); // for inheritance - GuiMenuTextListCtrl(GuiMenuBar *ctrl); - - // GuiControl overloads: - bool onKeyDown(const GuiEvent &event); - void onMouseDown(const GuiEvent &event); - void onMouseUp(const GuiEvent &event); - void onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver); - - virtual void onCellHighlighted(Point2I cell); // Added -}; - -//------------------------------------------------------------------------------ - class GuiMenuBar : public GuiTickCtrl // Was: GuiControl { typedef GuiTickCtrl Parent; // Was: GuiControl Parent; public: - struct Menu; + struct MenuEntry + { + U32 pos; + RectI bounds; - struct MenuItem // an individual item in a pull-down menu - { - char *text; // the text of the menu item - U32 id; // a script-assigned identifier - char *accelerator; // the keyboard accelerator shortcut for the menu item - U32 acceleratorIndex; // index of this accelerator - bool enabled; // true if the menu item is selectable - bool visible; // true if the menu item is visible - S32 bitmapIndex; // index of the bitmap in the bitmap array - S32 checkGroup; // the group index of the item visa vi check marks - - // only one item in the group can be checked. - MenuItem *nextMenuItem; // next menu item in the linked list - - bool isSubmenu; // This menu item has a submenu that will be displayed - - Menu* submenuParentMenu; // For a submenu, this is the parent menu - Menu* submenu; - String cmd; - }; - - struct Menu - { - char *text; - U32 id; - RectI bounds; bool visible; - S32 bitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) - bool drawBitmapOnly; // Draw only the bitmap and not the text - bool drawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) + S32 bitmapIndex; + bool drawBitmapOnly; - Menu *nextMenu; - MenuItem *firstMenuItem; - }; - - GuiMenuBackgroundCtrl *mBackground; - GuiMenuTextListCtrl *mTextList; - - GuiSubmenuBackgroundCtrl *mSubmenuBackground; // Background for a submenu - GuiMenuTextListCtrl *mSubmenuTextList; // Text list for a submenu + bool drawBorder; - Vector mMenuList; - Menu *mouseDownMenu; - Menu *mouseOverMenu; + StringTableEntry text; + PopupMenu* popupMenu; + }; + + Vector mMenuList; + + MenuEntry *mouseDownMenu; + MenuEntry *mouseOverMenu; MenuItem* mouseDownSubmenu; // Stores the menu item that is a submenu that has been selected MenuItem* mouseOverSubmenu; // Stores the menu item that is a submenu that has been highlighted @@ -151,59 +75,26 @@ public: S32 mVerticalMargin; // Top and bottom margin around the text of each menu S32 mBitmapMargin; // Margin between a menu's bitmap and text - // Used to keep track of the amount of ticks that the mouse is hovering - // over a menu. - S32 mMouseOverCounter; - bool mCountMouseOver; - S32 mMouseHoverAmount; + U32 mMenubarHeight; + + bool mMouseInMenu; GuiMenuBar(); + + void onRemove(); bool onWake(); void onSleep(); - // internal menu handling functions - // these are used by the script manipulation functions to add/remove/change menu items - static Menu* sCreateMenu(const char *menuText, U32 menuId); - void addMenu(Menu *menu, S32 pos = -1); - void addMenu(const char *menuText, U32 menuId); - Menu *findMenu(const char *menu); // takes either a menu text or a string id - static MenuItem *findMenuItem(Menu *menu, const char *menuItem); // takes either a menu text or a string id - void removeMenu(Menu *menu); - static void removeMenuItem(Menu *menu, MenuItem *menuItem); - static MenuItem* addMenuItem(Menu *menu, const char *text, U32 id, const char *accelerator, S32 checkGroup, const char *cmd); - static MenuItem* addMenuItem(Menu *menu, MenuItem *menuItem); - static void clearMenuItems(Menu *menu); - void clearMenus(); + virtual void addObject(SimObject* object); - void attachToMenuBar(Menu* menu, S32 pos = -1); - void removeFromMenuBar(Menu* menu); - - // Methods to deal with submenus - static MenuItem* findSubmenuItem(Menu *menu, const char *menuItem, const char *submenuItem); - static MenuItem* findSubmenuItem(MenuItem *menuItem, const char *submenuItem); - static void addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text, U32 id, const char *accelerator, S32 checkGroup); - static void addSubmenuItem(Menu *menu, MenuItem *submenu, MenuItem *newMenuItem ); - static void removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem); - static void clearSubmenuItems(MenuItem *menuitem); - void onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2I cellSize); - void closeSubmenu(); - void checkSubmenuMouseMove(const GuiEvent &event); - MenuItem *findHitMenuItem(Point2I mousePoint); - - void highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Point2I cellSize); // Called whenever a menu item is highlighted by the mouse - - // display/mouse functions - - Menu *findHitMenu(Point2I mousePoint); - - // Called when the GUI theme changes and a bitmap arrary may need updating - // void onThemeChange(); + MenuEntry *findHitMenu(Point2I mousePoint); void onPreRender(); void onRender(Point2I offset, const RectI &updateRect); void checkMenuMouseMove(const GuiEvent &event); void onMouseMove(const GuiEvent &event); + void onMouseEnter(const GuiEvent &event); void onMouseLeave(const GuiEvent &event); void onMouseDown(const GuiEvent &event); void onMouseDragged(const GuiEvent &event); @@ -215,18 +106,21 @@ public: void removeWindowAcceleratorMap( WindowInputGenerator &inputGenerator ); void acceleratorKeyPress(U32 index); - virtual void menuItemSelected(Menu *menu, MenuItem *item); - // Added to support 'ticks' void processTick(); + void insert(SimObject* pObject, S32 pos); + static void initPersistFields(); + U32 getMenuListCount() { return mMenuList.size(); } + + PopupMenu* getMenu(U32 index); + DECLARE_CONOBJECT(GuiMenuBar); DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu )); DECLARE_CALLBACK( void, onMenuSelect, ( S32 menuId, const char* menuText )); DECLARE_CALLBACK( void, onMenuItemSelect, ( S32 menuId, const char* menuText, S32 menuItemId, const char* menuItemText )); - DECLARE_CALLBACK( void, onSubmenuSelect, ( S32 submenuId, const char* submenuText )); }; #endif diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index 36e693203..99c354102 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -25,20 +25,32 @@ #include "gfx/primBuilder.h" #include "gui/core/guiCanvas.h" -GuiPopupMenuBackgroundCtrl::GuiPopupMenuBackgroundCtrl(GuiPopupMenuTextListCtrl *textList) +GuiPopupMenuBackgroundCtrl::GuiPopupMenuBackgroundCtrl() { - mTextList = textList; - mTextList->mBackground = this; + mMenuBarCtrl = nullptr; } void GuiPopupMenuBackgroundCtrl::onMouseDown(const GuiEvent &event) { - mTextList->setSelectedCell(Point2I(-1, -1)); + +} + +void GuiPopupMenuBackgroundCtrl::onMouseUp(const GuiEvent &event) +{ + clearPopups(); + + //Pass along the event just in case we clicked over a menu item. We don't want to eat the input for it. + if (mMenuBarCtrl) + mMenuBarCtrl->onMouseUp(event); + close(); } void GuiPopupMenuBackgroundCtrl::onMouseMove(const GuiEvent &event) { + //It's possible we're trying to pan through a menubar while a popup is displayed. Pass along our event to the menubar for good measure + if (mMenuBarCtrl) + mMenuBarCtrl->onMouseMove(event); } void GuiPopupMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event) @@ -48,26 +60,64 @@ void GuiPopupMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event) void GuiPopupMenuBackgroundCtrl::close() { getRoot()->removeObject(this); + + mMenuBarCtrl = nullptr; +} + +S32 GuiPopupMenuBackgroundCtrl::findPopupMenu(PopupMenu* menu) +{ + S32 menuId = -1; + + for (U32 i = 0; i < mPopups.size(); i++) + { + if (mPopups[i]->getId() == menu->getId()) + return i; + } + + return menuId; +} + +void GuiPopupMenuBackgroundCtrl::clearPopups() +{ + for (U32 i = 0; i < mPopups.size(); i++) + { + mPopups[i]->mTextList->setSelectedCell(Point2I(-1, -1)); + mPopups[i]->mTextList->mPopup->hidePopup(); + } } GuiPopupMenuTextListCtrl::GuiPopupMenuTextListCtrl() { isSubMenu = false; // Added - mMenu = NULL; - mMenuBar = NULL; - mPopup = NULL; + + mMenuBar = nullptr; + mPopup = nullptr; + + mLastHighlightedMenuIdx = -1; } void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver) { - if (dStrcmp(mList[cell.y].text + 3, "-\t")) // Was: dStrcmp(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag - Parent::onRenderCell(offset, cell, selected, mouseOver); - else + //check if we're a real entry, or if it's a divider + if (mPopup->mMenuItems[cell.y].isSpacer) { S32 yp = offset.y + mCellSize.y / 2; - GFX->getDrawUtil()->drawLine(offset.x, yp, offset.x + mCellSize.x, yp, ColorI(128, 128, 128)); - GFX->getDrawUtil()->drawLine(offset.x, yp + 1, offset.x + mCellSize.x, yp + 1, ColorI(255, 255, 255)); + GFX->getDrawUtil()->drawLine(offset.x + 5, yp, offset.x + mCellSize.x - 5, yp, ColorI(128, 128, 128)); } + else + { + if (dStrcmp(mList[cell.y].text + 3, "-\t")) // Was: dStrcmp(mList[cell.y].text + 2, "-\t")) but has been changed to take into account the submenu flag + { + Parent::onRenderCell(offset, cell, selected, mouseOver); + } + else + { + S32 yp = offset.y + mCellSize.y / 2; + GFX->getDrawUtil()->drawLine(offset.x, yp, offset.x + mCellSize.x, yp, ColorI(128, 128, 128)); + GFX->getDrawUtil()->drawLine(offset.x, yp + 1, offset.x + mCellSize.x, yp + 1, ColorI(255, 255, 255)); + } + } + // now see if there's a bitmap... U8 idx = mList[cell.y].text[0]; if (idx != 1) @@ -153,17 +203,12 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event) if (selectionIndex != -1) { - GuiMenuBar::MenuItem *list = mMenu->firstMenuItem; + MenuItem *item = &mPopup->mMenuItems[selectionIndex]; - while (selectionIndex && list) + if (item) { - list = list->nextMenuItem; - selectionIndex--; - } - if (list) - { - if (list->enabled) - dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), list->text ? list->text : "")); + if (item->enabled) + dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->text.isNotEmpty() ? item->text : "")); } } @@ -181,4 +226,23 @@ void GuiPopupMenuTextListCtrl::onCellHighlighted(Point2I cell) Point2I globalpoint = localToGlobalCoord(globalbounds.point); globalbounds.point = globalpoint; } + + S32 selectionIndex = cell.y; + + if (selectionIndex != -1 && mLastHighlightedMenuIdx != selectionIndex) + { + mLastHighlightedMenuIdx = selectionIndex; + + mPopup->hidePopupSubmenus(); + } + + if (selectionIndex != -1) + { + MenuItem *list = &mPopup->mMenuItems[selectionIndex]; + + if (list->isSubmenu && list->subMenu != nullptr) + { + list->subMenu->showPopup(getRoot(), getPosition().x + mCellSize.x, getPosition().y + (selectionIndex * mCellSize.y)); + } + } } \ No newline at end of file diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.h b/Engine/source/gui/editor/guiPopupMenuCtrl.h index c26fa855d..54632a009 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.h +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.h @@ -42,6 +42,7 @@ class GuiPopupMenuBackgroundCtrl; class GuiPopupMenuTextListCtrl : public GuiTextListCtrl { friend class GuiPopupMenuBackgroundCtrl; + friend class PopupMenu; private: typedef GuiTextListCtrl Parent; @@ -51,10 +52,12 @@ private: public: bool isSubMenu; // Indicates that this text list is in a submenu Point2I maxBitmapSize; - GuiMenuBar::Menu* mMenu; + GuiMenuBar* mMenuBar; PopupMenu* mPopup; + S32 mLastHighlightedMenuIdx; + GuiPopupMenuTextListCtrl(); // GuiControl overloads: @@ -70,16 +73,21 @@ class GuiPopupMenuBackgroundCtrl : public GuiControl { typedef GuiControl Parent; -protected: - GuiPopupMenuTextListCtrl *mTextList; - public: - GuiPopupMenuBackgroundCtrl(GuiPopupMenuTextListCtrl* textList); + GuiPopupMenuBackgroundCtrl(); void onMouseDown(const GuiEvent &event); + void onMouseUp(const GuiEvent &event); void onMouseMove(const GuiEvent &event); void onMouseDragged(const GuiEvent &event); void close(); + + void clearPopups(); + + S32 findPopupMenu(PopupMenu* menu); + + Vector mPopups; + GuiMenuBar* mMenuBarCtrl; }; #endif \ No newline at end of file diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp new file mode 100644 index 000000000..0e5db18da --- /dev/null +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -0,0 +1,506 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "gui/editor/popupMenu.h" +#include "console/consoleTypes.h" +#include "console/engineAPI.h" +#include "gui/core/guiCanvas.h" +#include "core/util/safeDelete.h" +#include "gui/editor/guiPopupMenuCtrl.h" +#include "gui/editor/guiMenuBar.h" + +static U32 sMaxPopupGUID = 0; +PopupMenuEvent PopupMenu::smPopupMenuEvent; +bool PopupMenu::smSelectionEventHandled = false; + +/// Event class used to remove popup menus from the event notification in a safe way +class PopUpNotifyRemoveEvent : public SimEvent +{ +public: + void process(SimObject *object) + { + PopupMenu::smPopupMenuEvent.remove((PopupMenu *)object, &PopupMenu::handleSelectEvent); + } +}; + +//----------------------------------------------------------------------------- +// Constructor/Destructor +//----------------------------------------------------------------------------- +PopupMenu::PopupMenu() +{ + bitmapIndex = -1; + + barTitle = StringTable->EmptyString(); + + mMenuBarCtrl = nullptr; + mTextList = nullptr; + + isSubmenu = false; +} + +PopupMenu::~PopupMenu() +{ + PopupMenu::smPopupMenuEvent.remove(this, &PopupMenu::handleSelectEvent); +} + +IMPLEMENT_CONOBJECT(PopupMenu); + +ConsoleDocClass( PopupMenu, + "@brief PopupMenu represents a system menu.\n\n" + "You can add menu items to the menu, but there is no torque object associated " + "with these menu items, they exist only in a platform specific manner.\n\n" + "@note Internal use only\n\n" + "@internal" +); + +//----------------------------------------------------------------------------- +void PopupMenu::initPersistFields() +{ + Parent::initPersistFields(); + + addField("barTitle", TypeCaseString, Offset(barTitle, PopupMenu), ""); +} + +//----------------------------------------------------------------------------- +bool PopupMenu::onAdd() +{ + if(! Parent::onAdd()) + return false; + + Con::executef(this, "onAdd"); + return true; +} + +void PopupMenu::onRemove() +{ + Con::executef(this, "onRemove"); + + Parent::onRemove(); +} + +//----------------------------------------------------------------------------- +void PopupMenu::onMenuSelect() +{ + Con::executef(this, "onMenuSelect"); +} + +//----------------------------------------------------------------------------- +void PopupMenu::handleSelectEvent(U32 popID, U32 command) +{ +} + +//----------------------------------------------------------------------------- +bool PopupMenu::onMessageReceived(StringTableEntry queue, const char* event, const char* data) +{ + return Con::executef(this, "onMessageReceived", queue, event, data); +} + +bool PopupMenu::onMessageObjectReceived(StringTableEntry queue, Message *msg ) +{ + return Con::executef(this, "onMessageReceived", queue, Con::getIntArg(msg->getId())); +} + +////////////////////////////////////////////////////////////////////////// +// Platform Menu Data +////////////////////////////////////////////////////////////////////////// +GuiMenuBar* PopupMenu::getMenuBarCtrl() +{ + return mMenuBarCtrl; +} + +////////////////////////////////////////////////////////////////////////// +// Public Methods +////////////////////////////////////////////////////////////////////////// +S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd) +{ + String titleString = title; + + MenuItem newItem; + newItem.id = pos; + newItem.text = titleString; + newItem.cmd = cmd; + + if (titleString.isEmpty() || titleString == String("-")) + newItem.isSpacer = true; + else + newItem.isSpacer = false; + + if (accelerator[0]) + newItem.accelerator = dStrdup(accelerator); + else + newItem.accelerator = NULL; + + newItem.visible = true; + newItem.isChecked = false; + newItem.acceleratorIndex = 0; + newItem.enabled = !newItem.isSpacer; + + newItem.isSubmenu = false; + newItem.subMenu = nullptr; + newItem.subMenuParentMenu = nullptr; + + mMenuItems.push_back(newItem); + + return pos; +} + +S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) +{ + S32 itemPos = insertItem(pos, title, "", ""); + + mMenuItems[itemPos].isSubmenu = true; + mMenuItems[itemPos].subMenu = submenu; + mMenuItems[itemPos].subMenuParentMenu = this; + + submenu->isSubmenu = true; + + return itemPos; +} + +bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, const char* cmd) +{ + String titleString = title; + + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (mMenuItems[i].text == titleString) + { + mMenuItems[i].id = pos; + mMenuItems[i].cmd = cmd; + + if (accelerator && accelerator[0]) + mMenuItems[i].accelerator = dStrdup(accelerator); + else + mMenuItems[i].accelerator = NULL; + return true; + } + } + + return false; +} + +void PopupMenu::removeItem(S32 itemPos) +{ + if (mMenuItems.size() < itemPos || itemPos < 0) + return; + + mMenuItems.erase(itemPos); +} + +////////////////////////////////////////////////////////////////////////// +void PopupMenu::enableItem(S32 pos, bool enable) +{ + if (mMenuItems.size() < pos || pos < 0) + return; + + mMenuItems[pos].enabled = enable; +} + +void PopupMenu::checkItem(S32 pos, bool checked) +{ + if (mMenuItems.size() < pos || pos < 0) + return; + + if (checked && mMenuItems[pos].checkGroup != -1) + { + // first, uncheck everything in the group: + for (U32 i = 0; i < mMenuItems.size(); i++) + if (mMenuItems[i].checkGroup == mMenuItems[pos].checkGroup && mMenuItems[i].isChecked) + mMenuItems[i].isChecked = false; + } + + mMenuItems[pos].isChecked; +} + +void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) +{ + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (mMenuItems[i].id >= firstPos && mMenuItems[i].id <= lastPos) + { + mMenuItems[i].isChecked = false; + } + } +} + +bool PopupMenu::isItemChecked(S32 pos) +{ + if (mMenuItems.size() < pos || pos < 0) + return false; + + return mMenuItems[pos].isChecked; +} + +U32 PopupMenu::getItemCount() +{ + return mMenuItems.size(); +} + +////////////////////////////////////////////////////////////////////////// +bool PopupMenu::canHandleID(U32 id) +{ + return true; +} + +bool PopupMenu::handleSelect(U32 command, const char *text /* = NULL */) +{ + return dAtob(Con::executef(this, "onSelectItem", Con::getIntArg(command), text ? text : "")); +} + +////////////////////////////////////////////////////////////////////////// +void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) +{ + if (owner == NULL) + return; + + GuiControl* editorGui; + Sim::findObject("EditorGui", editorGui); + + if (editorGui) + { + GuiPopupMenuBackgroundCtrl* backgroundCtrl; + Sim::findObject("PopUpMenuControl", backgroundCtrl); + + GuiControlProfile* profile; + Sim::findObject("GuiMenubarProfile", profile); + + if (!profile) + return; + + if (mTextList == nullptr) + { + mTextList = new GuiPopupMenuTextListCtrl(); + mTextList->registerObject(); + mTextList->setControlProfile(profile); + + mTextList->mPopup = this; + mTextList->mMenuBar = getMenuBarCtrl(); + } + + if (!backgroundCtrl) + { + backgroundCtrl = new GuiPopupMenuBackgroundCtrl(); + + backgroundCtrl->registerObject("PopUpMenuControl"); + } + + if (!backgroundCtrl || !mTextList) + return; + + if (!isSubmenu) + { + //if we're a 'parent' menu, then tell the background to clear out all existing other popups + + backgroundCtrl->clearPopups(); + } + + //find out if we're doing a first-time add + S32 popupIndex = backgroundCtrl->findPopupMenu(this); + + if (popupIndex == -1) + { + backgroundCtrl->addObject(mTextList); + backgroundCtrl->mPopups.push_back(this); + } + + mTextList->mBackground = backgroundCtrl; + + owner->pushDialogControl(backgroundCtrl, 10); + + //Set the background control's menubar, if any, and if it's not already set + if(backgroundCtrl->mMenuBarCtrl == nullptr) + backgroundCtrl->mMenuBarCtrl = getMenuBarCtrl(); + + backgroundCtrl->setExtent(editorGui->getExtent()); + + mTextList->clear(); + + S32 textWidth = 0, width = 0; + S32 acceleratorWidth = 0; + GFont *font = profile->mFont; + + Point2I maxBitmapSize = Point2I(0, 0); + + S32 numBitmaps = profile->mBitmapArrayRects.size(); + if (numBitmaps) + { + RectI *bitmapBounds = profile->mBitmapArrayRects.address(); + for (S32 i = 0; i < numBitmaps; i++) + { + if (bitmapBounds[i].extent.x > maxBitmapSize.x) + maxBitmapSize.x = bitmapBounds[i].extent.x; + if (bitmapBounds[i].extent.y > maxBitmapSize.y) + maxBitmapSize.y = bitmapBounds[i].extent.y; + } + } + + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (!mMenuItems[i].visible) + continue; + + S32 iTextWidth = font->getStrWidth(mMenuItems[i].text.c_str()); + S32 iAcceleratorWidth = mMenuItems[i].accelerator ? font->getStrWidth(mMenuItems[i].accelerator) : 0; + + if (iTextWidth > textWidth) + textWidth = iTextWidth; + if (iAcceleratorWidth > acceleratorWidth) + acceleratorWidth = iAcceleratorWidth; + } + + width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; + + mTextList->setCellSize(Point2I(width, font->getHeight() + 2)); + mTextList->clearColumnOffsets(); + mTextList->addColumnOffset(-1); // add an empty column in for the bitmap index. + mTextList->addColumnOffset(maxBitmapSize.x + 1); + mTextList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); + + U32 entryCount = 0; + + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (!mMenuItems[i].visible) + continue; + + char buf[512]; + + // If this menu item is a submenu, then set the isSubmenu to 2 to indicate + // an arrow should be drawn. Otherwise set the isSubmenu normally. + char isSubmenu = 1; + if (mMenuItems[i].isSubmenu) + isSubmenu = 2; + + char bitmapIndex = 1; + if (mMenuItems[i].bitmapIndex >= 0 && (mMenuItems[i].bitmapIndex * 3 <= profile->mBitmapArrayRects.size())) + bitmapIndex = mMenuItems[i].bitmapIndex + 2; + + dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, mMenuItems[i].text.c_str(), mMenuItems[i].accelerator ? mMenuItems[i].accelerator : ""); + mTextList->addEntry(entryCount, buf); + + if (!mMenuItems[i].enabled) + mTextList->setEntryActive(entryCount, false); + + entryCount++; + } + + Point2I pos = Point2I::Zero; + + if (x == -1 && y == -1) + pos = owner->getCursorPos(); + else + pos = Point2I(x, y); + + mTextList->setPosition(pos); + + //nudge in if we'd overshoot the screen + S32 widthDiff = (mTextList->getPosition().x + mTextList->getExtent().x) - backgroundCtrl->getWidth(); + if (widthDiff > 0) + { + Point2I popupPos = mTextList->getPosition(); + mTextList->setPosition(popupPos.x - widthDiff, popupPos.y); + } + + mTextList->setHidden(false); + } +} + +void PopupMenu::hidePopup() +{ + if (mTextList) + { + mTextList->setHidden(true); + } + + hidePopupSubmenus(); +} + +void PopupMenu::hidePopupSubmenus() +{ + for (U32 i = 0; i < mMenuItems.size(); i++) + { + if (mMenuItems[i].subMenu != nullptr) + mMenuItems[i].subMenu->hidePopup(); + } +} + +//----------------------------------------------------------------------------- +// Console Methods +//----------------------------------------------------------------------------- +DefineConsoleMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd), ("", "", ""), "(pos[, title][, accelerator][, cmd])") +{ + return object->insertItem(pos, title, accelerator, cmd); +} + +DefineConsoleMethod(PopupMenu, removeItem, void, (S32 pos), , "(pos)") +{ + object->removeItem(pos); +} + +DefineConsoleMethod(PopupMenu, insertSubMenu, S32, (S32 pos, String title, String subMenu), , "(pos, title, subMenu)") +{ + PopupMenu *mnu = dynamic_cast(Sim::findObject(subMenu)); + if(mnu == NULL) + { + Con::errorf("PopupMenu::insertSubMenu - Invalid PopupMenu object specified for submenu"); + return -1; + } + return object->insertSubMenu(pos, title, mnu); +} + +DefineConsoleMethod(PopupMenu, setItem, bool, (S32 pos, const char * title, const char * accelerator, const char *cmd), (""), "(pos, title[, accelerator][, cmd])") +{ + return object->setItem(pos, title, accelerator, cmd); +} + +//----------------------------------------------------------------------------- + +DefineConsoleMethod(PopupMenu, enableItem, void, (S32 pos, bool enabled), , "(pos, enabled)") +{ + object->enableItem(pos, enabled); +} + +DefineConsoleMethod(PopupMenu, checkItem, void, (S32 pos, bool checked), , "(pos, checked)") +{ + object->checkItem(pos, checked); +} + +DefineConsoleMethod(PopupMenu, checkRadioItem, void, (S32 firstPos, S32 lastPos, S32 checkPos), , "(firstPos, lastPos, checkPos)") +{ + object->checkRadioItem(firstPos, lastPos, checkPos); +} + +DefineConsoleMethod(PopupMenu, isItemChecked, bool, (S32 pos), , "(pos)") +{ + return object->isItemChecked(pos); +} + +DefineConsoleMethod(PopupMenu, getItemCount, S32, (), , "()") +{ + return object->getItemCount(); +} + +//----------------------------------------------------------------------------- +DefineConsoleMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") +{ + GuiCanvas *pCanvas = dynamic_cast(Sim::findObject(canvasName)); + object->showPopup(pCanvas, x, y); +} diff --git a/Engine/source/platform/menus/popupMenu.h b/Engine/source/gui/editor/popupMenu.h similarity index 69% rename from Engine/source/platform/menus/popupMenu.h rename to Engine/source/gui/editor/popupMenu.h index 8d1239972..9a6dd0821 100644 --- a/Engine/source/platform/menus/popupMenu.h +++ b/Engine/source/gui/editor/popupMenu.h @@ -19,17 +19,43 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- +#ifndef _POPUPMENU_H_ +#define _POPUPMENU_H_ + #include "console/simBase.h" #include "core/util/tVector.h" #include "util/messaging/dispatcher.h" #include "gui/core/guiCanvas.h" -#ifndef _POPUPMENU_H_ -#define _POPUPMENU_H_ +class PopupMenu; +class GuiMenuBar; +class GuiPopupMenuTextListCtrl; +class GuiPopupMenuBackgroundCtrl; -// Forward ref used by the platform code -struct PlatformPopupMenuData; -class MenuBar; +struct MenuItem // an individual item in a pull-down menu +{ + String text; // the text of the menu item + U32 id; // a script-assigned identifier + char *accelerator; // the keyboard accelerator shortcut for the menu item + U32 acceleratorIndex; // index of this accelerator + bool enabled; // true if the menu item is selectable + bool visible; // true if the menu item is visible + S32 bitmapIndex; // index of the bitmap in the bitmap array + S32 checkGroup; // the group index of the item visa vi check marks - + // only one item in the group can be checked. + + bool isSubmenu; // This menu item has a submenu that will be displayed + + bool isChecked; + + bool isSpacer; + + bool isMenubarEntry; + + PopupMenu* subMenuParentMenu; // For a submenu, this is the parent menu + PopupMenu* subMenu; + String cmd; +}; // PopupMenu represents a menu. // You can add menu items to the menu, but there is no torque object associated @@ -37,30 +63,32 @@ class MenuBar; class PopupMenu : public SimObject, public virtual Dispatcher::IMessageListener { typedef SimObject Parent; - - friend class MenuBar; - -private: - /// Used by MenuBar to attach the menu to the menu bar. Do not use anywhere else. - void attachToMenuBar(GuiCanvas *owner, S32 pos); + friend class GuiMenuBar; + friend class GuiPopupMenuTextListCtrl; + friend class GuiPopupMenuBackgroundCtrl; protected: - PlatformPopupMenuData *mData; - - SimSet *mSubmenus; - SimObjectPtr mCanvas; + Vector mMenuItems; - StringTableEntry mBarTitle; + GuiMenuBar* mMenuBarCtrl; - U32 mPopupGUID; - - bool mIsPopup; + StringTableEntry barTitle; + + RectI bounds; + bool visible; + + S32 bitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) + bool drawBitmapOnly; // Draw only the bitmap and not the text + bool drawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) + + bool isSubmenu; + + //This is the gui control that renders our popup + GuiPopupMenuTextListCtrl *mTextList; public: PopupMenu(); virtual ~PopupMenu(); - void createPlatformPopupMenuData(); - void deletePlatformPopupMenuData(); DECLARE_CONOBJECT(PopupMenu); @@ -72,15 +100,6 @@ public: static PopupMenuEvent smPopupMenuEvent; static bool smSelectionEventHandled; /// Set to true if any menu or submenu handles a selection event - /// Creates the platform specific menu object, a peer to this object. - /// The platform menu *must* exist before calling any method that manipulates - /// menu items or displays the menu. - /// implementd on a per-platform basis. - void createPlatformMenu(); - - void setBarTitle(const char * val) { mBarTitle = StringTable->insert(val, true); } - StringTableEntry getBarTitle() const { return mBarTitle; } - /// pass NULL for @p title to insert a separator /// returns the menu item's ID, or -1 on failure. /// implementd on a per-platform basis. @@ -118,39 +137,7 @@ public: /// Returns the number of items in the menu. U32 getItemCount(); - /// Returns the popup GUID - U32 getPopupGUID() { return mPopupGUID; } - //----------------------------------------------------------------------------- - // New code should not use these methods directly, use the menu bar instead. - // - // They remain for compatibility with old code and will be changing/going away - // once the existing code is moved over to the menu bar. - //----------------------------------------------------------------------------- - - /// Places this menu in the menu bar of the application's main window. - /// @param owner The GuiCanvas that owns the PlatformWindow that this call is associated with - /// @param pos The relative position at which to place the menu. - /// @param title The name of the menu - void attachToMenuBar(GuiCanvas *owner, S32 pos, const char *title); - - /// Removes this menu from the menu bar. - void removeFromMenuBar(); - - //----------------------------------------------------------------------------- - - /// Called when the menu has been attached to the menu bar - void onAttachToMenuBar(GuiCanvas *canvas, S32 pos, const char *title); - - /// Called when the menu has been removed from the menu bar - void onRemoveFromMenuBar(GuiCanvas *canvas); - - /// Returns the position index of this menu on the bar. - S32 getPosOnMenuBar(); - - /// Returns true if this menu is attached to the menu bar - bool isAttachedToMenuBar() { return mCanvas != NULL; } - /// Displays this menu as a popup menu and blocks until the user has selected /// an item. /// @param canvas the owner to show this popup associated with @@ -159,6 +146,9 @@ public: /// implemented on a per-platform basis. void showPopup(GuiCanvas *owner, S32 x = -1, S32 y = -1); + void hidePopup(); + void hidePopupSubmenus(); + /// Returns true iff this menu contains an item that matches @p iD. /// implemented on a per-platform basis. /// TODO: factor out common code @@ -184,6 +174,11 @@ public: virtual bool onMessageReceived(StringTableEntry queue, const char* event, const char* data ); virtual bool onMessageObjectReceived(StringTableEntry queue, Message *msg ); + + bool isVisible() { return visible; } + void setVisible(bool isVis) { visible = isVis; } + + GuiMenuBar* getMenuBarCtrl(); }; #endif // _POPUPMENU_H_ diff --git a/Engine/source/platform/menus/menuBar.cpp b/Engine/source/platform/menus/menuBar.cpp deleted file mode 100644 index cb70838a8..000000000 --- a/Engine/source/platform/menus/menuBar.cpp +++ /dev/null @@ -1,127 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/platform.h" -#include "platform/menus/menuBar.h" -#include "platform/menus/popupMenu.h" -#include "gui/core/guiCanvas.h" -#include "console/engineAPI.h" - -//----------------------------------------------------------------------------- -// Constructor/Destructor -//----------------------------------------------------------------------------- - -MenuBar::MenuBar() -{ - createPlatformPopupMenuData(); - - mCanvas = NULL; -} - -MenuBar::~MenuBar() -{ - removeFromCanvas(); - - deletePlatformPopupMenuData(); -} - -IMPLEMENT_CONOBJECT(MenuBar); - -ConsoleDocClass( MenuBar, - "@brief Used for rendering platform menu bars\n\n" - "Internal use only\n\n" - "@internal" -); - -//----------------------------------------------------------------------------- -// Public Methods -//----------------------------------------------------------------------------- - -void MenuBar::addObject(SimObject *obj) -{ - Parent::addObject(obj); - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::removeObject(SimObject *obj) -{ - Parent::removeObject(obj); - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::insertObject(SimObject *obj, S32 pos) -{ - Parent::addObject(obj); - - if(pos >= size()) - pos = size() - 1; - - if(pos < size()) - { - if(pos < 0) pos = 0; - Parent::reOrder(obj, at(pos)); - } - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::pushObject(SimObject *obj) -{ - Parent::pushObject(obj); - updateMenuBar(dynamic_cast(obj)); -} - -void MenuBar::popObject() -{ - Parent::popObject(); - updateMenuBar(); -} - -bool MenuBar::reOrder(SimObject *obj, SimObject *target /*= 0*/) -{ - bool ret = Parent::reOrder(obj, target); - if(ret) - updateMenuBar(dynamic_cast(obj)); - return ret; -} - -//----------------------------------------------------------------------------- -// Console Methods -//----------------------------------------------------------------------------- - -DefineConsoleMethod(MenuBar, attachToCanvas, void, (const char *canvas, S32 pos), , "(GuiCanvas, pos)") -{ - object->attachToCanvas(dynamic_cast(Sim::findObject(canvas)), pos); -} - -DefineConsoleMethod(MenuBar, removeFromCanvas, void, (), , "()") -{ - object->removeFromCanvas(); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(MenuBar, insert, void, (SimObject* pObject, S32 pos), ,"(object, pos) insert object at position") -{ - - if(pObject) - object->insertObject(pObject, pos); -} diff --git a/Engine/source/platform/menus/menuBar.h b/Engine/source/platform/menus/menuBar.h deleted file mode 100644 index 0e0e64602..000000000 --- a/Engine/source/platform/menus/menuBar.h +++ /dev/null @@ -1,71 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "console/simBase.h" - -#ifndef _MENUBAR_H_ -#define _MENUBAR_H_ - -// Forward Refs -class PlatformMenuBarData; -class PopupMenu; -class GuiCanvas; - -class MenuBar : public SimSet -{ - typedef SimSet Parent; - -protected: - PlatformMenuBarData *mData; - GuiCanvas *mCanvas; - - /// Update the native menu bar to ensure consistency with the set - void updateMenuBar(PopupMenu *menu = NULL); - - void createPlatformPopupMenuData(); - void deletePlatformPopupMenuData(); - -public: - MenuBar(); - virtual ~MenuBar(); - DECLARE_CONOBJECT(MenuBar); - - /// Attach this menu bar to the native menu bar - void attachToCanvas(GuiCanvas *owner, S32 pos); - /// Remove this menu bar from the native menu bar - void removeFromCanvas(); - - /// Returns true if this menu is attached to the menu bar - bool isAttachedToCanvas() { return mCanvas != NULL; } - - virtual void insertObject(SimObject *obj, S32 pos); - - // Overridden SimSet methods to ensure menu bar consistency when attached - virtual void addObject(SimObject *obj); - virtual void removeObject(SimObject *obj); - virtual void pushObject(SimObject *obj); - virtual void popObject(); - - virtual bool reOrder(SimObject *obj, SimObject *target = 0); -}; - -#endif // _MENUBAR_H_ diff --git a/Engine/source/platform/menus/popupMenu.cpp b/Engine/source/platform/menus/popupMenu.cpp deleted file mode 100644 index 7e8aad7ba..000000000 --- a/Engine/source/platform/menus/popupMenu.cpp +++ /dev/null @@ -1,269 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/menus/popupMenu.h" -#include "console/consoleTypes.h" -#include "console/engineAPI.h" -#include "gui/core/guiCanvas.h" -#include "core/util/safeDelete.h" - -static U32 sMaxPopupGUID = 0; -PopupMenuEvent PopupMenu::smPopupMenuEvent; -bool PopupMenu::smSelectionEventHandled = false; - -/// Event class used to remove popup menus from the event notification in a safe way -class PopUpNotifyRemoveEvent : public SimEvent -{ -public: - void process(SimObject *object) - { - PopupMenu::smPopupMenuEvent.remove((PopupMenu *)object, &PopupMenu::handleSelectEvent); - } -}; - -//----------------------------------------------------------------------------- -// Constructor/Destructor -//----------------------------------------------------------------------------- - -PopupMenu::PopupMenu() : mCanvas(NULL) -{ - createPlatformPopupMenuData(); - - mSubmenus = new SimSet; - mSubmenus->registerObject(); - - mBarTitle = StringTable->EmptyString(); - mIsPopup = false; - - mPopupGUID = sMaxPopupGUID++; -} - -PopupMenu::~PopupMenu() -{ - // This searches the menu bar so is safe to call for menus - // that aren't on it, since nothing will happen. - removeFromMenuBar(); - - SimSet::iterator i; - while((i = mSubmenus->begin()) != mSubmenus->end()) - { - (*i)->deleteObject(); - } - - mSubmenus->deleteObject(); - deletePlatformPopupMenuData(); - - PopupMenu::smPopupMenuEvent.remove(this, &PopupMenu::handleSelectEvent); -} - -IMPLEMENT_CONOBJECT(PopupMenu); - -ConsoleDocClass( PopupMenu, - "@brief PopupMenu represents a system menu.\n\n" - "You can add menu items to the menu, but there is no torque object associated " - "with these menu items, they exist only in a platform specific manner.\n\n" - "@note Internal use only\n\n" - "@internal" -); - - -//----------------------------------------------------------------------------- - -void PopupMenu::initPersistFields() -{ - addField("isPopup", TypeBool, Offset(mIsPopup, PopupMenu), "true if this is a pop-up/context menu. defaults to false."); - addField("barTitle", TypeCaseString, Offset(mBarTitle, PopupMenu), "the title of this menu when attached to a menu bar"); - - Parent::initPersistFields(); -} - -//----------------------------------------------------------------------------- - -bool PopupMenu::onAdd() -{ - if(! Parent::onAdd()) - return false; - - createPlatformMenu(); - - Con::executef(this, "onAdd"); - return true; -} - -void PopupMenu::onRemove() -{ - Con::executef(this, "onRemove"); - - Parent::onRemove(); -} - -//----------------------------------------------------------------------------- - -void PopupMenu::onMenuSelect() -{ - Con::executef(this, "onMenuSelect"); -} - -//----------------------------------------------------------------------------- - -void PopupMenu::handleSelectEvent(U32 popID, U32 command) -{ - if (popID == mPopupGUID && canHandleID(command)) - if (handleSelect(command)) - smSelectionEventHandled = true; -} - -//----------------------------------------------------------------------------- - -void PopupMenu::onAttachToMenuBar(GuiCanvas *canvas, S32 pos, const char *title) -{ - mCanvas = canvas; - - // Attached menus must be notified of menu events - smPopupMenuEvent.notify(this, &PopupMenu::handleSelectEvent); - - // Pass on to sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *mnu = dynamic_cast(*i); - if(mnu == NULL) - continue; - - mnu->onAttachToMenuBar(canvas, pos, title); - } - - // Call script - if(isProperlyAdded()) - Con::executef(this, "onAttachToMenuBar", Con::getIntArg(canvas ? canvas->getId() : 0), Con::getIntArg(pos), title); -} - -void PopupMenu::onRemoveFromMenuBar(GuiCanvas *canvas) -{ - mCanvas = NULL; - - // We are no longer interested in select events, remove ourselves from the notification list in a safe way - Sim::postCurrentEvent(this, new PopUpNotifyRemoveEvent()); - - // Pass on to sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *mnu = dynamic_cast(*i); - if(mnu == NULL) - continue; - - mnu->onRemoveFromMenuBar(canvas); - } - - // Call script - if(isProperlyAdded()) - Con::executef(this, "onRemoveFromMenuBar", Con::getIntArg(canvas ? canvas->getId() : 0)); -} - -//----------------------------------------------------------------------------- - -bool PopupMenu::onMessageReceived(StringTableEntry queue, const char* event, const char* data) -{ - return Con::executef(this, "onMessageReceived", queue, event, data); -} - - -bool PopupMenu::onMessageObjectReceived(StringTableEntry queue, Message *msg ) -{ - return Con::executef(this, "onMessageReceived", queue, Con::getIntArg(msg->getId())); -} - -//----------------------------------------------------------------------------- -// Console Methods -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd), ("", "", ""), "(pos[, title][, accelerator][, cmd])") -{ - return object->insertItem(pos, title, accelerator, cmd); -} - -DefineConsoleMethod(PopupMenu, removeItem, void, (S32 pos), , "(pos)") -{ - object->removeItem(pos); -} - -DefineConsoleMethod(PopupMenu, insertSubMenu, S32, (S32 pos, String title, String subMenu), , "(pos, title, subMenu)") -{ - PopupMenu *mnu = dynamic_cast(Sim::findObject(subMenu)); - if(mnu == NULL) - { - Con::errorf("PopupMenu::insertSubMenu - Invalid PopupMenu object specified for submenu"); - return -1; - } - return object->insertSubMenu(pos, title, mnu); -} - -DefineConsoleMethod(PopupMenu, setItem, bool, (S32 pos, const char * title, const char * accelerator, const char *cmd), (""), "(pos, title[, accelerator][, cmd])") -{ - return object->setItem(pos, title, accelerator, cmd); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, enableItem, void, (S32 pos, bool enabled), , "(pos, enabled)") -{ - object->enableItem(pos, enabled); -} - -DefineConsoleMethod(PopupMenu, checkItem, void, (S32 pos, bool checked), , "(pos, checked)") -{ - object->checkItem(pos, checked); -} - -DefineConsoleMethod(PopupMenu, checkRadioItem, void, (S32 firstPos, S32 lastPos, S32 checkPos), , "(firstPos, lastPos, checkPos)") -{ - object->checkRadioItem(firstPos, lastPos, checkPos); -} - -DefineConsoleMethod(PopupMenu, isItemChecked, bool, (S32 pos), , "(pos)") -{ - return object->isItemChecked(pos); -} - -DefineConsoleMethod(PopupMenu, getItemCount, S32, (), , "()") -{ - return object->getItemCount(); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, attachToMenuBar, void, (const char * canvasName, S32 pos, const char * title), , "(GuiCanvas, pos, title)") -{ - object->attachToMenuBar(dynamic_cast(Sim::findObject(canvasName)), pos, title); -} - -DefineConsoleMethod(PopupMenu, removeFromMenuBar, void, (), , "()") -{ - object->removeFromMenuBar(); -} - -//----------------------------------------------------------------------------- - -DefineConsoleMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") -{ - GuiCanvas *pCanvas = dynamic_cast(Sim::findObject(canvasName)); - object->showPopup(pCanvas, x, y); -} diff --git a/Engine/source/platformSDL/menus/PlatformSDLPopupMenuData.h b/Engine/source/platformSDL/menus/PlatformSDLPopupMenuData.h deleted file mode 100644 index 4911f5c10..000000000 --- a/Engine/source/platformSDL/menus/PlatformSDLPopupMenuData.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef PLATFORM_SDL_POPUPMENU_DATA_H -#define PLATFORM_SDL_POPUPMENU_DATA_H - -#include "core/util/tDictionary.h" - -class GuiMenuBar; -struct EventDescriptor; -class PopupMenu; -class MenuBar; - -struct PlatformPopupMenuData -{ - MenuBar *mMenuBar; - GuiMenuBar::Menu *mMenuGui; - - static const U8 mCheckedBitmapIdx = 0; - static Map mMenuMap; - - PlatformPopupMenuData() - { - mMenuBar = NULL; - mMenuGui = NULL; - } - - ~PlatformPopupMenuData() - { - - } - - void insertAccelerator(EventDescriptor &desc, U32 id); - void removeAccelerator(U32 id); - void setAccelleratorEnabled(U32 id, bool enabled); -}; - -#endif //PLATFORM_SDL_POPUPMENU_DATA_H \ No newline at end of file diff --git a/Engine/source/platformSDL/menus/guiPlatformGenericMenuBar.h b/Engine/source/platformSDL/menus/guiPlatformGenericMenuBar.h deleted file mode 100644 index b2129a8b1..000000000 --- a/Engine/source/platformSDL/menus/guiPlatformGenericMenuBar.h +++ /dev/null @@ -1,51 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#pragma once - -#include "gui/editor/guiMenuBar.h" -#include "platformSDL/menus/PlatformSDLPopupMenuData.h" -#include "platform/menus/popupMenu.h" - -class GuiPlatformGenericMenuBar : public GuiMenuBar -{ - typedef GuiMenuBar Parent; -public: - DECLARE_CONOBJECT(GuiPlatformGenericMenuBar); - - virtual void menuItemSelected(Menu *menu, MenuItem *item) - { - AssertFatal(menu && item, ""); - - PopupMenu *popupMenu = PlatformPopupMenuData::mMenuMap[menu]; - AssertFatal(popupMenu, ""); - - popupMenu->handleSelect(item->id); - - Parent::menuItemSelected(menu, item); - } - -protected: - /// menu id / item id - Map, String> mCmds; - -}; \ No newline at end of file diff --git a/Engine/source/platformSDL/menus/menuBarSDL.cpp b/Engine/source/platformSDL/menus/menuBarSDL.cpp deleted file mode 100644 index a0ddb2370..000000000 --- a/Engine/source/platformSDL/menus/menuBarSDL.cpp +++ /dev/null @@ -1,200 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/menus/menuBar.h" -#include "platform/menus/popupMenu.h" -#include "gui/core/guiCanvas.h" -#include "windowManager/platformWindowMgr.h" -#include "core/util/safeDelete.h" - -#include "windowManager/sdl/sdlWindow.h" -#include "gui/editor/guiMenuBar.h" - -#include "platformSDL/menus/PlatformSDLPopupMenuData.h" - -#include "platformSDL/menus/guiPlatformGenericMenuBar.h" - -#ifdef TORQUE_SDL - -//----------------------------------------------------------------------------- -// Platform Data -//----------------------------------------------------------------------------- - -// class PlatformMenuBarData -// { -// -// }; - -Map PlatformPopupMenuData::mMenuMap; - -IMPLEMENT_CONOBJECT(GuiPlatformGenericMenuBar); - -//----------------------------------------------------------------------------- -// MenuBar Methods -//----------------------------------------------------------------------------- - -void MenuBar::createPlatformPopupMenuData() -{ - mData = NULL; -} - -void MenuBar::deletePlatformPopupMenuData() -{ -// SAFE_DELETE(mData); -} - -//----------------------------------------------------------------------------- - -GuiPlatformGenericMenuBar* _FindMenuBarCtrl() -{ - GuiControl* control; - Sim::findObject("PlatformGenericMenubar", control); - AssertFatal(control, ""); - if( !control ) - return NULL; - - GuiPlatformGenericMenuBar* menuBar; - menuBar = dynamic_cast( control->findObjectByInternalName( StringTable->insert("menubar"), true) ); - AssertFatal(menuBar, ""); - return menuBar; -} - - -void MenuBar::updateMenuBar(PopupMenu *popupMenu /* = NULL */) -{ - //if(! isAttachedToCanvas()) - // return; - - if(!popupMenu) - return; - - GuiPlatformGenericMenuBar* menuBarGui = _FindMenuBarCtrl(); - popupMenu->mData->mMenuBar = this; - - String menuTitle = popupMenu->getBarTitle(); - - //Next, find out if we're still in the list of entries - SimSet::iterator itr = find(begin(), end(), popupMenu); - - GuiMenuBar::Menu* menuGui = menuBarGui->findMenu(menuTitle); - if (!menuGui) - { - //This is our first time setting this particular menu up, so we'll OK it. - if (itr == end()) - menuBarGui->attachToMenuBar(popupMenu->mData->mMenuGui); - else - menuBarGui->attachToMenuBar(popupMenu->mData->mMenuGui, itr - begin()); - } - else - { - //Not our first time through, so we're really updating it. - - //So, first, remove it from the menubar - menuBarGui->removeFromMenuBar(menuGui); - - //Next, find out if we're still in the list of entries - SimSet::iterator itr = find(begin(), end(), popupMenu); - - //if we're no longer in the list, we're pretty much done here - if (itr == end()) - return; - - //We're still here, so this is a valid menu for our current bar configuration, so add us back in. - menuBarGui->attachToMenuBar(menuGui, itr - begin()); - } -} - -//----------------------------------------------------------------------------- - -void MenuBar::attachToCanvas(GuiCanvas *owner, S32 pos) -{ - if(owner == NULL || isAttachedToCanvas()) - return; - - // This is set for popup menus in the onAttachToMenuBar() callback - mCanvas = owner; - - PlatformWindowSDL *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - // Setup the native menu bar - GuiMenuBar *hWindowMenu = static_cast( pWindow->getMenuHandle() ); - if( hWindowMenu == NULL && !Journal::IsPlaying() ) - hWindowMenu = _FindMenuBarCtrl(); - - if(hWindowMenu) - { - pWindow->setMenuHandle( hWindowMenu ); - GuiControl *base = hWindowMenu->getParent(); - - while( base->getParent() ) - { - base = base->getParent(); - } - - mCanvas->setMenuBar( base ); - } - - for (S32 i = 0; i < size(); ++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if (mnu == NULL) - { - Con::warnf("MenuBar::attachToMenuBar - Non-PopupMenu object in set"); - continue; - } - - if (mnu->isAttachedToMenuBar()) - mnu->removeFromMenuBar(); - - mnu->attachToMenuBar(owner, pos + i); - } - -} - -void MenuBar::removeFromCanvas() -{ - if (mCanvas == NULL || !isAttachedToCanvas()) - return; - - //_FindMenuBarCtrl()->clearMenus(); - - // Add the items - for (S32 i = 0; i < size(); ++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if (mnu == NULL) - { - Con::warnf("MenuBar::removeFromMenuBar - Non-PopupMenu object in set"); - continue; - } - - mnu->removeFromMenuBar(); - } - - mCanvas->setMenuBar(NULL); - - mCanvas = NULL; -} - -#endif diff --git a/Engine/source/platformSDL/menus/popupMenuSDL.cpp b/Engine/source/platformSDL/menus/popupMenuSDL.cpp deleted file mode 100644 index 788d7c88e..000000000 --- a/Engine/source/platformSDL/menus/popupMenuSDL.cpp +++ /dev/null @@ -1,393 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#ifdef TORQUE_SDL - -#include "platform/menus/popupMenu.h" -#include "platform/menus/menuBar.h" -#include "console/consoleTypes.h" -#include "gui/core/guiCanvas.h" -#include "core/util/safeDelete.h" - -#include "sim/actionMap.h" -#include "platform/platformInput.h" - -#include "windowManager/sdl/sdlWindow.h" -#include "gui/editor/guiMenuBar.h" - -#include "platformSDL/menus/PlatformSDLPopupMenuData.h" -#include "console/engineAPI.h" - -#include "platformSDL/menus/guiPlatformGenericMenuBar.h" -#include "gui/editor/guiPopupMenuCtrl.h" - -////////////////////////////////////////////////////////////////////////// -// Platform Menu Data -////////////////////////////////////////////////////////////////////////// -GuiPlatformGenericMenuBar* findMenuBarCtrl() -{ - GuiControl* control; - Sim::findObject("PlatformGenericMenubar", control); - AssertFatal(control, ""); - if (!control) - return NULL; - - GuiPlatformGenericMenuBar* menuBar; - menuBar = dynamic_cast(control->findObjectByInternalName(StringTable->insert("menubar"), true)); - AssertFatal(menuBar, ""); - return menuBar; -} - -////////////////////////////////////////////////////////////////////////// - -void PlatformPopupMenuData::insertAccelerator(EventDescriptor &desc, U32 id) -{ - AssertFatal(0, ""); -} - -void PlatformPopupMenuData::removeAccelerator(U32 id) -{ - AssertFatal(0, ""); -} - -void PlatformPopupMenuData::setAccelleratorEnabled( U32 id, bool enabled ) -{ - AssertFatal(0, ""); -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::createPlatformPopupMenuData() -{ - mData = new PlatformPopupMenuData; -} - -void PopupMenu::deletePlatformPopupMenuData() -{ - SAFE_DELETE(mData); -} -void PopupMenu::createPlatformMenu() -{ - mData->mMenuGui = GuiMenuBar::sCreateMenu( getBarTitle(), getId() ); - PlatformPopupMenuData::mMenuMap[ mData->mMenuGui ] = this; -} - - -////////////////////////////////////////////////////////////////////////// -// Public Methods -////////////////////////////////////////////////////////////////////////// - -S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char* cmd) -{ - GuiMenuBar::MenuItem *item = GuiMenuBar::findMenuItem( mData->mMenuGui, title ); - - //We'll make a special exception for the spacer items - if(item && dStrcmp(title, "")) - { - setItem( pos, title, accelerator, cmd); - return pos; - } - - item = GuiMenuBar::addMenuItem( mData->mMenuGui, title, pos, accelerator, -1, cmd ); - item->submenuParentMenu = this->mData->mMenuGui; - - return pos; -} - -S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) -{ - GuiMenuBar::MenuItem *item = GuiMenuBar::addMenuItem( mData->mMenuGui, title, pos, "", -1, "" ); - item->isSubmenu = true; - item->submenu = submenu->mData->mMenuGui; - item->submenuParentMenu = this->mData->mMenuGui; - - return pos; -} - -bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, const char* cmd) -{ - GuiMenuBar::MenuItem *item = NULL; - - item = GuiMenuBar::findMenuItem( mData->mMenuGui, title ); - - if(item) - { - item->id = pos; - item->cmd = cmd; - if( accelerator && accelerator[0] ) - item->accelerator = dStrdup( accelerator ); - else - item->accelerator = NULL; - return true; - } - - return false; -} - -void PopupMenu::removeItem(S32 itemPos) -{ - GuiMenuBar::MenuItem *item = GuiMenuBar::findMenuItem( mData->mMenuGui, String::ToString(itemPos) ); - if(item) - { - GuiMenuBar::removeMenuItem( mData->mMenuGui, item); - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::enableItem( S32 pos, bool enable ) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - { - if( item->id == pos) - item->enabled = enable; - } -} - -void PopupMenu::checkItem(S32 pos, bool checked) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - if(item->id == pos) - break; - - if( !item ) - return; - - if(checked && item->checkGroup != -1) - { - // first, uncheck everything in the group: - for( GuiMenuBar::MenuItem *itemWalk = mData->mMenuGui->firstMenuItem; itemWalk; itemWalk = itemWalk->nextMenuItem ) - if( itemWalk->checkGroup == item->checkGroup && itemWalk->bitmapIndex == mData->mCheckedBitmapIdx ) - itemWalk->bitmapIndex = -1; - } - - item->bitmapIndex = checked ? mData->mCheckedBitmapIdx : -1; -} - -void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - { - if(item->id >= firstPos && item->id <= lastPos) - { - item->bitmapIndex = (item->id == checkPos) ? mData->mCheckedBitmapIdx : -1; - } - } -} - -bool PopupMenu::isItemChecked(S32 pos) -{ - GuiMenuBar::MenuItem *item = NULL; - for( item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - if(item->id == pos) - return item->bitmapIndex == mData->mCheckedBitmapIdx; - - return false; -} - -U32 PopupMenu::getItemCount() -{ - int count = 0; - for( GuiMenuBar::MenuItem *item = mData->mMenuGui->firstMenuItem; item; item = item->nextMenuItem ) - ++count; - - return count; -} - -////////////////////////////////////////////////////////////////////////// - -bool PopupMenu::canHandleID(U32 id) -{ - return true; -} - -bool PopupMenu::handleSelect(U32 command, const char *text /* = NULL */) -{ - return dAtob(Con::executef(this, "onSelectItem", Con::getIntArg(command), text ? text : "")); -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) -{ - if(owner == NULL) - return; - - GuiControl* editorGui; - Sim::findObject("EditorGui", editorGui); - - if (editorGui) - { - GuiPopupMenuTextListCtrl* textList; - GuiPopupMenuBackgroundCtrl* backgroundCtrl; - Sim::findObject("PopUpMenuControl", backgroundCtrl); - - GuiControlProfile* profile; - Sim::findObject("GuiMenubarProfile", profile); - - if (!profile) - return; - - if (!backgroundCtrl) - { - textList = new GuiPopupMenuTextListCtrl(); - - textList->registerObject(); - - backgroundCtrl = new GuiPopupMenuBackgroundCtrl(textList); - - backgroundCtrl->registerObject("PopUpMenuControl"); - - textList->setControlProfile(profile); - - backgroundCtrl->addObject(textList); - } - else - { - textList = dynamic_cast(backgroundCtrl->first()); - } - - if (!backgroundCtrl || !textList) - return; - - owner->pushDialogControl(backgroundCtrl, 10); - - backgroundCtrl->setExtent(editorGui->getExtent()); - - textList->clear(); - textList->mMenu = mData->mMenuGui; - textList->mMenuBar = findMenuBarCtrl(); - textList->mPopup = this; - - S32 textWidth = 0, width = 0; - S32 acceleratorWidth = 0; - GFont *font = profile->mFont; - - Point2I maxBitmapSize = Point2I(0, 0); - - S32 numBitmaps = profile->mBitmapArrayRects.size(); - if (numBitmaps) - { - RectI *bitmapBounds = profile->mBitmapArrayRects.address(); - for (S32 i = 0; i < numBitmaps; i++) - { - if (bitmapBounds[i].extent.x > maxBitmapSize.x) - maxBitmapSize.x = bitmapBounds[i].extent.x; - if (bitmapBounds[i].extent.y > maxBitmapSize.y) - maxBitmapSize.y = bitmapBounds[i].extent.y; - } - } - - for (GuiMenuBar::MenuItem *walk = mData->mMenuGui->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if (!walk->visible) - continue; - - S32 iTextWidth = font->getStrWidth(walk->text); - S32 iAcceleratorWidth = walk->accelerator ? font->getStrWidth(walk->accelerator) : 0; - - if (iTextWidth > textWidth) - textWidth = iTextWidth; - if (iAcceleratorWidth > acceleratorWidth) - acceleratorWidth = iAcceleratorWidth; - } - width = textWidth + acceleratorWidth + maxBitmapSize.x * 2 + 2 + 4; - - textList->setCellSize(Point2I(width, font->getHeight() + 2)); - textList->clearColumnOffsets(); - textList->addColumnOffset(-1); // add an empty column in for the bitmap index. - textList->addColumnOffset(maxBitmapSize.x + 1); - textList->addColumnOffset(maxBitmapSize.x + 1 + textWidth + 4); - - U32 entryCount = 0; - - for (GuiMenuBar::MenuItem *walk = mData->mMenuGui->firstMenuItem; walk; walk = walk->nextMenuItem) - { - if (!walk->visible) - continue; - - char buf[512]; - - // If this menu item is a submenu, then set the isSubmenu to 2 to indicate - // an arrow should be drawn. Otherwise set the isSubmenu normally. - char isSubmenu = 1; - if (walk->isSubmenu) - isSubmenu = 2; - - char bitmapIndex = 1; - if (walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= profile->mBitmapArrayRects.size())) - bitmapIndex = walk->bitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, walk->text, walk->accelerator ? walk->accelerator : ""); - textList->addEntry(entryCount, buf); - - if (!walk->enabled) - textList->setEntryActive(entryCount, false); - - entryCount++; - } - - Point2I pos = owner->getCursorPos(); - textList->setPosition(pos); - - //nudge in if we'd overshoot the screen - S32 widthDiff = (textList->getPosition().x + textList->getExtent().x) - backgroundCtrl->getWidth(); - if (widthDiff > 0) - { - Point2I popupPos = textList->getPosition(); - textList->setPosition(popupPos.x - widthDiff, popupPos.y); - } - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos, const char *title) -{ - if(owner == NULL || isAttachedToMenuBar()) - return; -} - -// New version of above for use by MenuBar class. Do not use yet. -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos) -{ - if(owner == NULL || isAttachedToMenuBar()) - return; - - //mData->mMenuBar = owner->setMenuBar(); -} - -void PopupMenu::removeFromMenuBar() -{ - if(isAttachedToMenuBar()) - return; -} - -S32 PopupMenu::getPosOnMenuBar() -{ - - return 0; -} - -#endif diff --git a/Engine/source/platformWin32/menus/menuBarWin32.cpp b/Engine/source/platformWin32/menus/menuBarWin32.cpp deleted file mode 100644 index dfa103161..000000000 --- a/Engine/source/platformWin32/menus/menuBarWin32.cpp +++ /dev/null @@ -1,177 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platformWin32/platformWin32.h" -#include "platform/menus/menuBar.h" -#include "platform/menus/popupMenu.h" -#include "gui/core/guiCanvas.h" -#include "windowManager/platformWindowMgr.h" -#include "windowManager/win32/win32Window.h" -#include "core/util/safeDelete.h" - -//----------------------------------------------------------------------------- -// Platform Data -//----------------------------------------------------------------------------- - -// class PlatformMenuBarData -// { -// -// }; - -//----------------------------------------------------------------------------- -// MenuBar Methods -//----------------------------------------------------------------------------- - -#ifndef TORQUE_SDL - -void MenuBar::createPlatformPopupMenuData() -{ -// mData = new PlatformMenuBarData; - - // [tom, 6/4/2007] Nothing currently needed for win32 - mData = NULL; -} - -void MenuBar::deletePlatformPopupMenuData() -{ -// SAFE_DELETE(mData); -} - -//----------------------------------------------------------------------------- - -void MenuBar::updateMenuBar(PopupMenu *menu /* = NULL */) -{ - if(! isAttachedToCanvas()) - return; - - if(menu == NULL) - { - // [tom, 6/4/2007] Kludgetastic - GuiCanvas *oldCanvas = mCanvas; - S32 pos = -1; - PopupMenu *mnu = dynamic_cast(at(0)); - if(mnu) - pos = mnu->getPosOnMenuBar(); - - removeFromCanvas(); - attachToCanvas(oldCanvas, pos); - - return; - } - - menu->removeFromMenuBar(); - SimSet::iterator itr = find(begin(), end(), menu); - if(itr == end()) - return; - - menu->attachToMenuBar(mCanvas, itr - begin()); - - Win32Window *pWindow = dynamic_cast(mCanvas->getPlatformWindow()); - if(pWindow == NULL) - return; - - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); -} - -//----------------------------------------------------------------------------- - -void MenuBar::attachToCanvas(GuiCanvas *owner, S32 pos) -{ - if(owner == NULL || isAttachedToCanvas()) - return; - - // This is set for popup menus in the onAttachToMenuBar() callback - mCanvas = owner; - - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - // Setup the native menu bar - HMENU hWindowMenu = pWindow->getMenuHandle(); - if(hWindowMenu == NULL && !Journal::IsPlaying()) - { - hWindowMenu = CreateMenu(); - if(hWindowMenu) - { - pWindow->setMenuHandle( hWindowMenu); - } - } - - // Add the items - for(S32 i = 0;i < size();++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if(mnu == NULL) - { - Con::warnf("MenuBar::attachToMenuBar - Non-PopupMenu object in set"); - continue; - } - - if(mnu->isAttachedToMenuBar()) - mnu->removeFromMenuBar(); - - mnu->attachToMenuBar(owner, pos + i); - } - - HWND hWindow = pWindow->getHWND(); - SetMenu(hWindow, hWindowMenu); - DrawMenuBar(hWindow); - -} - -void MenuBar::removeFromCanvas() -{ - if(mCanvas == NULL || ! isAttachedToCanvas()) - return; - - Win32Window *pWindow = dynamic_cast(mCanvas->getPlatformWindow()); - if(pWindow == NULL) - return; - - // Setup the native menu bar - HMENU hWindowMenu = pWindow->getMenuHandle(); - if(hWindowMenu == NULL) - return; - - // Add the items - for(S32 i = 0;i < size();++i) - { - PopupMenu *mnu = dynamic_cast(at(i)); - if(mnu == NULL) - { - Con::warnf("MenuBar::removeFromMenuBar - Non-PopupMenu object in set"); - continue; - } - - mnu->removeFromMenuBar(); - } - - HWND hWindow = pWindow->getHWND(); - SetMenu(hWindow, NULL); - DrawMenuBar(hWindow); - - mCanvas = NULL; -} - -#endif diff --git a/Engine/source/platformWin32/menus/popupMenuWin32.cpp b/Engine/source/platformWin32/menus/popupMenuWin32.cpp deleted file mode 100644 index fc3170eeb..000000000 --- a/Engine/source/platformWin32/menus/popupMenuWin32.cpp +++ /dev/null @@ -1,746 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#ifndef TORQUE_SDL - -#include "platform/menus/popupMenu.h" -#include "platformWin32/platformWin32.h" -#include "console/engineAPI.h" -#include "console/consoleTypes.h" -#include "gui/core/guiCanvas.h" -#include "windowManager/platformWindowMgr.h" -#include "windowManager/win32/win32Window.h" -#include "core/util/safeDelete.h" - -#include "sim/actionMap.h" -#include "platform/platformInput.h" - -////////////////////////////////////////////////////////////////////////// -// Platform Menu Data -////////////////////////////////////////////////////////////////////////// - -struct PlatformPopupMenuData -{ - static U32 mLastPopupMenuID; - static const U32 PopupMenuIDRange; - - HMENU mMenu; - U32 mMenuID; - U32 mLastID; - - Win32Window::AcceleratorList mAccelerators; - Win32Window::AcceleratorList mDisabledAccelerators; - - PlatformPopupMenuData() - { - mMenu = NULL; - mMenuID = mLastPopupMenuID++; - mLastID = 0; - } - - ~PlatformPopupMenuData() - { - if(mMenu) - DestroyMenu(mMenu); - } - - void insertAccelerator(EventDescriptor &desc, U32 id); - void removeAccelerator(U32 id); - void setAccelleratorEnabled(U32 id, bool enabled); -}; - -U32 PlatformPopupMenuData::mLastPopupMenuID = 0; -const U32 PlatformPopupMenuData::PopupMenuIDRange = 100; - -////////////////////////////////////////////////////////////////////////// - -void PlatformPopupMenuData::insertAccelerator(EventDescriptor &desc, U32 id) -{ - if(desc.eventType != SI_KEY) - return; - - Win32Window::AcceleratorList::iterator i; - for(i = mAccelerators.begin();i != mAccelerators.end();++i) - { - if(i->mID == id) - { - // Update existing entry - i->mDescriptor.eventType = desc.eventType; - i->mDescriptor.eventCode = desc.eventCode; - i->mDescriptor.flags = desc.flags; - return; - } - - if(i->mDescriptor.eventType == desc.eventType && i->mDescriptor.eventCode == desc.eventCode && i->mDescriptor.flags == desc.flags) - { - // Already have a matching accelerator, don't add another one - return; - } - } - - Win32Window::Accelerator accel; - accel.mDescriptor = desc; - accel.mID = id; - mAccelerators.push_back(accel); -} - -void PlatformPopupMenuData::removeAccelerator(U32 id) -{ - Win32Window::AcceleratorList::iterator i; - for(i = mAccelerators.begin();i != mAccelerators.end();++i) - { - if(i->mID == id) - { - mAccelerators.erase(i); - return; - } - } -} - -void PlatformPopupMenuData::setAccelleratorEnabled( U32 id, bool enabled ) -{ - Win32Window::AcceleratorList *src = NULL; - Win32Window::AcceleratorList *dst = NULL; - - if ( enabled ) - { - src = &mDisabledAccelerators; - dst = &mAccelerators; - } - else - { - src = &mAccelerators; - dst = &mDisabledAccelerators; - } - - Win32Window::AcceleratorList::iterator i; - for ( i = src->begin(); i != src->end(); ++i ) - { - if ( i->mID == id ) - { - Win32Window::Accelerator tmp = *i; - src->erase( i ); - dst->push_back( tmp ); - return; - } - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::createPlatformPopupMenuData() -{ - mData = new PlatformPopupMenuData; -} - -void PopupMenu::deletePlatformPopupMenuData() -{ - SAFE_DELETE(mData); -} -void PopupMenu::createPlatformMenu() -{ - mData->mMenu = mIsPopup ? CreatePopupMenu() : CreateMenu(); - AssertFatal(mData->mMenu, "Unable to create menu"); - - MENUINFO mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.fMask = MIM_MENUDATA; - mi.dwMenuData = (ULONG_PTR)this; - SetMenuInfo(mData->mMenu, &mi); -} - -////////////////////////////////////////////////////////////////////////// -// Public Methods -////////////////////////////////////////////////////////////////////////// - -S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, const char *) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return -1; - - MENUITEMINFOA mi = { 0 }; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_ID|MIIM_TYPE; - mi.wID = (mData->mMenuID * PlatformPopupMenuData::PopupMenuIDRange) + mData->mLastID + 1; - mData->mLastID++; - if(title && *title) - mi.fType = MFT_STRING; - else - mi.fType = MFT_SEPARATOR; - - char buf[1024]; - if(accelerator && *accelerator) - { - dSprintf(buf, sizeof(buf), "%s\t%s", title, accelerator); - - if(isAttached) - pWindow->removeAccelerators(mData->mAccelerators); - - // Build entry for accelerator table - EventDescriptor accelDesc; - if(ActionMap::createEventDescriptor(accelerator, &accelDesc)) - mData->insertAccelerator(accelDesc, mi.wID); - else - Con::errorf("PopupMenu::insertItem - Could not create event descriptor for accelerator \"%s\"", accelerator); - - if(isAttached) - pWindow->addAccelerators(mData->mAccelerators); - } - else - dSprintf(buf, sizeof(buf), "%s", title); - - mi.dwTypeData = (LPSTR)buf; - - if(InsertMenuItemA(mData->mMenu, pos, TRUE, &mi)) - { - if(isAttached) - { - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } - return mi.wID; - } - - return -1; -} - -S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return -1; - - for(S32 i = 0;i < mSubmenus->size();i++) - { - if(submenu == (*mSubmenus)[i]) - { - Con::errorf("PopupMenu::insertSubMenu - Attempting to add submenu twice"); - return -1; - } - } - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_ID|MIIM_TYPE|MIIM_SUBMENU|MIIM_DATA; - mi.wID = (mData->mMenuID * PlatformPopupMenuData::PopupMenuIDRange) + mData->mLastID + 1; - if(title && *title) - mi.fType = MFT_STRING; - else - mi.fType = MFT_SEPARATOR; - mi.dwTypeData = (LPSTR)title; - mi.hSubMenu = submenu->mData->mMenu; - mi.dwItemData = (ULONG_PTR)submenu; - if(InsertMenuItemA(mData->mMenu, pos, TRUE, &mi)) - { - mSubmenus->addObject(submenu); - - if(isAttached) - { - pWindow->addAccelerators(submenu->mData->mAccelerators); - - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } - return mi.wID; - } - - return -1; -} - -bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, const char *) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return false; - - // Are we out of range? - if ( pos >= getItemCount() ) - return false; - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_TYPE; - - if(title && *title) - mi.fType = MFT_STRING; - else - mi.fType = MFT_SEPARATOR; - - char buf[1024]; - if(accelerator && *accelerator) - { - dSprintf(buf, sizeof(buf), "%s\t%s", title, accelerator); - - if(isAttached) - pWindow->removeAccelerators(mData->mAccelerators); - - // Build entry for accelerator table - EventDescriptor accelDesc; - if(ActionMap::createEventDescriptor(accelerator, &accelDesc)) - mData->insertAccelerator(accelDesc, pos); - else - Con::errorf("PopupMenu::setItem - Could not create event descriptor for accelerator \"%s\"", accelerator); - - if(isAttached) - pWindow->addAccelerators(mData->mAccelerators); - } - else - dSprintf(buf, sizeof(buf), "%s", title); - - mi.dwTypeData = (LPSTR)buf; - - if(SetMenuItemInfoA(mData->mMenu, pos, TRUE, &mi)) - { - if(isAttached) - { - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } - - return true; - } - - return false; -} - -void PopupMenu::removeItem(S32 itemPos) -{ - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - bool isAttached = isAttachedToMenuBar(); - if(isAttached && pWindow == NULL) - return; - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_DATA|MIIM_ID; - if(GetMenuItemInfoA(mData->mMenu, itemPos, TRUE, &mi)) - { - bool submenu = false; - - // Update list of submenus if this is a submenu - if(mi.fMask & MIIM_DATA) - { - PopupMenu *mnu = (PopupMenu *)mi.dwItemData; - if( mnu != NULL ) - { - if(isAttached) - pWindow->removeAccelerators(mnu->mData->mAccelerators); - mSubmenus->removeObject(mnu); - - submenu = true; - } - } - - if(! submenu) - { - // Update accelerators if this has an accelerator and wasn't a sub menu - for(S32 i = 0;i < mData->mAccelerators.size();++i) - { - if(mData->mAccelerators[i].mID == mi.wID) - { - if(isAttached) - pWindow->removeAccelerators(mData->mAccelerators); - - mData->mAccelerators.erase(i); - - if(isAttached) - pWindow->addAccelerators(mData->mAccelerators); - - break; - } - } - } - } - else - return; - - RemoveMenu(mData->mMenu, itemPos, MF_BYPOSITION); - - if(isAttached) - { - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - } -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::enableItem( S32 pos, bool enable ) -{ - U32 flags = enable ? MF_ENABLED : MF_GRAYED; - EnableMenuItem( mData->mMenu, pos, MF_BYPOSITION|flags ); - - // Update accelerators. - - // NOTE: This really DOES need to happen. A disabled menu item - // should not still have an accelerator mapped to it. - // - // Unfortunately, the editors currently only set menu items - // enabled/disabled when the menu itself is selected which means our - // accelerators would be out of synch. - - /* - Win32Window *pWindow = mCanvas ? dynamic_cast( mCanvas->getPlatformWindow() ) : NULL; - bool isAttached = isAttachedToMenuBar(); - if ( isAttached && pWindow == NULL ) - return; - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_DATA|MIIM_ID; - if ( !GetMenuItemInfoA( mData->mMenu, pos, TRUE, &mi) ) - return; - - if ( isAttached ) - pWindow->removeAccelerators( mData->mAccelerators ); - - mData->setAccelleratorEnabled( mi.wID, enable ); - - if ( isAttached ) - pWindow->addAccelerators( mData->mAccelerators ); - */ -} - -void PopupMenu::checkItem(S32 pos, bool checked) -{ -// U32 flags = checked ? MF_CHECKED : MF_UNCHECKED; -// CheckMenuItem(mData->mMenu, pos, MF_BYPOSITION|flags); - - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_STATE; - mi.fState = checked ? MFS_CHECKED : MFS_UNCHECKED; - SetMenuItemInfoA(mData->mMenu, pos, TRUE, &mi); -} - -void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) -{ - CheckMenuRadioItem(mData->mMenu, firstPos, lastPos, checkPos, MF_BYPOSITION); -} - -bool PopupMenu::isItemChecked(S32 pos) -{ - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_STATE; - if(GetMenuItemInfoA(mData->mMenu, pos, TRUE, &mi) && (mi.fState & MFS_CHECKED)) - return true; - return false; -} - -U32 PopupMenu::getItemCount() -{ - return GetMenuItemCount( mData->mMenu ); -} - -////////////////////////////////////////////////////////////////////////// - -bool PopupMenu::canHandleID(U32 id) -{ - for(S32 i = 0;i < mSubmenus->size();i++) - { - PopupMenu *subM = dynamic_cast((*mSubmenus)[i]); - if(subM == NULL) - continue; - - if(subM->canHandleID(id)) - return true; - } - - if(id >= mData->mMenuID * PlatformPopupMenuData::PopupMenuIDRange && - id < (mData->mMenuID+1) * PlatformPopupMenuData::PopupMenuIDRange) - { - return true; - } - - return false; -} - -bool PopupMenu::handleSelect(U32 command, const char *text /* = NULL */) -{ - // [tom, 8/20/2006] Pass off to a sub menu if it's for them - for(S32 i = 0;i < mSubmenus->size();i++) - { - PopupMenu *subM = dynamic_cast((*mSubmenus)[i]); - if(subM == NULL) - continue; - - if(subM->canHandleID(command)) - { - return subM->handleSelect(command, text); - } - } - - // [tom, 8/21/2006] Cheesey hack to find the position based on ID - char buf[512]; - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.dwTypeData = NULL; - - S32 numItems = GetMenuItemCount(mData->mMenu); - S32 pos = -1; - for(S32 i = 0;i < numItems;i++) - { - mi.fMask = MIIM_ID|MIIM_STRING|MIIM_STATE; - if(GetMenuItemInfoA(mData->mMenu, i, TRUE, &mi)) - { - if(mi.wID == command) - { - if(text == NULL) - { - mi.dwTypeData = buf; - mi.cch++; - GetMenuItemInfoA(mData->mMenu, i, TRUE, &mi); - - // [tom, 5/11/2007] Don't do anything if the menu item is disabled - if(mi.fState & MFS_DISABLED) - return false; - - text = StringTable->insert(mi.dwTypeData); - } - pos = i; - break; - } - } - } - - if(pos == -1) - { - Con::errorf("PopupMenu::handleSelect - Could not find menu item position for ID %d ... this shouldn't happen!", command); - return false; - } - - // [tom, 8/20/2006] Wasn't handled by a submenu, pass off to script - return dAtob(Con::executef(this, "onSelectItem", Con::getIntArg(pos), text ? text : "")); -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) -{ - if( owner == NULL ) - { - Con::warnf("PopupMenu::showPopup - Invalid canvas supplied!"); - return; - } - - // [tom, 6/4/2007] showPopup() blocks until the menu is closed by the user, - // so the canvas pointer is not needed beyond the scope of this function - // when working with context menus. Setting mCanvas here will cause undesired - // behavior in relation to the menu bar. - - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - HWND hWindow = pWindow->getHWND(); - POINT p; - if(x == -1 && y == -1) - GetCursorPos(&p); - else - { - p.x = x; - p.y = y; - ClientToScreen(hWindow, &p); - } - - winState.renderThreadBlocked = true; - U32 opt = (int)TrackPopupMenu(mData->mMenu, TPM_NONOTIFY|TPM_RETURNCMD, p.x, p.y, 0, hWindow, NULL); - if(opt > 0) - handleSelect(opt, NULL); - winState.renderThreadBlocked = false; -} - -////////////////////////////////////////////////////////////////////////// - -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos, const char *title) -{ - if(owner == NULL || isAttachedToMenuBar()) - return; - - // This is set for sub-menus in the onAttachToMenuBar() callback - mCanvas = owner; - - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - HMENU hWindowMenu = pWindow->getMenuHandle(); - if(hWindowMenu == NULL) - { - hWindowMenu = CreateMenu(); - if(hWindowMenu) - { - pWindow->setMenuHandle( hWindowMenu); - } - } - - MENUITEMINFOA mii; - - mii.cbSize = sizeof(MENUITEMINFOA); - - mii.fMask = MIIM_STRING|MIIM_DATA; - mii.dwTypeData = (LPSTR)title; - mii.fMask |= MIIM_ID; - mii.wID = mData->mMenuID; - mii.fMask |= MIIM_SUBMENU; - mii.hSubMenu = mData->mMenu; - mii.dwItemData = (ULONG_PTR)this; - - InsertMenuItemA(hWindowMenu, pos, TRUE, &mii); - - HWND hWindow = pWindow->getHWND(); - DrawMenuBar(hWindow); - - pWindow->addAccelerators(mData->mAccelerators); - - // Add accelerators for sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *submenu = dynamic_cast(*i); - if(submenu == NULL) - continue; - - pWindow->addAccelerators(submenu->mData->mAccelerators); - } - - onAttachToMenuBar(owner, pos, title); -} - -// New version of above for use by MenuBar class. Do not use yet. -void PopupMenu::attachToMenuBar(GuiCanvas *owner, S32 pos) -{ - Win32Window *pWindow = dynamic_cast(owner->getPlatformWindow()); - if(pWindow == NULL) - return; - - //When playing a journal, the system menu is not actually shown - if (Journal::IsPlaying()) - { - onAttachToMenuBar(owner, pos, mBarTitle); - return; - } - - HMENU hWindowMenu = pWindow->getMenuHandle(); - - MENUITEMINFOA mii; - - mii.cbSize = sizeof(MENUITEMINFOA); - - mii.fMask = MIIM_STRING|MIIM_DATA; - mii.dwTypeData = (LPSTR)mBarTitle; - mii.fMask |= MIIM_ID; - mii.wID = mData->mMenuID; - mii.fMask |= MIIM_SUBMENU; - mii.hSubMenu = mData->mMenu; - mii.dwItemData = (ULONG_PTR)this; - - InsertMenuItemA(hWindowMenu, pos, TRUE, &mii); - - pWindow->addAccelerators(mData->mAccelerators); - - // Add accelerators for sub menus (have to do this here as it's platform specific) - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *submenu = dynamic_cast(*i); - if(submenu == NULL) - continue; - - pWindow->addAccelerators(submenu->mData->mAccelerators); - } - - onAttachToMenuBar(owner, pos, mBarTitle); -} - -void PopupMenu::removeFromMenuBar() -{ - S32 pos = getPosOnMenuBar(); - if(pos == -1) - return; - - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - if(pWindow == NULL) - return; - - HMENU hMenuHandle = pWindow->getMenuHandle(); - if(!hMenuHandle) - return; - - RemoveMenu(hMenuHandle, pos, MF_BYPOSITION); - - HWND hWindow = pWindow->getHWND(); - - DrawMenuBar(hWindow); - - pWindow->removeAccelerators(mData->mAccelerators); - - // Remove accelerators for sub menus - for(SimSet::iterator i = mSubmenus->begin();i != mSubmenus->end();++i) - { - PopupMenu *submenu = dynamic_cast(*i); - if(submenu == NULL) - continue; - - pWindow->removeAccelerators(submenu->mData->mAccelerators); - } - - onRemoveFromMenuBar(mCanvas); -} - -S32 PopupMenu::getPosOnMenuBar() -{ - if(mCanvas == NULL) - return -1; - - Win32Window *pWindow = mCanvas ? dynamic_cast(mCanvas->getPlatformWindow()) : NULL; - if(pWindow == NULL) - return -1; - - HMENU hMenuHandle = pWindow->getMenuHandle(); - S32 numItems = GetMenuItemCount(hMenuHandle); - S32 pos = -1; - for(S32 i = 0;i < numItems;i++) - { - MENUITEMINFOA mi; - mi.cbSize = sizeof(mi); - mi.fMask = MIIM_DATA; - if(GetMenuItemInfoA(hMenuHandle, i, TRUE, &mi)) - { - if(mi.fMask & MIIM_DATA) - { - PopupMenu *mnu = (PopupMenu *)mi.dwItemData; - if(mnu == this) - { - pos = i; - break; - } - } - } - } - - return pos; -} - -#endif \ No newline at end of file diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index a48e3743d..149825b98 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -27,7 +27,6 @@ #include "windowManager/sdl/sdlWindowMgr.h" #include "windowManager/sdl/sdlCursorController.h" #include "platformSDL/sdlInput.h" -#include "platform/menus/popupMenu.h" #include "platform/platformInput.h" #include "gfx/gfxDevice.h" diff --git a/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs b/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs index 696b98975..f2de82d96 100644 --- a/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs +++ b/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs @@ -35,5 +35,4 @@ exec("./GuiEaseEditDlg.ed.cs"); exec("./guiObjectInspector.ed.cs"); exec("./uvEditor.ed.gui"); exec("./objectSelection.ed.cs"); -exec("./guiPlatformGenericMenubar.ed.cs"); exec("./postFxManager.gui"); \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.cs b/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.cs deleted file mode 100644 index 089b0b8fa..000000000 --- a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.cs +++ /dev/null @@ -1,19 +0,0 @@ -if(isClass(GuiPlatformGenericMenuBar)) -{ - exec("./guiPlatformGenericMenubar.ed.gui"); -} -else -{ - %guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiControl() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; - }; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.gui b/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.gui deleted file mode 100644 index 8d2cbcd74..000000000 --- a/Templates/BaseGame/game/tools/gui/guiPlatformGenericMenubar.ed.gui +++ /dev/null @@ -1,14 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -%guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiPlatformGenericMenuBar() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; -}; -//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs index 1305ae170..83317d0d8 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs @@ -66,9 +66,13 @@ function GuiEditCanvas::onCreateMenu(%this) } // Menu bar - %this.menuBar = new MenuBar() + %this.menuBar = new GuiMenuBar(GuiEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; new PopupMenu() { diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index bc1905292..535d00880 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -2017,7 +2017,7 @@ function EWorldEditor::syncGui( %this ) %this.syncToolPalette(); EditorTree.update(); - Editor.getUndoManager().updateUndoMenu( EditorGui.menuBar-->EditMenu ); + Editor.getUndoManager().updateUndoMenu( EditorGui.findMenu("Edit") ); EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() ); EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 ); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs index dbe978cab..b225d3534 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs @@ -110,9 +110,13 @@ function EditorGui::buildMenus(%this) }; // Menu bar - %this.menuBar = new MenuBar(WorldEditorMenubar) + %this.menuBar = new GuiMenuBar(WorldEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; }; // File Menu @@ -158,7 +162,7 @@ function EditorGui::buildMenus(%this) %fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();"); %fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();"); - %this.menuBar.insert(%fileMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%fileMenu); // Edit Menu %editMenu = new PopupMenu() @@ -187,7 +191,7 @@ function EditorGui::buildMenus(%this) item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; }; - %this.menuBar.insert(%editMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editMenu); // View Menu %viewMenu = new PopupMenu() @@ -201,7 +205,7 @@ function EditorGui::buildMenus(%this) item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();"; item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();"; }; - %this.menuBar.insert(%viewMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%viewMenu); // Camera Menu %cameraMenu = new PopupMenu() @@ -229,7 +233,7 @@ function EditorGui::buildMenus(%this) Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();"; item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu; }; - %this.menuBar.insert(%cameraMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%cameraMenu); // Editors Menu %editorsMenu = new PopupMenu() @@ -246,7 +250,7 @@ function EditorGui::buildMenus(%this) //item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin; //item[5] = "-"; }; - %this.menuBar.insert(%editorsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editorsMenu); // Lighting Menu %lightingMenu = new PopupMenu() @@ -263,7 +267,7 @@ function EditorGui::buildMenus(%this) // NOTE: The light managers will be inserted as the // last menu items in EditorLightingMenu::onAdd(). }; - %this.menuBar.insert(%lightingMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%lightingMenu); // Tools Menu %toolsMenu = new PopupMenu() @@ -278,7 +282,7 @@ function EditorGui::buildMenus(%this) item[2] = "Torque SimView" TAB "" TAB "tree();"; item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();"; }; - %this.menuBar.insert(%toolsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%toolsMenu); // Help Menu %helpMenu = new PopupMenu() @@ -293,7 +297,7 @@ function EditorGui::buildMenus(%this) item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);"; item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);"; }; - %this.menuBar.insert(%helpMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%helpMenu); // Menus that are added/removed dynamically (temporary) @@ -398,9 +402,9 @@ function EditorGui::setMenuDefaultState(%this) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + for(%i = 0;%i < %this.menuBar.getMenuCount();%i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); %menu.setupDefaultState(); } @@ -414,9 +418,10 @@ function EditorGui::findMenu(%this, %name) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + + for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); if(%name $= %menu.barTitle) return %menu; diff --git a/Templates/Full/game/tools/gui/guiDialogs.ed.cs b/Templates/Full/game/tools/gui/guiDialogs.ed.cs index db09e8570..dc6b4e3a3 100644 --- a/Templates/Full/game/tools/gui/guiDialogs.ed.cs +++ b/Templates/Full/game/tools/gui/guiDialogs.ed.cs @@ -35,4 +35,3 @@ exec("./GuiEaseEditDlg.ed.cs"); exec("./guiObjectInspector.ed.cs"); exec("./uvEditor.ed.gui"); exec("./objectSelection.ed.cs"); -exec("./guiPlatformGenericMenubar.ed.cs"); diff --git a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.cs b/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.cs deleted file mode 100644 index 089b0b8fa..000000000 --- a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.cs +++ /dev/null @@ -1,19 +0,0 @@ -if(isClass(GuiPlatformGenericMenuBar)) -{ - exec("./guiPlatformGenericMenubar.ed.gui"); -} -else -{ - %guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiControl() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; - }; -} \ No newline at end of file diff --git a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.gui b/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.gui deleted file mode 100644 index 8d2cbcd74..000000000 --- a/Templates/Full/game/tools/gui/guiPlatformGenericMenubar.ed.gui +++ /dev/null @@ -1,14 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -%guiContent = new GuiControl(PlatformGenericMenubar) { - profile = "GuiModelessDialogProfile"; - - new GuiPlatformGenericMenuBar() - { - internalName = "menubar"; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; -}; -//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs b/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs index 1305ae170..83317d0d8 100644 --- a/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs +++ b/Templates/Full/game/tools/guiEditor/scripts/guiEditorCanvas.ed.cs @@ -66,9 +66,13 @@ function GuiEditCanvas::onCreateMenu(%this) } // Menu bar - %this.menuBar = new MenuBar() + %this.menuBar = new GuiMenuBar(GuiEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; new PopupMenu() { diff --git a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs index bc1905292..b225d3534 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -20,2813 +20,412 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -function EditorGui::init(%this) +function EditorGui::buildMenus(%this) { - EWorldEditor.isDirty = false; - ETerrainEditor.isDirty = false; - ETerrainEditor.isMissionDirty = false; - - if( %this.isInitialized ) + if(isObject(%this.menuBar)) return; - - %this.readWorldEditorSettings(); - - $SelectedOperation = -1; - $NextOperationId = 1; - $HeightfieldDirtyRow = -1; - - if( !isObject( %this-->ToolsPaletteWindow ) ) - { - // Load Creator/Inspector GUI - exec("~/worldEditor/gui/ToolsPaletteGroups/init.cs"); - exec("~/worldEditor/gui/ToolsPaletteWindow.ed.gui"); - - if( isObject( EWToolsPaletteWindow ) ) - { - %this.add( EWToolsPaletteWindow ); - EWToolsPaletteWindow.init(); - EWToolsPaletteWindow.setVisible( false ); - } + + //set up %cmdctrl variable so that it matches OS standards + if( $platform $= "macos" ) + { + %cmdCtrl = "Cmd"; + %menuCmdCtrl = "Cmd"; + %quitShortcut = "Cmd Q"; + %redoShortcut = "Cmd-Shift Z"; } - - if( !isObject( %this-->TreeWindow ) ) - { - // Load Creator/Inspector GUI - exec("~/worldEditor/gui/WorldEditorTreeWindow.ed.gui"); - if( isObject( EWTreeWindow ) ) - { - %this.add( EWTreeWindow ); - EWTreeWindow-->EditorTree.selectPage( 0 ); - EWTreeWindow.setVisible( false ); - } - } - - if( !isObject( %this-->InspectorWindow ) ) - { - // Load Creator/Inspector GUI - exec("~/worldEditor/gui/WorldEditorInspectorWindow.ed.gui"); - //EWInspectorWindow.resize(getWord(EWInspectorWindow.Position, 0), getWord(EWInspectorWindow.Position, 1), getWord(EWInspectorWindow.extent, 0), getWord(EWInspectorWindow.extent, 1)); - if( isObject( EWInspectorWindow ) ) - { - %this.add( EWInspectorWindow ); - EWInspectorWindow.setVisible( false ); - } - } - - if( !isObject( %this-->WorldEditorToolbar ) ) - { - // Load Creator/Inspector GUI - exec("~/worldEditor/gui/WorldEditorToolbar.ed.gui"); - if( isObject( EWorldEditorToolbar ) ) - { - %this.add( EWorldEditorToolbar ); - EWorldEditorToolbar.setVisible( false ); - } - } - - if ( !isObject( %this-->TerrainEditToolbar ) ) - { - // Load Terrain Edit GUI - exec("~/worldEditor/gui/TerrainEditToolbar.ed.gui"); - if( isObject( EWTerrainEditToolbar ) ) - { - %this.add( EWTerrainEditToolbar ); - EWTerrainEditToolbar.setVisible( false ); - } - } - - if( !isObject( %this-->TerrainPainter ) ) - { - // Load Terrain Painter GUI - exec("~/worldEditor/gui/TerrainPainterWindow.ed.gui"); - if( isObject( %guiContent ) ){ - %this.add( %guiContent->TerrainPainter ); - %this.add( %guiContent->TerrainPainterPreview ); - } - - exec("~/worldEditor/gui/guiTerrainMaterialDlg.ed.gui"); - exec("~/worldEditor/gui/TerrainBrushSoftnessCurveDlg.ed.gui"); - } - if ( !isObject( %this-->TerrainPainterToolbar) ) - { - // Load Terrain Edit GUI - exec("~/worldEditor/gui/TerrainPainterToolbar.ed.gui"); - if( isObject( EWTerrainPainterToolbar ) ) - { - %this.add( EWTerrainPainterToolbar ); - EWTerrainPainterToolbar.setVisible( false ); - } - } - - if( !isObject( %this-->ToolsToolbar ) ) - { - // Load Creator/Inspector GUI - exec("~/worldEditor/gui/ToolsToolbar.ed.gui"); - if( isObject( EWToolsToolbar ) ) - { - %this.add( EWToolsToolbar ); - EWToolsToolbar.setVisible( true ); - - } - } - - // Visibility Layer Window - if( !isObject( %this-->VisibilityLayerWindow ) ) - { - %this.add( EVisibility ); - EVisibility.setVisible(false); - EVisibilityTabBook.selectPage(0); - } - - // Editor Settings Window - if( !isObject( %this-->EditorSettingsWindow ) ) - { - exec("~/worldEditor/gui/EditorSettingsWindow.ed.gui"); - exec("~/worldEditor/scripts/editorSettingsWindow.ed.cs"); - %this.add( ESettingsWindow ); - ESettingsWindow.setVisible(false); - - // Start the standard settings tabs pages - exec( "~/worldEditor/gui/GeneralSettingsTab.ed.gui" ); - ESettingsWindow.addTabPage( EGeneralSettingsPage ); - exec("~/worldEditor/gui/ObjectEditorSettingsTab.ed.gui"); - ESettingsWindow.addTabPage( EObjectEditorSettingsPage ); - exec("~/worldEditor/gui/AxisGizmoSettingsTab.ed.gui"); - ESettingsWindow.addTabPage( EAxisGizmoSettingsPage ); - exec("~/worldEditor/gui/TerrainEditorSettingsTab.ed.gui"); - ESettingsWindow.addTabPage( ETerrainEditorSettingsPage ); - exec("~/worldEditor/gui/CameraSettingsTab.ed.gui"); - ESettingsWindow.addTabPage( ECameraSettingsPage ); - } - - // Object Snap Options Window - if( !isObject( %this-->SnapOptionsWindow ) ) - { - exec("~/worldEditor/gui/ObjectSnapOptionsWindow.ed.gui"); - exec("~/worldEditor/scripts/objectSnapOptions.ed.cs"); - %this.add( ESnapOptions ); - ESnapOptions.setVisible(false); - ESnapOptionsTabBook.selectPage(0); - } - - // Transform Selection Window - if( !isObject( %this-->TransformSelectionWindow ) ) - { - exec("~/worldEditor/gui/TransformSelectionWindow.ed.gui"); - exec("~/worldEditor/scripts/transformSelection.ed.cs"); - %this.add( ETransformSelection ); - ETransformSelection.setVisible(false); - } - - // Manage Bookmarks Window - if( !isObject( %this-->ManageBookmarksWindow ) ) - { - %this.add( EManageBookmarks ); - EManageBookmarks.setVisible(false); - } - - // Manage SFXParameters Window - if( !isObject( %this-->ManageSFXParametersWindow ) ) - { - %this.add( EManageSFXParameters ); - EManageSFXParameters.setVisible( false ); - } - - // Select Objects Window - if( !isObject( %this->SelectObjectsWindow ) ) - { - %this.add( ESelectObjectsWindow ); - ESelectObjectsWindow.setVisible( false ); - } - - EWorldEditor.init(); - ETerrainEditor.init(); - - //Creator.init(); - EWCreatorWindow.init(); - ObjectBuilderGui.init(); - - %this.setMenuDefaultState(); - - EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/player"); - - /* - EWorldEditorCameraSpeed.clear(); - EWorldEditorCameraSpeed.add("Slowest - Camera 1",0); - EWorldEditorCameraSpeed.add("Slow - Camera 2",1); - EWorldEditorCameraSpeed.add("Slower - Camera 3",2); - EWorldEditorCameraSpeed.add("Normal - Camera 4",3); - EWorldEditorCameraSpeed.add("Faster - Camera 5",4); - EWorldEditorCameraSpeed.add("Fast - Camera 6",5); - EWorldEditorCameraSpeed.add("Fastest - Camera 7",6); - EWorldEditorCameraSpeed.setSelected(3); - */ - - EWorldEditorAlignPopup.clear(); - EWorldEditorAlignPopup.add("World",0); - EWorldEditorAlignPopup.add("Object",1); - EWorldEditorAlignPopup.setSelected(0); - - - // sync camera gui - EditorGui.syncCameraGui(); - - // this will brind CameraTypesDropdown to front so that it goes over the menubar - EditorGui.pushToBack(CameraTypesDropdown); - EditorGui.pushToBack(VisibilityDropdown); - - // dropdowns out so that they display correctly in editor gui - objectTransformDropdown.parentGroup = editorGui; - objectCenterDropdown.parentGroup = editorGui; - objectSnapDropdown.parentGroup = editorGui; - - // make sure to show the default world editor guis - EditorGui.bringToFront( EWorldEditor ); - EWorldEditor.setVisible( false ); - - // Call the startup callback on the editor plugins. - for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ ) - { - %obj = EditorPluginSet.getObject( %i ); - %obj.onWorldEditorStartup(); - } - - // With everything loaded, start up the settings window - ESettingsWindow.startup(); - - // Start up initial editor plugin. - - %initialEditor = %this.currentEditor; // Read from prefs. - %this.currentEditor = ""; - - if( %initialEditor $= "" ) - %initialEditor = "WorldEditorInspectorPlugin"; - %this.setEditor( %initialEditor, true, true ); - - // Done. - - %this.isInitialized = true; -} - -//------------------------------------------------------------------------------ -// Editor Gui's interactions with Camera Settings - -function EditorGui::setupDefaultCameraSettings( %this ) -{ - EditorSettings.beginGroup( "LevelInformation/levels/" @ %this.levelName ); - - EditorSettings.setDefaultValue( "cameraSpeedMin", "5" ); - EditorSettings.setDefaultValue( "cameraSpeedMax", "200" ); - - EditorSettings.endGroup(); -} - -function EditorGui::readCameraSettings( %this, %levelName ) -{ - if( %levelName !$= %this.levelName ) - return; - - EditorCameraSpeedOptions.setupGuiControls(); -} - -function EditorGui::writeCameraSettings( %this ) -{ - EditorSettings.beginGroup( "LevelInformation/levels/" @ %this.levelName ); - - EditorSettings.setValue( "cameraSpeed", $Camera::movementSpeed ); - - EditorSettings.endGroup(); -} - -//------------------------------------------------------------------------------ - -function EditorGui::shutdown( %this ) -{ - // Store settings. - %this.writeWorldEditorSettings(); - - // Deactivate current editor. - %this.setEditor( "" ); - - // Call the shutdown callback on the editor plugins. - foreach( %plugin in EditorPluginSet ) - %plugin.onWorldEditorShutdown(); -} - -/// This is used to add an editor to the Editors menu which -/// will take over the default world editor window. -function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin ) -{ - %windowMenu = %this.findMenu( "Editors" ); - %count = %windowMenu.getItemCount(); - - - %alreadyExists = false; - for ( %i = 0; %i < %count; %i++ ) - { - %existingPlugins = getField(%windowMenu.Item[%i], 2); - - if(%newPlugin $= %existingPlugins) - %alreadyExists = true; - } - - if( %accel $= "" && %count < 9 ) - %accel = "F" @ %count + 1; else - %accel = ""; - - if(!%alreadyExists) - %windowMenu.addItem( %count, %displayName TAB %accel TAB %newPlugin ); - - return %accel; -} - -function EditorGui::addToToolsToolbar( %this, %pluginName, %internalName, %bitmap, %tooltip ) -{ - %count = ToolsToolbarArray.getCount(); - - %alreadyExists = false; - for ( %i = 0; %i < %count; %i++ ) - { - %existingInternalName = ToolsToolbarArray.getObject(%i).getFieldValue("internalName"); - - if(%internalName $= %existingInternalName) - { - %alreadyExists = true; - break; - } - } - - if(!%alreadyExists) { - %button = new GuiBitmapButtonCtrl() { - canSaveDynamicFields = "0"; - internalName = %internalName; - Enabled = "1"; - isContainer = "0"; - Profile = "ToolsGuiButtonProfile"; - HorizSizing = "right"; - VertSizing = "bottom"; - position = "180 0"; - Extent = "25 19"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - Command = "EditorGui.setEditor(" @ %pluginName @ ");"; - tooltipprofile = "ToolsGuiToolTipProfile"; - ToolTip = %tooltip; - hovertime = "750"; - bitmap = %bitmap; - buttonType = "RadioButton"; - groupNum = "0"; - useMouseEvents = "0"; + %cmdCtrl = "Ctrl"; + %menuCmdCtrl = "Alt"; + %quitShortcut = "Alt F4"; + %redoShortcut = "Ctrl Y"; + } + + // Sub menus (temporary, until MenuBuilder gets updated) + // The speed increments located here are overwritten in EditorCameraSpeedMenu::setupDefaultState. + // The new min/max for the editor camera speed range can be set in each level's levelInfo object. + if(!isObject(EditorCameraSpeedOptions)) + { + %this.cameraSpeedMenu = new PopupMenu(EditorCameraSpeedOptions) + { + superClass = "MenuBuilder"; + class = "EditorCameraSpeedMenu"; + + item[0] = "Slowest" TAB %cmdCtrl @ "-Shift 1" TAB "5"; + item[1] = "Slow" TAB %cmdCtrl @ "-Shift 2" TAB "35"; + item[2] = "Slower" TAB %cmdCtrl @ "-Shift 3" TAB "70"; + item[3] = "Normal" TAB %cmdCtrl @ "-Shift 4" TAB "100"; + item[4] = "Faster" TAB %cmdCtrl @ "-Shift 5" TAB "130"; + item[5] = "Fast" TAB %cmdCtrl @ "-Shift 6" TAB "165"; + item[6] = "Fastest" TAB %cmdCtrl @ "-Shift 7" TAB "200"; }; - ToolsToolbarArray.add(%button); - EWToolsToolbar.setExtent((25 + 8) * (%count + 1) + 12 SPC "33"); } -} - -//----------------------------------------------------------------------------- - -function EditorGui::setDisplayType( %this, %type ) -{ - %gui = %this.currentEditor.editorGui; - if( !isObject( %gui ) ) - return; - - %this.viewTypeMenu.checkRadioItem( 0, 7, %type ); - - // Store the current camera rotation so we can restore it correctly when - // switching back to perspective view - if ( %gui.getDisplayType() == $EditTSCtrl::DisplayTypePerspective ) - %this.lastPerspectiveCamRotation = LocalClientConnection.camera.getRotation(); - - %gui.setDisplayType( %type ); - - if ( %gui.getDisplayType() == $EditTSCtrl::DisplayTypePerspective ) - LocalClientConnection.camera.setRotation( %this.lastPerspectiveCamRotation ); - - %this.currentDisplayType = %type; -} - -//----------------------------------------------------------------------------- - -function EditorGui::setEditor( %this, %newEditor, %dontActivate ) -{ - if ( isObject( %this.currentEditor ) ) + if(!isObject(EditorFreeCameraTypeOptions)) { - if( isObject( %newEditor ) && %this.currentEditor.getId() == %newEditor.getId() ) - return; - - if( %this.currentEditor.isActivated ) - %this.currentEditor.onDeactivated(); + %this.freeCameraTypeMenu = new PopupMenu(EditorFreeCameraTypeOptions) + { + superClass = "MenuBuilder"; + class = "EditorFreeCameraTypeMenu"; - if( isObject( %this.currentEditor.editorGui ) ) - %this.currentOrthoFOV = %this.currentEditor.editorGui.getOrthoFOV(); + item[0] = "Standard" TAB "Ctrl 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");"; + item[1] = "Orbit Camera" TAB "Ctrl 2" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\");"; + Item[2] = "-"; + item[3] = "Smoothed" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Camera\");"; + item[4] = "Smoothed Rotate" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");"; + }; } - - if( !isObject( %newEditor ) ) + if(!isObject(EditorPlayerCameraTypeOptions)) { - %this.currentEditor = ""; - return; - } - - // If we have a special set editor function, run that instead - if( %newEditor.isMethod( "setEditorFunction" ) ) - { - if( %newEditor.setEditorFunction() ) + %this.playerCameraTypeMenu = new PopupMenu(EditorPlayerCameraTypeOptions) { - %this.syncEditor( %newEditor ); - %this.currentEditor = %newEditor; + superClass = "MenuBuilder"; + class = "EditorPlayerCameraTypeMenu"; - if (!%dontActivate) - %this.currentEditor.onActivated(); - } - else + Item[0] = "First Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"1st Person Camera\");"; + Item[1] = "Third Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"3rd Person Camera\");"; + }; + } + if(!isObject(EditorCameraBookmarks)) + { + %this.cameraBookmarksMenu = new PopupMenu(EditorCameraBookmarks) { - // if were falling back and were the same editor, why are we going to just shove ourself - // into the editor position again? opt for a fallback - if( !isObject( %this.currentEditor ) ) - %this.currentEditor = "WorldEditorInspectorPlugin"; - else if( %this.currentEditor.getId() == %newEditor.getId() ) - %this.currentEditor = "WorldEditorInspectorPlugin"; - - %this.syncEditor( %this.currentEditor, true ); + superClass = "MenuBuilder"; + class = "EditorCameraBookmarksMenu"; - if( !%dontActivate ) - %this.currentEditor.onActivated(); - } + //item[0] = "None"; + }; } - else - { - %this.syncEditor( %newEditor ); - %this.currentEditor = %newEditor; - - if( !%dontActivate ) - %this.currentEditor.onActivated(); - } - - // Sync display type. - - %gui = %this.currentEditor.editorGui; - if( isObject( %gui ) ) - { - %gui.setDisplayType( %this.currentDisplayType ); - %gui.setOrthoFOV( %this.currentOrthoFOV ); - EditorGui.syncCameraGui(); - } -} - -function EditorGui::syncEditor( %this, %newEditor, %newEditorFailed ) -{ - // Sync with menu bar - %menu = %this.findMenu( "Editors" ); - %count = %menu.getItemCount(); - for ( %i = 0; %i < %count; %i++ ) - { - %pluginObj = getField( %menu.item[%i], 2 ); - if ( %pluginObj $= %newEditor ) - { - %menu.checkRadioItem( 0, %count, %i ); - break; - } - } - - // In order to hook up a palette, the word Palette must be able to be - // switched out in order to read correctly, if not, no palette will be used - %paletteName = strreplace(%newEditor, "Plugin", "Palette"); - - // Sync with ToolsToolbar - for ( %i = 0; %i < ToolsToolbarArray.getCount(); %i++ ) - { - %toolbarButton = ToolsToolbarArray.getObject(%i).internalName; - if( %paletteName $= %toolbarButton ) - { - ToolsToolbarArray.getObject(%i).setStateOn(1); - break; - } - } - - // Handles quit game and gui editor changes in wierd scenarios - if( %newEditorFailed && EWToolsToolbar.isDynamic ) - { - if( EWToolsToolbar.isClosed ) - EWToolsToolbar.reset(); - EWToolsToolbar.toggleSize(); - } - - // Toggle the editor specific palette; we define special cases here - switch$ ( %paletteName ) - { - case "MaterialEditorPalette": - %paletteName = "WorldEditorInspectorPalette"; - case "DatablockEditorPalette": - %paletteName = "WorldEditorInspectorPalette"; - case "ParticleEditorPalette": - %paletteName = "WorldEditorInspectorPalette"; - } - - %this-->ToolsPaletteWindow.togglePalette(%paletteName); -} - -function EditorGui::onWake( %this ) -{ - EHWorldEditor.setStateOn( 1 ); - - // Notify the editor plugins that the editor has started. - - foreach( %plugin in EditorPluginSet ) - %plugin.onEditorWake(); - - // Push the ActionMaps in the order that we want to have them - // before activating an editor plugin, so that if the plugin - // installs an ActionMap, it will be highest on the stack. - - MoveMap.push(); - EditorMap.push(); - - // Active the current editor plugin. - - if( !%this.currentEditor.isActivated ) - %this.currentEditor.onActivated(); - - %slashPos = 0; - while( strpos( $Server::MissionFile, "/", %slashPos ) != -1 ) - { - %slashPos = strpos( $Server::MissionFile, "/", %slashPos ) + 1; - } - %levelName = getSubStr( $Server::MissionFile , %slashPos , 99 ); - - if( %levelName !$= %this.levelName ) - %this.onNewLevelLoaded( %levelName ); -} - -function EditorGui::onSleep( %this ) -{ - // Deactivate the current editor plugin. - - if( %this.currentEditor.isActivated ) - %this.currentEditor.onDeactivated(); - - // Remove the editor's ActionMaps. - - EditorMap.pop(); - MoveMap.pop(); - - // Notify the editor plugins that the editor will be closing. - - foreach( %plugin in EditorPluginSet ) - %plugin.onEditorSleep(); - - if(isObject($Server::CurrentScene)) - $Server::CurrentScene.open(); -} - -function EditorGui::onNewLevelLoaded( %this, %levelName ) -{ - %this.levelName = %levelName; - %this.setupDefaultCameraSettings(); - ECameraSettingsPage.init(); - EditorCameraSpeedOptions.setupDefaultState(); - - new ScriptObject( EditorMissionCleanup ) - { - parentGroup = "MissionCleanup"; - }; -} - -function EditorMissionCleanup::onRemove( %this ) -{ - EditorGui.levelName = ""; - foreach( %plugin in EditorPluginSet ) - %plugin.onExitMission(); -} - -//----------------------------------------------------------------------------- - -// Called when we have been set as the content and onWake has been called -function EditorGui::onSetContent(%this, %oldContent) -{ - %this.attachMenus(); -} - -// Called before onSleep when the canvas content is changed -function EditorGui::onUnsetContent(%this, %newContent) -{ - %this.detachMenus(); -} - -//------------------------------------------------------------------------------ - -function EditorGui::toggleSFXParametersWindow( %this ) -{ - %window = %this-->ManageSFXParametersWindow; - %window.setVisible( !%window.isVisible() ); -} - -//------------------------------------------------------------------------------ - -function EditorGui::addCameraBookmark( %this, %name ) -{ - %obj = new CameraBookmark() { - datablock = CameraBookmarkMarker; - internalName = %name; - }; - - // Place into correct group - if( !isObject(CameraBookmarks) ) - { - %grp = new SimGroup(CameraBookmarks); - MissionGroup.add(%grp); - } - CameraBookmarks.add( %obj ); - - %cam = LocalClientConnection.camera.getTransform(); - %obj.setTransform( %cam ); - - EWorldEditor.isDirty = true; - EditorTree.buildVisibleTree(true); -} - -function EditorGui::removeCameraBookmark( %this, %name ) -{ - if( !isObject(CameraBookmarks) ) - return; - - %mark = CameraBookmarks.findObjectByInternalName( %name, true ); - if( %mark == 0 ) - return; - - MEDeleteUndoAction::submit( %mark ); - EWorldEditor.isDirty = true; - EditorTree.buildVisibleTree(true); -} - -function EditorGui::removeCameraBookmarkIndex( %this, %index ) -{ - if( !isObject(CameraBookmarks) ) - return; - - if( %index < 0 || %index >= CameraBookmarks.getCount() ) - return; - - %obj = CameraBookmarks.getObject( %index ); - MEDeleteUndoAction::submit( %obj ); - EWorldEditor.isDirty = true; - EditorTree.buildVisibleTree(true); -} - -function EditorGui::jumpToBookmark( %this, %name ) -{ - if( !isObject(CameraBookmarks) ) - return; - - %mark = CameraBookmarks.findObjectByInternalName( %name, true ); - if( %mark == 0 ) - return; - - LocalClientConnection.camera.setTransform( %mark.getTransform() ); - return; -} - -function EditorGui::jumpToBookmarkIndex( %this, %index ) -{ - if( !isObject(CameraBookmarks) ) - return; - - if( %index < 0 || %index >= CameraBookmarks.getCount() ) - return; - - %trans = CameraBookmarks.getObject( %index ).getTransform(); - LocalClientConnection.camera.setTransform( %trans ); -} - -function EditorGui::addCameraBookmarkByGui( %this ) -{ - // look for a NewCamera name to grab - for(%i = 0; ; %i++){ - %name = "NewCamera_" @ %i; - if( !CameraBookmarks.findObjectByInternalName(%name) ){ - break; - } - } - EditorGui.addCameraBookmark( %name ); -} - -function EditorGui::toggleCameraBookmarkWindow( %this ) -{ - EManageBookmarks.ToggleVisibility(); -} - -function EditorGui::toggleObjectSelectionsWindow( %this ) -{ - ESelectObjectsWindow.toggleVisibility(); -} - -function EditorGui::toggleOrthoGrid( %this ) -{ - EWorldEditor.renderOrthoGrid = !EWorldEditor.renderOrthoGrid; -} - -//------------------------------------------------------------------------------ - -function EditorGui::syncCameraGui( %this ) -{ - if( !EditorIsActive() ) - return; - - // Sync projection type - %displayType = %this.currentEditor.editorGui.getDisplayType(); - %this.viewTypeMenu.checkRadioItem( 0, 7, %displayType ); - - // Set the camera object's mode and rotation so that it moves correctly - // based on the current editor mode - if( %displayType != $EditTSCtrl::DisplayTypePerspective ) - { - switch( %displayType ) - { - case $EditTSCtrl::DisplayTypeTop: %name = "Top View"; %camRot = "0 0 0"; - case $EditTSCtrl::DisplayTypeBottom: %name = "Bottom View"; %camRot = "3.14159 0 0"; - case $EditTSCtrl::DisplayTypeLeft: %name = "Left View"; %camRot = "-1.571 0 1.571"; - case $EditTSCtrl::DisplayTypeRight: %name = "Right View"; %camRot = "-1.571 0 -1.571"; - case $EditTSCtrl::DisplayTypeFront: %name = "Front View"; %camRot = "-1.571 0 3.14159"; - case $EditTSCtrl::DisplayTypeBack: %name = "Back View"; %camRot = "-1.571 0 0"; - case $EditTSCtrl::DisplayTypeIsometric: %name = "Isometric View"; %camRot = "0 0 0"; - } - - LocalClientConnection.camera.controlMode = "Fly"; - LocalClientConnection.camera.setRotation( %camRot ); - EditorGuiStatusBar.setCamera( %name ); - return; - } - - // Sync camera settings. - %flyModeRadioItem = -1; - if(LocalClientConnection.getControlObject() != LocalClientConnection.player) - { - %mode = LocalClientConnection.camera.getMode(); - - if(%mode $= "Fly" && LocalClientConnection.camera.newtonMode) - { - if(LocalClientConnection.camera.newtonRotation == true) - { - EditorGui-->NewtonianRotationCamera.setStateOn(true); - EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/smooth-cam-rot"); - %flyModeRadioItem = 4; - EditorGuiStatusBar.setCamera("Smooth Rot Camera"); - } - else - { - EditorGui-->NewtonianCamera.setStateOn(true); - EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/smooth-cam"); - %flyModeRadioItem = 3; - EditorGuiStatusBar.setCamera("Smooth Camera"); - } - } - else if(%mode $= "EditOrbit") - { - EditorGui-->OrbitCamera.setStateOn(true); - EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/orbit-cam"); - %flyModeRadioItem = 1; - EditorGuiStatusBar.setCamera("Orbit Camera"); - } - else // default camera mode - { - EditorGui-->StandardCamera.setStateOn(true); - EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/camera"); - %flyModeRadioItem = 0; - EditorGuiStatusBar.setCamera("Standard Camera"); - } - - //quick way select menu bar options - %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 0 ); - EditorFreeCameraTypeOptions.checkRadioItem( 0, 4, %flyModeRadioItem); - EditorPlayerCameraTypeOptions.checkRadioItem( 0, 4, -1); - } - else if (!$isFirstPersonVar) // if 3rd person - { - EditorGui-->trdPersonCamera.setStateOn(true); - EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/3rd-person-camera"); - %flyModeRadioItem = 1; - //quick way select menu bar options - %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 1 ); - EditorPlayerCameraTypeOptions.checkRadioItem( 0, 2, %flyModeRadioItem); - EditorGuiStatusBar.setCamera("3rd Person Camera"); - } - else if ($isFirstPersonVar) // if 1st Person - { - EditorGui-->PlayerCamera.setStateOn(true); - EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/player"); - %flyModeRadioItem = 0; - //quick way select menu bar options - %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 1 ); - EditorPlayerCameraTypeOptions.checkRadioItem( 0, 2, %flyModeRadioItem); - EditorFreeCameraTypeOptions.checkRadioItem( 0, 4, -1); - EditorGuiStatusBar.setCamera("1st Person Camera"); - } - } - -/// @name EditorPlugin Methods -/// @{ - -//------------------------------------------------------------------------------ -// WorldEditorPlugin -//------------------------------------------------------------------------------ - -function WorldEditorPlugin::onActivated( %this ) -{ - EditorGui.bringToFront( EWorldEditor ); - EWorldEditor.setVisible(true); - EditorGui.menuBar.insert( EditorGui.worldMenu, EditorGui.menuBar.dynamicItemInsertPos ); - EWorldEditor.makeFirstResponder(true); - EditorTree.open(MissionGroup,true); - EWCreatorWindow.setNewObjectGroup(MissionGroup); - - EWorldEditor.syncGui(); - - EditorGuiStatusBar.setSelectionObjectsByCount(EWorldEditor.getSelectionSize()); - - // Should the Transform Selection window open? - if( EWorldEditor.ETransformSelectionDisplayed ) - { - ETransformSelection.setVisible(true); - } - - Parent::onActivated(%this); -} - -function WorldEditorPlugin::onDeactivated( %this ) -{ - // Hide the Transform Selection window from other editors - ETransformSelection.setVisible(false); - - EWorldEditor.setVisible( false ); - EditorGui.menuBar.remove( EditorGui.worldMenu ); - - Parent::onDeactivated(%this); -} - -//------------------------------------------------------------------------------ -// WorldEditorInspectorPlugin -//------------------------------------------------------------------------------ - -function WorldEditorInspectorPlugin::onWorldEditorStartup( %this ) -{ - Parent::onWorldEditorStartup( %this ); - - // Add ourselves to the window menu. - %accel = EditorGui.addToEditorsMenu( "Object Editor", "", WorldEditorInspectorPlugin ); - - // Add ourselves to the ToolsToolbar - %tooltip = "Object Editor (" @ %accel @ ")"; - EditorGui.addToToolsToolbar( "WorldEditorInspectorPlugin", "WorldEditorInspectorPalette", expandFilename("tools/worldEditor/images/toolbar/transform-objects"), %tooltip ); - - //connect editor windows - GuiWindowCtrl::attach( EWInspectorWindow, EWTreeWindow); - - %map = new ActionMap(); - %map.bindCmd( keyboard, "1", "EWorldEditorNoneModeBtn.performClick();", "" ); // Select - %map.bindCmd( keyboard, "2", "EWorldEditorMoveModeBtn.performClick();", "" ); // Move - %map.bindCmd( keyboard, "3", "EWorldEditorRotateModeBtn.performClick();", "" ); // Rotate - %map.bindCmd( keyboard, "4", "EWorldEditorScaleModeBtn.performClick();", "" ); // Scale - %map.bindCmd( keyboard, "f", "FitToSelectionBtn.performClick();", "" );// Fit Camera to Selection - %map.bindCmd( keyboard, "z", "EditorGuiStatusBar.setCamera(\"Standard Camera\");", "" );// Free camera - %map.bindCmd( keyboard, "n", "ToggleNodeBar->renderHandleBtn.performClick();", "" );// Render Node - %map.bindCmd( keyboard, "shift n", "ToggleNodeBar->renderTextBtn.performClick();", "" );// Render Node Text - %map.bindCmd( keyboard, "g", "ESnapOptions-->GridSnapButton.performClick();" ); // Grid Snappping - %map.bindCmd( keyboard, "t", "SnapToBar->objectSnapDownBtn.performClick();", "" );// Terrain Snapping - %map.bindCmd( keyboard, "b", "SnapToBar-->objectSnapBtn.performClick();" ); // Soft Snappping - %map.bindCmd( keyboard, "v", "EWorldEditorToolbar->boundingBoxColBtn.performClick();", "" );// Bounds Selection - %map.bindCmd( keyboard, "o", "objectCenterDropdown->objectBoxBtn.performClick(); objectCenterDropdown.toggle();", "" );// Object Center - %map.bindCmd( keyboard, "p", "objectCenterDropdown->objectBoundsBtn.performClick(); objectCenterDropdown.toggle();", "" );// Bounds Center - %map.bindCmd( keyboard, "k", "objectTransformDropdown->objectTransformBtn.performClick(); objectTransformDropdown.toggle();", "" );// Object Transform - %map.bindCmd( keyboard, "l", "objectTransformDropdown->worldTransformBtn.performClick(); objectTransformDropdown.toggle();", "" );// World Transform - - WorldEditorInspectorPlugin.map = %map; -} - -function WorldEditorInspectorPlugin::onActivated( %this ) -{ - Parent::onActivated( %this ); - - EditorGui-->InspectorWindow.setVisible( true ); - EditorGui-->TreeWindow.setVisible( true ); - EditorGui-->WorldEditorToolbar.setVisible( true ); - %this.map.push(); -} - -function WorldEditorInspectorPlugin::onDeactivated( %this ) -{ - Parent::onDeactivated( %this ); - - EditorGui-->InspectorWindow.setVisible( false ); - EditorGui-->TreeWindow.setVisible( false ); - EditorGui-->WorldEditorToolbar.setVisible( false ); - %this.map.pop(); -} - -function WorldEditorInspectorPlugin::onEditMenuSelect( %this, %editMenu ) -{ - %canCutCopy = EWorldEditor.getSelectionSize() > 0; - %editMenu.enableItem( 3, %canCutCopy ); // Cut - %editMenu.enableItem( 4, %canCutCopy ); // Copy - %editMenu.enableItem( 5, EWorldEditor.canPasteSelection() ); // Paste - - %selSize = EWorldEditor.getSelectionSize(); - %lockCount = EWorldEditor.getSelectionLockCount(); - %hideCount = EWorldEditor.getSelectionHiddenCount(); - %editMenu.enableItem( 6, %selSize > 0 && %lockCount != %selSize ); // Delete Selection - - %editMenu.enableItem( 8, %canCutCopy ); // Deselect -} - -function WorldEditorInspectorPlugin::handleDelete( %this ) -{ - // The tree handles deletion and notifies the - // world editor to clear its selection. - // - // This is because non-SceneObject elements like - // SimGroups also need to be destroyed. - // - // See EditorTree::onObjectDeleteCompleted(). - %selSize = EWorldEditor.getSelectionSize(); - if( %selSize > 0 ) - EditorTree.deleteSelection(); -} - -function WorldEditorInspectorPlugin::handleDeselect() -{ - EWorldEditor.clearSelection(); -} - -function WorldEditorInspectorPlugin::handleCut() -{ - EWorldEditor.cutSelection(); -} - -function WorldEditorInspectorPlugin::handleCopy() -{ - EWorldEditor.copySelection(); -} - -function WorldEditorInspectorPlugin::handlePaste() -{ - EWorldEditor.pasteSelection(); -} - -//------------------------------------------------------------------------------ -// TerrainEditorPlugin -//------------------------------------------------------------------------------ - -function TerrainEditorPlugin::onWorldEditorStartup( %this ) -{ - Parent::onWorldEditorStartup( %this ); - - // Add ourselves to the window menu. - %accel = EditorGui.addToEditorsMenu( "Terrain Editor", "", TerrainEditorPlugin ); - - // Add ourselves to the ToolsToolbar - %tooltip = "Terrain Editor (" @ %accel @ ")"; - EditorGui.addToToolsToolbar( "TerrainEditorPlugin", "TerrainEditorPalette", expandFilename("tools/worldEditor/images/toolbar/sculpt-terrain"), %tooltip ); - - %map = new ActionMap(); - %map.bindCmd( keyboard, "1", "ToolsPaletteArray->brushAdjustHeight.performClick();", "" ); //Grab Terrain - %map.bindCmd( keyboard, "2", "ToolsPaletteArray->raiseHeight.performClick();", "" ); // Raise Height - %map.bindCmd( keyboard, "3", "ToolsPaletteArray->lowerHeight.performClick();", "" ); // Lower Height - %map.bindCmd( keyboard, "4", "ToolsPaletteArray->smoothHeight.performClick();", "" ); // Average Height - %map.bindCmd( keyboard, "5", "ToolsPaletteArray->smoothSlope.performClick();", "" ); // Smooth Slope - %map.bindCmd( keyboard, "6", "ToolsPaletteArray->paintNoise.performClick();", "" ); // Noise - %map.bindCmd( keyboard, "7", "ToolsPaletteArray->flattenHeight.performClick();", "" ); // Flatten - %map.bindCmd( keyboard, "8", "ToolsPaletteArray->setHeight.performClick();", "" ); // Set Height - %map.bindCmd( keyboard, "9", "ToolsPaletteArray->setEmpty.performClick();", "" ); // Clear Terrain - %map.bindCmd( keyboard, "0", "ToolsPaletteArray->clearEmpty.performClick();", "" ); // Restore Terrain - %map.bindCmd( keyboard, "v", "EWTerrainEditToolbarBrushType->ellipse.performClick();", "" );// Circle Brush - %map.bindCmd( keyboard, "b", "EWTerrainEditToolbarBrushType->box.performClick();", "" );// Box Brush - %map.bindCmd( keyboard, "=", "TerrainEditorPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size - %map.bindCmd( keyboard, "+", "TerrainEditorPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size - %map.bindCmd( keyboard, "-", "TerrainEditorPlugin.keyboardModifyBrushSize(-1);", "" );// -1 Brush Size - %map.bindCmd( keyboard, "[", "TerrainEditorPlugin.keyboardModifyBrushSize(-5);", "" );// -5 Brush Size - %map.bindCmd( keyboard, "]", "TerrainEditorPlugin.keyboardModifyBrushSize(5);", "" );// +5 Brush Size - /*%map.bindCmd( keyboard, "]", "TerrainBrushPressureTextEditContainer->textEdit.text += 5", "" );// +5 Pressure - %map.bindCmd( keyboard, "[", "TerrainBrushPressureTextEditContainer->textEdit.text -= 5", "" );// -5 Pressure - %map.bindCmd( keyboard, "'", "TerrainBrushSoftnessTextEditContainer->textEdit.text += 5", "" );// +5 Softness - %map.bindCmd( keyboard, ";", "TerrainBrushSoftnessTextEditContainer->textEdit.text -= 5", "" );// -5 Softness*/ - - TerrainEditorPlugin.map = %map; - - %this.terrainMenu = new PopupMenu() + %this.viewTypeMenu = new PopupMenu() { superClass = "MenuBuilder"; - - barTitle = "Terrain"; - - item[0] = "Smooth Heightmap" TAB "" TAB "ETerrainEditor.onSmoothHeightmap();"; - }; -} - -function TerrainEditorPlugin::onActivated( %this ) -{ - Parent::onActivated( %this ); - - EditorGui.readTerrainEditorSettings(); - - %action = EditorSettings.value("TerrainEditor/currentAction"); - ETerrainEditor.switchAction( %action ); - ToolsPaletteArray.findObjectByInternalName( %action, true ).setStateOn( true ); - - EWTerrainEditToolbarBrushType->ellipse.performClick(); // Circle Brush - - EditorGui.menuBar.insert( %this.terrainMenu, EditorGui.menuBar.dynamicItemInsertPos ); - - EditorGui.bringToFront( ETerrainEditor ); - ETerrainEditor.setVisible( true ); - ETerrainEditor.attachTerrain(); - ETerrainEditor.makeFirstResponder( true ); - - EWTerrainEditToolbar.setVisible( true ); - ETerrainEditor.onBrushChanged(); - ETerrainEditor.setup(); - TerrainEditorPlugin.syncBrushInfo(); - - EditorGuiStatusBar.setSelection(""); - %this.map.push(); -} - -function TerrainEditorPlugin::onDeactivated( %this ) -{ - Parent::onDeactivated( %this ); - - endToolTime("TerrainEditor"); - EditorGui.writeTerrainEditorSettings(); - - EWTerrainEditToolbar.setVisible( false ); - ETerrainEditor.setVisible( false ); - - EditorGui.menuBar.remove( %this.terrainMenu ); - - %this.map.pop(); -} - -function TerrainEditorPlugin::syncBrushInfo( %this ) -{ - // Update gui brush info - TerrainBrushSizeTextEditContainer-->textEdit.text = getWord(ETerrainEditor.getBrushSize(), 0); - TerrainBrushPressureTextEditContainer-->textEdit.text = ETerrainEditor.getBrushPressure()*100; - TerrainBrushSoftnessTextEditContainer-->textEdit.text = ETerrainEditor.getBrushSoftness()*100; - TerrainSetHeightTextEditContainer-->textEdit.text = ETerrainEditor.setHeightVal; - - %brushType = ETerrainEditor.getBrushType(); - eval( "EWTerrainEditToolbar-->" @ %brushType @ ".setStateOn(1);" ); -} - -function TerrainEditorPlugin::validateBrushSize( %this ) -{ - %minBrushSize = 1; - %maxBrushSize = getWord(ETerrainEditor.maxBrushSize, 0); - - %val = $ThisControl.getText(); - if(%val < %minBrushSize) - $ThisControl.setValue(%minBrushSize); - else if(%val > %maxBrushSize) - $ThisControl.setValue(%maxBrushSize); -} - -function TerrainEditorPlugin::keyboardModifyBrushSize( %this, %amt) -{ - %val = TerrainBrushSizeTextEditContainer-->textEdit.getText(); - %val += %amt; - TerrainBrushSizeTextEditContainer-->textEdit.setValue(%val); - TerrainBrushSizeTextEditContainer-->textEdit.forceValidateText(); - ETerrainEditor.setBrushSize( TerrainBrushSizeTextEditContainer-->textEdit.getText() ); -} - -//------------------------------------------------------------------------------ -// TerrainTextureEditorTool -//------------------------------------------------------------------------------ - -function TerrainTextureEditorTool::onActivated( %this ) -{ - EditorGui.bringToFront( ETerrainEditor ); - ETerrainEditor.setVisible( true ); - ETerrainEditor.attachTerrain(); - ETerrainEditor.makeFirstResponder( true ); - - EditorGui-->TextureEditor.setVisible(true); - - EditorGuiStatusBar.setSelection(""); -} - -function TerrainTextureEditorTool::onDeactivated( %this ) -{ - EditorGui-->TextureEditor.setVisible(false); - - ETerrainEditor.setVisible( false ); -} - -//------------------------------------------------------------------------------ -// TerrainPainterPlugin -//------------------------------------------------------------------------------ - -function TerrainPainterPlugin::onWorldEditorStartup( %this ) -{ - Parent::onWorldEditorStartup( %this ); - - // Add ourselves to the window menu. - %accel = EditorGui.addToEditorsMenu( "Terrain Painter", "", TerrainPainterPlugin ); - - // Add ourselves to the ToolsToolbar - %tooltip = "Terrain Painter (" @ %accel @ ")"; - EditorGui.addToToolsToolbar( "TerrainPainterPlugin", "TerrainPainterPalette", expandFilename("tools/worldEditor/images/toolbar/paint-terrain"), %tooltip ); - - %map = new ActionMap(); - %map.bindCmd( keyboard, "v", "EWTerrainPainterToolbarBrushType->ellipse.performClick();", "" );// Circle Brush - %map.bindCmd( keyboard, "b", "EWTerrainPainterToolbarBrushType->box.performClick();", "" );// Box Brush - %map.bindCmd( keyboard, "=", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size - %map.bindCmd( keyboard, "+", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size - %map.bindCmd( keyboard, "-", "TerrainPainterPlugin.keyboardModifyBrushSize(-1);", "" );// -1 Brush Size - %map.bindCmd( keyboard, "[", "TerrainPainterPlugin.keyboardModifyBrushSize(-5);", "" );// -5 Brush Size - %map.bindCmd( keyboard, "]", "TerrainPainterPlugin.keyboardModifyBrushSize(5);", "" );// +5 Brush Size - /*%map.bindCmd( keyboard, "]", "PaintBrushSlopeControl->SlopeMinAngle.text += 5", "" );// +5 SlopeMinAngle - %map.bindCmd( keyboard, "[", "PaintBrushSlopeControl->SlopeMinAngle.text -= 5", "" );// -5 SlopeMinAngle - %map.bindCmd( keyboard, "'", "PaintBrushSlopeControl->SlopeMaxAngle.text += 5", "" );// +5 SlopeMaxAngle - %map.bindCmd( keyboard, ";", "PaintBrushSlopeControl->SlopeMaxAngle.text -= 5", "" );// -5 Softness*/ - - for(%i=1; %i<10; %i++) - { - %map.bindCmd( keyboard, %i, "TerrainPainterPlugin.keyboardSetMaterial(" @ (%i-1) @ ");", "" ); - } - %map.bindCmd( keyboard, 0, "TerrainPainterPlugin.keyboardSetMaterial(10);", "" ); - - TerrainPainterPlugin.map = %map; - GuiWindowCtrl::attach( EPainter, EPainterPreview); -} - -function TerrainPainterPlugin::onActivated( %this ) -{ - Parent::onActivated( %this ); - - EditorGui.readTerrainEditorSettings(); - - EWTerrainPainterToolbarBrushType->ellipse.performClick();// Circle Brush - %this.map.push(); - - EditorGui.bringToFront( ETerrainEditor ); - ETerrainEditor.setVisible( true ); - ETerrainEditor.attachTerrain(); - ETerrainEditor.makeFirstResponder( true ); - - EditorGui-->TerrainPainter.setVisible(true); - EditorGui-->TerrainPainterPreview.setVisible(true); - EWTerrainPainterToolbar.setVisible(true); - ETerrainEditor.onBrushChanged(); - EPainter.setup(); - TerrainPainterPlugin.syncBrushInfo(); - - EditorGuiStatusBar.setSelection(""); -} - -function TerrainPainterPlugin::onDeactivated( %this ) -{ - Parent::onDeactivated( %this ); - - EditorGui.writeTerrainEditorSettings(); - - %this.map.pop(); - EditorGui-->TerrainPainter.setVisible(false); - EditorGui-->TerrainPainterPreview.setVisible(false); - EWTerrainPainterToolbar.setVisible(false); - ETerrainEditor.setVisible( false ); -} - -function TerrainPainterPlugin::syncBrushInfo( %this ) -{ - // Update gui brush info - PaintBrushSizeTextEditContainer-->textEdit.text = getWord(ETerrainEditor.getBrushSize(), 0); - PaintBrushSlopeControl-->SlopeMinAngle.text = ETerrainEditor.getSlopeLimitMinAngle(); - PaintBrushSlopeControl-->SlopeMaxAngle.text = ETerrainEditor.getSlopeLimitMaxAngle(); - PaintBrushPressureTextEditContainer-->textEdit.text = ETerrainEditor.getBrushPressure()*100; - %brushType = ETerrainEditor.getBrushType(); - eval( "EWTerrainPainterToolbar-->" @ %brushType @ ".setStateOn(1);" ); -} - -function TerrainPainterPlugin::validateBrushSize( %this ) -{ - %minBrushSize = 1; - %maxBrushSize = getWord(ETerrainEditor.maxBrushSize, 0); - - %val = $ThisControl.getText(); - if(%val < %minBrushSize) - $ThisControl.setValue(%minBrushSize); - else if(%val > %maxBrushSize) - $ThisControl.setValue(%maxBrushSize); -} - -function TerrainPainterPlugin::validateSlopeMaxAngle( %this ) -{ - %maxval = ETerrainEditor.getSlopeLimitMaxAngle(); - PaintBrushSlopeControl-->SlopeMaxAngle.setText(%maxval); -} - -function TerrainPainterPlugin::validateSlopeMinAngle( %this ) -{ - %minval = ETerrainEditor.getSlopeLimitMinAngle(); - PaintBrushSlopeControl-->SlopeMinAngle.setText(%minval); -} - -function TerrainPainterPlugin::keyboardModifyBrushSize( %this, %amt) -{ - %val = PaintBrushSizeTextEditContainer-->textEdit.getText(); - %val += %amt; - PaintBrushSizeTextEditContainer-->textEdit.setValue(%val); - PaintBrushSizeTextEditContainer-->textEdit.forceValidateText(); - ETerrainEditor.setBrushSize( PaintBrushSizeTextEditContainer-->textEdit.getText() ); -} - -function TerrainPainterPlugin::keyboardSetMaterial( %this, %mat) -{ - %name = "EPainterMaterialButton" @ %mat; - %ctrl = EPainter.findObjectByInternalName(%name, true); - if(%ctrl) - { - %ctrl.performClick(); - } -} - -/// @} End of EditorPlugin Methods - - -function objectTransformDropdown::toggle() -{ - if ( objectTransformDropdown.visible ) - { - EWorldEditorToolbar-->objectTransform.setStateOn(false); - objectTransformDropdownDecoy.setVisible(false); - objectTransformDropdownDecoy.setActive(false); - objectTransformDropdown.setVisible(false); - } - else - { - EWorldEditorToolbar-->objectTransform.setStateOn(true); - objectTransformDropdown.setVisible(true); - objectTransformDropdownDecoy.setActive(true); - objectTransformDropdownDecoy.setVisible(true); - } -} - -function CameraTypesDropdownToggle() -{ - if ( CameraTypesDropdown.visible ) - { - EWorldEditorToggleCamera.setStateOn(0); - CameraTypesDropdownDecoy.setVisible(false); - CameraTypesDropdownDecoy.setActive(false); - CameraTypesDropdown.setVisible(false); - } - else - { - CameraTypesDropdown.setVisible(true); - CameraTypesDropdownDecoy.setVisible(true); - CameraTypesDropdownDecoy.setActive(true); - EWorldEditorToggleCamera.setStateOn(1); - } -} - -function VisibilityDropdownToggle() -{ - if ( EVisibility.visible ) - { - EVisibility.setVisible(false); - visibilityToggleBtn.setStateOn(0); - } - else - { - EVisibility.setVisible(true); - visibilityToggleBtn.setStateOn(1); - } -} - -function CameraTypesDropdownDecoy::onMouseLeave() -{ - CameraTypesDropdownToggle(); -} - -//----------------------------------------------------------------------------- - -function EWorldEditor::getGridSnap( %this ) -{ - return %this.gridSnap; -} - -function EWorldEditor::setGridSnap( %this, %value ) -{ - %this.gridSnap = %value; - GlobalGizmoProfile.snapToGrid = %value; - %this.syncGui(); -} - -function EWorldEditor::getGridSize( %this ) -{ - return %this.gridSize; -} - -function EWorldEditor::setGridSize( %this, %value ) -{ - GlobalGizmoProfile.gridSize = %value SPC %value SPC %value; - %this.gridSize = %value; - - %this.syncGui(); -} - -//----------------------------------------------------------------------------- - -function EWorldEditor::areAllSelectedObjectsOfType( %this, %className ) -{ - %activeSelection = %this.getActiveSelection(); - if( !isObject( %activeSelection ) ) - return false; - %count = %activeSelection.getCount(); - for( %i = 0; %i < %count; %i ++ ) - { - %obj = %activeSelection.getObject( %i ); - if( !%obj.isMemberOfClass( %className ) ) - return false; - } - - return true; -} - -//----------------------------------------------------------------------------- -function EWorldEditorToggleCamera::toggleBitmap(%this) -{ - %currentImage = %this.bitmap; - - if ( %currentImage $= "tools/worldEditor/images/toolbar/player" ) - %image = "tools/worldEditor/images/toolbar/camera"; - else - %image = "tools/worldEditor/images/toolbar/player"; - - %this.setBitmap( %image ); -} - -function EWorldEditorCameraSpeed::updateMenuBar(%this, %editorBarCtrl) -{ - // Update Toolbar TextEdit - if( %editorBarCtrl.getId() == CameraSpeedDropdownCtrlContainer-->slider.getId() ) - { - %value = %editorBarCtrl.getValue(); - EWorldEditorCameraSpeed.setText( %value ); - $Camera::movementSpeed = %value; - } - - // Update Toolbar Slider - if( %editorBarCtrl.getId() == EWorldEditorCameraSpeed.getId() ) - { - %value = %editorBarCtrl.getText(); - if ( %value !$= "" ) - { - if ( %value <= 0 ) // camera speed must be >= 0 - { - %value = 1; - %editorBarCtrl.setText( %value ); - } - CameraSpeedDropdownCtrlContainer-->slider.setValue( %value ); - $Camera::movementSpeed = %value; - } - } - - // Update Editor - EditorCameraSpeedOptions.checkRadioItem(0, 6, -1); -} - -//----------------------------------------------------------------------------- - -function EWorldEditorAlignPopup::onSelect(%this, %id, %text) -{ - if ( GlobalGizmoProfile.mode $= "Scale" && %text $= "World" ) - { - EWorldEditorAlignPopup.setSelected(1); - return; - } - - GlobalGizmoProfile.alignment = %text; -} - -//----------------------------------------------------------------------------- - - -//----------------------------------------------------------------------------- - -function EWorldEditorNoneModeBtn::onClick(%this) -{ - GlobalGizmoProfile.mode = "None"; - - EditorGuiStatusBar.setInfo("Selection arrow."); -} - -function EWorldEditorMoveModeBtn::onClick(%this) -{ - GlobalGizmoProfile.mode = "Move"; - - %cmdCtrl = "CTRL"; - if( $platform $= "macos" ) - %cmdCtrl = "CMD"; - - EditorGuiStatusBar.setInfo( "Move selection. SHIFT while dragging duplicates objects. " @ %cmdCtrl @ " to toggle soft snap. ALT to toggle grid snap." ); -} - -function EWorldEditorRotateModeBtn::onClick(%this) -{ - GlobalGizmoProfile.mode = "Rotate"; - - EditorGuiStatusBar.setInfo("Rotate selection."); -} - -function EWorldEditorScaleModeBtn::onClick(%this) -{ - GlobalGizmoProfile.mode = "Scale"; - - EditorGuiStatusBar.setInfo("Scale selection."); -} - -//----------------------------------------------------------------------------- - -function EditorTree::onDeleteSelection( %this ) -{ - %this.undoDeleteList = ""; -} - -function EditorTree::onDeleteObject( %this, %object ) -{ - // Don't delete locked objects - if( %object.locked ) - return true; - - if( %object == EWCreatorWindow.objectGroup ) - EWCreatorWindow.setNewObjectGroup( MissionGroup ); - - // Append it to our list. - %this.undoDeleteList = %this.undoDeleteList TAB %object; - - // We're gonna delete this ourselves in the - // completion callback. - return true; -} - -function EditorTree::onObjectDeleteCompleted( %this ) -{ - // This can be called when a deletion is attempted but nothing was - // actually deleted ( cannot delete the root of the tree ) so only submit - // the undo if we really deleted something. - if ( %this.undoDeleteList !$= "" ) - MEDeleteUndoAction::submit( %this.undoDeleteList ); - - // Let the world editor know to - // clear its selection. - EWorldEditor.clearSelection(); - EWorldEditor.isDirty = true; -} - -function EditorTree::onClearSelected(%this) -{ - WorldEditor.clearSelection(); -} - -function EditorTree::onInspect(%this, %obj) -{ - Inspector.inspect(%obj); -} - -function EditorTree::toggleLock( %this ) -{ - if( EWTreeWindow-->LockSelection.command $= "EWorldEditor.lockSelection(true); EditorTree.toggleLock();" ) - { - EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();"; - EWTreeWindow-->DeleteSelection.command = ""; - } - else - { - EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();"; - EWTreeWindow-->DeleteSelection.command = "EditorMenuEditDelete();"; - } -} - -function EditorTree::onAddSelection(%this, %obj, %isLastSelection) -{ - EWorldEditor.selectObject( %obj ); - - %selSize = EWorldEditor.getSelectionSize(); - %lockCount = EWorldEditor.getSelectionLockCount(); - - if( %lockCount < %selSize ) - { - EWTreeWindow-->LockSelection.setStateOn(0); - EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();"; - } - else if ( %lockCount > 0 ) - { - EWTreeWindow-->LockSelection.setStateOn(1); - EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();"; - } - - if( %selSize > 0 && %lockCount == 0 ) - EWTreeWindow-->DeleteSelection.command = "EditorMenuEditDelete();"; - else - EWTreeWindow-->DeleteSelection.command = ""; - - if( %isLastSelection ) - Inspector.addInspect( %obj ); - else - Inspector.addInspect( %obj, false ); - -} -function EditorTree::onRemoveSelection(%this, %obj) -{ - EWorldEditor.unselectObject(%obj); - Inspector.removeInspect( %obj ); -} -function EditorTree::onSelect(%this, %obj) -{ -} - -function EditorTree::onUnselect(%this, %obj) -{ - EWorldEditor.unselectObject(%obj); -} - -function EditorTree::onDragDropped(%this) -{ - EWorldEditor.isDirty = true; -} - -function EditorTree::onAddGroupSelected(%this, %group) -{ - EWCreatorWindow.setNewObjectGroup(%group); -} - -function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) -{ - %haveObjectEntries = false; - %haveLockAndHideEntries = true; - - // Handle multi-selection. - if( %this.getSelectedItemsCount() > 1 ) - { - %popup = ETMultiSelectionContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETMultiSelectionContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; - item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - }; - } - - // Open context menu if this is a CameraBookmark - else if( %obj.isMemberOfClass( "CameraBookmark" ) ) - { - %popup = ETCameraBookmarkContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarkContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );"; - - bookmark = -1; - }; - - ETCameraBookmarkContextPopup.bookmark = %obj; - } - - // Open context menu if this is set CameraBookmarks group. - else if( %obj.name $= "CameraBookmarks" ) - { - %popup = ETCameraBookmarksGroupContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarksGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; - }; - } - - // Open context menu if this is a SimGroup - else if( !%obj.isMemberOfClass( "SceneObject" ) ) - { - %popup = ETSimGroupContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - - object = -1; - }; - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Open generic context menu. - else - { - %popup = ETContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; - }; - - if(%obj.isMemberOfClass("Entity")) - { - %popup = ETEntityContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - }; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; - } - - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) - { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - if( %haveObjectEntries ) - { - %popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" ); - %popup.enableItem( 1, %obj.getName() !$= "MissionGroup" ); - if( %haveLockAndHideEntries ) - { - %popup.checkItem( 4, %obj.locked ); - %popup.checkItem( 5, %obj.hidden ); - } - %popup.enableItem( 7, %this.isItemSelected( %itemId ) ); - } - - %popup.showPopup( Canvas ); -} - -function EditorTree::positionContextMenu( %this, %menu ) -{ - if( (getWord(%menu.position, 0) + getWord(%menu.extent, 0)) > getWord(EWorldEditor.extent, 0) ) - { - %posx = getWord(%menu.position, 0); - %offset = getWord(EWorldEditor.extent, 0) - (%posx + getWord(%menu.extent, 0)) - 5; - %posx += %offset; - %menu.position = %posx @ " " @ getWord(%menu.position, 1); - } -} - -function EditorTree::isValidDragTarget( %this, %id, %obj ) -{ - if( %obj.isMemberOfClass( "Path" ) ) - return EWorldEditor.areAllSelectedObjectsOfType( "Marker" ); - if( %obj.name $= "CameraBookmarks" ) - return EWorldEditor.areAllSelectedObjectsOfType( "CameraBookmark" ); - else - return ( %obj.getClassName() $= "SimGroup" ); -} - -function EditorTree::onBeginReparenting( %this ) -{ - if( isObject( %this.reparentUndoAction ) ) - %this.reparentUndoAction.delete(); - - %action = UndoActionReparentObjects::create( %this ); - - %this.reparentUndoAction = %action; -} - -function EditorTree::onReparent( %this, %obj, %oldParent, %newParent ) -{ - %this.reparentUndoAction.add( %obj, %oldParent, %newParent ); -} - -function EditorTree::onEndReparenting( %this ) -{ - %action = %this.reparentUndoAction; - %this.reparentUndoAction = ""; - - if( %action.numObjects > 0 ) - { - if( %action.numObjects == 1 ) - %action.actionName = "Reparent Object"; - else - %action.actionName = "Reparent Objects"; - - %action.addToManager( Editor.getUndoManager() ); - - EWorldEditor.syncGui(); - } - else - %action.delete(); -} - -function EditorTree::update( %this ) -{ - %this.buildVisibleTree( false ); -} - -//------------------------------------------------------------------------------ - -// Tooltip for TSStatic -function EditorTree::GetTooltipTSStatic( %this, %obj ) -{ - return "Shape: " @ %obj.shapeName; -} - -// Tooltip for ShapeBase -function EditorTree::GetTooltipShapeBase( %this, %obj ) -{ - return "Datablock: " @ %obj.dataBlock; -} - -// Tooltip for StaticShape -function EditorTree::GetTooltipStaticShape( %this, %obj ) -{ - return "Datablock: " @ %obj.dataBlock; -} - -// Tooltip for Item -function EditorTree::GetTooltipItem( %this, %obj ) -{ - return "Datablock: " @ %obj.dataBlock; -} - -// Tooltip for RigidShape -function EditorTree::GetTooltipRigidShape( %this, %obj ) -{ - return "Datablock: " @ %obj.dataBlock; -} - -// Tooltip for Prefab -function EditorTree::GetTooltipPrefab( %this, %obj ) -{ - return "File: " @ %obj.filename; -} - -// Tooltip for GroundCover -function EditorTree::GetTooltipGroundCover( %this, %obj ) -{ - %text = "Material: " @ %obj.material; - for(%i=0; %i<8; %i++) - { - if(%obj.probability[%i] > 0 && %obj.shapeFilename[%i] !$= "") - { - %text = %text NL "Shape " @ %i @ ": " @ %obj.shapeFilename[%i]; - } - } - return %text; -} - -// Tooltip for SFXEmitter -function EditorTree::GetTooltipSFXEmitter( %this, %obj ) -{ - if(%obj.fileName $= "") - return "Track: " @ %obj.track; - else - return "File: " @ %obj.fileName; -} - -// Tooltip for ParticleEmitterNode -function EditorTree::GetTooltipParticleEmitterNode( %this, %obj ) -{ - %text = "Datablock: " @ %obj.dataBlock; - %text = %text NL "Emitter: " @ %obj.emitter; - return %text; -} - -// Tooltip for WorldEditorSelection -function EditorTree::GetTooltipWorldEditorSelection( %this, %obj ) -{ - %text = "Objects: " @ %obj.getCount(); - - if( !%obj.getCanSave() ) - %text = %text NL "Persistent: No"; - else - %text = %text NL "Persistent: Yes"; - - return %text; -} - -//------------------------------------------------------------------------------ - -function EditorTreeTabBook::onTabSelected( %this ) -{ - if( EditorTreeTabBook.getSelectedPage() == 0) - { - EWTreeWindow-->DeleteSelection.visible = true; - EWTreeWindow-->LockSelection.visible = true; - EWTreeWindow-->AddSimGroup.visible = true; - } - else - { - EWTreeWindow-->DeleteSelection.visible = false; - EWTreeWindow-->LockSelection.visible = false; - EWTreeWindow-->AddSimGroup.visible = false; - } -} - -//------------------------------------------------------------------------------ - -function Editor::open(%this) -{ - // prevent the mission editor from opening while the GuiEditor is open. - if(Canvas.getContent() == GuiEditorGui.getId()) - return; - - EditorGui.buildMenus(); - - if( !EditorGui.isInitialized ) - EditorGui.init(); - - %this.editorEnabled(); - Canvas.setContent(EditorGui); - EditorGui.syncCameraGui(); -} - -function Editor::close(%this, %gui) -{ - %this.editorDisabled(); - Canvas.setContent(%gui); - if(isObject(MessageHud)) - MessageHud.close(); - EditorGui.writeCameraSettings(); - - EditorGui.onDestroyMenu(); -} - -function EditorGui::onDestroyMenu(%this) -{ - if( !isObject( %this.menuBar ) ) - return; - - // Destroy menus - while( %this.menuBar.getCount() != 0 ) - %this.menuBar.getObject( 0 ).delete(); - - %this.menuBar.removeFromCanvas(); - %this.menuBar.delete(); -} - -$RelightCallback = ""; - -function EditorLightingComplete() -{ - $lightingMission = false; - RelightStatus.visible = false; - - if ($RelightCallback !$= "") - { - eval($RelightCallback); - } - - $RelightCallback = ""; -} - -function updateEditorLightingProgress() -{ - RelightProgress.setValue(($SceneLighting::lightingProgress)); - if ($lightingMission) - $lightingProgressThread = schedule(1, 0, "updateEditorLightingProgress"); -} - -function Editor::lightScene(%this, %callback, %forceAlways) -{ - if ($lightingMission) - return; - - $lightingMission = true; - $RelightCallback = %callback; - RelightStatus.visible = true; - RelightProgress.setValue(0); - Canvas.repaint(); - lightScene("EditorLightingComplete", %forceAlways); - updateEditorLightingProgress(); -} - -//------------------------------------------------------------------------------ - -function EditorGui::handleEscape( %this ) -{ - %result = false; - if ( isObject( %this.currentEditor ) ) - %result = %this.currentEditor.handleEscape(); - - if ( !%result ) - { - Editor.close("PlayGui"); - } -} - -function EditTSCtrl::updateGizmoMode( %this, %mode ) -{ - // Called when the gizmo mode is changed from C++ - - if ( %mode $= "None" ) - EditorGuiToolbar->NoneModeBtn.performClick(); - else if ( %mode $= "Move" ) - EditorGuiToolbar->MoveModeBtn.performClick(); - else if ( %mode $= "Rotate" ) - EditorGuiToolbar->RotateModeBtn.performClick(); - else if ( %mode $= "Scale" ) - EditorGuiToolbar->ScaleModeBtn.performClick(); -} - -//------------------------------------------------------------------------------ - -function EWorldEditor::syncGui( %this ) -{ - %this.syncToolPalette(); - - EditorTree.update(); - Editor.getUndoManager().updateUndoMenu( EditorGui.menuBar-->EditMenu ); - EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() ); - - EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 ); - - EWorldEditorToolbar-->boundingBoxColBtn.setStateOn( EWorldEditor.boundingBoxCollision ); - - if( EWorldEditor.objectsUseBoxCenter ) - { - EWorldEditorToolbar-->centerObject.setBitmap("tools/gui/images/menubar/bounds-center"); - objectCenterDropdown-->objectBoundsBtn.setStateOn( 1 ); - } - else - { - EWorldEditorToolbar-->centerObject.setBitmap("tools/gui/images/menubar/object-center"); - objectCenterDropdown-->objectBoxBtn.setStateOn( 1 ); - } - - if( GlobalGizmoProfile.getFieldValue(alignment) $= "Object" ) - { - EWorldEditorToolbar-->objectTransform.setBitmap("tools/gui/images/menubar/object-transform"); - objectTransformDropdown-->objectTransformBtn.setStateOn( 1 ); - - } - else - { - EWorldEditorToolbar-->objectTransform.setBitmap("tools/gui/images/menubar/world-transform"); - objectTransformDropdown-->worldTransformBtn.setStateOn( 1 ); - } - - EWorldEditorToolbar-->renderHandleBtn.setStateOn( EWorldEditor.renderObjHandle ); - EWorldEditorToolbar-->renderTextBtn.setStateOn( EWorldEditor.renderObjText ); - - EWorldEditorToolbar-->objectSnapDownBtn.setStateOn( %this.stickToGround ); - SnapToBar-->objectSnapBtn.setStateOn( EWorldEditor.getSoftSnap() ); - EWorldEditorToolbar-->softSnapSizeTextEdit.setText( EWorldEditor.getSoftSnapSize() ); - ESnapOptions-->SnapSize.setText( EWorldEditor.getSoftSnapSize() ); - ESnapOptions-->GridSize.setText( EWorldEditor.getGridSize() ); - - ESnapOptions-->GridSnapButton.setStateOn( %this.getGridSnap() ); - ESnapOptions-->GroupSnapButton.setStateOn( %this.UseGroupCenter ); - SnapToBar-->objectGridSnapBtn.setStateOn( %this.getGridSnap() ); - ESnapOptions-->NoSnapButton.setStateOn( !%this.stickToGround && !%this.getSoftSnap() && !%this.getGridSnap() ); -} - -function EWorldEditor::syncToolPalette( %this ) -{ - switch$ ( GlobalGizmoProfile.mode ) - { - case "None": - EWorldEditorNoneModeBtn.performClick(); - case "Move": - EWorldEditorMoveModeBtn.performClick(); - case "Rotate": - EWorldEditorRotateModeBtn.performClick(); - case "Scale": - EWorldEditorScaleModeBtn.performClick(); - } -} - -function EWorldEditor::addSimGroup( %this, %groupCurrentSelection ) -{ - %activeSelection = %this.getActiveSelection(); - if ( %activeSelection.getObjectIndex( MissionGroup ) != -1 ) - { - MessageBoxOK( "Error", "Cannot add MissionGroup to a new SimGroup" ); - return; - } - - // Find our parent. - - %parent = MissionGroup; - if( !%groupCurrentSelection && isObject( %activeSelection ) && %activeSelection.getCount() > 0 ) - { - %firstSelectedObject = %activeSelection.getObject( 0 ); - if( %firstSelectedObject.isMemberOfClass( "SimGroup" ) ) - %parent = %firstSelectedObject; - else if( %firstSelectedObject.getId() != MissionGroup.getId() ) - %parent = %firstSelectedObject.parentGroup; - } - - // If we are about to do a group-selected as well, - // starting recording an undo compound. - - if( %groupCurrentSelection ) - Editor.getUndoManager().pushCompound( "Group Selected" ); - - // Create the SimGroup. - - %object = new SimGroup() - { - parentGroup = %parent; + item[ 0 ] = "Top" TAB "Alt 2" TAB "EditorGuiStatusBar.setCamera(\"Top View\");"; + item[ 1 ] = "Bottom" TAB "Alt 5" TAB "EditorGuiStatusBar.setCamera(\"Bottom View\");"; + item[ 2 ] = "Front" TAB "Alt 3" TAB "EditorGuiStatusBar.setCamera(\"Front View\");"; + item[ 3 ] = "Back" TAB "Alt 6" TAB "EditorGuiStatusBar.setCamera(\"Back View\");"; + item[ 4 ] = "Left" TAB "Alt 4" TAB "EditorGuiStatusBar.setCamera(\"Left View\");"; + item[ 5 ] = "Right" TAB "Alt 7" TAB "EditorGuiStatusBar.setCamera(\"Right View\");"; + item[ 6 ] = "Perspective" TAB "Alt 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");"; + item[ 7 ] = "Isometric" TAB "Alt 8" TAB "EditorGuiStatusBar.setCamera(\"Isometric View\");"; }; - MECreateUndoAction::submit( %object ); - - // Put selected objects into the group, if requested. - - if( %groupCurrentSelection && isObject( %activeSelection ) ) - { - %undo = UndoActionReparentObjects::create( EditorTree ); - %numObjects = %activeSelection.getCount(); - for( %i = 0; %i < %numObjects; %i ++ ) - { - %sel = %activeSelection.getObject( %i ); - %undo.add( %sel, %sel.parentGroup, %object ); - %object.add( %sel ); - } + // Menu bar + %this.menuBar = new GuiMenuBar(WorldEditorMenubar) + { + dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; + }; + + // File Menu + %fileMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorFileMenu"; + + barTitle = "File"; + }; + + + %fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );"); + %fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );"); + %fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();"); + %fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();"); + %fileMenu.appendItem("-"); + + if( $platform $= "windows" ) + { + %fileMenu.appendItem( "Open Project in Torsion" TAB "" TAB "EditorOpenTorsionProject();" ); + %fileMenu.appendItem( "Open Level File in Torsion" TAB "" TAB "EditorOpenFileInTorsion();" ); + %fileMenu.appendItem( "-" ); + } + + %fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );"); + %fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );"); + + %fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );"); + %fileMenu.appendItem("-"); + %fileMenu.appendItem("Export To COLLADA..." TAB "" TAB "EditorExportToCollada();"); + //item[5] = "Import Terraform Data..." TAB "" TAB "Heightfield::import();"; + //item[6] = "Import Texture Data..." TAB "" TAB "Texture::import();"; + //item[7] = "-"; + //item[8] = "Export Terraform Data..." TAB "" TAB "Heightfield::saveBitmap(\"\");"; + + %fileMenu.appendItem( "-" ); + %fileMenu.appendItem( "Add FMOD Designer Audio..." TAB "" TAB "AddFMODProjectDlg.show();" ); + + %fileMenu.appendItem("-"); + %fileMenu.appendItem("Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");"); - %undo.addToManager( Editor.getUndoManager() ); - } + %fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();"); + %fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();"); + + %this.menuBar.insert(%fileMenu); + + // Edit Menu + %editMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorEditMenu"; + internalName = "EditMenu"; + + barTitle = "Edit"; + + item[0] = "Undo" TAB %cmdCtrl SPC "Z" TAB "Editor.getUndoManager().undo();"; + item[1] = "Redo" TAB %redoShortcut TAB "Editor.getUndoManager().redo();"; + item[2] = "-"; + item[3] = "Cut" TAB %cmdCtrl SPC "X" TAB "EditorMenuEditCut();"; + item[4] = "Copy" TAB %cmdCtrl SPC "C" TAB "EditorMenuEditCopy();"; + item[5] = "Paste" TAB %cmdCtrl SPC "V" TAB "EditorMenuEditPaste();"; + item[6] = "Delete" TAB "Delete" TAB "EditorMenuEditDelete();"; + item[7] = "-"; + item[8] = "Deselect" TAB "X" TAB "EditorMenuEditDeselect();"; + Item[9] = "Select..." TAB "" TAB "EditorGui.toggleObjectSelectionsWindow();"; + item[10] = "-"; + item[11] = "Audio Parameters..." TAB "" TAB "EditorGui.toggleSFXParametersWindow();"; + item[12] = "Editor Settings..." TAB "" TAB "ESettingsWindow.ToggleVisibility();"; + item[13] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();"; + item[14] = "-"; + item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; + item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; + }; + %this.menuBar.insert(%editMenu); - // Stop recording for group-selected. - - if( %groupCurrentSelection ) - Editor.getUndoManager().popCompound(); - - // When not grouping selection, make the newly created SimGroup the - // current selection. - - if( !%groupCurrentSelection ) + // View Menu + %viewMenu = new PopupMenu() { - EWorldEditor.clearSelection(); - EWorldEditor.selectObject( %object ); - } + superClass = "MenuBuilder"; + class = "EditorViewMenu"; + internalName = "viewMenu"; - // Refresh the Gui. - - %this.syncGui(); -} - -function EWorldEditor::toggleLockChildren( %this, %simGroup ) -{ - foreach( %child in %simGroup ) - { - if( %child.class $= "SimGroup" ) - { - %this.toggleHideChildren( %child ); - } - if( %child.isMemberOfClass( "SimGroup" ) ) - { - %this.toggleHideChildren( %child ); - %child.setLocked( !%child.locked ); - } - else - { - %child.setLocked( !%child.locked ); - } - } - - EWorldEditor.syncGui(); -} - -function EWorldEditor::toggleHideChildren( %this, %simGroup ) -{ - foreach( %child in %simGroup ) - { - if( %child.class $= "SimGroup" ) - { - %this.toggleHideChildren( %child ); - } - if( %child.isMemberOfClass( "SimGroup" ) ) - { - %this.toggleHideChildren( %child ); - %this.hideObject( %child, !%child.hidden ); - } - else - { - %this.hideObject( %child, !%child.hidden ); - } - } - - EWorldEditor.syncGui(); -} - -function EWorldEditor::convertSelectionToPolyhedralObjects( %this, %className ) -{ - %group = %this.getNewObjectGroup(); - %undoManager = Editor.getUndoManager(); - - %activeSelection = %this.getActiveSelection(); - while( %activeSelection.getCount() != 0 ) - { - %oldObject = %activeSelection.getObject( 0 ); - %newObject = %this.createPolyhedralObject( %className, %oldObject ); - if( isObject( %newObject ) ) - { - %undoManager.pushCompound( "Convert ConvexShape to " @ %className ); - %newObject.parentGroup = %oldObject.parentGroup; - MECreateUndoAction::submit( %newObject ); - MEDeleteUndoAction::submit( %oldObject ); - %undoManager.popCompound(); - } - } -} - -function EWorldEditor::convertSelectionToConvexShape( %this ) -{ - %group = %this.getNewObjectGroup(); - %undoManager = Editor.getUndoManager(); - - %activeSelection = %this.getActiveSelection(); - while( %activeSelection.getCount() != 0 ) - { - %oldObject = %activeSelection.getObject( 0 ); - %newObject = %this.createConvexShapeFrom( %oldObject ); - if( isObject( %newObject ) ) - { - %undoManager.pushCompound( "Convert " @ %oldObject.getClassName() @ " to ConvexShape" ); - %newObject.parentGroup = %oldObject.parentGroup; - MECreateUndoAction::submit( %newObject ); - MEDeleteUndoAction::submit( %oldObject ); - %undoManager.popCompound(); - } - } -} - -function EWorldEditor::getNewObjectGroup( %this ) -{ - return EWCreatorWindow.getNewObjectGroup(); -} - -function EWorldEditor::deleteMissionObject( %this, %object ) -{ - // Unselect in editor tree. - - %id = EditorTree.findItemByObjectId( %object ); - EditorTree.selectItem( %id, false ); - - // Delete object. - - MEDeleteUndoAction::submit( %object ); - EWorldEditor.isDirty = true; - EditorTree.buildVisibleTree( true ); -} - -function EWorldEditor::createGameObject( %this, %entity ) -{ - if(!isObject(GameObjectBuilder)) - { - new GuiControl(GameObjectBuilder, EditorGuiGroup) { - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "0 0"; - extent = "800 600"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; + barTitle = "View"; + + item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();"; + item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();"; + }; + %this.menuBar.insert(%viewMenu); - new GuiWindowCtrl(GameObjectBuilderTargetWindow) { - profile = "ToolsGuiWindowProfile"; - horizSizing = "center"; - vertSizing = "center"; - position = "384 205"; - extent = "256 102"; - minExtent = "256 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - resizeWidth = "1"; - resizeHeight = "1"; - canMove = "1"; - canClose = "0"; - canMinimize = "0"; - canMaximize = "0"; - minSize = "50 50"; - text = "Create Object"; + // Camera Menu + %cameraMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorCameraMenu"; + + barTitle = "Camera"; + + item[0] = "World Camera" TAB %this.freeCameraTypeMenu; + item[1] = "Player Camera" TAB %this.playerCameraTypeMenu; + item[2] = "-"; + Item[3] = "Toggle Camera" TAB %menuCmdCtrl SPC "C" TAB "commandToServer('ToggleCamera');"; + item[4] = "Place Camera at Selection" TAB "Ctrl Q" TAB "EWorldEditor.dropCameraToSelection();"; + item[5] = "Place Camera at Player" TAB "Alt Q" TAB "commandToServer('dropCameraAtPlayer');"; + item[6] = "Place Player at Camera" TAB "Alt W" TAB "commandToServer('DropPlayerAtCamera');"; + item[7] = "-"; + item[8] = "Fit View to Selection" TAB "F" TAB "commandToServer('EditorCameraAutoFit', EWorldEditor.getSelectionRadius()+1);"; + item[9] = "Fit View To Selection and Orbit" TAB "Alt F" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\"); commandToServer('EditorCameraAutoFit', EWorldEditor.getSelectionRadius()+1);"; + item[10] = "-"; + item[11] = "Speed" TAB %this.cameraSpeedMenu; + item[12] = "View" TAB %this.viewTypeMenu; + item[13] = "-"; + Item[14] = "Add Bookmark..." TAB "Ctrl B" TAB "EditorGui.addCameraBookmarkByGui();"; + Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();"; + item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu; + }; + %this.menuBar.insert(%cameraMenu); - new GuiTextCtrl() { - profile = "GuiCenterTextProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "9 26"; - extent = "84 16"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - text = "Object Name:"; - }; - new GuiTextEditCtrl(GameObjectBuilderObjectName) { - class = ObjectBuilderGuiTextEditCtrl; - profile = "ToolsGuiTextEditProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "78 26"; - extent = "172 18"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - historySize = "0"; - }; - new GuiButtonCtrl(GameObjectBuilderOKButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "7 250"; - extent = "156 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "EWorldEditor.buildGameObject();"; - helpTag = "0"; - text = "Create New"; - Accelerator = "return"; - }; - new GuiButtonCtrl(GameObjectBuilderCancelButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "left"; - vertSizing = "bottom"; - position = "170 250"; - extent = "80 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "Canvas.popDialog(GameObjectBuilder);"; - helpTag = "0"; - text = "Cancel"; - Accelerator = "escape"; - }; - }; + // Editors Menu + %editorsMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorToolsMenu"; + + barTitle = "Editors"; + + //item[0] = "Object Editor" TAB "F1" TAB WorldEditorInspectorPlugin; + //item[1] = "Material Editor" TAB "F2" TAB MaterialEditorPlugin; + //item[2] = "-"; + //item[3] = "Terrain Editor" TAB "F3" TAB TerrainEditorPlugin; + //item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin; + //item[5] = "-"; + }; + %this.menuBar.insert(%editorsMenu); + + // Lighting Menu + %lightingMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorLightingMenu"; + + barTitle = "Lighting"; + + item[0] = "Full Relight" TAB "Alt L" TAB "Editor.lightScene(\"\", forceAlways);"; + item[1] = "Toggle ShadowViz" TAB "" TAB "toggleShadowViz();"; + item[2] = "-"; + + // NOTE: The light managers will be inserted as the + // last menu items in EditorLightingMenu::onAdd(). + }; + %this.menuBar.insert(%lightingMenu); + + // Tools Menu + %toolsMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorUtilitiesMenu"; + + barTitle = "Tools"; + + item[0] = "Network Graph" TAB "n" TAB "toggleNetGraph();"; + item[1] = "Profiler" TAB "ctrl F2" TAB "showMetrics(true);"; + item[2] = "Torque SimView" TAB "" TAB "tree();"; + item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();"; + }; + %this.menuBar.insert(%toolsMenu); + + // Help Menu + %helpMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorHelpMenu"; + + barTitle = "Help"; + + item[0] = "Online Documentation..." TAB "Alt F1" TAB "gotoWebPage(EWorldEditor.documentationURL);"; + item[1] = "Offline User Guide..." TAB "" TAB "gotoWebPage(EWorldEditor.documentationLocal);"; + item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);"; + item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);"; + }; + %this.menuBar.insert(%helpMenu); + + // Menus that are added/removed dynamically (temporary) + + // World Menu + if(! isObject(%this.worldMenu)) + { + %this.dropTypeMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorDropTypeMenu"; + + // The onSelectItem() callback for this menu re-purposes the command field + // as the MenuBuilder version is not used. + item[0] = "at Origin" TAB "" TAB "atOrigin"; + item[1] = "at Camera" TAB "" TAB "atCamera"; + item[2] = "at Camera w/Rotation" TAB "" TAB "atCameraRot"; + item[3] = "Below Camera" TAB "" TAB "belowCamera"; + item[4] = "Screen Center" TAB "" TAB "screenCenter"; + item[5] = "at Centroid" TAB "" TAB "atCentroid"; + item[6] = "to Terrain" TAB "" TAB "toTerrain"; + item[7] = "Below Selection" TAB "" TAB "belowSelection"; + item[8] = "At Gizmo" TAB "" TAB "atGizmo"; }; - GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88; - GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57; - GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57; - } - - GameObjectBuilderObjectName.text = ""; - GameObjectBuilder.selectedEntity = %entity; - - Canvas.pushDialog(GameObjectBuilder); -} - -function EWorldEditor::buildGameObject(%this) -{ - if(GameObjectBuilderObjectName.getText() $= "") - { - error("Attempted to make a new Game Object with no name!"); - Canvas.popDialog(GameObjectBuilder); - return; - } - - %path = EditorSettings.value( "WorldEditor/newGameObjectDir" ); - %className = GameObjectBuilderObjectName.getText(); - GameObjectBuilder.selectedEntity.class = %className; - Inspector.inspect(GameObjectBuilder.selectedEntity); - - %file = new FileObject(); - - if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) - { - %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); - %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); - - //todo, pre-write any event functions of interest - - %file.close(); - } - - //set up the paths - %tamlPath = %path @ "/" @ %className @ ".taml"; - %scriptPath = %path @ "/" @ %className @ ".cs"; - saveGameObject(%className, %tamlPath, %scriptPath); - - //reload it - execGameObjects(); - - //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. - TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath); - - GameObjectBuilder.selectedEntity = ""; - - Canvas.popDialog(GameObjectBuilder); -} - -function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect ) -{ - if( !isObject( %set ) ) - return; - - foreach( %obj in %set ) - { - if( %deselect ) - %this.unselectObject( %obj ); - else - %this.selectObject( %obj ); - } -} - -function toggleSnappingOptions( %var ) -{ - if( SnapToBar->objectSnapDownBtn.getValue() && SnapToBar->objectSnapBtn.getValue() ) - { - if( %var $= "terrain" ) + %this.alignBoundsMenu = new PopupMenu() { - EWorldEditor.stickToGround = 1; - EWorldEditor.setSoftSnap(false); - ESnapOptionsTabBook.selectPage(0); - SnapToBar->objectSnapBtn.setStateOn(0); - } - else - { - // soft snapping - EWorldEditor.stickToGround = 0; - EWorldEditor.setSoftSnap(true); - ESnapOptionsTabBook.selectPage(1); - SnapToBar->objectSnapDownBtn.setStateOn(0); - } + superClass = "MenuBuilder"; + class = "EditorAlignBoundsMenu"; + + // The onSelectItem() callback for this menu re-purposes the command field + // as the MenuBuilder version is not used. + item[0] = "+X Axis" TAB "" TAB "0"; + item[1] = "+Y Axis" TAB "" TAB "1"; + item[2] = "+Z Axis" TAB "" TAB "2"; + item[3] = "-X Axis" TAB "" TAB "3"; + item[4] = "-Y Axis" TAB "" TAB "4"; + item[5] = "-Z Axis" TAB "" TAB "5"; + }; + + %this.alignCenterMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorAlignCenterMenu"; + + // The onSelectItem() callback for this menu re-purposes the command field + // as the MenuBuilder version is not used. + item[0] = "X Axis" TAB "" TAB "0"; + item[1] = "Y Axis" TAB "" TAB "1"; + item[2] = "Z Axis" TAB "" TAB "2"; + }; + + %this.worldMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + + barTitle = "Object"; + + item[0] = "Lock Selection" TAB %cmdCtrl @ " L" TAB "EWorldEditor.lockSelection(true); EWorldEditor.syncGui();"; + item[1] = "Unlock Selection" TAB %cmdCtrl @ "-Shift L" TAB "EWorldEditor.lockSelection(false); EWorldEditor.syncGui();"; + item[2] = "-"; + item[3] = "Hide Selection" TAB %cmdCtrl @ " H" TAB "EWorldEditor.hideSelection(true); EWorldEditor.syncGui();"; + item[4] = "Show Selection" TAB %cmdCtrl @ "-Shift H" TAB "EWorldEditor.hideSelection(false); EWorldEditor.syncGui();"; + item[5] = "-"; + item[6] = "Align Bounds" TAB %this.alignBoundsMenu; + item[7] = "Align Center" TAB %this.alignCenterMenu; + item[8] = "-"; + item[9] = "Reset Transforms" TAB "Ctrl R" TAB "EWorldEditor.resetTransforms();"; + item[10] = "Reset Selected Rotation" TAB "" TAB "EWorldEditor.resetSelectedRotation();"; + item[11] = "Reset Selected Scale" TAB "" TAB "EWorldEditor.resetSelectedScale();"; + item[12] = "Transform Selection..." TAB "Ctrl T" TAB "ETransformSelection.ToggleVisibility();"; + item[13] = "-"; + //item[13] = "Drop Camera to Selection" TAB "Ctrl Q" TAB "EWorldEditor.dropCameraToSelection();"; + //item[14] = "Add Selection to Instant Group" TAB "" TAB "EWorldEditor.addSelectionToAddGroup();"; + item[14] = "Drop Selection" TAB "Ctrl D" TAB "EWorldEditor.dropSelection();"; + //item[15] = "-"; + item[15] = "Drop Location" TAB %this.dropTypeMenu; + Item[16] = "-"; + Item[17] = "Make Selection Prefab" TAB "" TAB "EditorMakePrefab();"; + Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();"; + Item[19] = "-"; + Item[20] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; + Item[21] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; + }; } - else if( %var $= "terrain" && EWorldEditor.stickToGround == 0 ) +} + +////////////////////////////////////////////////////////////////////////// + +function EditorGui::attachMenus(%this) +{ + %this.menuBar.attachToCanvas(Canvas, 0); +} + +function EditorGui::detachMenus(%this) +{ + %this.menuBar.removeFromCanvas(); +} + +function EditorGui::setMenuDefaultState(%this) +{ + if(! isObject(%this.menuBar)) + return 0; + + for(%i = 0;%i < %this.menuBar.getMenuCount();%i++) { - // Terrain Snapping - EWorldEditor.stickToGround = 1; - EWorldEditor.setSoftSnap(false); - ESnapOptionsTabBook.selectPage(0); - SnapToBar->objectSnapDownBtn.setStateOn(1); - SnapToBar->objectSnapBtn.setStateOn(0); - - } - else if( %var $= "soft" && EWorldEditor.getSoftSnap() == false ) - { - // Object Snapping - EWorldEditor.stickToGround = 0; - EWorldEditor.setSoftSnap(true); - ESnapOptionsTabBook.selectPage(1); - SnapToBar->objectSnapBtn.setStateOn(1); - SnapToBar->objectSnapDownBtn.setStateOn(0); - - } - else if( %var $= "grid" ) - { - EWorldEditor.setGridSnap( !EWorldEditor.getGridSnap() ); - } - else if( %var $= "byGroup" ) - { - EWorldEditor.UseGroupCenter = !EWorldEditor.UseGroupCenter; - ESnapOptions->GroupSnapButton.setStateOn(EWorldEditor.UseGroupCenter); - } - else - { - // No snapping. - - EWorldEditor.stickToGround = false; - EWorldEditor.setGridSnap( false ); - EWorldEditor.setSoftSnap( false ); - - SnapToBar->objectSnapDownBtn.setStateOn(0); - SnapToBar->objectSnapBtn.setStateOn(0); + %menu = %this.menuBar.getMenu(%i); + %menu.setupDefaultState(); } - EWorldEditor.syncGui(); + %this.worldMenu.setupDefaultState(); } -function objectCenterDropdown::toggle() +////////////////////////////////////////////////////////////////////////// + +function EditorGui::findMenu(%this, %name) { - if ( objectCenterDropdown.visible ) - { - EWorldEditorToolbar-->centerObject.setStateOn(false); - objectCenterDropdownDecoy.setVisible(false); - objectCenterDropdownDecoy.setActive(false); - objectCenterDropdown.setVisible(false); - } - else - { - EWorldEditorToolbar-->centerObject.setStateOn(true); - objectCenterDropdown.setVisible(true); - objectCenterDropdownDecoy.setActive(true); - objectCenterDropdownDecoy.setVisible(true); - } -} - -function objectTransformDropdown::toggle() -{ - if ( objectTransformDropdown.visible ) - { - EWorldEditorToolbar-->objectTransform.setStateOn(false); - objectTransformDropdownDecoy.setVisible(false); - objectTransformDropdownDecoy.setActive(false); - objectTransformDropdown.setVisible(false); - } - else - { - EWorldEditorToolbar-->objectTransform.setStateOn(true); - objectTransformDropdown.setVisible(true); - objectTransformDropdownDecoy.setActive(true); - objectTransformDropdownDecoy.setVisible(true); - } -} - -function objectSnapDropdownDecoy::onMouseLeave() -{ - objectSnapDropdown.toggle(); -} - -function objectCenterDropdownDecoy::onMouseLeave() -{ - objectCenterDropdown.toggle(); -} - -function objectTransformDropdownDecoy::onMouseLeave() -{ - objectTransformDropdown.toggle(); -} - -//------------------------------------------------------------------------------ - -function EWAddSimGroupButton::onDefaultClick( %this ) -{ - EWorldEditor.addSimGroup(); -} - -function EWAddSimGroupButton::onCtrlClick( %this ) -{ - EWorldEditor.addSimGroup( true ); -} - -//------------------------------------------------------------------------------ - -function EWToolsToolbar::reset( %this ) -{ - %count = ToolsToolbarArray.getCount(); - for( %i = 0 ; %i < %count; %i++ ) - ToolsToolbarArray.getObject(%i).setVisible(true); - - %this.setExtent((29 + 4) * %count + 12, 33); - %this.isClosed = 0; - EWToolsToolbar.isDynamic = 0; + if(! isObject(%this.menuBar)) + return 0; - EWToolsToolbarDecoy.setVisible(false); - EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 31); - - %this-->resizeArrow.setBitmap( "tools/gui/images/collapse-toolbar" ); -} - -function EWToolsToolbar::toggleSize( %this, %useDynamics ) -{ - // toggles the size of the tooltoolbar. also goes through - // and hides each control not currently selected. we hide the controls - // in a very neat, spiffy way - - if ( %this.isClosed == 0 ) + + for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++) { - %image = "tools/gui/images/expand-toolbar"; + %menu = %this.menuBar.getMenu(%i); - for( %i = 0 ; %i < ToolsToolbarArray.getCount(); %i++ ) - { - if( ToolsToolbarArray.getObject(%i).getValue() != 1 ) - ToolsToolbarArray.getObject(%i).setVisible(false); - } - - %this.setExtent(43, 33); - %this.isClosed = 1; - - if(!%useDynamics) - { - EWToolsToolbarDecoy.setVisible(true); - EWToolsToolbar.isDynamic = 1; - } - - EWToolsToolbarDecoy.setExtent(35, 31); + if(%name $= %menu.barTitle) + return %menu; } - else - { - %image = "tools/gui/images/collapse-toolbar"; - - %count = ToolsToolbarArray.getCount(); - for( %i = 0 ; %i < %count; %i++ ) - ToolsToolbarArray.getObject(%i).setVisible(true); - - %this.setExtent((29 + 4) * %count + 12, 33); - %this.isClosed = 0; - - if(!%useDynamics) - { - EWToolsToolbarDecoy.setVisible(false); - EWToolsToolbar.isDynamic = 0; - } - - EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 32); - } - - %this-->resizeArrow.setBitmap( %image ); - + + return 0; } - -function EWToolsToolbarDecoy::onMouseEnter( %this ) -{ - EWToolsToolbar.toggleSize(true); -} - -function EWToolsToolbarDecoy::onMouseLeave( %this ) -{ - EWToolsToolbar.toggleSize(true); -} - -//------------------------------------------------------------------------------ - -function EditorGuiStatusBar::reset( %this ) -{ - EWorldEditorStatusBarInfo.clearInfo(); -} - -function EditorGuiStatusBar::getInfo( %this ) -{ - return EWorldEditorStatusBarInfo.getValue(); -} - -function EditorGuiStatusBar::setInfo( %this, %text ) -{ - EWorldEditorStatusBarInfo.setText(%text); -} - -function EditorGuiStatusBar::clearInfo( %this ) -{ - EWorldEditorStatusBarInfo.setText(""); -} - -function EditorGuiStatusBar::getSelection( %this ) -{ - return EWorldEditorStatusBarSelection.getValue(); -} - -function EditorGuiStatusBar::setSelection( %this, %text ) -{ - EWorldEditorStatusBarSelection.setText(%text); -} - -function EditorGuiStatusBar::setSelectionObjectsByCount( %this, %count ) -{ - %text = " objects selected"; - if(%count == 1) - %text = " object selected"; - - EWorldEditorStatusBarSelection.setText(%count @ %text); -} - -function EditorGuiStatusBar::clearSelection( %this ) -{ - EWorldEditorStatusBarSelection.setText(""); -} - -function EditorGuiStatusBar::getCamera( %this ) -{ - return EWorldEditorStatusBarCamera.getText(); -} - -function EditorGuiStatusBar::setCamera( %this, %text ) -{ - %id = EWorldEditorStatusBarCamera.findText( %text ); - if( %id != -1 ) - { - if ( EWorldEditorStatusBarCamera.getSelected() != %id ) - EWorldEditorStatusBarCamera.setSelected( %id, true ); - } -} - -function EWorldEditorStatusBarCamera::onWake( %this ) -{ - %this.add( "Standard Camera" ); - %this.add( "1st Person Camera" ); - %this.add( "3rd Person Camera" ); - %this.add( "Orbit Camera" ); - %this.add( "Top View" ); - %this.add( "Bottom View" ); - %this.add( "Left View" ); - %this.add( "Right View" ); - %this.add( "Front View" ); - %this.add( "Back View" ); - %this.add( "Isometric View" ); - %this.add( "Smooth Camera" ); - %this.add( "Smooth Rot Camera" ); -} - -function EWorldEditorStatusBarCamera::onSelect( %this, %id, %text ) -{ - switch$( %text ) - { - case "Top View": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeTop ); - - case "Bottom View": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeBottom ); - - case "Left View": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeLeft ); - - case "Right View": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeRight ); - - case "Front View": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeFront ); - - case "Back View": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeBack ); - - case "Isometric View": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeIsometric ); - - case "Standard Camera": - commandToServer( 'SetEditorCameraStandard' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); - - case "1st Person Camera": - commandToServer( 'SetEditorCameraPlayer' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); - - case "3rd Person Camera": - commandToServer( 'SetEditorCameraPlayerThird' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); - - case "Orbit Camera": - commandToServer( 'SetEditorOrbitCamera' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); - - case "Smooth Camera": - commandToServer( 'SetEditorCameraNewton' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); - - case "Smooth Rot Camera": - commandToServer( 'SetEditorCameraNewtonDamped' ); - EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); - } -} - -//------------------------------------------------------------------------------------ -// Each a gui slider bar is pushed on the editor gui, it maps itself with value -// located in its connected text control -//------------------------------------------------------------------------------------ -function softSnapSizeSliderCtrlContainer::onWake(%this) -{ - %this-->slider.setValue(EWorldEditorToolbar-->softSnapSizeTextEdit.getValue()); -} -function softSnapSizeSliderCtrlContainer::onSliderChanged(%this) -{ - EWorldEditor.setSoftSnapSize( %this-->slider.value ); - EWorldEditor.syncGui(); -} -//------------------------------------------------------------------------------------ - -function PaintBrushSizeSliderCtrlContainer::onWake(%this) -{ - %this-->slider.range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0); - %this-->slider.setValue(PaintBrushSizeTextEditContainer-->textEdit.getValue()); -} - -function PaintBrushPressureSliderCtrlContainer::onWake(%this) -{ - %this-->slider.setValue(PaintBrushPressureTextEditContainer-->textEdit.getValue() / 100); -} - -function PaintBrushSoftnessSliderCtrlContainer::onWake(%this) -{ - %this-->slider.setValue(PaintBrushSoftnessTextEditContainer-->textEdit.getValue() / 100); -} - -//------------------------------------------------------------------------------------ - -function TerrainBrushSizeSliderCtrlContainer::onWake(%this) -{ - %this-->slider.range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0); - %this-->slider.setValue(TerrainBrushSizeTextEditContainer-->textEdit.getValue()); -} - -function TerrainBrushPressureSliderCtrlContainer::onWake(%this) -{ - %this-->slider.setValue(TerrainBrushPressureTextEditContainer-->textEdit.getValue() / 100.0); -} - -function TerrainBrushSoftnessSliderCtrlContainer::onWake(%this) -{ - %this-->slider.setValue(TerrainBrushSoftnessTextEditContainer-->textEdit.getValue() / 100.0); -} - -function TerrainSetHeightSliderCtrlContainer::onWake(%this) -{ - %this-->slider.setValue(TerrainSetHeightTextEditContainer-->textEdit.getValue()); -} -//------------------------------------------------------------------------------------ -function CameraSpeedDropdownCtrlContainer::onWake(%this) -{ - %this-->slider.setValue(CameraSpeedDropdownContainer-->textEdit.getText()); -} - -//------------------------------------------------------------------------------------ -// Callbacks to close the dropdown slider controls like the camera speed, -// that are marked with this class name. - -function EditorDropdownSliderContainer::onMouseDown(%this) -{ - Canvas.popDialog(%this); -} - -function EditorDropdownSliderContainer::onRightMouseDown(%this) -{ - Canvas.popDialog(%this); -} \ No newline at end of file From fac951e30da6ddb56f1b75e2a6d41c96403ac0a6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 12 Nov 2017 11:42:44 -0600 Subject: [PATCH 056/312] Prior commit had mangled files somehow. Fixed. --- .../tools/worldEditor/scripts/EditorGui.ed.cs | 3165 +++++++++++++++-- .../tools/worldEditor/scripts/menus.ed.cs | 31 +- 2 files changed, 2801 insertions(+), 395 deletions(-) diff --git a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs index b225d3534..535d00880 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -20,412 +20,2813 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -function EditorGui::buildMenus(%this) +function EditorGui::init(%this) { - if(isObject(%this.menuBar)) - return; + EWorldEditor.isDirty = false; + ETerrainEditor.isDirty = false; + ETerrainEditor.isMissionDirty = false; - //set up %cmdctrl variable so that it matches OS standards - if( $platform $= "macos" ) - { - %cmdCtrl = "Cmd"; - %menuCmdCtrl = "Cmd"; - %quitShortcut = "Cmd Q"; - %redoShortcut = "Cmd-Shift Z"; + if( %this.isInitialized ) + return; + + %this.readWorldEditorSettings(); + + $SelectedOperation = -1; + $NextOperationId = 1; + $HeightfieldDirtyRow = -1; + + if( !isObject( %this-->ToolsPaletteWindow ) ) + { + // Load Creator/Inspector GUI + exec("~/worldEditor/gui/ToolsPaletteGroups/init.cs"); + exec("~/worldEditor/gui/ToolsPaletteWindow.ed.gui"); + + if( isObject( EWToolsPaletteWindow ) ) + { + %this.add( EWToolsPaletteWindow ); + EWToolsPaletteWindow.init(); + EWToolsPaletteWindow.setVisible( false ); + } + } + + if( !isObject( %this-->TreeWindow ) ) + { + // Load Creator/Inspector GUI + exec("~/worldEditor/gui/WorldEditorTreeWindow.ed.gui"); + if( isObject( EWTreeWindow ) ) + { + %this.add( EWTreeWindow ); + EWTreeWindow-->EditorTree.selectPage( 0 ); + EWTreeWindow.setVisible( false ); + } + } + + if( !isObject( %this-->InspectorWindow ) ) + { + // Load Creator/Inspector GUI + exec("~/worldEditor/gui/WorldEditorInspectorWindow.ed.gui"); + //EWInspectorWindow.resize(getWord(EWInspectorWindow.Position, 0), getWord(EWInspectorWindow.Position, 1), getWord(EWInspectorWindow.extent, 0), getWord(EWInspectorWindow.extent, 1)); + if( isObject( EWInspectorWindow ) ) + { + %this.add( EWInspectorWindow ); + EWInspectorWindow.setVisible( false ); + } + } + + if( !isObject( %this-->WorldEditorToolbar ) ) + { + // Load Creator/Inspector GUI + exec("~/worldEditor/gui/WorldEditorToolbar.ed.gui"); + if( isObject( EWorldEditorToolbar ) ) + { + %this.add( EWorldEditorToolbar ); + EWorldEditorToolbar.setVisible( false ); + } + } + + if ( !isObject( %this-->TerrainEditToolbar ) ) + { + // Load Terrain Edit GUI + exec("~/worldEditor/gui/TerrainEditToolbar.ed.gui"); + if( isObject( EWTerrainEditToolbar ) ) + { + %this.add( EWTerrainEditToolbar ); + EWTerrainEditToolbar.setVisible( false ); + } + } + + if( !isObject( %this-->TerrainPainter ) ) + { + // Load Terrain Painter GUI + exec("~/worldEditor/gui/TerrainPainterWindow.ed.gui"); + if( isObject( %guiContent ) ){ + %this.add( %guiContent->TerrainPainter ); + %this.add( %guiContent->TerrainPainterPreview ); + } + + exec("~/worldEditor/gui/guiTerrainMaterialDlg.ed.gui"); + exec("~/worldEditor/gui/TerrainBrushSoftnessCurveDlg.ed.gui"); + } + if ( !isObject( %this-->TerrainPainterToolbar) ) + { + // Load Terrain Edit GUI + exec("~/worldEditor/gui/TerrainPainterToolbar.ed.gui"); + if( isObject( EWTerrainPainterToolbar ) ) + { + %this.add( EWTerrainPainterToolbar ); + EWTerrainPainterToolbar.setVisible( false ); + } + } + + if( !isObject( %this-->ToolsToolbar ) ) + { + // Load Creator/Inspector GUI + exec("~/worldEditor/gui/ToolsToolbar.ed.gui"); + if( isObject( EWToolsToolbar ) ) + { + %this.add( EWToolsToolbar ); + EWToolsToolbar.setVisible( true ); + + } + } + + // Visibility Layer Window + if( !isObject( %this-->VisibilityLayerWindow ) ) + { + %this.add( EVisibility ); + EVisibility.setVisible(false); + EVisibilityTabBook.selectPage(0); + } + + // Editor Settings Window + if( !isObject( %this-->EditorSettingsWindow ) ) + { + exec("~/worldEditor/gui/EditorSettingsWindow.ed.gui"); + exec("~/worldEditor/scripts/editorSettingsWindow.ed.cs"); + %this.add( ESettingsWindow ); + ESettingsWindow.setVisible(false); + + // Start the standard settings tabs pages + exec( "~/worldEditor/gui/GeneralSettingsTab.ed.gui" ); + ESettingsWindow.addTabPage( EGeneralSettingsPage ); + exec("~/worldEditor/gui/ObjectEditorSettingsTab.ed.gui"); + ESettingsWindow.addTabPage( EObjectEditorSettingsPage ); + exec("~/worldEditor/gui/AxisGizmoSettingsTab.ed.gui"); + ESettingsWindow.addTabPage( EAxisGizmoSettingsPage ); + exec("~/worldEditor/gui/TerrainEditorSettingsTab.ed.gui"); + ESettingsWindow.addTabPage( ETerrainEditorSettingsPage ); + exec("~/worldEditor/gui/CameraSettingsTab.ed.gui"); + ESettingsWindow.addTabPage( ECameraSettingsPage ); + } + + // Object Snap Options Window + if( !isObject( %this-->SnapOptionsWindow ) ) + { + exec("~/worldEditor/gui/ObjectSnapOptionsWindow.ed.gui"); + exec("~/worldEditor/scripts/objectSnapOptions.ed.cs"); + %this.add( ESnapOptions ); + ESnapOptions.setVisible(false); + ESnapOptionsTabBook.selectPage(0); + } + + // Transform Selection Window + if( !isObject( %this-->TransformSelectionWindow ) ) + { + exec("~/worldEditor/gui/TransformSelectionWindow.ed.gui"); + exec("~/worldEditor/scripts/transformSelection.ed.cs"); + %this.add( ETransformSelection ); + ETransformSelection.setVisible(false); + } + + // Manage Bookmarks Window + if( !isObject( %this-->ManageBookmarksWindow ) ) + { + %this.add( EManageBookmarks ); + EManageBookmarks.setVisible(false); + } + + // Manage SFXParameters Window + if( !isObject( %this-->ManageSFXParametersWindow ) ) + { + %this.add( EManageSFXParameters ); + EManageSFXParameters.setVisible( false ); + } + + // Select Objects Window + if( !isObject( %this->SelectObjectsWindow ) ) + { + %this.add( ESelectObjectsWindow ); + ESelectObjectsWindow.setVisible( false ); + } + + EWorldEditor.init(); + ETerrainEditor.init(); + + //Creator.init(); + EWCreatorWindow.init(); + ObjectBuilderGui.init(); + + %this.setMenuDefaultState(); + + EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/player"); + + /* + EWorldEditorCameraSpeed.clear(); + EWorldEditorCameraSpeed.add("Slowest - Camera 1",0); + EWorldEditorCameraSpeed.add("Slow - Camera 2",1); + EWorldEditorCameraSpeed.add("Slower - Camera 3",2); + EWorldEditorCameraSpeed.add("Normal - Camera 4",3); + EWorldEditorCameraSpeed.add("Faster - Camera 5",4); + EWorldEditorCameraSpeed.add("Fast - Camera 6",5); + EWorldEditorCameraSpeed.add("Fastest - Camera 7",6); + EWorldEditorCameraSpeed.setSelected(3); + */ + + EWorldEditorAlignPopup.clear(); + EWorldEditorAlignPopup.add("World",0); + EWorldEditorAlignPopup.add("Object",1); + EWorldEditorAlignPopup.setSelected(0); + + + // sync camera gui + EditorGui.syncCameraGui(); + + // this will brind CameraTypesDropdown to front so that it goes over the menubar + EditorGui.pushToBack(CameraTypesDropdown); + EditorGui.pushToBack(VisibilityDropdown); + + // dropdowns out so that they display correctly in editor gui + objectTransformDropdown.parentGroup = editorGui; + objectCenterDropdown.parentGroup = editorGui; + objectSnapDropdown.parentGroup = editorGui; + + // make sure to show the default world editor guis + EditorGui.bringToFront( EWorldEditor ); + EWorldEditor.setVisible( false ); + + // Call the startup callback on the editor plugins. + for ( %i = 0; %i < EditorPluginSet.getCount(); %i++ ) + { + %obj = EditorPluginSet.getObject( %i ); + %obj.onWorldEditorStartup(); + } + + // With everything loaded, start up the settings window + ESettingsWindow.startup(); + + // Start up initial editor plugin. + + %initialEditor = %this.currentEditor; // Read from prefs. + %this.currentEditor = ""; + + if( %initialEditor $= "" ) + %initialEditor = "WorldEditorInspectorPlugin"; + %this.setEditor( %initialEditor, true, true ); + + // Done. + + %this.isInitialized = true; +} + +//------------------------------------------------------------------------------ +// Editor Gui's interactions with Camera Settings + +function EditorGui::setupDefaultCameraSettings( %this ) +{ + EditorSettings.beginGroup( "LevelInformation/levels/" @ %this.levelName ); + + EditorSettings.setDefaultValue( "cameraSpeedMin", "5" ); + EditorSettings.setDefaultValue( "cameraSpeedMax", "200" ); + + EditorSettings.endGroup(); +} + +function EditorGui::readCameraSettings( %this, %levelName ) +{ + if( %levelName !$= %this.levelName ) + return; + + EditorCameraSpeedOptions.setupGuiControls(); +} + +function EditorGui::writeCameraSettings( %this ) +{ + EditorSettings.beginGroup( "LevelInformation/levels/" @ %this.levelName ); + + EditorSettings.setValue( "cameraSpeed", $Camera::movementSpeed ); + + EditorSettings.endGroup(); +} + +//------------------------------------------------------------------------------ + +function EditorGui::shutdown( %this ) +{ + // Store settings. + %this.writeWorldEditorSettings(); + + // Deactivate current editor. + %this.setEditor( "" ); + + // Call the shutdown callback on the editor plugins. + foreach( %plugin in EditorPluginSet ) + %plugin.onWorldEditorShutdown(); +} + +/// This is used to add an editor to the Editors menu which +/// will take over the default world editor window. +function EditorGui::addToEditorsMenu( %this, %displayName, %accel, %newPlugin ) +{ + %windowMenu = %this.findMenu( "Editors" ); + %count = %windowMenu.getItemCount(); + + + %alreadyExists = false; + for ( %i = 0; %i < %count; %i++ ) + { + %existingPlugins = getField(%windowMenu.Item[%i], 2); + + if(%newPlugin $= %existingPlugins) + %alreadyExists = true; + } + + if( %accel $= "" && %count < 9 ) + %accel = "F" @ %count + 1; + else + %accel = ""; + + if(!%alreadyExists) + %windowMenu.addItem( %count, %displayName TAB %accel TAB %newPlugin ); + + return %accel; +} + +function EditorGui::addToToolsToolbar( %this, %pluginName, %internalName, %bitmap, %tooltip ) +{ + %count = ToolsToolbarArray.getCount(); + + %alreadyExists = false; + for ( %i = 0; %i < %count; %i++ ) + { + %existingInternalName = ToolsToolbarArray.getObject(%i).getFieldValue("internalName"); + + if(%internalName $= %existingInternalName) + { + %alreadyExists = true; + break; + } + } + + if(!%alreadyExists) + { + %button = new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = %internalName; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "180 0"; + Extent = "25 19"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "EditorGui.setEditor(" @ %pluginName @ ");"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = %tooltip; + hovertime = "750"; + bitmap = %bitmap; + buttonType = "RadioButton"; + groupNum = "0"; + useMouseEvents = "0"; + }; + ToolsToolbarArray.add(%button); + EWToolsToolbar.setExtent((25 + 8) * (%count + 1) + 12 SPC "33"); + } +} + +//----------------------------------------------------------------------------- + +function EditorGui::setDisplayType( %this, %type ) +{ + %gui = %this.currentEditor.editorGui; + if( !isObject( %gui ) ) + return; + + %this.viewTypeMenu.checkRadioItem( 0, 7, %type ); + + // Store the current camera rotation so we can restore it correctly when + // switching back to perspective view + if ( %gui.getDisplayType() == $EditTSCtrl::DisplayTypePerspective ) + %this.lastPerspectiveCamRotation = LocalClientConnection.camera.getRotation(); + + %gui.setDisplayType( %type ); + + if ( %gui.getDisplayType() == $EditTSCtrl::DisplayTypePerspective ) + LocalClientConnection.camera.setRotation( %this.lastPerspectiveCamRotation ); + + %this.currentDisplayType = %type; +} + +//----------------------------------------------------------------------------- + +function EditorGui::setEditor( %this, %newEditor, %dontActivate ) +{ + if ( isObject( %this.currentEditor ) ) + { + if( isObject( %newEditor ) && %this.currentEditor.getId() == %newEditor.getId() ) + return; + + if( %this.currentEditor.isActivated ) + %this.currentEditor.onDeactivated(); + + if( isObject( %this.currentEditor.editorGui ) ) + %this.currentOrthoFOV = %this.currentEditor.editorGui.getOrthoFOV(); + } + + if( !isObject( %newEditor ) ) + { + %this.currentEditor = ""; + return; + } + + // If we have a special set editor function, run that instead + if( %newEditor.isMethod( "setEditorFunction" ) ) + { + if( %newEditor.setEditorFunction() ) + { + %this.syncEditor( %newEditor ); + %this.currentEditor = %newEditor; + + if (!%dontActivate) + %this.currentEditor.onActivated(); + } + else + { + // if were falling back and were the same editor, why are we going to just shove ourself + // into the editor position again? opt for a fallback + if( !isObject( %this.currentEditor ) ) + %this.currentEditor = "WorldEditorInspectorPlugin"; + else if( %this.currentEditor.getId() == %newEditor.getId() ) + %this.currentEditor = "WorldEditorInspectorPlugin"; + + %this.syncEditor( %this.currentEditor, true ); + + if( !%dontActivate ) + %this.currentEditor.onActivated(); + } } else { - %cmdCtrl = "Ctrl"; - %menuCmdCtrl = "Alt"; - %quitShortcut = "Alt F4"; - %redoShortcut = "Ctrl Y"; - } - - // Sub menus (temporary, until MenuBuilder gets updated) - // The speed increments located here are overwritten in EditorCameraSpeedMenu::setupDefaultState. - // The new min/max for the editor camera speed range can be set in each level's levelInfo object. - if(!isObject(EditorCameraSpeedOptions)) - { - %this.cameraSpeedMenu = new PopupMenu(EditorCameraSpeedOptions) - { - superClass = "MenuBuilder"; - class = "EditorCameraSpeedMenu"; - - item[0] = "Slowest" TAB %cmdCtrl @ "-Shift 1" TAB "5"; - item[1] = "Slow" TAB %cmdCtrl @ "-Shift 2" TAB "35"; - item[2] = "Slower" TAB %cmdCtrl @ "-Shift 3" TAB "70"; - item[3] = "Normal" TAB %cmdCtrl @ "-Shift 4" TAB "100"; - item[4] = "Faster" TAB %cmdCtrl @ "-Shift 5" TAB "130"; - item[5] = "Fast" TAB %cmdCtrl @ "-Shift 6" TAB "165"; - item[6] = "Fastest" TAB %cmdCtrl @ "-Shift 7" TAB "200"; - }; - } - if(!isObject(EditorFreeCameraTypeOptions)) - { - %this.freeCameraTypeMenu = new PopupMenu(EditorFreeCameraTypeOptions) - { - superClass = "MenuBuilder"; - class = "EditorFreeCameraTypeMenu"; - - item[0] = "Standard" TAB "Ctrl 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");"; - item[1] = "Orbit Camera" TAB "Ctrl 2" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\");"; - Item[2] = "-"; - item[3] = "Smoothed" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Camera\");"; - item[4] = "Smoothed Rotate" TAB "" TAB "EditorGuiStatusBar.setCamera(\"Smooth Rot Camera\");"; - }; - } - if(!isObject(EditorPlayerCameraTypeOptions)) - { - %this.playerCameraTypeMenu = new PopupMenu(EditorPlayerCameraTypeOptions) - { - superClass = "MenuBuilder"; - class = "EditorPlayerCameraTypeMenu"; - - Item[0] = "First Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"1st Person Camera\");"; - Item[1] = "Third Person" TAB "" TAB "EditorGuiStatusBar.setCamera(\"3rd Person Camera\");"; - }; - } - if(!isObject(EditorCameraBookmarks)) - { - %this.cameraBookmarksMenu = new PopupMenu(EditorCameraBookmarks) - { - superClass = "MenuBuilder"; - class = "EditorCameraBookmarksMenu"; - - //item[0] = "None"; - }; - } - %this.viewTypeMenu = new PopupMenu() - { - superClass = "MenuBuilder"; + %this.syncEditor( %newEditor ); + %this.currentEditor = %newEditor; - item[ 0 ] = "Top" TAB "Alt 2" TAB "EditorGuiStatusBar.setCamera(\"Top View\");"; - item[ 1 ] = "Bottom" TAB "Alt 5" TAB "EditorGuiStatusBar.setCamera(\"Bottom View\");"; - item[ 2 ] = "Front" TAB "Alt 3" TAB "EditorGuiStatusBar.setCamera(\"Front View\");"; - item[ 3 ] = "Back" TAB "Alt 6" TAB "EditorGuiStatusBar.setCamera(\"Back View\");"; - item[ 4 ] = "Left" TAB "Alt 4" TAB "EditorGuiStatusBar.setCamera(\"Left View\");"; - item[ 5 ] = "Right" TAB "Alt 7" TAB "EditorGuiStatusBar.setCamera(\"Right View\");"; - item[ 6 ] = "Perspective" TAB "Alt 1" TAB "EditorGuiStatusBar.setCamera(\"Standard Camera\");"; - item[ 7 ] = "Isometric" TAB "Alt 8" TAB "EditorGuiStatusBar.setCamera(\"Isometric View\");"; - }; - - // Menu bar - %this.menuBar = new GuiMenuBar(WorldEditorMenubar) - { - dynamicItemInsertPos = 3; - extent = "1024 20"; - minExtent = "320 20"; - horizSizing = "width"; - profile = "GuiMenuBarProfile"; - }; - - // File Menu - %fileMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorFileMenu"; - - barTitle = "File"; - }; - - - %fileMenu.appendItem("New Level" TAB "" TAB "schedule( 1, 0, \"EditorNewLevel\" );"); - %fileMenu.appendItem("Open Level..." TAB %cmdCtrl SPC "O" TAB "schedule( 1, 0, \"EditorOpenMission\" );"); - %fileMenu.appendItem("Save Level" TAB %cmdCtrl SPC "S" TAB "EditorSaveMissionMenu();"); - %fileMenu.appendItem("Save Level As..." TAB "" TAB "EditorSaveMissionAs();"); - %fileMenu.appendItem("-"); - - if( $platform $= "windows" ) - { - %fileMenu.appendItem( "Open Project in Torsion" TAB "" TAB "EditorOpenTorsionProject();" ); - %fileMenu.appendItem( "Open Level File in Torsion" TAB "" TAB "EditorOpenFileInTorsion();" ); - %fileMenu.appendItem( "-" ); + if( !%dontActivate ) + %this.currentEditor.onActivated(); } - %fileMenu.appendItem("Create Blank Terrain" TAB "" TAB "Canvas.pushDialog( CreateNewTerrainGui );"); - %fileMenu.appendItem("Import Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainImportGui );"); + // Sync display type. - %fileMenu.appendItem("Export Terrain Heightmap" TAB "" TAB "Canvas.pushDialog( TerrainExportGui );"); - %fileMenu.appendItem("-"); - %fileMenu.appendItem("Export To COLLADA..." TAB "" TAB "EditorExportToCollada();"); - //item[5] = "Import Terraform Data..." TAB "" TAB "Heightfield::import();"; - //item[6] = "Import Texture Data..." TAB "" TAB "Texture::import();"; - //item[7] = "-"; - //item[8] = "Export Terraform Data..." TAB "" TAB "Heightfield::saveBitmap(\"\");"; - - %fileMenu.appendItem( "-" ); - %fileMenu.appendItem( "Add FMOD Designer Audio..." TAB "" TAB "AddFMODProjectDlg.show();" ); - - %fileMenu.appendItem("-"); - %fileMenu.appendItem("Play Level" TAB "F11" TAB "Editor.close(\"PlayGui\");"); - - %fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();"); - %fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();"); - - %this.menuBar.insert(%fileMenu); - - // Edit Menu - %editMenu = new PopupMenu() + %gui = %this.currentEditor.editorGui; + if( isObject( %gui ) ) { - superClass = "MenuBuilder"; - class = "EditorEditMenu"; - internalName = "EditMenu"; - - barTitle = "Edit"; - - item[0] = "Undo" TAB %cmdCtrl SPC "Z" TAB "Editor.getUndoManager().undo();"; - item[1] = "Redo" TAB %redoShortcut TAB "Editor.getUndoManager().redo();"; - item[2] = "-"; - item[3] = "Cut" TAB %cmdCtrl SPC "X" TAB "EditorMenuEditCut();"; - item[4] = "Copy" TAB %cmdCtrl SPC "C" TAB "EditorMenuEditCopy();"; - item[5] = "Paste" TAB %cmdCtrl SPC "V" TAB "EditorMenuEditPaste();"; - item[6] = "Delete" TAB "Delete" TAB "EditorMenuEditDelete();"; - item[7] = "-"; - item[8] = "Deselect" TAB "X" TAB "EditorMenuEditDeselect();"; - Item[9] = "Select..." TAB "" TAB "EditorGui.toggleObjectSelectionsWindow();"; - item[10] = "-"; - item[11] = "Audio Parameters..." TAB "" TAB "EditorGui.toggleSFXParametersWindow();"; - item[12] = "Editor Settings..." TAB "" TAB "ESettingsWindow.ToggleVisibility();"; - item[13] = "Snap Options..." TAB "" TAB "ESnapOptions.ToggleVisibility();"; - item[14] = "-"; - item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; - item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; - }; - %this.menuBar.insert(%editMenu); - - // View Menu - %viewMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorViewMenu"; - internalName = "viewMenu"; - - barTitle = "View"; - - item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();"; - item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();"; - }; - %this.menuBar.insert(%viewMenu); - - // Camera Menu - %cameraMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorCameraMenu"; - - barTitle = "Camera"; - - item[0] = "World Camera" TAB %this.freeCameraTypeMenu; - item[1] = "Player Camera" TAB %this.playerCameraTypeMenu; - item[2] = "-"; - Item[3] = "Toggle Camera" TAB %menuCmdCtrl SPC "C" TAB "commandToServer('ToggleCamera');"; - item[4] = "Place Camera at Selection" TAB "Ctrl Q" TAB "EWorldEditor.dropCameraToSelection();"; - item[5] = "Place Camera at Player" TAB "Alt Q" TAB "commandToServer('dropCameraAtPlayer');"; - item[6] = "Place Player at Camera" TAB "Alt W" TAB "commandToServer('DropPlayerAtCamera');"; - item[7] = "-"; - item[8] = "Fit View to Selection" TAB "F" TAB "commandToServer('EditorCameraAutoFit', EWorldEditor.getSelectionRadius()+1);"; - item[9] = "Fit View To Selection and Orbit" TAB "Alt F" TAB "EditorGuiStatusBar.setCamera(\"Orbit Camera\"); commandToServer('EditorCameraAutoFit', EWorldEditor.getSelectionRadius()+1);"; - item[10] = "-"; - item[11] = "Speed" TAB %this.cameraSpeedMenu; - item[12] = "View" TAB %this.viewTypeMenu; - item[13] = "-"; - Item[14] = "Add Bookmark..." TAB "Ctrl B" TAB "EditorGui.addCameraBookmarkByGui();"; - Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();"; - item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu; - }; - %this.menuBar.insert(%cameraMenu); - - // Editors Menu - %editorsMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorToolsMenu"; - - barTitle = "Editors"; - - //item[0] = "Object Editor" TAB "F1" TAB WorldEditorInspectorPlugin; - //item[1] = "Material Editor" TAB "F2" TAB MaterialEditorPlugin; - //item[2] = "-"; - //item[3] = "Terrain Editor" TAB "F3" TAB TerrainEditorPlugin; - //item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin; - //item[5] = "-"; - }; - %this.menuBar.insert(%editorsMenu); - - // Lighting Menu - %lightingMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorLightingMenu"; - - barTitle = "Lighting"; - - item[0] = "Full Relight" TAB "Alt L" TAB "Editor.lightScene(\"\", forceAlways);"; - item[1] = "Toggle ShadowViz" TAB "" TAB "toggleShadowViz();"; - item[2] = "-"; - - // NOTE: The light managers will be inserted as the - // last menu items in EditorLightingMenu::onAdd(). - }; - %this.menuBar.insert(%lightingMenu); - - // Tools Menu - %toolsMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorUtilitiesMenu"; - - barTitle = "Tools"; - - item[0] = "Network Graph" TAB "n" TAB "toggleNetGraph();"; - item[1] = "Profiler" TAB "ctrl F2" TAB "showMetrics(true);"; - item[2] = "Torque SimView" TAB "" TAB "tree();"; - item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();"; - }; - %this.menuBar.insert(%toolsMenu); - - // Help Menu - %helpMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorHelpMenu"; - - barTitle = "Help"; - - item[0] = "Online Documentation..." TAB "Alt F1" TAB "gotoWebPage(EWorldEditor.documentationURL);"; - item[1] = "Offline User Guide..." TAB "" TAB "gotoWebPage(EWorldEditor.documentationLocal);"; - item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);"; - item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);"; - }; - %this.menuBar.insert(%helpMenu); - - // Menus that are added/removed dynamically (temporary) - - // World Menu - if(! isObject(%this.worldMenu)) - { - %this.dropTypeMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorDropTypeMenu"; - - // The onSelectItem() callback for this menu re-purposes the command field - // as the MenuBuilder version is not used. - item[0] = "at Origin" TAB "" TAB "atOrigin"; - item[1] = "at Camera" TAB "" TAB "atCamera"; - item[2] = "at Camera w/Rotation" TAB "" TAB "atCameraRot"; - item[3] = "Below Camera" TAB "" TAB "belowCamera"; - item[4] = "Screen Center" TAB "" TAB "screenCenter"; - item[5] = "at Centroid" TAB "" TAB "atCentroid"; - item[6] = "to Terrain" TAB "" TAB "toTerrain"; - item[7] = "Below Selection" TAB "" TAB "belowSelection"; - item[8] = "At Gizmo" TAB "" TAB "atGizmo"; - }; - - %this.alignBoundsMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorAlignBoundsMenu"; - - // The onSelectItem() callback for this menu re-purposes the command field - // as the MenuBuilder version is not used. - item[0] = "+X Axis" TAB "" TAB "0"; - item[1] = "+Y Axis" TAB "" TAB "1"; - item[2] = "+Z Axis" TAB "" TAB "2"; - item[3] = "-X Axis" TAB "" TAB "3"; - item[4] = "-Y Axis" TAB "" TAB "4"; - item[5] = "-Z Axis" TAB "" TAB "5"; - }; - - %this.alignCenterMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorAlignCenterMenu"; - - // The onSelectItem() callback for this menu re-purposes the command field - // as the MenuBuilder version is not used. - item[0] = "X Axis" TAB "" TAB "0"; - item[1] = "Y Axis" TAB "" TAB "1"; - item[2] = "Z Axis" TAB "" TAB "2"; - }; - - %this.worldMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - class = "EditorWorldMenu"; - - barTitle = "Object"; - - item[0] = "Lock Selection" TAB %cmdCtrl @ " L" TAB "EWorldEditor.lockSelection(true); EWorldEditor.syncGui();"; - item[1] = "Unlock Selection" TAB %cmdCtrl @ "-Shift L" TAB "EWorldEditor.lockSelection(false); EWorldEditor.syncGui();"; - item[2] = "-"; - item[3] = "Hide Selection" TAB %cmdCtrl @ " H" TAB "EWorldEditor.hideSelection(true); EWorldEditor.syncGui();"; - item[4] = "Show Selection" TAB %cmdCtrl @ "-Shift H" TAB "EWorldEditor.hideSelection(false); EWorldEditor.syncGui();"; - item[5] = "-"; - item[6] = "Align Bounds" TAB %this.alignBoundsMenu; - item[7] = "Align Center" TAB %this.alignCenterMenu; - item[8] = "-"; - item[9] = "Reset Transforms" TAB "Ctrl R" TAB "EWorldEditor.resetTransforms();"; - item[10] = "Reset Selected Rotation" TAB "" TAB "EWorldEditor.resetSelectedRotation();"; - item[11] = "Reset Selected Scale" TAB "" TAB "EWorldEditor.resetSelectedScale();"; - item[12] = "Transform Selection..." TAB "Ctrl T" TAB "ETransformSelection.ToggleVisibility();"; - item[13] = "-"; - //item[13] = "Drop Camera to Selection" TAB "Ctrl Q" TAB "EWorldEditor.dropCameraToSelection();"; - //item[14] = "Add Selection to Instant Group" TAB "" TAB "EWorldEditor.addSelectionToAddGroup();"; - item[14] = "Drop Selection" TAB "Ctrl D" TAB "EWorldEditor.dropSelection();"; - //item[15] = "-"; - item[15] = "Drop Location" TAB %this.dropTypeMenu; - Item[16] = "-"; - Item[17] = "Make Selection Prefab" TAB "" TAB "EditorMakePrefab();"; - Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();"; - Item[19] = "-"; - Item[20] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; - Item[21] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; - }; + %gui.setDisplayType( %this.currentDisplayType ); + %gui.setOrthoFOV( %this.currentOrthoFOV ); + EditorGui.syncCameraGui(); } } -////////////////////////////////////////////////////////////////////////// - -function EditorGui::attachMenus(%this) +function EditorGui::syncEditor( %this, %newEditor, %newEditorFailed ) { - %this.menuBar.attachToCanvas(Canvas, 0); + // Sync with menu bar + %menu = %this.findMenu( "Editors" ); + %count = %menu.getItemCount(); + for ( %i = 0; %i < %count; %i++ ) + { + %pluginObj = getField( %menu.item[%i], 2 ); + if ( %pluginObj $= %newEditor ) + { + %menu.checkRadioItem( 0, %count, %i ); + break; + } + } + + // In order to hook up a palette, the word Palette must be able to be + // switched out in order to read correctly, if not, no palette will be used + %paletteName = strreplace(%newEditor, "Plugin", "Palette"); + + // Sync with ToolsToolbar + for ( %i = 0; %i < ToolsToolbarArray.getCount(); %i++ ) + { + %toolbarButton = ToolsToolbarArray.getObject(%i).internalName; + if( %paletteName $= %toolbarButton ) + { + ToolsToolbarArray.getObject(%i).setStateOn(1); + break; + } + } + + // Handles quit game and gui editor changes in wierd scenarios + if( %newEditorFailed && EWToolsToolbar.isDynamic ) + { + if( EWToolsToolbar.isClosed ) + EWToolsToolbar.reset(); + EWToolsToolbar.toggleSize(); + } + + // Toggle the editor specific palette; we define special cases here + switch$ ( %paletteName ) + { + case "MaterialEditorPalette": + %paletteName = "WorldEditorInspectorPalette"; + case "DatablockEditorPalette": + %paletteName = "WorldEditorInspectorPalette"; + case "ParticleEditorPalette": + %paletteName = "WorldEditorInspectorPalette"; + } + + %this-->ToolsPaletteWindow.togglePalette(%paletteName); } -function EditorGui::detachMenus(%this) +function EditorGui::onWake( %this ) { + EHWorldEditor.setStateOn( 1 ); + + // Notify the editor plugins that the editor has started. + + foreach( %plugin in EditorPluginSet ) + %plugin.onEditorWake(); + + // Push the ActionMaps in the order that we want to have them + // before activating an editor plugin, so that if the plugin + // installs an ActionMap, it will be highest on the stack. + + MoveMap.push(); + EditorMap.push(); + + // Active the current editor plugin. + + if( !%this.currentEditor.isActivated ) + %this.currentEditor.onActivated(); + + %slashPos = 0; + while( strpos( $Server::MissionFile, "/", %slashPos ) != -1 ) + { + %slashPos = strpos( $Server::MissionFile, "/", %slashPos ) + 1; + } + %levelName = getSubStr( $Server::MissionFile , %slashPos , 99 ); + + if( %levelName !$= %this.levelName ) + %this.onNewLevelLoaded( %levelName ); +} + +function EditorGui::onSleep( %this ) +{ + // Deactivate the current editor plugin. + + if( %this.currentEditor.isActivated ) + %this.currentEditor.onDeactivated(); + + // Remove the editor's ActionMaps. + + EditorMap.pop(); + MoveMap.pop(); + + // Notify the editor plugins that the editor will be closing. + + foreach( %plugin in EditorPluginSet ) + %plugin.onEditorSleep(); + + if(isObject($Server::CurrentScene)) + $Server::CurrentScene.open(); +} + +function EditorGui::onNewLevelLoaded( %this, %levelName ) +{ + %this.levelName = %levelName; + %this.setupDefaultCameraSettings(); + ECameraSettingsPage.init(); + EditorCameraSpeedOptions.setupDefaultState(); + + new ScriptObject( EditorMissionCleanup ) + { + parentGroup = "MissionCleanup"; + }; +} + +function EditorMissionCleanup::onRemove( %this ) +{ + EditorGui.levelName = ""; + foreach( %plugin in EditorPluginSet ) + %plugin.onExitMission(); +} + +//----------------------------------------------------------------------------- + +// Called when we have been set as the content and onWake has been called +function EditorGui::onSetContent(%this, %oldContent) +{ + %this.attachMenus(); +} + +// Called before onSleep when the canvas content is changed +function EditorGui::onUnsetContent(%this, %newContent) +{ + %this.detachMenus(); +} + +//------------------------------------------------------------------------------ + +function EditorGui::toggleSFXParametersWindow( %this ) +{ + %window = %this-->ManageSFXParametersWindow; + %window.setVisible( !%window.isVisible() ); +} + +//------------------------------------------------------------------------------ + +function EditorGui::addCameraBookmark( %this, %name ) +{ + %obj = new CameraBookmark() { + datablock = CameraBookmarkMarker; + internalName = %name; + }; + + // Place into correct group + if( !isObject(CameraBookmarks) ) + { + %grp = new SimGroup(CameraBookmarks); + MissionGroup.add(%grp); + } + CameraBookmarks.add( %obj ); + + %cam = LocalClientConnection.camera.getTransform(); + %obj.setTransform( %cam ); + + EWorldEditor.isDirty = true; + EditorTree.buildVisibleTree(true); +} + +function EditorGui::removeCameraBookmark( %this, %name ) +{ + if( !isObject(CameraBookmarks) ) + return; + + %mark = CameraBookmarks.findObjectByInternalName( %name, true ); + if( %mark == 0 ) + return; + + MEDeleteUndoAction::submit( %mark ); + EWorldEditor.isDirty = true; + EditorTree.buildVisibleTree(true); +} + +function EditorGui::removeCameraBookmarkIndex( %this, %index ) +{ + if( !isObject(CameraBookmarks) ) + return; + + if( %index < 0 || %index >= CameraBookmarks.getCount() ) + return; + + %obj = CameraBookmarks.getObject( %index ); + MEDeleteUndoAction::submit( %obj ); + EWorldEditor.isDirty = true; + EditorTree.buildVisibleTree(true); +} + +function EditorGui::jumpToBookmark( %this, %name ) +{ + if( !isObject(CameraBookmarks) ) + return; + + %mark = CameraBookmarks.findObjectByInternalName( %name, true ); + if( %mark == 0 ) + return; + + LocalClientConnection.camera.setTransform( %mark.getTransform() ); + return; +} + +function EditorGui::jumpToBookmarkIndex( %this, %index ) +{ + if( !isObject(CameraBookmarks) ) + return; + + if( %index < 0 || %index >= CameraBookmarks.getCount() ) + return; + + %trans = CameraBookmarks.getObject( %index ).getTransform(); + LocalClientConnection.camera.setTransform( %trans ); +} + +function EditorGui::addCameraBookmarkByGui( %this ) +{ + // look for a NewCamera name to grab + for(%i = 0; ; %i++){ + %name = "NewCamera_" @ %i; + if( !CameraBookmarks.findObjectByInternalName(%name) ){ + break; + } + } + EditorGui.addCameraBookmark( %name ); +} + +function EditorGui::toggleCameraBookmarkWindow( %this ) +{ + EManageBookmarks.ToggleVisibility(); +} + +function EditorGui::toggleObjectSelectionsWindow( %this ) +{ + ESelectObjectsWindow.toggleVisibility(); +} + +function EditorGui::toggleOrthoGrid( %this ) +{ + EWorldEditor.renderOrthoGrid = !EWorldEditor.renderOrthoGrid; +} + +//------------------------------------------------------------------------------ + +function EditorGui::syncCameraGui( %this ) +{ + if( !EditorIsActive() ) + return; + + // Sync projection type + %displayType = %this.currentEditor.editorGui.getDisplayType(); + %this.viewTypeMenu.checkRadioItem( 0, 7, %displayType ); + + // Set the camera object's mode and rotation so that it moves correctly + // based on the current editor mode + if( %displayType != $EditTSCtrl::DisplayTypePerspective ) + { + switch( %displayType ) + { + case $EditTSCtrl::DisplayTypeTop: %name = "Top View"; %camRot = "0 0 0"; + case $EditTSCtrl::DisplayTypeBottom: %name = "Bottom View"; %camRot = "3.14159 0 0"; + case $EditTSCtrl::DisplayTypeLeft: %name = "Left View"; %camRot = "-1.571 0 1.571"; + case $EditTSCtrl::DisplayTypeRight: %name = "Right View"; %camRot = "-1.571 0 -1.571"; + case $EditTSCtrl::DisplayTypeFront: %name = "Front View"; %camRot = "-1.571 0 3.14159"; + case $EditTSCtrl::DisplayTypeBack: %name = "Back View"; %camRot = "-1.571 0 0"; + case $EditTSCtrl::DisplayTypeIsometric: %name = "Isometric View"; %camRot = "0 0 0"; + } + + LocalClientConnection.camera.controlMode = "Fly"; + LocalClientConnection.camera.setRotation( %camRot ); + EditorGuiStatusBar.setCamera( %name ); + return; + } + + // Sync camera settings. + %flyModeRadioItem = -1; + if(LocalClientConnection.getControlObject() != LocalClientConnection.player) + { + %mode = LocalClientConnection.camera.getMode(); + + if(%mode $= "Fly" && LocalClientConnection.camera.newtonMode) + { + if(LocalClientConnection.camera.newtonRotation == true) + { + EditorGui-->NewtonianRotationCamera.setStateOn(true); + EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/smooth-cam-rot"); + %flyModeRadioItem = 4; + EditorGuiStatusBar.setCamera("Smooth Rot Camera"); + } + else + { + EditorGui-->NewtonianCamera.setStateOn(true); + EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/smooth-cam"); + %flyModeRadioItem = 3; + EditorGuiStatusBar.setCamera("Smooth Camera"); + } + } + else if(%mode $= "EditOrbit") + { + EditorGui-->OrbitCamera.setStateOn(true); + EWorldEditorToggleCamera.setBitmap("tools/gui/images/menubar/orbit-cam"); + %flyModeRadioItem = 1; + EditorGuiStatusBar.setCamera("Orbit Camera"); + } + else // default camera mode + { + EditorGui-->StandardCamera.setStateOn(true); + EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/camera"); + %flyModeRadioItem = 0; + EditorGuiStatusBar.setCamera("Standard Camera"); + } + + //quick way select menu bar options + %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 0 ); + EditorFreeCameraTypeOptions.checkRadioItem( 0, 4, %flyModeRadioItem); + EditorPlayerCameraTypeOptions.checkRadioItem( 0, 4, -1); + } + else if (!$isFirstPersonVar) // if 3rd person + { + EditorGui-->trdPersonCamera.setStateOn(true); + EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/3rd-person-camera"); + %flyModeRadioItem = 1; + //quick way select menu bar options + %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 1 ); + EditorPlayerCameraTypeOptions.checkRadioItem( 0, 2, %flyModeRadioItem); + EditorGuiStatusBar.setCamera("3rd Person Camera"); + } + else if ($isFirstPersonVar) // if 1st Person + { + EditorGui-->PlayerCamera.setStateOn(true); + EWorldEditorToggleCamera.setBitmap("tools/worldEditor/images/toolbar/player"); + %flyModeRadioItem = 0; + //quick way select menu bar options + %this.findMenu( "Camera" ).checkRadioItem( 0, 1, 1 ); + EditorPlayerCameraTypeOptions.checkRadioItem( 0, 2, %flyModeRadioItem); + EditorFreeCameraTypeOptions.checkRadioItem( 0, 4, -1); + EditorGuiStatusBar.setCamera("1st Person Camera"); + } + } + +/// @name EditorPlugin Methods +/// @{ + +//------------------------------------------------------------------------------ +// WorldEditorPlugin +//------------------------------------------------------------------------------ + +function WorldEditorPlugin::onActivated( %this ) +{ + EditorGui.bringToFront( EWorldEditor ); + EWorldEditor.setVisible(true); + EditorGui.menuBar.insert( EditorGui.worldMenu, EditorGui.menuBar.dynamicItemInsertPos ); + EWorldEditor.makeFirstResponder(true); + EditorTree.open(MissionGroup,true); + EWCreatorWindow.setNewObjectGroup(MissionGroup); + + EWorldEditor.syncGui(); + + EditorGuiStatusBar.setSelectionObjectsByCount(EWorldEditor.getSelectionSize()); + + // Should the Transform Selection window open? + if( EWorldEditor.ETransformSelectionDisplayed ) + { + ETransformSelection.setVisible(true); + } + + Parent::onActivated(%this); +} + +function WorldEditorPlugin::onDeactivated( %this ) +{ + // Hide the Transform Selection window from other editors + ETransformSelection.setVisible(false); + + EWorldEditor.setVisible( false ); + EditorGui.menuBar.remove( EditorGui.worldMenu ); + + Parent::onDeactivated(%this); +} + +//------------------------------------------------------------------------------ +// WorldEditorInspectorPlugin +//------------------------------------------------------------------------------ + +function WorldEditorInspectorPlugin::onWorldEditorStartup( %this ) +{ + Parent::onWorldEditorStartup( %this ); + + // Add ourselves to the window menu. + %accel = EditorGui.addToEditorsMenu( "Object Editor", "", WorldEditorInspectorPlugin ); + + // Add ourselves to the ToolsToolbar + %tooltip = "Object Editor (" @ %accel @ ")"; + EditorGui.addToToolsToolbar( "WorldEditorInspectorPlugin", "WorldEditorInspectorPalette", expandFilename("tools/worldEditor/images/toolbar/transform-objects"), %tooltip ); + + //connect editor windows + GuiWindowCtrl::attach( EWInspectorWindow, EWTreeWindow); + + %map = new ActionMap(); + %map.bindCmd( keyboard, "1", "EWorldEditorNoneModeBtn.performClick();", "" ); // Select + %map.bindCmd( keyboard, "2", "EWorldEditorMoveModeBtn.performClick();", "" ); // Move + %map.bindCmd( keyboard, "3", "EWorldEditorRotateModeBtn.performClick();", "" ); // Rotate + %map.bindCmd( keyboard, "4", "EWorldEditorScaleModeBtn.performClick();", "" ); // Scale + %map.bindCmd( keyboard, "f", "FitToSelectionBtn.performClick();", "" );// Fit Camera to Selection + %map.bindCmd( keyboard, "z", "EditorGuiStatusBar.setCamera(\"Standard Camera\");", "" );// Free camera + %map.bindCmd( keyboard, "n", "ToggleNodeBar->renderHandleBtn.performClick();", "" );// Render Node + %map.bindCmd( keyboard, "shift n", "ToggleNodeBar->renderTextBtn.performClick();", "" );// Render Node Text + %map.bindCmd( keyboard, "g", "ESnapOptions-->GridSnapButton.performClick();" ); // Grid Snappping + %map.bindCmd( keyboard, "t", "SnapToBar->objectSnapDownBtn.performClick();", "" );// Terrain Snapping + %map.bindCmd( keyboard, "b", "SnapToBar-->objectSnapBtn.performClick();" ); // Soft Snappping + %map.bindCmd( keyboard, "v", "EWorldEditorToolbar->boundingBoxColBtn.performClick();", "" );// Bounds Selection + %map.bindCmd( keyboard, "o", "objectCenterDropdown->objectBoxBtn.performClick(); objectCenterDropdown.toggle();", "" );// Object Center + %map.bindCmd( keyboard, "p", "objectCenterDropdown->objectBoundsBtn.performClick(); objectCenterDropdown.toggle();", "" );// Bounds Center + %map.bindCmd( keyboard, "k", "objectTransformDropdown->objectTransformBtn.performClick(); objectTransformDropdown.toggle();", "" );// Object Transform + %map.bindCmd( keyboard, "l", "objectTransformDropdown->worldTransformBtn.performClick(); objectTransformDropdown.toggle();", "" );// World Transform + + WorldEditorInspectorPlugin.map = %map; +} + +function WorldEditorInspectorPlugin::onActivated( %this ) +{ + Parent::onActivated( %this ); + + EditorGui-->InspectorWindow.setVisible( true ); + EditorGui-->TreeWindow.setVisible( true ); + EditorGui-->WorldEditorToolbar.setVisible( true ); + %this.map.push(); +} + +function WorldEditorInspectorPlugin::onDeactivated( %this ) +{ + Parent::onDeactivated( %this ); + + EditorGui-->InspectorWindow.setVisible( false ); + EditorGui-->TreeWindow.setVisible( false ); + EditorGui-->WorldEditorToolbar.setVisible( false ); + %this.map.pop(); +} + +function WorldEditorInspectorPlugin::onEditMenuSelect( %this, %editMenu ) +{ + %canCutCopy = EWorldEditor.getSelectionSize() > 0; + %editMenu.enableItem( 3, %canCutCopy ); // Cut + %editMenu.enableItem( 4, %canCutCopy ); // Copy + %editMenu.enableItem( 5, EWorldEditor.canPasteSelection() ); // Paste + + %selSize = EWorldEditor.getSelectionSize(); + %lockCount = EWorldEditor.getSelectionLockCount(); + %hideCount = EWorldEditor.getSelectionHiddenCount(); + %editMenu.enableItem( 6, %selSize > 0 && %lockCount != %selSize ); // Delete Selection + + %editMenu.enableItem( 8, %canCutCopy ); // Deselect +} + +function WorldEditorInspectorPlugin::handleDelete( %this ) +{ + // The tree handles deletion and notifies the + // world editor to clear its selection. + // + // This is because non-SceneObject elements like + // SimGroups also need to be destroyed. + // + // See EditorTree::onObjectDeleteCompleted(). + %selSize = EWorldEditor.getSelectionSize(); + if( %selSize > 0 ) + EditorTree.deleteSelection(); +} + +function WorldEditorInspectorPlugin::handleDeselect() +{ + EWorldEditor.clearSelection(); +} + +function WorldEditorInspectorPlugin::handleCut() +{ + EWorldEditor.cutSelection(); +} + +function WorldEditorInspectorPlugin::handleCopy() +{ + EWorldEditor.copySelection(); +} + +function WorldEditorInspectorPlugin::handlePaste() +{ + EWorldEditor.pasteSelection(); +} + +//------------------------------------------------------------------------------ +// TerrainEditorPlugin +//------------------------------------------------------------------------------ + +function TerrainEditorPlugin::onWorldEditorStartup( %this ) +{ + Parent::onWorldEditorStartup( %this ); + + // Add ourselves to the window menu. + %accel = EditorGui.addToEditorsMenu( "Terrain Editor", "", TerrainEditorPlugin ); + + // Add ourselves to the ToolsToolbar + %tooltip = "Terrain Editor (" @ %accel @ ")"; + EditorGui.addToToolsToolbar( "TerrainEditorPlugin", "TerrainEditorPalette", expandFilename("tools/worldEditor/images/toolbar/sculpt-terrain"), %tooltip ); + + %map = new ActionMap(); + %map.bindCmd( keyboard, "1", "ToolsPaletteArray->brushAdjustHeight.performClick();", "" ); //Grab Terrain + %map.bindCmd( keyboard, "2", "ToolsPaletteArray->raiseHeight.performClick();", "" ); // Raise Height + %map.bindCmd( keyboard, "3", "ToolsPaletteArray->lowerHeight.performClick();", "" ); // Lower Height + %map.bindCmd( keyboard, "4", "ToolsPaletteArray->smoothHeight.performClick();", "" ); // Average Height + %map.bindCmd( keyboard, "5", "ToolsPaletteArray->smoothSlope.performClick();", "" ); // Smooth Slope + %map.bindCmd( keyboard, "6", "ToolsPaletteArray->paintNoise.performClick();", "" ); // Noise + %map.bindCmd( keyboard, "7", "ToolsPaletteArray->flattenHeight.performClick();", "" ); // Flatten + %map.bindCmd( keyboard, "8", "ToolsPaletteArray->setHeight.performClick();", "" ); // Set Height + %map.bindCmd( keyboard, "9", "ToolsPaletteArray->setEmpty.performClick();", "" ); // Clear Terrain + %map.bindCmd( keyboard, "0", "ToolsPaletteArray->clearEmpty.performClick();", "" ); // Restore Terrain + %map.bindCmd( keyboard, "v", "EWTerrainEditToolbarBrushType->ellipse.performClick();", "" );// Circle Brush + %map.bindCmd( keyboard, "b", "EWTerrainEditToolbarBrushType->box.performClick();", "" );// Box Brush + %map.bindCmd( keyboard, "=", "TerrainEditorPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size + %map.bindCmd( keyboard, "+", "TerrainEditorPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size + %map.bindCmd( keyboard, "-", "TerrainEditorPlugin.keyboardModifyBrushSize(-1);", "" );// -1 Brush Size + %map.bindCmd( keyboard, "[", "TerrainEditorPlugin.keyboardModifyBrushSize(-5);", "" );// -5 Brush Size + %map.bindCmd( keyboard, "]", "TerrainEditorPlugin.keyboardModifyBrushSize(5);", "" );// +5 Brush Size + /*%map.bindCmd( keyboard, "]", "TerrainBrushPressureTextEditContainer->textEdit.text += 5", "" );// +5 Pressure + %map.bindCmd( keyboard, "[", "TerrainBrushPressureTextEditContainer->textEdit.text -= 5", "" );// -5 Pressure + %map.bindCmd( keyboard, "'", "TerrainBrushSoftnessTextEditContainer->textEdit.text += 5", "" );// +5 Softness + %map.bindCmd( keyboard, ";", "TerrainBrushSoftnessTextEditContainer->textEdit.text -= 5", "" );// -5 Softness*/ + + TerrainEditorPlugin.map = %map; + + %this.terrainMenu = new PopupMenu() + { + superClass = "MenuBuilder"; + + barTitle = "Terrain"; + + item[0] = "Smooth Heightmap" TAB "" TAB "ETerrainEditor.onSmoothHeightmap();"; + }; +} + +function TerrainEditorPlugin::onActivated( %this ) +{ + Parent::onActivated( %this ); + + EditorGui.readTerrainEditorSettings(); + + %action = EditorSettings.value("TerrainEditor/currentAction"); + ETerrainEditor.switchAction( %action ); + ToolsPaletteArray.findObjectByInternalName( %action, true ).setStateOn( true ); + + EWTerrainEditToolbarBrushType->ellipse.performClick(); // Circle Brush + + EditorGui.menuBar.insert( %this.terrainMenu, EditorGui.menuBar.dynamicItemInsertPos ); + + EditorGui.bringToFront( ETerrainEditor ); + ETerrainEditor.setVisible( true ); + ETerrainEditor.attachTerrain(); + ETerrainEditor.makeFirstResponder( true ); + + EWTerrainEditToolbar.setVisible( true ); + ETerrainEditor.onBrushChanged(); + ETerrainEditor.setup(); + TerrainEditorPlugin.syncBrushInfo(); + + EditorGuiStatusBar.setSelection(""); + %this.map.push(); +} + +function TerrainEditorPlugin::onDeactivated( %this ) +{ + Parent::onDeactivated( %this ); + + endToolTime("TerrainEditor"); + EditorGui.writeTerrainEditorSettings(); + + EWTerrainEditToolbar.setVisible( false ); + ETerrainEditor.setVisible( false ); + + EditorGui.menuBar.remove( %this.terrainMenu ); + + %this.map.pop(); +} + +function TerrainEditorPlugin::syncBrushInfo( %this ) +{ + // Update gui brush info + TerrainBrushSizeTextEditContainer-->textEdit.text = getWord(ETerrainEditor.getBrushSize(), 0); + TerrainBrushPressureTextEditContainer-->textEdit.text = ETerrainEditor.getBrushPressure()*100; + TerrainBrushSoftnessTextEditContainer-->textEdit.text = ETerrainEditor.getBrushSoftness()*100; + TerrainSetHeightTextEditContainer-->textEdit.text = ETerrainEditor.setHeightVal; + + %brushType = ETerrainEditor.getBrushType(); + eval( "EWTerrainEditToolbar-->" @ %brushType @ ".setStateOn(1);" ); +} + +function TerrainEditorPlugin::validateBrushSize( %this ) +{ + %minBrushSize = 1; + %maxBrushSize = getWord(ETerrainEditor.maxBrushSize, 0); + + %val = $ThisControl.getText(); + if(%val < %minBrushSize) + $ThisControl.setValue(%minBrushSize); + else if(%val > %maxBrushSize) + $ThisControl.setValue(%maxBrushSize); +} + +function TerrainEditorPlugin::keyboardModifyBrushSize( %this, %amt) +{ + %val = TerrainBrushSizeTextEditContainer-->textEdit.getText(); + %val += %amt; + TerrainBrushSizeTextEditContainer-->textEdit.setValue(%val); + TerrainBrushSizeTextEditContainer-->textEdit.forceValidateText(); + ETerrainEditor.setBrushSize( TerrainBrushSizeTextEditContainer-->textEdit.getText() ); +} + +//------------------------------------------------------------------------------ +// TerrainTextureEditorTool +//------------------------------------------------------------------------------ + +function TerrainTextureEditorTool::onActivated( %this ) +{ + EditorGui.bringToFront( ETerrainEditor ); + ETerrainEditor.setVisible( true ); + ETerrainEditor.attachTerrain(); + ETerrainEditor.makeFirstResponder( true ); + + EditorGui-->TextureEditor.setVisible(true); + + EditorGuiStatusBar.setSelection(""); +} + +function TerrainTextureEditorTool::onDeactivated( %this ) +{ + EditorGui-->TextureEditor.setVisible(false); + + ETerrainEditor.setVisible( false ); +} + +//------------------------------------------------------------------------------ +// TerrainPainterPlugin +//------------------------------------------------------------------------------ + +function TerrainPainterPlugin::onWorldEditorStartup( %this ) +{ + Parent::onWorldEditorStartup( %this ); + + // Add ourselves to the window menu. + %accel = EditorGui.addToEditorsMenu( "Terrain Painter", "", TerrainPainterPlugin ); + + // Add ourselves to the ToolsToolbar + %tooltip = "Terrain Painter (" @ %accel @ ")"; + EditorGui.addToToolsToolbar( "TerrainPainterPlugin", "TerrainPainterPalette", expandFilename("tools/worldEditor/images/toolbar/paint-terrain"), %tooltip ); + + %map = new ActionMap(); + %map.bindCmd( keyboard, "v", "EWTerrainPainterToolbarBrushType->ellipse.performClick();", "" );// Circle Brush + %map.bindCmd( keyboard, "b", "EWTerrainPainterToolbarBrushType->box.performClick();", "" );// Box Brush + %map.bindCmd( keyboard, "=", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size + %map.bindCmd( keyboard, "+", "TerrainPainterPlugin.keyboardModifyBrushSize(1);", "" );// +1 Brush Size + %map.bindCmd( keyboard, "-", "TerrainPainterPlugin.keyboardModifyBrushSize(-1);", "" );// -1 Brush Size + %map.bindCmd( keyboard, "[", "TerrainPainterPlugin.keyboardModifyBrushSize(-5);", "" );// -5 Brush Size + %map.bindCmd( keyboard, "]", "TerrainPainterPlugin.keyboardModifyBrushSize(5);", "" );// +5 Brush Size + /*%map.bindCmd( keyboard, "]", "PaintBrushSlopeControl->SlopeMinAngle.text += 5", "" );// +5 SlopeMinAngle + %map.bindCmd( keyboard, "[", "PaintBrushSlopeControl->SlopeMinAngle.text -= 5", "" );// -5 SlopeMinAngle + %map.bindCmd( keyboard, "'", "PaintBrushSlopeControl->SlopeMaxAngle.text += 5", "" );// +5 SlopeMaxAngle + %map.bindCmd( keyboard, ";", "PaintBrushSlopeControl->SlopeMaxAngle.text -= 5", "" );// -5 Softness*/ + + for(%i=1; %i<10; %i++) + { + %map.bindCmd( keyboard, %i, "TerrainPainterPlugin.keyboardSetMaterial(" @ (%i-1) @ ");", "" ); + } + %map.bindCmd( keyboard, 0, "TerrainPainterPlugin.keyboardSetMaterial(10);", "" ); + + TerrainPainterPlugin.map = %map; + GuiWindowCtrl::attach( EPainter, EPainterPreview); +} + +function TerrainPainterPlugin::onActivated( %this ) +{ + Parent::onActivated( %this ); + + EditorGui.readTerrainEditorSettings(); + + EWTerrainPainterToolbarBrushType->ellipse.performClick();// Circle Brush + %this.map.push(); + + EditorGui.bringToFront( ETerrainEditor ); + ETerrainEditor.setVisible( true ); + ETerrainEditor.attachTerrain(); + ETerrainEditor.makeFirstResponder( true ); + + EditorGui-->TerrainPainter.setVisible(true); + EditorGui-->TerrainPainterPreview.setVisible(true); + EWTerrainPainterToolbar.setVisible(true); + ETerrainEditor.onBrushChanged(); + EPainter.setup(); + TerrainPainterPlugin.syncBrushInfo(); + + EditorGuiStatusBar.setSelection(""); +} + +function TerrainPainterPlugin::onDeactivated( %this ) +{ + Parent::onDeactivated( %this ); + + EditorGui.writeTerrainEditorSettings(); + + %this.map.pop(); + EditorGui-->TerrainPainter.setVisible(false); + EditorGui-->TerrainPainterPreview.setVisible(false); + EWTerrainPainterToolbar.setVisible(false); + ETerrainEditor.setVisible( false ); +} + +function TerrainPainterPlugin::syncBrushInfo( %this ) +{ + // Update gui brush info + PaintBrushSizeTextEditContainer-->textEdit.text = getWord(ETerrainEditor.getBrushSize(), 0); + PaintBrushSlopeControl-->SlopeMinAngle.text = ETerrainEditor.getSlopeLimitMinAngle(); + PaintBrushSlopeControl-->SlopeMaxAngle.text = ETerrainEditor.getSlopeLimitMaxAngle(); + PaintBrushPressureTextEditContainer-->textEdit.text = ETerrainEditor.getBrushPressure()*100; + %brushType = ETerrainEditor.getBrushType(); + eval( "EWTerrainPainterToolbar-->" @ %brushType @ ".setStateOn(1);" ); +} + +function TerrainPainterPlugin::validateBrushSize( %this ) +{ + %minBrushSize = 1; + %maxBrushSize = getWord(ETerrainEditor.maxBrushSize, 0); + + %val = $ThisControl.getText(); + if(%val < %minBrushSize) + $ThisControl.setValue(%minBrushSize); + else if(%val > %maxBrushSize) + $ThisControl.setValue(%maxBrushSize); +} + +function TerrainPainterPlugin::validateSlopeMaxAngle( %this ) +{ + %maxval = ETerrainEditor.getSlopeLimitMaxAngle(); + PaintBrushSlopeControl-->SlopeMaxAngle.setText(%maxval); +} + +function TerrainPainterPlugin::validateSlopeMinAngle( %this ) +{ + %minval = ETerrainEditor.getSlopeLimitMinAngle(); + PaintBrushSlopeControl-->SlopeMinAngle.setText(%minval); +} + +function TerrainPainterPlugin::keyboardModifyBrushSize( %this, %amt) +{ + %val = PaintBrushSizeTextEditContainer-->textEdit.getText(); + %val += %amt; + PaintBrushSizeTextEditContainer-->textEdit.setValue(%val); + PaintBrushSizeTextEditContainer-->textEdit.forceValidateText(); + ETerrainEditor.setBrushSize( PaintBrushSizeTextEditContainer-->textEdit.getText() ); +} + +function TerrainPainterPlugin::keyboardSetMaterial( %this, %mat) +{ + %name = "EPainterMaterialButton" @ %mat; + %ctrl = EPainter.findObjectByInternalName(%name, true); + if(%ctrl) + { + %ctrl.performClick(); + } +} + +/// @} End of EditorPlugin Methods + + +function objectTransformDropdown::toggle() +{ + if ( objectTransformDropdown.visible ) + { + EWorldEditorToolbar-->objectTransform.setStateOn(false); + objectTransformDropdownDecoy.setVisible(false); + objectTransformDropdownDecoy.setActive(false); + objectTransformDropdown.setVisible(false); + } + else + { + EWorldEditorToolbar-->objectTransform.setStateOn(true); + objectTransformDropdown.setVisible(true); + objectTransformDropdownDecoy.setActive(true); + objectTransformDropdownDecoy.setVisible(true); + } +} + +function CameraTypesDropdownToggle() +{ + if ( CameraTypesDropdown.visible ) + { + EWorldEditorToggleCamera.setStateOn(0); + CameraTypesDropdownDecoy.setVisible(false); + CameraTypesDropdownDecoy.setActive(false); + CameraTypesDropdown.setVisible(false); + } + else + { + CameraTypesDropdown.setVisible(true); + CameraTypesDropdownDecoy.setVisible(true); + CameraTypesDropdownDecoy.setActive(true); + EWorldEditorToggleCamera.setStateOn(1); + } +} + +function VisibilityDropdownToggle() +{ + if ( EVisibility.visible ) + { + EVisibility.setVisible(false); + visibilityToggleBtn.setStateOn(0); + } + else + { + EVisibility.setVisible(true); + visibilityToggleBtn.setStateOn(1); + } +} + +function CameraTypesDropdownDecoy::onMouseLeave() +{ + CameraTypesDropdownToggle(); +} + +//----------------------------------------------------------------------------- + +function EWorldEditor::getGridSnap( %this ) +{ + return %this.gridSnap; +} + +function EWorldEditor::setGridSnap( %this, %value ) +{ + %this.gridSnap = %value; + GlobalGizmoProfile.snapToGrid = %value; + %this.syncGui(); +} + +function EWorldEditor::getGridSize( %this ) +{ + return %this.gridSize; +} + +function EWorldEditor::setGridSize( %this, %value ) +{ + GlobalGizmoProfile.gridSize = %value SPC %value SPC %value; + %this.gridSize = %value; + + %this.syncGui(); +} + +//----------------------------------------------------------------------------- + +function EWorldEditor::areAllSelectedObjectsOfType( %this, %className ) +{ + %activeSelection = %this.getActiveSelection(); + if( !isObject( %activeSelection ) ) + return false; + + %count = %activeSelection.getCount(); + for( %i = 0; %i < %count; %i ++ ) + { + %obj = %activeSelection.getObject( %i ); + if( !%obj.isMemberOfClass( %className ) ) + return false; + } + + return true; +} + +//----------------------------------------------------------------------------- +function EWorldEditorToggleCamera::toggleBitmap(%this) +{ + %currentImage = %this.bitmap; + + if ( %currentImage $= "tools/worldEditor/images/toolbar/player" ) + %image = "tools/worldEditor/images/toolbar/camera"; + else + %image = "tools/worldEditor/images/toolbar/player"; + + %this.setBitmap( %image ); +} + +function EWorldEditorCameraSpeed::updateMenuBar(%this, %editorBarCtrl) +{ + // Update Toolbar TextEdit + if( %editorBarCtrl.getId() == CameraSpeedDropdownCtrlContainer-->slider.getId() ) + { + %value = %editorBarCtrl.getValue(); + EWorldEditorCameraSpeed.setText( %value ); + $Camera::movementSpeed = %value; + } + + // Update Toolbar Slider + if( %editorBarCtrl.getId() == EWorldEditorCameraSpeed.getId() ) + { + %value = %editorBarCtrl.getText(); + if ( %value !$= "" ) + { + if ( %value <= 0 ) // camera speed must be >= 0 + { + %value = 1; + %editorBarCtrl.setText( %value ); + } + CameraSpeedDropdownCtrlContainer-->slider.setValue( %value ); + $Camera::movementSpeed = %value; + } + } + + // Update Editor + EditorCameraSpeedOptions.checkRadioItem(0, 6, -1); +} + +//----------------------------------------------------------------------------- + +function EWorldEditorAlignPopup::onSelect(%this, %id, %text) +{ + if ( GlobalGizmoProfile.mode $= "Scale" && %text $= "World" ) + { + EWorldEditorAlignPopup.setSelected(1); + return; + } + + GlobalGizmoProfile.alignment = %text; +} + +//----------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- + +function EWorldEditorNoneModeBtn::onClick(%this) +{ + GlobalGizmoProfile.mode = "None"; + + EditorGuiStatusBar.setInfo("Selection arrow."); +} + +function EWorldEditorMoveModeBtn::onClick(%this) +{ + GlobalGizmoProfile.mode = "Move"; + + %cmdCtrl = "CTRL"; + if( $platform $= "macos" ) + %cmdCtrl = "CMD"; + + EditorGuiStatusBar.setInfo( "Move selection. SHIFT while dragging duplicates objects. " @ %cmdCtrl @ " to toggle soft snap. ALT to toggle grid snap." ); +} + +function EWorldEditorRotateModeBtn::onClick(%this) +{ + GlobalGizmoProfile.mode = "Rotate"; + + EditorGuiStatusBar.setInfo("Rotate selection."); +} + +function EWorldEditorScaleModeBtn::onClick(%this) +{ + GlobalGizmoProfile.mode = "Scale"; + + EditorGuiStatusBar.setInfo("Scale selection."); +} + +//----------------------------------------------------------------------------- + +function EditorTree::onDeleteSelection( %this ) +{ + %this.undoDeleteList = ""; +} + +function EditorTree::onDeleteObject( %this, %object ) +{ + // Don't delete locked objects + if( %object.locked ) + return true; + + if( %object == EWCreatorWindow.objectGroup ) + EWCreatorWindow.setNewObjectGroup( MissionGroup ); + + // Append it to our list. + %this.undoDeleteList = %this.undoDeleteList TAB %object; + + // We're gonna delete this ourselves in the + // completion callback. + return true; +} + +function EditorTree::onObjectDeleteCompleted( %this ) +{ + // This can be called when a deletion is attempted but nothing was + // actually deleted ( cannot delete the root of the tree ) so only submit + // the undo if we really deleted something. + if ( %this.undoDeleteList !$= "" ) + MEDeleteUndoAction::submit( %this.undoDeleteList ); + + // Let the world editor know to + // clear its selection. + EWorldEditor.clearSelection(); + EWorldEditor.isDirty = true; +} + +function EditorTree::onClearSelected(%this) +{ + WorldEditor.clearSelection(); +} + +function EditorTree::onInspect(%this, %obj) +{ + Inspector.inspect(%obj); +} + +function EditorTree::toggleLock( %this ) +{ + if( EWTreeWindow-->LockSelection.command $= "EWorldEditor.lockSelection(true); EditorTree.toggleLock();" ) + { + EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();"; + EWTreeWindow-->DeleteSelection.command = ""; + } + else + { + EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();"; + EWTreeWindow-->DeleteSelection.command = "EditorMenuEditDelete();"; + } +} + +function EditorTree::onAddSelection(%this, %obj, %isLastSelection) +{ + EWorldEditor.selectObject( %obj ); + + %selSize = EWorldEditor.getSelectionSize(); + %lockCount = EWorldEditor.getSelectionLockCount(); + + if( %lockCount < %selSize ) + { + EWTreeWindow-->LockSelection.setStateOn(0); + EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(true); EditorTree.toggleLock();"; + } + else if ( %lockCount > 0 ) + { + EWTreeWindow-->LockSelection.setStateOn(1); + EWTreeWindow-->LockSelection.command = "EWorldEditor.lockSelection(false); EditorTree.toggleLock();"; + } + + if( %selSize > 0 && %lockCount == 0 ) + EWTreeWindow-->DeleteSelection.command = "EditorMenuEditDelete();"; + else + EWTreeWindow-->DeleteSelection.command = ""; + + if( %isLastSelection ) + Inspector.addInspect( %obj ); + else + Inspector.addInspect( %obj, false ); + +} +function EditorTree::onRemoveSelection(%this, %obj) +{ + EWorldEditor.unselectObject(%obj); + Inspector.removeInspect( %obj ); +} +function EditorTree::onSelect(%this, %obj) +{ +} + +function EditorTree::onUnselect(%this, %obj) +{ + EWorldEditor.unselectObject(%obj); +} + +function EditorTree::onDragDropped(%this) +{ + EWorldEditor.isDirty = true; +} + +function EditorTree::onAddGroupSelected(%this, %group) +{ + EWCreatorWindow.setNewObjectGroup(%group); +} + +function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) +{ + %haveObjectEntries = false; + %haveLockAndHideEntries = true; + + // Handle multi-selection. + if( %this.getSelectedItemsCount() > 1 ) + { + %popup = ETMultiSelectionContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETMultiSelectionContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; + item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + }; + } + + // Open context menu if this is a CameraBookmark + else if( %obj.isMemberOfClass( "CameraBookmark" ) ) + { + %popup = ETCameraBookmarkContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETCameraBookmarkContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );"; + + bookmark = -1; + }; + + ETCameraBookmarkContextPopup.bookmark = %obj; + } + + // Open context menu if this is set CameraBookmarks group. + else if( %obj.name $= "CameraBookmarks" ) + { + %popup = ETCameraBookmarksGroupContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETCameraBookmarksGroupContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; + }; + } + + // Open context menu if this is a SimGroup + else if( !%obj.isMemberOfClass( "SceneObject" ) ) + { + %popup = ETSimGroupContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETSimGroupContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; + item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + item[ 8 ] = "-"; + item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; + item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; + item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; + + object = -1; + }; + + %popup.object = %obj; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + } + + // Open generic context menu. + else + { + %popup = ETContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; + item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + object = -1; + }; + + if(%obj.isMemberOfClass("Entity")) + { + %popup = ETEntityContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 12 ] = "-"; + item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; + }; + } + + // Specialized version for ConvexShapes. + else if( %obj.isMemberOfClass( "ConvexShape" ) ) + { + %popup = ETConvexShapeContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 8 ] = "-"; + item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; + }; + } + + // Specialized version for polyhedral objects. + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup = ETPolyObjectContextPopup; + if( !isObject( %popup ) ) + %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 8 ] = "-"; + item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + }; + } + + %popup.object = %obj; + %haveObjectEntries = true; + } + + if( %haveObjectEntries ) + { + %popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" ); + %popup.enableItem( 1, %obj.getName() !$= "MissionGroup" ); + if( %haveLockAndHideEntries ) + { + %popup.checkItem( 4, %obj.locked ); + %popup.checkItem( 5, %obj.hidden ); + } + %popup.enableItem( 7, %this.isItemSelected( %itemId ) ); + } + + %popup.showPopup( Canvas ); +} + +function EditorTree::positionContextMenu( %this, %menu ) +{ + if( (getWord(%menu.position, 0) + getWord(%menu.extent, 0)) > getWord(EWorldEditor.extent, 0) ) + { + %posx = getWord(%menu.position, 0); + %offset = getWord(EWorldEditor.extent, 0) - (%posx + getWord(%menu.extent, 0)) - 5; + %posx += %offset; + %menu.position = %posx @ " " @ getWord(%menu.position, 1); + } +} + +function EditorTree::isValidDragTarget( %this, %id, %obj ) +{ + if( %obj.isMemberOfClass( "Path" ) ) + return EWorldEditor.areAllSelectedObjectsOfType( "Marker" ); + if( %obj.name $= "CameraBookmarks" ) + return EWorldEditor.areAllSelectedObjectsOfType( "CameraBookmark" ); + else + return ( %obj.getClassName() $= "SimGroup" ); +} + +function EditorTree::onBeginReparenting( %this ) +{ + if( isObject( %this.reparentUndoAction ) ) + %this.reparentUndoAction.delete(); + + %action = UndoActionReparentObjects::create( %this ); + + %this.reparentUndoAction = %action; +} + +function EditorTree::onReparent( %this, %obj, %oldParent, %newParent ) +{ + %this.reparentUndoAction.add( %obj, %oldParent, %newParent ); +} + +function EditorTree::onEndReparenting( %this ) +{ + %action = %this.reparentUndoAction; + %this.reparentUndoAction = ""; + + if( %action.numObjects > 0 ) + { + if( %action.numObjects == 1 ) + %action.actionName = "Reparent Object"; + else + %action.actionName = "Reparent Objects"; + + %action.addToManager( Editor.getUndoManager() ); + + EWorldEditor.syncGui(); + } + else + %action.delete(); +} + +function EditorTree::update( %this ) +{ + %this.buildVisibleTree( false ); +} + +//------------------------------------------------------------------------------ + +// Tooltip for TSStatic +function EditorTree::GetTooltipTSStatic( %this, %obj ) +{ + return "Shape: " @ %obj.shapeName; +} + +// Tooltip for ShapeBase +function EditorTree::GetTooltipShapeBase( %this, %obj ) +{ + return "Datablock: " @ %obj.dataBlock; +} + +// Tooltip for StaticShape +function EditorTree::GetTooltipStaticShape( %this, %obj ) +{ + return "Datablock: " @ %obj.dataBlock; +} + +// Tooltip for Item +function EditorTree::GetTooltipItem( %this, %obj ) +{ + return "Datablock: " @ %obj.dataBlock; +} + +// Tooltip for RigidShape +function EditorTree::GetTooltipRigidShape( %this, %obj ) +{ + return "Datablock: " @ %obj.dataBlock; +} + +// Tooltip for Prefab +function EditorTree::GetTooltipPrefab( %this, %obj ) +{ + return "File: " @ %obj.filename; +} + +// Tooltip for GroundCover +function EditorTree::GetTooltipGroundCover( %this, %obj ) +{ + %text = "Material: " @ %obj.material; + for(%i=0; %i<8; %i++) + { + if(%obj.probability[%i] > 0 && %obj.shapeFilename[%i] !$= "") + { + %text = %text NL "Shape " @ %i @ ": " @ %obj.shapeFilename[%i]; + } + } + return %text; +} + +// Tooltip for SFXEmitter +function EditorTree::GetTooltipSFXEmitter( %this, %obj ) +{ + if(%obj.fileName $= "") + return "Track: " @ %obj.track; + else + return "File: " @ %obj.fileName; +} + +// Tooltip for ParticleEmitterNode +function EditorTree::GetTooltipParticleEmitterNode( %this, %obj ) +{ + %text = "Datablock: " @ %obj.dataBlock; + %text = %text NL "Emitter: " @ %obj.emitter; + return %text; +} + +// Tooltip for WorldEditorSelection +function EditorTree::GetTooltipWorldEditorSelection( %this, %obj ) +{ + %text = "Objects: " @ %obj.getCount(); + + if( !%obj.getCanSave() ) + %text = %text NL "Persistent: No"; + else + %text = %text NL "Persistent: Yes"; + + return %text; +} + +//------------------------------------------------------------------------------ + +function EditorTreeTabBook::onTabSelected( %this ) +{ + if( EditorTreeTabBook.getSelectedPage() == 0) + { + EWTreeWindow-->DeleteSelection.visible = true; + EWTreeWindow-->LockSelection.visible = true; + EWTreeWindow-->AddSimGroup.visible = true; + } + else + { + EWTreeWindow-->DeleteSelection.visible = false; + EWTreeWindow-->LockSelection.visible = false; + EWTreeWindow-->AddSimGroup.visible = false; + } +} + +//------------------------------------------------------------------------------ + +function Editor::open(%this) +{ + // prevent the mission editor from opening while the GuiEditor is open. + if(Canvas.getContent() == GuiEditorGui.getId()) + return; + + EditorGui.buildMenus(); + + if( !EditorGui.isInitialized ) + EditorGui.init(); + + %this.editorEnabled(); + Canvas.setContent(EditorGui); + EditorGui.syncCameraGui(); +} + +function Editor::close(%this, %gui) +{ + %this.editorDisabled(); + Canvas.setContent(%gui); + if(isObject(MessageHud)) + MessageHud.close(); + EditorGui.writeCameraSettings(); + + EditorGui.onDestroyMenu(); +} + +function EditorGui::onDestroyMenu(%this) +{ + if( !isObject( %this.menuBar ) ) + return; + + // Destroy menus + while( %this.menuBar.getCount() != 0 ) + %this.menuBar.getObject( 0 ).delete(); + %this.menuBar.removeFromCanvas(); + %this.menuBar.delete(); } -function EditorGui::setMenuDefaultState(%this) -{ - if(! isObject(%this.menuBar)) - return 0; - - for(%i = 0;%i < %this.menuBar.getMenuCount();%i++) - { - %menu = %this.menuBar.getMenu(%i); - %menu.setupDefaultState(); - } - - %this.worldMenu.setupDefaultState(); -} +$RelightCallback = ""; -////////////////////////////////////////////////////////////////////////// - -function EditorGui::findMenu(%this, %name) +function EditorLightingComplete() { - if(! isObject(%this.menuBar)) - return 0; - + $lightingMission = false; + RelightStatus.visible = false; - for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++) + if ($RelightCallback !$= "") { - %menu = %this.menuBar.getMenu(%i); - - if(%name $= %menu.barTitle) - return %menu; + eval($RelightCallback); } - return 0; + $RelightCallback = ""; } + +function updateEditorLightingProgress() +{ + RelightProgress.setValue(($SceneLighting::lightingProgress)); + if ($lightingMission) + $lightingProgressThread = schedule(1, 0, "updateEditorLightingProgress"); +} + +function Editor::lightScene(%this, %callback, %forceAlways) +{ + if ($lightingMission) + return; + + $lightingMission = true; + $RelightCallback = %callback; + RelightStatus.visible = true; + RelightProgress.setValue(0); + Canvas.repaint(); + lightScene("EditorLightingComplete", %forceAlways); + updateEditorLightingProgress(); +} + +//------------------------------------------------------------------------------ + +function EditorGui::handleEscape( %this ) +{ + %result = false; + if ( isObject( %this.currentEditor ) ) + %result = %this.currentEditor.handleEscape(); + + if ( !%result ) + { + Editor.close("PlayGui"); + } +} + +function EditTSCtrl::updateGizmoMode( %this, %mode ) +{ + // Called when the gizmo mode is changed from C++ + + if ( %mode $= "None" ) + EditorGuiToolbar->NoneModeBtn.performClick(); + else if ( %mode $= "Move" ) + EditorGuiToolbar->MoveModeBtn.performClick(); + else if ( %mode $= "Rotate" ) + EditorGuiToolbar->RotateModeBtn.performClick(); + else if ( %mode $= "Scale" ) + EditorGuiToolbar->ScaleModeBtn.performClick(); +} + +//------------------------------------------------------------------------------ + +function EWorldEditor::syncGui( %this ) +{ + %this.syncToolPalette(); + + EditorTree.update(); + Editor.getUndoManager().updateUndoMenu( EditorGui.findMenu("Edit") ); + EditorGuiStatusBar.setSelectionObjectsByCount( %this.getSelectionSize() ); + + EWTreeWindow-->LockSelection.setStateOn( %this.getSelectionLockCount() > 0 ); + + EWorldEditorToolbar-->boundingBoxColBtn.setStateOn( EWorldEditor.boundingBoxCollision ); + + if( EWorldEditor.objectsUseBoxCenter ) + { + EWorldEditorToolbar-->centerObject.setBitmap("tools/gui/images/menubar/bounds-center"); + objectCenterDropdown-->objectBoundsBtn.setStateOn( 1 ); + } + else + { + EWorldEditorToolbar-->centerObject.setBitmap("tools/gui/images/menubar/object-center"); + objectCenterDropdown-->objectBoxBtn.setStateOn( 1 ); + } + + if( GlobalGizmoProfile.getFieldValue(alignment) $= "Object" ) + { + EWorldEditorToolbar-->objectTransform.setBitmap("tools/gui/images/menubar/object-transform"); + objectTransformDropdown-->objectTransformBtn.setStateOn( 1 ); + + } + else + { + EWorldEditorToolbar-->objectTransform.setBitmap("tools/gui/images/menubar/world-transform"); + objectTransformDropdown-->worldTransformBtn.setStateOn( 1 ); + } + + EWorldEditorToolbar-->renderHandleBtn.setStateOn( EWorldEditor.renderObjHandle ); + EWorldEditorToolbar-->renderTextBtn.setStateOn( EWorldEditor.renderObjText ); + + EWorldEditorToolbar-->objectSnapDownBtn.setStateOn( %this.stickToGround ); + SnapToBar-->objectSnapBtn.setStateOn( EWorldEditor.getSoftSnap() ); + EWorldEditorToolbar-->softSnapSizeTextEdit.setText( EWorldEditor.getSoftSnapSize() ); + ESnapOptions-->SnapSize.setText( EWorldEditor.getSoftSnapSize() ); + ESnapOptions-->GridSize.setText( EWorldEditor.getGridSize() ); + + ESnapOptions-->GridSnapButton.setStateOn( %this.getGridSnap() ); + ESnapOptions-->GroupSnapButton.setStateOn( %this.UseGroupCenter ); + SnapToBar-->objectGridSnapBtn.setStateOn( %this.getGridSnap() ); + ESnapOptions-->NoSnapButton.setStateOn( !%this.stickToGround && !%this.getSoftSnap() && !%this.getGridSnap() ); +} + +function EWorldEditor::syncToolPalette( %this ) +{ + switch$ ( GlobalGizmoProfile.mode ) + { + case "None": + EWorldEditorNoneModeBtn.performClick(); + case "Move": + EWorldEditorMoveModeBtn.performClick(); + case "Rotate": + EWorldEditorRotateModeBtn.performClick(); + case "Scale": + EWorldEditorScaleModeBtn.performClick(); + } +} + +function EWorldEditor::addSimGroup( %this, %groupCurrentSelection ) +{ + %activeSelection = %this.getActiveSelection(); + if ( %activeSelection.getObjectIndex( MissionGroup ) != -1 ) + { + MessageBoxOK( "Error", "Cannot add MissionGroup to a new SimGroup" ); + return; + } + + // Find our parent. + + %parent = MissionGroup; + if( !%groupCurrentSelection && isObject( %activeSelection ) && %activeSelection.getCount() > 0 ) + { + %firstSelectedObject = %activeSelection.getObject( 0 ); + if( %firstSelectedObject.isMemberOfClass( "SimGroup" ) ) + %parent = %firstSelectedObject; + else if( %firstSelectedObject.getId() != MissionGroup.getId() ) + %parent = %firstSelectedObject.parentGroup; + } + + // If we are about to do a group-selected as well, + // starting recording an undo compound. + + if( %groupCurrentSelection ) + Editor.getUndoManager().pushCompound( "Group Selected" ); + + // Create the SimGroup. + + %object = new SimGroup() + { + parentGroup = %parent; + }; + MECreateUndoAction::submit( %object ); + + // Put selected objects into the group, if requested. + + if( %groupCurrentSelection && isObject( %activeSelection ) ) + { + %undo = UndoActionReparentObjects::create( EditorTree ); + + %numObjects = %activeSelection.getCount(); + for( %i = 0; %i < %numObjects; %i ++ ) + { + %sel = %activeSelection.getObject( %i ); + %undo.add( %sel, %sel.parentGroup, %object ); + %object.add( %sel ); + } + + %undo.addToManager( Editor.getUndoManager() ); + } + + // Stop recording for group-selected. + + if( %groupCurrentSelection ) + Editor.getUndoManager().popCompound(); + + // When not grouping selection, make the newly created SimGroup the + // current selection. + + if( !%groupCurrentSelection ) + { + EWorldEditor.clearSelection(); + EWorldEditor.selectObject( %object ); + } + + // Refresh the Gui. + + %this.syncGui(); +} + +function EWorldEditor::toggleLockChildren( %this, %simGroup ) +{ + foreach( %child in %simGroup ) + { + if( %child.class $= "SimGroup" ) + { + %this.toggleHideChildren( %child ); + } + if( %child.isMemberOfClass( "SimGroup" ) ) + { + %this.toggleHideChildren( %child ); + %child.setLocked( !%child.locked ); + } + else + { + %child.setLocked( !%child.locked ); + } + } + + EWorldEditor.syncGui(); +} + +function EWorldEditor::toggleHideChildren( %this, %simGroup ) +{ + foreach( %child in %simGroup ) + { + if( %child.class $= "SimGroup" ) + { + %this.toggleHideChildren( %child ); + } + if( %child.isMemberOfClass( "SimGroup" ) ) + { + %this.toggleHideChildren( %child ); + %this.hideObject( %child, !%child.hidden ); + } + else + { + %this.hideObject( %child, !%child.hidden ); + } + } + + EWorldEditor.syncGui(); +} + +function EWorldEditor::convertSelectionToPolyhedralObjects( %this, %className ) +{ + %group = %this.getNewObjectGroup(); + %undoManager = Editor.getUndoManager(); + + %activeSelection = %this.getActiveSelection(); + while( %activeSelection.getCount() != 0 ) + { + %oldObject = %activeSelection.getObject( 0 ); + %newObject = %this.createPolyhedralObject( %className, %oldObject ); + if( isObject( %newObject ) ) + { + %undoManager.pushCompound( "Convert ConvexShape to " @ %className ); + %newObject.parentGroup = %oldObject.parentGroup; + MECreateUndoAction::submit( %newObject ); + MEDeleteUndoAction::submit( %oldObject ); + %undoManager.popCompound(); + } + } +} + +function EWorldEditor::convertSelectionToConvexShape( %this ) +{ + %group = %this.getNewObjectGroup(); + %undoManager = Editor.getUndoManager(); + + %activeSelection = %this.getActiveSelection(); + while( %activeSelection.getCount() != 0 ) + { + %oldObject = %activeSelection.getObject( 0 ); + %newObject = %this.createConvexShapeFrom( %oldObject ); + if( isObject( %newObject ) ) + { + %undoManager.pushCompound( "Convert " @ %oldObject.getClassName() @ " to ConvexShape" ); + %newObject.parentGroup = %oldObject.parentGroup; + MECreateUndoAction::submit( %newObject ); + MEDeleteUndoAction::submit( %oldObject ); + %undoManager.popCompound(); + } + } +} + +function EWorldEditor::getNewObjectGroup( %this ) +{ + return EWCreatorWindow.getNewObjectGroup(); +} + +function EWorldEditor::deleteMissionObject( %this, %object ) +{ + // Unselect in editor tree. + + %id = EditorTree.findItemByObjectId( %object ); + EditorTree.selectItem( %id, false ); + + // Delete object. + + MEDeleteUndoAction::submit( %object ); + EWorldEditor.isDirty = true; + EditorTree.buildVisibleTree( true ); +} + +function EWorldEditor::createGameObject( %this, %entity ) +{ + if(!isObject(GameObjectBuilder)) + { + new GuiControl(GameObjectBuilder, EditorGuiGroup) { + profile = "ToolsGuiDefaultProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "0 0"; + extent = "800 600"; + minExtent = "8 8"; + visible = "1"; + setFirstResponder = "0"; + modal = "1"; + helpTag = "0"; + + new GuiWindowCtrl(GameObjectBuilderTargetWindow) { + profile = "ToolsGuiWindowProfile"; + horizSizing = "center"; + vertSizing = "center"; + position = "384 205"; + extent = "256 102"; + minExtent = "256 8"; + visible = "1"; + setFirstResponder = "0"; + modal = "1"; + helpTag = "0"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + minSize = "50 50"; + text = "Create Object"; + + new GuiTextCtrl() { + profile = "GuiCenterTextProfile"; + horizSizing = "right"; + vertSizing = "bottom"; + position = "9 26"; + extent = "84 16"; + minExtent = "8 8"; + visible = "1"; + setFirstResponder = "0"; + modal = "1"; + helpTag = "0"; + text = "Object Name:"; + }; + new GuiTextEditCtrl(GameObjectBuilderObjectName) { + class = ObjectBuilderGuiTextEditCtrl; + profile = "ToolsGuiTextEditProfile"; + horizSizing = "width"; + vertSizing = "bottom"; + position = "78 26"; + extent = "172 18"; + minExtent = "8 8"; + visible = "1"; + setFirstResponder = "0"; + modal = "1"; + helpTag = "0"; + historySize = "0"; + }; + new GuiButtonCtrl(GameObjectBuilderOKButton) { + profile = "ToolsGuiButtonProfile"; + horizSizing = "width"; + vertSizing = "bottom"; + position = "7 250"; + extent = "156 24"; + minExtent = "8 8"; + visible = "1"; + setFirstResponder = "0"; + modal = "1"; + command = "EWorldEditor.buildGameObject();"; + helpTag = "0"; + text = "Create New"; + Accelerator = "return"; + }; + new GuiButtonCtrl(GameObjectBuilderCancelButton) { + profile = "ToolsGuiButtonProfile"; + horizSizing = "left"; + vertSizing = "bottom"; + position = "170 250"; + extent = "80 24"; + minExtent = "8 8"; + visible = "1"; + setFirstResponder = "0"; + modal = "1"; + command = "Canvas.popDialog(GameObjectBuilder);"; + helpTag = "0"; + text = "Cancel"; + Accelerator = "escape"; + }; + }; + }; + + GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88; + GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57; + GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57; + } + + GameObjectBuilderObjectName.text = ""; + GameObjectBuilder.selectedEntity = %entity; + + Canvas.pushDialog(GameObjectBuilder); +} + +function EWorldEditor::buildGameObject(%this) +{ + if(GameObjectBuilderObjectName.getText() $= "") + { + error("Attempted to make a new Game Object with no name!"); + Canvas.popDialog(GameObjectBuilder); + return; + } + + %path = EditorSettings.value( "WorldEditor/newGameObjectDir" ); + %className = GameObjectBuilderObjectName.getText(); + GameObjectBuilder.selectedEntity.class = %className; + Inspector.inspect(GameObjectBuilder.selectedEntity); + + %file = new FileObject(); + + if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) + { + %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); + %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //set up the paths + %tamlPath = %path @ "/" @ %className @ ".taml"; + %scriptPath = %path @ "/" @ %className @ ".cs"; + saveGameObject(%className, %tamlPath, %scriptPath); + + //reload it + execGameObjects(); + + //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. + TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath); + + GameObjectBuilder.selectedEntity = ""; + + Canvas.popDialog(GameObjectBuilder); +} + +function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect ) +{ + if( !isObject( %set ) ) + return; + + foreach( %obj in %set ) + { + if( %deselect ) + %this.unselectObject( %obj ); + else + %this.selectObject( %obj ); + } +} + +function toggleSnappingOptions( %var ) +{ + if( SnapToBar->objectSnapDownBtn.getValue() && SnapToBar->objectSnapBtn.getValue() ) + { + if( %var $= "terrain" ) + { + EWorldEditor.stickToGround = 1; + EWorldEditor.setSoftSnap(false); + ESnapOptionsTabBook.selectPage(0); + SnapToBar->objectSnapBtn.setStateOn(0); + } + else + { + // soft snapping + EWorldEditor.stickToGround = 0; + EWorldEditor.setSoftSnap(true); + ESnapOptionsTabBook.selectPage(1); + SnapToBar->objectSnapDownBtn.setStateOn(0); + } + } + else if( %var $= "terrain" && EWorldEditor.stickToGround == 0 ) + { + // Terrain Snapping + EWorldEditor.stickToGround = 1; + EWorldEditor.setSoftSnap(false); + ESnapOptionsTabBook.selectPage(0); + SnapToBar->objectSnapDownBtn.setStateOn(1); + SnapToBar->objectSnapBtn.setStateOn(0); + + } + else if( %var $= "soft" && EWorldEditor.getSoftSnap() == false ) + { + // Object Snapping + EWorldEditor.stickToGround = 0; + EWorldEditor.setSoftSnap(true); + ESnapOptionsTabBook.selectPage(1); + SnapToBar->objectSnapBtn.setStateOn(1); + SnapToBar->objectSnapDownBtn.setStateOn(0); + + } + else if( %var $= "grid" ) + { + EWorldEditor.setGridSnap( !EWorldEditor.getGridSnap() ); + } + else if( %var $= "byGroup" ) + { + EWorldEditor.UseGroupCenter = !EWorldEditor.UseGroupCenter; + ESnapOptions->GroupSnapButton.setStateOn(EWorldEditor.UseGroupCenter); + } + else + { + // No snapping. + + EWorldEditor.stickToGround = false; + EWorldEditor.setGridSnap( false ); + EWorldEditor.setSoftSnap( false ); + + SnapToBar->objectSnapDownBtn.setStateOn(0); + SnapToBar->objectSnapBtn.setStateOn(0); + } + + EWorldEditor.syncGui(); +} + +function objectCenterDropdown::toggle() +{ + if ( objectCenterDropdown.visible ) + { + EWorldEditorToolbar-->centerObject.setStateOn(false); + objectCenterDropdownDecoy.setVisible(false); + objectCenterDropdownDecoy.setActive(false); + objectCenterDropdown.setVisible(false); + } + else + { + EWorldEditorToolbar-->centerObject.setStateOn(true); + objectCenterDropdown.setVisible(true); + objectCenterDropdownDecoy.setActive(true); + objectCenterDropdownDecoy.setVisible(true); + } +} + +function objectTransformDropdown::toggle() +{ + if ( objectTransformDropdown.visible ) + { + EWorldEditorToolbar-->objectTransform.setStateOn(false); + objectTransformDropdownDecoy.setVisible(false); + objectTransformDropdownDecoy.setActive(false); + objectTransformDropdown.setVisible(false); + } + else + { + EWorldEditorToolbar-->objectTransform.setStateOn(true); + objectTransformDropdown.setVisible(true); + objectTransformDropdownDecoy.setActive(true); + objectTransformDropdownDecoy.setVisible(true); + } +} + +function objectSnapDropdownDecoy::onMouseLeave() +{ + objectSnapDropdown.toggle(); +} + +function objectCenterDropdownDecoy::onMouseLeave() +{ + objectCenterDropdown.toggle(); +} + +function objectTransformDropdownDecoy::onMouseLeave() +{ + objectTransformDropdown.toggle(); +} + +//------------------------------------------------------------------------------ + +function EWAddSimGroupButton::onDefaultClick( %this ) +{ + EWorldEditor.addSimGroup(); +} + +function EWAddSimGroupButton::onCtrlClick( %this ) +{ + EWorldEditor.addSimGroup( true ); +} + +//------------------------------------------------------------------------------ + +function EWToolsToolbar::reset( %this ) +{ + %count = ToolsToolbarArray.getCount(); + for( %i = 0 ; %i < %count; %i++ ) + ToolsToolbarArray.getObject(%i).setVisible(true); + + %this.setExtent((29 + 4) * %count + 12, 33); + %this.isClosed = 0; + EWToolsToolbar.isDynamic = 0; + + EWToolsToolbarDecoy.setVisible(false); + EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 31); + + %this-->resizeArrow.setBitmap( "tools/gui/images/collapse-toolbar" ); +} + +function EWToolsToolbar::toggleSize( %this, %useDynamics ) +{ + // toggles the size of the tooltoolbar. also goes through + // and hides each control not currently selected. we hide the controls + // in a very neat, spiffy way + + if ( %this.isClosed == 0 ) + { + %image = "tools/gui/images/expand-toolbar"; + + for( %i = 0 ; %i < ToolsToolbarArray.getCount(); %i++ ) + { + if( ToolsToolbarArray.getObject(%i).getValue() != 1 ) + ToolsToolbarArray.getObject(%i).setVisible(false); + } + + %this.setExtent(43, 33); + %this.isClosed = 1; + + if(!%useDynamics) + { + EWToolsToolbarDecoy.setVisible(true); + EWToolsToolbar.isDynamic = 1; + } + + EWToolsToolbarDecoy.setExtent(35, 31); + } + else + { + %image = "tools/gui/images/collapse-toolbar"; + + %count = ToolsToolbarArray.getCount(); + for( %i = 0 ; %i < %count; %i++ ) + ToolsToolbarArray.getObject(%i).setVisible(true); + + %this.setExtent((29 + 4) * %count + 12, 33); + %this.isClosed = 0; + + if(!%useDynamics) + { + EWToolsToolbarDecoy.setVisible(false); + EWToolsToolbar.isDynamic = 0; + } + + EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 32); + } + + %this-->resizeArrow.setBitmap( %image ); + +} + +function EWToolsToolbarDecoy::onMouseEnter( %this ) +{ + EWToolsToolbar.toggleSize(true); +} + +function EWToolsToolbarDecoy::onMouseLeave( %this ) +{ + EWToolsToolbar.toggleSize(true); +} + +//------------------------------------------------------------------------------ + +function EditorGuiStatusBar::reset( %this ) +{ + EWorldEditorStatusBarInfo.clearInfo(); +} + +function EditorGuiStatusBar::getInfo( %this ) +{ + return EWorldEditorStatusBarInfo.getValue(); +} + +function EditorGuiStatusBar::setInfo( %this, %text ) +{ + EWorldEditorStatusBarInfo.setText(%text); +} + +function EditorGuiStatusBar::clearInfo( %this ) +{ + EWorldEditorStatusBarInfo.setText(""); +} + +function EditorGuiStatusBar::getSelection( %this ) +{ + return EWorldEditorStatusBarSelection.getValue(); +} + +function EditorGuiStatusBar::setSelection( %this, %text ) +{ + EWorldEditorStatusBarSelection.setText(%text); +} + +function EditorGuiStatusBar::setSelectionObjectsByCount( %this, %count ) +{ + %text = " objects selected"; + if(%count == 1) + %text = " object selected"; + + EWorldEditorStatusBarSelection.setText(%count @ %text); +} + +function EditorGuiStatusBar::clearSelection( %this ) +{ + EWorldEditorStatusBarSelection.setText(""); +} + +function EditorGuiStatusBar::getCamera( %this ) +{ + return EWorldEditorStatusBarCamera.getText(); +} + +function EditorGuiStatusBar::setCamera( %this, %text ) +{ + %id = EWorldEditorStatusBarCamera.findText( %text ); + if( %id != -1 ) + { + if ( EWorldEditorStatusBarCamera.getSelected() != %id ) + EWorldEditorStatusBarCamera.setSelected( %id, true ); + } +} + +function EWorldEditorStatusBarCamera::onWake( %this ) +{ + %this.add( "Standard Camera" ); + %this.add( "1st Person Camera" ); + %this.add( "3rd Person Camera" ); + %this.add( "Orbit Camera" ); + %this.add( "Top View" ); + %this.add( "Bottom View" ); + %this.add( "Left View" ); + %this.add( "Right View" ); + %this.add( "Front View" ); + %this.add( "Back View" ); + %this.add( "Isometric View" ); + %this.add( "Smooth Camera" ); + %this.add( "Smooth Rot Camera" ); +} + +function EWorldEditorStatusBarCamera::onSelect( %this, %id, %text ) +{ + switch$( %text ) + { + case "Top View": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeTop ); + + case "Bottom View": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeBottom ); + + case "Left View": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeLeft ); + + case "Right View": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeRight ); + + case "Front View": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeFront ); + + case "Back View": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeBack ); + + case "Isometric View": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypeIsometric ); + + case "Standard Camera": + commandToServer( 'SetEditorCameraStandard' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); + + case "1st Person Camera": + commandToServer( 'SetEditorCameraPlayer' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); + + case "3rd Person Camera": + commandToServer( 'SetEditorCameraPlayerThird' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); + + case "Orbit Camera": + commandToServer( 'SetEditorOrbitCamera' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); + + case "Smooth Camera": + commandToServer( 'SetEditorCameraNewton' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); + + case "Smooth Rot Camera": + commandToServer( 'SetEditorCameraNewtonDamped' ); + EditorGui.setDisplayType( $EditTsCtrl::DisplayTypePerspective ); + } +} + +//------------------------------------------------------------------------------------ +// Each a gui slider bar is pushed on the editor gui, it maps itself with value +// located in its connected text control +//------------------------------------------------------------------------------------ +function softSnapSizeSliderCtrlContainer::onWake(%this) +{ + %this-->slider.setValue(EWorldEditorToolbar-->softSnapSizeTextEdit.getValue()); +} +function softSnapSizeSliderCtrlContainer::onSliderChanged(%this) +{ + EWorldEditor.setSoftSnapSize( %this-->slider.value ); + EWorldEditor.syncGui(); +} +//------------------------------------------------------------------------------------ + +function PaintBrushSizeSliderCtrlContainer::onWake(%this) +{ + %this-->slider.range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0); + %this-->slider.setValue(PaintBrushSizeTextEditContainer-->textEdit.getValue()); +} + +function PaintBrushPressureSliderCtrlContainer::onWake(%this) +{ + %this-->slider.setValue(PaintBrushPressureTextEditContainer-->textEdit.getValue() / 100); +} + +function PaintBrushSoftnessSliderCtrlContainer::onWake(%this) +{ + %this-->slider.setValue(PaintBrushSoftnessTextEditContainer-->textEdit.getValue() / 100); +} + +//------------------------------------------------------------------------------------ + +function TerrainBrushSizeSliderCtrlContainer::onWake(%this) +{ + %this-->slider.range = "1" SPC getWord(ETerrainEditor.maxBrushSize, 0); + %this-->slider.setValue(TerrainBrushSizeTextEditContainer-->textEdit.getValue()); +} + +function TerrainBrushPressureSliderCtrlContainer::onWake(%this) +{ + %this-->slider.setValue(TerrainBrushPressureTextEditContainer-->textEdit.getValue() / 100.0); +} + +function TerrainBrushSoftnessSliderCtrlContainer::onWake(%this) +{ + %this-->slider.setValue(TerrainBrushSoftnessTextEditContainer-->textEdit.getValue() / 100.0); +} + +function TerrainSetHeightSliderCtrlContainer::onWake(%this) +{ + %this-->slider.setValue(TerrainSetHeightTextEditContainer-->textEdit.getValue()); +} +//------------------------------------------------------------------------------------ +function CameraSpeedDropdownCtrlContainer::onWake(%this) +{ + %this-->slider.setValue(CameraSpeedDropdownContainer-->textEdit.getText()); +} + +//------------------------------------------------------------------------------------ +// Callbacks to close the dropdown slider controls like the camera speed, +// that are marked with this class name. + +function EditorDropdownSliderContainer::onMouseDown(%this) +{ + Canvas.popDialog(%this); +} + +function EditorDropdownSliderContainer::onRightMouseDown(%this) +{ + Canvas.popDialog(%this); +} \ No newline at end of file diff --git a/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs index dbe978cab..b225d3534 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/menus.ed.cs @@ -110,9 +110,13 @@ function EditorGui::buildMenus(%this) }; // Menu bar - %this.menuBar = new MenuBar(WorldEditorMenubar) + %this.menuBar = new GuiMenuBar(WorldEditorMenubar) { dynamicItemInsertPos = 3; + extent = "1024 20"; + minExtent = "320 20"; + horizSizing = "width"; + profile = "GuiMenuBarProfile"; }; // File Menu @@ -158,7 +162,7 @@ function EditorGui::buildMenus(%this) %fileMenu.appendItem("Exit Level" TAB "" TAB "EditorExitMission();"); %fileMenu.appendItem("Quit" TAB %quitShortcut TAB "EditorQuitGame();"); - %this.menuBar.insert(%fileMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%fileMenu); // Edit Menu %editMenu = new PopupMenu() @@ -187,7 +191,7 @@ function EditorGui::buildMenus(%this) item[15] = "Game Options..." TAB "" TAB "Canvas.pushDialog(optionsDlg);"; item[16] = "PostEffect Manager" TAB "" TAB "Canvas.pushDialog(PostFXManager);"; }; - %this.menuBar.insert(%editMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editMenu); // View Menu %viewMenu = new PopupMenu() @@ -201,7 +205,7 @@ function EditorGui::buildMenus(%this) item[ 0 ] = "Visibility Layers" TAB "Alt V" TAB "VisibilityDropdownToggle();"; item[ 1 ] = "Show Grid in Ortho Views" TAB %cmdCtrl @ "-Shift-Alt G" TAB "EditorGui.toggleOrthoGrid();"; }; - %this.menuBar.insert(%viewMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%viewMenu); // Camera Menu %cameraMenu = new PopupMenu() @@ -229,7 +233,7 @@ function EditorGui::buildMenus(%this) Item[15] = "Manage Bookmarks..." TAB "Ctrl-Shift B" TAB "EditorGui.toggleCameraBookmarkWindow();"; item[16] = "Jump to Bookmark" TAB %this.cameraBookmarksMenu; }; - %this.menuBar.insert(%cameraMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%cameraMenu); // Editors Menu %editorsMenu = new PopupMenu() @@ -246,7 +250,7 @@ function EditorGui::buildMenus(%this) //item[4] = "Terrain Painter" TAB "F4" TAB TerrainPainterPlugin; //item[5] = "-"; }; - %this.menuBar.insert(%editorsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%editorsMenu); // Lighting Menu %lightingMenu = new PopupMenu() @@ -263,7 +267,7 @@ function EditorGui::buildMenus(%this) // NOTE: The light managers will be inserted as the // last menu items in EditorLightingMenu::onAdd(). }; - %this.menuBar.insert(%lightingMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%lightingMenu); // Tools Menu %toolsMenu = new PopupMenu() @@ -278,7 +282,7 @@ function EditorGui::buildMenus(%this) item[2] = "Torque SimView" TAB "" TAB "tree();"; item[3] = "Make Selected a Mesh" TAB "" TAB "makeSelectedAMesh();"; }; - %this.menuBar.insert(%toolsMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%toolsMenu); // Help Menu %helpMenu = new PopupMenu() @@ -293,7 +297,7 @@ function EditorGui::buildMenus(%this) item[2] = "Offline Reference Guide..." TAB "" TAB "shellexecute(EWorldEditor.documentationReference);"; item[3] = "Torque 3D Forums..." TAB "" TAB "gotoWebPage(EWorldEditor.forumURL);"; }; - %this.menuBar.insert(%helpMenu, %this.menuBar.getCount()); + %this.menuBar.insert(%helpMenu); // Menus that are added/removed dynamically (temporary) @@ -398,9 +402,9 @@ function EditorGui::setMenuDefaultState(%this) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + for(%i = 0;%i < %this.menuBar.getMenuCount();%i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); %menu.setupDefaultState(); } @@ -414,9 +418,10 @@ function EditorGui::findMenu(%this, %name) if(! isObject(%this.menuBar)) return 0; - for(%i = 0;%i < %this.menuBar.getCount();%i++) + + for(%i = 0; %i < %this.menuBar.getMenuCount(); %i++) { - %menu = %this.menuBar.getObject(%i); + %menu = %this.menuBar.getMenu(%i); if(%name $= %menu.barTitle) return %menu; From c7e12d3be7d4f80f812c36789ef3148898ec522d Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sun, 12 Nov 2017 13:39:14 -0500 Subject: [PATCH 057/312] roll back changes to simFieldDictionary as it doesn't want to play nice and causing corruption --- Engine/source/console/simFieldDictionary.cpp | 266 +-- Engine/source/console/simFieldDictionary.h | 13 +- Engine/source/persistence/taml/taml.cpp | 2249 +++++++++--------- 3 files changed, 1259 insertions(+), 1269 deletions(-) diff --git a/Engine/source/console/simFieldDictionary.cpp b/Engine/source/console/simFieldDictionary.cpp index 2deb56bf9..f68a8689b 100644 --- a/Engine/source/console/simFieldDictionary.cpp +++ b/Engine/source/console/simFieldDictionary.cpp @@ -32,6 +32,10 @@ #include "console/consoleInternal.h" #include "core/frameAllocator.h" +SimFieldDictionary::Entry *SimFieldDictionary::smFreeList = NULL; + +static Chunker fieldChunker; + U32 SimFieldDictionary::getHashValue(StringTableEntry slotName) { return HashPointer(slotName) % HashTableSize; @@ -44,43 +48,58 @@ U32 SimFieldDictionary::getHashValue(const String& fieldName) SimFieldDictionary::Entry *SimFieldDictionary::addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value) { - Entry ret; - ret.slotName = slotName; - ret.type = type; - ret.value = value; + Entry* ret; + if (smFreeList) + { + ret = smFreeList; + smFreeList = ret->next; + } + else + ret = fieldChunker.alloc(); + ret->next = mHashTable[bucket]; + ret->slotName = slotName; + ret->type = type; + ret->value = value; + + mHashTable[bucket] = ret; mNumFields++; mVersion++; - mHashTable[bucket].push_back(std::move(ret)); - return &mHashTable[bucket].back(); + return ret; } void SimFieldDictionary::freeEntry(SimFieldDictionary::Entry *ent) { - auto &vec = mHashTable[getHashValue(ent->slotName)]; + ent->next = smFreeList; + smFreeList = ent; - // Find the slot. - auto iter = std::find_if(vec.begin(), vec.end(), [&](const Entry &ref) -> bool { - return ref.slotName == ent->slotName; - }); - if (iter != vec.end()) - { - vec.erase(iter); - mNumFields--; - } + mNumFields--; } SimFieldDictionary::SimFieldDictionary() : mNumFields(0), mVersion(0) { - + dMemset(mHashTable, 0, sizeof(mHashTable)); } SimFieldDictionary::~SimFieldDictionary() { + for (U32 i = 0; i < HashTableSize; i++) + { + for (Entry *walk = mHashTable[i]; walk;) + { + Entry *temp = walk; + walk = temp->next; + if (temp->value) + dFree(temp->value); + freeEntry(temp); + } + } + + AssertFatal(mNumFields == 0, "Incorrect count on field dictionary"); } void SimFieldDictionary::setFieldType(StringTableEntry slotName, const char *typeString) @@ -100,12 +119,12 @@ void SimFieldDictionary::setFieldType(StringTableEntry slotName, ConsoleBaseType // If the field exists on the object, set the type U32 bucket = getHashValue(slotName); - for (Entry &ref : mHashTable[bucket]) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) { - if (ref.slotName == slotName) + if (walk->slotName == slotName) { // Found and type assigned, let's bail - ref.type = type; + walk->type = type; return; } } @@ -118,14 +137,9 @@ U32 SimFieldDictionary::getFieldType(StringTableEntry slotName) const { U32 bucket = getHashValue(slotName); - const std::vector &vec = mHashTable[bucket]; - size_t size = vec.size(); - for (size_t i = 0; i < size; ++i) - { - const Entry &ref = vec[i]; - if (ref.slotName == slotName) - return ref.type ? ref.type->getTypeID() : TypeString; - } + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) + if (walk->slotName == slotName) + return walk->type ? walk->type->getTypeID() : TypeString; return TypeString; } @@ -134,13 +148,10 @@ SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(const String &f { U32 bucket = getHashValue(fieldName); - const std::vector &vec = mHashTable[bucket]; - size_t size = vec.size(); - for (size_t i = 0; i < size; ++i) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) { - const Entry &ref = vec[i]; - if (fieldName.equal(ref.slotName, String::NoCase)) - return const_cast(&ref); + if (fieldName.equal(walk->slotName, String::NoCase)) + return walk; } return NULL; @@ -150,13 +161,11 @@ SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(StringTableEntry { U32 bucket = getHashValue(fieldName); - const std::vector &vec = mHashTable[bucket]; - size_t size = vec.size(); - for (size_t i = 0; i < size; ++i) + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) { - if (vec[i].slotName == fieldName) + if (walk->slotName == fieldName) { - return const_cast(&vec[i]); + return walk; } } @@ -167,43 +176,45 @@ SimFieldDictionary::Entry *SimFieldDictionary::findDynamicField(StringTableEntry void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *value) { U32 bucket = getHashValue(slotName); + Entry **walk = &mHashTable[bucket]; + while (*walk && (*walk)->slotName != slotName) + walk = &((*walk)->next); - for (Entry &ref : mHashTable[bucket]) + Entry *field = *walk; + if (!value || !*value) { - if (ref.slotName == slotName) + if (field) { - if (!value || !*value) - { - mVersion++; + mVersion++; - if (ref.value) - dFree(ref.value); + if (field->value) + dFree(field->value); - freeEntry(&ref); - } - else - { - if (ref.value) - dFree(ref.value); - - ref.value = dStrdup(value); - } - - return; + *walk = field->next; + freeEntry(field); } } + else + { + if (field) + { + if (field->value) + dFree(field->value); - // no field, add entry. - addEntry(bucket, slotName, 0, dStrdup(value)); + field->value = dStrdup(value); + } + else + addEntry(bucket, slotName, 0, dStrdup(value)); + } } const char *SimFieldDictionary::getFieldValue(StringTableEntry slotName) { U32 bucket = getHashValue(slotName); - for (const Entry &ref : mHashTable[bucket]) - if (ref.slotName == slotName) - return ref.value; + for (Entry *walk = mHashTable[bucket]; walk; walk = walk->next) + if (walk->slotName == slotName) + return walk->value; return NULL; } @@ -214,41 +225,41 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict) for (U32 i = 0; i < HashTableSize; i++) { - for (const Entry &ref : mHashTable[i]) + for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next) { - setFieldValue(ref.slotName, ref.value); - setFieldType(ref.slotName, ref.type); + setFieldValue(walk->slotName, walk->value); + setFieldType(walk->slotName, walk->type); } } } static S32 QSORT_CALLBACK compareEntries(const void* a, const void* b) { - const SimFieldDictionary::Entry *fa = reinterpret_cast(a); - const SimFieldDictionary::Entry *fb = reinterpret_cast(b); + SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a); + SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b); return dStricmp(fa->slotName, fb->slotName); } void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop) { const AbstractClassRep::FieldList &list = obj->getFieldList(); - Vector flist(__FILE__, __LINE__); + Vector flist(__FILE__, __LINE__); for (U32 i = 0; i < HashTableSize; i++) { - for (const Entry &walk : mHashTable[i]) + for (Entry *walk = mHashTable[i]; walk; walk = walk->next) { // make sure we haven't written this out yet: - U32 j; - for (j = 0; j < list.size(); j++) - if (list[j].pFieldname == walk.slotName) + U32 i; + for (i = 0; i < list.size(); i++) + if (list[i].pFieldname == walk->slotName) break; - if (j != list.size()) + if (i != list.size()) continue; - if (!obj->writeField(walk.slotName, walk.value)) + if (!obj->writeField(walk->slotName, walk->value)) continue; flist.push_back(walk); @@ -256,20 +267,20 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop } // Sort Entries to prevent version control conflicts - dQsort(flist.address(), flist.size(), sizeof(Entry), compareEntries); + dQsort(flist.address(), flist.size(), sizeof(Entry *), compareEntries); // Save them out - for (const Entry &ref : flist) + for (Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) { - U32 nBufferSize = (dStrlen(ref.value) * 2) + dStrlen(ref.slotName) + 16; + U32 nBufferSize = (dStrlen((*itr)->value) * 2) + dStrlen((*itr)->slotName) + 16; FrameTemp expandedBuffer(nBufferSize); stream.writeTabs(tabStop + 1); - const char *typeName = ref.type && ref.type->getTypeID() != TypeString ? ref.type->getTypeName() : ""; - dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", ref.slotName); - if (ref.value) - expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), ref.value); + const char *typeName = (*itr)->type && (*itr)->type->getTypeID() != TypeString ? (*itr)->type->getTypeName() : ""; + dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", (*itr)->slotName); + if ((*itr)->value) + expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value); dStrcat(expandedBuffer, "\";\r\n"); stream.write(dStrlen(expandedBuffer), expandedBuffer); @@ -280,35 +291,35 @@ void SimFieldDictionary::printFields(SimObject *obj) { const AbstractClassRep::FieldList &list = obj->getFieldList(); char expandedBuffer[4096]; - Vector flist(__FILE__, __LINE__); + Vector flist(__FILE__, __LINE__); for (U32 i = 0; i < HashTableSize; i++) { - for (const Entry &walk : mHashTable[i]) + for (Entry *walk = mHashTable[i]; walk; walk = walk->next) { // make sure we haven't written this out yet: - U32 j; - for (j = 0; j < list.size(); j++) - if (list[i].pFieldname == walk.slotName) + U32 i; + for (i = 0; i < list.size(); i++) + if (list[i].pFieldname == walk->slotName) break; - if (j != list.size()) + if (i != list.size()) continue; flist.push_back(walk); } } - dQsort(flist.address(), flist.size(), sizeof(Entry), compareEntries); + dQsort(flist.address(), flist.size(), sizeof(Entry *), compareEntries); - for (const Entry &ref : flist) + for (Vector::iterator itr = flist.begin(); itr != flist.end(); itr++) { const char* type = "string"; - if (ref.type) - type = ref.type->getTypeClassName(); + if ((*itr)->type) + type = (*itr)->type->getTypeClassName(); - dSprintf(expandedBuffer, sizeof(expandedBuffer), " %s %s = \"", type, ref.slotName); - if (ref.value) - expandEscape(expandedBuffer + dStrlen(expandedBuffer), ref.value); + dSprintf(expandedBuffer, sizeof(expandedBuffer), " %s %s = \"", type, (*itr)->slotName); + if ((*itr)->value) + expandEscape(expandedBuffer + dStrlen(expandedBuffer), (*itr)->value); Con::printf("%s\"", expandedBuffer); } } @@ -332,44 +343,29 @@ SimFieldDictionary::Entry *SimFieldDictionary::operator[](U32 index) SimFieldDictionaryIterator::SimFieldDictionaryIterator(SimFieldDictionary * dictionary) { mDictionary = dictionary; - mHashIndex = 0; - mVecIndex = -1; // -1 since we immediately call operator++ - mEntry = NULL; + mHashIndex = -1; + mEntry = 0; operator++(); } SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator++() { - if (!mDictionary || mHashIndex >= SimFieldDictionary::HashTableSize) - { - mEntry = NULL; - return NULL; - } + if (!mDictionary) + return(mEntry); - std::vector &vec = mDictionary->mHashTable[mHashIndex]; + if (mEntry) + mEntry = mEntry->next; - while (vec.size() == 0 && mHashIndex < (SimFieldDictionary::HashTableSize - 1)) - { - vec = mDictionary->mHashTable[++mHashIndex]; - mVecIndex = 0; - } + while (!mEntry && (mHashIndex < (SimFieldDictionary::HashTableSize - 1))) + mEntry = mDictionary->mHashTable[++mHashIndex]; - if (mVecIndex >= vec.size() || mHashIndex >= SimFieldDictionary::HashTableSize) - { - mEntry = NULL; - return NULL; - } - - mEntry = &vec[mVecIndex]; - ++mVecIndex; - return mEntry; + return(mEntry); } SimFieldDictionary::Entry* SimFieldDictionaryIterator::operator*() { - return mEntry; + return(mEntry); } - // A variation of the stock SimFieldDictionary::setFieldValue(), this method adds the // argument which, when true, prohibits the replacement of fields that // already have a value. @@ -389,13 +385,13 @@ void SimFieldDictionary::setFieldValue(StringTableEntry slotName, const char *va return; U32 bucket = getHashValue(slotName); - for (const Entry &walk : mHashTable[bucket]) - { - if (walk.slotName == slotName) - { - return; - } - } + Entry **walk = &mHashTable[bucket]; + while (*walk && (*walk)->slotName != slotName) + walk = &((*walk)->next); + + Entry *field = *walk; + if (field) + return; addEntry(bucket, slotName, type, dStrdup(value)); } @@ -417,22 +413,14 @@ void SimFieldDictionary::assignFrom(SimFieldDictionary *dict, const char* filter if (filter_len == 0) { for (U32 i = 0; i < HashTableSize; i++) - { - for (const Entry &walk : dict->mHashTable[i]) - { - setFieldValue(walk.slotName, walk.value, walk.type, no_replace); - } - } + for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next) + setFieldValue(walk->slotName, walk->value, walk->type, no_replace); } else { for (U32 i = 0; i < HashTableSize; i++) - { - for (const Entry &walk : dict->mHashTable[i]) - { - if (dStrncmp(walk.slotName, filter, filter_len) == 0) - setFieldValue(walk.slotName, walk.value, walk.type, no_replace); - } - } + for (Entry *walk = dict->mHashTable[i]; walk; walk = walk->next) + if (dStrncmp(walk->slotName, filter, filter_len) == 0) + setFieldValue(walk->slotName, walk->value, walk->type, no_replace); } } \ No newline at end of file diff --git a/Engine/source/console/simFieldDictionary.h b/Engine/source/console/simFieldDictionary.h index 4c9d86e4e..c89bd5b57 100644 --- a/Engine/source/console/simFieldDictionary.h +++ b/Engine/source/console/simFieldDictionary.h @@ -32,9 +32,6 @@ class ConsoleBaseType; class SimObject; -#include -#include - #include "core/stringTable.h" #include "core/stream/stream.h" @@ -54,17 +51,18 @@ public: StringTableEntry slotName; char *value; + Entry *next; ConsoleBaseType *type; }; enum { HashTableSize = 19 }; - //Entry *mHashTable[HashTableSize]; - - std::vector mHashTable[HashTableSize]; + Entry *mHashTable[HashTableSize]; private: + static Entry *smFreeList; + void freeEntry(Entry *entry); Entry* addEntry(U32 bucket, StringTableEntry slotName, ConsoleBaseType* type, char* value = 0); @@ -105,7 +103,6 @@ class SimFieldDictionaryIterator { SimFieldDictionary * mDictionary; S32 mHashIndex; - S32 mVecIndex; SimFieldDictionary::Entry * mEntry; public: @@ -115,4 +112,4 @@ public: }; -#endif // _SIMFIELDDICTIONARY_H_ +#endif // _SIMFIELDDICTIONARY_H_ \ No newline at end of file diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index 762edcb94..f364ed0ce 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -82,635 +82,637 @@ //----------------------------------------------------------------------------- -IMPLEMENT_CONOBJECT( Taml ); +IMPLEMENT_CONOBJECT(Taml); //----------------------------------------------------------------------------- -StringTableEntry tamlRefIdName = StringTable->insert( "TamlId" ); -StringTableEntry tamlRefToIdName = StringTable->insert( "TamlRefId" ); -StringTableEntry tamlNamedObjectName = StringTable->insert( "Name" ); +StringTableEntry tamlRefIdName = StringTable->insert("TamlId"); +StringTableEntry tamlRefToIdName = StringTable->insert("TamlRefId"); +StringTableEntry tamlNamedObjectName = StringTable->insert("Name"); //----------------------------------------------------------------------------- typedef Taml::TamlFormatMode _TamlFormatMode; -ImplementEnumType( _TamlFormatMode, +ImplementEnumType(_TamlFormatMode, "") - { Taml::XmlFormat, "xml" }, - { Taml::BinaryFormat, "binary" }//, - //{ Taml::JSONFormat, "json" } -EndImplementEnumType; - -//----------------------------------------------------------------------------- - -Taml::TamlFormatMode Taml::getFormatModeEnum(const char* label) { - // Search for Mnemonic. - for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) - { - if( dStricmp(__TamlFormatMode::_sEnumTable[i].getName(), label) == 0) - return (TamlFormatMode)__TamlFormatMode::_sEnumTable[i].getInt(); - } + Taml::XmlFormat, "xml" +}, +{ Taml::BinaryFormat, "binary" }//, + //{ Taml::JSONFormat, "json" } + EndImplementEnumType; - // Warn. - Con::warnf( "Taml::getFormatModeEnum() - Invalid format of '%s'.", label ); + //----------------------------------------------------------------------------- - return Taml::InvalidFormat; -} + Taml::TamlFormatMode Taml::getFormatModeEnum(const char* label) + { + // Search for Mnemonic. + for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) + { + if (dStricmp(__TamlFormatMode::_sEnumTable[i].getName(), label) == 0) + return (TamlFormatMode)__TamlFormatMode::_sEnumTable[i].getInt(); + } -//----------------------------------------------------------------------------- + // Warn. + Con::warnf("Taml::getFormatModeEnum() - Invalid format of '%s'.", label); -const char* Taml::getFormatModeDescription(const Taml::TamlFormatMode formatMode) -{ - // Search for Mnemonic. - for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) - { - if( __TamlFormatMode::_sEnumTable[i].getInt() == (S32)formatMode ) - return __TamlFormatMode::_sEnumTable[i].getName(); - } + return Taml::InvalidFormat; + } - // Warn. - Con::warnf( "Taml::getFormatModeDescription() - Invalid format mode." ); + //----------------------------------------------------------------------------- - return StringTable->EmptyString(); -} + const char* Taml::getFormatModeDescription(const Taml::TamlFormatMode formatMode) + { + // Search for Mnemonic. + for (U32 i = 0; i < (sizeof(__TamlFormatMode::_sEnums) / sizeof(EnumTable::Value)); i++) + { + if (__TamlFormatMode::_sEnumTable[i].getInt() == (S32)formatMode) + return __TamlFormatMode::_sEnumTable[i].getName(); + } -//----------------------------------------------------------------------------- + // Warn. + Con::warnf("Taml::getFormatModeDescription() - Invalid format mode."); -// The string-table-entries are set to string literals below because Taml is used in a static scope and the string-table cannot currently be used like that. -Taml::Taml() : - mFormatMode(XmlFormat), - mJSONStrict( true ), - mBinaryCompression(true), - mWriteDefaults(false), - mAutoFormatXmlExtension("taml"), - mAutoFormat(true), - mProgenitorUpdate(true), - mAutoFormatBinaryExtension("baml"), - mAutoFormatJSONExtension("json") -{ - // Reset the file-path buffer. - mFilePathBuffer[0] = 0; -} + return StringTable->EmptyString(); + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::initPersistFields() -{ - // Call parent. - Parent::initPersistFields(); + // The string-table-entries are set to string literals below because Taml is used in a static scope and the string-table cannot currently be used like that. + Taml::Taml() : + mFormatMode(XmlFormat), + mJSONStrict(true), + mBinaryCompression(true), + mWriteDefaults(false), + mAutoFormatXmlExtension("taml"), + mAutoFormat(true), + mProgenitorUpdate(true), + mAutoFormatBinaryExtension("baml"), + mAutoFormatJSONExtension("json") + { + // Reset the file-path buffer. + mFilePathBuffer[0] = 0; + } - addField("Format", TYPEID<_TamlFormatMode>(), Offset(mFormatMode, Taml), "The read/write format that should be used."); - addField("JSONStrict", TypeBool, Offset(mBinaryCompression, Taml), "Whether to write JSON that is strictly compatible with RFC4627 or not.\n"); - addField("BinaryCompression", TypeBool, Offset(mBinaryCompression, Taml), "Whether ZIP compression is used on binary formatting or not.\n"); - addField("WriteDefaults", TypeBool, Offset(mWriteDefaults, Taml), "Whether to write static fields that are at their default or not.\n"); - addField("ProgenitorUpdate", TypeBool, Offset(mProgenitorUpdate, Taml), "Whether to update each type instances file-progenitor or not.\n"); - addField("AutoFormat", TypeBool, Offset(mAutoFormat, Taml), "Whether the format type is automatically determined by the filename extension or not.\n"); - addField("AutoFormatXmlExtension", TypeString, Offset(mAutoFormatXmlExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the XML format.\n"); - addField("AutoFormatBinaryExtension", TypeString, Offset(mAutoFormatBinaryExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the BINARY format.\n"); - addField("AutoFormatJSONExtension", TypeString, Offset(mAutoFormatJSONExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the JSON format.\n"); -} + //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + void Taml::initPersistFields() + { + // Call parent. + Parent::initPersistFields(); -bool Taml::onAdd() -{ - // Call parent. - if ( !Parent::onAdd() ) - return false; + addField("Format", TYPEID<_TamlFormatMode>(), Offset(mFormatMode, Taml), "The read/write format that should be used."); + addField("JSONStrict", TypeBool, Offset(mBinaryCompression, Taml), "Whether to write JSON that is strictly compatible with RFC4627 or not.\n"); + addField("BinaryCompression", TypeBool, Offset(mBinaryCompression, Taml), "Whether ZIP compression is used on binary formatting or not.\n"); + addField("WriteDefaults", TypeBool, Offset(mWriteDefaults, Taml), "Whether to write static fields that are at their default or not.\n"); + addField("ProgenitorUpdate", TypeBool, Offset(mProgenitorUpdate, Taml), "Whether to update each type instances file-progenitor or not.\n"); + addField("AutoFormat", TypeBool, Offset(mAutoFormat, Taml), "Whether the format type is automatically determined by the filename extension or not.\n"); + addField("AutoFormatXmlExtension", TypeString, Offset(mAutoFormatXmlExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the XML format.\n"); + addField("AutoFormatBinaryExtension", TypeString, Offset(mAutoFormatBinaryExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the BINARY format.\n"); + addField("AutoFormatJSONExtension", TypeString, Offset(mAutoFormatJSONExtension, Taml), "When using auto-format, this is the extension (end of filename) used to detect the JSON format.\n"); + } - // Set JSON strict mode. - mJSONStrict = Con::getBoolVariable( TAML_JSON_STRICT_VARIBLE, true ); + //----------------------------------------------------------------------------- - // Reset the compilation. - resetCompilation(); + bool Taml::onAdd() + { + // Call parent. + if (!Parent::onAdd()) + return false; - return true; -} + // Set JSON strict mode. + mJSONStrict = Con::getBoolVariable(TAML_JSON_STRICT_VARIBLE, true); -//----------------------------------------------------------------------------- + // Reset the compilation. + resetCompilation(); -void Taml::onRemove() -{ - // Reset the compilation. - resetCompilation(); + return true; + } - // Call parent. - Parent::onRemove(); -} + //----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- + void Taml::onRemove() + { + // Reset the compilation. + resetCompilation(); -bool Taml::write( SimObject* pSimObject, const char* pFilename ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_Write); + // Call parent. + Parent::onRemove(); + } - // Sanity! - AssertFatal( pSimObject != NULL, "Cannot write a NULL object." ); - AssertFatal( pFilename != NULL, "Cannot write to a NULL filename." ); + //----------------------------------------------------------------------------- - // Expand the file-name into the file-path buffer. - Con::expandToolScriptFilename( mFilePathBuffer, sizeof(mFilePathBuffer), pFilename ); + bool Taml::write(SimObject* pSimObject, const char* pFilename) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_Write); - FileStream stream; + // Sanity! + AssertFatal(pSimObject != NULL, "Cannot write a NULL object."); + AssertFatal(pFilename != NULL, "Cannot write to a NULL filename."); - // File opened? - if ( !stream.open( mFilePathBuffer, Torque::FS::File::Write ) ) - { - // No, so warn. - Con::warnf("Taml::writeFile() - Could not open filename '%s' for write.", mFilePathBuffer ); - return false; - } + // Expand the file-name into the file-path buffer. + Con::expandToolScriptFilename(mFilePathBuffer, sizeof(mFilePathBuffer), pFilename); - // Get the file auto-format mode. - const TamlFormatMode formatMode = getFileAutoFormatMode( mFilePathBuffer ); + FileStream stream; - // Reset the compilation. - resetCompilation(); + // File opened? + if (!stream.open(mFilePathBuffer, Torque::FS::File::Write)) + { + // No, so warn. + Con::warnf("Taml::writeFile() - Could not open filename '%s' for write.", mFilePathBuffer); + return false; + } - // Write object. - const bool status = write( stream, pSimObject, formatMode ); + // Get the file auto-format mode. + const TamlFormatMode formatMode = getFileAutoFormatMode(mFilePathBuffer); - // Close file. - stream.close(); + // Reset the compilation. + resetCompilation(); - // Reset the compilation. - resetCompilation(); + // Write object. + const bool status = write(stream, pSimObject, formatMode); - return status; -} + // Close file. + stream.close(); -//----------------------------------------------------------------------------- + // Reset the compilation. + resetCompilation(); -SimObject* Taml::read( const char* pFilename ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_Read); + return status; + } - // Sanity! - AssertFatal( pFilename != NULL, "Cannot read from a NULL filename." ); + //----------------------------------------------------------------------------- - // Expand the file-name into the file-path buffer. - Con::expandToolScriptFilename( mFilePathBuffer, sizeof(mFilePathBuffer), pFilename ); + SimObject* Taml::read(const char* pFilename) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_Read); - FileStream stream; + // Sanity! + AssertFatal(pFilename != NULL, "Cannot read from a NULL filename."); - // File opened? - if ( !stream.open( mFilePathBuffer, Torque::FS::File::Read ) ) - { - // No, so warn. - Con::warnf("Taml::read() - Could not open filename '%s' for read.", mFilePathBuffer ); - return NULL; - } + // Expand the file-name into the file-path buffer. + Con::expandToolScriptFilename(mFilePathBuffer, sizeof(mFilePathBuffer), pFilename); - // Get the file auto-format mode. - const TamlFormatMode formatMode = getFileAutoFormatMode( mFilePathBuffer ); + FileStream stream; - // Reset the compilation. - resetCompilation(); + // File opened? + if (!stream.open(mFilePathBuffer, Torque::FS::File::Read)) + { + // No, so warn. + Con::warnf("Taml::read() - Could not open filename '%s' for read.", mFilePathBuffer); + return NULL; + } - // Write object. - SimObject* pSimObject = read( stream, formatMode ); + // Get the file auto-format mode. + const TamlFormatMode formatMode = getFileAutoFormatMode(mFilePathBuffer); - // Close file. - stream.close(); + // Reset the compilation. + resetCompilation(); - // Reset the compilation. - resetCompilation(); + // Write object. + SimObject* pSimObject = read(stream, formatMode); - // Did we generate an object? - if ( pSimObject == NULL ) - { - // No, so warn. - Con::warnf( "Taml::read() - Failed to load an object from the file '%s'.", mFilePathBuffer ); - } - else - { - pSimObject->onPostAdd(); - } + // Close file. + stream.close(); - return pSimObject; -} + // Reset the compilation. + resetCompilation(); -//----------------------------------------------------------------------------- + // Did we generate an object? + if (pSimObject == NULL) + { + // No, so warn. + Con::warnf("Taml::read() - Failed to load an object from the file '%s'.", mFilePathBuffer); + } + else + { + pSimObject->onPostAdd(); + } -bool Taml::write( FileStream& stream, SimObject* pSimObject, const TamlFormatMode formatMode ) -{ - // Sanity! - AssertFatal( pSimObject != NULL, "Cannot write a NULL object." ); + return pSimObject; + } - // Compile nodes. - TamlWriteNode* pRootNode = compileObject( pSimObject ); + //----------------------------------------------------------------------------- - // Format appropriately. - switch( formatMode ) - { - /// Xml. - case XmlFormat: - { - // Create writer. - TamlXmlWriter writer( this ); - // Write. - return writer.write( stream, pRootNode ); - } + bool Taml::write(FileStream& stream, SimObject* pSimObject, const TamlFormatMode formatMode) + { + // Sanity! + AssertFatal(pSimObject != NULL, "Cannot write a NULL object."); - /// Binary. - case BinaryFormat: - { - // Create writer. - TamlBinaryWriter writer( this ); + // Compile nodes. + TamlWriteNode* pRootNode = compileObject(pSimObject); - // Write. - return writer.write( stream, pRootNode, mBinaryCompression ); - } + // Format appropriately. + switch (formatMode) + { + /// Xml. + case XmlFormat: + { + // Create writer. + TamlXmlWriter writer(this); + // Write. + return writer.write(stream, pRootNode); + } - /// JSON. - case JSONFormat: - { - // Create writer. - //TamlJSONWriter writer( this ); + /// Binary. + case BinaryFormat: + { + // Create writer. + TamlBinaryWriter writer(this); - // Write. - //return writer.write( stream, pRootNode ); - return NULL; - } + // Write. + return writer.write(stream, pRootNode, mBinaryCompression); + } - /// Invalid. - case InvalidFormat: - { - // Warn. - Con::warnf("Taml::write() - Cannot write, invalid format."); + /// JSON. + case JSONFormat: + { + // Create writer. + //TamlJSONWriter writer( this ); + + // Write. + //return writer.write( stream, pRootNode ); + return NULL; + } + + /// Invalid. + case InvalidFormat: + { + // Warn. + Con::warnf("Taml::write() - Cannot write, invalid format."); + return false; + } + } + + // Warn. + Con::warnf("Taml::write() - Unknown format."); + return false; + } + + //----------------------------------------------------------------------------- + + SimObject* Taml::read(FileStream& stream, const TamlFormatMode formatMode) + { + // Format appropriately. + switch (formatMode) + { + /// Xml. + case XmlFormat: + { + // Create reader. + TamlXmlReader reader(this); + + // Read. + return reader.read(stream); + } + + /// Binary. + case BinaryFormat: + { + // Create reader. + TamlBinaryReader reader(this); + + // Read. + return reader.read(stream); + } + + /// JSON. + case JSONFormat: + { + // Create reader. + //TamlJSONReader reader( this ); + + // Read. + //return reader.read( stream ); + return NULL; + } + + /// Invalid. + case InvalidFormat: + { + // Warn. + Con::warnf("Taml::read() - Cannot read, invalid format."); + return NULL; + } + } + + // Warn. + Con::warnf("Taml::read() - Unknown format."); + return NULL; + } + + //----------------------------------------------------------------------------- + + bool Taml::parse(const char* pFilename, TamlVisitor& visitor) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_Parse); + + // Sanity! + AssertFatal(pFilename != NULL, "Taml::parse() - Cannot parse a NULL filename."); + + // Fetch format mode. + const TamlFormatMode formatMode = getFileAutoFormatMode(pFilename); + + // Handle format mode appropriately. + switch (formatMode) + { + case XmlFormat: + { + // Parse with the visitor. + TamlXmlParser parser; + + // Are property changes needed but not supported? + if (visitor.wantsPropertyChanges() && !parser.canChangeProperty()) + { + // Yes, so warn. + Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename); return false; - } - } + } - // Warn. - Con::warnf("Taml::write() - Unknown format."); - return false; -} + return parser.accept(pFilename, visitor); + } -//----------------------------------------------------------------------------- + case JSONFormat: + { + // Parse with the visitor. + /*TamlJSONParser parser; -SimObject* Taml::read( FileStream& stream, const TamlFormatMode formatMode ) -{ - // Format appropriately. - switch( formatMode ) - { - /// Xml. - case XmlFormat: - { - // Create reader. - TamlXmlReader reader( this ); + // Are property changes needed but not supported? + if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() ) + { + // Yes, so warn. + Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename ); + return false; + } - // Read. - return reader.read( stream ); - } + return parser.accept( pFilename, visitor ); */ + return false; + } - /// Binary. - case BinaryFormat: - { - // Create reader. - TamlBinaryReader reader( this ); + case BinaryFormat: + default: + break; + } - // Read. - return reader.read( stream ); - } + // Warn. + Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a required parser is not available.", getFormatModeDescription(formatMode), pFilename); + return false; + } - /// JSON. - case JSONFormat: - { - // Create reader. - //TamlJSONReader reader( this ); + //----------------------------------------------------------------------------- - // Read. - //return reader.read( stream ); - return NULL; - } - - /// Invalid. - case InvalidFormat: - { - // Warn. - Con::warnf("Taml::read() - Cannot read, invalid format."); - return NULL; - } - } + void Taml::resetCompilation(void) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_ResetCompilation); - // Warn. - Con::warnf("Taml::read() - Unknown format."); - return NULL; -} + // Clear compiled nodes. + for (typeNodeVector::iterator itr = mCompiledNodes.begin(); itr != mCompiledNodes.end(); ++itr) + { + // Fetch node. + TamlWriteNode* pNode = (*itr); -//----------------------------------------------------------------------------- + // Reset node. + pNode->resetNode(); -bool Taml::parse( const char* pFilename, TamlVisitor& visitor ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_Parse); + // Delete node. + delete pNode; + } + mCompiledNodes.clear(); - // Sanity! - AssertFatal( pFilename != NULL, "Taml::parse() - Cannot parse a NULL filename." ); + // Clear compiled objects. + mCompiledObjects.clear(); - // Fetch format mode. - const TamlFormatMode formatMode = getFileAutoFormatMode( pFilename ); + // Reset master node Id. + mMasterNodeId = 0; + } - // Handle format mode appropriately. - switch( formatMode ) - { - case XmlFormat: - { - // Parse with the visitor. - TamlXmlParser parser; + //----------------------------------------------------------------------------- - // Are property changes needed but not supported? - if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() ) - { - // Yes, so warn. - Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename ); - return false; - } + Taml::TamlFormatMode Taml::getFileAutoFormatMode(const char* pFilename) + { + // Sanity! + AssertFatal(pFilename != NULL, "Taml::getFileAutoFormatMode() - Cannot auto-format using a NULL filename."); - return parser.accept( pFilename, visitor ); - } + // Is auto-format active? + if (mAutoFormat) + { + // Yes, so fetch the extension lengths. + const U32 xmlExtensionLength = dStrlen(mAutoFormatXmlExtension); + const U32 binaryExtensionLength = dStrlen(mAutoFormatBinaryExtension); + const U32 jsonExtensionLength = dStrlen(mAutoFormatJSONExtension); - case JSONFormat: - { - // Parse with the visitor. - /*TamlJSONParser parser; + // Fetch filename length. + const U32 filenameLength = dStrlen(pFilename); - // Are property changes needed but not supported? - if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() ) - { - // Yes, so warn. - Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename ); - return false; - } + // Fetch end of filename, + const char* pEndOfFilename = pFilename + filenameLength; - return parser.accept( pFilename, visitor ); */ - return false; - } - - case BinaryFormat: - default: - break; - } - - // Warn. - Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a required parser is not available.", getFormatModeDescription(formatMode), pFilename ); - return false; -} - -//----------------------------------------------------------------------------- - -void Taml::resetCompilation( void ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_ResetCompilation); - - // Clear compiled nodes. - for( typeNodeVector::iterator itr = mCompiledNodes.begin(); itr != mCompiledNodes.end(); ++itr ) - { - // Fetch node. - TamlWriteNode* pNode = (*itr); - - // Reset node. - pNode->resetNode(); - - // Delete node. - delete pNode; - } - mCompiledNodes.clear(); - - // Clear compiled objects. - mCompiledObjects.clear(); - - // Reset master node Id. - mMasterNodeId = 0; -} - -//----------------------------------------------------------------------------- - -Taml::TamlFormatMode Taml::getFileAutoFormatMode( const char* pFilename ) -{ - // Sanity! - AssertFatal( pFilename != NULL, "Taml::getFileAutoFormatMode() - Cannot auto-format using a NULL filename." ); - - // Is auto-format active? - if ( mAutoFormat ) - { - // Yes, so fetch the extension lengths. - const U32 xmlExtensionLength = dStrlen( mAutoFormatXmlExtension ); - const U32 binaryExtensionLength = dStrlen( mAutoFormatBinaryExtension ); - const U32 jsonExtensionLength = dStrlen( mAutoFormatJSONExtension ); - - // Fetch filename length. - const U32 filenameLength = dStrlen( pFilename ); - - // Fetch end of filename, - const char* pEndOfFilename = pFilename + filenameLength; - - // Check for the XML format. - if ( xmlExtensionLength <= filenameLength && dStricmp( pEndOfFilename - xmlExtensionLength, mAutoFormatXmlExtension ) == 0 ) + // Check for the XML format. + if (xmlExtensionLength <= filenameLength && dStricmp(pEndOfFilename - xmlExtensionLength, mAutoFormatXmlExtension) == 0) return Taml::XmlFormat; - // Check for the Binary format. - if ( binaryExtensionLength <= filenameLength && dStricmp( pEndOfFilename - xmlExtensionLength, mAutoFormatBinaryExtension ) == 0 ) - return Taml::BinaryFormat; + // Check for the Binary format. + if (binaryExtensionLength <= filenameLength && dStricmp(pEndOfFilename - xmlExtensionLength, mAutoFormatBinaryExtension) == 0) + return Taml::BinaryFormat; - // Check for the XML format. - if ( jsonExtensionLength <= filenameLength && dStricmp( pEndOfFilename - jsonExtensionLength, mAutoFormatJSONExtension ) == 0 ) + // Check for the XML format. + if (jsonExtensionLength <= filenameLength && dStricmp(pEndOfFilename - jsonExtensionLength, mAutoFormatJSONExtension) == 0) return Taml::JSONFormat; - } + } - // Use the explicitly specified format mode. - return mFormatMode; -} + // Use the explicitly specified format mode. + return mFormatMode; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -TamlWriteNode* Taml::compileObject( SimObject* pSimObject, const bool forceId ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileObject); + TamlWriteNode* Taml::compileObject(SimObject* pSimObject, const bool forceId) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileObject); - // Sanity! - AssertFatal( pSimObject != NULL, "Taml::compileObject() - Cannot compile a NULL object." ); + // Sanity! + AssertFatal(pSimObject != NULL, "Taml::compileObject() - Cannot compile a NULL object."); - // Fetch object Id. - const SimObjectId objectId = pSimObject->getId(); + // Fetch object Id. + const SimObjectId objectId = pSimObject->getId(); - // Find a previously compiled node. - typeCompiledHash::Iterator compiledItr = mCompiledObjects.find( objectId ); + // Find a previously compiled node. + typeCompiledHash::Iterator compiledItr = mCompiledObjects.find(objectId); - // Have we already compiled this? - if ( compiledItr != mCompiledObjects.end() ) - { - // Yes, so sanity! - AssertFatal( mCompiledNodes.size() != 0, "Taml::compileObject() - Found a compiled node at the root." ); + // Have we already compiled this? + if (compiledItr != mCompiledObjects.end()) + { + // Yes, so sanity! + AssertFatal(mCompiledNodes.size() != 0, "Taml::compileObject() - Found a compiled node at the root."); - // Yes, so fetch node. - TamlWriteNode* compiledNode = compiledItr->value; + // Yes, so fetch node. + TamlWriteNode* compiledNode = compiledItr->value; - // Is a reference Id already present? - if ( compiledNode->mRefId == 0 ) - { + // Is a reference Id already present? + if (compiledNode->mRefId == 0) + { // No, so allocate one. compiledNode->mRefId = ++mMasterNodeId; - } + } - // Create write node. - TamlWriteNode* pNewNode = new TamlWriteNode(); - pNewNode->set( pSimObject ); + // Create write node. + TamlWriteNode* pNewNode = new TamlWriteNode(); + pNewNode->set(pSimObject); - // Set reference node. - pNewNode->mRefToNode = compiledNode; + // Set reference node. + pNewNode->mRefToNode = compiledNode; - // Push new node. - mCompiledNodes.push_back( pNewNode ); + // Push new node. + mCompiledNodes.push_back(pNewNode); - return pNewNode; - } + return pNewNode; + } - // No, so create write node. - TamlWriteNode* pNewNode = new TamlWriteNode(); - pNewNode->set( pSimObject ); + // No, so create write node. + TamlWriteNode* pNewNode = new TamlWriteNode(); + pNewNode->set(pSimObject); - // Is an Id being forced for this object? - if ( forceId ) - { - // Yes, so allocate one. - pNewNode->mRefId = ++mMasterNodeId; - } + // Is an Id being forced for this object? + if (forceId) + { + // Yes, so allocate one. + pNewNode->mRefId = ++mMasterNodeId; + } - // Push new node. - mCompiledNodes.push_back( pNewNode ); + // Push new node. + mCompiledNodes.push_back(pNewNode); - // Insert compiled object. - mCompiledObjects.insertUnique( objectId, pNewNode ); + // Insert compiled object. + mCompiledObjects.insertUnique(objectId, pNewNode); - // Are there any Taml callbacks? - if ( pNewNode->mpTamlCallbacks != NULL ) - { - // Yes, so call it. - tamlPreWrite( pNewNode->mpTamlCallbacks ); - } + // Are there any Taml callbacks? + if (pNewNode->mpTamlCallbacks != NULL) + { + // Yes, so call it. + tamlPreWrite(pNewNode->mpTamlCallbacks); + } - // Compile static and dynamic fields. - compileStaticFields( pNewNode ); - compileDynamicFields( pNewNode ); + // Compile static and dynamic fields. + compileStaticFields(pNewNode); + compileDynamicFields(pNewNode); - // Compile children. - compileChildren( pNewNode ); + // Compile children. + compileChildren(pNewNode); - // Compile custom state. - compileCustomState( pNewNode ); + // Compile custom state. + compileCustomState(pNewNode); - // Are there any Taml callbacks? - if ( pNewNode->mpTamlCallbacks != NULL ) - { - // Yes, so call it. - tamlPostWrite( pNewNode->mpTamlCallbacks ); - } + // Are there any Taml callbacks? + if (pNewNode->mpTamlCallbacks != NULL) + { + // Yes, so call it. + tamlPostWrite(pNewNode->mpTamlCallbacks); + } - return pNewNode; -} + return pNewNode; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::compileStaticFields( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileStaticFields); + void Taml::compileStaticFields(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileStaticFields); - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile static fields on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile static fields on a node with no object." ); + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile static fields on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile static fields on a node with no object."); - // Fetch object. - SimObject* pSimObject = pTamlWriteNode->mpSimObject; + // Fetch object. + SimObject* pSimObject = pTamlWriteNode->mpSimObject; - // Fetch field list. - const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); + // Fetch field list. + const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); - // Fetch field count. - const U32 fieldCount = fieldList.size(); + // Fetch field count. + const U32 fieldCount = fieldList.size(); - // Iterate fields. - U8 arrayDepth = 0; - TamlCustomNode* currentArrayNode; - for( U32 index = 0; index < fieldCount; ++index ) - { - // Fetch field. - const AbstractClassRep::Field* pField = &fieldList[index]; + // Iterate fields. + U8 arrayDepth = 0; + TamlCustomNode* currentArrayNode; + for (U32 index = 0; index < fieldCount; ++index) + { + // Fetch field. + const AbstractClassRep::Field* pField = &fieldList[index]; - // Ignore if field not appropriate. - if( pField->type == AbstractClassRep::DeprecatedFieldType || + // Ignore if field not appropriate. + if (pField->type == AbstractClassRep::DeprecatedFieldType || pField->type == AbstractClassRep::StartGroupFieldType || - pField->type == AbstractClassRep::EndGroupFieldType ) + pField->type == AbstractClassRep::EndGroupFieldType) continue; - if( pField->type == AbstractClassRep::StartArrayFieldType ) - { - TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; - currentArrayNode = pCustomNodes.addNode(pField->pGroupname); - for(U16 idx = 0; idx < pField->elementCount; idx++) - currentArrayNode->addNode(pField->pFieldname); - arrayDepth++; - continue; - } + if (pField->type == AbstractClassRep::StartArrayFieldType) + { + TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; + currentArrayNode = pCustomNodes.addNode(pField->pGroupname); + for (U16 idx = 0; idx < pField->elementCount; idx++) + currentArrayNode->addNode(pField->pFieldname); + arrayDepth++; + continue; + } - if( pField->type == AbstractClassRep::EndArrayFieldType ) - { - arrayDepth--; - continue; - } + if (pField->type == AbstractClassRep::EndArrayFieldType) + { + arrayDepth--; + continue; + } - if(arrayDepth == 0 && pField->elementCount > 1) - { - TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; - char* niceFieldName = const_cast(pField->pFieldname); - niceFieldName[0] = dToupper(niceFieldName[0]); - String str_niceFieldName = String(niceFieldName); - currentArrayNode = pCustomNodes.addNode(str_niceFieldName + "s"); - for(U16 idx = 0; idx < pField->elementCount; idx++) - currentArrayNode->addNode(str_niceFieldName); - } + if (arrayDepth == 0 && pField->elementCount > 1) + { + TamlCustomNodes& pCustomNodes = pTamlWriteNode->mCustomNodes; + char* niceFieldName = const_cast(pField->pFieldname); + niceFieldName[0] = dToupper(niceFieldName[0]); + String str_niceFieldName = String(niceFieldName); + currentArrayNode = pCustomNodes.addNode(str_niceFieldName + "s"); + for (U16 idx = 0; idx < pField->elementCount; idx++) + currentArrayNode->addNode(str_niceFieldName); + } - // Fetch fieldname. - StringTableEntry fieldName = StringTable->insert( pField->pFieldname ); + // Fetch fieldname. + StringTableEntry fieldName = StringTable->insert(pField->pFieldname); - // Fetch element count. - const U32 elementCount = pField->elementCount; + // Fetch element count. + const U32 elementCount = pField->elementCount; - // Skip if the field should not be written. - // For now, we only deal with non-array fields. - if ( elementCount == 1 && - pField->setDataFn != NULL && - ( !getWriteDefaults() && pField->writeDataFn( pSimObject, fieldName ) == false) ) + // Skip if the field should not be written. + // For now, we only deal with non-array fields. + if (elementCount == 1 && + pField->setDataFn != NULL && + (!getWriteDefaults() && pField->writeDataFn(pSimObject, fieldName) == false)) continue; - // Iterate elements. - for( U32 elementIndex = 0; elementIndex < elementCount; ++elementIndex ) - { + // Iterate elements. + for (U32 elementIndex = 0; elementIndex < elementCount; ++elementIndex) + { char indexBuffer[8]; - dSprintf( indexBuffer, 8, "%d", elementIndex ); + dSprintf(indexBuffer, 8, "%d", elementIndex); // Fetch object field value. const char* pFieldValue = pSimObject->getPrefixedDataField(fieldName, indexBuffer); - if(!pFieldValue) + if (!pFieldValue) pFieldValue = StringTable->EmptyString(); - if(pField->type == TypeBool) + if (pField->type == TypeBool) pFieldValue = dAtob(pFieldValue) ? "true" : "false"; - U32 nBufferSize = dStrlen( pFieldValue ) + 1; - FrameTemp valueCopy( nBufferSize ); - dStrcpy( (char *)valueCopy, pFieldValue ); + U32 nBufferSize = dStrlen(pFieldValue) + 1; + FrameTemp valueCopy(nBufferSize); + dStrcpy((char *)valueCopy, pFieldValue); // Skip if field should not be written. if (!pSimObject->writeField(fieldName, valueCopy)) - continue; + continue; // Reassign field value. pFieldValue = valueCopy; @@ -719,657 +721,660 @@ void Taml::compileStaticFields( TamlWriteNode* pTamlWriteNode ) char fnBuf[1024]; if ((S32)pField->type == TypeFilename) { - Con::collapseScriptFilename( fnBuf, 1024, pFieldValue ); - pFieldValue = fnBuf; + Con::collapseScriptFilename(fnBuf, 1024, pFieldValue); + pFieldValue = fnBuf; } // Save field/value. - if(arrayDepth > 0 || pField->elementCount > 1) + if (arrayDepth > 0 || pField->elementCount > 1) currentArrayNode->getChildren()[elementIndex]->addField(fieldName, pFieldValue); else { - TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair( fieldName, pFieldValue ); - pTamlWriteNode->mFields.push_back( pFieldValuePair ); + TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(fieldName, pFieldValue); + pTamlWriteNode->mFields.push_back(pFieldValuePair); } - } - } -} + } + } + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -static S32 QSORT_CALLBACK compareFieldEntries(const void* a,const void* b) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompareFieldEntries); + static S32 QSORT_CALLBACK compareFieldEntries(const void* a, const void* b) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompareFieldEntries); - SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a); - SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b); - return dStricmp(fa->slotName, fb->slotName); -} + SimFieldDictionary::Entry *fa = *((SimFieldDictionary::Entry **)a); + SimFieldDictionary::Entry *fb = *((SimFieldDictionary::Entry **)b); + return dStricmp(fa->slotName, fb->slotName); + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::compileDynamicFields( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileDynamicFields); + void Taml::compileDynamicFields(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileDynamicFields); - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile dynamic fields on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile dynamic fields on a node with no object." ); + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile dynamic fields on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile dynamic fields on a node with no object."); - // Fetch object. - SimObject* pSimObject = pTamlWriteNode->mpSimObject; + // Fetch object. + SimObject* pSimObject = pTamlWriteNode->mpSimObject; - // Fetch field dictionary. - SimFieldDictionary* pFieldDictionary = pSimObject->getFieldDictionary(); + // Fetch field dictionary. + SimFieldDictionary* pFieldDictionary = pSimObject->getFieldDictionary(); - // Ignore if not writing dynamic fields. - if ( !pFieldDictionary || !pSimObject->getCanSaveDynamicFields() ) - return; + // Ignore if not writing dynamic fields. + if (!pFieldDictionary || !pSimObject->getCanSaveDynamicFields()) + return; - // Fetch field list. - const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); + // Fetch field list. + const AbstractClassRep::FieldList& fieldList = pSimObject->getFieldList(); - // Fetch field count. - const U32 fieldCount = fieldList.size(); + // Fetch field count. + const U32 fieldCount = fieldList.size(); - Vector dynamicFieldList(__FILE__, __LINE__); + Vector dynamicFieldList(__FILE__, __LINE__); - // Ensure the dynamic field doesn't conflict with static field. - for( U32 hashIndex = 0; hashIndex < SimFieldDictionary::HashTableSize; ++hashIndex ) - { - for (const SimFieldDictionary::Entry &pEntry : pFieldDictionary->mHashTable[hashIndex]) - { + // Ensure the dynamic field doesn't conflict with static field. + for (U32 hashIndex = 0; hashIndex < SimFieldDictionary::HashTableSize; ++hashIndex) + { + for (SimFieldDictionary::Entry* pEntry = pFieldDictionary->mHashTable[hashIndex]; pEntry; pEntry = pEntry->next) + { // Iterate static fields. U32 fieldIndex; - for( fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex ) + for (fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex) { - if (fieldList[fieldIndex].pFieldname == pEntry.slotName) - break; + if (fieldList[fieldIndex].pFieldname == pEntry->slotName) + break; } // Skip if found. - if( fieldIndex != (U32)fieldList.size() ) - continue; + if (fieldIndex != (U32)fieldList.size()) + continue; // Skip if not writing field. - if (!pSimObject->writeField(pEntry.slotName, pEntry.value)) - continue; + if (!pSimObject->writeField(pEntry->slotName, pEntry->value)) + continue; - dynamicFieldList.push_back( pEntry ); - } - } + dynamicFieldList.push_back(pEntry); + } + } - // Sort Entries to prevent version control conflicts - if ( dynamicFieldList.size() > 1 ) - dQsort(dynamicFieldList.address(), dynamicFieldList.size(), sizeof(SimFieldDictionary::Entry), compareFieldEntries); + // Sort Entries to prevent version control conflicts + if (dynamicFieldList.size() > 1) + dQsort(dynamicFieldList.address(), dynamicFieldList.size(), sizeof(SimFieldDictionary::Entry*), compareFieldEntries); - // Save the fields. - for (const SimFieldDictionary::Entry &pEntry : dynamicFieldList) - { - // Save field/value. - TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(pEntry.slotName, pEntry.value); - pTamlWriteNode->mFields.push_back(pFieldValuePair); - } -} + // Save the fields. + for (Vector::iterator entryItr = dynamicFieldList.begin(); entryItr != dynamicFieldList.end(); ++entryItr) + { + // Fetch entry. + SimFieldDictionary::Entry* pEntry = *entryItr; -//----------------------------------------------------------------------------- + // Save field/value. + TamlWriteNode::FieldValuePair* pFieldValuePair = new TamlWriteNode::FieldValuePair(pEntry->slotName, pEntry->value); + pTamlWriteNode->mFields.push_back(pFieldValuePair); + } + } -void Taml::compileChildren( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileChildren); + //----------------------------------------------------------------------------- - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile children on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile children on a node with no object." ); + void Taml::compileChildren(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileChildren); - // Fetch object. - SimObject* pSimObject = pTamlWriteNode->mpSimObject; + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile children on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile children on a node with no object."); - // Fetch the Taml children. - TamlChildren* pChildren = dynamic_cast( pSimObject ); + // Fetch object. + SimObject* pSimObject = pTamlWriteNode->mpSimObject; - // Finish if object does not contain Taml children. - if ( pChildren == NULL || pChildren->getTamlChildCount() == 0 ) - return; + // Fetch the Taml children. + TamlChildren* pChildren = dynamic_cast(pSimObject); - // Create children vector. - pTamlWriteNode->mChildren = new typeNodeVector(); + // Finish if object does not contain Taml children. + if (pChildren == NULL || pChildren->getTamlChildCount() == 0) + return; - // Fetch the child count. - const U32 childCount = pChildren->getTamlChildCount(); + // Create children vector. + pTamlWriteNode->mChildren = new typeNodeVector(); - // Iterate children. - for ( U32 childIndex = 0; childIndex < childCount; childIndex++ ) - { - // Compile object. - TamlWriteNode* pChildTamlWriteNode = compileObject( pChildren->getTamlChild(childIndex) ); + // Fetch the child count. + const U32 childCount = pChildren->getTamlChildCount(); - // Save node. - pTamlWriteNode->mChildren->push_back( pChildTamlWriteNode ); - } -} + // Iterate children. + for (U32 childIndex = 0; childIndex < childCount; childIndex++) + { + // Compile object. + TamlWriteNode* pChildTamlWriteNode = compileObject(pChildren->getTamlChild(childIndex)); -//----------------------------------------------------------------------------- + // Save node. + pTamlWriteNode->mChildren->push_back(pChildTamlWriteNode); + } + } -void Taml::compileCustomState( TamlWriteNode* pTamlWriteNode ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CompileCustomProperties); + //----------------------------------------------------------------------------- - // Sanity! - AssertFatal( pTamlWriteNode != NULL, "Cannot compile custom state on a NULL node." ); - AssertFatal( pTamlWriteNode->mpSimObject != NULL, "Cannot compile custom state on a node with no object." ); + void Taml::compileCustomState(TamlWriteNode* pTamlWriteNode) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CompileCustomProperties); - // Fetch the custom node on the write node. - TamlCustomNodes& customNodes = pTamlWriteNode->mCustomNodes; + // Sanity! + AssertFatal(pTamlWriteNode != NULL, "Cannot compile custom state on a NULL node."); + AssertFatal(pTamlWriteNode->mpSimObject != NULL, "Cannot compile custom state on a node with no object."); - // Are there any Taml callbacks? - if ( pTamlWriteNode->mpTamlCallbacks != NULL ) - { - // Yes, so call it. - tamlCustomWrite( pTamlWriteNode->mpTamlCallbacks, customNodes ); - } + // Fetch the custom node on the write node. + TamlCustomNodes& customNodes = pTamlWriteNode->mCustomNodes; - // Fetch custom nodes. - const TamlCustomNodeVector& nodes = customNodes.getNodes(); + // Are there any Taml callbacks? + if (pTamlWriteNode->mpTamlCallbacks != NULL) + { + // Yes, so call it. + tamlCustomWrite(pTamlWriteNode->mpTamlCallbacks, customNodes); + } - // Finish if no custom nodes to process. - if ( nodes.size() == 0 ) - return; - - // Iterate custom properties. - for( TamlCustomNodeVector::const_iterator customNodesItr = nodes.begin(); customNodesItr != nodes.end(); ++customNodesItr ) - { - // Fetch the custom node. - TamlCustomNode* pCustomNode = *customNodesItr; + // Fetch custom nodes. + const TamlCustomNodeVector& nodes = customNodes.getNodes(); - // Compile custom node state. - compileCustomNodeState( pCustomNode ); - } -} + // Finish if no custom nodes to process. + if (nodes.size() == 0) + return; -//----------------------------------------------------------------------------- + // Iterate custom properties. + for (TamlCustomNodeVector::const_iterator customNodesItr = nodes.begin(); customNodesItr != nodes.end(); ++customNodesItr) + { + // Fetch the custom node. + TamlCustomNode* pCustomNode = *customNodesItr; -void Taml::compileCustomNodeState( TamlCustomNode* pCustomNode ) -{ - // Sanity! - AssertFatal( pCustomNode != NULL, "Taml: Cannot compile NULL custom node state." ); + // Compile custom node state. + compileCustomNodeState(pCustomNode); + } + } - // Fetch children. - const TamlCustomNodeVector& children = pCustomNode->getChildren(); + //----------------------------------------------------------------------------- - // Fetch proxy object. - SimObject* pProxyObject = pCustomNode->getProxyObject(false); + void Taml::compileCustomNodeState(TamlCustomNode* pCustomNode) + { + // Sanity! + AssertFatal(pCustomNode != NULL, "Taml: Cannot compile NULL custom node state."); - // Do we have a proxy object? - if ( pProxyObject != NULL ) - { - // Yes, so sanity! - AssertFatal( children.size() == 0, "Taml: Cannot compile a proxy object on a custom node that has children." ); + // Fetch children. + const TamlCustomNodeVector& children = pCustomNode->getChildren(); - // Yes, so compile it. - // NOTE: We force an Id for custom compiled objects so we guarantee an Id. The reason for this is fairly - // weak in that the XML parser currently has no way of distinguishing between a compiled object node - // and a custom node. If the node has an Id or an Id-Ref then it's obviously an object and should be parsed as such. - pCustomNode->setWriteNode( compileObject( pProxyObject, true ) ); - return; - } + // Fetch proxy object. + SimObject* pProxyObject = pCustomNode->getProxyObject(false); - // Finish if no children. - if ( children.size() == 0 ) - return; + // Do we have a proxy object? + if (pProxyObject != NULL) + { + // Yes, so sanity! + AssertFatal(children.size() == 0, "Taml: Cannot compile a proxy object on a custom node that has children."); - // Iterate children. - for( TamlCustomNodeVector::const_iterator childItr = children.begin(); childItr != children.end(); ++childItr ) - { - // Fetch shape node. - TamlCustomNode* pChildNode = *childItr; + // Yes, so compile it. + // NOTE: We force an Id for custom compiled objects so we guarantee an Id. The reason for this is fairly + // weak in that the XML parser currently has no way of distinguishing between a compiled object node + // and a custom node. If the node has an Id or an Id-Ref then it's obviously an object and should be parsed as such. + pCustomNode->setWriteNode(compileObject(pProxyObject, true)); + return; + } - // Compile the child. - compileCustomNodeState( pChildNode ); - } -} + // Finish if no children. + if (children.size() == 0) + return; -//----------------------------------------------------------------------------- + // Iterate children. + for (TamlCustomNodeVector::const_iterator childItr = children.begin(); childItr != children.end(); ++childItr) + { + // Fetch shape node. + TamlCustomNode* pChildNode = *childItr; -SimObject* Taml::createType( StringTableEntry typeName, const Taml* pTaml, const char* pProgenitorSuffix ) -{ - // Debug Profiling. - PROFILE_SCOPE(Taml_CreateType); + // Compile the child. + compileCustomNodeState(pChildNode); + } + } - typedef HashTable typeClassHash; - static typeClassHash mClassMap; + //----------------------------------------------------------------------------- - // Sanity! - AssertFatal( typeName != NULL, "Taml: Type cannot be NULL" ); + SimObject* Taml::createType(StringTableEntry typeName, const Taml* pTaml, const char* pProgenitorSuffix) + { + // Debug Profiling. + PROFILE_SCOPE(Taml_CreateType); - // Find type. - typeClassHash::Iterator typeItr = mClassMap.find( typeName ); + typedef HashTable typeClassHash; + static typeClassHash mClassMap; - // Found type? - if ( typeItr == mClassMap.end() ) - { - // No, so find type. - AbstractClassRep* pClassRep = AbstractClassRep::getClassList(); - while( pClassRep ) - { + // Sanity! + AssertFatal(typeName != NULL, "Taml: Type cannot be NULL"); + + // Find type. + typeClassHash::Iterator typeItr = mClassMap.find(typeName); + + // Found type? + if (typeItr == mClassMap.end()) + { + // No, so find type. + AbstractClassRep* pClassRep = AbstractClassRep::getClassList(); + while (pClassRep) + { // Is this the type? - if( dStricmp( pClassRep->getClassName(), typeName ) == 0 ) + if (dStricmp(pClassRep->getClassName(), typeName) == 0) { - // Yes, so insert it. - typeItr = mClassMap.insertUnique( typeName, pClassRep ); - break; + // Yes, so insert it. + typeItr = mClassMap.insertUnique(typeName, pClassRep); + break; } // Next type. pClassRep = pClassRep->getNextClass(); - } + } - // Did we find the type? - if ( typeItr == mClassMap.end() ) - { + // Did we find the type? + if (typeItr == mClassMap.end()) + { // No, so warn and fail. - Con::warnf( "Taml: Failed to create type '%s' as such a registered type could not be found.", typeName ); + Con::warnf("Taml: Failed to create type '%s' as such a registered type could not be found.", typeName); return NULL; - } - } + } + } - // Create the object. - ConsoleObject* pConsoleObject = typeItr->value->create(); + // Create the object. + ConsoleObject* pConsoleObject = typeItr->value->create(); - // NOTE: It is important that we don't register the object here as many objects rely on the fact that - // fields are set prior to the object being registered. Registering here will invalid those assumptions. + // NOTE: It is important that we don't register the object here as many objects rely on the fact that + // fields are set prior to the object being registered. Registering here will invalid those assumptions. - // Fetch the SimObject. - SimObject* pSimObject = dynamic_cast( pConsoleObject ); + // Fetch the SimObject. + SimObject* pSimObject = dynamic_cast(pConsoleObject); - // Was it a SimObject? - if ( pSimObject == NULL ) - { - // No, so warn. - Con::warnf( "Taml: Failed to create type '%s' as it is not a SimObject.", typeName ); + // Was it a SimObject? + if (pSimObject == NULL) + { + // No, so warn. + Con::warnf("Taml: Failed to create type '%s' as it is not a SimObject.", typeName); - // Destroy object and fail. - delete pConsoleObject; - return NULL; - } + // Destroy object and fail. + delete pConsoleObject; + return NULL; + } - // Are we updating the file-progenitor? - if ( pTaml->getProgenitorUpdate() ) - { - // Yes, so do we have a progenitor suffix? - if ( pProgenitorSuffix == NULL ) - { + // Are we updating the file-progenitor? + if (pTaml->getProgenitorUpdate()) + { + // Yes, so do we have a progenitor suffix? + if (pProgenitorSuffix == NULL) + { // No, so just set it to the progenitor file. - pSimObject->setProgenitorFile( pTaml->getFilePathBuffer() ); - } - else - { + pSimObject->setProgenitorFile(pTaml->getFilePathBuffer()); + } + else + { // Yes, so format the progenitor buffer. char progenitorBuffer[2048]; - dSprintf( progenitorBuffer, sizeof(progenitorBuffer), "%s,%s", pTaml->getFilePathBuffer(), pProgenitorSuffix ); + dSprintf(progenitorBuffer, sizeof(progenitorBuffer), "%s,%s", pTaml->getFilePathBuffer(), pProgenitorSuffix); // Set the progenitor file. - pSimObject->setProgenitorFile( progenitorBuffer ); - } - } + pSimObject->setProgenitorFile(progenitorBuffer); + } + } - return pSimObject; -} + return pSimObject; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -bool Taml::generateTamlSchema() -{ - // Fetch any TAML Schema file reference. - const char* pTamlSchemaFile = Con::getVariable( TAML_SCHEMA_VARIABLE ); + bool Taml::generateTamlSchema() + { + // Fetch any TAML Schema file reference. + const char* pTamlSchemaFile = Con::getVariable(TAML_SCHEMA_VARIABLE); - // Do we have a schema file reference? - if ( pTamlSchemaFile == NULL || *pTamlSchemaFile == 0 ) - { - // No, so warn. - Con::warnf( "Taml::generateTamlSchema() - Cannot write a TAML schema as no schema variable is set ('%s').", TAML_SCHEMA_VARIABLE ); - return false; - } + // Do we have a schema file reference? + if (pTamlSchemaFile == NULL || *pTamlSchemaFile == 0) + { + // No, so warn. + Con::warnf("Taml::generateTamlSchema() - Cannot write a TAML schema as no schema variable is set ('%s').", TAML_SCHEMA_VARIABLE); + return false; + } - // Expand the file-name into the file-path buffer. - char filePathBuffer[1024]; - Con::expandToolScriptFilename( filePathBuffer, sizeof(filePathBuffer), pTamlSchemaFile ); + // Expand the file-name into the file-path buffer. + char filePathBuffer[1024]; + Con::expandToolScriptFilename(filePathBuffer, sizeof(filePathBuffer), pTamlSchemaFile); - FileStream stream; + FileStream stream; - // File opened? - /*if ( !stream.open( filePathBuffer, Torque::FS::File::Write ) ) - { - // No, so warn. - Con::warnf("Taml::GenerateTamlSchema() - Could not open filename '%s' for write.", filePathBuffer ); - return false; - }*/ + // File opened? + /*if ( !stream.open( filePathBuffer, Torque::FS::File::Write ) ) + { + // No, so warn. + Con::warnf("Taml::GenerateTamlSchema() - Could not open filename '%s' for write.", filePathBuffer ); + return false; + }*/ - // Create document. - TiXmlDocument schemaDocument; + // Create document. + TiXmlDocument schemaDocument; - // Add declaration. - TiXmlDeclaration schemaDeclaration( "1.0", "iso-8859-1", "no" ); - schemaDocument.InsertEndChild( schemaDeclaration ); + // Add declaration. + TiXmlDeclaration schemaDeclaration("1.0", "iso-8859-1", "no"); + schemaDocument.InsertEndChild(schemaDeclaration); - // Add schema element. - TiXmlElement* pSchemaElement = new TiXmlElement( "xs:schema" ); - pSchemaElement->SetAttribute( "xmlns:xs", "http://www.w3.org/2001/XMLSchema" ); - schemaDocument.LinkEndChild( pSchemaElement ); + // Add schema element. + TiXmlElement* pSchemaElement = new TiXmlElement("xs:schema"); + pSchemaElement->SetAttribute("xmlns:xs", "http://www.w3.org/2001/XMLSchema"); + schemaDocument.LinkEndChild(pSchemaElement); - // Fetch class-rep root. - AbstractClassRep* pRootType = AbstractClassRep::getClassList(); + // Fetch class-rep root. + AbstractClassRep* pRootType = AbstractClassRep::getClassList(); - // Fetch SimObject class rep. - AbstractClassRep* pSimObjectType = AbstractClassRep::findClassRep( "SimObject" ); - // Sanity! - AssertFatal( pSimObjectType != NULL, "Taml::GenerateTamlSchema() - Could not find SimObject class rep." ); + // Fetch SimObject class rep. + AbstractClassRep* pSimObjectType = AbstractClassRep::findClassRep("SimObject"); + // Sanity! + AssertFatal(pSimObjectType != NULL, "Taml::GenerateTamlSchema() - Could not find SimObject class rep."); - // Reset scratch state. - char buffer[1024]; - HashTable childGroups; + // Reset scratch state. + char buffer[1024]; + HashTable childGroups; - // ************************************************************* - // Generate console type elements. - // ************************************************************* + // ************************************************************* + // Generate console type elements. + // ************************************************************* - // Vector2. - TiXmlComment* pVector2Comment = new TiXmlComment( "Vector2 Console Type" ); - pSchemaElement->LinkEndChild( pVector2Comment ); - TiXmlElement* pVector2TypeElement = new TiXmlElement( "xs:simpleType" ); - pVector2TypeElement->SetAttribute( "name", "Vector2_ConsoleType" ); - pSchemaElement->LinkEndChild( pVector2TypeElement ); - TiXmlElement* pVector2ElementA = new TiXmlElement( "xs:restriction" ); - pVector2ElementA->SetAttribute( "base", "xs:string" ); - pVector2TypeElement->LinkEndChild( pVector2ElementA ); - TiXmlElement* pVector2ElementB = new TiXmlElement( "xs:pattern" ); - pVector2ElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pVector2ElementA->LinkEndChild( pVector2ElementB ); + // Vector2. + TiXmlComment* pVector2Comment = new TiXmlComment("Vector2 Console Type"); + pSchemaElement->LinkEndChild(pVector2Comment); + TiXmlElement* pVector2TypeElement = new TiXmlElement("xs:simpleType"); + pVector2TypeElement->SetAttribute("name", "Vector2_ConsoleType"); + pSchemaElement->LinkEndChild(pVector2TypeElement); + TiXmlElement* pVector2ElementA = new TiXmlElement("xs:restriction"); + pVector2ElementA->SetAttribute("base", "xs:string"); + pVector2TypeElement->LinkEndChild(pVector2ElementA); + TiXmlElement* pVector2ElementB = new TiXmlElement("xs:pattern"); + pVector2ElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pVector2ElementA->LinkEndChild(pVector2ElementB); - // Point2F. - TiXmlComment* pPoint2FComment = new TiXmlComment( "Point2F Console Type" ); - pSchemaElement->LinkEndChild( pPoint2FComment ); - TiXmlElement* pPoint2FTypeElement = new TiXmlElement( "xs:simpleType" ); - pPoint2FTypeElement->SetAttribute( "name", "Point2F_ConsoleType" ); - pSchemaElement->LinkEndChild( pPoint2FTypeElement ); - TiXmlElement* pPoint2FElementA = new TiXmlElement( "xs:restriction" ); - pPoint2FElementA->SetAttribute( "base", "xs:string" ); - pPoint2FTypeElement->LinkEndChild( pPoint2FElementA ); - TiXmlElement* pPoint2FElementB = new TiXmlElement( "xs:pattern" ); - pPoint2FElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pPoint2FElementA->LinkEndChild( pPoint2FElementB ); + // Point2F. + TiXmlComment* pPoint2FComment = new TiXmlComment("Point2F Console Type"); + pSchemaElement->LinkEndChild(pPoint2FComment); + TiXmlElement* pPoint2FTypeElement = new TiXmlElement("xs:simpleType"); + pPoint2FTypeElement->SetAttribute("name", "Point2F_ConsoleType"); + pSchemaElement->LinkEndChild(pPoint2FTypeElement); + TiXmlElement* pPoint2FElementA = new TiXmlElement("xs:restriction"); + pPoint2FElementA->SetAttribute("base", "xs:string"); + pPoint2FTypeElement->LinkEndChild(pPoint2FElementA); + TiXmlElement* pPoint2FElementB = new TiXmlElement("xs:pattern"); + pPoint2FElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pPoint2FElementA->LinkEndChild(pPoint2FElementB); - // Point2I. - TiXmlComment* pPoint2IComment = new TiXmlComment( "Point2I Console Type" ); - pSchemaElement->LinkEndChild( pPoint2IComment ); - TiXmlElement* pPoint2ITypeElement = new TiXmlElement( "xs:simpleType" ); - pPoint2ITypeElement->SetAttribute( "name", "Point2I_ConsoleType" ); - pSchemaElement->LinkEndChild( pPoint2ITypeElement ); - TiXmlElement* pPoint2IElementA = new TiXmlElement( "xs:restriction" ); - pPoint2IElementA->SetAttribute( "base", "xs:string" ); - pPoint2ITypeElement->LinkEndChild( pPoint2IElementA ); - TiXmlElement* pPoint2IElementB = new TiXmlElement( "xs:pattern" ); - pPoint2IElementB->SetAttribute( "value", "[-]?[0-9]* [-]?[0-9]*" ); - pPoint2IElementA->LinkEndChild( pPoint2IElementB ); + // Point2I. + TiXmlComment* pPoint2IComment = new TiXmlComment("Point2I Console Type"); + pSchemaElement->LinkEndChild(pPoint2IComment); + TiXmlElement* pPoint2ITypeElement = new TiXmlElement("xs:simpleType"); + pPoint2ITypeElement->SetAttribute("name", "Point2I_ConsoleType"); + pSchemaElement->LinkEndChild(pPoint2ITypeElement); + TiXmlElement* pPoint2IElementA = new TiXmlElement("xs:restriction"); + pPoint2IElementA->SetAttribute("base", "xs:string"); + pPoint2ITypeElement->LinkEndChild(pPoint2IElementA); + TiXmlElement* pPoint2IElementB = new TiXmlElement("xs:pattern"); + pPoint2IElementB->SetAttribute("value", "[-]?[0-9]* [-]?[0-9]*"); + pPoint2IElementA->LinkEndChild(pPoint2IElementB); - // b2AABB. - TiXmlComment* pb2AABBComment = new TiXmlComment( "b2AABB Console Type" ); - pSchemaElement->LinkEndChild( pb2AABBComment ); - TiXmlElement* pb2AABBTypeElement = new TiXmlElement( "xs:simpleType" ); - pb2AABBTypeElement->SetAttribute( "name", "b2AABB_ConsoleType" ); - pSchemaElement->LinkEndChild( pb2AABBTypeElement ); - TiXmlElement* pb2AABBElementA = new TiXmlElement( "xs:restriction" ); - pb2AABBElementA->SetAttribute( "base", "xs:string" ); - pb2AABBTypeElement->LinkEndChild( pb2AABBElementA ); - TiXmlElement* pb2AABBElementB = new TiXmlElement( "xs:pattern" ); - pb2AABBElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pb2AABBElementA->LinkEndChild( pb2AABBElementB ); + // b2AABB. + TiXmlComment* pb2AABBComment = new TiXmlComment("b2AABB Console Type"); + pSchemaElement->LinkEndChild(pb2AABBComment); + TiXmlElement* pb2AABBTypeElement = new TiXmlElement("xs:simpleType"); + pb2AABBTypeElement->SetAttribute("name", "b2AABB_ConsoleType"); + pSchemaElement->LinkEndChild(pb2AABBTypeElement); + TiXmlElement* pb2AABBElementA = new TiXmlElement("xs:restriction"); + pb2AABBElementA->SetAttribute("base", "xs:string"); + pb2AABBTypeElement->LinkEndChild(pb2AABBElementA); + TiXmlElement* pb2AABBElementB = new TiXmlElement("xs:pattern"); + pb2AABBElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pb2AABBElementA->LinkEndChild(pb2AABBElementB); - // RectI. - TiXmlComment* pRectIComment = new TiXmlComment( "RectI Console Type" ); - pSchemaElement->LinkEndChild( pRectIComment ); - TiXmlElement* pRectITypeElement = new TiXmlElement( "xs:simpleType" ); - pRectITypeElement->SetAttribute( "name", "RectI_ConsoleType" ); - pSchemaElement->LinkEndChild( pRectITypeElement ); - TiXmlElement* pRectIElementA = new TiXmlElement( "xs:restriction" ); - pRectIElementA->SetAttribute( "base", "xs:string" ); - pRectITypeElement->LinkEndChild( pRectIElementA ); - TiXmlElement* pRectIElementB = new TiXmlElement( "xs:pattern" ); - pRectIElementB->SetAttribute( "value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*" ); - pRectIElementA->LinkEndChild( pRectIElementB ); + // RectI. + TiXmlComment* pRectIComment = new TiXmlComment("RectI Console Type"); + pSchemaElement->LinkEndChild(pRectIComment); + TiXmlElement* pRectITypeElement = new TiXmlElement("xs:simpleType"); + pRectITypeElement->SetAttribute("name", "RectI_ConsoleType"); + pSchemaElement->LinkEndChild(pRectITypeElement); + TiXmlElement* pRectIElementA = new TiXmlElement("xs:restriction"); + pRectIElementA->SetAttribute("base", "xs:string"); + pRectITypeElement->LinkEndChild(pRectIElementA); + TiXmlElement* pRectIElementB = new TiXmlElement("xs:pattern"); + pRectIElementB->SetAttribute("value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*"); + pRectIElementA->LinkEndChild(pRectIElementB); - // RectF. - TiXmlComment* pRectFComment = new TiXmlComment( "RectF Console Type" ); - pSchemaElement->LinkEndChild( pRectFComment ); - TiXmlElement* pRectFTypeElement = new TiXmlElement( "xs:simpleType" ); - pRectFTypeElement->SetAttribute( "name", "RectF_ConsoleType" ); - pSchemaElement->LinkEndChild( pRectFTypeElement ); - TiXmlElement* pRectFElementA = new TiXmlElement( "xs:restriction" ); - pRectFElementA->SetAttribute( "base", "xs:string" ); - pRectFTypeElement->LinkEndChild( pRectFElementA ); - TiXmlElement* pRectFElementB = new TiXmlElement( "xs:pattern" ); - pRectFElementB->SetAttribute( "value", "(\\b[-]?(b[0-9]+)?\\.)?[0-9]+\\b" ); - pRectFElementA->LinkEndChild( pRectFElementB ); + // RectF. + TiXmlComment* pRectFComment = new TiXmlComment("RectF Console Type"); + pSchemaElement->LinkEndChild(pRectFComment); + TiXmlElement* pRectFTypeElement = new TiXmlElement("xs:simpleType"); + pRectFTypeElement->SetAttribute("name", "RectF_ConsoleType"); + pSchemaElement->LinkEndChild(pRectFTypeElement); + TiXmlElement* pRectFElementA = new TiXmlElement("xs:restriction"); + pRectFElementA->SetAttribute("base", "xs:string"); + pRectFTypeElement->LinkEndChild(pRectFElementA); + TiXmlElement* pRectFElementB = new TiXmlElement("xs:pattern"); + pRectFElementB->SetAttribute("value", "(\\b[-]?(b[0-9]+)?\\.)?[0-9]+\\b"); + pRectFElementA->LinkEndChild(pRectFElementB); - // AssetId. - TiXmlComment* pAssetIdComment = new TiXmlComment("AssetId Console Type"); - pSchemaElement->LinkEndChild(pAssetIdComment); - TiXmlElement* pAssetIdTypeElement = new TiXmlElement("xs:simpleType"); - pAssetIdTypeElement->SetAttribute("name", "AssetId_ConsoleType"); - pSchemaElement->LinkEndChild(pAssetIdTypeElement); - TiXmlElement* pAssetIdElementA = new TiXmlElement("xs:restriction"); - pAssetIdElementA->SetAttribute("base", "xs:string"); - pAssetIdTypeElement->LinkEndChild(pAssetIdElementA); - TiXmlElement* pAssetIdElementB = new TiXmlElement("xs:pattern"); - dSprintf(buffer, sizeof(buffer), "(%s)?\\b[a-zA-Z0-9]+\\b%s\\b[a-zA-Z0-9]+\\b", ASSET_ID_FIELD_PREFIX, ASSET_SCOPE_TOKEN); - pAssetIdElementB->SetAttribute("value", buffer); - pAssetIdElementA->LinkEndChild(pAssetIdElementB); + // AssetId. + TiXmlComment* pAssetIdComment = new TiXmlComment("AssetId Console Type"); + pSchemaElement->LinkEndChild(pAssetIdComment); + TiXmlElement* pAssetIdTypeElement = new TiXmlElement("xs:simpleType"); + pAssetIdTypeElement->SetAttribute("name", "AssetId_ConsoleType"); + pSchemaElement->LinkEndChild(pAssetIdTypeElement); + TiXmlElement* pAssetIdElementA = new TiXmlElement("xs:restriction"); + pAssetIdElementA->SetAttribute("base", "xs:string"); + pAssetIdTypeElement->LinkEndChild(pAssetIdElementA); + TiXmlElement* pAssetIdElementB = new TiXmlElement("xs:pattern"); + dSprintf(buffer, sizeof(buffer), "(%s)?\\b[a-zA-Z0-9]+\\b%s\\b[a-zA-Z0-9]+\\b", ASSET_ID_FIELD_PREFIX, ASSET_SCOPE_TOKEN); + pAssetIdElementB->SetAttribute("value", buffer); + pAssetIdElementA->LinkEndChild(pAssetIdElementB); - // Color Enums. - TiXmlComment* pColorEnumsComment = new TiXmlComment( "Color Enums" ); - pSchemaElement->LinkEndChild( pColorEnumsComment ); - TiXmlElement* pColorEnumsTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorEnumsTypeElement->SetAttribute( "name", "Color_Enums" ); - pSchemaElement->LinkEndChild( pColorEnumsTypeElement ); - TiXmlElement* pColorEnumsRestrictionElement = new TiXmlElement( "xs:restriction" ); - pColorEnumsRestrictionElement->SetAttribute( "base", "xs:string" ); - pColorEnumsTypeElement->LinkEndChild( pColorEnumsRestrictionElement ); - const S32 ColorEnumsCount = StockColor::getCount(); - for( S32 index = 0; index < ColorEnumsCount; ++index ) - { - // Add enumeration element. - TiXmlElement* pColorEnumsAttributeEnumerationElement = new TiXmlElement( "xs:enumeration" ); - pColorEnumsAttributeEnumerationElement->SetAttribute( "value", StockColor::getColorItem(index)->getColorName() ); - pColorEnumsRestrictionElement->LinkEndChild( pColorEnumsAttributeEnumerationElement ); - } + // Color Enums. + TiXmlComment* pColorEnumsComment = new TiXmlComment("Color Enums"); + pSchemaElement->LinkEndChild(pColorEnumsComment); + TiXmlElement* pColorEnumsTypeElement = new TiXmlElement("xs:simpleType"); + pColorEnumsTypeElement->SetAttribute("name", "Color_Enums"); + pSchemaElement->LinkEndChild(pColorEnumsTypeElement); + TiXmlElement* pColorEnumsRestrictionElement = new TiXmlElement("xs:restriction"); + pColorEnumsRestrictionElement->SetAttribute("base", "xs:string"); + pColorEnumsTypeElement->LinkEndChild(pColorEnumsRestrictionElement); + const S32 ColorEnumsCount = StockColor::getCount(); + for (S32 index = 0; index < ColorEnumsCount; ++index) + { + // Add enumeration element. + TiXmlElement* pColorEnumsAttributeEnumerationElement = new TiXmlElement("xs:enumeration"); + pColorEnumsAttributeEnumerationElement->SetAttribute("value", StockColor::getColorItem(index)->getColorName()); + pColorEnumsRestrictionElement->LinkEndChild(pColorEnumsAttributeEnumerationElement); + } - // LinearColorF. - TiXmlComment* pColorFValuesComment = new TiXmlComment( "LinearColorF Values" ); - pSchemaElement->LinkEndChild( pColorFValuesComment ); - TiXmlElement* pColorFValuesTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorFValuesTypeElement->SetAttribute( "name", "ColorF_Values" ); - pSchemaElement->LinkEndChild( pColorFValuesTypeElement ); - TiXmlElement* pColorFValuesElementA = new TiXmlElement( "xs:restriction" ); - pColorFValuesElementA->SetAttribute( "base", "xs:string" ); - pColorFValuesTypeElement->LinkEndChild( pColorFValuesElementA ); - TiXmlElement* pColorFValuesElementB = new TiXmlElement( "xs:pattern" ); - pColorFValuesElementB->SetAttribute( "value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b" ); - pColorFValuesElementA->LinkEndChild( pColorFValuesElementB ); + // LinearColorF. + TiXmlComment* pColorFValuesComment = new TiXmlComment("LinearColorF Values"); + pSchemaElement->LinkEndChild(pColorFValuesComment); + TiXmlElement* pColorFValuesTypeElement = new TiXmlElement("xs:simpleType"); + pColorFValuesTypeElement->SetAttribute("name", "ColorF_Values"); + pSchemaElement->LinkEndChild(pColorFValuesTypeElement); + TiXmlElement* pColorFValuesElementA = new TiXmlElement("xs:restriction"); + pColorFValuesElementA->SetAttribute("base", "xs:string"); + pColorFValuesTypeElement->LinkEndChild(pColorFValuesElementA); + TiXmlElement* pColorFValuesElementB = new TiXmlElement("xs:pattern"); + pColorFValuesElementB->SetAttribute("value", "([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b ([-]?(\\b[0-9]+)?\\.)?[0-9]+\\b"); + pColorFValuesElementA->LinkEndChild(pColorFValuesElementB); - TiXmlComment* pColorFComment = new TiXmlComment( "LinearColorF Console Type" ); - pSchemaElement->LinkEndChild( pColorFComment ); - TiXmlElement* pColorFTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorFTypeElement->SetAttribute( "name", "ColorF_ConsoleType" ); - pSchemaElement->LinkEndChild( pColorFTypeElement ); - TiXmlElement* pColorFUnionElement = new TiXmlElement( "xs:union" ); - pColorFUnionElement->SetAttribute( "memberTypes", "ColorF_Values Color_Enums" ); - pColorFTypeElement->LinkEndChild( pColorFUnionElement ); + TiXmlComment* pColorFComment = new TiXmlComment("LinearColorF Console Type"); + pSchemaElement->LinkEndChild(pColorFComment); + TiXmlElement* pColorFTypeElement = new TiXmlElement("xs:simpleType"); + pColorFTypeElement->SetAttribute("name", "ColorF_ConsoleType"); + pSchemaElement->LinkEndChild(pColorFTypeElement); + TiXmlElement* pColorFUnionElement = new TiXmlElement("xs:union"); + pColorFUnionElement->SetAttribute("memberTypes", "ColorF_Values Color_Enums"); + pColorFTypeElement->LinkEndChild(pColorFUnionElement); - // ColorI. - TiXmlComment* pColorIValuesComment = new TiXmlComment( "ColorI Values" ); - pSchemaElement->LinkEndChild( pColorIValuesComment ); - TiXmlElement* pColorIValuesTypeElement = new TiXmlElement( "xs:simpleType" ); - pColorIValuesTypeElement->SetAttribute( "name", "ColorI_Values" ); - pSchemaElement->LinkEndChild( pColorIValuesTypeElement ); - TiXmlElement* pColorIValuesElementA = new TiXmlElement( "xs:restriction" ); - pColorIValuesElementA->SetAttribute( "base", "xs:string" ); - pColorIValuesTypeElement->LinkEndChild( pColorIValuesElementA ); - TiXmlElement* pColorIValuesElementB = new TiXmlElement( "xs:pattern" ); - pColorIValuesElementB->SetAttribute( "value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*" ); - pColorIValuesElementA->LinkEndChild( pColorIValuesElementB ); + // ColorI. + TiXmlComment* pColorIValuesComment = new TiXmlComment("ColorI Values"); + pSchemaElement->LinkEndChild(pColorIValuesComment); + TiXmlElement* pColorIValuesTypeElement = new TiXmlElement("xs:simpleType"); + pColorIValuesTypeElement->SetAttribute("name", "ColorI_Values"); + pSchemaElement->LinkEndChild(pColorIValuesTypeElement); + TiXmlElement* pColorIValuesElementA = new TiXmlElement("xs:restriction"); + pColorIValuesElementA->SetAttribute("base", "xs:string"); + pColorIValuesTypeElement->LinkEndChild(pColorIValuesElementA); + TiXmlElement* pColorIValuesElementB = new TiXmlElement("xs:pattern"); + pColorIValuesElementB->SetAttribute("value", "[-]?[0-9]* [-]?[0-9]* [-]?[0-9]* [-]?[0-9]*"); + pColorIValuesElementA->LinkEndChild(pColorIValuesElementB); - TiXmlComment* pColorIComment = new TiXmlComment( "ColorI Console Type" ); - pSchemaElement->LinkEndChild( pColorIComment ); - TiXmlElement* pColorITypeElement = new TiXmlElement( "xs:simpleType" ); - pColorITypeElement->SetAttribute( "name", "ColorI_ConsoleType" ); - pSchemaElement->LinkEndChild( pColorITypeElement ); - TiXmlElement* pColorIUnionElement = new TiXmlElement( "xs:union" ); - pColorIUnionElement->SetAttribute( "memberTypes", "ColorI_Values Color_Enums" ); - pColorITypeElement->LinkEndChild( pColorIUnionElement ); + TiXmlComment* pColorIComment = new TiXmlComment("ColorI Console Type"); + pSchemaElement->LinkEndChild(pColorIComment); + TiXmlElement* pColorITypeElement = new TiXmlElement("xs:simpleType"); + pColorITypeElement->SetAttribute("name", "ColorI_ConsoleType"); + pSchemaElement->LinkEndChild(pColorITypeElement); + TiXmlElement* pColorIUnionElement = new TiXmlElement("xs:union"); + pColorIUnionElement->SetAttribute("memberTypes", "ColorI_Values Color_Enums"); + pColorITypeElement->LinkEndChild(pColorIUnionElement); - // ************************************************************* - // Generate engine type elements. - // ************************************************************* + // ************************************************************* + // Generate engine type elements. + // ************************************************************* - // Generate the engine type elements. - TiXmlComment* pComment = new TiXmlComment( "Type Elements" ); - pSchemaElement->LinkEndChild( pComment ); - for ( AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass() ) - { - // Add type. - TiXmlElement* pTypeElement = new TiXmlElement( "xs:element" ); - pTypeElement->SetAttribute( "name", pType->getClassName() ); - dSprintf( buffer, sizeof(buffer), "%s_Type", pType->getClassName() ); - pTypeElement->SetAttribute( "type", buffer ); - pSchemaElement->LinkEndChild( pTypeElement ); - } + // Generate the engine type elements. + TiXmlComment* pComment = new TiXmlComment("Type Elements"); + pSchemaElement->LinkEndChild(pComment); + for (AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass()) + { + // Add type. + TiXmlElement* pTypeElement = new TiXmlElement("xs:element"); + pTypeElement->SetAttribute("name", pType->getClassName()); + dSprintf(buffer, sizeof(buffer), "%s_Type", pType->getClassName()); + pTypeElement->SetAttribute("type", buffer); + pSchemaElement->LinkEndChild(pTypeElement); + } - // ************************************************************* - // Generate the engine complex types. - // ************************************************************* - for ( AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass() ) - { - // Add complex type comment. - dSprintf( buffer, sizeof(buffer), " %s Type ", pType->getClassName() ); - TiXmlComment* pComment = new TiXmlComment( buffer ); - pSchemaElement->LinkEndChild( pComment ); + // ************************************************************* + // Generate the engine complex types. + // ************************************************************* + for (AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass()) + { + // Add complex type comment. + dSprintf(buffer, sizeof(buffer), " %s Type ", pType->getClassName()); + TiXmlComment* pComment = new TiXmlComment(buffer); + pSchemaElement->LinkEndChild(pComment); - // Add complex type. - TiXmlElement* pComplexTypeElement = new TiXmlElement( "xs:complexType" ); - dSprintf( buffer, sizeof(buffer), "%s_Type", pType->getClassName() ); - pComplexTypeElement->SetAttribute( "name", buffer ); - pSchemaElement->LinkEndChild( pComplexTypeElement ); + // Add complex type. + TiXmlElement* pComplexTypeElement = new TiXmlElement("xs:complexType"); + dSprintf(buffer, sizeof(buffer), "%s_Type", pType->getClassName()); + pComplexTypeElement->SetAttribute("name", buffer); + pSchemaElement->LinkEndChild(pComplexTypeElement); - // Add sequence. - TiXmlElement* pSequenceElement = new TiXmlElement( "xs:sequence" ); - pComplexTypeElement->LinkEndChild( pSequenceElement ); + // Add sequence. + TiXmlElement* pSequenceElement = new TiXmlElement("xs:sequence"); + pComplexTypeElement->LinkEndChild(pSequenceElement); - // Fetch container child class. - AbstractClassRep* pContainerChildClass = pType->getContainerChildClass( true ); + // Fetch container child class. + AbstractClassRep* pContainerChildClass = pType->getContainerChildClass(true); - // Is the type allowed children? - if ( pContainerChildClass != NULL ) - { + // Is the type allowed children? + if (pContainerChildClass != NULL) + { // Yes, so add choice element. - TiXmlElement* pChoiceElement = new TiXmlElement( "xs:choice" ); - pChoiceElement->SetAttribute( "minOccurs", 0 ); - pChoiceElement->SetAttribute( "maxOccurs", "unbounded" ); - pSequenceElement->LinkEndChild( pChoiceElement ); + TiXmlElement* pChoiceElement = new TiXmlElement("xs:choice"); + pChoiceElement->SetAttribute("minOccurs", 0); + pChoiceElement->SetAttribute("maxOccurs", "unbounded"); + pSequenceElement->LinkEndChild(pChoiceElement); // Find child group. - HashTable::Iterator childGroupItr = childGroups.find( pContainerChildClass ); + HashTable::Iterator childGroupItr = childGroups.find(pContainerChildClass); // Does the group exist? - if ( childGroupItr == childGroups.end() ) + if (childGroupItr == childGroups.end()) { - // No, so format group name. - dSprintf( buffer, sizeof(buffer), "%s_ChildrenTypes", pContainerChildClass->getClassName() ); + // No, so format group name. + dSprintf(buffer, sizeof(buffer), "%s_ChildrenTypes", pContainerChildClass->getClassName()); - // Insert into child group hash. - childGroupItr = childGroups.insertUnique( pContainerChildClass, StringTable->insert( buffer ) ); + // Insert into child group hash. + childGroupItr = childGroups.insertUnique(pContainerChildClass, StringTable->insert(buffer)); - // Add the group. - TiXmlElement* pChildrenGroupElement = new TiXmlElement( "xs:group" ); - pChildrenGroupElement->SetAttribute( "name", buffer ); - pSchemaElement->LinkEndChild( pChildrenGroupElement ); + // Add the group. + TiXmlElement* pChildrenGroupElement = new TiXmlElement("xs:group"); + pChildrenGroupElement->SetAttribute("name", buffer); + pSchemaElement->LinkEndChild(pChildrenGroupElement); - // Add choice element. - TiXmlElement* pChildreGroupChoiceElement = new TiXmlElement( "xs:choice" ); - pChildrenGroupElement->LinkEndChild( pChildreGroupChoiceElement ); + // Add choice element. + TiXmlElement* pChildreGroupChoiceElement = new TiXmlElement("xs:choice"); + pChildrenGroupElement->LinkEndChild(pChildreGroupChoiceElement); - // Add choice members. - for ( AbstractClassRep* pChoiceType = pRootType; pChoiceType != NULL; pChoiceType = pChoiceType->getNextClass() ) - { - // Skip if not derived from the container child class. - if ( !pChoiceType->isClass( pContainerChildClass ) ) - continue; + // Add choice members. + for (AbstractClassRep* pChoiceType = pRootType; pChoiceType != NULL; pChoiceType = pChoiceType->getNextClass()) + { + // Skip if not derived from the container child class. + if (!pChoiceType->isClass(pContainerChildClass)) + continue; - // Add choice member. - TiXmlElement* pChildrenMemberElement = new TiXmlElement( "xs:element" ); - pChildrenMemberElement->SetAttribute( "name", pChoiceType->getClassName() ); - dSprintf( buffer, sizeof(buffer), "%s_Type", pChoiceType->getClassName() ); - pChildrenMemberElement->SetAttribute( "type", buffer ); - pChildreGroupChoiceElement->LinkEndChild( pChildrenMemberElement ); - } + // Add choice member. + TiXmlElement* pChildrenMemberElement = new TiXmlElement("xs:element"); + pChildrenMemberElement->SetAttribute("name", pChoiceType->getClassName()); + dSprintf(buffer, sizeof(buffer), "%s_Type", pChoiceType->getClassName()); + pChildrenMemberElement->SetAttribute("type", buffer); + pChildreGroupChoiceElement->LinkEndChild(pChildrenMemberElement); + } } // Reference the child group. - TiXmlElement* pChoiceGroupReferenceElement = new TiXmlElement( "xs:group" ); - pChoiceGroupReferenceElement->SetAttribute( "ref", childGroupItr->value ); - pChoiceGroupReferenceElement->SetAttribute( "minOccurs", 0 ); - pChoiceElement->LinkEndChild( pChoiceGroupReferenceElement ); - } + TiXmlElement* pChoiceGroupReferenceElement = new TiXmlElement("xs:group"); + pChoiceGroupReferenceElement->SetAttribute("ref", childGroupItr->value); + pChoiceGroupReferenceElement->SetAttribute("minOccurs", 0); + pChoiceElement->LinkEndChild(pChoiceGroupReferenceElement); + } - // Generate the custom Taml schema. - for ( AbstractClassRep* pCustomSchemaType = pType; pCustomSchemaType != NULL; pCustomSchemaType = pCustomSchemaType->getParentClass() ) - { + // Generate the custom Taml schema. + for (AbstractClassRep* pCustomSchemaType = pType; pCustomSchemaType != NULL; pCustomSchemaType = pCustomSchemaType->getParentClass()) + { // Fetch the types custom TAML schema function. AbstractClassRep::WriteCustomTamlSchema customSchemaFn = pCustomSchemaType->getCustomTamlSchema(); // Skip if no function avilable. - if ( customSchemaFn == NULL ) - continue; + if (customSchemaFn == NULL) + continue; // Call schema generation function. - customSchemaFn( pType, pSequenceElement ); - } + customSchemaFn(pType, pSequenceElement); + } - // Generate field attribute group. - TiXmlElement* pFieldAttributeGroupElement = new TiXmlElement( "xs:attributeGroup" ); - dSprintf( buffer, sizeof(buffer), "%s_Fields", pType->getClassName() ); - pFieldAttributeGroupElement->SetAttribute( "name", buffer ); - pSchemaElement->LinkEndChild( pFieldAttributeGroupElement ); + // Generate field attribute group. + TiXmlElement* pFieldAttributeGroupElement = new TiXmlElement("xs:attributeGroup"); + dSprintf(buffer, sizeof(buffer), "%s_Fields", pType->getClassName()); + pFieldAttributeGroupElement->SetAttribute("name", buffer); + pSchemaElement->LinkEndChild(pFieldAttributeGroupElement); - // Fetch field list. - const AbstractClassRep::FieldList& fields = pType->mFieldList; + // Fetch field list. + const AbstractClassRep::FieldList& fields = pType->mFieldList; - // Fetcj field count. - const S32 fieldCount = fields.size(); + // Fetcj field count. + const S32 fieldCount = fields.size(); - // Iterate static fields (in reverse as most types are organized from the root-fields up). - for( S32 index = fieldCount-1; index > 0; --index ) - { + // Iterate static fields (in reverse as most types are organized from the root-fields up). + for (S32 index = fieldCount - 1; index > 0; --index) + { // Fetch field. const AbstractClassRep::Field& field = fields[index]; // Skip if not a data field. - if( field.type == AbstractClassRep::DeprecatedFieldType || - field.type == AbstractClassRep::StartGroupFieldType || - field.type == AbstractClassRep::EndGroupFieldType ) - continue; + if (field.type == AbstractClassRep::DeprecatedFieldType || + field.type == AbstractClassRep::StartGroupFieldType || + field.type == AbstractClassRep::EndGroupFieldType) + continue; // Skip if the field root is not this type. - if ( pType->findFieldRoot( field.pFieldname ) != pType ) - continue; + if (pType->findFieldRoot(field.pFieldname) != pType) + continue; // Add attribute element. - TiXmlElement* pAttributeElement = new TiXmlElement( "xs:attribute" ); - pAttributeElement->SetAttribute( "name", field.pFieldname ); + TiXmlElement* pAttributeElement = new TiXmlElement("xs:attribute"); + pAttributeElement->SetAttribute("name", field.pFieldname); // Handle the console type appropriately. const S32 fieldType = (S32)field.type; @@ -1378,168 +1383,168 @@ bool Taml::generateTamlSchema() // Is the field an enumeration? if ( fieldType == TypeEnum ) { - // Yes, so add attribute type. - TiXmlElement* pAttributeSimpleTypeElement = new TiXmlElement( "xs:simpleType" ); - pAttributeElement->LinkEndChild( pAttributeSimpleTypeElement ); + // Yes, so add attribute type. + TiXmlElement* pAttributeSimpleTypeElement = new TiXmlElement( "xs:simpleType" ); + pAttributeElement->LinkEndChild( pAttributeSimpleTypeElement ); - // Add restriction element. - TiXmlElement* pAttributeRestrictionElement = new TiXmlElement( "xs:restriction" ); - pAttributeRestrictionElement->SetAttribute( "base", "xs:string" ); - pAttributeSimpleTypeElement->LinkEndChild( pAttributeRestrictionElement ); + // Add restriction element. + TiXmlElement* pAttributeRestrictionElement = new TiXmlElement( "xs:restriction" ); + pAttributeRestrictionElement->SetAttribute( "base", "xs:string" ); + pAttributeSimpleTypeElement->LinkEndChild( pAttributeRestrictionElement ); - // Yes, so fetch enumeration count. - const S32 enumCount = field.table->size; + // Yes, so fetch enumeration count. + const S32 enumCount = field.table->size; - // Iterate enumeration. - for( S32 index = 0; index < enumCount; ++index ) - { - // Add enumeration element. - TiXmlElement* pAttributeEnumerationElement = new TiXmlElement( "xs:enumeration" ); - pAttributeEnumerationElement->SetAttribute( "value", field.table->table[index].label ); - pAttributeRestrictionElement->LinkEndChild( pAttributeEnumerationElement ); - } + // Iterate enumeration. + for( S32 index = 0; index < enumCount; ++index ) + { + // Add enumeration element. + TiXmlElement* pAttributeEnumerationElement = new TiXmlElement( "xs:enumeration" ); + pAttributeEnumerationElement->SetAttribute( "value", field.table->table[index].label ); + pAttributeRestrictionElement->LinkEndChild( pAttributeEnumerationElement ); + } } else {*/ - // No, so assume it's a string type initially. - const char* pFieldTypeDescription = "xs:string"; + // No, so assume it's a string type initially. + const char* pFieldTypeDescription = "xs:string"; - // Handle known types. - if( fieldType == TypeF32 ) - { - pFieldTypeDescription = "xs:float"; - } - else if( fieldType == TypeS8 || fieldType == TypeS32 ) - { - pFieldTypeDescription = "xs:int"; - } - else if( fieldType == TypeBool || fieldType == TypeFlag ) - { - pFieldTypeDescription = "xs:boolean"; - } - else if( fieldType == TypePoint2F ) - { - pFieldTypeDescription = "Point2F_ConsoleType"; - } - else if( fieldType == TypePoint2I ) - { - pFieldTypeDescription = "Point2I_ConsoleType"; - } - else if( fieldType == TypeRectI ) - { - pFieldTypeDescription = "RectI_ConsoleType"; - } - else if( fieldType == TypeRectF ) - { - pFieldTypeDescription = "RectF_ConsoleType"; - } - else if( fieldType == TypeColorF ) - { - pFieldTypeDescription = "ColorF_ConsoleType"; - } - else if( fieldType == TypeColorI ) - { - pFieldTypeDescription = "ColorI_ConsoleType"; - } - else if (fieldType == TypeAssetId/* || - fieldType == TypeImageAssetPtr || - fieldType == TypeAnimationAssetPtr || - fieldType == TypeAudioAssetPtr*/) - { - pFieldTypeDescription = "AssetId_ConsoleType"; - } + // Handle known types. + if (fieldType == TypeF32) + { + pFieldTypeDescription = "xs:float"; + } + else if (fieldType == TypeS8 || fieldType == TypeS32) + { + pFieldTypeDescription = "xs:int"; + } + else if (fieldType == TypeBool || fieldType == TypeFlag) + { + pFieldTypeDescription = "xs:boolean"; + } + else if (fieldType == TypePoint2F) + { + pFieldTypeDescription = "Point2F_ConsoleType"; + } + else if (fieldType == TypePoint2I) + { + pFieldTypeDescription = "Point2I_ConsoleType"; + } + else if (fieldType == TypeRectI) + { + pFieldTypeDescription = "RectI_ConsoleType"; + } + else if (fieldType == TypeRectF) + { + pFieldTypeDescription = "RectF_ConsoleType"; + } + else if (fieldType == TypeColorF) + { + pFieldTypeDescription = "ColorF_ConsoleType"; + } + else if (fieldType == TypeColorI) + { + pFieldTypeDescription = "ColorI_ConsoleType"; + } + else if (fieldType == TypeAssetId/* || + fieldType == TypeImageAssetPtr || + fieldType == TypeAnimationAssetPtr || + fieldType == TypeAudioAssetPtr*/) + { + pFieldTypeDescription = "AssetId_ConsoleType"; + } - // Set attribute type. - pAttributeElement->SetAttribute( "type", pFieldTypeDescription ); + // Set attribute type. + pAttributeElement->SetAttribute("type", pFieldTypeDescription); //} - pAttributeElement->SetAttribute( "use", "optional" ); - pFieldAttributeGroupElement->LinkEndChild( pAttributeElement ); - } + pAttributeElement->SetAttribute("use", "optional"); + pFieldAttributeGroupElement->LinkEndChild(pAttributeElement); + } - // Is this the SimObject Type? - if ( pType == pSimObjectType ) - { + // Is this the SimObject Type? + if (pType == pSimObjectType) + { // Yes, so add reserved Taml field attributes here... // Add Taml "Name" attribute element. - TiXmlElement* pNameAttributeElement = new TiXmlElement( "xs:attribute" ); - pNameAttributeElement->SetAttribute( "name", tamlNamedObjectName ); - pNameAttributeElement->SetAttribute( "type", "xs:normalizedString" ); - pFieldAttributeGroupElement->LinkEndChild( pNameAttributeElement ); + TiXmlElement* pNameAttributeElement = new TiXmlElement("xs:attribute"); + pNameAttributeElement->SetAttribute("name", tamlNamedObjectName); + pNameAttributeElement->SetAttribute("type", "xs:normalizedString"); + pFieldAttributeGroupElement->LinkEndChild(pNameAttributeElement); // Add Taml "TamlId" attribute element. - TiXmlElement* pTamlIdAttributeElement = new TiXmlElement( "xs:attribute" ); - pTamlIdAttributeElement->SetAttribute( "name", tamlRefIdName ); - pTamlIdAttributeElement->SetAttribute( "type", "xs:nonNegativeInteger" ); - pFieldAttributeGroupElement->LinkEndChild( pTamlIdAttributeElement ); + TiXmlElement* pTamlIdAttributeElement = new TiXmlElement("xs:attribute"); + pTamlIdAttributeElement->SetAttribute("name", tamlRefIdName); + pTamlIdAttributeElement->SetAttribute("type", "xs:nonNegativeInteger"); + pFieldAttributeGroupElement->LinkEndChild(pTamlIdAttributeElement); // Add Taml "TamlRefId" attribute element. - TiXmlElement* pTamlRefIdAttributeElement = new TiXmlElement( "xs:attribute" ); - pTamlRefIdAttributeElement->SetAttribute( "name", tamlRefToIdName ); - pTamlRefIdAttributeElement->SetAttribute( "type", "xs:nonNegativeInteger" ); - pFieldAttributeGroupElement->LinkEndChild( pTamlRefIdAttributeElement ); - } + TiXmlElement* pTamlRefIdAttributeElement = new TiXmlElement("xs:attribute"); + pTamlRefIdAttributeElement->SetAttribute("name", tamlRefToIdName); + pTamlRefIdAttributeElement->SetAttribute("type", "xs:nonNegativeInteger"); + pFieldAttributeGroupElement->LinkEndChild(pTamlRefIdAttributeElement); + } - // Add attribute group types. - for ( AbstractClassRep* pAttributeGroupsType = pType; pAttributeGroupsType != NULL; pAttributeGroupsType = pAttributeGroupsType->getParentClass() ) - { - TiXmlElement* pFieldAttributeGroupRefElement = new TiXmlElement( "xs:attributeGroup" ); - dSprintf( buffer, sizeof(buffer), "%s_Fields", pAttributeGroupsType->getClassName() ); - pFieldAttributeGroupRefElement->SetAttribute( "ref", buffer ); - pComplexTypeElement->LinkEndChild( pFieldAttributeGroupRefElement ); - } + // Add attribute group types. + for (AbstractClassRep* pAttributeGroupsType = pType; pAttributeGroupsType != NULL; pAttributeGroupsType = pAttributeGroupsType->getParentClass()) + { + TiXmlElement* pFieldAttributeGroupRefElement = new TiXmlElement("xs:attributeGroup"); + dSprintf(buffer, sizeof(buffer), "%s_Fields", pAttributeGroupsType->getClassName()); + pFieldAttributeGroupRefElement->SetAttribute("ref", buffer); + pComplexTypeElement->LinkEndChild(pFieldAttributeGroupRefElement); + } - // Add "any" attribute element (dynamic fields). - TiXmlElement* pAnyAttributeElement = new TiXmlElement( "xs:anyAttribute" ); - pAnyAttributeElement->SetAttribute( "processContents", "skip" ); - pComplexTypeElement->LinkEndChild( pAnyAttributeElement ); - } + // Add "any" attribute element (dynamic fields). + TiXmlElement* pAnyAttributeElement = new TiXmlElement("xs:anyAttribute"); + pAnyAttributeElement->SetAttribute("processContents", "skip"); + pComplexTypeElement->LinkEndChild(pAnyAttributeElement); + } - // Write the schema document. - schemaDocument.SaveFile( filePathBuffer ); + // Write the schema document. + schemaDocument.SaveFile(filePathBuffer); - // Close file. - stream.close(); + // Close file. + stream.close(); - return true; -} + return true; + } -//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- -void Taml::WriteUnrestrictedCustomTamlSchema( const char* pCustomNodeName, const AbstractClassRep* pClassRep, TiXmlElement* pParentElement ) -{ - // Sanity! - AssertFatal( pCustomNodeName != NULL, "Taml::WriteDefaultCustomTamlSchema() - Node name cannot be NULL." ); - AssertFatal( pClassRep != NULL, "Taml::WriteDefaultCustomTamlSchema() - ClassRep cannot be NULL." ); - AssertFatal( pParentElement != NULL, "Taml::WriteDefaultCustomTamlSchema() - Parent Element cannot be NULL." ); + void Taml::WriteUnrestrictedCustomTamlSchema(const char* pCustomNodeName, const AbstractClassRep* pClassRep, TiXmlElement* pParentElement) + { + // Sanity! + AssertFatal(pCustomNodeName != NULL, "Taml::WriteDefaultCustomTamlSchema() - Node name cannot be NULL."); + AssertFatal(pClassRep != NULL, "Taml::WriteDefaultCustomTamlSchema() - ClassRep cannot be NULL."); + AssertFatal(pParentElement != NULL, "Taml::WriteDefaultCustomTamlSchema() - Parent Element cannot be NULL."); - char buffer[1024]; + char buffer[1024]; - // Add custom type element. - TiXmlElement* pCustomElement = new TiXmlElement( "xs:element" ); - dSprintf( buffer, sizeof(buffer), "%s.%s", pClassRep->getClassName(), pCustomNodeName ); - pCustomElement->SetAttribute( "name", buffer ); - pCustomElement->SetAttribute( "minOccurs", 0 ); - pCustomElement->SetAttribute( "maxOccurs", 1 ); - pParentElement->LinkEndChild( pCustomElement ); + // Add custom type element. + TiXmlElement* pCustomElement = new TiXmlElement("xs:element"); + dSprintf(buffer, sizeof(buffer), "%s.%s", pClassRep->getClassName(), pCustomNodeName); + pCustomElement->SetAttribute("name", buffer); + pCustomElement->SetAttribute("minOccurs", 0); + pCustomElement->SetAttribute("maxOccurs", 1); + pParentElement->LinkEndChild(pCustomElement); - // Add complex type element. - TiXmlElement* pComplexTypeElement = new TiXmlElement( "xs:complexType" ); - pCustomElement->LinkEndChild( pComplexTypeElement ); + // Add complex type element. + TiXmlElement* pComplexTypeElement = new TiXmlElement("xs:complexType"); + pCustomElement->LinkEndChild(pComplexTypeElement); - // Add choice element. - TiXmlElement* pChoiceElement = new TiXmlElement( "xs:choice" ); - pChoiceElement->SetAttribute( "minOccurs", 0 ); - pChoiceElement->SetAttribute( "maxOccurs", "unbounded" ); - pComplexTypeElement->LinkEndChild( pChoiceElement ); + // Add choice element. + TiXmlElement* pChoiceElement = new TiXmlElement("xs:choice"); + pChoiceElement->SetAttribute("minOccurs", 0); + pChoiceElement->SetAttribute("maxOccurs", "unbounded"); + pComplexTypeElement->LinkEndChild(pChoiceElement); - // Add sequence element. - TiXmlElement* pSequenceElement = new TiXmlElement( "xs:sequence" ); - pChoiceElement->LinkEndChild( pSequenceElement ); + // Add sequence element. + TiXmlElement* pSequenceElement = new TiXmlElement("xs:sequence"); + pChoiceElement->LinkEndChild(pSequenceElement); - // Add "any" element. - TiXmlElement* pAnyElement = new TiXmlElement( "xs:any" ); - pAnyElement->SetAttribute( "processContents", "skip" ); - pSequenceElement->LinkEndChild( pAnyElement ); -} + // Add "any" element. + TiXmlElement* pAnyElement = new TiXmlElement("xs:any"); + pAnyElement->SetAttribute("processContents", "skip"); + pSequenceElement->LinkEndChild(pAnyElement); + } \ No newline at end of file From d7287914c7f3fad4a0961d638a1256c48e69dd93 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sun, 12 Nov 2017 14:21:49 -0500 Subject: [PATCH 058/312] fix arg corruption on functioncall compilation. --- Engine/source/console/astNodes.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index 53e666176..6ea557703 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -1402,6 +1402,8 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) bool isThisCall = false; + ExprNode *walk = args; + // Try to optimize the this pointer call if it is a variable // that we are loading. if (callType == MethodCall) @@ -1420,11 +1422,11 @@ U32 FuncCallExprNode::compile(CodeStream &codeStream, U32 ip, TypeReq type) codeStream.emitSTE(var->varName); // inc args since we took care of first arg. - args = static_cast(args->getNext()); + walk = (ExprNode*)walk ->getNext(); } } - for (ExprNode *walk = args; walk; walk = (ExprNode *)walk->getNext()) + for (; walk; walk = (ExprNode *)walk->getNext()) { TypeReq walkType = walk->getPreferredType(); if (walkType == TypeReqNone) walkType = TypeReqString; From f9bf4fca4bd014336e989c2f696db6c6d2353e06 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 12 Nov 2017 23:58:34 -0600 Subject: [PATCH 059/312] new method: TSShapeInstance::resetMaterialList(). Sets all object-instance mapto values back to initial state. reskin now does so to avoid having to track origional values independently. (so say, if you've already got skin1 plugged in to one, and nothing in to another, no need to set skin1=skin2 on the first and skin2 or base=skin2 on the second to swap both on over to skin2). also by request, went ahead and killed case sensitivity for mapto string replacement when reskinning. --- Engine/source/T3D/player.cpp | 1 + Engine/source/T3D/shapeBase.cpp | 1 + Engine/source/T3D/tsStatic.cpp | 1 + Engine/source/ts/tsShapeInstance.cpp | 10 ++++++++-- Engine/source/ts/tsShapeInstance.h | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 15b57046a..7f537d65d 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -1953,6 +1953,7 @@ void Player::reSkin() { if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) { + mShapeInstance->resetMaterialList(); Vector skins; String(mSkinNameHandle.getString()).split( ";", skins ); diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 5f71a7eb9..19ada8ce2 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -3689,6 +3689,7 @@ void ShapeBase::reSkin() { if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) { + mShapeInstance->resetMaterialList(); Vector skins; String(mSkinNameHandle.getString()).split( ";", skins ); diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index b2f33f44a..67e210f34 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -534,6 +534,7 @@ void TSStatic::reSkin() { if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) { + mShapeInstance->resetMaterialList(); Vector skins; String(mSkinNameHandle.getString()).split( ";", skins ); diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index 7010371bc..53167f1cf 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -307,8 +307,8 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName ) { // Try changing base const String &pName = materialNames[i]; - String newName( pName ); - newName.replace( oldBaseName, newBaseName ); + String newName( String::ToLower(pName) ); + newName.replace( String::ToLower(oldBaseName), String::ToLower(newBaseName) ); pMatList->renameMaterial( i, newName ); } @@ -316,6 +316,12 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName ) initMaterialList(); } +void TSShapeInstance::resetMaterialList() +{ + TSMaterialList* oMatlist = mShape->materialList; + setMaterialList(oMatlist); +} + //------------------------------------------------------------------------------------- // Render & detail selection //------------------------------------------------------------------------------------- diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index c483c8792..627eb63ce 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -377,7 +377,7 @@ protected: } void reSkin( String newBaseName, String oldBaseName = String::EmptyString ); - + void resetMaterialList(); enum { MaskNodeRotation = 0x01, From c772f8044aa77bad6f33683c3ad03a272344483a Mon Sep 17 00:00:00 2001 From: Justin Knight Date: Tue, 14 Nov 2017 11:57:13 +0000 Subject: [PATCH 060/312] Fix forest editor failing to load forest because of space after object ID --- Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs | 2 +- Templates/BaseGame/game/tools/forestEditor/main.cs | 4 ++-- Templates/Full/game/tools/forestEditor/forestEditorGui.cs | 2 +- Templates/Full/game/tools/forestEditor/main.cs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs index e0e9f1ce4..5916e84d7 100644 --- a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs +++ b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.cs @@ -50,7 +50,7 @@ function ForestEditorGui::onActiveForestUpdated( %this, %forest, %createNew ) /// Called from a message box when a forest is not found. function ForestEditorGui::createForest( %this ) { - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { diff --git a/Templates/BaseGame/game/tools/forestEditor/main.cs b/Templates/BaseGame/game/tools/forestEditor/main.cs index 346365b04..288807bb8 100644 --- a/Templates/BaseGame/game/tools/forestEditor/main.cs +++ b/Templates/BaseGame/game/tools/forestEditor/main.cs @@ -144,7 +144,7 @@ function ForestEditorPlugin::onActivated( %this ) //ForestEditToolbar.setVisible( true ); //Get our existing forest object in our current mission if we have one - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if(isObject(%forestObject)) { ForestEditorGui.setActiveForest(%forestObject.getName()); @@ -242,7 +242,7 @@ function ForestEditorPlugin::onSaveMission( %this, %missionFile ) ForestDataManager.saveDirty(); //First, find out if we have an existing forest object - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { diff --git a/Templates/Full/game/tools/forestEditor/forestEditorGui.cs b/Templates/Full/game/tools/forestEditor/forestEditorGui.cs index e0e9f1ce4..5916e84d7 100644 --- a/Templates/Full/game/tools/forestEditor/forestEditorGui.cs +++ b/Templates/Full/game/tools/forestEditor/forestEditorGui.cs @@ -50,7 +50,7 @@ function ForestEditorGui::onActiveForestUpdated( %this, %forest, %createNew ) /// Called from a message box when a forest is not found. function ForestEditorGui::createForest( %this ) { - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { diff --git a/Templates/Full/game/tools/forestEditor/main.cs b/Templates/Full/game/tools/forestEditor/main.cs index 6a7dbf994..813c744eb 100644 --- a/Templates/Full/game/tools/forestEditor/main.cs +++ b/Templates/Full/game/tools/forestEditor/main.cs @@ -143,7 +143,7 @@ function ForestEditorPlugin::onActivated( %this ) //ForestEditToolbar.setVisible( true ); //Get our existing forest object in our current mission if we have one - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if(isObject(%forestObject)) { ForestEditorGui.setActiveForest(%forestObject.getName()); @@ -241,7 +241,7 @@ function ForestEditorPlugin::onSaveMission( %this, %missionFile ) ForestDataManager.saveDirty(); //First, find out if we have an existing forest object - %forestObject = parseMissionGroupForIds("Forest", ""); + %forestObject = trim(parseMissionGroupForIds("Forest", "")); if ( isObject( %forestObject ) ) { From 9c3687b8397d0ecc09d3cdaa33c30f188997adef Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 15 Nov 2017 18:52:41 -0600 Subject: [PATCH 061/312] Changes the buttons to be a checkbox button, which is easier to identity as being activated or not compared to the stock togglebutton. --- Templates/BaseGame/game/core/console/console.gui | 12 ++++++------ Templates/Full/game/core/art/gui/console.gui | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Templates/BaseGame/game/core/console/console.gui b/Templates/BaseGame/game/core/console/console.gui index 1286ed85c..c2f21eba9 100644 --- a/Templates/BaseGame/game/core/console/console.gui +++ b/Templates/BaseGame/game/core/console/console.gui @@ -83,7 +83,7 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiToggleButtonCtrl(ConsoleDlgErrorFilterBtn) { + new GuiCheckBoxCtrl(ConsoleDlgErrorFilterBtn) { text = "Errors"; groupNum = "-1"; buttonType = "ToggleButton"; @@ -93,7 +93,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiButtonProfile"; + profile = "GuiCheckBoxProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -102,7 +102,7 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiToggleButtonCtrl(ConsoleDlgWarnFilterBtn) { + new GuiCheckBoxCtrl(ConsoleDlgWarnFilterBtn) { text = "Warnings"; groupNum = "-1"; buttonType = "ToggleButton"; @@ -112,7 +112,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiButtonProfile"; + profile = "GuiCheckBoxProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -121,7 +121,7 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiToggleButtonCtrl(ConsoleDlgNormalFilterBtn) { + new GuiCheckBoxCtrl(ConsoleDlgNormalFilterBtn) { text = "Normal Messages"; groupNum = "-1"; buttonType = "ToggleButton"; @@ -131,7 +131,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiButtonProfile"; + profile = "GuiCheckBoxProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; diff --git a/Templates/Full/game/core/art/gui/console.gui b/Templates/Full/game/core/art/gui/console.gui index c1627fafb..16300e4ac 100644 --- a/Templates/Full/game/core/art/gui/console.gui +++ b/Templates/Full/game/core/art/gui/console.gui @@ -83,7 +83,7 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiToggleButtonCtrl(ConsoleDlgErrorFilterBtn) { + new GuiCheckBoxCtrl(ConsoleDlgErrorFilterBtn) { text = "Errors"; groupNum = "-1"; buttonType = "ToggleButton"; @@ -93,7 +93,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiButtonProfile"; + profile = "GuiCheckBoxProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -102,7 +102,7 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiToggleButtonCtrl(ConsoleDlgWarnFilterBtn) { + new GuiCheckBoxCtrl(ConsoleDlgWarnFilterBtn) { text = "Warnings"; groupNum = "-1"; buttonType = "ToggleButton"; @@ -112,7 +112,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiButtonProfile"; + profile = "GuiCheckBoxProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -121,7 +121,7 @@ canSave = "1"; canSaveDynamicFields = "0"; }; - new GuiToggleButtonCtrl(ConsoleDlgNormalFilterBtn) { + new GuiCheckBoxCtrl(ConsoleDlgNormalFilterBtn) { text = "Normal Messages"; groupNum = "-1"; buttonType = "ToggleButton"; @@ -131,7 +131,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiButtonProfile"; + profile = "GuiCheckBoxProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; From 75b85f9ac5a1106e0d0a5a0e9b8021b6450d3280 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Wed, 22 Nov 2017 15:16:49 +0000 Subject: [PATCH 062/312] Correct orientation of images --- .../game/core/art/grids/512_forestgreen.png | Bin 4614 -> 3938 bytes .../core/art/grids/512_forestgreen_lines.png | Bin 6245 -> 10553 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Templates/Full/game/core/art/grids/512_forestgreen.png b/Templates/Full/game/core/art/grids/512_forestgreen.png index 179831bea181d17b5d3594211f0f8e68481caabc..c5f2cd2fd5eb6fb6767b92743ca7ad5fc3eff943 100644 GIT binary patch delta 2223 zcmV;g2vGNiB;p>BBYzJmNkljLRJ;@dT8Xivg1sJyZ_eq5&@5 zLe!IOBk|O-;LZNiiy&=pV%qgY2y}aqMrnH>#3*ed#Dncx^dw!{D{1wN18ZJ}nfIOd zdEa>p>hJS8G~Mm{&hGm*dA>8x%roz8AAkJu8~}N4699lr{}lWXXCvO9Q*0;wzvOj?b_9)14|vx?H~X^k)8pl_Tmpdf2c8(cL(4XM~*H&zS!|2R^MOU|C4=v zc7dnRGXT|pG0=(Q%Ud7b+WmIbRpDG&K0UO8162!;|LWMJuSEcWB7FidYAEjrK;bxB z?f>rBweUqA2lNR*$51{h0M)+#+1Jl?kN)eH4m?{jpH?RTK#@KH81>vy0od};*4Iy- zD*Qn!XI7p&Fu{o2Q=b5IJa<$8UOREBeYh~nBj4VCI`%|Dod5tu>Vx><7Z0tzzuN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8ke`!d}V|B$3z{a>|EAHiN ztIq*8{H8(5*;Pwu|IH(-5*(z9=9tMvW*@z!6vIRa*Gp8KE`_0zVoDj)*@^m{o! zocGWNf#sCgyIY;BfekI`;^r!S+f#?k)cVQv+_=-GDK(8fuL3tap11{$?ItU2x4qi1 zg#F(GDn6|LrX9uPyd>W4#C)tm#rOFU`wwB079h?4o!yYVXPb From b5277e0f085446b89ca35bfcf882a472cd2289e6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 3 Dec 2017 01:21:30 -0600 Subject: [PATCH 063/312] Fixes the inspector/component editor to display the components attached to an entity correctly in the inspector. --- Engine/source/gui/editor/guiInspector.cpp | 45 ++- Engine/source/gui/editor/guiInspector.h | 5 + .../gui/editor/inspector/componentGroup.cpp | 294 +++++++++++++++++- .../gui/editor/inspector/componentGroup.h | 8 +- .../gui/worldEditor/worldEditorSelection.cpp | 40 ++- Templates/BaseGame/game/core/main.cs | 6 + .../scripts/server/connectionToClient.cs | 17 + .../scripts/server/levelDownload.cs | 18 +- .../scripts/componentEditor.ed.cs | 98 +++++- .../tools/worldEditor/scripts/EditorGui.ed.cs | 26 ++ 10 files changed, 513 insertions(+), 44 deletions(-) diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 086995529..63e112c9e 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -32,6 +32,7 @@ #include "gui/editor/inspector/entityGroup.h" #include "gui/editor/inspector/mountingGroup.h" #include "gui/editor/inspector/componentGroup.h" +#include "T3D/components/component.h" IMPLEMENT_CONOBJECT(GuiInspector); @@ -590,6 +591,13 @@ void GuiInspector::refresh() //Entity inspector group if (mTargets.first()->getClassRep()->isSubclassOf("Entity")) { + //Put the GameObject group before everything that'd be gameobject-effecting, for orginazational purposes + GuiInspectorGroup *gameObject = new GuiInspectorGroup("GameObject", this); + + gameObject->registerObject(); + mGroups.push_back(gameObject); + addObject(gameObject); + GuiInspectorEntityGroup *components = new GuiInspectorEntityGroup("Components", this); if (components != NULL) { @@ -598,6 +606,29 @@ void GuiInspector::refresh() addObject(components); } + Entity* selectedEntity = dynamic_cast(mTargets.first().getObject()); + + U32 compCount = selectedEntity->getComponentCount(); + //Now, add the component groups + for (U32 c = 0; c < compCount; ++c) + { + Component* comp = selectedEntity->getComponent(c); + + String compName; + if (comp->getFriendlyName() != StringTable->EmptyString()) + compName = comp->getFriendlyName(); + else + compName = comp->getComponentName(); + + GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(compName, this, comp); + if (compGroup != NULL) + { + compGroup->registerObject(); + mGroups.push_back(compGroup); + addObject(compGroup); + } + } + //Mounting group override GuiInspectorGroup *mounting = new GuiInspectorMountingGroup("Mounting", this); if (mounting != NULL) @@ -608,20 +639,6 @@ void GuiInspector::refresh() } } - if (mTargets.first()->getClassRep()->isSubclassOf("Component")) - { - //Build the component field groups as the component describes it - Component* comp = dynamic_cast(mTargets.first().getPointer()); - - if (comp->getComponentFieldCount() > 0) - { - GuiInspectorComponentGroup *compGroup = new GuiInspectorComponentGroup("Component Fields", this); - compGroup->registerObject(); - mGroups.push_back(compGroup); - addObject(compGroup); - } - } - // Create the inspector groups for static fields. for( TargetVector::iterator iter = mTargets.begin(); iter != mTargets.end(); ++ iter ) diff --git a/Engine/source/gui/editor/guiInspector.h b/Engine/source/gui/editor/guiInspector.h index f5b00a796..1896b55dc 100644 --- a/Engine/source/gui/editor/guiInspector.h +++ b/Engine/source/gui/editor/guiInspector.h @@ -89,6 +89,9 @@ public: else return nullptr; } + + S32 getComponentGroupTargetId() { return mComponentGroupTargetId; } + void setComponentGroupTargetId(S32 compId) { mComponentGroupTargetId = compId; } /// Return the number of objects being inspected by this GuiInspector. U32 getNumInspectObjects() const { return mTargets.size(); } @@ -146,6 +149,8 @@ protected: /// Objects being inspected by this GuiInspector. TargetVector mTargets; + + S32 mComponentGroupTargetId; F32 mDividerPos; S32 mDividerMargin; diff --git a/Engine/source/gui/editor/inspector/componentGroup.cpp b/Engine/source/gui/editor/inspector/componentGroup.cpp index 7d6d30eaa..6e16db173 100644 --- a/Engine/source/gui/editor/inspector/componentGroup.cpp +++ b/Engine/source/gui/editor/inspector/componentGroup.cpp @@ -38,10 +38,11 @@ ConsoleDocClass(GuiInspectorComponentGroup, "@internal" ); -GuiInspectorComponentGroup::GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent) +GuiInspectorComponentGroup::GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent, Component* targetComponent) : GuiInspectorGroup(groupName, parent) { /*mNeedScroll=false;*/ + mTargetComponent = targetComponent; }; bool GuiInspectorComponentGroup::onAdd() @@ -89,15 +90,277 @@ bool GuiInspectorComponentGroup::inspectGroup() GuiRolloutCtrl *pArrayRollout = NULL; bool bGrabItems = false; - Component* comp = dynamic_cast(getInspector()->getInspectObject(0)); - //if this isn't a component, what are we even doing here? - if (!comp) + if (!mTargetComponent) return false; - for (U32 i = 0; i < comp->getComponentFieldCount(); i++) + mParent->setComponentGroupTargetId(mTargetComponent->getId()); + + //first, relevent static fields + AbstractClassRep::FieldList& fieldList = mTargetComponent->getClassRep()->mFieldList; + for (AbstractClassRep::FieldList::iterator itr = fieldList.begin(); + itr != fieldList.end(); ++itr) { - ComponentField* field = comp->getComponentField(i); + AbstractClassRep::Field* field = &(*itr); + if (field->type == AbstractClassRep::StartGroupFieldType) + { + // If we're dealing with general fields, always set grabItems to true (to skip them) + if (bNoGroup == true) + bGrabItems = true; + else if (dStricmp(field->pGroupname, mCaption) == 0) + bGrabItems = true; + continue; + } + else if (field->type == AbstractClassRep::EndGroupFieldType) + { + // If we're dealing with general fields, always set grabItems to false (to grab them) + if (bNoGroup == true) + bGrabItems = false; + else if (dStricmp(field->pGroupname, mCaption) == 0) + bGrabItems = false; + continue; + } + + // Skip field if it has the HideInInspectors flag set. + if (field->flag.test(AbstractClassRep::FIELD_HideInInspectors)) + continue; + + if (field->pFieldname == StringTable->insert("locked") || field->pFieldname == StringTable->insert("class") + || field->pFieldname == StringTable->insert("internalName")) + continue; + + if (/*(bGrabItems == true || (bNoGroup == true && bGrabItems == false)) &&*/ itr->type != AbstractClassRep::DeprecatedFieldType) + { + if (bNoGroup == true && bGrabItems == true) + continue; + + if (field->type == AbstractClassRep::StartArrayFieldType) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Beginning array '%s'", + field->pFieldname); +#endif + + // Starting an array... + // Create a rollout for the Array, give it the array's name. + GuiRolloutCtrl *arrayRollout = new GuiRolloutCtrl(); + GuiControlProfile *arrayRolloutProfile = dynamic_cast(Sim::findObject("GuiInspectorRolloutProfile0")); + + arrayRollout->setControlProfile(arrayRolloutProfile); + //arrayRollout->mCaption = StringTable->insert( String::ToString( "%s (%i)", field->pGroupname, field->elementCount ) ); + arrayRollout->setCaption(field->pGroupname); + //arrayRollout->setMargin( 14, 0, 0, 0 ); + arrayRollout->registerObject(); + + GuiStackControl *arrayStack = new GuiStackControl(); + arrayStack->registerObject(); + arrayStack->freeze(true); + arrayRollout->addObject(arrayStack); + + // Allocate a rollout for each element-count in the array + // Give it the element count name. + for (U32 i = 0; i < field->elementCount; i++) + { + GuiRolloutCtrl *elementRollout = new GuiRolloutCtrl(); + GuiControlProfile *elementRolloutProfile = dynamic_cast(Sim::findObject("GuiInspectorRolloutProfile0")); + + char buf[256]; + dSprintf(buf, 256, " [%i]", i); + + elementRollout->setControlProfile(elementRolloutProfile); + elementRollout->setCaption(buf); + //elementRollout->setMargin( 14, 0, 0, 0 ); + elementRollout->registerObject(); + + GuiStackControl *elementStack = new GuiStackControl(); + elementStack->registerObject(); + elementRollout->addObject(elementStack); + elementRollout->instantCollapse(); + + arrayStack->addObject(elementRollout); + } + + pArrayRollout = arrayRollout; + pArrayStack = arrayStack; + arrayStack->freeze(false); + pArrayRollout->instantCollapse(); + mStack->addObject(arrayRollout); + + bMakingArray = true; + continue; + } + else if (field->type == AbstractClassRep::EndArrayFieldType) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Ending array '%s'", + field->pFieldname); +#endif + + bMakingArray = false; + continue; + } + + if (bMakingArray) + { + // Add a GuiInspectorField for this field, + // for every element in the array... + for (U32 i = 0; i < pArrayStack->size(); i++) + { + FrameTemp intToStr(64); + dSprintf(intToStr, 64, "%d", i); + + // The array stack should have a rollout for each element + // as children... + GuiRolloutCtrl *pRollout = dynamic_cast(pArrayStack->at(i)); + // And the each of those rollouts should have a stack for + // fields... + GuiStackControl *pStack = dynamic_cast(pRollout->at(0)); + + // And we add a new GuiInspectorField to each of those stacks... + GuiInspectorField *fieldGui = constructField(field->type); + if (fieldGui == NULL) + fieldGui = new GuiInspectorField(); + + fieldGui->init(mParent, this); + StringTableEntry caption = field->pFieldname; + fieldGui->setInspectorField(field, caption, intToStr); + + if (fieldGui->registerObject()) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Adding array element '%s[%i]'", + field->pFieldname, i); +#endif + + mChildren.push_back(fieldGui); + pStack->addObject(fieldGui); + } + else + delete fieldGui; + } + + continue; + } + + // This is weird, but it should work for now. - JDD + // We are going to check to see if this item is an array + // if so, we're going to construct a field for each array element + if (field->elementCount > 1) + { + // Make a rollout control for this array + // + GuiRolloutCtrl *rollout = new GuiRolloutCtrl(); + rollout->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorRolloutProfile0"); + rollout->setCaption(String::ToString("%s (%i)", field->pFieldname, field->elementCount)); + rollout->setMargin(14, 0, 0, 0); + rollout->registerObject(); + mArrayCtrls.push_back(rollout); + + // Put a stack control within the rollout + // + GuiStackControl *stack = new GuiStackControl(); + stack->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorStackProfile"); + stack->registerObject(); + stack->freeze(true); + rollout->addObject(stack); + + mStack->addObject(rollout); + + // Create each field and add it to the stack. + // + for (S32 nI = 0; nI < field->elementCount; nI++) + { + FrameTemp intToStr(64); + dSprintf(intToStr, 64, "%d", nI); + + // Construct proper ValueName[nI] format which is "ValueName0" for index 0, etc. + + String fieldName = String::ToString("%s%d", field->pFieldname, nI); + + // If the field already exists, just update it + GuiInspectorField *fieldGui = findField(fieldName); + if (fieldGui != NULL) + { + fieldGui->updateValue(); + continue; + } + + bNewItems = true; + + fieldGui = constructField(field->type); + if (fieldGui == NULL) + fieldGui = new GuiInspectorField(); + + fieldGui->init(mParent, this); + StringTableEntry caption = StringTable->insert(String::ToString(" [%i]", nI)); + fieldGui->setInspectorField(field, caption, intToStr); + + fieldGui->setTargetObject(mTargetComponent); + + if (fieldGui->registerObject()) + { + mChildren.push_back(fieldGui); + stack->addObject(fieldGui); + } + else + delete fieldGui; + } + + stack->freeze(false); + stack->updatePanes(); + rollout->instantCollapse(); + } + else + { + // If the field already exists, just update it + GuiInspectorField *fieldGui = findField(field->pFieldname); + if (fieldGui != NULL) + { + fieldGui->updateValue(); + continue; + } + + bNewItems = true; + + fieldGui = constructField(field->type); + if (fieldGui == NULL) + fieldGui = new GuiInspectorField(); + + fieldGui->init(mParent, this); + fieldGui->setInspectorField(field); + + fieldGui->setTargetObject(mTargetComponent); + + if (fieldGui->registerObject()) + { +#ifdef DEBUG_SPEW + Platform::outputDebugString("[GuiInspectorGroup] Adding field '%s'", + field->pFieldname); +#endif + fieldGui->setValue(mTargetComponent->getDataField(field->pFieldname, NULL)); + + mChildren.push_back(fieldGui); + mStack->addObject(fieldGui); + } + else + { + SAFE_DELETE(fieldGui); + } + } + } + } + + for (U32 i = 0; i < mTargetComponent->getComponentFieldCount(); i++) + { + ComponentField* field = mTargetComponent->getComponentField(i); + + //first and foremost, nab the field type and check if it's a custom field or not. + //If it's not a custom field, proceed below, if it is, hand it off to script to be handled by the component + if (field->mFieldType == -1) + { + Con::executef(this, "onConstructComponentField", mTargetComponent, field->mFieldName); + continue; + } bNewItems = true; @@ -107,10 +370,12 @@ bool GuiInspectorComponentGroup::inspectGroup() fieldGui->init(mParent, this); - AbstractClassRep::Field *refField; + fieldGui->setTargetObject(mTargetComponent); + + AbstractClassRep::Field *refField = NULL; //check dynamics - SimFieldDictionary* fieldDictionary = comp->getFieldDictionary(); + SimFieldDictionary* fieldDictionary = mTargetComponent->getFieldDictionary(); SimFieldDictionaryIterator itr(fieldDictionary); while (*itr) @@ -196,6 +461,14 @@ void GuiInspectorComponentGroup::onMouseMove(const GuiEvent &event) { //mParent->mOverDivider = false; } + +void GuiInspectorComponentGroup::onRightMouseUp(const GuiEvent &event) +{ + //mParent->mOverDivider = false; + if (isMethod("onRightMouseUp")) + Con::executef(this, "onRightMouseUp", event.mousePoint); +} + ConsoleMethod(GuiInspectorComponentGroup, inspectGroup, bool, 2, 2, "Refreshes the dynamic fields in the inspector.") { return object->inspectGroup(); @@ -250,3 +523,8 @@ ConsoleMethod(GuiInspectorComponentGroup, addDynamicField, void, 2, 2, "obj.addD ConsoleMethod(GuiInspectorComponentGroup, removeDynamicField, void, 3, 3, "") { } + +DefineConsoleMethod(GuiInspectorComponentGroup, getComponent, S32, (), ,"") +{ + return object->getComponent()->getId(); +} diff --git a/Engine/source/gui/editor/inspector/componentGroup.h b/Engine/source/gui/editor/inspector/componentGroup.h index 34b748c98..f41c11b09 100644 --- a/Engine/source/gui/editor/inspector/componentGroup.h +++ b/Engine/source/gui/editor/inspector/componentGroup.h @@ -34,12 +34,14 @@ private: typedef GuiInspectorGroup Parent; GuiControl* mAddCtrl; + Component* mTargetComponent; + Vector tempFields; public: DECLARE_CONOBJECT(GuiInspectorComponentGroup); GuiInspectorComponentGroup() { /*mNeedScroll=false;*/ }; - GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent); + GuiInspectorComponentGroup(StringTableEntry groupName, SimObjectPtr parent, Component* targetComponent); //----------------------------------------------------------------------------- // inspectGroup is overridden in GuiInspectorComponentGroup to inspect an @@ -50,6 +52,7 @@ public: virtual void updateAllFields(); void onMouseMove(const GuiEvent &event); + virtual void onRightMouseUp(const GuiEvent &event); // For scriptable dynamic field additions void addDynamicField(); @@ -61,6 +64,9 @@ public: virtual SimFieldDictionary::Entry* findDynamicFieldInDictionary(StringTableEntry fieldName); AbstractClassRep::Field* findObjectBehaviorField(Component* target, String fieldName); + + Component* getComponent() { return mTargetComponent; } + protected: // create our inner controls when we add virtual bool createContent(); diff --git a/Engine/source/gui/worldEditor/worldEditorSelection.cpp b/Engine/source/gui/worldEditor/worldEditorSelection.cpp index eaaeb4c43..00311adea 100644 --- a/Engine/source/gui/worldEditor/worldEditorSelection.cpp +++ b/Engine/source/gui/worldEditor/worldEditorSelection.cpp @@ -23,7 +23,7 @@ #include "gui/worldEditor/worldEditorSelection.h" #include "gui/worldEditor/worldEditor.h" #include "scene/sceneObject.h" - +#include "T3D/entity.h" IMPLEMENT_CONOBJECT( WorldEditorSelection ); @@ -410,26 +410,34 @@ void WorldEditorSelection::rotate(const EulerF & rot, const Point3F & center) // single selections will rotate around own axis, multiple about world if(size() == 1) { - SceneObject* object = dynamic_cast< SceneObject* >( at( 0 ) ); - if( object ) + Entity* eO = dynamic_cast< Entity* >(at(0)); + if (eO) { - MatrixF mat = object->getTransform(); + eO->setTransform(eO->getPosition(), eO->getRotation() + RotationF(rot)); + } + else + { + SceneObject* object = dynamic_cast(at(0)); + if (object) + { + MatrixF mat = object->getTransform(); - Point3F pos; - mat.getColumn(3, &pos); + Point3F pos; + mat.getColumn(3, &pos); - // get offset in obj space - Point3F offset = pos - center; - MatrixF wMat = object->getWorldTransform(); - wMat.mulV(offset); + // get offset in obj space + Point3F offset = pos - center; + MatrixF wMat = object->getWorldTransform(); + wMat.mulV(offset); - // - MatrixF transform(EulerF(0,0,0), -offset); - transform.mul(MatrixF(rot)); - transform.mul(MatrixF(EulerF(0,0,0), offset)); - mat.mul(transform); + // + MatrixF transform(EulerF(0, 0, 0), -offset); + transform.mul(MatrixF(rot)); + transform.mul(MatrixF(EulerF(0, 0, 0), offset)); + mat.mul(transform); - object->setTransform(mat); + object->setTransform(mat); + } } } else diff --git a/Templates/BaseGame/game/core/main.cs b/Templates/BaseGame/game/core/main.cs index a8a396f41..8058c1f90 100644 --- a/Templates/BaseGame/game/core/main.cs +++ b/Templates/BaseGame/game/core/main.cs @@ -41,6 +41,12 @@ $Core::UnAvailableTexturePath = "core/images/unavailable"; $Core::WarningTexturePath = "core/images/warnMat"; $Core::CommonShaderPath = "core/shaders"; +ModuleDatabase.setModuleExtension("module"); + +//Core components +ModuleDatabase.scanModules( "core", false ); +ModuleDatabase.LoadExplicit( "CoreComponentsModule" ); + exec("./helperFunctions.cs"); // We need some of the default GUI profiles in order to get the canvas and diff --git a/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs b/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs index c3a4a3e26..38709c971 100644 --- a/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs +++ b/Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs @@ -132,6 +132,23 @@ function isNameUnique(%name) // function GameConnection::onDrop(%client, %reason) { + %entityIds = parseMissionGroupForIds("Entity", ""); + %entityCount = getWordCount(%entityIds); + + for(%i=0; %i < %entityCount; %i++) + { + %entity = getWord(%entityIds, %i); + + for(%e=0; %e < %entity.getCount(); %e++) + { + %child = %entity.getObject(%e); + if(%child.getClassName() $= "Entity") + %entityIds = %entityIds SPC %child.getID(); + } + + %entity.notify("onClientDisconnect", %client); + } + if($missionRunning) theLevelInfo.onClientLeaveGame(); diff --git a/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs b/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs index a598ee04f..e33f80711 100644 --- a/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs +++ b/Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs @@ -131,6 +131,22 @@ function serverCmdMissionStartPhase3Ack(%client, %seq) %client.currentPhase = 3; // Server is ready to drop into the game + %entityIds = parseMissionGroupForIds("Entity", ""); + %entityCount = getWordCount(%entityIds); + + for(%i=0; %i < %entityCount; %i++) + { + %entity = getWord(%entityIds, %i); + + for(%e=0; %e < %entity.getCount(); %e++) + { + %child = %entity.getObject(%e); + if(%child.getCLassName() $= "Entity") + %entityIds = %entityIds SPC %child.getID(); + } + + %entity.notify("onClientConnect", %client); + } //Have any special game-play handling here if(theLevelInfo.isMethod("onClientEnterGame")) @@ -151,7 +167,7 @@ function serverCmdMissionStartPhase3Ack(%client, %seq) }; } - if (isDefined("$Game::DefaultCameraClass")) + //if (isDefined("$Game::DefaultCameraClass")) %client.camera = spawnObject("Camera", Observer); } diff --git a/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs b/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs index 9a9ce33d6..a2a62b08a 100644 --- a/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs +++ b/Templates/BaseGame/game/tools/componentEditor/scripts/componentEditor.ed.cs @@ -154,13 +154,13 @@ function QuickEditComponentList::onHotTrackItem( %this, %itemID ) SuperTooltipDlg.setTitle(%componentObj.friendlyName); SuperTooltipDlg.addParam("", %componentObj.description @ "\n"); - %fieldCount = %componentObj.getComponentFieldCount(); + /*%fieldCount = %componentObj.getComponentFieldCount(); for (%i = 0; %i < %fieldCount; %i++) { %name = getField(%componentObj.getComponentField(%i), 0); SuperTooltipDlg.addParam(%name, %description @ "\n"); - } + }*/ %position = %this.getGlobalPosition(); SuperTooltipDlg.processTooltip( %position,0,1 ); %this.opened = true; @@ -219,7 +219,7 @@ function AddComponentQuickEditButton::onClick(%this) %instance.owner = Inspector.getInspectObject(0); %instance.owner.add(%instance); - Inspector.schedule( 50, "refresh" ); + schedule( 50, 0, "refreshInspector", Inspector.getInspectObject(0) ); EWorldEditor.isDirty = true; } @@ -227,7 +227,97 @@ function addComponent(%obj, %instance) { echo("Adding the component!"); %obj.addComponent(%instance); - Inspector.schedule( 50, "refresh" ); + //Inspector.schedule( 50, "refresh" ); + schedule( 50, 0, "refreshInspector", Inspector.getInspectObject(0) ); EWorldEditor.isDirty = true; } +function refreshInspector(%entity) +{ + inspector.removeInspect(%entity); + inspector.addInspect(%entity); +} + +function GuiInspectorComponentGroup::onConstructComponentField(%this, %component, %fieldName) +{ + //echo("Tried to make a component field for component:" @ %component @ " for the " @ %fieldName @ " field."); + + %fieldType = %component.getComponentFieldType(%fieldName); + %makeCommand = %this @ ".build" @ %fieldType @ "Field("@ %component @ "," @ %fieldName @ ");"; + eval(%makeCommand); +} + +function GuiInspectorComponentGroup::onRightMouseUp(%this, %point) +{ + if( !isObject( InspectComponentPopup ) ) + new PopupMenu( InspectComponentPopup ) + { + superClass = "MenuBuilder"; + isPopup = true; + + item[ 0 ] = "View in Asset Browser" TAB "" TAB "AssetBrowser.editAsset();"; + item[ 1 ] = "Delete Component" TAB "" TAB "schedule(10, 0, ComponentEditorRemoveComponent, InspectComponentPopup.componentOwner, InspectComponentPopup.component);"; + item[ 2 ] = "Edit Script" TAB "" TAB "AssetBrowser.editAsset();"; + item[ 3 ] = ""; + }; + + %comp = %this.getComponent(); + InspectComponentPopup.componentOwner = %comp.owner; + InspectComponentPopup.component = %comp; + + //Find out our asset! + %componentName = %this.caption; + + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "ComponentAsset")) + return; //if we didn't find ANY, just exit + + EditAssetPopup.assetId = ""; + + // Find all the types. + %count = %assetQuery.getCount(); + + %categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %friendlyName = %componentAsset.friendlyName; + + if(%friendlyName !$= "" && %friendlyName $= %componentName) + { + EditAssetPopup.assetId = %assetId; + break; + } + + %compName = %componentAsset.componentName; + + if(%compName !$= "" && %compName $= %componentName) + { + EditAssetPopup.assetId = %assetId; + break; + } + } + + if(EditAssetPopup.assetId $= "") + { + //didn't find it + InspectComponentPopup.enableItem(0, false); + InspectComponentPopup.enableItem(2, false); + } + else + { + InspectComponentPopup.enableItem(0, true); + InspectComponentPopup.enableItem(2, true); + } + + InspectComponentPopup.showPopup(Canvas); +} + +function ComponentEditorRemoveComponent(%entity, %component) +{ + %entity.removeComponent(%component, true); + inspector.removeInspect(%entity); + inspector.addInspect(%entity); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index bc1905292..f6e88eece 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1302,6 +1302,7 @@ function VisibilityDropdownToggle() { EVisibility.setVisible(true); visibilityToggleBtn.setStateOn(1); + EVisibility.setExtent("200 540"); } } @@ -1641,6 +1642,31 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) object = -1; }; + + if(%obj.isMemberOfClass("Entity")) + { + if( !isObject( GameObjectPopup ) ) + %popup = new PopupMenu( GameObjectPopup : ETSimGroupContextPopup ) + { + //item[ 12 ] = "-"; + item[ 12 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; + item[ 13 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; + item[ 14 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; + }; + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + GameObjectPopup.enableItem(12, true); + GameObjectPopup.enableItem(13, false); + GameObjectPopup.enableItem(14, false); + } + else + { + GameObjectPopup.enableItem(12, false); + GameObjectPopup.enableItem(13, true); + GameObjectPopup.enableItem(14, true); + } + } %popup.object = %obj; From f657f774cec4600d78574e92d0ff5e1474c87aff Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 6 Dec 2017 14:09:27 -0600 Subject: [PATCH 064/312] Updates Native File Dialogs lib to enable browsing and selecting of folders, instead of just files. --- Engine/lib/nativeFileDialogs/SConstruct | 5 +- Engine/lib/nativeFileDialogs/common.h | 2 +- Engine/lib/nativeFileDialogs/include/nfd.h | 5 + Engine/lib/nativeFileDialogs/nfd_cocoa.m | 43 +++++- Engine/lib/nativeFileDialogs/nfd_gtk.c | 63 +++++++- Engine/lib/nativeFileDialogs/nfd_win.cpp | 141 +++++++++++++++++- .../platform/nativeDialogs/fileDialog.cpp | 6 +- 7 files changed, 250 insertions(+), 15 deletions(-) diff --git a/Engine/lib/nativeFileDialogs/SConstruct b/Engine/lib/nativeFileDialogs/SConstruct index 342fa1a3a..b1a9e4881 100644 --- a/Engine/lib/nativeFileDialogs/SConstruct +++ b/Engine/lib/nativeFileDialogs/SConstruct @@ -3,7 +3,8 @@ # # Scons build script -- GCC, Clang, Visual Studio # Does not build test - +# +# SCons builds are deprecated -- see README.md for details. import os @@ -97,3 +98,5 @@ set_warnings(nfd_env) nfd_env.Append( CPPPATH=['.','./include'] ) nfd_env.StaticLibrary( get_lib_name('nfd', debug), nfd_files ) + +print "*** Scons builds are deprecated! See README.md for details." diff --git a/Engine/lib/nativeFileDialogs/common.h b/Engine/lib/nativeFileDialogs/common.h index 688b0b1fd..7745d323b 100644 --- a/Engine/lib/nativeFileDialogs/common.h +++ b/Engine/lib/nativeFileDialogs/common.h @@ -11,7 +11,7 @@ #define _NFD_COMMON_H #define NFD_MAX_STRLEN 256 -#define _NFD_UNUSED(x) ((void)x) +#define _NFD_UNUSED(x) ((void)x) void *NFDi_Malloc( size_t bytes ); void NFDi_Free( void *ptr ); diff --git a/Engine/lib/nativeFileDialogs/include/nfd.h b/Engine/lib/nativeFileDialogs/include/nfd.h index 03fe53206..74c92743f 100644 --- a/Engine/lib/nativeFileDialogs/include/nfd.h +++ b/Engine/lib/nativeFileDialogs/include/nfd.h @@ -50,6 +50,11 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, const nfdchar_t *defaultPath, nfdchar_t **outPath ); + +/* select folder dialog */ +nfdresult_t NFD_PickFolder( const nfdchar_t *defaultPath, + nfdchar_t **outPath); + /* nfd_common.c */ /* get last error -- set when nfdresult_t returns NFD_ERROR */ diff --git a/Engine/lib/nativeFileDialogs/nfd_cocoa.m b/Engine/lib/nativeFileDialogs/nfd_cocoa.m index a73e15714..d3fb48347 100644 --- a/Engine/lib/nativeFileDialogs/nfd_cocoa.m +++ b/Engine/lib/nativeFileDialogs/nfd_cocoa.m @@ -122,7 +122,8 @@ nfdresult_t NFD_OpenDialog( const char *filterList, nfdchar_t **outPath ) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - + + NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; NSOpenPanel *dialog = [NSOpenPanel openPanel]; [dialog setAllowsMultipleSelection:NO]; @@ -152,6 +153,7 @@ nfdresult_t NFD_OpenDialog( const char *filterList, } [pool release]; + [keyWindow makeKeyAndOrderFront:nil]; return nfdResult; } @@ -233,3 +235,42 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, return nfdResult; } + +nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, + nfdchar_t **outPath) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + NSWindow *keyWindow = [[NSApplication sharedApplication] keyWindow]; + NSOpenPanel *dialog = [NSOpenPanel openPanel]; + [dialog setAllowsMultipleSelection:NO]; + [dialog setCanChooseDirectories:YES]; + [dialog setCanCreateDirectories:YES]; + [dialog setCanChooseFiles:NO]; + + // Set the starting directory + SetDefaultPath(dialog, defaultPath); + + nfdresult_t nfdResult = NFD_CANCEL; + if ( [dialog runModal] == NSModalResponseOK ) + { + NSURL *url = [dialog URL]; + const char *utf8Path = [[url path] UTF8String]; + + // byte count, not char count + size_t len = strlen(utf8Path);//NFDi_UTF8_Strlen(utf8Path); + + *outPath = NFDi_Malloc( len+1 ); + if ( !*outPath ) + { + [pool release]; + return NFD_ERROR; + } + memcpy( *outPath, utf8Path, len+1 ); /* copy null term */ + nfdResult = NFD_OKAY; + } + [pool release]; + + [keyWindow makeKeyAndOrderFront:nil]; + return nfdResult; +} diff --git a/Engine/lib/nativeFileDialogs/nfd_gtk.c b/Engine/lib/nativeFileDialogs/nfd_gtk.c index fd15a86dd..65bc41dad 100644 --- a/Engine/lib/nativeFileDialogs/nfd_gtk.c +++ b/Engine/lib/nativeFileDialogs/nfd_gtk.c @@ -47,14 +47,10 @@ static void AddFiltersToDialog( GtkWidget *dialog, const char *filterList ) if ( NFDi_IsFilterSegmentChar(*p_filterList) ) { char typebufWildcard[NFD_MAX_STRLEN]; - /* add another type to the filter */ - if (strlen(typebuf) <= 0 || strlen(typebuf) > NFD_MAX_STRLEN-1) - { - p_filterList++; - continue; - } - + assert( strlen(typebuf) > 0 ); + assert( strlen(typebuf) < NFD_MAX_STRLEN-1 ); + snprintf( typebufWildcard, NFD_MAX_STRLEN, "*.%s", typebuf ); AddTypeToFilterName( typebuf, filterName, NFD_MAX_STRLEN ); @@ -297,6 +293,59 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, /* Build the filter list */ AddFiltersToDialog(dialog, filterList); + /* Set the default path */ + SetDefaultPath(dialog, defaultPath); + + result = NFD_CANCEL; + if ( gtk_dialog_run( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) + { + char *filename; + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(dialog) ); + + { + size_t len = strlen(filename); + *outPath = NFDi_Malloc( len + 1 ); + memcpy( *outPath, filename, len + 1 ); + if ( !*outPath ) + { + g_free( filename ); + gtk_widget_destroy(dialog); + return NFD_ERROR; + } + } + g_free(filename); + + result = NFD_OKAY; + } + + WaitForCleanup(); + gtk_widget_destroy(dialog); + WaitForCleanup(); + + return result; +} + +nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, + nfdchar_t **outPath) +{ + GtkWidget *dialog; + nfdresult_t result; + + if (!gtk_init_check(NULL, NULL)) + { + NFDi_SetError(INIT_FAIL_MSG); + return NFD_ERROR; + } + + dialog = gtk_file_chooser_dialog_new( "Select folder", + NULL, + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + "_Cancel", GTK_RESPONSE_CANCEL, + "_Select", GTK_RESPONSE_ACCEPT, + NULL ); + gtk_file_chooser_set_do_overwrite_confirmation( GTK_FILE_CHOOSER(dialog), TRUE ); + + /* Set the default path */ SetDefaultPath(dialog, defaultPath); diff --git a/Engine/lib/nativeFileDialogs/nfd_win.cpp b/Engine/lib/nativeFileDialogs/nfd_win.cpp index 45878824a..a73fd8a46 100644 --- a/Engine/lib/nativeFileDialogs/nfd_win.cpp +++ b/Engine/lib/nativeFileDialogs/nfd_win.cpp @@ -9,13 +9,17 @@ #define UNICODE #endif +#ifdef __MINGW32__ +// Explicitly setting NTDDI version, this is necessary for the MinGW compiler +#define NTDDI_VERSION NTDDI_VISTA +#define _WIN32_WINNT _WIN32_WINNT_VISTA +#endif #include #include #include #include #include - #include "nfd_common.h" @@ -359,14 +363,15 @@ nfdresult_t NFD_OpenDialog( const char *filterList, HRESULT result = ::CoInitializeEx(NULL, ::COINIT_APARTMENTTHREADED | ::COINIT_DISABLE_OLE1DDE ); + + ::IFileOpenDialog *fileOpenDialog(NULL); + if ( !SUCCEEDED(result)) { NFDi_SetError("Could not initialize COM."); goto end; } - ::IFileOpenDialog *fileOpenDialog(NULL); - // Create dialog result = ::CoCreateInstance(::CLSID_FileOpenDialog, NULL, CLSCTX_ALL, ::IID_IFileOpenDialog, @@ -616,3 +621,133 @@ nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList, return nfdResult; } + +class AutoCoInit +{ +public: + AutoCoInit() + { + mResult = ::CoInitializeEx(NULL, + ::COINIT_APARTMENTTHREADED | + ::COINIT_DISABLE_OLE1DDE); + } + + ~AutoCoInit() + { + if (SUCCEEDED(mResult)) + { + ::CoUninitialize(); + } + } + + HRESULT Result() const { return mResult; } +private: + HRESULT mResult; +}; + +// VS2010 hasn't got a copy of CComPtr - this was first added in the 2003 SDK, so we make our own small CComPtr instead +template +class ComPtr +{ +public: + ComPtr() : mPtr(NULL) { } + ~ComPtr() + { + if (mPtr) + { + mPtr->Release(); + } + } + + T* Ptr() const { return mPtr; } + T** operator&() { return &mPtr; } + T* operator->() const { return mPtr; } +private: + // Don't allow copy or assignment + ComPtr(const ComPtr&); + ComPtr& operator = (const ComPtr&) const; + T* mPtr; +}; + +nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath, + nfdchar_t **outPath) +{ + // Init COM + AutoCoInit autoCoInit; + if (!SUCCEEDED(autoCoInit.Result())) + { + NFDi_SetError("CoInitializeEx failed."); + return NFD_ERROR; + } + + // Create the file dialog COM object + ComPtr pFileDialog; + if (!SUCCEEDED(CoCreateInstance(CLSID_FileOpenDialog, + NULL, + CLSCTX_ALL, + IID_PPV_ARGS(&pFileDialog)))) + { + NFDi_SetError("CoCreateInstance for CLSID_FileOpenDialog failed."); + return NFD_ERROR; + } + + // Set the default path + if (SetDefaultPath(pFileDialog.Ptr(), defaultPath) != NFD_OKAY) + { + NFDi_SetError("SetDefaultPath failed."); + return NFD_ERROR; + } + + // Get the dialogs options + DWORD dwOptions = 0; + if (!SUCCEEDED(pFileDialog->GetOptions(&dwOptions))) + { + NFDi_SetError("GetOptions for IFileDialog failed."); + return NFD_ERROR; + } + + // Add in FOS_PICKFOLDERS which hides files and only allows selection of folders + if (!SUCCEEDED(pFileDialog->SetOptions(dwOptions | FOS_PICKFOLDERS))) + { + NFDi_SetError("SetOptions for IFileDialog failed."); + return NFD_ERROR; + } + + // Show the dialog to the user + const HRESULT result = pFileDialog->Show(NULL); + if (result == HRESULT_FROM_WIN32(ERROR_CANCELLED)) + { + return NFD_CANCEL; + } + else if (!SUCCEEDED(result)) + { + NFDi_SetError("Show for IFileDialog failed."); + return NFD_ERROR; + } + + // Get the shell item result + ComPtr pShellItem; + if (!SUCCEEDED(pFileDialog->GetResult(&pShellItem))) + { + return NFD_OKAY; + } + + // Finally get the path + wchar_t *path = NULL; + if (!SUCCEEDED(pShellItem->GetDisplayName(SIGDN_DESKTOPABSOLUTEPARSING, &path))) + { + NFDi_SetError("GetDisplayName for IShellItem failed."); + return NFD_ERROR; + } + + // Convert string + CopyWCharToNFDChar(path, outPath); + CoTaskMemFree(path); + if (!*outPath) + { + // error is malloc-based, error message would be redundant + return NFD_ERROR; + } + + return NFD_OKAY; +} diff --git a/Engine/source/platform/nativeDialogs/fileDialog.cpp b/Engine/source/platform/nativeDialogs/fileDialog.cpp index 09ed1c63e..34e57e3e6 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.cpp +++ b/Engine/source/platform/nativeDialogs/fileDialog.cpp @@ -252,12 +252,14 @@ bool FileDialog::Execute() rootDir.replace("/", "\\"); #endif - if (mData.mStyle & FileDialogData::FDS_OPEN) + if (mData.mStyle & FileDialogData::FDS_OPEN && !(mData.mStyle & FileDialogData::FDS_BROWSEFOLDER)) result = NFD_OpenDialog(strippedFilters.c_str(), defaultPath.c_str(), &outPath); - else if (mData.mStyle & FileDialogData::FDS_SAVE) + else if (mData.mStyle & FileDialogData::FDS_SAVE && !(mData.mStyle & FileDialogData::FDS_BROWSEFOLDER)) result = NFD_SaveDialog(strippedFilters.c_str(), defaultPath.c_str(), &outPath); else if (mData.mStyle & FileDialogData::FDS_MULTIPLEFILES) result = NFD_OpenDialogMultiple(strippedFilters.c_str(), defaultPath.c_str(), &pathSet); + else if (mData.mStyle & FileDialogData::FDS_BROWSEFOLDER) + result = NFD_PickFolder(defaultPath.c_str(), &outPath); if (result == NFD_CANCEL) { From ae6b035f107e1bc9cd466a15358ce83ec7865e34 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Fri, 8 Dec 2017 20:50:44 +0100 Subject: [PATCH 065/312] Improve console dump with additional information, such as array sizes and variadic function --- Engine/source/console/consoleDoc.cpp | 30 ++++++++++++++++++----- Engine/source/console/consoleInternal.cpp | 4 ++- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index b63d7293a..4fb6921dd 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -185,7 +185,7 @@ void printGroupStart(const char * aName, const char * aDocs) Con::printf(" /*! */"); } -void printClassMember(const bool isDeprec, const char * aType, const char * aName, const char * aDocs) +void printClassMember(const bool isDeprec, const char * aType, const char * aName, const char * aDocs, S32 aElementCount) { Con::printf(" /*!"); @@ -200,7 +200,14 @@ void printClassMember(const bool isDeprec, const char * aType, const char * aNam Con::printf(" */"); - Con::printf(" %s %s;", isDeprec ? "deprecated" : aType, aName); + if (aElementCount == 1) + { + Con::printf(" %s %s;", isDeprec ? "deprecated" : aType, aName); + } + else + { + Con::printf(" %s %s[%i];", isDeprec ? "deprecated" : aType, aName, aElementCount); + } } void printGroupEnd() @@ -235,8 +242,17 @@ void Namespace::printNamespaceEntries(Namespace * g, bool dumpScript, bool dumpE // If it's a function if( eType >= Entry::ConsoleFunctionType ) { - printClassMethod(true, typeNames[eType], funcName, ewalk->getArgumentsString().c_str(), - ewalk->getDocString().c_str()); + if (ewalk->mHeader != NULL) + { + // The function was defined with types, so we can print out the actual return type + printClassMethod(true, ewalk->mHeader->mReturnString, funcName, ewalk->getArgumentsString().c_str(), + ewalk->getDocString().c_str()); + } + else + { + printClassMethod(true, typeNames[eType], funcName, (ewalk->getArgumentsString() + "...").c_str(), + ewalk->getDocString().c_str()); + } } else if(ewalk->mType == Entry::GroupMarker) { @@ -416,7 +432,8 @@ void Namespace::dumpClasses( bool dumpScript, bool dumpEngine ) true, "", (*fieldList)[j].pFieldname, - (*fieldList)[j].pFieldDocs + (*fieldList)[j].pFieldDocs, + (*fieldList)[j].elementCount ); } else @@ -427,7 +444,8 @@ void Namespace::dumpClasses( bool dumpScript, bool dumpEngine ) false, cbt ? cbt->getTypeClassName() : "", (*fieldList)[j].pFieldname, - (*fieldList)[j].pFieldDocs + (*fieldList)[j].pFieldDocs, + (*fieldList)[j].elementCount ); } } diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index 1d1477325..eadee5d7b 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -1607,8 +1607,10 @@ namespace { if (dStrcmp(nativeType, "char*") == 0 || dStrcmp(nativeType, "char *") == 0) return "string"; - else if (dStrcmp(nativeType, "S32") == 0 || dStrcmp(nativeType, "U32") == 0) + else if (dStrcmp(nativeType, "S32") == 0) return "int"; + else if (dStrcmp(nativeType, "U32") == 0) + return "uint"; else if (dStrcmp(nativeType, "F32") == 0) return "float"; From 2bd43efcb9d3d95acf84143481cc0b07d019d798 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Fri, 8 Dec 2017 21:08:35 +0100 Subject: [PATCH 066/312] Fix minor errors in console function definitions --- Engine/source/T3D/item.cpp | 2 +- Engine/source/T3D/shapeBase.cpp | 2 +- Engine/source/scene/sceneManager.cpp | 2 +- Engine/source/scene/sceneObject.cpp | 2 +- Engine/source/sim/actionMap.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index 8970e3e3c..e6d21b93a 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -1209,7 +1209,7 @@ DefineEngineMethod( Item, isRotating, bool, (),, return object->isRotating(); } -DefineEngineMethod( Item, setCollisionTimeout, bool, (S32 ignoreColObj),(NULL), +DefineEngineMethod( Item, setCollisionTimeout, bool, (S32 ignoreColObj),, "@brief Temporarily disable collisions against a specific ShapeBase object.\n\n" "This is useful to prevent a player from immediately picking up an Item they have " diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 5f71a7eb9..643a5955d 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -4405,7 +4405,7 @@ DefineEngineMethod( ShapeBase, getEyeTransform, TransformF, (),, return mat; } -DefineEngineMethod( ShapeBase, getLookAtPoint, const char*, ( F32 distance, S32 typeMask ), ( 2000, 0xFFFFFFFF ), +DefineEngineMethod( ShapeBase, getLookAtPoint, const char*, ( F32 distance, U32 typeMask ), ( 2000, 0xFFFFFFFF ), "@brief Get the world position this object is looking at.\n\n" "Casts a ray from the eye and returns information about what the ray hits.\n" diff --git a/Engine/source/scene/sceneManager.cpp b/Engine/source/scene/sceneManager.cpp index caa117e9a..e40caecfc 100644 --- a/Engine/source/scene/sceneManager.cpp +++ b/Engine/source/scene/sceneManager.cpp @@ -740,7 +740,7 @@ DefineConsoleFunction( sceneDumpZoneStates, void, ( bool updateFirst ), ( true ) //----------------------------------------------------------------------------- -DefineConsoleFunction( sceneGetZoneOwner, SceneObject*, ( U32 zoneId ), ( true ), +DefineConsoleFunction( sceneGetZoneOwner, SceneObject*, ( U32 zoneId ),, "Return the SceneObject that contains the given zone.\n\n" "@param zoneId ID of zone.\n" "@return A SceneObject or NULL if the given @a zoneId is invalid.\n\n" diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index 6605f5407..a6be00320 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -1265,7 +1265,7 @@ DefineEngineMethod( SceneObject, getType, S32, (),, //----------------------------------------------------------------------------- DefineEngineMethod( SceneObject, mountObject, bool, - ( SceneObject* objB, S32 slot, TransformF txfm ), ( MatrixF::Identity ), + ( SceneObject* objB, S32 slot, TransformF txfm ), ( TransformF::Identity ), "@brief Mount objB to this object at the desired slot with optional transform.\n\n" "@param objB Object to mount onto us\n" diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 88bcde89e..a2af2d6ba 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -1868,7 +1868,7 @@ static ConsoleDocFragment _ActionMapbind2( "ActionMap", "bool bind( string device, string action, string flag, string deadZone, string scale, string command );"); -ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier spec, mod...], command )" +ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier, spec, mod...], command )" "@hide") { StringStackWrapper args(argc - 2, argv + 2); From 86a0ba44d31ac1516b583858eb9bdf3f8da2ce59 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sun, 10 Dec 2017 18:57:46 +0100 Subject: [PATCH 067/312] Cleanup of the elements exposed to the console --- Engine/source/T3D/entity.cpp | 4 ++-- Engine/source/afx/afxCamera.cpp | 4 ++-- Engine/source/afx/afxChoreographer.cpp | 4 ++-- Engine/source/afx/ui/afxSpellButton.cpp | 4 ++-- Engine/source/afx/ui/afxTSCtrl.cpp | 2 +- Engine/source/afx/util/afxParticlePool.cpp | 2 ++ Engine/source/module/moduleDefinition.cpp | 2 -- Engine/source/sim/actionMap.cpp | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index b81974cfe..d58d086c6 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -1654,7 +1654,7 @@ ConsoleMethod(Entity, addComponents, void, 2, 2, "() - Add all fielded behaviors object->addComponents(); }*/ -ConsoleMethod(Entity, addComponent, bool, 3, 3, "(ComponentInstance bi) - Add a behavior to the object\n" +ConsoleMethod(Entity, addComponent, bool, 3, 3, "(Component* bi) - Add a behavior to the object\n" "@param bi The behavior instance to add" "@return (bool success) Whether or not the behavior was successfully added") { @@ -1679,7 +1679,7 @@ ConsoleMethod(Entity, addComponent, bool, 3, 3, "(ComponentInstance bi) - Add a return false; } -ConsoleMethod(Entity, removeComponent, bool, 3, 4, "(ComponentInstance bi, [bool deleteBehavior = true])\n" +ConsoleMethod(Entity, removeComponent, bool, 3, 4, "(Component* bi, [bool deleteBehavior = true])\n" "@param bi The behavior instance to remove\n" "@param deleteBehavior Whether or not to delete the behavior\n" "@return (bool success) Whether the behavior was successfully removed") diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index 0a914ad11..63ad635ac 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -453,7 +453,7 @@ const char* afxCamera::getMode() static char buffer[100]; ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8, - "(GameBase orbitObject, transform mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" + "(GameBase orbitObject, TransformF mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" "Set the camera to orbit around some given object.\n\n" "@param orbitObject Object we want to orbit.\n" "@param mat A set of fields: posX posY posZ aaX aaY aaZ aaTheta\n" @@ -541,7 +541,7 @@ ConsoleMethod(afxCamera, getThirdPersonAngle, F32, 2, 2, "") return object->getThirdPersonAngle(); } -ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, Point3f coi_offset])") +ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, Point3F coi_offset])") { Point3F offset; dSscanf(argv[2], "%f %f %f", &offset.x, &offset.y, &offset.z); diff --git a/Engine/source/afx/afxChoreographer.cpp b/Engine/source/afx/afxChoreographer.cpp index 581ba42ba..5473552f5 100644 --- a/Engine/source/afx/afxChoreographer.cpp +++ b/Engine/source/afx/afxChoreographer.cpp @@ -848,13 +848,13 @@ void afxChoreographer::unregisterParticlePool(afxParticlePool* pool) //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// -DefineEngineMethod( afxChoreographer, setRanking, void, ( unsigned int ranking ),, +DefineEngineMethod( afxChoreographer, setRanking, void, ( U32 ranking ),, "Set a ranking value (0-255) for the choreographer.\n" ) { object->setRanking((U8)ranking); } -DefineEngineMethod( afxChoreographer, setLevelOfDetail, void, ( unsigned int lod ),, +DefineEngineMethod( afxChoreographer, setLevelOfDetail, void, ( U32 lod ),, "Set a level-of-detail value (0-255) for the choreographer.\n" ) { object->setLevelOfDetail((U8)lod); diff --git a/Engine/source/afx/ui/afxSpellButton.cpp b/Engine/source/afx/ui/afxSpellButton.cpp index 149423dd0..2ca1e4473 100644 --- a/Engine/source/afx/ui/afxSpellButton.cpp +++ b/Engine/source/afx/ui/afxSpellButton.cpp @@ -343,13 +343,13 @@ afxRPGMagicSpellData* afxSpellButton::getSpellRPGDataBlock() const //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// -DefineEngineMethod( afxSpellButton, onSpellbookChange, void, ( afxSpellBook* spellbook, unsigned int page ),, +DefineEngineMethod( afxSpellButton, onSpellbookChange, void, ( afxSpellBook* spellbook, U32 page ),, "Notify an afxSpellButton when its associated spellbook has changed.\n" ) { object->setSpellBook(spellbook, (U8)page); } -DefineEngineMethod( afxSpellButton, onTurnPage, void, ( unsigned int page ),, +DefineEngineMethod( afxSpellButton, onTurnPage, void, (U32 page ),, "Notify an afxSpellButton when the spellbook turns to a new page.\n" ) { object->setPage((U8)page); diff --git a/Engine/source/afx/ui/afxTSCtrl.cpp b/Engine/source/afx/ui/afxTSCtrl.cpp index 5766b43a4..5a308601c 100644 --- a/Engine/source/afx/ui/afxTSCtrl.cpp +++ b/Engine/source/afx/ui/afxTSCtrl.cpp @@ -329,7 +329,7 @@ DefineEngineMethod(afxTSCtrl, setSpellBook, void, (afxSpellBook* spellbook),, object->setSpellBook(spellbook); } -DefineEngineMethod(afxTSCtrl, pushTargetingMode, void, (unsigned int mode, unsigned int checkMethod), ((U32)arcaneFX::TARGETING_OFF, (U32)arcaneFX::TARGET_CHECK_POLL), +DefineEngineMethod(afxTSCtrl, pushTargetingMode, void, (U32 mode, U32 checkMethod), ((U32)arcaneFX::TARGETING_OFF, (U32)arcaneFX::TARGET_CHECK_POLL), "Push a new targeting-mode onto a statck of modes.\n\n" "@ingroup AFX") { diff --git a/Engine/source/afx/util/afxParticlePool.cpp b/Engine/source/afx/util/afxParticlePool.cpp index 37647f294..e6dbb172f 100644 --- a/Engine/source/afx/util/afxParticlePool.cpp +++ b/Engine/source/afx/util/afxParticlePool.cpp @@ -60,6 +60,8 @@ afxParticlePoolData::afxParticlePoolData(const afxParticlePoolData& other, bool ImplementEnumType( afxParticlePool_PoolType, "Possible particle pool types.\n" "@ingroup afxParticlePool\n\n" ) { afxParticlePoolData::POOL_NORMAL, "normal", "..." }, { afxParticlePoolData::POOL_TWOPASS, "two-pass", "..." }, +// Alias... + { afxParticlePoolData::POOL_TWOPASS, "twopass", "..." }, EndImplementEnumType; afxParticlePoolData::~afxParticlePoolData() diff --git a/Engine/source/module/moduleDefinition.cpp b/Engine/source/module/moduleDefinition.cpp index c8dae30d8..795186aef 100644 --- a/Engine/source/module/moduleDefinition.cpp +++ b/Engine/source/module/moduleDefinition.cpp @@ -82,8 +82,6 @@ void ModuleDefinition::initPersistFields() // Call parent. Parent::initPersistFields(); - addProtectedField("ModuleId", TypeString, Offset(mModuleId, ModuleDefinition), &defaultProtectedSetFn, &defaultProtectedGetFn, ""); - /// Module configuration. addProtectedField( "ModuleId", TypeString, Offset(mModuleId, ModuleDefinition), &setModuleId, &defaultProtectedGetFn, "A unique string Id for the module. It can contain any characters except a comma or semi-colon (the asset scope character)." ); addProtectedField( "VersionId", TypeS32, Offset(mVersionId, ModuleDefinition), &setVersionId, &defaultProtectedGetFn, "The version Id. Breaking changes to a module should use a higher version Id." ); diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 88bcde89e..d27a00876 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -1917,7 +1917,7 @@ static ConsoleDocFragment _ActionMapbindObj2( "ActionMap", "bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );"); -ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec, mod...], command, object)" +ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier, spec, mod...], command, object)" "@hide") { SimObject* simObject = Sim::findObject(argv[argc - 1]); From d0b0b4305800b640c5ae3cbc16f8c9439fc04f76 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Tue, 12 Dec 2017 14:00:27 +0000 Subject: [PATCH 068/312] Update libpng to 1.6.34 --- Engine/lib/lpng/ANNOUNCE | 77 +-- Engine/lib/lpng/CHANGES | 51 +- Engine/lib/lpng/CMakeLists.txt | 12 +- Engine/lib/lpng/LICENSE | 4 +- Engine/lib/lpng/README | 2 +- Engine/lib/lpng/example.c | 1066 +++++++++++++++++++++++++++++ Engine/lib/lpng/libpng-manual.txt | 21 +- Engine/lib/lpng/libpng.3 | 37 +- Engine/lib/lpng/libpngpf.3 | 2 +- Engine/lib/lpng/png.c | 34 +- Engine/lib/lpng/png.h | 28 +- Engine/lib/lpng/pngbar.jpg | Bin 0 -> 2498 bytes Engine/lib/lpng/pngbar.png | Bin 0 -> 2399 bytes Engine/lib/lpng/pngnow.png | Bin 0 -> 2069 bytes Engine/lib/lpng/pngread.c | 14 +- Engine/lib/lpng/pngrtran.c | 22 +- Engine/lib/lpng/pngrutil.c | 47 +- Engine/lib/lpng/pngtest.c | 2 +- Engine/lib/lpng/pngtest.png | Bin 0 -> 8759 bytes Engine/lib/lpng/pngtrans.c | 6 +- Engine/lib/lpng/pngwrite.c | 2 +- 21 files changed, 1255 insertions(+), 172 deletions(-) create mode 100644 Engine/lib/lpng/example.c create mode 100644 Engine/lib/lpng/pngbar.jpg create mode 100644 Engine/lib/lpng/pngbar.png create mode 100644 Engine/lib/lpng/pngnow.png create mode 100644 Engine/lib/lpng/pngtest.png diff --git a/Engine/lib/lpng/ANNOUNCE b/Engine/lib/lpng/ANNOUNCE index 3cbe5a926..0f66c0d1d 100644 --- a/Engine/lib/lpng/ANNOUNCE +++ b/Engine/lib/lpng/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.32 - August 24, 2017 +Libpng 1.6.34 - September 29, 2017 This is a public release of libpng, intended for use in production codes. @@ -7,79 +7,24 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.6.32.tar.xz (LZMA-compressed, recommended) - libpng-1.6.32.tar.gz + libpng-1.6.34.tar.xz (LZMA-compressed, recommended) + libpng-1.6.34.tar.gz Source files with CRLF line endings (for Windows), without the "configure" script - lpng1632.7z (LZMA-compressed, recommended) - lpng1632.zip + lpng1634.7z (LZMA-compressed, recommended) + lpng1634.zip Other information: - libpng-1.6.32-README.txt - libpng-1.6.32-LICENSE.txt - libpng-1.6.32-*.asc (armored detached GPG signatures) + libpng-1.6.34-README.txt + libpng-1.6.34-LICENSE.txt + libpng-1.6.34-*.asc (armored detached GPG signatures) -Changes since the last public release (1.6.31): - Avoid possible NULL dereference in png_handle_eXIf when benign_errors - are allowed. Avoid leaking the input buffer "eXIf_buf". - Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif - to arguments for png_get_eXIf() and png_set_eXIf(). - Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in - pngwrite.c, and made various other fixes to png_write_eXIf(). - Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and - png_set_eXIf_1(), respectively, to avoid breaking API compatibility - with libpng-1.6.31. - Updated contrib/libtests/pngunknown.c with eXIf chunk. - Initialized btoa[] in pngstest.c - Stop memory leak when returning from png_handle_eXIf() with an error - (Bug report from the OSS-fuzz project). - Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf(). - Update libpng.3 and libpng-manual.txt about eXIf functions. - Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability. - Removed png_get_eXIf_1() and png_set_eXIf_1(). - Check length of all chunks except IDAT against user limit to fix an - OSS-fuzz issue. - Check length of IDAT against maximum possible IDAT size, accounting - for height, rowbytes, interlacing and zlib/deflate overhead. - Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf) - does not work (the eXIf chunk data can contain zeroes). - Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation, - no longer using deprecated cmake LOCATION feature (Clifford Yapp). - Fixed five-byte error in the calculation of IDAT maximum possible size. - Moved chunk-length check into a png_check_chunk_length() private - function (Suggested by Max Stepin). - Moved bad pngs from tests to contrib/libtests/crashers - Moved testing of bad pngs into a separate tests/pngtest-badpngs script - Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL - in the output but PASS for the libpng test. - Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp). - Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the - num_exif argument to png_get_eXIf_1() (Github Issue 171). - Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks(). - Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers. - Make pngtest --strict, --relax, --xfail options imply -m (multiple). - Removed unused chunk_name parameter from png_check_chunk_length(). - Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak. - Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue. - Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR. - Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue. - Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account - for the minimum 'deflate' stream, and relocate the test to a point - after the keyword has been read. - Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM". - Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers, - one for each known chunk type, with length = 2GB-1. - Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts - in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706, - and 162707). - Renamed chunks in contrib/testpngs/crashers to avoid having files whose - names differ only in case; this causes problems with some platforms - (github issue #172). - Added contrib/oss-fuzz directory which contains files used by the oss-fuzz - project (https://github.com/google/oss-fuzz/tree/master/projects/libpng). +Changes since the last public release (1.6.33): + Removed contrib/pngsuite/i*.png; some of these were incorrect and caused + test failures. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/Engine/lib/lpng/CHANGES b/Engine/lib/lpng/CHANGES index 14e60dd26..4b8211891 100644 --- a/Engine/lib/lpng/CHANGES +++ b/Engine/lib/lpng/CHANGES @@ -833,7 +833,7 @@ Version 1.0.7beta11 [May 7, 2000] Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes which are no longer used. Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is - defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED + defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXt_SUPPORTED is defined. Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory overrun when old applications fill the info_ptr->text structure directly. @@ -5939,7 +5939,7 @@ Version 1.6.32beta06 [August 2, 2017] Version 1.6.32beta07 [August 3, 2017] Check length of all chunks except IDAT against user limit to fix an - OSS-fuzz issue. + OSS-fuzz issue (Fixes CVE-2017-12652). Version 1.6.32beta08 [August 3, 2017] Check length of IDAT against maximum possible IDAT size, accounting @@ -5994,6 +5994,53 @@ Version 1.6.32rc02 [August 22, 2017] Version 1.6.32 [August 24, 2017] No changes. +Version 1.6.33beta01 [August 28, 2017] + Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing + parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse). + Fixed off-by-one error in png_do_check_palette_indexes() (Bug report + by Mick P., Source Forge Issue #269). + +Version 1.6.33beta02 [September 3, 2017] + Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc + to fix shortlived oss-fuzz issue 3234. + Compute a larger limit on IDAT because some applications write a deflate + buffer for each row (Bug report by Andrew Church). + Use current date (DATE) instead of release-date (RDATE) in last + changed date of contrib/oss-fuzz files. + Enabled ARM support in CMakeLists.txt (Bernd Kuhls). + +Version 1.6.33beta03 [September 14, 2017] + Fixed incorrect typecast of some arguments to png_malloc() and + png_calloc() that were png_uint_32 instead of png_alloc_size_t + (Bug report by "irwir" in Github libpng issue #175). + Use pnglibconf.h.prebuilt when building for ANDROID with cmake (Github + issue 162, by rcdailey). + +Version 1.6.33rc01 [September 20, 2017] + Initialize memory allocated by png_inflate to zero, using memset, to + stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2() + due to truncated iTXt or zTXt chunk. + Initialize memory allocated by png_read_buffer to zero, using memset, to + stop an oss-fuzz "use of uninitialized value" detection in + png_icc_check_tag_table() due to truncated iCCP chunk. + Removed a redundant test (suggested by "irwir" in Github issue #180). + +Version 1.6.33rc02 [September 23, 2017] + Added an interlaced version of each file in contrib/pngsuite. + Relocate new memset() call in pngrutil.c. + Removed more redundant tests (suggested by "irwir" in Github issue #180). + Add support for loading images with associated alpha in the Simplified + API (Samuel Williams). + +Version 1.6.33 [September 28, 2017] + Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 state. + Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc + Add end_info structure and png_read_end() to the libpng fuzzer. + +Version 1.6.34 [September 29, 2017] + Removed contrib/pngsuite/i*.png; some of these were incorrect and caused + test failures. + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement diff --git a/Engine/lib/lpng/CMakeLists.txt b/Engine/lib/lpng/CMakeLists.txt index 7a51f0064..48c6fa287 100644 --- a/Engine/lib/lpng/CMakeLists.txt +++ b/Engine/lib/lpng/CMakeLists.txt @@ -31,12 +31,12 @@ endif(POLICY CMP0054) set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo") -project(libpng C) +project(libpng ASM C) enable_testing() set(PNGLIB_MAJOR 1) set(PNGLIB_MINOR 6) -set(PNGLIB_RELEASE 32) +set(PNGLIB_RELEASE 34) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) @@ -262,7 +262,7 @@ find_program(AWK NAMES gawk awk) include_directories(${CMAKE_CURRENT_BINARY_DIR}) -if(NOT AWK) +if(NOT AWK OR ANDROID) # No awk available to generate sources; use pre-built pnglibconf.h configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h) @@ -441,7 +441,7 @@ else() "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk" "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out" "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out") -endif(NOT AWK) +endif(NOT AWK OR ANDROID) # OUR SOURCES set(libpng_public_hdrs @@ -455,7 +455,7 @@ set(libpng_private_hdrs pnginfo.h pngstruct.h ) -if(AWK) +if(AWK AND NOT ANDROID) list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h") endif() set(libpng_sources @@ -844,7 +844,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW) # SET UP LINKS if(PNG_SHARED) set_target_properties(png PROPERTIES -# VERSION 16.${PNGLIB_RELEASE}.1.6.32 +# VERSION 16.${PNGLIB_RELEASE}.1.6.34 VERSION 16.${PNGLIB_RELEASE}.0 SOVERSION 16 CLEAN_DIRECT_OUTPUT 1) diff --git a/Engine/lib/lpng/LICENSE b/Engine/lib/lpng/LICENSE index e803911d3..4cda4fa0a 100644 --- a/Engine/lib/lpng/LICENSE +++ b/Engine/lib/lpng/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are +libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals @@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and Glenn Randers-Pehrson glennrp at users.sourceforge.net -April 1, 2017 +September 29, 2017 diff --git a/Engine/lib/lpng/README b/Engine/lib/lpng/README index 71292715e..0da5a5ef8 100644 --- a/Engine/lib/lpng/README +++ b/Engine/lib/lpng/README @@ -1,4 +1,4 @@ -README for libpng version 1.6.32 - August 24, 2017 (shared library 16.0) +README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. diff --git a/Engine/lib/lpng/example.c b/Engine/lib/lpng/example.c new file mode 100644 index 000000000..99d2f054a --- /dev/null +++ b/Engine/lib/lpng/example.c @@ -0,0 +1,1066 @@ + +#if 0 /* in case someone actually tries to compile this */ + +/* example.c - an example of using libpng + * Last changed in libpng 1.6.24 [August 4, 2016] + * Maintained 1998-2016 Glenn Randers-Pehrson + * Maintained 1996, 1997 Andreas Dilger) + * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) + * To the extent possible under law, the authors have waived + * all copyright and related or neighboring rights to this file. + * This work is published from: United States. + */ + +/* This is an example of how to use libpng to read and write PNG files. + * The file libpng-manual.txt is much more verbose then this. If you have not + * read it, do so first. This was designed to be a starting point of an + * implementation. This is not officially part of libpng, is hereby placed + * in the public domain, and therefore does not require a copyright notice. + * + * This file does not currently compile, because it is missing certain + * parts, like allocating memory to hold an image. You will have to + * supply these parts to get it to compile. For an example of a minimal + * working PNG reader/writer, see pngtest.c, included in this distribution; + * see also the programs in the contrib directory. + */ + +/* The simple, but restricted, approach to reading a PNG file or data stream + * just requires two function calls, as in the following complete program. + * Writing a file just needs one function call, so long as the data has an + * appropriate layout. + * + * The following code reads PNG image data from a file and writes it, in a + * potentially new format, to a new file. While this code will compile there is + * minimal (insufficient) error checking; for a more realistic version look at + * contrib/examples/pngtopng.c + */ +#include +#include +#include +#include +#include +#include + +int main(int argc, const char **argv) +{ + if (argc == 3) + { + png_image image; /* The control structure used by libpng */ + + /* Initialize the 'png_image' structure. */ + memset(&image, 0, (sizeof image)); + image.version = PNG_IMAGE_VERSION; + + /* The first argument is the file to read: */ + if (png_image_begin_read_from_file(&image, argv[1]) != 0) + { + png_bytep buffer; + + /* Set the format in which to read the PNG file; this code chooses a + * simple sRGB format with a non-associated alpha channel, adequate to + * store most images. + */ + image.format = PNG_FORMAT_RGBA; + + /* Now allocate enough memory to hold the image in this format; the + * PNG_IMAGE_SIZE macro uses the information about the image (width, + * height and format) stored in 'image'. + */ + buffer = malloc(PNG_IMAGE_SIZE(image)); + + /* If enough memory was available read the image in the desired format + * then write the result out to the new file. 'background' is not + * necessary when reading the image because the alpha channel is + * preserved; if it were to be removed, for example if we requested + * PNG_FORMAT_RGB, then either a solid background color would have to + * be supplied or the output buffer would have to be initialized to the + * actual background of the image. + * + * The fourth argument to png_image_finish_read is the 'row_stride' - + * this is the number of components allocated for the image in each + * row. It has to be at least as big as the value returned by + * PNG_IMAGE_ROW_STRIDE, but if you just allocate space for the + * default, minimum, size using PNG_IMAGE_SIZE as above you can pass + * zero. + * + * The final argument is a pointer to a buffer for the colormap; + * colormaps have exactly the same format as a row of image pixels (so + * you choose what format to make the colormap by setting + * image.format). A colormap is only returned if + * PNG_FORMAT_FLAG_COLORMAP is also set in image.format, so in this + * case NULL is passed as the final argument. If you do want to force + * all images into an index/color-mapped format then you can use: + * + * PNG_IMAGE_COLORMAP_SIZE(image) + * + * to find the maximum size of the colormap in bytes. + */ + if (buffer != NULL && + png_image_finish_read(&image, NULL/*background*/, buffer, + 0/*row_stride*/, NULL/*colormap*/) != 0) + { + /* Now write the image out to the second argument. In the write + * call 'convert_to_8bit' allows 16-bit data to be squashed down to + * 8 bits; this isn't necessary here because the original read was + * to the 8-bit format. + */ + if (png_image_write_to_file(&image, argv[2], 0/*convert_to_8bit*/, + buffer, 0/*row_stride*/, NULL/*colormap*/) != 0) + { + /* The image has been written successfully. */ + exit(0); + } + } + + else + { + /* Calling png_image_free is optional unless the simplified API was + * not run to completion. In this case if there wasn't enough + * memory for 'buffer' we didn't complete the read, so we must free + * the image: + */ + if (buffer == NULL) + png_image_free(&image); + + else + free(buffer); + } + + /* Something went wrong reading or writing the image. libpng stores a + * textual message in the 'png_image' structure: + */ + fprintf(stderr, "pngtopng: error: %s\n", image.message); + exit (1); + } + + fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n"); + exit(1); +} + +/* That's it ;-) Of course you probably want to do more with PNG files than + * just converting them all to 32-bit RGBA PNG files; you can do that between + * the call to png_image_finish_read and png_image_write_to_file. You can also + * ask for the image data to be presented in a number of different formats. You + * do this by simply changing the 'format' parameter set before allocating the + * buffer. + * + * The format parameter consists of five flags that define various aspects of + * the image, you can simply add these together to get the format or you can use + * one of the predefined macros from png.h (as above): + * + * PNG_FORMAT_FLAG_COLOR: if set the image will have three color components per + * pixel (red, green and blue), if not set the image will just have one + * luminance (grayscale) component. + * + * PNG_FORMAT_FLAG_ALPHA: if set each pixel in the image will have an additional + * alpha value; a linear value that describes the degree the image pixel + * covers (overwrites) the contents of the existing pixel on the display. + * + * PNG_FORMAT_FLAG_LINEAR: if set the components of each pixel will be returned + * as a series of 16-bit linear values, if not set the components will be + * returned as a series of 8-bit values encoded according to the 'sRGB' + * standard. The 8-bit format is the normal format for images intended for + * direct display, because almost all display devices do the inverse of the + * sRGB transformation to the data they receive. The 16-bit format is more + * common for scientific data and image data that must be further processed; + * because it is linear simple math can be done on the component values. + * Regardless of the setting of this flag the alpha channel is always linear, + * although it will be 8 bits or 16 bits wide as specified by the flag. + * + * PNG_FORMAT_FLAG_BGR: if set the components of a color pixel will be returned + * in the order blue, then green, then red. If not set the pixel components + * are in the order red, then green, then blue. + * + * PNG_FORMAT_FLAG_AFIRST: if set the alpha channel (if present) precedes the + * color or grayscale components. If not set the alpha channel follows the + * components. + * + * You do not have to read directly from a file. You can read from memory or, + * on systems that support it, from a FILE*. This is controlled by + * the particular png_image_read_from_ function you call at the start. Likewise + * on write you can write to a FILE* if your system supports it. Check the + * macro PNG_STDIO_SUPPORTED to see if stdio support has been included in your + * libpng build. + * + * If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data you may need to write it in + * the 8-bit format for display. You do this by setting the convert_to_8bit + * flag to 'true'. + * + * Don't repeatedly convert between the 8-bit and 16-bit forms. There is + * significant data loss when 16-bit data is converted to the 8-bit encoding and + * the current libpng implementation of conversion to 16-bit is also + * significantly lossy. The latter will be fixed in the future, but the former + * is unavoidable - the 8-bit format just doesn't have enough resolution. + */ + +/* If your program needs more information from the PNG data it reads, or if you + * need to do more complex transformations, or minimize transformations, on the + * data you read, then you must use one of the several lower level libpng + * interfaces. + * + * All these interfaces require that you do your own error handling - your + * program must be able to arrange for control to return to your own code any + * time libpng encounters a problem. There are several ways to do this, but the + * standard way is to use the ANSI-C (C90) interface to establish a + * return point within your own code. You must do this if you do not use the + * simplified interface (above). + * + * The first step is to include the header files you need, including the libpng + * header file. Include any standard headers and feature test macros your + * program requires before including png.h: + */ +#include + + /* The png_jmpbuf() macro, used in error handling, became available in + * libpng version 1.0.6. If you want to be able to run your code with older + * versions of libpng, you must define the macro yourself (but only if it + * is not already defined by libpng!). + */ + +#ifndef png_jmpbuf +# define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf) +#endif + +/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp() + * returns zero if the image is a PNG and nonzero if it isn't a PNG. + * + * The function check_if_png() shown here, but not used, returns nonzero (true) + * if the file can be opened and is a PNG, 0 (false) otherwise. + * + * If this call is successful, and you are going to keep the file open, + * you should call png_set_sig_bytes(png_ptr, PNG_BYTES_TO_CHECK); once + * you have created the png_ptr, so that libpng knows your application + * has read that many bytes from the start of the file. Make sure you + * don't call png_set_sig_bytes() with more than 8 bytes read or give it + * an incorrect number of bytes read, or you will either have read too + * many bytes (your fault), or you are telling libpng to read the wrong + * number of magic bytes (also your fault). + * + * Many applications already read the first 2 or 4 bytes from the start + * of the image to determine the file type, so it would be easiest just + * to pass the bytes to png_sig_cmp() or even skip that if you know + * you have a PNG file, and call png_set_sig_bytes(). + */ +#define PNG_BYTES_TO_CHECK 4 +int check_if_png(char *file_name, FILE **fp) +{ + char buf[PNG_BYTES_TO_CHECK]; + + /* Open the prospective PNG file. */ + if ((*fp = fopen(file_name, "rb")) == NULL) + return 0; + + /* Read in some of the signature bytes */ + if (fread(buf, 1, PNG_BYTES_TO_CHECK, *fp) != PNG_BYTES_TO_CHECK) + return 0; + + /* Compare the first PNG_BYTES_TO_CHECK bytes of the signature. + Return nonzero (true) if they match */ + + return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK)); +} + +/* Read a PNG file. You may want to return an error code if the read + * fails (depending upon the failure). There are two "prototypes" given + * here - one where we are given the filename, and we need to open the + * file, and the other where we are given an open file (possibly with + * some or all of the magic bytes read - see comments above). + */ +#ifdef open_file /* prototype 1 */ +void read_png(char *file_name) /* We need to open the file */ +{ + png_structp png_ptr; + png_infop info_ptr; + int sig_read = 0; + png_uint_32 width, height; + int bit_depth, color_type, interlace_type; + FILE *fp; + + if ((fp = fopen(file_name, "rb")) == NULL) + return (ERROR); + +#else no_open_file /* prototype 2 */ +void read_png(FILE *fp, int sig_read) /* File is already open */ +{ + png_structp png_ptr; + png_infop info_ptr; + png_uint_32 width, height; + int bit_depth, color_type, interlace_type; +#endif no_open_file /* Only use one prototype! */ + + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also supply the + * the compiler header file version, so that we know if the application + * was compiled with a compatible version of the library. REQUIRED + */ + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (png_ptr == NULL) + { + fclose(fp); + return (ERROR); + } + + /* Allocate/initialize the memory for image information. REQUIRED. */ + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) + { + fclose(fp); + png_destroy_read_struct(&png_ptr, NULL, NULL); + return (ERROR); + } + + /* Set error handling if you are using the setjmp/longjmp method (this is + * the normal method of doing things with libpng). REQUIRED unless you + * set up your own error handlers in the png_create_read_struct() earlier. + */ + + if (setjmp(png_jmpbuf(png_ptr))) + { + /* Free all of the memory associated with the png_ptr and info_ptr */ + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + fclose(fp); + /* If we get here, we had a problem reading the file */ + return (ERROR); + } + + /* One of the following I/O initialization methods is REQUIRED */ +#ifdef streams /* PNG file I/O method 1 */ + /* Set up the input control if you are using standard C streams */ + png_init_io(png_ptr, fp); + +#else no_streams /* PNG file I/O method 2 */ + /* If you are using replacement read functions, instead of calling + * png_init_io() here you would call: + */ + png_set_read_fn(png_ptr, (void *)user_io_ptr, user_read_fn); + /* where user_io_ptr is a structure you want available to the callbacks */ +#endif no_streams /* Use only one I/O method! */ + + /* If we have already read some of the signature */ + png_set_sig_bytes(png_ptr, sig_read); + +#ifdef hilevel + /* + * If you have enough memory to read in the entire image at once, + * and you need to specify only transforms that can be controlled + * with one of the PNG_TRANSFORM_* bits (this presently excludes + * quantizing, filling, setting background, and doing gamma + * adjustment), then you can read the entire image (including + * pixels) into the info structure with this call: + */ + png_read_png(png_ptr, info_ptr, png_transforms, NULL); + +#else + /* OK, you're doing it the hard way, with the lower-level functions */ + + /* The call to png_read_info() gives us all of the information from the + * PNG file before the first IDAT (image data chunk). REQUIRED + */ + png_read_info(png_ptr, info_ptr); + + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, + &interlace_type, NULL, NULL); + + /* Set up the data transformations you want. Note that these are all + * optional. Only call them if you want/need them. Many of the + * transformations only work on specific types of images, and many + * are mutually exclusive. + */ + + /* Tell libpng to strip 16 bits/color files down to 8 bits/color. + * Use accurate scaling if it's available, otherwise just chop off the + * low byte. + */ +#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED + png_set_scale_16(png_ptr); +#else + png_set_strip_16(png_ptr); +#endif + + /* Strip alpha bytes from the input data without combining with the + * background (not recommended). + */ + png_set_strip_alpha(png_ptr); + + /* Extract multiple pixels with bit depths of 1, 2, and 4 from a single + * byte into separate bytes (useful for paletted and grayscale images). + */ + png_set_packing(png_ptr); + + /* Change the order of packed pixels to least significant bit first + * (not useful if you are using png_set_packing). */ + png_set_packswap(png_ptr); + + /* Expand paletted colors into true RGB triplets */ + if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(png_ptr); + + /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ + if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) + png_set_expand_gray_1_2_4_to_8(png_ptr); + + /* Expand paletted or RGB images with transparency to full alpha channels + * so the data will be available as RGBA quartets. + */ + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) != 0) + png_set_tRNS_to_alpha(png_ptr); + + /* Set the background color to draw transparent and alpha images over. + * It is possible to set the red, green, and blue components directly + * for paletted images instead of supplying a palette index. Note that + * even if the PNG file supplies a background, you are not required to + * use it - you should use the (solid) application background if it has one. + */ + + png_color_16 my_background, *image_background; + + if (png_get_bKGD(png_ptr, info_ptr, &image_background) != 0) + png_set_background(png_ptr, image_background, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + else + png_set_background(png_ptr, &my_background, + PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); + + /* Some suggestions as to how to get a screen gamma value + * + * Note that screen gamma is the display_exponent, which includes + * the CRT_exponent and any correction for viewing conditions + */ + if (/* We have a user-defined screen gamma value */) + { + screen_gamma = user-defined screen_gamma; + } + /* This is one way that applications share the same screen gamma value */ + else if ((gamma_str = getenv("SCREEN_GAMMA")) != NULL) + { + screen_gamma = atof(gamma_str); + } + /* If we don't have another value */ + else + { + screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor + in a dimly lit room */ + screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */ + } + + /* Tell libpng to handle the gamma conversion for you. The final call + * is a good guess for PC generated images, but it should be configurable + * by the user at run time by the user. It is strongly suggested that + * your application support gamma correction. + */ + + int intent; + + if (png_get_sRGB(png_ptr, info_ptr, &intent) != 0) + png_set_gamma(png_ptr, screen_gamma, PNG_DEFAULT_sRGB); + else + { + double image_gamma; + if (png_get_gAMA(png_ptr, info_ptr, &image_gamma) != 0) + png_set_gamma(png_ptr, screen_gamma, image_gamma); + else + png_set_gamma(png_ptr, screen_gamma, 0.45455); + } + +#ifdef PNG_READ_QUANTIZE_SUPPORTED + /* Quantize RGB files down to 8-bit palette or reduce palettes + * to the number of colors available on your screen. + */ + if ((color_type & PNG_COLOR_MASK_COLOR) != 0) + { + int num_palette; + png_colorp palette; + + /* This reduces the image to the application supplied palette */ + if (/* We have our own palette */) + { + /* An array of colors to which the image should be quantized */ + png_color std_color_cube[MAX_SCREEN_COLORS]; + + png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS, + MAX_SCREEN_COLORS, NULL, 0); + } + /* This reduces the image to the palette supplied in the file */ + else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) != 0) + { + png_uint_16p histogram = NULL; + + png_get_hIST(png_ptr, info_ptr, &histogram); + + png_set_quantize(png_ptr, palette, num_palette, + max_screen_colors, histogram, 0); + } + } +#endif /* READ_QUANTIZE */ + + /* Invert monochrome files to have 0 as white and 1 as black */ + png_set_invert_mono(png_ptr); + + /* If you want to shift the pixel values from the range [0,255] or + * [0,65535] to the original [0,7] or [0,31], or whatever range the + * colors were originally in: + */ + if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT) != 0) + { + png_color_8p sig_bit_p; + + png_get_sBIT(png_ptr, info_ptr, &sig_bit_p); + png_set_shift(png_ptr, sig_bit_p); + } + + /* Flip the RGB pixels to BGR (or RGBA to BGRA) */ + if ((color_type & PNG_COLOR_MASK_COLOR) != 0) + png_set_bgr(png_ptr); + + /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ + png_set_swap_alpha(png_ptr); + + /* Swap bytes of 16-bit files to least significant byte first */ + png_set_swap(png_ptr); + + /* Add filler (or alpha) byte (before/after each RGB triplet) */ + png_set_filler(png_ptr, 0xffff, PNG_FILLER_AFTER); + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* Turn on interlace handling. REQUIRED if you are not using + * png_read_image(). To see how to handle interlacing passes, + * see the png_read_row() method below: + */ + number_passes = png_set_interlace_handling(png_ptr); +#else /* !READ_INTERLACING */ + number_passes = 1; +#endif /* READ_INTERLACING */ + + + /* Optional call to gamma correct and add the background to the palette + * and update info structure. REQUIRED if you are expecting libpng to + * update the palette for you (ie you selected such a transform above). + */ + png_read_update_info(png_ptr, info_ptr); + + /* Allocate the memory to hold the image using the fields of info_ptr. */ + + /* The easiest way to read the image: */ + png_bytep row_pointers[height]; + + /* Clear the pointer array */ + for (row = 0; row < height; row++) + row_pointers[row] = NULL; + + for (row = 0; row < height; row++) + row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, + info_ptr)); + + /* Now it's time to read the image. One of these methods is REQUIRED */ +#ifdef entire /* Read the entire image in one go */ + png_read_image(png_ptr, row_pointers); + +#else no_entire /* Read the image one or more scanlines at a time */ + /* The other way to read images - deal with interlacing: */ + + for (pass = 0; pass < number_passes; pass++) + { +#ifdef single /* Read the image a single row at a time */ + for (y = 0; y < height; y++) + { + png_read_rows(png_ptr, &row_pointers[y], NULL, 1); + } + +#else no_single /* Read the image several rows at a time */ + for (y = 0; y < height; y += number_of_rows) + { +#ifdef sparkle /* Read the image using the "sparkle" effect. */ + png_read_rows(png_ptr, &row_pointers[y], NULL, + number_of_rows); +#else no_sparkle /* Read the image using the "rectangle" effect */ + png_read_rows(png_ptr, NULL, &row_pointers[y], + number_of_rows); +#endif no_sparkle /* Use only one of these two methods */ + } + + /* If you want to display the image after every pass, do so here */ +#endif no_single /* Use only one of these two methods */ + } +#endif no_entire /* Use only one of these two methods */ + + /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ + png_read_end(png_ptr, info_ptr); +#endif hilevel + + /* At this point you have read the entire image */ + + /* Clean up after the read, and free any memory allocated - REQUIRED */ + png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + + /* Close the file */ + fclose(fp); + + /* That's it */ + return (OK); +} + +/* Progressively read a file */ + +int +initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) +{ + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also check that + * the library version is compatible in case we are using dynamically + * linked libraries. + */ + *png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (*png_ptr == NULL) + { + *info_ptr = NULL; + return (ERROR); + } + + *info_ptr = png_create_info_struct(png_ptr); + + if (*info_ptr == NULL) + { + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + if (setjmp(png_jmpbuf((*png_ptr)))) + { + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + /* This one's new. You will need to provide all three + * function callbacks, even if you aren't using them all. + * If you aren't using all functions, you can specify NULL + * parameters. Even when all three functions are NULL, + * you need to call png_set_progressive_read_fn(). + * These functions shouldn't be dependent on global or + * static variables if you are decoding several images + * simultaneously. You should store stream specific data + * in a separate struct, given as the second parameter, + * and retrieve the pointer from inside the callbacks using + * the function png_get_progressive_ptr(png_ptr). + */ + png_set_progressive_read_fn(*png_ptr, (void *)stream_data, + info_callback, row_callback, end_callback); + + return (OK); +} + +int +process_data(png_structp *png_ptr, png_infop *info_ptr, + png_bytep buffer, png_uint_32 length) +{ + if (setjmp(png_jmpbuf((*png_ptr)))) + { + /* Free the png_ptr and info_ptr memory on error */ + png_destroy_read_struct(png_ptr, info_ptr, NULL); + return (ERROR); + } + + /* This one's new also. Simply give it chunks of data as + * they arrive from the data stream (in order, of course). + * On segmented machines, don't give it any more than 64K. + * The library seems to run fine with sizes of 4K, although + * you can give it much less if necessary (I assume you can + * give it chunks of 1 byte, but I haven't tried with less + * than 256 bytes yet). When this function returns, you may + * want to display any rows that were generated in the row + * callback, if you aren't already displaying them there. + */ + png_process_data(*png_ptr, *info_ptr, buffer, length); + return (OK); +} + +info_callback(png_structp png_ptr, png_infop info) +{ + /* Do any setup here, including setting any of the transformations + * mentioned in the Reading PNG files section. For now, you _must_ + * call either png_start_read_image() or png_read_update_info() + * after all the transformations are set (even if you don't set + * any). You may start getting rows before png_process_data() + * returns, so this is your last chance to prepare for that. + */ +} + +row_callback(png_structp png_ptr, png_bytep new_row, + png_uint_32 row_num, int pass) +{ + /* + * This function is called for every row in the image. If the + * image is interlaced, and you turned on the interlace handler, + * this function will be called for every row in every pass. + * + * In this function you will receive a pointer to new row data from + * libpng called new_row that is to replace a corresponding row (of + * the same data format) in a buffer allocated by your application. + * + * The new row data pointer "new_row" may be NULL, indicating there is + * no new data to be replaced (in cases of interlace loading). + * + * If new_row is not NULL then you need to call + * png_progressive_combine_row() to replace the corresponding row as + * shown below: + */ + + /* Get pointer to corresponding row in our + * PNG read buffer. + */ + png_bytep old_row = ((png_bytep *)our_data)[row_num]; + +#ifdef PNG_READ_INTERLACING_SUPPORTED + /* If both rows are allocated then copy the new row + * data to the corresponding row data. + */ + if ((old_row != NULL) && (new_row != NULL)) + png_progressive_combine_row(png_ptr, old_row, new_row); + + /* + * The rows and passes are called in order, so you don't really + * need the row_num and pass, but I'm supplying them because it + * may make your life easier. + * + * For the non-NULL rows of interlaced images, you must call + * png_progressive_combine_row() passing in the new row and the + * old row, as demonstrated above. You can call this function for + * NULL rows (it will just return) and for non-interlaced images + * (it just does the memcpy for you) if it will make the code + * easier. Thus, you can just do this for all cases: + */ + + png_progressive_combine_row(png_ptr, old_row, new_row); + + /* where old_row is what was displayed for previous rows. Note + * that the first pass (pass == 0 really) will completely cover + * the old row, so the rows do not have to be initialized. After + * the first pass (and only for interlaced images), you will have + * to pass the current row as new_row, and the function will combine + * the old row and the new row. + */ +#endif /* READ_INTERLACING */ +} + +end_callback(png_structp png_ptr, png_infop info) +{ + /* This function is called when the whole image has been read, + * including any chunks after the image (up to and including + * the IEND). You will usually have the same info chunk as you + * had in the header, although some data may have been added + * to the comments and time fields. + * + * Most people won't do much here, perhaps setting a flag that + * marks the image as finished. + */ +} + +/* Write a png file */ +void write_png(char *file_name /* , ... other image information ... */) +{ + FILE *fp; + png_structp png_ptr; + png_infop info_ptr; + png_colorp palette; + + /* Open the file */ + fp = fopen(file_name, "wb"); + if (fp == NULL) + return (ERROR); + + /* Create and initialize the png_struct with the desired error handler + * functions. If you want to use the default stderr and longjump method, + * you can supply NULL for the last three parameters. We also check that + * the library version is compatible with the one used at compile time, + * in case we are using dynamically linked libraries. REQUIRED. + */ + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + png_voidp user_error_ptr, user_error_fn, user_warning_fn); + + if (png_ptr == NULL) + { + fclose(fp); + return (ERROR); + } + + /* Allocate/initialize the image information data. REQUIRED */ + info_ptr = png_create_info_struct(png_ptr); + if (info_ptr == NULL) + { + fclose(fp); + png_destroy_write_struct(&png_ptr, NULL); + return (ERROR); + } + + /* Set error handling. REQUIRED if you aren't supplying your own + * error handling functions in the png_create_write_struct() call. + */ + if (setjmp(png_jmpbuf(png_ptr))) + { + /* If we get here, we had a problem writing the file */ + fclose(fp); + png_destroy_write_struct(&png_ptr, &info_ptr); + return (ERROR); + } + + /* One of the following I/O initialization functions is REQUIRED */ + +#ifdef streams /* I/O initialization method 1 */ + /* Set up the output control if you are using standard C streams */ + png_init_io(png_ptr, fp); + +#else no_streams /* I/O initialization method 2 */ + /* If you are using replacement write functions, instead of calling + * png_init_io() here you would call + */ + png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, + user_IO_flush_function); + /* where user_io_ptr is a structure you want available to the callbacks */ +#endif no_streams /* Only use one initialization method */ + +#ifdef hilevel + /* This is the easy way. Use it if you already have all the + * image info living in the structure. You could "|" many + * PNG_TRANSFORM flags into the png_transforms integer here. + */ + png_write_png(png_ptr, info_ptr, png_transforms, NULL); + +#else + /* This is the hard way */ + + /* Set the image information here. Width and height are up to 2^31, + * bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on + * the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, + * PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, + * or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or + * PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST + * currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED + */ + png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, + PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + /* Set the palette if there is one. REQUIRED for indexed-color images */ + palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH + * (sizeof (png_color))); + /* ... Set palette colors ... */ + png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); + /* You must not free palette here, because png_set_PLTE only makes a link to + * the palette that you malloced. Wait until you are about to destroy + * the png structure. + */ + + /* Optional significant bit (sBIT) chunk */ + png_color_8 sig_bit; + + /* If we are dealing with a grayscale image then */ + sig_bit.gray = true_bit_depth; + + /* Otherwise, if we are dealing with a color image then */ + sig_bit.red = true_red_bit_depth; + sig_bit.green = true_green_bit_depth; + sig_bit.blue = true_blue_bit_depth; + + /* If the image has an alpha channel then */ + sig_bit.alpha = true_alpha_bit_depth; + + png_set_sBIT(png_ptr, info_ptr, &sig_bit); + + + /* Optional gamma chunk is strongly suggested if you have any guess + * as to the correct gamma of the image. + */ + png_set_gAMA(png_ptr, info_ptr, gamma); + + /* Optionally write comments into the image */ + { + png_text text_ptr[3]; + + char key0[]="Title"; + char text0[]="Mona Lisa"; + text_ptr[0].key = key0; + text_ptr[0].text = text0; + text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[0].itxt_length = 0; + text_ptr[0].lang = NULL; + text_ptr[0].lang_key = NULL; + + char key1[]="Author"; + char text1[]="Leonardo DaVinci"; + text_ptr[1].key = key1; + text_ptr[1].text = text1; + text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE; + text_ptr[1].itxt_length = 0; + text_ptr[1].lang = NULL; + text_ptr[1].lang_key = NULL; + + char key2[]="Description"; + char text2[]=""; + text_ptr[2].key = key2; + text_ptr[2].text = text2; + text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt; + text_ptr[2].itxt_length = 0; + text_ptr[2].lang = NULL; + text_ptr[2].lang_key = NULL; + + png_set_text(write_ptr, write_info_ptr, text_ptr, 3); + } + + /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */ + + /* Note that if sRGB is present the gAMA and cHRM chunks must be ignored + * on read and, if your application chooses to write them, they must + * be written in accordance with the sRGB profile + */ + + /* Write the file header information. REQUIRED */ + png_write_info(png_ptr, info_ptr); + + /* If you want, you can write the info in two steps, in case you need to + * write your private chunk ahead of PLTE: + * + * png_write_info_before_PLTE(write_ptr, write_info_ptr); + * write_my_chunk(); + * png_write_info(png_ptr, info_ptr); + * + * However, given the level of known- and unknown-chunk support in 1.2.0 + * and up, this should no longer be necessary. + */ + + /* Once we write out the header, the compression type on the text + * chunk gets changed to PNG_TEXT_COMPRESSION_NONE_WR or + * PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again + * at the end. + */ + + /* Set up the transformations you want. Note that these are + * all optional. Only call them if you want them. + */ + + /* Invert monochrome pixels */ + png_set_invert_mono(png_ptr); + + /* Shift the pixels up to a legal bit depth and fill in + * as appropriate to correctly scale the image. + */ + png_set_shift(png_ptr, &sig_bit); + + /* Pack pixels into bytes */ + png_set_packing(png_ptr); + + /* Swap location of alpha bytes from ARGB to RGBA */ + png_set_swap_alpha(png_ptr); + + /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into + * RGB (4 channels -> 3 channels). The second parameter is not used. + */ + png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); + + /* Flip BGR pixels to RGB */ + png_set_bgr(png_ptr); + + /* Swap bytes of 16-bit files to most significant byte first */ + png_set_swap(png_ptr); + + /* Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats */ + png_set_packswap(png_ptr); + + /* Turn on interlace handling if you are not using png_write_image() */ + if (interlacing != 0) + number_passes = png_set_interlace_handling(png_ptr); + + else + number_passes = 1; + + /* The easiest way to write the image (you may have a different memory + * layout, however, so choose what fits your needs best). You need to + * use the first method if you aren't handling interlacing yourself. + */ + png_uint_32 k, height, width; + + /* In this example, "image" is a one-dimensional array of bytes */ + + /* Guard against integer overflow */ + if (height > PNG_SIZE_MAX/(width*bytes_per_pixel)) { + png_error(png_ptr, "Image_data buffer would be too large"); + } + png_byte image[height*width*bytes_per_pixel]; + + png_bytep row_pointers[height]; + + if (height > PNG_UINT_32_MAX/(sizeof (png_bytep))) + png_error (png_ptr, "Image is too tall to process in memory"); + + /* Set up pointers into your "image" byte array */ + for (k = 0; k < height; k++) + row_pointers[k] = image + k*width*bytes_per_pixel; + + /* One of the following output methods is REQUIRED */ + +#ifdef entire /* Write out the entire image data in one call */ + png_write_image(png_ptr, row_pointers); + + /* The other way to write the image - deal with interlacing */ + +#else no_entire /* Write out the image data by one or more scanlines */ + + /* The number of passes is either 1 for non-interlaced images, + * or 7 for interlaced images. + */ + for (pass = 0; pass < number_passes; pass++) + { + /* Write a few rows at a time. */ + png_write_rows(png_ptr, &row_pointers[first_row], number_of_rows); + + /* If you are only writing one row at a time, this works */ + for (y = 0; y < height; y++) + png_write_rows(png_ptr, &row_pointers[y], 1); + } +#endif no_entire /* Use only one output method */ + + /* You can write optional chunks like tEXt, zTXt, and tIME at the end + * as well. Shouldn't be necessary in 1.2.0 and up as all the public + * chunks are supported and you can use png_set_unknown_chunks() to + * register unknown chunks into the info structure to be written out. + */ + + /* It is REQUIRED to call this to finish writing the rest of the file */ + png_write_end(png_ptr, info_ptr); +#endif hilevel + + /* If you png_malloced a palette, free it here (don't free info_ptr->palette, + * as recommended in versions 1.0.5m and earlier of this example; if + * libpng mallocs info_ptr->palette, libpng will free it). If you + * allocated it with malloc() instead of png_malloc(), use free() instead + * of png_free(). + */ + png_free(png_ptr, palette); + palette = NULL; + + /* Similarly, if you png_malloced any data that you passed in with + * png_set_something(), such as a hist or trans array, free it here, + * when you can be sure that libpng is through with it. + */ + png_free(png_ptr, trans); + trans = NULL; + /* Whenever you use png_free() it is a good idea to set the pointer to + * NULL in case your application inadvertently tries to png_free() it + * again. When png_free() sees a NULL it returns without action, thus + * avoiding the double-free security problem. + */ + + /* Clean up after the write, and free any memory allocated */ + png_destroy_write_struct(&png_ptr, &info_ptr); + + /* Close the file */ + fclose(fp); + + /* That's it */ + return (OK); +} + +#endif /* if 0 */ diff --git a/Engine/lib/lpng/libpng-manual.txt b/Engine/lib/lpng/libpng-manual.txt index e34b1436f..d4407ef2e 100644 --- a/Engine/lib/lpng/libpng-manual.txt +++ b/Engine/lib/lpng/libpng-manual.txt @@ -1,6 +1,6 @@ libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.32 - August 24, 2017 + libpng version 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017 + libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -986,8 +986,17 @@ premultiplication. png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); -This is the default libpng handling of the alpha channel - it is not -pre-multiplied into the color components. In addition the call states +Choices for the alpha_mode are + + PNG_ALPHA_PNG 0 /* according to the PNG standard */ + PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ + PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ + PNG_ALPHA_PREMULTIPLIED 1 /* as above */ + PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ + PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ + +PNG_ALPHA_PNG is the default libpng handling of the alpha channel. It is not +pre-multiplied into the color components. In addition the call states that the output is for a sRGB system and causes all PNG files without gAMA chunks to be assumed to be encoded using sRGB. @@ -1002,7 +1011,7 @@ early Mac systems behaved. This is the classic Jim Blinn approach and will work in academic environments where everything is done by the book. It has the shortcoming of assuming that input PNG data with no gamma information is linear - this -is unlikely to be correct unless the PNG files where generated locally. +is unlikely to be correct unless the PNG files were generated locally. Most of the time the output precision will be so low as to show significant banding in dark areas of the image. @@ -5405,7 +5414,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.32 are Y2K compliant. It is my belief that earlier +upward through 1.6.34 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer diff --git a/Engine/lib/lpng/libpng.3 b/Engine/lib/lpng/libpng.3 index 899d8eacc..3c8d62ab2 100644 --- a/Engine/lib/lpng/libpng.3 +++ b/Engine/lib/lpng/libpng.3 @@ -1,6 +1,6 @@ -.TH LIBPNG 3 "August 24, 2017" +.TH LIBPNG 3 "September 29, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34 .SH SYNOPSIS \fB #include \fP @@ -518,7 +518,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng. .SH LIBPNG.TXT libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.6.32 - August 24, 2017 + libpng version 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -529,7 +529,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017 + libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -1504,8 +1504,17 @@ premultiplication. png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); -This is the default libpng handling of the alpha channel - it is not -pre-multiplied into the color components. In addition the call states +Choices for the alpha_mode are + + PNG_ALPHA_PNG 0 /* according to the PNG standard */ + PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ + PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ + PNG_ALPHA_PREMULTIPLIED 1 /* as above */ + PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ + PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ + +PNG_ALPHA_PNG is the default libpng handling of the alpha channel. It is not +pre-multiplied into the color components. In addition the call states that the output is for a sRGB system and causes all PNG files without gAMA chunks to be assumed to be encoded using sRGB. @@ -1520,7 +1529,7 @@ early Mac systems behaved. This is the classic Jim Blinn approach and will work in academic environments where everything is done by the book. It has the shortcoming of assuming that input PNG data with no gamma information is linear - this -is unlikely to be correct unless the PNG files where generated locally. +is unlikely to be correct unless the PNG files were generated locally. Most of the time the output precision will be so low as to show significant banding in dark areas of the image. @@ -5923,7 +5932,7 @@ Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.6.32 are Y2K compliant. It is my belief that earlier +upward through 1.6.34 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer @@ -6021,11 +6030,11 @@ the first widely used release: ... 1.0.19 10 10019 10.so.0.19[.0] ... - 1.2.57 13 10257 12.so.0.56[.0] + 1.2.59 13 10259 12.so.0.59[.0] ... - 1.5.28 15 10528 15.so.15.28[.0] + 1.5.30 15 10530 15.so.15.30[.0] ... - 1.6.32 16 10632 16.so.16.32[.0] + 1.6.34 16 10634 16.so.16.34[.0] Henceforth the source version will match the shared-library minor and patch numbers; the shared-library major version number will be @@ -6081,7 +6090,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.6.32 - August 24, 2017: +Libpng version 1.6.34 - September 29, 2017: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6106,7 +6115,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are +libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals @@ -6234,7 +6243,7 @@ files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). Glenn Randers-Pehrson glennrp at users.sourceforge.net -August 24, 2017 +September 29, 2017 .\" end of man page diff --git a/Engine/lib/lpng/libpngpf.3 b/Engine/lib/lpng/libpngpf.3 index ab84577e4..8cea87a71 100644 --- a/Engine/lib/lpng/libpngpf.3 +++ b/Engine/lib/lpng/libpngpf.3 @@ -1,6 +1,6 @@ .TH LIBPNGPF 3 "April 1, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.32 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34 (private functions) .SH SYNOPSIS \fB\fB#include \fI\fI"pngpriv.h" diff --git a/Engine/lib/lpng/png.c b/Engine/lib/lpng/png.c index 2352df13c..ff02c5651 100644 --- a/Engine/lib/lpng/png.c +++ b/Engine/lib/lpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.32 [August 24, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32; +typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34; #ifdef __GNUC__ /* The version tests may need to be added to, but the problem warning has @@ -816,14 +816,14 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.32 - August 24, 2017" PNG_STRING_NEWLINE \ + "libpng version 1.6.34 - September 29, 2017" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.32 - August 24, 2017\ + return "libpng version 1.6.34 - September 29, 2017\ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -1913,12 +1913,12 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace, */ if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST) return png_icc_profile_error(png_ptr, colorspace, "sRGB", - (unsigned)intent, "invalid sRGB rendering intent"); + (png_alloc_size_t)intent, "invalid sRGB rendering intent"); if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 && colorspace->rendering_intent != intent) return png_icc_profile_error(png_ptr, colorspace, "sRGB", - (unsigned)intent, "inconsistent rendering intents"); + (png_alloc_size_t)intent, "inconsistent rendering intents"); if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0) { @@ -1979,7 +1979,6 @@ icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace, if (profile_length < 132) return png_icc_profile_error(png_ptr, colorspace, name, profile_length, "too short"); - return 1; } @@ -2224,15 +2223,6 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace, * being in range. All defined tag types have an 8 byte header - a 4 byte * type signature then 0. */ - if ((tag_start & 3) != 0) - { - /* CNHP730S.icc shipped with Microsoft Windows 64 violates this, it is - * only a warning here because libpng does not care about the - * alignment. - */ - (void)png_icc_profile_error(png_ptr, NULL, name, tag_id, - "ICC profile tag start not a multiple of 4"); - } /* This is a hard error; potentially it can cause read outside the * profile. @@ -2240,6 +2230,16 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace, if (tag_start > profile_length || tag_length > profile_length - tag_start) return png_icc_profile_error(png_ptr, colorspace, name, tag_id, "ICC profile tag outside profile"); + + if ((tag_start & 3) != 0) + { + /* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is + * only a warning here because libpng does not care about the + * alignment. + */ + (void)png_icc_profile_error(png_ptr, NULL, name, tag_id, + "ICC profile tag start not a multiple of 4"); + } } return 1; /* success, maybe with warnings */ @@ -3761,7 +3761,7 @@ png_log16bit(png_uint_32 x) * of getting this accuracy in practice. * * To deal with this the following exp() function works out the exponent of the - * frational part of the logarithm by using an accurate 32-bit value from the + * fractional part of the logarithm by using an accurate 32-bit value from the * top four fractional bits then multiplying in the remaining bits. */ static const png_uint_32 diff --git a/Engine/lib/lpng/png.h b/Engine/lib/lpng/png.h index 51ac8abe7..4c873f5c2 100644 --- a/Engine/lib/lpng/png.h +++ b/Engine/lib/lpng/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.32, August 24, 2017 + * libpng version 1.6.34, September 29, 2017 * * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017: + * libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,7 +25,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are + * libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -209,11 +209,11 @@ * ... * 1.0.19 10 10019 10.so.0.19[.0] * ... - * 1.2.57 13 10257 12.so.0.57[.0] + * 1.2.59 13 10257 12.so.0.59[.0] * ... - * 1.5.28 15 10527 15.so.15.28[.0] + * 1.5.30 15 10527 15.so.15.30[.0] * ... - * 1.6.32 16 10632 16.so.16.32[.0] + * 1.6.34 16 10633 16.so.16.34[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -241,13 +241,13 @@ * Y2K compliance in libpng: * ========================= * - * August 24, 2017 + * September 29, 2017 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.6.32 are Y2K compliant. It is my belief that + * upward through 1.6.34 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -309,8 +309,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.32" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.32 - August 24, 2017\n" +#define PNG_LIBPNG_VER_STRING "1.6.34" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.34 - September 29, 2017\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -318,7 +318,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 32 +#define PNG_LIBPNG_VER_RELEASE 34 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -349,7 +349,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10632 /* 1.6.32 */ +#define PNG_LIBPNG_VER 10634 /* 1.6.34 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -459,7 +459,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_32; +typedef char* png_libpng_version_1_6_34; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -2819,6 +2819,8 @@ typedef struct # define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */ #endif +#define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U /* alpha channel is associated */ + /* Commonly used formats have predefined macros. * * First the single byte (sRGB) formats: diff --git a/Engine/lib/lpng/pngbar.jpg b/Engine/lib/lpng/pngbar.jpg new file mode 100644 index 0000000000000000000000000000000000000000..70ba8d817ce433788c7933dbe3c29c3e384b2b0a GIT binary patch literal 2498 zcmb79cR1UN8veLX-}`>=f8Y0x?_}m=8Q`%n#hU_5OiaM90Zxtq1>=CgTfsNH zyhE`{nwsjeShHXcFRV>~hi`yq2v*YHBRtd~Fu*+^LY^4lCw1}#Lva_%-vvRO=aKPAMFitLB9!@Se7YxRO;(_xakVqs4H@^T1A;613B7T`LfloCM zC>s>YhTw#8BK~ij^a5~J00TIJnM42(oCyqPI(Y@00RRyA^t=CpnFWBbLcymyB_03- z0x_M|W@3T<`-BN}TAvxt!Yd50@*zZ&*pN77LnCW9lz^y8aNMcnEYqn3{J(Y(W-t^0 zvHZ$XfCC^V5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Df;}>eg@uPwZ7NbAfwc4%LKv$AESApwMAQTgR)Bj)d}7P zwCAfKkJo5opoC@6Lg<3Mcwvcs4!^5<=}qW6{9VgWp{KyaBpI7crIgaZ7IUp RQSJZ$002ovPDHLkV1iCKFfIT9 literal 0 HcmV?d00001 diff --git a/Engine/lib/lpng/pngnow.png b/Engine/lib/lpng/pngnow.png new file mode 100644 index 0000000000000000000000000000000000000000..82793ebddb7863266a66ffc6ab2c01ca32100808 GIT binary patch literal 2069 zcmWkudpuN&7T#yD z0ALXk%;6bOV2GtAMuxod+KXid08{XL`q<{m10|OLLYbYp~ zqD01zCx~Qa;aTH3$83tYNL5@^&dW%qu3E?~lv;*N57-E2|bs(K#(iIEOmeFx% zkcfvMOG`)&LHQ673#pIPl0s5bu0h@0>CO<}7a`Ws2_Xc#K~M$^F+q|Eqco5dLWna2 z#X^t(LKqoD8nRJmzN=KPsmsFupvRG!&XgFV8A;Y6t95Zm1LFa^q z^92erLk2B|aULIYLrE_dC!DV+A~6Qa3B~AUAmL0W(=n6@Y2+%tkPyj9RsagyA*csN zrps7?xTc~3G=mlSYRm(ZDb=D31>#001TxH*!;$k@LY&S-QNy%At*T6qc|mvuj(MT{ zShXyF6!Ad#Eru11piDK&6sbyVIXSpO33CD}%6q-XYOk*K|bUdDgx`AW{hwjYa zM<-xjEZA^`|H~$2a>8bLQKZ} zLB^Jd#VHvwfGx?~A>ERiCUg3J?OJcAAZbdf6Hk&Nk_fY$mS?2o%GPH}1d{E{WQll1 z=-8g42GdW4aQykf``V&Q6W}O#EGzZC`E*NWZcMk35*qfRc}Z6Nnc{k=W$S9olPI;+ z@nk_TpA-koOx36tuc^5+8y2dJKCX$4z2CENV(>!in*_$fq1N2jW1W6k7j=WW!K2we zQx6hfTZ3TdyW^y&(Mek}jvhFo%!~{*FP%!sE17a%?j{}9boS=;RS0g0Vl+OX*4!KG zS9cV3_T@Rcztag#Ba8Akz?VEN{KY|&-cj^8X4hI9rOS7jb^I*rs9{W6y2#E2G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ngread.c +++ b/Engine/lib/lpng/pngread.c @@ -1,7 +1,7 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.32 [August 24, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -3759,7 +3759,13 @@ png_image_read_direct(png_voidp argument) mode = PNG_ALPHA_PNG; output_gamma = PNG_DEFAULT_sRGB; } - + + if ((change & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) + { + mode = PNG_ALPHA_OPTIMIZED; + change &= ~PNG_FORMAT_FLAG_ASSOCIATED_ALPHA; + } + /* If 'do_local_background' is set check for the presence of gamma * correction; this is part of the work-round for the libpng bug * described above. @@ -3985,6 +3991,10 @@ png_image_read_direct(png_voidp argument) else if (do_local_compose != 0) /* internal error */ png_error(png_ptr, "png_image_read: alpha channel lost"); + if ((format & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) { + info_format |= PNG_FORMAT_FLAG_ASSOCIATED_ALPHA; + } + if (info_ptr->bit_depth == 16) info_format |= PNG_FORMAT_FLAG_LINEAR; diff --git a/Engine/lib/lpng/pngrtran.c b/Engine/lib/lpng/pngrtran.c index 9a30ddf22..c18965031 100644 --- a/Engine/lib/lpng/pngrtran.c +++ b/Engine/lib/lpng/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.31 [July 27, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -430,7 +430,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, int i; png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); for (i = 0; i < num_palette; i++) png_ptr->quantize_index[i] = (png_byte)i; } @@ -447,7 +447,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize an array to sort colors */ png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte)))); /* Initialize the quantize_sort array */ for (i = 0; i < num_palette; i++) @@ -581,9 +581,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, /* Initialize palette index arrays */ png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * + (sizeof (png_byte)))); png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr, - (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte)))); + (png_alloc_size_t)((png_uint_32)num_palette * + (sizeof (png_byte)))); /* Initialize the sort array */ for (i = 0; i < num_palette; i++) @@ -592,7 +594,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, png_ptr->palette_to_index[i] = (png_byte)i; } - hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 * + hash = (png_dsortpp)png_calloc(png_ptr, (png_alloc_size_t)(769 * (sizeof (png_dsortp)))); num_new_palette = num_palette; @@ -623,7 +625,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, { t = (png_dsortp)png_malloc_warn(png_ptr, - (png_uint_32)(sizeof (png_dsort))); + (png_alloc_size_t)(sizeof (png_dsort))); if (t == NULL) break; @@ -748,9 +750,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette, png_size_t num_entries = ((png_size_t)1 << total_bits); png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr, - (png_uint_32)(num_entries * (sizeof (png_byte)))); + (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); - distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries * + distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries * (sizeof (png_byte)))); memset(distance, 0xff, num_entries * (sizeof (png_byte))); @@ -3322,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr) == png_ptr->trans_color.gray) { unsigned int tmp = *sp & (0x0f0f >> (4 - shift)); - tmp |= + tmp |= (unsigned int)(png_ptr->background.gray << shift); *sp = (png_byte)(tmp & 0xff); } diff --git a/Engine/lib/lpng/pngrutil.c b/Engine/lib/lpng/pngrutil.c index a4fa71457..8692933bd 100644 --- a/Engine/lib/lpng/pngrutil.c +++ b/Engine/lib/lpng/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.32 [August 24, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -314,6 +314,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn) if (buffer != NULL) { + memset(buffer, 0, new_size); /* just in case */ png_ptr->read_buffer = buffer; png_ptr->read_buffer_size = new_size; } @@ -673,6 +674,8 @@ png_decompress_chunk(png_structrp png_ptr, if (text != NULL) { + memset(text, 0, buffer_size); + ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/, png_ptr->read_buffer + prefix_size, &lzsize, text + prefix_size, newlength); @@ -736,9 +739,7 @@ png_decompress_chunk(png_structrp png_ptr, { /* inflateReset failed, store the error message */ png_zstream_error(png_ptr, ret); - - if (ret == Z_STREAM_END) - ret = PNG_UNEXPECTED_ZLIB_RETURN; + ret = PNG_UNEXPECTED_ZLIB_RETURN; } } @@ -1476,7 +1477,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) /* Now read the tag table; a variable size buffer is * needed at this point, allocate one for the whole * profile. The header check has already validated - * that none of these stuff will overflow. + * that none of this stuff will overflow. */ const png_uint_32 tag_count = png_get_uint_32( profile_header+128); @@ -1583,19 +1584,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) return; } } - - else if (size > 0) - errmsg = "truncated"; - -#ifndef __COVERITY__ - else + if (errmsg == NULL) errmsg = png_ptr->zstream.msg; -#endif } - /* else png_icc_check_tag_table output an error */ } - else /* profile truncated */ errmsg = png_ptr->zstream.msg; } @@ -3144,28 +3137,28 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) { png_alloc_size_t limit = PNG_UINT_31_MAX; - if (png_ptr->chunk_name != png_IDAT) - { # ifdef PNG_SET_USER_LIMITS_SUPPORTED - if (png_ptr->user_chunk_malloc_max > 0 && - png_ptr->user_chunk_malloc_max < limit) - limit = png_ptr->user_chunk_malloc_max; + if (png_ptr->user_chunk_malloc_max > 0 && + png_ptr->user_chunk_malloc_max < limit) + limit = png_ptr->user_chunk_malloc_max; # elif PNG_USER_CHUNK_MALLOC_MAX > 0 - if (PNG_USER_CHUNK_MALLOC_MAX < limit) - limit = PNG_USER_CHUNK_MALLOC_MAX; + if (PNG_USER_CHUNK_MALLOC_MAX < limit) + limit = PNG_USER_CHUNK_MALLOC_MAX; # endif - } - else + if (png_ptr->chunk_name == png_IDAT) { + png_alloc_size_t idat_limit = PNG_UINT_31_MAX; size_t row_factor = (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1) + 1 + (png_ptr->interlaced? 6: 0)); if (png_ptr->height > PNG_UINT_32_MAX/row_factor) - limit=PNG_UINT_31_MAX; + idat_limit=PNG_UINT_31_MAX; else - limit = png_ptr->height * row_factor; - limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */ - limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX; + idat_limit = png_ptr->height * row_factor; + row_factor = row_factor > 32566? 32566 : row_factor; + idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */ + idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX; + limit = limit < idat_limit? idat_limit : limit; } if (length > limit) diff --git a/Engine/lib/lpng/pngtest.c b/Engine/lib/lpng/pngtest.c index ce53345e1..9d5075791 100644 --- a/Engine/lib/lpng/pngtest.c +++ b/Engine/lib/lpng/pngtest.c @@ -2153,4 +2153,4 @@ main(void) #endif /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32; +typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34; diff --git a/Engine/lib/lpng/pngtest.png b/Engine/lib/lpng/pngtest.png new file mode 100644 index 0000000000000000000000000000000000000000..66df0c4e6f6d13981148bf2fbb85df2b797028a7 GIT binary patch literal 8759 zcmX9k1ymc)(*cSW3bZ%{no!&+(grJT2~?ms!6{HYxEJ>V#l1m_Yk@#i zRZ$M`4|Dk^4)MLfPzdc66r3L(9{!t)0;}0`_d5pQc94~ZnAlsoIKObQvw}NgNdL8m z2LQH(y*;0au@gXmm*1QpAR^2w{7TsTmDXFY=NN&f&Y1hK1YZe>h|2T45d^#v5E2lP z7g_fssmE{$9h7u1k9z#v!@!`r)dHg{q2efG@lGl@$38 zi*gW%YxDDO`X>K7pN~UDH&C>Xm3SgCqW%{}8S&`f)FY9uy<%fHqA zeCV7WU!n>7YW;J=pG5vFFrX1Y8q)2tu{&02Nds#v1g&F>Z&Pz2g0^a^alUb(9&p=E zl|53ppvJ^1>sS4qxo)|PI9(~e`#F|cnqf6V-({k{m$MG!z_So5_kEheE>Sc*>~Xss zSXZb$An?L^#+0cCV0*Sf(iuD8qT>Yr-*DNG-&xh$WZS!=J)fbsct8%~6!ygb2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p9MGl7rH}os?viS+jCQ&3aRB-IZi^iaj!HY9MZ7w2Y;9 zOm+lX%s~v2|CLh+nQJRsK%oFm3`_vP#(E0C!9Z95OjSpy72whTU;qG9y73>Bhx`9r XEN%cGySZ5AKccd{nq0Yz(bxY2;5`P= literal 0 HcmV?d00001 diff --git a/Engine/lib/lpng/pngtrans.c b/Engine/lib/lpng/pngtrans.c index 326ac33f0..6882f0fd7 100644 --- a/Engine/lib/lpng/pngtrans.c +++ b/Engine/lib/lpng/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.6.30 [June 28, 2017] + * Last changed in libpng 1.6.33 [September 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -609,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) return; /* The filler channel has gone already */ /* Fix the rowbytes value. */ - row_info->rowbytes = (unsigned int)(dp-row); + row_info->rowbytes = (png_size_t)(dp-row); } #endif @@ -708,7 +708,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) * forms produced on either GCC or MSVC. */ int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width); - png_bytep rp = png_ptr->row_buf + row_info->rowbytes; + png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1; switch (row_info->bit_depth) { diff --git a/Engine/lib/lpng/pngwrite.c b/Engine/lib/lpng/pngwrite.c index a7662acb7..a16d77ce0 100644 --- a/Engine/lib/lpng/pngwrite.c +++ b/Engine/lib/lpng/pngwrite.c @@ -1940,7 +1940,7 @@ png_image_write_main(png_voidp argument) int colormap = (format & PNG_FORMAT_FLAG_COLORMAP); int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */ int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA); - int write_16bit = linear && !colormap && (display->convert_to_8bit == 0); + int write_16bit = linear && (display->convert_to_8bit == 0); # ifdef PNG_BENIGN_ERRORS_SUPPORTED /* Make sure we error out on any bad situation */ From 01f0d5cfca1a94b2381712d7d670d2539da830c4 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 19 Dec 2017 16:04:46 -0600 Subject: [PATCH 069/312] tAlgorythm fed namespace T3D for better library interoperability. resulted in the need to specify usage in... a few places. --- Engine/source/T3D/decal/decalDataFile.cpp | 2 +- Engine/source/T3D/fx/windEmitter.cpp | 2 +- Engine/source/collision/clippedPolyList.cpp | 4 +- Engine/source/console/simObjectList.cpp | 10 +-- Engine/source/console/simSet.h | 4 +- Engine/source/core/tAlgorithm.h | 69 ++++++++++--------- Engine/source/forest/forestDataFile.cpp | 4 +- Engine/source/forest/forestWindMgr.cpp | 4 +- Engine/source/gui/editor/guiEditCtrl.cpp | 2 +- Engine/source/materials/processedMaterial.cpp | 2 +- Engine/source/math/mIntersector.h | 2 +- Engine/source/math/mPlaneSet.h | 2 +- Engine/source/math/mathUtils.cpp | 2 +- Engine/source/postFx/postEffectManager.cpp | 8 +-- Engine/source/scene/sceneContainer.cpp | 4 +- Engine/source/sfx/sfxController.cpp | 2 +- Engine/source/sfx/sfxDevice.cpp | 4 +- Engine/source/sfx/sfxSystem.cpp | 6 +- Engine/source/terrain/terrCellMaterial.cpp | 4 +- Engine/source/ts/tsLastDetail.cpp | 2 +- 20 files changed, 70 insertions(+), 69 deletions(-) diff --git a/Engine/source/T3D/decal/decalDataFile.cpp b/Engine/source/T3D/decal/decalDataFile.cpp index 002184c16..6dc321a4a 100644 --- a/Engine/source/T3D/decal/decalDataFile.cpp +++ b/Engine/source/T3D/decal/decalDataFile.cpp @@ -131,7 +131,7 @@ bool DecalDataFile::write( Stream& stream ) { DecalInstance *inst = allDecals[i]; - dataIter = find( allDatablocks.begin(), allDatablocks.end(), inst->mDataBlock ); + dataIter = T3D::find( allDatablocks.begin(), allDatablocks.end(), inst->mDataBlock ); U8 dataIndex = dataIter - allDatablocks.begin(); stream.write( dataIndex ); diff --git a/Engine/source/T3D/fx/windEmitter.cpp b/Engine/source/T3D/fx/windEmitter.cpp index 719ecb905..a484be4be 100644 --- a/Engine/source/T3D/fx/windEmitter.cpp +++ b/Engine/source/T3D/fx/windEmitter.cpp @@ -47,7 +47,7 @@ WindEmitter::WindEmitter() WindEmitter::~WindEmitter() { - WindEmitterList::iterator iter = find( smAllEmitters.begin(), smAllEmitters.end(), this ); + WindEmitterList::iterator iter = T3D::find( smAllEmitters.begin(), smAllEmitters.end(), this ); smAllEmitters.erase( iter ); } diff --git a/Engine/source/collision/clippedPolyList.cpp b/Engine/source/collision/clippedPolyList.cpp index 5fd665d87..3eee28a09 100644 --- a/Engine/source/collision/clippedPolyList.cpp +++ b/Engine/source/collision/clippedPolyList.cpp @@ -330,7 +330,7 @@ void ClippedPolyList::cullUnusedVerts() for ( vIter = mVertexList.begin(); vIter != mVertexList.end(); vIter++, i++ ) { // Is this vertex used? - iNextIter = find( mIndexList.begin(), mIndexList.end(), i ); + iNextIter = T3D::find( mIndexList.begin(), mIndexList.end(), i ); if ( iNextIter != mIndexList.end() ) continue; @@ -346,7 +346,7 @@ void ClippedPolyList::cullUnusedVerts() for ( nextVIter = vIter + 1; nextVIter != mVertexList.end(); nextVIter++, n++ ) { - iNextIter = find( mIndexList.begin(), mIndexList.end(), n ); + iNextIter = T3D::find( mIndexList.begin(), mIndexList.end(), n ); // If we found a used vertex // grab its index for later use diff --git a/Engine/source/console/simObjectList.cpp b/Engine/source/console/simObjectList.cpp index 3dec06767..8388f6e9d 100644 --- a/Engine/source/console/simObjectList.cpp +++ b/Engine/source/console/simObjectList.cpp @@ -33,7 +33,7 @@ String SimObjectList::smSortScriptCallbackFn; bool SimObjectList::pushBack(SimObject* obj) { - if (find(begin(),end(),obj) == end()) + if (T3D::find(begin(),end(),obj) == end()) { push_back(obj); return true; @@ -44,7 +44,7 @@ bool SimObjectList::pushBack(SimObject* obj) bool SimObjectList::pushBackForce(SimObject* obj) { - iterator itr = find(begin(),end(),obj); + iterator itr = T3D::find(begin(),end(),obj); if (itr == end()) { push_back(obj); @@ -64,7 +64,7 @@ bool SimObjectList::pushBackForce(SimObject* obj) bool SimObjectList::pushFront(SimObject* obj) { - if (find(begin(),end(),obj) == end()) + if (T3D::find(begin(),end(),obj) == end()) { push_front(obj); return true; @@ -75,7 +75,7 @@ bool SimObjectList::pushFront(SimObject* obj) bool SimObjectList::remove(SimObject* obj) { - iterator ptr = find(begin(),end(),obj); + iterator ptr = T3D::find(begin(),end(),obj); if (ptr != end()) { erase(ptr); @@ -87,7 +87,7 @@ bool SimObjectList::remove(SimObject* obj) bool SimObjectList::removeStable(SimObject* obj) { - iterator ptr = find(begin(),end(),obj); + iterator ptr = T3D::find(begin(),end(),obj); if (ptr != end()) { erase(ptr); diff --git a/Engine/source/console/simSet.h b/Engine/source/console/simSet.h index 9712e7945..4bb6e9300 100644 --- a/Engine/source/console/simSet.h +++ b/Engine/source/console/simSet.h @@ -154,9 +154,9 @@ class SimSet : public SimObject, public TamlChildren value operator[] (S32 index) { return objectList[U32(index)]; } inline iterator find( iterator first, iterator last, SimObject *obj) - { return ::find(first, last, obj); } + { return T3D::find(first, last, obj); } inline iterator find(SimObject *obj) - { return ::find(begin(), end(), obj); } + { return T3D::find(begin(), end(), obj); } /// Reorder the position of "obj" to either be the last object in the list or, if /// "target" is given, to come before "target" in the list of children. diff --git a/Engine/source/core/tAlgorithm.h b/Engine/source/core/tAlgorithm.h index 2c5b6d25f..defe6171f 100644 --- a/Engine/source/core/tAlgorithm.h +++ b/Engine/source/core/tAlgorithm.h @@ -23,40 +23,41 @@ #ifndef _TALGORITHM_H_ #define _TALGORITHM_H_ - -/// Finds the first matching value within the container -/// returning the the element or last if its not found. -template -Iterator find(Iterator first, Iterator last, Value value) +namespace T3D { - while (first != last && *first != value) - ++first; - return first; + /// Finds the first matching value within the container + /// returning the the element or last if its not found. + template + Iterator find(Iterator first, Iterator last, Value value) + { + while (first != last && *first != value) + ++first; + return first; + } + + /// Exchanges the values of the two elements. + template + inline void swap(T &left, T &right) + { + T temp = right; + right = left; + left = temp; + } + + /// Steps thru the elements of an array calling detete for each. + template + void for_each(Iterator first, Iterator last, Functor func) + { + for (; first != last; first++) + func(*first); + } + + /// Functor for deleting a pointer. + /// @see for_each + struct delete_pointer + { + template + void operator()(T *ptr) { delete ptr; } + }; } - -/// Exchanges the values of the two elements. -template -inline void swap( T &left, T &right ) -{ - T temp = right; - right = left; - left = temp; -} - -/// Steps thru the elements of an array calling detete for each. -template -void for_each( Iterator first, Iterator last, Functor func ) -{ - for ( ; first != last; first++ ) - func( *first ); -} - -/// Functor for deleting a pointer. -/// @see for_each -struct delete_pointer -{ - template - void operator()(T *ptr){ delete ptr;} -}; - #endif //_TALGORITHM_H_ diff --git a/Engine/source/forest/forestDataFile.cpp b/Engine/source/forest/forestDataFile.cpp index a50fc2b81..b9a708df7 100644 --- a/Engine/source/forest/forestDataFile.cpp +++ b/Engine/source/forest/forestDataFile.cpp @@ -213,7 +213,7 @@ bool ForestData::write( const char *path ) Vector::const_iterator iter = items.begin(); for ( ; iter != items.end(); iter++ ) { - U8 dataIndex = find( allDatablocks.begin(), allDatablocks.end(), iter->getData() ) - allDatablocks.begin(); + U8 dataIndex = T3D::find( allDatablocks.begin(), allDatablocks.end(), iter->getData() ) - allDatablocks.begin(); stream.write( dataIndex ); @@ -770,7 +770,7 @@ U32 ForestData::getDatablocks( Vector *outVector ) const { ForestItemData *data = item->getData(); - if ( find( outVector->begin(), outVector->end(), data ) != outVector->end() ) + if (T3D::find( outVector->begin(), outVector->end(), data ) != outVector->end() ) continue; count++; diff --git a/Engine/source/forest/forestWindMgr.cpp b/Engine/source/forest/forestWindMgr.cpp index 6db8a03bf..e61e41c83 100644 --- a/Engine/source/forest/forestWindMgr.cpp +++ b/Engine/source/forest/forestWindMgr.cpp @@ -85,7 +85,7 @@ void ForestWindMgr::addEmitter( ForestWindEmitter *emitter ) void ForestWindMgr::removeEmitter( ForestWindEmitter *emitter ) { - ForestWindEmitterList::iterator iter = find( mEmitters.begin(), + ForestWindEmitterList::iterator iter = T3D::find( mEmitters.begin(), mEmitters.end(), emitter ); @@ -161,7 +161,7 @@ void ForestWindMgr::processTick() PROFILE_SCOPE( ForestWindMgr_AdvanceTime_SwapSources ); AssertFatal( mPrevSources->isEmpty(), "prev sources not empty!" ); - swap( mSources, mPrevSources ); + T3D::swap( mSources, mPrevSources ); AssertFatal( mSources->isEmpty(), "swap failed!" ); } diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 09644d990..0abd6589b 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -1015,7 +1015,7 @@ void GuiEditCtrl::removeSelection( GuiControl* ctrl ) { if( selectionContains( ctrl ) ) { - Vector< GuiControl* >::iterator i = ::find( mSelectedControls.begin(), mSelectedControls.end(), ctrl ); + Vector< GuiControl* >::iterator i = T3D::find( mSelectedControls.begin(), mSelectedControls.end(), ctrl ); if ( i != mSelectedControls.end() ) mSelectedControls.erase( i ); diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 1622d50e6..d910d6245 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -103,7 +103,7 @@ ProcessedMaterial::ProcessedMaterial() ProcessedMaterial::~ProcessedMaterial() { - for_each( mPasses.begin(), mPasses.end(), delete_pointer() ); + T3D::for_each( mPasses.begin(), mPasses.end(), T3D::delete_pointer() ); } void ProcessedMaterial::_setBlendState(Material::BlendOp blendOp, GFXStateBlockDesc& desc ) diff --git a/Engine/source/math/mIntersector.h b/Engine/source/math/mIntersector.h index e667e1715..32d8a3d6f 100644 --- a/Engine/source/math/mIntersector.h +++ b/Engine/source/math/mIntersector.h @@ -228,7 +228,7 @@ void PolyhedronBoxIntersector< Polyhedron >::_preprocess( const MatrixF& objToWo Point2F p = _project( i, v2 ); // Second point on line. if( frontFace != 0 ) - swap( p, q ); + T3D::swap( p, q ); Point2F normal( - ( p.y - q.y ), p.x - q.x ); normal.normalize(); diff --git a/Engine/source/math/mPlaneSet.h b/Engine/source/math/mPlaneSet.h index 8d0a919bb..511c7bd92 100644 --- a/Engine/source/math/mPlaneSet.h +++ b/Engine/source/math/mPlaneSet.h @@ -441,7 +441,7 @@ U32 PlaneSet< T >::clipPolygon( const Point3F* inVertices, U32 inNumVertices, Po // Make the output of the last iteration the // input of this iteration. - swap( tempPolygon, clippedPolygon ); + T3D::swap( tempPolygon, clippedPolygon ); numTempPolygonVertices = numClippedPolygonVertices; if( maxOutVertices < numTempPolygonVertices + 1 ) diff --git a/Engine/source/math/mathUtils.cpp b/Engine/source/math/mathUtils.cpp index dfc418deb..745338e10 100644 --- a/Engine/source/math/mathUtils.cpp +++ b/Engine/source/math/mathUtils.cpp @@ -1706,7 +1706,7 @@ bool clipFrustumByPolygon( const Point3F* points, U32 numPoints, const RectI& vi // Make the output of the last iteration the // input of this iteration. - swap( tempPolygon, clippedPolygon ); + T3D::swap( tempPolygon, clippedPolygon ); numTempPolygonVertices = numClippedPolygonVertices; // Clip our current remainder of the original polygon diff --git a/Engine/source/postFx/postEffectManager.cpp b/Engine/source/postFx/postEffectManager.cpp index 4316cfc33..dc37723bb 100644 --- a/Engine/source/postFx/postEffectManager.cpp +++ b/Engine/source/postFx/postEffectManager.cpp @@ -198,7 +198,7 @@ bool PostEffectManager::_addEffect( PostEffect *effect ) bool PostEffectManager::_removeEffect( PostEffect *effect ) { // Check the end of frame list. - EffectVector::iterator iter = find( mEndOfFrameList.begin(), mEndOfFrameList.end(), effect ); + EffectVector::iterator iter = T3D::find( mEndOfFrameList.begin(), mEndOfFrameList.end(), effect ); if ( iter != mEndOfFrameList.end() ) { mEndOfFrameList.erase( iter ); @@ -206,7 +206,7 @@ bool PostEffectManager::_removeEffect( PostEffect *effect ) } // Check the diffuse list. - iter = find( mAfterDiffuseList.begin(), mAfterDiffuseList.end(), effect ); + iter = T3D::find( mAfterDiffuseList.begin(), mAfterDiffuseList.end(), effect ); if ( iter != mAfterDiffuseList.end() ) { mAfterDiffuseList.erase( iter ); @@ -218,7 +218,7 @@ bool PostEffectManager::_removeEffect( PostEffect *effect ) for( ; mapIter != mAfterBinMap.end(); mapIter++ ) { EffectVector &effects = mapIter->value; - iter = find( effects.begin(), effects.end(), effect ); + iter = T3D::find( effects.begin(), effects.end(), effect ); if ( iter != effects.end() ) { effects.erase( iter ); @@ -230,7 +230,7 @@ bool PostEffectManager::_removeEffect( PostEffect *effect ) for( ; mapIter != mBeforeBinMap.end(); mapIter++ ) { EffectVector &effects = mapIter->value; - iter = find( effects.begin(), effects.end(), effect ); + iter = T3D::find( effects.begin(), effects.end(), effect ); if ( iter != effects.end() ) { effects.erase( iter ); diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index 6f6202414..a561f45e3 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -183,7 +183,7 @@ bool SceneContainer::removeObject(SceneObject* obj) // Remove water and physical zone types from the special vector. if ( obj->getTypeMask() & ( WaterObjectType | PhysicalZoneObjectType ) ) { - Vector::iterator iter = find( mWaterAndZones.begin(), mWaterAndZones.end(), obj ); + Vector::iterator iter = T3D::find( mWaterAndZones.begin(), mWaterAndZones.end(), obj ); if( iter != mTerrains.end() ) mWaterAndZones.erase_fast(iter); } @@ -191,7 +191,7 @@ bool SceneContainer::removeObject(SceneObject* obj) // Remove terrain objects from special vector. if( obj->getTypeMask() & TerrainObjectType ) { - Vector< SceneObject* >::iterator iter = find( mTerrains.begin(), mTerrains.end(), obj ); + Vector< SceneObject* >::iterator iter = T3D::find( mTerrains.begin(), mTerrains.end(), obj ); if( iter != mTerrains.end() ) mTerrains.erase_fast(iter); } diff --git a/Engine/source/sfx/sfxController.cpp b/Engine/source/sfx/sfxController.cpp index f5f17dfb6..2d9592eef 100644 --- a/Engine/source/sfx/sfxController.cpp +++ b/Engine/source/sfx/sfxController.cpp @@ -142,7 +142,7 @@ void SFXController::_compileList( SFXPlayList* playList ) { // Randomly exchange slots in the list. for( U32 i = 0; i < SFXPlayList::NUM_SLOTS; ++ i ) - swap( slotList[ gRandGen.randI( 0, SFXPlayList::NUM_SLOTS - 1 ) ], slotList[ i ] ); + T3D::swap( slotList[ gRandGen.randI( 0, SFXPlayList::NUM_SLOTS - 1 ) ], slotList[ i ] ); } break; diff --git a/Engine/source/sfx/sfxDevice.cpp b/Engine/source/sfx/sfxDevice.cpp index 3bb37f68f..1d2f7cf30 100644 --- a/Engine/source/sfx/sfxDevice.cpp +++ b/Engine/source/sfx/sfxDevice.cpp @@ -165,7 +165,7 @@ void SFXDevice::_removeBuffer( SFXBuffer* buffer ) { AssertFatal( buffer, "SFXDevice::_removeBuffer() - Got a null buffer!" ); - BufferIterator iter = find( mBuffers.begin(), mBuffers.end(), buffer ); + BufferIterator iter = T3D::find( mBuffers.begin(), mBuffers.end(), buffer ); if( iter != mBuffers.end() ) { SFXBuffer* buffer = *iter; @@ -201,7 +201,7 @@ void SFXDevice::_removeVoice( SFXVoice* voice ) { AssertFatal( voice, "SFXDevice::_removeVoice() - Got null voice!" ); - VoiceIterator iter = find( mVoices.begin(), mVoices.end(), voice ); + VoiceIterator iter = T3D::find( mVoices.begin(), mVoices.end(), voice ); if( iter != mVoices.end() ) { mStatNumVoices --; diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index 0ad80df6e..b02d4fc67 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -647,7 +647,7 @@ void SFXSystem::deleteWhenStopped( SFXSource* source ) // If the source isn't already on the play-once source list, // put it there now. - Vector< SFXSource* >::iterator iter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); + Vector< SFXSource* >::iterator iter = T3D::find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); if( iter == mPlayOnceSources.end() ) mPlayOnceSources.push_back( source ); } @@ -674,7 +674,7 @@ void SFXSystem::_onRemoveSource( SFXSource* source ) { // Check if it was a play once source. - Vector< SFXSource* >::iterator iter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); + Vector< SFXSource* >::iterator iter = T3D::find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); if ( iter != mPlayOnceSources.end() ) mPlayOnceSources.erase_fast( iter ); @@ -684,7 +684,7 @@ void SFXSystem::_onRemoveSource( SFXSource* source ) if( dynamic_cast< SFXSound* >( source ) ) { - SFXSoundVector::iterator iter = find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) ); + SFXSoundVector::iterator iter = T3D::find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) ); if( iter != mSounds.end() ) mSounds.erase_fast( iter ); diff --git a/Engine/source/terrain/terrCellMaterial.cpp b/Engine/source/terrain/terrCellMaterial.cpp index cd1f123d0..de0be345e 100644 --- a/Engine/source/terrain/terrCellMaterial.cpp +++ b/Engine/source/terrain/terrCellMaterial.cpp @@ -289,7 +289,7 @@ void TerrainCellMaterial::init( TerrainBlock *block, // The pass failed to be generated... give up. mPasses.last().materials.clear(); mPasses.clear(); - for_each( materials.begin(), materials.end(), delete_pointer() ); + T3D::for_each( materials.begin(), materials.end(), T3D::delete_pointer() ); return; } @@ -298,7 +298,7 @@ void TerrainCellMaterial::init( TerrainBlock *block, } // Cleanup any remaining matinfo. - for_each( materials.begin(), materials.end(), delete_pointer() ); + T3D::for_each( materials.begin(), materials.end(), T3D::delete_pointer() ); // If we have attached mats then update them too. if ( mDeferredMat ) diff --git a/Engine/source/ts/tsLastDetail.cpp b/Engine/source/ts/tsLastDetail.cpp index 863e79f3f..9619903b0 100644 --- a/Engine/source/ts/tsLastDetail.cpp +++ b/Engine/source/ts/tsLastDetail.cpp @@ -101,7 +101,7 @@ TSLastDetail::~TSLastDetail() mMaterial->deleteObject(); // Remove ourselves from the list. - Vector::iterator iter = find( smLastDetails.begin(), smLastDetails.end(), this ); + Vector::iterator iter = T3D::find( smLastDetails.begin(), smLastDetails.end(), this ); smLastDetails.erase( iter ); } From 601d232223c52a299ca23678ef82535095d58358 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 2 Jan 2018 15:48:44 -0600 Subject: [PATCH 070/312] Removes the LibMNG and LunGIF libraries, as they aren't actually utilized and just extend the build times. --- Engine/lib/lmng/CHANGES | 1447 - Engine/lib/lmng/LICENSE | 57 - Engine/lib/lmng/README | 36 - Engine/lib/lmng/README.autoconf | 213 - Engine/lib/lmng/README.config | 104 - Engine/lib/lmng/README.contrib | 95 - Engine/lib/lmng/README.dll | 41 - Engine/lib/lmng/README.examples | 48 - Engine/lib/lmng/README.footprint | 46 - Engine/lib/lmng/README.packaging | 24 - Engine/lib/lmng/bcb/bogus/bogus.bpr | 184 - Engine/lib/lmng/bcb/bogus/bogus.cpp | 212 - Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr | 235 - Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp | 489 - Engine/lib/lmng/bcb/mngrepair/mngrepair.res | Bin 1676 -> 0 bytes Engine/lib/lmng/bcb/mngtree/mngtree.bpr | 188 - Engine/lib/lmng/bcb/mngtree/mngtree.cpp | 249 - Engine/lib/lmng/bcb/mngview/MNGI.ICO | Bin 766 -> 0 bytes Engine/lib/lmng/bcb/mngview/Main.cpp | 573 - Engine/lib/lmng/bcb/mngview/Main.dfm | Bin 3660 -> 0 bytes Engine/lib/lmng/bcb/mngview/Main.h | 84 - Engine/lib/lmng/bcb/mngview/MngView.bpr | 187 - Engine/lib/lmng/bcb/mngview/MngView.cpp | 23 - Engine/lib/lmng/bcb/mngview/MngView.res | Bin 876 -> 0 bytes Engine/lib/lmng/bcb/mngview/README.TXT | 22 - Engine/lib/lmng/bcb/win32dll/libmng.bpr | 315 - Engine/lib/lmng/bcb/win32dll/libmng.cpp | 153 - Engine/lib/lmng/bcb/win32dll/libmng.dll | Bin 211456 -> 0 bytes Engine/lib/lmng/contrib/README | 1 - Engine/lib/lmng/contrib/bcb/mngdump/About.cpp | 25 - Engine/lib/lmng/contrib/bcb/mngdump/About.h | 7 - .../lib/lmng/contrib/bcb/mngdump/CALLBACK.CPP | 96 - .../lib/lmng/contrib/bcb/mngdump/CALLBACK.H | 39 - .../lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP | 1689 -- Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp | 23 - Engine/lib/lmng/contrib/bcb/mngdump/Help.h | 6 - .../lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR | 195 - .../lib/lmng/contrib/bcb/mngdump/MNGDUMP.RES | Bin 1684 -> 0 bytes .../lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp | 27 - Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp | 793 - Engine/lib/lmng/contrib/bcb/mngdump/Main.dfm | Bin 28109 -> 0 bytes Engine/lib/lmng/contrib/bcb/mngdump/Main.h | 296 - Engine/lib/lmng/contrib/delphi/libmng.pas | 1811 -- .../lib/lmng/contrib/delphi/mngview/Main.dfm | Bin 3642 -> 0 bytes .../lib/lmng/contrib/delphi/mngview/Main.pas | 692 - .../lmng/contrib/delphi/mngview/mngview.dpr | 14 - Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING | 340 - .../lib/lmng/contrib/gcc/fbmngplay/ChangeLog | 10 - .../lib/lmng/contrib/gcc/fbmngplay/Makefile | 50 - Engine/lib/lmng/contrib/gcc/fbmngplay/README | 30 - .../lib/lmng/contrib/gcc/fbmngplay/console.c | 107 - .../lib/lmng/contrib/gcc/fbmngplay/console.h | 21 - .../lmng/contrib/gcc/fbmngplay/fbmngplay.c | 228 - .../lmng/contrib/gcc/fbmngplay/fbmngplay.h | 43 - .../lib/lmng/contrib/gcc/fbmngplay/messages.c | 40 - .../lib/lmng/contrib/gcc/fbmngplay/messages.h | 19 - Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c | 398 - Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h | 38 - .../lib/lmng/contrib/gcc/gtk-mng-view/COPYING | 481 - .../lmng/contrib/gcc/gtk-mng-view/Makefile | 29 - .../lib/lmng/contrib/gcc/gtk-mng-view/README | 38 - .../contrib/gcc/gtk-mng-view/README.compile | 8 - .../lib/lmng/contrib/gcc/gtk-mng-view/dummy.c | 139 - .../contrib/gcc/gtk-mng-view/gtk-mng-view.c | 471 - .../contrib/gcc/gtk-mng-view/gtk-mng-view.h | 64 - .../lmng/contrib/gcc/gtk-mng-view/linux.mng | Bin 62066 -> 0 bytes .../lmng/contrib/gcc/mngtree/makefile.linux | 43 - Engine/lib/lmng/contrib/gcc/mngtree/mngtree.c | 237 - .../contrib/gcc/sdl-mngplay/.deps/mngplay.P | 114 - .../lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS | 7 - .../lib/lmng/contrib/gcc/sdl-mngplay/COPYING | 340 - .../lmng/contrib/gcc/sdl-mngplay/ChangeLog | 29 - .../lib/lmng/contrib/gcc/sdl-mngplay/INSTALL | 182 - .../lmng/contrib/gcc/sdl-mngplay/Makefile.am | 10 - .../lmng/contrib/gcc/sdl-mngplay/Makefile.in | 534 - .../lib/lmng/contrib/gcc/sdl-mngplay/README | 27 - .../lmng/contrib/gcc/sdl-mngplay/acinclude.m4 | 34 - .../lmng/contrib/gcc/sdl-mngplay/aclocal.m4 | 851 - .../contrib/gcc/sdl-mngplay/autogen.notes | 54 - .../lmng/contrib/gcc/sdl-mngplay/autogen.sh | 135 - .../lmng/contrib/gcc/sdl-mngplay/configure | 5782 ---- .../lmng/contrib/gcc/sdl-mngplay/configure.in | 35 - .../lib/lmng/contrib/gcc/sdl-mngplay/depcomp | 530 - .../lmng/contrib/gcc/sdl-mngplay/install-sh | 323 - .../lib/lmng/contrib/gcc/sdl-mngplay/missing | 360 - .../lmng/contrib/gcc/sdl-mngplay/mngplay.c | 507 - Engine/lib/lmng/contrib/gcc/xmngview/Makefile | 20 - Engine/lib/lmng/contrib/gcc/xmngview/README | 23 - Engine/lib/lmng/contrib/gcc/xmngview/color.c | 645 - Engine/lib/lmng/contrib/gcc/xmngview/xmng.h | 103 - .../lib/lmng/contrib/gcc/xmngview/xmngview.c | 1185 - Engine/lib/lmng/contrib/kylix/libmng.pas | 1726 -- .../lib/lmng/contrib/kylix/mngview/Main.dfm | Bin 2045 -> 0 bytes .../lib/lmng/contrib/kylix/mngview/Main.pas | 555 - Engine/lib/lmng/contrib/kylix/mngview/mngview | 17 - .../lmng/contrib/kylix/mngview/mngview.conf | 33 - .../lmng/contrib/kylix/mngview/mngview.dpr | 17 - .../lmng/contrib/kylix/mngview/mngview.kof | 61 - .../lmng/contrib/kylix/mngview/mngview.res | Bin 1688 -> 0 bytes .../contrib/msvc/libmng-msvc.lib/README.txt | 26 - .../contrib/msvc/libmng-msvc.lib/libmng.def | 380 - .../contrib/msvc/libmng-msvc.lib/libmng.lib | Bin 96386 -> 0 bytes Engine/lib/lmng/contrib/msvc/makemng/Makefile | 37 - Engine/lib/lmng/contrib/msvc/makemng/README | 24 - .../lib/lmng/contrib/msvc/makemng/filelist.c | 276 - .../lmng/contrib/msvc/makemng/getopt/getopt.c | 1060 - .../lmng/contrib/msvc/makemng/getopt/getopt.h | 180 - .../contrib/msvc/makemng/getopt/getopt1.c | 189 - .../lib/lmng/contrib/msvc/makemng/makemng.c | 1765 -- .../lib/lmng/contrib/msvc/makemng/makemng.dsp | 114 - .../lib/lmng/contrib/msvc/makemng/makemng.dsw | 29 - .../lib/lmng/contrib/msvc/mngplg/COPYING-LCMS | 515 - .../msvc/mngplg/mngplg-src-1.0.1/cur_ie.cur | Bin 326 -> 0 bytes .../msvc/mngplg/mngplg-src-1.0.1/cur_ns.cur | Bin 326 -> 0 bytes .../msvc/mngplg/mngplg-src-1.0.1/license.txt | 40 - .../msvc/mngplg/mngplg-src-1.0.1/npapidefs.h | 245 - .../msvc/mngplg/mngplg-src-1.0.1/npmngplg.c | 1936 -- .../msvc/mngplg/mngplg-src-1.0.1/npmngplg.def | 6 - .../msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep | 22 - .../msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp | 123 - .../msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw | 29 - .../msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak | 225 - .../msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc | 175 - .../msvc/mngplg/mngplg-src-1.0.1/resource.h | 19 - .../lib/lmng/contrib/msvc/mngplg/readme.txt | 211 - .../lib/lmng/contrib/msvc/mngview/MNGView.dsp | 126 - .../lib/lmng/contrib/msvc/mngview/MNGView.dsw | 29 - .../lib/lmng/contrib/msvc/mngview/MNGView.opt | Bin 48640 -> 0 bytes .../lib/lmng/contrib/msvc/mngview/MNGView.plg | 34 - Engine/lib/lmng/contrib/msvc/mngview/Main.cpp | 334 - Engine/lib/lmng/contrib/msvc/mngview/Main.h | 75 - Engine/lib/lmng/contrib/msvc/mngview/Main.rc | 105 - Engine/lib/lmng/contrib/msvc/mngview/Mng.ico | Bin 2238 -> 0 bytes Engine/lib/lmng/contrib/msvc/mngview/mng.cpp | 615 - .../lib/lmng/contrib/msvc/mngview/resource.h | 22 - Engine/lib/lmng/contrib/msvc/mngview/sRGB.icm | Bin 3144 -> 0 bytes .../lib/lmng/contrib/msvc/win32dll/README.txt | 23 - .../lib/lmng/contrib/msvc/win32dll/libmng.dsp | 465 - .../lib/lmng/contrib/msvc/win32dll/libmng.dsw | 29 - Engine/lib/lmng/doc/Plan1.png | Bin 9058 -> 0 bytes Engine/lib/lmng/doc/Plan2.png | Bin 8849 -> 0 bytes Engine/lib/lmng/doc/doc.readme | 19 - Engine/lib/lmng/doc/libmng.txt | 1107 - Engine/lib/lmng/doc/man/jng.5 | 37 - Engine/lib/lmng/doc/man/libmng.3 | 1146 - Engine/lib/lmng/doc/man/mng.5 | 42 - Engine/lib/lmng/doc/misc/magic.dif | 30 - .../lmng/doc/rpm/libmng-1.0.10-rhconf.patch | 38 - Engine/lib/lmng/doc/rpm/libmng.spec | 116 - Engine/lib/lmng/libmng.h | 2932 -- Engine/lib/lmng/libmng_callback_xs.c | 1239 - Engine/lib/lmng/libmng_chunk_descr.c | 6090 ---- Engine/lib/lmng/libmng_chunk_descr.h | 146 - Engine/lib/lmng/libmng_chunk_io.c | 10740 ------- Engine/lib/lmng/libmng_chunk_io.h | 415 - Engine/lib/lmng/libmng_chunk_prc.c | 4452 --- Engine/lib/lmng/libmng_chunk_prc.h | 381 - Engine/lib/lmng/libmng_chunk_xs.c | 7016 ----- Engine/lib/lmng/libmng_chunks.h | 1026 - Engine/lib/lmng/libmng_cms.c | 758 - Engine/lib/lmng/libmng_cms.h | 92 - Engine/lib/lmng/libmng_conf.h | 295 - Engine/lib/lmng/libmng_data.h | 1029 - Engine/lib/lmng/libmng_display.c | 7135 ----- Engine/lib/lmng/libmng_display.h | 343 - Engine/lib/lmng/libmng_dither.c | 58 - Engine/lib/lmng/libmng_dither.h | 45 - Engine/lib/lmng/libmng_error.c | 326 - Engine/lib/lmng/libmng_error.h | 119 - Engine/lib/lmng/libmng_filter.c | 978 - Engine/lib/lmng/libmng_filter.h | 69 - Engine/lib/lmng/libmng_hlapi.c | 2995 -- Engine/lib/lmng/libmng_jpeg.c | 1088 - Engine/lib/lmng/libmng_jpeg.h | 57 - Engine/lib/lmng/libmng_memory.h | 64 - Engine/lib/lmng/libmng_object_prc.c | 6998 ----- Engine/lib/lmng/libmng_object_prc.h | 690 - Engine/lib/lmng/libmng_objects.h | 635 - Engine/lib/lmng/libmng_pixels.c | 24610 ---------------- Engine/lib/lmng/libmng_pixels.h | 1147 - Engine/lib/lmng/libmng_prop_xs.c | 2799 -- Engine/lib/lmng/libmng_read.c | 1369 - Engine/lib/lmng/libmng_read.h | 53 - Engine/lib/lmng/libmng_trace.c | 1683 -- Engine/lib/lmng/libmng_trace.h | 1474 - Engine/lib/lmng/libmng_types.h | 574 - Engine/lib/lmng/libmng_write.c | 198 - Engine/lib/lmng/libmng_write.h | 49 - Engine/lib/lmng/libmng_zlib.c | 607 - Engine/lib/lmng/libmng_zlib.h | 60 - Engine/lib/lmng/makefiles/Makefile.am | 29 - Engine/lib/lmng/makefiles/README | 27 - Engine/lib/lmng/makefiles/configure.in | 193 - Engine/lib/lmng/makefiles/makefile.bcb3 | 108 - Engine/lib/lmng/makefiles/makefile.dj | 155 - Engine/lib/lmng/makefiles/makefile.linux | 180 - Engine/lib/lmng/makefiles/makefile.mingw | 164 - Engine/lib/lmng/makefiles/makefile.mingwdll | 158 - Engine/lib/lmng/makefiles/makefile.qnx | 160 - Engine/lib/lmng/makefiles/makefile.unix | 67 - Engine/lib/lmng/makefiles/makefile.vcwin32 | 99 - .../lib/lmng/special/mozcfg/mozlibmngconf.h | 218 - Engine/lib/lmng/unmaintained/autogen.sh | 50 - Engine/lib/lungif/dgif_lib.c | 1096 - Engine/lib/lungif/gif_err.c | 120 - Engine/lib/lungif/gif_lib.h | 336 - Engine/lib/lungif/gif_lib_private.h | 57 - Engine/lib/lungif/gifalloc.c | 443 - Tools/CMake/libraries/lmng.cmake | 32 - Tools/CMake/libraries/lungif.cmake | 28 - Tools/CMake/torque3d.cmake | 2 - 211 files changed, 136386 deletions(-) delete mode 100644 Engine/lib/lmng/CHANGES delete mode 100644 Engine/lib/lmng/LICENSE delete mode 100644 Engine/lib/lmng/README delete mode 100644 Engine/lib/lmng/README.autoconf delete mode 100644 Engine/lib/lmng/README.config delete mode 100644 Engine/lib/lmng/README.contrib delete mode 100644 Engine/lib/lmng/README.dll delete mode 100644 Engine/lib/lmng/README.examples delete mode 100644 Engine/lib/lmng/README.footprint delete mode 100644 Engine/lib/lmng/README.packaging delete mode 100644 Engine/lib/lmng/bcb/bogus/bogus.bpr delete mode 100644 Engine/lib/lmng/bcb/bogus/bogus.cpp delete mode 100644 Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr delete mode 100644 Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp delete mode 100644 Engine/lib/lmng/bcb/mngrepair/mngrepair.res delete mode 100644 Engine/lib/lmng/bcb/mngtree/mngtree.bpr delete mode 100644 Engine/lib/lmng/bcb/mngtree/mngtree.cpp delete mode 100644 Engine/lib/lmng/bcb/mngview/MNGI.ICO delete mode 100644 Engine/lib/lmng/bcb/mngview/Main.cpp delete mode 100644 Engine/lib/lmng/bcb/mngview/Main.dfm delete mode 100644 Engine/lib/lmng/bcb/mngview/Main.h delete mode 100644 Engine/lib/lmng/bcb/mngview/MngView.bpr delete mode 100644 Engine/lib/lmng/bcb/mngview/MngView.cpp delete mode 100644 Engine/lib/lmng/bcb/mngview/MngView.res delete mode 100644 Engine/lib/lmng/bcb/mngview/README.TXT delete mode 100644 Engine/lib/lmng/bcb/win32dll/libmng.bpr delete mode 100644 Engine/lib/lmng/bcb/win32dll/libmng.cpp delete mode 100644 Engine/lib/lmng/bcb/win32dll/libmng.dll delete mode 100644 Engine/lib/lmng/contrib/README delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/About.cpp delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/About.h delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.CPP delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.H delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/Help.h delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.RES delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/Main.dfm delete mode 100644 Engine/lib/lmng/contrib/bcb/mngdump/Main.h delete mode 100644 Engine/lib/lmng/contrib/delphi/libmng.pas delete mode 100644 Engine/lib/lmng/contrib/delphi/mngview/Main.dfm delete mode 100644 Engine/lib/lmng/contrib/delphi/mngview/Main.pas delete mode 100644 Engine/lib/lmng/contrib/delphi/mngview/mngview.dpr delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/ChangeLog delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/Makefile delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/README delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/console.c delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/console.h delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.c delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.h delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/messages.c delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/messages.h delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c delete mode 100644 Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/COPYING delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/Makefile delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/README delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/README.compile delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/dummy.c delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.c delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.h delete mode 100644 Engine/lib/lmng/contrib/gcc/gtk-mng-view/linux.mng delete mode 100644 Engine/lib/lmng/contrib/gcc/mngtree/makefile.linux delete mode 100644 Engine/lib/lmng/contrib/gcc/mngtree/mngtree.c delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/.deps/mngplay.P delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/COPYING delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/ChangeLog delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/INSTALL delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.am delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.in delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/README delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/acinclude.m4 delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/aclocal.m4 delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.notes delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.sh delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure.in delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/depcomp delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/install-sh delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/missing delete mode 100644 Engine/lib/lmng/contrib/gcc/sdl-mngplay/mngplay.c delete mode 100644 Engine/lib/lmng/contrib/gcc/xmngview/Makefile delete mode 100644 Engine/lib/lmng/contrib/gcc/xmngview/README delete mode 100644 Engine/lib/lmng/contrib/gcc/xmngview/color.c delete mode 100644 Engine/lib/lmng/contrib/gcc/xmngview/xmng.h delete mode 100644 Engine/lib/lmng/contrib/gcc/xmngview/xmngview.c delete mode 100644 Engine/lib/lmng/contrib/kylix/libmng.pas delete mode 100644 Engine/lib/lmng/contrib/kylix/mngview/Main.dfm delete mode 100644 Engine/lib/lmng/contrib/kylix/mngview/Main.pas delete mode 100644 Engine/lib/lmng/contrib/kylix/mngview/mngview delete mode 100644 Engine/lib/lmng/contrib/kylix/mngview/mngview.conf delete mode 100644 Engine/lib/lmng/contrib/kylix/mngview/mngview.dpr delete mode 100644 Engine/lib/lmng/contrib/kylix/mngview/mngview.kof delete mode 100644 Engine/lib/lmng/contrib/kylix/mngview/mngview.res delete mode 100644 Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/README.txt delete mode 100644 Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.def delete mode 100644 Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.lib delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/Makefile delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/README delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/filelist.c delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.c delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.h delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt1.c delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/makemng.c delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/makemng.dsp delete mode 100644 Engine/lib/lmng/contrib/msvc/makemng/makemng.dsw delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/COPYING-LCMS delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ie.cur delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ns.cur delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/license.txt delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npapidefs.h delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.c delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.def delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/resource.h delete mode 100644 Engine/lib/lmng/contrib/msvc/mngplg/readme.txt delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsp delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsw delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/MNGView.opt delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/MNGView.plg delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/Main.cpp delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/Main.h delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/Main.rc delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/Mng.ico delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/mng.cpp delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/resource.h delete mode 100644 Engine/lib/lmng/contrib/msvc/mngview/sRGB.icm delete mode 100644 Engine/lib/lmng/contrib/msvc/win32dll/README.txt delete mode 100644 Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsp delete mode 100644 Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsw delete mode 100644 Engine/lib/lmng/doc/Plan1.png delete mode 100644 Engine/lib/lmng/doc/Plan2.png delete mode 100644 Engine/lib/lmng/doc/doc.readme delete mode 100644 Engine/lib/lmng/doc/libmng.txt delete mode 100644 Engine/lib/lmng/doc/man/jng.5 delete mode 100644 Engine/lib/lmng/doc/man/libmng.3 delete mode 100644 Engine/lib/lmng/doc/man/mng.5 delete mode 100644 Engine/lib/lmng/doc/misc/magic.dif delete mode 100644 Engine/lib/lmng/doc/rpm/libmng-1.0.10-rhconf.patch delete mode 100644 Engine/lib/lmng/doc/rpm/libmng.spec delete mode 100644 Engine/lib/lmng/libmng.h delete mode 100644 Engine/lib/lmng/libmng_callback_xs.c delete mode 100644 Engine/lib/lmng/libmng_chunk_descr.c delete mode 100644 Engine/lib/lmng/libmng_chunk_descr.h delete mode 100644 Engine/lib/lmng/libmng_chunk_io.c delete mode 100644 Engine/lib/lmng/libmng_chunk_io.h delete mode 100644 Engine/lib/lmng/libmng_chunk_prc.c delete mode 100644 Engine/lib/lmng/libmng_chunk_prc.h delete mode 100644 Engine/lib/lmng/libmng_chunk_xs.c delete mode 100644 Engine/lib/lmng/libmng_chunks.h delete mode 100644 Engine/lib/lmng/libmng_cms.c delete mode 100644 Engine/lib/lmng/libmng_cms.h delete mode 100644 Engine/lib/lmng/libmng_conf.h delete mode 100644 Engine/lib/lmng/libmng_data.h delete mode 100644 Engine/lib/lmng/libmng_display.c delete mode 100644 Engine/lib/lmng/libmng_display.h delete mode 100644 Engine/lib/lmng/libmng_dither.c delete mode 100644 Engine/lib/lmng/libmng_dither.h delete mode 100644 Engine/lib/lmng/libmng_error.c delete mode 100644 Engine/lib/lmng/libmng_error.h delete mode 100644 Engine/lib/lmng/libmng_filter.c delete mode 100644 Engine/lib/lmng/libmng_filter.h delete mode 100644 Engine/lib/lmng/libmng_hlapi.c delete mode 100644 Engine/lib/lmng/libmng_jpeg.c delete mode 100644 Engine/lib/lmng/libmng_jpeg.h delete mode 100644 Engine/lib/lmng/libmng_memory.h delete mode 100644 Engine/lib/lmng/libmng_object_prc.c delete mode 100644 Engine/lib/lmng/libmng_object_prc.h delete mode 100644 Engine/lib/lmng/libmng_objects.h delete mode 100644 Engine/lib/lmng/libmng_pixels.c delete mode 100644 Engine/lib/lmng/libmng_pixels.h delete mode 100644 Engine/lib/lmng/libmng_prop_xs.c delete mode 100644 Engine/lib/lmng/libmng_read.c delete mode 100644 Engine/lib/lmng/libmng_read.h delete mode 100644 Engine/lib/lmng/libmng_trace.c delete mode 100644 Engine/lib/lmng/libmng_trace.h delete mode 100644 Engine/lib/lmng/libmng_types.h delete mode 100644 Engine/lib/lmng/libmng_write.c delete mode 100644 Engine/lib/lmng/libmng_write.h delete mode 100644 Engine/lib/lmng/libmng_zlib.c delete mode 100644 Engine/lib/lmng/libmng_zlib.h delete mode 100644 Engine/lib/lmng/makefiles/Makefile.am delete mode 100644 Engine/lib/lmng/makefiles/README delete mode 100644 Engine/lib/lmng/makefiles/configure.in delete mode 100644 Engine/lib/lmng/makefiles/makefile.bcb3 delete mode 100644 Engine/lib/lmng/makefiles/makefile.dj delete mode 100644 Engine/lib/lmng/makefiles/makefile.linux delete mode 100644 Engine/lib/lmng/makefiles/makefile.mingw delete mode 100644 Engine/lib/lmng/makefiles/makefile.mingwdll delete mode 100644 Engine/lib/lmng/makefiles/makefile.qnx delete mode 100644 Engine/lib/lmng/makefiles/makefile.unix delete mode 100644 Engine/lib/lmng/makefiles/makefile.vcwin32 delete mode 100644 Engine/lib/lmng/special/mozcfg/mozlibmngconf.h delete mode 100644 Engine/lib/lmng/unmaintained/autogen.sh delete mode 100644 Engine/lib/lungif/dgif_lib.c delete mode 100644 Engine/lib/lungif/gif_err.c delete mode 100644 Engine/lib/lungif/gif_lib.h delete mode 100644 Engine/lib/lungif/gif_lib_private.h delete mode 100644 Engine/lib/lungif/gifalloc.c delete mode 100644 Tools/CMake/libraries/lmng.cmake delete mode 100644 Tools/CMake/libraries/lungif.cmake diff --git a/Engine/lib/lmng/CHANGES b/Engine/lib/lmng/CHANGES deleted file mode 100644 index eeacf3324..000000000 --- a/Engine/lib/lmng/CHANGES +++ /dev/null @@ -1,1447 +0,0 @@ ------------------------------------------------------------ - -1.0.10 (Jul 13th 2007) ----------------------- - -in short: - -intermediate CVS - -------------------- - -bugfixes: - -core: -- fixed some compiler-warnings -- fixed display routines called twice for FULL_MNG support in mozlibmngconf.h -- standard windows dll upgraded to zlib 1.2.3 -- fixed problem with CLON object during readdisplay() (thanks Winfried!) -- added typecast to appease the compiler (G R-P) -- added more SKIPCHUNK conditionals (G R-P) -- added MORE MNG_NO_1_2_4BIT_SUPPORT (G R-P) -- added provisional support for anIM(mpNG) proposal -- added provisional support for ANG proposal - -samples: -- xmngview upgraded to 0.6 (thanks Winfried!) - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.9 (jan 30th 2005) ---------------------- - -in short: - -New optimizations save over 20KB on footprint. -Also a few bugfixes and several patches. - -Thanks to those sending in their additions and for testing! - -To turn on the optimizations do: - -#DEFINE MNG_OPTIMIZE_CHUNKINITFREE -#DEFINE MNG_OPTIMIZE_OBJCLEANUP -#DEFINE MNG_OPTIMIZE_CHUNKASSIGN -#DEFINE MNG_OPTIMIZE_CHUNKREADER - -(eg. they're not on by default (yet) !) - -------------------- - -bugfixes: -- fixed chunk pushing mechanism -- fixed bug in writing sBIT for indexed color -- fixed PPLT getchunk/putchunk routines -- fixed MNG_NO_1_2_4BIT_SUPPORT for TBBN1G04.PNG -- cleaned up macro-invocations (thanks to D. Airlie) - -core: -- added more SKIPCHUNK conditionals -- replaced MNG_TWEAK_LARGE_FILES with permanent solution -- improved handling of cheap transparency when 16-bit support is disabled -- added some MNG_SUPPORT_WRITE conditionals -- added function to retrieve current FRAM delay -- added MNG_NO_1_2_4BIT_SUPPORT -- added bgr565_a8 canvas-style (thanks to J. Elvander) -- standard windows dll upgraded to zlib 1.2.2 -- added LITTLEENDIAN/BIGENDIAN fixtures (thanks J.Stiles) -- inclusion of zlib/lcms/ijgsrc6b with <> instead of "" -- added conditional MNG_OPTIMIZE_CHUNKINITFREE -- added conditional MNG_OPTIMIZE_OBJCLEANUP -- added conditional MNG_OPTIMIZE_CHUNKASSIGN -- added conditional MNG_OPTIMIZE_CHUNKREADER -- fixed problem with global PLTE/tRNS - -samples: - -contrib: - -doc: -- patched jng & mng manual pages (Thanks Peter Breitenlohner) - -makefiles: - -autoconf: -- patched makefile.am & configure.in (Thanks Peter Breitenlohner) - ------------------------------------------------------------ - -1.0.8 (aug 5th 2004) --------------------- - -in short: - -added special data-pushing mechanisms and a few other tid-bits - -------------------- - -bugfixes: -- fixed problem with PAST usage where source > dest - -core: -- added missing get-/put-chunk-jdaa -- added CRC existence & checking flags -- added data-push mechanisms for specialized decoders -- some speed optimizations (thanks to John Stiles) -- defend against using undefined closestream function -- defend against using undefined openstream function -- added check for extreme chunk-lengths -- change worst-case iAlphadepth to 1 for standalone PNGs -- added support for 3+byte pixelsize for JPEG's -- added conditional to allow easier writing of large MNG's - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.7 (March 21st 2004) ------------------------ - -in short: - -A bunch of new canvas-styles, some bug-fixes, upgraded to latest zlib/lcms -and yet more work to please the Mozilla crowd. -Releasing beta's doesn't seem very responsive, and this one's hardly changed -much anyway. I just wanted to bump to a regular version for Mozilla -re-integration. - -------------------- - -bugfixes: -- fixed inclusion of IJNG chunk for non-JNG use (J.S) -- fixed bug in chunk-storage of SHOW chunk (where from == to) -- fixed bug in promote_g8_g8 with 16bit support off - -core: -- added CANVAS_RGB565 and CANVAS_BGR565 (big thanx to Raphael Assenat!!) -- added CANVAS_RGBA565 and CANVAS_BGRA565 ( -- ditto -- ) -- upgraded to zlib 1.2.1 -- upgraded to lcms 1.11 -- added premultiplied alpha canvas' for RGBA, ARGB, ABGR (thx to John Stiles) -- more optimizations with 16bit support off -- put conditionals around openstream/closestream callbacks. -- fixed typo (MNG_SKIPCHUNK_SAVE -> MNG_SKIPCHUNK_nEED) -- fixed some 64-bit platform compiler warnings - -samples: - -contrib: -- fixed mngtree sample (Raphael) -- added 5-6-5 canvas to SDL sample (Raphael) - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.6 (oct 19th 2003) ---------------------- - -in short: - -Final release from beta1. No feedback is good feedback I presume, -so here's 1.0.6-final! - - -------------------- - -bugfixes: - -core: - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.6-beta1 (sep 14th 2003) ---------------------------- - -in short: - -further footprint-reductions -removing email-addresses - -1.0.6 (final) will be out shortly - -------------------- - -bugfixes: - -core: -- added support for reducing the footprint of libmng by macros that optionally - skip unused chunks, remove 16-bit sample support, remove Delta support, and - remove JNG support, to accomodate Mozilla/Firebird. -- further optional removal of unused functions -- added MNG_NO_SUPPORT_FUNCQUERY conditional -- added iPNGdepth member to pData structure -- added conditionals around MAGN chunk support -- added conditionals around non-VLC chunk support -- added conditionals around "mng_display_go*" and other unused functions -- added more conditionals around "promote" functions -- removed email references as appropriate - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.6-alpha1 (aug 2nd 2003) ---------------------------- - -in short: - -This is mostly in the light of footprint-reduction to please the Mozilla -crew with a leaner and meaner libmng. See bug 18574 if you're interested: -http://bugzilla.mozilla.org/show_bug.cgi?id=18574 - -------------------- - -bugfixes: -- B719420 - fixed several MNG_APP_CMS problems - -core: -- removed some compiler-warnings -- hiding 12-bit JPEG stuff -- fixed problem with infinite loops during readdisplay() -- added size-optimiation COMPOSE routine usage -- added conditionals around canvas update routines -- added MNG_SKIPCHUNK_cHNK footprint optimizations -- added conditionals around some JNG-supporting code -- added conditionals around 16-bit supporting code -- combined init functions into one function -- replaced nested switches with simple init setup function -- added conditionals zlib and jpeg property accessors -- added size-optimization DIV255B8 routine usage -- added conditionals around 8-bit magn routines -- removed conditionals around 8-bit magn routines -- added MNG_NO_16BIT_SUPPORT and MNG_NO_DELTA_PNG conditionals -- reversed many loops to use decrementing counter -- converted some switches to array references -- removed some redundant checks for iRawlen==0 -- optionally use zlib's crc32 function instead of local mng_update_crc -- bugfix empty "if" statement when 16-bit code is enabled -- restored two misplaced #else/#endif blocks -- added conditionals around "mng_display_go*" and other unused functions -- added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional -- fixed duplicate for-loop -- fixed invalid test in promote_imageobject -- added conditionals around PAST chunk support -- fixed "FOOTPRINT_COMPOSEIV" typo (now "FOOTPRINT_DIV") - -samples: - -contrib: -- updated xmngview -- added MSVC project for creating delta-MNGs: makemng (thanks Alex!) -- added MSVC lib-file for use with the standard libmng.dll (again thanks Alex) - -doc: -- updated readme.contrib - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5 (mar 1st 2003) --------------------- - -in short: - -Only a small fix for progressive jpeg suspension problem. - -This is the long-awaited final release containing the new 'dynamic MNG' feature -and bringing MNG compliance to near 100%! - -------------------- - -bugfixes: -- B683152 - libjpeg suspension not always honored correctly - -core: - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-rc3 (jan 20th 2003) -------------------------- - -in short: - -Third release-candidate for the upcoming 1.0.5 version. - -Minor bug-fixes and finalizing the accepted proposal (by official vote) for -the TERM/frame_delay changes on mng-list (nov-dec/2002). - -------------------- - -bugfixes: -- B654627 - fixed SEGV when no gettickcount callback (thanks Adam!) -- B664383 - fixed typo (thanks Dimitri) -- B664911 - fixed buffer overflow during init (thanks Alex!) - -core: -- finalized changes in TERM/final_delay to elected proposal (positive vote) - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-rc2 (dec 9th 2002) ------------------------- - -in short: - -Second release-candidate for the upcoming 1.0.5 version. -This contains fixes for a few minor details reported by the loyal testers. -It fixes some issues with the goframe/golayer/gotime processing and related -stuff. And it adds a way to disable playback-caching from within the MNG, -which is very useful for streaming-MNG encoders (such as gserver!). - -------------------- - -bugfixes: - -core: -- fixed layer- & frame-counting during read() -- changed FRAMECOUNT/LAYERCOUNT/PLAYTIME error to warning -- fixed goframe/golayer/gotime processing -- added support for nEED "MNG 1.1" -- added support for nEED "CACHEOFF"; turn playback caching off for streaming MNG -- fixed magnification bug with object 0 -- added support to get totals for frames/layers/playtime after mng_read() -- fixed some issues in init_app_cms() -- fixed goxxxxx() support for zero values - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-rc1 (nov 1st 2002) ------------------------- - -in short: - -First release-candidate for the upcoming 1.0.5 version. -This fixes a few small problems and brings the TERM/MEND processing, with -respect to interframe_delay as per the current discussion on MNG-list, -up-to-date with the latest proposal. - -------------------- - -bugfixes: - -core: -- fixed initialization of pIds in dISC read routine (Thanks Winfried!) -- fixed issue in freeing evNT chunk (Thanks Winfried!) -- fixed clipping-problem with BACK tiling (Thanks Sakura!) -- fixed processing for multiple objects in MAGN (Thanks Sakura!) -- fixed display of visible target of PAST operation (Thanks Sakura!) -- modified TERM/MEND processing for max(1, TERM_delay, interframe_delay) - -samples: - -contrib: -- fixed typo in Makefile for gtk-mng-view sample - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-b3 (oct 15th 2002) ------------------------- - -in short: - -Fairly quick after beta2, since that introduced a couple of unfortunate -booboo's and wasn't very workable. It also changes the standard configure -script to build a standard shared object similar to what I intended. - -------------------- - -bugfixes: - -core: -- fixed support for condition=2 in TERM chunk -- fixed trace-constants for PAST chunk -- added mng_status_dynamic to supports function - -samples: - -contrib: - -doc: -- small cosmetic changes in man/libmng.3 - -makefiles: - -autoconf: -- fixed configure.in to build a 'standard' SO primarily - ------------------------------------------------------------ - -1.0.5-b2 (oct 9th 2002) ------------------------- - -in short: - -Second beta for next 1.0.5 release. This addresses some minor problems -detected during testing. It adds the proposed change to the MNG spec as -discussed on the "mng-list" recently; eg. Adam's option 4. -And it adds a little function to check at run-time if the lib is a beta or not. - -------------------- - -bugfixes: - -core: -- fixed chunk-storage for evNT chunk -- fixed dropping mix of frozen/unfrozen objects -- fixed problem with cloned objects marked as invalid -- fixed problem cloning frozen object_buffers -- fixed DISC support -- added proposed change in handling of TERM- & interframe-delay -- added another fix for misplaced TERM chunk -- added check for TERM placement during create/write -- completed support for condition=2 in TERM chunk -- added beta version function & constant - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.5-b1 (sep 24th 2002) ------------------------- - -in short: - -First beta of a large maintenance release. This completes support of the MNG -specification to nearly 100% (PAST, PROM, delta-images, BACK image+tile). -It adds "dynamic" MNG and a few other neat routines as well as fixes several -bugs reported through SourceForge or to me directly. - -------------------- - -bugfixes: -- B575832 - library has wrong patch version number -- B578572 - remove in 1.0.0! -- B578940 - some functions not implemented -- B581625 - large chunks fail with suspension reads -- B597134 - libmng pollutes the linker namespace - -core: -- added sanity check for improbable chunklengths -- removed eMNGma hack (thanks Dimitri!) -- unimplemented functions return an errorcode now -- added test-option for PNG filter method 192 (= levelling) -- added test-option for PNG filter method 193 (= no filtering) - (both are conditional and only for testing purposes!!!) -- completed PROM support -- completed delta-image support -- completed MAGN support (16-bit functions) -- added HLAPI function to copy a chunk from a read MNG to a newly created MNG -- added option for soft-handling of errors (only for repair software!!!) -- fixed some routine inclusion/exclusion for undefined conditionals -- pre-fixed all internal routines with mng_ -- added symbol MNG_LOCAL (= static) to really local functions -- fixed reading of FRAM with just frame_mode and name -- fixed read/write of MAGN chunk -- added event handling for dynamic MNG -- added 'supports' call to check function availability -- fixed copyright notice in the headers of all libmng modules -- fixed LOOP iteration=0 special case -- re-compiled standard Windows dll with lcms-1.0.9 -- added warning for too much IDAT data -- warnings are ignored by default now -- misplaced TERM is now treated as warning -- fixed color-correction for restore-background handling -- optimized restore-background for bKGD cases -- cleaned up some old stuff -- completed support for BACK image & tiling -- completed support for PAST -- added bgrx8 canvas (filler byte) -- fixed reset_object_detail to clear old buffer -- added in-memory color-correction of abstract images -- added compose over/under routines for PAST processing -- added flip & tile routines for PAST processing - -samples: -- Added new BCB sample for fixing invalid JASC Animation Shop files - (shows new copy_chunks function; use of MNG_SOFTERRORS & static linking) - -contrib: -- added xmngview by Winfried Szukalski (Vielen dank!) -- Updated the Delphi mngview sample to handle dynamic MNGs -- Added Kylix example (simplified port of the Delphi mngview sample) - -doc: -- added diff to add MNG&JNG to a systems 'magic' file (Thanks Winfried) -- fixed docs about using mng_display_resume after display_reset - (should read to use mng_display!) - -makefiles: -- added makefile to build a libmng.dll for MingW - (makefile.mingwdll - thanks to Frank Richter!) - -autoconf: -- fixing libtool version-number to be in line with what it should be - ------------------------------------------------------------ - -1.0.4 (Jun 23rd 2002) ---------------------- - -in short: - -Just some small fixes -Standard dll now compiled with zlib 1.1.4 and lcms 1.0.8 - -------------------- - -bugfixes: -- B495442 - invalid returnvalue in mng_get_suspensionmode -- B495443 - incorrect suspend check in read_databuffer -- B526138 - returned IJGSRC6B calling convention to default for MSVC -- B558212 - off by one error -- B557677 - can't find lcms.h - -core: -- fixed possible compile-problem in cleanup_rowproc -- MNG subimage alpha composite wrong for rgba8 images - -samples: - -contrib: - -doc: - -makefiles: -- fixed check for lcms.h in configure.in - -autoconf: - ------------------------------------------------------------ - -1.0.3 (Sep 18th 2001) ---------------------- - -in short: - -Small cosmetic changes. Cleaning up the contributions. -New makefile for mingw32, and new fbcon example. -Major thanks to Greg for helping out with the *nix stuff! -Note that there's also a separate download for ASM programmers now. -Check http://www.libmng.com for details (download/ports&packages page). - -It may be a while for the next release. I'm "off duty" for the next 8 or -so months... - -Gerard - -------------------- - -bugfixes: -- B459058 - wrong include for lcms headers - -core: -- changed inclusion of lcms.h header for Linux platforms (suggested by Greg) -- added get function for last processed BACK chunk - -samples: -- replaced the gtk & sdl viewer apps with updates by Greg Roelofs - -contrib: - -doc: - -makefiles: -- changed makefile.linux & makefile.unix as suggested by Greg Roelofs - (makefile.linux now compiles with lcms by default) -- added makefile.mingw for mingw32 by Benoit Blanchon (thanks Mate!) - -autoconf: - ------------------------------------------------------------ - -1.0.2 (Jul 7th 2001) --------------------- - -in short: - -Another maintenance release with a few added extra's. - -------------------- - -bugfixes: -- B421427 - writes wrong format in bKGD and tRNS -- B434583 - compiler-warning if MNG_STORE_CHUNKS undefined - -core: -- added optimization option for MNG-video playback -- added processterm callback -- added late binding errorcode (not used internally) -- fixed memory-leak with delta-images (Thanks Michael!) -- added option to turn off progressive refresh for large images - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.1 (May 2nd 2001) --------------------- - -in short: - -Maintenance release. -Fixed several memory-leaks with the help of Gregg Kelly, added/fixed some CMS -handling, exported JPEG functions from standard DLL, and some other minor fixes. - -The CMS fix now makes libmng automagically work in MNG_FULL_CMS mode as a -sRGB compliant system. YOU WILL NEED TO CHANGE THIS IF YOU ARE NOT ON AN sRGB -COMPLIANT SYSTEM AND WANT TO USE CMS!!!! -(look in libmng.h for the proper function-calls) - -------------------- - -bugfixes: - -core: -- added MEND processing callback -- fixed first FRAM_MODE=4 timing problem -- added handle status-copy function (use with care) -- exported JPEG functions from standard DLL -- added BGRA8 canvas with premultiplied alpha (contrib by Gregg Kelly) -- fixed problem with display_reset/display_resume (Thanks Gregg!) -- fixed several memory-leaks (Thanks Gregg!) -- fixed reset_rundata to drop all objects (Thanks again, Gregg!) -- fixed problem with cms profile being created multiple times when both - iCCP & cHRM/gAMA are present (And again... Gregg) -- moved mng_clear_cms to libmng_cms -- added "default" sRGB generation (Thanks Marti!) - -samples: - -contrib: - -doc: - -makefiles: - -autoconf: - ------------------------------------------------------------ - -1.0.0 (Feb 6th 2001) --------------------- - -in short: - -First public release. Finally(!) - -This is the 0.9.5 CVS version, which will never be released, because I feel it -is now ready for a public release. So apart from the version-numbers here and -there, all other changes are listed under 0.9.5. - -This library will work with every MNG/JNG known and available to me. Note that -there are still parts that need to be coded, and that MNG support is around -90-95% (JNG at 100%). It is however compliant with the latest and greatest -MNG 1.0 specification. - -I hope to dedicate a bit more time this year to finish up full support and fill -in the remaining blanks. But this is coming out of my spare time. And extra -help is always appreciated. - -Please enjoy! - -Gerard - ------------------------------------------------------------ - -0.9.5 (no release) ------------------- - -in short: - -intermediate CVS - -------------------- - -bugfixes: -B129681 - fixed compiler warnings SGI/Irix (thanks Dimitri) - -core: -- fixed compiler-warnings Mozilla (thanks Tim) -- fixed timing-problem with switching framing_modes -- fixed some small compiler warnings (thanks Nikki) - -samples: - -contrib: -- fixed library-paths for MSVC DLL project (thanks Chad) - -doc: - -makefiles: -- added makefile for DJGPP (thanks Silvio) - -autoconf: - ------------------------------------------------------------ - -0.9.4 (Jan 19th 2001) ----------------------- - -in short: - -Now that the MNG spec is at 1.0, this should be the last beta. There's a few -small changes to make it inline with the spec, and a couple of bug-fixes. -This is a serious release-candidate for libmng-1.0!! -Please... test test test test!! - -------------------- - -bugfixes: -B123314 - fixed number of TERM related problems -B123322 - fixed unwanted repetition in mng_readdisplay() -B123443 - fixed by Ralph -B124910 - fixed definition for WIN32_LEAN_AND_MEAN (thanks Chad) -B125750 - fixed by Ralph -B125756 - fixed mixup of data- & function-pointers (thanks Dimitri) -B127517 - changed inclusion of the lcms header file for non-windows platforms - -core: -- version numbers -- fixed possible loop in display_resume() (Thanks Vova!) -- fixed unwanted repetition in mng_readdisplay() -- changed inclusion of the lcms header file for non-windows platforms -- changed IHDR filter_method check for PNGs -- moved restore of object 0 to libmng_display -- added restore of object 0 to TERM processing (B123314) -- fixed TERM delay processing (B123314) -- fixed TERM end processing when count = 0 (B123314) -- changed callback convention for MSVC (Thanks Chad) -- fixed mixup of data- & function-pointers (thanks Dimitri) -- added support for "nEED MNG-1.0" -- added errorcode for MAGN methods -- added errorchecking for MAGN methods -- removed "old" MAGN methods 3 & 4 -- added "new" MAGN methods 3, 4 & 5 -- removed test filter-methods 1 & 65 -- set default level-set for filtertype=64 to all zeroes - -samples: - -contrib: -- added GTK mng-view example by Vova Babin -- added MSVC MNGview sample by Nikolaus Brennig -- updated Jason Summer's mngplg to version 0.9.2 - (that's mngplg-0.9.2 based on libmng-0.9.3 !!!) -- rearranged contrib directory slightly -- added MSVC project to build libmng.dll by Chad Austin - -doc: -- added README.dll -- added README.config - -makefiles: -- added a makefile for MS Visual C++ (Thanks to Atsushi Matsuda) - -autoconf: -- fixed configure.in for lcms (FreeBSD port by Mikhail Teterin) -- by default configure includes CMS support if lcms is present - ------------------------------------------------------------ - -0.9.3 (October 29th 2000) -------------------------- - -in short: - -Another beta release. The number of changes in the MNG specification have -resulted in a lot of new code and some changed code. At the same time I saw -no need to withhold some new functionality as it was pretty clear there was -going to be another beta-round. If things go well, I'm going to try to release -libmng 1.0.0 very shortly after this one. - -Many thanks to a lot of people for helping out, sending contributions, making -suggestions and testing this little baby. This would get nowhere without YOU!!! - -- fixed bug 111300/117103 -- added workaround for faulty PhotoShop iCCP chunk -- added MAGN/JDAA chunks -- added support for new filter_types -- added PNG/MNG spec version indicators -- added BCB mngview contribution by Andy Protano -- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano) -- implemented support for nEED "draft nn" -- implemented app-defined support for bKGD for PNG images -- removed trace-options from default SO/DLL builds (!!!) -- raised initial maximum canvas size to 10000x10000 (!!!) - (an App that wants to protect from overly large images should call - mng_set_maxcanvassize() with appropriate values) -- fixed other assorted stuff - -------------------- - -bugfixes: -B111300 - fixup for improved portability -B117103 - fixed compilation errors on *nix with lcms (thanks Ralph!) - -core: -- fixed compiler-warnings from Mozilla -- added check for simplicity-bits in MHDR -- added workaround for faulty PhotoShop iCCP chunk -- fixed app-supplied background restore -- fixed TERM processing delay of 0 msecs -- fixed write-code for zTXt & iTXt -- fixed read-code for iTXt -- added MAGN chunk -- fixed sRGB precedence for gamma_only corection -- added support for new filter_types -- fixed problem with no refresh after TERM -- fixed DEFI behavior -- fixed inclusion parameters to make the external libs work together -- added export of zlib functions from windows dll -- fixed timing & refresh behavior for single PNG/JNG -- removed trace-options from default SO/DLL builds (!!!) -- fixed MAGN rounding errors (thanks Matthias!) -- fixed small timing problem when FRAM delay = 0 -- fixed simplicity-check in compliance with draft 81/0.98a -- fixed alpha-blending for all alpha-canvasstyles -- added support for alpha-depth prediction -- fixed processing of unknown critical chunks -- removed test-MaGN -- added PNG/MNG spec version indicators -- implemented support for nEED -- added support for JDAA -- added functions to retrieve PNG/JNG specific header-info -- added optional support for bKGD for PNG images -- raised initial maximum canvas size to 10000x10000 -- added support for delta-JNG -- added callback to process non-critical unknown chunks -- fixed support for delta-images during read() / display() -- added closestream() processing for mng_cleanup() -- fixed delta-processing behavior -- added storage for pixel-/alpha-sampledepth for delta's -- implemented delayed delta-processing -- fixed putchunk_plte() to set bEmpty parameter (thanks Ben!) -- added errorcode for delayed delta-processing -- added get/set for bKGD preference setting -- added get function for interlace/progressive display -- fixed bug in empty PLTE handling -- fixed seperate read() & display() processing -- fixed tRNS processing for gray-image < 8-bits - -samples: -- added BCB mngview contribution by Andy Protano - -contrib: -- added BCB mngdump; a GUI-based MNG dumping utility (Andy Protano) - -doc: -- updated RPM spec-file by MATSUURA Takanori -- updated README.contrib - -makefiles: -- fixed some stuff in automake/autoconf/libtool -- fixed auto* for bug B117103 - ------------------------------------------------------------ - -0.9.2 (August 7th 2000) ------------------------ - -in short: - -Third beta release! Last one??? - -!!IMPORTANT!! All file-names are now prefixed with "libmng_" !!IMPORTANT!! - -Many thanks to Albert Chin-A-Young for his contribution of the -autoconf/automake/libtool stuff and to Ralph Giles for helping me -put it in the right places. - -There's a special README.autoconf so please read it! - -- fixed bug 110320/110546/110547/111096 -- added several status retrieval functions -- fixed other small bugs in display processing -- fixed number of small problems and documentation typos -- added autoconf/automake/libtool -- added latest MNG plugin (0.9.0) by Jason Summers - -------------------- - -bugfixes: -B110320 - fixed GCC warning about mix-sized pointer math -B110546 - fixed for improperly returning UNEXPECTEDEOF -B110547 - fixed bug in interlace code -B111096 - fixed large-buffer read-suspension - -core: -- version numbers -- fixed small bugs in display processing -- removed Nextbackxxx fields (no longer used) -- fixed problem with trace-functions improperly wrapped -- put specific code in add_chunk() inside MNG_SUPPORT_WRITE wrapper -- fixed documentation typos -- fixed wrapping of suspension parameters -- added status_xxxx functions -- added trace-codes/-strings for status_xxxxx functions -- changed file-prefixes -- added function to set simplicity field -- added trace-code/-string for updatemngsimplicity -- fixed putchunk_unknown() function - -samples: - -contrib: -- added latest MNG plugin (0.9.0) by Jason Summers - -doc: -- version numbers -- added autoconf readme -- version numbers in RPM stuff - -makefiles: -- fixed for new file-prefix -- added autoconf/automake/libtool - ------------------------------------------------------------ - -0.9.1 (July 26th 2000) ----------------------- - -in short: - -Second beta release. - -Given the enormous amount of bug-reports (not ;-), this will most likely -be one of the last betas. If things remain upright, the first public release -(1.0.0) is fairly eminent in the weeks to come... - -- added SDL mng player by Ralph Giles to contributions -- fixed timing and added internal buffering for I/O-suspension scenarios -- added get routines for internal display-state variables (frame/layer/playtime) -- changed read-processing for improved I/O-suspension (internal buffering) -- fixed several problems with create- & write-support -- added a load of documentation -- lots of small stuff - -------------------- - -bugfixes: - -core: -- fixed mandatory BACK color to be opaque -- changed mng_display_resume to allow to be called after a suspension - return with MNG_NEEDMOREDATA -- changed comments to indicate modified behavior for timer & suspension breaks -- added variables for go_xxxx processing -- implemented support for freeze/reset/resume & go_xxxx -- added trace-codes/-strings for special display processing -- added variables for improved timing support -- added support for improved timing -- added get routines for internal display variables -- added get/set routines for suspensionmode variable -- added trace-code/-string for get/set suspensionmode -- added trace-codes/-strings for get/set display variables -- added support for improved I/O-suspension -- changed read-processing for improved I/O-suspension -- added trace-code/-string for read_databuffer (I/O-suspension) -- added suspendbuffer constants -- changed EOF processing behavior -- fixed TERM delay processing -- changed pre-draft48 frame_mode=3 to frame_mode=1 -- added callbacks for SAVE/SEEK processing -- added trace-codes/-strings for SAVE/SEEK callbacks -- added variable for NEEDSECTIONWAIT breaks -- added trace-codes/-strings for get/set sectionbreaks -- added NEEDSECTIONWAIT error-code/-string -- added macro + routine to set returncode without calling error callback -- added trace-code/-string for special error routine -- changed default readbuffer size from 1024 to 4200 -- added variable for freeze & reset processing -- fixed storage of images during mng_read() -- fixed support for mng_display() after mng_read() -- added error cleanup processing -- fixed support for mng_display_reset() -- fixed suspension-buffering for 32K+ chunks -- added function to set frame-/layer-count & playtime -- added trace-code/-string for updatemngheader -- added error-code/-string for updatemngheader if not a MNG -- fixed creation-code -- fixed writing of signature -- fixed several chunk-writing routines - -samples: -- fixed the libmng.pas module in line with libmng.h - -contrib: -- added the SDL based mngplay viewer by Ralph Giles - -doc: -- extended the RPM contribution by MATSUURA Takanori -- added libmng.txt, a full description of the library and its usage -- added man-pages for mng(5), jng(5) and libmng(3) - -makefiles: - ------------------------------------------------------------ - -0.9.0 (June 30th 2000) ----------------------- - -in short: - -This is the first beta!!! Yippee!!! - -Thanks to all the people who helped to guide me in the right direction. -You know who you are! - -A special thanks to the guys with early implementations, who stood by and -put up with my whims :-) - -changes over 0.5.3: - -- updated mngplg to 0.4.1 (the latest & greatest) -- changed refresh parameters to 'x,y,width,height' - ------------------------------------------------------------ - -0.5.3 (never released) ----------------------- - -in short: - -This is a working version only; the next release will be 0.9.0 (first Beta!) - -There are a few incompatible changes with previous versions. The userdata -variable has been changed from mng_uint32 to mng_ptr to accomodate 64-bit -systems. For the same reason memory allocation size parameters have been -changed to a mng_size_t type which is a typedef of size_t. - -Thanks to Aleks Jakulin for helping to iron out some 64-bit platform issues! - -- implemented the update-region parameters of the refresh callback -- added support for most common delta-image options -- added an animation-speed modifier -- added an image-level parameter for the processtext callback -- updated mngplg to 0.4.0 (supports JNG, full CMS, and other enhancements!) -- fixed a lot of small things -- added support for PPLT chunk -- fixed to support 64-bit platforms - -------------------- - -bugfixes: - -core: -- added processing of color-info on delta-image -- fixed handling of empty SAVE chunk -- fixed display of stored JNG images -- fixed problem with BASI-IEND as object 0 -- changed the version parameters (obviously) -- added update-region parms for refresh calback -- added Needrefresh parameter -- added initialization of update-region for refresh -- added initialization of Needrefresh parameter -- changed progressive-display processing -- added tracecodes for tracing JPEG progression -- added tracing of JPEG calls -- added Deltaimmediate parm for faster delta-processing -- added extra checks for delta-images -- many changes to support delta-images -- optimized some store_xxx routines -- fixed some small things (as precaution) -- fixed possible trouble if IEND display-processing got broken up -- fixed nasty bug with embedded PNG after delta-image -- added processing of PLTE & tRNS for delta-images -- added processing of PLTE/tRNS & color-info for delta-images in the - ani_objects chain -- fixed problem with color-correction for stored images -- added get/set for speedtype to facilitate testing -- added trace-codes & -strings for get/set speedtype -- added speed-modifier to timing routine -- added get-routine of imagelevel for processtext callback -- added trace-code & -string for get imagelevel -- added administration of imagelevel parameter -- added support for PPLT chunk -- added trace-codes & -strings for PPLT chunk processing -- fixed problem with incorrect gamma-correction -- fixed inclusion of IJG read/write code -- fixed problem with 16-bit GA format -- fixed problem with cheap transparency for 4-bit gray -- fixed display_xxxx routines for interlaced images -- added precaution against faulty iCCP chunks from PS -- changed userdata variable to mng_ptr -- added typedef for mng_size_t -- changed size parameter for memory allocation to mng_size_t -- fixed compiler-warning for non-initialized iB variable -- changed definition for 32-bit ints (64-bit platforms) -- changed definition for mng_handle (64-bit platforms) -- swapped refresh parameters -- fixed initialization routine for new mng_handle type -- added inclusion of stdlib.h for abs() -- fixed some 64-bit warnings -- fixed incompatible return-types - -samples: - -contrib: -- updated mngplg to 0.3.0 (supports JNG & full color-correction!) -- updated mngplg to 0.4.0 (Jason is picking up the pace ;-) - -doc: -- added rpm directory with rpm spec-file (contributed by MATSUURA Takanori) - -makefiles: -- changed makefile.linux to reflect versionnr for shared-lib -- changed makefile.linux to depend on mng_conf.h & mng_types.h - ------------------------------------------------------------ - -0.5.2 (June 10th 2000) ----------------------- - -in short: - -This is the third release for developers -Another milestone since JNG is now fully supported -The next release will most likely be numbered 0.9.0 as the first Beta!! - -Fixed bug 106017 & 106019 -Added many constants regarding chunk-property values -Implemented full JNG support -Added all the error- & trace-strings -Added get/set routines for default ZLIB/IJG parameters -Added a generic makefile for Unix platforms (contributed by Tim Rowley) -Added canvasstyle for separate RGB + A canvas (eg. mozilla-style) -Separated configuration-options into a separate file: "mng_conf.h" -Fixed stuff for generic Unix compilation (contributed by Tim Rowley) -Upgraded to lcms1.0.6 (now supports 16-bit endian-peculiarities) -Added a makefile for Linux ELF & fixed some code-issues to go along with gcc -Added support for suspended input-buffer processing -Implemented the display-routines for RGBA/ARGB/BGRA/ABGR canvasstyles -Implemented the application background-restore functionality -Fixed & tested the mngtree Unix-sample (runs on Linux-RH6.2 with libmng.so) -Upgraded mngplg to v0.2.2 (based on the latest code including JNG) -Fixed a lot of other assorted stuff - -------------------- - -bugfixes: -B003(106017) - fixed problem with being proprietary to BCB -B004(106019) - fixed problem when MNG_SUPPORT_WRITE not defined - -core: -- bumped version-numbers up to 0.5.2 (yeah, really) -- fixed support for IJGSRC6B -- cleaned up some code regarding mixed support-options -- complemented constants for chunk-property values -- fixed MNG_UINT_pHYg value -- implemented JNG support -- fixed problem with DEFI clipping -- added error telltale strings & support -- added trace telltale strings & support -- added support for global color-chunks inside TERM/LOOP -- added support for global PLTE,tRNS,bKGD inside TERM/LOOP -- added default IJG compression parameters and such -- moved init of default zlib parms to "mng_hlapi.c" -- added init of default IJG parms -- added support for get/set of zlib/IJG default parms -- added tracestrings for global animation color-chunks -- added tracestrings for get/set of default ZLIB/IJG parms -- added tracestrings for global PLTE,tRNS,bKGD -- added framenr/layernr/playtime to object header -- added initialization of framenr/layernr/playtime -- changed ani_create calls not returning object pointer -- create ani objects always (not just inside TERM/LOOP) -- fixed inconsistancy with freeing global iCCP profile -- fixed minor bugs 16-bit pixel-handling -- added object promotion routine (PROM handling) -- added trace-codes & -strings for image-object promotion -- added trace-codes & -strings for delta-image processing -- added error-codes & -strings for delta-image processing -- added support for delta-image processing -- added ani-object routines for delta-image processing -- added delta-image fields -- added compression/filter/interlace fields to object-buffer for - delta-image processing -- added delta-image row-processing routines -- fixed up punctuation in several files (contributed by Tim Rowley) -- removed useless definition in "mng_chunks.h" (contributed by Tim Rowley) -- fixed pointer confusion in "mng_display.c" (contributed by Tim Rowley) -- fixed inclusion for memcpy (contributed by Tim Rowley) -- added mng_int32p (contributed by Tim Rowley) -- added internal delta-image processing callbacks -- separated configuration-options into "mng_conf.h" -- changed to most likely configuration -- added RGB8_A8 canvasstyle -- added getalphaline callback for RGB8_A8 canvasstyle -- fixed some makeup for Linux gcc compile -- implemented app bkgd restore routines -- implemented RGBA8, ARGB8, BGRA8 & ABGR8 display routines -- added support for RGB8_A8 canvasstyle -- added support for suspended input-buffer processing -- added mng_read_resume HLAPI function to support read-suspension -- fixed timer-handling to run with Mozilla (Tim Rowley) -- fixed alpha-handling for alpha canvasstyles -- fixed some compilation-warnings (contrib Jason Morris) - -samples: -- fixed mngview(delphi) to work with the new core -- synchronized libmng.pas(delphi) with the new libmng.h header -- removed the error- & trace-strings from libmng.pas(delphi) -- fixed mngtree(Unix) to compile on Linux (runs with libmng.so) -- added makefile.linux for mngtree(Unix) (tested on RedHat6.2) - -contrib: -- updated mngplg to 0.2.2 (based on latest code; supports JNG!) - -doc: -- this file obviously -- added Tim Rowley as contributing author -- changed the examples.readme doc -- updated the design-schematics in line with the current code - -makefiles: -- changed the directory to "makefiles" to avoid name-conflicts -- added generic Unix makefile (thanks to Tim Rowley) -- added Linux ELF makefile (tested on RedHat6.2) - ------------------------------------------------------------ - -0.5.1 May 16th 2000 -------------------- - -in short: - -This is the second release for developers -It's a bit of a milestone since all the chunk functionality is in place and -functioning (read, examine, create & write) -This version is incompatible with 0.5.0 since some of the callback prototypes -have changed (should be the last time that happens!) -There are a few more samples and even a real contribution! - -Fixed bug 105795 & 105797 -Fixed a mis-alignment in animation-timing -Added chunk-access functions -Finished all chunk-storage routine-bits -Finished all chunk-write routines -Changed the callback prototypes to allow error-reporting back to the library -Fixed some routines to allow for callback error-reporting -Added version-control functions & constants -Added two functions to set display- & sRGB-profile from memory -Moved CRC table to dynamic structure (for improved thread-safety) -Added SAVE & SEEK save&restore functionality -Finished the application-based CMS-callbacks -Fixed a few BCB specifics -Changed the Win32 DLL and samples to use __stdcall -Did some more assorted little changes -Added 2 BCB samples -Added 1 Unix sample -Added the MNG plugin by Jason Summers in the contrib section -Changed some documents to reflect these changes - -------------------- - -bugfixes: -B001(105795) - fixed wrong lcms call & memory-leak for gammatables -B002(105797) - fixed problem with missing sRGB profile - -core: -- changed chunk iteration function -- added chunk access functions -- added version control constants & functions -- changed strict-ANSI stuff -- added set_outputprofile2 & set_srgbprofile2 -- added empty-chunk put-routines -- added version_dll & VERSION_DLL (for consistency) -- added version control explanatory text & samples -- added iteratechunk callback definition -- improved definitions for DLL support -- added 8-bit palette definition -- added general array definitions -- added MNG_NULL definition -- changed most callback prototypes to allow the app - to report errors during callback processing -- added CRC table to main structure (for thread-safety) -- added iPLTEentries for checking hIST-length -- changed palette definition to exported palette-type -- removed frozen indicator -- added create/write indicators -- added eMNGma hack (will be removed in 1.0.0 !!!) -- added TERM animation object pointer (easier reference) -- added saved-data structure for SAVE/SEEK processing -- added some errorcodes -- added application errorcodes (used with callbacks) -- moved chunk-access errorcodes to severity 5 -- added chunk-access function trace-codes -- changed trace to macro for callback error-reporting -- added save_state & restore_state trace-codes -- put in some extra comments -- fixed layout for sBIT, PPLT -- changed write callback definition -- fixed layout for PPLT again (missed deltatype ?!?) -- cleaned up left-over teststuff in the BACK chunk routine -- changed CRC initialization to use dynamic structure - (wasn't thread-safe the old way !) -- filled in many missing sequence&length checks -- filled in many missing chunk-store snippets -- added checks for running animations -- filled remaining write routines -- fixed read_pplt with regard to deltatype -- added callback error-reporting support -- added pre-draft48 support (short MHDR, frame_mode, LOOP) -- fixed chunk-storage bit in several routines -- supplemented the SAVE & SEEK display processing -- added init of iPLTEcount -- changed calling-convention definition -- changed status-handling of display-routines -- added versioning-control routines -- filled the write routine -- fixed frame_delay misalignment -- added sanity check for frozen status -- changed display_mend to reset state to initial or SAVE -- added save_state and restore_state for SAVE/SEEK/TERM - processing -- added process_save & process_seek routines -- changed and filled iterate-chunk function -- added getchunk functions -- added putchunk functions -- added empty-chunk put-routines -- filled application-based color-management routines -- added creatememprofile -- filled the deflatedata routine -- added cleanup of saved-data (SAVE/SEEK processing) -- moved the actual write_graphic functionality from mng_hlapi.c - to it's appropriate function in the mng_write.c module -- moved standard header includes into mng_types.h - (stdlib/mem for mem-mngmt & math for fp gamma-calc) -- added getimgdata & putimgdata functions - -samples: -- fixed mngview(delphi) to work with the new core -- synchronized libmng.pas(delphi) with the new libmng.h header -- added mngtree(bcb) sample -- added bogus(bcb) sample -- added mngtree(unix) sample - -contrib: -- added mngplg 0.1.0 / a MNG plugin for Win32 by Jason Summers - -doc: -- added this changes.readme file -- changed the samples.readme doc accordingly -- changed the contrib.readme doc accordingly - ------------------------------------------------------------ - -0.5.0 May 1st 2000 ------------------- - -in short: - -This is the first developers release. -It's roughly about 60% done. diff --git a/Engine/lib/lmng/LICENSE b/Engine/lib/lmng/LICENSE deleted file mode 100644 index 2b624c00a..000000000 --- a/Engine/lib/lmng/LICENSE +++ /dev/null @@ -1,57 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2007 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * Glenn Randers-Pehrson * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * Parts of this software have been adapted from the libpng package. * */ -/* * Although this library supports all features from the PNG specification * */ -/* * (as MNG descends from it) it does not require the libpng package. * */ -/* * It does require the zlib library and optionally the IJG jpeg library, * */ -/* * and/or the "little-cms" library by Marti Maria (depending on the * */ -/* * inclusion of support for JNG and Full-Color-Management respectively. * */ -/* * * */ -/* * This library's function is primarily to read and display MNG * */ -/* * animations. It is not meant as a full-featured image-editing * */ -/* * component! It does however offer creation and editing functionality * */ -/* * at the chunk level. * */ -/* * (future modifications may include some more support for creation * */ -/* * and or editing) * */ -/* * * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/README b/Engine/lib/lmng/README deleted file mode 100644 index a8e67cad5..000000000 --- a/Engine/lib/lmng/README +++ /dev/null @@ -1,36 +0,0 @@ -libmng 1.0.10 -------------- - -Added provisional ANG and anIM support, and made some minor bugfixes. - -libmng 1.0.9 ------------- - -A number of optimizations in the chunk handling and reader/writer code. -This saves over 20KB on binary footprint! - -Also several bugfixes and a couple of patches bring it another step -closer to perfection.... :-) - -See CHANGELOG for details. - - -Y.T. - -Gerard - - -For more information please visit: - -The official libmng web-site: - http://www.libmng.com/ - -Libmng's community on SourceForge: - https://sourceforge.net/project/?group_id=5635 - -The official MNG homepage: - http://www.libpng.org/pub/mng/ - -The official PNG homepage: - http://www.libpng.org/pub/png/ - diff --git a/Engine/lib/lmng/README.autoconf b/Engine/lib/lmng/README.autoconf deleted file mode 100644 index 753f7b4fd..000000000 --- a/Engine/lib/lmng/README.autoconf +++ /dev/null @@ -1,213 +0,0 @@ -********************************************************************** -********************************************************************** - - ***** this is unmaintained ***** - -If you happen to find problems with autoconfiguration and building, -I simply cannot help you. I'm looking for a maintainer that doesn't mind -spending a few minutes every now and then on the next release to make sure -things are still in working order. - -For the moment all autoconf stuff ahs been moved into unmaintained!! - -********************************************************************** -********************************************************************** - - - - -Configuration from CVS -====================== - -If you're using source checked out from CVS, rather than a source -distribution tarball, please be aware that you can use ./autogen.sh in -place of ./configure below. - -Because this is a cross-platform project, the source templates for -the autoconf scripts are sequestered in the 'makefiles' directory. -Running './autogen.sh' will copy them into their conventional places at -the lop level. If you already see the files there, you don't need to -worry about this step. - -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/Engine/lib/lmng/README.config b/Engine/lib/lmng/README.config deleted file mode 100644 index d5cd4541d..000000000 --- a/Engine/lib/lmng/README.config +++ /dev/null @@ -1,104 +0,0 @@ -Configuration options in libmng -=============================== - -The library is fairly configurable through the use of a number of defines. -Please note however that certain defines are for internal use only. -The following list gives a summary of options that can be used externally to -define the functionality of the library: - -======================================== - -#define MNG_BUILD_DLL - -This is used to indicate that a "standard" DLL should result from compiling -the library. Please note the remarks in README.dll if you intend to work -with the library as a DLL. The purpose of this option is to ensure that -DLL builds have the same set of functions. - -#define MNG_BUILD_SO - -This is used to indicate that a "standard" shared library (SO) should result -from a compilation. The purpose of this option is to ensure that all -shared libraries generated this way will have the same set of functions. - -#define MNG_USE_DLL / #define MNG_USE_SO - -These should be used when including the library header in the compilation -of an application to indicate that the compiler/linker must take the -necessary steps to make the binary executable to use the standard DLL -or shared library (SO). - -#define MNG_SKIP_ZLIB / #define MNG_SKIP_LCMS / #define MNG_SKIP_IJG6B - -Use these in conjunction with MNG_USE_DLL / MNG_USE_SO. This is useful if -you only need the external definitions of the MNG library and not the others, -which will speed up the compilation process. - -#define MNG_SUPPORT_FULL / #define MNG_SUPPORT_LC / #define MNG_SUPPORT_VLC - -These can be used to indicate the level of MNG spec compliance required. -Currently only full MNG compliance is supported. - -#define MNG_SUPPORT_IJG6B - -This can be used to indicate if JNG support is required. This option will -include the IJG JPEG-library. Note that MNG_SUPPORT_FULL will automatically -set this option. Use this only if you need JNG support with MNG-(V)LC. - -#define MNG_FULL_CMS / #define MNG_GAMMA_ONLY / #define MNG_NO_CMS / -#define MNG_APP_CMS - -These indicate the color-correction support level of the library. -If you are on a platform that supports lcms (Little CMS by Marti Maria Saguar) -then it is highly recommended to define MNG_FULL_CMS. -If your platform has it's own CMS then select MNG_APP_CMS and be sure to -include the appropriate callbacks in your app. -In all other cases it is recommended to define MNG_GAMMA_ONLY. - -#define MNG_SUPPORT_READ / #define MNG_SUPPORT_WRITE / -#define MNG_SUPPORT_DISPLAY - -These indicate the high-level support for reading, writing and/or -displaying files. Note that in order to display a file, you'll need to read -it first. (yes, really!) - -#define MNG_STORE_CHUNKS - -This indicates that the library should store chunk-information when reading -a file. This information can then be processed through the -MNG_ITERATE_CHUNKS() function. Note that you must specify this option if -you want to create and write a new file. - -#define MNG_ACCESS_CHUNKS - -This is used to indicate that the app may need access to internally stored -chunk information. MNG_STORE_CHUNKS must be defined as well for this option -to function properly. - -#define MNG_INTERNAL_MEMMNGMT - -You can use this to have the library handle it's own memory allocation and -deallocation through the "standard" memory functions. This option is turned -off by default, which means your app must define the memory callbacks. - -#define MNG_ERROR_TELLTALE - -Set this on to allow human-readable error-messages to be included in the -library and the error function and callback. - -#define MNG_BIGENDIAN_SUPPORTED - -This option should be used to indicate the hardware is based on big endian -integers. - -#define MNG_SUPPORT_TRACE / #define MNG_TRACE_TELLTALE - -These two can be used when debugging an app. You'll need to have the trace -callback setup also. This allows for a rather thorough investigation of the -libraries function paths. - -======================================== - -Any other optional defines you may encounter are for internal use only. -please do not specify them externally. In case of doubt, consult the -support email lists. More info can be found on http://www.libmng.com diff --git a/Engine/lib/lmng/README.contrib b/Engine/lib/lmng/README.contrib deleted file mode 100644 index 9b287532a..000000000 --- a/Engine/lib/lmng/README.contrib +++ /dev/null @@ -1,95 +0,0 @@ -The contrib directory contains contributions made by fellow -enthousiasts. (Check respective web-sites for the latest version) - ----------------------------------------------------------------------- - -mngplg - A Netscape plugin for MNG - by Jason Summers - -http://pobox.com/~jason1/imaging/mngplg/ - -The very first contribution, and what a start! -GIF look out, MNG is on the prowl and ready to swat you like a fly! - ----------------------------------------------------------------------- - -mngplay - An SDL based MNG viewer - by Ralph Giles - -http://snow.ashlu.bc.ca/~giles/mng/ - -Another nice contribution. View MNG files on practically any platform -with this standalone viewer. -Source-code only; Requires SDL library and libmng.so - -(Modified by Greg Roelofs) - ----------------------------------------------------------------------- - -mngview - A BCB port of the Delphi sample - by Andy Protano - -I have added this nice little port to the BCB samples directory. -It adds a nifty progressbar while reading a file. Excellent work! -Requires libmng.dll -(note: this is in the BCB samples directory) - ----------------------------------------------------------------------- - -mngdump - A BCB GUI-based dump utility - by Andy Protano - -Andy has sent me this fully functional MNG dump utility, that gives -detailed information of the contents of any MNG file. -Requires libmng.dll - ----------------------------------------------------------------------- - -mng-view - A GTK-based MNG viewer - by Vova Babin - -Vova has been hacking away with the libmng code and has come up with -this nice little sample how to write a MNG viewer using GTK. -Thanks mate! -Source-code only -Requires GTK+ (1.2 or higher) and libmng (0.9.2 or higher) - -(Modified by Greg Roelofs) - ----------------------------------------------------------------------- - -mngview - Another MNG viewer; this one for MSVC - by Nicholaus Brennig - -A welcome contribution from Nicholaus. Author of SlowView. A very nice -image-handling utility for Windows. A welcome contribution since there -have been numerous questions about linking libmng with MSVC. -Well, look no further. Here it is! - ----------------------------------------------------------------------- - -MSVC libmng project - An MSVC project to build libmng.dll - - by Chad Austin - -Chad has contributed some project-files that you could use to build -libmng.dll with MSVC. Please be sure to read the README file included. - ----------------------------------------------------------------------- - -fbmngplay - A simple fbcon based mng player - by Stefan Reinauer - -Stefan has contributed this little example, based on Ralph's -SDL player. It uses the kernel framebuffer device to display mng -animations through the libmng interface. -(currently for 16-bit buffers only) - ----------------------------------------------------------------------- - -xmngview - Lesstif/Motif standalone player for MNG files - - by Winfried Szukalski - -Winfried contributed this MNG player for X-based systems. -(recently updated) - ----------------------------------------------------------------------- - -makemng - A delta-MNG creation utility for MSVC - by Alex Volkov - -Alex sent me this nice utility that will allow you to create highly -optmized MNGs using the delta-PNG capabilities of MNG. - ----------------------------------------------------------------------- diff --git a/Engine/lib/lmng/README.dll b/Engine/lib/lmng/README.dll deleted file mode 100644 index 2f779e81a..000000000 --- a/Engine/lib/lmng/README.dll +++ /dev/null @@ -1,41 +0,0 @@ -Standard Windows DLL -==================== - -The DLL provided in the BCB/win32dll directory is meant as the sole candidate -for distributions, based on libmng.dll, that install the DLL into the public -Windows system-directory. The outline herein defines the requirements to -which such a distribution must comply. If you cannot comply with these -requirements please install the dll in the same directory as your application -and NOT in the Windows system-directory!!! - - -1) Only the DLL already assembled in the libmng distribution may be used for - other distributions! - -2) Only stable public releases are eligible for distribution! A public release - is one where the y-value of the x.y.z version-code is an even number. - Eg. 1.0.0, 1.2.1, 2.4.7, etc. - -3) The installation program MUST store the DLL in the Windows system-directory! - Eg. C:\WinNT\System32, C:\Windows98\System - (Note: InstallShield users can use the variable) - -3) The installation program MUST flag the file as a shared library! - -4) The installation program MUST NOT install the DLL if a newer version - already exists in the Windows system-directory! The standard DLL provided - contains the Windows-default version-numbering system. PLEASE USE IT!! - DO NOT rely on the date or size of the files. - -5) An uninstall procedure MAY NOT remove the DLL if other applications are - still linked to it! Proper handling as a shared library is imperitive. - -6) TEST IT, TEST IT, TEST IT!!! (I just can't stress this enough) - If you don't have enough time, let someone else test it BEFORE you - distribute! - - -The penalty for violating these rules is inclusion of your name in the list -of endangered but useless species (just below the GIF entry!), and on my -blacklist. YOU HAVE BEEN FOREWARNED! - diff --git a/Engine/lib/lmng/README.examples b/Engine/lib/lmng/README.examples deleted file mode 100644 index 1ba94c140..000000000 --- a/Engine/lib/lmng/README.examples +++ /dev/null @@ -1,48 +0,0 @@ -The samples are in platform-specific directories. - -!!! contributions are very welcome !!! - - -bcb - Borland C++ Builder (3.0) (found under bcb/xxx) ------------------------------------------------------ - -win32dll - sample project to create a Windows dll. Requires zlib1.2.1, - IJG jpgsrc6b and lcms1.0.14. The directories containing these - libraries must be at the same level as the libmng directory. - So if you're in the directory with this file and the libmng - sources, they should be in ..\zlib , ..\jpgsrc6b and ..\lcms - respectively. - -!!! To run the other Win32 samples you need to copy the libmng.dll - file from here into the sample's directory !!! - -mngtree - sample project to create a little command-line tool that dumps - the chunk-structure of a given file onto stdout. - -bogus - a completely bogus example on how to create a perfectly valid - (though slightly biased) MNG. - -mngview - port of the Delphi mngview sample. contributed by Andy Protano. - see also README.contrib - -mngrepair- an example on how to fix invalid MNG files - uses the new mng_copy_chunks() function and MNG_SOFTERRORS to - 'ignore' certain input-errors. This conditional *MUST* only be used - for exactly this kind of software; eg. repair utilities. - - -delphi - Borland Delphi (3.0+) (found under contrib/delphi/xxx) ---------------------------------------------------------------- - -mngview - sample project for a simple mng-viewer. The general unit in - the delphi directory was translated from libmng.h It can be - used in other projects to access libmng.dll created with the - win32dll example above. - - -unix - Unix (found under contrib/gcc/xxx) ------------------------------------------ - -mngtree - basically a copy of the BCB sample. It includes a makefile for - Linux and it's been tested on RedHat6.2 - diff --git a/Engine/lib/lmng/README.footprint b/Engine/lib/lmng/README.footprint deleted file mode 100644 index 34dba7f18..000000000 --- a/Engine/lib/lmng/README.footprint +++ /dev/null @@ -1,46 +0,0 @@ -/* - You can use one or more of the following defines to - reduce the size of the compiled library. Define the - SKIPCANVAS macros for any canvas configurations that - your application doesn't use. Define the SKIPCHUNK - macros for any chunks that your application doesn't - process. Define MNG_OPTIMIZE_FOOTPRINT to choose - smaller code size over faster execution and less memory - usage. These macros became available in version 1.0.6. -*/ - -/* eliminate unused features from libmng */ -#define MNG_OPTIMIZE_FOOTPRINT -#define MNG_OPTIMIZE_OBJCLEANUP -#define MNG_OPTIMIZE_CHUNKINITFREE -#define MNG_OPTIMIZE_CHUNKASSIGN -#define MNG_OPTIMIZE_CHUNKREADER - -#define MNG_SKIPCANVAS_ABGR8 -#define MNG_SKIPCANVAS_ARGB8 -#define MNG_SKIPCANVAS_BGR8 -#define MNG_SKIPCANVAS_BGRA8 -#define MNG_SKIPCANVAS_BGRA8_PM -#define MNG_SKIPCANVAS_BGRX8 -#define MNG_SKIPCANVAS_RGBA8 -#define MNG_SKIPCANVAS_BGR565 -#define MNG_SKIPCANVAS_RGB565 -#define MNG_SKIPCANVAS_BGRA565 -#define MNG_SKIPCANVAS_RGBA565 - -#define MNG_SKIPCHUNK_iCCP -#define MNG_SKIPCHUNK_tEXt -#define MNG_SKIPCHUNK_zTXt -#define MNG_SKIPCHUNK_iTXt -#define MNG_SKIPCHUNK_bKGD -#define MNG_SKIPCHUNK_pHYs -#define MNG_SKIPCHUNK_sBIT -#define MNG_SKIPCHUNK_sPLT -#define MNG_SKIPCHUNK_hIST -#define MNG_SKIPCHUNK_tIME -#define MNG_SKIPCHUNK_eXPI -#define MNG_SKIPCHUNK_fPRI -#define MNG_SKIPCHUNK_nEED -#define MNG_SKIPCHUNK_pHYg - - diff --git a/Engine/lib/lmng/README.packaging b/Engine/lib/lmng/README.packaging deleted file mode 100644 index da0db3e7b..000000000 --- a/Engine/lib/lmng/README.packaging +++ /dev/null @@ -1,24 +0,0 @@ -Packaging Libmng for distribution ---------------------------------- - -These are some notes for those building binaries for distribution. - -We're interested to hear about anywhere libmng is helpful, so let us -know if you're including it with your application or OS. Also, if your -build is publicly accessible, we'd be happy to link to it from -the libmng site. - -However, We respectfully request that you *not* distribute binaries as a -shared library (DLL) with any of the major features disabled. While -there is support for this in terms of #ifdef directives (in -libmng_conf.h) and autoconf switches they are intended for embedded -application and testing. The default compilation options support the -full MNG specification, and we wish to avoid the confusion among -general users that partial support would engender. - - -Platform specific notes: - -We have a basic .spec file for generating rpms. Send us a note if you'd -like to clean it up. - diff --git a/Engine/lib/lmng/bcb/bogus/bogus.bpr b/Engine/lib/lmng/bcb/bogus/bogus.bpr deleted file mode 100644 index 50a7a8094..000000000 --- a/Engine/lib/lmng/bcb/bogus/bogus.bpr +++ /dev/null @@ -1,184 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = bogus.exe -OBJFILES = bogus.obj -RESFILES = bogus.res -RESDEPEN = $(RESFILES) -LIBFILES = ..\win32dll\libmng.lib -LIBRARIES = -SPARELIBS = -PACKAGES = vclx35.bpi VCL35.bpi vcldb35.bpi vcldbx35.bpi bcbsmp35.bpi dclocx35.bpi \ - Qrpt35.bpi -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .; -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -w -r- -k -y -v -vi- -c -tWC -CFLAG2 = -D_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -I..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -CFLAG3 = -Tkh30000 -PFLAGS = -D_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -U..\win32dll;$(BCB)\lib;$(DEBUGLIBPATH) \ - -I..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include \ - -$Y -$W -$O- -v -JPHN -M -RFLAGS = -D_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL \ - -i..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -AFLAGS = /i..\win32dll /i..\..\..\libmng-devel /i..\..\..\zlib /i..\..\..\jpgsrc6b \ - /i..\..\..\lcms /i$(BCB)\include /d_NO_VCL /dMNG_SUPPORT_WRITE \ - /dMNG_ACCESS_CHUNKS /dMNG_STORE_CHUNKS /dMNG_NO_CMS /dMNG_USE_DLL /mx /w2 /zd -LFLAGS = -L..\win32dll;$(BCB)\lib;$(DEBUGLIBPATH) -ap -Tpe -x -Gn -v -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) import32.lib cw32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=1 -MinorVer=0 -Release=1 -Build=9 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription=Executable (Console) -FileVersion=1.0.1.9 -InternalName=bogus -LegalCopyright=copyright (c) 2000,2002 G. Juyn -LegalTrademarks= -OriginalFilename=bogus.exe -ProductName=bogus -ProductVersion=1.0.1 -Comments= - -[Excluded Packages] -C:\Program Files\Borland\CBuilder3\Bin\DbX35.bpl=(untitled) - -[HistoryLists\hlIncludePath] -Count=3 -Item0=..\win32dll;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item1=..\..\..\libmng-devel;..\..\..\zlib;$(BCB)\include -Item2=..\..\..\libmng;..\..\..\zlib;$(BCB)\include - -[HistoryLists\hlLibraryPath] -Count=2 -Item0=..\win32dll;$(BCB)\lib -Item1=$(BCB)\lib - -[HistoryLists\hlConditionals] -Count=2 -Item0=_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item1=_NO_VCL;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_USE_DLL - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/bogus/bogus.cpp b/Engine/lib/lmng/bcb/bogus/bogus.cpp deleted file mode 100644 index 626d0d73c..000000000 --- a/Engine/lib/lmng/bcb/bogus/bogus.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000,2002 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : bogus * */ -/* * file : bogus.cpp copyright (c) 2000,2002 G.Juyn * */ -/* * version : 1.0.1 * */ -/* * * */ -/* * purpose : main project file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : bogus is (quite literally) a bogus sample which creates and* */ -/* * writes a totally valid, be it somewhat trivial, MNG-file * */ -/* * * */ -/* * changes : 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - changed memory allocation size parameters to mng_size_t * */ -/* * * */ -/* * 1.0.1 - 10/07/2002 - G.Juyn * */ -/* * - fixed copyright notice * */ -/* * - updated MHDR simplicity flag * */ -/* * * */ -/* ************************************************************************** */ - -#pragma hdrstop -#include -#include -#include -#include - -#include "libmng.h" - -/* ************************************************************************** */ - -USERES("bogus.res"); -USELIB("..\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- -typedef struct user_struct { - - FILE *hFile; /* file handle */ - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -#define MY_DECL __stdcall /* get the right callback convention */ - -/* ************************************************************************** */ - -mng_ptr MY_DECL myalloc (mng_size_t iSize) -{ - return (mng_ptr)calloc (1, iSize); /* duh! */ -} - -/* ************************************************************************** */ - -#pragma argsused -void MY_DECL myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool MY_DECL mywritedata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iWritten) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* write it */ - *iWritten = fwrite (pBuf, 1, iSize, pMydata->hFile); - /* iWritten will indicate errors */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -int makeimage (char * zFilename) -{ - userdatap pMydata; - mng_handle hMNG; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - /* can we open the file ? */ - if ((pMydata->hFile = fopen (zFilename, "wb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open output file %s.\n", zFilename); - return 1; - } - /* let's initialize the library */ - hMNG = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!hMNG) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (hMNG, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (hMNG, myclosestream)) != 0) || - ((iRC = mng_setcb_writedata (hMNG, mywritedata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* create the file in memory */ - if ( ((iRC = mng_create (hMNG) ) != 0) || - ((iRC = mng_putchunk_mhdr (hMNG, 640, 480, 1000, 3, 1, 3, 0x0047) ) != 0) || - ((iRC = mng_putchunk_basi (hMNG, 640, 160, 8, 2, 0, 0, 0, 0xFF, 0x00, 0x00, 0xFF, 1)) != 0) || - ((iRC = mng_putchunk_iend (hMNG) ) != 0) || - ((iRC = mng_putchunk_defi (hMNG, 0, 0, 0, MNG_TRUE, 0, 160, MNG_FALSE, 0, 0, 0, 0 )) != 0) || - ((iRC = mng_putchunk_basi (hMNG, 640, 160, 8, 2, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF, 1)) != 0) || - ((iRC = mng_putchunk_iend (hMNG) ) != 0) || - ((iRC = mng_putchunk_defi (hMNG, 0, 0, 0, MNG_TRUE, 0, 320, MNG_FALSE, 0, 0, 0, 0 )) != 0) || - ((iRC = mng_putchunk_basi (hMNG, 640, 160, 8, 2, 0, 0, 0, 0x00, 0x00, 0xFF, 0xFF, 1)) != 0) || - ((iRC = mng_putchunk_iend (hMNG) ) != 0) || - ((iRC = mng_putchunk_mend (hMNG) ) != 0) ) - fprintf (stderr, "Cannot create the chunks for the image.\n"); - else - { - if ((iRC = mng_write (hMNG)) != 0) - fprintf (stderr, "Cannot write the image.\n"); - - } - } - - mng_cleanup (&hMNG); /* cleanup the library */ - } - - fclose (pMydata->hFile); /* cleanup */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -#pragma argsused -int main (int argc, char *argv[]) -{ - return makeimage ("dutch.mng"); -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr b/Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr deleted file mode 100644 index 386da9021..000000000 --- a/Engine/lib/lmng/bcb/mngrepair/mngrepair.bpr +++ /dev/null @@ -1,235 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = mngrepair.exe -OBJFILES = obj\mngrepair.obj obj\libmng_hlapi.obj obj\libmng_callback_xs.obj \ - obj\libmng_prop_xs.obj obj\libmng_chunk_xs.obj obj\libmng_object_prc.obj \ - obj\libmng_chunk_prc.obj obj\libmng_chunk_io.obj obj\libmng_read.obj \ - obj\libmng_write.obj obj\libmng_display.obj obj\libmng_dither.obj \ - obj\libmng_pixels.obj obj\libmng_filter.obj obj\libmng_error.obj \ - obj\libmng_trace.obj obj\libmng_cms.obj obj\libmng_zlib.obj obj\libmng_jpeg.obj \ - obj\adler32.obj obj\compress.obj obj\crc32.obj obj\deflate.obj obj\infblock.obj \ - obj\infcodes.obj obj\inffast.obj obj\inflate.obj obj\inftrees.obj \ - obj\infutil.obj obj\trees.obj obj\uncompr.obj obj\zutil.obj -RESFILES = mngrepair.res -RESDEPEN = $(RESFILES) -LIBFILES = -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = vclx35.bpi VCL35.bpi vcldb35.bpi vcldbx35.bpi bcbsmp35.bpi dclocx35.bpi \ - Qrpt35.bpi -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\..;..\..\..\zlib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -Od -Hc -w -r- -d -k -y -v -vi- -w-par -c -tWC -CFLAG2 = -D_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS \ - -I..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include \ - -H=$(BCB)\lib\vcl35.csm -CFLAG3 = -Tkh30000 -ff -5 -wuse -wucp -wstv -wstu -wsig -wpin -wnod -wnak -wdef -wcln \ - -wbbf -wasm -wamp -wamb -PFLAGS = -D_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS \ - -N2.\obj -N0.\obj \ - -U..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(RELEASELIBPATH) \ - -I..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -H -W \ - -$Y -$W -$O- -v -JPHN -M -RFLAGS = -D_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS \ - -i..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -AFLAGS = /i..\..\..\libmng-devel /i..\..\..\zlib /i..\..\..\jpgsrc6b /i$(BCB)\include \ - /d_NO_VCL /dMNG_SUPPORT_FULL /dMNG_SUPPORT_READ /dMNG_SUPPORT_WRITE \ - /dMNG_ACCESS_CHUNKS /dMNG_STORE_CHUNKS /dMNG_INCLUDE_ZLIB /dMNG_NO_CMS \ - /dMNG_SOFTERRORS /mx /w2 /zd -LFLAGS = -L..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(RELEASELIBPATH) \ - -ap -Tpe -x -Gn -wdef -wdpl -v -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) import32.lib cw32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=1 -MinorVer=0 -Release=0 -Build=27 -Debug=1 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription=Executable (Console) -FileVersion=1.0.0.27 -InternalName=mngrepair -LegalCopyright=copyright (c) 2002 G.Juyn -LegalTrademarks= -OriginalFilename=mngrepair.exe -ProductName=mngrepair -ProductVersion=1.0 -Comments= - -[Excluded Packages] -C:\Program Files\Borland\CBuilder3\Bin\DbX35.bpl=(untitled) - -[HistoryLists\hlIncludePath] -Count=9 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -Item1=..\..\..\libmng-devel;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -Item2=..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\include -Item3=..\..\..\libmng-devel;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item4=..\..;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item5=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item6=..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms;$(BCB)\include -Item7=..\..\..\libmng;..\..\..\zlib;$(BCB)\include -Item8=..\..\..\libmng;$(BCB)\include - -[HistoryLists\hlLibraryPath] -Count=7 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib -Item1=..\..\..\libmng-devel;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib -Item2=..\..;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib -Item3=..\..\..\jpgsrc6b;..\..\..\zlib;..\..\..\libmng-devel;..\win32dll;$(BCB)\lib -Item4=..\win32dll;$(BCB)\lib -Item5=..\..\..\libmng\bcb\win32dll;$(BCB)\lib -Item6=..\..\..\libmng;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b - -[HistoryLists\hlConditionals] -Count=13 -Item0=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_NO_CMS;MNG_SOFTERRORS -Item1=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG6B;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL;MNG_SOFTERRORS -Item2=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG6B;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL;MNG_SOFTERROR -Item3=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG6B;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item4=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_INCLUDE_ZLIB;MNG_INCLUDE_IJG;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item5=_NO_VCL;MNG_SUPPORT_FULL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item6=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL;MNG_SUPPORT_IJG6B -Item7=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_DEFINE_JPEG_STDCALL -Item8=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_SUPPORT_DISPLAY;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS -Item9=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS -Item10=_NO_VCL;MNG_SUPPORT_READ;MNG_SUPPORT_WRITE;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item11=_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item12=_NO_VCL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS - -[HistoryLists\hlIntOutputDir] -Count=2 -Item0=.\obj -Item1=..\..\..\obj - -[HistoryLists\hlRunParameters] -Count=4 -Item0=roilion02.mng roilion02-fixed.mng -Item1=roilion.mng roilion-fixed.mng -Item2=dutch.mng -Item3=usflag-lc-d63.mng - -[Debugging] -DebugSourceDirs=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b - -[Parameters] -RunParams=roilion02.mng roilion02-fixed.mng -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp b/Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp deleted file mode 100644 index 5f7c6ec19..000000000 --- a/Engine/lib/lmng/bcb/mngrepair/mngrepair.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2002 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : mngrepair * */ -/* * file : mngrepair.cpp copyright (c) 2002 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : main project file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : mngrepair iterates tries to fix a couple of 'common' * */ -/* * MNG encoding errors (such as in JASC Animation Shop) * */ -/* * * */ -/* * changes : * */ -/* * * */ -/* ************************************************************************** */ - -#define HAVE_BOOLEAN - -#include -#pragma hdrstop -#include - -#include "libmng.h" - -/* ************************************************************************** */ - -USERES("mngrepair.res"); -USEUNIT("..\..\libmng_hlapi.c"); -USEUNIT("..\..\libmng_callback_xs.c"); -USEUNIT("..\..\libmng_prop_xs.c"); -USEUNIT("..\..\libmng_chunk_xs.c"); -USEUNIT("..\..\libmng_object_prc.c"); -USEUNIT("..\..\libmng_chunk_prc.c"); -USEUNIT("..\..\libmng_chunk_io.c"); -USEUNIT("..\..\libmng_read.c"); -USEUNIT("..\..\libmng_write.c"); -USEUNIT("..\..\libmng_display.c"); -USEUNIT("..\..\libmng_dither.c"); -USEUNIT("..\..\libmng_pixels.c"); -USEUNIT("..\..\libmng_filter.c"); -USEUNIT("..\..\libmng_error.c"); -USEUNIT("..\..\libmng_trace.c"); -USEUNIT("..\..\libmng_cms.c"); -USEUNIT("..\..\libmng_zlib.c"); -USEUNIT("..\..\libmng_jpeg.c"); -USEUNIT("..\..\..\zlib\adler32.c"); -USEUNIT("..\..\..\zlib\compress.c"); -USEUNIT("..\..\..\zlib\crc32.c"); -USEUNIT("..\..\..\zlib\deflate.c"); -USEUNIT("..\..\..\zlib\infblock.c"); -USEUNIT("..\..\..\zlib\infcodes.c"); -USEUNIT("..\..\..\zlib\inffast.c"); -USEUNIT("..\..\..\zlib\inflate.c"); -USEUNIT("..\..\..\zlib\inftrees.c"); -USEUNIT("..\..\..\zlib\infutil.c"); -USEUNIT("..\..\..\zlib\trees.c"); -USEUNIT("..\..\..\zlib\uncompr.c"); -USEUNIT("..\..\..\zlib\zutil.c"); -//--------------------------------------------------------------------------- -typedef struct user_struct { - - FILE *hFileI; /* input file handle */ - FILE *hFileO; /* output file handle */ - mng_handle hHandleI; /* input mng handle */ - mng_handle hHandleO; /* output mng handle */ - mng_bool bHasSAVE; /* indicates a SAVE in the input */ - mng_bool bHasTERM; /* indicates we saved the TERM */ - mng_bool bIsJASC; /* indicates if this is an AS file */ - mng_chunkid iLastchunk; /* last processed chunk */ - mng_retcode iError; /* errorcode from function in callback */ - mng_uint8 iTermaction; /* saved TERM parameters */ - mng_uint8 iIteraction; - mng_uint32 iDelay; - mng_uint32 iItermax; - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -#define MY_DECL /* get the right callback convention */ - -/* ************************************************************************** */ - -mng_ptr MY_DECL myalloc (mng_size_t iSize) -{ /* duh! */ - return (mng_ptr)calloc (1, (size_t)iSize); -} - -/* ************************************************************************** */ - -#pragma argsused -void MY_DECL myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool MY_DECL myreaddata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* read it */ - *iRead = fread (pBuf, 1, iSize, pMydata->hFileI); - /* iRead will indicate EOF */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool MY_DECL mywritedata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iWritten) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* write it */ - *iWritten = fwrite (pBuf, 1, iSize, pMydata->hFileO); - /* iWritten will indicate errors */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool MY_DECL myprocesserror (mng_handle hMNG, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext) -{ /* sequence error for TERM we ignore ! */ - if ((iErrorcode == MNG_SEQUENCEERROR) && (iChunkname == MNG_UINT_TERM)) - return MNG_TRUE; - - return MNG_FALSE; /* all others get dumped ! */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myiterchunk (mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq) -{ - mng_uint32 iWidth; /* temps for IHDR processing */ - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - - mng_bool bEmpty; /* temps for FRAM processing */ - mng_uint8 iMode; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iChangedelay; - mng_uint8 iChangetimeout; - mng_uint8 iChangeclipping; - mng_uint8 iChangesyncid; - mng_uint32 iDelay; - mng_uint32 iTimeout; - mng_uint8 iBoundarytype; - mng_int32 iBoundaryl; - mng_int32 iBoundaryr; - mng_int32 iBoundaryt; - mng_int32 iBoundaryb; - mng_uint32 iCount; - mng_uint32p pSyncids; - /* get to my userdata */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - - if (pMydata->hFileO) /* are we writing this time ? */ - { /* do we need to 'forget' the TERM ? */ - if ((iChunktype == MNG_UINT_TERM) && (pMydata->bHasTERM)) - ; - else - { /* fix JASC AS frame_type ? */ - if ((iChunktype == MNG_UINT_FRAM) && (pMydata->bIsJASC)) - { - if ((pMydata->iError = mng_getchunk_fram (hMNG, hChunk, - &bEmpty, &iMode, &iNamesize, &zName, - &iChangedelay, &iChangetimeout, - &iChangeclipping, &iChangesyncid, - &iDelay, &iTimeout, &iBoundarytype, - &iBoundaryl, &iBoundaryr, - &iBoundaryt, &iBoundaryb, - &iCount, &pSyncids)) != 0) - { - fprintf (stderr, "Cannot get FRAM fields.\n"); - return MNG_FALSE; /* stop the process ! */ - } - - if (iMode == 1) /* really ? */ - iMode = 3; - - if ((pMydata->iError = mng_putchunk_fram (pMydata->hHandleO, - bEmpty, iMode, iNamesize, zName, - iChangedelay, iChangetimeout, - iChangeclipping, iChangesyncid, - iDelay, iTimeout, iBoundarytype, - iBoundaryl, iBoundaryr, - iBoundaryt, iBoundaryb, - iCount, pSyncids)) != 0) - { - fprintf (stderr, "Cannot write FRAM chunk.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - else - { - if ((pMydata->iError = mng_copy_chunk (hMNG, hChunk, pMydata->hHandleO)) != 0) - { - fprintf (stderr, "Cannot copy the chunk.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - } - /* need to insert TERM in the proper place ? */ - if ((iChunktype == MNG_UINT_MHDR) && (pMydata->bHasTERM)) - { - if ((pMydata->iError = mng_putchunk_term (pMydata->hHandleO, - pMydata->iTermaction, - pMydata->iIteraction, - pMydata->iDelay, - pMydata->iItermax)) != 0) - { - fprintf (stderr, "Cannot write TERM chunk.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - } - else /* first iteration; just checking stuff */ - { - if (iChunktype == MNG_UINT_SAVE) /* SAVE ? */ - { - pMydata->bHasSAVE = MNG_TRUE; /* we got a SAVE ! */ - pMydata->bIsJASC = MNG_FALSE; /* so it's definitely not an invalid AS file */ - } - else - { /* TERM ? */ - if (iChunktype == MNG_UINT_TERM) - { /* is it in the wrong place ? */ - if ((pMydata->iLastchunk != MNG_UINT_MHDR) || - (pMydata->iLastchunk != MNG_UINT_SAVE) ) - { - pMydata->bHasTERM = MNG_TRUE; - - if ((pMydata->iError = mng_getchunk_term (hMNG, hChunk, - &pMydata->iTermaction, - &pMydata->iIteraction, - &pMydata->iDelay, - &pMydata->iItermax)) != 0) - { - fprintf (stderr, "Cannot get TERM fields.\n"); - return MNG_FALSE; /* stop the process ! */ - } - } - } - else - { /* IHDR ? */ - if (iChunktype == MNG_UINT_IHDR) - { - if ((pMydata->iError = mng_getchunk_ihdr (hMNG, hChunk, - &iWidth, &iHeight, &iBitdepth, - &iColortype, &iCompression, - &iFilter, &iInterlace)) != 0) - { - fprintf (stderr, "Cannot get IHDR fields.\n"); - return MNG_FALSE; /* stop the process ! */ - } - /* is it not a typical JASC AS file */ - if ((iBitdepth != 8) || (iColortype != 6)) - pMydata->bIsJASC = MNG_FALSE; - } - } - } - - pMydata->iLastchunk = iChunktype; - } - - return MNG_TRUE; /* keep'm coming... */ -} - -/* ************************************************************************** */ - -int fixit (char * zFilenameI, - char * zFilenameO) -{ - userdatap pMydata; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - - pMydata->hFileO = 0; /* initialize some stuff! */ - pMydata->hHandleI = MNG_NULL; - pMydata->hHandleO = MNG_NULL; - pMydata->bHasSAVE = MNG_FALSE; - pMydata->bHasTERM = MNG_FALSE; - pMydata->bIsJASC = MNG_TRUE; - pMydata->iLastchunk = MNG_UINT_HUH; - pMydata->iTermaction = 0; - pMydata->iIteraction = 0; - pMydata->iDelay = 0; - pMydata->iItermax = 0; - /* can we open the input file ? */ - if ((pMydata->hFileI = fopen (zFilenameI, "rb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open input file %s.\n", zFilenameI); - return 1; - } - /* let's initialize the library */ - pMydata->hHandleI = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!pMydata->hHandleI) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* some informatory messages */ - fprintf (stderr, "Compiled with libmng %s.\n", MNG_VERSION_TEXT); - fprintf (stderr, "Running with libmng %s.\n", mng_version_text()); - /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (pMydata->hHandleI, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (pMydata->hHandleI, myclosestream )) != 0) || - ((iRC = mng_setcb_readdata (pMydata->hHandleI, myreaddata )) != 0) || - ((iRC = mng_setcb_errorproc (pMydata->hHandleI, myprocesserror)) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* reaad the file into memory */ - if ((iRC = mng_read (pMydata->hHandleI)) != 0) - fprintf (stderr, "Cannot read the input file.\n"); - else - { /* run through the chunk list to get TERM */ - if ((iRC = mng_iterate_chunks (pMydata->hHandleI, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - else - { - if (pMydata->iError) /* did the iteration fail somehow ? */ - iRC = pMydata->iError; - else - { /* can we open the output file ? */ - if ((pMydata->hFileO = fopen (zFilenameO, "wb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open output file %s.\n", zFilenameO); - iRC = 1; - } - else - { /* let's initialize the library */ - pMydata->hHandleO = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!pMydata->hHandleO) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (pMydata->hHandleO, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (pMydata->hHandleO, myclosestream)) != 0) || - ((iRC = mng_setcb_writedata (pMydata->hHandleO, mywritedata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { - if ((iRC = mng_create (pMydata->hHandleO)) != 0) - fprintf (stderr, "Cannot create a new MNG.\n"); - else - { /* run through the chunk again and create the new file */ - if ((iRC = mng_iterate_chunks (pMydata->hHandleI, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - else - { /* did the iteration fail somehow ? */ - if (pMydata->iError) - iRC = pMydata->iError; - else - { /* now write the created new file !! */ - if ((iRC = mng_write (pMydata->hHandleO)) != 0) - fprintf (stderr, "Cannot write the output file.\n"); - } - } - } - } - /* cleanup the library */ - mng_cleanup (&pMydata->hHandleO); - } - /* cleanup output file */ - fclose (pMydata->hFileO); - } - } - } - } - } - - mng_cleanup (&pMydata->hHandleI); /* cleanup the library */ - } - - fclose (pMydata->hFileI); /* cleanup input file and userdata */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -int main(int argc, char *argv[]) -{ - if (argc > 2) /* need two (2) parameters ! */ - return fixit (argv[1], argv[2]); - else - fprintf (stdout, "\nUsage: mngrepair \n\n"); - - return 0; -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/bcb/mngrepair/mngrepair.res b/Engine/lib/lmng/bcb/mngrepair/mngrepair.res deleted file mode 100644 index 12530c34f74fcaf605dd2044163b0db97b5629ea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1676 zcmb7DO=}ZT6g_DMVmDf}8$mFFi&mu6l7+gd;%jH>H?0&`mRM^nwn?ceV^?{L2OX%8 zpA$Dieu@hh?sVBjaXk0VO!Cqc#GBlCALrh4Ki+!)P^G46rksw*&xryr)25`@)YO%r zFq+|{N_{{rA>XFY`C%PG~O-|rKUBxFdlf!{2z6rC@Wt~;juj%{o^38fo7 z>GgU^a*~{QIMD$feeH!r2e>UpdkEQ51%$ z$N)E?iA_5m;>H}c9R_$PIM;~+a zu!q}#Ftov4N3nqgMHX`sbX@*QxR+NxrVc>|&BIvkV8~I0p8L z)jvjI@wCkOd0OHACF*tRqQyj~Kc?lhkD-3&{1lyZ8o)d?O)ugZ9%2R0sgLl2Ve37?5=;()t#ywwb~XHsZ=V)Jt~;1xmYFW#uKLt4O&_VLt@ceu+3~X7CDI_zmR7RO8St7_mhhB& z4Yig^_gJHJs(}w=0y93lCs}V|mM6NvEav&GB4jp?S=*sjJ4;rd_Z1oIc*i)q9QW~& z)f8fQk|myR7E?}0@-F%*tE}7O`OlG0dJ0w{wZ9}si%|}kUE8Z1WEijgHZF|$ob7bh rXW%L=i+dp1NRNvOj25!4bro3;Zx(P -#include -#include -#include - -#include "libmng.h" - -/* ************************************************************************** */ - -USERES("mngtree.res"); -USELIB("..\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- - -/* ************************************************************************** */ - -typedef struct user_struct { - - FILE *hFile; /* file handle */ - int iIndent; /* for nice indented formatting */ - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -#define MY_DECL __stdcall /* get the right callback convention */ - -/* ************************************************************************** */ - -mng_ptr MY_DECL myalloc (mng_size_t iSize) -{ /* duh! */ - return (mng_ptr)calloc (1, (size_t)iSize); -} - -/* ************************************************************************** */ - -#pragma argsused -void MY_DECL myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool MY_DECL myreaddata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* read it */ - *iRead = fread (pBuf, 1, iSize, pMydata->hFile); - /* iRead will indicate EOF */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -#pragma argsused -mng_bool MY_DECL myiterchunk (mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - char aCh[4]; - char zIndent[80]; - int iX; - /* decode the chunkname */ - aCh[0] = (char)((iChunktype >> 24) & 0xFF); - aCh[1] = (char)((iChunktype >> 16) & 0xFF); - aCh[2] = (char)((iChunktype >> 8) & 0xFF); - aCh[3] = (char)((iChunktype ) & 0xFF); - /* indent less ? */ - if ( (iChunktype == MNG_UINT_MEND) || (iChunktype == MNG_UINT_IEND) || - (iChunktype == MNG_UINT_ENDL) ) - pMydata->iIndent -= 2; - /* this looks ugly; but I haven't - figured out how to do it prettier */ - for (iX = 0; iX < pMydata->iIndent; iX++) - zIndent[iX] = ' '; - zIndent[pMydata->iIndent] = '\0'; - /* print a nicely indented line */ - printf ("%s%c%c%c%c\n", &zIndent, aCh[0], aCh[1], aCh[2], aCh[3]); - /* indent more ? */ - if ( (iChunktype == MNG_UINT_MHDR) || (iChunktype == MNG_UINT_IHDR) || - (iChunktype == MNG_UINT_JHDR) || (iChunktype == MNG_UINT_DHDR) || - (iChunktype == MNG_UINT_BASI) || (iChunktype == MNG_UINT_LOOP) ) - pMydata->iIndent += 2; - - return MNG_TRUE; /* keep'm coming... */ -} - -/* ************************************************************************** */ - -int dumptree (char * zFilename) -{ - userdatap pMydata; - mng_handle hMNG; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - /* can we open the file ? */ - if ((pMydata->hFile = fopen (zFilename, "rb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open input file %s.\n", zFilename); - return 1; - } - /* let's initialize the library */ - hMNG = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!hMNG) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (hMNG, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (hMNG, myclosestream)) != 0) || - ((iRC = mng_setcb_readdata (hMNG, myreaddata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* reaad the file into memory */ - if ((iRC = mng_read (hMNG)) != 0) - fprintf (stderr, "Cannot read the file.\n"); - else - { - pMydata->iIndent = 2; /* start of the indenting at a nice level */ - - printf ("Starting dump of %s.\n\n", zFilename); - /* run through the chunk list */ - if ((iRC = mng_iterate_chunks (hMNG, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - - printf ("\nDone.\n"); - } - } - - mng_cleanup (&hMNG); /* cleanup the library */ - } - - fclose (pMydata->hFile); /* cleanup */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -#pragma argsused -int main(int argc, char *argv[]) -{ - if (argc > 1) /* need that first parameter ! */ - return dumptree (argv[1]); - else - fprintf (stdout, "\nUsage: mngtree \n\n"); - - return 0; -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/bcb/mngview/MNGI.ICO b/Engine/lib/lmng/bcb/mngview/MNGI.ICO deleted file mode 100644 index 1556e589963b6951532c0350f0c71182d22ce26f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 766 zcmd6lp^^eI5JZ~`RVzVZS$UGG5hLNBB36=5%cmfbxI<9n-ejpl0G`SAB;AvAlC4M! z+BmKiasH7u^uJ&P2e8nREEQ_+qfn$$%G{9|f}&b0h1Nf{79&6lDbkmOxjj#k%qO#H z_fQ7QX5b;DV4i97l3qn(N~}ok46z6$_}rVLJ3O42mnO>@K48^-;8D-HmnGzwM~)7T z;SM+V9F%>!KCuo)#lyWDORGN(^R!SpCx2n^20lb;?W7|wWP9iQH~!R>t6X@FCs4Ud W0UshRJAhS{_N?Qj;dkG@?DY@aqI6dP diff --git a/Engine/lib/lmng/bcb/mngview/Main.cpp b/Engine/lib/lmng/bcb/mngview/Main.cpp deleted file mode 100644 index 2bc3b5409..000000000 --- a/Engine/lib/lmng/bcb/mngview/Main.cpp +++ /dev/null @@ -1,573 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -#include // for : malloc & free -#include "Main.h" - -/****************************************************************************} -{* For conditions of distribution and use, *} -{* see copyright notice in libmng.pas *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : main.pas copyright (c) 2000 G.Juyn *} -{* version : 1.0.1 *} -{* *} -{* purpose : Main form for mngview application *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info@3-t.com *} -{* *} -{* comment : this is the heart of the mngview applciation *} -{* *} -{* changes : This project is a converted version of "mngview" - AP *} -{* - AP - 15/9/2000 - revisions ... *} -{* - made the callbacks calling convention explicit *} -(* - Moved the defines from "project options" to "main.h" *} -{* - Added Readme.txt to the project - Please READ IT ! *} -(* *} -{* 0.5.1 - 05/02/2000 - G.Juyn *} -{* - added this version block *} -{* - made the initialization part more robust *} -{* eg. program aborts on initialization errors *} -{* - B002(105797) - added check for existence of default sRGB *} -{* profile (now included in distribution) *} -{* - added mng_cleanup to program exit *} -{* 0.5.1 - 05/08/2000 - G.Juyn *} -{* - changed to stdcall convention *} -{* 0.5.1 - 05/11/2000 - G.Juyn *} -{* - changed callback function declarations *} -{* *} -{* 0.5.3 - 06/16/2000 - G.Juyn *} -{* - removed processmessages call from refresh callback *} -{* 0.5.3 - 06/17/2000 - G.Juyn *} -{* - switched "storechunks" off *} -{* 0.5.3 - 06/26/2000 - G.Juyn *} -{* - changed definition of userdata to mng_ptr *} -{* 0.5.3 - 06/28/2000 - G.Juyn *} -{* - changed the default icon to something more appropriate *} -{* - changed definition of memory alloc size to mng_size_t *} -{* 0.5.3 - 06/29/2000 - G.Juyn *} -{* - changed order of refresh parameters *} -{* *} -{* 0.9.0 - 06/30/2000 - G.Juyn *} -{* - changed refresh parameters to 'x,y,width,height' *} -{* *} -{* 0.9.1 - 07/08/2000 - G.Juyn *} -{* - fixed to use returncode constants *} -{* - changed to accomodate MNG_NEEDTIMERWAIT returncode *} -{* 0.9.1 - 07/10/2000 - G.Juyn *} -{* - changed to use suspension-mode *} -{* *} -{* 1.0.1 - 05/02/2000 - G.Juyn *} -{* - removed loading of default sRGB profile (auto in libmng) *} -{* *} -{****************************************************************************/ - -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -TMainForm *MainForm; - -# define _OR_ | -# define _AND_ & -# define _DIV_ / -# define _NOT_ ! -# define _NIL_ 0 -# define _SHR_ >> -# define _SHL_ << - -// Prototypes for static functions - the LibMng Callbacks. -static mng_ptr __stdcall Memalloc( mng_uint32 iLen ); -static void __stdcall Memfree( mng_ptr iPtr, mng_size_t iLen ); -static mng_bool __stdcall Openstream( mng_handle hHandle ); -static mng_bool __stdcall Closestream( mng_handle hHandle ); -static mng_bool __stdcall Readdata ( mng_handle hHandle, mng_ptr pBuf, - mng_uint32 iBuflen, mng_uint32 *pRead ); -static mng_bool __stdcall ProcessHeader ( mng_handle hHandle, - mng_uint32 iWidth, mng_uint32 iHeight ); -static mng_ptr __stdcall GetCanvasLine ( mng_handle hHandle, - mng_uint32 iLinenr ); -static mng_ptr __stdcall GetAlphaLine( mng_handle hHandle, mng_uint32 iLinenr ); -static mng_bool __stdcall ImageRefresh ( mng_handle hHandle, - mng_uint32 iX, mng_uint32 iY, mng_uint32 iWidth, mng_uint32 iHeight ); -static mng_uint32 __stdcall GetTickCount( mng_handle hHandle ); -static mng_bool __stdcall SetTimer( mng_handle hHandle, mng_uint32 iMsecs ); - -//--------------------------------------------------------------------------- -__fastcall TMainForm::TMainForm(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -static mng_ptr __stdcall Memalloc( mng_uint32 iLen ) -{ -mng_ptr pResult = - - malloc( iLen ); /* get memory from the heap */ - - if( pResult ) /* Added - condition */ - memset( pResult, 0, iLen ); - - return pResult; -} -//--------------------------------------------------------------------------- -static void __stdcall Memfree( mng_ptr iPtr, mng_size_t iLen ) -{ - free( iPtr ); /* free the memory */ - (void)iLen; // Kill compiler warning -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall Openstream( mng_handle hHandle ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - if( OHForm->OFFile != _NIL_ ) /* free previous stream (if any) */ - OHForm->OFFile->Free(); - - /* open a new stream */ - OHForm->OFFile = new TFileStream( - OHForm->SFFileName, fmOpenRead _OR_ fmShareDenyWrite); - - OHForm->ProgressBar1->Position = 0; /* Added */ - OHForm->ProgressBar1->Min =0; /* Added */ - OHForm->ProgressBar1->Max = OHForm->OFFile->Size; /* Added */ - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall Closestream( mng_handle hHandle ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - OHForm->OFFile->Free(); /* cleanup the stream */ - OHForm->OFFile = 0; /* don't use it again ! */ - - OHForm->ProgressBar1->Position = 0; /* Added */ - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall Readdata ( mng_handle hHandle, mng_ptr pBuf, - mng_uint32 iBuflen, mng_uint32 *pRead ) -{ -TMainForm *OHForm; -unsigned int IHTicks; -unsigned int IHByte1; -unsigned int IHByte2; -unsigned int IHBytesPerSec ; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* are we at EOF ? */ - if( OHForm->OFFile->Position >= OHForm->OFFile->Size ) - { - *pRead = 0; /* indicate so */ - } - else - { - IHBytesPerSec = OHForm->IFBytesPerSec; /* fake a slow connection */ - - if( IHBytesPerSec > 0 ) - { - IHTicks = (unsigned int)GetTickCount(); - IHByte1 = (IHTicks - OHForm->IFTicks) * IHBytesPerSec; - IHByte2 = (OHForm->IFBytes + iBuflen) * 1000; - - if( IHByte2 > IHByte1 ) /* Added - condition */ - if( ((IHByte2 - IHByte1) _DIV_ IHBytesPerSec) > 10 ) - { - Sleep( (DWORD)((IHByte2 - IHByte1) _DIV_ IHBytesPerSec) ); - } - }; - - /* read the requested data */ - *pRead = OHForm->OFFile->Read( pBuf, iBuflen); - OHForm->IFBytes = OHForm->IFBytes + *pRead; - - OHForm->ProgressBar1->Position = (int)OHForm->IFBytes; /* Added */ - } // end else; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall ProcessHeader ( mng_handle hHandle, - mng_uint32 iWidth, mng_uint32 iHeight ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* Added */ - OHForm->Caption = ExtractFileName( OHForm->SFFileName ) + - " [" + - String( iWidth ) + - "x" + - String( iHeight ) + - "]"; - - OHForm->OFBitmap->Width = iWidth; /* store the new dimensions */ - OHForm->OFBitmap->Height = iHeight; - OHForm->OFImage->Left = 0; /* adjust the visible component */ - OHForm->OFImage->Top = 0; - OHForm->OFImage->Width = iWidth; - OHForm->OFImage->Height = iHeight; - - OHForm->FormResize (OHForm); /* force re-centering the image*/ - /* clear the canvas & draw an outline */ - OHForm->OFBitmap->Canvas->Brush->Color = clGray; - OHForm->OFBitmap->Canvas->Brush->Style = bsSolid; - OHForm->OFBitmap->Canvas->FillRect( OHForm->OFBitmap->Canvas->ClipRect ); - OHForm->OFBitmap->Canvas->Brush->Color = clRed; - OHForm->OFBitmap->Canvas->Brush->Style = bsSolid; - OHForm->OFBitmap->Canvas->Pen->Color = clRed; - OHForm->OFBitmap->Canvas->Pen->Style = psSolid; - OHForm->OFBitmap->Canvas->FrameRect( OHForm->OFBitmap->Canvas->ClipRect); - - /* make sure it gets out there */ - OHForm->OFImage->Picture->Assign( OHForm->OFBitmap ); - - /* tell the library we want funny windows-bgr*/ - if( mng_set_canvasstyle( hHandle, MNG_CANVAS_BGR8 ) ) - OHForm->MNGerror( "libmng reported an error setting the canvas style" ); - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_ptr __stdcall GetCanvasLine ( mng_handle hHandle, - mng_uint32 iLinenr ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* easy with these bitmap objects ! */ - return OHForm->OFBitmap->ScanLine[ iLinenr ]; -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall ImageRefresh ( mng_handle hHandle, - mng_uint32 iX, mng_uint32 iY, mng_uint32 iWidth, mng_uint32 iHeight ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - - /* force redraw */ - OHForm->OFImage->Picture->Assign( OHForm->OFBitmap ); - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -static mng_uint32 __stdcall GetTickCount( mng_handle hHandle ) -{ - return GetTickCount(); /* windows knows that */ -} -//--------------------------------------------------------------------------- -static mng_bool __stdcall SetTimer( mng_handle hHandle, mng_uint32 iMsecs ) -{ -TMainForm *OHForm; - - /* get a fix on our form */ - OHForm = (TMainForm *)mng_get_userdata( hHandle ); - OHForm->OFTimer->Interval = iMsecs; /* and set the timer */ - OHForm->OFTimer->Enabled = true; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormCreate(TObject *Sender) -{ -String SHProfileName; -mng_uint16 IHRed, IHGreen, IHBlue; /* word */ - - OFBitmap = new Graphics::TBitmap(); /* initialize */ - IFBytesPerSec = 10000000; - OFFile = 0; - - OFOpenDialog->InitialDir = ""; - OFBitmap->HandleType = bmDIB; /* make it a 24-bit DIB */ - OFBitmap->PixelFormat = pf24bit; - - /* now initialize the library */ - IFHandle = mng_initialize( mng_ptr(this), Memalloc, Memfree, _NIL_ ); - - if( IFHandle == _NIL_ ) - { - MNGerror ("libmng initializiation error"\ - "\n"\ - "Program aborted" - ); - PostMessage( Handle, WM_CLOSE, 0, 0); - return; // was Exit - }; - - /* no need to store chunk-info ! */ - mng_set_storechunks( IFHandle, MNG_FALSE ); - - /* use suspension-buffer */ - mng_set_suspensionmode( IFHandle, MNG_TRUE ); - - /* set all the callbacks */ - if( - (mng_setcb_openstream (IFHandle, Openstream ) != MNG_NOERROR) _OR_ - (mng_setcb_closestream (IFHandle, Closestream ) != MNG_NOERROR) _OR_ - (mng_setcb_readdata (IFHandle, Readdata ) != MNG_NOERROR) _OR_ - (mng_setcb_processheader(IFHandle, ProcessHeader) != MNG_NOERROR) _OR_ - (mng_setcb_getcanvasline(IFHandle, GetCanvasLine) != MNG_NOERROR) _OR_ - (mng_setcb_refresh (IFHandle, ImageRefresh ) != MNG_NOERROR) _OR_ - (mng_setcb_gettickcount (IFHandle, GetTickCount ) != MNG_NOERROR) _OR_ - (mng_setcb_settimer (IFHandle, SetTimer ) != MNG_NOERROR) - ) - { - MNGerror ("libmng reported an error setting a callback function!"\ - "\n"\ - "Program aborted" - ); - PostMessage( Handle, WM_CLOSE, 0, 0 ); - return; // was Exit - }; - - /* supply our own bg-color */ - IHRed = (mng_uint16)((Color ) _AND_ 0xFF); - IHGreen = (mng_uint16)((Color _SHR_ 8) _AND_ 0xFF); - IHBlue = (mng_uint16)((Color _SHR_ 16) _AND_ 0xFF); - - IHRed = (mng_uint16)((IHRed _SHL_ 8) + IHRed); - IHGreen = (mng_uint16)((IHGreen _SHL_ 8) + IHGreen); - IHBlue = (mng_uint16)((IHBlue _SHL_ 8) + IHBlue); - - if( mng_set_bgcolor (IFHandle, IHRed, IHGreen, IHBlue) != MNG_NOERROR ) - MNGerror( "libmng reported an error setting the background color!"); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormCloseQuery(TObject *Sender, - bool &CanClose) -{ - BFCancelled = true; - - /* if we're still animating then stop it */ - if( OFTimer->Enabled ) - { - if( mng_display_freeze (IFHandle) != MNG_NOERROR ) - MNGerror ("libmng reported an error during display_freeze!" ); - } - - OFTimer->Enabled = false; - - mng_cleanup( &IFHandle ); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormShow(TObject *Sender) -{ - FormResize( this ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormResize(TObject *Sender) -{ - /* center the image in the window */ - - if( ClientWidth < OFImage->Width ) - OFImage->Left = 0; - else - OFImage->Left = (ClientWidth - OFImage->Width ) _DIV_ 2; - - if( ClientHeight < OFImage->Height ) - OFImage->Top = 0; - else - OFImage->Top = (ClientHeight - OFImage->Height) _DIV_ 2; - - ProgressBar1->Width = Panel1->Width - 8; /* Added */ - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormKeyDown(TObject *Sender, WORD &Key, - TShiftState Shift) -{ - /* pressing will freeze an animation */ - if( Key == VK_ESCAPE ) - { - if( OFTimer->Enabled ) - { - if( mng_display_freeze( IFHandle) != MNG_NOERROR ) - MNGerror( "libmng reported an error during display_freeze!" ); - } - - OFTimer->Enabled = false; /* don't let that timer go off then ! */ - BFCancelled = true; - } - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFTimerTimer(TObject *Sender) -{ -mng_retcode IHRslt; - - OFTimer->Enabled = false; /* only once ! */ - - if( _NOT_ BFCancelled ) - { - /* and inform the library */ - IHRslt = mng_display_resume( IFHandle ); - - if( (IHRslt != MNG_NOERROR) _AND_ (IHRslt != MNG_NEEDTIMERWAIT) ) - MNGerror( "libmng reported an error during display_resume!" ); - - }; - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuFileOpenClick(TObject *Sender) -{ -mng_retcode IHRslt; - - OFOpenDialog->InitialDir = ""; -OFOpenDialog->InitialDir = GetCurrentDir(); //@@ - OFOpenDialog->FileName = SFFileName; - - if( OFOpenDialog->Execute() ) /* get the filename */ - { - if( OFTimer->Enabled ) /* if the lib was active; stop it */ - { - OFTimer->Enabled = false; - - Application->ProcessMessages(); /* process any timer requests (for safety) */ - /* now freeze the animation */ - if( mng_display_freeze( IFHandle ) != MNG_NOERROR ) - MNGerror( "libmng reported an error during display_freeze!" ); - }; - - /* save interesting fields */ - SFFileName = OFOpenDialog->FileName; - IFTicks = GetTickCount(); - IFBytes = 0; - BFCancelled = false; - - /* always reset (just in case) */ - if( mng_reset( IFHandle ) != MNG_NOERROR ) - { - MNGerror( "libmng reported an error during reset!" ); - } - else - { - /* and let the lib do it's job ! */ - IHRslt = mng_readdisplay (IFHandle); - - if( (IHRslt != MNG_NOERROR) _AND_ (IHRslt != MNG_NEEDTIMERWAIT) ) - MNGerror( "libmng reported an error reading the input file!" ); - - }; - }; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuFileProfileClick(TObject *Sender) -{ -char SHProfileDir[ MAX_PATH ]; - - GetSystemDirectory( SHProfileDir, MAX_PATH ); - strcat( SHProfileDir, "\\Color" ); - - OFOpenDialogProfile->InitialDir = String( SHProfileDir ); - - if( OFOpenDialogProfile->Execute() ) - { - if( mng_set_outputprofile( IFHandle, OFOpenDialogProfile->FileName.c_str()) != 0 ) - MNGerror( "libmng reported an error setting the output-profile!" ); - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuFileExitClick(TObject *Sender) -{ - if( mng_cleanup( &IFHandle ) != MNG_NOERROR ) - MNGerror( "libmng cleanup error" ); - - Close(); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuOptionsModemSpeedClick(TObject *Sender) -{ - - OFMenuOptionsModem28k8->Checked = false; - OFMenuOptionsModem33k6->Checked = false; - OFMenuOptionsModem56k->Checked = false; - OFMenuOptionsModemISDN64->Checked = false; - OFMenuOptionsModemISDN128->Checked = false; - OFMenuOptionsModemCable512->Checked = false; - OFMenuOptionsModemUnlimited->Checked = false; - - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModem28k8->Tag _DIV_ 10 ) - OFMenuOptionsModem28k8->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModem33k6->Tag _DIV_ 10 ) - OFMenuOptionsModem33k6->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModem56k->Tag _DIV_ 10 ) - OFMenuOptionsModem56k->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemISDN64->Tag _DIV_ 10 ) - OFMenuOptionsModemISDN64->Checked = true; - else - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemISDN128->Tag _DIV_ 10 ) - OFMenuOptionsModemISDN128->Checked = true; - else - /* Added - changedit was the line below ! */ -// if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemUnlimited->Tag _DIV_ 10 ) - if( IFBytesPerSec == (unsigned int)OFMenuOptionsModemCable512->Tag _DIV_ 10 ) - OFMenuOptionsModemCable512->Checked = true; - else - OFMenuOptionsModemUnlimited->Checked = true; - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OFMenuOptionsModemXClick(TObject *Sender) -{ - IFBytesPerSec = ((TMenuItem*)Sender)->Tag _DIV_ 10; -} -//--------------------------------------------------------------------------- -void TMainForm::MNGerror( String SHMsg ) -{ -/* get extended info */ -mng_uint32 iErrorcode; -mng_uint8 iSeverity; -mng_chunkid iChunkname; -mng_uint32 iChunkseq; -mng_int32 iExtra1; -mng_int32 iExtra2; -mng_pchar zErrortext; -char szFormatStr[ 256 ]; - - iErrorcode = mng_getlasterror (IFHandle, &iSeverity, - &iChunkname, &iChunkseq, &iExtra1, &iExtra2, - (mng_pchar*)&zErrortext); - - wsprintf( szFormatStr, - "Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d", - (int)iErrorcode, (int)iSeverity, (int)iChunkseq, (int)iExtra1 - ); - - MessageDlg( SHMsg + - "\n\n" + - String(zErrortext) + - "\n\n" + - szFormatStr, /* see wsprintf above */ - mtError, - TMsgDlgButtons() << mbOK, - 0 - ); - -} -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/bcb/mngview/Main.dfm b/Engine/lib/lmng/bcb/mngview/Main.dfm deleted file mode 100644 index ae72e95c17bce7b3ebd0ceeb9098b1efbd14f0c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3660 zcmd5Y}T7@m0TUE6V!@KwHwYH^54C88vzaZwK>vE#;~j!nE(xxv;uv4`x3wL6Iu zgoJ?$f1zCR6Zi|cB5~l%sYi|oAweos^S(3tF^O9tluLI#Gw;VU?=v$y@9cU~BxY-) zxzlLxw#f3rhjWCOoyKy(Y+1}}_<@^`h3q}L$F-k{X8OZSJNJOue4y>j=-ZU_2V8qX zjG8s%%=h%9ORnZSeqiW5=Wbvfmm0pumudqm2q`z_>syVD`}fSxYTFyT-7T{yy`n>@ z=R9DZ?T<`)#Ak&=vSj`!2yMr5seYx^Eq5(1EO%+Z_GJGqKX&LWDKvY&w^X;dReYKu zaLvG7E-#=+egn%@Xm3C%Ls^G1L$Xj4G8SkdUZ}?41k-pd8>m5qGA5^|r{I`~ADK*0 zf&w?1uzEqRO0|-XM5|OsmC9&2vKW=HQh^c~G}Njg+_H=Cf(anlL#tLngb-*!UAC1f z*sGvpB*1B-N*ID}KqwIhbo7Uza1#P%#6gV>=n!xjqE)LQs=y=cBj^Vjc&Zp(1SVwu zFJed-T7(Yu3wXgEc+RCwCXdP2utTmth4KFbEA=-_<#*VQkD;8xT*gqIbKztSDD$U; zd<6Yqr$M}@*QdC$E$ST@#dZTT8Rb&jt2us1KRKYmu`!2Pp6YpU2GruzfQ$l%kPB_^ zV|rZoN1g%c7`TxF*j*a3FC(m!^|sd?_#-2aK$Na@*b#NY4h@=KZ;&}EVpd1_yg+ob z=~{hiv>T!or%Yx+95UT%1dvvBBG$Awad_4q+RWx9V032c~~ zjJwwG5ai7k)_5I4iBrA|a-8x+N%;k^W0BWbu0NzWNKoKL6IB0|@)w`M*@W@w)@JlXqssQ0j0n(KMB2Ns69dR4mBZ}A@QzY(*0HkgSP}~Sm-3U162Ee&#P3af$ z7vf=XH6Y3gp%hbqloCKJ#DKVs?6Ethh}{uI>Xv}iEdZ(;0cXnN0>C*9pQF*`0p-0x zfx!OmSRQqBQLo7DE#9Hpk0g4DHsY6P=AGPz!}^|)x13F%bKgzgsZsyDX+3NQHVt6Y zmdsAz_X8S+n^sU#eLu z>LLWh26JdK%-kZX3TQ3`wTIMGfI`KSi1qf3SI)zPQ4A;IdMWk8ME6w6{9V^z2#ctcCAcEF+T!CVOv2l@QdpH8jqGiWN6{WYY?u73x|bNro{Me`+yUYj1xt+jo@bNZ{oqk;7jG|!lH zvs>R;`#>;}Ckm4;9hV?`b9zn~b7fULrY!k$CS5-x@?3)Mt!cWN_0XZWR#xTgelb$M zeC)ae;oH-M_dSQXj8j`MPJa5~PO?J^iO;AFXm6j|h5yYBukKkB51Tr(9KR2lpDH?> zR-6XI58VE-1d-;bDzncC9w)#Dr diff --git a/Engine/lib/lmng/bcb/mngview/Main.h b/Engine/lib/lmng/bcb/mngview/Main.h deleted file mode 100644 index 94dac0191..000000000 --- a/Engine/lib/lmng/bcb/mngview/Main.h +++ /dev/null @@ -1,84 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef MainH -#define MainH -//--------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -//--------------------------------------------------------------------------- -// These MUST be defined before we include "Libmng.h -# define MNG_SUPPORT_READ -# define MNG_ACCESS_CHUNKS -# define MNG_STORE_CHUNKS -# define MNG_NO_CMS -# define MNG_USE_DLL -# define MNG_SUPPORT_DISPLAY -# define MNG_SKIP_ZLIB // we don't need the zlib definitions here -# define MNG_SKIP_IJG6B // we don't need the IJG definitions here -#include "libmng.h" -//--------------------------------------------------------------------------- -class TMainForm : public TForm -{ -__published: // IDE-managed Components - TMainMenu *OFMainMenu; - TMenuItem *OFMenuFile; - TMenuItem *OFMenuFileOpen; - TMenuItem *OFMenuFileProfile; - TMenuItem *OFMenuFileN1; - TMenuItem *OFMenuFileExit; - TMenuItem *OFMenuOptions; - TMenuItem *OFMenuOptionsModemSpeed; - TMenuItem *OFMenuOptionsModem28k8; - TMenuItem *OFMenuOptionsModem33k6; - TMenuItem *OFMenuOptionsModem56k; - TMenuItem *OFMenuOptionsModemISDN64; - TMenuItem *OFMenuOptionsModemISDN128; - TMenuItem *OFMenuOptionsModemCable512; - TMenuItem *OFMenuOptionsModemUnlimited; - TOpenDialog *OFOpenDialog; - TTimer *OFTimer; - TOpenDialog *OFOpenDialogProfile; - TImage *OFImage; - TPanel *Panel1; - TProgressBar *ProgressBar1; - void __fastcall FormCreate(TObject *Sender); - void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose); - void __fastcall FormShow(TObject *Sender); - void __fastcall FormResize(TObject *Sender); - void __fastcall FormKeyDown(TObject *Sender, WORD &Key, - TShiftState Shift); - void __fastcall OFTimerTimer(TObject *Sender); - void __fastcall OFMenuFileOpenClick(TObject *Sender); - void __fastcall OFMenuFileProfileClick(TObject *Sender); - void __fastcall OFMenuFileExitClick(TObject *Sender); - void __fastcall OFMenuOptionsModemSpeedClick(TObject *Sender); - void __fastcall OFMenuOptionsModemXClick(TObject *Sender); -private: // User declarations -public : - // Data - was private in the pascal version - String SFFileName; /* filename of the input stream */ - TFileStream *OFFile; /* input stream */ - mng_handle IFHandle; /* the libray handle */ - Graphics::TBitmap *OFBitmap; /* drawing canvas */ -# ifdef TEST_RGB8_A8 - void *OFAlpha; -# endif - bool BFCancelled; /* or app-exit */ - unsigned int IFTicks; /* used to fake slow connections */ - unsigned int IFBytes; - unsigned int IFBytesPerSec; - // Methods - void MNGerror( String SHMsg ); -public: // User declarations - __fastcall TMainForm(TComponent* Owner); -}; -//--------------------------------------------------------------------------- -extern PACKAGE TMainForm *MainForm; -//--------------------------------------------------------------------------- -#endif - diff --git a/Engine/lib/lmng/bcb/mngview/MngView.bpr b/Engine/lib/lmng/bcb/mngview/MngView.bpr deleted file mode 100644 index f80283bb1..000000000 --- a/Engine/lib/lmng/bcb/mngview/MngView.bpr +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = MngView.exe -OBJFILES = MngView.obj Main.obj -RESFILES = MngView.res -DEFFILE = -RESDEPEN = $(RESFILES) Main.dfm -LIBFILES = ..\win32dll\libmng.lib -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi bcbsmp35.bpi dclocx35.bpi \ - QRPT35.bpi -# --------------------------------------------------------------------------- -PATHCPP = .; -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -Od -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx -tW -CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -CFLAG3 = -Tkh30000 -6 -PFLAGS = -U$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ - -I$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -$Y \ - -$W -$O- -v -JPHN -M -RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /i..\.. /i..\..\..\zlib \ - /i..\..\..\jpgsrc6b /mx /w2 /zd /dMNG_USE_DLL -LFLAGS = -L$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpe -x -Gn -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=2057 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=8 -Item0=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -Item1=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b;..\win32dll -Item2=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\ijgsrc6b -Item3=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\libjpeg -Item4=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\zlib -Item5=$(BCB)\include;$(BCB)\include\vcl;..\.. -Item6=$(BCB)\include;$(BCB)\include\vcl -Item7=..\..\delphi;$(BCB)\include;$(BCB)\include\vcl - -[HistoryLists\hlLibraryPath] -Count=2 -Item0=$(BCB)\lib\obj;$(BCB)\lib -Item1=..\..\delphi;$(BCB)\lib\obj;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=3 -Item0=MNG_USE_DLL -Item1=_RTLDLL -Item2=_RTLDLL;USEPACKAGES - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -[Parameters] -RunParams= -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/mngview/MngView.cpp b/Engine/lib/lmng/bcb/mngview/MngView.cpp deleted file mode 100644 index bc4624bc0..000000000 --- a/Engine/lib/lmng/bcb/mngview/MngView.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -USERES("MngView.res"); -USEFORM("Main.cpp", MainForm); -USEFILE("README.txt"); -USELIB("..\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- -WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) -{ - try - { - Application->Initialize(); - Application->CreateForm(__classid(TMainForm), &MainForm); - Application->Run(); - } - catch (Exception &exception) - { - Application->ShowException(&exception); - } - return 0; -} -//--------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/mngview/MngView.res b/Engine/lib/lmng/bcb/mngview/MngView.res deleted file mode 100644 index a596e09854a724a43bd470de4143e7d77f65d621..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 876 zcmb7@!Ait15QhKm7JAbKz1yQl-(VF3iHQ0t9u{)!90D6yrH@mOeH4!#J?>#4{%O;0 ziwokke`luO%p?Q?03{VdFNQPwS`2*2nyh21)kQuOT{9@DTPj2P&7RXH0AGmoj$ek9 zplw@%xQXaO@A&Qa6;Qp=YPX|(Td`7kT5TSirtyC7_Y+P!a`Vw>(viEJ(=%?gnsKl7 z*78a7jZwN=uQ+t;JD=){eYd_bT8C&OS6W%Mu}7}dcH=N|9Xa!%pY?OD=A8929_MQ_ z>5ubeobMd_4UXJ6<%D_KzjIy@Pq^g7=nlAcG|2_DcmTDbNiIzP!DIEbKjr=TIVUL( z-F)v;URa)@_uN^}0c$PrI%I$NIAx+G<5Md5|D3v_)`CUV{?anEIO>z}0adsJa6^S~ fh9}(N0ngMuUg!s#-ivq}GL&Wh9&bgwMHzkob9oSG diff --git a/Engine/lib/lmng/bcb/mngview/README.TXT b/Engine/lib/lmng/bcb/mngview/README.TXT deleted file mode 100644 index 28a54321a..000000000 --- a/Engine/lib/lmng/bcb/mngview/README.TXT +++ /dev/null @@ -1,22 +0,0 @@ - -Please note : - - If your project includes the header file "Rpcndr.h", then -you will then have to define "HAVE_BOOLEAN" before "libmng.h" -is included. Why ? ... - -"jmorecfg.h" has -#ifndef HAVE_BOOLEAN -typedef int boolean; -#endif - - and "Rpcndr.h" has -typedef unsigned char boolean - - This >>MAY<< affect other libraries used in the same project -that depend on the jpeg source - especially as "boolean" is -used in structures (possible alignment problems). For example -"Sam leffler's" LibTiff can be built with the Jpeg codec. - - Just a little something to be aware of !. AP - 15/9/2000. - diff --git a/Engine/lib/lmng/bcb/win32dll/libmng.bpr b/Engine/lib/lmng/bcb/win32dll/libmng.bpr deleted file mode 100644 index c02c4a645..000000000 --- a/Engine/lib/lmng/bcb/win32dll/libmng.bpr +++ /dev/null @@ -1,315 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = libmng.dll -OBJFILES = ..\..\..\obj\libmng.obj ..\..\..\obj\libmng_hlapi.obj \ - ..\..\..\obj\libmng_callback_xs.obj ..\..\..\obj\libmng_prop_xs.obj \ - ..\..\..\obj\libmng_chunk_xs.obj ..\..\..\obj\libmng_object_prc.obj \ - ..\..\..\obj\libmng_chunk_descr.obj ..\..\..\obj\libmng_chunk_prc.obj \ - ..\..\..\obj\libmng_chunk_io.obj ..\..\..\obj\libmng_read.obj \ - ..\..\..\obj\libmng_write.obj ..\..\..\obj\libmng_display.obj \ - ..\..\..\obj\libmng_dither.obj ..\..\..\obj\libmng_pixels.obj \ - ..\..\..\obj\libmng_filter.obj ..\..\..\obj\libmng_error.obj \ - ..\..\..\obj\libmng_trace.obj ..\..\..\obj\libmng_cms.obj \ - ..\..\..\obj\libmng_zlib.obj ..\..\..\obj\libmng_jpeg.obj \ - ..\..\..\obj\adler32.obj ..\..\..\obj\compress.obj ..\..\..\obj\crc32.obj \ - ..\..\..\obj\deflate.obj ..\..\..\obj\inffast.obj ..\..\..\obj\inflate.obj \ - ..\..\..\obj\inftrees.obj ..\..\..\obj\trees.obj ..\..\..\obj\uncompr.obj \ - ..\..\..\obj\zutil.obj ..\..\..\obj\jquant2.obj ..\..\..\obj\jcapistd.obj \ - ..\..\..\obj\jccoefct.obj ..\..\..\obj\jccolor.obj ..\..\..\obj\jcdctmgr.obj \ - ..\..\..\obj\jchuff.obj ..\..\..\obj\jcinit.obj ..\..\..\obj\jcmainct.obj \ - ..\..\..\obj\jcmarker.obj ..\..\..\obj\jcmaster.obj ..\..\..\obj\jcomapi.obj \ - ..\..\..\obj\jcparam.obj ..\..\..\obj\jcphuff.obj ..\..\..\obj\jcprepct.obj \ - ..\..\..\obj\jcsample.obj ..\..\..\obj\jctrans.obj ..\..\..\obj\jdapistd.obj \ - ..\..\..\obj\jdatadst.obj ..\..\..\obj\jdatasrc.obj ..\..\..\obj\jdcoefct.obj \ - ..\..\..\obj\jdcolor.obj ..\..\..\obj\jddctmgr.obj ..\..\..\obj\jdhuff.obj \ - ..\..\..\obj\jdinput.obj ..\..\..\obj\jdmainct.obj ..\..\..\obj\jdmarker.obj \ - ..\..\..\obj\jdmaster.obj ..\..\..\obj\jdmerge.obj ..\..\..\obj\jdphuff.obj \ - ..\..\..\obj\jdpostct.obj ..\..\..\obj\jdsample.obj ..\..\..\obj\jdtrans.obj \ - ..\..\..\obj\jerror.obj ..\..\..\obj\jfdctflt.obj ..\..\..\obj\jfdctfst.obj \ - ..\..\..\obj\jfdctint.obj ..\..\..\obj\jidctflt.obj ..\..\..\obj\jidctfst.obj \ - ..\..\..\obj\jidctint.obj ..\..\..\obj\jidctred.obj ..\..\..\obj\jmemmgr.obj \ - ..\..\..\obj\jmemnobs.obj ..\..\..\obj\jquant1.obj ..\..\..\obj\jcapimin.obj \ - ..\..\..\obj\jutils.obj ..\..\..\obj\jdapimin.obj -RESFILES = libmng.res -RESDEPEN = $(RESFILES) -LIBFILES = ..\..\..\lcms\Projects\Bcc-5.5-static\lcmsstat.lib -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = vclx35.bpi VCL35.bpi vcldb35.bpi vcldbx35.bpi bcbsmp35.bpi dclocx35.bpi \ - Qrpt35.bpi -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -WD -O2 -Hc -w- -d -k- -vi -w-par -c -tWD -CFLAG2 = -D_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL \ - -I"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin \ - -H=$(BCB)\lib\vcl35.csm -CFLAG3 = -Tkh30000 -ff -pr -wuse -wucp -wstv -wstu -wsig -wpin -wnod -wnak -wdef -wcln \ - -wbbf -wasm -wamp -wamb -PFLAGS = -D_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL \ - -N2..\..\..\obj -N0..\..\..\obj \ - -U"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin;$(RELEASELIBPATH) \ - -I"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin \ - -H -W -$L- -$D- -v -JPHN -M -RFLAGS = -D_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_OPTIMIZE_CHUNKREADER;XMNG_OPTIMIZE_DISPLAYCALLS;XMNG_INCLUDE_MPNG_PROPOSAL;XMNG_INCLUDE_ANG_PROPOSAL \ - -i"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -AFLAGS = /i"c:\program files\borland\cbuilder3\projects" /i..\..\..\libmng-devel \ - /i..\..\..\zlib /i..\..\..\jpgsrc6b /i..\..\..\lcms\include /i..\..\..\lcms\src \ - /i$(BCB)\include /i$(BCB)\bin /d_NO_VCL /dMNG_BUILD_DLL /dMNG_FULL_CMS \ - /dMNG_STRICT_ANSI /dMNG_CHECK_BAD_ICCP /dZLIB_DLL /dZLIB_WINAPI \ - /dMNG_OPTIMIZE_FOOTPRINT_COMPOSE /dMNG_OPTIMIZE_FOOTPRINT_DIV \ - /dMNG_OPTIMIZE_FOOTPRINT_SWITCH /dXMNG_DECREMENT_LOOPS \ - /dMNG_OPTIMIZE_FOOTPRINT_INIT /dXMNG_OPTIMIZE_FOOTPRINT_MAGN \ - /dMNG_OPTIMIZE_OBJCLEANUP /dMNG_OPTIMIZE_CHUNKINITFREE \ - /dMNG_OPTIMIZE_CHUNKASSIGN /dMNG_OPTIMIZE_CHUNKREADER \ - /dXMNG_OPTIMIZE_DISPLAYCALLS /dXMNG_INCLUDE_MPNG_PROPOSAL \ - /dXMNG_INCLUDE_ANG_PROPOSAL /mx /w2 /zd -LFLAGS = -L"c:\program files\borland\cbuilder3\projects";..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin;$(RELEASELIBPATH) \ - -H:0x1000000 -Hc:0x10000 -B:0x60000000 -aa -Tpd -s -Gn -Gi -M -wdpl -d -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0d32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) import32.lib cw32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=1 -MajorVer=1 -MinorVer=0 -Release=10 -Build=1440 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=1 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName=PNG/MNG Group -FileDescription=libmng - THE MNG library -FileVersion=1.0.10.1440 -InternalName=libmng -LegalCopyright=Copyright © 2000-2007 G. Juyn, 2007 G.Randers-Pherson -LegalTrademarks= -OriginalFilename=libmng.dll -ProductName=libmng -ProductVersion=1.0.10 -Comments= - -[HistoryLists\hlIncludePath] -Count=12 -Item0=c:\program files\borland\cbuilder3\projects;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item1=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item2=c:\program files\borland\cbuilder3\projects;..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item3=..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\include;$(BCB)\bin -Item4=..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;$(BCB)\include;$(BCB)\bin -Item5=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;$(BCB)\include;$(BCB)\bin -Item6=..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;$(BCB)\include;$(BCB)\bin -Item7=..\..\..\..\jpgsrc6b;..\..\..\..\lcms\include;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\include;$(BCB)\bin -Item8=..\..\..\..\lcms\include;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\include;$(BCB)\bin -Item9=..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\include;$(BCB)\bin -Item10=..\..\libmng;$(BCB)\include;$(BCB)\bin -Item11=..\..\libmng;$(BCB)\include - -[HistoryLists\hlLibraryPath] -Count=12 -Item0=c:\program files\borland\cbuilder3\projects;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin -Item1=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\include;..\..\..\lcms\src;$(BCB)\lib;$(BCB)\bin -Item2=c:\program files\borland\cbuilder3\projects;..\..\..\lcms\src;..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item3=..\..\..\lcms\src;..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item4=..\..\..\libmng;..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item5=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;$(BCB)\lib;$(BCB)\bin -Item6=..\..\..\libmng;..\..\..\jpgsrc6b;..\..\..\zlib;$(BCB)\lib;$(BCB)\bin -Item7=..\..\..\..\jpgsrc6b;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item8=..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item9=..\..\..\..\zlib;..\..\..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item10=..\..\libmng;$(BCB)\lib;$(BCB)\bin -Item11=..\..\libmng;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=7 -Item0=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\src -Item1=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\source;..\..\..\lcms\src -Item2=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\source -Item3=..\..\..\jpgsrc6b;..\..\..\lcms\source;..\..\..\zlib;..\..\..\libmng -Item4=..\..\..\..\jpgsrc6b;..\..\..\..\lcms\source;..\..\..\..\zlib;..\..\..\..\libmng -Item5=..\..\..\..\libmng -Item6=..\..\libmng - -[HistoryLists\hlConditionals] -Count=30 -Item0=_NO_VCL;MNG_BUILD_DLL;MNG_FULL_CMS;MNG_STRICT_ANSI;MNG_CHECK_BAD_ICCP;ZLIB_DLL;ZLIB_WINAPI;MNG_OPTIMIZE_FOOTPRINT_COMPOSE;MNG_OPTIMIZE_FOOTPRINT_DIV;MNG_OPTIMIZE_FOOTPRINT_SWITCH;XMNG_DECREMENT_LOOPS;MNG_OPTIMIZE_FOOTPRINT_INIT;XMNG_OPTIMIZE_FOOTPRINT_MAGN;MNG_OPTIMIZE_OBJCLEANUP;MNG_OPTIMIZE_CHUNKINITFREE;MNG_OPTIMIZE_CHUNKASSIGN;MNG_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HistoryLists\hlIntOutputDir] -Count=2 -Item0=..\..\..\obj -Item1=..\..\..\..\obj - -[HistoryLists\hlHostApplication] -Count=23 -Item0=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngview.exe -Item1=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\MNGJNGportal.exe -Item2=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\gif2mng.exe -Item3=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngview_push.exe -Item4=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngtree.exe -Item5=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngdump.exe -Item6=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\lm_diag.exe -Item7=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\eMNGma.exe -Item8=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\bogus.exe -Item9=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\TestNGImage.exe -Item10=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngrepair.exe -Item11=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\Test_lz.exe -Item12=D:\Triple-T\Software\LossyPNG\Bin\Test_lz.exe -Item13=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\SlowView.exe -Item14=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\Bin\eMNGma.exe -Item15=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngpromo.exe -Item16=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\mngdump.exe -Item17=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\mngview.exe -Item18=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\bogus.exe -Item19=D:\Triple-T\Software\mnglib3t\libmng\bcb\win32dll\mngtree.exe -Item20=D:\Triple-T\Software\mnglib3t\libmng\samples\bcb\win32dll\mngview.exe -Item21=D:\Triple-T\Software\mnglib3t\libmng\samples\bcb\win32dll\mngdump.exe -Item22=D:\Triple-T\Software\mnglib3t\libmng\samples\Delphi3\mngdump\mngdump.exe - -[HistoryLists\hlRunParameters] -Count=3 -Item0=sample.mng -Item1=roilion02.mng roilion02-fixed.mng -Item2=usflag-lc-d63.mng - -[Debugging] -DebugSourceDirs=..\..\..\libmng-devel;..\..\..\zlib;..\..\..\jpgsrc6b;..\..\..\lcms\src - -[Parameters] -RunParams= -HostApplication=D:\Triple-T\Software\mnglib3t\libmng-devel\bcb\win32dll\mngview.exe - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/bcb/win32dll/libmng.cpp b/Engine/lib/lmng/bcb/win32dll/libmng.cpp deleted file mode 100644 index 5ba4a8a89..000000000 --- a/Engine/lib/lmng/bcb/win32dll/libmng.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2007 Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn * */ -/* * (hopefully some more to come...) * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng.cpp copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : generic dll project assembly file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * web : http://www.3-t.com * */ -/* * email : mailto:info@3-t.com * */ -/* * * */ -/* * comment : Autogenerated file with the libmng.dll BCB project * */ -/* * * */ -/* * changes : 0.5.1 - 05/14/2000 - G.Juyn * */ -/* * - added this block * */ -/* * * */ -/* * 1.0.5 - 08/20/2000 - G.Juyn * */ -/* * - version-number & copyright * */ -/* * * */ -/* ************************************************************************** */ - -#include -#pragma hdrstop -#include - -/* ************************************************************************** */ - -USERES("libmng.res"); -USEUNIT("..\..\libmng_hlapi.c"); -USEUNIT("..\..\libmng_callback_xs.c"); -USEUNIT("..\..\libmng_prop_xs.c"); -USEUNIT("..\..\libmng_chunk_xs.c"); -USEUNIT("..\..\libmng_object_prc.c"); -USEUNIT("..\..\libmng_chunk_descr.c"); -USEUNIT("..\..\libmng_chunk_prc.c"); -USEUNIT("..\..\libmng_chunk_io.c"); -USEUNIT("..\..\libmng_read.c"); -USEUNIT("..\..\libmng_write.c"); -USEUNIT("..\..\libmng_display.c"); -USEUNIT("..\..\libmng_dither.c"); -USEUNIT("..\..\libmng_pixels.c"); -USEUNIT("..\..\libmng_filter.c"); -USEUNIT("..\..\libmng_error.c"); -USEUNIT("..\..\libmng_trace.c"); -USEUNIT("..\..\libmng_cms.c"); -USEUNIT("..\..\libmng_zlib.c"); -USEUNIT("..\..\libmng_jpeg.c"); -USEUNIT("..\..\..\zlib\adler32.c"); -USEUNIT("..\..\..\zlib\compress.c"); -USEUNIT("..\..\..\zlib\crc32.c"); -USEUNIT("..\..\..\zlib\deflate.c"); -USEUNIT("..\..\..\zlib\inffast.c"); -USEUNIT("..\..\..\zlib\inflate.c"); -USEUNIT("..\..\..\zlib\inftrees.c"); -USEUNIT("..\..\..\zlib\trees.c"); -USEUNIT("..\..\..\zlib\uncompr.c"); -USEUNIT("..\..\..\zlib\zutil.c"); -USEUNIT("..\..\..\jpgsrc6b\jquant2.c"); -USEUNIT("..\..\..\jpgsrc6b\jcapistd.c"); -USEUNIT("..\..\..\jpgsrc6b\jccoefct.c"); -USEUNIT("..\..\..\jpgsrc6b\jccolor.c"); -USEUNIT("..\..\..\jpgsrc6b\jcdctmgr.c"); -USEUNIT("..\..\..\jpgsrc6b\jchuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jcinit.c"); -USEUNIT("..\..\..\jpgsrc6b\jcmainct.c"); -USEUNIT("..\..\..\jpgsrc6b\jcmarker.c"); -USEUNIT("..\..\..\jpgsrc6b\jcmaster.c"); -USEUNIT("..\..\..\jpgsrc6b\jcomapi.c"); -USEUNIT("..\..\..\jpgsrc6b\jcparam.c"); -USEUNIT("..\..\..\jpgsrc6b\jcphuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jcprepct.c"); -USEUNIT("..\..\..\jpgsrc6b\jcsample.c"); -USEUNIT("..\..\..\jpgsrc6b\jctrans.c"); -USEUNIT("..\..\..\jpgsrc6b\jdapistd.c"); -USEUNIT("..\..\..\jpgsrc6b\jdatadst.c"); -USEUNIT("..\..\..\jpgsrc6b\jdatasrc.c"); -USEUNIT("..\..\..\jpgsrc6b\jdcoefct.c"); -USEUNIT("..\..\..\jpgsrc6b\jdcolor.c"); -USEUNIT("..\..\..\jpgsrc6b\jddctmgr.c"); -USEUNIT("..\..\..\jpgsrc6b\jdhuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jdinput.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmainct.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmarker.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmaster.c"); -USEUNIT("..\..\..\jpgsrc6b\jdmerge.c"); -USEUNIT("..\..\..\jpgsrc6b\jdphuff.c"); -USEUNIT("..\..\..\jpgsrc6b\jdpostct.c"); -USEUNIT("..\..\..\jpgsrc6b\jdsample.c"); -USEUNIT("..\..\..\jpgsrc6b\jdtrans.c"); -USEUNIT("..\..\..\jpgsrc6b\jerror.c"); -USEUNIT("..\..\..\jpgsrc6b\jfdctflt.c"); -USEUNIT("..\..\..\jpgsrc6b\jfdctfst.c"); -USEUNIT("..\..\..\jpgsrc6b\jfdctint.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctflt.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctfst.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctint.c"); -USEUNIT("..\..\..\jpgsrc6b\jidctred.c"); -USEUNIT("..\..\..\jpgsrc6b\jmemmgr.c"); -USEUNIT("..\..\..\jpgsrc6b\jmemnobs.c"); -USEUNIT("..\..\..\jpgsrc6b\jquant1.c"); -USEUNIT("..\..\..\jpgsrc6b\jcapimin.c"); -USEUNIT("..\..\..\jpgsrc6b\jutils.c"); -USEUNIT("..\..\..\jpgsrc6b\jdapimin.c"); -USELIB("..\..\..\lcms\Projects\Bcc-5.5-static\lcmsstat.lib"); -//--------------------------------------------------------------------------- -#pragma argsused -int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) -{ - return 1; -} -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/bcb/win32dll/libmng.dll b/Engine/lib/lmng/bcb/win32dll/libmng.dll deleted file mode 100644 index 50c4e8250efbc0c4e788e19a14c8d71b165259e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 211456 zcmeFYc{JPI_b8k>K}ZmU2GImTN)QBT#Smf$5wmJbYb-^HqO?K`8A?OVRXWctogRwT zSmNoRGab>U)m8`f^eI|xZu&1sjCv5{%_6x|FZw@JiuWB00BTSz;L9-`+xrH zG@$B;8W5xp0D%7l0sugP0w}HsB@I>nlo$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Md*_`*V+ELOJI3LO_b39gL?s^BOlxE=x)*OB{nA68yAE69w!uwmT< zJaVGFqaDNZ!3T}>^lM4KqJJrI&UHCMxwcHPQ5vpN8z_r4ofM8?QdvFde2JL4($liS zJ*RmH?tu2LiDH@191v-vYl+V3uBY`lt72b=j~Xk#xwSM($E&Nj+LGt?lp}|(-h2Ai zZDsXB^KVE%TqP6+_=SOOb>3iv<0GfW4oXh0rYeh~d=>>WI%YU_(dsJ6OGBKyu)pGn zLP#V7<5HJ(DMuKVy4tLE7!)#|pEgNc3K2-t);N#W>teHHbEQI#t!XRWMwO+~R{AnM zGjf7{Bk>PCPv3jfhxh$x2}C=V!Uj>XF7?j~Vv3mY7 zWMzJLgbj@iP)}a=@m$EZ5xG*9_Yi%ia8k7+QdEk12 zG!){_rCRDhvK88DrGpFpI5$FcK|9|?me{2M=JcP`Dcm7Cn@bE%?NWBMAVH|1CtXwE zmY`H#dWLko^i?AS9FH#gVEmN>p8ph`JaNe>WoPVnozMiK>ecQI|lR z=NT7uQKIT%MASuzs*4g;7bU7LMnn~ipzFM@M!FeTcI2nDu4W^yqeK7!j2+()BHiN~w*ilq2SeP?fJpMVJCr znQ3U1nn1mjlplm#Nf0OcvRs@!#ayY_;eX4O3W~WBGWYu<$H|W zafz{%q@@~K^i%0}!w2qf16ghjIq -#pragma hdrstop -# include - -#include "Main.h" - -//--------------------------------------------------------------------------- -mng_ptr __stdcall TMainForm::Alloc( mng_size_t iSize ) -{ - return (mng_ptr)calloc( 1, (size_t)iSize ); -} -//--------------------------------------------------------------------------- -void __stdcall TMainForm::Free( mng_ptr pPtr, mng_size_t iSize ) -{ - free( pPtr ); - return; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::FileReadData( mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead ) -{ -TMainForm *MainForm = (TMainForm *)mng_get_userdata( hMNG ); - - *iRead = fread( pBuf, 1, iSize, MainForm->GetFd() ); - - // iRead will indicate EOF - - MainForm->ProgressBar1->Position += (int)iRead; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::ProcessHeader( mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight ) -{ -TMainForm *MainForm = (TMainForm *)mng_get_userdata( hHandle ); - - MainForm->Caption = ExtractFileName( MainForm->OpenDialog1->FileName ) + - " [" + - String( iWidth ) + - "x" + - String( iHeight ) + - "]"; - - Application->Title = MainForm->asAppName + " " + MainForm->Caption; - - MainForm->ProgressBar1->Max = iWidth * iHeight; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::OpenStream( mng_handle hMNG ) -{ - // nothing to do ! - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::CloseStream( mng_handle hMNG ) -{ - MainForm->ProgressBar1->Position = 0; - - return MNG_TRUE; -} -//--------------------------------------------------------------------------- -mng_bool __stdcall TMainForm::IterateChunks( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq ) -{ -TMainForm *MainForm = (TMainForm *)mng_get_userdata( hMNG ); -char aCh[5]; - - // decode the chunkname - aCh[0] = (char)((iChunktype >> 24) & 0xFF); - aCh[1] = (char)((iChunktype >> 16) & 0xFF); - aCh[2] = (char)((iChunktype >> 8) & 0xFF); - aCh[3] = (char)((iChunktype ) & 0xFF); - aCh[4] = (char)0; // zero terminate - used as a "C" string below - - MainForm->RichEditReport->Lines->Add( "" ); - - MainForm->RichEditReport->Lines->Add( - "Chunk " + String( iChunkseq + 1 ) + " : " + String( aCh ) ); - - // Add Chunk text to listbox - MainForm->ListBoxChunks->Items->Add( aCh ); - - // keep'm coming ... unless we encounter an error - return MainForm->ShowChunk( hMNG, hChunk, iChunktype ); -} -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.H b/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.H deleted file mode 100644 index 224a3130c..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/CALLBACK.H +++ /dev/null @@ -1,39 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#include "Main.h" -#include "libmng.h" -#pragma hdrstop - -#ifndef CallbackH -#define CallbackH - -//--------------------------------------------------------------------------- -extern mng_ptr __stdcall myalloc( mng_size_t iSize ); -//--------------------------------------------------------------------------- -extern void __stdcall myfree( mng_ptr pPtr, mng_size_t iSize ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myreaddata( mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall ProcessHeader( mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myopenstream( mng_handle hMNG ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myclosestream( mng_handle hMNG ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall myiterchunk ( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq ); -//--------------------------------------------------------------------------- -extern mng_bool __stdcall mytraceproc( mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname ); -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -#endif diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP b/Engine/lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP deleted file mode 100644 index 16a7f1a07..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/CHUNKS.CPP +++ /dev/null @@ -1,1689 +0,0 @@ -// -// Chunks.cpp -// -// The following functions are to assemble a string for each chunk -// The function name "Info_????" denote which chunk it handles -// -// Comments marked @todo@ may, or maynot, be filled in at a later date ! -// -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -#include "Main.h" - -# define xUSE_UNKNOWN // remove "x" to report of "UNKNOWN" - else "" - -# define FFACTOR ((float)100000.0) - -// NB We must use Octal for RichEdit's newlines - MicroSoft love Octal ! -# define nl "\015\012" -# define TAB asTab - -// Ps : If anyone reading this knows how to do this using token -// pasting please let me know ! (AP) - -// ConCat newline to string -# define NL as = as + nl - -// Integer ARGuement -# define IARG( _str_, _int_ )\ - as = as + TAB + (_str_) + " " + String( _int_ ) - -// Bool ARGuement -# define BARG( _str_, _bool_ )\ - if( WantsBool() )\ - as = as + TAB + (_str_) + " " + ((_bool_) ? "true" : "false");\ - else\ - as = as + TAB + (_str_) + " " + IntToStr( _bool_ ); - -// Float ARGuement -# define FARG( _str_, _float_ )\ - as = as + TAB + (_str_) + " " + String( _float_ ) - -// szText ARGuement -# define ZARG( _str_, _sz_ )\ - as = as + TAB + (_str_) + " \"" + String( _sz_ ) + "\"" - -// Concat general strings -# define STR( _str_ ) as = as + _str_ - -// Concat Hex string -# define HEXSTR( _str_ ) as = as + IntToHex(_str_,2) - -// Concat Macro Identifier to ARG -#define MI( _str_ ) as = as + TAB + _str_; - -// Concat "(" Comment ")" to ARG -#define PCOM( _str_ )\ - if( WantsComments() ) as = as + TAB + "(" + _str_ + ")"; - -// Concat "float(" Comment ")" to ARG -#define FPCOM( _str_ )\ - if( WantsComments() ) as = as + TAB + "float(" + _str_ + ")"; - -//--------------------------------------------------------------------------- -// Macro Identifiers - these, below, are used several times -// NB those used once have local #define's and #undef's -//--------------------------------------------------------------------------- - -# ifdef USE_UNKNOWN -# define UNKNOWN "UNKNOWN" -# else -# define UNKNOWN "" -# endif -// Does this need two to be more visible ? -# define ILLEGAL_VALUE ">> ILLEGAL VALUE << " - -// IHDR, BASI, JHDR, PROM, sPLT -# define MI_BITDEPTH( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_BITDEPTH_1 : MI( "MNG_BITDEPTH_1" ); break;\ - case MNG_BITDEPTH_2 : MI( "MNG_BITDEPTH_2" ); break;\ - case MNG_BITDEPTH_4 : MI( "MNG_BITDEPTH_4" ); break;\ - case MNG_BITDEPTH_8 : MI( "MNG_BITDEPTH_8" ); break;\ - case MNG_BITDEPTH_16 : MI( "MNG_BITDEPTH_16" ); break;\ - default : MI(ILLEGAL_VALUE);\ - } - -// IHDR, BASI, PROM -# define MI_COLORTYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_COLORTYPE_GRAY : MI( "MNG_COLORTYPE_GRAY" ); break;\ - case MNG_COLORTYPE_RGB : MI( "MNG_COLORTYPE_RGB" ); break;\ - case MNG_COLORTYPE_INDEXED : MI( "MNG_COLORTYPE_INDEXED" ); break;\ - case MNG_COLORTYPE_GRAYA : MI( "MNG_COLORTYPE_GRAYA" ); break;\ - case MNG_COLORTYPE_RGBA : MI( "MNG_COLORTYPE_RGBA" ); break;\ - default : MI(ILLEGAL_VALUE);\ - } - -// IHDR, zTXt, iTXt, iCCP, BASI, JHDR -# define MI_COMPRESSION_DEFLATE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_COMPRESSION_DEFLATE ) {\ - MI( "MNG_COMPRESSION_DEFLATE" );\ - } else {\ - MI( ILLEGAL_VALUE );\ - }\ - } - -// IHDR, BASI, JHDR -# define MI_FILTER( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_FILTER_ADAPTIVE : MI( "MNG_FILTER_ADAPTIVE" ); break;\ - case MNG_FILTER_NO_ADAPTIVE : MI( "MNG_FILTER_NO_ADAPTIVE" ); break;\ - case MNG_FILTER_DIFFERING : MI( "MNG_FILTER_DIFFERING" ); break;\ - case MNG_FILTER_MASK : MI( "MNG_FILTER_MASK" ); break;\ - default : MI(UNKNOWN);\ - } - //NB MNG_FILTER_NO_DIFFERING == MNG_FILTER_ADAPTIVE - -// IHDR, BASI, JHDR -#define MI_INTERLACE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_INTERLACE_NONE ) {\ - MI( "MNG_INTERLACE_NONE" )\ - } else if( (_i_) == MNG_INTERLACE_ADAM7 ) {\ - MI( "MNG_INTERLACE_ADAM7" );\ - } else { MI(ILLEGAL_VALUE);} \ - } - -// pHYs, pHYg -#define MI_UNITS( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_UNIT_UNKNOWN ) {\ - MI( "MNG_UNIT_UNKNOWN" )\ - } else if( (_i_) == MNG_UNIT_METER ) {\ - MI( "MNG_UNIT_METER" );\ - } else { MI(UNKNOWN);} \ - } - -// CLON & MOVE -#define MI_LOCATION( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_LOCATION_ABSOLUTE ) {\ - MI( "MNG_LOCATION_ABSOLUTE" )\ - } else if( (_i_) == MNG_LOCATION_RELATIVE ) {\ - MI( "MNG_LOCATION_RELATIVE" );\ - } else { MI(ILLEGAL_VALUE);} \ - } - -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_BACK( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -// NB for BACKGROUND other values are only advisory -#define MI_BACKGROUND( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_BACKGROUNDCOLOR_MANDATORY ) {\ - MI( "MNG_BACKGROUNDCOLOR_MANDATORY" )\ - } else if( (_i_) == MNG_BACKGROUNDIMAGE_MANDATORY ) {\ - MI( "MNG_BACKGROUNDIMAGE_MANDATORY" );\ - } \ - } - -# define MI_BACKGROUND_TILE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_BACKGROUNDIMAGE_NOTILE : MI( "MNG_BACKGROUNDIMAGE_NOTILE" ); break;\ - case MNG_BACKGROUNDIMAGE_TILE : MI( "MNG_BACKGROUNDIMAGE_TILE" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; -mng_uint8 iMandatory; -mng_uint16 iImageid; -mng_uint8 iTile; - - if( mng_getchunk_back( hMNG, hChunk, - &iRed, &iGreen, &iBlue, - &iMandatory, &iImageid, &iTile ) != 0 ) - return false; - - IARG( "iRed", iRed ); - NL; IARG( "iGreen",iGreen ); - NL; IARG( "iBlue", iBlue ); - NL; IARG( "iMandatory", iMandatory ); MI_BACKGROUND( iMandatory ); - NL; IARG( "iImageid", iImageid ); - NL; IARG( "iTile", iTile ); MI_BACKGROUND_TILE( iTile ); - - return true; -# undef MI_BACKGROUND -# undef MI_BACKGROUND_TILE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_BASI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -#define MI_VIEWABLE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_NOTVIEWABLE ) {\ - MI( "MNG_NOTVIEWABLE" )\ - } else if( (_i_) == MNG_VIEWABLE ) {\ - MI( "MNG_VIEWABLE" );\ - } else { MI(UNKNOWN);} \ - } -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint8 iBitdepth; -mng_uint8 iColortype; -mng_uint8 iCompression; -mng_uint8 iFilter; -mng_uint8 iInterlace; -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; -mng_uint16 iAlpha; -mng_uint8 iViewable; - - if( mng_getchunk_basi( hMNG, hChunk, - &iWidth, &iHeight, &iBitdepth, &iColortype, - &iCompression, &iFilter, &iInterlace, - &iRed, &iGreen, &iBlue, &iAlpha, - &iViewable ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iBitdepth", iBitdepth ); MI_BITDEPTH( iBitdepth ); - NL; IARG( "iColortype", iColortype ); MI_COLORTYPE( iColortype ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iFilter", iFilter ); MI_FILTER( iFilter ); - NL; IARG( "iInterlace", iInterlace ); MI_INTERLACE( iInterlace ); - NL; IARG( "iRed", iRed ); - NL; IARG( "iGreen", iGreen ); - NL; IARG( "iBlue", iBlue ); - NL; IARG( "iAlpha", iAlpha ); - NL; IARG( "iViewable", iViewable ); MI_VIEWABLE( iViewable ); - - return true; -# undef MI_VIEWABLE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_CLIP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_CLIPPING( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CLIPPING_ABSOLUTE : MI( "MNG_CLIPPING_ABSOLUTE" ); break;\ - case MNG_CLIPPING_RELATIVE : MI( "MNG_CLIPPING_RELATIVE" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint8 iCliptype; -mng_int32 iClipl; -mng_int32 iClipr; -mng_int32 iClipt; -mng_int32 iClipb; - - if( mng_getchunk_clip( hMNG, hChunk, - &iFirstid, &iLastid, - &iCliptype, &iClipl, &iClipr, &iClipt, &iClipb ) != 0 ) - return false; - - IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iCliptype", iCliptype ); MI_CLIPPING( iCliptype ); - NL; IARG( "iClipl", iClipl ); - NL; IARG( "iClipr", iClipr ); - NL; IARG( "iClipt", iClipt ); - NL; IARG( "iClipb", iClipb ); - - return true; -# undef MI_CLIPPING -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_CLON( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_CLONTYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_FULL_CLONE : MI( "MNG_FULL_CLONE" ); break;\ - case MNG_PARTIAL_CLONE : MI( "MNG_PARTIAL_CLONE" ); break;\ - case MNG_RENUMBER : MI( "MNG_RENUMBER" ); break;\ - default : MI(UNKNOWN);\ - } - -#define MI_CLON_CONCRETE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_CONCRETE_ASPARENT ) {\ - MI( "MNG_CONCRETE_ASPARENT" )\ - } else if( (_i_) == MNG_CONCRETE_MAKEABSTRACT ) {\ - MI( "MNG_CONCRETE_MAKEABSTRACT" );\ - } else { MI(UNKNOWN);} \ - } - -mng_uint16 iSourceid; -mng_uint16 iCloneid; -mng_uint8 iClonetype; -mng_uint8 iDonotshow; -mng_uint8 iConcrete; -mng_bool bHasloca; -mng_uint8 iLocationtype; -mng_int32 iLocationx; -mng_int32 iLocationy; - - if( mng_getchunk_clon( hMNG, hChunk, - &iSourceid, &iCloneid, &iClonetype, &iDonotshow, - &iConcrete, &bHasloca, - &iLocationtype, &iLocationx, &iLocationy ) != 0 ) - return false; - - IARG( "iSourceid", iSourceid ); - NL; IARG( "iCloneid", iCloneid ); - NL; IARG( "iClonetype", iClonetype ); MI_CLONTYPE( iClonetype ); - NL; IARG( "iDonotshow", iDonotshow ); - NL; IARG( "iConcrete", iConcrete ); MI_CLON_CONCRETE( iConcrete ); - NL; BARG( "bHasloca", bHasloca ); - NL; IARG( "iLocationtype", iLocationtype ); MI_LOCATION( iLocationtype ); - NL; IARG( "iLocationx", iLocationx ); - NL; IARG( "iLocationy", iLocationy ); - - return true; -# undef MI_CLONTYPE -# undef MI_CLON_CONCRETE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DBYK( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_POLARITY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_POLARITY_ONLY : MI( "MNG_POLARITY_ONLY" ); break;\ - case MNG_POLARITY_ALLBUT : MI( "MNG_POLARITY_ALLBUT" ); break;\ - default : MI(UNKNOWN);\ - } -mng_chunkid iChunkname; -mng_uint8 iPolarity; -mng_uint32 iKeywordssize; -mng_pchar zKeywords; - - if( mng_getchunk_dbyk( hMNG, hChunk, - &iChunkname, &iPolarity, &iKeywordssize, &zKeywords ) != 0 ) - return false; - - IARG( "iChunkname", iChunkname ); // show chunk name ? @todo@ - NL; IARG( "iPolarity", iPolarity ); MI_POLARITY( iPolarity ); - NL; IARG( "iKeywordssize", iKeywordssize ); - NL; ZARG( "zKeywords", zKeywords ); - - return true; -# undef MI_POLARITY -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DEFI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -#define MI_DONOTSHOW( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_DONOTSHOW_VISIBLE ) {\ - MI( "MNG_DONOTSHOW_VISIBLE" )\ - } else if( (_i_) == MNG_DONOTSHOW_NOTVISIBLE ) {\ - MI( "MNG_DONOTSHOW_NOTVISIBLE" );\ - }\ - } - -#define MI_DEFI_CONCRETE( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_ABSTRACT ) {\ - MI( "MNG_ABSTRACT" )\ - } else if( (_i_) == MNG_CONCRETE ) {\ - MI( "MNG_CONCRETE" );\ - }\ - } -mng_uint16 iObjectid; -mng_uint8 iDonotshow; -mng_uint8 iConcrete; -mng_bool bHasloca; -mng_int32 iXlocation; -mng_int32 iYlocation; -mng_bool bHasclip; -mng_int32 iLeftcb; -mng_int32 iRightcb; -mng_int32 iTopcb; -mng_int32 iBottomcb; - - if( mng_getchunk_defi( hMNG, hChunk, - &iObjectid, &iDonotshow, &iConcrete, - &bHasloca, &iXlocation, &iYlocation, - &bHasclip, &iLeftcb, &iRightcb, &iTopcb, &iBottomcb ) != 0 ) - return false; - - IARG( "iObjectid", iObjectid ); - NL; IARG( "iDonotshow", iDonotshow ); MI_DONOTSHOW( iDonotshow ); - NL; IARG( "iConcrete", iConcrete ); MI_DEFI_CONCRETE( iConcrete ); - NL; BARG( "bHasloca", bHasloca ); - NL; IARG( "iXlocation", iXlocation ); - NL; IARG( "iYlocation", iYlocation ); - NL; BARG( "bHasclip", bHasclip ); - NL; IARG( "iLeftcb", iLeftcb ); - NL; IARG( "iRightcb", iRightcb ); - NL; IARG( "iTopcb", iTopcb ); - NL; IARG( "iBottomcb", iBottomcb ); - - return true; -# undef MI_DONOTSHOW -# undef MI_DEFI_CONCRETE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DHDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_IMAGETYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_IMAGETYPE_UNKNOWN : MI( "MNG_IMAGETYPE_UNKNOWN" ); break;\ - case MNG_IMAGETYPE_PNG : MI( "MNG_IMAGETYPE_PNG" ); break;\ - case MNG_IMAGETYPE_JNG : MI( "MNG_IMAGETYPE_JNG" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_DELTATYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_DELTATYPE_REPLACE : MI( "MNG_DELTATYPE_REPLACE" ); break;\ - case MNG_DELTATYPE_BLOCKPIXELADD : MI( "MNG_DELTATYPE_BLOCKPIXELADD" ); break;\ - case MNG_DELTATYPE_BLOCKALPHAADD : MI( "MNG_DELTATYPE_BLOCKALPHAADD" ); break;\ - case MNG_DELTATYPE_BLOCKCOLORADD : MI( "MNG_DELTATYPE_BLOCKCOLORADD" ); break;\ - case MNG_DELTATYPE_BLOCKPIXELREPLACE : MI( "MNG_DELTATYPE_BLOCKPIXELREPLACE" ); break;\ - case MNG_DELTATYPE_BLOCKALPHAREPLACE : MI( "MNG_DELTATYPE_BLOCKALPHAREPLACE" ); break;\ - case MNG_DELTATYPE_BLOCKCOLORREPLACE : MI( "MNG_DELTATYPE_BLOCKCOLORREPLACE" ); break;\ - case MNG_DELTATYPE_NOCHANGE : MI( "MNG_DELTATYPE_NOCHANGE" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_uint16 iObjectid; -mng_uint8 iImagetype; -mng_uint8 iDeltatype; -mng_uint32 iBlockwidth; -mng_uint32 iBlockheight; -mng_uint32 iBlockx; -mng_uint32 iBlocky; - - if( mng_getchunk_dhdr( hMNG, hChunk, - &iObjectid, &iImagetype, &iDeltatype, - &iBlockwidth, &iBlockheight, &iBlockx, &iBlocky ) != 0 ) - return false; - - IARG( "iObjectid", iObjectid ); - NL; IARG( "iImagetype", iImagetype ); MI_IMAGETYPE( iImagetype ); - NL; IARG( "iDeltatype", iDeltatype ); MI_DELTATYPE( iDeltatype ); - NL; IARG( "iBlockwidth", iBlockwidth ); - NL; IARG( "iBlockheight", iBlockheight ); - NL; IARG( "iBlockx", iBlockx ); - NL; IARG( "iBlocky", iBlocky ); - - return true; -# undef MI_IMAGETYPE -# undef MI_DELTATYPE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DISC( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; -mng_uint16p pObjectids; - - if( mng_getchunk_disc( hMNG, hChunk, &iCount, &pObjectids ) != 0 ) - return false; - - IARG( "iCount", iCount ); - //pObjectids pObjectids - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_DROP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; -mng_chunkidp pChunknames; - - if( mng_getchunk_drop( hMNG, hChunk, &iCount, &pChunknames ) != 0 ) - return false; - - IARG( "iCount", iCount ); - // pChunknamesp Chunknames // Iterate chunk names ? @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_ENDL( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint8 iLevel; - - if( mng_getchunk_endl( hMNG, hChunk, &iLevel ) != 0 ) - return false; - - IARG( "iLevel", iLevel ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_FRAM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_BOUNDARY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_BOUNDARY_ABSOLUTE : MI( "MNG_BOUNDARY_ABSOLUTE" ); break;\ - case MNG_BOUNDARY_RELATIVE : MI( "MNG_BOUNDARY_RELATIVE" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_FRAMINGMODE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_FRAMINGMODE_NOCHANGE : MI( "MNG_FRAMINGMODE_NOCHANGE" ); break;\ - case MNG_FRAMINGMODE_1 : MI( "MNG_FRAMINGMODE_1" ); break;\ - case MNG_FRAMINGMODE_2 : MI( "MNG_FRAMINGMODE_2" ); break;\ - case MNG_FRAMINGMODE_3 : MI( "MNG_FRAMINGMODE_3" ); break;\ - case MNG_FRAMINGMODE_4 : MI( "MNG_FRAMINGMODE_4" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGEDELAY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGEDELAY_NO : MI( "MNG_CHANGEDELAY_NO" ); break;\ - case MNG_CHANGEDELAY_NEXTSUBFRAME : MI( "MNG_CHANGEDELAY_NEXTSUBFRAME" ); break;\ - case MNG_CHANGEDELAY_DEFAULT : MI( "MNG_CHANGEDELAY_DEFAULT" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGETIMOUT( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGETIMOUT_NO : MI( "MNG_CHANGETIMOUT_NO" ); break;\ - case MNG_CHANGETIMOUT_DETERMINISTIC_1 : MI( "MNG_CHANGETIMOUT_DETERMINISTIC_1" ); break;\ - case MNG_CHANGETIMOUT_DETERMINISTIC_2 : MI( "MNG_CHANGETIMOUT_DETERMINISTIC_2" ); break;\ - case MNG_CHANGETIMOUT_DECODER_1 : MI( "MNG_CHANGETIMOUT_DECODER_1" ); break;\ - case MNG_CHANGETIMOUT_DECODER_2 : MI( "MNG_CHANGETIMOUT_DECODER_2" ); break;\ - case MNG_CHANGETIMOUT_USER_1 : MI( "MNG_CHANGETIMOUT_USER_1" ); break;\ - case MNG_CHANGETIMOUT_USER_2 : MI( "MNG_CHANGETIMOUT_USER_2" ); break;\ - case MNG_CHANGETIMOUT_EXTERNAL_1 : MI( "MNG_CHANGETIMOUT_EXTERNAL_1" ); break;\ - case MNG_CHANGETIMOUT_EXTERNAL_2 : MI( " MNG_CHANGETIMOUT_EXTERNAL_2" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGECLIPPING( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGECLIPPING_NO : MI( "MNG_CHANGECLIPPING_NO" ); break;\ - case MNG_CHANGECLIPPING_NEXTSUBFRAME : MI( "MNG_CHANGECLIPPING_NEXTSUBFRAME" ); break;\ - case MNG_CHANGECLIPPING_DEFAULT : MI( "MNG_CHANGECLIPPING_DEFAULT" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_CHANGESYNCID( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_CHANGESYNCID_NO : MI( "MNG_CHANGESYNCID_NO" ); break;\ - case MNG_CHANGESYNCID_NEXTSUBFRAME : MI( "MNG_CHANGESYNCID_NEXTSUBFRAME" ); break;\ - case MNG_CHANGESYNCID_DEFAULT : MI( "MNG_CHANGESYNCID_DEFAULT" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_bool bEmpty; -mng_uint8 iMode; -mng_uint32 iNamesize; -mng_pchar zName; -mng_uint8 iChangedelay; -mng_uint8 iChangetimeout; -mng_uint8 iChangeclipping; -mng_uint8 iChangesyncid; -mng_uint32 iDelay; -mng_uint32 iTimeout; -mng_uint8 iBoundarytype; -mng_int32 iBoundaryl; -mng_int32 iBoundaryr; -mng_int32 iBoundaryt; -mng_int32 iBoundaryb; -mng_uint32 iCount; -mng_uint32p pSyncids; - - if( mng_getchunk_fram( hMNG, hChunk, - &bEmpty, &iMode, &iNamesize, &zName, - &iChangedelay, &iChangetimeout, &iChangeclipping, &iChangesyncid, - &iDelay, &iTimeout, - &iBoundarytype, &iBoundaryl, &iBoundaryr,&iBoundaryt, &iBoundaryb, - &iCount, &pSyncids ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iMode", iMode ); MI_FRAMINGMODE( iMode ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - NL; IARG( "iChangedelay", iChangedelay ); MI_CHANGEDELAY( iChangedelay ); - NL; IARG( "iChangetimeout", iChangetimeout ); MI_CHANGETIMOUT( iChangetimeout ); - NL; IARG( "iChangeclipping", iChangeclipping ); MI_CHANGECLIPPING( iChangeclipping ); - NL; IARG( "iChangesyncid", iChangesyncid ); MI_CHANGESYNCID( iChangesyncid ); - NL; IARG( "iDelay", iDelay ); - NL; IARG( "iTimeout", iTimeout ); - NL; IARG( "iBoundarytype", iBoundarytype ); MI_BOUNDARY( iBoundarytype ); - NL; IARG( "iBoundaryl", iBoundaryl ); - NL; IARG( "iBoundaryr", iBoundaryr ); - NL; IARG( "iBoundaryt", iBoundaryt ); - NL; IARG( "iBoundaryb", iBoundaryb ); - NL; IARG( "iCount", iCount ); - //pSyncids pSyncids @todo@ - - return true; -# undef MI_BOUNDARY -# undef MI_FRAMINGMODE -# undef MI_CHANGEDELAY -# undef MI_CHANGETIMOUT -# undef MI_CHANGECLIPPING -# undef MI_CHANGESYNCID -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_IDAT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iRawlen; -mng_ptr pRawdata; - - if( mng_getchunk_idat( hMNG, hChunk, &iRawlen, &pRawdata ) != 0 ) - return false; - - IARG( "iRawlen", iRawlen ); - - if( WantsRawData() ) { - Byte *bp = (Byte*)pRawdata; - - NL; STR( TAB + "Rawdata : " ); - // show the first 16 bytes, as hex - for( int n = 0; n < 16; n +=1 ) - HEXSTR( (int)bp[n] ) + " "; - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_IEND( mng_handle hMNG, mng_handle hChunk, String &as ) -{ - NL + TAB; STR( "End of Image." ); - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_IHDR( - mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint8 iBitdepth; -mng_uint8 iColortype; -mng_uint8 iCompression; -mng_uint8 iFilter; -mng_uint8 iInterlace; - - if( mng_getchunk_ihdr( hMNG, hChunk, &iWidth, &iHeight, &iBitdepth, - &iColortype, &iCompression, &iFilter, &iInterlace ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iBitdepth", iBitdepth ); MI_BITDEPTH( iBitdepth ); - NL; IARG( "iColortype", iColortype ); MI_COLORTYPE( iColortype ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iFilter", iFilter ); MI_FILTER( iFilter ); - NL; IARG( "iInterlace", iInterlace ); MI_INTERLACE( iInterlace ); - - if( WantsComments() ) - { - NL; NL + TAB; - switch( iColortype ) { - case MNG_COLORTYPE_GRAY : - switch( iBitdepth ) { - case 1 : case 2 : case 4 : case 8 : case 16 : - STR( "Each pixel value is a greyscale level -" ); - } // inner switch - break; - case MNG_COLORTYPE_RGB : - switch( iBitdepth ) { - case 8 : case 16 : - STR( "Each pixel value is an R,G,B series -" ); - } // inner switch - break; - case MNG_COLORTYPE_INDEXED : - switch( iBitdepth ) { - case 1 : case 2 : case 4 : case 8 : - STR( "Each pixel value is a palette index -" ); - } // inner switch - break; - case MNG_COLORTYPE_GRAYA : - switch( iBitdepth ) { - case 8 : case 16 : - STR( "Each pixel value is a greyscale level, "\ - "followed by an Alpha channel level -" ); - } // inner switch - break; - case MNG_COLORTYPE_RGBA : - switch( iBitdepth ){ - case 8 : case 16: - STR( "Each pixel value is an R,G,B "\ - "series, followed by an Alpha channel level -" ); - } // inner switch - break; - } - STR( " " + String(iBitdepth) + " bits per pixel." ); - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_JDAT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iRawlen; -mng_ptr pRawdata = NULL; - - if( mng_getchunk_jdat( hMNG, hChunk, &iRawlen, &pRawdata ) != 0 ) - return false; - - IARG( "iRawlen", iRawlen ); - - if( WantsRawData() ) { - Byte *bp = (Byte*)pRawdata; - - NL; STR( TAB + "Rawdata : " ); - // show the first 16 bytes, as hex - for( int n = 0; n < 16; n +=1 ) - HEXSTR( (int)bp[n] ) + " "; - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_JHDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_JPEG_COLORTYPE( _i_ )\ - if( WantsMacroIds() ) {\ - switch( _i_ ){\ - case MNG_COLORTYPE_JPEGGRAY : MI( "MNG_COLORTYPE_JPEGGRAY");break;\ - case MNG_COLORTYPE_JPEGCOLOR : MI( "MNG_COLORTYPE_JPEGCOLOR");break;\ - case MNG_COLORTYPE_JPEGGRAYA : MI( "MNG_COLORTYPE_JPEGGRAYA");break;\ - case MNG_COLORTYPE_JPEGCOLORA : MI( "MNG_COLORTYPE_JPEGCOLORA");break;\ - default : MI(UNKNOWN);\ - }\ -} - -# define MI_JPEG_BITDEPTH( _i_ )\ - if( WantsMacroIds() ) {\ - switch( _i_ ){\ - case MNG_BITDEPTH_JPEG8 : MI("MNG_BITDEPTH_JPEG8");break;\ - case MNG_BITDEPTH_JPEG12 : MI("MNG_BITDEPTH_JPEG12");break;\ - case MNG_BITDEPTH_JPEG8AND12 : MI("MNG_BITDEPTH_JPEG8AND12");break;\ - default : MI(UNKNOWN);\ - }\ - } - -# define MI_JPEGCOMPRESSION( _i_ )\ - if( WantsMacroIds() ) {\ - if( iImagecompression == MNG_COMPRESSION_BASELINEJPEG ) {\ - MI( "MNG_COMPRESSION_BASELINEJPEG" );\ - } else { MI(ILLEGAL_VALUE); };\ - } - -# define MI_JPEGINTERLACE( _i_ )\ - if( WantsMacroIds() ) {\ - if( iImageinterlace == MNG_INTERLACE_SEQUENTIAL ) {\ - MI( "MNG_INTERLACE_SEQUENTIAL");\ - } else {\ - MI( "MNG_INTERLACE_PROGRESSIVE" );\ - }\ - } - -// NB alpha bitdepth is not png bitdepth because it can be 0 (zero) -# define MI_ALPHABITDEPTH( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_BITDEPTH_1 : MI( "MNG_BITDEPTH_1" ); break;\ - case MNG_BITDEPTH_2 : MI( "MNG_BITDEPTH_2" ); break;\ - case MNG_BITDEPTH_4 : MI( "MNG_BITDEPTH_4" ); break;\ - case MNG_BITDEPTH_8 : MI( "MNG_BITDEPTH_8" ); break;\ - case MNG_BITDEPTH_16 : MI( "MNG_BITDEPTH_16" ); break;\ - case 0 : break;\ - default : MI(ILLEGAL_VALUE);\ - } - -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint8 iColortype; -mng_uint8 iImagesampledepth; -mng_uint8 iImagecompression; -mng_uint8 iImageinterlace; -mng_uint8 iAlphasampledepth; -mng_uint8 iAlphacompression; -mng_uint8 iAlphafilter; -mng_uint8 iAlphainterlace; - - if( mng_getchunk_jhdr( hMNG, hChunk, - &iWidth, &iHeight, &iColortype, &iImagesampledepth, - &iImagecompression, &iImageinterlace, - &iAlphasampledepth, &iAlphacompression, - &iAlphafilter, &iAlphainterlace ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iColortype", iColortype ); MI_JPEG_COLORTYPE( iColortype ); - NL; IARG( "iImagesampledepth", iImagesampledepth ); MI_JPEG_BITDEPTH( iImagesampledepth ); - NL; IARG( "iImagecompression", iImagecompression ); MI_JPEGCOMPRESSION( iImagecompression ); - NL; IARG( "iImageinterlace", iImageinterlace ); MI_JPEGINTERLACE( iImageinterlace ); - NL; IARG( "iAlphasampledepth", iAlphasampledepth ); MI_ALPHABITDEPTH( iAlphasampledepth ); - NL; IARG( "iAlphacompression", iAlphacompression ); MI_COMPRESSION_DEFLATE( iAlphacompression ); - NL; IARG( "iAlphafilter", iAlphafilter ); MI_FILTER( iAlphafilter ); - NL; IARG( "iAlphainterlace", iAlphainterlace ); MI_INTERLACE( iAlphainterlace ); - - return true; -# undef MI_JPEG_COLORTYPE -# undef MI_JPEG_BITDEPTH -# undef MI_JPEGCOMPRESSION -# undef MI_JPEGINTERLACE -# undef MI_ALPHABITDEPTH -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_LOOP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_TERMINATION( _i_ )\ - if( WantsMacroIds() )\ - switch( (_i_) ) {\ - case MNG_TERMINATION_DECODER_NC :\ - MI( "MNG_TERMINATION_DECODER_NC" ); break;\ - case MNG_TERMINATION_USER_NC :\ - MI( "MNG_TERMINATION_USER_NC" ); break;\ - case MNG_TERMINATION_EXTERNAL_NC :\ - MI( "MNG_TERMINATION_EXTERNAL_NC" ); break;\ - case MNG_TERMINATION_DETERMINISTIC_NC :\ - MI( "MNG_TERMINATION_DETERMINISTIC_NC" ); break;\ - case MNG_TERMINATION_DECODER_C :\ - MI( "MNG_TERMINATION_DECODER_C" ); break;\ - case MNG_TERMINATION_USER_C :\ - MI( "MNG_TERMINATION_USER_C" ); break;\ - case MNG_TERMINATION_EXTERNAL_C :\ - MI( "MNG_TERMINATION_EXTERNAL_C" ); break;\ - case MNG_TERMINATION_DETERMINISTIC_C :\ - MI( "MNG_TERMINATION_DETERMINISTIC_C" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint8 iLevel; -mng_uint32 iRepeat; -mng_uint8 iTermination; -mng_uint32 iItermin; -mng_uint32 iItermax; -mng_uint32 iCount; -mng_uint32p pSignals; - - if( mng_getchunk_loop( hMNG, hChunk, - &iLevel, &iRepeat, &iTermination, - &iItermin, &iItermax, &iCount, &pSignals ) != 0 ) - return false; - - IARG( "iLevel", iLevel ); - NL; IARG( "iRepeat", iRepeat ); - NL; IARG( "iTermination", iTermination ); MI_TERMINATION( iTermination ); - NL; IARG( "iItermin", iItermin ); - NL; IARG( "iItermax", iItermax ); - NL; IARG( "iCount", iCount ); - //pSignals pSignals //@todo@ - - return true; -# undef MI_TERMINATION -} -//--------------------------------------------------------------------------- -/* -bool __fastcall TMainForm::Info_M?GN( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint16 iMethodX; -mng_uint16 iMX; -mng_uint16 iMY; -mng_uint16 iML; -mng_uint16 iMR; -mng_uint16 iMT; -mng_uint16 iMB; -mng_uint16 iMethodY; - - if( mng_getchunk_magn( hMNG, hChunk, - &iFirstid, &iLastid, - &iMethodX, &iMX, &iMY, &iML, &iMR, &iMT, &iMB, - &iMethodY ) != 0 ) - return false; - - IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iMethodX", iMethodX ); - NL; IARG( "iMX", iMX ); - NL; IARG( "iMY", iMY ); - NL; IARG( "iML", iML ); - NL; IARG( "iMR", iMR ); - NL; IARG( "iMT", iMT ); - NL; IARG( "iMB", iMB ); - NL; IARG( "iMethodY", iMethodY ); - - return true; -} -*/ -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_MEND( mng_handle hMNG, mng_handle hChunk, String &as ) -{ - NL + TAB; STR( "End of Multiply Network Graphic." ); - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_MHDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -// NB "iSimplicity" is a bit field -# define MI_SIMPLICITY( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) & MNG_SIMPLICITY_VALID )\ - MI( "MNG_SIMPLICITY_VALID" );\ - if( (_i_) & MNG_SIMPLICITY_SIMPLEFEATURES )\ - MI( "MNG_SIMPLICITY_SIMPLEFEATURES" );\ - if( (_i_) & MNG_SIMPLICITY_COMPLEXFEATURES )\ - MI( "MNG_SIMPLICITY_COMPLEXFEATURES" );\ - if( (_i_) & MNG_SIMPLICITY_TRANSPARENCY )\ - MI( "MNG_SIMPLICITY_TRANSPARENCY" );\ - if( (_i_) & MNG_SIMPLICITY_JNG )\ - MI( "MNG_SIMPLICITY_JNG" );\ - if( (_i_) & MNG_SIMPLICITY_DELTAPNG )\ - MI( "MNG_SIMPLICITY_DELTAPNG" );\ - } - -mng_uint32 iWidth; -mng_uint32 iHeight; -mng_uint32 iTicks; -mng_uint32 iLayercount; -mng_uint32 iFramecount; -mng_uint32 iPlaytime; -mng_uint32 iSimplicity; - - if( mng_getchunk_mhdr( hMNG, hChunk, - &iWidth, &iHeight, &iTicks, - &iLayercount, &iFramecount, &iPlaytime, - &iSimplicity ) != 0 ) - return false; - - IARG( "iWidth", iWidth ); - NL; IARG( "iHeight", iHeight ); - NL; IARG( "iTicks", iTicks ); - NL; IARG( "iLayercount", iLayercount ); - NL; IARG( "iFramecount", iFramecount ); - NL; IARG( "iPlaytime", iPlaytime ); - NL; IARG( "iSimplicity", iSimplicity ); MI_SIMPLICITY( iSimplicity ); - - return true; -# undef MI_SIMPLICITY -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_MOVE( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint8 iMovetype; -mng_int32 iMovex; -mng_int32 iMovey; - - if( mng_getchunk_move( hMNG, hChunk, - &iFirstid, &iLastid, &iMovetype, &iMovex, &iMovey ) != 0 ) - return false; - - IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iMovetype", iMovetype ); MI_LOCATION( iMovetype ); - NL; IARG( "iMovex", iMovex ); - NL; IARG( "iMovey", iMovey ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_ORDR( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; - - if( mng_getchunk_ordr( hMNG, hChunk, &iCount ) != 0 ) - return false; - - IARG( "iCount", iCount ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PAST( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -// PAST -# define MI_TARGET( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_TARGET_ABSOLUTE : MI( "MNG_TARGET_ABSOLUTE" ); break;\ - case MNG_TARGET_RELATIVE_SAMEPAST : MI( "MNG_TARGET_RELATIVE_SAMEPAST" ); break;\ - case MNG_TARGET_RELATIVE_PREVPAST : MI( "MNG_TARGET_RELATIVE_PREVPAST" ); break;\ - default : MI(UNKNOWN);\ - } - -// COMPOSITE, ORIENTATION, OFFSET & BOUNDARY depend upon "iCount" -mng_uint16 iDestid; -mng_uint8 iTargettype; -mng_int32 iTargetx; -mng_int32 iTargety; -mng_uint32 iCount; - - if( mng_getchunk_past( hMNG, hChunk, - &iDestid, &iTargettype, &iTargetx, &iTargety, &iCount ) != 0 ) - return false; - - IARG( "iDestid", iDestid ); - NL; IARG( "iTargettype", iTargettype ); MI_TARGET( iTargettype ); - NL; IARG( "iTargetx", iTargetx ); - NL; IARG( "iTargety", iTargety ); - NL; IARG( "iCount", iCount ); - - return true; -# undef MI_TARGET -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PLTE( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iCount; -mng_palette8 aPalette; -mng_uint32 iPalEntry; - - if( mng_getchunk_plte( hMNG, hChunk, &iCount, &aPalette ) != 0 ) - return false; - - IARG( "iCount", iCount ); - - if( WantsPaletteEntries() ) - { - iPalEntry = 0; - do{ - if( WantsRgbOrder() ) - { - as = as + nl + - TAB + "Palette entry [" + PadInt( iPalEntry ) + "]" + - TAB + "R(" + PadInt( aPalette[ iPalEntry ].iRed ) + ") " + - TAB + "G(" + PadInt( aPalette[ iPalEntry ].iGreen ) + ") " + - TAB + "B(" + PadInt( aPalette[ iPalEntry ].iBlue ) + ")"; - } - else - { - as = as + nl + - TAB + "Palette entry [" + PadInt( iPalEntry ) + "]" + - TAB + "B(" + PadInt( aPalette[ iPalEntry ].iBlue ) + ") " + - TAB + "G(" + PadInt( aPalette[ iPalEntry ].iGreen ) + ") " + - TAB + "R(" + PadInt( aPalette[ iPalEntry ].iRed ) + ")"; - - }; - iPalEntry += 1; - } while( iPalEntry < iCount ); - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PPLT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -/* -# define MI_DELTATYPE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_DELTATYPE_REPLACERGB : MI( "MNG_DELTATYPE_REPLACERGB" ); break;\ - case MNG_DELTATYPE_DELTARGB : MI( "MNG_DELTATYPE_DELTARGB" ); break;\ - case MNG_DELTATYPE_REPLACEALPHA : MI( "MNG_DELTATYPE_REPLACEALPHA" ); break;\ - case MNG_DELTATYPE_DELTAALPHA : MI( "MNG_DELTATYPE_DELTAALPHA" ); break;\ - case MNG_DELTATYPE_REPLACERGBA : MI( "MNG_DELTATYPE_REPLACERGBA" ); break;\ - case MNG_DELTATYPE_DELTARGBA : MI( "MNG_DELTATYPE_DELTARGBA" ); break;\ - default : MI(UNKNOWN);\ - } -*/ -mng_uint32 iCount; - - if( mng_getchunk_pplt( hMNG, hChunk, &iCount ) != 0 ) - return false; - - IARG( "iCount", iCount ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_PROM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_FILLMETHOD( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_FILLMETHOD_LEFTBITREPLICATE : MI( "MNG_FILLMETHOD_LEFTBITREPLICATE" ); break;\ - case MNG_FILLMETHOD_ZEROFILL : MI( "MNG_FILLMETHOD_ZEROFILL" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint8 iColortype; -mng_uint8 iSampledepth; -mng_uint8 iFilltype; - - if( mng_getchunk_prom( hMNG, hChunk, - &iColortype, &iSampledepth, &iFilltype ) != 0 ) - return false; - - IARG( "iColortype", iColortype ); MI_COLORTYPE( iColortype ); - NL; IARG( "iSampledepth", iSampledepth ); MI_BITDEPTH( iSampledepth ); - NL; IARG( "iFilltype", iFilltype ); MI_FILLMETHOD( iFilltype ); - - return true; -# undef MI_FILLMETHOD -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_SAVE( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_SAVEOFFSET( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_SAVEOFFSET_4BYTE : MI( "MNG_SAVEOFFSET_4BYTE" ); break;\ - case MNG_SAVEOFFSET_8BYTE : MI( "MNG_SAVEOFFSET_8BYTE" ); break;\ - default : MI(UNKNOWN);\ - } - -/* -# define MI_SAVEENTRY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_SAVEENTRY_SEGMENTFULL : MI( "MNG_SAVEENTRY_SEGMENTFULL" ); break;\ - case MNG_SAVEENTRY_SEGMENT : MI( "MNG_SAVEENTRY_SEGMENT" ); break;\ - case MNG_SAVEENTRY_SUBFRAME : MI( "MNG_SAVEENTRY_SUBFRAME" ); break;\ - case MNG_SAVEENTRY_EXPORTEDIMAGE : MI( "MNG_SAVEENTRY_EXPORTEDIMAGE" ); break;\ - default : MI(UNKNOWN);\ - } -*/ -mng_bool bEmpty; -mng_uint8 iOffsettype; -mng_uint32 iCount; - - if( mng_getchunk_save( hMNG, hChunk, - &bEmpty, &iOffsettype, &iCount ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iOffsettype", iOffsettype ); MI_SAVEOFFSET( iOffsettype ); - NL; IARG( "iCount", iCount ); - - return true; -# undef MI_SAVEOFFSET -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_SEEK( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iNamesize; -mng_pchar zName; - - if( mng_getchunk_seek( hMNG, hChunk, &iNamesize, &zName ) != 0 ) - return false; - - IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_SHOW( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_SHOWMODE( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_SHOWMODE_0 : MI( "MNG_SHOWMODE_0" ); break;\ - case MNG_SHOWMODE_1 : MI( "MNG_SHOWMODE_1" ); break;\ - case MNG_SHOWMODE_2 : MI( "MNG_SHOWMODE_2" ); break;\ - case MNG_SHOWMODE_3 : MI( "MNG_SHOWMODE_3" ); break;\ - case MNG_SHOWMODE_4 : MI( "MNG_SHOWMODE_4" ); break;\ - case MNG_SHOWMODE_5 : MI( "MNG_SHOWMODE_5" ); break;\ - case MNG_SHOWMODE_6 : MI( "MNG_SHOWMODE_6" ); break;\ - case MNG_SHOWMODE_7 : MI( "MNG_SHOWMODE_7" ); break;\ - default : MI(UNKNOWN);\ - } -mng_bool bEmpty; -mng_uint16 iFirstid; -mng_uint16 iLastid; -mng_uint8 iMode; - - if( mng_getchunk_show( hMNG, hChunk, - &bEmpty, &iFirstid, &iLastid, &iMode ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iFirstid", iFirstid ); - NL; IARG( "iLastid", iLastid ); - NL; IARG( "iMode", iMode ); MI_SHOWMODE( iMode ); - - return true; -# undef MI_SHOWMODE -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_TERM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_TERMACTION( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_TERMACTION_LASTFRAME : MI( "MNG_TERMACTION_LASTFRAME" ); break;\ - case MNG_TERMACTION_CLEAR : MI( "MNG_TERMACTION_CLEAR" ); break;\ - case MNG_TERMACTION_FIRSTFRAME : MI( "MNG_TERMACTION_FIRSTFRAME" ); break;\ - case MNG_TERMACTION_REPEAT : MI( "MNG_TERMACTION_REPEAT" ); break;\ - default : MI(UNKNOWN);\ - } - -# define MI_ITERACTION( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_ITERACTION_LASTFRAME : MI( "MNG_ITERACTION_LASTFRAME" ); break;\ - case MNG_ITERACTION_CLEAR : MI( "MNG_ITERACTION_CLEAR" ); break;\ - case MNG_ITERACTION_FIRSTFRAME : MI( "MNG_ITERACTION_FIRSTFRAME" ); break;\ - default : MI(UNKNOWN);\ - } - -mng_uint8 iTermaction; -mng_uint8 iIteraction; -mng_uint32 iDelay; -mng_uint32 iItermax; - - if( mng_getchunk_term( hMNG, hChunk, - &iTermaction, &iIteraction, &iDelay, &iItermax ) != 0 ) - return false; - - IARG( "iTermaction", iTermaction ); MI_TERMACTION( iTermaction ); - NL; IARG( "iIteraction", iIteraction ); MI_ITERACTION( iIteraction ); - NL; IARG( "iDelay", iDelay ); - NL; IARG( "iItermax", iItermax ); - - return true; -# undef MI_TERMACTION -# undef MI_ITERACTION -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_bKGD( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint8 iType; -mng_uint8 iIndex; -mng_uint16 iGray; -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; - - if( mng_getchunk_bkgd( hMNG, hChunk, - &bEmpty, &iType, &iIndex, &iGray, - &iRed, &iGreen, &iBlue ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iType", iType ); - NL; IARG( "iIndex", iIndex ); - NL; IARG( "iGray", iGray ); - NL; IARG( "iRed", iRed ); - NL; IARG( "iGreen", iGreen ); - NL; IARG( "iBlue", iBlue ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_cHRM( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iWhitepointx; -mng_uint32 iWhitepointy; -mng_uint32 iRedx; -mng_uint32 iRedy; -mng_uint32 iGreenx; -mng_uint32 iGreeny; -mng_uint32 iBluex; -mng_uint32 iBluey; - - if( mng_getchunk_chrm( hMNG, hChunk, - &bEmpty, &iWhitepointx, &iWhitepointy, - &iRedx, &iRedy, - &iGreenx,&iGreeny, - &iBluex, &iBluey ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; FARG( "iWhitepointx", iWhitepointx ); - FPCOM( String( (float)(iWhitepointx /FFACTOR) ) ); - NL; FARG( "iWhitepointy", iWhitepointy ); - FPCOM( String( (float)(iWhitepointy /FFACTOR) ) ); - - NL; FARG( "iRedx", iRedx ); - FPCOM( String( (float)(iRedx /FFACTOR) ) ); - NL; FARG( "iRedy", iRedy ); - FPCOM( String( (float)(iRedy /FFACTOR) ) ); - - NL; FARG( "iGreenx", iGreenx ); - FPCOM( String( (float)(iGreenx /FFACTOR) ) ); - NL; FARG( "iGreeny", iGreeny ); - FPCOM( String( (float)(iGreeny /FFACTOR) ) ); - - NL; FARG( "iBluex", iBluex ); - FPCOM( String( (float)(iBluex /FFACTOR) ) ); - NL; FARG( "iBluey", iBluey ); - FPCOM( String( (float)(iBluey /FFACTOR) ) ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_eXPI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iSnapshotid; -mng_uint32 iNamesize; -mng_pchar zName; - - if( mng_getchunk_expi( hMNG, hChunk, - &iSnapshotid, &iNamesize, &zName ) != 0 ) - return false; - - IARG( "iSnapshotid", iSnapshotid ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_fPRI( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_PRIORITY( _i_ )\ - if( WantsMacroIds() )\ - switch( _i_ ) {\ - case MNG_PRIORITY_ABSOLUTE : MI( "MNG_PRIORITY_ABSOLUTE" ); break;\ - case MNG_PRIORITY_RELATIVE : MI( "MNG_PRIORITY_RELATIVE" ); break;\ - default : MI(UNKNOWN);\ - } -mng_uint8 iDeltatype; -mng_uint8 iPriority; - - if( mng_getchunk_fpri( hMNG, hChunk, &iDeltatype, &iPriority ) != 0 ) - return false; - - IARG( "iDeltatype", iDeltatype ); MI_PRIORITY( iDeltatype ); - NL; IARG( "iPriority", iPriority ); - - return true; -# undef MI_PRIORITY -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_gAMA( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iGamma; - - if( mng_getchunk_gama( hMNG, hChunk, &bEmpty, &iGamma ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; FARG( "iGamma", iGamma ); - FPCOM( String( (float)(iGamma /FFACTOR) ) ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_hIST( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iEntrycount; -mng_uint16arr aEntries; - - if( mng_getchunk_hist( hMNG, hChunk, &iEntrycount, &aEntries ) != 0 ) - return false; - - - IARG( "iEntrycount", iEntrycount ); - //aEntries aEntries @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_iCCP( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iNamesize; -mng_pchar zName; -mng_uint8 iCompression; -mng_uint32 iProfilesize; -mng_ptr pProfile; - - if( mng_getchunk_iccp( hMNG, hChunk, - &bEmpty, &iNamesize, &zName, &iCompression, - &iProfilesize,&pProfile ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "Name", zName ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iProfilesize", iProfilesize ); -// "pProfile " + String( pProfile ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_iTXt( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -#define MI_ITXT_FLAG( _i_ )\ - if( WantsMacroIds() ) {\ - if( (_i_) == MNG_FLAG_UNCOMPRESSED ) {\ - MI( "MNG_FLAG_UNCOMPRESSED" )\ - } else if( (_i_) == MNG_FLAG_COMPRESSED ) {\ - MI( "MNG_FLAG_COMPRESSED" );\ - }\ - } -mng_uint32 iKeywordsize; -mng_pchar zKeyword; -mng_uint8 iCompressionflag; -mng_uint8 iCompressionmethod; -mng_uint32 iLanguagesize; -mng_pchar zLanguage; -mng_uint32 iTranslationsize; -mng_pchar zTranslation; -mng_uint32 iTextsize; -mng_pchar zText; - - if( mng_getchunk_itxt( hMNG, hChunk, - &iKeywordsize, &zKeyword, - &iCompressionflag, &iCompressionmethod, - &iLanguagesize, &zLanguage, - &iTranslationsize, &zTranslation, - &iTextsize, &zText ) != 0 ) - return false; - - IARG( "iKeywordsize", iKeywordsize ); - NL; ZARG( "zKeyword", zKeyword ); - NL; IARG( "iCompressionflag", iCompressionflag ); MI_ITXT_FLAG( iCompressionflag ); - NL; IARG( "iCompressionmethod", iCompressionmethod ); MI_COMPRESSION_DEFLATE( iCompressionflag ); - NL; IARG( "iLanguagesize", iLanguagesize ); - NL; ZARG( "zLanguage", zLanguage ); - NL; IARG( "iTranslationsize", iTranslationsize ); - NL; ZARG( "zTranslation", zTranslation ); - NL; IARG( "iTextsize", iTextsize ); - NL; ZARG( "zText", zText ); - - return true; -# undef MI_ITXT_FLAG -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_nEED( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iKeywordssize; -mng_pchar zKeywords; - - if( mng_getchunk_need( hMNG, hChunk, &iKeywordssize, &zKeywords ) != 0) - return false; - - IARG( "iKeywordssize", iKeywordssize ); - NL; IARG( "zKeywords", zKeywords ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_pHYg( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iSizex; -mng_uint32 iSizey; -mng_uint8 iUnit; - - if( mng_getchunk_phyg( hMNG, hChunk, - &bEmpty, &iSizex, &iSizey, &iUnit ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iSizex", iSizex ); - NL; IARG( "iSizey", iSizey ); - NL; IARG( "iUnit", iUnit ); MI_UNITS( iUnit ); - - if( iUnit ) { - PCOM("X/Y pixels per unit" ); - } else { - if( iSizex == iSizey ) { - PCOM( "Square pixels" ); - } - } - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_pHYs( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iSizex; -mng_uint32 iSizey; -mng_uint8 iUnit; - - if( mng_getchunk_phys( hMNG, hChunk, - &bEmpty, &iSizex, &iSizey, &iUnit ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iSizex", iSizex ); - NL; IARG( "iSizey", iSizey ); - NL; IARG( "iUnit", iUnit ); MI_UNITS( iUnit ); - - if( iUnit ) { - PCOM("X/Y pixels per unit" ); - } else { - if( iSizex == iSizey ) { - PCOM( "Square pixels" ); - } - } - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_sBIT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ // tested with cs3* cs5* cs8* -mng_bool bEmpty; -mng_uint8 iType; -mng_uint8arr4 aBits; - - if( mng_getchunk_sbit( hMNG, hChunk, &bEmpty, &iType, &aBits ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iType", iType ); - //aBits aBits @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_sPLT( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_uint32 iNamesize; -mng_pchar zName; -mng_uint8 iSampledepth; -mng_uint32 iEntrycount; -mng_ptr pEntries; - - if( mng_getchunk_splt( hMNG, hChunk, - &bEmpty, &iNamesize, &zName, - &iSampledepth, &iEntrycount, &pEntries ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iNamesize", iNamesize ); - NL; ZARG( "zName", zName ); - NL; IARG( "iSampledepth", iSampledepth ); MI_BITDEPTH( iSampledepth ); - NL; IARG( "iEntrycount", iEntrycount ); - //pEntries pEntries @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_sRGB( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -# define MI_RENDERINGINTENT( _i_ )\ - if( WantsMacroIds() ) {\ - switch( (_i_) ) {\ - case MNG_INTENT_PERCEPTUAL :\ - MI( "MNG_INTENT_PERCEPTUAL" ); break;\ - case MNG_INTENT_RELATIVECOLORIMETRIC :\ - MI( "MNG_INTENT_RELATIVECOLORIMETRIC" );break;\ - case MNG_INTENT_SATURATION :\ - MI( "MNG_INTENT_SATURATION" ); break;\ - case MNG_INTENT_ABSOLUTECOLORIMETRIC :\ - MI( "MNG_INTENT_ABSOLUTECOLORIMETRIC" );break;\ - }\ - } -mng_bool bEmpty; -mng_uint8 iRenderingintent; - - if( mng_getchunk_srgb( hMNG, hChunk,&bEmpty, &iRenderingintent ) != 0) - return false; - - BARG( "bEmpty", bEmpty ); - NL; IARG( "iRenderingintent", iRenderingintent ); - MI_RENDERINGINTENT( iRenderingintent ); - - return true; -# undef MI_RENDERINGINTENT -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_tEXt( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iKeywordsize; -mng_pchar zKeyword; -mng_uint32 iTextsize; -mng_pchar zText; - - if( mng_getchunk_text( hMNG, hChunk, - &iKeywordsize, &zKeyword, &iTextsize, &zText ) != 0 ) - return false; - - IARG( "iKeywordsize", iKeywordsize ); - NL; ZARG( "zKeyword", zKeyword ); - NL; IARG( "iTextsize", iTextsize ); - NL; ZARG( "zText", zText ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_tIME( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint16 iYear; -mng_uint8 iMonth; -mng_uint8 iDay; -mng_uint8 iHour; -mng_uint8 iMinute; -mng_uint8 iSecond; - - if( mng_getchunk_time( hMNG, hChunk, - &iYear, &iMonth, &iDay, &iHour, &iMinute, &iSecond ) != 0 ) - return false; - - IARG( "iYear", iYear ); - NL; IARG( "iMonth", iMonth ); - NL; IARG( "iDay", iDay ); - NL; IARG( "iHour", iHour ); - NL; IARG( "iMinute", iMinute ); - NL; IARG( "iSecond", iSecond ); - // Do not do help line here - may confuse international readers ! - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_tRNS( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_bool bEmpty; -mng_bool bGlobal; -mng_uint8 iType; -mng_uint32 iCount; -mng_uint8arr aAlphas; -mng_uint16 iGray; -mng_uint16 iRed; -mng_uint16 iGreen; -mng_uint16 iBlue; -mng_uint32 iRawlen; -mng_uint8arr aRawdata; - - if( mng_getchunk_trns( hMNG, hChunk, - &bEmpty, &bGlobal, &iType, &iCount, - &aAlphas, - &iGray, &iRed, &iGreen, &iBlue, - &iRawlen, - &aRawdata ) != 0 ) - return false; - - BARG( "bEmpty", bEmpty ); - NL; BARG( "bGlobal", bGlobal ); - NL; IARG( "iType", iType ); - NL; IARG( "iCount", iCount ); -//aAlphas aAlphas @todo@ - NL; IARG( "iGray", iGray ); - NL; IARG( "iRed", iRed ); - NL; IARG( "iGreen", iGreen ); - NL; IARG( "iBlue", iBlue ); - NL; IARG( "iRawlen", iRawlen ); -//aRawdata aRawdata @todo@ - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_zTXt( mng_handle hMNG, mng_handle hChunk, String &as ) -{ -mng_uint32 iKeywordsize; -mng_pchar zKeyword; -mng_uint8 iCompression; -mng_uint32 iTextsize; -mng_pchar zText; - - if( mng_getchunk_ztxt( hMNG, hChunk, - &iKeywordsize, &zKeyword, &iCompression, &iTextsize, &zText ) != 0 ) - return false; - - IARG( "iKeywordsize", iKeywordsize ); - NL; ZARG( "zKeyword", zKeyword ); - NL; IARG( "iCompression", iCompression ); MI_COMPRESSION_DEFLATE( iCompression ); - NL; IARG( "iTextsize", iTextsize ); - NL; ZARG( "zText", zText ); - - return true; -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::Info_Unknown( mng_handle hMNG, mng_handle hChunk, String &as ) -{ - NL + TAB; STR( "Unknown Chunk" ); - NL + TAB; STR( nl + TAB + "(See help tab for a list of unsupported chunks)!" ); - - return true; -} -//--------------------------------------------------------------------------- - - - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp b/Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp deleted file mode 100644 index c9e1ab509..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/Help.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//--------------------------------------------------------------------------- -// Help.cpp : Help pane text -//--------------------------------------------------------------------------- -#include "Help.h" - -// NB : If more text is to go in here don't forget to enlarge min/max -extern char *_szHelp = { -"\nA MNG developers tool to display the chunk data of MNG/JNG/PNG files."\ -"\n" -"\nMngDump - Version 1.0 - September 2000"\ -"\n"\ -"\n NOTE - This program comes with NO warranties whatsoever."\ -"\n"\ -"\nInstruction for use ... press the folder button and load a file !"\ -"\n"\ -"\nThe following chunks are (currently) unsupported :"\ -"\nIJNG, IPNG, JSEP, MaGN, MAGN, oFFs, pCAL, sCAL"\ -"\n"\ -"\nThe program will be periodically updated, inline with libmng's growth."\ -"\nPlease report any bugs, suggestions, etc to the maintainer." -}; -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Help.h b/Engine/lib/lmng/contrib/bcb/mngdump/Help.h deleted file mode 100644 index 736d562d2..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/Help.h +++ /dev/null @@ -1,6 +0,0 @@ -//--------------------------------------------------------------------------- -#ifndef HelpH -#define HelpH -//--------------------------------------------------------------------------- -extern char *_szHelp; -#endif diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR b/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR deleted file mode 100644 index 67845d0b0..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.BPR +++ /dev/null @@ -1,195 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.03 -# --------------------------------------------------------------------------- -PROJECT = MNGDUMP.exe -OBJFILES = MNGDUMP.obj Main.obj Chunks.obj About.obj Callback.obj Help.obj -RESFILES = MngDump.res -DEFFILE = -RESDEPEN = $(RESFILES) Main.dfm -LIBFILES = ..\..\..\bcb\win32dll\libmng.lib -LIBRARIES = VCL35.lib -SPARELIBS = VCL35.lib -PACKAGES = VCLX35.bpi VCL35.bpi VCLDB35.bpi VCLDBX35.bpi bcbsmp35.bpi dclocx35.bpi \ - QRPT35.bpi -# --------------------------------------------------------------------------- -PATHCPP = .; -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -w -Ve -k- -vi -c -b- -w-par -w-inl -Vx -tW -CFLAG2 = -I..\win32dll;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -CFLAG3 = -Tkh30000 -6 -PFLAGS = -U..\win32dll;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \ - -I..\win32dll;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b \ - -$L- -$D- -v -JPHN -M -RFLAGS = -i..\win32dll;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -AFLAGS = /i$(BCB)\include /i$(BCB)\include\vcl /i..\..\..\libmng /i..\..\..\zlib \ - /i..\..\..\jpgsrc6b /mx /w2 /zd /dMNG_SUPPORT_READ /dMNG_ACCESS_CHUNKS \ - /dMNG_STORE_CHUNKS /dMNG_NO_CMS /dMNG_USE_DLL /dHAVE_BOOLEAN -LFLAGS = -L..\win32dll;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) -aa -Tpe -x -Gn -IFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=1 -Special=0 -Private=0 -DLL=0 -Locale=2057 -CodePage=1252 - -[Version Info Keys] -CompanyName=RDS -FileDescription=MngDump -FileVersion=1.0.0.0 -InternalName= -LegalCopyright=Copyright (c) 2000 G.Juyn -LegalTrademarks= -OriginalFilename=MngTree -ProductName= -ProductVersion=1.0.0.0 -Comments=Author Andy Protano - September 2000 - -[HistoryLists\hlIncludePath] -Count=10 -Item0=$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -Item1=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\jpgsrc6b -Item2=..\mngtree;..\..\delphi\mngview;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\jpgsrc6b -Item3=..\mngtree;..\..\delphi\mngview;$(BCB)\include;$(BCB)\include\vcl;..\..\..\libmng;..\..\..\zlib;..\..\..\libjpeg -Item4=..\..\delphi\mngview;$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\libjpeg -Item5=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\..\zlib;..\..\..\libjpeg -Item6=$(BCB)\include;$(BCB)\include\vcl;..\..;..\..\zlib;..\..\libjpeg -Item7=$(BCB)\include;$(BCB)\include\vcl;..\.. -Item8=$(BCB)\include;$(BCB)\include\vcl;.. -Item9=$(BCB)\include;$(BCB)\include\vcl - -[HistoryLists\hlLibraryPath] -Count=4 -Item0=$(BCB)\lib\obj;$(BCB)\lib -Item1=..\mngtree;$(BCB)\lib\obj;$(BCB)\lib -Item2=..\mngtree;..\..\delphi\mngview;$(BCB)\lib\obj;$(BCB)\lib -Item3=..\..\delphi\mngview;$(BCB)\lib\obj;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=6 -Item0=MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL;HAVE_BOOLEAN -Item1=_RTLDLL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL;HAVE_BOOLEAN -Item2=_RTLDLL;MNG_SUPPORT_READ;MNG_ACCESS_CHUNKS;MNG_STORE_CHUNKS;MNG_NO_CMS;MNG_USE_DLL -Item3=_RTLDLL;HAVE_BOOLEAN -Item4=_RTLDLL -Item5=_RTLDLL;USEPACKAGES - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -[Parameters] -RunParams= -HostApplication= - -!endif - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $< -# --------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.RES b/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.RES deleted file mode 100644 index f912f29b3dbc53e022b853e7d6be30425a610ece..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1684 zcmd6mO-~b16o%hAO1v!Y}G4d5&BI%5jj*p670sP@5mCZO8yNK}*xz zMDn=4PaG1K)X*JRn*FU>a5Ig|tap%#TPZ4v3w`B=%w1CdUncd3R(^3EFW?cq4B=bI znytaJBWam9t{Zrlb2qX*z{$p26!*2E6|L(XysAz1k|y7Uy@rb7xUpof!d_8Db+W~d z(E#V>TdGHkSa-CoUDj9H;f{6sYRtCu7O{P z+rpY_-}9Z3_lWq+{Wm;+OXrSfbDfOaA+Ag0*#D`X;8U{nkSrCiyXU?cwH!}XBz>gv zir!*BbgNZ=M%~u^p*~ZOyrXGdOt1S|;4eKRqkXYnllcv`4!rsW&ppQd0AgF8$aBKp z)fXx+Da>Q@DyL1|>MZADQkY(>~WHcYSVq^ilpt z%bbC0)vl1E$4pMi7$aq59dHWhJ?hM`#d-{H6K8+Z`rTu-h;mlecgq%Tug#+DbbQ04 VM}9lQ)H1Rk<2iXZX6oOo{{UBn^LPLN diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp b/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp deleted file mode 100644 index 883f6d4b2..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/MNGDUMP.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#pragma hdrstop -USERES("MngDump.res"); -USEFORM("Main.cpp", MainForm); -USEUNIT("Chunks.cpp"); -USEUNIT("About.cpp"); -USEUNIT("Callback.cpp"); -USEUNIT("Help.cpp"); -USELIB("..\..\..\bcb\win32dll\libmng.lib"); -//--------------------------------------------------------------------------- -WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) -{ - try - { - Application->Initialize(); - Application->Title = "MngDump"; - Application->CreateForm(__classid(TMainForm), &MainForm); - Application->Run(); - } - catch (Exception &exception) - { - Application->ShowException(&exception); - } - return 0; -} -//--------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp b/Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp deleted file mode 100644 index af7a916d2..000000000 --- a/Engine/lib/lmng/contrib/bcb/mngdump/Main.cpp +++ /dev/null @@ -1,793 +0,0 @@ -//--------------------------------------------------------------------------- -#include -#include -#include -#pragma hdrstop -//--------------------------------------------------------------------------- -#pragma package(smart_init) -#pragma resource "*.dfm" -#include "Main.h" -TMainForm *MainForm; -//--------------------------------------------------------------------------- -#include "About.h" -#include "Help.h" - -# define PAGE_CHUNKS 1 -# define PAGE_REPORT 2 -# define PAGE_OPTIONS 3 -# define PAGE_ABOUT 4 -# define PAGE_HELP 5 - -/* ************************************************************************** */ -/* * * */ -/* * MngDump is based on Gerard Juyn's MngTree * */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000 Andy Protano * */ -/* * Gerard Juyn (gerard@libmng.com) * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn (gerard@libmng.com) * */ -/* * Andy Protano (a.a.protano@care4free.net) * */ -/* * * */ -/* * This program is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ - -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -__fastcall TMainForm::TMainForm(TComponent* Owner) - : TForm(Owner) -{ -} -//--------------------------------------------------------------------------- -__fastcall TMainForm::~TMainForm( void ) -{ -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::OnMinMax(TMessage& Msg) -{ - ((POINT far *)Msg.LParam)[3].x = 500; - ((POINT far *)Msg.LParam)[3].y = 450; - - TForm::Dispatch(&Msg); -} -//--------------------------------------------------------------------------- -// MessageBox Methods -// ---------------------------------------------------------------------- -int __fastcall TMainForm::MessageBox( String &as, UINT flags ) -{ - return ::MessageBox( Handle, as.c_str(), Application->Title.c_str(), flags ); -} -// ---------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxOk( String as ) -{ - (void)MessageBox( as, MB_ICONINFORMATION ); -} -//------------------------------------------------------------------------- -int __fastcall TMainForm::MsgBoxYN( String as ) -{ - return MessageBox( as, MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON1 ); -} -//------------------------------------------------------------------------- -int __fastcall TMainForm::MsgBoxYNC( String as ) -{ - return MessageBox( as, MB_YESNOCANCEL | MB_ICONQUESTION ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxStop( String as ) -{ - (void)MessageBox( as, MB_ICONSTOP ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxInfo( String as ) -{ - (void)MessageBox( as, MB_OK | MB_ICONINFORMATION ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::MsgBoxWarn( String as ) -{ - (void)MessageBox( as, MB_OK | MB_ICONWARNING ); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::FormCreate(TObject *Sender) -{ - // For when the application name changes - coz i'll forget ! - asAppName = Application->Title; - // And while we've got it set the caption - Caption = Application->Title; - - // Load About Screen - LabelAbout->Caption = _szAbout; - // Load Help Screen - LabelHelp->Caption = _szHelp; - - fd = NULL; - strList = new TStringList(); - - asTab = " ";// default tab size 2 - RadioGroupTabSize->ItemIndex = 1; // range is zero based - - // Start with the help pane - PageControl1->ActivePage = tsHelp; - - mnuWordWrap->Checked = false; - // This call will TOGGLE and set word wrap for all the applicables - // editors and enable/disable the Horz scroll bar. - mnuWordWrapClick( this ); // So start with false to get to true; - - // Clear things from design time settings - StaticTextStatus->Caption = ""; - //strList->Clear(); constructor dodid that - pnlChunks->Caption = ""; - ListBoxChunks->Clear(); - RichEditChunks->Clear(); - RichEditReport->Clear(); - ProgressBar1->Min = 0; - ProgressBar1->Position = 0; - SetChunkCount( 0 ); - - // Set default states for switches - cbPaletteEntries->Checked = false; - cbRGBOrder->Checked = true; - cbRawData->Checked = true; - cbComments->Checked = true; - cbMacroIdentifier->Checked = true; - cbBool->Checked = true; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FormDestroy(TObject *Sender) -{ - delete strList; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuExitClick(TObject *Sender) -{ - Close(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuFileOpenClick(TObject *Sender) -{ - if( !OpenDialog1->Execute() ) - return; - - Application->ProcessMessages(); // Refresh the screen - LoadFile(); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuReloadClick(TObject *Sender) -{ - // Only reload - if we have something to reload - if( OpenDialog1->FileName.Length() ) - LoadFile(); - else - MsgBoxStop( "Nothing to reload yet !" ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuUndoClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->Undo(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuCutClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->CutToClipboard(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuCopyClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->CopyToClipboard(); -} -//------------------------------------------------------------------------- -void __fastcall TMainForm::sbtnCopyChunkClick(TObject *Sender) -{ - if( RichEditChunks->Lines->Count ) // Do we have something in there ? - { - // Copy chunk data from Chunks pane to clipboard - RichEditChunks->SelectAll(); - RichEditChunks->CopyToClipboard(); - RichEditChunks->SelLength = 0; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuPasteClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->PasteFromClipboard(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuSelectAllClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count ) // Do we have something in there ? - RichEditReport->SelectAll(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuWordWrapClick(TObject *Sender) -{ -bool bWrap; - - mnuWordWrap->Checked = !mnuWordWrap->Checked; - bWrap = mnuWordWrap->Checked; - - RichEditChunks->WordWrap = bWrap; - RichEditReport->WordWrap = bWrap; - - if( bWrap ) { // if Word wrap on then no need for horizontal scrollbar - RichEditChunks->ScrollBars = ssVertical; - RichEditReport->ScrollBars = ssVertical; - } else { // Horizontal scrollbar required (auto) - RichEditChunks->ScrollBars = ssBoth; - RichEditReport->ScrollBars = ssBoth; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuSetFontClick(TObject *Sender) -{ - if( FontDialog1->Execute() ) - { - RichEditChunks->Font = FontDialog1->Font; - RichEditReport->Font = FontDialog1->Font; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FontDialog1Apply(TObject *Sender, HWND Wnd) -{ - RichEditChunks->Font = FontDialog1->Font; - RichEditReport->Font = FontDialog1->Font; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuFindClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "Find what ?."); - return; - } - - FindDialog->Execute(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::FindDialogFind(TObject *Sender) -{ -TSearchTypes st; -TFindDialog *fd; -int newpos; - - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "Find what ?."); - return; - } - - fd = dynamic_cast( Sender ); - - if( fd->Options.Contains( frMatchCase ) ) - st << stMatchCase; - if( fd->Options.Contains( frWholeWord ) ) - st << stWholeWord; - - if( RichEditReport->SelLength ) - RichEditReport->SelStart += 1; - - newpos = RichEditReport->FindText( fd->FindText, - RichEditReport->SelStart, RichEditReport->Text.Length(), st ); - - if( newpos != -1 ) { - RichEditReport->SelStart = newpos; - RichEditReport->SelLength = fd->FindText.Length(); - } else { - MsgBoxInfo( "End of document reached." ); - RichEditReport->SelStart = 0; - } -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuFindNextClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "Find what ?."); - return; - } - - FindDialogFind( FindDialog ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuPrintClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "I can't find anything to print !."); - return; - } - - RichEditReport->Print( ExtractFileName( OpenDialog1->FileName ) ); - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuPrintSetupClick(TObject *Sender) -{ - PrinterSetupDialog->Execute(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::mnuSaveClick(TObject *Sender) -{ - if( RichEditReport->Lines->Count == 0 ) - { - MsgBoxStop( "I can't find anything to save !."); - return; - } - - // Grab the graphic's filename and change to "txt" extension - { - char szFile[ MAXFILE ]; - char szExt[ MAXEXT ]; - char szDest[ MAXPATH ]; - String as; - - fnsplit( OpenDialog1->FileName.c_str(), NULL, NULL, szFile, szExt ); - - memset( szDest, 0, MAXPATH ); - strcat( szDest, szFile ); - strcat( szDest, "\." ); - strcat( szDest, "txt" ); - as = szDest; - - // Initially create a text file of the same name as the graphic - // but with "txt" extension - SaveDialog1->FileName = as; - } - - if( !SaveDialog1->Execute() ) - return; // Given up hey ? - - RichEditReport->Lines->SaveToFile( SaveDialog1->FileName ); -} -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -//--------------------------------------------------------------------------- -void __fastcall TMainForm::LoadFile( void ) -{ -int bStatus; - - // Can we open the file ? - if( (fd = fopen( OpenDialog1->FileName.c_str(), "rb") ) == NULL ) - { - MsgBoxStop( "Cannot open input file\n\n" + OpenDialog1->FileName ); - return; - } - - pnlChunks->Caption = ""; - strList->Clear(); - ListBoxChunks->Clear(); - RichEditChunks->Clear(); - RichEditReport->Clear(); - - ProgressBar1->Min = 0; - ProgressBar1->Position = 0; - SetChunkCount( 0 ); - - RichEditReport->Lines->Add( "" ); - RichEditReport->Lines->Add( "Chunk contents of file :" ); - RichEditReport->Lines->Add( OpenDialog1->FileName ); - RichEditReport->Lines->Add( "" ); - - // Make report pane visible - prove we are working and not locked up - PageControl1->ActivePage = tsReport; - -try { - StaticTextStatus->Caption = "Working ... please wait"; - StaticTextStatus->Update(); - bStatus = DumpTree(); // true indicates success -} -__finally { - ProgressBar1->Position = 0; - StaticTextStatus->Caption = "Ok"; - fclose( fd ); - fd = NULL; -} - - if( !bStatus ) // We have an error - { - pnlChunks->Caption = ""; - strList->Clear(); - ListBoxChunks->Clear(); - RichEditChunks->Clear(); - - RichEditReport->Lines->Add(""); - RichEditReport->Lines->Add("An error occurred while reading the file."); - - } else { // Read file and chunks without any problems - - // Set Report Panels caption - pnlChunks->Caption = "Chunk 1 of " + String( ListBoxChunks->Items->Count ); - - // Set Listbox to first item - ListBoxChunks->ItemIndex = 0; - - // Put gleeful message in report pane - RichEditChunks->Lines->Add( "" ); - RichEditChunks->Lines->Add( - "No error's found when reading file ... " ); - RichEditChunks->Lines->Add( - "Click the list box to display the data for each chunk."); - - // Place cursor at top of editor - RichEditChunks->SelStart = 0; - RichEditChunks->SelLength = 0; - - // Place cursor at top of editor - RichEditReport->SelStart = 0; - RichEditReport->SelLength = 0; - - // Lock richedits - so an immediate undo does not make data vanish ! - RichEditReport->Modified = false; - // @ap@ Borland should fix this ! (it don't work) - } - -} -//--------------------------------------------------------------------------- -bool __fastcall TMainForm::DumpTree( void ) -{ -mng_handle hMNG; - - // let's initialize the library - hMNG = mng_initialize( (mng_ptr)this, Alloc, Free, NULL ); - - if( !hMNG ) // did that work out ? - { - MNGError( hMNG, "Cannot initialize libmng." ); - mng_cleanup( &hMNG ); // Always cleanup the library - MsgBoxStop( "Bye!" ); - Application->Terminate(); // Exit now - } - - // setup callbacks - if( (mng_setcb_openstream ( hMNG, OpenStream ) != 0) || - (mng_setcb_closestream ( hMNG, CloseStream ) != 0) || - (mng_setcb_processheader( hMNG,ProcessHeader ) != 0) || - (mng_setcb_readdata ( hMNG, FileReadData ) != 0) - ) - { - MNGError( hMNG, "Cannot set callbacks for libmng."); - mng_cleanup( &hMNG ); // Always cleanup the library - MsgBoxStop( "Bye!" ); - Application->Terminate(); // Exit now - } - else - { - // read the file into memory - if( mng_read( hMNG ) != 0 ) - { - // Because we read the whole file in first, - // here is where bad input files first choke ! - MNGError( hMNG, "Cannot read the file." ); - mng_cleanup( &hMNG ); // Always cleanup the library - return false; - } - else - { - // run through the chunk list - if( mng_iterate_chunks( hMNG, 0, IterateChunks ) != 0 ) - { - MNGError( hMNG, "Error Getting Chunk info!" ); - mng_cleanup( &hMNG ); // Always cleanup the library - return false; // Errors may occur with bad chunk data - } - } - } - - mng_cleanup( &hMNG ); // Always cleanup the library - - return true; -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::MNGError( mng_handle hMNG, String SHMsg ) -{ -// get extended info -mng_uint32 iErrorcode; -mng_uint8 iSeverity; -mng_chunkid iChunkname; -mng_uint32 iChunkseq; -mng_int32 iExtra1; -mng_int32 iExtra2; -mng_pchar zErrortext; -char szFormatStr[ 256 ]; - - iErrorcode = mng_getlasterror( hMNG, &iSeverity, &iChunkname, - &iChunkseq, &iExtra1, &iExtra2, - &zErrortext); - - wsprintf( szFormatStr, - "Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d", - (int)iErrorcode, (int)iSeverity, (int)iChunkseq, (int)iExtra1 - ); - - MsgBoxStop( SHMsg + "\n\n" + String( zErrortext ) + "\n\n" + String( szFormatStr ) ); -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::ListBoxChunksClick(TObject *Sender) -{ -// When the Chunks listbox is clicked ... -// display strings from strlist in the RichEditChunks window. -int iIndex = ListBoxChunks->ItemIndex; - - if( !ListBoxChunks->Items->Count ) - return; - - // Update panel to reflect the selection : "Chunk N of NChunks" - pnlChunks->Caption = "Chunk " + String( iIndex + 1) + - " of " + String( ListBoxChunks->Items->Count ); - - // Reset Chunks windows ... - RichEditChunks->Clear(); - RichEditChunks->Lines->Add( "" ); - // ... Chunks header string : "Chunk N : XXXX" (XXXX == Chunk name) - RichEditChunks->Lines->Add( "Chunk " + String( iIndex + 1 ) + " : " + - ListBoxChunks->Items->Strings[ iIndex ] ); - // ... Seperator line - //RichEditChunks->Lines->Add(""); - - // ... add the data from the stringlist - { - String as = strList->Strings[ iIndex ] + 1; - String z; - int n =1; - do{ - if( as[n] == '\n' ) - { - RichEditChunks->Lines->Add( z ); - z = ""; - } - else - z = z + as[n]; - n+=1; - } while( n < as.Length() ); - RichEditChunks->Lines->Add( z ); - } - - // ... Seperator line - RichEditChunks->Lines->Add(""); - - // Place cursor at top of editor - RichEditChunks->SelStart = 0; - RichEditChunks->SelLength = 0; - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::EventShowPage(TObject *Sender) -{ - - switch( ((TTabSheet *)Sender)->Tag ) { - case PAGE_REPORT : - mnuPrint->Enabled = true; - mnuEdit->Enabled = true; - mnuUndo->Enabled = true; - mnuSave->Enabled = true; - sbtnSave->Enabled = true; - sbtnUndo->Enabled = true; - mnuCut->Enabled = true; - sbtnCut->Enabled = true; - mnuCopy->Enabled = true; - sbtnCopy->Enabled = true; - mnuPaste->Enabled = true; - sbtnPaste->Enabled = true; - mnuSearch->Enabled = true; - sbtnPrint->Enabled = true; - break; - //case PAGE_CHUNKS : - //case PAGE_OPTIONS : - ///case PAGE_ABOUT : - //case PAGE_HELP : - default : - mnuPrint->Enabled = false; - mnuEdit->Enabled = false; - // no need to enable/disable menu commands as none will be available - mnuSave->Enabled = false; - sbtnSave->Enabled = false; - sbtnUndo->Enabled = false; - sbtnCut->Enabled = false; - sbtnCopy->Enabled = false; - sbtnPaste->Enabled = false; - mnuSearch->Enabled = false; - sbtnPrint->Enabled = false; - } - -} -//--------------------------------------------------------------------------- -void __fastcall TMainForm::RadioGroupTabSizeClick(TObject *Sender) -{ - switch( RadioGroupTabSize->ItemIndex ) { - case 0 : asTab = " "; break; - case 1 : asTab = " "; break; - case 2 : asTab = " "; break; - case 3 : asTab = " "; break; - case 4 : asTab = " "; break; - case 5 : asTab = " "; break; - } -} -//--------------------------------------------------------------------------- -String __fastcall TMainForm::PadInt( int iInt, int iWidth ) -{ - -char szFmtStr[ 24 ]; -char szInt[ 24 ]; // Should be wide enough ! -String as; - wsprintf( szFmtStr,"%%%d\d\0",iWidth ); //"%[iWidth]d" - as = szFmtStr; - wsprintf( szInt, szFmtStr, iInt ); - - return String( szInt ); -} -//--------------------------------------------------------------------------- -mng_bool __fastcall TMainForm::ShowChunk( - mng_handle hMNG, mng_handle hChunk, mng_chunkid iChunktype ) -{ -String asDataText; - - // Fill asDataText with string data including newline's ... - // this is added to string list for each chunk - // and also added to the tail end of "Report" - - // NOTE : - // Return True to continue processing. - // If mng_getchunk_xxxx fails just return false to the - // caller "(bool) myiterchunk" which inturn will then return false - // to "(mng_retcode) mng_iterate_chunks(...)" which will then - // give us the correct error code. - // In other words DON'T check for errors in "(bool) myiterchunk" ! - - switch( iChunktype ) { - case MNG_UINT_BACK : - if( !Info_BACK( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_BASI : - if( !Info_BASI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_CLIP : - if( !Info_CLIP( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_CLON : - if( !Info_CLON( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DBYK : // untested @ap@ - if( !Info_DBYK( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DEFI : - if( !Info_DEFI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DHDR : - if( !Info_DHDR( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DISC : // untested @ap@ - if( !Info_DISC( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_DROP : // untested @ap@ - if( !Info_DROP( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_ENDL : - if( !Info_ENDL( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_FRAM : - if( !Info_FRAM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_IDAT : - if( !Info_IDAT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_IEND : - if( !Info_IEND( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_IHDR : - if( !Info_IHDR( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_IJNG 0x494a4e47L // Function AWOL @ap@ -#define MNG_UINT_IPNG 0x49504e47L // Function AWOL @ap@ - case MNG_UINT_JDAT : - if( !Info_JDAT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_JHDR : - if( !Info_JHDR( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_JSEP 0x4a534550L // Function AWOL @ap@ - case MNG_UINT_LOOP : - if( !Info_LOOP( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_MaGN 0x4d61474eL // which one "mng_getchunk_magn" ? - case MNG_UINT_MEND : - if( !Info_MEND( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_MHDR : - if( !Info_MHDR( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_MOVE : - if( !Info_MOVE( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_MaGN 0x4d61474eL // which one "mng_getchunk_magn" ? - case MNG_UINT_ORDR : - if( !Info_ORDR( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PAST : - if( !Info_PAST( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PLTE : - if( !Info_PLTE( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PPLT : - if( !Info_PPLT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_PROM : - if( !Info_PROM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_SAVE : - if( !Info_SAVE( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_SEEK : - if( !Info_SEEK( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_SHOW : - if( !Info_SHOW( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_TERM : - if( !Info_TERM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_bKGD : - if( !Info_bKGD( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_cHRM : - if( !Info_cHRM( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_eXPI : - if( !Info_eXPI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_fPRI : - if( !Info_fPRI( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_gAMA : - if( !Info_gAMA( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_hIST : - if( !Info_hIST( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_iCCP : - if( !Info_iCCP( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_iTXt : // untested @ap@ - if( !Info_iTXt( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_nEED : - if( !Info_nEED( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_oFFs 0x6f464673L // Function AWOL @ap@ -#define MNG_UINT_pCAL 0x7043414cL // Function AWOL @ap@ - case MNG_UINT_pHYg : // untested @ap@ - if( !Info_pHYg( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_pHYs : - if( !Info_pHYs( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_sBIT : - if( !Info_sBIT( hMNG, hChunk, asDataText ) ) return false; break; -#define MNG_UINT_sCAL 0x7343414cL // Function AWOL @ap@ - case MNG_UINT_sPLT : // untested @ap@ - if( !Info_sPLT( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_sRGB : - if( !Info_sRGB( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_tEXt : - if( !Info_tEXt( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_tIME : - if( !Info_tIME( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_tRNS : - if( !Info_tRNS( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_zTXt : - if( !Info_zTXt( hMNG, hChunk, asDataText ) ) return false; break; - case MNG_UINT_HUH : - default : // this will catch unknown chunks - Huh ! - if( !Info_Unknown( hMNG, hChunk, asDataText ) ) return false; break; - } // end of switch - //------------------------------------------------- - - // Add this chunk's string to our string list - strList->Insert( GetChunkCount(), asDataText ); - - // Now's the time to bump chunk count - IncChunkCount(); - - // Add this chunk's string to the Report - MainForm->RichEditReport->Lines->Add( asDataText ); - - return true; -} -//--------------------------------------------------------------------------- - diff --git a/Engine/lib/lmng/contrib/bcb/mngdump/Main.dfm b/Engine/lib/lmng/contrib/bcb/mngdump/Main.dfm deleted file mode 100644 index 3187217d06263abb5438dccafee5138b0a3fe86a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28109 zcmeHQ&u<(@c5cpy^NXS^du<1cHR47Pj4dP9TFYHCMh*^1NtOapB1CePx%4 znZZntMp_skfxQUH!3*dT<*6> zcfX=5C$9LrLD8EjZnQgv{_Ks$POw+}x0%ut3tpuKV4_uCiYb?l%27=ftYt>X)lT%G$ZgTD#XEl=7)gdwsj>`>hqf75LrC z`d)i*snH6mm20h)uI~kY8J@cPs$RX;I`8*_Zu@Q-FuMDpFu&Hg<2QS2e)n=~d#`Y( zMw}tS(@tq)&1?D1l9cBpO9e-got+Z%7(Xft-IrQ3yyPg zW4+`1JInnbXtyf8t)O+S=oKHUa z1RX>9?+k~mVZ%Q*q1Zew-Gue<$>t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VdHt?g!i2X_=D0?&Ux`@0JbXDFT!HH0=1YY=3 zi_w8v5$1V>Ep2c6xR&U3E77U08XHY`8CpJdW~0HJ;HByOu~cO&)Jq%6XZkoR&d(&T zCZ`Q0ifr8G;n(lpz|$b{1`f`Reh=4;EhNRwneY%XFX8wDgJijl*KO>ZUChg#Yu)y( zuHU1hlU6;PZ~v{X{A#cNZqDJxtGa|=Ty3j;#nrR=q?2F$o_SSLj)^9~QenHN?d$<+XlMhe>lDEL-Hu#c?^9`@rzBOm6 z=Sp~g1+FcZUcc%GgLd~rm+!Oaee~AZpSEuO*;{8jQtr2I)h@U23Kp+bb~n=52f26}Xij zl1BZdx{~$V9iq`CZ>t*jQIGtIU*zc}afHA8t4q6ULrwiTtnpa5`h&<#95C~6;Z7rn zx@RxcDe4q52kh71e2q`B#4RdgS?3+A#4eUUV%4u1nypjhlV7_5{zkU=*MA<1WBr+= z2~)Vb5JiYXF9907M7<|g`t`s#|4ZXM{x`YCH;2Hx9+8V#d;)jw8Xqgh2NPjEILSDX zUC#G^L|(AVDH}IGHg1y7xHWzXSAQ6Jh!0feq0cYiOU-7aGq)~HZk>&KcfAOdsvWK2 zKC?soC^C6RC~dwjs#$$^*8g#Pp!@-m*3VSoIJF(;^@@k zvAvE}!uDR|q>M?=hQ#!`h+B%0P8H{v)(*j%)L%5IXBw%Hikcl)amz7sRuf-!wng3w z-Pi!MjUE8bz|2;71~%1m@!PO3oWF2!Y4gg)bT8I=V%>?&d9l_UKEoK9U!w}n96rm8 zq!&SRwcVYiR<9v9R(E$U?CxS}^-k~Z;0;>aKJ{_L_X4MUt+mwYH1C#AvrP@_oV3^{ z{sKN6_!*2(rEug{T`8(h5q?5A-%*;lx5+ -#include -#include -#include -#include -#include -#include -#include -#include -#include -//--------------------------------------------------------------------------- -// These MUST be defined before we include "Libmng.h -//# define MNG_SUPPORT_READ -//# define MNG_ACCESS_CHUNKS -//# define MNG_STORE_CHUNKS -//# define MNG_NO_CMS -# define MNG_USE_DLL -# define MNG_SKIP_ZLIB -# define MNG_SKIP_LCMS -# define MNG_SKIP_IJG6B - -#include "../../../libmng.h" -//--------------------------------------------------------------------------- -class TMainForm : public TForm -{ -__published: // IDE-managed Components - TMainMenu *MainMenu1; - TMenuItem *mnuFile; - TMenuItem *mnuOpen; - TMenuItem *mnuReload; - TMenuItem *mnuSave; - TMenuItem *N1; - TMenuItem *mnuPrint; - TMenuItem *mnuPrintSetup; - TMenuItem *N2; - TMenuItem *mnuExit; - TMenuItem *mnuEdit; - TMenuItem *mnuUndo; - TMenuItem *N3; - TMenuItem *mnuCut; - TMenuItem *mnuCopy; - TMenuItem *mnuPaste; - TMenuItem *N4; - TMenuItem *mnuSelectAll; - TMenuItem *N5; - TMenuItem *mnuSetFont; - TMenuItem *mnuWordWrap; - TMenuItem *mnuSearch; - TMenuItem *mnuFind; - TMenuItem *mnuFindNext; - TPanel *Panel1; - TSpeedButton *sbtnOpen; - TSpeedButton *sbtnReload; - TSpeedButton *sbtnSave; - TSpeedButton *sbtnPrint; - TSpeedButton *sbtnPrintSetup; - TSpeedButton *sbtnUndo; - TSpeedButton *sbtnCut; - TSpeedButton *sbtnCopy; - TSpeedButton *sbtnPaste; - TOpenDialog *OpenDialog1; - TSaveDialog *SaveDialog1; - TPrintDialog *PrintDialog; - TPrinterSetupDialog *PrinterSetupDialog; - TFontDialog *FontDialog1; - TFindDialog *FindDialog; - TPageControl *PageControl1; - TTabSheet *tsChunks; - TTabSheet *tsReport; - TPanel *pnlChunks; - TListBox *ListBoxChunks; - TSpeedButton *sbtnCopyChunk; - TRichEdit *RichEditChunks; - TRichEdit *RichEditReport; - TPanel *PanelStatusBar; - TProgressBar *ProgressBar1; - TTabSheet *tsOptions; - TTabSheet *tsAbout; - TLabel *LabelAbout; - TTabSheet *tsHelp; - TLabel *LabelHelp; - TCheckBox *cbBool; - TCheckBox *cbMacroIdentifier; - TCheckBox *cbRawData; - TCheckBox *cbRGBOrder; - TCheckBox *cbPaletteEntries; - TCheckBox *cbComments; - TRadioGroup *RadioGroupTabSize; - TStaticText *StaticTextStatus; - TStaticText *StaticText1; - void __fastcall mnuFileOpenClick(TObject *Sender); - void __fastcall FormCreate(TObject *Sender); - void __fastcall ListBoxChunksClick(TObject *Sender); - void __fastcall mnuReloadClick(TObject *Sender); - void __fastcall mnuExitClick(TObject *Sender); - void __fastcall FormDestroy(TObject *Sender); - void __fastcall mnuUndoClick(TObject *Sender); - void __fastcall mnuCutClick(TObject *Sender); - void __fastcall mnuCopyClick(TObject *Sender); - void __fastcall mnuPasteClick(TObject *Sender); - void __fastcall mnuSelectAllClick(TObject *Sender); - void __fastcall mnuWordWrapClick(TObject *Sender); - void __fastcall mnuSetFontClick(TObject *Sender); - void __fastcall FontDialog1Apply(TObject *Sender, HWND Wnd); - void __fastcall mnuFindClick(TObject *Sender); - void __fastcall FindDialogFind(TObject *Sender); - void __fastcall mnuFindNextClick(TObject *Sender); - void __fastcall sbtnCopyChunkClick(TObject *Sender); - void __fastcall mnuPrintClick(TObject *Sender); - void __fastcall mnuPrintSetupClick(TObject *Sender); - void __fastcall mnuSaveClick(TObject *Sender); - void __fastcall EventShowPage(TObject *Sender); - void __fastcall RadioGroupTabSizeClick(TObject *Sender); -protected : - void virtual __fastcall OnMinMax(TMessage& Msg); - BEGIN_MESSAGE_MAP // to limit minimum form size for about/help panes - MESSAGE_HANDLER( WM_GETMINMAXINFO, TMessage, OnMinMax ) - END_MESSAGE_MAP(TForm) -private: // User declarations - FILE *fd; - int iChunkCount; // To link stringList to listbox - String asTab; // Number of spaces to use as tab stop -public: // User declarations - // Constructor - __fastcall TMainForm(TComponent* Owner); - // Destructor - __fastcall ~TMainForm( void ); - - // ------------------------------------------------------------------ - // Callbacks ... as static member functions - // ------------------------------------------------------------------ - static mng_ptr __stdcall Alloc( mng_size_t iSize ); - static void __stdcall Free( mng_ptr pPtr, mng_size_t iSize ); - static mng_bool __stdcall FileReadData( mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead ); - static mng_bool __stdcall ProcessHeader( mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight ); - static mng_bool __stdcall OpenStream( mng_handle hMNG ); - static mng_bool __stdcall CloseStream( mng_handle hMNG ); - static mng_bool __stdcall IterateChunks( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq ); - - // ------------------------------------------------------------------ - //public data members - // ------------------------------------------------------------------ - // Associates a string, strList[n], with a chunk in the listbox[N] - TStringList *strList; - String asAppName; // pinch Application->Title at startup - - // ------------------------------------------------------------------ - // MessageBox functions - // ------------------------------------------------------------------ - int __fastcall MessageBox( String &as, UINT flags ); - void __fastcall MsgBoxOk( String as ); - int __fastcall MsgBoxYN( String as ); - int __fastcall MsgBoxYNC( String as ); - void __fastcall MsgBoxStop( String as ); - void __fastcall MsgBoxInfo( String as ); - void __fastcall MsgBoxWarn( String as ); - - // ------------------------------------------------------------------ - // Just to isolate teh "FILE *fd" variable from possible change. - inline FILE* __fastcall GetFd( void ) - { return fd; }; - - // ------------------------------------------------------------------ - // Options - // ------------------------------------------------------------------ - inline bool _fastcall WantsComments( void ) - { return cbComments->Checked; }; - - inline bool _fastcall WantsPaletteEntries( void ) - { return cbPaletteEntries->Checked; }; - - inline bool _fastcall WantsRgbOrder( void ) - { return cbRGBOrder->Checked; }; - - inline bool _fastcall WantsRawData( void ) - { return cbRawData->Checked; }; - - inline bool _fastcall WantsMacroIds( void ) - { return cbMacroIdentifier->Checked; }; - - inline bool _fastcall WantsBool( void ) - { return cbBool->Checked; }; - - // ------------------------------------------------------------------ - // Chunk count stuff - // ------------------------------------------------------------------ - inline int __fastcall IncChunkCount( void ) - { return iChunkCount += 1; }; - inline int __fastcall SetChunkCount( int anInt ) - { iChunkCount = anInt; }; - inline int __fastcall GetChunkCount( void ) - { return iChunkCount; }; - - // ------------------------------------------------------------------ - // Open a file, initialise things, and then calls "Dumptree(...)" - void __fastcall LoadFile( void ); - - // All LibMng calls involving the library handle are made from here : - // Initialize the library - // Setup callbacks - // Read the file into memory - // Run through the chunk list (mng_iterate_chunks) - // Cleanup the library - // Show Report page, all done. (then explode into the starry heavens!) - bool __fastcall DumpTree( void ); - - // Handle library errors gracefully. - void __fastcall MNGError( mng_handle hMNG, String SHMsg ); - - // Uesd with Palette entries - to right align int's to N chars width - String __fastcall PadInt( int iInt, int iWidth = 3 ); // default = 3 - - // A long switch that calls Info_XXXX's to assemble the chunks string - mng_bool __fastcall ShowChunk( mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype ); - - // ------------------------------------------------------------------ - // The following functions are to assemble a string for each chunk. - // The function name "Info_????" denotes which chunk it handles - // Definitions can be found in "Chunks.cpp" - // ------------------------------------------------------------------ - bool __fastcall Info_BACK( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_BASI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_CLIP( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_CLON( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DBYK( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DEFI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DISC( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_DROP( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_ENDL( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_FRAM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_IDAT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_IEND( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_IHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_IJNG - Function missing @ap@ - // MNG_UINT_IPNG - Function missing @ap@ - bool __fastcall Info_JDAT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_JHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_JSEP - Function missing @ap@ - bool __fastcall Info_LOOP( mng_handle hMNG, mng_handle hChunk, String &as ); - // MAGN ? MNG_UINT_MAGN @ap@ - bool __fastcall Info_MEND( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_MHDR( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_MOVE( mng_handle hMNG, mng_handle hChunk, String &as ); - // MaGN ? MNG_UINT_MaGN @ap@ - bool __fastcall Info_ORDR( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PAST( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PLTE( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PPLT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_PROM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_SAVE( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_SEEK( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_SHOW( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_TERM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_bKGD( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_cHRM( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_eXPI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_fPRI( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_gAMA( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_hIST( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_iCCP( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_iTXt( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_nEED( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_oFFs - Function missing @ap@ - // MNG_UINT_pCAL - Function missing @ap@ - bool __fastcall Info_pHYg( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_pHYs( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_sBIT( mng_handle hMNG, mng_handle hChunk, String &as ); - // MNG_UINT_sCAL - Function missing @ap@ - bool __fastcall Info_sPLT( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_sRGB( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_tEXt( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_tIME( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_tRNS( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_zTXt( mng_handle hMNG, mng_handle hChunk, String &as ); - bool __fastcall Info_Unknown( mng_handle hMNG, mng_handle hChunk, String &as ); - -}; -//--------------------------------------------------------------------------- -extern PACKAGE TMainForm *MainForm; -//--------------------------------------------------------------------------- -#endif diff --git a/Engine/lib/lmng/contrib/delphi/libmng.pas b/Engine/lib/lmng/contrib/delphi/libmng.pas deleted file mode 100644 index 1fabb2331..000000000 --- a/Engine/lib/lmng/contrib/delphi/libmng.pas +++ /dev/null @@ -1,1811 +0,0 @@ -unit libmng; - -{****************************************************************************} -{* *} -{* COPYRIGHT NOTICE: *} -{* *} -{* Copyright (c) 2000-2004 Gerard Juyn (gerard@libmng.com) *} -{* [You may insert additional notices after this sentence if you modify *} -{* this source] *} -{* *} -{* For the purposes of this copyright and license, "Contributing Authors" *} -{* is defined as the following set of individuals: *} -{* *} -{* Gerard Juyn *} -{* (hopefully some more to come...) *} -{* *} -{* The MNG Library is supplied "AS IS". The Contributing Authors *} -{* disclaim all warranties, expressed or implied, including, without *} -{* limitation, the warranties of merchantability and of fitness for any *} -{* purpose. The Contributing Authors assume no liability for direct, *} -{* indirect, incidental, special, exemplary, or consequential damages, *} -{* which may result from the use of the MNG Library, even if advised of *} -{* the possibility of such damage. *} -{* *} -{* Permission is hereby granted to use, copy, modify, and distribute this *} -{* source code, or portions hereof, for any purpose, without fee, subject *} -{* to the following restrictions: *} -{* *} -{* 1. The origin of this source code must not be misrepresented; *} -{* you must not claim that you wrote the original software. *} -{* *} -{* 2. Altered versions must be plainly marked as such and must not be *} -{* misrepresented as being the original source. *} -{* *} -{* 3. This Copyright notice may not be removed or altered from any source *} -{* or altered source distribution. *} -{* *} -{* The Contributing Authors specifically permit, without fee, and *} -{* encourage the use of this source code as a component to supporting *} -{* the MNG and JNG file format in commercial products. If you use this *} -{* source code in a product, acknowledgment would be highly appreciated. *} -{* *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : libmng.pas copyright (c) 2000-2004 G.Juyn *} -{* version : 1.0.8 *} -{* *} -{* purpose : libmng.dll wrapper unit *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info (at) 3-t (dot) com *} -{* *} -{* comment : contains the pascal-translation of libmng.h *} -{* can be used by Delphi programs to access the libmng.dll *} -{* *} -{* changes : 0.5.1 - 05/02/2000 - G.Juyn *} -{* - added this version block *} -{* 0.5.1 - 05/08/2000 - G.Juyn *} -{* - changed to stdcall convention *} -{* 0.5.1 - 05/11/2000 - G.Juyn *} -{* - changed callback prototypes *} -{* - added TRUE/FALSE/NULL constants *} -{* - added setoutputprofile2 & setsrgbprofile2 *} -{* - added several new types *} -{* - added chunk-access functions *} -{* - added new error- & tracecodes *} -{* *} -{* 0.5.2 - 05/24/2000 - G.Juyn *} -{* - removed error- & trace-strings since they are now *} -{* provided by the library *} -{* *} -{* 0.5.3 - 06/21/2000 - G.Juyn *} -{* - fixed definition of imagetype *} -{* - added definition of speedtype *} -{* - added get/set speed parameter *} -{* - added get imagelevel parameter *} -{* 0.5.3 - 06/26/2000 - G.Juyn *} -{* - changed definition of userdata to mng_ptr *} -{* 0.5.3 - 06/28/2000 - G.Juyn *} -{* - added mng_size_t definition *} -{* - changed definition of memory alloc size to mng_size_t *} -{* 0.5.3 - 06/29/2000 - G.Juyn *} -{* - changed order of refresh parameters *} -{* - changed definition of mng_handle *} -{* *} -{* 0.9.0 - 06/30/2000 - G.Juyn *} -{* - changed refresh parameters to 'x,y,width,height' *} -{* *} -{* 0.9.1 - 07/08/2000 - G.Juyn *} -{* - added libmng errorcode constants *} -{* 0.9.1 - 07/10/2000 - G.Juyn *} -{* - added new libmng functions *} -{* 0.9.1 - 07/19/2000 - G.Juyn *} -{* - fixed several type definitions *} -{* 0.9.1 - 07/25/2000 - G.Juyn *} -{* - fixed definition of mng_imgtype *} -{* *} -{* 0.9.2 - 08/04/2000 - G.Juyn *} -{* - fixed in line with libmng.h *} -{* 0.9.2 - 08/05/2000 - G.Juyn *} -{* - added function to set simplicity field *} -{* *} -{* 0.9.3 - 10/21/2000 - G.Juyn *} -{* - added several new HLAPI entry points *} -{* *} -{* 1.0.5 - 09/16/2002 - G.Juyn *} -{* - added dynamic MNG features *} -{* *} -{* 1.0.8 - 04/12/2004 - G.Juyn *} -{* - added CRC existence & checking flags *} -{* - added push mechanisms *} -{* *} -{****************************************************************************} - -interface - -{****************************************************************************} - -const MNG_TRUE = TRUE; - MNG_FALSE = FALSE; - MNG_NULL = nil; - -type mng_uint32 = cardinal; - mng_int32 = integer; - mng_uint16 = word; - mng_int16 = smallint; - mng_uint8 = byte; - mng_int8 = shortint; - mng_bool = boolean; - mng_ptr = pointer; - mng_pchar = pchar; - - mng_handle = pointer; - mng_retcode = mng_int32; - mng_chunkid = mng_uint32; - - mng_size_t = cardinal; - - mng_imgtype = (mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng); - mng_speedtype = (mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest); - - mng_uint32p = ^mng_uint32; - mng_uint16p = ^mng_uint16; - mng_uint8p = ^mng_uint8; - mng_chunkidp = ^mng_chunkid; - - mng_palette8e = packed record { 8-bit palette element } - iRed : mng_uint8; - iGreen : mng_uint8; - iBlue : mng_uint8; - end; - - mng_palette8 = packed array [0 .. 255] of mng_palette8e; - - mng_uint8arr = packed array [0 .. 255] of mng_uint8; - mng_uint8arr4 = packed array [0 .. 3] of mng_uint8; - mng_uint16arr = packed array [0 .. 255] of mng_uint16; - mng_uint32arr2 = packed array [0 .. 1] of mng_uint32; - -{****************************************************************************} - -type mng_memalloc = function ( iLen : mng_size_t) : mng_ptr; stdcall; -type mng_memfree = procedure ( pPtr : mng_ptr; - iLen : mng_size_t); stdcall; - -type mng_releasedata = procedure ( pUserData : mng_ptr; - pData : mng_ptr; - iLength : mng_size_t); stdcall; - -type mng_openstream = function ( hHandle : mng_handle) : mng_bool; stdcall; -type mng_closestream = function ( hHandle : mng_handle) : mng_bool; stdcall; - -type mng_readdata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; stdcall; - -type mng_writedata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pWritten : mng_uint32) : mng_bool; stdcall; - -type mng_errorproc = function ( hHandle : mng_handle; - iErrorcode : mng_retcode; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar ) : mng_bool; stdcall; -type mng_traceproc = function ( hHandle : mng_handle; - iFuncnr : mng_int32; - iFuncseq : mng_uint32; - zFuncname : mng_pchar ) : mng_bool; stdcall; - -type mng_processheader = function ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; -type mng_processtext = function ( hHandle : mng_handle; - iType : mng_uint8; - zKeyword : mng_pchar; - zText : mng_pchar; - zLanguage : mng_pchar; - zTranslation : mng_pchar ) : mng_bool; stdcall; - -type mng_processsave = function ( hHandle : mng_handle) : mng_bool; stdcall; -type mng_processseek = function ( hHandle : mng_handle; - zName : mng_pchar ) : mng_bool; stdcall; - -type mng_processneed = function ( hHandle : mng_handle; - zKeyword : mng_pchar ) : mng_bool; stdcall; - -type mng_processunknown = function ( hHandle : mng_handle; - iChunkid : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_bool; stdcall; - -type mng_getcanvasline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -type mng_getalphaline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -type mng_getbkgdline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -type mng_refresh = function ( hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; - -type mng_gettickcount = function ( hHandle : mng_handle) : mng_uint32; stdcall; -type mng_settimer = function ( hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; stdcall; - -type mng_processgamma = function ( hHandle : mng_handle; - iGamma : mng_uint32) : mng_bool; stdcall; -type mng_processchroma = function ( hHandle : mng_handle; - iWhitex : mng_uint32; - iWhitey : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32) : mng_bool; stdcall; -type mng_processsrgb = function ( hHandle : mng_handle; - iIntent : mng_uint8 ) : mng_bool; stdcall; -type mng_processiccp = function ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_bool; stdcall; -type mng_processarow = function ( hHandle : mng_handle; - iRowsamples : mng_uint32; - bIsRGBA16 : mng_bool; - pRow : mng_ptr ) : mng_bool; stdcall; - -type mng_iteratechunk = function ( hHandle : mng_handle; - hChunk : mng_handle; - iChunkid : mng_chunkid; - iChunkseq : mng_uint32) : mng_bool; stdcall; - -{****************************************************************************} - -function mng_initialize ( pUserdata : mng_ptr; - fMemalloc : mng_memalloc; - fMemfree : mng_memfree; - fTraceproc : mng_traceproc ) : mng_handle; stdcall; - -function mng_reset ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_cleanup (var hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_read ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_read_pushdata ( hHandle : mng_handle; - pData : mng_ptr; - iLength : mng_uint32; - bTakeownership : mng_bool ) : mng_retcode; stdcall; -function mng_read_pushsig ( hHandle : mng_handle; - eSigtype : mng_imgtype ) : mng_retcode; stdcall; -function mng_read_pushchunk ( hHandle : mng_handle; - pData : mng_ptr; - iLength : mng_uint32; - bTakeownership : mng_bool ) : mng_retcode; stdcall; -function mng_read_resume ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_write ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_create ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_readdisplay ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_resume ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_freeze ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_reset ( hHandle : mng_handle ) : mng_retcode; stdcall; -function mng_display_goframe ( hHandle : mng_handle; - iFramenr : mng_uint32 ) : mng_retcode; stdcall; -function mng_display_golayer ( hHandle : mng_handle; - iLayernr : mng_uint32 ) : mng_retcode; stdcall; -function mng_display_gotime ( hHandle : mng_handle; - iPlaytime : mng_uint32 ) : mng_retcode; stdcall; - -function mng_trapevent ( hHandle : mng_handle; - iEventtype : mng_uint8; - iX : mng_int32; - iY : mng_int32 ) : mng_retcode; stdcall; - -function mng_getlasterror ( hHandle : mng_handle; - var iSeverity : mng_uint8; - var iChunkname : mng_chunkid; - var iChunkseq : mng_uint32; - var iExtra1 : mng_int32; - var iExtra2 : mng_int32; - var zErrortext : mng_pchar ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_setcb_memalloc ( hHandle : mng_handle; - fProc : mng_memalloc ) : mng_retcode; stdcall; -function mng_setcb_memfree ( hHandle : mng_handle; - fProc : mng_memfree ) : mng_retcode; stdcall; -function mng_setcb_releasedata ( hHandle : mng_handle; - fProc : mng_releasedata ) : mng_retcode; stdcall; - -function mng_setcb_openstream ( hHandle : mng_handle; - fProc : mng_openstream ) : mng_retcode; stdcall; -function mng_setcb_closestream ( hHandle : mng_handle; - fProc : mng_closestream ) : mng_retcode; stdcall; - -function mng_setcb_readdata ( hHandle : mng_handle; - fProc : mng_readdata ) : mng_retcode; stdcall; - -function mng_setcb_writedata ( hHandle : mng_handle; - fProc : mng_writedata ) : mng_retcode; stdcall; - -function mng_setcb_errorproc ( hHandle : mng_handle; - fProc : mng_errorproc ) : mng_retcode; stdcall; -function mng_setcb_traceproc ( hHandle : mng_handle; - fProc : mng_traceproc ) : mng_retcode; stdcall; - -function mng_setcb_processheader ( hHandle : mng_handle; - fProc : mng_processheader) : mng_retcode; stdcall; -function mng_setcb_processtext ( hHandle : mng_handle; - fProc : mng_processtext ) : mng_retcode; stdcall; - -function mng_setcb_getcanvasline ( hHandle : mng_handle; - fProc : mng_getcanvasline) : mng_retcode; stdcall; -function mng_setcb_getalphaline ( hHandle : mng_handle; - fProc : mng_getalphaline ) : mng_retcode; stdcall; -function mng_setcb_getbkgdline ( hHandle : mng_handle; - fProc : mng_getbkgdline ) : mng_retcode; stdcall; -function mng_setcb_refresh ( hHandle : mng_handle; - fProc : mng_refresh ) : mng_retcode; stdcall; - -function mng_setcb_gettickcount ( hHandle : mng_handle; - fProc : mng_gettickcount ) : mng_retcode; stdcall; -function mng_setcb_settimer ( hHandle : mng_handle; - fProc : mng_settimer ) : mng_retcode; stdcall; - -function mng_setcb_processgamma ( hHandle : mng_handle; - fProc : mng_processgamma ) : mng_retcode; stdcall; -function mng_setcb_processchroma ( hHandle : mng_handle; - fProc : mng_processchroma) : mng_retcode; stdcall; -function mng_setcb_processsrgb ( hHandle : mng_handle; - fProc : mng_processsrgb ) : mng_retcode; stdcall; -function mng_setcb_processiccp ( hHandle : mng_handle; - fProc : mng_processiccp ) : mng_retcode; stdcall; -function mng_setcb_processarow ( hHandle : mng_handle; - fProc : mng_processarow ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_getcb_memalloc ( hHandle : mng_handle ) : mng_memalloc; stdcall; -function mng_getcb_memfree ( hHandle : mng_handle ) : mng_memfree; stdcall; -function mng_getcb_releasedata ( hHandle : mng_handle ) : mng_releasedata; stdcall; - -function mng_getcb_openstream ( hHandle : mng_handle ) : mng_openstream; stdcall; -function mng_getcb_closestream ( hHandle : mng_handle ) : mng_closestream; stdcall; - -function mng_getcb_readdata ( hHandle : mng_handle ) : mng_readdata; stdcall; - -function mng_getcb_writedata ( hHandle : mng_handle ) : mng_writedata; stdcall; - -function mng_getcb_errorproc ( hHandle : mng_handle ) : mng_errorproc; stdcall; -function mng_getcb_traceproc ( hHandle : mng_handle ) : mng_traceproc; stdcall; - -function mng_getcb_processheader ( hHandle : mng_handle ) : mng_processheader; stdcall; -function mng_getcb_processtext ( hHandle : mng_handle ) : mng_processtext; stdcall; - -function mng_getcb_getcanvasline ( hHandle : mng_handle ) : mng_getcanvasline; stdcall; -function mng_getcb_getalphaline ( hHandle : mng_handle ) : mng_getalphaline; stdcall; -function mng_getcb_getbkgdline ( hHandle : mng_handle ) : mng_getbkgdline; stdcall; -function mng_getcb_refresh ( hHandle : mng_handle ) : mng_refresh; stdcall; - -function mng_getcb_gettickcount ( hHandle : mng_handle ) : mng_gettickcount; stdcall; -function mng_getcb_settimer ( hHandle : mng_handle ) : mng_settimer; stdcall; - -function mng_getcb_processgamma ( hHandle : mng_handle ) : mng_processgamma; stdcall; -function mng_getcb_processchroma ( hHandle : mng_handle ) : mng_processchroma; stdcall; -function mng_getcb_processsrgb ( hHandle : mng_handle ) : mng_processsrgb; stdcall; -function mng_getcb_processiccp ( hHandle : mng_handle ) : mng_processiccp; stdcall; -function mng_getcb_processarow ( hHandle : mng_handle ) : mng_processarow; stdcall; - -{****************************************************************************} - -function mng_set_userdata ( hHandle : mng_handle; - pUserdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_set_canvasstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_bkgdstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; stdcall; - -function mng_set_bgcolor ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; stdcall; - -function mng_set_usebkgd ( hHandle : mng_handle; - bUseBKGD : mng_bool ) : mng_retcode; stdcall; - -function mng_set_storechunks ( hHandle : mng_handle; - bStorechunks : mng_bool ) : mng_retcode; stdcall; - -function mng_set_cacheplayback ( hHandle : mng_handle; - bCacheplayback : mng_bool ) : mng_retcode; stdcall; - -function mng_set_viewgammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_displaygammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_dfltimggammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; stdcall; - -function mng_set_srgb ( hHandle : mng_handle; - bIssRGB : mng_bool ) : mng_retcode; stdcall; -function mng_set_outputprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; stdcall; -function mng_set_outputprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; stdcall; -function mng_set_srgbprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; stdcall; -function mng_set_srgbprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; stdcall; - -function mng_set_maxcanvaswidth ( hHandle : mng_handle; - iMaxwidth : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_maxcanvasheight ( hHandle : mng_handle; - iMaxheight : mng_uint32 ) : mng_retcode; stdcall; -function mng_set_maxcanvassize ( hHandle : mng_handle; - iMaxwidth : mng_uint32; - iMaxheight : mng_uint32 ) : mng_retcode; stdcall; - -function mng_set_suspensionmode ( hHandle : mng_handle; - bSuspensionmode : mng_bool ) : mng_retcode; stdcall; - -function mng_set_speed ( hHandle : mng_handle; - iSpeed : mng_speedtype ) : mng_retcode; stdcall; - -function mng_set_crcmode ( hHandle : mng_handle; - iCrcmode : mng_uint32 ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_get_userdata ( hHandle : mng_handle ) : mng_ptr; stdcall; - -function mng_get_sigtype ( hHandle : mng_handle ) : mng_imgtype; stdcall; -function mng_get_imagetype ( hHandle : mng_handle ) : mng_imgtype; stdcall; -function mng_get_imagewidth ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_imageheight ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_ticks ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_framecount ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_layercount ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_playtime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_simplicity ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_canvasstyle ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_bkgdstyle ( hHandle : mng_handle ) : mng_uint32; stdcall; - -procedure mng_get_bgcolor ( hHandle : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ); stdcall; - -function mng_get_usebkgd ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_storechunks ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_get_cacheplayback ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_viewgammaint ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_displaygammaint ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_dfltimggammaint ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_srgb ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_maxcanvaswidth ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_maxcanvasheight ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_suspensionmode ( hHandle : mng_handle ) : mng_bool; stdcall; - -function mng_get_speed ( hHandle : mng_handle ) : mng_speedtype; stdcall; -function mng_get_imagelevel ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_get_starttime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_runtime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_currentframe ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_currentlayer ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_currentplaytime ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_totalframes ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_totallayers ( hHandle : mng_handle ) : mng_uint32; stdcall; -function mng_get_totalplaytime ( hHandle : mng_handle ) : mng_uint32; stdcall; - -function mng_status_error ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_reading ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_suspendbreak ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_creating ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_writing ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_displaying ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_running ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_timerbreak ( hHandle : mng_handle ) : mng_bool; stdcall; -function mng_status_dynamic ( hHandle : mng_handle ) : mng_bool; stdcall; - -{****************************************************************************} - -function mng_iterate_chunks ( hHandle : mng_handle; - iChunkseq : mng_uint32; - fProc : mng_iteratechunk ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_getchunk_ihdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_plte ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var aPalette : mng_palette8 ) : mng_retcode; stdcall; - -function mng_getchunk_idat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_trns ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var bGlobal : mng_bool; - var iType : mng_uint8; - var iCount : mng_uint32; - var aAlphas : mng_uint8arr; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iRawlen : mng_uint32; - var aRawdata : mng_uint8arr ) : mng_retcode; stdcall; - -function mng_getchunk_gama ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iGamma : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_chrm ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iWhitepointx : mng_uint32; - var iWhitepointy : mng_uint32; - var iRedx : mng_uint32; - var iRedy : mng_uint32; - var iGreenx : mng_uint32; - var iGreeny : mng_uint32; - var iBluex : mng_uint32; - var iBluey : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_srgb ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iRenderingintent : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_iccp ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iCompression : mng_uint8; - var iProfilesize : mng_uint32; - var pProfile : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_text ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_ztxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompression : mng_uint8; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_itxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompressionflag : mng_uint8; - var iCompressionmethod : mng_uint8; - var iLanguagesize : mng_uint32; - var zLanguage : mng_pchar; - var iTranslationsize : mng_uint32; - var zTranslation : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_bkgd ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var iIndex : mng_uint8; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ) : mng_retcode; stdcall; - -function mng_getchunk_phys ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_sbit ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var aBits : mng_uint8arr4) : mng_retcode; stdcall; - -function mng_getchunk_splt ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iSampledepth : mng_uint8; - var iEntrycount : mng_uint32; - var pEntries : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_hist ( hHandle : mng_handle; - hChunk : mng_handle; - var iEntrycount : mng_uint32; - var aEntries : mng_uint16arr) : mng_retcode; stdcall; - -function mng_getchunk_time ( hHandle : mng_handle; - hChunk : mng_handle; - var iYear : mng_uint16; - var iMonth : mng_uint8; - var iDay : mng_uint8; - var iHour : mng_uint8; - var iMinute : mng_uint8; - var iSecond : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_mhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iTicks : mng_uint32; - var iLayercount : mng_uint32; - var iFramecount : mng_uint32; - var iPlaytime : mng_uint32; - var iSimplicity : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_loop ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8; - var iRepeat : mng_uint32; - var iTermination : mng_uint8; - var iItermin : mng_uint32; - var iItermax : mng_uint32; - var iCount : mng_uint32; - var pSignals : mng_uint32p ) : mng_retcode; stdcall; - -function mng_getchunk_endl ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_defi ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iXlocation : mng_int32; - var iYlocation : mng_int32; - var bHasclip : mng_bool; - var iLeftcb : mng_int32; - var iRightcb : mng_int32; - var iTopcb : mng_int32; - var iBottomcb : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_basi ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var iViewable : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_clon ( hHandle : mng_handle; - hChunk : mng_handle; - var iSourceid : mng_uint16; - var iCloneid : mng_uint16; - var iClonetype : mng_uint8; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iLocationtype : mng_uint8; - var iLocationx : mng_int32; - var iLocationy : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_past ( hHandle : mng_handle; - hChunk : mng_handle; - var iDestid : mng_uint16; - var iTargettype : mng_uint8; - var iTargetx : mng_int32; - var iTargety : mng_int32; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_past_src ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iSourceid : mng_uint16; - var iComposition : mng_uint8; - var iOrientation : mng_uint8; - var iOffsettype : mng_uint8; - var iOffsetx : mng_int32; - var iOffsety : mng_int32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_disc ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pObjectids : mng_uint16p ) : mng_retcode; stdcall; - -function mng_getchunk_back ( hHandle : mng_handle; - hChunk : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iMandatory : mng_uint8; - var iImageid : mng_uint16; - var iTile : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_fram ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iMode : mng_uint8; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iChangedelay : mng_uint8; - var iChangetimeout : mng_uint8; - var iChangeclipping : mng_uint8; - var iChangesyncid : mng_uint8; - var iDelay : mng_uint32; - var iTimeout : mng_uint32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32; - var iCount : mng_uint32; - var pSyncids : mng_uint32p ) : mng_retcode; stdcall; - -function mng_getchunk_move ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMovetype : mng_uint8; - var iMovex : mng_int32; - var iMovey : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_clip ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iCliptype : mng_uint8; - var iClipl : mng_int32; - var iClipr : mng_int32; - var iClipt : mng_int32; - var iClipb : mng_int32 ) : mng_retcode; stdcall; - -function mng_getchunk_show ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMode : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_term ( hHandle : mng_handle; - hChunk : mng_handle; - var iTermaction : mng_uint8; - var iIteraction : mng_uint8; - var iDelay : mng_uint32; - var iItermax : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_save ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iOffsettype : mng_uint8; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_save_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iEntrytype : mng_uint8; - var iOffset : mng_uint32arr2; - var iStarttime : mng_uint32arr2; - var iLayernr : mng_uint32; - var iFramenr : mng_uint32; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_seek ( hHandle : mng_handle; - hChunk : mng_handle; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_expi ( hHandle : mng_handle; - hChunk : mng_handle; - var iSnapshotid : mng_uint16; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_fpri ( hHandle : mng_handle; - hChunk : mng_handle; - var iDeltatype : mng_uint8; - var iPriority : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_need ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_phyg ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_jhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iColortype : mng_uint8; - var iImagesampledepth : mng_uint8; - var iImagecompression : mng_uint8; - var iImageinterlace : mng_uint8; - var iAlphasampledepth : mng_uint8; - var iAlphacompression : mng_uint8; - var iAlphafilter : mng_uint8; - var iAlphainterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_jdat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_getchunk_dhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iImagetype : mng_uint8; - var iDeltatype : mng_uint8; - var iBlockwidth : mng_uint32; - var iBlockheight : mng_uint32; - var iBlockx : mng_uint32; - var iBlocky : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_prom ( hHandle : mng_handle; - hChunk : mng_handle; - var iColortype : mng_uint8; - var iSampledepth : mng_uint8; - var iFilltype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_pplt ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_pplt_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var bUsed : mng_bool ) : mng_retcode; stdcall; - -function mng_getchunk_drop ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pChunknames : mng_chunkidp ) : mng_retcode; stdcall; - -function mng_getchunk_dbyk ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iPolarity : mng_uint8; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_getchunk_ordr ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_getchunk_ordr_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iChunkname : mng_chunkid; - var iOrdertype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_getchunk_unknown ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_putchunk_ihdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_plte ( hHandle : mng_handle; - iCount : mng_uint32; - aPalette : mng_palette8 ) : mng_retcode; stdcall; - -function mng_putchunk_idat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_iend ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_putchunk_trns ( hHandle : mng_handle; - bEmpty : mng_bool; - bGlobal : mng_bool; - iType : mng_uint8; - iCount : mng_uint32; - aAlphas : mng_uint8arr; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iRawlen : mng_uint32; - aRawdata : mng_uint8arr ) : mng_retcode; stdcall; - -function mng_putchunk_gama ( hHandle : mng_handle; - bEmpty : mng_bool; - iGamma : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_chrm ( hHandle : mng_handle; - bEmpty : mng_bool; - iWhitepointx : mng_uint32; - iWhitepointy : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_srgb ( hHandle : mng_handle; - bEmpty : mng_bool; - iRenderingintent : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_iccp ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iCompression : mng_uint8; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_text ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_ztxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompression : mng_uint8; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_itxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompressionflag : mng_uint8; - iCompressionmethod : mng_uint8; - iLanguagesize : mng_uint32; - zLanguage : mng_pchar; - iTranslationsize : mng_uint32; - zTranslation : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_bkgd ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - iIndex : mng_uint8; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; stdcall; - -function mng_putchunk_phys ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_sbit ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - aBits : mng_uint8arr4) : mng_retcode; stdcall; - -function mng_putchunk_splt ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iSampledepth : mng_uint8; - iEntrycount : mng_uint32; - pEntries : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_hist ( hHandle : mng_handle; - iEntrycount : mng_uint32; - aEntries : mng_uint16arr) : mng_retcode; stdcall; - -function mng_putchunk_time ( hHandle : mng_handle; - iYear : mng_uint16; - iMonth : mng_uint8; - iDay : mng_uint8; - iHour : mng_uint8; - iMinute : mng_uint8; - iSecond : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_mhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iTicks : mng_uint32; - iLayercount : mng_uint32; - iFramecount : mng_uint32; - iPlaytime : mng_uint32; - iSimplicity : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_mend ( hHandle : mng_handle ) : mng_retcode; stdcall; - -function mng_putchunk_loop ( hHandle : mng_handle; - iLevel : mng_uint8; - iRepeat : mng_uint32; - iTermination : mng_uint8; - iItermin : mng_uint32; - iItermax : mng_uint32; - iCount : mng_uint32; - pSignals : mng_uint32p ) : mng_retcode; stdcall; - -function mng_putchunk_endl ( hHandle : mng_handle; - iLevel : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_defi ( hHandle : mng_handle; - iObjectid : mng_uint16; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iXlocation : mng_int32; - iYlocation : mng_int32; - bHasclip : mng_bool; - iLeftcb : mng_int32; - iRightcb : mng_int32; - iTopcb : mng_int32; - iBottomcb : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_basi ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - iViewable : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_clon ( hHandle : mng_handle; - iSourceid : mng_uint16; - iCloneid : mng_uint16; - iClonetype : mng_uint8; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iLocationtype : mng_uint8; - iLocationx : mng_int32; - iLocationy : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_past ( hHandle : mng_handle; - iDestid : mng_uint16; - iTargettype : mng_uint8; - iTargetx : mng_int32; - iTargety : mng_int32; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_past_src ( hHandle : mng_handle; - iEntry : mng_uint32; - iSourceid : mng_uint16; - iComposition : mng_uint8; - iOrientation : mng_uint8; - iOffsettype : mng_uint8; - iOffsetx : mng_int32; - iOffsety : mng_int32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_disc ( hHandle : mng_handle; - iCount : mng_uint32; - pObjectids : mng_uint16p ) : mng_retcode; stdcall; - -function mng_putchunk_back ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iMandatory : mng_uint8; - iImageid : mng_uint16; - iTile : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_fram ( hHandle : mng_handle; - bEmpty : mng_bool; - iMode : mng_uint8; - iNamesize : mng_uint32; - zName : mng_pchar; - iChangedelay : mng_uint8; - iChangetimeout : mng_uint8; - iChangeclipping : mng_uint8; - iChangesyncid : mng_uint8; - iDelay : mng_uint32; - iTimeout : mng_uint32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32; - iCount : mng_uint32; - pSyncids : mng_uint32p ) : mng_retcode; stdcall; - -function mng_putchunk_move ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMovetype : mng_uint8; - iMovex : mng_int32; - iMovey : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_clip ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iCliptype : mng_uint8; - iClipl : mng_int32; - iClipr : mng_int32; - iClipt : mng_int32; - iClipb : mng_int32 ) : mng_retcode; stdcall; - -function mng_putchunk_show ( hHandle : mng_handle; - bEmpty : mng_bool; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMode : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_term ( hHandle : mng_handle; - iTermaction : mng_uint8; - iIteraction : mng_uint8; - iDelay : mng_uint32; - iItermax : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_save ( hHandle : mng_handle; - bEmpty : mng_bool; - iOffsettype : mng_uint8; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_save_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iEntrytype : mng_uint8; - iOffset : mng_uint32arr2; - iStarttime : mng_uint32arr2; - iLayernr : mng_uint32; - iFramenr : mng_uint32; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_seek ( hHandle : mng_handle; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_expi ( hHandle : mng_handle; - iSnapshotid : mng_uint16; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_fpri ( hHandle : mng_handle; - iDeltatype : mng_uint8; - iPriority : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_need ( hHandle : mng_handle; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_phyg ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_jhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iColortype : mng_uint8; - iImagesampledepth : mng_uint8; - iImagecompression : mng_uint8; - iImageinterlace : mng_uint8; - iAlphasampledepth : mng_uint8; - iAlphacompression : mng_uint8; - iAlphafilter : mng_uint8; - iAlphainterlace : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_jdat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; stdcall; - -function mng_putchunk_dhdr ( hHandle : mng_handle; - iObjectid : mng_uint16; - iImagetype : mng_uint8; - iDeltatype : mng_uint8; - iBlockwidth : mng_uint32; - iBlockheight : mng_uint32; - iBlockx : mng_uint32; - iBlocky : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_prom ( hHandle : mng_handle; - iColortype : mng_uint8; - iSampledepth : mng_uint8; - iFilltype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_pplt ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_pplt_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - bUsed : mng_bool ) : mng_retcode; stdcall; - -function mng_putchunk_drop ( hHandle : mng_handle; - iCount : mng_uint32; - pChunknames : mng_chunkidp ) : mng_retcode; stdcall; - -function mng_putchunk_dbyk ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iPolarity : mng_uint8; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; stdcall; - -function mng_putchunk_ordr ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; stdcall; - -function mng_putchunk_ordr_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iChunkname : mng_chunkid; - iOrdertype : mng_uint8 ) : mng_retcode; stdcall; - -function mng_putchunk_unknown ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; stdcall; - -{****************************************************************************} - -function mng_updatemngheader ( hHandle : mng_handle; - iFramecount : mng_uint32; - iLayercount : mng_uint32; - iPlaytime : mng_uint32 ) : mng_retcode; stdcall; - -function mng_updatemngsimplicity ( hHandle : mng_handle; - iSimplicity : mng_uint32 ) : mng_retcode; stdcall; - -{****************************************************************************} - -const MNG_NOERROR = 0; - - MNG_OUTOFMEMORY = 1; - MNG_INVALIDHANDLE = 2; - MNG_NOCALLBACK = 3; - MNG_UNEXPECTEDEOF = 4; - MNG_ZLIBERROR = 5; - MNG_JPEGERROR = 6; - MNG_LCMSERROR = 7; - MNG_NOOUTPUTPROFILE = 8; - MNG_NOSRGBPROFILE = 9; - MNG_BUFOVERFLOW = 10; - MNG_FUNCTIONINVALID = 11; - MNG_OUTPUTERROR = 12; - MNG_JPEGBUFTOOSMALL = 13; - MNG_NEEDMOREDATA = 14; - MNG_NEEDTIMERWAIT = 15; - MNG_NEEDSECTIONWAIT = 16; - - MNG_APPIOERROR = 901; - MNG_APPTIMERERROR = 902; - MNG_APPCMSERROR = 903; - MNG_APPMISCERROR = 904; - MNG_APPTRACEABORT = 905; - - MNG_INTERNALERROR = 999; - - MNG_INVALIDSIG = 1025; - MNG_INVALIDCRC = 1027; - MNG_INVALIDLENGTH = 1028; - MNG_SEQUENCEERROR = 1029; - MNG_CHUNKNOTALLOWED = 1030; - MNG_MULTIPLEERROR = 1031; - MNG_PLTEMISSING = 1032; - MNG_IDATMISSING = 1033; - MNG_CANNOTBEEMPTY = 1034; - MNG_GLOBALLENGTHERR = 1035; - MNG_INVALIDBITDEPTH = 1036; - MNG_INVALIDCOLORTYPE = 1037; - MNG_INVALIDCOMPRESS = 1038; - MNG_INVALIDFILTER = 1039; - MNG_INVALIDINTERLACE = 1040; - MNG_NOTENOUGHIDAT = 1041; - MNG_PLTEINDEXERROR = 1042; - MNG_NULLNOTFOUND = 1043; - MNG_KEYWORDNULL = 1044; - MNG_OBJECTUNKNOWN = 1045; - MNG_OBJECTEXISTS = 1046; - MNG_TOOMUCHIDAT = 1047; - MNG_INVSAMPLEDEPTH = 1048; - MNG_INVOFFSETSIZE = 1049; - MNG_INVENTRYTYPE = 1050; - MNG_ENDWITHNULL = 1051; - MNG_INVIMAGETYPE = 1052; - MNG_INVDELTATYPE = 1053; - MNG_INVALIDINDEX = 1054; - MNG_TOOMUCHJDAT = 1055; - MNG_JPEGPARMSERR = 1056; - MNG_INVFILLMETHOD = 1057; - MNG_OBJNOTCONCRETE = 1058; - MNG_TARGETNOALPHA = 1059; - MNG_MNGTOOCOMPLEX = 1060; - MNG_UNKNOWNCRITICAL = 1061; - MNG_UNSUPPORTEDNEED = 1062; - MNG_INVALIDDELTA = 1063; - MNG_INVALIDMETHOD = 1064; - MNG_IMPROBABLELENGTH = 1065; - MNG_INVALIDBLOCK = 1066; - MNG_INVALIDEVENT = 1067; - MNG_INVALIDMASK = 1068; - MNG_NOMATCHINGLOOP = 1069; - MNG_SEEKNOTFOUND = 1070; - - MNG_INVALIDCNVSTYLE = 2049; - MNG_WRONGCHUNK = 2050; - MNG_INVALIDENTRYIX = 2051; - MNG_NOHEADER = 2052; - MNG_NOCORRCHUNK = 2053; - MNG_NOMHDR = 2054; - - MNG_IMAGETOOLARGE = 4097; - MNG_NOTANANIMATION = 4098; - MNG_FRAMENRTOOHIGH = 4099; - MNG_LAYERNRTOOHIGH = 4100; - MNG_PLAYTIMETOOHIGH = 4101; - MNG_FNNOTIMPLEMENTED = 4102; - - MNG_IMAGEFROZEN = 8193; - -{****************************************************************************} - -const MNG_CANVAS_RGB8 = $00000000; - MNG_CANVAS_RGBA8 = $00001000; - MNG_CANVAS_ARGB8 = $00003000; - MNG_CANVAS_RGB8_A8 = $00005000; - MNG_CANVAS_BGR8 = $00000001; - MNG_CANVAS_BGRX8 = $00010001; - MNG_CANVAS_BGRA8 = $00001001; - MNG_CANVAS_ABGR8 = $00003001; - MNG_CANVAS_RGB16 = $00000100; { not supported yet } - MNG_CANVAS_RGBA16 = $00001100; { not supported yet } - MNG_CANVAS_ARGB16 = $00003100; { not supported yet } - MNG_CANVAS_BGR16 = $00000101; { not supported yet } - MNG_CANVAS_BGRA16 = $00001101; { not supported yet } - MNG_CANVAS_ABGR16 = $00003101; { not supported yet } - MNG_CANVAS_GRAY8 = $00000002; { not supported yet } - MNG_CANVAS_GRAY16 = $00000102; { not supported yet } - MNG_CANVAS_GRAYA8 = $00001002; { not supported yet } - MNG_CANVAS_GRAYA16 = $00001102; { not supported yet } - MNG_CANVAS_AGRAY8 = $00003002; { not supported yet } - MNG_CANVAS_AGRAY16 = $00003102; { not supported yet } - MNG_CANVAS_DX15 = $00000003; { not supported yet } - MNG_CANVAS_DX16 = $00000004; { not supported yet } - -{****************************************************************************} - -const MNG_UINT_HUH = $40404040; - - MNG_UINT_BACK = $4241434b; - MNG_UINT_BASI = $42415349; - MNG_UINT_CLIP = $434c4950; - MNG_UINT_CLON = $434c4f4e; - MNG_UINT_DBYK = $4442594b; - MNG_UINT_DEFI = $44454649; - MNG_UINT_DHDR = $44484452; - MNG_UINT_DISC = $44495343; - MNG_UINT_DROP = $44524f50; - MNG_UINT_ENDL = $454e444c; - MNG_UINT_FRAM = $4652414d; - MNG_UINT_IDAT = $49444154; - MNG_UINT_IEND = $49454e44; - MNG_UINT_IHDR = $49484452; - MNG_UINT_IJNG = $494a4e47; - MNG_UINT_IPNG = $49504e47; - MNG_UINT_JDAT = $4a444154; - MNG_UINT_JHDR = $4a484452; - MNG_UINT_JSEP = $4a534550; - MNG_UINT_LOOP = $4c4f4f50; - MNG_UINT_MEND = $4d454e44; - MNG_UINT_MHDR = $4d484452; - MNG_UINT_MOVE = $4d4f5645; - MNG_UINT_ORDR = $4f524452; - MNG_UINT_PAST = $50415354; - MNG_UINT_PLTE = $504c5445; - MNG_UINT_PPLT = $50504c54; - MNG_UINT_PROM = $50524f4d; - MNG_UINT_SAVE = $53415645; - MNG_UINT_SEEK = $5345454b; - MNG_UINT_SHOW = $53484f57; - MNG_UINT_TERM = $5445524d; - MNG_UINT_bKGD = $624b4744; - MNG_UINT_cHRM = $6348524d; - MNG_UINT_eXPI = $65585049; - MNG_UINT_fPRI = $66505249; - MNG_UINT_gAMA = $67414d41; - MNG_UINT_hIST = $68495354; - MNG_UINT_iCCP = $69434350; - MNG_UINT_iTXt = $69545874; - MNG_UINT_nEED = $6e454544; - MNG_UINT_oFFs = $6f464673; - MNG_UINT_pCAL = $7043414c; - MNG_UINT_pHYg = $70444167; - MNG_UINT_pHYs = $70485973; - MNG_UINT_sBIT = $73424954; - MNG_UINT_sCAL = $7343414c; - MNG_UINT_sPLT = $73504c54; - MNG_UINT_sRGB = $73524742; - MNG_UINT_tEXt = $74455874; - MNG_UINT_tIME = $74494d45; - MNG_UINT_tRNS = $74524e53; - MNG_UINT_zTXt = $7a545874; - - MNG_UINT_evNT = $65764e54; - -{****************************************************************************} - -implementation - -{****************************************************************************} - -const mngdll = 'libmng.dll'; - -{****************************************************************************} - -function mng_initialize; external mngdll; -function mng_reset; external mngdll; -function mng_cleanup; external mngdll; - -function mng_read; external mngdll; -function mng_read_pushdata; external mngdll; -function mng_read_pushsig; external mngdll; -function mng_read_pushchunk; external mngdll; -function mng_read_resume; external mngdll; -function mng_write; external mngdll; -function mng_create; external mngdll; - -function mng_readdisplay; external mngdll; -function mng_display; external mngdll; -function mng_display_resume; external mngdll; -function mng_display_freeze; external mngdll; -function mng_display_reset; external mngdll; -function mng_display_goframe; external mngdll; -function mng_display_golayer; external mngdll; -function mng_display_gotime; external mngdll; - -function mng_trapevent; external mngdll; - -function mng_getlasterror; external mngdll; - -{****************************************************************************} - -function mng_setcb_memalloc; external mngdll; -function mng_setcb_memfree; external mngdll; -function mng_setcb_releasedata; external mngdll; - -function mng_setcb_openstream; external mngdll; -function mng_setcb_closestream; external mngdll; - -function mng_setcb_readdata; external mngdll; - -function mng_setcb_writedata; external mngdll; - -function mng_setcb_errorproc; external mngdll; -function mng_setcb_traceproc; external mngdll; - -function mng_setcb_processheader; external mngdll; -function mng_setcb_processtext; external mngdll; - -function mng_setcb_getcanvasline; external mngdll; -function mng_setcb_getalphaline; external mngdll; -function mng_setcb_getbkgdline; external mngdll; -function mng_setcb_refresh; external mngdll; - -function mng_setcb_gettickcount; external mngdll; -function mng_setcb_settimer; external mngdll; - -function mng_setcb_processgamma; external mngdll; -function mng_setcb_processchroma; external mngdll; -function mng_setcb_processsrgb; external mngdll; -function mng_setcb_processiccp; external mngdll; -function mng_setcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_getcb_memalloc; external mngdll; -function mng_getcb_memfree; external mngdll; -function mng_getcb_releasedata; external mngdll; - -function mng_getcb_openstream; external mngdll; -function mng_getcb_closestream; external mngdll; - -function mng_getcb_readdata; external mngdll; - -function mng_getcb_writedata; external mngdll; - -function mng_getcb_errorproc; external mngdll; -function mng_getcb_traceproc; external mngdll; - -function mng_getcb_processheader; external mngdll; -function mng_getcb_processtext; external mngdll; - -function mng_getcb_getcanvasline; external mngdll; -function mng_getcb_getalphaline; external mngdll; -function mng_getcb_getbkgdline; external mngdll; -function mng_getcb_refresh; external mngdll; - -function mng_getcb_gettickcount; external mngdll; -function mng_getcb_settimer; external mngdll; - -function mng_getcb_processgamma; external mngdll; -function mng_getcb_processchroma; external mngdll; -function mng_getcb_processsrgb; external mngdll; -function mng_getcb_processiccp; external mngdll; -function mng_getcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_set_userdata; external mngdll; - -function mng_set_canvasstyle; external mngdll; -function mng_set_bkgdstyle; external mngdll; - -function mng_set_bgcolor; external mngdll; -function mng_set_usebkgd; external mngdll; - -function mng_set_storechunks; external mngdll; -function mng_set_cacheplayback; external mngdll; - -// function mng_set_viewgamma; external mngdll; -// function mng_set_displaygamma; external mngdll; -// function mng_set_dfltimggamma; external mngdll; -function mng_set_viewgammaint; external mngdll; -function mng_set_displaygammaint; external mngdll; -function mng_set_dfltimggammaint; external mngdll; - -function mng_set_srgb; external mngdll; -function mng_set_outputprofile; external mngdll; -function mng_set_outputprofile2; external mngdll; -function mng_set_srgbprofile; external mngdll; -function mng_set_srgbprofile2; external mngdll; - -function mng_set_maxcanvaswidth; external mngdll; -function mng_set_maxcanvasheight; external mngdll; -function mng_set_maxcanvassize; external mngdll; - -function mng_set_suspensionmode; external mngdll; -function mng_set_speed; external mngdll; -function mng_set_crcmode; external mngdll; - -{****************************************************************************} - -function mng_get_userdata; external mngdll; - -function mng_get_sigtype; external mngdll; -function mng_get_imagetype; external mngdll; -function mng_get_imagewidth; external mngdll; -function mng_get_imageheight; external mngdll; -function mng_get_ticks; external mngdll; -function mng_get_framecount; external mngdll; -function mng_get_layercount; external mngdll; -function mng_get_playtime; external mngdll; -function mng_get_simplicity; external mngdll; - -function mng_get_canvasstyle; external mngdll; -function mng_get_bkgdstyle; external mngdll; - -procedure mng_get_bgcolor; external mngdll; -function mng_get_usebkgd; external mngdll; - -function mng_get_storechunks; external mngdll; -function mng_get_cacheplayback; external mngdll; - -// function mng_get_viewgamma; external mngdll; -// function mng_get_displaygamma; external mngdll; -// function mng_get_dfltimggamma; external mngdll; -function mng_get_viewgammaint; external mngdll; -function mng_get_displaygammaint; external mngdll; -function mng_get_dfltimggammaint; external mngdll; - -function mng_get_srgb; external mngdll; - -function mng_get_maxcanvaswidth; external mngdll; -function mng_get_maxcanvasheight; external mngdll; - -function mng_get_suspensionmode; external mngdll; - -function mng_get_speed; external mngdll; -function mng_get_imagelevel; external mngdll; - -function mng_get_starttime; external mngdll; -function mng_get_runtime; external mngdll; -function mng_get_currentframe; external mngdll; -function mng_get_currentlayer; external mngdll; -function mng_get_currentplaytime; external mngdll; -function mng_get_totalframes; external mngdll; -function mng_get_totallayers; external mngdll; -function mng_get_totalplaytime; external mngdll; - -function mng_status_error; external mngdll; -function mng_status_reading; external mngdll; -function mng_status_suspendbreak; external mngdll; -function mng_status_creating; external mngdll; -function mng_status_writing; external mngdll; -function mng_status_displaying; external mngdll; -function mng_status_running; external mngdll; -function mng_status_timerbreak; external mngdll; -function mng_status_dynamic; external mngdll; - -{****************************************************************************} - -function mng_iterate_chunks; external mngdll; - -{****************************************************************************} - -function mng_getchunk_ihdr; external mngdll; -function mng_getchunk_plte; external mngdll; -function mng_getchunk_idat; external mngdll; -function mng_getchunk_trns; external mngdll; -function mng_getchunk_gama; external mngdll; -function mng_getchunk_chrm; external mngdll; -function mng_getchunk_srgb; external mngdll; -function mng_getchunk_iccp; external mngdll; -function mng_getchunk_text; external mngdll; -function mng_getchunk_ztxt; external mngdll; -function mng_getchunk_itxt; external mngdll; -function mng_getchunk_bkgd; external mngdll; -function mng_getchunk_phys; external mngdll; -function mng_getchunk_sbit; external mngdll; -function mng_getchunk_splt; external mngdll; -function mng_getchunk_hist; external mngdll; -function mng_getchunk_time; external mngdll; -function mng_getchunk_mhdr; external mngdll; -function mng_getchunk_loop; external mngdll; -function mng_getchunk_endl; external mngdll; -function mng_getchunk_defi; external mngdll; -function mng_getchunk_basi; external mngdll; -function mng_getchunk_clon; external mngdll; -function mng_getchunk_past; external mngdll; -function mng_getchunk_past_src; external mngdll; -function mng_getchunk_disc; external mngdll; -function mng_getchunk_back; external mngdll; -function mng_getchunk_fram; external mngdll; -function mng_getchunk_move; external mngdll; -function mng_getchunk_clip; external mngdll; -function mng_getchunk_show; external mngdll; -function mng_getchunk_term; external mngdll; -function mng_getchunk_save; external mngdll; -function mng_getchunk_save_entry; external mngdll; -function mng_getchunk_seek; external mngdll; -function mng_getchunk_expi; external mngdll; -function mng_getchunk_fpri; external mngdll; -function mng_getchunk_need; external mngdll; -function mng_getchunk_phyg; external mngdll; -function mng_getchunk_jhdr; external mngdll; -function mng_getchunk_jdat; external mngdll; -function mng_getchunk_dhdr; external mngdll; -function mng_getchunk_prom; external mngdll; -function mng_getchunk_pplt; external mngdll; -function mng_getchunk_pplt_entry; external mngdll; -function mng_getchunk_drop; external mngdll; -function mng_getchunk_dbyk; external mngdll; -function mng_getchunk_ordr; external mngdll; -function mng_getchunk_ordr_entry; external mngdll; -function mng_getchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_putchunk_ihdr; external mngdll; -function mng_putchunk_plte; external mngdll; -function mng_putchunk_idat; external mngdll; -function mng_putchunk_iend; external mngdll; -function mng_putchunk_trns; external mngdll; -function mng_putchunk_gama; external mngdll; -function mng_putchunk_chrm; external mngdll; -function mng_putchunk_srgb; external mngdll; -function mng_putchunk_iccp; external mngdll; -function mng_putchunk_text; external mngdll; -function mng_putchunk_ztxt; external mngdll; -function mng_putchunk_itxt; external mngdll; -function mng_putchunk_bkgd; external mngdll; -function mng_putchunk_phys; external mngdll; -function mng_putchunk_sbit; external mngdll; -function mng_putchunk_splt; external mngdll; -function mng_putchunk_hist; external mngdll; -function mng_putchunk_time; external mngdll; -function mng_putchunk_mhdr; external mngdll; -function mng_putchunk_mend; external mngdll; -function mng_putchunk_loop; external mngdll; -function mng_putchunk_endl; external mngdll; -function mng_putchunk_defi; external mngdll; -function mng_putchunk_basi; external mngdll; -function mng_putchunk_clon; external mngdll; -function mng_putchunk_past; external mngdll; -function mng_putchunk_past_src; external mngdll; -function mng_putchunk_disc; external mngdll; -function mng_putchunk_back; external mngdll; -function mng_putchunk_fram; external mngdll; -function mng_putchunk_move; external mngdll; -function mng_putchunk_clip; external mngdll; -function mng_putchunk_show; external mngdll; -function mng_putchunk_term; external mngdll; -function mng_putchunk_save; external mngdll; -function mng_putchunk_save_entry; external mngdll; -function mng_putchunk_seek; external mngdll; -function mng_putchunk_expi; external mngdll; -function mng_putchunk_fpri; external mngdll; -function mng_putchunk_need; external mngdll; -function mng_putchunk_phyg; external mngdll; -function mng_putchunk_jhdr; external mngdll; -function mng_putchunk_jdat; external mngdll; -function mng_putchunk_dhdr; external mngdll; -function mng_putchunk_prom; external mngdll; -function mng_putchunk_pplt; external mngdll; -function mng_putchunk_pplt_entry; external mngdll; -function mng_putchunk_drop; external mngdll; -function mng_putchunk_dbyk; external mngdll; -function mng_putchunk_ordr; external mngdll; -function mng_putchunk_ordr_entry; external mngdll; -function mng_putchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_updatemngheader; external mngdll; -function mng_updatemngsimplicity; external mngdll; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/delphi/mngview/Main.dfm b/Engine/lib/lmng/contrib/delphi/mngview/Main.dfm deleted file mode 100644 index cb86b81c66251a473e57a60a39dedfe17b154c2b..0000000000000000000000000000000000000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y#wYKbDhaAF&zb>H;{S7qU-JI{?>i2ME;H` zr37#TvG?ZJggG}h`E5#)KNh0vrv}IkeOSKRybdkW7fFl|Jnp({AQ}Yr}7BPRC+XWrk@V!OoAI6jUpCsY!jfPyLbY z9v9&ciPL8t@0+y}{AYQzR{Dzfj&+n1RIww78f>E6vfbNbU3x%`ZqqW)R_tEO@cWIS z=R+~@eDJX#hCW%;nQzim2Io-3Iwq or app-exit } - BFHasMouse : boolean; { mouse is/was over image } - - IFTicks : cardinal; { used to fake slow connections } - IFBytes : cardinal; - IFBytesPerSec : integer; - - procedure MNGerror (SHMsg : string); - - public - { Public declarations } - - end; - -var - MainForm: TMainForm; - -{****************************************************************************} - -implementation - -{$R *.DFM} - -{****************************************************************************} - -{$F+} -function Memalloc (iLen : mng_uint32) : mng_ptr; stdcall; -{$F-} -begin - getmem (Result, iLen); { get memory from the heap } - fillchar (Result^, iLen, 0); { and initialize it } -end; - -{****************************************************************************} - -{$F+} -procedure Memfree (iPtr : mng_ptr; - iLen : mng_size_t); stdcall; -{$F-} -begin - freemem (iPtr, iLen); { free the memory } -end; - -{****************************************************************************} - -{$F+} -function Openstream (hHandle : mng_handle) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - if OFFile <> nil then { free previous stream (if any) } - OFFile.Free; - { open a new stream } - OFFile := TFileStream.Create (SFFileName, fmOpenRead or fmShareDenyWrite); - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Closestream (hHandle : mng_handle) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - OFFile.Free; { cleanup the stream } - OFFile := nil; { don't use it again ! } - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Readdata ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - IHTicks : cardinal; - IHByte1 : cardinal; - IHByte2 : cardinal; - IHBytesPerSec : cardinal; - -begin - { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin { are we at EOF ? } - if OFFile.Position >= OFFile.Size then - begin - pRead := 0; { indicate so } - end - else - begin - IHBytesPerSec := IFBytesPerSec; { fake a slow connection } - - if IHBytesPerSec > 0 then - begin - IHTicks := Windows.GetTickCount; - IHByte1 := round (((IHTicks - IFTicks) / 1000) * IHBytesPerSec); - IHByte2 := (IFBytes + iBuflen); - - if ((IHByte2 - IHByte1) div IHBytesPerSec) > 10 then - Windows.Sleep ((IHByte2 - IHByte1) div IHBytesPerSec); - - end; - { read the requested data } - pRead := OFFile.Read (pBuf^, iBuflen); - IFBytes := IFBytes + pRead; - end; - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function ProcessHeader (hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin - OFBitmap.Width := iWidth; { store the new dimensions } - OFBitmap.Height := iHeight; - OFImage.Left := 0; { adjust the visible component } - OFImage.Top := 0; - OFImage.Width := iWidth; - OFImage.Height := iHeight; - - FormResize (OHForm); { force re-centering the image} - { clear the canvas & draw an outline } - OFBitmap.Canvas.Brush.Color := clGray; - OFBitmap.Canvas.Brush.Style := bsSolid; - OFBitmap.Canvas.FillRect (OFBitmap.Canvas.ClipRect); - OFBitmap.Canvas.Brush.Color := clRed; - OFBitmap.Canvas.Brush.Style := bsSolid; - OFBitmap.Canvas.Pen.Color := clRed; - OFBitmap.Canvas.Pen.Style := psSolid; - OFBitmap.Canvas.FrameRect (OFBitmap.Canvas.ClipRect); - - OFImage.Picture.Assign (OFBitmap); { make sure it gets out there } - { tell the library we want funny windows-bgr} - if mng_set_canvasstyle (hHandle, MNG_CANVAS_BGRX8) <> 0 then - MNGerror ('libmng reported an error setting the canvas style'); - - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function GetCanvasLine (hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { easy with these bitmap objects ! } - Result := OHForm.OFBitmap.ScanLine [iLinenr]; -end; - -{****************************************************************************} - -{$F+} -function ImageRefresh (hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { force redraw } - OHForm.OFImage.Picture.Assign (OHForm.OFBitmap); - - Result := MNG_TRUE; -end; - - -{****************************************************************************} - -{$F+} -function GetTickCount (hHandle : mng_handle) : mng_uint32; stdcall; -{$F-} -begin - Result := Windows.GetTickCount; { windows knows that } -end; - -{****************************************************************************} - -{$F+} -function SetTimer (hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; stdcall; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - OHForm.OFTimer.Interval := iMsecs; { and set the timer } - OHForm.OFTimer.Enabled := true; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -procedure TMainForm.FormCreate(Sender: TObject); - -var IHRed, IHGreen, IHBlue : word; - -begin { initialize } - OFBitmap := TBitmap.Create; - IFBytesPerSec := 10000000; - BFHasMouse := false; - OFFile := nil; - - OFOpenDialog.Initialdir := ''; - OFBitmap.HandleType := bmDIB; { make it a 24-bit DIB } - OFBitmap.PixelFormat := pf32bit; - { now initialize the library } - IFHandle := mng_initialize (mng_ptr(self), Memalloc, Memfree, nil); - - if IFHandle = NIL then - begin - MNGerror ('libmng initialization error' + #13#10 + - 'Program aborted'); - Windows.Postmessage (handle, WM_Close, 0, 0); - Exit; - end; - { no need to store chunk-info ! } - mng_set_storechunks (IFHandle, MNG_FALSE); - { do not use suspension-buffer } - mng_set_suspensionmode (IFHandle, MNG_FALSE); - { set all the callbacks } - if (mng_setcb_openstream (IFHandle, Openstream ) <> MNG_NOERROR) or - (mng_setcb_closestream (IFHandle, Closestream ) <> MNG_NOERROR) or - (mng_setcb_readdata (IFHandle, Readdata ) <> MNG_NOERROR) or - (mng_setcb_processheader (IFHandle, ProcessHeader) <> MNG_NOERROR) or - (mng_setcb_getcanvasline (IFHandle, GetCanvasLine) <> MNG_NOERROR) or - (mng_setcb_refresh (IFHandle, ImageRefresh ) <> MNG_NOERROR) or - (mng_setcb_gettickcount (IFHandle, GetTickCount ) <> MNG_NOERROR) or - (mng_setcb_settimer (IFHandle, SetTimer ) <> MNG_NOERROR) then - begin - MNGerror ('libmng reported an error setting a callback function!' + #13#10 + - 'Program aborted'); - Windows.Postmessage (handle, WM_Close, 0, 0); - Exit; - end; - - IHRed := (Color ) and $FF; { supply our own bg-color } - IHGreen := (Color shr 8) and $FF; - IHBlue := (Color shr 16) and $FF; - - IHRed := (IHRed shl 8) + IHRed; - IHGreen := (IHGreen shl 8) + IHGreen; - IHBlue := (IHBlue shl 8) + IHBlue; - - if mng_set_bgcolor (IFHandle, IHRed, IHGreen, IHBlue) <> MNG_NOERROR then - MNGerror ('libmng reported an error setting the background color!'); - -end; - -{****************************************************************************} - -procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); -begin - OFTimer.Enabled := false; - BFCancelled := true; - { if we're still animating then stop it } - if mng_status_running (IFHandle) and not mng_status_reading (IFHandle) then - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - - mng_cleanup (IFHandle); -end; - -{****************************************************************************} - -procedure TMainForm.FormShow(Sender: TObject); -begin - FormResize (self); -end; - -{****************************************************************************} - -procedure TMainForm.FormResize(Sender: TObject); -begin { center the image in the window } - if ClientWidth < OFImage.Width then - OFImage.Left := 0 - else - OFImage.Left := (ClientWidth - OFImage.Width ) div 2; - - if ClientHeight < OFImage.Height then - OFImage.Top := 0 - else - OFImage.Top := (ClientHeight - OFImage.Height) div 2; - -end; - -{****************************************************************************} - -procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if Key = vk_Escape then { pressing will freeze an animation } - begin - OFTimer.Enabled := false; { don't let that timer go off then ! } - BFCancelled := true; - - if mng_status_running (IFHandle) and not mng_status_reading (IFHandle) then - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - end; -end; - -{****************************************************************************} - -procedure TMainForm.FormMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { if we had the mouse, it's left ! } - begin - if mng_trapevent (IFHandle, 3, 0, 0) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := false; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseMove(Sender: TObject; Shift: TShiftState; - X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { did we have the mouse already ? } - begin - if mng_trapevent (IFHandle, 2, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - end - else - begin { if not, it has entered ! } - if mng_trapevent (IFHandle, 1, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := true; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 4, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 5, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFTimerTimer(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFTimer.Enabled := false; { only once ! } - - if not BFCancelled then - begin { and inform the library } - IHRslt := mng_display_resume (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRslt <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error during display_resume!'); - - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileOpenClick(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFOpenDialog.InitialDir := ''; - OFOpenDialog.FileName := SFFileName; - - if OFOpenDialog.Execute then { get the filename } - begin - if OFTimer.Enabled then { if the lib was active; stop it } - begin - OFTimer.Enabled := false; - - Application.ProcessMessages; { process any timer requests (for safety) } - { now freeze the animation } - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - end; - { save interesting fields } - SFFileName := OFOpenDialog.FileName; - IFTicks := Windows.GetTickCount; - IFBytes := 0; - BFCancelled := false; - { always reset (just in case) } - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!') - else - begin { and let the lib do it's job ! } - IHRslt := mng_readdisplay (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRSLT <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error reading the input file!'); - - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileProfileClick(Sender: TObject); - -var SHProfileDir : array [0 .. MAX_PATH + 20] of char; - -begin - GetSystemDirectory (@SHProfileDir, MAX_PATH); - strcat (@SHProfileDir, '\Color'); - - OFOpenDialogProfile.InitialDir := strpas (@SHProfileDir); - - if OFOpenDialogProfile.Execute then - if mng_set_outputprofile (IFHandle, pchar (OFOpenDialogProfile.FileName)) <> 0 then - MNGerror ('libmng reported an error setting the output-profile!'); - -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileExitClick(Sender: TObject); -begin - if mng_cleanup (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng cleanup error'); - - Close; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuOptionsModemSpeedClick(Sender: TObject); -begin - OFMenuOptionsModem28k8.Checked := false; - OFMenuOptionsModem33k6.Checked := false; - OFMenuOptionsModem56k.Checked := false; - OFMenuOptionsModemISDN64.Checked := false; - OFMenuOptionsModemISDN128.Checked := false; - OFMenuOptionsModemCable512.Checked := false; - OFMenuOptionsModemUnlimited.Checked := false; - - if IFBytesPerSec = OFMenuOptionsModem28k8.Tag div 10 then - OFMenuOptionsModem28k8.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModem33k6.Tag div 10 then - OFMenuOptionsModem33k6.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModem56k.Tag div 10 then - OFMenuOptionsModem56k.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModemISDN64.Tag div 10 then - OFMenuOptionsModemISDN64.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModemISDN128.Tag div 10 then - OFMenuOptionsModemISDN128.Checked := true - else - if IFBytesPerSec = OFMenuOptionsModemUnlimited.Tag div 10 then - OFMenuOptionsModemCable512.Checked := true - else - OFMenuOptionsModemUnlimited.Checked := true; - -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuOptionsModemXClick(Sender: TObject); -begin - IFBytesPerSec := TMenuItem (Sender).Tag div 10; -end; - -{****************************************************************************} - -procedure TMainForm.MNGerror; - -var iErrorcode : mng_uint32; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar; - -begin { get extended info } - iErrorcode := mng_getlasterror (IFHandle, iSeverity, iChunkname, iChunkseq, - iExtra1, iExtra2, zErrortext); - - MessageDlg (SHMsg + #13#10#13#10 + strpas (zErrortext) + #13#10#13#10 + - Format ('Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d', - [iErrorcode, iSeverity, iChunkseq, iExtra1]), - mtError, [mbOK], 0); -end; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/delphi/mngview/mngview.dpr b/Engine/lib/lmng/contrib/delphi/mngview/mngview.dpr deleted file mode 100644 index 6408c75de..000000000 --- a/Engine/lib/lmng/contrib/delphi/mngview/mngview.dpr +++ /dev/null @@ -1,14 +0,0 @@ -program mngview; - -uses - Forms, - Main in 'Main.pas' {MainForm}, - libmng in '..\libmng.pas'; - -{$R *.RES} - -begin - Application.Initialize; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING b/Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING deleted file mode 100644 index d60c31a97..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/ChangeLog b/Engine/lib/lmng/contrib/gcc/fbmngplay/ChangeLog deleted file mode 100644 index fd0859233..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/ChangeLog +++ /dev/null @@ -1,10 +0,0 @@ -******************* Thu Sep 13 15:28:01 CEST 2001 ******************** - -* new option -S to play on start console only. -* new option -c to play animationon any fb console -* split fbmngplay to several files. - -******************* Wed Sep 12 14:51:44 CEST 2001 ******************** - -* new option -p for dynamic positioning of the mng animation in the - upper right corner. diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/Makefile b/Engine/lib/lmng/contrib/gcc/fbmngplay/Makefile deleted file mode 100644 index 27ad8db33..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 1994, 1995-8, 1999 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. - -SHELL = /bin/sh -CC = gcc - -SOURCES = fbmngplay.c -PROGRAMS = fbmngplay fbmngplay.static -OBJECTS = fbmngplay.o messages.o mng.o console.o - -LDFLAGS = -L/usr/lib -LIBSS = /usr/lib/libmng-mini.a /usr/lib/libz.a -lm -LIBSD = -lmng -lz -lm - -CFLAGS = -Os -Wall -Wmissing-prototypes -Wstrict-prototypes -D_REENTRANT -COMPILE = $(CC) $(CFLAGS) -LINKS = $(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ -LINKD = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ - -all: $(PROGRAMS) - strip -s $(PROGRAMS) -.SUFFIXES: -.SUFFIXES: .S .c .o .s - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean: - -rm -f *.o core -clean: mostlyclean - -rm -f fbmngplay fbmngplay.static - -fbmngplay: $(OBJECTS) - @rm -f fbmngplay - $(LINKD) $(LDFLAGS) $(OBJECTS) $(LIBSD) -fbmngplay.static: $(OBJECTS) - @rm -f fbmngplay.static - $(LINKS) $(LDFLAGS) $(OBJECTS) $(LIBSS) - -.PHONY: mostlyclean clean fbmngplay fbmngplay.static all diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/README b/Engine/lib/lmng/contrib/gcc/fbmngplay/README deleted file mode 100644 index 4e839370a..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/README +++ /dev/null @@ -1,30 +0,0 @@ -* fbmngplay * - -a simple fbcon based mng player - -This is a simple example program, using the kernel framebuffer device -to display mng animation decoded by the new libmng implementation. - -This player is based on the SDL version included in the libmng package -from Ralph Giles . The code's fairly rough at this -point, but there was no example player for *nix in the distribution. -Patches welcome, of course. - -On a unix-like system, the build instructions are simple: - -(install and/or build the mng library from libmng.com) -make -make install - -To use the player: - -fbmngplay .mng .mng ... - -To stop looping animations, press CTRL C or send a TERM or INT signal. - -See the options with -fbmngplay -h - ---- -Stefan Reinauer, -$Date: 2002/09/26 18:09:36 $ diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/console.c deleted file mode 100644 index 4b5d5fb43..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. - - This file is based on getfd.c from the kbd package. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "console.h" - -int start_console = 0; - -/* - * getfd.c - * - * Get an fd for use with kbd/console ioctls. - * We try several things because opening /dev/console will fail - * if someone else used X (which does a chown on /dev/console). - */ - -static int -is_a_console(const int fd) { - char arg; - - arg = 0; - return (ioctl(fd, KDGKBTYPE, &arg) == 0 - && ((arg == KB_101) || (arg == KB_84))); -} - -static int -open_a_console(const char * const fnam) { - int fd; - - fd = open(fnam, O_RDONLY); - if (fd < 0 && errno == EACCES) - fd = open(fnam, O_WRONLY); - if (fd < 0) - return -1; - if (!is_a_console(fd)) { - close(fd); - return -1; - } - return fd; -} - -int getfd (const char * const nm) { - int fd; - - if (nm) { - fd = open_a_console(nm); - if (fd >= 0) - return fd; - } else { - fd = open_a_console("/dev/tty"); - if (fd >= 0) - return fd; - - fd = open_a_console("/dev/tty0"); - if (fd >= 0) - return fd; - - fd = open_a_console("/dev/console"); - if (fd >= 0) - return fd; - - for (fd = 0; fd < 3; fd++) - if (is_a_console(fd)) - return fd; - } - fprintf(stderr, - "Couldnt get a file descriptor referring to the console\n"); - exit(1); /* total failure */ -} - -int fd; -int current_console(void) -{ - struct vt_stat vtstat; - if (ioctl(fd, VT_GETSTATE, &vtstat)) { - fprintf(stderr,"fbmngplay: VT_GETSTATE\n"); - exit(1); - } - return vtstat.v_active; - -} - -void init_consoles(void) -{ - // get current tty - fd = getfd(0); - start_console=current_console(); -} - diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/console.h deleted file mode 100644 index 465efb484..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/console.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __CONSOLES_H -#define __CONSOLES_H - -extern int getfd(const char* const); -extern void init_consoles(void); -extern int current_console(void); -extern int start_console; - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.c deleted file mode 100644 index 8f26a2c5a..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include "fbmngplay.h" -#include "messages.h" -#include "console.h" -#include "mng.h" - -volatile int run = 1; -int verbose = 0; -int buffered = 0; -int dynpos = 0; -int waitsignal = 0; -int delta = 16; -int sconly=0; - -void sigint_handler(int signal); -void sigterm_handler(int signal); -void sigusr1_handler(int signal); - -void sigint_handler(int signal) -{ - run = 2; -} - -void sigterm_handler(int signal) -{ - restore_area(); - run = 0; -} - -void sigusr1_handler(int signal) -{ - run = 0; -} - -int main(int argc, char *argv[]) -{ - int fbdev,c,option_index; - unsigned int alpha; - struct fb_var_screeninfo var; - - /* Check which console we're running on */ - init_consoles(); - - /* allocate our stream data structure */ - mng = (mngstuff *) calloc(1, sizeof(*mng)); - if (mng == NULL) { - fprintf(stderr, "could not allocate stream structure.\n"); - exit(0); - } - alpha = 100; - mng->alpha = 100; - mng->fbx = 15; - mng->fby = 15; - mng->background = NULL; - - while (1) { - static struct option long_options[] = { - {"help", 0, 0, 'h'}, - {"verbose", 0, 0, 'v'}, - {"alpha", 1, 0, 'a'}, - {"buffered", 0, 0, 'b'}, - {"signal", 0, 0, 's'}, - {"delta", 0, 0, 'd'}, - {"position", 0, 0, 'p'}, - {"version", 0, 0, 'V'}, - {"start-console",0,0,'S'}, - {"console",1,0,'c'}, - {0, 0, 0, 0} - }; - - c = getopt_long(argc, argv, "a:x:y:bh?vsd:pVSc:", - long_options, &option_index); - - if (c == -1) - break; - - switch (c) { - case 'a': - alpha = atoi(optarg); - if (alpha > 100) - alpha = 100; - mng->alpha = alpha; - break; - case 'x': - mng->fbx = atoi(optarg); - break; - case 'y': - mng->fby = atoi(optarg); - break; - case 'd': - delta = atoi(optarg); - break; - case '?': - case 'h': - usage(argv[0]); - exit(0); - case 'v': - verbose = 1; - break; - case 's': - waitsignal = 1; - break; - case 'b': - buffered = 1; - break; - case 'p': - dynpos = 1; - break; - case 'V': - version(); - exit(0); - case 'c': - start_console=atoi(optarg); - case 'S': - sconly=1; - break; - default: - break; - } - } - - if (optind >= argc) { - printf("Which files do you want to play?\n"); - exit(0); - } - - //init_consoles(); - - /* Initialize framebuffer */ - fbdev = open("/dev/fb0", O_RDWR); - if (fbdev < 0) { - fprintf(stderr, "error while opening framebuffer.\n"); - exit(fbdev); - } - - ioctl(fbdev, FBIOGET_VSCREENINFO, &var); - mng->fbwidth = var.xres; - mng->fbheight = var.yres; - mng->fbbpp = var.bits_per_pixel; - - mng->display = - mmap(NULL, var.xres * var.yres * (var.bits_per_pixel >> 3), - PROT_WRITE | PROT_READ, MAP_SHARED, fbdev, 0); - - /* arrange to call the shutdown routine before we exit */ - atexit(&cleanup); - - while (optind < argc) { - // leftover arguements are filenames. - mng->filename = argv[optind++]; - - /* set up the mng decoder for our stream */ - mng->mng = mng_initialize(mng, mngalloc, mngfree, MNG_NULL); - if (mng->mng == MNG_NULL) { - fprintf(stderr, "could not initialize libmng.\n"); - exit(1); - } - - /* set the callbacks */ - mng_setcb_errorproc(mng->mng, mngerror); - mng_setcb_openstream(mng->mng, mngopenstream); - mng_setcb_closestream(mng->mng, mngclosestream); - mng_setcb_readdata(mng->mng, mngreadstream); - mng_setcb_gettickcount(mng->mng, mnggetticks); - mng_setcb_settimer(mng->mng, mngsettimer); - mng_setcb_processheader(mng->mng, mngprocessheader); - mng_setcb_getcanvasline(mng->mng, mnggetcanvasline); - mng_setcb_refresh(mng->mng, mngrefresh); - /* FIXME: should check for errors here */ - - signal(SIGINT, sigint_handler); - signal(SIGTERM, sigterm_handler); - - mng_readdisplay(mng->mng); - - /* loop though the frames */ - while (mng->delay && run) { - mdelay(mng->delay); - mng->delay = 0; - mng_display_resume(mng->mng); - if (run == 2) { - if (mng->alpha == 0) - run = 0; - mng->alpha -= delta; - if (mng->alpha < 0) - mng->alpha = 0; - } - } - - if (waitsignal && optind < argc) { - signal(SIGUSR1, sigusr1_handler); - run = 1; - while (run) { - sleep(2); - } - } - - memset(mng->copybuffer, 0, - 4 * mng->width * mng->height); - run = 1; - mng->alpha = alpha; - if (optind == argc) { /* last file */ - restore_area(); - } - } - - /* cleanup and quit */ - return mngquit(mng->mng); -} diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.h deleted file mode 100644 index 9af1c2764..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/fbmngplay.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __FBMNGPLAY_H -#define __FBMNGPLAY_H - -#include - -#define FBMNGPLAY_VERSION "0.3" - -/* structure for keeping track of our mng stream inside the callbacks */ -typedef struct { - FILE *file; /* pointer to the file we're decoding */ - char *filename; /* pointer to the file's path/name */ - mng_uint32 delay; /* ticks to wait before resuming decode */ - unsigned char *display; /* pointer to display */ - unsigned char *copybuffer; - unsigned char *background; - mng_handle mng; /* mng handle */ - int width, height; - int fbwidth, fbheight, fbbpp; - int fbx, fby; - int alpha; -} mngstuff; - -extern volatile int run; -extern int verbose; -extern int buffered; -extern int dynpos; -extern int waitsignal; -extern int delta; -extern int sconly; - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.c deleted file mode 100644 index 2356ddf66..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#include - -#include "fbmngplay.h" -#include "messages.h" - -void usage(char *name) -{ - fprintf(stderr, "\nusage: %s [ -x ] [ -y ] [ -a ] [-b] [-v]" - " [-s] [file.mng [file.mng [...]]]\n", name); - fprintf(stderr, "\n -x: x coordinate\n"); - fprintf(stderr, " -y: y coordinate\n"); - fprintf(stderr, " -a, --alpha: default alpha channel 1..100\n"); - fprintf(stderr, " -v, --verbose: verbose mode\n"); - fprintf(stderr, " -b, --buffered: buffered mode\n"); - fprintf(stderr, " -s, --signal: wait for SIGUSR1 between animations\n"); - fprintf(stderr, " -p, --position: dynamically select position\n"); - fprintf(stderr, " -V, --version: show version and exit\n"); - fprintf(stderr, " -?, -h, --help: print this help.\n\n"); - fprintf(stderr, " -S --start-console: only output animation on console it was started on.\n"); -} - -void version(void) -{ - fprintf(stderr, "fbmngplay v%s, Copyright (C) 2001 Stefan Reinauer\n",FBMNGPLAY_VERSION); - fprintf(stderr, "fbmngplay comes with ABSOLUTELY NO WARRANTY;\n"); - fprintf(stderr,"This is free software, and you are welcome to redistribute it\n"); - fprintf(stderr,"under certain conditions; Check the GPL for details.\n"); -} diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.h deleted file mode 100644 index fe20eea5a..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/messages.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __MESSAGES_H -#define __MESSAGES_H - -extern void usage(char *name); -extern void version(void); - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c b/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c deleted file mode 100644 index b6564cce4..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#include -#include -#include - -#include "fbmngplay.h" -#include "console.h" -#include "mng.h" - -mngstuff *mng; -unsigned char *bufferstream; -unsigned long bufferpos = 0, buffersize = 0; - -inline void mdelay(unsigned long msec) -{ - usleep(msec * 1000); -} - -/* callbacks for the mng decoder */ - -/* memory allocation; data must be zeroed */ -mng_ptr mngalloc(mng_uint32 size) -{ - return (mng_ptr) calloc(1, size); -} - -/* memory deallocation */ -void mngfree(mng_ptr p, mng_uint32 size) -{ - free(p); - return; -} - -mng_bool mngopenstream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* open the file */ - mymng->file = fopen(mymng->filename, "rb"); - if (mymng->file == NULL) { - fprintf(stderr, "unable to open '%s'\n", mymng->filename); - run = 0; - return MNG_FALSE; - } - - if (buffered) { - unsigned long len; - fseek(mymng->file, 0, SEEK_END); - len = ftell(mymng->file); - rewind(mymng->file); - bufferstream = malloc(len); - if (!bufferstream) { - /* Not enough memory for buffers - * -> we go back to unbuffered mode - */ - printf("Reverted to non buffered mode.\n"); - buffered = 0; - return MNG_TRUE; - } - buffersize = len; - fread(bufferstream, 1, len, mymng->file); - bufferpos = 0; - fclose(mymng->file); - mymng->file = NULL; - } - - return MNG_TRUE; -} - -mng_bool mngclosestream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* close the file */ - if (mymng->file) - fclose(mymng->file); - mymng->file = NULL; /* for safety */ - - if (bufferstream) { - free(bufferstream); - bufferstream = 0; - buffersize = 0; - bufferpos = 0; - } - return MNG_TRUE; -} - -/* feed data to the decoder */ -mng_bool mngreadstream(mng_handle mng, mng_ptr buffer, - mng_uint32 size, mng_uint32 * bytesread) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - if (!buffered) { - /* read the requested amount of data from the file */ - *bytesread = fread(buffer, 1, size, mymng->file); - } else { - *bytesread = (buffersize - bufferpos) < - size ? (buffersize - bufferpos) : size; - memcpy(buffer, bufferstream + bufferpos, *bytesread); - bufferpos += (*bytesread); - } - return MNG_TRUE; -} - -/* the header's been read. set up the display stuff */ -mng_bool mngprocessheader(mng_handle mng, - mng_uint32 width, mng_uint32 height) -{ - mngstuff *mymng; - unsigned char *copybuffer, *background; - unsigned char *src; - - mymng = (mngstuff *) mng_get_userdata(mng); - mymng->width = width; - mymng->height = height; - - if (dynpos) { - mymng->fbx = (mymng->fbwidth)-width-15; - switch (mymng->fbheight) { - case 768: - mymng->fby = 15; - break; - case 1024: - mymng->fby = 30; - break; - default: - mymng->fby = 0; - break; - } - } - - copybuffer = (unsigned char *) malloc(width * height * 4); - if (copybuffer == NULL) { - fprintf(stderr, "could not allocate copy buffer.\n"); - exit(0); - } - mymng->copybuffer = copybuffer; - - if (!mymng->background) { - background = - (unsigned char *) malloc(width * height * - (mymng->fbbpp >> 3)); - if (background == NULL) { - fprintf(stderr, - "could not allocate background buffer.\n"); - exit(0); - } - mymng->background = background; - - src = mymng->display + (mymng->fbwidth * mymng->fby + - mymng->fbx) * (mymng->fbbpp >> 3); - - while (height--) { - memcpy(background, src, - width * (mymng->fbbpp >> 3)); - background += width * (mymng->fbbpp >> 3); - src += mymng->fbwidth * (mymng->fbbpp >> 3); - } - } - /* tell the mng decoder about our bit-depth choice */ - /* FIXME: this works on intel. is it correct in general? */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRA8); - - return MNG_TRUE; -} - -/* return a row pointer for the decoder to fill */ -mng_ptr mnggetcanvasline(mng_handle mng, mng_uint32 line) -{ - mngstuff *mymng; - mng_ptr row; - - /* dereference our structure */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* we assume any necessary locking has happened - outside, in the frame level code */ - row = mymng->copybuffer + mymng->width * 4 * line; - - return (row); -} - -/* timer */ -mng_uint32 mnggetticks(mng_handle mng) -{ - mng_uint32 ticks; - struct timeval tv; - struct timezone tz; - - gettimeofday(&tv, &tz); - ticks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000); - - return (ticks); -} - -static inline void copyline(unsigned char *dest, unsigned char *src, - unsigned char *background, mngstuff * mymng) -{ - // BGRA8 - unsigned int i = mymng->width; - unsigned int fr, fg, fb, br, bg, bb, r, g, b, a; - unsigned short output, input; - - while (i--) { - fb = *src++; - fg = *src++; - fr = *src++; - - a = *src++; - a = a * mymng->alpha / 100; - switch (mymng->fbbpp) { - case 16: - input = *((unsigned short *) background)++; - br = (input >> 8) & 0xf8; - bg = (input >> 3) & 0xfc; - bb = input << 3 & 0xff; - break; - case 24: - bb = *background++; - bg = *background++; - br = *background++; - break; - case 32: - bb = *background++; - bg = *background++; - br = *background++; - background++; - break; - default: - br = 0; - bg = 0; - bb = 0; - printf("depth not supported.\n"); - run = 0; - break; - } - - r = ((fr * a) + (br * (0x100 - a))) >> 8; - g = ((fg * a) + (bg * (0x100 - a))) >> 8; - b = ((fb * a) + (bb * (0x100 - a))) >> 8; - - switch (mymng->fbbpp) { - case 16: - // dumb 24->16 bit conversion. - r >>= 3; - g >>= 2; - b >>= 3; - - output = (r << 11) | (g << 5) | b; - *((unsigned short *) dest)++ = output; - break; - case 24: - *dest++ = b; - *dest++ = g; - *dest++ = r; - break; - case 32: - *dest++ = b; - *dest++ = g; - *dest++ = r; - dest++; - break; - default: - break; - } - } -} - -mng_bool mngrefresh(mng_handle mng, mng_uint32 x, mng_uint32 y, - mng_uint32 w, mng_uint32 h) -{ - mngstuff *mymng; - unsigned char *dest, *src, *background; - - if (sconly && current_console()!=start_console) - return MNG_TRUE; - - /* dereference our structure */ - mymng = (mngstuff *) mng_get_userdata(mng); - - dest = mymng->display + ((mymng->fby * mymng->fbwidth + mymng->fbx) - * (mymng->fbbpp >> 3)); - src = mymng->copybuffer; - background = mymng->background; - /* refresh the screen with the new frame */ - while (h-- > 0) { - copyline(dest, src, background, mymng); - dest += mymng->fbwidth * (mymng->fbbpp >> 3); - background += mymng->width * (mymng->fbbpp >> 3); - src += 4 * mymng->width; // 4 bytes per pixel due to RGBA - } - - // remove traces - memset(mymng->copybuffer, 0, 4 * mymng->width * mymng->height); - - return MNG_TRUE; -} - -/* interframe delay callback */ -mng_bool mngsettimer(mng_handle mng, mng_uint32 msecs) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* set the timer for when the decoder wants to be woken */ - mymng->delay = msecs; - - return MNG_TRUE; -} - -mng_bool mngerror(mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - mngstuff *mymng; - char chunk[5]; - - /* dereference our data so we can get the filename */ - mymng = (mngstuff *) mng_get_userdata(mng); - /* pull out the chuck type as a string */ - // FIXME: does this assume unsigned char? - chunk[0] = (char) ((chunktype >> 24) & 0xFF); - chunk[1] = (char) ((chunktype >> 16) & 0xFF); - chunk[2] = (char) ((chunktype >> 8) & 0xFF); - chunk[3] = (char) ((chunktype) & 0xFF); - chunk[4] = '\0'; - - /* output the error */ - fprintf(stderr, "error playing '%s' chunk %s (%d):\n", - mymng->filename, chunk, chunkseq); - fprintf(stderr, "%s\n", text); - - return 0; -} - -int mngquit(mng_handle mng) -{ - mngstuff *mymng; - - /* dereference our data so we can free it */ - mymng = (mngstuff *) mng_get_userdata(mng); - - /* cleanup. this will call mymngclosestream */ - mng_cleanup(&mng); - - /* free our data */ - free(mymng); - /* quit */ - exit(0); -} - -void cleanup(void) -{ - mngquit(mng->mng); - exit(0); -} - -void restore_area(void) -{ - int height, width; - unsigned char *dest, *background; - - if (sconly && current_console()!=start_console) - return; - - background = mng->background; - height = mng->height; - width = mng->width; - dest = mng->display + (mng->fbwidth * mng->fby + - mng->fbx) * (mng->fbbpp >> 3); - while (height--) { - memcpy(dest, background, width * (mng->fbbpp >> 3)); - background += width * (mng->fbbpp >> 3); - dest += mng->fbwidth * (mng->fbbpp >> 3); - } -} diff --git a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h b/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h deleted file mode 100644 index 11dfb94b2..000000000 --- a/Engine/lib/lmng/contrib/gcc/fbmngplay/mng.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - fbmngplay - fb console MNG player. - (c) 2001 by Stefan Reinauer, - - This program is based on mngplay, part of libmng, written and (C) by - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. -*/ - -#ifndef __HOOKS_H -#define __HOOKS_H - -#include "fbmngplay.h" - -extern mngstuff *mng; - -extern inline void mdelay(unsigned long msec); -extern mng_ptr mngalloc(mng_uint32 size); -extern void mngfree(mng_ptr p, mng_uint32 size); -extern mng_bool mngopenstream(mng_handle mng); -extern mng_bool mngclosestream(mng_handle mng); -extern mng_bool mngreadstream( mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32 * bytesread); -extern mng_bool mngprocessheader( mng_handle mng, mng_uint32 width, mng_uint32 height); -extern mng_ptr mnggetcanvasline(mng_handle mng, mng_uint32 line); -extern mng_uint32 mnggetticks(mng_handle mng); -extern mng_bool mngrefresh(mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h); -extern mng_bool mngsettimer(mng_handle mng, mng_uint32 msecs); -extern mng_bool mngerror(mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text); -extern int mngquit(mng_handle mng); -extern void cleanup(void); -extern void restore_area(void); -#endif - diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/COPYING b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/COPYING deleted file mode 100644 index eb685a5ec..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/COPYING +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/Makefile b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/Makefile deleted file mode 100644 index 6e0783e40..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -LIBMNG_PREFIX = /usr/local - -CC = gcc - -CFLAGS = -g -O2 -Wall \ - `pkg-config --cflags gtk+-2.0` \ - -I$(LIBMNG_PREFIX)/include - -LIBS = `pkg-config --libs gtk+-2.0` \ - -L$(LIBMNG_PREFIX)/lib -lmng -ljpeg -llcms -lz - -OBJ = dummy.o \ - gtk-mng-view.o - -EXE_BASENAME=gmngview - -all: $(EXE_BASENAME) - -$(EXE_BASENAME): $(OBJ) - $(CC) -o $(EXE_BASENAME) $(OBJ) $(LIBS) - -#$(EXE_BASENAME)-static: $(OBJ) -# $(CC) -static -o $(EXE_BASENAME)-static $(OBJ) $(LIBS) - -.c.o: gtk-mng-view.h - $(CC) -c $(CFLAGS) $< - -clean: - rm -f core $(EXE_BASENAME) $(EXE_BASENAME)-static $(OBJ) diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README deleted file mode 100644 index af7a21ff0..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README +++ /dev/null @@ -1,38 +0,0 @@ -From dummy.c: - -/* - * Very simple program, that has been used by us - * (V. Babin and - * S. Kondrat ) - * during toying with libmng (http://www.limng.com) - * - * License: GPL :-)) - * - * 7 July 2001: added key-press/button-press handling to exit viewer without - * window-manager help; added libmng version info [Greg Roelofs] - */ - -From gtk-mng-view.c: - -/* Toy widget for GTK+ for displaying MNG animations. - * - * Copyright (C) 2000 The Free Software Foundation - * - * Author(s): Volodymyr Babin - * - * This code is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README.compile b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README.compile deleted file mode 100644 index fb97b563b..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/README.compile +++ /dev/null @@ -1,8 +0,0 @@ -Require: - - * gtk+ >= 1.2.0 (tested on 1.2.8) - * libmng (tested on 0.9.2) - -You have specify Your libmng instalation prefix -before typing `make' in the first line of a Makefile -in this directory. Later type `make'. diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/dummy.c b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/dummy.c deleted file mode 100644 index c0aa16ec2..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/dummy.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Very simple program, that has been used by us - * (V. Babin and - * S. Kondrat ) - * during toying with libmng (http://www.libmng.com) - * - * License: GPL :-)) - * - * 7 July 2001: added key-press/button-press handling to exit viewer without - * window-manager help; added libmng version info [Greg Roelofs] - */ - -#include -#include -#include -#include -#include -#include -#include "gtk-mng-view.h" - -#define BLOCK_SIZE 4096 - -static guint -read_file (const gchar* file_name, guchar ** ptr) -{ - gint fd; - guint size = 0; - guint bytes_read = 0; - - if ((fd = open (file_name, O_RDONLY)) == -1) - { - perror (file_name); - * ptr = NULL; - return 0; - } - - * ptr = g_new (guchar, BLOCK_SIZE); - while ((bytes_read = read (fd, * ptr + size, BLOCK_SIZE))) - { - size += bytes_read; - * ptr = (guchar *) g_realloc (* ptr, size + BLOCK_SIZE); - } - close (fd); - - * ptr = (guchar *) g_realloc (* ptr, size); - return size; -} - -int -main (int argc, char ** argv) -{ - GtkMngView * mng_view; - GtkWidget * window; - GtkWidget * align; - GtkWidget * frame; - guchar * mng_data = NULL; - guint mng_data_size; - - if (argc < 2) - { - g_print ("Usage: %s \n\n", argv[0]); - - g_print (" Compiled with GTK+ %d.%d.%d; using GTK+ %d.%d.%d.\n", - GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION, - gtk_major_version, gtk_minor_version, gtk_micro_version); -#ifdef GDK_PIXBUF_VERSION - g_print (" Compiled with gdk-pixbuf %s; using gdk-pixbuf %s.\n", - GDK_PIXBUF_VERSION, gdk_pixbuf_version); -#endif - g_print (" Compiled with libmng %s; using libmng %s.\n", - MNG_VERSION_TEXT, mng_version_text()); - g_print (" Compiled with zlib %s; using zlib %s.\n", - ZLIB_VERSION, zlib_version); -#ifdef JPEG_LIB_VERSION - { - int major = JPEG_LIB_VERSION / 10; - int minor = JPEG_LIB_VERSION % 10; - char minoralpha[2]; - - if (minor) - { - minoralpha[0] = (char)(minor - 1 + 'a'); - minoralpha[1] = '\0'; - } - else - minoralpha[0] = '\0'; - g_print (" Compiled with libjpeg %d%s.\n", major, minoralpha); - } -#endif - g_print ("\nPress Esc or Q, or click mouse button, to quit.\n"); - return 1; - } - - mng_data_size = read_file (* (argv + 1), &mng_data); - - if (mng_data == NULL) - return 1; - - gtk_init (&argc, &argv); - gdk_rgb_init (); - gdk_rgb_set_verbose (TRUE); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - - window = gtk_widget_new (GTK_TYPE_WINDOW, - "GtkWindow::type", GTK_WINDOW_TOPLEVEL, - "GtkWindow::title", "MNG animation", - "GtkContainer::border_width", 5, - NULL); - gtk_signal_connect (GTK_OBJECT (window), "delete_event", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - /* any keypress (e.g., Esc or Q) or mouse-button click will quit viewer */ - gtk_signal_connect (GTK_OBJECT (window), "key_press_event", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - gtk_widget_add_events(window, GDK_BUTTON_PRESS_MASK); - gtk_signal_connect (GTK_OBJECT (window), "button_press_event", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (window), align); - frame = gtk_frame_new (NULL); - gtk_container_add (GTK_CONTAINER (align), frame); - - /* actually it */ - mng_view = GTK_MNG_VIEW (gtk_mng_view_new ()); - gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (mng_view)); - - gtk_mng_view_load_mng_from_memory (mng_view, mng_data, mng_data_size); - g_free (mng_data); - - /* rest in piece */ - gtk_widget_show_all (window); - gtk_main (); - - return 0; -} diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.c b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.c deleted file mode 100644 index 2a10d7c33..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.c +++ /dev/null @@ -1,471 +0,0 @@ -/* Toy widget for GTK+ for displaying MNG animations. - * - * Copyright (C) 2000 The Free Software Foundation - * - * Author(s): Volodymyr Babin - * - * This code is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "gtk-mng-view.h" -#include - -/* MNG callbacks */ - -static mng_ptr -mng_malloc_callback (mng_size_t how_many) -{ - return (mng_ptr) g_new0 (gchar, how_many); -} - -static void -mng_free_callback (mng_ptr pointer, mng_size_t number) -{ - g_free (pointer); -} - -static mng_bool -mng_open_stream_callback (mng_handle mng_h) -{ - return MNG_TRUE; -} - -static mng_bool -mng_close_stream_callback (mng_handle mng_h) -{ - return MNG_TRUE; -} - -static mng_bool -mng_read_data_callback (mng_handle mng_h, - mng_ptr buffer, - mng_uint32 bytes_requested, - mng_uint32 * bytes_read) -{ - guint available_mng_food; - - GtkMngView * mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - - available_mng_food = mng_view->bytes_to_eat - mng_view->bytes_eaten; - if (available_mng_food > 0 && mng_view->mng_food != NULL) - { - * bytes_read = (mng_uint32) MIN ((mng_uint32) available_mng_food, bytes_requested); - memcpy (buffer, mng_view->mng_food + mng_view->bytes_eaten, * bytes_read); - mng_view->bytes_eaten += * bytes_read; - return MNG_TRUE; - } - else - return MNG_FALSE; -} - -static mng_bool -mng_process_header_callback (mng_handle mng_h, - mng_uint32 width, - mng_uint32 height) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - - mng_view->width = width; - mng_view->height = height; - - g_free (mng_view->MNG_drawing_buffer); - mng_view->MNG_drawing_buffer = g_new0 (guchar, 3 * width * height); - - gtk_widget_queue_resize (GTK_WIDGET (mng_view)); - return MNG_TRUE; -} - -static gboolean -gtk_mng_view_animator (GtkMngView * mng_view) -{ - mng_retcode retcode; - - retcode = mng_display_resume (mng_view->MNG_handle); - - if (retcode == MNG_NOERROR) - { - mng_view->timeout_ID = 0; - return FALSE; - } - else if (retcode == MNG_NEEDTIMERWAIT) - return FALSE; - else - g_warning ("mng_display_resume() return not good value"); - - return FALSE; -} - -static mng_bool -mng_set_timer_callback (mng_handle mng_h, - mng_uint32 delay) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - mng_view->timeout_ID = gtk_timeout_add (delay, - (GtkFunction) gtk_mng_view_animator, - mng_view); - return MNG_TRUE; -} - -static mng_uint32 -mng_get_tickcount_callback (mng_handle mng_h) -{ - gdouble seconds; - gulong microseconds; - - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - seconds = g_timer_elapsed (mng_view->timer, - µseconds); - - return ((mng_uint32) (seconds*1000.0 + ((gdouble) microseconds)/1000.0)); -} - -static mng_ptr -mng_get_canvas_line_callback (mng_handle mng_h, - mng_uint32 line) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - return mng_view->MNG_drawing_buffer + 3 * line * mng_view->width; -} - -static void gtk_mng_view_paint (GtkMngView *, GdkRectangle *); - -static mng_bool -mng_refresh_callback (mng_handle mng_h, - mng_uint32 x, - mng_uint32 y, - mng_uint32 width, - mng_uint32 height) -{ - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (mng_get_userdata (mng_h)); - - if (GTK_WIDGET_REALIZED (mng_view)) - { - GdkRectangle rectangle; - - rectangle.x = x; - rectangle.y = y; - rectangle.width = width; - rectangle.height = height; - gtk_mng_view_paint (mng_view, &rectangle); - } - return MNG_TRUE; -} - -static gboolean -gtk_mng_view_init_libmng (GtkMngView * mng_view) -{ - GtkWidget * widget; - - g_return_val_if_fail (IS_GTK_MNG_VIEW (mng_view), FALSE); - - if (mng_view->MNG_handle) - mng_cleanup (&mng_view->MNG_handle); - - mng_view->MNG_handle = mng_initialize (mng_view, - mng_malloc_callback, - mng_free_callback, - MNG_NULL); - - if (mng_view->MNG_handle == MNG_NULL) - return FALSE; - - if (mng_setcb_openstream (mng_view->MNG_handle, mng_open_stream_callback) != MNG_NOERROR || - mng_setcb_closestream (mng_view->MNG_handle, mng_close_stream_callback) != MNG_NOERROR || - mng_setcb_readdata (mng_view->MNG_handle, mng_read_data_callback) != MNG_NOERROR || - mng_setcb_processheader (mng_view->MNG_handle, mng_process_header_callback) != MNG_NOERROR || - mng_setcb_settimer (mng_view->MNG_handle, mng_set_timer_callback) != MNG_NOERROR || - mng_setcb_gettickcount (mng_view->MNG_handle, mng_get_tickcount_callback) != MNG_NOERROR || - mng_setcb_getcanvasline (mng_view->MNG_handle, mng_get_canvas_line_callback) != MNG_NOERROR || - mng_setcb_refresh (mng_view->MNG_handle, mng_refresh_callback) != MNG_NOERROR) - { - mng_cleanup (&mng_view->MNG_handle); - return FALSE; - } - - mng_set_canvasstyle (mng_view->MNG_handle, MNG_CANVAS_RGB8); - - widget = GTK_WIDGET (mng_view); - - if (!GTK_WIDGET_REALIZED (widget)) - gtk_widget_realize (widget); - - mng_set_bgcolor (mng_view->MNG_handle, - widget->style->bg[GTK_STATE_NORMAL].red, - widget->style->bg[GTK_STATE_NORMAL].green, - widget->style->bg[GTK_STATE_NORMAL].blue); - return TRUE; -} - -/* GTK+ widget methods */ - -static GtkWidgetClass * parent_class = NULL; - -static void -gtk_mng_view_finalize (GObject * obj) -{ - GtkMngView * mng_view = GTK_MNG_VIEW (obj); - - g_timer_destroy (mng_view->timer); - - if (mng_view->timeout_ID) - gtk_timeout_remove (mng_view->timeout_ID); - - g_free (mng_view->MNG_drawing_buffer); - - if (mng_view->MNG_handle) - mng_cleanup (&mng_view->MNG_handle); - - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -gtk_mng_view_size_request (GtkWidget * widget, GtkRequisition * requisition) -{ - GtkMngView * mng_view; - - g_return_if_fail (IS_GTK_MNG_VIEW (widget)); - g_return_if_fail (requisition != NULL); - - mng_view = (GtkMngView *) widget; - - requisition->width = mng_view->width; - requisition->height = mng_view->height; -} - -static void -gtk_mng_view_size_allocate (GtkWidget * widget, GtkAllocation * allocation) -{ - g_return_if_fail (IS_GTK_MNG_VIEW (widget)); - g_return_if_fail (allocation != NULL); - - if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, - allocation->x, - allocation->y, - allocation->width, - allocation->height); -} - -static void -gtk_mng_view_paint (GtkMngView * mng_view, - GdkRectangle * area) -{ - GtkWidget * widget; - guint rowstride; - guchar * buffer; - register guchar * ptr; - register guchar * bptr; - - widget = GTK_WIDGET (mng_view); - - g_assert (GTK_WIDGET_REALIZED (widget)); - - rowstride = 3 * area->width; - buffer = g_new (guchar, rowstride * area->height); - - - bptr = buffer; - ptr = mng_view->MNG_drawing_buffer - + 3 * (area->y * mng_view->width + area->x); - - while (bptr < buffer + rowstride * area->height) - { - memcpy (bptr, ptr, rowstride); - bptr += rowstride; - ptr += 3 * mng_view->width; - } - - gdk_draw_rgb_image (widget->window, - widget->style->white_gc, - area->x, - area->y, - area->width, - area->height, - GDK_RGB_DITHER_NORMAL, - buffer, - rowstride); - - g_free (buffer); - gdk_flush (); -} - -static gboolean -gtk_mng_view_expose (GtkWidget * widget, GdkEventExpose * event) -{ - g_return_val_if_fail (IS_GTK_MNG_VIEW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - if (GTK_WIDGET_REALIZED (widget)) - { - GdkRectangle dummy; - GdkRectangle rectangle; - GtkMngView * mng_view; - - mng_view = GTK_MNG_VIEW (widget); - dummy.x = dummy.y = 0; - dummy.width = mng_view->width; - dummy.height = mng_view->height; - - if (gdk_rectangle_intersect (&dummy, &event->area, &rectangle)) - gtk_mng_view_paint (mng_view, &rectangle); - } - return FALSE; -} - -static void -gtk_mng_view_realize (GtkWidget * widget) -{ - GdkWindowAttr attributes; - gint attributes_mask; - - g_return_if_fail (IS_GTK_MNG_VIEW (widget)); - - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); - attributes.event_mask = gtk_widget_get_events (widget); - attributes.event_mask |= GDK_EXPOSURE_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, widget); - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); -} - -static void -gtk_mng_view_init (GtkMngView * mng_view) -{ - g_return_if_fail (IS_GTK_MNG_VIEW (mng_view)); - - GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (mng_view), GTK_NO_WINDOW); - - mng_view->MNG_handle = NULL; - mng_view->MNG_drawing_buffer = NULL; - mng_view->timeout_ID = 0; - mng_view->timer = g_timer_new (); - g_timer_start (mng_view->timer); - mng_view->mng_food = NULL; -} - -static void -gtk_mng_view_class_init (GtkMngViewClass * klass) -{ - GObjectClass * object_class; - GtkWidgetClass * widget_class; - - parent_class = g_type_class_peek_parent (klass); - - object_class = G_OBJECT_CLASS (klass); - object_class->finalize = gtk_mng_view_finalize; - - widget_class = GTK_WIDGET_CLASS (klass); - widget_class->size_request = gtk_mng_view_size_request; - widget_class->size_allocate = gtk_mng_view_size_allocate; - widget_class->expose_event = gtk_mng_view_expose; - widget_class->realize = gtk_mng_view_realize; -} - -GtkType -gtk_mng_view_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo type_info = - { - "GtkMngView", - sizeof (GtkMngView), - sizeof (GtkMngViewClass), - (GtkClassInitFunc) gtk_mng_view_class_init, - (GtkObjectInitFunc) gtk_mng_view_init, - NULL, NULL, - (GtkClassInitFunc) NULL - }; - type = gtk_type_unique (GTK_TYPE_WIDGET, &type_info); - } - return type; -} - -GtkWidget * -gtk_mng_view_new (void) -{ - return GTK_WIDGET (gtk_type_new (GTK_MNG_VIEW_TYPE)); -} - -gboolean -gtk_mng_view_load_mng_from_memory (GtkMngView * mng_view, - guchar * data_to_eat, - guint data_size) -{ - g_return_val_if_fail (IS_GTK_MNG_VIEW (mng_view), FALSE); - g_return_val_if_fail (data_size > 27, FALSE); - g_return_val_if_fail (data_to_eat != NULL, FALSE); - - if (data_to_eat[0] != 0x8a || - data_to_eat[1] != 'M' || - data_to_eat[2] != 'N' || - data_to_eat[3] != 'G' || - data_to_eat[4] != 0x0d || - data_to_eat[5] != 0x0a || - data_to_eat[6] != 0x1a || - data_to_eat[7] != 0x0a) - { - g_warning ("not mng format"); - return FALSE; - } - - if (gtk_mng_view_init_libmng (mng_view)) - { - mng_view->bytes_to_eat = data_size; - mng_view->bytes_eaten = 0; - mng_view->mng_food = data_to_eat; - - if (mng_read (mng_view->MNG_handle) != MNG_NOERROR) - { - g_warning ("libmng read error"); - mng_cleanup (&mng_view->MNG_handle); - return FALSE; - } - else - return mng_display (mng_view->MNG_handle); - } - else - { - g_warning ("error initializing libmng"); - return FALSE; - } - return TRUE; -} diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.h b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.h deleted file mode 100644 index 1cbb33524..000000000 --- a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/gtk-mng-view.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Toy widget for GTK+ for displaying MNG animations. - * - * Copyright (C) 2000 The Free Software Foundation - * - * Author(s): Volodymyr Babin - * - * This code is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GTK_MNG_VIEW_H__ -#define __GTK_MNG_VIEW_H__ - -#include -#include - -#define GTK_MNG_VIEW_TYPE (gtk_mng_view_get_type ()) -#define GTK_MNG_VIEW(o) (GTK_CHECK_CAST ((o), GTK_MNG_VIEW_TYPE, GtkMngView)) -#define GTK_MNG_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), GTK_MNG_VIEW_TYPE, GtkMngViewClass)) -#define IS_GTK_MNG_VIEW(o) (GTK_CHECK_TYPE ((o), GTK_MNG_VIEW_TYPE)) -#define IS_GTK_MNG_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GTK_MNG_VIEW_TYPE)) - -typedef struct _GtkMngView GtkMngView; -typedef struct _GtkMngViewClass GtkMngViewClass; - -struct _GtkMngView -{ - GtkWidget widget; - /* private */ - GTimer * timer; - guint timeout_ID; - guint width; - guint height; - mng_handle MNG_handle; - guchar * MNG_drawing_buffer; - guchar * mng_food; - guint bytes_to_eat; - guint bytes_eaten; -}; - -struct _GtkMngViewClass -{ - GtkWidgetClass klass; -}; - -GtkType gtk_mng_view_get_type (void); -GtkWidget * gtk_mng_view_new (void); - -/* returns !FALSE on success */ -gboolean gtk_mng_view_load_mng_from_memory (GtkMngView *, guchar *, guint); - -#endif /* __GTK_MNG_VIEW_H__ */ diff --git a/Engine/lib/lmng/contrib/gcc/gtk-mng-view/linux.mng b/Engine/lib/lmng/contrib/gcc/gtk-mng-view/linux.mng deleted file mode 100644 index 16ffa04360f5aeecf0456604329918c8639f0229..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 62066 zcmeF%RZtvJyEl3~xVw91a0?E>T?cm^+}#Q85*T1`w?H7cySrNmF2M=z^cz$_W+tG$ zom~wQ<>BGs$;n9+A`veS&x1FptgP(f;^NUj*vrey8VT?E`Z`;jr;dzXR9I+QPx2Y! zB#VU6-QAs&lXHK69~l{$O-5U#FC#52)c^!``B||cq2l7=hK7dvlam`88_(LRzn2BP zzrRD60Mki<^YioR>FMtciI|v}TcTVlDk?!iL2Y(w1{5TJ%A?-9p`J{P?_(u#CTjnF zh!B~o-GA>Q<^fXC_;>mLXM^eYuakm-!OWJI64&(k*_CbYz0gV+x#wRe$AMYI&9-_) z0(*6hUd3B8Nve|l_iycVhvyZ8YgQxoX+;2l=c?Fys}!=d^S4fWrH2P=0NJFGbZh43 z)}%aq&Z?tJ%Ou+qUmA7)_hwp&J>dP&t7Sby?WDzOj$%^onr zZKb_14g5u<(XWV}K(Yit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PmgqRps3Nb>Xxoa5W?2+CT9jq9q04ER!V=IvSW7Dr|b#GcmS|DXJ9iojIoITN*YI1A}FW3>*rEMoQo| zvoV!{Bg%nxI$?XZiL27Bhkk5CnZQNEP@Uq|G{~g%1dbE0$XuaGP-qE$`yf!mF$clX zJ61KDJ8YLS5uXkdIqc4gIlc*?exd{2+V3DL%qlg5SI6&*9XL2!&LE6&X_I!q{Mej) zGlN2zA}m!L1<{)86R49ip!hmd8jd*zsV{~Y>~)p29L8}=QIKZLujVO-T92Y0(_L6; zQNJ@3hAEMP#BmeDf(uipL{{_f@L~fRHF5_230p#=!)SGY!3o(b$wo>BQbzBI`*BgU zn4Y6FG%4aWIy!49b4`>?rHtR-uVY5Z1dDN2S?(eAX2 zqtykL*BDEk=62DgRXs)y?KS<}g{Z08Ms4Nq0Y)FZok!w$5W-U>BPr9*kPwFDw4l+7 zdISk!B|`L$R|I;Lhu0{m6=|$fZI7Zkgn|@othCSgBPG?Vl!GSfI*tjWNUSPq7Xe7e z)LPmwwnkY$PXWdU26{l!Y1hsFc2U(hoxR>!OY4ftti9$wa|H~VdaSOf)7`h1?-6y~ z8;h+aJFis7N@hPlM!N&_iw-ng4Wtz^s*fG)a1Q05alarAEJt5$NTunp%qt7o!m```iRkAUf~YsQVtp&=%@xry|(TyKQPtE>%E%8`ILiXObZ&U z4$+nrId;q8J(PoN&ZpGE)&1s2{BFRgMqZI8Ag_E5796b^PbUBhUagO*-YqAu^~z^@ zr8;n9RKK(i(F!=3i)T>|>MF2}#`jNF(uSR?|0YknsD zyK?_~`3B>h&%n!}?T5bTd2e3hoX_)1IV^{A^zf?F-$lV1-2GU~c`tv*|7Rg(Z?(6A q>f@BZvHk~5ZLYT)!ruu10000 -#include -#include - -#include "../../../libmng.h" - -/* ************************************************************************** */ - -typedef struct user_struct { - - FILE *hFile; /* file handle */ - int iIndent; /* for nice indented formatting */ - - } userdata; - -typedef userdata * userdatap; - -/* ************************************************************************** */ - -mng_ptr myalloc (mng_size_t iSize) -{ /* duh! */ - return (mng_ptr)calloc (1, (size_t)iSize); -} - -/* ************************************************************************** */ - -void myfree (mng_ptr pPtr, mng_size_t iSize) -{ - free (pPtr); /* duh! */ - return; -} - -/* ************************************************************************** */ - -mng_bool myopenstream (mng_handle hMNG) -{ - return MNG_TRUE; /* already opened in main function */ -} - -/* ************************************************************************** */ - -mng_bool myclosestream (mng_handle hMNG) -{ - return MNG_TRUE; /* gets closed in main function */ -} - -/* ************************************************************************** */ - -mng_bool myreaddata (mng_handle hMNG, - mng_ptr pBuf, - mng_uint32 iSize, - mng_uint32 *iRead) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - /* read it */ - *iRead = fread (pBuf, 1, iSize, pMydata->hFile); - /* iRead will indicate EOF */ - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool myiterchunk (mng_handle hMNG, - mng_handle hChunk, - mng_chunkid iChunktype, - mng_uint32 iChunkseq) -{ /* get to my file handle */ - userdatap pMydata = (userdatap)mng_get_userdata (hMNG); - char aCh[4]; - char zIndent[80]; - int iX; - /* decode the chunkname */ - aCh[0] = (char)((iChunktype >> 24) & 0xFF); - aCh[1] = (char)((iChunktype >> 16) & 0xFF); - aCh[2] = (char)((iChunktype >> 8) & 0xFF); - aCh[3] = (char)((iChunktype ) & 0xFF); - /* indent less ? */ - if ( (iChunktype == MNG_UINT_MEND) || (iChunktype == MNG_UINT_IEND) || - (iChunktype == MNG_UINT_ENDL) ) - pMydata->iIndent -= 2; - /* this looks ugly; but I haven't - figured out how to do it prettier */ - for (iX = 0; iX < pMydata->iIndent; iX++) - zIndent[iX] = ' '; - zIndent[pMydata->iIndent] = '\0'; - /* print a nicely indented line */ - printf ("%s%c%c%c%c\n", zIndent, aCh[0], aCh[1], aCh[2], aCh[3]); - /* indent more ? */ - if ( (iChunktype == MNG_UINT_MHDR) || (iChunktype == MNG_UINT_IHDR) || - (iChunktype == MNG_UINT_JHDR) || (iChunktype == MNG_UINT_DHDR) || - (iChunktype == MNG_UINT_BASI) || (iChunktype == MNG_UINT_LOOP) ) - pMydata->iIndent += 2; - - return MNG_TRUE; /* keep'm coming... */ -} - -/* ************************************************************************** */ - -int dumptree (char * zFilename) -{ - userdatap pMydata; - mng_handle hMNG; - mng_retcode iRC; - /* get a data buffer */ - pMydata = (userdatap)calloc (1, sizeof (userdata)); - - if (pMydata == NULL) /* oke ? */ - { - fprintf (stderr, "Cannot allocate a data buffer.\n"); - return 1; - } - /* can we open the file ? */ - if ((pMydata->hFile = fopen (zFilename, "rb")) == NULL) - { /* error out if we can't */ - fprintf (stderr, "Cannot open input file %s.\n", zFilename); - return 1; - } - /* let's initialize the library */ - hMNG = mng_initialize ((mng_ptr)pMydata, myalloc, myfree, MNG_NULL); - - if (!hMNG) /* did that work out ? */ - { - fprintf (stderr, "Cannot initialize libmng.\n"); - iRC = 1; - } - else - { /* setup callbacks */ - if ( ((iRC = mng_setcb_openstream (hMNG, myopenstream )) != 0) || - ((iRC = mng_setcb_closestream (hMNG, myclosestream)) != 0) || - ((iRC = mng_setcb_readdata (hMNG, myreaddata )) != 0) ) - fprintf (stderr, "Cannot set callbacks for libmng.\n"); - else - { /* read the file into memory */ - if ((iRC = mng_read (hMNG)) != 0) - fprintf (stderr, "Cannot read the file.\n"); - else - { - pMydata->iIndent = 2; /* start of the indenting at a nice level */ - - printf ("Starting dump of %s.\n\n", zFilename); - /* run through the chunk list */ - if ((iRC = mng_iterate_chunks (hMNG, 0, myiterchunk)) != 0) - fprintf (stderr, "Cannot iterate the chunks.\n"); - - printf ("\nDone.\n"); - } - } - - mng_cleanup (&hMNG); /* cleanup the library */ - } - - fclose (pMydata->hFile); /* cleanup */ - free (pMydata); - - return iRC; -} - -/* ************************************************************************** */ - -int main(int argc, char *argv[]) -{ - if (argc > 1) /* need that first parameter ! */ - return dumptree (argv[1]); - else - printf ("\nUsage: mngtree \n\n"); - - return 0; -} - -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/.deps/mngplay.P b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/.deps/mngplay.P deleted file mode 100644 index 6d68a8a48..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/.deps/mngplay.P +++ /dev/null @@ -1,114 +0,0 @@ -mngplay.o: mngplay.c /usr/include/stdio.h /usr/include/features.h \ - /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stddef.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stdarg.h \ - /usr/include/bits/types.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/bits/stdio_lim.h \ - /usr/include/bits/stdio.h /usr/include/stdlib.h \ - /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h \ - /usr/include/bits/endian.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/sys/sysmacros.h /usr/include/alloca.h \ - /usr/local/include/SDL/SDL.h /usr/local/include/SDL/SDL_main.h \ - /usr/local/include/SDL/SDL_types.h \ - /usr/local/include/SDL/SDL_getenv.h \ - /usr/local/include/SDL/SDL_error.h \ - /usr/local/include/SDL/begin_code.h \ - /usr/local/include/SDL/close_code.h \ - /usr/local/include/SDL/SDL_rwops.h /usr/local/include/SDL/SDL_timer.h \ - /usr/local/include/SDL/SDL_audio.h \ - /usr/local/include/SDL/SDL_byteorder.h \ - /usr/local/include/SDL/SDL_cdrom.h \ - /usr/local/include/SDL/SDL_joystick.h \ - /usr/local/include/SDL/SDL_events.h \ - /usr/local/include/SDL/SDL_active.h \ - /usr/local/include/SDL/SDL_keyboard.h \ - /usr/local/include/SDL/SDL_keysym.h \ - /usr/local/include/SDL/SDL_mouse.h /usr/local/include/SDL/SDL_video.h \ - /usr/local/include/SDL/SDL_mutex.h /usr/local/include/SDL/SDL_quit.h \ - /usr/local/include/SDL/SDL_version.h /usr/local/include/libmng.h \ - /usr/local/include/libmng_conf.h /usr/local/include/libmng_types.h \ - /usr/local/include/zlib.h /usr/local/include/zconf.h \ - /usr/include/setjmp.h /usr/include/bits/setjmp.h \ - /usr/local/include/jpeglib.h /usr/local/include/jconfig.h \ - /usr/local/include/jmorecfg.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/limits.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/string.h \ - /usr/include/bits/string.h /usr/include/bits/string2.h \ - /usr/include/math.h /usr/include/bits/huge_val.h \ - /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ - /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/float.h \ - /usr/include/bits/mathinline.h -mngplay.c : -/usr/include/stdio.h : -/usr/include/features.h : -/usr/include/sys/cdefs.h : -/usr/include/gnu/stubs.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stddef.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/stdarg.h : -/usr/include/bits/types.h : -/usr/include/libio.h : -/usr/include/_G_config.h : -/usr/include/bits/stdio_lim.h : -/usr/include/bits/stdio.h : -/usr/include/stdlib.h : -/usr/include/sys/types.h : -/usr/include/time.h : -/usr/include/endian.h : -/usr/include/bits/endian.h : -/usr/include/sys/select.h : -/usr/include/bits/select.h : -/usr/include/bits/sigset.h : -/usr/include/sys/sysmacros.h : -/usr/include/alloca.h : -/usr/local/include/SDL/SDL.h : -/usr/local/include/SDL/SDL_main.h : -/usr/local/include/SDL/SDL_types.h : -/usr/local/include/SDL/SDL_getenv.h : -/usr/local/include/SDL/SDL_error.h : -/usr/local/include/SDL/begin_code.h : -/usr/local/include/SDL/close_code.h : -/usr/local/include/SDL/SDL_rwops.h : -/usr/local/include/SDL/SDL_timer.h : -/usr/local/include/SDL/SDL_audio.h : -/usr/local/include/SDL/SDL_byteorder.h : -/usr/local/include/SDL/SDL_cdrom.h : -/usr/local/include/SDL/SDL_joystick.h : -/usr/local/include/SDL/SDL_events.h : -/usr/local/include/SDL/SDL_active.h : -/usr/local/include/SDL/SDL_keyboard.h : -/usr/local/include/SDL/SDL_keysym.h : -/usr/local/include/SDL/SDL_mouse.h : -/usr/local/include/SDL/SDL_video.h : -/usr/local/include/SDL/SDL_mutex.h : -/usr/local/include/SDL/SDL_quit.h : -/usr/local/include/SDL/SDL_version.h : -/usr/local/include/libmng.h : -/usr/local/include/libmng_conf.h : -/usr/local/include/libmng_types.h : -/usr/local/include/zlib.h : -/usr/local/include/zconf.h : -/usr/include/setjmp.h : -/usr/include/bits/setjmp.h : -/usr/local/include/jpeglib.h : -/usr/local/include/jconfig.h : -/usr/local/include/jmorecfg.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/limits.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/syslimits.h : -/usr/include/limits.h : -/usr/include/bits/posix1_lim.h : -/usr/include/bits/local_lim.h : -/usr/include/linux/limits.h : -/usr/include/bits/posix2_lim.h : -/usr/include/string.h : -/usr/include/bits/string.h : -/usr/include/bits/string2.h : -/usr/include/math.h : -/usr/include/bits/huge_val.h : -/usr/include/bits/mathdef.h : -/usr/include/bits/mathcalls.h : -/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include/float.h : -/usr/include/bits/mathinline.h : diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS deleted file mode 100644 index 4ff88f20e..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/AUTHORS +++ /dev/null @@ -1,7 +0,0 @@ -Contributors to mnyplay - -Ralph Giles -Greg Roelofs (minor contribs!) - --- -$Date: 2002/09/26 18:09:37 $ diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/COPYING b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/COPYING deleted file mode 100644 index d60c31a97..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/ChangeLog b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/ChangeLog deleted file mode 100644 index c7605a8b1..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/ChangeLog +++ /dev/null @@ -1,29 +0,0 @@ -2001-07-08 Greg Roelofs - - added SDL/libmng/zlib/libjpeg version info to usage screen - - added mouse-click handling (as an alternate quit mode) - - added completely static build - - fixed automake setup to order options and libraries correctly on - link line, and included resulting files (configure, Makefile.in, - etc.) in order to match instructions in INSTALL file - -2000-07-06 Ralph Giles - * Release 0.1 - - added error handling callback - - added event system so you can actually quit - (click the window closebox or type 'escape' or 'q') - - window titles from the filename - - added basic auto* - -2000-07-05 Ralph Giles - * snapshot; - - changed refresh parameters to patch libmng 0.9 - -2000-06-06 Ralph Giles - * snapshot; - - basic playing works now with the MNGsuite tests - -2000-06-06 Ralph Giles - * snapshot; - - doesn't really work yet - -# beginning =) diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/INSTALL b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/INSTALL deleted file mode 100644 index b42a17ac4..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.am b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.am deleted file mode 100644 index 059b1d3e7..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -# process this with automake to create Makefile.in - -bin_PROGRAMS = mngplay mngplay-static - -mngplay_SOURCES = mngplay.c -mngplay_static_SOURCES = mngplay.c - -mngplay_static_LDFLAGS = -static - -# end diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.in b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.in deleted file mode 100644 index 2881fb680..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/Makefile.in +++ /dev/null @@ -1,534 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 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@ - -# process this with automake to create Makefile.in - -SOURCES = $(mngplay_SOURCES) $(mngplay_static_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -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 = : -bin_PROGRAMS = mngplay$(EXEEXT) mngplay-static$(EXEEXT) -subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ - ChangeLog INSTALL depcomp install-sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_mngplay_OBJECTS = mngplay.$(OBJEXT) -mngplay_OBJECTS = $(am_mngplay_OBJECTS) -mngplay_DEPENDENCIES = -am_mngplay_static_OBJECTS = mngplay.$(OBJEXT) -mngplay_static_OBJECTS = $(am_mngplay_static_OBJECTS) -mngplay_static_DEPENDENCIES = -DEFAULT_INCLUDES = -I. -I$(srcdir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(mngplay_SOURCES) $(mngplay_static_SOURCES) -DIST_SOURCES = $(mngplay_SOURCES) $(mngplay_static_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GREP = @GREP@ -HAS_SDL = @HAS_SDL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -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_alias = @build_alias@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -mngplay_LDADD = @mngplay_LDADD@ -mngplay_static_LDADD = @mngplay_static_LDADD@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -mngplay_SOURCES = mngplay.c -mngplay_static_SOURCES = mngplay.c -mngplay_static_LDFLAGS = -static -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -mngplay$(EXEEXT): $(mngplay_OBJECTS) $(mngplay_DEPENDENCIES) - @rm -f mngplay$(EXEEXT) - $(LINK) $(mngplay_LDFLAGS) $(mngplay_OBJECTS) $(mngplay_LDADD) $(LIBS) -mngplay-static$(EXEEXT): $(mngplay_static_OBJECTS) $(mngplay_static_DEPENDENCIES) - @rm -f mngplay-static$(EXEEXT) - $(LINK) $(mngplay_static_LDFLAGS) $(mngplay_static_OBJECTS) $(mngplay_static_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mngplay.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -uninstall-info-am: - -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; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - 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; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - 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; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; 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: - $(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 -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_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-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ - clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ - dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-compile distclean-generic distclean-tags \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-info-am - - -# end -# 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/Engine/lib/lmng/contrib/gcc/sdl-mngplay/README b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/README deleted file mode 100644 index 0a99d0a62..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/README +++ /dev/null @@ -1,27 +0,0 @@ -* mngplay * - -a simple SDL-based mng player - -This is a simple example program, using the Simple Direct media Layer -to display mng animation decoded by the new libmng implementation. - -SDL and libmng are quite portable, but I've only tried it on x86 Linux. -Project files for MacOS, BeOS and Win32 are welcome. The code's fairly -rough at this point, but there was no example player for *nix in the -distribution. Patches welcome, of course. - -On a unix-like system, the build instructions are simple: - -(install and/or build the SDL libraries from libsdl.org) -(install and/or build the mng library from libmng.com) -./configure (or ./autogen.sh if you're using the cvs source) -make -make install - -To use the player: - -mngplay .mng - ---- -Ralph Giles -$Date: 2002/09/26 18:09:37 $ diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/acinclude.m4 b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/acinclude.m4 deleted file mode 100644 index 9505b56ba..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/acinclude.m4 +++ /dev/null @@ -1,34 +0,0 @@ -dnl autoconf macros for detecting libmng -dnl add this to your aclocal or acinclude to make use of it -dnl -dnl (c) 2000 Ralph Giles -dnl - -dnl A basic check: looks for libmng and its dependencies -dnl and adds the required bits to CFLAGS and LIBS - -# check for libmng -AC_DEFUN(LIBMNG_CHECK, [ - dnl prerequisites first - AC_CHECK_LIB(jpeg, jpeg_set_defaults) - AC_CHECK_LIB(z, inflate) - dnl now the library - AC_CHECK_LIB(mng, mng_readdisplay, [_libmng_present=1]) - AC_CHECK_HEADER(libmng.h) - dnl see if we need the optional link dependency - AC_CHECK_LIB(lcms, cmsCreateRGBProfile, [ - AC_CHECK_HEADER(lcms.h) - AC_CHECK_LIB(mng, mnglcms_initlibrary, [ - LIBS="$LIBS -llcms" - AC_DEFINE(HAVE_LIBLCMS) - _libmng_present=1 - ]) - ]) - if test $_libmng_present -eq 1; then - LIBS="-lmng $LIBS" - AC_DEFINE(HAVE_LIBMNG) - fi - _libmng_present= -]) - -dnl end LIBMNG macros diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/aclocal.m4 b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/aclocal.m4 deleted file mode 100644 index 6b72bbb1e..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/aclocal.m4 +++ /dev/null @@ -1,851 +0,0 @@ -# generated automatically by aclocal 1.9.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. -# This file 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. - -# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION so it can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.6])]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file 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. - -# serial 7 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file 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. - -# serial 8 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH]) -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file 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. - -#serial 3 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file 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. - -# serial 12 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.58])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# serial 3 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file 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. - -# serial 4 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# AM_PROG_MKDIR_P -# --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. -# -# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories -# created by `make install' are always world readable, even if the -# installer happens to have an overly restrictive umask (e.g. 077). -# This was a mistake. There are at least two reasons why we must not -# use `-m 0755': -# - it causes special bits like SGID to be ignored, -# - it may be too restrictive (some setups expect 775 directories). -# -# Do not use -m 0755 and let people choose whatever they expect by -# setting umask. -# -# We cannot accept any implementation of `mkdir' that recognizes `-p'. -# Some implementations (such as Solaris 8's) are not thread-safe: if a -# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' -# concurrently, both version can detect that a/ is missing, but only -# one can create it and the other will error out. Consequently we -# restrict ourselves to GNU make (using the --version option ensures -# this.) -AC_DEFUN([AM_PROG_MKDIR_P], -[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p])]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# serial 3 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file 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. - -# serial 4 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file 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. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([acinclude.m4]) diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.notes b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.notes deleted file mode 100644 index 8f217578d..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.notes +++ /dev/null @@ -1,54 +0,0 @@ -[The end of this file is the result of the following command, executed - under tcsh: - - (time /bin/sh autogen.sh) >>&! autogen.log & - - If you have automake and autoconf, the following minimal set of files - is sufficient to rerun the autogen.sh script: - - Makefile.am - acinclude.m4 - autogen.sh - configure.in - mngplay.c - - It will then create the following files: - - aclocal.m4 - mkinstalldirs [symbolic link to utility supplied with automake] - missing [symbolic link to utility supplied with automake] - install-sh [symbolic link to utility supplied with automake] - Makefile.in - configure - - The following documentation files are also part of mngplay: - - AUTHORS - COPYING - ChangeLog - INSTALL - README - - I have replaced the symbolic links with copies of the actual utilities and - included all files in order to match the instructions in the INSTALL file. - Either run configure and make in the usual manner, or, if you prefer, rerun - autogen.sh from scratch and then run configure and make. - - Greg Roelofs, 20010708 -] - ------------------------------------------------------------------------------- - -If you wish to pass any options to configure, please specify them on the -`autogen.sh' command line. -For example use --prefix= to specify the install directory. - -processing . -Running aclocal ... -Running automake --foreign ... -automake: configure.in: installing `./install-sh' -automake: configure.in: installing `./mkinstalldirs' -automake: configure.in: installing `./missing' -Running autoconf ... -Skipping configure process. -1.370u 0.220s 0:03.32 47.8% 0+0k 0+0io 3201pf+0w diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.sh b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.sh deleted file mode 100644 index 73864c449..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/autogen.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. - -PKGNAME="mngplay" - -# GRR 20010708: added this; just want to create configure script, not run it: -NOCONFIGURE="true" - -am_opt="--foreign" - -DIE=0 - -# try to guess the proper treetop -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. -(test -f $srcdir/configure.in \ - && test -f $srcdir/mngplay.c) || { - echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" - echo " top-level $PKGNAME directory" - exit 1 -} - - -# check for autoconf -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile $PKGNAME." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -# check for automake -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile $PKGNAME." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)." - DIE=1 - NO_AUTOMAKE=yes -} - - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)." - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$*"; then - echo - echo "If you wish to pass any options to configure, please specify them on the" - echo \`$0\'" command line." - echo "For example use --prefix= to specify the install directory." - echo -fi - -case $CC in -xlc ) - am_opt="$(am_opt) --include-deps";; -esac - -for coin in `find $srcdir -name configure.in -print` -do - dr=`dirname $coin` - if test -f $dr/NO-AUTO-GEN; then - echo skipping $dr -- flagged as no auto-gen - else - echo processing $dr - macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` - ( cd $dr - aclocalinclude="$ACLOCAL_FLAGS" - for k in $macrodirs; do - if test -d $k; then - aclocalinclude="$aclocalinclude -I $k" - ##else - ## echo "**Warning**: No such directory \`$k'. Ignored." - fi - done - if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then - if grep "sed.*POTFILES" configure.in >/dev/null; then - : do nothing -- we still have an old unmodified configure.in - else - echo "Creating $dr/aclocal.m4 ..." - test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 - echo "Running gettextize... Ignore non-fatal messages." - echo "no" | gettextize --force --copy - echo "Making $dr/aclocal.m4 writable ..." - test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 - fi - fi - if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then - echo "Creating $dr/aclocal.m4 ..." - test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 - echo "Running gettextize... Ignore non-fatal messages." - echo "no" | gettextize --force --copy - echo "Making $dr/aclocal.m4 writable ..." - test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 - fi - if grep "^AC_PROG_LIBTOOL" configure.in >/dev/null; then - echo "Running libtoolize..." - libtoolize --force --copy - fi - echo "Running aclocal $aclocalinclude ..." - aclocal $aclocalinclude - if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then - echo "Running autoheader..." - autoheader - fi - echo "Running automake $am_opt ..." - automake --add-missing $am_opt - echo "Running autoconf ..." - autoconf - ) - fi -done - -#conf_flags="--enable-maintainer-mode --enable-debug " - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" -else - echo Skipping configure process. -fi - -# end diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure deleted file mode 100644 index 857b82741..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure +++ /dev/null @@ -1,5782 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61. -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - - -exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="mngplay.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -CYGPATH_W -PACKAGE -VERSION -ACLOCAL -AUTOCONF -AUTOMAKE -AUTOHEADER -MAKEINFO -install_sh -STRIP -INSTALL_STRIP_PROGRAM -mkdir_p -AWK -SET_MAKE -am__leading_dot -AMTAR -am__tar -am__untar -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -DEPDIR -am__include -am__quote -AMDEP_TRUE -AMDEP_FALSE -AMDEPBACKSLASH -CCDEPMODE -am__fastdepCC_TRUE -am__fastdepCC_FALSE -CPP -GREP -EGREP -HAS_SDL -mngplay_LDADD -mngplay_static_LDADD -LIBOBJS -LTLIBOBJS' -ac_subst_files='' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute directory names. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -configure -generated by GNU Autoconf 2.61 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" -else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" -fi -shift -for ac_site_file -do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -am__api_version="1.9" -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done -IFS=$as_save_IFS - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm -f conftest.sed - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 -echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # We used to keeping the `.' as first argument, in order to - # allow $(mkdir_p) to be used without argument. As in - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. However this is wrong - # for two reasons: - # 1. if the package is installed by a user who cannot write `.' - # make install will fail, - # 2. the above comment should most certainly read - # $(mkdir_p) $(DESTDIR)$(somedir) - # so it does not work when $(somedir) is undefined and - # $(DESTDIR) is not. - # To support the latter case, we have to write - # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), - # so the `.' trick is pointless. - mkdir_p='mkdir -p --' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } -set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - SET_MAKE= -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE=mngplay - VERSION=$VERSION - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -install_sh=${install_sh-"$am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { (ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; - xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; -esac - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ echo "$as_me:$LINENO: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - - -depcc="$CC" am_compiler_list= - -{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - - -if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_GREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_GREP=$GREP -fi - - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - - $ac_path_EGREP_found && break 3 - done -done - -done -IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - -else - ac_cv_path_EGREP=$EGREP -fi - - - fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - - -# Extract the first word of "sdl-config", so it can be a program name with args. -set dummy sdl-config; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_HAS_SDL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$HAS_SDL"; then - ac_cv_prog_HAS_SDL="$HAS_SDL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_HAS_SDL="yes" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - -fi -fi -HAS_SDL=$ac_cv_prog_HAS_SDL -if test -n "$HAS_SDL"; then - { echo "$as_me:$LINENO: result: $HAS_SDL" >&5 -echo "${ECHO_T}$HAS_SDL" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - -if test "x$HAS_SDL" != "xyes"; then - { { echo "$as_me:$LINENO: error: SDL library not found! - You need this for any display to happen. (rather the point) - You can get a copy at " >&5 -echo "$as_me: error: SDL library not found! - You need this for any display to happen. (rather the point) - You can get a copy at " >&2;} - { (exit 1); exit 1; }; } -fi -CFLAGS="$CFLAGS `sdl-config --cflags`" - -mngplay_LDADD="`sdl-config --libs`" -mngplay_static_LDADD="`sdl-config --static-libs`" - - - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - -{ echo "$as_me:$LINENO: checking for jpeg_set_defaults in -ljpeg" >&5 -echo $ECHO_N "checking for jpeg_set_defaults in -ljpeg... $ECHO_C" >&6; } -if test "${ac_cv_lib_jpeg_jpeg_set_defaults+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ljpeg $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char jpeg_set_defaults (); -int -main () -{ -return jpeg_set_defaults (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_jpeg_jpeg_set_defaults=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_jpeg_jpeg_set_defaults=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_set_defaults" >&5 -echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_set_defaults" >&6; } -if test $ac_cv_lib_jpeg_jpeg_set_defaults = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBJPEG 1 -_ACEOF - - LIBS="-ljpeg $LIBS" - -fi - - -{ echo "$as_me:$LINENO: checking for inflate in -lz" >&5 -echo $ECHO_N "checking for inflate in -lz... $ECHO_C" >&6; } -if test "${ac_cv_lib_z_inflate+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char inflate (); -int -main () -{ -return inflate (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_z_inflate=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_z_inflate=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflate" >&5 -echo "${ECHO_T}$ac_cv_lib_z_inflate" >&6; } -if test $ac_cv_lib_z_inflate = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBZ 1 -_ACEOF - - LIBS="-lz $LIBS" - -fi - - { echo "$as_me:$LINENO: checking for mng_readdisplay in -lmng" >&5 -echo $ECHO_N "checking for mng_readdisplay in -lmng... $ECHO_C" >&6; } -if test "${ac_cv_lib_mng_mng_readdisplay+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmng $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char mng_readdisplay (); -int -main () -{ -return mng_readdisplay (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_mng_mng_readdisplay=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mng_mng_readdisplay=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_mng_mng_readdisplay" >&5 -echo "${ECHO_T}$ac_cv_lib_mng_mng_readdisplay" >&6; } -if test $ac_cv_lib_mng_mng_readdisplay = yes; then - _libmng_present=1 -fi - - if test "${ac_cv_header_libmng_h+set}" = set; then - { echo "$as_me:$LINENO: checking for libmng.h" >&5 -echo $ECHO_N "checking for libmng.h... $ECHO_C" >&6; } -if test "${ac_cv_header_libmng_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_libmng_h" >&5 -echo "${ECHO_T}$ac_cv_header_libmng_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking libmng.h usability" >&5 -echo $ECHO_N "checking libmng.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking libmng.h presence" >&5 -echo $ECHO_N "checking libmng.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: libmng.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: libmng.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: libmng.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: libmng.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: libmng.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: libmng.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: libmng.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: libmng.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: libmng.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: libmng.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: libmng.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for libmng.h" >&5 -echo $ECHO_N "checking for libmng.h... $ECHO_C" >&6; } -if test "${ac_cv_header_libmng_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_libmng_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_libmng_h" >&5 -echo "${ECHO_T}$ac_cv_header_libmng_h" >&6; } - -fi - - - { echo "$as_me:$LINENO: checking for cmsCreateRGBProfile in -llcms" >&5 -echo $ECHO_N "checking for cmsCreateRGBProfile in -llcms... $ECHO_C" >&6; } -if test "${ac_cv_lib_lcms_cmsCreateRGBProfile+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-llcms $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char cmsCreateRGBProfile (); -int -main () -{ -return cmsCreateRGBProfile (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_lcms_cmsCreateRGBProfile=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_lcms_cmsCreateRGBProfile=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_lcms_cmsCreateRGBProfile" >&5 -echo "${ECHO_T}$ac_cv_lib_lcms_cmsCreateRGBProfile" >&6; } -if test $ac_cv_lib_lcms_cmsCreateRGBProfile = yes; then - - if test "${ac_cv_header_lcms_h+set}" = set; then - { echo "$as_me:$LINENO: checking for lcms.h" >&5 -echo $ECHO_N "checking for lcms.h... $ECHO_C" >&6; } -if test "${ac_cv_header_lcms_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_lcms_h" >&5 -echo "${ECHO_T}$ac_cv_header_lcms_h" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking lcms.h usability" >&5 -echo $ECHO_N "checking lcms.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking lcms.h presence" >&5 -echo $ECHO_N "checking lcms.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: lcms.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: lcms.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: lcms.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: lcms.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: lcms.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: lcms.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: lcms.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: lcms.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: lcms.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: lcms.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: lcms.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for lcms.h" >&5 -echo $ECHO_N "checking for lcms.h... $ECHO_C" >&6; } -if test "${ac_cv_header_lcms_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_lcms_h=$ac_header_preproc -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_lcms_h" >&5 -echo "${ECHO_T}$ac_cv_header_lcms_h" >&6; } - -fi - - - { echo "$as_me:$LINENO: checking for mnglcms_initlibrary in -lmng" >&5 -echo $ECHO_N "checking for mnglcms_initlibrary in -lmng... $ECHO_C" >&6; } -if test "${ac_cv_lib_mng_mnglcms_initlibrary+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmng $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char mnglcms_initlibrary (); -int -main () -{ -return mnglcms_initlibrary (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - ac_cv_lib_mng_mnglcms_initlibrary=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_mng_mnglcms_initlibrary=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_mng_mnglcms_initlibrary" >&5 -echo "${ECHO_T}$ac_cv_lib_mng_mnglcms_initlibrary" >&6; } -if test $ac_cv_lib_mng_mnglcms_initlibrary = yes; then - - LIBS="$LIBS -llcms" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBLCMS 1 -_ACEOF - - _libmng_present=1 - -fi - - -fi - - if test $_libmng_present -eq 1; then - LIBS="-lmng $LIBS" - cat >>confdefs.h <<\_ACEOF -#define HAVE_LIBMNG 1 -_ACEOF - - fi - _libmng_present= - - -ac_config_files="$ac_config_files Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&5 -echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." >&2;} - { (exit 1); exit 1; }; } -fi - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 - -# Save the log message, to keep $[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.61. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -# Files that config.status was made for. -config_files="$ac_config_files" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2006 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL - export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "$CONFIG_FILES"; then - -_ACEOF - - - -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -CYGPATH_W!$CYGPATH_W$ac_delim -PACKAGE!$PACKAGE$ac_delim -VERSION!$VERSION$ac_delim -ACLOCAL!$ACLOCAL$ac_delim -AUTOCONF!$AUTOCONF$ac_delim -AUTOMAKE!$AUTOMAKE$ac_delim -AUTOHEADER!$AUTOHEADER$ac_delim -MAKEINFO!$MAKEINFO$ac_delim -install_sh!$install_sh$ac_delim -STRIP!$STRIP$ac_delim -INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim -mkdir_p!$mkdir_p$ac_delim -AWK!$AWK$ac_delim -SET_MAKE!$SET_MAKE$ac_delim -am__leading_dot!$am__leading_dot$ac_delim -AMTAR!$AMTAR$ac_delim -am__tar!$am__tar$ac_delim -am__untar!$am__untar$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -DEPDIR!$DEPDIR$ac_delim -am__include!$am__include$ac_delim -am__quote!$am__quote$ac_delim -AMDEP_TRUE!$AMDEP_TRUE$ac_delim -AMDEP_FALSE!$AMDEP_FALSE$ac_delim -AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim -CCDEPMODE!$CCDEPMODE$ac_delim -am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim -am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim -CPP!$CPP$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -HAS_SDL!$HAS_SDL$ac_delim -mngplay_LDADD!$mngplay_LDADD$ac_delim -mngplay_static_LDADD!$mngplay_static_LDADD$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF - - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 82; then - break - elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi - -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end -_ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof -_ACEOF - - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF -fi # test -n "$CONFIG_FILES" - - -for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - ac_file_inputs="$ac_file_inputs $ac_f" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - fi - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p -' $ac_file_inputs` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac - ;; - - - :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 -echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # So let's grep whole file. - if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir=$dirpart/$fdir - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - - esac -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure.in b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure.in deleted file mode 100644 index 758926411..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/configure.in +++ /dev/null @@ -1,35 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl Version of this release -VERSION=0.1 - -AC_INIT(mngplay.c) -AM_INIT_AUTOMAKE(mngplay, $VERSION) - -dnl AC_CANONICAL_SYSTEM -AC_LANG_C - -dnl Checks for programs. -AC_PROG_CC - -dnl Checks for header files. -AC_HEADER_STDC - -dnl check for Simple Direct Media Layer -AC_CHECK_PROG(HAS_SDL, sdl-config, yes) -if test "x$HAS_SDL" != "xyes"; then - AC_MSG_ERROR([ SDL library not found! - You need this for any display to happen. (rather the point) - You can get a copy at ]) -fi -CFLAGS="$CFLAGS `sdl-config --cflags`" - -mngplay_LDADD="`sdl-config --libs`" -mngplay_static_LDADD="`sdl-config --static-libs`" -AC_SUBST(mngplay_LDADD) -AC_SUBST(mngplay_static_LDADD) - -dnl check for libmng - macro in acinclude.m4 -LIBMNG_CHECK() - -AC_OUTPUT(Makefile) diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/depcomp b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/depcomp deleted file mode 100644 index 04701da53..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/depcomp +++ /dev/null @@ -1,530 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2005-07-09.11 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/install-sh b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/install-sh deleted file mode 100644 index 4d4a9519e..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/missing b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/missing deleted file mode 100644 index 894e786e1..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2005-06-08.21 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/mngplay.c b/Engine/lib/lmng/contrib/gcc/sdl-mngplay/mngplay.c deleted file mode 100644 index b6bc0fa82..000000000 --- a/Engine/lib/lmng/contrib/gcc/sdl-mngplay/mngplay.c +++ /dev/null @@ -1,507 +0,0 @@ -/* - mngplay - - $Date: 2003/12/07 09:45:16 $ - - Ralph Giles - - This program my be redistributed under the terms of the - GNU General Public Licence, version 2, or at your preference, - any later version. - - (this assuming there's no problem with libmng not being GPL...) - - - this is an SDL based mng player. the code is very rough; - patches welcome. - - - GRR 20010708: added SDL/libmng/zlib/libjpeg version info, mouse-click - handling (alternate quit mode); improved automake setup - - Raphael Assenat - 2003/11/26: added command line options to run in alternate color depths. - -*/ - -#include -#include - -#include -#include - -#include // basename - - -#define DEFAULT_SDL_VIDEO_DEPTH 32 - -/* structure for keeping track of our mng stream inside the callbacks */ -typedef struct { - FILE *file; /* pointer to the file we're decoding */ - char *filename; /* pointer to the file's path/name */ - SDL_Surface *surface; /* SDL display */ - mng_uint32 delay; /* ticks to wait before resuming decode */ - int sdl_video_depth; /* The depth for SDL_SetVideoMode */ -} mngstuff; - -/* callbacks for the mng decoder */ - -/* memory allocation; data must be zeroed */ -mng_ptr mymngalloc(mng_uint32 size) -{ - return (mng_ptr)calloc(1, size); -} - -/* memory deallocation */ -void mymngfree(mng_ptr p, mng_uint32 size) -{ - free(p); - return; -} - -mng_bool mymngopenstream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* open the file */ - mymng->file = fopen(mymng->filename, "rb"); - if (mymng->file == NULL) { - fprintf(stderr, "unable to open '%s'\n", mymng->filename); - return MNG_FALSE; - } - - return MNG_TRUE; -} - -mng_bool mymngclosestream(mng_handle mng) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* close the file */ - fclose(mymng->file); - mymng->file = NULL; /* for safety */ - - return MNG_TRUE; -} - -/* feed data to the decoder */ -mng_bool mymngreadstream(mng_handle mng, mng_ptr buffer, - mng_uint32 size, mng_uint32 *bytesread) -{ - mngstuff *mymng; - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* read the requested amount of data from the file */ - *bytesread = fread(buffer, 1, size, mymng->file); - - return MNG_TRUE; -} - -/* the header's been read. set up the display stuff */ -mng_bool mymngprocessheader(mng_handle mng, - mng_uint32 width, mng_uint32 height) -{ - mngstuff *mymng; - SDL_Surface *screen; - char title[256]; - -// fprintf(stderr, "our mng is %dx%d\n", width,height); - - /* retreive our user data */ - mymng = (mngstuff*)mng_get_userdata(mng); - - screen = SDL_SetVideoMode(width,height, mymng->sdl_video_depth, SDL_SWSURFACE); - if (screen == NULL) { - fprintf(stderr, "unable to allocate %dx%d video memory: %s\n", - width, height, SDL_GetError()); - return MNG_FALSE; - } - - printf("SDL Video Mode: %dx%d bpp=%d\n", width, height, mymng->sdl_video_depth); - - /* save the surface pointer */ - mymng->surface = screen; - - /* set a descriptive window title */ - snprintf(title, 256, "mngplay: %s", mymng->filename); - SDL_WM_SetCaption(title, "mngplay"); - - /* in necessary, lock the drawing surface to the decoder - can safely fill it. We'll unlock elsewhere before display */ - if (SDL_MUSTLOCK(mymng->surface)) { - if ( SDL_LockSurface(mymng->surface) < 0 ) { - fprintf(stderr, "could not lock display surface\n"); - exit(1); - } - } - -/* - printf("RGBA Masks: %08X %08X %08X %08X\n", - mymng->surface->format->Rmask, - mymng->surface->format->Gmask, - mymng->surface->format->Bmask, - mymng->surface->format->Amask); - printf("RGBA Shifts: %08X %08X %08X %08X\n", - mymng->surface->format->Rshift, - mymng->surface->format->Gshift, - mymng->surface->format->Bshift, - mymng->surface->format->Ashift); -*/ - /* Choose a canvas style which matches the SDL_Surface pixel format */ - switch(mymng->surface->format->BitsPerPixel) - { - case 32: - if (mymng->surface->format->Amask==0) { - /* No alpha (padding byte) */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRX8); - } else { - /* Red first */ - fprintf(stderr, "No matching mng canvas for sdl pixel format. Colors may be wrong.\n"); - mng_set_canvasstyle(mng, MNG_CANVAS_BGRX8); - } - } - else { - /* Real alpha */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRA8); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - } - } - break; - case 24: - if (mymng->surface->format->Amask==0) { - /* No alpha here should mean true rgb24bit */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGR8); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - } - } - else { - /* If there is an alpha and we are in 24 bpp, this must - * mean rgb5658 */ - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGRA565); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA565); - } - } - break; - case 16: - if (mymng->surface->format->Bshift==0) { - /* Blue first */ - mng_set_canvasstyle(mng, MNG_CANVAS_BGR565); - } else { - /* Red first */ - mng_set_canvasstyle(mng, MNG_CANVAS_RGB565); - } - break; - default: - return MNG_FALSE; - } - - return MNG_TRUE; -} - -/* return a row pointer for the decoder to fill */ -mng_ptr mymnggetcanvasline(mng_handle mng, mng_uint32 line) -{ - mngstuff *mymng; - SDL_Surface *surface; - mng_ptr row; - - /* dereference our structure */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* we assume any necessary locking has happened - outside, in the frame level code */ - row = mymng->surface->pixels + mymng->surface->pitch*line; - -// fprintf(stderr, " returning pointer to line %d (%p)\n", line, row); - - return (row); -} - -/* timer */ -mng_uint32 mymnggetticks(mng_handle mng) -{ - mng_uint32 ticks; - - ticks = (mng_uint32)SDL_GetTicks(); -// fprintf(stderr, " %d\t(returning tick count)\n",ticks); - - return(ticks); -} - -mng_bool mymngrefresh(mng_handle mng, mng_uint32 x, mng_uint32 y, - mng_uint32 w, mng_uint32 h) -{ - mngstuff *mymng; - SDL_Rect frame; - - frame.x = x; - frame.y = y; - frame.w = w; - frame.h = h; - - /* dereference our structure */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* if necessary, unlock the display */ - if (SDL_MUSTLOCK(mymng->surface)) { - SDL_UnlockSurface(mymng->surface); - } - - /* refresh the screen with the new frame */ - SDL_UpdateRects(mymng->surface, 1, &frame); - - /* in necessary, relock the drawing surface */ - if (SDL_MUSTLOCK(mymng->surface)) { - if ( SDL_LockSurface(mymng->surface) < 0 ) { - fprintf(stderr, "could not lock display surface\n"); - return MNG_FALSE; - } - } - - - return MNG_TRUE; -} - -/* interframe delay callback */ -mng_bool mymngsettimer(mng_handle mng, mng_uint32 msecs) -{ - mngstuff *mymng; - -// fprintf(stderr," pausing for %d ms\n", msecs); - - /* look up our stream struct */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* set the timer for when the decoder wants to be woken */ - mymng->delay = msecs; - - return MNG_TRUE; - -} - -mng_bool mymngerror(mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - mngstuff *mymng; - char chunk[5]; - - /* dereference our data so we can get the filename */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* pull out the chuck type as a string */ - // FIXME: does this assume unsigned char? - chunk[0] = (char)((chunktype >> 24) & 0xFF); - chunk[1] = (char)((chunktype >> 16) & 0xFF); - chunk[2] = (char)((chunktype >> 8) & 0xFF); - chunk[3] = (char)((chunktype ) & 0xFF); - chunk[4] = '\0'; - - /* output the error */ - fprintf(stderr, "error playing '%s' chunk %s (%d):\n", - mymng->filename, chunk, chunkseq); - fprintf(stderr, "%s\n", text); - - return (0); -} - -int mymngquit(mng_handle mng) -{ - mngstuff *mymng; - - /* dereference our data so we can free it */ - mymng = (mngstuff*)mng_get_userdata(mng); - - /* cleanup. this will call mymngclosestream */ - mng_cleanup(&mng); - - /* free our data */ - free(mymng); - - /* quit */ - exit(0); -} - -int checkevents(mng_handle mng) -{ - SDL_Event event; - - /* check if there's an event pending */ - if (!SDL_PollEvent(&event)) { - return 0; /* no events pending */ - } - - /* we have an event; process it */ - switch (event.type) { - case SDL_QUIT: - mymngquit(mng); /* quit */ - break; - case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: - mymngquit(mng); - break; - case SDL_KEYUP: - switch (event.key.keysym.sym) { - case SDLK_ESCAPE: - case SDLK_q: - mymngquit(mng); - break; - } - /* FALL THROUGH */ - default: - return 1; - } - - return 0; /* GRR ADDED: non-void function */ -} - -int main(int argc, char *argv[]) -{ - mngstuff *mymng; - mng_handle mng; - SDL_Rect updaterect; - - if (argc < 2) { - const SDL_version *pSDLver = SDL_Linked_Version(); - - fprintf(stderr, "Usage: %s mngfile [depth]\n\n", basename(argv[0])); - fprintf(stderr, " where 'depth' is 15,16,24 or 32\n"); - fprintf(stderr, - " Compiled with SDL %d.%d.%d; using SDL %d.%d.%d.\n", - SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL, - pSDLver->major, pSDLver->minor, pSDLver->patch); - fprintf(stderr, " Compiled with libmng %s; using libmng %s.\n", - MNG_VERSION_TEXT, mng_version_text()); - fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n", - ZLIB_VERSION, zlib_version); -#ifdef JPEG_LIB_VERSION - { - int major = JPEG_LIB_VERSION / 10; - int minor = JPEG_LIB_VERSION % 10; - char minoralpha[2]; - - if (minor) { - minoralpha[0] = (char)(minor - 1 + 'a'); - minoralpha[1] = '\0'; - } else - minoralpha[0] = '\0'; - fprintf(stderr, " Compiled with libjpeg %d%s.\n", - major, minoralpha); - } -#endif - fprintf(stderr, - "\nPress Esc or Q, or click mouse button, to quit.\n"); - exit(1); - } - - /* allocate our stream data structure */ - mymng = (mngstuff*)calloc(1, sizeof(*mymng)); - if (mymng == NULL) { - fprintf(stderr, "could not allocate stream structure.\n"); - exit(0); - } - - /* pass the name of the file we want to play */ - mymng->filename = argv[1]; - - /* pass the color depth we wish to use */ - if (argc>=3) { - mymng->sdl_video_depth = atoi(argv[2]); - switch(mymng->sdl_video_depth) { - case 15: - case 16: - case 24: - case 32: - break; - default: - fprintf(stderr, "Unsupported color depth. Choices are: 15, 16, 24 and 32\n"); - exit(1); - } - } - else { - mymng->sdl_video_depth = DEFAULT_SDL_VIDEO_DEPTH; - } - - /* set up the mng decoder for our stream */ - mng = mng_initialize(mymng, mymngalloc, mymngfree, MNG_NULL); - if (mng == MNG_NULL) { - fprintf(stderr, "could not initialize libmng.\n"); - exit(1); - } - - /* set the callbacks */ - mng_setcb_errorproc(mng, mymngerror); - mng_setcb_openstream(mng, mymngopenstream); - mng_setcb_closestream(mng, mymngclosestream); - mng_setcb_readdata(mng, mymngreadstream); - mng_setcb_gettickcount(mng, mymnggetticks); - mng_setcb_settimer(mng, mymngsettimer); - mng_setcb_processheader(mng, mymngprocessheader); - mng_setcb_getcanvasline(mng, mymnggetcanvasline); - mng_setcb_refresh(mng, mymngrefresh); - /* FIXME: should check for errors here */ - - /* initialize SDL */ - if (SDL_Init(SDL_INIT_VIDEO) < 0) { - fprintf(stderr, "%s: Unable to initialize SDL (%s)\n", - argv[0], SDL_GetError()); - exit(1); - } - /* arrange to call the shutdown routine before we exit */ - atexit(SDL_Quit); - - /* restrict event handling to the relevant bits */ - SDL_EventState(SDL_KEYDOWN, SDL_IGNORE); /* keyup only */ - SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE); -// SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE); -// SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE); - -// fprintf(stderr, "playing mng...maybe.\n"); - - mng_readdisplay(mng); - - /* loop though the frames */ - while (mymng->delay) { -// fprintf(stderr, " waiting for %d ms\n", mymng->delay); - SDL_Delay(mymng->delay); - - /* reset the delay in case the decoder - doesn't update it again */ - mymng->delay = 0; - - mng_display_resume(mng); - - /* check for user input (just quit at this point) */ - checkevents(mng); - } - - /* ¿hay alguno? pause before quitting */ - fprintf(stderr, "pausing before shutdown...\n"); - SDL_Delay(1000); - - /* cleanup and quit */ - mymngquit(mng); -} - diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/Makefile b/Engine/lib/lmng/contrib/gcc/xmngview/Makefile deleted file mode 100644 index 4b38662f7..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PROC=athlon -CFLAGS=-g -Wall -O2 -march=$(PROC) -mcpu=$(PROC) -MOTIFLIB=/usr/local/lesstif/lib -MOTIFINC=/usr/local/lesstif/include -MNGLIB=-lmng -LIBS=-L/usr/X11R6/lib -L$(MOTIFLIB) -lXm -lXt -lX11 $(MNGLIB) -lm -INC=-I/usr/X11R6/include -I$(MOTIFINC) -CC=gcc -LDFLAGS= - -all: clean compile - -compile: - $(CC) $(CFLAGS) $(INC) color.c xmngview.c -o xmngview $(LIBS) - -clean: - rm -f xmngview core - -install: - cp -a xmngview /usr/local/bin/xmngview diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/README b/Engine/lib/lmng/contrib/gcc/xmngview/README deleted file mode 100644 index 576228efa..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/README +++ /dev/null @@ -1,23 +0,0 @@ -Program: -======== - -'xmngview' displays MNG/JNG/PNG files. The program can be called - - xmngview - xmngview filename - -This program is used within a plugin library for a browser: - xmngview -wWINDOWID -bgBGPIXEL filename - -Limitations: -============ - needs Lesstif/Motif, i.e. '-lXm -lXt -lX11'. - depth >= 8 (tested with 8bpp, 16bpp, 24bpp) - perhaps INTEL only - perhaps LINUX only - -libmng: -======= - read the first lines of xmngview.c - -szukw000, March 2003 diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/color.c b/Engine/lib/lmng/contrib/gcc/xmngview/color.c deleted file mode 100644 index 2e75a1c92..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/color.c +++ /dev/null @@ -1,645 +0,0 @@ -/* - * This code is mainly code I have found in - * ida-0.14 Gerd Knorr - * http://bytesex.org/ida - * Ida is a small and fast image viewer, motif-based. - * - * Copyright (C) 2002 Gerd Knorr - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * -*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "xmng.h" - -static void (*dither_line)(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width); -static void dither_line_gray(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width); -static void dither_line_color(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width); -static void init_dither(int shades_r, int shades_g, int shades_b, - int shades_gray); - -static XVisualInfo *vis_info; - -/* PseudoColor: ditherresult => colormap-entry -*/ -static int x11_colors; -static int x11_grays; -static unsigned long *x11_map; -static unsigned long x11_map_color[256]; -static unsigned long x11_map_gray[64]; - -static unsigned long x11_red; -static unsigned long x11_green; -static unsigned long x11_blue; - -static int try_red[] = {4, 6, 6, 5, 4}; -static int try_green[] = {8, 6, 6, 5, 4}; -static int try_blue[] = {4, 6, 4, 5, 4}; - -/* TrueColor: r,g,b => X11-color -*/ -static unsigned long x11_lut_red[256]; -static unsigned long x11_lut_green[256]; -static unsigned long x11_lut_blue[256]; -static unsigned long x11_lut_gray[256]; - -#define x11_black x11_map_gray[0] -#define x11_gray x11_map_gray[47*x11_grays/64] -#define x11_lightgray x11_map_gray[55*x11_grays/64] -#define x11_white x11_map_gray[63*x11_grays/64] - -static int x11_alloc_grays(Display * dpy, Colormap cmap, unsigned long *colors, - int gray) -{ - XColor akt_color; - int i, upb; - upb = gray - 1; - - for (i = 0; i < gray; i++) - { -/* FIXME: original code - akt_color.red = i * 65535 / upb; - akt_color.green = i * 65535 / upb; - akt_color.blue = i * 65535 / upb; -*/ - akt_color.red = i * 255 / upb; - akt_color.green = i * 255 / upb; - akt_color.blue = i * 255 / upb; - - if (!XAllocColor(dpy, cmap, &akt_color)) - { -/* no free color cell available -*/ - XFreeColors(dpy, cmap, colors, i, 0); - return 1; - } - colors[i] = akt_color.pixel; - } - return 0; -} - -static int x11_alloc_colorcube(Display * dpy, Colormap cmap, - unsigned long *colors, int red, int green, int blue) -{ - XColor akt_color; - int i, upb_r, upb_g, upb_b; - - upb_r = red - 1; upb_g = green - 1; upb_b = blue - 1; - - for (i = 0; i < red * green * blue; i++) - { - akt_color.red = ((i / (green * blue)) % red) * 65535 / upb_r; - akt_color.green = ((i / blue) % green) * 65535 / upb_g; - akt_color.blue = (i % blue) * 65535 / upb_b; - - if (!XAllocColor(dpy, cmap, &akt_color)) - { -/* no free color cell available -*/ - XFreeColors(dpy, cmap, colors, i, 0); - return 1; - } - colors[i] = akt_color.pixel; - } - return 0; -} - -static unsigned long x11_alloc_color(Display * dpy, Colormap cmap, int red, - int green, int blue) -{ - XColor akt_color; - - akt_color.red = red; - akt_color.green = green; - akt_color.blue = blue; - - XAllocColor(dpy, cmap, &akt_color); - return akt_color.pixel; -} - -static void x11_create_lut(unsigned long red_mask, - unsigned long green_mask, - unsigned long blue_mask) -{ - int rgb_red_bits = 0; - int rgb_red_shift = 0; - int rgb_green_bits = 0; - int rgb_green_shift = 0; - int rgb_blue_bits = 0; - int rgb_blue_shift = 0; - int i; - unsigned long mask; - - for (i = 0; i < 24; i++) - { - mask = (1 << i); - if (red_mask & mask) - rgb_red_bits++; - else - if (!rgb_red_bits) - rgb_red_shift++; - if (green_mask & mask) - rgb_green_bits++; - else - if (!rgb_green_bits) - rgb_green_shift++; - - if (blue_mask & mask) - rgb_blue_bits++; - else - if (!rgb_blue_bits) - rgb_blue_shift++; - } - - for (i = 0; i < 256; i++) - { - x11_lut_red[i] = (i >> (8 - rgb_red_bits)) << rgb_red_shift; - x11_lut_green[i] = (i >> (8 - rgb_green_bits)) << rgb_green_shift; - x11_lut_blue[i] = (i >> (8 - rgb_blue_bits)) << rgb_blue_shift; - x11_lut_gray[i] = - x11_lut_red[i] | x11_lut_green[i] | x11_lut_blue[i]; - } -} - -void x11_init_color(ImageInfo *img) -{ - Colormap cmap; - XVisualInfo vis_template; - int found, vis_class; - unsigned int i; - Display *dpy; - - dpy = img->dpy; - cmap = DefaultColormap(dpy, DefaultScreen(dpy)); - if (0 == x11_grays) - x11_grays = 8; - -/* Ask for visual type -*/ - vis_template.screen = XDefaultScreen(dpy); - vis_template.visualid = - XVisualIDFromVisual(img->visual); - vis_info = - XGetVisualInfo(dpy, VisualIDMask | VisualScreenMask, &vis_template, - &found); - if (XShmQueryExtension(dpy)) - img->have_shmem = 1; - -#if defined(__cplusplus) || defined(c_plusplus) - vis_class = vis_info->c_class; -#else - vis_class = vis_info->class; -#endif - if(vis_class == TrueColor) - { - img->gray = 0; /* XXX testing... */ - img->display_depth = 4; - img->display_type = TRUECOLOR; - - x11_create_lut(vis_info->red_mask, vis_info->green_mask, - vis_info->blue_mask); - x11_black = x11_alloc_color(dpy, cmap, 0, 0, 0); - x11_gray = x11_alloc_color(dpy, cmap, 0xc000, 0xc000, 0xc000); - x11_lightgray = x11_alloc_color(dpy, cmap, 0xe000, 0xe000, 0xe000); - x11_white = x11_alloc_color(dpy, cmap, 0xffff, 0xffff, 0xffff); - } - else - if(vis_class == PseudoColor && vis_info->depth == 8) - { - img->display_depth = 1; - img->display_type = PSEUDOCOLOR; - if (0 != x11_alloc_grays(dpy, cmap, x11_map_gray, x11_grays)) - { - fprintf(stderr, "%s:%d:Sorry, can't allocate %d grays\n", - __FILE__,__LINE__,x11_grays); - Viewer_postlude(); - exit(1); - } - if (!img->gray) - { - for (i = 0; i < sizeof(try_red) / sizeof(int); i++) - { - if (0 == x11_alloc_colorcube - (dpy, cmap, x11_map_color, - try_red[i], try_green[i], try_blue[i])) - { - x11_colors = try_red[i] * try_green[i] * try_blue[i]; - - init_dither(try_red[i], try_green[i], try_blue[i], x11_grays); - - break; - } - } - if (i == sizeof(try_red) / sizeof(int)) - { - img->gray = 1; - fputs("failed to allocate colors, using grayscaled\n", stderr); - } - } - if (img->gray) - init_dither(2, 2, 2, x11_grays); - } - else - if(vis_class == StaticGray || vis_class == GrayScale) - { - img->display_depth = 1; - img->display_type = PSEUDOCOLOR; - x11_grays = 64; - img->gray = 1; - - init_dither(2, 2, 2, x11_grays); - - if (0 != x11_alloc_grays(dpy, cmap, x11_map_gray, x11_grays)) - { - fprintf(stderr, "%s:%d: Sorry, can't allocate %d grays\n", - __FILE__,__LINE__, x11_grays); - Viewer_postlude(); - exit(1); - } - } - else - { - fprintf(stderr, "%s:%d: Sorry, can't handle visual\n", __FILE__,__LINE__); - Viewer_postlude(); - exit(1); - } -/* some common colors -*/ - x11_red = x11_alloc_color(dpy, cmap, 65535, 0, 0); - x11_green = x11_alloc_color(dpy, cmap, 0, 65535, 0); - x11_blue = x11_alloc_color(dpy, cmap, 0, 0, 65535); - - if (img->gray) - { - x11_map = x11_map_gray; - - dither_line = dither_line_gray; - } - else - { - x11_map = x11_map_color; - - dither_line = dither_line_color; - } -} - -static int mitshm_bang = 0; - -static int x11_error_dev_null(Display * dpy, XErrorEvent * event) -{ - mitshm_bang = 1; - return 0; -} - -XImage *x11_create_ximage(ImageInfo *img) -{ - XImage *ximage = NULL; - unsigned char *data; - XShmSegmentInfo *shminfo = NULL; - int (*old_handler)(Display * dpy, XErrorEvent * event); - - if (img->have_shmem) - { - old_handler = XSetErrorHandler(x11_error_dev_null); - img->shm = shminfo = (XShmSegmentInfo*)malloc(sizeof(XShmSegmentInfo)); - memset(shminfo, 0, sizeof(XShmSegmentInfo)); - ximage = XShmCreateImage(img->dpy, - img->visual, - img->depth, - ZPixmap, NULL, - shminfo, img->img_width, img->img_height); - if (ximage) - { - shminfo->shmid = shmget(IPC_PRIVATE, - ximage->bytes_per_line * ximage->height, - IPC_CREAT | 0777); - - if (-1 == shminfo->shmid) - { - fprintf(stderr,"shmget(%dMB): %s\n", - ximage->bytes_per_line * ximage->height / 1024 / 1024, - strerror(errno)); - goto oom; - } - shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); - - if ((void *) -1 == shminfo->shmaddr) - { - perror("shmat"); - goto oom; - } - ximage->data = shminfo->shmaddr; - shminfo->readOnly = False; - - XShmAttach(img->dpy, shminfo); - XSync(img->dpy, False); - shmctl(shminfo->shmid, IPC_RMID, 0); - - if (mitshm_bang) - { - img->have_shmem = 0; - shmdt(shminfo->shmaddr); - free(shminfo); - img->shm = shminfo = NULL; - XDestroyImage(ximage); - ximage = NULL; - } - } - else - { - img->have_shmem = 0; - free(shminfo); - img->shm = shminfo = NULL; - } - XSetErrorHandler(old_handler); - } - - if (ximage == NULL) - { - img->shm = NULL; - if (NULL == (data = (unsigned char*) - malloc(img->img_width * img->img_height * img->display_depth))) - { - fprintf(stderr,"Oops: out of memory\n"); - goto oom; - } - ximage = XCreateImage(img->dpy, - img->visual, - img->depth, - ZPixmap, 0, (char*)data, - img->img_width, img->img_height, - 8, 0); - } - memset(ximage->data, 0, ximage->bytes_per_line * ximage->height); - - return ximage; - - oom: - if (shminfo) - { - if (shminfo->shmid && shminfo->shmid != -1) - shmctl(shminfo->shmid, IPC_RMID, 0); - free(shminfo); - } - if (ximage) - XDestroyImage(ximage); - img->shm = 0; - return NULL; -} - -void x11_destroy_ximage(ImageInfo *img) -{ - XShmSegmentInfo *shminfo = (XShmSegmentInfo*)img->shm; - - if (shminfo) - { - XShmDetach(img->dpy, shminfo); - XDestroyImage(img->ximage); - shmdt(shminfo->shmaddr); - free(shminfo); - } - else - XDestroyImage(img->ximage); -} -/* - * ordered dither routines - * - * stolen from The GIMP and trimmed for speed - */ -#define DITHER_LEVEL 8 - -static long red_mult, green_mult; -static long red_dither[256]; -static long green_dither[256]; -static long blue_dither[256]; -static long gray_dither[256]; - -typedef unsigned long vector[DITHER_LEVEL]; -typedef vector matrix[DITHER_LEVEL]; - -#if DITHER_LEVEL == 8 -#define DITHER_MASK 7 -static matrix origDM = -{ - {0, 32, 8, 40, 2, 34, 10, 42}, - {48, 16, 56, 24, 50, 18, 58, 26}, - {12, 44, 4, 36, 14, 46, 6, 38}, - {60, 28, 52, 20, 62, 30, 54, 22}, - {3, 35, 11, 43, 1, 33, 9, 41}, - {51, 19, 59, 27, 49, 17, 57, 25}, - {15, 47, 7, 39, 13, 45, 5, 37}, - {63, 31, 55, 23, 61, 29, 53, 21} -}; -static matrix DM; - -#endif /* DITHER_LEVEL == 8 */ - -#if DITHER_LEVEL == 4 -#define DITHER_MASK 3 -static matrix origDM = -{ - {0, 8, 2, 10}, - {12, 4, 14, 6}, - {3, 11, 1, 9}, - {15, 7, 13, 5} -}; -static matrix DM; - -#endif - -static void init_dither(int shades_r, int shades_g, int shades_b, - int shades_gray) -{ - int i, j; - unsigned char low_shade, high_shade; - unsigned short index; - float red_colors_per_shade; - float green_colors_per_shade; - float blue_colors_per_shade; - float gray_colors_per_shade; - - red_mult = shades_g * shades_b; - green_mult = shades_b; - - red_colors_per_shade = 256.0 / (shades_r - 1); - green_colors_per_shade = 256.0 / (shades_g - 1); - blue_colors_per_shade = 256.0 / (shades_b - 1); - gray_colors_per_shade = 256.0 / (shades_gray - 1); - -/* this avoids a shift when checking these values -*/ - memcpy(DM, origDM, sizeof(unsigned long)*DITHER_LEVEL*DITHER_LEVEL); - for (i = 0; i < DITHER_LEVEL; i++) - for (j = 0; j < DITHER_LEVEL; j++) - DM[i][j] *= 0x10000; - -/* setup arrays containing three bytes of information for red, green, & blue - * the arrays contain : - * 1st byte: low end shade value - * 2nd byte: high end shade value - * 3rd & 4th bytes: ordered dither matrix index -*/ - - for (i = 0; i < 256; i++) - { -/* setup the red information -*/ - low_shade = (unsigned char) (i / red_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * red_colors_per_shade) / red_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - low_shade *= red_mult; - high_shade *= red_mult; - - red_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - -/* setup the green information -*/ - low_shade = (unsigned char) (i / green_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * green_colors_per_shade) / green_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - low_shade *= green_mult; - high_shade *= green_mult; - - green_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - -/* setup the blue information -*/ - low_shade = (unsigned char) (i / blue_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * blue_colors_per_shade) / blue_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - blue_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - -/* setup the gray information -*/ - low_shade = (unsigned char) (i / gray_colors_per_shade); - high_shade = low_shade + 1; - - index = (unsigned short) - (((i - low_shade * gray_colors_per_shade) / gray_colors_per_shade) * - (DITHER_LEVEL * DITHER_LEVEL + 1)); - - gray_dither[i] = (index << 16) + (high_shade << 8) + (low_shade); - } -} - -static void dither_line_color(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width) -{ - unsigned long a, b, dval, *ymod; - unsigned int x; - ymod = DM[y & DITHER_MASK]; - - for(x = 0; x < width; x++) - { - dval = ymod[x & DITHER_MASK]; - - b = red_dither[src[0]]; - if (dval < b) - b >>= 8; - - a = green_dither[src[1]]; - if (dval < a) - a >>= 8; - b += a; - - a = blue_dither[src[2]]; - if (dval < a) - a >>= 8; - b += a; - src += RGB_SIZE; - *dest++ = (unsigned char)(b & 0xff); - } -} - -static void dither_line_gray(unsigned char *src, unsigned char *dest, - unsigned int y, unsigned int width) -{ - unsigned long a, g, *ymod; - unsigned int x; - - ymod = DM[y & DITHER_MASK]; - - for(x = 0; x < width; x++) - { - g = (src[0]*3 + src[1]*6 + src[2]) / 10; - a = gray_dither[g]; - src += RGB_SIZE; - - if (ymod[x & DITHER_MASK] < a) - a >>= 8; - - *dest++ = a & 0xff; - } -} - -void viewer_renderline(ImageInfo *img, unsigned char *scanline, - unsigned int row, unsigned int x, unsigned int width) -{ - unsigned char *src, *dst; - unsigned long pix; - XImage *ximage; - unsigned int col, max_col; - unsigned short mng_rgb_size; - - mng_rgb_size = img->mng_rgb_size; - ximage = img->ximage; - src = scanline; - col = x; - max_col = x + width; - - if (img->display_type == PSEUDOCOLOR) - { - dst = img->dither_line; - dither_line(src, dst, row, width); - - while(col < max_col) - { - XPutPixel(ximage, col, row, x11_map[dst[0]]); - ++col; - ++dst; - } - return; - } -/* display_type == TRUECOLOR -*/ - while(col < max_col) - { - pix = x11_lut_red[src[0]] | x11_lut_green[src[1]] | x11_lut_blue[src[2]]; - - XPutPixel(ximage, col, row, pix); - - ++col; - src += RGB_SIZE; - } -} diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/xmng.h b/Engine/lib/lmng/contrib/gcc/xmngview/xmng.h deleted file mode 100644 index 3012b4e9f..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/xmng.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef _XMNG_H_ -#define _XMNG_H -#define RGB_SIZE 3 -#define CANVAS_RGB8_SIZE 3 -#define CANVAS_RGBA8_SIZE 4 -#define CANVAS_ARGB8_SIZE 4 -#define CANVAS_RGB8_A8_SIZE 4 -#define CANVAS_BGR8_SIZE 3 -#define CANVAS_BGRA8_SIZE 4 -#define CANVAS_BGRA8PM_SIZE 4 -#define CANVAS_ABGR8_SIZE 4 - -#define MNG_MAGIC "\x8aMNG\x0d\x0a\x1a\x0a" -#define JNG_MAGIC "\x8bJNG\x0d\x0a\x1a\x0a" -#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a" -#define PSEUDOCOLOR 1 -#define TRUECOLOR 2 - -#define MNG_TYPE 1 -#define JNG_TYPE 2 -#define PNG_TYPE 3 - -#define SPACE_X 10 -#define SPACE_Y 10 -#define BUT_ENTRY_BORDER 0 -#define FRAME_SHADOW_WIDTH 2 -#define ANY_WIDTH 4 - -#define OK MNG_NOERROR -#define MAX_COLORBUF 64 - -typedef struct -{ - unsigned int frozen:1; - unsigned int restarted:1; - unsigned int stopped:1; - unsigned int single_step_wanted:1; - unsigned int single_step_served:1; - unsigned int has_bg_color:1; - unsigned int has_bg_pixel:1; - unsigned int x11_init:1; - unsigned int timer_active:1; - - mng_handle user_handle; - Widget canvas; - int type; - XtIntervalId timeout_ID; - mng_uint32 counter; - mng_uint32 delay; - mng_uint32 img_width, img_height; - mng_uint32 read_len; - mng_uint32 read_pos; - unsigned char *read_buf; - unsigned char *mng_buf; - unsigned char *dither_line; - - Window external_win; - Window frame_win; - Window control_win; - GC gc; - Display *dpy; - Window win; - unsigned short mng_rgb_size; - unsigned short mng_bytes_per_line; - XImage *ximage; - int src_x, src_y; - int dst_x, dst_y; - unsigned int frame_w, frame_h; - - void *shm; - int gray; - int display_depth, display_type; - int have_shmem; - Pixel bg_pixel; - unsigned short xbg_red, xbg_green, xbg_blue; - unsigned char bg_red, bg_green, bg_blue; - Visual *visual; - unsigned int depth; -/* do not free */ - struct timeval timer_start; - struct timeval timer_end; - - char *read_idf; - FILE *reader; - int *argc_ptr; - char **argv; - char bg_color[MAX_COLORBUF]; -} ImageInfo; - -#define XPUTIMAGE(dpy,dr,gc,xi,a,b,c,d,w,h) \ - if (have_shmem) \ - XShmPutImage(dpy,dr,gc,xi,a,b,c,d,w,h,True); \ - else \ - XPutImage(dpy,dr,gc,xi,a,b,c,d,w,h) - -extern void Viewer_postlude(void); -extern XImage *x11_create_ximage(ImageInfo *data); -extern void x11_destroy_ximage(ImageInfo *data); -extern void x11_init_color(ImageInfo *data); -extern void viewer_renderline(ImageInfo *data, unsigned char *scanline, - unsigned int row, unsigned int x, unsigned int width); - -#endif diff --git a/Engine/lib/lmng/contrib/gcc/xmngview/xmngview.c b/Engine/lib/lmng/contrib/gcc/xmngview/xmngview.c deleted file mode 100644 index 3198c7b95..000000000 --- a/Engine/lib/lmng/contrib/gcc/xmngview/xmngview.c +++ /dev/null @@ -1,1185 +0,0 @@ -/* Built with libmng-1.0.9 - * Compiled on linux with gcc-3.3.4 - * james@blastwave.org suggested the single step mode and wrote: - * "xmngview works on Solaris both Sparc and Intel and compiles with Sun's cc" - * - * - * This program my be redistributed under the terms of the - * GNU General Public Licence, version 2, or at your preference, - * any later version. - * - * For more information about libmng please visit: - * - * The official libmng web-site: - * http://www.libmng.com - * - * Libmng on SourceForge: - * http://libmng.sourceforge.net - * - * The official MNG homepage: - * http://www.libpng.org/pub/mng - * - * The official PNG homepage: - * http://www.libpng.org/pub/png -*/ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "xmng.h" - -#define DEFAULT_BACKGROUND "grey77" -static char version[]={"0.6"}; - -static void run_viewer(FILE *reader, char *read_idf); - -static mng_handle user_handle; -static ImageInfo img; -static struct timeval start_tv, now_tv; -static XtIntervalId timeout_ID; -static char *prg_idf; - -static XtAppContext app_context; -static Widget toplevel, main_form, canvas, file_label; -static XmFontList file_font; -static Dimension start_width; - -#define SLASH '/' -/* - * Cnf: XQueryColor(3X11) -*/ -static char *parse_rgb_color(char *val) -{ - char *s, *d; - int ch; - char status, rgb_type; - char r[6], g[6], b[6], rgb[24]; - - rgb_type = 0; - status = 1; - s = val; - memset(r, 0, 6); - memset(g, 0, 6); - memset(b, 0, 6); - - if(strncasecmp(s, "rgb:", 4) == 0) - { - rgb_type = 1; - s += 4; - if((d = strchr(s, SLASH))) - { - *d = 0; - - if(d - s > 4) - s[4] = 0; - strcpy(r, s); - - s = ++d; - - if((d = strchr(s, SLASH))) - { - *d = 0; - if(d - s > 4) - s[4] = 0; - strcpy(g, s); - - s = d + 1; - while((ch = *++d) && isxdigit(ch)); - *d = 0; - if(d - s > 4) - s[4] = 0; - strcpy(b, s); - - } - if(*r == 0 || *g == 0 || *b == 0) - return NULL; - - s = r - 1; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = rgb_type = 0; - break; - } - s = g - 1; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = rgb_type = 0; - break; - } - s = b - 1; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = rgb_type = 0; - break; - } - if(status) - { - strcpy(rgb, "rgb:"); - d = rgb + 4; - s = r; - while(*s) *d++ = *s++; - *d++ = SLASH; - s = g; - while(*s) *d++ = *s++; - *d++ = SLASH; - s = b; - while(*s) *d++ = *s++; - *d = 0; - - return strdup(rgb); - } - } /* if((slash = strchr(s, SLASH))) */ - return NULL; - } - - s = val; - if(*s == '#' || isdigit(*s)) - { - if(*s != '#') - --s; - while((ch = *++s)) - { - if(isxdigit(ch)) continue; - status = 0; - break; - } - if(status) - { - d = rgb; - s = val; - if(*s == '#') - ++s; -/* - * #RGB (4 bits each) - * #RRGGBB (8 bits each) - * #RRRGGGBBB (12 bits each) - * #RRRRGGGGBBBB (16 bits each) -*/ - if(strlen(s) > 12) - s[12] = 0; - *d++ = '#'; - strcpy(d, s); - return strdup(rgb); - } - return NULL; - } - -/* - * 'white', 'LavenderBlush', 'dark slate gray', 'grey12' -*/ - s = val - 1; - while((ch = *++s)) - { - if(isalnum(ch) || isspace(ch)) continue; - status = 0; - break; - } - if(!status) - return NULL; - return strdup(val); - -}/* parse_rgb_color() */ - -static void set_bg_pixel(ImageInfo *img) -{ - XColor xcolor; - Widget w; - char *s, *d; - int found; - - w = img->canvas; - - if(!img->has_bg_pixel) - { - if(img->has_bg_color) - { - s = strdup(img->bg_color); - - d = parse_rgb_color(s); - - free(s); - - if(d) - { - strcpy(img->bg_color, d); - free(d); - } - else - img->has_bg_color = 0; - } - if(!img->has_bg_color) - { - strcpy(img->bg_color, DEFAULT_BACKGROUND); - img->has_bg_color = 1; - } - - found = XParseColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - img->bg_color, &xcolor); - - if(!found) - { - strcpy(img->bg_color, DEFAULT_BACKGROUND); - - found = XParseColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - img->bg_color, &xcolor); - - } - xcolor.flags = DoRed | DoGreen | DoBlue; - - XAllocColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - &xcolor); - } - else - { - xcolor.pixel = img->bg_pixel; - xcolor.flags = DoRed|DoGreen|DoBlue; - - found = XQueryColor(img->dpy, - DefaultColormap(img->dpy, DefaultScreen(img->dpy)), - &xcolor); - } - img->bg_pixel = xcolor.pixel; - img->xbg_red = xcolor.red; - img->xbg_green = xcolor.green; - img->xbg_blue = xcolor.blue; - img->bg_red = (unsigned char)xcolor.red&0xff; - img->bg_green = (unsigned char)xcolor.green&0xff; - img->bg_blue = (unsigned char)xcolor.blue&0xff; - img->has_bg_pixel = 1; - -}/* set_bg_pixel() */ - -static void fsb_cancel_cb(Widget w, XtPointer client, XtPointer call) -{ - XtUnmanageChild(w); -} - -void create_file_dialog(Widget w, char *button_text, char *title_text, - void(*fsb_select_cb)(Widget,XtPointer,XtPointer)) -{ - Arg args[4]; - int cnt; - Widget dialog; - XmString button_str, title_str, filter; - Widget child; - - cnt = 0; - dialog = XmCreateFileSelectionDialog(w, "Files", args, cnt); - - XtUnmanageChild(XmFileSelectionBoxGetChild(dialog,XmDIALOG_HELP_BUTTON)); - XtAddCallback(dialog, XmNcancelCallback, fsb_cancel_cb, NULL); - XtAddCallback(dialog, XmNokCallback, fsb_select_cb, NULL); - button_str = XmStringCreateLocalized(button_text); - title_str = XmStringCreateLocalized(title_text); - filter = XmStringCreateLocalized("*.[jmp]ng"); - XtVaSetValues(dialog, - XmNokLabelString, button_str, - XmNdialogTitle, title_str, - XmNpattern, filter, - XmNfileFilterStyle, XmFILTER_NONE, - NULL); - XmStringFree(button_str); - XmStringFree(title_str); - XmStringFree(filter); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_FILTER_TEXT); - XtVaSetValues(child, XmNfontList, file_font, NULL); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_DIR_LIST); - XtVaSetValues(child, XmNfontList, file_font, NULL); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_LIST); - XtVaSetValues(child, XmNfontList, file_font, NULL); - child = XmFileSelectionBoxGetChild(dialog, XmDIALOG_TEXT); - XtVaSetValues(child, XmNfontList, file_font, NULL); - - XtManageChild(dialog); - XMapRaised(XtDisplay (dialog), XtWindow (XtParent (dialog))); -} - -void run_mng_file_cb(Widget w, XtPointer client, XtPointer call) -{ - XmFileSelectionBoxCallbackStruct *fsb; - char *read_idf; - FILE *reader; - - XtUnmanageChild(w); - fsb = (XmFileSelectionBoxCallbackStruct *)call; - XmStringGetLtoR(fsb->value, XmSTRING_DEFAULT_CHARSET, &read_idf); - - if(read_idf == NULL || *read_idf == 0) return; - - reader = fopen(read_idf, "r"); - if(reader == NULL) - { - perror(read_idf); - fprintf(stderr, "\n\n%s: cannot open file '%s'\n\n", prg_idf, read_idf); - return; - } - run_viewer(reader, read_idf); - - free(read_idf); -} - -static void user_reset_data(void) -{ - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - mng_cleanup(&img.user_handle); - - img.read_pos = 0; - free(img.read_buf); - img.read_buf = NULL; - img.read_len = 0; - img.img_width = 0; - img.img_height = 0; - img.mng_bytes_per_line = 0; - img.read_idf = NULL; - img.frozen = 0; - img.restarted = 0; - img.single_step_wanted = 0; - img.single_step_served = 0; - - XClearWindow(img.dpy, img.win); -} - -void browse_file_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.user_handle) - user_reset_data(); - - img.stopped = 0; - img.frozen = 0; - img.restarted = 0; - create_file_dialog(w, "Select", "Select MNG file", run_mng_file_cb); -} - -void Viewer_postlude(void) -{ - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - mng_cleanup(&img.user_handle); - if(img.reader) fclose(img.reader); - if(img.ximage) XDestroyImage(img.ximage); - if(img.read_buf) free(img.read_buf); - if(img.mng_buf) free(img.mng_buf); - if(img.dither_line) free(img.dither_line); - if(!img.external_win && img.dpy) XtCloseDisplay(img.dpy); - fputc('\n', stderr); -} - -static void user_init_data(ImageInfo *img) -{ - unsigned int depth; - int screen; - Display *dpy; - - dpy = img->dpy; - screen = DefaultScreen(dpy); - depth = DefaultDepth(dpy, screen); - img->depth = depth; - - if(!img->visual) - { - img->visual = DefaultVisual(dpy, screen); - img->gc = DefaultGC(dpy, DefaultScreen(dpy)); - } - else - { - if(img->mng_buf) free(img->mng_buf); - if(img->dither_line) free(img->dither_line); - - x11_destroy_ximage(img); - } - - set_bg_pixel(img); - - mng_set_bgcolor(img->user_handle, - img->xbg_red, img->xbg_green, img->xbg_blue); - - img->mng_bytes_per_line = img->img_width * img->mng_rgb_size; - img->mng_buf = (unsigned char*) - calloc(1, img->mng_bytes_per_line * img->img_height); - img->dither_line = (unsigned char*) - calloc(1, img->mng_bytes_per_line); - - if(!img->x11_init) - { - x11_init_color(img); - - img->x11_init = 1; - } - img->ximage = x11_create_ximage(img); - - if(img->ximage == NULL) - { - Viewer_postlude(); - exit(0); - } -} - -static void player_exit_cb(Widget w, XtPointer client, XtPointer call) -{ - Viewer_postlude(); - exit(0); -} - -static void player_stop_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - user_reset_data(); - img.stopped = 1; -} - -static void player_single_step_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - if(img.single_step_served) - { - img.single_step_served = 0; - img.frozen = 0; - - img.single_step_wanted = 1; - return; - } - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - img.single_step_wanted = 1; - mng_display_resume(img.user_handle); -} - -static void player_pause_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - if(img.frozen) return; - - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - img.frozen = 1; - img.single_step_served = 0; - img.single_step_wanted = 0; -} - -static void player_resume_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - if(!img.frozen - && !img.single_step_served) - return; - img.frozen = 0; - - if(img.single_step_served - || img.single_step_wanted) - { - img.single_step_served = 0; - img.single_step_wanted = 0; - - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - } - mng_display_resume(img.user_handle); -} - -static void player_restart_cb(Widget w, XtPointer client, XtPointer call) -{ - if(img.type != MNG_TYPE) return; - if(!img.user_handle) return; - if(img.stopped) return; - - img.frozen = 1; - if(timeout_ID) XtRemoveTimeOut(timeout_ID); - timeout_ID = 0; - - img.frozen = 0; - img.single_step_served = 0; - img.single_step_wanted = 0; - - img.read_pos = 0; - mng_reset(img.user_handle); - img.restarted = 1; - gettimeofday(&start_tv, NULL); - mng_read(img.user_handle); - mng_display(img.user_handle); -} - -static void release_event_cb(Widget w, XtPointer client, XEvent *event, - Boolean *cont) -{ - Viewer_postlude(); - exit(0); -} - -static void redraw(int type) -{ - if((type == Expose || type == GraphicsExpose) - && img.ximage) - { - XPutImage(img.dpy, img.win, img.gc, img.ximage, - 0, 0, 0, 0, img.img_width, img.img_height); - } -} - -static void exposures_cb(Widget w, XtPointer client, - XmDrawingAreaCallbackStruct *cbs) -{ - - redraw(cbs->event->xany.type); -} - -static mng_ptr user_alloc(mng_size_t len) -{ - return calloc(1, len + 2); -} - -static void user_free(mng_ptr buf, mng_size_t len) -{ - free(buf); -} - -static mng_bool user_read(mng_handle user_handle, mng_ptr out_buf, - mng_uint32 req_len, mng_uint32 *out_len) -{ - mng_uint32 more; - ImageInfo *img; - - img = (ImageInfo *)mng_get_userdata(user_handle); - - more = img->read_len - img->read_pos; - - if(more > 0 - && img->read_buf != NULL) - { - if(req_len < more) - more = req_len; - memcpy(out_buf, img->read_buf + img->read_pos, more); - img->read_pos += more; - *out_len = more; - - return MNG_TRUE; - } - return MNG_FALSE; -} - -static mng_bool user_open_stream(mng_handle user_handle) -{ - return MNG_TRUE; -} - -static mng_bool user_close_stream(mng_handle user_handle) -{ - return MNG_TRUE; -} - -static void create_widgets(mng_uint32 width, mng_uint32 height) -{ - Widget but_rc, but_frame, canvas_frame; - Widget but1, but2, but3, but4, but5, but6, but7; - - toplevel = XtAppInitialize(&app_context, "xmngview", NULL, 0, - img.argc_ptr, img.argv, - 0, 0, 0); - - main_form = XtVaCreateManagedWidget("main_form", - xmFormWidgetClass, toplevel, - XmNhorizontalSpacing, SPACE_X, - XmNverticalSpacing, SPACE_Y, - XmNresizable, True, - NULL); - but_frame = XtVaCreateManagedWidget("but_frame", - xmFrameWidgetClass, main_form, - XmNshadowType, XmSHADOW_ETCHED_OUT, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - XmNshadowThickness, FRAME_SHADOW_WIDTH, - NULL); - but_rc = XtVaCreateManagedWidget("but_rc", - xmRowColumnWidgetClass, but_frame, - XmNentryAlignment, XmALIGNMENT_CENTER, - XmNorientation, XmHORIZONTAL, - XmNpacking, XmPACK_COLUMN, - XmNnumColumns, 1, - XmNresizeWidth, True, - XmNentryBorder, BUT_ENTRY_BORDER, - NULL); - but1 = XtVaCreateManagedWidget("Exit", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but1, XmNactivateCallback, - player_exit_cb, (XtPointer)toplevel); - - but2 = XtVaCreateManagedWidget("Pause", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but2, XmNactivateCallback, - player_pause_cb, (XtPointer)toplevel); - - but3 = XtVaCreateManagedWidget("GoOn", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but3, XmNactivateCallback, - player_resume_cb, NULL); - - but4 = XtVaCreateManagedWidget("Restart", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but4, XmNactivateCallback, - player_restart_cb, NULL); - - but5 = XtVaCreateManagedWidget("Step", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but5, XmNactivateCallback, - player_single_step_cb, NULL); - - but6 = XtVaCreateManagedWidget("Finish", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but6, XmNactivateCallback, - player_stop_cb, NULL); - - but7 = XtVaCreateManagedWidget("Browse", - xmPushButtonWidgetClass, but_rc, - NULL); - XtAddCallback(but7, XmNactivateCallback, - browse_file_cb, NULL); - - file_label = XtVaCreateManagedWidget("FILE: ", - xmLabelWidgetClass, main_form, - XmNalignment, XmALIGNMENT_BEGINNING, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, but_frame, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - - canvas_frame = XtVaCreateManagedWidget("canvas_frame", - xmFrameWidgetClass, main_form, - XmNshadowType, XmSHADOW_ETCHED_OUT, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopWidget, file_label, - XmNbottomAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_FORM, - NULL); - - canvas = XtVaCreateManagedWidget("canvas", - xmDrawingAreaWidgetClass, canvas_frame, - XmNheight, height, - XmNwidth, width, - NULL); - - XtAddEventHandler(canvas, - ButtonReleaseMask|ButtonPressMask, - False, release_event_cb, (XtPointer)toplevel); - - XtAddCallback(canvas, - XmNexposeCallback, (XtCallbackProc)exposures_cb, (XtPointer)&img); - - XtRealizeWidget(toplevel); - - if(start_width == 0) - { - width = height = 0; - - start_width = (FRAME_SHADOW_WIDTH<<1); - XtVaGetValues(but1, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but2, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but3, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but4, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but5, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1) + ANY_WIDTH; - XtVaGetValues(but6, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1); - XtVaGetValues(but7, XmNwidth, &width, NULL); - start_width += width + (BUT_ENTRY_BORDER<<1); - } - img.canvas = canvas; - img.dpy = XtDisplay(img.canvas); - img.win = XtWindow(img.canvas); - file_font = XmFontListAppendEntry(NULL, - XmFontListEntryCreate(XmFONTLIST_DEFAULT_TAG, - XmFONT_IS_FONT, - XLoadQueryFont(img.dpy, - "-*-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1"))); -} - -static mng_bool user_process_header(mng_handle user_handle, - mng_uint32 width, mng_uint32 height) -{ - ImageInfo *img; - Dimension cw, ch, tw, th, dh, dw, fw, fh; - XmString xmstr; - char *s, buf[128]; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - if(img->restarted) - { - img->restarted = 0; - return MNG_TRUE; - } - img->img_width = width; - img->img_height = height; - - if(!img->external_win) - { - if(!img->canvas) - create_widgets(width, height); - else - { - tw = th = fw = fh = cw = ch = 0; - - XtVaGetValues(toplevel, XmNwidth, &tw, XmNheight, &th, NULL); - XtVaGetValues(main_form, XmNwidth, &fw, XmNheight, &fh, NULL); - XtVaGetValues(img->canvas, XmNwidth, &cw, XmNheight, &ch, NULL); - - if(height > ch) - { - dh = height - ch; - th += dh; - fh += dh; - } else - if(ch > height) - { - dh = ch - height; - th -= dh; - fh -= dh; - } - if(width > cw) - { - dw = width - cw; - tw += dw; - fw += dw; - } else - if(cw > width) - { - if(width > start_width) - dw = cw - width; - else - dw = cw - start_width; - tw -= dw; - fw -= dw; - } - if(fw < start_width) - { - tw = start_width + (SPACE_X<<1); - fw = start_width; - } - XtVaSetValues(toplevel, XmNwidth,tw , XmNheight,th , NULL); - XtVaSetValues(main_form, XmNwidth,fw , XmNheight,fh , NULL); - XtVaSetValues(img->canvas, XmNwidth,width , XmNheight,height , NULL); - } - } - else - if(img->external_win) - { - Display *dpy; - - XtToolkitInitialize(); - app_context = XtCreateApplicationContext(); - dpy = XtOpenDisplay(app_context, NULL,NULL,"xmngview", - NULL, 0, img->argc_ptr, img->argv); - img->dpy = dpy; - img->win = img->external_win; - - XSelectInput(dpy, img->win, ExposureMask); - } - user_init_data(img); - - if(img->canvas) - { - s = strrchr(img->read_idf, '/'); - if(s == NULL) s = img->read_idf; else ++s; - s = strdup(s); - if(strlen(s) > 64) s[64] = 0; - sprintf(buf, "%s (%d x %d)", s, img->img_width, img->img_height); - xmstr = XmStringCreateLtoR((char*)buf, XmSTRING_DEFAULT_CHARSET); - XtVaSetValues(file_label, XmNlabelString, xmstr, NULL); - XmStringFree(xmstr); - free(s); - } - gettimeofday(&start_tv, NULL); - return MNG_TRUE; -} - -static void wait_cb(XtPointer client, XtIntervalId * id) -{ - timeout_ID = 0; - - if(img.frozen - || img.single_step_served) - { -// gettimeofday(&start_tv, NULL); - - timeout_ID = XtAppAddTimeOut(app_context, - img.delay, wait_cb, NULL); - } - else - { - mng_display_resume(img.user_handle); - } -} - -static mng_bool user_set_timer(mng_handle user_handle, mng_uint32 delay) -{ - ImageInfo *img; - - img = (ImageInfo*)mng_get_userdata(user_handle); - img->delay = delay; - - timeout_ID = XtAppAddTimeOut(app_context, - delay, wait_cb, NULL); - - return MNG_TRUE; -} - -static mng_uint32 user_get_tick_count(mng_handle user_handle) -{ - double sec, usec; - mng_uint32 ticks; - - gettimeofday(&now_tv, NULL); - - sec = (double)(now_tv.tv_sec - start_tv.tv_sec); - usec = (double)now_tv.tv_usec - (double)start_tv.tv_usec; - ticks = (mng_uint32)(sec * 1000.0 + usec/1000.0); -//fprintf(stderr,"TICKS %u (%f:%f)\n", ticks, sec, usec); - return ticks; -} - -static mng_ptr user_get_canvas_line(mng_handle user_handle, mng_uint32 line) -{ - ImageInfo *img; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - return img->mng_buf + img->mng_bytes_per_line * line; -} - -static mng_bool user_refresh(mng_handle user_handle, mng_uint32 x, - mng_uint32 y, mng_uint32 width, mng_uint32 height) -{ - ImageInfo *img; - mng_uint32 src_len; - unsigned char *src_start, *src_buf; - int row, max_row; - Display *dpy; - GC gc; - Window win; - XImage *ximage; - Visual *visual; - int have_shmem; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - if(img->single_step_wanted) - img->single_step_served = 1; - - win = img->win; - gc = img->gc; - dpy = img->dpy; - ximage = img->ximage; - visual = img->visual; - have_shmem = img->have_shmem; - - max_row = y + height; - row = y; - src_len = img->mng_bytes_per_line; - src_buf = src_start = img->mng_buf + img->mng_rgb_size * x + y * src_len; - - while(row < max_row) - { - viewer_renderline(img, src_start, row, x, width); - - ++row; - src_start += src_len; - } - XPUTIMAGE(dpy, win, gc, ximage, x, y, x, y, width, height); - XSync(dpy, False); - return MNG_TRUE; -} - -static mng_bool user_error(mng_handle user_handle, mng_int32 code, - mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - ImageInfo *img; - unsigned char chunk[5]; - - img = (ImageInfo*)mng_get_userdata(user_handle); - - chunk[0] = (char)((chunktype >> 24) & 0xFF); - chunk[1] = (char)((chunktype >> 16) & 0xFF); - chunk[2] = (char)((chunktype >> 8) & 0xFF); - chunk[3] = (char)((chunktype ) & 0xFF); - chunk[4] = '\0'; - - fprintf(stderr, "\n\n%s: error playing(%s) chunk[%d]'%s':\n", - prg_idf, img->read_idf, chunkseq, chunk); - fprintf(stderr, "code(%d) severity(%d) extra1(%d) extra2(%d)" - "\ntext:'%s'\n\n", code, severity, extra1, extra2, text); - return 0; -} - -static mng_bool prelude(void) -{ -#define MAXBUF 8 - unsigned char buf[MAXBUF]; - - if(fread(buf, 1, MAXBUF, img.reader) != MAXBUF) - { - fprintf(stderr,"\n%s:prelude\n\tcannot read signature \n", - prg_idf); - return MNG_FALSE; - } - - if(memcmp(buf, MNG_MAGIC, 8) == 0) - img.type = MNG_TYPE; - else - if(memcmp(buf, JNG_MAGIC, 8) == 0) - img.type = JNG_TYPE; - else - if(memcmp(buf, PNG_MAGIC, 8) == 0) - img.type = PNG_TYPE; - if(!img.type) - { - fprintf(stderr,"\n%s:'%s' is no MNG / JNG / PNG file\n", - prg_idf, img.read_idf); - return MNG_FALSE; - } - fseek(img.reader, 0, SEEK_SET); - fseek(img.reader, 0, SEEK_END); - img.read_len = ftell(img.reader); - fseek(img.reader, 0, SEEK_SET); - - if(!img.user_handle) - { - user_handle = mng_initialize(&img, user_alloc, user_free, MNG_NULL); - - if(user_handle == MNG_NULL) - { - fprintf(stderr, "\n%s: cannot initialize libmng.\n", prg_idf); - return MNG_FALSE; - } - img.user_handle = user_handle; - - mng_set_canvasstyle(user_handle, MNG_CANVAS_RGB8); - img.mng_rgb_size = CANVAS_RGB8_SIZE; - - if(mng_setcb_openstream(user_handle, user_open_stream) != OK - || mng_setcb_closestream(user_handle, user_close_stream) != OK - || mng_setcb_readdata(user_handle, user_read) != OK - || mng_setcb_settimer(user_handle, user_set_timer) != OK - || mng_setcb_gettickcount(user_handle, user_get_tick_count) != OK - || mng_setcb_processheader(user_handle, user_process_header) != OK - || mng_setcb_getcanvasline(user_handle, user_get_canvas_line) != OK - || mng_setcb_refresh(user_handle, user_refresh) != OK - || mng_setcb_errorproc(user_handle, user_error) != OK - ) - { - fprintf(stderr,"\n%s: cannot set callbacks for libmng.\n", - prg_idf); - return MNG_FALSE; - } - } - img.read_buf = (unsigned char*)calloc(1, img.read_len + 2); - fread(img.read_buf, 1, img.read_len, img.reader); - fclose(img.reader); - img.reader = NULL; - - return MNG_TRUE; -} - -static void run_viewer(FILE *reader, char *read_idf) -{ - XEvent event; - - img.read_idf = read_idf; - img.reader = reader; - - if(read_idf != NULL) - { - if(prelude() == MNG_FALSE) - return ; - - gettimeofday(&start_tv, NULL); - - mng_read(img.user_handle); - mng_display(img.user_handle); - } - - if(!img.external_win) - { - XtAppMainLoop(app_context); - } - else - while(1) - { - XtAppNextEvent(app_context, &event); - - redraw(event.type); - } -} - -static void usage(const char *prg) -{ - const char *bar= -"\n------------------------------------------------------------------------\n"; - - fputs(bar, stderr); - fprintf(stderr,"%s version %s\n" - "USAGE: %s [--w WINDOW] [--bg BACKGROUND_COLOR] [FILE]\n", - prg, version, prg); - fputs("\twith BACKGROUND_COLOR = " - "(\"TEXT\" | \"#RGB\" | \"rgb:R/G/B\" | \"PIXEL\")\n" - "\te.g.\n\t(--bg \"red\" | --bg \"#ff0000\" " - "| --bg \"rgb:ff/00/00\" | --bg \"0xf800\")\n" - "\twith FILE=(idf.mng | idf.jng | idf.png)",stderr); - fputs(bar, stderr); -} - -static void shrink_name(char *buf) -{ - char *s, *d; - int ch; - - s = d = buf; - while((ch = *s++)) - { - if(isspace(ch)) continue; - *d++ = tolower(ch); - } - *d = 0; -} - -int main(int argc, char **argv) -{ - FILE *reader; - char *read_idf, *s; - char *ok; - int i; - unsigned char has_bg_color, has_bg_pixel; - Window external_win; - Pixel bg_pixel; - - if((prg_idf = strrchr(argv[0], '/')) == NULL) - prg_idf = argv[0]; - else - ++prg_idf; - - memset(&img, 0, sizeof(ImageInfo)); - external_win = 0; read_idf = NULL; reader = NULL; - has_bg_color = has_bg_pixel = 0; - bg_pixel = 0; - i = 0; - - while(++i < argc) - { - s = argv[i]; - - if(strcmp(s, "--help") == 0 - || strcmp(s, "-help") == 0 - || *s == '?') - { - usage(prg_idf); - return 0; - } - if(strcasecmp(s, "--w") == 0) - { - ++i; - s = argv[i]; - external_win = strtoul(s, &ok, 10); - if(*ok) - return 0; - continue; - } - if(strcasecmp(s, "--bg") == 0) - { - ++i; - s = argv[i]; - if(*s == '#' || strncasecmp(s, "rgb:", 4) == 0 || isalpha(*s)) - { - strncpy(img.bg_color, s, MAX_COLORBUF); - img.bg_color[MAX_COLORBUF] = 0; - has_bg_color = 1; - - if(*s != '#') - shrink_name(img.bg_color); - continue; - } - bg_pixel = strtoul(s, &ok, 16); - - if(*ok == 0) - has_bg_pixel = 1; - continue; - } - if(*s != '-') - { - read_idf = s; continue; - } - } - if(read_idf != NULL) - { - reader = fopen(read_idf, "rb"); - if(reader == NULL) - { - perror(read_idf); - fprintf(stderr, "\n\n%s: cannot open file '%s'\n\n", prg_idf, read_idf); - return 0; - } - } - img.argv = argv; - img.argc_ptr = &argc; - img.external_win = external_win; - img.has_bg_pixel = has_bg_pixel; - img.bg_pixel = bg_pixel; - img.has_bg_color = has_bg_color; - - if(!has_bg_pixel && !has_bg_color) - { - strcpy(img.bg_color, DEFAULT_BACKGROUND); - img.has_bg_color = 1; - } - - if(read_idf == NULL && external_win == 0) - create_widgets(5,5); - - run_viewer(reader, read_idf); - - Viewer_postlude(); - return 0; -} diff --git a/Engine/lib/lmng/contrib/kylix/libmng.pas b/Engine/lib/lmng/contrib/kylix/libmng.pas deleted file mode 100644 index f81c17645..000000000 --- a/Engine/lib/lmng/contrib/kylix/libmng.pas +++ /dev/null @@ -1,1726 +0,0 @@ -unit libmng; - -{****************************************************************************} -{* *} -{* COPYRIGHT NOTICE: *} -{* *} -{* Copyright (c) 2000-2002 Gerard Juyn (gerard@libmng.com) *} -{* [You may insert additional notices after this sentence if you modify *} -{* this source] *} -{* *} -{* For the purposes of this copyright and license, "Contributing Authors" *} -{* is defined as the following set of individuals: *} -{* *} -{* Gerard Juyn *} -{* (hopefully some more to come...) *} -{* *} -{* The MNG Library is supplied "AS IS". The Contributing Authors *} -{* disclaim all warranties, expressed or implied, including, without *} -{* limitation, the warranties of merchantability and of fitness for any *} -{* purpose. The Contributing Authors assume no liability for direct, *} -{* indirect, incidental, special, exemplary, or consequential damages, *} -{* which may result from the use of the MNG Library, even if advised of *} -{* the possibility of such damage. *} -{* *} -{* Permission is hereby granted to use, copy, modify, and distribute this *} -{* source code, or portions hereof, for any purpose, without fee, subject *} -{* to the following restrictions: *} -{* *} -{* 1. The origin of this source code must not be misrepresented; *} -{* you must not claim that you wrote the original software. *} -{* *} -{* 2. Altered versions must be plainly marked as such and must not be *} -{* misrepresented as being the original source. *} -{* *} -{* 3. This Copyright notice may not be removed or altered from any source *} -{* or altered source distribution. *} -{* *} -{* The Contributing Authors specifically permit, without fee, and *} -{* encourage the use of this source code as a component to supporting *} -{* the MNG and JNG file format in commercial products. If you use this *} -{* source code in a product, acknowledgment would be highly appreciated. *} -{* *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : libmng.pas copyright (c) 2000-2002 G.Juyn *} -{* version : 1.0.5 *} -{* *} -{* purpose : libmng.so wrapper unit *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info@3-t.com *} -{* *} -{* comment : contains the pascal-translation of libmng.h *} -{* can be used by Kylix programs to access the libmng.so *} -{* *} -{* changes : 1.0.5 - 09/21/2002 - G.Juyn *} -{* - modified for Kylix use *} -{* *} -{****************************************************************************} - -interface - -{****************************************************************************} - -const MNG_TRUE = TRUE; - MNG_FALSE = FALSE; - MNG_NULL = nil; - -type mng_uint32 = cardinal; - mng_int32 = integer; - mng_uint16 = word; - mng_int16 = smallint; - mng_uint8 = byte; - mng_int8 = shortint; - mng_bool = boolean; - mng_ptr = pointer; - mng_pchar = pchar; - - mng_handle = pointer; - mng_retcode = mng_int32; - mng_chunkid = mng_uint32; - - mng_size_t = cardinal; - - mng_imgtype = (mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng); - mng_speedtype = (mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest); - - mng_uint32p = ^mng_uint32; - mng_uint16p = ^mng_uint16; - mng_uint8p = ^mng_uint8; - mng_chunkidp = ^mng_chunkid; - - mng_palette8e = packed record { 8-bit palette element } - iRed : mng_uint8; - iGreen : mng_uint8; - iBlue : mng_uint8; - end; - - mng_palette8 = packed array [0 .. 255] of mng_palette8e; - - mng_uint8arr = packed array [0 .. 255] of mng_uint8; - mng_uint8arr4 = packed array [0 .. 3] of mng_uint8; - mng_uint16arr = packed array [0 .. 255] of mng_uint16; - mng_uint32arr2 = packed array [0 .. 1] of mng_uint32; - -{****************************************************************************} - -type mng_memalloc = function ( iLen : mng_size_t) : mng_ptr; cdecl; - mng_memfree = procedure ( iPtr : mng_ptr; - iLen : mng_size_t); cdecl; - -type mng_openstream = function ( hHandle : mng_handle) : mng_bool; cdecl; -type mng_closestream = function ( hHandle : mng_handle) : mng_bool; cdecl; - -type mng_readdata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; cdecl; - -type mng_writedata = function ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pWritten : mng_uint32) : mng_bool; cdecl; - -type mng_errorproc = function ( hHandle : mng_handle; - iErrorcode : mng_retcode; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar ) : mng_bool; cdecl; -type mng_traceproc = function ( hHandle : mng_handle; - iFuncnr : mng_int32; - iFuncseq : mng_uint32; - zFuncname : mng_pchar ) : mng_bool; cdecl; - -type mng_processheader = function ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; -type mng_processtext = function ( hHandle : mng_handle; - iType : mng_uint8; - zKeyword : mng_pchar; - zText : mng_pchar; - zLanguage : mng_pchar; - zTranslation : mng_pchar ) : mng_bool; cdecl; - -type mng_processsave = function ( hHandle : mng_handle) : mng_bool; cdecl; -type mng_processseek = function ( hHandle : mng_handle; - zName : mng_pchar ) : mng_bool; cdecl; - -type mng_processneed = function ( hHandle : mng_handle; - zKeyword : mng_pchar ) : mng_bool; cdecl; - -type mng_processunknown = function ( hHandle : mng_handle; - iChunkid : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_bool; cdecl; - -type mng_getcanvasline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -type mng_getalphaline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -type mng_getbkgdline = function ( hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -type mng_refresh = function ( hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; - -type mng_gettickcount = function ( hHandle : mng_handle) : mng_uint32; cdecl; -type mng_settimer = function ( hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; cdecl; - -type mng_processgamma = function ( hHandle : mng_handle; - iGamma : mng_uint32) : mng_bool; cdecl; -type mng_processchroma = function ( hHandle : mng_handle; - iWhitex : mng_uint32; - iWhitey : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32) : mng_bool; cdecl; -type mng_processsrgb = function ( hHandle : mng_handle; - iIntent : mng_uint8 ) : mng_bool; cdecl; -type mng_processiccp = function ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_bool; cdecl; -type mng_processarow = function ( hHandle : mng_handle; - iRowsamples : mng_uint32; - bIsRGBA16 : mng_bool; - pRow : mng_ptr ) : mng_bool; cdecl; - -type mng_iteratechunk = function ( hHandle : mng_handle; - hChunk : mng_handle; - iChunkid : mng_chunkid; - iChunkseq : mng_uint32) : mng_bool; cdecl; - -{****************************************************************************} - -function mng_initialize ( pUserdata : mng_ptr; - fMemalloc : mng_memalloc; - fMemfree : mng_memfree; - fTraceproc : mng_traceproc ) : mng_handle; cdecl; - -function mng_reset ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_cleanup (var hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_read ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_read_resume ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_write ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_create ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_readdisplay ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_resume ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_freeze ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_reset ( hHandle : mng_handle ) : mng_retcode; cdecl; -function mng_display_goframe ( hHandle : mng_handle; - iFramenr : mng_uint32 ) : mng_retcode; cdecl; -function mng_display_golayer ( hHandle : mng_handle; - iLayernr : mng_uint32 ) : mng_retcode; cdecl; -function mng_display_gotime ( hHandle : mng_handle; - iPlaytime : mng_uint32 ) : mng_retcode; cdecl; - -function mng_trapevent ( hHandle : mng_handle; - iEventtype : mng_uint8; - iX : mng_int32; - iY : mng_int32 ) : mng_retcode; cdecl; - -function mng_getlasterror ( hHandle : mng_handle; - var iSeverity : mng_uint8; - var iChunkname : mng_chunkid; - var iChunkseq : mng_uint32; - var iExtra1 : mng_int32; - var iExtra2 : mng_int32; - var zErrortext : mng_pchar ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_setcb_memalloc ( hHandle : mng_handle; - fProc : mng_memalloc ) : mng_retcode; cdecl; -function mng_setcb_memfree ( hHandle : mng_handle; - fProc : mng_memfree ) : mng_retcode; cdecl; - -function mng_setcb_openstream ( hHandle : mng_handle; - fProc : mng_openstream ) : mng_retcode; cdecl; -function mng_setcb_closestream ( hHandle : mng_handle; - fProc : mng_closestream ) : mng_retcode; cdecl; - -function mng_setcb_readdata ( hHandle : mng_handle; - fProc : mng_readdata ) : mng_retcode; cdecl; - -function mng_setcb_writedata ( hHandle : mng_handle; - fProc : mng_writedata ) : mng_retcode; cdecl; - -function mng_setcb_errorproc ( hHandle : mng_handle; - fProc : mng_errorproc ) : mng_retcode; cdecl; -function mng_setcb_traceproc ( hHandle : mng_handle; - fProc : mng_traceproc ) : mng_retcode; cdecl; - -function mng_setcb_processheader ( hHandle : mng_handle; - fProc : mng_processheader) : mng_retcode; cdecl; -function mng_setcb_processtext ( hHandle : mng_handle; - fProc : mng_processtext ) : mng_retcode; cdecl; - -function mng_setcb_getcanvasline ( hHandle : mng_handle; - fProc : mng_getcanvasline) : mng_retcode; cdecl; -function mng_setcb_getalphaline ( hHandle : mng_handle; - fProc : mng_getalphaline ) : mng_retcode; cdecl; -function mng_setcb_getbkgdline ( hHandle : mng_handle; - fProc : mng_getbkgdline ) : mng_retcode; cdecl; -function mng_setcb_refresh ( hHandle : mng_handle; - fProc : mng_refresh ) : mng_retcode; cdecl; - -function mng_setcb_gettickcount ( hHandle : mng_handle; - fProc : mng_gettickcount ) : mng_retcode; cdecl; -function mng_setcb_settimer ( hHandle : mng_handle; - fProc : mng_settimer ) : mng_retcode; cdecl; - -function mng_setcb_processgamma ( hHandle : mng_handle; - fProc : mng_processgamma ) : mng_retcode; cdecl; -function mng_setcb_processchroma ( hHandle : mng_handle; - fProc : mng_processchroma) : mng_retcode; cdecl; -function mng_setcb_processsrgb ( hHandle : mng_handle; - fProc : mng_processsrgb ) : mng_retcode; cdecl; -function mng_setcb_processiccp ( hHandle : mng_handle; - fProc : mng_processiccp ) : mng_retcode; cdecl; -function mng_setcb_processarow ( hHandle : mng_handle; - fProc : mng_processarow ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_getcb_memalloc ( hHandle : mng_handle ) : mng_memalloc; cdecl; -function mng_getcb_memfree ( hHandle : mng_handle ) : mng_memfree; cdecl; - -function mng_getcb_openstream ( hHandle : mng_handle ) : mng_openstream; cdecl; -function mng_getcb_closestream ( hHandle : mng_handle ) : mng_closestream; cdecl; - -function mng_getcb_readdata ( hHandle : mng_handle ) : mng_readdata; cdecl; - -function mng_getcb_writedata ( hHandle : mng_handle ) : mng_writedata; cdecl; - -function mng_getcb_errorproc ( hHandle : mng_handle ) : mng_errorproc; cdecl; -function mng_getcb_traceproc ( hHandle : mng_handle ) : mng_traceproc; cdecl; - -function mng_getcb_processheader ( hHandle : mng_handle ) : mng_processheader; cdecl; -function mng_getcb_processtext ( hHandle : mng_handle ) : mng_processtext; cdecl; - -function mng_getcb_getcanvasline ( hHandle : mng_handle ) : mng_getcanvasline; cdecl; -function mng_getcb_getalphaline ( hHandle : mng_handle ) : mng_getalphaline; cdecl; -function mng_getcb_getbkgdline ( hHandle : mng_handle ) : mng_getbkgdline; cdecl; -function mng_getcb_refresh ( hHandle : mng_handle ) : mng_refresh; cdecl; - -function mng_getcb_gettickcount ( hHandle : mng_handle ) : mng_gettickcount; cdecl; -function mng_getcb_settimer ( hHandle : mng_handle ) : mng_settimer; cdecl; - -function mng_getcb_processgamma ( hHandle : mng_handle ) : mng_processgamma; cdecl; -function mng_getcb_processchroma ( hHandle : mng_handle ) : mng_processchroma; cdecl; -function mng_getcb_processsrgb ( hHandle : mng_handle ) : mng_processsrgb; cdecl; -function mng_getcb_processiccp ( hHandle : mng_handle ) : mng_processiccp; cdecl; -function mng_getcb_processarow ( hHandle : mng_handle ) : mng_processarow; cdecl; - -{****************************************************************************} - -function mng_set_userdata ( hHandle : mng_handle; - pUserdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_set_canvasstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_bkgdstyle ( hHandle : mng_handle; - iStyle : mng_uint32 ) : mng_retcode; cdecl; - -function mng_set_bgcolor ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; cdecl; - -function mng_set_usebkgd ( hHandle : mng_handle; - bUseBKGD : mng_bool ) : mng_retcode; cdecl; - -function mng_set_storechunks ( hHandle : mng_handle; - bStorechunks : mng_bool ) : mng_retcode; cdecl; - -function mng_set_cacheplayback ( hHandle : mng_handle; - bCacheplayback : mng_bool ) : mng_retcode; cdecl; - -function mng_set_viewgammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_displaygammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_dfltimggammaint ( hHandle : mng_handle; - iGamma : mng_uint32 ) : mng_retcode; cdecl; - -function mng_set_srgb ( hHandle : mng_handle; - bIssRGB : mng_bool ) : mng_retcode; cdecl; -function mng_set_outputprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; cdecl; -function mng_set_outputprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; cdecl; -function mng_set_srgbprofile ( hHandle : mng_handle; - zFilename : mng_pchar ) : mng_retcode; cdecl; -function mng_set_srgbprofile2 ( hHandle : mng_handle; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; cdecl; - -function mng_set_maxcanvaswidth ( hHandle : mng_handle; - iMaxwidth : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_maxcanvasheight ( hHandle : mng_handle; - iMaxheight : mng_uint32 ) : mng_retcode; cdecl; -function mng_set_maxcanvassize ( hHandle : mng_handle; - iMaxwidth : mng_uint32; - iMaxheight : mng_uint32 ) : mng_retcode; cdecl; - -function mng_set_suspensionmode ( hHandle : mng_handle; - bSuspensionmode : mng_bool ) : mng_retcode; cdecl; - -function mng_set_speed ( hHandle : mng_handle; - iSpeed : mng_speedtype ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_get_userdata ( hHandle : mng_handle ) : mng_ptr; cdecl; - -function mng_get_sigtype ( hHandle : mng_handle ) : mng_imgtype; cdecl; -function mng_get_imagetype ( hHandle : mng_handle ) : mng_imgtype; cdecl; -function mng_get_imagewidth ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_imageheight ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_ticks ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_framecount ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_layercount ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_playtime ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_simplicity ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_canvasstyle ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_bkgdstyle ( hHandle : mng_handle ) : mng_uint32; cdecl; - -procedure mng_get_bgcolor ( hHandle : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ); cdecl; - -function mng_get_usebkgd ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_storechunks ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_get_cacheplayback ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_viewgammaint ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_displaygammaint ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_dfltimggammaint ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_srgb ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_maxcanvaswidth ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_maxcanvasheight ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_suspensionmode ( hHandle : mng_handle ) : mng_bool; cdecl; - -function mng_get_speed ( hHandle : mng_handle ) : mng_speedtype; cdecl; -function mng_get_imagelevel ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_get_starttime ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_runtime ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_currentframe ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_currentlayer ( hHandle : mng_handle ) : mng_uint32; cdecl; -function mng_get_currentplaytime ( hHandle : mng_handle ) : mng_uint32; cdecl; - -function mng_status_error ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_reading ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_suspendbreak ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_creating ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_writing ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_displaying ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_running ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_timerbreak ( hHandle : mng_handle ) : mng_bool; cdecl; -function mng_status_dynamic ( hHandle : mng_handle ) : mng_bool; cdecl; - -{****************************************************************************} - -function mng_iterate_chunks ( hHandle : mng_handle; - iChunkseq : mng_uint32; - fProc : mng_iteratechunk ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_getchunk_ihdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_plte ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var aPalette : mng_palette8 ) : mng_retcode; cdecl; - -function mng_getchunk_idat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_trns ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var bGlobal : mng_bool; - var iType : mng_uint8; - var iCount : mng_uint32; - var aAlphas : mng_uint8arr; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iRawlen : mng_uint32; - var aRawdata : mng_uint8arr ) : mng_retcode; cdecl; - -function mng_getchunk_gama ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iGamma : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_chrm ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iWhitepointx : mng_uint32; - var iWhitepointy : mng_uint32; - var iRedx : mng_uint32; - var iRedy : mng_uint32; - var iGreenx : mng_uint32; - var iGreeny : mng_uint32; - var iBluex : mng_uint32; - var iBluey : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_srgb ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iRenderingintent : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_iccp ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iCompression : mng_uint8; - var iProfilesize : mng_uint32; - var pProfile : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_text ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_ztxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompression : mng_uint8; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_itxt ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordsize : mng_uint32; - var zKeyword : mng_pchar; - var iCompressionflag : mng_uint8; - var iCompressionmethod : mng_uint8; - var iLanguagesize : mng_uint32; - var zLanguage : mng_pchar; - var iTranslationsize : mng_uint32; - var zTranslation : mng_pchar; - var iTextsize : mng_uint32; - var zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_bkgd ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var iIndex : mng_uint8; - var iGray : mng_uint16; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16 ) : mng_retcode; cdecl; - -function mng_getchunk_phys ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_sbit ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iType : mng_uint8; - var aBits : mng_uint8arr4) : mng_retcode; cdecl; - -function mng_getchunk_splt ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iSampledepth : mng_uint8; - var iEntrycount : mng_uint32; - var pEntries : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_hist ( hHandle : mng_handle; - hChunk : mng_handle; - var iEntrycount : mng_uint32; - var aEntries : mng_uint16arr) : mng_retcode; cdecl; - -function mng_getchunk_time ( hHandle : mng_handle; - hChunk : mng_handle; - var iYear : mng_uint16; - var iMonth : mng_uint8; - var iDay : mng_uint8; - var iHour : mng_uint8; - var iMinute : mng_uint8; - var iSecond : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_mhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iTicks : mng_uint32; - var iLayercount : mng_uint32; - var iFramecount : mng_uint32; - var iPlaytime : mng_uint32; - var iSimplicity : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_loop ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8; - var iRepeat : mng_uint32; - var iTermination : mng_uint8; - var iItermin : mng_uint32; - var iItermax : mng_uint32; - var iCount : mng_uint32; - var pSignals : mng_uint32p ) : mng_retcode; cdecl; - -function mng_getchunk_endl ( hHandle : mng_handle; - hChunk : mng_handle; - var iLevel : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_defi ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iXlocation : mng_int32; - var iYlocation : mng_int32; - var bHasclip : mng_bool; - var iLeftcb : mng_int32; - var iRightcb : mng_int32; - var iTopcb : mng_int32; - var iBottomcb : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_basi ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iBitdepth : mng_uint8; - var iColortype : mng_uint8; - var iCompression : mng_uint8; - var iFilter : mng_uint8; - var iInterlace : mng_uint8; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var iViewable : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_clon ( hHandle : mng_handle; - hChunk : mng_handle; - var iSourceid : mng_uint16; - var iCloneid : mng_uint16; - var iClonetype : mng_uint8; - var iDonotshow : mng_uint8; - var iConcrete : mng_uint8; - var bHasloca : mng_bool; - var iLocationtype : mng_uint8; - var iLocationx : mng_int32; - var iLocationy : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_past ( hHandle : mng_handle; - hChunk : mng_handle; - var iDestid : mng_uint16; - var iTargettype : mng_uint8; - var iTargetx : mng_int32; - var iTargety : mng_int32; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_past_src ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iSourceid : mng_uint16; - var iComposition : mng_uint8; - var iOrientation : mng_uint8; - var iOffsettype : mng_uint8; - var iOffsetx : mng_int32; - var iOffsety : mng_int32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_disc ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pObjectids : mng_uint16p ) : mng_retcode; cdecl; - -function mng_getchunk_back ( hHandle : mng_handle; - hChunk : mng_handle; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iMandatory : mng_uint8; - var iImageid : mng_uint16; - var iTile : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_fram ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iMode : mng_uint8; - var iNamesize : mng_uint32; - var zName : mng_pchar; - var iChangedelay : mng_uint8; - var iChangetimeout : mng_uint8; - var iChangeclipping : mng_uint8; - var iChangesyncid : mng_uint8; - var iDelay : mng_uint32; - var iTimeout : mng_uint32; - var iBoundarytype : mng_uint8; - var iBoundaryl : mng_int32; - var iBoundaryr : mng_int32; - var iBoundaryt : mng_int32; - var iBoundaryb : mng_int32; - var iCount : mng_uint32; - var pSyncids : mng_uint32p ) : mng_retcode; cdecl; - -function mng_getchunk_move ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMovetype : mng_uint8; - var iMovex : mng_int32; - var iMovey : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_clip ( hHandle : mng_handle; - hChunk : mng_handle; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iCliptype : mng_uint8; - var iClipl : mng_int32; - var iClipr : mng_int32; - var iClipt : mng_int32; - var iClipb : mng_int32 ) : mng_retcode; cdecl; - -function mng_getchunk_show ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iFirstid : mng_uint16; - var iLastid : mng_uint16; - var iMode : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_term ( hHandle : mng_handle; - hChunk : mng_handle; - var iTermaction : mng_uint8; - var iIteraction : mng_uint8; - var iDelay : mng_uint32; - var iItermax : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_save ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iOffsettype : mng_uint8; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_save_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iEntrytype : mng_uint8; - var iOffset : mng_uint32arr2; - var iStarttime : mng_uint32arr2; - var iLayernr : mng_uint32; - var iFramenr : mng_uint32; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_seek ( hHandle : mng_handle; - hChunk : mng_handle; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_expi ( hHandle : mng_handle; - hChunk : mng_handle; - var iSnapshotid : mng_uint16; - var iNamesize : mng_uint32; - var zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_fpri ( hHandle : mng_handle; - hChunk : mng_handle; - var iDeltatype : mng_uint8; - var iPriority : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_need ( hHandle : mng_handle; - hChunk : mng_handle; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_phyg ( hHandle : mng_handle; - hChunk : mng_handle; - var bEmpty : mng_bool; - var iSizex : mng_uint32; - var iSizey : mng_uint32; - var iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_jhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iWidth : mng_uint32; - var iHeight : mng_uint32; - var iColortype : mng_uint8; - var iImagesampledepth : mng_uint8; - var iImagecompression : mng_uint8; - var iImageinterlace : mng_uint8; - var iAlphasampledepth : mng_uint8; - var iAlphacompression : mng_uint8; - var iAlphafilter : mng_uint8; - var iAlphainterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_jdat ( hHandle : mng_handle; - hChunk : mng_handle; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_getchunk_dhdr ( hHandle : mng_handle; - hChunk : mng_handle; - var iObjectid : mng_uint16; - var iImagetype : mng_uint8; - var iDeltatype : mng_uint8; - var iBlockwidth : mng_uint32; - var iBlockheight : mng_uint32; - var iBlockx : mng_uint32; - var iBlocky : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_prom ( hHandle : mng_handle; - hChunk : mng_handle; - var iColortype : mng_uint8; - var iSampledepth : mng_uint8; - var iFilltype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_pplt ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_pplt_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iRed : mng_uint16; - var iGreen : mng_uint16; - var iBlue : mng_uint16; - var iAlpha : mng_uint16; - var bUsed : mng_bool ) : mng_retcode; cdecl; - -function mng_getchunk_drop ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32; - var pChunknames : mng_chunkidp ) : mng_retcode; cdecl; - -function mng_getchunk_dbyk ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iPolarity : mng_uint8; - var iKeywordssize : mng_uint32; - var zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_getchunk_ordr ( hHandle : mng_handle; - hChunk : mng_handle; - var iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_getchunk_ordr_entry ( hHandle : mng_handle; - hChunk : mng_handle; - iEntry : mng_uint32; - var iChunkname : mng_chunkid; - var iOrdertype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_getchunk_unknown ( hHandle : mng_handle; - hChunk : mng_handle; - var iChunkname : mng_chunkid; - var iRawlen : mng_uint32; - var pRawdata : mng_ptr ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_putchunk_ihdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_plte ( hHandle : mng_handle; - iCount : mng_uint32; - aPalette : mng_palette8 ) : mng_retcode; cdecl; - -function mng_putchunk_idat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_iend ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_putchunk_trns ( hHandle : mng_handle; - bEmpty : mng_bool; - bGlobal : mng_bool; - iType : mng_uint8; - iCount : mng_uint32; - aAlphas : mng_uint8arr; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iRawlen : mng_uint32; - aRawdata : mng_uint8arr ) : mng_retcode; cdecl; - -function mng_putchunk_gama ( hHandle : mng_handle; - bEmpty : mng_bool; - iGamma : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_chrm ( hHandle : mng_handle; - bEmpty : mng_bool; - iWhitepointx : mng_uint32; - iWhitepointy : mng_uint32; - iRedx : mng_uint32; - iRedy : mng_uint32; - iGreenx : mng_uint32; - iGreeny : mng_uint32; - iBluex : mng_uint32; - iBluey : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_srgb ( hHandle : mng_handle; - bEmpty : mng_bool; - iRenderingintent : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_iccp ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iCompression : mng_uint8; - iProfilesize : mng_uint32; - pProfile : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_text ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_ztxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompression : mng_uint8; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_itxt ( hHandle : mng_handle; - iKeywordsize : mng_uint32; - zKeyword : mng_pchar; - iCompressionflag : mng_uint8; - iCompressionmethod : mng_uint8; - iLanguagesize : mng_uint32; - zLanguage : mng_pchar; - iTranslationsize : mng_uint32; - zTranslation : mng_pchar; - iTextsize : mng_uint32; - zText : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_bkgd ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - iIndex : mng_uint8; - iGray : mng_uint16; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16 ) : mng_retcode; cdecl; - -function mng_putchunk_phys ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_sbit ( hHandle : mng_handle; - bEmpty : mng_bool; - iType : mng_uint8; - aBits : mng_uint8arr4) : mng_retcode; cdecl; - -function mng_putchunk_splt ( hHandle : mng_handle; - bEmpty : mng_bool; - iNamesize : mng_uint32; - zName : mng_pchar; - iSampledepth : mng_uint8; - iEntrycount : mng_uint32; - pEntries : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_hist ( hHandle : mng_handle; - iEntrycount : mng_uint32; - aEntries : mng_uint16arr) : mng_retcode; cdecl; - -function mng_putchunk_time ( hHandle : mng_handle; - iYear : mng_uint16; - iMonth : mng_uint8; - iDay : mng_uint8; - iHour : mng_uint8; - iMinute : mng_uint8; - iSecond : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_mhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iTicks : mng_uint32; - iLayercount : mng_uint32; - iFramecount : mng_uint32; - iPlaytime : mng_uint32; - iSimplicity : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_mend ( hHandle : mng_handle ) : mng_retcode; cdecl; - -function mng_putchunk_loop ( hHandle : mng_handle; - iLevel : mng_uint8; - iRepeat : mng_uint32; - iTermination : mng_uint8; - iItermin : mng_uint32; - iItermax : mng_uint32; - iCount : mng_uint32; - pSignals : mng_uint32p ) : mng_retcode; cdecl; - -function mng_putchunk_endl ( hHandle : mng_handle; - iLevel : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_defi ( hHandle : mng_handle; - iObjectid : mng_uint16; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iXlocation : mng_int32; - iYlocation : mng_int32; - bHasclip : mng_bool; - iLeftcb : mng_int32; - iRightcb : mng_int32; - iTopcb : mng_int32; - iBottomcb : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_basi ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iBitdepth : mng_uint8; - iColortype : mng_uint8; - iCompression : mng_uint8; - iFilter : mng_uint8; - iInterlace : mng_uint8; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - iViewable : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_clon ( hHandle : mng_handle; - iSourceid : mng_uint16; - iCloneid : mng_uint16; - iClonetype : mng_uint8; - iDonotshow : mng_uint8; - iConcrete : mng_uint8; - bHasloca : mng_bool; - iLocationtype : mng_uint8; - iLocationx : mng_int32; - iLocationy : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_past ( hHandle : mng_handle; - iDestid : mng_uint16; - iTargettype : mng_uint8; - iTargetx : mng_int32; - iTargety : mng_int32; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_past_src ( hHandle : mng_handle; - iEntry : mng_uint32; - iSourceid : mng_uint16; - iComposition : mng_uint8; - iOrientation : mng_uint8; - iOffsettype : mng_uint8; - iOffsetx : mng_int32; - iOffsety : mng_int32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_disc ( hHandle : mng_handle; - iCount : mng_uint32; - pObjectids : mng_uint16p ) : mng_retcode; cdecl; - -function mng_putchunk_back ( hHandle : mng_handle; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iMandatory : mng_uint8; - iImageid : mng_uint16; - iTile : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_fram ( hHandle : mng_handle; - bEmpty : mng_bool; - iMode : mng_uint8; - iNamesize : mng_uint32; - zName : mng_pchar; - iChangedelay : mng_uint8; - iChangetimeout : mng_uint8; - iChangeclipping : mng_uint8; - iChangesyncid : mng_uint8; - iDelay : mng_uint32; - iTimeout : mng_uint32; - iBoundarytype : mng_uint8; - iBoundaryl : mng_int32; - iBoundaryr : mng_int32; - iBoundaryt : mng_int32; - iBoundaryb : mng_int32; - iCount : mng_uint32; - pSyncids : mng_uint32p ) : mng_retcode; cdecl; - -function mng_putchunk_move ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMovetype : mng_uint8; - iMovex : mng_int32; - iMovey : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_clip ( hHandle : mng_handle; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iCliptype : mng_uint8; - iClipl : mng_int32; - iClipr : mng_int32; - iClipt : mng_int32; - iClipb : mng_int32 ) : mng_retcode; cdecl; - -function mng_putchunk_show ( hHandle : mng_handle; - bEmpty : mng_bool; - iFirstid : mng_uint16; - iLastid : mng_uint16; - iMode : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_term ( hHandle : mng_handle; - iTermaction : mng_uint8; - iIteraction : mng_uint8; - iDelay : mng_uint32; - iItermax : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_save ( hHandle : mng_handle; - bEmpty : mng_bool; - iOffsettype : mng_uint8; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_save_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iEntrytype : mng_uint8; - iOffset : mng_uint32arr2; - iStarttime : mng_uint32arr2; - iLayernr : mng_uint32; - iFramenr : mng_uint32; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_seek ( hHandle : mng_handle; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_expi ( hHandle : mng_handle; - iSnapshotid : mng_uint16; - iNamesize : mng_uint32; - zName : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_fpri ( hHandle : mng_handle; - iDeltatype : mng_uint8; - iPriority : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_need ( hHandle : mng_handle; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_phyg ( hHandle : mng_handle; - bEmpty : mng_bool; - iSizex : mng_uint32; - iSizey : mng_uint32; - iUnit : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_jhdr ( hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32; - iColortype : mng_uint8; - iImagesampledepth : mng_uint8; - iImagecompression : mng_uint8; - iImageinterlace : mng_uint8; - iAlphasampledepth : mng_uint8; - iAlphacompression : mng_uint8; - iAlphafilter : mng_uint8; - iAlphainterlace : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_jdat ( hHandle : mng_handle; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; cdecl; - -function mng_putchunk_dhdr ( hHandle : mng_handle; - iObjectid : mng_uint16; - iImagetype : mng_uint8; - iDeltatype : mng_uint8; - iBlockwidth : mng_uint32; - iBlockheight : mng_uint32; - iBlockx : mng_uint32; - iBlocky : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_prom ( hHandle : mng_handle; - iColortype : mng_uint8; - iSampledepth : mng_uint8; - iFilltype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_pplt ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_pplt_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iRed : mng_uint16; - iGreen : mng_uint16; - iBlue : mng_uint16; - iAlpha : mng_uint16; - bUsed : mng_bool ) : mng_retcode; cdecl; - -function mng_putchunk_drop ( hHandle : mng_handle; - iCount : mng_uint32; - pChunknames : mng_chunkidp ) : mng_retcode; cdecl; - -function mng_putchunk_dbyk ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iPolarity : mng_uint8; - iKeywordssize : mng_uint32; - zKeywords : mng_pchar ) : mng_retcode; cdecl; - -function mng_putchunk_ordr ( hHandle : mng_handle; - iCount : mng_uint32 ) : mng_retcode; cdecl; - -function mng_putchunk_ordr_entry ( hHandle : mng_handle; - iEntry : mng_uint32; - iChunkname : mng_chunkid; - iOrdertype : mng_uint8 ) : mng_retcode; cdecl; - -function mng_putchunk_unknown ( hHandle : mng_handle; - iChunkname : mng_chunkid; - iRawlen : mng_uint32; - pRawdata : mng_ptr ) : mng_retcode; cdecl; - -{****************************************************************************} - -function mng_updatemngheader ( hHandle : mng_handle; - iFramecount : mng_uint32; - iLayercount : mng_uint32; - iPlaytime : mng_uint32 ) : mng_retcode; cdecl; - -function mng_updatemngsimplicity ( hHandle : mng_handle; - iSimplicity : mng_uint32 ) : mng_retcode; cdecl; - -{****************************************************************************} - -const MNG_NOERROR = 0; - - MNG_OUTOFMEMORY = 1; - MNG_INVALIDHANDLE = 2; - MNG_NOCALLBACK = 3; - MNG_UNEXPECTEDEOF = 4; - MNG_ZLIBERROR = 5; - MNG_JPEGERROR = 6; - MNG_LCMSERROR = 7; - MNG_NOOUTPUTPROFILE = 8; - MNG_NOSRGBPROFILE = 9; - MNG_BUFOVERFLOW = 10; - MNG_FUNCTIONINVALID = 11; - MNG_OUTPUTERROR = 12; - MNG_JPEGBUFTOOSMALL = 13; - MNG_NEEDMOREDATA = 14; - MNG_NEEDTIMERWAIT = 15; - MNG_NEEDSECTIONWAIT = 16; - - MNG_APPIOERROR = 901; - MNG_APPTIMERERROR = 902; - MNG_APPCMSERROR = 903; - MNG_APPMISCERROR = 904; - MNG_APPTRACEABORT = 905; - - MNG_INTERNALERROR = 999; - - MNG_INVALIDSIG = 1025; - MNG_INVALIDCRC = 1027; - MNG_INVALIDLENGTH = 1028; - MNG_SEQUENCEERROR = 1029; - MNG_CHUNKNOTALLOWED = 1030; - MNG_MULTIPLEERROR = 1031; - MNG_PLTEMISSING = 1032; - MNG_IDATMISSING = 1033; - MNG_CANNOTBEEMPTY = 1034; - MNG_GLOBALLENGTHERR = 1035; - MNG_INVALIDBITDEPTH = 1036; - MNG_INVALIDCOLORTYPE = 1037; - MNG_INVALIDCOMPRESS = 1038; - MNG_INVALIDFILTER = 1039; - MNG_INVALIDINTERLACE = 1040; - MNG_NOTENOUGHIDAT = 1041; - MNG_PLTEINDEXERROR = 1042; - MNG_NULLNOTFOUND = 1043; - MNG_KEYWORDNULL = 1044; - MNG_OBJECTUNKNOWN = 1045; - MNG_OBJECTEXISTS = 1046; - MNG_TOOMUCHIDAT = 1047; - MNG_INVSAMPLEDEPTH = 1048; - MNG_INVOFFSETSIZE = 1049; - MNG_INVENTRYTYPE = 1050; - MNG_ENDWITHNULL = 1051; - MNG_INVIMAGETYPE = 1052; - MNG_INVDELTATYPE = 1053; - MNG_INVALIDINDEX = 1054; - MNG_TOOMUCHJDAT = 1055; - MNG_JPEGPARMSERR = 1056; - MNG_INVFILLMETHOD = 1057; - MNG_OBJNOTCONCRETE = 1058; - MNG_TARGETNOALPHA = 1059; - MNG_MNGTOOCOMPLEX = 1060; - MNG_UNKNOWNCRITICAL = 1061; - MNG_UNSUPPORTEDNEED = 1062; - MNG_INVALIDDELTA = 1063; - MNG_INVALIDMETHOD = 1064; - MNG_IMPROBABLELENGTH = 1065; - MNG_INVALIDBLOCK = 1066; - MNG_INVALIDEVENT = 1067; - MNG_INVALIDMASK = 1068; - MNG_NOMATCHINGLOOP = 1069; - MNG_SEEKNOTFOUND = 1070; - - MNG_INVALIDCNVSTYLE = 2049; - MNG_WRONGCHUNK = 2050; - MNG_INVALIDENTRYIX = 2051; - MNG_NOHEADER = 2052; - MNG_NOCORRCHUNK = 2053; - MNG_NOMHDR = 2054; - - MNG_IMAGETOOLARGE = 4097; - MNG_NOTANANIMATION = 4098; - MNG_FRAMENRTOOHIGH = 4099; - MNG_LAYERNRTOOHIGH = 4100; - MNG_PLAYTIMETOOHIGH = 4101; - MNG_FNNOTIMPLEMENTED = 4102; - - MNG_IMAGEFROZEN = 8193; - -{****************************************************************************} - -const MNG_CANVAS_RGB8 = $00000000; - MNG_CANVAS_RGBA8 = $00001000; - MNG_CANVAS_ARGB8 = $00003000; - MNG_CANVAS_RGB8_A8 = $00005000; - MNG_CANVAS_BGR8 = $00000001; - MNG_CANVAS_BGRX8 = $00010001; - MNG_CANVAS_BGRA8 = $00001001; - MNG_CANVAS_ABGR8 = $00003001; - MNG_CANVAS_RGB16 = $00000100; { not supported yet } - MNG_CANVAS_RGBA16 = $00001100; { not supported yet } - MNG_CANVAS_ARGB16 = $00003100; { not supported yet } - MNG_CANVAS_BGR16 = $00000101; { not supported yet } - MNG_CANVAS_BGRA16 = $00001101; { not supported yet } - MNG_CANVAS_ABGR16 = $00003101; { not supported yet } - MNG_CANVAS_GRAY8 = $00000002; { not supported yet } - MNG_CANVAS_GRAY16 = $00000102; { not supported yet } - MNG_CANVAS_GRAYA8 = $00001002; { not supported yet } - MNG_CANVAS_GRAYA16 = $00001102; { not supported yet } - MNG_CANVAS_AGRAY8 = $00003002; { not supported yet } - MNG_CANVAS_AGRAY16 = $00003102; { not supported yet } - MNG_CANVAS_DX15 = $00000003; { not supported yet } - MNG_CANVAS_DX16 = $00000004; { not supported yet } - -{****************************************************************************} - -const MNG_UINT_HUH = $40404040; - - MNG_UINT_BACK = $4241434b; - MNG_UINT_BASI = $42415349; - MNG_UINT_CLIP = $434c4950; - MNG_UINT_CLON = $434c4f4e; - MNG_UINT_DBYK = $4442594b; - MNG_UINT_DEFI = $44454649; - MNG_UINT_DHDR = $44484452; - MNG_UINT_DISC = $44495343; - MNG_UINT_DROP = $44524f50; - MNG_UINT_ENDL = $454e444c; - MNG_UINT_FRAM = $4652414d; - MNG_UINT_IDAT = $49444154; - MNG_UINT_IEND = $49454e44; - MNG_UINT_IHDR = $49484452; - MNG_UINT_IJNG = $494a4e47; - MNG_UINT_IPNG = $49504e47; - MNG_UINT_JDAT = $4a444154; - MNG_UINT_JHDR = $4a484452; - MNG_UINT_JSEP = $4a534550; - MNG_UINT_LOOP = $4c4f4f50; - MNG_UINT_MEND = $4d454e44; - MNG_UINT_MHDR = $4d484452; - MNG_UINT_MOVE = $4d4f5645; - MNG_UINT_ORDR = $4f524452; - MNG_UINT_PAST = $50415354; - MNG_UINT_PLTE = $504c5445; - MNG_UINT_PPLT = $50504c54; - MNG_UINT_PROM = $50524f4d; - MNG_UINT_SAVE = $53415645; - MNG_UINT_SEEK = $5345454b; - MNG_UINT_SHOW = $53484f57; - MNG_UINT_TERM = $5445524d; - MNG_UINT_bKGD = $624b4744; - MNG_UINT_cHRM = $6348524d; - MNG_UINT_eXPI = $65585049; - MNG_UINT_fPRI = $66505249; - MNG_UINT_gAMA = $67414d41; - MNG_UINT_hIST = $68495354; - MNG_UINT_iCCP = $69434350; - MNG_UINT_iTXt = $69545874; - MNG_UINT_nEED = $6e454544; - MNG_UINT_oFFs = $6f464673; - MNG_UINT_pCAL = $7043414c; - MNG_UINT_pHYg = $70444167; - MNG_UINT_pHYs = $70485973; - MNG_UINT_sBIT = $73424954; - MNG_UINT_sCAL = $7343414c; - MNG_UINT_sPLT = $73504c54; - MNG_UINT_sRGB = $73524742; - MNG_UINT_tEXt = $74455874; - MNG_UINT_tIME = $74494d45; - MNG_UINT_tRNS = $74524e53; - MNG_UINT_zTXt = $7a545874; - - MNG_UINT_evNT = $65764e54; - -{****************************************************************************} - -implementation - -{****************************************************************************} - -const mngdll = 'libmng.so'; - -{****************************************************************************} - -function mng_initialize; external mngdll; -function mng_reset; external mngdll; -function mng_cleanup; external mngdll; - -function mng_read; external mngdll; -function mng_read_resume; external mngdll; -function mng_write; external mngdll; -function mng_create; external mngdll; - -function mng_readdisplay; external mngdll; -function mng_display; external mngdll; -function mng_display_resume; external mngdll; -function mng_display_freeze; external mngdll; -function mng_display_reset; external mngdll; -function mng_display_goframe; external mngdll; -function mng_display_golayer; external mngdll; -function mng_display_gotime; external mngdll; - -function mng_trapevent; external mngdll; - -function mng_getlasterror; external mngdll; - -{****************************************************************************} - -function mng_setcb_memalloc; external mngdll; -function mng_setcb_memfree; external mngdll; - -function mng_setcb_openstream; external mngdll; -function mng_setcb_closestream; external mngdll; - -function mng_setcb_readdata; external mngdll; - -function mng_setcb_writedata; external mngdll; - -function mng_setcb_errorproc; external mngdll; -function mng_setcb_traceproc; external mngdll; - -function mng_setcb_processheader; external mngdll; -function mng_setcb_processtext; external mngdll; - -function mng_setcb_getcanvasline; external mngdll; -function mng_setcb_getalphaline; external mngdll; -function mng_setcb_getbkgdline; external mngdll; -function mng_setcb_refresh; external mngdll; - -function mng_setcb_gettickcount; external mngdll; -function mng_setcb_settimer; external mngdll; - -function mng_setcb_processgamma; external mngdll; -function mng_setcb_processchroma; external mngdll; -function mng_setcb_processsrgb; external mngdll; -function mng_setcb_processiccp; external mngdll; -function mng_setcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_getcb_memalloc; external mngdll; -function mng_getcb_memfree; external mngdll; - -function mng_getcb_openstream; external mngdll; -function mng_getcb_closestream; external mngdll; - -function mng_getcb_readdata; external mngdll; - -function mng_getcb_writedata; external mngdll; - -function mng_getcb_errorproc; external mngdll; -function mng_getcb_traceproc; external mngdll; - -function mng_getcb_processheader; external mngdll; -function mng_getcb_processtext; external mngdll; - -function mng_getcb_getcanvasline; external mngdll; -function mng_getcb_getalphaline; external mngdll; -function mng_getcb_getbkgdline; external mngdll; -function mng_getcb_refresh; external mngdll; - -function mng_getcb_gettickcount; external mngdll; -function mng_getcb_settimer; external mngdll; - -function mng_getcb_processgamma; external mngdll; -function mng_getcb_processchroma; external mngdll; -function mng_getcb_processsrgb; external mngdll; -function mng_getcb_processiccp; external mngdll; -function mng_getcb_processarow; external mngdll; - -{****************************************************************************} - -function mng_set_userdata; external mngdll; - -function mng_set_canvasstyle; external mngdll; -function mng_set_bkgdstyle; external mngdll; - -function mng_set_bgcolor; external mngdll; -function mng_set_usebkgd; external mngdll; - -function mng_set_storechunks; external mngdll; -function mng_set_cacheplayback; external mngdll; - -// function mng_set_viewgamma; external mngdll; -// function mng_set_displaygamma; external mngdll; -// function mng_set_dfltimggamma; external mngdll; -function mng_set_viewgammaint; external mngdll; -function mng_set_displaygammaint; external mngdll; -function mng_set_dfltimggammaint; external mngdll; - -function mng_set_srgb; external mngdll; -function mng_set_outputprofile; external mngdll; -function mng_set_outputprofile2; external mngdll; -function mng_set_srgbprofile; external mngdll; -function mng_set_srgbprofile2; external mngdll; - -function mng_set_maxcanvaswidth; external mngdll; -function mng_set_maxcanvasheight; external mngdll; -function mng_set_maxcanvassize; external mngdll; - -function mng_set_suspensionmode; external mngdll; - -function mng_set_speed; external mngdll; - -{****************************************************************************} - -function mng_get_userdata; external mngdll; - -function mng_get_sigtype; external mngdll; -function mng_get_imagetype; external mngdll; -function mng_get_imagewidth; external mngdll; -function mng_get_imageheight; external mngdll; -function mng_get_ticks; external mngdll; -function mng_get_framecount; external mngdll; -function mng_get_layercount; external mngdll; -function mng_get_playtime; external mngdll; -function mng_get_simplicity; external mngdll; - -function mng_get_canvasstyle; external mngdll; -function mng_get_bkgdstyle; external mngdll; - -procedure mng_get_bgcolor; external mngdll; -function mng_get_usebkgd; external mngdll; - -function mng_get_storechunks; external mngdll; -function mng_get_cacheplayback; external mngdll; - -// function mng_get_viewgamma; external mngdll; -// function mng_get_displaygamma; external mngdll; -// function mng_get_dfltimggamma; external mngdll; -function mng_get_viewgammaint; external mngdll; -function mng_get_displaygammaint; external mngdll; -function mng_get_dfltimggammaint; external mngdll; - -function mng_get_srgb; external mngdll; - -function mng_get_maxcanvaswidth; external mngdll; -function mng_get_maxcanvasheight; external mngdll; - -function mng_get_suspensionmode; external mngdll; - -function mng_get_speed; external mngdll; -function mng_get_imagelevel; external mngdll; - -function mng_get_starttime; external mngdll; -function mng_get_runtime; external mngdll; -function mng_get_currentframe; external mngdll; -function mng_get_currentlayer; external mngdll; -function mng_get_currentplaytime; external mngdll; - -function mng_status_error; external mngdll; -function mng_status_reading; external mngdll; -function mng_status_suspendbreak; external mngdll; -function mng_status_creating; external mngdll; -function mng_status_writing; external mngdll; -function mng_status_displaying; external mngdll; -function mng_status_running; external mngdll; -function mng_status_timerbreak; external mngdll; -function mng_status_dynamic; external mngdll; - -{****************************************************************************} - -function mng_iterate_chunks; external mngdll; - -{****************************************************************************} - -function mng_getchunk_ihdr; external mngdll; -function mng_getchunk_plte; external mngdll; -function mng_getchunk_idat; external mngdll; -function mng_getchunk_trns; external mngdll; -function mng_getchunk_gama; external mngdll; -function mng_getchunk_chrm; external mngdll; -function mng_getchunk_srgb; external mngdll; -function mng_getchunk_iccp; external mngdll; -function mng_getchunk_text; external mngdll; -function mng_getchunk_ztxt; external mngdll; -function mng_getchunk_itxt; external mngdll; -function mng_getchunk_bkgd; external mngdll; -function mng_getchunk_phys; external mngdll; -function mng_getchunk_sbit; external mngdll; -function mng_getchunk_splt; external mngdll; -function mng_getchunk_hist; external mngdll; -function mng_getchunk_time; external mngdll; -function mng_getchunk_mhdr; external mngdll; -function mng_getchunk_loop; external mngdll; -function mng_getchunk_endl; external mngdll; -function mng_getchunk_defi; external mngdll; -function mng_getchunk_basi; external mngdll; -function mng_getchunk_clon; external mngdll; -function mng_getchunk_past; external mngdll; -function mng_getchunk_past_src; external mngdll; -function mng_getchunk_disc; external mngdll; -function mng_getchunk_back; external mngdll; -function mng_getchunk_fram; external mngdll; -function mng_getchunk_move; external mngdll; -function mng_getchunk_clip; external mngdll; -function mng_getchunk_show; external mngdll; -function mng_getchunk_term; external mngdll; -function mng_getchunk_save; external mngdll; -function mng_getchunk_save_entry; external mngdll; -function mng_getchunk_seek; external mngdll; -function mng_getchunk_expi; external mngdll; -function mng_getchunk_fpri; external mngdll; -function mng_getchunk_need; external mngdll; -function mng_getchunk_phyg; external mngdll; -function mng_getchunk_jhdr; external mngdll; -function mng_getchunk_jdat; external mngdll; -function mng_getchunk_dhdr; external mngdll; -function mng_getchunk_prom; external mngdll; -function mng_getchunk_pplt; external mngdll; -function mng_getchunk_pplt_entry; external mngdll; -function mng_getchunk_drop; external mngdll; -function mng_getchunk_dbyk; external mngdll; -function mng_getchunk_ordr; external mngdll; -function mng_getchunk_ordr_entry; external mngdll; -function mng_getchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_putchunk_ihdr; external mngdll; -function mng_putchunk_plte; external mngdll; -function mng_putchunk_idat; external mngdll; -function mng_putchunk_iend; external mngdll; -function mng_putchunk_trns; external mngdll; -function mng_putchunk_gama; external mngdll; -function mng_putchunk_chrm; external mngdll; -function mng_putchunk_srgb; external mngdll; -function mng_putchunk_iccp; external mngdll; -function mng_putchunk_text; external mngdll; -function mng_putchunk_ztxt; external mngdll; -function mng_putchunk_itxt; external mngdll; -function mng_putchunk_bkgd; external mngdll; -function mng_putchunk_phys; external mngdll; -function mng_putchunk_sbit; external mngdll; -function mng_putchunk_splt; external mngdll; -function mng_putchunk_hist; external mngdll; -function mng_putchunk_time; external mngdll; -function mng_putchunk_mhdr; external mngdll; -function mng_putchunk_mend; external mngdll; -function mng_putchunk_loop; external mngdll; -function mng_putchunk_endl; external mngdll; -function mng_putchunk_defi; external mngdll; -function mng_putchunk_basi; external mngdll; -function mng_putchunk_clon; external mngdll; -function mng_putchunk_past; external mngdll; -function mng_putchunk_past_src; external mngdll; -function mng_putchunk_disc; external mngdll; -function mng_putchunk_back; external mngdll; -function mng_putchunk_fram; external mngdll; -function mng_putchunk_move; external mngdll; -function mng_putchunk_clip; external mngdll; -function mng_putchunk_show; external mngdll; -function mng_putchunk_term; external mngdll; -function mng_putchunk_save; external mngdll; -function mng_putchunk_save_entry; external mngdll; -function mng_putchunk_seek; external mngdll; -function mng_putchunk_expi; external mngdll; -function mng_putchunk_fpri; external mngdll; -function mng_putchunk_need; external mngdll; -function mng_putchunk_phyg; external mngdll; -function mng_putchunk_jhdr; external mngdll; -function mng_putchunk_jdat; external mngdll; -function mng_putchunk_dhdr; external mngdll; -function mng_putchunk_prom; external mngdll; -function mng_putchunk_pplt; external mngdll; -function mng_putchunk_pplt_entry; external mngdll; -function mng_putchunk_drop; external mngdll; -function mng_putchunk_dbyk; external mngdll; -function mng_putchunk_ordr; external mngdll; -function mng_putchunk_ordr_entry; external mngdll; -function mng_putchunk_unknown; external mngdll; - -{****************************************************************************} - -function mng_updatemngheader; external mngdll; -function mng_updatemngsimplicity; external mngdll; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/kylix/mngview/Main.dfm b/Engine/lib/lmng/contrib/kylix/mngview/Main.dfm deleted file mode 100644 index 5d231e759f9910988f02d73fdb66c561cffbd63f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2045 zcmd5-OOx9~5T2FS8b5Zurl7dSr$D8^NhppPX=eKC?&*iBr?n}uu=BWm(+Zw+SflzoXDsZt8pW^^ zN!8NHq_87Se-K0Ce3lFK)S2dgk^?i&{pz^i2{{^@+$RoiMpGlTaw`)xnoF^$%`fYX z`enYUW1VofAAg%fccqqAroLx|Vrj~jmDzF5ix%BP6XBkBdbM7p(ppa>a+sa$O4A?n z(s24LN@R2!i;Uefcd;n5V!N+Z{VFn1>E2-&CwOYLDv|6ra6ZQVDP|4xYs?dNij}dI z)wblnmKB6xtybBF6(r`0t=DS^Huhzk4N;hQh(*hLGCbcqM3VFTh373ATMqY9&%@j@ za)kU8Pj>?}Z1;TdePFT#z1+e}Q(z8L)($Yq)6|L?1Do`)(gqBJ z4OsL2lpy?A{sQNKAo0n%HO$z>pNwZ}#IYFbdpJ-7?-;qw<`w$|74qO7@&Ao4^%qk4 z1LgP%bB$b9nC}>rEN&^gSTpt&&Y{v^@BYCXzDnPVyKW-rDi%*WLd|$7XwhvZy3~yl zp$uKNLZPcuNmrLwrn=WpgiuY$L~<6WW~@{3<4h!Xyh82ZfC~^NA~J&G3PND%VxZvl zN-q@0wN55mP!3c_&r;FRbHUF^u!k`7M5OZN)=Wmbf$EL*f)_}YsPnE|ia70xq^qy=+i9iP|?tJ}^NM4JRV*8I^7|S}pEs;aD90ye;6;x2$hzS)G z$d-)7zWwJP5frr!p(^uK!iXL7o`hE4}OQ}X@diV_2^h%gW#w;I76AQOU{%b=V u%Rc`XwkE0!6%)z{>N99%duC}+D75L)&ZF2FAk|EUG%R74%+B+j9rh0xmJg)> diff --git a/Engine/lib/lmng/contrib/kylix/mngview/Main.pas b/Engine/lib/lmng/contrib/kylix/mngview/Main.pas deleted file mode 100644 index 0407b2408..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/Main.pas +++ /dev/null @@ -1,555 +0,0 @@ -unit Main; - -interface - -uses - Qt, QExtCtrls, QDialogs, QMenus, QTypes, QGraphics, QControls, QForms, - SysUtils, Classes, QStdCtrls, IdGlobal, - libmng; - -{****************************************************************************} -{* For conditions of distribution and use, *} -{* see copyright notice in libmng.pas *} -{****************************************************************************} -{* *} -{* project : libmng *} -{* file : main.pas copyright (c) 2000-2002 G.Juyn *} -{* version : 1.0.5 *} -{* *} -{* purpose : Main form for mngview application *} -{* *} -{* author : G.Juyn *} -{* web : http://www.3-t.com *} -{* email : mailto:info@3-t.com *} -{* *} -{* comment : this is the heart of the mngview applciation *} -{* *} -{* changes : 1.0.5 - 09/21/2002 - G.Juyn *} -{* - modified for Kylix use *} -{* *} -{****************************************************************************} - -type - TMainForm = class(TForm) - - OFMainMenu: TMainMenu; - OFMenuFile: TMenuItem; - OFMenuFileOpen: TMenuItem; - OFMenuFileN1: TMenuItem; - OFMenuFileExit: TMenuItem; - - OFTimer: TTimer; - - OFOpenDialog: TOpenDialog; - OFPanel: TPanel; - OFImage: TImage; - - procedure FormCreate(Sender: TObject); - procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); - procedure FormShow(Sender: TObject); - procedure FormResize(Sender: TObject); - procedure FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); - procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); - - procedure OFImageMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); - procedure OFImageMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - procedure OFImageMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); - - procedure OFTimerTimer(Sender: TObject); - - procedure OFMenuFileOpenClick(Sender: TObject); - procedure OFMenuFileExitClick(Sender: TObject); - - private - { Private declarations } - - SFFileName : string; { filename of the input stream } - OFFile : TFileStream; { input stream } - IFHandle : mng_handle; { the libray handle } - OFBitmap : TBitmap; { drawing canvas } - BFCancelled : boolean; { or app-exit } - BFHasMouse : boolean; { mouse is/was over image } - - procedure MNGerror (SHMsg : string); - - public - { Public declarations } - - end; - -var - MainForm: TMainForm; - -{****************************************************************************} - -implementation - -{$R *.dfm} - -{****************************************************************************} - -{$F+} -function Memalloc (iLen : mng_uint32) : mng_ptr; cdecl; -{$F-} -begin - getmem (Result, iLen); { get memory from the heap } - fillchar (Result^, iLen, 0); { and initialize it } -end; - -{****************************************************************************} - -{$F+} -procedure Memfree (iPtr : mng_ptr; - iLen : mng_size_t); cdecl; -{$F-} -begin - freemem (iPtr, iLen); { free the memory } -end; - -{****************************************************************************} - -{$F+} -function Openstream (hHandle : mng_handle) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - if OFFile <> nil then { free previous stream (if any) } - OFFile.Free; - { open a new stream } - OFFile := TFileStream.Create (SFFileName, fmOpenRead or fmShareDenyWrite); - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Closestream (hHandle : mng_handle) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHFORM do - begin - OFFile.Free; { cleanup the stream } - OFFile := nil; { don't use it again ! } - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function Readdata ( hHandle : mng_handle; - pBuf : mng_ptr; - iBuflen : mng_uint32; - var pRead : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin - { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin { are we at EOF ? } - if OFFile.Position >= OFFile.Size then - begin - pRead := 0; { indicate so } - end - else - begin - { read the requested data } - pRead := OFFile.Read (pBuf^, iBuflen); - end; - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function ProcessHeader (hHandle : mng_handle; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - - with OHForm do - begin - OFBitmap.Width := iWidth; { store the new dimensions } - OFBitmap.Height := iHeight; - OFBitmap.PixelFormat := pf32bit; - - OFImage.Left := 0; { adjust the visible component } - OFImage.Top := 0; - OFImage.Width := iWidth; - OFImage.Height := iHeight; - - FormResize (OHForm); { force re-centering the image} - { clear the canvas & draw an outline } - OFBitmap.Canvas.Brush.Color := clGray; - OFBitmap.Canvas.Brush.Style := bsSolid; - OFBitmap.Canvas.FillRect (OFBitmap.Canvas.ClipRect); - - OFImage.Picture.Assign (OFBitmap); { make sure it gets out there } - { tell the library we want funny windows-bgr} - if mng_set_canvasstyle (hHandle, MNG_CANVAS_BGRX8) <> 0 then - MNGerror ('libmng reported an error setting the canvas style'); - - end; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -{$F+} -function GetCanvasLine (hHandle : mng_handle; - iLinenr : mng_uint32) : mng_ptr; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { easy with these bitmap objects ! } - Result := TBitmap(OHForm.OFImage.Picture.Graphic).ScanLine [iLinenr]; -end; - -{****************************************************************************} - -{$F+} -function ImageRefresh (hHandle : mng_handle; - iX : mng_uint32; - iY : mng_uint32; - iWidth : mng_uint32; - iHeight : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - { force redraw } - OHForm.OFImage.Refresh; - - Result := MNG_TRUE; -end; - - -{****************************************************************************} - -{$F+} -function MyGetTickCount (hHandle : mng_handle) : mng_uint32; cdecl; -{$F-} -begin - Result := GetTickCount; { the system knows that } -end; - -{****************************************************************************} - -{$F+} -function SetTimer (hHandle : mng_handle; - iMsecs : mng_uint32) : mng_bool; cdecl; -{$F-} - -var OHForm : TMainForm; - -begin { get a fix on our form } - OHForm := TMainForm (mng_get_userdata (hHandle)); - OHForm.OFTimer.Interval := iMsecs; { and set the timer } - OHForm.OFTimer.Enabled := true; - - Result := MNG_TRUE; -end; - -{****************************************************************************} - -procedure TMainForm.FormCreate(Sender: TObject); - -var IHRed, IHGreen, IHBlue : word; - -begin { initialize } - OFBitmap := TBitmap.Create; - BFHasMouse := false; - OFFile := nil; - - OFOpenDialog.Initialdir := ''; - { now initialize the library } - IFHandle := mng_initialize (mng_ptr(self), Memalloc, Memfree, nil); - - if IFHandle = NIL then - begin - MNGerror ('libmng initialization error' + #13#10 + - 'Program aborted'); - Application.Terminate; - end; - { no need to store chunk-info ! } - mng_set_storechunks (IFHandle, MNG_FALSE); - { do not use suspension-buffer } - mng_set_suspensionmode (IFHandle, MNG_FALSE); - { set all the callbacks } - if (mng_setcb_openstream (IFHandle, Openstream ) <> MNG_NOERROR) or - (mng_setcb_closestream (IFHandle, Closestream ) <> MNG_NOERROR) or - (mng_setcb_readdata (IFHandle, Readdata ) <> MNG_NOERROR) or - (mng_setcb_processheader (IFHandle, ProcessHeader ) <> MNG_NOERROR) or - (mng_setcb_getcanvasline (IFHandle, GetCanvasLine ) <> MNG_NOERROR) or - (mng_setcb_refresh (IFHandle, ImageRefresh ) <> MNG_NOERROR) or - (mng_setcb_gettickcount (IFHandle, MyGetTickCount ) <> MNG_NOERROR) or - (mng_setcb_settimer (IFHandle, SetTimer ) <> MNG_NOERROR) then - begin - MNGerror ('libmng reported an error setting a callback function!' + #13#10 + - 'Program aborted'); - Application.Terminate; - end; - - IHRed := (Color ) and $FF; { supply our own bg-color } - IHGreen := (Color shr 8) and $FF; - IHBlue := (Color shr 16) and $FF; - - IHRed := (IHRed shl 8) + IHRed; - IHGreen := (IHGreen shl 8) + IHGreen; - IHBlue := (IHBlue shl 8) + IHBlue; - - if mng_set_bgcolor (IFHandle, IHRed, IHGreen, IHBlue) <> MNG_NOERROR then - MNGerror ('libmng reported an error setting the background color!'); - -end; - -{****************************************************************************} - -procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); -begin - BFCancelled := true; - - if OFTimer.Enabled then { if we're still animating then stop it } - begin - OFTimer.Enabled := false; - - Application.ProcessMessages; - - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!'); - - end; - - mng_cleanup (IFHandle); -end; - -{****************************************************************************} - -procedure TMainForm.FormShow(Sender: TObject); -begin - FormResize (self); -end; - -{****************************************************************************} - -procedure TMainForm.FormResize(Sender: TObject); -begin { center the image in the window } - if ClientWidth < OFImage.Width then - OFImage.Left := 0 - else - OFImage.Left := (ClientWidth - OFImage.Width ) div 2; - - if ClientHeight < OFImage.Height then - OFImage.Top := 0 - else - OFImage.Top := (ClientHeight - OFImage.Height) div 2; - -end; - -{****************************************************************************} - -procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); -begin - if Key = Key_Escape then { pressing will freeze an animation } - begin - if OFTimer.Enabled then - if mng_display_freeze (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during display_freeze!'); - - OFTimer.Enabled := false; { don't let that timer go off then ! } - BFCancelled := true; - end; -end; - -{****************************************************************************} - -procedure TMainForm.FormMouseMove(Sender: TObject; Shift: TShiftState; X, - Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { if we had the mouse, it's left ! } - begin - if mng_trapevent (IFHandle, 3, 0, 0) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := false; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseMove(Sender: TObject; Shift: TShiftState; - X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - begin - if BFHasMouse then { did we have the mouse already ? } - begin - if mng_trapevent (IFHandle, 2, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - end - else - begin { if not, it has entered ! } - if mng_trapevent (IFHandle, 1, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); - - BFHasMouse := true; - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseDown(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 4, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFImageMouseUp(Sender: TObject; Button: TMouseButton; - Shift: TShiftState; X, Y: Integer); -begin - if mng_status_dynamic (IFHandle) then - if mng_trapevent (IFHandle, 5, X, Y) <> MNG_NOERROR then - MNGerror ('libmng reported an error during trapevent!'); -end; - -{****************************************************************************} - -procedure TMainForm.OFTimerTimer(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFTimer.Enabled := false; { only once ! } - - if not BFCancelled then - begin { and inform the library } - IHRslt := mng_display_resume (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRslt <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error during display_resume!'); - - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileOpenClick(Sender: TObject); - -var IHRslt : mng_retcode; - -begin - OFOpenDialog.InitialDir := ''; - OFOpenDialog.FileName := SFFileName; - - if OFOpenDialog.Execute then { get the filename } - begin - if OFTimer.Enabled then { if the lib was active; stop it } - begin - OFTimer.Enabled := false; - - Application.ProcessMessages; { process any timer requests (for safety) } - { now freeze the animation } - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!'); - end; - { save interesting fields } - SFFileName := OFOpenDialog.FileName; - BFCancelled := false; - - OFImage.Picture.Graphic := nil; { clear the output-canvas } - OFImage.Refresh; - { always reset (just in case) } - if mng_reset (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng reported an error during reset!') - else - begin { and let the lib do it's job ! } - IHRslt := mng_readdisplay (IFHandle); - - if (IHRslt <> MNG_NOERROR) and (IHRSLT <> MNG_NEEDTIMERWAIT) then - MNGerror ('libmng reported an error reading the input file!'); - - end; - end; -end; - -{****************************************************************************} - -procedure TMainForm.OFMenuFileExitClick(Sender: TObject); -begin - if mng_cleanup (IFHandle) <> MNG_NOERROR then - MNGerror ('libmng cleanup error'); - - Close; -end; - -{****************************************************************************} - -procedure TMainForm.MNGerror; - -var iErrorcode : mng_uint32; - iSeverity : mng_uint8; - iChunkname : mng_chunkid; - iChunkseq : mng_uint32; - iExtra1 : mng_int32; - iExtra2 : mng_int32; - zErrortext : mng_pchar; - -begin { get extended info } - iErrorcode := mng_getlasterror (IFHandle, iSeverity, iChunkname, iChunkseq, - iExtra1, iExtra2, zErrortext); - - MessageDlg (SHMsg + #13#10#13#10 + strpas (zErrortext) + #13#10#13#10 + - Format ('Error = %d; Severity = %d; Chunknr = %d; Extra1 = %d', - [iErrorcode, iSeverity, iChunkseq, iExtra1]), - mtError, [mbOK], 0); - Application.Terminate; -end; - -{****************************************************************************} - -end. diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview b/Engine/lib/lmng/contrib/kylix/mngview/mngview deleted file mode 100644 index bd29748bc..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -app_install_dir=/data/Triple-T/Software/mnglib3t/libmng-devel/contrib/kylix/mngview -app_path=$app_install_dir/mngview.bin -app_ld_path=$app_install_dir/lib -# -if [ -n "$LD_LIBRARY_PATH" ]; then - export LD_LIBRARY_PATH="$app_ld_path:$LD_LIBRARY_PATH" -else - export LD_LIBRARY_PATH="$app_ld_path" -fi -# -if [ -z "$LANG" ]; then - export LANG="en_US" -fi -# -exec $app_path $* diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.conf b/Engine/lib/lmng/contrib/kylix/mngview/mngview.conf deleted file mode 100644 index f2aed0130..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview.conf +++ /dev/null @@ -1,33 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I+ --$J- --$K- --$L+ --$M- --$N+ --$O+ --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --H+ --W+ --M --$M16384,1048576 --K$00400000 --DCLX_USE_LIBQT diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.dpr b/Engine/lib/lmng/contrib/kylix/mngview/mngview.dpr deleted file mode 100644 index d16a2ce38..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview.dpr +++ /dev/null @@ -1,17 +0,0 @@ -program mngview; - -uses - QForms, - Main in 'Main.pas' {MainForm}, - libmng in '../libmng.pas'; - -{$E .bin} - -{$R *.res} - -begin - Application.Initialize; - Application.Title := 'mngview - libmng test-viewer in Kylix'; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.kof b/Engine/lib/lmng/contrib/kylix/mngview/mngview.kof deleted file mode 100644 index 70dc3abfc..000000000 --- a/Engine/lib/lmng/contrib/kylix/mngview/mngview.kof +++ /dev/null @@ -1,61 +0,0 @@ -[Compiler] -A=8 -B=0 -C=1 -D=1 -E=0 -F=0 -G=1 -H=1 -I=1 -J=0 -K=0 -L=1 -M=0 -N=1 -O=1 -P=1 -Q=0 -R=0 -S=0 -T=0 -U=0 -V=1 -W=0 -X=1 -Y=1 -Z=1 -ShowHints=1 -ShowWarnings=1 -UnitAliases= - -[Linker] -MapFile=0 -OutputObjs=0 -ConsoleApp=1 -DebugInfo=0 -RemoteSymbols=0 -MinStackSize=16384 -MaxStackSize=1048576 -ImageBase=4194304 -ExeDescription= -DynamicLoader=/lib/ld-linux.so.2 - -[Directories] -OutputDir= -UnitOutputDir= -PackageDLLOutputDir= -PackageDCPOutputDir= -SearchPath= -Packages=baseclx:visualclx:dataclx:visualdbclx:netclx:netdataclx:xmlrtl:indy:webdsnapclx:websnapclx -Conditionals=CLX_USE_LIBQT -DebugSourceDirs= -UsePackages=0 - -[Parameters] -RunParams= -HostApplication= -Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee% -UseLauncher=0 -DebugCWD= - diff --git a/Engine/lib/lmng/contrib/kylix/mngview/mngview.res b/Engine/lib/lmng/contrib/kylix/mngview/mngview.res deleted file mode 100644 index fec7f73cae053e829583819970bdab2ec14c3b9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1688 zcmd6m&u#{NrGG=mFGb=dy=?WLT!HR#*j%^CtDmR zCQ`@sW8#po#FpI?ORK+B%G^xjGW!Kw>A5RN(_?+%hEz}J{|}S;4V0f;$75&;mI-vu zGO#6RbtAtq~9D1m2c)k|jg}sJ?!m#46!d_89WvYdq zqe7muZ>bzKu(q_LUG_(M$!W_g?0UT>XIo#3KY(iS1yvXLx?829TV}$H9r&Bv(MUt> ztEW9R;azpe+|xVt@oTzIT@8@lgBtW;9o?Wt0jzx;YM?g$pF!P5>ijEmpa=NmIXAH+ zdgHYQ)Z8bw=e~zt`y-l;#!TZ5G;;3|83+7A?`8<^;`N#;)@@C1k-MH_O;;9bwTK>4 zZC>Lp-gU@$#BQrD`x1uLstw_7vdvK}_a$au!~ZG1d+urI2jI5p?dd&P1isU{P-|4O zU#Q1q2=zoqL}l1-lW{TUE3&o0)d6Fh^9NAmYeU!Y-JaF6FJ}Gb^ED}({&L?na(#kw zyf29FQ{jkSM+;~*n`-_Y%)d;%W&hKYozGRe?pU%rVV&4q^X@ktM9VSd9nWu>bklEW RhQ3Es7th5zvQqq3{0kdL_KyGn diff --git a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/README.txt b/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/README.txt deleted file mode 100644 index 23b9f1d5a..000000000 --- a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/README.txt +++ /dev/null @@ -1,26 +0,0 @@ -.lib & .def files to link an MSVC project against the standard DLL build with BCB. - -Please note that this version is created for libmng 1.0.5, but should work with -1.0.6 as there were no API changes between the two versions. - -These files are courtesy of Alex Volkov. Here's what he had to say about it: - -------------------------------------------------------------------------------- - -That reminds me, I remade the MSVC libmng.lib for linking to the -bcb-generated dll. The .lib and its corresponding .def are attached. The -.def I generated by simply dumping all the exports from the bcb .dll and -later added the .def to the contrib/msvc/win32dll project. The .def is -necessary for MSVC to name the imports correctly, otherwise it produces -mangled symbol names. What is ironic is that it is not necessary to -completely build the dll with msvc -- you need just the resulting .lib -- -but you still have to setup the entire project for building the dll because of -the stdcall calling convention. The resulting .lib is not perfect -- the hints -are all off, of course -- but it does the job. In any case, the win32 exes -linked with the attached .lib in fact work with bcb-generated dll just fine. I -know the building process can be somehow automated, but I have not had the time -to work on that, and for me it was a one-shot deal. - -Alex. - -------------------------------------------------------------------------------- diff --git a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.def b/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.def deleted file mode 100644 index 5f4f18758..000000000 --- a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.def +++ /dev/null @@ -1,380 +0,0 @@ -LIBRARY libmng -EXPORTS - jcopy_block_row - jcopy_sample_rows - jdiv_round_up - jinit_1pass_quantizer - jinit_2pass_quantizer - jinit_c_coef_controller - jinit_c_main_controller - jinit_c_master_control - jinit_c_prep_controller - jinit_color_converter - jinit_color_deconverter - jinit_compress_master - jinit_d_coef_controller - jinit_d_main_controller - jinit_d_post_controller - jinit_downsampler - jinit_forward_dct - jinit_huff_decoder - jinit_huff_encoder - jinit_input_controller - jinit_inverse_dct - jinit_marker_reader - jinit_marker_writer - jinit_master_decompress - jinit_memory_mgr - jinit_merged_upsampler - jinit_phuff_decoder - jinit_phuff_encoder - jinit_upsampler - jpeg_CreateCompress - jpeg_CreateDecompress - jpeg_abort - jpeg_abort_compress - jpeg_abort_decompress - jpeg_add_quant_table - jpeg_alloc_huff_table - jpeg_alloc_quant_table - jpeg_calc_output_dimensions - jpeg_consume_input - jpeg_copy_critical_parameters - jpeg_default_colorspace - jpeg_destroy - jpeg_destroy_compress - jpeg_destroy_decompress - jpeg_fdct_float - jpeg_fdct_ifast - jpeg_fdct_islow - jpeg_fill_bit_buffer - jpeg_finish_compress - jpeg_finish_decompress - jpeg_finish_output - jpeg_free_large - jpeg_free_small - jpeg_gen_optimal_table - jpeg_get_large - jpeg_get_small - jpeg_has_multiple_scans - jpeg_huff_decode - jpeg_save_markers - jpeg_set_colorspace - jpeg_set_defaults - jpeg_set_linear_quality - jpeg_set_marker_processor - jpeg_set_quality - jpeg_simple_progression - jpeg_start_compress - jpeg_start_decompress - jpeg_start_output - jpeg_std_error - jpeg_stdio_dest - jpeg_stdio_src - jpeg_suppress_tables - jpeg_write_coefficients - jpeg_write_m_byte - jpeg_write_m_header - jpeg_write_marker - jpeg_write_raw_data - jpeg_write_scanlines - jpeg_write_tables - jround_up - jzero_far - mng_cleanup - mng_copy_chunk - mng_create - mng_display - mng_display_freeze - mng_display_goframe - mng_display_golayer - mng_display_gotime - mng_display_reset - mng_display_resume - mng_get_alphabitdepth - mng_get_alphacompression - mng_get_alphadepth - mng_get_alphafilter - mng_get_alphainterlace - mng_get_bgcolor - mng_get_bitdepth - mng_get_bkgdstyle - mng_get_cacheplayback - mng_get_canvasstyle - mng_get_colortype - mng_get_compression - mng_get_currentframe - mng_get_currentlayer - mng_get_currentplaytime - mng_get_dfltimggamma - mng_get_dfltimggammaint - mng_get_displaygamma - mng_get_displaygammaint - mng_get_doprogressive - mng_get_filter - mng_get_framecount - mng_get_imageheight - mng_get_imagelevel - mng_get_imagetype - mng_get_imagewidth - mng_get_interlace - mng_get_jpeg_dctmethod - mng_get_jpeg_maxjdat - mng_get_jpeg_optimized - mng_get_jpeg_progressive - mng_get_jpeg_quality - mng_get_jpeg_smoothing - mng_get_lastbackchunk - mng_get_lastseekname - mng_get_layercount - mng_get_maxcanvasheight - mng_get_maxcanvaswidth - mng_get_playtime - mng_get_refreshpass - mng_get_runtime - mng_get_sectionbreaks - mng_get_sigtype - mng_get_simplicity - mng_get_speed - mng_get_srgb - mng_get_starttime - mng_get_storechunks - mng_get_suspensionmode - mng_get_ticks - mng_get_totalframes - mng_get_totallayers - mng_get_totalplaytime - mng_get_usebkgd - mng_get_userdata - mng_get_viewgamma - mng_get_viewgammaint - mng_get_zlib_level - mng_get_zlib_maxidat - mng_get_zlib_memlevel - mng_get_zlib_method - mng_get_zlib_strategy - mng_get_zlib_windowbits - mng_getcb_closestream - mng_getcb_errorproc - mng_getcb_getalphaline - mng_getcb_getbkgdline - mng_getcb_getcanvasline - mng_getcb_gettickcount - mng_getcb_memalloc - mng_getcb_memfree - mng_getcb_openstream - mng_getcb_processheader - mng_getcb_processneed - mng_getcb_processsave - mng_getcb_processseek - mng_getcb_processterm - mng_getcb_processtext - mng_getcb_processunknown - mng_getcb_readdata - mng_getcb_refresh - mng_getcb_settimer - mng_getcb_writedata - mng_getchunk_back - mng_getchunk_basi - mng_getchunk_bkgd - mng_getchunk_chrm - mng_getchunk_clip - mng_getchunk_clon - mng_getchunk_dbyk - mng_getchunk_defi - mng_getchunk_dhdr - mng_getchunk_disc - mng_getchunk_drop - mng_getchunk_endl - mng_getchunk_evnt - mng_getchunk_evnt_entry - mng_getchunk_expi - mng_getchunk_fpri - mng_getchunk_fram - mng_getchunk_gama - mng_getchunk_hist - mng_getchunk_iccp - mng_getchunk_idat - mng_getchunk_ihdr - mng_getchunk_itxt - mng_getchunk_jdat - mng_getchunk_jhdr - mng_getchunk_loop - mng_getchunk_magn - mng_getchunk_mhdr - mng_getchunk_move - mng_getchunk_need - mng_getchunk_ordr - mng_getchunk_ordr_entry - mng_getchunk_past - mng_getchunk_past_src - mng_getchunk_phyg - mng_getchunk_phys - mng_getchunk_plte - mng_getchunk_pplt - mng_getchunk_pplt_entry - mng_getchunk_prom - mng_getchunk_save - mng_getchunk_save_entry - mng_getchunk_sbit - mng_getchunk_seek - mng_getchunk_show - mng_getchunk_splt - mng_getchunk_srgb - mng_getchunk_term - mng_getchunk_text - mng_getchunk_time - mng_getchunk_trns - mng_getchunk_unknown - mng_getchunk_ztxt - mng_getimgdata_chunk - mng_getimgdata_chunkseq - mng_getimgdata_seq - mng_getlasterror - mng_initialize - mng_iterate_chunks - mng_putchunk_back - mng_putchunk_basi - mng_putchunk_bkgd - mng_putchunk_chrm - mng_putchunk_clip - mng_putchunk_clon - mng_putchunk_dbyk - mng_putchunk_defi - mng_putchunk_dhdr - mng_putchunk_disc - mng_putchunk_drop - mng_putchunk_endl - mng_putchunk_evnt - mng_putchunk_evnt_entry - mng_putchunk_expi - mng_putchunk_fpri - mng_putchunk_fram - mng_putchunk_gama - mng_putchunk_hist - mng_putchunk_iccp - mng_putchunk_idat - mng_putchunk_iend - mng_putchunk_ihdr - mng_putchunk_ipng - mng_putchunk_itxt - mng_putchunk_jdat - mng_putchunk_jhdr - mng_putchunk_jsep - mng_putchunk_loop - mng_putchunk_magn - mng_putchunk_mend - mng_putchunk_mhdr - mng_putchunk_move - mng_putchunk_need - mng_putchunk_ordr - mng_putchunk_ordr_entry - mng_putchunk_past - mng_putchunk_past_src - mng_putchunk_phyg - mng_putchunk_phys - mng_putchunk_plte - mng_putchunk_pplt - mng_putchunk_pplt_entry - mng_putchunk_prom - mng_putchunk_save - mng_putchunk_save_entry - mng_putchunk_sbit - mng_putchunk_seek - mng_putchunk_show - mng_putchunk_splt - mng_putchunk_srgb - mng_putchunk_term - mng_putchunk_text - mng_putchunk_time - mng_putchunk_trns - mng_putchunk_unknown - mng_putchunk_ztxt - mng_putimgdata_ihdr - mng_putimgdata_jhdr - mng_read - mng_read_resume - mng_readdisplay - mng_reset - mng_set_bgcolor - mng_set_bkgdstyle - mng_set_cacheplayback - mng_set_canvasstyle - mng_set_dfltimggamma - mng_set_dfltimggammaint - mng_set_displaygamma - mng_set_displaygammaint - mng_set_doprogressive - mng_set_jpeg_dctmethod - mng_set_jpeg_maxjdat - mng_set_jpeg_optimized - mng_set_jpeg_progressive - mng_set_jpeg_quality - mng_set_jpeg_smoothing - mng_set_maxcanvasheight - mng_set_maxcanvassize - mng_set_maxcanvaswidth - mng_set_outputprofile - mng_set_outputprofile2 - mng_set_outputsrgb - mng_set_sectionbreaks - mng_set_speed - mng_set_srgb - mng_set_srgbimplicit - mng_set_srgbprofile - mng_set_srgbprofile2 - mng_set_storechunks - mng_set_suspensionmode - mng_set_usebkgd - mng_set_userdata - mng_set_viewgamma - mng_set_viewgammaint - mng_set_zlib_level - mng_set_zlib_maxidat - mng_set_zlib_memlevel - mng_set_zlib_method - mng_set_zlib_strategy - mng_set_zlib_windowbits - mng_setcb_closestream - mng_setcb_errorproc - mng_setcb_getalphaline - mng_setcb_getbkgdline - mng_setcb_getcanvasline - mng_setcb_gettickcount - mng_setcb_memalloc - mng_setcb_memfree - mng_setcb_openstream - mng_setcb_processheader - mng_setcb_processmend - mng_setcb_processneed - mng_setcb_processsave - mng_setcb_processseek - mng_setcb_processterm - mng_setcb_processtext - mng_setcb_processunknown - mng_setcb_readdata - mng_setcb_refresh - mng_setcb_settimer - mng_setcb_writedata - mng_status_creating - mng_status_displaying - mng_status_dynamic - mng_status_error - mng_status_reading - mng_status_running - mng_status_runningevent - mng_status_suspendbreak - mng_status_timerbreak - mng_status_writing - mng_supports_func - mng_trapevent - mng_updatemngheader - mng_updatemngsimplicity - mng_version_beta - mng_version_dll - mng_version_major - mng_version_minor - mng_version_release - mng_version_so - mng_version_text - mng_write diff --git a/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.lib b/Engine/lib/lmng/contrib/msvc/libmng-msvc.lib/libmng.lib deleted file mode 100644 index 375db10d52956b45081e495c6e54d5006b7c6b9f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 96386 zcmeHw4VYa;dHBs5&N6(d1vMf_vGY0|L6HX zlqXHERMkERw~?sBXHk*g?Hl! zeEtB1n{ecKN#g!CV*)#I1ir9Q;XxdM2l^E5#u519JcZkE1Rk8Ga2<{u|10sOLB<3g z!V&oLYK4#D2z=#4h1+oi9-5(WBaR$TOMJDTF@cA11RlnD1U`l%@U>oryKn>^nX7ehBP@oxqoI1b&2k3EYb#@D%bTa3_wyk7p~q6Gs5WEYZM` z<1vY!;5-5-o1Xwr<2(ZI#S!@FEQOnJZbkK+jZ4CfKJ8%N+-@C(4^S&nBV ze!hV*fd_E}o?E4Wygvv00_7-hD~`bPQx&emkpt)9_~noS%J7%K3u_dRhZlffov3gJ zj=+mE72b{`2hPFqYn(^mQ5=Dna2|nsaRh#|T;VPp?_wD{O5x9O1hVN0*W$?Wltj-4 zmI*wFBd|xG!reFmQ*a&uoMQ^GC(a{q1CAUoNbJ>MnZOe`0()Pf@Bog$RGe4fLpTEa zEKs-|M_}513fJMt@wCLgxIO_~+rGf`6$LKT@4*px%}j+GapZVjVkXWZumeY6|8)wV#t}FG*CX&j9DxImQb1W92plwB0cCX% z2hPiJ@Fs;vaRg?qQNXp$0uEWO@BtiwL+2{I3rFCvsS0nyk>eSO+5IdNcnC+}@Us*? zj3Y2-zQXM|0!N_S1#pfdIB*`0xq}K1;|Lsij>1Q91ddvua0iaS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H)_@`wPve6-l+7~5Hz@?uTNsW@^^i{!O>AlSGW&Ij6B}q zvyD|ZjW@f;_j>_fy-}JkF$%cJ=WEtRYt>e*TncQ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/Makefile b/Engine/lib/lmng/contrib/msvc/makemng/Makefile deleted file mode 100644 index b5c31b5f5..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -######################################################################## -# This is a GNU makefile - tested on CYGWIN and Linux -# -# You may need to compile or install libmng before compiling this. -# Libmng also requires zlib, jpeg and lcms -# - -TARGET = makemng -# These flags are needed to get it to compile with libmng.dll on CYGWIN -# CYGWINFLAGS = -DMNG_USE_DLL -CYGWINFLAGS = -MNGFLAGS = -I. -DMNG_SKIP_LCMS -DMNG_SKIP_IJG6B \ - -DMNG_SUPPORT_READ -DMNG_SUPPORT_WRITE -DMNG_SUPPORT_DISPLAY \ - -DMNG_ACCESS_CHUNKS - -CC = gcc -CFLAGS = -W -Wall -O0 # -g -LIBS = -L/usr/local/lib -lmng -lm -lz -ljpeg -llcms -LDFLAGS= - -BINS = $(TARGET) $(TARGET).exe -SRCS = makemng.c filelist.c -OBJS = makemng.o filelist.o - -.SUFFIXES: .c .o - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c $(MNGFLAGS) $(CYGWINFLAGS) - -all: $(TARGET) - -$(TARGET): $(OBJS) - $(CC) -o $(TARGET) $(OBJS) $(LIBS) $(LDFLAGS) - -clean: - rm -f $(BINS) *.o - diff --git a/Engine/lib/lmng/contrib/msvc/makemng/README b/Engine/lib/lmng/contrib/msvc/makemng/README deleted file mode 100644 index dbd26ea89..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/README +++ /dev/null @@ -1,24 +0,0 @@ -MAKEMNG - Jan 10, 2003 - -A simple MNG encoder. MAKEMNG takes a bunch of still frames (PNGs) -as input, computes delta images and stuffs it all into an MNG, thus -creating an animation. - -You will need zlib to compile and run this app. -The included Makefile should work on Linux and CYGWIN. -The MSVC project will most likely need modifications for your -environment. - -usage: makemng [-v] [-f rate] [-r] [-s size] [-o outputfile] -produces an MNG animation from a bunch of frame images -options: - -v : be verbose, explains things no human should know - -f rate : sets the framerate; rate is 1..100 per second (default 5) - -b : auto-select background frame (instead of frame0) - -r : split delta frames into full rectangles only - -s size : enable sector cleanup and set sector size (8..64) -diagnostical options: - -d : generate delta-mask PNGs (form: mask_FRM1_FRM2.png) - -------------- -Alex Volkov diff --git a/Engine/lib/lmng/contrib/msvc/makemng/filelist.c b/Engine/lib/lmng/contrib/msvc/makemng/filelist.c deleted file mode 100644 index 852d018f6..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/filelist.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* This file contains two versions of make_file_list(); one for Windows, and - * one for other systems (POSIX). - */ -#ifdef WIN32 -#include -#include -#include -#include - -char** -make_file_list (const char* pattern, int* pnum_entries) -{ - int num_entries, length; - char** StringTable; - char** lpLastOffs; - - num_entries = 0; - StringTable = 0; - do - { - int slen; - long handle; - struct _finddata_t f; - - if (num_entries == 0) - length = 0; - else - { - slen = (num_entries + 1) * sizeof (char*); - StringTable = (char**) malloc (slen + length); - if (StringTable == 0) - break; - - lpLastOffs = StringTable; - *lpLastOffs = (char*)StringTable + slen; - - num_entries = 0; - length = slen; - } - - handle = _findfirst (pattern, &f); - if (handle != -1) - { - do - { - if (f.attrib & (_A_HIDDEN | _A_SUBDIR | _A_SYSTEM)) - continue; - - slen = strlen (f.name) + 1; - length += slen; - - if (StringTable) - { - char *lpStr; - char **lpLo, **lpHi; - - lpLo = StringTable; - lpHi = lpLastOffs - 1; - while (lpLo <= lpHi) - { - char c1, c2; - char *pStr; - int LocLen; - char **lpMid; - - lpMid = lpLo + ((lpHi - lpLo) >> 1); - - LocLen = lpMid[1] - lpMid[0]; - if (LocLen > slen) - LocLen = slen; - - lpStr = lpMid[0]; - pStr = f.name; - while (LocLen-- - && (c1 = toupper (*lpStr++)) - == (c2 = toupper (*pStr++))) - ; - - if (c1 <= c2) - lpLo = lpMid + 1; - else - lpHi = lpMid - 1; - } - - lpStr = lpLo[0]; - memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]); - strcpy (lpStr, f.name); - - for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi) - lpHi[1] = lpHi[0] + slen; - } - - ++num_entries; - - } while (_findnext (handle, &f) == 0); - - _findclose (handle); - } - } while (num_entries && StringTable == 0); - - if (StringTable == 0) - *pnum_entries = 0; - else - *pnum_entries = num_entries; - - return StringTable; -} - -#else /* ! defined(WIN32) */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -char** -make_file_list (const char* pattern, int* pnum_entries) -{ - size_t num_entries, length; - char** StringTable; - char** lpLastOffs; - char* slash; // Pointer inside pattern to the last / - char path[PATH_MAX]; // buffer for a filename with path - char* file; // Pointer inside path to the filename - size_t pathlen; // length of path, excluding last / and filename - - slash = (char*) strrchr ((const char *) pattern, '/'); - if (slash == NULL) - { - pathlen = 1; - path[0] = '.'; - } - else - { - pathlen = slash - pattern; - memcpy (path, pattern, pathlen); - pattern = slash + 1; - } - file = path + pathlen + 1; - - num_entries = 0; - StringTable = 0; - do - { - int slen; - DIR *handle; - - if (num_entries == 0) - length = 0; - else - { - slen = (num_entries + 1) * sizeof (char*); - StringTable = (char**) malloc (slen + length); - if (StringTable == 0) - break; - - lpLastOffs = StringTable; - *lpLastOffs = (char*)StringTable + slen; - - num_entries = 0; - length = slen; - } - - path[pathlen] = '\0'; // strip any file part - handle = opendir((const char *) path); - if (handle != NULL) - { - path[pathlen] = '/'; - // change the 0 char to a slash; a filename will be - // attached here. - while (1) - { - struct dirent *de; - struct stat sb; - - de = readdir(handle); - if (de == NULL) - break; - if (de->d_name[0] == '.') - continue; - strcpy (file, de->d_name); - // attach the filename to path - if (stat(path, &sb) == -1) - continue; - if (!S_ISREG(sb.st_mode)) - continue; - if (fnmatch(pattern, de->d_name, 0) != 0) - continue; - - slen = strlen (de->d_name) + 1; - length += slen; - - if (StringTable) - { - char *lpStr; - char **lpLo, **lpHi; - - lpLo = StringTable; - lpHi = lpLastOffs - 1; - while (lpLo <= lpHi) - { - char c1, c2; - char *pStr; - int LocLen; - char **lpMid; - - lpMid = lpLo + ((lpHi - lpLo) >> 1); - - LocLen = lpMid[1] - lpMid[0]; - if (LocLen > slen) - LocLen = slen; - - lpStr = lpMid[0]; - pStr = de->d_name; - while (LocLen-- - && (c1 = toupper (*lpStr++)) - == (c2 = toupper (*pStr++))) - ; - - if (c1 <= c2) - lpLo = lpMid + 1; - else - lpHi = lpMid - 1; - } - - lpStr = lpLo[0]; - memmove (lpStr + slen, lpStr, lpLastOffs[0] - lpLo[0]); - strcpy (lpStr, de->d_name); - - for (lpHi = lpLastOffs++; lpHi >= lpLo; --lpHi) - lpHi[1] = lpHi[0] + slen; - } - - ++num_entries; - } - closedir(handle); - } - } while (num_entries && StringTable == 0); - - if (StringTable == 0) - *pnum_entries = 0; - else - *pnum_entries = num_entries; - - return StringTable; -} - -#endif - -void -free_file_list (char** list) -{ - if (list) - free(list); -} diff --git a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.c b/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.c deleted file mode 100644 index 08d13d4aa..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.c +++ /dev/null @@ -1,1060 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#include - -#ifndef HAVE_GETOPT_H -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. */ -# if defined HAVE_LIBINTL_H || defined _LIBC -# include -# ifndef _ -# define _(msgid) gettext (msgid) -# endif -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -int optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -#ifndef WIN32 -# if HAVE_STRING_H -# include -# else -# include -# endif -#else -# include -#endif - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (); -#endif - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Stored original parameters. - XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ -extern int __libc_argc; -extern char **__libc_argv; - -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -# ifdef USE_NONOPTION_FLAGS -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; -# endif - -# ifdef USE_NONOPTION_FLAGS -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -# else -# define SWAP_FLAGS(ch1, ch2) -# endif -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#if defined _LIBC && defined USE_NONOPTION_FLAGS - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = HMalloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#if defined _LIBC && defined USE_NONOPTION_FLAGS - if (posixly_correct == NULL - && argc == __libc_argc && argv == __libc_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) HMalloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int print_errors = opterr; - if (optstring[0] == ':') - print_errors = 0; - - if (argc < 1) - return -1; - - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#if defined _LIBC && defined USE_NONOPTION_FLAGS -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else if (long_only - || pfound->has_arg != p->has_arg - || pfound->flag != p->flag - || pfound->val != p->val) - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (print_errors) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (print_errors) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (print_errors) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (print_errors) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (print_errors) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (print_errors) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - -#endif /* HAVE_GETOPT_H */ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.h b/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.h deleted file mode 100644 index a1b8dd665..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt.h +++ /dev/null @@ -1,180 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _GETOPT_H - -#ifndef __need_getopt -# define _GETOPT_H 1 -#endif - -/* If __GNU_LIBRARY__ is not already defined, either we are being used - standalone, or this is the first header included in the source file. - If we are being used with glibc, we need to include , but - that does not exist if we are standalone. So: if __GNU_LIBRARY__ is - not defined, include , which will pull in for us - if it's from glibc. (Why ctype.h? It's guaranteed to exist and it - doesn't flood the namespace with stuff the way some other headers do.) */ -#if !defined __GNU_LIBRARY__ -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -#ifndef __need_getopt -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -# if (defined __STDC__ && __STDC__) || defined __cplusplus - const char *name; -# else - char *name; -# endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -# define no_argument 0 -# define required_argument 1 -# define optional_argument 2 -#endif /* need getopt */ - - -/* Get definitions and prototypes for functions to process the - arguments in ARGV (ARGC of them, minus the program name) for - options given in OPTS. - - Return the option character from OPTS just read. Return -1 when - there are no more options. For unrecognized options, or options - missing arguments, `optopt' is set to the option letter, and '?' is - returned. - - The OPTS string is a list of characters which are recognized option - letters, optionally followed by colons, specifying that that letter - takes an argument, to be placed in `optarg'. - - If a letter in OPTS is followed by two colons, its argument is - optional. This behavior is specific to the GNU `getopt'. - - The argument `--' causes premature termination of argument - scanning, explicitly telling `getopt' that there are no more - options. - - If OPTS begins with `--', then non-option arguments are treated as - arguments to the option '\0'. This behavior is specific to the GNU - `getopt'. */ - -#if (defined __STDC__ && __STDC__) || defined __cplusplus -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int __argc, char *const *__argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ - -# ifndef __need_getopt -extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, - const struct option *__longopts, int *__longind); -extern int getopt_long_only (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int __argc, char *const *__argv, - const char *__shortopts, - const struct option *__longopts, int *__longind, - int __long_only); -# endif -#else /* not __STDC__ */ -extern int getopt (); -# ifndef __need_getopt -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -# endif -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -/* Make sure we later can get all the definitions and declarations. */ -#undef __need_getopt - -#endif /* getopt.h */ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt1.c b/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt1.c deleted file mode 100644 index 57eee0821..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/getopt/getopt1.c +++ /dev/null @@ -1,189 +0,0 @@ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include - -#ifndef HAVE_GETOPT_H -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; -{ - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - int option_index = 0; - static struct option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ - -#endif /* HAVE_GETOPT_H */ diff --git a/Engine/lib/lmng/contrib/msvc/makemng/makemng.c b/Engine/lib/lmng/contrib/msvc/makemng/makemng.c deleted file mode 100644 index 878b07134..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/makemng.c +++ /dev/null @@ -1,1765 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -# include -#else -# include -#endif - - -struct options -{ - char *inmask; - char *inpath; - char *outfile; - int framerate; - char verbose; - char backimage; - char deltamask; - int sectorsize; - int fullrects; -} opts; - -// externals -char** make_file_list (const char* pattern, int* pnum_entries); -void free_file_list (char** list); - -// internals -int error (int errn, const char* fmt, const char* s); -void verbose (const char* fmt, const char* s); -void verbose_d (const char* fmt, int val); -void parse_arguments (int argc, char *argv[], struct options *opts); -int read_file_list (void); -void calc_mng_dims (void); -void select_back_image (void); -void delta_images (void); -int write_mng_file (void); - -typedef union -{ - struct - { - unsigned char r, g, b, a; - } bchan; - unsigned char channels[4]; - unsigned int value; -} RGBA; - -typedef struct _file_info -{ - FILE* f; - char* fname; - char* fmode; - int w, h; - int x, y; - RGBA* image; - unsigned char* indimg; - int delay; - int identical; - unsigned short objid; - unsigned short cloneid; - int clone; - unsigned short precloneid; - int preclone; - struct _file_info* next; -} file_info; - -void file_info_free (); - -// MNG callbacks -mng_ptr MNG_DECL mng_alloc (mng_size_t iLen); -void MNG_DECL mng_free (mng_ptr pPtr, mng_size_t iLen); -mng_bool MNG_DECL mng_open_stream(mng_handle mng); -mng_bool MNG_DECL mng_close_stream(mng_handle mng); -mng_bool MNG_DECL mng_read_stream(mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes); -mng_bool MNG_DECL mng_write_stream (mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes); -mng_bool MNG_DECL mng_process_header(mng_handle mng, mng_uint32 width, mng_uint32 height); -mng_ptr MNG_DECL mng_get_canvasline_read(mng_handle mng, mng_uint32 line); -mng_ptr MNG_DECL mng_get_canvasline_write(mng_handle mng, mng_uint32 line); -mng_bool MNG_DECL mng_refresh_display(mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h); -mng_uint32 MNG_DECL mng_get_tickcount(mng_handle mng); -mng_bool MNG_DECL mng_set_timer(mng_handle mng, mng_uint32 msecs); - -#define MAX_COLORS 0x100 - -// global png/mng data -char** Files = 0; -int cFiles = 0; -file_info* Infos = 0; -mng_palette8 Pal; -int cPalClr = 0; -int mngw = 0, mngh = 0; -int iback = 0; -int timerate = 100; // default 100 ticks per second -int framedelay = 20; // default 5 fps -int _curframe = -1; -int _curdeltaframe = -1; - -int -main(int argc, char* argv[]) -{ - int ret = 0; - - parse_arguments (argc, argv, &opts); - - if (opts.framerate) // update delay - framedelay = timerate / opts.framerate; - - if (!opts.inpath && (strchr (opts.inmask, '/') || strchr (opts.inmask, '\\'))) - { - char *pch1, *pch2; - - opts.inpath = (char*) calloc (strlen (opts.inmask), 1); - if (!opts.inpath) - return error (EXIT_FAILURE, "No memory", 0); - - strcpy (opts.inpath, opts.inmask); - pch1 = strrchr (opts.inpath, '/'); - pch2 = strrchr (opts.inpath, '\\'); - if (pch2 > pch1) - pch1 = pch2; - - pch1[1] = 0; // term the path - - verbose ("Frame files in dir: %s\n", opts.inpath); - } - - if (!opts.outfile) - { - char* pch; - - opts.outfile = (char*) calloc (strlen(opts.inmask) + 6, 1); - if (!opts.outfile) - return error (EXIT_FAILURE, "No memory", 0); - - strcpy (opts.outfile, opts.inmask); - while ((pch = strchr (opts.outfile, '*')) != 0) - strcpy (pch, pch + 1); - - pch = strstr (opts.outfile, ".png"); - if (!pch) - pch = opts.outfile + strlen (opts.outfile); - strcpy (pch, ".mng"); - - if (pch == opts.outfile || pch[-1] == '/' || pch[-1] == '\\') - { // have to fix blank name - memmove (pch + 1, pch, strlen(pch) + 1); - *pch = '1'; - } - - verbose ("Output file: %s\n", opts.outfile); - } - - fprintf (stderr, "using timerate of %d and framedelay of %d\n", timerate, framedelay); - - ret = read_file_list (); - if (!ret) - { - calc_mng_dims (); - if (opts.backimage) - select_back_image (); - delta_images (); - - ret = write_mng_file (); - } - - file_info_free (); - free_file_list (Files); - - return ret; -} - -int -error(int errn, const char* fmt, const char* s) -{ - fprintf(stderr, fmt, s); - return errn; -} - -void -verbose(const char* fmt, const char* s) -{ - if (!opts.verbose) - return; - - fprintf(stderr, fmt, s); -} - -void verbose_d (const char* fmt, int val) -{ - if (!opts.verbose) - return; - - fprintf(stderr, fmt, val); -} - -void -usage() -{ - fprintf(stderr, "usage: makemng [-v] [-f rate] [-r] [-s size] [-o outputfile] \n"); - fprintf(stderr, "produces an MNG animation from a bunch of frame images\n"); - fprintf(stderr, "options:\n"); - fprintf(stderr, " -v\t\t : be verbose, explains things no human should know\n"); - fprintf(stderr, " -f rate\t : sets the framerate; rate is 1..100 per second (default 5)\n"); - fprintf(stderr, " -b\t\t : auto-select background frame (instead of frame0)\n"); - fprintf(stderr, " -r\t\t : split delta frames into full rectangles only\n"); - fprintf(stderr, " -s size\t : enable sector cleanup and set sector size (8..64)\n"); - fprintf(stderr, "diagnostical options:\n"); - fprintf(stderr, " -d\t\t : generate delta-mask PNGs (form: mask_FRM1_FRM2.png)\n"); -} - -void -parse_arguments(int argc, char *argv[], struct options *opts) -{ - char ch; - - memset(opts, '\0', sizeof (struct options)); - while ((ch = getopt(argc, argv, "?hvbdrf:s:o:")) != -1) - { - switch(ch) - { - case 'o': - opts->outfile = optarg; - break; - case 'f': - opts->framerate = atoi(optarg); - if (opts->framerate < 1 || opts->framerate > 100) - { - fprintf(stderr, "invalid -f option value\n"); - usage(); - exit(EXIT_FAILURE); - } - break; - case 'd': - opts->deltamask = 1; - break; - case 'b': - opts->backimage = 1; - break; - case 'r': - opts->fullrects = 1; - break; - case 's': - opts->sectorsize = atoi(optarg); - if (opts->sectorsize < 8 || opts->sectorsize > 64) - { - fprintf(stderr, "invalid -r option value\n"); - usage(); - exit(EXIT_FAILURE); - } - break; - case 'v': - opts->verbose = 1; - break; - case '?': - case 'h': - default: - usage(); - exit(EXIT_FAILURE); - } - } - - argc -= optind; - argv += optind; - if (argc != 1) - { - usage(); - exit(EXIT_FAILURE); - } - - opts->inmask = argv[0]; -} - -void -make_file_name(int index, char* buf) -{ - if (opts.inpath) - strcpy(buf, opts.inpath); - else - *buf = 0; - - strcat(buf, Files[index]); -} - -void -file_info_init (file_info* ms) -{ - memset(ms, 0, sizeof(*ms)); - ms->identical = -1; - ms->clone = -1; - ms->preclone = -1; -} - -void -file_info_cleanup (file_info* ms) -{ - file_info* fi = ms; - - while (fi) - { - file_info* tempi = fi; - - if (fi->image) - { - free(fi->image); - fi->image = 0; - } - - if (fi->indimg) - { - free(fi->indimg); - fi->indimg = 0; - } - - if (fi->f) - { - fclose(fi->f); - fi->f = 0; - } - - - fi = fi->next; - if (tempi != ms) - free (tempi); - } -} - -void -file_info_free () -{ - int i; - - if (Infos) - { - for (i = 0; i < cFiles; i++) - file_info_cleanup (Infos + i); - - free (Infos); - Infos = 0; - } -} - -int -equal_colors (RGBA rgba, mng_palette8e mng_clr) -{ - return rgba.bchan.r == mng_clr.iRed && - rgba.bchan.g == mng_clr.iGreen && - rgba.bchan.b == mng_clr.iBlue; -} - -int -lookup_palette (RGBA rgba) -{ - int i; - - for (i = 0; i < cPalClr && !equal_colors(rgba, Pal[i]); i++) - ; - - return i < cPalClr ? i : -1; -} - -int -update_palette (file_info* ms) -{ - int i; - - for (i = 0; i < ms->w * ms->h; i++) - { - RGBA rgba = ms->image[i]; - int ipal = lookup_palette (rgba); - if (ipal == -1) - { // add color - if (cPalClr >= MAX_COLORS) - return 1; - - Pal[cPalClr].iRed = rgba.bchan.r; - Pal[cPalClr].iGreen = rgba.bchan.g; - Pal[cPalClr].iBlue = rgba.bchan.b; - cPalClr++; - } - } - return 0; -} - -int -convert_image_indexed (file_info* ms) -{ - int i; - - ms->indimg = (unsigned char*) malloc (ms->w * ms->h); - if (!ms->indimg) - return 230; - - for (i = 0; i < ms->w * ms->h; i++) - { - int ipal = lookup_palette (ms->image[i]); - - if (ipal == -1) - return 1; // something is screwed - - ms->indimg[i] = ipal; - } - - free (ms->image); - ms->image = 0; - - return 0; -} - -int -read_file_list (void) -{ - int ret = 0; - mng_handle mng; - char namebuf[260]; - int i; - - cFiles = 0; - Files = make_file_list(opts.inmask, &cFiles); - - if (!Files || cFiles == 0) - { - fprintf (stderr, "No frame files found\n"); - return 1; - } - - Infos = (file_info*) malloc (sizeof(file_info) * cFiles); - if (!Infos) - return 251; - - memset(Infos, 0, sizeof(file_info) * cFiles); - - mng = mng_initialize (MNG_NULL, mng_alloc, mng_free, MNG_NULL); - if (mng == MNG_NULL) - return 250; - - // set the callbacks - mng_setcb_openstream(mng, mng_open_stream); - mng_setcb_closestream(mng, mng_close_stream); - mng_setcb_readdata(mng, mng_read_stream); - mng_setcb_processheader(mng, mng_process_header); - mng_setcb_getcanvasline(mng, mng_get_canvasline_read); - mng_setcb_gettickcount(mng, mng_get_tickcount); - mng_setcb_settimer(mng, mng_set_timer); - mng_setcb_refresh(mng, mng_refresh_display); - - for (i = 0; i < cFiles && !ret; i++) - { - file_info* rf = Infos + i; - - file_info_init (rf); - make_file_name (i, namebuf); - rf->fname = namebuf; - rf->fmode = "rb"; - - verbose_d ("%03d ", i); verbose ("reading '%s'...", rf->fname); - - mng_reset (mng); - mng_set_userdata (mng, rf); - - for (ret = mng_readdisplay (mng); - ret == MNG_NEEDMOREDATA || ret == MNG_NEEDTIMERWAIT; - ret = mng_display_resume (mng)) - { - if (ret == MNG_NEEDTIMERWAIT) - rf->delay = 0; - } - - if (ret) - { - fprintf (stderr, "Could not read '%s'\n", rf->fname); - ret = 2; - } - - ret = update_palette (rf); - if (ret) - { - fprintf (stderr, "Too many unique colors (%d processed), giving up\n", i); - ret = 3; - } - - ret = convert_image_indexed (rf); - if (ret) - { - fprintf (stderr, "Image conversion failed on '%s'\n", rf->fname); - ret = 4; - } - - verbose (" done\n", 0); - } - - mng_cleanup (&mng); - - if (ret == MNG_NOERROR) - fprintf (stderr, "%d animation frames\n", cFiles); - - return ret; -} - -void -calc_mng_dims (void) -{ - int i; - - mngw = mngh = -1; - - // get max dims - for (i = 0; i < cFiles; i++) - { - if (Infos[i].w > mngw) - mngw = Infos[i].w; - - if (Infos[i].h > mngh) - mngh = Infos[i].h; - } - - // adjust images - center - for (i = 0; i < cFiles; i++) - { - if (Infos[i].w < mngw) - Infos[i].x = (mngw - Infos[i].w) >> 1; - - if (Infos[i].h < mngh) - Infos[i].y = (mngh - Infos[i].h) >> 1; - } -} - -int -compare_images (file_info* i1, file_info* i2) -{ - int cnt = 0; - int w, h, x, y; - int dx1, dx2, dy1, dy2; - - if (i1->w > i2->w) - { - w = i2->w; - dx1 = i2->x; - dx2 = 0; - } - else if (i1->w < i2->w) - { - w = i1->w; - dx1 = 0; - dx2 = i1->x; - } - else - { - w = i1->w; - dx1 = dx2 = 0; - } - - if (i1->h > i2->h) - { - h = i2->h; - dy1 = i2->y; - dy2 = 0; - } - else if (i1->h < i2->h) - { - h = i1->h; - dy1 = 0; - dy2 = i1->y; - } - else - { - h = i1->h; - dy1 = dy2 = 0; - } - - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (i1->indimg[(y + dy1) * i1->w + x + dx1] != i2->indimg[(y + dy2) * i2->w + x + dx2]) - cnt++; - } - } - return cnt; -} - -void -select_back_image (void) -{ - int i; - int* cdiff; - int max; - - cdiff = (int*) calloc (cFiles, sizeof(int)); - if (!cdiff) - return; - - verbose ("selecting optimal background image...", 0); - - for (i = 2; i < cFiles; i++) - { - if (Infos[i].w == mngw && Infos[i].h == mngh) - { - cdiff[i] = compare_images (Infos + i, Infos + i - 1) - - compare_images (Infos + i, Infos + 0); - } - else - { - // image is smaller than animation and cannot be background - cdiff[i] = 0x7fffffff; - } - } - - // the difference has to be big enough - // or it will be useless - iback = 0; - max = mngw * mngh / 32; - - for (i = 2; i < cFiles; i++) - { - if (cdiff[i] > max) - { - iback = i; - max = cdiff[i]; - } - } - - verbose (" done\n", 0); - fprintf(stderr, "frame %03d selected as background\n", iback); -} - -int -equal_images (int i1, int i2) -{ - // deference identical chain - while (Infos[i1].identical != -1) - i1 = Infos[i1].identical; - while (Infos[i2].identical != -1) - i2 = Infos[i2].identical; - - if (i1 == i2) - return 1; - - if (Infos[i1].x != Infos[i2].x || Infos[i1].y != Infos[i2].y - || Infos[i1].w != Infos[i2].w || Infos[i1].h != Infos[i2].h) - return 0; - - return compare_images (Infos + i1, Infos + i2) == 0; -} - -int -delta_adjust_positions (int* pos1, int* pos2) -{ - if (*pos1 <= *pos2) - return 1; - else - { - (*pos1)--; - (*pos2)--; - return -1; - } -} - -void -clean_expansion_horz (unsigned char* mask, int w, int x1, int y1, int x2, int y2, int threshold) -{ - int x, y, dx, dy; - // assume anything out of bounds is cleared - int prevclear = threshold + 1; - - dy = delta_adjust_positions (&y1, &y2); - dx = delta_adjust_positions (&x1, &x2); - - for (y = y1; y != y2; y += dy) - { - int dcnt, ecnt; - - dcnt = ecnt = 0; - - for (x = x1; x != x2; x += dx) - { - if (mask[y * w + x] == 1) - dcnt++; - else if (mask[y * w + x] == 2 || mask[y * w + x] == 3) - ecnt++; - } - - if (dcnt == 0 && ecnt == 0) - { // line is clear - prevclear++; - } - else if (dcnt == 0) - { - if (prevclear >= threshold) - { // it's not clear yet, but it will be in a moment ;) - int lx, ly = y; - - if (prevclear == threshold) - { // need to clean everything we just checked - ly = y - prevclear * dy; - } - - for (ly = ly; ly != y + dy; ly += dy) - for (lx = x1; lx != x2; lx += dx) - mask[ly * w + lx] = 0; - } - prevclear++; - } - else - { // line is dirty - prevclear = 0; - } - } -} - -void -clean_expansion_vert (unsigned char* mask, int w, int x1, int y1, int x2, int y2, int threshold) -{ - int x, y, dx, dy; - // assume anything out of bounds is cleared - int prevclear = threshold + 1; - - dy = delta_adjust_positions (&y1, &y2); - dx = delta_adjust_positions (&x1, &x2); - - for (x = x1; x != x2; x += dx) - { - int dcnt, ecnt; - - dcnt = ecnt = 0; - - for (y = y1; y != y2; y += dy) - { - if (mask[y * w + x] == 1) - dcnt++; - else if (mask[y * w + x] == 2 || mask[y * w + x] == 3) - ecnt++; - } - - if (dcnt == 0 && ecnt == 0) - { // line is clear - prevclear++; - } - else if (dcnt == 0) - { - if (prevclear >= threshold) - { // it's not clear yet, but it will be in a moment ;) - int ly, lx = x; - - if (prevclear == threshold) - { // need to clean everything we just checked - lx = x - prevclear * dx; - } - - for (lx = lx; lx != x + dx; lx += dx) - for (ly = y1; ly != y2; ly += dy) - mask[ly * w + lx] = 0; - } - prevclear++; - } - else - { // line is dirty - prevclear = 0; - } - } -} - -struct _expand_corner -{ - int x, y; - int tx1, ty1; - int tx2, ty2; -} -const expand_corner [] = -{ - {0, 0, 1, 0, 0, 1}, // top-left - {1, 0, 0, 0, 0, 1}, // top-mid, from left - {1, 0, 2, 0, 2, 1}, // top-mid, from right - {2, 0, 1, 0, 2, 1}, // top-right - {0, 1, 0, 0, 1, 0}, // mid-left, from top - {0, 1, 0, 2, 1, 2}, // mid-left, from bottom - {2, 1, 1, 0, 2, 0}, // mid-right, from top - {2, 1, 1, 2, 2, 2}, // mid-right, from bottom - {0, 2, 1, 2, 0, 1}, // bot-left - {1, 2, 0, 1, 0, 2}, // bot-mid, from left - {1, 2, 2, 1, 2, 2}, // bot-mid, from right - {2, 2, 1, 2, 2, 1}, // bot-right - - {-1,-1, -1,-1, -1,-1} // term -}; - -// this will recursively expand the missing corner pixels -// recursion is limited so we dont overflow the stack -int -expand_rect (char* mask, int x, int y, int w, int h) -{ - static int level = 0; - int x1, y1, x2, y2, i, lx, ly; - const struct _expand_corner* pc; - signed char matrix[3][3]; - int cnt = 0; - - if (level > 99) - return 1; // make sure parent knows it failed - - level++; - - if (x > 0) - x1 = x - 1; - else - { - for (i = 0; i < 3; i++) - matrix[0][i] = -1; - - x1 = x; - } - - if (y > 0) - y1 = y - 1; - else - { - for (i = 0; i < 3; i++) - matrix[i][0] = -1; - - y1 = y; - } - - if (x + 1 < w) - x2 = x + 2; - else - { - for (i = 0; i < 3; i++) - matrix[2][i] = -1; - - x2 = x + 1; - } - - if (y + 1 < h) - y2 = y + 2; - else - { - for (i = 0; i < 3; i++) - matrix[i][2] = -1; - - y2 = y + 1; - } - - for (ly = y1; ly < y2; ly++) - for (lx = x1; lx < x2; lx++) - matrix[lx - x + 1][ly - y + 1] = mask[ly * w + lx]; - - // check corner pixels - for (pc = expand_corner; pc->x != -1; pc++) - { - if (matrix[pc->x][pc->y] == 0 && matrix[pc->tx1][pc->ty1] > 0 && matrix[pc->tx2][pc->ty2] > 0) - { // corner pixel missing - int ofs = (y - 1 + pc->y) * w + (x - 1 + pc->x); - - matrix[pc->x][pc->y] = 3; - - // but it may already be present in the mask (recursive) - if (mask[ofs] == 0) - { - mask[ofs] = 3; - cnt += 1 + expand_rect (mask, x - 1 + pc->x, y - 1 + pc->y, w, h); - } - } - } - - level--; - - return cnt; -} - -file_info* -file_info_add_image (file_info* fi) -{ - file_info* ni; - - ni = (file_info*) malloc (sizeof(file_info)); - if (!ni) - return 0; - - file_info_init (ni); - - while (fi->next) - fi = fi->next; - - return fi->next = ni; -} - -int -is_multi_delta_image (file_info* fi) -{ - return fi && fi->next; -} - -#define MASK_COLORS 4 -mng_palette8e mask_pal[MASK_COLORS] = -{ - {0x00, 0x00, 0x00}, - {0xff, 0xff, 0xff}, - {0x00, 0xff, 0x00}, - {0x00, 0x00, 0xff} -}; - -void -create_mask_png (char* mask, int w, int h) -{ - int ret = 0; - mng_handle mng; - file_info wf; - char fname[260]; - mng_ptr imgdata; - unsigned char* tempdata; - unsigned char* p; - uLong srcLen; - uLong dstLen; - int i; - - file_info_init (&wf); - sprintf(fname, "mask_%03d_%03d.png", _curframe, _curdeltaframe); - - wf.fname = fname; - wf.fmode = "wb"; - - // extra byte in front of each line for filter type - srcLen = w * h + h; - tempdata = (mng_ptr) malloc(srcLen); - if (!tempdata) - return; - - // maximum necessary space - // deflated data can be 100.1% + 12 bytes in worst case - dstLen = srcLen + srcLen / 100 + 20; // extra 8 for safety - imgdata = (mng_ptr) malloc(dstLen); - if (!imgdata) - return; - - for (i = 0, p = tempdata; i < w * h; i++, p++) - { - if (i % w == 0) - { // write filter byte - *p++ = 0; - } - - *p = mask[i]; - } - - if (Z_OK != compress2(imgdata, &dstLen, tempdata, srcLen, 9)) - return; - - free(tempdata); - - mng = mng_initialize (&wf, mng_alloc, mng_free, MNG_NULL); - if (mng == MNG_NULL) - return; - - // set the callbacks - mng_setcb_openstream(mng, mng_open_stream); - mng_setcb_closestream(mng, mng_close_stream); - mng_setcb_writedata(mng, mng_write_stream); - - ret = mng_create (mng); - - ret = mng_putchunk_ihdr (mng, w, h, - MNG_BITDEPTH_8, MNG_COLORTYPE_INDEXED, MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, MNG_INTERLACE_NONE); - - if (ret == MNG_NOERROR) - ret = mng_putchunk_plte (mng, 4, mask_pal); - if (ret == MNG_NOERROR) - ret = mng_putchunk_idat (mng, dstLen, imgdata); - if (ret == MNG_NOERROR) - ret = mng_putchunk_iend (mng); - - free (imgdata); - - if (ret == MNG_NOERROR) - ret = mng_write (mng); - - mng_cleanup (&mng); - - file_info_cleanup (&wf); -} - -int -build_delta (file_info* i1, file_info* i2) -{ - int w, h, x, y; - int dx1, dx2, dy1, dy2; - int cnt; - char* mask = 0; - - if (i1->w > i2->w) - { - w = i2->w; - dx1 = i2->x; - dx2 = 0; - } - else if (i1->w < i2->w) - { - w = i1->w; - dx1 = 0; - dx2 = i1->x; - } - else - { - w = i1->w; - dx1 = dx2 = 0; - } - - if (i1->h > i2->h) - { - h = i2->h; - dy1 = i2->y; - dy2 = 0; - } - else if (i1->h < i2->h) - { - h = i1->h; - dy1 = 0; - dy2 = i1->y; - } - else - { - h = i1->h; - dy1 = dy2 = 0; - } - - mask = (char*) malloc (w * h); - if (!mask) - return 220; - memset(mask, 0, w * h); - - // build diff mask first - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (i1->indimg[(y + dy1) * i1->w + x + dx1] != i2->indimg[(y + dy2) * i2->w + x + dx2]) - // diff pixel - mask[y * w + x] = 1; - } - } - - // coarse expand the diff pixels - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (mask[y * w + x] == 1) - { - int x1 = x - 2; - int x2 = x + 3; - int y1 = y - 2; - int y2 = y + 3; - int lx; - if (x1 < 0) - x1 = 0; - if (x2 > w) - x2 = w; - if (y1 < 0) - y1 = 0; - if (y2 > h) - y2 = h; - - for (y1 = y1; y1 < y2; y1++) - for (lx = x1; lx < x2; lx++) - if (mask[y1 * w + lx] == 0) - mask[y1 * w + lx] = 2; - } - } - } - - // scan and remove extra expansion horizontally and vertically - clean_expansion_vert (mask, w, 0, 0, w, h, 1); - clean_expansion_vert (mask, w, w, 0, 0, h, 1); - clean_expansion_horz (mask, w, 0, 0, w, h, 1); - clean_expansion_horz (mask, w, 0, h, w, 0, 1); - - - do // coarse expand the diff pixels - { // merge would-be diff rectangles in the process - cnt = 0; - - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - if (mask[y * w + x] != 0) - cnt += expand_rect (mask, x, y, w, h); - } - } - // repeat is something was expanded - } while (cnt != 0); - - // at this point we should have guaranteed non-overlapping - // rectangles that cover all of the delta areas - - if (opts.sectorsize) - { // final expansion cleanup - for (y = 0; y < h; y += opts.sectorsize) - { - for (x = 0; x < w; x += opts.sectorsize) - { - int x2, y2; - - cnt = 0; - for (y2 = y; y2 < y + opts.sectorsize && y2 < h; y2++) - for (x2 = x; x2 < x + opts.sectorsize && x2 < w; x2++) - if (mask[y2 * w + x2] == 1) - cnt++; - - if (cnt > 0) - continue; // dirty sector - - // clean up sector - for (y2 = y; y2 < y + opts.sectorsize && y2 < h; y2++) - for (x2 = x; x2 < x + opts.sectorsize && x2 < w; x2++) - mask[y2 * w + x2] = 0; - - } - } - } - - // check how muany pixels have to be replaced - for (x = 0, cnt = 0; x < w * h; x++) - if (mask[x]) - cnt++; - - if (opts.deltamask) - create_mask_png (mask, w, h); - - // generate delta images - if (cnt != w * h) - { - int ofs; - - for (y = 0, ofs = 0; y < h; y++) - { - for (x = 0; x < w; x++, ofs++) - { - if (mask[ofs] != 0) - { // copy masked rectangle into a new image - // and clear the mask - int i; - int rw, rh; - int x2, y2; - unsigned char* src; - unsigned char* dst; - file_info* ni; - - ni = file_info_add_image (i1); - if (!ni) - { - x = w; - y = h; - break; - } - - - // lookup delta rectangle - for (i = x, src = mask + ofs; i < w && *src != 0; i++, src++) - ; - ni->w = rw = i - x; - - if (opts.fullrects) - { // locate only complete rectangles - y2 = y + 1; - for (i = y + 1, src = mask + ofs; i < h && *src != 0; i++, src += w) - { - unsigned char* src2; - - y2 = i; - for (x2 = x, src2 = src; x2 < x + rw && *src2 != 0; x2++, src2++) - ; - - if (x2 < x + rw) - break; - } - } - else - { // any rectangles - for (y2 = y + 1, src = mask + ofs; y2 < h && *src != 0; y2++, src += w) - ; - } - - ni->h = rh = y2 - y; - - ni->indimg = (unsigned char*) malloc (rw * rh); - if (!ni->indimg) - { - x = w; - y = h; - break; - } - - // copy the pixels - for (i = 0, src = i1->indimg + (dy1 + y) * i1->w + dx1 + x, dst = ni->indimg; - i < rh; - i++, src += i1->w, dst += rw - ) - { - memcpy (dst, src, rw); - memset (mask + ofs + i * w, 0, rw); - } - - ni->x = i1->x + dx1 + x; - ni->y = i1->y + dy1 + y; - } - } - } - - if (i1->next) - { // dispose of the original - file_info* ni = i1->next; - free (i1->indimg); - i1->indimg = ni->indimg; - i1->x = ni->x; - i1->y = ni->y; - i1->w = ni->w; - i1->h = ni->h; - i1->next = ni->next; - - free (ni); - } - } - else - { // break here - cnt = 1; - } - - if (mask) - free (mask); - - return 0; -} - -void -delta_images (void) -{ - int i; - unsigned short nextid = 0x101; - - verbose ("calculating frame image deltas", 0); - - Infos[iback].objid = nextid++; - if (iback != 0) - { // set the first frame objid different - // from back id - Infos[0].objid = nextid++; - } - - // remove dupes - for (i = 1; i < cFiles; i++) - { - int i2; - - if (i == iback) - continue; - - Infos[i].objid = Infos[i - 1].objid; - - for (i2 = i - 1; i2 >= 0 && Infos[i].identical == -1; i2--) - { - int orgi2 = i2; - - // deference identical chain - while (Infos[i2].identical != -1) - i2 = Infos[i2].identical; - - if (equal_images (i, i2)) - { - Infos[i].identical = i2; - // dont need image data anymore - if (Infos[i].indimg) - { - free (Infos[i].indimg); - Infos[i].indimg = 0; - } - - if (orgi2 != i - 1) - { // detached descendant - // clone the object for it - if (Infos[i2].clone == -1) - { // no clones yet - Infos[i2].cloneid = nextid++; - Infos[i2].clone = i; - Infos[i].objid = Infos[i2].cloneid; - } - else - { // already cloned for another frame - // tell the frame to preclone it for - // this frame too - // dereference preclone chain first - for (i2 = Infos[i2].clone; Infos[i2].preclone != -1; i2 = Infos[i2].preclone) - ; - Infos[i2].preclone = i; - Infos[i2].precloneid = nextid++; - Infos[i].objid = Infos[i2].precloneid; - } - } - } - } - verbose (".", 0); - } - verbose ("|", 0); - - // compute deltas - for (i = cFiles - 1; i >= 0; i--) - { - int i2; - - if (i == iback || Infos[i].identical != -1) - // no delta needed - continue; - else - { - if (i == 0 && i != iback) - { // delta against original background - i2 = iback; - } - else - { // deref indentical chain - for (i2 = i - 1; i2 >= 0 && Infos[i2].identical != -1; i2 = Infos[i2].identical) - ; - - // sanity check - if (Infos[i2].objid != Infos[i].objid) - { - fprintf (stderr, "delta_images: logical error 1\n"); - exit(EXIT_FAILURE); - } - } - - // debug info - _curframe = i; - _curdeltaframe = i2; - - build_delta (Infos + i, Infos + i2); - } - verbose (".", 0); - } - - verbose ("\n", 0); -} - -int -get_png_image_data (file_info* ms, unsigned char* imgdata) -{ - int i; - - for (i = 0; i < ms->w * ms->h; i++, imgdata++) - { - if (i % ms->w == 0) - { // write filter byte - *imgdata++ = 0; - } - - *imgdata = ms->indimg[i]; - } - return 0; -} - -int -compress_png (file_info* ms, mng_ptr imgdata, mng_uint32 imglen, mng_uint32p bytes) -{ - int ret = 0; - unsigned char* tempdata; - uLong srcLen; - - *bytes = 0; - - // extra byte in front of each line for filter type - srcLen = ms->w * ms->h + ms->h; - tempdata = (mng_ptr) malloc(srcLen); - if (!tempdata) - return 241; - - ret = get_png_image_data (ms, tempdata); - if (!ret) - { - uLong dstLen = imglen; - - if (Z_OK == compress2(imgdata, &dstLen, tempdata, srcLen, 9)) - *bytes = dstLen; - else - ret = 253; - } - - free(tempdata); - - return ret; -} - -int -output_png (mng_handle mng, file_info* rf, int delta) -{ - int ret = 0; - mng_ptr imgdata; - mng_uint32 imglen; - mng_uint32 cbcomp; - unsigned short objid = rf->objid; - - // maximum necessary space - // deflated data can be 100.1% + 12 bytes in worst case - imglen = mngw * mngh + mngh; - imglen += imglen / 100 + 20; // extra 8 for safety - imgdata = (mng_ptr) malloc(imglen); - if (!imgdata) - return 252; - - do - { - if (delta) - { // output delta - ret = mng_putchunk_dhdr (mng, objid, - MNG_IMAGETYPE_PNG, MNG_DELTATYPE_BLOCKPIXELREPLACE, - rf->w, rf->h, rf->x, rf->y); - } - else - { // output image verbatim - ret = mng_putchunk_ihdr (mng, rf->w, rf->h, - MNG_BITDEPTH_8, MNG_COLORTYPE_INDEXED, MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, MNG_INTERLACE_NONE); - - if (ret == MNG_NOERROR) - { // write empty PLTE to use the global PLTE - ret = mng_putchunk_plte (mng, 0, Pal); - //ret = mng_putchunk_plte (mng, cPalClr, Pal); // enable to write plain PNG - } - } - - if (ret == MNG_NOERROR) - ret = compress_png (rf, imgdata, imglen, &cbcomp); - - if (ret == MNG_NOERROR) - ret = mng_putchunk_idat (mng, cbcomp, imgdata); - - if (ret == MNG_NOERROR) - ret = mng_putchunk_iend (mng); - - } while ((rf = rf->next) != 0 && ret == MNG_NOERROR); - - free (imgdata); - - return ret; -} - -int -write_mng_file (void) -{ - int ret = 0; - mng_handle mng; - file_info wf; - file_info rf; - file_info backf; - int i; - unsigned short lastobjid; - char curframemode, newframemode; - - mng = mng_initialize (MNG_NULL, mng_alloc, mng_free, MNG_NULL); - if (mng == MNG_NULL) - { - fprintf (stderr, "libmng did not init properly\n"); - return 250; - } - - // set the callbacks - mng_setcb_openstream(mng, mng_open_stream); - mng_setcb_closestream(mng, mng_close_stream); - mng_setcb_writedata(mng, mng_write_stream); - - file_info_init (&wf); - wf.fname = opts.outfile; - wf.fmode = "wb"; - mng_set_userdata (mng, &wf); - - ret = mng_create (mng); - if (ret != MNG_NOERROR) - fprintf (stderr, "Could not create '%s'\n", wf.fname); - else - verbose ("writing MNG file '%s'", wf.fname); - - ret = mng_putchunk_mhdr (mng, mngw, mngh, timerate, 0, 0, 0, - MNG_SIMPLICITY_VALID | MNG_SIMPLICITY_SIMPLEFEATURES | - MNG_SIMPLICITY_COMPLEXFEATURES | MNG_SIMPLICITY_DELTAPNG | 0x240); - - //ret = mng_putchunk_term (mng, MNG_TERMACTION_LASTFRAME, MNG_ITERACTION_LASTFRAME, 0, 0); - - ret = mng_putchunk_plte (mng, cPalClr, Pal); - - ret = mng_putchunk_back (mng, 0,0,0, 0, 0, MNG_BACKGROUNDIMAGE_NOTILE); - - curframemode = MNG_FRAMINGMODE_1; - ret = mng_putchunk_fram (mng, MNG_FALSE, curframemode, 0,MNG_NULL, - MNG_CHANGEDELAY_DEFAULT, MNG_CHANGETIMOUT_NO, MNG_CHANGECLIPPING_NO, MNG_CHANGESYNCID_NO, - framedelay, 0,0,0,0,0,0, MNG_NULL,0); - - // define the staring image/object - backf = Infos[iback]; - ret = mng_putchunk_defi (mng, backf.objid, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE, MNG_FALSE, 0,0, MNG_FALSE, 0,0,0,0); - ret = output_png (mng, &backf, 0); - - //ret = mng_putchunk_save (mng, MNG_TRUE, 0,0); - //ret = mng_putchunk_seek (mng, 5, "start"); - - if (iback != 0) - { // clone the starting object for the first frame - ret = mng_putchunk_clon (mng, backf.objid, Infos[0].objid, - MNG_FULL_CLONE, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE_ASPARENT, - MNG_FALSE, 0,0,0); - } - - lastobjid = 0; - - for (i = 0; i < cFiles && ret == MNG_NOERROR; i++) - { - rf = Infos[i]; - - if (rf.precloneid != 0) - { // pre-clone the object for another frame - ret = mng_putchunk_clon (mng, rf.objid, rf.precloneid, - MNG_FULL_CLONE, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE_ASPARENT, - MNG_FALSE, 0,0,0); - } - - if (is_multi_delta_image (&rf)) - // multi-delta png; frame mode: 0-delay for subframe - newframemode = MNG_FRAMINGMODE_2; - else - // frame mode: 1 image per frame - newframemode = MNG_FRAMINGMODE_1; - - - if (newframemode != curframemode) - { // change framing mode only - ret = mng_putchunk_fram (mng, MNG_FALSE, newframemode, 0,MNG_NULL, - MNG_CHANGEDELAY_NO, MNG_CHANGETIMOUT_NO, MNG_CHANGECLIPPING_NO, MNG_CHANGESYNCID_NO, - 0,0,0,0,0,0,0, MNG_NULL,0); - curframemode = newframemode; - } - else if (curframemode == MNG_FRAMINGMODE_2) - { // start new subframe - ret = mng_putchunk_fram (mng, MNG_TRUE, 0,0,MNG_NULL,0,0,0,0,0,0,0,0,0,0,0,0,0); - } - - if (rf.indimg != 0 && i != iback) - { // display a delta png - ret = output_png (mng, &rf, 1); - } - - if (rf.cloneid != 0) - { // post-clone the object for another frame - ret = mng_putchunk_clon (mng, rf.objid, rf.cloneid, - MNG_FULL_CLONE, MNG_DONOTSHOW_NOTVISIBLE, MNG_CONCRETE_ASPARENT, - MNG_FALSE, 0,0,0); - } - - if (rf.objid != lastobjid || rf.identical != -1) - { // show the object for this frame - ret = mng_putchunk_show (mng, MNG_FALSE, rf.objid, rf.objid, MNG_SHOWMODE_0); - lastobjid = rf.objid; - } - - verbose (".", 0); - } - - //ret = mng_putchunk_seek (mng, 3, "end"); - ret = mng_putchunk_mend (mng); - - ret = mng_write (mng); - - file_info_cleanup (&wf); - - mng_cleanup (&mng); - - if (ret == MNG_NOERROR) - verbose ("finished.\n", 0); - else - fprintf (stderr, "Could not create MNG file\n"); - - return ret; -} - -mng_ptr MNG_DECL -mng_alloc (mng_size_t iLen) -{ - mng_ptr ptr; - - if (iLen & 0x80000000) - return 0; // MNG error! - - ptr = malloc (iLen); - if (ptr) - memset(ptr, 0, iLen); - - return ptr; -} - -void MNG_DECL -mng_free (mng_ptr pPtr, mng_size_t iLen) -{ - if (iLen) - free (pPtr); -} - -mng_bool MNG_DECL -mng_open_stream (mng_handle mng) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - ms->f = fopen (ms->fname, ms->fmode); - if (!ms->f) - { - fprintf(stderr, "unable to open '%s'\n", ms->fname); - return MNG_FALSE; - } - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_close_stream (mng_handle mng) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - fclose(ms->f); - ms->f = NULL; - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_read_stream (mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - *bytes = fread(buffer, 1, size, ms->f); - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_write_stream (mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32p bytes) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - *bytes = fwrite(buffer, 1, size, ms->f); - - return MNG_TRUE; -} - -mng_bool MNG_DECL -mng_process_header (mng_handle mng, mng_uint32 width, mng_uint32 height) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - ms->w = width; - ms->h = height; - ms->image = (RGBA*) malloc(sizeof(RGBA) * width * height); - if (!ms->image) - return MNG_FALSE; - - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - - return MNG_TRUE; -} - -mng_ptr MNG_DECL -mng_get_canvasline_read (mng_handle mng, mng_uint32 line) -{ - file_info* ms; - mng_ptr row; - - ms = (file_info*) mng_get_userdata (mng); - - row = ms->image + ms->w * line; - - return row; -} - -mng_ptr MNG_DECL -mng_get_canvasline_write (mng_handle mng, mng_uint32 line) -{ - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - //if (!ms->rowdata) - // ms->rowdata = (unsigned char*) malloc (ms->w); - //if (!ms->rowdata) - // return MNG_NULL; - - //make_pal_row (ms, line, ms->rowdata); - - // satisfying compiler - line = 0; - - return MNG_NULL; -} - -mng_bool MNG_DECL -mng_refresh_display (mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h) -{ - // not implemented - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - - // satisfying compiler - x = y = w = h = 0; - - return MNG_TRUE; -} - -mng_uint32 MNG_DECL -mng_get_tickcount (mng_handle mng) -{ - // not implemented - file_info* ms; - static int tick = 0; - - ms = (file_info*) mng_get_userdata (mng); - - return tick += 50; -} - -mng_bool MNG_DECL -mng_set_timer (mng_handle mng, mng_uint32 msecs) -{ - // not implemented - file_info* ms; - - ms = (file_info*) mng_get_userdata (mng); - ms->delay = msecs; - - return MNG_TRUE; -} diff --git a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsp b/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsp deleted file mode 100644 index c5b5aca22..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsp +++ /dev/null @@ -1,114 +0,0 @@ -# Microsoft Developer Studio Project File - Name="makemng" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=makemng - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "makemng.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "makemng.mak" CFG="makemng - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "makemng - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "makemng - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=xicl6.exe -RSC=rc.exe - -!IF "$(CFG)" == "makemng - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "NDEBUG" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /D "ZLIB_DLL" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /machine:I386 /libpath:"." - -!ELSEIF "$(CFG)" == "makemng - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "..\..\src" /I "..\..\src\msvc++" /I "..\..\src\getopt" /D "_DEBUG" /D "ZLIB_DLL" /D "WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "MNG_USE_DLL" /D "MNG_SKIP_LCMS" /D "MNG_SKIP_IJG6B" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=xilink6.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib zlib.lib libmng.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"." - -!ENDIF - -# Begin Target - -# Name "makemng - Win32 Release" -# Name "makemng - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\filelist.c -# End Source File -# Begin Source File - -SOURCE=..\..\src\getopt\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\makemng.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\getopt.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsw b/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsw deleted file mode 100644 index ab12fac01..000000000 --- a/Engine/lib/lmng/contrib/msvc/makemng/makemng.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "makemng"=.\makemng.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/COPYING-LCMS b/Engine/lib/lmng/contrib/msvc/mngplg/COPYING-LCMS deleted file mode 100644 index e98f0e17b..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/COPYING-LCMS +++ /dev/null @@ -1,515 +0,0 @@ - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ie.cur b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ie.cur deleted file mode 100644 index 159ad4e869633131e4e1cbecc75dc8b61564fee7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 326 zcma*hu?~VT5XSMZkidwOj50d9G3wj+2#)Y*JchxAM_|-wIQ}h?7)T6les}4mcdZo3 zsVJm`d~(uW(h-z&fn)nshqw-Awl4mu#2?8^he<}x7;!+35;t7m{ON%fcQjz`5+(76 gP3!5*W<6bA7gW}0Qj_(yBZqtR^(oHarC%@3BSF`D0{{R3 diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ns.cur b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/cur_ns.cur deleted file mode 100644 index 196bb25c142cfad5aaf7595a0507523bcee9d8ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 326 zcmbWxF%m#95Czb`W^}Y#DV1(O>oCR<EvV1dx>dsAn G2j3T($$EkS diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/license.txt b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/license.txt deleted file mode 100644 index 6756e5e7e..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/license.txt +++ /dev/null @@ -1,40 +0,0 @@ -MNGPLG -A simple browser plug-in for the MNG image/animation file format. - -By Jason Summers -Web site: - - -COPYRIGHT NOTICE - -Copyright (c) 2000-2002 by Jason Summers - -THIS SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT -ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE -THIS SOFTWARE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING -ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THIS SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THIS SOFTWARE TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this source code must not be misrepresented; - you must not claim that you wrote the original software. - 2. Altered source versions must be plainly marked as such, and must not - be misrepresented as being the original source. - 3. Altered binary versions must not be misrepresented as being the - original. - 4. This Copyright notice may not be removed or altered from any source - or altered source distribution, although you may add a Copyright - notice for yourself for any code that you have written. diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npapidefs.h b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npapidefs.h deleted file mode 100644 index 3d6f82132..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npapidefs.h +++ /dev/null @@ -1,245 +0,0 @@ -// npapidefs.h -// minimal version of the defs from the NS plugin SDK - -#ifndef NPAPIDEFS_H -#define NPAPIDEFS_H - -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 11 - -#define NPVERS_HAS_STREAMOUTPUT 8 -#define NPVERS_HAS_NOTIFICATION 9 -#define NPVERS_HAS_LIVECONNECT 9 -#define NPVERS_HAS_WINDOWLESS 11 - -#define NPERR_NO_ERROR 0 -#define NPERR_GENERIC_ERROR 1 -#define NPERR_INVALID_INSTANCE_ERROR 2 -#define NPERR_INVALID_FUNCTABLE_ERROR 3 -#define NPERR_MODULE_LOAD_FAILED_ERROR 4 -#define NPERR_OUT_OF_MEMORY_ERROR 5 -#define NPERR_INVALID_PLUGIN_ERROR 6 -#define NPERR_INVALID_PLUGIN_DIR_ERROR 7 -#define NPERR_INCOMPATIBLE_VERSION_ERROR 8 -#define NPERR_INVALID_PARAM 9 -#define NPERR_INVALID_URL 10 -#define NPERR_FILE_NOT_FOUND 11 -#define NPERR_NO_DATA 12 -#define NPERR_STREAM_NOT_SEEKABLE 13 - -#define NP_EMBED 1 -#define NP_FULL 2 - -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 -#define NP_ASFILEONLY 4 - -#define NPRES_DONE 0 -#define NPRES_NETWORK_ERR 1 -#define NPRES_USER_BREAK 2 - -typedef unsigned short uint16; -typedef unsigned long uint32; -typedef short int16; -typedef long int32; - -typedef unsigned char NPBool; -typedef int16 NPError; -typedef int16 NPReason; -typedef char* NPMIMEType; -typedef HRGN NPRegion; - -typedef void* JRIGlobalRef; -struct JRIEnvInterface; -typedef struct JRIEnvInterface JRIEnvInterface; -typedef const JRIEnvInterface* JRIEnv; -struct _jobject; -typedef struct _jobject *jobject; -typedef jobject jref; - -typedef struct _NPRect -{ - uint16 top; - uint16 left; - uint16 bottom; - uint16 right; -} NPRect; - -typedef struct _NPP -{ - void* pdata; - void* ndata; -} NPP_t; - -typedef NPP_t* NPP; - -typedef struct _NPStream -{ - void* pdata; - void* ndata; - const char* url; - uint32 end; - uint32 lastmodified; - void* notifyData; -} NPStream; - -typedef enum { - NPPVpluginNameString = 1, - NPPVpluginDescriptionString, - NPPVpluginWindowBool, - NPPVpluginTransparentBool -} NPPVariable; - -typedef enum { - NPNVxDisplay = 1, - NPNVxtAppContext, - NPNVnetscapeWindow, - NPNVjavascriptEnabledBool, - NPNVasdEnabledBool, - NPNVisOfflineBool -} NPNVariable; - -typedef enum { - NPWindowTypeWindow = 1, - NPWindowTypeDrawable -} NPWindowType; - -typedef struct _NPSavedData -{ - int32 len; - void* buf; -} NPSavedData; - -typedef struct _NPByteRange -{ - int32 offset; - uint32 length; - struct _NPByteRange* next; -} NPByteRange; - -typedef struct _NPFullPrint -{ - NPBool pluginPrinted; - NPBool printOne; - void* platformPrint; -} NPFullPrint; - -typedef struct _NPWindow -{ - void* window; - int32 x; - int32 y; - uint32 width; - uint32 height; - NPRect clipRect; - NPWindowType type; -} NPWindow; - -typedef struct _NPEmbedPrint -{ - NPWindow window; - void* platformPrint; -} NPEmbedPrint; - -typedef struct _NPPrint -{ - uint16 mode; - union - { - NPFullPrint fullPrint; - NPEmbedPrint embedPrint; - } print; -} NPPrint; - -typedef struct _NPEvent -{ - uint16 event; - uint32 wParam; - uint32 lParam; -} NPEvent; - - -typedef NPError (*NPP_NewUPP)(NPMIMEType,NPP,uint16,int16,char* argn[],char* argv[],NPSavedData*); -typedef NPError (*NPP_DestroyUPP)(NPP instance, NPSavedData** save); -typedef NPError (*NPP_SetWindowUPP)(NPP,NPWindow*); -typedef NPError (*NPP_NewStreamUPP)(NPP,NPMIMEType,NPStream*,NPBool,uint16*); -typedef NPError (*NPP_DestroyStreamUPP)(NPP,NPStream*,NPReason); -typedef int32 (*NPP_WriteReadyUPP)(NPP instance,NPStream*); -typedef int32 (*NPP_WriteUPP)(NPP,NPStream*,int32,int32,void*); -typedef void (*NPP_StreamAsFileUPP)(NPP,NPStream*,const char*); -typedef void (*NPP_PrintUPP)(NPP,NPPrint*); -typedef int16 (*NPP_HandleEventUPP)(NPP,void*); -typedef void (*NPP_URLNotifyUPP)(NPP,const char*,NPReason,void*); -typedef NPError (*NPP_GetValueUPP)(NPP,NPPVariable,void*); -typedef NPError (*NPP_SetValueUPP)(NPP,NPNVariable,void*); -typedef NPError (*NPN_GetValueUPP)(NPP,NPNVariable,void*); -typedef NPError (*NPN_SetValueUPP)(NPP,NPPVariable,void*); -typedef NPError (*NPN_GetURLNotifyUPP)(NPP,const char*,const char*,void*); -typedef NPError (*NPN_PostURLNotifyUPP)(NPP,const char*,const char*,uint32,const char*,NPBool,void*); -typedef NPError (*NPN_GetURLUPP)(NPP,const char*,const char*); -typedef NPError (*NPN_PostURLUPP)(NPP,const char*,const char*,uint32,const char*,NPBool); -typedef NPError (*NPN_RequestReadUPP)(NPStream*,NPByteRange*); -typedef NPError (*NPN_NewStreamUPP)(NPP,NPMIMEType,const char*,NPStream**); -typedef int32 (*NPN_WriteUPP)(NPP,NPStream*,int32,void*); -typedef NPError (*NPN_DestroyStreamUPP)(NPP,NPStream*,NPReason); -typedef void (*NPN_StatusUPP)(NPP instance, const char*); -typedef const char* (*NPN_UserAgentUPP)(NPP); -typedef void* (*NPN_MemAllocUPP)(uint32); -typedef void (*NPN_MemFreeUPP)(void*); -typedef uint32 (*NPN_MemFlushUPP)(uint32); -typedef void (*NPN_ReloadPluginsUPP)(NPBool); -typedef JRIEnv* (*NPN_GetJavaEnvUPP)(void); -typedef jref (*NPN_GetJavaPeerUPP)(NPP); -typedef void (*NPN_InvalidateRectUPP)(NPP,NPRect*); -typedef void (*NPN_InvalidateRegionUPP)(NPP,NPRegion); -typedef void (*NPN_ForceRedrawUPP)(NPP); - - -typedef struct _NPPluginFuncs { - uint16 size; - uint16 version; - NPP_NewUPP newp; - NPP_DestroyUPP destroy; - NPP_SetWindowUPP setwindow; - NPP_NewStreamUPP newstream; - NPP_DestroyStreamUPP destroystream; - NPP_StreamAsFileUPP asfile; - NPP_WriteReadyUPP writeready; - NPP_WriteUPP write; - NPP_PrintUPP print; - NPP_HandleEventUPP event; - NPP_URLNotifyUPP urlnotify; - JRIGlobalRef javaClass; - NPP_GetValueUPP getvalue; - NPP_SetValueUPP setvalue; -} NPPluginFuncs; - -typedef struct _NPNetscapeFuncs { - uint16 size; - uint16 version; - NPN_GetURLUPP geturl; - NPN_PostURLUPP posturl; - NPN_RequestReadUPP requestread; - NPN_NewStreamUPP newstream; - NPN_WriteUPP write; - NPN_DestroyStreamUPP destroystream; - NPN_StatusUPP status; - NPN_UserAgentUPP uagent; - NPN_MemAllocUPP memalloc; - NPN_MemFreeUPP memfree; - NPN_MemFlushUPP memflush; - NPN_ReloadPluginsUPP reloadplugins; - NPN_GetJavaEnvUPP getJavaEnv; - NPN_GetJavaPeerUPP getJavaPeer; - NPN_GetURLNotifyUPP geturlnotify; - NPN_PostURLNotifyUPP posturlnotify; - NPN_GetValueUPP getvalue; - NPN_SetValueUPP setvalue; - NPN_InvalidateRectUPP invalidaterect; - NPN_InvalidateRegionUPP invalidateregion; - NPN_ForceRedrawUPP forceredraw; -} NPNetscapeFuncs; - - -#endif // NPAPIDEFS_H diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.c b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.c deleted file mode 100644 index 91719bdf3..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.c +++ /dev/null @@ -1,1936 +0,0 @@ -/* -*- Mode: C; tab-width: 4; -*- */ -/* npmngplg.c - * MNG browser plugin - * By Jason Summers - * Based on libmng by Gerard Juyn - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "resource.h" -#include "libmng.h" -#include "jversion.h" // part of libjpeg -#include "zlib.h" // for zlibVersion -#include "npapidefs.h" - -#define MNGPLG_CMS -//#define MNGPLG_TRACE - -#define IDBASE 47000 -#define ID_SAVEAS (IDBASE+0) -#define ID_COPYIMAGE (IDBASE+1) -#define ID_COPYURL (IDBASE+2) -#define ID_VIEWIMAGE (IDBASE+3) -#define ID_ABOUT (IDBASE+4) -#define ID_FREEZE (IDBASE+5) -#define ID_RESTARTANIM (IDBASE+6) -#define ID_COPYLINKLOC (IDBASE+7) -#define ID_STOPANIM (IDBASE+8) -#define ID_SHOWERROR (IDBASE+9) -#define ID_PROPERTIES (IDBASE+10) - -#define MNGPLGVERS "1.0.1" - -/* instance-specific data */ -typedef struct pluginstruct_ -{ - NPWindow* fWindow; - uint16 fMode; - HWND fhWnd; - WNDPROC fDefaultWindowProc; - NPP instance; - - mng_handle mng; - -#define STATE_INIT 0 -#define STATE_LOADING 1 // stream opened -#define STATE_VALIDFRAME 2 // at least one frame has been displayed -#define STATE_LOADED 3 // image loaded; stream closed - - -#define MAXLEN_TEXT 5000 - -#define MAXLEN_URL 300 -#define MAXLEN_TARGET 100 - - // I think I'm not doing this very well. Probably there really needs to be - // two state variables, one for loading from the network, and one for - // the libmng processing. (or use libmng's new getstate API?) - int loadstate; - - int paintedyet; - - int scrolling; // allow scrolling of the image? - int xscrollpos, yscrollpos; - int windowwidth, windowheight; // client size of current window - - int diblinesize; - DWORD dibsize; - DWORD filesize; - DWORD libmngpos; // count of bytes that have been sent to libmng - DWORD byteswanted; // libmng asked for this many more bytes (add to libmngpos) - - unsigned char *mngdata; // stores the MNG file in memory - DWORD bytesloaded; // - DWORD bytesalloc; // size of mngdata - int needresume; // if previous mng_readdisplay call returned NEEDMOREDATA - - char *textdata; - - int errorflag; // set if an error occurs that prevents displaying the image - char errormsg[256]; - - unsigned char *lpdib; // pointer to header section of dib - unsigned char *lpdibbits; // pointer to "bits" section of dib (follows the header) - LPBITMAPINFOHEADER lpdibinfo; // alias for lpdib - int frozen; - int timer_set; - int timer2_set; - int dynamicmng; - int mouse_over_mng; - int mouse_captured; - - int force_bgcolor; - mng_uint16 bg_r,bg_g,bg_b; // background color - - unsigned char url[MAX_PATH]; // the url of the stream - - int islink; - HCURSOR linkcursor; - HBRUSH bkgdbrush; - unsigned char linkurl[MAXLEN_URL]; - unsigned char linktarget[MAXLEN_TARGET]; - -} PluginInstance; - - -/* global variables */ - -#ifdef MNGPLG_TRACE -static FILE *tracefile; -#endif - -static const char* gInstanceLookupString = "pdata"; -static HMODULE g_hInst = NULL; -static HCURSOR hcurHandNS; -static HFONT hfontMsg; - -/* function prototypes */ -LRESULT CALLBACK DlgProcAbout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK DlgProcProp(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK PluginWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); - -void set_scrollbars(PluginInstance *This); - - -//////////////////////////// NPN_functions - -static NPNetscapeFuncs* g_pNavigatorFuncs; -static NPPluginFuncs* g_pluginFuncs; - -static const char* NPN_UserAgent(NPP instance) -{ - return g_pNavigatorFuncs->uagent(instance); -} - -static NPError NPN_GetURL(NPP instance, const char *url, const char *target) -{ - return g_pNavigatorFuncs->geturl(instance, url, target); -} - - - -/* ----------------------------------------------------------------------- */ - -BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved) -{ - switch(reason) { - case DLL_PROCESS_ATTACH: - g_hInst=hModule; - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -/* ----------------------------------------------------------------------- */ - -static void warn(PluginInstance *This, char *fmt, ...) -{ - va_list ap; - char buf[2048]; - HWND hwnd; - - va_start(ap, fmt); - wvsprintf(buf,fmt, ap); - va_end(ap); - - if(This) hwnd= This->fhWnd; - else hwnd=NULL; - - MessageBox(hwnd,buf,"MNG Plug-in",MB_OK|MB_ICONWARNING); -} - - -static void set_error(PluginInstance *This, char *fmt, ...) -{ - va_list ap; - char buf[2048]; - HWND hwnd; - - va_start(ap, fmt); - wvsprintf(buf,fmt, ap); - va_end(ap); - - if(This) hwnd= This->fhWnd; - else hwnd=NULL; - - This->errorflag=1; - lstrcpyn(This->errormsg,buf,256); - - if(This->lpdib) { - free(This->lpdib); - This->lpdib=NULL; - } - This->xscrollpos = This->yscrollpos = 0; - - if(This->fhWnd) - InvalidateRect(This->fhWnd,NULL,TRUE); -} - -/* ----------------------------------------------------------------------- */ -// MNG callbacks -#define MNGPLG_CALLBACK MNG_DECL - -static mng_ptr MNGPLG_CALLBACK memallocfunc(mng_size_t n) -{ - return (mng_ptr) calloc(n,1); -} - - -static void MNGPLG_CALLBACK memfreefunc(mng_ptr p, mng_size_t n) -{ - free((void*)p); -} - - -static mng_bool MNGPLG_CALLBACK callback_openstream (mng_handle mng) -{ -// PluginInstance *This; -// This = (PluginInstance*) mng_get_userdata(mng); - return MNG_TRUE; -} - -static mng_bool MNGPLG_CALLBACK callback_closestream (mng_handle mng) -{ - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - This->loadstate = STATE_LOADED; // this is probably redundant - - return MNG_TRUE; -} - - -static mng_bool MNGPLG_CALLBACK callback_readdata (mng_handle mng,mng_ptr pBuf, - mng_uint32 Buflen,mng_uint32 *pRead) -{ - int n; - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"readdata callback buflen=%d loadstate=%d bytesloaded=%d libmngpos=%d\n", - Buflen,This->loadstate,This->bytesloaded, This->libmngpos); -#endif - - - // do we have enough data available? - if(This->bytesloaded - This->libmngpos >= Buflen) { - CopyMemory(pBuf,&This->mngdata[This->libmngpos],Buflen); - (*pRead)= Buflen; - This->libmngpos += Buflen; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returning full: %d\n",Buflen); -#endif - This->byteswanted=0; - return MNG_TRUE; - } - else if(This->loadstate>=STATE_LOADED) { - // We don't have the data it asked for, but we're at the end - // of file, so send it anyway...? - - n=This->bytesloaded-This->libmngpos; - - if(n>0) { - CopyMemory(pBuf,&This->mngdata[This->libmngpos],n); - This->libmngpos+=n; - } - (*pRead)=n; - // so what do we return? -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returning partial: %d\n",n); -#endif - This->byteswanted=0; - return MNG_TRUE; - } - - // else we don't yet have the data it's requesting -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returning 0\n"); -#endif - (*pRead)=0; - This->byteswanted=Buflen; - return MNG_TRUE; -} - - -static mng_bool MNGPLG_CALLBACK callback_processheader(mng_handle mng,mng_uint32 iWidth,mng_uint32 iHeight) -{ - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - - This->diblinesize = (((iWidth * 24)+31)/32)*4; - This->dibsize = sizeof(BITMAPINFOHEADER) + This->diblinesize*iHeight; - This->lpdib = calloc(This->dibsize,1); - This->lpdibinfo = (LPBITMAPINFOHEADER)This->lpdib; - This->lpdibbits = &This->lpdib[sizeof(BITMAPINFOHEADER)]; - ZeroMemory((void*)This->lpdib,sizeof(BITMAPINFOHEADER)); - This->lpdibinfo->biSize = sizeof(BITMAPINFOHEADER); - This->lpdibinfo->biWidth = iWidth; - This->lpdibinfo->biHeight = iHeight; - This->lpdibinfo->biPlanes = 1; - This->lpdibinfo->biBitCount = 24; - - mng_set_canvasstyle (mng, MNG_CANVAS_BGR8); - -/* if(This->fhWnd) { - if((int)iWidth > This->windowwidth || (int)iHeight > This->windowheight) { - This->scrolling=1; - } - } */ - - set_scrollbars(This); - return MNG_TRUE; -} - - -static mng_ptr MNGPLG_CALLBACK callback_getcanvasline (mng_handle mng, mng_uint32 iLinenr) -{ - unsigned char *pp; - - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - pp = (&This->lpdibbits[(This->lpdibinfo->biHeight-1-iLinenr)*This->diblinesize]); - return (mng_ptr) pp; -} - -static mng_bool MNGPLG_CALLBACK callback_refresh (mng_handle mng, mng_uint32 iLeft, mng_uint32 iTop, - mng_uint32 iRight, mng_uint32 iBottom) -{ - PluginInstance *This; - RECT rect; - - This = (PluginInstance*) mng_get_userdata(mng); - - if(This->loadstateloadstate=STATE_VALIDFRAME; - } - - if(This->fhWnd) { - if(This->paintedyet) { - rect.left= iLeft - This->xscrollpos; - rect.top= iTop - This->yscrollpos; - rect.right= iLeft+iRight; - rect.bottom= iTop+iBottom; - - InvalidateRect(This->fhWnd,&rect,FALSE); - } - else { - // Make sure the first paint clears the whole plugin window - InvalidateRect(This->fhWnd,NULL,TRUE); - This->paintedyet=1; - } - UpdateWindow(This->fhWnd); - } - return MNG_TRUE; -} - -static mng_uint32 MNGPLG_CALLBACK callback_gettickcount (mng_handle mng) -{ - return GetTickCount(); -} - - -static mng_bool MNGPLG_CALLBACK callback_settimer (mng_handle mng,mng_uint32 iMsecs) -{ - PluginInstance *This; - This = (PluginInstance*) mng_get_userdata(mng); - - if(This->fhWnd) { - if(!SetTimer(This->fhWnd,1,(UINT)iMsecs,NULL)) { - warn(This,"Unable to create a timer for animation"); - This->frozen=1; - //return MNG_FALSE; - return MNG_TRUE; - } - This->timer_set=1; - } - return MNG_TRUE; -} - -static mng_bool MNGPLG_CALLBACK callback_processtext(mng_handle mng, - mng_uint8 iType, mng_pchar zKeyword, mng_pchar zText, - mng_pchar zLanguage, mng_pchar zTranslation) -{ - PluginInstance *This; - int pos,i; - - This = (PluginInstance*) mng_get_userdata(mng); - - if(!This->textdata) { - This->textdata=(char*)malloc(MAXLEN_TEXT+10); - if(!This->textdata) return MNG_TRUE; - lstrcpy(This->textdata,""); - } - - pos=lstrlen(This->textdata); - if(pos>=(MAXLEN_TEXT-10)) return MNG_TRUE; - - if(pos>0) { /* separate items with a blank line */ - This->textdata[pos++]='\r'; - This->textdata[pos++]='\n'; - This->textdata[pos++]='\r'; - This->textdata[pos++]='\n'; - } - - for(i=0;zKeyword[i];i++) { - if(postextdata[pos++]=zKeyword[i]; - } - This->textdata[pos++]=':'; - This->textdata[pos++]=' '; - - for(i=0;zText[i];i++) { - if(postextdata[pos++]='\r'; - } - This->textdata[pos++]=zText[i]; - } - } - This->textdata[pos++]='\0'; - - return MNG_TRUE; -} - -#ifdef MNGPLG_TRACE -static mng_bool MNGPLG_CALLBACK callback_traceproc (mng_handle mng, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname) -{ - if(tracefile) { - fprintf(tracefile,"%d\t%d\t%d\t%s\n",(int)mng,iFuncnr,iFuncseq,zFuncname); - } - return MNG_TRUE; -} -#endif - -/* ----------------------------------------------------------------------- */ -static int file_exists(const char *fn) -{ - HANDLE h; - - // try to open with no access - h=CreateFile(fn,0,FILE_SHARE_READ,NULL,OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL,NULL); - if(h == INVALID_HANDLE_VALUE) { return 0; } - CloseHandle(h); - return 1; -} - -static void handle_read_error(PluginInstance *This, mng_retcode rv) -{ - mng_int8 iSeverity; - mng_chunkid iChunkname; - mng_uint32 iChunkseq; - mng_int32 iExtra1; - mng_int32 iExtra2; - mng_pchar zErrortext; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"returned: %d\n",rv); -#endif - - switch(rv) { - case MNG_NOERROR: case MNG_NEEDTIMERWAIT: - break; - - case MNG_NEEDMOREDATA: - if(This->loadstate>=STATE_LOADED) { - set_error(This,"Unexpected end of file"); - } - else { - This->needresume=1; - } - break; - - case MNG_INVALIDSIG: - set_error(This,"Invalid or missing MNG file (maybe a 404 Not Found error)"); - break; - - default: - - mng_getlasterror(This->mng, &iSeverity,&iChunkname,&iChunkseq,&iExtra1, - &iExtra2,&zErrortext); - - if(zErrortext) { - set_error(This,"Error reported by libmng (%d)\r\n\r\n%s",(int)rv,zErrortext); - } - else { - set_error(This,"Error %d reported by libmng",(int)rv); - } - } -} - -#ifdef MNGPLG_CMS - -static int init_color_management(PluginInstance *This) -{ - mng_set_outputsrgb(This->mng); - return 1; -} - -#endif - -// return 1 if okay -static int my_init_mng(PluginInstance *This) -{ - mng_retcode rv; - int err; - - This->mng = mng_initialize((mng_ptr)This,memallocfunc,memfreefunc,NULL); - //(mng_memalloc) (mng_memfree) - -#ifdef MNGPLG_CMS - init_color_management(This); -#endif - - err=0; - rv=mng_setcb_openstream (This->mng, callback_openstream ); if(rv) err++; - rv=mng_setcb_closestream (This->mng, callback_closestream ); if(rv) err++; - rv=mng_setcb_readdata (This->mng, callback_readdata ); if(rv) err++; - rv=mng_setcb_processheader (This->mng, callback_processheader); if(rv) err++; - rv=mng_setcb_getcanvasline (This->mng, callback_getcanvasline); if(rv) err++; - rv=mng_setcb_refresh (This->mng, callback_refresh ); if(rv) err++; - rv=mng_setcb_gettickcount (This->mng, callback_gettickcount ); if(rv) err++; - rv=mng_setcb_settimer (This->mng, callback_settimer ); if(rv) err++; - rv=mng_setcb_processtext (This->mng, callback_processtext ); if(rv) err++; - -#ifdef MNGPLG_TRACE - rv=mng_setcb_traceproc (This->mng, callback_traceproc ); if(rv) err++; -#endif - if(err) { - warn(This,"Error setting libmng callback functions"); - return 0; - } - - rv= mng_set_suspensionmode (This->mng,MNG_TRUE); - if(rv) { - warn(This,"Error setting suspension mode"); - return 0; - } - - // if the web page author provided a bgcolor, use it - if(This->force_bgcolor) { - rv=mng_set_bgcolor (This->mng, This->bg_r, This->bg_g, This->bg_b); - } - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"initial readdisplay\n"); -#endif - - handle_read_error(This, mng_readdisplay(This->mng) ); - return 1; -} - -/* Global initialization */ -static NPError NPP_Initialize(void) -{ - if(!g_hInst) { - warn(NULL,"MNG plugin error: Cannot load resources"); - } - -#ifdef MNGPLG_TRACE - tracefile=fopen("c:\\temp\\mngtrace.txt","w"); -#endif - -#ifndef IDC_HAND -#define IDC_HAND MAKEINTRESOURCE(32649) -#endif - hcurHandNS = LoadCursor(NULL,IDC_HAND); - if(!hcurHandNS) { - hcurHandNS=LoadCursor(g_hInst,"CURHAND_NS"); - } - - hfontMsg=CreateFont(-12,0,0,0,FW_DONTCARE,TRUE,0,0,ANSI_CHARSET, - OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DRAFT_QUALITY, - VARIABLE_PITCH|FF_SWISS,"Arial"); - return NPERR_NO_ERROR; -} - -/* Global shutdown */ -static void NPP_Shutdown(void) -{ -#ifdef MNGPLG_TRACE - if(tracefile) { - fclose(tracefile); - tracefile=NULL; - } -#endif - if(hfontMsg) DeleteObject((HGDIOBJ)hfontMsg); - return; -} - - -static unsigned char gethex(const char *s) -{ - int v[2]; - int i; - - v[0]=v[1]=0; - for(i=0;i<2;i++) { - if(s[i]>='a' && s[i]<='f') v[i]=s[i]-87; - if(s[i]>='A' && s[i]<='F') v[i]=s[i]-55; - if(s[i]>='0' && s[i]<='9') v[i]=s[i]-48; - } - return (unsigned char)(v[0]*16+v[1]); -} - -static void hexcolor2rgb(const char *s, mng_uint16 *r, mng_uint16 *g, mng_uint16 *b) -{ - if(lstrlen(s)!=7) return; - if(s[0]!='#') return; - (*r)= gethex(&s[1]); (*r)= ((*r)<<8)|(*r); - (*g)= gethex(&s[3]); (*g)= ((*g)<<8)|(*g); - (*b)= gethex(&s[5]); (*b)= ((*b)<<8)|(*b); -} - -static void find_window_size(PluginInstance *This) -{ - RECT r; - if(This->scrolling) { // make sure scrollbars exist if needed - ShowScrollBar(This->fhWnd,SB_BOTH,TRUE); - } - GetClientRect(This->fhWnd, &r); - This->windowwidth=r.right; - This->windowheight=r.bottom; -} - -static void set_scrollbars(PluginInstance *This) -{ - SCROLLINFO si; - int maxpos; - - if(!This->scrolling) return; - if(!This->fhWnd) return; - - ZeroMemory(&si,sizeof(SCROLLINFO)); - si.cbSize = sizeof(SCROLLINFO); - - // horizontal - if(This->lpdib) { - maxpos=This->lpdibinfo->biWidth-This->windowwidth; - if(maxpos<0) maxpos=0; - if(This->xscrollpos>maxpos) This->xscrollpos=maxpos; - if(This->xscrollpos<0) This->xscrollpos=0; - - si.fMask = SIF_ALL|SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = This->lpdibinfo->biWidth -1; - si.nPage = This->windowwidth; - si.nPos = This->xscrollpos; - } - else { // no image to display - si.fMask = SIF_ALL|SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = 0; - si.nPage = 1; - si.nPos = 0; - } - SetScrollInfo(This->fhWnd,SB_HORZ,&si,TRUE); - - // vertical - if(This->lpdib) { - maxpos=This->lpdibinfo->biHeight-This->windowheight; - if(maxpos<0) maxpos=0; - if(This->yscrollpos>maxpos) This->yscrollpos=maxpos; - if(This->yscrollpos<0) This->yscrollpos=0; - - si.fMask = SIF_ALL|SIF_DISABLENOSCROLL; - si.nMin = 0; - si.nMax = This->lpdibinfo->biHeight -1; - si.nPage = This->windowheight; - si.nPos = This->yscrollpos; - } - SetScrollInfo(This->fhWnd,SB_VERT,&si,TRUE); -} - - -#define SCROLLLINE 40 - -static void scrollmsg(PluginInstance *This, UINT msg,int code, short int pos) -{ - int page; - int dx, dy; // amount of scrolling - int x_orig, y_orig; - - if(!This->scrolling) return; - if(!This->lpdib) return; - - x_orig=This->xscrollpos; - y_orig=This->yscrollpos; - - if(msg==WM_HSCROLL) { - page=This->windowwidth-15; - if(pagexscrollpos-=SCROLLLINE; break; - case SB_LINERIGHT: This->xscrollpos+=SCROLLLINE; break; - case SB_PAGELEFT: This->xscrollpos-=page; break; - case SB_PAGERIGHT: This->xscrollpos+=page; break; - case SB_LEFT: This->xscrollpos=0; break; - case SB_RIGHT: This->xscrollpos=This->lpdibinfo->biWidth; break; - case SB_THUMBTRACK: This->xscrollpos=pos; break; - default: return; - } - set_scrollbars(This); - } - else if(msg==WM_VSCROLL) { - page=This->windowheight-15; - if(pageyscrollpos-=SCROLLLINE; break; - case SB_LINEDOWN: This->yscrollpos+=SCROLLLINE; break; - case SB_PAGEUP: This->yscrollpos-=page; break; - case SB_PAGEDOWN: This->yscrollpos+=page; break; - case SB_TOP: This->yscrollpos=0; break; - case SB_BOTTOM: This->yscrollpos=This->lpdibinfo->biHeight; break; - case SB_THUMBTRACK: This->yscrollpos=pos; break; - default: return; - } - set_scrollbars(This); - } - - dx= x_orig - This->xscrollpos; - dy= y_orig - This->yscrollpos; - - if(dx || dy) { // if any change - // GetClientRect(This->fhWnd,&cliprect); - ScrollWindowEx(This->fhWnd,dx,dy,NULL,NULL /*&cliprect*/,NULL,NULL,SW_INVALIDATE); - } -} - -/* Once-per-instance initialization */ -static NPError NPP_New(NPMIMEType pluginType,NPP instance,uint16 mode, - int16 argc,char* argn[],char* argv[],NPSavedData* saved) -{ - PluginInstance* This; - int i; - - if (instance == NULL) { - return NPERR_INVALID_INSTANCE_ERROR; - } - instance->pdata = calloc(sizeof(PluginInstance),1); - - - This = (PluginInstance*) instance->pdata; - if (This == NULL) { - return NPERR_OUT_OF_MEMORY_ERROR; - } - - This->force_bgcolor=1; - This->bg_r = This->bg_g = This->bg_b = 0xffff; - - /* record some info for later lookup */ - This->fWindow = NULL; - This->fMode = mode; - - This->fhWnd = NULL; - This->fDefaultWindowProc = NULL; - This->instance = instance; /* save the instance id for reverse lookups */ - This->scrolling = (mode==NP_FULL); - This->xscrollpos = This->yscrollpos = 0; - This->windowwidth = This->windowheight = 0; - - This->loadstate = STATE_INIT; - This->paintedyet = 0; - This->mng=0; - This->lpdib=NULL; - lstrcpy(This->url,""); - This->frozen=0; - This->needresume=0; - This->errorflag=0; - lstrcpy(This->errormsg,""); - - This->dibsize = This->filesize = 0; - - lstrcpy(This->linkurl,""); - lstrcpy(This->linktarget,"_self"); - This->islink=0; - - This->timer_set=0; - This->timer2_set=0; - This->dynamicmng= -1; - This->mouse_over_mng=0; - This->mouse_captured=0; - - This->linkcursor = hcurHandNS; - - // examine the tag arguments - for(i=0;iforce_bgcolor=1; - hexcolor2rgb(argv[i],&This->bg_r,&This->bg_g,&This->bg_b); - } - else if(!_stricmp(argn[i],"href")) { - lstrcpyn(This->linkurl,argv[i],MAXLEN_URL); - This->islink=1; - } - else if(!_stricmp(argn[i],"target")) { - lstrcpyn(This->linktarget,argv[i],MAXLEN_TARGET); - } - } - - This->bkgdbrush=NULL; - if(This->force_bgcolor) - This->bkgdbrush=CreateSolidBrush(RGB(This->bg_r,This->bg_g,This->bg_b)); - - return NPERR_NO_ERROR; -} - -static void BeforeDestroyWindow(PluginInstance *This) -{ - if(This->timer_set) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - } - if(This->timer2_set) { - KillTimer(This->fhWnd,2); - This->timer2_set=0; - } - if(This->mouse_captured) { - ReleaseCapture(); - This->mouse_captured=0; - } - - SetWindowLong( This->fhWnd, GWL_WNDPROC, (LONG)This->fDefaultWindowProc); // unsubclass - This->fDefaultWindowProc = NULL; - This->fhWnd = NULL; -} - -static NPError NPP_Destroy(NPP instance, NPSavedData** save) -{ - PluginInstance* This; - - if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; - This = (PluginInstance*) instance->pdata; - - if(!This) return NPERR_INVALID_INSTANCE_ERROR; - - if(This->mng) { - This->dynamicmng=0; - mng_cleanup(&This->mng); - This->mng=0; - } - if(This->lpdib) { - free(This->lpdib); - This->lpdib=NULL; - } - if(This->mngdata) { - free(This->mngdata); - This->mngdata=NULL; - This->bytesalloc=0; - } - if(This->textdata) { - free(This->textdata); - This->textdata=NULL; - } - - if( This->fhWnd ) { // un-subclass the plugin window - BeforeDestroyWindow(This); - } - - if(This->bkgdbrush) DeleteObject((HGDIOBJ)This->bkgdbrush); - - if(This) { - if(instance->pdata) free(instance->pdata); - instance->pdata = NULL; - } - - return NPERR_NO_ERROR; -} - -/* Browser is providing us with a window */ -static NPError NPP_SetWindow(NPP instance, NPWindow* window) -{ - NPError result = NPERR_NO_ERROR; - PluginInstance* This; - - if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - - if( This->fhWnd != NULL ) { /* If we already have a window... */ - - if( (window == NULL) || ( window->window == NULL ) ) { - /* There is now no window to use. get rid of the old - * one and exit. */ - BeforeDestroyWindow(This); - This->fWindow=window; - return NPERR_NO_ERROR; - } - - else if ( This->fhWnd == (HWND) window->window ) { - /* The new window is the same as the old one. Redraw and get out. */ - This->fWindow=window; - - InvalidateRect( This->fhWnd, NULL, FALSE ); - /* UpdateWindow( This->fhWnd ); */ - return NPERR_NO_ERROR; - } - else { - /* Unsubclass the old window, so that we can subclass the new - * one later. */ - BeforeDestroyWindow(This); - } - } - else if( (window == NULL) || ( window->window == NULL ) ) { - /* We can just get out of here if there is no current - * window and there is no new window to use. */ - This->fWindow=window; - - return NPERR_NO_ERROR; - } - - /* Subclass the new window so that we can begin drawing and - * receiving window messages. */ - This->fDefaultWindowProc = (WNDPROC)SetWindowLong( (HWND)window->window, GWL_WNDPROC, (LONG)PluginWindowProc); - This->fhWnd = (HWND) window->window; - SetProp( This->fhWnd, gInstanceLookupString, (HANDLE)This); - - This->fWindow = window; - find_window_size(This); - - set_scrollbars(This); - - InvalidateRect( This->fhWnd, NULL, TRUE ); - UpdateWindow( This->fhWnd ); - - return result; -} - -// browser is announcing its intent to send data to us -static NPError NPP_NewStream(NPP instance,NPMIMEType type,NPStream *stream, - NPBool seekable,uint16 *stype) { - PluginInstance* This; - - if(instance==NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - if(!This) - return NPERR_GENERIC_ERROR; - - /* save the URL for later */ - lstrcpyn(This->url,stream->url,MAX_PATH); - - - This->libmngpos=0; - This->bytesloaded=0; - This->bytesalloc=0; - This->byteswanted=0; - This->mngdata=NULL; - This->textdata=NULL; - - // if we know the total length of the stream in advance - // (most of the time we will, hopefully), allocate that amount. - if(stream->end > 0) { - This->mngdata = malloc(stream->end); - This->bytesalloc= stream->end; - } - - my_init_mng(This); - - This->loadstate=STATE_LOADING; - - (*stype)=NP_NORMAL; - - return NPERR_NO_ERROR; -} - -static int32 NPP_WriteReady(NPP instance, NPStream *stream) -{ - /* Number of bytes ready to accept in NPP_Write() */ - /* We can handle any amount, so just return some really big number. */ - return (int32)0X0FFFFFFF; -} - -#define ALLOC_CHUNK_SIZE 131072 - -static int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) -{ - PluginInstance* This; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"NPP_Write offs=%d len=%d\n",offset,len); -#endif - - - if(!instance) return -1; - This = (PluginInstance*) instance->pdata; - if(!This) return -1; - if(len<1) return len; - - if(offset+len > (int)This->bytesalloc) { // oops, overflowed our memory buffer - This->bytesalloc += ALLOC_CHUNK_SIZE; - if(This->mngdata) { - This->mngdata=realloc(This->mngdata, This->bytesalloc); - } - else { // first time - This->mngdata=malloc(This->bytesalloc); - } - if(!This->mngdata) { - warn(This,"Cannot allocate memory for image (%d,%d,%p",offset,len,buffer); - return -1; - } - } - - // now we should have enough room to copy the data to memory - - CopyMemory(&This->mngdata[offset],buffer,len); - - This->bytesloaded = offset+len; - - // now, check if it's time to call mng_read_resume - if(This->needresume && - (This->bytesloaded >= (This->libmngpos + This->byteswanted)) ) - { - This->needresume=0; -// handle_read_error(This, mng_read_resume(This->mng) ); - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"NPP_Write display_resume bytesloaded=%d libmngpos=%d byteswanted=%d\n", - This->bytesloaded,This->libmngpos,This->byteswanted); -#endif - - handle_read_error(This, mng_display_resume(This->mng) ); - } - - - return len; // The number of bytes accepted -- we always accept them all. -} - -/* DestroyStream gets called after the file has finished loading, - */ -static NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) -{ - PluginInstance* This; - if(!instance) return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; -// if(reason==NPRES_DONE) { - This->filesize = This->bytesloaded; - This->loadstate = STATE_LOADED; -// } - - if(reason!=NPRES_DONE) { - set_error(This,"Image load failed or was canceled (%d)",(int)reason); - This->needresume=0; - if(This->timer_set) { KillTimer(This->fhWnd,1); This->timer_set=0; } - return NPERR_NO_ERROR; - } - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"NPP_DestroyStream reason=%d needresume=%d\n",reason,This->needresume); -#endif - - if(This->needresume) { - This->needresume=0; -// handle_read_error(This, mng_read_resume(This->mng) ); - handle_read_error(This, mng_display_resume(This->mng) ); -// This->needresume=0; - } - - return NPERR_NO_ERROR; -} - - -static void NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) -{ - return; -} - -// Print embedded plug-in (via the browser's Print command) -static void NPP_Print(NPP instance, NPPrint* printInfo) -{ - PluginInstance* This; - if (instance == NULL) return; - This = (PluginInstance*) instance->pdata; - - if(printInfo == NULL) { - // Some browsers (Netscape) set printInfo to NULL to tell the plugin - // to print in full page mode (this may be a bug). - // PrintFullPage(); -- full page printing not implemented - return; - } - - if (printInfo->mode == NP_FULL) { - /* the plugin is full-page, and the browser is giving it a chance - * to print in the manner of its choosing */ - void* platformPrint = printInfo->print.fullPrint.platformPrint; - NPBool printOne = printInfo->print.fullPrint.printOne; - - /* Setting this to FALSE and returning *should* cause the browser to - * call NPP_Print again, this time with mode=NP_EMBED. - * However, that doesn't happen with any browser I've ever seen :-(. - * Instead of the following line, you will probably need to implement - * printing yourself. You also might as well set pluginPrinted to TRUE, - * though every browser I've tested ignores it. */ - printInfo->print.fullPrint.pluginPrinted = FALSE; - /* or */ - /* PrintFullPage(); - * printInfo->print.fullPrint.pluginPrinted = TRUE; */ - } - else { // we are embedded, and the browser had provided a printer context - HDC pdc; - int prevstretchmode; - NPWindow* printWindow; - - if(This->loadstate < STATE_VALIDFRAME) return; - - printWindow= &(printInfo->print.embedPrint.window); - - /* embedPrint.platformPrint is a Windows device context in disguise */ - - /* The definition of NPWindow changed between API verion 0.9 and 0.11, - * increasing in size from 28 to 32 bytes. This normally makes it - * impossible for version 0.9 browsers to print version 0.11 plugins - * (because the platformPrint field ends up at the wrong offset) -- - * unless the plugin takes special care to detect this situation. - * To work around it, if we are compiled with API 0.11 or higher, - * and the browser is version 0.9 or earlier, we look for the HDC - * 4 bytes earlier, at offset 28 instead of 32 (of the embedPrint - * sub-structure). - */ - - if(sizeof(NPWindow)>28 && /* i.e. is plugin API >= 0.11? */ - HIBYTE(g_pNavigatorFuncs->version)==0 && - LOBYTE(g_pNavigatorFuncs->version)<=9) { - char *tmpc; - HDC *tmph; - - tmpc= (char*)&(printInfo->print.embedPrint); - tmph= (HDC*)&tmpc[28]; - pdc= *tmph; - } - else { - pdc= (HDC) (printInfo->print.embedPrint.platformPrint); - } - - if(!This->lpdib) return; - - prevstretchmode=SetStretchBltMode(pdc,COLORONCOLOR); - StretchDIBits(pdc, - printWindow->x,printWindow->y, - printWindow->width,printWindow->height, /* dest coords */ - 0,0,This->lpdibinfo->biWidth, This->lpdibinfo->biHeight, /* source coords */ - This->lpdibbits, (LPBITMAPINFO)This->lpdib, - DIB_RGB_COLORS,SRCCOPY); - if(prevstretchmode) SetStretchBltMode(pdc,prevstretchmode); - } - return; -} - - -/*+++++++++++++++++++++++++++++++++++++++++++++++++ - * NPP_URLNotify: - * Notifies the instance of the completion of a URL request. - +++++++++++++++++++++++++++++++++++++++++++++++++*/ -static void NPP_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData) -{ - return; -} - - -/**********************************************************************/ - -/* Try to make a filename from the url. Caller must provide fn[MAX_PATH] buffer. - * This function attempts to extract a bitmap filename from a URL, - * but if it doesn't look like it contains an appropriate name, - * it leaves it blank. */ -static void url2filename(char *fn, char *url) -{ - int title,ext,i; - - lstrcpy(fn,""); - ext=0; /* position of the file extention */ - title=0; /* position of the base filename */ - for(i=0;url[i];i++) { - if(url[i]=='.') ext=i+1; - if(url[i]=='/') title=i+1; - if(url[i]=='\\') title=i+1; // handle Microsoft's bogus file: "URLs" - if(url[i]==':') title=i+1; - if(url[i]=='=') title=i+1; - } - - if (!_stricmp(&url[ext],"mng") || - !_stricmp(&url[ext],"jng") || - !_stricmp(&url[ext],"png") ) - { - lstrcpyn(fn,&url[title],MAX_PATH); - } -} - -// sanitize string and escape '&'s for use in a menu -static void escapeformenu(unsigned char *s1) -{ - int f, t, len; - unsigned char s2[200]; - - t=0; - len=lstrlen(s1); if(len>50) len=50; - for(f=0;fmng || This->loadstatebytesloaded != This->filesize) - { - warn(This,"Image not loaded -- can't save"); - return; - } - - if(lstrlen(This->url)) { - url2filename(fn,This->url); - } - else { - lstrcpy(fn,""); - } - - ZeroMemory(&ofn,sizeof(OPENFILENAME)); - ofn.lStructSize=sizeof(OPENFILENAME); - ofn.hwndOwner=This->fhWnd; - ofn.nFilterIndex=1; - ofn.lpstrTitle="Save Image As..."; - ofn.lpstrFile=fn; - ofn.nMaxFile=MAX_PATH; - ofn.Flags=OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT; - - t=mng_get_sigtype(This->mng); - if(t==mng_it_png) { - ofn.lpstrDefExt="png"; // FIXME also give an option of MNG - ofn.lpstrFilter="PNG (*.png)\0*.png\0\0"; - } - else if(t==mng_it_jng) { - ofn.lpstrDefExt="jng"; // FIXME also give an option of MNG - ofn.lpstrFilter="JNG (*.jng)\0*.jng\0\0"; - } - else { - ofn.lpstrFilter="MNG (*.mng)\0*.mng\0\0"; - ofn.lpstrDefExt="mng"; - } - - if(GetSaveFileName(&ofn)) { - // save to filename: ofn.lpstrFile - hfile=CreateFile(ofn.lpstrFile,GENERIC_WRITE,FILE_SHARE_READ, - NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - if(hfile==INVALID_HANDLE_VALUE) { - warn(This,"Unable to write file"); - } - else { - b=WriteFile(hfile, This->mngdata, This->filesize, - &byteswritten,NULL); - if(!b || byteswritten != This->filesize) { - warn(This,"Error writing file"); - } - CloseHandle(hfile); - } - } -} - - -static void CopyToClipboard(PluginInstance *This,unsigned char *mem,int size,UINT format) -{ - HGLOBAL hClip; - LPVOID lpClip; - - if(!mem) return; - - if(!OpenClipboard(NULL)) { - warn(This,"Can't open the clipboard"); - return; - } - - if(EmptyClipboard()) { - hClip=GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE,size); - lpClip=GlobalLock(hClip); - if(lpClip) { - CopyMemory(lpClip,mem,size); - GlobalUnlock(hClip); - if(!SetClipboardData(format,hClip)) { - warn(This,"Can't set clipboard data"); - } - } - else { - warn(This,"Can't allocate memory for clipboard"); - } - } - else { - warn(This,"Can't clear the clipboard"); - } - CloseClipboard(); -} - -static void AboutDialog(PluginInstance *This) -{ - DialogBoxParam(g_hInst,"ABOUTDLG",This->fhWnd,(DLGPROC)DlgProcAbout,(LPARAM)This); -} - -static void PropDialog(PluginInstance *This) -{ - //if(This->textdata) - DialogBoxParam(g_hInst,"PROPDLG",This->fhWnd,(DLGPROC)DlgProcProp,(LPARAM)This); -} - -static void display_last_error(PluginInstance *This) -{ - if(This->errorflag) { - warn(This,"%s",This->errormsg); - } -} - -static void DynamicMNG_FireEvent(PluginInstance *This, mng_uint8 eventtype, POINTS pos) -{ - mng_retcode r; - if(!This->mng) return; - if(This->dynamicmng == 0) return; - if(This->dynamicmng == -1) { - r=mng_status_dynamic(This->mng); - if(r==MNG_FALSE) { - return; - } - else { - This->dynamicmng=1; - } - } - mng_trapevent(This->mng, eventtype, pos.x+This->xscrollpos, pos.y+This->yscrollpos); -} - - -static void ContextMenu(PluginInstance *This, HWND hwnd) -{ - int cmd; - HMENU menu; - POINT pt; - unsigned char buf[MAX_PATH], buf2[200]; - - pt.x=0; pt.y=0; - GetCursorPos(&pt); - - // create context menu dynamically - menu=CreatePopupMenu(); - if(This->errorflag) { - AppendMenu(menu,MF_ENABLED,ID_SHOWERROR,"SHOW ERROR MESSAGE"); - AppendMenu(menu,MF_SEPARATOR,0,NULL); - } - - AppendMenu(menu,(This->loadstate>=STATE_LOADED?MF_ENABLED:MF_GRAYED),ID_SAVEAS,"Save Image &As..."); - AppendMenu(menu,(This->lpdib?MF_ENABLED:MF_GRAYED),ID_COPYIMAGE,"&Copy Image"); - AppendMenu(menu,MF_ENABLED,ID_COPYURL,"Cop&y Image Location"); - if(This->islink) { - AppendMenu(menu,MF_ENABLED,ID_COPYLINKLOC,"Copy Link Location"); - } - - url2filename(buf,This->url); - escapeformenu(buf); - if(lstrlen(buf)) { - wsprintf(buf2,"View Image (%s)",buf); - } - else { - wsprintf(buf2,"View Image"); - } - AppendMenu(menu,MF_ENABLED,ID_VIEWIMAGE,buf2); - - - AppendMenu(menu,MF_SEPARATOR,0,NULL); - // AppendMenu(menu,(This->mng?MF_ENABLED:MF_GRAYED),ID_STOPANIM,"Stop Animation"); - - - AppendMenu(menu,(This->mng?MF_ENABLED:MF_GRAYED)| - (This->frozen?MF_CHECKED:MF_UNCHECKED),ID_FREEZE,"&Freeze Animation"); - - // AppendMenu(menu,(This->mng?MF_ENABLED:MF_GRAYED),ID_RESTARTANIM,"Restart Animation"); - - AppendMenu(menu,MF_SEPARATOR,0,NULL); - - AppendMenu(menu,MF_ENABLED,ID_PROPERTIES,"Properties..."); - - AppendMenu(menu,MF_ENABLED,ID_ABOUT,"About MNG Plug-in..."); - - cmd=TrackPopupMenuEx(menu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_NONOTIFY|TPM_RETURNCMD| - TPM_RIGHTBUTTON,pt.x,pt.y,hwnd,NULL); - - DestroyMenu(menu); - - switch(cmd) { - - case ID_STOPANIM: - if(This->mng) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - mng_display_freeze(This->mng); - } - break; - - case ID_FREEZE: - This->frozen = !This->frozen; - if(This->frozen) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - mng_display_freeze(This->mng); - } - else { - handle_read_error(This, mng_display_resume(This->mng) ); - - } - break; - - case ID_RESTARTANIM: - if(!This->frozen) { - KillTimer(This->fhWnd,1); - This->timer_set=0; - mng_display_freeze(This->mng); - } - This->frozen=1; - mng_display_reset(This->mng); - This->frozen=0; - handle_read_error(This, mng_display_resume(This->mng) ); - break; - - case ID_SAVEAS: - SaveImage(This); - break; - case ID_COPYIMAGE: - if(This->lpdib) { - CopyToClipboard(This,(unsigned char*)This->lpdib,This->dibsize,CF_DIB); - } - else { - warn(This,"No image to copy"); - } - break; - case ID_COPYURL: - CopyToClipboard(This,This->url,lstrlen(This->url)+1,CF_TEXT); - break; - case ID_COPYLINKLOC: - if(This->islink) { - CopyToClipboard(This,This->linkurl,lstrlen(This->linkurl)+1,CF_TEXT); - } - break; - case ID_VIEWIMAGE: - if(lstrlen(This->url)) - NPN_GetURL(This->instance,This->url,"_self"); - break; - case ID_PROPERTIES: - PropDialog(This); - break; - case ID_ABOUT: - AboutDialog(This); - break; - case ID_SHOWERROR: - display_last_error(This); - break; - } -} - -/*+++++++++++++++++++++++++++++++++++++++++++++++++ - * PluginWindowProc - * Handle the Windows window-event loop. - +++++++++++++++++++++++++++++++++++++++++++++++++*/ -static LRESULT CALLBACK PluginWindowProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - PluginInstance* This; - HDC hdc; - RECT rect; - - This = (PluginInstance*) GetProp(hWnd, gInstanceLookupString); - - if(!This) return DefWindowProc( hWnd, Msg, wParam, lParam); - - switch(Msg) { - - case WM_ERASEBKGND: - { - HBRUSH br; - hdc= (HDC)wParam; - - if(This->bkgdbrush) - br=This->bkgdbrush; - else - br=GetStockObject(GRAY_BRUSH); - - GetClientRect(hWnd,&rect); - FillRect(hdc,&rect,br); - return 1; - } - - case WM_HSCROLL: - case WM_VSCROLL: - scrollmsg(This,Msg,(int)(LOWORD(wParam)),(short int)(HIWORD(wParam))); - return 0; - - case WM_SIZE: - find_window_size(This); - set_scrollbars(This); - return 0; - - - case WM_CONTEXTMENU: case WM_RBUTTONUP: - ContextMenu(This, hWnd); - return 0; - - - case WM_SETCURSOR: - if(LOWORD(lParam)==HTCLIENT) { - if(This->islink) { - SetCursor(This->linkcursor); - return 1; - } - } - break; - - case WM_LBUTTONDOWN: - SetCapture(This->fhWnd); - This->mouse_captured=1; - - if(This->dynamicmng && This->mng && !This->errorflag) { - DynamicMNG_FireEvent(This,4,MAKEPOINTS(lParam)); - } - return 0; - - case WM_LBUTTONUP: - { - RECT rc; - POINT pt; - - if(This->mouse_captured) { - ReleaseCapture(); - This->mouse_captured=0; - } - if(This->dynamicmng && This->mng && !This->errorflag) { - DynamicMNG_FireEvent(This,5,MAKEPOINTS(lParam)); - } - - // if mouse is not over image, don't follow links, etc. - GetWindowRect(This->fhWnd,&rc); - GetCursorPos(&pt); - if(!PtInRect(&rc,pt)) return 0; - - if(This->islink) { - NPN_GetURL(This->instance,This->linkurl,This->linktarget); - return 0; - } - else if(This->errorflag) { - display_last_error(This); - } - } - return 0; - - case WM_MOUSEMOVE: - - if(This->dynamicmng && This->mng && This->lpdib && !This->errorflag) { - POINTS pos; - int overimage; - - pos=MAKEPOINTS(lParam); - overimage=0; - if(pos.x>=0 && pos.xlpdibinfo->biWidth && pos.y>=0 && pos.ylpdibinfo->biHeight) { - overimage=1; - } - - if(overimage) { - if(This->mouse_over_mng) { - // mouse is still over image: mouse move event - DynamicMNG_FireEvent(This,2,pos); // 2=mouse move - } - else { - // mouse wasn't over the image but now it is: mouse-enter event - DynamicMNG_FireEvent(This,1,pos); // mouse enter - } - } - else { // mouse not now over image - if(This->mouse_over_mng) { // ... but it used to be - pos.x=0; pos.y=0; - DynamicMNG_FireEvent(This,3,pos); // 3=mouse leave - } - } - - This->mouse_over_mng=overimage; // remember for next time - - if(This->mouse_over_mng && (This->dynamicmng==1) ) { -#define MOUSE_POLL_INTERVAL 100 // milliseconds - SetTimer(This->fhWnd,2,MOUSE_POLL_INTERVAL,NULL); - This->timer2_set=0; - } - } - return 0; - - case WM_PAINT: - { - PAINTSTRUCT paintStruct; - HDC hdc; - RECT rect2; - - hdc = BeginPaint( hWnd, &paintStruct ); - SetWindowOrgEx(hdc,This->xscrollpos,This->yscrollpos,NULL); - - GetClientRect(hWnd,&rect); - if(This) { - if(This->errorflag || !This->lpdib) { - SelectObject(hdc,hfontMsg); - Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom); - rect2.left=rect.left+2; - rect2.top=rect.top+2; - rect2.right=rect.right-2; - rect2.bottom=rect.bottom-2; - if(This->errorflag) { - DrawText(hdc,"MNG PLUG-IN ERROR!",-1,&rect2,DT_LEFT|DT_WORDBREAK); - } - else { - if(This->loadstate>=STATE_LOADING) { - DrawText(hdc,"MNG image loading...",-1,&rect2,DT_LEFT|DT_WORDBREAK); - } - else { - DrawText(hdc,"MNG plug-in",-1,&rect2,DT_LEFT|DT_WORDBREAK); - } - } - } - else if(This->lpdib) { - StretchDIBits(hdc, - 0,0,This->lpdibinfo->biWidth,This->lpdibinfo->biHeight, - 0,0,This->lpdibinfo->biWidth,This->lpdibinfo->biHeight, - &((BYTE*)(This->lpdib))[sizeof(BITMAPINFOHEADER)], - (LPBITMAPINFO)This->lpdib,DIB_RGB_COLORS,SRCCOPY); - } - } - - - EndPaint( hWnd, &paintStruct ); - } - return 0; - - case WM_TIMER: - switch(wParam) { - case 1: // the main animation timer - KillTimer(hWnd,1); - This->timer_set=0; - -#ifdef MNGPLG_TRACE - fprintf(tracefile,"WM_TIMER display_resume bytesloaded=%d\n",This->bytesloaded); -#endif - - if(This->mng) { - if(!This->needresume) { - handle_read_error(This, mng_display_resume(This->mng) ); - } - } - return 0; - - case 2: // timer for polling mouse position - { - RECT rc; - POINT pt; - POINTS pos; - - GetWindowRect(hWnd,&rc); - GetCursorPos(&pt); - if(!PtInRect(&rc,pt)) { - KillTimer(hWnd,2); - pos.x=0; pos.y=0; - DynamicMNG_FireEvent(This,3,pos); // 3=mouse leave - This->mouse_over_mng=0; - } - } - return 0; - } - break; - - } - - /* Forward unprocessed messages on to their original destination - * (the window proc we replaced) */ - return This->fDefaultWindowProc(hWnd, Msg, wParam, lParam); -} - -static LRESULT CALLBACK DlgProcProp(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - char buf[4096],buf2[1024]; - - switch(Msg) { - case WM_INITDIALOG: - { - DWORD tabs[1]; - - PluginInstance *This=(PluginInstance*)lParam; - - tabs[0]= 60; - SendDlgItemMessage(hWnd,IDC_IMGINFO,EM_SETTABSTOPS,(WPARAM)1,(LPARAM)tabs); - - wsprintf(buf,"URL:\t%s\r\n",This->url); - - if(This->lpdib) { - wsprintf(buf2,"Dimensions:\t%d x %d\r\n",This->lpdibinfo->biWidth, - This->lpdibinfo->biHeight); - lstrcat(buf,buf2); - } - - if(This->lpdib && This->fMode==NP_EMBED) { - wsprintf(buf2,"Window:\t%d x %d\r\n",This->windowwidth, - This->windowheight); - lstrcat(buf,buf2); - } - - if(This->filesize) { - wsprintf(buf2,"File size:\t%u bytes\r\n",This->filesize); - lstrcat(buf,buf2); - } - -#ifdef _DEBUG - if(This->mngdata && This->lpdib && This->bytesalloc && This->dibsize) { - // note this doesn't include memory used by libmng - wsprintf(buf2,"Memory used:\t%u bytes\r\n", - This->bytesalloc + This->dibsize); - lstrcat(buf,buf2); - } -#endif - - if(This->islink) { - wsprintf(buf2,"Link to:\t%s\r\n",This->linkurl); - lstrcat(buf,buf2); - if(strcmp(This->linktarget,"_self")) { - wsprintf(buf2,"Link target:\t%s\r\n",This->linktarget); - lstrcat(buf,buf2); - } - } - - if(This->loadstate >= STATE_VALIDFRAME) { - wsprintf(buf2,"Signature:\t%s\r\n",get_imagetype_name(mng_get_sigtype(This->mng))); - lstrcat(buf,buf2); - wsprintf(buf2,"Image type:\t%s\r\n",get_imagetype_name(mng_get_imagetype(This->mng))); - lstrcat(buf,buf2); - wsprintf(buf2,"Simplicity:\t0x%08x\r\n",mng_get_simplicity(This->mng)); - lstrcat(buf,buf2); - wsprintf(buf2,"Frame count:\t%u\r\n",mng_get_framecount(This->mng)); - lstrcat(buf,buf2); - wsprintf(buf2,"Layer count:\t%u\r\n",mng_get_layercount(This->mng)); - lstrcat(buf,buf2); - wsprintf(buf2,"Play time:\t%u\r\n",mng_get_playtime(This->mng)); - lstrcat(buf,buf2); - } - - SetDlgItemText(hWnd,IDC_IMGINFO,buf); - - if(This->textdata) - SetDlgItemText(hWnd,IDC_MNGTEXT,This->textdata); - } - return(TRUE); - case WM_CLOSE: - EndDialog(hWnd,0); - return(TRUE); - case WM_COMMAND: - switch(wParam) { - case IDOK: - case IDCANCEL: - EndDialog(hWnd,0); - return(TRUE); - } - } - return(FALSE); -} - -static LRESULT CALLBACK DlgProcAbout(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - char buf[4096],buf2[1024],buf3[300]; - - switch(Msg) { - case WM_INITDIALOG: - { - //DWORD tabs[1]; - - PluginInstance *This=(PluginInstance*)lParam; - - //tabs[0]= 60; - //SendDlgItemMessage(hWnd,IDC_IMGINFO,EM_SETTABSTOPS,(WPARAM)1,(LPARAM)tabs); - - wsprintf(buf,"MNGPLG Plug-in, Version %s\r\n%s" -#ifdef _DEBUG - " DEBUG BUILD" -#endif - "\r\nCopyright (C) 2000-2002 by Jason Summers\r\n\r\n",MNGPLGVERS,__DATE__); - - wsprintf(buf2,"Based on libmng by Gerard Juyn.\r\n"); - lstrcat(buf,buf2); - - wsprintf(buf2,"libmng version: %s\r\n\r\n",mng_version_text()); - lstrcat(buf,buf2); - - wsprintf(buf2,"Uses the zlib compression library.\r\n"); - lstrcat(buf,buf2); - wsprintf(buf2,"zlib version: %s\r\n\r\n",zlibVersion()); - lstrcat(buf,buf2); - - wsprintf(buf2,"This software is based in part on the work of the " - "Independent JPEG Group.\r\n"); - lstrcat(buf,buf2); - // This really only gives the version of the libjpeg header used when - // compiling this plugin, but I don't know how to query libjpeg for its - // version. - wsprintf(buf2,"IJG JPEG library version: %s\r\n%s\r\n\r\n",JVERSION,JCOPYRIGHT); - lstrcat(buf,buf2); - -#ifdef MNGPLG_CMS - wsprintf(buf2,"Uses the lcms color management library by Martí Maria. " - "lcms is distributed under the terms of the GNU LESSER GENERAL PUBLIC LICENSE. " - "See the file COPYING-LCMS.\r\n\r\n"); - lstrcat(buf,buf2); -#endif - - if(GetModuleFileName(g_hInst,buf3,260)) { - wsprintf(buf2,"MNGPLG location: %s\r\n",buf3); - lstrcat(buf,buf2); - } - - SetDlgItemText(hWnd,IDC_PRGINFO,buf); - - } - return(TRUE); - case WM_CLOSE: - EndDialog(hWnd,0); - return(TRUE); - case WM_COMMAND: - switch(wParam) { - case IDOK: - case IDCANCEL: - EndDialog(hWnd,0); - return(TRUE); - } - } - return(FALSE); -} - - -///////////////////// -///////////////////// low-level plug-in NPAPI functions - -static JRIGlobalRef Private_GetJavaClass(void) -{ - return NULL; -} - -NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs) -{ - if(!pFuncs) return NPERR_INVALID_FUNCTABLE_ERROR; - - pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; - pFuncs->newp = NPP_New; - pFuncs->destroy = NPP_Destroy; - pFuncs->setwindow = NPP_SetWindow; - pFuncs->newstream = NPP_NewStream; - pFuncs->destroystream = NPP_DestroyStream; - pFuncs->asfile = NPP_StreamAsFile; - pFuncs->writeready = NPP_WriteReady; - pFuncs->write = NPP_Write; - pFuncs->print = NPP_Print; - pFuncs->event = NULL; - - g_pluginFuncs = pFuncs; - - return NPERR_NO_ERROR; -} - -NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs) -{ - int navMinorVers; - - if(!pFuncs) return NPERR_INVALID_FUNCTABLE_ERROR; - - g_pNavigatorFuncs = pFuncs; // save it for future reference - - if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - navMinorVers = g_pNavigatorFuncs->version & 0xFF; - if(navMinorVers>=NPVERS_HAS_NOTIFICATION) - g_pluginFuncs->urlnotify = NPP_URLNotify; - if( navMinorVers>=NPVERS_HAS_LIVECONNECT) - g_pluginFuncs->javaClass = Private_GetJavaClass(); - - return NPP_Initialize(); -} - -NPError WINAPI NP_Shutdown() -{ - NPP_Shutdown(); - - g_pNavigatorFuncs = NULL; - return NPERR_NO_ERROR; -} diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.def b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.def deleted file mode 100644 index 9dcd7dc5f..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.def +++ /dev/null @@ -1,6 +0,0 @@ -LIBRARY npmngplg - -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep deleted file mode 100644 index c7a306e5c..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dep +++ /dev/null @@ -1,22 +0,0 @@ -# Microsoft Developer Studio Generated Dependency File, included by npmngplg.mak - -.\npmngplg.c : \ - "..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - "..\jpgsrc6b\jconfig.h"\ - "..\jpgsrc6b\jmorecfg.h"\ - "..\jpgsrc6b\jpeglib.h"\ - "..\jpgsrc6b\jversion.h"\ - "..\lcms-1.08a\include\icc34.h"\ - "..\lcms-1.08a\include\lcms.h"\ - "..\libmng-1.0.4\libmng.h"\ - "..\libmng-1.0.4\libmng_conf.h"\ - "..\libmng-1.0.4\libmng_types.h"\ - "..\zlib-1.1.4\zconf.h"\ - "..\zlib-1.1.4\zlib.h"\ - ".\npapidefs.h"\ - - -.\npmngplg.rc : \ - ".\cur_ie.cur"\ - ".\cur_ns.cur"\ - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp deleted file mode 100644 index 5bd4698ff..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsp +++ /dev/null @@ -1,123 +0,0 @@ -# Microsoft Developer Studio Project File - Name="npmngplg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=npmngplg - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "npmngplg.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "npmngplg.mak" CFG="npmngplg - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "npmngplg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "npmngplg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\libmng-1.0.5\Release\libmng.lib ..\zlib-1.1.4\Release\zlib.lib ..\jpgsrc6b\Release\libjpeg.lib ..\lcms-1.09b\src\Release\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /machine:I386 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\libmng-1.0.5\Debug\libmng.lib ..\zlib-1.1.4\Debug\zlib.lib ..\jpgsrc6b\Debug\libjpeg.lib ..\lcms-1.09b\src\Debug\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"c:\program files\opera\program\plugins\npmngplg.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "npmngplg - Win32 Release" -# Name "npmngplg - Win32 Debug" -# Begin Source File - -SOURCE=.\cur_ns.cur -# End Source File -# Begin Source File - -SOURCE=.\npapidefs.h -# End Source File -# Begin Source File - -SOURCE=.\npmngplg.c - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -# SUBTRACT CPP /YX - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -# SUBTRACT CPP /Fr /YX /Yc /Yu - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\npmngplg.def -# End Source File -# Begin Source File - -SOURCE=.\npmngplg.rc -# End Source File -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw deleted file mode 100644 index a52c8b0c2..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "npmngplg"=.\npmngplg.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak deleted file mode 100644 index 6ed10b619..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.mak +++ /dev/null @@ -1,225 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on npmngplg.dsp -!IF "$(CFG)" == "" -CFG=npmngplg - Win32 Debug -!MESSAGE No configuration specified. Defaulting to npmngplg - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "npmngplg - Win32 Release" && "$(CFG)" != "npmngplg - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "npmngplg.mak" CFG="npmngplg - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "npmngplg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "npmngplg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -ALL : "$(OUTDIR)\npmngplg.dll" - - -CLEAN : - -@erase "$(INTDIR)\npmngplg.obj" - -@erase "$(INTDIR)\npmngplg.res" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\npmngplg.dll" - -@erase "$(OUTDIR)\npmngplg.exp" - -@erase "$(OUTDIR)\npmngplg.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\npmngplg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\npmngplg.res" /d "NDEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\npmngplg.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=..\libmng-1.0.5\Release\libmng.lib ..\zlib-1.1.4\Release\zlib.lib ..\jpgsrc6b\Release\libjpeg.lib ..\lcms-1.09b\src\Release\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\npmngplg.pdb" /machine:I386 /def:".\npmngplg.def" /out:"$(OUTDIR)\npmngplg.dll" /implib:"$(OUTDIR)\npmngplg.lib" -DEF_FILE= \ - ".\npmngplg.def" -LINK32_OBJS= \ - "$(INTDIR)\npmngplg.obj" \ - "$(INTDIR)\npmngplg.res" - -"$(OUTDIR)\npmngplg.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug - -ALL : "..\..\program files\opera\program\plugins\npmngplg.dll" - - -CLEAN : - -@erase "$(INTDIR)\npmngplg.obj" - -@erase "$(INTDIR)\npmngplg.res" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\npmngplg.exp" - -@erase "$(OUTDIR)\npmngplg.lib" - -@erase "$(OUTDIR)\npmngplg.pdb" - -@erase "..\..\program files\opera\program\plugins\npmngplg.dll" - -@erase "..\..\program files\opera\program\plugins\npmngplg.ilk" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\npmngplg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -RSC_PROJ=/l 0x409 /fo"$(INTDIR)\npmngplg.res" /d "_DEBUG" -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\npmngplg.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=..\libmng-1.0.5\Debug\libmng.lib ..\zlib-1.1.4\Debug\zlib.lib ..\jpgsrc6b\Debug\libjpeg.lib ..\lcms-1.09b\src\Debug\lcms.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\npmngplg.pdb" /debug /machine:I386 /def:".\npmngplg.def" /out:"c:\program files\opera\program\plugins\npmngplg.dll" /implib:"$(OUTDIR)\npmngplg.lib" /pdbtype:sept -DEF_FILE= \ - ".\npmngplg.def" -LINK32_OBJS= \ - "$(INTDIR)\npmngplg.obj" \ - "$(INTDIR)\npmngplg.res" - -"..\..\program files\opera\program\plugins\npmngplg.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("npmngplg.dep") -!INCLUDE "npmngplg.dep" -!ELSE -!MESSAGE Warning: cannot find "npmngplg.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "npmngplg - Win32 Release" || "$(CFG)" == "npmngplg - Win32 Debug" -SOURCE=.\npmngplg.c - -!IF "$(CFG)" == "npmngplg - Win32 Release" - -CPP_SWITCHES=/nologo /MT /W3 /GX /O2 /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -"$(INTDIR)\npmngplg.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) @<< - $(CPP_SWITCHES) $(SOURCE) -<< - - -!ELSEIF "$(CFG)" == "npmngplg - Win32 Debug" - -CPP_SWITCHES=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\libmng-1.0.5" /I "..\zlib-1.1.4" /I "..\jpgsrc6b" /I "..\lcms-1.09b\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -"$(INTDIR)\npmngplg.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) @<< - $(CPP_SWITCHES) $(SOURCE) -<< - - -!ENDIF - -SOURCE=.\npmngplg.rc - -"$(INTDIR)\npmngplg.res" : $(SOURCE) "$(INTDIR)" - $(RSC) $(RSC_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc deleted file mode 100644 index c0dee930d..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/npmngplg.rc +++ /dev/null @@ -1,175 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,1,1 - PRODUCTVERSION 1,0,1,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "Comments", "\0" - VALUE "CompanyName", "Jason Summers\0" - VALUE "FileDescription", "MNG Plug-in 1.0.1\0" - VALUE "FileExtents", "mng|mng|jng|jng\0" - VALUE "FileOpenName", "MNG Animation (*.mng)|MNG Animation (*.mng)|JNG Image (*.jng)|JNG Image (*.jng)\0" - VALUE "FileVersion", "1.0.1\0" - VALUE "InternalName", "npmngplg\0" - VALUE "LegalCopyright", "Copyright © 2000-2002\0" - VALUE "LegalTrademarks", "\0" - VALUE "MIMEType", "video/mng|video/x-mng|image/jng|image/x-jng\0" - VALUE "OriginalFilename", "npmngplg.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "MNG Plug-in 1.0.1\0" - VALUE "ProductVersion", "1.0.1\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -ABOUTDLG DIALOG DISCARDABLE 0, 0, 282, 137 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "MNGPLG" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,225,7,50,14,WS_GROUP - EDITTEXT IDC_PRGINFO,7,7,213,123,ES_MULTILINE | ES_AUTOVSCROLL | - ES_READONLY | NOT WS_BORDER | WS_VSCROLL | WS_GROUP -END - -PROPDLG DIALOG DISCARDABLE 0, 0, 344, 186 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Image properties" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,287,7,50,14,WS_GROUP - EDITTEXT IDC_IMGINFO,7,7,275,97,ES_MULTILINE | ES_AUTOVSCROLL | - ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_GROUP - LTEXT "Image comments:",IDC_STATIC,7,108,56,8 - EDITTEXT IDC_MNGTEXT,7,119,275,60,ES_MULTILINE | ES_READONLY | - WS_VSCROLL | WS_GROUP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - "ABOUTDLG", DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 275 - TOPMARGIN, 7 - BOTTOMMARGIN, 130 - END - - "PROPDLG", DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 337 - TOPMARGIN, 7 - BOTTOMMARGIN, 179 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Cursor -// - -CURHAND_NS CURSOR DISCARDABLE "cur_ns.cur" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/resource.h b/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/resource.h deleted file mode 100644 index 878c604fa..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/mngplg-src-1.0.1/resource.h +++ /dev/null @@ -1,19 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by npmngplg.rc -// -#define IDR_DATA1 106 -#define IDC_PRGINFO 1000 -#define IDC_IMGINFO 1001 -#define IDC_MNGTEXT 1002 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 110 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Engine/lib/lmng/contrib/msvc/mngplg/readme.txt b/Engine/lib/lmng/contrib/msvc/mngplg/readme.txt deleted file mode 100644 index 002c4f13a..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngplg/readme.txt +++ /dev/null @@ -1,211 +0,0 @@ -MNGPLG -A simple browser plug-in for the MNG image/animation file format. - -By Jason Summers -Version 1.0.1 2 Oct 2002 -Web site: - - -COPYRIGHT NOTICE - -Copyright (c) 2000-2002 by Jason Summers - -THIS SOFTWARE IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT -ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE -THIS SOFTWARE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING -ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THIS SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THIS SOFTWARE TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. The origin of this source code must not be misrepresented; - you must not claim that you wrote the original software. - 2. Altered source versions must be plainly marked as such, and must not - be misrepresented as being the original source. - 3. Altered binary versions must not be misrepresented as being the - original. - 4. This Copyright notice may not be removed or altered from any source - or altered source distribution, although you may add a Copyright - notice for yourself for any code that you have written. - - -This software uses several third-party libraries (listed below), some of -which are optional. If you redistribute MNGPLG, it is your responsibility to -comply with the licenses of any libraries used. - -This package includes a compiled executable plug-in file, npmngplg.dll. This -file includes code from lcms, which is distributed under the LGPL. To the -best of my understanding, that basically means that anyone distributing that -file must (1) make it possible for the recipient to modify the plug-in to -use a new or modified version of lcms, and (2) make available the lcms -source code. Requirement (1) is satisfied by the inclusion of the source -code. For requirement (2), you can find out how to get the lcms source code -at the web site listed at the beginning of this document, if necessary. - - ---------- - -Based on libmng. - Copyright (c) 2000,2002 Gerard Juyn (gerard@libmng.com) - - -Uses the zlib compression library. - (C) 1995-2002 Jean-loup Gailly and Mark Adler - -This software is based in part on the work of the Independent JPEG Group. - Copyright (C) 1991-1998, Thomas G. Lane - -Uses the lcms color management library by Martí Maria Saguer. - (distributed under the GNU LESSER GENERAL PUBLIC LICENSE) - ---------- - -SECURITY NOTICE - -Although I've tried to write it carefully, MNGPLG has not had any sort of -security audit. Due to the nature of plug-ins, it is possible for certain -types of bugs to exist which may allow remote web sites to take control of -your computer or do harm to it by sending a carefully constructed data file -to the plug-in. If you are paranoid about security, you may not wish to -leave MNGPLG enabled in your browser for an extended period of time. - ---------- - -INTRODUCTION - -MNGPLG is a Netscape-style browser plug-in which displays the MNG -image/animation format. It is configured to claim the following MIME types: - - video/x-mng - video/mng - image/x-jng - image/jng - -It claims the file extensions ".mng" and ".jng", but file extensions should -only apply when no MIME type is available (e.g. on an FTP site, or on your -local hard disk). - -It can also display PNG image files, but it would cause too many problems -for it to try to claim the PNG data type. - -If you are configuring a web server to support MNG and JNG, the correct -MIME types to use are "video/x-mng" and "image/x-jng", since the MIME types -have not, as of this writing, been officially registered. - - -REQUIREMENTS - -MNG requires a 32-bit Windows operating system, and a 32-bit web browser -that supports Netscape-style plug-ins. For example, it works in Netscape 3 -and higher, Opera 3.51 and higher, and Microsoft Internet Explorer from -about version 3 to 5.0. (It does not readily work in IE 5.5sp2 and -higher.) Netscape 6 and higher (and related browsers) include native -support for MNG, so it should not be necessary to use this plug-in. - - -INSTALLATION - -There's no install program. To install it, copy the included "npmngplg.dll" -file to your browser's "Plugins" folder, then restart your browser. - -For Netscape 4.x, the Plugins folder is typically located somewhere like: -C:\Program Files\Netscape\Communicator\Program\Plugins - -Note: Windows Explorer, by default, is configured to hide files that end in -".dll". You should probably change that setting. I'd tell you how, but it's -different in almost every version of Windows. - -In Netscape 4.x, you can verify that the plug-in is installed by choosing -Help|About Plug-ins from the main menu (with JavaScript enabled). - -To uninstall, delete the npmngplg.dll file. It does not create any other -files. It currently does not write anything to the Windows registry. - - -HOW TO USE (FOR END USERS) - -Right-click on an MNG image as it is being displayed to get a menu with some -of the usual features. - -Right-click and choose "Properties" to display some internal information -about the image. Some images have embedded text information that will be -shown in the "Image comments" area. For technical reasons, some or all of -the comments may not be available until the animation completes a full loop. - - -HOW TO USE (FOR WEB DEVELOPERS) - -First, if at all possible, configure your web server (not browser) to -assign the MIME type "video/x-mng" to files that end in ".mng", and -assign type "image/x-jng" to files that end in ".jng". - -The most reliable way to embed MNG files in a web page is (unfortunately) -to use the nonstandard tag. For example: - - - -The src, width, and height attributes are required. Width and height should -match the actual width and height of the image. - -Transparency is not supported, and probably never will be. However, you can -supply a background color to use in transparent areas by using the BGCOLOR -attribute in the EMBED tag, i.e.: - - - -You cannot use color names like "red"; you must use the hexadecimal format -as in the example. - -An image can be made into a "hotlink" by including an HREF and optionally a -TARGET attribute in the EMBED tag. For example: - - - - -SOURCE CODE - -The C source code is included. I've only tested it with libmng 1.0.5, -but it's probably also compatible with other versions, maybe with -minor changes. - -To compile it, you'll need: - -- libmng MNG library . - -libmng in turn uses some other libraries: - - - zlib compression library - - - IJG JPEG library - - - [optional] lcms "Little Color Management System" library. - -If you include lcms, turn on the MNG_FULL_CMS option in libmng_conf.h -before compiling. Note that lcms is distributed under the LGPL -- be sure -you understand the implications of that before distributing any resulting -executable files. - -If you don't include lcms, comment out the "#define MNGPLG_CMS" line in -npmngplg.c. - -I also recommend turning on the MNG_ERROR_TELLTALE and -MNG_SUPPORT_DYNAMICMNG options in libmng_conf.h. - -The files from the Netscape plug-in SDK are no longer needed as of MNGPNG -0.9.4. - -Make sure to include the npmngplg.def file in your project, or declare the -necessary DLL entry points in some other way. diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsp b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsp deleted file mode 100644 index b2c114e8c..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsp +++ /dev/null @@ -1,126 +0,0 @@ -# Microsoft Developer Studio Project File - Name="MNGView" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=MNGView - Win32 Debug -!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE -!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl -!MESSAGE -!MESSAGE NMAKE /f "MNGView.mak". -!MESSAGE -!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben -!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: -!MESSAGE -!MESSAGE NMAKE /f "MNGView.mak" CFG="MNGView - Win32 Debug" -!MESSAGE -!MESSAGE Für die Konfiguration stehen zur Auswahl: -!MESSAGE -!MESSAGE "MNGView - Win32 Release" (basierend auf "Win32 (x86) Application") -!MESSAGE "MNGView - Win32 Debug" (basierend auf "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "MNGView - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "NDEBUG" -# ADD RSC /l 0xc07 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"MNGView.exe" - -!ELSEIF "$(CFG)" == "MNGView - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "_DEBUG" -# ADD RSC /l 0xc07 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "MNGView - Win32 Release" -# Name "MNGView - Win32 Debug" -# Begin Group "Quellcodedateien" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# Begin Source File - -SOURCE=.\Main.rc -# End Source File -# Begin Source File - -SOURCE=.\mng.cpp -# End Source File -# End Group -# Begin Group "Header-Dateien" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\Main.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# End Group -# Begin Group "Ressourcendateien" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\Mng.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsw b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsw deleted file mode 100644 index 54bc89302..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN! - -############################################################################### - -Project: "MNGView"=.\MNGView.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.opt b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.opt deleted file mode 100644 index 1106e85eb1eda410345a3e81fd9ff927edba940d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 48640 zcmeHQ3vgW5Sw2UKtVe8FvSrJTWBXc)ZOM9AZ(Dw^cJE4S?<>12$!?r(SG!lzwN`i4 zyDPtvkWMM%7Mj*=(~y=nb_xsxm{OR5&OnCA6le*M)&rgn3??K6rjxW~0#h=SB$)5q z*X~LySvDpK^uK35-Sha*`Tz5ubJzF&KIcEzzEl6ov%hoSt8Bq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wpg=*_8wsM4LB)1mq<>}Yg66D$)4h5Z*j6uv;dz7#*-s_L)J7~uHVG6 zQcuxIMDegI5^G6kl8Lli_>pXt9+PJ8=%gMr?F+`_h}Y$o?_R64{*&y#Wd9}mFWG;Y z*zvj39(m+Ze}|24mK=r3u2H1J+(U=?f)uvy&0%7q3)&w2Vewtq<>dq_=PXz`)@CzK*^@d8nhi+wJWb^7ajM zbalC0U0r?d?jE`4F~-`hz6m3aZKix1k=KBaAy44XVMQDP%GlEuwRv;zg_VW9iG&Z; z{}cBC+~E(Ay#|#+qt= z9w~txsAb;~HLmK;)4~NJPKep{NRLbI+2`u@bae0Y_M_{bt`3*Cdq{M>%RSiT9rVZp zx9Iu}G%C;p;h#a*`Fq@Tae`Ab&{1$l)VQjwIWc`#dj2)EDexwGEqc!0Y`g1*hLfmo5&MbZH>A%MfN`&k4)#kOp2Ambp8vS{{lO{VKF>X z;4w1)p8$0J3w}HoTy*{mo&Q4TztH(FbpDI*r`pfx{1-a^h0cFj@RC4D(g10oqz3*Q DV=S|x diff --git a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.plg b/Engine/lib/lmng/contrib/msvc/mngview/MNGView.plg deleted file mode 100644 index c950d9e5d..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/MNGView.plg +++ /dev/null @@ -1,34 +0,0 @@ - - -

-

Erstellungsprotokoll

-

---------------------Konfiguration: MNGView - Win32 Release-------------------- -

-

Befehlszeilen

-Erstellen der temporären Datei "C:\WINDOWS\TEMP\RSPF386.TMP" mit Inhalten -[ -/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Release/MNGView.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c -"F:\Nikgames\Libmng\contrib\MNGView\Main.cpp" -] -Creating command line "cl.exe @C:\WINDOWS\TEMP\RSPF386.TMP" -Erstellen der temporären Datei "C:\WINDOWS\TEMP\RSPF387.TMP" mit Inhalten -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/MNGView.pdb" /machine:I386 /out:"MNGView.exe" -.\Release\Main.obj -.\Release\mng.obj -.\Release\Main.res -] -Erstellen der Befehlzeile "link.exe @C:\WINDOWS\TEMP\RSPF387.TMP" -

Ausgabefenster

-Kompilierung läuft... -Main.cpp -Linker-Vorgang läuft... - - - -

Ergebnisse

-MNGView.exe - 0 Fehler, 0 Warnung(en) -
- - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Main.cpp b/Engine/lib/lmng/contrib/msvc/mngview/Main.cpp deleted file mode 100644 index bf1f98d6b..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/Main.cpp +++ /dev/null @@ -1,334 +0,0 @@ -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// -// MNGView Sample Application for VC6: -// Loads all MNG/JNG/PNG Files LibMNG can do -// Can save a single Frame to PNG Format. -// -// This code is public domain. -// Created by Nikolaus Brennig, November 14th, 2000. -// virtualnik@nol.at -// http://cust.nol.at/ppee -// -// Tab: 4 -// -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- - -#define WIN32_LEAN_AND_MEAN -#include "Main.h" - - -//--------------------------------------------------------------------------------------------- -// Libs (its up to you to make VC find the libs; set the paths in the options): -//--------------------------------------------------------------------------------------------- -#pragma comment(lib,"comctl32.lib") -#pragma comment(lib,"libmng.lib") -#pragma comment(lib,"libjpeg.lib") -#pragma comment(lib,"libz.lib") -#pragma comment(lib,"lcmsstat.lib") - - -//--------------------------------------------------------------------------------------------- -// Vars: -//--------------------------------------------------------------------------------------------- -HWND hPicWin; -HINSTANCE hinst; -HMENU hMenu; -HDC MemDC, hdc; -HBITMAP MemImage, DefaultMemImage; -ANIMFILE AnimFile; -RECT rcRect; -OPENFILENAME ofn, sfn; -int W, H, Bits; -int dx, dy; -char OFNFile[1024]; -char CurDir[1024]; - - -//--------------------------------------------------------------------------------------------- -// Loads a file: -//--------------------------------------------------------------------------------------------- -VOID LoadOFN( HWND hwnd ) -{ - GetCurrentDirectory( sizeof(CurDir), CurDir ); - - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = hwnd; - ofn.lpstrFile = OFNFile; - ofn.nMaxFile = sizeof(OFNFile); - ofn.lpstrFilter = "Network Graphics (*.mng;*.jng:*.png)\0*.mng;*.jng;*.png\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = NULL; - ofn.lpstrInitialDir = CurDir; - ofn.lpstrTitle = "Load:"; - ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | - OFN_HIDEREADONLY | OFN_NONETWORKBUTTON; - - // Display the Open dialog box. - if( GetOpenFileName(&ofn) ) - { - dx = dy = W = H = 0; - if( AnimFile.isAnimation == 1 ) CleanUpMNG(); - LoadMNG( OFNFile, hwnd, hdc ); - } -} - - -//--------------------------------------------------------------------------------------------- -// Saves a file: -//--------------------------------------------------------------------------------------------- -VOID SaveSFN( HWND hwnd ) -{ - GetCurrentDirectory( sizeof(CurDir), CurDir ); - - // Initialize OPENFILENAME - sfn.lStructSize = sizeof(OPENFILENAME); - sfn.hwndOwner = hwnd; - sfn.lpstrFile = OFNFile; - sfn.nMaxFile = sizeof(OFNFile); - sfn.lpstrFilter = "PNG\0*.png\0"; - sfn.nFilterIndex = 1; - sfn.lpstrFileTitle = 0; - sfn.nMaxFileTitle = 0; - sfn.lpstrInitialDir = CurDir; - sfn.lpstrTitle = "Save an Image"; - sfn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_NONETWORKBUTTON; - - // Display the Open dialog box. - if( GetSaveFileName(&sfn) ) - { - SaveMNG( OFNFile, MemDC, MemImage ); - } -} - - -//--------------------------------------------------------------------------------------------- -// For stringhandling... -//--------------------------------------------------------------------------------------------- -VOID catpath( char *dst, const char *src ) -{ - int len = lstrlen(dst); - if( len > 0 && (dst[len-1] != '\\' && dst[len-1] != '/') ) lstrcat( dst, "\\" ); - lstrcat( dst, src ); -} - - -//--------------------------------------------------------------------------------------------- -// MainWindow WindowProc -//--------------------------------------------------------------------------------------------- -long WINAPI WindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) -{ - switch( message ) - { - case WM_TIMER: - { - int wTimerID = wParam; - if( AnimFile.isAnimation == 1 && wTimerID == 2 ) - { - UpdateMNG(); - SendMessage( hPicWin, WM_PAINT, 0, 0 ); - } - } - break; - - case WM_COMMAND: - switch( LOWORD(wParam) ) - { - case FILE_OPEN: - LoadOFN(hwnd); - break; - - case FILE_SAVE: - SaveSFN(hwnd); - break; - - case FILE_EXIT: - DestroyWindow( hPicWin ); - break; - - case HELP_ABOUT: - Warning( - "MNGView Sample Application for VC6.\n" \ - "This Code is Public Domain.\n" \ - "Created by Nikolaus Brennig." - ); - break; - } - break; - - case WM_ERASEBKGND: - return 0L; - - case WM_PAINT: - // GetDC: - GetClientRect( hPicWin, &rcRect ); - hdc = GetDC( hPicWin ); - - if( MemDC == 0 ) - { - BitBlt( hdc, 0, 0, rcRect.right, rcRect.bottom, MemDC, 0, 0, BLACKNESS ); - ReleaseDC( hPicWin, hdc ); - break; - } - - // Erase: - // Upper area... - BitBlt( hdc, 0, 0, rcRect.right, (0+dy), MemDC, 0, 0, BLACKNESS ); - // Lower area... - BitBlt( hdc, 0, (0+dy)+H, rcRect.right, rcRect.bottom - ((0+dy)+H), MemDC, 0, 0, BLACKNESS ); - // Left area... - BitBlt( hdc, 0, 0, (0+dx), rcRect.bottom, MemDC, 0, 0, BLACKNESS ); - // Right area... - BitBlt( hdc, (0+dx)+W, 0, rcRect.right, rcRect.bottom, MemDC, 0, 0, BLACKNESS ); - - // Show Imageframe: - BitBlt( hdc, dx, dy, W, H, MemDC, 0, 0, SRCCOPY ); - - // Release DC... - ReleaseDC( hPicWin, hdc ); - break; - - case WM_HSCROLL: - { - int nScrollCode = (int) LOWORD(wParam); // scroll bar value - if( nScrollCode == SB_LINELEFT ) dx += 10; - if( nScrollCode == SB_LINERIGHT ) dx -= 10; - SendMessage( hwnd, WM_PAINT, 0, 0 ); - } - break; - - case WM_VSCROLL: - { - int nScrollCode = (int) LOWORD(wParam); // scroll bar value - if( nScrollCode == SB_LINEUP ) dy += 10; - if( nScrollCode == SB_LINEDOWN ) dy -= 10; - SendMessage( hwnd, WM_PAINT, 0, 0 ); - } - break; - - case WM_GETMINMAXINFO: - ((MINMAXINFO*)lParam)->ptMinTrackSize.x = 550; - ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 450; - return 0L; - - case WM_DESTROY: - if( AnimFile.isAnimation == 1 ) - CleanUpMNG(); - if( hMenu ) DestroyMenu( hMenu ); - PostQuitMessage(0); - return 0L; - } - - return DefWindowProc( hwnd, message, wParam, lParam ); -} - - -//--------------------------------------------------------------------------------------------- -// ok, initen wir mal das Window mit den Styleparametern... -//--------------------------------------------------------------------------------------------- -BOOL InitApplication( HINSTANCE hInstance, int nCmdShow, LPSTR lpCommandLine ) -{ - WNDCLASSEX wcex; - - ZeroMemory( &wcex, sizeof(wcex) ); - wcex.cbSize = sizeof(wcex); - wcex.style = 0; - wcex.lpfnWndProc = WindowProc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(APPICON)); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); - wcex.hbrBackground = HBRUSH(GetStockObject(BLACK_BRUSH)); - wcex.lpszMenuName = 0; - wcex.lpszClassName = "MNGViewClass"; - wcex.hIconSm = 0; - - if( !RegisterClassEx(&wcex) ) - return Error( "RegisterClass failed!" ); - - // Init: - W = 0; - H = 0; - AnimFile.isAnimation = 0; - MemDC = 0; - MemImage = 0; - DefaultMemImage = 0; - - // Create the Window: - hPicWin = CreateWindowEx( - 0, - "MNGViewClass", - TITLE, - WS_OVERLAPPEDWINDOW|WS_SYSMENU|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_HSCROLL|WS_VSCROLL, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, NULL, - hInstance, - NULL - ); - if( !hPicWin ) - return Error( "Couldn't create Window!" ); - - // Load our menu... - hMenu = LoadMenu( GetModuleHandle(NULL), MAKEINTRESOURCE(THEMENU) ); - if( hMenu == 0 ) Warning( "Unable to load Menu!" ); - SetMenu( hPicWin, hMenu ); - - InitCommonControls(); - - UpdateWindow(hPicWin); - ShowWindow(hPicWin, SW_NORMAL); - - return true; -} - - -//--------------------------------------------------------------------------------------------- -// Ok. Das ist die Startfunktion, die wird als erstes von Windows augerufen... -//--------------------------------------------------------------------------------------------- -int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) -{ - MSG msg; - - hinst = hInstance; - - if( !InitApplication(hInstance, nCmdShow, lpCmdLine) ) - return -1; - - while( GetMessage(&msg, NULL, 0, 0) ) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - return msg.wParam; -} - - -//--------------------------------------------------------------------------------------------- -// Error -//--------------------------------------------------------------------------------------------- -BOOL Error( const char *err ) -{ - MessageBox( hPicWin, err, TITLE, MB_ICONHAND+MB_OK ); - DestroyWindow( hPicWin ); - - return FALSE; -} - - -//--------------------------------------------------------------------------------------------- -// Warning -//--------------------------------------------------------------------------------------------- -BOOL Warning( const char *err ) -{ - MessageBox( hPicWin, err, TITLE, MB_ICONHAND+MB_OK ); - - return FALSE; -} - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Main.h b/Engine/lib/lmng/contrib/msvc/mngview/Main.h deleted file mode 100644 index 9d9743f4d..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/Main.h +++ /dev/null @@ -1,75 +0,0 @@ -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// -// MNGView Sample Application for VC6: -// Loads all MNG/JNG/PNG Files LibMNG can do -// Can save a single Frame to PNG Format. -// -// This code is public domain. -// Created by Nikolaus Brennig, November 14th, 2000. -// virtualnik@nol.at -// http://cust.nol.at/ppee -// -// Tab: 4 -// -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- - -#ifndef _MAIN_H -#define _MAIN_H - - -//--------------------------------------------------------------------------------------------- -// Includes: -//--------------------------------------------------------------------------------------------- -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include "Resource.h" - - -//--------------------------------------------------------------------------------------------- -// Defines: -//--------------------------------------------------------------------------------------------- -#define TITLE "MNGView Sample Application 1.0" - - -//--------------------------------------------------------------------------------------------- -// global Vars: -//--------------------------------------------------------------------------------------------- -extern HWND hPicWin; -extern HINSTANCE hinst; -extern HDC MemDC, hdc; -extern HBITMAP MemImage, DefaultMemImage; -extern int W, H, Bits; - - -typedef struct -{ - int MaxFrame; - int CurFrame; - int Delay; - int isAnimation; -} ANIMFILE; -extern ANIMFILE AnimFile; - - -//--------------------------------------------------------------------------------------------- -// Function prototypes: -//--------------------------------------------------------------------------------------------- -BOOL Error( const char *err ); -BOOL Warning( const char *err ); -VOID catpath( char *dst, const char *src ); - - -// MNG.cpp specific: -VOID LoadMNG( LPSTR Filename, HWND hwnd, HDC hdc ); -VOID SaveMNG( LPSTR Filename, HDC hdc, HBITMAP hBmp ); - -VOID UpdateMNG(); -VOID CleanUpMNG(); - - -#endif \ No newline at end of file diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Main.rc b/Engine/lib/lmng/contrib/msvc/mngview/Main.rc deleted file mode 100644 index dc4df8de1..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/Main.rc +++ /dev/null @@ -1,105 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "Windows.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Englisch (USA) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -THEMENU MENU DISCARDABLE -BEGIN - POPUP "File" - BEGIN - MENUITEM "Open", FILE_OPEN - MENUITEM "Save", FILE_SAVE - MENUITEM SEPARATOR - MENUITEM "Exit", FILE_EXIT - END - POPUP "Help" - BEGIN - MENUITEM "About", HELP_ABOUT - END -END - -#endif // Englisch (USA) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Deutsch (Österreich) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA) -#ifdef _WIN32 -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -APPICON ICON DISCARDABLE "MNG.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""Windows.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Deutsch (Österreich) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/Mng.ico b/Engine/lib/lmng/contrib/msvc/mngview/Mng.ico deleted file mode 100644 index 9016eafbba78b92ba4b8ecd260a42346ccea529d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2238 zcmc(gUufG^6vscmUw!FsgQwhk&%NJs zzW1DS&o2c-f3X;j%62^-cP^AIBx7=3PoG$qESZtzK= zmx)YD?3~A)L3JdDfzqmE9N*aFi0&2v%x&3CT3=V|zx@TR7Kl1BBmQX;d?x7npTA~^k%)_d$#qYT-Qo$0n%zb8~iwx(o zQf?;nx`09BwO8-af!Q^?~{&PBUzQdolB}8tTB=kqcA;W@TB?xy_3&RzZ!C;h2$H$ARgdiZl2CynLlzXgn|KX9gWkjVpdib zbbo+X&MZ?5cB?z>J~4P#FI?1`9nyy}Q)cdq9M#Ss*^KzC0PW=1)`kBZH7JRv>q?l< zIt?nuJ>_e#vk!LE06R+FUeD_pi~2CK<6UrijMP^U2}4!qCB=PN@kg{)OL0oFPc40m zm54HNF~jtXMP%uFh?Vuh>He_p|9XMR=L5=jS@EiopCnD@V?@r+fcsZHAZ+lLYIq{m zGpXY$!Y=VFd|a-(;G$tT6i!04aBhYC{M=Bz z@(ILp3)q00R{huC^3ZyIUbSUni@$S8pW%HQ96i;&zv%2VJBmH2*3PDmyPylXcCzr} ztAmaBE`OWNw{lmP#OJT$zL66_o&N!E9d{G({Oh=*czM_sKEJKou8p{@Ka6{J_U$%Y be}7wll(_znLfo^b!J8f@`VWcme~y0vE&YIi diff --git a/Engine/lib/lmng/contrib/msvc/mngview/mng.cpp b/Engine/lib/lmng/contrib/msvc/mngview/mng.cpp deleted file mode 100644 index dbfc56a01..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/mng.cpp +++ /dev/null @@ -1,615 +0,0 @@ -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -// -// MNGView Sample Application for VC6: -// Loads all MNG/JNG/PNG Files LibMNG can do -// Can save a single Frame to PNG Format. -// -// This code is public domain. -// Created by Nikolaus Brennig, November 14th, 2000. -// virtualnik@nol.at -// http://cust.nol.at/ppee -// -// Tab: 4 -// -//--------------------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------------------- -#define WIN32_LEAN_AND_MEAN -#include "Main.h" -#include - - -//--------------------------------------------------------------------------------------------- -// VARS: -//--------------------------------------------------------------------------------------------- -typedef struct -{ - FILE *file; - LPSTR filename; - mng_uint32 delay; -} mngstuff; - -int lineWidth; -BYTE *mngdestbuffer; -mngstuff *mymngstuff; -mng_handle Curmng; - - - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -//--------------------------------------------------------------------------------------------- -// callbacks for the mng decoder: -//--------------------------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// - -//--------------------------------------------------------------------------------------------- -// memory allocation; data must be zeroed -//--------------------------------------------------------------------------------------------- -mng_ptr mymngalloc( mng_uint32 size ) -{ - return (mng_ptr)calloc(1, size); -} - - -//--------------------------------------------------------------------------------------------- -// memory deallocation -//--------------------------------------------------------------------------------------------- -void mymngfree(mng_ptr p, mng_uint32 size) -{ - free(p); -} - - -//--------------------------------------------------------------------------------------------- -// Stream open: -//--------------------------------------------------------------------------------------------- -mng_bool mymngopenstream(mng_handle mng) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // open the file - mymng->file = fopen( mymng->filename, "rb" ); - if( mymng->file == NULL ) - { - char temp[100]; - sprintf( temp, "Unable to open File: %s", mymng->filename ); - Warning( temp ); - return MNG_FALSE; - } - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// Stream open for Writing: -//--------------------------------------------------------------------------------------------- -mng_bool mymngopenstreamwrite(mng_handle mng) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // open the file - mymng->file = fopen( mymng->filename, "wb" ); - if( mymng->file == NULL ) - { - Warning( "unable to open file!" ); - return MNG_FALSE; - } - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// Stream close: -//--------------------------------------------------------------------------------------------- -mng_bool mymngclosestream(mng_handle mng) -{ - return MNG_TRUE; // We close the file ourself, mng_cleanup doesnt seem to do it... -} - - -//--------------------------------------------------------------------------------------------- -// feed data to the decoder -//--------------------------------------------------------------------------------------------- -mng_bool mymngreadstream( mng_handle mng, mng_ptr buffer, mng_uint32 size, mng_uint32 *bytesread ) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // read the requested amount of data from the file - *bytesread = fread( buffer, sizeof(BYTE), size, mymng->file ); - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// the header's been read. set up the display stuff -//--------------------------------------------------------------------------------------------- -mng_bool mymngprocessheader( mng_handle mng, mng_uint32 width, mng_uint32 height ) -{ - // Store values: - W = width; H = height; - Bits = 24; - lineWidth = ((((W * Bits) + 31) >> 5) << 2); - - // Create decoderbuffer: - mngdestbuffer = new BYTE[lineWidth*H]; - if( mngdestbuffer == 0 ) Warning( "Out of Memory!" ); - - // Create the MemoryBitmap now, we store there the image... - if( DefaultMemImage ) SelectObject( MemDC, DefaultMemImage ); - if( MemDC ) DeleteDC( MemDC ); - if( MemImage ) DeleteObject( MemImage ); - hdc = GetDC( hPicWin ); - MemDC = CreateCompatibleDC( 0 ); - MemImage = CreateCompatibleBitmap( hdc, W, H ); - DefaultMemImage = (HBITMAP)SelectObject( MemDC, MemImage ); - ReleaseDC( hPicWin, hdc ); - - // Set output style: - mng_set_canvasstyle( mng, MNG_CANVAS_BGR8 ); - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// return a row pointer for the decoder to fill -//--------------------------------------------------------------------------------------------- -mng_ptr mymnggetcanvasline( mng_handle mng, mng_uint32 line ) -{ - return (mng_ptr)(mngdestbuffer + (lineWidth*(H-1-line))); -} - - -//--------------------------------------------------------------------------------------------- -// timer -//--------------------------------------------------------------------------------------------- -mng_uint32 mymnggetticks(mng_handle mng) -{ - return (mng_uint32)GetTickCount(); -} - - -//--------------------------------------------------------------------------------------------- -// Refresh: -//--------------------------------------------------------------------------------------------- -mng_bool mymngrefresh( mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h ) -{ - PBITMAPINFO bmpi = (PBITMAPINFO)LocalAlloc(LPTR, sizeof(BITMAPINFOHEADER)); - bmpi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmpi->bmiHeader.biWidth = W; - bmpi->bmiHeader.biHeight = H; - bmpi->bmiHeader.biPlanes = 1; - bmpi->bmiHeader.biCompression = BI_RGB; - bmpi->bmiHeader.biBitCount = Bits; - bmpi->bmiHeader.biSizeImage = 0; - bmpi->bmiHeader.biClrUsed = 0; - bmpi->bmiHeader.biClrImportant = 0; - - // Now blt the Image onto our MemDC... - StretchDIBits( MemDC, 0, 0, W, H, 0, 0, W, H, mngdestbuffer, bmpi, 0, SRCCOPY ); - LocalFree((PBITMAPINFO)bmpi); - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// interframe delay callback -//--------------------------------------------------------------------------------------------- -mng_bool mymngsettimer(mng_handle mng, mng_uint32 msecs) -{ - mngstuff *mymng; - - // look up our stream struct - mymng = (mngstuff*)mng_get_userdata(mng); - - // set the timer for when the decoder wants to be woken - mymng->delay = msecs; - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// Error Callback; -//--------------------------------------------------------------------------------------------- -mng_bool mymngerror( - mng_handle mng, mng_int32 code, mng_int8 severity, - mng_chunkid chunktype, mng_uint32 chunkseq, - mng_int32 extra1, mng_int32 extra2, mng_pchar text - ) -{ - char chunk[5]; - - // pull out the chuck type as a string - // FIXME: does this assume unsigned char? - chunk[0] = (char)((chunktype >> 24) & 0xFF); - chunk[1] = (char)((chunktype >> 16) & 0xFF); - chunk[2] = (char)((chunktype >> 8) & 0xFF); - chunk[3] = (char)((chunktype ) & 0xFF); - chunk[4] = '\0'; - - // output the error: - char temp[1000]; - sprintf( temp, "error playing chunk %s (%d)", chunk, chunkseq ); - Warning( temp ); - - // No need for anymore decoding: - KillTimer( hPicWin, 2 ); - - // error occured; - return MNG_FALSE; -} - - -//--------------------------------------------------------------------------------------------- -// Load a MNG/JNG/PNG file: -//--------------------------------------------------------------------------------------------- -VOID LoadMNG( LPSTR Filename, HWND hwnd, HDC hdc ) -{ - // allocate our stream data structure - mymngstuff = (mngstuff*)calloc(1, sizeof(*mymngstuff)); - if( mymngstuff == NULL ) - { - Warning( "Unable to allocate MNG struct!" ); - return; - } - - // pass the name of the file we want to play - mymngstuff->filename = Filename; - - // set up the mng decoder for our stream - Curmng = mng_initialize(mymngstuff, mymngalloc, mymngfree, MNG_NULL); - if(Curmng == MNG_NULL) - { - free(mymngstuff); - Warning( "MNG Init Error!" ); - return; - } - - // No need to store chunks: - mng_set_storechunks(Curmng, MNG_FALSE); - - // Set the colorprofile, lcms uses this: - mng_set_srgb( Curmng, MNG_TRUE ); - char DestDir[2048]; - SearchPath( NULL, "MNGVIEW.EXE", NULL, sizeof(DestDir), DestDir, NULL ); - lstrcpyn( DestDir, DestDir, lstrlen(DestDir)-lstrlen("MNGVIEW.EXE") ); - catpath( DestDir, "sRGB.icm" ); - FILE *RGBfile = fopen( DestDir, "rb" ); - if( RGBfile == 0 ) - { - mng_cleanup(&Curmng); - free(mymngstuff); - Warning( "Need file \"sRGB.icm\" !" ); - return; - } - fclose(RGBfile); - mng_set_outputprofile(Curmng, DestDir); - - // Set white as background color: - WORD Red = (255 << 8) + 255; - WORD Green = (255 << 8) + 255; - WORD Blue = (255 << 8) + 255; - mng_set_bgcolor( Curmng, Red, Green, Blue ); - - // If PNG Background is available, use it: - mng_set_usebkgd( Curmng, MNG_TRUE ); - - // set the callbacks - mng_setcb_errorproc(Curmng, mymngerror); - mng_setcb_openstream(Curmng, mymngopenstream); - mng_setcb_closestream(Curmng, mymngclosestream); - mng_setcb_readdata(Curmng, mymngreadstream); - mng_setcb_gettickcount(Curmng, mymnggetticks); - mng_setcb_settimer(Curmng, mymngsettimer); - mng_setcb_processheader(Curmng, mymngprocessheader); - mng_setcb_getcanvasline(Curmng, mymnggetcanvasline); - mng_setcb_refresh(Curmng, mymngrefresh); - - // Read the stuff: - mng_readdisplay(Curmng); - - AnimFile.CurFrame = mng_get_layercount( Curmng ); - AnimFile.MaxFrame = mng_get_framecount( Curmng ); - AnimFile.isAnimation = 1; - AnimFile.Delay = mymngstuff->delay; - - // Start the whole thing: - SetTimer( hPicWin, 2, mymngstuff->delay, 0 ); -} - - -//--------------------------------------------------------------------------------------------- -// Called when loading a new file or Appquit: -//--------------------------------------------------------------------------------------------- -void CleanUpMNG() -{ - KillTimer( hPicWin, 2 ); - mng_cleanup(&Curmng); - fclose( mymngstuff->file ); - free(mymngstuff); - delete [] mngdestbuffer; -} - - -//--------------------------------------------------------------------------------------------- -// Called when timer says next frame/layer/update is needed: -//--------------------------------------------------------------------------------------------- -void UpdateMNG() -{ - mymngstuff->delay = 0; - if( MNG_NEEDTIMERWAIT == mng_display_resume(Curmng) ) - { - KillTimer( hPicWin, 2 ); - SetTimer( hPicWin, 2, mymngstuff->delay, 0 ); - } - else - { - CleanUpMNG(); - AnimFile.CurFrame = -1; - AnimFile.MaxFrame = -1; - AnimFile.isAnimation = -1; - AnimFile.Delay = -1; - } -} - - - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -//--------------------------------------------------------------------------------------------- -// MNG WRITING STUFF: -//--------------------------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// -int OffsetX=0,OffsetY=0,OffsetW=0,OffsetH=0; -BYTE *srcbuffer=0, *tmpbuffer; - - -//--------------------------------------------------------------------------------------------- -// Callback for writing data: -//--------------------------------------------------------------------------------------------- -mng_bool mymngwritedata( mng_handle hMNG, mng_ptr pBuf, mng_uint32 iSize, mng_uint32 *iWritten ) -{ - mngstuff *pMydata = (mngstuff*)mng_get_userdata(hMNG); - - *iWritten = fwrite( pBuf, sizeof(BYTE), iSize, pMydata->file ); - - if( *iWritten < iSize ) - { - Warning( "write error" ); - return MNG_FALSE; - } - - return MNG_TRUE; -} - - -//--------------------------------------------------------------------------------------------- -// swap Rs and Bs... -//--------------------------------------------------------------------------------------------- -BOOL RGBFromBGR( BYTE *buf, UINT widthPix, UINT height ) -{ - UINT col, row; - LPBYTE pRed, pBlu; - BYTE tmp; - - if (buf==NULL)return FALSE; - - INT TmpRow = 0; - INT WidthBytes = widthPix*3; - if(WidthBytes & 0x003) WidthBytes = (WidthBytes | 3) + 1; - INT OurCol = 0; - for( row=0; rowbmiHeader.biSize = sizeof(BITMAPINFOHEADER); - pbmi->bmiHeader.biWidth = bmp.bmWidth; - pbmi->bmiHeader.biHeight = -bmp.bmHeight; - pbmi->bmiHeader.biPlanes = bmp.bmPlanes; - pbmi->bmiHeader.biBitCount = 24; - pbmi->bmiHeader.biCompression = BI_RGB; - pbmi->bmiHeader.biSizeImage = LineWidth * H * FrameCount; - pbmi->bmiHeader.biClrImportant = 0; - - // Alloc Memory... - srcbuffer = 0; - srcbuffer = new BYTE[LineWidth*H*FrameCount]; - if( srcbuffer == 0 ) - Warning( "srcbuffer == 0!" ); - - // get the buffer and modify the format: - if( 0 == GetDIBits( MemDC, hBmp2, 0, (WORD) (H*FrameCount), srcbuffer, pbmi, 0 ) ) - Warning( "no GetDIBits!!!" ); - RGBFromBGR( srcbuffer, W, H*FrameCount ); - if( srcbuffer == 0 ) - Warning( "srcbuffer == 0!" ); - - // Freee. - LocalFree((PBITMAPINFO)pbmi); -} - - -//--------------------------------------------------------------------------------------------- -// Writes a single PNG datastream -//--------------------------------------------------------------------------------------------- -VOID WritePNG( mng_handle hMNG, int Frame, int FrameCount ) -{ - BYTE *dstbuffer; - INT LineWidth; - INT WidthBytes; - - OffsetX=0; OffsetY=0; OffsetW=W; OffsetH=H; - - // Get WidthBytes... - WidthBytes = W*3; - LineWidth = W*3; - if(LineWidth & 0x003) LineWidth = (LineWidth | 3) + 1; - - tmpbuffer = new BYTE[(WidthBytes+1)*OffsetH]; - if( tmpbuffer == 0 ) Warning( "Out of Memory!" ); - - // Write DEFI chunk. - mng_putchunk_defi( hMNG, 0, 0, 0, MNG_TRUE, OffsetX, OffsetY, MNG_FALSE, 0, 0, 0, 0 ); - - // Write Header: - mng_putchunk_ihdr( - hMNG, - OffsetW, OffsetH, - MNG_BITDEPTH_8/*iBitdepth*/, - MNG_COLORTYPE_RGB/*iColortype*/, - MNG_COMPRESSION_DEFLATE/*iCompression*/, - MNG_FILTER_ADAPTIVE/*iFilter*/, - MNG_INTERLACE_NONE /*iInterlace*/ - ); - - // transfer data, add Filterbyte: - for( int Row=0; Row No Filter. - tmpbuffer[Row*(WidthBytes+1)]=0; - - // Copy the scanline: - memcpy( - tmpbuffer+Row*(WidthBytes+1)+1, - srcbuffer+((OffsetY+Row)*(LineWidth))+OffsetX, - WidthBytes - ); - } - - // Free srcbuffer if not animated GIF: - delete [] srcbuffer; - - // Compress data with ZLib (Deflate): - dstbuffer = new BYTE[(WidthBytes+1)*OffsetH]; - if( dstbuffer == 0 ) Warning( "Out of Memory!" ); - DWORD dstbufferSize=(WidthBytes+1)*OffsetH; - - // Compress data: - if( Z_OK != compress2( - (Bytef *)dstbuffer, (ULONG *)&dstbufferSize, - (const Bytef*)tmpbuffer, (ULONG) (WidthBytes+1)*OffsetH, - 9 - )) Warning( "Unable to compress imagedata!" ); - - // Write Data into MNG File: - mng_putchunk_idat( hMNG, dstbufferSize, (mng_ptr*)dstbuffer); - mng_putchunk_iend(hMNG); - - // Free the stuff: - delete [] tmpbuffer; - delete [] dstbuffer; -} - - -//--------------------------------------------------------------------------------------------- -// Writes a MNG (24bit) -//--------------------------------------------------------------------------------------------- -VOID SaveMNG( LPSTR Filename, HDC hdc, HBITMAP hBmp ) -{ - mng_handle hMNG; - - // check if currently a MNG file is loaded: - if( AnimFile.isAnimation == 1 ) - CleanUpMNG(); - - // Creates the srcbuffer for imagedata: - CreateSrcBuffer( 0, 1, hBmp ); - - // allocate our stream data structure - mymngstuff = (mngstuff*)calloc(1, sizeof(*mymngstuff)); - if( mymngstuff == NULL ) - { - Warning( "Cannot allocate data buffer." ); - return; - } - - // pass the name of the file we want to play - mymngstuff->filename = Filename; - - // init the lib: - hMNG = mng_initialize((mng_ptr)mymngstuff, mymngalloc, mymngfree, MNG_NULL); - if( !hMNG ) - { - Warning( "Cannot initialize libmng." ); - return; - } - else - { - mng_setcb_openstream(hMNG, mymngopenstreamwrite ); - mng_setcb_closestream(hMNG, mymngclosestream); - mng_setcb_writedata(hMNG, mymngwritedata); - - // Write File: - mng_create(hMNG); - - // Just a single Frame (save a normal PNG): - WritePNG( hMNG, 0, 1 ); - - // Now write file: - mng_write(hMNG); - - // Free the stuff: - fclose( mymngstuff->file ); - mng_cleanup(&hMNG); - } - - free( mymngstuff ); -} - - diff --git a/Engine/lib/lmng/contrib/msvc/mngview/resource.h b/Engine/lib/lmng/contrib/msvc/mngview/resource.h deleted file mode 100644 index 281352369..000000000 --- a/Engine/lib/lmng/contrib/msvc/mngview/resource.h +++ /dev/null @@ -1,22 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Main.rc -// -#define THEMENU 102 -#define APPICON 200 -#define FILE_OPEN 40002 -#define FILE_EXIT 40003 -#define HELP_ABOUT 40004 -#define FILE_SAVE 40005 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40006 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Engine/lib/lmng/contrib/msvc/mngview/sRGB.icm b/Engine/lib/lmng/contrib/msv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qcZ`QLw&XXtVF;#zMJ5QQ^HU&RY&_ z#cUO9?cHXxt!mqsB3{w;V$0%+;!h>qlI!1DeOLM2%=U!sy`}c0`*+}W2zT7w>ALe+ znPOR9+0d@wU9IKJ@}ly$yI1VKR$*IlU=L}JWRJ8msIt9EuWCotr|P8Yff|pR=Dq5B zx9y$U$J^Jx-)(=>0gVI22Rfw1Ho}dP#Y+O@16`i z*?Ee6s_7^FpZ2!UT8dhs*4);Kwxl*`drW)Z>44Ln9nKvsKb!x2^o;hInzPDhOV5$c z6`Y$npLc%pLdJ#hi-{M9I#+Z)y0qldovyI1-phfPuU_%Fa;e+B`}|dxt7on`T|0f9 zeZB35{f*WhyPlR`?0#wKweM}c>2S0CmgB9Cz6E{f`d#}k-uAkE<&OWI8v~05`tB~i zd;ebCJ?VYk{m}=h4_-gadN}=P{bTIoq9+PZDxRu8t^L*b*Ji1`^z5M5V9&FNXOD)s zLoff8`L9pI1<$F^D@L?N>PM|d&y4wu-FmU~#qi6Fm($~gzbXE<_m$DBpMH1yy=P*{ z#PDm;>zO}F-l)Dg`quVs=Va*Q(|2j_rl*SDtG++>f&HQTWAw+7>FiJVPnDmIKX-fy L{PK7vZD!`*_k{EN diff --git a/Engine/lib/lmng/contrib/msvc/win32dll/README.txt b/Engine/lib/lmng/contrib/msvc/win32dll/README.txt deleted file mode 100644 index d0c079a64..000000000 --- a/Engine/lib/lmng/contrib/msvc/win32dll/README.txt +++ /dev/null @@ -1,23 +0,0 @@ -MSVC project files for libmng.dll ---------------------------------- - -Contribution by Chad Austin -(This README by Gerard Juyn) - -These project files were kindly donated by Chad. Please note that it -requires jpeglib, zlib and lcms to be in a directory which is at the -same level as the libmng directory. - -I'm not sure how things work, since I don't have access to MSVC, so -it could be this needs a little tweaking, considering the location -where I put contributions. - -As to the DLL itself. If you want to distribute libmng.dll with your -Application and store it in the standard Windows system-directory, you -*must* use the libmng.dll provided in this distribution. *Not* a dll -you have compiled yourself, unless you place this dll in the same -directory as your own Application!!! - -Thanks, - -Gerard diff --git a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsp b/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsp deleted file mode 100644 index 70fb028d8..000000000 --- a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsp +++ /dev/null @@ -1,465 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libmng" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libmng - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libmng.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libmng.mak" CFG="libmng - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libmng - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libmng - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libmng - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W2 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /D "MNG_BUILD_DLL" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "libmng - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W2 /Gm /GX /ZI /Od /I "zlib" /I "jpeg" /I "lcms/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBMNG_EXPORTS" /D "MNG_BUILD_DLL" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "libmng - Win32 Release" -# Name "libmng - Win32 Debug" -# Begin Group "mng" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\..\libmng_callback_xs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_chunk_io.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_chunk_prc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_chunk_xs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_cms.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_display.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_dither.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_error.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_hlapi.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_jpeg.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_object_prc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_pixels.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_prop_xs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_read.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_trace.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_write.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\libmng_zlib.c -# End Source File -# End Group -# Begin Group "jpeg" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcapimin.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcapistd.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jccoefct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jccolor.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcdctmgr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jchuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcinit.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcmainct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcmarker.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcmaster.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcomapi.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcparam.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcphuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcprepct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jcsample.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jctrans.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdapimin.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdapistd.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdatadst.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdatasrc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdcoefct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdcolor.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jddctmgr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdhuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdinput.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmainct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmarker.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmaster.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdmerge.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdphuff.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdpostct.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdsample.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jdtrans.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jerror.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jfdctflt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jfdctfst.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jfdctint.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctflt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctfst.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctint.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jidctred.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jmemmgr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jmemnobs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jquant1.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jquant2.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\jpgsrc6b\jutils.c -# End Source File -# End Group -# Begin Group "lcms" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSCNVRT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSERR.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSGAMMA.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSGMT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsintrp.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsio1.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSLUT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSMATSH.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsmtrx.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSPACK.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmspcs.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\CMSWTPNT.C -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\lcms\source\cmsxform.c -# End Source File -# End Group -# Begin Group "zlib" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\..\zlib\adler32.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\compress.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\crc32.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\deflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\infblock.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\infcodes.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\inffast.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\inflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\inftrees.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\infutil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\trees.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\uncompr.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\..\zlib\zutil.c -# End Source File -# End Group -# End Target -# End Project diff --git a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsw b/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsw deleted file mode 100644 index 40148e03b..000000000 --- a/Engine/lib/lmng/contrib/msvc/win32dll/libmng.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "libmng"=".\libmng.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Engine/lib/lmng/doc/Plan1.png b/Engine/lib/lmng/doc/Plan1.png deleted file mode 100644 index ced55172788251f9a45bc555d0395f298a0cf1ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9058 zcmZ8{c|25a|Naa^Gbm%r5;|r`_AS|>84WWeg^*oLgpfV^G?oS#V<{n&$dV;HAse&$*ZDeO=f4{$rx9=wpvE@iBowprblCj3Ed_ z4}d^)*P!$u5O}ymvyaxndPVQ57VY=o;Nb8=y90sNQxpnlKMdZ6`bM<&1JG{OF(VKN zv9E(cU%fNDm_A3$7H82;T-_h94fTFNM@Lr{CFaKk})Ykru}jzO?}OUNlg6~T3DFf*n_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wl4-j8A94O`<%6q)y@Q3Se7BTp zW?(Q4w0%HNv-EJ#)0hY_b=$G){9n^g@c4P~BWQ#Z^>Pm6abnrtT+G96j;*)8)S@i7 zVV&kabku{i{KoT*C(nX(=6{}Jq%7`U-_?@roysg3(4eOVBB-IUrC}sqw0914a(@aO z4y6OI&?vex6NrbYC9S|G^c>eeg8P2oEY(Y8oKgF<&$LurP7C!BH={z-A?u|5d|pGx`6t natjLl)>&k%;(yLE-#3n!i~%saUY*B>|B%tq(#I5Q+7kaCz%_pi diff --git a/Engine/lib/lmng/doc/Plan2.png b/Engine/lib/lmng/doc/Plan2.png deleted file mode 100644 index 3619ea6631c97409ae78cb407c62deb405419175..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8849 zcmZ{KcT`hb^L8Q$gr=cM69`2S=_n#i5?X?E5Ri`aD$+!n#Lxl?1dxs(i1Z>w5Gh_E zV(5zWDiA@cf^-CahwFXs_50&nYgV$)KKq6?6s0;JsmVX4F?Sf1fti#s2YGk z6bKOL)GZhV2m~IhR2~3soYB*|sRn!>A0MB503#4+GyQT2@CEfX&@lw&k3k1@rwu_M zJ`oL7)Xn>2t4~MsUX+|xOZs|z?4vkf3UL^6>(Fn&pO&)sm0vf; zdaEaFq&9+F{NOAf)eU-DjUQyCsfEgO)|s2BXZt@SQDEmhCFj086_g~bycRQf&$PP! z+O^5nw|zK9#FF&zt?GDmLqwKmGPABgeM-?4C7}-^D^s&DBQy z@`J7T4dLo`>2jB0t@r|UTP!<%X!^DTJ?9UVT|Pbm|* z95LakPp5Kl0Izr0P@8hEEb&47 za@Lr0vBp@TJYn4WsJ!z><)y}e%K*x(Y8HZya}-9_qq2sv+UbUtHS=3WGWxoOfQ&sjJCs-1o7c);l_wEEgdNJy$hB=NFZxeZ!bp zmqhaQ8z*E&-5)i-R_)48ae%H@P)TTL)A2*MA8t0rbuSjAT(ix3XoIXjGni$LKRS{s zfbSgQy~RGudT#y7t)i$*;!i#7j|yE_UJ5l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8nj%s9&DH>1`FvL ze(TV=#X}%@96h~aPu8F#Yl(o#<_Rr64M`LRt1H)b@O5vns=5oV!JEKY1`}~5A`C2< z*TLWepr)=0Kc0!11M}j7xd`Ug!8vIZq_8Uy*(>2a;B~dCnzoq>C=j6@Wbn~0&R4^S z8+k9I^}^t#;+5GNG}s=6%-&A3qo@5v;#@;f| z?Q>F@ty|flD@mQ;jzvlIn|y7jenC)v+5XvIj_%IdKJA~Sa(vfEIj8J8t|9(b zJ2HT_OLT?5k_HC!k5*f?6a4`b-eD~S(Pqn=WF4SV&0=lU>Se9e4+Z>vek6H|X9|C< za0V6`VX*ikEjdLY>18NS#Rmo@S7 zy!Hb`yW1-%M12S$GjCkFDh4QMX%YGt{jXl=@;8srx~#Iir{>Y`Z@n131=^5APJL$1 zc4VdnD(%FrKkVe-`BFqkBUD1*5FB|Mg!{)VLGL71u28}0+7!Yf6i)qpP$1}z4s~3& z62q3!lF|&W8=o97{GCNejge8|*!7~K=n%LyWHdy39eCGgs>SJnbx`$W)0aZeF`$3eQV_?L zKtM4n=bs$#S?<7*FJ(?`v;czk|H#zuQ2rIMm%LcQ5q6V`?dlK+()Qa*#+9y|XRcAO TRG2#XLy3l(j%tOn4etK{O_6P$ diff --git a/Engine/lib/lmng/doc/doc.readme b/Engine/lib/lmng/doc/doc.readme deleted file mode 100644 index e92e93cb5..000000000 --- a/Engine/lib/lmng/doc/doc.readme +++ /dev/null @@ -1,19 +0,0 @@ -This directory hosts the documentation for libmng. - -You will find a lot of useful info on the web-site: -http://www.libmng.com - -Man-pages are in the man sub-directory - -RPM specification files are in the RPM sub-directory - -Files in this directory: - -- libmng.txt - -Description of the library proper and its usage - -- Plan1.png & Plan2.png - -Visual representation of the functional and technical -design of the library (in PNG format of course!) diff --git a/Engine/lib/lmng/doc/libmng.txt b/Engine/lib/lmng/doc/libmng.txt deleted file mode 100644 index b9e9bc4b8..000000000 --- a/Engine/lib/lmng/doc/libmng.txt +++ /dev/null @@ -1,1107 +0,0 @@ -libmng - Multiple-image Network Graphics (MNG) Reference Library 1.0.9 - -DESCRIPTION -The libmng library supports decoding, displaying, encoding, and various -other manipulations of the Multiple-image Network Graphics (MNG) format -image files. It uses the zlib compression library, and optionally the -JPEG library by the Independant JPEG Group (IJG) and/or -lcms (little cms), a color-management library by Marti Maria Saguer. - - -I. Introduction - -This file describes how to use and modify the MNG reference library -(known as libmng) for your own use. There are seven sections to this -file: introduction, callbacks, housekeeping, reading, displaying, -writing, and modification and configuration notes for various special -platforms. We assume that libmng is already installed; see the -INSTALL.README file for instructions on how to install libmng. - -Libmng was written to support and promote the MNG specification. - -The latest MNG specification (currently 1.0) is available at - http://www.libpng.org/pub/mng/ - -Other information about MNG can be found at the MNG home page at - http://www.libpng.org/pub/mng/ - -The latest version of libmng can be found at its own homepage at - http://www.libmng.com/ - -In most cases the library will not need to be changed. -For standardization purposes the library contains both a Windows DLL -and a makefile for building a shared library (SO). The library is -written in C, but an interface for Borland Delphi is also available. - -Libmng has been designed to handle multiple sessions at one time, -to be easily modifiable, to be portable to the vast majority of -machines (ANSI, K&R, 32-, and 64-bit) available, and to be easy -to use. - -Libmng uses zlib for its compression and decompression of MNG files. -Further information about zlib, and the latest version of zlib, can be -found at the zlib home page, . -The zlib compression utility is a general purpose utility that is -useful for more than MNG/PNG files, and can be used without libmng. -See the documentation delivered with zlib for more details. - -Libmng optionally uses the JPEG library by the Independant JPEG Group -(IJG). This library is used for the JNG sub-format, which is part of -the MNG specification, and allows for inclusion of JPEG decoded and -thus highly compressed (photographic) images. -Further information about the IJG JPEG library and the latest sources -can be found at . - -Libmng can also optionally use the lcms (little CMS) library by -Marti Maria Saguer. This library provides an excellent color-management -system (CMS), which gives libmng the ability to provide full -color-correction for images with the proper color-information encoded. -Further information and the latest sources can be found at -. - -Libmng is thread safe, provided the threads are using different -handles as returned by the initialization call. -Each thread should have its own handle and thus its own image. -Libmng does not protect itself against two threads using the -same instance of a handle. - -The libmng.h header file is the single reference needed for programming -with libmng: - -#include - - -II. Callbacks - -Libmng makes extensive use of callback functions. This is meant to -keep the library as platform-independant and flexible as possible. -Actually, the first call you will make to the library, already contains -three parameters you can use to provide callback entry-points. - -Most functions must return a mng_bool (boolean). Returning MNG_FALSE -indicates the library the callback failed in some way and the library -will immediately return from whatever it was doing back to the -application. Returning MNG_TRUE indicates there were no problems and -processing can continue. - -Let's step through each of the possible callbacks. The sections on -reading, displaying and writing will also explain which callbacks are -needed when and where. - -- mng_ptr mng_memalloc (mng_size_t iLen) - -A very basic function which the library uses to allocate a memory-block -with the given size. A typical implementation would be: - - mng_ptr my_alloc (mng_size_t iLen) { - return calloc (1, iSize); - } - -Note that the library requires you to zero-out the memory-block!!! - -- void mng_memfree (mng_ptr pPtr, - mng_size_t iLen) - -Counterpart of the previous function. Typically: - - void my_free (mng_ptr pPtr, mng_size_t iLen) { - free (pPtr); - } - -- mng_bool mng_openstream (mng_handle hHandle) -- mng_bool mng_closestream (mng_handle hHandle) - -These are called by the library just before it starts to process -(either read or write) a file and just after the processing stops. -This is the recommended place to do I/O initialization & finalization. -Whether you do or not, is up to you. The library does not put any -meaning into the calls. They are simply provided for your convenience. - -- mng_bool mng_readdata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) - -This function is called when the library needs some more input while -reading an image. The reading process supports two modes: -Suspension-mode (SMOD) and non-suspension-mode (NSMOD). -See mng_set_suspensionmode() for a more detailed description. - -In NSMOD, the library requires you to return exactly the amount of bytes -requested (= iBuflen). Any lesser amount indicates the input file -is exhausted and the library will return a MNG_UNEXPECTEDEOF errorcode. - -In SMOD, you may return a smaller amount of bytes than requested. -This tells the library it should temporarily wait for more input to -arrive. The lib will return with MNG_NEEDMOREDATA, and will expect a -call to mng_read_resume() or mng_display_resume() next, as soon as -more input-data has arrived. - -For NSMOD this function could be as simple as: - - mng_bool my_read (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) { - *pRead = fread (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -- mng_bool mng_writedata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) - -This function is called during the mng_write() function to actually -output data to the file. There is no suspension-mode during write, -so the application must return the exact number of bytes the library -requests to be written. - -A typical implementation could be: - - mng_bool my_write (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) { - *pWritten = fwrite (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -- mng_bool mng_errorproc (mng_handle hHandle, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext) - -This function is called whenever an error is detected inside the -library. This may be caused by invalid input, callbacks indicating -failure, or wrongfully calling functions out of place. - -If you do not provide this callback the library will still return -an errorcode from the called function, and the mng_getlasterror() -function can be used to retrieve the other parameters. - -This function is currently only provided for convenience, but may -at some point be used to indicate certain errors may be acceptable, -and processing should continue. - -- mng_bool mng_traceproc (mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname) - -This function is provided to allow a functional analysis of the -library. This may be useful if you encounter certain errors and -cannot determine what the problem is. - -Almost all functions inside the library will activate this -callback with an appropriate function-name at the start and end -of the function. Please note that large images may generate an -enormous amount of calls. - -- mng_bool mng_processheader (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This function is called once the header information of an input- -image has been processed. At this point the image dimensions are -available and also some other properties depending on the type -of the image. Eg. for a MNG the frame-/layercount, playtime & -simplicity fields are known. - -The primary purpose of this callback is to inform the application -of the size of the image, and for the application to initialize -the drawing canvas to be used by the library. This is also a good -point to set the canvas-style. Eg. mng_set_canvasstyle(). - -- mng_bool mng_processtext (mng_handle hHandle, - mng_uint8 iType, - mng_pchar zKeyword, - mng_pchar zText, - mng_pchar zLanguage, - mng_pchar zTranslation) - -This callback is activated for each textual chunk in the input- -image. These are tEXt, zTXt & iTXt. It may be used to retain -specific comments for presentation to the user. - -- mng_bool mng_processsave (mng_handle hHandle) -- mng_bool mng_processseek (mng_handle hHandle, - mng_pchar zName) - -The purpose of these callbacks is to signal the processing of the -SAVE & SEEK chunks in a MNG input-file. This may be used in the -future to specify some special processing. At the moment these -functions are only provided as a signal. - -- mng_ptr mng_getcanvasline (mng_handle hHandle, - mng_uint32 iLinenr) -- mng_ptr mng_getbkgdline (mng_handle hHandle, - mng_uint32 iLinenr) -- mng_ptr mng_getalphaline (mng_handle hHandle, - mng_uint32 iLinenr) - -These callbacks are used to access the drawing canvas, background -canvas and an optional separate alpha-channel canvas. The latter is -used only with the MNG_CANVAS_RGB8_A8 canvas-style. - -If the getbkgdline() callback is not supplied the library will -composite full or partially transparent pixels in the image against -a specified background color. See mng_set_bgcolor() for more details. -If a chosen canvas-style includes an alpha-channel, this callback -is very likely not needed. - -The application is responsible for returning a pointer to a line of -pixels, which should be in the exact format as defined by the call -to mng_set_canvasstyle() and mng_set_bkgdstyle(), without gaps between -the representation of each pixel. - -- mng_bool mng_refresh (mng_handle hHandle, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This callback is called when the library has drawn a complete frame -onto the drawing canvas, and it is ready to be displayed. -The application is responsible for transferring the drawing canvas -from memory onto the actual output device. - -- mng_uint32 mng_gettickcount (mng_handle hHandle) - -This function should return the number of milliseconds on some internal -clock. The entire animation timing depends heavily on this function, -1and the number returned should be as accurate as possible. - -- mng_bool mng_settimer (mng_handle hHandle, - mng_uint32 iMsecs) - -This callback is activated every time the library requires a "pause". -Note that the function itself should NOT execute the wait. It should -simply store the time-field and allow the library to return. Libmng -will return with the MNG_NEEDTIMERWAIT code, indicating the callback -was called and it is now time to execute the pause. - -After the indicated number of milliseconds have elapsed, the application -should call mng_display_resume(), to resume the animation as planned. - -This method allows for both a real timer or a simple wait command in the -application. Whichever method you select, both the gettickcount() and -settimer() callbacks are crucial for proper animation timing. - -- mng_bool mng_processgamma (mng_handle hHandle, - mng_uint32 iGamma) -- mng_bool mng_processchroma (mng_handle hHandle, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) -- mng_bool mng_processsrgb (mng_handle hHandle, - mng_uint8 iRenderingintent) -- mng_bool mng_processiccp (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) -- mng_bool mng_processarow (mng_handle hHandle, - mng_uint32 iRowsamples, - mng_bool bIsRGBA16, - mng_ptr pRow) - -These callbacks are only required when you selected the MNG_APP_CMS -directive during compilation of the library. See the configuration -section for more details. - -- mng_bool mng_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) - -This callback is only used for the mng_iterate_chunks() function. -It is called exactly once for each chunk stored. - - -III. Housekeeping - - -> Memory management - -The library can use internal memory allocation/deallocation or use -provided callbacks for its memory management. The choice is made at -compilation time. See the section on customization for details. - -If internal management has been selected, the memory callback functions -need not be supplied. Even if you do supply them they will not be used. -The actual code used is similar to the code discussed in the callback -section: - - pPtr = calloc (1, iSize); - - free (pPtr); - -If your compiler does not support these functions, or you wish to monitor -the library's use of memory for certain reasons, you can choose to -compile the library with external memory management. In this case the -memory callback functions MUST be supplied, and should function as if the -above code was used. - - -> Initialization - -The basic initialization of the library is short and swift: - - myhandle = mng_initialize (myuserdata, my_alloc, - my_free, MNG_NULL); - if (myhandle == MNG_NULL) - /* process error */; - -The first field is an application-only parameter. It is saved in -libmng's internal structures and available at all times through the -mng_get_userdata() function. This is especially handy in callback functions -if your program may be handling multiple files at the same time. - -The second and third field supply the library with the memory callback -1function entry-points. These are described in more detail in the callback -section and the previous paragraph. - -The fourth and last field may be used to supply the library with the -entry-point of a trace callback function. For regular use you will not -need this! - -The function returns a handle which will be your ticket to MNG-heaven. -All other functions rely on this handle. It is the single fixed unique -reference-point between your application and the library. - -You should call the initialization function for each image you wish to -process simultaneously. If you are processing images consecutively, you can -reset the internal status of the library with the mng_reset() function. -This function will clear all internal state variables, free any stored -chunks and/or objects, etc, etc. Your callbacks and other external parameters -will be retained. - -After you successfully received the handle it is time to set the required -callbacks. The sections on reading, displaying & writing indicate which -callbacks are required and which are optional. -To set the callbacks simply do: - - myretcode = mng_setcb_xxxxxx (myhandle, my_xxxxxx); - if (myretcode != MNG_NOERROR) - /* process error */; - -Naturally you'd replace the x's with the name of the callback. - - -> Cleanup - -Once you've gotten hold of that precious mng_handle, you should always, -and I mean always, call the cleanup function when you're done. -Just do: - - mng_cleanup (myhandle); - -And you're done. There shouldn't be an ounce of memory spilled after -that call. - -Note that if you would like to process multiple files consecutively -you do not need to do mng_cleanup() / mng_initialize() between each file -but simply - - myretcode = mng_reset (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -will suffice. Saves some time and effort, that. - - -> Error handling - -From the examples in the previous paragraphs you may have noticed a -meticulous scheme for error handling. And yes, that's exactly what it is. -Practically each call simply returns an errorcode, indicating success, -eg. MNG_NOERROR or failure, anything else but MNG_NEEDMOREDATA and -MNG_NEEDTIMERWAIT. These latter two will be discussed in more detail in -their respective fields of interest: the reading section and displaying -section respectively. - -It is the application's responsibility to check the returncode after -each call. You can call mng_getlasterror() to receive the details of -the last detected error. This even includes a discriptive error-message -if you enabled that option during compilation of the library. - -Note that after receiving an error it is still possible to call the -library, but it's also very likely that any following call will fail. -The only functions deemed to work will be mng_reset() and mng_cleanup(). -Yes, if you abort your program after an error, you should still call -mng_cleanup(). - - -IV. Reading - -Reading a MNG, JNG or PNG is fairly easy. It depends slightly on your -ultimate goal how certain specifics are to be handled, but the basics -are similar in all cases. - -For the read functioins to work you must have compiled the library with -the MNG_READ_SUPPRT directive. The standard DLL and Shared Library -have this on by default! - - -> Setup - -Naturally you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_readdata, mng_closestream - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -The reading bit will also fail if you are already creating or -displaying a file. Seems a bit obvious, but I thought I'd mention it, -just in case. - - -> To suspend or not to suspend - -There is one choice you need to make before calling the read function. -Are you in need of suspension-mode or not? - -If you're reading from a disk you most certainly do not need -suspension-mode. Even the oldest and slowest of disks will be fast -enough for straight reading. - -However, if your input comes from a really slow device, such as a -dialup-line or the likes, you may opt for suspension-mode. This is done -by calling - - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - -Suspension-mode will force the library to use special buffering on the -input. This allows your application to receive data of arbitrarily length -and return this in the mng_readdata() callback, without disturbing the -chunk processing routines of the library. - -Suspension-mode does require a little extra care in the main logic of the -1application. The read function may return with MNG_NEEDMOREDATA when the -mng_readdata() callback returns less data then it needs to process the -next chunk. This indicates the application to wait for more data to arrive -and then resume processing by calling mng_read_resume(). - - -> The read HLAPI - -The actual reading is just plain simple. Since all I/O is done -1outside the library through the callbacks, the library can focus on -its real task. Understanding, checking and labelling the input data! - -All you really need to do is this: - - myretcode = mng_read (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -Of course, if you're on suspension-mode the code is a little more -complicated: - - myretcode = mng_read (myhandle); - - while (myretcode == MNG_NEEDMOREDATA) { - /* wait for input-data to arrive */ - myretcode = mng_read_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -This is rather crude and more sophisticated programming methods may -dictate another approach. Whatever method you decide on, it should -act as if the above code was in its place. - -There is also the mng_readdisplay() function, but this is discussed -in the displaying section. It functions pretty much as the mng_read() -function, but also immediately starts displaying the image. -mng_read_resume() should be replaced by mng_display_resume() in that -case! - - -> What happens inside - -What actually happens inside the library depends on the configuration -options set during the compilation of the library. - -Basically the library will first read the 8-byte file header, to determine -its validity and the type of image it is about to process. Then it will -repeatedly read a 4-byte chunk-length and then the remainder of the chunk -until it either reaches EOF (indicated by the mng_readdata() callback) or -implicitly decides EOF as it processed the logically last chunk of the -image. - -Applications that require strict conformity and do not allow superfluous -data after the ending chunk, will need to perform this check in their -mng_closestream() callback. - -Each chunk is then checked on CRC, after which it is handed over to the -appropriate chunk processing routine. These routines will disect the -chunk, check the validity of its contents, check its position with respect -to other chunks, etc, etc. - -If everything checks out, the chunk is further processed as follows: - -If display support has been selected during compilation, certain pre-display -initialization will take place. - -If chunk-storage support has been selected during compilation, the chunks -data may be stored in a special internal structure and held for future -reference. - - -> Storing and accessing chunks - -One of the compilation options activates support for chunk storage. -This option may be useful if you want to examine an image. The directive -is MNG_STORE_CHUNKS. You must also turn on the MNG_ACCESS_CHUNKS -directive. - -The actual storage facility can be turned on or off with the -mng_set_storechunks() function. If set to MNG_TRUE, chunks will be -stored as they are read. - -At any point you can then call the mng_iterate_chunks() function -to iterate through the current list of chunks. This function requires -a callback which is called for each chunk and receives a specific -chunk-handle. This chunk-handle can be used to call the appropriate -mng_getchunk_xxxx() function, to access the chunks properties. - -A typical implementation may look like this: - - mng_bool my_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) { - switch (iChunkid) { - case MNG_UINT_MHDR : { /* process MHDR */; - break; } - case MNG_UINT_FRAM : { /* process FRAM */; - break; } - - ...etc... - - case MNG_UINT_HUH : { /* unknown chunk */; - break; } - default : { /* duh; forgot one */; } - } - - return MNG_TRUE; /* keep'm coming */ - } - -To get to the actual chunk fields of lets say a SHOW chunk you would do: - - mng_bool isempty; - mng_uint16 firstid, lastid; - mng_uint8 showmode; - - myretcode mng_getchunk_show (hHandle, hChunk, - isempty, firstid, - lastid, showmode); - if (myretcode != MNG_NOERROR) - /* process error */; - - -V. Displaying - - -> Setup - -Assuming you have initialized the library and are the owner of -a mng_handle. The following callbacks are essential: - - mng_getcanvasline, mng_refresh - mng_gettickcount, mng_settimer - -If you wish to use an application supplied background you must supply: - - mng_getbkgdline - -If you wish to use the MNG_CANVAS_RGB8_A8 canvas style you must supply: - - mng_getalphaline - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -Note that the mng_processheader() callback is optional but will -be quite significant for proper operation! - -Displaying an image will fail if you are creating a file or already -displaying one. Yes, you can't display it twice! - - -> A word on canvas styles - -The canvas style describes how your drawing canvas is made up. -You must set this before the library actually starts drawing, so -the mng_processheader() callback is a pretty good place for it. - -Currently only 8-bit RGB canvas styles are supported, either with -or without an alpha channel. - -If you like to do alpha composition yourself you can select one of -the canvas styles that include an alpha channel. You can even have -a separate alpha canvas by selecting the MNG_CANVAS_RGB8_A8 style. - -All styles require a compact model. Eg. MNG_CANVAS_BGR8 requires -your canvas lines in bgrbgrbgr... storage, where each letter -represents an 8-bit value of the corresponding color, and each -threesome makes up the values of one(1) pixel. - -The library processes a line at a time, so the canvas lines do not -actually need to be consecutive in memory. - - -> Alpha composition and application backgrounds - -All Network Graphics can be partially transparent. This requires -special processing if you need to display an image against some -background. Note that the MNG header (MHDR chunk) contains a -simplicity field indicating whether transparency information in -the file is critical or not. This only applies to embedded images, -which means the full image-frame of the MNG may still contain fully -transparent pixels! - -Depending on your needs you can supply a single background color, -a background canvas or tell the library to return the alpha-channel -and do alpha composition yourself. - -This is different from the BACK chunk in a MNG, or the bKGD chunk -in an (embedded) PNG or JNG. The BACK chunk indicates an optional or -mandatory background color and/or image. The bKGD chunk only indicates -an optional background color. These chunks indicate the Authors -preferences. They may be absent in which case you need to supply -some sort of background yourself. - -> Composing against a background color - -This is the easiest method. Call the mng_set_bgcolor() function to -set the values of the red, green and blue component of your preferred -background color. - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. - -> Composing against a background canvas - -This is somewhat more complicated. You will need to set the -mng_getbkgdline() callback. This will be called whenever the library -needs to compose a partially transparent line. - -This canvas must hold the background against which the image should -be composed. Its size must match exactly with the image dimensions -and thus the drawing canvas! - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. The canvas style of the -background canvas may even differ from the drawing canvas. The library's -composing will still function properly. - -> Composing within the application - -If you have the option in your application to draw a (partially) -transparent canvas to the output device, this option is preferred. - -Select one of the canvas styles that do have an alpha-channel. -The library will now supply the appropriate alpha information, -allowing the application to compose the image as it sees fit. - - -> Color information and CMS - -Network Graphics may, and usually will, contain color-correction -information. This information is intended to compensate for the -difference in recording and display devices used. - -This document does not address the specifics of color-management. -See the PNG specification for a more detailed description. - -> Using little cms by Marti Maria Saguer - -This is the easiest method, providing you can compile the lcms package. -Select the MNG_FULL_CMS directive during compilation, and sit back and -relax. The library will take care of all color-correction for you. - -> Using an OS- or application-supplied CMS - -If you are so lucky to have access to CMS functionality from within -your application, you may instruct the library to leave color-correction -to you. - -Select the MNG_APP_CMS directive during compilation of the library. -You MUST also set the following callbacks: - - mng_processgamma, mng_processchroma, - mng_processsrgb, mng_processiccp and - mng_processarow - -The last callback is called when the library needs you to correct -an arbitrary line of pixels. The other callbacks are called when -the corresponding color-information is encountered in the file. -You must store this information somewhere for use in the -mng_processarow() callback. - -> Using gamma-only correction - -This isn't a preferred method, but it's better than no correction -at all. Gamma-only correction will at least compensate for -gamma-differences between the original recorder and your output device. - -Select the MNG_GAMMA_ONLY directive during compilation -of the library. Your compiler MUST support fp operations. - -> No color correction - -Ouch. This is really bad. This is the least preferred method, -but may be necessary if your system cannot use lcms, doesn't -have its own CMS, and does not allow fp operations, ruling out -the gamma-only option. - -Select the MNG_NO_CMS directive during compilation. -Images will definitely not be displayed as seen by the Author!!! - - -> Animations and timing - -Animations require some form of timing support. The library relies -on two callbacks for this purpose. The mng_gettickcount() and -mng_settimer() callbacks. mng_gettickcount() is used to determine -the passing of time in milliseconds since the beginning of the -animation. This is also used to compensate during suspension-mode -if you are using the mng_readdisplay() function to read & display -the file simultaneously. - -The callback may return an arbitrary number of milliseconds, but -this number must increase proportionaly between calls. Most modern -systems will have some tickcount() function which derives its -input from an internal clock. The value returned from this function -is more than adequate for libmng. - -The mng_settimer() callback is called when the library determines -a little "pause" is required before rendering another frame of the -animation. The pause interval is also expressed in milliseconds. -Your application should store this value and return immediately. -The library will then make appropriate arrangements to store its -internal state and returns to your application with the -MNG_NEEDTIMERWAIT code. - -At that point you should suspend processing and wait the given -interval. Please use your OS features for this. Do not engage some -sort of loop. That is real bad programming practice. Most modern -systems will have some timing functions. A simple wait() function -may suffice, but this may prevent your applications main-task from -running, and possibly prevent the actual update of your output device. - - -> The mng_refresh() callback - -The mng_refresh() callback is called whenever the library has -"finished" drawing a new frame onto your canvas, and just before it -will call the mng_settimer() callback. - -This allows you to perform some actions necessary to "refresh" the -canvas onto your output device. Please do NOT suspend processing -inside this callback. This must be handled after the mng_settimer() -callback! - - -> Displaying while reading - -This method is preferred if you are reading from a slow input device -(such as a dialup-line) and you wish to start displaying something -as quickly as possible. This functionality is provided mainly for -browser-type applications but may be appropriate for other -applications as well. - -The method is usually used in unison with the suspension-mode of -the read module. A typical implementation would look like this: - - /* initiale library and set required callbacks */ - - /* activate suspension-mode */ - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - - myretcode = mng_readdisplay (myhandle); - - while ((myretcode == MNG_NEEDMOREDATA) || - (myretcode == MNG_NEEDTIMERWAIT)) { - if (myretcode == MNG_NEEDMOREDATA) - /* wait for more input-data */; - else - /* wait for timer interval */; - - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -More advanced programming methods may require a different approach, -but the final result should function as in the code above. - - -> Displaying after reading - -This method is used to display a file that was previously read. -It is primarily meant for viewers with direct file access, such as -1a local harddisk. - -Once you have successfully read the file, all you need to do is: - - myretcode = mng_display (myhandle); - - while (myretcode == MNG_NEEDTIMERWAIT) { - /* wait for timer interval */; - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -Again, more advanced programming methods may require a different -approach, but the final result should function as in the code above. - - -> Display manipulation - -Several HLAPI functions are provided to allow a user to manipulate -the normal flow of an animation. - -- mng_display_freeze (mng_handle hHandle) - -This will "freeze" the animation in place. - -- mng_display_resume (mng_handle hHandle) - -This function can be used to resume a frozen animation, or to force -the library to advance the animation to the next frame. - -- mng_display_reset (mng_handle hHandle) - -This function will "reset" the animation into its pristine state. -Calling mng_display() afterwards will re-display the animation -from the first frame. - -- mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayer) -- mng_display_goframe (mng_handle hHandle, - mng_uint32 iFrame) -- mng_display_goplaytime (mng_handle hHandle, - mng_uint32 iPlaytime) - -These three functions can be used to "jump" to a specific layer, frame -or timeslot in the animation. You must "freeze" the animation before -using any of these functions. - -All above functions may only be called during a timer interval! -It is the applications responsibility to cleanup any resources with -respect to the timer wait. - - -VI. Writing - -The main focus of the library lies in its displaying capabilites. -But it does offer writing support as well. -You can create and write a file, or you can write a file you -have previously read, providing the storage of chunks was enabled -and active. - -For this to work you must have compiled the library with the -MNG_WRITE_SUPPO1RT and MNG_ACCESS_CHUNKS directives. The standard DLL and -Shared Library have this on by default! - - -> Setup - -As always you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_writedata, mng_closestream - -You can optionally define: - - mng_errorproc, mng_traceproc - -The creation and writing functions will fail if you are in the middle -of reading, creating or writing a file. - - -> Creating a new file - -To start a new file the library must be in its initial state. -First you need to tell the library your intentions: - - myretcode = mng_create (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -After that you start adding the appropriate chunks: - - myretcode = mng_putchunk_mhdr (myhandle, ...); - if (myretcode != MNG_NOERROR) - /* process error */; - -And so on, and so forth. Note that the library will automatically signal -the logical end of the file by the ending chunk. Also the first chunk -will indicate the library the filetype (eg. PNG, JNG or MNG) and force -the proper signature when writing the file. - -The code above can be simplified, as you can always get the last errorcode -by using the mng_getlasterror() function: - - if ( (mng_putchunk_xxxx (myhandle, ...)) or - (mng_putchunk_xxxx (myhandle, ...)) or - ...etc... ) - /* process error */; - -Please note that you must have a pretty good understanding of the chunk -specification. Unlike the read functions, there are virtually no checks, -so it is quite possible to write completely wrong files. -It is a good practice to read back your file into the library to verify -its integrity. - -Once you've got all the chunks added, all you do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -And presto. You're done. The real work is of course carried out in -your callbacks. Note that this is a single operation as opposed to -the read & display functions that may return with MNG_NEEDMOREDATA -and/or MNG_NEEDTIMERWAIT. The write function just does the job, and -only returns after it's finished or if it encounters some -unrecoverable error. - - -> Writing a previously read file - -If you have already successfully read a file, you can use the library to -write it out as a copy or something. You MUST have compiled the library -with the MNG_STORE_CHUNKS directive, and you must have done -mng_set_storechunks (myhandle, MNG_TRUE). - -This doesn't require the MNG_ACCESS_CHUNKS directive, unless you want -to fiddle with the chunks as well. - -Again all you need to do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - - -VII. Modifying/Customizing libmng: - -to do - -> Compilation directives - -to do - -> Platform dependant modification - -to do - - -References : - -libmng : - http://www.libmng.com/ - -zlib : - http://www.info-zip.org/pub/infozip/zlib/ - -IJG JPEG library : - http://www.ijg.org/ - -lcms (little CMS) by Marti Maria Saguer : - http://www.littlecms.com/ - -MNG specification: - http://www.libpng.org/pub/mng - - -In the case of any inconsistency between the MNG specification -and this library, the specification takes precedence. - - -The contributing authors would like to thank all those who helped -with testing, bug fixes, and patience. This wouldn't have been -possible without all of you!!! - - -COPYRIGHT NOTICE: - -Copyright (c) 2000,2001 Gerard Juyn - -For the purposes of this copyright and license, "Contributing Authors" -is defined as the following set of individuals: - - Gerard Juyn - -The MNG Library is supplied "AS IS". The Contributing Authors -disclaim all warranties, expressed or implied, including, without -limitation, the warranties of merchantability and of fitness for any -purpose. The Contributing Authors assume no liability for direct, -indirect, incidental, special, exemplary, or consequential damages, -which may result from the use of the MNG Library, even if advised of -the possibility of such damage. - -Permission is hereby granted to use, copy, modify, and distribute this -source code, or portions hereof, for any purpose, without fee, subject -to the following restrictions: - -1. The origin of this source code must not be misrepresented; -you must not claim that you wrote the original software. - -2. Altered versions must be plainly marked as such and must not be -misrepresented as being the original source. - -3. This Copyright notice may not be removed or altered from any source -or altered source distribution. - -The Contributing Authors specifically permit, without fee, and -encourage the use of this source code as a component to supporting -the MNG and JNG file format in commercial products. If you use this -source code in a product, acknowledgment would be highly appreciated. - - -Remarks : - -Parts of this software have been adapted from the libpng library. -Although this library supports all features from the PNG specification -(as MNG descends from it) it does not require the libpng library. -It does require the zlib library and optionally the IJG JPEG library, -and/or the "little-cms" library by Marti Maria Saguer (depending on the -inclusion of support for JNG and Full-Color-Management respectively. - -This library's function is primarily to read and display MNG -animations. It is not meant as a full-featured image-editing -component! It does however offer creation and editing functionality -at the chunk level. (future modifications may include some more -support for creation and or editing) - diff --git a/Engine/lib/lmng/doc/man/jng.5 b/Engine/lib/lmng/doc/man/jng.5 deleted file mode 100644 index 0e371ad0e..000000000 --- a/Engine/lib/lmng/doc/man/jng.5 +++ /dev/null @@ -1,37 +0,0 @@ -.TH JNG 5 "July 26, 2000" -.SH NAME -jng \- JPEG Network Graphics (JNG) sub-format -.SH DESCRIPTION -JNG (JPEG Network Graphics) is a sub-format of the MNG (Multiple-image -Network Graphics) format. As with MNG it extends on the features of the -popular PNG (Portable Network Graphics) image-format. -.br - -This sub-format was designed to support a lossy compression-method. -It is based completely on the JPEG specification. It adds the high-compression -ratios of JPEG for photographic images. - -As a member of the Network Graphics family, JNG was deemed adequate as a -stand-alone format as it extends the JPEG format with color-correction and -transparency features. - -.SH "SEE ALSO" -.IR png(5) ", " mng(5) ", " libmng(3) -.LP -MNG 1.00, February 9, 2001: -.IP -http://www.libpng.org/pub/mng - -.SH AUTHORS -This man page: Gerard Juyn -.LP -Multiple-image Network Graphics (MNG) Specification Version 1.00 (Februari 9, 2001): -Glenn Randers-Pehrson and others (png-list@ccrc.wustl.edu). -.LP - -.SH COPYRIGHT NOTICE -The MNG-1.00 specification is copyright (c) 1998-2001 Glenn Randers-Pehrson. -See the specification for conditions of use and distribution. -.LP -.\" end of man page - diff --git a/Engine/lib/lmng/doc/man/libmng.3 b/Engine/lib/lmng/doc/man/libmng.3 deleted file mode 100644 index 5321faaa1..000000000 --- a/Engine/lib/lmng/doc/man/libmng.3 +++ /dev/null @@ -1,1146 +0,0 @@ -.TH LIBMNG 3 "January 30th, 2005" -.SH NAME -libmng \- Multiple-image Network Graphics (MNG) Reference Library 1.0.9 -.SH SYNOPSIS -\fI\fB - -\fB#include \fP - - -.SH DESCRIPTION -The -.I libmng -library supports decoding, displaying, encoding, and various other -manipulations of the Multiple-image Network Graphics (MNG) format -image files. It uses the -.IR zlib(3) -compression library, and optionally the JPEG library by the Independant -JPEG Group (IJG) and/or lcms (little cms), a color-management library -by Marti Maria Saguer. - - -.SH I. Introduction - -This file describes how to use and modify the MNG reference library -(known as libmng) for your own use. There are seven sections to this -file: introduction, callbacks, housekeeping, reading, displaying, -writing, and modification and configuration notes for various special -platforms. We assume that libmng is already installed; see the -INSTALL.README file for instructions on how to install libmng. - -Libmng was written to support and promote the MNG specification. - -The MNG-1.0 specification is available at -. - -Other information about MNG can be found at the MNG home page, -. -The latest version of libmng can be found at its own homepage at -. - -In most cases the library will not need to be changed. -For standardization purposes the library contains both a Windows DLL -and a makefile for building a shared library (SO). The library is -written in C, but an interface for Borland Delphi is also available. - -Libmng has been designed to handle multiple sessions at one time, -to be easily modifiable, to be portable to the vast majority of -machines (ANSI, K&R, 32-, and 64-bit) available, and to be easy -to use. - -Libmng uses zlib for its compression and decompression of MNG files. -Further information about zlib, and the latest version of zlib, can be -found at the zlib home page, . -The zlib compression utility is a general purpose utility that is -useful for more than MNG/PNG files, and can be used without libmng. -See the documentation delivered with zlib for more details. - -Libmng optionally uses the JPEG library by the Independant JPEG Group -(IJG). This library is used for the JNG sub-format, which is part of -the MNG specification, and allows for inclusion of JPEG decoded and -thus highly compressed (photographic) images. -Further information about the IJG JPEG library and the latest sources -can be found at . - -Libmng can also optionally use the lcms (little CMS) library by -Marti Maria Saguer. This library provides an excellent color-management -system (CMS), which gives libmng the ability to provide full -color-correction for images with the proper color-information encoded. -Further information and the latest sources can be found at -. - -Libmng is thread safe, provided the threads are using different -handles as returned by the initialization call. -Each thread should have its own handle and thus its own image. -Libmng does not protect itself against two threads using the -same instance of a handle. - -The libmng.h header file is the single reference needed for programming -with libmng: - -#include - - -.SH II. Callbacks - -Libmng makes extensive use of callback functions. This is meant to -keep the library as platform-independant and flexible as possible. -Actually, the first call you will make to the library, already contains -three parameters you can use to provide callback entry-points. - -Most functions must return a mng_bool (boolean). Returning MNG_FALSE -indicates the library the callback failed in some way and the library -will immediately return from whatever it was doing back to the -application. Returning MNG_TRUE indicates there were no problems and -processing can continue. - -Let's step through each of the possible callbacks. The sections on -reading, displaying and writing will also explain which callbacks are -needed when and where. - -\- mng_ptr mng_memalloc (mng_size_t iLen) - -A very basic function which the library uses to allocate a memory-block -with the given size. A typical implementation would be: - - mng_ptr my_alloc (mng_size_t iLen) { - return calloc (1, iLen); - } - -Note that the library requires you to zero-out the memory-block!!! - -\- void mng_memfree (mng_ptr pPtr, - mng_size_t iLen) - -Counterpart of the previous function. Typically: - - void my_free (mng_ptr pPtr, mng_size_t iLen) { - free (pPtr); - } - -\- mng_bool mng_openstream (mng_handle hHandle) - -\- mng_bool mng_closestream (mng_handle hHandle) - -These are called by the library just before it starts to process -(either read or write) a file and just after the processing stops. -This is the recommended place to do I/O initialization & finalization. -Whether you do or not, is up to you. The library does not put any -meaning into the calls. They are simply provided for your convenience. - -\- mng_bool mng_readdata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) - -This function is called when the library needs some more input while -reading an image. The reading process supports two modes: -Suspension-mode (SMOD) and non-suspension-mode (NSMOD). -See mng_set_suspensionmode() for a more detailed description. - -In NSMOD, the library requires you to return exactly the amount of bytes -requested (= iBuflen). Any lesser amount indicates the input file -is exhausted and the library will return a MNG_UNEXPECTEDEOF errorcode. - -In SMOD, you may return a smaller amount of bytes than requested. -This tells the library it should temporarily wait for more input to -arrive. The lib will return with MNG_NEEDMOREDATA, and will expect a -call to mng_read_resume() or mng_display_resume() next, as soon as -more input-data has arrived. - -For NSMOD this function could be as simple as: - - mng_bool my_read (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead) { - *pRead = fread (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -\- mng_bool mng_writedata (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) - -This function is called during the mng_write() function to actually -output data to the file. There is no suspension-mode during write, -so the application must return the exact number of bytes the library -requests to be written. - -A typical implementation could be: - - mng_bool my_write (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten) { - *pWritten = fwrite (pBuf, 1, iBuflen, myfile); - return MNG_TRUE; - } - -\- mng_bool mng_errorproc (mng_handle hHandle, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext) - -This function is called whenever an error is detected inside the -library. This may be caused by invalid input, callbacks indicating -failure, or wrongfully calling functions out of place. - -If you do not provide this callback the library will still return -an errorcode from the called function, and the mng_getlasterror() -function can be used to retrieve the other parameters. - -This function is currently only provided for convenience, but may -at some point be used to indicate certain errors may be acceptable, -and processing should continue. - -\- mng_bool mng_traceproc (mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname) - -This function is provided to allow a functional analysis of the -library. This may be useful if you encounter certain errors and -cannot determine what the problem is. - -Almost all functions inside the library will activate this -callback with an appropriate function-name at the start and end -of the function. Please note that large images may generate an -enormous amount of calls. - -\- mng_bool mng_processheader (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This function is called once the header information of an input- -image has been processed. At this point the image dimensions are -available and also some other properties depending on the type -of the image. Eg. for a MNG the frame-/layercount, playtime & -simplicity fields are known. - -The primary purpose of this callback is to inform the application -of the size of the image, and for the application to initialize -the drawing canvas to be used by the library. This is also a good -point to set the canvas-style. Eg. mng_set_canvasstyle(). - -\- mng_bool mng_processtext (mng_handle hHandle, - mng_uint8 iType, - mng_pchar zKeyword, - mng_pchar zText, - mng_pchar zLanguage, - mng_pchar zTranslation) - -This callback is activated for each textual chunk in the input- -image. These are tEXt, zTXt & iTXt. It may be used to retain -specific comments for presentation to the user. - -\- mng_bool mng_processsave (mng_handle hHandle) - -\- mng_bool mng_processseek (mng_handle hHandle, - mng_pchar zName) - -The purpose of these callbacks is to signal the processing of the -SAVE & SEEK chunks in a MNG input-file. This may be used in the -future to specify some special processing. At the moment these -functions are only provided as a signal. - -\- mng_ptr mng_getcanvasline (mng_handle hHandle, - mng_uint32 iLinenr) - -\- mng_ptr mng_getbkgdline (mng_handle hHandle, - mng_uint32 iLinenr) - -\- mng_ptr mng_getalphaline (mng_handle hHandle, - mng_uint32 iLinenr) - -These callbacks are used to access the drawing canvas, background -canvas and an optional separate alpha-channel canvas. The latter is -used only with the MNG_CANVAS_RGB8_A8 canvas-style. - -If the getbkgdline() callback is not supplied the library will -composite fully or partially transparent pixels in the image against -a specified background color. See mng_set_bgcolor() for more details. -If a chosen canvas-style includes an alpha-channel, this callback -is very likely not needed. - -The application is responsible for returning a pointer to a line of -pixels, which should be in the exact format as defined by the call -to mng_set_canvasstyle() and mng_set_bkgdstyle(), without gaps between -the representation of each pixel, unless specified by the canvas-style. - -\- mng_bool mng_refresh (mng_handle hHandle, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight) - -This callback is called when the library has drawn a complete frame -onto the drawing canvas, and it is ready to be displayed. -The application is responsible for transferring the drawing canvas -from memory onto the actual output device. - -\- mng_uint32 mng_gettickcount (mng_handle hHandle) - -This function should return the number of milliseconds on some internal -clock. The entire animation timing depends heavily on this function, -and the number returned should be as accurate as possible. - -\- mng_bool mng_settimer (mng_handle hHandle, - mng_uint32 iMsecs) - -This callback is activated every time the library requires a "pause". -Note that the function itself should NOT execute the wait. It should -simply store the time-field and allow the library to return. Libmng -will return with the MNG_NEEDTIMERWAIT code, indicating the callback -was called and it is now time to execute the pause. - -After the indicated number of milliseconds have elapsed, the application -should call mng_display_resume(), to resume the animation as planned. - -This method allows for both a real timer or a simple wait command in the -application. Whichever method you select, both the gettickcount() and -settimer() callbacks are crucial for proper animation timing. - -\- mng_bool mng_processgamma (mng_handle hHandle, - mng_uint32 iGamma) - -\- mng_bool mng_processchroma (mng_handle hHandle, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) - -\- mng_bool mng_processsrgb (mng_handle hHandle, - mng_uint8 iRenderingintent) - -\- mng_bool mng_processiccp (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) - -\- mng_bool mng_processarow (mng_handle hHandle, - mng_uint32 iRowsamples, - mng_bool bIsRGBA16, - mng_ptr pRow) - -These callbacks are only required when you selected the MNG_APP_CMS -directive during compilation of the library. See the configuration -section for more details. - -\- mng_bool mng_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) - -This callback is only used for the mng_iterate_chunks() function. -It is called exactly once for each chunk stored. - - -.SH III. Housekeeping - - -.SS Memory management - -The library can use internal memory allocation/deallocation or use -provided callbacks for its memory management. The choice is made at -compilation time. See the section on customization for details. - -If internal management has been selected, the memory callback functions -need not be supplied. Even if you do supply them they will not be used. -The actual code used is similar to the code discussed in the callback -section: - - pPtr = calloc (1, iLen); - - free (pPtr); - -If your compiler does not support these functions, or you wish to monitor -the library's use of memory for certain reasons, you can choose to -compile the library with external memory management. In this case the -memory callback functions MUST be supplied, and should function as if the -above code was used. - - -.SS Initialization - -The basic initialization of the library is short and swift: - - myhandle = mng_initialize (myuserdata, my_alloc, - my_free, MNG_NULL); - if (myhandle == MNG_NULL) - /* process error */; - -The first field is an application-only parameter. It is saved in -libmng's internal structures and available at all times through the -mng_get_userdata() function. This is especially handy in callback functions -if your program may be handling multiple files at the same time. - -The second and third field supply the library with the memory callback -function entry-points. These are described in more detail in the callback -section and the previous paragraph. - -The fourth and last field may be used to supply the library with the -entry-point of a trace callback function. For regular use you will not -need this! - -The function returns a handle which will be your ticket to MNG-heaven. -All other functions rely on this handle. It is the single fixed unique -reference-point between your application and the library. - -You should call the initialization function for each image you wish to -process simultaneously. If you are processing images consecutively, you can -reset the internal status of the library with the mng_reset() function. -This function will clear all internal state variables, free any stored -chunks and/or objects, etc, etc. Your callbacks and other external parameters -will be retained. - -After you successfully received the handle it is time to set the required -callbacks. The sections on reading, displaying & writing indicate which -callbacks are required and which are optional. -To set the callbacks simply do: - - myretcode = mng_setcb_xxxxxx (myhandle, my_xxxxxx); - if (myretcode != MNG_NOERROR) - /* process error */; - -Naturally you'd replace the x's with the name of the callback. - - -.SS Cleanup - -Once you've gotten hold of that precious mng_handle, you should always, -and I mean always, call the cleanup function when you're done. -Just do: - - mng_cleanup (myhandle); - -And you're done. There shouldn't be an ounce of memory spilled after -that call. - -Note that if you would like to process multiple files consecutively -you do not need to do mng_cleanup() / mng_initialize() between each file -but simply - - myretcode = mng_reset (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -will suffice. Saves some time and effort, that. - - -.SS Error handling - -From the examples in the previous paragraphs you may have noticed a -meticulous scheme for error handling. And yes, that's exactly what it is. -Practically each call simply returns an errorcode, indicating success, -eg. MNG_NOERROR or failure, anything else but MNG_NEEDMOREDATA and -MNG_NEEDTIMERWAIT. These latter two will be discussed in more detail in -their respective fields of interest: the reading section and displaying -section respectively. - -It is the application's responsibility to check the returncode after -each call. You can call mng_getlasterror() to receive the details of -the last detected error. This even includes a discriptive error-message -if you enabled that option during compilation of the library. - -Note that after receiving an error it is still possible to call the -library, but it's also very likely that any following call will fail. -The only functions deemed to work will be mng_reset() and mng_cleanup(). -Yes, if you abort your program after an error, you should still call -mng_cleanup(). - - -.SH IV. Reading - -Reading a MNG, JNG or PNG is fairly easy. It depends slightly on your -ultimate goal how certain specifics are to be handled, but the basics -are similar in all cases. - -For the read functioins to work you must have compiled the library with -the MNG_READ_SUPPRT directive. The standard DLL and Shared Library -have this on by default! - - -.SS Setup - -Naturally you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_readdata, mng_closestream - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -The reading bit will also fail if you are already creating or -displaying a file. Seems a bit obvious, but I thought I'd mention it, -just in case. - - -.SS To suspend or not to suspend - -There is one choice you need to make before calling the read function. -Are you in need of suspension-mode or not? - -If you're reading from a disk you most certainly do not need -suspension-mode. Even the oldest and slowest of disks will be fast -enough for straight reading. - -However, if your input comes from a really slow device, such as a -dialup-line or the likes, you may opt for suspension-mode. This is done -by calling - - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - -Suspension-mode will force the library to use special buffering on the -input. This allows your application to receive data of arbitrarily length -and return this in the mng_readdata() callback, without disturbing the -chunk processing routines of the library. - -Suspension-mode does require a little extra care in the main logic of the -application. The read function may return with MNG_NEEDMOREDATA when the -mng_readdata() callback returns less data then it needs to process the -next chunk. This indicates the application to wait for more data to arrive -and then resume processing by calling mng_read_resume(). - - -.SS The read HLAPI - -The actual reading is just plain simple. Since all I/O is done -outside the library through the callbacks, the library can focus on -its real task. Understanding, checking and labelling the input data! - -All you really need to do is this: - - myretcode = mng_read (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -Of course, if you're on suspension-mode the code is a little more -complicated: - - myretcode = mng_read (myhandle); - - while (myretcode == MNG_NEEDMOREDATA) { - /* wait for input-data to arrive */ - myretcode = mng_read_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -This is rather crude and more sophisticated programming methods may -dictate another approach. Whatever method you decide on, it should -act as if the above code was in its place. - -There is also the mng_readdisplay() function, but this is discussed -in the displaying section. It functions pretty much as the mng_read() -function, but also immediately starts displaying the image. -mng_read_resume() should be replaced by mng_display_resume() in that -case! - - -.SS What happens inside - -What actually happens inside the library depends on the configuration -options set during the compilation of the library. - -Basically the library will first read the 8-byte file header, to determine -its validity and the type of image it is about to process. Then it will -repeatedly read a 4-byte chunk-length and then the remainder of the chunk -until it either reaches EOF (indicated by the mng_readdata() callback) or -implicitly decides EOF as it processed the logically last chunk of the -image. - -Applications that require strict conformity and do not allow superfluous -data after the ending chunk, will need to perform this check in their -mng_closestream() callback. - -Each chunk is then checked on CRC, after which it is handed over to the -appropriate chunk processing routine. These routines will disect the -chunk, check the validity of its contents, check its position with respect -to other chunks, etc, etc. - -If everything checks out, the chunk is further processed as follows: - -If display support has been selected during compilation, certain pre-display -initialization will take place. - -If chunk-storage support has been selected during compilation, the chunks -data may be stored in a special internal structure and held for future -reference. - - -.SS Storing and accessing chunks - -One of the compilation options activates support for chunk storage. -This option may be useful if you want to examine an image. The directive -is MNG_STORE_CHUNKS. You must also turn on the MNG_ACCESS_CHUNKS -directive. - -The actual storage facility can be turned on or off with the -mng_set_storechunks() function. If set to MNG_TRUE, chunks will be -stored as they are read. - -At any point you can then call the mng_iterate_chunks() function -to iterate through the current list of chunks. This function requires -a callback which is called for each chunk and receives a specific -chunk-handle. This chunk-handle can be used to call the appropriate -mng_getchunk_xxxx() function, to access the chunks properties. - -A typical implementation may look like this: - - mng_bool my_iteratechunk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq) { - switch (iChunkid) { - case MNG_UINT_MHDR : { /* process MHDR */; - break; } - case MNG_UINT_FRAM : { /* process FRAM */; - break; } - - ...etc... - - case MNG_UINT_HUH : { /* unknown chunk */; - break; } - default : { /* duh; forgot one */; } - } - - return MNG_TRUE; /* keep'm coming */ - } - -To get to the actual chunk fields of lets say a SHOW chunk you would do: - - mng_bool isempty; - mng_uint16 firstid, lastid; - mng_uint8 showmode; - - myretcode mng_getchunk_show (hHandle, hChunk, - isempty, firstid, - lastid, showmode); - if (myretcode != MNG_NOERROR) - /* process error */; - - -.SH V. Displaying - - -.SS Setup - -Assuming you have initialized the library and are the owner of -a mng_handle. The following callbacks are essential: - - mng_getcanvasline, mng_refresh - mng_gettickcount, mng_settimer - -If you wish to use an application supplied background you must supply: - - mng_getbkgdline - -If you wish to use the MNG_CANVAS_RGB8_A8 canvas style you must supply: - - mng_getalphaline - -You may optionally define: - - mng_errorproc, mng_traceproc - mng_processheader, mng_processtext - mng_processsave, mng_processseek - -Note that the mng_processheader() callback is optional but will -be quite significant for proper operation! - -Displaying an image will fail if you are creating a file or already -displaying one. Yes, you can't display it twice! - - -.SS A word on canvas styles - -The canvas style describes how your drawing canvas is made up. -You must set this before the library actually starts drawing, so -the mng_processheader() callback is a pretty good place for it. - -Currently only 8-bit RGB canvas styles are supported, either with -or without an alpha channel. - -If you like to do alpha composition yourself you can select one of -the canvas styles that include an alpha channel. You can even have -a separate alpha canvas by selecting the MNG_CANVAS_RGB8_A8 style. - -All styles require a compact model. Eg. MNG_CANVAS_BGR8 requires -your canvas lines in bgrbgrbgr... storage, where each letter -represents an 8-bit value of the corresponding color, and each -threesome makes up the values of one(1) pixel. - -The library processes a line at a time, so the canvas lines do not -actually need to be consecutive in memory. - - -.SS Alpha composition and application backgrounds - -All Network Graphics can be partially transparent. This requires -special processing if you need to display an image against some -background. Note that the MNG header (MHDR chunk) contains a -simplicity field indicating whether transparency information in -the file is critical or not. This only applies to embedded images, -which means the full image-frame of the MNG may still contain fully -transparent pixels! - -Depending on your needs you can supply a single background color, -a background canvas or tell the library to return the alpha-channel -and do alpha composition yourself. - -This is different from the BACK chunk in a MNG, or the bKGD chunk -in an (embedded) PNG or JNG. The BACK chunk indicates an optional or -mandatory background color and/or image. The bKGD chunk only indicates -an optional background color. These chunks indicate the Authors -preferences. They may be absent in which case you need to supply -some sort of background yourself. - -.SS Composing against a background color - -This is the easiest method. Call the mng_set_bgcolor() function to -set the values of the red, green and blue component of your preferred -background color. - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. - -.SS Composing against a background canvas - -This is somewhat more complicated. You will need to set the -mng_getbkgdline() callback. This will be called whenever the library -needs to compose a partially transparent line. - -This canvas must hold the background against which the image should -be composed. Its size must match exactly with the image dimensions -and thus the drawing canvas! - -Use one of the canvas styles that do not have an alpha-channel, and -which matches your output requirements. The canvas style of the -background canvas may even differ from the drawing canvas. The library's -composing will still function properly. - -.SS Composing within the application - -If you have the option in your application to draw a (partially) -transparent canvas to the output device, this option is preferred. - -Select one of the canvas styles that do have an alpha-channel. -The library will now supply the appropriate alpha information, -allowing the application to compose the image as it sees fit. - - -.SS Color information and CMS - -Network Graphics may, and usually will, contain color-correction -information. This information is intended to compensate for the -difference in recording and display devices used. - -This document does not address the specifics of color-management. -See the PNG specification for a more detailed description. - -.SS Using little cms by Marti Maria Saguer - -This is the easiest method, providing you can compile the lcms package. -Select the MNG_FULL_CMS directive during compilation, and sit back and -relax. The library will take care of all color-correction for you. - -.SS Using an OS- or application-supplied CMS - -If you are so lucky to have access to CMS functionality from within -your application, you may instruct the library to leave color-correction -to you. - -Select the MNG_APP_CMS directive during compilation of the library. -You MUST also set the following callbacks: - - mng_processgamma, mng_processchroma, - mng_processsrgb, mng_processiccp and - mng_processarow - -The last callback is called when the library needs you to correct -an arbitrary line of pixels. The other callbacks are called when -the corresponding color-information is encountered in the file. -You must store this information somewhere for use in the -mng_processarow() callback. - -.SS Using gamma-only correction - -This isn't a preferred method, but it's better than no correction -at all. Gamma-only correction will at least compensate for -gamma-differences between the original recorder and your output device. - -Select the MNG_GAMMA_ONLY directive during compilation -of the library. Your compiler MUST support fp operations. - -.SS No color correction - -Ouch. This is really bad. This is the least preferred method, -but may be necessary if your system cannot use lcms, doesn't -have its own CMS, and does not allow fp operations, ruling out -the gamma-only option. - -Select the MNG_NO_CMS directive during compilation. -Images will definitely not be displayed as seen by the Author!!! - - -.SS Animations and timing - -Animations require some form of timing support. The library relies -on two callbacks for this purpose. The mng_gettickcount() and -mng_settimer() callbacks. mng_gettickcount() is used to determine -the passing of time in milliseconds since the beginning of the -animation. This is also used to compensate during suspension-mode -if you are using the mng_readdisplay() function to read & display -the file simultaneously. - -The callback may return an arbitrary number of milliseconds, but -this number must increase proportionaly between calls. Most modern -systems will have some tickcount() function which derives its -input from an internal clock. The value returned from this function -is more than adequate for libmng. - -The mng_settimer() callback is called when the library determines -a little "pause" is required before rendering another frame of the -animation. The pause interval is also expressed in milliseconds. -Your application should store this value and return immediately. -The library will then make appropriate arrangements to store its -internal state and returns to your application with the -MNG_NEEDTIMERWAIT code. - -At that point you should suspend processing and wait the given -interval. Please use your OS features for this. Do not engage some -sort of loop. That is real bad programming practice. Most modern -systems will have some timing functions. A simple wait() function -may suffice, but this may prevent your applications main-task from -running, and possibly prevent the actual update of your output device. - - -.SS The mng_refresh() callback - -The mng_refresh() callback is called whenever the library has -"finished" drawing a new frame onto your canvas, and just before it -will call the mng_settimer() callback. - -This allows you to perform some actions necessary to "refresh" the -canvas onto your output device. Please do NOT suspend processing -inside this callback. This must be handled after the mng_settimer() -callback! - - -.SS Displaying while reading - -This method is preferred if you are reading from a slow input device -(such as a dialup-line) and you wish to start displaying something -as quickly as possible. This functionality is provided mainly for -browser-type applications but may be appropriate for other -applications as well. - -The method is usually used in unison with the suspension-mode of -the read module. A typical implementation would look like this: - - /* initiale library and set required callbacks */ - - /* activate suspension-mode */ - myretcode = mng_set_suspensionmode (myhandle, - MNG_TRUE); - if (myretcode != MNG_NOERROR) - /* process error */; - - myretcode = mng_readdisplay (myhandle); - - while ((myretcode == MNG_NEEDMOREDATA) || - (myretcode == MNG_NEEDTIMERWAIT)) { - if (myretcode == MNG_NEEDMOREDATA) - /* wait for more input-data */; - else - /* wait for timer interval */; - - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -More advanced programming methods may require a different approach, -but the final result should function as in the code above. - - -.SS Displaying after reading - -This method is used to display a file that was previously read. -It is primarily meant for viewers with direct file access, such as -1a local harddisk. - -Once you have successfully read the file, all you need to do is: - - myretcode = mng_display (myhandle); - - while (myretcode == MNG_NEEDTIMERWAIT) { - /* wait for timer interval */; - myretcode = mng_display_resume (myhandle); - } - - if (myretcode != MNG_NOERROR) - /* process error */; - -Again, more advanced programming methods may require a different -approach, but the final result should function as in the code above. - - -.SS Display manipulation - -Several HLAPI functions are provided to allow a user to manipulate -the normal flow of an animation. - -\- mng_display_freeze (mng_handle hHandle) - -This will "freeze" the animation in place. - -\- mng_display_resume (mng_handle hHandle) - -This function can be used to resume a frozen animation, or to force -the library to advance the animation to the next frame. - -\- mng_display_reset (mng_handle hHandle) - -This function will "reset" the animation into its pristine state. -Calling mng_display() afterwards will re-display the animation -from the first frame. - -\- mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayer) - -\- mng_display_goframe (mng_handle hHandle, - mng_uint32 iFrame) - -\- mng_display_gotime (mng_handle hHandle, - mng_uint32 iPlaytime) - -These three functions can be used to "jump" to a specific layer, frame -or timeslot in the animation. You must "freeze" the animation before -using any of these functions. - -All above functions may only be called during a timer interval! -It is the applications responsibility to cleanup any resources with -respect to the timer wait. - - -.SH VI. Writing - -The main focus of the library lies in its displaying capabilites. -But it does offer writing support as well. -You can create and write a file, or you can write a file you -have previously read, providing the storage of chunks was enabled -and active. - -For this to work you must have compiled the library with the -MNG_WRITE_SUPPO1RT and MNG_ACCESS_CHUNKS directives. The standard DLL and -Shared Library have this on by default! - - -.SS Setup - -As always you must have initialized the library and be the owner of -a mng_handle. The following callbacks are essential: - - mng_openstream, mng_writedata, mng_closestream - -You can optionally define: - - mng_errorproc, mng_traceproc - -The creation and writing functions will fail if you are in the middle -of reading, creating or writing a file. - - -.SS Creating a new file - -To start a new file the library must be in its initial state. -First you need to tell the library your intentions: - - myretcode = mng_create (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -After that you start adding the appropriate chunks: - - myretcode = mng_put1chunk_mhdr (myhandle, ...); - if (myretcode != MNG_NOERROR) - /* process error */; - -And so on, and so forth. Note that the library will automatically signal -the logical end of the file by the ending chunk. Also the first chunk -will indicate the library the filetype (eg. PNG, JNG or MNG) and force -the proper signature when writing the file. - -The code above can be simplified, as you can always get the last errorcode -by using the mng_getlasterror() function: - - if ( (mng_putchunk_xxxx (myhandle, ...)) or - (mng_putchunk_xxxx (myhandle, ...)) or - ...etc... ) - /* process error */; - -Please note that you must have a pretty good understanding of the chunk -specification. Unlike the read functions, there are virtually no checks, -so it is quite possible to write completely wrong files. -It is a good practice to read back your file into the library to verify -its integrity. - -Once you've got all the chunks added, all you do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - -And presto. You're done. The real work is of course carried out in -your callbacks. Note that this is a single operation as opposed to -the read & display functions that may return with MNG_NEEDMOREDATA -and/or MNG_NEEDTIMERWAIT. The write function just does the job, and -only returns after it's finished or if it encounters some -unrecoverable error. - - -.SS Writing a previously read file - -If you have already successfully read a file, you can use the library to -write it out as a copy or something. You MUST have compiled the library -with the MNG_STORE_CHUNKS directive, and you must have done -mng_set_storechunks (myhandle, MNG_TRUE). - -This doesn't require the MNG_ACCESS_CHUNKS directive, unless you want -to fiddle with the chunks as well. - -Again all you need to do is: - - myretcode mng_write (myhandle); - if (myretcode != MNG_NOERROR) - /* process error */; - - -.SH VII. Modifying/Customizing libmng: - -not finished yet - -.SS Compilation directives - -not finished yet - -.SS Platform dependant modification - -not finished yet - -.SH "SEE ALSO" -.IR mng(5), jng(5), png(5), libpng(3) - -.LP -libmng : -.IP -.br -http://www.libmng.com - -.LP -zlib : -.IP -.br -http://www.info-zip.org/pub/infozip/zlib/ - -.LP -IJG JPEG library : -.IP -.br -http://www.ijg.org - -.LP -lcms (little CMS) by Marti Maria Saguer : -.IP -.br -http://www.littlecms.com/ - -.LP -MNG specification: -.IP -.br -http://www.libpng.org/pub/mng - -.LP -In the case of any inconsistency between the MNG specification -and this library, the specification takes precedence. - - -.SH AUTHORS -This man page: Gerard Juyn - - -The contributing authors would like to thank all those who helped -with testing, bug fixes, and patience. This wouldn't have been -possible without all of you!!! - - -.SH COPYRIGHT NOTICE: - -Copyright (c) 2000-2002 Gerard Juyn - -For the purposes of this copyright and license, "Contributing Authors" -is defined as the following set of individuals: - - Gerard Juyn - -The MNG Library is supplied "AS IS". The Contributing Authors -disclaim all warranties, expressed or implied, including, without -limitation, the warranties of merchantability and of fitness for any -purpose. The Contributing Authors assume no liability for direct, -indirect, incidental, special, exemplary, or consequential damages, -which may result from the use of the MNG Library, even if advised of -the possibility of such damage. - -Permission is hereby granted to use, copy, modify, and distribute this -source code, or portions hereof, for any purpose, without fee, subject -to the following restrictions: - -1. The origin of this source code must not be misrepresented; -you must not claim that you wrote the original software. - -2. Altered versions must be plainly marked as such and must not be -misrepresented as being the original source. - -3. This Copyright notice may not be removed or altered from any source -or altered source distribution. - -The Contributing Authors specifically permit, without fee, and -encourage the use of this source code as a component to supporting -the MNG and JNG file format in commercial products. If you use this -source code in a product, acknowledgment would be highly appreciated. - -.SH Remarks - -Parts of this software have been adapted from the libpng library. -Although this library supports all features from the PNG specification -(as MNG descends from it) it does not require the libpng library. -It does require the zlib library and optionally the IJG JPEG library, -and/or the "little-cms" library by Marti Maria Saguer (depending on the -inclusion of support for JNG and Full-Color-Management respectively. - -This library's function is primarily to read and display MNG -animations. It is not meant as a full-featured image-editing -component! It does however offer creation and editing functionality -at the chunk level. (future modifications may include some more -support for creation and or editing) - -.\" end of man page diff --git a/Engine/lib/lmng/doc/man/mng.5 b/Engine/lib/lmng/doc/man/mng.5 deleted file mode 100644 index e40c24910..000000000 --- a/Engine/lib/lmng/doc/man/mng.5 +++ /dev/null @@ -1,42 +0,0 @@ -.TH MNG 5 "July 25, 2000" -.SH NAME -mng \- Multiple-image Network Graphics (MNG) format -.SH DESCRIPTION -MNG (Multiple-image Network Graphics) is the animation extension of the -popular PNG image-format. PNG (Portable Network Graphics) is an -extensible file format for the lossless, portable, well-compressed -storage of raster images. -.br - -MNG has advanced animation features which make it very useful as a full -replacement for GIF animations. These features allow animations that -are impossible with GIF or result in much smaller files as GIF. - -As MNG builds on the same structure as PNG, it is robust, extensible and -free of patents. It retains the same clever file integrity checks as in PNG. - -MNG also embraces the lossy JPEG image-format in a sub-format named JNG, -which allows for alpha-transparency and color-correction on highly -compressed (photographic) images. - -.SH "SEE ALSO" -.IR png(5) ", " jng(5) ", " libmng(3) ", " libpng(3) ", " zlib(3) ", " -deflate(5) ", " zlib(5) ", " jpeg(5) -.LP -MNG 1.00, Februari 9, 2001: -.IP -.br -http://www.libpng.org/pub/mng -.SH AUTHORS -This man page: Gerard Juyn -.LP -Multiple-image Network Graphics (MNG) Specification Version 1.00 (Februari 9, 2001): -Glenn Randers-Pehrson and others (png-list@ccrc.wustl.edu). -.LP - -.SH COPYRIGHT NOTICE -The MNG-1.00 specification is copyright (c) 1998-2001 Glenn Randers-Pehrson. -See the specification for conditions of use and distribution. -.LP -.\" end of man page - diff --git a/Engine/lib/lmng/doc/misc/magic.dif b/Engine/lib/lmng/doc/misc/magic.dif deleted file mode 100644 index 005ad5a74..000000000 --- a/Engine/lib/lmng/doc/misc/magic.dif +++ /dev/null @@ -1,30 +0,0 @@ ---- magic.orig Wed Aug 14 16:48:56 2002 -+++ magic Wed Aug 14 16:50:09 2002 -@@ -2544,6 +2544,27 @@ - >>28 byte 1 interlaced - 1 string PNG PNG image data, CORRUPTED - -+#MNG -+# 0x8a M N G 0x0d 0x0a 0x1a 0x0a [4-byte pad] -+# M H D R [4-byte width][4-byte height][4-byte ticks][4-byte layers] -+# [4-byte frame][4-byte time] -+# -+0 string \x8aMNG MNG image data, -+>4 belong !0x0d0a1a0a CORRUPTED -+>4 belong 0x0d0a1a0a -+>>16 belong x %ld x -+>>20 belong x %ld -+ -+#JNG -+# 0x8b J N G 0x0d 0x0a 0x1a 0x0a [4-byte pad] -+# J H D R [4-byte width][4-byte height] -+# -+0 string \x8bJNG JNG image data, -+>4 belong !0x0d0a1a0a CORRUPTED -+>4 belong 0x0d0a1a0a -+>>16 belong x %ld x -+>>20 belong x %ld -+ - # GIF - 0 string GIF8 GIF image data - >4 string 7a \b, version 8%s, diff --git a/Engine/lib/lmng/doc/rpm/libmng-1.0.10-rhconf.patch b/Engine/lib/lmng/doc/rpm/libmng-1.0.10-rhconf.patch deleted file mode 100644 index a73b79dbe..000000000 --- a/Engine/lib/lmng/doc/rpm/libmng-1.0.10-rhconf.patch +++ /dev/null @@ -1,38 +0,0 @@ ---- libmng/makefiles/makefile.linux.orig Sat Jul 1 15:10:35 2000 -+++ libmng/makefiles/makefile.linux Sat Jul 1 15:14:52 2000 -@@ -13,19 +13,19 @@ - OPTIONS = -DMNG_BUILD_SO - - # where "make install" puts libmng.a,libmng.so*,libmng.h,libmng_conf.h,libmng_types.h --prefix=/usr/local -+prefix=/usr - - # Where the zlib library and include files are located --ZLIBLIB=../zlib --ZLIBINC=../zlib -+ZLIBLIB=/usr/lib -+ZLIBINC=/usr/include - - # Where the jpeg library and include files are located --JPEGLIB=../jpgsrc --JPEGINC=../jpgsrc -+JPEGLIB=/usr/lib -+JPEGINC=/usr/include - - # Where the lcms library and include files are located --LCMSLIB=../lcms/lib --LCMSINC=../lcms/source -+LCMSLIB=/usr/lib -+LCMSINC=/usr/include - - ALIGN= - # for i386: -@@ -37,7 +37,7 @@ - - # for pgcc version 2.95.1, -O3 is buggy; don't use it. - --CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -funroll-loops \ -+CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall $(RPM_OPT_FLAGS) \ - $(OPTIONS) $(ALIGN) # $(WARNMORE) -g - LDFLAGS=-L. -Wl,-rpath,. \ - -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ diff --git a/Engine/lib/lmng/doc/rpm/libmng.spec b/Engine/lib/lmng/doc/rpm/libmng.spec deleted file mode 100644 index 89908d7a9..000000000 --- a/Engine/lib/lmng/doc/rpm/libmng.spec +++ /dev/null @@ -1,116 +0,0 @@ -Summary: A library of functions for manipulating MNG format files. -Name: libmng -Version: 1.0.10 -Release: 2.1 -Copyright: AS IS -Group: System Environment/Libraries -Source0: libmng-%{PACKAGE_VERSION}.tar.gz -Patch: libmng-%{PACKAGE_VERSION}-rhconf.patch -URL: http://www.libmng.com/ -BuildRoot: /var/tmp/libmng-root -BuildPrereq: libjpeg-devel, zlib-devel, lcms-devel - -%description -libmng - library for reading, writing, displaying and examing -Multiple-Image Network Graphics. MNG is the animation extension to the -popular PNG image-format. - -%package devel -Summary: Development tools for programs to manipulate MNG format files. -Group: Development/Libraries -Requires: libmng = %{PACKAGE_VERSION} -%description devel -The libmng-devel package contains the header files and static -libraries necessary for developing programs using the MNG -(Multiple-Image Network Graphics) library. - -If you want to develop programs which will manipulate MNG image format -files, you should install libmng-devel. You'll also need to install -the libmng package. - -%changelog -* Fri Jul 13 2007 Glenn Randers-Pehrson -- updated to 1.0.10 - -* Thu Aug 5 2004 Gerard Juyn -* Sun Jan 30 2005 Gerard Juyn -- updated to 1.0.9 - -* Thu Aug 5 2004 Gerard Juyn -- updated to 1.0.8 - -* Sun Mar 21 2004 Gerard Juyn -- updated to 1.0.7 - -* Sun Oct 19 2003 Gerard Juyn -- updated to 1.0.6 - -* Tue Sep 24 2002 Gerard Juyn -- updated to 1.0.5 - -* Sun Jun 23 2002 Gerard Juyn -- updated to 1.0.4 - -* Mon Sep 18 2001 Gerard Juyn -- updated to 1.0.3 - -* Sat Jul 7 2001 Gerard Juyn -- updated to 1.0.2 - -* Wed May 2 2001 Gerard Juyn -- updated to 1.0.1 - -* Mon Feb 5 2001 Gerard Juyn -- updated to 1.0.0 - -* Fri Jan 19 2001 Gerard Juyn -- updated to 0.9.4 - -* Sat Oct 28 2000 Gerard Juyn -- updated to 0.9.3 - -* Tue Aug 15 2000 MATSUURA Takanori -- based on libmng-0.9.2/doc/rpm/libmng.spec -- use %%configure and %%makeinstall - -* Sat Aug 5 2000 Gerard Juyn -- updated to 0.9.2 - -* Wed Jul 26 2000 Gerard Juyn -- updated to 0.9.1 - -* Sat Jul 1 2000 MATSUURA Takanori -- updated to 0.9.0 - -* Sat Jun 24 2000 MATSUURA Takanori -- 1st release for RPM - -%prep -%setup -%configure - -%build -make - -%install -rm -rf $RPM_BUILD_ROOT -%makeinstall - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root) -%doc CHANGES LICENSE README doc -/usr/lib/libmng.so.* - -%files devel -%defattr(-,root,root) -/usr/include/* -/usr/lib/libmng.a -/usr/lib/libmng.so - diff --git a/Engine/lib/lmng/libmng.h b/Engine/lib/lmng/libmng.h deleted file mode 100644 index b3b1ab141..000000000 --- a/Engine/lib/lmng/libmng.h +++ /dev/null @@ -1,2932 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * COPYRIGHT NOTICE: * */ -/* * * */ -/* * Copyright (c) 2000-2007 Gerard Juyn * */ -/* * [You may insert additional notices after this sentence if you modify * */ -/* * this source] * */ -/* * * */ -/* * For the purposes of this copyright and license, "Contributing Authors" * */ -/* * is defined as the following set of individuals: * */ -/* * * */ -/* * Gerard Juyn - gjuyn :at: users.sourceforge.net * */ -/* * Glenn Randers-Pehrson - glennrp :at: users.sourceforge.net * */ -/* * Raphael Assenat - raph :at: raphnet.net * */ -/* * John Stiles - * */ -/* * * */ -/* * The MNG Library is supplied "AS IS". The Contributing Authors * */ -/* * disclaim all warranties, expressed or implied, including, without * */ -/* * limitation, the warranties of merchantability and of fitness for any * */ -/* * purpose. The Contributing Authors assume no liability for direct, * */ -/* * indirect, incidental, special, exemplary, or consequential damages, * */ -/* * which may result from the use of the MNG Library, even if advised of * */ -/* * the possibility of such damage. * */ -/* * * */ -/* * Permission is hereby granted to use, copy, modify, and distribute this * */ -/* * source code, or portions hereof, for any purpose, without fee, subject * */ -/* * to the following restrictions: * */ -/* * * */ -/* * 1. The origin of this source code must not be misrepresented; * */ -/* * you must not claim that you wrote the original software. * */ -/* * * */ -/* * 2. Altered versions must be plainly marked as such and must not be * */ -/* * misrepresented as being the original source. * */ -/* * * */ -/* * 3. This Copyright notice may not be removed or altered from any source * */ -/* * or altered source distribution. * */ -/* * * */ -/* * The Contributing Authors specifically permit, without fee, and * */ -/* * encourage the use of this source code as a component to supporting * */ -/* * the MNG and JNG file format in commercial products. If you use this * */ -/* * source code in a product, acknowledgment would be highly appreciated. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * Parts of this software have been adapted from the libpng package. * */ -/* * Although this library supports all features from the PNG specification * */ -/* * (as MNG descends from it) it does not require the libpng package. * */ -/* * It does require the zlib library and optionally the IJG jpeg library, * */ -/* * and/or the "little-cms" library by Marti Maria (depending on the * */ -/* * inclusion of support for JNG and Full-Color-Management respectively. * */ -/* * * */ -/* * This library's function is primarily to read and display MNG * */ -/* * animations. It is not meant as a full-featured image-editing * */ -/* * component! It does however offer creation and editing functionality * */ -/* * at the chunk level. * */ -/* * (future modifications may include some more support for creation * */ -/* * and or editing) * */ -/* * * */ -/* ************************************************************************** */ - -/* ************************************************************************** */ -/* * * */ -/* * Version numbering * */ -/* * * */ -/* * X.Y.Z : X = release (0 = initial build) * */ -/* * Y = major version (uneven = test; even = production) * */ -/* * Z = minor version (bugfixes; 2 is older than 10) * */ -/* * * */ -/* * production versions only appear when a test-version is extensively * */ -/* * tested and found stable or for intermediate bug-fixes (recognized by * */ -/* * a change in the Z number) * */ -/* * * */ -/* * x.1.x = test version * */ -/* * x.2.x = production version * */ -/* * x.3.x = test version * */ -/* * x.4.x = production version * */ -/* * etc. * */ -/* * * */ -/* ************************************************************************** */ -/* * * */ -/* * Identifier naming conventions throughout this library * */ -/* * * */ -/* * iXxxx = an integer * */ -/* * dXxxx = a float * */ -/* * pXxxx = a pointer * */ -/* * bXxxx = a boolean * */ -/* * eXxxx = an enumeration * */ -/* * hXxxx = a handle * */ -/* * zXxxx = a zero-terminated string (pchar) * */ -/* * fXxxx = a pointer to a function (callback) * */ -/* * aXxxx = an array * */ -/* * sXxxx = a structure * */ -/* * * */ -/* * Macros & defines are in all uppercase. * */ -/* * Functions & typedefs in all lowercase. * */ -/* * Exported stuff is prefixed with MNG_ or mng_ respectively. * */ -/* * * */ -/* * (I may have missed a couple; don't hesitate to let me know!) * */ -/* * * */ -/* ************************************************************************** */ - -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : main application interface * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : The main application interface. An application should not * */ -/* * need access to any of the other modules! * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - changed chunk iteration function * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added chunk access functions * */ -/* * - added version control constants & functions * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added set_outputprofile2 & set_srgbprofile2 * */ -/* * - added empty-chunk put-routines * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - added version_dll & VERSION_DLL (for consistency) * */ -/* * - added version control explanatory text & samples * */ -/* * 0.5.1 - 05/15/2000 - G.Juyn * */ -/* * - added getimgdata & putimgdata functions * */ -/* * * */ -/* * 0.5.2 - 05/16/2000 - G.Juyn * */ -/* * - changed the version parameters (obviously) * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - complimented constants for chunk-property values * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - fixed MNG_UINT_pHYg value * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for get/set default zlib/IJG parms * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added MNG_BIGENDIAN_SUPPORT (contributed by Tim Rowley) * */ -/* * - separated configuration-options into "mng_conf.h" * */ -/* * - added RGB8_A8 canvasstyle * */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - moved errorcodes from "mng_error.h" * */ -/* * - added mng_read_resume function to support * */ -/* * read-suspension * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed the version parameters (obviously) * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added get/set for speedtype to facilitate testing * */ -/* * - added get for imagelevel during processtext callback * */ -/* * 0.5.3 - 06/24/2000 - G.Juyn * */ -/* * - fixed inclusion of IJG read/write code * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * * */ -/* * 0.9.0 - 06/30/2000 - G.Juyn * */ -/* * - changed refresh parameters to 'x,y,width,height' * */ -/* * * */ -/* * 0.9.1 - 07/06/2000 - G.Juyn * */ -/* * - added MNG_NEEDTIMERWAIT errorcode * */ -/* * - changed comments to indicate modified behavior for * */ -/* * timer & suspension breaks * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added get routines for internal display variables * */ -/* * - added get/set routines for suspensionmode variable * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * - added get/set routines for sectionbreak variable * */ -/* * - added NEEDSECTIONWAIT errorcode * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added function to set frame-/layer-count & playtime * */ -/* * - added errorcode for updatemngheader if not a MNG * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - fixed problem with trace-functions improperly wrapped * */ -/* * - added status_xxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added function to set simplicity field * */ -/* * * */ -/* * 0.9.3 - 08/09/2000 - G.Juyn * */ -/* * - added check for simplicity-bits in MHDR * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - fixed processing of unknown critical chunks * */ -/* * - removed test-MaGN * */ -/* * - added PNG/MNG spec version indicators * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * - added JDAA chunk * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added errocode for delayed delta-processing * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 0.9.4 - 01/18/2001 - G.Juyn * */ -/* * - added errorcode for MAGN methods * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * * */ -/* * 1.0.0 - 02/05/2001 - G.Juyn * */ -/* * - version numbers (obviously) * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added late binding errorcode (not used internally) * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.5 - 07/04/2002 - G.Juyn * */ -/* * - added errorcode for extreme chunk-sizes * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * - added 'supports' call to check function availability * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added check for TERM placement during create/write * */ -/* * - added beta version function & constant * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G. Randers-Pehrson * */ -/* * - added support for reducing the footprint of libmng * */ -/* * by macros that optionally skip unused chunks, remove * */ -/* * 16-bit sample support, remove Delta support, and * */ -/* * remove JNG support, to accomodate Mozilla/Firebird. * */ -/* * 1.0.6 - 07/14/2003 - G. Randers-Pehrson * */ -/* * - further optional removal of unused functions * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */ -/* * - put gamma, cms-related declarations inside #ifdef * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/12/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 06/05/2004 - G.R-P * */ -/* * - define MNG_INCLUDE_ZLIB when MNG_USE_ZLIB_CRC is defined * */ -/* * * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 10/17/2004 - G.Juyn * */ -/* * - fixed PPLT getchunk/putchunk routines * */ -/* * * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_h_ -#define _libmng_h_ - -/* ************************************************************************** */ - -#include "libmng_conf.h" /* user-specific configuration options */ - -/* ************************************************************************** */ - -#define MNG_CHECK_BAD_ICCP /* let's catch that sucker !!! */ - -#ifdef MNG_SUPPORT_READ /* dependencies based on user-configuration */ -#define MNG_INCLUDE_READ_PROCS -#endif - -#ifdef MNG_SUPPORT_WRITE -#define MNG_INCLUDE_WRITE_PROCS -#endif - -#ifdef MNG_USE_ZLIB_CRC -#define MNG_INCLUDE_ZLIB -#endif - -#ifdef MNG_SUPPORT_DISPLAY -#define MNG_INCLUDE_FILTERS -#define MNG_INCLUDE_INTERLACE -#define MNG_INCLUDE_OBJECTS -#define MNG_INCLUDE_DISPLAY_PROCS -#define MNG_INCLUDE_TIMING_PROCS -#define MNG_INCLUDE_ZLIB -#endif - -#ifdef MNG_STORE_CHUNKS -#define MNG_INCLUDE_ZLIB -#endif - -#ifdef MNG_SUPPORT_IJG6B -#define MNG_INCLUDE_JNG -#define MNG_INCLUDE_IJG6B -#define MNG_USE_SETJMP -#endif - -#ifdef MNG_INCLUDE_JNG -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_ACCESS_CHUNKS) -#define MNG_INCLUDE_JNG_READ -#endif -#if defined(MNG_SUPPORT_WRITE) || defined(MNG_ACCESS_CHUNKS) -#define MNG_INCLUDE_JNG_WRITE -#endif -#endif - -#ifdef MNG_FULL_CMS -#define MNG_INCLUDE_LCMS -#endif - -#ifdef MNG_AUTO_DITHER -#define MNG_INCLUDE_DITHERING -#endif - -#ifdef MNG_SUPPORT_TRACE -#define MNG_INCLUDE_TRACE_PROCS -#ifdef MNG_TRACE_TELLTALE -#define MNG_INCLUDE_TRACE_STRINGS -#endif -#endif - -#ifdef MNG_ERROR_TELLTALE -#define MNG_INCLUDE_ERROR_STRINGS -#endif - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_OPTIMIZE_CHUNKACCESS -#define MNG_OPTIMIZE_CHUNKACCESS -#endif -#else -#ifdef MNG_OPTIMIZE_CHUNKACCESS -#undef MNG_OPTIMIZE_CHUNKACCESS -#endif -#endif - -/* ************************************************************************** */ - -#include "libmng_types.h" /* platform-specific definitions - and other assorted stuff */ - -/* ************************************************************************** */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Versioning control * */ -/* * * */ -/* * version_so and version_dll will NOT reflect version_major; * */ -/* * these will only change for binary incompatible changes (which will * */ -/* * hopefully never occur) * */ -/* * note: they will be set to 1 on the first public release !!! * */ -/* * * */ -/* * first public release: * */ -/* * #define MNG_VERSION_TEXT "1.0.0" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 1 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * bug fix & cosmetics : * */ -/* * #define MNG_VERSION_TEXT "1.0.1" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 1 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 1 * */ -/* * * */ -/* * feature change : * */ -/* * #define MNG_VERSION_TEXT "1.2.0" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 1 * */ -/* * #define MNG_VERSION_MINOR 2 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * major rewrite (still binary compatible) : * */ -/* * #define MNG_VERSION_TEXT "2.0.0" * */ -/* * #define MNG_VERSION_SO 1 eg. libmng.so.1 * */ -/* * #define MNG_VERSION_DLL 1 eg. libmng.dll * */ -/* * #define MNG_VERSION_MAJOR 2 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * binary incompatible change: * */ -/* * #define MNG_VERSION_TEXT "13.0.0" * */ -/* * #define MNG_VERSION_SO 2 eg. libmng.so.2 * */ -/* * #define MNG_VERSION_DLL 2 eg. libmng2.dll * */ -/* * #define MNG_VERSION_MAJOR 13 * */ -/* * #define MNG_VERSION_MINOR 0 * */ -/* * #define MNG_VERSION_RELEASE 0 * */ -/* * * */ -/* * note that version_so & version_dll will always remain equal so it * */ -/* * doesn't matter which one is called to do version-checking; they are * */ -/* * just provided for their target platform * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_VERSION_TEXT "1.0.10" -#define MNG_VERSION_SO 1 /* eg. libmng.so.1 */ -#define MNG_VERSION_DLL 1 /* but: libmng.dll (!) */ -#define MNG_VERSION_MAJOR 1 -#define MNG_VERSION_MINOR 0 -#define MNG_VERSION_RELEASE 10 -#define MNG_VERSION_BETA MNG_FALSE - -MNG_EXT mng_pchar MNG_DECL mng_version_text (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_so (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_dll (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_major (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_minor (void); -MNG_EXT mng_uint8 MNG_DECL mng_version_release (void); -MNG_EXT mng_bool MNG_DECL mng_version_beta (void); - -/* use the following call to check wether the version of libmng your app - is using supports the given function; this is useful in apps that dynamically - load the library to make sure a certain function will work; the result will - be MNG_TRUE if the given function is implemented in this version of the library; - Major/Minor/Version indicate the version the function became available; - (if these fields are zero the function is not yet implemented!) */ -#ifdef MNG_SUPPORT_FUNCQUERY -MNG_EXT mng_bool MNG_DECL mng_supports_func (mng_pchar zFunction, - mng_uint8* iMajor, - mng_uint8* iMinor, - mng_uint8* iRelease); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * MNG/PNG specification level conformance * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_PNG_VERSION "1.2" -#define MNG_PNG_VERSION_MAJ 1 -#define MNG_PNG_VERSION_MIN 2 - -#define MNG_MNG_VERSION "1.1" -#define MNG_MNG_VERSION_MAJ 1 -#define MNG_MNG_VERSION_MIN 1 -#define MNG_MNG_DRAFT 99 /* deprecated; - only used for nEED "MNG DRAFT nn" */ - -/* ************************************************************************** */ -/* * * */ -/* * High-level application functions * */ -/* * * */ -/* ************************************************************************** */ - -/* library initialization function */ -/* must be the first called before anything can be done at all */ -/* initializes internal datastructure(s) */ -MNG_EXT mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata, - mng_memalloc fMemalloc, - mng_memfree fMemfree, - mng_traceproc fTraceproc); - -/* library reset function */ -/* can be used to re-initialize the library, so another image can be - processed. there's absolutely no harm in calling it, even when it's not - really necessary */ -MNG_EXT mng_retcode MNG_DECL mng_reset (mng_handle hHandle); - -/* library cleanup function */ -/* must be the last called to clean up internal datastructure(s) */ -MNG_EXT mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle); - -/* high-level read functions */ -/* use mng_read if you simply want to read a Network Graphic */ -/* mng_read_resume is used in I/O-read-suspension scenarios, where the - "readdata" callback may return FALSE & length=0 indicating its buffer is - depleted or too short to supply the required bytes, and the buffer needs - to be refilled; libmng will return the errorcode MNG_NEEDMOREDATA telling - the app to refill its read-buffer after which it must call mng_read_resume - (or mng_display_resume if it also displaying the image simultaneously) */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_read (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_read_resume (mng_handle hHandle); -#endif - -/* high-level "data push" functions */ -/* these functions can be used in situations where data is streaming into the - application and needs to be buffered by libmng before it is actually - requested by libmng itself. the pushing complements the normal reading - mechanism, but applications can decide to always return "0 bytes read" to - make libmng go into suspension mode with the returncode MNG_NEEDMOREDATA */ -/* mng_read_pushdata can be used to push blobs of data of arbitrary size; - mng_read_pushsig and mng_read_pushchunk can be used if the application - has already done some low-level decoding (eg. at the chunk level) */ -/* the data being pushed into libmng with mng_read_pushdata *must* contain - the regular 4-byte chunklength, but *must not* contain it with - mng_read_pushchunk!!! */ -/* mng_read_pushsig is used to prevent libmng from trying to parse the regular - PNG/JNG/MNG signature bytes; the application must have done this itself - and *must* indicate the proper type in the function call or things will - go amiss!! - also you *must* call this first, so pretty much right after mng_initialize - and certainly before any call to mng_read or mng_readdisplay !!!! */ -/* IMPORTANT!!! data can only be safely pushed when libmng is in a - "wait" state; eg. during MNG_NEEDTIMERWAIT, MNG_NEEDSECTIONWAIT or - MNG_NEEDMOREDATA !!! this just means you can't have one thread displaying - and another thread pushing data !!! */ -/* if bOwnership = MNG_TRUE, libmng will retain the supplied pointer and - *will* expect the buffer to remain available until libmng is finished - with it; what happens then depends on whether or not you have set the - releasedata() callback; if this is set than the supplied buffer will - be returned through this callback and your application can take care of - cleaning it up, otherwise libmng will use its internal freeing mechanism - (which, depending on compile-options, will be the standard C free() call, - or the memfree() callback */ -/* if bOwnership = MNG_FALSE, libmng will just copy the data into its own - buffers and dispose of it in the normal way */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_read_pushdata (mng_handle hHandle, - mng_ptr pData, - mng_size_t iLength, - mng_bool bTakeownership); -MNG_EXT mng_retcode MNG_DECL mng_read_pushsig (mng_handle hHandle, - mng_imgtype eSigtype); -MNG_EXT mng_retcode MNG_DECL mng_read_pushchunk (mng_handle hHandle, - mng_ptr pChunk, - mng_size_t iLength, - mng_bool bTakeownership); -#endif - -/* high-level write & create functions */ -/* use this if you want to write a previously read Network Graphic or - if you want to create a new graphic and write it */ -/* to write a previously read graphic you must have defined MNG_STORE_CHUNKS */ -/* to create a new graphic you'll also need access to the chunks - (eg. #define MNG_ACCESS_CHUNKS !) */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_retcode MNG_DECL mng_write (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_create (mng_handle hHandle); -#endif - -/* high-level display functions */ -/* use these to display a previously read or created graphic or - to read & display a graphic simultaneously */ -/* mng_display_resume should be called after a timer-interval - expires that was set through the settimer-callback, after a - read suspension-break, or, to resume an animation after a call - to mng_display_freeze/mng_display_reset */ -/* mng_display_freeze thru mng_display_gotime can be used to influence - the display of an image, BUT ONLY if it has been completely read! */ -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_readdisplay (mng_handle hHandle); -#endif -MNG_EXT mng_retcode MNG_DECL mng_display (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_display_freeze (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_display_reset (mng_handle hHandle); -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -MNG_EXT mng_retcode MNG_DECL mng_display_goframe (mng_handle hHandle, - mng_uint32 iFramenr); -MNG_EXT mng_retcode MNG_DECL mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayernr); -MNG_EXT mng_retcode MNG_DECL mng_display_gotime (mng_handle hHandle, - mng_uint32 iPlaytime); -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* event processing function */ -/* this needs to be called by the app when dynamic MNG is enabled and - a specific event occurs in the user-interface */ -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) -MNG_EXT mng_retcode MNG_DECL mng_trapevent (mng_handle hHandle, - mng_uint8 iEventtype, - mng_int32 iX, - mng_int32 iY); -#endif - -/* error reporting function */ -/* use this if you need more detailed info on the last error */ -/* iExtra1 & iExtra2 may contain errorcodes from zlib, jpeg, etc... */ -/* zErrortext will only be filled if you #define MNG_ERROR_TELLTALE */ -MNG_EXT mng_retcode MNG_DECL mng_getlasterror (mng_handle hHandle, - mng_int8* iSeverity, - mng_chunkid* iChunkname, - mng_uint32* iChunkseq, - mng_int32* iExtra1, - mng_int32* iExtra2, - mng_pchar* zErrortext); - -/* ************************************************************************** */ -/* * * */ -/* * Callback set functions * */ -/* * * */ -/* ************************************************************************** */ - -/* memory callbacks */ -/* called to allocate and release internal datastructures */ -#ifndef MNG_INTERNAL_MEMMNGMT -MNG_EXT mng_retcode MNG_DECL mng_setcb_memalloc (mng_handle hHandle, - mng_memalloc fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_memfree (mng_handle hHandle, - mng_memfree fProc); -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* open- & close-stream callbacks */ -/* called to open & close streams for input or output */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -MNG_EXT mng_retcode MNG_DECL mng_setcb_openstream (mng_handle hHandle, - mng_openstream fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_closestream (mng_handle hHandle, - mng_closestream fProc); -#endif -#endif - -/* read callback */ -/* called to get data from the inputstream */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_setcb_readdata (mng_handle hHandle, - mng_readdata fProc); -#endif - -/* write callback */ -/* called to put data into the outputstream */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_retcode MNG_DECL mng_setcb_writedata (mng_handle hHandle, - mng_writedata fProc); -#endif - -/* error callback */ -/* called when an error occurs */ -/* the application can determine if the error is recoverable, - and may inform the library by setting specific returncodes */ -MNG_EXT mng_retcode MNG_DECL mng_setcb_errorproc (mng_handle hHandle, - mng_errorproc fProc); - -/* trace callback */ -/* called to show the currently executing function */ -#ifdef MNG_SUPPORT_TRACE -MNG_EXT mng_retcode MNG_DECL mng_setcb_traceproc (mng_handle hHandle, - mng_traceproc fProc); -#endif - -/* callbacks for read processing */ -/* processheader is called when all header information has been gathered - from the inputstream */ -/* processtext is called for every tEXt, zTXt and iTXt chunk in the - inputstream (iType=0 for tEXt, 1 for zTXt and 2 for iTXt); - you can call get_imagelevel to check at what nesting-level the chunk is - encountered (eg. tEXt inside an embedded image inside a MNG -> level == 2; - in most other case -> level == 1) */ -/* processsave & processseek are called for SAVE/SEEK chunks */ -/* processneed is called for the nEED chunk; you should specify a callback - for this as the default behavior will be to abort processing, unless - the requirement is one of: - - a supported chunk - - the text "draft nn" where nn is a numeric value - - the text "MNG-1.0" or "MNG-1.1" - - the text "CACHEOFF" */ -/* processmend is called at the very end of the animation-stream; - note that this may not be the end of the animation though! */ -/* processterm is called when a TERM chunk is encountered; there can be only - 1 in the stream (or none) */ -/* processunknown is called after reading each non-critical unknown chunk */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_setcb_processheader (mng_handle hHandle, - mng_processheader fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processtext (mng_handle hHandle, - mng_processtext fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processsave (mng_handle hHandle, - mng_processsave fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processseek (mng_handle hHandle, - mng_processseek fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle, - mng_processneed fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processmend (mng_handle hHandle, - mng_processmend fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processterm (mng_handle hHandle, - mng_processterm fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processunknown(mng_handle hHandle, - mng_processunknown fProc); -#endif - -/* callbacks for display processing */ -/* getcanvasline is called to get an access-pointer to a line on the - drawing-canvas */ -/* getbkgdline is called to get an access-pointer to a line from the - background-canvas */ -/* refresh is called to inform the GUI to redraw the current canvas onto - its output device (eg. in Win32 this would mean sending an - invalidate message for the specified region */ -/* NOTE that the update-region is specified as x,y,width,height; eg. the - invalidate message for Windows requires left,top,right,bottom parameters - where the bottom-right is exclusive of the region!! - to get these correctly is as simple as: - left = x; - top = y; - right = x + width; - bottom = y + height; - if your implementation requires inclusive points, simply subtract 1 from - both the right & bottom values calculated above. - */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_retcode MNG_DECL mng_setcb_getcanvasline (mng_handle hHandle, - mng_getcanvasline fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_getbkgdline (mng_handle hHandle, - mng_getbkgdline fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_getalphaline (mng_handle hHandle, - mng_getalphaline fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_refresh (mng_handle hHandle, - mng_refresh fProc); - -/* timing callbacks */ -/* gettickcount is called to get the system tickcount (milliseconds); - this is used to determine the remaining interval between frames */ -/* settimer is called to inform the application that it should set a timer; - when the timer is triggered the app must call mng_display_resume */ -MNG_EXT mng_retcode MNG_DECL mng_setcb_gettickcount (mng_handle hHandle, - mng_gettickcount fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_settimer (mng_handle hHandle, - mng_settimer fProc); - -/* color management callbacks */ -/* called to transmit color management information to the application */ -/* these are only used when you #define MNG_APP_CMS */ -#ifdef MNG_APP_CMS -MNG_EXT mng_retcode MNG_DECL mng_setcb_processgamma (mng_handle hHandle, - mng_processgamma fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processchroma (mng_handle hHandle, - mng_processchroma fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processsrgb (mng_handle hHandle, - mng_processsrgb fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processiccp (mng_handle hHandle, - mng_processiccp fProc); -MNG_EXT mng_retcode MNG_DECL mng_setcb_processarow (mng_handle hHandle, - mng_processarow fProc); -#endif /* MNG_APP_CMS */ -#endif /* MNG_SUPPORT_DISPLAY */ - -/* release push data callback */ -/* used when the app pushes data into libmng (as opposed to libmng pulling it) - and relinquishes ownership of the pushed data-buffer, but *does* want to - release (free) the buffer itself once libmng has finished processing it */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_retcode MNG_DECL mng_setcb_releasedata (mng_handle hHandle, - mng_releasedata fProc); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Callback get functions * */ -/* * * */ -/* ************************************************************************** */ - -/* see _setcb_ */ -#ifndef MNG_INTERNAL_MEMMNGMT -MNG_EXT mng_memalloc MNG_DECL mng_getcb_memalloc (mng_handle hHandle); -MNG_EXT mng_memfree MNG_DECL mng_getcb_memfree (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_releasedata MNG_DECL mng_getcb_releasedata (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_WRITE_SUPPORT) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -MNG_EXT mng_openstream MNG_DECL mng_getcb_openstream (mng_handle hHandle); -MNG_EXT mng_closestream MNG_DECL mng_getcb_closestream (mng_handle hHandle); -#endif -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_readdata MNG_DECL mng_getcb_readdata (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_writedata MNG_DECL mng_getcb_writedata (mng_handle hHandle); -#endif - -/* see _setcb_ */ -MNG_EXT mng_errorproc MNG_DECL mng_getcb_errorproc (mng_handle hHandle); - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_TRACE -MNG_EXT mng_traceproc MNG_DECL mng_getcb_traceproc (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_processheader MNG_DECL mng_getcb_processheader (mng_handle hHandle); -MNG_EXT mng_processtext MNG_DECL mng_getcb_processtext (mng_handle hHandle); -MNG_EXT mng_processsave MNG_DECL mng_getcb_processsave (mng_handle hHandle); -MNG_EXT mng_processseek MNG_DECL mng_getcb_processseek (mng_handle hHandle); -MNG_EXT mng_processneed MNG_DECL mng_getcb_processneed (mng_handle hHandle); -MNG_EXT mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle); -MNG_EXT mng_processterm MNG_DECL mng_getcb_processterm (mng_handle hHandle); -#endif - -/* see _setcb_ */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_getcanvasline MNG_DECL mng_getcb_getcanvasline (mng_handle hHandle); -MNG_EXT mng_getbkgdline MNG_DECL mng_getcb_getbkgdline (mng_handle hHandle); -MNG_EXT mng_getalphaline MNG_DECL mng_getcb_getalphaline (mng_handle hHandle); -MNG_EXT mng_refresh MNG_DECL mng_getcb_refresh (mng_handle hHandle); - -/* see _setcb_ */ -MNG_EXT mng_gettickcount MNG_DECL mng_getcb_gettickcount (mng_handle hHandle); -MNG_EXT mng_settimer MNG_DECL mng_getcb_settimer (mng_handle hHandle); - -/* see _setcb_ */ -#ifdef MNG_APP_CMS -MNG_EXT mng_processgamma MNG_DECL mng_getcb_processgamma (mng_handle hHandle); -MNG_EXT mng_processchroma MNG_DECL mng_getcb_processchroma (mng_handle hHandle); -MNG_EXT mng_processsrgb MNG_DECL mng_getcb_processsrgb (mng_handle hHandle); -MNG_EXT mng_processiccp MNG_DECL mng_getcb_processiccp (mng_handle hHandle); -MNG_EXT mng_processarow MNG_DECL mng_getcb_processarow (mng_handle hHandle); -#endif /* MNG_APP_CMS */ -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ -/* * * */ -/* * Property set functions * */ -/* * * */ -/* ************************************************************************** */ - -/* Application data pointer */ -/* provided for application use; not used by the library */ -MNG_EXT mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle, - mng_ptr pUserdata); - -/* The style of the drawing- & background-canvas */ -/* only used for displaying images */ -/* both are initially set to 24-bit RGB (eg. 8-bit per channel) */ -MNG_EXT mng_retcode MNG_DECL mng_set_canvasstyle (mng_handle hHandle, - mng_uint32 iStyle); -MNG_EXT mng_retcode MNG_DECL mng_set_bkgdstyle (mng_handle hHandle, - mng_uint32 iStyle); - -/* The default background color */ -/* only used if the getbkgdline callback is not defined */ -/* for initially painting the canvas and restoring (part of) the background */ -MNG_EXT mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue); - -/* Indicates preferred use of the bKGD chunk for PNG images */ -MNG_EXT mng_retcode MNG_DECL mng_set_usebkgd (mng_handle hHandle, - mng_bool bUseBKGD); - -/* Indicates storage of read chunks */ -/* only useful if you #define mng_store_chunks */ -/* can be used to dynamically change storage management */ -MNG_EXT mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle, - mng_bool bStorechunks); - -/* Indicates breaks requested when processing SAVE/SEEK */ -/* set this to let the app handle section breaks; the library will return - MNG_NEEDSECTIONWAIT return-codes for each SEEK chunk */ -MNG_EXT mng_retcode MNG_DECL mng_set_sectionbreaks (mng_handle hHandle, - mng_bool bSectionbreaks); - -/* Indicates storage of playback info (ON by default!) */ -/* can be used to turn off caching of playback info; this is useful to - specifically optimize MNG-video playback; note that if caching is turned off - LOOP chunks will be flagged as errors! TERM chunks will be ignored and only - passed to the processterm() callback if it is defined by the app; also, this - feature can only be used with mng_readdisplay(); mng_read(), - mng_display_reset() and mng_display_goxxxx() will return an error; - once this option is turned off it can't be turned on for the same stream!!! */ -MNG_EXT mng_retcode MNG_DECL mng_set_cacheplayback (mng_handle hHandle, - mng_bool bCacheplayback); - -/* Indicates automatic progressive refreshes for large images (ON by default!) */ -/* turn this off if you do not want intermittent painting while a large image - is being read. useful if the input-stream comes from a fast medium, such - as a local harddisk */ -MNG_EXT mng_retcode MNG_DECL mng_set_doprogressive (mng_handle hHandle, - mng_bool bDoProgressive); - -/* Indicates existence and required checking of the CRC in input streams, - and generation in output streams */ -/* !!!! Use this ONLY if you know what you are doing !!!! */ -/* The value is a combination of the following flags: - 0x0000001 = CRC is present in the input stream - 0x0000002 = CRC must be generated in the output stream - 0x0000010 = CRC should be checked for ancillary chunks - 0x0000020 = a faulty CRC for ancillary chunks generates a warning only - 0x0000040 = a faulty CRC for ancillary chunks generates an error - 0x0000100 = CRC should be checked for critical chunks - 0x0000200 = a faulty CRC for critical chunks generates a warning only - 0x0000400 = a faulty CRC for critical chunks generates an error - - The default is 0x00000533 = CRC present in input streams; should be checked; - warning for ancillary chunks; error for critical - chunks; generate CRC for output streams - - Note that some combinations are meaningless; eg. if the CRC is not present - it won't do any good to turn the checking flags on; if a checking flag - is off, it doesn't do any good to ask for generation of warnings or errors. - Also libmng will generate either an error or a warning, not both, - so if you specify both the default will be to generate an error! - The only useful combinations for input are 331, 551, 351, 531, 0, 301, 501 - and optionally 031 and 051, but only checking ancillary chunks and not - critical chunks is generally not a very good idea!!! - If you've also writing these values should be combined with 0x02 if - CRC's are required in the output stream - */ -MNG_EXT mng_retcode MNG_DECL mng_set_crcmode (mng_handle hHandle, - mng_uint32 iCrcmode); - -/* Color-management necessaries */ -/* - ************************************************************************* - !!!!!!!! THIS NEXT BIT IS IMPORTANT !!!!!!!!! - ************************************************************************* - - If you have defined MNG_FULL_CMS (and are using lcms), you will have to - think hard about the following routines. - - lcms requires 2 profiles to work off the differences in the input-image - and the output-device. The ICC profile for the input-image will be - embedded within it to reflect its color-characteristics, but the output - profile depends on the output-device, which is something only *YOU* know - about. sRGB (standard RGB) is common for x86 compatible environments - (eg. Windows, Linux and some others) - - If you are compiling for a sRGB compliant system you probably won't have - to do anything special. (unless you want to of course) - - If you are compiling for a non-sRGB compliant system - (eg. SGI, Mac, Next, others...) - you *MUST* define a proper ICC profile for the generic output-device - associated with that platform. - - In either event, you may also want to offer an option to your users to - set the profile manually, or, if you know how, set it from a - system-defined default. - - TO RECAP: for sRGB systems (Windows, Linux) no action required! - for non-sRGB systems (SGI, Mac, Next) ACTION REQUIRED! - - Please visit http://www.srgb.com, http://www.color.org and - http://www.littlecms.com for more info. - - ************************************************************************* - !!!!!!!! THE BIT ABOVE IS IMPORTANT !!!!!!!!! - ************************************************************************* -*/ -/* mng_set_srgb tells libmng if it's running on a sRGB compliant system or not - the default is already set to MNG_TRUE */ -/* mng_set_outputprofile, mng_set_outputprofile2, mng_set_outputsrgb - are used to set the default profile describing the output-device - by default it is already initialized with an sRGB profile */ -/* mng_set_srgbprofile, mng_set_srgbprofile2, mng_set_srgbimplicit - are used to set the default profile describing a standard sRGB device - this is used when the input-image is tagged only as being sRGB, but the - output-device is defined as not being sRGB compliant - by default it is already initialized with a standard sRGB profile */ -#if defined(MNG_SUPPORT_DISPLAY) -MNG_EXT mng_retcode MNG_DECL mng_set_srgb (mng_handle hHandle, - mng_bool bIssRGB); -MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile (mng_handle hHandle, - mng_pchar zFilename); -MNG_EXT mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile); -MNG_EXT mng_retcode MNG_DECL mng_set_outputsrgb (mng_handle hHandle); -MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle, - mng_pchar zFilename); -MNG_EXT mng_retcode MNG_DECL mng_set_srgbprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile); -MNG_EXT mng_retcode MNG_DECL mng_set_srgbimplicit (mng_handle hHandle); -#endif - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -/* Gamma settings */ -/* ... blabla (explain gamma processing a little; eg. formula & stuff) ... */ -MNG_EXT mng_retcode MNG_DECL mng_set_viewgamma (mng_handle hHandle, - mng_float dGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_displaygamma (mng_handle hHandle, - mng_float dGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggamma (mng_handle hHandle, - mng_float dGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_viewgammaint (mng_handle hHandle, - mng_uint32 iGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_displaygammaint (mng_handle hHandle, - mng_uint32 iGamma); -MNG_EXT mng_retcode MNG_DECL mng_set_dfltimggammaint (mng_handle hHandle, - mng_uint32 iGamma); -#endif - -#ifndef MNG_SKIP_MAXCANVAS -/* Ultimate clipping size */ -/* used to limit extreme graphics from overloading the system */ -/* if a graphic exceeds these limits a warning is issued, which can - be ignored by the app (using the errorproc callback). in that case - the library will use these settings to clip the input graphic, and - the app's canvas must account for this */ -MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvaswidth (mng_handle hHandle, - mng_uint32 iMaxwidth); -MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvasheight (mng_handle hHandle, - mng_uint32 iMaxheight); -MNG_EXT mng_retcode MNG_DECL mng_set_maxcanvassize (mng_handle hHandle, - mng_uint32 iMaxwidth, - mng_uint32 iMaxheight); -#endif - -/* ZLIB default compression parameters */ -/* these are used when writing out chunks */ -/* they are also used when compressing PNG image-data or JNG alpha-data; - in this case you can set them just before calling mng_putimgdata_ihdr */ -/* set to your liking; usually the defaults will suffice though! */ -/* check the documentation for ZLIB for details on these parameters */ -#ifdef MNG_INCLUDE_ZLIB -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_level (mng_handle hHandle, - mng_int32 iZlevel); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_method (mng_handle hHandle, - mng_int32 iZmethod); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_windowbits (mng_handle hHandle, - mng_int32 iZwindowbits); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_memlevel (mng_handle hHandle, - mng_int32 iZmemlevel); -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_strategy (mng_handle hHandle, - mng_int32 iZstrategy); - -MNG_EXT mng_retcode MNG_DECL mng_set_zlib_maxidat (mng_handle hHandle, - mng_uint32 iMaxIDAT); -#endif /* MNG_INCLUDE_ZLIB */ - -/* JNG default compression parameters (based on IJG code) */ -/* these are used when compressing JNG image-data; so you can set them - just before calling mng_putimgdata_jhdr */ -/* set to your liking; usually the defaults will suffice though! */ -/* check the documentation for IJGSRC6B for details on these parameters */ -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_INCLUDE_IJG6B -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_dctmethod (mng_handle hHandle, - mngjpeg_dctmethod eJPEGdctmethod); -#endif -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_quality (mng_handle hHandle, - mng_int32 iJPEGquality); -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_smoothing (mng_handle hHandle, - mng_int32 iJPEGsmoothing); -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_progressive(mng_handle hHandle, - mng_bool bJPEGprogressive); -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_optimized (mng_handle hHandle, - mng_bool bJPEGoptimized); - -MNG_EXT mng_retcode MNG_DECL mng_set_jpeg_maxjdat (mng_handle hHandle, - mng_uint32 iMaxJDAT); -#endif /* MNG_INCLUDE_JNG */ - -/* Suspension-mode setting */ -/* use this to activate the internal suspension-buffer to improve - read-suspension processing */ -/* TODO: write-suspension ??? */ -#if defined(MNG_SUPPORT_READ) -MNG_EXT mng_retcode MNG_DECL mng_set_suspensionmode (mng_handle hHandle, - mng_bool bSuspensionmode); -#endif - -/* Speed setting */ -/* use this to influence the display-speed of animations */ -#if defined(MNG_SUPPORT_DISPLAY) -MNG_EXT mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle, - mng_speedtype iSpeed); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Property get functions * */ -/* * * */ -/* ************************************************************************** */ - -/* see _set_ */ -MNG_EXT mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle); - -/* Network Graphic header details */ -/* these get filled once the graphics header is processed, - so they are available in the processheader callback; before that - they are zeroed out and imagetype is set to it_unknown */ -/* this might be a good point for the app to initialize the drawing-canvas! */ -/* note that some fields are only set for the first(!) header-chunk: - MNG/MHDR (imagetype = mng_it_mng) - ticks thru simplicity - PNG/IHDR (imagetype = mng_it_png) - bitdepth thru interlace - JNG/JHDR (imagetype = mng_it_jng) - bitdepth thru compression & - interlace thru alphainterlace */ -MNG_EXT mng_imgtype MNG_DECL mng_get_sigtype (mng_handle hHandle); -MNG_EXT mng_imgtype MNG_DECL mng_get_imagetype (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_imagewidth (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_imageheight (mng_handle hHandle); - -MNG_EXT mng_uint32 MNG_DECL mng_get_ticks (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_framecount (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_layercount (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_playtime (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_simplicity (mng_handle hHandle); - -MNG_EXT mng_uint8 MNG_DECL mng_get_bitdepth (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_colortype (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_compression (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_filter (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_interlace (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphabitdepth (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphacompression(mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphafilter (mng_handle hHandle); -MNG_EXT mng_uint8 MNG_DECL mng_get_alphainterlace (mng_handle hHandle); - -/* indicates the predicted alpha-depth required to properly display the image */ -/* gets set once the graphics header is processed and is available in the - processheader callback for any type of input-image (PNG, JNG or MNG) */ -/* possible values are 0,1,2,4,8,16 - 0 = no transparency required - 1 = on/off transparency required (alpha-values are 0 or 2^bit_depth-1) - 2+ = semi-transparency required (values will be scaled to the bitdepth of the - canvasstyle supplied by the application) */ -MNG_EXT mng_uint8 MNG_DECL mng_get_alphadepth (mng_handle hHandle); - -/* defines whether a refresh() callback is called for an interlace pass (PNG) - or progressive scan (JNG) */ -/* returns the interlace pass number for PNG or a fabricated pass number for JNG; - returns 0 in all other cases */ -/* only useful if the image_type = mng_it_png or mng_it_jng and if the image - is actually interlaced (PNG) or progressive (JNG) */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_uint8 MNG_DECL mng_get_refreshpass (mng_handle hHandle); -#endif - -/* see _set_ */ -MNG_EXT mng_uint32 MNG_DECL mng_get_canvasstyle (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_bkgdstyle (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_retcode MNG_DECL mng_get_bgcolor (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_usebkgd (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_storechunks (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_sectionbreaks (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_cacheplayback (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_bool MNG_DECL mng_get_doprogressive (mng_handle hHandle); - -/* see _set_ */ -MNG_EXT mng_uint32 MNG_DECL mng_get_crcmode (mng_handle hHandle); - -/* see _set_ */ -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS) -MNG_EXT mng_bool MNG_DECL mng_get_srgb (mng_handle hHandle); -#endif - -/* see _set_ */ -MNG_EXT mng_float MNG_DECL mng_get_viewgamma (mng_handle hHandle); -MNG_EXT mng_float MNG_DECL mng_get_displaygamma (mng_handle hHandle); -MNG_EXT mng_float MNG_DECL mng_get_dfltimggamma (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_viewgammaint (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_displaygammaint (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_dfltimggammaint (mng_handle hHandle); - -#ifndef MNG_SKIP_MAXCANVAS -/* see _set_ */ -MNG_EXT mng_uint32 MNG_DECL mng_get_maxcanvaswidth (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_maxcanvasheight (mng_handle hHandle); -#endif - -/* see _set_ */ -#ifdef MNG_INCLUDE_ZLIB -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_level (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_method (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_windowbits (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_memlevel (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_zlib_strategy (mng_handle hHandle); - -MNG_EXT mng_uint32 MNG_DECL mng_get_zlib_maxidat (mng_handle hHandle); -#endif /* MNG_INCLUDE_ZLIB */ - -/* see _set_ */ -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_INCLUDE_IJG6B -MNG_EXT mngjpeg_dctmethod - MNG_DECL mng_get_jpeg_dctmethod (mng_handle hHandle); -#endif -MNG_EXT mng_int32 MNG_DECL mng_get_jpeg_quality (mng_handle hHandle); -MNG_EXT mng_int32 MNG_DECL mng_get_jpeg_smoothing (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_get_jpeg_progressive(mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_get_jpeg_optimized (mng_handle hHandle); - -MNG_EXT mng_uint32 MNG_DECL mng_get_jpeg_maxjdat (mng_handle hHandle); -#endif /* MNG_INCLUDE_JNG */ - -/* see _set_ */ -#if defined(MNG_SUPPORT_READ) -MNG_EXT mng_bool MNG_DECL mng_get_suspensionmode (mng_handle hHandle); -#endif - -/* see _set_ */ -#if defined(MNG_SUPPORT_DISPLAY) -MNG_EXT mng_speedtype - MNG_DECL mng_get_speed (mng_handle hHandle); -#endif - -/* Image-level */ -/* this can be used inside the processtext callback to determine the level of - text of the image being processed; the value 1 is returned for top-level - texts, and the value 2 for a text inside an embedded image inside a MNG */ -MNG_EXT mng_uint32 MNG_DECL mng_get_imagelevel (mng_handle hHandle); - -/* BACK info */ -/* can be used to retrieve the color & mandatory values for the last processed - BACK chunk of a MNG (will fail for other image-types); - if no BACK chunk was processed yet, it will return all zeroes */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_retcode MNG_DECL mng_get_lastbackchunk (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue, - mng_uint8* iMandatory); -#endif - -/* SEEK info */ -/* can be used to retrieve the segmentname of the last processed SEEK chunk; - if no SEEK chunk was processed or its segmentname was empty, the function - will return an empty string; the provided buffer must be at least 80 bytes!! */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_retcode MNG_DECL mng_get_lastseekname (mng_handle hHandle, - mng_pchar zSegmentname); -#endif - -/* FRAM info */ -/* can be used to retrieve the current FRAM delay; this may be useful when - retrieving a stream of frames with their corresponding delays by "fake" - reading and displaying the file */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_uint32 MNG_DECL mng_get_currframdelay (mng_handle hHandle); -#endif - -/* Display status variables */ -/* these get filled & updated during display processing */ -/* starttime is the tickcount at the start of displaying the animation */ -/* runtime is the actual number of millisecs since the start of the animation */ -/* currentframe, currentlayer & currentplaytime indicate the current - frame/layer/playtime(msecs) in the animation (these keep increasing; - even after the animation loops back to the TERM chunk) */ -/* totalframes, totallayers & totalplaytime are filled after a complete run - of an animation (eg. at MEND); they are also valid after just reading the MNG */ -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_uint32 MNG_DECL mng_get_starttime (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_runtime (mng_handle hHandle); -#ifndef MNG_NO_CURRENT_INFO -MNG_EXT mng_uint32 MNG_DECL mng_get_currentframe (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_currentlayer (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_currentplaytime (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_totalframes (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_totallayers (mng_handle hHandle); -MNG_EXT mng_uint32 MNG_DECL mng_get_totalplaytime (mng_handle hHandle); -#endif -#endif - -/* Status variables */ -/* these indicate the internal state of the library */ -/* most indicate exactly what you would expect - - status_error: true if the last function call returned an errorcode - status_reading: true if the library is (still) reading an image - status_suspendbreak: true if the library has suspended for "I/O" - status_creating: true if the library is in the middle of creating an image - status_writing: true if the library is in the middle of writing an image - status_displaying: true if the library is displaying an image - status_running: true if display processing is active (eg. not frozen or reset) - status_timerbreak: true if the library has suspended for a "timer-break" - status_dynamic: true if the library encountered an evNT chunk in the MNG - status_runningevent: true if the library is processing an external event */ -/* eg. mng_readdisplay() will turn the reading, displaying and running status on; - when EOF is reached the reading status will be turned off */ -MNG_EXT mng_bool MNG_DECL mng_status_error (mng_handle hHandle); -#ifdef MNG_SUPPORT_READ -MNG_EXT mng_bool MNG_DECL mng_status_reading (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_suspendbreak (mng_handle hHandle); -#endif -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_bool MNG_DECL mng_status_creating (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_writing (mng_handle hHandle); -#endif -#ifdef MNG_SUPPORT_DISPLAY -MNG_EXT mng_bool MNG_DECL mng_status_displaying (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_running (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_timerbreak (mng_handle hHandle); -#endif -#ifdef MNG_SUPPORT_DYNAMICMNG -MNG_EXT mng_bool MNG_DECL mng_status_dynamic (mng_handle hHandle); -MNG_EXT mng_bool MNG_DECL mng_status_runningevent (mng_handle hHandle); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Chunk access functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_ACCESS_CHUNKS - -/* ************************************************************************** */ - -/* use this to iterate the stored chunks */ -/* requires MNG_ACCESS_CHUNKS & MNG_STORE_CHUNKS */ -/* starts from the supplied chunk-index-nr; the first chunk has index 0!! */ -MNG_EXT mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle, - mng_uint32 iChunkseq, - mng_iteratechunk fProc); - -/* use the next function inside your 'iteratechunk' callback to copy - the given chunk to a new mng you are creating */ -/* the 'out' handle should be in 'create' status! */ -#ifdef MNG_SUPPORT_WRITE -MNG_EXT mng_retcode MNG_DECL mng_copy_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_handle hHandleOut); -#endif - -/* ************************************************************************** */ - -/* use these to get chunk data from within the callback in iterate_chunks */ -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_palette8 *aPalette); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_bool *bGlobal, - mng_uint8 *iType, - mng_uint32 *iCount, - mng_uint8arr *aAlphas, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint32 *iRawlen, - mng_uint8arr *aRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iGamma); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iWhitepointx, - mng_uint32 *iWhitepointy, - mng_uint32 *iRedx, - mng_uint32 *iRedy, - mng_uint32 *iGreenx, - mng_uint32 *iGreeny, - mng_uint32 *iBluex, - mng_uint32 *iBluey); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iRenderingintent); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iCompression, - mng_uint32 *iProfilesize, - mng_ptr *pProfile); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint32 *iTextsize, - mng_pchar *zText); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompression, - mng_uint32 *iTextsize, - mng_pchar *zText); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompressionflag, - mng_uint8 *iCompressionmethod, - mng_uint32 *iLanguagesize, - mng_pchar *zLanguage, - mng_uint32 *iTranslationsize, - mng_pchar *zTranslation, - mng_uint32 *iTextsize, - mng_pchar *zText); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8 *iIndex, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8arr4 *aBits); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iSampledepth, - mng_uint32 *iEntrycount, - mng_ptr *pEntries); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iEntrycount, - mng_uint16arr *aEntries); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iYear, - mng_uint8 *iMonth, - mng_uint8 *iDay, - mng_uint8 *iHour, - mng_uint8 *iMinute, - mng_uint8 *iSecond); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint32 *iTicks, - mng_uint32 *iLayercount, - mng_uint32 *iFramecount, - mng_uint32 *iPlaytime, - mng_uint32 *iSimplicity); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel, - mng_uint32 *iRepeat, - mng_uint8 *iTermination, - mng_uint32 *iItermin, - mng_uint32 *iItermax, - mng_uint32 *iCount, - mng_uint32p *pSignals); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_int32 *iXlocation, - mng_int32 *iYlocation, - mng_bool *bHasclip, - mng_int32 *iLeftcb, - mng_int32 *iRightcb, - mng_int32 *iTopcb, - mng_int32 *iBottomcb); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_uint8 *iViewable); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSourceid, - mng_uint16 *iCloneid, - mng_uint8 *iClonetype, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_uint8 *iLocationtype, - mng_int32 *iLocationx, - mng_int32 *iLocationy); - -#ifndef MNG_SKIPCHUNK_PAST -MNG_EXT mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iDestid, - mng_uint8 *iTargettype, - mng_int32 *iTargetx, - mng_int32 *iTargety, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iSourceid, - mng_uint8 *iComposition, - mng_uint8 *iOrientation, - mng_uint8 *iOffsettype, - mng_int32 *iOffsetx, - mng_int32 *iOffsety, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_uint16p *pObjectids); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint8 *iMandatory, - mng_uint16 *iImageid, - mng_uint8 *iTile); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iMode, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iChangedelay, - mng_uint8 *iChangetimeout, - mng_uint8 *iChangeclipping, - mng_uint8 *iChangesyncid, - mng_uint32 *iDelay, - mng_uint32 *iTimeout, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb, - mng_uint32 *iCount, - mng_uint32p *pSyncids); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMovetype, - mng_int32 *iMovex, - mng_int32 *iMovey); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iCliptype, - mng_int32 *iClipl, - mng_int32 *iClipr, - mng_int32 *iClipt, - mng_int32 *iClipb); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMode); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iTermaction, - mng_uint8 *iIteraction, - mng_uint32 *iDelay, - mng_uint32 *iItermax); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iOffsettype, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEntrytype, - mng_uint32arr2 *iOffset, - mng_uint32arr2 *iStarttime, - mng_uint32 *iLayernr, - mng_uint32 *iFramenr, - mng_uint32 *iNamesize, - mng_pchar *zName); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iNamesize, - mng_pchar *zName); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSnapshotid, - mng_uint32 *iNamesize, - mng_pchar *zName); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint8 *iPriority); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iColortype, - mng_uint8 *iImagesampledepth, - mng_uint8 *iImagecompression, - mng_uint8 *iImageinterlace, - mng_uint8 *iAlphasampledepth, - mng_uint8 *iAlphacompression, - mng_uint8 *iAlphafilter, - mng_uint8 *iAlphainterlace); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_jdaa (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iImagetype, - mng_uint8 *iDeltatype, - mng_uint32 *iBlockwidth, - mng_uint32 *iBlockheight, - mng_uint32 *iBlockx, - mng_uint32 *iBlocky); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iColortype, - mng_uint8 *iSampledepth, - mng_uint8 *iFilltype); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_bool *bUsed); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_chunkidp *pChunknames); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint8 *iPolarity, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_chunkid *iChunkname, - mng_uint8 *iOrdertype); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint16 *iMethodX, - mng_uint16 *iMX, - mng_uint16 *iMY, - mng_uint16 *iML, - mng_uint16 *iMR, - mng_uint16 *iMT, - mng_uint16 *iMB, - mng_uint16 *iMethodY); - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iFramewidth, - mng_uint32 *iFrameheight, - mng_uint16 *iNumplays, - mng_uint16 *iTickspersec, - mng_uint8 *iCompressionmethod, - mng_uint32 *iCount); -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng_frame (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint32 *iX, - mng_uint32 *iY, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_int32 *iXoffset, - mng_int32 *iYoffset, - mng_uint16 *iTicks); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_evnt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_evnt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEventtype, - mng_uint8 *iMasktype, - mng_int32 *iLeft, - mng_int32 *iRight, - mng_int32 *iTop, - mng_int32 *iBottom, - mng_uint16 *iObjectid, - mng_uint8 *iIndex, - mng_uint32 *iSegmentnamesize, - mng_pchar *zSegmentname); - -MNG_EXT mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint32 *iRawlen, - mng_ptr *pRawdata); - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* use these to create new chunks at the end of the chunk-list */ -/* requires at least MNG_ACCESS_CHUNKS (MNG_SUPPORT_WRITE may be nice too) */ -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle, - mng_uint32 iCount, - mng_palette8 aPalette); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle, - mng_bool bEmpty, - mng_bool bGlobal, - mng_uint8 iType, - mng_uint32 iCount, - mng_uint8arr aAlphas, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint32 iRawlen, - mng_uint8arr aRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iGamma); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iRenderingintent); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iCompression, - mng_uint32 iProfilesize, - mng_ptr pProfile); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint32 iTextsize, - mng_pchar zText); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompression, - mng_uint32 iTextsize, - mng_pchar zText); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompressionflag, - mng_uint8 iCompressionmethod, - mng_uint32 iLanguagesize, - mng_pchar zLanguage, - mng_uint32 iTranslationsize, - mng_pchar zTranslation, - mng_uint32 iTextsize, - mng_pchar zText); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8 iIndex, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8arr4 aBits); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iSampledepth, - mng_uint32 iEntrycount, - mng_ptr pEntries); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle, - mng_uint32 iEntrycount, - mng_uint16arr aEntries); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle, - mng_uint16 iYear, - mng_uint8 iMonth, - mng_uint8 iDay, - mng_uint8 iHour, - mng_uint8 iMinute, - mng_uint8 iSecond); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint32 iTicks, - mng_uint32 iLayercount, - mng_uint32 iFramecount, - mng_uint32 iPlaytime, - mng_uint32 iSimplicity); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle, - mng_uint8 iLevel, - mng_uint32 iRepeat, - mng_uint8 iTermination, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle, - mng_uint8 iLevel); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_int32 iXlocation, - mng_int32 iYlocation, - mng_bool bHasclip, - mng_int32 iLeftcb, - mng_int32 iRightcb, - mng_int32 iTopcb, - mng_int32 iBottomcb); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha, - mng_uint8 iViewable); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy); - -#ifndef MNG_SKIPCHUNK_PAST -MNG_EXT mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle, - mng_uint16 iDestid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iSourceid, - mng_uint8 iComposition, - mng_uint8 iOrientation, - mng_uint8 iOffsettype, - mng_int32 iOffsetx, - mng_int32 iOffsety, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle, - mng_uint32 iCount, - mng_uint16p pObjectids); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iMode, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iChangedelay, - mng_uint8 iChangetimeout, - mng_uint8 iChangeclipping, - mng_uint8 iChangesyncid, - mng_uint32 iDelay, - mng_uint32 iTimeout, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb, - mng_uint32 iCount, - mng_uint32p pSyncids); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle, - mng_bool bEmpty, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iOffsettype, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEntrytype, - mng_uint32arr2 iOffset, - mng_uint32arr2 iStarttime, - mng_uint32 iLayernr, - mng_uint32 iFramenr, - mng_uint32 iNamesize, - mng_pchar zName); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle, - mng_uint32 iNamesize, - mng_pchar zName); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle, - mng_uint16 iSnapshotid, - mng_uint32 iNamesize, - mng_pchar zName); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint8 iPriority); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle, - mng_uint32 iKeywordssize, - mng_pchar zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iImagesampledepth, - mng_uint8 iImagecompression, - mng_uint8 iImageinterlace, - mng_uint8 iAlphasampledepth, - mng_uint8 iAlphacompression, - mng_uint8 iAlphafilter, - mng_uint8 iAlphainterlace); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jdaa (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle, - mng_uint8 iColortype, - mng_uint8 iSampledepth, - mng_uint8 iFilltype); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_jpng (mng_handle hHandle); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle, - mng_uint32 iCount, - mng_chunkidp pChunknames); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint8 iPolarity, - mng_uint32 iKeywordssize, - mng_pchar zKeywords); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_chunkid iChunkname, - mng_uint8 iOrdertype); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint16 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint16 iMethodY); - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng (mng_handle hHandle, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint8 iCompressionmethod, - mng_uint32 iCount); -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng_frame (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_int32 iXoffset, - mng_int32 iYoffset, - mng_uint16 iTicks); -#endif - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_evnt (mng_handle hHandle, - mng_uint32 iCount); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_evnt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname); - -MNG_EXT mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint32 iRawlen, - mng_ptr pRawdata); - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -/* use these functions to access the actual image-data in stored chunks, - as opposed to the IDAT/JDAT data */ -/* to get accurate pixel-data the canvasstyle should seriously reflect the - bitdepth/colortype combination of the preceding IHDR/JHDR/BASI/DHDR; - all input can be converted to rgb(a)8 (rgb(a)16 for 16-bit images), but - there are only limited conversions back (see below for putimgdata) */ - -/* call this function if you want to extract the nth image from the list; - the first image is designated seqnr 0! */ -/* this function finds the IHDR/JHDR/BASI/DHDR with the appropriate seqnr, - starting from the beginning of the chunk-list; this may tend to get a little - slow for animations with a large number of chunks for images near the end */ -/* supplying a seqnr past the last image in the animation will return with - an errorcode */ -MNG_EXT mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* both the following functions will search forward to find the first IDAT/JDAT, - and then traverse back to find the start of the image (IHDR,JHDR,DHDR,BASI); - note that this is very fast compared to decoding the IDAT/JDAT, so there's - not really a need for optimization; either can be called from the - iterate_chunks callback when a IHDR/JHDR is encountered; for BASI/DHDR there - may not be real image-data so it's wisest to keep iterating till the IEND, - and then call either of these functions if necessary (remember the correct seqnr!) */ - -/* call this function if you want to extract the image starting at or after the nth - position in the chunk-list; this number is returned in the iterate_chunks callback */ -MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* call this function if you want to extract the image starting at or after the - indicated chunk; the handle of a chunk is returned in the iterate_chunks callback */ -MNG_EXT mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* use the following functions to add image-data to the list of stored chunks */ -/* note that this only adds the IDAT or JDAT chunks and no others; you must call - one of these functions after you 'put' the initial chunks of the image and - before you 'put' the closing chunks */ -/* the canvasstyle should seriously reflect the bitdepth/colortype combination; - eg. bitdepth=16 would expect a 16-bit canvasstyle, - colortype=g or ga would expect a gray or gray+alpha style respectively - and so on, and so forth ... - (nb. the number of conversions will be extremely limited for the moment!) */ - -MNG_EXT mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -MNG_EXT mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iInterlace, - mng_uint8 iAlphaBitdepth, - mng_uint8 iAlphaCompression, - mng_uint8 iAlphaFilter, - mng_uint8 iAlphaInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline); - -/* ************************************************************************** */ - -/* use the following functions to set the framecount/layercount/playtime or - simplicity of an animation you are creating; this may be useful if these - variables are calculated during the creation-process */ - -MNG_EXT mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle, - mng_uint32 iFramecount, - mng_uint32 iLayercount, - mng_uint32 iPlaytime); - -MNG_EXT mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle, - mng_uint32 iSimplicity); - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -#endif /* MNG_ACCESS_CHUNKS */ - -/* ************************************************************************** */ -/* * * */ -/* * Error-code structure * */ -/* * * */ -/* * 0b0000 00xx xxxx xxxx - basic errors; severity 9 (environment) * */ -/* * 0b0000 01xx xxxx xxxx - chunk errors; severity 9 (image induced) * */ -/* * 0b0000 10xx xxxx xxxx - severity 5 errors (application induced) * */ -/* * 0b0001 00xx xxxx xxxx - severity 2 warnings (recoverable) * */ -/* * 0b0010 00xx xxxx xxxx - severity 1 warnings (recoverable) * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_NOERROR (mng_retcode)0 /* er.. indicates all's well */ - -#define MNG_OUTOFMEMORY (mng_retcode)1 /* oops, buy some megabytes! */ -#define MNG_INVALIDHANDLE (mng_retcode)2 /* call mng_initialize first */ -#define MNG_NOCALLBACK (mng_retcode)3 /* set the callbacks please */ -#define MNG_UNEXPECTEDEOF (mng_retcode)4 /* what'd ya do with the data? */ -#define MNG_ZLIBERROR (mng_retcode)5 /* zlib burped */ -#define MNG_JPEGERROR (mng_retcode)6 /* jpglib complained */ -#define MNG_LCMSERROR (mng_retcode)7 /* little cms stressed out */ -#define MNG_NOOUTPUTPROFILE (mng_retcode)8 /* no output-profile defined */ -#define MNG_NOSRGBPROFILE (mng_retcode)9 /* no sRGB-profile defined */ -#define MNG_BUFOVERFLOW (mng_retcode)10 /* zlib output-buffer overflow */ -#define MNG_FUNCTIONINVALID (mng_retcode)11 /* ay, totally inappropriate */ -#define MNG_OUTPUTERROR (mng_retcode)12 /* disk full ? */ -#define MNG_JPEGBUFTOOSMALL (mng_retcode)13 /* can't handle buffer overflow*/ -#define MNG_NEEDMOREDATA (mng_retcode)14 /* I'm hungry, give me more */ -#define MNG_NEEDTIMERWAIT (mng_retcode)15 /* Sleep a while then wake me */ -#define MNG_NEEDSECTIONWAIT (mng_retcode)16 /* just processed a SEEK */ -#define MNG_LOOPWITHCACHEOFF (mng_retcode)17 /* LOOP when playback info off */ - -#define MNG_DLLNOTLOADED (mng_retcode)99 /* late binding failed */ - -#define MNG_APPIOERROR (mng_retcode)901 /* application I/O error */ -#define MNG_APPTIMERERROR (mng_retcode)902 /* application timing error */ -#define MNG_APPCMSERROR (mng_retcode)903 /* application CMS error */ -#define MNG_APPMISCERROR (mng_retcode)904 /* application other error */ -#define MNG_APPTRACEABORT (mng_retcode)905 /* application aborts on trace */ - -#define MNG_INTERNALERROR (mng_retcode)999 /* internal inconsistancy */ - -#define MNG_INVALIDSIG (mng_retcode)1025 /* invalid graphics file */ -#define MNG_INVALIDCRC (mng_retcode)1027 /* crc check failed */ -#define MNG_INVALIDLENGTH (mng_retcode)1028 /* chunklength mystifies me */ -#define MNG_SEQUENCEERROR (mng_retcode)1029 /* invalid chunk sequence */ -#define MNG_CHUNKNOTALLOWED (mng_retcode)1030 /* completely out-of-place */ -#define MNG_MULTIPLEERROR (mng_retcode)1031 /* only one occurence allowed */ -#define MNG_PLTEMISSING (mng_retcode)1032 /* indexed-color requires PLTE */ -#define MNG_IDATMISSING (mng_retcode)1033 /* IHDR-block requires IDAT */ -#define MNG_CANNOTBEEMPTY (mng_retcode)1034 /* must contain some data */ -#define MNG_GLOBALLENGTHERR (mng_retcode)1035 /* global data incorrect */ -#define MNG_INVALIDBITDEPTH (mng_retcode)1036 /* bitdepth out-of-range */ -#define MNG_INVALIDCOLORTYPE (mng_retcode)1037 /* colortype out-of-range */ -#define MNG_INVALIDCOMPRESS (mng_retcode)1038 /* compression method invalid */ -#define MNG_INVALIDFILTER (mng_retcode)1039 /* filter method invalid */ -#define MNG_INVALIDINTERLACE (mng_retcode)1040 /* interlace method invalid */ -#define MNG_NOTENOUGHIDAT (mng_retcode)1041 /* ran out of compressed data */ -#define MNG_PLTEINDEXERROR (mng_retcode)1042 /* palette-index out-of-range */ -#define MNG_NULLNOTFOUND (mng_retcode)1043 /* couldn't find null-separator*/ -#define MNG_KEYWORDNULL (mng_retcode)1044 /* keyword cannot be empty */ -#define MNG_OBJECTUNKNOWN (mng_retcode)1045 /* the object can't be found */ -#define MNG_OBJECTEXISTS (mng_retcode)1046 /* the object already exists */ -#define MNG_TOOMUCHIDAT (mng_retcode)1047 /* got too much compressed data*/ -#define MNG_INVSAMPLEDEPTH (mng_retcode)1048 /* sampledepth out-of-range */ -#define MNG_INVOFFSETSIZE (mng_retcode)1049 /* invalid offset-size */ -#define MNG_INVENTRYTYPE (mng_retcode)1050 /* invalid entry-type */ -#define MNG_ENDWITHNULL (mng_retcode)1051 /* may not end with NULL */ -#define MNG_INVIMAGETYPE (mng_retcode)1052 /* invalid image_type */ -#define MNG_INVDELTATYPE (mng_retcode)1053 /* invalid delta_type */ -#define MNG_INVALIDINDEX (mng_retcode)1054 /* index-value invalid */ -#define MNG_TOOMUCHJDAT (mng_retcode)1055 /* got too much compressed data*/ -#define MNG_JPEGPARMSERR (mng_retcode)1056 /* JHDR/JPEG parms do not match*/ -#define MNG_INVFILLMETHOD (mng_retcode)1057 /* invalid fill_method */ -#define MNG_OBJNOTCONCRETE (mng_retcode)1058 /* object must be concrete */ -#define MNG_TARGETNOALPHA (mng_retcode)1059 /* object has no alpha-channel */ -#define MNG_MNGTOOCOMPLEX (mng_retcode)1060 /* can't handle complexity */ -#define MNG_UNKNOWNCRITICAL (mng_retcode)1061 /* unknown critical chunk found*/ -#define MNG_UNSUPPORTEDNEED (mng_retcode)1062 /* nEED requirement unsupported*/ -#define MNG_INVALIDDELTA (mng_retcode)1063 /* Delta operation illegal */ -#define MNG_INVALIDMETHOD (mng_retcode)1064 /* invalid MAGN method */ -#define MNG_IMPROBABLELENGTH (mng_retcode)1065 /* impropable chunk length */ -#define MNG_INVALIDBLOCK (mng_retcode)1066 /* invalid delta block */ -#define MNG_INVALIDEVENT (mng_retcode)1067 /* invalid event_type */ -#define MNG_INVALIDMASK (mng_retcode)1068 /* invalid mask_type */ -#define MNG_NOMATCHINGLOOP (mng_retcode)1069 /* ENDL without matching LOOP */ -#define MNG_SEEKNOTFOUND (mng_retcode)1070 /* EvNT points to unknown SEEK */ -#define MNG_OBJNOTABSTRACT (mng_retcode)1071 /* object must be abstract */ -#define MNG_TERMSEQERROR (mng_retcode)1072 /* TERM in wrong place */ -#define MNG_INVALIDFIELDVAL (mng_retcode)1073 /* invalid fieldvalue (generic)*/ -#define MNG_INVALIDWIDTH (mng_retcode)1074 /* invalid frame/image width */ -#define MNG_INVALIDHEIGHT (mng_retcode)1075 /* invalid frame/image height */ - -#define MNG_INVALIDCNVSTYLE (mng_retcode)2049 /* can't make anything of this */ -#define MNG_WRONGCHUNK (mng_retcode)2050 /* accessing the wrong chunk */ -#define MNG_INVALIDENTRYIX (mng_retcode)2051 /* accessing the wrong entry */ -#define MNG_NOHEADER (mng_retcode)2052 /* must have had header first */ -#define MNG_NOCORRCHUNK (mng_retcode)2053 /* can't find parent chunk */ -#define MNG_NOMHDR (mng_retcode)2054 /* no MNG header available */ - -#define MNG_IMAGETOOLARGE (mng_retcode)4097 /* input-image way too big */ -#define MNG_NOTANANIMATION (mng_retcode)4098 /* file not a MNG */ -#define MNG_FRAMENRTOOHIGH (mng_retcode)4099 /* frame-nr out-of-range */ -#define MNG_LAYERNRTOOHIGH (mng_retcode)4100 /* layer-nr out-of-range */ -#define MNG_PLAYTIMETOOHIGH (mng_retcode)4101 /* playtime out-of-range */ -#define MNG_FNNOTIMPLEMENTED (mng_retcode)4102 /* function not yet available */ - -#define MNG_IMAGEFROZEN (mng_retcode)8193 /* stopped displaying */ - -#define MNG_LCMS_NOHANDLE 1 /* LCMS returned NULL handle */ -#define MNG_LCMS_NOMEM 2 /* LCMS returned NULL gammatab */ -#define MNG_LCMS_NOTRANS 3 /* LCMS returned NULL transform*/ - -/* ************************************************************************** */ -/* * * */ -/* * Canvas styles * */ -/* * * */ -/* * Note that the intentions are pretty darn good, but that the focus * */ -/* * is currently on 8-bit color support * */ -/* * * */ -/* * The RGB8_A8 style is defined for apps that require a separate * */ -/* * canvas for the color-planes and the alpha-plane (eg. mozilla) * */ -/* * This requires for the app to supply the "getalphaline" callback!!! * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_CANVAS_RGB8 0x00000000L -#define MNG_CANVAS_RGBA8 0x00001000L -#define MNG_CANVAS_RGBA8_PM 0x00009000L -#define MNG_CANVAS_ARGB8 0x00003000L -#define MNG_CANVAS_ARGB8_PM 0x0000B000L -#define MNG_CANVAS_RGB8_A8 0x00005000L -#define MNG_CANVAS_BGR8 0x00000001L -#define MNG_CANVAS_BGRX8 0x00010001L -#define MNG_CANVAS_BGRA8 0x00001001L -#define MNG_CANVAS_BGRA8PM 0x00009001L /* backward compatibility */ -#define MNG_CANVAS_BGRA8_PM 0x00009001L -#define MNG_CANVAS_ABGR8 0x00003001L -#define MNG_CANVAS_ABGR8_PM 0x0000B001L -#define MNG_CANVAS_RGB16 0x00000100L /* not supported yet */ -#define MNG_CANVAS_RGBA16 0x00001100L /* not supported yet */ -#define MNG_CANVAS_ARGB16 0x00003100L /* not supported yet */ -#define MNG_CANVAS_BGR16 0x00000101L /* not supported yet */ -#define MNG_CANVAS_BGRA16 0x00001101L /* not supported yet */ -#define MNG_CANVAS_ABGR16 0x00003101L /* not supported yet */ -#define MNG_CANVAS_GRAY8 0x00000002L /* not supported yet */ -#define MNG_CANVAS_GRAY16 0x00000102L /* not supported yet */ -#define MNG_CANVAS_GRAYA8 0x00001002L /* not supported yet */ -#define MNG_CANVAS_GRAYA16 0x00001102L /* not supported yet */ -#define MNG_CANVAS_AGRAY8 0x00003002L /* not supported yet */ -#define MNG_CANVAS_AGRAY16 0x00003102L /* not supported yet */ -#define MNG_CANVAS_DX15 0x00000003L /* not supported yet */ -#define MNG_CANVAS_DX16 0x00000004L /* not supported yet */ - -#define MNG_CANVAS_RGB565 0x00000005L -#define MNG_CANVAS_RGBA565 0x00001005L -#define MNG_CANVAS_BGR565 0x00000006L -#define MNG_CANVAS_BGRA565 0x00001006L -#define MNG_CANVAS_BGR565_A8 0x00004006L - -#define MNG_CANVAS_RGB555 0x00000007L -#define MNG_CANVAS_BGR555 0x00000008L - -#define MNG_CANVAS_PIXELTYPE(C) (C & 0x000000FFL) -#define MNG_CANVAS_BITDEPTH(C) (C & 0x00000100L) -#define MNG_CANVAS_HASALPHA(C) (C & 0x00001000L) -#define MNG_CANVAS_ALPHAFIRST(C) (C & 0x00002000L) -#define MNG_CANVAS_ALPHASEPD(C) (C & 0x00004000L) -#define MNG_CANVAS_ALPHAPM(C) (C & 0x00008000L) -#define MNG_CANVAS_HASFILLER(C) (C & 0x00010000L) - -#define MNG_CANVAS_RGB(C) (MNG_CANVAS_PIXELTYPE (C) == 0) -#define MNG_CANVAS_BGR(C) (MNG_CANVAS_PIXELTYPE (C) == 1) -#define MNG_CANVAS_GRAY(C) (MNG_CANVAS_PIXELTYPE (C) == 2) -#define MNG_CANVAS_DIRECTX15(C) (MNG_CANVAS_PIXELTYPE (C) == 3) -#define MNG_CANVAS_DIRECTX16(C) (MNG_CANVAS_PIXELTYPE (C) == 4) -#define MNG_CANVAS_RGB_565(C) (MNG_CANVAS_PIXELTYPE (C) == 5) -#define MNG_CANVAS_BGR_565(C) (MNG_CANVAS_PIXELTYPE (C) == 6) -#define MNG_CANVAS_8BIT(C) (!MNG_CANVAS_BITDEPTH (C)) -#define MNG_CANVAS_16BIT(C) (MNG_CANVAS_BITDEPTH (C)) -#define MNG_CANVAS_PIXELFIRST(C) (!MNG_CANVAS_ALPHAFIRST (C)) - -/* ************************************************************************** */ -/* * * */ -/* * Chunk names (idea adapted from libpng 1.1.0 - png.h) * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_UINT_HUH 0x40404040L - -#define MNG_UINT_BACK 0x4241434bL -#define MNG_UINT_BASI 0x42415349L -#define MNG_UINT_CLIP 0x434c4950L -#define MNG_UINT_CLON 0x434c4f4eL -#define MNG_UINT_DBYK 0x4442594bL -#define MNG_UINT_DEFI 0x44454649L -#define MNG_UINT_DHDR 0x44484452L -#define MNG_UINT_DISC 0x44495343L -#define MNG_UINT_DROP 0x44524f50L -#define MNG_UINT_ENDL 0x454e444cL -#define MNG_UINT_FRAM 0x4652414dL -#define MNG_UINT_IDAT 0x49444154L -#define MNG_UINT_IEND 0x49454e44L -#define MNG_UINT_IHDR 0x49484452L -#define MNG_UINT_IJNG 0x494a4e47L -#define MNG_UINT_IPNG 0x49504e47L -#define MNG_UINT_JDAA 0x4a444141L -#define MNG_UINT_JDAT 0x4a444154L -#define MNG_UINT_JHDR 0x4a484452L -#define MNG_UINT_JSEP 0x4a534550L -#define MNG_UINT_JdAA 0x4a644141L -#define MNG_UINT_LOOP 0x4c4f4f50L -#define MNG_UINT_MAGN 0x4d41474eL -#define MNG_UINT_MEND 0x4d454e44L -#define MNG_UINT_MHDR 0x4d484452L -#define MNG_UINT_MOVE 0x4d4f5645L -#define MNG_UINT_ORDR 0x4f524452L -#define MNG_UINT_PAST 0x50415354L -#define MNG_UINT_PLTE 0x504c5445L -#define MNG_UINT_PPLT 0x50504c54L -#define MNG_UINT_PROM 0x50524f4dL -#define MNG_UINT_SAVE 0x53415645L -#define MNG_UINT_SEEK 0x5345454bL -#define MNG_UINT_SHOW 0x53484f57L -#define MNG_UINT_TERM 0x5445524dL -#define MNG_UINT_adAT 0x61644154L -#define MNG_UINT_ahDR 0x61684452L -#define MNG_UINT_bKGD 0x624b4744L -#define MNG_UINT_cHRM 0x6348524dL -#define MNG_UINT_eXPI 0x65585049L -#define MNG_UINT_evNT 0x65764e54L -#define MNG_UINT_fPRI 0x66505249L -#define MNG_UINT_gAMA 0x67414d41L -#define MNG_UINT_hIST 0x68495354L -#define MNG_UINT_iCCP 0x69434350L -#define MNG_UINT_iTXt 0x69545874L -#define MNG_UINT_mpNG 0x6d704e47L -#define MNG_UINT_nEED 0x6e454544L -#define MNG_UINT_oFFs 0x6f464673L -#define MNG_UINT_pCAL 0x7043414cL -#define MNG_UINT_pHYg 0x70444167L -#define MNG_UINT_pHYs 0x70485973L -#define MNG_UINT_sBIT 0x73424954L -#define MNG_UINT_sCAL 0x7343414cL -#define MNG_UINT_sPLT 0x73504c54L -#define MNG_UINT_sRGB 0x73524742L -#define MNG_UINT_tEXt 0x74455874L -#define MNG_UINT_tIME 0x74494d45L -#define MNG_UINT_tRNS 0x74524e53L -#define MNG_UINT_zTXt 0x7a545874L - -/* ************************************************************************** */ -/* * * */ -/* * Chunk property values * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_BITDEPTH_1 1 /* IHDR, BASI, JHDR, PROM */ -#define MNG_BITDEPTH_2 2 -#define MNG_BITDEPTH_4 4 -#define MNG_BITDEPTH_8 8 /* sPLT */ -#define MNG_BITDEPTH_16 16 - -#define MNG_COLORTYPE_GRAY 0 /* IHDR, BASI, PROM */ -#define MNG_COLORTYPE_RGB 2 -#define MNG_COLORTYPE_INDEXED 3 -#define MNG_COLORTYPE_GRAYA 4 -#define MNG_COLORTYPE_RGBA 6 - -#define MNG_COMPRESSION_DEFLATE 0 /* IHDR, zTXt, iTXt, iCCP, - BASI, JHDR */ - -#define MNG_FILTER_ADAPTIVE 0 /* IHDR, BASI, JHDR */ -/* #define MNG_FILTER_NO_ADAPTIVE 1 -#define MNG_FILTER_NO_DIFFERING 0 -#define MNG_FILTER_DIFFERING 0x40 -#define MNG_FILTER_MASK (MNG_FILTER_NO_ADAPTIVE | MNG_FILTER_DIFFERING) */ -#ifdef FILTER192 -#define MNG_FILTER_DIFFERING 0xC0 -#endif -#ifdef FILTER193 -#define MNG_FILTER_NOFILTER 0xC1 -#endif - -#define MNG_INTERLACE_NONE 0 /* IHDR, BASI, JHDR */ -#define MNG_INTERLACE_ADAM7 1 - -#define MNG_FILTER_NONE 0 /* IDAT */ -#define MNG_FILTER_SUB 1 -#define MNG_FILTER_UP 2 -#define MNG_FILTER_AVERAGE 3 -#define MNG_FILTER_PAETH 4 - -#define MNG_INTENT_PERCEPTUAL 0 /* sRGB */ -#define MNG_INTENT_RELATIVECOLORIMETRIC 1 -#define MNG_INTENT_SATURATION 2 -#define MNG_INTENT_ABSOLUTECOLORIMETRIC 3 - /* tEXt, zTXt, iTXt */ -#define MNG_TEXT_TITLE "Title" -#define MNG_TEXT_AUTHOR "Author" -#define MNG_TEXT_DESCRIPTION "Description" -#define MNG_TEXT_COPYRIGHT "Copyright" -#define MNG_TEXT_CREATIONTIME "Creation Time" -#define MNG_TEXT_SOFTWARE "Software" -#define MNG_TEXT_DISCLAIMER "Disclaimer" -#define MNG_TEXT_WARNING "Warning" -#define MNG_TEXT_SOURCE "Source" -#define MNG_TEXT_COMMENT "Comment" - -#define MNG_FLAG_UNCOMPRESSED 0 /* iTXt */ -#define MNG_FLAG_COMPRESSED 1 - -#define MNG_UNIT_UNKNOWN 0 /* pHYs, pHYg */ -#define MNG_UNIT_METER 1 - /* MHDR */ -#define MNG_SIMPLICITY_VALID 0x00000001 -#define MNG_SIMPLICITY_SIMPLEFEATURES 0x00000002 -#define MNG_SIMPLICITY_COMPLEXFEATURES 0x00000004 -#define MNG_SIMPLICITY_TRANSPARENCY 0x00000008 -#define MNG_SIMPLICITY_JNG 0x00000010 -#define MNG_SIMPLICITY_DELTAPNG 0x00000020 - -#define MNG_TERMINATION_DECODER_NC 0 /* LOOP */ -#define MNG_TERMINATION_USER_NC 1 -#define MNG_TERMINATION_EXTERNAL_NC 2 -#define MNG_TERMINATION_DETERMINISTIC_NC 3 -#define MNG_TERMINATION_DECODER_C 4 -#define MNG_TERMINATION_USER_C 5 -#define MNG_TERMINATION_EXTERNAL_C 6 -#define MNG_TERMINATION_DETERMINISTIC_C 7 - -#define MNG_DONOTSHOW_VISIBLE 0 /* DEFI */ -#define MNG_DONOTSHOW_NOTVISIBLE 1 - -#define MNG_ABSTRACT 0 /* DEFI */ -#define MNG_CONCRETE 1 - -#define MNG_NOTVIEWABLE 0 /* BASI */ -#define MNG_VIEWABLE 1 - -#define MNG_FULL_CLONE 0 /* CLON */ -#define MNG_PARTIAL_CLONE 1 -#define MNG_RENUMBER 2 - -#define MNG_CONCRETE_ASPARENT 0 /* CLON */ -#define MNG_CONCRETE_MAKEABSTRACT 1 - -#define MNG_LOCATION_ABSOLUTE 0 /* CLON, MOVE */ -#define MNG_LOCATION_RELATIVE 1 - -#ifndef MNG_SKIPCHUNK_PAST -#define MNG_TARGET_ABSOLUTE 0 /* PAST */ -#define MNG_TARGET_RELATIVE_SAMEPAST 1 -#define MNG_TARGET_RELATIVE_PREVPAST 2 - -#define MNG_COMPOSITE_OVER 0 /* PAST */ -#define MNG_COMPOSITE_REPLACE 1 -#define MNG_COMPOSITE_UNDER 2 - -#define MNG_ORIENTATION_SAME 0 /* PAST */ -#define MNG_ORIENTATION_180DEG 2 -#define MNG_ORIENTATION_FLIPHORZ 4 -#define MNG_ORIENTATION_FLIPVERT 6 -#define MNG_ORIENTATION_TILED 8 - -#define MNG_OFFSET_ABSOLUTE 0 /* PAST */ -#define MNG_OFFSET_RELATIVE 1 -#endif - -#define MNG_BOUNDARY_ABSOLUTE 0 /* PAST, FRAM */ -#define MNG_BOUNDARY_RELATIVE 1 - -#define MNG_BACKGROUNDCOLOR_MANDATORY 0x01 /* BACK */ -#define MNG_BACKGROUNDIMAGE_MANDATORY 0x02 /* BACK */ - -#define MNG_BACKGROUNDIMAGE_NOTILE 0 /* BACK */ -#define MNG_BACKGROUNDIMAGE_TILE 1 - -#define MNG_FRAMINGMODE_NOCHANGE 0 /* FRAM */ -#define MNG_FRAMINGMODE_1 1 -#define MNG_FRAMINGMODE_2 2 -#define MNG_FRAMINGMODE_3 3 -#define MNG_FRAMINGMODE_4 4 - -#define MNG_CHANGEDELAY_NO 0 /* FRAM */ -#define MNG_CHANGEDELAY_NEXTSUBFRAME 1 -#define MNG_CHANGEDELAY_DEFAULT 2 - -#define MNG_CHANGETIMOUT_NO 0 /* FRAM */ -#define MNG_CHANGETIMOUT_DETERMINISTIC_1 1 -#define MNG_CHANGETIMOUT_DETERMINISTIC_2 2 -#define MNG_CHANGETIMOUT_DECODER_1 3 -#define MNG_CHANGETIMOUT_DECODER_2 4 -#define MNG_CHANGETIMOUT_USER_1 5 -#define MNG_CHANGETIMOUT_USER_2 6 -#define MNG_CHANGETIMOUT_EXTERNAL_1 7 -#define MNG_CHANGETIMOUT_EXTERNAL_2 8 - -#define MNG_CHANGECLIPPING_NO 0 /* FRAM */ -#define MNG_CHANGECLIPPING_NEXTSUBFRAME 1 -#define MNG_CHANGECLIPPING_DEFAULT 2 - -#define MNG_CHANGESYNCID_NO 0 /* FRAM */ -#define MNG_CHANGESYNCID_NEXTSUBFRAME 1 -#define MNG_CHANGESYNCID_DEFAULT 2 - -#define MNG_CLIPPING_ABSOLUTE 0 /* CLIP */ -#define MNG_CLIPPING_RELATIVE 1 - -#define MNG_SHOWMODE_0 0 /* SHOW */ -#define MNG_SHOWMODE_1 1 -#define MNG_SHOWMODE_2 2 -#define MNG_SHOWMODE_3 3 -#define MNG_SHOWMODE_4 4 -#define MNG_SHOWMODE_5 5 -#define MNG_SHOWMODE_6 6 -#define MNG_SHOWMODE_7 7 - -#define MNG_TERMACTION_LASTFRAME 0 /* TERM */ -#define MNG_TERMACTION_CLEAR 1 -#define MNG_TERMACTION_FIRSTFRAME 2 -#define MNG_TERMACTION_REPEAT 3 - -#define MNG_ITERACTION_LASTFRAME 0 /* TERM */ -#define MNG_ITERACTION_CLEAR 1 -#define MNG_ITERACTION_FIRSTFRAME 2 - -#define MNG_SAVEOFFSET_4BYTE 4 /* SAVE */ -#define MNG_SAVEOFFSET_8BYTE 8 - -#define MNG_SAVEENTRY_SEGMENTFULL 0 /* SAVE */ -#define MNG_SAVEENTRY_SEGMENT 1 -#define MNG_SAVEENTRY_SUBFRAME 2 -#define MNG_SAVEENTRY_EXPORTEDIMAGE 3 - -#define MNG_PRIORITY_ABSOLUTE 0 /* fPRI */ -#define MNG_PRIORITY_RELATIVE 1 - -#ifdef MNG_INCLUDE_JNG -#define MNG_COLORTYPE_JPEGGRAY 8 /* JHDR */ -#define MNG_COLORTYPE_JPEGCOLOR 10 -#define MNG_COLORTYPE_JPEGGRAYA 12 -#define MNG_COLORTYPE_JPEGCOLORA 14 - -#define MNG_BITDEPTH_JPEG8 8 /* JHDR */ -#define MNG_BITDEPTH_JPEG12 12 -#define MNG_BITDEPTH_JPEG8AND12 20 - -#define MNG_COMPRESSION_BASELINEJPEG 8 /* JHDR */ - -#define MNG_INTERLACE_SEQUENTIAL 0 /* JHDR */ -#define MNG_INTERLACE_PROGRESSIVE 8 -#endif /* MNG_INCLUDE_JNG */ - -#define MNG_IMAGETYPE_UNKNOWN 0 /* DHDR */ -#define MNG_IMAGETYPE_PNG 1 -#define MNG_IMAGETYPE_JNG 2 - -#define MNG_DELTATYPE_REPLACE 0 /* DHDR */ -#define MNG_DELTATYPE_BLOCKPIXELADD 1 -#define MNG_DELTATYPE_BLOCKALPHAADD 2 -#define MNG_DELTATYPE_BLOCKCOLORADD 3 -#define MNG_DELTATYPE_BLOCKPIXELREPLACE 4 -#define MNG_DELTATYPE_BLOCKALPHAREPLACE 5 -#define MNG_DELTATYPE_BLOCKCOLORREPLACE 6 -#define MNG_DELTATYPE_NOCHANGE 7 - -#define MNG_FILLMETHOD_LEFTBITREPLICATE 0 /* PROM */ -#define MNG_FILLMETHOD_ZEROFILL 1 - -#define MNG_DELTATYPE_REPLACERGB 0 /* PPLT */ -#define MNG_DELTATYPE_DELTARGB 1 -#define MNG_DELTATYPE_REPLACEALPHA 2 -#define MNG_DELTATYPE_DELTAALPHA 3 -#define MNG_DELTATYPE_REPLACERGBA 4 -#define MNG_DELTATYPE_DELTARGBA 5 - -#define MNG_POLARITY_ONLY 0 /* DBYK */ -#define MNG_POLARITY_ALLBUT 1 - -#define MNG_EVENT_NONE 0 /* evNT */ -#define MNG_EVENT_MOUSEENTER 1 -#define MNG_EVENT_MOUSEMOVE 2 -#define MNG_EVENT_MOUSEEXIT 3 -#define MNG_EVENT_MOUSEDOWN 4 -#define MNG_EVENT_MOUSEUP 5 - -#define MNG_MASK_NONE 0 /* evNT */ -#define MNG_MASK_BOX 1 -#define MNG_MASK_OBJECT 2 -#define MNG_MASK_OBJECTIX 3 -#define MNG_MASK_BOXOBJECT 4 -#define MNG_MASK_BOXOBJECTIX 5 - -/* ************************************************************************** */ -/* * * */ -/* * Processtext callback types * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_TYPE_TEXT 0 -#define MNG_TYPE_ZTXT 1 -#define MNG_TYPE_ITXT 2 - -/* ************************************************************************** */ -/* * * */ -/* * CRC processing masks * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_CRC_INPUT 0x0000000f -#define MNG_CRC_INPUT_NONE 0x00000000 -#define MNG_CRC_INPUT_PRESENT 0x00000001 -#define MNG_CRC_OUTPUT 0x000000f0 -#define MNG_CRC_OUTPUT_NONE 0x00000000 -#define MNG_CRC_OUTPUT_GENERATE 0x00000020 -#define MNG_CRC_OUTPUT_DUMMY 0x00000040 -#define MNG_CRC_ANCILLARY 0x00000f00 -#define MNG_CRC_ANCILLARY_IGNORE 0x00000000 -#define MNG_CRC_ANCILLARY_DISCARD 0x00000100 -#define MNG_CRC_ANCILLARY_WARNING 0x00000200 -#define MNG_CRC_ANCILLARY_ERROR 0x00000300 -#define MNG_CRC_CRITICAL 0x0000f000 -#define MNG_CRC_CRITICAL_IGNORE 0x00000000 -#define MNG_CRC_CRITICAL_WARNING 0x00002000 -#define MNG_CRC_CRITICAL_ERROR 0x00003000 -#define MNG_CRC_DEFAULT 0x00002121 - -/* ************************************************************************** */ - -#ifdef __cplusplus -} -#endif - -#endif /* _libmng_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_callback_xs.c b/Engine/lib/lmng/libmng_callback_xs.c deleted file mode 100644 index ff1a22a70..000000000 --- a/Engine/lib/lmng/libmng_callback_xs.c +++ /dev/null @@ -1,1239 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_callback_xs.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : callback get/set interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the callback get/set functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - fixed calling convention * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contribution by Tim Rowley) * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added processterm callback * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - added SKIPCHUNK feature * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * 1.0.7 - 03/19/2004 - G.R-P * */ -/* * - fixed typo (MNG_SKIPCHUNK_SAVE -> MNG_SKIPCHUNK_nEED * */ -/* * * */ -/* * 1.0.8 - 04/10/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 09/18/2004 - G.R-P. * */ -/* * - added two SKIPCHUNK_TERM conditionals * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Callback set functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_retcode MNG_DECL mng_setcb_memalloc (mng_handle hHandle, - mng_memalloc fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMALLOC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fMemalloc = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMALLOC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_retcode MNG_DECL mng_setcb_memfree (mng_handle hHandle, - mng_memfree fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMFREE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fMemfree = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_MEMFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_releasedata (mng_handle hHandle, - mng_releasedata fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_RELEASEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fReleasedata = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_RELEASEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_retcode MNG_DECL mng_setcb_openstream (mng_handle hHandle, - mng_openstream fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_OPENSTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fOpenstream = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_OPENSTREAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_retcode MNG_DECL mng_setcb_closestream (mng_handle hHandle, - mng_closestream fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_CLOSESTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fClosestream = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_CLOSESTREAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_readdata (mng_handle hHandle, - mng_readdata fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_READDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fReaddata = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_READDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_setcb_writedata (mng_handle hHandle, - mng_writedata fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_WRITEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fWritedata = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_WRITEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_setcb_errorproc (mng_handle hHandle, - mng_errorproc fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_ERRORPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fErrorproc = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_ERRORPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_TRACE -mng_retcode MNG_DECL mng_setcb_traceproc (mng_handle hHandle, - mng_traceproc fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_TRACEPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fTraceproc = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_TRACEPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_TRACE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_processheader (mng_handle hHandle, - mng_processheader fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSHEADER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessheader = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSHEADER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_tEXt -mng_retcode MNG_DECL mng_setcb_processtext (mng_handle hHandle, - mng_processtext fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesstext = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode MNG_DECL mng_setcb_processsave (mng_handle hHandle, - mng_processsave fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesssave = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode MNG_DECL mng_setcb_processseek (mng_handle hHandle, - mng_processseek fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessseek = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_nEED -mng_retcode MNG_DECL mng_setcb_processneed (mng_handle hHandle, - mng_processneed fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessneed = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSNEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_processmend (mng_handle hHandle, - mng_processmend fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessmend = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSMEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_setcb_processunknown (mng_handle hHandle, - mng_processunknown fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessunknown = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSUNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_TERM -mng_retcode MNG_DECL mng_setcb_processterm (mng_handle hHandle, - mng_processterm fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessterm = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSTERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_getcanvasline (mng_handle hHandle, - mng_getcanvasline fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETCANVASLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGetcanvasline = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETCANVASLINE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_getbkgdline (mng_handle hHandle, - mng_getbkgdline fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETBKGDLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGetbkgdline = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETBKGDLINE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_getalphaline (mng_handle hHandle, - mng_getalphaline fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETALPHALINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGetalphaline = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETALPHALINE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_refresh (mng_handle hHandle, - mng_refresh fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_REFRESH, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fRefresh = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_REFRESH, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_gettickcount (mng_handle hHandle, - mng_gettickcount fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETTICKCOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fGettickcount = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_GETTICKCOUNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_setcb_settimer (mng_handle hHandle, - mng_settimer fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_SETTIMER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fSettimer = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_SETTIMER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_setcb_processgamma (mng_handle hHandle, - mng_processgamma fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSGAMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessgamma = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSGAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode MNG_DECL mng_setcb_processchroma (mng_handle hHandle, - mng_processchroma fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSCHROMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesschroma = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSCHROMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_setcb_processsrgb (mng_handle hHandle, - mng_processsrgb fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcesssrgb = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSSRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_setcb_processiccp (mng_handle hHandle, - mng_processiccp fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessiccp = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_setcb_processarow (mng_handle hHandle, - mng_processarow fProc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSAROW, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->fProcessarow = fProc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SETCB_PROCESSAROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ -/* * * */ -/* * Callback get functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_memalloc MNG_DECL mng_getcb_memalloc (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMALLOC, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMALLOC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fMemalloc; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifndef MNG_INTERNAL_MEMMNGMT -mng_memfree MNG_DECL mng_getcb_memfree (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMFREE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_MEMFREE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fMemfree; -} -#endif /* MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_releasedata MNG_DECL mng_getcb_releasedata (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_RELEASEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_RELEASEDATA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fReleasedata; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_readdata MNG_DECL mng_getcb_readdata (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_READDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_READDATA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fReaddata; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_openstream MNG_DECL mng_getcb_openstream (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_OPENSTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_OPENSTREAM, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fOpenstream; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OPEN_CLOSE_STREAM -mng_closestream MNG_DECL mng_getcb_closestream (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_CLOSESTREAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_CLOSESTREAM, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fClosestream; -} -#endif -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_writedata MNG_DECL mng_getcb_writedata (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_WRITEDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_WRITEDATA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fWritedata; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -mng_errorproc MNG_DECL mng_getcb_errorproc (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_ERRORPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_ERRORPROC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fErrorproc; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_TRACE -mng_traceproc MNG_DECL mng_getcb_traceproc (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_TRACEPROC, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_TRACEPROC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fTraceproc; -} -#endif /* MNG_SUPPORT_TRACE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_processheader MNG_DECL mng_getcb_processheader (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSHEADER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSHEADER, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessheader; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_tEXt -mng_processtext MNG_DECL mng_getcb_processtext (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTEXT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesstext; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SAVE -mng_processsave MNG_DECL mng_getcb_processsave (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSAVE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesssave; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_SEEK -mng_processseek MNG_DECL mng_getcb_processseek (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSEEK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessseek; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_nEED -mng_processneed MNG_DECL mng_getcb_processneed (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSNEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSNEED, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessneed; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_processmend MNG_DECL mng_getcb_processmend (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSMEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSMEND, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessmend; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_processunknown MNG_DECL mng_getcb_processunknown (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSUNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSUNKNOWN, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessunknown; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -#ifndef MNG_SKIPCHUNK_TERM -mng_processterm MNG_DECL mng_getcb_processterm (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSTERM, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessterm; -} -#endif -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_getcanvasline MNG_DECL mng_getcb_getcanvasline (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETCANVASLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETCANVASLINE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGetcanvasline; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_getbkgdline MNG_DECL mng_getcb_getbkgdline (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETBKGDLINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETBKGDLINE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGetbkgdline; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_getalphaline MNG_DECL mng_getcb_getalphaline (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETALPHALINE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETALPHALINE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGetalphaline; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_refresh MNG_DECL mng_getcb_refresh (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_REFRESH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_REFRESH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fRefresh; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_gettickcount MNG_DECL mng_getcb_gettickcount (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETTICKCOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_GETTICKCOUNT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fGettickcount; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_settimer MNG_DECL mng_getcb_settimer (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_SETTIMER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_SETTIMER, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fSettimer; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_processgamma MNG_DECL mng_getcb_processgamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessgamma; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_cHRM -mng_processchroma MNG_DECL mng_getcb_processchroma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSCHROMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSCHROMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesschroma; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_processsrgb MNG_DECL mng_getcb_processsrgb (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSSRGB, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcesssrgb; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -#ifndef MNG_SKIPCHUNK_iCCP -mng_processiccp MNG_DECL mng_getcb_processiccp (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSICCP, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessiccp; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_APP_CMS) -mng_processarow MNG_DECL mng_getcb_processarow (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSAROW, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GETCB_PROCESSAROW, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->fProcessarow; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_APP_CMS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_chunk_descr.c b/Engine/lib/lmng/libmng_chunk_descr.c deleted file mode 100644 index e1004a540..000000000 --- a/Engine/lib/lmng/libmng_chunk_descr.c +++ /dev/null @@ -1,6090 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_descr.c copyright (c) 2005-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk descriptor functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the chunk- anf field-descriptor * */ -/* * routines * */ -/* * * */ -/* * changes : 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - made all constants 'static' * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * 1.0.9 - 01/17/2005 - G.Juyn * */ -/* * - fixed problem with global PLTE/tRNS * */ -/* * * */ -/* * 1.0.10 - 01/17/2005 - G.R-P. * */ -/* * - added typecast to appease the compiler * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include /* needed for offsetof() */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_objects.h" -#include "libmng_chunks.h" -#include "libmng_chunk_descr.h" -#include "libmng_object_prc.h" -#include "libmng_chunk_prc.h" -#include "libmng_chunk_io.h" -#include "libmng_display.h" - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -#include "libmng_pixels.h" -#include "libmng_filter.h" -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER -#if defined(MNG_INCLUDE_READ_PROCS) || defined(MNG_INCLUDE_WRITE_PROCS) - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* PNG chunks */ - -MNG_LOCAL mng_field_descriptor mng_fields_ihdr [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_ihdr, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_ihdr, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 16, 1, 1, - offsetof(mng_ihdr, iBitdepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 6, 1, 1, - offsetof(mng_ihdr, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_ihdr, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_ihdr, iFilter), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_ihdr, iInterlace), MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_plte [] = - { - {mng_debunk_plte, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_idat [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 0, 0, - offsetof(mng_idat, pData), MNG_NULL, offsetof(mng_idat, iDatasize)} - }; - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_trns [] = - { - {mng_debunk_trns, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -MNG_LOCAL mng_field_descriptor mng_fields_gama [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_gama, iGamma), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -MNG_LOCAL mng_field_descriptor mng_fields_chrm [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iWhitepointx), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iWhitepointy), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iRedx), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iRedy), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iGreeny), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iGreeny), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iBluex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_chrm, iBluey), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -MNG_LOCAL mng_field_descriptor mng_fields_srgb [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 4, 1, 1, - offsetof(mng_srgb, iRenderingintent), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -MNG_LOCAL mng_field_descriptor mng_fields_iccp [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_iccp, zName), MNG_NULL, offsetof(mng_iccp, iNamesize)}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_iccp, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_DEFLATED, - 0, 0, 0, 0, - offsetof(mng_iccp, pProfile), MNG_NULL, offsetof(mng_iccp, iProfilesize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -MNG_LOCAL mng_field_descriptor mng_fields_text [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_text, zKeyword), MNG_NULL, offsetof(mng_text, iKeywordsize)}, - {MNG_NULL, - MNG_NULL, - 0, 0, 0, 0, - offsetof(mng_text, zText), MNG_NULL, offsetof(mng_text, iTextsize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -MNG_LOCAL mng_field_descriptor mng_fields_ztxt [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_ztxt, zKeyword), MNG_NULL, offsetof(mng_ztxt, iKeywordsize)}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_ztxt, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_DEFLATED, - 0, 0, 0, 0, - offsetof(mng_ztxt, zText), MNG_NULL, offsetof(mng_ztxt, iTextsize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_LOCAL mng_field_descriptor mng_fields_itxt [] = - { - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 1, 79, - offsetof(mng_itxt, zKeyword), MNG_NULL, offsetof(mng_itxt, iKeywordsize)}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_itxt, iCompressionflag), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_itxt, iCompressionmethod), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 0, 0, - offsetof(mng_itxt, zLanguage), MNG_NULL, offsetof(mng_itxt, iLanguagesize)}, - {MNG_NULL, - MNG_FIELD_TERMINATOR, - 0, 0, 0, 0, - offsetof(mng_itxt, zTranslation), MNG_NULL, offsetof(mng_itxt, iTranslationsize)}, - {mng_deflate_itxt, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -MNG_LOCAL mng_field_descriptor mng_fields_bkgd [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_PUTIMGTYPE, - 0, 0, 0, 0, - offsetof(mng_bkgd, iType), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE3, - 0, 0xFF, 1, 1, - offsetof(mng_bkgd, iIndex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE0 | MNG_FIELD_IFIMGTYPE4, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iGray), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iRed), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iGreen), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFFFF, 2, 2, - offsetof(mng_bkgd, iBlue), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -MNG_LOCAL mng_field_descriptor mng_fields_phys [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_phys, iSizex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_phys, iSizey), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_phys, iUnit), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -MNG_LOCAL mng_field_descriptor mng_fields_sbit [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_PUTIMGTYPE, - 0, 0, 0, 0, - offsetof(mng_sbit, iType), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPES, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[0]), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE3 | MNG_FIELD_IFIMGTYPE4 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[1]), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE2 | MNG_FIELD_IFIMGTYPE3 | MNG_FIELD_IFIMGTYPE6, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[2]), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_IFIMGTYPE6, - 0, 0xFF, 1, 1, - offsetof(mng_sbit, aBits[3]), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_LOCAL mng_field_descriptor mng_fields_splt [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 79, - offsetof(mng_splt, zName), MNG_NULL, offsetof(mng_splt, iNamesize)}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 16, 1, 1, - offsetof(mng_splt, iSampledepth), MNG_NULL, MNG_NULL}, - {mng_splt_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -MNG_LOCAL mng_field_descriptor mng_fields_hist [] = - { - {mng_hist_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -MNG_LOCAL mng_field_descriptor mng_fields_time [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_time, iYear), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 12, 1, 1, - offsetof(mng_time, iMonth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 31, 1, 1, - offsetof(mng_time, iDay), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 24, 1, 1, - offsetof(mng_time, iHour), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 60, 1, 1, - offsetof(mng_time, iMinute), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 60, 1, 1, - offsetof(mng_time, iSecond), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* JNG chunks */ - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_field_descriptor mng_fields_jhdr [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_jhdr, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_NOHIGHBIT, - 1, 0, 4, 4, - offsetof(mng_jhdr, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 16, 1, 1, - offsetof(mng_jhdr, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 20, 1, 1, - offsetof(mng_jhdr, iImagesampledepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 8, 8, 1, 1, - offsetof(mng_jhdr, iImagecompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 8, 1, 1, - offsetof(mng_jhdr, iImageinterlace), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 16, 1, 1, - offsetof(mng_jhdr, iAlphasampledepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 8, 1, 1, - offsetof(mng_jhdr, iAlphacompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_jhdr, iAlphafilter), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_jhdr, iAlphainterlace), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#define mng_fields_jdaa mng_fields_idat -#define mng_fields_jdat mng_fields_idat -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* MNG chunks */ - -MNG_LOCAL mng_field_descriptor mng_fields_mhdr [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iTicks), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iLayercount), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iFramecount), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iPlaytime), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_mhdr, iSimplicity), MNG_NULL, MNG_NULL} - }; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_LOCAL mng_field_descriptor mng_fields_loop [] = - { - {mng_debunk_loop, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_LOCAL mng_field_descriptor mng_fields_endl [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFF, 1, 1, - offsetof(mng_endl, iLevel), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -MNG_LOCAL mng_field_descriptor mng_fields_defi [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_defi, iObjectid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFF, 1, 1, - offsetof(mng_defi, iDonotshow), offsetof(mng_defi, bHasdonotshow), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFF, 1, 1, - offsetof(mng_defi, iConcrete), offsetof(mng_defi, bHasconcrete), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_defi, iXlocation), offsetof(mng_defi, bHasloca), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_defi, iYlocation), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iLeftcb), offsetof(mng_defi, bHasclip), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iRightcb), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iTopcb), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_defi, iBottomcb), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -MNG_LOCAL mng_field_descriptor mng_fields_basi [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_basi, iWidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_basi, iHeight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 16, 1, 1, - offsetof(mng_basi, iBitdepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 6, 1, 1, - offsetof(mng_basi, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_basi, iCompression), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_basi, iFilter), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_basi, iInterlace), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iRed), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iGreen), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iBlue), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFFFF, 2, 2, - offsetof(mng_basi, iAlpha), offsetof(mng_basi, bHasalpha), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_basi, iViewable), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -MNG_LOCAL mng_field_descriptor mng_fields_clon [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clon, iSourceid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clon, iCloneid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 2, 1, 1, - offsetof(mng_clon, iClonetype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_clon, iDonotshow), offsetof(mng_clon, bHasdonotshow), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_clon, iConcrete), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 2, 1, 1, - offsetof(mng_clon, iLocationtype), offsetof(mng_clon, bHasloca), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_clon, iLocationx), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_clon, iLocationy), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -MNG_LOCAL mng_field_descriptor mng_fields_past [] = - { - {mng_debunk_past, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -MNG_LOCAL mng_field_descriptor mng_fields_disc [] = - { - {mng_disc_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -MNG_LOCAL mng_field_descriptor mng_fields_back [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iRed), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iGreen), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iBlue), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 3, 1, 1, - offsetof(mng_back, iMandatory), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 0xFFFF, 2, 2, - offsetof(mng_back, iImageid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 1, 1, 1, - offsetof(mng_back, iTile), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_LOCAL mng_field_descriptor mng_fields_fram [] = - { - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 4, 1, 1, - offsetof(mng_fram, iMode), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_TERMINATOR | MNG_FIELD_OPTIONAL, - 0, 0, 1, 79, - offsetof(mng_fram, zName), MNG_NULL, offsetof(mng_fram, iNamesize)}, - {mng_fram_remainder, - MNG_FIELD_OPTIONAL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -MNG_LOCAL mng_field_descriptor mng_fields_move [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_move, iFirstid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_move, iLastid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_move, iMovetype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_move, iMovex), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_move, iMovey), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -MNG_LOCAL mng_field_descriptor mng_fields_clip [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clip, iFirstid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_clip, iLastid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_clip, iCliptype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipl), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipr), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipt), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_clip, iClipb), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -MNG_LOCAL mng_field_descriptor mng_fields_show [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 1, 0xFFFF, 2, 2, - offsetof(mng_show, iFirstid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 1, 0xFFFF, 2, 2, - offsetof(mng_show, iLastid), offsetof(mng_show, bHaslastid), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL, - 0, 7, 1, 1, - offsetof(mng_show, iMode), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -MNG_LOCAL mng_field_descriptor mng_fields_term [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 3, 1, 1, - offsetof(mng_term, iTermaction), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 2, 1, 1, - offsetof(mng_term, iIteraction), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_term, iDelay), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_term, iItermax), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_field_descriptor mng_fields_save [] = - { - {mng_save_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -MNG_LOCAL mng_field_descriptor mng_fields_seek [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 79, - offsetof(mng_seek, zName), MNG_NULL, offsetof(mng_seek, iNamesize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -MNG_LOCAL mng_field_descriptor mng_fields_expi [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_expi, iSnapshotid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 79, - offsetof(mng_expi, zName), MNG_NULL, offsetof(mng_expi, iNamesize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -MNG_LOCAL mng_field_descriptor mng_fields_fpri [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_fpri, iDeltatype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFF, 1, 1, - offsetof(mng_fpri, iPriority), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_field_descriptor mng_fields_need [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 0, - offsetof(mng_need, zKeywords), MNG_NULL, offsetof(mng_need, iKeywordssize)} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -#define mng_fields_phyg mng_fields_phys -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_dhdr [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_dhdr, iObjectid), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 2, 1, 1, - offsetof(mng_dhdr, iImagetype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 7, 1, 1, - offsetof(mng_dhdr, iDeltatype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlockwidth), offsetof(mng_dhdr, bHasblocksize), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP1, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlockheight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlockx), offsetof(mng_dhdr, bHasblockloc), MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT | MNG_FIELD_OPTIONAL | MNG_FIELD_GROUP2, - 0, 0, 4, 4, - offsetof(mng_dhdr, iBlocky), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_prom [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 14, 1, 1, - offsetof(mng_prom, iColortype), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 16, 1, 1, - offsetof(mng_prom, iSampledepth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_prom, iFilltype), MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_pplt [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 5, 1, 1, - offsetof(mng_pplt, iDeltatype), MNG_NULL, MNG_NULL}, - {mng_pplt_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_field_descriptor mng_fields_drop [] = - { - {mng_drop_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -MNG_LOCAL mng_field_descriptor mng_fields_dbyk [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_dbyk, iChunkname), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_dbyk, iPolarity), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 0, - offsetof(mng_dbyk, zKeywords), MNG_NULL, offsetof(mng_dbyk, iKeywordssize)} - }; -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_LOCAL mng_field_descriptor mng_fields_ordr [] = - { - {mng_drop_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_LOCAL mng_field_descriptor mng_fields_magn [] = - { - {mng_debunk_magn, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_LOCAL mng_field_descriptor mng_fields_mpng [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_mpng, iFramewidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_mpng, iFrameheight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0xFFFF, 2, 2, - offsetof(mng_mpng, iNumplays), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0xFFFF, 2, 2, - offsetof(mng_mpng, iTickspersec), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 1, 1, - offsetof(mng_mpng, iCompressionmethod), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_DEFLATED, - 0, 0, 1, 0, - offsetof(mng_mpng, pFrames), MNG_NULL, offsetof(mng_mpng, iFramessize)} - }; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_LOCAL mng_field_descriptor mng_fields_ahdr [] = - { - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_ahdr, iNumframes), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_ahdr, iTickspersec), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 0, 4, 4, - offsetof(mng_ahdr, iNumplays), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_ahdr, iTilewidth), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 1, 0, 4, 4, - offsetof(mng_ahdr, iTileheight), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_ahdr, iInterlace), MNG_NULL, MNG_NULL}, - {MNG_NULL, - MNG_FIELD_INT, - 0, 1, 1, 1, - offsetof(mng_ahdr, iStillused), MNG_NULL, MNG_NULL} - }; - -MNG_LOCAL mng_field_descriptor mng_fields_adat [] = - { - {mng_adat_tiles, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -MNG_LOCAL mng_field_descriptor mng_fields_evnt [] = - { - {mng_evnt_entries, - MNG_NULL, - 0, 0, 0, 0, - MNG_NULL, MNG_NULL, MNG_NULL} - }; -#endif - -/* ************************************************************************** */ - -MNG_LOCAL mng_field_descriptor mng_fields_unknown [] = - { - {MNG_NULL, - MNG_NULL, - 0, 0, 1, 0, - offsetof(mng_unknown_chunk, pData), MNG_NULL, offsetof(mng_unknown_chunk, iDatasize)} - }; - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* PNG chunks */ - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ihdr = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ihdr, - mng_fields_ihdr, (sizeof(mng_fields_ihdr) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_NULL, - MNG_DESCR_NOIHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOBASI | MNG_DESCR_NOIDAT | MNG_DESCR_NOPLTE}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_plte = - {mng_it_png, mng_create_none, 0, offsetof(mng_plte, bEmpty), - MNG_NULL, MNG_NULL, mng_special_plte, - mng_fields_plte, (sizeof(mng_fields_plte) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_idat = - {mng_it_png, mng_create_none, 0, offsetof(mng_idat, bEmpty), - MNG_NULL, MNG_NULL, mng_special_idat, - mng_fields_idat, (sizeof(mng_fields_idat) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_DESCR_NOJSEP}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_iend = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_iend, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_NULL}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_trns = - {mng_it_png, mng_create_none, 0, offsetof(mng_trns, bEmpty), - MNG_NULL, MNG_NULL, mng_special_trns, - mng_fields_trns, (sizeof(mng_fields_trns) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; - -#ifndef MNG_SKIPCHUNK_gAMA -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_gama = - {mng_it_png, mng_create_none, 0, offsetof(mng_gama, bEmpty), - MNG_NULL, MNG_NULL, mng_special_gama, - mng_fields_gama, (sizeof(mng_fields_gama) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_cHRM -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_chrm = - {mng_it_png, mng_create_none, 0, offsetof(mng_chrm, bEmpty), - MNG_NULL, MNG_NULL, mng_special_chrm, - mng_fields_chrm, (sizeof(mng_fields_chrm) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_sRGB -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_srgb = - {mng_it_png, mng_create_none, 0, offsetof(mng_srgb, bEmpty), - MNG_NULL, MNG_NULL, mng_special_srgb, - mng_fields_srgb, (sizeof(mng_fields_srgb) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_iCCP -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_iccp = - {mng_it_png, mng_create_none, 0, offsetof(mng_iccp, bEmpty), - MNG_NULL, MNG_NULL, mng_special_iccp, - mng_fields_iccp, (sizeof(mng_fields_iccp) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOPLTE | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_tEXt -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_text = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_text, - mng_fields_text, (sizeof(mng_fields_text) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -#ifndef MNG_SKIPCHUNK_zTXt -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ztxt = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ztxt, - mng_fields_ztxt, (sizeof(mng_fields_ztxt) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_itxt = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_itxt, - mng_fields_itxt, (sizeof(mng_fields_itxt) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_bkgd = - {mng_it_png, mng_create_none, 0, offsetof(mng_bkgd, bEmpty), - MNG_NULL, MNG_NULL, mng_special_bkgd, - mng_fields_bkgd, (sizeof(mng_fields_bkgd) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_pHYs -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_phys = - {mng_it_png, mng_create_none, 0, offsetof(mng_phys, bEmpty), - MNG_NULL, MNG_NULL, mng_special_phys, - mng_fields_phys, (sizeof(mng_fields_phys) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_sBIT -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_sbit = - {mng_it_png, mng_create_none, 0, offsetof(mng_sbit, bEmpty), - MNG_NULL, MNG_NULL, mng_special_sbit, - mng_fields_sbit, (sizeof(mng_fields_sbit) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_splt = - {mng_it_png, mng_create_none, 0, offsetof(mng_splt, bEmpty), - MNG_NULL, MNG_NULL, mng_special_splt, - mng_fields_splt, (sizeof(mng_fields_splt) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL | MNG_DESCR_EMPTYEMBED | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_GenHDR, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_hIST -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_hist = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_hist, - mng_fields_hist, (sizeof(mng_fields_hist) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_GenHDR | MNG_DESCR_PLTE, - MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT | MNG_DESCR_NOJDAA}; -#endif - -#ifndef MNG_SKIPCHUNK_tIME -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_time = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_time, - mng_fields_time, (sizeof(mng_fields_time) / sizeof(mng_field_descriptor)), - MNG_DESCR_GLOBAL, - MNG_DESCR_GenHDR, - MNG_NULL}; -#endif - -/* ************************************************************************** */ -/* JNG chunks */ - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jhdr = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jhdr, - mng_fields_jhdr, (sizeof(mng_fields_jhdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_NULL, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jdaa = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jdaa, - mng_fields_jdaa, (sizeof(mng_fields_jdaa) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_JngHDR, - MNG_DESCR_NOJSEP}; -#endif - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jdat = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jdat, - mng_fields_jdat, (sizeof(mng_fields_jdat) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTYEMBED, - MNG_DESCR_JngHDR, - MNG_NULL}; -#endif - -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_jsep = - {mng_it_jng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_jsep, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_JngHDR, - MNG_DESCR_NOJSEP}; -#endif - -/* ************************************************************************** */ -/* MNG chunks */ - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mhdr = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_mhdr, - mng_fields_mhdr, (sizeof(mng_fields_mhdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_NULL, - MNG_DESCR_NOMHDR | MNG_DESCR_NOIHDR | MNG_DESCR_NOJHDR}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mend = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_mend, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_NULL}; - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_loop = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_loop, - mng_fields_loop, (sizeof(mng_fields_loop) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_endl = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_endl, - mng_fields_endl, (sizeof(mng_fields_endl) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_DEFI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_defi = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_defi, - mng_fields_defi, (sizeof(mng_fields_defi) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_BASI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_basi = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_basi, - mng_fields_basi, (sizeof(mng_fields_basi) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_CLON -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_clon = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_clon, - mng_fields_clon, (sizeof(mng_fields_clon) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_PAST -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_past = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_past, - mng_fields_past, (sizeof(mng_fields_past) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_DISC -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_disc = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_disc, - mng_fields_disc, (sizeof(mng_fields_disc) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_BACK -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_back = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_back, - mng_fields_back, (sizeof(mng_fields_back) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_fram = - {mng_it_mng, mng_create_none, 0, offsetof(mng_fram, bEmpty), - MNG_NULL, MNG_NULL, mng_special_fram, - mng_fields_fram, (sizeof(mng_fields_fram) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_MOVE -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_move = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_move, - mng_fields_move, (sizeof(mng_fields_move) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_CLIP -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_clip = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_clip, - mng_fields_clip, (sizeof(mng_fields_clip) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_SHOW -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_show = - {mng_it_mng, mng_create_none, 0, offsetof(mng_show, bEmpty), - MNG_NULL, MNG_NULL, mng_special_show, - mng_fields_show, (sizeof(mng_fields_show) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_TERM -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_term = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_term, - mng_fields_term, (sizeof(mng_fields_term) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOTERM | MNG_DESCR_NOLOOP}; -#endif - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_save = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_save, - mng_fields_save, (sizeof(mng_fields_save) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR, - MNG_DESCR_NOSAVE | MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_SEEK -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_seek = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_seek, - mng_fields_seek, (sizeof(mng_fields_seek) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYGLOBAL, - MNG_DESCR_MHDR | MNG_DESCR_SAVE, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_eXPI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_expi = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_expi, - mng_fields_expi, (sizeof(mng_fields_expi) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_fPRI -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_fpri = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_fpri, - mng_fields_fpri, (sizeof(mng_fields_fpri) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_need = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_need, - mng_fields_need, (sizeof(mng_fields_need) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_pHYg -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_phyg = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_phyg, - mng_fields_phyg, (sizeof(mng_fields_phyg) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_dhdr = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_dhdr, - mng_fields_dhdr, (sizeof(mng_fields_dhdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_prom = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_prom, - mng_fields_prom, (sizeof(mng_fields_prom) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ipng = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ipng, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_pplt = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_pplt, - mng_fields_pplt, (sizeof(mng_fields_pplt) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ijng = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ijng, - MNG_NULL, 0, - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif -#endif - -#ifndef MNG_NO_DELTA_PNG -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_drop = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_drop, - mng_fields_drop, (sizeof(mng_fields_drop) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_dbyk = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_dbyk, - mng_fields_dbyk, (sizeof(mng_fields_dbyk) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif -#endif - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ordr = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ordr, - mng_fields_ordr, (sizeof(mng_fields_ordr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR | MNG_DESCR_DHDR, - MNG_NULL}; -#endif -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_magn = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_magn, - mng_fields_magn, (sizeof(mng_fields_magn) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOIHDR | MNG_DESCR_NOBASI | MNG_DESCR_NODHDR | MNG_DESCR_NOJHDR}; -#endif - -#ifndef MNG_SKIPCHUNK_evNT -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_evnt = - {mng_it_mng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_evnt, - mng_fields_evnt, (sizeof(mng_fields_evnt) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_MHDR, - MNG_DESCR_NOSAVE}; -#endif - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_mpng = - {mng_it_mpng, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_mpng, - mng_fields_mpng, (sizeof(mng_fields_mpng) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_NULL, - MNG_DESCR_NOMHDR | MNG_DESCR_NOIDAT | MNG_DESCR_NOJDAT}; -#endif - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_ahdr = - {mng_it_ang, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_ahdr, - mng_fields_ahdr, (sizeof(mng_fields_ahdr) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_IHDR, - MNG_DESCR_NOMHDR | MNG_DESCR_NOJHDR | MNG_DESCR_NOIDAT}; - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_adat = - {mng_it_ang, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_adat, - mng_fields_adat, (sizeof(mng_fields_adat) / sizeof(mng_field_descriptor)), - MNG_NULL, - MNG_DESCR_IHDR, - MNG_DESCR_NOMHDR | MNG_DESCR_NOJHDR}; -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* the good ol' unknown babe */ - -MNG_LOCAL mng_chunk_descriptor mng_chunk_descr_unknown = - {mng_it_png, mng_create_none, 0, 0, - MNG_NULL, MNG_NULL, mng_special_unknown, - mng_fields_unknown, (sizeof(mng_fields_unknown) / sizeof(mng_field_descriptor)), - MNG_DESCR_EMPTY | MNG_DESCR_EMPTYEMBED, - MNG_NULL, - MNG_NULL}; - -/* ************************************************************************** */ -/* ************************************************************************** */ - -MNG_LOCAL mng_chunk_header mng_chunk_unknown = - {MNG_UINT_HUH, mng_init_general, mng_free_unknown, - mng_read_general, mng_write_unknown, mng_assign_unknown, - 0, 0, sizeof(mng_unknown_chunk), &mng_chunk_descr_unknown}; - -/* ************************************************************************** */ - - /* the table-idea & binary search code was adapted from - libpng 1.1.0 (pngread.c) */ - /* NOTE1: the table must remain sorted by chunkname, otherwise the binary - search will break !!! (ps. watch upper-/lower-case chunknames !!) */ - /* NOTE2: the layout must remain equal to the header part of all the - chunk-structures (yes, that means even the pNext and pPrev fields; - it's wasting a bit of space, but hey, the code is a lot easier) */ - -MNG_LOCAL mng_chunk_header mng_chunk_table [] = - { -#ifndef MNG_SKIPCHUNK_BACK - {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_general, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back), &mng_chunk_descr_back}, -#endif -#ifndef MNG_SKIPCHUNK_BASI - {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_general, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi), &mng_chunk_descr_basi}, -#endif -#ifndef MNG_SKIPCHUNK_CLIP - {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_general, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip), &mng_chunk_descr_clip}, -#endif -#ifndef MNG_SKIPCHUNK_CLON - {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_general, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon), &mng_chunk_descr_clon}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_general, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk), &mng_chunk_descr_dbyk}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_DEFI - {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_general, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi), &mng_chunk_descr_defi}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr), &mng_chunk_descr_dhdr}, -#endif -#ifndef MNG_SKIPCHUNK_DISC - {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_general, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc), &mng_chunk_descr_disc}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DROP - {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_general, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop), &mng_chunk_descr_drop}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_general, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl), &mng_chunk_descr_endl}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_general, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram), &mng_chunk_descr_fram}, -#endif - {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_general, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat), &mng_chunk_descr_idat}, /* 12-th element! */ - {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_general, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend), &mng_chunk_descr_iend}, - {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr), &mng_chunk_descr_ihdr}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_general, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng), &mng_chunk_descr_ijng}, -#endif - {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_general, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng), &mng_chunk_descr_ipng}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_general, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa), &mng_chunk_descr_jdaa}, - {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_general, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat), &mng_chunk_descr_jdat}, - {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr), &mng_chunk_descr_jhdr}, - {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_general, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep), &mng_chunk_descr_jsep}, - {MNG_UINT_JdAA, mng_init_general, mng_free_jdaa, mng_read_general, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa), &mng_chunk_descr_jdaa}, -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_general, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop), &mng_chunk_descr_loop}, -#endif -#ifndef MNG_SKIPCHUNK_MAGN - {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_general, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn), &mng_chunk_descr_magn}, -#endif - {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_general, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend), &mng_chunk_descr_mend}, - {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_general, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr), &mng_chunk_descr_mhdr}, -#ifndef MNG_SKIPCHUNK_MOVE - {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_general, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move), &mng_chunk_descr_move}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_general, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr), &mng_chunk_descr_ordr}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_general, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past), &mng_chunk_descr_past}, -#endif - {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_general, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte), &mng_chunk_descr_plte}, -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_general, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt), &mng_chunk_descr_pplt}, - {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_general, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom), &mng_chunk_descr_prom}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_general, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save), &mng_chunk_descr_save}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_general, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek), &mng_chunk_descr_seek}, -#endif -#ifndef MNG_SKIPCHUNK_SHOW - {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_general, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show), &mng_chunk_descr_show}, -#endif -#ifndef MNG_SKIPCHUNK_TERM - {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_general, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term), &mng_chunk_descr_term}, -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - {MNG_UINT_adAT, mng_init_general, mng_free_adat, mng_read_general, mng_write_adat, mng_assign_adat, 0, 0, sizeof(mng_adat), &mng_chunk_descr_adat}, - {MNG_UINT_ahDR, mng_init_general, mng_free_general, mng_read_general, mng_write_ahdr, mng_assign_ahdr, 0, 0, sizeof(mng_ahdr), &mng_chunk_descr_ahdr}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_general, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd), &mng_chunk_descr_bkgd}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_general, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm), &mng_chunk_descr_chrm}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_general, mng_write_expi, mng_assign_expi, 0, 0, sizeof(mng_expi), &mng_chunk_descr_expi}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_general, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt), &mng_chunk_descr_evnt}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_general, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri), &mng_chunk_descr_fpri}, -#endif -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_general, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama), &mng_chunk_descr_gama}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_general, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist), &mng_chunk_descr_hist}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_general, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp), &mng_chunk_descr_iccp}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_general, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt), &mng_chunk_descr_itxt}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_general, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng), &mng_chunk_descr_mpng}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_general, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need), &mng_chunk_descr_need}, -#endif -/* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */ -/* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_general, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg), &mng_chunk_descr_phyg}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_general, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys), &mng_chunk_descr_phys}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_general, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit), &mng_chunk_descr_sbit}, -#endif -/* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_general, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt), &mng_chunk_descr_splt}, -#endif - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_general, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb), &mng_chunk_descr_srgb}, -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_general, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text), &mng_chunk_descr_text}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_general, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time), &mng_chunk_descr_time}, -#endif - {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_general, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns), &mng_chunk_descr_trns}, -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_general, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt), &mng_chunk_descr_ztxt}, -#endif - }; - -/* ************************************************************************** */ -/* ************************************************************************** */ - -void mng_get_chunkheader (mng_chunkid iChunkname, - mng_chunk_headerp pResult) -{ - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_chunk_headerp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (mng_chunk_table) / sizeof (mng_chunk_table [0])) - 1; - - /* binary search; with 54 chunks, worst-case is 7 comparisons */ - iLower = 0; -#ifndef MNG_NO_DELTA_PNG - iMiddle = 11; /* start with the IDAT entry */ -#else - iMiddle = 8; -#endif - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (mng_chunk_table [iMiddle].iChunkname < iChunkname) - iLower = iMiddle + 1; - else if (mng_chunk_table [iMiddle].iChunkname > iChunkname) - iUpper = iMiddle - 1; - else - { - pEntry = &mng_chunk_table [iMiddle]; - break; - } - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (!pEntry) /* unknown chunk ? */ - pEntry = &mng_chunk_unknown; /* make it so! */ - - MNG_COPY (pResult, pEntry, sizeof(mng_chunk_header)); - - return; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* PNG chunks */ - -MNG_C_SPECIALFUNC (mng_special_ihdr) -{ - pData->bHasIHDR = MNG_TRUE; /* indicate IHDR is present */ - /* and store interesting fields */ - if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_NOCHANGE)) - { - pData->iDatawidth = ((mng_ihdrp)pChunk)->iWidth; - pData->iDataheight = ((mng_ihdrp)pChunk)->iHeight; - } - - pData->iBitdepth = ((mng_ihdrp)pChunk)->iBitdepth; - pData->iColortype = ((mng_ihdrp)pChunk)->iColortype; - pData->iCompression = ((mng_ihdrp)pChunk)->iCompression; - pData->iFilter = ((mng_ihdrp)pChunk)->iFilter; - pData->iInterlace = ((mng_ihdrp)pChunk)->iInterlace; - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iCompression != MNG_COMPRESSION_DEFLATE) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iInterlace != MNG_INTERLACE_NONE ) && - (pData->iInterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* check the colortype for delta-images ! */ - { - mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - - if (pData->iColortype != pBuf->iColortype) - { - if ( ( (pData->iColortype != MNG_COLORTYPE_INDEXED) || - (pBuf->iColortype == MNG_COLORTYPE_GRAY ) ) && - ( (pData->iColortype != MNG_COLORTYPE_GRAY ) || - (pBuf->iColortype == MNG_COLORTYPE_INDEXED) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - } - } -#endif -#endif - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_png; /* then this must be a PNG */ - pData->iWidth = pData->iDatawidth; - pData->iHeight = pData->iDataheight; - /* predict alpha-depth ! */ - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) - pData->iAlphadepth = pData->iBitdepth; - else - if (pData->iColortype == MNG_COLORTYPE_INDEXED) - pData->iAlphadepth = 8; /* worst case scenario */ - else - pData->iAlphadepth = 1; /* Possible tRNS cheap binary transparency */ - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - -#if !defined(MNG_INCLUDE_MPNG_PROPOSAL) || !defined(MNG_SUPPORT_DISPLAY) - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); -#endif - } - - if (!pData->bHasDHDR) - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - return mng_process_display_ihdr (pData); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} - -/* ************************************************************************** */ - -MNG_F_SPECIALFUNC (mng_debunk_plte) -{ - mng_pltep pPLTE = (mng_pltep)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - /* length must be multiple of 3 */ - if (((iRawlen % 3) != 0) || (iRawlen > 768)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* this is the exact length */ - pPLTE->iEntrycount = iRawlen / 3; - - MNG_COPY (pPLTE->aEntries, pRawdata, iRawlen); - - *piRawlen = 0; - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_plte) -{ /* multiple PLTE only inside BASI */ - if ((pData->bHasPLTE) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* only allowed for indexed-color or - rgb(a)-color! */ - if ((pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* empty only allowed if global present */ - if ((((mng_pltep)pChunk)->bEmpty) && (!pData->bHasglobalPLTE)) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - else - { - if (((mng_pltep)pChunk)->bEmpty) /* cannot be empty as global! */ - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasPLTE = MNG_TRUE; /* got it! */ - else - pData->bHasglobalPLTE = MNG_TRUE; - - pData->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; - pBuf->bHasPLTE = MNG_TRUE; /* it's definitely got a PLTE now */ - pBuf->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - MNG_COPY (pBuf->aPLTEentries, ((mng_pltep)pChunk)->aEntries, - sizeof (pBuf->aPLTEentries)); - } - else -#endif - { /* get the current object */ - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address the object buffer */ - pBuf->bHasPLTE = MNG_TRUE; /* and tell it it's got a PLTE now */ - - if (((mng_pltep)pChunk)->bEmpty) /* if empty, inherit from global */ - { - pBuf->iPLTEcount = pData->iGlobalPLTEcount; - MNG_COPY (pBuf->aPLTEentries, pData->aGlobalPLTEentries, - sizeof (pBuf->aPLTEentries)); - - if (pData->bHasglobalTRNS) /* also copy global tRNS ? */ - { - mng_uint32 iRawlen2 = pData->iGlobalTRNSrawlen; - mng_uint8p pRawdata2 = (mng_uint8p)(pData->aGlobalTRNSrawdata); - /* indicate tRNS available */ - pBuf->bHasTRNS = MNG_TRUE; - /* global length oke ? */ - if ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - /* copy it */ - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - } - } - else - { /* store fields for future reference */ - pBuf->iPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - MNG_COPY (pBuf->aPLTEentries, ((mng_pltep)pChunk)->aEntries, - sizeof (pBuf->aPLTEentries)); - } - } - } - else /* store as global */ - { - pData->iGlobalPLTEcount = ((mng_pltep)pChunk)->iEntrycount; - MNG_COPY (pData->aGlobalPLTEentries, ((mng_pltep)pChunk)->aEntries, - sizeof (pData->aGlobalPLTEentries)); - /* create an animation object */ - return mng_create_ani_plte (pData); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_idat) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasJHDR) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); -#endif - /* not allowed for deltatype NO_CHANGE */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && ((pData->iDeltatype == MNG_DELTATYPE_NOCHANGE))) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); -#endif - /* can only be empty in BASI-block! */ - if ((((mng_idatp)pChunk)->bEmpty) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* indexed-color requires PLTE */ - if ((pData->bHasIHDR) && (pData->iColortype == 3) && (!pData->bHasPLTE)) - MNG_ERROR (pData, MNG_PLTEMISSING); - - pData->bHasIDAT = MNG_TRUE; /* got some IDAT now, don't we */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_iend) -{ /* IHDR-block requires IDAT */ - if ((pData->bHasIHDR) && (!pData->bHasIDAT)) - MNG_ERROR (pData, MNG_IDATMISSING); - - pData->iImagelevel--; /* one level up */ - -#ifdef MNG_SUPPORT_DISPLAY - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_image (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* display processing */ - iRetcode = mng_process_display_iend (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_SUPPORT_DISPLAY - if (!pData->bTimerset) /* reset only if not broken !!! */ - { -#endif - /* IEND signals the end for most ... */ - pData->bHasIHDR = MNG_FALSE; - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; -#ifdef MNG_SUPPORT_DISPLAY - } -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_F_SPECIALFUNC (mng_debunk_trns) -{ - mng_trnsp pTRNS = (mng_trnsp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not global! */ - pTRNS->bGlobal = MNG_FALSE; - pTRNS->iType = pData->iColortype; - - if (iRawlen != 0) - { - switch (pData->iColortype) /* store fields */ - { - case 0: { /* gray */ - if (iRawlen != 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->iGray = mng_get_uint16 (pRawdata); - break; - } - case 2: { /* rgb */ - if (iRawlen != 6) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->iRed = mng_get_uint16 (pRawdata); - pTRNS->iGreen = mng_get_uint16 (pRawdata+2); - pTRNS->iBlue = mng_get_uint16 (pRawdata+4); - break; - } - case 3: { /* indexed */ - if (iRawlen > 256) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->iCount = iRawlen; - MNG_COPY (pTRNS->aEntries, pRawdata, iRawlen); - break; - } - } - } - } - else /* it's global! */ - { - if (iRawlen == 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - pTRNS->bGlobal = MNG_TRUE; - pTRNS->iType = 0; - pTRNS->iRawlen = iRawlen; - MNG_COPY (pTRNS->aRawdata, pRawdata, iRawlen); - - pData->iGlobalTRNSrawlen = iRawlen; - MNG_COPY (pData->aGlobalTRNSrawdata, pRawdata, iRawlen); - } - - *piRawlen = 0; - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_trns) -{ /* multiple tRNS only inside BASI */ - if ((pData->bHasTRNS) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not allowed with full alpha-channel */ - if ((pData->iColortype == 4) || (pData->iColortype == 6)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if (!((mng_trnsp)pChunk)->bEmpty) /* filled ? */ - { -#ifdef MNG_SUPPORT_DISPLAY - if (pData->iColortype == 3) - { - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; - - if (!pImage) /* no object then check obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - - if (((mng_trnsp)pChunk)->iCount > pBuf->iPLTEcount) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } -#endif - } - else /* if empty there must be global stuff! */ - { - if (!pData->bHasglobalTRNS) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasTRNS = MNG_TRUE; /* indicate tRNS available */ - else - pData->bHasglobalTRNS = MNG_TRUE; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - mng_uint8p pRawdata2; - mng_uint32 iRawlen2; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1,0,0,0,0,0,0,0,1}; -#endif - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = ((mng_trnsp)pChunk)->iGray; -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - pBuf->iTRNSgray *= multiplier[pData->iPNGdepth]; -#endif -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSred = ((mng_trnsp)pChunk)->iRed; - pBuf->iTRNSgreen = ((mng_trnsp)pChunk)->iGreen; - pBuf->iTRNSblue = ((mng_trnsp)pChunk)->iBlue; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNScount = ((mng_trnsp)pChunk)->iCount; - MNG_COPY (pBuf->aTRNSentries, - ((mng_trnsp)pChunk)->aEntries, - ((mng_trnsp)pChunk)->iCount); - break; - } - } - } - else -#endif - { /* address current object */ - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasTRNS = MNG_TRUE; /* and tell it it's got a tRNS now */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; - - if (((mng_trnsp)pChunk)->bEmpty) /* if empty, inherit from global */ - { - iRawlen2 = pData->iGlobalTRNSrawlen; - pRawdata2 = (mng_ptr)(pData->aGlobalTRNSrawdata); - /* global length oke ? */ - if ((pData->iColortype == 0) && (iRawlen2 != 2)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 2) && (iRawlen2 != 6)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 3) && ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount))) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = mng_get_uint16 (pRawdata2); -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSred = mng_get_uint16 (pRawdata2); - pBuf->iTRNSgreen = mng_get_uint16 (pRawdata2+2); - pBuf->iTRNSblue = mng_get_uint16 (pRawdata2+4); -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - break; - } - } - } - else - { - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = ((mng_trnsp)pChunk)->iGray; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSred = ((mng_trnsp)pChunk)->iRed; - pBuf->iTRNSgreen = ((mng_trnsp)pChunk)->iGreen; - pBuf->iTRNSblue = ((mng_trnsp)pChunk)->iBlue; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNScount = ((mng_trnsp)pChunk)->iCount; - MNG_COPY (pBuf->aTRNSentries, - ((mng_trnsp)pChunk)->aEntries, - ((mng_trnsp)pChunk)->iCount); - break; - } - } - } - } - } - else - { /* create an animation object */ - return mng_create_ani_trns (pData); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_gama) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasGAMA = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalGAMA = (mng_bool)!((mng_gamap)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - pImage = (mng_imagep)pData->pObjzero; - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - /* store for color-processing routines */ - pImage->pImgbuf->iGamma = ((mng_gamap)pChunk)->iGamma; - pImage->pImgbuf->bHasGAMA = MNG_TRUE; - } - else - { /* store as global */ - if (!((mng_gamap)pChunk)->bEmpty) - pData->iGlobalGamma = ((mng_gamap)pChunk)->iGamma; - /* create an animation object */ - return mng_create_ani_gama (pData, pChunk); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -MNG_C_SPECIALFUNC (mng_special_chrm) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasCHRM = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalCHRM = (mng_bool)!((mng_chrmp)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY - { -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - pImage = (mng_imagep)pData->pObjzero; - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */ - /* store for color-processing routines */ - pBuf->iWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; - pBuf->iWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; - pBuf->iPrimaryredx = ((mng_chrmp)pChunk)->iRedx; - pBuf->iPrimaryredy = ((mng_chrmp)pChunk)->iRedy; - pBuf->iPrimarygreenx = ((mng_chrmp)pChunk)->iGreenx; - pBuf->iPrimarygreeny = ((mng_chrmp)pChunk)->iGreeny; - pBuf->iPrimarybluex = ((mng_chrmp)pChunk)->iBluex; - pBuf->iPrimarybluey = ((mng_chrmp)pChunk)->iBluey; - } - else - { /* store as global */ - if (!((mng_chrmp)pChunk)->bEmpty) - { - pData->iGlobalWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; - pData->iGlobalWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; - pData->iGlobalPrimaryredx = ((mng_chrmp)pChunk)->iRedx; - pData->iGlobalPrimaryredy = ((mng_chrmp)pChunk)->iRedy; - pData->iGlobalPrimarygreenx = ((mng_chrmp)pChunk)->iGreenx; - pData->iGlobalPrimarygreeny = ((mng_chrmp)pChunk)->iGreeny; - pData->iGlobalPrimarybluex = ((mng_chrmp)pChunk)->iBluex; - pData->iGlobalPrimarybluey = ((mng_chrmp)pChunk)->iBluey; - } - /* create an animation object */ - return mng_create_ani_chrm (pData, pChunk); - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_srgb) -{ -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasSRGB = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalSRGB = (mng_bool)!((mng_srgbp)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - pImage = (mng_imagep)pData->pObjzero; - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - /* store for color-processing routines */ - pImage->pImgbuf->iRenderingintent = ((mng_srgbp)pChunk)->iRenderingintent; - pImage->pImgbuf->bHasSRGB = MNG_TRUE; - } - else - { /* store as global */ - if (!((mng_srgbp)pChunk)->bEmpty) - pData->iGlobalRendintent = ((mng_srgbp)pChunk)->iRenderingintent; - /* create an animation object */ - return mng_create_ani_srgb (pData, pChunk); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -MNG_C_SPECIALFUNC (mng_special_iccp) -{ - mng_retcode iRetcode; - mng_chunk_headerp pDummy; - -#ifdef MNG_CHECK_BAD_ICCP /* Check for bad iCCP chunk */ - if (!strncmp (((mng_iccpp)pChunk)->zName, "Photoshop ICC profile", 21)) - { - if (((mng_iccpp)pChunk)->iProfilesize == 2615) /* is it the sRGB profile ? */ - { - mng_chunk_header chunk_srgb; - mng_get_chunkheader (MNG_UINT_sRGB, &chunk_srgb); - /* pretend it's an sRGB chunk then ! */ - iRetcode = mng_read_general (pData, &chunk_srgb, 1, (mng_ptr)"0", &pDummy); - if (iRetcode) /* on error bail out */ - return iRetcode; - - pDummy->fCleanup (pData, pDummy); - } - } - else - { -#endif /* MNG_CHECK_BAD_ICCP */ - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasICCP = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalICCP = (mng_bool)!((mng_iccpp)pChunk)->bEmpty; - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - } - else - { /* store as global */ - if (pData->pGlobalProfile) /* did we have a global profile ? */ - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - if (((mng_iccpp)pChunk)->bEmpty) /* empty chunk ? */ - { - pData->iGlobalProfilesize = 0; /* reset to null */ - pData->pGlobalProfile = MNG_NULL; - } - else - { /* allocate a global buffer & copy it */ - MNG_ALLOC (pData, pData->pGlobalProfile, ((mng_iccpp)pChunk)->iProfilesize); - MNG_COPY (pData->pGlobalProfile, ((mng_iccpp)pChunk)->pProfile, ((mng_iccpp)pChunk)->iProfilesize); - /* store its length as well */ - pData->iGlobalProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - } - /* create an animation object */ - return mng_create_ani_iccp (pData, pChunk); - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_CHECK_BAD_ICCP - } -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -MNG_C_SPECIALFUNC (mng_special_text) -{ - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_TEXT, - ((mng_textp)pChunk)->zKeyword, - ((mng_textp)pChunk)->zText, 0, 0); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -MNG_C_SPECIALFUNC (mng_special_ztxt) -{ - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ZTXT, - ((mng_ztxtp)pChunk)->zKeyword, - ((mng_ztxtp)pChunk)->zText, 0, 0); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_F_SPECIALFUNC (mng_deflate_itxt) -{ - mng_itxtp pITXT = (mng_itxtp)pChunk; - mng_uint32 iBufsize = 0; - mng_uint8p pBuf = 0; - mng_uint32 iTextlen = 0; - - if (pITXT->iCompressionflag) /* decompress the text ? */ - { - mng_retcode iRetcode = mng_inflate_buffer (pData, *ppRawdata, *piRawlen, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - MNG_ALLOC (pData, pITXT->zText, iTextlen+1); - MNG_COPY (pITXT->zText, pBuf, iTextlen); - - pITXT->iTextsize = iTextlen; - - MNG_FREEX (pData, pBuf, iBufsize); - - } else { - - MNG_ALLOC (pData, pITXT->zText, (*piRawlen)+1); - MNG_COPY (pITXT->zText, *ppRawdata, *piRawlen); - - pITXT->iTextsize = *piRawlen; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -MNG_C_SPECIALFUNC (mng_special_itxt) -{ - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ITXT, - ((mng_itxtp)pChunk)->zKeyword, - ((mng_itxtp)pChunk)->zText, - ((mng_itxtp)pChunk)->zLanguage, - ((mng_itxtp)pChunk)->zTranslation); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -MNG_C_SPECIALFUNC (mng_special_bkgd) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; -#endif - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasBKGD = MNG_TRUE; /* indicate bKGD available */ - else - pData->bHasglobalBKGD = (mng_bool)!(((mng_bkgdp)pChunk)->bEmpty); - -#ifdef MNG_SUPPORT_DISPLAY - if (!pImage) /* if no object dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; /* address object buffer */ - -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iJHDRcolortype) /* store fields for future reference */ - { - case 8 : ; /* gray */ - case 12 : { /* graya */ - pBuf->iBKGDgray = ((mng_bkgdp)pChunk)->iGray; - break; - } - case 10 : ; /* rgb */ - case 14 : { /* rgba */ - pBuf->iBKGDred = ((mng_bkgdp)pChunk)->iRed; - pBuf->iBKGDgreen = ((mng_bkgdp)pChunk)->iGreen; - pBuf->iBKGDblue = ((mng_bkgdp)pChunk)->iBlue; - break; - } - } - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0 : ; /* gray */ - case 4 : { /* graya */ - pBuf->iBKGDgray = ((mng_bkgdp)pChunk)->iGray; - break; - } - case 2 : ; /* rgb */ - case 6 : { /* rgba */ - pBuf->iBKGDred = ((mng_bkgdp)pChunk)->iRed; - pBuf->iBKGDgreen = ((mng_bkgdp)pChunk)->iGreen; - pBuf->iBKGDblue = ((mng_bkgdp)pChunk)->iBlue; - break; - } - case 3 : { /* indexed */ - pBuf->iBKGDindex = ((mng_bkgdp)pChunk)->iIndex; - break; - } - } - } - else /* store as global */ - { - if (!(((mng_bkgdp)pChunk)->bEmpty)) - { - pData->iGlobalBKGDred = ((mng_bkgdp)pChunk)->iRed; - pData->iGlobalBKGDgreen = ((mng_bkgdp)pChunk)->iGreen; - pData->iGlobalBKGDblue = ((mng_bkgdp)pChunk)->iBlue; - } - /* create an animation object */ - return mng_create_ani_bkgd (pData); - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -MNG_C_SPECIALFUNC (mng_special_phys) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -MNG_C_SPECIALFUNC (mng_special_sbit) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_F_SPECIALFUNC (mng_splt_entries) -{ - mng_spltp pSPLT = (mng_spltp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if ((pSPLT->iSampledepth != MNG_BITDEPTH_8 ) && - (pSPLT->iSampledepth != MNG_BITDEPTH_16) ) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - /* check remaining length */ - if ( ((pSPLT->iSampledepth == MNG_BITDEPTH_8 ) && (iRawlen % 6 != 0)) || - ((pSPLT->iSampledepth == MNG_BITDEPTH_16) && (iRawlen % 10 != 0)) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (pSPLT->iSampledepth == MNG_BITDEPTH_8) - pSPLT->iEntrycount = iRawlen / 6; - else - pSPLT->iEntrycount = iRawlen / 10; - - if (iRawlen) - { - MNG_ALLOC (pData, pSPLT->pEntries, iRawlen); - MNG_COPY (pSPLT->pEntries, pRawdata, iRawlen); - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -MNG_C_SPECIALFUNC (mng_special_splt) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -MNG_F_SPECIALFUNC (mng_hist_entries) -{ - mng_histp pHIST = (mng_histp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iX; - - if ( ((iRawlen & 0x01) != 0) || ((iRawlen >> 1) != pData->iPLTEcount) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pHIST->iEntrycount = iRawlen >> 1; - - for (iX = 0; iX < pHIST->iEntrycount; iX++) - { - pHIST->aEntries[iX] = mng_get_uint16 (pRawdata); - pRawdata += 2; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -MNG_C_SPECIALFUNC (mng_special_hist) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -MNG_C_SPECIALFUNC (mng_special_time) -{ -/* if (pData->fProcesstime) */ /* inform the application ? */ -/* { - - pData->fProcesstime ((mng_handle)pData, ); - } */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* JNG chunks */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jhdr) -{ - if ((pData->eSigtype == mng_it_jng) && (pData->iChunkseq > 1)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* inside a JHDR-IEND block now */ - pData->bHasJHDR = MNG_TRUE; - /* and store interesting fields */ - pData->iDatawidth = ((mng_jhdrp)pChunk)->iWidth; - pData->iDataheight = ((mng_jhdrp)pChunk)->iHeight; - pData->iJHDRcolortype = ((mng_jhdrp)pChunk)->iColortype; - pData->iJHDRimgbitdepth = ((mng_jhdrp)pChunk)->iImagesampledepth; - pData->iJHDRimgcompression = ((mng_jhdrp)pChunk)->iImagecompression; - pData->iJHDRimginterlace = ((mng_jhdrp)pChunk)->iImageinterlace; - pData->iJHDRalphabitdepth = ((mng_jhdrp)pChunk)->iAlphasampledepth; - pData->iJHDRalphacompression = ((mng_jhdrp)pChunk)->iAlphacompression; - pData->iJHDRalphafilter = ((mng_jhdrp)pChunk)->iAlphafilter; - pData->iJHDRalphainterlace = ((mng_jhdrp)pChunk)->iAlphainterlace; - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iJHDRalphabitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iJHDRalphabitdepth < 8) - pData->iJHDRalphabitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iJHDRalphabitdepth > 8) - { - pData->iPNGmult = 2; - pData->iJHDRalphabitdepth = 8; - } -#endif - /* parameter validity checks */ - if ((pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAY ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLORA) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG12 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8AND12) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - if ((pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_1 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_2 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_4 ) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE ) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) ) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if ((pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iJHDRalphafilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) && - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - } - else - { - if (pData->iJHDRalphabitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - if (pData->iJHDRalphacompression) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); - if (pData->iJHDRalphainterlace) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - } - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_jng; /* then this must be a JNG */ - pData->iWidth = ((mng_jhdrp)pChunk)->iWidth; - pData->iHeight = ((mng_jhdrp)pChunk)->iHeight; - /* predict alpha-depth ! */ - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - pData->iAlphadepth = pData->iJHDRalphabitdepth; - else - pData->iAlphadepth = 0; - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - } - - pData->iColortype = 0; /* fake grayscale for other routines */ - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_process_display_jhdr (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_NO_16BIT_SUPPORT - if (((mng_jhdrp)pChunk)->iAlphasampledepth > 8) - ((mng_jhdrp)pChunk)->iAlphasampledepth = 8; -#endif - - return MNG_NOERROR; /* done */ -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jdaa) -{ - if (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasJDAA = MNG_TRUE; /* got some JDAA now, don't we */ - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jdat) -{ - pData->bHasJDAT = MNG_TRUE; /* got some JDAT now, don't we */ - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_jsep) -{ - pData->bHasJSEP = MNG_TRUE; /* indicate we've had the 8-/12-bit separator */ - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ -/* ************************************************************************** */ -/* MNG chunks */ - -MNG_C_SPECIALFUNC (mng_special_mhdr) -{ - if (pData->bHasheader) /* can only be the first chunk! */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasMHDR = MNG_TRUE; /* oh boy, a real MNG */ - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_mng; /* fill header fields */ - pData->iWidth = ((mng_mhdrp)pChunk)->iWidth; - pData->iHeight = ((mng_mhdrp)pChunk)->iHeight; - pData->iTicks = ((mng_mhdrp)pChunk)->iTicks; - pData->iLayercount = ((mng_mhdrp)pChunk)->iLayercount; - pData->iFramecount = ((mng_mhdrp)pChunk)->iFramecount; - pData->iPlaytime = ((mng_mhdrp)pChunk)->iPlaytime; - pData->iSimplicity = ((mng_mhdrp)pChunk)->iSimplicity; -#ifndef MNG_NO_OLD_VERSIONS - pData->bPreDraft48 = MNG_FALSE; -#endif - /* predict alpha-depth */ - if ((pData->iSimplicity & 0x00000001) == 0) -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* no indicators = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - else - if ((pData->iSimplicity & 0x00000008) == 0) - pData->iAlphadepth = 0; /* no transparency at all */ - else - if ((pData->iSimplicity & 0x00000140) == 0x00000040) - pData->iAlphadepth = 1; /* no semi-transparency guaranteed */ - else -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* anything else = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - -#ifdef MNG_INCLUDE_JNG /* can we handle the complexity ? */ - if (pData->iSimplicity & 0x0000FC00) -#else - if (pData->iSimplicity & 0x0000FC10) -#endif - MNG_ERROR (pData, MNG_MNGTOOCOMPLEX); - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iImagelevel++; /* one level deeper */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_mend) -{ -#ifdef MNG_SUPPORT_DISPLAY - { /* do something */ - mng_retcode iRetcode = mng_process_display_mend (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (!pData->iTotalframes) /* save totals */ - pData->iTotalframes = pData->iFrameseq; - if (!pData->iTotallayers) - pData->iTotallayers = pData->iLayerseq; - if (!pData->iTotalplaytime) - pData->iTotalplaytime = pData->iFrametime; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - pData->bHasMHDR = MNG_FALSE; /* end of the line, bro! */ - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_F_SPECIALFUNC (mng_debunk_loop) -{ - mng_loopp pLOOP = (mng_loopp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if (iRawlen >= 5) /* length checks */ - { - if (iRawlen >= 6) - { - if ((iRawlen - 6) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (iRawlen >= 5) /* store the fields */ - { - pLOOP->iLevel = *pRawdata; - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) - { - pLOOP->iTermination = *(pRawdata+1); - pLOOP->iRepeat = mng_get_uint32 (pRawdata+2); - } - else -#endif - { - pLOOP->iRepeat = mng_get_uint32 (pRawdata+1); - } - - if (iRawlen >= 6) - { -#ifndef MNG_NO_OLD_VERSIONS - if (!pData->bPreDraft48) -#endif - pLOOP->iTermination = *(pRawdata+5); - - if (iRawlen >= 10) - { - pLOOP->iItermin = mng_get_uint32 (pRawdata+6); - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (iRawlen >= 14) - { - pLOOP->iItermax = mng_get_uint32 (pRawdata+10); - pLOOP->iCount = (iRawlen - 14) / 4; - - if (pLOOP->iCount) - { - MNG_ALLOC (pData, pLOOP->pSignals, pLOOP->iCount << 2); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata + 14; - mng_uint32p pOut = (mng_uint32p)pLOOP->pSignals; - - for (iX = 0; iX < pLOOP->iCount; iX++) - { - *pOut++ = mng_get_uint32 (pIn); - pIn += 4; - } - } -#else - MNG_COPY (pLOOP->pSignals, pRawdata + 14, pLOOP->iCount << 2); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } -#endif - } - } - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_C_SPECIALFUNC (mng_special_loop) -{ - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_LOOPWITHCACHEOFF); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - pData->bHasLOOP = MNG_TRUE; /* indicate we're inside a loop */ - /* create the LOOP ani-object */ - iRetcode = mng_create_ani_loop (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* skip till matching ENDL if iteration=0 */ - if ((!pData->bSkipping) && (((mng_loopp)pChunk)->iRepeat == 0)) - pData->bSkipping = MNG_TRUE; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -MNG_C_SPECIALFUNC (mng_special_endl) -{ -#ifdef MNG_SUPPORT_DISPLAY - if (pData->bHasLOOP) /* are we really processing a loop ? */ - { - mng_uint8 iLevel = ((mng_endlp)pChunk)->iLevel; - /* create an ENDL animation object */ - return mng_create_ani_endl (pData, iLevel); - } - else - MNG_ERROR (pData, MNG_NOMATCHINGLOOP); -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -MNG_C_SPECIALFUNC (mng_special_defi) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode; - - pData->iDEFIobjectid = ((mng_defip)pChunk)->iObjectid; - pData->bDEFIhasdonotshow = ((mng_defip)pChunk)->bHasdonotshow; - pData->iDEFIdonotshow = ((mng_defip)pChunk)->iDonotshow; - pData->bDEFIhasconcrete = ((mng_defip)pChunk)->bHasconcrete; - pData->iDEFIconcrete = ((mng_defip)pChunk)->iConcrete; - pData->bDEFIhasloca = ((mng_defip)pChunk)->bHasloca; - pData->iDEFIlocax = ((mng_defip)pChunk)->iXlocation; - pData->iDEFIlocay = ((mng_defip)pChunk)->iYlocation; - pData->bDEFIhasclip = ((mng_defip)pChunk)->bHasclip; - pData->iDEFIclipl = ((mng_defip)pChunk)->iLeftcb; - pData->iDEFIclipr = ((mng_defip)pChunk)->iRightcb; - pData->iDEFIclipt = ((mng_defip)pChunk)->iTopcb; - pData->iDEFIclipb = ((mng_defip)pChunk)->iBottomcb; - /* create an animation object */ - iRetcode = mng_create_ani_defi (pData); - if (!iRetcode) /* do display processing */ - iRetcode = mng_process_display_defi (pData); - return iRetcode; -#else - return MNG_NOERROR; /* done */ -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -MNG_C_SPECIALFUNC (mng_special_basi) -{ - pData->bHasBASI = MNG_TRUE; /* inside a BASI-IEND block now */ - /* store interesting fields */ - pData->iDatawidth = ((mng_basip)pChunk)->iWidth; - pData->iDataheight = ((mng_basip)pChunk)->iHeight; - pData->iBitdepth = ((mng_basip)pChunk)->iBitdepth; - pData->iColortype = ((mng_basip)pChunk)->iColortype; - pData->iCompression = ((mng_basip)pChunk)->iCompression; - pData->iFilter = ((mng_basip)pChunk)->iFilter; - pData->iInterlace = ((mng_basip)pChunk)->iInterlace; - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_basi (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_NO_16BIT_SUPPORT - if (((mng_basip)pChunk)->iBitdepth > 8) - ((mng_basip)pChunk)->iBitdepth = 8; -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -MNG_C_SPECIALFUNC (mng_special_clon) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_clon (pData, pChunk); -#else - return MNG_NOERROR; /* done */ -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -MNG_F_SPECIALFUNC (mng_debunk_past) -{ - mng_pastp pPAST = (mng_pastp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iSize; - mng_uint32 iX; - mng_past_sourcep pSource; - /* check the length */ - if ((iRawlen < 41) || (((iRawlen - 11) % 30) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pPAST->iDestid = mng_get_uint16 (pRawdata); - pPAST->iTargettype = *(pRawdata+2); - pPAST->iTargetx = mng_get_int32 (pRawdata+3); - pPAST->iTargety = mng_get_int32 (pRawdata+7); - pPAST->iCount = ((iRawlen - 11) / 30); /* how many entries again? */ - iSize = pPAST->iCount * sizeof (mng_past_source); - - pRawdata += 11; - /* get a buffer for all the source blocks */ - MNG_ALLOC (pData, pPAST->pSources, iSize); - - pSource = (mng_past_sourcep)(pPAST->pSources); - - for (iX = pPAST->iCount; iX > 0; iX--) - { /* now copy the source blocks */ - pSource->iSourceid = mng_get_uint16 (pRawdata); - pSource->iComposition = *(pRawdata+2); - pSource->iOrientation = *(pRawdata+3); - pSource->iOffsettype = *(pRawdata+4); - pSource->iOffsetx = mng_get_int32 (pRawdata+5); - pSource->iOffsety = mng_get_int32 (pRawdata+9); - pSource->iBoundarytype = *(pRawdata+13); - pSource->iBoundaryl = mng_get_int32 (pRawdata+14); - pSource->iBoundaryr = mng_get_int32 (pRawdata+18); - pSource->iBoundaryt = mng_get_int32 (pRawdata+22); - pSource->iBoundaryb = mng_get_int32 (pRawdata+26); - - pSource++; - pRawdata += 30; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -MNG_C_SPECIALFUNC (mng_special_past) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_past (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -MNG_F_SPECIALFUNC (mng_disc_entries) -{ - mng_discp pDISC = (mng_discp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - - if ((iRawlen % 2) != 0) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pDISC->iCount = (iRawlen / sizeof (mng_uint16)); - - if (pDISC->iCount) - { - MNG_ALLOC (pData, pDISC->pObjectids, iRawlen); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata; - mng_uint16p pOut = pDISC->pObjectids; - - for (iX = pDISC->iCount; iX > 0; iX--) - { - *pOut++ = mng_get_uint16 (pIn); - pIn += 2; - } - } -#else - MNG_COPY (pDISC->pObjectids, pRawdata, iRawlen); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -MNG_C_SPECIALFUNC (mng_special_disc) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_disc (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -MNG_C_SPECIALFUNC (mng_special_back) -{ -#ifdef MNG_SUPPORT_DISPLAY - /* retrieve the fields */ - pData->bHasBACK = MNG_TRUE; - pData->iBACKred = ((mng_backp)pChunk)->iRed; - pData->iBACKgreen = ((mng_backp)pChunk)->iGreen; - pData->iBACKblue = ((mng_backp)pChunk)->iBlue; - pData->iBACKmandatory = ((mng_backp)pChunk)->iMandatory; - pData->iBACKimageid = ((mng_backp)pChunk)->iImageid; - pData->iBACKtile = ((mng_backp)pChunk)->iTile; - - return mng_create_ani_back (pData); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_F_SPECIALFUNC (mng_fram_remainder) -{ - mng_framp pFRAM = (mng_framp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iRequired = 0; - - if (iRawlen < 4) /* must have at least 4 bytes */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iRequired = 4; /* calculate and check required remaining length */ - - pFRAM->iChangedelay = *pRawdata; - pFRAM->iChangetimeout = *(pRawdata+1); - pFRAM->iChangeclipping = *(pRawdata+2); - pFRAM->iChangesyncid = *(pRawdata+3); - - if (pFRAM->iChangedelay ) { iRequired += 4; } - if (pFRAM->iChangetimeout ) { iRequired += 4; } - if (pFRAM->iChangeclipping) { iRequired += 17; } - - if (pFRAM->iChangesyncid) - { - if ((iRawlen - iRequired) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { - if (iRawlen != iRequired) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - pRawdata += 4; - - if (pFRAM->iChangedelay) /* delay changed ? */ - { - pFRAM->iDelay = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - - if (pFRAM->iChangetimeout) /* timeout changed ? */ - { - pFRAM->iTimeout = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - - if (pFRAM->iChangeclipping) /* clipping changed ? */ - { - pFRAM->iBoundarytype = *pRawdata; - pFRAM->iBoundaryl = mng_get_int32 (pRawdata+1); - pFRAM->iBoundaryr = mng_get_int32 (pRawdata+5); - pFRAM->iBoundaryt = mng_get_int32 (pRawdata+9); - pFRAM->iBoundaryb = mng_get_int32 (pRawdata+13); - pRawdata += 17; - } - - if (pFRAM->iChangesyncid) - { - pFRAM->iCount = (iRawlen - iRequired) / 4; - - if (pFRAM->iCount) - { - MNG_ALLOC (pData, pFRAM->pSyncids, pFRAM->iCount * 4); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint32p pOut = pFRAM->pSyncids; - - for (iX = pFRAM->iCount; iX > 0; iX--) - { - *pOut++ = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - } -#else - MNG_COPY (pFRAM->pSyncids, pRawdata, pFRAM->iCount * 4); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) /* old style input-stream ? */ - { - switch (pFRAM->iMode) /* fix the framing mode then */ - { - case 0: { break; } - case 1: { pFRAM->iMode = 3; break; } - case 2: { pFRAM->iMode = 4; break; } - case 3: { pFRAM->iMode = 1; break; } - case 4: { pFRAM->iMode = 1; break; } - case 5: { pFRAM->iMode = 2; break; } - default: { pFRAM->iMode = 1; break; } - } - } -#endif - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -MNG_C_SPECIALFUNC (mng_special_fram) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_fram (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -MNG_C_SPECIALFUNC (mng_special_move) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_move (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -MNG_C_SPECIALFUNC (mng_special_clip) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_clip (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -MNG_C_SPECIALFUNC (mng_special_show) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode; - - if (!((mng_showp)pChunk)->bEmpty) /* any data ? */ - { - if (!((mng_showp)pChunk)->bHaslastid) - ((mng_showp)pChunk)->iLastid = ((mng_showp)pChunk)->iFirstid; - - pData->iSHOWfromid = ((mng_showp)pChunk)->iFirstid; - pData->iSHOWtoid = ((mng_showp)pChunk)->iLastid; - pData->iSHOWmode = ((mng_showp)pChunk)->iMode; - } - else /* use defaults then */ - { - pData->iSHOWfromid = 1; - pData->iSHOWtoid = 65535; - pData->iSHOWmode = 2; - } - /* create a SHOW animation object */ - iRetcode = mng_create_ani_show (pData); - if (!iRetcode) /* go and do it! */ - iRetcode = mng_process_display_show (pData); - -#endif /* MNG_SUPPORT_DISPLAY */ - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -MNG_C_SPECIALFUNC (mng_special_term) -{ - /* should be behind MHDR or SAVE !! */ - if ((!pData->bHasSAVE) && (pData->iChunkseq > 2)) - { - pData->bMisplacedTERM = MNG_TRUE; /* indicate we found a misplaced TERM */ - /* and send a warning signal!!! */ - MNG_WARNING (pData, MNG_SEQUENCEERROR); - } - - pData->bHasTERM = MNG_TRUE; - - if (pData->fProcessterm) /* inform the app ? */ - if (!pData->fProcessterm (((mng_handle)pData), - ((mng_termp)pChunk)->iTermaction, - ((mng_termp)pChunk)->iIteraction, - ((mng_termp)pChunk)->iDelay, - ((mng_termp)pChunk)->iItermax)) - MNG_ERROR (pData, MNG_APPMISCERROR); - -#ifdef MNG_SUPPORT_DISPLAY - { /* create the TERM ani-object */ - mng_retcode iRetcode = mng_create_ani_term (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* save for future reference */ - pData->pTermaniobj = pData->pLastaniobj; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_F_SPECIALFUNC (mng_save_entries) -{ - mng_savep pSAVE = (mng_savep)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_save_entryp pEntry = MNG_NULL; - mng_uint32 iCount = 0; - mng_uint8 iOtype = *pRawdata; - mng_uint8 iEtype; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint32 iOffset[2]; - mng_uint32 iStarttime[2]; - mng_uint32 iFramenr; - mng_uint32 iLayernr; - mng_uint32 iX; - mng_uint32 iNamesize; - - if ((iOtype != 4) && (iOtype != 8)) - MNG_ERROR (pData, MNG_INVOFFSETSIZE); - - pSAVE->iOffsettype = iOtype; - - for (iX = 0; iX < 2; iX++) /* do this twice to get the count first ! */ - { - pTemp = pRawdata + 1; - iLen = iRawlen - 1; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_save_entry))); - - pSAVE->iCount = iCount; - pSAVE->pEntries = pEntry; - } - - while (iLen) /* anything left ? */ - { - iEtype = *pTemp; /* entrytype */ - - if ((iEtype != 0) && (iEtype != 1) && (iEtype != 2) && (iEtype != 3)) - MNG_ERROR (pData, MNG_INVENTRYTYPE); - - pTemp++; - - if (iEtype > 1) - { - iOffset [0] = 0; - iOffset [1] = 0; - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iOffset [0] = 0; - iOffset [1] = mng_get_uint32 (pTemp); - - pTemp += 4; - } - else - { - iOffset [0] = mng_get_uint32 (pTemp); - iOffset [1] = mng_get_uint32 (pTemp+4); - - pTemp += 8; - } - - if (iEtype > 0) - { - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iStarttime [0] = 0; - iStarttime [1] = mng_get_uint32 (pTemp+0); - iLayernr = mng_get_uint32 (pTemp+4); - iFramenr = mng_get_uint32 (pTemp+8); - - pTemp += 12; - } - else - { - iStarttime [0] = mng_get_uint32 (pTemp+0); - iStarttime [1] = mng_get_uint32 (pTemp+4); - iLayernr = mng_get_uint32 (pTemp+8); - iFramenr = mng_get_uint32 (pTemp+12); - - pTemp += 16; - } - } - } - - pNull = pTemp; /* get the name length */ - while (*pNull) - pNull++; - - if ((pNull - pRawdata) > (mng_int32)iRawlen) - { - iNamesize = iLen; /* no null found; so end of SAVE */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen -= iNamesize; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!pEntry) - { - iCount++; - } - else - { - pEntry->iEntrytype = iEtype; - pEntry->iOffset [0] = iOffset [0]; - pEntry->iOffset [1] = iOffset [1]; - pEntry->iStarttime [0] = iStarttime [0]; - pEntry->iStarttime [1] = iStarttime [1]; - pEntry->iLayernr = iLayernr; - pEntry->iFramenr = iFramenr; - pEntry->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zName, iNamesize+1); - MNG_COPY (pEntry->zName, pTemp, iNamesize); - } - - pEntry++; - } - - pTemp += iNamesize; - } - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_C_SPECIALFUNC (mng_special_save) -{ - pData->bHasSAVE = MNG_TRUE; - - if (pData->fProcesssave) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesssave ((mng_handle)pData); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - /* TODO: something with the parameters */ - - /* create a SAVE animation object */ - iRetcode = mng_create_ani_save (pData); - if (!iRetcode) /* process it */ - iRetcode = mng_process_display_save (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -MNG_C_SPECIALFUNC (mng_special_seek) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_DISPLAY - /* create a SEEK animation object */ - iRetcode = mng_create_ani_seek (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - - if (pData->fProcessseek) /* inform the app ? */ - if (!pData->fProcessseek ((mng_handle)pData, ((mng_seekp)pChunk)->zName)) - MNG_ERROR (pData, MNG_APPMISCERROR); - -#ifdef MNG_SUPPORT_DISPLAY - return mng_process_display_seek (pData); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -MNG_C_SPECIALFUNC (mng_special_expi) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -MNG_C_SPECIALFUNC (mng_special_fpri) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_bool CheckKeyword (mng_datap pData, - mng_uint8p pKeyword) -{ - mng_chunkid handled_chunks [] = - { - MNG_UINT_BACK, /* keep it sorted !!!! */ - MNG_UINT_BASI, - MNG_UINT_CLIP, - MNG_UINT_CLON, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DBYK, */ -#endif - MNG_UINT_DEFI, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_DHDR, -#endif - MNG_UINT_DISC, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DROP, */ -#endif - MNG_UINT_ENDL, - MNG_UINT_FRAM, - MNG_UINT_IDAT, - MNG_UINT_IEND, - MNG_UINT_IHDR, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - MNG_UINT_IJNG, -#endif - MNG_UINT_IPNG, -#endif -#ifdef MNG_INCLUDE_JNG - MNG_UINT_JDAA, - MNG_UINT_JDAT, - MNG_UINT_JHDR, -/* TODO: MNG_UINT_JSEP, */ - MNG_UINT_JdAA, -#endif - MNG_UINT_LOOP, - MNG_UINT_MAGN, - MNG_UINT_MEND, - MNG_UINT_MHDR, - MNG_UINT_MOVE, -/* TODO: MNG_UINT_ORDR, */ - MNG_UINT_PAST, - MNG_UINT_PLTE, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_PPLT, - MNG_UINT_PROM, -#endif - MNG_UINT_SAVE, - MNG_UINT_SEEK, - MNG_UINT_SHOW, - MNG_UINT_TERM, - MNG_UINT_bKGD, - MNG_UINT_cHRM, -/* TODO: MNG_UINT_eXPI, */ - MNG_UINT_evNT, -/* TODO: MNG_UINT_fPRI, */ - MNG_UINT_gAMA, -/* TODO: MNG_UINT_hIST, */ - MNG_UINT_iCCP, - MNG_UINT_iTXt, - MNG_UINT_nEED, -/* TODO: MNG_UINT_oFFs, */ -/* TODO: MNG_UINT_pCAL, */ -/* TODO: MNG_UINT_pHYg, */ -/* TODO: MNG_UINT_pHYs, */ -/* TODO: MNG_UINT_sBIT, */ -/* TODO: MNG_UINT_sCAL, */ -/* TODO: MNG_UINT_sPLT, */ - MNG_UINT_sRGB, - MNG_UINT_tEXt, - MNG_UINT_tIME, - MNG_UINT_tRNS, - MNG_UINT_zTXt, - }; - - mng_bool bOke = MNG_FALSE; - - if (pData->fProcessneed) /* does the app handle it ? */ - bOke = pData->fProcessneed ((mng_handle)pData, (mng_pchar)pKeyword); - - if (!bOke) - { /* find the keyword length */ - mng_uint8p pNull = pKeyword; - while (*pNull) - pNull++; - - if ((pNull - pKeyword) == 4) /* test a chunk ? */ - { /* get the chunk-id */ - mng_chunkid iChunkid = (*pKeyword << 24) + (*(pKeyword+1) << 16) + - (*(pKeyword+2) << 8) + (*(pKeyword+3) ); - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - /* determine max index of table */ - iTop = (sizeof (handled_chunks) / sizeof (handled_chunks [0])) - 1; - - /* binary search; with 52 chunks, worst-case is 7 comparisons */ - iLower = 0; - iMiddle = iTop >> 1; - iUpper = iTop; - - do /* the binary search itself */ - { - if (handled_chunks [iMiddle] < iChunkid) - iLower = iMiddle + 1; - else if (handled_chunks [iMiddle] > iChunkid) - iUpper = iMiddle - 1; - else - { - bOke = MNG_TRUE; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - } - /* test draft ? */ - if ((!bOke) && ((pNull - pKeyword) == 8) && - (*pKeyword == 'd') && (*(pKeyword+1) == 'r') && - (*(pKeyword+2) == 'a') && (*(pKeyword+3) == 'f') && - (*(pKeyword+4) == 't') && (*(pKeyword+5) == ' ')) - { - mng_uint32 iDraft; - - iDraft = (*(pKeyword+6) - '0') * 10 + (*(pKeyword+7) - '0'); - bOke = (mng_bool)(iDraft <= MNG_MNG_DRAFT); - } - /* test MNG 1.0/1.1 ? */ - if ((!bOke) && ((pNull - pKeyword) == 7) && - (*pKeyword == 'M') && (*(pKeyword+1) == 'N') && - (*(pKeyword+2) == 'G') && (*(pKeyword+3) == '-') && - (*(pKeyword+4) == '1') && (*(pKeyword+5) == '.') && - ((*(pKeyword+6) == '0') || (*(pKeyword+6) == '1'))) - bOke = MNG_TRUE; - /* test CACHEOFF ? */ - if ((!bOke) && ((pNull - pKeyword) == 8) && - (*pKeyword == 'C') && (*(pKeyword+1) == 'A') && - (*(pKeyword+2) == 'C') && (*(pKeyword+3) == 'H') && - (*(pKeyword+4) == 'E') && (*(pKeyword+5) == 'O') && - (*(pKeyword+6) == 'F') && (*(pKeyword+7) == 'F')) - { - if (!pData->pFirstaniobj) /* only if caching hasn't started yet ! */ - { - bOke = MNG_TRUE; - pData->bCacheplayback = MNG_FALSE; - pData->bStorechunks = MNG_FALSE; - } - } - } - - return bOke; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -MNG_C_SPECIALFUNC (mng_special_need) -{ - /* let's check it */ - mng_bool bOke = MNG_TRUE; - mng_uint8p pNull, pTemp, pMax; - - pTemp = (mng_uint8p)((mng_needp)pChunk)->zKeywords; - pMax = (mng_uint8p)(pTemp + ((mng_needp)pChunk)->iKeywordssize); - pNull = pTemp; - while (*pNull) - pNull++; - - while ((bOke) && (pNull < pMax)) - { - bOke = CheckKeyword (pData, pTemp); - pTemp = pNull + 1; - pNull = pTemp; - while (*pNull) - pNull++; - } - - if (bOke) - bOke = CheckKeyword (pData, pTemp); - - if (!bOke) - MNG_ERROR (pData, MNG_UNSUPPORTEDNEED); - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -MNG_C_SPECIALFUNC (mng_special_phyg) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_dhdr) -{ - if ((((mng_dhdrp)pChunk)->iDeltatype == MNG_DELTATYPE_REPLACE) && (((mng_dhdrp)pChunk)->bHasblockloc)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - if ((((mng_dhdrp)pChunk)->iDeltatype == MNG_DELTATYPE_NOCHANGE) && (((mng_dhdrp)pChunk)->bHasblocksize)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasDHDR = MNG_TRUE; /* inside a DHDR-IEND block now */ - pData->iDeltatype = ((mng_dhdrp)pChunk)->iDeltatype; - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_dhdr (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_prom) -{ - if ((((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_GRAY ) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_RGB ) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_INDEXED) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_GRAYA ) && - (((mng_promp)pChunk)->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - -#ifdef MNG_NO_16BIT_SUPPORT - if (((mng_promp)pChunk)->iSampledepth == MNG_BITDEPTH_16 ) - ((mng_promp)pChunk)->iSampledepth = MNG_BITDEPTH_8; -#endif - - if ((((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_1 ) && - (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_2 ) && - (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_4 ) && - (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_16BIT_SUPPORT - && (((mng_promp)pChunk)->iSampledepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_prom (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_ipng) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode = mng_create_ani_ipng (pData); - if (!iRetcode) /* process it */ - iRetcode = mng_process_display_ipng (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_F_SPECIALFUNC (mng_pplt_entries) -{ - mng_ppltp pPPLT = (mng_ppltp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint8 iDeltatype = pPPLT->iDeltatype; - mng_uint32 iMax = 0; - mng_int32 iX, iY, iM; - mng_rgbpaltab aIndexentries; - mng_uint8arr aAlphaentries; - mng_uint8arr aUsedentries; - /* must be indexed color ! */ - if (pData->iColortype != MNG_COLORTYPE_INDEXED) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - for (iY = 255; iY >= 0; iY--) /* reset arrays */ - { - aIndexentries [iY].iRed = 0; - aIndexentries [iY].iGreen = 0; - aIndexentries [iY].iBlue = 0; - aAlphaentries [iY] = 255; - aUsedentries [iY] = 0; - } - - while (iRawlen) /* as long as there are entries left ... */ - { - mng_uint32 iDiff; - - if (iRawlen < 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iX = (mng_int32)(*pRawdata); /* get start and end index */ - iM = (mng_int32)(*(pRawdata+1)); - - if (iM < iX) - MNG_ERROR (pData, MNG_INVALIDINDEX); - - if (iM >= (mng_int32) iMax) /* determine highest used index */ - iMax = iM + 1; - - pRawdata += 2; - iRawlen -= 2; - iDiff = (iM - iX + 1); - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - iDiff = iDiff * 3; - else - if ((iDeltatype == MNG_DELTATYPE_REPLACERGBA) || - (iDeltatype == MNG_DELTATYPE_DELTARGBA ) ) - iDiff = iDiff * 4; - - if (iRawlen < iDiff) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - { - for (iY = iX; iY <= iM; iY++) - { - aIndexentries [iY].iRed = *pRawdata; - aIndexentries [iY].iGreen = *(pRawdata+1); - aIndexentries [iY].iBlue = *(pRawdata+2); - aUsedentries [iY] = 1; - - pRawdata += 3; - iRawlen -= 3; - } - } - else - if ((iDeltatype == MNG_DELTATYPE_REPLACEALPHA) || - (iDeltatype == MNG_DELTATYPE_DELTAALPHA ) ) - { - for (iY = iX; iY <= iM; iY++) - { - aAlphaentries [iY] = *pRawdata; - aUsedentries [iY] = 1; - - pRawdata++; - iRawlen--; - } - } - else - { - for (iY = iX; iY <= iM; iY++) - { - aIndexentries [iY].iRed = *pRawdata; - aIndexentries [iY].iGreen = *(pRawdata+1); - aIndexentries [iY].iBlue = *(pRawdata+2); - aAlphaentries [iY] = *(pRawdata+3); - aUsedentries [iY] = 1; - - pRawdata += 4; - iRawlen -= 4; - } - } - } - - switch (pData->iBitdepth) /* check maximum allowed entries for bitdepth */ - { - case MNG_BITDEPTH_1 : { - if (iMax > 2) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_2 : { - if (iMax > 4) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_4 : { - if (iMax > 16) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - } - - pPPLT->iCount = iMax; - - for (iY = 255; iY >= 0; iY--) - { - pPPLT->aEntries [iY].iRed = aIndexentries [iY].iRed; - pPPLT->aEntries [iY].iGreen = aIndexentries [iY].iGreen; - pPPLT->aEntries [iY].iBlue = aIndexentries [iY].iBlue; - pPPLT->aEntries [iY].iAlpha = aAlphaentries [iY]; - pPPLT->aEntries [iY].bUsed = (mng_bool)(aUsedentries [iY]); - } - - { /* create animation object */ - mng_retcode iRetcode = mng_create_ani_pplt (pData, iDeltatype, iMax, - aIndexentries, aAlphaentries, - aUsedentries); - if (iRetcode) - return iRetcode; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_pplt) -{ - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -MNG_C_SPECIALFUNC (mng_special_ijng) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode = mng_create_ani_ijng (pData); - if (!iRetcode) /* process it */ - iRetcode = mng_process_display_ijng (pData); - return iRetcode; -#else - return MNG_NOERROR; /* done */ -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_F_SPECIALFUNC (mng_drop_entries) -{ - mng_dropp pDROP = (mng_dropp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iX; - mng_uint32p pEntry; - /* check length */ - if ((iRawlen < 4) || ((iRawlen % 4) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - MNG_ALLOC (pData, pEntry, iRawlen); - pDROP->iCount = iRawlen / 4; - pDROP->pChunknames = (mng_ptr)pEntry; - - for (iX = pDROP->iCount; iX > 0; iX--) - { - *pEntry++ = mng_get_uint32 (pRawdata); - pRawdata += 4; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -MNG_C_SPECIALFUNC (mng_special_drop) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -MNG_C_SPECIALFUNC (mng_special_dbyk) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_F_SPECIALFUNC (mng_ordr_entries) -{ - mng_ordrp pORDR = (mng_ordrp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_uint32 iX; - mng_ordr_entryp pEntry; - /* check length */ - if ((iRawlen < 5) || ((iRawlen % 5) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - MNG_ALLOC (pData, pEntry, iRawlen); - pORDR->iCount = iRawlen / 5; - pORDR->pEntries = (mng_ptr)pEntry; - - for (iX = pORDR->iCount; iX > 0; iX--) - { - pEntry->iChunkname = mng_get_uint32 (pRawdata); - pEntry->iOrdertype = *(pRawdata+4); - pEntry++; - pRawdata += 5; - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -MNG_C_SPECIALFUNC (mng_special_ordr) -{ -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_F_SPECIALFUNC (mng_debunk_magn) -{ - mng_magnp pMAGN = (mng_magnp)pChunk; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_bool bFaulty; - /* check length */ - if (iRawlen > 20) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - /* following is an ugly hack to allow faulty layout caused by previous - versions of libmng and MNGeye, which wrote MAGN with a 16-bit - MethodX/MethodY (as opposed to the proper 8-bit as defined in the spec!) */ - - if ((iRawlen == 6) || (iRawlen == 8) || (iRawlen == 10) || (iRawlen == 12) || - (iRawlen == 14) || (iRawlen == 16) || (iRawlen == 20)) - bFaulty = MNG_TRUE; /* these lengths are all wrong */ - else /* length 18 can be right or wrong !!! */ - if ((iRawlen == 18) && (mng_get_uint16 (pRawdata+4) <= 5) && - (mng_get_uint16 (pRawdata+6) < 256) && - (mng_get_uint16 (pRawdata+8) < 256) && - (mng_get_uint16 (pRawdata+10) < 256) && - (mng_get_uint16 (pRawdata+12) < 256) && - (mng_get_uint16 (pRawdata+14) < 256) && - (mng_get_uint16 (pRawdata+16) < 256)) - bFaulty = MNG_TRUE; /* this is very likely the wrong layout */ - else - bFaulty = MNG_FALSE; /* all other cases are handled as right */ - - if (bFaulty) /* wrong layout ? */ - { - if (iRawlen > 0) /* get the fields */ - pMAGN->iFirstid = mng_get_uint16 (pRawdata); - else - pMAGN->iFirstid = 0; - - if (iRawlen > 2) - pMAGN->iLastid = mng_get_uint16 (pRawdata+2); - else - pMAGN->iLastid = pMAGN->iFirstid; - - if (iRawlen > 4) - pMAGN->iMethodX = (mng_uint8)(mng_get_uint16 (pRawdata+4)); - else - pMAGN->iMethodX = 0; - - if (iRawlen > 6) - pMAGN->iMX = mng_get_uint16 (pRawdata+6); - else - pMAGN->iMX = 1; - - if (iRawlen > 8) - pMAGN->iMY = mng_get_uint16 (pRawdata+8); - else - pMAGN->iMY = pMAGN->iMX; - - if (iRawlen > 10) - pMAGN->iML = mng_get_uint16 (pRawdata+10); - else - pMAGN->iML = pMAGN->iMX; - - if (iRawlen > 12) - pMAGN->iMR = mng_get_uint16 (pRawdata+12); - else - pMAGN->iMR = pMAGN->iMX; - - if (iRawlen > 14) - pMAGN->iMT = mng_get_uint16 (pRawdata+14); - else - pMAGN->iMT = pMAGN->iMY; - - if (iRawlen > 16) - pMAGN->iMB = mng_get_uint16 (pRawdata+16); - else - pMAGN->iMB = pMAGN->iMY; - - if (iRawlen > 18) - pMAGN->iMethodY = (mng_uint8)(mng_get_uint16 (pRawdata+18)); - else - pMAGN->iMethodY = pMAGN->iMethodX; - } - else /* proper layout !!!! */ - { - if (iRawlen > 0) /* get the fields */ - pMAGN->iFirstid = mng_get_uint16 (pRawdata); - else - pMAGN->iFirstid = 0; - - if (iRawlen > 2) - pMAGN->iLastid = mng_get_uint16 (pRawdata+2); - else - pMAGN->iLastid = pMAGN->iFirstid; - - if (iRawlen > 4) - pMAGN->iMethodX = *(pRawdata+4); - else - pMAGN->iMethodX = 0; - - if (iRawlen > 5) - pMAGN->iMX = mng_get_uint16 (pRawdata+5); - else - pMAGN->iMX = 1; - - if (iRawlen > 7) - pMAGN->iMY = mng_get_uint16 (pRawdata+7); - else - pMAGN->iMY = pMAGN->iMX; - - if (iRawlen > 9) - pMAGN->iML = mng_get_uint16 (pRawdata+9); - else - pMAGN->iML = pMAGN->iMX; - - if (iRawlen > 11) - pMAGN->iMR = mng_get_uint16 (pRawdata+11); - else - pMAGN->iMR = pMAGN->iMX; - - if (iRawlen > 13) - pMAGN->iMT = mng_get_uint16 (pRawdata+13); - else - pMAGN->iMT = pMAGN->iMY; - - if (iRawlen > 15) - pMAGN->iMB = mng_get_uint16 (pRawdata+15); - else - pMAGN->iMB = pMAGN->iMY; - - if (iRawlen > 17) - pMAGN->iMethodY = *(pRawdata+17); - else - pMAGN->iMethodY = pMAGN->iMethodX; - } - /* check field validity */ - if ((pMAGN->iMethodX > 5) || (pMAGN->iMethodY > 5)) - MNG_ERROR (pData, MNG_INVALIDMETHOD); - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -MNG_C_SPECIALFUNC (mng_special_magn) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ani_magn (pData, pChunk); -#else - return MNG_NOERROR; -#endif /* MNG_SUPPORT_DISPLAY */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -MNG_F_SPECIALFUNC (mng_evnt_entries) -{ - mng_evntp pEVNT = (mng_evntp)pChunk; - mng_uint32 iRawlen; - mng_uint8p pRawdata; -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) - mng_retcode iRetcode; -#endif - mng_uint8p pNull; - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iNamesize; - mng_uint32 iCount = 0; - mng_evnt_entryp pEntry = MNG_NULL; - mng_uint32 iX; - - for (iX = 0; iX < 2; iX++) - { - iRawlen = *piRawlen; - pRawdata = *ppRawdata; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_evnt_entry))); - pEVNT->iCount = iCount; - pEVNT->pEntries = pEntry; - } - - while (iRawlen) /* anything left ? */ - { - if (iRawlen < 2) /* must have at least 2 bytes ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iEventtype = *pRawdata; /* eventtype */ - if (iEventtype > 5) - MNG_ERROR (pData, MNG_INVALIDEVENT); - - pRawdata++; - - iMasktype = *pRawdata; /* masktype */ - if (iMasktype > 5) - MNG_ERROR (pData, MNG_INVALIDMASK); - - pRawdata++; - iRawlen -= 2; - - iLeft = 0; - iRight = 0; - iTop = 0; - iBottom = 0; - iObjectid = 0; - iIndex = 0; - - switch (iMasktype) - { - case 1 : - { - if (iRawlen > 16) - { - iLeft = mng_get_int32 (pRawdata); - iRight = mng_get_int32 (pRawdata+4); - iTop = mng_get_int32 (pRawdata+8); - iBottom = mng_get_int32 (pRawdata+12); - pRawdata += 16; - iRawlen -= 16; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 2 : - { - if (iRawlen > 2) - { - iObjectid = mng_get_uint16 (pRawdata); - pRawdata += 2; - iRawlen -= 2; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 3 : - { - if (iRawlen > 3) - { - iObjectid = mng_get_uint16 (pRawdata); - iIndex = *(pRawdata+2); - pRawdata += 3; - iRawlen -= 3; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 4 : - { - if (iRawlen > 18) - { - iLeft = mng_get_int32 (pRawdata); - iRight = mng_get_int32 (pRawdata+4); - iTop = mng_get_int32 (pRawdata+8); - iBottom = mng_get_int32 (pRawdata+12); - iObjectid = mng_get_uint16 (pRawdata+16); - pRawdata += 18; - iRawlen -= 18; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 5 : - { - if (iRawlen > 19) - { - iLeft = mng_get_int32 (pRawdata); - iRight = mng_get_int32 (pRawdata+4); - iTop = mng_get_int32 (pRawdata+8); - iBottom = mng_get_int32 (pRawdata+12); - iObjectid = mng_get_uint16 (pRawdata+16); - iIndex = *(pRawdata+18); - pRawdata += 19; - iRawlen -= 19; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - } - - pNull = pRawdata; /* get the name length */ - while (*pNull) - pNull++; - - if ((pNull - pRawdata) > (mng_int32)iRawlen) - { - iNamesize = iRawlen; /* no null found; so end of evNT */ - iRawlen = 0; - } - else - { - iNamesize = pNull - pRawdata; /* should be another entry */ - iRawlen = iRawlen - iNamesize - 1; - - if (!iRawlen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!iX) - { - iCount++; - } - else - { - pEntry->iEventtype = iEventtype; - pEntry->iMasktype = iMasktype; - pEntry->iLeft = iLeft; - pEntry->iRight = iRight; - pEntry->iTop = iTop; - pEntry->iBottom = iBottom; - pEntry->iObjectid = iObjectid; - pEntry->iIndex = iIndex; - pEntry->iSegmentnamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zSegmentname, iNamesize+1); - MNG_COPY (pEntry->zSegmentname, pRawdata, iNamesize); - } - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) - iRetcode = mng_create_event (pData, (mng_ptr)pEntry); - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - - pEntry++; - } - - pRawdata = pRawdata + iNamesize + 1; - } - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -MNG_C_SPECIALFUNC (mng_special_evnt) -{ - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_C_SPECIALFUNC (mng_special_mpng) -{ - if ((pData->eImagetype != mng_it_png) && (pData->eImagetype != mng_it_jng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_mpng_obj (pData, pChunk); -#else - return MNG_NOERROR; -#endif -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_C_SPECIALFUNC (mng_special_ahdr) -{ -#ifdef MNG_SUPPORT_DISPLAY - return mng_create_ang_obj (pData, pChunk); -#else - return MNG_NOERROR; -#endif -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_F_SPECIALFUNC (mng_adat_tiles) -{ - if ((pData->eImagetype != mng_it_ang) || (!pData->pANG)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - { - mng_adatp pADAT = (mng_adatp)pChunk; - mng_ang_objp pANG = (mng_ang_objp)pData->pANG; - mng_uint32 iRawlen = *piRawlen; - mng_uint8p pRawdata = *ppRawdata; - mng_retcode iRetcode; - mng_uint8p pBuf; - mng_uint32 iBufsize; - mng_uint32 iRealsize; - mng_uint8p pTemp; - mng_uint8p pTemp2; - mng_int32 iX; - mng_int32 iSize; - -#ifdef MNG_SUPPORT_DISPLAY - mng_imagep pImage; - mng_int32 iTemplen; - mng_uint8p pSwap; - - mng_processobject pProcess; - - mng_uint32 iSavedatawidth; - mng_uint32 iSavedataheight; - - mng_fptr fSaveinitrowproc; - mng_fptr fSavestorerow; - mng_fptr fSaveprocessrow; - mng_fptr fSavedifferrow; - mng_imagep fSavestoreobj; - mng_imagedatap fSavestorebuf; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - png_imgtype eSavepngimgtype; -#endif - - mng_uint8 iSaveinterlace; - mng_int8 iSavepass; - mng_int32 iSaverow; - mng_int32 iSaverowinc; - mng_int32 iSavecol; - mng_int32 iSavecolinc; - mng_int32 iSaverowsamples; - mng_int32 iSavesamplemul; - mng_int32 iSavesampleofs; - mng_int32 iSavesamplediv; - mng_int32 iSaverowsize; - mng_int32 iSaverowmax; - mng_int32 iSavefilterofs; - mng_int32 iSavepixelofs; - mng_uint32 iSavelevel0; - mng_uint32 iSavelevel1; - mng_uint32 iSavelevel2; - mng_uint32 iSavelevel3; - mng_uint8p pSaveworkrow; - mng_uint8p pSaveprevrow; - mng_uint8p pSaverGBArow; - mng_bool bSaveisRGBA16; - mng_bool bSaveisOpaque; - mng_int32 iSavefilterbpp; - - mng_int32 iSavedestl; - mng_int32 iSavedestt; - mng_int32 iSavedestr; - mng_int32 iSavedestb; - mng_int32 iSavesourcel; - mng_int32 iSavesourcet; - mng_int32 iSavesourcer; - mng_int32 iSavesourceb; -#endif /* MNG_SUPPORT_DISPLAY */ - - iRetcode = mng_inflate_buffer (pData, pRawdata, iRawlen, - &pBuf, &iBufsize, &iRealsize); - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - /* get buffer for tile info in ADAT chunk */ - pADAT->iTilessize = pANG->iNumframes * sizeof(mng_adat_tile); - MNG_ALLOCX (pData, pADAT->pTiles, pADAT->iTilessize); - if (!pADAT->pTiles) - { - pADAT->iTilessize = 0; - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - pTemp = pBuf; - pTemp2 = (mng_uint8p)pADAT->pTiles; - - if (!pANG->iStillused) - iSize = 12; - else - iSize = 13; - - for (iX = 0; iX < pANG->iNumframes; iX++) - { - MNG_COPY (pTemp2, pTemp, iSize); - pTemp += iSize; - pTemp2 += sizeof(mng_adat_tile); - } - -#ifdef MNG_SUPPORT_DISPLAY - /* get buffer for tile info in ANG object */ - pANG->iTilessize = pADAT->iTilessize; - MNG_ALLOCX (pData, pANG->pTiles, pANG->iTilessize); - if (!pANG->pTiles) - { - pANG->iTilessize = 0; - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* copy it from the ADAT object */ - MNG_COPY (pANG->pTiles, pADAT->pTiles, pANG->iTilessize); - - /* save IDAT work-parms */ - fSaveinitrowproc = pData->fInitrowproc; - fSavestorerow = pData->fDisplayrow; - fSaveprocessrow = pData->fProcessrow; - fSavedifferrow = pData->fDifferrow; - fSavestoreobj = pData->pStoreobj; - fSavestorebuf = pData->pStorebuf; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - eSavepngimgtype = pData->ePng_imgtype; -#endif - - iSavedatawidth = pData->iDatawidth; - iSavedataheight = pData->iDataheight; - iSaveinterlace = pData->iInterlace; - iSavepass = pData->iPass; - iSaverow = pData->iRow; - iSaverowinc = pData->iRowinc; - iSavecol = pData->iCol; - iSavecolinc = pData->iColinc; - iSaverowsamples = pData->iRowsamples; - iSavesamplemul = pData->iSamplemul; - iSavesampleofs = pData->iSampleofs; - iSavesamplediv = pData->iSamplediv; - iSaverowsize = pData->iRowsize; - iSaverowmax = pData->iRowmax; - iSavefilterofs = pData->iFilterofs; - iSavepixelofs = pData->iPixelofs; - iSavelevel0 = pData->iLevel0; - iSavelevel1 = pData->iLevel1; - iSavelevel2 = pData->iLevel2; - iSavelevel3 = pData->iLevel3; - pSaveworkrow = pData->pWorkrow; - pSaveprevrow = pData->pPrevrow; - pSaverGBArow = pData->pRGBArow; - bSaveisRGBA16 = pData->bIsRGBA16; - bSaveisOpaque = pData->bIsOpaque; - iSavefilterbpp = pData->iFilterbpp; - iSavedestl = pData->iDestl; - iSavedestt = pData->iDestt; - iSavedestr = pData->iDestr; - iSavedestb = pData->iDestb; - iSavesourcel = pData->iSourcel; - iSavesourcet = pData->iSourcet; - iSavesourcer = pData->iSourcer; - iSavesourceb = pData->iSourceb; - - pData->iDatawidth = pANG->iTilewidth; - pData->iDataheight = pANG->iTileheight; - - pData->iDestl = 0; - pData->iDestt = 0; - pData->iDestr = pANG->iTilewidth; - pData->iDestb = pANG->iTileheight; - pData->iSourcel = 0; - pData->iSourcet = 0; - pData->iSourcer = pANG->iTilewidth; - pData->iSourceb = pANG->iTileheight; - - pData->fInitrowproc = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - - /* clone image object to store the pixel-data from object 0 */ - iRetcode = mng_clone_imageobject (pData, 1, MNG_FALSE, MNG_FALSE, MNG_FALSE, - MNG_FALSE, 0, 0, 0, pData->pObjzero, &pImage); - if (iRetcode) /* on error, drop temp buffer and bail */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - /* make sure we got the right dimensions and interlacing */ - iRetcode = mng_reset_object_details (pData, pImage, pANG->iTilewidth, pANG->iTileheight, - pImage->pImgbuf->iBitdepth, pImage->pImgbuf->iColortype, - pImage->pImgbuf->iCompression, pImage->pImgbuf->iFilter, - pANG->iInterlace, MNG_FALSE); - if (iRetcode) /* on error, drop temp buffer and bail */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - pData->pStoreobj = pImage; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype = mng_png_imgtype(pData->iColortype,pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - { - switch (pData->iColortype) - { - case 0 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 1; - else - pData->iFilterofs = 2; - - break; - } - case 2 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 3; - else - pData->iFilterofs = 6; - - break; - } - case 3 : { - pData->iFilterofs = 1; - break; - } - case 4 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 2; - else - pData->iFilterofs = 4; - - break; - } - case 6 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 4; - else - pData->iFilterofs = 8; - - break; - } - } - } -#endif - -#ifdef FILTER193 /* no adaptive filtering ? */ - if (pData->iFilter == MNG_FILTER_NOFILTER) - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - - if (pData->fInitrowproc) /* need to initialize row processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - if (iRetcode) - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - /* calculate remainder of buffer */ - pTemp = pBuf + (mng_int32)(pANG->iNumframes * iSize); - iTemplen = iRealsize - (mng_int32)(pANG->iNumframes * iSize); - - do - { - if (iTemplen > pData->iRowmax) /* get a pixel-row from the temp buffer */ - { - MNG_COPY (pData->pWorkrow, pTemp, pData->iRowmax); - } - else - { - MNG_COPY (pData->pWorkrow, pTemp, iTemplen); - } - - { /* image not completed yet ? */ - if (pData->iRow < (mng_int32)pData->iDataheight) - { -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth == 1) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (pData->iRowsize+7)/8; - - for (iX = ((pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>7)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>6)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>5)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>3)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>1)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&1); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 2) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (2*pData->iRowsize+7)/8; - - for (iX = ((2*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (2*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>6)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&3); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 4) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (4*pData->iRowsize+7)/8; - - for (iX = ((4*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (4*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>4)&0x0f); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&0x0f); - if (iX-- <= 0) - break; - pSrc++; - } - } - if (pData->iPNGdepth < 8 && pData->iColortype == 0) - { - /* Expand samples to 8-bit by LBR */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - - for (iX = pData->iRowsize; iX > 0; iX--) - *pSrc++ *= multiplier[pData->iPNGdepth]; - } -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - { - /* Reduce Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc; - - for (iX = pData->iRowsize; iX > 0; iX--) - { - *pDest = *pSrc; - pDest++; - pSrc+=2; - } - } -#endif - -#ifdef FILTER192 /* has leveling info ? */ - if (pData->iFilterofs == MNG_FILTER_DIFFERING) - iRetcode = init_rowdiffering (pData); - else -#endif - iRetcode = MNG_NOERROR; - /* filter the row if necessary */ - if ((!iRetcode) && (pData->iFilterofs < pData->iPixelofs ) && - (*(pData->pWorkrow + pData->iFilterofs)) ) - iRetcode = mng_filter_a_row (pData); - - /* additional leveling/differing ? */ - if ((!iRetcode) && (pData->fDifferrow)) - { - iRetcode = ((mng_differrow)pData->fDifferrow) (pData); - - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* make sure we're processing the right data */ - } - - if (!iRetcode) - { - { /* process this row */ - if ((!iRetcode) && (pData->fProcessrow)) - iRetcode = ((mng_processrow)pData->fProcessrow) (pData); - /* store in object ? */ - if ((!iRetcode) && (pData->fStorerow)) - iRetcode = ((mng_storerow)pData->fStorerow) (pData); - } - } - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, iRetcode); - } - - if (!pData->fDifferrow) /* swap row-pointers */ - { - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* so prev points to the processed row! */ - } - /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, iRetcode); - } - } - } - - pTemp += pData->iRowmax; - iTemplen -= pData->iRowmax; - } /* until some error or EOI - or all pixels received */ - while ( (iTemplen > 0) && - ( (pData->iRow < (mng_int32)pData->iDataheight) || - ( (pData->iPass >= 0) && (pData->iPass < 7) ) ) ); - - mng_cleanup_rowproc (pData); /* cleanup row processing buffers !! */ - - /* restore saved work-parms */ - pData->iDatawidth = iSavedatawidth; - pData->iDataheight = iSavedataheight; - - pData->fInitrowproc = fSaveinitrowproc; - pData->fDisplayrow = fSavestorerow; - pData->fProcessrow = fSaveprocessrow; - pData->fDifferrow = fSavedifferrow; - pData->pStoreobj = fSavestoreobj; - pData->pStorebuf = fSavestorebuf; - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->ePng_imgtype = eSavepngimgtype; -#endif - - pData->iInterlace = iSaveinterlace; - pData->iPass = iSavepass; - pData->iRow = iSaverow; - pData->iRowinc = iSaverowinc; - pData->iCol = iSavecol; - pData->iColinc = iSavecolinc; - pData->iRowsamples = iSaverowsamples; - pData->iSamplemul = iSavesamplemul; - pData->iSampleofs = iSavesampleofs; - pData->iSamplediv = iSavesamplediv; - pData->iRowsize = iSaverowsize; - pData->iRowmax = iSaverowmax; - pData->iFilterofs = iSavefilterofs; - pData->iPixelofs = iSavepixelofs; - pData->iLevel0 = iSavelevel0; - pData->iLevel1 = iSavelevel1; - pData->iLevel2 = iSavelevel2; - pData->iLevel3 = iSavelevel3; - pData->pWorkrow = pSaveworkrow; - pData->pPrevrow = pSaveprevrow; - pData->pRGBArow = pSaverGBArow; - pData->bIsRGBA16 = bSaveisRGBA16; - pData->bIsOpaque = bSaveisOpaque; - pData->iFilterbpp = iSavefilterbpp; - pData->iDestl = iSavedestl; - pData->iDestt = iSavedestt; - pData->iDestr = iSavedestr; - pData->iDestb = iSavedestb; - pData->iSourcel = iSavesourcel; - pData->iSourcet = iSavesourcet; - pData->iSourcer = iSavesourcer; - pData->iSourceb = iSavesourceb; - - /* create the animation directives ! */ - pProcess = (mng_processobject)pANG->sHeader.fProcess; - iRetcode = pProcess (pData, (mng_objectp)pData->pANG); - if (iRetcode) - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - - MNG_FREE (pData, pBuf, iBufsize); /* always free the temp buffer ! */ - } - - *piRawlen = 0; - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -MNG_C_SPECIALFUNC (mng_special_adat) -{ - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -MNG_C_SPECIALFUNC (mng_special_unknown) -{ - /* critical chunk ? */ - if ((((mng_uint32)pData->iChunkname & 0x20000000) == 0) -#ifdef MNG_SKIPCHUNK_SAVE - && (pData->iChunkname != MNG_UINT_SAVE) -#endif -#ifdef MNG_SKIPCHUNK_SEEK - && (pData->iChunkname != MNG_UINT_SEEK) -#endif -#ifdef MNG_SKIPCHUNK_DBYK - && (pData->iChunkname != MNG_UINT_DBYK) -#endif -#ifdef MNG_SKIPCHUNK_ORDR - && (pData->iChunkname != MNG_UINT_ORDR) -#endif - ) - MNG_ERROR (pData, MNG_UNKNOWNCRITICAL); - - if (pData->fProcessunknown) /* let the app handle it ? */ - { - mng_bool bOke = pData->fProcessunknown ((mng_handle)pData, pData->iChunkname, - ((mng_unknown_chunkp)pChunk)->iDatasize, - ((mng_unknown_chunkp)pChunk)->pData); - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS || MNG_INCLUDE_WRITE_PROCS */ -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - - - diff --git a/Engine/lib/lmng/libmng_chunk_descr.h b/Engine/lib/lmng/libmng_chunk_descr.h deleted file mode 100644 index 3781ab052..000000000 --- a/Engine/lib/lmng/libmng_chunk_descr.h +++ /dev/null @@ -1,146 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_descr.h copyright (c) 2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk descriptor functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : definition of the chunk- anf field-descriptor routines * */ -/* * * */ -/* * changes : 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunk_descr_h_ -#define _libmng_chunk_descr_h_ - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER -#if defined(MNG_INCLUDE_READ_PROCS) || defined(MNG_INCLUDE_WRITE_PROCS) - -/* ************************************************************************** */ - -void mng_get_chunkheader (mng_chunkid iChunkname, - mng_chunk_headerp pResult); - -/* ************************************************************************** */ - -#define MNG_F_SPECIALFUNC(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunk, \ - mng_uint32* piRawlen, \ - mng_uint8p* ppRawdata) - -MNG_F_SPECIALFUNC (mng_debunk_plte) ; -MNG_F_SPECIALFUNC (mng_debunk_trns) ; -MNG_F_SPECIALFUNC (mng_deflate_itxt) ; -MNG_F_SPECIALFUNC (mng_splt_entries) ; -MNG_F_SPECIALFUNC (mng_hist_entries) ; - -MNG_F_SPECIALFUNC (mng_debunk_loop) ; -MNG_F_SPECIALFUNC (mng_debunk_past) ; -MNG_F_SPECIALFUNC (mng_disc_entries) ; -MNG_F_SPECIALFUNC (mng_fram_remainder) ; -MNG_F_SPECIALFUNC (mng_save_entries) ; -MNG_F_SPECIALFUNC (mng_pplt_entries) ; -MNG_F_SPECIALFUNC (mng_drop_entries) ; -MNG_F_SPECIALFUNC (mng_ordr_entries) ; -MNG_F_SPECIALFUNC (mng_debunk_magn) ; -MNG_F_SPECIALFUNC (mng_evnt_entries) ; -MNG_F_SPECIALFUNC (mng_adat_tiles) ; - -/* ************************************************************************** */ - -#define MNG_C_SPECIALFUNC(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunk) - -MNG_C_SPECIALFUNC (mng_special_ihdr) ; -MNG_C_SPECIALFUNC (mng_special_plte) ; -MNG_C_SPECIALFUNC (mng_special_idat) ; -MNG_C_SPECIALFUNC (mng_special_iend) ; -MNG_C_SPECIALFUNC (mng_special_trns) ; -MNG_C_SPECIALFUNC (mng_special_gama) ; -MNG_C_SPECIALFUNC (mng_special_chrm) ; -MNG_C_SPECIALFUNC (mng_special_srgb) ; -MNG_C_SPECIALFUNC (mng_special_iccp) ; -MNG_C_SPECIALFUNC (mng_special_text) ; -MNG_C_SPECIALFUNC (mng_special_ztxt) ; -MNG_C_SPECIALFUNC (mng_special_itxt) ; -MNG_C_SPECIALFUNC (mng_special_bkgd) ; -MNG_C_SPECIALFUNC (mng_special_phys) ; -MNG_C_SPECIALFUNC (mng_special_sbit) ; -MNG_C_SPECIALFUNC (mng_special_splt) ; -MNG_C_SPECIALFUNC (mng_special_hist) ; -MNG_C_SPECIALFUNC (mng_special_time) ; - -MNG_C_SPECIALFUNC (mng_special_jhdr) ; -MNG_C_SPECIALFUNC (mng_special_jdaa) ; -MNG_C_SPECIALFUNC (mng_special_jdat) ; -MNG_C_SPECIALFUNC (mng_special_jsep) ; - -MNG_C_SPECIALFUNC (mng_special_mhdr) ; -MNG_C_SPECIALFUNC (mng_special_mend) ; -MNG_C_SPECIALFUNC (mng_special_loop) ; -MNG_C_SPECIALFUNC (mng_special_endl) ; -MNG_C_SPECIALFUNC (mng_special_defi) ; -MNG_C_SPECIALFUNC (mng_special_basi) ; -MNG_C_SPECIALFUNC (mng_special_clon) ; -MNG_C_SPECIALFUNC (mng_special_past) ; -MNG_C_SPECIALFUNC (mng_special_disc) ; -MNG_C_SPECIALFUNC (mng_special_back) ; -MNG_C_SPECIALFUNC (mng_special_fram) ; -MNG_C_SPECIALFUNC (mng_special_move) ; -MNG_C_SPECIALFUNC (mng_special_clip) ; -MNG_C_SPECIALFUNC (mng_special_show) ; -MNG_C_SPECIALFUNC (mng_special_term) ; -MNG_C_SPECIALFUNC (mng_special_save) ; -MNG_C_SPECIALFUNC (mng_special_seek) ; -MNG_C_SPECIALFUNC (mng_special_expi) ; -MNG_C_SPECIALFUNC (mng_special_fpri) ; -MNG_C_SPECIALFUNC (mng_special_need) ; -MNG_C_SPECIALFUNC (mng_special_phyg) ; - -MNG_C_SPECIALFUNC (mng_special_dhdr) ; -MNG_C_SPECIALFUNC (mng_special_prom) ; -MNG_C_SPECIALFUNC (mng_special_ipng) ; -MNG_C_SPECIALFUNC (mng_special_pplt) ; -MNG_C_SPECIALFUNC (mng_special_ijng) ; -MNG_C_SPECIALFUNC (mng_special_drop) ; -MNG_C_SPECIALFUNC (mng_special_dbyk) ; -MNG_C_SPECIALFUNC (mng_special_ordr) ; - -MNG_C_SPECIALFUNC (mng_special_magn) ; -MNG_C_SPECIALFUNC (mng_special_evnt) ; -MNG_C_SPECIALFUNC (mng_special_mpng) ; -MNG_C_SPECIALFUNC (mng_special_ahdr) ; -MNG_C_SPECIALFUNC (mng_special_adat) ; -MNG_C_SPECIALFUNC (mng_special_unknown) ; - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS) || MNG_INCLUDE_WRITE_PROCS */ -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#endif /* _libmng_chunk_descr_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_chunk_io.c b/Engine/lib/lmng/libmng_chunk_io.c deleted file mode 100644 index eb18099fd..000000000 --- a/Engine/lib/lmng/libmng_chunk_io.c +++ /dev/null @@ -1,10740 +0,0 @@ -/** ************************************************************************* */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_io.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk I/O routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of chunk input/output routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/01/2000 - G.Juyn * */ -/* * - cleaned up left-over teststuff in the BACK chunk routine * */ -/* * 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - changed CRC initialization to use dynamic structure * */ -/* * (wasn't thread-safe the old way !) * */ -/* * 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - filled in many missing sequence&length checks * */ -/* * - filled in many missing chunk-store snippets * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added checks for running animations * */ -/* * - filled some write routines * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/10/2000 - G.Juyn * */ -/* * - filled some more write routines * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - filled remaining write routines * */ -/* * - fixed read_pplt with regard to deltatype * */ -/* * - added callback error-reporting support * */ -/* * - added pre-draft48 support (short MHDR, frame_mode, LOOP) * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * - fixed chunk-storage bit in several routines * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * - supplemented the SAVE & SEEK display processing * */ -/* * * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - B004 - fixed problem with MNG_SUPPORT_WRITE not defined * */ -/* * also for MNG_SUPPORT_WRITE without MNG_INCLUDE_JNG * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - cleaned up some code regarding mixed support * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - implemented JNG support * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for global color-chunks in animation * */ -/* * - added support for global PLTE,tRNS,bKGD in animation * */ -/* * - added support for SAVE & SEEK in animation * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - changed ani_create calls not returning object pointer * */ -/* * - create ani objects always (not just inside TERM/LOOP) * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added support for delta-image processing * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * * */ -/* * 0.5.3 - 06/12/2000 - G.Juyn * */ -/* * - added processing of color-info on delta-image * */ -/* * 0.5.3 - 06/13/2000 - G.Juyn * */ -/* * - fixed handling of empty SAVE chunk * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed to support delta-images * */ -/* * - added extra checks for delta-images * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed possible trouble if IEND display-process got * */ -/* * broken up * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added processing of PLTE & tRNS for delta-images * */ -/* * - added administration of imagelevel parameter * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - implemented support for PPLT chunk * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - added precaution against faulty iCCP chunks from PS * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed some 64-bit warnings * */ -/* * * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed pre-draft48 frame_mode=3 to frame_mode=1 * */ -/* * 0.9.1 - 07/16/2000 - G.Juyn * */ -/* * - fixed storage of images during mng_read() * */ -/* * - fixed support for mng_display() after mng_read() * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed several chunk-writing routines * */ -/* * 0.9.1 - 07/24/2000 - G.Juyn * */ -/* * - fixed reading of still-images * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/08/2000 - G.Juyn * */ -/* * - fixed compiler-warnings from Mozilla * */ -/* * 0.9.3 - 08/09/2000 - G.Juyn * */ -/* * - added check for simplicity-bits in MHDR * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - fixed check for simplicity-bits in MHDR (JNG) * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 08/22/2000 - G.Juyn * */ -/* * - fixed write-code for zTXt & iTXt * */ -/* * - fixed read-code for iTXt * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/02/2000 - G.Juyn * */ -/* * - fixed simplicity-check in compliance with draft 81/0.98a * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - fixed support for MAGN * */ -/* * - implemented nEED "xxxx" (where "xxxx" is a chunkid) * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/23/2000 - G.Juyn * */ -/* * - fixed bug in empty PLTE handling * */ -/* * * */ -/* * 0.9.4 - 11/20/2000 - G.Juyn * */ -/* * - changed IHDR filter_method check for PNGs * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added errorchecking for MAGN methods * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * * */ -/* * 0.9.5 - 1/25/2001 - G.Juyn * */ -/* * - fixed some small compiler warnings (thanks Nikki) * */ -/* * * */ -/* * 1.0.2 - 05/05/2000 - G.Juyn * */ -/* * - B421427 - writes wrong format in bKGD and tRNS * */ -/* * 1.0.2 - 06/20/2000 - G.Juyn * */ -/* * - B434583 - compiler-warning if MNG_STORE_CHUNKS undefined * */ -/* * * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/07/2002 - G.Juyn * */ -/* * - fixed reading of FRAM with just frame_mode and name * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - misplaced TERM is now treated as warning * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 10/03/2002 - G.Juyn * */ -/* * - fixed chunk-storage for evNT chunk * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * 1.0.5 - 10/17/2002 - G.Juyn * */ -/* * - fixed initializtion of pIds in dISC read routine * */ -/* * 1.0.5 - 11/06/2002 - G.Juyn * */ -/* * - added support for nEED "MNG 1.1" * */ -/* * - added support for nEED "CACHEOFF" * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 06/02/2003 - G.R-P * */ -/* * - removed some redundant checks for iRawlen==0 * */ -/* * 1.0.6 - 06/22/2003 - G.R-P * */ -/* * - added MNG_NO_16BIT_SUPPORT, MNG_NO_DELTA_PNG reductions * */ -/* * - optionally use zlib's crc32 function instead of * */ -/* * local mng_update_crc * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 10/29/2003 - G.R-P * */ -/* * - revised JDAA and JDAT readers to avoid compiler bug * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 01/27/2004 - J.S * */ -/* * - fixed inclusion of IJNG chunk for non-JNG use * */ -/* * 1.0.7 - 02/26/2004 - G.Juyn * */ -/* * - fixed bug in chunk-storage of SHOW chunk (from == to) * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 07/07/2004 - G.R-P * */ -/* * - change worst-case iAlphadepth to 1 for standalone PNGs * */ -/* * * */ -/* * 1.0.9 - 09/28/2004 - G.R-P * */ -/* * - improved handling of cheap transparency when 16-bit * */ -/* * support is disabled * */ -/* * 1.0.9 - 10/04/2004 - G.Juyn * */ -/* * - fixed bug in writing sBIT for indexed color * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * 1.0.9 - 12/07/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * 1.0.9 - 01/17/2005 - G.Juyn * */ -/* * - fixed problem with global PLTE/tRNS * */ -/* * * */ -/* * 1.0.10 - 02/07/2005 - G.Juyn * */ -/* * - fixed display routines called twice for FULL_MNG * */ -/* * support in mozlibmngconf.h * */ -/* * 1.0.10 - 12/04/2005 - G.R-P. * */ -/* * - #ifdef out use of mng_inflate_buffer when it is not * */ -/* * available. * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * 1.0.10 - 05/02/2007 - G.Juyn * */ -/* * - fixed inflate_buffer for extreme compression ratios * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_chunks.h" -#ifdef MNG_CHECK_BAD_ICCP -#include "libmng_chunk_prc.h" -#endif -#include "libmng_memory.h" -#include "libmng_display.h" -#include "libmng_zlib.h" -#include "libmng_pixels.h" -#include "libmng_chunk_io.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * CRC - Cyclic Redundancy Check * */ -/* * * */ -/* * The code below is taken directly from the sample provided with the * */ -/* * PNG specification. * */ -/* * (it is only adapted to the library's internal data-definitions) * */ -/* * * */ -/* ************************************************************************** */ -/* Make the table for a fast CRC. */ -#ifndef MNG_USE_ZLIB_CRC -MNG_LOCAL void make_crc_table (mng_datap pData) -{ - mng_uint32 iC; - mng_int32 iN, iK; - - for (iN = 0; iN < 256; iN++) - { - iC = (mng_uint32) iN; - - for (iK = 0; iK < 8; iK++) - { - if (iC & 1) - iC = 0xedb88320U ^ (iC >> 1); - else - iC = iC >> 1; - } - - pData->aCRCtable [iN] = iC; - } - - pData->bCRCcomputed = MNG_TRUE; -} -#endif - -/* Update a running CRC with the bytes buf[0..len-1]--the CRC - should be initialized to all 1's, and the transmitted value - is the 1's complement of the final running CRC (see the - crc() routine below). */ - -MNG_LOCAL mng_uint32 update_crc (mng_datap pData, - mng_uint32 iCrc, - mng_uint8p pBuf, - mng_int32 iLen) -{ -#ifdef MNG_USE_ZLIB_CRC - return crc32 (iCrc, pBuf, iLen); -#else - mng_uint32 iC = iCrc; - mng_int32 iN; - - if (!pData->bCRCcomputed) - make_crc_table (pData); - - for (iN = 0; iN < iLen; iN++) - iC = pData->aCRCtable [(iC ^ pBuf [iN]) & 0xff] ^ (iC >> 8); - - return iC; -#endif -} - -/* Return the CRC of the bytes buf[0..len-1]. */ -mng_uint32 mng_crc (mng_datap pData, - mng_uint8p pBuf, - mng_int32 iLen) -{ -#ifdef MNG_USE_ZLIB_CRC - return update_crc (pData, 0, pBuf, iLen); -#else - return update_crc (pData, 0xffffffffU, pBuf, iLen) ^ 0xffffffffU; -#endif -} - -/* ************************************************************************** */ -/* * * */ -/* * Routines for swapping byte-order from and to graphic files * */ -/* * (This code is adapted from the libpng package) * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_BIGENDIAN_SUPPORTED - -/* ************************************************************************** */ - -mng_uint32 mng_get_uint32 (mng_uint8p pBuf) -{ - mng_uint32 i = ((mng_uint32)(*pBuf) << 24) + - ((mng_uint32)(*(pBuf + 1)) << 16) + - ((mng_uint32)(*(pBuf + 2)) << 8) + - (mng_uint32)(*(pBuf + 3)); - return (i); -} - -/* ************************************************************************** */ - -mng_int32 mng_get_int32 (mng_uint8p pBuf) -{ - mng_int32 i = ((mng_int32)(*pBuf) << 24) + - ((mng_int32)(*(pBuf + 1)) << 16) + - ((mng_int32)(*(pBuf + 2)) << 8) + - (mng_int32)(*(pBuf + 3)); - return (i); -} - -/* ************************************************************************** */ - -mng_uint16 mng_get_uint16 (mng_uint8p pBuf) -{ - mng_uint16 i = (mng_uint16)(((mng_uint16)(*pBuf) << 8) + - (mng_uint16)(*(pBuf + 1))); - return (i); -} - -/* ************************************************************************** */ - -void mng_put_uint32 (mng_uint8p pBuf, - mng_uint32 i) -{ - *pBuf = (mng_uint8)((i >> 24) & 0xff); - *(pBuf+1) = (mng_uint8)((i >> 16) & 0xff); - *(pBuf+2) = (mng_uint8)((i >> 8) & 0xff); - *(pBuf+3) = (mng_uint8)(i & 0xff); -} - -/* ************************************************************************** */ - -void mng_put_int32 (mng_uint8p pBuf, - mng_int32 i) -{ - *pBuf = (mng_uint8)((i >> 24) & 0xff); - *(pBuf+1) = (mng_uint8)((i >> 16) & 0xff); - *(pBuf+2) = (mng_uint8)((i >> 8) & 0xff); - *(pBuf+3) = (mng_uint8)(i & 0xff); -} - -/* ************************************************************************** */ - -void mng_put_uint16 (mng_uint8p pBuf, - mng_uint16 i) -{ - *pBuf = (mng_uint8)((i >> 8) & 0xff); - *(pBuf+1) = (mng_uint8)(i & 0xff); -} - -/* ************************************************************************** */ - -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - -/* ************************************************************************** */ -/* * * */ -/* * Helper routines to simplify chunk-data extraction * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -MNG_LOCAL mng_uint8p find_null (mng_uint8p pIn) -{ - mng_uint8p pOut = pIn; - while (*pOut) /* the read_graphic routine has made sure there's */ - pOut++; /* always at least 1 zero-byte in the buffer */ - return pOut; -} -#endif - -/* ************************************************************************** */ - -#if !defined(MNG_SKIPCHUNK_iCCP) || !defined(MNG_SKIPCHUNK_zTXt) || \ - !defined(MNG_SKIPCHUNK_iTXt) || defined(MNG_INCLUDE_MPNG_PROPOSAL) || \ - defined(MNG_INCLUDE_ANG_PROPOSAL) -mng_retcode mng_inflate_buffer (mng_datap pData, - mng_uint8p pInbuf, - mng_uint32 iInsize, - mng_uint8p *pOutbuf, - mng_uint32 *iOutsize, - mng_uint32 *iRealsize) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INFLATE_BUFFER, MNG_LC_START); -#endif - - if (iInsize) /* anything to do ? */ - { - *iOutsize = iInsize * 3; /* estimate uncompressed size */ - /* and allocate a temporary buffer */ - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - - do - { - mngzlib_inflateinit (pData); /* initialize zlib */ - /* let zlib know where to store the output */ - pData->sZlib.next_out = *pOutbuf; - /* "size - 1" so we've got space for the - zero-termination of a possible string */ - pData->sZlib.avail_out = *iOutsize - 1; - /* ok; let's inflate... */ - iRetcode = mngzlib_inflatedata (pData, iInsize, pInbuf); - /* determine actual output size */ - *iRealsize = (mng_uint32)pData->sZlib.total_out; - - mngzlib_inflatefree (pData); /* zlib's done */ - - if (iRetcode == MNG_BUFOVERFLOW) /* not enough space ? */ - { /* then get some more */ - MNG_FREEX (pData, *pOutbuf, *iOutsize); - *iOutsize = *iOutsize + *iOutsize; - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - } - } /* repeat if we didn't have enough space */ - while ((iRetcode == MNG_BUFOVERFLOW) && - (*iOutsize < 200 * iInsize)); - - if (!iRetcode) /* if oke ? */ - *((*pOutbuf) + *iRealsize) = 0; /* then put terminator zero */ - - } - else - { - *pOutbuf = 0; /* nothing to do; then there's no output */ - *iOutsize = 0; - *iRealsize = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INFLATE_BUFFER, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ -/* * * */ -/* * Helper routines to simplify chunk writing * */ -/* * * */ -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_WRITE_PROCS -/* ************************************************************************** */ - -#if !defined(MNG_SKIPCHUNK_iCCP) || !defined(MNG_SKIPCHUNK_zTXt) || !defined(MNG_SKIPCHUNK_iTXt) -MNG_LOCAL mng_retcode deflate_buffer (mng_datap pData, - mng_uint8p pInbuf, - mng_uint32 iInsize, - mng_uint8p *pOutbuf, - mng_uint32 *iOutsize, - mng_uint32 *iRealsize) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DEFLATE_BUFFER, MNG_LC_START); -#endif - - if (iInsize) /* anything to do ? */ - { - *iOutsize = (iInsize * 5) >> 2; /* estimate compressed size */ - /* and allocate a temporary buffer */ - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - - do - { - mngzlib_deflateinit (pData); /* initialize zlib */ - /* let zlib know where to store the output */ - pData->sZlib.next_out = *pOutbuf; - pData->sZlib.avail_out = *iOutsize; - /* ok; let's deflate... */ - iRetcode = mngzlib_deflatedata (pData, iInsize, pInbuf); - /* determine actual output size */ - *iRealsize = pData->sZlib.total_out; - - mngzlib_deflatefree (pData); /* zlib's done */ - - if (iRetcode == MNG_BUFOVERFLOW) /* not enough space ? */ - { /* then get some more */ - MNG_FREEX (pData, *pOutbuf, *iOutsize); - *iOutsize = *iOutsize + (iInsize >> 1); - MNG_ALLOC (pData, *pOutbuf, *iOutsize); - } - } /* repeat if we didn't have enough space */ - while (iRetcode == MNG_BUFOVERFLOW); - } - else - { - *pOutbuf = 0; /* nothing to do; then there's no output */ - *iOutsize = 0; - *iRealsize = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DEFLATE_BUFFER, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode write_raw_chunk (mng_datap pData, - mng_chunkid iChunkname, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -{ - mng_uint32 iCrc; - mng_uint32 iWritten; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_RAW_CHUNK, MNG_LC_START); -#endif - /* temporary buffer ? */ - if ((pRawdata != 0) && (pRawdata != pData->pWritebuf+8)) - { /* store length & chunktype in default buffer */ - mng_put_uint32 (pData->pWritebuf, iRawlen); - mng_put_uint32 (pData->pWritebuf+4, (mng_uint32)iChunkname); - - if (pData->iCrcmode & MNG_CRC_OUTPUT) - { - if ((pData->iCrcmode & MNG_CRC_OUTPUT) == MNG_CRC_OUTPUT_GENERATE) - { /* calculate the crc */ - iCrc = update_crc (pData, 0xffffffffL, pData->pWritebuf+4, 4); - iCrc = update_crc (pData, iCrc, pRawdata, iRawlen) ^ 0xffffffffL; - } else { - iCrc = 0; /* dummy crc */ - } /* store in default buffer */ - mng_put_uint32 (pData->pWritebuf+8, iCrc); - } - /* write the length & chunktype */ - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, 8, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != 8) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - /* write the temporary buffer */ - if (!pData->fWritedata ((mng_handle)pData, pRawdata, iRawlen, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != iRawlen) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - - if (pData->iCrcmode & MNG_CRC_OUTPUT) - { /* write the crc */ - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf+8, 4, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != 4) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - } - } - else - { /* prefix with length & chunktype */ - mng_put_uint32 (pData->pWritebuf, iRawlen); - mng_put_uint32 (pData->pWritebuf+4, (mng_uint32)iChunkname); - - if (pData->iCrcmode & MNG_CRC_OUTPUT) - { - if ((pData->iCrcmode & MNG_CRC_OUTPUT) == MNG_CRC_OUTPUT_GENERATE) - /* calculate the crc */ - iCrc = mng_crc (pData, pData->pWritebuf+4, iRawlen + 4); - else - iCrc = 0; /* dummy crc */ - /* add it to the buffer */ - mng_put_uint32 (pData->pWritebuf + iRawlen + 8, iCrc); - /* write it in a single pass */ - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, iRawlen + 12, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != iRawlen + 12) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - } else { - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, iRawlen + 8, &iWritten)) - MNG_ERROR (pData, MNG_APPIOERROR); - - if (iWritten != iRawlen + 8) /* disk full ? */ - MNG_ERROR (pData, MNG_OUTPUTERROR); - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_RAW_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* B004 */ -#endif /* MNG_INCLUDE_WRITE_PROCS */ -/* B004 */ -/* ************************************************************************** */ -/* * * */ -/* * chunk read functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode create_chunk_storage (mng_datap pData, - mng_chunkp pHeader, - mng_uint32 iRawlen, - mng_uint8p pRawdata, - mng_field_descp pField, - mng_uint16 iFields, - mng_chunkp* ppChunk, - mng_bool bWorkcopy) -{ - mng_field_descp pTempfield = pField; - mng_uint16 iFieldcount = iFields; - mng_uint8p pTempdata = pRawdata; - mng_uint32 iTemplen = iRawlen; - mng_uint16 iLastgroup = 0; - mng_uint8p pChunkdata; - mng_uint32 iDatalen; - mng_uint8 iColortype; - mng_bool bProcess; - /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (((mng_chunk_headerp)(*ppChunk))->iChunkname == MNG_UINT_HUH) - ((mng_chunk_headerp)(*ppChunk))->iChunkname = pData->iChunkname; - - if ((!bWorkcopy) || - ((((mng_chunk_headerp)pHeader)->iChunkname != MNG_UINT_IDAT) && - (((mng_chunk_headerp)pHeader)->iChunkname != MNG_UINT_JDAT) && - (((mng_chunk_headerp)pHeader)->iChunkname != MNG_UINT_JDAA) )) - { - pChunkdata = (mng_uint8p)(*ppChunk); - -#ifdef MNG_INCLUDE_JNG /* determine current colortype */ - if (pData->bHasJHDR) - iColortype = (mng_uint8)(pData->iJHDRcolortype - 8); - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - iColortype = pData->iColortype; - else - iColortype = 6; - - if (iTemplen) /* not empty ? */ - { /* then go fill the fields */ - while ((iFieldcount) && (iTemplen)) - { - if (pTempfield->iOffsetchunk) - { - if (pTempfield->iFlags & MNG_FIELD_PUTIMGTYPE) - { - *(pChunkdata+pTempfield->iOffsetchunk) = iColortype; - bProcess = MNG_FALSE; - } - else - if (pTempfield->iFlags & MNG_FIELD_IFIMGTYPES) - bProcess = (mng_bool)(((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE0) && (iColortype == 0)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE2) && (iColortype == 2)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE3) && (iColortype == 3)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE4) && (iColortype == 4)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE6) && (iColortype == 6)) ); - else - bProcess = MNG_TRUE; - - if (bProcess) - { - iLastgroup = (mng_uint16)(pTempfield->iFlags & MNG_FIELD_GROUPMASK); - /* numeric field ? */ - if (pTempfield->iFlags & MNG_FIELD_INT) - { - if (iTemplen < pTempfield->iLengthmax) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - switch (pTempfield->iLengthmax) - { - case 1 : { mng_uint8 iNum = *pTempdata; - if (((mng_uint16)iNum < pTempfield->iMinvalue) || - ((mng_uint16)iNum > pTempfield->iMaxvalue) ) - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - *(pChunkdata+pTempfield->iOffsetchunk) = iNum; - break; } - case 2 : { mng_uint16 iNum = mng_get_uint16 (pTempdata); - if ((iNum < pTempfield->iMinvalue) || (iNum > pTempfield->iMaxvalue)) - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - *((mng_uint16p)(pChunkdata+pTempfield->iOffsetchunk)) = iNum; - break; } - case 4 : { mng_uint32 iNum = mng_get_uint32 (pTempdata); - if ((iNum < pTempfield->iMinvalue) || - ((pTempfield->iFlags & MNG_FIELD_NOHIGHBIT) && (iNum & 0x80000000)) ) - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunk)) = iNum; - break; } - } - - pTempdata += pTempfield->iLengthmax; - iTemplen -= pTempfield->iLengthmax; - - } else { /* not numeric so it's a bunch of bytes */ - - if (!pTempfield->iOffsetchunklen) /* big fat NONO */ - MNG_ERROR (pData, MNG_INTERNALERROR); - /* with terminating 0 ? */ - if (pTempfield->iFlags & MNG_FIELD_TERMINATOR) - { - mng_uint8p pWork = pTempdata; - while (*pWork) /* find the zero */ - pWork++; - iDatalen = (mng_uint32)(pWork - pTempdata); - } else { /* no terminator, so everything that's left ! */ - iDatalen = iTemplen; - } - - if ((pTempfield->iLengthmax) && (iDatalen > pTempfield->iLengthmax)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); -#if !defined(MNG_SKIPCHUNK_iCCP) || !defined(MNG_SKIPCHUNK_zTXt) || \ - !defined(MNG_SKIPCHUNK_iTXt) || defined(MNG_INCLUDE_MPNG_PROPOSAL) || \ - defined(MNG_INCLUDE_ANG_PROPOSAL) - /* needs decompression ? */ - if (pTempfield->iFlags & MNG_FIELD_DEFLATED) - { - mng_uint8p pBuf = 0; - mng_uint32 iBufsize = 0; - mng_uint32 iRealsize; - mng_ptr pWork; - - iRetcode = mng_inflate_buffer (pData, pTempdata, iDatalen, - &pBuf, &iBufsize, &iRealsize); - -#ifdef MNG_CHECK_BAD_ICCP /* Check for bad iCCP chunk */ - if ((iRetcode) && (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_iCCP)) - { - *((mng_ptr *)(pChunkdata+pTempfield->iOffsetchunk)) = MNG_NULL; - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunklen)) = iDatalen; - } - else -#endif - { - if (iRetcode) - return iRetcode; - -#if defined(MNG_INCLUDE_MPNG_PROPOSAL) || defined(MNG_INCLUDE_ANG_PROPOSAL) - if ( (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_mpNG) || - (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_adAT) ) - { - MNG_ALLOC (pData, pWork, iRealsize); - } - else - { -#endif - /* don't forget to generate null terminator */ - MNG_ALLOC (pData, pWork, iRealsize+1); -#if defined(MNG_INCLUDE_MPNG_PROPOSAL) || defined(MNG_INCLUDE_ANG_PROPOSAL) - } -#endif - MNG_COPY (pWork, pBuf, iRealsize); - - *((mng_ptr *)(pChunkdata+pTempfield->iOffsetchunk)) = pWork; - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunklen)) = iRealsize; - } - - if (pBuf) /* free the temporary buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - - } else -#endif - { /* no decompression, so just copy */ - - mng_ptr pWork; - /* don't forget to generate null terminator */ - MNG_ALLOC (pData, pWork, iDatalen+1); - MNG_COPY (pWork, pTempdata, iDatalen); - - *((mng_ptr *)(pChunkdata+pTempfield->iOffsetchunk)) = pWork; - *((mng_uint32p)(pChunkdata+pTempfield->iOffsetchunklen)) = iDatalen; - } - - if (pTempfield->iFlags & MNG_FIELD_TERMINATOR) - iDatalen++; /* skip the terminating zero as well !!! */ - - iTemplen -= iDatalen; - pTempdata += iDatalen; - } - /* need to set an indicator ? */ - if (pTempfield->iOffsetchunkind) - *((mng_uint8p)(pChunkdata+pTempfield->iOffsetchunkind)) = MNG_TRUE; - } - } - - if (pTempfield->pSpecialfunc) /* special function required ? */ - { - iRetcode = pTempfield->pSpecialfunc(pData, *ppChunk, &iTemplen, &pTempdata); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - pTempfield++; /* Neeeeeeexxxtt */ - iFieldcount--; - } - - if (iTemplen) /* extra data ??? */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - while (iFieldcount) /* not enough data ??? */ - { - if (pTempfield->iFlags & MNG_FIELD_IFIMGTYPES) - bProcess = (mng_bool)(((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE0) && (iColortype == 0)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE2) && (iColortype == 2)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE3) && (iColortype == 3)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE4) && (iColortype == 4)) || - ((pTempfield->iFlags & MNG_FIELD_IFIMGTYPE6) && (iColortype == 6)) ); - else - bProcess = MNG_TRUE; - - if (bProcess) - { - if (!(pTempfield->iFlags & MNG_FIELD_OPTIONAL)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - if ((pTempfield->iFlags & MNG_FIELD_GROUPMASK) && - ((mng_uint16)(pTempfield->iFlags & MNG_FIELD_GROUPMASK) == iLastgroup)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - pTempfield++; - iFieldcount--; - } - } - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -READ_CHUNK (mng_read_general) -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_chunk_descp pDescr = ((mng_chunk_headerp)pHeader)->pChunkdescr; - mng_field_descp pField; - mng_uint16 iFields; - - if (!pDescr) /* this is a bad booboo !!! */ - MNG_ERROR (pData, MNG_INTERNALERROR); - - pField = pDescr->pFielddesc; - iFields = pDescr->iFielddesc; - /* check chunk against signature */ - if ((pDescr->eImgtype == mng_it_mng) && (pData->eSigtype != mng_it_mng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if ((pDescr->eImgtype == mng_it_jng) && (pData->eSigtype == mng_it_png)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* empties allowed ? */ - if ((iRawlen == 0) && (!(pDescr->iAllowed & MNG_DESCR_EMPTY))) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->eImagetype != mng_it_mng) || (!(pDescr->iAllowed & MNG_DESCR_GLOBAL))) - { /* *a* header required ? */ - if ((pDescr->iMusthaves & MNG_DESCR_GenHDR) && -#ifdef MNG_INCLUDE_JNG - (!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - (!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pDescr->iMusthaves & MNG_DESCR_JngHDR) && - (!pData->bHasDHDR) && (!pData->bHasJHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); -#endif - } - /* specific chunk pre-requisite ? */ - if (((pDescr->iMusthaves & MNG_DESCR_IHDR) && (!pData->bHasIHDR)) || -#ifdef MNG_INCLUDE_JNG - ((pDescr->iMusthaves & MNG_DESCR_JHDR) && (!pData->bHasJHDR)) || -#endif - ((pDescr->iMusthaves & MNG_DESCR_DHDR) && (!pData->bHasDHDR)) || - ((pDescr->iMusthaves & MNG_DESCR_LOOP) && (!pData->bHasLOOP)) || - ((pDescr->iMusthaves & MNG_DESCR_PLTE) && (!pData->bHasPLTE)) || - ((pDescr->iMusthaves & MNG_DESCR_MHDR) && (!pData->bHasMHDR)) || - ((pDescr->iMusthaves & MNG_DESCR_SAVE) && (!pData->bHasSAVE)) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* specific chunk undesired ? */ - if (((pDescr->iMustNOThaves & MNG_DESCR_NOIHDR) && (pData->bHasIHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOBASI) && (pData->bHasBASI)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NODHDR) && (pData->bHasDHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOIDAT) && (pData->bHasIDAT)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOPLTE) && (pData->bHasPLTE)) || -#ifdef MNG_INCLUDE_JNG - ((pDescr->iMustNOThaves & MNG_DESCR_NOJHDR) && (pData->bHasJHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOJDAT) && (pData->bHasJDAT)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOJDAA) && (pData->bHasJDAA)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOJSEP) && (pData->bHasJSEP)) || -#endif - ((pDescr->iMustNOThaves & MNG_DESCR_NOMHDR) && (pData->bHasMHDR)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOLOOP) && (pData->bHasLOOP)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOTERM) && (pData->bHasTERM)) || - ((pDescr->iMustNOThaves & MNG_DESCR_NOSAVE) && (pData->bHasSAVE)) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->eSigtype == mng_it_mng) /* check global and embedded empty chunks */ - { -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - if ((iRawlen == 0) && (!(pDescr->iAllowed & MNG_DESCR_EMPTYEMBED))) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } else { - if ((iRawlen == 0) && (!(pDescr->iAllowed & MNG_DESCR_EMPTYGLOBAL))) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - - if (pDescr->pSpecialfunc) /* need special processing ? */ - { - iRetcode = create_chunk_storage (pData, pHeader, iRawlen, pRawdata, - pField, iFields, ppChunk, MNG_TRUE); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* empty indicator ? */ - if ((!iRawlen) && (pDescr->iOffsetempty)) - *(((mng_uint8p)*ppChunk)+pDescr->iOffsetempty) = MNG_TRUE; - - iRetcode = pDescr->pSpecialfunc(pData, *ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - - if ((((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_IDAT) || - (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAT) || - (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAA) ) - { - iRetcode = ((mng_chunk_headerp)*ppChunk)->fCleanup (pData, *ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - *ppChunk = MNG_NULL; - } else { -#ifdef MNG_STORE_CHUNKS - if (!pData->bStorechunks) -#endif - { - iRetcode = ((mng_chunk_headerp)*ppChunk)->fCleanup (pData, *ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - *ppChunk = MNG_NULL; - } - } - } - -#ifdef MNG_SUPPORT_DISPLAY - if (iRawlen) - { -#ifdef MNG_OPTIMIZE_DISPLAYCALLS - pData->iRawlen = iRawlen; - pData->pRawdata = pRawdata; -#endif - - /* display processing */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_IDAT) - iRetcode = mng_process_display_idat (pData, iRawlen, pRawdata); -#ifdef MNG_INCLUDE_JNG - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAT) - iRetcode = mng_process_display_jdat (pData, iRawlen, pRawdata); - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAA) - iRetcode = mng_process_display_jdaa (pData, iRawlen, pRawdata); -#endif -#else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_IDAT) - iRetcode = mng_process_display_idat (pData); -#ifdef MNG_INCLUDE_JNG - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAT) - iRetcode = mng_process_display_jdat (pData); - else - if (((mng_chunk_headerp)pHeader)->iChunkname == MNG_UINT_JDAA) - iRetcode = mng_process_display_jdaa (pData); -#endif -#endif - - if (iRetcode) - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if ((pData->bStorechunks) && (!(*ppChunk))) - { - iRetcode = create_chunk_storage (pData, pHeader, iRawlen, pRawdata, - pField, iFields, ppChunk, MNG_FALSE); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* empty indicator ? */ - if ((!iRawlen) && (pDescr->iOffsetempty)) - *(((mng_uint8p)*ppChunk)+pDescr->iOffsetempty) = MNG_TRUE; - } -#endif /* MNG_STORE_CHUNKS */ - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IHDR, MNG_LC_START); -#endif - - if (iRawlen != 13) /* length oke ? */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* only allowed inside PNG or MNG */ - if ((pData->eSigtype != mng_it_png) && (pData->eSigtype != mng_it_mng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* sequence checks */ - if ((pData->eSigtype == mng_it_png) && (pData->iChunkseq > 1)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasIDAT) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasIDAT)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasIHDR = MNG_TRUE; /* indicate IHDR is present */ - /* and store interesting fields */ - if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_NOCHANGE)) - { - pData->iDatawidth = mng_get_uint32 (pRawdata); - pData->iDataheight = mng_get_uint32 (pRawdata+4); - } - - pData->iBitdepth = *(pRawdata+8); - pData->iColortype = *(pRawdata+9); - pData->iCompression = *(pRawdata+10); - pData->iFilter = *(pRawdata+11); - pData->iInterlace = *(pRawdata+12); - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iCompression != MNG_COMPRESSION_DEFLATE) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iInterlace != MNG_INTERLACE_NONE ) && - (pData->iInterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* check the colortype for delta-images ! */ - { - mng_imagedatap pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - - if (pData->iColortype != pBuf->iColortype) - { - if ( ( (pData->iColortype != MNG_COLORTYPE_INDEXED) || - (pBuf->iColortype == MNG_COLORTYPE_GRAY ) ) && - ( (pData->iColortype != MNG_COLORTYPE_GRAY ) || - (pBuf->iColortype == MNG_COLORTYPE_INDEXED) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - } - } -#endif -#endif - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_png; /* then this must be a PNG */ - pData->iWidth = pData->iDatawidth; - pData->iHeight = pData->iDataheight; - /* predict alpha-depth ! */ - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) - pData->iAlphadepth = pData->iBitdepth; - else - if (pData->iColortype == MNG_COLORTYPE_INDEXED) - pData->iAlphadepth = 8; /* worst case scenario */ - else - pData->iAlphadepth = 1; /* Possible tRNS cheap binary transparency */ - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - -#if !defined(MNG_INCLUDE_MPNG_PROPOSAL) || !defined(MNG_SUPPORT_DISPLAY) - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); -#endif - } - - if (!pData->bHasDHDR) - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_process_display_ihdr (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the fields */ - ((mng_ihdrp)*ppChunk)->iWidth = mng_get_uint32 (pRawdata); - ((mng_ihdrp)*ppChunk)->iHeight = mng_get_uint32 (pRawdata+4); - ((mng_ihdrp)*ppChunk)->iBitdepth = pData->iBitdepth; - ((mng_ihdrp)*ppChunk)->iColortype = pData->iColortype; - ((mng_ihdrp)*ppChunk)->iCompression = pData->iCompression; - ((mng_ihdrp)*ppChunk)->iFilter = pData->iFilter; - ((mng_ihdrp)*ppChunk)->iInterlace = pData->iInterlace; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_plte) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - mng_uint32 iX; - mng_uint8p pRawdata2; -#endif -#ifdef MNG_SUPPORT_DISPLAY - mng_uint32 iRawlen2; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PLTE, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJHDR)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* multiple PLTE only inside BASI */ - if ((pData->bHasPLTE) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - /* length must be multiple of 3 */ - if (((iRawlen % 3) != 0) || (iRawlen > 768)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* only allowed for indexed-color or - rgb(a)-color! */ - if ((pData->iColortype != 2) && (pData->iColortype != 3) && (pData->iColortype != 6)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - /* empty only allowed if global present */ - if ((iRawlen == 0) && (!pData->bHasglobalPLTE)) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - else - { - if (iRawlen == 0) /* cannot be empty as global! */ - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasPLTE = MNG_TRUE; /* got it! */ - else - pData->bHasglobalPLTE = MNG_TRUE; - - pData->iPLTEcount = iRawlen / 3; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; - pBuf->bHasPLTE = MNG_TRUE; /* it's definitely got a PLTE now */ - pBuf->iPLTEcount = iRawlen / 3; /* this is the exact length */ - pRawdata2 = pRawdata; /* copy the entries */ - - for (iX = 0; iX < iRawlen / 3; iX++) - { - pBuf->aPLTEentries[iX].iRed = *pRawdata2; - pBuf->aPLTEentries[iX].iGreen = *(pRawdata2+1); - pBuf->aPLTEentries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - } - else -#endif - { /* get the current object */ - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address the object buffer */ - pBuf->bHasPLTE = MNG_TRUE; /* and tell it it's got a PLTE now */ - - if (!iRawlen) /* if empty, inherit from global */ - { - pBuf->iPLTEcount = pData->iGlobalPLTEcount; - MNG_COPY (pBuf->aPLTEentries, pData->aGlobalPLTEentries, - sizeof (pBuf->aPLTEentries)); - - if (pData->bHasglobalTRNS) /* also copy global tRNS ? */ - { /* indicate tRNS available */ - pBuf->bHasTRNS = MNG_TRUE; - - iRawlen2 = pData->iGlobalTRNSrawlen; - pRawdata2 = (mng_uint8p)(pData->aGlobalTRNSrawdata); - /* global length oke ? */ - if ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - /* copy it */ - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - } - } - else - { /* store fields for future reference */ - pBuf->iPLTEcount = iRawlen / 3; - pRawdata2 = pRawdata; - - for (iX = 0; iX < pBuf->iPLTEcount; iX++) - { - pBuf->aPLTEentries[iX].iRed = *pRawdata2; - pBuf->aPLTEentries[iX].iGreen = *(pRawdata2+1); - pBuf->aPLTEentries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - } - } - } - else /* store as global */ - { - pData->iGlobalPLTEcount = iRawlen / 3; - pRawdata2 = pRawdata; - - for (iX = 0; iX < pData->iGlobalPLTEcount; iX++) - { - pData->aGlobalPLTEentries[iX].iRed = *pRawdata2; - pData->aGlobalPLTEentries[iX].iGreen = *(pRawdata2+1); - pData->aGlobalPLTEentries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_plte (pData, pData->iGlobalPLTEcount, - pData->aGlobalPLTEentries); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_pltep)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_pltep)*ppChunk)->iEntrycount = iRawlen / 3; - pRawdata2 = pRawdata; - - for (iX = 0; iX < ((mng_pltep)*ppChunk)->iEntrycount; iX++) - { - ((mng_pltep)*ppChunk)->aEntries[iX].iRed = *pRawdata2; - ((mng_pltep)*ppChunk)->aEntries[iX].iGreen = *(pRawdata2+1); - ((mng_pltep)*ppChunk)->aEntries[iX].iBlue = *(pRawdata2+2); - - pRawdata2 += 3; - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IDAT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_JNG /* sequence checks */ - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasJHDR) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasJSEP) - MNG_ERROR (pData, MNG_SEQUENCEERROR); -#endif - /* not allowed for deltatype NO_CHANGE */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && ((pData->iDeltatype == MNG_DELTATYPE_NOCHANGE))) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); -#endif - /* can only be empty in BASI-block! */ - if ((iRawlen == 0) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* indexed-color requires PLTE */ - if ((pData->bHasIHDR) && (pData->iColortype == 3) && (!pData->bHasPLTE)) - MNG_ERROR (pData, MNG_PLTEMISSING); - - pData->bHasIDAT = MNG_TRUE; /* got some IDAT now, don't we */ - -#ifdef MNG_SUPPORT_DISPLAY - if (iRawlen) - { /* display processing */ - mng_retcode iRetcode = mng_process_display_idat (pData, iRawlen, pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_idatp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_idatp)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen != 0) /* is there any data ? */ - { - MNG_ALLOC (pData, ((mng_idatp)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_idatp)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IEND, MNG_LC_START); -#endif - - if (iRawlen > 0) /* must not contain data! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_INCLUDE_JNG /* sequence checks */ - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* IHDR-block requires IDAT */ - if ((pData->bHasIHDR) && (!pData->bHasIDAT)) - MNG_ERROR (pData, MNG_IDATMISSING); - - pData->iImagelevel--; /* one level up */ - -#ifdef MNG_SUPPORT_DISPLAY - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_image (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* display processing */ - iRetcode = mng_process_display_iend (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_SUPPORT_DISPLAY - if (!pData->bTimerset) /* reset only if not broken !!! */ - { -#endif - /* IEND signals the end for most ... */ - pData->bHasIHDR = MNG_FALSE; - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; -#ifdef MNG_SUPPORT_DISPLAY - } -#endif - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_trns) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TRNS, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJHDR)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* multiple tRNS only inside BASI */ - if ((pData->bHasTRNS) && (!pData->bHasBASI)) - MNG_ERROR (pData, MNG_MULTIPLEERROR); - - if (iRawlen > 256) /* it just can't be bigger than that! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not allowed with full alpha-channel */ - if ((pData->iColortype == 4) || (pData->iColortype == 6)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if (iRawlen != 0) /* filled ? */ - { /* length checks */ - if ((pData->iColortype == 0) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 2) && (iRawlen != 6)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - if (pData->iColortype == 3) - { - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; - - if (!pImage) /* no object then check obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - - if (iRawlen > pBuf->iPLTEcount) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } -#endif - } - else /* if empty there must be global stuff! */ - { - if (!pData->bHasglobalTRNS) - MNG_ERROR (pData, MNG_CANNOTBEEMPTY); - } - } - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - pData->bHasTRNS = MNG_TRUE; /* indicate tRNS available */ - else - pData->bHasglobalTRNS = MNG_TRUE; - -#ifdef MNG_SUPPORT_DISPLAY - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - mng_imagep pImage; - mng_imagedatap pBuf; - mng_uint8p pRawdata2; - mng_uint32 iRawlen2; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { /* store in object 0 !!! */ - pImage = (mng_imagep)pData->pObjzero; - pBuf = pImage->pImgbuf; /* address object buffer */ - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1, - 0,0,0,0,0,0,0,1}; -#endif - pBuf->iTRNSgray = mng_get_uint16 (pRawdata); - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; -#if defined(MNG_NO_1_2_4BIT_SUPPORT) - pBuf->iTRNSgray *= multiplier[pData->iPNGdepth]; -#endif -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = mng_get_uint16 (pRawdata); - pBuf->iTRNSgreen = mng_get_uint16 (pRawdata+2); - pBuf->iTRNSblue = mng_get_uint16 (pRawdata+4); - pBuf->iTRNScount = 0; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = iRawlen; - MNG_COPY (pBuf->aTRNSentries, pRawdata, iRawlen); - break; - } - } - - pBuf->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */ - } - else -#endif - { /* address current object */ - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasTRNS = MNG_TRUE; /* and tell it it's got a tRNS now */ - - if (iRawlen == 0) /* if empty, inherit from global */ - { - iRawlen2 = pData->iGlobalTRNSrawlen; - pRawdata2 = (mng_ptr)(pData->aGlobalTRNSrawdata); - /* global length oke ? */ - if ((pData->iColortype == 0) && (iRawlen2 != 2)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 2) && (iRawlen2 != 6)) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - - if ((pData->iColortype == 3) && ((iRawlen2 == 0) || (iRawlen2 > pBuf->iPLTEcount))) - MNG_ERROR (pData, MNG_GLOBALLENGTHERR); - } - else - { - iRawlen2 = iRawlen; - pRawdata2 = pRawdata; - } - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0: { /* gray */ - pBuf->iTRNSgray = mng_get_uint16 (pRawdata2); - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = 0; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - pBuf->iTRNSgray >>= 8; -#endif - break; - } - case 2: { /* rgb */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = mng_get_uint16 (pRawdata2); - pBuf->iTRNSgreen = mng_get_uint16 (pRawdata2+2); - pBuf->iTRNSblue = mng_get_uint16 (pRawdata2+4); - pBuf->iTRNScount = 0; -#if defined(MNG_NO_16BIT_SUPPORT) - if (pData->iPNGmult == 2) - { - pBuf->iTRNSred >>= 8; - pBuf->iTRNSgreen >>= 8; - pBuf->iTRNSblue >>= 8; - } -#endif - break; - } - case 3: { /* indexed */ - pBuf->iTRNSgray = 0; - pBuf->iTRNSred = 0; - pBuf->iTRNSgreen = 0; - pBuf->iTRNSblue = 0; - pBuf->iTRNScount = iRawlen2; - MNG_COPY (pBuf->aTRNSentries, pRawdata2, iRawlen2); - break; - } - } - } - } - else /* store as global */ - { - pData->iGlobalTRNSrawlen = iRawlen; - MNG_COPY (pData->aGlobalTRNSrawdata, pRawdata, iRawlen); - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_trns (pData, pData->iGlobalTRNSrawlen, - pData->aGlobalTRNSrawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { /* not global! */ - ((mng_trnsp)*ppChunk)->bGlobal = MNG_FALSE; - ((mng_trnsp)*ppChunk)->iType = pData->iColortype; - - if (iRawlen == 0) /* if empty, indicate so */ - ((mng_trnsp)*ppChunk)->bEmpty = MNG_TRUE; - else - { - ((mng_trnsp)*ppChunk)->bEmpty = MNG_FALSE; - - switch (pData->iColortype) /* store fields */ - { - case 0: { /* gray */ - ((mng_trnsp)*ppChunk)->iGray = mng_get_uint16 (pRawdata); - break; - } - case 2: { /* rgb */ - ((mng_trnsp)*ppChunk)->iRed = mng_get_uint16 (pRawdata); - ((mng_trnsp)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+2); - ((mng_trnsp)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+4); - break; - } - case 3: { /* indexed */ - ((mng_trnsp)*ppChunk)->iCount = iRawlen; - MNG_COPY (((mng_trnsp)*ppChunk)->aEntries, pRawdata, iRawlen); - break; - } - } - } - } - else /* it's global! */ - { - ((mng_trnsp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_trnsp)*ppChunk)->bGlobal = MNG_TRUE; - ((mng_trnsp)*ppChunk)->iType = 0; - ((mng_trnsp)*ppChunk)->iRawlen = iRawlen; - - MNG_COPY (((mng_trnsp)*ppChunk)->aRawdata, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GAMA, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be exactly 4 */ - if (iRawlen != 4) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or exactly 4 */ - if ((iRawlen != 0) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasGAMA = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalGAMA = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata); - pImage->pImgbuf->bHasGAMA = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iGamma = mng_get_uint32 (pRawdata); - pImage->pImgbuf->bHasGAMA = MNG_TRUE; - } - } - else - { /* store as global */ - if (iRawlen != 0) - pData->iGlobalGamma = mng_get_uint32 (pRawdata); - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_gama (pData, (mng_bool)(iRawlen == 0), - pData->iGlobalGamma); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_gamap)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - ((mng_gamap)*ppChunk)->iGamma = mng_get_uint32 (pRawdata); - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_cHRM -READ_CHUNK (mng_read_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHRM, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be exactly 32 */ - if (iRawlen != 32) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or exactly 32 */ - if ((iRawlen != 0) && (iRawlen != 32)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasCHRM = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalCHRM = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint32 iWhitepointx, iWhitepointy; - mng_uint32 iPrimaryredx, iPrimaryredy; - mng_uint32 iPrimarygreenx, iPrimarygreeny; - mng_uint32 iPrimarybluex, iPrimarybluey; - - iWhitepointx = mng_get_uint32 (pRawdata); - iWhitepointy = mng_get_uint32 (pRawdata+4); - iPrimaryredx = mng_get_uint32 (pRawdata+8); - iPrimaryredy = mng_get_uint32 (pRawdata+12); - iPrimarygreenx = mng_get_uint32 (pRawdata+16); - iPrimarygreeny = mng_get_uint32 (pRawdata+20); - iPrimarybluex = mng_get_uint32 (pRawdata+24); - iPrimarybluey = mng_get_uint32 (pRawdata+28); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - mng_imagedatap pBuf; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store it in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */ - /* store for color-processing routines */ - pBuf->iWhitepointx = iWhitepointx; - pBuf->iWhitepointy = iWhitepointy; - pBuf->iPrimaryredx = iPrimaryredx; - pBuf->iPrimaryredy = iPrimaryredy; - pBuf->iPrimarygreenx = iPrimarygreenx; - pBuf->iPrimarygreeny = iPrimarygreeny; - pBuf->iPrimarybluex = iPrimarybluex; - pBuf->iPrimarybluey = iPrimarybluey; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - pBuf->bHasCHRM = MNG_TRUE; /* and tell it it's got a CHRM now */ - /* store for color-processing routines */ - pBuf->iWhitepointx = iWhitepointx; - pBuf->iWhitepointy = iWhitepointy; - pBuf->iPrimaryredx = iPrimaryredx; - pBuf->iPrimaryredy = iPrimaryredy; - pBuf->iPrimarygreenx = iPrimarygreenx; - pBuf->iPrimarygreeny = iPrimarygreeny; - pBuf->iPrimarybluex = iPrimarybluex; - pBuf->iPrimarybluey = iPrimarybluey; - } - } - else - { /* store as global */ - if (iRawlen != 0) - { - pData->iGlobalWhitepointx = iWhitepointx; - pData->iGlobalWhitepointy = iWhitepointy; - pData->iGlobalPrimaryredx = iPrimaryredx; - pData->iGlobalPrimaryredy = iPrimaryredy; - pData->iGlobalPrimarygreenx = iPrimarygreenx; - pData->iGlobalPrimarygreeny = iPrimarygreeny; - pData->iGlobalPrimarybluex = iPrimarybluex; - pData->iGlobalPrimarybluey = iPrimarybluey; - } - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_chrm (pData, (mng_bool)(iRawlen == 0), - iWhitepointx, iWhitepointy, - iPrimaryredx, iPrimaryredy, - iPrimarygreenx, iPrimarygreeny, - iPrimarybluex, iPrimarybluey); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_chrmp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_chrmp)*ppChunk)->iWhitepointx = mng_get_uint32 (pRawdata); - ((mng_chrmp)*ppChunk)->iWhitepointy = mng_get_uint32 (pRawdata+4); - ((mng_chrmp)*ppChunk)->iRedx = mng_get_uint32 (pRawdata+8); - ((mng_chrmp)*ppChunk)->iRedy = mng_get_uint32 (pRawdata+12); - ((mng_chrmp)*ppChunk)->iGreenx = mng_get_uint32 (pRawdata+16); - ((mng_chrmp)*ppChunk)->iGreeny = mng_get_uint32 (pRawdata+20); - ((mng_chrmp)*ppChunk)->iBluex = mng_get_uint32 (pRawdata+24); - ((mng_chrmp)*ppChunk)->iBluey = mng_get_uint32 (pRawdata+28); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SRGB, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be exactly 1 */ - if (iRawlen != 1) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or exactly 1 */ - if ((iRawlen != 0) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasSRGB = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalSRGB = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iRenderingintent = *pRawdata; - pImage->pImgbuf->bHasSRGB = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - /* store for color-processing routines */ - pImage->pImgbuf->iRenderingintent = *pRawdata; - pImage->pImgbuf->bHasSRGB = MNG_TRUE; - } - } - else - { /* store as global */ - if (iRawlen != 0) - pData->iGlobalRendintent = *pRawdata; - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_srgb (pData, (mng_bool)(iRawlen == 0), - pData->iGlobalRendintent); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_srgbp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - ((mng_srgbp)*ppChunk)->iRenderingintent = *pRawdata; - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_iCCP -READ_CHUNK (mng_read_iccp) -{ - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iCompressedsize; - mng_uint32 iProfilesize; - mng_uint32 iBufsize = 0; - mng_uint8p pBuf = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ICCP, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasPLTE) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasIDAT) || (pData->bHasPLTE)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { /* length must be at least 2 */ - if (iRawlen < 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* length must be empty or at least 2 */ - if ((iRawlen != 0) && (iRawlen < 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - pTemp = find_null (pRawdata); /* find null-separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - /* determine size of compressed profile */ - iCompressedsize = (mng_uint32)(iRawlen - (pTemp - pRawdata) - 2); - /* decompress the profile */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iProfilesize); - -#ifdef MNG_CHECK_BAD_ICCP /* Check for bad iCCP chunk */ - if ((iRetcode) && (!strncmp ((char *)pRawdata, "Photoshop ICC profile", 21))) - { - if (iRawlen == 2615) /* is it the sRGB profile ? */ - { - mng_chunk_header chunk_srgb = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)}; -#else - {MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0}; -#endif - /* pretend it's an sRGB chunk then ! */ - iRetcode = mng_read_srgb (pData, &chunk_srgb, 1, (mng_ptr)"0", ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - } - else - { -#endif /* MNG_CHECK_BAD_ICCP */ - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasICCP = MNG_TRUE; /* indicate we've got it */ - else - pData->bHasglobalICCP = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - { - mng_imagep pImage; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* update delta image ? */ - { /* store in object 0 ! */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, pBuf, iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - else -#endif - { - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* no object then dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - if (pImage->pImgbuf->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pImage->pImgbuf->pProfile, pImage->pImgbuf->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pImage->pImgbuf->pProfile, iProfilesize); - MNG_COPY (pImage->pImgbuf->pProfile, pBuf, iProfilesize); - /* store its length as well */ - pImage->pImgbuf->iProfilesize = iProfilesize; - pImage->pImgbuf->bHasICCP = MNG_TRUE; - } - } - else - { /* store as global */ - if (iRawlen == 0) /* empty chunk ? */ - { - if (pData->pGlobalProfile) /* did we have a global profile ? */ - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; /* reset to null */ - pData->pGlobalProfile = MNG_NULL; - } - else - { /* allocate a global buffer & copy it */ - MNG_ALLOC (pData, pData->pGlobalProfile, iProfilesize); - MNG_COPY (pData->pGlobalProfile, pBuf, iProfilesize); - /* store its length as well */ - pData->iGlobalProfilesize = iProfilesize; - } - - /* create an animation object */ - iRetcode = mng_create_ani_iccp (pData, (mng_bool)(iRawlen == 0), - pData->iGlobalProfilesize, - pData->pGlobalProfile); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - /* store the fields */ - ((mng_iccpp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) /* not empty ? */ - { - if (!pBuf) /* hasn't been unpuzzled it yet ? */ - { /* find null-separator */ - pTemp = find_null (pRawdata); - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - /* determine size of compressed profile */ - iCompressedsize = iRawlen - (pTemp - pRawdata) - 2; - /* decompress the profile */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iProfilesize); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - - ((mng_iccpp)*ppChunk)->iNamesize = (mng_uint32)(pTemp - pRawdata); - - if (((mng_iccpp)*ppChunk)->iNamesize) - { - MNG_ALLOC (pData, ((mng_iccpp)*ppChunk)->zName, - ((mng_iccpp)*ppChunk)->iNamesize + 1); - MNG_COPY (((mng_iccpp)*ppChunk)->zName, pRawdata, - ((mng_iccpp)*ppChunk)->iNamesize); - } - - ((mng_iccpp)*ppChunk)->iCompression = *(pTemp+1); - ((mng_iccpp)*ppChunk)->iProfilesize = iProfilesize; - - MNG_ALLOC (pData, ((mng_iccpp)*ppChunk)->pProfile, iProfilesize); - MNG_COPY (((mng_iccpp)*ppChunk)->pProfile, pBuf, iProfilesize); - } - } -#endif /* MNG_STORE_CHUNKS */ - - if (pBuf) /* free the temporary buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - -#ifdef MNG_CHECK_BAD_ICCP - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_tEXt -READ_CHUNK (mng_read_text) -{ - mng_uint32 iKeywordlen, iTextlen; - mng_pchar zKeyword, zText; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TEXT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 2) /* length must be at least 2 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pTemp = find_null (pRawdata); /* find the null separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - if (pTemp == pRawdata) /* there must be at least 1 char for keyword */ - MNG_ERROR (pData, MNG_KEYWORDNULL); - - iKeywordlen = (mng_uint32)(pTemp - pRawdata); - iTextlen = iRawlen - iKeywordlen - 1; - - if (pData->fProcesstext) /* inform the application ? */ - { - mng_bool bOke; - - MNG_ALLOC (pData, zKeyword, iKeywordlen + 1); - MNG_COPY (zKeyword, pRawdata, iKeywordlen); - - MNG_ALLOCX (pData, zText, iTextlen + 1); - - if (!zText) /* on error bail out */ - { - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - if (iTextlen) - MNG_COPY (zText, pTemp+1, iTextlen); - - bOke = pData->fProcesstext ((mng_handle)pData, MNG_TYPE_TEXT, zKeyword, zText, 0, 0); - - MNG_FREEX (pData, zText, iTextlen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_textp)*ppChunk)->iKeywordsize = iKeywordlen; - ((mng_textp)*ppChunk)->iTextsize = iTextlen; - - if (iKeywordlen) - { - MNG_ALLOC (pData, ((mng_textp)*ppChunk)->zKeyword, iKeywordlen+1); - MNG_COPY (((mng_textp)*ppChunk)->zKeyword, pRawdata, iKeywordlen); - } - - if (iTextlen) - { - MNG_ALLOC (pData, ((mng_textp)*ppChunk)->zText, iTextlen+1); - MNG_COPY (((mng_textp)*ppChunk)->zText, pTemp+1, iTextlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_zTXt -READ_CHUNK (mng_read_ztxt) -{ - mng_retcode iRetcode; - mng_uint32 iKeywordlen, iTextlen; - mng_pchar zKeyword; - mng_uint8p pTemp; - mng_uint32 iCompressedsize; - mng_uint32 iBufsize; - mng_uint8p pBuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ZTXT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 3) /* length must be at least 3 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pTemp = find_null (pRawdata); /* find the null separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - if (pTemp == pRawdata) /* there must be at least 1 char for keyword */ - MNG_ERROR (pData, MNG_KEYWORDNULL); - - if (*(pTemp+1) != 0) /* only deflate compression-method allowed */ - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - iKeywordlen = (mng_uint32)(pTemp - pRawdata); - iCompressedsize = (mng_uint32)(iRawlen - iKeywordlen - 2); - - zKeyword = 0; /* there's no keyword buffer yet */ - pBuf = 0; /* or a temporary buffer ! */ - - if (pData->fProcesstext) /* inform the application ? */ - { /* decompress the text */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - MNG_ALLOCX (pData, zKeyword, iKeywordlen+1); - - if (!zKeyword) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (zKeyword, pRawdata, iKeywordlen); - - if (!pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ZTXT, zKeyword, (mng_pchar)pBuf, 0, 0)) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - MNG_ERROR (pData, MNG_APPMISCERROR); - } - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - return iRetcode; - } - /* store the fields */ - ((mng_ztxtp)*ppChunk)->iKeywordsize = iKeywordlen; - ((mng_ztxtp)*ppChunk)->iCompression = *(pTemp+1); - - if ((!pBuf) && (iCompressedsize)) /* did we not get a text-buffer yet ? */ - { /* decompress the text */ - iRetcode = mng_inflate_buffer (pData, pTemp+2, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - return iRetcode; - } - } - - MNG_ALLOCX (pData, ((mng_ztxtp)*ppChunk)->zKeyword, iKeywordlen + 1); - /* on error bail out */ - if (!((mng_ztxtp)*ppChunk)->zKeyword) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_ztxtp)*ppChunk)->zKeyword, pRawdata, iKeywordlen); - - ((mng_ztxtp)*ppChunk)->iTextsize = iTextlen; - - if (iCompressedsize) - { - MNG_ALLOCX (pData, ((mng_ztxtp)*ppChunk)->zText, iTextlen + 1); - /* on error bail out */ - if (!((mng_ztxtp)*ppChunk)->zText) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, pBuf, iBufsize); - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_ztxtp)*ppChunk)->zText, pBuf, iTextlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - - MNG_FREEX (pData, pBuf, iBufsize); /* free the temporary buffers */ - MNG_FREEX (pData, zKeyword, iKeywordlen+1); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_iTXt -READ_CHUNK (mng_read_itxt) -{ - mng_retcode iRetcode; - mng_uint32 iKeywordlen, iTextlen, iLanguagelen, iTranslationlen; - mng_pchar zKeyword, zLanguage, zTranslation; - mng_uint8p pNull1, pNull2, pNull3; - mng_uint32 iCompressedsize; - mng_uint8 iCompressionflag; - mng_uint32 iBufsize; - mng_uint8p pBuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ITXT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 6) /* length must be at least 6 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pNull1 = find_null (pRawdata); /* find the null separators */ - pNull2 = find_null (pNull1+3); - pNull3 = find_null (pNull2+1); - /* not found inside input-data ? */ - if (((pNull1 - pRawdata) > (mng_int32)iRawlen) || - ((pNull2 - pRawdata) > (mng_int32)iRawlen) || - ((pNull3 - pRawdata) > (mng_int32)iRawlen) ) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - if (pNull1 == pRawdata) /* there must be at least 1 char for keyword */ - MNG_ERROR (pData, MNG_KEYWORDNULL); - /* compression or not ? */ - if ((*(pNull1+1) != 0) && (*(pNull1+1) != 1)) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if (*(pNull1+2) != 0) /* only deflate compression-method allowed */ - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - iKeywordlen = (mng_uint32)(pNull1 - pRawdata); - iLanguagelen = (mng_uint32)(pNull2 - pNull1 - 3); - iTranslationlen = (mng_uint32)(pNull3 - pNull2 - 1); - iCompressedsize = (mng_uint32)(iRawlen - iKeywordlen - iLanguagelen - iTranslationlen - 5); - iCompressionflag = *(pNull1+1); - - zKeyword = 0; /* no buffers acquired yet */ - zLanguage = 0; - zTranslation = 0; - pBuf = 0; - iTextlen = 0; - - if (pData->fProcesstext) /* inform the application ? */ - { - if (iCompressionflag) /* decompress the text ? */ - { - iRetcode = mng_inflate_buffer (pData, pNull3+1, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffer */ - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - else - { - iTextlen = iCompressedsize; - iBufsize = iTextlen+1; /* plus 1 for terminator byte!!! */ - - MNG_ALLOC (pData, pBuf, iBufsize); - MNG_COPY (pBuf, pNull3+1, iTextlen); - } - - MNG_ALLOCX (pData, zKeyword, iKeywordlen + 1); - MNG_ALLOCX (pData, zLanguage, iLanguagelen + 1); - MNG_ALLOCX (pData, zTranslation, iTranslationlen + 1); - /* on error bail out */ - if ((!zKeyword) || (!zLanguage) || (!zTranslation)) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (zKeyword, pRawdata, iKeywordlen); - MNG_COPY (zLanguage, pNull1+3, iLanguagelen); - MNG_COPY (zTranslation, pNull2+1, iTranslationlen); - - if (!pData->fProcesstext ((mng_handle)pData, MNG_TYPE_ITXT, zKeyword, (mng_pchar)pBuf, - zLanguage, zTranslation)) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - - MNG_ERROR (pData, MNG_APPMISCERROR); - } - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - /* store the fields */ - ((mng_itxtp)*ppChunk)->iKeywordsize = iKeywordlen; - ((mng_itxtp)*ppChunk)->iLanguagesize = iLanguagelen; - ((mng_itxtp)*ppChunk)->iTranslationsize = iTranslationlen; - ((mng_itxtp)*ppChunk)->iCompressionflag = *(pNull1+1); - ((mng_itxtp)*ppChunk)->iCompressionmethod = *(pNull1+2); - - if ((!pBuf) && (iCompressedsize)) /* did we not get a text-buffer yet ? */ - { - if (iCompressionflag) /* decompress the text ? */ - { - iRetcode = mng_inflate_buffer (pData, pNull3+1, iCompressedsize, - &pBuf, &iBufsize, &iTextlen); - - if (iRetcode) /* on error bail out */ - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } - else - { - iTextlen = iCompressedsize; - iBufsize = iTextlen+1; /* plus 1 for terminator byte!!! */ - - MNG_ALLOC (pData, pBuf, iBufsize); - MNG_COPY (pBuf, pNull3+1, iTextlen); - } - } - - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zKeyword, iKeywordlen + 1); - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zLanguage, iLanguagelen + 1); - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zTranslation, iTranslationlen + 1); - /* on error bail out */ - if ((!((mng_itxtp)*ppChunk)->zKeyword ) || - (!((mng_itxtp)*ppChunk)->zLanguage ) || - (!((mng_itxtp)*ppChunk)->zTranslation) ) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_itxtp)*ppChunk)->zKeyword, pRawdata, iKeywordlen); - MNG_COPY (((mng_itxtp)*ppChunk)->zLanguage, pNull1+3, iLanguagelen); - MNG_COPY (((mng_itxtp)*ppChunk)->zTranslation, pNull2+1, iTranslationlen); - - ((mng_itxtp)*ppChunk)->iTextsize = iTextlen; - - if (iTextlen) - { - MNG_ALLOCX (pData, ((mng_itxtp)*ppChunk)->zText, iTextlen + 1); - - if (!((mng_itxtp)*ppChunk)->zText) - { /* don't forget to drop the temp buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (((mng_itxtp)*ppChunk)->zText, pBuf, iTextlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - /* free the temporary buffers */ - MNG_FREEX (pData, zTranslation, iTranslationlen + 1); - MNG_FREEX (pData, zLanguage, iLanguagelen + 1); - MNG_FREEX (pData, zKeyword, iKeywordlen + 1); - MNG_FREEX (pData, pBuf, iBufsize); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_bKGD -READ_CHUNK (mng_read_bkgd) -{ -#ifdef MNG_SUPPORT_DISPLAY - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BKGD, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen > 6) /* it just can't be bigger than that! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_INCLUDE_JNG /* length checks */ - if (pData->bHasJHDR) - { - if (((pData->iJHDRcolortype == 8) || (pData->iJHDRcolortype == 12)) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (((pData->iJHDRcolortype == 10) || (pData->iJHDRcolortype == 14)) && (iRawlen != 6)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - if (((pData->iColortype == 0) || (pData->iColortype == 4)) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (((pData->iColortype == 2) || (pData->iColortype == 6)) && (iRawlen != 6)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 3) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { - if (iRawlen != 6) /* global is always 16-bit RGB ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - pData->bHasBKGD = MNG_TRUE; /* indicate bKGD available */ - else - pData->bHasglobalBKGD = (mng_bool)(iRawlen != 0); - -#ifdef MNG_SUPPORT_DISPLAY - if (!pImage) /* if no object dump it in obj 0 */ - pImage = (mng_imagep)pData->pObjzero; - - pBuf = pImage->pImgbuf; /* address object buffer */ - -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iJHDRcolortype) /* store fields for future reference */ - { - case 8 : ; /* gray */ - case 12 : { /* graya */ - pBuf->iBKGDgray = mng_get_uint16 (pRawdata); - break; - } - case 10 : ; /* rgb */ - case 14 : { /* rgba */ - pBuf->iBKGDred = mng_get_uint16 (pRawdata); - pBuf->iBKGDgreen = mng_get_uint16 (pRawdata+2); - pBuf->iBKGDblue = mng_get_uint16 (pRawdata+4); - break; - } - } - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - pBuf->bHasBKGD = MNG_TRUE; /* tell the object it's got bKGD now */ - - switch (pData->iColortype) /* store fields for future reference */ - { - case 0 : ; /* gray */ - case 4 : { /* graya */ - pBuf->iBKGDgray = mng_get_uint16 (pRawdata); - break; - } - case 2 : ; /* rgb */ - case 6 : { /* rgba */ - pBuf->iBKGDred = mng_get_uint16 (pRawdata); - pBuf->iBKGDgreen = mng_get_uint16 (pRawdata+2); - pBuf->iBKGDblue = mng_get_uint16 (pRawdata+4); - break; - } - case 3 : { /* indexed */ - pBuf->iBKGDindex = *pRawdata; - break; - } - } - } - else /* store as global */ - { - if (iRawlen) - { - pData->iGlobalBKGDred = mng_get_uint16 (pRawdata); - pData->iGlobalBKGDgreen = mng_get_uint16 (pRawdata+2); - pData->iGlobalBKGDblue = mng_get_uint16 (pRawdata+4); - } - - { /* create an animation object */ - mng_retcode iRetcode = mng_create_ani_bkgd (pData, pData->iGlobalBKGDred, - pData->iGlobalBKGDgreen, - pData->iGlobalBKGDblue); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_bkgdp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_bkgdp)*ppChunk)->iType = pData->iColortype; - - if (iRawlen) - { - switch (iRawlen) /* guess from length */ - { - case 1 : { /* indexed */ - ((mng_bkgdp)*ppChunk)->iType = 3; - ((mng_bkgdp)*ppChunk)->iIndex = *pRawdata; - break; - } - case 2 : { /* gray */ - ((mng_bkgdp)*ppChunk)->iType = 0; - ((mng_bkgdp)*ppChunk)->iGray = mng_get_uint16 (pRawdata); - break; - } - case 6 : { /* rgb */ - ((mng_bkgdp)*ppChunk)->iType = 2; - ((mng_bkgdp)*ppChunk)->iRed = mng_get_uint16 (pRawdata); - ((mng_bkgdp)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+2); - ((mng_bkgdp)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+4); - break; - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_pHYs -READ_CHUNK (mng_read_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYS, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIDAT) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if (pData->bHasIDAT) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* it's 9 bytes or empty; no more, no less! */ - if ((iRawlen != 9) && (iRawlen != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_physp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_physp)*ppChunk)->iSizex = mng_get_uint32 (pRawdata); - ((mng_physp)*ppChunk)->iSizey = mng_get_uint32 (pRawdata+4); - ((mng_physp)*ppChunk)->iUnit = *(pRawdata+8); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_sBIT -READ_CHUNK (mng_read_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SBIT, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasPLTE) || (pData->bHasIDAT) || (pData->bHasJDAT) || (pData->bHasJDAA)) -#else - if ((pData->bHasPLTE) || (pData->bHasIDAT)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen > 4) /* it just can't be bigger than that! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_INCLUDE_JNG /* length checks */ - if (pData->bHasJHDR) - { - if ((pData->iJHDRcolortype == 8) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iJHDRcolortype == 10) && (iRawlen != 3)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iJHDRcolortype == 12) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iJHDRcolortype == 14) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else -#endif /* MNG_INCLUDE_JNG */ - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) - { - if ((pData->iColortype == 0) && (iRawlen != 1)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 2) && (iRawlen != 3)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 3) && (iRawlen != 3)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 4) && (iRawlen != 2)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((pData->iColortype == 6) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { /* global = empty or RGBA */ - if ((iRawlen != 0) && (iRawlen != 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_sbitp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) - ((mng_sbitp)*ppChunk)->iType = pData->iJHDRcolortype; - else -#endif - if (pData->bHasIHDR) - ((mng_sbitp)*ppChunk)->iType = pData->iColortype; - else /* global ! */ - ((mng_sbitp)*ppChunk)->iType = 6; - - if (iRawlen > 0) - ((mng_sbitp)*ppChunk)->aBits [0] = *pRawdata; - if (iRawlen > 1) - ((mng_sbitp)*ppChunk)->aBits [1] = *(pRawdata+1); - if (iRawlen > 2) - ((mng_sbitp)*ppChunk)->aBits [2] = *(pRawdata+2); - if (iRawlen > 3) - ((mng_sbitp)*ppChunk)->aBits [3] = *(pRawdata+3); - - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_sPLT -READ_CHUNK (mng_read_splt) -{ - mng_uint8p pTemp; - mng_uint32 iNamelen; - mng_uint8 iSampledepth; - mng_uint32 iRemain; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SPLT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasIDAT) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen) - { - pTemp = find_null (pRawdata); /* find null-separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - MNG_ERROR (pData, MNG_NULLNOTFOUND); - - iNamelen = (mng_uint32)(pTemp - pRawdata); - iSampledepth = *(pTemp+1); - iRemain = (iRawlen - 2 - iNamelen); - - if ((iSampledepth != 1) && (iSampledepth != 2)) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - /* check remaining length */ - if ( ((iSampledepth == 1) && (iRemain % 6 != 0)) || - ((iSampledepth == 2) && (iRemain % 10 != 0)) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - } - else - { - pTemp = MNG_NULL; - iNamelen = 0; - iSampledepth = 0; - iRemain = 0; - } - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_spltp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_spltp)*ppChunk)->iNamesize = iNamelen; - ((mng_spltp)*ppChunk)->iSampledepth = iSampledepth; - - if (iSampledepth == 1) - ((mng_spltp)*ppChunk)->iEntrycount = iRemain / 6; - else - ((mng_spltp)*ppChunk)->iEntrycount = iRemain / 10; - - if (iNamelen) - { - MNG_ALLOC (pData, ((mng_spltp)*ppChunk)->zName, iNamelen+1); - MNG_COPY (((mng_spltp)*ppChunk)->zName, pRawdata, iNamelen); - } - - if (iRemain) - { - MNG_ALLOC (pData, ((mng_spltp)*ppChunk)->pEntries, iRemain); - MNG_COPY (((mng_spltp)*ppChunk)->pEntries, pTemp+2, iRemain); - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_hIST -READ_CHUNK (mng_read_hist) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_HIST, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasIHDR) && (!pData->bHasBASI) && (!pData->bHasDHDR) ) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if ((!pData->bHasPLTE) || (pData->bHasIDAT)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* length oke ? */ - if ( ((iRawlen & 0x01) != 0) || ((iRawlen >> 1) != pData->iPLTEcount) ) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { - mng_uint32 iX; - /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_histp)*ppChunk)->iEntrycount = iRawlen >> 1; - - for (iX = 0; iX < (iRawlen >> 1); iX++) - { - ((mng_histp)*ppChunk)->aEntries [iX] = mng_get_uint16 (pRawdata); - pRawdata += 2; - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_tIME -READ_CHUNK (mng_read_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TIME, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 7) /* length must be exactly 7 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -/* if (pData->fProcesstime) */ /* inform the application ? */ -/* { - - pData->fProcesstime ((mng_handle)pData, ); - } */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_timep)*ppChunk)->iYear = mng_get_uint16 (pRawdata); - ((mng_timep)*ppChunk)->iMonth = *(pRawdata+2); - ((mng_timep)*ppChunk)->iDay = *(pRawdata+3); - ((mng_timep)*ppChunk)->iHour = *(pRawdata+4); - ((mng_timep)*ppChunk)->iMinute = *(pRawdata+5); - ((mng_timep)*ppChunk)->iSecond = *(pRawdata+6); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MHDR, MNG_LC_START); -#endif - - if (pData->eSigtype != mng_it_mng) /* sequence checks */ - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if (pData->bHasheader) /* can only be the first chunk! */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* correct length ? */ -#ifndef MNG_NO_OLD_VERSIONS - if ((iRawlen != 28) && (iRawlen != 12)) -#else - if ((iRawlen != 28)) -#endif - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasMHDR = MNG_TRUE; /* oh boy, a real MNG */ - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_mng; /* fill header fields */ - pData->iWidth = mng_get_uint32 (pRawdata); - pData->iHeight = mng_get_uint32 (pRawdata+4); - pData->iTicks = mng_get_uint32 (pRawdata+8); - -#ifndef MNG_NO_OLD_VERSIONS - if (iRawlen == 28) /* proper MHDR ? */ - { -#endif - pData->iLayercount = mng_get_uint32 (pRawdata+12); - pData->iFramecount = mng_get_uint32 (pRawdata+16); - pData->iPlaytime = mng_get_uint32 (pRawdata+20); - pData->iSimplicity = mng_get_uint32 (pRawdata+24); - -#ifndef MNG_NO_OLD_VERSIONS - pData->bPreDraft48 = MNG_FALSE; - } - else /* probably pre-draft48 then */ - { - pData->iLayercount = 0; - pData->iFramecount = 0; - pData->iPlaytime = 0; - pData->iSimplicity = 0; - - pData->bPreDraft48 = MNG_TRUE; - } -#endif - /* predict alpha-depth */ - if ((pData->iSimplicity & 0x00000001) == 0) -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* no indicators = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - else - if ((pData->iSimplicity & 0x00000008) == 0) - pData->iAlphadepth = 0; /* no transparency at all */ - else - if ((pData->iSimplicity & 0x00000140) == 0x00000040) - pData->iAlphadepth = 1; /* no semi-transparency guaranteed */ - else -#ifndef MNG_NO_16BIT_SUPPORT - pData->iAlphadepth = 16; /* anything else = assume the worst */ -#else - pData->iAlphadepth = 8; /* anything else = assume the worst */ -#endif - -#ifdef MNG_INCLUDE_JNG /* can we handle the complexity ? */ - if (pData->iSimplicity & 0x0000FC00) -#else - if (pData->iSimplicity & 0x0000FC10) -#endif - MNG_ERROR (pData, MNG_MNGTOOCOMPLEX); - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_mhdrp)*ppChunk)->iWidth = pData->iWidth; - ((mng_mhdrp)*ppChunk)->iHeight = pData->iHeight; - ((mng_mhdrp)*ppChunk)->iTicks = pData->iTicks; - ((mng_mhdrp)*ppChunk)->iLayercount = pData->iLayercount; - ((mng_mhdrp)*ppChunk)->iFramecount = pData->iFramecount; - ((mng_mhdrp)*ppChunk)->iPlaytime = pData->iPlaytime; - ((mng_mhdrp)*ppChunk)->iSimplicity = pData->iSimplicity; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MEND, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen > 0) /* must not contain data! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { /* do something */ - mng_retcode iRetcode = mng_process_display_mend (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (!pData->iTotalframes) /* save totals */ - pData->iTotalframes = pData->iFrameseq; - if (!pData->iTotallayers) - pData->iTotallayers = pData->iLayerseq; - if (!pData->iTotalplaytime) - pData->iTotalplaytime = pData->iFrametime; - } -#endif /* MNG_SUPPORT_DISPLAY */ - - pData->bHasMHDR = MNG_FALSE; /* end of the line, bro! */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_LOOP -READ_CHUNK (mng_read_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_LOOP, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_LOOPWITHCACHEOFF); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen >= 5) /* length checks */ - { - if (iRawlen >= 6) - { - if ((iRawlen - 6) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint8 iLevel; - mng_uint32 iRepeat; - mng_uint8 iTermination = 0; - mng_uint32 iItermin = 1; - mng_uint32 iItermax = 0x7fffffffL; - mng_retcode iRetcode; - - pData->bHasLOOP = MNG_TRUE; /* indicate we're inside a loop */ - - iLevel = *pRawdata; /* determine the fields for processing */ - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) - { - iTermination = *(pRawdata+1); - - iRepeat = mng_get_uint32 (pRawdata+2); - } - else -#endif - iRepeat = mng_get_uint32 (pRawdata+1); - - if (iRawlen >= 6) - { -#ifndef MNG_NO_OLD_VERSIONS - if (!pData->bPreDraft48) -#endif - iTermination = *(pRawdata+5); - - if (iRawlen >= 10) - { - iItermin = mng_get_uint32 (pRawdata+6); - - if (iRawlen >= 14) - { - iItermax = mng_get_uint32 (pRawdata+10); - - /* TODO: process signals */ - - } - } - } - /* create the LOOP ani-object */ - iRetcode = mng_create_ani_loop (pData, iLevel, iRepeat, iTermination, - iItermin, iItermax, 0, 0); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* skip till matching ENDL if iteration=0 */ - if ((!pData->bSkipping) && (iRepeat == 0)) - pData->bSkipping = MNG_TRUE; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (iRawlen >= 5) /* store the fields */ - { - ((mng_loopp)*ppChunk)->iLevel = *pRawdata; - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) - { - ((mng_loopp)*ppChunk)->iTermination = *(pRawdata+1); - ((mng_loopp)*ppChunk)->iRepeat = mng_get_uint32 (pRawdata+2); - } - else -#endif - { - ((mng_loopp)*ppChunk)->iRepeat = mng_get_uint32 (pRawdata+1); - } - - if (iRawlen >= 6) - { -#ifndef MNG_NO_OLD_VERSIONS - if (!pData->bPreDraft48) -#endif - ((mng_loopp)*ppChunk)->iTermination = *(pRawdata+5); - - if (iRawlen >= 10) - { - ((mng_loopp)*ppChunk)->iItermin = mng_get_uint32 (pRawdata+6); - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (iRawlen >= 14) - { - ((mng_loopp)*ppChunk)->iItermax = mng_get_uint32 (pRawdata+10); - ((mng_loopp)*ppChunk)->iCount = (iRawlen - 14) / 4; - - if (((mng_loopp)*ppChunk)->iCount) - { - MNG_ALLOC (pData, ((mng_loopp)*ppChunk)->pSignals, - ((mng_loopp)*ppChunk)->iCount << 2); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata + 14; - mng_uint32p pOut = (mng_uint32p)((mng_loopp)*ppChunk)->pSignals; - - for (iX = 0; iX < ((mng_loopp)*ppChunk)->iCount; iX++) - { - *pOut++ = mng_get_uint32 (pIn); - pIn += 4; - } - } -#else - MNG_COPY (((mng_loopp)*ppChunk)->pSignals, pRawdata + 14, - ((mng_loopp)*ppChunk)->iCount << 2); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } -#endif - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_LOOP -READ_CHUNK (mng_read_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ENDL, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 1) /* length must be exactly 1 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - if (pData->bHasLOOP) /* are we really processing a loop ? */ - { - mng_uint8 iLevel = *pRawdata; /* get the nest level */ - /* create an ENDL animation object */ - mng_retcode iRetcode = mng_create_ani_endl (pData, iLevel); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -/* { - mng_ani_endlp pENDL = (mng_ani_endlp)pData->pLastaniobj; - - iRetcode = pENDL->sHeader.fProcess (pData, pENDL); - - if (iRetcode) - return iRetcode; - } */ - } - else - MNG_ERROR (pData, MNG_NOMATCHINGLOOP); - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_endlp)*ppChunk)->iLevel = *pRawdata; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_DEFI -READ_CHUNK (mng_read_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DEFI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 2) && (iRawlen != 3) && (iRawlen != 4) && - (iRawlen != 12) && (iRawlen != 28)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - pData->iDEFIobjectid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - { - pData->bDEFIhasdonotshow = MNG_TRUE; - pData->iDEFIdonotshow = *(pRawdata+2); - } - else - { - pData->bDEFIhasdonotshow = MNG_FALSE; - pData->iDEFIdonotshow = 0; - } - - if (iRawlen > 3) - { - pData->bDEFIhasconcrete = MNG_TRUE; - pData->iDEFIconcrete = *(pRawdata+3); - } - else - { - pData->bDEFIhasconcrete = MNG_FALSE; - pData->iDEFIconcrete = 0; - } - - if (iRawlen > 4) - { - pData->bDEFIhasloca = MNG_TRUE; - pData->iDEFIlocax = mng_get_int32 (pRawdata+4); - pData->iDEFIlocay = mng_get_int32 (pRawdata+8); - } - else - { - pData->bDEFIhasloca = MNG_FALSE; - pData->iDEFIlocax = 0; - pData->iDEFIlocay = 0; - } - - if (iRawlen > 12) - { - pData->bDEFIhasclip = MNG_TRUE; - pData->iDEFIclipl = mng_get_int32 (pRawdata+12); - pData->iDEFIclipr = mng_get_int32 (pRawdata+16); - pData->iDEFIclipt = mng_get_int32 (pRawdata+20); - pData->iDEFIclipb = mng_get_int32 (pRawdata+24); - } - else - { - pData->bDEFIhasclip = MNG_FALSE; - pData->iDEFIclipl = 0; - pData->iDEFIclipr = 0; - pData->iDEFIclipt = 0; - pData->iDEFIclipb = 0; - } - /* create an animation object */ - iRetcode = mng_create_ani_defi (pData); - - if (!iRetcode) /* do display processing */ - iRetcode = mng_process_display_defi (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_defip)*ppChunk)->iObjectid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - { - ((mng_defip)*ppChunk)->bHasdonotshow = MNG_TRUE; - ((mng_defip)*ppChunk)->iDonotshow = *(pRawdata+2); - } - else - ((mng_defip)*ppChunk)->bHasdonotshow = MNG_FALSE; - - if (iRawlen > 3) - { - ((mng_defip)*ppChunk)->bHasconcrete = MNG_TRUE; - ((mng_defip)*ppChunk)->iConcrete = *(pRawdata+3); - } - else - ((mng_defip)*ppChunk)->bHasconcrete = MNG_FALSE; - - if (iRawlen > 4) - { - ((mng_defip)*ppChunk)->bHasloca = MNG_TRUE; - ((mng_defip)*ppChunk)->iXlocation = mng_get_int32 (pRawdata+4); - ((mng_defip)*ppChunk)->iYlocation = mng_get_int32 (pRawdata+8); - } - else - ((mng_defip)*ppChunk)->bHasloca = MNG_FALSE; - - if (iRawlen > 12) - { - ((mng_defip)*ppChunk)->bHasclip = MNG_TRUE; - ((mng_defip)*ppChunk)->iLeftcb = mng_get_int32 (pRawdata+12); - ((mng_defip)*ppChunk)->iRightcb = mng_get_int32 (pRawdata+16); - ((mng_defip)*ppChunk)->iTopcb = mng_get_int32 (pRawdata+20); - ((mng_defip)*ppChunk)->iBottomcb = mng_get_int32 (pRawdata+24); - } - else - ((mng_defip)*ppChunk)->bHasclip = MNG_FALSE; - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_BASI -READ_CHUNK (mng_read_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BASI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 13) && (iRawlen != 19) && (iRawlen != 21) && (iRawlen != 22)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasBASI = MNG_TRUE; /* inside a BASI-IEND block now */ - /* store interesting fields */ - pData->iDatawidth = mng_get_uint32 (pRawdata); - pData->iDataheight = mng_get_uint32 (pRawdata+4); - pData->iBitdepth = *(pRawdata+8); - pData->iColortype = *(pRawdata+9); - pData->iCompression = *(pRawdata+10); - pData->iFilter = *(pRawdata+11); - pData->iInterlace = *(pRawdata+12); - - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iBitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iBitdepth < 8) - pData->iBitdepth = 8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth > 8) - { - pData->iBitdepth = 8; - pData->iPNGmult = 2; - } -#endif - - if ((pData->iBitdepth != 8) /* parameter validity checks */ -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iBitdepth != 1) && - (pData->iBitdepth != 2) && - (pData->iBitdepth != 4) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iBitdepth != 16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iColortype != MNG_COLORTYPE_GRAY ) && - (pData->iColortype != MNG_COLORTYPE_RGB ) && - (pData->iColortype != MNG_COLORTYPE_INDEXED) && - (pData->iColortype != MNG_COLORTYPE_GRAYA ) && - (pData->iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iColortype == MNG_COLORTYPE_INDEXED) && (pData->iBitdepth > 8)) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (((pData->iColortype == MNG_COLORTYPE_RGB ) || - (pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iColortype == MNG_COLORTYPE_RGBA ) ) && - (pData->iBitdepth < 8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iCompression != MNG_COMPRESSION_DEFLATE) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iFilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iFilter != MNG_FILTER_DIFFERING) && - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iFilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iFilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iFilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iInterlace != MNG_INTERLACE_NONE ) && - (pData->iInterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint16 iRed = 0; - mng_uint16 iGreen = 0; - mng_uint16 iBlue = 0; - mng_bool bHasalpha = MNG_FALSE; - mng_uint16 iAlpha = 0xFFFF; - mng_uint8 iViewable = 0; - mng_retcode iRetcode; - - if (iRawlen > 13) /* get remaining fields, if any */ - { - iRed = mng_get_uint16 (pRawdata+13); - iGreen = mng_get_uint16 (pRawdata+15); - iBlue = mng_get_uint16 (pRawdata+17); - } - - if (iRawlen > 19) - { - bHasalpha = MNG_TRUE; - iAlpha = mng_get_uint16 (pRawdata+19); - } - - if (iRawlen > 21) - iViewable = *(pRawdata+21); - /* create an animation object */ - iRetcode = mng_create_ani_basi (pData, iRed, iGreen, iBlue, - bHasalpha, iAlpha, iViewable); - -/* if (!iRetcode) - iRetcode = mng_process_display_basi (pData, iRed, iGreen, iBlue, - bHasalpha, iAlpha, iViewable); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_basip)*ppChunk)->iWidth = mng_get_uint32 (pRawdata); - ((mng_basip)*ppChunk)->iHeight = mng_get_uint32 (pRawdata+4); -#ifdef MNG_NO_16BIT_SUPPORT - if (*(pRawdata+8) > 8) - ((mng_basip)*ppChunk)->iBitdepth = 8; - else -#endif - ((mng_basip)*ppChunk)->iBitdepth = *(pRawdata+8); - ((mng_basip)*ppChunk)->iColortype = *(pRawdata+9); - ((mng_basip)*ppChunk)->iCompression = *(pRawdata+10); - ((mng_basip)*ppChunk)->iFilter = *(pRawdata+11); - ((mng_basip)*ppChunk)->iInterlace = *(pRawdata+12); - - if (iRawlen > 13) - { - ((mng_basip)*ppChunk)->iRed = mng_get_uint16 (pRawdata+13); - ((mng_basip)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+15); - ((mng_basip)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+17); - } - - if (iRawlen > 19) - ((mng_basip)*ppChunk)->iAlpha = mng_get_uint16 (pRawdata+19); - - if (iRawlen > 21) - ((mng_basip)*ppChunk)->iViewable = *(pRawdata+21); - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_CLON -READ_CHUNK (mng_read_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLON, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 4) && (iRawlen != 5) && (iRawlen != 6) && - (iRawlen != 7) && (iRawlen != 16)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint16 iSourceid, iCloneid; - mng_uint8 iClonetype = 0; - mng_bool bHasdonotshow = MNG_FALSE; - mng_uint8 iDonotshow = 0; - mng_uint8 iConcrete = 0; - mng_bool bHasloca = MNG_FALSE; - mng_uint8 iLocationtype = 0; - mng_int32 iLocationx = 0; - mng_int32 iLocationy = 0; - mng_retcode iRetcode; - - iSourceid = mng_get_uint16 (pRawdata); - iCloneid = mng_get_uint16 (pRawdata+2); - - if (iRawlen > 4) - iClonetype = *(pRawdata+4); - - if (iRawlen > 5) - { - bHasdonotshow = MNG_TRUE; - iDonotshow = *(pRawdata+5); - } - - if (iRawlen > 6) - iConcrete = *(pRawdata+6); - - if (iRawlen > 7) - { - bHasloca = MNG_TRUE; - iLocationtype = *(pRawdata+7); - iLocationx = mng_get_int32 (pRawdata+8); - iLocationy = mng_get_int32 (pRawdata+12); - } - - iRetcode = mng_create_ani_clon (pData, iSourceid, iCloneid, iClonetype, - bHasdonotshow, iDonotshow, iConcrete, - bHasloca, iLocationtype, iLocationx, iLocationy); - -/* if (!iRetcode) - iRetcode = mng_process_display_clon (pData, iSourceid, iCloneid, iClonetype, - bHasdonotshow, iDonotshow, iConcrete, - bHasloca, iLocationtype, iLocationx, - iLocationy); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_clonp)*ppChunk)->iSourceid = mng_get_uint16 (pRawdata); - ((mng_clonp)*ppChunk)->iCloneid = mng_get_uint16 (pRawdata+2); - - if (iRawlen > 4) - ((mng_clonp)*ppChunk)->iClonetype = *(pRawdata+4); - - if (iRawlen > 5) - ((mng_clonp)*ppChunk)->iDonotshow = *(pRawdata+5); - - if (iRawlen > 6) - ((mng_clonp)*ppChunk)->iConcrete = *(pRawdata+6); - - if (iRawlen > 7) - { - ((mng_clonp)*ppChunk)->bHasloca = MNG_TRUE; - ((mng_clonp)*ppChunk)->iLocationtype = *(pRawdata+7); - ((mng_clonp)*ppChunk)->iLocationx = mng_get_int32 (pRawdata+8); - ((mng_clonp)*ppChunk)->iLocationy = mng_get_int32 (pRawdata+12); - } - else - { - ((mng_clonp)*ppChunk)->bHasloca = MNG_FALSE; - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_PAST -READ_CHUNK (mng_read_past) -{ -#if defined(MNG_STORE_CHUNKS) || defined(MNG_SUPPORT_DISPLAY) - mng_retcode iRetcode; - mng_uint16 iTargetid; - mng_uint8 iTargettype; - mng_int32 iTargetx; - mng_int32 iTargety; - mng_uint32 iCount; - mng_uint32 iSize; - mng_ptr pSources; - mng_uint32 iX; - mng_past_sourcep pSource; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PAST, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - /* check the length */ - if ((iRawlen < 41) || (((iRawlen - 11) % 30) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#if defined(MNG_STORE_CHUNKS) || defined(MNG_SUPPORT_DISPLAY) - iTargetid = mng_get_uint16 (pRawdata); - iTargettype = *(pRawdata+2); - iTargetx = mng_get_int32 (pRawdata+3); - iTargety = mng_get_int32 (pRawdata+7); - iCount = ((iRawlen - 11) / 30); /* how many entries again? */ - iSize = iCount * sizeof (mng_past_source); - - pRawdata += 11; - /* get a buffer for all the source blocks */ - MNG_ALLOC (pData, pSources, iSize); - - pSource = (mng_past_sourcep)pSources; - - for (iX = 0; iX < iCount; iX++) /* now copy the source blocks */ - { - pSource->iSourceid = mng_get_uint16 (pRawdata); - pSource->iComposition = *(pRawdata+2); - pSource->iOrientation = *(pRawdata+3); - pSource->iOffsettype = *(pRawdata+4); - pSource->iOffsetx = mng_get_int32 (pRawdata+5); - pSource->iOffsety = mng_get_int32 (pRawdata+9); - pSource->iBoundarytype = *(pRawdata+13); - pSource->iBoundaryl = mng_get_int32 (pRawdata+14); - pSource->iBoundaryr = mng_get_int32 (pRawdata+18); - pSource->iBoundaryt = mng_get_int32 (pRawdata+22); - pSource->iBoundaryb = mng_get_int32 (pRawdata+26); - - pSource++; - pRawdata += 30; - } -#endif - -#ifdef MNG_SUPPORT_DISPLAY - { /* create playback object */ - iRetcode = mng_create_ani_past (pData, iTargetid, iTargettype, iTargetx, - iTargety, iCount, pSources); - -/* if (!iRetcode) - iRetcode = mng_process_display_past (pData, iTargetid, iTargettype, iTargetx, - iTargety, iCount, pSources); */ - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pSources, iSize); - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pSources, iSize); - return iRetcode; - } - /* store the fields */ - ((mng_pastp)*ppChunk)->iDestid = iTargetid; - ((mng_pastp)*ppChunk)->iTargettype = iTargettype; - ((mng_pastp)*ppChunk)->iTargetx = iTargetx; - ((mng_pastp)*ppChunk)->iTargety = iTargety; - ((mng_pastp)*ppChunk)->iCount = iCount; - /* get a buffer & copy the source blocks */ - MNG_ALLOC (pData, ((mng_pastp)*ppChunk)->pSources, iSize); - MNG_COPY (((mng_pastp)*ppChunk)->pSources, pSources, iSize); - } -#endif /* MNG_STORE_CHUNKS */ - -#if defined(MNG_STORE_CHUNKS) || defined(MNG_SUPPORT_DISPLAY) - /* free the source block buffer */ - MNG_FREEX (pData, pSources, iSize); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_DISC -READ_CHUNK (mng_read_disc) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - mng_uint32 iCount; - mng_uint16p pIds = MNG_NULL; - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DISC, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if ((iRawlen % 2) != 0) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - iCount = (iRawlen / sizeof (mng_uint16)); - - if (iCount) - { - MNG_ALLOC (pData, pIds, iRawlen); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint8p pIn = pRawdata; - mng_uint16p pOut = pIds; - - for (iX = 0; iX < iCount; iX++) - { - *pOut++ = mng_get_uint16 (pIn); - pIn += 2; - } - } -#else - MNG_COPY (pIds, pRawdata, iRawlen); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } -#endif - -#ifdef MNG_SUPPORT_DISPLAY - { /* create playback object */ - iRetcode = mng_create_ani_disc (pData, iCount, pIds); - -/* if (!iRetcode) - iRetcode = mng_process_display_disc (pData, iCount, pIds); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_discp)*ppChunk)->iCount = iCount; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_discp)*ppChunk)->pObjectids, iRawlen); - MNG_COPY (((mng_discp)*ppChunk)->pObjectids, pIds, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - if (iRawlen) - MNG_FREEX (pData, pIds, iRawlen); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_BACK -READ_CHUNK (mng_read_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BACK, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 6) && (iRawlen != 7) && (iRawlen != 9) && (iRawlen != 10)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - /* retrieve the fields */ - pData->bHasBACK = MNG_TRUE; - pData->iBACKred = mng_get_uint16 (pRawdata); - pData->iBACKgreen = mng_get_uint16 (pRawdata+2); - pData->iBACKblue = mng_get_uint16 (pRawdata+4); - - if (iRawlen > 6) - pData->iBACKmandatory = *(pRawdata+6); - else - pData->iBACKmandatory = 0; - - if (iRawlen > 7) - pData->iBACKimageid = mng_get_uint16 (pRawdata+7); - else - pData->iBACKimageid = 0; - - if (iRawlen > 9) - pData->iBACKtile = *(pRawdata+9); - else - pData->iBACKtile = 0; - - iRetcode = mng_create_ani_back (pData, pData->iBACKred, pData->iBACKgreen, - pData->iBACKblue, pData->iBACKmandatory, - pData->iBACKimageid, pData->iBACKtile); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_backp)*ppChunk)->iRed = mng_get_uint16 (pRawdata); - ((mng_backp)*ppChunk)->iGreen = mng_get_uint16 (pRawdata+2); - ((mng_backp)*ppChunk)->iBlue = mng_get_uint16 (pRawdata+4); - - if (iRawlen > 6) - ((mng_backp)*ppChunk)->iMandatory = *(pRawdata+6); - - if (iRawlen > 7) - ((mng_backp)*ppChunk)->iImageid = mng_get_uint16 (pRawdata+7); - - if (iRawlen > 9) - ((mng_backp)*ppChunk)->iTile = *(pRawdata+9); - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_FRAM -READ_CHUNK (mng_read_fram) -{ - mng_uint8p pTemp; -#ifdef MNG_STORE_CHUNKS - mng_uint32 iNamelen; -#endif - mng_uint32 iRemain; - mng_uint32 iRequired = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FRAM, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen <= 1) /* only framing-mode ? */ - { -#ifdef MNG_STORE_CHUNKS - iNamelen = 0; /* indicate so */ -#endif - iRemain = 0; - pTemp = MNG_NULL; - } - else - { - pTemp = find_null (pRawdata+1); /* find null-separator */ - /* not found inside input-data ? */ - if ((pTemp - pRawdata) > (mng_int32)iRawlen) - pTemp = pRawdata + iRawlen; /* than remainder is name */ - -#ifdef MNG_STORE_CHUNKS - iNamelen = (mng_uint32)((pTemp - pRawdata) - 1); -#endif - iRemain = (mng_uint32)(iRawlen - (pTemp - pRawdata)); - - if (iRemain) /* if there is remaining data it's less 1 byte */ - iRemain--; - - if ((iRemain) && (iRemain < 4)) /* remains must be empty or at least 4 bytes */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if (iRemain) - { - iRequired = 4; /* calculate and check required remaining length */ - - if (*(pTemp+1)) { iRequired += 4; } - if (*(pTemp+2)) { iRequired += 4; } - if (*(pTemp+3)) { iRequired += 17; } - - if (*(pTemp+4)) - { - if ((iRemain - iRequired) % 4 != 0) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - else - { - if (iRemain != iRequired) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - } - } - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint8p pWork = pTemp; - mng_uint8 iFramemode = 0; - mng_uint8 iChangedelay = 0; - mng_uint32 iDelay = 0; - mng_uint8 iChangetimeout = 0; - mng_uint32 iTimeout = 0; - mng_uint8 iChangeclipping = 0; - mng_uint8 iCliptype = 0; - mng_int32 iClipl = 0; - mng_int32 iClipr = 0; - mng_int32 iClipt = 0; - mng_int32 iClipb = 0; - mng_retcode iRetcode; - - if (iRawlen) /* any data specified ? */ - { - if (*(pRawdata)) /* save the new framing mode ? */ - { - iFramemode = *(pRawdata); - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) /* old style input-stream ? */ - { - switch (iFramemode) - { - case 0: { break; } - case 1: { iFramemode = 3; break; } - case 2: { iFramemode = 4; break; } - case 3: { iFramemode = 1; break; } - case 4: { iFramemode = 1; break; } - case 5: { iFramemode = 2; break; } - default: { iFramemode = 1; break; } - } - } -#endif - } - - if (iRemain) - { - iChangedelay = *(pWork+1); - iChangetimeout = *(pWork+2); - iChangeclipping = *(pWork+3); - pWork += 5; - - if (iChangedelay) /* delay changed ? */ - { - iDelay = mng_get_uint32 (pWork); - pWork += 4; - } - - if (iChangetimeout) /* timeout changed ? */ - { - iTimeout = mng_get_uint32 (pWork); - pWork += 4; - } - - if (iChangeclipping) /* clipping changed ? */ - { - iCliptype = *pWork; - iClipl = mng_get_int32 (pWork+1); - iClipr = mng_get_int32 (pWork+5); - iClipt = mng_get_int32 (pWork+9); - iClipb = mng_get_int32 (pWork+13); - } - } - } - - iRetcode = mng_create_ani_fram (pData, iFramemode, iChangedelay, iDelay, - iChangetimeout, iTimeout, - iChangeclipping, iCliptype, - iClipl, iClipr, iClipt, iClipb); - -/* if (!iRetcode) - iRetcode = mng_process_display_fram (pData, iFramemode, iChangedelay, iDelay, - iChangetimeout, iTimeout, - iChangeclipping, iCliptype, - iClipl, iClipr, iClipt, iClipb); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_framp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - mng_uint8 iFramemode = *(pRawdata); - -#ifndef MNG_NO_OLD_VERSIONS - if (pData->bPreDraft48) /* old style input-stream ? */ - { - switch (iFramemode) - { - case 1: { iFramemode = 3; break; } - case 2: { iFramemode = 4; break; } - case 3: { iFramemode = 5; break; } /* TODO: provision for mode=5 ??? */ - case 4: { iFramemode = 1; break; } - case 5: { iFramemode = 2; break; } - default: { iFramemode = 1; break; } - } - } -#endif - - ((mng_framp)*ppChunk)->iMode = iFramemode; - ((mng_framp)*ppChunk)->iNamesize = iNamelen; - - if (iNamelen) - { - MNG_ALLOC (pData, ((mng_framp)*ppChunk)->zName, iNamelen+1); - MNG_COPY (((mng_framp)*ppChunk)->zName, pRawdata+1, iNamelen); - } - - if (iRemain) - { - ((mng_framp)*ppChunk)->iChangedelay = *(pTemp+1); - ((mng_framp)*ppChunk)->iChangetimeout = *(pTemp+2); - ((mng_framp)*ppChunk)->iChangeclipping = *(pTemp+3); - ((mng_framp)*ppChunk)->iChangesyncid = *(pTemp+4); - - pTemp += 5; - - if (((mng_framp)*ppChunk)->iChangedelay) - { - ((mng_framp)*ppChunk)->iDelay = mng_get_uint32 (pTemp); - pTemp += 4; - } - - if (((mng_framp)*ppChunk)->iChangetimeout) - { - ((mng_framp)*ppChunk)->iTimeout = mng_get_uint32 (pTemp); - pTemp += 4; - } - - if (((mng_framp)*ppChunk)->iChangeclipping) - { - ((mng_framp)*ppChunk)->iBoundarytype = *pTemp; - ((mng_framp)*ppChunk)->iBoundaryl = mng_get_int32 (pTemp+1); - ((mng_framp)*ppChunk)->iBoundaryr = mng_get_int32 (pTemp+5); - ((mng_framp)*ppChunk)->iBoundaryt = mng_get_int32 (pTemp+9); - ((mng_framp)*ppChunk)->iBoundaryb = mng_get_int32 (pTemp+13); - pTemp += 17; - } - - if (((mng_framp)*ppChunk)->iChangesyncid) - { - ((mng_framp)*ppChunk)->iCount = (iRemain - iRequired) / 4; - - if (((mng_framp)*ppChunk)->iCount) - { - MNG_ALLOC (pData, ((mng_framp)*ppChunk)->pSyncids, - ((mng_framp)*ppChunk)->iCount * 4); - -#ifndef MNG_BIGENDIAN_SUPPORTED - { - mng_uint32 iX; - mng_uint32p pOut = ((mng_framp)*ppChunk)->pSyncids; - - for (iX = 0; iX < ((mng_framp)*ppChunk)->iCount; iX++) - { - *pOut++ = mng_get_uint32 (pTemp); - pTemp += 4; - } - } -#else - MNG_COPY (((mng_framp)*ppChunk)->pSyncids, pTemp, - ((mng_framp)*ppChunk)->iCount * 4); -#endif /* !MNG_BIGENDIAN_SUPPORTED */ - } - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_MOVE -READ_CHUNK (mng_read_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MOVE, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 13) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - /* create a MOVE animation object */ - iRetcode = mng_create_ani_move (pData, mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9)); - -/* if (!iRetcode) - iRetcode = mng_process_display_move (pData, - mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9)); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_movep)*ppChunk)->iFirstid = mng_get_uint16 (pRawdata); - ((mng_movep)*ppChunk)->iLastid = mng_get_uint16 (pRawdata+2); - ((mng_movep)*ppChunk)->iMovetype = *(pRawdata+4); - ((mng_movep)*ppChunk)->iMovex = mng_get_int32 (pRawdata+5); - ((mng_movep)*ppChunk)->iMovey = mng_get_int32 (pRawdata+9); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_CLIP -READ_CHUNK (mng_read_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLIP, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 21) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - /* create a CLIP animation object */ - iRetcode = mng_create_ani_clip (pData, mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9), - mng_get_int32 (pRawdata+13), - mng_get_int32 (pRawdata+17)); - -/* if (!iRetcode) - iRetcode = mng_process_display_clip (pData, - mng_get_uint16 (pRawdata), - mng_get_uint16 (pRawdata+2), - *(pRawdata+4), - mng_get_int32 (pRawdata+5), - mng_get_int32 (pRawdata+9), - mng_get_int32 (pRawdata+13), - mng_get_int32 (pRawdata+17)); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_clipp)*ppChunk)->iFirstid = mng_get_uint16 (pRawdata); - ((mng_clipp)*ppChunk)->iLastid = mng_get_uint16 (pRawdata+2); - ((mng_clipp)*ppChunk)->iCliptype = *(pRawdata+4); - ((mng_clipp)*ppChunk)->iClipl = mng_get_int32 (pRawdata+5); - ((mng_clipp)*ppChunk)->iClipr = mng_get_int32 (pRawdata+9); - ((mng_clipp)*ppChunk)->iClipt = mng_get_int32 (pRawdata+13); - ((mng_clipp)*ppChunk)->iClipb = mng_get_int32 (pRawdata+17); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_SHOW -READ_CHUNK (mng_read_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SHOW, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check the length */ - if ((iRawlen != 0) && (iRawlen != 2) && (iRawlen != 4) && (iRawlen != 5)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - if (iRawlen) /* determine parameters if any */ - { - pData->iSHOWfromid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - pData->iSHOWtoid = mng_get_uint16 (pRawdata+2); - else - pData->iSHOWtoid = pData->iSHOWfromid; - - if (iRawlen > 4) - pData->iSHOWmode = *(pRawdata+4); - else - pData->iSHOWmode = 0; - } - else /* use defaults then */ - { - pData->iSHOWmode = 2; - pData->iSHOWfromid = 1; - pData->iSHOWtoid = 65535; - } - /* create a SHOW animation object */ - iRetcode = mng_create_ani_show (pData, pData->iSHOWfromid, - pData->iSHOWtoid, pData->iSHOWmode); - - if (!iRetcode) - iRetcode = mng_process_display_show (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_showp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_showp)*ppChunk)->iFirstid = mng_get_uint16 (pRawdata); - - if (iRawlen > 2) - ((mng_showp)*ppChunk)->iLastid = mng_get_uint16 (pRawdata+2); - else - ((mng_showp)*ppChunk)->iLastid = ((mng_showp)*ppChunk)->iFirstid; - - if (iRawlen > 4) - ((mng_showp)*ppChunk)->iMode = *(pRawdata+4); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_TERM -READ_CHUNK (mng_read_term) -{ - mng_uint8 iTermaction; - mng_uint8 iIteraction = 0; - mng_uint32 iDelay = 0; - mng_uint32 iItermax = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TERM, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - /* should be behind MHDR or SAVE !! */ - if ((!pData->bHasSAVE) && (pData->iChunkseq > 2)) - { - pData->bMisplacedTERM = MNG_TRUE; /* indicate we found a misplaced TERM */ - /* and send a warning signal!!! */ - MNG_WARNING (pData, MNG_SEQUENCEERROR); - } - - if (pData->bHasLOOP) /* no way, jose! */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasTERM) /* only 1 allowed! */ - MNG_ERROR (pData, MNG_MULTIPLEERROR); - /* check the length */ - if ((iRawlen != 1) && (iRawlen != 10)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasTERM = MNG_TRUE; - - iTermaction = *pRawdata; /* get the fields */ - - if (iRawlen > 1) - { - iIteraction = *(pRawdata+1); - iDelay = mng_get_uint32 (pRawdata+2); - iItermax = mng_get_uint32 (pRawdata+6); - } - - if (pData->fProcessterm) /* inform the app ? */ - if (!pData->fProcessterm (((mng_handle)pData), iTermaction, iIteraction, - iDelay, iItermax)) - MNG_ERROR (pData, MNG_APPMISCERROR); - -#ifdef MNG_SUPPORT_DISPLAY - { /* create the TERM ani-object */ - mng_retcode iRetcode = mng_create_ani_term (pData, iTermaction, iIteraction, - iDelay, iItermax); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* save for future reference */ - pData->pTermaniobj = pData->pLastaniobj; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_termp)*ppChunk)->iTermaction = iTermaction; - ((mng_termp)*ppChunk)->iIteraction = iIteraction; - ((mng_termp)*ppChunk)->iDelay = iDelay; - ((mng_termp)*ppChunk)->iItermax = iItermax; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_SAVE -READ_CHUNK (mng_read_save) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SAVE, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (pData->bHasSAVE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - pData->bHasSAVE = MNG_TRUE; - - if (pData->fProcesssave) /* inform the application ? */ - { - mng_bool bOke = pData->fProcesssave ((mng_handle)pData); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - - /* TODO: something with the parameters */ - - - /* create a SAVE animation object */ - iRetcode = mng_create_ani_save (pData); - - if (!iRetcode) - iRetcode = mng_process_display_save (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_savep)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) /* not empty ? */ - { - mng_uint8 iOtype = *pRawdata; - mng_uint8 iEtype; - mng_uint32 iCount = 0; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint32 iOffset[2]; - mng_uint32 iStarttime[2]; - mng_uint32 iFramenr; - mng_uint32 iLayernr; - mng_uint32 iX; - mng_save_entryp pEntry = MNG_NULL; - mng_uint32 iNamesize; - - if ((iOtype != 4) && (iOtype != 8)) - MNG_ERROR (pData, MNG_INVOFFSETSIZE); - - ((mng_savep)*ppChunk)->iOffsettype = iOtype; - - for (iX = 0; iX < 2; iX++) /* do this twice to get the count first ! */ - { - pTemp = pRawdata + 1; - iLen = iRawlen - 1; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_save_entry))); - - ((mng_savep)*ppChunk)->iCount = iCount; - ((mng_savep)*ppChunk)->pEntries = pEntry; - } - - while (iLen) /* anything left ? */ - { - iEtype = *pTemp; /* entrytype */ - - if ((iEtype != 0) && (iEtype != 1) && (iEtype != 2) && (iEtype != 3)) - MNG_ERROR (pData, MNG_INVENTRYTYPE); - - pTemp++; - - if (iEtype > 1) - { - iOffset [0] = 0; - iOffset [1] = 0; - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iOffset [0] = 0; - iOffset [1] = mng_get_uint32 (pTemp); - - pTemp += 4; - } - else - { - iOffset [0] = mng_get_uint32 (pTemp); - iOffset [1] = mng_get_uint32 (pTemp+4); - - pTemp += 8; - } - - if (iEtype > 0) - { - iStarttime [0] = 0; - iStarttime [1] = 0; - iLayernr = 0; - iFramenr = 0; - } - else - { - if (iOtype == 4) - { - iStarttime [0] = 0; - iStarttime [1] = mng_get_uint32 (pTemp+0); - iLayernr = mng_get_uint32 (pTemp+4); - iFramenr = mng_get_uint32 (pTemp+8); - - pTemp += 12; - } - else - { - iStarttime [0] = mng_get_uint32 (pTemp+0); - iStarttime [1] = mng_get_uint32 (pTemp+4); - iLayernr = mng_get_uint32 (pTemp+8); - iFramenr = mng_get_uint32 (pTemp+12); - - pTemp += 16; - } - } - } - - pNull = find_null (pTemp); /* get the name length */ - - if ((pNull - pRawdata) > (mng_int32)iRawlen) - { - iNamesize = iLen; /* no null found; so end of SAVE */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen -= iNamesize; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!pEntry) - { - iCount++; - } - else - { - pEntry->iEntrytype = iEtype; - pEntry->iOffset [0] = iOffset [0]; - pEntry->iOffset [1] = iOffset [1]; - pEntry->iStarttime [0] = iStarttime [0]; - pEntry->iStarttime [1] = iStarttime [1]; - pEntry->iLayernr = iLayernr; - pEntry->iFramenr = iFramenr; - pEntry->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zName, iNamesize+1); - MNG_COPY (pEntry->zName, pTemp, iNamesize); - } - - pEntry++; - } - - pTemp += iNamesize; - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_SEEK -READ_CHUNK (mng_read_seek) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SEEK, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasSAVE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_SUPPORT_DISPLAY - /* create a SEEK animation object */ - iRetcode = mng_create_ani_seek (pData, iRawlen, (mng_pchar)pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - - if (pData->fProcessseek) /* inform the app ? */ - { - mng_bool bOke; - mng_pchar zName; - - MNG_ALLOC (pData, zName, iRawlen + 1); - - if (iRawlen) - MNG_COPY (zName, pRawdata, iRawlen); - - bOke = pData->fProcessseek ((mng_handle)pData, zName); - - MNG_FREEX (pData, zName, iRawlen + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_SUPPORT_DISPLAY - /* do display processing of the SEEK */ - iRetcode = mng_process_display_seek (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_seekp)*ppChunk)->iNamesize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_seekp)*ppChunk)->zName, iRawlen+1); - MNG_COPY (((mng_seekp)*ppChunk)->zName, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_eXPI -READ_CHUNK (mng_read_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EXPI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 3) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_expip)*ppChunk)->iSnapshotid = mng_get_uint16 (pRawdata); - ((mng_expip)*ppChunk)->iNamesize = iRawlen - 2; - - if (((mng_expip)*ppChunk)->iNamesize) - { - MNG_ALLOC (pData, ((mng_expip)*ppChunk)->zName, - ((mng_expip)*ppChunk)->iNamesize + 1); - MNG_COPY (((mng_expip)*ppChunk)->zName, pRawdata+2, - ((mng_expip)*ppChunk)->iNamesize); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_fPRI -READ_CHUNK (mng_read_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FPRI, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 2) /* must be two bytes long */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_fprip)*ppChunk)->iDeltatype = *pRawdata; - ((mng_fprip)*ppChunk)->iPriority = *(pRawdata+1); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_nEED -MNG_LOCAL mng_bool CheckKeyword (mng_datap pData, - mng_uint8p pKeyword) -{ - mng_chunkid handled_chunks [] = - { - MNG_UINT_BACK, /* keep it sorted !!!! */ - MNG_UINT_BASI, - MNG_UINT_CLIP, - MNG_UINT_CLON, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DBYK, */ -#endif - MNG_UINT_DEFI, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_DHDR, -#endif - MNG_UINT_DISC, -#ifndef MNG_NO_DELTA_PNG -/* TODO: MNG_UINT_DROP, */ -#endif - MNG_UINT_ENDL, - MNG_UINT_FRAM, - MNG_UINT_IDAT, - MNG_UINT_IEND, - MNG_UINT_IHDR, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - MNG_UINT_IJNG, -#endif - MNG_UINT_IPNG, -#endif -#ifdef MNG_INCLUDE_JNG - MNG_UINT_JDAA, - MNG_UINT_JDAT, - MNG_UINT_JHDR, -/* TODO: MNG_UINT_JSEP, */ - MNG_UINT_JdAA, -#endif - MNG_UINT_LOOP, - MNG_UINT_MAGN, - MNG_UINT_MEND, - MNG_UINT_MHDR, - MNG_UINT_MOVE, -/* TODO: MNG_UINT_ORDR, */ - MNG_UINT_PAST, - MNG_UINT_PLTE, -#ifndef MNG_NO_DELTA_PNG - MNG_UINT_PPLT, - MNG_UINT_PROM, -#endif - MNG_UINT_SAVE, - MNG_UINT_SEEK, - MNG_UINT_SHOW, - MNG_UINT_TERM, -#ifdef MNG_INCLUDE_ANG_PROPOSAL - MNG_UINT_adAT, - MNG_UINT_ahDR, -#endif - MNG_UINT_bKGD, - MNG_UINT_cHRM, -/* TODO: MNG_UINT_eXPI, */ - MNG_UINT_evNT, -/* TODO: MNG_UINT_fPRI, */ - MNG_UINT_gAMA, -/* TODO: MNG_UINT_hIST, */ - MNG_UINT_iCCP, - MNG_UINT_iTXt, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - MNG_UINT_mpNG, -#endif - MNG_UINT_nEED, -/* TODO: MNG_UINT_oFFs, */ -/* TODO: MNG_UINT_pCAL, */ -/* TODO: MNG_UINT_pHYg, */ -/* TODO: MNG_UINT_pHYs, */ -/* TODO: MNG_UINT_sBIT, */ -/* TODO: MNG_UINT_sCAL, */ -/* TODO: MNG_UINT_sPLT, */ - MNG_UINT_sRGB, - MNG_UINT_tEXt, - MNG_UINT_tIME, - MNG_UINT_tRNS, - MNG_UINT_zTXt, - }; - - mng_bool bOke = MNG_FALSE; - - if (pData->fProcessneed) /* does the app handle it ? */ - bOke = pData->fProcessneed ((mng_handle)pData, (mng_pchar)pKeyword); - - if (!bOke) - { /* find the keyword length */ - mng_uint8p pNull = find_null (pKeyword); - - if (pNull - pKeyword == 4) /* test a chunk ? */ - { /* get the chunk-id */ - mng_chunkid iChunkid = (*pKeyword << 24) + (*(pKeyword+1) << 16) + - (*(pKeyword+2) << 8) + (*(pKeyword+3) ); - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - /* determine max index of table */ - iTop = (sizeof (handled_chunks) / sizeof (handled_chunks [0])) - 1; - - /* binary search; with 52 chunks, worst-case is 7 comparisons */ - iLower = 0; - iMiddle = iTop >> 1; - iUpper = iTop; - - do /* the binary search itself */ - { - if (handled_chunks [iMiddle] < iChunkid) - iLower = iMiddle + 1; - else if (handled_chunks [iMiddle] > iChunkid) - iUpper = iMiddle - 1; - else - { - bOke = MNG_TRUE; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - } - /* test draft ? */ - if ((!bOke) && (pNull - pKeyword == 8) && - (*pKeyword == 'd') && (*(pKeyword+1) == 'r') && - (*(pKeyword+2) == 'a') && (*(pKeyword+3) == 'f') && - (*(pKeyword+4) == 't') && (*(pKeyword+5) == ' ')) - { - mng_uint32 iDraft; - - iDraft = (*(pKeyword+6) - '0') * 10 + (*(pKeyword+7) - '0'); - bOke = (mng_bool)(iDraft <= MNG_MNG_DRAFT); - } - /* test MNG 1.0/1.1 ? */ - if ((!bOke) && (pNull - pKeyword == 7) && - (*pKeyword == 'M') && (*(pKeyword+1) == 'N') && - (*(pKeyword+2) == 'G') && (*(pKeyword+3) == '-') && - (*(pKeyword+4) == '1') && (*(pKeyword+5) == '.') && - ((*(pKeyword+6) == '0') || (*(pKeyword+6) == '1'))) - bOke = MNG_TRUE; - /* test CACHEOFF ? */ - if ((!bOke) && (pNull - pKeyword == 8) && - (*pKeyword == 'C') && (*(pKeyword+1) == 'A') && - (*(pKeyword+2) == 'C') && (*(pKeyword+3) == 'H') && - (*(pKeyword+4) == 'E') && (*(pKeyword+5) == 'O') && - (*(pKeyword+6) == 'F') && (*(pKeyword+7) == 'F')) - { - if (!pData->pFirstaniobj) /* only if caching hasn't started yet ! */ - { - bOke = MNG_TRUE; - pData->bCacheplayback = MNG_FALSE; - pData->bStorechunks = MNG_FALSE; - } - } - } - - return bOke; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_nEED -READ_CHUNK (mng_read_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_NEED, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 1) /* check the length */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - { /* let's check it */ - mng_bool bOke = MNG_TRUE; - mng_pchar zKeywords; - mng_uint8p pNull, pTemp; - - MNG_ALLOC (pData, zKeywords, iRawlen + 1); - - if (iRawlen) - MNG_COPY (zKeywords, pRawdata, iRawlen); - - pTemp = (mng_uint8p)zKeywords; - pNull = find_null (pTemp); - - while ((bOke) && (pNull < (mng_uint8p)zKeywords + iRawlen)) - { - bOke = CheckKeyword (pData, pTemp); - pTemp = pNull + 1; - pNull = find_null (pTemp); - } - - if (bOke) - bOke = CheckKeyword (pData, pTemp); - - MNG_FREEX (pData, zKeywords, iRawlen + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_UNSUPPORTEDNEED); - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_needp)*ppChunk)->iKeywordssize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_needp)*ppChunk)->zKeywords, iRawlen+1); - MNG_COPY (((mng_needp)*ppChunk)->zKeywords, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_pHYg -READ_CHUNK (mng_read_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYG, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* it's 9 bytes or empty; no more, no less! */ - if ((iRawlen != 9) && (iRawlen != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_phygp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - - if (iRawlen) - { - ((mng_phygp)*ppChunk)->iSizex = mng_get_uint32 (pRawdata); - ((mng_phygp)*ppChunk)->iSizey = mng_get_uint32 (pRawdata+4); - ((mng_phygp)*ppChunk)->iUnit = *(pRawdata+8); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JHDR, MNG_LC_START); -#endif - /* sequence checks */ - if ((pData->eSigtype != mng_it_jng) && (pData->eSigtype != mng_it_mng)) - MNG_ERROR (pData, MNG_CHUNKNOTALLOWED); - - if ((pData->eSigtype == mng_it_jng) && (pData->iChunkseq > 1)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 16) /* length oke ? */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - /* inside a JHDR-IEND block now */ - pData->bHasJHDR = MNG_TRUE; - /* and store interesting fields */ - pData->iDatawidth = mng_get_uint32 (pRawdata); - pData->iDataheight = mng_get_uint32 (pRawdata+4); - pData->iJHDRcolortype = *(pRawdata+8); - pData->iJHDRimgbitdepth = *(pRawdata+9); - pData->iJHDRimgcompression = *(pRawdata+10); - pData->iJHDRimginterlace = *(pRawdata+11); - pData->iJHDRalphabitdepth = *(pRawdata+12); - pData->iJHDRalphacompression = *(pRawdata+13); - pData->iJHDRalphafilter = *(pRawdata+14); - pData->iJHDRalphainterlace = *(pRawdata+15); - - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - pData->iPNGmult = 1; - pData->iPNGdepth = pData->iJHDRalphabitdepth; -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iJHDRalphabitdepth < 8) - pData->iJHDRalphabitdepth = 8; -#endif - -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iJHDRalphabitdepth > 8) - { - pData->iPNGmult = 2; - pData->iJHDRalphabitdepth = 8; - } -#endif - /* parameter validity checks */ - if ((pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAY ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iJHDRcolortype != MNG_COLORTYPE_JPEGCOLORA) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - if ((pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG12 ) && - (pData->iJHDRimgbitdepth != MNG_BITDEPTH_JPEG8AND12) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iJHDRimgcompression != MNG_COMPRESSION_BASELINEJPEG) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if ((pData->iJHDRimginterlace != MNG_INTERLACE_SEQUENTIAL ) && - (pData->iJHDRimginterlace != MNG_INTERLACE_PROGRESSIVE) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - if ((pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_1_2_4BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_1 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_2 ) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_4 ) -#endif -#ifndef MNG_NO_16BIT_SUPPORT - && (pData->iJHDRalphabitdepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ((pData->iJHDRalphacompression != MNG_COMPRESSION_DEFLATE ) && - (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) ) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if ((pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG) && - (pData->iJHDRalphabitdepth != MNG_BITDEPTH_8 ) ) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - -#if defined(FILTER192) || defined(FILTER193) - if ((pData->iJHDRalphafilter != MNG_FILTER_ADAPTIVE ) && -#if defined(FILTER192) && defined(FILTER193) - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) && - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#else -#ifdef FILTER192 - (pData->iJHDRalphafilter != MNG_FILTER_DIFFERING) ) -#else - (pData->iJHDRalphafilter != MNG_FILTER_NOFILTER ) ) -#endif -#endif - MNG_ERROR (pData, MNG_INVALIDFILTER); -#else - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); -#endif - - if ((pData->iJHDRalphainterlace != MNG_INTERLACE_NONE ) && - (pData->iJHDRalphainterlace != MNG_INTERLACE_ADAM7) ) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - } - else - { - if (pData->iJHDRalphabitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if (pData->iJHDRalphacompression) - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - - if (pData->iJHDRalphafilter) - MNG_ERROR (pData, MNG_INVALIDFILTER); - - if (pData->iJHDRalphainterlace) - MNG_ERROR (pData, MNG_INVALIDINTERLACE); - - } - - if (!pData->bHasheader) /* first chunk ? */ - { - pData->bHasheader = MNG_TRUE; /* we've got a header */ - pData->eImagetype = mng_it_jng; /* then this must be a JNG */ - pData->iWidth = mng_get_uint32 (pRawdata); - pData->iHeight = mng_get_uint32 (pRawdata+4); - /* predict alpha-depth ! */ - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - pData->iAlphadepth = pData->iJHDRalphabitdepth; - else - pData->iAlphadepth = 0; - /* fits on maximum canvas ? */ - if ((pData->iWidth > pData->iMaxwidth) || (pData->iHeight > pData->iMaxheight)) - MNG_WARNING (pData, MNG_IMAGETOOLARGE); - - if (pData->fProcessheader) /* inform the app ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - } - - pData->iColortype = 0; /* fake grayscale for other routines */ - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_process_display_jhdr (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_jhdrp)*ppChunk)->iWidth = mng_get_uint32 (pRawdata); - ((mng_jhdrp)*ppChunk)->iHeight = mng_get_uint32 (pRawdata+4); - ((mng_jhdrp)*ppChunk)->iColortype = *(pRawdata+8); - ((mng_jhdrp)*ppChunk)->iImagesampledepth = *(pRawdata+9); - ((mng_jhdrp)*ppChunk)->iImagecompression = *(pRawdata+10); - ((mng_jhdrp)*ppChunk)->iImageinterlace = *(pRawdata+11); - ((mng_jhdrp)*ppChunk)->iAlphasampledepth = *(pRawdata+12); -#ifdef MNG_NO_16BIT_SUPPORT - if (*(pRawdata+12) > 8) - ((mng_jhdrp)*ppChunk)->iAlphasampledepth = 8; -#endif - ((mng_jhdrp)*ppChunk)->iAlphacompression = *(pRawdata+13); - ((mng_jhdrp)*ppChunk)->iAlphafilter = *(pRawdata+14); - ((mng_jhdrp)*ppChunk)->iAlphainterlace = *(pRawdata+15); - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jhdr 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jdaa) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - volatile mng_retcode iRetcode; - - iRetcode=MNG_NOERROR; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAA, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasJHDR) && (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->bHasJSEP) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (pData->iJHDRalphacompression != MNG_COMPRESSION_BASELINEJPEG) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen == 0) /* can never be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasJDAA = MNG_TRUE; /* got some JDAA now, don't we */ - -#ifdef MNG_SUPPORT_DISPLAY - iRetcode = mng_process_display_jdaa (pData, iRawlen, pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_jdaap)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_jdaap)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen != 0) /* is there any data ? */ - { - MNG_ALLOC (pData, ((mng_jdaap)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_jdaap)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jdaa 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jdat) -{ -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - volatile mng_retcode iRetcode; - - iRetcode=MNG_NOERROR; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasJHDR) && (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen == 0) /* can never be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasJDAT = MNG_TRUE; /* got some JDAT now, don't we */ - -#ifdef MNG_SUPPORT_DISPLAY - iRetcode = mng_process_display_jdat (pData, iRawlen, pRawdata); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_jdatp)*ppChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_jdatp)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen != 0) /* is there any data ? */ - { - MNG_ALLOC (pData, ((mng_jdatp)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_jdatp)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jdat 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JSEP, MNG_LC_START); -#endif - - if (!pData->bHasJHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 0) /* must be empty ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasJSEP = MNG_TRUE; /* indicate we've had the 8-/12-bit separator */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#else -#define read_jsep 0 -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_dhdr) -{ - mng_uint8 iImagetype, iDeltatype; -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DHDR, MNG_LC_START); -#endif - - if (!pData->bHasMHDR) /* sequence checks */ - MNG_ERROR (pData, MNG_SEQUENCEERROR); - -#ifdef MNG_INCLUDE_JNG - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((pData->bHasIHDR) || (pData->bHasBASI) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check for valid length */ - if ((iRawlen != 4) && (iRawlen != 12) && (iRawlen != 20)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iImagetype = *(pRawdata+2); /* check fields for validity */ - iDeltatype = *(pRawdata+3); - - if (iImagetype > MNG_IMAGETYPE_JNG) - MNG_ERROR (pData, MNG_INVIMAGETYPE); - - if (iDeltatype > MNG_DELTATYPE_NOCHANGE) - MNG_ERROR (pData, MNG_INVDELTATYPE); - - if ((iDeltatype == MNG_DELTATYPE_REPLACE) && (iRawlen > 12)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((iDeltatype == MNG_DELTATYPE_NOCHANGE) && (iRawlen > 4)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - pData->bHasDHDR = MNG_TRUE; /* inside a DHDR-IEND block now */ - pData->iDeltatype = iDeltatype; - - pData->iImagelevel++; /* one level deeper */ - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_uint16 iObjectid = mng_get_uint16 (pRawdata); - mng_uint32 iBlockwidth = 0; - mng_uint32 iBlockheight = 0; - mng_uint32 iBlockx = 0; - mng_uint32 iBlocky = 0; - mng_retcode iRetcode; - - if (iRawlen > 4) - { - iBlockwidth = mng_get_uint32 (pRawdata+4); - iBlockheight = mng_get_uint32 (pRawdata+8); - } - - if (iRawlen > 12) - { - iBlockx = mng_get_uint32 (pRawdata+12); - iBlocky = mng_get_uint32 (pRawdata+16); - } - - iRetcode = mng_create_ani_dhdr (pData, iObjectid, iImagetype, iDeltatype, - iBlockwidth, iBlockheight, iBlockx, iBlocky); - -/* if (!iRetcode) - iRetcode = mng_process_display_dhdr (pData, iObjectid, iImagetype, iDeltatype, - iBlockwidth, iBlockheight, iBlockx, iBlocky); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_dhdrp)*ppChunk)->iObjectid = mng_get_uint16 (pRawdata); - ((mng_dhdrp)*ppChunk)->iImagetype = iImagetype; - ((mng_dhdrp)*ppChunk)->iDeltatype = iDeltatype; - - if (iRawlen > 4) - { - ((mng_dhdrp)*ppChunk)->iBlockwidth = mng_get_uint32 (pRawdata+4); - ((mng_dhdrp)*ppChunk)->iBlockheight = mng_get_uint32 (pRawdata+8); - } - - if (iRawlen > 12) - { - ((mng_dhdrp)*ppChunk)->iBlockx = mng_get_uint32 (pRawdata+12); - ((mng_dhdrp)*ppChunk)->iBlocky = mng_get_uint32 (pRawdata+16); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_prom) -{ - mng_uint8 iColortype; - mng_uint8 iSampledepth; - mng_uint8 iFilltype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PROM, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 3) /* gotta be exactly 3 bytes */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iColortype = *pRawdata; /* check fields for validity */ - iSampledepth = *(pRawdata+1); - iFilltype = *(pRawdata+2); - - if ((iColortype != MNG_COLORTYPE_GRAY ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_INDEXED) && - (iColortype != MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - -#ifdef MNG_NO_16BIT_SUPPORT - if (iSampledepth == MNG_BITDEPTH_16 ) - iSampledepth = MNG_BITDEPTH_8; -#endif - - if ((iSampledepth != MNG_BITDEPTH_1 ) && - (iSampledepth != MNG_BITDEPTH_2 ) && - (iSampledepth != MNG_BITDEPTH_4 ) && - (iSampledepth != MNG_BITDEPTH_8 ) -#ifndef MNG_NO_16BIT_SUPPORT - && (iSampledepth != MNG_BITDEPTH_16) -#endif - ) - MNG_ERROR (pData, MNG_INVSAMPLEDEPTH); - - if ((iFilltype != MNG_FILLMETHOD_LEFTBITREPLICATE) && - (iFilltype != MNG_FILLMETHOD_ZEROFILL ) ) - MNG_ERROR (pData, MNG_INVFILLMETHOD); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_prom (pData, iSampledepth, - iColortype, iFilltype); - -/* if (!iRetcode) - iRetcode = mng_process_display_prom (pData, iSampledepth, - iColortype, iFilltype); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_promp)*ppChunk)->iColortype = iColortype; - ((mng_promp)*ppChunk)->iSampledepth = iSampledepth; - ((mng_promp)*ppChunk)->iFilltype = iFilltype; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IPNG, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 0) /* gotta be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_ipng (pData); - - if (!iRetcode) - iRetcode = mng_process_display_ipng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_pplt) -{ - mng_uint8 iDeltatype; - mng_uint8p pTemp; - mng_uint32 iLen; - mng_uint8 iX, iM; - mng_uint32 iY; - mng_uint32 iMax; - mng_rgbpaltab aIndexentries; - mng_uint8arr aAlphaentries; - mng_uint8arr aUsedentries; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PPLT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) && (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 1) /* must have at least 1 byte */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iDeltatype = *pRawdata; - /* valid ? */ - if (iDeltatype > MNG_DELTATYPE_DELTARGBA) - MNG_ERROR (pData, MNG_INVDELTATYPE); - /* must be indexed color ! */ - if (pData->iColortype != MNG_COLORTYPE_INDEXED) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - pTemp = pRawdata + 1; - iLen = iRawlen - 1; - iMax = 0; - - for (iY = 0; iY < 256; iY++) /* reset arrays */ - { - aIndexentries [iY].iRed = 0; - aIndexentries [iY].iGreen = 0; - aIndexentries [iY].iBlue = 0; - aAlphaentries [iY] = 255; - aUsedentries [iY] = 0; - } - - while (iLen) /* as long as there are entries left ... */ - { - mng_uint32 iDiff; - - if (iLen < 2) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iX = *pTemp; /* get start and end index */ - iM = *(pTemp+1); - - if (iM < iX) - MNG_ERROR (pData, MNG_INVALIDINDEX); - - if ((mng_uint32)iM >= iMax) /* determine highest used index */ - iMax = (mng_uint32)iM + 1; - - pTemp += 2; - iLen -= 2; - iDiff = (iM - iX + 1); - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - iDiff = iDiff * 3; - else - if ((iDeltatype == MNG_DELTATYPE_REPLACERGBA) || - (iDeltatype == MNG_DELTATYPE_DELTARGBA ) ) - iDiff = iDiff * 4; - - if (iLen < iDiff) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - if ((iDeltatype == MNG_DELTATYPE_REPLACERGB ) || - (iDeltatype == MNG_DELTATYPE_DELTARGB ) ) - { - for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++) - { - aIndexentries [iY].iRed = *pTemp; - aIndexentries [iY].iGreen = *(pTemp+1); - aIndexentries [iY].iBlue = *(pTemp+2); - aUsedentries [iY] = 1; - - pTemp += 3; - iLen -= 3; - } - } - else - if ((iDeltatype == MNG_DELTATYPE_REPLACEALPHA) || - (iDeltatype == MNG_DELTATYPE_DELTAALPHA ) ) - { - for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++) - { - aAlphaentries [iY] = *pTemp; - aUsedentries [iY] = 1; - - pTemp++; - iLen--; - } - } - else - { - for (iY = (mng_uint32)iX; iY <= (mng_uint32)iM; iY++) - { - aIndexentries [iY].iRed = *pTemp; - aIndexentries [iY].iGreen = *(pTemp+1); - aIndexentries [iY].iBlue = *(pTemp+2); - aAlphaentries [iY] = *(pTemp+3); - aUsedentries [iY] = 1; - - pTemp += 4; - iLen -= 4; - } - } - } - - switch (pData->iBitdepth) /* check maximum allowed entries for bitdepth */ - { - case MNG_BITDEPTH_1 : { - if (iMax > 2) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_2 : { - if (iMax > 4) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - case MNG_BITDEPTH_4 : { - if (iMax > 16) - MNG_ERROR (pData, MNG_INVALIDINDEX); - break; - } - } - -#ifdef MNG_SUPPORT_DISPLAY - { /* create animation object */ - mng_retcode iRetcode = mng_create_ani_pplt (pData, iDeltatype, iMax, - aIndexentries, aAlphaentries, - aUsedentries); - -/* if (!iRetcode) - iRetcode = mng_process_display_pplt (pData, iDeltatype, iMax, aIndexentries, - aAlphaentries, aUsedentries); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_ppltp)*ppChunk)->iDeltatype = iDeltatype; - ((mng_ppltp)*ppChunk)->iCount = iMax; - - for (iY = 0; iY < 256; iY++) - { - ((mng_ppltp)*ppChunk)->aEntries [iY].iRed = aIndexentries [iY].iRed; - ((mng_ppltp)*ppChunk)->aEntries [iY].iGreen = aIndexentries [iY].iGreen; - ((mng_ppltp)*ppChunk)->aEntries [iY].iBlue = aIndexentries [iY].iBlue; - ((mng_ppltp)*ppChunk)->aEntries [iY].iAlpha = aAlphaentries [iY]; - ((mng_ppltp)*ppChunk)->aEntries [iY].bUsed = (mng_bool)(aUsedentries [iY]); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IJNG, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen != 0) /* gotta be empty */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode = mng_create_ani_ijng (pData); - - if (!iRetcode) - iRetcode = mng_process_display_ijng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DROP, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check length */ - if ((iRawlen < 4) || ((iRawlen % 4) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_dropp)*ppChunk)->iCount = iRawlen / 4; - - if (iRawlen) - { - mng_uint32 iX; - mng_uint8p pTemp = pRawdata; - mng_uint32p pEntry; - - MNG_ALLOC (pData, pEntry, iRawlen); - - ((mng_dropp)*ppChunk)->pChunknames = (mng_ptr)pEntry; - - for (iX = 0; iX < iRawlen / 4; iX++) - { - *pEntry = mng_get_uint32 (pTemp); - - pTemp += 4; - pEntry++; - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -READ_CHUNK (mng_read_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DBYK, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 6) /* must be at least 6 long */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_dbykp)*ppChunk)->iChunkname = mng_get_uint32 (pRawdata); - ((mng_dbykp)*ppChunk)->iPolarity = *(pRawdata+4); - ((mng_dbykp)*ppChunk)->iKeywordssize = iRawlen - 5; - - if (iRawlen > 5) - { - MNG_ALLOC (pData, ((mng_dbykp)*ppChunk)->zKeywords, iRawlen-4); - MNG_COPY (((mng_dbykp)*ppChunk)->zKeywords, pRawdata+5, iRawlen-5); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -READ_CHUNK (mng_read_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ORDR, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (!pData->bHasDHDR)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check length */ - if ((iRawlen < 5) || ((iRawlen % 5) != 0)) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#ifdef MNG_SUPPORT_DISPLAY - { - - - /* TODO: something !!! */ - - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_ordrp)*ppChunk)->iCount = iRawlen / 5; - - if (iRawlen) - { - mng_uint32 iX; - mng_ordr_entryp pEntry; - mng_uint8p pTemp = pRawdata; - - MNG_ALLOC (pData, pEntry, iRawlen); - - ((mng_ordrp)*ppChunk)->pEntries = pEntry; - - for (iX = 0; iX < iRawlen / 5; iX++) - { - pEntry->iChunkname = mng_get_uint32 (pTemp); - pEntry->iOrdertype = *(pTemp+4); - - pTemp += 5; - pEntry++; - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_MAGN -READ_CHUNK (mng_read_magn) -{ - mng_uint16 iFirstid, iLastid; - mng_uint8 iMethodX, iMethodY; - mng_uint16 iMX, iMY, iML, iMR, iMT, iMB; - mng_bool bFaulty; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MAGN, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_SUPPORT_JNG - if ((!pData->bHasMHDR) || (pData->bHasIHDR) || (pData->bHasDHDR) || (pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) || (pData->bHasIHDR) || (pData->bHasDHDR)) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* check length */ - if (iRawlen > 20) - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - /* following is an ugly hack to allow faulty layout caused by previous - versions of libmng and MNGeye, which wrote MAGN with a 16-bit - MethodX/MethodY (as opposed to the proper 8-bit as defined in the spec!) */ - - if ((iRawlen == 6) || (iRawlen == 8) || (iRawlen == 10) || (iRawlen == 12) || - (iRawlen == 14) || (iRawlen == 16) || (iRawlen == 20)) - bFaulty = MNG_TRUE; /* these lengths are all wrong */ - else /* length 18 can be right or wrong !!! */ - if ((iRawlen == 18) && (mng_get_uint16 (pRawdata+4) <= 5) && - (mng_get_uint16 (pRawdata+6) < 256) && - (mng_get_uint16 (pRawdata+8) < 256) && - (mng_get_uint16 (pRawdata+10) < 256) && - (mng_get_uint16 (pRawdata+12) < 256) && - (mng_get_uint16 (pRawdata+14) < 256) && - (mng_get_uint16 (pRawdata+16) < 256)) - bFaulty = MNG_TRUE; /* this is very likely the wrong layout */ - else - bFaulty = MNG_FALSE; /* all other cases are handled as right */ - - if (bFaulty) /* wrong layout ? */ - { - if (iRawlen > 0) /* get the fields */ - iFirstid = mng_get_uint16 (pRawdata); - else - iFirstid = 0; - - if (iRawlen > 2) - iLastid = mng_get_uint16 (pRawdata+2); - else - iLastid = iFirstid; - - if (iRawlen > 4) - iMethodX = (mng_uint8)(mng_get_uint16 (pRawdata+4)); - else - iMethodX = 0; - - if (iRawlen > 6) - iMX = mng_get_uint16 (pRawdata+6); - else - iMX = 1; - - if (iRawlen > 8) - iMY = mng_get_uint16 (pRawdata+8); - else - iMY = iMX; - - if (iRawlen > 10) - iML = mng_get_uint16 (pRawdata+10); - else - iML = iMX; - - if (iRawlen > 12) - iMR = mng_get_uint16 (pRawdata+12); - else - iMR = iMX; - - if (iRawlen > 14) - iMT = mng_get_uint16 (pRawdata+14); - else - iMT = iMY; - - if (iRawlen > 16) - iMB = mng_get_uint16 (pRawdata+16); - else - iMB = iMY; - - if (iRawlen > 18) - iMethodY = (mng_uint8)(mng_get_uint16 (pRawdata+18)); - else - iMethodY = iMethodX; - } - else /* proper layout !!!! */ - { - if (iRawlen > 0) /* get the fields */ - iFirstid = mng_get_uint16 (pRawdata); - else - iFirstid = 0; - - if (iRawlen > 2) - iLastid = mng_get_uint16 (pRawdata+2); - else - iLastid = iFirstid; - - if (iRawlen > 4) - iMethodX = *(pRawdata+4); - else - iMethodX = 0; - - if (iRawlen > 5) - iMX = mng_get_uint16 (pRawdata+5); - else - iMX = 1; - - if (iRawlen > 7) - iMY = mng_get_uint16 (pRawdata+7); - else - iMY = iMX; - - if (iRawlen > 9) - iML = mng_get_uint16 (pRawdata+9); - else - iML = iMX; - - if (iRawlen > 11) - iMR = mng_get_uint16 (pRawdata+11); - else - iMR = iMX; - - if (iRawlen > 13) - iMT = mng_get_uint16 (pRawdata+13); - else - iMT = iMY; - - if (iRawlen > 15) - iMB = mng_get_uint16 (pRawdata+15); - else - iMB = iMY; - - if (iRawlen > 17) - iMethodY = *(pRawdata+17); - else - iMethodY = iMethodX; - } - /* check field validity */ - if ((iMethodX > 5) || (iMethodY > 5)) - MNG_ERROR (pData, MNG_INVALIDMETHOD); - -#ifdef MNG_SUPPORT_DISPLAY - { - mng_retcode iRetcode; - - iRetcode = mng_create_ani_magn (pData, iFirstid, iLastid, iMethodX, - iMX, iMY, iML, iMR, iMT, iMB, iMethodY); - -/* if (!iRetcode) - iRetcode = mng_process_display_magn (pData, iFirstid, iLastid, iMethodX, - iMX, iMY, iML, iMR, iMT, iMB, iMethodY); */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_magnp)*ppChunk)->iFirstid = iFirstid; - ((mng_magnp)*ppChunk)->iLastid = iLastid; - ((mng_magnp)*ppChunk)->iMethodX = iMethodX; - ((mng_magnp)*ppChunk)->iMX = iMX; - ((mng_magnp)*ppChunk)->iMY = iMY; - ((mng_magnp)*ppChunk)->iML = iML; - ((mng_magnp)*ppChunk)->iMR = iMR; - ((mng_magnp)*ppChunk)->iMT = iMT; - ((mng_magnp)*ppChunk)->iMB = iMB; - ((mng_magnp)*ppChunk)->iMethodY = iMethodY; - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -READ_CHUNK (mng_read_mpng) -{ - mng_uint32 iFramewidth; - mng_uint32 iFrameheight; - mng_uint16 iTickspersec; - mng_uint32 iFramessize; - mng_uint32 iCompressedsize; -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - mng_retcode iRetcode; - mng_uint16 iNumplays; - mng_uint32 iBufsize; - mng_uint8p pBuf = 0; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MPNG, MNG_LC_START); -#endif - /* sequence checks */ - if (!pData->bHasIHDR) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 41) /* length must be at least 41 */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - - iFramewidth = mng_get_int32 (pRawdata); - if (iFramewidth == 0) /* frame_width must not be zero */ - MNG_ERROR (pData, MNG_INVALIDWIDTH); - - iFrameheight = mng_get_int32 (pRawdata+4); - if (iFrameheight == 0) /* frame_height must not be zero */ - MNG_ERROR (pData, MNG_INVALIDHEIGHT); - - iTickspersec = mng_get_uint16 (pRawdata+10); - if (iTickspersec == 0) /* delay_den must not be zero */ - MNG_ERROR (pData, MNG_INVALIDFIELDVAL); - - if (*(pRawdata+12) != 0) /* only deflate compression-method allowed */ - MNG_ERROR (pData, MNG_INVALIDCOMPRESS); - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - iNumplays = mng_get_uint16 (pRawdata+8); - iCompressedsize = (mng_uint32)(iRawlen - 13); -#endif - -#ifdef MNG_SUPPORT_DISPLAY - { - iRetcode = mng_inflate_buffer (pData, pRawdata+13, iCompressedsize, - &pBuf, &iBufsize, &iFramessize); - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - if (iFramessize % 26) - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } - - iRetcode = mng_create_mpng_obj (pData, iFramewidth, iFrameheight, iNumplays, - iTickspersec, iFramessize, pBuf); - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - } -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the fields */ - ((mng_mpngp)*ppChunk)->iFramewidth = iFramewidth; - ((mng_mpngp)*ppChunk)->iFrameheight = iFrameheight; - ((mng_mpngp)*ppChunk)->iNumplays = iNumplays; - ((mng_mpngp)*ppChunk)->iTickspersec = iTickspersec; - ((mng_mpngp)*ppChunk)->iCompressionmethod = *(pRawdata+14); - -#ifndef MNG_SUPPORT_DISPLAY - iRetcode = mng_inflate_buffer (pData, pRawdata+13, iCompressedsize, - &pBuf, &iBufsize, &iFramessize); - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pBuf, iBufsize); - return iRetcode; - } - - if (iFramessize % 26) - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_INVALIDLENGTH); - } -#endif - - if (iFramessize) - { - MNG_ALLOCX (pData, ((mng_mpngp)*ppChunk)->pFrames, iFramessize); - if (((mng_mpngp)*ppChunk)->pFrames == 0) - { - MNG_FREEX (pData, pBuf, iBufsize); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - ((mng_mpngp)*ppChunk)->iFramessize = iFramessize; - MNG_COPY (((mng_mpngp)*ppChunk)->pFrames, pBuf, iFramessize); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#if defined(MNG_SUPPORT_DISPLAY) || defined(MNG_STORE_CHUNKS) - MNG_FREEX (pData, pBuf, iBufsize); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifndef MNG_SKIPCHUNK_evNT -READ_CHUNK (mng_read_evnt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EVNT, MNG_LC_START); -#endif - /* sequence checks */ - if ((!pData->bHasMHDR) || (pData->bHasSAVE)) - MNG_ERROR (pData, MNG_SEQUENCEERROR); - - if (iRawlen < 2) /* must have at least 1 entry ! */ - MNG_ERROR (pData, MNG_INVALIDLENGTH); - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) - { - if (iRawlen) /* not empty ? */ - { - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iNamesize; - - pTemp = pRawdata; - iLen = iRawlen; - - while (iLen) /* anything left ? */ - { - iEventtype = *pTemp; /* eventtype */ - if (iEventtype > 5) - MNG_ERROR (pData, MNG_INVALIDEVENT); - - pTemp++; - - iMasktype = *pTemp; /* masktype */ - if (iMasktype > 5) - MNG_ERROR (pData, MNG_INVALIDMASK); - - pTemp++; - iLen -= 2; - - iLeft = 0; - iRight = 0; - iTop = 0; - iBottom = 0; - iObjectid = 0; - iIndex = 0; - - switch (iMasktype) - { - case 1 : - { - if (iLen > 16) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - pTemp += 16; - iLen -= 16; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 2 : - { - if (iLen > 2) - { - iObjectid = mng_get_uint16 (pTemp); - pTemp += 2; - iLen -= 2; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 3 : - { - if (iLen > 3) - { - iObjectid = mng_get_uint16 (pTemp); - iIndex = *(pTemp+2); - pTemp += 3; - iLen -= 3; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 4 : - { - if (iLen > 18) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - pTemp += 18; - iLen -= 18; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 5 : - { - if (iLen > 19) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - iIndex = *(pTemp+18); - pTemp += 19; - iLen -= 19; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - } - - pNull = find_null (pTemp); /* get the name length */ - - if ((pNull - pTemp) > (mng_int32)iLen) - { - iNamesize = iLen; /* no null found; so end of evNT */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen = iLen - iNamesize - 1; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - iRetcode = mng_create_event (pData, iEventtype, iMasktype, iLeft, iRight, - iTop, iBottom, iObjectid, iIndex, - iNamesize, (mng_pchar)pTemp); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pTemp = pTemp + iNamesize + 1; - } - } - } -#endif /* MNG_SUPPORT_DISPLAY && MNG_SUPPORT_DYNAMICMNG */ - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (iRawlen) /* not empty ? */ - { - mng_uint32 iX; - mng_uint32 iCount = 0; - mng_uint8p pTemp; - mng_uint8p pNull; - mng_uint32 iLen; - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iNamesize; - mng_evnt_entryp pEntry = MNG_NULL; - - for (iX = 0; iX < 2; iX++) /* do this twice to get the count first ! */ - { - pTemp = pRawdata; - iLen = iRawlen; - - if (iX) /* second run ? */ - { - MNG_ALLOC (pData, pEntry, (iCount * sizeof (mng_evnt_entry))); - - ((mng_evntp)*ppChunk)->iCount = iCount; - ((mng_evntp)*ppChunk)->pEntries = pEntry; - } - - while (iLen) /* anything left ? */ - { - iEventtype = *pTemp; /* eventtype */ - if (iEventtype > 5) - MNG_ERROR (pData, MNG_INVALIDEVENT); - - pTemp++; - - iMasktype = *pTemp; /* masktype */ - if (iMasktype > 5) - MNG_ERROR (pData, MNG_INVALIDMASK); - - pTemp++; - iLen -= 2; - - iLeft = 0; - iRight = 0; - iTop = 0; - iBottom = 0; - iObjectid = 0; - iIndex = 0; - - switch (iMasktype) - { - case 1 : - { - if (iLen > 16) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - pTemp += 16; - iLen -= 16; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 2 : - { - if (iLen > 2) - { - iObjectid = mng_get_uint16 (pTemp); - pTemp += 2; - iLen -= 2; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 3 : - { - if (iLen > 3) - { - iObjectid = mng_get_uint16 (pTemp); - iIndex = *(pTemp+2); - pTemp += 3; - iLen -= 3; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 4 : - { - if (iLen > 18) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - pTemp += 18; - iLen -= 18; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - case 5 : - { - if (iLen > 19) - { - iLeft = mng_get_int32 (pTemp); - iRight = mng_get_int32 (pTemp+4); - iTop = mng_get_int32 (pTemp+8); - iBottom = mng_get_int32 (pTemp+12); - iObjectid = mng_get_uint16 (pTemp+16); - iIndex = *(pTemp+18); - pTemp += 19; - iLen -= 19; - } - else - MNG_ERROR (pData, MNG_INVALIDLENGTH); - break; - } - } - - pNull = find_null (pTemp); /* get the name length */ - - if ((pNull - pTemp) > (mng_int32)iLen) - { - iNamesize = iLen; /* no null found; so end of evNT */ - iLen = 0; - } - else - { - iNamesize = pNull - pTemp; /* should be another entry */ - iLen = iLen - iNamesize - 1; - - if (!iLen) /* must not end with a null ! */ - MNG_ERROR (pData, MNG_ENDWITHNULL); - } - - if (!iX) - { - iCount++; - } - else - { - pEntry->iEventtype = iEventtype; - pEntry->iMasktype = iMasktype; - pEntry->iLeft = iLeft; - pEntry->iRight = iRight; - pEntry->iTop = iTop; - pEntry->iBottom = iBottom; - pEntry->iObjectid = iObjectid; - pEntry->iIndex = iIndex; - pEntry->iSegmentnamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zSegmentname, iNamesize+1); - MNG_COPY (pEntry->zSegmentname, pTemp, iNamesize); - } - - pEntry++; - } - - pTemp = pTemp + iNamesize + 1; - } - } - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_UNKNOWN, MNG_LC_START); -#endif - /* sequence checks */ -#ifdef MNG_INCLUDE_JNG - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && - (!pData->bHasBASI) && (!pData->bHasDHDR) ) -#endif - MNG_ERROR (pData, MNG_SEQUENCEERROR); - /* critical chunk ? */ - if ((((mng_uint32)pData->iChunkname & 0x20000000) == 0) -#ifdef MNG_SKIPCHUNK_SAVE - && (pData->iChunkname != MNG_UINT_SAVE) -#endif -#ifdef MNG_SKIPCHUNK_SEEK - && (pData->iChunkname != MNG_UINT_SEEK) -#endif -#ifdef MNG_SKIPCHUNK_DBYK - && (pData->iChunkname != MNG_UINT_DBYK) -#endif -#ifdef MNG_SKIPCHUNK_ORDR - && (pData->iChunkname != MNG_UINT_ORDR) -#endif - ) - MNG_ERROR (pData, MNG_UNKNOWNCRITICAL); - - if (pData->fProcessunknown) /* let the app handle it ? */ - { - mng_bool bOke = pData->fProcessunknown ((mng_handle)pData, pData->iChunkname, - iRawlen, (mng_ptr)pRawdata); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - -#ifdef MNG_STORE_CHUNKS - if (pData->bStorechunks) - { /* initialize storage */ - mng_retcode iRetcode = ((mng_chunk_headerp)pHeader)->fCreate (pData, pHeader, ppChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* store the length */ - ((mng_chunk_headerp)*ppChunk)->iChunkname = pData->iChunkname; - ((mng_unknown_chunkp)*ppChunk)->iDatasize = iRawlen; - - if (iRawlen == 0) /* any data at all ? */ - ((mng_unknown_chunkp)*ppChunk)->pData = 0; - else - { /* then store it */ - MNG_ALLOC (pData, ((mng_unknown_chunkp)*ppChunk)->pData, iRawlen); - MNG_COPY (((mng_unknown_chunkp)*ppChunk)->pData, pRawdata, iRawlen); - } - } -#endif /* MNG_STORE_CHUNKS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ -/* * * */ -/* * chunk write functions * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_ihdr) -{ - mng_ihdrp pIHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IHDR, MNG_LC_START); -#endif - - pIHDR = (mng_ihdrp)pChunk; /* address the proper chunk */ - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 13; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pIHDR->iWidth); - mng_put_uint32 (pRawdata+4, pIHDR->iHeight); - - *(pRawdata+8) = pIHDR->iBitdepth; - *(pRawdata+9) = pIHDR->iColortype; - *(pRawdata+10) = pIHDR->iCompression; - *(pRawdata+11) = pIHDR->iFilter; - *(pRawdata+12) = pIHDR->iInterlace; - /* and write it */ - iRetcode = write_raw_chunk (pData, pIHDR->sHeader.iChunkname, iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IHDR, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_plte) -{ - mng_pltep pPLTE; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PLTE, MNG_LC_START); -#endif - - pPLTE = (mng_pltep)pChunk; /* address the proper chunk */ - - if (pPLTE->bEmpty) /* write empty chunk ? */ - iRetcode = write_raw_chunk (pData, pPLTE->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pPLTE->iEntrycount * 3; - /* fill the output buffer */ - pTemp = pRawdata; - - for (iX = 0; iX < pPLTE->iEntrycount; iX++) - { - *pTemp = pPLTE->aEntries [iX].iRed; - *(pTemp+1) = pPLTE->aEntries [iX].iGreen; - *(pTemp+2) = pPLTE->aEntries [iX].iBlue; - - pTemp += 3; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pPLTE->sHeader.iChunkname, iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PLTE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_idat) -{ - mng_idatp pIDAT; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IDAT, MNG_LC_START); -#endif - - pIDAT = (mng_idatp)pChunk; /* address the proper chunk */ - - if (pIDAT->bEmpty) /* and write it */ - iRetcode = write_raw_chunk (pData, pIDAT->sHeader.iChunkname, 0, 0); - else - iRetcode = write_raw_chunk (pData, pIDAT->sHeader.iChunkname, - pIDAT->iDatasize, pIDAT->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IDAT, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_iend) -{ - mng_iendp pIEND; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IEND, MNG_LC_START); -#endif - - pIEND = (mng_iendp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pIEND->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IEND, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_trns) -{ - mng_trnsp pTRNS; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TRNS, MNG_LC_START); -#endif - - pTRNS = (mng_trnsp)pChunk; /* address the proper chunk */ - - if (pTRNS->bEmpty) /* write empty chunk ? */ - iRetcode = write_raw_chunk (pData, pTRNS->sHeader.iChunkname, 0, 0); - else - if (pTRNS->bGlobal) /* write global chunk ? */ - iRetcode = write_raw_chunk (pData, pTRNS->sHeader.iChunkname, - pTRNS->iRawlen, (mng_uint8p)pTRNS->aRawdata); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer */ - iRawlen = 0; /* and default size */ - - switch (pTRNS->iType) - { - case 0: { - iRawlen = 2; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pTRNS->iGray); - - break; - } - case 2: { - iRawlen = 6; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pTRNS->iRed); - mng_put_uint16 (pRawdata+2, pTRNS->iGreen); - mng_put_uint16 (pRawdata+4, pTRNS->iBlue); - - break; - } - case 3: { /* init output buffer size */ - iRawlen = pTRNS->iCount; - - pTemp = pRawdata; /* fill the output buffer */ - - for (iX = 0; iX < pTRNS->iCount; iX++) - { - *pTemp = pTRNS->aEntries[iX]; - pTemp++; - } - - break; - } - } - /* write the chunk */ - iRetcode = write_raw_chunk (pData, pTRNS->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TRNS, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_gama) -{ - mng_gamap pGAMA; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GAMA, MNG_LC_START); -#endif - - pGAMA = (mng_gamap)pChunk; /* address the proper chunk */ - - if (pGAMA->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pGAMA->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 4; - /* fill the buffer */ - mng_put_uint32 (pRawdata, pGAMA->iGamma); - /* and write it */ - iRetcode = write_raw_chunk (pData, pGAMA->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GAMA, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -WRITE_CHUNK (mng_write_chrm) -{ - mng_chrmp pCHRM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CHRM, MNG_LC_START); -#endif - - pCHRM = (mng_chrmp)pChunk; /* address the proper chunk */ - - if (pCHRM->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pCHRM->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 32; - /* fill the buffer */ - mng_put_uint32 (pRawdata, pCHRM->iWhitepointx); - mng_put_uint32 (pRawdata+4, pCHRM->iWhitepointy); - mng_put_uint32 (pRawdata+8, pCHRM->iRedx); - mng_put_uint32 (pRawdata+12, pCHRM->iRedy); - mng_put_uint32 (pRawdata+16, pCHRM->iGreenx); - mng_put_uint32 (pRawdata+20, pCHRM->iGreeny); - mng_put_uint32 (pRawdata+24, pCHRM->iBluex); - mng_put_uint32 (pRawdata+28, pCHRM->iBluey); - /* and write it */ - iRetcode = write_raw_chunk (pData, pCHRM->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CHRM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_srgb) -{ - mng_srgbp pSRGB; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SRGB, MNG_LC_START); -#endif - - pSRGB = (mng_srgbp)pChunk; /* address the proper chunk */ - - if (pSRGB->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pSRGB->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - /* fill the buffer */ - *pRawdata = pSRGB->iRenderingintent; - /* and write it */ - iRetcode = write_raw_chunk (pData, pSRGB->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SRGB, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -WRITE_CHUNK (mng_write_iccp) -{ - mng_iccpp pICCP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ICCP, MNG_LC_START); -#endif - - pICCP = (mng_iccpp)pChunk; /* address the proper chunk */ - - if (pICCP->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pICCP->sHeader.iChunkname, 0, 0); - else - { /* compress the profile */ - iRetcode = deflate_buffer (pData, pICCP->pProfile, pICCP->iProfilesize, - &pBuf, &iBuflen, &iReallen); - - if (!iRetcode) /* still oke ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pICCP->iNamesize + 2 + iReallen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pICCP->iNamesize) - { - MNG_COPY (pTemp, pICCP->zName, pICCP->iNamesize); - pTemp += pICCP->iNamesize; - } - - *pTemp = 0; - *(pTemp+1) = pICCP->iCompression; - pTemp += 2; - - if (iReallen) - MNG_COPY (pTemp, pBuf, iReallen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pICCP->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the extra buffer */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ICCP, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -WRITE_CHUNK (mng_write_text) -{ - mng_textp pTEXT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TEXT, MNG_LC_START); -#endif - - pTEXT = (mng_textp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pTEXT->iKeywordsize + 1 + pTEXT->iTextsize; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pTEXT->iKeywordsize) - { - MNG_COPY (pTemp, pTEXT->zKeyword, pTEXT->iKeywordsize); - pTemp += pTEXT->iKeywordsize; - } - - *pTemp = 0; - pTemp += 1; - - if (pTEXT->iTextsize) - MNG_COPY (pTemp, pTEXT->zText, pTEXT->iTextsize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pTEXT->sHeader.iChunkname, - iRawlen, pRawdata); - - if (iRawlen > pData->iWritebufsize) /* drop the temp buffer ? */ - MNG_FREEX (pData, pRawdata, iRawlen); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TEXT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -WRITE_CHUNK (mng_write_ztxt) -{ - mng_ztxtp pZTXT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ZTXT, MNG_LC_START); -#endif - - pZTXT = (mng_ztxtp)pChunk; /* address the proper chunk */ - /* compress the text */ - iRetcode = deflate_buffer (pData, (mng_uint8p)pZTXT->zText, pZTXT->iTextsize, - &pBuf, &iBuflen, &iReallen); - - if (!iRetcode) /* all ok ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pZTXT->iKeywordsize + 2 + iReallen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pZTXT->iKeywordsize) - { - MNG_COPY (pTemp, pZTXT->zKeyword, pZTXT->iKeywordsize); - pTemp += pZTXT->iKeywordsize; - } - - *pTemp = 0; /* terminator zero */ - pTemp++; - *pTemp = 0; /* compression type */ - pTemp++; - - if (iReallen) - MNG_COPY (pTemp, pBuf, iReallen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pZTXT->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the compression buffer */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ZTXT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -WRITE_CHUNK (mng_write_itxt) -{ - mng_itxtp pITXT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ITXT, MNG_LC_START); -#endif - - pITXT = (mng_itxtp)pChunk; /* address the proper chunk */ - - if (pITXT->iCompressionflag) /* compress the text */ - iRetcode = deflate_buffer (pData, (mng_uint8p)pITXT->zText, pITXT->iTextsize, - &pBuf, &iBuflen, &iReallen); - else - iRetcode = MNG_NOERROR; - - if (!iRetcode) /* all ok ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pITXT->iKeywordsize + pITXT->iLanguagesize + - pITXT->iTranslationsize + 5; - - if (pITXT->iCompressionflag) - iRawlen = iRawlen + iReallen; - else - iRawlen = iRawlen + pITXT->iTextsize; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pITXT->iKeywordsize) - { - MNG_COPY (pTemp, pITXT->zKeyword, pITXT->iKeywordsize); - pTemp += pITXT->iKeywordsize; - } - - *pTemp = 0; - pTemp++; - *pTemp = pITXT->iCompressionflag; - pTemp++; - *pTemp = pITXT->iCompressionmethod; - pTemp++; - - if (pITXT->iLanguagesize) - { - MNG_COPY (pTemp, pITXT->zLanguage, pITXT->iLanguagesize); - pTemp += pITXT->iLanguagesize; - } - - *pTemp = 0; - pTemp++; - - if (pITXT->iTranslationsize) - { - MNG_COPY (pTemp, pITXT->zTranslation, pITXT->iTranslationsize); - pTemp += pITXT->iTranslationsize; - } - - *pTemp = 0; - pTemp++; - - if (pITXT->iCompressionflag) - { - if (iReallen) - MNG_COPY (pTemp, pBuf, iReallen); - } - else - { - if (pITXT->iTextsize) - MNG_COPY (pTemp, pITXT->zText, pITXT->iTextsize); - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pITXT->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the compression buffer */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -WRITE_CHUNK (mng_write_bkgd) -{ - mng_bkgdp pBKGD; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BKGD, MNG_LC_START); -#endif - - pBKGD = (mng_bkgdp)pChunk; /* address the proper chunk */ - - if (pBKGD->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pBKGD->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 0; /* and default size */ - - switch (pBKGD->iType) - { - case 0: { /* gray */ - iRawlen = 2; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pBKGD->iGray); - - break; - } - case 2: { /* rgb */ - iRawlen = 6; /* fill the size & output buffer */ - mng_put_uint16 (pRawdata, pBKGD->iRed); - mng_put_uint16 (pRawdata+2, pBKGD->iGreen); - mng_put_uint16 (pRawdata+4, pBKGD->iBlue); - - break; - } - case 3: { /* indexed */ - iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pBKGD->iIndex; - - break; - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pBKGD->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BKGD, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -WRITE_CHUNK (mng_write_phys) -{ - mng_physp pPHYS; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYS, MNG_LC_START); -#endif - - pPHYS = (mng_physp)pChunk; /* address the proper chunk */ - - if (pPHYS->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pPHYS->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 9; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pPHYS->iSizex); - mng_put_uint32 (pRawdata+4, pPHYS->iSizey); - - *(pRawdata+8) = pPHYS->iUnit; - /* and write it */ - iRetcode = write_raw_chunk (pData, pPHYS->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYS, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -WRITE_CHUNK (mng_write_sbit) -{ - mng_sbitp pSBIT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SBIT, MNG_LC_START); -#endif - - pSBIT = (mng_sbitp)pChunk; /* address the proper chunk */ - - if (pSBIT->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pSBIT->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 0; /* and default size */ - - switch (pSBIT->iType) - { - case 0: { /* gray */ - iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - - break; - } - case 2: { /* rgb */ - iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - - break; - } - case 3: { /* indexed */ - iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *pRawdata = pSBIT->aBits[1]; - *pRawdata = pSBIT->aBits[2]; - - break; - } - case 4: { /* gray + alpha */ - iRawlen = 2; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - - break; - } - case 6: { /* rgb + alpha */ - iRawlen = 4; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - *(pRawdata+3) = pSBIT->aBits[3]; - - break; - } - case 10: { /* jpeg gray */ - iRawlen = 1; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - - break; - } - case 12: { /* jpeg rgb */ - iRawlen = 3; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - - break; - } - case 14: { /* jpeg gray + alpha */ - iRawlen = 2; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - - break; - } - case 16: { /* jpeg rgb + alpha */ - iRawlen = 4; /* fill the size & output buffer */ - *pRawdata = pSBIT->aBits[0]; - *(pRawdata+1) = pSBIT->aBits[1]; - *(pRawdata+2) = pSBIT->aBits[2]; - *(pRawdata+3) = pSBIT->aBits[3]; - - break; - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pSBIT->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SBIT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -WRITE_CHUNK (mng_write_splt) -{ - mng_spltp pSPLT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint32 iEntrieslen; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SPLT, MNG_LC_START); -#endif - - pSPLT = (mng_spltp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iEntrieslen = ((pSPLT->iSampledepth >> 3) * 4 + 2) * pSPLT->iEntrycount; - iRawlen = pSPLT->iNamesize + 2 + iEntrieslen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - - pTemp = pRawdata; /* fill the buffer */ - - if (pSPLT->iNamesize) - { - MNG_COPY (pTemp, pSPLT->zName, pSPLT->iNamesize); - pTemp += pSPLT->iNamesize; - } - - *pTemp = 0; - *(pTemp+1) = pSPLT->iSampledepth; - pTemp += 2; - - if (pSPLT->iEntrycount) - MNG_COPY (pTemp, pSPLT->pEntries, iEntrieslen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pSPLT->sHeader.iChunkname, - iRawlen, pRawdata); - - if (iRawlen > pData->iWritebufsize) /* drop the temp buffer ? */ - MNG_FREEX (pData, pRawdata, iRawlen); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SPLT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -WRITE_CHUNK (mng_write_hist) -{ - mng_histp pHIST; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_HIST, MNG_LC_START); -#endif - - pHIST = (mng_histp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pHIST->iEntrycount << 1; - - pTemp = pRawdata; /* fill the output buffer */ - - for (iX = 0; iX < pHIST->iEntrycount; iX++) - { - mng_put_uint16 (pTemp, pHIST->aEntries [iX]); - pTemp += 2; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pHIST->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_HIST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -WRITE_CHUNK (mng_write_time) -{ - mng_timep pTIME; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TIME, MNG_LC_START); -#endif - - pTIME = (mng_timep)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 7; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pTIME->iYear); - - *(pRawdata+2) = pTIME->iMonth; - *(pRawdata+3) = pTIME->iDay; - *(pRawdata+4) = pTIME->iHour; - *(pRawdata+5) = pTIME->iMinute; - *(pRawdata+6) = pTIME->iSecond; - /* and write it */ - iRetcode = write_raw_chunk (pData, pTIME->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TIME, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_mhdr) -{ - mng_mhdrp pMHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MHDR, MNG_LC_START); -#endif - - pMHDR = (mng_mhdrp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 28; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pMHDR->iWidth); - mng_put_uint32 (pRawdata+4, pMHDR->iHeight); - mng_put_uint32 (pRawdata+8, pMHDR->iTicks); - mng_put_uint32 (pRawdata+12, pMHDR->iLayercount); - mng_put_uint32 (pRawdata+16, pMHDR->iFramecount); - mng_put_uint32 (pRawdata+20, pMHDR->iPlaytime); - mng_put_uint32 (pRawdata+24, pMHDR->iSimplicity); - - /* and write it */ - iRetcode = write_raw_chunk (pData, pMHDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MHDR, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_mend) -{ - mng_mendp pMEND; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MEND, MNG_LC_START); -#endif - - pMEND = (mng_mendp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pMEND->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MEND, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_loop) -{ - mng_loopp pLOOP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - mng_uint8p pTemp1; - mng_uint32p pTemp2; - mng_uint32 iX; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_LOOP, MNG_LC_START); -#endif - - pLOOP = (mng_loopp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 5; - /* fill the output buffer */ - *pRawdata = pLOOP->iLevel; - mng_put_uint32 (pRawdata+1, pLOOP->iRepeat); - - if (pLOOP->iTermination) - { - iRawlen++; - *(pRawdata+5) = pLOOP->iTermination; - - if ((pLOOP->iCount) || - (pLOOP->iItermin != 1) || (pLOOP->iItermax != 0x7FFFFFFFL)) - { - iRawlen += 8; - - mng_put_uint32 (pRawdata+6, pLOOP->iItermin); - mng_put_uint32 (pRawdata+10, pLOOP->iItermax); - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (pLOOP->iCount) - { - iRawlen += pLOOP->iCount * 4; - - pTemp1 = pRawdata+14; - pTemp2 = pLOOP->pSignals; - - for (iX = 0; iX < pLOOP->iCount; iX++) - { - mng_put_uint32 (pTemp1, *pTemp2); - - pTemp1 += 4; - pTemp2++; - } - } -#endif - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pLOOP->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_LOOP, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_endl) -{ - mng_endlp pENDL; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ENDL, MNG_LC_START); -#endif - - pENDL = (mng_endlp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pENDL->iLevel; /* fill the output buffer */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pENDL->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ENDL, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_defi) -{ - mng_defip pDEFI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DEFI, MNG_LC_START); -#endif - - pDEFI = (mng_defip)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pDEFI->iObjectid); - - if ((pDEFI->iDonotshow) || (pDEFI->iConcrete) || (pDEFI->bHasloca) || (pDEFI->bHasclip)) - { - iRawlen++; - *(pRawdata+2) = pDEFI->iDonotshow; - - if ((pDEFI->iConcrete) || (pDEFI->bHasloca) || (pDEFI->bHasclip)) - { - iRawlen++; - *(pRawdata+3) = pDEFI->iConcrete; - - if ((pDEFI->bHasloca) || (pDEFI->bHasclip)) - { - iRawlen += 8; - - mng_put_uint32 (pRawdata+4, pDEFI->iXlocation); - mng_put_uint32 (pRawdata+8, pDEFI->iYlocation); - - if (pDEFI->bHasclip) - { - iRawlen += 16; - - mng_put_uint32 (pRawdata+12, pDEFI->iLeftcb); - mng_put_uint32 (pRawdata+16, pDEFI->iRightcb); - mng_put_uint32 (pRawdata+20, pDEFI->iTopcb); - mng_put_uint32 (pRawdata+24, pDEFI->iBottomcb); - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDEFI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DEFI, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_basi) -{ - mng_basip pBASI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_bool bOpaque; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BASI, MNG_LC_START); -#endif - - pBASI = (mng_basip)pChunk; /* address the proper chunk */ - -#ifndef MNG_NO_16BIT_SUPPORT - if (pBASI->iBitdepth <= 8) /* determine opacity alpha-field */ -#endif - bOpaque = (mng_bool)(pBASI->iAlpha == 0xFF); -#ifndef MNG_NO_16BIT_SUPPORT - else - bOpaque = (mng_bool)(pBASI->iAlpha == 0xFFFF); -#endif - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 13; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pBASI->iWidth); - mng_put_uint32 (pRawdata+4, pBASI->iHeight); - - *(pRawdata+8) = pBASI->iBitdepth; - *(pRawdata+9) = pBASI->iColortype; - *(pRawdata+10) = pBASI->iCompression; - *(pRawdata+11) = pBASI->iFilter; - *(pRawdata+12) = pBASI->iInterlace; - - if ((pBASI->iRed) || (pBASI->iGreen) || (pBASI->iBlue) || - (!bOpaque) || (pBASI->iViewable)) - { - iRawlen += 6; - mng_put_uint16 (pRawdata+13, pBASI->iRed); - mng_put_uint16 (pRawdata+15, pBASI->iGreen); - mng_put_uint16 (pRawdata+17, pBASI->iBlue); - - if ((!bOpaque) || (pBASI->iViewable)) - { - iRawlen += 2; - mng_put_uint16 (pRawdata+19, pBASI->iAlpha); - - if (pBASI->iViewable) - { - iRawlen++; - *(pRawdata+21) = pBASI->iViewable; - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pBASI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BASI, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_clon) -{ - mng_clonp pCLON; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLON, MNG_LC_START); -#endif - - pCLON = (mng_clonp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 4; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pCLON->iSourceid); - mng_put_uint16 (pRawdata+2, pCLON->iCloneid); - - if ((pCLON->iClonetype) || (pCLON->iDonotshow) || (pCLON->iConcrete) || (pCLON->bHasloca)) - { - iRawlen++; - *(pRawdata+4) = pCLON->iClonetype; - - if ((pCLON->iDonotshow) || (pCLON->iConcrete) || (pCLON->bHasloca)) - { - iRawlen++; - *(pRawdata+5) = pCLON->iDonotshow; - - if ((pCLON->iConcrete) || (pCLON->bHasloca)) - { - iRawlen++; - *(pRawdata+6) = pCLON->iConcrete; - - if (pCLON->bHasloca) - { - iRawlen += 9; - *(pRawdata+7) = pCLON->iLocationtype; - mng_put_int32 (pRawdata+8, pCLON->iLocationx); - mng_put_int32 (pRawdata+12, pCLON->iLocationy); - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pCLON->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLON, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -WRITE_CHUNK (mng_write_past) -{ - mng_pastp pPAST; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_past_sourcep pSource; - mng_uint32 iX; - mng_uint8p pTemp; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PAST, MNG_LC_START); -#endif - - pPAST = (mng_pastp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 11 + (30 * pPAST->iCount); - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pPAST->iDestid); - - *(pRawdata+2) = pPAST->iTargettype; - - mng_put_int32 (pRawdata+3, pPAST->iTargetx); - mng_put_int32 (pRawdata+7, pPAST->iTargety); - - pTemp = pRawdata+11; - pSource = pPAST->pSources; - - for (iX = 0; iX < pPAST->iCount; iX++) - { - mng_put_uint16 (pTemp, pSource->iSourceid); - - *(pTemp+2) = pSource->iComposition; - *(pTemp+3) = pSource->iOrientation; - *(pTemp+4) = pSource->iOffsettype; - - mng_put_int32 (pTemp+5, pSource->iOffsetx); - mng_put_int32 (pTemp+9, pSource->iOffsety); - - *(pTemp+13) = pSource->iBoundarytype; - - mng_put_int32 (pTemp+14, pSource->iBoundaryl); - mng_put_int32 (pTemp+18, pSource->iBoundaryr); - mng_put_int32 (pTemp+22, pSource->iBoundaryt); - mng_put_int32 (pTemp+26, pSource->iBoundaryb); - - pSource++; - pTemp += 30; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pPAST->sHeader.iChunkname, - iRawlen, pRawdata); - /* free temporary buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PAST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_disc) -{ - mng_discp pDISC; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint32 iX; - mng_uint8p pTemp1; - mng_uint16p pTemp2; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DISC, MNG_LC_START); -#endif - - pDISC = (mng_discp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pDISC->iCount << 1; - - pTemp1 = pRawdata; /* fill the output buffer */ - pTemp2 = pDISC->pObjectids; - - for (iX = 0; iX < pDISC->iCount; iX++) - { - mng_put_uint16 (pTemp1, *pTemp2); - - pTemp2++; - pTemp1 += 2; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDISC->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DISC, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_back) -{ - mng_backp pBACK; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BACK, MNG_LC_START); -#endif - - pBACK = (mng_backp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 6; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pBACK->iRed); - mng_put_uint16 (pRawdata+2, pBACK->iGreen); - mng_put_uint16 (pRawdata+4, pBACK->iBlue); - - if ((pBACK->iMandatory) || (pBACK->iImageid) || (pBACK->iTile)) - { - iRawlen++; - *(pRawdata+6) = pBACK->iMandatory; - - if ((pBACK->iImageid) || (pBACK->iTile)) - { - iRawlen += 2; - mng_put_uint16 (pRawdata+7, pBACK->iImageid); - - if (pBACK->iTile) - { - iRawlen++; - *(pRawdata+9) = pBACK->iTile; - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pBACK->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_BACK, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_fram) -{ - mng_framp pFRAM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_uint32p pTemp2; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FRAM, MNG_LC_START); -#endif - - pFRAM = (mng_framp)pChunk; /* address the proper chunk */ - - if (pFRAM->bEmpty) /* empty ? */ - iRetcode = write_raw_chunk (pData, pFRAM->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - /* fill the output buffer */ - *pRawdata = pFRAM->iMode; - - if ((pFRAM->iNamesize ) || - (pFRAM->iChangedelay ) || (pFRAM->iChangetimeout) || - (pFRAM->iChangeclipping) || (pFRAM->iChangesyncid ) ) - { - if (pFRAM->iNamesize) - MNG_COPY (pRawdata+1, pFRAM->zName, pFRAM->iNamesize); - - iRawlen += pFRAM->iNamesize; - pTemp = pRawdata + pFRAM->iNamesize + 1; - - if ((pFRAM->iChangedelay ) || (pFRAM->iChangetimeout) || - (pFRAM->iChangeclipping) || (pFRAM->iChangesyncid ) ) - { - *pTemp = 0; - *(pTemp+1) = pFRAM->iChangedelay; - *(pTemp+2) = pFRAM->iChangetimeout; - *(pTemp+3) = pFRAM->iChangeclipping; - *(pTemp+4) = pFRAM->iChangesyncid; - - iRawlen += 5; - pTemp += 5; - - if (pFRAM->iChangedelay) - { - mng_put_uint32 (pTemp, pFRAM->iDelay); - iRawlen += 4; - pTemp += 4; - } - - if (pFRAM->iChangetimeout) - { - mng_put_uint32 (pTemp, pFRAM->iTimeout); - iRawlen += 4; - pTemp += 4; - } - - if (pFRAM->iChangeclipping) - { - *pTemp = pFRAM->iBoundarytype; - - mng_put_uint32 (pTemp+1, pFRAM->iBoundaryl); - mng_put_uint32 (pTemp+5, pFRAM->iBoundaryr); - mng_put_uint32 (pTemp+9, pFRAM->iBoundaryt); - mng_put_uint32 (pTemp+13, pFRAM->iBoundaryb); - - iRawlen += 17; - pTemp += 17; - } - - if (pFRAM->iChangesyncid) - { - iRawlen += pFRAM->iCount * 4; - pTemp2 = pFRAM->pSyncids; - - for (iX = 0; iX < pFRAM->iCount; iX++) - { - mng_put_uint32 (pTemp, *pTemp2); - - pTemp2++; - pTemp += 4; - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pFRAM->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_move) -{ - mng_movep pMOVE; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MOVE, MNG_LC_START); -#endif - - pMOVE = (mng_movep)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 13; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pMOVE->iFirstid); - mng_put_uint16 (pRawdata+2, pMOVE->iLastid); - - *(pRawdata+4) = pMOVE->iMovetype; - - mng_put_int32 (pRawdata+5, pMOVE->iMovex); - mng_put_int32 (pRawdata+9, pMOVE->iMovey); - /* and write it */ - iRetcode = write_raw_chunk (pData, pMOVE->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MOVE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_clip) -{ - mng_clipp pCLIP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLIP, MNG_LC_START); -#endif - - pCLIP = (mng_clipp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 21; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pCLIP->iFirstid); - mng_put_uint16 (pRawdata+2, pCLIP->iLastid); - - *(pRawdata+4) = pCLIP->iCliptype; - - mng_put_int32 (pRawdata+5, pCLIP->iClipl); - mng_put_int32 (pRawdata+9, pCLIP->iClipr); - mng_put_int32 (pRawdata+13, pCLIP->iClipt); - mng_put_int32 (pRawdata+17, pCLIP->iClipb); - /* and write it */ - iRetcode = write_raw_chunk (pData, pCLIP->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_CLIP, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_show) -{ - mng_showp pSHOW; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SHOW, MNG_LC_START); -#endif - - pSHOW = (mng_showp)pChunk; /* address the proper chunk */ - - if (pSHOW->bEmpty) /* empty ? */ - iRetcode = write_raw_chunk (pData, pSHOW->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pSHOW->iFirstid); - - if ((pSHOW->iLastid != pSHOW->iFirstid) || (pSHOW->iMode)) - { - iRawlen += 2; - mng_put_uint16 (pRawdata+2, pSHOW->iLastid); - - if (pSHOW->iMode) - { - iRawlen++; - *(pRawdata+4) = pSHOW->iMode; - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pSHOW->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SHOW, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_term) -{ - mng_termp pTERM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TERM, MNG_LC_START); -#endif - - pTERM = (mng_termp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pTERM->iTermaction; /* fill the output buffer */ - - if (pTERM->iTermaction == 3) - { - iRawlen = 10; - *(pRawdata+1) = pTERM->iIteraction; - - mng_put_uint32 (pRawdata+2, pTERM->iDelay); - mng_put_uint32 (pRawdata+6, pTERM->iItermax); - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pTERM->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_TERM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -WRITE_CHUNK (mng_write_save) -{ - mng_savep pSAVE; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_save_entryp pEntry; - mng_uint32 iEntrysize; - mng_uint8p pTemp; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SAVE, MNG_LC_START); -#endif - - pSAVE = (mng_savep)pChunk; /* address the proper chunk */ - - if (pSAVE->bEmpty) /* empty ? */ - iRetcode = write_raw_chunk (pData, pSAVE->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pSAVE->iOffsettype; /* fill the output buffer */ - - if (pSAVE->iOffsettype == 16) - iEntrysize = 25; - else - iEntrysize = 17; - - pTemp = pRawdata+1; - pEntry = pSAVE->pEntries; - - for (iX = 0; iX < pSAVE->iCount; iX++) - { - if (iX) /* put separator null-byte, except the first */ - { - *pTemp = 0; - pTemp++; - iRawlen++; - } - - iRawlen += iEntrysize + pEntry->iNamesize; - *pTemp = pEntry->iEntrytype; - - if (pSAVE->iOffsettype == 16) - { - mng_put_uint32 (pTemp+1, pEntry->iOffset[0]); - mng_put_uint32 (pTemp+5, pEntry->iOffset[1]); - mng_put_uint32 (pTemp+9, pEntry->iStarttime[0]); - mng_put_uint32 (pTemp+13, pEntry->iStarttime[1]); - mng_put_uint32 (pTemp+17, pEntry->iLayernr); - mng_put_uint32 (pTemp+21, pEntry->iFramenr); - - pTemp += 25; - } - else - { - mng_put_uint32 (pTemp+1, pEntry->iOffset[1]); - mng_put_uint32 (pTemp+5, pEntry->iStarttime[1]); - mng_put_uint32 (pTemp+9, pEntry->iLayernr); - mng_put_uint32 (pTemp+13, pEntry->iFramenr); - - pTemp += 17; - } - - if (pEntry->iNamesize) - { - MNG_COPY (pTemp, pEntry->zName, pEntry->iNamesize); - pTemp += pEntry->iNamesize; - } - - pEntry++; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pSAVE->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SAVE, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -WRITE_CHUNK (mng_write_seek) -{ - mng_seekp pSEEK; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SEEK, MNG_LC_START); -#endif - - pSEEK = (mng_seekp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pSEEK->iNamesize; - - if (iRawlen) /* fill the output buffer */ - MNG_COPY (pRawdata, pSEEK->zName, iRawlen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pSEEK->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_SEEK, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -WRITE_CHUNK (mng_write_expi) -{ - mng_expip pEXPI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EXPI, MNG_LC_START); -#endif - - pEXPI = (mng_expip)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2 + pEXPI->iNamesize; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pEXPI->iSnapshotid); - - if (pEXPI->iNamesize) - MNG_COPY (pRawdata+2, pEXPI->zName, pEXPI->iNamesize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pEXPI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EXPI, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -WRITE_CHUNK (mng_write_fpri) -{ - mng_fprip pFPRI; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FPRI, MNG_LC_START); -#endif - - pFPRI = (mng_fprip)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 2; - - *pRawdata = pFPRI->iDeltatype; /* fill the output buffer */ - *(pRawdata+1) = pFPRI->iPriority; - /* and write it */ - iRetcode = write_raw_chunk (pData, pFPRI->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_FPRI, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -WRITE_CHUNK (mng_write_need) -{ - mng_needp pNEED; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_NEED, MNG_LC_START); -#endif - - pNEED = (mng_needp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pNEED->iKeywordssize; - /* fill the output buffer */ - if (pNEED->iKeywordssize) - MNG_COPY (pRawdata, pNEED->zKeywords, pNEED->iKeywordssize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pNEED->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_NEED, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -WRITE_CHUNK (mng_write_phyg) -{ - mng_phygp pPHYG; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYG, MNG_LC_START); -#endif - - pPHYG = (mng_phygp)pChunk; /* address the proper chunk */ - - if (pPHYG->bEmpty) /* write empty ? */ - iRetcode = write_raw_chunk (pData, pPHYG->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 9; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pPHYG->iSizex); - mng_put_uint32 (pRawdata+4, pPHYG->iSizey); - - *(pRawdata+8) = pPHYG->iUnit; - /* and write it */ - iRetcode = write_raw_chunk (pData, pPHYG->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PHYG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -/* B004 */ -#ifdef MNG_INCLUDE_JNG -/* B004 */ -WRITE_CHUNK (mng_write_jhdr) -{ - mng_jhdrp pJHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JHDR, MNG_LC_START); -#endif - - pJHDR = (mng_jhdrp)pChunk; /* address the proper chunk */ - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 16; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pJHDR->iWidth); - mng_put_uint32 (pRawdata+4, pJHDR->iHeight); - - *(pRawdata+8) = pJHDR->iColortype; - *(pRawdata+9) = pJHDR->iImagesampledepth; - *(pRawdata+10) = pJHDR->iImagecompression; - *(pRawdata+11) = pJHDR->iImageinterlace; - *(pRawdata+12) = pJHDR->iAlphasampledepth; - *(pRawdata+13) = pJHDR->iAlphacompression; - *(pRawdata+14) = pJHDR->iAlphafilter; - *(pRawdata+15) = pJHDR->iAlphainterlace; - /* and write it */ - iRetcode = write_raw_chunk (pData, pJHDR->sHeader.iChunkname, iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jhdr 0 -/* B004 */ -#endif /* MNG_INCLUDE_JNG */ -/* B004 */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_jdaa) -{ - mng_jdatp pJDAA; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAA, MNG_LC_START); -#endif - - pJDAA = (mng_jdaap)pChunk; /* address the proper chunk */ - - if (pJDAA->bEmpty) /* and write it */ - iRetcode = write_raw_chunk (pData, pJDAA->sHeader.iChunkname, 0, 0); - else - iRetcode = write_raw_chunk (pData, pJDAA->sHeader.iChunkname, - pJDAA->iDatasize, pJDAA->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAA, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jdaa 0 -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -/* B004 */ -#ifdef MNG_INCLUDE_JNG -/* B004 */ -WRITE_CHUNK (mng_write_jdat) -{ - mng_jdatp pJDAT; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAT, MNG_LC_START); -#endif - - pJDAT = (mng_jdatp)pChunk; /* address the proper chunk */ - - if (pJDAT->bEmpty) /* and write it */ - iRetcode = write_raw_chunk (pData, pJDAT->sHeader.iChunkname, 0, 0); - else - iRetcode = write_raw_chunk (pData, pJDAT->sHeader.iChunkname, - pJDAT->iDatasize, pJDAT->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JDAT, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jdat 0 -/* B004 */ -#endif /* MNG_INCLUDE_JNG */ -/* B004 */ - -/* ************************************************************************** */ - -/* B004 */ -#ifdef MNG_INCLUDE_JNG -/* B004 */ -WRITE_CHUNK (mng_write_jsep) -{ - mng_jsepp pJSEP; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JSEP, MNG_LC_START); -#endif - - pJSEP = (mng_jsepp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pJSEP->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_JSEP, MNG_LC_END); -#endif - - return iRetcode; -} -#else -#define write_jsep 0 -/* B004 */ -#endif /* MNG_INCLUDE_JNG */ -/* B004 */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_dhdr) -{ - mng_dhdrp pDHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DHDR, MNG_LC_START); -#endif - - pDHDR = (mng_dhdrp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 4; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pDHDR->iObjectid); - - *(pRawdata+2) = pDHDR->iImagetype; - *(pRawdata+3) = pDHDR->iDeltatype; - - if (pDHDR->iDeltatype != 7) - { - iRawlen += 8; - mng_put_uint32 (pRawdata+4, pDHDR->iBlockwidth); - mng_put_uint32 (pRawdata+8, pDHDR->iBlockheight); - - if (pDHDR->iDeltatype != 0) - { - iRawlen += 8; - mng_put_uint32 (pRawdata+12, pDHDR->iBlockx); - mng_put_uint32 (pRawdata+16, pDHDR->iBlocky); - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDHDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_prom) -{ - mng_promp pPROM; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PROM, MNG_LC_START); -#endif - - pPROM = (mng_promp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 3; - - *pRawdata = pPROM->iColortype; /* fill the output buffer */ - *(pRawdata+1) = pPROM->iSampledepth; - *(pRawdata+2) = pPROM->iFilltype; - /* and write it */ - iRetcode = write_raw_chunk (pData, pPROM->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PROM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_ipng) -{ - mng_ipngp pIPNG; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IPNG, MNG_LC_START); -#endif - - pIPNG = (mng_ipngp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pIPNG->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IPNG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_pplt) -{ - mng_ppltp pPPLT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_pplt_entryp pEntry; - mng_uint8p pTemp; - mng_uint32 iX; - mng_bool bHasgroup; - mng_uint8p pLastid = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PPLT, MNG_LC_START); -#endif - - pPPLT = (mng_ppltp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 1; - - *pRawdata = pPPLT->iDeltatype; /* fill the output buffer */ - - pTemp = pRawdata+1; - bHasgroup = MNG_FALSE; - - for (iX = 0; iX < pPPLT->iCount; iX++) - { - pEntry = &pPPLT->aEntries[iX]; - - if (pEntry->bUsed) /* valid entry ? */ - { - if (!bHasgroup) /* start a new group ? */ - { - bHasgroup = MNG_TRUE; - pLastid = pTemp+1; - - *pTemp = (mng_uint8)iX; - *(pTemp+1) = 0; - - pTemp += 2; - iRawlen += 2; - } - - switch (pPPLT->iDeltatype) /* add group-entry depending on type */ - { - case 0: ; - case 1: { - *pTemp = pEntry->iRed; - *(pTemp+1) = pEntry->iGreen; - *(pTemp+2) = pEntry->iBlue; - - pTemp += 3; - iRawlen += 3; - - break; - } - - case 2: ; - case 3: { - *pTemp = pEntry->iAlpha; - - pTemp++; - iRawlen++; - - break; - } - - case 4: ; - case 5: { - *pTemp = pEntry->iRed; - *(pTemp+1) = pEntry->iGreen; - *(pTemp+2) = pEntry->iBlue; - *(pTemp+3) = pEntry->iAlpha; - - pTemp += 4; - iRawlen += 4; - - break; - } - - } - } - else - { - if (bHasgroup) /* finish off a group ? */ - *pLastid = (mng_uint8)(iX-1); - - bHasgroup = MNG_FALSE; - } - } - - if (bHasgroup) /* last group unfinished ? */ - *pLastid = (mng_uint8)(pPPLT->iCount-1); - /* write the output buffer */ - iRetcode = write_raw_chunk (pData, pPPLT->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_PPLT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_ijng) -{ - mng_ijngp pIJNG; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IJNG, MNG_LC_START); -#endif - - pIJNG = (mng_ijngp)pChunk; /* address the proper chunk */ - /* and write it */ - iRetcode = write_raw_chunk (pData, pIJNG->sHeader.iChunkname, 0, 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_IJNG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_drop) -{ - mng_dropp pDROP; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint32 iX; - mng_uint8p pTemp1; - mng_chunkidp pTemp2; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DROP, MNG_LC_START); -#endif - - pDROP = (mng_dropp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pDROP->iCount << 2; - - pTemp1 = pRawdata; /* fill the output buffer */ - pTemp2 = pDROP->pChunknames; - - for (iX = 0; iX < pDROP->iCount; iX++) - { - mng_put_uint32 (pTemp1, (mng_uint32)*pTemp2); - - pTemp2++; - pTemp1 += 4; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pDROP->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DROP, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -WRITE_CHUNK (mng_write_dbyk) -{ - mng_dbykp pDBYK; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DBYK, MNG_LC_START); -#endif - - pDBYK = (mng_dbykp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 5 + pDBYK->iKeywordssize; - /* fill the output buffer */ - mng_put_uint32 (pRawdata, pDBYK->iChunkname); - *(pRawdata+4) = pDBYK->iPolarity; - - if (pDBYK->iKeywordssize) - MNG_COPY (pRawdata+5, pDBYK->zKeywords, pDBYK->iKeywordssize); - /* and write it */ - iRetcode = write_raw_chunk (pData, pDBYK->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_DBYK, MNG_LC_END); -#endif - - return iRetcode; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -WRITE_CHUNK (mng_write_ordr) -{ - mng_ordrp pORDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pTemp; - mng_ordr_entryp pEntry; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ORDR, MNG_LC_START); -#endif - - pORDR = (mng_ordrp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = pORDR->iCount * 5; - - pTemp = pRawdata; /* fill the output buffer */ - pEntry = pORDR->pEntries; - - for (iX = 0; iX < pORDR->iCount; iX++) - { - mng_put_uint32 (pTemp, pEntry->iChunkname); - *(pTemp+4) = pEntry->iOrdertype; - pTemp += 5; - pEntry++; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pORDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_ORDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_magn) -{ - mng_magnp pMAGN; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MAGN, MNG_LC_START); -#endif - - pMAGN = (mng_magnp)pChunk; /* address the proper chunk */ - - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 18; - /* fill the output buffer */ - mng_put_uint16 (pRawdata, pMAGN->iFirstid); - mng_put_uint16 (pRawdata+2, pMAGN->iLastid); - *(pRawdata+4) = pMAGN->iMethodX; - mng_put_uint16 (pRawdata+5, pMAGN->iMX); - mng_put_uint16 (pRawdata+7, pMAGN->iMY); - mng_put_uint16 (pRawdata+9, pMAGN->iML); - mng_put_uint16 (pRawdata+11, pMAGN->iMR); - mng_put_uint16 (pRawdata+13, pMAGN->iMT); - mng_put_uint16 (pRawdata+15, pMAGN->iMB); - *(pRawdata+17) = pMAGN->iMethodY; - /* optimize length */ - if (pMAGN->iMethodY == pMAGN->iMethodX) - { - iRawlen--; - - if (pMAGN->iMB == pMAGN->iMY) - { - iRawlen -= 2; - - if (pMAGN->iMT == pMAGN->iMY) - { - iRawlen -= 2; - - if (pMAGN->iMR == pMAGN->iMX) - { - iRawlen -= 2; - - if (pMAGN->iML == pMAGN->iMX) - { - iRawlen -= 2; - - if (pMAGN->iMY == pMAGN->iMX) - { - iRawlen -= 2; - - if (pMAGN->iMX == 1) - { - iRawlen -= 2; - - if (pMAGN->iMethodX == 0) - { - iRawlen--; - - if (pMAGN->iLastid == pMAGN->iFirstid) - { - iRawlen -= 2; - - if (pMAGN->iFirstid == 0) - iRawlen = 0; - - } - } - } - } - } - } - } - } - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pMAGN->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MAGN, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -WRITE_CHUNK (mng_write_mpng) -{ - mng_mpngp pMPNG; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_uint8p pBuf = 0; - mng_uint32 iBuflen; - mng_uint32 iReallen; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MPNG, MNG_LC_START); -#endif - - pMPNG = (mng_mpngp)pChunk; /* address the proper chunk */ - /* compress the frame structures */ - iRetcode = deflate_buffer (pData, (mng_uint8p)pMPNG->pFrames, pMPNG->iFramessize, - &pBuf, &iBuflen, &iReallen); - - if (!iRetcode) /* all ok ? */ - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 15 + iReallen; - /* requires large buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_ALLOC (pData, pRawdata, iRawlen); - /* fill the buffer */ - mng_put_uint32 (pRawdata, pMPNG->iFramewidth); - mng_put_uint32 (pRawdata+4, pMPNG->iFrameheight); - mng_put_uint16 (pRawdata+8, pMPNG->iNumplays); - mng_put_uint16 (pRawdata+10, pMPNG->iTickspersec); - *(pRawdata+12) = pMPNG->iCompressionmethod; - - if (iReallen) - MNG_COPY (pRawdata+13, pBuf, iReallen); - /* and write it */ - iRetcode = write_raw_chunk (pData, pMPNG->sHeader.iChunkname, - iRawlen, pRawdata); - /* drop the temp buffer ? */ - if (iRawlen > pData->iWritebufsize) - MNG_FREEX (pData, pRawdata, iRawlen); - } - - MNG_FREEX (pData, pBuf, iBuflen); /* always drop the compression buffer */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_MPNG, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -WRITE_CHUNK (mng_write_ahdr) -{ - mng_ahdrp pAHDR; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_AHDR, MNG_LC_START); -#endif - - pAHDR = (mng_ahdrp)pChunk; /* address the proper chunk */ - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 22; - /* fill the buffer */ - mng_put_uint32 (pRawdata, pAHDR->iNumframes); - mng_put_uint32 (pRawdata+4, pAHDR->iTickspersec); - mng_put_uint32 (pRawdata+8, pAHDR->iNumplays); - mng_put_uint32 (pRawdata+12, pAHDR->iTilewidth); - mng_put_uint32 (pRawdata+16, pAHDR->iTileheight); - *(pRawdata+20) = pAHDR->iInterlace; - *(pRawdata+21) = pAHDR->iStillused; - /* and write it */ - iRetcode = write_raw_chunk (pData, pAHDR->sHeader.iChunkname, - iRawlen, pRawdata); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_AHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -WRITE_CHUNK (mng_write_adat) -{ - - /* TODO: something */ - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -WRITE_CHUNK (mng_write_evnt) -{ - mng_evntp pEVNT; - mng_uint8p pRawdata; - mng_uint32 iRawlen; - mng_retcode iRetcode; - mng_evnt_entryp pEntry; - mng_uint8p pTemp; - mng_uint32 iX; - mng_uint32 iNamesize; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EVNT, MNG_LC_START); -#endif - - pEVNT = (mng_evntp)pChunk; /* address the proper chunk */ - - if (!pEVNT->iCount) /* empty ? */ - iRetcode = write_raw_chunk (pData, pEVNT->sHeader.iChunkname, 0, 0); - else - { - pRawdata = pData->pWritebuf+8; /* init output buffer & size */ - iRawlen = 0; - pTemp = pRawdata; - pEntry = pEVNT->pEntries; - - for (iX = 0; iX < pEVNT->iCount; iX++) - { - if (iX) /* put separator null-byte, except the first */ - { - *pTemp = 0; - pTemp++; - iRawlen++; - } - - *pTemp = pEntry->iEventtype; - *(pTemp+1) = pEntry->iMasktype; - pTemp += 2; - iRawlen += 2; - - switch (pEntry->iMasktype) - { - case 1 : - { - mng_put_int32 (pTemp, pEntry->iLeft); - mng_put_int32 (pTemp+4, pEntry->iRight); - mng_put_int32 (pTemp+8, pEntry->iTop); - mng_put_int32 (pTemp+12, pEntry->iBottom); - pTemp += 16; - iRawlen += 16; - break; - } - case 2 : - { - mng_put_uint16 (pTemp, pEntry->iObjectid); - pTemp += 2; - iRawlen += 2; - break; - } - case 3 : - { - mng_put_uint16 (pTemp, pEntry->iObjectid); - *(pTemp+2) = pEntry->iIndex; - pTemp += 3; - iRawlen += 3; - break; - } - case 4 : - { - mng_put_int32 (pTemp, pEntry->iLeft); - mng_put_int32 (pTemp+4, pEntry->iRight); - mng_put_int32 (pTemp+8, pEntry->iTop); - mng_put_int32 (pTemp+12, pEntry->iBottom); - mng_put_uint16 (pTemp+16, pEntry->iObjectid); - pTemp += 18; - iRawlen += 18; - break; - } - case 5 : - { - mng_put_int32 (pTemp, pEntry->iLeft); - mng_put_int32 (pTemp+4, pEntry->iRight); - mng_put_int32 (pTemp+8, pEntry->iTop); - mng_put_int32 (pTemp+12, pEntry->iBottom); - mng_put_uint16 (pTemp+16, pEntry->iObjectid); - *(pTemp+18) = pEntry->iIndex; - pTemp += 19; - iRawlen += 19; - break; - } - } - - iNamesize = pEntry->iSegmentnamesize; - - if (iNamesize) - { - MNG_COPY (pTemp, pEntry->zSegmentname, iNamesize); - pTemp += iNamesize; - iRawlen += iNamesize; - } - - pEntry++; - } - /* and write it */ - iRetcode = write_raw_chunk (pData, pEVNT->sHeader.iChunkname, - iRawlen, pRawdata); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_EVNT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -WRITE_CHUNK (mng_write_unknown) -{ - mng_unknown_chunkp pUnknown; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_UNKNOWN, MNG_LC_START); -#endif - /* address the proper chunk */ - pUnknown = (mng_unknown_chunkp)pChunk; - /* and write it */ - iRetcode = write_raw_chunk (pData, pUnknown->sHeader.iChunkname, - pUnknown->iDatasize, pUnknown->pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_UNKNOWN, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_chunk_io.h b/Engine/lib/lmng/libmng_chunk_io.h deleted file mode 100644 index f8505baec..000000000 --- a/Engine/lib/lmng/libmng_chunk_io.h +++ /dev/null @@ -1,415 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_io.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.109 * */ -/* * * */ -/* * purpose : Chunk I/O routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the chunk input/output routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - changed CRC initialization to use dynamic structure * */ -/* * (wasn't thread-safe the old way !) * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed write routines definition * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added SKIP_CHUNK and NO_DELTA_PNG support * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed SKIPCHUNK_itXT and SKIPCHUNK_ztXT typos * */ -/* * * */ -/* * 1.0.9 - 12/07/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunk_io_h_ -#define _libmng_chunk_io_h_ - -/* ************************************************************************** */ - -mng_uint32 mng_crc (mng_datap pData, - mng_uint8p buf, - mng_int32 len); - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_inflate_buffer (mng_datap pData, - mng_uint8p pInbuf, - mng_uint32 iInsize, - mng_uint8p *pOutbuf, - mng_uint32 *iOutsize, - mng_uint32 *iRealsize); - -/* ************************************************************************** */ - -#define READ_CHUNK(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pHeader, \ - mng_uint32 iRawlen, \ - mng_uint8p pRawdata, \ - mng_chunkp* ppChunk) - -#ifdef MNG_OPTIMIZE_CHUNKREADER -READ_CHUNK (mng_read_general) ; -#endif - -READ_CHUNK (mng_read_ihdr) ; -READ_CHUNK (mng_read_plte) ; -READ_CHUNK (mng_read_idat) ; -READ_CHUNK (mng_read_iend) ; -READ_CHUNK (mng_read_trns) ; -READ_CHUNK (mng_read_gama) ; -READ_CHUNK (mng_read_chrm) ; -READ_CHUNK (mng_read_srgb) ; -#ifndef MNG_SKIPCHUNK_iCCP -READ_CHUNK (mng_read_iccp) ; -#endif -#ifndef MNG_SKIPCHUNK_tEXt -READ_CHUNK (mng_read_text) ; -#endif -#ifndef MNG_SKIPCHUNK_zTXt -READ_CHUNK (mng_read_ztxt) ; -#endif -#ifndef MNG_SKIPCHUNK_iTXt -READ_CHUNK (mng_read_itxt) ; -#endif -#ifndef MNG_SKIPCHUNK_bKGD -READ_CHUNK (mng_read_bkgd) ; -#endif -#ifndef MNG_SKIPCHUNK_pHYs -READ_CHUNK (mng_read_phys) ; -#endif -#ifndef MNG_SKIPCHUNK_sBIT -READ_CHUNK (mng_read_sbit) ; -#endif -#ifndef MNG_SKIPCHUNK_sPLT -READ_CHUNK (mng_read_splt) ; -#endif -#ifndef MNG_SKIPCHUNK_hIST -READ_CHUNK (mng_read_hist) ; -#endif -#ifndef MNG_SKIPCHUNK_tIME -READ_CHUNK (mng_read_time) ; -#endif -READ_CHUNK (mng_read_mhdr) ; -READ_CHUNK (mng_read_mend) ; -READ_CHUNK (mng_read_loop) ; -READ_CHUNK (mng_read_endl) ; -READ_CHUNK (mng_read_defi) ; -READ_CHUNK (mng_read_basi) ; -READ_CHUNK (mng_read_clon) ; -#ifndef MNG_SKIPCHUNK_PAST -READ_CHUNK (mng_read_past) ; -#endif -READ_CHUNK (mng_read_disc) ; -READ_CHUNK (mng_read_back) ; -READ_CHUNK (mng_read_fram) ; -READ_CHUNK (mng_read_move) ; -READ_CHUNK (mng_read_clip) ; -READ_CHUNK (mng_read_show) ; -READ_CHUNK (mng_read_term) ; -READ_CHUNK (mng_read_save) ; -READ_CHUNK (mng_read_seek) ; -#ifndef MNG_SKIPCHUNK_eXPI -READ_CHUNK (mng_read_expi) ; -#endif -#ifndef MNG_SKIPCHUNK_fPRI -READ_CHUNK (mng_read_fpri) ; -#endif -#ifndef MNG_SKIPCHUNK_pHYg -READ_CHUNK (mng_read_phyg) ; -#endif -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_jhdr) ; -READ_CHUNK (mng_read_jdaa) ; -READ_CHUNK (mng_read_jdat) ; -READ_CHUNK (mng_read_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -READ_CHUNK (mng_read_dhdr) ; -READ_CHUNK (mng_read_prom) ; -READ_CHUNK (mng_read_ipng) ; -READ_CHUNK (mng_read_pplt) ; -#ifdef MNG_INCLUDE_JNG -READ_CHUNK (mng_read_ijng) ; -#endif -READ_CHUNK (mng_read_drop) ; -READ_CHUNK (mng_read_dbyk) ; -READ_CHUNK (mng_read_ordr) ; -#endif -READ_CHUNK (mng_read_magn) ; -#ifndef MNG_SKIPCHUNK_nEED -READ_CHUNK (mng_read_need) ; -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -READ_CHUNK (mng_read_mpng) ; -#endif -#ifndef MNG_SKIPCHUNK_evNT -READ_CHUNK (mng_read_evnt) ; -#endif -READ_CHUNK (mng_read_unknown) ; - -/* ************************************************************************** */ - -#else /* MNG_INCLUDE_READ_PROCS */ -#define mng_read_ihdr 0 -#define mng_read_plte 0 -#define mng_read_idat 0 -#define mng_read_iend 0 -#define mng_read_trns 0 -#define mng_read_gama 0 -#define mng_read_chrm 0 -#define mng_read_srgb 0 -#define mng_read_iccp 0 -#define mng_read_text 0 -#define mng_read_ztxt 0 -#define mng_read_itxt 0 -#define mng_read_bkgd 0 -#define mng_read_phys 0 -#define mng_read_sbit 0 -#define mng_read_splt 0 -#define mng_read_hist 0 -#define mng_read_time 0 -#define mng_read_mhdr 0 -#define mng_read_mend 0 -#define mng_read_loop 0 -#define mng_read_endl 0 -#define mng_read_defi 0 -#define mng_read_basi 0 -#define mng_read_clon 0 -#ifndef MNG_SKIPCHUNK_PAST -#define mng_read_past 0 -#endif -#define mng_read_disc 0 -#define mng_read_back 0 -#define mng_read_fram 0 -#define mng_read_move 0 -#define mng_read_clip 0 -#define mng_read_show 0 -#define mng_read_term 0 -#define mng_read_save 0 -#define mng_read_seek 0 -#define mng_read_expi 0 -#define mng_read_fpri 0 -#define mng_read_phyg 0 -#ifdef MNG_INCLUDE_JNG -#define mng_read_jhdr 0 -#define mng_read_jdaa 0 -#define mng_read_jdat 0 -#define mng_read_jsep 0 -#endif -#ifndef MNG_NO_DELTA_PNG -#define mng_read_dhdr 0 -#define mng_read_prom 0 -#define mng_read_ipng 0 -#define mng_read_pplt 0 -#ifdef MNG_INCLUDE_JNG -#define mng_read_ijng 0 -#endif -#define mng_read_drop 0 -#define mng_read_dbyk 0 -#define mng_read_ordr 0 -#endif -#define mng_read_magn 0 -#define mng_read_need 0 -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -#define mng_read_mpng 0 -#endif -#define mng_read_evnt 0 -#define mng_read_unknown 0 -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -#define WRITE_CHUNK(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunk) - -WRITE_CHUNK (mng_write_ihdr) ; -WRITE_CHUNK (mng_write_plte) ; -WRITE_CHUNK (mng_write_idat) ; -WRITE_CHUNK (mng_write_iend) ; -WRITE_CHUNK (mng_write_trns) ; -WRITE_CHUNK (mng_write_gama) ; -WRITE_CHUNK (mng_write_chrm) ; -WRITE_CHUNK (mng_write_srgb) ; -WRITE_CHUNK (mng_write_iccp) ; -WRITE_CHUNK (mng_write_text) ; -WRITE_CHUNK (mng_write_ztxt) ; -WRITE_CHUNK (mng_write_itxt) ; -WRITE_CHUNK (mng_write_bkgd) ; -WRITE_CHUNK (mng_write_phys) ; -WRITE_CHUNK (mng_write_sbit) ; -WRITE_CHUNK (mng_write_splt) ; -WRITE_CHUNK (mng_write_hist) ; -WRITE_CHUNK (mng_write_time) ; -WRITE_CHUNK (mng_write_mhdr) ; -WRITE_CHUNK (mng_write_mend) ; -WRITE_CHUNK (mng_write_loop) ; -WRITE_CHUNK (mng_write_endl) ; -WRITE_CHUNK (mng_write_defi) ; -WRITE_CHUNK (mng_write_basi) ; -WRITE_CHUNK (mng_write_clon) ; -#ifndef MNG_SKIPCHUNK_PAST -WRITE_CHUNK (mng_write_past) ; -#endif -WRITE_CHUNK (mng_write_disc) ; -WRITE_CHUNK (mng_write_back) ; -WRITE_CHUNK (mng_write_fram) ; -WRITE_CHUNK (mng_write_move) ; -WRITE_CHUNK (mng_write_clip) ; -WRITE_CHUNK (mng_write_show) ; -WRITE_CHUNK (mng_write_term) ; -WRITE_CHUNK (mng_write_save) ; -WRITE_CHUNK (mng_write_seek) ; -WRITE_CHUNK (mng_write_expi) ; -WRITE_CHUNK (mng_write_fpri) ; -WRITE_CHUNK (mng_write_phyg) ; -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_jhdr) ; -WRITE_CHUNK (mng_write_jdaa) ; -WRITE_CHUNK (mng_write_jdat) ; -WRITE_CHUNK (mng_write_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -WRITE_CHUNK (mng_write_dhdr) ; -WRITE_CHUNK (mng_write_prom) ; -WRITE_CHUNK (mng_write_ipng) ; -WRITE_CHUNK (mng_write_pplt) ; -#ifdef MNG_INCLUDE_JNG -WRITE_CHUNK (mng_write_ijng) ; -#endif -WRITE_CHUNK (mng_write_drop) ; -WRITE_CHUNK (mng_write_dbyk) ; -WRITE_CHUNK (mng_write_ordr) ; -#endif -WRITE_CHUNK (mng_write_magn) ; -WRITE_CHUNK (mng_write_need) ; -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -WRITE_CHUNK (mng_write_mpng) ; -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -WRITE_CHUNK (mng_write_ahdr) ; -WRITE_CHUNK (mng_write_adat) ; -#endif -WRITE_CHUNK (mng_write_evnt) ; -WRITE_CHUNK (mng_write_unknown) ; - -/* ************************************************************************** */ - -#else /* MNG_INCLUDE_WRITE_PROCS */ -#define mng_write_ihdr 0 -#define mng_write_plte 0 -#define mng_write_idat 0 -#define mng_write_iend 0 -#define mng_write_trns 0 -#define mng_write_gama 0 -#define mng_write_chrm 0 -#define mng_write_srgb 0 -#define mng_write_iccp 0 -#define mng_write_text 0 -#define mng_write_ztxt 0 -#define mng_write_itxt 0 -#define mng_write_bkgd 0 -#define mng_write_phys 0 -#define mng_write_sbit 0 -#define mng_write_splt 0 -#define mng_write_hist 0 -#define mng_write_time 0 -#define mng_write_mhdr 0 -#define mng_write_mend 0 -#define mng_write_loop 0 -#define mng_write_endl 0 -#define mng_write_defi 0 -#define mng_write_basi 0 -#define mng_write_clon 0 -#ifndef MNG_SKIPCHUNK_PAST -#define mng_write_past 0 -#endif -#define mng_write_disc 0 -#define mng_write_back 0 -#define mng_write_fram 0 -#define mng_write_move 0 -#define mng_write_clip 0 -#define mng_write_show 0 -#define mng_write_term 0 -#define mng_write_save 0 -#define mng_write_seek 0 -#define mng_write_expi 0 -#define mng_write_fpri 0 -#define mng_write_phyg 0 -#ifdef MNG_INCLUDE_JNG -#define mng_write_jhdr 0 -#define mng_write_jdaa 0 -#define mng_write_jdat 0 -#define mng_write_jsep 0 -#endif -#ifndef MNG_NO_DELTA_PNG -#define mng_write_dhdr 0 -#define mng_write_prom 0 -#define mng_write_ipng 0 -#define mng_write_pplt 0 -#ifdef MNG_INCLUDE_JNG -#define mng_write_ijng 0 -#endif -#define mng_write_drop 0 -#define mng_write_dbyk 0 -#define mng_write_ordr 0 -#endif -#define mng_write_magn 0 -#define mng_write_need 0 -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -#define mng_write_mpng 0 -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -#define mng_write_adat 0 -#define mng_write_ahdr 0 -#endif -#define mng_write_evnt 0 -#define mng_write_unknown 0 -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_chunk_io_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_chunk_prc.c b/Engine/lib/lmng/libmng_chunk_prc.c deleted file mode 100644 index e633e7e26..000000000 --- a/Engine/lib/lmng/libmng_chunk_prc.c +++ /dev/null @@ -1,4452 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_prc.c copyright (c) 2000-2005 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk initialization & cleanup (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the chunk initialization & cleanup * */ -/* * routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed creation-code * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - put add_chunk() inside MNG_INCLUDE_WRITE_PROCS wrapper * */ -/* * 0.9.2 - 08/01/2000 - G.Juyn * */ -/* * - wrapper for add_chunk() changed * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 10/04/2002 - G.Juyn * */ -/* * - fixed chunk-storage for evNT chunk * */ -/* * 1.0.5 - 10/17/2002 - G.Juyn * */ -/* * - fixed issue in freeing evNT chunk * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * - added MNG_NO_DELTA_PNG reduction feature * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed SKIPCHUNK_eXPI -> fPRI typo * */ -/* * * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 07/30/2005 - G.Juyn * */ -/* * - fixed problem with CLON object during readdisplay() * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#include "libmng_chunk_prc.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * General chunk routines * */ -/* * * */ -/* ************************************************************************** */ - -void mng_add_chunk (mng_datap pData, - mng_chunkp pChunk) -{ - if (!pData->pFirstchunk) /* list is still empty ? */ - { - pData->pFirstchunk = pChunk; /* then this becomes the first */ - -#ifdef MNG_SUPPORT_WRITE - if (!pData->iFirstchunkadded) - { - pData->iFirstchunkadded = ((mng_chunk_headerp)pChunk)->iChunkname; -#endif - - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_IHDR) - pData->eImagetype = mng_it_png; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_JHDR) - pData->eImagetype = mng_it_jng; - else -#endif - pData->eImagetype = mng_it_mng; - - pData->eSigtype = pData->eImagetype; -#ifdef MNG_SUPPORT_WRITE - } -#endif - } - else - { /* else we make appropriate links */ - ((mng_chunk_headerp)pChunk)->pPrev = pData->pLastchunk; - ((mng_chunk_headerp)pData->pLastchunk)->pNext = pChunk; - } - - pData->pLastchunk = pChunk; /* and it's always the last */ - - return; -} - -/* ************************************************************************** */ -/* * * */ -/* * Chunk specific initialization routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -INIT_CHUNK_HDR (mng_init_general) -{ - MNG_ALLOC (pData, *ppChunk, ((mng_chunk_headerp)pHeader)->iChunksize); - MNG_COPY (*ppChunk, pHeader, sizeof (mng_chunk_header)); - return MNG_NOERROR; -} - -#else /* MNG_OPTIMIZE_CHUNKINITFREE */ - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ihdr)); - ((mng_ihdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_plte) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PLTE, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_plte)); - ((mng_pltep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDAT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_idat)); - ((mng_idatp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IEND, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_iend)); - ((mng_iendp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_trns) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TRNS, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_trns)); - ((mng_trnsp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -INIT_CHUNK_HDR (mng_init_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMA, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_gama)); - ((mng_gamap)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -INIT_CHUNK_HDR (mng_init_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CHRM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_chrm)); - ((mng_chrmp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -INIT_CHUNK_HDR (mng_init_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SRGB, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_srgb)); - ((mng_srgbp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -INIT_CHUNK_HDR (mng_init_iccp) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ICCP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_iccp)); - ((mng_iccpp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -INIT_CHUNK_HDR (mng_init_text) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TEXT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_text)); - ((mng_textp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -INIT_CHUNK_HDR (mng_init_ztxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ZTXT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ztxt)); - ((mng_ztxtp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -INIT_CHUNK_HDR (mng_init_itxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ITXT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_itxt)); - ((mng_itxtp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -INIT_CHUNK_HDR (mng_init_bkgd) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BKGD, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_bkgd)); - ((mng_bkgdp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -INIT_CHUNK_HDR (mng_init_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYS, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_phys)); - ((mng_physp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -INIT_CHUNK_HDR (mng_init_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SBIT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_sbit)); - ((mng_sbitp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -INIT_CHUNK_HDR (mng_init_splt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SPLT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_splt)); - ((mng_spltp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -INIT_CHUNK_HDR (mng_init_hist) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_HIST, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_hist)); - ((mng_histp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -INIT_CHUNK_HDR (mng_init_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TIME, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_time)); - ((mng_timep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_mhdr)); - ((mng_mhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MEND, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_mend)); - ((mng_mendp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -INIT_CHUNK_HDR (mng_init_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_LOOP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_loop)); - ((mng_loopp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ENDL, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_endl)); - ((mng_endlp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -INIT_CHUNK_HDR (mng_init_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DEFI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_defi)); - ((mng_defip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -INIT_CHUNK_HDR (mng_init_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BASI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_basi)); - ((mng_basip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -INIT_CHUNK_HDR (mng_init_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLON, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_clon)); - ((mng_clonp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -INIT_CHUNK_HDR (mng_init_past) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PAST, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_past)); - ((mng_pastp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -INIT_CHUNK_HDR (mng_init_disc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DISC, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_disc)); - ((mng_discp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -INIT_CHUNK_HDR (mng_init_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BACK, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_back)); - ((mng_backp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -INIT_CHUNK_HDR (mng_init_fram) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FRAM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_fram)); - ((mng_framp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -INIT_CHUNK_HDR (mng_init_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MOVE, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_move)); - ((mng_movep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -INIT_CHUNK_HDR (mng_init_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLIP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_clip)); - ((mng_clipp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -INIT_CHUNK_HDR (mng_init_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SHOW, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_show)); - ((mng_showp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -INIT_CHUNK_HDR (mng_init_term) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TERM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_term)); - ((mng_termp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -INIT_CHUNK_HDR (mng_init_save) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SAVE, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_save)); - ((mng_savep)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; - -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -INIT_CHUNK_HDR (mng_init_seek) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SEEK, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_seek)); - ((mng_seekp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -INIT_CHUNK_HDR (mng_init_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EXPI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_expi)); - ((mng_expip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -INIT_CHUNK_HDR (mng_init_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FPRI, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_fpri)); - ((mng_fprip)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -INIT_CHUNK_HDR (mng_init_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_NEED, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_need)); - ((mng_needp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -INIT_CHUNK_HDR (mng_init_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYG, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_phyg)); - ((mng_phygp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jhdr)); - ((mng_jhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jdaa) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jdaa)); - ((mng_jdaap)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jdat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jdat)); - ((mng_jdatp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JSEP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_jsep)); - ((mng_jsepp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_dhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DHDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_dhdr)); - ((mng_dhdrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_prom) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PROM, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_prom)); - ((mng_promp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IPNG, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ipng)); - ((mng_ipngp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_pplt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PPLT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_pplt)); - ((mng_ppltp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IJNG, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ijng)); - ((mng_ijngp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DROP, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_drop)); - ((mng_dropp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -INIT_CHUNK_HDR (mng_init_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DBYK, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_dbyk)); - ((mng_dbykp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -INIT_CHUNK_HDR (mng_init_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ORDR, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_ordr)); - ((mng_ordrp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -INIT_CHUNK_HDR (mng_init_magn) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_magn)); - ((mng_magnp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -INIT_CHUNK_HDR (mng_init_evnt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EVNT, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_evnt)); - ((mng_evntp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -INIT_CHUNK_HDR (mng_init_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_UNKNOWN, MNG_LC_START); -#endif - - MNG_ALLOC (pData, *ppChunk, sizeof (mng_unknown_chunk)); - ((mng_unknown_chunkp)*ppChunk)->sHeader = *((mng_chunk_headerp)pHeader); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - -/* ************************************************************************** */ -/* * * */ -/* * Chunk specific cleanup routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_general) -{ - MNG_FREEX (pData, pHeader, ((mng_chunk_headerp)pHeader)->iChunksize); - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_ihdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_plte) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PLTE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_plte)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -FREE_CHUNK_HDR (mng_free_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IDAT, MNG_LC_START); -#endif - - if (((mng_idatp)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_idatp)pHeader)->pData, - ((mng_idatp)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_idat)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IDAT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IEND, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_iend)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_trns) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TRNS, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_trns)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_gAMA -FREE_CHUNK_HDR (mng_free_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_GAMA, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_gama)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_cHRM -FREE_CHUNK_HDR (mng_free_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CHRM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_chrm)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_sRGB -FREE_CHUNK_HDR (mng_free_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SRGB, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_srgb)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -FREE_CHUNK_HDR (mng_free_iccp) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ICCP, MNG_LC_START); -#endif - - if (((mng_iccpp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_iccpp)pHeader)->zName, - ((mng_iccpp)pHeader)->iNamesize + 1); - - if (((mng_iccpp)pHeader)->iProfilesize) - MNG_FREEX (pData, ((mng_iccpp)pHeader)->pProfile, - ((mng_iccpp)pHeader)->iProfilesize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_iccp)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ICCP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -FREE_CHUNK_HDR (mng_free_text) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TEXT, MNG_LC_START); -#endif - - if (((mng_textp)pHeader)->iKeywordsize) - MNG_FREEX (pData, ((mng_textp)pHeader)->zKeyword, - ((mng_textp)pHeader)->iKeywordsize + 1); - - if (((mng_textp)pHeader)->iTextsize) - MNG_FREEX (pData, ((mng_textp)pHeader)->zText, - ((mng_textp)pHeader)->iTextsize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_text)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TEXT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -FREE_CHUNK_HDR (mng_free_ztxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ZTXT, MNG_LC_START); -#endif - - if (((mng_ztxtp)pHeader)->iKeywordsize) - MNG_FREEX (pData, ((mng_ztxtp)pHeader)->zKeyword, - ((mng_ztxtp)pHeader)->iKeywordsize + 1); - - if (((mng_ztxtp)pHeader)->iTextsize) - MNG_FREEX (pData, ((mng_ztxtp)pHeader)->zText, - ((mng_ztxtp)pHeader)->iTextsize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_ztxt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ZTXT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ -#ifndef MNG_SKIPCHUNK_iTXt -FREE_CHUNK_HDR (mng_free_itxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ITXT, MNG_LC_START); -#endif - - if (((mng_itxtp)pHeader)->iKeywordsize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zKeyword, - ((mng_itxtp)pHeader)->iKeywordsize + 1); - - if (((mng_itxtp)pHeader)->iLanguagesize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zLanguage, - ((mng_itxtp)pHeader)->iLanguagesize + 1); - - if (((mng_itxtp)pHeader)->iTranslationsize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zTranslation, - ((mng_itxtp)pHeader)->iTranslationsize + 1); - - if (((mng_itxtp)pHeader)->iTextsize) - MNG_FREEX (pData, ((mng_itxtp)pHeader)->zText, - ((mng_itxtp)pHeader)->iTextsize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_itxt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ITXT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -FREE_CHUNK_HDR (mng_free_mpng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG, MNG_LC_START); -#endif - - if (((mng_mpngp)pHeader)->iFramessize) - MNG_FREEX (pData, ((mng_mpngp)pHeader)->pFrames, - ((mng_mpngp)pHeader)->iFramessize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_mpng)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_ANG_PROPOSAL -FREE_CHUNK_HDR (mng_free_adat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ADAT, MNG_LC_START); -#endif - - if (((mng_adatp)pHeader)->iTilessize) - MNG_FREEX (pData, ((mng_adatp)pHeader)->pTiles, ((mng_adatp)pHeader)->iTilessize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_adat)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ADAT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_bKGD -FREE_CHUNK_HDR (mng_free_bkgd) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BKGD, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_bkgd)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_pHYs -FREE_CHUNK_HDR (mng_free_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYS, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_phys)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_sBIT -FREE_CHUNK_HDR (mng_free_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SBIT, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_sbit)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -FREE_CHUNK_HDR (mng_free_splt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SPLT, MNG_LC_START); -#endif - - if (((mng_spltp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_spltp)pHeader)->zName, - ((mng_spltp)pHeader)->iNamesize + 1); - - if (((mng_spltp)pHeader)->iEntrycount) - MNG_FREEX (pData, ((mng_spltp)pHeader)->pEntries, - ((mng_spltp)pHeader)->iEntrycount * - (((mng_spltp)pHeader)->iSampledepth * 3 + sizeof (mng_uint16)) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_splt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SPLT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_hIST -FREE_CHUNK_HDR (mng_free_hist) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_HIST, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_hist)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_tIME -FREE_CHUNK_HDR (mng_free_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TIME, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_time)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_mhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MEND, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_mend)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -FREE_CHUNK_HDR (mng_free_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_LOOP, MNG_LC_START); -#endif - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (((mng_loopp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_loopp)pHeader)->pSignals, - ((mng_loopp)pHeader)->iCount * sizeof (mng_uint32) ); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_loop)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_LOOP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ENDL, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_endl)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_DEFI -FREE_CHUNK_HDR (mng_free_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DEFI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_defi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_BASI -FREE_CHUNK_HDR (mng_free_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BASI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_basi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_CLON -FREE_CHUNK_HDR (mng_free_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLON, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_clon)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -FREE_CHUNK_HDR (mng_free_past) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PAST, MNG_LC_START); -#endif - - if (((mng_pastp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_pastp)pHeader)->pSources, - ((mng_pastp)pHeader)->iCount * sizeof (mng_past_source) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_past)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PAST, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -FREE_CHUNK_HDR (mng_free_disc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DISC, MNG_LC_START); -#endif - - if (((mng_discp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_discp)pHeader)->pObjectids, - ((mng_discp)pHeader)->iCount * sizeof (mng_uint16) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_disc)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DISC, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_BACK -FREE_CHUNK_HDR (mng_free_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BACK, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_back)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -FREE_CHUNK_HDR (mng_free_fram) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FRAM, MNG_LC_START); -#endif - - if (((mng_framp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_framp)pHeader)->zName, - ((mng_framp)pHeader)->iNamesize + 1); - - if (((mng_framp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_framp)pHeader)->pSyncids, - ((mng_framp)pHeader)->iCount * sizeof (mng_uint32) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_fram)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FRAM, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_MOVE -FREE_CHUNK_HDR (mng_free_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MOVE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_move)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_CLIP -FREE_CHUNK_HDR (mng_free_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLIP, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_clip)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_SHOW -FREE_CHUNK_HDR (mng_free_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SHOW, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_show)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_TERM -FREE_CHUNK_HDR (mng_free_term) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TERM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_term)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -FREE_CHUNK_HDR (mng_free_save) -{ - mng_save_entryp pEntry = ((mng_savep)pHeader)->pEntries; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SAVE, MNG_LC_START); -#endif - - for (iX = 0; iX < ((mng_savep)pHeader)->iCount; iX++) - { - if (pEntry->iNamesize) - MNG_FREEX (pData, pEntry->zName, pEntry->iNamesize); - - pEntry = pEntry + sizeof (mng_save_entry); - } - - if (((mng_savep)pHeader)->iCount) - MNG_FREEX (pData, ((mng_savep)pHeader)->pEntries, - ((mng_savep)pHeader)->iCount * sizeof (mng_save_entry) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_save)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SAVE, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -FREE_CHUNK_HDR (mng_free_seek) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SEEK, MNG_LC_START); -#endif - - if (((mng_seekp)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_seekp)pHeader)->zName, - ((mng_seekp)pHeader)->iNamesize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_seek)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_SEEK, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -FREE_CHUNK_HDR (mng_free_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EXPI, MNG_LC_START); -#endif - - if (((mng_expip)pHeader)->iNamesize) - MNG_FREEX (pData, ((mng_expip)pHeader)->zName, - ((mng_expip)pHeader)->iNamesize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_expi)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EXPI, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_fPRI -FREE_CHUNK_HDR (mng_free_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FPRI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_fpri)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -FREE_CHUNK_HDR (mng_free_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_NEED, MNG_LC_START); -#endif - - if (((mng_needp)pHeader)->iKeywordssize) - MNG_FREEX (pData, ((mng_needp)pHeader)->zKeywords, - ((mng_needp)pHeader)->iKeywordssize + 1); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_need)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_NEED, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_pHYg -FREE_CHUNK_HDR (mng_free_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_phyg)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_jhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jdaa) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_START); -#endif - - if (((mng_jdaap)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_jdaap)pHeader)->pData, - ((mng_jdaap)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_jdaa)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAA, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jdat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAT, MNG_LC_START); -#endif - - if (((mng_jdatp)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_jdatp)pHeader)->pData, - ((mng_jdatp)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_jdat)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JDAT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JSEP, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_jsep)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_dhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_dhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_prom) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PROM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_prom)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IPNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_ipng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_pplt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PPLT, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_pplt)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IJNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_ijng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DROP, MNG_LC_START); -#endif - - if (((mng_dropp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_dropp)pHeader)->pChunknames, - ((mng_dropp)pHeader)->iCount * sizeof (mng_chunkid) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_drop)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DROP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -FREE_CHUNK_HDR (mng_free_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DBYK, MNG_LC_START); -#endif - - if (((mng_dbykp)pHeader)->iKeywordssize) - MNG_FREEX (pData, ((mng_dbykp)pHeader)->zKeywords, - ((mng_dbykp)pHeader)->iKeywordssize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_dbyk)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_DBYK, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -FREE_CHUNK_HDR (mng_free_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ORDR, MNG_LC_START); -#endif - - if (((mng_ordrp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_ordrp)pHeader)->pEntries, - ((mng_ordrp)pHeader)->iCount * sizeof (mng_ordr_entry) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_ordr)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ORDR, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE -#ifndef MNG_SKIPCHUNK_MAGN -FREE_CHUNK_HDR (mng_free_magn) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_START); -#endif - - MNG_FREEX (pData, pHeader, sizeof (mng_magn)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -FREE_CHUNK_HDR (mng_free_evnt) -{ - mng_evnt_entryp pEntry = ((mng_evntp)pHeader)->pEntries; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVNT, MNG_LC_START); -#endif - - for (iX = 0; iX < ((mng_evntp)pHeader)->iCount; iX++) - { - if (pEntry->iSegmentnamesize) - MNG_FREEX (pData, pEntry->zSegmentname, pEntry->iSegmentnamesize+1); - - pEntry++; - } - - if (((mng_evntp)pHeader)->iCount) - MNG_FREEX (pData, ((mng_evntp)pHeader)->pEntries, - ((mng_evntp)pHeader)->iCount * sizeof (mng_evnt_entry) ); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_evnt)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVNT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} -#endif - -/* ************************************************************************** */ - -FREE_CHUNK_HDR (mng_free_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_UNKNOWN, MNG_LC_START); -#endif - - if (((mng_unknown_chunkp)pHeader)->iDatasize) - MNG_FREEX (pData, ((mng_unknown_chunkp)pHeader)->pData, - ((mng_unknown_chunkp)pHeader)->iDatasize); - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - MNG_FREEX (pData, pHeader, sizeof (mng_unknown_chunk)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_UNKNOWN, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_CHUNKINITFREE - return MNG_NOERROR; -#else - return mng_free_general(pData, pHeader); -#endif -} - -/* ************************************************************************** */ -/* * * */ -/* * Chunk specific copy routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_general) -{ - mng_ptr pSrc = (mng_uint8p)pChunkfrom + sizeof (mng_chunk_header); - mng_ptr pDst = (mng_uint8p)pChunkto + sizeof (mng_chunk_header); - mng_size_t iLen = ((mng_chunk_headerp)pChunkfrom)->iChunksize - sizeof (mng_chunk_header); - - MNG_COPY (pDst, pSrc, iLen); - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_ihdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ihdrp)pChunkto)->iWidth = ((mng_ihdrp)pChunkfrom)->iWidth; - ((mng_ihdrp)pChunkto)->iHeight = ((mng_ihdrp)pChunkfrom)->iHeight; - ((mng_ihdrp)pChunkto)->iBitdepth = ((mng_ihdrp)pChunkfrom)->iBitdepth; - ((mng_ihdrp)pChunkto)->iColortype = ((mng_ihdrp)pChunkfrom)->iColortype; - ((mng_ihdrp)pChunkto)->iCompression = ((mng_ihdrp)pChunkfrom)->iCompression; - ((mng_ihdrp)pChunkto)->iFilter = ((mng_ihdrp)pChunkfrom)->iFilter; - ((mng_ihdrp)pChunkto)->iInterlace = ((mng_ihdrp)pChunkfrom)->iInterlace; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_plte) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PLTE, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PLTE) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_pltep)pChunkto)->bEmpty = ((mng_pltep)pChunkfrom)->bEmpty; - ((mng_pltep)pChunkto)->iEntrycount = ((mng_pltep)pChunkfrom)->iEntrycount; - - for (iX = 0; iX < ((mng_pltep)pChunkto)->iEntrycount; iX++) - ((mng_pltep)pChunkto)->aEntries [iX] = ((mng_pltep)pChunkfrom)->aEntries [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -ASSIGN_CHUNK_HDR (mng_assign_idat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IDAT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_idatp)pChunkto)->bEmpty = ((mng_idatp)pChunkfrom)->bEmpty; - ((mng_idatp)pChunkto)->iDatasize = ((mng_idatp)pChunkfrom)->iDatasize; - - if (((mng_idatp)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_idatp)pChunkto)->pData, ((mng_idatp)pChunkto)->iDatasize); - MNG_COPY (((mng_idatp)pChunkto)->pData, ((mng_idatp)pChunkfrom)->pData, - ((mng_idatp)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_iend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IEND, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IEND) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_trns) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TRNS, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_tRNS) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_trnsp)pChunkto)->bEmpty = ((mng_trnsp)pChunkfrom)->bEmpty; - ((mng_trnsp)pChunkto)->bGlobal = ((mng_trnsp)pChunkfrom)->bGlobal; - ((mng_trnsp)pChunkto)->iType = ((mng_trnsp)pChunkfrom)->iType; - ((mng_trnsp)pChunkto)->iCount = ((mng_trnsp)pChunkfrom)->iCount; - ((mng_trnsp)pChunkto)->iGray = ((mng_trnsp)pChunkfrom)->iGray; - ((mng_trnsp)pChunkto)->iRed = ((mng_trnsp)pChunkfrom)->iRed; - ((mng_trnsp)pChunkto)->iGreen = ((mng_trnsp)pChunkfrom)->iGreen; - ((mng_trnsp)pChunkto)->iBlue = ((mng_trnsp)pChunkfrom)->iBlue; - ((mng_trnsp)pChunkto)->iRawlen = ((mng_trnsp)pChunkfrom)->iRawlen; - - for (iX = 0; iX < ((mng_trnsp)pChunkto)->iCount; iX++) - ((mng_trnsp)pChunkto)->aEntries [iX] = ((mng_trnsp)pChunkfrom)->aEntries [iX]; - - for (iX = 0; iX < ((mng_trnsp)pChunkto)->iRawlen; iX++) - ((mng_trnsp)pChunkto)->aRawdata [iX] = ((mng_trnsp)pChunkfrom)->aRawdata [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_gAMA -ASSIGN_CHUNK_HDR (mng_assign_gama) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_GAMA, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_gAMA) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_gamap)pChunkto)->bEmpty = ((mng_gamap)pChunkfrom)->bEmpty; - ((mng_gamap)pChunkto)->iGamma = ((mng_gamap)pChunkfrom)->iGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_cHRM -ASSIGN_CHUNK_HDR (mng_assign_chrm) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CHRM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_cHRM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_chrmp)pChunkto)->bEmpty = ((mng_chrmp)pChunkfrom)->bEmpty; - ((mng_chrmp)pChunkto)->iWhitepointx = ((mng_chrmp)pChunkfrom)->iWhitepointx; - ((mng_chrmp)pChunkto)->iWhitepointy = ((mng_chrmp)pChunkfrom)->iWhitepointy; - ((mng_chrmp)pChunkto)->iRedx = ((mng_chrmp)pChunkfrom)->iRedx; - ((mng_chrmp)pChunkto)->iRedy = ((mng_chrmp)pChunkfrom)->iRedy; - ((mng_chrmp)pChunkto)->iGreenx = ((mng_chrmp)pChunkfrom)->iGreenx; - ((mng_chrmp)pChunkto)->iGreeny = ((mng_chrmp)pChunkfrom)->iGreeny; - ((mng_chrmp)pChunkto)->iBluex = ((mng_chrmp)pChunkfrom)->iBluex; - ((mng_chrmp)pChunkto)->iBluey = ((mng_chrmp)pChunkfrom)->iBluey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_sRGB -ASSIGN_CHUNK_HDR (mng_assign_srgb) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SRGB, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_sRGB) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_srgbp)pChunkto)->iRenderingintent = ((mng_srgbp)pChunkfrom)->iRenderingintent; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -ASSIGN_CHUNK_HDR (mng_assign_iccp) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ICCP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_iCCP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_iccpp)pChunkto)->bEmpty = ((mng_iccpp)pChunkfrom)->bEmpty; - ((mng_iccpp)pChunkto)->iNamesize = ((mng_iccpp)pChunkfrom)->iNamesize; - ((mng_iccpp)pChunkto)->iCompression = ((mng_iccpp)pChunkfrom)->iCompression; - ((mng_iccpp)pChunkto)->iProfilesize = ((mng_iccpp)pChunkfrom)->iProfilesize; - - if (((mng_iccpp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunkto)->zName, ((mng_iccpp)pChunkto)->iNamesize); - MNG_COPY (((mng_iccpp)pChunkto)->zName, ((mng_iccpp)pChunkfrom)->zName, - ((mng_iccpp)pChunkto)->iNamesize); - } - - if (((mng_iccpp)pChunkto)->iProfilesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunkto)->pProfile, ((mng_iccpp)pChunkto)->iProfilesize); - MNG_COPY (((mng_iccpp)pChunkto)->pProfile, ((mng_iccpp)pChunkfrom)->pProfile, - ((mng_iccpp)pChunkto)->iProfilesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -ASSIGN_CHUNK_HDR (mng_assign_text) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TEXT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_tEXt) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_textp)pChunkto)->iKeywordsize = ((mng_textp)pChunkfrom)->iKeywordsize; - ((mng_textp)pChunkto)->iTextsize = ((mng_textp)pChunkfrom)->iTextsize; - - if (((mng_textp)pChunkto)->iKeywordsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zKeyword, ((mng_textp)pChunkto)->iKeywordsize); - MNG_COPY (((mng_itxtp)pChunkto)->zKeyword, ((mng_textp)pChunkfrom)->zKeyword, - ((mng_itxtp)pChunkto)->iKeywordsize); - } - - if (((mng_textp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_textp)pChunkto)->zText, ((mng_textp)pChunkto)->iTextsize); - MNG_COPY (((mng_textp)pChunkto)->zText, ((mng_textp)pChunkfrom)->zText, - ((mng_textp)pChunkto)->iTextsize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -ASSIGN_CHUNK_HDR (mng_assign_ztxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ZTXT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_zTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ztxtp)pChunkto)->iKeywordsize = ((mng_ztxtp)pChunkfrom)->iKeywordsize; - ((mng_ztxtp)pChunkto)->iCompression = ((mng_ztxtp)pChunkfrom)->iCompression; - ((mng_ztxtp)pChunkto)->iTextsize = ((mng_ztxtp)pChunkfrom)->iTextsize; - - if (((mng_ztxtp)pChunkto)->iKeywordsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunkto)->zKeyword, ((mng_ztxtp)pChunkto)->iKeywordsize); - MNG_COPY (((mng_ztxtp)pChunkto)->zKeyword, ((mng_ztxtp)pChunkfrom)->zKeyword, - ((mng_ztxtp)pChunkto)->iKeywordsize); - } - - if (((mng_ztxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunkto)->zText, ((mng_ztxtp)pChunkto)->iTextsize); - MNG_COPY (((mng_ztxtp)pChunkto)->zText, ((mng_ztxtp)pChunkfrom)->zText, - ((mng_ztxtp)pChunkto)->iTextsize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -ASSIGN_CHUNK_HDR (mng_assign_itxt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ITXT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_iTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_itxtp)pChunkto)->iKeywordsize = ((mng_itxtp)pChunkfrom)->iKeywordsize; - ((mng_itxtp)pChunkto)->iCompressionflag = ((mng_itxtp)pChunkfrom)->iCompressionflag; - ((mng_itxtp)pChunkto)->iCompressionmethod = ((mng_itxtp)pChunkfrom)->iCompressionmethod; - ((mng_itxtp)pChunkto)->iLanguagesize = ((mng_itxtp)pChunkfrom)->iLanguagesize; - ((mng_itxtp)pChunkto)->iTranslationsize = ((mng_itxtp)pChunkfrom)->iTranslationsize; - ((mng_itxtp)pChunkto)->iTextsize = ((mng_itxtp)pChunkfrom)->iTextsize; - - if (((mng_itxtp)pChunkto)->iKeywordsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zKeyword, ((mng_itxtp)pChunkto)->iKeywordsize); - MNG_COPY (((mng_itxtp)pChunkto)->zKeyword, ((mng_itxtp)pChunkfrom)->zKeyword, - ((mng_itxtp)pChunkto)->iKeywordsize); - } - - if (((mng_itxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zLanguage, ((mng_itxtp)pChunkto)->iLanguagesize); - MNG_COPY (((mng_itxtp)pChunkto)->zLanguage, ((mng_itxtp)pChunkfrom)->zLanguage, - ((mng_itxtp)pChunkto)->iLanguagesize); - } - - if (((mng_itxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zTranslation, ((mng_itxtp)pChunkto)->iTranslationsize); - MNG_COPY (((mng_itxtp)pChunkto)->zTranslation, ((mng_itxtp)pChunkfrom)->zTranslation, - ((mng_itxtp)pChunkto)->iTranslationsize); - } - - if (((mng_itxtp)pChunkto)->iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunkto)->zText, ((mng_itxtp)pChunkto)->iTextsize); - MNG_COPY (((mng_itxtp)pChunkto)->zText, ((mng_itxtp)pChunkfrom)->zText, - ((mng_itxtp)pChunkto)->iTextsize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_bKGD -ASSIGN_CHUNK_HDR (mng_assign_bkgd) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BKGD, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_bKGD) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_bkgdp)pChunkto)->bEmpty = ((mng_bkgdp)pChunkfrom)->bEmpty; - ((mng_bkgdp)pChunkto)->iType = ((mng_bkgdp)pChunkfrom)->iType; - ((mng_bkgdp)pChunkto)->iIndex = ((mng_bkgdp)pChunkfrom)->iIndex; - ((mng_bkgdp)pChunkto)->iGray = ((mng_bkgdp)pChunkfrom)->iGray; - ((mng_bkgdp)pChunkto)->iRed = ((mng_bkgdp)pChunkfrom)->iRed; - ((mng_bkgdp)pChunkto)->iGreen = ((mng_bkgdp)pChunkfrom)->iGreen; - ((mng_bkgdp)pChunkto)->iBlue = ((mng_bkgdp)pChunkfrom)->iBlue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_pHYs -ASSIGN_CHUNK_HDR (mng_assign_phys) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYS, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_pHYs) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_physp)pChunkto)->bEmpty = ((mng_physp)pChunkfrom)->bEmpty; - ((mng_physp)pChunkto)->iSizex = ((mng_physp)pChunkfrom)->iSizex; - ((mng_physp)pChunkto)->iSizey = ((mng_physp)pChunkfrom)->iSizey; - ((mng_physp)pChunkto)->iUnit = ((mng_physp)pChunkfrom)->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_sBIT -ASSIGN_CHUNK_HDR (mng_assign_sbit) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SBIT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_sBIT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_sbitp)pChunkto)->bEmpty = ((mng_sbitp)pChunkfrom)->bEmpty; - ((mng_sbitp)pChunkto)->iType = ((mng_sbitp)pChunkfrom)->iType; - ((mng_sbitp)pChunkto)->aBits [0] = ((mng_sbitp)pChunkfrom)->aBits [0]; - ((mng_sbitp)pChunkto)->aBits [1] = ((mng_sbitp)pChunkfrom)->aBits [1]; - ((mng_sbitp)pChunkto)->aBits [2] = ((mng_sbitp)pChunkfrom)->aBits [2]; - ((mng_sbitp)pChunkto)->aBits [3] = ((mng_sbitp)pChunkfrom)->aBits [3]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -ASSIGN_CHUNK_HDR (mng_assign_splt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SPLT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_sPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_spltp)pChunkto)->bEmpty = ((mng_spltp)pChunkfrom)->bEmpty; - ((mng_spltp)pChunkto)->iNamesize = ((mng_spltp)pChunkfrom)->iNamesize; - ((mng_spltp)pChunkto)->iSampledepth = ((mng_spltp)pChunkfrom)->iSampledepth; - ((mng_spltp)pChunkto)->iEntrycount = ((mng_spltp)pChunkfrom)->iEntrycount; - ((mng_spltp)pChunkto)->pEntries = ((mng_spltp)pChunkfrom)->pEntries; - - if (((mng_spltp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_spltp)pChunkto)->zName, ((mng_spltp)pChunkto)->iNamesize); - MNG_COPY (((mng_spltp)pChunkto)->zName, ((mng_spltp)pChunkfrom)->zName, - ((mng_spltp)pChunkto)->iNamesize); - } - - if (((mng_spltp)pChunkto)->iEntrycount) - { - mng_uint32 iLen = ((mng_spltp)pChunkto)->iEntrycount * - (((mng_spltp)pChunkto)->iSampledepth * 3 + sizeof (mng_uint16)); - - MNG_ALLOC (pData, ((mng_spltp)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_spltp)pChunkto)->pEntries, ((mng_spltp)pChunkfrom)->pEntries, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_hIST -ASSIGN_CHUNK_HDR (mng_assign_hist) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_HIST, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_hIST) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_histp)pChunkto)->iEntrycount = ((mng_histp)pChunkfrom)->iEntrycount; - - for (iX = 0; iX < ((mng_histp)pChunkto)->iEntrycount; iX++) - ((mng_histp)pChunkto)->aEntries [iX] = ((mng_histp)pChunkfrom)->aEntries [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_tIME -ASSIGN_CHUNK_HDR (mng_assign_time) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TIME, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_tIME) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_timep)pChunkto)->iYear = ((mng_timep)pChunkfrom)->iYear; - ((mng_timep)pChunkto)->iMonth = ((mng_timep)pChunkfrom)->iMonth; - ((mng_timep)pChunkto)->iDay = ((mng_timep)pChunkfrom)->iDay; - ((mng_timep)pChunkto)->iHour = ((mng_timep)pChunkfrom)->iHour; - ((mng_timep)pChunkto)->iMinute = ((mng_timep)pChunkfrom)->iMinute; - ((mng_timep)pChunkto)->iSecond = ((mng_timep)pChunkfrom)->iSecond; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_mhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_mhdrp)pChunkto)->iWidth = ((mng_mhdrp)pChunkfrom)->iWidth; - ((mng_mhdrp)pChunkto)->iHeight = ((mng_mhdrp)pChunkfrom)->iHeight; - ((mng_mhdrp)pChunkto)->iTicks = ((mng_mhdrp)pChunkfrom)->iTicks; - ((mng_mhdrp)pChunkto)->iLayercount = ((mng_mhdrp)pChunkfrom)->iLayercount; - ((mng_mhdrp)pChunkto)->iFramecount = ((mng_mhdrp)pChunkfrom)->iFramecount; - ((mng_mhdrp)pChunkto)->iPlaytime = ((mng_mhdrp)pChunkfrom)->iPlaytime; - ((mng_mhdrp)pChunkto)->iSimplicity = ((mng_mhdrp)pChunkfrom)->iSimplicity; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_mend) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MEND, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MEND) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -ASSIGN_CHUNK_HDR (mng_assign_loop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_LOOP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_LOOP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_loopp)pChunkto)->iLevel = ((mng_loopp)pChunkfrom)->iLevel; - ((mng_loopp)pChunkto)->iRepeat = ((mng_loopp)pChunkfrom)->iRepeat; - ((mng_loopp)pChunkto)->iTermination = ((mng_loopp)pChunkfrom)->iTermination; - ((mng_loopp)pChunkto)->iItermin = ((mng_loopp)pChunkfrom)->iItermin; - ((mng_loopp)pChunkto)->iItermax = ((mng_loopp)pChunkfrom)->iItermax; - ((mng_loopp)pChunkto)->iCount = ((mng_loopp)pChunkfrom)->iCount; - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (((mng_loopp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_loopp)pChunkto)->iCount * sizeof (mng_uint32); - MNG_ALLOC (pData, ((mng_loopp)pChunkto)->pSignals, iLen); - MNG_COPY (((mng_loopp)pChunkto)->pSignals, ((mng_loopp)pChunkfrom)->pSignals, iLen); - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_endl) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ENDL, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_ENDL) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_endlp)pChunkto)->iLevel = ((mng_endlp)pChunkfrom)->iLevel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_DEFI -ASSIGN_CHUNK_HDR (mng_assign_defi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DEFI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DEFI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_defip)pChunkto)->iObjectid = ((mng_defip)pChunkfrom)->iObjectid; - ((mng_defip)pChunkto)->bHasdonotshow = ((mng_defip)pChunkfrom)->bHasdonotshow; - ((mng_defip)pChunkto)->iDonotshow = ((mng_defip)pChunkfrom)->iDonotshow; - ((mng_defip)pChunkto)->bHasconcrete = ((mng_defip)pChunkfrom)->bHasconcrete; - ((mng_defip)pChunkto)->iConcrete = ((mng_defip)pChunkfrom)->iConcrete; - ((mng_defip)pChunkto)->bHasloca = ((mng_defip)pChunkfrom)->bHasloca; - ((mng_defip)pChunkto)->iXlocation = ((mng_defip)pChunkfrom)->iXlocation; - ((mng_defip)pChunkto)->iYlocation = ((mng_defip)pChunkfrom)->iYlocation; - ((mng_defip)pChunkto)->bHasclip = ((mng_defip)pChunkfrom)->bHasclip; - ((mng_defip)pChunkto)->iLeftcb = ((mng_defip)pChunkfrom)->iLeftcb; - ((mng_defip)pChunkto)->iRightcb = ((mng_defip)pChunkfrom)->iRightcb; - ((mng_defip)pChunkto)->iTopcb = ((mng_defip)pChunkfrom)->iTopcb; - ((mng_defip)pChunkto)->iBottomcb = ((mng_defip)pChunkfrom)->iBottomcb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_BASI -ASSIGN_CHUNK_HDR (mng_assign_basi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BASI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_BASI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_basip)pChunkto)->iWidth = ((mng_basip)pChunkfrom)->iWidth; - ((mng_basip)pChunkto)->iHeight = ((mng_basip)pChunkfrom)->iHeight; - ((mng_basip)pChunkto)->iBitdepth = ((mng_basip)pChunkfrom)->iBitdepth; - ((mng_basip)pChunkto)->iColortype = ((mng_basip)pChunkfrom)->iColortype; - ((mng_basip)pChunkto)->iCompression = ((mng_basip)pChunkfrom)->iCompression; - ((mng_basip)pChunkto)->iFilter = ((mng_basip)pChunkfrom)->iFilter; - ((mng_basip)pChunkto)->iInterlace = ((mng_basip)pChunkfrom)->iInterlace; - ((mng_basip)pChunkto)->iRed = ((mng_basip)pChunkfrom)->iRed; - ((mng_basip)pChunkto)->iGreen = ((mng_basip)pChunkfrom)->iGreen; - ((mng_basip)pChunkto)->iBlue = ((mng_basip)pChunkfrom)->iBlue; - ((mng_basip)pChunkto)->iAlpha = ((mng_basip)pChunkfrom)->iAlpha; - ((mng_basip)pChunkto)->iViewable = ((mng_basip)pChunkfrom)->iViewable; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_CLON -ASSIGN_CHUNK_HDR (mng_assign_clon) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLON, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_CLON) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_clonp)pChunkto)->iSourceid = ((mng_clonp)pChunkfrom)->iSourceid; - ((mng_clonp)pChunkto)->iCloneid = ((mng_clonp)pChunkfrom)->iCloneid; - ((mng_clonp)pChunkto)->iClonetype = ((mng_clonp)pChunkfrom)->iClonetype; -#ifdef MNG_OPTIMIZE_CHUNKREADER - ((mng_clonp)pChunkto)->bHasdonotshow = ((mng_clonp)pChunkfrom)->bHasdonotshow; -#endif - ((mng_clonp)pChunkto)->iDonotshow = ((mng_clonp)pChunkfrom)->iDonotshow; - ((mng_clonp)pChunkto)->iConcrete = ((mng_clonp)pChunkfrom)->iConcrete; - ((mng_clonp)pChunkto)->bHasloca = ((mng_clonp)pChunkfrom)->bHasloca; - ((mng_clonp)pChunkto)->iLocationtype = ((mng_clonp)pChunkfrom)->iLocationtype; - ((mng_clonp)pChunkto)->iLocationx = ((mng_clonp)pChunkfrom)->iLocationx; - ((mng_clonp)pChunkto)->iLocationy = ((mng_clonp)pChunkfrom)->iLocationy; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -ASSIGN_CHUNK_HDR (mng_assign_past) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PAST, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_pastp)pChunkto)->iDestid = ((mng_pastp)pChunkfrom)->iDestid; - ((mng_pastp)pChunkto)->iTargettype = ((mng_pastp)pChunkfrom)->iTargettype; - ((mng_pastp)pChunkto)->iTargetx = ((mng_pastp)pChunkfrom)->iTargetx; - ((mng_pastp)pChunkto)->iTargety = ((mng_pastp)pChunkfrom)->iTargety; - ((mng_pastp)pChunkto)->iCount = ((mng_pastp)pChunkfrom)->iCount; - - if (((mng_pastp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_pastp)pChunkto)->iCount * sizeof (mng_past_source); - - MNG_ALLOC (pData, ((mng_pastp)pChunkto)->pSources, iLen); - MNG_COPY (((mng_pastp)pChunkto)->pSources, ((mng_pastp)pChunkfrom)->pSources, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -ASSIGN_CHUNK_HDR (mng_assign_disc) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DISC, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DISC) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_discp)pChunkto)->iCount = ((mng_discp)pChunkfrom)->iCount; - - if (((mng_discp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_discp)pChunkto)->iCount * sizeof (mng_uint16); - - MNG_ALLOC (pData, ((mng_discp)pChunkto)->pObjectids, iLen); - MNG_COPY (((mng_discp)pChunkto)->pObjectids, ((mng_discp)pChunkfrom)->pObjectids, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_BACK -ASSIGN_CHUNK_HDR (mng_assign_back) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BACK, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_BACK) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_backp)pChunkto)->iRed = ((mng_backp)pChunkfrom)->iRed; - ((mng_backp)pChunkto)->iGreen = ((mng_backp)pChunkfrom)->iGreen; - ((mng_backp)pChunkto)->iBlue = ((mng_backp)pChunkfrom)->iBlue; - ((mng_backp)pChunkto)->iMandatory = ((mng_backp)pChunkfrom)->iMandatory; - ((mng_backp)pChunkto)->iImageid = ((mng_backp)pChunkfrom)->iImageid; - ((mng_backp)pChunkto)->iTile = ((mng_backp)pChunkfrom)->iTile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -ASSIGN_CHUNK_HDR (mng_assign_fram) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FRAM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_FRAM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_framp)pChunkto)->bEmpty = ((mng_framp)pChunkfrom)->bEmpty; - ((mng_framp)pChunkto)->iMode = ((mng_framp)pChunkfrom)->iMode; - ((mng_framp)pChunkto)->iNamesize = ((mng_framp)pChunkfrom)->iNamesize; - ((mng_framp)pChunkto)->iChangedelay = ((mng_framp)pChunkfrom)->iChangedelay; - ((mng_framp)pChunkto)->iChangetimeout = ((mng_framp)pChunkfrom)->iChangetimeout; - ((mng_framp)pChunkto)->iChangeclipping = ((mng_framp)pChunkfrom)->iChangeclipping; - ((mng_framp)pChunkto)->iChangesyncid = ((mng_framp)pChunkfrom)->iChangesyncid; - ((mng_framp)pChunkto)->iDelay = ((mng_framp)pChunkfrom)->iDelay; - ((mng_framp)pChunkto)->iTimeout = ((mng_framp)pChunkfrom)->iTimeout; - ((mng_framp)pChunkto)->iBoundarytype = ((mng_framp)pChunkfrom)->iBoundarytype; - ((mng_framp)pChunkto)->iBoundaryl = ((mng_framp)pChunkfrom)->iBoundaryl; - ((mng_framp)pChunkto)->iBoundaryr = ((mng_framp)pChunkfrom)->iBoundaryr; - ((mng_framp)pChunkto)->iBoundaryt = ((mng_framp)pChunkfrom)->iBoundaryt; - ((mng_framp)pChunkto)->iBoundaryb = ((mng_framp)pChunkfrom)->iBoundaryb; - ((mng_framp)pChunkto)->iCount = ((mng_framp)pChunkfrom)->iCount; - - if (((mng_framp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_framp)pChunkto)->zName, ((mng_framp)pChunkto)->iNamesize); - MNG_COPY (((mng_framp)pChunkto)->zName, ((mng_framp)pChunkfrom)->zName, - ((mng_framp)pChunkto)->iNamesize); - } - - if (((mng_framp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_framp)pChunkto)->iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_framp)pChunkto)->pSyncids, iLen); - MNG_COPY (((mng_framp)pChunkto)->pSyncids, ((mng_framp)pChunkfrom)->pSyncids, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_MOVE -ASSIGN_CHUNK_HDR (mng_assign_move) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MOVE, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MOVE) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_movep)pChunkto)->iFirstid = ((mng_movep)pChunkfrom)->iFirstid; - ((mng_movep)pChunkto)->iLastid = ((mng_movep)pChunkfrom)->iLastid; - ((mng_movep)pChunkto)->iMovetype = ((mng_movep)pChunkfrom)->iMovetype; - ((mng_movep)pChunkto)->iMovex = ((mng_movep)pChunkfrom)->iMovex; - ((mng_movep)pChunkto)->iMovey = ((mng_movep)pChunkfrom)->iMovey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_CLIP -ASSIGN_CHUNK_HDR (mng_assign_clip) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLIP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_CLIP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_clipp)pChunkto)->iFirstid = ((mng_clipp)pChunkfrom)->iFirstid; - ((mng_clipp)pChunkto)->iLastid = ((mng_clipp)pChunkfrom)->iLastid; - ((mng_clipp)pChunkto)->iCliptype = ((mng_clipp)pChunkfrom)->iCliptype; - ((mng_clipp)pChunkto)->iClipl = ((mng_clipp)pChunkfrom)->iClipl; - ((mng_clipp)pChunkto)->iClipr = ((mng_clipp)pChunkfrom)->iClipr; - ((mng_clipp)pChunkto)->iClipt = ((mng_clipp)pChunkfrom)->iClipt; - ((mng_clipp)pChunkto)->iClipb = ((mng_clipp)pChunkfrom)->iClipb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_SHOW -ASSIGN_CHUNK_HDR (mng_assign_show) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SHOW, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_SHOW) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_showp)pChunkto)->bEmpty = ((mng_showp)pChunkfrom)->bEmpty; - ((mng_showp)pChunkto)->iFirstid = ((mng_showp)pChunkfrom)->iFirstid; - ((mng_showp)pChunkto)->iLastid = ((mng_showp)pChunkfrom)->iLastid; - ((mng_showp)pChunkto)->iMode = ((mng_showp)pChunkfrom)->iMode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_TERM -ASSIGN_CHUNK_HDR (mng_assign_term) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TERM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_TERM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_termp)pChunkto)->iTermaction = ((mng_termp)pChunkfrom)->iTermaction; - ((mng_termp)pChunkto)->iIteraction = ((mng_termp)pChunkfrom)->iIteraction; - ((mng_termp)pChunkto)->iDelay = ((mng_termp)pChunkfrom)->iDelay; - ((mng_termp)pChunkto)->iItermax = ((mng_termp)pChunkfrom)->iItermax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -ASSIGN_CHUNK_HDR (mng_assign_save) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SAVE, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_savep)pChunkto)->bEmpty = ((mng_savep)pChunkfrom)->bEmpty; - ((mng_savep)pChunkto)->iOffsettype = ((mng_savep)pChunkfrom)->iOffsettype; - ((mng_savep)pChunkto)->iCount = ((mng_savep)pChunkfrom)->iCount; - - if (((mng_savep)pChunkto)->iCount) - { - mng_uint32 iX; - mng_save_entryp pEntry; - mng_uint32 iLen = ((mng_savep)pChunkto)->iCount * sizeof (mng_save_entry); - - MNG_ALLOC (pData, ((mng_savep)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_savep)pChunkto)->pEntries, ((mng_savep)pChunkfrom)->pEntries, iLen); - - pEntry = ((mng_savep)pChunkto)->pEntries; - - for (iX = 0; iX < ((mng_savep)pChunkto)->iCount; iX++) - { - if (pEntry->iNamesize) - { - mng_pchar pTemp = pEntry->zName; - - MNG_ALLOC (pData, pEntry->zName, pEntry->iNamesize); - MNG_COPY (pEntry->zName, pTemp, pEntry->iNamesize); - } - else - { - pEntry->zName = MNG_NULL; - } - - pEntry++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -ASSIGN_CHUNK_HDR (mng_assign_seek) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SEEK, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_SEEK) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_seekp)pChunkto)->iNamesize = ((mng_seekp)pChunkfrom)->iNamesize; - - if (((mng_seekp)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_seekp)pChunkto)->zName, ((mng_seekp)pChunkto)->iNamesize); - MNG_COPY (((mng_seekp)pChunkto)->zName, ((mng_seekp)pChunkfrom)->zName, - ((mng_seekp)pChunkto)->iNamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -ASSIGN_CHUNK_HDR (mng_assign_expi) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EXPI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_eXPI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_expip)pChunkto)->iSnapshotid = ((mng_expip)pChunkfrom)->iSnapshotid; - ((mng_expip)pChunkto)->iNamesize = ((mng_expip)pChunkfrom)->iNamesize; - - if (((mng_expip)pChunkto)->iNamesize) - { - MNG_ALLOC (pData, ((mng_expip)pChunkto)->zName, ((mng_expip)pChunkto)->iNamesize); - MNG_COPY (((mng_expip)pChunkto)->zName, ((mng_expip)pChunkfrom)->zName, - ((mng_expip)pChunkto)->iNamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_fPRI -ASSIGN_CHUNK_HDR (mng_assign_fpri) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FPRI, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_fPRI) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_fprip)pChunkto)->iDeltatype = ((mng_fprip)pChunkfrom)->iDeltatype; - ((mng_fprip)pChunkto)->iPriority = ((mng_fprip)pChunkfrom)->iPriority; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -ASSIGN_CHUNK_HDR (mng_assign_need) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_NEED, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_nEED) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_needp)pChunkto)->iKeywordssize = ((mng_needp)pChunkfrom)->iKeywordssize; - - if (((mng_needp)pChunkto)->iKeywordssize) - { - MNG_ALLOC (pData, ((mng_needp)pChunkto)->zKeywords, ((mng_needp)pChunkto)->iKeywordssize); - MNG_COPY (((mng_needp)pChunkto)->zKeywords, ((mng_needp)pChunkfrom)->zKeywords, - ((mng_needp)pChunkto)->iKeywordssize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_pHYg -ASSIGN_CHUNK_HDR (mng_assign_phyg) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_pHYg) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_phygp)pChunkto)->bEmpty = ((mng_phygp)pChunkfrom)->bEmpty; - ((mng_phygp)pChunkto)->iSizex = ((mng_phygp)pChunkfrom)->iSizex; - ((mng_phygp)pChunkto)->iSizey = ((mng_phygp)pChunkfrom)->iSizey; - ((mng_phygp)pChunkto)->iUnit = ((mng_phygp)pChunkfrom)->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_jhdrp)pChunkto)->iWidth = ((mng_jhdrp)pChunkfrom)->iWidth; - ((mng_jhdrp)pChunkto)->iHeight = ((mng_jhdrp)pChunkfrom)->iHeight; - ((mng_jhdrp)pChunkto)->iColortype = ((mng_jhdrp)pChunkfrom)->iColortype; - ((mng_jhdrp)pChunkto)->iImagesampledepth = ((mng_jhdrp)pChunkfrom)->iImagesampledepth; - ((mng_jhdrp)pChunkto)->iImagecompression = ((mng_jhdrp)pChunkfrom)->iImagecompression; - ((mng_jhdrp)pChunkto)->iImageinterlace = ((mng_jhdrp)pChunkfrom)->iImageinterlace; - ((mng_jhdrp)pChunkto)->iAlphasampledepth = ((mng_jhdrp)pChunkfrom)->iAlphasampledepth; - ((mng_jhdrp)pChunkto)->iAlphacompression = ((mng_jhdrp)pChunkfrom)->iAlphacompression; - ((mng_jhdrp)pChunkto)->iAlphafilter = ((mng_jhdrp)pChunkfrom)->iAlphafilter; - ((mng_jhdrp)pChunkto)->iAlphainterlace = ((mng_jhdrp)pChunkfrom)->iAlphainterlace; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jdaa) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAA, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JDAA) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_jdaap)pChunkto)->bEmpty = ((mng_jdaap)pChunkfrom)->bEmpty; - ((mng_jdaap)pChunkto)->iDatasize = ((mng_jdaap)pChunkfrom)->iDatasize; - - if (((mng_jdaap)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_jdaap)pChunkto)->pData, ((mng_jdaap)pChunkto)->iDatasize); - MNG_COPY (((mng_jdaap)pChunkto)->pData, ((mng_jdaap)pChunkfrom)->pData, - ((mng_jdaap)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jdat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_jdatp)pChunkto)->bEmpty = ((mng_jdatp)pChunkfrom)->bEmpty; - ((mng_jdatp)pChunkto)->iDatasize = ((mng_jdatp)pChunkfrom)->iDatasize; - - if (((mng_jdatp)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_jdatp)pChunkto)->pData, ((mng_jdatp)pChunkto)->iDatasize); - MNG_COPY (((mng_jdatp)pChunkto)->pData, ((mng_jdatp)pChunkfrom)->pData, - ((mng_jdatp)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jsep) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JSEP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_JSEP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_dhdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_dhdrp)pChunkto)->iObjectid = ((mng_dhdrp)pChunkfrom)->iObjectid; - ((mng_dhdrp)pChunkto)->iImagetype = ((mng_dhdrp)pChunkfrom)->iImagetype; - ((mng_dhdrp)pChunkto)->iDeltatype = ((mng_dhdrp)pChunkfrom)->iDeltatype; - ((mng_dhdrp)pChunkto)->iBlockwidth = ((mng_dhdrp)pChunkfrom)->iBlockwidth; - ((mng_dhdrp)pChunkto)->iBlockheight = ((mng_dhdrp)pChunkfrom)->iBlockheight; - ((mng_dhdrp)pChunkto)->iBlockx = ((mng_dhdrp)pChunkfrom)->iBlockx; - ((mng_dhdrp)pChunkto)->iBlocky = ((mng_dhdrp)pChunkfrom)->iBlocky; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_prom) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PROM, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PROM) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_promp)pChunkto)->iColortype = ((mng_promp)pChunkfrom)->iColortype; - ((mng_promp)pChunkto)->iSampledepth = ((mng_promp)pChunkfrom)->iSampledepth; - ((mng_promp)pChunkto)->iFilltype = ((mng_promp)pChunkfrom)->iFilltype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_ipng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IPNG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IPNG) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_pplt) -{ - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PPLT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ppltp)pChunkto)->iDeltatype = ((mng_ppltp)pChunkfrom)->iDeltatype; - ((mng_ppltp)pChunkto)->iCount = ((mng_ppltp)pChunkfrom)->iCount; - - for (iX = 0; iX < ((mng_ppltp)pChunkto)->iCount; iX++) - ((mng_ppltp)pChunkto)->aEntries [iX] = ((mng_ppltp)pChunkfrom)->aEntries [iX]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_ijng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IJNG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_IJNG) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_drop) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DROP, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DROP) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_dropp)pChunkto)->iCount = ((mng_dropp)pChunkfrom)->iCount; - - if (((mng_dropp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_dropp)pChunkto)->iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_dropp)pChunkto)->pChunknames, iLen); - MNG_COPY (((mng_dropp)pChunkto)->pChunknames, ((mng_dropp)pChunkfrom)->pChunknames, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -ASSIGN_CHUNK_HDR (mng_assign_dbyk) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DBYK, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_DBYK) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_dbykp)pChunkto)->iChunkname = ((mng_dbykp)pChunkfrom)->iChunkname; - ((mng_dbykp)pChunkto)->iPolarity = ((mng_dbykp)pChunkfrom)->iPolarity; - ((mng_dbykp)pChunkto)->iKeywordssize = ((mng_dbykp)pChunkfrom)->iKeywordssize; - - if (((mng_dbykp)pChunkto)->iKeywordssize) - { - MNG_ALLOC (pData, ((mng_dbykp)pChunkto)->zKeywords, ((mng_dbykp)pChunkto)->iKeywordssize); - MNG_COPY (((mng_dbykp)pChunkto)->zKeywords, ((mng_dbykp)pChunkfrom)->zKeywords, - ((mng_dbykp)pChunkto)->iKeywordssize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -ASSIGN_CHUNK_HDR (mng_assign_ordr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ORDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ordrp)pChunkto)->iCount = ((mng_ordrp)pChunkfrom)->iCount; - - if (((mng_ordrp)pChunkto)->iCount) - { - mng_uint32 iLen = ((mng_ordrp)pChunkto)->iCount * sizeof (mng_ordr_entry); - - MNG_ALLOC (pData, ((mng_ordrp)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_ordrp)pChunkto)->pEntries, ((mng_ordrp)pChunkfrom)->pEntries, iLen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKASSIGN -#ifndef MNG_SKIPCHUNK_MAGN -ASSIGN_CHUNK_HDR (mng_assign_magn) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MAGN, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_MAGN) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_magnp)pChunkto)->iFirstid = ((mng_magnp)pChunkfrom)->iFirstid; - ((mng_magnp)pChunkto)->iLastid = ((mng_magnp)pChunkfrom)->iLastid; - ((mng_magnp)pChunkto)->iMethodX = ((mng_magnp)pChunkfrom)->iMethodX; - ((mng_magnp)pChunkto)->iMX = ((mng_magnp)pChunkfrom)->iMX; - ((mng_magnp)pChunkto)->iMY = ((mng_magnp)pChunkfrom)->iMY; - ((mng_magnp)pChunkto)->iML = ((mng_magnp)pChunkfrom)->iML; - ((mng_magnp)pChunkto)->iMR = ((mng_magnp)pChunkfrom)->iMR; - ((mng_magnp)pChunkto)->iMT = ((mng_magnp)pChunkfrom)->iMT; - ((mng_magnp)pChunkto)->iMB = ((mng_magnp)pChunkfrom)->iMB; - ((mng_magnp)pChunkto)->iMethodY = ((mng_magnp)pChunkfrom)->iMethodY; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_mpng) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MPNG, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_mpngp)pChunkto)->iFramewidth = ((mng_mpngp)pChunkfrom)->iFramewidth; - ((mng_mpngp)pChunkto)->iFrameheight = ((mng_mpngp)pChunkfrom)->iFrameheight; - ((mng_mpngp)pChunkto)->iNumplays = ((mng_mpngp)pChunkfrom)->iNumplays; - ((mng_mpngp)pChunkto)->iTickspersec = ((mng_mpngp)pChunkfrom)->iTickspersec; - ((mng_mpngp)pChunkto)->iCompressionmethod = ((mng_mpngp)pChunkfrom)->iCompressionmethod; - ((mng_mpngp)pChunkto)->iFramessize = ((mng_mpngp)pChunkfrom)->iFramessize; - - if (((mng_mpngp)pChunkto)->iFramessize) - { - MNG_ALLOC (pData, ((mng_mpngp)pChunkto)->pFrames, ((mng_mpngp)pChunkto)->iFramessize); - MNG_COPY (((mng_mpngp)pChunkto)->pFrames, ((mng_mpngp)pChunkfrom)->pFrames, - ((mng_mpngp)pChunkto)->iFramessize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_ahdr) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_AHDR, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_ahDR) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_ahdrp)pChunkto)->iNumframes = ((mng_ahdrp)pChunkfrom)->iNumframes; - ((mng_ahdrp)pChunkto)->iTickspersec = ((mng_ahdrp)pChunkfrom)->iTickspersec; - ((mng_ahdrp)pChunkto)->iNumplays = ((mng_ahdrp)pChunkfrom)->iNumplays; - ((mng_ahdrp)pChunkto)->iTilewidth = ((mng_ahdrp)pChunkfrom)->iTilewidth; - ((mng_ahdrp)pChunkto)->iTileheight = ((mng_ahdrp)pChunkfrom)->iTileheight; - ((mng_ahdrp)pChunkto)->iInterlace = ((mng_ahdrp)pChunkfrom)->iInterlace; - ((mng_ahdrp)pChunkto)->iStillused = ((mng_ahdrp)pChunkfrom)->iStillused; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_AHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_adat) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ADAT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_adAT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_adatp)pChunkto)->iTilessize = ((mng_adatp)pChunkfrom)->iTilessize; - - if (((mng_adatp)pChunkto)->iTilessize) - { - MNG_ALLOC (pData, ((mng_adatp)pChunkto)->pTiles, ((mng_adatp)pChunkto)->iTilessize); - MNG_COPY (((mng_adatp)pChunkto)->pTiles, ((mng_adatp)pChunkfrom)->pTiles, - ((mng_adatp)pChunkto)->iTilessize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_ADAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -ASSIGN_CHUNK_HDR (mng_assign_evnt) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EVNT, MNG_LC_START); -#endif - - if (((mng_chunk_headerp)pChunkfrom)->iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_WRONGCHUNK); /* ouch */ - - ((mng_evntp)pChunkto)->iCount = ((mng_evntp)pChunkfrom)->iCount; - - if (((mng_evntp)pChunkto)->iCount) - { - mng_uint32 iX; - mng_evnt_entryp pEntry; - mng_uint32 iLen = ((mng_evntp)pChunkto)->iCount * sizeof (mng_evnt_entry); - - MNG_ALLOC (pData, ((mng_evntp)pChunkto)->pEntries, iLen); - MNG_COPY (((mng_evntp)pChunkto)->pEntries, ((mng_evntp)pChunkfrom)->pEntries, iLen); - - pEntry = ((mng_evntp)pChunkto)->pEntries; - - for (iX = 0; iX < ((mng_evntp)pChunkto)->iCount; iX++) - { - if (pEntry->iSegmentnamesize) - { - mng_pchar pTemp = pEntry->zSegmentname; - - MNG_ALLOC (pData, pEntry->zSegmentname, pEntry->iSegmentnamesize+1); - MNG_COPY (pEntry->zSegmentname, pTemp, pEntry->iSegmentnamesize); - } - else - { - pEntry->zSegmentname = MNG_NULL; - } - - pEntry++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -ASSIGN_CHUNK_HDR (mng_assign_unknown) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_UNKNOWN, MNG_LC_START); -#endif - - ((mng_unknown_chunkp)pChunkto)->iDatasize = ((mng_unknown_chunkp)pChunkfrom)->iDatasize; - - if (((mng_unknown_chunkp)pChunkto)->iDatasize) - { - MNG_ALLOC (pData, ((mng_unknown_chunkp)pChunkto)->pData, ((mng_unknown_chunkp)pChunkto)->iDatasize); - MNG_COPY (((mng_unknown_chunkp)pChunkto)->pData, ((mng_unknown_chunkp)pChunkfrom)->pData, - ((mng_unknown_chunkp)pChunkto)->iDatasize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ASSIGN_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_chunk_prc.h b/Engine/lib/lmng/libmng_chunk_prc.h deleted file mode 100644 index 0cf0f3c1d..000000000 --- a/Engine/lib/lmng/libmng_chunk_prc.h +++ /dev/null @@ -1,381 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_prc.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk initialization & cleanup (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : definition of the chunk initialization & cleanup routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added NO_DELTA_PNG support * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunk_prc_h_ -#define _libmng_chunk_prc_h_ - -/* ************************************************************************** */ - -void mng_add_chunk (mng_datap pData, - mng_chunkp pChunk); - -/* ************************************************************************** */ - -#define INIT_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pHeader, \ - mng_chunkp* ppChunk) - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -INIT_CHUNK_HDR (mng_init_general) ; -#else -INIT_CHUNK_HDR (mng_init_ihdr) ; -INIT_CHUNK_HDR (mng_init_plte) ; -INIT_CHUNK_HDR (mng_init_idat) ; -INIT_CHUNK_HDR (mng_init_iend) ; -INIT_CHUNK_HDR (mng_init_trns) ; -INIT_CHUNK_HDR (mng_init_gama) ; -INIT_CHUNK_HDR (mng_init_chrm) ; -INIT_CHUNK_HDR (mng_init_srgb) ; -INIT_CHUNK_HDR (mng_init_iccp) ; -INIT_CHUNK_HDR (mng_init_text) ; -INIT_CHUNK_HDR (mng_init_ztxt) ; -INIT_CHUNK_HDR (mng_init_itxt) ; -INIT_CHUNK_HDR (mng_init_bkgd) ; -INIT_CHUNK_HDR (mng_init_phys) ; -INIT_CHUNK_HDR (mng_init_sbit) ; -INIT_CHUNK_HDR (mng_init_splt) ; -INIT_CHUNK_HDR (mng_init_hist) ; -INIT_CHUNK_HDR (mng_init_time) ; -INIT_CHUNK_HDR (mng_init_mhdr) ; -INIT_CHUNK_HDR (mng_init_mend) ; -INIT_CHUNK_HDR (mng_init_loop) ; -INIT_CHUNK_HDR (mng_init_endl) ; -INIT_CHUNK_HDR (mng_init_defi) ; -INIT_CHUNK_HDR (mng_init_basi) ; -INIT_CHUNK_HDR (mng_init_clon) ; -#ifndef MNG_SKIPCHUNK_PAST -INIT_CHUNK_HDR (mng_init_past) ; -#endif -INIT_CHUNK_HDR (mng_init_disc) ; -INIT_CHUNK_HDR (mng_init_back) ; -INIT_CHUNK_HDR (mng_init_fram) ; -INIT_CHUNK_HDR (mng_init_move) ; -INIT_CHUNK_HDR (mng_init_clip) ; -INIT_CHUNK_HDR (mng_init_show) ; -INIT_CHUNK_HDR (mng_init_term) ; -INIT_CHUNK_HDR (mng_init_save) ; -INIT_CHUNK_HDR (mng_init_seek) ; -INIT_CHUNK_HDR (mng_init_expi) ; -INIT_CHUNK_HDR (mng_init_fpri) ; -INIT_CHUNK_HDR (mng_init_need) ; -INIT_CHUNK_HDR (mng_init_phyg) ; -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_jhdr) ; -INIT_CHUNK_HDR (mng_init_jdaa) ; -INIT_CHUNK_HDR (mng_init_jdat) ; -INIT_CHUNK_HDR (mng_init_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -INIT_CHUNK_HDR (mng_init_dhdr) ; -INIT_CHUNK_HDR (mng_init_prom) ; -INIT_CHUNK_HDR (mng_init_ipng) ; -INIT_CHUNK_HDR (mng_init_pplt) ; -#ifdef MNG_INCLUDE_JNG -INIT_CHUNK_HDR (mng_init_ijng) ; -#endif -INIT_CHUNK_HDR (mng_init_drop) ; -INIT_CHUNK_HDR (mng_init_dbyk) ; -INIT_CHUNK_HDR (mng_init_ordr) ; -#endif -INIT_CHUNK_HDR (mng_init_magn) ; -INIT_CHUNK_HDR (mng_init_evnt) ; -INIT_CHUNK_HDR (mng_init_unknown) ; -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - -/* ************************************************************************** */ - -#define FREE_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pHeader) - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE -FREE_CHUNK_HDR (mng_free_general) ; -#else /* MNG_OPTIMIZE_CHUNKINITFREE */ -FREE_CHUNK_HDR (mng_free_ihdr) ; -FREE_CHUNK_HDR (mng_free_plte) ; -FREE_CHUNK_HDR (mng_free_iend) ; -FREE_CHUNK_HDR (mng_free_trns) ; -FREE_CHUNK_HDR (mng_free_gama) ; -FREE_CHUNK_HDR (mng_free_chrm) ; -FREE_CHUNK_HDR (mng_free_srgb) ; -FREE_CHUNK_HDR (mng_free_bkgd) ; -FREE_CHUNK_HDR (mng_free_phys) ; -FREE_CHUNK_HDR (mng_free_sbit) ; -FREE_CHUNK_HDR (mng_free_hist) ; -FREE_CHUNK_HDR (mng_free_time) ; -FREE_CHUNK_HDR (mng_free_mhdr) ; -FREE_CHUNK_HDR (mng_free_mend) ; -FREE_CHUNK_HDR (mng_free_endl) ; -FREE_CHUNK_HDR (mng_free_defi) ; -FREE_CHUNK_HDR (mng_free_basi) ; -FREE_CHUNK_HDR (mng_free_clon) ; -FREE_CHUNK_HDR (mng_free_back) ; -FREE_CHUNK_HDR (mng_free_move) ; -FREE_CHUNK_HDR (mng_free_clip) ; -FREE_CHUNK_HDR (mng_free_show) ; -FREE_CHUNK_HDR (mng_free_term) ; -FREE_CHUNK_HDR (mng_free_fpri) ; -FREE_CHUNK_HDR (mng_free_phyg) ; -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jhdr) ; -FREE_CHUNK_HDR (mng_free_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_dhdr) ; -FREE_CHUNK_HDR (mng_free_prom) ; -FREE_CHUNK_HDR (mng_free_ipng) ; -FREE_CHUNK_HDR (mng_free_pplt) ; -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_ijng) ; -#endif -#endif -FREE_CHUNK_HDR (mng_free_magn) ; -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - -FREE_CHUNK_HDR (mng_free_idat) ; -FREE_CHUNK_HDR (mng_free_iccp) ; -FREE_CHUNK_HDR (mng_free_text) ; -FREE_CHUNK_HDR (mng_free_ztxt) ; -FREE_CHUNK_HDR (mng_free_itxt) ; -FREE_CHUNK_HDR (mng_free_splt) ; -FREE_CHUNK_HDR (mng_free_loop) ; -#ifndef MNG_SKIPCHUNK_PAST -FREE_CHUNK_HDR (mng_free_past) ; -#endif -FREE_CHUNK_HDR (mng_free_disc) ; -FREE_CHUNK_HDR (mng_free_fram) ; -FREE_CHUNK_HDR (mng_free_save) ; -FREE_CHUNK_HDR (mng_free_seek) ; -FREE_CHUNK_HDR (mng_free_expi) ; -FREE_CHUNK_HDR (mng_free_need) ; -#ifdef MNG_INCLUDE_JNG -FREE_CHUNK_HDR (mng_free_jdaa) ; -FREE_CHUNK_HDR (mng_free_jdat) ; -#endif -#ifndef MNG_NO_DELTA_PNG -FREE_CHUNK_HDR (mng_free_drop) ; -FREE_CHUNK_HDR (mng_free_dbyk) ; -FREE_CHUNK_HDR (mng_free_ordr) ; -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -FREE_CHUNK_HDR (mng_free_mpng) ; -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -FREE_CHUNK_HDR (mng_free_adat) ; -#endif -FREE_CHUNK_HDR (mng_free_evnt) ; -FREE_CHUNK_HDR (mng_free_unknown) ; - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -#define ASSIGN_CHUNK_HDR(n) mng_retcode n (mng_datap pData, \ - mng_chunkp pChunkto, \ - mng_chunkp pChunkfrom) - -#ifdef MNG_OPTIMIZE_CHUNKASSIGN -ASSIGN_CHUNK_HDR (mng_assign_general) ; -#else /* MNG_OPTIMIZE_CHUNKASSIGN */ -ASSIGN_CHUNK_HDR (mng_assign_ihdr) ; -ASSIGN_CHUNK_HDR (mng_assign_plte) ; -ASSIGN_CHUNK_HDR (mng_assign_iend) ; -ASSIGN_CHUNK_HDR (mng_assign_trns) ; -ASSIGN_CHUNK_HDR (mng_assign_gama) ; -ASSIGN_CHUNK_HDR (mng_assign_chrm) ; -ASSIGN_CHUNK_HDR (mng_assign_srgb) ; -ASSIGN_CHUNK_HDR (mng_assign_bkgd) ; -ASSIGN_CHUNK_HDR (mng_assign_phys) ; -ASSIGN_CHUNK_HDR (mng_assign_sbit) ; -ASSIGN_CHUNK_HDR (mng_assign_hist) ; -ASSIGN_CHUNK_HDR (mng_assign_time) ; -ASSIGN_CHUNK_HDR (mng_assign_mhdr) ; -ASSIGN_CHUNK_HDR (mng_assign_mend) ; -ASSIGN_CHUNK_HDR (mng_assign_endl) ; -ASSIGN_CHUNK_HDR (mng_assign_defi) ; -ASSIGN_CHUNK_HDR (mng_assign_basi) ; -ASSIGN_CHUNK_HDR (mng_assign_clon) ; -ASSIGN_CHUNK_HDR (mng_assign_back) ; -ASSIGN_CHUNK_HDR (mng_assign_move) ; -ASSIGN_CHUNK_HDR (mng_assign_clip) ; -ASSIGN_CHUNK_HDR (mng_assign_show) ; -ASSIGN_CHUNK_HDR (mng_assign_term) ; -ASSIGN_CHUNK_HDR (mng_assign_fpri) ; -ASSIGN_CHUNK_HDR (mng_assign_phyg) ; -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jhdr) ; -ASSIGN_CHUNK_HDR (mng_assign_jsep) ; -#endif -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_dhdr) ; -ASSIGN_CHUNK_HDR (mng_assign_prom) ; -ASSIGN_CHUNK_HDR (mng_assign_ipng) ; -ASSIGN_CHUNK_HDR (mng_assign_pplt) ; -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_ijng) ; -#endif -#endif -ASSIGN_CHUNK_HDR (mng_assign_magn) ; -#endif /* MNG_OPTIMIZE_CHUNKASSIGN */ - -ASSIGN_CHUNK_HDR (mng_assign_idat) ; -ASSIGN_CHUNK_HDR (mng_assign_iccp) ; -ASSIGN_CHUNK_HDR (mng_assign_text) ; -ASSIGN_CHUNK_HDR (mng_assign_ztxt) ; -ASSIGN_CHUNK_HDR (mng_assign_itxt) ; -ASSIGN_CHUNK_HDR (mng_assign_splt) ; -ASSIGN_CHUNK_HDR (mng_assign_loop) ; -#ifndef MNG_SKIPCHUNK_PAST -ASSIGN_CHUNK_HDR (mng_assign_past) ; -#endif -ASSIGN_CHUNK_HDR (mng_assign_disc) ; -ASSIGN_CHUNK_HDR (mng_assign_fram) ; -ASSIGN_CHUNK_HDR (mng_assign_save) ; -ASSIGN_CHUNK_HDR (mng_assign_seek) ; -ASSIGN_CHUNK_HDR (mng_assign_need) ; -ASSIGN_CHUNK_HDR (mng_assign_expi) ; -#ifdef MNG_INCLUDE_JNG -ASSIGN_CHUNK_HDR (mng_assign_jdaa) ; -ASSIGN_CHUNK_HDR (mng_assign_jdat) ; -#endif -#ifndef MNG_NO_DELTA_PNG -ASSIGN_CHUNK_HDR (mng_assign_drop) ; -ASSIGN_CHUNK_HDR (mng_assign_dbyk) ; -ASSIGN_CHUNK_HDR (mng_assign_ordr) ; -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_mpng) ; -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL -ASSIGN_CHUNK_HDR (mng_assign_ahdr) ; -ASSIGN_CHUNK_HDR (mng_assign_adat) ; -#endif -ASSIGN_CHUNK_HDR (mng_assign_evnt) ; -ASSIGN_CHUNK_HDR (mng_assign_unknown) ; - -/* ************************************************************************** */ - -#else /* MNG_INCLUDE_WRITE_PROCS */ -#define mng_assign_general 0 -#define mng_assign_ihdr 0 -#define mng_assign_plte 0 -#define mng_assign_idat 0 -#define mng_assign_iend 0 -#define mng_assign_trns 0 -#define mng_assign_gama 0 -#define mng_assign_chrm 0 -#define mng_assign_srgb 0 -#define mng_assign_iccp 0 -#define mng_assign_text 0 -#define mng_assign_ztxt 0 -#define mng_assign_itxt 0 -#define mng_assign_bkgd 0 -#define mng_assign_phys 0 -#define mng_assign_sbit 0 -#define mng_assign_splt 0 -#define mng_assign_hist 0 -#define mng_assign_time 0 -#define mng_assign_mhdr 0 -#define mng_assign_mend 0 -#define mng_assign_loop 0 -#define mng_assign_endl 0 -#define mng_assign_defi 0 -#define mng_assign_basi 0 -#define mng_assign_clon 0 -#ifndef MNG_SKIPCHUNK_PAST -#define mng_assign_past 0 -#endif -#define mng_assign_disc 0 -#define mng_assign_back 0 -#define mng_assign_fram 0 -#define mng_assign_move 0 -#define mng_assign_clip 0 -#define mng_assign_show 0 -#define mng_assign_term 0 -#define mng_assign_save 0 -#define mng_assign_seek 0 -#define mng_assign_expi 0 -#define mng_assign_fpri 0 -#define mng_assign_phyg 0 -#ifdef MNG_INCLUDE_JNG -#define mng_assign_jhdr 0 -#define mng_assign_jdaa 0 -#define mng_assign_jdat 0 -#define mng_assign_jsep 0 -#endif -#ifndef MNG_NO_DELTA_PNG -#define mng_assign_dhdr 0 -#define mng_assign_prom 0 -#define mng_assign_ipng 0 -#define mng_assign_pplt 0 -#ifdef MNG_INCLUDE_JNG -#define mng_assign_ijng 0 -#endif -#define mng_assign_drop 0 -#define mng_assign_dbyk 0 -#define mng_assign_ordr 0 -#endif -#define mng_assign_magn 0 -#define mng_assign_need 0 -#define mng_assign_mpng 0 -#define mng_assign_ahdr 0 -#define mng_assign_adat 0 -#define mng_assign_evnt 0 -#define mng_assign_unknown 0 -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_chunk_prc_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_chunk_xs.c b/Engine/lib/lmng/libmng_chunk_xs.c deleted file mode 100644 index 13114090d..000000000 --- a/Engine/lib/lmng/libmng_chunk_xs.c +++ /dev/null @@ -1,7016 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunk_xs.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : chunk access functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the chunk access functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - changed and filled iterate-chunk function * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - fixed calling convention * */ -/* * - added getchunk functions * */ -/* * - added putchunk functions * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added empty-chunk put-routines * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/15/2000 - G.Juyn * */ -/* * - added getimgdata & putimgdata functions * */ -/* * * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - B004 - fixed problem with MNG_SUPPORT_WRITE not defined * */ -/* * also for MNG_SUPPORT_WRITE without MNG_INCLUDE_JNG * */ -/* * - Cleaned up some code regarding mixed support * */ -/* * * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed creation-code * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added function to set simplicity field * */ -/* * - fixed putchunk_unknown() function * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - fixed putchunk_plte() to set bEmpty parameter * */ -/* * * */ -/* * 0.9.5 - 01/25/2001 - G.Juyn * */ -/* * - fixed some small compiler warnings (thanks Nikki) * */ -/* * * */ -/* * 1.0.5 - 09/07/2002 - G.Juyn * */ -/* * - B578940 - unimplemented functions return errorcode * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added check for TERM placement during create/write * */ -/* * 1.0.5 - 11/28/2002 - G.Juyn * */ -/* * - fixed definition of iMethodX/Y for MAGN chunk * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_NO_DELTA_PNG reduction and more SKIPCHUNK * */ -/* * optimizations * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.8 - 04/01/2004 - G.Juyn * */ -/* * - added missing get-/put-chunk-jdaa * */ -/* * 1.0.8 - 08/02/2004 - G.Juyn * */ -/* * - added conditional to allow easier writing of large MNG's * */ -/* * * */ -/* * 1.0.9 - 09/17/2004 - G.R-P * */ -/* * - added two more conditionals * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 17/14/2004 - G.Juyn * */ -/* * - fixed PPLT getchunk/putchunk routines * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#ifdef MNG_OPTIMIZE_CHUNKREADER -#include "libmng_chunk_descr.h" -#endif -#include "libmng_chunk_prc.h" -#include "libmng_chunk_io.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_ACCESS_CHUNKS - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_iterate_chunks (mng_handle hHandle, - mng_uint32 iChunkseq, - mng_iteratechunk fProc) -{ - mng_uint32 iSeq; - mng_chunkid iChunkname; - mng_datap pData; - mng_chunkp pChunk; - mng_bool bCont; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - iSeq = 0; - bCont = MNG_TRUE; - pChunk = pData->pFirstchunk; /* get the first chunk */ - /* as long as there are some more */ - while ((pChunk) && (bCont)) /* and the app didn't signal a stop */ - { - if (iSeq >= iChunkseq) /* reached the first target ? */ - { /* then call this and next ones back in... */ - iChunkname = ((mng_chunk_headerp)pChunk)->iChunkname; - bCont = fProc (hHandle, (mng_handle)pChunk, iChunkname, iSeq); - } - - iSeq++; /* next one */ - pChunk = ((mng_chunk_headerp)pChunk)->pNext; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_ITERATE_CHUNKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_copy_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_handle hHandleOut) -{ - mng_datap pDataOut; - mng_chunkp pChunk; - mng_chunkp pChunkOut; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handles */ - MNG_VALIDHANDLE (hHandleOut) - - pDataOut = (mng_datap)hHandleOut; /* make outhandle addressable */ - pChunk = (mng_chunkp)hChunk; /* address the chunk */ - - if (!pDataOut->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pDataOut, MNG_FUNCTIONINVALID) - /* create a new chunk */ - iRetcode = ((mng_createchunk)((mng_chunk_headerp)pChunk)->fCreate) - (pDataOut, ((mng_chunk_headerp)pChunk), &pChunkOut); - if (!iRetcode) /* assign the chunk-specific data */ - iRetcode = ((mng_assignchunk)((mng_chunk_headerp)pChunk)->fAssign) - (pDataOut, pChunkOut, pChunk); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pDataOut, pChunkOut); /* and put it in the output-stream */ - - /* could it be the end of the chain ? */ - if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_IEND) - { -#ifdef MNG_INCLUDE_JNG - if ((pDataOut->iFirstchunkadded == MNG_UINT_IHDR) || - (pDataOut->iFirstchunkadded == MNG_UINT_JHDR) ) -#else - if (pDataOut->iFirstchunkadded == MNG_UINT_IHDR) -#endif - pDataOut->bCreating = MNG_FALSE; /* right; this should be the last chunk !!! */ - } - - if (((mng_chunk_headerp)pChunkOut)->iChunkname == MNG_UINT_MEND) - pDataOut->bCreating = MNG_FALSE; /* definitely this should be the last !!! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_COPY_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_ihdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace) -{ - mng_datap pData; - mng_ihdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ihdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iBitdepth = pChunk->iBitdepth; - *iColortype = pChunk->iColortype; - *iCompression = pChunk->iCompression; - *iFilter = pChunk->iFilter; - *iInterlace = pChunk->iInterlace; - - /* fill the chunk */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_plte (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_palette8 *aPalette) -{ - mng_datap pData; - mng_pltep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_pltep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PLTE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iEntrycount; /* fill the fields */ - - MNG_COPY (*aPalette, pChunk->aEntries, sizeof (mng_palette8)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_idat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_idatp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_idatp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_IDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRawlen = pChunk->iDatasize; /* fill the fields */ - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_trns (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_bool *bGlobal, - mng_uint8 *iType, - mng_uint32 *iCount, - mng_uint8arr *aAlphas, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint32 *iRawlen, - mng_uint8arr *aRawdata) -{ - mng_datap pData; - mng_trnsp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_trnsp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_tRNS) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *bGlobal = pChunk->bGlobal; - *iType = pChunk->iType; - *iCount = pChunk->iCount; - *iGray = pChunk->iGray; - *iRed = pChunk->iRed; - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - *iRawlen = pChunk->iRawlen; - - MNG_COPY (*aAlphas, pChunk->aEntries, sizeof (mng_uint8arr)); - MNG_COPY (*aRawdata, pChunk->aRawdata, sizeof (mng_uint8arr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -mng_retcode MNG_DECL mng_getchunk_gama (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iGamma) -{ - mng_datap pData; - mng_gamap pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_gamap)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_gAMA) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iGamma = pChunk->iGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode MNG_DECL mng_getchunk_chrm (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iWhitepointx, - mng_uint32 *iWhitepointy, - mng_uint32 *iRedx, - mng_uint32 *iRedy, - mng_uint32 *iGreenx, - mng_uint32 *iGreeny, - mng_uint32 *iBluex, - mng_uint32 *iBluey) -{ - mng_datap pData; - mng_chrmp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_chrmp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_cHRM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iWhitepointx = pChunk->iWhitepointx; - *iWhitepointy = pChunk->iWhitepointy; - *iRedx = pChunk->iRedx; - *iRedy = pChunk->iRedy; - *iGreenx = pChunk->iGreenx; - *iGreeny = pChunk->iGreeny; - *iBluex = pChunk->iBluex; - *iBluey = pChunk->iBluey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode MNG_DECL mng_getchunk_srgb (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iRenderingintent) -{ - mng_datap pData; - mng_srgbp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_srgbp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_sRGB) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iRenderingintent = pChunk->iRenderingintent; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_getchunk_iccp (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iCompression, - mng_uint32 *iProfilesize, - mng_ptr *pProfile) -{ - mng_datap pData; - mng_iccpp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_iccpp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_iCCP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - *iCompression = pChunk->iCompression; - *iProfilesize = pChunk->iProfilesize; - *pProfile = pChunk->pProfile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -mng_retcode MNG_DECL mng_getchunk_text (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint32 *iTextsize, - mng_pchar *zText) -{ - mng_datap pData; - mng_textp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_textp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_tEXt) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordsize = pChunk->iKeywordsize; - *zKeyword = pChunk->zKeyword; - *iTextsize = pChunk->iTextsize; - *zText = pChunk->zText; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -mng_retcode MNG_DECL mng_getchunk_ztxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompression, - mng_uint32 *iTextsize, - mng_pchar *zText) -{ - mng_datap pData; - mng_ztxtp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ztxtp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_zTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordsize = pChunk->iKeywordsize; - *zKeyword = pChunk->zKeyword; - *iCompression = pChunk->iCompression; - *iTextsize = pChunk->iTextsize; - *zText = pChunk->zText; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -mng_retcode MNG_DECL mng_getchunk_itxt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordsize, - mng_pchar *zKeyword, - mng_uint8 *iCompressionflag, - mng_uint8 *iCompressionmethod, - mng_uint32 *iLanguagesize, - mng_pchar *zLanguage, - mng_uint32 *iTranslationsize, - mng_pchar *zTranslation, - mng_uint32 *iTextsize, - mng_pchar *zText) -{ - mng_datap pData; - mng_itxtp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_itxtp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_iTXt) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordsize = pChunk->iKeywordsize; - *zKeyword = pChunk->zKeyword; - *iCompressionflag = pChunk->iCompressionflag; - *iCompressionmethod = pChunk->iCompressionmethod; - *iLanguagesize = pChunk->iLanguagesize; - *zLanguage = pChunk->zLanguage; - *iTranslationsize = pChunk->iTranslationsize; - *zTranslation = pChunk->zTranslation; - *iTextsize = pChunk->iTextsize; - *zText = pChunk->zText; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode MNG_DECL mng_getchunk_bkgd (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8 *iIndex, - mng_uint16 *iGray, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue) -{ - mng_datap pData; - mng_bkgdp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_bkgdp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_bKGD) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iType = pChunk->iType; - *iIndex = pChunk->iIndex; - *iGray = pChunk->iGray; - *iRed = pChunk->iRed; - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -mng_retcode MNG_DECL mng_getchunk_phys (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit) -{ - mng_datap pData; - mng_physp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_physp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_pHYs) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iSizex = pChunk->iSizex; - *iSizey = pChunk->iSizey; - *iUnit = pChunk->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -mng_retcode MNG_DECL mng_getchunk_sbit (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iType, - mng_uint8arr4 *aBits) -{ - mng_datap pData; - mng_sbitp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_sbitp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_sBIT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; - *iType = pChunk->iType; - (*aBits)[0] = pChunk->aBits[0]; - (*aBits)[1] = pChunk->aBits[1]; - (*aBits)[2] = pChunk->aBits[2]; - (*aBits)[3] = pChunk->aBits[3]; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -mng_retcode MNG_DECL mng_getchunk_splt (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iSampledepth, - mng_uint32 *iEntrycount, - mng_ptr *pEntries) -{ - mng_datap pData; - mng_spltp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_spltp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_sPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - *iSampledepth = pChunk->iSampledepth; - *iEntrycount = pChunk->iEntrycount; - *pEntries = pChunk->pEntries; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -mng_retcode MNG_DECL mng_getchunk_hist (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iEntrycount, - mng_uint16arr *aEntries) -{ - mng_datap pData; - mng_histp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_histp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_hIST) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iEntrycount = pChunk->iEntrycount; /* fill the fields */ - - MNG_COPY (*aEntries, pChunk->aEntries, sizeof (mng_uint16arr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -mng_retcode MNG_DECL mng_getchunk_time (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iYear, - mng_uint8 *iMonth, - mng_uint8 *iDay, - mng_uint8 *iHour, - mng_uint8 *iMinute, - mng_uint8 *iSecond) -{ - mng_datap pData; - mng_timep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_timep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_tIME) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iYear = pChunk->iYear; /* fill the fields */ - *iMonth = pChunk->iMonth; - *iDay = pChunk->iDay; - *iHour = pChunk->iHour; - *iMinute = pChunk->iMinute; - *iSecond = pChunk->iSecond; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_mhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint32 *iTicks, - mng_uint32 *iLayercount, - mng_uint32 *iFramecount, - mng_uint32 *iPlaytime, - mng_uint32 *iSimplicity) -{ - mng_datap pData; - mng_mhdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_mhdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iTicks = pChunk->iTicks; - *iLayercount = pChunk->iLayercount; - *iFramecount = pChunk->iFramecount; - *iPlaytime = pChunk->iPlaytime; - *iSimplicity = pChunk->iSimplicity; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode MNG_DECL mng_getchunk_loop (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel, - mng_uint32 *iRepeat, - mng_uint8 *iTermination, - mng_uint32 *iItermin, - mng_uint32 *iItermax, - mng_uint32 *iCount, - mng_uint32p *pSignals) -{ - mng_datap pData; - mng_loopp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_loopp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_LOOP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iLevel = pChunk->iLevel; /* fill teh fields */ - *iRepeat = pChunk->iRepeat; - *iTermination = pChunk->iTermination; - *iItermin = pChunk->iItermin; - *iItermax = pChunk->iItermax; - *iCount = pChunk->iCount; - *pSignals = pChunk->pSignals; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_endl (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iLevel) -{ - mng_datap pData; - mng_endlp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_endlp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_ENDL) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iLevel = pChunk->iLevel; /* fill the field */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode MNG_DECL mng_getchunk_defi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_int32 *iXlocation, - mng_int32 *iYlocation, - mng_bool *bHasclip, - mng_int32 *iLeftcb, - mng_int32 *iRightcb, - mng_int32 *iTopcb, - mng_int32 *iBottomcb) -{ - mng_datap pData; - mng_defip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_defip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DEFI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iObjectid = pChunk->iObjectid; /* fill the fields */ - *iDonotshow = pChunk->iDonotshow; - *iConcrete = pChunk->iConcrete; - *bHasloca = pChunk->bHasloca; - *iXlocation = pChunk->iXlocation; - *iYlocation = pChunk->iYlocation; - *bHasclip = pChunk->bHasclip; - *iLeftcb = pChunk->iLeftcb; - *iRightcb = pChunk->iRightcb; - *iTopcb = pChunk->iTopcb; - *iBottomcb = pChunk->iBottomcb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode MNG_DECL mng_getchunk_basi (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iBitdepth, - mng_uint8 *iColortype, - mng_uint8 *iCompression, - mng_uint8 *iFilter, - mng_uint8 *iInterlace, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_uint8 *iViewable) -{ - mng_datap pData; - mng_basip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_basip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_BASI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iBitdepth = pChunk->iBitdepth; - *iColortype = pChunk->iColortype; - *iCompression = pChunk->iCompression; - *iFilter = pChunk->iFilter; - *iInterlace = pChunk->iInterlace; - *iRed = pChunk->iRed; - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - *iAlpha = pChunk->iAlpha; - *iViewable = pChunk->iViewable; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode MNG_DECL mng_getchunk_clon (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSourceid, - mng_uint16 *iCloneid, - mng_uint8 *iClonetype, - mng_uint8 *iDonotshow, - mng_uint8 *iConcrete, - mng_bool *bHasloca, - mng_uint8 *iLocationtype, - mng_int32 *iLocationx, - mng_int32 *iLocationy) -{ - mng_datap pData; - mng_clonp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_clonp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_CLON) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iSourceid = pChunk->iSourceid; /* fill the fields */ - *iCloneid = pChunk->iCloneid; - *iClonetype = pChunk->iClonetype; - *iDonotshow = pChunk->iDonotshow; - *iConcrete = pChunk->iConcrete; - *bHasloca = pChunk->bHasloca; - *iLocationtype = pChunk->iLocationtype; - *iLocationx = pChunk->iLocationx; - *iLocationy = pChunk->iLocationy; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_getchunk_past (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iDestid, - mng_uint8 *iTargettype, - mng_int32 *iTargetx, - mng_int32 *iTargety, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_pastp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_pastp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iDestid = pChunk->iDestid; /* fill the fields */ - *iTargettype = pChunk->iTargettype; - *iTargetx = pChunk->iTargetx; - *iTargety = pChunk->iTargety; - *iCount = pChunk->iCount; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_getchunk_past_src (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iSourceid, - mng_uint8 *iComposition, - mng_uint8 *iOrientation, - mng_uint8 *iOffsettype, - mng_int32 *iOffsetx, - mng_int32 *iOffsety, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb) -{ - mng_datap pData; - mng_pastp pChunk; - mng_past_sourcep pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_pastp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address the entry */ - pEntry = pChunk->pSources + iEntry; - - *iSourceid = pEntry->iSourceid; /* fill the fields */ - *iComposition = pEntry->iComposition; - *iOrientation = pEntry->iOrientation; - *iOffsettype = pEntry->iOffsettype; - *iOffsetx = pEntry->iOffsetx; - *iOffsety = pEntry->iOffsety; - *iBoundarytype = pEntry->iBoundarytype; - *iBoundaryl = pEntry->iBoundaryl; - *iBoundaryr = pEntry->iBoundaryr; - *iBoundaryt = pEntry->iBoundaryt; - *iBoundaryb = pEntry->iBoundaryb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PAST_SRC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode MNG_DECL mng_getchunk_disc (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_uint16p *pObjectids) -{ - mng_datap pData; - mng_discp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_discp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DISC) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the fields */ - *pObjectids = pChunk->pObjectids; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -mng_retcode MNG_DECL mng_getchunk_back (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint8 *iMandatory, - mng_uint16 *iImageid, - mng_uint8 *iTile) -{ - mng_datap pData; - mng_backp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_backp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_BACK) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRed = pChunk->iRed; /* fill the fields */ - *iGreen = pChunk->iGreen; - *iBlue = pChunk->iBlue; - *iMandatory = pChunk->iMandatory; - *iImageid = pChunk->iImageid; - *iTile = pChunk->iTile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode MNG_DECL mng_getchunk_fram (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iMode, - mng_uint32 *iNamesize, - mng_pchar *zName, - mng_uint8 *iChangedelay, - mng_uint8 *iChangetimeout, - mng_uint8 *iChangeclipping, - mng_uint8 *iChangesyncid, - mng_uint32 *iDelay, - mng_uint32 *iTimeout, - mng_uint8 *iBoundarytype, - mng_int32 *iBoundaryl, - mng_int32 *iBoundaryr, - mng_int32 *iBoundaryt, - mng_int32 *iBoundaryb, - mng_uint32 *iCount, - mng_uint32p *pSyncids) -{ - mng_datap pData; - mng_framp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_framp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_FRAM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iMode = pChunk->iMode; - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - *iChangedelay = pChunk->iChangedelay; - *iChangetimeout = pChunk->iChangetimeout; - *iChangeclipping = pChunk->iChangeclipping; - *iChangesyncid = pChunk->iChangesyncid; - *iDelay = pChunk->iDelay; - *iTimeout = pChunk->iTimeout; - *iBoundarytype = pChunk->iBoundarytype; - *iBoundaryl = pChunk->iBoundaryl; - *iBoundaryr = pChunk->iBoundaryr; - *iBoundaryt = pChunk->iBoundaryt; - *iBoundaryb = pChunk->iBoundaryb; - *iCount = pChunk->iCount; - *pSyncids = pChunk->pSyncids; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode MNG_DECL mng_getchunk_move (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMovetype, - mng_int32 *iMovex, - mng_int32 *iMovey) -{ - mng_datap pData; - mng_movep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_movep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_MOVE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iFirstid = pChunk->iFirstid; /* fill the fields */ - *iLastid = pChunk->iLastid; - *iMovetype = pChunk->iMovetype; - *iMovex = pChunk->iMovex; - *iMovey = pChunk->iMovey; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode MNG_DECL mng_getchunk_clip (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iCliptype, - mng_int32 *iClipl, - mng_int32 *iClipr, - mng_int32 *iClipt, - mng_int32 *iClipb) -{ - mng_datap pData; - mng_clipp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_clipp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_CLIP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iFirstid = pChunk->iFirstid; /* fill the fields */ - *iLastid = pChunk->iLastid; - *iCliptype = pChunk->iCliptype; - *iClipl = pChunk->iClipl; - *iClipr = pChunk->iClipr; - *iClipt = pChunk->iClipt; - *iClipb = pChunk->iClipb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode MNG_DECL mng_getchunk_show (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint8 *iMode) -{ - mng_datap pData; - mng_showp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_showp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SHOW) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iFirstid = pChunk->iFirstid; - *iLastid = pChunk->iLastid; - *iMode = pChunk->iMode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -mng_retcode MNG_DECL mng_getchunk_term (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iTermaction, - mng_uint8 *iIteraction, - mng_uint32 *iDelay, - mng_uint32 *iItermax) -{ - mng_datap pData; - mng_termp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_termp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_TERM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iTermaction = pChunk->iTermaction; /* fill the fields */ - *iIteraction = pChunk->iIteraction; - *iDelay = pChunk->iDelay; - *iItermax = pChunk->iItermax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode MNG_DECL mng_getchunk_save (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint8 *iOffsettype, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_savep pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_savep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iOffsettype = pChunk->iOffsettype; - *iCount = pChunk->iCount; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_save_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEntrytype, - mng_uint32arr2 *iOffset, - mng_uint32arr2 *iStarttime, - mng_uint32 *iLayernr, - mng_uint32 *iFramenr, - mng_uint32 *iNamesize, - mng_pchar *zName) -{ - mng_datap pData; - mng_savep pChunk; - mng_save_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_savep)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = pChunk->pEntries + iEntry; /* address the entry */ - /* fill the fields */ - *iEntrytype = pEntry->iEntrytype; - (*iOffset)[0] = pEntry->iOffset[0]; - (*iOffset)[1] = pEntry->iOffset[1]; - (*iStarttime)[0] = pEntry->iStarttime[0]; - (*iStarttime)[1] = pEntry->iStarttime[1]; - *iLayernr = pEntry->iLayernr; - *iFramenr = pEntry->iFramenr; - *iNamesize = pEntry->iNamesize; - *zName = pEntry->zName; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SAVE_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode MNG_DECL mng_getchunk_seek (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iNamesize, - mng_pchar *zName) -{ - mng_datap pData; - mng_seekp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_seekp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_SEEK) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iNamesize = pChunk->iNamesize; /* fill the fields */ - *zName = pChunk->zName; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -mng_retcode MNG_DECL mng_getchunk_expi (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iSnapshotid, - mng_uint32 *iNamesize, - mng_pchar *zName) -{ - mng_datap pData; - mng_expip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_expip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_eXPI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iSnapshotid = pChunk->iSnapshotid; /* fill the fields */ - *iNamesize = pChunk->iNamesize; - *zName = pChunk->zName; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -mng_retcode MNG_DECL mng_getchunk_fpri (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint8 *iPriority) -{ - mng_datap pData; - mng_fprip pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_fprip)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_fPRI) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iDeltatype = pChunk->iDeltatype; /* fill the fields */ - *iPriority = pChunk->iPriority; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -mng_retcode MNG_DECL mng_getchunk_need (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords) -{ - mng_datap pData; - mng_needp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_needp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_nEED) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iKeywordssize = pChunk->iKeywordssize; - *zKeywords = pChunk->zKeywords; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -mng_retcode MNG_DECL mng_getchunk_phyg (mng_handle hHandle, - mng_handle hChunk, - mng_bool *bEmpty, - mng_uint32 *iSizex, - mng_uint32 *iSizey, - mng_uint8 *iUnit) -{ - mng_datap pData; - mng_phygp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_phygp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_pHYg) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *bEmpty = pChunk->bEmpty; /* fill the fields */ - *iSizex = pChunk->iSizex; - *iSizey = pChunk->iSizey; - *iUnit = pChunk->iUnit; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_getchunk_jhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_uint8 *iColortype, - mng_uint8 *iImagesampledepth, - mng_uint8 *iImagecompression, - mng_uint8 *iImageinterlace, - mng_uint8 *iAlphasampledepth, - mng_uint8 *iAlphacompression, - mng_uint8 *iAlphafilter, - mng_uint8 *iAlphainterlace) -{ - mng_datap pData; - mng_jhdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_jhdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_JHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iWidth = pChunk->iWidth; /* fill the fields */ - *iHeight = pChunk->iHeight; - *iColortype = pChunk->iColortype; - *iImagesampledepth = pChunk->iImagesampledepth; - *iImagecompression = pChunk->iImagecompression; - *iImageinterlace = pChunk->iImageinterlace; - *iAlphasampledepth = pChunk->iAlphasampledepth; - *iAlphacompression = pChunk->iAlphacompression; - *iAlphafilter = pChunk->iAlphafilter; - *iAlphainterlace = pChunk->iAlphainterlace; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_getchunk_jdat (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_jdatp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_jdatp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_JDAT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRawlen = pChunk->iDatasize; /* fill the fields */ - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_getchunk_jdaa (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_jdaap pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_jdaap)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_JDAA) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iRawlen = pChunk->iDatasize; /* fill the fields */ - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_dhdr (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iObjectid, - mng_uint8 *iImagetype, - mng_uint8 *iDeltatype, - mng_uint32 *iBlockwidth, - mng_uint32 *iBlockheight, - mng_uint32 *iBlockx, - mng_uint32 *iBlocky) -{ - mng_datap pData; - mng_dhdrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_dhdrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DHDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iObjectid = pChunk->iObjectid; /* fill the fields */ - *iImagetype = pChunk->iImagetype; - *iDeltatype = pChunk->iDeltatype; - *iBlockwidth = pChunk->iBlockwidth; - *iBlockheight = pChunk->iBlockheight; - *iBlockx = pChunk->iBlockx; - *iBlocky = pChunk->iBlocky; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_prom (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iColortype, - mng_uint8 *iSampledepth, - mng_uint8 *iFilltype) -{ - mng_datap pData; - mng_promp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_promp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PROM) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iColortype = pChunk->iColortype; /* fill the fields */ - *iSampledepth = pChunk->iSampledepth; - *iFilltype = pChunk->iFilltype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_pplt (mng_handle hHandle, - mng_handle hChunk, - mng_uint8 *iDeltatype, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_ppltp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ppltp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iDeltatype = pChunk->iDeltatype; /* fill the fields */ - *iCount = pChunk->iCount; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_pplt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint16 *iRed, - mng_uint16 *iGreen, - mng_uint16 *iBlue, - mng_uint16 *iAlpha, - mng_bool *bUsed) -{ - mng_datap pData; - mng_ppltp pChunk; - mng_pplt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ppltp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = &pChunk->aEntries[iEntry]; /* address the entry */ - - *iRed = pEntry->iRed; /* fill the fields */ - *iGreen = pEntry->iGreen; - *iBlue = pEntry->iBlue; - *iAlpha = pEntry->iAlpha; - *bUsed = pEntry->bUsed; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_PPLT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_getchunk_drop (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount, - mng_chunkidp *pChunknames) -{ - mng_datap pData; - mng_dropp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_dropp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DROP) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the fields */ - *pChunknames = pChunk->pChunknames; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -mng_retcode MNG_DECL mng_getchunk_dbyk (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint8 *iPolarity, - mng_uint32 *iKeywordssize, - mng_pchar *zKeywords) -{ - mng_datap pData; - mng_dbykp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_dbykp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_DBYK) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iChunkname = pChunk->iChunkname; /* fill the fields */ - *iPolarity = pChunk->iPolarity; - *iKeywordssize = pChunk->iKeywordssize; - *zKeywords = pChunk->zKeywords; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_getchunk_ordr (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_ordrp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ordrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the field */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_getchunk_ordr_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_chunkid *iChunkname, - mng_uint8 *iOrdertype) -{ - mng_datap pData; - mng_ordrp pChunk; - mng_ordr_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_ordrp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = pChunk->pEntries + iEntry; /* address the proper entry */ - - *iChunkname = pEntry->iChunkname; /* fill the fields */ - *iOrdertype = pEntry->iOrdertype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_ORDR_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode MNG_DECL mng_getchunk_magn (mng_handle hHandle, - mng_handle hChunk, - mng_uint16 *iFirstid, - mng_uint16 *iLastid, - mng_uint16 *iMethodX, - mng_uint16 *iMX, - mng_uint16 *iMY, - mng_uint16 *iML, - mng_uint16 *iMR, - mng_uint16 *iMT, - mng_uint16 *iMB, - mng_uint16 *iMethodY) -{ - mng_datap pData; - mng_magnp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_magnp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_MAGN) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iFirstid = pChunk->iFirstid; /* fill the fields */ - *iLastid = pChunk->iLastid; - *iMethodX = (mng_uint16)pChunk->iMethodX; - *iMX = pChunk->iMX; - *iMY = pChunk->iMY; - *iML = pChunk->iML; - *iMR = pChunk->iMR; - *iMT = pChunk->iMT; - *iMB = pChunk->iMB; - *iMethodY = (mng_uint16)pChunk->iMethodY; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iFramewidth, - mng_uint32 *iFrameheight, - mng_uint16 *iNumplays, - mng_uint16 *iTickspersec, - mng_uint8 *iCompressionmethod, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_mpngp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_mpngp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iFramewidth = pChunk->iFramewidth; - *iFrameheight = pChunk->iFrameheight; - *iNumplays = pChunk->iNumplays; - *iTickspersec = pChunk->iTickspersec; - *iCompressionmethod = pChunk->iCompressionmethod; - *iCount = pChunk->iFramessize / sizeof (mng_mpng_frame); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_getchunk_mpng_frame (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint32 *iX, - mng_uint32 *iY, - mng_uint32 *iWidth, - mng_uint32 *iHeight, - mng_int32 *iXoffset, - mng_int32 *iYoffset, - mng_uint16 *iTicks) -{ - mng_datap pData; - mng_mpngp pChunk; - mng_mpng_framep pFrame; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_mpngp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* valid index ? */ - if (iEntry >= (pChunk->iFramessize / sizeof (mng_mpng_frame))) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pFrame = pChunk->pFrames + iEntry; /* address the entry */ - /* fill the fields */ - *iX = pFrame->iX; - *iY = pFrame->iY; - *iWidth = pFrame->iWidth; - *iHeight = pFrame->iHeight; - *iXoffset = pFrame->iXoffset; - *iYoffset = pFrame->iYoffset; - *iTicks = pFrame->iTicks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_MPNG_FRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -mng_retcode MNG_DECL mng_getchunk_evnt (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 *iCount) -{ - mng_datap pData; - mng_evntp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_evntp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - *iCount = pChunk->iCount; /* fill the fields */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_evnt_entry (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iEntry, - mng_uint8 *iEventtype, - mng_uint8 *iMasktype, - mng_int32 *iLeft, - mng_int32 *iRight, - mng_int32 *iTop, - mng_int32 *iBottom, - mng_uint16 *iObjectid, - mng_uint8 *iIndex, - mng_uint32 *iSegmentnamesize, - mng_pchar *zSegmentname) -{ - mng_datap pData; - mng_evntp pChunk; - mng_evnt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_evntp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - - if (iEntry >= pChunk->iCount) /* valid index ? */ - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - - pEntry = pChunk->pEntries + iEntry; /* address the entry */ - /* fill the fields */ - *iEventtype = pEntry->iEventtype; - *iMasktype = pEntry->iMasktype; - *iLeft = pEntry->iLeft; - *iRight = pEntry->iRight; - *iTop = pEntry->iTop; - *iBottom = pEntry->iBottom; - *iObjectid = pEntry->iObjectid; - *iIndex = pEntry->iIndex; - *iSegmentnamesize = pEntry->iSegmentnamesize; - *zSegmentname = pEntry->zSegmentname; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_EVNT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getchunk_unknown (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid *iChunkname, - mng_uint32 *iRawlen, - mng_ptr *pRawdata) -{ - mng_datap pData; - mng_unknown_chunkp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - pChunk = (mng_unknown_chunkp)hChunk; /* address the chunk */ - - if (pChunk->sHeader.fCleanup != mng_free_unknown) - MNG_ERROR (pData, MNG_WRONGCHUNK) /* ouch */ - /* fill the fields */ - *iChunkname = pChunk->sHeader.iChunkname; - *iRawlen = pChunk->iDatasize; - *pRawdata = pChunk->pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETCHUNK_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -MNG_LOCAL mng_bool check_term (mng_datap pData, - mng_chunkid iChunkname) -{ - mng_chunk_headerp pChunk = (mng_chunk_headerp)pData->pLastchunk; - - if (!pChunk) /* nothing added yet ? */ - return MNG_TRUE; - /* last added chunk is TERM ? */ - if (pChunk->iChunkname != MNG_UINT_TERM) - return MNG_TRUE; - /* previous to last is MHDR ? */ - if ((pChunk->pPrev) && (((mng_chunk_headerp)pChunk->pPrev)->iChunkname == MNG_UINT_MHDR)) - return MNG_TRUE; - - if (iChunkname == MNG_UINT_SEEK) /* new chunk to be added is SEEK ? */ - return MNG_TRUE; - - return MNG_FALSE; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_ihdr, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr)}; -#else - {MNG_UINT_IHDR, mng_init_ihdr, mng_free_ihdr, mng_read_ihdr, mng_write_ihdr, mng_assign_ihdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ihdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - ((mng_ihdrp)pChunk)->iWidth = iWidth; - ((mng_ihdrp)pChunk)->iHeight = iHeight; - ((mng_ihdrp)pChunk)->iBitdepth = iBitdepth; - ((mng_ihdrp)pChunk)->iColortype = iColortype; - ((mng_ihdrp)pChunk)->iCompression = iCompression; - ((mng_ihdrp)pChunk)->iFilter = iFilter; - ((mng_ihdrp)pChunk)->iInterlace = iInterlace; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_plte (mng_handle hHandle, - mng_uint32 iCount, - mng_palette8 aPalette) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_plte, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte)}; -#else - {MNG_UINT_PLTE, mng_init_plte, mng_free_plte, mng_read_plte, mng_write_plte, mng_assign_plte, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PLTE)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_plte (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PLTE, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_pltep)pChunk)->iEntrycount = iCount; - ((mng_pltep)pChunk)->bEmpty = (mng_bool)(iCount == 0); - - MNG_COPY (((mng_pltep)pChunk)->aEntries, aPalette, sizeof (mng_palette8)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_idat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat)}; -#else - {MNG_UINT_IDAT, mng_init_idat, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IDAT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_idat (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IDAT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_idatp)pChunk)->bEmpty = (mng_bool)(iRawlen == 0); - ((mng_idatp)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_idatp)pChunk)->pData, iRawlen); - MNG_COPY (((mng_idatp)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_iend (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_iend, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend)}; -#else - {MNG_UINT_IEND, mng_init_iend, mng_free_iend, mng_read_iend, mng_write_iend, mng_assign_iend, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IEND)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_iend (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IEND, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_INCLUDE_JNG - if ((pData->iFirstchunkadded == MNG_UINT_IHDR) || - (pData->iFirstchunkadded == MNG_UINT_JHDR) ) -#else - if (pData->iFirstchunkadded == MNG_UINT_IHDR) -#endif - pData->bCreating = MNG_FALSE; /* should be last chunk !!! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_trns (mng_handle hHandle, - mng_bool bEmpty, - mng_bool bGlobal, - mng_uint8 iType, - mng_uint32 iCount, - mng_uint8arr aAlphas, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint32 iRawlen, - mng_uint8arr aRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_trns, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns)}; -#else - {MNG_UINT_tRNS, mng_init_trns, mng_free_trns, mng_read_trns, mng_write_trns, mng_assign_trns, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_tRNS)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_trns (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_tRNS, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_trnsp)pChunk)->bEmpty = bEmpty; - ((mng_trnsp)pChunk)->bGlobal = bGlobal; - ((mng_trnsp)pChunk)->iType = iType; - ((mng_trnsp)pChunk)->iCount = iCount; - ((mng_trnsp)pChunk)->iGray = iGray; - ((mng_trnsp)pChunk)->iRed = iRed; - ((mng_trnsp)pChunk)->iGreen = iGreen; - ((mng_trnsp)pChunk)->iBlue = iBlue; - ((mng_trnsp)pChunk)->iRawlen = iRawlen; - - MNG_COPY (((mng_trnsp)pChunk)->aEntries, aAlphas, sizeof (mng_uint8arr)); - MNG_COPY (((mng_trnsp)pChunk)->aRawdata, aRawdata, sizeof (mng_uint8arr)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -mng_retcode MNG_DECL mng_putchunk_gama (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iGamma) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_gama, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama)}; -#else - {MNG_UINT_gAMA, mng_init_gama, mng_free_gama, mng_read_gama, mng_write_gama, mng_assign_gama, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_gAMA)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_gama (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_gAMA, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_gamap)pChunk)->bEmpty = bEmpty; - ((mng_gamap)pChunk)->iGamma = iGamma; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode MNG_DECL mng_putchunk_chrm (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_chrm, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm)}; -#else - {MNG_UINT_cHRM, mng_init_chrm, mng_free_chrm, mng_read_chrm, mng_write_chrm, mng_assign_chrm, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_cHRM)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_chrm (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_cHRM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_chrmp)pChunk)->bEmpty = bEmpty; - ((mng_chrmp)pChunk)->iWhitepointx = iWhitepointx; - ((mng_chrmp)pChunk)->iWhitepointy = iWhitepointy; - ((mng_chrmp)pChunk)->iRedx = iRedx; - ((mng_chrmp)pChunk)->iRedy = iRedy; - ((mng_chrmp)pChunk)->iGreenx = iGreenx; - ((mng_chrmp)pChunk)->iGreeny = iGreeny; - ((mng_chrmp)pChunk)->iBluex = iBluex; - ((mng_chrmp)pChunk)->iBluey = iBluey; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode MNG_DECL mng_putchunk_srgb (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iRenderingintent) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)}; -#else - {MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_sRGB)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_srgb (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_sRGB, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_srgbp)pChunk)->bEmpty = bEmpty; - ((mng_srgbp)pChunk)->iRenderingintent = iRenderingintent; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_putchunk_iccp (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iCompression, - mng_uint32 iProfilesize, - mng_ptr pProfile) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp)}; -#else - {MNG_UINT_iCCP, mng_init_iccp, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_iCCP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_iccp (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_iCCP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_iccpp)pChunk)->bEmpty = bEmpty; - ((mng_iccpp)pChunk)->iNamesize = iNamesize; - ((mng_iccpp)pChunk)->iCompression = iCompression; - ((mng_iccpp)pChunk)->iProfilesize = iProfilesize; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_iccpp)pChunk)->zName, zName, iNamesize); - } - - if (iProfilesize) - { - MNG_ALLOC (pData, ((mng_iccpp)pChunk)->pProfile, iProfilesize); - MNG_COPY (((mng_iccpp)pChunk)->pProfile, pProfile, iProfilesize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -mng_retcode MNG_DECL mng_putchunk_text (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint32 iTextsize, - mng_pchar zText) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text)}; -#else - {MNG_UINT_tEXt, mng_init_text, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_tEXt)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_text (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_tEXt, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_textp)pChunk)->iKeywordsize = iKeywordsize; - ((mng_textp)pChunk)->iTextsize = iTextsize; - - if (iKeywordsize) - { - MNG_ALLOC (pData, ((mng_textp)pChunk)->zKeyword, iKeywordsize + 1); - MNG_COPY (((mng_textp)pChunk)->zKeyword, zKeyword, iKeywordsize); - } - - if (iTextsize) - { - MNG_ALLOC (pData, ((mng_textp)pChunk)->zText, iTextsize + 1); - MNG_COPY (((mng_textp)pChunk)->zText, zText, iTextsize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TEXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -mng_retcode MNG_DECL mng_putchunk_ztxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompression, - mng_uint32 iTextsize, - mng_pchar zText) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt)}; -#else - {MNG_UINT_zTXt, mng_init_ztxt, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_zTXt)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ztxt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_zTXt, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_ztxtp)pChunk)->iKeywordsize = iKeywordsize; - ((mng_ztxtp)pChunk)->iCompression = iCompression; - ((mng_ztxtp)pChunk)->iTextsize = iTextsize; - - if (iKeywordsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zKeyword, iKeywordsize + 1); - MNG_COPY (((mng_ztxtp)pChunk)->zKeyword, zKeyword, iKeywordsize); - } - - if (iTextsize) - { - MNG_ALLOC (pData, ((mng_ztxtp)pChunk)->zText, iTextsize + 1); - MNG_COPY (((mng_ztxtp)pChunk)->zText, zText, iTextsize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ZTXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -mng_retcode MNG_DECL mng_putchunk_itxt (mng_handle hHandle, - mng_uint32 iKeywordsize, - mng_pchar zKeyword, - mng_uint8 iCompressionflag, - mng_uint8 iCompressionmethod, - mng_uint32 iLanguagesize, - mng_pchar zLanguage, - mng_uint32 iTranslationsize, - mng_pchar zTranslation, - mng_uint32 iTextsize, - mng_pchar zText) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt)}; -#else - {MNG_UINT_iTXt, mng_init_itxt, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_iTXt)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_itxt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_iTXt, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_itxtp)pChunk)->iKeywordsize = iKeywordsize; - ((mng_itxtp)pChunk)->iCompressionflag = iCompressionflag; - ((mng_itxtp)pChunk)->iCompressionmethod = iCompressionmethod; - ((mng_itxtp)pChunk)->iLanguagesize = iLanguagesize; - ((mng_itxtp)pChunk)->iTranslationsize = iTranslationsize; - ((mng_itxtp)pChunk)->iTextsize = iTextsize; - - if (iKeywordsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zKeyword, iKeywordsize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zKeyword, zKeyword, iKeywordsize); - } - - if (iLanguagesize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zLanguage, iLanguagesize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zLanguage, zLanguage, iLanguagesize); - } - - if (iTranslationsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zTranslation, iTranslationsize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zTranslation, zTranslation, iTranslationsize); - } - - if (iTextsize) - { - MNG_ALLOC (pData, ((mng_itxtp)pChunk)->zText, iTextsize + 1); - MNG_COPY (((mng_itxtp)pChunk)->zText, zText, iTextsize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ITXT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode MNG_DECL mng_putchunk_bkgd (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8 iIndex, - mng_uint16 iGray, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_bkgd, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd)}; -#else - {MNG_UINT_bKGD, mng_init_bkgd, mng_free_bkgd, mng_read_bkgd, mng_write_bkgd, mng_assign_bkgd, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_bKGD)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_bkgd (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_bKGD, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_bkgdp)pChunk)->bEmpty = bEmpty; - ((mng_bkgdp)pChunk)->iType = iType; - ((mng_bkgdp)pChunk)->iIndex = iIndex; - ((mng_bkgdp)pChunk)->iGray = iGray; - ((mng_bkgdp)pChunk)->iRed = iRed; - ((mng_bkgdp)pChunk)->iGreen = iGreen; - ((mng_bkgdp)pChunk)->iBlue = iBlue; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -mng_retcode MNG_DECL mng_putchunk_phys (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_phys, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys)}; -#else - {MNG_UINT_pHYs, mng_init_phys, mng_free_phys, mng_read_phys, mng_write_phys, mng_assign_phys, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_pHYs)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_phys (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_pHYs, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_physp)pChunk)->bEmpty = bEmpty; - ((mng_physp)pChunk)->iSizex = iSizex; - ((mng_physp)pChunk)->iSizey = iSizey; - ((mng_physp)pChunk)->iUnit = iUnit; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sBIT -mng_retcode MNG_DECL mng_putchunk_sbit (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iType, - mng_uint8arr4 aBits) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_sbit, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit)}; -#else - {MNG_UINT_sBIT, mng_init_sbit, mng_free_sbit, mng_read_sbit, mng_write_sbit, mng_assign_sbit, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_sBIT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_sbit (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_sBIT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_sbitp)pChunk)->bEmpty = bEmpty; - ((mng_sbitp)pChunk)->iType = iType; - ((mng_sbitp)pChunk)->aBits[0] = aBits[0]; - ((mng_sbitp)pChunk)->aBits[1] = aBits[1]; - ((mng_sbitp)pChunk)->aBits[2] = aBits[2]; - ((mng_sbitp)pChunk)->aBits[3] = aBits[3]; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SBIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -mng_retcode MNG_DECL mng_putchunk_splt (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iSampledepth, - mng_uint32 iEntrycount, - mng_ptr pEntries) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt)}; -#else - {MNG_UINT_sPLT, mng_init_splt, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_sPLT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_splt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_sPLT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_spltp)pChunk)->bEmpty = bEmpty; - ((mng_spltp)pChunk)->iNamesize = iNamesize; - ((mng_spltp)pChunk)->iSampledepth = iSampledepth; - ((mng_spltp)pChunk)->iEntrycount = iEntrycount; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_spltp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_spltp)pChunk)->zName, zName, iNamesize); - } - - if (iEntrycount) - { - mng_uint32 iSize = iEntrycount * ((iSampledepth >> 1) + 2); - - MNG_ALLOC (pData, ((mng_spltp)pChunk)->pEntries, iSize); - MNG_COPY (((mng_spltp)pChunk)->pEntries, pEntries, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -mng_retcode MNG_DECL mng_putchunk_hist (mng_handle hHandle, - mng_uint32 iEntrycount, - mng_uint16arr aEntries) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_hist, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist)}; -#else - {MNG_UINT_hIST, mng_init_hist, mng_free_hist, mng_read_hist, mng_write_hist, mng_assign_hist, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_hIST)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_hist (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_hIST, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_histp)pChunk)->iEntrycount = iEntrycount; - - MNG_COPY (((mng_histp)pChunk)->aEntries, aEntries, sizeof (mng_uint16arr)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_HIST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -mng_retcode MNG_DECL mng_putchunk_time (mng_handle hHandle, - mng_uint16 iYear, - mng_uint8 iMonth, - mng_uint8 iDay, - mng_uint8 iHour, - mng_uint8 iMinute, - mng_uint8 iSecond) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_time, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time)}; -#else - {MNG_UINT_tIME, mng_init_time, mng_free_time, mng_read_time, mng_write_time, mng_assign_time, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_tIME)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_time (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_tIME, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_timep)pChunk)->iYear = iYear; - ((mng_timep)pChunk)->iMonth = iMonth; - ((mng_timep)pChunk)->iDay = iDay; - ((mng_timep)pChunk)->iHour = iHour; - ((mng_timep)pChunk)->iMinute = iMinute; - ((mng_timep)pChunk)->iSecond = iSecond; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_mhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint32 iTicks, - mng_uint32 iLayercount, - mng_uint32 iFramecount, - mng_uint32 iPlaytime, - mng_uint32 iSimplicity) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_mhdr, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr)}; -#else - {MNG_UINT_MHDR, mng_init_mhdr, mng_free_mhdr, mng_read_mhdr, mng_write_mhdr, mng_assign_mhdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must be very first! */ - if (pData->iFirstchunkadded != 0) - MNG_ERROR (pData, MNG_SEQUENCEERROR) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_mhdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_mhdrp)pChunk)->iWidth = iWidth; - ((mng_mhdrp)pChunk)->iHeight = iHeight; - ((mng_mhdrp)pChunk)->iTicks = iTicks; - ((mng_mhdrp)pChunk)->iLayercount = iLayercount; - ((mng_mhdrp)pChunk)->iFramecount = iFramecount; - ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime; - ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_mend (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_mend, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend)}; -#else - {MNG_UINT_MEND, mng_init_mend, mng_free_mend, mng_read_mend, mng_write_mend, mng_assign_mend, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MEND)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_mend (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MEND, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - - pData->bCreating = MNG_FALSE; /* should be last chunk !!! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode MNG_DECL mng_putchunk_loop (mng_handle hHandle, - mng_uint8 iLevel, - mng_uint32 iRepeat, - mng_uint8 iTermination, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop)}; -#else - {MNG_UINT_LOOP, mng_init_loop, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_LOOP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_loop (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_LOOP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_loopp)pChunk)->iLevel = iLevel; - ((mng_loopp)pChunk)->iRepeat = iRepeat; - ((mng_loopp)pChunk)->iTermination = iTermination; - ((mng_loopp)pChunk)->iItermin = iItermin; - ((mng_loopp)pChunk)->iItermax = iItermax; - ((mng_loopp)pChunk)->iCount = iCount; - ((mng_loopp)pChunk)->pSignals = pSignals; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_endl (mng_handle hHandle, - mng_uint8 iLevel) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_endl, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl)}; -#else - {MNG_UINT_ENDL, mng_init_endl, mng_free_endl, mng_read_endl, mng_write_endl, mng_assign_endl, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_ENDL)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_endl (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_ENDL, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_endlp)pChunk)->iLevel = iLevel; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode MNG_DECL mng_putchunk_defi (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_int32 iXlocation, - mng_int32 iYlocation, - mng_bool bHasclip, - mng_int32 iLeftcb, - mng_int32 iRightcb, - mng_int32 iTopcb, - mng_int32 iBottomcb) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_defi, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi)}; -#else - {MNG_UINT_DEFI, mng_init_defi, mng_free_defi, mng_read_defi, mng_write_defi, mng_assign_defi, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DEFI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_defi (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DEFI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_defip)pChunk)->iObjectid = iObjectid; - ((mng_defip)pChunk)->iDonotshow = iDonotshow; - ((mng_defip)pChunk)->iConcrete = iConcrete; - ((mng_defip)pChunk)->bHasloca = bHasloca; - ((mng_defip)pChunk)->iXlocation = iXlocation; - ((mng_defip)pChunk)->iYlocation = iYlocation; - ((mng_defip)pChunk)->bHasclip = bHasclip; - ((mng_defip)pChunk)->iLeftcb = iLeftcb; - ((mng_defip)pChunk)->iRightcb = iRightcb; - ((mng_defip)pChunk)->iTopcb = iTopcb; - ((mng_defip)pChunk)->iBottomcb = iBottomcb; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode MNG_DECL mng_putchunk_basi (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha, - mng_uint8 iViewable) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_basi, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi)}; -#else - {MNG_UINT_BASI, mng_init_basi, mng_free_basi, mng_read_basi, mng_write_basi, mng_assign_basi, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_BASI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_basi (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_BASI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_basip)pChunk)->iWidth = iWidth; - ((mng_basip)pChunk)->iHeight = iHeight; - ((mng_basip)pChunk)->iBitdepth = iBitdepth; - ((mng_basip)pChunk)->iColortype = iColortype; - ((mng_basip)pChunk)->iCompression = iCompression; - ((mng_basip)pChunk)->iFilter = iFilter; - ((mng_basip)pChunk)->iInterlace = iInterlace; - ((mng_basip)pChunk)->iRed = iRed; - ((mng_basip)pChunk)->iGreen = iGreen; - ((mng_basip)pChunk)->iBlue = iBlue; - ((mng_basip)pChunk)->iAlpha = iAlpha; - ((mng_basip)pChunk)->iViewable = iViewable; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode MNG_DECL mng_putchunk_clon (mng_handle hHandle, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_clon, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon)}; -#else - {MNG_UINT_CLON, mng_init_clon, mng_free_clon, mng_read_clon, mng_write_clon, mng_assign_clon, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_CLON)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_clon (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_CLON, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_clonp)pChunk)->iSourceid = iSourceid; - ((mng_clonp)pChunk)->iCloneid = iCloneid; - ((mng_clonp)pChunk)->iClonetype = iClonetype; - ((mng_clonp)pChunk)->iDonotshow = iDonotshow; - ((mng_clonp)pChunk)->iConcrete = iConcrete; - ((mng_clonp)pChunk)->bHasloca = bHasloca; - ((mng_clonp)pChunk)->iLocationtype = iLocationtype; - ((mng_clonp)pChunk)->iLocationx = iLocationx; - ((mng_clonp)pChunk)->iLocationy = iLocationy; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_putchunk_past (mng_handle hHandle, - mng_uint16 iDestid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past)}; -#else - {MNG_UINT_PAST, mng_init_past, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PAST)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_past (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PAST, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_pastp)pChunk)->iDestid = iDestid; - ((mng_pastp)pChunk)->iTargettype = iTargettype; - ((mng_pastp)pChunk)->iTargetx = iTargetx; - ((mng_pastp)pChunk)->iTargety = iTargety; - ((mng_pastp)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_pastp)pChunk)->pSources, iCount * sizeof (mng_past_source)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode MNG_DECL mng_putchunk_past_src (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iSourceid, - mng_uint8 iComposition, - mng_uint8 iOrientation, - mng_uint8 iOffsettype, - mng_int32 iOffsetx, - mng_int32 iOffsety, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_past_sourcep pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been PAST ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PAST) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_pastp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_pastp)pChunk)->pSources + iEntry; - - pEntry->iSourceid = iSourceid; /* fill entry */ - pEntry->iComposition = iComposition; - pEntry->iOrientation = iOrientation; - pEntry->iOffsettype = iOffsettype; - pEntry->iOffsetx = iOffsetx; - pEntry->iOffsety = iOffsety; - pEntry->iBoundarytype = iBoundarytype; - pEntry->iBoundaryl = iBoundaryl; - pEntry->iBoundaryr = iBoundaryr; - pEntry->iBoundaryt = iBoundaryt; - pEntry->iBoundaryb = iBoundaryb; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PAST_SRC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode MNG_DECL mng_putchunk_disc (mng_handle hHandle, - mng_uint32 iCount, - mng_uint16p pObjectids) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc)}; -#else - {MNG_UINT_DISC, mng_init_disc, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DISC)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_disc (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DISC, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_discp)pChunk)->iCount = iCount; - - if (iCount) - { - mng_uint32 iSize = iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_discp)pChunk)->pObjectids, iSize); - MNG_COPY (((mng_discp)pChunk)->pObjectids, pObjectids, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -mng_retcode MNG_DECL mng_putchunk_back (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_back, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back)}; -#else - {MNG_UINT_BACK, mng_init_back, mng_free_back, mng_read_back, mng_write_back, mng_assign_back, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_BACK)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_back (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_BACK, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_backp)pChunk)->iRed = iRed; - ((mng_backp)pChunk)->iGreen = iGreen; - ((mng_backp)pChunk)->iBlue = iBlue; - ((mng_backp)pChunk)->iMandatory = iMandatory; - ((mng_backp)pChunk)->iImageid = iImageid; - ((mng_backp)pChunk)->iTile = iTile; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode MNG_DECL mng_putchunk_fram (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iMode, - mng_uint32 iNamesize, - mng_pchar zName, - mng_uint8 iChangedelay, - mng_uint8 iChangetimeout, - mng_uint8 iChangeclipping, - mng_uint8 iChangesyncid, - mng_uint32 iDelay, - mng_uint32 iTimeout, - mng_uint8 iBoundarytype, - mng_int32 iBoundaryl, - mng_int32 iBoundaryr, - mng_int32 iBoundaryt, - mng_int32 iBoundaryb, - mng_uint32 iCount, - mng_uint32p pSyncids) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram)}; -#else - {MNG_UINT_FRAM, mng_init_fram, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_FRAM)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_fram (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_FRAM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_framp)pChunk)->bEmpty = bEmpty; - ((mng_framp)pChunk)->iMode = iMode; - ((mng_framp)pChunk)->iNamesize = iNamesize; - ((mng_framp)pChunk)->iChangedelay = iChangedelay; - ((mng_framp)pChunk)->iChangetimeout = iChangetimeout; - ((mng_framp)pChunk)->iChangeclipping = iChangeclipping; - ((mng_framp)pChunk)->iChangesyncid = iChangesyncid; - ((mng_framp)pChunk)->iDelay = iDelay; - ((mng_framp)pChunk)->iTimeout = iTimeout; - ((mng_framp)pChunk)->iBoundarytype = iBoundarytype; - ((mng_framp)pChunk)->iBoundaryl = iBoundaryl; - ((mng_framp)pChunk)->iBoundaryr = iBoundaryr; - ((mng_framp)pChunk)->iBoundaryt = iBoundaryt; - ((mng_framp)pChunk)->iBoundaryb = iBoundaryb; - ((mng_framp)pChunk)->iCount = iCount; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_framp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_framp)pChunk)->zName, zName, iNamesize); - } - - if (iCount) - { - mng_uint32 iSize = iCount * sizeof (mng_uint32); - - MNG_ALLOC (pData, ((mng_framp)pChunk)->pSyncids, iSize); - MNG_COPY (((mng_framp)pChunk)->pSyncids, pSyncids, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode MNG_DECL mng_putchunk_move (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_move, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move)}; -#else - {MNG_UINT_MOVE, mng_init_move, mng_free_move, mng_read_move, mng_write_move, mng_assign_move, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MOVE)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_move (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MOVE, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_movep)pChunk)->iFirstid = iFirstid; - ((mng_movep)pChunk)->iLastid = iLastid; - ((mng_movep)pChunk)->iMovetype = iMovetype; - ((mng_movep)pChunk)->iMovex = iMovex; - ((mng_movep)pChunk)->iMovey = iMovey; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode MNG_DECL mng_putchunk_clip (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_clip, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip)}; -#else - {MNG_UINT_CLIP, mng_init_clip, mng_free_clip, mng_read_clip, mng_write_clip, mng_assign_clip, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_CLIP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_clip (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_CLIP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_clipp)pChunk)->iFirstid = iFirstid; - ((mng_clipp)pChunk)->iLastid = iLastid; - ((mng_clipp)pChunk)->iCliptype = iCliptype; - ((mng_clipp)pChunk)->iClipl = iClipl; - ((mng_clipp)pChunk)->iClipr = iClipr; - ((mng_clipp)pChunk)->iClipt = iClipt; - ((mng_clipp)pChunk)->iClipb = iClipb; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode MNG_DECL mng_putchunk_show (mng_handle hHandle, - mng_bool bEmpty, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_show, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show)}; -#else - {MNG_UINT_SHOW, mng_init_show, mng_free_show, mng_read_show, mng_write_show, mng_assign_show, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_SHOW)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_show (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_SHOW, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_showp)pChunk)->bEmpty = bEmpty; - ((mng_showp)pChunk)->iFirstid = iFirstid; - ((mng_showp)pChunk)->iLastid = iLastid; - ((mng_showp)pChunk)->iMode = iMode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -mng_retcode MNG_DECL mng_putchunk_term (mng_handle hHandle, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_term, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term)}; -#else - {MNG_UINT_TERM, mng_init_term, mng_free_term, mng_read_term, mng_write_term, mng_assign_term, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_term (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_TERM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_termp)pChunk)->iTermaction = iTermaction; - ((mng_termp)pChunk)->iIteraction = iIteraction; - ((mng_termp)pChunk)->iDelay = iDelay; - ((mng_termp)pChunk)->iItermax = iItermax; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode MNG_DECL mng_putchunk_save (mng_handle hHandle, - mng_bool bEmpty, - mng_uint8 iOffsettype, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save)}; -#else - {MNG_UINT_SAVE, mng_init_save, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_SAVE)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_save (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_SAVE, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_savep)pChunk)->bEmpty = bEmpty; - ((mng_savep)pChunk)->iOffsettype = iOffsettype; - ((mng_savep)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_savep)pChunk)->pEntries, iCount * sizeof (mng_save_entry)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_save_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEntrytype, - mng_uint32arr2 iOffset, - mng_uint32arr2 iStarttime, - mng_uint32 iLayernr, - mng_uint32 iFramenr, - mng_uint32 iNamesize, - mng_pchar zName) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_save_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been SAVE ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_SAVE) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_savep)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_savep)pChunk)->pEntries + iEntry; - - pEntry->iEntrytype = iEntrytype; /* fill entry */ - pEntry->iOffset[0] = iOffset[0]; - pEntry->iOffset[1] = iOffset[1]; - pEntry->iStarttime[0] = iStarttime[0]; - pEntry->iStarttime[1] = iStarttime[1]; - pEntry->iLayernr = iLayernr; - pEntry->iFramenr = iFramenr; - pEntry->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, pEntry->zName, iNamesize + 1); - MNG_COPY (pEntry->zName, zName, iNamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SAVE_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode MNG_DECL mng_putchunk_seek (mng_handle hHandle, - mng_uint32 iNamesize, - mng_pchar zName) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek)}; -#else - {MNG_UINT_SEEK, mng_init_seek, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_SEEK)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_seek (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_SEEK, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_seekp)pChunk)->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_seekp)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_seekp)pChunk)->zName, zName, iNamesize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -mng_retcode MNG_DECL mng_putchunk_expi (mng_handle hHandle, - mng_uint16 iSnapshotid, - mng_uint32 iNamesize, - mng_pchar zName) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_general, 0, 0, sizeof(mng_expi)}; -#else - {MNG_UINT_eXPI, mng_init_expi, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_eXPI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_expi (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_eXPI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_expip)pChunk)->iSnapshotid = iSnapshotid; - ((mng_expip)pChunk)->iNamesize = iNamesize; - - if (iNamesize) - { - MNG_ALLOC (pData, ((mng_expip)pChunk)->zName, iNamesize + 1); - MNG_COPY (((mng_expip)pChunk)->zName, zName, iNamesize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EXPI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -mng_retcode MNG_DECL mng_putchunk_fpri (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint8 iPriority) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_fpri, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri)}; -#else - {MNG_UINT_fPRI, mng_init_fpri, mng_free_fpri, mng_read_fpri, mng_write_fpri, mng_assign_fpri, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_fPRI)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_fpri (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_fPRI, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_fprip)pChunk)->iDeltatype = iDeltatype; - ((mng_fprip)pChunk)->iPriority = iPriority; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_FPRI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -mng_retcode MNG_DECL mng_putchunk_need (mng_handle hHandle, - mng_uint32 iKeywordssize, - mng_pchar zKeywords) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need)}; -#else - {MNG_UINT_nEED, mng_init_need, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_nEED)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_need (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_nEED, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_needp)pChunk)->iKeywordssize = iKeywordssize; - - if (iKeywordssize) - { - MNG_ALLOC (pData, ((mng_needp)pChunk)->zKeywords, iKeywordssize + 1); - MNG_COPY (((mng_needp)pChunk)->zKeywords, zKeywords, iKeywordssize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_NEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -mng_retcode MNG_DECL mng_putchunk_phyg (mng_handle hHandle, - mng_bool bEmpty, - mng_uint32 iSizex, - mng_uint32 iSizey, - mng_uint8 iUnit) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_phyg, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg)}; -#else - {MNG_UINT_pHYg, mng_init_phyg, mng_free_phyg, mng_read_phyg, mng_write_phyg, mng_assign_phyg, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_pHYg)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_phyg (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_pHYg, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_phygp)pChunk)->bEmpty = bEmpty; - ((mng_phygp)pChunk)->iSizex = iSizex; - ((mng_phygp)pChunk)->iSizey = iSizey; - ((mng_phygp)pChunk)->iUnit = iUnit; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PHYG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iImagesampledepth, - mng_uint8 iImagecompression, - mng_uint8 iImageinterlace, - mng_uint8 iAlphasampledepth, - mng_uint8 iAlphacompression, - mng_uint8 iAlphafilter, - mng_uint8 iAlphainterlace) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_jhdr, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr)}; -#else - {MNG_UINT_JHDR, mng_init_jhdr, mng_free_jhdr, mng_read_jhdr, mng_write_jhdr, mng_assign_jhdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jhdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_jhdrp)pChunk)->iWidth = iWidth; - ((mng_jhdrp)pChunk)->iHeight = iHeight; - ((mng_jhdrp)pChunk)->iColortype = iColortype; - ((mng_jhdrp)pChunk)->iImagesampledepth = iImagesampledepth; - ((mng_jhdrp)pChunk)->iImagecompression = iImagecompression; - ((mng_jhdrp)pChunk)->iImageinterlace = iImageinterlace; - ((mng_jhdrp)pChunk)->iAlphasampledepth = iAlphasampledepth; - ((mng_jhdrp)pChunk)->iAlphacompression = iAlphacompression; - ((mng_jhdrp)pChunk)->iAlphafilter = iAlphafilter; - ((mng_jhdrp)pChunk)->iAlphainterlace = iAlphainterlace; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jdat (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat)}; -#else - {MNG_UINT_JDAT, mng_init_jdat, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR or JHDR first! */ - if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && - (pData->iFirstchunkadded != MNG_UINT_JHDR) ) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JDAT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jdat (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JDAT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_jdatp)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_jdatp)pChunk)->pData, iRawlen); - MNG_COPY (((mng_jdatp)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jdaa (mng_handle hHandle, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)}; -#else - {MNG_UINT_JDAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR or JHDR first! */ - if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && - (pData->iFirstchunkadded != MNG_UINT_JHDR) ) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JDAA)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jdaa (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JDAA, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_jdaap)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_jdaap)pChunk)->pData, iRawlen); - MNG_COPY (((mng_jdaap)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -mng_retcode MNG_DECL mng_putchunk_jsep (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_jsep, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep)}; -#else - {MNG_UINT_JSEP, mng_init_jsep, mng_free_jsep, mng_read_jsep, mng_write_jsep, mng_assign_jsep, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR or JHDR first! */ - if ((pData->iFirstchunkadded != MNG_UINT_MHDR) && - (pData->iFirstchunkadded != MNG_UINT_JHDR) ) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_JSEP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_jsep (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_JSEP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_JSEP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_dhdr (mng_handle hHandle, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_dhdr, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr)}; -#else - {MNG_UINT_DHDR, mng_init_dhdr, mng_free_dhdr, mng_read_dhdr, mng_write_dhdr, mng_assign_dhdr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DHDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_dhdr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DHDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_dhdrp)pChunk)->iObjectid = iObjectid; - ((mng_dhdrp)pChunk)->iImagetype = iImagetype; - ((mng_dhdrp)pChunk)->iDeltatype = iDeltatype; - ((mng_dhdrp)pChunk)->iBlockwidth = iBlockwidth; - ((mng_dhdrp)pChunk)->iBlockheight = iBlockheight; - ((mng_dhdrp)pChunk)->iBlockx = iBlockx; - ((mng_dhdrp)pChunk)->iBlocky = iBlocky; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_prom (mng_handle hHandle, - mng_uint8 iColortype, - mng_uint8 iSampledepth, - mng_uint8 iFilltype) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_prom, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom)}; -#else - {MNG_UINT_PROM, mng_init_prom, mng_free_prom, mng_read_prom, mng_write_prom, mng_assign_prom, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PROM)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_prom (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PROM, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_promp)pChunk)->iColortype = iColortype; - ((mng_promp)pChunk)->iSampledepth = iSampledepth; - ((mng_promp)pChunk)->iFilltype = iFilltype; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_ipng (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_ipng, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng)}; -#else - {MNG_UINT_IPNG, mng_init_ipng, mng_free_ipng, mng_read_ipng, mng_write_ipng, mng_assign_ipng, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IPNG)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ipng (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IPNG, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_pplt (mng_handle hHandle, - mng_uint8 iDeltatype, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_pplt, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt)}; -#else - {MNG_UINT_PPLT, mng_init_pplt, mng_free_pplt, mng_read_pplt, mng_write_pplt, mng_assign_pplt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_PPLT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_pplt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_PPLT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_ppltp)pChunk)->iDeltatype = iDeltatype; - ((mng_ppltp)pChunk)->iCount = iCount; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_pplt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint16 iAlpha) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_pplt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been PPLT ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_PPLT) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - - /* index out of bounds ? */ - if (iEntry >= ((mng_ppltp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = (mng_pplt_entryp)(((mng_ppltp)pChunk)->aEntries) + iEntry; - - pEntry->iRed = (mng_uint8)iRed; /* fill the entry */ - pEntry->iGreen = (mng_uint8)iGreen; - pEntry->iBlue = (mng_uint8)iBlue; - pEntry->iAlpha = (mng_uint8)iAlpha; - pEntry->bUsed = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_PPLT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -mng_retcode MNG_DECL mng_putchunk_ijng (mng_handle hHandle) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_ijng, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng)}; -#else - {MNG_UINT_IJNG, mng_init_ijng, mng_free_ijng, mng_read_ijng, mng_write_ijng, mng_assign_ijng, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_IJNG)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ijng (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_IJNG, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode MNG_DECL mng_putchunk_drop (mng_handle hHandle, - mng_uint32 iCount, - mng_chunkidp pChunknames) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop)}; -#else - {MNG_UINT_DROP, mng_init_drop, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DROP)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_drop (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DROP, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_dropp)pChunk)->iCount = iCount; - - if (iCount) - { - mng_uint32 iSize = iCount * sizeof (mng_chunkid); - - MNG_ALLOC (pData, ((mng_dropp)pChunk)->pChunknames, iSize); - MNG_COPY (((mng_dropp)pChunk)->pChunknames, pChunknames, iSize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DROP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK -mng_retcode MNG_DECL mng_putchunk_dbyk (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint8 iPolarity, - mng_uint32 iKeywordssize, - mng_pchar zKeywords) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk)}; -#else - {MNG_UINT_DBYK, mng_init_dbyk, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_DBYK)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_dbyk (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_DBYK, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_dbykp)pChunk)->iChunkname = iChunkname; - ((mng_dbykp)pChunk)->iPolarity = iPolarity; - ((mng_dbykp)pChunk)->iKeywordssize = iKeywordssize; - - if (iKeywordssize) - { - MNG_ALLOC (pData, ((mng_dbykp)pChunk)->zKeywords, iKeywordssize + 1); - MNG_COPY (((mng_dbykp)pChunk)->zKeywords, zKeywords, iKeywordssize); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_DBYK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_putchunk_ordr (mng_handle hHandle, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr)}; -#else - {MNG_UINT_ORDR, mng_init_ordr, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_ORDR)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_ordr (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_ORDR, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_ordrp)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_ordrp)pChunk)->pEntries, iCount * sizeof (mng_ordr_entry)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR -mng_retcode MNG_DECL mng_putchunk_ordr_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_chunkid iChunkname, - mng_uint8 iOrdertype) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_ordr_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been ORDR ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_ORDR) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_ordrp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_ordrp)pChunk)->pEntries + iEntry; - - pEntry->iChunkname = iChunkname; /* fill the entry */ - pEntry->iOrdertype = iOrdertype; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_ORDR_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode MNG_DECL mng_putchunk_magn (mng_handle hHandle, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint16 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint16 iMethodY) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_magn, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn)}; -#else - {MNG_UINT_MAGN, mng_init_magn, mng_free_magn, mng_read_magn, mng_write_magn, mng_assign_magn, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_MAGN)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_magn (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_MAGN, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_magnp)pChunk)->iFirstid = iFirstid; - ((mng_magnp)pChunk)->iLastid = iLastid; - ((mng_magnp)pChunk)->iMethodX = (mng_uint8)iMethodX; - ((mng_magnp)pChunk)->iMX = iMX; - ((mng_magnp)pChunk)->iMY = iMY; - ((mng_magnp)pChunk)->iML = iML; - ((mng_magnp)pChunk)->iMR = iMR; - ((mng_magnp)pChunk)->iMT = iMT; - ((mng_magnp)pChunk)->iMB = iMB; - ((mng_magnp)pChunk)->iMethodY = (mng_uint8)iMethodY; - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng (mng_handle hHandle, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint8 iCompressionmethod, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng)}; -#else - {MNG_UINT_mpNG, mng_init_mpng, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a IHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_mpng (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_mpNG, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_mpngp)pChunk)->iFramewidth = iFramewidth; - ((mng_mpngp)pChunk)->iFrameheight = iFrameheight; - ((mng_mpngp)pChunk)->iNumplays = iNumplays; - ((mng_mpngp)pChunk)->iTickspersec = iTickspersec; - ((mng_mpngp)pChunk)->iCompressionmethod = iCompressionmethod; - ((mng_mpngp)pChunk)->iFramessize = iCount * sizeof (mng_mpng_frame); - - if (iCount) - MNG_ALLOC (pData, ((mng_mpngp)pChunk)->pFrames, ((mng_mpngp)pChunk)->iFramessize); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -MNG_EXT mng_retcode MNG_DECL mng_putchunk_mpng_frame (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_int32 iXoffset, - mng_int32 iYoffset, - mng_uint16 iTicks) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_mpng_framep pFrame; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a IHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_IHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been mpNG ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_mpNG) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= (((mng_mpngp)pChunk)->iFramessize / sizeof (mng_mpng_frame))) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pFrame = ((mng_mpngp)pChunk)->pFrames + iEntry; - /* fill entry */ - pFrame->iX = iX; - pFrame->iY = iY; - pFrame->iWidth = iWidth; - pFrame->iHeight = iHeight; - pFrame->iXoffset = iXoffset; - pFrame->iYoffset = iYoffset; - pFrame->iTicks = iTicks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_MPNG_FRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_evNT -mng_retcode MNG_DECL mng_putchunk_evnt (mng_handle hHandle, - mng_uint32 iCount) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt)}; -#else - {MNG_UINT_evNT, mng_init_evnt, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, MNG_UINT_evNT)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_evnt (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_evNT, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_evntp)pChunk)->iCount = iCount; - - if (iCount) - MNG_ALLOC (pData, ((mng_evntp)pChunk)->pEntries, iCount * sizeof (mng_evnt_entry)); - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_evnt_entry (mng_handle hHandle, - mng_uint32 iEntry, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_evnt_entryp pEntry; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a MHDR first! */ - if (pData->iFirstchunkadded != MNG_UINT_MHDR) - MNG_ERROR (pData, MNG_NOHEADER) - - pChunk = pData->pLastchunk; /* last one must have been evNT ! */ - - if (((mng_chunk_headerp)pChunk)->iChunkname != MNG_UINT_evNT) - MNG_ERROR (pData, MNG_NOCORRCHUNK) - /* index out of bounds ? */ - if (iEntry >= ((mng_evntp)pChunk)->iCount) - MNG_ERROR (pData, MNG_INVALIDENTRYIX) - /* address proper entry */ - pEntry = ((mng_evntp)pChunk)->pEntries + iEntry; - /* fill entry */ - pEntry->iEventtype = iEventtype; - pEntry->iMasktype = iMasktype; - pEntry->iLeft = iLeft; - pEntry->iRight = iRight; - pEntry->iTop = iTop; - pEntry->iBottom = iBottom; - pEntry->iObjectid = iObjectid; - pEntry->iIndex = iIndex; - pEntry->iSegmentnamesize = iSegmentnamesize; - - if (iSegmentnamesize) - { - MNG_ALLOC (pData, pEntry->zSegmentname, iSegmentnamesize + 1); - MNG_COPY (pEntry->zSegmentname, zSegmentname, iSegmentnamesize); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_EVNT_ENTRY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putchunk_unknown (mng_handle hHandle, - mng_chunkid iChunkname, - mng_uint32 iRawlen, - mng_ptr pRawdata) -{ - mng_datap pData; - mng_chunkp pChunk; - mng_retcode iRetcode; -#ifndef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_header sChunkheader = -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - {MNG_UINT_HUH, mng_init_general, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0, sizeof(mng_unknown_chunk)}; -#else - {MNG_UINT_HUH, mng_init_unknown, mng_free_unknown, mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0}; -#endif -#else - mng_chunk_header sChunkheader; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must have had a header first! */ - if (pData->iFirstchunkadded == 0) - MNG_ERROR (pData, MNG_NOHEADER) - /* prevent misplaced TERM ! */ - if (!check_term (pData, iChunkname)) - MNG_ERROR (pData, MNG_TERMSEQERROR) - /* create the chunk */ -#ifndef MNG_OPTIMIZE_CHUNKREADER -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#else - iRetcode = mng_init_unknown (pData, &sChunkheader, &pChunk); -#endif -#else - mng_get_chunkheader(MNG_UINT_HUH, &sChunkheader); - iRetcode = mng_init_general (pData, &sChunkheader, &pChunk); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fill the chunk */ - ((mng_unknown_chunkp)pChunk)->sHeader.iChunkname = iChunkname; - ((mng_unknown_chunkp)pChunk)->iDatasize = iRawlen; - - if (iRawlen) - { - MNG_ALLOC (pData, ((mng_unknown_chunkp)pChunk)->pData, iRawlen); - MNG_COPY (((mng_unknown_chunkp)pChunk)->pData, pRawdata, iRawlen); - } - - mng_add_chunk (pData, pChunk); /* add it to the list */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTCHUNK_UNKNOWN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getimgdata_seq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_SEQ, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getimgdata_chunkseq (mng_handle hHandle, - mng_uint32 iSeqnr, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNKSEQ, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getimgdata_chunk (mng_handle hHandle, - mng_handle hChunk, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETIMGDATA_CHUNK, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_putimgdata_ihdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_IHDR, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -mng_retcode MNG_DECL mng_putimgdata_jhdr (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iColortype, - mng_uint8 iBitdepth, - mng_uint8 iCompression, - mng_uint8 iInterlace, - mng_uint8 iAlphaBitdepth, - mng_uint8 iAlphaCompression, - mng_uint8 iAlphaFilter, - mng_uint8 iAlphaInterlace, - mng_uint32 iCanvasstyle, - mng_getcanvasline fGetcanvasline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_START); -#endif - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_PUTIMGDATA_JHDR, MNG_LC_END); -#endif - - return MNG_FNNOTIMPLEMENTED; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_updatemngheader (mng_handle hHandle, - mng_uint32 iFramecount, - mng_uint32 iLayercount, - mng_uint32 iPlaytime) -{ - mng_datap pData; - mng_chunkp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must be a MNG animation! */ - if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR)) - MNG_ERROR (pData, MNG_NOMHDR) - - pChunk = pData->pFirstchunk; /* get the first chunk */ - /* and update the variables */ - ((mng_mhdrp)pChunk)->iFramecount = iFramecount; - ((mng_mhdrp)pChunk)->iLayercount = iLayercount; - ((mng_mhdrp)pChunk)->iPlaytime = iPlaytime; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGHEADER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_updatemngsimplicity (mng_handle hHandle, - mng_uint32 iSimplicity) -{ - mng_datap pData; - mng_chunkp pChunk; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = (mng_datap)hHandle; /* and make it addressable */ - - if (!pData->bCreating) /* aren't we creating a new file ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID) - /* must be a MNG animation! */ - if ((pData->eImagetype != mng_it_mng) || (pData->iFirstchunkadded != MNG_UINT_MHDR)) - MNG_ERROR (pData, MNG_NOMHDR) - - pChunk = pData->pFirstchunk; /* get the first chunk */ - /* and update the variable */ - ((mng_mhdrp)pChunk)->iSimplicity = iSimplicity; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_UPDATEMNGSIMPLICITY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ - -#endif /* MNG_ACCESS_CHUNKS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_chunks.h b/Engine/lib/lmng/libmng_chunks.h deleted file mode 100644 index d10bf2dc7..000000000 --- a/Engine/lib/lmng/libmng_chunks.h +++ /dev/null @@ -1,1026 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_chunks.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Chunk structures (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of known chunk structures * */ -/* * * */ -/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - put in some extra comments * */ -/* * 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - fixed layout for sBIT, PPLT * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed write callback definition * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - fixed layout for PPLT again (missed deltatype ?!?) * */ -/* * * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - removed useless definition (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 11/28/2002 - G.Juyn * */ -/* * - fixed definition of iMethodX/Y for MAGN chunk * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added conditional around MNG_NO_DELTA_PNG support * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_chunks_h_ -#define _libmng_chunks_h_ - -/* ************************************************************************** */ - -#ifdef MNG_SWAP_ENDIAN -#define PNG_SIG 0x474e5089L -#define JNG_SIG 0x474e4a8bL -#define MNG_SIG 0x474e4d8aL -#define POST_SIG 0x0a1a0a0dL -#else -#define PNG_SIG 0x89504e47L -#define JNG_SIG 0x8b4a4e47L -#define MNG_SIG 0x8a4d4e47L -#define POST_SIG 0x0d0a1a0aL -#endif - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_CHUNKREADER - -typedef mng_retcode (*mng_f_specialfunc) (mng_datap pData, - mng_chunkp pChunk, - mng_uint32* piRawlen, - mng_uint8p* ppRawdata); - -typedef mng_retcode (*mng_c_specialfunc) (mng_datap pData, - mng_chunkp pChunk); - -#define MNG_FIELD_OPTIONAL 0x0001 -#define MNG_FIELD_TERMINATOR 0x0002 -#define MNG_FIELD_REPETITIVE 0x0004 -#define MNG_FIELD_DEFLATED 0x0008 -#define MNG_FIELD_IFIMGTYPES 0x01F0 /* image-type mask */ -#define MNG_FIELD_IFIMGTYPE0 0x0010 -#define MNG_FIELD_IFIMGTYPE2 0x0020 -#define MNG_FIELD_IFIMGTYPE3 0x0040 -#define MNG_FIELD_IFIMGTYPE4 0x0080 -#define MNG_FIELD_IFIMGTYPE6 0x0100 -#define MNG_FIELD_PUTIMGTYPE 0x0200 -#define MNG_FIELD_NOHIGHBIT 0x0400 -#define MNG_FIELD_GROUPMASK 0x7000 -#define MNG_FIELD_GROUP1 0x1000 -#define MNG_FIELD_GROUP2 0x2000 -#define MNG_FIELD_GROUP3 0x3000 -#define MNG_FIELD_GROUP4 0x4000 -#define MNG_FIELD_GROUP5 0x5000 -#define MNG_FIELD_GROUP6 0x6000 -#define MNG_FIELD_GROUP7 0x7000 -#define MNG_FIELD_INT 0x8000 - -typedef struct { /* chunk-field descriptor */ - mng_f_specialfunc pSpecialfunc; - mng_uint16 iFlags; - mng_uint16 iMinvalue; - mng_uint16 iMaxvalue; - mng_uint16 iLengthmin; - mng_uint16 iLengthmax; - mng_uint16 iOffsetchunk; - mng_uint16 iOffsetchunkind; - mng_uint16 iOffsetchunklen; - } mng_field_descriptor; -typedef mng_field_descriptor * mng_field_descp; - -#define MNG_DESCR_GLOBAL 0x0001 -#define MNG_DESCR_EMPTY 0x0002 -#define MNG_DESCR_EMPTYEMBED 0x0006 -#define MNG_DESCR_EMPTYGLOBAL 0x000A - -#define MNG_DESCR_GenHDR 0x0001 /* IHDR/JHDR/BASI/DHDR */ -#define MNG_DESCR_JngHDR 0x0002 /* JHDR/DHDR */ -#define MNG_DESCR_MHDR 0x0004 -#define MNG_DESCR_IHDR 0x0008 -#define MNG_DESCR_JHDR 0x0010 -#define MNG_DESCR_DHDR 0x0020 -#define MNG_DESCR_LOOP 0x0040 -#define MNG_DESCR_PLTE 0x0080 -#define MNG_DESCR_SAVE 0x0100 - -#define MNG_DESCR_NOIHDR 0x0001 -#define MNG_DESCR_NOJHDR 0x0002 -#define MNG_DESCR_NOBASI 0x0004 -#define MNG_DESCR_NODHDR 0x0008 -#define MNG_DESCR_NOIDAT 0x0010 -#define MNG_DESCR_NOJDAT 0x0020 -#define MNG_DESCR_NOJDAA 0x0040 -#define MNG_DESCR_NOPLTE 0x0080 -#define MNG_DESCR_NOJSEP 0x0100 -#define MNG_DESCR_NOMHDR 0x0200 -#define MNG_DESCR_NOTERM 0x0400 -#define MNG_DESCR_NOLOOP 0x0800 -#define MNG_DESCR_NOSAVE 0x1000 - -typedef struct { /* chunk descriptor */ - mng_imgtype eImgtype; - mng_createobjtype eCreateobject; - mng_uint16 iObjsize; - mng_uint16 iOffsetempty; - mng_ptr pObjcleanup; - mng_ptr pObjprocess; - mng_c_specialfunc pSpecialfunc; - mng_field_descp pFielddesc; - mng_uint16 iFielddesc; - mng_uint16 iAllowed; - mng_uint16 iMusthaves; - mng_uint16 iMustNOThaves; - } mng_chunk_descriptor; -typedef mng_chunk_descriptor * mng_chunk_descp; - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -typedef mng_retcode (*mng_createchunk) (mng_datap pData, - mng_chunkp pHeader, - mng_chunkp* ppChunk); - -typedef mng_retcode (*mng_cleanupchunk) (mng_datap pData, - mng_chunkp pHeader); - -typedef mng_retcode (*mng_readchunk) (mng_datap pData, - mng_chunkp pHeader, - mng_uint32 iRawlen, - mng_uint8p pRawdata, - mng_chunkp* pChunk); - -typedef mng_retcode (*mng_writechunk) (mng_datap pData, - mng_chunkp pChunk); - -typedef mng_retcode (*mng_assignchunk) (mng_datap pData, - mng_chunkp pChunkto, - mng_chunkp pChunkfrom); - -/* ************************************************************************** */ - -typedef struct { /* generic header */ - mng_chunkid iChunkname; - mng_createchunk fCreate; - mng_cleanupchunk fCleanup; - mng_readchunk fRead; - mng_writechunk fWrite; - mng_assignchunk fAssign; - mng_chunkp pNext; /* for double-linked list */ - mng_chunkp pPrev; -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - mng_size_t iChunksize; -#endif -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_chunk_descp pChunkdescr; -#endif - } mng_chunk_header; -typedef mng_chunk_header * mng_chunk_headerp; - -/* ************************************************************************** */ - -typedef struct { /* IHDR */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - } mng_ihdr; -typedef mng_ihdr * mng_ihdrp; - -/* ************************************************************************** */ - -typedef struct { /* PLTE */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iEntrycount; - mng_rgbpaltab aEntries; - } mng_plte; -typedef mng_plte * mng_pltep; - -/* ************************************************************************** */ - -typedef struct { /* IDAT */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iDatasize; - mng_ptr pData; - } mng_idat; -typedef mng_idat * mng_idatp; - -/* ************************************************************************** */ - -typedef struct { /* IEND */ - mng_chunk_header sHeader; - } mng_iend; -typedef mng_iend * mng_iendp; - -/* ************************************************************************** */ - -typedef struct { /* tRNS */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_bool bGlobal; - mng_uint8 iType; /* colortype (0,2,3) */ - mng_uint32 iCount; - mng_uint8arr aEntries; - mng_uint16 iGray; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_uint32 iRawlen; - mng_uint8arr aRawdata; - } mng_trns; -typedef mng_trns * mng_trnsp; - -/* ************************************************************************** */ - -typedef struct { /* gAMA */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iGamma; - } mng_gama; -typedef mng_gama * mng_gamap; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -typedef struct { /* cHRM */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iWhitepointx; - mng_uint32 iWhitepointy; - mng_uint32 iRedx; - mng_uint32 iRedy; - mng_uint32 iGreenx; - mng_uint32 iGreeny; - mng_uint32 iBluex; - mng_uint32 iBluey; - } mng_chrm; -typedef mng_chrm * mng_chrmp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* sRGB */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iRenderingintent; - } mng_srgb; -typedef mng_srgb * mng_srgbp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -typedef struct { /* iCCP */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iCompression; - mng_uint32 iProfilesize; - mng_ptr pProfile; - } mng_iccp; -typedef mng_iccp * mng_iccpp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tEXt -typedef struct { /* tEXt */ - mng_chunk_header sHeader; - mng_uint32 iKeywordsize; - mng_pchar zKeyword; - mng_uint32 iTextsize; - mng_pchar zText; - } mng_text; -typedef mng_text * mng_textp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_zTXt -typedef struct { /* zTXt */ - mng_chunk_header sHeader; - mng_uint32 iKeywordsize; - mng_pchar zKeyword; - mng_uint8 iCompression; - mng_uint32 iTextsize; - mng_pchar zText; - } mng_ztxt; -typedef mng_ztxt * mng_ztxtp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iTXt -typedef struct { /* iTXt */ - mng_chunk_header sHeader; - mng_uint32 iKeywordsize; - mng_pchar zKeyword; - mng_uint8 iCompressionflag; - mng_uint8 iCompressionmethod; - mng_uint32 iLanguagesize; - mng_pchar zLanguage; - mng_uint32 iTranslationsize; - mng_pchar zTranslation; - mng_uint32 iTextsize; - mng_pchar zText; - } mng_itxt; -typedef mng_itxt * mng_itxtp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -typedef struct { /* bKGD */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iType; /* 3=indexed, 0=gray, 2=rgb */ - mng_uint8 iIndex; - mng_uint16 iGray; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - } mng_bkgd; -typedef mng_bkgd * mng_bkgdp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYs -typedef struct { /* pHYs */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iSizex; - mng_uint32 iSizey; - mng_uint8 iUnit; - } mng_phys; -typedef mng_phys * mng_physp; -#endif - -/* ************************************************************************** */ -#ifndef MNG_SKIPCHUNK_sBIT - -typedef struct { /* sBIT */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iType; /* colortype (0,2,3,4,6,10,12,14,16) */ - mng_uint8arr4 aBits; - } mng_sbit; -typedef mng_sbit * mng_sbitp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sPLT -typedef struct { /* sPLT */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iSampledepth; - mng_uint32 iEntrycount; - mng_ptr pEntries; - } mng_splt; -typedef mng_splt * mng_spltp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_hIST -typedef struct { /* hIST */ - mng_chunk_header sHeader; - mng_uint32 iEntrycount; - mng_uint16arr aEntries; - } mng_hist; -typedef mng_hist * mng_histp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_tIME -typedef struct { /* tIME */ - mng_chunk_header sHeader; - mng_uint16 iYear; - mng_uint8 iMonth; - mng_uint8 iDay; - mng_uint8 iHour; - mng_uint8 iMinute; - mng_uint8 iSecond; - } mng_time; -typedef mng_time * mng_timep; -#endif - -/* ************************************************************************** */ - -typedef struct { /* MHDR */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint32 iTicks; - mng_uint32 iLayercount; - mng_uint32 iFramecount; - mng_uint32 iPlaytime; - mng_uint32 iSimplicity; - } mng_mhdr; -typedef mng_mhdr * mng_mhdrp; - -/* ************************************************************************** */ - -typedef struct { /* MEND */ - mng_chunk_header sHeader; - } mng_mend; -typedef mng_mend * mng_mendp; - -/* ************************************************************************** */ - -typedef struct { /* LOOP */ - mng_chunk_header sHeader; - mng_uint8 iLevel; - mng_uint32 iRepeat; - mng_uint8 iTermination; - mng_uint32 iItermin; - mng_uint32 iItermax; - mng_uint32 iCount; - mng_uint32p pSignals; - } mng_loop; -typedef mng_loop * mng_loopp; - -/* ************************************************************************** */ - -typedef struct { /* ENDL */ - mng_chunk_header sHeader; - mng_uint8 iLevel; - } mng_endl; -typedef mng_endl * mng_endlp; - -/* ************************************************************************** */ - -typedef struct { /* DEFI */ - mng_chunk_header sHeader; - mng_uint16 iObjectid; - mng_bool bHasdonotshow; - mng_uint8 iDonotshow; - mng_bool bHasconcrete; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_int32 iXlocation; - mng_int32 iYlocation; - mng_bool bHasclip; - mng_int32 iLeftcb; - mng_int32 iRightcb; - mng_int32 iTopcb; - mng_int32 iBottomcb; - } mng_defi; -typedef mng_defi * mng_defip; - -/* ************************************************************************** */ - -typedef struct { /* BASI */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasalpha; -#endif - mng_uint16 iAlpha; - mng_uint8 iViewable; - } mng_basi; -typedef mng_basi * mng_basip; - -/* ************************************************************************** */ - -typedef struct { /* CLON */ - mng_chunk_header sHeader; - mng_uint16 iSourceid; - mng_uint16 iCloneid; - mng_uint8 iClonetype; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasdonotshow; -#endif - mng_uint8 iDonotshow; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_uint8 iLocationtype; - mng_int32 iLocationx; - mng_int32 iLocationy; - } mng_clon; -typedef mng_clon * mng_clonp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -typedef struct { /* PAST source */ - mng_uint16 iSourceid; - mng_uint8 iComposition; - mng_uint8 iOrientation; - mng_uint8 iOffsettype; - mng_int32 iOffsetx; - mng_int32 iOffsety; - mng_uint8 iBoundarytype; - mng_int32 iBoundaryl; - mng_int32 iBoundaryr; - mng_int32 iBoundaryt; - mng_int32 iBoundaryb; - } mng_past_source; -typedef mng_past_source * mng_past_sourcep; - -typedef struct { /* PAST */ - mng_chunk_header sHeader; - mng_uint16 iDestid; - mng_uint8 iTargettype; - mng_int32 iTargetx; - mng_int32 iTargety; - mng_uint32 iCount; - mng_past_sourcep pSources; - } mng_past; -typedef mng_past * mng_pastp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* DISC */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_uint16p pObjectids; - } mng_disc; -typedef mng_disc * mng_discp; - -/* ************************************************************************** */ - -typedef struct { /* BACK */ - mng_chunk_header sHeader; - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_uint8 iMandatory; - mng_uint16 iImageid; - mng_uint8 iTile; - } mng_back; -typedef mng_back * mng_backp; - -/* ************************************************************************** */ - -typedef struct { /* FRAM */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iMode; - mng_uint32 iNamesize; - mng_pchar zName; - mng_uint8 iChangedelay; - mng_uint8 iChangetimeout; - mng_uint8 iChangeclipping; - mng_uint8 iChangesyncid; - mng_uint32 iDelay; - mng_uint32 iTimeout; - mng_uint8 iBoundarytype; - mng_int32 iBoundaryl; - mng_int32 iBoundaryr; - mng_int32 iBoundaryt; - mng_int32 iBoundaryb; - mng_uint32 iCount; - mng_uint32p pSyncids; - } mng_fram; -typedef mng_fram * mng_framp; - -/* ************************************************************************** */ - -typedef struct { /* MOVE */ - mng_chunk_header sHeader; - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMovetype; - mng_int32 iMovex; - mng_int32 iMovey; - } mng_move; -typedef mng_move * mng_movep; - -/* ************************************************************************** */ - -typedef struct { /* CLIP */ - mng_chunk_header sHeader; - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iCliptype; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_clip; -typedef mng_clip * mng_clipp; - -/* ************************************************************************** */ - -typedef struct { /* SHOW */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint16 iFirstid; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHaslastid; -#endif - mng_uint16 iLastid; - mng_uint8 iMode; - } mng_show; -typedef mng_show * mng_showp; - -/* ************************************************************************** */ - -typedef struct { /* TERM */ - mng_chunk_header sHeader; - mng_uint8 iTermaction; - mng_uint8 iIteraction; - mng_uint32 iDelay; - mng_uint32 iItermax; - } mng_term; -typedef mng_term * mng_termp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -typedef struct { /* SAVE entry */ - mng_uint8 iEntrytype; - mng_uint32arr2 iOffset; /* 0=MSI, 1=LSI */ - mng_uint32arr2 iStarttime; /* 0=MSI, 1=LSI */ - mng_uint32 iLayernr; - mng_uint32 iFramenr; - mng_uint32 iNamesize; - mng_pchar zName; - } mng_save_entry; -typedef mng_save_entry * mng_save_entryp; - -typedef struct { /* SAVE */ - mng_chunk_header sHeader; - mng_bool bEmpty; - mng_uint8 iOffsettype; - mng_uint32 iCount; - mng_save_entryp pEntries; - } mng_save; -typedef mng_save * mng_savep; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -typedef struct { /* SEEK */ - mng_chunk_header sHeader; - mng_uint32 iNamesize; - mng_pchar zName; - } mng_seek; -typedef mng_seek * mng_seekp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_eXPI -typedef struct { /* eXPI */ - mng_chunk_header sHeader; - mng_uint16 iSnapshotid; - mng_uint32 iNamesize; - mng_pchar zName; - } mng_expi; -typedef mng_expi * mng_expip; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_fPRI -typedef struct { /* fPRI */ - mng_chunk_header sHeader; - mng_uint8 iDeltatype; - mng_uint8 iPriority; - } mng_fpri; -typedef mng_fpri * mng_fprip; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_nEED -typedef struct { /* nEED */ - mng_chunk_header sHeader; - mng_uint32 iKeywordssize; - mng_pchar zKeywords; - } mng_need; -typedef mng_need * mng_needp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_pHYg -typedef mng_phys mng_phyg; /* pHYg */ -typedef mng_phyg * mng_phygp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -typedef struct { /* JHDR */ - mng_chunk_header sHeader; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_uint8 iColortype; - mng_uint8 iImagesampledepth; - mng_uint8 iImagecompression; - mng_uint8 iImageinterlace; - mng_uint8 iAlphasampledepth; - mng_uint8 iAlphacompression; - mng_uint8 iAlphafilter; - mng_uint8 iAlphainterlace; - } mng_jhdr; -typedef mng_jhdr * mng_jhdrp; - -/* ************************************************************************** */ - -typedef mng_idat mng_jdaa; /* JDAA */ -typedef mng_jdaa * mng_jdaap; - -/* ************************************************************************** */ - -typedef mng_idat mng_jdat; /* JDAT */ -typedef mng_jdat * mng_jdatp; - -/* ************************************************************************** */ - -typedef struct { /* JSEP */ - mng_chunk_header sHeader; - } mng_jsep; -typedef mng_jsep * mng_jsepp; - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG - -typedef struct { /* DHDR */ - mng_chunk_header sHeader; - mng_uint16 iObjectid; - mng_uint8 iImagetype; - mng_uint8 iDeltatype; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasblocksize; -#endif - mng_uint32 iBlockwidth; - mng_uint32 iBlockheight; -#ifdef MNG_OPTIMIZE_CHUNKREADER - mng_bool bHasblockloc; -#endif - mng_uint32 iBlockx; - mng_uint32 iBlocky; - } mng_dhdr; -typedef mng_dhdr * mng_dhdrp; - -/* ************************************************************************** */ - -typedef struct { /* PROM */ - mng_chunk_header sHeader; - mng_uint8 iColortype; - mng_uint8 iSampledepth; - mng_uint8 iFilltype; - } mng_prom; -typedef mng_prom * mng_promp; - -/* ************************************************************************** */ - -typedef struct { /* IPNG */ - mng_chunk_header sHeader; - } mng_ipng; -typedef mng_ipng *mng_ipngp; - -/* ************************************************************************** */ - -typedef struct { /* PPLT entry */ - mng_uint8 iRed; - mng_uint8 iGreen; - mng_uint8 iBlue; - mng_uint8 iAlpha; - mng_bool bUsed; - } mng_pplt_entry; -typedef mng_pplt_entry * mng_pplt_entryp; - -typedef struct { /* PPLT */ - mng_chunk_header sHeader; - mng_uint8 iDeltatype; - mng_uint32 iCount; - mng_pplt_entry aEntries [256]; - } mng_pplt; -typedef mng_pplt * mng_ppltp; - -/* ************************************************************************** */ - -typedef struct { /* IJNG */ - mng_chunk_header sHeader; - } mng_ijng; -typedef mng_ijng *mng_ijngp; - -/* ************************************************************************** */ - -typedef struct { /* DROP */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_chunkidp pChunknames; - } mng_drop; -typedef mng_drop * mng_dropp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DBYK -typedef struct { /* DBYK */ - mng_chunk_header sHeader; - mng_chunkid iChunkname; - mng_uint8 iPolarity; - mng_uint32 iKeywordssize; - mng_pchar zKeywords; - } mng_dbyk; -typedef mng_dbyk * mng_dbykp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_ORDR -typedef struct { /* ORDR entry */ - mng_chunkid iChunkname; - mng_uint8 iOrdertype; - } mng_ordr_entry; -typedef mng_ordr_entry * mng_ordr_entryp; - -typedef struct mng_ordr_struct { /* ORDR */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_ordr_entryp pEntries; - } mng_ordr; -typedef mng_ordr * mng_ordrp; -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -typedef struct { /* MAGN */ - mng_chunk_header sHeader; - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMethodX; - mng_uint16 iMX; - mng_uint16 iMY; - mng_uint16 iML; - mng_uint16 iMR; - mng_uint16 iMT; - mng_uint16 iMB; - mng_uint8 iMethodY; - } mng_magn; -typedef mng_magn * mng_magnp; - -/* ************************************************************************** */ - -typedef struct { /* evNT entry */ - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iSegmentnamesize; - mng_pchar zSegmentname; - } mng_evnt_entry; -typedef mng_evnt_entry * mng_evnt_entryp; - -typedef struct { /* evNT */ - mng_chunk_header sHeader; - mng_uint32 iCount; - mng_evnt_entryp pEntries; - } mng_evnt; -typedef mng_evnt * mng_evntp; - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -typedef struct { /* mpNG frame */ - mng_uint32 iX; - mng_uint32 iY; - mng_uint32 iWidth; - mng_uint32 iHeight; - mng_int32 iXoffset; - mng_int32 iYoffset; - mng_uint16 iTicks; - } mng_mpng_frame; -typedef mng_mpng_frame * mng_mpng_framep; - -typedef struct { /* mpNG */ - mng_chunk_header sHeader; - mng_uint32 iFramewidth; - mng_uint32 iFrameheight; - mng_uint16 iNumplays; - mng_uint16 iTickspersec; - mng_uint8 iCompressionmethod; - mng_uint32 iFramessize; - mng_mpng_framep pFrames; - } mng_mpng; -typedef mng_mpng * mng_mpngp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -typedef struct { /* ahDR */ - mng_chunk_header sHeader; - mng_uint32 iNumframes; - mng_uint32 iTickspersec; - mng_uint32 iNumplays; - mng_uint32 iTilewidth; - mng_uint32 iTileheight; - mng_uint8 iInterlace; - mng_uint8 iStillused; - } mng_ahdr; -typedef mng_ahdr * mng_ahdrp; - -typedef struct { /* adAT tile */ - mng_uint32 iTicks; - mng_int32 iXoffset; - mng_int32 iYoffset; - mng_uint8 iTilesource; - } mng_adat_tile; -typedef mng_adat_tile * mng_adat_tilep; - -typedef struct { /* adAT */ - mng_chunk_header sHeader; - mng_uint32 iTilessize; - mng_adat_tilep pTiles; - } mng_adat; -typedef mng_adat * mng_adatp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* unknown chunk */ - mng_chunk_header sHeader; - mng_uint32 iDatasize; - mng_ptr pData; - } mng_unknown_chunk; -typedef mng_unknown_chunk * mng_unknown_chunkp; - -/* ************************************************************************** */ - -#endif /* _libmng_chunks_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_cms.c b/Engine/lib/lmng/libmng_cms.c deleted file mode 100644 index 999575f66..000000000 --- a/Engine/lib/lmng/libmng_cms.c +++ /dev/null @@ -1,758 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_cms.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : color management routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the color management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/01/2000 - G.Juyn * */ -/* * - B001(105795) - fixed a typo and misconception about * */ -/* * freeing allocated gamma-table. (reported by Marti Maria) * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/09/2000 - G.Juyn * */ -/* * - filled application-based color-management routines * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added creatememprofile * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 06/10/2000 - G.Juyn * */ -/* * - fixed some compilation-warnings (contrib Jason Morris) * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - fixed problem with color-correction for stored images * */ -/* * 0.5.3 - 06/23/2000 - G.Juyn * */ -/* * - fixed problem with incorrect gamma-correction * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/31/2000 - G.Juyn * */ -/* * - fixed sRGB precedence for gamma_only corection * */ -/* * * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * * */ -/* * 1.0.1 - 03/31/2001 - G.Juyn * */ -/* * - ignore gamma=0 (see png-list for more info) * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn (reported by Gregg Kelly) * */ -/* * - fixed problem with cms profile being created multiple * */ -/* * times when both iCCP & cHRM/gAMA are present * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - optimized color-correction routines * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 11/08/2002 - G.Juyn * */ -/* * - fixed issues in init_app_cms() * */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * 1.0.6 - 07/11/2003 - G. R-P * */ -/* * - added conditional MNG_SKIPCHUNK_cHRM/iCCP * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_cms.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ -/* * * */ -/* * Little CMS helper routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS - -#define MNG_CMS_FLAGS 0 - -/* ************************************************************************** */ - -void mnglcms_initlibrary () -{ - cmsErrorAction (LCMS_ERROR_IGNORE); /* LCMS should ignore errors! */ -} - -/* ************************************************************************** */ - -mng_cmsprof mnglcms_createfileprofile (mng_pchar zFilename) -{ - return cmsOpenProfileFromFile (zFilename, "r"); -} - -/* ************************************************************************** */ - -mng_cmsprof mnglcms_creatememprofile (mng_uint32 iProfilesize, - mng_ptr pProfile) -{ - return cmsOpenProfileFromMem (pProfile, iProfilesize); -} - -/* ************************************************************************** */ - -mng_cmsprof mnglcms_createsrgbprofile (void) -{ - cmsCIExyY D65; - cmsCIExyYTRIPLE Rec709Primaries = { - {0.6400, 0.3300, 1.0}, - {0.3000, 0.6000, 1.0}, - {0.1500, 0.0600, 1.0} - }; - LPGAMMATABLE Gamma24[3]; - mng_cmsprof hsRGB; - - cmsWhitePointFromTemp(6504, &D65); - Gamma24[0] = Gamma24[1] = Gamma24[2] = cmsBuildGamma(256, 2.4); - hsRGB = cmsCreateRGBProfile(&D65, &Rec709Primaries, Gamma24); - cmsFreeGamma(Gamma24[0]); - - return hsRGB; -} - -/* ************************************************************************** */ - -void mnglcms_freeprofile (mng_cmsprof hProf) -{ - cmsCloseProfile (hProf); - return; -} - -/* ************************************************************************** */ - -void mnglcms_freetransform (mng_cmstrans hTrans) -{ -/* B001 start */ - cmsDeleteTransform (hTrans); -/* B001 end */ - return; -} - -/* ************************************************************************** */ - -mng_retcode mng_clear_cms (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_START); -#endif - - if (pData->hTrans) /* transformation still active ? */ - mnglcms_freetransform (pData->hTrans); - - pData->hTrans = 0; - - if (pData->hProf1) /* file profile still active ? */ - mnglcms_freeprofile (pData->hProf1); - - pData->hProf1 = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ -/* * * */ -/* * Color-management initialization & correction routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS - -mng_retcode mng_init_full_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj) -{ - mng_cmsprof hProf; - mng_cmstrans hTrans; - mng_imagep pImage = MNG_NULL; - mng_imagedatap pBuf = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS, MNG_LC_START); -#endif - - if (bObject) /* use object if present ? */ - { /* current object ? */ - if ((mng_imagep)pData->pCurrentobj) - pImage = (mng_imagep)pData->pCurrentobj; - else /* if not; use object 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - if (bRetrobj) /* retrieving from an object ? */ - pImage = (mng_imagep)pData->pRetrieveobj; - - if (pImage) /* are we using an object ? */ - pBuf = pImage->pImgbuf; /* then address the buffer */ - - if ((!pBuf) || (!pBuf->bCorrected)) /* is the buffer already corrected ? */ - { -#ifndef MNG_SKIPCHUNK_iCCP - if (((pBuf) && (pBuf->bHasICCP)) || ((bGlobal) && (pData->bHasglobalICCP))) - { - if (!pData->hProf2) /* output profile not defined ? */ - { /* then assume sRGB !! */ - pData->hProf2 = mnglcms_createsrgbprofile (); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - } - - if ((pBuf) && (pBuf->bHasICCP)) /* generate a profile handle */ - hProf = cmsOpenProfileFromMem (pBuf->pProfile, pBuf->iProfilesize); - else - hProf = cmsOpenProfileFromMem (pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->hProf1 = hProf; /* save for future use */ - - if (!hProf) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->bIsRGBA16) /* 16-bit intermediates ? */ - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE, - pData->hProf2, TYPE_RGBA_16_SE, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - else -#endif - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8, - pData->hProf2, TYPE_RGBA_8, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - - pData->hTrans = hTrans; /* save for future use */ - - if (!hTrans) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOTRANS); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_full_cms; - - return MNG_NOERROR; /* and done */ - } - else -#endif - if (((pBuf) && (pBuf->bHasSRGB)) || ((bGlobal) && (pData->bHasglobalSRGB))) - { - mng_uint8 iIntent; - - if (pData->bIssRGB) /* sRGB system ? */ - return MNG_NOERROR; /* no conversion required */ - - if (!pData->hProf3) /* sRGB profile not defined ? */ - { /* then create it implicitly !! */ - pData->hProf3 = mnglcms_createsrgbprofile (); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - } - - hProf = pData->hProf3; /* convert from sRGB profile */ - - if ((pBuf) && (pBuf->bHasSRGB)) /* determine rendering intent */ - iIntent = pBuf->iRenderingintent; - else - iIntent = pData->iGlobalRendintent; - - if (pData->bIsRGBA16) /* 16-bit intermediates ? */ - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE, - pData->hProf2, TYPE_RGBA_16_SE, - iIntent, MNG_CMS_FLAGS); - else - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8, - pData->hProf2, TYPE_RGBA_8, - iIntent, MNG_CMS_FLAGS); - - pData->hTrans = hTrans; /* save for future use */ - - if (!hTrans) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOTRANS); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_full_cms; - - return MNG_NOERROR; /* and done */ - } - else - if ( (((pBuf) && (pBuf->bHasCHRM)) || ((bGlobal) && (pData->bHasglobalCHRM))) && - ( ((pBuf) && (pBuf->bHasGAMA) && (pBuf->iGamma > 0)) || - ((bGlobal) && (pData->bHasglobalGAMA) && (pData->iGlobalGamma > 0)) ) ) - { - mng_CIExyY sWhitepoint; - mng_CIExyYTRIPLE sPrimaries; - mng_gammatabp pGammatable[3]; - mng_float dGamma; - - if (!pData->hProf2) /* output profile not defined ? */ - { /* then assume sRGB !! */ - pData->hProf2 = mnglcms_createsrgbprofile (); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - } - -#ifndef MNG_SKIPCHUNK_cHRM - if ((pBuf) && (pBuf->bHasCHRM)) /* local cHRM ? */ - { - sWhitepoint.x = (mng_float)pBuf->iWhitepointx / 100000; - sWhitepoint.y = (mng_float)pBuf->iWhitepointy / 100000; - sPrimaries.Red.x = (mng_float)pBuf->iPrimaryredx / 100000; - sPrimaries.Red.y = (mng_float)pBuf->iPrimaryredy / 100000; - sPrimaries.Green.x = (mng_float)pBuf->iPrimarygreenx / 100000; - sPrimaries.Green.y = (mng_float)pBuf->iPrimarygreeny / 100000; - sPrimaries.Blue.x = (mng_float)pBuf->iPrimarybluex / 100000; - sPrimaries.Blue.y = (mng_float)pBuf->iPrimarybluey / 100000; - } - else - { - sWhitepoint.x = (mng_float)pData->iGlobalWhitepointx / 100000; - sWhitepoint.y = (mng_float)pData->iGlobalWhitepointy / 100000; - sPrimaries.Red.x = (mng_float)pData->iGlobalPrimaryredx / 100000; - sPrimaries.Red.y = (mng_float)pData->iGlobalPrimaryredy / 100000; - sPrimaries.Green.x = (mng_float)pData->iGlobalPrimarygreenx / 100000; - sPrimaries.Green.y = (mng_float)pData->iGlobalPrimarygreeny / 100000; - sPrimaries.Blue.x = (mng_float)pData->iGlobalPrimarybluex / 100000; - sPrimaries.Blue.y = (mng_float)pData->iGlobalPrimarybluey / 100000; - } -#endif - - sWhitepoint.Y = /* Y component is always 1.0 */ - sPrimaries.Red.Y = - sPrimaries.Green.Y = - sPrimaries.Blue.Y = 1.0; - - if ((pBuf) && (pBuf->bHasGAMA)) /* get the gamma value */ - dGamma = (mng_float)pBuf->iGamma / 100000; - else - dGamma = (mng_float)pData->iGlobalGamma / 100000; - - dGamma = pData->dViewgamma / dGamma; - - pGammatable [0] = /* and build the lookup tables */ - pGammatable [1] = - pGammatable [2] = cmsBuildGamma (256, dGamma); - - if (!pGammatable [0]) /* enough memory ? */ - MNG_ERRORL (pData, MNG_LCMS_NOMEM); - /* create the profile */ - hProf = cmsCreateRGBProfile (&sWhitepoint, &sPrimaries, pGammatable); - - cmsFreeGamma (pGammatable [0]); /* free the temporary gamma tables ? */ - /* yes! but just the one! */ - - pData->hProf1 = hProf; /* save for future use */ - - if (!hProf) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); - - if (pData->bIsRGBA16) /* 16-bit intermediates ? */ - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_16_SE, - pData->hProf2, TYPE_RGBA_16_SE, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - else - hTrans = cmsCreateTransform (hProf, TYPE_RGBA_8, - pData->hProf2, TYPE_RGBA_8, - INTENT_PERCEPTUAL, MNG_CMS_FLAGS); - - pData->hTrans = hTrans; /* save for future use */ - - if (!hTrans) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOTRANS); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_full_cms; - - return MNG_NOERROR; /* and done */ - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_FULL_CMS, MNG_LC_END); -#endif - /* if we get here, we'll only do gamma */ - return mng_init_gamma_only (pData, bGlobal, bObject, bRetrobj); -} -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS -mng_retcode mng_correct_full_cms (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_FULL_CMS, MNG_LC_START); -#endif - - cmsDoTransform (pData->hTrans, pData->pRGBArow, pData->pRGBArow, pData->iRowsamples); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_FULL_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ - -#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS) -mng_retcode mng_init_gamma_only (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj) -{ - mng_float dGamma; - mng_imagep pImage = MNG_NULL; - mng_imagedatap pBuf = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_START); -#endif - - if (bObject) /* use object if present ? */ - { /* current object ? */ - if ((mng_imagep)pData->pCurrentobj) - pImage = (mng_imagep)pData->pCurrentobj; - else /* if not; use object 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - if (bRetrobj) /* retrieving from an object ? */ - pImage = (mng_imagep)pData->pRetrieveobj; - - if (pImage) /* are we using an object ? */ - pBuf = pImage->pImgbuf; /* then address the buffer */ - - if ((!pBuf) || (!pBuf->bCorrected)) /* is the buffer already corrected ? */ - { - if ((pBuf) && (pBuf->bHasSRGB)) /* get the gamma value */ - dGamma = 0.45455; - else - if ((pBuf) && (pBuf->bHasGAMA)) - dGamma = (mng_float)pBuf->iGamma / 100000; - else - if ((bGlobal) && (pData->bHasglobalSRGB)) - dGamma = 0.45455; - else - if ((bGlobal) && (pData->bHasglobalGAMA)) - dGamma = (mng_float)pData->iGlobalGamma / 100000; - else - dGamma = pData->dDfltimggamma; - - if (dGamma > 0) /* ignore gamma=0 */ - { - dGamma = pData->dViewgamma / (dGamma * pData->dDisplaygamma); - - if (dGamma != pData->dLastgamma) /* lookup table needs to be computed ? */ - { - mng_int32 iX; - - pData->aGammatab [0] = 0; - - for (iX = 1; iX <= 255; iX++) - pData->aGammatab [iX] = (mng_uint8)(pow (iX / 255.0, dGamma) * 255 + 0.5); - - pData->dLastgamma = dGamma; /* keep for next time */ - } - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_gamma_only; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GAMMA_ONLY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS || MNG_APP_CMS */ - -/* ************************************************************************** */ - -#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS) -mng_retcode mng_correct_gamma_only (mng_datap pData) -{ - mng_uint8p pWork; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_START); -#endif - - pWork = pData->pRGBArow; /* address intermediate row */ - - if (pData->bIsRGBA16) /* 16-bit intermediate row ? */ - { - - - /* TODO: 16-bit precision gamma processing */ - /* we'll just do the high-order byte for now */ - - - /* convert all samples in the row */ - for (iX = 0; iX < pData->iRowsamples; iX++) - { /* using the precalculated gamma lookup table */ - *pWork = pData->aGammatab [*pWork]; - *(pWork+2) = pData->aGammatab [*(pWork+2)]; - *(pWork+4) = pData->aGammatab [*(pWork+4)]; - - pWork += 8; - } - } - else - { /* convert all samples in the row */ - for (iX = 0; iX < pData->iRowsamples; iX++) - { /* using the precalculated gamma lookup table */ - *pWork = pData->aGammatab [*pWork]; - *(pWork+1) = pData->aGammatab [*(pWork+1)]; - *(pWork+2) = pData->aGammatab [*(pWork+2)]; - - pWork += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_GAMMA_ONLY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_GAMMA_ONLY || MNG_FULL_CMS || MNG_APP_CMS */ - -/* ************************************************************************** */ - -#ifdef MNG_APP_CMS -mng_retcode mng_init_app_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj) -{ - mng_imagep pImage = MNG_NULL; - mng_imagedatap pBuf = MNG_NULL; - mng_bool bDone = MNG_FALSE; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_START); -#endif - - if (bObject) /* use object if present ? */ - { /* current object ? */ - if ((mng_imagep)pData->pCurrentobj) - pImage = (mng_imagep)pData->pCurrentobj; - else /* if not; use object 0 */ - pImage = (mng_imagep)pData->pObjzero; - } - - if (bRetrobj) /* retrieving from an object ? */ - pImage = (mng_imagep)pData->pRetrieveobj; - - if (pImage) /* are we using an object ? */ - pBuf = pImage->pImgbuf; /* then address the buffer */ - - if ((!pBuf) || (!pBuf->bCorrected)) /* is the buffer already corrected ? */ - { -#ifndef MNG_SKIPCHUNK_iCCP - if ( (pData->fProcessiccp) && - (((pBuf) && (pBuf->bHasICCP)) || ((bGlobal) && (pData->bHasglobalICCP))) ) - { - mng_uint32 iProfilesize; - mng_ptr pProfile; - - if ((pBuf) && (pBuf->bHasICCP)) /* get the right profile */ - { - iProfilesize = pBuf->iProfilesize; - pProfile = pBuf->pProfile; - } - else - { - iProfilesize = pData->iGlobalProfilesize; - pProfile = pData->pGlobalProfile; - } - /* inform the app */ - if (!pData->fProcessiccp ((mng_handle)pData, iProfilesize, pProfile)) - MNG_ERROR (pData, MNG_APPCMSERROR); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - bDone = MNG_TRUE; - } -#endif - - if ( (pData->fProcesssrgb) && - (((pBuf) && (pBuf->bHasSRGB)) || ((bGlobal) && (pData->bHasglobalSRGB))) ) - { - mng_uint8 iIntent; - - if ((pBuf) && (pBuf->bHasSRGB)) /* determine rendering intent */ - iIntent = pBuf->iRenderingintent; - else - iIntent = pData->iGlobalRendintent; - /* inform the app */ - if (!pData->fProcesssrgb ((mng_handle)pData, iIntent)) - MNG_ERROR (pData, MNG_APPCMSERROR); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - bDone = MNG_TRUE; - } - -#ifndef MNG_SKIPCHUNK_cHRM - if ( (pData->fProcesschroma) && - (((pBuf) && (pBuf->bHasCHRM)) || ((bGlobal) && (pData->bHasglobalCHRM))) ) - { - mng_uint32 iWhitepointx, iWhitepointy; - mng_uint32 iPrimaryredx, iPrimaryredy; - mng_uint32 iPrimarygreenx, iPrimarygreeny; - mng_uint32 iPrimarybluex, iPrimarybluey; - - if ((pBuf) && (pBuf->bHasCHRM)) /* local cHRM ? */ - { - iWhitepointx = pBuf->iWhitepointx; - iWhitepointy = pBuf->iWhitepointy; - iPrimaryredx = pBuf->iPrimaryredx; - iPrimaryredy = pBuf->iPrimaryredy; - iPrimarygreenx = pBuf->iPrimarygreenx; - iPrimarygreeny = pBuf->iPrimarygreeny; - iPrimarybluex = pBuf->iPrimarybluex; - iPrimarybluey = pBuf->iPrimarybluey; - } - else - { - iWhitepointx = pData->iGlobalWhitepointx; - iWhitepointy = pData->iGlobalWhitepointy; - iPrimaryredx = pData->iGlobalPrimaryredx; - iPrimaryredy = pData->iGlobalPrimaryredy; - iPrimarygreenx = pData->iGlobalPrimarygreenx; - iPrimarygreeny = pData->iGlobalPrimarygreeny; - iPrimarybluex = pData->iGlobalPrimarybluex; - iPrimarybluey = pData->iGlobalPrimarybluey; - } - /* inform the app */ - if (!pData->fProcesschroma ((mng_handle)pData, iWhitepointx, iWhitepointy, - iPrimaryredx, iPrimaryredy, - iPrimarygreenx, iPrimarygreeny, - iPrimarybluex, iPrimarybluey)) - MNG_ERROR (pData, MNG_APPCMSERROR); - /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - bDone = MNG_TRUE; - } -#endif - - if ( (pData->fProcessgamma) && - (((pBuf) && (pBuf->bHasGAMA)) || ((bGlobal) && (pData->bHasglobalGAMA))) ) - { - mng_uint32 iGamma; - - if ((pBuf) && (pBuf->bHasGAMA)) /* get the gamma value */ - iGamma = pBuf->iGamma; - else - iGamma = pData->iGlobalGamma; - /* inform the app */ - if (!pData->fProcessgamma ((mng_handle)pData, iGamma)) - { /* app wants us to use internal routines ! */ - iRetcode = mng_init_gamma_only (pData, bGlobal, bObject, bRetrobj); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - } - - bDone = MNG_TRUE; - } - - if (!bDone) /* no color-info at all ? */ - { - /* then use default image gamma ! */ - if (!pData->fProcessgamma ((mng_handle)pData, - (mng_uint32)((pData->dDfltimggamma * 100000) + 0.5))) - { /* app wants us to use internal routines ! */ - iRetcode = mng_init_gamma_only (pData, bGlobal, bObject, bRetrobj); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* load color-correction routine */ - pData->fCorrectrow = (mng_fptr)mng_correct_app_cms; - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_APP_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_APP_CMS */ - -/* ************************************************************************** */ - -#ifdef MNG_APP_CMS -mng_retcode mng_correct_app_cms (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_START); -#endif - - if (pData->fProcessarow) /* let the app do something with our row */ - if (!pData->fProcessarow ((mng_handle)pData, pData->iRowsamples, - pData->bIsRGBA16, pData->pRGBArow)) - MNG_ERROR (pData, MNG_APPCMSERROR); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CORRECT_APP_CMS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_APP_CMS */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_cms.h b/Engine/lib/lmng/libmng_cms.h deleted file mode 100644 index 4459f805f..000000000 --- a/Engine/lib/lmng/libmng_cms.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_cms.h copyright (c) 2000-2003 G.Juyn * */ -/* * version : 1.0.6 * */ -/* * * */ -/* * purpose : color management routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of color management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added creatememprofile * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - optimized color-correction routines * */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_cms_h_ -#define _libmng_cms_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS -void mnglcms_initlibrary (void); -mng_cmsprof mnglcms_createfileprofile (mng_pchar zFilename); -mng_cmsprof mnglcms_creatememprofile (mng_uint32 iProfilesize, - mng_ptr pProfile ); -mng_cmsprof mnglcms_createsrgbprofile (void); -void mnglcms_freeprofile (mng_cmsprof hProf ); -void mnglcms_freetransform (mng_cmstrans hTrans ); - -mng_retcode mng_clear_cms (mng_datap pData ); -#endif - -/* ************************************************************************** */ - -#ifdef MNG_FULL_CMS -mng_retcode mng_init_full_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj); -mng_retcode mng_correct_full_cms (mng_datap pData); -#endif - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_retcode mng_init_gamma_only (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj); -mng_retcode mng_correct_gamma_only (mng_datap pData); -#endif - -#ifdef MNG_APP_CMS -mng_retcode mng_init_app_cms (mng_datap pData, - mng_bool bGlobal, - mng_bool bObject, - mng_bool bRetrobj); -mng_retcode mng_correct_app_cms (mng_datap pData); -#endif - -/* ************************************************************************** */ - -#endif /* _libmng_cms_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_conf.h b/Engine/lib/lmng/libmng_conf.h deleted file mode 100644 index 8441ee087..000000000 --- a/Engine/lib/lmng/libmng_conf.h +++ /dev/null @@ -1,295 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_conf.h copyright (c) G.Juyn 2000-2004 * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : main configuration file * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : The configuration file. Change this to include/exclude * */ -/* * the options you want or do not want in libmng. * */ -/* * * */ -/* * changes : 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - separated configuration-options into this file * */ -/* * - changed to most likely configuration (?) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - changed options to create a standard so-library * */ -/* * with everything enabled * */ -/* * 0.5.2 - 06/04/2000 - G.Juyn * */ -/* * - changed options to create a standard win32-dll * */ -/* * with everything enabled * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 09/16/2000 - G.Juyn * */ -/* * - removed trace-options from default SO/DLL builds * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B526138 - returned IJGSRC6B calling convention to * */ -/* * default for MSVC * */ -/* * * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * - added 'supports' call to check function availability * */ -/* * * */ -/* * 1.0.6 - 06/22/2002 - G.R-P * */ -/* * - added MNG_NO_INCLUDE_JNG conditional * */ -/* * - added MNG_SKIPCHUNK_evNT conditional * */ -/* * 1.0.6 - 07/14/2002 - G.R-P * */ -/* * - added MNG_NO_SUPPORT_FUNCQUERY conditional * */ -/* * * */ -/* * 1.0.7 - 03/07/2004 - G.R-P * */ -/* * - added MNG_VERSION_QUERY_SUPPORT_ conditional * */ -/* * * */ -/* * 1.0.9 - 05/12/2004 - G.Juyn * */ -/* * - clearified MNG_BIGENDIAN_SUPPORTED conditional * */ -/* * - added MNG_LITTLEENDIAN_SUPPORTED conditional * */ -/* * * */ -/* ************************************************************************** */ - - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_conf_h_ -#define _libmng_conf_h_ - -#ifdef MNG_MOZILLA_CFG -#include "special\mozcfg\mozlibmngconf.h" -#endif - -/* ************************************************************************** */ -/* * * */ -/* * User-selectable compile-time options * */ -/* * * */ -/* ************************************************************************** */ - -/* enable exactly one(1) of the MNG-(sub)set selectors */ -/* use this to select which (sub)set of the MNG specification you wish - to support */ -/* generally you'll want full support as the library provides it automatically - for you! if you're really strung on memory-requirements you can opt - to enable less support (but it's just NOT a good idea!) */ -/* NOTE that this isn't actually implemented yet */ - -#if !defined(MNG_SUPPORT_FULL) && !defined(MNG_SUPPORT_LC) && !defined(MNG_SUPPORT_VLC) -#define MNG_SUPPORT_FULL -/* #define MNG_SUPPORT_LC */ -/* #define MNG_SUPPORT_VLC */ -#endif - -/* ************************************************************************** */ - -/* enable JPEG support if required */ -/* use this to enable the JNG support routines */ -/* this requires an external jpeg package; - currently only IJG's jpgsrc6b is supported! */ -/* NOTE that the IJG code can be either 8- or 12-bit (eg. not both); - so choose the one you've defined in jconfig.h; if you don't know what - the heck I'm talking about, just leave it at 8-bit support (thank you!) */ - -#ifndef MNG_NO_INCLUDE_JNG -#ifdef MNG_SUPPORT_FULL /* full support includes JNG */ -#define MNG_SUPPORT_IJG6B -#endif - -#ifndef MNG_SUPPORT_IJG6B -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_IJG6B -#endif -#endif - -#if defined(MNG_SUPPORT_IJG6B) && !defined(MNG_SUPPORT_JPEG8) && !defined(MNG_SUPPORT_JPEG12) -#define MNG_SUPPORT_JPEG8 -/* #define MNG_SUPPORT_JPEG12 */ -#endif - -/* The following is required to export the IJG routines from the DLL in - the Windows-standard calling convention; - currently this only works for Borland C++ !!! */ - -#if defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#if defined(MNG_SUPPORT_IJG6B) && defined(__BORLANDC__) -#define MNG_DEFINE_JPEG_STDCALL -#endif -#endif -#endif - -/* ************************************************************************** */ - -/* enable required high-level functions */ -/* use this to select the high-level functions you require */ -/* if you only need to display a MNG, disable write support! */ -/* if you only need to examine a MNG, disable write & display support! */ -/* if you only need to copy a MNG, disable display support! */ -/* if you only need to create a MNG, disable read & display support! */ -/* NOTE that turning all options off will be very unuseful! */ - -#if !defined(MNG_SUPPORT_READ) && !defined(MNG_SUPPORT_WRITE) && !defined(MNG_SUPPORT_DISPLAY) -#define MNG_SUPPORT_READ -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_WRITE -#endif -#define MNG_SUPPORT_DISPLAY -#endif - -/* ************************************************************************** */ - -/* enable chunk access functions */ -/* use this to select whether you need access to the individual chunks */ -/* useful if you want to examine a read MNG (you'll also need MNG_STORE_CHUNKS !)*/ -/* required if you need to create & write a new MNG! */ - -#ifndef MNG_ACCESS_CHUNKS -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_ACCESS_CHUNKS -#endif -#endif - -/* ************************************************************************** */ - -/* enable exactly one(1) of the color-management functionality selectors */ -/* use this to select the level of automatic color support */ -/* MNG_FULL_CMS requires the lcms (little cms) external package ! */ -/* if you want your own app (or the OS) to handle color-management - select MNG_APP_CMS */ - -#define MNG_GAMMA_ONLY -/* #define MNG_FULL_CMS */ -/* #define MNG_APP_CMS */ - -/* ************************************************************************** */ - -/* enable automatic dithering */ -/* use this if you need dithering support to convert high-resolution - images to a low-resolution output-device */ -/* NOTE that this is not supported yet */ - -/* #define MNG_AUTO_DITHER */ - -/* ************************************************************************** */ - -/* enable whether chunks should be stored for reference later */ -/* use this if you need to examine the chunks of a MNG you have read, - or (re-)write a MNG you have read */ -/* turn this off if you want to reduce memory-consumption */ - -#ifndef MNG_STORE_CHUNKS -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_STORE_CHUNKS -#endif -#endif - -/* ************************************************************************** */ - -/* enable internal memory management (if your compiler supports it) */ -/* use this if your compiler supports the 'standard' memory functions - (calloc & free), and you want the library to use these functions and not - bother your app with memory-callbacks */ - -/* #define MNG_INTERNAL_MEMMNGMT */ - -/* ************************************************************************** */ - -/* enable internal tracing-functionality (manual debugging purposes) */ -/* use this if you have trouble location bugs or problems */ -/* NOTE that you'll need to specify the trace callback function! */ - -/* #define MNG_SUPPORT_TRACE */ - -/* ************************************************************************** */ - -/* enable extended error- and trace-telltaling */ -/* use this if you need explanatory messages with errors and/or tracing */ - -#if !defined(MNG_ERROR_TELLTALE) && !defined(MNG_TRACE_TELLTALE) -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_ERROR_TELLTALE -#define MNG_TRACE_TELLTALE -#endif -#endif - -/* ************************************************************************** */ - -/* enable BIG/LITTLE endian optimizations */ -/* enable BIG if you're on an architecture that supports big-endian reads - and writes that aren't word-aligned */ -/* according to reliable sources this only works for PowerPC (bigendian mode) - and 680x0 */ -/* enable LITTLE if you're on an architecture that supports little-endian */ -/* when in doubt leave both off !!! */ - -/* #define MNG_BIGENDIAN_SUPPORTED */ -/* #define MNG_LITTLEENDIAN_SUPPORTED */ - -/* ************************************************************************** */ -/* enable 'version' functions */ -#if !defined(MNG_VERSION_QUERY_SUPPORT) && \ - !defined(MNG_NO_VERSION_QUERY_SUPPORT) -#define MNG_VERSION_QUERY_SUPPORT -#endif - -/* enable 'supports' function */ -/* use this if you need to query the availability of functions at runtime; - useful for apps that dynamically load the library and that need specific - functions */ - -#if !defined(MNG_NO_SUPPORT_FUNCQUERY) && !defined(MNG_SUPPORT_FUNCQUERY) -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || \ - defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_FUNCQUERY -#endif -#endif - -/* ************************************************************************** */ - -/* enable dynamic MNG features */ -/* use this if you would like to have dynamic support for specifically - designed MNGs; eg. this is useful for 'rollover' effects such as common - on the world wide web */ - -#ifndef MNG_SUPPORT_DYNAMICMNG -#if defined(MNG_BUILD_SO) || defined(MNG_USE_SO) || defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_SUPPORT_DYNAMICMNG -#endif -#endif -#ifndef MNG_SUPPORT_DYNAMICMNG -#ifndef MNG_SKIPCHUNK_evNT -#define MNG_SKIPCHUNK_evNT -#endif -#endif - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_NO_ACCESS_JPEG -#ifndef MNG_ACCESS_JPEG -#define MNG_ACCESS_JPEG -#endif -#endif -#endif - -#ifdef MNG_INCLUDE_ZLIB -#ifndef MNG_NO_ACCESS_ZLIB -#ifndef MNG_ACCESS_ZLIB -#define MNG_ACCESS_ZLIB -#endif -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * End of user-selectable compile-time options * */ -/* * * */ -/* ************************************************************************** */ - -#endif /* _libmng_conf_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_data.h b/Engine/lib/lmng/libmng_data.h deleted file mode 100644 index 430dca96b..000000000 --- a/Engine/lib/lmng/libmng_data.h +++ /dev/null @@ -1,1029 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_data.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : main data structure definition * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the library main data structure * */ -/* * * */ -/* * changes : 0.5.1 - 05/04/2000 - G.Juyn * */ -/* * - added CRC table to main structure (for thread-safety) * */ -/* * 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added iPLTEentries for checking hIST-length * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed palette definition to exported palette-type * */ -/* * - removed frozen indicator * */ -/* * - added create/write indicators * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * - added saved-data structure for SAVE/SEEK processing * */ -/* * * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - added fields for JNG support (IJG-based) * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - changed global tRNS definition * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added delta-image fields * */ -/* * 0.5.2 - 06/01/2000 - G.Juyn * */ -/* * - added internal delta-image processing callbacks * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - changed SWAP_ENDIAN to BIGENDIAN_SUPPORTED * */ -/* * (contributed by Tim Rowley) * */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added parameter for delayed buffer-processing * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - added update-region parms for refresh calback * */ -/* * - added Needrefresh parameter * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - added Deltaimmediate parm for faster delta-processing * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added Speed parameter to facilitate testing * */ -/* * - added Imagelevel parameter for processtext callback * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added variables for go_xxxx processing * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added variables for improved timing support * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * - added variable for NEEDSECTIONWAIT breaks * */ -/* * - added variable for freeze & reset processing * */ -/* * 0.9.1 - 07/17/2000 - G.Juyn * */ -/* * - fixed suspension-buffering for 32K+ chunks * */ -/* * * */ -/* * 0.9.2 - 07/29/2000 - G.Juyn * */ -/* * - removed Nextbackxxx fields (no longer used) * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - fixed wrapping of suspension parameters * */ -/* * 0.9.2 - 08/04/2000 - G.Juyn * */ -/* * - B111096 - fixed large-buffer read-suspension * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 02/13/2001 - G.Juyn * */ -/* * - fixed first FRAM_MODE=4 timing problem * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 07/16/2002 - G.Juyn * */ -/* * - B581625 - large chunks fail with suspension reads * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - finished support for BACK image & tiling * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * - completed support for condition=2 in TERM chunk * */ -/* * 1.0.5 - 10/20/2002 - G.Juyn * */ -/* * - fixed processing for multiple objects in MAGN * */ -/* * - fixed display of visible target of PAST operation * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * 1.0.5 - 24/02/2003 - G.Juyn * */ -/* * - B683152 - libjpeg suspension not always honored correctly* */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * 1.0.6 - 07/05/2003 - G. R-P * */ -/* * - optionally use zlib's crc32() function * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added iPNGdepth member to pData structure * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/10/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_data_h_ -#define _libmng_data_h_ - -/* ************************************************************************** */ - -#define MNG_MAGIC 0x52530a0aL - -/* ************************************************************************** */ -/* * * */ -/* * Internal structures * */ -/* * * */ -/* ************************************************************************** */ - -typedef mng_palette8 mng_rgbpaltab; - -/* ************************************************************************** */ -/* * * */ -/* * The saved_data structure * */ -/* * * */ -/* * This contains the saved data after a SAVE chunk has been processed. * */ -/* * The data is saved from the main data structure during SAVE processing, * */ -/* * and restored to the main data structure during SEEK processing. * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct mng_savedata_struct { - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - mng_bool bHasglobalPLTE; /* global PLTE chunk processed */ - mng_bool bHasglobalTRNS; /* global tRNS chunk processed */ - mng_bool bHasglobalGAMA; /* global gAMA chunk processed */ - mng_bool bHasglobalCHRM; /* global cHRM chunk processed */ - mng_bool bHasglobalSRGB; /* global sRGB chunk processed */ - mng_bool bHasglobalICCP; /* global iCCP chunk processed */ - mng_bool bHasglobalBKGD; /* global bKGD chunk processed */ -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_DISPLAY - mng_uint16 iBACKred; /* BACK fields */ - mng_uint16 iBACKgreen; - mng_uint16 iBACKblue; - mng_uint8 iBACKmandatory; - mng_uint16 iBACKimageid; - mng_uint8 iBACKtile; - - mng_uint8 iFRAMmode; /* FRAM fields (global) */ - mng_uint32 iFRAMdelay; - mng_uint32 iFRAMtimeout; - mng_bool bFRAMclipping; - mng_int32 iFRAMclipl; - mng_int32 iFRAMclipr; - mng_int32 iFRAMclipt; - mng_int32 iFRAMclipb; - - mng_uint32 iGlobalPLTEcount; /* global PLTE fields */ - mng_rgbpaltab aGlobalPLTEentries; - - mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */ - mng_uint8arr aGlobalTRNSrawdata; - - mng_uint32 iGlobalGamma; /* global gAMA fields */ - -#ifndef MNG_SKIPCHUNK_cHRM - mng_uint32 iGlobalWhitepointx; /* global cHRM fields */ - mng_uint32 iGlobalWhitepointy; - mng_uint32 iGlobalPrimaryredx; - mng_uint32 iGlobalPrimaryredy; - mng_uint32 iGlobalPrimarygreenx; - mng_uint32 iGlobalPrimarygreeny; - mng_uint32 iGlobalPrimarybluex; - mng_uint32 iGlobalPrimarybluey; -#endif - - mng_uint8 iGlobalRendintent; /* global sRGB fields */ - - mng_uint32 iGlobalProfilesize; /* global iCCP fields */ - mng_ptr pGlobalProfile; - - mng_uint16 iGlobalBKGDred; /* global bKGD fields */ - mng_uint16 iGlobalBKGDgreen; - mng_uint16 iGlobalBKGDblue; -#endif /* MNG_SUPPORT_DISPLAY */ - - } mng_savedata; - -typedef mng_savedata * mng_savedatap; - -/* ************************************************************************** */ -/* * * */ -/* * Internal buffer structure for data push mechanisms * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct { - mng_ptr pNext; /* for linked list */ - mng_ptr pData; /* used for chunks & data */ - mng_uint32 iLength; - mng_bool bOwned; - mng_uint8p pDatanext; /* only used for data */ - mng_uint32 iRemaining; - } mng_pushdata; -typedef mng_pushdata * mng_pushdatap; - -/* ************************************************************************** */ -/* * * */ -/* * The main libmng data structure * */ -/* * * */ -/* * The handle used in all functions points to this structure which * */ -/* * contains all volatile data necessary to process the network graphic. * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct mng_data_struct { - - mng_uint32 iMagic; /* magic number to validate - a given handle */ - mng_ptr pUserdata; /* application workdata */ - - mng_imgtype eSigtype; /* image information */ - mng_imgtype eImagetype; /* initially zeroed */ - mng_uint32 iWidth; /* filled after header is processed */ - mng_uint32 iHeight; - mng_uint32 iTicks; /* these only after MHDR */ - mng_uint32 iLayercount; - mng_uint32 iFramecount; - mng_uint32 iPlaytime; - mng_uint32 iSimplicity; - mng_uint8 iAlphadepth; /* indicates expected alpha-depth */ - - mng_uint32 iImagelevel; /* level of image inside a stream */ - - mng_uint32 iCanvasstyle; /* layout of the drawing-canvas */ - mng_uint32 iBkgdstyle; /* layout of the background-canvas */ - - mng_int8 iMagnify; /* magnification factor (not used yet) */ - mng_uint32 iOffsetx; /* x-offset for extremely large image */ - mng_uint32 iOffsety; /* y-offset for extremely large image */ - mng_uint32 iCanvaswidth; /* real canvas size */ - mng_uint32 iCanvasheight; /* must be set by processheader callback */ - - mng_uint16 iBGred; /* default background color */ - mng_uint16 iBGgreen; /* initially "black" */ - mng_uint16 iBGblue; - mng_bool bUseBKGD; /* preferred use of bKGD for PNG */ - - mng_bool bIssRGB; /* indicates sRGB system */ - -#ifdef MNG_FULL_CMS /* little CMS variables */ - mng_cmsprof hProf1; /* image input profile */ - mng_cmsprof hProf2; /* default output profile */ - mng_cmsprof hProf3; /* default sRGB profile */ - mng_cmstrans hTrans; /* current transformation handle */ -#endif - - mng_float dViewgamma; /* gamma calculation variables */ - mng_float dDisplaygamma; /* initially set for sRGB conditions */ - mng_float dDfltimggamma; - - mng_bool bStorechunks; /* switch for storing chunkdata */ - mng_bool bSectionbreaks; /* indicate NEEDSECTIONWAIT breaks */ - mng_bool bCacheplayback; /* switch to cache playback info */ - mng_bool bDoProgressive; /* progressive refresh for large images */ - mng_uint32 iCrcmode; /* CRC existence & checking flags */ - - mng_speedtype iSpeed; /* speed-modifier for animations */ - - mng_uint32 iMaxwidth; /* maximum canvas size */ - mng_uint32 iMaxheight; /* initially set to 1024 x 1024 */ - - mng_int32 iErrorcode; /* error reporting fields */ - mng_int8 iSeverity; - mng_int32 iErrorx1; - mng_int32 iErrorx2; - mng_pchar zErrortext; - - mng_memalloc fMemalloc; /* callback pointers */ - mng_memfree fMemfree; /* initially nulled */ - mng_releasedata fReleasedata; -#ifndef MNG_NO_OPEN_CLOSE_STREAM - mng_openstream fOpenstream; - mng_closestream fClosestream; -#endif - mng_readdata fReaddata; - mng_writedata fWritedata; - mng_errorproc fErrorproc; - mng_traceproc fTraceproc; - mng_processheader fProcessheader; - mng_processtext fProcesstext; - mng_processsave fProcesssave; - mng_processseek fProcessseek; - mng_processneed fProcessneed; - mng_processmend fProcessmend; - mng_processunknown fProcessunknown; - mng_processterm fProcessterm; - mng_getcanvasline fGetcanvasline; - mng_getbkgdline fGetbkgdline; - mng_getalphaline fGetalphaline; - mng_refresh fRefresh; - mng_gettickcount fGettickcount; - mng_settimer fSettimer; - mng_processgamma fProcessgamma; - mng_processchroma fProcesschroma; - mng_processsrgb fProcesssrgb; - mng_processiccp fProcessiccp; - mng_processarow fProcessarow; - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -#ifndef MNG_NO_OLD_VERSIONS - mng_bool bPreDraft48; /* flags ancient style draft */ -#endif - - mng_chunkid iChunkname; /* read/write-state variables */ - mng_uint32 iChunkseq; - mng_chunkp pFirstchunk; /* double-linked list of */ - mng_chunkp pLastchunk; /* stored chunk-structures */ - - mng_bool bHasheader; /* first header chunk processed */ - mng_bool bHasMHDR; /* inside a MHDR-MEND sequence */ - mng_bool bHasIHDR; /* inside a IHDR-IEND sequence */ - mng_bool bHasBASI; /* inside a BASI-IEND sequence */ - mng_bool bHasDHDR; /* inside a DHDR-IEND sequence */ -#ifdef MNG_INCLUDE_JNG - mng_bool bHasJHDR; /* inside a JHDR-IEND sequence */ - mng_bool bHasJSEP; /* passed the JSEP separator */ - mng_bool bHasJDAA; /* at least 1 JDAA processed */ - mng_bool bHasJDAT; /* at least 1 JDAT processed */ -#endif - mng_bool bHasPLTE; /* PLTE chunk processed */ - mng_bool bHasTRNS; /* tRNS chunk processed */ - mng_bool bHasGAMA; /* gAMA chunk processed */ - mng_bool bHasCHRM; /* cHRM chunk processed */ - mng_bool bHasSRGB; /* sRGB chunk processed */ - mng_bool bHasICCP; /* iCCP chunk processed */ - mng_bool bHasBKGD; /* bKGD chunk processed */ - mng_bool bHasIDAT; /* at least 1 IDAT processed */ - - mng_bool bHasSAVE; /* SAVE chunk processed */ - mng_bool bHasBACK; /* BACK chunk processed */ - mng_bool bHasFRAM; /* FRAM chunk processed */ - mng_bool bHasTERM; /* TERM chunk processed */ - mng_bool bHasLOOP; /* at least 1 LOOP open */ - - mng_bool bHasglobalPLTE; /* global PLTE chunk processed */ - mng_bool bHasglobalTRNS; /* global tRNS chunk processed */ - mng_bool bHasglobalGAMA; /* global gAMA chunk processed */ - mng_bool bHasglobalCHRM; /* global cHRM chunk processed */ - mng_bool bHasglobalSRGB; /* global sRGB chunk processed */ - mng_bool bHasglobalICCP; /* global iCCP chunk processed */ - mng_bool bHasglobalBKGD; /* global bKGD chunk processed */ - - mng_uint32 iDatawidth; /* IHDR/BASI/DHDR fields */ - mng_uint32 iDataheight; /* valid if inside IHDR-IEND, */ - mng_uint8 iBitdepth; /* BASI-IEND or DHDR-IEND */ - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - - mng_uint32 iPLTEcount; /* PLTE fields */ - -#ifdef MNG_INCLUDE_JNG - mng_uint8 iJHDRcolortype; /* JHDR fields */ - mng_uint8 iJHDRimgbitdepth; /* valid if inside JHDR-IEND */ - mng_uint8 iJHDRimgcompression; - mng_uint8 iJHDRimginterlace; - mng_uint8 iJHDRalphabitdepth; - mng_uint8 iJHDRalphacompression; - mng_uint8 iJHDRalphafilter; - mng_uint8 iJHDRalphainterlace; -#endif - -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_READ - mng_bool bReading; /* read processing variables */ - mng_bool bHavesig; - mng_bool bEOF; - mng_uint32 iReadbufsize; - mng_uint8p pReadbuf; - - mng_uint32 iLargebufsize; /* temp for very large chunks */ - mng_uint8p pLargebuf; - - mng_uint32 iSuspendtime; /* tickcount at last suspension */ - mng_bool bSuspended; /* input-reading has been suspended; - we're expecting a call to - mng_read_resume! */ - mng_uint8 iSuspendpoint; /* indicates at which point the flow - was broken to suspend input-reading */ - - mng_bool bSuspensionmode; /* I/O-suspension variables */ - mng_uint32 iSuspendbufsize; - mng_uint8p pSuspendbuf; - mng_uint8p pSuspendbufnext; - mng_uint32 iSuspendbufleft; - mng_uint32 iChunklen; /* chunk length */ - mng_uint8p pReadbufnext; /* 32K+ suspension-processing */ - mng_uint8p pLargebufnext; - - mng_pushdatap pFirstpushchunk; /* variables for push mechanisms */ - mng_pushdatap pLastpushchunk; - mng_pushdatap pFirstpushdata; - mng_pushdatap pLastpushdata; -#endif /* MNG_SUPPORT_READ */ - -#ifdef MNG_SUPPORT_WRITE - mng_bool bCreating; /* create/write processing variables */ - mng_bool bWriting; - mng_chunkid iFirstchunkadded; - mng_uint32 iWritebufsize; - mng_uint8p pWritebuf; -#endif - -#ifdef MNG_SUPPORT_DISPLAY - mng_bool bDisplaying; /* display-state variables */ - mng_bool bFramedone; - mng_uint32 iFrameseq; - mng_uint32 iLayerseq; - mng_uint32 iFrametime; /* millisecs */ - - mng_uint32 iTotalframes; /* end-totals after mng_read() */ - mng_uint32 iTotallayers; - mng_uint32 iTotalplaytime; /* millisecs */ - - mng_bool bSkipping; /* LOOP iteration=0 */ - -#ifdef MNG_SUPPORT_DYNAMICMNG - mng_bool bDynamic; /* MNG is dynamic (eg. has events) */ - mng_bool bRunningevent; /* currently processing an event */ - mng_bool bStopafterseek; /* stop after next SEEK */ - mng_int32 iEventx; /* X/Y of current event */ - mng_int32 iEventy; - mng_objectp pLastmousemove; /* last event triggered */ -#endif - - mng_uint32 iRequestframe; /* go_xxxx variables */ - mng_uint32 iRequestlayer; - mng_uint32 iRequesttime; - mng_bool bSearching; - - mng_bool bRestorebkgd; /* flags restore required before IDAT/JDAT */ - - mng_uint32 iRuntime; /* millisecs since start */ - mng_uint32 iSynctime; /* tickcount at last framesync */ - mng_uint32 iStarttime; /* tickcount at start */ - mng_uint32 iEndtime; /* tickcount at end */ - mng_bool bRunning; /* animation is active */ - mng_bool bTimerset; /* the timer has been set; - we're expecting a call to - mng_display_resume! */ - mng_uint8 iBreakpoint; /* indicates at which point the - flow was broken to run the timer */ - mng_bool bSectionwait; /* indicates a section break */ - mng_bool bFreezing; /* indicates app requested a freeze */ - mng_bool bResetting; /* indicates app requested a reset */ - mng_bool bNeedrefresh; /* indicates screen-refresh is needed */ - mng_bool bMisplacedTERM; /* indicates TERM is out of place */ - mng_bool bOnlyfirstframe; /* show first frame after TERM and stop */ - mng_uint32 iFramesafterTERM; /* determines frame-count after TERM */ - mng_objectp pCurrentobj; /* current "object" */ - mng_objectp pCurraniobj; /* current animation object - "to be"/"being" processed */ - mng_objectp pTermaniobj; /* TERM animation object */ - mng_uint32 iIterations; /* TERM/MEND iteration count */ - mng_objectp pObjzero; /* "on-the-fly" image (object = 0) */ - mng_objectp pLastclone; /* last clone */ - mng_objectp pStoreobj; /* current store object for row routines */ - mng_objectp pStorebuf; /* current store object-buffer for row routines */ - mng_objectp pRetrieveobj; /* current retrieve object for row routines */ - mng_savedatap pSavedata; /* pointer to saved data (after SAVE) */ - - mng_uint32 iUpdateleft; /* update region for refresh */ - mng_uint32 iUpdateright; - mng_uint32 iUpdatetop; - mng_uint32 iUpdatebottom; - - mng_int8 iPass; /* current interlacing pass; - negative value means no interlace */ - mng_int32 iRow; /* current row counter */ - mng_int32 iRowinc; /* row increment for this pass */ - mng_int32 iCol; /* current starting column */ - mng_int32 iColinc; /* column increment for this pass */ - mng_int32 iRowsamples; /* nr. of samples in current workrow */ - mng_int32 iSamplemul; /* needed to calculate rowsize */ - mng_int32 iSampleofs; /* from rowsamples */ - mng_int32 iSamplediv; - mng_int32 iRowsize; /* size of actual data in work row */ - mng_int32 iRowmax; /* maximum size of data in work row */ - mng_int32 iFilterofs; /* offset to filter-byte in work row */ - mng_int32 iPixelofs; /* offset to pixel-bytes in work row */ - mng_uint32 iLevel0; /* leveling variables */ - mng_uint32 iLevel1; - mng_uint32 iLevel2; - mng_uint32 iLevel3; - mng_uint8p pWorkrow; /* working row of pixel-data */ - mng_uint8p pPrevrow; /* previous row of pixel-data */ - mng_uint8p pRGBArow; /* intermediate row of RGBA8 or RGBA16 data */ - mng_bool bIsRGBA16; /* indicates intermediate row is RGBA16 */ - mng_bool bIsOpaque; /* indicates intermediate row is fully opaque */ - mng_int32 iFilterbpp; /* bpp index for filtering routines */ - - mng_int32 iSourcel; /* variables for showing objects */ - mng_int32 iSourcer; - mng_int32 iSourcet; - mng_int32 iSourceb; - mng_int32 iDestl; - mng_int32 iDestr; - mng_int32 iDestt; - mng_int32 iDestb; - - mng_objectp pFirstimgobj; /* double-linked list of */ - mng_objectp pLastimgobj; /* image-object structures */ - mng_objectp pFirstaniobj; /* double-linked list of */ - mng_objectp pLastaniobj; /* animation-object structures */ -#ifdef MNG_SUPPORT_DYNAMICMNG - mng_objectp pFirstevent; /* double-linked list of */ - mng_objectp pLastevent; /* event-object structures */ -#endif - -#if defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS) || defined(MNG_APP_CMS) - mng_uint8 aGammatab[256]; /* precomputed gamma lookup table */ - mng_float dLastgamma; /* last gamma used to compute table */ -#endif - - mng_fptr fDisplayrow; /* internal callback to display an - uncompressed/unfiltered/ - color-corrected row */ - mng_fptr fRestbkgdrow; /* internal callback for restore- - background processing of a row */ - mng_fptr fCorrectrow; /* internal callback to color-correct an - uncompressed/unfiltered row */ - mng_fptr fRetrieverow; /* internal callback to retrieve an - uncompressed/unfiltered row of data */ - mng_fptr fStorerow; /* internal callback to store an - uncompressed/unfiltered row of data */ - mng_fptr fProcessrow; /* internal callback to process an - uncompressed row of data */ - mng_fptr fDifferrow; /* internal callback to perform - added filter leveling and - differing on an unfiltered row */ - mng_fptr fScalerow; /* internal callback to scale a - delta-row to the bitdepth of its target */ - mng_fptr fDeltarow; /* internal callback to execute a - delta-row onto a target */ -#ifndef MNG_SKIPCHUNK_PAST - mng_fptr fFliprow; /* internal callback to flip a row of pixels - left<->right for a PAST operation */ - mng_fptr fTilerow; /* internal callback to tile a row of pixels - during a PAST operation */ -#endif - mng_fptr fInitrowproc; /* internal callback to initialize - the row processing */ - - mng_uint16 iDEFIobjectid; /* DEFI fields */ - mng_bool bDEFIhasdonotshow; - mng_uint8 iDEFIdonotshow; - mng_bool bDEFIhasconcrete; - mng_uint8 iDEFIconcrete; - mng_bool bDEFIhasloca; - mng_int32 iDEFIlocax; - mng_int32 iDEFIlocay; - mng_bool bDEFIhasclip; - mng_int32 iDEFIclipl; - mng_int32 iDEFIclipr; - mng_int32 iDEFIclipt; - mng_int32 iDEFIclipb; - - mng_uint16 iBACKred; /* BACK fields */ - mng_uint16 iBACKgreen; - mng_uint16 iBACKblue; - mng_uint8 iBACKmandatory; - mng_uint16 iBACKimageid; - mng_uint8 iBACKtile; - - mng_int32 iBackimgoffsx; /* temp variables for restore_bkgd */ - mng_int32 iBackimgoffsy; - mng_uint32 iBackimgwidth; - mng_uint32 iBackimgheight; - -#ifndef MNG_SKIPCHUNK_FRAM - mng_uint8 iFRAMmode; /* FRAM fields (global) */ - mng_uint32 iFRAMdelay; - mng_uint32 iFRAMtimeout; - mng_bool bFRAMclipping; - mng_int32 iFRAMclipl; - mng_int32 iFRAMclipr; - mng_int32 iFRAMclipt; - mng_int32 iFRAMclipb; - - mng_uint8 iFramemode; /* current subframe variables */ - mng_uint32 iFramedelay; - mng_uint32 iFrametimeout; - mng_bool bFrameclipping; - mng_int32 iFrameclipl; - mng_int32 iFrameclipr; - mng_int32 iFrameclipt; - mng_int32 iFrameclipb; - - mng_uint32 iNextdelay; /* delay *after* next image */ -#endif - -#ifndef MNG_SKIPCHUNK_SHOW - mng_uint8 iSHOWmode; /* SHOW fields */ - mng_uint16 iSHOWfromid; - mng_uint16 iSHOWtoid; - mng_uint16 iSHOWnextid; - mng_int16 iSHOWskip; -#endif - - mng_uint32 iGlobalPLTEcount; /* global PLTE fields */ - mng_rgbpaltab aGlobalPLTEentries; - - mng_uint32 iGlobalTRNSrawlen; /* global tRNS fields */ - mng_uint8arr aGlobalTRNSrawdata; - - mng_uint32 iGlobalGamma; /* global gAMA fields */ - -#ifndef MNG_SKIPCHUNK_cHRM - mng_uint32 iGlobalWhitepointx; /* global cHRM fields */ - mng_uint32 iGlobalWhitepointy; - mng_uint32 iGlobalPrimaryredx; - mng_uint32 iGlobalPrimaryredy; - mng_uint32 iGlobalPrimarygreenx; - mng_uint32 iGlobalPrimarygreeny; - mng_uint32 iGlobalPrimarybluex; - mng_uint32 iGlobalPrimarybluey; -#endif - - mng_uint8 iGlobalRendintent; /* global sRGB fields */ - -#ifndef MNG_SKIPCHUNK_iCCP - mng_uint32 iGlobalProfilesize; /* global iCCP fields */ - mng_ptr pGlobalProfile; -#endif - - mng_uint16 iGlobalBKGDred; /* global bKGD fields */ - mng_uint16 iGlobalBKGDgreen; - mng_uint16 iGlobalBKGDblue; - - mng_ptr pDeltaImage; /* delta-image fields */ - mng_uint8 iDeltaImagetype; -#endif /* MNG_SUPPORT_DISPLAY */ - mng_uint8 iDeltatype; /* need this one in read processing !! */ -#ifdef MNG_SUPPORT_DISPLAY - mng_uint32 iDeltaBlockwidth; - mng_uint32 iDeltaBlockheight; - mng_uint32 iDeltaBlockx; - mng_uint32 iDeltaBlocky; - mng_bool bDeltaimmediate; - - mng_fptr fDeltagetrow; /* internal delta-proc callbacks */ - mng_fptr fDeltaaddrow; - mng_fptr fDeltareplacerow; - mng_fptr fDeltaputrow; - -#ifndef MNG_SKIPCHUNK_PROM - mng_fptr fPromoterow; /* internal PROM fields */ - mng_fptr fPromBitdepth; - mng_ptr pPromBuf; - mng_uint8 iPromColortype; - mng_uint8 iPromBitdepth; - mng_uint8 iPromFilltype; - mng_uint32 iPromWidth; - mng_ptr pPromSrc; - mng_ptr pPromDst; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - mng_uint16 iMAGNfromid; - mng_uint16 iMAGNcurrentid; - mng_uint16 iMAGNtoid; -#endif - -#ifndef MNG_SKIPCHUNK_PAST - mng_uint16 iPASTid; - mng_int32 iPastx; /* target x/y of last PAST */ - mng_int32 iPasty; -#endif - - mng_objectp pLastseek; /* last processed ani_seek object */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - mng_objectp pMPNG; /* mpNG object if available */ -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - mng_objectp pANG; /* ANG object if available */ -#endif - -#endif /* MNG_SUPPORT_DISPLAY */ - -#ifdef MNG_INCLUDE_ZLIB - z_stream sZlib; /* zlib (de)compression variables */ - - mng_int32 iZlevel; /* zlib compression parameters */ - mng_int32 iZmethod; - mng_int32 iZwindowbits; - mng_int32 iZmemlevel; - mng_int32 iZstrategy; - - mng_uint32 iMaxIDAT; /* maximum size of IDAT data */ - - mng_bool bInflating; /* indicates "inflate" in progress */ - mng_bool bDeflating; /* indicates "deflate" in progress */ -#endif /* MNG_INCLUDE_ZLIB */ - -#ifdef MNG_INCLUDE_JNG - mngjpeg_dctmethod eJPEGdctmethod; /* IJG compression variables */ - mng_int32 iJPEGquality; - mng_int32 iJPEGsmoothing; - mng_bool bJPEGcompressprogr; - mng_bool bJPEGcompressopt; - - mng_uint32 iMaxJDAT; /* maximum size of JDAT/JDAA data */ - - mngjpeg_compp pJPEGcinfo; /* compression structure */ - mngjpeg_errorp pJPEGcerr; /* error-manager compress */ - - mngjpeg_decompp pJPEGdinfo; /* decompression structure (JDAT) */ - mngjpeg_errorp pJPEGderr; /* error-manager decompress (JDAT) */ - mngjpeg_sourcep pJPEGdsrc; /* source-manager decompress (JDAT) */ - - mngjpeg_decompp pJPEGdinfo2; /* decompression structure (JDAA) */ - mngjpeg_errorp pJPEGderr2; /* error-manager decompress (JDAA) */ - mngjpeg_sourcep pJPEGdsrc2; /* source-manager decompress (JDAA) */ - - mng_uint8p pJPEGbuf; /* buffer for JPEG (de)compression (JDAT) */ - mng_uint32 iJPEGbufmax; /* allocated space for buffer (JDAT) */ - mng_uint8p pJPEGcurrent; /* current pointer into buffer (JDAT) */ - mng_uint32 iJPEGbufremain; /* remaining bytes in buffer (JDAT) */ - mng_uint32 iJPEGtoskip; /* bytes to skip on next input-block (JDAT) */ - - mng_uint8p pJPEGbuf2; /* buffer for JPEG (de)compression (JDAA) */ - mng_uint32 iJPEGbufmax2; /* allocated space for buffer (JDAA) */ - mng_uint8p pJPEGcurrent2; /* current pointer into buffer (JDAA) */ - mng_uint32 iJPEGbufremain2; /* remaining bytes in buffer (JDAA) */ - mng_uint32 iJPEGtoskip2; /* bytes to skip on next input-block (JDAA) */ - - mng_uint8p pJPEGrow; /* buffer for a JPEG row of samples (JDAT) */ - mng_uint32 iJPEGrowlen; - - mng_uint8p pJPEGrow2; /* buffer for a JPEG row of samples (JDAA) */ - mng_uint32 iJPEGrowlen2; - - mng_bool bJPEGcompress; /* indicates "compress" initialized */ - - mng_bool bJPEGdecompress; /* indicates "decompress" initialized (JDAT) */ - mng_bool bJPEGhasheader; /* indicates "readheader" succeeded (JDAT) */ - mng_bool bJPEGdecostarted; /* indicates "decompress" started (JDAT) */ - mng_bool bJPEGscanstarted; /* indicates "first scan" started (JDAT) */ - mng_bool bJPEGscanending; /* indicates "finish_output" suspended (JDAT) */ - mng_bool bJPEGprogressive; /* indicates a progressive image (JDAT) */ - - mng_bool bJPEGdecompress2; /* indicates "decompress" initialized (JDAA) */ - mng_bool bJPEGhasheader2; /* indicates "readheader" succeeded (JDAA) */ - mng_bool bJPEGdecostarted2; /* indicates "decompress" started (JDAA) */ - mng_bool bJPEGscanstarted2; /* indicates "first scan" started (JDAA) */ - mng_bool bJPEGprogressive2; /* indicates a progressive image (JDAA) */ - - mng_fptr fStorerow2; /* internal callback to store an - uncompressed/unfiltered row of JPEG-data (JDAT) */ - - mng_fptr fStorerow3; /* internal callback to store an - uncompressed/unfiltered row of JPEG-data (JDAA) */ - - mng_uint32 iJPEGrow; /* row-number for current JPEG row */ - mng_uint32 iJPEGalpharow; /* nr. of rows filled with alpha */ - mng_uint32 iJPEGrgbrow; /* nr. of rows filled with 'color'-info */ - mng_uint32 iJPEGdisprow; /* nr. of rows already displayed "on-the-fly" */ - -#if defined(MNG_USE_SETJMP) && defined (MNG_INCLUDE_IJG6B) - jmp_buf sErrorbuf; /* setjmp/longjmp buffer (error-recovery) */ -#endif - -#endif /* MNG_INCLUDE_JNG */ - -#ifndef MNG_USE_ZLIB_CRC - mng_uint32 aCRCtable [256]; /* CRC prefab table */ - mng_bool bCRCcomputed; /* "has been built" indicator */ -#endif - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - png_imgtype ePng_imgtype; -#endif - -#if defined(MNG_NO_1_2_4BIT_SUPPORT) || defined(MNG_NO_16BIT_SUPPORT) - mng_uint8 iPNGdepth; /* Real input depth */ - mng_uint8 iPNGmult; -#endif - -#ifdef MNG_OPTIMIZE_DISPLAYCALLS - mng_uint32 iRawlen; /* temp vars for display processing */ - mng_uint8p pRawdata; -#ifndef MNG_SKIPCHUNK_BASI - mng_uint16 iBASIred; - mng_uint16 iBASIgreen; - mng_uint16 iBASIblue; - mng_bool bBASIhasalpha; - mng_uint16 iBASIalpha; - mng_uint8 iBASIviewable; -#endif -#ifndef MNG_SKIPCHUNK_CLON - mng_uint16 iCLONsourceid; - mng_uint16 iCLONcloneid; - mng_uint8 iCLONclonetype; - mng_bool bCLONhasdonotshow; - mng_uint8 iCLONdonotshow; - mng_uint8 iCLONconcrete; - mng_bool bCLONhasloca; - mng_uint8 iCLONlocationtype; - mng_int32 iCLONlocationx; - mng_int32 iCLONlocationy; -#endif -#ifndef MNG_SKIPCHUNK_DISC - mng_uint32 iDISCcount; - mng_uint16p pDISCids; -#endif -#ifndef MNG_SKIPCHUNK_FRAM - mng_uint8 iTempFramemode; - mng_uint8 iTempChangedelay; - mng_uint32 iTempDelay; - mng_uint8 iTempChangetimeout; - mng_uint32 iTempTimeout; - mng_uint8 iTempChangeclipping; - mng_uint8 iTempCliptype; - mng_int32 iTempClipl; - mng_int32 iTempClipr; - mng_int32 iTempClipt; - mng_int32 iTempClipb; -#endif -#ifndef MNG_SKIPCHUNK_MOVE - mng_uint16 iMOVEfromid; - mng_uint16 iMOVEtoid; - mng_uint8 iMOVEmovetype; - mng_int32 iMOVEmovex; - mng_int32 iMOVEmovey; -#endif -#ifndef MNG_SKIPCHUNK_CLIP - mng_uint16 iCLIPfromid; - mng_uint16 iCLIPtoid; - mng_uint8 iCLIPcliptype; - mng_int32 iCLIPclipl; - mng_int32 iCLIPclipr; - mng_int32 iCLIPclipt; - mng_int32 iCLIPclipb; -#endif -#ifndef MNG_NO_DELTA_PNG - mng_uint16 iDHDRobjectid; - mng_uint8 iDHDRimagetype; - mng_uint8 iDHDRdeltatype; - mng_uint32 iDHDRblockwidth; - mng_uint32 iDHDRblockheight; - mng_uint32 iDHDRblockx; - mng_uint32 iDHDRblocky; - mng_uint8 iPROMbitdepth; - mng_uint8 iPROMcolortype; - mng_uint8 iPROMfilltype; - mng_uint8 iPPLTtype; - mng_uint32 iPPLTcount; - mng_palette8ep paPPLTindexentries; - mng_uint8p paPPLTalphaentries; - mng_uint8p paPPLTusedentries; -#endif -#ifndef MNG_SKIPCHUNK_MAGN - mng_uint16 iMAGNfirstid; - mng_uint16 iMAGNlastid; - mng_uint8 iMAGNmethodX; - mng_uint16 iMAGNmX; - mng_uint16 iMAGNmY; - mng_uint16 iMAGNmL; - mng_uint16 iMAGNmR; - mng_uint16 iMAGNmT; - mng_uint16 iMAGNmB; - mng_uint8 iMAGNmethodY; -#endif -#ifndef MNG_SKIPCHUNK_PAST - mng_uint16 iPASTtargetid; - mng_uint8 iPASTtargettype; - mng_int32 iPASTtargetx; - mng_int32 iPASTtargety; - mng_uint32 iPASTcount; - mng_ptr pPASTsources; -#endif -#endif /* MNG_OPTIMIZE_DISPLAYCALLS */ - - } mng_data; - -typedef mng_data * mng_datap; - -/* ************************************************************************** */ -/* * * */ -/* * Internal Callback-Function prototypes * */ -/* * * */ -/* ************************************************************************** */ - -typedef mng_retcode(*mng_displayrow) (mng_datap pData); -typedef mng_retcode(*mng_restbkgdrow) (mng_datap pData); -typedef mng_retcode(*mng_correctrow) (mng_datap pData); -typedef mng_retcode(*mng_retrieverow) (mng_datap pData); -typedef mng_retcode(*mng_storerow) (mng_datap pData); -typedef mng_retcode(*mng_processrow) (mng_datap pData); -typedef mng_retcode(*mng_initrowproc) (mng_datap pData); -typedef mng_retcode(*mng_differrow) (mng_datap pData); -typedef mng_retcode(*mng_scalerow) (mng_datap pData); -typedef mng_retcode(*mng_deltarow) (mng_datap pData); -typedef mng_retcode(*mng_promoterow) (mng_datap pData); -typedef mng_retcode(*mng_fliprow) (mng_datap pData); -typedef mng_retcode(*mng_tilerow) (mng_datap pData); - -typedef mng_uint8 (*mng_bitdepth_8) (mng_uint8 iB); -typedef mng_uint16 (*mng_bitdepth_16) (mng_uint8 iB); - -typedef mng_retcode(*mng_magnify_x) (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p iSrcline, - mng_uint8p iDstline); -typedef mng_retcode(*mng_magnify_y) (mng_datap pData, - mng_int32 iM, - mng_int32 iS, - mng_uint32 iWidth, - mng_uint8p iSrcline1, - mng_uint8p iSrcline2, - mng_uint8p iDstline); - -/* ************************************************************************** */ -/* * * */ -/* * Routines for swapping byte-order from and to graphic files * */ -/* * (This code is adapted from the libpng package) * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_BIGENDIAN_SUPPORTED -mng_uint32 mng_get_uint32 (mng_uint8p pBuf); -mng_int32 mng_get_int32 (mng_uint8p pBuf); -mng_uint16 mng_get_uint16 (mng_uint8p pBuf); -void mng_put_uint32 (mng_uint8p pBuf, - mng_uint32 i); -void mng_put_int32 (mng_uint8p pBuf, - mng_int32 i); -void mng_put_uint16 (mng_uint8p pBuf, - mng_uint16 i); -#else /* MNG_BIGENDIAN_SUPPORTED */ -#define mng_get_uint32(P) *(mng_uint32p)(P) -#define mng_get_int32(P) *(mng_int32p)(P) -#define mng_get_uint16(P) *(mng_uint16p)(P) -#define mng_put_uint32(P,I) *(mng_uint32p)(P) = (I) -#define mng_put_int32(P,I) *(mng_int32p)(P) = (I) -#define mng_put_uint16(P,I) *(mng_uint16p)(P) = (I) -#endif /* MNG_BIGENDIAN_SUPPORTED */ - -/* ************************************************************************** */ -/* * * */ -/* * Some handy(?) macro definitions * */ -/* * * */ -/* ************************************************************************** */ - -#define MAX_COORD(a, b) (((a) > (b)) ? (a) : (b)) -#define MIN_COORD(a, b) (((a) < (b)) ? (a) : (b)) - -/* ************************************************************************** */ - -#endif /* _libmng_data_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_display.c b/Engine/lib/lmng/libmng_display.c deleted file mode 100644 index adfb91d0e..000000000 --- a/Engine/lib/lmng/libmng_display.c +++ /dev/null @@ -1,7135 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_display.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Display management (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the display management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * - fixed frame_delay misalignment * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - added sanity check for frozen status * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - changed display_mend to reset state to initial or SAVE * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * - added process_save & process_seek routines * */ -/* * 0.5.1 - 05/14/2000 - G.Juyn * */ -/* * - added save_state and restore_state for SAVE/SEEK/TERM * */ -/* * processing * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG support (JHDR/JDAT) * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - fixed problem with DEFI clipping * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added delta-image support (DHDR,PROM,IPNG,IJNG) * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed pointer confusion (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/09/2000 - G.Juyn * */ -/* * - fixed timer-handling to run with Mozilla (Tim Rowley) * */ -/* * 0.5.2 - 06/10/2000 - G.Juyn * */ -/* * - fixed some compilation-warnings (contrib Jason Morris) * */ -/* * * */ -/* * 0.5.3 - 06/12/2000 - G.Juyn * */ -/* * - fixed display of stored JNG images * */ -/* * 0.5.3 - 06/13/2000 - G.Juyn * */ -/* * - fixed problem with BASI-IEND as object 0 * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed delta-image processing * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed some minor stuff * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added speed-modifier to timing routine * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for PPLT chunk processing * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - swapped refresh parameters * */ -/* * * */ -/* * 0.9.0 - 06/30/2000 - G.Juyn * */ -/* * - changed refresh parameters to 'x,y,width,height' * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - implemented support for freeze/reset/resume & go_xxxx * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added support for improved timing * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed EOF processing behavior * */ -/* * - fixed TERM delay processing * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - fixed freeze & reset processing * */ -/* * 0.9.1 - 07/16/2000 - G.Juyn * */ -/* * - fixed storage of images during mng_read() * */ -/* * - fixed support for mng_display() after mng_read() * */ -/* * 0.9.1 - 07/24/2000 - G.Juyn * */ -/* * - fixed reading of still-images * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/21/2000 - G.Juyn * */ -/* * - fixed TERM processing delay of 0 msecs * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed problem with no refresh after TERM * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 09/16/2000 - G.Juyn * */ -/* * - fixed timing & refresh behavior for single PNG/JNG * */ -/* * 0.9.3 - 09/19/2000 - G.Juyn * */ -/* * - refixed timing & refresh behavior for single PNG/JNG * */ -/* * 0.9.3 - 10/02/2000 - G.Juyn * */ -/* * - fixed timing again (this is getting boring...) * */ -/* * - refixed problem with no refresh after TERM * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - fixed delta-processing behavior * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - added storage for pixel-/alpha-sampledepth for delta's * */ -/* * 0.9.3 - 10/27/2000 - G.Juyn * */ -/* * - fixed separate read() & display() processing * */ -/* * * */ -/* * 0.9.4 - 10/31/2000 - G.Juyn * */ -/* * - fixed possible loop in display_resume() (Thanks Vova!) * */ -/* * 0.9.4 - 11/20/2000 - G.Juyn * */ -/* * - fixed unwanted repetition in mng_readdisplay() * */ -/* * 0.9.4 - 11/24/2000 - G.Juyn * */ -/* * - moved restore of object 0 to libmng_display * */ -/* * - added restore of object 0 to TERM processing !!! * */ -/* * - fixed TERM delay processing * */ -/* * - fixed TERM end processing (count = 0) * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * - set default level-set for filtertype=64 to all zeroes * */ -/* * * */ -/* * 0.9.5 - 1/20/2001 - G.Juyn * */ -/* * - fixed compiler-warnings Mozilla (thanks Tim) * */ -/* * 0.9.5 - 1/23/2001 - G.Juyn * */ -/* * - fixed timing-problem with switching framing_modes * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 02/13/2001 - G.Juyn * */ -/* * - fixed first FRAM_MODE=4 timing problem * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn * */ -/* * - fixed memory-leak for JNGs with alpha (Thanks Gregg!) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - fixed memory-leak with delta-images (Thanks Michael!) * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - fixed color-correction for restore-background handling * */ -/* * - optimized restore-background for bKGD cases * */ -/* * - cleaned up some old stuff * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - finished support for BACK image & tiling * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 10/05/2002 - G.Juyn * */ -/* * - fixed dropping mix of frozen/unfrozen objects * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added proposed change in handling of TERM- & if-delay * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * - completed support for condition=2 in TERM chunk * */ -/* * 1.0.5 - 10/18/2002 - G.Juyn * */ -/* * - fixed clipping-problem with BACK tiling (Thanks Sakura!) * */ -/* * 1.0.5 - 10/20/2002 - G.Juyn * */ -/* * - fixed processing for multiple objects in MAGN * */ -/* * - fixed display of visible target of PAST operation * */ -/* * 1.0.5 - 10/30/2002 - G.Juyn * */ -/* * - modified TERM/MEND processing for max(1, TERM_delay, * */ -/* * interframe_delay) * */ -/* * 1.0.5 - 11/04/2002 - G.Juyn * */ -/* * - fixed layer- & frame-counting during read() * */ -/* * - fixed goframe/golayer/gotime processing * */ -/* * 1.0.5 - 01/19/2003 - G.Juyn * */ -/* * - B654627 - fixed SEGV when no gettickcount callback * */ -/* * - B664383 - fixed typo * */ -/* * - finalized changes in TERM/final_delay to elected proposal* */ -/* * * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around some JNG-supporting code * */ -/* * - added conditionals around 16-bit supporting code * */ -/* * - reversed some loops to use decrementing counter * */ -/* * - combined init functions into one function * */ -/* * 1.0.6 - 07/10/2003 - G.R-P * */ -/* * - replaced nested switches with simple init setup function * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * * */ -/* * 1.0.8 - 03/31/2004 - G.Juyn * */ -/* * - fixed problem with PAST usage where source > dest * */ -/* * 1.0.8 - 05/04/2004 - G.R-P. * */ -/* * - fixed misplaced 16-bit conditionals * */ -/* * * */ -/* * 1.0.9 - 09/18/2004 - G.R-P. * */ -/* * - revised some SKIPCHUNK conditionals * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 07/06/2005 - G.R-P. * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * 1.0.10 - 12/28/2005 - G.R-P. * */ -/* * - added missing SKIPCHUNK_MAGN conditional * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - fixed several compiler warnings * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_chunks.h" -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_memory.h" -#include "libmng_zlib.h" -#include "libmng_jpeg.h" -#include "libmng_cms.h" -#include "libmng_pixels.h" -#include "libmng_display.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode set_delay (mng_datap pData, - mng_uint32 iInterval) -{ - if (!iInterval) /* at least 1 msec please! */ - iInterval = 1; - - if (pData->bRunning) /* only when really displaying */ - if (!pData->fSettimer ((mng_handle)pData, iInterval)) - MNG_ERROR (pData, MNG_APPTIMERERROR); - -#ifdef MNG_SUPPORT_DYNAMICMNG - if ((!pData->bDynamic) || (pData->bRunning)) -#else - if (pData->bRunning) -#endif - pData->bTimerset = MNG_TRUE; /* and indicate so */ - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_uint32 calculate_delay (mng_datap pData, - mng_uint32 iDelay) -{ - mng_uint32 iTicks = pData->iTicks; - mng_uint32 iWaitfor = 1; /* default non-MNG delay */ - - if (!iTicks) /* tick_count not specified ? */ - if (pData->eImagetype == mng_it_mng) - iTicks = 1000; - - if (iTicks) - { - switch (pData->iSpeed) /* honor speed modifier */ - { - case mng_st_fast : - { - iWaitfor = (mng_uint32)(( 500 * iDelay) / iTicks); - break; - } - case mng_st_slow : - { - iWaitfor = (mng_uint32)((3000 * iDelay) / iTicks); - break; - } - case mng_st_slowest : - { - iWaitfor = (mng_uint32)((8000 * iDelay) / iTicks); - break; - } - default : - { - iWaitfor = (mng_uint32)((1000 * iDelay) / iTicks); - } - } - } - - return iWaitfor; -} - -/* ************************************************************************** */ -/* * * */ -/* * Progressive display refresh - does the call to the refresh callback * */ -/* * and sets the timer to allow the app to perform the actual refresh to * */ -/* * the screen (eg. process its main message-loop) * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_refresh (mng_datap pData, - mng_uint32 iInterval) -{ - { /* let the app refresh first ? */ - if ((pData->bRunning) && (!pData->bSkipping) && - (pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright)) - { - if (!pData->fRefresh (((mng_handle)pData), - pData->iUpdateleft, pData->iUpdatetop, - pData->iUpdateright - pData->iUpdateleft, - pData->iUpdatebottom - pData->iUpdatetop)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iUpdateleft = 0; /* reset update-region */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; /* reset refreshneeded indicator */ - pData->bNeedrefresh = MNG_FALSE; - /* interval requested ? */ - if ((!pData->bFreezing) && (iInterval)) - { /* setup the timer */ - mng_retcode iRetcode = set_delay (pData, iInterval); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Generic display routines * */ -/* * * */ -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode interframe_delay (mng_datap pData) -{ - mng_uint32 iWaitfor = 0; - mng_uint32 iInterval; - mng_uint32 iRuninterval; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_START); -#endif - - { -#ifndef MNG_SKIPCHUNK_FRAM - if (pData->iFramedelay > 0) /* real delay ? */ - { /* let the app refresh first ? */ - if ((pData->bRunning) && (!pData->bSkipping) && - (pData->iUpdatetop < pData->iUpdatebottom) && (pData->iUpdateleft < pData->iUpdateright)) - if (!pData->fRefresh (((mng_handle)pData), - pData->iUpdateleft, pData->iUpdatetop, - pData->iUpdateright - pData->iUpdateleft, - pData->iUpdatebottom - pData->iUpdatetop)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - pData->iUpdateleft = 0; /* reset update-region */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; /* reset refreshneeded indicator */ - pData->bNeedrefresh = MNG_FALSE; - -#ifndef MNG_SKIPCHUNK_TERM - if (pData->bOnlyfirstframe) /* only processing first frame after TERM ? */ - { - pData->iFramesafterTERM++; - /* did we do a frame yet ? */ - if (pData->iFramesafterTERM > 1) - { /* then that's it; just stop right here ! */ - pData->pCurraniobj = MNG_NULL; - pData->bRunning = MNG_FALSE; - - return MNG_NOERROR; - } - } -#endif - - if (pData->fGettickcount) - { /* get current tickcount */ - pData->iRuntime = pData->fGettickcount ((mng_handle)pData); - /* calculate interval since last sync-point */ - if (pData->iRuntime < pData->iSynctime) - iRuninterval = pData->iRuntime + ~pData->iSynctime + 1; - else - iRuninterval = pData->iRuntime - pData->iSynctime; - /* calculate actual run-time */ - if (pData->iRuntime < pData->iStarttime) - pData->iRuntime = pData->iRuntime + ~pData->iStarttime + 1; - else - pData->iRuntime = pData->iRuntime - pData->iStarttime; - } - else - { - iRuninterval = 0; - } - - iWaitfor = calculate_delay (pData, pData->iFramedelay); - - if (iWaitfor > iRuninterval) /* delay necessary ? */ - iInterval = iWaitfor - iRuninterval; - else - iInterval = 1; /* force app to process messageloop */ - /* set the timer ? */ - if (((pData->bRunning) || (pData->bSearching) || (pData->bReading)) && - (!pData->bSkipping)) - { - iRetcode = set_delay (pData, iInterval); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - - if (!pData->bSkipping) /* increase frametime in advance */ - pData->iFrametime = pData->iFrametime + iWaitfor; - /* setup for next delay */ - pData->iFramedelay = pData->iNextdelay; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INTERFRAME_DELAY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL void set_display_routine (mng_datap pData) -{ /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - switch (pData->iCanvasstyle) /* determine display routine */ - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb8; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGBA8 - case MNG_CANVAS_RGBA8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba8; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGBA8_PM - case MNG_CANVAS_RGBA8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_rgba8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_ARGB8 - case MNG_CANVAS_ARGB8 : { pData->fDisplayrow = (mng_fptr)mng_display_argb8; break; } -#endif -#ifndef MNG_SKIPCANVAS_ARGB8_PM - case MNG_CANVAS_ARGB8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_argb8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB8_A8 - case MNG_CANVAS_RGB8_A8 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb8_a8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgrx8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRA8 - case MNG_CANVAS_BGRA8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRA8_PM - case MNG_CANVAS_BGRA8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_bgra8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_ABGR8 - case MNG_CANVAS_ABGR8 : { pData->fDisplayrow = (mng_fptr)mng_display_abgr8; break; } -#endif -#ifndef MNG_SKIPCANVAS_ABGR8_PM - case MNG_CANVAS_ABGR8_PM: { pData->fDisplayrow = (mng_fptr)mng_display_abgr8_pm; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb565; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGBA565 - case MNG_CANVAS_RGBA565 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba565; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr565; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRA565 - case MNG_CANVAS_BGRA565 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra565; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR565_A8 - case MNG_CANVAS_BGR565_A8 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr565_a8; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB555 - case MNG_CANVAS_RGB555 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb555; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR555 - case MNG_CANVAS_BGR555 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr555; break; } -#endif - -#ifndef MNG_NO_16BIT_SUPPORT -/* case MNG_CANVAS_RGB16 : { pData->fDisplayrow = (mng_fptr)mng_display_rgb16; break; } */ -/* case MNG_CANVAS_RGBA16 : { pData->fDisplayrow = (mng_fptr)mng_display_rgba16; break; } */ -/* case MNG_CANVAS_ARGB16 : { pData->fDisplayrow = (mng_fptr)mng_display_argb16; break; } */ -/* case MNG_CANVAS_BGR16 : { pData->fDisplayrow = (mng_fptr)mng_display_bgr16; break; } */ -/* case MNG_CANVAS_BGRA16 : { pData->fDisplayrow = (mng_fptr)mng_display_bgra16; break; } */ -/* case MNG_CANVAS_ABGR16 : { pData->fDisplayrow = (mng_fptr)mng_display_abgr16; break; } */ -#endif -/* case MNG_CANVAS_INDEX8 : { pData->fDisplayrow = (mng_fptr)mng_display_index8; break; } */ -/* case MNG_CANVAS_INDEXA8 : { pData->fDisplayrow = (mng_fptr)mng_display_indexa8; break; } */ -/* case MNG_CANVAS_AINDEX8 : { pData->fDisplayrow = (mng_fptr)mng_display_aindex8; break; } */ -/* case MNG_CANVAS_GRAY8 : { pData->fDisplayrow = (mng_fptr)mng_display_gray8; break; } */ -/* case MNG_CANVAS_AGRAY8 : { pData->fDisplayrow = (mng_fptr)mng_display_agray8; break; } */ -/* case MNG_CANVAS_GRAYA8 : { pData->fDisplayrow = (mng_fptr)mng_display_graya8; break; } */ -#ifndef MNG_NO_16BIT_SUPPORT -/* case MNG_CANVAS_GRAY16 : { pData->fDisplayrow = (mng_fptr)mng_display_gray16; break; } */ -/* case MNG_CANVAS_GRAYA16 : { pData->fDisplayrow = (mng_fptr)mng_display_graya16; break; } */ -/* case MNG_CANVAS_AGRAY16 : { pData->fDisplayrow = (mng_fptr)mng_display_agray16; break; } */ -#endif -/* case MNG_CANVAS_DX15 : { pData->fDisplayrow = (mng_fptr)mng_display_dx15; break; } */ -/* case MNG_CANVAS_DX16 : { pData->fDisplayrow = (mng_fptr)mng_display_dx16; break; } */ - } - } - - return; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode load_bkgdlayer (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_START); -#endif - /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - mng_int32 iY; - mng_retcode iRetcode; - mng_bool bColorcorr = MNG_FALSE; - /* save values */ - mng_int32 iDestl = pData->iDestl; - mng_int32 iDestr = pData->iDestr; - mng_int32 iDestt = pData->iDestt; - mng_int32 iDestb = pData->iDestb; - mng_int32 iSourcel = pData->iSourcel; - mng_int32 iSourcer = pData->iSourcer; - mng_int32 iSourcet = pData->iSourcet; - mng_int32 iSourceb = pData->iSourceb; - mng_int8 iPass = pData->iPass; - mng_int32 iRow = pData->iRow; - mng_int32 iRowinc = pData->iRowinc; - mng_int32 iCol = pData->iCol; - mng_int32 iColinc = pData->iColinc; - mng_int32 iRowsamples = pData->iRowsamples; - mng_int32 iRowsize = pData->iRowsize; - mng_uint8p pPrevrow = pData->pPrevrow; - mng_uint8p pRGBArow = pData->pRGBArow; - mng_bool bIsRGBA16 = pData->bIsRGBA16; - mng_bool bIsOpaque = pData->bIsOpaque; - mng_fptr fCorrectrow = pData->fCorrectrow; - mng_fptr fDisplayrow = pData->fDisplayrow; - mng_fptr fRetrieverow = pData->fRetrieverow; - mng_objectp pCurrentobj = pData->pCurrentobj; - mng_objectp pRetrieveobj = pData->pRetrieveobj; - - pData->iDestl = 0; /* determine clipping region */ - pData->iDestt = 0; - pData->iDestr = pData->iWidth; - pData->iDestb = pData->iHeight; - -#ifndef MNG_SKIPCHUNK_FRAM - if (pData->bFrameclipping) /* frame clipping specified ? */ - { - pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl); - pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt); - pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb); - } -#endif - /* anything to clear ? */ - if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt)) - { - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */ - pData->bIsOpaque = MNG_TRUE; - - pData->iSourcel = 0; /* source relative to destination */ - pData->iSourcer = pData->iDestr - pData->iDestl; - pData->iSourcet = 0; - pData->iSourceb = pData->iDestb - pData->iDestt; - - set_display_routine (pData); /* determine display routine */ - /* default restore using preset BG color */ - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgcolor; - -#ifndef MNG_SKIPCHUNK_bKGD - if (((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng)) && - (pData->bUseBKGD)) - { /* prefer bKGD in PNG/JNG */ - if (!pData->pCurrentobj) - pData->pCurrentobj = pData->pObjzero; - - if (((mng_imagep)pData->pCurrentobj)->pImgbuf->bHasBKGD) - { - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bkgd; - bColorcorr = MNG_TRUE; - } - } -#endif - - if (pData->fGetbkgdline) /* background-canvas-access callback set ? */ - { - switch (pData->iBkgdstyle) - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgrx8; break; } -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr565; break; } -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb565; break; } -#endif -#ifndef MNG_NO_16BIT_SUPPORT - /* case MNG_CANVAS_RGB16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_rgb16; break; } */ - /* case MNG_CANVAS_BGR16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_bgr16; break; } */ -#endif - /* case MNG_CANVAS_INDEX8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_index8; break; } */ - /* case MNG_CANVAS_GRAY8 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_gray8; break; } */ -#ifndef MNG_NO_16BIT_SUPPORT - /* case MNG_CANVAS_GRAY16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_gray16; break; } */ -#endif - /* case MNG_CANVAS_DX15 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_dx15; break; } */ - /* case MNG_CANVAS_DX16 : { pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_dx16; break; } */ - } - } - -#ifndef MNG_SKIPCHUNK_BACK - if (pData->bHasBACK) - { /* background image ? */ - if ((pData->iBACKmandatory & 0x02) && (pData->iBACKimageid)) - { - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_backcolor; - bColorcorr = MNG_TRUE; - } - else /* background color ? */ - if (pData->iBACKmandatory & 0x01) - { - pData->fRestbkgdrow = (mng_fptr)mng_restore_bkgd_backcolor; - bColorcorr = MNG_TRUE; - } - } -#endif - - pData->fCorrectrow = MNG_NULL; /* default no color-correction */ - - if (bColorcorr) /* do we have to do color-correction ? */ - { -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_TRUE, MNG_FALSE, MNG_FALSE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - } - /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iDestt; /* this is where we start */ - iRetcode = MNG_NOERROR; /* so far, so good */ - - while ((!iRetcode) && (iY < pData->iDestb)) - { /* restore a background row */ - iRetcode = ((mng_restbkgdrow)pData->fRestbkgdrow) (pData); - /* color correction ? */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* so... display it */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - if (bColorcorr) /* did we do color-correction ? */ - { - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif -#ifndef MNG_SKIPCHUNK_BACK - /* background image ? */ - if ((pData->bHasBACK) && (pData->iBACKmandatory & 0x02) && (pData->iBACKimageid)) - { - mng_imagep pImage; - /* let's find that object then */ - pData->pRetrieveobj = mng_find_imageobject (pData, pData->iBACKimageid); - pImage = (mng_imagep)pData->pRetrieveobj; - /* exists, viewable and visible ? */ - if ((pImage) && (pImage->bViewable) && (pImage->bVisible)) - { /* will it fall within the target region ? */ - if ((pImage->iPosx < pData->iDestr) && (pImage->iPosy < pData->iDestb) && - ((pData->iBACKtile) || - ((pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth >= pData->iDestl) && - (pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight >= pData->iDestt) )) && - ((!pImage->bClipped) || - ((pImage->iClipl <= pImage->iClipr) && (pImage->iClipt <= pImage->iClipb) && - (pImage->iClipl < pData->iDestr) && (pImage->iClipr >= pData->iDestl) && - (pImage->iClipt < pData->iDestb) && (pImage->iClipb >= pData->iDestt) ))) - { /* right; we've got ourselves something to do */ - if (pImage->bClipped) /* clip output region with image's clipping region ? */ - { - if (pImage->iClipl > pData->iDestl) - pData->iDestl = pImage->iClipl; - if (pImage->iClipr < pData->iDestr) - pData->iDestr = pImage->iClipr; - if (pImage->iClipt > pData->iDestt) - pData->iDestt = pImage->iClipt; - if (pImage->iClipb < pData->iDestb) - pData->iDestb = pImage->iClipb; - } - /* image offset does some extra clipping too ! */ - if (pImage->iPosx > pData->iDestl) - pData->iDestl = pImage->iPosx; - if (pImage->iPosy > pData->iDestt) - pData->iDestt = pImage->iPosy; - - if (!pData->iBACKtile) /* without tiling further clipping is needed */ - { - if (pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth < pData->iDestr) - pData->iDestr = pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth; - if (pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight < pData->iDestb) - pData->iDestb = pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight; - } - - pData->iSourcel = 0; /* source relative to destination */ - pData->iSourcer = pData->iDestr - pData->iDestl; - pData->iSourcet = 0; - pData->iSourceb = pData->iDestb - pData->iDestt; - /* 16-bit background ? */ - -#ifdef MNG_NO_16BIT_SUPPORT - pData->bIsRGBA16 = MNG_FALSE; -#else - pData->bIsRGBA16 = (mng_bool)(pImage->pImgbuf->iBitdepth > 8); -#endif - /* let restore routine know the offsets !!! */ - pData->iBackimgoffsx = pImage->iPosx; - pData->iBackimgoffsy = pImage->iPosy; - pData->iBackimgwidth = pImage->pImgbuf->iWidth; - pData->iBackimgheight = pImage->pImgbuf->iHeight; - pData->iRow = 0; /* start at the top again !! */ - /* determine background object retrieval routine */ - switch (pImage->pImgbuf->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8; - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - } - -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - /* get temporary row-buffers */ - MNG_ALLOC (pData, pData->pPrevrow, pData->iRowsize); - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iDestt; /* this is where we start */ - iRetcode = MNG_NOERROR; /* so far, so good */ - - while ((!iRetcode) && (iY < pData->iDestb)) - { /* restore a background row */ - iRetcode = mng_restore_bkgd_backimage (pData); - /* color correction ? */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* so... display it */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop temporary row-buffers */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - MNG_FREE (pData, pData->pPrevrow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - } - } -#endif - } - - pData->iDestl = iDestl; /* restore values */ - pData->iDestr = iDestr; - pData->iDestt = iDestt; - pData->iDestb = iDestb; - pData->iSourcel = iSourcel; - pData->iSourcer = iSourcer; - pData->iSourcet = iSourcet; - pData->iSourceb = iSourceb; - pData->iPass = iPass; - pData->iRow = iRow; - pData->iRowinc = iRowinc; - pData->iCol = iCol; - pData->iColinc = iColinc; - pData->iRowsamples = iRowsamples; - pData->iRowsize = iRowsize; - pData->pPrevrow = pPrevrow; - pData->pRGBArow = pRGBArow; - pData->bIsRGBA16 = bIsRGBA16; - pData->bIsOpaque = bIsOpaque; - pData->fCorrectrow = fCorrectrow; - pData->fDisplayrow = fDisplayrow; - pData->fRetrieverow = fRetrieverow; - pData->pCurrentobj = pCurrentobj; - pData->pRetrieveobj = pRetrieveobj; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_LOAD_BKGDLAYER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode clear_canvas (mng_datap pData) -{ - mng_int32 iY; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_START); -#endif - - pData->iDestl = 0; /* clipping region is full canvas! */ - pData->iDestt = 0; - pData->iDestr = pData->iWidth; - pData->iDestb = pData->iHeight; - - pData->iSourcel = 0; /* source is same as destination */ - pData->iSourcer = pData->iWidth; - pData->iSourcet = 0; - pData->iSourceb = pData->iHeight; - - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->bIsRGBA16 = MNG_FALSE; /* let's keep it simple ! */ - pData->bIsOpaque = MNG_TRUE; - - set_display_routine (pData); /* determine display routine */ - /* get a temporary row-buffer */ - /* it's transparent black by default!! */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iDestt; /* this is where we start */ - iRetcode = MNG_NOERROR; /* so far, so good */ - - while ((!iRetcode) && (iY < pData->iDestb)) - { /* clear a row then */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) - iRetcode = mng_next_row (pData); /* adjust variables for next row */ - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEAR_CANVAS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode next_frame (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_START); -#endif - - if (!pData->iBreakpoint) /* no previous break here ? */ - { -#ifndef MNG_SKIPCHUNK_FRAM - mng_uint8 iOldmode = pData->iFramemode; - /* interframe delay required ? */ - if ((iOldmode == 2) || (iOldmode == 4)) - { - if ((pData->iFrameseq) && (iFramemode != 1) && (iFramemode != 3)) - iRetcode = interframe_delay (pData); - else - pData->iFramedelay = pData->iNextdelay; - } - else - { /* delay before inserting background layer? */ - if ((pData->bFramedone) && (iFramemode == 4)) - iRetcode = interframe_delay (pData); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* now we'll assume we're in the next frame! */ - if (iFramemode) /* save the new framing mode ? */ - { - pData->iFRAMmode = iFramemode; - pData->iFramemode = iFramemode; - } - else /* reload default */ - pData->iFramemode = pData->iFRAMmode; - - if (iChangedelay) /* delay changed ? */ - { - pData->iNextdelay = iDelay; /* for *after* next subframe */ - - if ((iOldmode == 2) || (iOldmode == 4)) - pData->iFramedelay = pData->iFRAMdelay; - - if (iChangedelay == 2) /* also overall ? */ - pData->iFRAMdelay = iDelay; - } - else - { /* reload default */ - pData->iNextdelay = pData->iFRAMdelay; - } - - if (iChangetimeout) /* timeout changed ? */ - { /* for next subframe */ - pData->iFrametimeout = iTimeout; - - if ((iChangetimeout == 2) || /* also overall ? */ - (iChangetimeout == 4) || - (iChangetimeout == 6) || - (iChangetimeout == 8)) - pData->iFRAMtimeout = iTimeout; - } - else /* reload default */ - pData->iFrametimeout = pData->iFRAMtimeout; - - if (iChangeclipping) /* clipping changed ? */ - { - pData->bFrameclipping = MNG_TRUE; - - if (!iCliptype) /* absolute ? */ - { - pData->iFrameclipl = iClipl; - pData->iFrameclipr = iClipr; - pData->iFrameclipt = iClipt; - pData->iFrameclipb = iClipb; - } - else /* relative */ - { - pData->iFrameclipl = pData->iFrameclipl + iClipl; - pData->iFrameclipr = pData->iFrameclipr + iClipr; - pData->iFrameclipt = pData->iFrameclipt + iClipt; - pData->iFrameclipb = pData->iFrameclipb + iClipb; - } - - if (iChangeclipping == 2) /* also overall ? */ - { - pData->bFRAMclipping = MNG_TRUE; - - if (!iCliptype) /* absolute ? */ - { - pData->iFRAMclipl = iClipl; - pData->iFRAMclipr = iClipr; - pData->iFRAMclipt = iClipt; - pData->iFRAMclipb = iClipb; - } - else /* relative */ - { - pData->iFRAMclipl = pData->iFRAMclipl + iClipl; - pData->iFRAMclipr = pData->iFRAMclipr + iClipr; - pData->iFRAMclipt = pData->iFRAMclipt + iClipt; - pData->iFRAMclipb = pData->iFRAMclipb + iClipb; - } - } - } - else - { /* reload defaults */ - pData->bFrameclipping = pData->bFRAMclipping; - pData->iFrameclipl = pData->iFRAMclipl; - pData->iFrameclipr = pData->iFRAMclipr; - pData->iFrameclipt = pData->iFRAMclipt; - pData->iFrameclipb = pData->iFRAMclipb; - } -#endif - } - - if (!pData->bTimerset) /* timer still off ? */ - { - if ( -#ifndef MNG_SKIPCHUNK_FRAM - (pData->iFramemode == 4) || /* insert background layer after a new frame */ -#endif - (!pData->iLayerseq)) /* and certainly before the very first layer */ - iRetcode = load_bkgdlayer (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->iFrameseq++; /* count the frame ! */ - pData->bFramedone = MNG_TRUE; /* and indicate we've done one */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_FRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode next_layer (mng_datap pData) -{ - mng_imagep pImage; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - if (!pData->iBreakpoint) /* no previous break here ? */ - { /* interframe delay required ? */ - if ((pData->eImagetype == mng_it_mng) && (pData->iLayerseq) && - ((pData->iFramemode == 1) || (pData->iFramemode == 3))) - iRetcode = interframe_delay (pData); - else - pData->iFramedelay = pData->iNextdelay; - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - - if (!pData->bTimerset) /* timer still off ? */ - { - if (!pData->iLayerseq) /* restore background for the very first layer ? */ - { /* wait till IDAT/JDAT for PNGs & JNGs !!! */ - if ((pData->eImagetype == mng_it_png) || (pData->eImagetype == mng_it_jng)) - pData->bRestorebkgd = MNG_TRUE; - else - { /* for MNG we do it right away */ - iRetcode = load_bkgdlayer (pData); - pData->iLayerseq++; /* and it counts as a layer then ! */ - } - } -#ifndef MNG_SKIPCHUNK_FRAM - else - if (pData->iFramemode == 3) /* restore background for each layer ? */ - iRetcode = load_bkgdlayer (pData); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing a delta-image ? */ - pImage = (mng_imagep)pData->pDeltaImage; - else -#endif - pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* not an active object ? */ - pImage = (mng_imagep)pData->pObjzero; - /* determine display rectangle */ - pData->iDestl = MAX_COORD ((mng_int32)0, pImage->iPosx); - pData->iDestt = MAX_COORD ((mng_int32)0, pImage->iPosy); - /* is it a valid buffer ? */ - if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight)) - { - pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth, - pImage->iPosx + (mng_int32)pImage->pImgbuf->iWidth ); - pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight, - pImage->iPosy + (mng_int32)pImage->pImgbuf->iHeight); - } - else /* it's a single image ! */ - { - pData->iDestr = MIN_COORD ((mng_int32)pData->iWidth, - (mng_int32)pData->iDatawidth ); - pData->iDestb = MIN_COORD ((mng_int32)pData->iHeight, - (mng_int32)pData->iDataheight); - } - -#ifndef MNG_SKIPCHUNK_FRAM - if (pData->bFrameclipping) /* frame clipping specified ? */ - { - pData->iDestl = MAX_COORD (pData->iDestl, pData->iFrameclipl); - pData->iDestt = MAX_COORD (pData->iDestt, pData->iFrameclipt); - pData->iDestr = MIN_COORD (pData->iDestr, pData->iFrameclipr); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iFrameclipb); - } -#endif - - if (pImage->bClipped) /* is the image clipped itself ? */ - { - pData->iDestl = MAX_COORD (pData->iDestl, pImage->iClipl); - pData->iDestt = MAX_COORD (pData->iDestt, pImage->iClipt); - pData->iDestr = MIN_COORD (pData->iDestr, pImage->iClipr); - pData->iDestb = MIN_COORD (pData->iDestb, pImage->iClipb); - } - /* determine source starting point */ - pData->iSourcel = MAX_COORD ((mng_int32)0, pData->iDestl - pImage->iPosx); - pData->iSourcet = MAX_COORD ((mng_int32)0, pData->iDestt - pImage->iPosy); - - if ((pImage->pImgbuf->iWidth) && (pImage->pImgbuf->iHeight)) - { /* and maximum size */ - pData->iSourcer = MIN_COORD ((mng_int32)pImage->pImgbuf->iWidth, - pData->iSourcel + pData->iDestr - pData->iDestl); - pData->iSourceb = MIN_COORD ((mng_int32)pImage->pImgbuf->iHeight, - pData->iSourcet + pData->iDestb - pData->iDestt); - } - else /* it's a single image ! */ - { - pData->iSourcer = pData->iSourcel + pData->iDestr - pData->iDestl; - pData->iSourceb = pData->iSourcet + pData->iDestb - pData->iDestt; - } - - pData->iLayerseq++; /* count the layer ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_LAYER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_display_image (mng_datap pData, - mng_imagep pImage, - mng_bool bLayeradvanced) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_START); -#endif - /* actively running ? */ -#ifndef MNG_SKIPCHUNK_MAGN - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - if ( (!pData->iBreakpoint) && /* needs magnification ? */ - ( (pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY) ) ) - { - iRetcode = mng_magnify_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } -#endif - - pData->pRetrieveobj = pImage; /* so retrieve-row and color-correction can find it */ - - if (!bLayeradvanced) /* need to advance the layer ? */ - { - mng_imagep pSave = pData->pCurrentobj; - pData->pCurrentobj = pImage; - next_layer (pData); /* advance to next layer */ - pData->pCurrentobj = pSave; - } - /* need to restore the background ? */ - if ((!pData->bTimerset) && (pData->bRestorebkgd)) - { - mng_imagep pSave = pData->pCurrentobj; - pData->pCurrentobj = pImage; - pData->bRestorebkgd = MNG_FALSE; - iRetcode = load_bkgdlayer (pData); - pData->pCurrentobj = pSave; - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->iLayerseq++; /* and it counts as a layer then ! */ - } - /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - if (!pData->bTimerset) /* all systems still go ? */ - { - pData->iBreakpoint = 0; /* let's make absolutely sure... */ - /* anything to display ? */ - if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt)) - { - mng_int32 iY; - - set_display_routine (pData); /* determine display routine */ - /* and image-buffer retrieval routine */ - switch (pImage->pImgbuf->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - - case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8; - pData->bIsOpaque = (mng_bool)(!pImage->pImgbuf->bHasTRNS); - break; - } - - - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - } - - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = pData->iSourcet; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pImage->pImgbuf->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->bIsRGBA16 = MNG_FALSE; - /* adjust for 16-bit object ? */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pImage->pImgbuf->iBitdepth > 8) - { - pData->bIsRGBA16 = MNG_TRUE; - pData->iRowsize = pData->iRowsamples << 3; - } -#endif - - pData->fCorrectrow = MNG_NULL; /* default no color-correction */ - -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - iY = pData->iSourcet; /* this is where we start */ - - while ((!iRetcode) && (iY < pData->iSourceb)) - { /* get a row */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* color correction ? */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* so... display it */ - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* whehehe, this is good ! */ -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_execute_delta_image (mng_datap pData, - mng_imagep pTarget, - mng_imagep pDelta) -{ - mng_imagedatap pBuftarget = pTarget->pImgbuf; - mng_imagedatap pBufdelta = pDelta->pImgbuf; - mng_uint32 iY; - mng_retcode iRetcode; - mng_ptr pSaveRGBA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_START); -#endif - /* actively running ? */ - if (((pData->bRunning) || (pData->bSearching)) && (!pData->bSkipping)) - { - if (pBufdelta->bHasPLTE) /* palette in delta ? */ - { - mng_uint32 iX; - /* new palette larger than old one ? */ - if ((!pBuftarget->bHasPLTE) || (pBuftarget->iPLTEcount < pBufdelta->iPLTEcount)) - pBuftarget->iPLTEcount = pBufdelta->iPLTEcount; - /* it's definitely got a PLTE now */ - pBuftarget->bHasPLTE = MNG_TRUE; - - for (iX = 0; iX < pBufdelta->iPLTEcount; iX++) - { - pBuftarget->aPLTEentries[iX].iRed = pBufdelta->aPLTEentries[iX].iRed; - pBuftarget->aPLTEentries[iX].iGreen = pBufdelta->aPLTEentries[iX].iGreen; - pBuftarget->aPLTEentries[iX].iBlue = pBufdelta->aPLTEentries[iX].iBlue; - } - } - - if (pBufdelta->bHasTRNS) /* cheap transparency in delta ? */ - { - switch (pData->iColortype) /* drop it into the target */ - { - case 0: { /* gray */ - pBuftarget->iTRNSgray = pBufdelta->iTRNSgray; - pBuftarget->iTRNSred = 0; - pBuftarget->iTRNSgreen = 0; - pBuftarget->iTRNSblue = 0; - pBuftarget->iTRNScount = 0; - break; - } - case 2: { /* rgb */ - pBuftarget->iTRNSgray = 0; - pBuftarget->iTRNSred = pBufdelta->iTRNSred; - pBuftarget->iTRNSgreen = pBufdelta->iTRNSgreen; - pBuftarget->iTRNSblue = pBufdelta->iTRNSblue; - pBuftarget->iTRNScount = 0; - break; - } - case 3: { /* indexed */ - pBuftarget->iTRNSgray = 0; - pBuftarget->iTRNSred = 0; - pBuftarget->iTRNSgreen = 0; - pBuftarget->iTRNSblue = 0; - /* existing range smaller than new one ? */ - if ((!pBuftarget->bHasTRNS) || (pBuftarget->iTRNScount < pBufdelta->iTRNScount)) - pBuftarget->iTRNScount = pBufdelta->iTRNScount; - - MNG_COPY (pBuftarget->aTRNSentries, pBufdelta->aTRNSentries, pBufdelta->iTRNScount); - break; - } - } - - pBuftarget->bHasTRNS = MNG_TRUE; /* tell it it's got a tRNS now */ - } - -#ifndef MNG_SKIPCHUNK_bKGD - if (pBufdelta->bHasBKGD) /* bkgd in source ? */ - { /* drop it onto the target */ - pBuftarget->bHasBKGD = MNG_TRUE; - pBuftarget->iBKGDindex = pBufdelta->iBKGDindex; - pBuftarget->iBKGDgray = pBufdelta->iBKGDgray; - pBuftarget->iBKGDred = pBufdelta->iBKGDred; - pBuftarget->iBKGDgreen = pBufdelta->iBKGDgreen; - pBuftarget->iBKGDblue = pBufdelta->iBKGDblue; - } -#endif - - if (pBufdelta->bHasGAMA) /* gamma in source ? */ - { - pBuftarget->bHasGAMA = MNG_TRUE; /* drop it onto the target */ - pBuftarget->iGamma = pBufdelta->iGamma; - } - -#ifndef MNG_SKIPCHUNK_cHRM - if (pBufdelta->bHasCHRM) /* chroma in delta ? */ - { /* drop it onto the target */ - pBuftarget->bHasCHRM = MNG_TRUE; - pBuftarget->iWhitepointx = pBufdelta->iWhitepointx; - pBuftarget->iWhitepointy = pBufdelta->iWhitepointy; - pBuftarget->iPrimaryredx = pBufdelta->iPrimaryredx; - pBuftarget->iPrimaryredy = pBufdelta->iPrimaryredy; - pBuftarget->iPrimarygreenx = pBufdelta->iPrimarygreenx; - pBuftarget->iPrimarygreeny = pBufdelta->iPrimarygreeny; - pBuftarget->iPrimarybluex = pBufdelta->iPrimarybluex; - pBuftarget->iPrimarybluey = pBufdelta->iPrimarybluey; - } -#endif - -#ifndef MNG_SKIPCHUNK_sRGB - if (pBufdelta->bHasSRGB) /* sRGB in delta ? */ - { /* drop it onto the target */ - pBuftarget->bHasSRGB = MNG_TRUE; - pBuftarget->iRenderingintent = pBufdelta->iRenderingintent; - } -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBufdelta->bHasICCP) /* ICC profile in delta ? */ - { - pBuftarget->bHasICCP = MNG_TRUE; /* drop it onto the target */ - - if (pBuftarget->pProfile) /* profile existed ? */ - MNG_FREEX (pData, pBuftarget->pProfile, pBuftarget->iProfilesize); - /* allocate a buffer & copy it */ - MNG_ALLOC (pData, pBuftarget->pProfile, pBufdelta->iProfilesize); - MNG_COPY (pBuftarget->pProfile, pBufdelta->pProfile, pBufdelta->iProfilesize); - /* store its length as well */ - pBuftarget->iProfilesize = pBufdelta->iProfilesize; - } -#endif - /* need to execute delta pixels ? */ - if ((!pData->bDeltaimmediate) && (pData->iDeltatype != MNG_DELTATYPE_NOCHANGE)) - { - pData->fScalerow = MNG_NULL; /* not needed by default */ - - switch (pBufdelta->iBitdepth) /* determine scaling routine */ - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - switch (pBuftarget->iBitdepth) - { - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g2; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g4; break; } - - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g1_g16; break; } -#endif - } - break; - } - - case 2 : { - switch (pBuftarget->iBitdepth) - { - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g1; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g4; break; } - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g2_g16; break; } -#endif - } - break; - } - - case 4 : { - switch (pBuftarget->iBitdepth) - { - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g1; break; } - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g2; break; } - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g4_g16; break; } -#endif - } - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - - case 8 : { - switch (pBufdelta->iColortype) - { - case 0 : ; - case 3 : ; - case 8 : { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g1; break; } - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g2; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fScalerow = (mng_fptr)mng_scale_g8_g16; break; } -#endif - } - break; - } - case 2 : ; - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuftarget->iBitdepth == 16) - pData->fScalerow = (mng_fptr)mng_scale_rgb8_rgb16; -#endif - break; - } - case 4 : ; - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuftarget->iBitdepth == 16) - pData->fScalerow = (mng_fptr)mng_scale_ga8_ga16; -#endif - break; - } - case 6 : ; - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuftarget->iBitdepth == 16) - pData->fScalerow = (mng_fptr)mng_scale_rgba8_rgba16; -#endif - break; - } - } - break; - } - -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - switch (pBufdelta->iColortype) - { - case 0 : ; - case 3 : ; - case 8 : { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g1; break; } - case 2 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g2; break; } - case 4 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fScalerow = (mng_fptr)mng_scale_g16_g8; break; } - } - break; - } - case 2 : ; - case 10 : { - if (pBuftarget->iBitdepth == 8) - pData->fScalerow = (mng_fptr)mng_scale_rgb16_rgb8; - break; - } - case 4 : ; - case 12 : { - if (pBuftarget->iBitdepth == 8) - pData->fScalerow = (mng_fptr)mng_scale_ga16_ga8; - break; - } - case 6 : ; - case 14 : { - if (pBuftarget->iBitdepth == 8) - pData->fScalerow = (mng_fptr)mng_scale_rgba16_rgba8; - break; - } - } - break; - } -#endif - - } - - pData->fDeltarow = MNG_NULL; /* let's assume there's nothing to do */ - - switch (pBuftarget->iColortype) /* determine delta processing routine */ - { - case 0 : ; - case 8 : { /* gray */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) || - (pBufdelta->iColortype == 8)) - { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fDeltarow = (mng_fptr)mng_delta_g1_g1; break; } - case 2 : { pData->fDeltarow = (mng_fptr)mng_delta_g2_g2; break; } - case 4 : { pData->fDeltarow = (mng_fptr)mng_delta_g4_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_g8_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_g16_g16; break; } -#endif - } - } - } - - break; - } - - case 2 : ; - case 10 : { /* rgb */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgb8_rgb8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgb16_rgb16; break; } -#endif - } - } - } - - break; - } - - case 3 : { /* indexed; abuse gray routines */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3)) - { - switch (pBuftarget->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fDeltarow = (mng_fptr)mng_delta_g1_g1; break; } - case 2 : { pData->fDeltarow = (mng_fptr)mng_delta_g2_g2; break; } - case 4 : { pData->fDeltarow = (mng_fptr)mng_delta_g4_g4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_g8_g8; break; } - } - } - } - - break; - } - - case 4 : ; - case 12 : { /* gray + alpha */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 4) || (pBufdelta->iColortype == 12)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_ga8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_ga16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3) || - (pBufdelta->iColortype == 8)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_g8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_g16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_ga8_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_ga16_a16; break; } -#endif - } - } - } - - break; - } - - case 6 : ; - case 14 : { /* rgb + alpha */ - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - if ((pBufdelta->iColortype == 6) || (pBufdelta->iColortype == 14)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgba8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgba16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - { - if ((pBufdelta->iColortype == 2) || (pBufdelta->iColortype == 10)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgb8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgb16; break; } -#endif - } - } - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - { - if ((pBufdelta->iColortype == 0) || (pBufdelta->iColortype == 3)) - { - switch (pBuftarget->iBitdepth) - { - case 8 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba8_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fDeltarow = (mng_fptr)mng_delta_rgba16_a16; break; } -#endif - } - } - } - - break; - } - - } - - if (pData->fDeltarow) /* do we need to take action ? */ - { - pData->iPass = -1; /* setup row dimensions and stuff */ - pData->iRow = pData->iDeltaBlocky; - pData->iRowinc = 1; - pData->iCol = pData->iDeltaBlockx; - pData->iColinc = 1; - pData->iRowsamples = pBufdelta->iWidth; - pData->iRowsize = pBuftarget->iRowsize; - /* indicate where to retrieve & where to store */ - pData->pRetrieveobj = (mng_objectp)pDelta; - pData->pStoreobj = (mng_objectp)pTarget; - - pSaveRGBA = pData->pRGBArow; /* save current temp-buffer! */ - /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, (pBufdelta->iRowsize << 1)); - - iY = 0; /* this is where we start */ - iRetcode = MNG_NOERROR; /* still oke for now */ - - while ((!iRetcode) && (iY < pBufdelta->iHeight)) - { /* get a row */ - mng_uint8p pWork = pBufdelta->pImgdata + (iY * pBufdelta->iRowsize); - - MNG_COPY (pData->pRGBArow, pWork, pBufdelta->iRowsize); - - if (pData->fScalerow) /* scale it (if necessary) */ - iRetcode = ((mng_scalerow)pData->fScalerow) (pData); - - if (!iRetcode) /* and... execute it */ - iRetcode = ((mng_deltarow)pData->fDeltarow) (pData); - - if (!iRetcode) /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREE (pData, pData->pRGBArow, (pBufdelta->iRowsize << 1)); - pData->pRGBArow = pSaveRGBA; /* restore saved temp-buffer! */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - else - MNG_ERROR (pData, MNG_INVALIDDELTA); - - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_EXECUTE_DELTA_IMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_retcode save_state (mng_datap pData) -{ - mng_savedatap pSave; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_START); -#endif - - if (pData->pSavedata) /* sanity check */ - MNG_ERROR (pData, MNG_INTERNALERROR); - /* get a buffer for saving */ - MNG_ALLOC (pData, pData->pSavedata, sizeof (mng_savedata)); - - pSave = pData->pSavedata; /* address it more directly */ - /* and copy global data from the main struct */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - pSave->bHasglobalPLTE = pData->bHasglobalPLTE; - pSave->bHasglobalTRNS = pData->bHasglobalTRNS; - pSave->bHasglobalGAMA = pData->bHasglobalGAMA; - pSave->bHasglobalCHRM = pData->bHasglobalCHRM; - pSave->bHasglobalSRGB = pData->bHasglobalSRGB; - pSave->bHasglobalICCP = pData->bHasglobalICCP; - pSave->bHasglobalBKGD = pData->bHasglobalBKGD; -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifndef MNG_SKIPCHUNK_BACK - pSave->iBACKred = pData->iBACKred; - pSave->iBACKgreen = pData->iBACKgreen; - pSave->iBACKblue = pData->iBACKblue; - pSave->iBACKmandatory = pData->iBACKmandatory; - pSave->iBACKimageid = pData->iBACKimageid; - pSave->iBACKtile = pData->iBACKtile; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pSave->iFRAMmode = pData->iFRAMmode; - pSave->iFRAMdelay = pData->iFRAMdelay; - pSave->iFRAMtimeout = pData->iFRAMtimeout; - pSave->bFRAMclipping = pData->bFRAMclipping; - pSave->iFRAMclipl = pData->iFRAMclipl; - pSave->iFRAMclipr = pData->iFRAMclipr; - pSave->iFRAMclipt = pData->iFRAMclipt; - pSave->iFRAMclipb = pData->iFRAMclipb; -#endif - - pSave->iGlobalPLTEcount = pData->iGlobalPLTEcount; - - MNG_COPY (pSave->aGlobalPLTEentries, pData->aGlobalPLTEentries, sizeof (mng_rgbpaltab)); - - pSave->iGlobalTRNSrawlen = pData->iGlobalTRNSrawlen; - MNG_COPY (pSave->aGlobalTRNSrawdata, pData->aGlobalTRNSrawdata, 256); - - pSave->iGlobalGamma = pData->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - pSave->iGlobalWhitepointx = pData->iGlobalWhitepointx; - pSave->iGlobalWhitepointy = pData->iGlobalWhitepointy; - pSave->iGlobalPrimaryredx = pData->iGlobalPrimaryredx; - pSave->iGlobalPrimaryredy = pData->iGlobalPrimaryredy; - pSave->iGlobalPrimarygreenx = pData->iGlobalPrimarygreenx; - pSave->iGlobalPrimarygreeny = pData->iGlobalPrimarygreeny; - pSave->iGlobalPrimarybluex = pData->iGlobalPrimarybluex; - pSave->iGlobalPrimarybluey = pData->iGlobalPrimarybluey; -#endif - -#ifndef MNG_SKIPCHUNK_sRGB - pSave->iGlobalRendintent = pData->iGlobalRendintent; -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - pSave->iGlobalProfilesize = pData->iGlobalProfilesize; - - if (pSave->iGlobalProfilesize) /* has a profile ? */ - { /* then copy that ! */ - MNG_ALLOC (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize); - MNG_COPY (pSave->pGlobalProfile, pData->pGlobalProfile, pSave->iGlobalProfilesize); - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pSave->iGlobalBKGDred = pData->iGlobalBKGDred; - pSave->iGlobalBKGDgreen = pData->iGlobalBKGDgreen; - pSave->iGlobalBKGDblue = pData->iGlobalBKGDblue; -#endif - - /* freeze current image objects */ - pImage = (mng_imagep)pData->pFirstimgobj; - - while (pImage) - { /* freeze the object AND its buffer */ - pImage->bFrozen = MNG_TRUE; - pImage->pImgbuf->bFrozen = MNG_TRUE; - /* neeeext */ - pImage = (mng_imagep)pImage->sHeader.pNext; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SAVE_STATE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_reset_objzero (mng_datap pData) -{ - mng_imagep pImage = (mng_imagep)pData->pObjzero; - mng_retcode iRetcode = mng_reset_object_details (pData, pImage, 0, 0, 0, - 0, 0, 0, 0, MNG_TRUE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pImage->bVisible = MNG_TRUE; - pImage->bViewable = MNG_TRUE; - pImage->iPosx = 0; - pImage->iPosy = 0; - pImage->bClipped = MNG_FALSE; - pImage->iClipl = 0; - pImage->iClipr = 0; - pImage->iClipt = 0; - pImage->iClipb = 0; -#ifndef MNG_SKIPCHUNK_MAGN - pImage->iMAGN_MethodX = 0; - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode restore_state (mng_datap pData) -{ -#ifndef MNG_SKIPCHUNK_SAVE - mng_savedatap pSave; -#endif - mng_imagep pImage; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_START); -#endif - /* restore object 0 status !!! */ - iRetcode = mng_reset_objzero (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* fresh cycle; fake no frames done yet */ - pData->bFramedone = MNG_FALSE; - -#ifndef MNG_SKIPCHUNK_SAVE - if (pData->pSavedata) /* do we have a saved state ? */ - { - pSave = pData->pSavedata; /* address it more directly */ - /* and copy it back to the main struct */ -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - pData->bHasglobalPLTE = pSave->bHasglobalPLTE; - pData->bHasglobalTRNS = pSave->bHasglobalTRNS; - pData->bHasglobalGAMA = pSave->bHasglobalGAMA; - pData->bHasglobalCHRM = pSave->bHasglobalCHRM; - pData->bHasglobalSRGB = pSave->bHasglobalSRGB; - pData->bHasglobalICCP = pSave->bHasglobalICCP; - pData->bHasglobalBKGD = pSave->bHasglobalBKGD; -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifndef MNG_SKIPCHUNK_BACK - pData->iBACKred = pSave->iBACKred; - pData->iBACKgreen = pSave->iBACKgreen; - pData->iBACKblue = pSave->iBACKblue; - pData->iBACKmandatory = pSave->iBACKmandatory; - pData->iBACKimageid = pSave->iBACKimageid; - pData->iBACKtile = pSave->iBACKtile; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = pSave->iFRAMmode; -/* pData->iFRAMdelay = pSave->iFRAMdelay; */ - pData->iFRAMtimeout = pSave->iFRAMtimeout; - pData->bFRAMclipping = pSave->bFRAMclipping; - pData->iFRAMclipl = pSave->iFRAMclipl; - pData->iFRAMclipr = pSave->iFRAMclipr; - pData->iFRAMclipt = pSave->iFRAMclipt; - pData->iFRAMclipb = pSave->iFRAMclipb; - /* NOOOOOOOOOOOO */ -/* pData->iFramemode = pSave->iFRAMmode; - pData->iFramedelay = pSave->iFRAMdelay; - pData->iFrametimeout = pSave->iFRAMtimeout; - pData->bFrameclipping = pSave->bFRAMclipping; - pData->iFrameclipl = pSave->iFRAMclipl; - pData->iFrameclipr = pSave->iFRAMclipr; - pData->iFrameclipt = pSave->iFRAMclipt; - pData->iFrameclipb = pSave->iFRAMclipb; */ - -/* pData->iNextdelay = pSave->iFRAMdelay; */ - pData->iNextdelay = pData->iFramedelay; -#endif - - pData->iGlobalPLTEcount = pSave->iGlobalPLTEcount; - MNG_COPY (pData->aGlobalPLTEentries, pSave->aGlobalPLTEentries, sizeof (mng_rgbpaltab)); - - pData->iGlobalTRNSrawlen = pSave->iGlobalTRNSrawlen; - MNG_COPY (pData->aGlobalTRNSrawdata, pSave->aGlobalTRNSrawdata, 256); - - pData->iGlobalGamma = pSave->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = pSave->iGlobalWhitepointx; - pData->iGlobalWhitepointy = pSave->iGlobalWhitepointy; - pData->iGlobalPrimaryredx = pSave->iGlobalPrimaryredx; - pData->iGlobalPrimaryredy = pSave->iGlobalPrimaryredy; - pData->iGlobalPrimarygreenx = pSave->iGlobalPrimarygreenx; - pData->iGlobalPrimarygreeny = pSave->iGlobalPrimarygreeny; - pData->iGlobalPrimarybluex = pSave->iGlobalPrimarybluex; - pData->iGlobalPrimarybluey = pSave->iGlobalPrimarybluey; -#endif - - pData->iGlobalRendintent = pSave->iGlobalRendintent; - -#ifndef MNG_SKIPCHUNK_iCCP - pData->iGlobalProfilesize = pSave->iGlobalProfilesize; - - if (pData->iGlobalProfilesize) /* has a profile ? */ - { /* then copy that ! */ - MNG_ALLOC (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - MNG_COPY (pData->pGlobalProfile, pSave->pGlobalProfile, pData->iGlobalProfilesize); - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = pSave->iGlobalBKGDred; - pData->iGlobalBKGDgreen = pSave->iGlobalBKGDgreen; - pData->iGlobalBKGDblue = pSave->iGlobalBKGDblue; -#endif - } - else /* no saved-data; so reset the lot */ -#endif /* SKIPCHUNK_SAVE */ - { -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - pData->bHasglobalPLTE = MNG_FALSE; - pData->bHasglobalTRNS = MNG_FALSE; - pData->bHasglobalGAMA = MNG_FALSE; - pData->bHasglobalCHRM = MNG_FALSE; - pData->bHasglobalSRGB = MNG_FALSE; - pData->bHasglobalICCP = MNG_FALSE; - pData->bHasglobalBKGD = MNG_FALSE; -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifndef MNG_SKIPCHUNK_TERM - if (!pData->bMisplacedTERM) /* backward compatible ugliness !!! */ - { - pData->iBACKred = 0; - pData->iBACKgreen = 0; - pData->iBACKblue = 0; - pData->iBACKmandatory = 0; - pData->iBACKimageid = 0; - pData->iBACKtile = 0; - } -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = 1; -/* pData->iFRAMdelay = 1; */ - pData->iFRAMtimeout = 0x7fffffffl; - pData->bFRAMclipping = MNG_FALSE; - pData->iFRAMclipl = 0; - pData->iFRAMclipr = 0; - pData->iFRAMclipt = 0; - pData->iFRAMclipb = 0; - /* NOOOOOOOOOOOO */ -/* pData->iFramemode = 1; - pData->iFramedelay = 1; - pData->iFrametimeout = 0x7fffffffl; - pData->bFrameclipping = MNG_FALSE; - pData->iFrameclipl = 0; - pData->iFrameclipr = 0; - pData->iFrameclipt = 0; - pData->iFrameclipb = 0; */ - -/* pData->iNextdelay = 1; */ - pData->iNextdelay = pData->iFramedelay; -#endif - - pData->iGlobalPLTEcount = 0; - - pData->iGlobalTRNSrawlen = 0; - - pData->iGlobalGamma = 0; - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = 0; - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; -#endif - - pData->iGlobalRendintent = 0; - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->iGlobalProfilesize) /* free a previous profile ? */ - MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = 0; - pData->iGlobalBKGDgreen = 0; - pData->iGlobalBKGDblue = 0; -#endif - } - -#ifndef MNG_SKIPCHUNK_TERM - if (!pData->bMisplacedTERM) /* backward compatible ugliness !!! */ - { - pImage = (mng_imagep)pData->pFirstimgobj; - /* drop un-frozen image objects */ - while (pImage) - { - mng_imagep pNext = (mng_imagep)pImage->sHeader.pNext; - - if (!pImage->bFrozen) /* is it un-frozen ? */ - { - mng_imagep pPrev = (mng_imagep)pImage->sHeader.pPrev; - - if (pPrev) /* unlink it */ - pPrev->sHeader.pNext = pNext; - else - pData->pFirstimgobj = pNext; - - if (pNext) - pNext->sHeader.pPrev = pPrev; - else - pData->pLastimgobj = pPrev; - - if (pImage->pImgbuf->bFrozen) /* buffer frozen ? */ - { - if (pImage->pImgbuf->iRefcount < 2) - MNG_ERROR (pData, MNG_INTERNALERROR); - /* decrease ref counter */ - pImage->pImgbuf->iRefcount--; - /* just cleanup the object then */ - MNG_FREEX (pData, pImage, sizeof (mng_image)); - } - else - { /* free the image buffer */ - iRetcode = mng_free_imagedataobject (pData, pImage->pImgbuf); - /* and cleanup the object */ - MNG_FREEX (pData, pImage, sizeof (mng_image)); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - - pImage = pNext; /* neeeext */ - } - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_STATE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * General display processing routine * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_process_display (mng_datap pData) -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_START); -#endif - - if (!pData->iBreakpoint) /* not broken previously ? */ - { - if ((pData->iRequestframe) || (pData->iRequestlayer) || (pData->iRequesttime)) - { - pData->bSearching = MNG_TRUE; /* indicate we're searching */ - - iRetcode = clear_canvas (pData); /* make the canvas virgin black ?!? */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* let's start from the top, shall we */ - pData->pCurraniobj = pData->pFirstaniobj; - } - } - - do /* process the objects */ - { - if (pData->bSearching) /* clear timer-flag when searching !!! */ - pData->bTimerset = MNG_FALSE; - /* do we need to finish something first ? */ - if ((pData->iBreakpoint) && (pData->iBreakpoint < 99)) - { - switch (pData->iBreakpoint) /* return to broken display routine */ - { -#ifndef MNG_SKIPCHUNK_FRAM - case 1 : { iRetcode = mng_process_display_fram2 (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_SHOW - case 3 : ; /* same as 4 !!! */ - case 4 : { iRetcode = mng_process_display_show (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_CLON - case 5 : { iRetcode = mng_process_display_clon2 (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_MAGN - case 9 : { iRetcode = mng_process_display_magn2 (pData); break; } - case 10 : { iRetcode = mng_process_display_mend2 (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_PAST - case 11 : { iRetcode = mng_process_display_past2 (pData); break; } -#endif - default : MNG_ERROR (pData, MNG_INTERNALERROR); - } - } - else - { - if (pData->pCurraniobj) - iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj); - } - - if (!pData->bTimerset) /* reset breakpoint flag ? */ - pData->iBreakpoint = 0; - /* can we advance to next object ? */ - if ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait)) - { - pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext; - /* MEND processing to be done ? */ - if ((pData->eImagetype == mng_it_mng) && (!pData->pCurraniobj)) - iRetcode = mng_process_display_mend (pData); - - if (!pData->pCurraniobj) /* refresh after last image ? */ - pData->bNeedrefresh = MNG_TRUE; - } - - if (pData->bSearching) /* are we looking for something ? */ - { - if ((pData->iRequestframe) && (pData->iRequestframe <= pData->iFrameseq)) - { - pData->iRequestframe = 0; /* found the frame ! */ - pData->bSearching = MNG_FALSE; - } - else - if ((pData->iRequestlayer) && (pData->iRequestlayer <= pData->iLayerseq)) - { - pData->iRequestlayer = 0; /* found the layer ! */ - pData->bSearching = MNG_FALSE; - } - else - if ((pData->iRequesttime) && (pData->iRequesttime <= pData->iFrametime)) - { - pData->iRequesttime = 0; /* found the playtime ! */ - pData->bSearching = MNG_FALSE; - } - } - } /* until error or a break or no more objects */ - while ((!iRetcode) && (pData->pCurraniobj) && - (((pData->bRunning) && (!pData->bTimerset)) || (pData->bSearching)) && - (!pData->bSectionwait) && (!pData->bFreezing)); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* refresh needed ? */ - if ((!pData->bTimerset) && (pData->bNeedrefresh)) - { - iRetcode = mng_display_progressive_refresh (pData, 1); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - /* timer break ? */ - if ((pData->bTimerset) && (!pData->iBreakpoint)) - pData->iBreakpoint = 99; - else - if (!pData->bTimerset) - pData->iBreakpoint = 0; /* reset if no timer break */ - - if ((!pData->bTimerset) && (!pData->pCurraniobj)) - pData->bRunning = MNG_FALSE; /* all done now ! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Chunk display processing routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT -png_imgtype mng_png_imgtype(mng_uint8 colortype, mng_uint8 bitdepth) -{ - png_imgtype ret; - switch (bitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1: - { - png_imgtype imgtype[]={png_g1,png_none,png_none,png_idx1}; - ret=imgtype[colortype]; - break; - } - case 2: - { - png_imgtype imgtype[]={png_g2,png_none,png_none,png_idx2}; - ret=imgtype[colortype]; - break; - } - case 4: - { - png_imgtype imgtype[]={png_g4,png_none,png_none,png_idx4}; - ret=imgtype[colortype]; - break; - } -#endif - case 8: - { - png_imgtype imgtype[]={png_g8,png_none,png_rgb8,png_idx8,png_ga8, - png_none,png_rgba8}; - ret=imgtype[colortype]; - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16: - { - png_imgtype imgtype[]={png_g16,png_none,png_rgb16,png_none,png_ga16, - png_none,png_rgba16}; - ret=imgtype[colortype]; - break; - } -#endif - default: - ret=png_none; - break; - } - return (ret); -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - -/* ************************************************************************** */ - -mng_retcode mng_process_display_ihdr (mng_datap pData) -{ /* address the current "object" if any */ - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_START); -#endif - - if (!pData->bHasDHDR) - { - pData->fInitrowproc = MNG_NULL; /* do nothing by default */ - pData->fDisplayrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - pData->pStoreobj = MNG_NULL; - } - - if (!pData->iBreakpoint) /* not previously broken ? */ - { - mng_retcode iRetcode = MNG_NOERROR; - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* is a delta-image ? */ - { - if (pData->iDeltatype == MNG_DELTATYPE_REPLACE) - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pDeltaImage, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth; - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iBitdepth; - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iBitdepth; - - if (!iRetcode) - { /* process immediately if bitdepth & colortype are equal */ - pData->bDeltaimmediate = - (mng_bool)((pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) && - (pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) ); - /* be sure to reset object 0 */ - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - } - } - else -#endif - { - if (pImage) /* update object buffer ? */ - iRetcode = mng_reset_object_details (pData, pImage, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - else - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifndef MNG_NO_DELTA_PNG - if (!pData->bHasDHDR) -#endif - { - if (pImage) /* real object ? */ - pData->pStoreobj = pImage; /* tell the row routines */ - else /* otherwise use object 0 */ - pData->pStoreobj = pData->pObjzero; - -#if !defined(MNG_INCLUDE_MPNG_PROPOSAL) && !defined(MNG_INCLUDE_ANG_PROPOSAL) - if ( /* display "on-the-fly" ? */ -#ifndef MNG_SKIPCHUNK_MAGN - (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) && - (((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) && -#endif - ( (pData->eImagetype == mng_it_png ) || - (((mng_imagep)pData->pStoreobj)->bVisible) ) ) - { - next_layer (pData); /* that's a new layer then ! */ - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 2; - else - { - pData->iBreakpoint = 0; - /* anything to display ? */ - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - } - } -#endif - } - - if (!pData->bTimerset) /* no timer break ? */ - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype=mng_png_imgtype(pData->iColortype,pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - { - switch (pData->iColortype) - { - case 0 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 1; - else - pData->iFilterofs = 2; - - break; - } - case 2 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 3; - else - pData->iFilterofs = 6; - - break; - } - case 3 : { - pData->iFilterofs = 1; - break; - } - case 4 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 2; - else - pData->iFilterofs = 4; - - break; - } - case 6 : { - if (pData->iBitdepth <= 8) - pData->iFilterofs = 4; - else - pData->iFilterofs = 8; - - break; - } - } - } -#endif - -#ifdef FILTER193 /* no adaptive filtering ? */ - if (pData->iFilter == MNG_FILTER_NOFILTER) - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -mng_retcode mng_process_display_mpng (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MPNG, MNG_LC_START); -#endif - - pData->iAlphadepth = 8; /* assume transparency !! */ - - if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */ - { - pData->iWidth = ((mng_mpng_objp)pData->pMPNG)->iFramewidth; - pData->iHeight = ((mng_mpng_objp)pData->pMPNG)->iFrameheight; - - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - next_layer (pData); /* first mPNG layer then ! */ - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -mng_retcode mng_process_display_ang (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_ANG, MNG_LC_START); -#endif - - if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */ - { - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - - next_layer (pData); /* first mPNG layer then ! */ - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_ANG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_idat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_process_display_idat (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_START); -#endif - -#if defined(MNG_INCLUDE_MPNG_PROPOSAL) || defined(MNG_INCLUDE_ANG_PROPOSAL) - if ((pData->eImagetype == mng_it_png) && (pData->iLayerseq <= 0)) - { - if (pData->fProcessheader) /* inform the app (creating the output canvas) ? */ - if (!pData->fProcessheader (((mng_handle)pData), pData->iWidth, pData->iHeight)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - next_layer (pData); /* first regular PNG layer then ! */ - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - set_display_routine (pData); /* then determine display routine */ - } -#endif - - if (pData->bRestorebkgd) /* need to restore the background ? */ - { - pData->bRestorebkgd = MNG_FALSE; - iRetcode = load_bkgdlayer (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->iLayerseq++; /* and it counts as a layer then ! */ - } - - if (pData->fInitrowproc) /* need to initialize row processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - pData->fInitrowproc = MNG_NULL; /* only call this once !!! */ - } - - if ((!iRetcode) && (!pData->bInflating)) - /* initialize inflate */ - iRetcode = mngzlib_inflateinit (pData); - - if (!iRetcode) /* all ok? then inflate, my man */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mngzlib_inflaterows (pData, iRawlen, pRawdata); -#else - iRetcode = mngzlib_inflaterows (pData, pData->iRawlen, pData->pRawdata); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_iend (mng_datap pData) -{ - mng_retcode iRetcode, iRetcode2; - mng_bool bDodisplay = MNG_FALSE; - mng_bool bMagnify = MNG_FALSE; - mng_bool bCleanup = (mng_bool)(pData->iBreakpoint != 0); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_JNG /* progressive+alpha JNG can be displayed now */ - if ( (pData->bHasJHDR ) && - ( (pData->bJPEGprogressive) || (pData->bJPEGprogressive2)) && - ( (pData->eImagetype == mng_it_jng ) || - (((mng_imagep)pData->pStoreobj)->bVisible) ) && - ( (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) ) - bDodisplay = MNG_TRUE; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - if ( (pData->pStoreobj) && /* on-the-fly magnification ? */ - ( (((mng_imagep)pData->pStoreobj)->iMAGN_MethodX) || - (((mng_imagep)pData->pStoreobj)->iMAGN_MethodY) ) ) - bMagnify = MNG_TRUE; -#endif - - if ((pData->bHasBASI) || /* was it a BASI stream */ - (bDodisplay) || /* or should we display the JNG */ -#ifndef MNG_SKIPCHUNK_MAGN - (bMagnify) || /* or should we magnify it */ -#endif - /* or did we get broken here last time ? */ - ((pData->iBreakpoint) && (pData->iBreakpoint != 8))) - { - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - - if (!pImage) /* or was it object 0 ? */ - pImage = (mng_imagep)pData->pObjzero; - /* display it now then ? */ - if ((pImage->bVisible) && (pImage->bViewable)) - { /* ok, so do it */ - iRetcode = mng_display_image (pData, pImage, bDodisplay); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 6; - } - } -#ifndef MNG_NO_DELTA_PNG - else - if ((pData->bHasDHDR) || /* was it a DHDR stream */ - (pData->iBreakpoint == 8)) /* or did we get broken here last time ? */ - { - mng_imagep pImage = (mng_imagep)pData->pDeltaImage; - - if (!pData->iBreakpoint) - { /* perform the delta operations needed */ - iRetcode = mng_execute_delta_image (pData, pImage, (mng_imagep)pData->pObjzero); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - /* display it now then ? */ - if ((pImage->bVisible) && (pImage->bViewable)) - { /* ok, so do it */ - iRetcode = mng_display_image (pData, pImage, MNG_FALSE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 8; - } - } -#endif - - if (!pData->bTimerset) /* can we continue ? */ - { - pData->iBreakpoint = 0; /* clear this flag now ! */ - - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - if (pData->eImagetype == mng_it_mpng) - { - pData->pCurraniobj = pData->pFirstaniobj; - } else -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - if (pData->eImagetype == mng_it_ang) - { - pData->pCurraniobj = pData->pFirstaniobj; - } else -#endif - { /* cleanup object 0 */ - mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - 0, 0, 0, 0, 0, 0, 0, MNG_TRUE); - } - - if (pData->bInflating) /* if we've been inflating */ - { /* cleanup row-processing, */ - iRetcode = mng_cleanup_rowproc (pData); - /* also cleanup inflate! */ - iRetcode2 = mngzlib_inflatefree (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - if (iRetcode2) - return iRetcode2; - } - -#ifdef MNG_INCLUDE_JNG - if (pData->bJPEGdecompress) /* if we've been decompressing JDAT */ - { /* cleanup row-processing, */ - iRetcode = mng_cleanup_rowproc (pData); - /* also cleanup decompress! */ - iRetcode2 = mngjpeg_decompressfree (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - if (iRetcode2) - return iRetcode2; - } - - if (pData->bJPEGdecompress2) /* if we've been decompressing JDAA */ - { /* cleanup row-processing, */ - iRetcode = mng_cleanup_rowproc (pData); - /* also cleanup decompress! */ - iRetcode2 = mngjpeg_decompressfree2 (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - if (iRetcode2) - return iRetcode2; - } -#endif - - if (bCleanup) /* if we got broken last time we need to cleanup */ - { - pData->bHasIHDR = MNG_FALSE; /* IEND signals the end for most ... */ - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; - } - /* if the image was displayed on the fly, */ - /* we'll have to make the app refresh */ - if ((pData->eImagetype != mng_it_mng) && (pData->fDisplayrow)) - pData->bNeedrefresh = MNG_TRUE; - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -/* change in the MNG spec with regards to TERM delay & interframe_delay - as proposed by Adam M. Costello (option 4) and finalized by official vote - during december 2002 / check the 'mng-list' archives for more details */ - -mng_retcode mng_process_display_mend (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DYNAMICMNG - if (pData->bStopafterseek) /* need to stop after this ? */ - { - pData->bFreezing = MNG_TRUE; /* stop processing on this one */ - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->bNeedrefresh = MNG_TRUE; /* make sure the last bit is displayed ! */ - } -#endif - -#ifndef MNG_SKIPCHUNK_TERM - /* TERM processed ? */ - if ((pData->bDisplaying) && (pData->bRunning) && - (pData->bHasTERM) && (pData->pTermaniobj)) - { - mng_retcode iRetcode; - mng_ani_termp pTERM; - /* get the right animation object ! */ - pTERM = (mng_ani_termp)pData->pTermaniobj; - - pData->iIterations++; /* increase iteration count */ - - switch (pTERM->iTermaction) /* determine what to do! */ - { - case 0 : { /* show last frame indefinitly */ - break; /* piece of cake, that is... */ - } - - case 1 : { /* cease displaying anything */ - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - iRetcode = interframe_delay (pData); - /* no interframe_delay? then fake it */ - if ((!iRetcode) && (!pData->bTimerset)) - iRetcode = set_delay (pData, 1); - - if (iRetcode) - return iRetcode; - - pData->iBreakpoint = 10; - break; - } - - case 2 : { /* show first image after TERM */ - iRetcode = restore_state (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* notify the app ? */ - if (pData->fProcessmend) - if (!pData->fProcessmend ((mng_handle)pData, pData->iIterations, 0)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - /* show first frame after TERM chunk */ - pData->pCurraniobj = pTERM; - pData->bOnlyfirstframe = MNG_TRUE; - pData->iFramesafterTERM = 0; - - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - break; - } - - case 3 : { /* repeat */ - if ((pTERM->iItermax) && (pTERM->iItermax < 0x7FFFFFFF)) - pTERM->iItermax--; - - if (pTERM->iItermax) /* go back to TERM ? */ - { /* restore to initial or SAVE state */ - iRetcode = restore_state (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* notify the app ? */ - if (pData->fProcessmend) - if (!pData->fProcessmend ((mng_handle)pData, - pData->iIterations, pTERM->iItermax)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - /* restart from TERM chunk */ - pData->pCurraniobj = pTERM; - - if (pTERM->iDelay) /* set the delay (?) */ - { - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - pData->bNeedrefresh = MNG_TRUE; - } - } - else - { - switch (pTERM->iIteraction) - { - case 0 : { /* show last frame indefinitly */ - break; /* piece of cake, that is... */ - } - - case 1 : { /* cease displaying anything */ - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - iRetcode = interframe_delay (pData); - /* no interframe_delay? then fake it */ - if ((!iRetcode) && (!pData->bTimerset)) - iRetcode = set_delay (pData, 1); - - if (iRetcode) - return iRetcode; - - pData->iBreakpoint = 10; - break; - } - - case 2 : { /* show first image after TERM */ - iRetcode = restore_state (pData); - /* on error bail out */ - if (iRetcode) - return iRetcode; - /* notify the app ? */ - if (pData->fProcessmend) - if (!pData->fProcessmend ((mng_handle)pData, - pData->iIterations, 0)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - /* show first frame after TERM chunk */ - pData->pCurraniobj = pTERM; - pData->bOnlyfirstframe = MNG_TRUE; - pData->iFramesafterTERM = 0; - /* max(1, TERM delay, interframe_delay) */ -#ifndef MNG_SKIPCHUNK_FRAM - if (pTERM->iDelay > pData->iFramedelay) - pData->iFramedelay = pTERM->iDelay; - if (!pData->iFramedelay) - pData->iFramedelay = 1; -#endif - - break; - } - } - } - - break; - } - } - } -#endif /* MNG_SKIPCHUNK_TERM */ - /* just reading ? */ - if ((!pData->bDisplaying) && (pData->bReading)) - if (pData->fProcessmend) /* inform the app ? */ - if (!pData->fProcessmend ((mng_handle)pData, 0, 0)) - MNG_ERROR (pData, MNG_APPMISCERROR); - - if (!pData->pCurraniobj) /* always let the app refresh at the end ! */ - pData->bNeedrefresh = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_mend2 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->bFrameclipping = MNG_FALSE; /* nothing to do but restore the app background */ -#endif - load_bkgdlayer (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MEND, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode mng_process_display_defi (mng_datap pData) -{ - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_START); -#endif - - if (!pData->iDEFIobjectid) /* object id=0 ? */ - { - pImage = (mng_imagep)pData->pObjzero; - - if (pData->bDEFIhasdonotshow) - pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0); - - if (pData->bDEFIhasloca) - { - pImage->iPosx = pData->iDEFIlocax; - pImage->iPosy = pData->iDEFIlocay; - } - - if (pData->bDEFIhasclip) - { - pImage->bClipped = pData->bDEFIhasclip; - pImage->iClipl = pData->iDEFIclipl; - pImage->iClipr = pData->iDEFIclipr; - pImage->iClipt = pData->iDEFIclipt; - pImage->iClipb = pData->iDEFIclipb; - } - - pData->pCurrentobj = 0; /* not a real object ! */ - } - else - { /* already exists ? */ - pImage = (mng_imagep)mng_find_imageobject (pData, pData->iDEFIobjectid); - - if (!pImage) /* if not; create new */ - { - mng_retcode iRetcode = mng_create_imageobject (pData, pData->iDEFIobjectid, - (mng_bool)(pData->iDEFIconcrete == 1), - (mng_bool)(pData->iDEFIdonotshow == 0), - MNG_FALSE, 0, 0, 0, 0, 0, 0, 0, - pData->iDEFIlocax, pData->iDEFIlocay, - pData->bDEFIhasclip, - pData->iDEFIclipl, pData->iDEFIclipr, - pData->iDEFIclipt, pData->iDEFIclipb, - &pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* exists; then set new info */ - if (pData->bDEFIhasdonotshow) - pImage->bVisible = (mng_bool)(pData->iDEFIdonotshow == 0); - - pImage->bViewable = MNG_FALSE; - - if (pData->bDEFIhasloca) - { - pImage->iPosx = pData->iDEFIlocax; - pImage->iPosy = pData->iDEFIlocay; - } - - if (pData->bDEFIhasclip) - { - pImage->bClipped = pData->bDEFIhasclip; - pImage->iClipl = pData->iDEFIclipl; - pImage->iClipr = pData->iDEFIclipr; - pImage->iClipt = pData->iDEFIclipt; - pImage->iClipb = pData->iDEFIclipb; - } - - if (pData->bDEFIhasconcrete) - pImage->pImgbuf->bConcrete = (mng_bool)(pData->iDEFIconcrete == 1); - } - - pData->pCurrentobj = pImage; /* others may want to know this */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable) -#else -mng_retcode mng_process_display_basi (mng_datap pData) -#endif -{ /* address the current "object" if any */ - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_uint8p pWork; - mng_uint32 iX; - mng_imagedatap pBuf; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_START); -#endif - - if (!pImage) /* or is it an "on-the-fly" image ? */ - pImage = (mng_imagep)pData->pObjzero; - /* address the object-buffer */ - pBuf = pImage->pImgbuf; - - pData->fDisplayrow = MNG_NULL; /* do nothing by default */ - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - /* set parms now that they're known */ - iRetcode = mng_reset_object_details (pData, pImage, pData->iDatawidth, - pData->iDataheight, pData->iBitdepth, - pData->iColortype, pData->iCompression, - pData->iFilter, pData->iInterlace, MNG_FALSE); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* save the viewable flag */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->bViewable = (mng_bool)(iViewable == 1); -#else - pImage->bViewable = (mng_bool)(pData->iBASIviewable == 1); -#endif - pBuf->bViewable = pImage->bViewable; - pData->pStoreobj = pImage; /* let row-routines know which object */ - - pWork = pBuf->pImgdata; /* fill the object-buffer with the specified - "color" sample */ - switch (pData->iColortype) /* depending on color_type & bit_depth */ - { - case 0 : { /* gray */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed); -#else - mng_put_uint16 (pWork, pData->iBASIred); -#endif - pWork += 2; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; -#else - *pWork = (mng_uint8)pData->iBASIred; -#endif - pWork++; - } - } - /* force tRNS ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((bHasalpha) && (!iAlpha)) -#else - if ((pData->bBASIhasalpha) && (!pData->iBASIalpha)) -#endif - { - pBuf->bHasTRNS = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->iTRNSgray = iRed; -#else - pBuf->iTRNSgray = pData->iBASIred; -#endif - } - - break; - } - - case 2 : { /* rgb */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed ); - mng_put_uint16 (pWork+2, iGreen); - mng_put_uint16 (pWork+4, iBlue ); -#else - mng_put_uint16 (pWork, pData->iBASIred ); - mng_put_uint16 (pWork+2, pData->iBASIgreen); - mng_put_uint16 (pWork+4, pData->iBASIblue ); -#endif - pWork += 6; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; - *(pWork+1) = (mng_uint8)iGreen; - *(pWork+2) = (mng_uint8)iBlue; -#else - *pWork = (mng_uint8)pData->iBASIred; - *(pWork+1) = (mng_uint8)pData->iBASIgreen; - *(pWork+2) = (mng_uint8)pData->iBASIblue; -#endif - pWork += 3; - } - } - /* force tRNS ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((bHasalpha) && (!iAlpha)) -#else - if ((pData->bBASIhasalpha) && (!pData->iBASIalpha)) -#endif - { - pBuf->bHasTRNS = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->iTRNSred = iRed; - pBuf->iTRNSgreen = iGreen; - pBuf->iTRNSblue = iBlue; -#else - pBuf->iTRNSred = pData->iBASIred; - pBuf->iTRNSgreen = pData->iBASIgreen; - pBuf->iTRNSblue = pData->iBASIblue; -#endif - } - - break; - } - - case 3 : { /* indexed */ - pBuf->bHasPLTE = MNG_TRUE; - - switch (pData->iBitdepth) - { - case 1 : { pBuf->iPLTEcount = 2; break; } - case 2 : { pBuf->iPLTEcount = 4; break; } - case 4 : { pBuf->iPLTEcount = 16; break; } - case 8 : { pBuf->iPLTEcount = 256; break; } - default : { pBuf->iPLTEcount = 1; break; } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->aPLTEentries [0].iRed = (mng_uint8)iRed; - pBuf->aPLTEentries [0].iGreen = (mng_uint8)iGreen; - pBuf->aPLTEentries [0].iBlue = (mng_uint8)iBlue; -#else - pBuf->aPLTEentries [0].iRed = (mng_uint8)pData->iBASIred; - pBuf->aPLTEentries [0].iGreen = (mng_uint8)pData->iBASIgreen; - pBuf->aPLTEentries [0].iBlue = (mng_uint8)pData->iBASIblue; -#endif - - for (iX = 1; iX < pBuf->iPLTEcount; iX++) - { - pBuf->aPLTEentries [iX].iRed = 0; - pBuf->aPLTEentries [iX].iGreen = 0; - pBuf->aPLTEentries [iX].iBlue = 0; - } - /* force tRNS ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((bHasalpha) && (iAlpha < 255)) -#else - if ((pData->bBASIhasalpha) && (pData->iBASIalpha < 255)) -#endif - { - pBuf->bHasTRNS = MNG_TRUE; - pBuf->iTRNScount = 1; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->aTRNSentries [0] = (mng_uint8)iAlpha; -#else - pBuf->aTRNSentries [0] = (mng_uint8)pData->iBASIalpha; -#endif - } - - break; - } - - case 4 : { /* gray+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed); - mng_put_uint16 (pWork+2, iAlpha); -#else - mng_put_uint16 (pWork, pData->iBASIred); - mng_put_uint16 (pWork+2, pData->iBASIalpha); -#endif - pWork += 4; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; - *(pWork+1) = (mng_uint8)iAlpha; -#else - *pWork = (mng_uint8)pData->iBASIred; - *(pWork+1) = (mng_uint8)pData->iBASIalpha; -#endif - pWork += 2; - } - } - - break; - } - - case 6 : { /* rgb+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth == 16) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_put_uint16 (pWork, iRed); - mng_put_uint16 (pWork+2, iGreen); - mng_put_uint16 (pWork+4, iBlue); - mng_put_uint16 (pWork+6, iAlpha); -#else - mng_put_uint16 (pWork, pData->iBASIred); - mng_put_uint16 (pWork+2, pData->iBASIgreen); - mng_put_uint16 (pWork+4, pData->iBASIblue); - mng_put_uint16 (pWork+6, pData->iBASIalpha); -#endif - pWork += 8; - } - } - else -#endif - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iDatawidth * pData->iDataheight; - iX > 0;iX--) -#else - for (iX = 0; iX < pData->iDatawidth * pData->iDataheight; iX++) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - *pWork = (mng_uint8)iRed; - *(pWork+1) = (mng_uint8)iGreen; - *(pWork+2) = (mng_uint8)iBlue; - *(pWork+3) = (mng_uint8)iAlpha; -#else - *pWork = (mng_uint8)pData->iBASIred; - *(pWork+1) = (mng_uint8)pData->iBASIgreen; - *(pWork+2) = (mng_uint8)pData->iBASIblue; - *(pWork+3) = (mng_uint8)pData->iBASIalpha; -#endif - pWork += 4; - } - } - - break; - } - - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype=mng_png_imgtype(pData->iColortype,pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { /* just to accomodate IDAT if it arrives */ - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 - if (pData->iFilter == 0xC0) /* leveling & differing ? */ - { - switch (pData->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 1; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 2; -#endif - - break; - } - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 3; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 6; -#endif - - break; - } - case 3 : { - pData->iFilterofs = 1; - break; - } - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 2; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 4; -#endif - - break; - } - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->iBitdepth <= 8) -#endif - pData->iFilterofs = 4; -#ifndef MNG_NO_16BIT_SUPPORT - else - pData->iFilterofs = 8; -#endif - - break; - } - } - } -#endif - -#ifdef FILTER193 - if (pData->iFilter == 0xC1) /* no adaptive filtering ? */ - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy) -#else -mng_retcode mng_process_display_clon (mng_datap pData) -#endif -{ - mng_imagep pSource, pClone; - mng_bool bVisible, bAbstract; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START); -#endif -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - /* locate the source object first */ - pSource = mng_find_imageobject (pData, iSourceid); - /* check if the clone exists */ - pClone = mng_find_imageobject (pData, iCloneid); -#else - /* locate the source object first */ - pSource = mng_find_imageobject (pData, pData->iCLONsourceid); - /* check if the clone exists */ - pClone = mng_find_imageobject (pData, pData->iCLONcloneid); -#endif - - if (!pSource) /* source must exist ! */ - MNG_ERROR (pData, MNG_OBJECTUNKNOWN); - - if (pClone) /* clone must not exist ! */ - MNG_ERROR (pData, MNG_OBJECTEXISTS); - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (bHasdonotshow) /* DoNotShow flag filled ? */ - bVisible = (mng_bool)(iDonotshow == 0); - else - bVisible = pSource->bVisible; -#else - if (pData->bCLONhasdonotshow) /* DoNotShow flag filled ? */ - bVisible = (mng_bool)(pData->iCLONdonotshow == 0); - else - bVisible = pSource->bVisible; -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - bAbstract = (mng_bool)(iConcrete == 1); -#else - bAbstract = (mng_bool)(pData->iCLONconcrete == 1); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iClonetype) /* determine action to take */ - { - case 0 : { /* full clone */ - iRetcode = mng_clone_imageobject (pData, iCloneid, MNG_FALSE, - bVisible, bAbstract, bHasloca, - iLocationtype, iLocationx, iLocationy, - pSource, &pClone); - break; - } - - case 1 : { /* partial clone */ - iRetcode = mng_clone_imageobject (pData, iCloneid, MNG_TRUE, - bVisible, bAbstract, bHasloca, - iLocationtype, iLocationx, iLocationy, - pSource, &pClone); - break; - } - - case 2 : { /* renumber object */ - iRetcode = mng_renum_imageobject (pData, pSource, iCloneid, - bVisible, bAbstract, bHasloca, - iLocationtype, iLocationx, iLocationy); - pClone = pSource; - break; - } - - } -#else - switch (pData->iCLONclonetype) /* determine action to take */ - { - case 0 : { /* full clone */ - iRetcode = mng_clone_imageobject (pData, pData->iCLONcloneid, MNG_FALSE, - bVisible, bAbstract, - pData->bCLONhasloca, pData->iCLONlocationtype, - pData->iCLONlocationx, pData->iCLONlocationy, - pSource, &pClone); - break; - } - - case 1 : { /* partial clone */ - iRetcode = mng_clone_imageobject (pData, pData->iCLONcloneid, MNG_TRUE, - bVisible, bAbstract, - pData->bCLONhasloca, pData->iCLONlocationtype, - pData->iCLONlocationx, pData->iCLONlocationy, - pSource, &pClone); - break; - } - - case 2 : { /* renumber object */ - iRetcode = mng_renum_imageobject (pData, pSource, pData->iCLONcloneid, - bVisible, bAbstract, - pData->bCLONhasloca, pData->iCLONlocationtype, - pData->iCLONlocationx, pData->iCLONlocationy); - pClone = pSource; - break; - } - - } -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - - /* display on the fly ? */ - if ((pClone->bViewable) && (pClone->bVisible)) - { - pData->pLastclone = pClone; /* remember in case of timer break ! */ - /* display it */ - mng_display_image (pData, pClone, MNG_FALSE); - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 5; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_clon2 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_START); -#endif - /* only called after timer break ! */ - mng_display_image (pData, (mng_imagep)pData->pLastclone, MNG_FALSE); - pData->iBreakpoint = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds) -#else -mng_retcode mng_process_display_disc (mng_datap pData) -#endif -{ - mng_uint32 iX; - mng_imagep pImage; - mng_uint32 iRetcode; -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iCount) /* specific list ? */ -#else - if (pData->iDISCcount) /* specific list ? */ -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_uint16p pWork = pIds; -#else - mng_uint16p pWork = pData->pDISCids; -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifdef MNG_DECREMENT_LOOPS /* iterate the list */ - for (iX = iCount; iX > 0; iX--) -#else - for (iX = 0; iX < iCount; iX++) -#endif -#else -#ifdef MNG_DECREMENT_LOOPS /* iterate the list */ - for (iX = pData->iDISCcount; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iDISCcount; iX++) -#endif -#endif - { - pImage = mng_find_imageobject (pData, *pWork++); - - if (pImage) /* found the object ? */ - { /* then drop it */ - iRetcode = mng_free_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } - else /* empty: drop all un-frozen objects */ - { - mng_imagep pNext = (mng_imagep)pData->pFirstimgobj; - - while (pNext) /* any left ? */ - { - pImage = pNext; - pNext = pImage->sHeader.pNext; - - if (!pImage->bFrozen) /* not frozen ? */ - { /* then drop it */ - iRetcode = mng_free_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_process_display_fram (mng_datap pData) -#endif -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START); -#endif - /* advance a frame then */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = next_frame (pData, iFramemode, iChangedelay, iDelay, - iChangetimeout, iTimeout, iChangeclipping, - iCliptype, iClipl, iClipr, iClipt, iClipb); -#else - iRetcode = next_frame (pData, pData->iTempFramemode, pData->iTempChangedelay, - pData->iTempDelay, pData->iTempChangetimeout, - pData->iTempTimeout, pData->iTempChangeclipping, - pData->iTempCliptype, pData->iTempClipl, pData->iTempClipr, - pData->iTempClipt, pData->iTempClipb); -#endif - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_fram2 (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_START); -#endif - /* again; after the break */ - iRetcode = next_frame (pData, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - pData->iBreakpoint = 0; /* not again! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_move (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey) -#else -mng_retcode mng_process_display_move (mng_datap pData) -#endif -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_START); -#endif - /* iterate the list */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = iFromid; iX <= iToid; iX++) -#else - for (iX = pData->iMOVEfromid; iX <= pData->iMOVEtoid; iX++) -#endif - { - if (!iX) /* object id=0 ? */ - pImage = (mng_imagep)pData->pObjzero; - else - pImage = mng_find_imageobject (pData, iX); - - if (pImage) /* object exists ? */ - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iMovetype) -#else - switch (pData->iMOVEmovetype) -#endif - { - case 0 : { /* absolute */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iPosx = iMovex; - pImage->iPosy = iMovey; -#else - pImage->iPosx = pData->iMOVEmovex; - pImage->iPosy = pData->iMOVEmovey; -#endif - break; - } - case 1 : { /* relative */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iPosx = pImage->iPosx + iMovex; - pImage->iPosy = pImage->iPosy + iMovey; -#else - pImage->iPosx = pImage->iPosx + pData->iMOVEmovex; - pImage->iPosy = pImage->iPosy + pData->iMOVEmovey; -#endif - break; - } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_clip (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_process_display_clip (mng_datap pData) -#endif -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_START); -#endif - /* iterate the list */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = iFromid; iX <= iToid; iX++) -#else - for (iX = pData->iCLIPfromid; iX <= pData->iCLIPtoid; iX++) -#endif - { - if (!iX) /* object id=0 ? */ - pImage = (mng_imagep)pData->pObjzero; - else - pImage = mng_find_imageobject (pData, iX); - - if (pImage) /* object exists ? */ - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iCliptype) -#else - switch (pData->iCLIPcliptype) -#endif - { - case 0 : { /* absolute */ - pImage->bClipped = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iClipl = iClipl; - pImage->iClipr = iClipr; - pImage->iClipt = iClipt; - pImage->iClipb = iClipb; -#else - pImage->iClipl = pData->iCLIPclipl; - pImage->iClipr = pData->iCLIPclipr; - pImage->iClipt = pData->iCLIPclipt; - pImage->iClipb = pData->iCLIPclipb; -#endif - break; - } - case 1 : { /* relative */ - pImage->bClipped = MNG_TRUE; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iClipl = pImage->iClipl + iClipl; - pImage->iClipr = pImage->iClipr + iClipr; - pImage->iClipt = pImage->iClipt + iClipt; - pImage->iClipb = pImage->iClipb + iClipb; -#else - pImage->iClipl = pImage->iClipl + pData->iCLIPclipl; - pImage->iClipr = pImage->iClipr + pData->iCLIPclipr; - pImage->iClipt = pImage->iClipt + pData->iCLIPclipt; - pImage->iClipb = pImage->iClipb + pData->iCLIPclipb; -#endif - break; - } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode mng_process_display_show (mng_datap pData) -{ - mng_int16 iX, iS, iFrom, iTo; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_START); -#endif - - /* TODO: optimization for the cases where "abs (iTo - iFrom)" is rather high; - especially where ((iFrom==1) && (iTo==65535)); eg. an empty SHOW !!! */ - - if (pData->iBreakpoint == 3) /* previously broken during cycle-mode ? */ - { - pImage = mng_find_imageobject (pData, pData->iSHOWnextid); - - if (pImage) /* still there ? */ - mng_display_image (pData, pImage, MNG_FALSE); - - pData->iBreakpoint = 0; /* let's not go through this again! */ - } - else - { - if (pData->iBreakpoint) /* previously broken at other point ? */ - { /* restore last parms */ - iFrom = (mng_int16)pData->iSHOWfromid; - iTo = (mng_int16)pData->iSHOWtoid; - iX = (mng_int16)pData->iSHOWnextid; - iS = (mng_int16)pData->iSHOWskip; - } - else - { /* regular sequence ? */ - if (pData->iSHOWtoid >= pData->iSHOWfromid) - iS = 1; - else /* reverse sequence ! */ - iS = -1; - - iFrom = (mng_int16)pData->iSHOWfromid; - iTo = (mng_int16)pData->iSHOWtoid; - iX = iFrom; - - pData->iSHOWfromid = (mng_uint16)iFrom; - pData->iSHOWtoid = (mng_uint16)iTo; - pData->iSHOWskip = iS; - } - /* cycle mode ? */ - if ((pData->iSHOWmode == 6) || (pData->iSHOWmode == 7)) - { - mng_uint16 iTrigger = 0; - mng_uint16 iFound = 0; - mng_uint16 iPass = 0; - mng_imagep pFound = 0; - - do - { - iPass++; /* lets prevent endless loops when there - are no potential candidates in the list! */ - - if (iS > 0) /* forward ? */ - { - for (iX = iFrom; iX <= iTo; iX += iS) - { - pImage = mng_find_imageobject (pData, (mng_uint16)iX); - - if (pImage) /* object exists ? */ - { - if (iFound) /* already found a candidate ? */ - pImage->bVisible = MNG_FALSE; - else - if (iTrigger) /* found the trigger ? */ - { - pImage->bVisible = MNG_TRUE; - iFound = iX; - pFound = pImage; - } - else - if (pImage->bVisible) /* ok, this is the trigger */ - { - pImage->bVisible = MNG_FALSE; - iTrigger = iX; - } - } - } - } - else - { - for (iX = iFrom; iX >= iTo; iX += iS) - { - pImage = mng_find_imageobject (pData, (mng_uint16)iX); - - if (pImage) /* object exists ? */ - { - if (iFound) /* already found a candidate ? */ - pImage->bVisible = MNG_FALSE; - else - if (iTrigger) /* found the trigger ? */ - { - pImage->bVisible = MNG_TRUE; - iFound = iX; - pFound = pImage; - } - else - if (pImage->bVisible) /* ok, this is the trigger */ - { - pImage->bVisible = MNG_FALSE; - iTrigger = iX; - } - } - } - } - - if (!iTrigger) /* did not find a trigger ? */ - iTrigger = 1; /* then fake it so the first image - gets nominated */ - } /* cycle back to beginning ? */ - while ((iPass < 2) && (iTrigger) && (!iFound)); - - pData->iBreakpoint = 0; /* just a sanity precaution */ - /* display it ? */ - if ((pData->iSHOWmode == 6) && (pFound)) - { - mng_display_image (pData, pFound, MNG_FALSE); - - if (pData->bTimerset) /* timer set ? */ - { - pData->iBreakpoint = 3; - pData->iSHOWnextid = iFound; /* save it for after the break */ - } - } - } - else - { - do - { - pImage = mng_find_imageobject (pData, iX); - - if (pImage) /* object exists ? */ - { - if (pData->iBreakpoint) /* did we get broken last time ? */ - { /* could only happen in the display routine */ - mng_display_image (pData, pImage, MNG_FALSE); - pData->iBreakpoint = 0; /* only once inside this loop please ! */ - } - else - { - switch (pData->iSHOWmode) /* do what ? */ - { - case 0 : { - pImage->bVisible = MNG_TRUE; - mng_display_image (pData, pImage, MNG_FALSE); - break; - } - case 1 : { - pImage->bVisible = MNG_FALSE; - break; - } - case 2 : { - if (pImage->bVisible) - mng_display_image (pData, pImage, MNG_FALSE); - break; - } - case 3 : { - pImage->bVisible = MNG_TRUE; - break; - } - case 4 : { - pImage->bVisible = (mng_bool)(!pImage->bVisible); - if (pImage->bVisible) - mng_display_image (pData, pImage, MNG_FALSE); - break; - } - case 5 : { - pImage->bVisible = (mng_bool)(!pImage->bVisible); - } - } - } - } - - if (!pData->bTimerset) /* next ? */ - iX += iS; - - } /* continue ? */ - while ((!pData->bTimerset) && (((iS > 0) && (iX <= iTo)) || - ((iS < 0) && (iX >= iTo)) )); - - if (pData->bTimerset) /* timer set ? */ - { - pData->iBreakpoint = 4; - pData->iSHOWnextid = iX; /* save for next time */ - } - else - pData->iBreakpoint = 0; - - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_display_save (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_START); -#endif - - iRetcode = save_state (pData); /* save the current state */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_display_seek (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DYNAMICMNG - if (pData->bStopafterseek) /* need to stop after this SEEK ? */ - { - pData->bFreezing = MNG_TRUE; /* stop processing on this one */ - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->bNeedrefresh = MNG_TRUE; /* make sure the last bit is displayed ! */ - } - else -#endif - { /* restore the initial or SAVE state */ - mng_retcode iRetcode = restore_state (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_DYNAMICMNG - /* stop after next SEEK ? */ - if ((pData->bDynamic) || (pData->bRunningevent)) - pData->bStopafterseek = MNG_TRUE; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_jhdr (mng_datap pData) -{ /* address the current "object" if any */ - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_START); -#endif - - if (!pData->bHasDHDR) - { - pData->fInitrowproc = MNG_NULL; /* do nothing by default */ - pData->fDisplayrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - pData->fStorerow2 = MNG_NULL; - pData->fStorerow3 = MNG_NULL; - - pData->pStoreobj = MNG_NULL; /* initialize important work-parms */ - - pData->iJPEGrow = 0; - pData->iJPEGalpharow = 0; - pData->iJPEGrgbrow = 0; - pData->iRowmax = 0; /* so init_rowproc does the right thing ! */ - } - - if (!pData->iBreakpoint) /* not previously broken ? */ - { -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* delta-image ? */ - { - if (pData->iDeltatype == MNG_DELTATYPE_REPLACE) - { - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pDeltaImage, - pData->iDatawidth, pData->iDataheight, - pData->iJHDRimgbitdepth, pData->iJHDRcolortype, - pData->iJHDRalphacompression, pData->iJHDRalphafilter, - pData->iJHDRalphainterlace, MNG_TRUE); - - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth; - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - else - if ((pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - ((mng_imagep)pData->pDeltaImage)->pImgbuf->iPixelsampledepth = pData->iJHDRimgbitdepth; - - } - else -#endif /* MNG_NO_DELTA_PNG */ - { - if (pImage) /* update object buffer ? */ - { - iRetcode = mng_reset_object_details (pData, pImage, - pData->iDatawidth, pData->iDataheight, - pData->iJHDRimgbitdepth, pData->iJHDRcolortype, - pData->iJHDRalphacompression, pData->iJHDRalphafilter, - pData->iJHDRalphainterlace, MNG_TRUE); - - pImage->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth; - pImage->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression; - pImage->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace; - pImage->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - else /* update object 0 */ - { - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iJHDRimgbitdepth, pData->iJHDRcolortype, - pData->iJHDRalphacompression, pData->iJHDRalphafilter, - pData->iJHDRalphainterlace, MNG_TRUE); - - ((mng_imagep)pData->pObjzero)->pImgbuf->iAlphabitdepth = pData->iJHDRalphabitdepth; - ((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRcompression = pData->iJHDRimgcompression; - ((mng_imagep)pData->pObjzero)->pImgbuf->iJHDRinterlace = pData->iJHDRimginterlace; - ((mng_imagep)pData->pObjzero)->pImgbuf->iAlphasampledepth = pData->iJHDRalphabitdepth; - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (!pData->bHasDHDR) - { /* we're always storing a JPEG */ - if (pImage) /* real object ? */ - pData->pStoreobj = pImage; /* tell the row routines */ - else /* otherwise use object 0 */ - pData->pStoreobj = pData->pObjzero; - /* display "on-the-fly" ? */ - if ( -#ifndef MNG_SKIPCHUNK_MAGN - ( ((mng_imagep)pData->pStoreobj)->iMAGN_MethodX == 0) && - ( ((mng_imagep)pData->pStoreobj)->iMAGN_MethodY == 0) && -#endif - ( (pData->eImagetype == mng_it_jng ) || - (((mng_imagep)pData->pStoreobj)->bVisible) ) ) - { - next_layer (pData); /* that's a new layer then ! */ - - pData->iBreakpoint = 0; - - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 7; - else - if (pData->bRunning) /* still running ? */ - { /* anything to display ? */ - if ((pData->iDestr > pData->iDestl) && (pData->iDestb > pData->iDestt)) - { - set_display_routine (pData); /* then determine display routine */ - /* display from the object we store in */ - pData->pRetrieveobj = pData->pStoreobj; - } - } - } - } - - if (!pData->bTimerset) /* no timer break ? */ - { /* default row initialization ! */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->ePng_imgtype=png_none; -#endif - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - - if ((!pData->bHasDHDR) || (pData->iDeltatype == MNG_DELTATYPE_REPLACE)) - { /* 8-bit JPEG ? */ - if (pData->iJHDRimgbitdepth == 8) - { /* intermediate row is 8-bit deep */ - pData->bIsRGBA16 = MNG_FALSE; - pData->iRowsamples = pData->iDatawidth; - - switch (pData->iJHDRcolortype) /* determine pixel processing routines */ - { - case MNG_COLORTYPE_JPEGGRAY : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_g8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - pData->bIsOpaque = MNG_TRUE; - break; - } - case MNG_COLORTYPE_JPEGCOLOR : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_rgb8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - pData->bIsOpaque = MNG_TRUE; - break; - } - case MNG_COLORTYPE_JPEGGRAYA : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_ga8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - pData->bIsOpaque = MNG_FALSE; - break; - } - case MNG_COLORTYPE_JPEGCOLORA : - { - pData->fStorerow2 = (mng_fptr)mng_store_jpeg_rgba8; - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - pData->bIsOpaque = MNG_FALSE; - break; - } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - - /* TODO: 12-bit JPEG */ - /* TODO: 8- + 12-bit JPEG (eg. type=20) */ - - } -#endif - /* possible IDAT alpha-channel ? */ - if (pData->iJHDRalphacompression == MNG_COMPRESSION_DEFLATE) - { - /* determine alpha processing routine */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; -#endif - switch (pData->iJHDRalphabitdepth) - { -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a1_ni; break; } - case 2 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a2_ni; break; } - case 4 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a4_ni; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a8_ni; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fInitrowproc = (mng_fptr)mng_init_jpeg_a16_ni; break; } -#endif -#else -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->ePng_imgtype = png_jpeg_a1; break; } - case 2 : { pData->ePng_imgtype = png_jpeg_a2; break; } - case 4 : { pData->ePng_imgtype = png_jpeg_a4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->ePng_imgtype = png_jpeg_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->ePng_imgtype = png_jpeg_a16; break; } -#endif -#endif - } - } - else /* possible JDAA alpha-channel ? */ - if (pData->iJHDRalphacompression == MNG_COMPRESSION_BASELINEJPEG) - { /* 8-bit JPEG ? */ - if (pData->iJHDRimgbitdepth == 8) - { - if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) - pData->fStorerow3 = (mng_fptr)mng_store_jpeg_g8_alpha; - else - if (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) - pData->fStorerow3 = (mng_fptr)mng_store_jpeg_rgb8_alpha; - } - else - { - /* TODO: 12-bit JPEG with 8-bit JDAA */ - } - } - /* initialize JPEG library */ - iRetcode = mngjpeg_initialize (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* must be alpha add/replace !! */ - if ((pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAADD ) && - (pData->iDeltatype != MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - MNG_ERROR (pData, MNG_INVDELTATYPE); - /* determine alpha processing routine */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; -#endif - switch (pData->iJHDRalphabitdepth) - { -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; break; } - case 2 : { pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; break; } - case 4 : { pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; break; } -#endif -#else -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { pData->ePng_imgtype = png_jpeg_a1; break; } - case 2 : { pData->ePng_imgtype = png_jpeg_a2; break; } - case 4 : { pData->ePng_imgtype = png_jpeg_a4; break; } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { pData->ePng_imgtype = png_jpeg_a8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->ePng_imgtype = png_jpeg_a16; break; } -#endif -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - } - } - - pData->iFilterofs = 0; /* determine filter characteristics */ - pData->iLevel0 = 0; /* default levels */ - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iJHDRalphafilter == 0xC0) - { - if (pData->iJHDRalphabitdepth <= 8) - pData->iFilterofs = 1; - else - pData->iFilterofs = 2; - - } -#endif -#ifdef FILTER193 /* no adaptive filtering ? */ - if (pData->iJHDRalphafilter == 0xC1) - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_jdaa (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_process_display_jdaa (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_START); -#endif - - if (!pData->bJPEGdecompress2) /* if we're not decompressing already */ - { - if (pData->fInitrowproc) /* initialize row-processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - pData->fInitrowproc = MNG_NULL; /* only call this once !!! */ - } - - if (!iRetcode) /* initialize decompress */ - iRetcode = mngjpeg_decompressinit2 (pData); - } - - if (!iRetcode) /* all ok? then decompress, my man */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mngjpeg_decompressdata2 (pData, iRawlen, pRawdata); -#else - iRetcode = mngjpeg_decompressdata2 (pData, pData->iRawlen, pData->pRawdata); -#endif - - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_jdat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_process_display_jdat (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_START); -#endif - - if (pData->bRestorebkgd) /* need to restore the background ? */ - { - pData->bRestorebkgd = MNG_FALSE; - iRetcode = load_bkgdlayer (pData); - - pData->iLayerseq++; /* and it counts as a layer then ! */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (!pData->bJPEGdecompress) /* if we're not decompressing already */ - { - if (pData->fInitrowproc) /* initialize row-processing? */ - { - iRetcode = ((mng_initrowproc)pData->fInitrowproc) (pData); - pData->fInitrowproc = MNG_NULL; /* only call this once !!! */ - } - - if (!iRetcode) /* initialize decompress */ - iRetcode = mngjpeg_decompressinit (pData); - } - - if (!iRetcode) /* all ok? then decompress, my man */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mngjpeg_decompressdata (pData, iRawlen, pRawdata); -#else - iRetcode = mngjpeg_decompressdata (pData, pData->iRawlen, pData->pRawdata); -#endif - - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_JDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky) -#else -mng_retcode mng_process_display_dhdr (mng_datap pData) -#endif -{ - mng_imagep pImage; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_START); -#endif - - pData->fInitrowproc = MNG_NULL; /* do nothing by default */ - pData->fDisplayrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->pStoreobj = MNG_NULL; - - pData->fDeltagetrow = MNG_NULL; - pData->fDeltaaddrow = MNG_NULL; - pData->fDeltareplacerow = MNG_NULL; - pData->fDeltaputrow = MNG_NULL; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage = mng_find_imageobject (pData, iObjectid); -#else - pImage = mng_find_imageobject (pData, pData->iDHDRobjectid); -#endif - - if (pImage) /* object exists ? */ - { - if (pImage->pImgbuf->bConcrete) /* is it concrete ? */ - { /* previous magnification to be done ? */ -#ifndef MNG_SKIPCHUNK_MAGN - if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY)) - { - iRetcode = mng_magnify_imageobject (pData, pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - /* save delta fields */ - pData->pDeltaImage = (mng_ptr)pImage; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iDeltaImagetype = iImagetype; - pData->iDeltatype = iDeltatype; - pData->iDeltaBlockwidth = iBlockwidth; - pData->iDeltaBlockheight = iBlockheight; - pData->iDeltaBlockx = iBlockx; - pData->iDeltaBlocky = iBlocky; -#else - pData->iDeltaImagetype = pData->iDHDRimagetype; - pData->iDeltatype = pData->iDHDRdeltatype; - pData->iDeltaBlockwidth = pData->iDHDRblockwidth; - pData->iDeltaBlockheight = pData->iDHDRblockheight; - pData->iDeltaBlockx = pData->iDHDRblockx; - pData->iDeltaBlocky = pData->iDHDRblocky; -#endif - /* restore target-object fields */ - pData->iDatawidth = pImage->pImgbuf->iWidth; - pData->iDataheight = pImage->pImgbuf->iHeight; - pData->iBitdepth = pImage->pImgbuf->iBitdepth; - pData->iColortype = pImage->pImgbuf->iColortype; - pData->iCompression = pImage->pImgbuf->iCompression; - pData->iFilter = pImage->pImgbuf->iFilter; - pData->iInterlace = pImage->pImgbuf->iInterlace; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; - else - if ((iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iAlphasampledepth; - else - if ((iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; -#else - if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKPIXELADD ) || - (pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; - else - if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKALPHAADD ) || - (pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iAlphasampledepth; - else - if ((pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKCOLORADD ) || - (pData->iDHDRdeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) ) - pData->iBitdepth = pImage->pImgbuf->iPixelsampledepth; -#endif - -#ifdef MNG_INCLUDE_JNG - pData->iJHDRimgbitdepth = pImage->pImgbuf->iBitdepth; - pData->iJHDRcolortype = pImage->pImgbuf->iColortype; - pData->iJHDRimgcompression = pImage->pImgbuf->iJHDRcompression; - pData->iJHDRimginterlace = pImage->pImgbuf->iJHDRinterlace; - pData->iJHDRalphacompression = pImage->pImgbuf->iCompression; - pData->iJHDRalphafilter = pImage->pImgbuf->iFilter; - pData->iJHDRalphainterlace = pImage->pImgbuf->iInterlace; - pData->iJHDRalphabitdepth = pImage->pImgbuf->iAlphabitdepth; -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - /* block size specified ? */ - if (iDeltatype != MNG_DELTATYPE_NOCHANGE) - { /* block entirely within target ? */ - if (iDeltatype != MNG_DELTATYPE_REPLACE) - { - if (((iBlockx + iBlockwidth ) > pData->iDatawidth ) || - ((iBlocky + iBlockheight) > pData->iDataheight) ) - MNG_ERROR (pData, MNG_INVALIDBLOCK); - } - - pData->iDatawidth = iBlockwidth; - pData->iDataheight = iBlockheight; - } -#else - /* block size specified ? */ - if (pData->iDHDRdeltatype != MNG_DELTATYPE_NOCHANGE) - { /* block entirely within target ? */ - if (pData->iDHDRdeltatype != MNG_DELTATYPE_REPLACE) - { - if (((pData->iDHDRblockx + pData->iDHDRblockwidth ) > pData->iDatawidth ) || - ((pData->iDHDRblocky + pData->iDHDRblockheight) > pData->iDataheight) ) - MNG_ERROR (pData, MNG_INVALIDBLOCK); - } - - pData->iDatawidth = pData->iDHDRblockwidth; - pData->iDataheight = pData->iDHDRblockheight; - } -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iDeltatype) /* determine nr of delta-channels */ -#else - switch (pData->iDHDRdeltatype) /* determine nr of delta-channels */ -#endif - { - case MNG_DELTATYPE_BLOCKALPHAADD : ; - case MNG_DELTATYPE_BLOCKALPHAREPLACE : - { -#ifdef MNG_INCLUDE_JNG - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) - { - pData->iColortype = MNG_COLORTYPE_GRAY; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY; - } - else - if ((pData->iColortype == MNG_COLORTYPE_RGBA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - pData->iColortype = MNG_COLORTYPE_GRAY; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY; - } -#else - if (pData->iColortype == MNG_COLORTYPE_GRAYA) - pData->iColortype = MNG_COLORTYPE_GRAY; - else - if (pData->iColortype == MNG_COLORTYPE_RGBA) - pData->iColortype = MNG_COLORTYPE_GRAY; -#endif - else /* target has no alpha; that sucks! */ - MNG_ERROR (pData, MNG_TARGETNOALPHA); - - break; - } - - case MNG_DELTATYPE_BLOCKCOLORADD : ; - case MNG_DELTATYPE_BLOCKCOLORREPLACE : - { -#ifdef MNG_INCLUDE_JNG - if ((pData->iColortype == MNG_COLORTYPE_GRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) - { - pData->iColortype = MNG_COLORTYPE_GRAY; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGGRAY; - } - else - if ((pData->iColortype == MNG_COLORTYPE_RGBA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { - pData->iColortype = MNG_COLORTYPE_RGB; - pData->iJHDRcolortype = MNG_COLORTYPE_JPEGCOLOR; - } -#else - if (pData->iColortype == MNG_COLORTYPE_GRAYA) - pData->iColortype = MNG_COLORTYPE_GRAY; - else - if (pData->iColortype == MNG_COLORTYPE_RGBA) - pData->iColortype = MNG_COLORTYPE_RGB; -#endif - else /* target has no alpha; that sucks! */ - MNG_ERROR (pData, MNG_TARGETNOALPHA); - - break; - } - - } - /* full image replace ? */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iDeltatype == MNG_DELTATYPE_REPLACE) -#else - if (pData->iDHDRdeltatype == MNG_DELTATYPE_REPLACE) -#endif - { - iRetcode = mng_reset_object_details (pData, pImage, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_FALSE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->pStoreobj = pImage; /* and store straight into this object */ - } - else - { - mng_imagedatap pBufzero, pBuf; - /* we store in object 0 and process it later */ - pData->pStoreobj = pData->pObjzero; - /* make sure to initialize object 0 then */ - iRetcode = mng_reset_object_details (pData, (mng_imagep)pData->pObjzero, - pData->iDatawidth, pData->iDataheight, - pData->iBitdepth, pData->iColortype, - pData->iCompression, pData->iFilter, - pData->iInterlace, MNG_TRUE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pBuf = pImage->pImgbuf; /* copy possible palette & cheap transparency */ - pBufzero = ((mng_imagep)pData->pObjzero)->pImgbuf; - - pBufzero->bHasPLTE = pBuf->bHasPLTE; - pBufzero->bHasTRNS = pBuf->bHasTRNS; - - if (pBufzero->bHasPLTE) /* copy palette ? */ - { - mng_uint32 iX; - - pBufzero->iPLTEcount = pBuf->iPLTEcount; - - for (iX = 0; iX < pBuf->iPLTEcount; iX++) - { - pBufzero->aPLTEentries [iX].iRed = pBuf->aPLTEentries [iX].iRed; - pBufzero->aPLTEentries [iX].iGreen = pBuf->aPLTEentries [iX].iGreen; - pBufzero->aPLTEentries [iX].iBlue = pBuf->aPLTEentries [iX].iBlue; - } - } - - if (pBufzero->bHasTRNS) /* copy cheap transparency ? */ - { - pBufzero->iTRNSgray = pBuf->iTRNSgray; - pBufzero->iTRNSred = pBuf->iTRNSred; - pBufzero->iTRNSgreen = pBuf->iTRNSgreen; - pBufzero->iTRNSblue = pBuf->iTRNSblue; - pBufzero->iTRNScount = pBuf->iTRNScount; - - MNG_COPY (pBufzero->aTRNSentries, pBuf->aTRNSentries, - sizeof (pBufzero->aTRNSentries)); - } - /* process immediately if bitdepth & colortype are equal */ - pData->bDeltaimmediate = - (mng_bool)((pData->bDisplaying) && (!pData->bSkipping) && - ((pData->bRunning) || (pData->bSearching)) && - (pData->iBitdepth == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) && - (pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype) ); - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - pData->fInitrowproc = (mng_fptr)mng_init_rowproc; - pData->ePng_imgtype = mng_png_imgtype (pData->iColortype, pData->iBitdepth); -#else - switch (pData->iColortype) /* determine row initialization routine */ - { - case 0 : { /* gray */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_g16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_g16_i; - - break; - } -#endif - } - - break; - } - case 2 : { /* rgb */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgb16_i; - - break; - } -#endif - } - - break; - } - case 3 : { /* indexed */ - switch (pData->iBitdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx1_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx1_i; - - break; - } - case 2 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx2_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx2_i; - - break; - } - case 4 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx4_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx4_i; - - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_idx8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_idx8_i; - - break; - } - } - - break; - } - case 4 : { /* gray+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_ga16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_ga16_i; - - break; - } -#endif - } - - break; - } - case 6 : { /* rgb+alpha */ - switch (pData->iBitdepth) - { - case 8 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba8_i; - - break; - } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { - if (!pData->iInterlace) - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_ni; - else - pData->fInitrowproc = (mng_fptr)mng_init_rgba16_i; - - break; - } -#endif - } - - break; - } - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - } - else - MNG_ERROR (pData, MNG_OBJNOTCONCRETE); - - } - else - MNG_ERROR (pData, MNG_OBJECTUNKNOWN); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype) -#else -mng_retcode mng_process_display_prom (mng_datap pData) -#endif -{ - mng_imagep pImage; - mng_imagedatap pBuf; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_START); -#endif - - if (!pData->pDeltaImage) /* gotta have this now! */ - MNG_ERROR (pData, MNG_INVALIDDELTA); - - pImage = (mng_imagep)pData->pDeltaImage; - pBuf = pImage->pImgbuf; - /* can't demote bitdepth! */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iBitdepth < pBuf->iBitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ( ((pBuf->iColortype == MNG_COLORTYPE_GRAY ) && - (iColortype != MNG_COLORTYPE_GRAY ) && - (iColortype != MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_GRAYA ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGBA ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) || -#ifdef MNG_INCLUDE_JNG - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY ) && - (iColortype != MNG_COLORTYPE_JPEGGRAY ) && - (iColortype != MNG_COLORTYPE_JPEGCOLOR ) && - (iColortype != MNG_COLORTYPE_JPEGGRAYA ) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR ) && - (iColortype != MNG_COLORTYPE_JPEGCOLOR ) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA ) && - (iColortype != MNG_COLORTYPE_JPEGGRAYA ) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) && - (iColortype != MNG_COLORTYPE_JPEGCOLORA) ) || -#endif - ((pBuf->iColortype == MNG_COLORTYPE_INDEXED ) && - (iColortype != MNG_COLORTYPE_INDEXED ) && - (iColortype != MNG_COLORTYPE_RGB ) && - (iColortype != MNG_COLORTYPE_RGBA ) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - iRetcode = mng_promote_imageobject (pData, pImage, iBitdepth, iColortype, iFilltype); -#else - if (pData->iPROMbitdepth < pBuf->iBitdepth) - MNG_ERROR (pData, MNG_INVALIDBITDEPTH); - - if ( ((pBuf->iColortype == MNG_COLORTYPE_GRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_GRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_GRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_GRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_GRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || - ((pBuf->iColortype == MNG_COLORTYPE_RGBA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) || -#ifdef MNG_INCLUDE_JNG - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAY ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLOR ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGGRAYA ) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || - ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) && - (pData->iPROMcolortype != MNG_COLORTYPE_JPEGCOLORA) ) || -#endif - ((pBuf->iColortype == MNG_COLORTYPE_INDEXED ) && - (pData->iPROMcolortype != MNG_COLORTYPE_INDEXED ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGB ) && - (pData->iPROMcolortype != MNG_COLORTYPE_RGBA ) ) ) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - - iRetcode = mng_promote_imageobject (pData, pImage, pData->iPROMbitdepth, - pData->iPROMcolortype, pData->iPROMfilltype); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_display_ipng (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_START); -#endif - /* indicate it for what it is now */ - pData->iDeltaImagetype = MNG_IMAGETYPE_PNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_ijng (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_START); -#endif - /* indicate it for what it is now */ - pData->iDeltaImagetype = MNG_IMAGETYPE_JNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries) -#else -mng_retcode mng_process_display_pplt (mng_datap pData) -#endif -{ - mng_uint32 iX; - mng_imagep pImage = (mng_imagep)pData->pObjzero; - mng_imagedatap pBuf = pImage->pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iX = iCount; -#else - iX = pData->iPPLTcount; -#endif -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iType) -#else - switch (pData->iPPLTtype) -#endif - { - case MNG_DELTATYPE_REPLACERGB : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue; - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = pData->paPPLTindexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = pData->paPPLTindexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = pData->paPPLTindexentries [iX].iBlue; - } -#endif - } - - break; - } - case MNG_DELTATYPE_DELTARGB : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - paIndexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - paIndexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - paIndexentries [iX].iBlue ); - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - pData->paPPLTindexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - pData->paPPLTindexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - pData->paPPLTindexentries [iX].iBlue ); - } -#endif - } - - break; - } - case MNG_DELTATYPE_REPLACEALPHA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - pBuf->aTRNSentries [iX] = paAlphaentries [iX]; - } -#else - if (pData->paPPLTusedentries [iX]) - pBuf->aTRNSentries [iX] = pData->paPPLTalphaentries [iX]; - } -#endif - - break; - } - case MNG_DELTATYPE_DELTAALPHA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - paAlphaentries [iX]); -#else - if (pData->paPPLTusedentries [iX]) - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - pData->paPPLTalphaentries [iX]); -#endif - } - - break; - } - case MNG_DELTATYPE_REPLACERGBA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = paIndexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = paIndexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = paIndexentries [iX].iBlue; - pBuf->aTRNSentries [iX] = paAlphaentries [iX]; - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = pData->paPPLTindexentries [iX].iRed; - pBuf->aPLTEentries [iX].iGreen = pData->paPPLTindexentries [iX].iGreen; - pBuf->aPLTEentries [iX].iBlue = pData->paPPLTindexentries [iX].iBlue; - pBuf->aTRNSentries [iX] = pData->paPPLTalphaentries [iX]; - } -#endif - } - - break; - } - case MNG_DELTATYPE_DELTARGBA : - { -#ifdef MNG_DECREMENT_LOOPS - for (; iX > 0;iX--) -#else -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = 0; iX < iCount; iX++) -#else - for (iX = 0; iX < pData->iPPLTcount; iX++) -#endif -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (paUsedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - paIndexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - paIndexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - paIndexentries [iX].iBlue ); - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - paAlphaentries [iX]); - } -#else - if (pData->paPPLTusedentries [iX]) - { - pBuf->aPLTEentries [iX].iRed = - (mng_uint8)(pBuf->aPLTEentries [iX].iRed + - pData->paPPLTindexentries [iX].iRed ); - pBuf->aPLTEentries [iX].iGreen = - (mng_uint8)(pBuf->aPLTEentries [iX].iGreen + - pData->paPPLTindexentries [iX].iGreen); - pBuf->aPLTEentries [iX].iBlue = - (mng_uint8)(pBuf->aPLTEentries [iX].iBlue + - pData->paPPLTindexentries [iX].iBlue ); - pBuf->aTRNSentries [iX] = - (mng_uint8)(pBuf->aTRNSentries [iX] + - pData->paPPLTalphaentries [iX]); - } -#endif - } - - break; - } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((iType != MNG_DELTATYPE_REPLACERGB) && (iType != MNG_DELTATYPE_DELTARGB)) -#else - if ((pData->iPPLTtype != MNG_DELTATYPE_REPLACERGB) && - (pData->iPPLTtype != MNG_DELTATYPE_DELTARGB ) ) -#endif - { - if (pBuf->bHasTRNS) - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iCount > pBuf->iTRNScount) - pBuf->iTRNScount = iCount; -#else - if (pData->iPPLTcount > pBuf->iTRNScount) - pBuf->iTRNScount = pData->iPPLTcount; -#endif - } - else - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pBuf->iTRNScount = iCount; - pBuf->bHasTRNS = MNG_TRUE; -#else - pBuf->iTRNScount = pData->iPPLTcount; - pBuf->bHasTRNS = MNG_TRUE; -#endif - } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if ((iType != MNG_DELTATYPE_REPLACEALPHA) && (iType != MNG_DELTATYPE_DELTAALPHA)) -#else - if ((pData->iPPLTtype != MNG_DELTATYPE_REPLACEALPHA) && - (pData->iPPLTtype != MNG_DELTATYPE_DELTAALPHA ) ) -#endif - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iCount > pBuf->iPLTEcount) - pBuf->iPLTEcount = iCount; -#else - if (pData->iPPLTcount > pBuf->iPLTEcount) - pBuf->iPLTEcount = pData->iPPLTcount; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY) -#else -mng_retcode mng_process_display_magn (mng_datap pData) -#endif -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START); -#endif - /* iterate the object-ids */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - for (iX = iFirstid; iX <= iLastid; iX++) -#else - for (iX = pData->iMAGNfirstid; iX <= pData->iMAGNlastid; iX++) -#endif - { - if (iX == 0) /* process object 0 ? */ - { - pImage = (mng_imagep)pData->pObjzero; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iMAGN_MethodX = iMethodX; - pImage->iMAGN_MethodY = iMethodY; - pImage->iMAGN_MX = iMX; - pImage->iMAGN_MY = iMY; - pImage->iMAGN_ML = iML; - pImage->iMAGN_MR = iMR; - pImage->iMAGN_MT = iMT; - pImage->iMAGN_MB = iMB; -#else - pImage->iMAGN_MethodX = pData->iMAGNmethodX; - pImage->iMAGN_MethodY = pData->iMAGNmethodY; - pImage->iMAGN_MX = pData->iMAGNmX; - pImage->iMAGN_MY = pData->iMAGNmY; - pImage->iMAGN_ML = pData->iMAGNmL; - pImage->iMAGN_MR = pData->iMAGNmR; - pImage->iMAGN_MT = pData->iMAGNmT; - pImage->iMAGN_MB = pData->iMAGNmB; -#endif - } - else - { - pImage = mng_find_imageobject (pData, iX); - /* object exists & is not frozen ? */ - if ((pImage) && (!pImage->bFrozen)) - { /* previous magnification to be done ? */ - if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY)) - { - mng_retcode iRetcode = mng_magnify_imageobject (pData, pImage); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pImage->iMAGN_MethodX = iMethodX; - pImage->iMAGN_MethodY = iMethodY; - pImage->iMAGN_MX = iMX; - pImage->iMAGN_MY = iMY; - pImage->iMAGN_ML = iML; - pImage->iMAGN_MR = iMR; - pImage->iMAGN_MT = iMT; - pImage->iMAGN_MB = iMB; -#else - pImage->iMAGN_MethodX = pData->iMAGNmethodX; - pImage->iMAGN_MethodY = pData->iMAGNmethodY; - pImage->iMAGN_MX = pData->iMAGNmX; - pImage->iMAGN_MY = pData->iMAGNmY; - pImage->iMAGN_ML = pData->iMAGNmL; - pImage->iMAGN_MR = pData->iMAGNmR; - pImage->iMAGN_MT = pData->iMAGNmT; - pImage->iMAGN_MB = pData->iMAGNmB; -#endif - } - } - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iMAGNfromid = iFirstid; - pData->iMAGNtoid = iLastid; - iX = iFirstid; -#else - pData->iMAGNfromid = pData->iMAGNfirstid; - pData->iMAGNtoid = pData->iMAGNlastid; - iX = pData->iMAGNfirstid; -#endif - /* iterate again for showing */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - while ((iX <= iLastid) && (!pData->bTimerset)) -#else - while ((iX <= pData->iMAGNlastid) && (!pData->bTimerset)) -#endif - { - pData->iMAGNcurrentid = iX; - - if (iX) /* only real objects ! */ - { - pImage = mng_find_imageobject (pData, iX); - /* object exists & is not frozen & - is visible & is viewable ? */ - if ((pImage) && (!pImage->bFrozen) && - (pImage->bVisible) && (pImage->bViewable)) - { - mng_retcode iRetcode = mng_display_image (pData, pImage, MNG_FALSE); - if (iRetcode) - return iRetcode; - } - } - - iX++; - } - - if (pData->bTimerset) /* broken ? */ - pData->iBreakpoint = 9; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_display_magn2 (mng_datap pData) -{ - mng_uint16 iX; - mng_imagep pImage; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_START); -#endif - - iX = pData->iMAGNcurrentid; - /* iterate again for showing */ - while ((iX <= pData->iMAGNtoid) && (!pData->bTimerset)) - { - pData->iMAGNcurrentid = iX; - - if (iX) /* only real objects ! */ - { - pImage = mng_find_imageobject (pData, iX); - /* object exists & is not frozen & - is visible & is viewable ? */ - if ((pImage) && (!pImage->bFrozen) && - (pImage->bVisible) && (pImage->bViewable)) - { - mng_retcode iRetcode = mng_display_image (pData, pImage, MNG_FALSE); - if (iRetcode) - return iRetcode; - } - } - - iX++; - } - - if (pData->bTimerset) /* broken ? */ - pData->iBreakpoint = 9; - else - pData->iBreakpoint = 0; /* not again ! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -mng_retcode mng_process_display_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources) -#else -mng_retcode mng_process_display_past (mng_datap pData) -#endif -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_imagep pTargetimg; - mng_imagep pSourceimg; -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - mng_past_sourcep pSource = (mng_past_sourcep)pSources; -#else - mng_past_sourcep pSource = (mng_past_sourcep)pData->pPASTsources; -#endif - mng_uint32 iX = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (iTargetid) /* a real destination object ? */ -#else - if (pData->iPASTtargetid) /* a real destination object ? */ -#endif - { /* let's find it then */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pTargetimg = (mng_imagep)mng_find_imageobject (pData, iTargetid); -#else - pTargetimg = (mng_imagep)mng_find_imageobject (pData, pData->iPASTtargetid); -#endif - - if (!pTargetimg) /* if it doesn't exists; do a barf */ - MNG_ERROR (pData, MNG_OBJECTUNKNOWN); - /* it's gotta be abstract !!! */ - if (pTargetimg->pImgbuf->bConcrete) - MNG_ERROR (pData, MNG_OBJNOTABSTRACT); - /* we want 32-/64-bit RGBA to play with ! */ - if ((pTargetimg->pImgbuf->iBitdepth <= MNG_BITDEPTH_8) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAY) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_RGB) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_INDEXED) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAYA) ) - iRetcode = mng_promote_imageobject (pData, pTargetimg, MNG_BITDEPTH_8, - MNG_COLORTYPE_RGBA, - MNG_FILLMETHOD_LEFTBITREPLICATE); - else - if ((pTargetimg->pImgbuf->iBitdepth > MNG_BITDEPTH_8) && - ((pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAY) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_RGB) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_GRAYA) ) ) - iRetcode = mng_promote_imageobject (pData, pTargetimg, MNG_BITDEPTH_16, - MNG_COLORTYPE_RGBA, - MNG_FILLMETHOD_LEFTBITREPLICATE); -#ifdef MNG_INCLUDE_JNG - else - if ((pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGGRAY) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) || - (pTargetimg->pImgbuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) ) - iRetcode = mng_promote_imageobject (pData, pTargetimg, - pTargetimg->pImgbuf->iBitdepth, - MNG_COLORTYPE_JPEGCOLORA, - MNG_FILLMETHOD_LEFTBITREPLICATE); -#endif - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* make it really abstract ? */ - if (!pTargetimg->pImgbuf->bCorrected) - { - iRetcode = mng_colorcorrect_object (pData, pTargetimg); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - else - { /* pasting into object 0 !!! */ - pTargetimg = (mng_imagep)pData->pObjzero; - /* is it usable ??? */ - if ((pTargetimg->bClipped) && - (pTargetimg->iClipr > pTargetimg->iPosx) && - (pTargetimg->iClipb > pTargetimg->iPosy)) - { - /* make it 32-bit RGBA please !!! */ - iRetcode = mng_reset_object_details (pData, pTargetimg, - pTargetimg->iClipr - pTargetimg->iPosx, - pTargetimg->iClipb - pTargetimg->iPosy, - MNG_BITDEPTH_8, MNG_COLORTYPE_RGBA, - 0, 0, 0, MNG_FALSE); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - pTargetimg = MNG_NULL; /* clipped beyond visibility ! */ - } - - if (pTargetimg) /* usable destination ? */ - { - mng_int32 iSourceY; - mng_int32 iSourceYinc; - mng_int32 iSourcerowsize; - mng_int32 iSourcesamples; - mng_bool bSourceRGBA16; - mng_int32 iTargetY; - mng_int32 iTargetrowsize; - mng_int32 iTargetsamples; - mng_bool bTargetRGBA16 = MNG_FALSE; - mng_int32 iTemprowsize; - mng_imagedatap pBuf; -#ifndef MNG_SKIPCHUNK_MAGN - /* needs magnification ? */ - if ((pTargetimg->iMAGN_MethodX) || (pTargetimg->iMAGN_MethodY)) - iRetcode = mng_magnify_imageobject (pData, pTargetimg); -#endif - - if (!iRetcode) /* still ok ? */ - { - bTargetRGBA16 = (mng_bool)(pTargetimg->pImgbuf->iBitdepth > 8); - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - switch (iTargettype) /* determine target x/y */ -#else - switch (pData->iPASTtargettype) /* determine target x/y */ -#endif - { - case 0 : { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPastx = iTargetx; - pData->iPasty = iTargety; -#else - pData->iPastx = pData->iPASTtargetx; - pData->iPasty = pData->iPASTtargety; -#endif - break; - } - - case 1 : { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPastx = pTargetimg->iPastx + iTargetx; - pData->iPasty = pTargetimg->iPasty + iTargety; -#else - pData->iPastx = pTargetimg->iPastx + pData->iPASTtargetx; - pData->iPasty = pTargetimg->iPasty + pData->iPASTtargety; -#endif - break; - } - - case 2 : { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPastx += iTargetx; - pData->iPasty += iTargety; -#else - pData->iPastx += pData->iPASTtargetx; - pData->iPasty += pData->iPASTtargety; -#endif - break; - } - } - /* save for next time ... */ - pTargetimg->iPastx = pData->iPastx; - pTargetimg->iPasty = pData->iPasty; - /* address destination for row-routines */ - pData->pStoreobj = (mng_objectp)pTargetimg; - pData->pStorebuf = (mng_objectp)pTargetimg->pImgbuf; - } - /* process the sources one by one */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - while ((!iRetcode) && (iX < iCount)) -#else - while ((!iRetcode) && (iX < pData->iPASTcount)) -#endif - { /* find the little bastards first */ - pSourceimg = (mng_imagep)mng_find_imageobject (pData, pSource->iSourceid); - /* exists and viewable? */ - if ((pSourceimg) && (pSourceimg->bViewable)) - { /* needs magnification ? */ -#ifndef MNG_SKIPCHUNK_MAGN - if ((pSourceimg->iMAGN_MethodX) || (pSourceimg->iMAGN_MethodY)) - iRetcode = mng_magnify_imageobject (pData, pSourceimg); -#endif - - if (!iRetcode) /* still ok ? */ - { - pBuf = (mng_imagedatap)pSourceimg->pImgbuf; - /* address source for row-routines */ - pData->pRetrieveobj = (mng_objectp)pSourceimg; - - pData->iPass = -1; /* init row-processing variables */ - pData->iRowinc = 1; - pData->iColinc = 1; - pData->iPixelofs = 0; - iSourcesamples = (mng_int32)pBuf->iWidth; - iSourcerowsize = pBuf->iRowsize; - bSourceRGBA16 = (mng_bool)(pBuf->iBitdepth > 8); - /* make sure the delta-routines do the right thing */ - pData->iDeltatype = MNG_DELTATYPE_BLOCKPIXELREPLACE; - - switch (pBuf->iColortype) - { - case 0 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS); - break; - } - - case 2 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS); - break; - } - - - case 3 : { pData->fRetrieverow = (mng_fptr)mng_retrieve_idx8; - pData->bIsOpaque = (mng_bool)(!pBuf->bHasTRNS); - break; - } - - - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_g16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_g8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - case 10 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgb8; - - pData->bIsOpaque = MNG_TRUE; - break; - } - - - case 12 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_ga8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - - - case 14 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bSourceRGBA16) - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - else -#endif - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - - pData->bIsOpaque = MNG_FALSE; - break; - } - } - /* determine scaling */ -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_DELTA_PNG - if ((!bSourceRGBA16) && (bTargetRGBA16)) - pData->fScalerow = (mng_fptr)mng_scale_rgba8_rgba16; - else - if ((bSourceRGBA16) && (!bTargetRGBA16)) - pData->fScalerow = (mng_fptr)mng_scale_rgba16_rgba8; - else -#endif -#endif - pData->fScalerow = MNG_NULL; - - /* default no color-correction */ - pData->fCorrectrow = MNG_NULL; - -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - } - - if (!iRetcode) /* still ok ? */ - { - pData->fFliprow = MNG_NULL; /* no flipping or tiling by default */ - pData->fTilerow = MNG_NULL; - /* but perhaps we do have to ... */ - switch (pSource->iOrientation) - { - case 2 : ; - case 4 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fFliprow = (mng_fptr)mng_flip_rgba16; - else -#endif - pData->fFliprow = (mng_fptr)mng_flip_rgba8; - break; - } - - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fTilerow = (mng_fptr)mng_tile_rgba16; - else -#endif - pData->fTilerow = (mng_fptr)mng_tile_rgba8; - break; - } - } - /* determine composition routine */ - /* note that we're abusing the delta-routine setup !!! */ - switch (pSource->iComposition) - { - case 0 : { /* composite over */ -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fDeltarow = (mng_fptr)mng_composeover_rgba16; - else -#endif - pData->fDeltarow = (mng_fptr)mng_composeover_rgba8; - break; - } - - case 1 : { /* replace */ -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fDeltarow = (mng_fptr)mng_delta_rgba16_rgba16; - else -#endif - pData->fDeltarow = (mng_fptr)mng_delta_rgba8_rgba8; - break; - } - - case 2 : { /* composite under */ -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - pData->fDeltarow = (mng_fptr)mng_composeunder_rgba16; - else -#endif - pData->fDeltarow = (mng_fptr)mng_composeunder_rgba8; - break; - } - } - /* determine offsets & clipping */ - if (pSource->iOffsettype == 1) - { - pData->iDestl = pData->iPastx + pSource->iOffsetx; - pData->iDestt = pData->iPasty + pSource->iOffsety; - } - else - { - pData->iDestl = pSource->iOffsetx; - pData->iDestt = pSource->iOffsety; - } - - pData->iDestr = (mng_int32)pTargetimg->pImgbuf->iWidth; - pData->iDestb = (mng_int32)pTargetimg->pImgbuf->iHeight; - /* take the source dimension into account ? */ - if (pSource->iOrientation != 8) - { - pData->iDestr = MIN_COORD (pData->iDestr, pData->iDestl + (mng_int32)pBuf->iWidth); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iDestt + (mng_int32)pBuf->iHeight); - } - /* source clipping */ - if (pSource->iBoundarytype == 1) - { - if (pData->iDestl < pData->iPastx + pSource->iBoundaryl) - pData->iSourcel = pData->iPastx + pSource->iBoundaryl - pData->iDestl; - else - pData->iSourcel = 0; - - if (pData->iDestt < pData->iPasty + pSource->iBoundaryt) - pData->iSourcet = pData->iPasty + pSource->iBoundaryt - pData->iDestt; - else - pData->iSourcet = 0; - - pData->iDestl = MAX_COORD (pData->iDestl, pData->iPastx + pSource->iBoundaryl); - pData->iDestt = MAX_COORD (pData->iDestt, pData->iPasty + pSource->iBoundaryt); - pData->iDestr = MIN_COORD (pData->iDestr, pData->iPastx + pSource->iBoundaryr); - pData->iDestb = MIN_COORD (pData->iDestb, pData->iPasty + pSource->iBoundaryb); - } - else - { - if (pData->iDestl < pSource->iBoundaryl) - pData->iSourcel = pSource->iBoundaryl - pData->iDestl; - else - pData->iSourcel = 0; - - if (pData->iDestt < pSource->iBoundaryt) - pData->iSourcet = pSource->iBoundaryt - pData->iDestt; - else - pData->iSourcet = 0; - - pData->iDestl = MAX_COORD (pData->iDestl, pSource->iBoundaryl); - pData->iDestt = MAX_COORD (pData->iDestt, pSource->iBoundaryt); - pData->iDestr = MIN_COORD (pData->iDestr, pSource->iBoundaryr); - pData->iDestb = MIN_COORD (pData->iDestb, pSource->iBoundaryb); - } - - if (pData->iSourcel) /* indent source ? */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) /* abuse tiling routine to shift source-pixels */ - pData->fTilerow = (mng_fptr)mng_tile_rgba16; - else -#endif - pData->fTilerow = (mng_fptr)mng_tile_rgba8; - } - /* anything to display ? */ - if ((pData->iDestl <= pData->iDestr) && (pData->iDestt <= pData->iDestb)) - { /* init variables for the loop */ - if ((pSource->iOrientation == 2) || (pSource->iOrientation == 6)) - { - iSourceY = (mng_int32)pBuf->iHeight - 1 - pData->iSourcet; - iSourceYinc = -1; - } - else - { - iSourceY = pData->iSourcet; - iSourceYinc = 1; - } - - iTargetY = pData->iDestt; - pData->iCol = pData->iDestl; - - iTargetsamples = pData->iDestr - pData->iDestl; - -#ifndef MNG_NO_16BIT_SUPPORT - if (bTargetRGBA16) - iTargetrowsize = (iTargetsamples << 3); - else -#endif - iTargetrowsize = (iTargetsamples << 2); - - /* get temporary work-buffers */ - if (iSourcerowsize > iTargetrowsize) - iTemprowsize = iSourcerowsize << 1; - else - iTemprowsize = iTargetrowsize << 1; - MNG_ALLOC (pData, pData->pRGBArow, iTemprowsize); - MNG_ALLOC (pData, pData->pWorkrow, iTemprowsize); - - while ((!iRetcode) && (iTargetY < pData->iDestb)) - { /* get a row */ - pData->iRow = iSourceY; - pData->iRowsamples = iSourcesamples; - pData->iRowsize = iSourcerowsize; - pData->bIsRGBA16 = bSourceRGBA16; - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* scale it (if necessary) */ - if ((!iRetcode) && (pData->fScalerow)) - iRetcode = ((mng_scalerow)pData->fScalerow) (pData); - - pData->bIsRGBA16 = bTargetRGBA16; - /* color correction (if necessary) */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - /* flipping (if necessary) */ - if ((!iRetcode) && (pData->fFliprow)) - iRetcode = ((mng_fliprow)pData->fFliprow) (pData); - /* tiling (if necessary) */ - if ((!iRetcode) && (pData->fTilerow)) - iRetcode = ((mng_tilerow)pData->fTilerow) (pData); - - if (!iRetcode) /* and paste..... */ - { - pData->iRow = iTargetY; - pData->iRowsamples = iTargetsamples; - pData->iRowsize = iTargetrowsize; - iRetcode = ((mng_deltarow)pData->fDeltarow) (pData); - } - - iSourceY += iSourceYinc; /* and next line */ - - if (iSourceY < 0) - iSourceY = (mng_int32)pBuf->iHeight - 1; - else - if (iSourceY >= (mng_int32)pBuf->iHeight) - iSourceY = 0; - - iTargetY++; - } - /* drop the temporary row-buffer */ - MNG_FREEX (pData, pData->pWorkrow, iTemprowsize); - MNG_FREEX (pData, pData->pRGBArow, iTemprowsize); - } - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - if (!iRetcode) - iRetcode = mng_clear_cms (pData); -#endif - } - - pSource++; /* neeeeext */ - iX++; - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - if (!iTargetid) /* did we paste into object 0 ? */ -#else - if (!pData->iPASTtargetid) /* did we paste into object 0 ? */ -#endif - { /* display it then ! */ - iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* target is visible & viewable ? */ - if ((pTargetimg->bVisible) && (pTargetimg->bViewable)) - { - iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE); - if (iRetcode) - return iRetcode; - } - } - } - - if (pData->bTimerset) /* broken ? */ - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - pData->iPASTid = iTargetid; -#else - pData->iPASTid = pData->iPASTtargetid; -#endif - pData->iBreakpoint = 11; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCHUNK_PAST */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_display_past2 (mng_datap pData) -{ - mng_retcode iRetcode; - mng_imagep pTargetimg; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_START); -#endif - - if (pData->iPASTid) /* a real destination object ? */ - pTargetimg = (mng_imagep)mng_find_imageobject (pData, pData->iPASTid); - else /* otherwise object 0 */ - pTargetimg = (mng_imagep)pData->pObjzero; - - iRetcode = mng_display_image (pData, pTargetimg, MNG_FALSE); - if (iRetcode) - return iRetcode; - - pData->iBreakpoint = 0; /* only once */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_PAST, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCHUNK_PAST */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - diff --git a/Engine/lib/lmng/libmng_display.h b/Engine/lib/lmng/libmng_display.h deleted file mode 100644 index f394dd2f6..000000000 --- a/Engine/lib/lmng/libmng_display.h +++ /dev/null @@ -1,343 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_display.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Display management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the display managament routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG support stuff * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for delta-image processing * */ -/* * - added support for PPLT chunk processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * * */ -/* * 0.9.4 - 11/24/2000 - G.Juyn * */ -/* * - moved restore of object 0 to libmng_display * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added proposed change in handling of TERM- & if-delay * */ -/* * 1.0.5 - 10/20/2002 - G.Juyn * */ -/* * - fixed display of visible target of PAST operation * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P. * */ -/* * - added some SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_display_h_ -#define _libmng_display_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_refresh (mng_datap pData, - mng_uint32 iInterval); - -/* ************************************************************************** */ - -mng_retcode mng_reset_objzero (mng_datap pData); - -mng_retcode mng_display_image (mng_datap pData, - mng_imagep pImage, - mng_bool bLayeradvanced); - -mng_retcode mng_execute_delta_image (mng_datap pData, - mng_imagep pTarget, - mng_imagep pDelta); - -/* ************************************************************************** */ - -mng_retcode mng_process_display (mng_datap pData); - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT -png_imgtype mng_png_imgtype (mng_uint8 colortype, - mng_uint8 bitdepth); -#endif - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - -mng_retcode mng_process_display_ihdr (mng_datap pData); - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -mng_retcode mng_process_display_mpng (mng_datap pData); -#endif - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -mng_retcode mng_process_display_ang (mng_datap pData); -#endif - -mng_retcode mng_process_display_idat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -mng_retcode mng_process_display_iend (mng_datap pData); -mng_retcode mng_process_display_mend (mng_datap pData); -mng_retcode mng_process_display_mend2 (mng_datap pData); -mng_retcode mng_process_display_defi (mng_datap pData); - -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode mng_process_display_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable); -#endif - -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode mng_process_display_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy); -mng_retcode mng_process_display_clon2 (mng_datap pData); -#endif - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_process_display_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds); -#endif - -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode mng_process_display_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); -mng_retcode mng_process_display_fram2 (mng_datap pData); -#endif - -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode mng_process_display_move (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iMovetype, - mng_int32 iMovex, - mng_int32 iMovey); -#endif - -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode mng_process_display_clip (mng_datap pData, - mng_uint16 iFromid, - mng_uint16 iToid, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); -#endif - -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode mng_process_display_show (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_display_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_display_seek (mng_datap pData); -#endif -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_jhdr (mng_datap pData); - -mng_retcode mng_process_display_jdaa (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -mng_retcode mng_process_display_jdat (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_display_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky); - -mng_retcode mng_process_display_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype); - -mng_retcode mng_process_display_ipng (mng_datap pData); -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_ijng (mng_datap pData); -#endif - -mng_retcode mng_process_display_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_process_display_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY); -mng_retcode mng_process_display_magn2 (mng_datap pData); -#endif - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_display_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources); -mng_retcode mng_process_display_past2 (mng_datap pData); -#endif - -#else /* MNG_OPTIMIZE_DISPLAYCALLS */ - -mng_retcode mng_process_display_ihdr (mng_datap pData); -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -mng_retcode mng_process_display_mpng (mng_datap pData); -#endif -mng_retcode mng_process_display_idat (mng_datap pData); -mng_retcode mng_process_display_iend (mng_datap pData); -mng_retcode mng_process_display_mend (mng_datap pData); -mng_retcode mng_process_display_mend2 (mng_datap pData); -mng_retcode mng_process_display_defi (mng_datap pData); -#ifndef MNG_SKIPCHUNK_BASI -mng_retcode mng_process_display_basi (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_CLON -mng_retcode mng_process_display_clon (mng_datap pData); -mng_retcode mng_process_display_clon2 (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_process_display_disc (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_FRAM -mng_retcode mng_process_display_fram (mng_datap pData); -mng_retcode mng_process_display_fram2 (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_MOVE -mng_retcode mng_process_display_move (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_CLIP -mng_retcode mng_process_display_clip (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SHOW -mng_retcode mng_process_display_show (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_display_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_display_seek (mng_datap pData); -#endif -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_jhdr (mng_datap pData); -mng_retcode mng_process_display_jdaa (mng_datap pData); -mng_retcode mng_process_display_jdat (mng_datap pData); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_display_dhdr (mng_datap pData); -mng_retcode mng_process_display_prom (mng_datap pData); -mng_retcode mng_process_display_ipng (mng_datap pData); -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_process_display_ijng (mng_datap pData); -#endif -mng_retcode mng_process_display_pplt (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_process_display_magn (mng_datap pData); -mng_retcode mng_process_display_magn2 (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_display_past (mng_datap pData); -mng_retcode mng_process_display_past2 (mng_datap pData); -#endif - -#endif /* MNG_OPTIMIZE_DISPLAYCALLS */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_display_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_dither.c b/Engine/lib/lmng/libmng_dither.c deleted file mode 100644 index e23850cef..000000000 --- a/Engine/lib/lmng/libmng_dither.c +++ /dev/null @@ -1,58 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_dither.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Dithering routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the dithering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_dither.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -mng_retcode mng_dither_a_row (mng_datap pData, - mng_uint8p pRow) -{ - - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - - diff --git a/Engine/lib/lmng/libmng_dither.h b/Engine/lib/lmng/libmng_dither.h deleted file mode 100644 index d9217c0ca..000000000 --- a/Engine/lib/lmng/libmng_dither.h +++ /dev/null @@ -1,45 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_dither.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : Dithering routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the dithering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_dither_h_ -#define _libmng_dither_h_ - -/* ************************************************************************** */ - -mng_retcode mng_dither_a_row (mng_datap pData, - mng_uint8p pRow); - -/* ************************************************************************** */ - -#endif /* _libmng_dither_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_error.c b/Engine/lib/lmng/libmng_error.c deleted file mode 100644 index 3a4da2063..000000000 --- a/Engine/lib/lmng/libmng_error.c +++ /dev/null @@ -1,326 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_error.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Error routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the general error handling routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added error telltaling * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added errorstrings for delta-image processing * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added errorstring for delayed buffer-processing * */ -/* * * */ -/* * 0.9.1 - 07/06/2000 - G.Juyn * */ -/* * - added MNG_NEEDTIMERWAIT errorstring * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added NEEDSECTIONWAIT errorstring * */ -/* * - added macro + routine to set returncode without * */ -/* * calling error callback * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added errorstring for updatemngheader if not a MNG * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/09/2000 - G.Juyn * */ -/* * - added check for simplicity-bits in MHDR * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - fixed processing of unknown critical chunks * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added errorcode for delayed delta-processing * */ -/* * * */ -/* * 0.9.4 - 01/18/2001 - G.Juyn * */ -/* * - added errorcode for MAGN methods * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * * */ -/* * 1.0.5 - 07/04/2002 - G.Juyn * */ -/* * - added errorcode for extreme chunk-sizes * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - warnings are ignored by default now! * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added check for TERM placement during create/write * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - added MNG_SKIPCHUNK_CHNK, MNG_NO_DELTA_PNG reductions. * */ -/* * - skipped more code when MNG_INCLUDE_JNG is not enabled. * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditional around evNT chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed typo on SKIPCHUNK_evNT (->PAST) * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ERROR_STRINGS -MNG_LOCAL mng_error_entry const error_table [] = - { - {MNG_NOERROR, "No error"}, - {MNG_OUTOFMEMORY, "Out of memory"}, - {MNG_INVALIDHANDLE, "The handle is invalid"}, - {MNG_NOCALLBACK, "A required callback is not defined"}, - {MNG_UNEXPECTEDEOF, "Encountered unexpected end-of-file"}, - {MNG_ZLIBERROR, "zlib encountered an error"}, -#ifdef MNG_INCLUDE_JNG - {MNG_JPEGERROR, "ijgsrc6b encountered an error"}, -#endif - {MNG_LCMSERROR, "lcms encountered an error"}, - {MNG_NOOUTPUTPROFILE, "No output-profile defined for CMS"}, - {MNG_NOSRGBPROFILE, "No sRGB-profile defined for CMS"}, - {MNG_BUFOVERFLOW, "Internal buffer-overflow"}, - {MNG_FUNCTIONINVALID, "Function is invalid at this point"}, - {MNG_OUTPUTERROR, "Writing was unsuccessful; disk full?"}, - {MNG_JPEGBUFTOOSMALL, "Internal buffer for JPEG processing too small"}, - {MNG_NEEDMOREDATA, "Reading suspended; waiting for I/O to catch up"}, - {MNG_NEEDTIMERWAIT, "Timer suspension; normal animation delay"}, - {MNG_NEEDSECTIONWAIT, "SEEK suspension; application decides"}, - {MNG_LOOPWITHCACHEOFF, "LOOP encountered when playback cache is turned off"}, - - {MNG_APPIOERROR, "Application signalled I/O error"}, - {MNG_APPTIMERERROR, "Application signalled timing error"}, - {MNG_APPCMSERROR, "Application signalled CMS error"}, - {MNG_APPMISCERROR, "Application signalled an error"}, - {MNG_APPTRACEABORT, "Application signalled error during trace-callback"}, - - {MNG_INTERNALERROR, "Internal error in libmng"}, - - {MNG_INVALIDSIG, "The signature is invalid"}, - {MNG_INVALIDCRC, "The CRC for this chunk is invalid"}, - {MNG_INVALIDLENGTH, "Chunk-length is invalid"}, - {MNG_SEQUENCEERROR, "Chunk out of sequence"}, - {MNG_CHUNKNOTALLOWED, "Chunk not allowed at this point"}, - {MNG_MULTIPLEERROR, "Chunk cannot occur multiple times"}, - {MNG_PLTEMISSING, "Missing PLTE chunk"}, - {MNG_IDATMISSING, "Missing IDAT chunk(s)"}, - {MNG_CANNOTBEEMPTY, "Chunk cannot be empty"}, - {MNG_GLOBALLENGTHERR, "Global data length invalid"}, - {MNG_INVALIDBITDEPTH, "The bit_depth is invalid"}, - {MNG_INVALIDCOLORTYPE, "The color_type is invalid"}, - {MNG_INVALIDCOMPRESS, "The compression_method is invalid"}, - {MNG_INVALIDFILTER, "The filter_method or filter_type is invalid"}, - {MNG_INVALIDINTERLACE, "The interlace_method is invalid"}, - {MNG_NOTENOUGHIDAT, "There is not enough data in the IDAT chunk(s)"}, - {MNG_PLTEINDEXERROR, "Palette-index out of bounds"}, - {MNG_NULLNOTFOUND, "NULL separator not found"}, - {MNG_KEYWORDNULL, "Keyword cannot be zero-length"}, - {MNG_OBJECTUNKNOWN, "Object does not exist"}, - {MNG_OBJECTEXISTS, "Object already exists"}, - {MNG_TOOMUCHIDAT, "Too much data in IDAT chunk(s)"}, - {MNG_INVSAMPLEDEPTH, "The sample_depth is invalid"}, - {MNG_INVOFFSETSIZE, "The offset_type is invalid"}, - {MNG_INVENTRYTYPE, "The entry_type is invalid"}, - {MNG_ENDWITHNULL, "Chunk must not end with NULL byte"}, - {MNG_INVIMAGETYPE, "The image_type is invalid"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_INVDELTATYPE, "The delta_type is invalid"}, -#endif - {MNG_INVALIDINDEX, "Index-value out of bounds"}, -#ifdef MNG_INCLUDE_JNG - {MNG_TOOMUCHJDAT, "Too much data in JDAT chunk(s)"}, - {MNG_JPEGPARMSERR, "JHDR parameters & JFIF-data do not match"}, -#endif - {MNG_INVFILLMETHOD, "The fill_method is invalid"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_OBJNOTCONCRETE, "Target object for DHDR must be concrete"}, -#endif - {MNG_TARGETNOALPHA, "Target object must have alpha-channel"}, - {MNG_MNGTOOCOMPLEX, "MHDR simplicity indicates unsupported feature(s)"}, - {MNG_UNKNOWNCRITICAL, "Unknown critical chunk encountered"}, -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UNSUPPORTEDNEED, "Requested nEED resources are not supported"}, -#endif - {MNG_INVALIDDELTA, "The delta operation is invalid (mismatched color_types?)"}, - {MNG_INVALIDMETHOD, "Method is invalid"}, - {MNG_IMPROBABLELENGTH, "Chunklength is incredibly large"}, - {MNG_INVALIDBLOCK, "Delta block width and or height invalid"}, - {MNG_INVALIDEVENT, "Event type is invalid"}, - {MNG_INVALIDMASK, "Mask type is invalid"}, - {MNG_NOMATCHINGLOOP, "ENDL without matching LOOP"}, -#ifndef MNG_SKIPCHUNK_evNT - {MNG_SEEKNOTFOUND, "evNT points to unknown SEEK"}, -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_OBJNOTABSTRACT, "Destination object for PAST must be abstract"}, -#endif - {MNG_TERMSEQERROR, "TERM misplaced during creation of MNG stream"}, - {MNG_INVALIDFIELDVAL, "invalid fieldvalue (generic)"}, - {MNG_INVALIDWIDTH, "invalid frame/image width"}, - {MNG_INVALIDHEIGHT, "invalid frame/image height"}, - - {MNG_INVALIDCNVSTYLE, "Canvas_style is invalid"}, - {MNG_WRONGCHUNK, "Attempt to access the wrong chunk"}, - {MNG_INVALIDENTRYIX, "Attempt to access an non-existing entry"}, - {MNG_NOHEADER, "No valid header-chunk"}, - {MNG_NOCORRCHUNK, "Parent chunk not found"}, - {MNG_NOMHDR, "No MNG header (MHDR) found"}, - - {MNG_IMAGETOOLARGE, "Image is larger than defined maximum"}, - {MNG_NOTANANIMATION, "Image is not an animation"}, - {MNG_FRAMENRTOOHIGH, "Framenr out of bounds"}, - {MNG_LAYERNRTOOHIGH, "Layernr out of bounds"}, - {MNG_PLAYTIMETOOHIGH, "Playtime out of bounds"}, - {MNG_FNNOTIMPLEMENTED, "Function not yet implemented"}, - {MNG_IMAGEFROZEN, "Image is frozen"}, - - {MNG_LCMS_NOHANDLE, "Handle could not be initialized"}, - {MNG_LCMS_NOMEM, "No memory for gamma-table(s)"}, - {MNG_LCMS_NOTRANS, "Transformation could not be initialized"} - }; -#endif /* MNG_INCLUDE_ERROR_STRINGS */ - -/* ************************************************************************** */ - -mng_bool mng_store_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_STORE_ERROR, MNG_LC_START); -#endif - - if (pData != 0) - { - pData->iErrorcode = iError; /* save also for getlasterror */ - pData->iErrorx1 = iExtra1; - pData->iErrorx2 = iExtra2; - -#ifdef MNG_INCLUDE_ERROR_STRINGS - { /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_error_entryp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (error_table) / sizeof (error_table [0])) - 1; - - iLower = 0; /* initialize binary search */ - iMiddle = iTop >> 1; /* start in the middle */ - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (error_table [iMiddle].iError < iError) - iLower = iMiddle + 1; - else if (error_table [iMiddle].iError > iError) - iUpper = iMiddle - 1; - else - { - pEntry = &error_table [iMiddle]; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (pEntry) /* found it ? */ - pData->zErrortext = pEntry->zErrortext; - else - pData->zErrortext = "Unknown error"; - } -#else /* MNG_INCLUDE_ERROR_STRINGS */ - pData->zErrortext = 0; -#endif /* MNG_INCLUDE_ERROR_STRINGS */ - - if (iError == 0) /* no error is not severe ! */ - { - pData->iSeverity = 0; - } - else - { - switch (iError&0x3C00) /* determine the severity */ - { - case 0x0800 : { pData->iSeverity = 5; break; } - case 0x1000 : { pData->iSeverity = 2; break; } - case 0x2000 : { pData->iSeverity = 1; break; } - default : { pData->iSeverity = 9; } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_STORE_ERROR, MNG_LC_END); -#endif - - return MNG_TRUE; -} - -/* ************************************************************************** */ - -mng_bool mng_process_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_PROCESS_ERROR, MNG_LC_START); -#endif - - mng_store_error (pData, iError, iExtra1, iExtra2); - - if ((pData != MNG_NULL) && (pData->iMagic == MNG_MAGIC)) - { - if (pData->fErrorproc) /* callback defined ? */ - return pData->fErrorproc (((mng_handle)pData), iError, pData->iSeverity, - pData->iChunkname, pData->iChunkseq, - pData->iErrorx1, pData->iErrorx2, pData->zErrortext); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (pData, MNG_FN_PROCESS_ERROR, MNG_LC_END); -#endif - - return MNG_TRUE; /* warnings are ignored by default ! */ -} - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_error.h b/Engine/lib/lmng/libmng_error.h deleted file mode 100644 index b49ff7330..000000000 --- a/Engine/lib/lmng/libmng_error.h +++ /dev/null @@ -1,119 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_error.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : Error functions (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the generic error-codes and functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added some errorcodes * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added some errorcodes * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added application errorcodes (used with callbacks) * */ -/* * - moved chunk-access errorcodes to severity 5 * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG errorcodes * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added error tell-tale definition * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added errorcodes for delta-image processing * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added errorcode for delayed buffer-processing * */ -/* * - moved errorcodes to "libmng.h" * */ -/* * * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added macro + routine to set returncode without * */ -/* * calling error callback * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 08/20/2002 - G.Juyn * */ -/* * - added option for soft-handling of errors * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_error_h_ -#define _libmng_error_h_ - -/* ************************************************************************** */ -/* * * */ -/* * Default error routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_bool mng_store_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2); - -mng_bool mng_process_error (mng_datap pData, - mng_retcode iError, - mng_retcode iExtra1, - mng_retcode iExtra2); - -/* ************************************************************************** */ -/* * * */ -/* * Error handling macros * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_SOFTERRORS -#define MNG_ERROR(D,C) { if (!mng_process_error (D, C, 0, 0)) return C; } -#define MNG_ERRORZ(D,Z) { if (!mng_process_error (D, MNG_ZLIBERROR, Z, 0)) return MNG_ZLIBERROR; } -#define MNG_ERRORJ(D,J) { if (!mng_process_error (D, MNG_JPEGERROR, J, 0)) return MNG_JPEGERROR; } -#define MNG_ERRORL(D,L) { if (!mng_process_error (D, MNG_LCMSERROR, L, 0)) return MNG_LCMSERROR; } -#else -#define MNG_ERROR(D,C) { mng_process_error (D, C, 0, 0); return C; } -#define MNG_ERRORZ(D,Z) { mng_process_error (D, MNG_ZLIBERROR, Z, 0); return MNG_ZLIBERROR; } -#define MNG_ERRORJ(D,J) { mng_process_error (D, MNG_JPEGERROR, J, 0); return MNG_JPEGERROR; } -#define MNG_ERRORL(D,L) { mng_process_error (D, MNG_LCMSERROR, L, 0); return MNG_LCMSERROR; } -#endif - -#define MNG_RETURN(D,C) { mng_store_error (D, C, 0, 0); return C; } - -#define MNG_WARNING(D,C) { if (!mng_process_error (D, C, 0, 0)) return C; } - -#define MNG_VALIDHANDLE(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \ - return MNG_INVALIDHANDLE; } -#define MNG_VALIDHANDLEX(H) { if ((H == 0) || (((mng_datap)H)->iMagic != MNG_MAGIC)) \ - return 0; } -#define MNG_VALIDCB(D,C) { if (!((mng_datap)D)->C) \ - MNG_ERROR (((mng_datap)D), MNG_NOCALLBACK) } - -/* ************************************************************************** */ -/* * * */ -/* * Error string-table entry * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct { - mng_retcode iError; - mng_pchar zErrortext; - } mng_error_entry; -typedef mng_error_entry const * mng_error_entryp; - -/* ************************************************************************** */ - -#endif /* _libmng_error_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_filter.c b/Engine/lib/lmng/libmng_filter.c deleted file mode 100644 index ed69a7534..000000000 --- a/Engine/lib/lmng/libmng_filter.c +++ /dev/null @@ -1,978 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_filter.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Filtering routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the filtering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - reversed some loops to use decrementing counter * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_filter.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_FILTERS - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_sub (mng_datap pData) -{ - mng_uint32 iBpp; - mng_uint8p pRawx; - mng_uint8p pRawx_prev; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_SUB, MNG_LC_START); -#endif - - iBpp = pData->iFilterbpp; - pRawx = pData->pWorkrow + pData->iPixelofs + iBpp; - pRawx_prev = pData->pWorkrow + pData->iPixelofs; - - for (iX = iBpp; iX < pData->iRowsize; iX++) - { - *pRawx = (mng_uint8)(*pRawx + *pRawx_prev); - pRawx++; - pRawx_prev++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_SUB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_up (mng_datap pData) -{ - mng_uint8p pRawx; - mng_uint8p pPriorx; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_UP, MNG_LC_START); -#endif - - pRawx = pData->pWorkrow + pData->iPixelofs; - pPriorx = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif - { - *pRawx = (mng_uint8)(*pRawx + *pPriorx); - pRawx++; - pPriorx++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_UP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_average (mng_datap pData) -{ - mng_int32 iBpp; - mng_uint8p pRawx; - mng_uint8p pRawx_prev; - mng_uint8p pPriorx; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_AVERAGE, MNG_LC_START); -#endif - - iBpp = pData->iFilterbpp; - pRawx = pData->pWorkrow + pData->iPixelofs; - pPriorx = pData->pPrevrow + pData->iPixelofs; - pRawx_prev = pData->pWorkrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = iBpp - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < iBpp; iX++) -#endif - { - *pRawx = (mng_uint8)(*pRawx + ((*pPriorx) >> 1)); - pRawx++; - pPriorx++; - } - - for (iX = iBpp; iX < pData->iRowsize; iX++) - { - *pRawx = (mng_uint8)(*pRawx + ((*pRawx_prev + *pPriorx) >> 1)); - pRawx++; - pPriorx++; - pRawx_prev++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_AVERAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode filter_paeth (mng_datap pData) -{ - mng_int32 iBpp; - mng_uint8p pRawx; - mng_uint8p pRawx_prev; - mng_uint8p pPriorx; - mng_uint8p pPriorx_prev; - mng_int32 iX; - mng_uint32 iA, iB, iC; - mng_uint32 iP; - mng_uint32 iPa, iPb, iPc; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_PAETH, MNG_LC_START); -#endif - - iBpp = pData->iFilterbpp; - pRawx = pData->pWorkrow + pData->iPixelofs; - pPriorx = pData->pPrevrow + pData->iPixelofs; - pRawx_prev = pData->pWorkrow + pData->iPixelofs; - pPriorx_prev = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = iBpp - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < iBpp; iX++) -#endif - { - *pRawx = (mng_uint8)(*pRawx + *pPriorx); - - pRawx++; - pPriorx++; - } - - for (iX = iBpp; iX < pData->iRowsize; iX++) - { - iA = (mng_uint32)*pRawx_prev; - iB = (mng_uint32)*pPriorx; - iC = (mng_uint32)*pPriorx_prev; - iP = iA + iB - iC; - iPa = abs (iP - iA); - iPb = abs (iP - iB); - iPc = abs (iP - iC); - - if ((iPa <= iPb) && (iPa <= iPc)) - *pRawx = (mng_uint8)(*pRawx + iA); - else - if (iPb <= iPc) - *pRawx = (mng_uint8)(*pRawx + iB); - else - *pRawx = (mng_uint8)(*pRawx + iC); - - pRawx++; - pPriorx++; - pRawx_prev++; - pPriorx_prev++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_PAETH, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_filter_a_row (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_START); -#endif - - switch (*(pData->pWorkrow + pData->iFilterofs)) - { - case 1 : { - iRetcode = filter_sub (pData); - break; - } - case 2 : { - iRetcode = filter_up (pData); - break; - } - case 3 : { - iRetcode = filter_average (pData); - break; - } - case 4 : { - iRetcode = filter_paeth (pData); - break; - } - - default : iRetcode = MNG_INVALIDFILTER; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef FILTER192 -mng_retcode mng_init_rowdiffering (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_START); -#endif - - if (pData->iFilter == 0xC0) /* has leveling parameters ? */ - { - switch (pData->iColortype) /* salvage leveling parameters */ - { - case 0 : { /* gray */ - if (pData->iBitdepth <= 8) - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - else - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - - break; - } - case 2 : { /* rgb */ - if (pData->iBitdepth <= 8) - { - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1); - pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2); - } - else - { - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2); - pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4); - } - - break; - } - case 3 : { /* indexed */ - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - break; - } - case 4 : { /* gray+alpha */ - if (pData->iBitdepth <= 8) - { - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1); - } - else - { - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2); - } - - break; - } - case 6 : { /* rgb+alpha */ - if (pData->iBitdepth <= 8) - { - pData->iLevel0 = (mng_uint16)*pData->pWorkrow; - pData->iLevel1 = (mng_uint16)*(pData->pWorkrow+1); - pData->iLevel2 = (mng_uint16)*(pData->pWorkrow+2); - pData->iLevel3 = (mng_uint16)*(pData->pWorkrow+3); - } - else - { - pData->iLevel0 = mng_get_uint16 (pData->pWorkrow); - pData->iLevel1 = mng_get_uint16 (pData->pWorkrow+2); - pData->iLevel2 = mng_get_uint16 (pData->pWorkrow+4); - pData->iLevel3 = mng_get_uint16 (pData->pWorkrow+6); - } - - break; - } - } - } - /* shift the entire row back in place */ - pRawi = pData->pWorkrow + pData->iFilterofs; - pRawo = pData->pWorkrow; - - for (iX = 0; iX < pData->iRowsize + pData->iPixelofs - pData->iFilterofs; iX++) - *pRawo++ = *pRawi++; - - pData->iFilterofs = 0; /* indicate so ! */ - -#ifdef FILTER193 - if (pData->iFilter == 0xC1) /* no adaptive filtering ? */ - pData->iPixelofs = pData->iFilterofs; - else -#endif - pData->iPixelofs = pData->iFilterofs + 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWDIFFERING, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g1 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_START); -#endif - - if (pData->iLevel0 & 0x01) /* is it uneven level ? */ - { - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - /* just invert every bit */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif - *pRawo++ = (mng_uint8)(~(*pRawi++)); - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g2 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 4; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 2; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03); - iN = (mng_uint8)((iN << 2) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g4 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 2; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 4; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F); - iN = (mng_uint8)((iN << 4) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF); - - pRawi++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_g16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo++ = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF); - - pRawi++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgb8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF); - *pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 + - (mng_uint16)*(pRawo+1)) & 0xFF); - *(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 + - (mng_uint16)*(pRawo+1)) & 0xFF); - - pRawi += 3; - pRawo += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgb16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF); - *pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - *(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - - pRawi += 3; - pRawo += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx1 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_START); -#endif - - if (pData->iLevel0 & 0x01) /* is it uneven level ? */ - { - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - /* just invert every bit */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif - *pRawo++ = (mng_uint8)(~(*pRawi++)); - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx2 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 4; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 2; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x03); - iN = (mng_uint8)((iN << 2) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx4 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - mng_int32 iC, iS; - mng_uint8 iB, iN, iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - iC = 0; - iB = 0; - iN = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iC) - { - iC = 2; - iB = *pRawi++; - iN = 0; - iS = 8; - } - - iS -= 4; - iQ = (mng_uint8)(((iB >> iS) + pData->iLevel0) & 0x0F); - iN = (mng_uint8)((iN << 4) + iQ); - iC--; - - if (!iC) - *pRawo++ = iN; - - } - - if (iC) - *pRawo = (mng_uint8)(iN << iS); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_idx8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo++ = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF); - - pRawi++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_ga8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0) & 0xFF); - *(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF); - - pRawi += 2; - pRawo += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_ga16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0) & 0xFFFF); - *(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF); - - pRawi += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgba8 (mng_datap pData) -{ - mng_uint8p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_START); -#endif - - pRawi = pData->pWorkrow + pData->iPixelofs; - pRawo = pData->pPrevrow + pData->iPixelofs; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint8)(((mng_uint16)*(pRawi+1) + pData->iLevel1) & 0xFF); - *pRawo = (mng_uint8)(((mng_uint16)*pRawi + pData->iLevel0 + - (mng_uint16)*(pRawo+1)) & 0xFF); - *(pRawo+2) = (mng_uint8)(((mng_uint16)*(pRawi+2) + pData->iLevel2 + - (mng_uint16)*(pRawo+1)) & 0xFF); - *(pRawo+3) = (mng_uint8)(((mng_uint16)*(pRawi+3) + pData->iLevel3) & 0xFF); - - pRawi += 4; - pRawo += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_differ_rgba16 (mng_datap pData) -{ - mng_uint16p pRawi, pRawo; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_START); -#endif - - pRawi = (mng_uint16p)(pData->pWorkrow + pData->iPixelofs); - pRawo = (mng_uint16p)(pData->pPrevrow + pData->iPixelofs); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples - 1; iX >= 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pRawo+1) = (mng_uint16)(((mng_uint32)*(pRawi+1) + (mng_uint32)pData->iLevel1) & 0xFFFF); - *pRawo = (mng_uint16)(((mng_uint32)*pRawi + (mng_uint32)pData->iLevel0 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - *(pRawo+2) = (mng_uint16)(((mng_uint32)*(pRawi+2) + (mng_uint32)pData->iLevel2 + - (mng_uint32)*(pRawo+1)) & 0xFFFF); - *(pRawo+3) = (mng_uint16)(((mng_uint32)*(pRawi+3) + (mng_uint32)pData->iLevel3) & 0xFFFF); - - pRawi += 4; - pRawo += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DIFFER_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* FILTER192 */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_FILTERS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_filter.h b/Engine/lib/lmng/libmng_filter.h deleted file mode 100644 index 9ac9c7f99..000000000 --- a/Engine/lib/lmng/libmng_filter.h +++ /dev/null @@ -1,69 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_filter.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.5 * */ -/* * * */ -/* * purpose : Filtering routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the filtering routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_filter_h_ -#define _libmng_filter_h_ - -/* ************************************************************************** */ - -mng_retcode mng_filter_a_row (mng_datap pData); - -/* ************************************************************************** */ - -#ifdef FILTER192 -mng_retcode mng_init_rowdiffering (mng_datap pData); - -mng_retcode mng_differ_g1 (mng_datap pData); -mng_retcode mng_differ_g2 (mng_datap pData); -mng_retcode mng_differ_g4 (mng_datap pData); -mng_retcode mng_differ_g8 (mng_datap pData); -mng_retcode mng_differ_g16 (mng_datap pData); -mng_retcode mng_differ_rgb8 (mng_datap pData); -mng_retcode mng_differ_rgb16 (mng_datap pData); -mng_retcode mng_differ_idx1 (mng_datap pData); -mng_retcode mng_differ_idx2 (mng_datap pData); -mng_retcode mng_differ_idx4 (mng_datap pData); -mng_retcode mng_differ_idx8 (mng_datap pData); -mng_retcode mng_differ_ga8 (mng_datap pData); -mng_retcode mng_differ_ga16 (mng_datap pData); -mng_retcode mng_differ_rgba8 (mng_datap pData); -mng_retcode mng_differ_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ - -#endif /* _libmng_filter_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_hlapi.c b/Engine/lib/lmng/libmng_hlapi.c deleted file mode 100644 index 6199d593c..000000000 --- a/Engine/lib/lmng/libmng_hlapi.c +++ /dev/null @@ -1,2995 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_hlapi.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : high-level application API (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the high-level function interface * */ -/* * for applications. * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added init of iPLTEcount * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed calling-convention definition * */ -/* * - changed status-handling of display-routines * */ -/* * - added versioning-control routines * */ -/* * - filled the write routine * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added eMNGma hack (will be removed in 1.0.0 !!!) * */ -/* * - added TERM animation object pointer (easier reference) * */ -/* * 0.5.1 - 05/14/2000 - G.Juyn * */ -/* * - added cleanup of saved-data (SAVE/SEEK processing) * */ -/* * 0.5.1 - 05/16/2000 - G.Juyn * */ -/* * - moved the actual write_graphic functionality from here * */ -/* * to its appropriate function in the mng_write module * */ -/* * * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - cleaned up some code regarding mixed support * */ -/* * - added JNG support * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - moved init of default zlib parms here from "mng_zlib.c" * */ -/* * - added init of default IJG parms * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - fixed inconsistancy with freeing global iCCP profile * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added delta-image field initialization * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added initialization of the buffer-suspend parameter * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - added initialization of update-region for refresh * */ -/* * - added initialization of Needrefresh parameter * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - added initialization of Deltaimmediate * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added initialization of Speed * */ -/* * - added initialization of Imagelevel * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed initialization routine for new mng_handle type * */ -/* * * */ -/* * 0.9.1 - 07/06/2000 - G.Juyn * */ -/* * - changed mng_display_resume to allow to be called after * */ -/* * a suspension return with MNG_NEEDMOREDATA * */ -/* * - added returncode MNG_NEEDTIMERWAIT for timer breaks * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - implemented support for freeze/reset/resume & go_xxxx * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added support for improved timing * */ -/* * - added support for improved I/O-suspension * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed EOF processing behavior * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * - added variable for NEEDSECTIONWAIT breaks * */ -/* * - added variable for freeze & reset processing * */ -/* * 0.9.1 - 07/17/2000 - G.Juyn * */ -/* * - added error cleanup processing * */ -/* * - fixed support for mng_display_reset() * */ -/* * - fixed suspension-buffering for 32K+ chunks * */ -/* * * */ -/* * 0.9.2 - 07/29/2000 - G.Juyn * */ -/* * - fixed small bugs in display processing * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - fixed wrapping of suspension parameters * */ -/* * 0.9.2 - 08/04/2000 - G.Juyn * */ -/* * - B111096 - fixed large-buffer read-suspension * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - raised initial maximum canvas size * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - fixed support for delta-images during read() / display() * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - added closestream() processing for mng_cleanup() * */ -/* * 0.9.3 - 10/27/2000 - G.Juyn * */ -/* * - fixed separate read() & display() processing * */ -/* * * */ -/* * 0.9.4 - 11/20/2000 - G.Juyn * */ -/* * - fixed unwanted repetition in mng_readdisplay() * */ -/* * 0.9.4 - 11/24/2000 - G.Juyn * */ -/* * - moved restore of object 0 to libmng_display * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 02/13/2001 - G.Juyn * */ -/* * - fixed first FRAM_MODE=4 timing problem * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn * */ -/* * - fixed bug with display_reset/display_resume (Thanks G!) * */ -/* * 1.0.1 - 04/22/2001 - G.Juyn * */ -/* * - fixed memory-leak (Thanks Gregg!) * */ -/* * 1.0.1 - 04/23/2001 - G.Juyn * */ -/* * - fixed reset_rundata to drop all objects * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 07/16/2002 - G.Juyn * */ -/* * - B581625 - large chunks fail with suspension reads * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - fixed LOOP iteration=0 special case * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - added another fix for misplaced TERM chunk * */ -/* * - completed support for condition=2 in TERM chunk * */ -/* * - added beta version function & constant * */ -/* * 1.0.5 - 10/11/2002 - G.Juyn * */ -/* * - added mng_status_dynamic to supports function * */ -/* * 1.0.5 - 11/04/2002 - G.Juyn * */ -/* * - changed FRAMECOUNT/LAYERCOUNT/PLAYTIME error to warning * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * 1.0.5 - 11/29/2002 - G.Juyn * */ -/* * - fixed goxxxxx() support for zero values * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/11/2003 - G.R-P * */ -/* * - added conditionals zlib and jpeg property accessors * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added conditionals around "mng_display_go*" and other * */ -/* * unused functions * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */ -/* * - put gamma, cms-related declarations inside #ifdef * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - fixed zTXT -> zTXt typo * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/10/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 07/06/2004 - G.R-P * */ -/* * - defend against using undefined openstream function * */ -/* * 1.0.8 - 08/02/2004 - G.Juyn * */ -/* * - added conditional to allow easier writing of large MNG's * */ -/* * * */ -/* * 1.0.9 - 08/17/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 07/06/2005 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_chunks.h" -#include "libmng_memory.h" -#include "libmng_read.h" -#include "libmng_write.h" -#include "libmng_display.h" -#include "libmng_zlib.h" -#include "libmng_jpeg.h" -#include "libmng_cms.h" -#include "libmng_pixels.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * local routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -MNG_LOCAL mng_retcode mng_drop_objects (mng_datap pData, - mng_bool bDropaniobj) -{ - mng_objectp pObject; - mng_objectp pNext; - mng_cleanupobject fCleanup; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_START); -#endif - - pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */ - - while (pObject) /* more objects to discard ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - - pObject = pNext; /* neeeext */ - } - - pData->pFirstimgobj = MNG_NULL; /* clean this up!!! */ - pData->pLastimgobj = MNG_NULL; - - if (bDropaniobj) /* drop animation objects ? */ - { - pObject = pData->pFirstaniobj; /* get first stored animation-object (if any) */ - - while (pObject) /* more objects to discard ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - - pObject = pNext; /* neeeext */ - } - - pData->pFirstaniobj = MNG_NULL; /* clean this up!!! */ - pData->pLastaniobj = MNG_NULL; - -#ifdef MNG_SUPPORT_DYNAMICMNG - pObject = pData->pFirstevent; /* get first event-object (if any) */ - - while (pObject) /* more objects to discard ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - - pObject = pNext; /* neeeext */ - } - - pData->pFirstevent = MNG_NULL; /* clean this up!!! */ - pData->pLastevent = MNG_NULL; -#endif - } - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - if (pData->pMPNG) /* drop MPNG data (if any) */ - { - fCleanup = ((mng_object_headerp)pData->pMPNG)->fCleanup; - fCleanup (pData, pData->pMPNG); - pData->pMPNG = MNG_NULL; - } -#endif - -#ifdef MNG_INCLUDE_ANG_PROPOSAL - if (pData->pANG) /* drop ANG data (if any) */ - { - fCleanup = ((mng_object_headerp)pData->pANG)->fCleanup; - fCleanup (pData, pData->pANG); - pData->pANG = MNG_NULL; - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_OBJECTS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_SAVE -MNG_LOCAL mng_retcode mng_drop_savedata (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_START); -#endif - - if (pData->pSavedata) /* sanity check */ - { /* address it more directly */ - mng_savedatap pSave = pData->pSavedata; - - if (pSave->iGlobalProfilesize) /* cleanup the profile ? */ - MNG_FREEX (pData, pSave->pGlobalProfile, pSave->iGlobalProfilesize); - /* cleanup the save structure */ - MNG_FREE (pData, pData->pSavedata, sizeof (mng_savedata)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_SAVEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -MNG_LOCAL mng_retcode mng_reset_rundata (mng_datap pData) -{ - mng_drop_invalid_objects (pData); /* drop invalidly stored objects */ -#ifndef MNG_SKIPCHUNK_SAVE - mng_drop_savedata (pData); /* drop stored savedata */ -#endif - mng_reset_objzero (pData); /* reset object 0 */ - /* drop stored objects (if any) */ - mng_drop_objects (pData, MNG_FALSE); - - pData->bFramedone = MNG_FALSE; - pData->iFrameseq = 0; /* reset counters & stuff */ - pData->iLayerseq = 0; - pData->iFrametime = 0; - - pData->bSkipping = MNG_FALSE; - -#ifdef MNG_SUPPORT_DYNAMICMNG - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->iEventx = 0; - pData->iEventy = 0; - pData->pLastmousemove = MNG_NULL; -#endif - - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - - pData->iRuntime = 0; - pData->iSynctime = 0; - pData->iStarttime = 0; - pData->iEndtime = 0; - pData->bRunning = MNG_FALSE; - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - pData->bSectionwait = MNG_FALSE; - pData->bFreezing = MNG_FALSE; - pData->bResetting = MNG_FALSE; - pData->bNeedrefresh = MNG_FALSE; - pData->bOnlyfirstframe = MNG_FALSE; - pData->iFramesafterTERM = 0; - - pData->iIterations = 0; - /* start of animation objects! */ - pData->pCurraniobj = MNG_NULL; - - pData->iUpdateleft = 0; /* reset region */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; - pData->iPLTEcount = 0; /* reset PLTE data */ - -#ifndef MNG_SKIPCHUNK_DEFI - pData->iDEFIobjectid = 0; /* reset DEFI data */ - pData->bDEFIhasdonotshow = MNG_FALSE; - pData->iDEFIdonotshow = 0; - pData->bDEFIhasconcrete = MNG_FALSE; - pData->iDEFIconcrete = 0; - pData->bDEFIhasloca = MNG_FALSE; - pData->iDEFIlocax = 0; - pData->iDEFIlocay = 0; - pData->bDEFIhasclip = MNG_FALSE; - pData->iDEFIclipl = 0; - pData->iDEFIclipr = 0; - pData->iDEFIclipt = 0; - pData->iDEFIclipb = 0; -#endif - -#ifndef MNG_SKIPCHUNK_BACK - pData->iBACKred = 0; /* reset BACK data */ - pData->iBACKgreen = 0; - pData->iBACKblue = 0; - pData->iBACKmandatory = 0; - pData->iBACKimageid = 0; - pData->iBACKtile = 0; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = 1; /* default global FRAM variables */ - pData->iFRAMdelay = 1; - pData->iFRAMtimeout = 0x7fffffffl; - pData->bFRAMclipping = MNG_FALSE; - pData->iFRAMclipl = 0; - pData->iFRAMclipr = 0; - pData->iFRAMclipt = 0; - pData->iFRAMclipb = 0; - - pData->iFramemode = 1; /* again for the current frame */ - pData->iFramedelay = 1; - pData->iFrametimeout = 0x7fffffffl; - pData->bFrameclipping = MNG_FALSE; - pData->iFrameclipl = 0; - pData->iFrameclipr = 0; - pData->iFrameclipt = 0; - pData->iFrameclipb = 0; - - pData->iNextdelay = 1; -#endif - -#ifndef MNG_SKIPCHUNK_SHOW - pData->iSHOWmode = 0; /* reset SHOW data */ - pData->iSHOWfromid = 0; - pData->iSHOWtoid = 0; - pData->iSHOWnextid = 0; - pData->iSHOWskip = 0; -#endif - - pData->iGlobalPLTEcount = 0; /* reset global PLTE data */ - - pData->iGlobalTRNSrawlen = 0; /* reset global tRNS data */ - - pData->iGlobalGamma = 0; /* reset global gAMA data */ - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = 0; /* reset global cHRM data */ - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; -#endif - -#ifndef MNG_SKIPCHUNK_sRGB - pData->iGlobalRendintent = 0; /* reset global sRGB data */ -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->iGlobalProfilesize) /* drop global profile (if any) */ - MNG_FREE (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = 0; /* reset global bKGD data */ - pData->iGlobalBKGDgreen = 0; - pData->iGlobalBKGDblue = 0; -#endif -#ifndef MNG_NO_DELTA_PNG - /* reset delta-image */ - pData->pDeltaImage = MNG_NULL; - pData->iDeltaImagetype = 0; - pData->iDeltatype = 0; - pData->iDeltaBlockwidth = 0; - pData->iDeltaBlockheight = 0; - pData->iDeltaBlockx = 0; - pData->iDeltaBlocky = 0; - pData->bDeltaimmediate = MNG_FALSE; - - pData->fDeltagetrow = MNG_NULL; - pData->fDeltaaddrow = MNG_NULL; - pData->fDeltareplacerow = MNG_NULL; - pData->fDeltaputrow = MNG_NULL; - - pData->fPromoterow = MNG_NULL; - pData->fPromBitdepth = MNG_NULL; - pData->pPromBuf = MNG_NULL; - pData->iPromColortype = 0; - pData->iPromBitdepth = 0; - pData->iPromFilltype = 0; - pData->iPromWidth = 0; - pData->pPromSrc = MNG_NULL; - pData->pPromDst = MNG_NULL; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - pData->iMAGNfromid = 0; - pData->iMAGNtoid = 0; -#endif - -#ifndef MNG_SKIPCHUNK_PAST - pData->iPastx = 0; - pData->iPasty = 0; -#endif - - pData->pLastseek = MNG_NULL; - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -MNG_LOCAL void cleanup_errors (mng_datap pData) -{ - pData->iErrorcode = MNG_NOERROR; - pData->iSeverity = 0; - pData->iErrorx1 = 0; - pData->iErrorx2 = 0; - pData->zErrortext = MNG_NULL; - - return; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -MNG_LOCAL mng_retcode make_pushbuffer (mng_datap pData, - mng_ptr pPushdata, - mng_size_t iLength, - mng_bool bTakeownership, - mng_pushdatap * pPush) -{ - mng_pushdatap pTemp; - - MNG_ALLOC (pData, pTemp, sizeof(mng_pushdata)); - - pTemp->pNext = MNG_NULL; - - if (bTakeownership) /* are we going to own the buffer? */ - { /* then just copy the pointer */ - pTemp->pData = (mng_uint8p)pPushdata; - } - else - { /* otherwise create new buffer */ - MNG_ALLOCX (pData, pTemp->pData, iLength); - if (!pTemp->pData) /* succeeded? */ - { - MNG_FREEX (pData, pTemp, sizeof(mng_pushdata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* and copy the bytes across */ - MNG_COPY (pTemp->pData, pPushdata, iLength); - } - - pTemp->iLength = iLength; - pTemp->bOwned = bTakeownership; - pTemp->pDatanext = pTemp->pData; - pTemp->iRemaining = iLength; - - *pPush = pTemp; /* return it */ - - return MNG_NOERROR; /* and all's well */ -} -#endif - -#ifdef MNG_VERSION_QUERY_SUPPORT -/* ************************************************************************** */ -/* * * */ -/* * Versioning control * */ -/* * * */ -/* ************************************************************************** */ - -mng_pchar MNG_DECL mng_version_text (void) -{ - return MNG_VERSION_TEXT; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_so (void) -{ - return MNG_VERSION_SO; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_dll (void) -{ - return MNG_VERSION_DLL; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_major (void) -{ - return MNG_VERSION_MAJOR; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_minor (void) -{ - return MNG_VERSION_MINOR; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_version_release (void) -{ - return MNG_VERSION_RELEASE; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_version_beta (void) -{ - return MNG_VERSION_BETA; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * 'supports' function * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_FUNCQUERY -typedef struct { - mng_pchar zFunction; - mng_uint8 iMajor; /* Major == 0 means not implemented ! */ - mng_uint8 iMinor; - mng_uint8 iRelease; - } mng_func_entry; -typedef mng_func_entry const * mng_func_entryp; - -MNG_LOCAL mng_func_entry const func_table [] = - { /* keep it alphabetically sorted !!!!! */ - {"mng_cleanup", 1, 0, 0}, - {"mng_copy_chunk", 1, 0, 5}, - {"mng_create", 1, 0, 0}, - {"mng_display", 1, 0, 0}, - {"mng_display_freeze", 1, 0, 0}, -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED - {"mng_display_goframe", 1, 0, 0}, - {"mng_display_golayer", 1, 0, 0}, - {"mng_display_gotime", 1, 0, 0}, -#endif - {"mng_display_reset", 1, 0, 0}, - {"mng_display_resume", 1, 0, 0}, - {"mng_get_alphabitdepth", 1, 0, 0}, - {"mng_get_alphacompression", 1, 0, 0}, - {"mng_get_alphadepth", 1, 0, 0}, - {"mng_get_alphafilter", 1, 0, 0}, - {"mng_get_alphainterlace", 1, 0, 0}, - {"mng_get_bgcolor", 1, 0, 0}, - {"mng_get_bitdepth", 1, 0, 0}, - {"mng_get_bkgdstyle", 1, 0, 0}, - {"mng_get_cacheplayback", 1, 0, 2}, - {"mng_get_canvasstyle", 1, 0, 0}, - {"mng_get_colortype", 1, 0, 0}, - {"mng_get_compression", 1, 0, 0}, -#ifndef MNG_NO_CURRENT_INFO - {"mng_get_currentframe", 1, 0, 0}, - {"mng_get_currentlayer", 1, 0, 0}, - {"mng_get_currentplaytime", 1, 0, 0}, -#endif - {"mng_get_currframdelay", 1, 0, 9}, -#ifndef MNG_NO_DFLT_INFO - {"mng_get_dfltimggamma", 1, 0, 0}, - {"mng_get_dfltimggammaint", 1, 0, 0}, -#endif - {"mng_get_displaygamma", 1, 0, 0}, - {"mng_get_displaygammaint", 1, 0, 0}, - {"mng_get_doprogressive", 1, 0, 2}, - {"mng_get_filter", 1, 0, 0}, - {"mng_get_framecount", 1, 0, 0}, - {"mng_get_imageheight", 1, 0, 0}, - {"mng_get_imagelevel", 1, 0, 0}, - {"mng_get_imagetype", 1, 0, 0}, - {"mng_get_imagewidth", 1, 0, 0}, - {"mng_get_interlace", 1, 0, 0}, -#ifdef MNG_ACCESS_JPEG - {"mng_get_jpeg_dctmethod", 1, 0, 0}, - {"mng_get_jpeg_maxjdat", 1, 0, 0}, - {"mng_get_jpeg_optimized", 1, 0, 0}, - {"mng_get_jpeg_progressive", 1, 0, 0}, - {"mng_get_jpeg_quality", 1, 0, 0}, - {"mng_get_jpeg_smoothing", 1, 0, 0}, -#endif - {"mng_get_lastbackchunk", 1, 0, 3}, - {"mng_get_lastseekname", 1, 0, 5}, - {"mng_get_layercount", 1, 0, 0}, -#ifndef MNG_SKIP_MAXCANVAS - {"mng_get_maxcanvasheight", 1, 0, 0}, - {"mng_get_maxcanvaswidth", 1, 0, 0}, -#endif - {"mng_get_playtime", 1, 0, 0}, - {"mng_get_refreshpass", 1, 0, 0}, - {"mng_get_runtime", 1, 0, 0}, - {"mng_get_sectionbreaks", 1, 0, 0}, - {"mng_get_sigtype", 1, 0, 0}, - {"mng_get_simplicity", 1, 0, 0}, - {"mng_get_speed", 1, 0, 0}, - {"mng_get_srgb", 1, 0, 0}, - {"mng_get_starttime", 1, 0, 0}, - {"mng_get_storechunks", 1, 0, 0}, - {"mng_get_suspensionmode", 1, 0, 0}, - {"mng_get_ticks", 1, 0, 0}, -#ifndef MNG_NO_CURRENT_INFO - {"mng_get_totalframes", 1, 0, 5}, - {"mng_get_totallayers", 1, 0, 5}, - {"mng_get_totalplaytime", 1, 0, 5}, -#endif - {"mng_get_usebkgd", 1, 0, 0}, - {"mng_get_userdata", 1, 0, 0}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {"mng_get_viewgamma", 1, 0, 0}, - {"mng_get_viewgammaint", 1, 0, 0}, -#endif -#ifdef MNG_ACCESS_ZLIB - {"mng_get_zlib_level", 1, 0, 0}, - {"mng_get_zlib_maxidat", 1, 0, 0}, - {"mng_get_zlib_memlevel", 1, 0, 0}, - {"mng_get_zlib_method", 1, 0, 0}, - {"mng_get_zlib_strategy", 1, 0, 0}, - {"mng_get_zlib_windowbits", 1, 0, 0}, -#endif -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_getcb_closestream", 1, 0, 0}, -#endif - {"mng_getcb_errorproc", 1, 0, 0}, - {"mng_getcb_getalphaline", 1, 0, 0}, - {"mng_getcb_getbkgdline", 1, 0, 0}, - {"mng_getcb_getcanvasline", 1, 0, 0}, - {"mng_getcb_gettickcount", 1, 0, 0}, - {"mng_getcb_memalloc", 1, 0, 0}, - {"mng_getcb_memfree", 1, 0, 0}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_getcb_openstream", 1, 0, 0}, -#endif - {"mng_getcb_processarow", 1, 0, 0}, - {"mng_getcb_processchroma", 1, 0, 0}, - {"mng_getcb_processgamma", 1, 0, 0}, - {"mng_getcb_processheader", 1, 0, 0}, - {"mng_getcb_processiccp", 1, 0, 0}, - {"mng_getcb_processmend", 1, 0, 1}, - {"mng_getcb_processneed", 1, 0, 0}, - {"mng_getcb_processsave", 1, 0, 0}, - {"mng_getcb_processseek", 1, 0, 0}, - {"mng_getcb_processsrgb", 1, 0, 0}, - {"mng_getcb_processterm", 1, 0, 2}, - {"mng_getcb_processtext", 1, 0, 0}, - {"mng_getcb_processunknown", 1, 0, 0}, - {"mng_getcb_readdata", 1, 0, 0}, - {"mng_getcb_refresh", 1, 0, 0}, - {"mng_getcb_releasedata", 1, 0, 8}, - {"mng_getcb_settimer", 1, 0, 0}, - {"mng_getcb_traceproc", 1, 0, 0}, - {"mng_getcb_writedata", 1, 0, 0}, - {"mng_getchunk_back", 1, 0, 0}, - {"mng_getchunk_basi", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_bKGD - {"mng_getchunk_bkgd", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {"mng_getchunk_chrm", 1, 0, 0}, -#endif - {"mng_getchunk_clip", 1, 0, 0}, - {"mng_getchunk_clon", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_dBYK - {"mng_getchunk_dbyk", 1, 0, 0}, -#endif -#endif - {"mng_getchunk_defi", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_dhdr", 1, 0, 0}, -#endif - {"mng_getchunk_disc", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_drop", 1, 0, 0}, -#endif - {"mng_getchunk_endl", 1, 0, 0}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {"mng_getchunk_mpng", 1, 0, 10}, - {"mng_getchunk_mpng_frame", 1, 0, 10}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {"mng_getchunk_evnt", 1, 0, 5}, - {"mng_getchunk_evnt_entry", 1, 0, 5}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {"mng_getchunk_expi", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {"mng_getchunk_fpri", 1, 0, 0}, -#endif - {"mng_getchunk_fram", 1, 0, 0}, - {"mng_getchunk_gama", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_hIST - {"mng_getchunk_hist", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {"mng_getchunk_iccp", 1, 0, 0}, -#endif - {"mng_getchunk_idat", 1, 0, 0}, - {"mng_getchunk_iend", 1, 0, 0}, - {"mng_getchunk_ihdr", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {"mng_getchunk_ijng", 1, 0, 0}, -#endif - {"mng_getchunk_ipng", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {"mng_getchunk_itxt", 1, 0, 0}, -#endif -#ifdef MNG_INCLUDE_JNG - {"mng_getchunk_jdaa", 1, 0, 0}, - {"mng_getchunk_jdat", 1, 0, 0}, - {"mng_getchunk_jhdr", 1, 0, 0}, - {"mng_getchunk_jsep", 1, 0, 0}, -#endif - {"mng_getchunk_loop", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_MAGN - {"mng_getchunk_magn", 1, 0, 0}, -#endif - {"mng_getchunk_mend", 1, 0, 0}, - {"mng_getchunk_mhdr", 1, 0, 0}, - {"mng_getchunk_move", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_nEED - {"mng_getchunk_need", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_ORDR -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_ordr", 1, 0, 0}, - {"mng_getchunk_ordr_entry", 1, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {"mng_getchunk_past", 1, 0, 0}, - {"mng_getchunk_past_src", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {"mng_getchunk_phyg", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {"mng_getchunk_phys", 1, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG - {"mng_getchunk_plte", 1, 0, 0}, - {"mng_getchunk_pplt", 1, 0, 0}, - {"mng_getchunk_pplt_entry", 1, 0, 0}, - {"mng_getchunk_prom", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {"mng_getchunk_save", 1, 0, 0}, - {"mng_getchunk_save_entry", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {"mng_getchunk_sbit", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {"mng_getchunk_seek", 1, 0, 0}, -#endif - {"mng_getchunk_show", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_sPLT - {"mng_getchunk_splt", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {"mng_getchunk_srgb", 1, 0, 0}, -#endif - {"mng_getchunk_term", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_tEXt - {"mng_getchunk_text", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {"mng_getchunk_time", 1, 0, 0}, -#endif - {"mng_getchunk_trns", 1, 0, 0}, - {"mng_getchunk_unkown", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_zTXt - {"mng_getchunk_ztxt", 1, 0, 0}, -#endif - {"mng_getimgdata_chunk", 0, 0, 0}, - {"mng_getimgdata_chunkseq", 0, 0, 0}, - {"mng_getimgdata_seq", 0, 0, 0}, - {"mng_getlasterror", 1, 0, 0}, - {"mng_initialize", 1, 0, 0}, - {"mng_iterate_chunks", 1, 0, 0}, - {"mng_putchunk_back", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_BASI - {"mng_putchunk_basi", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {"mng_putchunk_bkgd", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {"mng_putchunk_chrm", 1, 0, 0}, -#endif - {"mng_putchunk_clip", 1, 0, 0}, - {"mng_putchunk_clon", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {"mng_putchunk_dbyk", 1, 0, 0}, -#endif -#endif - {"mng_putchunk_defi", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_putchunk_dhdr", 1, 0, 0}, -#endif - {"mng_putchunk_disc", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {"mng_putchunk_drop", 1, 0, 0}, -#endif - {"mng_putchunk_endl", 1, 0, 0}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {"mng_putchunk_mpng", 1, 0, 10}, - {"mng_putchunk_mpng_frame", 1, 0, 10}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {"mng_putchunk_evnt", 1, 0, 5}, - {"mng_putchunk_evnt_entry", 1, 0, 5}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {"mng_putchunk_expi", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {"mng_putchunk_fpri", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {"mng_putchunk_fram", 1, 0, 0}, -#endif - {"mng_putchunk_gama", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_hIST - {"mng_putchunk_hist", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {"mng_putchunk_iccp", 1, 0, 0}, -#endif - {"mng_putchunk_idat", 1, 0, 0}, - {"mng_putchunk_iend", 1, 0, 0}, - {"mng_putchunk_ihdr", 1, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {"mng_putchunk_ijng", 1, 0, 0}, -#endif - {"mng_putchunk_ipng", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {"mng_putchunk_itxt", 1, 0, 0}, -#endif -#ifdef MNG_INCLUDE_JNG - {"mng_putchunk_jdaa", 1, 0, 0}, - {"mng_putchunk_jdat", 1, 0, 0}, - {"mng_putchunk_jhdr", 1, 0, 0}, - {"mng_putchunk_jsep", 1, 0, 0}, -#endif - {"mng_putchunk_loop", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_MAGN - {"mng_putchunk_magn", 1, 0, 0}, -#endif - {"mng_putchunk_mend", 1, 0, 0}, - {"mng_putchunk_mhdr", 1, 0, 0}, - {"mng_putchunk_move", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_nEED - {"mng_putchunk_need", 1, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {"mng_putchunk_ordr", 1, 0, 0}, - {"mng_putchunk_ordr_entry", 1, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {"mng_putchunk_past", 1, 0, 0}, - {"mng_putchunk_past_src", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {"mng_putchunk_phyg", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {"mng_putchunk_phys", 1, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG - {"mng_putchunk_plte", 1, 0, 0}, - {"mng_putchunk_pplt", 1, 0, 0}, - {"mng_putchunk_pplt_entry", 1, 0, 0}, - {"mng_putchunk_prom", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {"mng_putchunk_save", 1, 0, 0}, - {"mng_putchunk_save_entry", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {"mng_putchunk_sbit", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {"mng_putchunk_seek", 1, 0, 0}, -#endif - {"mng_putchunk_show", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_sPLT - {"mng_putchunk_splt", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {"mng_putchunk_srgb", 1, 0, 0}, -#endif - {"mng_putchunk_term", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_tEXt - {"mng_putchunk_text", 1, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {"mng_putchunk_time", 1, 0, 0}, -#endif - {"mng_putchunk_trns", 1, 0, 0}, - {"mng_putchunk_unkown", 1, 0, 0}, -#ifndef MNG_SKIPCHUNK_zTXt - {"mng_putchunk_ztxt", 1, 0, 0}, -#endif - {"mng_putimgdata_ihdr", 0, 0, 0}, - {"mng_putimgdata_jhdr", 0, 0, 0}, - {"mng_reset", 1, 0, 0}, - {"mng_read", 1, 0, 0}, - {"mng_read_pushchunk", 1, 0, 8}, - {"mng_read_pushdata", 1, 0, 8}, - {"mng_read_pushsig", 1, 0, 8}, - {"mng_read_resume", 1, 0, 0}, - {"mng_readdisplay", 1, 0, 0}, - {"mng_set_bgcolor", 1, 0, 0}, - {"mng_set_bkgdstyle", 1, 0, 0}, - {"mng_set_cacheplayback", 1, 0, 2}, - {"mng_set_canvasstyle", 1, 0, 0}, - {"mng_set_dfltimggamma", 1, 0, 0}, -#ifndef MNG_NO_DFLT_INFO - {"mng_set_dfltimggammaint", 1, 0, 0}, -#endif - {"mng_set_displaygamma", 1, 0, 0}, - {"mng_set_displaygammaint", 1, 0, 0}, - {"mng_set_doprogressive", 1, 0, 2}, -#ifdef MNG_ACCESS_JPEG - {"mng_set_jpeg_dctmethod", 1, 0, 0}, - {"mng_set_jpeg_maxjdat", 1, 0, 0}, - {"mng_set_jpeg_optimized", 1, 0, 0}, - {"mng_set_jpeg_progressive", 1, 0, 0}, - {"mng_set_jpeg_quality", 1, 0, 0}, - {"mng_set_jpeg_smoothing", 1, 0, 0}, -#endif -#ifndef MNG_SKIP_MAXCANVAS - {"mng_set_maxcanvasheight", 1, 0, 0}, - {"mng_set_maxcanvassize", 1, 0, 0}, - {"mng_set_maxcanvaswidth", 1, 0, 0}, -#endif - {"mng_set_outputprofile", 1, 0, 0}, - {"mng_set_outputprofile2", 1, 0, 0}, - {"mng_set_outputsrgb", 1, 0, 1}, - {"mng_set_sectionbreaks", 1, 0, 0}, - {"mng_set_speed", 1, 0, 0}, - {"mng_set_srgb", 1, 0, 0}, - {"mng_set_srgbimplicit", 1, 0, 1}, - {"mng_set_srgbprofile", 1, 0, 0}, - {"mng_set_srgbprofile2", 1, 0, 0}, - {"mng_set_storechunks", 1, 0, 0}, - {"mng_set_suspensionmode", 1, 0, 0}, - {"mng_set_usebkgd", 1, 0, 0}, - {"mng_set_userdata", 1, 0, 0}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {"mng_set_viewgamma", 1, 0, 0}, - {"mng_set_viewgammaint", 1, 0, 0}, -#endif -#ifdef MNG_ACCESS_ZLIB - {"mng_set_zlib_level", 1, 0, 0}, - {"mng_set_zlib_maxidat", 1, 0, 0}, - {"mng_set_zlib_memlevel", 1, 0, 0}, - {"mng_set_zlib_method", 1, 0, 0}, - {"mng_set_zlib_strategy", 1, 0, 0}, - {"mng_set_zlib_windowbits", 1, 0, 0}, -#endif -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_setcb_closestream", 1, 0, 0}, -#endif - {"mng_setcb_errorproc", 1, 0, 0}, - {"mng_setcb_getalphaline", 1, 0, 0}, - {"mng_setcb_getbkgdline", 1, 0, 0}, - {"mng_setcb_getcanvasline", 1, 0, 0}, - {"mng_setcb_gettickcount", 1, 0, 0}, - {"mng_setcb_memalloc", 1, 0, 0}, - {"mng_setcb_memfree", 1, 0, 0}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {"mng_setcb_openstream", 1, 0, 0}, -#endif - {"mng_setcb_processarow", 1, 0, 0}, - {"mng_setcb_processchroma", 1, 0, 0}, - {"mng_setcb_processgamma", 1, 0, 0}, - {"mng_setcb_processheader", 1, 0, 0}, - {"mng_setcb_processiccp", 1, 0, 0}, - {"mng_setcb_processmend", 1, 0, 1}, - {"mng_setcb_processneed", 1, 0, 0}, - {"mng_setcb_processsave", 1, 0, 0}, - {"mng_setcb_processseek", 1, 0, 0}, - {"mng_setcb_processsrgb", 1, 0, 0}, - {"mng_setcb_processterm", 1, 0, 2}, - {"mng_setcb_processtext", 1, 0, 0}, - {"mng_setcb_processunknown", 1, 0, 0}, - {"mng_setcb_readdata", 1, 0, 0}, - {"mng_setcb_refresh", 1, 0, 0}, - {"mng_setcb_releasedata", 1, 0, 8}, - {"mng_setcb_settimer", 1, 0, 0}, - {"mng_setcb_traceproc", 1, 0, 0}, - {"mng_setcb_writedata", 1, 0, 0}, - {"mng_status_creating", 1, 0, 0}, - {"mng_status_displaying", 1, 0, 0}, - {"mng_status_dynamic", 1, 0, 5}, - {"mng_status_error", 1, 0, 0}, - {"mng_status_reading", 1, 0, 0}, - {"mng_status_running", 1, 0, 0}, - {"mng_status_runningevent", 1, 0, 5}, - {"mng_status_suspendbreak", 1, 0, 0}, - {"mng_status_timerbreak", 1, 0, 0}, - {"mng_status_writing", 1, 0, 0}, - {"mng_supports_func", 1, 0, 5}, - {"mng_trapevent", 1, 0, 5}, - {"mng_updatemngheader", 1, 0, 0}, - {"mng_updatemngsimplicity", 1, 0, 0}, - {"mng_version_beta", 1, 0, 5}, - {"mng_version_dll", 1, 0, 0}, - {"mng_version_major", 1, 0, 0}, - {"mng_version_minor", 1, 0, 0}, - {"mng_version_release", 1, 0, 0}, - {"mng_version_so", 1, 0, 0}, - {"mng_version_text", 1, 0, 0}, - {"mng_write", 1, 0, 0}, - }; - -mng_bool MNG_DECL mng_supports_func (mng_pchar zFunction, - mng_uint8* iMajor, - mng_uint8* iMinor, - mng_uint8* iRelease) -{ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_func_entryp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (func_table) / sizeof (func_table [0])) - 1; - - iLower = 0; /* initialize binary search */ - iMiddle = iTop >> 1; /* start in the middle */ - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - mng_int32 iRslt = strcmp(func_table [iMiddle].zFunction, zFunction); - if (iRslt < 0) - iLower = iMiddle + 1; - else if (iRslt > 0) - iUpper = iMiddle - 1; - else - { - pEntry = &func_table [iMiddle]; - break; - }; - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (pEntry) /* found it ? */ - { - *iMajor = pEntry->iMajor; - *iMinor = pEntry->iMinor; - *iRelease = pEntry->iRelease; - return MNG_TRUE; - } - else - { - *iMajor = 0; - *iMinor = 0; - *iRelease = 0; - return MNG_FALSE; - } -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * HLAPI routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_handle MNG_DECL mng_initialize (mng_ptr pUserdata, - mng_memalloc fMemalloc, - mng_memfree fMemfree, - mng_traceproc fTraceproc) -{ - mng_datap pData; -#ifdef MNG_SUPPORT_DISPLAY - mng_retcode iRetcode; - mng_imagep pImage; -#endif - -#ifdef MNG_INTERNAL_MEMMNGMT /* allocate the main datastruc */ - pData = (mng_datap)calloc (1, sizeof (mng_data)); -#else - pData = (mng_datap)fMemalloc (sizeof (mng_data)); -#endif - - if (!pData) - return MNG_NULL; /* error: out of memory?? */ - /* validate the structure */ - pData->iMagic = MNG_MAGIC; - /* save userdata field */ - pData->pUserdata = pUserdata; - /* remember trace callback */ - pData->fTraceproc = fTraceproc; - -#ifdef MNG_SUPPORT_TRACE - if (mng_trace (pData, MNG_FN_INITIALIZE, MNG_LC_INITIALIZE)) - { - MNG_FREEX (pData, pData, sizeof (mng_data)); - return MNG_NULL; - } -#endif - /* default canvas styles are 8-bit RGB */ - pData->iCanvasstyle = MNG_CANVAS_RGB8; - pData->iBkgdstyle = MNG_CANVAS_RGB8; - - pData->iBGred = 0; /* black */ - pData->iBGgreen = 0; - pData->iBGblue = 0; - - pData->bUseBKGD = MNG_TRUE; - -#ifdef MNG_FULL_CMS - pData->bIssRGB = MNG_TRUE; - pData->hProf1 = 0; /* no profiles yet */ - pData->hProf2 = 0; - pData->hProf3 = 0; - pData->hTrans = 0; -#endif - - pData->dViewgamma = 1.0; - pData->dDisplaygamma = 2.2; - pData->dDfltimggamma = 0.45455; - /* initially remember chunks */ - pData->bStorechunks = MNG_TRUE; - /* no breaks at section-borders */ - pData->bSectionbreaks = MNG_FALSE; - /* initially cache playback info */ - pData->bCacheplayback = MNG_TRUE; - /* progressive refresh for large images */ - pData->bDoProgressive = MNG_TRUE; - /* crc exists; should check; error for - critical chunks; warning for ancillery; - generate crc for output */ - pData->iCrcmode = MNG_CRC_DEFAULT; - /* normal animation-speed ! */ - pData->iSpeed = mng_st_normal; - /* initial image limits */ - pData->iMaxwidth = 10000; - pData->iMaxheight = 10000; - -#ifdef MNG_INTERNAL_MEMMNGMT /* internal management */ - pData->fMemalloc = MNG_NULL; - pData->fMemfree = MNG_NULL; -#else /* keep callbacks */ - pData->fMemalloc = fMemalloc; - pData->fMemfree = fMemfree; -#endif - /* no value (yet) */ - pData->fReleasedata = MNG_NULL; -#ifndef MNG_NO_OPEN_CLOSE_STREAM - pData->fOpenstream = MNG_NULL; - pData->fClosestream = MNG_NULL; -#endif - pData->fReaddata = MNG_NULL; - pData->fWritedata = MNG_NULL; - pData->fErrorproc = MNG_NULL; - pData->fProcessheader = MNG_NULL; - pData->fProcesstext = MNG_NULL; - pData->fProcesssave = MNG_NULL; - pData->fProcessseek = MNG_NULL; - pData->fProcessneed = MNG_NULL; - pData->fProcessmend = MNG_NULL; - pData->fProcessunknown = MNG_NULL; - pData->fProcessterm = MNG_NULL; - pData->fGetcanvasline = MNG_NULL; - pData->fGetbkgdline = MNG_NULL; - pData->fGetalphaline = MNG_NULL; - pData->fRefresh = MNG_NULL; - pData->fGettickcount = MNG_NULL; - pData->fSettimer = MNG_NULL; - pData->fProcessgamma = MNG_NULL; - pData->fProcesschroma = MNG_NULL; - pData->fProcesssrgb = MNG_NULL; - pData->fProcessiccp = MNG_NULL; - pData->fProcessarow = MNG_NULL; - -#if defined(MNG_SUPPORT_DISPLAY) && (defined(MNG_GAMMA_ONLY) || defined(MNG_FULL_CMS)) - pData->dLastgamma = 0; /* lookup table needs first-time calc */ -#endif - -#ifdef MNG_SUPPORT_DISPLAY /* create object 0 */ - iRetcode = mng_create_imageobject (pData, 0, MNG_TRUE, MNG_TRUE, MNG_TRUE, - 0, 0, 0, 0, 0, 0, 0, 0, 0, MNG_FALSE, - 0, 0, 0, 0, &pImage); - - if (iRetcode) /* on error drop out */ - { - MNG_FREEX (pData, pData, sizeof (mng_data)); - return MNG_NULL; - } - - pData->pObjzero = pImage; -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_INCLUDE_LCMS) - mnglcms_initlibrary (); /* init lcms particulars */ -#endif - -#ifdef MNG_SUPPORT_READ - pData->bSuspensionmode = MNG_FALSE; - pData->iSuspendbufsize = 0; - pData->pSuspendbuf = MNG_NULL; - pData->pSuspendbufnext = MNG_NULL; - pData->iSuspendbufleft = 0; - pData->iChunklen = 0; - pData->pReadbufnext = MNG_NULL; - pData->pLargebufnext = MNG_NULL; - - pData->pFirstpushchunk = MNG_NULL; - pData->pLastpushchunk = MNG_NULL; - pData->pFirstpushdata = MNG_NULL; - pData->pLastpushdata = MNG_NULL; -#endif - -#ifdef MNG_INCLUDE_ZLIB - mngzlib_initialize (pData); /* initialize zlib structures and such */ - /* default zlib compression parameters */ - pData->iZlevel = MNG_ZLIB_LEVEL; - pData->iZmethod = MNG_ZLIB_METHOD; - pData->iZwindowbits = MNG_ZLIB_WINDOWBITS; - pData->iZmemlevel = MNG_ZLIB_MEMLEVEL; - pData->iZstrategy = MNG_ZLIB_STRATEGY; - /* default maximum IDAT data size */ - pData->iMaxIDAT = MNG_MAX_IDAT_SIZE; -#endif - -#ifdef MNG_INCLUDE_JNG /* default IJG compression parameters */ - pData->eJPEGdctmethod = MNG_JPEG_DCT; - pData->iJPEGquality = MNG_JPEG_QUALITY; - pData->iJPEGsmoothing = MNG_JPEG_SMOOTHING; - pData->bJPEGcompressprogr = MNG_JPEG_PROGRESSIVE; - pData->bJPEGcompressopt = MNG_JPEG_OPTIMIZED; - /* default maximum JDAT data size */ - pData->iMaxJDAT = MNG_MAX_JDAT_SIZE; -#endif - - mng_reset ((mng_handle)pData); - -#ifdef MNG_SUPPORT_TRACE - if (mng_trace (pData, MNG_FN_INITIALIZE, MNG_LC_END)) - { - MNG_FREEX (pData, pData, sizeof (mng_data)); - return MNG_NULL; - } -#endif - - return (mng_handle)pData; /* if we get here, we're in business */ -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_reset (mng_handle hHandle) -{ - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)(hHandle)); /* address main structure */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_SAVE - mng_drop_savedata (pData); /* cleanup saved-data from SAVE/SEEK */ -#endif -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS) - mng_clear_cms (pData); /* cleanup left-over cms stuff if any */ -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_INCLUDE_JNG) - mngjpeg_cleanup (pData); /* cleanup jpeg stuff */ -#endif - -#ifdef MNG_INCLUDE_ZLIB - if (pData->bInflating) /* if we've been inflating */ - { -#ifdef MNG_INCLUDE_DISPLAY_PROCS - mng_cleanup_rowproc (pData); /* cleanup row-processing, */ -#endif - mngzlib_inflatefree (pData); /* cleanup inflate! */ - } -#endif /* MNG_INCLUDE_ZLIB */ - -#ifdef MNG_SUPPORT_READ - if ((pData->bReading) && (!pData->bEOF)) - mng_process_eof (pData); /* cleanup app streaming */ - /* cleanup default read buffers */ - MNG_FREE (pData, pData->pReadbuf, pData->iReadbufsize); - MNG_FREE (pData, pData->pLargebuf, pData->iLargebufsize); - MNG_FREE (pData, pData->pSuspendbuf, pData->iSuspendbufsize); - - while (pData->pFirstpushdata) /* release any pushed data & chunks */ - mng_release_pushdata (pData); - while (pData->pFirstpushchunk) - mng_release_pushchunk (pData); -#endif - -#ifdef MNG_SUPPORT_WRITE /* cleanup default write buffer */ - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize); -#endif - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - mng_drop_chunks (pData); /* drop stored chunks (if any) */ -#endif - -#ifdef MNG_SUPPORT_DISPLAY - mng_drop_objects (pData, MNG_TRUE); /* drop stored objects (if any) */ - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->iGlobalProfilesize) /* drop global profile (if any) */ - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); -#endif -#endif - - pData->eSigtype = mng_it_unknown; - pData->eImagetype = mng_it_unknown; - pData->iWidth = 0; /* these are unknown yet */ - pData->iHeight = 0; - pData->iTicks = 0; - pData->iLayercount = 0; - pData->iFramecount = 0; - pData->iPlaytime = 0; - pData->iSimplicity = 0; - pData->iAlphadepth = 16; /* assume the worst! */ - - pData->iImagelevel = 0; /* no image encountered */ - - pData->iMagnify = 0; /* 1-to-1 display */ - pData->iOffsetx = 0; /* no offsets */ - pData->iOffsety = 0; - pData->iCanvaswidth = 0; /* let the app decide during processheader */ - pData->iCanvasheight = 0; - /* so far, so good */ - pData->iErrorcode = MNG_NOERROR; - pData->iSeverity = 0; - pData->iErrorx1 = 0; - pData->iErrorx2 = 0; - pData->zErrortext = MNG_NULL; - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - /* let's assume the best scenario */ -#ifndef MNG_NO_OLD_VERSIONS - pData->bPreDraft48 = MNG_FALSE; -#endif - /* the unknown chunk */ - pData->iChunkname = MNG_UINT_HUH; - pData->iChunkseq = 0; - pData->pFirstchunk = MNG_NULL; - pData->pLastchunk = MNG_NULL; - /* nothing processed yet */ - pData->bHasheader = MNG_FALSE; - pData->bHasMHDR = MNG_FALSE; - pData->bHasIHDR = MNG_FALSE; - pData->bHasBASI = MNG_FALSE; - pData->bHasDHDR = MNG_FALSE; -#ifdef MNG_INCLUDE_JNG - pData->bHasJHDR = MNG_FALSE; - pData->bHasJSEP = MNG_FALSE; - pData->bHasJDAA = MNG_FALSE; - pData->bHasJDAT = MNG_FALSE; -#endif - pData->bHasPLTE = MNG_FALSE; - pData->bHasTRNS = MNG_FALSE; - pData->bHasGAMA = MNG_FALSE; - pData->bHasCHRM = MNG_FALSE; - pData->bHasSRGB = MNG_FALSE; - pData->bHasICCP = MNG_FALSE; - pData->bHasBKGD = MNG_FALSE; - pData->bHasIDAT = MNG_FALSE; - - pData->bHasSAVE = MNG_FALSE; - pData->bHasBACK = MNG_FALSE; - pData->bHasFRAM = MNG_FALSE; - pData->bHasTERM = MNG_FALSE; - pData->bHasLOOP = MNG_FALSE; - /* there's no global stuff yet either */ - pData->bHasglobalPLTE = MNG_FALSE; - pData->bHasglobalTRNS = MNG_FALSE; - pData->bHasglobalGAMA = MNG_FALSE; - pData->bHasglobalCHRM = MNG_FALSE; - pData->bHasglobalSRGB = MNG_FALSE; - pData->bHasglobalICCP = MNG_FALSE; - - pData->iDatawidth = 0; /* no IHDR/BASI/DHDR done yet */ - pData->iDataheight = 0; - pData->iBitdepth = 0; - pData->iColortype = 0; - pData->iCompression = 0; - pData->iFilter = 0; - pData->iInterlace = 0; - -#ifdef MNG_INCLUDE_JNG - pData->iJHDRcolortype = 0; /* no JHDR data */ - pData->iJHDRimgbitdepth = 0; - pData->iJHDRimgcompression = 0; - pData->iJHDRimginterlace = 0; - pData->iJHDRalphabitdepth = 0; - pData->iJHDRalphacompression = 0; - pData->iJHDRalphafilter = 0; - pData->iJHDRalphainterlace = 0; -#endif - -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_READ /* no reading done */ - pData->bReading = MNG_FALSE; - pData->bHavesig = MNG_FALSE; - pData->bEOF = MNG_FALSE; - pData->iReadbufsize = 0; - pData->pReadbuf = MNG_NULL; - - pData->iLargebufsize = 0; - pData->pLargebuf = MNG_NULL; - - pData->iSuspendtime = 0; - pData->bSuspended = MNG_FALSE; - pData->iSuspendpoint = 0; - - pData->pSuspendbufnext = pData->pSuspendbuf; - pData->iSuspendbufleft = 0; -#endif /* MNG_SUPPORT_READ */ - -#ifdef MNG_SUPPORT_WRITE /* no creating/writing done */ - pData->bCreating = MNG_FALSE; - pData->bWriting = MNG_FALSE; - pData->iFirstchunkadded = 0; - pData->iWritebufsize = 0; - pData->pWritebuf = MNG_NULL; -#endif /* MNG_SUPPORT_WRITE */ - -#ifdef MNG_SUPPORT_DISPLAY /* done nuttin' yet */ - pData->bDisplaying = MNG_FALSE; - pData->iFrameseq = 0; - pData->iLayerseq = 0; - pData->iFrametime = 0; - - pData->iTotallayers = 0; - pData->iTotalframes = 0; - pData->iTotalplaytime = 0; - - pData->bSkipping = MNG_FALSE; - -#ifdef MNG_SUPPORT_DYNAMICMNG - pData->bDynamic = MNG_FALSE; - pData->bRunningevent = MNG_FALSE; - pData->bStopafterseek = MNG_FALSE; - pData->iEventx = 0; - pData->iEventy = 0; - pData->pLastmousemove = MNG_NULL; -#endif - - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - - pData->bRestorebkgd = MNG_FALSE; - - pData->iRuntime = 0; - pData->iSynctime = 0; - pData->iStarttime = 0; - pData->iEndtime = 0; - pData->bRunning = MNG_FALSE; - pData->bTimerset = MNG_FALSE; - pData->iBreakpoint = 0; - pData->bSectionwait = MNG_FALSE; - pData->bFreezing = MNG_FALSE; - pData->bResetting = MNG_FALSE; - pData->bNeedrefresh = MNG_FALSE; - pData->bMisplacedTERM = MNG_FALSE; - pData->bOnlyfirstframe = MNG_FALSE; - pData->iFramesafterTERM = 0; - /* these don't exist yet */ - pData->pCurrentobj = MNG_NULL; - pData->pCurraniobj = MNG_NULL; - pData->pTermaniobj = MNG_NULL; - pData->pLastclone = MNG_NULL; - pData->pStoreobj = MNG_NULL; - pData->pStorebuf = MNG_NULL; - pData->pRetrieveobj = MNG_NULL; - /* no saved data ! */ - pData->pSavedata = MNG_NULL; - - pData->iUpdateleft = 0; /* no region updated yet */ - pData->iUpdateright = 0; - pData->iUpdatetop = 0; - pData->iUpdatebottom = 0; - - pData->iPass = -1; /* interlacing stuff and temp buffers */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = 0; - pData->iSamplemul = 0; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = 0; - pData->iRowmax = 0; - pData->iFilterofs = 0; - pData->iPixelofs = 1; - pData->iLevel0 = 0; - pData->iLevel1 = 0; - pData->iLevel2 = 0; - pData->iLevel3 = 0; - pData->pWorkrow = MNG_NULL; - pData->pPrevrow = MNG_NULL; - pData->pRGBArow = MNG_NULL; - pData->bIsRGBA16 = MNG_TRUE; - pData->bIsOpaque = MNG_TRUE; - pData->iFilterbpp = 1; - - pData->iSourcel = 0; /* always initialized just before */ - pData->iSourcer = 0; /* compositing the next layer */ - pData->iSourcet = 0; - pData->iSourceb = 0; - pData->iDestl = 0; - pData->iDestr = 0; - pData->iDestt = 0; - pData->iDestb = 0; - /* lists are empty */ - pData->pFirstimgobj = MNG_NULL; - pData->pLastimgobj = MNG_NULL; - pData->pFirstaniobj = MNG_NULL; - pData->pLastaniobj = MNG_NULL; -#ifdef MNG_SUPPORT_DYNAMICMNG - pData->pFirstevent = MNG_NULL; - pData->pLastevent = MNG_NULL; -#endif - /* no processing callbacks */ - pData->fDisplayrow = MNG_NULL; - pData->fRestbkgdrow = MNG_NULL; - pData->fCorrectrow = MNG_NULL; - pData->fRetrieverow = MNG_NULL; - pData->fStorerow = MNG_NULL; - pData->fProcessrow = MNG_NULL; - pData->fDifferrow = MNG_NULL; - pData->fScalerow = MNG_NULL; - pData->fDeltarow = MNG_NULL; -#ifndef MNG_SKIPCHUNK_PAST - pData->fFliprow = MNG_NULL; - pData->fTilerow = MNG_NULL; -#endif - pData->fInitrowproc = MNG_NULL; - - pData->iPLTEcount = 0; /* no PLTE data */ - -#ifndef MNG_SKIPCHUNK_DEFI - pData->iDEFIobjectid = 0; /* no DEFI data */ - pData->bDEFIhasdonotshow = MNG_FALSE; - pData->iDEFIdonotshow = 0; - pData->bDEFIhasconcrete = MNG_FALSE; - pData->iDEFIconcrete = 0; - pData->bDEFIhasloca = MNG_FALSE; - pData->iDEFIlocax = 0; - pData->iDEFIlocay = 0; - pData->bDEFIhasclip = MNG_FALSE; - pData->iDEFIclipl = 0; - pData->iDEFIclipr = 0; - pData->iDEFIclipt = 0; - pData->iDEFIclipb = 0; -#endif - -#ifndef MNG_SKIPCHUNK_BACK - pData->iBACKred = 0; /* no BACK data */ - pData->iBACKgreen = 0; - pData->iBACKblue = 0; - pData->iBACKmandatory = 0; - pData->iBACKimageid = 0; - pData->iBACKtile = 0; -#endif - -#ifndef MNG_SKIPCHUNK_FRAM - pData->iFRAMmode = 1; /* default global FRAM variables */ - pData->iFRAMdelay = 1; - pData->iFRAMtimeout = 0x7fffffffl; - pData->bFRAMclipping = MNG_FALSE; - pData->iFRAMclipl = 0; - pData->iFRAMclipr = 0; - pData->iFRAMclipt = 0; - pData->iFRAMclipb = 0; - - pData->iFramemode = 1; /* again for the current frame */ - pData->iFramedelay = 1; - pData->iFrametimeout = 0x7fffffffl; - pData->bFrameclipping = MNG_FALSE; - pData->iFrameclipl = 0; - pData->iFrameclipr = 0; - pData->iFrameclipt = 0; - pData->iFrameclipb = 0; - - pData->iNextdelay = 1; -#endif - -#ifndef MNG_SKIPCHUNK_SHOW - pData->iSHOWmode = 0; /* no SHOW data */ - pData->iSHOWfromid = 0; - pData->iSHOWtoid = 0; - pData->iSHOWnextid = 0; - pData->iSHOWskip = 0; -#endif - - pData->iGlobalPLTEcount = 0; /* no global PLTE data */ - - pData->iGlobalTRNSrawlen = 0; /* no global tRNS data */ - - pData->iGlobalGamma = 0; /* no global gAMA data */ - -#ifndef MNG_SKIPCHUNK_cHRM - pData->iGlobalWhitepointx = 0; /* no global cHRM data */ - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; -#endif - - pData->iGlobalRendintent = 0; /* no global sRGB data */ - -#ifndef MNG_SKIPCHUNK_iCCP - pData->iGlobalProfilesize = 0; /* no global iCCP data */ - pData->pGlobalProfile = MNG_NULL; -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - pData->iGlobalBKGDred = 0; /* no global bKGD data */ - pData->iGlobalBKGDgreen = 0; - pData->iGlobalBKGDblue = 0; -#endif - /* no delta-image */ -#ifndef MNG_NO_DELTA_PNG - pData->pDeltaImage = MNG_NULL; - pData->iDeltaImagetype = 0; - pData->iDeltatype = 0; - pData->iDeltaBlockwidth = 0; - pData->iDeltaBlockheight = 0; - pData->iDeltaBlockx = 0; - pData->iDeltaBlocky = 0; - pData->bDeltaimmediate = MNG_FALSE; - - pData->fDeltagetrow = MNG_NULL; - pData->fDeltaaddrow = MNG_NULL; - pData->fDeltareplacerow = MNG_NULL; - pData->fDeltaputrow = MNG_NULL; - - pData->fPromoterow = MNG_NULL; - pData->fPromBitdepth = MNG_NULL; - pData->pPromBuf = MNG_NULL; - pData->iPromColortype = 0; - pData->iPromBitdepth = 0; - pData->iPromFilltype = 0; - pData->iPromWidth = 0; - pData->pPromSrc = MNG_NULL; - pData->pPromDst = MNG_NULL; -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - pData->iMAGNfromid = 0; - pData->iMAGNtoid = 0; -#endif - -#ifndef MNG_SKIPCHUNK_PAST - pData->iPastx = 0; - pData->iPasty = 0; -#endif - - pData->pLastseek = MNG_NULL; -#endif - -#ifdef MNG_INCLUDE_ZLIB - pData->bInflating = 0; /* no inflating or deflating */ - pData->bDeflating = 0; /* going on at the moment */ -#endif - -#ifdef MNG_SUPPORT_DISPLAY /* reset object 0 */ - mng_reset_objzero (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_RESET, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_cleanup (mng_handle* hHandle) -{ - mng_datap pData; /* local vars */ -#ifndef MNG_INTERNAL_MEMMNGMT - mng_memfree fFree; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)*hHandle), MNG_FN_CLEANUP, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (*hHandle) /* check validity handle */ - pData = ((mng_datap)(*hHandle)); /* and address main structure */ - - mng_reset (*hHandle); /* do an implicit reset to cleanup most stuff */ - -#ifdef MNG_SUPPORT_DISPLAY /* drop object 0 */ - mng_free_imageobject (pData, (mng_imagep)pData->pObjzero); -#endif - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_FULL_CMS) - if (pData->hProf2) /* output profile defined ? */ - mnglcms_freeprofile (pData->hProf2); - - if (pData->hProf3) /* sRGB profile defined ? */ - mnglcms_freeprofile (pData->hProf3); -#endif - -#ifdef MNG_INCLUDE_ZLIB - mngzlib_cleanup (pData); /* cleanup zlib stuff */ -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)*hHandle), MNG_FN_CLEANUP, MNG_LC_CLEANUP) -#endif - - pData->iMagic = 0; /* invalidate the actual memory */ - -#ifdef MNG_INTERNAL_MEMMNGMT - free ((void *)*hHandle); /* cleanup the data-structure */ -#else - fFree = ((mng_datap)*hHandle)->fMemfree; - fFree ((mng_ptr)*hHandle, sizeof (mng_data)); -#endif - - *hHandle = 0; /* wipe pointer to inhibit future use */ - - return MNG_NOERROR; /* and we're done */ -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - MNG_VALIDCB (hHandle, fOpenstream) - MNG_VALIDCB (hHandle, fClosestream) -#endif - MNG_VALIDCB (hHandle, fReaddata) - -#ifdef MNG_SUPPORT_DISPLAY /* valid at this point ? */ - if ((pData->bReading) || (pData->bDisplaying)) -#else - if (pData->bReading) -#endif - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - -#ifdef MNG_SUPPORT_WRITE - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bReading = MNG_TRUE; /* read only! */ - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fOpenstream && !pData->fOpenstream (hHandle)) - /* open it and start reading */ - iRetcode = MNG_APPIOERROR; - else -#endif - iRetcode = mng_read_graphic (pData); - - if (pData->bEOF) /* already at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - -#ifdef MNG_SUPPORT_DISPLAY - mng_reset_rundata (pData); /* reset rundata */ -#endif - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_pushdata (mng_handle hHandle, - mng_ptr pData, - mng_size_t iLength, - mng_bool bTakeownership) -{ - mng_datap pMyData; /* local vars */ - mng_pushdatap pPush; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pMyData = ((mng_datap)hHandle); /* and make it addressable */ - /* create a containing buffer */ - iRetcode = make_pushbuffer (pMyData, pData, iLength, bTakeownership, &pPush); - if (iRetcode) - return iRetcode; - - if (pMyData->pLastpushdata) /* and update the buffer chain */ - pMyData->pLastpushdata->pNext = pPush; - else - pMyData->pFirstpushdata = pPush; - - pMyData->pLastpushdata = pPush; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_pushsig (mng_handle hHandle, - mng_imgtype eSigtype) -{ - mng_datap pData; /* local vars */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHSIG, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->bHavesig) /* can we expect this call ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - pData->eSigtype = eSigtype; - pData->bHavesig = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHSIG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_pushchunk (mng_handle hHandle, - mng_ptr pChunk, - mng_size_t iLength, - mng_bool bTakeownership) -{ - mng_datap pMyData; /* local vars */ - mng_pushdatap pPush; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHCHUNK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pMyData = ((mng_datap)hHandle); /* and make it addressable */ - /* create a containing buffer */ - iRetcode = make_pushbuffer (pMyData, pChunk, iLength, bTakeownership, &pPush); - if (iRetcode) - return iRetcode; - - if (pMyData->pLastpushchunk) /* and update the buffer chain */ - pMyData->pLastpushchunk->pNext = pPush; - else - pMyData->pFirstpushchunk = pPush; - - pMyData->pLastpushchunk = pPush; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_PUSHCHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_read_resume (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_RESUME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - /* can we expect this call ? */ - if ((!pData->bReading) || (!pData->bSuspended)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bSuspended = MNG_FALSE; /* reset the flag */ - -#ifdef MNG_SUPPORT_DISPLAY /* re-synchronize ? */ - if ((pData->bDisplaying) && (pData->bRunning)) - pData->iSynctime = pData->iSynctime - pData->iSuspendtime + - pData->fGettickcount (hHandle); -#endif - - iRetcode = mng_read_graphic (pData); /* continue reading now */ - - if (pData->bEOF) /* at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - -#ifdef MNG_SUPPORT_DISPLAY - mng_reset_rundata (pData); /* reset rundata */ -#endif - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READ_RESUME, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_write (mng_handle hHandle) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_WRITE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - MNG_VALIDCB (hHandle, fOpenstream) - MNG_VALIDCB (hHandle, fClosestream) -#endif - MNG_VALIDCB (hHandle, fWritedata) - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) /* valid at this point ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - cleanup_errors (pData); /* cleanup previous errors */ - - iRetcode = mng_write_graphic (pData);/* do the write */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_WRITE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_create (mng_handle hHandle) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_CREATE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) /* valid at this point ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - iRetcode = mng_reset (hHandle); /* clear any previous stuff */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bCreating = MNG_TRUE; /* indicate we're creating a new file */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_CREATE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_READ) -mng_retcode MNG_DECL mng_readdisplay (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READDISPLAY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - - MNG_VALIDCB (hHandle, fReaddata) - MNG_VALIDCB (hHandle, fGetcanvasline) - MNG_VALIDCB (hHandle, fRefresh) - MNG_VALIDCB (hHandle, fGettickcount) - MNG_VALIDCB (hHandle, fSettimer) - /* valid at this point ? */ - if ((pData->bReading) || (pData->bDisplaying)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - -#ifdef MNG_SUPPORT_WRITE - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bReading = MNG_TRUE; /* read & display! */ - pData->bDisplaying = MNG_TRUE; - pData->bRunning = MNG_TRUE; - pData->iFrameseq = 0; - pData->iLayerseq = 0; - pData->iFrametime = 0; - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - pData->iRuntime = 0; - pData->iSynctime = pData->fGettickcount (hHandle); - pData->iSuspendtime = 0; - pData->iStarttime = pData->iSynctime; - pData->iEndtime = 0; - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fOpenstream && !pData->fOpenstream (hHandle)) - /* open it and start reading */ - iRetcode = MNG_APPIOERROR; - else -#endif - iRetcode = mng_read_graphic (pData); - - if (pData->bEOF) /* already at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - mng_drop_invalid_objects (pData); /* drop invalidly stored objects */ - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - else - if (pData->bTimerset) /* indicate timer break ? */ - iRetcode = MNG_NEEDTIMERWAIT; - else - if (pData->bSectionwait) /* indicate section break ? */ - iRetcode = MNG_NEEDSECTIONWAIT; - else - { /* no breaks = end of run */ - pData->bRunning = MNG_FALSE; - - if (pData->bFreezing) /* dynamic MNG reached SEEK ? */ - pData->bFreezing = MNG_FALSE; /* reset it ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_READDISPLAY, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_DISPLAY && MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle and callbacks */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - -#ifndef MNG_INTERNAL_MEMMNGMT - MNG_VALIDCB (hHandle, fMemalloc) - MNG_VALIDCB (hHandle, fMemfree) -#endif - - MNG_VALIDCB (hHandle, fGetcanvasline) - MNG_VALIDCB (hHandle, fRefresh) - MNG_VALIDCB (hHandle, fGettickcount) - MNG_VALIDCB (hHandle, fSettimer) - - if (pData->bDisplaying) /* valid at this point ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - -#ifdef MNG_SUPPORT_WRITE - if ((pData->bWriting) || (pData->bCreating)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); -#endif - - cleanup_errors (pData); /* cleanup previous errors */ - - pData->bDisplaying = MNG_TRUE; /* display! */ - pData->bRunning = MNG_TRUE; - pData->iFrameseq = 0; - pData->iLayerseq = 0; - pData->iFrametime = 0; - pData->iRequestframe = 0; - pData->iRequestlayer = 0; - pData->iRequesttime = 0; - pData->bSearching = MNG_FALSE; - pData->iRuntime = 0; - pData->iSynctime = pData->fGettickcount (hHandle); -#ifdef MNG_SUPPORT_READ - pData->iSuspendtime = 0; -#endif - pData->iStarttime = pData->iSynctime; - pData->iEndtime = 0; - pData->pCurraniobj = pData->pFirstaniobj; - /* go do it */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bTimerset) /* indicate timer break ? */ - iRetcode = MNG_NEEDTIMERWAIT; - else - { /* no breaks = end of run */ - pData->bRunning = MNG_FALSE; - - if (pData->bFreezing) /* dynamic MNG reached SEEK ? */ - pData->bFreezing = MNG_FALSE; /* reset it ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display_resume (mng_handle hHandle) -{ - mng_datap pData; /* local vars */ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESUME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (!pData->bDisplaying) /* can we expect this call ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - /* was it running ? */ - if ((pData->bRunning) || (pData->bReading)) - { /* are we expecting this call ? */ - if ((pData->bTimerset) || (pData->bSuspended) || (pData->bSectionwait)) - { - pData->bTimerset = MNG_FALSE; /* reset the flags */ - pData->bSectionwait = MNG_FALSE; - -#ifdef MNG_SUPPORT_READ - if (pData->bReading) /* set during read&display ? */ - { - if (pData->bSuspended) /* calculate proper synchronization */ - pData->iSynctime = pData->iSynctime - pData->iSuspendtime + - pData->fGettickcount (hHandle); - else - pData->iSynctime = pData->fGettickcount (hHandle); - - pData->bSuspended = MNG_FALSE; /* now reset this flag */ - /* and continue reading */ - iRetcode = mng_read_graphic (pData); - - if (pData->bEOF) /* already at EOF ? */ - { - pData->bReading = MNG_FALSE; /* then we're no longer reading */ - /* drop invalidly stored objects */ - mng_drop_invalid_objects (pData); - } - } - else -#endif /* MNG_SUPPORT_READ */ - { /* synchronize timing */ - pData->iSynctime = pData->fGettickcount (hHandle); - /* resume display processing */ - iRetcode = mng_process_display (pData); - } - } - else - { - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - } - } - else - { /* synchronize timing */ - pData->iSynctime = pData->fGettickcount (hHandle); - pData->bRunning = MNG_TRUE; /* it's restarted again ! */ - /* resume display processing */ - iRetcode = mng_process_display (pData); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->bSuspended) /* read suspension ? */ - { - iRetcode = MNG_NEEDMOREDATA; - pData->iSuspendtime = pData->fGettickcount ((mng_handle)pData); - } - else - if (pData->bTimerset) /* indicate timer break ? */ - iRetcode = MNG_NEEDTIMERWAIT; - else - if (pData->bSectionwait) /* indicate section break ? */ - iRetcode = MNG_NEEDSECTIONWAIT; - else - { /* no breaks = end of run */ - pData->bRunning = MNG_FALSE; - - if (pData->bFreezing) /* trying to freeze ? */ - pData->bFreezing = MNG_FALSE; /* then we're there */ - - if (pData->bResetting) /* trying to reset as well ? */ - { /* full stop!!! */ - pData->bDisplaying = MNG_FALSE; - - iRetcode = mng_reset_rundata (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESUME, MNG_LC_END); -#endif - - return iRetcode; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display_freeze (mng_handle hHandle) -{ - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_FREEZE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bReading)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->bRunning) /* is it running ? */ - { - mng_retcode iRetcode; - - pData->bFreezing = MNG_TRUE; /* indicate we need to freeze */ - /* continue "normal" processing */ - iRetcode = mng_display_resume (hHandle); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_FREEZE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_display_reset (mng_handle hHandle) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESET, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bReading)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->bRunning) /* is it running ? */ - { - pData->bFreezing = MNG_TRUE; /* indicate we need to freeze */ - pData->bResetting = MNG_TRUE; /* indicate we're about to reset too */ - /* continue normal processing ? */ - iRetcode = mng_display_resume (hHandle); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - else - { /* full stop!!! */ - pData->bDisplaying = MNG_FALSE; - - iRetcode = mng_reset_rundata (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_RESET, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -mng_retcode MNG_DECL mng_display_goframe (mng_handle hHandle, - mng_uint32 iFramenr) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOFRAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bRunning)) - MNG_ERROR ((mng_datap)hHandle, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (iFramenr > pData->iTotalframes) /* is the parameter within bounds ? */ - MNG_ERROR (pData, MNG_FRAMENRTOOHIGH); - /* within MHDR bounds ? */ - if ((pData->iFramecount) && (iFramenr > pData->iFramecount)) - MNG_WARNING (pData, MNG_FRAMENRTOOHIGH); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->iFrameseq > iFramenr) /* search from current or go back to start ? */ - { - iRetcode = mng_reset_rundata (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (iFramenr) - { - pData->iRequestframe = iFramenr; /* go find the requested frame then */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bTimerset = MNG_FALSE; /* reset just to be safe */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOFRAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -mng_retcode MNG_DECL mng_display_golayer (mng_handle hHandle, - mng_uint32 iLayernr) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOLAYER, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bRunning)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (iLayernr > pData->iTotallayers) /* is the parameter within bounds ? */ - MNG_ERROR (pData, MNG_LAYERNRTOOHIGH); - /* within MHDR bounds ? */ - if ((pData->iLayercount) && (iLayernr > pData->iLayercount)) - MNG_WARNING (pData, MNG_LAYERNRTOOHIGH); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->iLayerseq > iLayernr) /* search from current or go back to start ? */ - { - iRetcode = mng_reset_rundata (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (iLayernr) - { - pData->iRequestlayer = iLayernr; /* go find the requested layer then */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bTimerset = MNG_FALSE; /* reset just to be safe */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOLAYER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -mng_retcode MNG_DECL mng_display_gotime (mng_handle hHandle, - mng_uint32 iPlaytime) -{ - mng_datap pData; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOTIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - /* can we expect this call ? */ - if ((!pData->bDisplaying) || (pData->bRunning)) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - /* is the parameter within bounds ? */ - if (iPlaytime > pData->iTotalplaytime) - MNG_ERROR (pData, MNG_PLAYTIMETOOHIGH); - /* within MHDR bounds ? */ - if ((pData->iPlaytime) && (iPlaytime > pData->iPlaytime)) - MNG_WARNING (pData, MNG_PLAYTIMETOOHIGH); - - cleanup_errors (pData); /* cleanup previous errors */ - - if (pData->iFrametime > iPlaytime) /* search from current or go back to start ? */ - { - iRetcode = mng_reset_rundata (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - if (iPlaytime) - { - pData->iRequesttime = iPlaytime; /* go find the requested playtime then */ - iRetcode = mng_process_display (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pData->bTimerset = MNG_FALSE; /* reset just to be safe */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_DISPLAY_GOTIME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_DISPLAY) && defined(MNG_SUPPORT_DYNAMICMNG) -mng_retcode MNG_DECL mng_trapevent (mng_handle hHandle, - mng_uint8 iEventtype, - mng_int32 iX, - mng_int32 iY) -{ - mng_datap pData; - mng_eventp pEvent; - mng_bool bFound = MNG_FALSE; - mng_retcode iRetcode; - mng_imagep pImage; - mng_uint8p pPixel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_TRAPEVENT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - if (pData->eImagetype != mng_it_mng) /* is it an animation ? */ - MNG_ERROR (pData, MNG_NOTANANIMATION); - - if (!pData->bDisplaying) /* can we expect this call ? */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (!pData->bCacheplayback) /* must store playback info to work!! */ - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - /* let's find a matching event object */ - pEvent = (mng_eventp)pData->pFirstevent; - - while ((pEvent) && (!bFound)) - { /* matching eventtype ? */ - if (pEvent->iEventtype == iEventtype) - { - switch (pEvent->iMasktype) /* check X/Y on basis of masktype */ - { - case MNG_MASK_NONE : /* no mask is easy */ - { - bFound = MNG_TRUE; - break; - } - - case MNG_MASK_BOX : /* inside the given box ? */ - { /* right- and bottom-border don't count ! */ - if ((iX >= pEvent->iLeft) && (iX < pEvent->iRight) && - (iY >= pEvent->iTop) && (iY < pEvent->iBottom)) - bFound = MNG_TRUE; - break; - } - - case MNG_MASK_OBJECT : /* non-zero pixel in the image object ? */ - { - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - ((mng_int32)pImage->pImgbuf->iWidth > iX) && - ((mng_int32)pImage->pImgbuf->iHeight > iY)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iY) + iX); - - if (*pPixel) /* non-zero ? */ - bFound = MNG_TRUE; - } - - break; - } - - case MNG_MASK_OBJECTIX : /* pixel in the image object matches index ? */ - { - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - ((mng_int32)pImage->pImgbuf->iWidth > iX) && (iX >= 0) && - ((mng_int32)pImage->pImgbuf->iHeight > iY) && (iY >= 0)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iY) + iX); - /* matching index ? */ - if (*pPixel == pEvent->iIndex) - bFound = MNG_TRUE; - } - - break; - } - - case MNG_MASK_BOXOBJECT : /* non-zero pixel in the image object ? */ - { - mng_int32 iTempx = iX - pEvent->iLeft; - mng_int32 iTempy = iY - pEvent->iTop; - - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - (iTempx < (mng_int32)pImage->pImgbuf->iWidth) && - (iTempx >= 0) && (iX < pEvent->iRight) && - (iTempy < (mng_int32)pImage->pImgbuf->iHeight) && - (iTempy >= 0) && (iY < pEvent->iBottom)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iTempy) + iTempx); - - if (*pPixel) /* non-zero ? */ - bFound = MNG_TRUE; - } - - break; - } - - case MNG_MASK_BOXOBJECTIX : /* pixel in the image object matches index ? */ - { - mng_int32 iTempx = iX - pEvent->iLeft; - mng_int32 iTempy = iY - pEvent->iTop; - - pImage = mng_find_imageobject (pData, pEvent->iObjectid); - /* valid image ? */ - if ((pImage) && (pImage->pImgbuf->iBitdepth <= 8) && - ((pImage->pImgbuf->iColortype == 0) || (pImage->pImgbuf->iColortype == 3)) && - (iTempx < (mng_int32)pImage->pImgbuf->iWidth) && - (iTempx >= 0) && (iX < pEvent->iRight) && - (iTempy < (mng_int32)pImage->pImgbuf->iHeight) && - (iTempy >= 0) && (iY < pEvent->iBottom)) - { - pPixel = pImage->pImgbuf->pImgdata + ((pImage->pImgbuf->iWidth * iTempy) + iTempx); - /* matching index ? */ - if (*pPixel == pEvent->iIndex) - bFound = MNG_TRUE; - } - - break; - } - - } - } - - if (!bFound) /* try the next one */ - pEvent = (mng_eventp)pEvent->sHeader.pNext; - } - /* found one that's not the last mousemove ? */ - if ((pEvent) && ((mng_objectp)pEvent != pData->pLastmousemove)) - { /* can we start an event process now ? */ - if ((!pData->bReading) && (!pData->bRunning)) - { - pData->iEventx = iX; /* save coordinates */ - pData->iEventy = iY; - /* do it then ! */ - iRetcode = pEvent->sHeader.fProcess (pData, pEvent); - - if (iRetcode) /* on error bail out */ - return iRetcode; - /* remember last mousemove event */ - if (pEvent->iEventtype == MNG_EVENT_MOUSEMOVE) - pData->pLastmousemove = (mng_objectp)pEvent; - else - pData->pLastmousemove = MNG_NULL; - } - else - { - - /* TODO: store unprocessed events or not ??? */ - - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_TRAPEVENT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_getlasterror (mng_handle hHandle, - mng_int8* iSeverity, - mng_chunkid* iChunkname, - mng_uint32* iChunkseq, - mng_int32* iExtra1, - mng_int32* iExtra2, - mng_pchar* zErrortext) -{ - mng_datap pData; /* local vars */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETLASTERROR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) /* check validity handle */ - pData = ((mng_datap)hHandle); /* and make it addressable */ - - *iSeverity = pData->iSeverity; /* return the appropriate fields */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) - *iChunkname = pData->iChunkname; - *iChunkseq = pData->iChunkseq; -#else - *iChunkname = MNG_UINT_HUH; - *iChunkseq = 0; -#endif - - *iExtra1 = pData->iErrorx1; - *iExtra2 = pData->iErrorx2; - *zErrortext = pData->zErrortext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GETLASTERROR, MNG_LC_END); -#endif - - return pData->iErrorcode; /* and the errorcode */ -} - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - diff --git a/Engine/lib/lmng/libmng_jpeg.c b/Engine/lib/lmng/libmng_jpeg.c deleted file mode 100644 index 5042e1d55..000000000 --- a/Engine/lib/lmng/libmng_jpeg.c +++ /dev/null @@ -1,1088 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_jpeg.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : JPEG library interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the JPEG library interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/22/2000 - G.Juyn * */ -/* * - implemented all the JNG routines * */ -/* * * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - added tracing of JPEG calls * */ -/* * 0.5.3 - 06/24/2000 - G.Juyn * */ -/* * - fixed inclusion of IJG read/write code * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed some 64-bit warnings * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 1.0.1 - 04/19/2001 - G.Juyn * */ -/* * - added export of JPEG functions for DLL * */ -/* * 1.0.1 - 04/22/2001 - G.Juyn * */ -/* * - fixed memory-leaks (Thanks Gregg!) * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B526138 - returned IJGSRC6B calling convention to * */ -/* * default for MSVC * */ -/* * * */ -/* * 1.0.5 - 24/02/2003 - G.Juyn * */ -/* * - B683152 - libjpeg suspension not always honored correctly* */ -/* * * */ -/* * 1.0.6 - 03/04/2003 - G.Juyn * */ -/* * - fixed some compiler-warnings * */ -/* * * */ -/* * 1.0.8 - 08/01/2004 - G.Juyn * */ -/* * - added support for 3+byte pixelsize for JPEG's * */ -/* * * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_pixels.h" -#include "libmng_jpeg.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#if defined(MNG_INCLUDE_JNG) && defined(MNG_INCLUDE_DISPLAY_PROCS) - -/* ************************************************************************** */ -/* * * */ -/* * Local IJG callback routines (source-manager, error-manager and such) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_IJG6B - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_init_source (j_decompress_ptr cinfo) -#else -void mng_init_source (j_decompress_ptr cinfo) -#endif -{ - return; /* nothing needed */ -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -boolean MNG_DECL mng_fill_input_buffer (j_decompress_ptr cinfo) -#else -boolean mng_fill_input_buffer (j_decompress_ptr cinfo) -#endif -{ - return FALSE; /* force IJG routine to return to caller */ -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes) -#else -void mng_skip_input_data (j_decompress_ptr cinfo, long num_bytes) -#endif -{ - if (num_bytes > 0) /* ignore fony calls */ - { /* address my generic structure */ - mng_datap pData = (mng_datap)cinfo->client_data; - /* address source manager */ - mngjpeg_sourcep pSrc = pData->pJPEGdinfo->src; - /* problem scenario ? */ - if (pSrc->bytes_in_buffer < (size_t)num_bytes) - { /* tell the boss we need to skip some data! */ - pData->iJPEGtoskip = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer); - - pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */ - pSrc->next_input_byte = MNG_NULL; - } - else - { /* simply advance in the buffer */ - pSrc->bytes_in_buffer -= num_bytes; - pSrc->next_input_byte += num_bytes; - } - } - - return; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes) -#else -void mng_skip_input_data2 (j_decompress_ptr cinfo, long num_bytes) -#endif -{ - if (num_bytes > 0) /* ignore fony calls */ - { /* address my generic structure */ - mng_datap pData = (mng_datap)cinfo->client_data; - /* address source manager */ - mngjpeg_sourcep pSrc = pData->pJPEGdinfo2->src; - /* problem scenario ? */ - if (pSrc->bytes_in_buffer < (size_t)num_bytes) - { /* tell the boss we need to skip some data! */ - pData->iJPEGtoskip2 = (mng_uint32)((size_t)num_bytes - pSrc->bytes_in_buffer); - - pSrc->bytes_in_buffer = 0; /* let the JPEG lib suspend */ - pSrc->next_input_byte = MNG_NULL; - } - else - { /* simply advance in the buffer */ - pSrc->bytes_in_buffer -= num_bytes; - pSrc->next_input_byte += num_bytes; - } - } - - return; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_term_source (j_decompress_ptr cinfo) -#else -void mng_term_source (j_decompress_ptr cinfo) -#endif -{ - return; /* nothing needed */ -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_USE_SETJMP -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_error_exit (j_common_ptr cinfo) -#else -void mng_error_exit (j_common_ptr cinfo) -#endif -{ /* address my generic structure */ - mng_datap pData = (mng_datap)cinfo->client_data; - -#ifdef MNG_ERROR_TELLTALE /* fill the message text ??? */ - (*cinfo->err->output_message) (cinfo); -#endif - /* return to the point of no return... */ - longjmp (pData->sErrorbuf, cinfo->err->msg_code); -} -#endif /* MNG_USE_SETJMP */ - -/* ************************************************************************** */ - -#ifdef MNG_USE_SETJMP -#ifdef MNG_DEFINE_JPEG_STDCALL -void MNG_DECL mng_output_message (j_common_ptr cinfo) -#else -void mng_output_message (j_common_ptr cinfo) -#endif -{ - return; /* just do nothing ! */ -} -#endif /* MNG_USE_SETJMP */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_IJG6B */ - -/* ************************************************************************** */ -/* * * */ -/* * Global JPEG routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mngjpeg_initialize (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_START); -#endif - /* allocate space for JPEG structures if necessary */ -#ifdef MNG_INCLUDE_JNG_READ - if (pData->pJPEGderr == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGderr, sizeof (mngjpeg_error )); - if (pData->pJPEGdsrc == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source)); - if (pData->pJPEGdinfo == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp)); - /* enable reverse addressing */ - pData->pJPEGdinfo->client_data = pData; - - if (pData->pJPEGderr2 == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGderr2, sizeof (mngjpeg_error )); - if (pData->pJPEGdsrc2 == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source)); - if (pData->pJPEGdinfo2 == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp)); - /* enable reverse addressing */ - pData->pJPEGdinfo2->client_data = pData; -#endif - -#ifdef MNG_INCLUDE_JNG_WRITE - if (pData->pJPEGcerr == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGcerr, sizeof (mngjpeg_error )); - if (pData->pJPEGcinfo == MNG_NULL) - MNG_ALLOC (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp )); - /* enable reverse addressing */ - pData->pJPEGcinfo->client_data = pData; -#endif - - if (pData->pJPEGbuf == MNG_NULL) /* initialize temporary buffers */ - { - pData->iJPEGbufmax = MNG_JPEG_MAXBUF; - MNG_ALLOC (pData, pData->pJPEGbuf, pData->iJPEGbufmax); - } - - if (pData->pJPEGbuf2 == MNG_NULL) - { - pData->iJPEGbufmax2 = MNG_JPEG_MAXBUF; - MNG_ALLOC (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2); - } - - pData->pJPEGcurrent = pData->pJPEGbuf; - pData->iJPEGbufremain = 0; - pData->pJPEGrow = MNG_NULL; - pData->iJPEGrowlen = 0; - pData->iJPEGtoskip = 0; - - pData->pJPEGcurrent2 = pData->pJPEGbuf2; - pData->iJPEGbufremain2 = 0; - pData->pJPEGrow2 = MNG_NULL; - pData->iJPEGrowlen2 = 0; - pData->iJPEGtoskip2 = 0; - /* not doing anything yet ! */ - pData->bJPEGcompress = MNG_FALSE; - - pData->bJPEGdecompress = MNG_FALSE; - pData->bJPEGhasheader = MNG_FALSE; - pData->bJPEGdecostarted = MNG_FALSE; - pData->bJPEGscanstarted = MNG_FALSE; - pData->bJPEGscanending = MNG_FALSE; - - pData->bJPEGdecompress2 = MNG_FALSE; - pData->bJPEGhasheader2 = MNG_FALSE; - pData->bJPEGdecostarted2 = MNG_FALSE; - pData->bJPEGscanstarted2 = MNG_FALSE; - - pData->iJPEGrow = 0; /* zero input/output lines */ - pData->iJPEGalpharow = 0; - pData->iJPEGrgbrow = 0; - pData->iJPEGdisprow = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_INITIALIZE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngjpeg_cleanup (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_CLEANUP, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B -#ifdef MNG_USE_SETJMP - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - -#ifdef MNG_INCLUDE_JNG_READ /* still decompressing something ? */ - if (pData->bJPEGdecompress) - jpeg_destroy_decompress (pData->pJPEGdinfo); - if (pData->bJPEGdecompress2) - jpeg_destroy_decompress (pData->pJPEGdinfo2); -#endif - -#ifdef MNG_INCLUDE_JNG_WRITE - if (pData->bJPEGcompress) /* still compressing something ? */ - jpeg_destroy_compress (pData->pJPEGcinfo); -#endif - -#endif /* MNG_INCLUDE_IJG6B */ - /* cleanup temporary buffers */ - MNG_FREE (pData, pData->pJPEGbuf2, pData->iJPEGbufmax2); - MNG_FREE (pData, pData->pJPEGbuf, pData->iJPEGbufmax); - /* cleanup space for JPEG structures */ -#ifdef MNG_INCLUDE_JNG_WRITE - MNG_FREE (pData, pData->pJPEGcinfo, sizeof (mngjpeg_comp )); - MNG_FREE (pData, pData->pJPEGcerr, sizeof (mngjpeg_error )); -#endif - -#ifdef MNG_INCLUDE_JNG_READ - MNG_FREE (pData, pData->pJPEGdinfo, sizeof (mngjpeg_decomp)); - MNG_FREE (pData, pData->pJPEGdsrc, sizeof (mngjpeg_source)); - MNG_FREE (pData, pData->pJPEGderr, sizeof (mngjpeg_error )); - MNG_FREE (pData, pData->pJPEGdinfo2, sizeof (mngjpeg_decomp)); - MNG_FREE (pData, pData->pJPEGdsrc2, sizeof (mngjpeg_source)); - MNG_FREE (pData, pData->pJPEGderr2, sizeof (mngjpeg_error )); -#endif - - MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2); - MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen); - /* whatever we were doing ... */ - /* we don't anymore ... */ - pData->bJPEGcompress = MNG_FALSE; - - pData->bJPEGdecompress = MNG_FALSE; - pData->bJPEGhasheader = MNG_FALSE; - pData->bJPEGdecostarted = MNG_FALSE; - pData->bJPEGscanstarted = MNG_FALSE; - pData->bJPEGscanending = MNG_FALSE; - - pData->bJPEGdecompress2 = MNG_FALSE; - pData->bJPEGhasheader2 = MNG_FALSE; - pData->bJPEGdecostarted2 = MNG_FALSE; - pData->bJPEGscanstarted2 = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_CLEANUP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * JPEG decompression routines (JDAT) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressinit (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B - /* allocate and initialize a JPEG decompression object */ - pData->pJPEGdinfo->err = jpeg_std_error (pData->pJPEGderr); - -#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */ - pData->pJPEGderr->error_exit = mng_error_exit; - pData->pJPEGderr->output_message = mng_output_message; - - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif /* MNG_USE_SETJMP */ - - /* allocate and initialize a JPEG decompression object (continued) */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_JPEG_CREATE_DECOMPRESS) -#endif - jpeg_create_decompress (pData->pJPEGdinfo); - - pData->bJPEGdecompress = MNG_TRUE; /* indicate it's initialized */ - - /* specify the source of the compressed data (eg, a file) */ - /* no, not a file; we have buffered input */ - pData->pJPEGdinfo->src = pData->pJPEGdsrc; - /* use the default handler */ - pData->pJPEGdinfo->src->resync_to_restart = jpeg_resync_to_restart; - /* setup local source routine & parms */ - pData->pJPEGdinfo->src->init_source = mng_init_source; - pData->pJPEGdinfo->src->fill_input_buffer = mng_fill_input_buffer; - pData->pJPEGdinfo->src->skip_input_data = mng_skip_input_data; - pData->pJPEGdinfo->src->term_source = mng_term_source; - pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent; - pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain; - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressdata (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata) -{ - mng_retcode iRetcode; - mng_uint32 iRemain; - mng_uint8p pWork; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_START); -#endif - -#if defined (MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - iRetcode = setjmp (pData->sErrorbuf);/* initialize local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - - pWork = pRawdata; - iRemain = iRawsize; - - if (pData->iJPEGtoskip) /* JPEG-lib told us to skip some more data ? */ - { - if (iRemain > pData->iJPEGtoskip) /* enough data in this buffer ? */ - { - iRemain -= pData->iJPEGtoskip; /* skip enough to access the next byte */ - pWork += pData->iJPEGtoskip; - - pData->iJPEGtoskip = 0; /* no more to skip then */ - } - else - { - pData->iJPEGtoskip -= iRemain; /* skip all data in the buffer */ - iRemain = 0; /* and indicate this accordingly */ - } - /* the skip set current-pointer to NULL ! */ - pData->pJPEGcurrent = pData->pJPEGbuf; - } - - while (iRemain) /* repeat until no more input-bytes */ - { /* need to shift anything ? */ - if ((pData->pJPEGcurrent > pData->pJPEGbuf) && - (pData->pJPEGcurrent - pData->pJPEGbuf + pData->iJPEGbufremain + iRemain > pData->iJPEGbufmax)) - { - if (pData->iJPEGbufremain > 0) /* then do so */ - MNG_COPY (pData->pJPEGbuf, pData->pJPEGcurrent, pData->iJPEGbufremain); - - pData->pJPEGcurrent = pData->pJPEGbuf; - } - /* does the remaining input fit into the buffer ? */ - if (pData->iJPEGbufremain + iRemain <= pData->iJPEGbufmax) - { /* move the lot */ - MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iRemain); - - pData->iJPEGbufremain += iRemain;/* adjust remaining_bytes counter */ - iRemain = 0; /* and indicate there's no input left */ - } - else - { /* calculate what does fit */ - mng_uint32 iFits = pData->iJPEGbufmax - pData->iJPEGbufremain; - - if (iFits <= 0) /* no space is just bugger 'm all */ - MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL); - /* move that */ - MNG_COPY ((pData->pJPEGcurrent + pData->iJPEGbufremain), pWork, iFits); - - pData->iJPEGbufremain += iFits; /* adjust remain_bytes counter */ - iRemain -= iFits; /* and the input-parms */ - pWork += iFits; - } - -#ifdef MNG_INCLUDE_IJG6B - pData->pJPEGdinfo->src->next_input_byte = pData->pJPEGcurrent; - pData->pJPEGdinfo->src->bytes_in_buffer = pData->iJPEGbufremain; - - if (!pData->bJPEGhasheader) /* haven't got the header yet ? */ - { - /* call jpeg_read_header() to obtain image info */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_HEADER) -#endif - if (jpeg_read_header (pData->pJPEGdinfo, TRUE) != JPEG_SUSPENDED) - { /* indicate the header's oke */ - pData->bJPEGhasheader = MNG_TRUE; - /* let's do some sanity checks ! */ - if ((pData->pJPEGdinfo->image_width != pData->iDatawidth ) || - (pData->pJPEGdinfo->image_height != pData->iDataheight) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - - if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAY ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA) ) && - (pData->pJPEGdinfo->jpeg_color_space != JCS_GRAYSCALE ) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - - if ( ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLOR ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) && - (pData->pJPEGdinfo->jpeg_color_space != JCS_YCbCr ) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - /* indicate whether or not it's progressive */ - pData->bJPEGprogressive = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo); - /* progressive+alpha can't display "on-the-fly"!! */ - if ((pData->bJPEGprogressive) && - ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) )) - pData->fDisplayrow = MNG_NULL; - /* allocate a row of JPEG-samples */ - if (pData->pJPEGdinfo->jpeg_color_space == JCS_YCbCr) - pData->iJPEGrowlen = pData->pJPEGdinfo->image_width * RGB_PIXELSIZE; - else - pData->iJPEGrowlen = pData->pJPEGdinfo->image_width; - - MNG_ALLOC (pData, pData->pJPEGrow, pData->iJPEGrowlen); - - pData->iJPEGrgbrow = 0; /* quite empty up to now */ - } - - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - } - /* decompress not started ? */ - if ((pData->bJPEGhasheader) && (!pData->bJPEGdecostarted)) - { - /* set parameters for decompression */ - - if (pData->bJPEGprogressive) /* progressive display ? */ - pData->pJPEGdinfo->buffered_image = TRUE; - - /* jpeg_start_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS) -#endif - if (jpeg_start_decompress (pData->pJPEGdinfo) == TRUE) - /* indicate it started */ - pData->bJPEGdecostarted = MNG_TRUE; - - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - } - /* process some scanlines ? */ - if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) && - ((!jpeg_input_complete (pData->pJPEGdinfo)) || - (pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height) || - ((pData->bJPEGprogressive) && (pData->bJPEGscanending)))) - { - mng_int32 iLines = 0; - - /* for (each output pass) */ - do - { /* address the row output buffer */ - JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow; - - /* init new pass ? */ - if ((pData->bJPEGprogressive) && (!pData->bJPEGscanstarted)) - { - pData->bJPEGscanstarted = MNG_TRUE; - - /* adjust output decompression parameters if required */ - /* nop */ - - /* start a new output pass */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_OUTPUT) -#endif - jpeg_start_output (pData->pJPEGdinfo, pData->pJPEGdinfo->input_scan_number); - - pData->iJPEGrow = 0; /* start at row 0 in the image again */ - } - - /* while (scan lines remain to be read) */ - if ((!pData->bJPEGprogressive) || (!pData->bJPEGscanending)) - { - do - { - /* jpeg_read_scanlines(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES) -#endif - iLines = jpeg_read_scanlines (pData->pJPEGdinfo, (JSAMPARRAY)&pRow, 1); - - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - - if (iLines > 0) /* got something ? */ - { - if (pData->fStorerow2) /* store in object ? */ - { - iRetcode = ((mng_storerow)pData->fStorerow2) (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - } - } - while ((pData->pJPEGdinfo->output_scanline < pData->pJPEGdinfo->output_height) && - (iLines > 0)); /* until end-of-image or not enough input-data */ - } - - /* terminate output pass */ - if ((pData->bJPEGprogressive) && - (pData->pJPEGdinfo->output_scanline >= pData->pJPEGdinfo->output_height)) - { -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT) -#endif - if (jpeg_finish_output (pData->pJPEGdinfo) != JPEG_SUSPENDED) - { /* this scan has ended */ - pData->bJPEGscanstarted = MNG_FALSE; - pData->bJPEGscanending = MNG_FALSE; - } - else - { - pData->bJPEGscanending = MNG_TRUE; - } - } - } - while ((!jpeg_input_complete (pData->pJPEGdinfo)) && - (iLines > 0) && (!pData->bJPEGscanending)); - } - /* end of image ? */ - if ((pData->bJPEGhasheader) && (pData->bJPEGdecostarted) && - (!pData->bJPEGscanending) && (jpeg_input_complete (pData->pJPEGdinfo)) && - (pData->pJPEGdinfo->input_scan_number == pData->pJPEGdinfo->output_scan_number)) - { - /* jpeg_finish_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS) -#endif - if (jpeg_finish_decompress (pData->pJPEGdinfo) == TRUE) - { /* indicate it's done */ - pData->bJPEGhasheader = MNG_FALSE; - pData->bJPEGdecostarted = MNG_FALSE; - pData->pJPEGcurrent = (mng_uint8p)pData->pJPEGdinfo->src->next_input_byte; - pData->iJPEGbufremain = (mng_uint32)pData->pJPEGdinfo->src->bytes_in_buffer; - /* remaining fluff is an error ! */ - if ((pData->iJPEGbufremain > 0) || (iRemain > 0)) - MNG_ERROR (pData, MNG_TOOMUCHJDAT); - } - } -#endif /* MNG_INCLUDE_IJG6B */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressfree (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B -#ifdef MNG_USE_SETJMP - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - /* free the row of JPEG-samples*/ - MNG_FREE (pData, pData->pJPEGrow, pData->iJPEGrowlen); - - /* release the JPEG decompression object */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS) -#endif - jpeg_destroy_decompress (pData->pJPEGdinfo); - - pData->bJPEGdecompress = MNG_FALSE; /* indicate it's done */ - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ -/* * * */ -/* * JPEG decompression routines (JDAA) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressinit2 (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B - /* allocate and initialize a JPEG decompression object */ - pData->pJPEGdinfo2->err = jpeg_std_error (pData->pJPEGderr2); - -#ifdef MNG_USE_SETJMP /* setup local JPEG error-routines */ - pData->pJPEGderr2->error_exit = mng_error_exit; - pData->pJPEGderr2->output_message = mng_output_message; - - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif /* MNG_USE_SETJMP */ - - /* allocate and initialize a JPEG decompression object (continued) */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_JPEG_CREATE_DECOMPRESS) -#endif - jpeg_create_decompress (pData->pJPEGdinfo2); - - pData->bJPEGdecompress2 = MNG_TRUE; /* indicate it's initialized */ - - /* specify the source of the compressed data (eg, a file) */ - /* no, not a file; we have buffered input */ - pData->pJPEGdinfo2->src = pData->pJPEGdsrc2; - /* use the default handler */ - pData->pJPEGdinfo2->src->resync_to_restart = jpeg_resync_to_restart; - /* setup local source routine & parms */ - pData->pJPEGdinfo2->src->init_source = mng_init_source; - pData->pJPEGdinfo2->src->fill_input_buffer = mng_fill_input_buffer; - pData->pJPEGdinfo2->src->skip_input_data = mng_skip_input_data2; - pData->pJPEGdinfo2->src->term_source = mng_term_source; - pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2; - pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2; - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressdata2 (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata) -{ - mng_retcode iRetcode; - mng_uint32 iRemain; - mng_uint8p pWork; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_START); -#endif - -#if defined (MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - iRetcode = setjmp (pData->sErrorbuf);/* initialize local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - - pWork = pRawdata; - iRemain = iRawsize; - - if (pData->iJPEGtoskip2) /* JPEG-lib told us to skip some more data ? */ - { - if (iRemain > pData->iJPEGtoskip2) /* enough data in this buffer ? */ - { - iRemain -= pData->iJPEGtoskip2; /* skip enough to access the next byte */ - pWork += pData->iJPEGtoskip2; - - pData->iJPEGtoskip2 = 0; /* no more to skip then */ - } - else - { - pData->iJPEGtoskip2 -= iRemain; /* skip all data in the buffer */ - iRemain = 0; /* and indicate this accordingly */ - } - /* the skip set current-pointer to NULL ! */ - pData->pJPEGcurrent2 = pData->pJPEGbuf2; - } - - while (iRemain) /* repeat until no more input-bytes */ - { /* need to shift anything ? */ - if ((pData->pJPEGcurrent2 > pData->pJPEGbuf2) && - (pData->pJPEGcurrent2 - pData->pJPEGbuf2 + pData->iJPEGbufremain2 + iRemain > pData->iJPEGbufmax2)) - { - if (pData->iJPEGbufremain2 > 0) /* then do so */ - MNG_COPY (pData->pJPEGbuf2, pData->pJPEGcurrent2, pData->iJPEGbufremain2); - - pData->pJPEGcurrent2 = pData->pJPEGbuf2; - } - /* does the remaining input fit into the buffer ? */ - if (pData->iJPEGbufremain2 + iRemain <= pData->iJPEGbufmax2) - { /* move the lot */ - MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iRemain); - /* adjust remaining_bytes counter */ - pData->iJPEGbufremain2 += iRemain; - iRemain = 0; /* and indicate there's no input left */ - } - else - { /* calculate what does fit */ - mng_uint32 iFits = pData->iJPEGbufmax2 - pData->iJPEGbufremain2; - - if (iFits <= 0) /* no space is just bugger 'm all */ - MNG_ERROR (pData, MNG_JPEGBUFTOOSMALL); - /* move that */ - MNG_COPY ((pData->pJPEGcurrent2 + pData->iJPEGbufremain2), pWork, iFits); - - pData->iJPEGbufremain2 += iFits; /* adjust remain_bytes counter */ - iRemain -= iFits; /* and the input-parms */ - pWork += iFits; - } - -#ifdef MNG_INCLUDE_IJG6B - pData->pJPEGdinfo2->src->next_input_byte = pData->pJPEGcurrent2; - pData->pJPEGdinfo2->src->bytes_in_buffer = pData->iJPEGbufremain2; - - if (!pData->bJPEGhasheader2) /* haven't got the header yet ? */ - { - /* call jpeg_read_header() to obtain image info */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_HEADER) -#endif - if (jpeg_read_header (pData->pJPEGdinfo2, TRUE) != JPEG_SUSPENDED) - { /* indicate the header's oke */ - pData->bJPEGhasheader2 = MNG_TRUE; - /* let's do some sanity checks ! */ - if ((pData->pJPEGdinfo2->image_width != pData->iDatawidth ) || - (pData->pJPEGdinfo2->image_height != pData->iDataheight) ) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - - if (pData->pJPEGdinfo2->jpeg_color_space != JCS_GRAYSCALE) - MNG_ERROR (pData, MNG_JPEGPARMSERR); - /* indicate whether or not it's progressive */ - pData->bJPEGprogressive2 = (mng_bool)jpeg_has_multiple_scans (pData->pJPEGdinfo2); - - if (pData->bJPEGprogressive2) /* progressive alphachannel not allowed !!! */ - MNG_ERROR (pData, MNG_JPEGPARMSERR); - /* allocate a row of JPEG-samples */ - if (pData->pJPEGdinfo2->jpeg_color_space == JCS_YCbCr) - pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width * RGB_PIXELSIZE; - else - pData->iJPEGrowlen2 = pData->pJPEGdinfo2->image_width; - - MNG_ALLOC (pData, pData->pJPEGrow2, pData->iJPEGrowlen2); - - pData->iJPEGalpharow = 0; /* quite empty up to now */ - } - - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - } - /* decompress not started ? */ - if ((pData->bJPEGhasheader2) && (!pData->bJPEGdecostarted2)) - { - /* set parameters for decompression */ - - if (pData->bJPEGprogressive2) /* progressive display ? */ - pData->pJPEGdinfo2->buffered_image = TRUE; - - /* jpeg_start_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_DECOMPRESS) -#endif - if (jpeg_start_decompress (pData->pJPEGdinfo2) == TRUE) - /* indicate it started */ - pData->bJPEGdecostarted2 = MNG_TRUE; - - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - } - /* process some scanlines ? */ - if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) && - ((!jpeg_input_complete (pData->pJPEGdinfo2)) || - (pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height))) - { - mng_int32 iLines; - - /* for (each output pass) */ - do - { /* address the row output buffer */ - JSAMPROW pRow = (JSAMPROW)pData->pJPEGrow2; - - /* init new pass ? */ - if ((pData->bJPEGprogressive2) && - ((!pData->bJPEGscanstarted2) || - (pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height))) - { - pData->bJPEGscanstarted2 = MNG_TRUE; - - /* adjust output decompression parameters if required */ - /* nop */ - - /* start a new output pass */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_START_OUTPUT) -#endif - jpeg_start_output (pData->pJPEGdinfo2, pData->pJPEGdinfo2->input_scan_number); - - pData->iJPEGrow = 0; /* start at row 0 in the image again */ - } - - /* while (scan lines remain to be read) */ - do - { - /* jpeg_read_scanlines(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_READ_SCANLINES) -#endif - iLines = jpeg_read_scanlines (pData->pJPEGdinfo2, (JSAMPARRAY)&pRow, 1); - - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - - if (iLines > 0) /* got something ? */ - { - if (pData->fStorerow3) /* store in object ? */ - { - iRetcode = ((mng_storerow)pData->fStorerow3) (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - } - } - while ((pData->pJPEGdinfo2->output_scanline < pData->pJPEGdinfo2->output_height) && - (iLines > 0)); /* until end-of-image or not enough input-data */ - - /* terminate output pass */ - if ((pData->bJPEGprogressive2) && - (pData->pJPEGdinfo2->output_scanline >= pData->pJPEGdinfo2->output_height)) - { -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_OUTPUT) -#endif - if (jpeg_finish_output (pData->pJPEGdinfo2) == JPEG_SUSPENDED) - jpeg_finish_output (pData->pJPEGdinfo2); - /* this scan has ended */ - pData->bJPEGscanstarted2 = MNG_FALSE; - } - } - while ((!jpeg_input_complete (pData->pJPEGdinfo2)) && (iLines > 0)); - } - /* end of image ? */ - if ((pData->bJPEGhasheader2) && (pData->bJPEGdecostarted2) && - (jpeg_input_complete (pData->pJPEGdinfo2)) && - (pData->pJPEGdinfo2->input_scan_number == pData->pJPEGdinfo2->output_scan_number)) - { - /* jpeg_finish_decompress(...); */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_JPEG_FINISH_DECOMPRESS) -#endif - if (jpeg_finish_decompress (pData->pJPEGdinfo2) == TRUE) - { /* indicate it's done */ - pData->bJPEGhasheader2 = MNG_FALSE; - pData->bJPEGdecostarted2 = MNG_FALSE; - pData->pJPEGcurrent2 = (mng_uint8p)pData->pJPEGdinfo2->src->next_input_byte; - pData->iJPEGbufremain2 = (mng_uint32)pData->pJPEGdinfo2->src->bytes_in_buffer; - /* remaining fluff is an error ! */ - if ((pData->iJPEGbufremain2 > 0) || (iRemain > 0)) - MNG_ERROR (pData, MNG_TOOMUCHJDAT); - } - } -#endif /* MNG_INCLUDE_IJG6B */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG_READ -mng_retcode mngjpeg_decompressfree2 (mng_datap pData) -{ -#if defined(MNG_INCLUDE_IJG6B) && defined(MNG_USE_SETJMP) - mng_retcode iRetcode; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_IJG6B -#ifdef MNG_USE_SETJMP - iRetcode = setjmp (pData->sErrorbuf);/* setup local JPEG error-recovery */ - if (iRetcode != 0) /* got here from longjmp ? */ - MNG_ERRORJ (pData, iRetcode); /* then IJG-lib issued an error */ -#endif - /* free the row of JPEG-samples*/ - MNG_FREE (pData, pData->pJPEGrow2, pData->iJPEGrowlen2); - - /* release the JPEG decompression object */ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_JPEG_DESTROY_DECOMPRESS) -#endif - jpeg_destroy_decompress (pData->pJPEGdinfo2); - - pData->bJPEGdecompress2 = MNG_FALSE; /* indicate it's done */ - -#endif /* MNG_INCLUDE_IJG6B */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_JPEG_DECOMPRESSFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_INCLUDE_JNG_READ */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG && MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_jpeg.h b/Engine/lib/lmng/libmng_jpeg.h deleted file mode 100644 index a072af9c9..000000000 --- a/Engine/lib/lmng/libmng_jpeg.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_jpeg.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : JPEG library interface (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the JPEG library interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_jpeg_h_ -#define _libmng_jpeg_h_ - -/* ************************************************************************** */ - -mng_retcode mngjpeg_initialize (mng_datap pData); -mng_retcode mngjpeg_cleanup (mng_datap pData); - -mng_retcode mngjpeg_decompressinit (mng_datap pData); -mng_retcode mngjpeg_decompressdata (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata); -mng_retcode mngjpeg_decompressfree (mng_datap pData); - -mng_retcode mngjpeg_decompressinit2 (mng_datap pData); -mng_retcode mngjpeg_decompressdata2 (mng_datap pData, - mng_uint32 iRawsize, - mng_uint8p pRawdata); -mng_retcode mngjpeg_decompressfree2 (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_jpeg_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_memory.h b/Engine/lib/lmng/libmng_memory.h deleted file mode 100644 index b92d0c13d..000000000 --- a/Engine/lib/lmng/libmng_memory.h +++ /dev/null @@ -1,64 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_memory.h copyright (c) 2000-2003 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : Memory management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of memory management functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.3 - 06/12/2000 - G.Juyn * */ -/* * - swapped MNG_COPY parameter-names * */ -/* * 0.5.3 - 06/27/2000 - G.Juyn * */ -/* * - changed size parameter to mng_size_t * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_memory_h_ -#define _libmng_memory_h_ - -/* ************************************************************************** */ -/* * * */ -/* * Generic memory manager macros * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INTERNAL_MEMMNGMT -#define MNG_ALLOC(H,P,L) { P = calloc (1, (mng_size_t)(L)); \ - if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } } -#define MNG_ALLOCX(H,P,L) { P = calloc (1, (mng_size_t)(L)); } -#define MNG_FREE(H,P,L) { if (P) { free (P); P = 0; } } -#define MNG_FREEX(H,P,L) { if (P) free (P); } -#else -#define MNG_ALLOC(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); \ - if (P == 0) { MNG_ERROR (H, MNG_OUTOFMEMORY) } } -#define MNG_ALLOCX(H,P,L) { P = H->fMemalloc ((mng_size_t)(L)); } -#define MNG_FREE(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); P = 0; } } -#define MNG_FREEX(H,P,L) { if (P) { H->fMemfree (P, (mng_size_t)(L)); } } -#endif /* mng_internal_memmngmt */ - -#define MNG_COPY(D,S,L) { memcpy (D, S, (mng_size_t)(L)); } - -/* ************************************************************************** */ - -#endif /* _libmng_memory_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_object_prc.c b/Engine/lib/lmng/libmng_object_prc.c deleted file mode 100644 index f6691ff42..000000000 --- a/Engine/lib/lmng/libmng_object_prc.c +++ /dev/null @@ -1,6998 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_object_prc.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Object processing routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the internal object processing routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - fixed to support JNG objects * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for global color-chunks in animation * */ -/* * - added support for global PLTE,tRNS,bKGD in animation * */ -/* * - added SAVE & SEEK animation objects * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - added initialization of framenr/layernr/playtime * */ -/* * - changed ani_object create routines not to return the * */ -/* * created object (wasn't necessary) * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added object promotion routine (PROM handling) * */ -/* * - added ani-object routines for delta-image processing * */ -/* * - added compression/filter/interlace fields to * */ -/* * object-buffer for delta-image processing * */ -/* * * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed support for delta-image processing * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed some small things (as precaution) * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added processing of PLTE/tRNS & color-info for * */ -/* * delta-images in the ani_objects chain * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for PPLT chunk * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added support for freeze/restart/resume & go_xxxx * */ -/* * 0.9.1 - 07/16/2000 - G.Juyn * */ -/* * - fixed support for mng_display() after mng_read() * */ -/* * * */ -/* * 0.9.2 - 07/29/2000 - G.Juyn * */ -/* * - fixed small bugs in display processing * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added valid-flag to stored objects for read() / display()* */ -/* * - added routine to discard "invalid" objects * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - fixed delta-processing behavior * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - added storage for pixel-/alpha-sampledepth for delta's * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - removed "old" MAGN methods 3 & 4 * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 0.9.5 - 1/22/2001 - G.Juyn * */ -/* * - B129681 - fixed compiler warnings SGI/Irix * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * 1.0.5 - 08/16/2002 - G.Juyn * */ -/* * - completed MAGN support (16-bit functions) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - fixed reset_object_detail to clear old buffer * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 10/05/2002 - G.Juyn * */ -/* * - fixed problem with cloned objects marked as invalid * */ -/* * - fixed problem cloning frozen object_buffers * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * 1.0.5 - 11/04/2002 - G.Juyn * */ -/* * - fixed goframe/golayer/gotime processing * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - fixed magnification bug with object 0 * */ -/* * 1.0.5 - 01/19/2003 - G.Juyn * */ -/* * - B664911 - fixed buffer overflow during init * */ -/* * * */ -/* * 1.0.6 - 04/19/2003 - G.Juyn * */ -/* * - fixed problem with infinite loops during readdisplay() * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 06/09/2003 - G. R-P * */ -/* * - added conditionals around 8-bit magn routines * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around some JNG-supporting code * */ -/* * - removed conditionals around 8-bit magn routines * */ -/* * - added conditionals around delta-png and 16-bit code * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added MNG_NO_LOOP_SIGNALS_SUPPORTED conditional * */ -/* * 1.0.6 - 07/29/2003 - G.Juyn * */ -/* * - fixed invalid test in promote_imageobject * */ -/* * 1.0.6 - 07/29/2003 - G.R-P. * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P. * */ -/* * - added conditionals around MAGN chunk support * */ -/* * * */ -/* * 1.0.7 - 03/21/2004 - G.Juyn * */ -/* * - fixed some 64-bit platform compiler warnings * */ -/* * * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT support * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */ -/* * 1.0.9 - 12/11/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_DISPLAYCALLS * */ -/* * 1.0.9 - 12/31/2004 - G.R-P. * */ -/* * - fixed warnings about possible uninitialized pointers * */ -/* * 1.0.9 - 01/02/2005 - G.Juyn * */ -/* * - fixing some compiler-warnings * */ -/* * * */ -/* * 1.0.10 - 02/07/2005 - G.Juyn * */ -/* * - fixed some compiler-warnings * */ -/* * 1.0.10 - 07/30/2005 - G.Juyn * */ -/* * - fixed problem with CLON object during readdisplay() * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#include "libmng_objects.h" -#include "libmng_display.h" -#include "libmng_pixels.h" -#include "libmng_object_prc.h" -#include "libmng_cms.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ -/* * * */ -/* * Generic object routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_drop_invalid_objects (mng_datap pData) -{ - mng_objectp pObject; - mng_objectp pNext; - mng_cleanupobject fCleanup; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_START); -#endif - - pObject = pData->pFirstimgobj; /* get first stored image-object (if any) */ - - while (pObject) /* more objects to check ? */ - { - pNext = ((mng_object_headerp)pObject)->pNext; - /* invalid ? */ - if (!((mng_imagep)pObject)->bValid) - { /* call appropriate cleanup */ - fCleanup = ((mng_object_headerp)pObject)->fCleanup; - fCleanup (pData, pObject); - } - - pObject = pNext; /* neeeext */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_INVALID_OBJECTS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_OPTIMIZE_OBJCLEANUP -MNG_LOCAL mng_retcode create_obj_general (mng_datap pData, - mng_size_t iObjsize, - mng_cleanupobject fCleanup, - mng_processobject fProcess, - mng_ptr *ppObject) -{ - mng_object_headerp pWork; - - MNG_ALLOC (pData, pWork, iObjsize); - - pWork->fCleanup = fCleanup; - pWork->fProcess = fProcess; - pWork->iObjsize = iObjsize; - *ppObject = (mng_ptr)pWork; - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode mng_free_obj_general (mng_datap pData, - mng_objectp pObject) -{ - MNG_FREEX (pData, pObject, ((mng_object_headerp)pObject)->iObjsize); - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Image-data-object routines * */ -/* * * */ -/* * these handle the "object buffer" as defined by the MNG specification * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_create_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_imagedatap *ppObject) -{ - mng_imagedatap pImagedata; - mng_uint32 iSamplesize = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGDATAOBJECT, MNG_LC_START); -#endif - /* get a buffer */ -#ifdef MNG_OPTIMIZE_OBJCLEANUP - { - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_imagedata), - (mng_cleanupobject)mng_free_imagedataobject, - MNG_NULL, &pTemp); - if (iRetcode) - return iRetcode; - pImagedata = (mng_imagedatap)pTemp; - } -#else - MNG_ALLOC (pData, pImagedata, sizeof (mng_imagedata)); - /* fill the appropriate fields */ - pImagedata->sHeader.fCleanup = (mng_cleanupobject)mng_free_imagedataobject; - pImagedata->sHeader.fProcess = MNG_NULL; -#endif - pImagedata->iRefcount = 1; - pImagedata->bFrozen = MNG_FALSE; - pImagedata->bConcrete = bConcrete; - pImagedata->bViewable = bViewable; - pImagedata->iWidth = iWidth; - pImagedata->iHeight = iHeight; - pImagedata->iBitdepth = iBitdepth; - pImagedata->iColortype = iColortype; - pImagedata->iCompression = iCompression; - pImagedata->iFilter = iFilter; - pImagedata->iInterlace = iInterlace; - pImagedata->bCorrected = MNG_FALSE; - pImagedata->iAlphabitdepth = 0; - pImagedata->iJHDRcompression = 0; - pImagedata->iJHDRinterlace = 0; - pImagedata->iPixelsampledepth = iBitdepth; - pImagedata->iAlphasampledepth = iBitdepth; - /* determine samplesize from color_type/bit_depth */ - switch (iColortype) /* for < 8-bit samples we just reserve 8 bits */ - { - case 0 : ; /* gray */ - case 8 : { /* JPEG gray */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 2; - else -#endif - iSamplesize = 1; - - break; - } - case 2 : ; /* rgb */ - case 10 : { /* JPEG rgb */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 6; - else -#endif - iSamplesize = 3; - - break; - } - case 3 : { /* indexed */ - iSamplesize = 1; - break; - } - case 4 : ; /* gray+alpha */ - case 12 : { /* JPEG gray+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 4; - else -#endif - iSamplesize = 2; - - break; - } - case 6 : ; /* rgb+alpha */ - case 14 : { /* JPEG rgb+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 8; - else -#endif - iSamplesize = 4; - - break; - } - } - /* make sure we remember all this */ - pImagedata->iSamplesize = iSamplesize; - pImagedata->iRowsize = iSamplesize * iWidth; - pImagedata->iImgdatasize = pImagedata->iRowsize * iHeight; - - if (pImagedata->iImgdatasize) /* need a buffer ? */ - { /* so allocate it */ - MNG_ALLOCX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize); - - if (!pImagedata->pImgdata) /* enough memory ? */ - { - MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - } - /* check global stuff */ - pImagedata->bHasGAMA = pData->bHasglobalGAMA; -#ifndef MNG_SKIPCHUNK_cHRM - pImagedata->bHasCHRM = pData->bHasglobalCHRM; -#endif - pImagedata->bHasSRGB = pData->bHasglobalSRGB; -#ifndef MNG_SKIPCHUNK_iCCP - pImagedata->bHasICCP = pData->bHasglobalICCP; -#endif -#ifndef MNG_SKIPCHUNK_bKGD - pImagedata->bHasBKGD = pData->bHasglobalBKGD; -#endif - - if (pData->bHasglobalGAMA) /* global gAMA present ? */ - pImagedata->iGamma = pData->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - if (pData->bHasglobalCHRM) /* global cHRM present ? */ - { - pImagedata->iWhitepointx = pData->iGlobalWhitepointx; - pImagedata->iWhitepointy = pData->iGlobalWhitepointy; - pImagedata->iPrimaryredx = pData->iGlobalPrimaryredx; - pImagedata->iPrimaryredy = pData->iGlobalPrimaryredy; - pImagedata->iPrimarygreenx = pData->iGlobalPrimarygreenx; - pImagedata->iPrimarygreeny = pData->iGlobalPrimarygreeny; - pImagedata->iPrimarybluex = pData->iGlobalPrimarybluex; - pImagedata->iPrimarybluey = pData->iGlobalPrimarybluey; - } -#endif - - if (pData->bHasglobalSRGB) /* glbal sRGB present ? */ - pImagedata->iRenderingintent = pData->iGlobalRendintent; - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->bHasglobalICCP) /* glbal iCCP present ? */ - { - pImagedata->iProfilesize = pData->iGlobalProfilesize; - - if (pImagedata->iProfilesize) - { - MNG_ALLOCX (pData, pImagedata->pProfile, pImagedata->iProfilesize); - - if (!pImagedata->pProfile) /* enough memory ? */ - { - MNG_FREEX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize); - MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - - MNG_COPY (pImagedata->pProfile, pData->pGlobalProfile, pImagedata->iProfilesize); - } - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - if (pData->bHasglobalBKGD) /* global bKGD present ? */ - { - pImagedata->iBKGDred = pData->iGlobalBKGDred; - pImagedata->iBKGDgreen = pData->iGlobalBKGDgreen; - pImagedata->iBKGDblue = pData->iGlobalBKGDblue; - } -#endif - - *ppObject = pImagedata; /* return it */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGDATAOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_imagedataobject (mng_datap pData, - mng_imagedatap pImagedata) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGDATAOBJECT, MNG_LC_START); -#endif - - if (pImagedata->iRefcount) /* decrease reference count */ - pImagedata->iRefcount--; - - if (!pImagedata->iRefcount) /* reached zero ? */ - { -#ifndef MNG_SKIPCHUNK_iCCP - if (pImagedata->iProfilesize) /* stored an iCCP profile ? */ - MNG_FREEX (pData, pImagedata->pProfile, pImagedata->iProfilesize); -#endif - if (pImagedata->iImgdatasize) /* sample-buffer present ? */ - MNG_FREEX (pData, pImagedata->pImgdata, pImagedata->iImgdatasize); - /* drop the buffer */ - MNG_FREEX (pData, pImagedata, sizeof (mng_imagedata)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGDATAOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_clone_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_imagedatap pSource, - mng_imagedatap *ppClone) -{ - mng_imagedatap pNewdata; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGDATAOBJECT, MNG_LC_START); -#endif - /* get a buffer */ - MNG_ALLOC (pData, pNewdata, sizeof (mng_imagedata)); - /* blatently copy the original buffer */ - MNG_COPY (pNewdata, pSource, sizeof (mng_imagedata)); - - pNewdata->iRefcount = 1; /* only the reference count */ - pNewdata->bConcrete = bConcrete; /* and concrete-flag are different */ - pNewdata->bFrozen = MNG_FALSE; - - if (pNewdata->iImgdatasize) /* sample buffer present ? */ - { - MNG_ALLOCX (pData, pNewdata->pImgdata, pNewdata->iImgdatasize); - - if (!pNewdata->pImgdata) /* not enough memory ? */ - { - MNG_FREEX (pData, pNewdata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* make a copy */ - MNG_COPY (pNewdata->pImgdata, pSource->pImgdata, pNewdata->iImgdatasize); - } - -#ifndef MNG_SKIPCHUNK_iCCP - if (pNewdata->iProfilesize) /* iCCP profile present ? */ - { - MNG_ALLOCX (pData, pNewdata->pProfile, pNewdata->iProfilesize); - - if (!pNewdata->pProfile) /* enough memory ? */ - { - MNG_FREEX (pData, pNewdata, sizeof (mng_imagedata)); - MNG_ERROR (pData, MNG_OUTOFMEMORY); - } - /* make a copy */ - MNG_COPY (pNewdata->pProfile, pSource->pProfile, pNewdata->iProfilesize); - } -#endif - - *ppClone = pNewdata; /* return the clone */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGDATAOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Image-object routines * */ -/* * * */ -/* * these handle the "object" as defined by the MNG specification * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_create_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bConcrete, - mng_bool bVisible, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_int32 iPosx, - mng_int32 iPosy, - mng_bool bClipped, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb, - mng_imagep *ppObject) -{ - mng_imagep pImage; - mng_imagep pPrev, pNext; - mng_retcode iRetcode; - mng_imagedatap pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGOBJECT, MNG_LC_START); -#endif - /* get a buffer */ - MNG_ALLOC (pData, pImage, sizeof (mng_image)); - /* now get a new "object buffer" */ - iRetcode = mng_create_imagedataobject (pData, bConcrete, bViewable, - iWidth, iHeight, iBitdepth, iColortype, - iCompression, iFilter, iInterlace, - &pImgbuf); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pImage, sizeof (mng_image)); - return iRetcode; - } - /* fill the appropriate fields */ - pImage->sHeader.fCleanup = (mng_cleanupobject)mng_free_imageobject; - pImage->sHeader.fProcess = MNG_NULL; -#ifdef MNG_OPTIMIZE_OBJCLEANUP - pImage->sHeader.iObjsize = sizeof (mng_image); -#endif - pImage->iId = iId; - pImage->bFrozen = MNG_FALSE; - pImage->bVisible = bVisible; - pImage->bViewable = bViewable; - pImage->bValid = (mng_bool)((pData->bDisplaying) && - ((pData->bRunning) || (pData->bSearching)) && - (!pData->bFreezing)); - pImage->iPosx = iPosx; - pImage->iPosy = iPosy; - pImage->bClipped = bClipped; - pImage->iClipl = iClipl; - pImage->iClipr = iClipr; - pImage->iClipt = iClipt; - pImage->iClipb = iClipb; -#ifndef MNG_SKIPCHUNK_MAGN - pImage->iMAGN_MethodX = 0; - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; -#endif -#ifndef MNG_SKIPCHUNK_PAST - pImage->iPastx = 0; - pImage->iPasty = 0; -#endif - pImage->pImgbuf = pImgbuf; - - if (iId) /* only if not object 0 ! */ - { /* find previous lower object-id */ - pPrev = (mng_imagep)pData->pLastimgobj; - - while ((pPrev) && (pPrev->iId > iId)) - pPrev = (mng_imagep)pPrev->sHeader.pPrev; - - if (pPrev) /* found it ? */ - { - pImage->sHeader.pPrev = pPrev; /* than link it in place */ - pImage->sHeader.pNext = pPrev->sHeader.pNext; - pPrev->sHeader.pNext = pImage; - } - else /* if not found, it becomes the first ! */ - { - pImage->sHeader.pNext = pData->pFirstimgobj; - pData->pFirstimgobj = pImage; - } - - pNext = (mng_imagep)pImage->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pImage; - else - pData->pLastimgobj = pImage; - - } - - *ppObject = pImage; /* and return the new buffer */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* okido */ -} - -/* ************************************************************************** */ - -mng_retcode mng_free_imageobject (mng_datap pData, - mng_imagep pImage) -{ - mng_retcode iRetcode; - mng_imagep pPrev = pImage->sHeader.pPrev; - mng_imagep pNext = pImage->sHeader.pNext; - mng_imagedatap pImgbuf = pImage->pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGOBJECT, MNG_LC_START); -#endif - - if (pImage->iId) /* not for object 0 */ - { - if (pPrev) /* unlink from the list first ! */ - pPrev->sHeader.pNext = pImage->sHeader.pNext; - else - pData->pFirstimgobj = pImage->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pImage->sHeader.pPrev; - else - pData->pLastimgobj = pImage->sHeader.pPrev; - - } - /* unlink the image-data buffer */ - iRetcode = mng_free_imagedataobject (pData, pImgbuf); - /* drop its own buffer */ - MNG_FREEX (pData, pImage, sizeof (mng_image)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_IMGOBJECT, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -mng_imagep mng_find_imageobject (mng_datap pData, - mng_uint16 iId) -{ - mng_imagep pImage = (mng_imagep)pData->pFirstimgobj; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (pData, MNG_FN_FIND_IMGOBJECT, MNG_LC_START); -#endif - /* look up the right id */ - while ((pImage) && (pImage->iId != iId)) - pImage = (mng_imagep)pImage->sHeader.pNext; - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - if ((!pImage) && (pData->eImagetype == mng_it_mpng)) - pImage = pData->pObjzero; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (pData, MNG_FN_FIND_IMGOBJECT, MNG_LC_END); -#endif - - return pImage; -} - -/* ************************************************************************** */ - -mng_retcode mng_clone_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bPartial, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy, - mng_imagep pSource, - mng_imagep *ppClone) -{ - mng_imagep pNew; - mng_imagep pPrev, pNext; - mng_retcode iRetcode; - mng_imagedatap pImgbuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGOBJECT, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN - if ((pSource->iId) && /* needs magnification ? */ - ((pSource->iMAGN_MethodX) || (pSource->iMAGN_MethodY))) - { - iRetcode = mng_magnify_imageobject (pData, pSource); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - /* get a buffer */ -#ifdef MNG_OPTIMIZE_OBJCLEANUP - { - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_image), - (mng_cleanupobject)mng_free_imageobject, - MNG_NULL, &pTemp); - if (iRetcode) - return iRetcode; - pNew = (mng_imagep)pTemp; - } -#else - MNG_ALLOC (pData, pNew, sizeof (mng_image)); - /* fill or copy the appropriate fields */ - pNew->sHeader.fCleanup = (mng_cleanupobject)mng_free_imageobject; - pNew->sHeader.fProcess = MNG_NULL; -#endif - pNew->iId = iId; - pNew->bFrozen = MNG_FALSE; - pNew->bVisible = bVisible; - pNew->bViewable = pSource->bViewable; - pNew->bValid = MNG_TRUE; - - if (bHasloca) /* location info available ? */ - { - if (iLocationtype == 0) /* absolute position ? */ - { - pNew->iPosx = iLocationx; - pNew->iPosy = iLocationy; - } - else /* relative */ - { - pNew->iPosx = pSource->iPosx + iLocationx; - pNew->iPosy = pSource->iPosy + iLocationy; - } - } - else /* copy from source */ - { - pNew->iPosx = pSource->iPosx; - pNew->iPosy = pSource->iPosy; - } - /* copy clipping info */ - pNew->bClipped = pSource->bClipped; - pNew->iClipl = pSource->iClipl; - pNew->iClipr = pSource->iClipr; - pNew->iClipt = pSource->iClipt; - pNew->iClipb = pSource->iClipb; -#ifndef MNG_SKIPCHUNK_MAGN - /* copy magnification info */ -/* pNew->iMAGN_MethodX = pSource->iMAGN_MethodX; LET'S NOT !!!!!! - pNew->iMAGN_MethodY = pSource->iMAGN_MethodY; - pNew->iMAGN_MX = pSource->iMAGN_MX; - pNew->iMAGN_MY = pSource->iMAGN_MY; - pNew->iMAGN_ML = pSource->iMAGN_ML; - pNew->iMAGN_MR = pSource->iMAGN_MR; - pNew->iMAGN_MT = pSource->iMAGN_MT; - pNew->iMAGN_MB = pSource->iMAGN_MB; */ -#endif - -#ifndef MNG_SKIPCHUNK_PAST - pNew->iPastx = 0; /* initialize PAST info */ - pNew->iPasty = 0; -#endif - - if (iId) /* not for object 0 */ - { /* find previous lower object-id */ - pPrev = (mng_imagep)pData->pLastimgobj; - while ((pPrev) && (pPrev->iId > iId)) - pPrev = (mng_imagep)pPrev->sHeader.pPrev; - - if (pPrev) /* found it ? */ - { - pNew->sHeader.pPrev = pPrev; /* than link it in place */ - pNew->sHeader.pNext = pPrev->sHeader.pNext; - pPrev->sHeader.pNext = pNew; - } - else /* if not found, it becomes the first ! */ - { - pNew->sHeader.pNext = pData->pFirstimgobj; - pData->pFirstimgobj = pNew; - } - - pNext = (mng_imagep)pNew->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pNew; - else - pData->pLastimgobj = pNew; - - } - - if (bPartial) /* partial clone ? */ - { - pNew->pImgbuf = pSource->pImgbuf; /* use the same object buffer */ - pNew->pImgbuf->iRefcount++; /* and increase the reference count */ - } - else /* create a full clone ! */ - { - mng_bool bConcrete = MNG_FALSE; /* it's abstract by default (?) */ - - if (!bAbstract) /* determine concreteness from source ? */ - bConcrete = pSource->pImgbuf->bConcrete; - /* create a full clone ! */ - iRetcode = mng_clone_imagedataobject (pData, bConcrete, pSource->pImgbuf, &pImgbuf); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pNew, sizeof (mng_image)); - return iRetcode; - } - - pNew->pImgbuf = pImgbuf; /* and remember it */ - } - - *ppClone = pNew; /* return it */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLONE_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_renum_imageobject (mng_datap pData, - mng_imagep pSource, - mng_uint16 iId, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy) -{ - mng_imagep pPrev, pNext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RENUM_IMGOBJECT, MNG_LC_START); -#endif - - pSource->bVisible = bVisible; /* store the new visibility */ - - if (bHasloca) /* location info available ? */ - { - if (iLocationtype == 0) /* absolute position ? */ - { - pSource->iPosx = iLocationx; - pSource->iPosy = iLocationy; - } - else /* relative */ - { - pSource->iPosx = pSource->iPosx + iLocationx; - pSource->iPosy = pSource->iPosy + iLocationy; - } - } - - if (iId) /* not for object 0 */ - { /* find previous lower object-id */ - pPrev = (mng_imagep)pData->pLastimgobj; - while ((pPrev) && (pPrev->iId > iId)) - pPrev = (mng_imagep)pPrev->sHeader.pPrev; - /* different from current ? */ - if (pPrev != (mng_imagep)pSource->sHeader.pPrev) - { - if (pSource->sHeader.pPrev) /* unlink from current position !! */ - ((mng_imagep)pSource->sHeader.pPrev)->sHeader.pNext = pSource->sHeader.pNext; - else - pData->pFirstimgobj = pSource->sHeader.pNext; - - if (pSource->sHeader.pNext) - ((mng_imagep)pSource->sHeader.pNext)->sHeader.pPrev = pSource->sHeader.pPrev; - else - pData->pLastimgobj = pSource->sHeader.pPrev; - - if (pPrev) /* found the previous ? */ - { /* than link it in place */ - pSource->sHeader.pPrev = pPrev; - pSource->sHeader.pNext = pPrev->sHeader.pNext; - pPrev->sHeader.pNext = pSource; - } - else /* if not found, it becomes the first ! */ - { - pSource->sHeader.pNext = pData->pFirstimgobj; - pData->pFirstimgobj = pSource; - } - - pNext = (mng_imagep)pSource->sHeader.pNext; - - if (pNext) - pNext->sHeader.pPrev = pSource; - else - pData->pLastimgobj = pSource; - - } - } - - pSource->iId = iId; /* now set the new id! */ - - if (bAbstract) /* force it to abstract ? */ - pSource->pImgbuf->bConcrete = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RENUM_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_reset_object_details (mng_datap pData, - mng_imagep pImage, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_bool bResetall) -{ - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint32 iSamplesize = 0; - mng_uint32 iRowsize; - mng_uint32 iImgdatasize; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESET_OBJECTDETAILS, MNG_LC_START); -#endif - - pBuf->iWidth = iWidth; /* set buffer characteristics */ - pBuf->iHeight = iHeight; - pBuf->iBitdepth = iBitdepth; - pBuf->iColortype = iColortype; - pBuf->iCompression = iCompression; - pBuf->iFilter = iFilter; - pBuf->iInterlace = iInterlace; - pBuf->bCorrected = MNG_FALSE; - pBuf->iAlphabitdepth = 0; - /* determine samplesize from color_type/bit_depth */ - switch (iColortype) /* for < 8-bit samples we just reserve 8 bits */ - { - case 0 : ; /* gray */ - case 8 : { /* JPEG gray */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 2; - else -#endif - iSamplesize = 1; - - break; - } - case 2 : ; /* rgb */ - case 10 : { /* JPEG rgb */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 6; - else -#endif - iSamplesize = 3; - - break; - } - case 3 : { /* indexed */ - iSamplesize = 1; - break; - } - case 4 : ; /* gray+alpha */ - case 12 : { /* JPEG gray+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 4; - else -#endif - iSamplesize = 2; - - break; - } - case 6 : ; /* rgb+alpha */ - case 14 : { /* JPEG rgb+alpha */ -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iSamplesize = 8; - else -#endif - iSamplesize = 4; - - break; - } - } - - iRowsize = iSamplesize * iWidth; - iImgdatasize = iRowsize * iHeight; - /* buffer size changed ? */ - if (iImgdatasize != pBuf->iImgdatasize) - { /* drop the old one */ - MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize); - - if (iImgdatasize) /* allocate new sample-buffer ? */ - MNG_ALLOC (pData, pBuf->pImgdata, iImgdatasize); - } - else - { - if (iImgdatasize) /* clear old buffer */ - { - mng_uint8p pTemp = pBuf->pImgdata; - mng_uint32 iX; - - for (iX = 0; iX < (iImgdatasize & (mng_uint32)(~3L)); iX += 4) - { - *((mng_uint32p)pTemp) = 0x00000000l; - pTemp += 4; - } - - while (pTemp < (pBuf->pImgdata + iImgdatasize)) - { - *pTemp = 0; - pTemp++; - } - } - } - - pBuf->iSamplesize = iSamplesize; /* remember new sizes */ - pBuf->iRowsize = iRowsize; - pBuf->iImgdatasize = iImgdatasize; - - if (!pBuf->iPixelsampledepth) /* set delta sampledepths if empty */ - pBuf->iPixelsampledepth = iBitdepth; - if (!pBuf->iAlphasampledepth) - pBuf->iAlphasampledepth = iBitdepth; - /* dimension set and clipping not ? */ - if ((iWidth) && (iHeight) && (!pImage->bClipped)) - { - pImage->iClipl = 0; /* set clipping to dimension by default */ - pImage->iClipr = iWidth; - pImage->iClipt = 0; - pImage->iClipb = iHeight; - } - -#ifndef MNG_SKIPCHUNK_MAGN - if (pImage->iId) /* reset magnification info ? */ - { - pImage->iMAGN_MethodX = 0; - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; - } -#endif - - if (bResetall) /* reset the other characteristics ? */ - { -#ifndef MNG_SKIPCHUNK_PAST - pImage->iPastx = 0; - pImage->iPasty = 0; -#endif - - pBuf->bHasPLTE = MNG_FALSE; - pBuf->bHasTRNS = MNG_FALSE; - pBuf->bHasGAMA = pData->bHasglobalGAMA; -#ifndef MNG_SKIPCHUNK_cHRM - pBuf->bHasCHRM = pData->bHasglobalCHRM; -#endif - pBuf->bHasSRGB = pData->bHasglobalSRGB; -#ifndef MNG_SKIPCHUNK_iCCP - pBuf->bHasICCP = pData->bHasglobalICCP; -#endif -#ifndef MNG_SKIPCHUNK_bKGD - pBuf->bHasBKGD = pData->bHasglobalBKGD; -#endif - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* drop possibly old ICC profile */ - { - MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize); - pBuf->iProfilesize = 0; - } -#endif - - if (pData->bHasglobalGAMA) /* global gAMA present ? */ - pBuf->iGamma = pData->iGlobalGamma; - -#ifndef MNG_SKIPCHUNK_cHRM - if (pData->bHasglobalCHRM) /* global cHRM present ? */ - { - pBuf->iWhitepointx = pData->iGlobalWhitepointx; - pBuf->iWhitepointy = pData->iGlobalWhitepointy; - pBuf->iPrimaryredx = pData->iGlobalPrimaryredx; - pBuf->iPrimaryredy = pData->iGlobalPrimaryredy; - pBuf->iPrimarygreenx = pData->iGlobalPrimarygreenx; - pBuf->iPrimarygreeny = pData->iGlobalPrimarygreeny; - pBuf->iPrimarybluex = pData->iGlobalPrimarybluex; - pBuf->iPrimarybluey = pData->iGlobalPrimarybluey; - } -#endif - - if (pData->bHasglobalSRGB) /* global sRGB present ? */ - pBuf->iRenderingintent = pData->iGlobalRendintent; - -#ifndef MNG_SKIPCHUNK_iCCP - if (pData->bHasglobalICCP) /* global iCCP present ? */ - { - if (pData->iGlobalProfilesize) - { - MNG_ALLOC (pData, pBuf->pProfile, pData->iGlobalProfilesize); - MNG_COPY (pBuf->pProfile, pData->pGlobalProfile, pData->iGlobalProfilesize); - } - - pBuf->iProfilesize = pData->iGlobalProfilesize; - } -#endif - -#ifndef MNG_SKIPCHUNK_bKGD - if (pData->bHasglobalBKGD) /* global bKGD present ? */ - { - pBuf->iBKGDred = pData->iGlobalBKGDred; - pBuf->iBKGDgreen = pData->iGlobalBKGDgreen; - pBuf->iBKGDblue = pData->iGlobalBKGDblue; - } -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESET_OBJECTDETAILS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#if !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN) -mng_retcode mng_promote_imageobject (mng_datap pData, - mng_imagep pImage, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype) -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint32 iW = pBuf->iWidth; - mng_uint32 iH = pBuf->iHeight; - mng_uint8p pNewbuf; - mng_uint32 iNewbufsize; - mng_uint32 iNewrowsize; - mng_uint32 iNewsamplesize = pBuf->iSamplesize; - mng_uint32 iY; - mng_uint8 iTempdepth; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_START); -#endif - -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (iBitdepth < 8) - iBitdepth=8; - if (pBuf->iBitdepth < 8) - pBuf->iBitdepth=8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (iBitdepth > 8) - iBitdepth=8; - if (pBuf->iBitdepth > 8) - pBuf->iBitdepth=8; -#endif - - pData->fPromoterow = MNG_NULL; /* init promotion fields */ - pData->fPromBitdepth = MNG_NULL; - pData->iPromColortype = iColortype; - pData->iPromBitdepth = iBitdepth; - pData->iPromFilltype = iFilltype; - - if (iBitdepth != pBuf->iBitdepth) /* determine bitdepth promotion */ - { - if (pBuf->iColortype == MNG_COLORTYPE_INDEXED) - iTempdepth = 8; - else - iTempdepth = pBuf->iBitdepth; - -#ifndef MNG_NO_DELTA_PNG - if (iFilltype == MNG_FILLMETHOD_ZEROFILL) - { - switch (iTempdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - switch (iBitdepth) - { - case 2 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_2; break; } - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_1_16; break; } -#endif - } - break; - } - case 2 : { - switch (iBitdepth) - { - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_2_16; break; } -#endif - } - break; - } - case 4 : { - switch (iBitdepth) - { - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_4_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_4_16; break; } -#endif - } - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromBitdepth = (mng_fptr)mng_promote_zerofill_8_16; -#endif - break; - } - } - } - else -#endif - { - switch (iTempdepth) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case 1 : { - switch (iBitdepth) - { - case 2 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_2; break; } - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_1_16; break; } -#endif - } - break; - } - case 2 : { - switch (iBitdepth) - { - case 4 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_4; break; } - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_2_16; break; } -#endif - } - break; - } - case 4 : { - switch (iBitdepth) - { - case 8 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_4_8; break; } -#ifndef MNG_NO_16BIT_SUPPORT - case 16 : { pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_4_16; break; } -#endif - } - break; - } -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case 8 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromBitdepth = (mng_fptr)mng_promote_replicate_8_16; -#endif - break; - } - } - } - } - /* g -> g */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_GRAY)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_g16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_g8; - } - - iNewsamplesize = 1; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 2; -#endif - } - else /* g -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_GRAYA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_ga16; -#endif - - iNewsamplesize = 2; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 4; -#endif - } - else /* g -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_RGB)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgb16; -#endif - - iNewsamplesize = 3; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 6; -#endif - } - else /* g -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAY) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* ga -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) && - (iColortype == MNG_COLORTYPE_GRAYA)) - { - iNewsamplesize = 2; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16; - if (iBitdepth == 16) - iNewsamplesize = 4; -#endif - } - else /* ga -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_GRAYA) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* rgb -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_RGB) && - (iColortype == MNG_COLORTYPE_RGB)) - { - iNewsamplesize = 3; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16; - if (iBitdepth == 16) - iNewsamplesize = 6; -#endif - } - else /* rgb -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_RGB) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16; -#endif - - iNewsamplesize = 4; -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* indexed -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) && - (iColortype == MNG_COLORTYPE_RGB)) - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgb8; - - iNewsamplesize = 3; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 6; -#endif - } - else /* indexed -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_INDEXED) && - (iColortype == MNG_COLORTYPE_RGBA)) - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_idx8_rgba8; - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* rgba -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_RGBA) && - (iColortype == MNG_COLORTYPE_RGBA)) - { - iNewsamplesize = 4; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16; - } - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } -#ifdef MNG_INCLUDE_JNG - else /* JPEG g -> g */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGGRAY)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_g16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_g8; - } - - iNewsamplesize = 1; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 2; -#endif - } - else /* JPEG g -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGGRAYA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_ga8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_ga16; -#endif - - iNewsamplesize = 2; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 4; -#endif - } - else /* JPEG g -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGCOLOR)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgb8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgb16; -#endif - - iNewsamplesize = 3; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 6; -#endif - } - else /* JPEG g -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAY) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_g8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_g16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* JPEG ga -> ga */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) && - (iColortype == MNG_COLORTYPE_JPEGGRAYA)) - { - iNewsamplesize = 2; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_ga16; - if (iBitdepth == 16) - iNewsamplesize = 4; -#endif - - } - else /* JPEG ga -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGGRAYA) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_ga8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_ga16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* JPEG rgb -> rgb */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) && - (iColortype == MNG_COLORTYPE_JPEGCOLOR)) - { - iNewsamplesize = 3; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgb16; - if (iBitdepth == 16) - iNewsamplesize = 6; -#endif - - } - else /* JPEG rgb -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLOR) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - { -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba16; - else -#endif - pData->fPromoterow = (mng_fptr)mng_promote_rgb8_rgba8; - } -#ifndef MNG_NO_16BIT_SUPPORT - else /* source = 16 bits */ - pData->fPromoterow = (mng_fptr)mng_promote_rgb16_rgba16; -#endif - - iNewsamplesize = 4; - -#ifndef MNG_NO_16BIT_SUPPORT - if (iBitdepth == 16) /* 16-bit wide ? */ - iNewsamplesize = 8; -#endif - } - else /* JPEG rgba -> rgba */ - if ((pBuf->iColortype == MNG_COLORTYPE_JPEGCOLORA) && - (iColortype == MNG_COLORTYPE_JPEGCOLORA)) - { - iNewsamplesize = 4; -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth <= 8) /* source <= 8 bits */ - if (iBitdepth == 16) - pData->fPromoterow = (mng_fptr)mng_promote_rgba8_rgba16; - if (iBitdepth == 16) - iNewsamplesize = 8; -#endif - } -#endif /* JNG */ - - /* found a proper promotion ? */ - if (pData->fPromoterow) - { - pData->pPromBuf = (mng_ptr)pBuf; - pData->iPromWidth = pBuf->iWidth; - iNewrowsize = iW * iNewsamplesize; - iNewbufsize = iH * iNewrowsize; - - MNG_ALLOC (pData, pNewbuf, iNewbufsize); - - pData->pPromSrc = (mng_ptr)pBuf->pImgdata; - pData->pPromDst = (mng_ptr)pNewbuf; - iY = 0; - - while ((!iRetcode) && (iY < iH)) - { - iRetcode = ((mng_promoterow)pData->fPromoterow) (pData); - pData->pPromSrc = (mng_uint8p)pData->pPromSrc + pBuf->iRowsize; - pData->pPromDst = (mng_uint8p)pData->pPromDst + iNewrowsize; -/* pData->pPromSrc = (mng_ptr)((mng_uint32)pData->pPromSrc + pBuf->iRowsize); */ -/* pData->pPromDst = (mng_ptr)((mng_uint32)pData->pPromDst + iNewrowsize); */ - iY++; - } - - MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize); - - pBuf->iBitdepth = iBitdepth; - pBuf->iColortype = iColortype; - pBuf->iSamplesize = iNewsamplesize; - pBuf->iRowsize = iNewrowsize; - pBuf->iImgdatasize = iNewbufsize; - pBuf->pImgdata = pNewbuf; - pBuf->bHasPLTE = MNG_FALSE; - pBuf->iPLTEcount = 0; - pBuf->bHasTRNS = MNG_FALSE; - pBuf->iTRNScount = 0; - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_magnify_imageobject (mng_datap pData, - mng_imagep pImage) -{ - mng_uint8p pNewdata; - mng_uint8p pSrcline1; - mng_uint8p pSrcline2; - mng_uint8p pTempline; - mng_uint8p pDstline; - mng_uint32 iNewrowsize; - mng_uint32 iNewsize; - mng_uint32 iY; - mng_int32 iS, iM; - mng_retcode iRetcode; - - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint32 iNewW = pBuf->iWidth; - mng_uint32 iNewH = pBuf->iHeight; - mng_magnify_x fMagnifyX = MNG_NULL; - mng_magnify_y fMagnifyY = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_START); -#endif - - if (pBuf->iColortype == MNG_COLORTYPE_INDEXED) /* indexed color ? */ - { /* concrete buffer ? */ - if ((pBuf->bConcrete) && (pImage->iId)) - MNG_ERROR (pData, MNG_INVALIDCOLORTYPE); - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN - if (pBuf->iTRNScount) /* with transparency ? */ - iRetcode = mng_promote_imageobject (pData, pImage, 8, 6, 0); - else - iRetcode = mng_promote_imageobject (pData, pImage, 8, 2, 0); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_MAGN - /* Promote everything to RGBA, using fill method 0 (LBR) */ - iRetcode = mng_promote_imageobject (pData, pImage, 8, 6, 0); - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - - if (pImage->iMAGN_MethodX) /* determine new width */ - { - if (pImage->iMAGN_MethodX == 1) - { - iNewW = pImage->iMAGN_ML; - if (pBuf->iWidth > 1) - iNewW = iNewW + pImage->iMAGN_MR; - if (pBuf->iWidth > 2) - iNewW = iNewW + (pBuf->iWidth - 2) * (pImage->iMAGN_MX); - } - else - { - iNewW = pBuf->iWidth + pImage->iMAGN_ML - 1; - if (pBuf->iWidth > 2) - iNewW = iNewW + pImage->iMAGN_MR - 1; - if (pBuf->iWidth > 3) - iNewW = iNewW + (pBuf->iWidth - 3) * (pImage->iMAGN_MX - 1); - } - } - - if (pImage->iMAGN_MethodY) /* determine new height */ - { - if (pImage->iMAGN_MethodY == 1) - { - iNewH = pImage->iMAGN_MT; - if (pBuf->iHeight > 1) - iNewH = iNewH + pImage->iMAGN_ML; - if (pBuf->iHeight > 2) - iNewH = iNewH + (pBuf->iHeight - 2) * (pImage->iMAGN_MY); - } - else - { - iNewH = pBuf->iHeight + pImage->iMAGN_MT - 1; - if (pBuf->iHeight > 2) - iNewH = iNewH + pImage->iMAGN_MB - 1; - if (pBuf->iHeight > 3) - iNewH = iNewH + (pBuf->iHeight - 3) * (pImage->iMAGN_MY - 1); - } - } - /* get new buffer */ - iNewrowsize = iNewW * pBuf->iSamplesize; - iNewsize = iNewH * iNewrowsize; - - MNG_ALLOC (pData, pNewdata, iNewsize); - - switch (pBuf->iColortype) /* determine magnification routines */ - { -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN - case 0 : ; - case 8 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_g8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_g8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_g8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_g8_x2; break; } - case 5 : { fMagnifyX = mng_magnify_g8_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_g8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_g8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_g8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_g8_y2; break; } - case 5 : { fMagnifyY = mng_magnify_g8_y3; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_g16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_g16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_g16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_g16_x2; break; } - case 5 : { fMagnifyX = mng_magnify_g16_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_g16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_g16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_g16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_g16_y2; break; } - case 5 : { fMagnifyY = mng_magnify_g16_y3; break; } - } - } -#endif - - break; - } - - case 2 : ; - case 10 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgb8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgb8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgb8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgb8_x2; break; } - case 5 : { fMagnifyX = mng_magnify_rgb8_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgb8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgb8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgb8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgb8_y2; break; } - case 5 : { fMagnifyY = mng_magnify_rgb8_y3; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgb16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgb16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgb16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgb16_x2; break; } - case 5 : { fMagnifyX = mng_magnify_rgb16_x3; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgb16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgb16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgb16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgb16_y2; break; } - case 5 : { fMagnifyY = mng_magnify_rgb16_y3; break; } - } - } -#endif - - break; - } - - case 4 : ; - case 12 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_ga8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_ga8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_ga8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_ga8_x4; break; } - case 5 : { fMagnifyX = mng_magnify_ga8_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_ga8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_ga8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_ga8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_ga8_y4; break; } - case 5 : { fMagnifyY = mng_magnify_ga8_y5; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_ga16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_ga16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_ga16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_ga16_x4; break; } - case 5 : { fMagnifyX = mng_magnify_ga16_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_ga16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_ga16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_ga16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_ga16_y4; break; } - case 5 : { fMagnifyY = mng_magnify_ga16_y5; break; } - } - } -#endif - - break; - } -#endif - - case 6 : ; - case 14 : { - if (pBuf->iBitdepth <= 8) - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgba8_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgba8_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgba8_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgba8_x4; break; } - case 5 : { fMagnifyX = mng_magnify_rgba8_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgba8_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgba8_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgba8_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgba8_y4; break; } - case 5 : { fMagnifyY = mng_magnify_rgba8_y5; break; } - } - } -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN - else - { - switch (pImage->iMAGN_MethodX) - { - case 1 : { fMagnifyX = mng_magnify_rgba16_x1; break; } - case 2 : { fMagnifyX = mng_magnify_rgba16_x2; break; } - case 3 : { fMagnifyX = mng_magnify_rgba16_x3; break; } - case 4 : { fMagnifyX = mng_magnify_rgba16_x4; break; } - case 5 : { fMagnifyX = mng_magnify_rgba16_x5; break; } - } - - switch (pImage->iMAGN_MethodY) - { - case 1 : { fMagnifyY = mng_magnify_rgba16_y1; break; } - case 2 : { fMagnifyY = mng_magnify_rgba16_y2; break; } - case 3 : { fMagnifyY = mng_magnify_rgba16_y3; break; } - case 4 : { fMagnifyY = mng_magnify_rgba16_y4; break; } - case 5 : { fMagnifyY = mng_magnify_rgba16_y5; break; } - } - } -#endif -#endif - break; - } - } - - pSrcline1 = pBuf->pImgdata; /* initialize row-loop variables */ - pDstline = pNewdata; - /* allocate temporary row */ - MNG_ALLOC (pData, pTempline, iNewrowsize); - - for (iY = 0; iY < pBuf->iHeight; iY++) - { - pSrcline2 = pSrcline1 + pBuf->iRowsize; - - if (fMagnifyX) /* magnifying in X-direction ? */ - { - iRetcode = fMagnifyX (pData, pImage->iMAGN_MX, - pImage->iMAGN_ML, pImage->iMAGN_MR, - pBuf->iWidth, pSrcline1, pDstline); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pTempline, iNewrowsize); - MNG_FREEX (pData, pNewdata, iNewsize); - return iRetcode; - } - } - else - { - MNG_COPY (pDstline, pSrcline1, iNewrowsize); - } - - pDstline += iNewrowsize; - /* magnifying in Y-direction ? */ - if ((fMagnifyY) && - ((iY < pBuf->iHeight - 1) || (pBuf->iHeight == 1) || (pImage->iMAGN_MethodY == 1))) - { - if (iY == 0) /* first interval ? */ - { - if (pBuf->iHeight == 1) /* single row ? */ - pSrcline2 = MNG_NULL; - - iM = (mng_int32)pImage->iMAGN_MT; - } - else /* last interval ? */ - if (((pImage->iMAGN_MethodY == 1) && (iY == (pBuf->iHeight - 1))) || - ((pImage->iMAGN_MethodY != 1) && (iY == (pBuf->iHeight - 2))) ) - iM = (mng_int32)pImage->iMAGN_MB; - else /* middle interval */ - iM = (mng_int32)pImage->iMAGN_MY; - - for (iS = 1; iS < iM; iS++) - { - iRetcode = fMagnifyY (pData, iS, iM, pBuf->iWidth, - pSrcline1, pSrcline2, pTempline); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pTempline, iNewrowsize); - MNG_FREEX (pData, pNewdata, iNewsize); - return iRetcode; - } - - if (fMagnifyX) /* magnifying in X-direction ? */ - { - iRetcode = fMagnifyX (pData, pImage->iMAGN_MX, - pImage->iMAGN_ML, pImage->iMAGN_MR, - pBuf->iWidth, pTempline, pDstline); - - if (iRetcode) /* on error bail out */ - { - MNG_FREEX (pData, pTempline, iNewrowsize); - MNG_FREEX (pData, pNewdata, iNewsize); - return iRetcode; - } - } - else - { - MNG_COPY (pDstline, pTempline, iNewrowsize); - } - - pDstline += iNewrowsize; - } - } - - pSrcline1 += pBuf->iRowsize; - } - /* drop temporary row */ - MNG_FREEX (pData, pTempline, iNewrowsize); - /* drop old pixel-data */ - MNG_FREEX (pData, pBuf->pImgdata, pBuf->iImgdatasize); - - pBuf->pImgdata = pNewdata; /* save new buffer dimensions */ - pBuf->iRowsize = iNewrowsize; - pBuf->iImgdatasize = iNewsize; - pBuf->iWidth = iNewW; - pBuf->iHeight = iNewH; - - if (pImage->iId) /* real object ? */ - { - pImage->iMAGN_MethodX = 0; /* it's done; don't do it again !!! */ - pImage->iMAGN_MethodY = 0; - pImage->iMAGN_MX = 0; - pImage->iMAGN_MY = 0; - pImage->iMAGN_ML = 0; - pImage->iMAGN_MR = 0; - pImage->iMAGN_MT = 0; - pImage->iMAGN_MB = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_IMGOBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_colorcorrect_object (mng_datap pData, - mng_imagep pImage) -{ - mng_imagedatap pBuf = pImage->pImgbuf; - mng_retcode iRetcode; - mng_uint32 iY; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COLORCORRECT_OBJECT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_JNG - if ((pBuf->iBitdepth < 8) || /* we need 8- or 16-bit RGBA !!! */ - ((pBuf->iColortype != MNG_COLORTYPE_RGBA ) && - (pBuf->iColortype != MNG_COLORTYPE_JPEGCOLORA) )) -#else - if (pBuf->iBitdepth < 8) /* we need 8- or 16-bit RGBA !!! */ -#endif - MNG_ERROR (pData, MNG_OBJNOTABSTRACT); - - if (!pBuf->bCorrected) /* only if not already done ! */ - { /* so the row routines now to find it */ - pData->pRetrieveobj = (mng_objectp)pImage; - pData->pStoreobj = (mng_objectp)pImage; - pData->pStorebuf = (mng_objectp)pImage->pImgbuf; - -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - { - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba16; - pData->fStorerow = (mng_fptr)mng_store_rgba16; - } - else -#endif - { - pData->fRetrieverow = (mng_fptr)mng_retrieve_rgba8; - pData->fStorerow = (mng_fptr)mng_store_rgba8; - } - - pData->bIsOpaque = MNG_FALSE; - - pData->iPass = -1; /* these are the object's dimensions now */ - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pBuf->iWidth; - pData->iRowsize = pData->iRowsamples << 2; - pData->iPixelofs = 0; - pData->bIsRGBA16 = MNG_FALSE; - /* adjust for 16-bit object ? */ -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - { - pData->bIsRGBA16 = MNG_TRUE; - pData->iRowsize = pData->iRowsamples << 3; - } -#endif - - pData->fCorrectrow = MNG_NULL; /* default no color-correction */ - -#ifdef MNG_NO_CMS - iRetcode = MNG_NOERROR; -#else -#if defined(MNG_FULL_CMS) /* determine color-management routine */ - iRetcode = mng_init_full_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_GAMMA_ONLY) - iRetcode = mng_init_gamma_only (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#elif defined(MNG_APP_CMS) - iRetcode = mng_init_app_cms (pData, MNG_FALSE, MNG_FALSE, MNG_TRUE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif /* MNG_NO_CMS */ - - if (pData->fCorrectrow) /* really correct something ? */ - { /* get a temporary row-buffer */ - MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize); - - pData->pWorkrow = pData->pRGBArow; - iY = 0; /* start from the top */ - - while ((!iRetcode) && (iY < pBuf->iHeight)) - { /* get a row */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - - if (!iRetcode) /* color correct it */ - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* store it back ! */ - iRetcode = ((mng_storerow)pData->fStorerow) (pData); - - if (!iRetcode) /* adjust variables for next row */ - iRetcode = mng_next_row (pData); - - iY++; /* and next line */ - } - /* drop the temporary row-buffer */ - MNG_FREEX (pData, pData->pRGBArow, pData->iRowsize); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#if defined(MNG_FULL_CMS) /* cleanup cms stuff */ - iRetcode = mng_clear_cms (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; -#endif - } - - pBuf->bCorrected = MNG_TRUE; /* let's not go through that again ! */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COLORCORRECT_OBJECT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Animation-object routines * */ -/* * * */ -/* * these handle the animation objects used to re-run parts of a MNG. * */ -/* * eg. during LOOP or TERM processing * */ -/* * * */ -/* ************************************************************************** */ - -void mng_add_ani_object (mng_datap pData, - mng_object_headerp pObject) -{ - mng_object_headerp pLast = (mng_object_headerp)pData->pLastaniobj; - - if (pLast) /* link it as last in the chain */ - { - pObject->pPrev = pLast; - pLast->pNext = pObject; - } - else - { - pObject->pPrev = MNG_NULL; /* be on the safe side */ - pData->pFirstaniobj = pObject; - } - - pObject->pNext = MNG_NULL; /* be on the safe side */ - pData->pLastaniobj = pObject; - /* keep track for jumping */ - pObject->iFramenr = pData->iFrameseq; - pObject->iLayernr = pData->iLayerseq; - pObject->iPlaytime = pData->iFrametime; - /* save restart object ? */ - if ((pData->bDisplaying) && (!pData->bRunning) && (!pData->pCurraniobj)) - pData->pCurraniobj = pObject; - - return; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -mng_retcode mng_create_ani_image (mng_datap pData) -{ - mng_ani_imagep pImage; - mng_imagep pCurrent; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IMAGE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - pCurrent = (mng_imagep)pData->pObjzero; - else /* get the current object */ -#endif - pCurrent = (mng_imagep)pData->pCurrentobj; - - if (!pCurrent) /* otherwise object 0 */ - pCurrent = (mng_imagep)pData->pObjzero; - /* now just clone the object !!! */ - iRetcode = mng_clone_imageobject (pData, 0, MNG_FALSE, pCurrent->bVisible, - MNG_FALSE, MNG_FALSE, 0, 0, 0, pCurrent, - &pImage); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - pImage->sHeader.fCleanup = mng_free_ani_image; - pImage->sHeader.fProcess = mng_process_ani_image; - - mng_add_ani_object (pData, (mng_object_headerp)pImage); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* okido */ -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_image (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_imagep pImage = (mng_ani_imagep)pObject; - mng_imagedatap pImgbuf = pImage->pImgbuf; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IMAGE, MNG_LC_START); -#endif - /* unlink the image-data buffer */ - iRetcode = mng_free_imagedataobject (pData, pImgbuf); - /* drop its own buffer */ - MNG_FREEX (pData, pImage, sizeof (mng_ani_image)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IMAGE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_image (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode = MNG_NOERROR; - mng_ani_imagep pImage = (mng_imagep)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IMAGE, MNG_LC_START); -#endif - -#ifndef MNG_NO_DELTA_PNG - if (pData->bHasDHDR) /* processing delta-image ? */ - { - mng_imagep pDelta = (mng_imagep)pData->pDeltaImage; - - if (!pData->iBreakpoint) /* only execute if not broken before */ - { /* make sure to process pixels as well */ - pData->bDeltaimmediate = MNG_FALSE; - /* execute the delta process */ - iRetcode = mng_execute_delta_image (pData, pDelta, (mng_imagep)pObject); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - /* now go and shoot it off (if required) */ - if ((pDelta->bVisible) && (pDelta->bViewable)) - iRetcode = mng_display_image (pData, pDelta, MNG_FALSE); - - if (!pData->bTimerset) - pData->bHasDHDR = MNG_FALSE; /* this image signifies IEND !! */ - - } - else -#endif - if (pData->pCurrentobj) /* active object ? */ - { - mng_imagep pCurrent = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf = pCurrent->pImgbuf; - - if (!pData->iBreakpoint) /* don't copy it again ! */ - { - if (pBuf->iImgdatasize) /* buffer present in active object ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize); - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize); -#endif - /* now blatently copy the animation buffer */ - MNG_COPY (pBuf, pImage->pImgbuf, sizeof (mng_imagedata)); - /* copy viewability */ - pCurrent->bViewable = pImage->bViewable; - - if (pBuf->iImgdatasize) /* sample buffer present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pImgdata, pBuf->iImgdatasize); - MNG_COPY (pBuf->pImgdata, pImage->pImgbuf->pImgdata, pBuf->iImgdatasize); - } - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pProfile, pBuf->iProfilesize); - MNG_COPY (pBuf->pProfile, pImage->pImgbuf->pProfile, pBuf->iProfilesize); - } -#endif - } - /* now go and shoot it off (if required) */ - if ((pCurrent->bVisible) && (pCurrent->bViewable)) - iRetcode = mng_display_image (pData, pCurrent, MNG_FALSE); - } - else - { - mng_imagep pObjzero = (mng_imagep)pData->pObjzero; - mng_imagedatap pBuf = pObjzero->pImgbuf; - - if (!pData->iBreakpoint) /* don't copy it again ! */ - { - if (pBuf->iImgdatasize) /* buffer present in active object ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pImgdata, pBuf->iImgdatasize); - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - /* then drop it */ - MNG_FREE (pData, pBuf->pProfile, pBuf->iProfilesize); -#endif - /* now blatently copy the animation buffer */ - MNG_COPY (pBuf, pImage->pImgbuf, sizeof (mng_imagedata)); - /* copy viewability */ - pObjzero->bViewable = pImage->bViewable; - - if (pBuf->iImgdatasize) /* sample buffer present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pImgdata, pBuf->iImgdatasize); - MNG_COPY (pBuf->pImgdata, pImage->pImgbuf->pImgdata, pBuf->iImgdatasize); - } - -#ifndef MNG_SKIPCHUNK_iCCP - if (pBuf->iProfilesize) /* iCCP profile present ? */ - { /* then make a copy */ - MNG_ALLOC (pData, pBuf->pProfile, pBuf->iProfilesize); - MNG_COPY (pBuf->pProfile, pImage->pImgbuf->pProfile, pBuf->iProfilesize); - } -#endif - } - /* now go and show it */ - iRetcode = mng_display_image (pData, pObjzero, MNG_FALSE); - } - - if (!iRetcode) /* all's well ? */ - { - if (pData->bTimerset) /* timer break ? */ - pData->iBreakpoint = 99; /* fictive number; no more processing needed! */ - else - pData->iBreakpoint = 0; /* else clear it */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IMAGE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_plte (mng_datap pData, - mng_uint32 iEntrycount, - mng_palette8ep paEntries) -#else -mng_retcode mng_create_ani_plte (mng_datap pData) -#endif -{ - mng_ani_pltep pPLTE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PLTE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_plte), - mng_free_obj_general, - mng_process_ani_plte, - &pTemp); - if (iRetcode) - return iRetcode; - pPLTE = (mng_ani_pltep)pTemp; -#else - MNG_ALLOC (pData, pPLTE, sizeof (mng_ani_plte)); - - pPLTE->sHeader.fCleanup = mng_free_ani_plte; - pPLTE->sHeader.fProcess = mng_process_ani_plte; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pPLTE); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pPLTE->iEntrycount = iEntrycount; - MNG_COPY (pPLTE->aEntries, paEntries, sizeof (pPLTE->aEntries)); -#else - pPLTE->iEntrycount = pData->iGlobalPLTEcount; - MNG_COPY (pPLTE->aEntries, pData->aGlobalPLTEentries, sizeof (pPLTE->aEntries)); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_plte (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PLTE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_plte)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_plte (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_pltep pPLTE = (mng_ani_pltep)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PLTE, MNG_LC_START); -#endif - - pData->bHasglobalPLTE = MNG_TRUE; - pData->iGlobalPLTEcount = pPLTE->iEntrycount; - - MNG_COPY (pData->aGlobalPLTEentries, pPLTE->aEntries, sizeof (pPLTE->aEntries)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PLTE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_trns (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata) -#else -mng_retcode mng_create_ani_trns (mng_datap pData) -#endif -{ - mng_ani_trnsp pTRNS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TRNS, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_trns), - mng_free_obj_general, - mng_process_ani_trns, - &pTemp); - if (iRetcode) - return iRetcode; - pTRNS = (mng_ani_trnsp)pTemp; -#else - MNG_ALLOC (pData, pTRNS, sizeof (mng_ani_trns)); - - pTRNS->sHeader.fCleanup = mng_free_ani_trns; - pTRNS->sHeader.fProcess = mng_process_ani_trns; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pTRNS); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pTRNS->iRawlen = iRawlen; - MNG_COPY (pTRNS->aRawdata, pRawdata, sizeof (pTRNS->aRawdata)); -#else - pTRNS->iRawlen = pData->iGlobalTRNSrawlen; - MNG_COPY (pTRNS->aRawdata, pData->aGlobalTRNSrawdata, sizeof (pTRNS->aRawdata)); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_trns (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TRNS, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_trns)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_trns (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_trnsp pTRNS = (mng_ani_trnsp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TRNS, MNG_LC_START); -#endif - - pData->bHasglobalTRNS = MNG_TRUE; - pData->iGlobalTRNSrawlen = pTRNS->iRawlen; - - MNG_COPY (pData->aGlobalTRNSrawdata, pTRNS->aRawdata, sizeof (pTRNS->aRawdata)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TRNS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_gAMA -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iGamma) -#else -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_gamap pGAMA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_GAMA, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_gama), - mng_free_obj_general, - mng_process_ani_gama, - &pTemp); - if (iRetcode) - return iRetcode; - pGAMA = (mng_ani_gamap)pTemp; -#else - MNG_ALLOC (pData, pGAMA, sizeof (mng_ani_gama)); - - pGAMA->sHeader.fCleanup = mng_free_ani_gama; - pGAMA->sHeader.fProcess = mng_process_ani_gama; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pGAMA); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pGAMA->bEmpty = bEmpty; - pGAMA->iGamma = iGamma; -#else - pGAMA->bEmpty = ((mng_gamap)pChunk)->bEmpty; - pGAMA->iGamma = ((mng_gamap)pChunk)->iGamma; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_gama (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_GAMA, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_gama)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_gama (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_gamap pGAMA = (mng_ani_gamap)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_GAMA, MNG_LC_START); -#endif - - if (pGAMA->bEmpty) /* empty chunk ? */ - { /* clear global gAMA */ - pData->bHasglobalGAMA = MNG_FALSE; - pData->iGlobalGamma = 0; - } - else - { /* set global gAMA */ - pData->bHasglobalGAMA = MNG_TRUE; - pData->iGlobalGamma = pGAMA->iGamma; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_GAMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey) -#else -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ptr pTemp; - mng_ani_chrmp pCHRM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CHRM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_chrm), - mng_free_obj_general, - mng_process_ani_chrm, - &pTemp); - if (iRetcode) - return iRetcode; - pCHRM = (mng_ani_chrmp)pTemp; -#else - MNG_ALLOC (pData, pCHRM, sizeof (mng_ani_chrm)); - - pCHRM->sHeader.fCleanup = mng_free_ani_chrm; - pCHRM->sHeader.fProcess = mng_process_ani_chrm; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pCHRM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pCHRM->bEmpty = bEmpty; - pCHRM->iWhitepointx = iWhitepointx; - pCHRM->iWhitepointy = iWhitepointy; - pCHRM->iRedx = iRedx; - pCHRM->iRedy = iRedy; - pCHRM->iGreenx = iGreenx; - pCHRM->iGreeny = iGreeny; - pCHRM->iBluex = iBluex; - pCHRM->iBluey = iBluey; -#else - pCHRM->bEmpty = ((mng_chrmp)pChunk)->bEmpty; - pCHRM->iWhitepointx = ((mng_chrmp)pChunk)->iWhitepointx; - pCHRM->iWhitepointy = ((mng_chrmp)pChunk)->iWhitepointy; - pCHRM->iRedx = ((mng_chrmp)pChunk)->iRedx; - pCHRM->iRedy = ((mng_chrmp)pChunk)->iRedy; - pCHRM->iGreenx = ((mng_chrmp)pChunk)->iGreenx; - pCHRM->iGreeny = ((mng_chrmp)pChunk)->iGreeny; - pCHRM->iBluex = ((mng_chrmp)pChunk)->iBluex; - pCHRM->iBluey = ((mng_chrmp)pChunk)->iBluey; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_chrm (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CHRM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_chrm)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_chrm (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_chrmp pCHRM = (mng_ani_chrmp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CHRM, MNG_LC_START); -#endif - - if (pCHRM->bEmpty) /* empty chunk ? */ - { /* clear global cHRM */ - pData->bHasglobalCHRM = MNG_FALSE; - pData->iGlobalWhitepointx = 0; - pData->iGlobalWhitepointy = 0; - pData->iGlobalPrimaryredx = 0; - pData->iGlobalPrimaryredy = 0; - pData->iGlobalPrimarygreenx = 0; - pData->iGlobalPrimarygreeny = 0; - pData->iGlobalPrimarybluex = 0; - pData->iGlobalPrimarybluey = 0; - } - else - { /* set global cHRM */ - pData->bHasglobalCHRM = MNG_TRUE; - pData->iGlobalWhitepointx = pCHRM->iWhitepointx; - pData->iGlobalWhitepointy = pCHRM->iWhitepointy; - pData->iGlobalPrimaryredx = pCHRM->iRedx; - pData->iGlobalPrimaryredy = pCHRM->iRedy; - pData->iGlobalPrimarygreenx = pCHRM->iGreenx; - pData->iGlobalPrimarygreeny = pCHRM->iGreeny; - pData->iGlobalPrimarybluex = pCHRM->iBluex; - pData->iGlobalPrimarybluey = pCHRM->iBluey; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CHRM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_sRGB -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_bool bEmpty, - mng_uint8 iRenderingintent) -#else -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_srgbp pSRGB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SRGB, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_srgb), - mng_free_obj_general, - mng_process_ani_srgb, - &pTemp); - if (iRetcode) - return iRetcode; - pSRGB = (mng_ani_srgbp)pTemp; -#else - MNG_ALLOC (pData, pSRGB, sizeof (mng_ani_srgb)); - - pSRGB->sHeader.fCleanup = mng_free_ani_srgb; - pSRGB->sHeader.fProcess = mng_process_ani_srgb; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSRGB); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pSRGB->bEmpty = bEmpty; - pSRGB->iRenderingintent = iRenderingintent; -#else - pSRGB->bEmpty = ((mng_srgbp)pChunk)->bEmpty; - pSRGB->iRenderingintent = ((mng_srgbp)pChunk)->iRenderingintent; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_srgb (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SRGB, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_srgb)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_srgb (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_srgbp pSRGB = (mng_ani_srgbp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SRGB, MNG_LC_START); -#endif - - if (pSRGB->bEmpty) /* empty chunk ? */ - { /* clear global sRGB */ - pData->bHasglobalSRGB = MNG_FALSE; - pData->iGlobalRendintent = 0; - } - else - { /* set global sRGB */ - pData->bHasglobalSRGB = MNG_TRUE; - pData->iGlobalRendintent = pSRGB->iRenderingintent; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iProfilesize, - mng_ptr pProfile) -#else -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ptr pTemp; - mng_ani_iccpp pICCP; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ICCP, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_iccp), - mng_free_ani_iccp, - mng_process_ani_iccp, - &pTemp); - if (iRetcode) - return iRetcode; - pICCP = (mng_ani_iccpp)pTemp; -#else - MNG_ALLOC (pData, pICCP, sizeof (mng_ani_iccp)); - - pICCP->sHeader.fCleanup = mng_free_ani_iccp; - pICCP->sHeader.fProcess = mng_process_ani_iccp; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pICCP); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pICCP->bEmpty = bEmpty; - pICCP->iProfilesize = iProfilesize; - - if (iProfilesize) - { - MNG_ALLOC (pData, pICCP->pProfile, iProfilesize); - MNG_COPY (pICCP->pProfile, pProfile, iProfilesize); - } -#else - pICCP->bEmpty = ((mng_iccpp)pChunk)->bEmpty; - pICCP->iProfilesize = ((mng_iccpp)pChunk)->iProfilesize; - - if (pICCP->iProfilesize) - { - MNG_ALLOC (pData, pICCP->pProfile, pICCP->iProfilesize); - MNG_COPY (pICCP->pProfile, ((mng_iccpp)pChunk)->pProfile, pICCP->iProfilesize); - } -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_iccp (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_iccpp pICCP = (mng_ani_iccpp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ICCP, MNG_LC_START); -#endif - - if (pICCP->iProfilesize) - MNG_FREEX (pData, pICCP->pProfile, pICCP->iProfilesize); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_iccp)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ICCP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_iccp (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_iccpp pICCP = (mng_ani_iccpp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ICCP, MNG_LC_START); -#endif - - if (pICCP->bEmpty) /* empty chunk ? */ - { /* clear global iCCP */ - pData->bHasglobalICCP = MNG_FALSE; - - if (pData->iGlobalProfilesize) - MNG_FREEX (pData, pData->pGlobalProfile, pData->iGlobalProfilesize); - - pData->iGlobalProfilesize = 0; - pData->pGlobalProfile = MNG_NULL; - } - else - { /* set global iCCP */ - pData->bHasglobalICCP = MNG_TRUE; - pData->iGlobalProfilesize = pICCP->iProfilesize; - - if (pICCP->iProfilesize) - { - MNG_ALLOC (pData, pData->pGlobalProfile, pICCP->iProfilesize); - MNG_COPY (pData->pGlobalProfile, pICCP->pProfile, pICCP->iProfilesize); - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ICCP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_bkgd (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue) -#else -mng_retcode mng_create_ani_bkgd (mng_datap pData) -#endif -{ - mng_ptr pTemp; - mng_ani_bkgdp pBKGD; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BKGD, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_bkgd), - mng_free_obj_general, - mng_process_ani_bkgd, - &pTemp); - if (iRetcode) - return iRetcode; - pBKGD = (mng_ani_bkgdp)pTemp; -#else - MNG_ALLOC (pData, pBKGD, sizeof (mng_ani_bkgd)); - - pBKGD->sHeader.fCleanup = mng_free_ani_bkgd; - pBKGD->sHeader.fProcess = mng_process_ani_bkgd; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pBKGD); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pBKGD->iRed = iRed; - pBKGD->iGreen = iGreen; - pBKGD->iBlue = iBlue; -#else - pBKGD->iRed = pData->iGlobalBKGDred; - pBKGD->iGreen = pData->iGlobalBKGDgreen; - pBKGD->iBlue = pData->iGlobalBKGDblue; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_bkgd (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BKGD, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_bkgd)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_bkgd (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_bkgdp pBKGD = (mng_ani_bkgdp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BKGD, MNG_LC_START); -#endif - - pData->bHasglobalBKGD = MNG_TRUE; - pData->iGlobalBKGDred = pBKGD->iRed; - pData->iGlobalBKGDgreen = pBKGD->iGreen; - pData->iGlobalBKGDblue = pBKGD->iBlue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_LOOP -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_uint8 iLevel, - mng_uint32 iRepeatcount, - mng_uint8 iTermcond, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals) -#else -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_loopp pLOOP; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_LOOP, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_loop), - mng_free_ani_loop, - mng_process_ani_loop, - &pTemp); - if (iRetcode) - return iRetcode; - pLOOP = (mng_ani_loopp)pTemp; -#else - MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop)); - - pLOOP->sHeader.fCleanup = mng_free_ani_loop; - pLOOP->sHeader.fProcess = mng_process_ani_loop; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pLOOP); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pLOOP->iLevel = iLevel; - pLOOP->iRepeatcount = iRepeatcount; - pLOOP->iTermcond = iTermcond; - pLOOP->iItermin = iItermin; - pLOOP->iItermax = iItermax; - pLOOP->iCount = iCount; - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (iCount) - { - MNG_ALLOC (pData, pLOOP->pSignals, (iCount << 1)); - MNG_COPY (pLOOP->pSignals, pSignals, (iCount << 1)); - } -#endif -#else /* MNG_OPTIMIZE_CHUNKREADER */ - pLOOP->iLevel = ((mng_loopp)pChunk)->iLevel; - pLOOP->iRepeatcount = ((mng_loopp)pChunk)->iRepeat; - pLOOP->iTermcond = ((mng_loopp)pChunk)->iTermination; - pLOOP->iItermin = ((mng_loopp)pChunk)->iItermin; - pLOOP->iItermax = ((mng_loopp)pChunk)->iItermax; - pLOOP->iCount = ((mng_loopp)pChunk)->iCount; - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (pLOOP->iCount) - { - MNG_ALLOC (pData, pLOOP->pSignals, (pLOOP->iCount << 1)); - MNG_COPY (pLOOP->pSignals, ((mng_loopp)pChunk)->pSignals, (pLOOP->iCount << 1)); - } -#endif -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - /* running counter starts with repeat_count */ - pLOOP->iRunningcount = pLOOP->iRepeatcount; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_loop (mng_datap pData, - mng_objectp pObject) -{ -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - mng_ani_loopp pLOOP = (mng_ani_loopp)pObject; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_LOOP, MNG_LC_START); -#endif - -#ifndef MNG_NO_LOOP_SIGNALS_SUPPORTED - if (pLOOP->iCount) /* drop signal buffer ? */ - MNG_FREEX (pData, pLOOP->pSignals, (pLOOP->iCount << 1)); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_loop)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_LOOP, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_loop (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_loopp pLOOP = (mng_ani_loopp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_LOOP, MNG_LC_START); -#endif - /* just reset the running counter */ - pLOOP->iRunningcount = pLOOP->iRepeatcount; - /* iteration=0 means we're skipping ! */ - if ((!pData->bSkipping) && (pLOOP->iRepeatcount == 0)) - pData->bSkipping = MNG_TRUE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_LOOP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* ************************************************************************** */ - -mng_retcode mng_create_ani_endl (mng_datap pData, - mng_uint8 iLevel) -{ - mng_ani_endlp pENDL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ENDL, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { - mng_retcode iRetcode; -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_endl), - mng_free_obj_general, - mng_process_ani_endl, - &pTemp); - if (iRetcode) - return iRetcode; - pENDL = (mng_ani_endlp)pTemp; -#else - MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl)); - - pENDL->sHeader.fCleanup = mng_free_ani_endl; - pENDL->sHeader.fProcess = mng_process_ani_endl; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pENDL); - - pENDL->iLevel = iLevel; - - iRetcode = mng_process_ani_endl (pData, (mng_objectp)pENDL); - if (iRetcode) - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_endl (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ENDL, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_endl)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_endl (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_endlp pENDL = (mng_ani_endlp)pObject; - mng_ani_loopp pLOOP; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_START); -#endif - - if (((pData->bDisplaying) && ((pData->bRunning) || (pData->bSearching))) || - (pData->bReading) ) - { - pLOOP = pENDL->pLOOP; /* determine matching LOOP */ - - if (!pLOOP) /* haven't got it yet ? */ - { /* go and look back in the list */ - pLOOP = (mng_ani_loopp)pENDL->sHeader.pPrev; - - while ((pLOOP) && - ((pLOOP->sHeader.fCleanup != mng_free_ani_loop) || - (pLOOP->iLevel != pENDL->iLevel) )) - pLOOP = pLOOP->sHeader.pPrev; - } - /* got it now ? */ - if ((pLOOP) && (pLOOP->iLevel == pENDL->iLevel)) - { - pENDL->pLOOP = pLOOP; /* save for next time ! */ - /* decrease running counter ? */ - if ((pLOOP->iRunningcount) && (pLOOP->iRunningcount < 0x7fffffffL)) - pLOOP->iRunningcount--; - - if ((!pData->bDisplaying) && (pData->bReading) && - (pLOOP->iRunningcount >= 0x7fffffffL)) - { - pData->iTotalframes = 0x7fffffffL; - pData->iTotallayers = 0x7fffffffL; - pData->iTotalplaytime = 0x7fffffffL; - } - else - { - /* TODO: we're cheating out on the termination_condition, - iteration_min, iteration_max and possible signals; - the code is just not ready for that can of worms.... */ - - if (!pLOOP->iRunningcount) /* reached zero ? */ - { /* was this the outer LOOP ? */ - if (pData->pFirstaniobj == (mng_objectp)pLOOP) /* TODO: THIS IS WRONG!! */ - pData->bHasLOOP = MNG_FALSE; - } - else - { - if (pData->pCurraniobj) /* was we processing objects ? */ - pData->pCurraniobj = pLOOP;/* then restart with LOOP */ - else /* else restart behind LOOP !!! */ - pData->pCurraniobj = pLOOP->sHeader.pNext; - } - } - /* does this match a 'skipping' LOOP? */ - if ((pData->bSkipping) && (pLOOP->iRepeatcount == 0)) - pData->bSkipping = MNG_FALSE; - } - else - MNG_ERROR (pData, MNG_NOMATCHINGLOOP); - - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_ENDL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DEFI -mng_retcode mng_create_ani_defi (mng_datap pData) -{ - mng_ani_defip pDEFI; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DEFI, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_defi), - mng_free_obj_general, - mng_process_ani_defi, - &pTemp); - if (iRetcode) - return iRetcode; - pDEFI = (mng_ani_defip)pTemp; -#else - MNG_ALLOC (pData, pDEFI, sizeof (mng_ani_defi)); - - pDEFI->sHeader.fCleanup = mng_free_ani_defi; - pDEFI->sHeader.fProcess = mng_process_ani_defi; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pDEFI); - - pDEFI->iId = pData->iDEFIobjectid; - pDEFI->bHasdonotshow = pData->bDEFIhasdonotshow; - pDEFI->iDonotshow = pData->iDEFIdonotshow; - pDEFI->bHasconcrete = pData->bDEFIhasconcrete; - pDEFI->iConcrete = pData->iDEFIconcrete; - pDEFI->bHasloca = pData->bDEFIhasloca; - pDEFI->iLocax = pData->iDEFIlocax; - pDEFI->iLocay = pData->iDEFIlocay; - pDEFI->bHasclip = pData->bDEFIhasclip; - pDEFI->iClipl = pData->iDEFIclipl; - pDEFI->iClipr = pData->iDEFIclipr; - pDEFI->iClipt = pData->iDEFIclipt; - pDEFI->iClipb = pData->iDEFIclipb; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_defi (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DEFI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_defi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_defi (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_defip pDEFI = (mng_ani_defip)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DEFI, MNG_LC_START); -#endif - - pData->iDEFIobjectid = pDEFI->iId; - pData->bDEFIhasdonotshow = pDEFI->bHasdonotshow; - pData->iDEFIdonotshow = pDEFI->iDonotshow; - pData->bDEFIhasconcrete = pDEFI->bHasconcrete; - pData->iDEFIconcrete = pDEFI->iConcrete; - pData->bDEFIhasloca = pDEFI->bHasloca; - pData->iDEFIlocax = pDEFI->iLocax; - pData->iDEFIlocay = pDEFI->iLocay; - pData->bDEFIhasclip = pDEFI->bHasclip; - pData->iDEFIclipl = pDEFI->iClipl; - pData->iDEFIclipr = pDEFI->iClipr; - pData->iDEFIclipt = pDEFI->iClipt; - pData->iDEFIclipb = pDEFI->iClipb; - - iRetcode = mng_process_display_defi (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DEFI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BASI -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable) -#else -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_basip pBASI; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BASI, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_basi), - mng_free_obj_general, - mng_process_ani_basi, - &pTemp); - if (iRetcode) - return iRetcode; - pBASI = (mng_ani_basip)pTemp; -#else - MNG_ALLOC (pData, pBASI, sizeof (mng_ani_basi)); - - pBASI->sHeader.fCleanup = mng_free_ani_basi; - pBASI->sHeader.fProcess = mng_process_ani_basi; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pBASI); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pBASI->iRed = iRed; - pBASI->iGreen = iGreen; - pBASI->iBlue = iBlue; - pBASI->bHasalpha = bHasalpha; - pBASI->iAlpha = iAlpha; - pBASI->iViewable = iViewable; -#else - pBASI->iRed = ((mng_basip)pChunk)->iRed; - pBASI->iGreen = ((mng_basip)pChunk)->iGreen; - pBASI->iBlue = ((mng_basip)pChunk)->iBlue; - pBASI->bHasalpha = ((mng_basip)pChunk)->bHasalpha; - pBASI->iAlpha = ((mng_basip)pChunk)->iAlpha; - pBASI->iViewable = ((mng_basip)pChunk)->iViewable; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_basi (pData, iRed, iGreen, iBlue, - bHasalpha, iAlpha, iViewable); -#else - iRetcode = mng_process_display_basi (pData, - ((mng_basip)pChunk)->iRed, - ((mng_basip)pChunk)->iGreen, - ((mng_basip)pChunk)->iBlue, - ((mng_basip)pChunk)->bHasalpha, - ((mng_basip)pChunk)->iAlpha, - ((mng_basip)pChunk)->iViewable); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iBASIred = iRed; - pData->iBASIgreen = iGreen; - pData->iBASIblue = iBlue; - pData->bBASIhasalpha = bHasalpha; - pData->iBASIalpha = iAlpha; - pData->iBASIviewable = iViewable; -#else - pData->iBASIred = ((mng_basip)pChunk)->iRed; - pData->iBASIgreen = ((mng_basip)pChunk)->iGreen; - pData->iBASIblue = ((mng_basip)pChunk)->iBlue; - pData->bBASIhasalpha = ((mng_basip)pChunk)->bHasalpha; - pData->iBASIalpha = ((mng_basip)pChunk)->iAlpha; - pData->iBASIviewable = ((mng_basip)pChunk)->iViewable; -#endif - - iRetcode = mng_process_display_basi (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BASI, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_basi (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BASI, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_basi)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BASI, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_basi (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_basip pBASI = (mng_ani_basip)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BASI, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_basi (pData, pBASI->iRed, pBASI->iGreen, pBASI->iBlue, - pBASI->bHasalpha, pBASI->iAlpha, pBASI->iViewable); -#else - pData->iBASIred = pBASI->iRed; - pData->iBASIgreen = pBASI->iGreen; - pData->iBASIblue = pBASI->iBlue; - pData->bBASIhasalpha = pBASI->bHasalpha; - pData->iBASIalpha = pBASI->iAlpha; - pData->iBASIviewable = pBASI->iViewable; - - iRetcode = mng_process_display_basi (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BASI, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLON -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocatype, - mng_int32 iLocax, - mng_int32 iLocay) -#else -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_clonp pCLON; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLON, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_clon), - mng_free_obj_general, - mng_process_ani_clon, - &pTemp); - if (iRetcode) - return iRetcode; - pCLON = (mng_ani_clonp)pTemp; -#else - MNG_ALLOC (pData, pCLON, sizeof (mng_ani_clon)); - - pCLON->sHeader.fCleanup = mng_free_ani_clon; - pCLON->sHeader.fProcess = mng_process_ani_clon; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pCLON); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pCLON->iSourceid = iSourceid; - pCLON->iCloneid = iCloneid; - pCLON->iClonetype = iClonetype; - pCLON->bHasdonotshow = bHasdonotshow; - pCLON->iDonotshow = iDonotshow; - pCLON->iConcrete = iConcrete; - pCLON->bHasloca = bHasloca; - pCLON->iLocatype = iLocatype; - pCLON->iLocax = iLocax; - pCLON->iLocay = iLocay; -#else - pCLON->iSourceid = ((mng_clonp)pChunk)->iSourceid; - pCLON->iCloneid = ((mng_clonp)pChunk)->iCloneid; - pCLON->iClonetype = ((mng_clonp)pChunk)->iClonetype; - pCLON->bHasdonotshow = ((mng_clonp)pChunk)->bHasdonotshow; - pCLON->iDonotshow = ((mng_clonp)pChunk)->iDonotshow; - pCLON->iConcrete = ((mng_clonp)pChunk)->iConcrete; - pCLON->bHasloca = ((mng_clonp)pChunk)->bHasloca; - pCLON->iLocatype = ((mng_clonp)pChunk)->iLocationtype; - pCLON->iLocax = ((mng_clonp)pChunk)->iLocationx; - pCLON->iLocay = ((mng_clonp)pChunk)->iLocationy; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_clon (pData, iSourceid, iCloneid, iClonetype, - bHasdonotshow, iDonotshow, iConcrete, - bHasloca, iLocatype, iLocax, iLocay); -#else - iRetcode = mng_process_display_clon (pData, - ((mng_clonp)pChunk)->iSourceid, - ((mng_clonp)pChunk)->iCloneid, - ((mng_clonp)pChunk)->iClonetype, - ((mng_clonp)pChunk)->bHasdonotshow, - ((mng_clonp)pChunk)->iDonotshow, - ((mng_clonp)pChunk)->iConcrete, - ((mng_clonp)pChunk)->bHasloca, - ((mng_clonp)pChunk)->iLocationtype, - ((mng_clonp)pChunk)->iLocationx, - ((mng_clonp)pChunk)->iLocationy); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iCLONsourceid = iSourceid; - pData->iCLONcloneid = iCloneid; - pData->iCLONclonetype = iClonetype; - pData->bCLONhasdonotshow = bHasdonotshow; - pData->iCLONdonotshow = iDonotshow; - pData->iCLONconcrete = iConcrete; - pData->bCLONhasloca = bHasloca; - pData->iCLONlocationtype = iLocatype; - pData->iCLONlocationx = iLocax; - pData->iCLONlocationy = iLocay; -#else - pData->iCLONsourceid = ((mng_clonp)pChunk)->iSourceid; - pData->iCLONcloneid = ((mng_clonp)pChunk)->iCloneid; - pData->iCLONclonetype = ((mng_clonp)pChunk)->iClonetype; - pData->bCLONhasdonotshow = ((mng_clonp)pChunk)->bHasdonotshow; - pData->iCLONdonotshow = ((mng_clonp)pChunk)->iDonotshow; - pData->iCLONconcrete = ((mng_clonp)pChunk)->iConcrete; - pData->bCLONhasloca = ((mng_clonp)pChunk)->bHasloca; - pData->iCLONlocationtype = ((mng_clonp)pChunk)->iLocationtype; - pData->iCLONlocationx = ((mng_clonp)pChunk)->iLocationx; - pData->iCLONlocationy = ((mng_clonp)pChunk)->iLocationy; -#endif - - iRetcode = mng_process_display_clon (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLON, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_clon (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLON, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_clon)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLON, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_clon (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_clonp pCLON = (mng_ani_clonp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLON, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_clon (pData, pCLON->iSourceid, pCLON->iCloneid, - pCLON->iClonetype, pCLON->bHasdonotshow, - pCLON->iDonotshow, pCLON->iConcrete, - pCLON->bHasloca, pCLON->iLocatype, - pCLON->iLocax, pCLON->iLocay); -#else - pData->iCLONcloneid = pCLON->iCloneid; - pData->iCLONsourceid = pCLON->iSourceid; - pData->iCLONclonetype = pCLON->iClonetype; - pData->bCLONhasdonotshow = pCLON->bHasdonotshow; - pData->iCLONdonotshow = pCLON->iDonotshow; - pData->iCLONconcrete = pCLON->iConcrete; - pData->bCLONhasloca = pCLON->bHasloca; - pData->iCLONlocationtype = pCLON->iLocatype; - pData->iCLONlocationx = pCLON->iLocax; - pData->iCLONlocationy = pCLON->iLocay; - - iRetcode = mng_process_display_clon (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLON, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_BACK -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_back (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile) -#else -mng_retcode mng_create_ani_back (mng_datap pData) -#endif -{ - mng_ani_backp pBACK; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BACK, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_back), - mng_free_obj_general, - mng_process_ani_back, - &pTemp); - if (iRetcode) - return iRetcode; - pBACK = (mng_ani_backp)pTemp; -#else - MNG_ALLOC (pData, pBACK, sizeof (mng_ani_back)); - - pBACK->sHeader.fCleanup = mng_free_ani_back; - pBACK->sHeader.fProcess = mng_process_ani_back; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pBACK); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pBACK->iRed = iRed; - pBACK->iGreen = iGreen; - pBACK->iBlue = iBlue; - pBACK->iMandatory = iMandatory; - pBACK->iImageid = iImageid; - pBACK->iTile = iTile; -#else - pBACK->iRed = pData->iBACKred; - pBACK->iGreen = pData->iBACKgreen; - pBACK->iBlue = pData->iBACKblue; - pBACK->iMandatory = pData->iBACKmandatory; - pBACK->iImageid = pData->iBACKimageid; - pBACK->iTile = pData->iBACKtile; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_back (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BACK, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_back)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_back (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_backp pBACK = (mng_ani_backp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BACK, MNG_LC_START); -#endif - - pData->iBACKred = pBACK->iRed; - pData->iBACKgreen = pBACK->iGreen; - pData->iBACKblue = pBACK->iBlue; - pData->iBACKmandatory = pBACK->iMandatory; - pData->iBACKimageid = pBACK->iImageid; - pData->iBACKtile = pBACK->iTile; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_BACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_FRAM -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_framp pFRAM; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_FRAM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_fram), - mng_free_obj_general, - mng_process_ani_fram, - &pTemp); - if (iRetcode) - return iRetcode; - pFRAM = (mng_ani_framp)pTemp; -#else - MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram)); - - pFRAM->sHeader.fCleanup = mng_free_ani_fram; - pFRAM->sHeader.fProcess = mng_process_ani_fram; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pFRAM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pFRAM->iFramemode = iFramemode; - pFRAM->iChangedelay = iChangedelay; - pFRAM->iDelay = iDelay; - pFRAM->iChangetimeout = iChangetimeout; - pFRAM->iTimeout = iTimeout; - pFRAM->iChangeclipping = iChangeclipping; - pFRAM->iCliptype = iCliptype; - pFRAM->iClipl = iClipl; - pFRAM->iClipr = iClipr; - pFRAM->iClipt = iClipt; - pFRAM->iClipb = iClipb; -#else - pFRAM->iFramemode = ((mng_framp)pChunk)->iMode; - pFRAM->iChangedelay = ((mng_framp)pChunk)->iChangedelay; - pFRAM->iDelay = ((mng_framp)pChunk)->iDelay; - pFRAM->iChangetimeout = ((mng_framp)pChunk)->iChangetimeout; - pFRAM->iTimeout = ((mng_framp)pChunk)->iTimeout; - pFRAM->iChangeclipping = ((mng_framp)pChunk)->iChangeclipping; - pFRAM->iCliptype = ((mng_framp)pChunk)->iBoundarytype; - pFRAM->iClipl = ((mng_framp)pChunk)->iBoundaryl; - pFRAM->iClipr = ((mng_framp)pChunk)->iBoundaryr; - pFRAM->iClipt = ((mng_framp)pChunk)->iBoundaryt; - pFRAM->iClipb = ((mng_framp)pChunk)->iBoundaryb; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_fram (pData, iFramemode, - iChangedelay, iDelay, - iChangetimeout, iTimeout, - iChangeclipping, iCliptype, - iClipl, iClipr, - iClipt, iClipb); -#else - iRetcode = mng_process_display_fram (pData, - ((mng_framp)pChunk)->iMode, - ((mng_framp)pChunk)->iChangedelay, - ((mng_framp)pChunk)->iDelay, - ((mng_framp)pChunk)->iChangetimeout, - ((mng_framp)pChunk)->iTimeout, - ((mng_framp)pChunk)->iChangeclipping, - ((mng_framp)pChunk)->iBoundarytype, - ((mng_framp)pChunk)->iBoundaryl, - ((mng_framp)pChunk)->iBoundaryr, - ((mng_framp)pChunk)->iBoundaryt, - ((mng_framp)pChunk)->iBoundaryb); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iTempFramemode = iFramemode; - pData->iTempChangedelay = iChangedelay; - pData->iTempDelay = iDelay; - pData->iTempChangetimeout = iChangetimeout; - pData->iTempTimeout = iTimeout; - pData->iTempChangeclipping = iChangeclipping; - pData->iTempCliptype = iCliptype; - pData->iTempClipl = iClipl; - pData->iTempClipr = iClipr; - pData->iTempClipt = iClipt; - pData->iTempClipb = iClipb; -#else - pData->iTempFramemode = ((mng_framp)pChunk)->iMode; - pData->iTempChangedelay = ((mng_framp)pChunk)->iChangedelay; - pData->iTempDelay = ((mng_framp)pChunk)->iDelay; - pData->iTempChangetimeout = ((mng_framp)pChunk)->iChangetimeout; - pData->iTempTimeout = ((mng_framp)pChunk)->iTimeout; - pData->iTempChangeclipping = ((mng_framp)pChunk)->iChangeclipping; - pData->iTempCliptype = ((mng_framp)pChunk)->iBoundarytype; - pData->iTempClipl = ((mng_framp)pChunk)->iBoundaryl; - pData->iTempClipr = ((mng_framp)pChunk)->iBoundaryr; - pData->iTempClipt = ((mng_framp)pChunk)->iBoundaryt; - pData->iTempClipb = ((mng_framp)pChunk)->iBoundaryb; -#endif - - iRetcode = mng_process_display_fram (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_fram (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_FRAM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_fram)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_FRAM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_fram (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_framp pFRAM = (mng_ani_framp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_FRAM, MNG_LC_START); -#endif - - if (pData->iBreakpoint) /* previously broken ? */ - { - iRetcode = mng_process_display_fram2 (pData); - pData->iBreakpoint = 0; /* not again */ - } - else - { -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_fram (pData, pFRAM->iFramemode, - pFRAM->iChangedelay, pFRAM->iDelay, - pFRAM->iChangetimeout, pFRAM->iTimeout, - pFRAM->iChangeclipping, pFRAM->iCliptype, - pFRAM->iClipl, pFRAM->iClipr, - pFRAM->iClipt, pFRAM->iClipb); -#else - pData->iTempFramemode = pFRAM->iFramemode; - pData->iTempChangedelay = pFRAM->iChangedelay; - pData->iTempDelay = pFRAM->iDelay; - pData->iTempChangetimeout = pFRAM->iChangetimeout; - pData->iTempTimeout = pFRAM->iTimeout; - pData->iTempChangeclipping = pFRAM->iChangeclipping; - pData->iTempCliptype = pFRAM->iCliptype; - pData->iTempClipl = pFRAM->iClipl; - pData->iTempClipr = pFRAM->iClipr; - pData->iTempClipt = pFRAM->iClipt; - pData->iTempClipb = pFRAM->iClipb; - - iRetcode = mng_process_display_fram (pData); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_FRAM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MOVE -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_move (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iLocax, - mng_int32 iLocay) -#else -mng_retcode mng_create_ani_move (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_movep pMOVE; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MOVE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_move), - mng_free_obj_general, - mng_process_ani_move, - &pTemp); - if (iRetcode) - return iRetcode; - pMOVE = (mng_ani_movep)pTemp; -#else - MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move)); - - pMOVE->sHeader.fCleanup = mng_free_ani_move; - pMOVE->sHeader.fProcess = mng_process_ani_move; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pMOVE); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pMOVE->iFirstid = iFirstid; - pMOVE->iLastid = iLastid; - pMOVE->iType = iType; - pMOVE->iLocax = iLocax; - pMOVE->iLocay = iLocay; -#else - pMOVE->iFirstid = ((mng_movep)pChunk)->iFirstid; - pMOVE->iLastid = ((mng_movep)pChunk)->iLastid; - pMOVE->iType = ((mng_movep)pChunk)->iMovetype; - pMOVE->iLocax = ((mng_movep)pChunk)->iMovex; - pMOVE->iLocay = ((mng_movep)pChunk)->iMovey; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_move (pData, iFirstid, iLastid, - iType, iLocax, iLocay); -#else - iRetcode = mng_process_display_move (pData, - ((mng_movep)pChunk)->iFirstid, - ((mng_movep)pChunk)->iLastid, - ((mng_movep)pChunk)->iMovetype, - ((mng_movep)pChunk)->iMovex, - ((mng_movep)pChunk)->iMovey); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iMOVEfromid = iFirstid; - pData->iMOVEtoid = iLastid; - pData->iMOVEmovetype = iType; - pData->iMOVEmovex = iLocax; - pData->iMOVEmovey = iLocay; -#else - pData->iMOVEfromid = ((mng_movep)pChunk)->iFirstid; - pData->iMOVEtoid = ((mng_movep)pChunk)->iLastid; - pData->iMOVEmovetype = ((mng_movep)pChunk)->iMovetype; - pData->iMOVEmovex = ((mng_movep)pChunk)->iMovex; - pData->iMOVEmovey = ((mng_movep)pChunk)->iMovey; -#endif - - iRetcode = mng_process_display_move (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MOVE, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_move (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MOVE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_move)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MOVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_move (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - mng_ani_movep pMOVE = (mng_ani_movep)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MOVE, MNG_LC_START); -#endif - /* re-process the MOVE chunk */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_move (pData, pMOVE->iFirstid, pMOVE->iLastid, - pMOVE->iType, pMOVE->iLocax, pMOVE->iLocay); -#else - pData->iMOVEfromid = pMOVE->iFirstid; - pData->iMOVEtoid = pMOVE->iLastid; - pData->iMOVEmovetype = pMOVE->iType; - pData->iMOVEmovex = pMOVE->iLocax; - pData->iMOVEmovey = pMOVE->iLocay; - - iRetcode = mng_process_display_move (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MOVE, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_CLIP -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb) -#else -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_clipp pCLIP; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLIP, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_clip), - mng_free_obj_general, - mng_process_ani_clip, - &pTemp); - if (iRetcode) - return iRetcode; - pCLIP = (mng_ani_clipp)pTemp; -#else - MNG_ALLOC (pData, pCLIP, sizeof (mng_ani_clip)); - - pCLIP->sHeader.fCleanup = mng_free_ani_clip; - pCLIP->sHeader.fProcess = mng_process_ani_clip; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pCLIP); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pCLIP->iFirstid = iFirstid; - pCLIP->iLastid = iLastid; - pCLIP->iType = iType; - pCLIP->iClipl = iClipl; - pCLIP->iClipr = iClipr; - pCLIP->iClipt = iClipt; - pCLIP->iClipb = iClipb; -#else - pCLIP->iFirstid = ((mng_clipp)pChunk)->iFirstid; - pCLIP->iLastid = ((mng_clipp)pChunk)->iLastid; - pCLIP->iType = ((mng_clipp)pChunk)->iCliptype; - pCLIP->iClipl = ((mng_clipp)pChunk)->iClipl; - pCLIP->iClipr = ((mng_clipp)pChunk)->iClipr; - pCLIP->iClipt = ((mng_clipp)pChunk)->iClipt; - pCLIP->iClipb = ((mng_clipp)pChunk)->iClipb; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_clip (pData, iFirstid, iLastid, - iType, iClipl, iClipr, - iClipt, iClipb); -#else - iRetcode = mng_process_display_clip (pData, - ((mng_clipp)pChunk)->iFirstid, - ((mng_clipp)pChunk)->iLastid, - ((mng_clipp)pChunk)->iCliptype, - ((mng_clipp)pChunk)->iClipl, - ((mng_clipp)pChunk)->iClipr, - ((mng_clipp)pChunk)->iClipt, - ((mng_clipp)pChunk)->iClipb); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iCLIPfromid = iFirstid; - pData->iCLIPtoid = iLastid; - pData->iCLIPcliptype = iType; - pData->iCLIPclipl = iClipl; - pData->iCLIPclipr = iClipr; - pData->iCLIPclipt = iClipt; - pData->iCLIPclipb = iClipb; -#else - pData->iCLIPfromid = ((mng_clipp)pChunk)->iFirstid; - pData->iCLIPtoid = ((mng_clipp)pChunk)->iLastid; - pData->iCLIPcliptype = ((mng_clipp)pChunk)->iCliptype; - pData->iCLIPclipl = ((mng_clipp)pChunk)->iClipl; - pData->iCLIPclipr = ((mng_clipp)pChunk)->iClipr; - pData->iCLIPclipt = ((mng_clipp)pChunk)->iClipt; - pData->iCLIPclipb = ((mng_clipp)pChunk)->iClipb; -#endif - - iRetcode = mng_process_display_clip (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_CLIP, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_clip (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLIP, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_clip)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_CLIP, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_clip (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - mng_ani_clipp pCLIP = (mng_ani_clipp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLIP, MNG_LC_START); -#endif - /* re-process the CLIP chunk */ -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_clip (pData, pCLIP->iFirstid, pCLIP->iLastid, - pCLIP->iType, pCLIP->iClipl, pCLIP->iClipr, - pCLIP->iClipt, pCLIP->iClipb); -#else - pData->iCLIPfromid = pCLIP->iFirstid; - pData->iCLIPtoid = pCLIP->iLastid; - pData->iCLIPcliptype = pCLIP->iType; - pData->iCLIPclipl = pCLIP->iClipl; - pData->iCLIPclipr = pCLIP->iClipr; - pData->iCLIPclipt = pCLIP->iClipt; - pData->iCLIPclipb = pCLIP->iClipb; - - iRetcode = mng_process_display_clip (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_CLIP, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SHOW -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_show (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode) -#else -mng_retcode mng_create_ani_show (mng_datap pData) -#endif -{ - mng_ani_showp pSHOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SHOW, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_show), - mng_free_obj_general, - mng_process_ani_show, - &pTemp); - if (iRetcode) - return iRetcode; - pSHOW = (mng_ani_showp)pTemp; -#else - MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show)); - - pSHOW->sHeader.fCleanup = mng_free_ani_show; - pSHOW->sHeader.fProcess = mng_process_ani_show; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSHOW); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pSHOW->iFirstid = iFirstid; - pSHOW->iLastid = iLastid; - pSHOW->iMode = iMode; -#else - pSHOW->iFirstid = pData->iSHOWfromid; - pSHOW->iLastid = pData->iSHOWtoid; - pSHOW->iMode = pData->iSHOWmode; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_show (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SHOW, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_show)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SHOW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_show (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - mng_ani_showp pSHOW = (mng_ani_showp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SHOW, MNG_LC_START); -#endif - - if (pData->iBreakpoint) /* returning from breakpoint ? */ - { - iRetcode = mng_process_display_show (pData); - } - else - { /* "re-run" SHOW chunk */ - pData->iSHOWmode = pSHOW->iMode; - pData->iSHOWfromid = pSHOW->iFirstid; - pData->iSHOWtoid = pSHOW->iLastid; - - iRetcode = mng_process_display_show (pData); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SHOW, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_TERM -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_term (mng_datap pData, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax) -#else -mng_retcode mng_create_ani_term (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_termp pTERM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TERM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_term), - mng_free_obj_general, - mng_process_ani_term, - &pTemp); - if (iRetcode) - return iRetcode; - pTERM = (mng_ani_termp)pTemp; -#else - MNG_ALLOC (pData, pTERM, sizeof (mng_ani_term)); - - pTERM->sHeader.fCleanup = mng_free_ani_term; - pTERM->sHeader.fProcess = mng_process_ani_term; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pTERM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pTERM->iTermaction = iTermaction; - pTERM->iIteraction = iIteraction; - pTERM->iDelay = iDelay; - pTERM->iItermax = iItermax; -#else - pTERM->iTermaction = ((mng_termp)pChunk)->iTermaction; - pTERM->iIteraction = ((mng_termp)pChunk)->iIteraction; - pTERM->iDelay = ((mng_termp)pChunk)->iDelay; - pTERM->iItermax = ((mng_termp)pChunk)->iItermax; -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_term (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TERM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_term)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_term (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TERM, MNG_LC_START); -#endif - - /* dummy: no action required! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_TERM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_create_ani_save (mng_datap pData) -{ - mng_ptr pTemp; - mng_ani_savep pSAVE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SAVE, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_save), - mng_free_obj_general, - mng_process_ani_save, - &pTemp); - if (iRetcode) - return iRetcode; - pSAVE = (mng_ani_savep)pTemp; -#else - MNG_ALLOC (pData, pSAVE, sizeof (mng_ani_save)); - - pSAVE->sHeader.fCleanup = mng_free_ani_save; - pSAVE->sHeader.fProcess = mng_process_ani_save; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSAVE); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_save (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SAVE, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_save)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_save (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SAVE, MNG_LC_START); -#endif - - iRetcode = mng_process_display_save (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SAVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_SEEK -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname) -#else -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ptr pTemp; - mng_ani_seekp pSEEK; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SEEK, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_seek), - mng_free_ani_seek, - mng_process_ani_seek, - &pTemp); - if (iRetcode) - return iRetcode; - pSEEK = (mng_ani_seekp)pTemp; -#else - MNG_ALLOC (pData, pSEEK, sizeof (mng_ani_seek)); - - pSEEK->sHeader.fCleanup = mng_free_ani_seek; - pSEEK->sHeader.fProcess = mng_process_ani_seek; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSEEK); - - pData->pLastseek = (mng_objectp)pSEEK; - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pSEEK->iSegmentnamesize = iSegmentnamesize; - if (iSegmentnamesize) - { - MNG_ALLOC (pData, pSEEK->zSegmentname, iSegmentnamesize + 1); - MNG_COPY (pSEEK->zSegmentname, zSegmentname, iSegmentnamesize); - } -#else - pSEEK->iSegmentnamesize = ((mng_seekp)pChunk)->iNamesize; - if (pSEEK->iSegmentnamesize) - { - MNG_ALLOC (pData, pSEEK->zSegmentname, pSEEK->iSegmentnamesize + 1); - MNG_COPY (pSEEK->zSegmentname, ((mng_seekp)pChunk)->zName, pSEEK->iSegmentnamesize); - } -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_seek (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_seekp pSEEK = (mng_ani_seekp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SEEK, MNG_LC_START); -#endif - - if (pSEEK->iSegmentnamesize) - MNG_FREEX (pData, pSEEK->zSegmentname, pSEEK->iSegmentnamesize + 1); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_seek)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_SEEK, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_seek (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_seekp pSEEK = (mng_ani_seekp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SEEK, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DYNAMICMNG - if (!pData->bStopafterseek) /* can we really process this one ? */ -#endif - { - pData->pLastseek = pObject; - - if (pData->fProcessseek) /* inform the app ? */ - { - mng_bool bOke; - mng_pchar zName; - - MNG_ALLOC (pData, zName, pSEEK->iSegmentnamesize + 1); - - if (pSEEK->iSegmentnamesize) - MNG_COPY (zName, pSEEK->zSegmentname, pSEEK->iSegmentnamesize); - - bOke = pData->fProcessseek ((mng_handle)pData, zName); - - MNG_FREEX (pData, zName, pSEEK->iSegmentnamesize + 1); - - if (!bOke) - MNG_ERROR (pData, MNG_APPMISCERROR); - } - } - - iRetcode = mng_process_display_seek (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_SEEK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky) -#else -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_dhdrp pDHDR; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DHDR, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_dhdr), - mng_free_obj_general, - mng_process_ani_dhdr, - &pTemp); - if (iRetcode) - return iRetcode; - pDHDR = (mng_ani_dhdrp)pTemp; -#else - MNG_ALLOC (pData, pDHDR, sizeof (mng_ani_dhdr)); - - pDHDR->sHeader.fCleanup = mng_free_ani_dhdr; - pDHDR->sHeader.fProcess = mng_process_ani_dhdr; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pDHDR); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pDHDR->iObjectid = iObjectid; - pDHDR->iImagetype = iImagetype; - pDHDR->iDeltatype = iDeltatype; - pDHDR->iBlockwidth = iBlockwidth; - pDHDR->iBlockheight = iBlockheight; - pDHDR->iBlockx = iBlockx; - pDHDR->iBlocky = iBlocky; -#else - pDHDR->iObjectid = ((mng_dhdrp)pChunk)->iObjectid; - pDHDR->iImagetype = ((mng_dhdrp)pChunk)->iImagetype; - pDHDR->iDeltatype = ((mng_dhdrp)pChunk)->iDeltatype; - pDHDR->iBlockwidth = ((mng_dhdrp)pChunk)->iBlockwidth; - pDHDR->iBlockheight = ((mng_dhdrp)pChunk)->iBlockheight; - pDHDR->iBlockx = ((mng_dhdrp)pChunk)->iBlockx; - pDHDR->iBlocky = ((mng_dhdrp)pChunk)->iBlocky; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_dhdr (pData, iObjectid, - iImagetype, iDeltatype, - iBlockwidth, iBlockheight, - iBlockx, iBlocky); -#else - iRetcode = mng_process_display_dhdr (pData, - ((mng_dhdrp)pChunk)->iObjectid, - ((mng_dhdrp)pChunk)->iImagetype, - ((mng_dhdrp)pChunk)->iDeltatype, - ((mng_dhdrp)pChunk)->iBlockwidth, - ((mng_dhdrp)pChunk)->iBlockheight, - ((mng_dhdrp)pChunk)->iBlockx, - ((mng_dhdrp)pChunk)->iBlocky); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iDHDRobjectid = iObjectid; - pData->iDHDRimagetype = iImagetype; - pData->iDHDRdeltatype = iDeltatype; - pData->iDHDRblockwidth = iBlockwidth; - pData->iDHDRblockheight = iBlockheight; - pData->iDHDRblockx = iBlockx; - pData->iDHDRblocky = iBlocky; -#else - pData->iDHDRobjectid = ((mng_dhdrp)pChunk)->iObjectid; - pData->iDHDRimagetype = ((mng_dhdrp)pChunk)->iImagetype; - pData->iDHDRdeltatype = ((mng_dhdrp)pChunk)->iDeltatype; - pData->iDHDRblockwidth = ((mng_dhdrp)pChunk)->iBlockwidth; - pData->iDHDRblockheight = ((mng_dhdrp)pChunk)->iBlockheight; - pData->iDHDRblockx = ((mng_dhdrp)pChunk)->iBlockx; - pData->iDHDRblocky = ((mng_dhdrp)pChunk)->iBlocky; -#endif - - iRetcode = mng_process_display_dhdr (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DHDR, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_dhdr (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DHDR, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_dhdr)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DHDR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_dhdr (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_dhdrp pDHDR = (mng_ani_dhdrp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DHDR, MNG_LC_START); -#endif - - pData->bHasDHDR = MNG_TRUE; /* let everyone know we're inside a DHDR */ - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_dhdr (pData, pDHDR->iObjectid, - pDHDR->iImagetype, pDHDR->iDeltatype, - pDHDR->iBlockwidth, pDHDR->iBlockheight, - pDHDR->iBlockx, pDHDR->iBlocky); -#else - pData->iDHDRobjectid = pDHDR->iObjectid; - pData->iDHDRimagetype = pDHDR->iImagetype; - pData->iDHDRdeltatype = pDHDR->iDeltatype; - pData->iDHDRblockwidth = pDHDR->iBlockwidth; - pData->iDHDRblockheight = pDHDR->iBlockheight; - pData->iDHDRblockx = pDHDR->iBlockx; - pData->iDHDRblocky = pDHDR->iBlocky; - - iRetcode = mng_process_display_dhdr (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DHDR, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype) -#else -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_promp pPROM=NULL; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PROM, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_prom), - mng_free_obj_general, - mng_process_ani_prom, - &pTemp); - if (iRetcode) - return iRetcode; - pPROM = (mng_ani_promp)pTemp; -#else - MNG_ALLOC (pData, pPROM, sizeof (mng_ani_prom)); - - pPROM->sHeader.fCleanup = mng_free_ani_prom; - pPROM->sHeader.fProcess = mng_process_ani_prom; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pPROM); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pPROM->iBitdepth = iBitdepth; - pPROM->iColortype = iColortype; - pPROM->iFilltype = iFilltype; -#else - pPROM->iBitdepth = ((mng_promp)pChunk)->iSampledepth; - pPROM->iColortype = ((mng_promp)pChunk)->iColortype; - pPROM->iFilltype = ((mng_promp)pChunk)->iFilltype; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_prom (pData, iBitdepth, - iColortype, iFilltype); -#else - iRetcode = mng_process_display_prom (pData, - ((mng_promp)pChunk)->iSampledepth, - ((mng_promp)pChunk)->iColortype, - ((mng_promp)pChunk)->iFilltype); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iPROMbitdepth = iBitdepth; - pData->iPROMcolortype = iColortype; - pData->iPROMfilltype = iFilltype; -#else - pData->iPROMbitdepth = ((mng_promp)pChunk)->iSampledepth; - pData->iPROMcolortype = ((mng_promp)pChunk)->iColortype; - pData->iPROMfilltype = ((mng_promp)pChunk)->iFilltype; -#endif - - iRetcode = mng_process_display_prom (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PROM, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_prom (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PROM, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_prom)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PROM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_prom (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_promp pPROM = (mng_ani_promp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PROM, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_prom (pData, pPROM->iBitdepth, - pPROM->iColortype, pPROM->iFilltype); -#else - pData->iPROMbitdepth = pPROM->iBitdepth; - pData->iPROMcolortype = pPROM->iColortype; - pData->iPROMfilltype = pPROM->iFilltype; - - iRetcode = mng_process_display_prom (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PROM, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_ipng (mng_datap pData) -{ - mng_ani_ipngp pIPNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IPNG, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_ipng), - mng_free_obj_general, - mng_process_ani_ipng, - &pTemp); - if (iRetcode) - return iRetcode; - pIPNG = (mng_ani_ipngp)pTemp; -#else - MNG_ALLOC (pData, pIPNG, sizeof (mng_ani_ipng)); - - pIPNG->sHeader.fCleanup = mng_free_ani_ipng; - pIPNG->sHeader.fProcess = mng_process_ani_ipng; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pIPNG); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_ipng (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IPNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_ipng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_ipng (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IPNG, MNG_LC_START); -#endif - - iRetcode = mng_process_display_ipng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IPNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_create_ani_ijng (mng_datap pData) -{ - mng_ani_ijngp pIJNG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IJNG, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_ani_ijng), - mng_free_obj_general, - mng_process_ani_ijng, - &pTemp); - if (iRetcode) - return iRetcode; - pIJNG = (mng_ani_ijngp)pTemp; -#else - MNG_ALLOC (pData, pIJNG, sizeof (mng_ani_ijng)); - - pIJNG->sHeader.fCleanup = mng_free_ani_ijng; - pIJNG->sHeader.fProcess = mng_process_ani_ijng; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pIJNG); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_ijng (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IJNG, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_ijng)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_ijng (mng_datap pData, - mng_objectp pObject) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IJNG, MNG_LC_START); -#endif - - iRetcode = mng_process_display_ijng (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_IJNG, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries) -{ - mng_ani_ppltp pPPLT; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_pplt), - mng_free_obj_general, - mng_process_ani_pplt, - &pTemp); - if (iRetcode) - return iRetcode; - pPPLT = (mng_ani_ppltp)pTemp; -#else - MNG_ALLOC (pData, pPPLT, sizeof (mng_ani_pplt)); - - pPPLT->sHeader.fCleanup = mng_free_ani_pplt; - pPPLT->sHeader.fProcess = mng_process_ani_pplt; -#endif - - pPPLT->iType = iType; - pPPLT->iCount = iCount; - - MNG_COPY (pPPLT->aIndexentries, paIndexentries, sizeof (pPPLT->aIndexentries)); - MNG_COPY (pPPLT->aAlphaentries, paAlphaentries, sizeof (pPPLT->aAlphaentries)); - MNG_COPY (pPPLT->aUsedentries, paUsedentries, sizeof (pPPLT->aUsedentries )); - - mng_add_ani_object (pData, (mng_object_headerp)pPPLT); - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_pplt (pData, iType, iCount, - paIndexentries, paAlphaentries, paUsedentries); -#else - pData->iPPLTtype = iType; - pData->iPPLTcount = iCount; - pData->paPPLTindexentries = paIndexentries; - pData->paPPLTalphaentries = paAlphaentries; - pData->paPPLTusedentries = paUsedentries; - - iRetcode = mng_process_display_pplt (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PPLT, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_pplt (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_pplt)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PPLT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_pplt (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_ppltp pPPLT = (mng_ani_ppltp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_pplt (pData, pPPLT->iType, pPPLT->iCount, - pPPLT->aIndexentries, pPPLT->aAlphaentries, - pPPLT->aUsedentries); -#else - pData->iPPLTtype = pPPLT->iType; - pData->iPPLTcount = pPPLT->iCount; - pData->paPPLTindexentries = &pPPLT->aIndexentries; - pData->paPPLTalphaentries = &pPPLT->aAlphaentries; - pData->paPPLTusedentries = &pPPLT->aUsedentries; - - iRetcode = mng_process_display_pplt (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PPLT, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY) -#else -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_magnp pMAGN=NULL; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_magn), - mng_free_obj_general, - mng_process_ani_magn, - &pTemp); - if (iRetcode) - return iRetcode; - pMAGN = (mng_ani_magnp)pTemp; -#else - MNG_ALLOC (pData, pMAGN, sizeof (mng_ani_magn)); - - pMAGN->sHeader.fCleanup = mng_free_ani_magn; - pMAGN->sHeader.fProcess = mng_process_ani_magn; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pMAGN); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pMAGN->iFirstid = iFirstid; - pMAGN->iLastid = iLastid; - pMAGN->iMethodX = iMethodX; - pMAGN->iMX = iMX; - pMAGN->iMY = iMY; - pMAGN->iML = iML; - pMAGN->iMR = iMR; - pMAGN->iMT = iMT; - pMAGN->iMB = iMB; - pMAGN->iMethodY = iMethodY; -#else - pMAGN->iFirstid = ((mng_magnp)pChunk)->iFirstid; - pMAGN->iLastid = ((mng_magnp)pChunk)->iLastid; - pMAGN->iMethodX = ((mng_magnp)pChunk)->iMethodX; - pMAGN->iMX = ((mng_magnp)pChunk)->iMX; - pMAGN->iMY = ((mng_magnp)pChunk)->iMY; - pMAGN->iML = ((mng_magnp)pChunk)->iML; - pMAGN->iMR = ((mng_magnp)pChunk)->iMR; - pMAGN->iMT = ((mng_magnp)pChunk)->iMT; - pMAGN->iMB = ((mng_magnp)pChunk)->iMB; - pMAGN->iMethodY = ((mng_magnp)pChunk)->iMethodY; -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_magn (pData, pMAGN->iFirstid, pMAGN->iLastid, - pMAGN->iMethodX, pMAGN->iMX, pMAGN->iMY, - pMAGN->iML, pMAGN->iMR, pMAGN->iMT, - pMAGN->iMB, pMAGN->iMethodY); -#else - iRetcode = mng_process_display_magn (pData, - ((mng_magnp)pChunk)->iFirstid, - ((mng_magnp)pChunk)->iLastid, - ((mng_magnp)pChunk)->iMethodX, - ((mng_magnp)pChunk)->iMX, - ((mng_magnp)pChunk)->iMY, - ((mng_magnp)pChunk)->iML, - ((mng_magnp)pChunk)->iMR, - ((mng_magnp)pChunk)->iMT, - ((mng_magnp)pChunk)->iMB, - ((mng_magnp)pChunk)->iMethodY); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iMAGNfirstid = iFirstid; - pData->iMAGNlastid = iLastid; - pData->iMAGNmethodX = iMethodX; - pData->iMAGNmX = iMX; - pData->iMAGNmY = iMY; - pData->iMAGNmL = iML; - pData->iMAGNmR = iMR; - pData->iMAGNmT = iMT; - pData->iMAGNmB = iMB; - pData->iMAGNmethodY = iMethodY; -#else - pData->iMAGNfirstid = ((mng_magnp)pChunk)->iFirstid; - pData->iMAGNlastid = ((mng_magnp)pChunk)->iLastid; - pData->iMAGNmethodX = ((mng_magnp)pChunk)->iMethodX; - pData->iMAGNmX = ((mng_magnp)pChunk)->iMX; - pData->iMAGNmY = ((mng_magnp)pChunk)->iMY; - pData->iMAGNmL = ((mng_magnp)pChunk)->iML; - pData->iMAGNmR = ((mng_magnp)pChunk)->iMR; - pData->iMAGNmT = ((mng_magnp)pChunk)->iMT; - pData->iMAGNmB = ((mng_magnp)pChunk)->iMB; - pData->iMAGNmethodY = ((mng_magnp)pChunk)->iMethodY; -#endif - - iRetcode = mng_process_display_magn (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_MAGN, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_OBJCLEANUP -mng_retcode mng_free_ani_magn (mng_datap pData, - mng_objectp pObject) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_START); -#endif - - MNG_FREEX (pData, pObject, sizeof (mng_ani_magn)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_MAGN, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_magn (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_magnp pMAGN = (mng_ani_magnp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_magn (pData, pMAGN->iFirstid, pMAGN->iLastid, - pMAGN->iMethodX, pMAGN->iMX, pMAGN->iMY, - pMAGN->iML, pMAGN->iMR, pMAGN->iMT, - pMAGN->iMB, pMAGN->iMethodY); -#else - pData->iMAGNfirstid = pMAGN->iFirstid; - pData->iMAGNlastid = pMAGN->iLastid; - pData->iMAGNmethodX = pMAGN->iMethodX; - pData->iMAGNmX = pMAGN->iMX; - pData->iMAGNmY = pMAGN->iMY; - pData->iMAGNmL = pMAGN->iML; - pData->iMAGNmR = pMAGN->iMR; - pData->iMAGNmT = pMAGN->iMT; - pData->iMAGNmB = pMAGN->iMB; - pData->iMAGNmethodY = pMAGN->iMethodY; - - iRetcode = mng_process_display_magn (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_MAGN, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources) -#else -mng_retcode mng_create_ani_past (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_pastp pPAST; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PAST, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_past), - mng_free_ani_past, - mng_process_ani_past, - &pTemp); - if (iRetcode) - return iRetcode; - pPAST = (mng_ani_pastp)pTemp; -#else - MNG_ALLOC (pData, pPAST, sizeof (mng_ani_past)); - - pPAST->sHeader.fCleanup = mng_free_ani_past; - pPAST->sHeader.fProcess = mng_process_ani_past; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pPAST); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pPAST->iTargetid = iTargetid; - pPAST->iTargettype = iTargettype; - pPAST->iTargetx = iTargetx; - pPAST->iTargety = iTargety; - pPAST->iCount = iCount; - - if (iCount) - { - MNG_ALLOC (pData, pPAST->pSources, (iCount * sizeof (mng_past_source))); - MNG_COPY (pPAST->pSources, pSources, (iCount * sizeof (mng_past_source))); - } -#else - pPAST->iTargetid = ((mng_pastp)pChunk)->iDestid; - pPAST->iTargettype = ((mng_pastp)pChunk)->iTargettype; - pPAST->iTargetx = ((mng_pastp)pChunk)->iTargetx; - pPAST->iTargety = ((mng_pastp)pChunk)->iTargety; - pPAST->iCount = ((mng_pastp)pChunk)->iCount; - - if (pPAST->iCount) - { - mng_size_t iSize = (mng_size_t)(pPAST->iCount * sizeof (mng_past_source)); - MNG_ALLOC (pData, pPAST->pSources, iSize); - MNG_COPY (pPAST->pSources, ((mng_pastp)pChunk)->pSources, iSize); - } -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_past (pData, iTargetid, iTargettype, - iTargetx, iTargety, - iCount, pSources); -#else - iRetcode = mng_process_display_past (pData, - ((mng_pastp)pChunk)->iDestid, - ((mng_pastp)pChunk)->iTargettype, - ((mng_pastp)pChunk)->iTargetx, - ((mng_pastp)pChunk)->iTargety, - ((mng_pastp)pChunk)->iCount, - ((mng_pastp)pChunk)->pSources); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iPASTtargetid = iTargetid; - pData->iPASTtargettype = iTargettype; - pData->iPASTtargetx = iTargetx; - pData->iPASTtargety = iTargety; - pData->iPASTcount = iCount; - pData->pPASTsources = pSources; -#else - pData->iPASTtargetid = ((mng_pastp)pChunk)->iDestid; - pData->iPASTtargettype = ((mng_pastp)pChunk)->iTargettype; - pData->iPASTtargetx = ((mng_pastp)pChunk)->iTargetx; - pData->iPASTtargety = ((mng_pastp)pChunk)->iTargety; - pData->iPASTcount = ((mng_pastp)pChunk)->iCount; - pData->pPASTsources = ((mng_pastp)pChunk)->pSources; -#endif - - iRetcode = mng_process_display_past (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_PAST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_free_ani_past (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_pastp pPAST = (mng_ani_pastp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PAST, MNG_LC_START); -#endif - - if (pPAST->iCount) - MNG_FREEX (pData, pPAST->pSources, (pPAST->iCount * sizeof (mng_past_source))); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_past)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_PAST, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_ani_past (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_pastp pPAST = (mng_ani_pastp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PAST, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_past (pData, pPAST->iTargetid, pPAST->iTargettype, - pPAST->iTargetx, pPAST->iTargety, - pPAST->iCount, pPAST->pSources); -#else - pData->iPASTtargetid = pPAST->iTargetid; - pData->iPASTtargettype = pPAST->iTargettype; - pData->iPASTtargetx = pPAST->iTargetx; - pData->iPASTtargety = pPAST->iTargety; - pData->iPASTcount = pPAST->iCount; - pData->pPASTsources = pPAST->pSources; - - iRetcode = mng_process_display_past (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_PAST, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds) -#else -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_chunkp pChunk) -#endif -{ - mng_ani_discp pDISC; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DISC, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - iRetcode = create_obj_general (pData, sizeof (mng_ani_disc), - mng_free_ani_disc, - mng_process_ani_disc, - &pTemp); - if (iRetcode) - return iRetcode; - pDISC = (mng_ani_discp)pTemp; -#else - MNG_ALLOC (pData, pDISC, sizeof (mng_ani_disc)); - - pDISC->sHeader.fCleanup = mng_free_ani_disc; - pDISC->sHeader.fProcess = mng_process_ani_disc; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pDISC); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pDISC->iCount = iCount; - - if (iCount) - { - MNG_ALLOC (pData, pDISC->pIds, (iCount << 1)); - MNG_COPY (pDISC->pIds, pIds, (iCount << 1)); - } -#else - pDISC->iCount = ((mng_discp)pChunk)->iCount; - - if (pDISC->iCount) - { - mng_size_t iSize = (mng_size_t)(pDISC->iCount << 1); - MNG_ALLOC (pData, pDISC->pIds, iSize); - MNG_COPY (pDISC->pIds, ((mng_discp)pChunk)->pObjectids, iSize); - } -#endif - } - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS -#ifndef MNG_OPTIMIZE_CHUNKREADER - iRetcode = mng_process_display_disc (pData, iCount, pIds); -#else - iRetcode = mng_process_display_disc (pData, - ((mng_discp)pChunk)->iCount, - ((mng_discp)pChunk)->pObjectids); -#endif -#else -#ifndef MNG_OPTIMIZE_CHUNKREADER - pData->iDISCcount = iCount; - pData->pDISCids = pIds; -#else - pData->iDISCcount = ((mng_discp)pChunk)->iCount; - pData->pDISCids = ((mng_discp)pChunk)->pObjectids; -#endif - - iRetcode = mng_process_display_disc (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANI_DISC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_disc (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_discp pDISC = (mng_ani_discp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DISC, MNG_LC_START); -#endif - - if (pDISC->iCount) - MNG_FREEX (pData, pDISC->pIds, (pDISC->iCount << 1)); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pObject, sizeof (mng_ani_disc)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANI_DISC, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_disc (mng_datap pData, - mng_objectp pObject) -{ - mng_ani_discp pDISC = (mng_ani_discp)pObject; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DISC, MNG_LC_START); -#endif - -#ifndef MNG_OPTIMIZE_DISPLAYCALLS - iRetcode = mng_process_display_disc (pData, pDISC->iCount, pDISC->pIds); -#else - pData->iDISCcount = pDISC->iCount; - pData->pDISCids = pDISC->pIds; - - iRetcode = mng_process_display_disc (pData); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANI_DISC, MNG_LC_END); -#endif - - return iRetcode; -} -#endif - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_event (mng_datap pData, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname) -#else -mng_retcode mng_create_event (mng_datap pData, - mng_ptr pEntry) -#endif -{ - mng_eventp pEvent; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_EVENT, MNG_LC_START); -#endif - - if (pData->bCacheplayback) /* caching playback info ? */ - { - mng_object_headerp pLast; - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_ptr pTemp; - mng_retcode iRetcode = create_obj_general (pData, sizeof (mng_event), - mng_free_event, - mng_process_event, - &pTemp); - if (iRetcode) - return iRetcode; - pEvent = (mng_eventp)pTemp; -#else - MNG_ALLOC (pData, pEvent, sizeof (mng_event)); - - pEvent->sHeader.fCleanup = mng_free_event; - pEvent->sHeader.fProcess = mng_process_event; -#endif - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pEvent->iEventtype = iEventtype; - pEvent->iMasktype = iMasktype; - pEvent->iLeft = iLeft; - pEvent->iRight = iRight; - pEvent->iTop = iTop; - pEvent->iBottom = iBottom; - pEvent->iObjectid = iObjectid; - pEvent->iIndex = iIndex; - pEvent->iSegmentnamesize = iSegmentnamesize; - - if (iSegmentnamesize) - { - MNG_ALLOC (pData, pEvent->zSegmentname, iSegmentnamesize+1); - MNG_COPY (pEvent->zSegmentname, zSegmentname, iSegmentnamesize); - } -#else - pEvent->iEventtype = ((mng_evnt_entryp)pEntry)->iEventtype; - pEvent->iMasktype = ((mng_evnt_entryp)pEntry)->iMasktype; - pEvent->iLeft = ((mng_evnt_entryp)pEntry)->iLeft; - pEvent->iRight = ((mng_evnt_entryp)pEntry)->iRight; - pEvent->iTop = ((mng_evnt_entryp)pEntry)->iTop; - pEvent->iBottom = ((mng_evnt_entryp)pEntry)->iBottom; - pEvent->iObjectid = ((mng_evnt_entryp)pEntry)->iObjectid; - pEvent->iIndex = ((mng_evnt_entryp)pEntry)->iIndex; - pEvent->iSegmentnamesize = ((mng_evnt_entryp)pEntry)->iSegmentnamesize; - - if (pEvent->iSegmentnamesize) - { - MNG_ALLOC (pData, pEvent->zSegmentname, pEvent->iSegmentnamesize+1); - MNG_COPY (pEvent->zSegmentname, ((mng_evnt_entryp)pEntry)->zSegmentname, pEvent->iSegmentnamesize); - } -#endif - /* fixup the double-linked list */ - pLast = (mng_object_headerp)pData->pLastevent; - - if (pLast) /* link it as last in the chain */ - { - pEvent->sHeader.pPrev = pLast; - pLast->pNext = pEvent; - } - else - { - pData->pFirstevent = pEvent; - } - - pData->pLastevent = pEvent; - pData->bDynamic = MNG_TRUE; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_EVENT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_event (mng_datap pData, - mng_objectp pObject) -{ - mng_eventp pEvent = (mng_eventp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVENT, MNG_LC_START); -#endif - - if (pEvent->iSegmentnamesize) - MNG_FREEX (pData, pEvent->zSegmentname, pEvent->iSegmentnamesize + 1); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pEvent, sizeof (mng_event)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_EVENT, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_event (mng_datap pData, - mng_objectp pObject) -{ -#ifndef MNG_SKIPCHUNK_SEEK - mng_eventp pEvent = (mng_eventp)pObject; - mng_object_headerp pAni; - mng_bool bFound = MNG_FALSE; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_EVENT, MNG_LC_START); -#endif - -#ifndef MNG_SKIPCHUNK_SEEK - if (!pEvent->pSEEK) /* need to find SEEK first ? */ - { - pAni = (mng_object_headerp)pData->pFirstaniobj; - - while ((pAni) && (!bFound)) - { - if ((pAni->fCleanup == mng_free_ani_seek) && - (strcmp(pEvent->zSegmentname, ((mng_ani_seekp)pAni)->zSegmentname) == 0)) - bFound = MNG_TRUE; - else - pAni = (mng_object_headerp)pAni->pNext; - } - - if (pAni) - pEvent->pSEEK = (mng_ani_seekp)pAni; - } - - if (pEvent->pSEEK) /* anything to do ? */ - { - pEvent->iLastx = pData->iEventx; - pEvent->iLasty = pData->iEventy; - /* let's start from this SEEK then */ - pData->pCurraniobj = (mng_objectp)pEvent->pSEEK; - pData->bRunningevent = MNG_TRUE; - /* wake-up the app ! */ - if (!pData->fSettimer ((mng_handle)pData, 5)) - MNG_ERROR (pData, MNG_APPTIMERERROR); - - } - else - MNG_ERROR (pData, MNG_SEEKNOTFOUND); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_EVENT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_SUPPORT_DYNAMICMNG */ - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint32 iFramessize, - mng_ptr pFrames) -#else -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_ptr pEntry) -#endif -{ - mng_mpng_objp pMPNG; - mng_ptr pTemp; - mng_retcode iRetcode; - mng_uint8p pFrame; - mng_int32 iCnt, iMax; - mng_uint32 iX, iY, iWidth, iHeight; - mng_int32 iXoffset, iYoffset; - mng_uint16 iTicks; - mng_uint16 iDelay; - mng_bool bNewframe; - mng_ani_loopp pLOOP; - mng_ani_endlp pENDL; - mng_ani_framp pFRAM; - mng_ani_movep pMOVE; - mng_ani_clipp pCLIP; - mng_ani_showp pSHOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_MPNG_OBJ, MNG_LC_START); -#endif - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_mpng_obj), mng_free_mpng_obj, - mng_process_mpng_obj, &pTemp); - if (iRetcode) - return iRetcode; - pMPNG = (mng_mpng_objp)pTemp; -#else - MNG_ALLOC (pData, pMPNG, sizeof (mng_mpng_obj)); - - pMPNG->sHeader.fCleanup = mng_free_mpng_obj; - pMPNG->sHeader.fProcess = mng_process_mpng_obj; -#endif - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pMPNG->iFramewidth = iFramewidth; - pMPNG->iFrameheight = iFrameheight; - pMPNG->iNumplays = iNumplays; - pMPNG->iTickspersec = iTickspersec; - pMPNG->iFramessize = iFramessize; - - if (iFramessize) - { - MNG_ALLOC (pData, pMPNG->pFrames, iFramessize); - MNG_COPY (pMPNG->pFrames, pFrames, iFramessize); - } -#else - pMPNG->iFramewidth = ((mng_mpngp)pEntry)->iFramewidth; - pMPNG->iFrameheight = ((mng_mpngp)pEntry)->iFrameheight; - pMPNG->iNumplays = ((mng_mpngp)pEntry)->iNumplays; - pMPNG->iTickspersec = ((mng_mpngp)pEntry)->iTickspersec; - pMPNG->iFramessize = ((mng_mpngp)pEntry)->iFramessize; - - if (pMPNG->iFramessize) - { - MNG_ALLOC (pData, pMPNG->pFrames, pMPNG->iFramessize); - MNG_COPY (pMPNG->pFrames, ((mng_mpngp)pEntry)->pFrames, pMPNG->iFramessize); - } -#endif - - pData->pMPNG = pMPNG; - pData->eImagetype = mng_it_mpng; - - iRetcode = mng_process_display_mpng (pData); - if (iRetcode) - return iRetcode; - - /* now let's create the MNG animation directives from this */ - - pFrame = (mng_uint8p)pMPNG->pFrames; - iMax = pMPNG->iFramessize / 26; - /* set up MNG impersonation */ - pData->iTicks = pMPNG->iTickspersec; - pData->iLayercount = iMax; - - if (pMPNG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_loop), - mng_free_ani_loop, mng_process_ani_loop, - &((mng_ptr)pLOOP)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop)); - - pLOOP->sHeader.fCleanup = mng_free_ani_loop; - pLOOP->sHeader.fProcess = mng_process_ani_loop; -#endif - - pLOOP->iLevel = 1; - if (pMPNG->iNumplays) - pLOOP->iRepeatcount = pMPNG->iNumplays; - else - pLOOP->iRepeatcount = 0xFFFFFFFFl; - - mng_add_ani_object (pData, (mng_object_headerp)pLOOP); - } - - bNewframe = MNG_TRUE; /* create the frame display objects */ - - for (iCnt = 0; iCnt < iMax; iCnt++) - { - iX = mng_get_uint32 (pFrame); - iY = mng_get_uint32 (pFrame+4); - iWidth = mng_get_uint32 (pFrame+8); - iHeight = mng_get_uint32 (pFrame+12); - iXoffset = mng_get_int32 (pFrame+16); - iYoffset = mng_get_int32 (pFrame+20); - iTicks = mng_get_uint16 (pFrame+24); - - iDelay = iTicks; - if (!iDelay) - { - mng_uint8p pTemp = pFrame+26; - mng_int32 iTemp = iCnt+1; - - while ((iTemp < iMax) && (!iDelay)) - { - iDelay = mng_get_uint16 (pTemp+24); - pTemp += 26; - iTemp++; - } - } - - if (bNewframe) - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_fram), - mng_free_obj_general, mng_process_ani_fram, - &((mng_ptr)pFRAM)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram)); - - pFRAM->sHeader.fCleanup = mng_free_ani_fram; - pFRAM->sHeader.fProcess = mng_process_ani_fram; -#endif - - pFRAM->iFramemode = 4; - pFRAM->iChangedelay = 1; - pFRAM->iDelay = iDelay; - - mng_add_ani_object (pData, (mng_object_headerp)pFRAM); - } - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_move), - mng_free_obj_general, - mng_process_ani_move, - &((mng_ptr)pMOVE)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move)); - - pMOVE->sHeader.fCleanup = mng_free_ani_move; - pMOVE->sHeader.fProcess = mng_process_ani_move; -#endif - - pMOVE->iLocax = iXoffset - (mng_int32)iX; - pMOVE->iLocay = iYoffset - (mng_int32)iY; - - mng_add_ani_object (pData, (mng_object_headerp)pMOVE); - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_clip), - mng_free_obj_general, - mng_process_ani_clip, - &((mng_ptr)pCLIP)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pCLIP, sizeof (mng_ani_clip)); - - pCLIP->sHeader.fCleanup = mng_free_ani_clip; - pCLIP->sHeader.fProcess = mng_process_ani_clip; -#endif - - pCLIP->iClipl = iXoffset; - pCLIP->iClipr = iXoffset + (mng_int32)iWidth; - pCLIP->iClipt = iYoffset; - pCLIP->iClipb = iYoffset + (mng_int32)iHeight; - - mng_add_ani_object (pData, (mng_object_headerp)pCLIP); - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_show), - mng_free_obj_general, mng_process_ani_show, - &((mng_ptr)pSHOW)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show)); - - pSHOW->sHeader.fCleanup = mng_free_ani_show; - pSHOW->sHeader.fProcess = mng_process_ani_show; -#endif - - mng_add_ani_object (pData, (mng_object_headerp)pSHOW); - - bNewframe = (mng_bool)iTicks; - pFrame += 26; - } - - if (pMPNG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_endl), - mng_free_obj_general, mng_process_ani_endl, - &((mng_ptr)pENDL)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl)); - - pENDL->sHeader.fCleanup = mng_free_ani_endl; - pENDL->sHeader.fProcess = mng_process_ani_endl; -#endif - - pENDL->iLevel = 1; - - mng_add_ani_object (pData, (mng_object_headerp)pENDL); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_MPNG_OBJ, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_mpng_obj (mng_datap pData, - mng_objectp pObject) -{ - mng_mpng_objp pMPNG = (mng_mpng_objp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG_OBJ, MNG_LC_START); -#endif - - if (pMPNG->iFramessize) - MNG_FREEX (pData, pMPNG->pFrames, pMPNG->iFramessize); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pMPNG, sizeof (mng_mpng_obj)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_MPNG_OBJ, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_mpng_obj (mng_datap pData, - mng_objectp pObject) -{ - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_MPNG_PROPOSAL */ - -/* ************************************************************************** */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_uint32 iNumframes, - mng_uint32 iTickspersec, - mng_uint32 iNumplays, - mng_uint32 iTilewidth, - mng_uint32 iTileheight, - mng_uint8 iInterlace, - mng_uint8 iStillused) -#else -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_ptr pEntry) -#endif -{ - mng_ang_objp pANG; - mng_ptr pTemp; - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANG_OBJ, MNG_LC_START); -#endif - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ang_obj), mng_free_ang_obj, - mng_process_ang_obj, &pTemp); - if (iRetcode) - return iRetcode; - pANG = (mng_ang_objp)pTemp; -#else - MNG_ALLOC (pData, pANG, sizeof (mng_ang_obj)); - - pANG->sHeader.fCleanup = mng_free_ang_obj; - pANG->sHeader.fProcess = mng_process_ang_obj; -#endif - -#ifndef MNG_OPTIMIZE_CHUNKREADER - pANG->iNumframes = iNumframes; - pANG->iTickspersec = iTickspersec; - pANG->iNumplays = iNumplays; - pANG->iTilewidth = iTilewidth; - pANG->iTileheight = iTileheight; - pANG->iInterlace = iInterlace; - pANG->iStillused = iStillused; -#else - pANG->iNumframes = ((mng_ahdrp)pEntry)->iNumframes; - pANG->iTickspersec = ((mng_ahdrp)pEntry)->iTickspersec; - pANG->iNumplays = ((mng_ahdrp)pEntry)->iNumplays; - pANG->iTilewidth = ((mng_ahdrp)pEntry)->iTilewidth; - pANG->iTileheight = ((mng_ahdrp)pEntry)->iTileheight; - pANG->iInterlace = ((mng_ahdrp)pEntry)->iInterlace; - pANG->iStillused = ((mng_ahdrp)pEntry)->iStillused; -#endif - - pData->pANG = pANG; - pData->eImagetype = mng_it_ang; - - iRetcode = mng_process_display_ang (pData); - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CREATE_ANG_OBJ, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_free_ang_obj (mng_datap pData, - mng_objectp pObject) -{ - mng_ang_objp pANG = (mng_ang_objp)pObject; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANG_OBJ, MNG_LC_START); -#endif - - if (pANG->iTilessize) - MNG_FREEX (pData, pANG->pTiles, pANG->iTilessize); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - MNG_FREEX (pData, pANG, sizeof (mng_ang_obj)); -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FREE_ANG_OBJ, MNG_LC_END); -#endif - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - return MNG_NOERROR; -#else - return mng_free_obj_general(pData, pObject); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ang_obj (mng_datap pData, - mng_objectp pObject) -{ - mng_ang_objp pANG = (mng_ang_objp)pObject; - mng_uint8p pTile = (mng_uint8p)pANG->pTiles; - mng_retcode iRetcode; - mng_int32 iCnt, iMax; - mng_uint32 iTicks; - mng_int32 iXoffset, iYoffset; - mng_uint8 iSource; - mng_ani_loopp pLOOP; - mng_ani_endlp pENDL; - mng_ani_framp pFRAM; - mng_ani_movep pMOVE; - mng_ani_showp pSHOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANG_OBJ, MNG_LC_START); -#endif - - /* let's create the MNG animation directives from this */ - - iMax = pANG->iNumframes; - /* set up MNG impersonation */ - pData->iTicks = pANG->iTickspersec; - pData->iLayercount = iMax; - - if (pANG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_loop), - mng_free_ani_loop, mng_process_ani_loop, - &((mng_ptr)pLOOP)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pLOOP, sizeof (mng_ani_loop)); - - pLOOP->sHeader.fCleanup = mng_free_ani_loop; - pLOOP->sHeader.fProcess = mng_process_ani_loop; -#endif - - pLOOP->iLevel = 1; - if (pANG->iNumplays) - pLOOP->iRepeatcount = pANG->iNumplays; - else - pLOOP->iRepeatcount = 0xFFFFFFFFl; - - mng_add_ani_object (pData, (mng_object_headerp)pLOOP); - } - - for (iCnt = 0; iCnt < iMax; iCnt++) - { - iTicks = mng_get_uint32 (pTile); - iXoffset = mng_get_int32 (pTile+4); - iYoffset = mng_get_int32 (pTile+8); - iSource = *(pTile+12); - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_fram), - mng_free_obj_general, mng_process_ani_fram, - &((mng_ptr)pFRAM)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pFRAM, sizeof (mng_ani_fram)); - - pFRAM->sHeader.fCleanup = mng_free_ani_fram; - pFRAM->sHeader.fProcess = mng_process_ani_fram; -#endif - - pFRAM->iFramemode = 4; - pFRAM->iChangedelay = 1; - pFRAM->iDelay = iTicks; - - mng_add_ani_object (pData, (mng_object_headerp)pFRAM); - - if (!iSource) - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_move), - mng_free_obj_general, - mng_process_ani_move, - &((mng_ptr)pMOVE)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pMOVE, sizeof (mng_ani_move)); - - pMOVE->sHeader.fCleanup = mng_free_ani_move; - pMOVE->sHeader.fProcess = mng_process_ani_move; -#endif - - pMOVE->iFirstid = 1; - pMOVE->iLastid = 1; - pMOVE->iLocax = -iXoffset; - pMOVE->iLocay = -iYoffset; - - mng_add_ani_object (pData, (mng_object_headerp)pMOVE); - } - -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_show), - mng_free_obj_general, mng_process_ani_show, - &((mng_ptr)pSHOW)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pSHOW, sizeof (mng_ani_show)); - - pSHOW->sHeader.fCleanup = mng_free_ani_show; - pSHOW->sHeader.fProcess = mng_process_ani_show; -#endif - - if (iSource) - pSHOW->iFirstid = 0; - else - pSHOW->iFirstid = 1; - pSHOW->iLastid = pSHOW->iFirstid; - - mng_add_ani_object (pData, (mng_object_headerp)pSHOW); - - pTile += sizeof(mng_adat_tile); - } - - if (pANG->iNumplays != 1) /* create a LOOP/ENDL pair ? */ - { -#ifdef MNG_OPTIMIZE_OBJCLEANUP - iRetcode = create_obj_general (pData, sizeof (mng_ani_endl), - mng_free_obj_general, mng_process_ani_endl, - &((mng_ptr)pENDL)); - if (iRetcode) - return iRetcode; -#else - MNG_ALLOC (pData, pENDL, sizeof (mng_ani_endl)); - - pENDL->sHeader.fCleanup = mng_free_ani_endl; - pENDL->sHeader.fProcess = mng_process_ani_endl; -#endif - - pENDL->iLevel = 1; - - mng_add_ani_object (pData, (mng_object_headerp)pENDL); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_ANG_OBJ, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_ANG_PROPOSAL */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_object_prc.h b/Engine/lib/lmng/libmng_object_prc.h deleted file mode 100644 index ffd20c871..000000000 --- a/Engine/lib/lmng/libmng_object_prc.h +++ /dev/null @@ -1,690 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_object_prc.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Object processing routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the internal object processing routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for global color-chunks in animation * */ -/* * - added support for global PLTE,tRNS,bKGD in animation * */ -/* * - added SAVE & SEEK animation objects * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - changed ani_object create routines not to return the * */ -/* * created object (wasn't necessary) * */ -/* * - added compression/filter/interlace fields to * */ -/* * object-buffer for delta-image processing * */ -/* * * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added support for PPLT chunk * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added routine to discard "invalid" objects * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around Delta-PNG code * */ -/* * - added SKIPCHUNK feature * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_object_prc_h_ -#define _libmng_object_prc_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_drop_invalid_objects (mng_datap pData); - -/* ************************************************************************** */ - -mng_retcode mng_create_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_imagedatap *ppObject); - -mng_retcode mng_free_imagedataobject (mng_datap pData, - mng_imagedatap pImagedata); - -mng_retcode mng_clone_imagedataobject (mng_datap pData, - mng_bool bConcrete, - mng_imagedatap pSource, - mng_imagedatap *ppClone); - -/* ************************************************************************** */ - -mng_retcode mng_create_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bConcrete, - mng_bool bVisible, - mng_bool bViewable, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_int32 iPosx, - mng_int32 iPosy, - mng_bool bClipped, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb, - mng_imagep *ppObject); - -mng_retcode mng_free_imageobject (mng_datap pData, - mng_imagep pImage); - -mng_imagep mng_find_imageobject (mng_datap pData, - mng_uint16 iId); - -mng_retcode mng_clone_imageobject (mng_datap pData, - mng_uint16 iId, - mng_bool bPartial, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy, - mng_imagep pSource, - mng_imagep *ppClone); - -mng_retcode mng_renum_imageobject (mng_datap pData, - mng_imagep pSource, - mng_uint16 iId, - mng_bool bVisible, - mng_bool bAbstract, - mng_bool bHasloca, - mng_uint8 iLocationtype, - mng_int32 iLocationx, - mng_int32 iLocationy); - -mng_retcode mng_reset_object_details (mng_datap pData, - mng_imagep pImage, - mng_uint32 iWidth, - mng_uint32 iHeight, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iCompression, - mng_uint8 iFilter, - mng_uint8 iInterlace, - mng_bool bResetall); - -mng_retcode mng_promote_imageobject (mng_datap pData, - mng_imagep pImage, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype); - -mng_retcode mng_magnify_imageobject (mng_datap pData, - mng_imagep pImage); - -mng_retcode mng_colorcorrect_object (mng_datap pData, - mng_imagep pImage); - -/* ************************************************************************** */ - -mng_retcode mng_create_ani_image (mng_datap pData); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - -mng_retcode mng_create_ani_plte (mng_datap pData, - mng_uint32 iEntrycount, - mng_palette8ep paEntries); - -mng_retcode mng_create_ani_trns (mng_datap pData, - mng_uint32 iRawlen, - mng_uint8p pRawdata); - -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iGamma); - -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey); - -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_bool bEmpty, - mng_uint8 iRenderinginent); - -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_bool bEmpty, - mng_uint32 iProfilesize, - mng_ptr pProfile); - -mng_retcode mng_create_ani_bkgd (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue); - -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_uint8 iLevel, - mng_uint32 iRepeatcount, - mng_uint8 iTermcond, - mng_uint32 iItermin, - mng_uint32 iItermax, - mng_uint32 iCount, - mng_uint32p pSignals); - -mng_retcode mng_create_ani_endl (mng_datap pData, - mng_uint8 iLevel); - -mng_retcode mng_create_ani_defi (mng_datap pData); - -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_bool bHasalpha, - mng_uint16 iAlpha, - mng_uint8 iViewable); - -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_uint16 iSourceid, - mng_uint16 iCloneid, - mng_uint8 iClonetype, - mng_bool bHasdonotshow, - mng_uint8 iDonotshow, - mng_uint8 iConcrete, - mng_bool bHasloca, - mng_uint8 iLocatype, - mng_int32 iLocax, - mng_int32 iLocay); - -mng_retcode mng_create_ani_back (mng_datap pData, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue, - mng_uint8 iMandatory, - mng_uint16 iImageid, - mng_uint8 iTile); - -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_uint8 iFramemode, - mng_uint8 iChangedelay, - mng_uint32 iDelay, - mng_uint8 iChangetimeout, - mng_uint32 iTimeout, - mng_uint8 iChangeclipping, - mng_uint8 iCliptype, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); - -mng_retcode mng_create_ani_move (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iLocax, - mng_int32 iLocay); - -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iType, - mng_int32 iClipl, - mng_int32 iClipr, - mng_int32 iClipt, - mng_int32 iClipb); - -mng_retcode mng_create_ani_show (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMode); - -mng_retcode mng_create_ani_term (mng_datap pData, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax); - -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_create_ani_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_uint16 iObjectid, - mng_uint8 iImagetype, - mng_uint8 iDeltatype, - mng_uint32 iBlockwidth, - mng_uint32 iBlockheight, - mng_uint32 iBlockx, - mng_uint32 iBlocky); - -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_uint8 iBitdepth, - mng_uint8 iColortype, - mng_uint8 iFilltype); - -mng_retcode mng_create_ani_ipng (mng_datap pData); -mng_retcode mng_create_ani_ijng (mng_datap pData); - -mng_retcode mng_create_ani_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_uint16 iFirstid, - mng_uint16 iLastid, - mng_uint8 iMethodX, - mng_uint16 iMX, - mng_uint16 iMY, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint16 iMT, - mng_uint16 iMB, - mng_uint8 iMethodY); -#endif - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_create_ani_past (mng_datap pData, - mng_uint16 iTargetid, - mng_uint8 iTargettype, - mng_int32 iTargetx, - mng_int32 iTargety, - mng_uint32 iCount, - mng_ptr pSources); -#endif - -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_uint32 iCount, - mng_uint16p pIds); -#endif - -#else /* MNG_OPTIMIZE_CHUNKREADER */ - -mng_retcode mng_create_ani_plte (mng_datap pData); -mng_retcode mng_create_ani_trns (mng_datap pData); -mng_retcode mng_create_ani_gama (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_chrm (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_srgb (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_iccp (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_bkgd (mng_datap pData); -mng_retcode mng_create_ani_loop (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_endl (mng_datap pData, - mng_uint8 iLevel); -mng_retcode mng_create_ani_defi (mng_datap pData); -mng_retcode mng_create_ani_basi (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_clon (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_back (mng_datap pData); -mng_retcode mng_create_ani_fram (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_move (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_clip (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_show (mng_datap pData); -mng_retcode mng_create_ani_term (mng_datap pData, - mng_chunkp pChunk); -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_create_ani_save (mng_datap pData); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_create_ani_seek (mng_datap pData, - mng_chunkp pChunk); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_create_ani_dhdr (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_prom (mng_datap pData, - mng_chunkp pChunk); -mng_retcode mng_create_ani_ipng (mng_datap pData); -mng_retcode mng_create_ani_ijng (mng_datap pData); - -mng_retcode mng_create_ani_pplt (mng_datap pData, - mng_uint8 iType, - mng_uint32 iCount, - mng_palette8ep paIndexentries, - mng_uint8p paAlphaentries, - mng_uint8p paUsedentries); -#endif - -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_create_ani_magn (mng_datap pData, - mng_chunkp pChunk); -#endif -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_create_ani_past (mng_datap pData, - mng_chunkp pChunk); -#endif -#ifndef MNG_SKIPCHUNK_DISC -mng_retcode mng_create_ani_disc (mng_datap pData, - mng_chunkp pChunk); -#endif - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - -/* ************************************************************************** */ - -mng_retcode mng_free_ani_image (mng_datap pData, - mng_objectp pObject); - -#ifndef MNG_OPTIMIZE_OBJCLEANUP - -mng_retcode mng_free_ani_plte (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_trns (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_gama (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode mng_free_ani_chrm (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode mng_free_ani_srgb (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode mng_free_ani_bkgd (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode mng_free_ani_endl (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_free_ani_defi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_basi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_clon (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_back (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_fram (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_move (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_clip (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_show (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_term (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_free_ani_save (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_free_ani_dhdr (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_prom (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_ipng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_ijng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_free_ani_pplt (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_MAGN -mng_retcode mng_free_ani_magn (mng_datap pData, - mng_objectp pObject); -#endif - -#endif /* MNG_OPTIMIZE_OBJCLEANUP */ - - -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode mng_free_ani_iccp (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode mng_free_ani_loop (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_free_ani_seek (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_free_ani_past (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_free_ani_disc (mng_datap pData, - mng_objectp pObject); - -/* ************************************************************************** */ - -mng_retcode mng_process_ani_image (mng_datap pData, - mng_objectp pObject); - -mng_retcode mng_process_ani_plte (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_trns (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_gama (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_cHRM -mng_retcode mng_process_ani_chrm (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_sRGB -mng_retcode mng_process_ani_srgb (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode mng_process_ani_iccp (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode mng_process_ani_bkgd (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_LOOP -mng_retcode mng_process_ani_loop (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_endl (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_process_ani_defi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_basi (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_clon (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_back (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_fram (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_move (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_clip (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_show (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_term (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_SAVE -mng_retcode mng_process_ani_save (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_SKIPCHUNK_SEEK -mng_retcode mng_process_ani_seek (mng_datap pData, - mng_objectp pObject); -#endif -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_process_ani_dhdr (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_prom (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_ipng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_ijng (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ani_pplt (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_process_ani_magn (mng_datap pData, - mng_objectp pObject); -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_process_ani_past (mng_datap pData, - mng_objectp pObject); -#endif -mng_retcode mng_process_ani_disc (mng_datap pData, - mng_objectp pObject); - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_event (mng_datap pData, - mng_uint8 iEventtype, - mng_uint8 iMasktype, - mng_int32 iLeft, - mng_int32 iRight, - mng_int32 iTop, - mng_int32 iBottom, - mng_uint16 iObjectid, - mng_uint8 iIndex, - mng_uint32 iSegmentnamesize, - mng_pchar zSegmentname); -#else -mng_retcode mng_create_event (mng_datap pData, - mng_ptr pEntry); -#endif -mng_retcode mng_free_event (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_event (mng_datap pData, - mng_objectp pObject); -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_uint32 iFramewidth, - mng_uint32 iFrameheight, - mng_uint16 iNumplays, - mng_uint16 iTickspersec, - mng_uint32 iFramessize, - mng_ptr pFrames); -#else -mng_retcode mng_create_mpng_obj (mng_datap pData, - mng_ptr pEntry); -#endif -mng_retcode mng_free_mpng_obj (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_mpng_obj (mng_datap pData, - mng_objectp pObject); -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -#ifndef MNG_OPTIMIZE_CHUNKREADER -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_uint32 iNumframes, - mng_uint32 iTickspersec, - mng_uint32 iNumplays, - mng_uint32 iTilewidth, - mng_uint32 iTileheight, - mng_uint8 iInterlace, - mng_uint8 iStillused); -#else -mng_retcode mng_create_ang_obj (mng_datap pData, - mng_ptr pEntry); -#endif -mng_retcode mng_free_ang_obj (mng_datap pData, - mng_objectp pObject); -mng_retcode mng_process_ang_obj (mng_datap pData, - mng_objectp pObject); -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_object_prc_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_objects.h b/Engine/lib/lmng/libmng_objects.h deleted file mode 100644 index 053e6b4b2..000000000 --- a/Engine/lib/lmng/libmng_objects.h +++ /dev/null @@ -1,635 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_objects.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Internal object structures (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the internal object structures * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - changed inclusion to DISPLAY_PROCS * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added global color-chunks for animations * */ -/* * - added global PLTE,tRNS,bKGD chunks for animation * */ -/* * - added SAVE & SEEK animation objects * */ -/* * 0.5.2 - 05/29/2000 - G.Juyn * */ -/* * - added framenr/layernr/playtime to object header * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added ani-objects for delta-image processing * */ -/* * - added compression/filter/interlace fields to * */ -/* * object-buffer for delta-image processing * */ -/* * * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed definition of aTRNSentries * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added definition for PPLT animation-processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/10/2000 - G.Juyn * */ -/* * - fixed DEFI behavior * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for delta-JNG * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added valid-flag to stored objects for read() / display()* */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - added storage for pixel-/alpha-sampledepth for delta's * */ -/* * * */ -/* * 1.0.5 - 09/13/2002 - G.Juyn * */ -/* * - fixed read/write of MAGN chunk * */ -/* * 1.0.5 - 09/15/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * 1.0.5 - 10/07/2002 - G.Juyn * */ -/* * - fixed DISC support * */ -/* * * */ -/* * 1.0.6 - 10/07/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.7 - 03/24/2004 - G.R-P * */ -/* * - added more SKIPCHUNK conditionals * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_OBJCLEANUP * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_objects_h_ -#define _libmng_objects_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* ************************************************************************** */ - -typedef mng_retcode (*mng_cleanupobject) (mng_datap pData, - mng_objectp pHeader); - -typedef mng_retcode (*mng_processobject) (mng_datap pData, - mng_objectp pHeader); - -/* ************************************************************************** */ - -typedef struct { - mng_cleanupobject fCleanup; - mng_processobject fProcess; - mng_objectp pNext; /* for double-linked list */ - mng_objectp pPrev; - mng_uint32 iFramenr; - mng_uint32 iLayernr; - mng_uint32 iPlaytime; -#ifdef MNG_OPTIMIZE_OBJCLEANUP - mng_size_t iObjsize; -#endif - } mng_object_header; -typedef mng_object_header * mng_object_headerp; - -/* ************************************************************************** */ - -typedef struct { /* MNG specification "object-buffer" */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iRefcount; /* reference counter */ - mng_bool bFrozen; /* frozen flag */ - mng_bool bConcrete; /* concrete flag */ - mng_bool bViewable; /* viewable flag */ - mng_uint32 iWidth; /* image specifics */ - mng_uint32 iHeight; - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iCompression; - mng_uint8 iFilter; - mng_uint8 iInterlace; - - mng_bool bCorrected; /* indicates if an abstract image - has already been color-corrected */ - - mng_uint8 iAlphabitdepth; /* used only for JNG images */ - mng_uint8 iJHDRcompression; - mng_uint8 iJHDRinterlace; - - mng_uint8 iPixelsampledepth; /* used with delta-images */ - mng_uint8 iAlphasampledepth; - - mng_bool bHasPLTE; /* PLTE chunk present */ - mng_bool bHasTRNS; /* tRNS chunk present */ - mng_bool bHasGAMA; /* gAMA chunk present */ - mng_bool bHasCHRM; /* cHRM chunk present */ - mng_bool bHasSRGB; /* sRGB chunk present */ - mng_bool bHasICCP; /* iCCP chunk present */ - mng_bool bHasBKGD; /* bKGD chunk present */ - - mng_uint32 iPLTEcount; /* PLTE fields */ - mng_rgbpaltab aPLTEentries; - - mng_uint16 iTRNSgray; /* tRNS fields */ - mng_uint16 iTRNSred; - mng_uint16 iTRNSgreen; - mng_uint16 iTRNSblue; - mng_uint32 iTRNScount; - mng_uint8arr aTRNSentries; - - mng_uint32 iGamma; /* gAMA fields */ - - mng_uint32 iWhitepointx; /* cHRM fields */ - mng_uint32 iWhitepointy; - mng_uint32 iPrimaryredx; - mng_uint32 iPrimaryredy; - mng_uint32 iPrimarygreenx; - mng_uint32 iPrimarygreeny; - mng_uint32 iPrimarybluex; - mng_uint32 iPrimarybluey; - - mng_uint8 iRenderingintent; /* sRGB fields */ - - mng_uint32 iProfilesize; /* iCCP fields */ - mng_ptr pProfile; - - mng_uint8 iBKGDindex; /* bKGD fields */ - mng_uint16 iBKGDgray; - mng_uint16 iBKGDred; - mng_uint16 iBKGDgreen; - mng_uint16 iBKGDblue; - - mng_uint32 iSamplesize; /* size of a sample */ - mng_uint32 iRowsize; /* size of a row of samples */ - mng_uint32 iImgdatasize; /* size of the sample data buffer */ - mng_uint8p pImgdata; /* actual sample data buffer */ - - } mng_imagedata; -typedef mng_imagedata * mng_imagedatap; - -/* ************************************************************************** */ - -typedef struct { /* MNG specification "object" */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iId; /* object-id */ - mng_bool bFrozen; /* frozen flag */ - mng_bool bVisible; /* potential visibility flag */ - mng_bool bViewable; /* viewable flag */ - mng_bool bValid; /* marks invalid when only reading */ - mng_int32 iPosx; /* location fields */ - mng_int32 iPosy; - mng_bool bClipped; /* clipping fields */ - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; -#ifndef MNG_SKIPCHUNK_MAGN - mng_uint8 iMAGN_MethodX; /* magnification (MAGN) */ - mng_uint8 iMAGN_MethodY; - mng_uint16 iMAGN_MX; - mng_uint16 iMAGN_MY; - mng_uint16 iMAGN_ML; - mng_uint16 iMAGN_MR; - mng_uint16 iMAGN_MT; - mng_uint16 iMAGN_MB; -#endif -#ifndef MNG_SKIPCHUNK_PAST - mng_int32 iPastx; /* target x/y from previous PAST */ - mng_int32 iPasty; -#endif - mng_imagedatap pImgbuf; /* the image-data buffer */ - } mng_image; -typedef mng_image * mng_imagep; - -/* ************************************************************************** */ - - /* "on-the-fly" image (= object 0) */ -typedef mng_image mng_ani_image; /* let's (ab)use the general "object" */ -typedef mng_ani_image * mng_ani_imagep; /* that's actualy crucial, so don't change it! */ - -/* ************************************************************************** */ - -typedef struct { /* global PLTE object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iEntrycount; - mng_rgbpaltab aEntries; - } mng_ani_plte; -typedef mng_ani_plte * mng_ani_pltep; - -/* ************************************************************************** */ - -typedef struct { /* global tRNS object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iRawlen; - mng_uint8arr aRawdata; - } mng_ani_trns; -typedef mng_ani_trns * mng_ani_trnsp; - -/* ************************************************************************** */ - -typedef struct { /* global gAMA object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint32 iGamma; - } mng_ani_gama; -typedef mng_ani_gama * mng_ani_gamap; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_cHRM -typedef struct { /* global cHRM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint32 iWhitepointx; - mng_uint32 iWhitepointy; - mng_uint32 iRedx; - mng_uint32 iRedy; - mng_uint32 iGreenx; - mng_uint32 iGreeny; - mng_uint32 iBluex; - mng_uint32 iBluey; - } mng_ani_chrm; -typedef mng_ani_chrm * mng_ani_chrmp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* global sRGB object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint8 iRenderingintent; - } mng_ani_srgb; -typedef mng_ani_srgb * mng_ani_srgbp; - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_iCCP -typedef struct { /* global iCCP object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_bool bEmpty; - mng_uint32 iProfilesize; - mng_ptr pProfile; - } mng_ani_iccp; -typedef mng_ani_iccp * mng_ani_iccpp; -#endif - -/* ************************************************************************** */ - -typedef struct { /* global bKGD object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - } mng_ani_bkgd; -typedef mng_ani_bkgd * mng_ani_bkgdp; - -/* ************************************************************************** */ - -typedef struct { /* LOOP object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iLevel; - mng_uint32 iRepeatcount; - mng_uint8 iTermcond; - mng_uint32 iItermin; - mng_uint32 iItermax; - mng_uint32 iCount; - mng_uint32p pSignals; - - mng_uint32 iRunningcount; /* running counter */ - } mng_ani_loop; -typedef mng_ani_loop * mng_ani_loopp; - -/* ************************************************************************** */ - -typedef struct { /* ENDL object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iLevel; - - mng_ani_loopp pLOOP; /* matching LOOP */ - } mng_ani_endl; -typedef mng_ani_endl * mng_ani_endlp; - -/* ************************************************************************** */ - -typedef struct { /* DEFI object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iId; - mng_bool bHasdonotshow; - mng_uint8 iDonotshow; - mng_bool bHasconcrete; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_int32 iLocax; - mng_int32 iLocay; - mng_bool bHasclip; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_ani_defi; -typedef mng_ani_defi * mng_ani_defip; - -/* ************************************************************************** */ - -typedef struct { /* BASI object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_bool bHasalpha; - mng_uint16 iAlpha; - mng_uint8 iViewable; - } mng_ani_basi; -typedef mng_ani_basi * mng_ani_basip; - -/* ************************************************************************** */ - -typedef struct { /* CLON object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iCloneid; - mng_uint16 iSourceid; - mng_uint8 iClonetype; - mng_bool bHasdonotshow; - mng_uint8 iDonotshow; - mng_uint8 iConcrete; - mng_bool bHasloca; - mng_uint8 iLocatype; - mng_int32 iLocax; - mng_int32 iLocay; - } mng_ani_clon; -typedef mng_ani_clon * mng_ani_clonp; - -/* ************************************************************************** */ - -typedef struct { /* BACK object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iRed; - mng_uint16 iGreen; - mng_uint16 iBlue; - mng_uint8 iMandatory; - mng_uint16 iImageid; - mng_uint8 iTile; - } mng_ani_back; -typedef mng_ani_back * mng_ani_backp; - -/* ************************************************************************** */ - -typedef struct { /* FRAM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iFramemode; - mng_uint8 iChangedelay; - mng_uint32 iDelay; - mng_uint8 iChangetimeout; - mng_uint32 iTimeout; - mng_uint8 iChangeclipping; - mng_uint8 iCliptype; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_ani_fram; -typedef mng_ani_fram * mng_ani_framp; - -/* ************************************************************************** */ - -typedef struct { /* MOVE object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iType; - mng_int32 iLocax; - mng_int32 iLocay; - } mng_ani_move; -typedef mng_ani_move * mng_ani_movep; - -/* ************************************************************************** */ - -typedef struct { /* CLIP object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iType; - mng_int32 iClipl; - mng_int32 iClipr; - mng_int32 iClipt; - mng_int32 iClipb; - } mng_ani_clip; -typedef mng_ani_clip * mng_ani_clipp; - -/* ************************************************************************** */ - -typedef struct { /* SHOW object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMode; - } mng_ani_show; -typedef mng_ani_show * mng_ani_showp; - -/* ************************************************************************** */ - -typedef struct { /* TERM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iTermaction; - mng_uint8 iIteraction; - mng_uint32 iDelay; - mng_uint32 iItermax; - } mng_ani_term; -typedef mng_ani_term * mng_ani_termp; - -/* ************************************************************************** */ - -typedef struct { /* SAVE object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - } mng_ani_save; -typedef mng_ani_save * mng_ani_savep; - -/* ************************************************************************** */ - -typedef struct { /* SEEK object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iSegmentnamesize; - mng_pchar zSegmentname; - } mng_ani_seek; -typedef mng_ani_seek * mng_ani_seekp; - -/* ************************************************************************** */ -#ifndef MNG_NO_DELTA_PNG -typedef struct { /* DHDR object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iObjectid; - mng_uint8 iImagetype; - mng_uint8 iDeltatype; - mng_uint32 iBlockwidth; - mng_uint32 iBlockheight; - mng_uint32 iBlockx; - mng_uint32 iBlocky; - } mng_ani_dhdr; -typedef mng_ani_dhdr * mng_ani_dhdrp; - -/* ************************************************************************** */ - -typedef struct { /* PROM object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iBitdepth; - mng_uint8 iColortype; - mng_uint8 iFilltype; - } mng_ani_prom; -typedef mng_ani_prom * mng_ani_promp; - -/* ************************************************************************** */ - -typedef struct { /* IPNG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - } mng_ani_ipng; -typedef mng_ani_ipng * mng_ani_ipngp; - -/* ************************************************************************** */ - -typedef struct { /* IJNG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - } mng_ani_ijng; -typedef mng_ani_ijng * mng_ani_ijngp; - -/* ************************************************************************** */ - -typedef struct { /* PPLT object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iType; - mng_uint32 iCount; - mng_rgbpaltab aIndexentries; - mng_uint8arr aAlphaentries; - mng_uint8arr aUsedentries; - } mng_ani_pplt; -typedef mng_ani_pplt * mng_ani_ppltp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -typedef struct { /* MAGN object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iFirstid; - mng_uint16 iLastid; - mng_uint8 iMethodX; - mng_uint16 iMX; - mng_uint16 iMY; - mng_uint16 iML; - mng_uint16 iMR; - mng_uint16 iMT; - mng_uint16 iMB; - mng_uint8 iMethodY; - } mng_ani_magn; -typedef mng_ani_magn * mng_ani_magnp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -typedef struct { /* PAST object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint16 iTargetid; - mng_uint8 iTargettype; - mng_int32 iTargetx; - mng_int32 iTargety; - mng_uint32 iCount; - mng_ptr pSources; - } mng_ani_past; -typedef mng_ani_past * mng_ani_pastp; -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_DISC -typedef struct { /* DISC object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iCount; - mng_uint16p pIds; - } mng_ani_disc; -typedef mng_ani_disc * mng_ani_discp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -typedef struct { /* event object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint8 iEventtype; - mng_uint8 iMasktype; - mng_int32 iLeft; - mng_int32 iRight; - mng_int32 iTop; - mng_int32 iBottom; - mng_uint16 iObjectid; - mng_uint8 iIndex; - mng_uint32 iSegmentnamesize; - mng_pchar zSegmentname; - - mng_ani_seekp pSEEK; /* SEEK ani object */ - mng_int32 iLastx; /* last X/Y coordinates */ - mng_int32 iLasty; - } mng_event; -typedef mng_event * mng_eventp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_MPNG_PROPOSAL -typedef struct { /* mPNG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iFramewidth; - mng_uint32 iFrameheight; - mng_uint32 iNumplays; - mng_uint16 iTickspersec; - mng_uint32 iFramessize; - mng_ptr pFrames; - } mng_mpng_obj; -typedef mng_mpng_obj * mng_mpng_objp; -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ANG_PROPOSAL -typedef struct { /* ANG object */ - mng_object_header sHeader; /* default header (DO NOT REMOVE) */ - mng_uint32 iNumframes; - mng_uint32 iTickspersec; - mng_uint32 iNumplays; - mng_uint32 iTilewidth; - mng_uint32 iTileheight; - mng_uint8 iInterlace; - mng_uint8 iStillused; - mng_uint32 iTilessize; - mng_ptr pTiles; - } mng_ang_obj; -typedef mng_ang_obj * mng_ang_objp; -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_objects_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_pixels.c b/Engine/lib/lmng/libmng_pixels.c deleted file mode 100644 index ce5637be9..000000000 --- a/Engine/lib/lmng/libmng_pixels.c +++ /dev/null @@ -1,24610 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_pixels.c copyright (c) 2000-2005 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Pixel-row management routines (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the pixel-row management routines * */ -/* * * */ -/* * the dual alpha-composing for RGBA/BGRA/etc output-canvas' * */ -/* * is based on the Note on Compositing chapter of the * */ -/* * DOH-3 draft, noted to me by Adam M. Costello * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/22/2000 - G.Juyn * */ -/* * - added JNG support * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - fixed minor bugs 16-bit pixel-handling * */ -/* * - added delta-image row-processing routines * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - fixed endian support (hopefully) * */ -/* * 0.5.2 - 06/03/2000 - G.Juyn * */ -/* * - fixed makeup for Linux gcc compile * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - implemented app bkgd restore routines * */ -/* * - implemented RGBA8, ARGB8, BGRA8 & ABGR8 display routines * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/09/2000 - G.Juyn * */ -/* * - fixed alpha-handling for alpha canvasstyles * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * 0.5.3 - 06/17/2000 - G.Juyn * */ -/* * - changed to support delta-images * */ -/* * - optimized some store_xxx routines * */ -/* * 0.5.3 - 06/20/2000 - G.Juyn * */ -/* * - fixed nasty bug with embedded PNG after delta-image * */ -/* * 0.5.3 - 06/24/2000 - G.Juyn * */ -/* * - fixed problem with 16-bit GA format * */ -/* * 0.5.3 - 06/25/2000 - G.Juyn * */ -/* * - fixed problem with cheap transparency for 4-bit gray * */ -/* * - fixed display_xxxx routines for interlaced images * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - fixed compiler-warning for non-initialized iB variable * */ -/* * * */ -/* * 0.9.1 - 07/05/2000 - G.Juyn * */ -/* * - fixed mandatory BACK color to be opaque * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - B110547 - fixed bug in interlace code * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/20/2000 - G.Juyn * */ -/* * - fixed app-supplied background restore * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 09/30/2000 - G.Juyn * */ -/* * - fixed MAGN rounding errors (thanks Matthias!) * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - fixed alpha-blending for RGBA canvasstyle * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - fixed alpha-blending for other alpha-canvasstyles * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - fixed support for bKGD * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.3 - 10/28/2000 - G.Juyn * */ -/* * - fixed tRNS processing for gray-image < 8-bits * */ -/* * * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - removed "old" MAGN methods 3 & 4 * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * - removed test filter-methods 1 & 65 * */ -/* * * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 04/25/2001 - G.Juyn * */ -/* * - moved mng_clear_cms to libmng_cms * */ -/* * * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.4 - 11/04/2001 - G.Juyn * */ -/* * - fixed possible compile-problem in cleanup_rowproc * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B558212 - off by one error * */ -/* * - MNG subimage alpha composite wrong for rgba8 images * */ -/* * * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/16/2002 - G.Juyn * */ -/* * - completed MAGN support (16-bit functions) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - optimized restore-background for bKGD cases * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - finished support for BACK image & tiling * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * * */ -/* * 1.0.6 - 03/09/2003 - G.Juyn * */ -/* * - hiding 12-bit JPEG stuff * */ -/* * 1.0.6 - 05/11/2003 - Glenn RP * */ -/* * - added size-optimization COMPOSE routine usage * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 05/25/2003 - Glenn RP * */ -/* * - added size-optimization DIV255B8 routine usage * */ -/* * 1.0.6 - 06/09/2003 - G. R-P * */ -/* * - added conditionals around 8-bit magn routines * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - removed conditionals around 8-bit magn routines * */ -/* * - added MNG_NO_16BIT_SUPPORT and MNG_NO_DELTA_PNG * */ -/* * conditionals * */ -/* * - reversed many loops to use decrementing counter * */ -/* * - combined init functions * */ -/* * - converted some switches to array references * */ -/* * 1.0.6 - 07/29/2003 - G.Juyn * */ -/* * - fixed duplicate for-loop * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals around PAST chunk support * */ -/* * - fixed "FOOTPRINT_COMPOSEIV" typo (now "FOOTPRINT_DIV") * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added more conditionals around "promote" functions * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/08/2004 - G.R-P * */ -/* * - added more conditionals around 16-bit-supporting code * */ -/* * 1.0.7 - 03/09/2004 - G.Juyn * */ -/* * - fixed bug in promote_g8_g8 with 16bit support off * */ -/* * 1.0.7 - 03/09/2004 - G.R-P * */ -/* * - more optimizations with 16bit support off * */ -/* * 1.0.7 - 03/10/2004 - G.Juyn * */ -/* * - fixed some warnings for 16bit optimizations * */ -/* * 1.0.7 - 03/21/2004 - G.Juyn * */ -/* * - fixed some 64-bit platform compiler warnings * */ -/* * * */ -/* * 1.0.8 - 06/20/2004 - G.Juyn * */ -/* * - some speed optimizations (thanks to John Stiles) * */ -/* * 1.0.8 - 08/01/2004 - G.Juyn * */ -/* * - added support for 3+byte pixelsize for JPEG's * */ -/* * * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added LITTLEENDIAN/BIGENDIAN fixtures (thanks J.Stiles) * */ -/* * - fixed MNG_NO_1_2_4BIT_SUPPORT for TBBN1G04.PNG * */ -/* * 1.0.9 - 12/31/2004 - G.R-P. * */ -/* * - fixed warnings about C++ style (//) comments * */ -/* * * */ -/* * 1.0.10 - 07/06/2005 - G.R-P. * */ -/* * - added MORE MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.10 - 10/06/2005 - G.R-P. * */ -/* * - alloc more memory for MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.10 - 12/07/2005 - G.R-P. * */ -/* * - optimized footprint of 16bit support * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_memory.h" -#include "libmng_cms.h" -#include "libmng_filter.h" -#include "libmng_pixels.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_DISPLAY_PROCS - -/* TODO: magnification & canvas-positioning/-clipping */ - -/* TODO: major optimization of pixel-loops by using assembler (?) */ - -/* ************************************************************************** */ -/* * * */ -/* * Interlace tables * */ -/* * * */ -/* ************************************************************************** */ - -MNG_LOCAL mng_uint32 const interlace_row [7] = { 0, 0, 4, 0, 2, 0, 1 }; -MNG_LOCAL mng_uint32 const interlace_rowskip [7] = { 8, 8, 8, 4, 4, 2, 2 }; -MNG_LOCAL mng_uint32 const interlace_col [7] = { 0, 4, 0, 2, 0, 1, 0 }; -MNG_LOCAL mng_uint32 const interlace_colskip [7] = { 8, 8, 4, 4, 2, 2, 1 }; -MNG_LOCAL mng_uint32 const interlace_roundoff [7] = { 7, 7, 3, 3, 1, 1, 0 }; -MNG_LOCAL mng_uint32 const interlace_divider [7] = { 3, 3, 2, 2, 1, 1, 0 }; - -/* ************************************************************************** */ -/* * * */ -/* * Alpha composing macros * */ -/* * the code below is slightly modified from the libpng package * */ -/* * the original was last optimized by Greg Roelofs & Mark Adler * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_COMPOSE8(RET,FG,ALPHA,BG) { \ - mng_uint16 iH = (mng_uint16)((mng_uint16)(FG) * (mng_uint16)(ALPHA) \ - + (mng_uint16)(BG)*(mng_uint16)(255 - \ - (mng_uint16)(ALPHA)) + (mng_uint16)128); \ - (RET) = (mng_uint8)((iH + (iH >> 8)) >> 8); } - -#define MNG_COMPOSE16(RET,FG,ALPHA,BG) { \ - mng_uint32 iH = (mng_uint32)((mng_uint32)(FG) * (mng_uint32)(ALPHA) \ - + (mng_uint32)(BG)*(mng_uint32)(65535L - \ - (mng_uint32)(ALPHA)) + (mng_uint32)32768L); \ - (RET) = (mng_uint16)((iH + (iH >> 16)) >> 16); } - -/* ************************************************************************** */ -/* * * */ -/* * Alpha blending macros * */ -/* * this code is based on Adam Costello's "Note on Compositing" from the * */ -/* * mng-list which gives the following formula: * */ -/* * * */ -/* * top pixel = (Rt, Gt, Bt, At) * */ -/* * bottom pixel = (Rb, Gb, Bb, Ab) * */ -/* * composite pixel = (Rc, Gc, Bc, Ac) * */ -/* * * */ -/* * all values in the range 0..1 * */ -/* * * */ -/* * Ac = 1 - (1 - At)(1 - Ab) * */ -/* * s = At / Ac * */ -/* * t = (1 - At) Ab / Ac * */ -/* * Rc = s Rt + t Rb * */ -/* * Gc = s Gt + t Gb * */ -/* * Bc = s Bt + t Bb * */ -/* * * */ -/* * (I just hope I coded it correctly in integer arithmetic...) * */ -/* * * */ -/* ************************************************************************** */ - -#define MNG_BLEND8(RT, GT, BT, AT, RB, GB, BB, AB, RC, GC, BC, AC) { \ - mng_uint32 S, T; \ - (AC) = (mng_uint8)((mng_uint32)255 - \ - ((((mng_uint32)255 - (mng_uint32)(AT)) * \ - ((mng_uint32)255 - (mng_uint32)(AB)) ) >> 8)); \ - S = (mng_uint32)(((mng_uint32)(AT) << 8) / \ - (mng_uint32)(AC)); \ - T = (mng_uint32)(((mng_uint32)255 - (mng_uint32)(AT)) * \ - (mng_uint32)(AB) / (mng_uint32)(AC)); \ - (RC) = (mng_uint8)((S * (mng_uint32)(RT) + \ - T * (mng_uint32)(RB) + (mng_uint32)127) >> 8); \ - (GC) = (mng_uint8)((S * (mng_uint32)(GT) + \ - T * (mng_uint32)(GB) + (mng_uint32)127) >> 8); \ - (BC) = (mng_uint8)((S * (mng_uint32)(BT) + \ - T * (mng_uint32)(BB) + (mng_uint32)127) >> 8); } - -#define MNG_BLEND16(RT, GT, BT, AT, RB, GB, BB, AB, RC, GC, BC, AC) { \ - mng_uint32 S, T; \ - (AC) = (mng_uint16)((mng_uint32)65535 - \ - ((((mng_uint32)65535 - (mng_uint32)(AT)) * \ - ((mng_uint32)65535 - (mng_uint32)(AB)) ) >> 16)); \ - S = (mng_uint32)(((mng_uint32)(AT) << 16) / \ - (mng_uint32)(AC)); \ - T = (mng_uint32)(((mng_uint32)65535 - (mng_uint32)(AT)) * \ - (mng_uint32)(AB) / (mng_uint32)(AC)); \ - (RC) = (mng_uint16)((S * (mng_uint32)(RT) + \ - T * (mng_uint32)(RB) + (mng_uint32)32767) >> 16); \ - (GC) = (mng_uint16)((S * (mng_uint32)(GT) + \ - T * (mng_uint32)(GB) + (mng_uint32)32767) >> 16); \ - (BC) = (mng_uint16)((S * (mng_uint32)(BT) + \ - T * (mng_uint32)(BB) + (mng_uint32)32767) >> 16); } - -/* ************************************************************************** */ - -/* note a good optimizing compiler will optimize this */ -#define DIV255B8(x) (mng_uint8)(((x) + 127) / 255) -#define DIV255B16(x) (mng_uint16)(((x) + 32767) / 65535) - -/* ************************************************************************** */ -/* * * */ -/* * Progressive display check - checks to see if progressive display is * */ -/* * in order & indicates so * */ -/* * * */ -/* * The routine is called after a call to one of the display_xxx routines * */ -/* * if appropriate * */ -/* * * */ -/* * The refresh is warrented in the read_chunk routine (mng_read.c) * */ -/* * and only during read&display processing, since there's not much point * */ -/* * doing it from memory! * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_check (mng_datap pData) -{ - if ((pData->bDoProgressive) && /* need progressive display? */ - ((pData->eImagetype != mng_it_mng) || (pData->iDataheight > 300)) && - (pData->iDestb - pData->iDestt > 50) && (!pData->pCurraniobj)) - { - mng_int32 iC = pData->iRow + pData->iDestt - pData->iSourcet; - - if (iC % 20 == 0) /* every 20th line */ - pData->bNeedrefresh = MNG_TRUE; - - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -/* * * */ -/* * Display routines - convert rowdata (which is already color-corrected) * */ -/* * to the output canvas, respecting the opacity information * */ -/* * * */ -/* ************************************************************************** */ - -MNG_LOCAL void check_update_region (mng_datap pData) -{ /* determine actual canvas row */ - mng_int32 iRow = pData->iRow + pData->iDestt - pData->iSourcet; - /* check for change in update-region */ - if ((pData->iDestl < (mng_int32)pData->iUpdateleft) || (pData->iUpdateright == 0)) - pData->iUpdateleft = pData->iDestl; - - if (pData->iDestr > (mng_int32)pData->iUpdateright) - pData->iUpdateright = pData->iDestr; - - if ((iRow < (mng_int32)pData->iUpdatetop) || (pData->iUpdatebottom == 0)) - pData->iUpdatetop = iRow; - - if (iRow+1 > (mng_int32)pData->iUpdatebottom) - pData->iUpdatebottom = iRow+1; - - return; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGr16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGb16 >> 8); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - } - else - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *pDataline, iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iA8, *(pScanline+2)); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGg16; - mng_uint16 iBGg16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *(pDataline+2*iBps); - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - } - else - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - /* and return the composed values */ - *(pScanline+i) = (mng_uint8)(iFGg16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - } - else - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iA8, *(pScanline+i)); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - } - else - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iA8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *pDataline, iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iA8, *(pScanline+2)); -#endif - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGBA8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgba8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *(pScanline+3) = *(pDataline+6); - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGr16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGb16 >> 8); - /* alpha remains fully opaque !!! */ - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgba8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *(pDataline+2*iBps); - *(pScanline+3) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - *(pScanline+i) = (mng_uint8)(iFGg16 >> 8); - /* alpha remains fully opaque !!! */ - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgba8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGBA8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGBA8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgba8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[4]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[2]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[4] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgba8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[4]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[2]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[4]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[4] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgba8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[0]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[2]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ -#ifdef MNG_BIGENDIAN_SUPPORTED - *(mng_uint32*)pScanline = (*(mng_uint32*)pDataline) | 0x000000FF; -#else - pScanline[0] = pDataline[0]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[2]; - pScanline[3] = 255; -#endif - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[2-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[2-i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[0] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGBA8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ARGB8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_argb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_START); -#endif - - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+4); - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+4); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+1)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+3)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8)(iFGr16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+3) = (mng_uint8)(iFGb16 >> 8); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+1)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+3)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCr16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCb16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCr8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCb8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_argb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+3*iBps); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+iBps); - *(pScanline+3) = *(pDataline+2*iBps); - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *(pDataline+4); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i+1)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - /* alpha remains fully opaque !!! */ - *(pScanline+i+1) = (mng_uint8)(iFGg16 >> 8); - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+1)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+3)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCr16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCb16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+i), iFGa8, *(pScanline+i+1)); - } - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCr8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCb8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_argb8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_START); -#endif - - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *pDataline; - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *(pDataline+2); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+i), iFGa8, *(pScanline+i+1)); - } -#else - MNG_COMPOSE8 (*(pScanline+1), *pDataline, iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2)); - MNG_COMPOSE8 (*(pScanline+3), *(pDataline+2), iFGa8, *(pScanline+3)); -#endif - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+1), *(pScanline+2), *(pScanline+3), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCr8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCb8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ARGB8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ARGB8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_argb8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[4]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[2]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[4] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_argb8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[4]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[2]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[4]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[4] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_argb8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[2]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[0]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[2]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[3-i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[3-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[0] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[2] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ARGB8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ARGB8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8_A8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb8_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination rows */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination rows starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *pAlphaline = *(pDataline+6); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGr16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGb16 >> 8); - /* alpha remains fully opaque !!! */ - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pAlphaline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb8_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination rows */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination rows starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *(pDataline+2*iBps); - *pAlphaline = *(pDataline+3*iBps); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+4); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - *(pScanline+i) = (mng_uint8)(iFGg16 >> 8); - /* alpha remains fully opaque !!! */ - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*pScanline ); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*(pScanline+2)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCr16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCb16 >> 8); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pAlphaline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb8_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination rows */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination rows starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pAlphaline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *pDataline; - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *(pDataline+2); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+i), iFGa8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *pDataline, iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+2), iFGa8, *(pScanline+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCr8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCb8; - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 3); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB8_A8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 8; - else - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGb16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGr16 >> 8); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - } - else - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGg16; - mng_uint16 iBGg16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+2*iBps); - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - } - else - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+2-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - /* and return the composed values */ - *(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - } - else - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 3) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - } - else - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); -#endif - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRX8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgrx8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 8; - else - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGb16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGr16 >> 8); - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgrx8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGg16; - mng_uint16 iBGg16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+2*iBps); - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha value */ - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+2-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - /* and return the composed values */ - *(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8); - } - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgrx8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + (pData->iSourcel / pData->iColinc) * 4; - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = 0xFF; /* filler byte */ - } - else - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iA8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iA8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iA8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iA8, *(pScanline+2)); -#endif - *(pScanline+3) = 0xFF; /* filler byte */ - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRX8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRA8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgra8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+6); - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iFGb16 >> 8); - *(pScanline+1) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGr16 >> 8); - /* alpha remains fully opaque !!! */ - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCb16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCr16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iFGa8, *(pScanline+2)); - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+2), *(pScanline+1), *pScanline, iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCb8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCr8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgra8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+2*iBps); - *(pScanline+1) = *(pDataline+iBps); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+3)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+4); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+2-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - *(pScanline+2-i) = (mng_uint8)(iFGg16 >> 8); - /* alpha remains fully opaque !!! */ - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+2)); - iBGg16 = (mng_uint16)(*(pScanline+1)); - iBGb16 = (mng_uint16)(*pScanline ); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCb16 >> 8); - *(pScanline+1) = (mng_uint8)(iCg16 >> 8); - *(pScanline+2) = (mng_uint8)(iCr16 >> 8); - *(pScanline+3) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iFGa8, *(pScanline+i)); - } - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+2), *(pScanline+1), *pScanline, iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCb8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCr8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgra8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+2); - *(pScanline+1) = *(pDataline+1); - *(pScanline+2) = *pDataline; - *(pScanline+3) = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i), *(pDataline+2-i), iFGa8, *(pScanline+i)); - } -#else - MNG_COMPOSE8 (*pScanline, *(pDataline+2), iFGa8, *pScanline ); - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+1), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *pDataline, iFGa8, *(pScanline+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+2), *(pScanline+1), *pScanline, iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCb8; - *(pScanline+1) = iCg8; - *(pScanline+2) = iCr8; - *(pScanline+3) = iCa8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRA8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRA8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgra8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { - pScanline[0] = DIV255B8(s * pDataline[4]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[0]); - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { - pScanline[0] = DIV255B8(s * pDataline[2]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[0]); - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[4] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[2] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgra8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[4-i-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[4]); - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[0]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[2]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[0]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = pDataline[4]; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[4] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[2] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgra8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i]); - } -#else - pScanline[0] = DIV255B8(s * pDataline[2]); - pScanline[1] = DIV255B8(s * pDataline[1]); - pScanline[2] = DIV255B8(s * pDataline[0]); -#endif - pScanline[3] = (mng_uint8)s; - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = pDataline[2]; - pScanline[1] = pDataline[1]; - pScanline[2] = pDataline[0]; - pScanline[3] = 255; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i]); - } - } -#else - pScanline[0] = DIV255B8(s * pDataline[2] + t * pScanline[0]); - pScanline[1] = DIV255B8(s * pDataline[1] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[0] + t * pScanline[2]); -#endif - pScanline[3] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[3]))); - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA8PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRA8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ABGR8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_abgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *(pDataline+4); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *(pDataline+4); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+3)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+1)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - /* alpha itself remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8)(iFGb16 >> 8); - *(pScanline+2) = (mng_uint8)(iFGg16 >> 8); - *(pScanline+3) = (mng_uint8)(iFGr16 >> 8); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+3)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+1)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCb16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCr16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+2), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2)); - MNG_COMPOSE8 (*(pScanline+3), *pDataline, iFGa8, *(pScanline+3)); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCb8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCr8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_abgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGg16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *pScanline = *(pDataline+3*iBps); - *(pScanline+1) = *(pDataline+2*iBps); - *(pScanline+2) = *(pDataline+iBps); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pScanline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *pScanline = *(pDataline+6); - *(pScanline+1) = *(pDataline+4); - *(pScanline+2) = *(pDataline+2); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - int i; - for (i=2; i >= 0; i--) - { - iFGg16 = mng_get_uint16 (pDataline+i+i); - /* scale background up */ - iBGg16 = (mng_uint16)(*(pScanline+3-i)); - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - /* now compose */ - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - /* and return the composed values */ - /* alpha itself remains fully opaque !!! */ - *(pScanline+3-i) = (mng_uint8)(iFGg16 >> 8); - } - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)(*(pScanline+3)); - iBGg16 = (mng_uint16)(*(pScanline+2)); - iBGb16 = (mng_uint16)(*(pScanline+1)); - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *pScanline = (mng_uint8)(iCa16 >> 8); - *(pScanline+1) = (mng_uint8)(iCb16 >> 8); - *(pScanline+2) = (mng_uint8)(iCg16 >> 8); - *(pScanline+3) = (mng_uint8)(iCr16 >> 8); - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+2-i), iFGa8, *(pScanline+i+1)); - } - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCb8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCr8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_abgr8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *pScanline; - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pScanline = *(pDataline+3); - *(pScanline+1) = *(pDataline+2); - *(pScanline+2) = *(pDataline+1); - *(pScanline+3) = *pDataline; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do simple alpha composing */ - /* alpha itself remains fully opaque !!! */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pScanline+i+1), *(pDataline+2-i), iFGa8, *(pScanline+i+1)); - } -#else - MNG_COMPOSE8 (*(pScanline+1), *(pDataline+2), iFGa8, *(pScanline+1)); - MNG_COMPOSE8 (*(pScanline+2), *(pDataline+1), iFGa8, *(pScanline+2)); - MNG_COMPOSE8 (*(pScanline+3), *pDataline, iFGa8, *(pScanline+3)); -#endif - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - *(pScanline+3), *(pScanline+2), *(pScanline+1), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pScanline = iCa8; - *(pScanline+1) = iCb8; - *(pScanline+2) = iCg8; - *(pScanline+3) = iCr8; - } - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ABGR8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_ABGR8_PM -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_abgr8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_abgr8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - if ((s = pDataline[6]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4]); - pScanline[2] = DIV255B8(s * pDataline[2]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - if ((s = pDataline[6]) != 0) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if (s == 255) - { /* plain copy it */ - pScanline[0] = 255; - pScanline[1] = pDataline[4]; - pScanline[2] = pDataline[2]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[4-i-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[4] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[2] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_abgr8_pm (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint32 s, t; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl << 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values and premultiply */ - if ((s = pDataline[3]) == 0) - *(mng_uint32*) pScanline = 0; /* set all components = 0 */ - else - { - if (s == 255) - { - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { - pScanline[0] = (mng_uint8)s; -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2]); - pScanline[2] = DIV255B8(s * pDataline[1]); - pScanline[3] = DIV255B8(s * pDataline[0]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - if ((s = pDataline[3]) != 0) /* any opacity at all ? */ - { /* fully opaque ? */ - if (s == 255) - { /* then simply copy the values */ - pScanline[0] = 255; - pScanline[1] = pDataline[2]; - pScanline[2] = pDataline[1]; - pScanline[3] = pDataline[0]; - } - else - { /* now blend (premultiplied) */ - t = 255 - s; - pScanline[0] = (mng_uint8)(255 - DIV255B8(t * (255 - pScanline[0]))); -#ifdef MNG_OPTIMIZE_FOOTPRINT_DIV - { - int i; - for (i=2; i >= 0; i--) - { - pScanline[i+1] = DIV255B8(s * pDataline[2-i] + t * - pScanline[i+1]); - } - } -#else - pScanline[1] = DIV255B8(s * pDataline[2] + t * pScanline[1]); - pScanline[2] = DIV255B8(s * pDataline[1] + t * pScanline[2]); - pScanline[3] = DIV255B8(s * pDataline[0] + t * pScanline[3]); -#endif - } - } - - pScanline += (pData->iColinc << 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_ABGR8_PM, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_ABGR8_PM */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ( (*(pDataline+2)&0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | - ( (*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) | - ( (*(pDataline+iBps)&0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( ( *(pDataline+4)) & 0xF8) | (*(pDataline+2) >> 5 ) ); - *pScanline = (mng_uint8)( ( ( *(pDataline )) >> 3 ) | ((*(pDataline+2) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | (*(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+4)) & 0xF8) | (*(pDataline+2)>>5) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ((*(pDataline+2)&0xFC) << 3) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( *(pScanline+1) & 0xF8 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0) >> 3 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)((iFGb16 >> 8) &0xF8) | ( (mng_uint8)(iFGg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8)( (mng_uint8) (iFGr16 >>11) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( *(pScanline+1) & 0xF8); - iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( ( *(pDataline+2*iBps)) & 0xF8) | - (*(pDataline+iBps) >> 5 ) ); - *pScanline = (mng_uint8)( ( ( *(pDataline )) >> 3 ) | - ((*(pDataline+iBps) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+4)) & 0xF8) | (*(pDataline+2)>>5) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ((*(pDataline+2)&0xFC) << 3) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( *(pScanline+1) & 0xF8 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0) >> 3 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)((iFGb16 >> 8) &0xF8) | ( (mng_uint8)(iFGg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8)( (mng_uint8) (iFGr16 >>11) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( *(pScanline+1) & 0xF8); - iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | (*(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xFC) << 3) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) & 0xF8) | ( *(pDataline+1) >> 5 ) ); - *pScanline = (mng_uint8)( ( (*(pDataline )) >> 3 ) | ( (*(pDataline+1) & 0xFC) << 3 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( *(pScanline+1) & 0xF8); - iGreen = (mng_uint8)( ( *(pScanline+1) << 5 ) | ( ( (*pScanline)&0xE0)>>3 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( iRed & 0xF8) | ( iGreen >> 5 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRA565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgra565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ( (*(pDataline+2)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+6); - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCb16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgra565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | - ( (*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) | - ( (*(pDataline+iBps)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCb16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgra565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGRA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGRA565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGBA565 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgba565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+4))&0xF8 ) | ( (*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline)) >>3) | ( (*(pDataline+2)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+6); - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline+4))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGb16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGr16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCb16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCr16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iRed = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgba565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint16 iFGa16, iBGa16, iCa16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2*iBps))&0xF8 ) | - ( (*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline)) >>3) | - ( (*(pDataline+iBps)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3*iBps); - - pScanline += (pData->iColinc * 3); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* get alpha values */ - iFGa16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*(pScanline+2)); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* plain copy it */ - *(pScanline+1) = (mng_uint8)( (*(pDataline+4))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *(pScanline+2) = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iFGa16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGb16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGr16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - } - else - { /* scale background up */ - iBGr16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGb16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCb16 >> 8) & 0xF8 ) | ( (mng_uint8)(iCg16 >> 8) >> 5 ) ); - *pScanline = (mng_uint8) ( ( (iCr16 >> 11) ) | (((mng_uint8)(iCg16 >> 8) & 0xFC) << 3) ); - *(pScanline+2) = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 3); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iRed = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgba565 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol << 2) + (pData->iDestl * 3); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2))&0xF8 ) | ( (*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline) >>3 ) | ( (*(pDataline+1)&0xFC ) << 3) ); - *(pScanline+2) = *(pDataline+3); - - pScanline += (pData->iColinc * 3); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iFGa8 = *(pDataline+3); /* get alpha values */ - iBGa8 = *(pScanline+2); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline+2)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *(pScanline+2) = *(pDataline+3); - } - else - { - mng_uint8 iRed, iGreen, iBlue; - - iBlue = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | ( ((*pScanline) & 0xE0)>>3 ) ); - iRed = (mng_uint8) ( (*pScanline << 3) ); - - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE8 (iRed, *pDataline, iFGa8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iFGa8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iFGa8, iBlue ); - /* alpha remains fully opaque !!! */ - *(pScanline+1) = (mng_uint8) ( ( iBlue & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iRed >> 3 ) | ( (iGreen & 0xFC) << 3) ); - } - else - { /* now blend */ - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iFGa8, - iRed , iGreen , iBlue , iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - - - *pScanline = (mng_uint8) ( ( iCr8 >> 3 ) | ( (iCg8 & 0xFC) << 3) ); - *(pScanline+1) = (mng_uint8) ( ( iCb8 & 0xF8 ) | (iCg8>>5) ); - *(pScanline+2) = (mng_uint8) iCa8; - } - } - } - - pScanline += (pData->iColinc *3); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGBA565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGBA565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR565_A8 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr565_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16, iBGa16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - mng_uint8 iA8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row -starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+2)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+4)) >>3) | ((*(pDataline+2)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+6)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ((*(pDataline+1)&0xFC ) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+3)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else /* Not fully opaque */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iA16) /* any opacity at all ? */ - { - if ((iA16 == 0xFFFF) || (iBGa16 == 0)) /* fully opaque or background fully transparent ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { - /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iA16>>8); - } - else /* background is not fully opaque */ - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iA16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8)&0xF8 ) | ( (mng_uint8)(iCg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iCb16>>11) ) | (((mng_uint8)(iCg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; -iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - iBGa8 = *pAlphaline; - - if (iA8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iA8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { - /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) ); - *pAlphaline = iA8; - } - else /* background not fully opaque */ - { - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) ); - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr565_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16, iBGa16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - mng_uint8 iA8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - mng_uint8 iBps; - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row -starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | - ((*(pDataline+iBps)>>5) ) ); - *pScanline = (mng_uint8)( ( (*(pDataline+2*iBps)) >>3) | - ((*(pDataline+iBps)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+6)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else /* Not fully opaque */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - iBGa16 = (mng_uint16)(*pAlphaline); - iBGa16 = (mng_uint16)(iBGa16 << 8) | iBGa16; - - if (iA16) /* any opacity at all ? */ - { - if ((iA16 == 0xFFFF) || (iBGa16 == 0)) /* fully opaque or background fully transparent ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( (*(pDataline))&0xF8 ) | (mng_uint8)( (*(pDataline+2)>>5 ) ); - *pScanline = (mng_uint8)( (*(pDataline+4)) >>3) | (mng_uint8)( (*(pDataline+2)&0xFC) << 3); - *pAlphaline = *(pDataline+6); - } - else - { - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { - /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - /* scale background up */ - - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iFGr16 >> 8)&0xF8 ) | ( (mng_uint8)(iFGg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iFGb16>>11) ) | (((mng_uint8)(iFGg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iA16>>8); - } - else /* background is not fully opaque */ - { /* scale background up */ - iBGb16 = (mng_uint16)( (*(pScanline+1)) & 0xF8 ); - iBGg16 = (mng_uint16)( (*(pScanline+1) << 5) | (((*(pScanline )) & 0xE0) >>3 ) ); - iBGr16 = (mng_uint16)( (*(pScanline )) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* let's blend */ - MNG_BLEND16 (mng_get_uint16 (pDataline ), - mng_get_uint16 (pDataline+2), - mng_get_uint16 (pDataline+4), iA16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( (iCr16 >> 8)&0xF8 ) | ( (mng_uint8)(iCg16>>8) >> 5) ); - *pScanline = (mng_uint8) ( ( (iCb16>>11) ) | (((mng_uint8)(iCg16>>8)&0xFC) << 3) ); - *pAlphaline = (mng_uint8)(iCa16 >> 8); - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; -iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - iBGa8 = *pAlphaline; - - if (iA8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iA8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { - /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) ); - *pAlphaline = iA8; - } - else /* background not fully opaque */ - { - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) ); - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr565_a8 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pAlphaline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8, iBGa8, iCa8; - mng_uint8 iCr8, iCg8, iCb8; - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - pAlphaline = (mng_uint8p)pData->fGetalphaline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row -starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pAlphaline = pAlphaline + pData->iCol + pData->iDestl; - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline))&0xF8 ) | ((*(pDataline+1)>>5 ) ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >>3 ) | ((*(pDataline+1)&0xFC ) << 3) ); - *pAlphaline = (mng_uint8)(*(pDataline+3)); - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - else /* Not fully opaque */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; -iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - iBGa8 = *pAlphaline; - - if (iA8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iA8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ( (*(pDataline)) &0xF8 ) | (*(pDataline+1) >>5 ) ); - *pScanline = (mng_uint8)( ( ((*(pDataline+2))>>3) ) | ((*(pDataline+1)&0xFC) << 3) ); - *pAlphaline = *(pDataline+3); - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { - /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8) ( *(pScanline+1) & 0xF8 ); - iGreen = (mng_uint8) ( (*(pScanline+1) << 5) | (((*pScanline) & 0xE0)>>3 ) ); - iBlue = (mng_uint8) ( (*pScanline << 3) ); - - MNG_COMPOSE8 (iRed, *pDataline, iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8) ( ( iRed & 0xF8 ) | (iGreen>>5) ); - *pScanline = (mng_uint8) ( ( iBlue >> 3 ) | ((iGreen & 0xFC) << 3) ); - *pAlphaline = iA8; - } - else /* background not fully opaque */ - { - MNG_BLEND8 (*pDataline, *(pDataline+1), *(pDataline+2), iA8, - *pScanline, *(pScanline+1), *(pScanline+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8) ( ( iCr8 & 0xF8 ) | (iCg8>>5) ); - *pScanline = (mng_uint8) ( ( iCb8 >> 3 ) | ((iCg8 & 0xFC) << 3) ); - *pAlphaline = iCa8; - } - } - } - - pScanline += (pData->iColinc * 2); - pAlphaline += pData->iColinc; - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR565_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR565_A8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB555 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_rgb555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGb16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGr16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_rgb555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2*iBps) & 0xF8) >> 1 ) | (*(pDataline+iBps) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+iBps) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+4) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGr16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGb16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGb16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGr16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_rgb555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline+2) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline ) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+2), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+0), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_RGB555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_RGB555 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR555 -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_COMPOSE -mng_retcode mng_display_bgr555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - if (pData->bIsRGBA16) /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 3); - else - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGb16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGr16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGr16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGb16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#else /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -mng_retcode mng_display_bgr555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint16 iA16; - mng_uint16 iFGr16, iFGg16, iFGb16; - mng_uint16 iBGr16, iBGg16, iBGb16; - mng_uint8 iA8; - mng_uint8 iBps; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_START); -#endif - - iBps=(mng_uint8)(pData->bIsRGBA16 ? 2:1); - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - /* adjust source row starting-point */ - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << (iBps+1)); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+iBps) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2*iBps) >> 3 ) | ((*(pDataline+iBps) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4*iBps; - } - } - else - { - if (pData->bIsRGBA16) /* 16-bit input row ? */ - { - - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA16 = mng_get_uint16 (pDataline+6); - - if (iA16) /* any opacity at all ? */ - { - if (iA16 == 0xFFFF) /* fully opaque ? */ - { /* scale down by dropping the LSB */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+2) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+4) >> 3 ) | ((*(pDataline+2) & 0xF8) << 2 ) ); - } - else - { /* get the proper values */ - iFGr16 = mng_get_uint16 (pDataline ); - iFGg16 = mng_get_uint16 (pDataline+2); - iFGb16 = mng_get_uint16 (pDataline+4); - - /* scale background up */ - iBGb16 = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iBGg16 = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBGr16 = (mng_uint8)( *(pScanline ) << 3 ); - - iBGr16 = (mng_uint16)((mng_uint32)iBGr16 << 8) | iBGr16; - iBGg16 = (mng_uint16)((mng_uint32)iBGg16 << 8) | iBGg16; - iBGb16 = (mng_uint16)((mng_uint32)iBGb16 << 8) | iBGb16; - /* now compose */ - MNG_COMPOSE16(iFGr16, iFGr16, iA16, iBGr16); - MNG_COMPOSE16(iFGg16, iFGg16, iA16, iBGg16); - MNG_COMPOSE16(iFGb16, iFGb16, iA16, iBGb16); - /* and return the composed values */ - *(pScanline+1) = (mng_uint8)( (mng_uint8)(((iFGr16 >> 8) & 0xF8) >> 1 ) | ( (mng_uint8)(iFGg16 >> 8) >> 6 ) ); - *pScanline = (mng_uint8)( (mng_uint8) ((iFGb16 >>11) >> 3 ) | ( ( (mng_uint8)(iFGg16 >> 8) & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 8; - } - } - else - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_OPTIMIZE_FOOTPRINT_COMPOSE */ -#else /* MNG_NO_16BIT_SUPPORT */ -mng_retcode mng_display_bgr555 (mng_datap pData) -{ - mng_uint8p pScanline; - mng_uint8p pDataline; - mng_int32 iX; - mng_uint8 iA8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_START); -#endif - /* viewable row ? */ - if ((pData->iRow >= pData->iSourcet) && (pData->iRow < pData->iSourceb)) - { /* address destination row */ - pScanline = (mng_uint8p)pData->fGetcanvasline (((mng_handle)pData), - pData->iRow + pData->iDestt - - pData->iSourcet); - /* adjust destination row starting-point */ - pScanline = pScanline + (pData->iCol * 2) + (pData->iDestl * 2); - pDataline = pData->pRGBArow; /* address source row */ - - pDataline = pDataline + ((pData->iSourcel / pData->iColinc) << 2); - - if (pData->bIsOpaque) /* forget about transparency ? */ - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { /* copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - else - { - { - for (iX = pData->iSourcel + pData->iCol; iX < pData->iSourcer; - iX += pData->iColinc) - { - iA8 = *(pDataline+3); /* get alpha value */ - - if (iA8) /* any opacity at all ? */ - { - if (iA8 == 0xFF) /* fully opaque ? */ - { /* then simply copy the values */ - *(pScanline+1) = (mng_uint8)( ((*(pDataline ) & 0xF8) >> 1 ) | (*(pDataline+1) >> 6 ) ); - *pScanline = (mng_uint8)( ( *(pDataline+2) >> 3 ) | ((*(pDataline+1) & 0xF8) << 2 ) ); - } - else - { /* do alpha composing */ - mng_uint8 iRed, iGreen, iBlue; - - iRed = (mng_uint8)( (*(pScanline+1) & 0xF8) << 1 ); - iGreen = (mng_uint8)( (*(pScanline+1) << 6 ) | ( ((*pScanline) & 0xE0) >> 2 ) ); - iBlue = (mng_uint8)( *(pScanline ) << 3 ); - - MNG_COMPOSE8 (iRed, *(pDataline+0), iA8, iRed ); - MNG_COMPOSE8 (iGreen, *(pDataline+1), iA8, iGreen ); - MNG_COMPOSE8 (iBlue, *(pDataline+2), iA8, iBlue ); - - *(pScanline+1) = (mng_uint8)( ( (iRed & 0xF8) >> 1 ) | ( iGreen >> 6 ) ); - *pScanline = (mng_uint8)( (iBlue >> 3 ) | ( (iGreen & 0xF8) << 2 ) ); - } - } - - pScanline += (pData->iColinc * 2); - pDataline += 4; - } - } - } - } - - check_update_region (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_BGR555, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_SKIPCANVAS_BGR555 */ - - -#ifndef MNG_SKIPCHUNK_BACK -/* ************************************************************************** */ -/* * * */ -/* * Background restore routines - restore the background with info from * */ -/* * the BACK and/or bKGD chunk or the app's background canvas * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_backimage (mng_datap pData) -{ - /* save some stuff */ - mng_uint8p pRGBArow = pData->pRGBArow; - mng_int32 iRow = pData->iRow; - mng_int32 iRowsamples = pData->iRowsamples; - - mng_retcode iRetcode; /* work variables */ - mng_uint8p pTemp; - mng_uint8p pWork = pRGBArow; - mng_uint32 iX; - mng_int32 iZ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKIMAGE, MNG_LC_START); -#endif - /* determine row to retrieve */ - pData->iRow = pData->iDestt + iRow + pData->iBackimgoffsy; - - while (pData->iRow >= (mng_int32)pData->iBackimgheight) - pData->iRow -= (mng_int32)pData->iBackimgheight; - /* set width to that of background image */ - pData->iRowsamples = pData->iBackimgwidth; - /* retrieve into alternate buffer ! */ - pData->pRGBArow = pData->pPrevrow; - /* get it then */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - - if (iRetcode) /* on error; bail out */ - return iRetcode; - /* we got the full row; but now need to - paste it into the proper location */ - iX = pData->iDestl - pData->iBackimgoffsx; - - while (iX >= pData->iBackimgwidth) - iX -= pData->iBackimgwidth; - -#ifndef MNG_NO_16BIT_SUPPORT - if (pData->bIsRGBA16) /* 16-bit buffer ? */ - { - pTemp = pData->pPrevrow + (iX << 3); - - for (iZ = (pData->iDestr - pData->iDestl); iZ > 0; iZ--) - { - MNG_COPY (pWork, pTemp, 8); - - pWork += 8; - pTemp += 8; - iX++; - /* reached end of bkgd-image line ? */ - if (iX >= pData->iBackimgwidth) - { - iX = 0; - pTemp = pData->pPrevrow; - } - } - } - else -#endif - { - pTemp = pData->pPrevrow + (iX << 2); - - for (iZ = (pData->iDestr - pData->iDestl); iZ > 0; iZ--) - { - MNG_COPY (pWork, pTemp, 4); - - pWork += 4; - pTemp += 4; - iX++; - /* reached end of bkgd-image line ? */ - if (iX >= pData->iBackimgwidth) - { - iX = 0; - pTemp = pData->pPrevrow; - } - } - } - - pData->pRGBArow = pRGBArow; /* restore original values */ - pData->iRow = iRow; - pData->iRowsamples = iRowsamples; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKIMAGE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_backcolor (mng_datap pData) -{ - mng_int32 iX; - mng_uint32p pWork32 = (mng_uint32p)pData->pRGBArow; - mng_uint32 iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKCOLOR, MNG_LC_START); -#endif - -#ifdef MNG_BIGENDIAN_SUPPORTED - /* fast way for big endian */ - iWrite = (((mng_uint8)(pData->iBACKred >> 8)) << 24) | - (((mng_uint8)(pData->iBACKgreen >> 8)) << 16) | - (((mng_uint8)(pData->iBACKblue >> 8)) << 8) | - ( 0xFF ); -#elif defined(MNG_LITTLEENDIAN_SUPPORTED) - /* fast way for little endian */ - iWrite = ( 0xFF << 24) | - (((mng_uint8)(pData->iBACKblue >> 8)) << 16) | - (((mng_uint8)(pData->iBACKgreen >> 8)) << 8) | - (((mng_uint8)(pData->iBACKred >> 8)) ); -#else - /* generic way, works on all platforms */ - /* put the data in memory in the correct order */ - { - mng_uint8 aBytes[4]; - aBytes[0] = (mng_uint8)(pData->iBACKred >> 8); - aBytes[1] = (mng_uint8)(pData->iBACKgreen >> 8); - aBytes[2] = (mng_uint8)(pData->iBACKblue >> 8); - aBytes[3] = 0xFF; - /* load that data into a register */ - iWrite = *(mng_uint32*) aBytes; - } -#endif - /* ok; drop the background-color in there */ - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - *pWork32++ = iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BACKCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_bKGD -mng_retcode mng_restore_bkgd_bkgd (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pWork = pData->pRGBArow; - mng_imagep pImage = (mng_imagep)pData->pCurrentobj; - mng_imagedatap pBuf = pImage->pImgbuf; - mng_uint8 iRed = 0; - mng_uint8 iGreen = 0; - mng_uint8 iBlue = 0; - mng_uint32p pWork32 = (mng_uint32p)pWork; - mng_uint32 iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BKGD, MNG_LC_START); -#endif - - switch (pBuf->iColortype) - { - case 0 : ; /* gray types */ - case 4 : { - mng_uint8 iGray; - -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - iGray = (mng_uint8)(pBuf->iBKGDgray >> 8); - else -#endif - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - /* LBR scaling */ - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - iGray = (mng_uint8)(multiplier[pBuf->iBitdepth] * pBuf->iBKGDgray); -#else - iGray = (mng_uint8)pBuf->iBKGDgray; -#endif - } - - iRed = iGray; - iGreen = iGray; - iBlue = iGray; - - break; - } - - case 3 : { /* indexed type */ - iRed = pBuf->aPLTEentries [pBuf->iBKGDindex].iRed; - iGreen = pBuf->aPLTEentries [pBuf->iBKGDindex].iGreen; - iBlue = pBuf->aPLTEentries [pBuf->iBKGDindex].iBlue; - - break; - } - - case 2 : ; /* rgb types */ - case 6 : { -#ifndef MNG_NO_16BIT_SUPPORT - if (pBuf->iBitdepth > 8) - { - iRed = (mng_uint8)(pBuf->iBKGDred >> 8); - iGreen = (mng_uint8)(pBuf->iBKGDgreen >> 8); - iBlue = (mng_uint8)(pBuf->iBKGDblue >> 8); - } - else -#endif - { - iRed = (mng_uint8)(pBuf->iBKGDred ); - iGreen = (mng_uint8)(pBuf->iBKGDgreen); - iBlue = (mng_uint8)(pBuf->iBKGDblue ); - } - - break; - } - } - -#ifdef MNG_BIGENDIAN_SUPPORTED - /* fast way for big endian */ - iWrite = (iRed << 24) | - (iGreen << 16) | - (iBlue << 8); -#elif defined(MNG_LITTLEENDIAN_SUPPORTED) - /* fast way for little endian */ - iWrite = (iBlue << 16) | - (iGreen << 8) | - (iRed ); -#else - /* generic way, works on all platforms */ - /* put the data in memory in the correct order */ - { - mng_uint8 aBytes[4]; - aBytes[0] = (mng_uint8)(iRed); - aBytes[1] = (mng_uint8)(iGreen); - aBytes[2] = (mng_uint8)(iBlue); - aBytes[3] = 0x00; - /* load that data into a register */ - iWrite = *(mng_uint32*) aBytes; - } -#endif - /* ok; drop it in there */ - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - *pWork32++ = iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_bgcolor (mng_datap pData) -{ - mng_int32 iX; - mng_uint32p pWork32 = (mng_uint32p)pData->pRGBArow; - mng_uint32 iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGCOLOR, MNG_LC_START); -#endif - -#ifdef MNG_BIGENDIAN_SUPPORTED - /* fast way for big endian */ - iWrite = (((mng_uint8)(pData->iBGred >> 8)) << 24) | - (((mng_uint8)(pData->iBGgreen >> 8)) << 16) | - (((mng_uint8)(pData->iBGblue >> 8)) << 8); -#elif defined(MNG_LITTLEENDIAN_SUPPORTED) - /* fast way for little endian */ - iWrite = (((mng_uint8)(pData->iBGblue >> 8)) << 16) | - (((mng_uint8)(pData->iBGgreen >> 8)) << 8) | - (((mng_uint8)(pData->iBGred >> 8)) ); -#else - /* generic way, works on all platforms */ - /* put the data in memory in the correct order */ - { - mng_uint8 aBytes[4]; - aBytes[0] = (mng_uint8)(pData->iBGred >> 8); - aBytes[1] = (mng_uint8)(pData->iBGgreen >> 8); - aBytes[2] = (mng_uint8)(pData->iBGblue >> 8); - aBytes[3] = 0x00; - /* load that data into a register */ - iWrite = *(mng_uint32*) aBytes; - } -#endif - /* ok; drop the background-color in there */ - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - *pWork32++ = iWrite; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8 -mng_retcode mng_restore_bkgd_rgb8 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB8, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = *pBkgd; /* ok; copy the pixel */ - *(pWork+1) = *(pBkgd+1); - *(pWork+2) = *(pBkgd+2); - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_RGB8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR8 -mng_retcode mng_restore_bkgd_bgr8 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR8, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = *(pBkgd+2); /* ok; copy the pixel */ - *(pWork+1) = *(pBkgd+1); - *(pWork+2) = *pBkgd; - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_BGR8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGRX8 -mng_retcode mng_restore_bkgd_bgrx8 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGRX8, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = *(pBkgd+2); /* ok; copy the pixel */ - *(pWork+1) = *(pBkgd+1); - *(pWork+2) = *pBkgd; - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGRX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_BGRX8 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_BGR565 -mng_retcode mng_restore_bkgd_bgr565 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR565, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = (mng_uint8)( *(pBkgd+1) & 0xF8); /* ok; copy the pixel */ - *(pWork+1) = (mng_uint8)( (*(pBkgd+1) << 5 ) | ( ((*pBkgd)&0xE0)>>3 ) ); - *(pWork+2) = (mng_uint8)( *(pBkgd) << 3 ); - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_BGR565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_BGR565 */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB565 -mng_retcode mng_restore_bkgd_rgb565 (mng_datap pData) -{ - mng_int32 iX; - mng_uint8p pBkgd; - mng_uint8p pWork = pData->pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB565, MNG_LC_START); -#endif - - if (pData->fGetbkgdline) /* can we access the background ? */ - { /* point to the right pixel then */ - pBkgd = (mng_uint8p)pData->fGetbkgdline ((mng_handle)pData, - pData->iRow + pData->iDestt) + - (3 * pData->iDestl); - - for (iX = (pData->iSourcer - pData->iSourcel); iX > 0; iX--) - { - *pWork = (mng_uint8)( *(pBkgd)&0xF8); /* ok; copy the pixel */ - *(pWork+1) = (mng_uint8)( (*(pBkgd+1) << 5) | ( ((*pBkgd)&0xE0)>>3 ) ); - *(pWork+2) = (mng_uint8)( *(pBkgd+1) << 3); - *(pWork+3) = 0x00; /* transparant for alpha-canvasses */ - - pWork += 4; - pBkgd += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RESTORE_RGB565, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SKIPCANVAS_RBB565 */ - - -/* ************************************************************************** */ -/* * * */ -/* * Row retrieval routines - retrieve processed & uncompressed row-data * */ -/* * from the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -/* TODO: a serious optimization is to retrieve only those pixels that will - actually be displayed; this would require changes in - the "display_image" routine (in mng_display.c) & - all the "retrieve_xxx" routines below & - the "display_xxx" routines above !!!!! - NOTE that "correct_xxx" routines would not require modification */ - -mng_retcode mng_retrieve_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = *pWorkrow; /* get the gray-value */ - /* is it transparent ? */ - if ((mng_uint16)iG == pBuf->iTRNSgray) - { - *pRGBArow = 0x00; /* nuttin to display */ - *(pRGBArow+1) = 0x00; - *(pRGBArow+2) = 0x00; - *(pRGBArow+3) = 0x00; - } - else - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - iG = (mng_uint8)(iG * multiplier[pBuf->iBitdepth]); -#endif - - *pRGBArow = iG; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iG; - *(pRGBArow+3) = 0xFF; - } - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; /* LBR scaling */ - iG = (mng_uint8)(multiplier[pBuf->iBitdepth] * *pWorkrow); -#else - iG = *pWorkrow; /* get the gray-value */ -#endif - - *pRGBArow = iG; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iG; - *(pRGBArow+3) = 0xFF; - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = mng_get_uint16 (pWorkrow); /* get the gray-value */ - /* is it transparent ? */ - if (iG == pBuf->iTRNSgray) - { /* nuttin to display */ - mng_put_uint16 (pRGBArow, 0x0000); - mng_put_uint16 (pRGBArow+2, 0x0000); - mng_put_uint16 (pRGBArow+4, 0x0000); - mng_put_uint16 (pRGBArow+6, 0x0000); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iG); - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iG); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pWorkrow += 2; /* next pixel */ - pRGBArow += 8; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = mng_get_uint16 (pWorkrow); /* get the gray-value */ - - mng_put_uint16 (pRGBArow, iG); /* and put in intermediate row */ - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iG); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pWorkrow += 2; /* next pixel */ - pRGBArow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iR, iG, iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = *pWorkrow; /* get the rgb-values */ - iG = *(pWorkrow+1); - iB = *(pWorkrow+2); - /* is it transparent ? */ - if (((mng_uint16)iR == pBuf->iTRNSred ) && - ((mng_uint16)iG == pBuf->iTRNSgreen) && - ((mng_uint16)iB == pBuf->iTRNSblue ) ) - { - *pRGBArow = 0x00; /* nothing to display */ - *(pRGBArow+1) = 0x00; - *(pRGBArow+2) = 0x00; - *(pRGBArow+3) = 0x00; - } - else - { - *pRGBArow = iR; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; - } - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRGBArow = *pWorkrow; /* just copy the pixel */ - *(pRGBArow+1) = *(pWorkrow+1); - *(pRGBArow+2) = *(pWorkrow+2); - *(pRGBArow+3) = 0xFF; - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iR, iG, iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = mng_get_uint16 (pWorkrow); /* get the rgb-values */ - iG = mng_get_uint16 (pWorkrow+2); - iB = mng_get_uint16 (pWorkrow+4); - /* is it transparent ? */ - if ((iR == pBuf->iTRNSred ) && - (iG == pBuf->iTRNSgreen) && - (iB == pBuf->iTRNSblue ) ) - { /* nothing to display */ - mng_put_uint16 (pRGBArow, 0x0000); - mng_put_uint16 (pRGBArow+2, 0x0000); - mng_put_uint16 (pRGBArow+4, 0x0000); - mng_put_uint16 (pRGBArow+6, 0x0000); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iR); - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iB); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* just copy the pixel */ - mng_put_uint16 (pRGBArow, mng_get_uint16 (pWorkrow )); - mng_put_uint16 (pRGBArow+2, mng_get_uint16 (pWorkrow+2)); - mng_put_uint16 (pRGBArow+4, mng_get_uint16 (pWorkrow+4)); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_idx8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_IDX8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - - if (pBuf->bHasTRNS) /* tRNS in buffer ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get the index */ - /* is it valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - *(pRGBArow+3) = pBuf->aTRNSentries [iQ]; - else - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get the index */ - /* is it valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pWorkrow++; /* next pixel */ - pRGBArow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = *pWorkrow; /* get the gray-value */ - *pRGBArow = iG; /* put in intermediate row */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iG; - *(pRGBArow+3) = *(pWorkrow+1); - - pWorkrow += 2; /* next pixel */ - pRGBArow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iG; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iG = mng_get_uint16 (pWorkrow); /* get the gray-value */ - - mng_put_uint16 (pRGBArow, iG); /* and put in intermediate row */ - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iG); - mng_put_uint16 (pRGBArow+6, mng_get_uint16 (pWorkrow+2)); - - pWorkrow += 4; /* next pixel */ - pRGBArow += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_retrieve_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA8, MNG_LC_START); -#endif - - pRGBArow = pData->pRGBArow; /* temporary work pointers */ - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - /* can't be easier than this ! */ - MNG_COPY (pRGBArow, pWorkrow, pBuf->iRowsize); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pRetrieveobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pRGBArow = pData->pRGBArow; - pWorkrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize); - /* can't be easier than this ! */ - MNG_COPY (pRGBArow, pWorkrow, pBuf->iRowsize); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RETRIEVE_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_g1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - *pOutrow = 0x01; /* white */ - else - *pOutrow = 0x00; /* black */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_g2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - - iQ = (mng_uint8)((iB & iM) >> iS); /* get the gray level */ - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_g4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - - iQ = (mng_uint8)((iB & iM) >> iS); /* get the gray level */ - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* copy into object buffer */ - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow)); - - pOutrow += (pData->iColinc << 1); /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy the RGB bytes */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pWorkrow += 3; /* next pixel */ - pOutrow += (pData->iColinc * 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 6); /* copy the RGB bytes */ - - pWorkrow += 6; /* next pixel */ - pOutrow += (pData->iColinc * 6); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_idx1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* store the index */ - *pOutrow = 0x01; - else - *pOutrow = 0x00; - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_idx2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* store the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_idx4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* store the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_idx8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_store_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy the GA bytes */ - *(pOutrow+1) = *(pWorkrow+1); - - pWorkrow += 2; /* next pixel */ - pOutrow += (pData->iColinc << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 4); /* copy the GA bytes */ - - pWorkrow += 4; /* next pixel */ - pOutrow += (pData->iColinc << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy the RGBA bytes */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - - pWorkrow += 4; /* next pixel */ - pOutrow += (pData->iColinc << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 8); /* copy the RGBA bytes */ - - pWorkrow += 8; /* next pixel */ - pOutrow += (pData->iColinc << 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines (JPEG) - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - /* easy as pie ... */ - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of gray-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; -#if RGB_PIXELSIZE != 3 - mng_int32 iX; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - -#if RGB_PIXELSIZE == 3 - /* easy as pie ... */ - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples * 3); -#else -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy pixel into object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pOutrow += 3; /* next pixel */ - pWorkrow += RGB_PIXELSIZE; - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of rgb-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_GA8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy into object buffer */ - - pOutrow += 2; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_GA8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of gray-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pJPEGrow; /* temporary work pointers */ - pOutrow = pBuf->pImgdata + (pData->iJPEGrow * pBuf->iRowsize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* copy pixel into object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pOutrow += 4; /* next pixel */ - pWorkrow += RGB_PIXELSIZE; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGBA8, MNG_LC_END); -#endif - - return mng_next_jpeg_row (pData); /* we've got one more row of rgb-samples */ -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_alpha (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_ALPHA, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pJPEGrow2; - pOutrow = pBuf->pImgdata + (pData->iJPEGalpharow * pBuf->iRowsize) + 1; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += 2; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_ALPHA, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_alpha (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_ALPHA, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pJPEGrow2; - pOutrow = pBuf->pImgdata + (pData->iJPEGalpharow * pBuf->iRowsize) + 3; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += 4; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_ALPHA, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it opaque ? */ - *pOutrow = 0xFF; /* opaque */ - else - *pOutrow = 0x00; /* transparent */ - - pOutrow += 2; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A1, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_a2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - { - const mng_uint8 alpha_level[4] = { 0x00, 0x55, 0xAA, 0xFF}; - *pOutrow = alpha_level[((iB & iM) >> iS)] ; - } -#else - switch ((iB & iM) >> iS) /* determine the alpha level */ - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += 2; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A2, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_a4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the alpha level */ - iQ = (mng_uint8)((iB & iM) >> iS); - iQ = (mng_uint8)(iQ + (iQ << 4)); /* expand to 8-bit by replication */ - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += 2; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A4, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_g8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += 2; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A8, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* only high-order byte! */ - - pOutrow += 2; /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G8_A16, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it opaque ? */ - *pOutrow = 0xFF; /* opaque */ - else - *pOutrow = 0x00; /* transparent */ - - pOutrow += 4; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A1, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_a2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - { - const mng_uint8 alpha_level[4] = { 0x00, 0x55, 0xAA, 0xFF}; - *pOutrow = alpha_level[((iB & iM) >> iS)] ; - } -#else - switch ((iB & iM) >> iS) /* determine the alpha level */ - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A2, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_a4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the alpha level */ - iQ = (mng_uint8)((iB & iM) >> iS); - iQ = (mng_uint8)(iQ + (iQ << 4)); /* expand to 8-bit by replication */ - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A4, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_store_jpeg_rgb8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in buffer */ - - pOutrow += 4; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A8, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* only high-order byte */ - - pOutrow += 4; /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_RGB8_A16, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a1 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - iM = 0; /* start at pixel 0 */ - iB = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* opaque ? */ - mng_put_uint16 (pOutrow, 0xFFFF);/* opaque */ - else - mng_put_uint16 (pOutrow, 0x0000);/* transparent */ - - pOutrow += 4; /* next pixel */ - iM >>= 1; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A1, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a2 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - { - const mng_uint16 gray_level[4] = { 0x0000, 0x5555, 0xAAAA, 0xFFFF}; - mng_put_uint16 (pOutrow, gray_level[((iB & iM) >> iS)]) ; - } -#else - switch ((iB & iM) >> iS) /* determine the gray level */ - { - case 0x03 : { mng_put_uint16 (pOutrow, 0xFFFF); break; } - case 0x02 : { mng_put_uint16 (pOutrow, 0xAAAA); break; } - case 0x01 : { mng_put_uint16 (pOutrow, 0x5555); break; } - default : { mng_put_uint16 (pOutrow, 0x0000); } - } -#endif - - pOutrow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A2, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a4 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint16 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint16)((iB & iM) >> iS); - iQ = (mng_uint16)(iQ + (iQ << 4)); /* expand to 16-bit by replication */ - iQ = (mng_uint16)(iQ + (iQ << 8)); - /* put in object buffer */ - mng_put_uint16 (pOutrow, iQ); - - pOutrow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A4, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = (mng_uint16)(*pWorkrow); /* get input byte */ - iW = (mng_uint16)(iW + (iW << 8)); /* expand to 16-bit by replication */ - - mng_put_uint16 (pOutrow, iW); /* put in object buffer */ - - pOutrow += 4; /* next pixel */ - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A8, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_JPEG12 -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g12_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 2; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* copy it */ - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow)); - - pOutrow += 4; /* next pixel */ - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_STORE_JPEG_G12_A16, MNG_LC_END); -#endif - /* we've got one more row of alpha-samples */ - return mng_next_jpeg_alpharow (pData); -} -#endif -#endif /* MNG_SUPPORT_JPEG12 */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG */ - -#ifndef MNG_NO_DELTA_PNG -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the processed & uncompressed row-data * */ -/* * onto the target "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - *pOutrow = 0xFF; /* white */ - else - *pOutrow = 0x00; /* black */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* invert if it is white ? */ - *pOutrow = (mng_uint8)(*pOutrow ^ 0xFF); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1, MNG_LC_END); -#endif - - return mng_store_g1 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g2 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - const mng_uint8 level[4] = { 0x00, 0x55, 0xAA, 0xFF}; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - *pOutrow = level[((iB & iM) >> iS)] ; -#else - switch ((iB & iM) >> iS) /* determine the alpha level */ - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - *pOutrow = level[((*pOutrow >> 6) + ((iB & iM) >> iS)) & 0x03] ; -#else - switch (((*pOutrow >> 6) + ((iB & iM) >> iS)) & 0x03) - { - case 0x03 : { *pOutrow = 0xFF; break; } - case 0x02 : { *pOutrow = 0xAA; break; } - case 0x01 : { *pOutrow = 0x55; break; } - default : { *pOutrow = 0x00; } - } -#endif - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2, MNG_LC_END); -#endif - - return mng_store_g2 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g4 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* expand to 8-bit by replication */ - iQ = (mng_uint8)(iQ + (iQ << 4)); - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)(((*pOutrow >> 4) + ((iB & iM) >> iS)) & 0x0F); - /* expand to 8-bit by replication */ - iQ = (mng_uint8)(iQ + (iQ << 4)); - - *pOutrow = iQ; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4, MNG_LC_END); -#endif - - return mng_store_g4 (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_delta_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow); - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8, MNG_LC_END); -#endif - - return mng_store_g8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow) )); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16, MNG_LC_END); -#endif - - return mng_store_g16 (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - /* next pixel */ - pOutrow += (pData->iColinc * 3); - pWorkrow += 3; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow ); - *(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1)); - *(pOutrow+2) = (mng_uint8)(*(pOutrow+2) + *(pWorkrow+2)); - /* next pixel */ - pOutrow += (pData->iColinc * 3); - pWorkrow += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8, MNG_LC_END); -#endif - - return mng_store_rgb8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - *(pOutrow+4) = *(pWorkrow+4); - *(pOutrow+5) = *(pWorkrow+5); - /* next pixel */ - pOutrow += (pData->iColinc * 6); - pWorkrow += 6; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow ) )); - mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) + - mng_get_uint16 (pWorkrow+2) )); - mng_put_uint16 (pOutrow+4, (mng_uint16)(mng_get_uint16 (pOutrow+4 ) + - mng_get_uint16 (pWorkrow+4) )); - /* next pixel */ - pOutrow += (pData->iColinc * 6); - pWorkrow += 6; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16, MNG_LC_END); -#endif - - return mng_store_rgb16 (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_idx1 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX1, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* put the right index value */ - *pOutrow = 1; - else - *pOutrow = 0; - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* invert if it is non-zero index */ - *pOutrow = (mng_uint8)(*pOutrow ^ 0x01); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 1; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX1, MNG_LC_END); -#endif - - return mng_store_idx1 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_idx2 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX2, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* put the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* calculate the index */ - *pOutrow = (mng_uint8)((*pOutrow + ((iB & iM) >> iS)) & 0x03); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 2; - iS -= 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX2, MNG_LC_END); -#endif - - return mng_store_idx2 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_idx4 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX4, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* put the index */ - *pOutrow = (mng_uint8)((iB & iM) >> iS); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* calculate the index */ - *pOutrow = (mng_uint8)((*pOutrow + ((iB & iM) >> iS)) & 0x0F); - - pOutrow += pData->iColinc; /* next pixel */ - iM >>= 4; - iS -= 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX4, MNG_LC_END); -#endif - - return mng_store_idx4 (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_idx8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow); - - pOutrow += pData->iColinc; /* next pixel */ - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_IDX8, MNG_LC_END); -#endif - - return mng_store_idx8 (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow ); - *(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1)); - /* next pixel */ - pOutrow += (pData->iColinc << 1); - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8, MNG_LC_END); -#endif - - return mng_store_ga8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow ) )); - mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) + - mng_get_uint16 (pWorkrow+2) )); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16, MNG_LC_END); -#endif - - return mng_store_ga16 (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; /* put in object buffer */ - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - *pOutrow = (mng_uint8)(*pOutrow + *pWorkrow ); - *(pOutrow+1) = (mng_uint8)(*(pOutrow+1) + *(pWorkrow+1)); - *(pOutrow+2) = (mng_uint8)(*(pOutrow+2) + *(pWorkrow+2)); - *(pOutrow+3) = (mng_uint8)(*(pOutrow+3) + *(pWorkrow+3)); - /* next pixel */ - pOutrow += (pData->iColinc << 2); - pWorkrow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8, MNG_LC_END); -#endif - - return mng_store_rgba8 (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pDeltaImage)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iDeltaBlocky * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + - (pData->iDeltaBlockx * pBuf->iSamplesize); - /* pixel replace ? */ - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - MNG_COPY (pOutrow, pWorkrow, 8); /* put in object buffer */ - /* next pixel */ - pOutrow += (pData->iColinc << 3); - pWorkrow += 8; - } - } - else - { /* pixel add ! */ -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* add to object buffer */ - mng_put_uint16 (pOutrow, (mng_uint16)(mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow ) )); - mng_put_uint16 (pOutrow+2, (mng_uint16)(mng_get_uint16 (pOutrow+2 ) + - mng_get_uint16 (pWorkrow+2) )); - mng_put_uint16 (pOutrow+4, (mng_uint16)(mng_get_uint16 (pOutrow+4 ) + - mng_get_uint16 (pWorkrow+4) )); - mng_put_uint16 (pOutrow+6, (mng_uint16)(mng_get_uint16 (pOutrow+6 ) + - mng_get_uint16 (pWorkrow+6) )); - /* next pixel */ - pOutrow += (pData->iColinc << 3); - pWorkrow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16, MNG_LC_END); -#endif - - return mng_store_rgba16 (pData); -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the source row onto the target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1_g1 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1_G1, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0x01); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G1_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g2_g2 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2_G2, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0x03); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G2_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_g4_g4 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4_G4, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0x0F); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G4_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_delta_g8_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8_G8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G8_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_g16_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16_G16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 1)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 2; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_G16_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgb8_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8_RGB8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples * 3); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples*3; iX > 0; iX--) -#else - for (iX = 0; iX < (pData->iRowsamples * 3); iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16_RGB16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples * 6)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) + - mng_get_uint16 (pWorkrow+4)) & 0xFFFF)); - - pOutrow += 6; - pWorkrow += 6; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGB16_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_delta_ga8_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_GA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples << 1); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = (pData->iRowsamples<<1); iX > 0; iX--) -#else - for (iX = 0; iX < (pData->iRowsamples << 1); iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_ga8_g8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_G8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - - pOutrow += 2; - pWorkrow++; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow += 2; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_ga8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_A8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 1; - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - - pOutrow += 2; - pWorkrow++; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow += 2; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_GA16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 2)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - - pOutrow += 4; - pWorkrow += 4; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_g16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_G16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow)); - - pOutrow += 4; - pWorkrow += 2; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 4; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_A16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+2, mng_get_uint16 (pWorkrow)); - - pOutrow += 4; - pWorkrow += 2; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 4; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_GA16_A16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgba8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, pData->iRowsamples << 2); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = (pData->iRowsamples << 2); iX > 0; iX--) -#else - for (iX = 0; iX < (pData->iRowsamples << 2); iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow++; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_retcode mng_delta_rgba8_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGB8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - - pOutrow += 4; - pWorkrow += 3; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow ) & 0xFF); - *(pOutrow+1) = (mng_uint8)(((mng_uint16)*(pOutrow+1) + - (mng_uint16)*(pWorkrow+1)) & 0xFF); - *(pOutrow+2) = (mng_uint8)(((mng_uint16)*(pOutrow+2) + - (mng_uint16)*(pWorkrow+2)) & 0xFF); - - pOutrow += 4; - pWorkrow += 3; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_delta_rgba8_a8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_A8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize) + 3; - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = *pWorkrow; - - pOutrow += 4; - pWorkrow++; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(((mng_uint16)*pOutrow + - (mng_uint16)*pWorkrow) & 0xFF); - - pOutrow += 4; - pWorkrow++; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA8_A8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGBA16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if ((pData->iDeltatype == MNG_DELTATYPE_REPLACE ) || - (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELREPLACE) ) - { - MNG_COPY (pOutrow, pWorkrow, (pData->iRowsamples << 3)); - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKPIXELADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) + - mng_get_uint16 (pWorkrow+4)) & 0xFFFF)); - mng_put_uint16 (pOutrow+6, (mng_uint16)((mng_get_uint16 (pOutrow+6) + - mng_get_uint16 (pWorkrow+6)) & 0xFFFF)); - - pOutrow += 8; - pWorkrow += 8; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGB16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, mng_get_uint16 (pWorkrow )); - mng_put_uint16 (pOutrow+2, mng_get_uint16 (pWorkrow+2)); - mng_put_uint16 (pOutrow+4, mng_get_uint16 (pWorkrow+4)); - - pOutrow += 8; - pWorkrow += 6; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKCOLORADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow, (mng_uint16)((mng_get_uint16 (pOutrow ) + - mng_get_uint16 (pWorkrow )) & 0xFFFF)); - mng_put_uint16 (pOutrow+2, (mng_uint16)((mng_get_uint16 (pOutrow+2) + - mng_get_uint16 (pWorkrow+2)) & 0xFFFF)); - mng_put_uint16 (pOutrow+4, (mng_uint16)((mng_get_uint16 (pOutrow+4) + - mng_get_uint16 (pWorkrow+4)) & 0xFFFF)); - - pOutrow += 8; - pWorkrow += 6; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgba16_a16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_A16, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAREPLACE) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+6, mng_get_uint16 (pWorkrow)); - - pOutrow += 8; - pWorkrow += 2; - } - } - else - if (pData->iDeltatype == MNG_DELTATYPE_BLOCKALPHAADD) - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - mng_put_uint16 (pOutrow+6, (mng_uint16)((mng_get_uint16 (pOutrow+6) + - mng_get_uint16 (pWorkrow)) & 0xFFFF)); - - pOutrow += 8; - pWorkrow += 2; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DELTA_RGBA16_A16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - scale the delta to bitdepth of target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g1_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 1); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g1_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 3); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g1_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 7); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g1_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = (mng_uint8)(*pWorkrow << 7); - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G1_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g2_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 2); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g2_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 6); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g2_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = (mng_uint8)(*pWorkrow << 6); - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g4_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow << 4); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g4_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = (mng_uint8)(*pWorkrow << 4); - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g8_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (pData->iRowsamples - 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 1); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + pData->iRowsamples - 1); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow--; - pOutrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_ga8_ga16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA8_GA16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + ((pData->iRowsamples - 1) << 1); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 2); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + ((pData->iRowsamples - 1) << 1)); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 2)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+3) = 0; - *(pOutrow+2) = *(pWorkrow+1); - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow -= 2; - pOutrow -= 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA8_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_rgb8_rgb16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB8_RGB16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + (3 * (pData->iRowsamples - 1)); - pOutrow = pOutrow + (6 * (pData->iRowsamples - 1)); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + 3 * (pData->iRowsamples - 1)); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + 6 * (pData->iRowsamples - 1)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+5) = 0; - *(pOutrow+4) = *(pWorkrow+2); - *(pOutrow+3) = 0; - *(pOutrow+2) = *(pWorkrow+1); - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow -= 3; - pOutrow -= 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_rgba8_rgba16 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA8_RGBA16, MNG_LC_START); -#endif - - pWorkrow = pWorkrow + ((pData->iRowsamples - 1) << 2); - pOutrow = pOutrow + ((pData->iRowsamples - 1) << 3); -/* pWorkrow = (mng_uint8p)((mng_uint32)pWorkrow + ((pData->iRowsamples - 1) << 2)); */ -/* pOutrow = (mng_uint8p)((mng_uint32)pOutrow + ((pData->iRowsamples - 1) << 3)); */ - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *(pOutrow+7) = 0; - *(pOutrow+6) = *(pWorkrow+3); - *(pOutrow+5) = 0; - *(pOutrow+4) = *(pWorkrow+2); - *(pOutrow+3) = 0; - *(pOutrow+2) = *(pWorkrow+1); - *(pOutrow+1) = 0; - *pOutrow = *pWorkrow; - - pWorkrow -= 4; - pOutrow -= 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g2_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 1); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G2_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g4_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 3); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g8_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 7); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g16_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G1, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 15); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g4_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 2); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G4_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_g8_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 6); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g16_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G2, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 14); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_scale_g8_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pWorkrow = (mng_uint8)(*pWorkrow >> 4); - pWorkrow++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G8_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_scale_g16_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G4, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 12); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_scale_g16_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_G16_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_ga16_ga8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA16_GA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_GA16_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_rgb16_rgb8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB16_RGB8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGB16_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_scale_rgba16_rgba8 (mng_datap pData) -{ - mng_uint8p pWorkrow = pData->pRGBArow; - mng_uint8p pOutrow = pData->pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA16_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - *pOutrow = (mng_uint8)(mng_get_uint16 (pWorkrow) >> 8); - pOutrow++; - pWorkrow += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_SCALE_RGBA16_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image bit routines - promote bit_depth * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_uint8 mng_promote_replicate_1_2 (mng_uint8 iB) -{ - return (mng_uint8)((iB << 1) | iB); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_1_4 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 1) + iB); - return (mng_uint8)((iB << 2) + iB); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_1_8 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 1) + iB); - iB = (mng_uint8)((iB << 2) + iB); - return (mng_uint8)((iB << 4) + iB); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_1_16 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 1) + iB); - iB = (mng_uint8)((iB << 2) + iB); - iB = (mng_uint8)((iB << 4) + iB); - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_2_4 (mng_uint8 iB) -{ - return (mng_uint8)((iB << 2) + iB); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_2_8 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 2) + iB); - return (mng_uint8)((iB << 4) + iB); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_2_16 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 2) + iB); - iB = (mng_uint8)((iB << 4) + iB); - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_4_8 (mng_uint8 iB) -{ - return (mng_uint8)((iB << 4) + iB); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_4_16 (mng_uint8 iB) -{ - iB = (mng_uint8)((iB << 4) + iB); - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif -#endif /* NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_8_16 (mng_uint8 iB) -{ - return (mng_uint16)(((mng_uint16)iB << 8) + (mng_uint16)iB); -} -#endif - -/* ************************************************************************** */ - -#if !defined(MNG_NO_DELTA_PNG) -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_uint8 mng_promote_zerofill_1_2 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 1); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_1_4 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 3); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_1_8 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 7); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_1_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 15); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_2_4 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 2); -} - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_2_8 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 6); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_2_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 14); -} -#endif - -/* ************************************************************************** */ - -mng_uint8 mng_promote_zerofill_4_8 (mng_uint8 iB) -{ - return (mng_uint8)(iB << 4); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_4_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 12); -} -#endif -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_8_16 (mng_uint8 iB) -{ - return (mng_uint16)((mng_uint16)iB << 8); -} -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - promote color_type * */ -/* * * */ -/* ************************************************************************** */ - -#if !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN) -mng_retcode mng_promote_g8_g8 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - *pDstline = iB; - - pSrcline++; - pDstline++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_g16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - - *pDstline = (mng_uint8)(iW >> 8); - *(pDstline+1) = (mng_uint8)(iW && 0xFF); - - pSrcline++; - pDstline += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_promote_g16_g16 (mng_datap pData) -{ - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_G16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - *pDstline = *pSrcline; - pSrcline++; - pDstline++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_ga8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - *(pDstline+1) = 0xFF; - - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - - *pDstline = iB; - - pSrcline++; - pDstline += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - { - *(pDstline+2) = 0xFF; - *(pDstline+3) = 0xFF; - } - - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - *pDstline = (mng_uint8)(iW >> 8); - *(pDstline+1) = (mng_uint8)(iW && 0xFF); - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g16_ga16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_GA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iW != pBuf->iTRNSgray)) - *(pDstline+1) = 0xFFFF; - - *pDstline = iW; - - pSrcline++; - pDstline += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_rgb8 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - - *pDstline = iB; - *(pDstline+1) = iB; - *(pDstline+2) = iB; - - pSrcline++; - pDstline += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgb16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - iB = (mng_uint8)(iW >> 8); - *pDstline = iB; - *(pDstline+2) = iB; - *(pDstline+4) = iB; - iB = (mng_uint8)(iW && 0xFF); - *(pDstline+1) = iB; - *(pDstline+3) = iB; - *(pDstline+5) = iB; - - pSrcline++; - pDstline += 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g16_rgb16 (mng_datap pData) -{ - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - - *pDstline = iW; - *(pDstline+1) = iW; - *(pDstline+2) = iW; - - pSrcline++; - pDstline += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - *(pDstline+3) = 0xFF; - - if (pData->fPromBitdepth) /* bitdepth promoted ? */ - iB = ((mng_bitdepth_8)pData->fPromBitdepth) (iB); - - *pDstline = iB; - *(pDstline+1) = iB; - *(pDstline+2) = iB; - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iB != pBuf->iTRNSgray)) - { - *(pDstline+6) = 0xFF; - *(pDstline+7) = 0xFF; - } - - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - iB = (mng_uint8)(iW >> 8); - *pDstline = iB; - *(pDstline+2) = iB; - *(pDstline+4) = iB; - iB = (mng_uint8)(iW && 0xFF); - *(pDstline+1) = iB; - *(pDstline+3) = iB; - *(pDstline+5) = iB;; - - pSrcline++; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g16_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || (iW != pBuf->iTRNSgray)) - *(pDstline+3) = 0xFFFF; - - *pDstline = iW; - *(pDstline+1) = iW; - *(pDstline+2) = iW; - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_G16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga8_ga16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_GA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - - *pDstline = (mng_uint8)(iW >> 8); - *(pDstline+1) = (mng_uint8)(iW && 0xFF); - *(pDstline+2) = (mng_uint8)(iA >> 8); - *(pDstline+3) = (mng_uint8)(iA && 0xFF); - - pSrcline += 2; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_ga8_rgba8 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint8 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - iA = *(pSrcline+1); - - *pDstline = iB; - *(pDstline+1) = iB; - *(pDstline+2) = iB; - *(pDstline+3) = iA; - - pSrcline += 2; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga8_rgba16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - mng_uint16 iW; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - - iB = (mng_uint8)(iW >> 8); - *pDstline = iB; - *(pDstline+2) = iB; - *(pDstline+4) = iB; - iB = (mng_uint8)(iW && 0xFF); - *(pDstline+1) = iB; - *(pDstline+3) = iB; - *(pDstline+5) = iB; - *(pDstline+6) = (mng_uint8)(iA >> 8); - *(pDstline+7) = (mng_uint8)(iA && 0xFF); - - pSrcline += 2; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga16_rgba16 (mng_datap pData) -{ - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iW; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA16_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iW = *pSrcline; - iA = *(pSrcline+1); - - *pDstline = iW; - *(pDstline+1) = iW; - *(pDstline+2) = iW; - *(pDstline+3) = iA; - - pSrcline += 2; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_GA16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgb16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+2)); - - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - - pSrcline += 3; - pDstline += 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_rgb8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iR; - mng_uint8 iG; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = *pSrcline; - iG = *(pSrcline+1); - iB = *(pSrcline+2); - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iR != pBuf->iTRNSred) || - ((mng_uint16)iG != pBuf->iTRNSgreen) || ((mng_uint16)iB != pBuf->iTRNSblue)) - *(pDstline+3) = 0xFF; - - *pDstline = iR; - *(pDstline+1) = iG; - *(pDstline+2) = iB; - - pSrcline += 3; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iR; - mng_uint8 iG; - mng_uint8 iB; - mng_uint16 iRw; - mng_uint16 iGw; - mng_uint16 iBw; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = *pSrcline; - iG = *(pSrcline+1); - iB = *(pSrcline+2); - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || ((mng_uint16)iR != pBuf->iTRNSred) || - ((mng_uint16)iG != pBuf->iTRNSgreen) || ((mng_uint16)iB != pBuf->iTRNSblue)) - { - *(pDstline+6) = 0xFF; - *(pDstline+7) = 0xFF; - } - - iRw = ((mng_bitdepth_16)pData->fPromBitdepth) (iR); - iGw = ((mng_bitdepth_16)pData->fPromBitdepth) (iG); - iBw = ((mng_bitdepth_16)pData->fPromBitdepth) (iB); - - *pDstline = (mng_uint8)(iRw >> 8); - *(pDstline+1) = (mng_uint8)(iRw && 0xFF); - *(pDstline+2) = (mng_uint8)(iGw >> 8); - *(pDstline+3) = (mng_uint8)(iGw && 0xFF); - *(pDstline+4) = (mng_uint8)(iBw >> 8); - *(pDstline+5) = (mng_uint8)(iBw && 0xFF); - - pSrcline += 3; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb16_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint16p pSrcline = (mng_uint16p)pData->pPromSrc; - mng_uint16p pDstline = (mng_uint16p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB16_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = *pSrcline; - iG = *(pSrcline+1); - iB = *(pSrcline+2); - /* no cheap transparency ? */ - if ((!pBuf->bHasTRNS) || (iR != pBuf->iTRNSred) || - (iG != pBuf->iTRNSgreen) || (iB != pBuf->iTRNSblue)) - *(pDstline+3) = 0xFFFF; - - *pDstline = iR; - *(pDstline+1) = iG; - *(pDstline+2) = iB; - - pSrcline += 3; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGB16_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_idx8_rgb8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - - if ((mng_uint32)iB < pBuf->iPLTEcount) - { - *pDstline = pBuf->aPLTEentries [iB].iRed; - *(pDstline+1) = pBuf->aPLTEentries [iB].iGreen; - *(pDstline+2) = pBuf->aPLTEentries [iB].iBlue; - } - - pSrcline++; - pDstline += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgb16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iN; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iN = *pSrcline; - - if ((mng_uint32)iN < pBuf->iPLTEcount) - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iRed); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iGreen); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iBlue); - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - } - - pSrcline++; - pDstline += 6; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_promote_idx8_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA8, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iB = *pSrcline; - - if ((mng_uint32)iB < pBuf->iPLTEcount) - { - *pDstline = pBuf->aPLTEentries [iB].iRed; - *(pDstline+1) = pBuf->aPLTEentries [iB].iGreen; - *(pDstline+2) = pBuf->aPLTEentries [iB].iBlue; - - if ((pBuf->bHasTRNS) && ((mng_uint32)iB < pBuf->iTRNScount)) - *(pDstline+3) = pBuf->aTRNSentries [iB]; - else - *(pDstline+3) = 0xFF; - } - - pSrcline++; - pDstline += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = (mng_imagedatap)pData->pPromBuf; - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint8 iN; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iN = *pSrcline; - - if ((mng_uint32)iN < pBuf->iPLTEcount) - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iRed); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iGreen); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aPLTEentries [iN].iBlue); - - if ((pBuf->bHasTRNS) && ((mng_uint32)iN < pBuf->iTRNScount)) - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (pBuf->aTRNSentries [iN]); - else - iA = 0xFFFF; - - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - *(pDstline+6) = (mng_uint8)(iA >> 8); - *(pDstline+7) = (mng_uint8)(iA && 0xFF); - } - - pSrcline++; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_IDX8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_promote_rgba8_rgba16 (mng_datap pData) -{ - mng_uint8p pSrcline = (mng_uint8p)pData->pPromSrc; - mng_uint8p pDstline = (mng_uint8p)pData->pPromDst; - mng_uint32 iX; - mng_uint16 iR; - mng_uint16 iG; - mng_uint16 iB; - mng_uint16 iA; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGBA8_RGBA16, MNG_LC_START); -#endif - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPromWidth; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPromWidth; iX++) -#endif - { - iR = ((mng_bitdepth_16)pData->fPromBitdepth) (*pSrcline); - iG = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+1)); - iB = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+2)); - iA = ((mng_bitdepth_16)pData->fPromBitdepth) (*(pSrcline+3)); - - *pDstline = (mng_uint8)(iR >> 8); - *(pDstline+1) = (mng_uint8)(iR && 0xFF); - *(pDstline+2) = (mng_uint8)(iG >> 8); - *(pDstline+3) = (mng_uint8)(iG && 0xFF); - *(pDstline+4) = (mng_uint8)(iB >> 8); - *(pDstline+5) = (mng_uint8)(iB && 0xFF); - *(pDstline+6) = (mng_uint8)(iA >> 8); - *(pDstline+7) = (mng_uint8)(iA && 0xFF); - - pSrcline += 4; - pDstline += 8; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROMOTE_RGBA8_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* !defined(MNG_NO_DELTA_PNG) || !defined(MNG_SKIPCHUNK_PAST) || !defined(MNG_SKIPCHUNK_MAGN) */ - -/* ************************************************************************** */ -/* * * */ -/* * Row processing routines - convert uncompressed data from zlib to * */ -/* * managable row-data which serves as input to the color-management * */ -/* * routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_g1 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G1, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { - if (pBuf->iTRNSgray) /* white transparent ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - /* transparent ! */ - mng_put_uint32 (pRGBArow, 0x00000000); - else /* opaque black */ - mng_put_uint32 (pRGBArow, 0x000000FF); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - } - } - else /* black transparent */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - /* opaque white */ - mng_put_uint32 (pRGBArow, 0xFFFFFFFF); - else /* transparent */ - mng_put_uint32 (pRGBArow, 0x00000000); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - } - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else /* no transparency */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - } - - if (iB & iM) /* is it white ? */ - /* opaque white */ - mng_put_uint32 (pRGBArow, 0xFFFFFFFF); - else /* opaque black */ - mng_put_uint32 (pRGBArow, 0x000000FF); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_g2 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - const mng_uint32 level[4] = { 0x000000FF, 0x555555FF, - 0xAAAAAAFF, 0xFFFFFFFF}; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G2, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* determine gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - - if (iQ == pBuf->iTRNSgray) /* transparent ? */ - mng_put_uint32 (pRGBArow, 0x00000000); - else - { -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - mng_put_uint32 (pRGBArow, level[iQ]); -#else - switch (iQ) /* determine the gray level */ - { - case 0x03 : { mng_put_uint32 (pRGBArow, 0xFFFFFFFF); break; } - case 0x02 : { mng_put_uint32 (pRGBArow, 0xAAAAAAFF); break; } - case 0x01 : { mng_put_uint32 (pRGBArow, 0x555555FF); break; } - default : { mng_put_uint32 (pRGBArow, 0x000000FF); } - } -#endif - } - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - -#ifdef MNG_OPTIMIZE_FOOTPRINT_SWITCH - mng_put_uint32 (pRGBArow, level[((iB & iM) >> iS)] ); -#else - switch ((iB & iM) >> iS) /* determine the gray level */ - { - case 0x03 : { mng_put_uint32 (pRGBArow, 0xFFFFFFFF); break; } - case 0x02 : { mng_put_uint32 (pRGBArow, 0xAAAAAAFF); break; } - case 0x01 : { mng_put_uint32 (pRGBArow, 0x555555FF); break; } - default : { mng_put_uint32 (pRGBArow, 0x000000FF); } - } -#endif - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_g4 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G4, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - - if (iQ == pBuf->iTRNSgray) /* transparent ? */ - { - *pRGBArow = 0; /* put in intermediate row */ - *(pRGBArow+1) = 0; - *(pRGBArow+2) = 0; - *(pRGBArow+3) = 0; - } - else - { /* expand to 8-bit by replication */ - iQ = (mng_uint8)(iQ + (iQ << 4)); - - *pRGBArow = iQ; /* put in intermediate row */ - *(pRGBArow+1) = iQ; - *(pRGBArow+2) = iQ; - *(pRGBArow+3) = 0xFF; - } - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the gray level */ - iQ = (mng_uint8)((iB & iM) >> iS); - iQ = (mng_uint8)(iQ + (iQ << 4));/* expand to 8-bit by replication */ - - *pRGBArow = iQ; /* put in intermediate row */ - *(pRGBArow+1) = iQ; - *(pRGBArow+2) = iQ; - *(pRGBArow+3) = 0xFF; - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_process_g8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G8, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iB = *pWorkrow; /* get next input-byte */ - - if (iB == pBuf->iTRNSgray) /* transparent ? */ - { - *pRGBArow = 0; /* put in intermediate row */ - *(pRGBArow+1) = 0; - *(pRGBArow+2) = 0; - *(pRGBArow+3) = 0; - } - else - { - *pRGBArow = iB; /* put in intermediate row */ - *(pRGBArow+1) = iB; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; - } - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iB = *pWorkrow; /* get next input-byte */ - - *pRGBArow = iB; /* put in intermediate row */ - *(pRGBArow+1) = iB; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_g16 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iW; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G16, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = mng_get_uint16 (pWorkrow); /* get input */ - - if (iW == pBuf->iTRNSgray) /* transparent ? */ - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, 0); - mng_put_uint16 (pRGBArow+2, 0); - mng_put_uint16 (pRGBArow+4, 0); - mng_put_uint16 (pRGBArow+6, 0); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iW); - mng_put_uint16 (pRGBArow+2, iW); - mng_put_uint16 (pRGBArow+4, iW); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pRGBArow += 8; /* next pixel */ - pWorkrow += 2; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = mng_get_uint16 (pWorkrow); /* get input */ - - mng_put_uint16 (pRGBArow, iW); /* and put in intermediate row */ - mng_put_uint16 (pRGBArow+2, iW); - mng_put_uint16 (pRGBArow+4, iW); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pRGBArow += 8; /* next pixel */ - pWorkrow += 2; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_G16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_rgb8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iR, iG, iB; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB8, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = *pWorkrow; /* get the RGB values */ - iG = *(pWorkrow+1); - iB = *(pWorkrow+2); - /* transparent ? */ - if ((iR == pBuf->iTRNSred) && (iG == pBuf->iTRNSgreen) && - (iB == pBuf->iTRNSblue)) - { - *pRGBArow = 0; /* this pixel is transparent ! */ - *(pRGBArow+1) = 0; - *(pRGBArow+2) = 0; - *(pRGBArow+3) = 0; - } - else - { - *pRGBArow = iR; /* copy the RGB values */ - *(pRGBArow+1) = iG; - *(pRGBArow+2) = iB; - *(pRGBArow+3) = 0xFF; /* this one isn't transparent */ - } - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRGBArow = *pWorkrow; /* copy the RGB bytes */ - *(pRGBArow+1) = *(pWorkrow+1); - *(pRGBArow+2) = *(pWorkrow+2); - *(pRGBArow+3) = 0xFF; /* no alpha; so always fully opaque */ - - pWorkrow += 3; /* next pixel */ - pRGBArow += 4; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_rgb16 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iR, iG, iB; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB16, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iR = mng_get_uint16 (pWorkrow); /* get the RGB values */ - iG = mng_get_uint16 (pWorkrow+2); - iB = mng_get_uint16 (pWorkrow+4); - /* transparent ? */ - if ((iR == pBuf->iTRNSred) && (iG == pBuf->iTRNSgreen) && - (iB == pBuf->iTRNSblue)) - { /* transparent then */ - mng_put_uint16 (pRGBArow, 0); - mng_put_uint16 (pRGBArow+2, 0); - mng_put_uint16 (pRGBArow+4, 0); - mng_put_uint16 (pRGBArow+6, 0); - } - else - { /* put in intermediate row */ - mng_put_uint16 (pRGBArow, iR); - mng_put_uint16 (pRGBArow+2, iG); - mng_put_uint16 (pRGBArow+4, iB); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - } - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* copy the RGB values */ - mng_put_uint16 (pRGBArow, mng_get_uint16 (pWorkrow )); - mng_put_uint16 (pRGBArow+2, mng_get_uint16 (pWorkrow+2)); - mng_put_uint16 (pRGBArow+4, mng_get_uint16 (pWorkrow+4)); - mng_put_uint16 (pRGBArow+6, 0xFFFF); - - pWorkrow += 6; /* next pixel */ - pRGBArow += 8; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGB16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_idx1 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - iS = 7; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - *(pRGBArow+3) = pBuf->aTRNSentries [iQ]; - else - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - iS -= 1; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0x80; - iS = 7; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 1; - iS -= 1; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_idx2 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX2, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - *(pRGBArow+3) = pBuf->aTRNSentries [iQ]; - else - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = *pWorkrow; /* get next input-byte */ - pWorkrow++; - iM = 0xC0; - iS = 6; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - *pRGBArow = pBuf->aPLTEentries [iQ].iRed; - *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen; - *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue; - *(pRGBArow+3) = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 2; - iS -= 2; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_idx4 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iB; - mng_uint8 iM; - mng_uint32 iS; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX4, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - iM = 0; /* start at pixel 0 */ - iB = 0; - iS = 0; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = pWorkrow [0]; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - pRGBArow [3] = pBuf->aTRNSentries [iQ]; - else - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - if (!iM) /* mask underflow ? */ - { - iB = pWorkrow [0]; /* get next input-byte */ - pWorkrow++; - iM = 0xF0; - iS = 4; - } - /* get the index */ - iQ = (mng_uint8)((iB & iM) >> iS); - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - iM >>= 4; - iS -= 4; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_process_idx8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint8 iQ; - mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX8, MNG_LC_START); -#endif - - if (!pBuf) /* no object? then use obj 0 */ - pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf; - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - - if (pBuf->bHasTRNS) /* tRNS encountered ? */ - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get input byte */ - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - /* transparency for this index ? */ - if ((mng_uint32)iQ < pBuf->iTRNScount) - pRGBArow [3] = pBuf->aTRNSentries [iQ]; - else - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_FALSE; /* it's not fully opaque */ - } - else - { -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iQ = *pWorkrow; /* get input byte */ - /* index valid ? */ - if ((mng_uint32)iQ < pBuf->iPLTEcount) - { /* put in intermediate row */ - pRGBArow [0] = pBuf->aPLTEentries [iQ].iRed; - pRGBArow [1] = pBuf->aPLTEentries [iQ].iGreen; - pRGBArow [2] = pBuf->aPLTEentries [iQ].iBlue; - pRGBArow [3] = 0xFF; - } - else - MNG_ERROR (pData, MNG_PLTEINDEXERROR); - - pRGBArow += 4; /* next pixel */ - pWorkrow++; - } - - pData->bIsOpaque = MNG_TRUE; /* it's fully opaque */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_IDX8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_process_ga8 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA8, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - *pRGBArow = *pWorkrow; /* copy the gray value */ - *(pRGBArow+1) = *pWorkrow; - *(pRGBArow+2) = *pWorkrow; - *(pRGBArow+3) = *(pWorkrow+1); /* copy the alpha value */ - - pWorkrow += 2; /* next pixel */ - pRGBArow += 4; - } - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_ga16 (mng_datap pData) -{ - mng_uint8p pWorkrow; - mng_uint8p pRGBArow; - mng_int32 iX; - mng_uint16 iW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA16, MNG_LC_START); -#endif - /* temporary work pointers */ - pWorkrow = pData->pWorkrow + pData->iPixelofs; - pRGBArow = pData->pRGBArow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iW = mng_get_uint16 (pWorkrow); /* copy the gray value */ - mng_put_uint16 (pRGBArow, iW); - mng_put_uint16 (pRGBArow+2, iW); - mng_put_uint16 (pRGBArow+4, iW); - /* copy the alpha value */ - mng_put_uint16 (pRGBArow+6, mng_get_uint16 (pWorkrow+2)); - - pWorkrow += 4; /* next pixel */ - pRGBArow += 8; - } - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_GA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_process_rgba8 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA8, MNG_LC_START); -#endif - /* this is the easiest transform */ - MNG_COPY (pData->pRGBArow, pData->pWorkrow + pData->iPixelofs, pData->iRowsize); - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_rgba16 (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA16, MNG_LC_START); -#endif - /* this is the easiest transform */ - MNG_COPY (pData->pRGBArow, pData->pWorkrow + pData->iPixelofs, pData->iRowsize); - - pData->bIsOpaque = MNG_FALSE; /* it's definitely not fully opaque */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines - set up the variables needed * */ -/* * to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_g1_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g1; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g1_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g1; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = ((pData->iRowsamples + 7) >> 3); - pData->iRowmax = ((pData->iDatawidth + 7) >> 3) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G1_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g2_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g2; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g2_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g2; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = ((pData->iRowsamples + 3) >> 2); - pData->iRowmax = ((pData->iDatawidth + 3) >> 2) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G2_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g4_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g4; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g4_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g4; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = ((pData->iRowsamples + 1) >> 1); - pData->iRowmax = ((pData->iDatawidth + 1) >> 1) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G4_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_init_g8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_g8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iDatawidth + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_g16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_g16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_g16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_g16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_g16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g16; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = (pData->iDatawidth << 1) + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_G16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_init_rgb8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 3; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 3; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_rgb8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 3; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 3; - pData->iRowmax = (pData->iDatawidth * 3) + pData->iPixelofs; - pData->iFilterbpp = 3; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgb16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 6; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 6; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 6; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgb16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgb16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgb16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgb16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgb16; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 6; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples * 6; - pData->iRowmax = (pData->iDatawidth * 6) + pData->iPixelofs; - pData->iFilterbpp = 6; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGB16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_idx1_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx1; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx1_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx1; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx1; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx1; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx1; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = ((pData->iDatawidth + 7) >> 3) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX1_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx2_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx2; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx2_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx2; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx2; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx2; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx2; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = ((pData->iDatawidth + 3) >> 2) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX2_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx4_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx4; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx4_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx4; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx4; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx4; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx4; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = ((pData->iDatawidth + 1) >> 1) + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX4_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_init_idx8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_idx8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_idx8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_idx8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_idx8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_idx8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iDatawidth + pData->iPixelofs; - pData->iFilterbpp = 1; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_IDX8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_ga8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_ga8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = (pData->iDatawidth << 1) + pData->iPixelofs; - pData->iFilterbpp = 2; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_ga16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_ga16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_ga16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_ga16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_ga16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_ga16; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = (pData->iDatawidth << 2) + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_GA16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_init_rgba8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -/* ************************************************************************** */ - -mng_retcode mng_init_rgba8_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba8; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba8; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba8; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba8; -#endif - - pData->iPass = 0; /* from 0..6; is 1..7 in specifications */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 2; - pData->iRowmax = (pData->iDatawidth << 2) + pData->iPixelofs; - pData->iFilterbpp = 4; - pData->bIsRGBA16 = MNG_FALSE; /* intermediate row is 8-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA8_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgba16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_NI, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 8; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 8; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_rgba16_i (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_I, MNG_LC_START); -#endif - - if (pData->fDisplayrow) - pData->fProcessrow = (mng_fptr)mng_process_rgba16; - - if (pData->pStoreobj) /* store in object too ? */ - { /* immediate delta ? */ -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - pData->fStorerow = (mng_fptr)mng_delta_rgba16; - else -#endif - pData->fStorerow = (mng_fptr)mng_store_rgba16; - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_rgba16; -#endif - - pData->iPass = 0; /* from 0..6; (1..7 in specification) */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> interlace_divider [0]; - pData->iSamplemul = 8; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 3; - pData->iRowmax = (pData->iDatawidth << 3) + pData->iPixelofs; - pData->iFilterbpp = 8; - pData->bIsRGBA16 = MNG_TRUE; /* intermediate row is 16-bit deep */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_RGBA16_I, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines (JPEG) - set up the variables * */ -/* * needed to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_jpeg_a1_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A1_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a1; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a1; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g1; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iRowsize = (pData->iRowsamples + 7) >> 3; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A1_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_jpeg_a2_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A2_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a2; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a2; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g2; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iRowsize = (pData->iRowsamples + 3) >> 2; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A2_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_init_jpeg_a4_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A4_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a4; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a4; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g4; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iRowsize = (pData->iRowsamples + 1) >> 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A4_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_init_jpeg_a8_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A8_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a8; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a8; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g8; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 1; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A8_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_jpeg_a16_ni (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A16_NI, MNG_LC_START); -#endif - - if (pData->pStoreobj) /* store in object too ? */ - { - if (pData->iJHDRimgbitdepth == 8) - { - switch (pData->iJHDRcolortype) - { - case 12 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a16; break; } - case 14 : { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a16; break; } - } - } - - /* TODO: bitdepth 12 & 20 */ - - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - pData->fDifferrow = (mng_fptr)mng_differ_g16; -#endif - - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iRowsize = pData->iRowsamples << 1; - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - pData->iFilterbpp = 2; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_JPEG_A16_NI, MNG_LC_END); -#endif - - return mng_init_rowproc (pData); -} -#endif - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - -/* ************************************************************************** */ -/* * * */ -/* * Generic row processing initialization & cleanup routines * */ -/* * - initialize the buffers used by the row processing routines * */ -/* * - cleanup the buffers used by the row processing routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_init_rowproc (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWPROC, MNG_LC_START); -#endif - -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT - if (pData->ePng_imgtype != png_none) - { - if (pData->fDisplayrow) - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - pData->fProcessrow = (mng_fptr)mng_process_g1; - break; - case png_g2: - pData->fProcessrow = (mng_fptr)mng_process_g2; - break; - case png_g4: - pData->fProcessrow = (mng_fptr)mng_process_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - pData->fProcessrow = (mng_fptr)mng_process_g8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fProcessrow = (mng_fptr)mng_process_idx1; - break; - case png_idx2: - pData->fProcessrow = (mng_fptr)mng_process_idx2; - break; - case png_idx4: - pData->fProcessrow = (mng_fptr)mng_process_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fProcessrow = (mng_fptr)mng_process_idx8; - break; - case png_ga8: - pData->fProcessrow = (mng_fptr)mng_process_ga8; - break; - case png_rgb8: - pData->fProcessrow = (mng_fptr)mng_process_rgb8; - break; - case png_rgba8: - pData->fProcessrow = (mng_fptr)mng_process_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: - pData->fProcessrow = (mng_fptr)mng_process_g16; - break; - case png_ga16: - pData->fProcessrow = (mng_fptr)mng_process_ga16; - break; - case png_rgb16: - pData->fProcessrow = (mng_fptr)mng_process_rgb16; - break; - case png_rgba16: - pData->fProcessrow = (mng_fptr)mng_process_rgba16; - break; -#endif - default: - break; - } - - if (pData->pStoreobj) /* store in object too ? */ - { -#ifndef MNG_NO_DELTA_PNG - if ((pData->bHasDHDR) && (pData->bDeltaimmediate)) - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - pData->fStorerow = (mng_fptr)mng_delta_g1; - break; - case png_g2: - pData->fStorerow = (mng_fptr)mng_delta_g2; - break; - case png_g4: - pData->fStorerow = (mng_fptr)mng_delta_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - pData->fStorerow = (mng_fptr)mng_delta_g8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fStorerow = (mng_fptr)mng_delta_idx1; - break; - case png_idx2: - pData->fStorerow = (mng_fptr)mng_delta_idx2; - break; - case png_idx4: - pData->fStorerow = (mng_fptr)mng_delta_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fStorerow = (mng_fptr)mng_delta_idx8; - break; - case png_ga8: - pData->fStorerow = (mng_fptr)mng_delta_ga8; - break; - case png_rgb8: - pData->fStorerow = (mng_fptr)mng_delta_rgb8; - break; - case png_rgba8: - pData->fStorerow = (mng_fptr)mng_delta_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: - pData->fStorerow = (mng_fptr)mng_delta_g16; - break; - case png_ga16: - pData->fStorerow = (mng_fptr)mng_delta_ga16; - break; - case png_rgb16: - pData->fStorerow = (mng_fptr)mng_delta_rgb16; - break; - case png_rgba16: - pData->fStorerow = (mng_fptr)mng_delta_rgba16; - break; -#endif - default: - break; - } - else -#endif /* MNG_NO_DELTA_PNG */ - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - pData->fStorerow = (mng_fptr)mng_store_g1; - break; - case png_g2: - pData->fStorerow = (mng_fptr)mng_store_g2; - break; - case png_g4: - pData->fStorerow = (mng_fptr)mng_store_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - pData->fStorerow = (mng_fptr)mng_store_g8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fStorerow = (mng_fptr)mng_store_idx1; - break; - case png_idx2: - pData->fStorerow = (mng_fptr)mng_store_idx2; - break; - case png_idx4: - pData->fStorerow = (mng_fptr)mng_store_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fStorerow = (mng_fptr)mng_store_idx8; - break; - case png_ga8: - pData->fStorerow = (mng_fptr)mng_store_ga8; - break; - case png_rgb8: - pData->fStorerow = (mng_fptr)mng_store_rgb8; - break; - case png_rgba8: - pData->fStorerow = (mng_fptr)mng_store_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: - pData->fStorerow = (mng_fptr)mng_store_g16; - break; - case png_ga16: - pData->fStorerow = (mng_fptr)mng_store_ga16; - break; - case png_rgb16: - pData->fStorerow = (mng_fptr)mng_store_rgb16; - break; - case png_rgba16: - pData->fStorerow = (mng_fptr)mng_store_rgba16; - break; -#endif - -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_jpeg_a1: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a1; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a1; break; } - } - } - /* TODO: bitdepth 12 & 20 */ - break; - case png_jpeg_a2: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a2; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a2; break; } - } - } - break; - /* TODO: bitdepth 12 & 20 */ - case png_jpeg_a4: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a4; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a4; break; } - } - } - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - /* TODO: bitdepth 12 & 20 */ - case png_jpeg_a8: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a8; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a8; break; } - } - } - break; - /* TODO: bitdepth 12 & 20 */ -#ifndef MNG_NO_16BIT_SUPPORT - case png_jpeg_a16: -/* if (pData->iJHDRimgbitdepth == 8) */ - { - switch (pData->iJHDRcolortype) - { - case 12 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_g8_a16; break; } - case 14 : - { pData->fStorerow = (mng_fptr)mng_store_jpeg_rgb8_a16; break; } - } - } - break; - /* TODO: bitdepth 12 & 20 */ -#endif -#endif /* MNG_INCLUDE_JNG */ - default: - break; - } - } - -#ifdef FILTER192 /* leveling & differing ? */ - if (pData->iFilter == MNG_FILTER_DIFFERING) - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a1: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g1; - break; - case png_g2: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a2: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g2; - break; - case png_g4: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a4: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a8: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g8; - break; - case png_rgb8: - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; - break; -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_idx1: - pData->fDifferrow = (mng_fptr)mng_differ_idx1; - break; - case png_idx2: - pData->fDifferrow = (mng_fptr)mng_differ_idx2; - break; - case png_idx4: - pData->fDifferrow = (mng_fptr)mng_differ_idx4; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_idx8: - pData->fDifferrow = (mng_fptr)mng_differ_idx8; - break; - case png_ga8: - pData->fDifferrow = (mng_fptr)mng_differ_ga8; - break; - case png_rgb8: - pData->fDifferrow = (mng_fptr)mng_differ_rgb8; - break; - case png_rgba8: - pData->fDifferrow = (mng_fptr)mng_differ_rgba8; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a16: -#endif - pData->fDifferrow = (mng_fptr)mng_differ_g16; - break; - case png_ga16: - pData->fDifferrow = (mng_fptr)mng_differ_ga16; - break; - case png_rgb16: - pData->fDifferrow = (mng_fptr)mng_differ_rgb16; - break; - case png_rgba16: - pData->fDifferrow = (mng_fptr)mng_differ_rgba16; - break; -#endif - default: - break; - } -#endif - - switch (pData->ePng_imgtype) - { -#ifndef MNG_NO_1_2_4BIT_SUPPORT - case png_g1: - case png_idx1: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a1: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 7; - pData->iSamplediv = 3; - pData->iFilterbpp = 1; - break; - case png_g2: - case png_idx2: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a2: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 3; - pData->iSamplediv = 2; - pData->iFilterbpp = 1; - break; - case png_g4: - case png_idx4: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a4: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 1; - pData->iSamplediv = 1; - pData->iFilterbpp = 1; - break; -#endif /* MNG_NO_1_2_4BIT_SUPPORT */ - case png_g8: - case png_idx8: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a8: -#endif - pData->iSamplemul = 1; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 1; - break; - case png_ga8: -#ifndef MNG_NO_16BIT_SUPPORT - case png_g16: -#ifdef MNG_INCLUDE_JNG - case png_jpeg_a16: -#endif -#endif - pData->iSamplemul = 2; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 2; - break; - case png_rgb8: - pData->iSamplemul = 3; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 3; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_ga16: -#endif - case png_rgba8: - pData->iSamplemul = 4; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 4; - break; -#ifndef MNG_NO_16BIT_SUPPORT - case png_rgb16: - pData->iSamplemul = 6; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 6; - break; - case png_rgba16: - pData->iSamplemul = 8; - pData->iSampleofs = 0; - pData->iSamplediv = 0; - pData->iFilterbpp = 8; - break; -#endif - default: - break; - } - - if (pData->iInterlace) /* noninterlaced */ - { - pData->iPass = 0; /* from 0..6; (1..7 in specification) */ - pData->iRow = interlace_row [0]; - pData->iRowinc = interlace_rowskip [0]; - pData->iCol = interlace_col [0]; - pData->iColinc = interlace_colskip [0]; - pData->iRowsamples = (pData->iDatawidth + interlace_roundoff [0]) >> - interlace_divider [0]; - pData->iRowmax = ((pData->iDatawidth * pData->iSamplemul + - pData->iSampleofs) >> pData->iSamplediv) + pData->iPixelofs; - } - else /* interlaced */ - { - pData->iPass = -1; - pData->iRow = 0; - pData->iRowinc = 1; - pData->iCol = 0; - pData->iColinc = 1; - pData->iRowsamples = pData->iDatawidth; - } - if (pData->iSamplediv > 0) - pData->iRowsize = (pData->iRowsamples + pData->iSampleofs) >> - pData->iSamplediv; - else - pData->iRowsize = (pData->iRowsamples * pData->iSamplemul); - - if (!pData->iInterlace) /* noninterlaced */ - pData->iRowmax = pData->iRowsize + pData->iPixelofs; - -#ifdef MNG_NO_16BIT_SUPPORT - pData->bIsRGBA16 = MNG_FALSE; -#else - switch (pData->ePng_imgtype) - { - case png_g16: - case png_ga16: - case png_rgb16: - case png_rgba16: - pData->bIsRGBA16 = MNG_TRUE; - break; - default: - pData->bIsRGBA16 = MNG_FALSE; - break; - } -#endif - - } -#endif /* MNG_OPTIMIZE_FOOTPRINT_INIT */ - - if (pData->pStoreobj) /* storage object selected ? */ - { - pData->pStorebuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - /* and so it becomes viewable ! */ - ((mng_imagep)pData->pStoreobj)->bViewable = MNG_TRUE; - ((mng_imagedatap)pData->pStorebuf)->bViewable = MNG_TRUE; - } - - /* allocate the buffers; the individual init routines have already - calculated the required maximum size; except in the case of a JNG - without alpha!!! */ - if (pData->iRowmax) - { -#if defined(MNG_NO_16BIT_SUPPORT) || defined (MNG_NO_1_2_4BIT_SUPPORT) - mng_uint8 iRowadd = 0; -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth < 8) - iRowadd=(pData->iPNGdepth*pData->iRowmax+7)/8; -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - iRowadd=pData->iRowmax; -#endif - MNG_ALLOC (pData, pData->pWorkrow, pData->iRowmax+iRowadd); - MNG_ALLOC (pData, pData->pPrevrow, pData->iRowmax+iRowadd); -#else - MNG_ALLOC (pData, pData->pWorkrow, pData->iRowmax); - MNG_ALLOC (pData, pData->pPrevrow, pData->iRowmax); -#endif - } - - /* allocate an RGBA16 row for intermediate processing */ - MNG_ALLOC (pData, pData->pRGBArow, (pData->iDatawidth << 3)); - -#ifndef MNG_NO_CMS - if (pData->fDisplayrow) /* display "on-the-fly" ? */ - { -#if defined(MNG_FULL_CMS) /* determine color-management initialization */ - mng_retcode iRetcode = mng_init_full_cms (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE); -#elif defined(MNG_GAMMA_ONLY) - mng_retcode iRetcode = mng_init_gamma_only (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE); -#elif defined(MNG_APP_CMS) - mng_retcode iRetcode = mng_init_app_cms (pData, MNG_TRUE, MNG_TRUE, MNG_FALSE); -#endif - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* !MNG_NO_CMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_INIT_ROWPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_next_row (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_ROW, MNG_LC_START); -#endif - - pData->iRow += pData->iRowinc; /* increase the row counter */ - - if (pData->iPass >= 0) /* interlaced ? */ - { - while ((pData->iPass < 7) && /* went 'outside' the image ? */ - ((pData->iRow >= (mng_int32)pData->iDataheight) || - (pData->iCol >= (mng_int32)pData->iDatawidth ) )) - { - pData->iPass++; /* next pass ! */ - - if (pData->iPass < 7) /* there's only 7 passes ! */ - { - pData->iRow = interlace_row [pData->iPass]; - pData->iRowinc = interlace_rowskip [pData->iPass]; - pData->iCol = interlace_col [pData->iPass]; - pData->iColinc = interlace_colskip [pData->iPass]; - pData->iRowsamples = (pData->iDatawidth - pData->iCol + interlace_roundoff [pData->iPass]) - >> interlace_divider [pData->iPass]; - - if (pData->iSamplemul > 1) /* recalculate row dimension */ - pData->iRowsize = pData->iRowsamples * pData->iSamplemul; - else - if (pData->iSamplediv > 0) - pData->iRowsize = (pData->iRowsamples + pData->iSampleofs) >> pData->iSamplediv; - else - pData->iRowsize = pData->iRowsamples; - - } - - if ((pData->iPass < 7) && /* reset previous row to zeroes ? */ - (pData->iRow < (mng_int32)pData->iDataheight) && - (pData->iCol < (mng_int32)pData->iDatawidth ) ) - { /* making sure the filters will work properly! */ - mng_int32 iX; - mng_uint8p pTemp = pData->pPrevrow; - -#ifdef MNG_NO_16BIT_SUPPORT -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iPNGmult*pData->iRowsize; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iPNGmult*pData->iRowsize; iX++) -#endif -#else -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsize; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsize; iX++) -#endif -#endif - { - *pTemp = 0; - pTemp++; - } - } - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_ROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_cleanup_rowproc (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEANUP_ROWPROC, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS /* cleanup cms profile/transform */ - { - mng_retcode iRetcode = mng_clear_cms (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif /* MNG_INCLUDE_LCMS */ - - if (pData->pRGBArow) /* cleanup buffer for intermediate row */ - MNG_FREEX (pData, pData->pRGBArow, (pData->iDatawidth << 3)); - if (pData->pPrevrow) /* cleanup buffer for previous row */ - MNG_FREEX (pData, pData->pPrevrow, pData->iRowmax); - if (pData->pWorkrow) /* cleanup buffer for working row */ - MNG_FREEX (pData, pData->pWorkrow, pData->iRowmax); - - pData->pWorkrow = MNG_NULL; /* propogate uninitialized buffers */ - pData->pPrevrow = MNG_NULL; - pData->pRGBArow = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_CLEANUP_ROWPROC, MNG_LC_END); -#endif - - return MNG_NOERROR; /* woohiii */ -} - -/* ************************************************************************** */ -/* * * */ -/* * Generic row processing routines for JNG * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -/* ************************************************************************** */ - -mng_retcode mng_display_jpeg_rows (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_JPEG_ROWS, MNG_LC_START); -#endif - /* any completed rows ? */ - if ((pData->iJPEGrow > pData->iJPEGdisprow) && - (pData->iJPEGalpharow > pData->iJPEGdisprow) ) - { - mng_uint32 iX, iMax; - mng_uint32 iSaverow = pData->iRow; /* save alpha decompression row-count */ - /* determine the highest complete(!) row */ - if (pData->iJPEGrow > pData->iJPEGalpharow) - iMax = pData->iJPEGalpharow; - else - iMax = pData->iJPEGrow; - /* display the rows */ - for (iX = pData->iJPEGdisprow; iX < iMax; iX++) - { - pData->iRow = iX; /* make sure we all know which row to handle */ - /* makeup an intermediate row from the buffer */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* color-correct it if necessary */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* and display it */ - { - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) /* check progressive display refresh */ - iRetcode = mng_display_progressive_check (pData); - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - pData->iJPEGdisprow = iMax; /* keep track of the last displayed row */ - pData->iRow = iSaverow; /* restore alpha decompression row-count */ - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DISPLAY_JPEG_ROWS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_next_jpeg_alpharow (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ALPHAROW, MNG_LC_START); -#endif - - pData->iJPEGalpharow++; /* count the row */ - - if (pData->fDisplayrow) /* display "on-the-fly" ? */ - { /* try to display what you can */ - iRetcode = mng_display_jpeg_rows (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ALPHAROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_next_jpeg_row (mng_datap pData) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ROW, MNG_LC_START); -#endif - - pData->iJPEGrow++; /* increase the row-counter */ - - if (pData->fDisplayrow) /* display "on-the-fly" ? */ - { /* has alpha channel ? */ - if ((pData->iJHDRcolortype == MNG_COLORTYPE_JPEGGRAYA ) || - (pData->iJHDRcolortype == MNG_COLORTYPE_JPEGCOLORA) ) - { /* try to display what you can */ - iRetcode = mng_display_jpeg_rows (pData); - } - else - { /* make sure we all know which row to handle */ - pData->iRow = pData->iJPEGrow - 1; - /* makeup an intermediate row from the buffer */ - iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData); - /* color-correct it if necessary */ - if ((!iRetcode) && (pData->fCorrectrow)) - iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData); - - if (!iRetcode) /* and display it */ - { - iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRetcode) /* check progressive display refresh */ - iRetcode = mng_display_progressive_check (pData); - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - } - - /* surpassed last filled row ? */ - if (pData->iJPEGrow > pData->iJPEGrgbrow) - pData->iJPEGrgbrow = pData->iJPEGrow; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_NEXT_JPEG_ROW, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_MAGN -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) /* calculate the distances */ - { - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - pTempdst += 3; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - pTempdst += 3; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - - pTempdst += 2; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - - pTempdst += 2; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - *pTempdst = *(pTempsrc1+1); /* replicate alpha from left */ - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - *pTempdst = *(pTempsrc2+1); /* replicate alpha from right */ - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate gray from left */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate gray from right */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_X5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X1, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *pTempdst = *(pTempsrc1+3); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - - (mng_int32)(*(pTempsrc1+3)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X3, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - *(pTempdst+3) = *(pTempsrc1+3); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - *(pTempdst+3) = *(pTempsrc2+3); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - /* replicate alpha from left */ - *pTempdst = *(pTempsrc1+3); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2)) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+1)) - - (mng_int32)(*(pTempsrc1+1)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+1)) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - *pTempdst = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+2)) - - (mng_int32)(*(pTempsrc1+2)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+2)) ); - - pTempdst++; - /* replicate alpha from right */ - *pTempdst = *(pTempsrc2+3); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline; /* initialize pixel-loop */ - pTempdst = pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate color from left */ - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - *(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - - (mng_int32)(*(pTempsrc1+3)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate color from right */ - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - *(pTempdst+3) = (mng_uint8)(((2 * iS * ( (mng_int32)(*(pTempsrc2+3)) - - (mng_int32)(*(pTempsrc1+3)) ) + iM) / - (iM * 2)) + (mng_int32)(*(pTempsrc1+3)) ); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ -mng_retcode mng_magnify_g8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth) - else - MNG_COPY (pDstline, pSrcline2, iWidth); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G8_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth * 3); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth * 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth * 3) - else - MNG_COPY (pDstline, pSrcline2, iWidth * 3); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth * 3); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB8_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth << 1); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth << 1) - else - MNG_COPY (pDstline, pSrcline2, iWidth << 1); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* replicate gray from top */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc2; /* replicate gray from bottom */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 1); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA8_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth << 2); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth << 2) - else - MNG_COPY (pDstline, pSrcline2, iWidth << 2); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y4, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint8p pTempsrc1; - mng_uint8p pTempsrc2; - mng_uint8p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_START); -#endif - - pTempsrc1 = pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = pSrcline2; - pTempdst = pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc1++; /* replicate color from top */ - *pTempdst++ = *pTempsrc1++; - *pTempdst++ = *pTempsrc1++; - - pTempsrc2 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc2++; /* replicate color from bottom */ - *pTempdst++ = *pTempsrc2++; - *pTempdst++ = *pTempsrc2++; - - pTempsrc1 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - *pTempdst = (mng_uint8)( ( (2 * iS * ( (mng_int32)(*pTempsrc2) - - (mng_int32)(*pTempsrc1) ) + iM) / - (iM * 2) ) + (mng_int32)(*pTempsrc1) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth << 2); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA8_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) /* calculate the distances */ - { - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) )); - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 1; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { /* is it same as first ? */ - if (*pTempsrc1 == *pTempsrc2) - { - for (iS = 1; iS < iM; iS++) /* then just repeat the first */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - } - else - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - pTempdst++; - } - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - } - } - } - - pTempsrc1++; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 3; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - pTempdst += 3; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - pTempdst += 3; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - } - } - } - - pTempsrc1 += 3; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p) pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - - pTempdst += 2; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - - pTempdst += 2; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - *pTempdst = *(pTempsrc1+1); /* replicate alpha from left */ - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - *pTempdst = *(pTempsrc2+1); /* replicate alpha from right */ - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 2; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate gray from left */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate gray from right */ - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1);/* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - } - } - } - - pTempsrc1 += 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_X5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX, iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X1, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - iM = iML; - else - if (iX == (iWidth - 1)) /* last interval ? */ - iM = iMR; - else - iM = iMX; - - for (iS = 1; iS < iM; iS++) /* fill interval */ - { - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - for (iS = 1; iS < iM; iS++) - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *pTempdst = *(pTempsrc1+3); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) ); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X3, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* replicate first half */ - { - *pTempdst = *pTempsrc1; - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - *(pTempdst+3) = *(pTempsrc1+3); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* replicate second half */ - { - *pTempdst = *pTempsrc2; - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - *(pTempdst+3) = *(pTempsrc2+3); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - /* replicate alpha from left */ - *pTempdst = *(pTempsrc1+3); - - pTempdst++; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; /* just repeat the first */ - else /* calculate the distance */ - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - - if (*(pTempsrc1+1) == *(pTempsrc2+1)) - *pTempdst = *(pTempsrc1+1); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+1))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+1))) ) ); - - pTempdst++; - - if (*(pTempsrc1+2) == *(pTempsrc2+2)) - *pTempdst = *(pTempsrc1+2); - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+2))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+2))) ) ); - - pTempdst++; - /* replicate alpha from right */ - *pTempdst = *(pTempsrc2+3); - - pTempdst++; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_int32 iS, iM, iH; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline; /* initialize pixel-loop */ - pTempdst = (mng_uint16p)pDstline; - - for (iX = 0; iX < iWidth; iX++) - { - pTempsrc2 = pTempsrc1 + 4; - - *pTempdst = *pTempsrc1; /* copy original source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - - if (iX == 0) /* first interval ? */ - { - if (iWidth == 1) /* single pixel ? */ - pTempsrc2 = MNG_NULL; - - iM = (mng_int32)iML; - } - else - if (iX == (iWidth - 2)) /* last interval ? */ - iM = (mng_int32)iMR; - else - iM = (mng_int32)iMX; - /* fill interval ? */ - if ((iX < iWidth - 1) || (iWidth == 1)) - { - if (pTempsrc2) /* do we have the second pixel ? */ - { - iH = (iM+1) / 2; /* calculate halfway point */ - - for (iS = 1; iS < iH; iS++) /* first half */ - { - *pTempdst = *pTempsrc1; /* replicate color from left */ - *(pTempdst+1) = *(pTempsrc1+1); - *(pTempdst+2) = *(pTempsrc1+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - mng_put_uint16 ((mng_uint8p)(pTempdst+3), - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) ); - - pTempdst += 4; - } - - for (iS = iH; iS < iM; iS++) /* second half */ - { - *pTempdst = *pTempsrc2; /* replicate color from right */ - *(pTempdst+1) = *(pTempsrc2+1); - *(pTempdst+2) = *(pTempsrc2+2); - - if (*(pTempsrc1+3) == *(pTempsrc2+3)) - *(pTempdst+3) = *(pTempsrc1+3); - else - mng_put_uint16 ((mng_uint8p)(pTempdst+3), - (mng_uint16)(((2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc2+3))) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)(pTempsrc1+3))) ) ); - - pTempdst += 4; - } - } - else - { - for (iS = 1; iS < iM; iS++) - { - *pTempdst = *pTempsrc1; /* repeat first source pixel */ - pTempdst++; - *pTempdst = *(pTempsrc1+1); - pTempdst++; - *pTempdst = *(pTempsrc1+2); - pTempdst++; - *pTempdst = *(pTempsrc1+3); - pTempdst++; - } - } - } - - pTempsrc1 += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_X4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_g16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, (iWidth << 1)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 1)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_g16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 1)) - else - MNG_COPY (pDstline, pSrcline2, (iWidth << 1)); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 1)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_G16_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, iWidth * 6); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, iWidth * 6); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgb16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, iWidth * 6) - else - MNG_COPY (pDstline, pSrcline2, iWidth * 6); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, iWidth * 6); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGB16_Y3, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_GRAY_SUPPORT -mng_retcode mng_magnify_ga16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, (iWidth << 2)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 2)) - else - MNG_COPY (pDstline, pSrcline2, (iWidth << 2)); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_ga16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc1; /* replicate gray from top */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst = *pTempsrc2; /* replicate gray from bottom */ - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 2)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_GA16_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_GRAY_SUPPORT */ - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y1, MNG_LC_START); -#endif - - MNG_COPY (pDstline, pSrcline1, (iWidth << 3)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y1, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y3, MNG_LC_START); -#endif - - if (pSrcline2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 3)) - else - MNG_COPY (pDstline, pSrcline2, (iWidth << 3)); - } - else - { /* just repeat the entire line */ - MNG_COPY (pDstline, pSrcline1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y4, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2 += 2; - - *pTempdst++ = *pTempsrc1++; /* replicate alpha from top */ - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { /* calculate the distances */ - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - - if (*pTempsrc1 == *pTempsrc2) - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1 += 2; - pTempsrc2++; - - *pTempdst++ = *pTempsrc2++; /* replicate alpha from bottom */ - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y4, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_magnify_rgba16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline) -{ - mng_uint32 iX; - mng_uint16p pTempsrc1; - mng_uint16p pTempsrc2; - mng_uint16p pTempdst; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y5, MNG_LC_START); -#endif - - pTempsrc1 = (mng_uint16p)pSrcline1; /* initialize pixel-loop */ - pTempsrc2 = (mng_uint16p)pSrcline2; - pTempdst = (mng_uint16p)pDstline; - - if (pTempsrc2) /* do we have a second line ? */ - { - if (iS < (iM+1) / 2) /* top half ? */ - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc1++; /* replicate color from top */ - *pTempdst++ = *pTempsrc1++; - *pTempdst++ = *pTempsrc1++; - - pTempsrc2 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - else - { - for (iX = 0; iX < iWidth; iX++) - { - *pTempdst++ = *pTempsrc2++; /* replicate color from bottom */ - *pTempdst++ = *pTempsrc2++; - *pTempdst++ = *pTempsrc2++; - - pTempsrc1 += 3; - - if (*pTempsrc1 == *pTempsrc2) /* calculate the distances */ - *pTempdst = *pTempsrc1; - else - mng_put_uint16 ((mng_uint8p)pTempdst, - (mng_uint16)( ( (2 * iS * ( (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc2)) - - (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) + iM) / - (iM * 2)) + (mng_int32)(mng_get_uint16 ((mng_uint8p)pTempsrc1)) ) ); - - pTempdst++; - pTempsrc1++; - pTempsrc2++; - } - } - } - else - { /* just repeat the entire line */ - MNG_COPY (pTempdst, pTempsrc1, (iWidth << 3)); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_MAGNIFY_RGBA16_Y5, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_NO_16BIT_SUPPORT */ -#endif /* MNG_OPTIMIZE_FOOTPRINT_MAGN */ -#endif /* MNG_SKIPCHUNK_MAGN */ - -/* ************************************************************************** */ -/* * * */ -/* * PAST composition routines - compose over/under with a target object * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_composeover_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8; - mng_uint8 iCr8, iCg8, iCb8, iCa8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iFGa8 = *(pWorkrow+3); /* get alpha values */ - iBGa8 = *(pOutrow+3); - - if (iFGa8) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa8 == 0xFF) || (iBGa8 == 0)) - { /* then simply copy the values */ - *pOutrow = *pWorkrow; - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = iFGa8; - } - else - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pOutrow+i), *(pWorkrow+i), iFGa8, *(pOutrow+i)); - } -#else - MNG_COMPOSE8 (*pOutrow, *pWorkrow, iFGa8, *pOutrow ); - MNG_COMPOSE8 (*(pOutrow+1), *(pWorkrow+1), iFGa8, *(pOutrow+1)); - MNG_COMPOSE8 (*(pOutrow+2), *(pWorkrow+2), iFGa8, *(pOutrow+2)); -#endif - /* alpha remains fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND8 (*pWorkrow, *(pWorkrow+1), *(pWorkrow+2), iFGa8, - *pOutrow, *(pOutrow+1), *(pOutrow+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pOutrow = iCr8; - *(pOutrow+1) = iCg8; - *(pOutrow+2) = iCb8; - *(pOutrow+3) = iCa8; - } - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_composeover_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint16p pWorkrow; - mng_uint16p pOutrow; - mng_int32 iX; - mng_uint16 iFGa16, iFGr16, iFGg16, iFGb16; - mng_uint16 iBGa16, iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA16, MNG_LC_START); -#endif - - pWorkrow = (mng_uint16p)pData->pRGBArow; - pOutrow = (mng_uint16p)(pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize)); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* get alpha values */ - iFGa16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+3)); - iBGa16 = mng_get_uint16 ((mng_uint8p)(pOutrow+3)); - - if (iFGa16) /* any opacity at all ? */ - { /* fully opaque or background fully transparent ? */ - if ((iFGa16 == 0xFFFF) || (iBGa16 == 0)) - { /* then simply copy the values */ - *pOutrow = *pWorkrow; - *(pOutrow+1) = *(pWorkrow+1); - *(pOutrow+2) = *(pWorkrow+2); - *(pOutrow+3) = *(pWorkrow+3); - } - else - { /* get color values */ - iFGr16 = mng_get_uint16 ((mng_uint8p)pWorkrow); - iFGg16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+1)); - iFGb16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+2)); - iBGr16 = mng_get_uint16 ((mng_uint8p)pOutrow); - iBGg16 = mng_get_uint16 ((mng_uint8p)(pOutrow+1)); - iBGb16 = mng_get_uint16 ((mng_uint8p)(pOutrow+2)); - - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE16 (iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16 (iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16 (iFGb16, iFGb16, iFGa16, iBGb16); - - mng_put_uint16 ((mng_uint8p)pOutrow, iFGr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iFGg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iFGb16); - /* alpha remains fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND16 (iFGr16, iFGg16, iFGb16, iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - mng_put_uint16 ((mng_uint8p)pOutrow, iCr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iCg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iCb16); - mng_put_uint16 ((mng_uint8p)(pOutrow+3), iCa16); - } - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEOVER_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_composeunder_rgba8 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint8p pWorkrow; - mng_uint8p pOutrow; - mng_int32 iX; - mng_uint8 iFGa8, iBGa8; - mng_uint8 iCr8, iCg8, iCb8, iCa8; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA8, MNG_LC_START); -#endif - - pWorkrow = pData->pRGBArow; - pOutrow = pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { - iFGa8 = *(pOutrow+3); /* get alpha values */ - iBGa8 = *(pWorkrow+3); - /* anything to do at all ? */ - if ((iBGa8) && (iFGa8 != 0xFF)) - { - if (iBGa8 == 0xFF) /* background fully opaque ? */ - { /* do alpha composing */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_COMPOSE - int i; - for (i=2; i >= 0; i--) - { - MNG_COMPOSE8 (*(pOutrow+i), *(pOutrow+i), iFGa8, *(pWorkrow+i)); - } -#else - MNG_COMPOSE8 (*pOutrow, *pOutrow, iFGa8, *pWorkrow ); - MNG_COMPOSE8 (*(pOutrow+1), *(pOutrow+1), iFGa8, *(pWorkrow+1)); - MNG_COMPOSE8 (*(pOutrow+2), *(pOutrow+2), iFGa8, *(pWorkrow+2)); -#endif - *(pOutrow+3) = 0xFF; /* alpha becomes fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND8 (*pOutrow, *(pOutrow+1), *(pOutrow+2), iFGa8, - *pWorkrow, *(pWorkrow+1), *(pWorkrow+2), iBGa8, - iCr8, iCg8, iCb8, iCa8); - /* and return the composed values */ - *pOutrow = iCr8; - *(pOutrow+1) = iCg8; - *(pOutrow+2) = iCb8; - *(pOutrow+3) = iCa8; - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_composeunder_rgba16 (mng_datap pData) -{ - mng_imagedatap pBuf = ((mng_imagep)pData->pStoreobj)->pImgbuf; - mng_uint16p pWorkrow; - mng_uint16p pOutrow; - mng_int32 iX; - mng_uint16 iFGa16, iFGr16, iFGg16, iFGb16; - mng_uint16 iBGa16, iBGr16, iBGg16, iBGb16; - mng_uint16 iCr16, iCg16, iCb16, iCa16; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA16, MNG_LC_START); -#endif - - pWorkrow = (mng_uint16p)pData->pRGBArow; - pOutrow = (mng_uint16p)(pBuf->pImgdata + (pData->iRow * pBuf->iRowsize ) + - (pData->iCol * pBuf->iSamplesize)); - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* get alpha values */ - iFGa16 = mng_get_uint16 ((mng_uint8p)(pOutrow+3)); - iBGa16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+3)); - /* anything to do at all ? */ - if ((iBGa16) && (iFGa16 != 0xFFFF)) - { - iFGr16 = mng_get_uint16 ((mng_uint8p)pOutrow); - iFGg16 = mng_get_uint16 ((mng_uint8p)(pOutrow+1)); - iFGb16 = mng_get_uint16 ((mng_uint8p)(pOutrow+2)); - iBGr16 = mng_get_uint16 ((mng_uint8p)pWorkrow); - iBGg16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+1)); - iBGb16 = mng_get_uint16 ((mng_uint8p)(pWorkrow+2)); - - if (iBGa16 == 0xFFFF) /* background fully opaque ? */ - { /* do alpha composing */ - MNG_COMPOSE16 (iFGr16, iFGr16, iFGa16, iBGr16); - MNG_COMPOSE16 (iFGg16, iFGg16, iFGa16, iBGg16); - MNG_COMPOSE16 (iFGb16, iFGb16, iFGa16, iBGb16); - - mng_put_uint16 ((mng_uint8p)pOutrow, iFGr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iFGg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iFGb16); - *(pOutrow+3) = 0xFFFF; /* alpha becomes fully opaque !!! */ - } - else - { /* here we'll have to blend */ - MNG_BLEND16 (iFGr16, iFGg16, iFGb16, iFGa16, - iBGr16, iBGg16, iBGb16, iBGa16, - iCr16, iCg16, iCb16, iCa16); - /* and return the composed values */ - mng_put_uint16 ((mng_uint8p)pOutrow, iCr16); - mng_put_uint16 ((mng_uint8p)(pOutrow+1), iCg16); - mng_put_uint16 ((mng_uint8p)(pOutrow+2), iCb16); - mng_put_uint16 ((mng_uint8p)(pOutrow+3), iCa16); - } - } - - pOutrow += 4; - pWorkrow += 4; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_COMPOSEUNDER_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * PAST flip & tile routines - flip or tile a row of pixels * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_flip_rgba8 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA8, MNG_LC_START); -#endif - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + pData->iRowsamples - 1; - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* let's flip */ - *pOutrow = *pWorkrow; - pOutrow++; - pWorkrow--; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_flip_rgba16 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA16, MNG_LC_START); -#endif - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + ((pData->iRowsamples - 1) << 1); - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - -#ifdef MNG_DECREMENT_LOOPS - for (iX = pData->iRowsamples; iX > 0; iX--) -#else - for (iX = 0; iX < pData->iRowsamples; iX++) -#endif - { /* let's flip */ - *pOutrow = *pWorkrow; - *(pOutrow + 1) = *(pWorkrow + 1); - - pOutrow += 2; - pWorkrow -= 2; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_FLIP_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode mng_tile_rgba8 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - mng_uint32 iZ, iMax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA8, MNG_LC_START); -#endif - - iZ = pData->iSourcel; /* indent ? */ - /* what's our source-length */ - iMax = ((mng_imagep)pData->pRetrieveobj)->pImgbuf->iWidth; - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + iZ; - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - - for (iX = pData->iDestl; iX < pData->iDestr; iX++) - { /* tiiiile */ - *pOutrow = *pWorkrow; - - pWorkrow++; - pOutrow++; - iZ++; - - if (iZ >= iMax) /* end of source ? */ - { - iZ = 0; - pWorkrow = (mng_uint32p)pData->pWorkrow; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA8, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_tile_rgba16 (mng_datap pData) -{ - mng_uint32p pWorkrow; - mng_uint32p pOutrow; - mng_int32 iX; - mng_uint32 iZ, iMax; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA16, MNG_LC_START); -#endif - - iZ = pData->iSourcel; /* indent ? */ - /* what's our source-length */ - iMax = ((mng_imagep)pData->pRetrieveobj)->pImgbuf->iWidth; - /* setup temp pointers */ - pWorkrow = (mng_uint32p)pData->pRGBArow + (iZ << 1); - pOutrow = (mng_uint32p)pData->pWorkrow; - /* swap original buffers */ - pData->pWorkrow = pData->pRGBArow; - pData->pRGBArow = (mng_uint8p)pOutrow; - - for (iX = pData->iDestl; iX < pData->iDestr; iX++) - { /* tiiiile */ - *pOutrow = *pWorkrow; - *(pOutrow + 1) = *(pWorkrow + 1); - - pWorkrow += 2; - pOutrow += 2; - iZ++; - - if (iZ >= iMax) /* end of source ? */ - { - iZ = 0; - pWorkrow = (mng_uint32p)pData->pWorkrow; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_TILE_RGBA16, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SKIPCHUNK_PAST */ - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_DISPLAY_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_pixels.h b/Engine/lib/lmng/libmng_pixels.h deleted file mode 100644 index 5a0281e89..000000000 --- a/Engine/lib/lmng/libmng_pixels.h +++ /dev/null @@ -1,1147 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_pixels.h copyright (c) 2000-2006 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Pixel-row management routines (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the pixel-row management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.5.2 - 05/22/2000 - G.Juyn * */ -/* * - added some JNG definitions * */ -/* * - added delta-image row-processing routines * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN support * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added optional support for bKGD for PNG images * */ -/* * - added support for JDAA * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/16/2002 - G.Juyn * */ -/* * - completed MAGN support (16-bit functions) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * * */ -/* * 1.0.6 - 03/09/2003 - G.Juyn * */ -/* * - hiding 12-bit JPEG stuff * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 06/09/2003 - G. R-P * */ -/* * - added conditionals around 8-bit magn routines * */ -/* * 1.0.6 - 07/07/2003 - G. R-P * */ -/* * - removed conditionals around 8-bit magn routines * */ -/* * - added conditionals around 16-bit and delta-PNG * */ -/* * supporting code * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added SKIPCHUNK conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/18/2003 - G.R-P * */ -/* * - added conditionals around 1, 2, and 4-bit prototypes * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * * */ -/* * 1.0.9 - 10/10/2004 - G.R-P. * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_pixels_h_ -#define _libmng_pixels_h_ - -/* ************************************************************************** */ -/* * * */ -/* * Progressive display check - checks to see if progressive display is * */ -/* * in order & indicates so * */ -/* * * */ -/* * The routine is called after a call to one of the display_xxx routines * */ -/* * if appropriate * */ -/* * * */ -/* * The refresh is warrented in the read_chunk routine (mng_read.c) * */ -/* * and only during read&display processing, since there's not much point * */ -/* * doing it from memory! * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_display_progressive_check (mng_datap pData); - -/* ************************************************************************** */ -/* * * */ -/* * Display routines - convert rowdata (which is already color-corrected) * */ -/* * to the output canvas, respecting any transparency information * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCANVAS_RGB8 -mng_retcode mng_display_rgb8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGBA8 -mng_retcode mng_display_rgba8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGBA8_PM -mng_retcode mng_display_rgba8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ARGB8 -mng_retcode mng_display_argb8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ARGB8_PM -mng_retcode mng_display_argb8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB8_A8 -mng_retcode mng_display_rgb8_a8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR8 -mng_retcode mng_display_bgr8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 -mng_retcode mng_display_bgrx8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRA8 -mng_retcode mng_display_bgra8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRA8_PM -mng_retcode mng_display_bgra8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ABGR8 -mng_retcode mng_display_abgr8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_ABGR8_PM -mng_retcode mng_display_abgr8_pm (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB565 -mng_retcode mng_display_rgb565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGBA565 -mng_retcode mng_display_rgba565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR565 -mng_retcode mng_display_bgr565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRA565 -mng_retcode mng_display_bgra565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR565_A8 -mng_retcode mng_display_bgr565_a8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB555 -mng_retcode mng_display_rgb555 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR555 -mng_retcode mng_display_bgr555 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Background restore routines - restore the background with info from * */ -/* * the BACK and/or bKGD chunk and/or the app's background canvas * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_restore_bkgd_backimage (mng_datap pData); -mng_retcode mng_restore_bkgd_backcolor (mng_datap pData); -mng_retcode mng_restore_bkgd_bkgd (mng_datap pData); -mng_retcode mng_restore_bkgd_bgcolor (mng_datap pData); -#ifndef MNG_SKIPCANVAS_RGB8 -mng_retcode mng_restore_bkgd_rgb8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR8 -mng_retcode mng_restore_bkgd_bgr8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 -mng_retcode mng_restore_bkgd_bgrx8 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_RGB565 -mng_retcode mng_restore_bkgd_rgb565 (mng_datap pData); -#endif -#ifndef MNG_SKIPCANVAS_BGR565 -mng_retcode mng_restore_bkgd_bgr565 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row retrieval routines - retrieve processed & uncompressed row-data * */ -/* * from the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_retrieve_g8 (mng_datap pData); -mng_retcode mng_retrieve_rgb8 (mng_datap pData); -mng_retcode mng_retrieve_idx8 (mng_datap pData); -mng_retcode mng_retrieve_ga8 (mng_datap pData); -mng_retcode mng_retrieve_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_retrieve_g16 (mng_datap pData); -mng_retcode mng_retrieve_ga16 (mng_datap pData); -mng_retcode mng_retrieve_rgb16 (mng_datap pData); -mng_retcode mng_retrieve_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_g1 (mng_datap pData); -mng_retcode mng_store_g2 (mng_datap pData); -mng_retcode mng_store_g4 (mng_datap pData); -mng_retcode mng_store_idx1 (mng_datap pData); -mng_retcode mng_store_idx2 (mng_datap pData); -mng_retcode mng_store_idx4 (mng_datap pData); -#endif -mng_retcode mng_store_idx8 (mng_datap pData); -mng_retcode mng_store_rgb8 (mng_datap pData); -mng_retcode mng_store_g8 (mng_datap pData); -mng_retcode mng_store_ga8 (mng_datap pData); -mng_retcode mng_store_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_g16 (mng_datap pData); -mng_retcode mng_store_ga16 (mng_datap pData); -mng_retcode mng_store_rgb16 (mng_datap pData); -mng_retcode mng_store_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row storage routines (JPEG) - store processed & uncompressed row-data * */ -/* * into the current "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_store_jpeg_g8 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8 (mng_datap pData); -mng_retcode mng_store_jpeg_ga8 (mng_datap pData); -mng_retcode mng_store_jpeg_rgba8 (mng_datap pData); - -#ifdef MNG_SUPPORT_JPEG12 -mng_retcode mng_store_jpeg_g12 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb12 (mng_datap pData); -mng_retcode mng_store_jpeg_ga12 (mng_datap pData); -mng_retcode mng_store_jpeg_rgba12 (mng_datap pData); -#endif - -mng_retcode mng_store_jpeg_g8_alpha (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8_alpha (mng_datap pData); - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_g8_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_g8_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_g8_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g8_a16 (mng_datap pData); -#endif - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb8_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_rgb8_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb8_a16 (mng_datap pData); -#endif - -#ifdef MNG_SUPPORT_JPEG12 -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_g12_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_g12_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_g12_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_g12_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_g12_a16 (mng_datap pData); -#endif - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb12_a1 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb12_a2 (mng_datap pData); -mng_retcode mng_store_jpeg_rgb12_a4 (mng_datap pData); -#endif -mng_retcode mng_store_jpeg_rgb12_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_store_jpeg_rgb12_a16 (mng_datap pData); -#endif -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the processed & uncompressed row-data * */ -/* * onto the target "object" * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1 (mng_datap pData); -mng_retcode mng_delta_g2 (mng_datap pData); -mng_retcode mng_delta_g4 (mng_datap pData); -#endif -mng_retcode mng_delta_g8 (mng_datap pData); -mng_retcode mng_delta_g16 (mng_datap pData); -mng_retcode mng_delta_rgb8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16 (mng_datap pData); -#endif -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_idx1 (mng_datap pData); -mng_retcode mng_delta_idx2 (mng_datap pData); -mng_retcode mng_delta_idx4 (mng_datap pData); -#endif -mng_retcode mng_delta_idx8 (mng_datap pData); -mng_retcode mng_delta_ga8 (mng_datap pData); -mng_retcode mng_delta_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16 (mng_datap pData); -mng_retcode mng_delta_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - apply the source row onto the target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_delta_g1_g1 (mng_datap pData); -mng_retcode mng_delta_g2_g2 (mng_datap pData); -mng_retcode mng_delta_g4_g4 (mng_datap pData); -#endif -mng_retcode mng_delta_g8_g8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_g16_g16 (mng_datap pData); -#endif -mng_retcode mng_delta_ga8_ga8 (mng_datap pData); -mng_retcode mng_delta_ga8_g8 (mng_datap pData); -mng_retcode mng_delta_ga8_a8 (mng_datap pData); -mng_retcode mng_delta_rgba8_rgb8 (mng_datap pData); -mng_retcode mng_delta_rgba8_a8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_ga16_ga16 (mng_datap pData); -mng_retcode mng_delta_ga16_g16 (mng_datap pData); -mng_retcode mng_delta_ga16_a16 (mng_datap pData); -mng_retcode mng_delta_rgba16_a16 (mng_datap pData); -mng_retcode mng_delta_rgba16_rgb16 (mng_datap pData); -#endif -#endif /* MNG_NO_DELTA_PNG */ -mng_retcode mng_delta_rgb8_rgb8 (mng_datap pData); /* Used for PAST */ -mng_retcode mng_delta_rgba8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_delta_rgb16_rgb16 (mng_datap pData); -mng_retcode mng_delta_rgba16_rgba16 (mng_datap pData); -#endif - -#ifndef MNG_NO_DELTA_PNG -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - scale the delta to bitdepth of target * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g1_g2 (mng_datap pData); -mng_retcode mng_scale_g1_g4 (mng_datap pData); -mng_retcode mng_scale_g1_g8 (mng_datap pData); -mng_retcode mng_scale_g2_g4 (mng_datap pData); -mng_retcode mng_scale_g2_g8 (mng_datap pData); -mng_retcode mng_scale_g4_g8 (mng_datap pData); -#endif -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g1_g16 (mng_datap pData); -mng_retcode mng_scale_g2_g16 (mng_datap pData); -mng_retcode mng_scale_g4_g16 (mng_datap pData); -#endif -mng_retcode mng_scale_g8_g16 (mng_datap pData); -mng_retcode mng_scale_ga8_ga16 (mng_datap pData); -mng_retcode mng_scale_rgb8_rgb16 (mng_datap pData); -mng_retcode mng_scale_rgba8_rgba16 (mng_datap pData); -#endif - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g2_g1 (mng_datap pData); -mng_retcode mng_scale_g4_g1 (mng_datap pData); -mng_retcode mng_scale_g8_g1 (mng_datap pData); -mng_retcode mng_scale_g4_g2 (mng_datap pData); -mng_retcode mng_scale_g8_g2 (mng_datap pData); -mng_retcode mng_scale_g8_g4 (mng_datap pData); -#endif -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_scale_g16_g1 (mng_datap pData); -mng_retcode mng_scale_g16_g2 (mng_datap pData); -mng_retcode mng_scale_g16_g4 (mng_datap pData); -#endif -mng_retcode mng_scale_g16_g8 (mng_datap pData); -mng_retcode mng_scale_ga16_ga8 (mng_datap pData); -mng_retcode mng_scale_rgb16_rgb8 (mng_datap pData); -mng_retcode mng_scale_rgba16_rgba8 (mng_datap pData); -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image bit routines - promote bit_depth * */ -/* * * */ -/* ************************************************************************** */ - -mng_uint8 mng_promote_replicate_1_2 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_1_4 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_1_8 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_2_4 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_2_8 (mng_uint8 iB); -mng_uint8 mng_promote_replicate_4_8 (mng_uint8 iB); -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_replicate_1_16 (mng_uint8 iB); -mng_uint16 mng_promote_replicate_2_16 (mng_uint8 iB); -mng_uint16 mng_promote_replicate_4_16 (mng_uint8 iB); -mng_uint16 mng_promote_replicate_8_16 (mng_uint8 iB); -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DELTA_PNG -mng_uint8 mng_promote_zerofill_1_2 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_1_4 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_1_8 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_2_4 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_2_8 (mng_uint8 iB); -mng_uint8 mng_promote_zerofill_4_8 (mng_uint8 iB); -#ifndef MNG_NO_16BIT_SUPPORT -mng_uint16 mng_promote_zerofill_1_16 (mng_uint8 iB); -mng_uint16 mng_promote_zerofill_2_16 (mng_uint8 iB); -mng_uint16 mng_promote_zerofill_4_16 (mng_uint8 iB); -mng_uint16 mng_promote_zerofill_8_16 (mng_uint8 iB); -#endif -#endif /* MNG_NO_DELTA_PNG */ - -/* ************************************************************************** */ -/* * * */ -/* * Delta-image row routines - promote color_type * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_promote_g8_g8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_g16 (mng_datap pData); -mng_retcode mng_promote_g16_g16 (mng_datap pData); -#endif - -mng_retcode mng_promote_g8_ga8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_ga16 (mng_datap pData); -mng_retcode mng_promote_g16_ga16 (mng_datap pData); -#endif - -mng_retcode mng_promote_g8_rgb8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgb16 (mng_datap pData); -mng_retcode mng_promote_g16_rgb16 (mng_datap pData); -#endif - -mng_retcode mng_promote_g8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_g8_rgba16 (mng_datap pData); -mng_retcode mng_promote_g16_rgba16 (mng_datap pData); - -mng_retcode mng_promote_ga8_ga16 (mng_datap pData); -#endif - -mng_retcode mng_promote_ga8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_ga8_rgba16 (mng_datap pData); -mng_retcode mng_promote_ga16_rgba16 (mng_datap pData); -#endif - -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgb16 (mng_datap pData); -#endif - -mng_retcode mng_promote_rgb8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_rgb8_rgba16 (mng_datap pData); -mng_retcode mng_promote_rgb16_rgba16 (mng_datap pData); -#endif - -mng_retcode mng_promote_idx8_rgb8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgb16 (mng_datap pData); -#endif - -mng_retcode mng_promote_idx8_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_promote_idx8_rgba16 (mng_datap pData); - -mng_retcode mng_promote_rgba8_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing routines - convert uncompressed data from zlib to * */ -/* * managable row-data which serves as input to the color-management * */ -/* * routines * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_g1 (mng_datap pData); -mng_retcode mng_process_g2 (mng_datap pData); -mng_retcode mng_process_g4 (mng_datap pData); -#endif -mng_retcode mng_process_g8 (mng_datap pData); -mng_retcode mng_process_rgb8 (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_process_idx1 (mng_datap pData); -mng_retcode mng_process_idx2 (mng_datap pData); -mng_retcode mng_process_idx4 (mng_datap pData); -#endif -mng_retcode mng_process_idx8 (mng_datap pData); -mng_retcode mng_process_ga8 (mng_datap pData); -mng_retcode mng_process_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_process_g16 (mng_datap pData); -mng_retcode mng_process_ga16 (mng_datap pData); -mng_retcode mng_process_rgb16 (mng_datap pData); -mng_retcode mng_process_rgba16 (mng_datap pData); -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines - set up the variables needed * */ -/* * to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_g1_i (mng_datap pData); -mng_retcode mng_init_g2_i (mng_datap pData); -mng_retcode mng_init_g4_i (mng_datap pData); -#endif -mng_retcode mng_init_g8_i (mng_datap pData); -mng_retcode mng_init_rgb8_i (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_idx1_i (mng_datap pData); -mng_retcode mng_init_idx2_i (mng_datap pData); -mng_retcode mng_init_idx4_i (mng_datap pData); -#endif -mng_retcode mng_init_idx8_i (mng_datap pData); -mng_retcode mng_init_ga8_i (mng_datap pData); -mng_retcode mng_init_rgba8_i (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_g1_ni (mng_datap pData); -mng_retcode mng_init_g2_ni (mng_datap pData); -mng_retcode mng_init_g4_ni (mng_datap pData); -#endif -mng_retcode mng_init_g8_ni (mng_datap pData); -mng_retcode mng_init_rgb8_ni (mng_datap pData); -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_idx1_ni (mng_datap pData); -mng_retcode mng_init_idx2_ni (mng_datap pData); -mng_retcode mng_init_idx4_ni (mng_datap pData); -#endif -mng_retcode mng_init_idx8_ni (mng_datap pData); -mng_retcode mng_init_ga8_ni (mng_datap pData); -mng_retcode mng_init_rgba8_ni (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_g16_i (mng_datap pData); -mng_retcode mng_init_rgb16_i (mng_datap pData); -mng_retcode mng_init_ga16_i (mng_datap pData); -mng_retcode mng_init_rgba16_i (mng_datap pData); -mng_retcode mng_init_g16_ni (mng_datap pData); -mng_retcode mng_init_rgb16_ni (mng_datap pData); -mng_retcode mng_init_ga16_ni (mng_datap pData); -mng_retcode mng_init_rgba16_ni (mng_datap pData); -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Row processing initialization routines (JPEG) - set up the variables * */ -/* * needed to process uncompressed row-data * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT -#ifdef MNG_INCLUDE_JNG -#ifndef MNG_NO_1_2_4BIT_SUPPORT -mng_retcode mng_init_jpeg_a1_ni (mng_datap pData); -mng_retcode mng_init_jpeg_a2_ni (mng_datap pData); -mng_retcode mng_init_jpeg_a4_ni (mng_datap pData); -#endif -mng_retcode mng_init_jpeg_a8_ni (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_init_jpeg_a16_ni (mng_datap pData); -#endif -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * General row processing routines * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_init_rowproc (mng_datap pData); -mng_retcode mng_next_row (mng_datap pData); -#ifdef MNG_INCLUDE_JNG -mng_retcode mng_next_jpeg_alpharow (mng_datap pData); -mng_retcode mng_next_jpeg_row (mng_datap pData); -#endif -mng_retcode mng_cleanup_rowproc (mng_datap pData); - -/* ************************************************************************** */ -/* * * */ -/* * Magnification row routines - apply magnification transforms * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -mng_retcode mng_magnify_g8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -#endif -mng_retcode mng_magnify_rgba8_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -mng_retcode mng_magnify_g8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -#endif -mng_retcode mng_magnify_rgba8_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba8_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); - -/* ************************************************************************** */ -#ifndef MNG_NO_16BIT_SUPPORT -#ifndef MNG_OPTIMIZE_FOOTPRINT_MAGN -mng_retcode mng_magnify_g16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x1 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x2 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x3 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x4 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_x5 (mng_datap pData, - mng_uint16 iMX, - mng_uint16 iML, - mng_uint16 iMR, - mng_uint32 iWidth, - mng_uint8p pSrcline, - mng_uint8p pDstline); - -mng_retcode mng_magnify_g16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_g16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgb16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_ga16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y1 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y2 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y3 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y4 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -mng_retcode mng_magnify_rgba16_y5 (mng_datap pData, - mng_int32 iS, - mng_int32 iM, - mng_uint32 iWidth, - mng_uint8p pSrcline1, - mng_uint8p pSrcline2, - mng_uint8p pDstline); -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * PAST composition routines - compose over/under with a target object * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode mng_composeover_rgba8 (mng_datap pData); -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_composeunder_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_composeover_rgba16 (mng_datap pData); -mng_retcode mng_composeunder_rgba16 (mng_datap pData); -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * PAST flip & tile routines - flip or tile a row of pixels * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef MNG_SKIPCHUNK_PAST -mng_retcode mng_flip_rgba8 (mng_datap pData); -mng_retcode mng_tile_rgba8 (mng_datap pData); -#ifndef MNG_NO_16BIT_SUPPORT -mng_retcode mng_flip_rgba16 (mng_datap pData); -mng_retcode mng_tile_rgba16 (mng_datap pData); -#endif -#endif - -/* ************************************************************************** */ - -#endif /* _libmng_pixels_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_prop_xs.c b/Engine/lib/lmng/libmng_prop_xs.c deleted file mode 100644 index 88e416d5c..000000000 --- a/Engine/lib/lmng/libmng_prop_xs.c +++ /dev/null @@ -1,2799 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_prop_xs.c copyright (c) 2000-2006 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : property get/set interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the property get/set functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - fixed calling convention * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added set_outputprofile2 & set_srgbprofile2 * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - changed inclusion of cms-routines * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added support for get/set default zlib/IJG parms * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contribution by Tim Rowley) * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added support for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added get/set for speedtype to facilitate testing * */ -/* * - added get for imagelevel during processtext callback * */ -/* * 0.5.3 - 06/26/2000 - G.Juyn * */ -/* * - changed userdata variable to mng_ptr * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - fixed incompatible return-types * */ -/* * * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added get routines for internal display variables * */ -/* * - added get/set routines for suspensionmode variable * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added get/set routines for sectionbreak variable * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - added status_xxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B495442 - invalid returnvalue in mng_get_suspensionmode * */ -/* * * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 05/11/2003 - G. Juyn * */ -/* * - added conditionals around canvas update routines * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around some JNG-supporting code * */ -/* * 1.0.6 - 07/11/2003 - G.R-P * */ -/* * - added conditionals zlib and jpeg property accessors * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added conditionals around various unused functions * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 12/06/2003 - R.A * */ -/* * - added CANVAS_RGBA565 and CANVAS_BGRA565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/07/2004 - G.R-P. * */ -/* * - put gamma, cms-related functions inside #ifdef * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * * */ -/* * 1.0.9 - 09/18/2004 - G.R-P. * */ -/* * - added some MNG_SUPPORT_WRITE conditionals * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* * 1.0.10 - 03/07/2006 - (thanks to W. Manthey) * */ -/* * - added CANVAS_RGB555 and CANVAS_BGR555 * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_objects.h" -#include "libmng_memory.h" -#include "libmng_cms.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Property set functions * */ -/* * * */ -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_userdata (mng_handle hHandle, - mng_ptr pUserdata) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->pUserdata = pUserdata; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USERDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_canvasstyle (mng_handle hHandle, - mng_uint32 iStyle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CANVASSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - switch (iStyle) - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGBA8 - case MNG_CANVAS_RGBA8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGBA8_PM - case MNG_CANVAS_RGBA8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_ARGB8 - case MNG_CANVAS_ARGB8 : break; -#endif -#ifndef MNG_SKIPCANVAS_ARGB8_PM - case MNG_CANVAS_ARGB8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_RGB8_A8 - case MNG_CANVAS_RGB8_A8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRA8 - case MNG_CANVAS_BGRA8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRA8_PM - case MNG_CANVAS_BGRA8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_ABGR8 - case MNG_CANVAS_ABGR8 : break; -#endif -#ifndef MNG_SKIPCANVAS_ABGR8_PM - case MNG_CANVAS_ABGR8_PM: break; -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGBA565 - case MNG_CANVAS_RGBA565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRA565 - case MNG_CANVAS_BGRA565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR565_A8 - case MNG_CANVAS_BGR565_A8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGB555 - case MNG_CANVAS_RGB555 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR555 - case MNG_CANVAS_BGR555 : break; -#endif -/* case MNG_CANVAS_RGB16 : break; */ -/* case MNG_CANVAS_RGBA16 : break; */ -/* case MNG_CANVAS_ARGB16 : break; */ -/* case MNG_CANVAS_BGR16 : break; */ -/* case MNG_CANVAS_BGRA16 : break; */ -/* case MNG_CANVAS_ABGR16 : break; */ -/* case MNG_CANVAS_INDEX8 : break; */ -/* case MNG_CANVAS_INDEXA8 : break; */ -/* case MNG_CANVAS_AINDEX8 : break; */ -/* case MNG_CANVAS_GRAY8 : break; */ -/* case MNG_CANVAS_GRAY16 : break; */ -/* case MNG_CANVAS_GRAYA8 : break; */ -/* case MNG_CANVAS_GRAYA16 : break; */ -/* case MNG_CANVAS_AGRAY8 : break; */ -/* case MNG_CANVAS_AGRAY16 : break; */ -/* case MNG_CANVAS_DX15 : break; */ -/* case MNG_CANVAS_DX16 : break; */ - default : { MNG_ERROR (((mng_datap)hHandle), MNG_INVALIDCNVSTYLE) }; - } - - ((mng_datap)hHandle)->iCanvasstyle = iStyle; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CANVASSTYLE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_bkgdstyle (mng_handle hHandle, - mng_uint32 iStyle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BKGDSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - switch (iStyle) /* alpha-modes not supported */ - { -#ifndef MNG_SKIPCANVAS_RGB8 - case MNG_CANVAS_RGB8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR8 - case MNG_CANVAS_BGR8 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGRX8 - case MNG_CANVAS_BGRX8 : break; -#endif -#ifndef MNG_SKIPCANVAS_RGB565 - case MNG_CANVAS_RGB565 : break; -#endif -#ifndef MNG_SKIPCANVAS_BGR565 - case MNG_CANVAS_BGR565 : break; -#endif -/* case MNG_CANVAS_RGB16 : break; */ -/* case MNG_CANVAS_BGR16 : break; */ -/* case MNG_CANVAS_INDEX8 : break; */ -/* case MNG_CANVAS_GRAY8 : break; */ -/* case MNG_CANVAS_GRAY16 : break; */ -/* case MNG_CANVAS_DX15 : break; */ -/* case MNG_CANVAS_DX16 : break; */ - default : MNG_ERROR (((mng_datap)hHandle), MNG_INVALIDCNVSTYLE); - } - - ((mng_datap)hHandle)->iBkgdstyle = iStyle; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BKGDSTYLE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_bgcolor (mng_handle hHandle, - mng_uint16 iRed, - mng_uint16 iGreen, - mng_uint16 iBlue) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BGCOLOR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iBGred = iRed; - ((mng_datap)hHandle)->iBGgreen = iGreen; - ((mng_datap)hHandle)->iBGblue = iBlue; - ((mng_datap)hHandle)->bUseBKGD = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_BGCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_usebkgd (mng_handle hHandle, - mng_bool bUseBKGD) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bUseBKGD = bUseBKGD; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_USEBKGD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_storechunks (mng_handle hHandle, - mng_bool bStorechunks) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_STORECHUNKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bStorechunks = bStorechunks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_STORECHUNKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_sectionbreaks (mng_handle hHandle, - mng_bool bSectionbreaks) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SECTIONBREAKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bSectionbreaks = bSectionbreaks; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SECTIONBREAKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_cacheplayback (mng_handle hHandle, - mng_bool bCacheplayback) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CACHEPLAYBACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - if (((mng_datap)hHandle)->bHasheader) - MNG_ERROR (((mng_datap)hHandle), MNG_FUNCTIONINVALID); - - ((mng_datap)hHandle)->bCacheplayback = bCacheplayback; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CACHEPLAYBACK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_doprogressive (mng_handle hHandle, - mng_bool bDoProgressive) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DOPROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - ((mng_datap)hHandle)->bDoProgressive = bDoProgressive; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DOPROGRESSIVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_crcmode (mng_handle hHandle, - mng_uint32 iCrcmode) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CRCMODE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - ((mng_datap)hHandle)->iCrcmode = iCrcmode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_CRCMODE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_srgb (mng_handle hHandle, - mng_bool bIssRGB) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bIssRGB = bIssRGB; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_set_outputprofile (mng_handle hHandle, - mng_pchar zFilename) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf2) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf2); - /* allocate new CMS profile handle */ - pData->hProf2 = mnglcms_createfileprofile (zFilename); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_SKIPCHUNK_iCCP -mng_retcode MNG_DECL mng_set_outputprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE2, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf2) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf2); - /* allocate new CMS profile handle */ - pData->hProf2 = mnglcms_creatememprofile (iProfilesize, pProfile); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTPROFILE2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_outputsrgb (mng_handle hHandle) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTSRGB, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf2) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf2); - /* allocate new CMS profile handle */ - pData->hProf2 = mnglcms_createsrgbprofile (); - - if (!pData->hProf2) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_OUTPUTSRGB, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_srgbprofile (mng_handle hHandle, - mng_pchar zFilename) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE2, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf3) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf3); - /* allocate new CMS profile handle */ - pData->hProf3 = mnglcms_createfileprofile (zFilename); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE2, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_srgbprofile2 (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf3) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf3); - /* allocate new CMS profile handle */ - pData->hProf3 = mnglcms_creatememprofile (iProfilesize, pProfile); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBPROFILE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_srgbimplicit (mng_handle hHandle) -{ -#ifdef MNG_INCLUDE_LCMS - mng_datap pData; -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBIMPLICIT, MNG_LC_START); -#endif - -#ifdef MNG_INCLUDE_LCMS - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; /* address the structure */ - - if (pData->hProf3) /* previously defined ? */ - mnglcms_freeprofile (pData->hProf3); - /* allocate new CMS profile handle */ - pData->hProf3 = mnglcms_createsrgbprofile (); - - if (!pData->hProf3) /* handle error ? */ - MNG_ERRORL (pData, MNG_LCMS_NOHANDLE); -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SRGBIMPLICIT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_set_viewgamma (mng_handle hHandle, - mng_float dGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dViewgamma = dGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_displaygamma (mng_handle hHandle, - mng_float dGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDisplaygamma = dGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_dfltimggamma (mng_handle hHandle, - mng_float dGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDfltimggamma = dGamma; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_retcode MNG_DECL mng_set_viewgammaint (mng_handle hHandle, - mng_uint32 iGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dViewgamma = (mng_float)iGamma / 100000; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_VIEWGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_displaygammaint (mng_handle hHandle, - mng_uint32 iGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDisplaygamma = (mng_float)iGamma / 100000; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#ifndef MNG_NO_DFLT_INFO -mng_retcode MNG_DECL mng_set_dfltimggammaint (mng_handle hHandle, - mng_uint32 iGamma) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->dDfltimggamma = (mng_float)iGamma / 100000; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIP_MAXCANVAS -mng_retcode MNG_DECL mng_set_maxcanvaswidth (mng_handle hHandle, - mng_uint32 iMaxwidth) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxwidth = iMaxwidth; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASWIDTH, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_maxcanvasheight (mng_handle hHandle, - mng_uint32 iMaxheight) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASHEIGHT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxheight = iMaxheight; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASHEIGHT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_set_maxcanvassize (mng_handle hHandle, - mng_uint32 iMaxwidth, - mng_uint32 iMaxheight) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASSIZE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxwidth = iMaxwidth; - ((mng_datap)hHandle)->iMaxheight = iMaxheight; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_MAXCANVASSIZE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_level (mng_handle hHandle, - mng_int32 iZlevel) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_LEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZlevel = iZlevel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_LEVEL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_method (mng_handle hHandle, - mng_int32 iZmethod) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_METHOD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZmethod = iZmethod; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_METHOD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_windowbits (mng_handle hHandle, - mng_int32 iZwindowbits) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_WINDOWBITS, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZwindowbits = iZwindowbits; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_WINDOWBITS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_memlevel (mng_handle hHandle, - mng_int32 iZmemlevel) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MEMLEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZmemlevel = iZmemlevel; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MEMLEVEL, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_strategy (mng_handle hHandle, - mng_int32 iZstrategy) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_STRATEGY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iZstrategy = iZstrategy; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_STRATEGY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_zlib_maxidat (mng_handle hHandle, - mng_uint32 iMaxIDAT) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MAXIDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxIDAT = iMaxIDAT; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_ZLIB_MAXIDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_dctmethod (mng_handle hHandle, - mngjpeg_dctmethod eJPEGdctmethod) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_DCTMETHOD, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->eJPEGdctmethod = eJPEGdctmethod; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_DCTMETHOD, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif MNG_SUPPORT_WRITE -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_quality (mng_handle hHandle, - mng_int32 iJPEGquality) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_QUALITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iJPEGquality = iJPEGquality; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_QUALITY, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_smoothing (mng_handle hHandle, - mng_int32 iJPEGsmoothing) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_SMOOTHING, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iJPEGsmoothing = iJPEGsmoothing; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_SMOOTHING, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_progressive (mng_handle hHandle, - mng_bool bJPEGprogressive) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_PROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bJPEGcompressprogr = bJPEGprogressive; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_PROGRESSIVE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_optimized (mng_handle hHandle, - mng_bool bJPEGoptimized) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_OPTIMIZED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->bJPEGcompressopt = bJPEGoptimized; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_OPTIMIZED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -#ifdef MNG_SUPPORT_WRITE -mng_retcode MNG_DECL mng_set_jpeg_maxjdat (mng_handle hHandle, - mng_uint32 iMaxJDAT) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_MAXJDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iMaxJDAT = iMaxJDAT; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_JPEG_MAXJDAT, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_WRITE */ -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_retcode MNG_DECL mng_set_suspensionmode (mng_handle hHandle, - mng_bool bSuspensionmode) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SUSPENSIONMODE, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - if (((mng_datap)hHandle)->bReading) /* we must NOT be reading !!! */ - MNG_ERROR ((mng_datap)hHandle, MNG_FUNCTIONINVALID); - - ((mng_datap)hHandle)->bSuspensionmode = bSuspensionmode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SUSPENSIONMODE, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_set_speed (mng_handle hHandle, - mng_speedtype iSpeed) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SPEED, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - ((mng_datap)hHandle)->iSpeed = iSpeed; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_SET_SPEED, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ -/* * * */ -/* * Property get functions * */ -/* * * */ -/* ************************************************************************** */ - -mng_ptr MNG_DECL mng_get_userdata (mng_handle hHandle) -{ /* no tracing in here to prevent recursive calls */ - MNG_VALIDHANDLEX (hHandle) - return ((mng_datap)hHandle)->pUserdata; -} - -/* ************************************************************************** */ - -mng_imgtype MNG_DECL mng_get_sigtype (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIGTYPE, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_it_unknown; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIGTYPE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->eSigtype; -} - -/* ************************************************************************** */ - -mng_imgtype MNG_DECL mng_get_imagetype (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGETYPE, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_it_unknown; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGETYPE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->eImagetype; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_imagewidth (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEWIDTH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iWidth; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_imageheight (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGEHEIGHT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iHeight; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_ticks (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TICKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TICKS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTicks; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_framecount (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FRAMECOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FRAMECOUNT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iFramecount; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_layercount (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LAYERCOUNT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LAYERCOUNT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iLayercount; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_playtime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_PLAYTIME, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_PLAYTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iPlaytime; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_simplicity (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIMPLICITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SIMPLICITY, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iSimplicity; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_bitdepth (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BITDEPTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iBitdepth; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRimgbitdepth; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BITDEPTH, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_colortype (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COLORTYPE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iColortype; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRcolortype; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COLORTYPE, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_compression (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COMPRESSION, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iCompression; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRimgcompression; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_COMPRESSION, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_filter (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FILTER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iFilter; - else - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_FILTER, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_interlace (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_INTERLACE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - if (((mng_datap)hHandle)->eImagetype == mng_it_png) - iRslt = ((mng_datap)hHandle)->iInterlace; - else -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRimginterlace; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_INTERLACE, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphabitdepth (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHABITDEPTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphabitdepth; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHABITDEPTH, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint8 MNG_DECL mng_get_refreshpass (mng_handle hHandle) -{ - mng_uint8 iRslt; - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_REFRESHPASS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - - pData = (mng_datap)hHandle; - /* for PNG we know the exact pass */ - if ((pData->eImagetype == mng_it_png) && (pData->iPass >= 0)) - iRslt = pData->iPass; -#ifdef MNG_INCLUDE_JNG - else /* for JNG we'll fake it... */ - if ((pData->eImagetype == mng_it_jng) && - (pData->bJPEGhasheader) && (pData->bJPEGdecostarted) && - (pData->bJPEGprogressive)) - { - if (pData->pJPEGdinfo->input_scan_number <= 1) - iRslt = 0; /* first pass (I think...) */ - else - if (jpeg_input_complete (pData->pJPEGdinfo)) - iRslt = 7; /* input complete; aka final pass */ - else - iRslt = 3; /* anything between 0 and 7 will do */ - - } -#endif - else - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_REFRESHPASS, MNG_LC_END); -#endif - - return iRslt; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ -mng_uint8 MNG_DECL mng_get_alphacompression (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHACOMPRESSION, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphacompression; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHACOMPRESSION, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphafilter (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAFILTER, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphafilter; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAFILTER, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphainterlace (mng_handle hHandle) -{ - mng_uint8 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAINTERLACE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_INCLUDE_JNG - if (((mng_datap)hHandle)->eImagetype == mng_it_jng) - iRslt = ((mng_datap)hHandle)->iJHDRalphainterlace; - else -#endif - iRslt = 0; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHAINTERLACE, MNG_LC_END); -#endif - - return iRslt; -} - -/* ************************************************************************** */ - -mng_uint8 MNG_DECL mng_get_alphadepth (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHADEPTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ALPHADEPTH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iAlphadepth; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_canvasstyle (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CANVASSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CANVASSTYLE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iCanvasstyle; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_bkgdstyle (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BKGDSTYLE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_BKGDSTYLE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iBkgdstyle; -} - -/* ************************************************************************** */ - -mng_retcode MNG_DECL mng_get_bgcolor (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GET_BGCOLOR, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - *iRed = ((mng_datap)hHandle)->iBGred; - *iGreen = ((mng_datap)hHandle)->iBGgreen; - *iBlue = ((mng_datap)hHandle)->iBGblue; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (((mng_datap)hHandle), MNG_FN_GET_BGCOLOR, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_usebkgd (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_USEBKGD, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_USEBKGD, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bUseBKGD; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_storechunks (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_STORECHUNKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_STORECHUNKS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bStorechunks; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_sectionbreaks (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SECTIONBREAKS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SECTIONBREAKS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bSectionbreaks; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_cacheplayback (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CACHEPLAYBACK, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CACHEPLAYBACK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bCacheplayback; -} - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_get_doprogressive (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_DOPROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_DOPROGRESSIVE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bDoProgressive; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_crcmode (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CRCMODE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_CRCMODE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iCrcmode; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_get_srgb (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SRGB, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEB (((mng_datap)hHandle), MNG_FN_GET_SRGB, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bIssRGB; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_float MNG_DECL mng_get_viewgamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->dViewgamma; -} -#endif - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_float MNG_DECL mng_get_displaygamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->dDisplaygamma; -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DFLT_INFO -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_float MNG_DECL mng_get_dfltimggamma (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->dDfltimggamma; -} -#endif -#endif - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_uint32 MNG_DECL mng_get_viewgammaint (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_VIEWGAMMA, MNG_LC_END); -#endif - - return (mng_uint32)(((mng_datap)hHandle)->dViewgamma * 100000); -} -#endif - -/* ************************************************************************** */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_uint32 MNG_DECL mng_get_displaygammaint (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DISPLAYGAMMA, MNG_LC_END); -#endif - - return (mng_uint32)(((mng_datap)hHandle)->dDisplaygamma * 100000); -} -#endif - -/* ************************************************************************** */ - -#ifndef MNG_NO_DFLT_INFO -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -mng_uint32 MNG_DECL mng_get_dfltimggammaint (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_DFLTIMGGAMMA, MNG_LC_END); -#endif - - return (mng_uint32)(((mng_datap)hHandle)->dDfltimggamma * 100000); -} -#endif -#endif - -/* ************************************************************************** */ - -#ifndef MNG_SKIP_MAXCANVAS -mng_uint32 MNG_DECL mng_get_maxcanvaswidth (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASWIDTH, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASWIDTH, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxwidth; -} - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_maxcanvasheight (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASHEIGHT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_MAXCANVASHEIGHT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxheight; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_level (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_LEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_LEVEL, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZlevel; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_method (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_METHOD, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_METHOD, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZmethod; -} - -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_windowbits (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_WINDOWBITS, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_WINDOWBITS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZwindowbits; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_memlevel (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MEMLEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MEMLEVEL, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZmemlevel; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_int32 MNG_DECL mng_get_zlib_strategy (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_STRATEGY, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_STRATEGY, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iZstrategy; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB -#ifdef MNG_ACCESS_ZLIB -mng_uint32 MNG_DECL mng_get_zlib_maxidat (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MAXIDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_ZLIB_MAXIDAT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxIDAT; -} -#endif /* MNG_ACCESS_ZLIB */ -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mngjpeg_dctmethod MNG_DECL mng_get_jpeg_dctmethod (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_DCTMETHOD, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return JDCT_ISLOW; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_DCTMETHOD, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->eJPEGdctmethod; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_int32 MNG_DECL mng_get_jpeg_quality (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_QUALITY, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_QUALITY, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iJPEGquality; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_int32 MNG_DECL mng_get_jpeg_smoothing (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_SMOOTHING, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_SMOOTHING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iJPEGsmoothing; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_bool MNG_DECL mng_get_jpeg_progressive (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_PROGRESSIVE, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_PROGRESSIVE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bJPEGcompressprogr; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_bool MNG_DECL mng_get_jpeg_optimized (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_OPTIMIZED, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_OPTIMIZED, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bJPEGcompressopt; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG -#ifdef MNG_ACCESS_JPEG -mng_uint32 MNG_DECL mng_get_jpeg_maxjdat (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_MAXJDAT, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_JPEG_MAXJDAT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iMaxJDAT; -} -#endif /* MNG_ACCESS_JPEG */ -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_bool MNG_DECL mng_get_suspensionmode (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SUSPENSIONMODE, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SUSPENSIONMODE, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bSuspensionmode; -} -#endif /* MNG_SUPPORT_READ */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_speedtype MNG_DECL mng_get_speed (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_SPEED, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iSpeed; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_uint32 MNG_DECL mng_get_imagelevel (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGELEVEL, MNG_LC_START); -#endif - - MNG_VALIDHANDLEX (hHandle) - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_IMAGELEVEL, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iImagelevel; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_get_lastbackchunk (mng_handle hHandle, - mng_uint16* iRed, - mng_uint16* iGreen, - mng_uint16* iBlue, - mng_uint8* iMandatory) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTBACKCHUNK, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - if (((mng_datap)hHandle)->eImagetype != mng_it_mng) - MNG_ERROR (((mng_datap)hHandle), MNG_FUNCTIONINVALID); - - *iRed = ((mng_datap)hHandle)->iBACKred; - *iGreen = ((mng_datap)hHandle)->iBACKgreen; - *iBlue = ((mng_datap)hHandle)->iBACKblue; - *iMandatory = ((mng_datap)hHandle)->iBACKmandatory; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTBACKCHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode MNG_DECL mng_get_lastseekname (mng_handle hHandle, - mng_pchar zSegmentname) -{ - mng_datap pData; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTSEEKNAME, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; - /* only allowed for MNG ! */ - if (pData->eImagetype != mng_it_mng) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - if (pData->pLastseek) /* is there a last SEEK ? */ - { - mng_ani_seekp pSEEK = (mng_ani_seekp)pData->pLastseek; - - if (pSEEK->iSegmentnamesize) /* copy the name if there is one */ - MNG_COPY (zSegmentname, pSEEK->zSegmentname, pSEEK->iSegmentnamesize); - - *(((mng_uint8p)zSegmentname) + pSEEK->iSegmentnamesize) = 0; - } - else - { /* return an empty string */ - *((mng_uint8p)zSegmentname) = 0; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_LASTSEEKNAME, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint32 MNG_DECL mng_get_currframdelay (mng_handle hHandle) -{ - mng_datap pData; - mng_uint32 iRslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRFRAMDELAY, MNG_LC_START); -#endif - - MNG_VALIDHANDLE (hHandle) - - pData = (mng_datap)hHandle; - /* only allowed for MNG ! */ - if (pData->eImagetype != mng_it_mng) - MNG_ERROR (pData, MNG_FUNCTIONINVALID); - - iRslt = pData->iFramedelay; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRFRAMDELAY, MNG_LC_END); -#endif - - return iRslt; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint32 MNG_DECL mng_get_starttime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_STARTTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_STARTTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iStarttime; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_uint32 MNG_DECL mng_get_runtime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_RUNTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_RUNTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iRuntime; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_currentframe (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTFRAME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTFRAME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iFrameseq; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_currentlayer (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTLAYER, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTLAYER, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iLayerseq; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_currentplaytime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTPLAYTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_CURRENTPLAYTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iFrametime; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_totalframes (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALFRAMES, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALFRAMES, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTotalframes; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_totallayers (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALLAYERS, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALLAYERS, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTotallayers; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -#ifndef MNG_NO_CURRENT_INFO -mng_uint32 MNG_DECL mng_get_totalplaytime (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALPLAYTIME, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return mng_st_normal; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_GET_TOTALPLAYTIME, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->iTotalplaytime; -} -#endif -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_bool MNG_DECL mng_status_error (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_ERROR, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_ERROR, MNG_LC_END); -#endif - - return (mng_bool)((mng_datap)hHandle)->iErrorcode; -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_bool MNG_DECL mng_status_reading (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_READING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_READING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bReading; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_READ -mng_bool MNG_DECL mng_status_suspendbreak (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_SUSPENDBREAK, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_SUSPENDBREAK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bSuspended; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_bool MNG_DECL mng_status_creating (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_CREATING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_CREATING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bCreating; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_WRITE -mng_bool MNG_DECL mng_status_writing (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_WRITING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_WRITING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bWriting; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_status_displaying (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DISPLAYING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DISPLAYING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bDisplaying; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_status_running (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNING, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNING, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bRunning; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_bool MNG_DECL mng_status_timerbreak (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_TIMERBREAK, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_TIMERBREAK, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bTimerset; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -mng_bool MNG_DECL mng_status_dynamic (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DYNAMIC, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_DYNAMIC, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bDynamic; -} -#endif - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DYNAMICMNG -mng_bool MNG_DECL mng_status_runningevent (mng_handle hHandle) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNINGEVENT, MNG_LC_START); -#endif - - if ((hHandle == 0) || (((mng_datap)hHandle)->iMagic != MNG_MAGIC)) - return MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACEX (((mng_datap)hHandle), MNG_FN_STATUS_RUNNINGEVENT, MNG_LC_END); -#endif - - return ((mng_datap)hHandle)->bRunningevent; -} -#endif - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_read.c b/Engine/lib/lmng/libmng_read.c deleted file mode 100644 index c922e19a5..000000000 --- a/Engine/lib/lmng/libmng_read.c +++ /dev/null @@ -1,1369 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_read.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Read logic (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the high-level read logic * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/19/2000 - G.Juyn * */ -/* * - cleaned up some code regarding mixed support * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added support for JNG * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed up punctuation (contribution by Tim Rowley) * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - changed read-processing for improved I/O-suspension * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed EOF processing behavior * */ -/* * 0.9.1 - 07/14/2000 - G.Juyn * */ -/* * - changed default readbuffer size from 1024 to 4200 * */ -/* * * */ -/* * 0.9.2 - 07/27/2000 - G.Juyn * */ -/* * - B110320 - fixed GCC warning about mix-sized pointer math * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - B110546 - fixed for improperly returning UNEXPECTEDEOF * */ -/* * 0.9.2 - 08/04/2000 - G.Juyn * */ -/* * - B111096 - fixed large-buffer read-suspension * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - removed test-MaGN * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added support for JDAA * */ -/* * * */ -/* * 0.9.5 - 01/23/2001 - G.Juyn * */ -/* * - fixed timing-problem with switching framing_modes * */ -/* * * */ -/* * 1.0.4 - 06/22/2002 - G.Juyn * */ -/* * - B495443 - incorrect suspend check in read_databuffer * */ -/* * * */ -/* * 1.0.5 - 07/04/2002 - G.Juyn * */ -/* * - added errorcode for extreme chunk-sizes * */ -/* * 1.0.5 - 07/08/2002 - G.Juyn * */ -/* * - B578572 - removed eMNGma hack (thanks Dimitri!) * */ -/* * 1.0.5 - 07/16/2002 - G.Juyn * */ -/* * - B581625 - large chunks fail with suspension reads * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/16/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * * */ -/* * 1.0.6 - 05/25/2003 - G.R-P * */ -/* * - added MNG_SKIPCHUNK_cHNK footprint optimizations * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_NO_DELTA_PNG reduction * */ -/* * - skip additional code when MNG_INCLUDE_JNG is not enabled * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * 1.0.6 - 08/17/2003 - G.R-P * */ -/* * - added conditionals around non-VLC chunk support * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/08/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 07/06/2004 - G.R-P * */ -/* * - defend against using undefined closestream function * */ -/* * 1.0.8 - 07/28/2004 - G.R-P * */ -/* * - added check for extreme chunk-lengths * */ -/* * * */ -/* * 1.0.9 - 09/16/2004 - G.Juyn * */ -/* * - fixed chunk pushing mechanism * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKINITFREE * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKASSIGN * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * 1.0.9 - 12/31/2004 - G.R-P * */ -/* * - removed stray characters from #ifdef directive * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_objects.h" -#include "libmng_object_prc.h" -#include "libmng_chunks.h" -#ifdef MNG_OPTIMIZE_CHUNKREADER -#include "libmng_chunk_descr.h" -#endif -#include "libmng_chunk_prc.h" -#include "libmng_chunk_io.h" -#include "libmng_display.h" -#include "libmng_read.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_READ_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_process_eof (mng_datap pData) -{ - if (!pData->bEOF) /* haven't closed the stream yet ? */ - { - pData->bEOF = MNG_TRUE; /* now we do! */ - -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fClosestream && !pData->fClosestream ((mng_handle)pData)) - { - MNG_ERROR (pData, MNG_APPIOERROR); - } -#endif - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_release_pushdata (mng_datap pData) -{ - mng_pushdatap pFirst = pData->pFirstpushdata; - mng_pushdatap pNext = pFirst->pNext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHDATA, MNG_LC_START); -#endif - - pData->pFirstpushdata = pNext; /* next becomes the first */ - - if (!pNext) /* no next? => no last! */ - pData->pLastpushdata = MNG_NULL; - /* buffer owned and release callback defined? */ - if ((pFirst->bOwned) && (pData->fReleasedata)) - pData->fReleasedata ((mng_handle)pData, pFirst->pData, pFirst->iLength); - else /* otherwise use internal free mechanism */ - MNG_FREEX (pData, pFirst->pData, pFirst->iLength); - /* and free it */ - MNG_FREEX (pData, pFirst, sizeof(mng_pushdata)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mng_release_pushchunk (mng_datap pData) -{ - mng_pushdatap pFirst = pData->pFirstpushchunk; - mng_pushdatap pNext = pFirst->pNext; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHCHUNK, MNG_LC_START); -#endif - - pData->pFirstpushchunk = pNext; /* next becomes the first */ - - if (!pNext) /* no next? => no last! */ - pData->pLastpushchunk = MNG_NULL; - /* buffer owned and release callback defined? */ - if ((pFirst->bOwned) && (pData->fReleasedata)) - pData->fReleasedata ((mng_handle)pData, pFirst->pData, pFirst->iLength); - else /* otherwise use internal free mechanism */ - MNG_FREEX (pData, pFirst->pData, pFirst->iLength); - /* and free it */ - MNG_FREEX (pData, pFirst, sizeof(mng_pushdata)); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_RELEASE_PUSHCHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode read_data (mng_datap pData, - mng_uint8p pBuf, - mng_uint32 iSize, - mng_uint32 * iRead) -{ - mng_retcode iRetcode; - mng_uint32 iTempsize = iSize; - mng_uint8p pTempbuf = pBuf; - mng_pushdatap pPush = pData->pFirstpushdata; - mng_uint32 iPushsize = 0; - *iRead = 0; /* nothing yet */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATA, MNG_LC_START); -#endif - - while (pPush) /* calculate size of pushed data */ - { - iPushsize += pPush->iRemaining; - pPush = pPush->pNext; - } - - if (iTempsize <= iPushsize) /* got enough push data? */ - { - while (iTempsize) - { - pPush = pData->pFirstpushdata; - /* enough data remaining in this buffer? */ - if (pPush->iRemaining <= iTempsize) - { /* no: then copy what we've got */ - MNG_COPY (pTempbuf, pPush->pDatanext, pPush->iRemaining); - /* move pointers & lengths */ - pTempbuf += pPush->iRemaining; - *iRead += pPush->iRemaining; - iTempsize -= pPush->iRemaining; - /* release the depleted buffer */ - iRetcode = mng_release_pushdata (pData); - if (iRetcode) - return iRetcode; - } - else - { /* copy the needed bytes */ - MNG_COPY (pTempbuf, pPush->pDatanext, iTempsize); - /* move pointers & lengths */ - pPush->iRemaining -= iTempsize; - pPush->pDatanext += iTempsize; - pTempbuf += iTempsize; - *iRead += iTempsize; - iTempsize = 0; /* all done!!! */ - } - } - } - else - { - mng_uint32 iTempread = 0; - /* get it from the app then */ - if (!pData->fReaddata (((mng_handle)pData), pTempbuf, iTempsize, &iTempread)) - MNG_ERROR (pData, MNG_APPIOERROR); - - *iRead += iTempread; - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode read_databuffer (mng_datap pData, - mng_uint8p pBuf, - mng_uint8p * pBufnext, - mng_uint32 iSize, - mng_uint32 * iRead) -{ - mng_retcode iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATABUFFER, MNG_LC_START); -#endif - - if (pData->bSuspensionmode) - { - mng_uint8p pTemp; - mng_uint32 iTemp; - - *iRead = 0; /* let's be negative about the outcome */ - - if (!pData->pSuspendbuf) /* need to create a suspension buffer ? */ - { - pData->iSuspendbufsize = MNG_SUSPENDBUFFERSIZE; - /* so, create it */ - MNG_ALLOC (pData, pData->pSuspendbuf, pData->iSuspendbufsize); - - pData->iSuspendbufleft = 0; /* make sure to fill it first time */ - pData->pSuspendbufnext = pData->pSuspendbuf; - } - /* more than our buffer can hold ? */ - if (iSize > pData->iSuspendbufsize) - { - mng_uint32 iRemain; - - if (!*pBufnext) /* first time ? */ - { - if (pData->iSuspendbufleft) /* do we have some data left ? */ - { /* then copy it */ - MNG_COPY (pBuf, pData->pSuspendbufnext, pData->iSuspendbufleft); - /* fixup variables */ - *pBufnext = pBuf + pData->iSuspendbufleft; - pData->pSuspendbufnext = pData->pSuspendbuf; - pData->iSuspendbufleft = 0; - } - else - { - *pBufnext = pBuf; - } - } - /* calculate how much to get */ - iRemain = iSize - (mng_uint32)(*pBufnext - pBuf); - /* let's go get it */ - iRetcode = read_data (pData, *pBufnext, iRemain, &iTemp); - if (iRetcode) - return iRetcode; - /* first read after suspension return 0 means EOF */ - if ((pData->iSuspendpoint) && (iTemp == 0)) - { /* that makes it final */ - mng_retcode iRetcode = mng_process_eof (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* indicate the source is depleted */ - *iRead = iSize - iRemain + iTemp; - } - else - { - if (iTemp < iRemain) /* suspension required ? */ - { - *pBufnext = *pBufnext + iTemp; - pData->bSuspended = MNG_TRUE; - } - else - { - *iRead = iSize; /* got it all now ! */ - } - } - } - else - { /* need to read some more ? */ - while ((!pData->bSuspended) && (!pData->bEOF) && (iSize > pData->iSuspendbufleft)) - { /* not enough space left in buffer ? */ - if (pData->iSuspendbufsize - pData->iSuspendbufleft - - (mng_uint32)(pData->pSuspendbufnext - pData->pSuspendbuf) < - MNG_SUSPENDREQUESTSIZE) - { - if (pData->iSuspendbufleft) /* then lets shift (if there's anything left) */ - MNG_COPY (pData->pSuspendbuf, pData->pSuspendbufnext, pData->iSuspendbufleft); - /* adjust running pointer */ - pData->pSuspendbufnext = pData->pSuspendbuf; - } - /* still not enough room ? */ - if (pData->iSuspendbufsize - pData->iSuspendbufleft < MNG_SUSPENDREQUESTSIZE) - MNG_ERROR (pData, MNG_INTERNALERROR); - /* now read some more data */ - pTemp = pData->pSuspendbufnext + pData->iSuspendbufleft; - - iRetcode = read_data (pData, pTemp, MNG_SUSPENDREQUESTSIZE, &iTemp); - if (iRetcode) - return iRetcode; - /* adjust fill-counter */ - pData->iSuspendbufleft += iTemp; - /* first read after suspension returning 0 means EOF */ - if ((pData->iSuspendpoint) && (iTemp == 0)) - { /* that makes it final */ - mng_retcode iRetcode = mng_process_eof (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - - if (pData->iSuspendbufleft) /* return the leftover scraps */ - MNG_COPY (pBuf, pData->pSuspendbufnext, pData->iSuspendbufleft); - /* and indicate so */ - *iRead = pData->iSuspendbufleft; - pData->pSuspendbufnext = pData->pSuspendbuf; - pData->iSuspendbufleft = 0; - } - else - { /* suspension required ? */ - if ((iSize > pData->iSuspendbufleft) && (iTemp < MNG_SUSPENDREQUESTSIZE)) - pData->bSuspended = MNG_TRUE; - - } - - pData->iSuspendpoint = 0; /* reset it here in case we loop back */ - } - - if ((!pData->bSuspended) && (!pData->bEOF)) - { /* return the data ! */ - MNG_COPY (pBuf, pData->pSuspendbufnext, iSize); - - *iRead = iSize; /* returned it all */ - /* adjust suspension-buffer variables */ - pData->pSuspendbufnext += iSize; - pData->iSuspendbufleft -= iSize; - } - } - } - else - { - iRetcode = read_data (pData, (mng_ptr)pBuf, iSize, iRead); - if (iRetcode) - return iRetcode; - if (*iRead == 0) /* suspension required ? */ - pData->bSuspended = MNG_TRUE; - } - - pData->iSuspendpoint = 0; /* safely reset it here ! */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_DATABUFFER, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode process_raw_chunk (mng_datap pData, - mng_uint8p pBuf, - mng_uint32 iBuflen) -{ - -#ifndef MNG_OPTIMIZE_CHUNKREADER - /* the table-idea & binary search code was adapted from - libpng 1.1.0 (pngread.c) */ - /* NOTE1: the table must remain sorted by chunkname, otherwise the binary - search will break !!! (ps. watch upper-/lower-case chunknames !!) */ - /* NOTE2: the layout must remain equal to the header part of all the - chunk-structures (yes, that means even the pNext and pPrev fields; - it's wasting a bit of space, but hey, the code is a lot easier) */ - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - mng_chunk_header mng_chunk_unknown = {MNG_UINT_HUH, mng_init_general, mng_free_unknown, - mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0, sizeof(mng_unknown_chunk)}; -#else - mng_chunk_header mng_chunk_unknown = {MNG_UINT_HUH, mng_init_unknown, mng_free_unknown, - mng_read_unknown, mng_write_unknown, mng_assign_unknown, 0, 0}; -#endif - -#ifdef MNG_OPTIMIZE_CHUNKINITFREE - - mng_chunk_header mng_chunk_table [] = - { -#ifndef MNG_SKIPCHUNK_BACK - {MNG_UINT_BACK, mng_init_general, mng_free_general, mng_read_back, mng_write_back, mng_assign_general, 0, 0, sizeof(mng_back)}, -#endif -#ifndef MNG_SKIPCHUNK_BASI - {MNG_UINT_BASI, mng_init_general, mng_free_general, mng_read_basi, mng_write_basi, mng_assign_general, 0, 0, sizeof(mng_basi)}, -#endif -#ifndef MNG_SKIPCHUNK_CLIP - {MNG_UINT_CLIP, mng_init_general, mng_free_general, mng_read_clip, mng_write_clip, mng_assign_general, 0, 0, sizeof(mng_clip)}, -#endif -#ifndef MNG_SKIPCHUNK_CLON - {MNG_UINT_CLON, mng_init_general, mng_free_general, mng_read_clon, mng_write_clon, mng_assign_general, 0, 0, sizeof(mng_clon)}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_UINT_DBYK, mng_init_general, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0, sizeof(mng_dbyk)}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_DEFI - {MNG_UINT_DEFI, mng_init_general, mng_free_general, mng_read_defi, mng_write_defi, mng_assign_general, 0, 0, sizeof(mng_defi)}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_DHDR, mng_init_general, mng_free_general, mng_read_dhdr, mng_write_dhdr, mng_assign_general, 0, 0, sizeof(mng_dhdr)}, -#endif -#ifndef MNG_SKIPCHUNK_DISC - {MNG_UINT_DISC, mng_init_general, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0, sizeof(mng_disc)}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DROP - {MNG_UINT_DROP, mng_init_general, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0, sizeof(mng_drop)}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_ENDL, mng_init_general, mng_free_general, mng_read_endl, mng_write_endl, mng_assign_general, 0, 0, sizeof(mng_endl)}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {MNG_UINT_FRAM, mng_init_general, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0, sizeof(mng_fram)}, -#endif - {MNG_UINT_IDAT, mng_init_general, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0, sizeof(mng_idat)}, /* 12-th element! */ - {MNG_UINT_IEND, mng_init_general, mng_free_general, mng_read_iend, mng_write_iend, mng_assign_general, 0, 0, sizeof(mng_iend)}, - {MNG_UINT_IHDR, mng_init_general, mng_free_general, mng_read_ihdr, mng_write_ihdr, mng_assign_general, 0, 0, sizeof(mng_ihdr)}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_IJNG, mng_init_general, mng_free_general, mng_read_ijng, mng_write_ijng, mng_assign_general, 0, 0, sizeof(mng_ijng)}, -#endif - {MNG_UINT_IPNG, mng_init_general, mng_free_general, mng_read_ipng, mng_write_ipng, mng_assign_general, 0, 0, sizeof(mng_ipng)}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_JDAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)}, - {MNG_UINT_JDAT, mng_init_general, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0, sizeof(mng_jdat)}, - {MNG_UINT_JHDR, mng_init_general, mng_free_general, mng_read_jhdr, mng_write_jhdr, mng_assign_general, 0, 0, sizeof(mng_jhdr)}, - {MNG_UINT_JSEP, mng_init_general, mng_free_general, mng_read_jsep, mng_write_jsep, mng_assign_general, 0, 0, sizeof(mng_jsep)}, - {MNG_UINT_JdAA, mng_init_general, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0, sizeof(mng_jdaa)}, -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_LOOP, mng_init_general, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0, sizeof(mng_loop)}, -#endif -#ifndef MNG_SKIPCHUNK_MAGN - {MNG_UINT_MAGN, mng_init_general, mng_free_general, mng_read_magn, mng_write_magn, mng_assign_general, 0, 0, sizeof(mng_magn)}, -#endif - {MNG_UINT_MEND, mng_init_general, mng_free_general, mng_read_mend, mng_write_mend, mng_assign_general, 0, 0, sizeof(mng_mend)}, - {MNG_UINT_MHDR, mng_init_general, mng_free_general, mng_read_mhdr, mng_write_mhdr, mng_assign_general, 0, 0, sizeof(mng_mhdr)}, -#ifndef MNG_SKIPCHUNK_MOVE - {MNG_UINT_MOVE, mng_init_general, mng_free_general, mng_read_move, mng_write_move, mng_assign_general, 0, 0, sizeof(mng_move)}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_UINT_ORDR, mng_init_general, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0, sizeof(mng_ordr)}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_UINT_PAST, mng_init_general, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0, sizeof(mng_past)}, -#endif - {MNG_UINT_PLTE, mng_init_general, mng_free_general, mng_read_plte, mng_write_plte, mng_assign_general, 0, 0, sizeof(mng_plte)}, -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_PPLT, mng_init_general, mng_free_general, mng_read_pplt, mng_write_pplt, mng_assign_general, 0, 0, sizeof(mng_pplt)}, - {MNG_UINT_PROM, mng_init_general, mng_free_general, mng_read_prom, mng_write_prom, mng_assign_general, 0, 0, sizeof(mng_prom)}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_UINT_SAVE, mng_init_general, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0, sizeof(mng_save)}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_UINT_SEEK, mng_init_general, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0, sizeof(mng_seek)}, -#endif -#ifndef MNG_SKIPCHUNK_SHOW - {MNG_UINT_SHOW, mng_init_general, mng_free_general, mng_read_show, mng_write_show, mng_assign_general, 0, 0, sizeof(mng_show)}, -#endif -#ifndef MNG_SKIPCHUNK_TERM - {MNG_UINT_TERM, mng_init_general, mng_free_general, mng_read_term, mng_write_term, mng_assign_general, 0, 0, sizeof(mng_term)}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_UINT_bKGD, mng_init_general, mng_free_general, mng_read_bkgd, mng_write_bkgd, mng_assign_general, 0, 0, sizeof(mng_bkgd)}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_UINT_cHRM, mng_init_general, mng_free_general, mng_read_chrm, mng_write_chrm, mng_assign_general, 0, 0, sizeof(mng_chrm)}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_UINT_eXPI, mng_init_general, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0, sizeof(mng_expi)}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_UINT_evNT, mng_init_general, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0, sizeof(mng_evnt)}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_UINT_fPRI, mng_init_general, mng_free_general, mng_read_fpri, mng_write_fpri, mng_assign_general, 0, 0, sizeof(mng_fpri)}, -#endif -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_UINT_gAMA, mng_init_general, mng_free_general, mng_read_gama, mng_write_gama, mng_assign_general, 0, 0, sizeof(mng_gama)}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_UINT_hIST, mng_init_general, mng_free_general, mng_read_hist, mng_write_hist, mng_assign_general, 0, 0, sizeof(mng_hist)}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_UINT_iCCP, mng_init_general, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0, sizeof(mng_iccp)}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_UINT_iTXt, mng_init_general, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0, sizeof(mng_itxt)}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_UINT_mpNG, mng_init_general, mng_free_mpng, mng_read_mpng, mng_write_mpng, mng_assign_mpng, 0, 0, sizeof(mng_mpng)}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UINT_nEED, mng_init_general, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0, sizeof(mng_need)}, -#endif -/* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */ -/* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_UINT_pHYg, mng_init_general, mng_free_general, mng_read_phyg, mng_write_phyg, mng_assign_general, 0, 0, sizeof(mng_phyg)}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_UINT_pHYs, mng_init_general, mng_free_general, mng_read_phys, mng_write_phys, mng_assign_general, 0, 0, sizeof(mng_phys)}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_UINT_sBIT, mng_init_general, mng_free_general, mng_read_sbit, mng_write_sbit, mng_assign_general, 0, 0, sizeof(mng_sbit)}, -#endif -/* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_UINT_sPLT, mng_init_general, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0, sizeof(mng_splt)}, -#endif - {MNG_UINT_sRGB, mng_init_general, mng_free_general, mng_read_srgb, mng_write_srgb, mng_assign_general, 0, 0, sizeof(mng_srgb)}, -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_UINT_tEXt, mng_init_general, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0, sizeof(mng_text)}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_UINT_tIME, mng_init_general, mng_free_general, mng_read_time, mng_write_time, mng_assign_general, 0, 0, sizeof(mng_time)}, -#endif - {MNG_UINT_tRNS, mng_init_general, mng_free_general, mng_read_trns, mng_write_trns, mng_assign_general, 0, 0, sizeof(mng_trns)}, -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_UINT_zTXt, mng_init_general, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0, sizeof(mng_ztxt)}, -#endif - }; - -#else /* MNG_OPTIMIZE_CHUNKINITFREE */ - - mng_chunk_header mng_chunk_table [] = - { -#ifndef MNG_SKIPCHUNK_BACK - {MNG_UINT_BACK, mng_init_back, mng_free_back, mng_read_back, mng_write_back, mng_assign_back, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_BASI - {MNG_UINT_BASI, mng_init_basi, mng_free_basi, mng_read_basi, mng_write_basi, mng_assign_basi, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_CLIP - {MNG_UINT_CLIP, mng_init_clip, mng_free_clip, mng_read_clip, mng_write_clip, mng_assign_clip, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_CLON - {MNG_UINT_CLON, mng_init_clon, mng_free_clon, mng_read_clon, mng_write_clon, mng_assign_clon, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_UINT_DBYK, mng_init_dbyk, mng_free_dbyk, mng_read_dbyk, mng_write_dbyk, mng_assign_dbyk, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_DEFI - {MNG_UINT_DEFI, mng_init_defi, mng_free_defi, mng_read_defi, mng_write_defi, mng_assign_defi, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_DHDR, mng_init_dhdr, mng_free_dhdr, mng_read_dhdr, mng_write_dhdr, mng_assign_dhdr, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_DISC - {MNG_UINT_DISC, mng_init_disc, mng_free_disc, mng_read_disc, mng_write_disc, mng_assign_disc, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_DROP - {MNG_UINT_DROP, mng_init_drop, mng_free_drop, mng_read_drop, mng_write_drop, mng_assign_drop, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_ENDL, mng_init_endl, mng_free_endl, mng_read_endl, mng_write_endl, mng_assign_endl, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_FRAM - {MNG_UINT_FRAM, mng_init_fram, mng_free_fram, mng_read_fram, mng_write_fram, mng_assign_fram, 0, 0}, -#endif - {MNG_UINT_IDAT, mng_init_idat, mng_free_idat, mng_read_idat, mng_write_idat, mng_assign_idat, 0, 0}, /* 12-th element! */ - {MNG_UINT_IEND, mng_init_iend, mng_free_iend, mng_read_iend, mng_write_iend, mng_assign_iend, 0, 0}, - {MNG_UINT_IHDR, mng_init_ihdr, mng_free_ihdr, mng_read_ihdr, mng_write_ihdr, mng_assign_ihdr, 0, 0}, -#ifndef MNG_NO_DELTA_PNG -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_IJNG, mng_init_ijng, mng_free_ijng, mng_read_ijng, mng_write_ijng, mng_assign_ijng, 0, 0}, -#endif - {MNG_UINT_IPNG, mng_init_ipng, mng_free_ipng, mng_read_ipng, mng_write_ipng, mng_assign_ipng, 0, 0}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_UINT_JDAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0}, - {MNG_UINT_JDAT, mng_init_jdat, mng_free_jdat, mng_read_jdat, mng_write_jdat, mng_assign_jdat, 0, 0}, - {MNG_UINT_JHDR, mng_init_jhdr, mng_free_jhdr, mng_read_jhdr, mng_write_jhdr, mng_assign_jhdr, 0, 0}, - {MNG_UINT_JSEP, mng_init_jsep, mng_free_jsep, mng_read_jsep, mng_write_jsep, mng_assign_jsep, 0, 0}, - {MNG_UINT_JdAA, mng_init_jdaa, mng_free_jdaa, mng_read_jdaa, mng_write_jdaa, mng_assign_jdaa, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_UINT_LOOP, mng_init_loop, mng_free_loop, mng_read_loop, mng_write_loop, mng_assign_loop, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_MAGN - {MNG_UINT_MAGN, mng_init_magn, mng_free_magn, mng_read_magn, mng_write_magn, mng_assign_magn, 0, 0}, -#endif - {MNG_UINT_MEND, mng_init_mend, mng_free_mend, mng_read_mend, mng_write_mend, mng_assign_mend, 0, 0}, - {MNG_UINT_MHDR, mng_init_mhdr, mng_free_mhdr, mng_read_mhdr, mng_write_mhdr, mng_assign_mhdr, 0, 0}, -#ifndef MNG_SKIPCHUNK_MOVE - {MNG_UINT_MOVE, mng_init_move, mng_free_move, mng_read_move, mng_write_move, mng_assign_move, 0, 0}, -#endif -#ifndef MNG_NO_DELTA_PNG -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_UINT_ORDR, mng_init_ordr, mng_free_ordr, mng_read_ordr, mng_write_ordr, mng_assign_ordr, 0, 0}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_PAST - {MNG_UINT_PAST, mng_init_past, mng_free_past, mng_read_past, mng_write_past, mng_assign_past, 0, 0}, -#endif - {MNG_UINT_PLTE, mng_init_plte, mng_free_plte, mng_read_plte, mng_write_plte, mng_assign_plte, 0, 0}, -#ifndef MNG_NO_DELTA_PNG - {MNG_UINT_PPLT, mng_init_pplt, mng_free_pplt, mng_read_pplt, mng_write_pplt, mng_assign_pplt, 0, 0}, - {MNG_UINT_PROM, mng_init_prom, mng_free_prom, mng_read_prom, mng_write_prom, mng_assign_prom, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_UINT_SAVE, mng_init_save, mng_free_save, mng_read_save, mng_write_save, mng_assign_save, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_UINT_SEEK, mng_init_seek, mng_free_seek, mng_read_seek, mng_write_seek, mng_assign_seek, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_SHOW - {MNG_UINT_SHOW, mng_init_show, mng_free_show, mng_read_show, mng_write_show, mng_assign_show, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_TERM - {MNG_UINT_TERM, mng_init_term, mng_free_term, mng_read_term, mng_write_term, mng_assign_term, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_UINT_bKGD, mng_init_bkgd, mng_free_bkgd, mng_read_bkgd, mng_write_bkgd, mng_assign_bkgd, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_UINT_cHRM, mng_init_chrm, mng_free_chrm, mng_read_chrm, mng_write_chrm, mng_assign_chrm, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_UINT_eXPI, mng_init_expi, mng_free_expi, mng_read_expi, mng_write_expi, mng_assign_expi, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_UINT_evNT, mng_init_evnt, mng_free_evnt, mng_read_evnt, mng_write_evnt, mng_assign_evnt, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_UINT_fPRI, mng_init_fpri, mng_free_fpri, mng_read_fpri, mng_write_fpri, mng_assign_fpri, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_UINT_gAMA, mng_init_gama, mng_free_gama, mng_read_gama, mng_write_gama, mng_assign_gama, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_UINT_hIST, mng_init_hist, mng_free_hist, mng_read_hist, mng_write_hist, mng_assign_hist, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_UINT_iCCP, mng_init_iccp, mng_free_iccp, mng_read_iccp, mng_write_iccp, mng_assign_iccp, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_UINT_iTXt, mng_init_itxt, mng_free_itxt, mng_read_itxt, mng_write_itxt, mng_assign_itxt, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_UINT_nEED, mng_init_need, mng_free_need, mng_read_need, mng_write_need, mng_assign_need, 0, 0}, -#endif -/* TODO: {MNG_UINT_oFFs, 0, 0, 0, 0, 0, 0}, */ -/* TODO: {MNG_UINT_pCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_UINT_pHYg, mng_init_phyg, mng_free_phyg, mng_read_phyg, mng_write_phyg, mng_assign_phyg, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_UINT_pHYs, mng_init_phys, mng_free_phys, mng_read_phys, mng_write_phys, mng_assign_phys, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_UINT_sBIT, mng_init_sbit, mng_free_sbit, mng_read_sbit, mng_write_sbit, mng_assign_sbit, 0, 0}, -#endif -/* TODO: {MNG_UINT_sCAL, 0, 0, 0, 0, 0, 0}, */ -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_UINT_sPLT, mng_init_splt, mng_free_splt, mng_read_splt, mng_write_splt, mng_assign_splt, 0, 0}, -#endif - {MNG_UINT_sRGB, mng_init_srgb, mng_free_srgb, mng_read_srgb, mng_write_srgb, mng_assign_srgb, 0, 0}, -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_UINT_tEXt, mng_init_text, mng_free_text, mng_read_text, mng_write_text, mng_assign_text, 0, 0}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_UINT_tIME, mng_init_time, mng_free_time, mng_read_time, mng_write_time, mng_assign_time, 0, 0}, -#endif - {MNG_UINT_tRNS, mng_init_trns, mng_free_trns, mng_read_trns, mng_write_trns, mng_assign_trns, 0, 0}, -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_UINT_zTXt, mng_init_ztxt, mng_free_ztxt, mng_read_ztxt, mng_write_ztxt, mng_assign_ztxt, 0, 0}, -#endif - }; - -#endif /* MNG_OPTIMIZE_CHUNKINITFREE */ - - /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_chunk_headerp pEntry; /* pointer to found entry */ -#else - mng_chunk_header sEntry; /* temp chunk-header */ -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - - mng_chunkid iChunkname; /* the chunk's tag */ - mng_chunkp pChunk; /* chunk structure (if #define MNG_STORE_CHUNKS) */ - mng_retcode iRetcode; /* temporary error-code */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RAW_CHUNK, MNG_LC_START); -#endif - /* reset timer indicator on read-cycle */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - /* get the chunkname */ - iChunkname = (mng_chunkid)(mng_get_uint32 (pBuf)); - - pBuf += sizeof (mng_chunkid); /* adjust the buffer */ - iBuflen -= sizeof (mng_chunkid); - pChunk = 0; - -#ifndef MNG_OPTIMIZE_CHUNKREADER - /* determine max index of table */ - iTop = (sizeof (mng_chunk_table) / sizeof (mng_chunk_table [0])) - 1; - - /* binary search; with 54 chunks, worst-case is 7 comparisons */ - iLower = 0; -#ifndef MNG_NO_DELTA_PNG - iMiddle = 11; /* start with the IDAT entry */ -#else - iMiddle = 8; -#endif - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (mng_chunk_table [iMiddle].iChunkname < iChunkname) - iLower = iMiddle + 1; - else if (mng_chunk_table [iMiddle].iChunkname > iChunkname) - iUpper = iMiddle - 1; - else - { - pEntry = &mng_chunk_table [iMiddle]; - break; - } - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (!pEntry) /* unknown chunk ? */ - pEntry = &mng_chunk_unknown; /* make it so! */ - -#else /* MNG_OPTIMIZE_CHUNKREADER */ - - mng_get_chunkheader (iChunkname, &sEntry); - -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - - pData->iChunkname = iChunkname; /* keep track of where we are */ - pData->iChunkseq++; - -#ifndef MNG_OPTIMIZE_CHUNKREADER - if (pEntry->fRead) /* read-callback available ? */ - { - iRetcode = pEntry->fRead (pData, pEntry, iBuflen, (mng_ptr)pBuf, &pChunk); - - if (!iRetcode) /* everything oke ? */ - { /* remember unknown chunk's id */ - if ((pChunk) && (pEntry->iChunkname == MNG_UINT_HUH)) - ((mng_chunk_headerp)pChunk)->iChunkname = iChunkname; - } - } -#else /* MNG_OPTIMIZE_CHUNKREADER */ - if (sEntry.fRead) /* read-callback available ? */ - { - iRetcode = sEntry.fRead (pData, &sEntry, iBuflen, (mng_ptr)pBuf, &pChunk); - -#ifndef MNG_OPTIMIZE_CHUNKREADER - if (!iRetcode) /* everything oke ? */ - { /* remember unknown chunk's id */ - if ((pChunk) && (sEntry.iChunkname == MNG_UINT_HUH)) - ((mng_chunk_headerp)pChunk)->iChunkname = iChunkname; - } -#endif - } -#endif /* MNG_OPTIMIZE_CHUNKREADER */ - else - iRetcode = MNG_NOERROR; - - if (pChunk) /* store this chunk ? */ - mng_add_chunk (pData, pChunk); /* do it */ - -#ifdef MNG_INCLUDE_JNG /* implicit EOF ? */ - if ((!pData->bHasMHDR) && (!pData->bHasIHDR) && (!pData->bHasJHDR)) -#else - if ((!pData->bHasMHDR) && (!pData->bHasIHDR)) -#endif - iRetcode = mng_process_eof (pData);/* then do some EOF processing */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_PROCESS_RAW_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode check_chunk_crc (mng_datap pData, - mng_uint8p pBuf, - mng_uint32 iBuflen) -{ - mng_uint32 iCrc; /* calculated CRC */ - mng_bool bDiscard = MNG_FALSE; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK_CRC, MNG_LC_START); -#endif - - if (pData->iCrcmode & MNG_CRC_INPUT) /* crc included ? */ - { - mng_bool bCritical = (mng_bool)((*pBuf & 0x20) == 0); - mng_uint32 iL = iBuflen - (mng_uint32)(sizeof (iCrc)); - - if (((bCritical ) && (pData->iCrcmode & MNG_CRC_CRITICAL )) || - ((!bCritical) && (pData->iCrcmode & MNG_CRC_ANCILLARY))) - { /* calculate the crc */ - iCrc = mng_crc (pData, pBuf, iL); - /* and check it */ - if (!(iCrc == mng_get_uint32 (pBuf + iL))) - { - mng_bool bWarning = MNG_FALSE; - mng_bool bError = MNG_FALSE; - - if (bCritical) - { - switch (pData->iCrcmode & MNG_CRC_CRITICAL) - { - case MNG_CRC_CRITICAL_WARNING : { bWarning = MNG_TRUE; break; } - case MNG_CRC_CRITICAL_ERROR : { bError = MNG_TRUE; break; } - } - } - else - { - switch (pData->iCrcmode & MNG_CRC_ANCILLARY) - { - case MNG_CRC_ANCILLARY_DISCARD : { bDiscard = MNG_TRUE; break; } - case MNG_CRC_ANCILLARY_WARNING : { bWarning = MNG_TRUE; break; } - case MNG_CRC_ANCILLARY_ERROR : { bError = MNG_TRUE; break; } - } - } - - if (bWarning) - MNG_WARNING (pData, MNG_INVALIDCRC); - if (bError) - MNG_ERROR (pData, MNG_INVALIDCRC); - } - } - - if (!bDiscard) /* still processing ? */ - iRetcode = process_raw_chunk (pData, pBuf, iL); - } - else - { /* no crc => straight onto processing */ - iRetcode = process_raw_chunk (pData, pBuf, iBuflen); - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK_CRC, MNG_LC_END); -#endif - - return iRetcode; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode read_chunk (mng_datap pData) -{ - mng_uint32 iBufmax = pData->iReadbufsize; - mng_uint8p pBuf = pData->pReadbuf; - mng_uint32 iBuflen = 0; /* number of bytes requested */ - mng_uint32 iRead = 0; /* number of bytes read */ - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK, MNG_LC_START); -#endif - -#ifdef MNG_SUPPORT_DISPLAY - if (pData->pCurraniobj) /* processing an animation object ? */ - { - do /* process it then */ - { - iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj); - /* refresh needed ? */ -/* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh)) - iRetcode = display_progressive_refresh (pData, 1); */ - /* can we advance to next object ? */ - if ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait)) - { /* reset timer indicator on read-cycle */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - - pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext; - /* TERM processing to be done ? */ - if ((!pData->pCurraniobj) && (pData->bHasTERM) && (!pData->bHasMHDR)) - iRetcode = mng_process_display_mend (pData); - } - } /* until error or a break or no more objects */ - while ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bFreezing)); - } - else - { - if (pData->iBreakpoint) /* do we need to finish something first ? */ - { - switch (pData->iBreakpoint) /* return to broken display routine */ - { -#ifndef MNG_SKIPCHUNK_FRAM - case 1 : { iRetcode = mng_process_display_fram2 (pData); break; } -#endif - case 2 : { iRetcode = mng_process_display_ihdr (pData); break; } -#ifndef MNG_SKIPCHUNK_SHOW - case 3 : ; /* same as 4 !!! */ - case 4 : { iRetcode = mng_process_display_show (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_CLON - case 5 : { iRetcode = mng_process_display_clon2 (pData); break; } -#endif -#ifdef MNG_INCLUDE_JNG - case 7 : { iRetcode = mng_process_display_jhdr (pData); break; } -#endif - case 6 : ; /* same as 8 !!! */ - case 8 : { iRetcode = mng_process_display_iend (pData); break; } -#ifndef MNG_SKIPCHUNK_MAGN - case 9 : { iRetcode = mng_process_display_magn2 (pData); break; } -#endif - case 10 : { iRetcode = mng_process_display_mend2 (pData); break; } -#ifndef MNG_SKIPCHUNK_PAST - case 11 : { iRetcode = mng_process_display_past2 (pData); break; } -#endif - } - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - /* can we continue processing now, or do we */ - /* need to wait for the timer to finish (again) ? */ -#ifdef MNG_SUPPORT_DISPLAY - if ((!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bEOF)) -#else - if (!pData->bEOF) -#endif - { -#ifdef MNG_SUPPORT_DISPLAY - /* freezing in progress ? */ - if ((pData->bFreezing) && (pData->iSuspendpoint == 0)) - pData->bRunning = MNG_FALSE; /* then this is the right moment to do it */ -#endif - - if (pData->iSuspendpoint <= 2) - { - iBuflen = sizeof (mng_uint32); /* read length */ - iRetcode = read_databuffer (pData, pBuf, &pData->pReadbufnext, iBuflen, &iRead); - - if (iRetcode) /* bail on errors */ - return iRetcode; - - if (pData->bSuspended) /* suspended ? */ - pData->iSuspendpoint = 2; - else /* save the length */ - { - pData->iChunklen = mng_get_uint32 (pBuf); - if (pData->iChunklen > 0x7ffffff) - return MNG_INVALIDLENGTH; - } - - } - - if (!pData->bSuspended) /* still going ? */ - { /* previously suspended or not eof ? */ - if ((pData->iSuspendpoint > 2) || (iRead == iBuflen)) - { /* determine length chunkname + data (+ crc) */ - if (pData->iCrcmode & MNG_CRC_INPUT) - iBuflen = pData->iChunklen + (mng_uint32)(sizeof (mng_chunkid) + sizeof (mng_uint32)); - else - iBuflen = pData->iChunklen + (mng_uint32)(sizeof (mng_chunkid)); - - /* do we have enough data in the current push buffer ? */ - if ((pData->pFirstpushdata) && (iBuflen <= pData->pFirstpushdata->iRemaining)) - { - mng_pushdatap pPush = pData->pFirstpushdata; - pBuf = pPush->pDatanext; - pPush->pDatanext += iBuflen; - pPush->iRemaining -= iBuflen; - pData->iSuspendpoint = 0; /* safely reset this here ! */ - - iRetcode = check_chunk_crc (pData, pBuf, iBuflen); - if (iRetcode) - return iRetcode; - - if (!pPush->iRemaining) /* buffer depleted? then release it */ - iRetcode = mng_release_pushdata (pData); - } - else - { - if (iBuflen < iBufmax) /* does it fit in default buffer ? */ - { /* note that we don't use the full size - so there's always a zero-byte at the - very end !!! */ - iRetcode = read_databuffer (pData, pBuf, &pData->pReadbufnext, iBuflen, &iRead); - if (iRetcode) /* bail on errors */ - return iRetcode; - - if (pData->bSuspended) /* suspended ? */ - pData->iSuspendpoint = 3; - else - { - if (iRead != iBuflen) /* did we get all the data ? */ - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - iRetcode = check_chunk_crc (pData, pBuf, iBuflen); - } - } - else - { - if (iBuflen > 16777216) /* is the length incredible? */ - MNG_ERROR (pData, MNG_IMPROBABLELENGTH); - - if (!pData->iSuspendpoint) /* create additional large buffer ? */ - { /* again reserve space for the last zero-byte */ - pData->iLargebufsize = iBuflen + 1; - pData->pLargebufnext = MNG_NULL; - MNG_ALLOC (pData, pData->pLargebuf, pData->iLargebufsize); - } - - iRetcode = read_databuffer (pData, pData->pLargebuf, &pData->pLargebufnext, iBuflen, &iRead); - if (iRetcode) - return iRetcode; - - if (pData->bSuspended) /* suspended ? */ - pData->iSuspendpoint = 4; - else - { - if (iRead != iBuflen) /* did we get all the data ? */ - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - iRetcode = check_chunk_crc (pData, pData->pLargebuf, iBuflen); - /* cleanup additional large buffer */ - MNG_FREE (pData, pData->pLargebuf, pData->iLargebufsize); - } - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - - } - else - { /* that's final */ - iRetcode = mng_process_eof (pData); - - if (iRetcode) /* on error bail out */ - return iRetcode; - - if ((iRead != 0) || /* did we get an unexpected eof ? */ -#ifdef MNG_INCLUDE_JNG - (pData->bHasIHDR || pData->bHasMHDR || pData->bHasJHDR)) -#else - (pData->bHasIHDR || pData->bHasMHDR)) -#endif - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - } - } - } - -#ifdef MNG_SUPPORT_DISPLAY /* refresh needed ? */ - if ((!pData->bTimerset) && (!pData->bSuspended) && (pData->bNeedrefresh)) - { - iRetcode = mng_display_progressive_refresh (pData, 1); - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_CHUNK, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -MNG_LOCAL mng_retcode process_pushedchunk (mng_datap pData) -{ - mng_pushdatap pPush; - mng_retcode iRetcode = MNG_NOERROR; - -#ifdef MNG_SUPPORT_DISPLAY - if (pData->pCurraniobj) /* processing an animation object ? */ - { - do /* process it then */ - { - iRetcode = ((mng_object_headerp)pData->pCurraniobj)->fProcess (pData, pData->pCurraniobj); - /* refresh needed ? */ -/* if ((!iRetcode) && (!pData->bTimerset) && (pData->bNeedrefresh)) - iRetcode = display_progressive_refresh (pData, 1); */ - /* can we advance to next object ? */ - if ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait)) - { /* reset timer indicator on read-cycle */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - - pData->pCurraniobj = ((mng_object_headerp)pData->pCurraniobj)->pNext; - /* TERM processing to be done ? */ - if ((!pData->pCurraniobj) && (pData->bHasTERM) && (!pData->bHasMHDR)) - iRetcode = mng_process_display_mend (pData); - } - } /* until error or a break or no more objects */ - while ((!iRetcode) && (pData->pCurraniobj) && - (!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bFreezing)); - } - else - { - if (pData->iBreakpoint) /* do we need to finish something first ? */ - { - switch (pData->iBreakpoint) /* return to broken display routine */ - { -#ifndef MNG_SKIPCHUNK_FRAM - case 1 : { iRetcode = mng_process_display_fram2 (pData); break; } -#endif - case 2 : { iRetcode = mng_process_display_ihdr (pData); break; } -#ifndef MNG_SKIPCHUNK_SHOW - case 3 : ; /* same as 4 !!! */ - case 4 : { iRetcode = mng_process_display_show (pData); break; } -#endif -#ifndef MNG_SKIPCHUNK_CLON - case 5 : { iRetcode = mng_process_display_clon2 (pData); break; } -#endif -#ifdef MNG_INCLUDE_JNG - case 7 : { iRetcode = mng_process_display_jhdr (pData); break; } -#endif - case 6 : ; /* same as 8 !!! */ - case 8 : { iRetcode = mng_process_display_iend (pData); break; } -#ifndef MNG_SKIPCHUNK_MAGN - case 9 : { iRetcode = mng_process_display_magn2 (pData); break; } -#endif - case 10 : { iRetcode = mng_process_display_mend2 (pData); break; } -#ifndef MNG_SKIPCHUNK_PAST - case 11 : { iRetcode = mng_process_display_past2 (pData); break; } -#endif - } - } - } - - if (iRetcode) /* on error bail out */ - return iRetcode; - -#endif /* MNG_SUPPORT_DISPLAY */ - /* can we continue processing now, or do we */ - /* need to wait for the timer to finish (again) ? */ -#ifdef MNG_SUPPORT_DISPLAY - if ((!pData->bTimerset) && (!pData->bSectionwait) && (!pData->bEOF)) -#else - if (!pData->bEOF) -#endif - { - pData->iSuspendpoint = 0; /* safely reset it here ! */ - pPush = pData->pFirstpushchunk; - - iRetcode = process_raw_chunk (pData, pPush->pData, pPush->iLength); - if (iRetcode) - return iRetcode; - -#ifdef MNG_SUPPORT_DISPLAY /* refresh needed ? */ - if ((!pData->bTimerset) && (!pData->bSuspended) && (pData->bNeedrefresh)) - { - iRetcode = mng_display_progressive_refresh (pData, 1); - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#endif - } - - return mng_release_pushchunk (pData); -} - -/* ************************************************************************** */ - -mng_retcode mng_read_graphic (mng_datap pData) -{ - mng_uint32 iBuflen; /* number of bytes requested */ - mng_uint32 iRead; /* number of bytes read */ - mng_retcode iRetcode; /* temporary error-code */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GRAPHIC, MNG_LC_START); -#endif - - if (!pData->pReadbuf) /* buffer allocated ? */ - { - pData->iReadbufsize = 4200; /* allocate a default read buffer */ - MNG_ALLOC (pData, pData->pReadbuf, pData->iReadbufsize); - } - /* haven't processed the signature ? */ - if ((!pData->bHavesig) || (pData->iSuspendpoint == 1)) - { - iBuflen = 2 * sizeof (mng_uint32); /* read signature */ - - iRetcode = read_databuffer (pData, pData->pReadbuf, &pData->pReadbufnext, iBuflen, &iRead); - - if (iRetcode) - return iRetcode; - - if (pData->bSuspended) /* input suspension ? */ - pData->iSuspendpoint = 1; - else - { - if (iRead != iBuflen) /* full signature received ? */ - MNG_ERROR (pData, MNG_UNEXPECTEDEOF); - /* is it a valid signature ? */ - if (mng_get_uint32 (pData->pReadbuf) == PNG_SIG) - pData->eSigtype = mng_it_png; - else -#ifdef MNG_INCLUDE_JNG - if (mng_get_uint32 (pData->pReadbuf) == JNG_SIG) - pData->eSigtype = mng_it_jng; - else -#endif - if (mng_get_uint32 (pData->pReadbuf) == MNG_SIG) - pData->eSigtype = mng_it_mng; - else - MNG_ERROR (pData, MNG_INVALIDSIG); - /* all of it ? */ - if (mng_get_uint32 (pData->pReadbuf+4) != POST_SIG) - MNG_ERROR (pData, MNG_INVALIDSIG); - - pData->bHavesig = MNG_TRUE; - } - } - - if (!pData->bSuspended) /* still going ? */ - { - do - { /* reset timer during mng_read() ? */ - if ((pData->bReading) && (!pData->bDisplaying)) - pData->bTimerset = MNG_FALSE; - - if (pData->pFirstpushchunk) /* chunks pushed ? */ - iRetcode = process_pushedchunk (pData); /* process the pushed chunk */ - else - iRetcode = read_chunk (pData); /* read & process a chunk */ - - if (iRetcode) /* on error bail out */ - return iRetcode; - } -#ifdef MNG_SUPPORT_DISPLAY /* until EOF or a break-request */ - while (((!pData->bEOF) || (pData->pCurraniobj)) && - (!pData->bSuspended) && (!pData->bSectionwait) && - ((!pData->bTimerset) || ((pData->bReading) && (!pData->bDisplaying)))); -#else - while ((!pData->bEOF) && (!pData->bSuspended)); -#endif - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_READ_GRAPHIC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_READ_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_read.h b/Engine/lib/lmng/libmng_read.h deleted file mode 100644 index 119cc3e60..000000000 --- a/Engine/lib/lmng/libmng_read.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_read.h copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.8 * */ -/* * * */ -/* * purpose : Read management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the read management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 10/18/2000 - G.Juyn * */ -/* * - added closestream() processing for mng_cleanup() * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.8 - 04/12/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_read_h_ -#define _libmng_read_h_ - -/* ************************************************************************** */ - -mng_retcode mng_process_eof (mng_datap pData); - -mng_retcode mng_release_pushdata (mng_datap pData); - -mng_retcode mng_release_pushchunk (mng_datap pData); - -mng_retcode mng_read_graphic (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_read_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_trace.c b/Engine/lib/lmng/libmng_trace.c deleted file mode 100644 index a6a2cab2b..000000000 --- a/Engine/lib/lmng/libmng_trace.c +++ /dev/null @@ -1,1683 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_trace.c copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Trace functions (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the trace functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - added callback error-reporting support * */ -/* * * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added trace telltale reporting * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added tracestrings for global animation color-chunks * */ -/* * - added tracestrings for get/set of default ZLIB/IJG parms * */ -/* * - added tracestrings for global PLTE,tRNS,bKGD * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added tracestrings for image-object promotion * */ -/* * - added tracestrings for delta-image processing * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added tracestrings for getalphaline callback * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added tracestring for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added tracestring for mng_read_resume HLAPI function * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added tracestrings for get/set speedtype * */ -/* * - added tracestring for get imagelevel * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added tracestring for delta-image processing * */ -/* * - added tracestrings for PPLT chunk processing * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added tracecodes for special display processing * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added tracestring for get/set suspensionmode * */ -/* * - added tracestrings for get/set display variables * */ -/* * - added tracecode for read_databuffer (I/O-suspension) * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added tracestrings for SAVE/SEEK callbacks * */ -/* * - added tracestrings for get/set sectionbreaks * */ -/* * - added tracestring for special error routine * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added tracestring for updatemngheader * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - added tracestrings for status_xxxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added tracestring for updatemngsimplicity * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * - added optional support for bKGD for PNG images * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - added routine to discard "invalid" objects * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * 1.0.5 - 10/09/2002 - G.Juyn * */ -/* * - fixed trace-constants for PAST chunk * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added conditionals around JNG and Delta-PNG code * */ -/* * 1.0.6 - 07/14/2003 - G.R-P * */ -/* * - added conditionals around various unused functions * */ -/* * 1.0.6 - 07/29/2003 - G.R-P * */ -/* * - added conditionals around PAST chunk support * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/07/2004 - G. Randers-Pehrson * */ -/* * - put gamma, cms-related declarations inside #ifdef * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_TRACE_PROCS - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_TRACE_STRINGS -MNG_LOCAL mng_trace_entry const trace_table [] = - { - {MNG_FN_INITIALIZE, "initialize"}, - {MNG_FN_RESET, "reset"}, - {MNG_FN_CLEANUP, "cleanup"}, - {MNG_FN_READ, "read"}, - {MNG_FN_WRITE, "write"}, - {MNG_FN_CREATE, "create"}, - {MNG_FN_READDISPLAY, "readdisplay"}, - {MNG_FN_DISPLAY, "display"}, - {MNG_FN_DISPLAY_RESUME, "display_resume"}, - {MNG_FN_DISPLAY_FREEZE, "display_freeze"}, - {MNG_FN_DISPLAY_RESET, "display_reset"}, -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED - {MNG_FN_DISPLAY_GOFRAME, "display_goframe"}, - {MNG_FN_DISPLAY_GOLAYER, "display_golayer"}, - {MNG_FN_DISPLAY_GOTIME, "display_gotime"}, -#endif - {MNG_FN_GETLASTERROR, "getlasterror"}, - {MNG_FN_READ_RESUME, "read_resume"}, - {MNG_FN_TRAPEVENT, "trapevent"}, - {MNG_FN_READ_PUSHDATA, "read_pushdata"}, - {MNG_FN_READ_PUSHSIG, "read_pushsig"}, - {MNG_FN_READ_PUSHCHUNK, "read_pushchunk"}, - - {MNG_FN_SETCB_MEMALLOC, "setcb_memalloc"}, - {MNG_FN_SETCB_MEMFREE, "setcb_memfree"}, - {MNG_FN_SETCB_READDATA, "setcb_readdata"}, - {MNG_FN_SETCB_WRITEDATA, "setcb_writedata"}, - {MNG_FN_SETCB_ERRORPROC, "setcb_errorproc"}, - {MNG_FN_SETCB_TRACEPROC, "setcb_traceproc"}, - {MNG_FN_SETCB_PROCESSHEADER, "setcb_processheader"}, - {MNG_FN_SETCB_PROCESSTEXT, "setcb_processtext"}, - {MNG_FN_SETCB_GETCANVASLINE, "setcb_getcanvasline"}, - {MNG_FN_SETCB_GETBKGDLINE, "setcb_getbkgdline"}, - {MNG_FN_SETCB_REFRESH, "setcb_refresh"}, - {MNG_FN_SETCB_GETTICKCOUNT, "setcb_gettickcount"}, - {MNG_FN_SETCB_SETTIMER, "setcb_settimer"}, - {MNG_FN_SETCB_PROCESSGAMMA, "setcb_processgamma"}, - {MNG_FN_SETCB_PROCESSCHROMA, "setcb_processchroma"}, - {MNG_FN_SETCB_PROCESSSRGB, "setcb_processsrgb"}, - {MNG_FN_SETCB_PROCESSICCP, "setcb_processiccp"}, - {MNG_FN_SETCB_PROCESSAROW, "setcb_processarow"}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {MNG_FN_SETCB_OPENSTREAM, "setcb_openstream"}, - {MNG_FN_SETCB_CLOSESTREAM, "setcb_closestream"}, -#endif - {MNG_FN_SETCB_GETALPHALINE, "setcb_getalphaline"}, - {MNG_FN_SETCB_PROCESSSAVE, "setcb_processsave"}, - {MNG_FN_SETCB_PROCESSSEEK, "setcb_processseek"}, - {MNG_FN_SETCB_PROCESSNEED, "setcb_processneed"}, - {MNG_FN_SETCB_PROCESSUNKNOWN, "setcb_processunknown"}, - {MNG_FN_SETCB_PROCESSMEND, "setcb_processmend"}, - {MNG_FN_SETCB_PROCESSTERM, "setcb_processterm"}, - {MNG_FN_SETCB_RELEASEDATA, "setcb_releasedata"}, - - {MNG_FN_GETCB_MEMALLOC, "getcb_memalloc"}, - {MNG_FN_GETCB_MEMFREE, "getcb_memfree"}, - {MNG_FN_GETCB_READDATA, "getcb_readdata,"}, - {MNG_FN_GETCB_WRITEDATA, "getcb_writedata"}, - {MNG_FN_GETCB_ERRORPROC, "getcb_errorproc"}, - {MNG_FN_GETCB_TRACEPROC, "getcb_traceproc"}, - {MNG_FN_GETCB_PROCESSHEADER, "getcb_processheader"}, - {MNG_FN_GETCB_PROCESSTEXT, "getcb_processtext"}, - {MNG_FN_GETCB_GETCANVASLINE, "getcb_getcanvasline"}, - {MNG_FN_GETCB_GETBKGDLINE, "getcb_getbkgdline"}, - {MNG_FN_GETCB_REFRESH, "getcb_refresh"}, - {MNG_FN_GETCB_GETTICKCOUNT, "getcb_gettickcount"}, - {MNG_FN_GETCB_SETTIMER, "getcb_settimer"}, - {MNG_FN_GETCB_PROCESSGAMMA, "getcb_processgamma"}, - {MNG_FN_GETCB_PROCESSCHROMA, "getcb_processchroma"}, - {MNG_FN_GETCB_PROCESSSRGB, "getcb_processsrgb"}, - {MNG_FN_GETCB_PROCESSICCP, "getcb_processiccp"}, - {MNG_FN_GETCB_PROCESSAROW, "getcb_processarow"}, -#ifndef MNG_NO_OPEN_CLOSE_STREAM - {MNG_FN_GETCB_OPENSTREAM, "getcb_openstream"}, - {MNG_FN_GETCB_CLOSESTREAM, "getcb_closestream"}, -#endif - {MNG_FN_GETCB_GETALPHALINE, "getcb_getalphaline"}, - {MNG_FN_GETCB_PROCESSSAVE, "getcb_processsave"}, - {MNG_FN_GETCB_PROCESSSEEK, "getcb_processseek"}, - {MNG_FN_GETCB_PROCESSNEED, "getcb_processneed"}, - {MNG_FN_GETCB_PROCESSUNKNOWN, "getcb_processunknown"}, - {MNG_FN_GETCB_PROCESSMEND, "getcb_processmend"}, - {MNG_FN_GETCB_PROCESSTERM, "getcb_processterm"}, - {MNG_FN_GETCB_RELEASEDATA, "getcb_releasedata"}, - - {MNG_FN_SET_USERDATA, "set_userdata"}, - {MNG_FN_SET_CANVASSTYLE, "set_canvasstyle"}, - {MNG_FN_SET_BKGDSTYLE, "set_bkgdstyle"}, - {MNG_FN_SET_BGCOLOR, "set_bgcolor"}, - {MNG_FN_SET_STORECHUNKS, "set_storechunks"}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {MNG_FN_SET_VIEWGAMMA, "set_viewgamma"}, -#ifndef MNG_NO_DFLT_INFO - {MNG_FN_SET_DISPLAYGAMMA, "set_displaygamma"}, -#endif - {MNG_FN_SET_DFLTIMGGAMMA, "set_dfltimggamma"}, -#endif - {MNG_FN_SET_SRGB, "set_srgb"}, - {MNG_FN_SET_OUTPUTPROFILE, "set_outputprofile"}, - {MNG_FN_SET_SRGBPROFILE, "set_srgbprofile"}, -#ifndef MNG_SKIP_MAXCANVAS - {MNG_FN_SET_MAXCANVASWIDTH, "set_maxcanvaswidth"}, - {MNG_FN_SET_MAXCANVASHEIGHT, "set_maxcanvasheight"}, - {MNG_FN_SET_MAXCANVASSIZE, "set_maxcanvassize"}, -#endif -#ifndef MNG_NO_ACCESS_ZLIB - {MNG_FN_SET_ZLIB_LEVEL, "set_zlib_level"}, - {MNG_FN_SET_ZLIB_METHOD, "set_zlib_method"}, - {MNG_FN_SET_ZLIB_WINDOWBITS, "set_zlib_windowbits"}, - {MNG_FN_SET_ZLIB_MEMLEVEL, "set_zlib_memlevel"}, - {MNG_FN_SET_ZLIB_STRATEGY, "set_zlib_strategy"}, - {MNG_FN_SET_ZLIB_MAXIDAT, "set_zlib_maxidat"}, -#endif -#ifndef MNG_NO_ACCESS_JPEG - {MNG_FN_SET_JPEG_DCTMETHOD, "set_jpeg_dctmethod"}, - {MNG_FN_SET_JPEG_QUALITY, "set_jpeg_quality"}, - {MNG_FN_SET_JPEG_SMOOTHING, "set_jpeg_smoothing"}, - {MNG_FN_SET_JPEG_PROGRESSIVE, "set_jpeg_progressive"}, - {MNG_FN_SET_JPEG_OPTIMIZED, "set_jpeg_optimized"}, - {MNG_FN_SET_JPEG_MAXJDAT, "set_jpeg_maxjdat"}, -#endif - {MNG_FN_SET_SPEED, "set_speed"}, - {MNG_FN_SET_SUSPENSIONMODE, "set_suspensionmode"}, - {MNG_FN_SET_SECTIONBREAKS, "set_sectionbreaks"}, - {MNG_FN_SET_USEBKGD, "set_usebkgd"}, - {MNG_FN_SET_OUTPUTPROFILE2, "set_outputprofile2"}, - {MNG_FN_SET_SRGBPROFILE2, "set_srgbprofile2"}, - {MNG_FN_SET_OUTPUTSRGB, "set_outputsrgb"}, - {MNG_FN_SET_SRGBIMPLICIT, "set_srgbimplicit"}, - {MNG_FN_SET_CACHEPLAYBACK, "set_cacheplayback"}, - {MNG_FN_SET_DOPROGRESSIVE, "set_doprogressive"}, - {MNG_FN_SET_CRCMODE, "set_crcmode"}, - - {MNG_FN_GET_USERDATA, "get_userdata"}, - {MNG_FN_GET_SIGTYPE, "get_sigtype"}, - {MNG_FN_GET_IMAGETYPE, "get_imagetype"}, - {MNG_FN_GET_IMAGEWIDTH, "get_imagewidth"}, - {MNG_FN_GET_IMAGEHEIGHT, "get_imageheight"}, - {MNG_FN_GET_TICKS, "get_ticks"}, - {MNG_FN_GET_FRAMECOUNT, "get_framecount"}, - {MNG_FN_GET_LAYERCOUNT, "get_layercount"}, - {MNG_FN_GET_PLAYTIME, "get_playtime"}, - {MNG_FN_GET_SIMPLICITY, "get_simplicity"}, - {MNG_FN_GET_CANVASSTYLE, "get_canvasstyle"}, - {MNG_FN_GET_BKGDSTYLE, "get_bkgdstyle"}, - {MNG_FN_GET_BGCOLOR, "get_bgcolor"}, - {MNG_FN_GET_STORECHUNKS, "get_storechunks"}, -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) - {MNG_FN_GET_VIEWGAMMA, "get_viewgamma"}, - {MNG_FN_GET_DISPLAYGAMMA, "get_displaygamma"}, -#ifndef MNG_NO_DFLT_INFO - {MNG_FN_GET_DFLTIMGGAMMA, "get_dfltimggamma"}, -#endif -#endif - {MNG_FN_GET_SRGB, "get_srgb"}, -#ifndef MNG_SKIP_MAXCANVAS - {MNG_FN_GET_MAXCANVASWIDTH, "get_maxcanvaswidth"}, - {MNG_FN_GET_MAXCANVASHEIGHT, "get_maxcanvasheight"}, -#endif -#ifndef MNG_NO_ACCESS_ZLIB - {MNG_FN_GET_ZLIB_LEVEL, "get_zlib_level"}, - {MNG_FN_GET_ZLIB_METHOD, "get_zlib_method"}, - {MNG_FN_GET_ZLIB_WINDOWBITS, "get_zlib_windowbits"}, - {MNG_FN_GET_ZLIB_MEMLEVEL, "get_zlib_memlevel"}, - {MNG_FN_GET_ZLIB_STRATEGY, "get_zlib_strategy"}, - {MNG_FN_GET_ZLIB_MAXIDAT, "get_zlib_maxidat"}, -#endif -#ifndef MNG_NO_ACCESS_JPEG - {MNG_FN_GET_JPEG_DCTMETHOD, "get_jpeg_dctmethod"}, - {MNG_FN_GET_JPEG_QUALITY, "get_jpeg_quality"}, - {MNG_FN_GET_JPEG_SMOOTHING, "get_jpeg_smoothing"}, - {MNG_FN_GET_JPEG_PROGRESSIVE, "get_jpeg_progressive"}, - {MNG_FN_GET_JPEG_OPTIMIZED, "get_jpeg_optimized"}, - {MNG_FN_GET_JPEG_MAXJDAT, "get_jpeg_maxjdat"}, -#endif - {MNG_FN_GET_SPEED, "get_speed"}, - {MNG_FN_GET_IMAGELEVEL, "get_imagelevel"}, - {MNG_FN_GET_SUSPENSIONMODE, "get_speed"}, - {MNG_FN_GET_STARTTIME, "get_starttime"}, - {MNG_FN_GET_RUNTIME, "get_runtime"}, -#ifndef MNG_NO_CURRENT_INFO - {MNG_FN_GET_CURRENTFRAME, "get_currentframe"}, - {MNG_FN_GET_CURRENTLAYER, "get_currentlayer"}, - {MNG_FN_GET_CURRENTPLAYTIME, "get_currentplaytime"}, -#endif - {MNG_FN_GET_SECTIONBREAKS, "get_sectionbreaks"}, - {MNG_FN_GET_ALPHADEPTH, "get_alphadepth"}, - {MNG_FN_GET_BITDEPTH, "get_bitdepth"}, - {MNG_FN_GET_COLORTYPE, "get_colortype"}, - {MNG_FN_GET_COMPRESSION, "get_compression"}, - {MNG_FN_GET_FILTER, "get_filter"}, - {MNG_FN_GET_INTERLACE, "get_interlace"}, - {MNG_FN_GET_ALPHABITDEPTH, "get_alphabitdepth"}, - {MNG_FN_GET_ALPHACOMPRESSION, "get_alphacompression"}, - {MNG_FN_GET_ALPHAFILTER, "get_alphafilter"}, - {MNG_FN_GET_ALPHAINTERLACE, "get_alphainterlace"}, - {MNG_FN_GET_USEBKGD, "get_usebkgd"}, - {MNG_FN_GET_REFRESHPASS, "get_refreshpass"}, - {MNG_FN_GET_CACHEPLAYBACK, "get_cacheplayback"}, - {MNG_FN_GET_DOPROGRESSIVE, "get_doprogressive"}, - {MNG_FN_GET_LASTBACKCHUNK, "get_lastbackchunk"}, - {MNG_FN_GET_LASTSEEKNAME, "get_lastseekname"}, -#ifndef MNG_NO_CURRENT_INFO - {MNG_FN_GET_TOTALFRAMES, "get_totalframes"}, - {MNG_FN_GET_TOTALLAYERS, "get_totallayers"}, - {MNG_FN_GET_TOTALPLAYTIME, "get_totalplaytime"}, -#endif - {MNG_FN_GET_CRCMODE, "get_crcmode"}, - {MNG_FN_GET_CURRFRAMDELAY, "get_currframdelay"}, - - {MNG_FN_STATUS_ERROR, "status_error"}, - {MNG_FN_STATUS_READING, "status_reading"}, - {MNG_FN_STATUS_SUSPENDBREAK, "status_suspendbreak"}, - {MNG_FN_STATUS_CREATING, "status_creating"}, - {MNG_FN_STATUS_WRITING, "status_writing"}, - {MNG_FN_STATUS_DISPLAYING, "status_displaying"}, - {MNG_FN_STATUS_RUNNING, "status_running"}, - {MNG_FN_STATUS_TIMERBREAK, "status_timerbreak"}, - {MNG_FN_STATUS_DYNAMIC, "status_dynamic"}, - {MNG_FN_STATUS_RUNNINGEVENT, "status_runningevent"}, - - {MNG_FN_ITERATE_CHUNKS, "iterate_chunks"}, - {MNG_FN_COPY_CHUNK, "copy_chunk"}, - - {MNG_FN_GETCHUNK_IHDR, "getchunk_ihdr"}, - {MNG_FN_GETCHUNK_PLTE, "getchunk_plte"}, - {MNG_FN_GETCHUNK_IDAT, "getchunk_idat"}, - {MNG_FN_GETCHUNK_IEND, "getchunk_iend"}, - {MNG_FN_GETCHUNK_TRNS, "getchunk_trns"}, -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_FN_GETCHUNK_GAMA, "getchunk_gama"}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_FN_GETCHUNK_CHRM, "getchunk_chrm"}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {MNG_FN_GETCHUNK_SRGB, "getchunk_srgb"}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_FN_GETCHUNK_ICCP, "getchunk_iccp"}, -#endif -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_FN_GETCHUNK_TEXT, "getchunk_text"}, -#endif -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_FN_GETCHUNK_ZTXT, "getchunk_ztxt"}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_FN_GETCHUNK_ITXT, "getchunk_itxt"}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_FN_GETCHUNK_BKGD, "getchunk_bkgd"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_FN_GETCHUNK_PHYS, "getchunk_phys"}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_FN_GETCHUNK_SBIT, "getchunk_sbit"}, -#endif -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_FN_GETCHUNK_SPLT, "getchunk_splt"}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_FN_GETCHUNK_HIST, "getchunk_hist"}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_FN_GETCHUNK_TIME, "getchunk_time"}, -#endif - {MNG_FN_GETCHUNK_MHDR, "getchunk_mhdr"}, - {MNG_FN_GETCHUNK_MEND, "getchunk_mend"}, -#ifndef MNG_SKIPCHUNK_LOOP - {MNG_FN_GETCHUNK_LOOP, "getchunk_loop"}, - {MNG_FN_GETCHUNK_ENDL, "getchunk_endl"}, -#endif - {MNG_FN_GETCHUNK_DEFI, "getchunk_defi"}, -#ifndef MNG_SKIPCHUNK_BASI - {MNG_FN_GETCHUNK_BASI, "getchunk_basi"}, -#endif - {MNG_FN_GETCHUNK_CLON, "getchunk_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_GETCHUNK_PAST, "getchunk_past"}, -#endif - {MNG_FN_GETCHUNK_DISC, "getchunk_disc"}, - {MNG_FN_GETCHUNK_BACK, "getchunk_back"}, - {MNG_FN_GETCHUNK_FRAM, "getchunk_fram"}, - {MNG_FN_GETCHUNK_MOVE, "getchunk_move"}, - {MNG_FN_GETCHUNK_CLIP, "getchunk_clip"}, - {MNG_FN_GETCHUNK_SHOW, "getchunk_show"}, - {MNG_FN_GETCHUNK_TERM, "getchunk_term"}, -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_GETCHUNK_SAVE, "getchunk_save"}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_FN_GETCHUNK_SEEK, "getchunk_seek"}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_FN_GETCHUNK_EXPI, "getchunk_expi"}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_FN_GETCHUNK_FPRI, "getchunk_fpri"}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_FN_GETCHUNK_NEED, "getchunk_need"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_FN_GETCHUNK_PHYG, "getchunk_phyg"}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_FN_GETCHUNK_JHDR, "getchunk_jhdr"}, - {MNG_FN_GETCHUNK_JDAT, "getchunk_jdat"}, - {MNG_FN_GETCHUNK_JSEP, "getchunk_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_GETCHUNK_DHDR, "getchunk_dhdr"}, - {MNG_FN_GETCHUNK_PROM, "getchunk_prom"}, - {MNG_FN_GETCHUNK_IPNG, "getchunk_ipng"}, - {MNG_FN_GETCHUNK_PPLT, "getchunk_pplt"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_GETCHUNK_IJNG, "getchunk_ijng"}, -#endif -#ifndef MNG_SKIPCHUNK_DROP - {MNG_FN_GETCHUNK_DROP, "getchunk_drop"}, -#endif -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_FN_GETCHUNK_DBYK, "getchunk_dbyk"}, -#endif -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_FN_GETCHUNK_ORDR, "getchunk_ordr"}, -#endif -#endif - {MNG_FN_GETCHUNK_UNKNOWN, "getchunk_unknown"}, - {MNG_FN_GETCHUNK_MAGN, "getchunk_magn"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_GETCHUNK_JDAA, "getchunk_jdaa"}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_GETCHUNK_EVNT, "getchunk_evnt"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_GETCHUNK_MPNG, "getchunk_mpng"}, -#endif - -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_GETCHUNK_PAST_SRC, "getchunk_past_src"}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_GETCHUNK_SAVE_ENTRY, "getchunk_save_entry"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_GETCHUNK_PPLT_ENTRY, "getchunk_pplt_entry"}, - {MNG_FN_GETCHUNK_ORDR_ENTRY, "getchunk_ordr_entry"}, -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_GETCHUNK_EVNT_ENTRY, "getchunk_evnt_entry"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_GETCHUNK_MPNG_FRAME, "getchunk_mpng_frame"}, -#endif - - {MNG_FN_PUTCHUNK_IHDR, "putchunk_ihdr"}, - {MNG_FN_PUTCHUNK_PLTE, "putchunk_plte"}, - {MNG_FN_PUTCHUNK_IDAT, "putchunk_idat"}, - {MNG_FN_PUTCHUNK_IEND, "putchunk_iend"}, - {MNG_FN_PUTCHUNK_TRNS, "putchunk_trns"}, -#ifndef MNG_SKIPCHUNK_gAMA - {MNG_FN_PUTCHUNK_GAMA, "putchunk_gama"}, -#endif -#ifndef MNG_SKIPCHUNK_cHRM - {MNG_FN_PUTCHUNK_CHRM, "putchunk_chrm"}, -#endif -#ifndef MNG_SKIPCHUNK_sRGB - {MNG_FN_PUTCHUNK_SRGB, "putchunk_srgb"}, -#endif -#ifndef MNG_SKIPCHUNK_iCCP - {MNG_FN_PUTCHUNK_ICCP, "putchunk_iccp"}, -#endif -#ifndef MNG_SKIPCHUNK_tEXt - {MNG_FN_PUTCHUNK_TEXT, "putchunk_text"}, -#endif -#ifndef MNG_SKIPCHUNK_zTXt - {MNG_FN_PUTCHUNK_ZTXT, "putchunk_ztxt"}, -#endif -#ifndef MNG_SKIPCHUNK_iTXt - {MNG_FN_PUTCHUNK_ITXT, "putchunk_itxt"}, -#endif -#ifndef MNG_SKIPCHUNK_bKGD - {MNG_FN_PUTCHUNK_BKGD, "putchunk_bkgd"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYs - {MNG_FN_PUTCHUNK_PHYS, "putchunk_phys"}, -#endif -#ifndef MNG_SKIPCHUNK_sBIT - {MNG_FN_PUTCHUNK_SBIT, "putchunk_sbit"}, -#endif -#ifndef MNG_SKIPCHUNK_sPLT - {MNG_FN_PUTCHUNK_SPLT, "putchunk_splt"}, -#endif -#ifndef MNG_SKIPCHUNK_hIST - {MNG_FN_PUTCHUNK_HIST, "putchunk_hist"}, -#endif -#ifndef MNG_SKIPCHUNK_tIME - {MNG_FN_PUTCHUNK_TIME, "putchunk_time"}, -#endif - {MNG_FN_PUTCHUNK_MHDR, "putchunk_mhdr"}, - {MNG_FN_PUTCHUNK_MEND, "putchunk_mend"}, - {MNG_FN_PUTCHUNK_LOOP, "putchunk_loop"}, - {MNG_FN_PUTCHUNK_ENDL, "putchunk_endl"}, - {MNG_FN_PUTCHUNK_DEFI, "putchunk_defi"}, - {MNG_FN_PUTCHUNK_BASI, "putchunk_basi"}, - {MNG_FN_PUTCHUNK_CLON, "putchunk_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PUTCHUNK_PAST, "putchunk_past"}, -#endif - {MNG_FN_PUTCHUNK_DISC, "putchunk_disc"}, - {MNG_FN_PUTCHUNK_BACK, "putchunk_back"}, - {MNG_FN_PUTCHUNK_FRAM, "putchunk_fram"}, - {MNG_FN_PUTCHUNK_MOVE, "putchunk_move"}, - {MNG_FN_PUTCHUNK_CLIP, "putchunk_clip"}, - {MNG_FN_PUTCHUNK_SHOW, "putchunk_show"}, - {MNG_FN_PUTCHUNK_TERM, "putchunk_term"}, -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_PUTCHUNK_SAVE, "putchunk_save"}, -#endif -#ifndef MNG_SKIPCHUNK_SEEK - {MNG_FN_PUTCHUNK_SEEK, "putchunk_seek"}, -#endif -#ifndef MNG_SKIPCHUNK_eXPI - {MNG_FN_PUTCHUNK_EXPI, "putchunk_expi"}, -#endif -#ifndef MNG_SKIPCHUNK_fPRI - {MNG_FN_PUTCHUNK_FPRI, "putchunk_fpri"}, -#endif -#ifndef MNG_SKIPCHUNK_nEED - {MNG_FN_PUTCHUNK_NEED, "putchunk_need"}, -#endif -#ifndef MNG_SKIPCHUNK_pHYg - {MNG_FN_PUTCHUNK_PHYG, "putchunk_phyg"}, -#endif -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PUTCHUNK_JHDR, "putchunk_jhdr"}, - {MNG_FN_PUTCHUNK_JDAT, "putchunk_jdat"}, - {MNG_FN_PUTCHUNK_JSEP, "putchunk_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PUTCHUNK_DHDR, "putchunk_dhdr"}, - {MNG_FN_PUTCHUNK_PROM, "putchunk_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PUTCHUNK_IPNG, "putchunk_ipng"}, -#endif - {MNG_FN_PUTCHUNK_PPLT, "putchunk_pplt"}, - {MNG_FN_PUTCHUNK_IJNG, "putchunk_ijng"}, -#ifndef MNG_SKIPCHUNK_DROP - {MNG_FN_PUTCHUNK_DROP, "putchunk_drop"}, -#endif -#ifndef MNG_SKIPCHUNK_DBYK - {MNG_FN_PUTCHUNK_DBYK, "putchunk_dbyk"}, -#endif -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_FN_PUTCHUNK_ORDR, "putchunk_ordr"}, -#endif -#endif - {MNG_FN_PUTCHUNK_UNKNOWN, "putchunk_unknown"}, - {MNG_FN_PUTCHUNK_MAGN, "putchunk_magn"}, - {MNG_FN_PUTCHUNK_JDAA, "putchunk_jdaa"}, -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_PUTCHUNK_EVNT, "putchunk_evnt"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_PUTCHUNK_MPNG, "putchunk_mpng"}, -#endif - -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PUTCHUNK_PAST_SRC, "putchunk_past_src"}, -#endif -#ifndef MNG_SKIPCHUNK_SAVE - {MNG_FN_PUTCHUNK_SAVE_ENTRY, "putchunk_save_entry"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PUTCHUNK_PPLT_ENTRY, "putchunk_pplt_entry"}, -#ifndef MNG_SKIPCHUNK_ORDR - {MNG_FN_PUTCHUNK_ORDR_ENTRY, "putchunk_ordr_entry"}, -#endif -#endif -#ifndef MNG_SKIPCHUNK_evNT - {MNG_FN_PUTCHUNK_EVNT_ENTRY, "putchunk_evnt_entry"}, -#endif -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_PUTCHUNK_MPNG_FRAME, "putchunk_mpng_frame"}, -#endif - - {MNG_FN_GETIMGDATA_SEQ, "getimgdata_seq"}, - {MNG_FN_GETIMGDATA_CHUNKSEQ, "getimgdata_chunkseq"}, - {MNG_FN_GETIMGDATA_CHUNK, "getimgdata_chunk"}, - - {MNG_FN_PUTIMGDATA_IHDR, "putimgdata_ihdr"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PUTIMGDATA_JHDR, "putimgdata_jhdr"}, - {MNG_FN_PUTIMGDATA_BASI, "putimgdata_basi"}, - {MNG_FN_PUTIMGDATA_DHDR, "putimgdata_dhdr"}, -#endif - - {MNG_FN_UPDATEMNGHEADER, "updatemngheader"}, - {MNG_FN_UPDATEMNGSIMPLICITY, "updatemngsimplicity"}, - - {MNG_FN_PROCESS_RAW_CHUNK, "process_raw_chunk"}, - {MNG_FN_READ_GRAPHIC, "read_graphic"}, - {MNG_FN_DROP_CHUNKS, "drop_chunks"}, - {MNG_FN_PROCESS_ERROR, "process_error"}, - {MNG_FN_CLEAR_CMS, "clear_cms"}, - {MNG_FN_DROP_OBJECTS, "drop_objects"}, - {MNG_FN_READ_CHUNK, "read_chunk"}, - {MNG_FN_LOAD_BKGDLAYER, "load_bkgdlayer"}, - {MNG_FN_NEXT_FRAME, "next_frame"}, - {MNG_FN_NEXT_LAYER, "next_layer"}, - {MNG_FN_INTERFRAME_DELAY, "interframe_delay"}, - {MNG_FN_DISPLAY_IMAGE, "display_image"}, - {MNG_FN_DROP_IMGOBJECTS, "drop_imgobjects"}, - {MNG_FN_DROP_ANIOBJECTS, "drop_aniobjects"}, - {MNG_FN_INFLATE_BUFFER, "inflate_buffer"}, - {MNG_FN_DEFLATE_BUFFER, "deflate_buffer"}, - {MNG_FN_WRITE_RAW_CHUNK, "write_raw_chunk"}, - {MNG_FN_WRITE_GRAPHIC, "write_graphic"}, - {MNG_FN_SAVE_STATE, "save_state"}, - {MNG_FN_RESTORE_STATE, "restore_state"}, - {MNG_FN_DROP_SAVEDATA, "drop_savedata"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_EXECUTE_DELTA_IMAGE, "execute_delta_image"}, -#endif - {MNG_FN_PROCESS_DISPLAY, "process_display"}, - {MNG_FN_CLEAR_CANVAS, "clear_canvas"}, - {MNG_FN_READ_DATABUFFER, "read_databuffer"}, - {MNG_FN_STORE_ERROR, "store_error"}, - {MNG_FN_DROP_INVALID_OBJECTS, "drop_invalid_objects"}, - {MNG_FN_RELEASE_PUSHDATA, "release_pushdata"}, - {MNG_FN_READ_DATA, "read_data"}, - {MNG_FN_READ_CHUNK_CRC, "read_chunk_crc"}, - {MNG_FN_RELEASE_PUSHCHUNK, "release_pushchunk"}, - - {MNG_FN_DISPLAY_RGB8, "display_rgb8"}, - {MNG_FN_DISPLAY_RGBA8, "display_rgba8"}, - {MNG_FN_DISPLAY_ARGB8, "display_argb8"}, - {MNG_FN_DISPLAY_BGR8, "display_bgr8"}, - {MNG_FN_DISPLAY_BGRA8, "display_bgra8"}, - {MNG_FN_DISPLAY_ABGR8, "display_abgr8"}, - {MNG_FN_DISPLAY_RGB16, "display_rgb16"}, - {MNG_FN_DISPLAY_RGBA16, "display_rgba16"}, - {MNG_FN_DISPLAY_ARGB16, "display_argb16"}, - {MNG_FN_DISPLAY_BGR16, "display_bgr16"}, - {MNG_FN_DISPLAY_BGRA16, "display_bgra16"}, - {MNG_FN_DISPLAY_ABGR16, "display_abgr16"}, - {MNG_FN_DISPLAY_INDEX8, "display_index8"}, - {MNG_FN_DISPLAY_INDEXA8, "display_indexa8"}, - {MNG_FN_DISPLAY_AINDEX8, "display_aindex8"}, - {MNG_FN_DISPLAY_GRAY8, "display_gray8"}, - {MNG_FN_DISPLAY_GRAY16, "display_gray16"}, - {MNG_FN_DISPLAY_GRAYA8, "display_graya8"}, - {MNG_FN_DISPLAY_GRAYA16, "display_graya16"}, - {MNG_FN_DISPLAY_AGRAY8, "display_agray8"}, - {MNG_FN_DISPLAY_AGRAY16, "display_agray16"}, - {MNG_FN_DISPLAY_DX15, "display_dx15"}, - {MNG_FN_DISPLAY_DX16, "display_dx16"}, - {MNG_FN_DISPLAY_RGB8_A8, "display_rgb8_a8"}, - {MNG_FN_DISPLAY_BGRA8PM, "display_bgra8_pm"}, - {MNG_FN_DISPLAY_BGRX8, "display_bgrx8"}, - {MNG_FN_DISPLAY_RGB565, "display_rgb565"}, - {MNG_FN_DISPLAY_RGBA565, "display_rgba565"}, - {MNG_FN_DISPLAY_BGR565, "display_bgr565"}, - {MNG_FN_DISPLAY_BGRA565, "display_bgra565"}, - {MNG_FN_DISPLAY_RGBA8_PM, "display_rgba8_pm"}, - {MNG_FN_DISPLAY_ARGB8_PM, "display_argb8_pm"}, - {MNG_FN_DISPLAY_ABGR8_PM, "display_abgr8_pm"}, - {MNG_FN_DISPLAY_BGR565_A8, "display_bgr565_a8"}, - - {MNG_FN_INIT_FULL_CMS, "init_full_cms"}, - {MNG_FN_CORRECT_FULL_CMS, "correct_full_cms"}, - {MNG_FN_INIT_GAMMA_ONLY, "init_gamma_only"}, - {MNG_FN_CORRECT_GAMMA_ONLY, "correct_gamma_only"}, - {MNG_FN_CORRECT_APP_CMS, "correct_app_cms"}, - {MNG_FN_INIT_FULL_CMS_OBJ, "init_full_cms_obj"}, - {MNG_FN_INIT_GAMMA_ONLY_OBJ, "init_gamma_only_obj"}, - {MNG_FN_INIT_APP_CMS, "init_app_cms"}, - {MNG_FN_INIT_APP_CMS_OBJ, "init_app_cms_obj"}, - - {MNG_FN_PROCESS_G1, "process_g1"}, - {MNG_FN_PROCESS_G2, "process_g2"}, - {MNG_FN_PROCESS_G4, "process_g4"}, - {MNG_FN_PROCESS_G8, "process_g8"}, - {MNG_FN_PROCESS_G16, "process_g16"}, - {MNG_FN_PROCESS_RGB8, "process_rgb8"}, - {MNG_FN_PROCESS_RGB16, "process_rgb16"}, - {MNG_FN_PROCESS_IDX1, "process_idx1"}, - {MNG_FN_PROCESS_IDX2, "process_idx2"}, - {MNG_FN_PROCESS_IDX4, "process_idx4"}, - {MNG_FN_PROCESS_IDX8, "process_idx8"}, - {MNG_FN_PROCESS_GA8, "process_ga8"}, - {MNG_FN_PROCESS_GA16, "process_ga16"}, - {MNG_FN_PROCESS_RGBA8, "process_rgba8"}, - {MNG_FN_PROCESS_RGBA16, "process_rgba16"}, - - {MNG_FN_INIT_G1_I, "init_g1_i"}, - {MNG_FN_INIT_G2_I, "init_g2_i"}, - {MNG_FN_INIT_G4_I, "init_g4_i"}, - {MNG_FN_INIT_G8_I, "init_g8_i"}, - {MNG_FN_INIT_G16_I, "init_g16_i"}, - {MNG_FN_INIT_RGB8_I, "init_rgb8_i"}, - {MNG_FN_INIT_RGB16_I, "init_rgb16_i"}, - {MNG_FN_INIT_IDX1_I, "init_idx1_i"}, - {MNG_FN_INIT_IDX2_I, "init_idx2_i"}, - {MNG_FN_INIT_IDX4_I, "init_idx4_i"}, - {MNG_FN_INIT_IDX8_I, "init_idx8_i"}, - {MNG_FN_INIT_GA8_I, "init_ga8_i"}, - {MNG_FN_INIT_GA16_I, "init_ga16_i"}, - {MNG_FN_INIT_RGBA8_I, "init_rgba8_i"}, - {MNG_FN_INIT_RGBA16_I, "init_rgba16_i"}, -#ifndef MNG_OPTIMIZE_FOOTPRINT_INIT - {MNG_FN_INIT_G1_NI, "init_g1_ni"}, - {MNG_FN_INIT_G2_NI, "init_g2_ni"}, - {MNG_FN_INIT_G4_NI, "init_g4_ni"}, - {MNG_FN_INIT_G8_NI, "init_g8_ni"}, - {MNG_FN_INIT_G16_NI, "init_g16_ni"}, - {MNG_FN_INIT_RGB8_NI, "init_rgb8_ni"}, - {MNG_FN_INIT_RGB16_NI, "init_rgb16_ni"}, - {MNG_FN_INIT_IDX1_NI, "init_idx1_ni"}, - {MNG_FN_INIT_IDX2_NI, "init_idx2_ni"}, - {MNG_FN_INIT_IDX4_NI, "init_idx4_ni"}, - {MNG_FN_INIT_IDX8_NI, "init_idx8_ni"}, - {MNG_FN_INIT_GA8_NI, "init_ga8_ni"}, - {MNG_FN_INIT_GA16_NI, "init_ga16_ni"}, - {MNG_FN_INIT_RGBA8_NI, "init_rgba8_ni"}, - {MNG_FN_INIT_RGBA16_NI, "init_rgba16_ni"}, -#endif - - {MNG_FN_INIT_ROWPROC, "init_rowproc"}, - {MNG_FN_NEXT_ROW, "next_row"}, - {MNG_FN_CLEANUP_ROWPROC, "cleanup_rowproc"}, - - {MNG_FN_FILTER_A_ROW, "filter_a_row"}, - {MNG_FN_FILTER_SUB, "filter_sub"}, - {MNG_FN_FILTER_UP, "filter_up"}, - {MNG_FN_FILTER_AVERAGE, "filter_average"}, - {MNG_FN_FILTER_PAETH, "filter_paeth"}, - - {MNG_FN_INIT_ROWDIFFERING, "init_rowdiffering"}, - {MNG_FN_DIFFER_G1, "differ_g1"}, - {MNG_FN_DIFFER_G2, "differ_g2"}, - {MNG_FN_DIFFER_G4, "differ_g4"}, - {MNG_FN_DIFFER_G8, "differ_g8"}, - {MNG_FN_DIFFER_G16, "differ_g16"}, - {MNG_FN_DIFFER_RGB8, "differ_rgb8"}, - {MNG_FN_DIFFER_RGB16, "differ_rgb16"}, - {MNG_FN_DIFFER_IDX1, "differ_idx1"}, - {MNG_FN_DIFFER_IDX2, "differ_idx2"}, - {MNG_FN_DIFFER_IDX4, "differ_idx4"}, - {MNG_FN_DIFFER_IDX8, "differ_idx8"}, - {MNG_FN_DIFFER_GA8, "differ_ga8"}, - {MNG_FN_DIFFER_GA16, "differ_ga16"}, - {MNG_FN_DIFFER_RGBA8, "differ_rgba8"}, - {MNG_FN_DIFFER_RGBA16, "differ_rgba16"}, - - {MNG_FN_CREATE_IMGDATAOBJECT, "create_imgdataobject"}, - {MNG_FN_FREE_IMGDATAOBJECT, "free_imgdataobject"}, - {MNG_FN_CLONE_IMGDATAOBJECT, "clone_imgdataobject"}, - {MNG_FN_CREATE_IMGOBJECT, "create_imgobject"}, - {MNG_FN_FREE_IMGOBJECT, "free_imgobject"}, - {MNG_FN_FIND_IMGOBJECT, "find_imgobject"}, - {MNG_FN_CLONE_IMGOBJECT, "clone_imgobject"}, - {MNG_FN_RESET_OBJECTDETAILS, "reset_objectdetails"}, - {MNG_FN_RENUM_IMGOBJECT, "renum_imgobject"}, - {MNG_FN_PROMOTE_IMGOBJECT, "promote_imgobject"}, - {MNG_FN_MAGNIFY_IMGOBJECT, "magnify_imgobject"}, - {MNG_FN_COLORCORRECT_OBJECT, "colorcorrect_object"}, - - {MNG_FN_STORE_G1, "store_g1"}, - {MNG_FN_STORE_G2, "store_g2"}, - {MNG_FN_STORE_G4, "store_g4"}, - {MNG_FN_STORE_G8, "store_g8"}, - {MNG_FN_STORE_G16, "store_g16"}, - {MNG_FN_STORE_RGB8, "store_rgb8"}, - {MNG_FN_STORE_RGB16, "store_rgb16"}, - {MNG_FN_STORE_IDX1, "store_idx1"}, - {MNG_FN_STORE_IDX2, "store_idx2"}, - {MNG_FN_STORE_IDX4, "store_idx4"}, - {MNG_FN_STORE_IDX8, "store_idx8"}, - {MNG_FN_STORE_GA8, "store_ga8"}, - {MNG_FN_STORE_GA16, "store_ga16"}, - {MNG_FN_STORE_RGBA8, "store_rgba8"}, - {MNG_FN_STORE_RGBA16, "store_rgba16"}, - - {MNG_FN_RETRIEVE_G8, "retrieve_g8"}, - {MNG_FN_RETRIEVE_G16, "retrieve_g16"}, - {MNG_FN_RETRIEVE_RGB8, "retrieve_rgb8"}, - {MNG_FN_RETRIEVE_RGB16, "retrieve_rgb16"}, - {MNG_FN_RETRIEVE_IDX8, "retrieve_idx8"}, - {MNG_FN_RETRIEVE_GA8, "retrieve_ga8"}, - {MNG_FN_RETRIEVE_GA16, "retrieve_ga16"}, - {MNG_FN_RETRIEVE_RGBA8, "retrieve_rgba8"}, - {MNG_FN_RETRIEVE_RGBA16, "retrieve_rgba16"}, - -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_DELTA_G1, "delta_g1"}, - {MNG_FN_DELTA_G2, "delta_g2"}, - {MNG_FN_DELTA_G4, "delta_g4"}, - {MNG_FN_DELTA_G8, "delta_g8"}, - {MNG_FN_DELTA_G16, "delta_g16"}, - {MNG_FN_DELTA_RGB8, "delta_rgb8"}, - {MNG_FN_DELTA_RGB16, "delta_rgb16"}, - {MNG_FN_DELTA_IDX1, "delta_idx1"}, - {MNG_FN_DELTA_IDX2, "delta_idx2"}, - {MNG_FN_DELTA_IDX4, "delta_idx4"}, - {MNG_FN_DELTA_IDX8, "delta_idx8"}, - {MNG_FN_DELTA_GA8, "delta_ga8"}, - {MNG_FN_DELTA_GA16, "delta_ga16"}, - {MNG_FN_DELTA_RGBA8, "delta_rgba8"}, - {MNG_FN_DELTA_RGBA16, "delta_rgba16"}, -#endif - - {MNG_FN_CREATE_ANI_LOOP, "create_ani_loop"}, - {MNG_FN_CREATE_ANI_ENDL, "create_ani_endl"}, - {MNG_FN_CREATE_ANI_DEFI, "create_ani_defi"}, - {MNG_FN_CREATE_ANI_BASI, "create_ani_basi"}, - {MNG_FN_CREATE_ANI_CLON, "create_ani_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_CREATE_ANI_PAST, "create_ani_past"}, -#endif - {MNG_FN_CREATE_ANI_DISC, "create_ani_disc"}, - {MNG_FN_CREATE_ANI_BACK, "create_ani_back"}, - {MNG_FN_CREATE_ANI_FRAM, "create_ani_fram"}, - {MNG_FN_CREATE_ANI_MOVE, "create_ani_move"}, - {MNG_FN_CREATE_ANI_CLIP, "create_ani_clip"}, - {MNG_FN_CREATE_ANI_SHOW, "create_ani_show"}, - {MNG_FN_CREATE_ANI_TERM, "create_ani_term"}, - {MNG_FN_CREATE_ANI_SAVE, "create_ani_save"}, - {MNG_FN_CREATE_ANI_SEEK, "create_ani_seek"}, - {MNG_FN_CREATE_ANI_GAMA, "create_ani_gama"}, - {MNG_FN_CREATE_ANI_CHRM, "create_ani_chrm"}, - {MNG_FN_CREATE_ANI_SRGB, "create_ani_srgb"}, - {MNG_FN_CREATE_ANI_ICCP, "create_ani_iccp"}, - {MNG_FN_CREATE_ANI_PLTE, "create_ani_plte"}, - {MNG_FN_CREATE_ANI_TRNS, "create_ani_trns"}, - {MNG_FN_CREATE_ANI_BKGD, "create_ani_bkgd"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_CREATE_ANI_DHDR, "create_ani_dhdr"}, - {MNG_FN_CREATE_ANI_PROM, "create_ani_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_CREATE_ANI_IPNG, "create_ani_ipng"}, -#endif - {MNG_FN_CREATE_ANI_IJNG, "create_ani_ijng"}, - {MNG_FN_CREATE_ANI_PPLT, "create_ani_pplt"}, -#endif - {MNG_FN_CREATE_ANI_MAGN, "create_ani_magn"}, - - {MNG_FN_CREATE_ANI_IMAGE, "create_ani_image"}, - {MNG_FN_CREATE_EVENT, "create_event"}, - - {MNG_FN_FREE_ANI_LOOP, "free_ani_loop"}, - {MNG_FN_FREE_ANI_ENDL, "free_ani_endl"}, - {MNG_FN_FREE_ANI_DEFI, "free_ani_defi"}, - {MNG_FN_FREE_ANI_BASI, "free_ani_basi"}, - {MNG_FN_FREE_ANI_CLON, "free_ani_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_FREE_ANI_PAST, "free_ani_past"}, -#endif - {MNG_FN_FREE_ANI_DISC, "free_ani_disc"}, - {MNG_FN_FREE_ANI_BACK, "free_ani_back"}, - {MNG_FN_FREE_ANI_FRAM, "free_ani_fram"}, - {MNG_FN_FREE_ANI_MOVE, "free_ani_move"}, - {MNG_FN_FREE_ANI_CLIP, "free_ani_clip"}, - {MNG_FN_FREE_ANI_SHOW, "free_ani_show"}, - {MNG_FN_FREE_ANI_TERM, "free_ani_term"}, - {MNG_FN_FREE_ANI_SAVE, "free_ani_save"}, - {MNG_FN_FREE_ANI_SEEK, "free_ani_seek"}, - {MNG_FN_FREE_ANI_GAMA, "free_ani_gama"}, - {MNG_FN_FREE_ANI_CHRM, "free_ani_chrm"}, - {MNG_FN_FREE_ANI_SRGB, "free_ani_srgb"}, - {MNG_FN_FREE_ANI_ICCP, "free_ani_iccp"}, - {MNG_FN_FREE_ANI_PLTE, "free_ani_plte"}, - {MNG_FN_FREE_ANI_TRNS, "free_ani_trns"}, - {MNG_FN_FREE_ANI_BKGD, "free_ani_bkgd"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_FREE_ANI_DHDR, "free_ani_dhdr"}, - {MNG_FN_FREE_ANI_PROM, "free_ani_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_FREE_ANI_IPNG, "free_ani_ipng"}, -#endif - {MNG_FN_FREE_ANI_IJNG, "free_ani_ijng"}, - {MNG_FN_FREE_ANI_PPLT, "free_ani_pplt"}, -#endif - {MNG_FN_FREE_ANI_MAGN, "free_ani_magn"}, - - {MNG_FN_FREE_ANI_IMAGE, "free_ani_image"}, - {MNG_FN_FREE_EVENT, "free_event"}, - - {MNG_FN_PROCESS_ANI_LOOP, "process_ani_loop"}, - {MNG_FN_PROCESS_ANI_ENDL, "process_ani_endl"}, - {MNG_FN_PROCESS_ANI_DEFI, "process_ani_defi"}, - {MNG_FN_PROCESS_ANI_BASI, "process_ani_basi"}, - {MNG_FN_PROCESS_ANI_CLON, "process_ani_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PROCESS_ANI_PAST, "process_ani_past"}, -#endif - {MNG_FN_PROCESS_ANI_DISC, "process_ani_disc"}, - {MNG_FN_PROCESS_ANI_BACK, "process_ani_back"}, - {MNG_FN_PROCESS_ANI_FRAM, "process_ani_fram"}, - {MNG_FN_PROCESS_ANI_MOVE, "process_ani_move"}, - {MNG_FN_PROCESS_ANI_CLIP, "process_ani_clip"}, - {MNG_FN_PROCESS_ANI_SHOW, "process_ani_show"}, - {MNG_FN_PROCESS_ANI_TERM, "process_ani_term"}, - {MNG_FN_PROCESS_ANI_SAVE, "process_ani_save"}, - {MNG_FN_PROCESS_ANI_SEEK, "process_ani_seek"}, - {MNG_FN_PROCESS_ANI_GAMA, "process_ani_gama"}, - {MNG_FN_PROCESS_ANI_CHRM, "process_ani_chrm"}, - {MNG_FN_PROCESS_ANI_SRGB, "process_ani_srgb"}, - {MNG_FN_PROCESS_ANI_ICCP, "process_ani_iccp"}, - {MNG_FN_PROCESS_ANI_PLTE, "process_ani_plte"}, - {MNG_FN_PROCESS_ANI_TRNS, "process_ani_trns"}, - {MNG_FN_PROCESS_ANI_BKGD, "process_ani_bkgd"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PROCESS_ANI_DHDR, "process_ani_dhdr"}, - {MNG_FN_PROCESS_ANI_PROM, "process_ani_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PROCESS_ANI_IPNG, "process_ani_ipng"}, -#endif - {MNG_FN_PROCESS_ANI_IJNG, "process_ani_ijng"}, - {MNG_FN_PROCESS_ANI_PPLT, "process_ani_pplt"}, -#endif - {MNG_FN_PROCESS_ANI_MAGN, "process_ani_magn"}, - - {MNG_FN_PROCESS_ANI_IMAGE, "process_ani_image"}, - {MNG_FN_PROCESS_EVENT, "process_event"}, - - {MNG_FN_RESTORE_BACKIMAGE, "restore_backimage"}, - {MNG_FN_RESTORE_BACKCOLOR, "restore_backcolor"}, - {MNG_FN_RESTORE_BGCOLOR, "restore_bgcolor"}, - {MNG_FN_RESTORE_RGB8, "restore_rgb8"}, - {MNG_FN_RESTORE_BGR8, "restore_bgr8"}, - {MNG_FN_RESTORE_BKGD, "restore_bkgd"}, - {MNG_FN_RESTORE_BGRX8, "restore_bgrx8"}, - {MNG_FN_RESTORE_RGB565, "restore_rgb565"}, - - {MNG_FN_INIT_IHDR, "init_ihdr"}, - {MNG_FN_INIT_PLTE, "init_plte"}, - {MNG_FN_INIT_IDAT, "init_idat"}, - {MNG_FN_INIT_IEND, "init_iend"}, - {MNG_FN_INIT_TRNS, "init_trns"}, - {MNG_FN_INIT_GAMA, "init_gama"}, - {MNG_FN_INIT_CHRM, "init_chrm"}, - {MNG_FN_INIT_SRGB, "init_srgb"}, - {MNG_FN_INIT_ICCP, "init_iccp"}, - {MNG_FN_INIT_TEXT, "init_text"}, - {MNG_FN_INIT_ZTXT, "init_ztxt"}, - {MNG_FN_INIT_ITXT, "init_itxt"}, - {MNG_FN_INIT_BKGD, "init_bkgd"}, - {MNG_FN_INIT_PHYS, "init_phys"}, - {MNG_FN_INIT_SBIT, "init_sbit"}, - {MNG_FN_INIT_SPLT, "init_splt"}, - {MNG_FN_INIT_HIST, "init_hist"}, - {MNG_FN_INIT_TIME, "init_time"}, - {MNG_FN_INIT_MHDR, "init_mhdr"}, - {MNG_FN_INIT_MEND, "init_mend"}, - {MNG_FN_INIT_LOOP, "init_loop"}, - {MNG_FN_INIT_ENDL, "init_endl"}, - {MNG_FN_INIT_DEFI, "init_defi"}, - {MNG_FN_INIT_BASI, "init_basi"}, - {MNG_FN_INIT_CLON, "init_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_INIT_PAST, "init_past"}, -#endif - {MNG_FN_INIT_DISC, "init_disc"}, - {MNG_FN_INIT_BACK, "init_back"}, - {MNG_FN_INIT_FRAM, "init_fram"}, - {MNG_FN_INIT_MOVE, "init_move"}, - {MNG_FN_INIT_CLIP, "init_clip"}, - {MNG_FN_INIT_SHOW, "init_show"}, - {MNG_FN_INIT_TERM, "init_term"}, - {MNG_FN_INIT_SAVE, "init_save"}, - {MNG_FN_INIT_SEEK, "init_seek"}, - {MNG_FN_INIT_EXPI, "init_expi"}, - {MNG_FN_INIT_FPRI, "init_fpri"}, - {MNG_FN_INIT_NEED, "init_need"}, - {MNG_FN_INIT_PHYG, "init_phyg"}, -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_INIT_JHDR, "init_jhdr"}, - {MNG_FN_INIT_JDAT, "init_jdat"}, - {MNG_FN_INIT_JSEP, "init_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_INIT_DHDR, "init_dhdr"}, - {MNG_FN_INIT_PROM, "init_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_INIT_IPNG, "init_ipng"}, -#endif - {MNG_FN_INIT_PPLT, "init_pplt"}, - {MNG_FN_INIT_IJNG, "init_ijng"}, - {MNG_FN_INIT_DROP, "init_drop"}, - {MNG_FN_INIT_DBYK, "init_dbyk"}, - {MNG_FN_INIT_ORDR, "init_ordr"}, -#endif - {MNG_FN_INIT_UNKNOWN, "init_unknown"}, - {MNG_FN_INIT_MAGN, "init_magn"}, - {MNG_FN_INIT_JDAA, "init_jdaa"}, - {MNG_FN_INIT_EVNT, "init_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_INIT_MPNG, "init_mpng"}, -#endif - - {MNG_FN_ASSIGN_IHDR, "assign_ihdr"}, - {MNG_FN_ASSIGN_PLTE, "assign_plte"}, - {MNG_FN_ASSIGN_IDAT, "assign_idat"}, - {MNG_FN_ASSIGN_IEND, "assign_iend"}, - {MNG_FN_ASSIGN_TRNS, "assign_trns"}, - {MNG_FN_ASSIGN_GAMA, "assign_gama"}, - {MNG_FN_ASSIGN_CHRM, "assign_chrm"}, - {MNG_FN_ASSIGN_SRGB, "assign_srgb"}, - {MNG_FN_ASSIGN_ICCP, "assign_iccp"}, - {MNG_FN_ASSIGN_TEXT, "assign_text"}, - {MNG_FN_ASSIGN_ZTXT, "assign_ztxt"}, - {MNG_FN_ASSIGN_ITXT, "assign_itxt"}, - {MNG_FN_ASSIGN_BKGD, "assign_bkgd"}, - {MNG_FN_ASSIGN_PHYS, "assign_phys"}, - {MNG_FN_ASSIGN_SBIT, "assign_sbit"}, - {MNG_FN_ASSIGN_SPLT, "assign_splt"}, - {MNG_FN_ASSIGN_HIST, "assign_hist"}, - {MNG_FN_ASSIGN_TIME, "assign_time"}, - {MNG_FN_ASSIGN_MHDR, "assign_mhdr"}, - {MNG_FN_ASSIGN_MEND, "assign_mend"}, - {MNG_FN_ASSIGN_LOOP, "assign_loop"}, - {MNG_FN_ASSIGN_ENDL, "assign_endl"}, - {MNG_FN_ASSIGN_DEFI, "assign_defi"}, - {MNG_FN_ASSIGN_BASI, "assign_basi"}, - {MNG_FN_ASSIGN_CLON, "assign_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_ASSIGN_PAST, "assign_past"}, -#endif - {MNG_FN_ASSIGN_DISC, "assign_disc"}, - {MNG_FN_ASSIGN_BACK, "assign_back"}, - {MNG_FN_ASSIGN_FRAM, "assign_fram"}, - {MNG_FN_ASSIGN_MOVE, "assign_move"}, - {MNG_FN_ASSIGN_CLIP, "assign_clip"}, - {MNG_FN_ASSIGN_SHOW, "assign_show"}, - {MNG_FN_ASSIGN_TERM, "assign_term"}, - {MNG_FN_ASSIGN_SAVE, "assign_save"}, - {MNG_FN_ASSIGN_SEEK, "assign_seek"}, - {MNG_FN_ASSIGN_EXPI, "assign_expi"}, - {MNG_FN_ASSIGN_FPRI, "assign_fpri"}, - {MNG_FN_ASSIGN_NEED, "assign_need"}, - {MNG_FN_ASSIGN_PHYG, "assign_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_ASSIGN_JHDR, "assign_jhdr"}, - {MNG_FN_ASSIGN_JDAT, "assign_jdat"}, - {MNG_FN_ASSIGN_JSEP, "assign_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_ASSIGN_DHDR, "assign_dhdr"}, - {MNG_FN_ASSIGN_PROM, "assign_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_ASSIGN_IPNG, "assign_ipng"}, -#endif - {MNG_FN_ASSIGN_PPLT, "assign_pplt"}, - {MNG_FN_ASSIGN_IJNG, "assign_ijng"}, - {MNG_FN_ASSIGN_DROP, "assign_drop"}, - {MNG_FN_ASSIGN_DBYK, "assign_dbyk"}, - {MNG_FN_ASSIGN_ORDR, "assign_ordr"}, -#endif - {MNG_FN_ASSIGN_UNKNOWN, "assign_unknown"}, - {MNG_FN_ASSIGN_MAGN, "assign_magn"}, - {MNG_FN_ASSIGN_JDAA, "assign_jdaa"}, - {MNG_FN_ASSIGN_EVNT, "assign_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_ASSIGN_MPNG, "assign_mpng"}, -#endif - - {MNG_FN_FREE_IHDR, "free_ihdr"}, - {MNG_FN_FREE_PLTE, "free_plte"}, - {MNG_FN_FREE_IDAT, "free_idat"}, - {MNG_FN_FREE_IEND, "free_iend"}, - {MNG_FN_FREE_TRNS, "free_trns"}, - {MNG_FN_FREE_GAMA, "free_gama"}, - {MNG_FN_FREE_CHRM, "free_chrm"}, - {MNG_FN_FREE_SRGB, "free_srgb"}, - {MNG_FN_FREE_ICCP, "free_iccp"}, - {MNG_FN_FREE_TEXT, "free_text"}, - {MNG_FN_FREE_ZTXT, "free_ztxt"}, - {MNG_FN_FREE_ITXT, "free_itxt"}, - {MNG_FN_FREE_BKGD, "free_bkgd"}, - {MNG_FN_FREE_PHYS, "free_phys"}, - {MNG_FN_FREE_SBIT, "free_sbit"}, - {MNG_FN_FREE_SPLT, "free_splt"}, - {MNG_FN_FREE_HIST, "free_hist"}, - {MNG_FN_FREE_TIME, "free_time"}, - {MNG_FN_FREE_MHDR, "free_mhdr"}, - {MNG_FN_FREE_MEND, "free_mend"}, - {MNG_FN_FREE_LOOP, "free_loop"}, - {MNG_FN_FREE_ENDL, "free_endl"}, - {MNG_FN_FREE_DEFI, "free_defi"}, - {MNG_FN_FREE_BASI, "free_basi"}, - {MNG_FN_FREE_CLON, "free_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_FREE_PAST, "free_past"}, -#endif - {MNG_FN_FREE_DISC, "free_disc"}, - {MNG_FN_FREE_BACK, "free_back"}, - {MNG_FN_FREE_FRAM, "free_fram"}, - {MNG_FN_FREE_MOVE, "free_move"}, - {MNG_FN_FREE_CLIP, "free_clip"}, - {MNG_FN_FREE_SHOW, "free_show"}, - {MNG_FN_FREE_TERM, "free_term"}, - {MNG_FN_FREE_SAVE, "free_save"}, - {MNG_FN_FREE_SEEK, "free_seek"}, - {MNG_FN_FREE_EXPI, "free_expi"}, - {MNG_FN_FREE_FPRI, "free_fpri"}, - {MNG_FN_FREE_NEED, "free_need"}, - {MNG_FN_FREE_PHYG, "free_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_FREE_JHDR, "free_jhdr"}, - {MNG_FN_FREE_JDAT, "free_jdat"}, - {MNG_FN_FREE_JSEP, "free_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_FREE_DHDR, "free_dhdr"}, - {MNG_FN_FREE_PROM, "free_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_FREE_IPNG, "free_ipng"}, -#endif - {MNG_FN_FREE_PPLT, "free_pplt"}, - {MNG_FN_FREE_IJNG, "free_ijng"}, - {MNG_FN_FREE_DROP, "free_drop"}, - {MNG_FN_FREE_DBYK, "free_dbyk"}, - {MNG_FN_FREE_ORDR, "free_ordr"}, -#endif - {MNG_FN_FREE_UNKNOWN, "free_unknown"}, - {MNG_FN_FREE_MAGN, "free_magn"}, - {MNG_FN_FREE_JDAA, "free_jdaa"}, - {MNG_FN_FREE_EVNT, "free_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_FREE_MPNG, "free_mpng"}, -#endif - - {MNG_FN_READ_IHDR, "read_ihdr"}, - {MNG_FN_READ_PLTE, "read_plte"}, - {MNG_FN_READ_IDAT, "read_idat"}, - {MNG_FN_READ_IEND, "read_iend"}, - {MNG_FN_READ_TRNS, "read_trns"}, - {MNG_FN_READ_GAMA, "read_gama"}, - {MNG_FN_READ_CHRM, "read_chrm"}, - {MNG_FN_READ_SRGB, "read_srgb"}, - {MNG_FN_READ_ICCP, "read_iccp"}, - {MNG_FN_READ_TEXT, "read_text"}, - {MNG_FN_READ_ZTXT, "read_ztxt"}, - {MNG_FN_READ_ITXT, "read_itxt"}, - {MNG_FN_READ_BKGD, "read_bkgd"}, - {MNG_FN_READ_PHYS, "read_phys"}, - {MNG_FN_READ_SBIT, "read_sbit"}, - {MNG_FN_READ_SPLT, "read_splt"}, - {MNG_FN_READ_HIST, "read_hist"}, - {MNG_FN_READ_TIME, "read_time"}, - {MNG_FN_READ_MHDR, "read_mhdr"}, - {MNG_FN_READ_MEND, "read_mend"}, - {MNG_FN_READ_LOOP, "read_loop"}, - {MNG_FN_READ_ENDL, "read_endl"}, - {MNG_FN_READ_DEFI, "read_defi"}, - {MNG_FN_READ_BASI, "read_basi"}, - {MNG_FN_READ_CLON, "read_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_READ_PAST, "read_past"}, -#endif - {MNG_FN_READ_DISC, "read_disc"}, - {MNG_FN_READ_BACK, "read_back"}, - {MNG_FN_READ_FRAM, "read_fram"}, - {MNG_FN_READ_MOVE, "read_move"}, - {MNG_FN_READ_CLIP, "read_clip"}, - {MNG_FN_READ_SHOW, "read_show"}, - {MNG_FN_READ_TERM, "read_term"}, - {MNG_FN_READ_SAVE, "read_save"}, - {MNG_FN_READ_SEEK, "read_seek"}, - {MNG_FN_READ_EXPI, "read_expi"}, - {MNG_FN_READ_FPRI, "read_fpri"}, - {MNG_FN_READ_NEED, "read_need"}, - {MNG_FN_READ_PHYG, "read_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_READ_JHDR, "read_jhdr"}, - {MNG_FN_READ_JDAT, "read_jdat"}, - {MNG_FN_READ_JSEP, "read_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_READ_DHDR, "read_dhdr"}, - {MNG_FN_READ_PROM, "read_prom"}, - {MNG_FN_READ_IPNG, "read_ipng"}, - {MNG_FN_READ_PPLT, "read_pplt"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_READ_IJNG, "read_ijng"}, -#endif - {MNG_FN_READ_DROP, "read_drop"}, - {MNG_FN_READ_DBYK, "read_dbyk"}, - {MNG_FN_READ_ORDR, "read_ordr"}, -#endif - {MNG_FN_READ_UNKNOWN, "read_unknown"}, - {MNG_FN_READ_MAGN, "read_magn"}, - {MNG_FN_READ_JDAA, "read_jdaa"}, - {MNG_FN_READ_EVNT, "read_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_READ_MPNG, "read_mpng"}, -#endif - - {MNG_FN_WRITE_IHDR, "write_ihdr"}, - {MNG_FN_WRITE_PLTE, "write_plte"}, - {MNG_FN_WRITE_IDAT, "write_idat"}, - {MNG_FN_WRITE_IEND, "write_iend"}, - {MNG_FN_WRITE_TRNS, "write_trns"}, - {MNG_FN_WRITE_GAMA, "write_gama"}, - {MNG_FN_WRITE_CHRM, "write_chrm"}, - {MNG_FN_WRITE_SRGB, "write_srgb"}, - {MNG_FN_WRITE_ICCP, "write_iccp"}, - {MNG_FN_WRITE_TEXT, "write_text"}, - {MNG_FN_WRITE_ZTXT, "write_ztxt"}, - {MNG_FN_WRITE_ITXT, "write_itxt"}, - {MNG_FN_WRITE_BKGD, "write_bkgd"}, - {MNG_FN_WRITE_PHYS, "write_phys"}, - {MNG_FN_WRITE_SBIT, "write_sbit"}, - {MNG_FN_WRITE_SPLT, "write_splt"}, - {MNG_FN_WRITE_HIST, "write_hist"}, - {MNG_FN_WRITE_TIME, "write_time"}, - {MNG_FN_WRITE_MHDR, "write_mhdr"}, - {MNG_FN_WRITE_MEND, "write_mend"}, - {MNG_FN_WRITE_LOOP, "write_loop"}, - {MNG_FN_WRITE_ENDL, "write_endl"}, - {MNG_FN_WRITE_DEFI, "write_defi"}, - {MNG_FN_WRITE_BASI, "write_basi"}, - {MNG_FN_WRITE_CLON, "write_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_WRITE_PAST, "write_past"}, -#endif - {MNG_FN_WRITE_DISC, "write_disc"}, - {MNG_FN_WRITE_BACK, "write_back"}, - {MNG_FN_WRITE_FRAM, "write_fram"}, - {MNG_FN_WRITE_MOVE, "write_move"}, - {MNG_FN_WRITE_CLIP, "write_clip"}, - {MNG_FN_WRITE_SHOW, "write_show"}, - {MNG_FN_WRITE_TERM, "write_term"}, - {MNG_FN_WRITE_SAVE, "write_save"}, - {MNG_FN_WRITE_SEEK, "write_seek"}, - {MNG_FN_WRITE_EXPI, "write_expi"}, - {MNG_FN_WRITE_FPRI, "write_fpri"}, - {MNG_FN_WRITE_NEED, "write_need"}, - {MNG_FN_WRITE_PHYG, "write_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_WRITE_JHDR, "write_jhdr"}, - {MNG_FN_WRITE_JDAT, "write_jdat"}, - {MNG_FN_WRITE_JSEP, "write_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_WRITE_DHDR, "write_dhdr"}, - {MNG_FN_WRITE_PROM, "write_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_WRITE_IPNG, "write_ipng"}, -#endif - {MNG_FN_WRITE_PPLT, "write_pplt"}, - {MNG_FN_WRITE_IJNG, "write_ijng"}, - {MNG_FN_WRITE_DROP, "write_drop"}, - {MNG_FN_WRITE_DBYK, "write_dbyk"}, - {MNG_FN_WRITE_ORDR, "write_ordr"}, -#endif - {MNG_FN_WRITE_UNKNOWN, "write_unknown"}, - {MNG_FN_WRITE_MAGN, "write_magn"}, - {MNG_FN_WRITE_JDAA, "write_jdaa"}, - {MNG_FN_WRITE_EVNT, "write_evnt"}, -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - {MNG_FN_WRITE_MPNG, "write_mpng"}, -#endif - - {MNG_FN_ZLIB_INITIALIZE, "zlib_initialize"}, - {MNG_FN_ZLIB_CLEANUP, "zlib_cleanup"}, - {MNG_FN_ZLIB_INFLATEINIT, "zlib_inflateinit"}, - {MNG_FN_ZLIB_INFLATEROWS, "zlib_inflaterows"}, - {MNG_FN_ZLIB_INFLATEDATA, "zlib_inflatedata"}, - {MNG_FN_ZLIB_INFLATEFREE, "zlib_inflatefree"}, - {MNG_FN_ZLIB_DEFLATEINIT, "zlib_deflateinit"}, - {MNG_FN_ZLIB_DEFLATEROWS, "zlib_deflaterows"}, - {MNG_FN_ZLIB_DEFLATEDATA, "zlib_deflatedata"}, - {MNG_FN_ZLIB_DEFLATEFREE, "zlib_deflatefree"}, - - {MNG_FN_PROCESS_DISPLAY_IHDR, "process_display_ihdr"}, - {MNG_FN_PROCESS_DISPLAY_PLTE, "process_display_plte"}, - {MNG_FN_PROCESS_DISPLAY_IDAT, "process_display_idat"}, - {MNG_FN_PROCESS_DISPLAY_IEND, "process_display_iend"}, - {MNG_FN_PROCESS_DISPLAY_TRNS, "process_display_trns"}, - {MNG_FN_PROCESS_DISPLAY_GAMA, "process_display_gama"}, - {MNG_FN_PROCESS_DISPLAY_CHRM, "process_display_chrm"}, - {MNG_FN_PROCESS_DISPLAY_SRGB, "process_display_srgb"}, - {MNG_FN_PROCESS_DISPLAY_ICCP, "process_display_iccp"}, - {MNG_FN_PROCESS_DISPLAY_BKGD, "process_display_bkgd"}, - {MNG_FN_PROCESS_DISPLAY_PHYS, "process_display_phys"}, - {MNG_FN_PROCESS_DISPLAY_SBIT, "process_display_sbit"}, - {MNG_FN_PROCESS_DISPLAY_SPLT, "process_display_splt"}, - {MNG_FN_PROCESS_DISPLAY_HIST, "process_display_hist"}, - {MNG_FN_PROCESS_DISPLAY_MHDR, "process_display_mhdr"}, - {MNG_FN_PROCESS_DISPLAY_MEND, "process_display_mend"}, - {MNG_FN_PROCESS_DISPLAY_LOOP, "process_display_loop"}, - {MNG_FN_PROCESS_DISPLAY_ENDL, "process_display_endl"}, - {MNG_FN_PROCESS_DISPLAY_DEFI, "process_display_defi"}, - {MNG_FN_PROCESS_DISPLAY_BASI, "process_display_basi"}, - {MNG_FN_PROCESS_DISPLAY_CLON, "process_display_clon"}, -#ifndef MNG_SKIPCHUNK_PAST - {MNG_FN_PROCESS_DISPLAY_PAST, "process_display_past"}, -#endif - {MNG_FN_PROCESS_DISPLAY_DISC, "process_display_disc"}, - {MNG_FN_PROCESS_DISPLAY_BACK, "process_display_back"}, - {MNG_FN_PROCESS_DISPLAY_FRAM, "process_display_fram"}, - {MNG_FN_PROCESS_DISPLAY_MOVE, "process_display_move"}, - {MNG_FN_PROCESS_DISPLAY_CLIP, "process_display_clip"}, - {MNG_FN_PROCESS_DISPLAY_SHOW, "process_display_show"}, - {MNG_FN_PROCESS_DISPLAY_TERM, "process_display_term"}, - {MNG_FN_PROCESS_DISPLAY_SAVE, "process_display_save"}, - {MNG_FN_PROCESS_DISPLAY_SEEK, "process_display_seek"}, - {MNG_FN_PROCESS_DISPLAY_EXPI, "process_display_expi"}, - {MNG_FN_PROCESS_DISPLAY_FPRI, "process_display_fpri"}, - {MNG_FN_PROCESS_DISPLAY_NEED, "process_display_need"}, - {MNG_FN_PROCESS_DISPLAY_PHYG, "process_display_phyg"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PROCESS_DISPLAY_JHDR, "process_display_jhdr"}, - {MNG_FN_PROCESS_DISPLAY_JDAT, "process_display_jdat"}, - {MNG_FN_PROCESS_DISPLAY_JSEP, "process_display_jsep"}, -#endif -#ifndef MNG_NO_DELTA_PNG - {MNG_FN_PROCESS_DISPLAY_DHDR, "process_display_dhdr"}, - {MNG_FN_PROCESS_DISPLAY_PROM, "process_display_prom"}, -#ifdef MNG_INCLUDE_JNG - {MNG_FN_PROCESS_DISPLAY_IPNG, "process_display_ipng"}, -#endif - {MNG_FN_PROCESS_DISPLAY_PPLT, "process_display_pplt"}, - {MNG_FN_PROCESS_DISPLAY_IJNG, "process_display_ijng"}, - {MNG_FN_PROCESS_DISPLAY_DROP, "process_display_drop"}, - {MNG_FN_PROCESS_DISPLAY_DBYK, "process_display_dbyk"}, - {MNG_FN_PROCESS_DISPLAY_ORDR, "process_display_ordr"}, -#endif - {MNG_FN_PROCESS_DISPLAY_MAGN, "process_display_magn"}, - {MNG_FN_PROCESS_DISPLAY_JDAA, "process_display_jdaa"}, - - {MNG_FN_JPEG_INITIALIZE, "jpeg_initialize"}, - {MNG_FN_JPEG_CLEANUP, "jpeg_cleanup"}, - {MNG_FN_JPEG_DECOMPRESSINIT, "jpeg_decompressinit"}, - {MNG_FN_JPEG_DECOMPRESSDATA, "jpeg_decompressdata"}, - {MNG_FN_JPEG_DECOMPRESSFREE, "jpeg_decompressfree"}, - - {MNG_FN_STORE_JPEG_G8, "store_jpeg_g8"}, - {MNG_FN_STORE_JPEG_RGB8, "store_jpeg_rgb8"}, - {MNG_FN_STORE_JPEG_G12, "store_jpeg_g12"}, - {MNG_FN_STORE_JPEG_RGB12, "store_jpeg_rgb12"}, - {MNG_FN_STORE_JPEG_GA8, "store_jpeg_ga8"}, - {MNG_FN_STORE_JPEG_RGBA8, "store_jpeg_rgba8"}, - {MNG_FN_STORE_JPEG_GA12, "store_jpeg_ga12"}, - {MNG_FN_STORE_JPEG_RGBA12, "store_jpeg_rgba12"}, - {MNG_FN_STORE_JPEG_G8_ALPHA, "store_jpeg_g8_alpha"}, - {MNG_FN_STORE_JPEG_RGB8_ALPHA, "store_jpeg_rgb8_alpha"}, - - {MNG_FN_INIT_JPEG_A1_NI, "init_jpeg_a1_ni"}, - {MNG_FN_INIT_JPEG_A2_NI, "init_jpeg_a2_ni"}, - {MNG_FN_INIT_JPEG_A4_NI, "init_jpeg_a4_ni"}, - {MNG_FN_INIT_JPEG_A8_NI, "init_jpeg_a8_ni"}, - {MNG_FN_INIT_JPEG_A16_NI, "init_jpeg_a16_ni"}, - - {MNG_FN_STORE_JPEG_G8_A1, "store_jpeg_g8_a1"}, - {MNG_FN_STORE_JPEG_G8_A2, "store_jpeg_g8_a2"}, - {MNG_FN_STORE_JPEG_G8_A4, "store_jpeg_g8_a4"}, - {MNG_FN_STORE_JPEG_G8_A8, "store_jpeg_g8_a8"}, - {MNG_FN_STORE_JPEG_G8_A16, "store_jpeg_g8_a16"}, - - {MNG_FN_STORE_JPEG_RGB8_A1, "store_jpeg_rgb8_a1"}, - {MNG_FN_STORE_JPEG_RGB8_A2, "store_jpeg_rgb8_a2"}, - {MNG_FN_STORE_JPEG_RGB8_A4, "store_jpeg_rgb8_a4"}, - {MNG_FN_STORE_JPEG_RGB8_A8, "store_jpeg_rgb8_a8"}, - {MNG_FN_STORE_JPEG_RGB8_A16, "store_jpeg_rgb8_a16"}, - - {MNG_FN_STORE_JPEG_G12_A1, "store_jpeg_g12_a1"}, - {MNG_FN_STORE_JPEG_G12_A2, "store_jpeg_g12_a2"}, - {MNG_FN_STORE_JPEG_G12_A4, "store_jpeg_g12_a4"}, - {MNG_FN_STORE_JPEG_G12_A8, "store_jpeg_g12_a8"}, - {MNG_FN_STORE_JPEG_G12_A16, "store_jpeg_g12_a16"}, - - {MNG_FN_STORE_JPEG_RGB12_A1, "store_jpeg_rgb12_a1"}, - {MNG_FN_STORE_JPEG_RGB12_A2, "store_jpeg_rgb12_a2"}, - {MNG_FN_STORE_JPEG_RGB12_A4, "store_jpeg_rgb12_a4"}, - {MNG_FN_STORE_JPEG_RGB12_A8, "store_jpeg_rgb12_a8"}, - {MNG_FN_STORE_JPEG_RGB12_A16, "store_jpeg_rgb12_a16"}, - - {MNG_FN_NEXT_JPEG_ALPHAROW, "next_jpeg_alpharow"}, - {MNG_FN_NEXT_JPEG_ROW, "next_jpeg_row"}, - {MNG_FN_DISPLAY_JPEG_ROWS, "display_jpeg_rows"}, - - {MNG_FN_MAGNIFY_G8_X1, "magnify_g8_x1"}, - {MNG_FN_MAGNIFY_G8_X2, "magnify_g8_x2"}, - {MNG_FN_MAGNIFY_RGB8_X1, "magnify_rgb8_x1"}, - {MNG_FN_MAGNIFY_RGB8_X2, "magnify_rgb8_x2"}, - {MNG_FN_MAGNIFY_GA8_X1, "magnify_ga8_x1"}, - {MNG_FN_MAGNIFY_GA8_X2, "magnify_ga8_x2"}, - {MNG_FN_MAGNIFY_GA8_X3, "magnify_ga8_x3"}, - {MNG_FN_MAGNIFY_GA8_X4, "magnify_ga8_x4"}, - {MNG_FN_MAGNIFY_RGBA8_X1, "magnify_rgba8_x1"}, - {MNG_FN_MAGNIFY_RGBA8_X2, "magnify_rgba8_x2"}, - {MNG_FN_MAGNIFY_RGBA8_X3, "magnify_rgba8_x3"}, - {MNG_FN_MAGNIFY_RGBA8_X4, "magnify_rgba8_x4"}, - {MNG_FN_MAGNIFY_G8_X3, "magnify_g8_x3"}, - {MNG_FN_MAGNIFY_RGB8_X3, "magnify_rgb8_x3"}, - {MNG_FN_MAGNIFY_GA8_X5, "magnify_ga8_x5"}, - {MNG_FN_MAGNIFY_RGBA8_X5, "magnify_rgba8_x5"}, - - {MNG_FN_MAGNIFY_G8_Y1, "magnify_g8_y1"}, - {MNG_FN_MAGNIFY_G8_Y2, "magnify_g8_y2"}, - {MNG_FN_MAGNIFY_RGB8_Y1, "magnify_rgb8_y1"}, - {MNG_FN_MAGNIFY_RGB8_Y2, "magnify_rgb8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y1, "magnify_ga8_y1"}, - {MNG_FN_MAGNIFY_GA8_Y2, "magnify_ga8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y3, "magnify_ga8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y4, "magnify_ga8_y4"}, - {MNG_FN_MAGNIFY_RGBA8_Y1, "magnify_rgba8_y1"}, - {MNG_FN_MAGNIFY_RGBA8_Y2, "magnify_rgba8_y2"}, - {MNG_FN_MAGNIFY_RGBA8_Y3, "magnify_rgba8_y3"}, - {MNG_FN_MAGNIFY_RGBA8_Y4, "magnify_rgba8_y4"}, - {MNG_FN_MAGNIFY_G8_Y3, "magnify_g8_y3"}, - {MNG_FN_MAGNIFY_RGB8_Y3, "magnify_rgb8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y5, "magnify_ga8_y5"}, - {MNG_FN_MAGNIFY_RGBA8_Y5, "magnify_rgba8_y5"}, - - {MNG_FN_MAGNIFY_G8_X1, "magnify_g8_x1"}, - {MNG_FN_MAGNIFY_G8_X2, "magnify_g8_x2"}, - {MNG_FN_MAGNIFY_RGB8_X1, "magnify_rgb8_x1"}, - {MNG_FN_MAGNIFY_RGB8_X2, "magnify_rgb8_x2"}, - {MNG_FN_MAGNIFY_GA8_X1, "magnify_ga8_x1"}, - {MNG_FN_MAGNIFY_GA8_X2, "magnify_ga8_x2"}, - {MNG_FN_MAGNIFY_GA8_X3, "magnify_ga8_x3"}, - {MNG_FN_MAGNIFY_GA8_X4, "magnify_ga8_x4"}, - {MNG_FN_MAGNIFY_RGBA8_X1, "magnify_rgba8_x1"}, - {MNG_FN_MAGNIFY_RGBA8_X2, "magnify_rgba8_x2"}, - {MNG_FN_MAGNIFY_RGBA8_X3, "magnify_rgba8_x3"}, - {MNG_FN_MAGNIFY_RGBA8_X4, "magnify_rgba8_x4"}, - {MNG_FN_MAGNIFY_G8_X3, "magnify_g8_x3"}, - {MNG_FN_MAGNIFY_RGB8_X3, "magnify_rgb8_x3"}, - {MNG_FN_MAGNIFY_GA8_X5, "magnify_ga8_x5"}, - {MNG_FN_MAGNIFY_RGBA8_X5, "magnify_rgba8_x5"}, - - {MNG_FN_MAGNIFY_G8_Y1, "magnify_g8_y1"}, - {MNG_FN_MAGNIFY_G8_Y2, "magnify_g8_y2"}, - {MNG_FN_MAGNIFY_RGB8_Y1, "magnify_rgb8_y1"}, - {MNG_FN_MAGNIFY_RGB8_Y2, "magnify_rgb8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y1, "magnify_ga8_y1"}, - {MNG_FN_MAGNIFY_GA8_Y2, "magnify_ga8_y2"}, - {MNG_FN_MAGNIFY_GA8_Y3, "magnify_ga8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y4, "magnify_ga8_y4"}, - {MNG_FN_MAGNIFY_RGBA8_Y1, "magnify_rgba8_y1"}, - {MNG_FN_MAGNIFY_RGBA8_Y2, "magnify_rgba8_y2"}, - {MNG_FN_MAGNIFY_RGBA8_Y3, "magnify_rgba8_y3"}, - {MNG_FN_MAGNIFY_RGBA8_Y4, "magnify_rgba8_y4"}, - {MNG_FN_MAGNIFY_G8_Y3, "magnify_g8_y3"}, - {MNG_FN_MAGNIFY_RGB8_Y3, "magnify_rgb8_y3"}, - {MNG_FN_MAGNIFY_GA8_Y5, "magnify_ga8_y5"}, - {MNG_FN_MAGNIFY_RGBA8_Y5, "magnify_rgba8_y5"}, - - {MNG_FN_DELTA_G1_G1, "delta_g1_g1"}, - {MNG_FN_DELTA_G2_G2, "delta_g2_g2"}, - {MNG_FN_DELTA_G4_G4, "delta_g4_g4"}, - {MNG_FN_DELTA_G8_G8, "delta_g8_g8"}, - {MNG_FN_DELTA_G16_G16, "delta_g16_g16"}, - {MNG_FN_DELTA_RGB8_RGB8, "delta_rgb8_rgb8"}, - {MNG_FN_DELTA_RGB16_RGB16, "delta_rgb16_rgb16"}, - {MNG_FN_DELTA_GA8_GA8, "delta_ga8_ga8"}, - {MNG_FN_DELTA_GA8_G8, "delta_ga8_g8"}, - {MNG_FN_DELTA_GA8_A8, "delta_ga8_a8"}, - {MNG_FN_DELTA_GA16_GA16, "delta_ga16_ga16"}, - {MNG_FN_DELTA_GA16_G16, "delta_ga16_g16"}, - {MNG_FN_DELTA_GA16_A16, "delta_ga16_a16"}, - {MNG_FN_DELTA_RGBA8_RGBA8, "delta_rgba8_rgba8"}, - {MNG_FN_DELTA_RGBA8_RGB8, "delta_rgba8_rgb8"}, - {MNG_FN_DELTA_RGBA8_A8, "delta_rgba8_a8"}, - {MNG_FN_DELTA_RGBA16_RGBA16, "delta_rgba16_rgba16"}, - {MNG_FN_DELTA_RGBA16_RGB16, "delta_rgba16_rgb16"}, - {MNG_FN_DELTA_RGBA16_A16, "delta_rgba16_a16"}, - - {MNG_FN_PROMOTE_G8_G8, "promote_g8_g8"}, - {MNG_FN_PROMOTE_G8_G16, "promote_g8_g16"}, - {MNG_FN_PROMOTE_G16_G16, "promote_g8_g16"}, - {MNG_FN_PROMOTE_G8_GA8, "promote_g8_ga8"}, - {MNG_FN_PROMOTE_G8_GA16, "promote_g8_ga16"}, - {MNG_FN_PROMOTE_G16_GA16, "promote_g16_ga16"}, - {MNG_FN_PROMOTE_G8_RGB8, "promote_g8_rgb8"}, - {MNG_FN_PROMOTE_G8_RGB16, "promote_g8_rgb16"}, - {MNG_FN_PROMOTE_G16_RGB16, "promote_g16_rgb16"}, - {MNG_FN_PROMOTE_G8_RGBA8, "promote_g8_rgba8"}, - {MNG_FN_PROMOTE_G8_RGBA16, "promote_g8_rgba16"}, - {MNG_FN_PROMOTE_G16_RGBA16, "promote_g16_rgba16"}, - {MNG_FN_PROMOTE_GA8_GA16, "promote_ga8_ga16"}, - {MNG_FN_PROMOTE_GA8_RGBA8, "promote_ga8_rgba8"}, - {MNG_FN_PROMOTE_GA8_RGBA16, "promote_ga8_rgba16"}, - {MNG_FN_PROMOTE_GA16_RGBA16, "promote_ga16_rgba16"}, - {MNG_FN_PROMOTE_RGB8_RGB16, "promote_rgb8_rgb16"}, - {MNG_FN_PROMOTE_RGB8_RGBA8, "promote_rgb8_rgba8"}, - {MNG_FN_PROMOTE_RGB8_RGBA16, "promote_rgb8_rgba16"}, - {MNG_FN_PROMOTE_RGB16_RGBA16, "promote_rgb16_rgba16"}, - {MNG_FN_PROMOTE_RGBA8_RGBA16, "promote_rgba8_rgba16"}, - {MNG_FN_PROMOTE_IDX8_RGB8, "promote_idx8_rgb8"}, - {MNG_FN_PROMOTE_IDX8_RGB16, "promote_idx8_rgb16"}, - {MNG_FN_PROMOTE_IDX8_RGBA8, "promote_idx8_rgba8"}, - {MNG_FN_PROMOTE_IDX8_RGBA16, "promote_idx8_rgba16"}, - - {MNG_FN_SCALE_G1_G2, "scale_g1_g2"}, - {MNG_FN_SCALE_G1_G4, "scale_g1_g4"}, - {MNG_FN_SCALE_G1_G8, "scale_g1_g8"}, - {MNG_FN_SCALE_G1_G16, "scale_g1_g16"}, - {MNG_FN_SCALE_G2_G4, "scale_g2_g4"}, - {MNG_FN_SCALE_G2_G8, "scale_g2_g8"}, - {MNG_FN_SCALE_G2_G16, "scale_g2_g16"}, - {MNG_FN_SCALE_G4_G8, "scale_g4_g8"}, - {MNG_FN_SCALE_G4_G16, "scale_g4_g16"}, - {MNG_FN_SCALE_G8_G16, "scale_g8_g16"}, - {MNG_FN_SCALE_GA8_GA16, "scale_ga8_ga16"}, - {MNG_FN_SCALE_RGB8_RGB16, "scale_rgb8_rgb16"}, - {MNG_FN_SCALE_RGBA8_RGBA16, "scale_rgba8_rgba16"}, - - {MNG_FN_SCALE_G2_G1, "scale_g2_g1"}, - {MNG_FN_SCALE_G4_G1, "scale_g4_g1"}, - {MNG_FN_SCALE_G8_G1, "scale_g8_g1"}, - {MNG_FN_SCALE_G16_G1, "scale_g16_g1"}, - {MNG_FN_SCALE_G4_G2, "scale_g4_g2"}, - {MNG_FN_SCALE_G8_G2, "scale_g8_g2"}, - {MNG_FN_SCALE_G16_G2, "scale_g16_g2"}, - {MNG_FN_SCALE_G8_G4, "scale_g8_g4"}, - {MNG_FN_SCALE_G16_G4, "scale_g16_g4"}, - {MNG_FN_SCALE_G16_G8, "scale_g16_g8"}, - {MNG_FN_SCALE_GA16_GA8, "scale_ga16_ga8"}, - {MNG_FN_SCALE_RGB16_RGB8, "scale_rgb16_rgb8"}, - {MNG_FN_SCALE_RGBA16_RGBA8, "scale_rgba16_rgba8"}, - - {MNG_FN_COMPOSEOVER_RGBA8, "composeover_rgba8"}, - {MNG_FN_COMPOSEOVER_RGBA16, "composeover_rgba16"}, - {MNG_FN_COMPOSEUNDER_RGBA8, "composeunder_rgba8"}, - {MNG_FN_COMPOSEUNDER_RGBA16, "composeunder_rgba16"}, - - {MNG_FN_FLIP_RGBA8, "flip_rgba8"}, - {MNG_FN_FLIP_RGBA16, "flip_rgba16"}, - {MNG_FN_TILE_RGBA8, "tile_rgba8"}, - {MNG_FN_TILE_RGBA16, "tile_rgba16"} - - }; -#endif /* MNG_INCLUDE_TRACE_STINGS */ - -/* ************************************************************************** */ - -mng_retcode mng_trace (mng_datap pData, - mng_uint32 iFunction, - mng_uint32 iLocation) -{ - mng_pchar zName = 0; /* bufferptr for tracestring */ - - if ((pData == 0) || (pData->iMagic != MNG_MAGIC)) - return MNG_INVALIDHANDLE; /* no good if the handle is corrupt */ - - if (pData->fTraceproc) /* report back to user ? */ - { -#ifdef MNG_INCLUDE_TRACE_STRINGS - { /* binary search variables */ - mng_int32 iTop, iLower, iUpper, iMiddle; - mng_trace_entryp pEntry; /* pointer to found entry */ - /* determine max index of table */ - iTop = (sizeof (trace_table) / sizeof (trace_table [0])) - 1; - - iLower = 0; /* initialize binary search */ - iMiddle = iTop >> 1; /* start in the middle */ - iUpper = iTop; - pEntry = 0; /* no goods yet! */ - - do /* the binary search itself */ - { - if (trace_table [iMiddle].iFunction < iFunction) - iLower = iMiddle + 1; - else if (trace_table [iMiddle].iFunction > iFunction) - iUpper = iMiddle - 1; - else - { - pEntry = &trace_table [iMiddle]; - break; - }; - - iMiddle = (iLower + iUpper) >> 1; - } - while (iLower <= iUpper); - - if (pEntry) /* found it ? */ - zName = pEntry->zTracetext; - - } -#endif - /* oke, now tell */ - if (!pData->fTraceproc (((mng_handle)pData), iFunction, iLocation, zName)) - return MNG_APPTRACEABORT; - - } - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_TRACE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_trace.h b/Engine/lib/lmng/libmng_trace.h deleted file mode 100644 index 0c749d978..000000000 --- a/Engine/lib/lmng/libmng_trace.h +++ /dev/null @@ -1,1474 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_trace.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : Trace functions (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the trace functions * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - added chunk-access function trace-codes * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/13/2000 - G.Juyn * */ -/* * - added save_state & restore_state trace-codes * */ -/* * 0.5.1 - 05/15/2000 - G.Juyn * */ -/* * - added getimgdata & putimgdata trace-codes * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - added JNG tracecodes * */ -/* * 0.5.2 - 05/23/2000 - G.Juyn * */ -/* * - added trace-table entry definition * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added tracecodes for global animation color-chunks * */ -/* * - added tracecodes for get/set of default ZLIB/IJG parms * */ -/* * - added tracecodes for global PLTE,tRNS,bKGD * */ -/* * 0.5.2 - 05/30/2000 - G.Juyn * */ -/* * - added tracecodes for image-object promotion * */ -/* * - added tracecodes for delta-image processing * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - added tracecodes for getalphaline callback * */ -/* * 0.5.2 - 06/05/2000 - G.Juyn * */ -/* * - added tracecode for RGB8_A8 canvasstyle * */ -/* * 0.5.2 - 06/06/2000 - G.Juyn * */ -/* * - added tracecode for mng_read_resume HLAPI function * */ -/* * * */ -/* * 0.5.3 - 06/06/2000 - G.Juyn * */ -/* * - added tracecodes for tracing JPEG progression * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added tracecodes for get/set speedtype * */ -/* * - added tracecodes for get imagelevel * */ -/* * 0.5.3 - 06/22/2000 - G.Juyn * */ -/* * - added tracecode for delta-image processing * */ -/* * - added tracecodes for PPLT chunk processing * */ -/* * * */ -/* * 0.9.1 - 07/07/2000 - G.Juyn * */ -/* * - added tracecodes for special display processing * */ -/* * 0.9.1 - 07/08/2000 - G.Juyn * */ -/* * - added tracecode for get/set suspensionmode * */ -/* * - added tracecodes for get/set display variables * */ -/* * - added tracecode for read_databuffer (I/O-suspension) * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added tracecodes for SAVE/SEEK callbacks * */ -/* * - added tracecodes for get/set sectionbreaks * */ -/* * - added tracecode for special error routine * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - added tracecode for updatemngheader * */ -/* * * */ -/* * 0.9.2 - 07/31/2000 - G.Juyn * */ -/* * - added tracecodes for status_xxxxx functions * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * - added tracecode for updatemngsimplicity * */ -/* * * */ -/* * 0.9.3 - 08/26/2000 - G.Juyn * */ -/* * - added MAGN chunk * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * 0.9.3 - 10/10/2000 - G.Juyn * */ -/* * - added support for alpha-depth prediction * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added JDAA chunk * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/16/2000 - G.Juyn * */ -/* * - added functions to retrieve PNG/JNG specific header-info * */ -/* * - added optional support for bKGD for PNG images * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * - added routine to discard "invalid" objects * */ -/* * 0.9.3 - 10/19/2000 - G.Juyn * */ -/* * - implemented delayed delta-processing * */ -/* * 0.9.3 - 10/20/2000 - G.Juyn * */ -/* * - added get/set for bKGD preference setting * */ -/* * 0.9.3 - 10/21/2000 - G.Juyn * */ -/* * - added get function for interlace/progressive display * */ -/* * * */ -/* * 0.9.4 - 1/18/2001 - G.Juyn * */ -/* * - added "new" MAGN methods 3, 4 & 5 * */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * 1.0.1 - 04/21/2001 - G.Juyn (code by G.Kelly) * */ -/* * - added BGRA8 canvas with premultiplied alpha * */ -/* * 1.0.1 - 05/02/2001 - G.Juyn * */ -/* * - added "default" sRGB generation (Thanks Marti!) * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added optimization option for MNG-video playback * */ -/* * - added processterm callback * */ -/* * 1.0.2 - 06/25/2001 - G.Juyn * */ -/* * - added option to turn off progressive refresh * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - added get function for last processed BACK chunk * */ -/* * * */ -/* * 1.0.5 - 08/15/2002 - G.Juyn * */ -/* * - completed PROM support * */ -/* * - completed delta-image support * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * - added HLAPI function to copy chunks * */ -/* * 1.0.5 - 09/14/2002 - G.Juyn * */ -/* * - added event handling for dynamic MNG * */ -/* * 1.0.5 - 09/20/2002 - G.Juyn * */ -/* * - added support for PAST * */ -/* * 1.0.5 - 09/22/2002 - G.Juyn * */ -/* * - added bgrx8 canvas (filler byte) * */ -/* * 1.0.5 - 09/23/2002 - G.Juyn * */ -/* * - added in-memory color-correction of abstract images * */ -/* * - added compose over/under routines for PAST processing * */ -/* * - added flip & tile routines for PAST processing * */ -/* * 1.0.5 - 10/09/2002 - G.Juyn * */ -/* * - fixed trace-constants for PAST chunk * */ -/* * 1.0.5 - 11/07/2002 - G.Juyn * */ -/* * - added support to get totals after mng_read() * */ -/* * * */ -/* * 1.0.6 - 07/14/2003 - G.Randers-Pehrson * */ -/* * - added conditionals around rarely used features * */ -/* * * */ -/* * 1.0.7 - 11/27/2003 - R.A * */ -/* * - added CANVAS_RGB565 and CANVAS_BGR565 * */ -/* * 1.0.7 - 01/25/2004 - J.S * */ -/* * - added premultiplied alpha canvas' for RGBA, ARGB, ABGR * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/02/2004 - G.Juyn * */ -/* * - added CRC existence & checking flags * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * * */ -/* * 1.0.9 - 10/03/2004 - G.Juyn * */ -/* * - added function to retrieve current FRAM delay * */ -/* * 1.0.9 - 10/14/2004 - G.Juyn * */ -/* * - added bgr565_a8 canvas-style (thanks to J. Elvander) * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 07/06/2007 - G.R-P bugfix by Lucas Quintana * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_trace_h_ -#define _libmng_trace_h_ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_TRACE_PROCS - -/* ************************************************************************** */ - -/* TODO: add a trace-mask so certain functions can be excluded */ - -mng_retcode mng_trace (mng_datap pData, - mng_uint32 iFunction, - mng_uint32 iLocation); - -/* ************************************************************************** */ - -#define MNG_TRACE(D,F,L) { mng_retcode iR = mng_trace (D,F,L); \ - if (iR) return iR; } - -#define MNG_TRACEB(D,F,L) { if (mng_trace (D,F,L)) return MNG_FALSE; } - -#define MNG_TRACEX(D,F,L) { if (mng_trace (D,F,L)) return 0; } - -/* ************************************************************************** */ - -#define MNG_LC_START 1 -#define MNG_LC_END 2 -#define MNG_LC_INITIALIZE 3 -#define MNG_LC_CLEANUP 4 - -/* ************************************************************************** */ - -#define MNG_LC_JPEG_CREATE_DECOMPRESS 101 -#define MNG_LC_JPEG_READ_HEADER 102 -#define MNG_LC_JPEG_START_DECOMPRESS 103 -#define MNG_LC_JPEG_START_OUTPUT 104 -#define MNG_LC_JPEG_READ_SCANLINES 105 -#define MNG_LC_JPEG_FINISH_OUTPUT 106 -#define MNG_LC_JPEG_FINISH_DECOMPRESS 107 -#define MNG_LC_JPEG_DESTROY_DECOMPRESS 108 - -/* ************************************************************************** */ - -#define MNG_FN_INITIALIZE 1 -#define MNG_FN_RESET 2 -#define MNG_FN_CLEANUP 3 -#define MNG_FN_READ 4 -#define MNG_FN_WRITE 5 -#define MNG_FN_CREATE 6 -#define MNG_FN_READDISPLAY 7 -#define MNG_FN_DISPLAY 8 -#define MNG_FN_DISPLAY_RESUME 9 -#define MNG_FN_DISPLAY_FREEZE 10 -#define MNG_FN_DISPLAY_RESET 11 -#ifndef MNG_NO_DISPLAY_GO_SUPPORTED -#define MNG_FN_DISPLAY_GOFRAME 12 -#define MNG_FN_DISPLAY_GOLAYER 13 -#define MNG_FN_DISPLAY_GOTIME 14 -#endif -#define MNG_FN_GETLASTERROR 15 -#define MNG_FN_READ_RESUME 16 -#define MNG_FN_TRAPEVENT 17 -#define MNG_FN_READ_PUSHDATA 18 -#define MNG_FN_READ_PUSHSIG 19 -#define MNG_FN_READ_PUSHCHUNK 20 - -#define MNG_FN_SETCB_MEMALLOC 101 -#define MNG_FN_SETCB_MEMFREE 102 -#define MNG_FN_SETCB_READDATA 103 -#define MNG_FN_SETCB_WRITEDATA 104 -#define MNG_FN_SETCB_ERRORPROC 105 -#define MNG_FN_SETCB_TRACEPROC 106 -#define MNG_FN_SETCB_PROCESSHEADER 107 -#define MNG_FN_SETCB_PROCESSTEXT 108 -#define MNG_FN_SETCB_GETCANVASLINE 109 -#define MNG_FN_SETCB_GETBKGDLINE 110 -#define MNG_FN_SETCB_REFRESH 111 -#define MNG_FN_SETCB_GETTICKCOUNT 112 -#define MNG_FN_SETCB_SETTIMER 113 -#define MNG_FN_SETCB_PROCESSGAMMA 114 -#define MNG_FN_SETCB_PROCESSCHROMA 115 -#define MNG_FN_SETCB_PROCESSSRGB 116 -#define MNG_FN_SETCB_PROCESSICCP 117 -#define MNG_FN_SETCB_PROCESSAROW 118 -#ifndef MNG_NO_OPEN_CLOSE_STREAM -#define MNG_FN_SETCB_OPENSTREAM 119 -#define MNG_FN_SETCB_CLOSESTREAM 120 -#endif -#define MNG_FN_SETCB_GETALPHALINE 121 -#define MNG_FN_SETCB_PROCESSSAVE 122 -#define MNG_FN_SETCB_PROCESSSEEK 123 -#define MNG_FN_SETCB_PROCESSNEED 124 -#define MNG_FN_SETCB_PROCESSUNKNOWN 125 -#define MNG_FN_SETCB_PROCESSMEND 126 -#define MNG_FN_SETCB_PROCESSTERM 127 -#define MNG_FN_SETCB_RELEASEDATA 128 - -#define MNG_FN_GETCB_MEMALLOC 201 -#define MNG_FN_GETCB_MEMFREE 202 -#define MNG_FN_GETCB_READDATA 203 -#define MNG_FN_GETCB_WRITEDATA 204 -#define MNG_FN_GETCB_ERRORPROC 205 -#define MNG_FN_GETCB_TRACEPROC 206 -#define MNG_FN_GETCB_PROCESSHEADER 207 -#define MNG_FN_GETCB_PROCESSTEXT 208 -#define MNG_FN_GETCB_GETCANVASLINE 209 -#define MNG_FN_GETCB_GETBKGDLINE 210 -#define MNG_FN_GETCB_REFRESH 211 -#define MNG_FN_GETCB_GETTICKCOUNT 212 -#define MNG_FN_GETCB_SETTIMER 213 -#define MNG_FN_GETCB_PROCESSGAMMA 214 -#define MNG_FN_GETCB_PROCESSCHROMA 215 -#define MNG_FN_GETCB_PROCESSSRGB 216 -#define MNG_FN_GETCB_PROCESSICCP 217 -#define MNG_FN_GETCB_PROCESSAROW 218 -#ifndef MNG_NO_OPEN_CLOSE_STREAM -#define MNG_FN_GETCB_OPENSTREAM 219 -#define MNG_FN_GETCB_CLOSESTREAM 220 -#endif -#define MNG_FN_GETCB_GETALPHALINE 221 -#define MNG_FN_GETCB_PROCESSSAVE 222 -#define MNG_FN_GETCB_PROCESSSEEK 223 -#define MNG_FN_GETCB_PROCESSNEED 224 -#define MNG_FN_GETCB_PROCESSUNKNOWN 225 -#define MNG_FN_GETCB_PROCESSMEND 226 -#define MNG_FN_GETCB_PROCESSTERM 227 -#define MNG_FN_GETCB_RELEASEDATA 228 - -#define MNG_FN_SET_USERDATA 301 -#define MNG_FN_SET_CANVASSTYLE 302 -#define MNG_FN_SET_BKGDSTYLE 303 -#define MNG_FN_SET_BGCOLOR 304 -#define MNG_FN_SET_STORECHUNKS 305 -#define MNG_FN_SET_VIEWGAMMA 306 -#define MNG_FN_SET_DISPLAYGAMMA 307 -#define MNG_FN_SET_DFLTIMGGAMMA 308 -#define MNG_FN_SET_SRGB 309 -#define MNG_FN_SET_OUTPUTPROFILE 310 -#define MNG_FN_SET_SRGBPROFILE 311 -#define MNG_FN_SET_MAXCANVASWIDTH 312 -#define MNG_FN_SET_MAXCANVASHEIGHT 313 -#define MNG_FN_SET_MAXCANVASSIZE 314 -#define MNG_FN_SET_ZLIB_LEVEL 315 -#define MNG_FN_SET_ZLIB_METHOD 316 -#define MNG_FN_SET_ZLIB_WINDOWBITS 317 -#define MNG_FN_SET_ZLIB_MEMLEVEL 318 -#define MNG_FN_SET_ZLIB_STRATEGY 319 -#define MNG_FN_SET_ZLIB_MAXIDAT 320 -#define MNG_FN_SET_JPEG_DCTMETHOD 321 -#define MNG_FN_SET_JPEG_QUALITY 322 -#define MNG_FN_SET_JPEG_SMOOTHING 323 -#define MNG_FN_SET_JPEG_PROGRESSIVE 324 -#define MNG_FN_SET_JPEG_OPTIMIZED 325 -#define MNG_FN_SET_JPEG_MAXJDAT 326 -#define MNG_FN_SET_SPEED 327 -#define MNG_FN_SET_SUSPENSIONMODE 328 -#define MNG_FN_SET_SECTIONBREAKS 329 -#define MNG_FN_SET_USEBKGD 330 -#define MNG_FN_SET_OUTPUTPROFILE2 331 -#define MNG_FN_SET_SRGBPROFILE2 332 -#define MNG_FN_SET_OUTPUTSRGB 333 -#define MNG_FN_SET_SRGBIMPLICIT 334 -#define MNG_FN_SET_CACHEPLAYBACK 335 -#define MNG_FN_SET_DOPROGRESSIVE 336 -#define MNG_FN_SET_CRCMODE 337 - -#define MNG_FN_GET_USERDATA 401 -#define MNG_FN_GET_SIGTYPE 402 -#define MNG_FN_GET_IMAGETYPE 403 -#define MNG_FN_GET_IMAGEWIDTH 404 -#define MNG_FN_GET_IMAGEHEIGHT 405 -#define MNG_FN_GET_TICKS 406 -#define MNG_FN_GET_FRAMECOUNT 407 -#define MNG_FN_GET_LAYERCOUNT 408 -#define MNG_FN_GET_PLAYTIME 409 -#define MNG_FN_GET_SIMPLICITY 410 -#define MNG_FN_GET_CANVASSTYLE 411 -#define MNG_FN_GET_BKGDSTYLE 412 -#define MNG_FN_GET_BGCOLOR 413 -#define MNG_FN_GET_STORECHUNKS 414 -#define MNG_FN_GET_VIEWGAMMA 415 -#define MNG_FN_GET_DISPLAYGAMMA 416 -#define MNG_FN_GET_DFLTIMGGAMMA 417 -#define MNG_FN_GET_SRGB 418 -#define MNG_FN_GET_MAXCANVASWIDTH 419 -#define MNG_FN_GET_MAXCANVASHEIGHT 420 -#define MNG_FN_GET_ZLIB_LEVEL 421 -#define MNG_FN_GET_ZLIB_METHOD 422 -#define MNG_FN_GET_ZLIB_WINDOWBITS 423 -#define MNG_FN_GET_ZLIB_MEMLEVEL 424 -#define MNG_FN_GET_ZLIB_STRATEGY 425 -#define MNG_FN_GET_ZLIB_MAXIDAT 426 -#define MNG_FN_GET_JPEG_DCTMETHOD 427 -#define MNG_FN_GET_JPEG_QUALITY 428 -#define MNG_FN_GET_JPEG_SMOOTHING 429 -#define MNG_FN_GET_JPEG_PROGRESSIVE 430 -#define MNG_FN_GET_JPEG_OPTIMIZED 431 -#define MNG_FN_GET_JPEG_MAXJDAT 432 -#define MNG_FN_GET_SPEED 433 -#define MNG_FN_GET_IMAGELEVEL 434 -#define MNG_FN_GET_SUSPENSIONMODE 435 -#define MNG_FN_GET_STARTTIME 436 -#define MNG_FN_GET_RUNTIME 437 -#define MNG_FN_GET_CURRENTFRAME 438 -#define MNG_FN_GET_CURRENTLAYER 439 -#define MNG_FN_GET_CURRENTPLAYTIME 440 -#define MNG_FN_GET_SECTIONBREAKS 441 -#define MNG_FN_GET_ALPHADEPTH 442 -#define MNG_FN_GET_BITDEPTH 443 -#define MNG_FN_GET_COLORTYPE 444 -#define MNG_FN_GET_COMPRESSION 445 -#define MNG_FN_GET_FILTER 446 -#define MNG_FN_GET_INTERLACE 447 -#define MNG_FN_GET_ALPHABITDEPTH 448 -#define MNG_FN_GET_ALPHACOMPRESSION 449 -#define MNG_FN_GET_ALPHAFILTER 450 -#define MNG_FN_GET_ALPHAINTERLACE 451 -#define MNG_FN_GET_USEBKGD 452 -#define MNG_FN_GET_REFRESHPASS 453 -#define MNG_FN_GET_CACHEPLAYBACK 454 -#define MNG_FN_GET_DOPROGRESSIVE 455 -#define MNG_FN_GET_LASTBACKCHUNK 456 -#define MNG_FN_GET_LASTSEEKNAME 457 -#define MNG_FN_GET_TOTALFRAMES 458 -#define MNG_FN_GET_TOTALLAYERS 459 -#define MNG_FN_GET_TOTALPLAYTIME 460 -#define MNG_FN_GET_CRCMODE 461 -#define MNG_FN_GET_CURRFRAMDELAY 462 - -#define MNG_FN_STATUS_ERROR 481 -#define MNG_FN_STATUS_READING 482 -#define MNG_FN_STATUS_SUSPENDBREAK 483 -#define MNG_FN_STATUS_CREATING 484 -#define MNG_FN_STATUS_WRITING 485 -#define MNG_FN_STATUS_DISPLAYING 486 -#define MNG_FN_STATUS_RUNNING 487 -#define MNG_FN_STATUS_TIMERBREAK 488 -#define MNG_FN_STATUS_DYNAMIC 489 -#define MNG_FN_STATUS_RUNNINGEVENT 490 - -/* ************************************************************************** */ - -#define MNG_FN_ITERATE_CHUNKS 601 -#define MNG_FN_COPY_CHUNK 602 - -#define MNG_FN_GETCHUNK_IHDR 701 -#define MNG_FN_GETCHUNK_PLTE 702 -#define MNG_FN_GETCHUNK_IDAT 703 -#define MNG_FN_GETCHUNK_IEND 704 -#define MNG_FN_GETCHUNK_TRNS 705 -#define MNG_FN_GETCHUNK_GAMA 706 -#define MNG_FN_GETCHUNK_CHRM 707 -#define MNG_FN_GETCHUNK_SRGB 708 -#define MNG_FN_GETCHUNK_ICCP 709 -#define MNG_FN_GETCHUNK_TEXT 710 -#define MNG_FN_GETCHUNK_ZTXT 711 -#define MNG_FN_GETCHUNK_ITXT 712 -#define MNG_FN_GETCHUNK_BKGD 713 -#define MNG_FN_GETCHUNK_PHYS 714 -#define MNG_FN_GETCHUNK_SBIT 715 -#define MNG_FN_GETCHUNK_SPLT 716 -#define MNG_FN_GETCHUNK_HIST 717 -#define MNG_FN_GETCHUNK_TIME 718 -#define MNG_FN_GETCHUNK_MHDR 719 -#define MNG_FN_GETCHUNK_MEND 720 -#define MNG_FN_GETCHUNK_LOOP 721 -#define MNG_FN_GETCHUNK_ENDL 722 -#define MNG_FN_GETCHUNK_DEFI 723 -#define MNG_FN_GETCHUNK_BASI 724 -#define MNG_FN_GETCHUNK_CLON 725 -#define MNG_FN_GETCHUNK_PAST 726 -#define MNG_FN_GETCHUNK_DISC 727 -#define MNG_FN_GETCHUNK_BACK 728 -#define MNG_FN_GETCHUNK_FRAM 729 -#define MNG_FN_GETCHUNK_MOVE 730 -#define MNG_FN_GETCHUNK_CLIP 731 -#define MNG_FN_GETCHUNK_SHOW 732 -#define MNG_FN_GETCHUNK_TERM 733 -#define MNG_FN_GETCHUNK_SAVE 734 -#define MNG_FN_GETCHUNK_SEEK 735 -#define MNG_FN_GETCHUNK_EXPI 736 -#define MNG_FN_GETCHUNK_FPRI 737 -#define MNG_FN_GETCHUNK_NEED 738 -#define MNG_FN_GETCHUNK_PHYG 739 -#define MNG_FN_GETCHUNK_JHDR 740 -#define MNG_FN_GETCHUNK_JDAT 741 -#define MNG_FN_GETCHUNK_JSEP 742 -#define MNG_FN_GETCHUNK_DHDR 743 -#define MNG_FN_GETCHUNK_PROM 744 -#define MNG_FN_GETCHUNK_IPNG 745 -#define MNG_FN_GETCHUNK_PPLT 746 -#define MNG_FN_GETCHUNK_IJNG 747 -#define MNG_FN_GETCHUNK_DROP 748 -#define MNG_FN_GETCHUNK_DBYK 749 -#define MNG_FN_GETCHUNK_ORDR 750 -#define MNG_FN_GETCHUNK_UNKNOWN 751 -#define MNG_FN_GETCHUNK_MAGN 752 -#define MNG_FN_GETCHUNK_JDAA 753 -#define MNG_FN_GETCHUNK_EVNT 754 -#define MNG_FN_GETCHUNK_MPNG 755 - -#define MNG_FN_GETCHUNK_PAST_SRC 781 -#define MNG_FN_GETCHUNK_SAVE_ENTRY 782 -#define MNG_FN_GETCHUNK_PPLT_ENTRY 783 -#define MNG_FN_GETCHUNK_ORDR_ENTRY 784 -#define MNG_FN_GETCHUNK_EVNT_ENTRY 785 -#define MNG_FN_GETCHUNK_MPNG_FRAME 786 - -#define MNG_FN_PUTCHUNK_IHDR 801 -#define MNG_FN_PUTCHUNK_PLTE 802 -#define MNG_FN_PUTCHUNK_IDAT 803 -#define MNG_FN_PUTCHUNK_IEND 804 -#define MNG_FN_PUTCHUNK_TRNS 805 -#define MNG_FN_PUTCHUNK_GAMA 806 -#define MNG_FN_PUTCHUNK_CHRM 807 -#define MNG_FN_PUTCHUNK_SRGB 808 -#define MNG_FN_PUTCHUNK_ICCP 809 -#define MNG_FN_PUTCHUNK_TEXT 810 -#define MNG_FN_PUTCHUNK_ZTXT 811 -#define MNG_FN_PUTCHUNK_ITXT 812 -#define MNG_FN_PUTCHUNK_BKGD 813 -#define MNG_FN_PUTCHUNK_PHYS 814 -#define MNG_FN_PUTCHUNK_SBIT 815 -#define MNG_FN_PUTCHUNK_SPLT 816 -#define MNG_FN_PUTCHUNK_HIST 817 -#define MNG_FN_PUTCHUNK_TIME 818 -#define MNG_FN_PUTCHUNK_MHDR 819 -#define MNG_FN_PUTCHUNK_MEND 820 -#define MNG_FN_PUTCHUNK_LOOP 821 -#define MNG_FN_PUTCHUNK_ENDL 822 -#define MNG_FN_PUTCHUNK_DEFI 823 -#define MNG_FN_PUTCHUNK_BASI 824 -#define MNG_FN_PUTCHUNK_CLON 825 -#define MNG_FN_PUTCHUNK_PAST 826 -#define MNG_FN_PUTCHUNK_DISC 827 -#define MNG_FN_PUTCHUNK_BACK 828 -#define MNG_FN_PUTCHUNK_FRAM 829 -#define MNG_FN_PUTCHUNK_MOVE 830 -#define MNG_FN_PUTCHUNK_CLIP 831 -#define MNG_FN_PUTCHUNK_SHOW 832 -#define MNG_FN_PUTCHUNK_TERM 833 -#define MNG_FN_PUTCHUNK_SAVE 834 -#define MNG_FN_PUTCHUNK_SEEK 835 -#define MNG_FN_PUTCHUNK_EXPI 836 -#define MNG_FN_PUTCHUNK_FPRI 837 -#define MNG_FN_PUTCHUNK_NEED 838 -#define MNG_FN_PUTCHUNK_PHYG 839 -#define MNG_FN_PUTCHUNK_JHDR 840 -#define MNG_FN_PUTCHUNK_JDAT 841 -#define MNG_FN_PUTCHUNK_JSEP 842 -#define MNG_FN_PUTCHUNK_DHDR 843 -#define MNG_FN_PUTCHUNK_PROM 844 -#define MNG_FN_PUTCHUNK_IPNG 845 -#define MNG_FN_PUTCHUNK_PPLT 846 -#define MNG_FN_PUTCHUNK_IJNG 847 -#define MNG_FN_PUTCHUNK_DROP 848 -#define MNG_FN_PUTCHUNK_DBYK 849 -#define MNG_FN_PUTCHUNK_ORDR 850 -#define MNG_FN_PUTCHUNK_UNKNOWN 851 -#define MNG_FN_PUTCHUNK_MAGN 852 -#define MNG_FN_PUTCHUNK_JDAA 853 -#define MNG_FN_PUTCHUNK_EVNT 854 -#define MNG_FN_PUTCHUNK_MPNG 855 - -#define MNG_FN_PUTCHUNK_PAST_SRC 881 -#define MNG_FN_PUTCHUNK_SAVE_ENTRY 882 -#define MNG_FN_PUTCHUNK_PPLT_ENTRY 883 -#define MNG_FN_PUTCHUNK_ORDR_ENTRY 884 -#define MNG_FN_PUTCHUNK_EVNT_ENTRY 885 -#define MNG_FN_PUTCHUNK_MPNG_FRAME 886 - -/* ************************************************************************** */ - -#define MNG_FN_GETIMGDATA_SEQ 901 -#define MNG_FN_GETIMGDATA_CHUNKSEQ 902 -#define MNG_FN_GETIMGDATA_CHUNK 903 - -#define MNG_FN_PUTIMGDATA_IHDR 951 -#define MNG_FN_PUTIMGDATA_JHDR 952 -#define MNG_FN_PUTIMGDATA_BASI 953 -#define MNG_FN_PUTIMGDATA_DHDR 954 - -#define MNG_FN_UPDATEMNGHEADER 981 -#define MNG_FN_UPDATEMNGSIMPLICITY 982 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_RAW_CHUNK 1001 -#define MNG_FN_READ_GRAPHIC 1002 -#define MNG_FN_DROP_CHUNKS 1003 -#define MNG_FN_PROCESS_ERROR 1004 -#define MNG_FN_CLEAR_CMS 1005 -#define MNG_FN_DROP_OBJECTS 1006 -#define MNG_FN_READ_CHUNK 1007 -#define MNG_FN_LOAD_BKGDLAYER 1008 -#define MNG_FN_NEXT_FRAME 1009 -#define MNG_FN_NEXT_LAYER 1010 -#define MNG_FN_INTERFRAME_DELAY 1011 -#define MNG_FN_DISPLAY_IMAGE 1012 -#define MNG_FN_DROP_IMGOBJECTS 1013 -#define MNG_FN_DROP_ANIOBJECTS 1014 -#define MNG_FN_INFLATE_BUFFER 1015 -#define MNG_FN_DEFLATE_BUFFER 1016 -#define MNG_FN_WRITE_RAW_CHUNK 1017 -#define MNG_FN_WRITE_GRAPHIC 1018 -#define MNG_FN_SAVE_STATE 1019 -#define MNG_FN_RESTORE_STATE 1020 -#define MNG_FN_DROP_SAVEDATA 1021 -#define MNG_FN_EXECUTE_DELTA_IMAGE 1022 -#define MNG_FN_PROCESS_DISPLAY 1023 -#define MNG_FN_CLEAR_CANVAS 1024 -#define MNG_FN_READ_DATABUFFER 1025 -#define MNG_FN_STORE_ERROR 1026 -#define MNG_FN_DROP_INVALID_OBJECTS 1027 -#define MNG_FN_RELEASE_PUSHDATA 1028 -#define MNG_FN_READ_DATA 1029 -#define MNG_FN_READ_CHUNK_CRC 1030 -#define MNG_FN_RELEASE_PUSHCHUNK 1031 - -/* ************************************************************************** */ - -#define MNG_FN_DISPLAY_RGB8 1101 -#define MNG_FN_DISPLAY_RGBA8 1102 -#define MNG_FN_DISPLAY_ARGB8 1103 -#define MNG_FN_DISPLAY_BGR8 1104 -#define MNG_FN_DISPLAY_BGRA8 1105 -#define MNG_FN_DISPLAY_ABGR8 1106 -#define MNG_FN_DISPLAY_RGB16 1107 -#define MNG_FN_DISPLAY_RGBA16 1108 -#define MNG_FN_DISPLAY_ARGB16 1109 -#define MNG_FN_DISPLAY_BGR16 1110 -#define MNG_FN_DISPLAY_BGRA16 1111 -#define MNG_FN_DISPLAY_ABGR16 1112 -#define MNG_FN_DISPLAY_INDEX8 1113 -#define MNG_FN_DISPLAY_INDEXA8 1114 -#define MNG_FN_DISPLAY_AINDEX8 1115 -#define MNG_FN_DISPLAY_GRAY8 1116 -#define MNG_FN_DISPLAY_GRAY16 1117 -#define MNG_FN_DISPLAY_GRAYA8 1118 -#define MNG_FN_DISPLAY_GRAYA16 1119 -#define MNG_FN_DISPLAY_AGRAY8 1120 -#define MNG_FN_DISPLAY_AGRAY16 1121 -#define MNG_FN_DISPLAY_DX15 1122 -#define MNG_FN_DISPLAY_DX16 1123 -#define MNG_FN_DISPLAY_RGB8_A8 1124 -#define MNG_FN_DISPLAY_BGRA8PM 1125 -#define MNG_FN_DISPLAY_BGRX8 1126 -#define MNG_FN_DISPLAY_RGB565 1127 -#define MNG_FN_DISPLAY_RGBA565 1128 -#define MNG_FN_DISPLAY_BGR565 1129 -#define MNG_FN_DISPLAY_BGRA565 1130 -#define MNG_FN_DISPLAY_RGBA8_PM 1131 -#define MNG_FN_DISPLAY_ARGB8_PM 1132 -#define MNG_FN_DISPLAY_ABGR8_PM 1133 -#define MNG_FN_DISPLAY_BGR565_A8 1134 -#define MNG_FN_DISPLAY_RGB555 1135 -#define MNG_FN_DISPLAY_BGR555 1136 - -/* ************************************************************************** */ - -#define MNG_FN_INIT_FULL_CMS 1201 -#define MNG_FN_CORRECT_FULL_CMS 1202 -#define MNG_FN_INIT_GAMMA_ONLY 1204 -#define MNG_FN_CORRECT_GAMMA_ONLY 1205 -#define MNG_FN_CORRECT_APP_CMS 1206 -#define MNG_FN_INIT_FULL_CMS_OBJ 1207 -#define MNG_FN_INIT_GAMMA_ONLY_OBJ 1208 -#define MNG_FN_INIT_APP_CMS 1209 -#define MNG_FN_INIT_APP_CMS_OBJ 1210 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_G1 1301 -#define MNG_FN_PROCESS_G2 1302 -#define MNG_FN_PROCESS_G4 1303 -#define MNG_FN_PROCESS_G8 1304 -#define MNG_FN_PROCESS_G16 1305 -#define MNG_FN_PROCESS_RGB8 1306 -#define MNG_FN_PROCESS_RGB16 1307 -#define MNG_FN_PROCESS_IDX1 1308 -#define MNG_FN_PROCESS_IDX2 1309 -#define MNG_FN_PROCESS_IDX4 1310 -#define MNG_FN_PROCESS_IDX8 1311 -#define MNG_FN_PROCESS_GA8 1312 -#define MNG_FN_PROCESS_GA16 1313 -#define MNG_FN_PROCESS_RGBA8 1314 -#define MNG_FN_PROCESS_RGBA16 1315 - -/* ************************************************************************** */ - -#define MNG_FN_INIT_G1_NI 1401 -#define MNG_FN_INIT_G1_I 1402 -#define MNG_FN_INIT_G2_NI 1403 -#define MNG_FN_INIT_G2_I 1404 -#define MNG_FN_INIT_G4_NI 1405 -#define MNG_FN_INIT_G4_I 1406 -#define MNG_FN_INIT_G8_NI 1407 -#define MNG_FN_INIT_G8_I 1408 -#define MNG_FN_INIT_G16_NI 1409 -#define MNG_FN_INIT_G16_I 1410 -#define MNG_FN_INIT_RGB8_NI 1411 -#define MNG_FN_INIT_RGB8_I 1412 -#define MNG_FN_INIT_RGB16_NI 1413 -#define MNG_FN_INIT_RGB16_I 1414 -#define MNG_FN_INIT_IDX1_NI 1415 -#define MNG_FN_INIT_IDX1_I 1416 -#define MNG_FN_INIT_IDX2_NI 1417 -#define MNG_FN_INIT_IDX2_I 1418 -#define MNG_FN_INIT_IDX4_NI 1419 -#define MNG_FN_INIT_IDX4_I 1420 -#define MNG_FN_INIT_IDX8_NI 1421 -#define MNG_FN_INIT_IDX8_I 1422 -#define MNG_FN_INIT_GA8_NI 1423 -#define MNG_FN_INIT_GA8_I 1424 -#define MNG_FN_INIT_GA16_NI 1425 -#define MNG_FN_INIT_GA16_I 1426 -#define MNG_FN_INIT_RGBA8_NI 1427 -#define MNG_FN_INIT_RGBA8_I 1428 -#define MNG_FN_INIT_RGBA16_NI 1429 -#define MNG_FN_INIT_RGBA16_I 1430 - -#define MNG_FN_INIT_ROWPROC 1497 -#define MNG_FN_NEXT_ROW 1498 -#define MNG_FN_CLEANUP_ROWPROC 1499 - -/* ************************************************************************** */ - -#define MNG_FN_FILTER_A_ROW 1501 -#define MNG_FN_FILTER_SUB 1502 -#define MNG_FN_FILTER_UP 1503 -#define MNG_FN_FILTER_AVERAGE 1504 -#define MNG_FN_FILTER_PAETH 1505 - -#define MNG_FN_INIT_ROWDIFFERING 1551 -#define MNG_FN_DIFFER_G1 1552 -#define MNG_FN_DIFFER_G2 1553 -#define MNG_FN_DIFFER_G4 1554 -#define MNG_FN_DIFFER_G8 1555 -#define MNG_FN_DIFFER_G16 1556 -#define MNG_FN_DIFFER_RGB8 1557 -#define MNG_FN_DIFFER_RGB16 1558 -#define MNG_FN_DIFFER_IDX1 1559 -#define MNG_FN_DIFFER_IDX2 1560 -#define MNG_FN_DIFFER_IDX4 1561 -#define MNG_FN_DIFFER_IDX8 1562 -#define MNG_FN_DIFFER_GA8 1563 -#define MNG_FN_DIFFER_GA16 1564 -#define MNG_FN_DIFFER_RGBA8 1565 -#define MNG_FN_DIFFER_RGBA16 1566 - -/* ************************************************************************** */ - -#define MNG_FN_CREATE_IMGDATAOBJECT 1601 -#define MNG_FN_FREE_IMGDATAOBJECT 1602 -#define MNG_FN_CLONE_IMGDATAOBJECT 1603 -#define MNG_FN_CREATE_IMGOBJECT 1604 -#define MNG_FN_FREE_IMGOBJECT 1605 -#define MNG_FN_FIND_IMGOBJECT 1606 -#define MNG_FN_CLONE_IMGOBJECT 1607 -#define MNG_FN_RESET_OBJECTDETAILS 1608 -#define MNG_FN_RENUM_IMGOBJECT 1609 -#define MNG_FN_PROMOTE_IMGOBJECT 1610 -#define MNG_FN_MAGNIFY_IMGOBJECT 1611 -#define MNG_FN_COLORCORRECT_OBJECT 1612 - -/* ************************************************************************** */ - -#define MNG_FN_STORE_G1 1701 -#define MNG_FN_STORE_G2 1702 -#define MNG_FN_STORE_G4 1703 -#define MNG_FN_STORE_G8 1704 -#define MNG_FN_STORE_G16 1705 -#define MNG_FN_STORE_RGB8 1706 -#define MNG_FN_STORE_RGB16 1707 -#define MNG_FN_STORE_IDX1 1708 -#define MNG_FN_STORE_IDX2 1709 -#define MNG_FN_STORE_IDX4 1710 -#define MNG_FN_STORE_IDX8 1711 -#define MNG_FN_STORE_GA8 1712 -#define MNG_FN_STORE_GA16 1713 -#define MNG_FN_STORE_RGBA8 1714 -#define MNG_FN_STORE_RGBA16 1715 - -#define MNG_FN_RETRIEVE_G8 1751 -#define MNG_FN_RETRIEVE_G16 1752 -#define MNG_FN_RETRIEVE_RGB8 1753 -#define MNG_FN_RETRIEVE_RGB16 1754 -#define MNG_FN_RETRIEVE_IDX8 1755 -#define MNG_FN_RETRIEVE_GA8 1756 -#define MNG_FN_RETRIEVE_GA16 1757 -#define MNG_FN_RETRIEVE_RGBA8 1758 -#define MNG_FN_RETRIEVE_RGBA16 1759 - -#define MNG_FN_DELTA_G1 1771 -#define MNG_FN_DELTA_G2 1772 -#define MNG_FN_DELTA_G4 1773 -#define MNG_FN_DELTA_G8 1774 -#define MNG_FN_DELTA_G16 1775 -#define MNG_FN_DELTA_RGB8 1776 -#define MNG_FN_DELTA_RGB16 1777 -#define MNG_FN_DELTA_IDX1 1778 -#define MNG_FN_DELTA_IDX2 1779 -#define MNG_FN_DELTA_IDX4 1780 -#define MNG_FN_DELTA_IDX8 1781 -#define MNG_FN_DELTA_GA8 1782 -#define MNG_FN_DELTA_GA16 1783 -#define MNG_FN_DELTA_RGBA8 1784 -#define MNG_FN_DELTA_RGBA16 1785 - -/* ************************************************************************** */ - -#define MNG_FN_CREATE_ANI_LOOP 1801 -#define MNG_FN_CREATE_ANI_ENDL 1802 -#define MNG_FN_CREATE_ANI_DEFI 1803 -#define MNG_FN_CREATE_ANI_BASI 1804 -#define MNG_FN_CREATE_ANI_CLON 1805 -#define MNG_FN_CREATE_ANI_PAST 1806 -#define MNG_FN_CREATE_ANI_DISC 1807 -#define MNG_FN_CREATE_ANI_BACK 1808 -#define MNG_FN_CREATE_ANI_FRAM 1809 -#define MNG_FN_CREATE_ANI_MOVE 1810 -#define MNG_FN_CREATE_ANI_CLIP 1811 -#define MNG_FN_CREATE_ANI_SHOW 1812 -#define MNG_FN_CREATE_ANI_TERM 1813 -#define MNG_FN_CREATE_ANI_SAVE 1814 -#define MNG_FN_CREATE_ANI_SEEK 1815 -#define MNG_FN_CREATE_ANI_GAMA 1816 -#define MNG_FN_CREATE_ANI_CHRM 1817 -#define MNG_FN_CREATE_ANI_SRGB 1818 -#define MNG_FN_CREATE_ANI_ICCP 1819 -#define MNG_FN_CREATE_ANI_PLTE 1820 -#define MNG_FN_CREATE_ANI_TRNS 1821 -#define MNG_FN_CREATE_ANI_BKGD 1822 -#define MNG_FN_CREATE_ANI_DHDR 1823 -#define MNG_FN_CREATE_ANI_PROM 1824 -#define MNG_FN_CREATE_ANI_IPNG 1825 -#define MNG_FN_CREATE_ANI_IJNG 1826 -#define MNG_FN_CREATE_ANI_PPLT 1827 -#define MNG_FN_CREATE_ANI_MAGN 1828 - -#define MNG_FN_CREATE_ANI_IMAGE 1891 -#define MNG_FN_CREATE_EVENT 1892 - -/* ************************************************************************** */ - -#define MNG_FN_FREE_ANI_LOOP 1901 -#define MNG_FN_FREE_ANI_ENDL 1902 -#define MNG_FN_FREE_ANI_DEFI 1903 -#define MNG_FN_FREE_ANI_BASI 1904 -#define MNG_FN_FREE_ANI_CLON 1905 -#define MNG_FN_FREE_ANI_PAST 1906 -#define MNG_FN_FREE_ANI_DISC 1907 -#define MNG_FN_FREE_ANI_BACK 1908 -#define MNG_FN_FREE_ANI_FRAM 1909 -#define MNG_FN_FREE_ANI_MOVE 1910 -#define MNG_FN_FREE_ANI_CLIP 1911 -#define MNG_FN_FREE_ANI_SHOW 1912 -#define MNG_FN_FREE_ANI_TERM 1913 -#define MNG_FN_FREE_ANI_SAVE 1914 -#define MNG_FN_FREE_ANI_SEEK 1915 -#define MNG_FN_FREE_ANI_GAMA 1916 -#define MNG_FN_FREE_ANI_CHRM 1917 -#define MNG_FN_FREE_ANI_SRGB 1918 -#define MNG_FN_FREE_ANI_ICCP 1919 -#define MNG_FN_FREE_ANI_PLTE 1920 -#define MNG_FN_FREE_ANI_TRNS 1921 -#define MNG_FN_FREE_ANI_BKGD 1922 -#define MNG_FN_FREE_ANI_DHDR 1923 -#define MNG_FN_FREE_ANI_PROM 1924 -#define MNG_FN_FREE_ANI_IPNG 1925 -#define MNG_FN_FREE_ANI_IJNG 1926 -#define MNG_FN_FREE_ANI_PPLT 1927 -#define MNG_FN_FREE_ANI_MAGN 1928 - -#define MNG_FN_FREE_ANI_IMAGE 1991 -#define MNG_FN_FREE_EVENT 1992 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_ANI_LOOP 2001 -#define MNG_FN_PROCESS_ANI_ENDL 2002 -#define MNG_FN_PROCESS_ANI_DEFI 2003 -#define MNG_FN_PROCESS_ANI_BASI 2004 -#define MNG_FN_PROCESS_ANI_CLON 2005 -#define MNG_FN_PROCESS_ANI_PAST 2006 -#define MNG_FN_PROCESS_ANI_DISC 2007 -#define MNG_FN_PROCESS_ANI_BACK 2008 -#define MNG_FN_PROCESS_ANI_FRAM 2009 -#define MNG_FN_PROCESS_ANI_MOVE 2010 -#define MNG_FN_PROCESS_ANI_CLIP 2011 -#define MNG_FN_PROCESS_ANI_SHOW 2012 -#define MNG_FN_PROCESS_ANI_TERM 2013 -#define MNG_FN_PROCESS_ANI_SAVE 2014 -#define MNG_FN_PROCESS_ANI_SEEK 2015 -#define MNG_FN_PROCESS_ANI_GAMA 2016 -#define MNG_FN_PROCESS_ANI_CHRM 2017 -#define MNG_FN_PROCESS_ANI_SRGB 2018 -#define MNG_FN_PROCESS_ANI_ICCP 2019 -#define MNG_FN_PROCESS_ANI_PLTE 2020 -#define MNG_FN_PROCESS_ANI_TRNS 2021 -#define MNG_FN_PROCESS_ANI_BKGD 2022 -#define MNG_FN_PROCESS_ANI_DHDR 2023 -#define MNG_FN_PROCESS_ANI_PROM 2024 -#define MNG_FN_PROCESS_ANI_IPNG 2025 -#define MNG_FN_PROCESS_ANI_IJNG 2026 -#define MNG_FN_PROCESS_ANI_PPLT 2027 -#define MNG_FN_PROCESS_ANI_MAGN 2028 - -#define MNG_FN_PROCESS_ANI_IMAGE 2091 -#define MNG_FN_PROCESS_EVENT 2092 - -/* ************************************************************************** */ - -#define MNG_FN_RESTORE_BACKIMAGE 2101 -#define MNG_FN_RESTORE_BACKCOLOR 2102 -#define MNG_FN_RESTORE_BGCOLOR 2103 -#define MNG_FN_RESTORE_RGB8 2104 -#define MNG_FN_RESTORE_BGR8 2105 -#define MNG_FN_RESTORE_BKGD 2106 -#define MNG_FN_RESTORE_BGRX8 2107 -#define MNG_FN_RESTORE_RGB565 2108 -#define MNG_FN_RESTORE_BGR565 2109 - -/* ************************************************************************** */ - -#define MNG_FN_INIT_IHDR 2201 -#define MNG_FN_INIT_PLTE 2202 -#define MNG_FN_INIT_IDAT 2203 -#define MNG_FN_INIT_IEND 2204 -#define MNG_FN_INIT_TRNS 2205 -#define MNG_FN_INIT_GAMA 2206 -#define MNG_FN_INIT_CHRM 2207 -#define MNG_FN_INIT_SRGB 2208 -#define MNG_FN_INIT_ICCP 2209 -#define MNG_FN_INIT_TEXT 2210 -#define MNG_FN_INIT_ZTXT 2211 -#define MNG_FN_INIT_ITXT 2212 -#define MNG_FN_INIT_BKGD 2213 -#define MNG_FN_INIT_PHYS 2214 -#define MNG_FN_INIT_SBIT 2215 -#define MNG_FN_INIT_SPLT 2216 -#define MNG_FN_INIT_HIST 2217 -#define MNG_FN_INIT_TIME 2218 -#define MNG_FN_INIT_MHDR 2219 -#define MNG_FN_INIT_MEND 2220 -#define MNG_FN_INIT_LOOP 2221 -#define MNG_FN_INIT_ENDL 2222 -#define MNG_FN_INIT_DEFI 2223 -#define MNG_FN_INIT_BASI 2224 -#define MNG_FN_INIT_CLON 2225 -#define MNG_FN_INIT_PAST 2226 -#define MNG_FN_INIT_DISC 2227 -#define MNG_FN_INIT_BACK 2228 -#define MNG_FN_INIT_FRAM 2229 -#define MNG_FN_INIT_MOVE 2230 -#define MNG_FN_INIT_CLIP 2231 -#define MNG_FN_INIT_SHOW 2232 -#define MNG_FN_INIT_TERM 2233 -#define MNG_FN_INIT_SAVE 2234 -#define MNG_FN_INIT_SEEK 2235 -#define MNG_FN_INIT_EXPI 2236 -#define MNG_FN_INIT_FPRI 2237 -#define MNG_FN_INIT_NEED 2238 -#define MNG_FN_INIT_PHYG 2239 -#define MNG_FN_INIT_JHDR 2240 -#define MNG_FN_INIT_JDAT 2241 -#define MNG_FN_INIT_JSEP 2242 -#define MNG_FN_INIT_DHDR 2243 -#define MNG_FN_INIT_PROM 2244 -#define MNG_FN_INIT_IPNG 2245 -#define MNG_FN_INIT_PPLT 2246 -#define MNG_FN_INIT_IJNG 2247 -#define MNG_FN_INIT_DROP 2248 -#define MNG_FN_INIT_DBYK 2249 -#define MNG_FN_INIT_ORDR 2250 -#define MNG_FN_INIT_UNKNOWN 2251 -#define MNG_FN_INIT_MAGN 2252 -#define MNG_FN_INIT_JDAA 2253 -#define MNG_FN_INIT_EVNT 2254 -#define MNG_FN_INIT_MPNG 2255 - -/* ************************************************************************** */ - -#define MNG_FN_ASSIGN_IHDR 2301 -#define MNG_FN_ASSIGN_PLTE 2302 -#define MNG_FN_ASSIGN_IDAT 2303 -#define MNG_FN_ASSIGN_IEND 2304 -#define MNG_FN_ASSIGN_TRNS 2305 -#define MNG_FN_ASSIGN_GAMA 2306 -#define MNG_FN_ASSIGN_CHRM 2307 -#define MNG_FN_ASSIGN_SRGB 2308 -#define MNG_FN_ASSIGN_ICCP 2309 -#define MNG_FN_ASSIGN_TEXT 2310 -#define MNG_FN_ASSIGN_ZTXT 2311 -#define MNG_FN_ASSIGN_ITXT 2312 -#define MNG_FN_ASSIGN_BKGD 2313 -#define MNG_FN_ASSIGN_PHYS 2314 -#define MNG_FN_ASSIGN_SBIT 2315 -#define MNG_FN_ASSIGN_SPLT 2316 -#define MNG_FN_ASSIGN_HIST 2317 -#define MNG_FN_ASSIGN_TIME 2318 -#define MNG_FN_ASSIGN_MHDR 2319 -#define MNG_FN_ASSIGN_MEND 2320 -#define MNG_FN_ASSIGN_LOOP 2321 -#define MNG_FN_ASSIGN_ENDL 2322 -#define MNG_FN_ASSIGN_DEFI 2323 -#define MNG_FN_ASSIGN_BASI 2324 -#define MNG_FN_ASSIGN_CLON 2325 -#define MNG_FN_ASSIGN_PAST 2326 -#define MNG_FN_ASSIGN_DISC 2327 -#define MNG_FN_ASSIGN_BACK 2328 -#define MNG_FN_ASSIGN_FRAM 2329 -#define MNG_FN_ASSIGN_MOVE 2330 -#define MNG_FN_ASSIGN_CLIP 2331 -#define MNG_FN_ASSIGN_SHOW 2332 -#define MNG_FN_ASSIGN_TERM 2333 -#define MNG_FN_ASSIGN_SAVE 2334 -#define MNG_FN_ASSIGN_SEEK 2335 -#define MNG_FN_ASSIGN_EXPI 2336 -#define MNG_FN_ASSIGN_FPRI 2337 -#define MNG_FN_ASSIGN_NEED 2338 -#define MNG_FN_ASSIGN_PHYG 2339 -#define MNG_FN_ASSIGN_JHDR 2340 -#define MNG_FN_ASSIGN_JDAT 2341 -#define MNG_FN_ASSIGN_JSEP 2342 -#define MNG_FN_ASSIGN_DHDR 2343 -#define MNG_FN_ASSIGN_PROM 2344 -#define MNG_FN_ASSIGN_IPNG 2345 -#define MNG_FN_ASSIGN_PPLT 2346 -#define MNG_FN_ASSIGN_IJNG 2347 -#define MNG_FN_ASSIGN_DROP 2348 -#define MNG_FN_ASSIGN_DBYK 2349 -#define MNG_FN_ASSIGN_ORDR 2350 -#define MNG_FN_ASSIGN_UNKNOWN 2351 -#define MNG_FN_ASSIGN_MAGN 2352 -#define MNG_FN_ASSIGN_JDAA 2353 -#define MNG_FN_ASSIGN_EVNT 2354 -#define MNG_FN_ASSIGN_MPNG 2355 - -/* ************************************************************************** */ - -#define MNG_FN_FREE_IHDR 2401 -#define MNG_FN_FREE_PLTE 2402 -#define MNG_FN_FREE_IDAT 2403 -#define MNG_FN_FREE_IEND 2404 -#define MNG_FN_FREE_TRNS 2405 -#define MNG_FN_FREE_GAMA 2406 -#define MNG_FN_FREE_CHRM 2407 -#define MNG_FN_FREE_SRGB 2408 -#define MNG_FN_FREE_ICCP 2409 -#define MNG_FN_FREE_TEXT 2410 -#define MNG_FN_FREE_ZTXT 2411 -#define MNG_FN_FREE_ITXT 2412 -#define MNG_FN_FREE_BKGD 2413 -#define MNG_FN_FREE_PHYS 2414 -#define MNG_FN_FREE_SBIT 2415 -#define MNG_FN_FREE_SPLT 2416 -#define MNG_FN_FREE_HIST 2417 -#define MNG_FN_FREE_TIME 2418 -#define MNG_FN_FREE_MHDR 2419 -#define MNG_FN_FREE_MEND 2420 -#define MNG_FN_FREE_LOOP 2421 -#define MNG_FN_FREE_ENDL 2422 -#define MNG_FN_FREE_DEFI 2423 -#define MNG_FN_FREE_BASI 2424 -#define MNG_FN_FREE_CLON 2425 -#define MNG_FN_FREE_PAST 2426 -#define MNG_FN_FREE_DISC 2427 -#define MNG_FN_FREE_BACK 2428 -#define MNG_FN_FREE_FRAM 2429 -#define MNG_FN_FREE_MOVE 2430 -#define MNG_FN_FREE_CLIP 2431 -#define MNG_FN_FREE_SHOW 2432 -#define MNG_FN_FREE_TERM 2433 -#define MNG_FN_FREE_SAVE 2434 -#define MNG_FN_FREE_SEEK 2435 -#define MNG_FN_FREE_EXPI 2436 -#define MNG_FN_FREE_FPRI 2437 -#define MNG_FN_FREE_NEED 2438 -#define MNG_FN_FREE_PHYG 2439 -#define MNG_FN_FREE_JHDR 2440 -#define MNG_FN_FREE_JDAT 2441 -#define MNG_FN_FREE_JSEP 2442 -#define MNG_FN_FREE_DHDR 2443 -#define MNG_FN_FREE_PROM 2444 -#define MNG_FN_FREE_IPNG 2445 -#define MNG_FN_FREE_PPLT 2446 -#define MNG_FN_FREE_IJNG 2447 -#define MNG_FN_FREE_DROP 2448 -#define MNG_FN_FREE_DBYK 2449 -#define MNG_FN_FREE_ORDR 2450 -#define MNG_FN_FREE_UNKNOWN 2451 -#define MNG_FN_FREE_MAGN 2452 -#define MNG_FN_FREE_JDAA 2453 -#define MNG_FN_FREE_EVNT 2454 -#define MNG_FN_FREE_MPNG 2455 - -/* ************************************************************************** */ - -#define MNG_FN_READ_IHDR 2601 -#define MNG_FN_READ_PLTE 2602 -#define MNG_FN_READ_IDAT 2603 -#define MNG_FN_READ_IEND 2604 -#define MNG_FN_READ_TRNS 2605 -#define MNG_FN_READ_GAMA 2606 -#define MNG_FN_READ_CHRM 2607 -#define MNG_FN_READ_SRGB 2608 -#define MNG_FN_READ_ICCP 2609 -#define MNG_FN_READ_TEXT 2610 -#define MNG_FN_READ_ZTXT 2611 -#define MNG_FN_READ_ITXT 2612 -#define MNG_FN_READ_BKGD 2613 -#define MNG_FN_READ_PHYS 2614 -#define MNG_FN_READ_SBIT 2615 -#define MNG_FN_READ_SPLT 2616 -#define MNG_FN_READ_HIST 2617 -#define MNG_FN_READ_TIME 2618 -#define MNG_FN_READ_MHDR 2619 -#define MNG_FN_READ_MEND 2620 -#define MNG_FN_READ_LOOP 2621 -#define MNG_FN_READ_ENDL 2622 -#define MNG_FN_READ_DEFI 2623 -#define MNG_FN_READ_BASI 2624 -#define MNG_FN_READ_CLON 2625 -#define MNG_FN_READ_PAST 2626 -#define MNG_FN_READ_DISC 2627 -#define MNG_FN_READ_BACK 2628 -#define MNG_FN_READ_FRAM 2629 -#define MNG_FN_READ_MOVE 2630 -#define MNG_FN_READ_CLIP 2631 -#define MNG_FN_READ_SHOW 2632 -#define MNG_FN_READ_TERM 2633 -#define MNG_FN_READ_SAVE 2634 -#define MNG_FN_READ_SEEK 2635 -#define MNG_FN_READ_EXPI 2636 -#define MNG_FN_READ_FPRI 2637 -#define MNG_FN_READ_NEED 2638 -#define MNG_FN_READ_PHYG 2639 -#define MNG_FN_READ_JHDR 2640 -#define MNG_FN_READ_JDAT 2641 -#define MNG_FN_READ_JSEP 2642 -#define MNG_FN_READ_DHDR 2643 -#define MNG_FN_READ_PROM 2644 -#define MNG_FN_READ_IPNG 2645 -#define MNG_FN_READ_PPLT 2646 -#define MNG_FN_READ_IJNG 2647 -#define MNG_FN_READ_DROP 2648 -#define MNG_FN_READ_DBYK 2649 -#define MNG_FN_READ_ORDR 2650 -#define MNG_FN_READ_UNKNOWN 2651 -#define MNG_FN_READ_MAGN 2652 -#define MNG_FN_READ_JDAA 2653 -#define MNG_FN_READ_EVNT 2654 -#define MNG_FN_READ_MPNG 2655 - -/* ************************************************************************** */ - -#define MNG_FN_WRITE_IHDR 2801 -#define MNG_FN_WRITE_PLTE 2802 -#define MNG_FN_WRITE_IDAT 2803 -#define MNG_FN_WRITE_IEND 2804 -#define MNG_FN_WRITE_TRNS 2805 -#define MNG_FN_WRITE_GAMA 2806 -#define MNG_FN_WRITE_CHRM 2807 -#define MNG_FN_WRITE_SRGB 2808 -#define MNG_FN_WRITE_ICCP 2809 -#define MNG_FN_WRITE_TEXT 2810 -#define MNG_FN_WRITE_ZTXT 2811 -#define MNG_FN_WRITE_ITXT 2812 -#define MNG_FN_WRITE_BKGD 2813 -#define MNG_FN_WRITE_PHYS 2814 -#define MNG_FN_WRITE_SBIT 2815 -#define MNG_FN_WRITE_SPLT 2816 -#define MNG_FN_WRITE_HIST 2817 -#define MNG_FN_WRITE_TIME 2818 -#define MNG_FN_WRITE_MHDR 2819 -#define MNG_FN_WRITE_MEND 2820 -#define MNG_FN_WRITE_LOOP 2821 -#define MNG_FN_WRITE_ENDL 2822 -#define MNG_FN_WRITE_DEFI 2823 -#define MNG_FN_WRITE_BASI 2824 -#define MNG_FN_WRITE_CLON 2825 -#define MNG_FN_WRITE_PAST 2826 -#define MNG_FN_WRITE_DISC 2827 -#define MNG_FN_WRITE_BACK 2828 -#define MNG_FN_WRITE_FRAM 2829 -#define MNG_FN_WRITE_MOVE 2830 -#define MNG_FN_WRITE_CLIP 2831 -#define MNG_FN_WRITE_SHOW 2832 -#define MNG_FN_WRITE_TERM 2833 -#define MNG_FN_WRITE_SAVE 2834 -#define MNG_FN_WRITE_SEEK 2835 -#define MNG_FN_WRITE_EXPI 2836 -#define MNG_FN_WRITE_FPRI 2837 -#define MNG_FN_WRITE_NEED 2838 -#define MNG_FN_WRITE_PHYG 2839 -#define MNG_FN_WRITE_JHDR 2840 -#define MNG_FN_WRITE_JDAT 2841 -#define MNG_FN_WRITE_JSEP 2842 -#define MNG_FN_WRITE_DHDR 2843 -#define MNG_FN_WRITE_PROM 2844 -#define MNG_FN_WRITE_IPNG 2845 -#define MNG_FN_WRITE_PPLT 2846 -#define MNG_FN_WRITE_IJNG 2847 -#define MNG_FN_WRITE_DROP 2848 -#define MNG_FN_WRITE_DBYK 2849 -#define MNG_FN_WRITE_ORDR 2850 -#define MNG_FN_WRITE_UNKNOWN 2851 -#define MNG_FN_WRITE_MAGN 2852 -#define MNG_FN_WRITE_JDAA 2853 -#define MNG_FN_WRITE_EVNT 2854 -#define MNG_FN_WRITE_MPNG 2855 - -/* ************************************************************************** */ - -#define MNG_FN_ZLIB_INITIALIZE 3001 -#define MNG_FN_ZLIB_CLEANUP 3002 -#define MNG_FN_ZLIB_INFLATEINIT 3003 -#define MNG_FN_ZLIB_INFLATEROWS 3004 -#define MNG_FN_ZLIB_INFLATEDATA 3005 -#define MNG_FN_ZLIB_INFLATEFREE 3006 -#define MNG_FN_ZLIB_DEFLATEINIT 3007 -#define MNG_FN_ZLIB_DEFLATEROWS 3008 -#define MNG_FN_ZLIB_DEFLATEDATA 3009 -#define MNG_FN_ZLIB_DEFLATEFREE 3010 - -/* ************************************************************************** */ - -#define MNG_FN_PROCESS_DISPLAY_IHDR 3201 -#define MNG_FN_PROCESS_DISPLAY_PLTE 3202 -#define MNG_FN_PROCESS_DISPLAY_IDAT 3203 -#define MNG_FN_PROCESS_DISPLAY_IEND 3204 -#define MNG_FN_PROCESS_DISPLAY_TRNS 3205 -#define MNG_FN_PROCESS_DISPLAY_GAMA 3206 -#define MNG_FN_PROCESS_DISPLAY_CHRM 3207 -#define MNG_FN_PROCESS_DISPLAY_SRGB 3208 -#define MNG_FN_PROCESS_DISPLAY_ICCP 3209 -#define MNG_FN_PROCESS_DISPLAY_BKGD 3210 -#define MNG_FN_PROCESS_DISPLAY_PHYS 3211 -#define MNG_FN_PROCESS_DISPLAY_SBIT 3212 -#define MNG_FN_PROCESS_DISPLAY_SPLT 3213 -#define MNG_FN_PROCESS_DISPLAY_HIST 3214 -#define MNG_FN_PROCESS_DISPLAY_MHDR 3215 -#define MNG_FN_PROCESS_DISPLAY_MEND 3216 -#define MNG_FN_PROCESS_DISPLAY_LOOP 3217 -#define MNG_FN_PROCESS_DISPLAY_ENDL 3218 -#define MNG_FN_PROCESS_DISPLAY_DEFI 3219 -#define MNG_FN_PROCESS_DISPLAY_BASI 3220 -#define MNG_FN_PROCESS_DISPLAY_CLON 3221 -#define MNG_FN_PROCESS_DISPLAY_PAST 3222 -#define MNG_FN_PROCESS_DISPLAY_DISC 3223 -#define MNG_FN_PROCESS_DISPLAY_BACK 3224 -#define MNG_FN_PROCESS_DISPLAY_FRAM 3225 -#define MNG_FN_PROCESS_DISPLAY_MOVE 3226 -#define MNG_FN_PROCESS_DISPLAY_CLIP 3227 -#define MNG_FN_PROCESS_DISPLAY_SHOW 3228 -#define MNG_FN_PROCESS_DISPLAY_TERM 3229 -#define MNG_FN_PROCESS_DISPLAY_SAVE 3230 -#define MNG_FN_PROCESS_DISPLAY_SEEK 3231 -#define MNG_FN_PROCESS_DISPLAY_EXPI 3232 -#define MNG_FN_PROCESS_DISPLAY_FPRI 3233 -#define MNG_FN_PROCESS_DISPLAY_NEED 3234 -#define MNG_FN_PROCESS_DISPLAY_PHYG 3235 -#define MNG_FN_PROCESS_DISPLAY_JHDR 3236 -#define MNG_FN_PROCESS_DISPLAY_JDAT 3237 -#define MNG_FN_PROCESS_DISPLAY_JSEP 3238 -#define MNG_FN_PROCESS_DISPLAY_DHDR 3239 -#define MNG_FN_PROCESS_DISPLAY_PROM 3240 -#define MNG_FN_PROCESS_DISPLAY_IPNG 3241 -#define MNG_FN_PROCESS_DISPLAY_PPLT 3242 -#define MNG_FN_PROCESS_DISPLAY_IJNG 3243 -#define MNG_FN_PROCESS_DISPLAY_DROP 3244 -#define MNG_FN_PROCESS_DISPLAY_DBYK 3245 -#define MNG_FN_PROCESS_DISPLAY_ORDR 3246 -#define MNG_FN_PROCESS_DISPLAY_MAGN 3247 -#define MNG_FN_PROCESS_DISPLAY_JDAA 3248 - -/* ************************************************************************** */ - -#define MNG_FN_JPEG_INITIALIZE 3401 -#define MNG_FN_JPEG_CLEANUP 3402 -#define MNG_FN_JPEG_DECOMPRESSINIT 3403 -#define MNG_FN_JPEG_DECOMPRESSDATA 3404 -#define MNG_FN_JPEG_DECOMPRESSFREE 3405 - -#define MNG_FN_STORE_JPEG_G8 3501 -#define MNG_FN_STORE_JPEG_RGB8 3502 -#define MNG_FN_STORE_JPEG_G12 3503 -#define MNG_FN_STORE_JPEG_RGB12 3504 -#define MNG_FN_STORE_JPEG_GA8 3505 -#define MNG_FN_STORE_JPEG_RGBA8 3506 -#define MNG_FN_STORE_JPEG_GA12 3507 -#define MNG_FN_STORE_JPEG_RGBA12 3508 -#define MNG_FN_STORE_JPEG_G8_ALPHA 3509 -#define MNG_FN_STORE_JPEG_RGB8_ALPHA 3510 - -#define MNG_FN_INIT_JPEG_A1_NI 3511 -#define MNG_FN_INIT_JPEG_A2_NI 3512 -#define MNG_FN_INIT_JPEG_A4_NI 3513 -#define MNG_FN_INIT_JPEG_A8_NI 3514 -#define MNG_FN_INIT_JPEG_A16_NI 3515 - -#define MNG_FN_STORE_JPEG_G8_A1 3521 -#define MNG_FN_STORE_JPEG_G8_A2 3522 -#define MNG_FN_STORE_JPEG_G8_A4 3523 -#define MNG_FN_STORE_JPEG_G8_A8 3524 -#define MNG_FN_STORE_JPEG_G8_A16 3525 - -#define MNG_FN_STORE_JPEG_RGB8_A1 3531 -#define MNG_FN_STORE_JPEG_RGB8_A2 3532 -#define MNG_FN_STORE_JPEG_RGB8_A4 3533 -#define MNG_FN_STORE_JPEG_RGB8_A8 3534 -#define MNG_FN_STORE_JPEG_RGB8_A16 3535 - -#define MNG_FN_STORE_JPEG_G12_A1 3541 -#define MNG_FN_STORE_JPEG_G12_A2 3542 -#define MNG_FN_STORE_JPEG_G12_A4 3543 -#define MNG_FN_STORE_JPEG_G12_A8 3544 -#define MNG_FN_STORE_JPEG_G12_A16 3545 - -#define MNG_FN_STORE_JPEG_RGB12_A1 3551 -#define MNG_FN_STORE_JPEG_RGB12_A2 3552 -#define MNG_FN_STORE_JPEG_RGB12_A4 3553 -#define MNG_FN_STORE_JPEG_RGB12_A8 3554 -#define MNG_FN_STORE_JPEG_RGB12_A16 3555 - -#define MNG_FN_NEXT_JPEG_ALPHAROW 3591 -#define MNG_FN_NEXT_JPEG_ROW 3592 -#define MNG_FN_DISPLAY_JPEG_ROWS 3593 - -/* ************************************************************************** */ - -#define MNG_FN_MAGNIFY_G8_X1 3701 -#define MNG_FN_MAGNIFY_G8_X2 3702 -#define MNG_FN_MAGNIFY_RGB8_X1 3703 -#define MNG_FN_MAGNIFY_RGB8_X2 3704 -#define MNG_FN_MAGNIFY_GA8_X1 3705 -#define MNG_FN_MAGNIFY_GA8_X2 3706 -#define MNG_FN_MAGNIFY_GA8_X3 3707 -#define MNG_FN_MAGNIFY_GA8_X4 3708 -#define MNG_FN_MAGNIFY_RGBA8_X1 3709 -#define MNG_FN_MAGNIFY_RGBA8_X2 3710 -#define MNG_FN_MAGNIFY_RGBA8_X3 3711 -#define MNG_FN_MAGNIFY_RGBA8_X4 3712 -#define MNG_FN_MAGNIFY_G8_X3 3713 -#define MNG_FN_MAGNIFY_RGB8_X3 3714 -#define MNG_FN_MAGNIFY_GA8_X5 3715 -#define MNG_FN_MAGNIFY_RGBA8_X5 3716 - -#define MNG_FN_MAGNIFY_G16_X1 3725 -#define MNG_FN_MAGNIFY_G16_X2 3726 -#define MNG_FN_MAGNIFY_RGB16_X1 3727 -#define MNG_FN_MAGNIFY_RGB16_X2 3728 -#define MNG_FN_MAGNIFY_GA16_X1 3729 -#define MNG_FN_MAGNIFY_GA16_X2 3730 -#define MNG_FN_MAGNIFY_GA16_X3 3731 -#define MNG_FN_MAGNIFY_GA16_X4 3732 -#define MNG_FN_MAGNIFY_RGBA16_X1 3733 -#define MNG_FN_MAGNIFY_RGBA16_X2 3734 -#define MNG_FN_MAGNIFY_RGBA16_X3 3735 -#define MNG_FN_MAGNIFY_RGBA16_X4 3736 -#define MNG_FN_MAGNIFY_G16_X3 3737 -#define MNG_FN_MAGNIFY_RGB16_X3 3738 -#define MNG_FN_MAGNIFY_GA16_X5 3739 -#define MNG_FN_MAGNIFY_RGBA16_X5 3740 - -#define MNG_FN_MAGNIFY_G8_Y1 3751 -#define MNG_FN_MAGNIFY_G8_Y2 3752 -#define MNG_FN_MAGNIFY_RGB8_Y1 3753 -#define MNG_FN_MAGNIFY_RGB8_Y2 3754 -#define MNG_FN_MAGNIFY_GA8_Y1 3755 -#define MNG_FN_MAGNIFY_GA8_Y2 3756 -#define MNG_FN_MAGNIFY_GA8_Y3 3757 -#define MNG_FN_MAGNIFY_GA8_Y4 3758 -#define MNG_FN_MAGNIFY_RGBA8_Y1 3759 -#define MNG_FN_MAGNIFY_RGBA8_Y2 3760 -#define MNG_FN_MAGNIFY_RGBA8_Y3 3761 -#define MNG_FN_MAGNIFY_RGBA8_Y4 3762 -#define MNG_FN_MAGNIFY_G8_Y3 3763 -#define MNG_FN_MAGNIFY_RGB8_Y3 3764 -#define MNG_FN_MAGNIFY_GA8_Y5 3765 -#define MNG_FN_MAGNIFY_RGBA8_Y5 3766 - -#define MNG_FN_MAGNIFY_G16_Y1 3775 -#define MNG_FN_MAGNIFY_G16_Y2 3776 -#define MNG_FN_MAGNIFY_RGB16_Y1 3777 -#define MNG_FN_MAGNIFY_RGB16_Y2 3778 -#define MNG_FN_MAGNIFY_GA16_Y1 3779 -#define MNG_FN_MAGNIFY_GA16_Y2 3780 -#define MNG_FN_MAGNIFY_GA16_Y3 3781 -#define MNG_FN_MAGNIFY_GA16_Y4 3782 -#define MNG_FN_MAGNIFY_RGBA16_Y1 3783 -#define MNG_FN_MAGNIFY_RGBA16_Y2 3784 -#define MNG_FN_MAGNIFY_RGBA16_Y3 3785 -#define MNG_FN_MAGNIFY_RGBA16_Y4 3786 -#define MNG_FN_MAGNIFY_G16_Y3 3787 -#define MNG_FN_MAGNIFY_RGB16_Y3 3788 -#define MNG_FN_MAGNIFY_GA16_Y5 3789 -#define MNG_FN_MAGNIFY_RGBA16_Y5 3790 - -/* ************************************************************************** */ - -#define MNG_FN_DELTA_G1_G1 3801 -#define MNG_FN_DELTA_G2_G2 3802 -#define MNG_FN_DELTA_G4_G4 3803 -#define MNG_FN_DELTA_G8_G8 3804 -#define MNG_FN_DELTA_G16_G16 3805 -#define MNG_FN_DELTA_RGB8_RGB8 3806 -#define MNG_FN_DELTA_RGB16_RGB16 3807 -#define MNG_FN_DELTA_GA8_GA8 3808 -#define MNG_FN_DELTA_GA8_G8 3809 -#define MNG_FN_DELTA_GA8_A8 3810 -#define MNG_FN_DELTA_GA16_GA16 3811 -#define MNG_FN_DELTA_GA16_G16 3812 -#define MNG_FN_DELTA_GA16_A16 3813 -#define MNG_FN_DELTA_RGBA8_RGBA8 3814 -#define MNG_FN_DELTA_RGBA8_RGB8 3815 -#define MNG_FN_DELTA_RGBA8_A8 3816 -#define MNG_FN_DELTA_RGBA16_RGBA16 3817 -#define MNG_FN_DELTA_RGBA16_RGB16 3818 -#define MNG_FN_DELTA_RGBA16_A16 3819 - -#define MNG_FN_PROMOTE_G8_G8 3901 -#define MNG_FN_PROMOTE_G8_G16 3902 -#define MNG_FN_PROMOTE_G16_G16 3903 -#define MNG_FN_PROMOTE_G8_GA8 3904 -#define MNG_FN_PROMOTE_G8_GA16 3905 -#define MNG_FN_PROMOTE_G16_GA16 3906 -#define MNG_FN_PROMOTE_G8_RGB8 3907 -#define MNG_FN_PROMOTE_G8_RGB16 3908 -#define MNG_FN_PROMOTE_G16_RGB16 3909 -#define MNG_FN_PROMOTE_G8_RGBA8 3910 -#define MNG_FN_PROMOTE_G8_RGBA16 3911 -#define MNG_FN_PROMOTE_G16_RGBA16 3912 -#define MNG_FN_PROMOTE_GA8_GA16 3913 -#define MNG_FN_PROMOTE_GA8_RGBA8 3914 -#define MNG_FN_PROMOTE_GA8_RGBA16 3915 -#define MNG_FN_PROMOTE_GA16_RGBA16 3916 -#define MNG_FN_PROMOTE_RGB8_RGB16 3917 -#define MNG_FN_PROMOTE_RGB8_RGBA8 3918 -#define MNG_FN_PROMOTE_RGB8_RGBA16 3919 -#define MNG_FN_PROMOTE_RGB16_RGBA16 3920 -#define MNG_FN_PROMOTE_RGBA8_RGBA16 3921 -#define MNG_FN_PROMOTE_IDX8_RGB8 3922 -#define MNG_FN_PROMOTE_IDX8_RGB16 3923 -#define MNG_FN_PROMOTE_IDX8_RGBA8 3924 -#define MNG_FN_PROMOTE_IDX8_RGBA16 3925 - -#define MNG_FN_SCALE_G1_G2 4001 -#define MNG_FN_SCALE_G1_G4 4002 -#define MNG_FN_SCALE_G1_G8 4003 -#define MNG_FN_SCALE_G1_G16 4004 -#define MNG_FN_SCALE_G2_G4 4005 -#define MNG_FN_SCALE_G2_G8 4006 -#define MNG_FN_SCALE_G2_G16 4007 -#define MNG_FN_SCALE_G4_G8 4008 -#define MNG_FN_SCALE_G4_G16 4009 -#define MNG_FN_SCALE_G8_G16 4010 -#define MNG_FN_SCALE_GA8_GA16 4011 -#define MNG_FN_SCALE_RGB8_RGB16 4012 -#define MNG_FN_SCALE_RGBA8_RGBA16 4013 - -#define MNG_FN_SCALE_G2_G1 4021 -#define MNG_FN_SCALE_G4_G1 4022 -#define MNG_FN_SCALE_G8_G1 4023 -#define MNG_FN_SCALE_G16_G1 4024 -#define MNG_FN_SCALE_G4_G2 4025 -#define MNG_FN_SCALE_G8_G2 4026 -#define MNG_FN_SCALE_G16_G2 4027 -#define MNG_FN_SCALE_G8_G4 4028 -#define MNG_FN_SCALE_G16_G4 4029 -#define MNG_FN_SCALE_G16_G8 4030 -#define MNG_FN_SCALE_GA16_GA8 4031 -#define MNG_FN_SCALE_RGB16_RGB8 4032 -#define MNG_FN_SCALE_RGBA16_RGBA8 4033 - -#define MNG_FN_COMPOSEOVER_RGBA8 4501 -#define MNG_FN_COMPOSEOVER_RGBA16 4502 -#define MNG_FN_COMPOSEUNDER_RGBA8 4503 -#define MNG_FN_COMPOSEUNDER_RGBA16 4504 - -#define MNG_FN_FLIP_RGBA8 4521 -#define MNG_FN_FLIP_RGBA16 4522 -#define MNG_FN_TILE_RGBA8 4523 -#define MNG_FN_TILE_RGBA16 4524 - -/* ************************************************************************** */ -/* * * */ -/* * Trace string-table entry * */ -/* * * */ -/* ************************************************************************** */ - -typedef struct { - mng_uint32 iFunction; - mng_pchar zTracetext; - } mng_trace_entry; -typedef mng_trace_entry const * mng_trace_entryp; - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_TRACE_PROCS */ - -/* ************************************************************************** */ - -#endif /* _libmng_trace_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_types.h b/Engine/lib/lmng/libmng_types.h deleted file mode 100644 index 81fb29f52..000000000 --- a/Engine/lib/lmng/libmng_types.h +++ /dev/null @@ -1,574 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_types.h copyright (c) 2000-2007 G.Juyn * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : type specifications * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Specification of the types used by the library * */ -/* * Creates platform-independant structure * */ -/* * * */ -/* * changes : 0.5.1 - 05/06/2000 - G.Juyn * */ -/* * - added iteratechunk callback definition * */ -/* * 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - improved definitions for DLL support * */ -/* * - added 8-bit palette definition * */ -/* * - added general array definitions * */ -/* * - added MNG_NULL definition * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - changed most callback prototypes to allow the app * */ -/* * to report errors during callback processing * */ -/* * 0.5.1 - 05/16/2000 - G.Juyn * */ -/* * - moved standard header includes into this file * */ -/* * (stdlib/mem for mem-mngmt & math for fp gamma-calc) * */ -/* * * */ -/* * 0.5.2 - 05/18/2000 - G.Juyn * */ -/* * - B003 - fixed problem with being proprietary * */ -/* * to Borland platform * */ -/* * - added helper definitions for JNG (IJG-based) * */ -/* * - fixed support for IJGSRC6B * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - added default IJG compression parameters and such * */ -/* * 0.5.2 - 05/31/2000 - G.Juyn * */ -/* * - fixed inclusion for memcpy (contributed by Tim Rowley) * */ -/* * - added mng_int32p (contributed by Tim Rowley) * */ -/* * 0.5.2 - 06/02/2000 - G.Juyn * */ -/* * - removed SWAP_ENDIAN reference (contributed by Tim Rowley)* */ -/* * - added getalphaline callback for RGB8_A8 canvasstyle * */ -/* * * */ -/* * 0.5.3 - 06/21/2000 - G.Juyn * */ -/* * - added speedtype to facilitate testing * */ -/* * 0.5.3 - 06/27/2000 - G.Juyn * */ -/* * - added typedef for mng_size_t * */ -/* * - changed size parameter for memory callbacks to * */ -/* * mng_size_t * */ -/* * 0.5.3 - 06/28/2000 - G.Juyn * */ -/* * - changed definition of 32-bit ints (64-bit platforms) * */ -/* * - changed definition of mng_handle (64-bit platforms) * */ -/* * 0.5.3 - 06/29/2000 - G.Juyn * */ -/* * - changed definition of mng_handle (again) * */ -/* * - swapped refresh parameters * */ -/* * - added inclusion of stdlib.h for abs() * */ -/* * * */ -/* * 0.9.0 - 06/30/2000 - G.Juyn * */ -/* * - changed refresh parameters to 'x,y,width,height' * */ -/* * 0.9.1 - 07/10/2000 - G.Juyn * */ -/* * - added suspendbuffer constants * */ -/* * 0.9.1 - 07/15/2000 - G.Juyn * */ -/* * - added callbacks for SAVE/SEEK processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/07/2000 - G.Juyn * */ -/* * - B111300 - fixup for improved portability * */ -/* * 0.9.3 - 08/12/2000 - G.Juyn * */ -/* * - added workaround for faulty PhotoShop iCCP chunk * */ -/* * 0.9.3 - 09/11/2000 - G.Juyn * */ -/* * - added export of zlib functions from windows dll * */ -/* * - fixed inclusion parameters once again to make those * */ -/* * external libs work together * */ -/* * - re-fixed fixed inclusion parameters * */ -/* * (these freeking libraries make me mad) * */ -/* * 0.9.3 - 10/11/2000 - G.Juyn * */ -/* * - added support for nEED * */ -/* * 0.9.3 - 10/17/2000 - G.Juyn * */ -/* * - added callback to process non-critical unknown chunks * */ -/* * * */ -/* * 0.9.4 - 11/20/2000 - R.Giles * */ -/* * - fixed inclusion of lcms header for non-windows platforms * */ -/* * 0.9.4 - 12/12/2000 - G.Juyn * */ -/* * - changed callback convention for MSVC (Thanks Chad) * */ -/* * 0.9.4 - 12/16/2000 - G.Juyn * */ -/* * - fixed mixup of data- & function-pointers (thanks Dimitri)* */ -/* * * */ -/* * 1.0.1 - 02/08/2001 - G.Juyn * */ -/* * - added MEND processing callback * */ -/* * * */ -/* * 1.0.2 - 06/23/2001 - G.Juyn * */ -/* * - added processterm callback * */ -/* * * */ -/* * 1.0.3 - 08/06/2001 - G.Juyn * */ -/* * - changed inclusion of lcms.h for Linux platforms * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.6 - 04/11/2003 - G.Juyn * */ -/* * - B719420 - fixed several MNG_APP_CMS problems * */ -/* * 1.0.6 - 06/15/2003 - R.Giles * */ -/* * - lcms.h inclusion is generally no longer prefixed * */ -/* * 1.0.6 - 07/07/2003 - G. R-P. * */ -/* * - added png_imgtypes enumeration * */ -/* * * */ -/* * 1.0.7 - 03/10/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * * */ -/* * 1.0.8 - 04/11/2004 - G.Juyn * */ -/* * - added data-push mechanisms for specialized decoders * */ -/* * 1.0.8 - 08/01/2004 - G.Juyn * */ -/* * - added support for 3+byte pixelsize for JPEG's * */ -/* * * */ -/* * 1.0.9 - 12/05/2004 - G.Juyn * */ -/* * - inclusion of zlib/lcms/ijgsrc6b with <> instead of "" * */ -/* * 1.0.9 - 12/06/2004 - G.Juyn * */ -/* * - added conditional MNG_OPTIMIZE_CHUNKREADER * */ -/* * * */ -/* * 1.0.10 - 04/08/2007 - G.Juyn * */ -/* * - added support for mPNG proposal * */ -/* * 1.0.10 - 04/12/2007 - G.Juyn * */ -/* * - added support for ANG proposal * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef _libmng_types_h_ -#define _libmng_types_h_ - -/* ************************************************************************** */ - -#ifdef __BORLANDC__ -#pragma option -AT /* turn off strict ANSI-C for the moment */ -#endif - -#ifndef WIN32 -#if defined(_WIN32) || defined(__WIN32__) || defined(_Windows) || defined(_WINDOWS) -#define WIN32 /* gather them into a single define */ -#endif -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Here's where the external & standard libs are embedded * */ -/* * * */ -/* * (it can be a bit of a pain in the lower-back to get them to work * */ -/* * together) * */ -/* * * */ -/* ************************************************************************** */ - -#ifdef WIN32 /* only include needed stuff */ -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#endif - -#ifdef MNG_USE_DLL -#ifdef MNG_SKIP_ZLIB -#undef MNG_INCLUDE_ZLIB -#endif -#ifdef MNG_SKIP_LCMS -#undef MNG_INCLUDE_LCMS -#endif -#ifdef MNG_SKIP_IJG6B -#undef MNG_INCLUDE_IJG6B -#endif -#endif - -#ifdef MNG_INCLUDE_ZLIB /* zlib by Mark Adler & Jean-loup Gailly */ -#include -#endif - -#ifdef MNG_INCLUDE_LCMS /* little cms by Marti Maria Saguer */ -#ifndef ZLIB_DLL -#undef FAR -#endif -#include -#endif /* MNG_INCLUDE_LCMS */ - -#ifdef MNG_INCLUDE_IJG6B /* IJG's jpgsrc6b */ -#include -#ifdef MNG_USE_SETJMP -#include /* needed for error-recovery (blergh) */ -#else -#ifdef WIN32 -#define USE_WINDOWS_MESSAGEBOX /* display a messagebox under Windoze */ -#endif -#endif /* MNG_USE_SETJMP */ -#ifdef FAR -#undef FAR /* possibly defined by zlib or lcms */ -#endif -#define JPEG_INTERNAL_OPTIONS /* for RGB_PIXELSIZE */ -#include /* all that for JPEG support :-) */ -#endif /* MNG_INCLUDE_IJG6B */ - -#if defined(MNG_INTERNAL_MEMMNGMT) || defined(MNG_INCLUDE_FILTERS) -#include /* "calloc" & "free" & "abs" */ -#endif - -#include /* get proper integer widths */ - -#ifdef WIN32 -#if defined __BORLANDC__ -#include /* defines "memcpy" for BCB */ -#else -#include /* defines "memcpy" for other win32 platforms */ -#endif -#include /* "strncmp" + "strcmp" */ -#else /* WIN32 */ -#ifdef BSD -#include /* defines "memcpy", etc for BSD (?) */ -#else -#include /* defines "memcpy", etc for all others (???) */ -#endif -#endif /* WIN32 */ - -#if defined(MNG_FULL_CMS) || defined(MNG_GAMMA_ONLY) || defined(MNG_APP_CMS) -#include /* fp gamma-calculation */ -#endif - -/* ************************************************************************** */ -/* * * */ -/* * Platform-dependant stuff * */ -/* * * */ -/* ************************************************************************** */ - -/* TODO: this may require some elaboration for other platforms; - only works with BCB for now */ - -#ifndef MNG_DLL -#if defined(MNG_BUILD_DLL) || defined(MNG_USE_DLL) -#define MNG_DLL -#endif -#endif - -#define MNG_LOCAL static - -#if defined(MNG_DLL) && defined(WIN32) /* setup DLL calling conventions */ -#define MNG_DECL __stdcall -#if defined(MNG_BUILD_DLL) -#define MNG_EXT __declspec(dllexport) -#elif defined(MNG_USE_DLL) -#define MNG_EXT __declspec(dllimport) -#else -#define MNG_EXT -#endif -#ifdef MNG_STRICT_ANSI -#undef MNG_STRICT_ANSI /* can't do strict-ANSI with this DLL-stuff */ -#endif -#else -#define MNG_DECL /* dummies for non-DLL */ -#define MNG_EXT -#endif /* MNG_DLL && WIN32 */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* now force ANSI-C from here on */ -#endif - -/* ************************************************************************** */ - -#if USHRT_MAX == 0xffffffffU /* get the proper 32-bit width !!! */ -typedef unsigned short mng_uint32; -typedef signed short mng_int32; -#elif UINT_MAX == 0xffffffffU -typedef unsigned int mng_uint32; -typedef signed int mng_int32; -#elif ULONG_MAX == 0xffffffffU -typedef unsigned long mng_uint32; -typedef signed long mng_int32; -#else -#error "Sorry, I can't find any 32-bit integers on this platform." -#endif - -typedef signed short mng_int16; /* other basic integers */ -typedef unsigned short mng_uint16; -typedef signed char mng_int8; -typedef unsigned char mng_uint8; - -typedef double mng_float; /* basic float */ - -typedef size_t mng_size_t; /* size field for memory allocation */ - -typedef char * mng_pchar; /* string */ -typedef void * mng_ptr; /* generic pointer */ -typedef void (*mng_fptr) (void); /* generic function pointer */ - -/* ************************************************************************** */ -/* * * */ -/* * Platform-independant from here * */ -/* * * */ -/* ************************************************************************** */ - -typedef mng_uint32 * mng_uint32p; /* pointer to unsigned longs */ -typedef mng_int32 * mng_int32p; /* pointer to longs */ -typedef mng_uint16 * mng_uint16p; /* pointer to unsigned words */ -typedef mng_uint8 * mng_uint8p; /* pointer to unsigned bytes */ - -typedef mng_int8 mng_bool; /* booleans */ - -struct mng_data_struct; -typedef struct mng_data_struct * mng_handle; /* generic handle */ - -typedef mng_int32 mng_retcode; /* generic return code */ -typedef mng_int32 mng_chunkid; /* 4-byte chunkname identifier */ -typedef mng_ptr mng_chunkp; /* pointer to a chunk-structure */ -typedef mng_ptr mng_objectp; /* pointer to an object-structure */ - -typedef mng_chunkid * mng_chunkidp; /* pointer to chunkid */ - -typedef struct { /* 8-bit palette element */ - mng_uint8 iRed; - mng_uint8 iGreen; - mng_uint8 iBlue; - } mng_palette8e; -typedef mng_palette8e mng_palette8[256]; /* 8-bit palette */ -typedef mng_palette8e * mng_palette8ep; - -typedef mng_uint8 mng_uint8arr[256]; /* generic arrays */ -typedef mng_uint8 mng_uint8arr4[4]; -typedef mng_uint16 mng_uint16arr[256]; -typedef mng_uint32 mng_uint32arr2[2]; - -/* ************************************************************************** */ - -#define MNG_FALSE 0 -#define MNG_TRUE 1 -#define MNG_NULL 0 - -#define MNG_SUSPENDBUFFERSIZE 32768 -#define MNG_SUSPENDREQUESTSIZE 1024 - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB - -/* size of temporary zlib buffer for deflate processing */ -#define MNG_ZLIB_MAXBUF 8192 - -/* default zlib compression parameters for deflateinit2 */ -#define MNG_ZLIB_LEVEL 9 /* level */ -#define MNG_ZLIB_METHOD Z_DEFLATED /* method */ -#define MNG_ZLIB_WINDOWBITS 15 /* window size */ -#define MNG_ZLIB_MEMLEVEL 9 /* memory level */ -#define MNG_ZLIB_STRATEGY Z_DEFAULT_STRATEGY /* strategy */ - -#define MNG_MAX_IDAT_SIZE 4096 /* maximum size of IDAT data */ - -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_JNG - -#ifdef MNG_INCLUDE_IJG6B /* IJG helper defs */ -typedef struct jpeg_compress_struct mngjpeg_comp; -typedef struct jpeg_decompress_struct mngjpeg_decomp; -typedef struct jpeg_error_mgr mngjpeg_error; -typedef struct jpeg_source_mgr mngjpeg_source; - -typedef mngjpeg_comp * mngjpeg_compp; -typedef mngjpeg_decomp * mngjpeg_decompp; -typedef mngjpeg_error * mngjpeg_errorp; -typedef mngjpeg_source * mngjpeg_sourcep; - -typedef J_DCT_METHOD mngjpeg_dctmethod; - -/* default IJG parameters for compression */ -#define MNG_JPEG_DCT JDCT_DEFAULT /* DCT algorithm (JDCT_ISLOW) */ -#define MNG_JPEG_QUALITY 100 /* quality 0..100; 100=best */ -#define MNG_JPEG_SMOOTHING 0 /* default no smoothing */ -#define MNG_JPEG_PROGRESSIVE MNG_FALSE /* default is just baseline */ -#define MNG_JPEG_OPTIMIZED MNG_FALSE /* default is not optimized */ -#endif /* MNG_INCLUDE_IJG6B */ - -#define MNG_JPEG_MAXBUF 65500 /* max size of temp JPEG buffer */ -#define MNG_MAX_JDAT_SIZE 4096 /* maximum size of JDAT data */ - -#endif /* MNG_INCLUDE_JNG */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_LCMS -typedef cmsHPROFILE mng_cmsprof; /* little CMS helper defs */ -typedef cmsHTRANSFORM mng_cmstrans; -typedef cmsCIExyY mng_CIExyY; -typedef cmsCIExyYTRIPLE mng_CIExyYTRIPLE; -typedef LPGAMMATABLE mng_gammatabp; -#endif /* MNG_INCLUDE_LCMS */ - -/* ************************************************************************** */ - - /* enumeration of known graphics types */ -enum mng_imgtypes {mng_it_unknown, mng_it_png, mng_it_mng, mng_it_jng -#ifdef MNG_INCLUDE_MPNG_PROPOSAL - ,mng_it_mpng -#endif -#ifdef MNG_INCLUDE_ANG_PROPOSAL - ,mng_it_ang -#endif - }; -typedef enum mng_imgtypes mng_imgtype; - - /* enumeration of animation speed-types */ -enum mng_speedtypes {mng_st_normal, mng_st_fast, mng_st_slow, mng_st_slowest}; -typedef enum mng_speedtypes mng_speedtype; - -#ifdef MNG_OPTIMIZE_CHUNKREADER - /* enumeration object-creation indicators */ -enum mng_createobjtypes {mng_create_none, mng_create_always, mng_create_ifglobal}; -typedef enum mng_createobjtypes mng_createobjtype; -#endif - -/* ************************************************************************** */ - -/* enumeration of PNG image types */ -#ifdef MNG_OPTIMIZE_FOOTPRINT_INIT -enum png_imgtypes - { - png_g1, - png_g2, - png_g4, - png_g8, - png_rgb8, - png_idx1, - png_idx2, - png_idx4, - png_idx8, - png_ga8, - png_rgba8, -#ifdef MNG_INCLUDE_JNG - png_jpeg_a1, - png_jpeg_a2, - png_jpeg_a4, - png_jpeg_a8, -#endif -#ifndef MNG_NO_16BIT_SUPPORT - png_g16, - png_ga16, - png_rgb16, - png_rgba16, -#ifdef MNG_INCLUDE_JNG - png_jpeg_a16, -#endif -#endif - png_none - }; - -typedef enum png_imgtypes png_imgtype; -#endif -/* ************************************************************************** */ - - /* memory management callbacks */ -typedef mng_ptr (MNG_DECL *mng_memalloc) (mng_size_t iLen); -typedef void (MNG_DECL *mng_memfree) (mng_ptr iPtr, - mng_size_t iLen); - -typedef void (MNG_DECL *mng_releasedata) (mng_ptr pUserdata, - mng_ptr pData, - mng_size_t iLength); - - /* I/O management callbacks */ -#ifndef MNG_NO_OPEN_CLOSE_STREAM -typedef mng_bool (MNG_DECL *mng_openstream) (mng_handle hHandle); -typedef mng_bool (MNG_DECL *mng_closestream) (mng_handle hHandle); -#endif -typedef mng_bool (MNG_DECL *mng_readdata) (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pRead); -typedef mng_bool (MNG_DECL *mng_writedata) (mng_handle hHandle, - mng_ptr pBuf, - mng_uint32 iBuflen, - mng_uint32p pWritten); - - /* error & trace processing callbacks */ -typedef mng_bool (MNG_DECL *mng_errorproc) (mng_handle hHandle, - mng_int32 iErrorcode, - mng_int8 iSeverity, - mng_chunkid iChunkname, - mng_uint32 iChunkseq, - mng_int32 iExtra1, - mng_int32 iExtra2, - mng_pchar zErrortext); -typedef mng_bool (MNG_DECL *mng_traceproc) (mng_handle hHandle, - mng_int32 iFuncnr, - mng_int32 iFuncseq, - mng_pchar zFuncname); - - /* read processing callbacks */ -typedef mng_bool (MNG_DECL *mng_processheader) (mng_handle hHandle, - mng_uint32 iWidth, - mng_uint32 iHeight); -typedef mng_bool (MNG_DECL *mng_processtext) (mng_handle hHandle, - mng_uint8 iType, - mng_pchar zKeyword, - mng_pchar zText, - mng_pchar zLanguage, - mng_pchar zTranslation); -typedef mng_bool (MNG_DECL *mng_processsave) (mng_handle hHandle); -typedef mng_bool (MNG_DECL *mng_processseek) (mng_handle hHandle, - mng_pchar zName); -typedef mng_bool (MNG_DECL *mng_processneed) (mng_handle hHandle, - mng_pchar zKeyword); -typedef mng_bool (MNG_DECL *mng_processmend) (mng_handle hHandle, - mng_uint32 iIterationsdone, - mng_uint32 iIterationsleft); -typedef mng_bool (MNG_DECL *mng_processunknown) (mng_handle hHandle, - mng_chunkid iChunkid, - mng_uint32 iRawlen, - mng_ptr pRawdata); -typedef mng_bool (MNG_DECL *mng_processterm) (mng_handle hHandle, - mng_uint8 iTermaction, - mng_uint8 iIteraction, - mng_uint32 iDelay, - mng_uint32 iItermax); - - /* display processing callbacks */ -typedef mng_ptr (MNG_DECL *mng_getcanvasline) (mng_handle hHandle, - mng_uint32 iLinenr); -typedef mng_ptr (MNG_DECL *mng_getbkgdline) (mng_handle hHandle, - mng_uint32 iLinenr); -typedef mng_ptr (MNG_DECL *mng_getalphaline) (mng_handle hHandle, - mng_uint32 iLinenr); -typedef mng_bool (MNG_DECL *mng_refresh) (mng_handle hHandle, - mng_uint32 iX, - mng_uint32 iY, - mng_uint32 iWidth, - mng_uint32 iHeight); - - /* timer management callbacks */ -typedef mng_uint32 (MNG_DECL *mng_gettickcount) (mng_handle hHandle); -typedef mng_bool (MNG_DECL *mng_settimer) (mng_handle hHandle, - mng_uint32 iMsecs); - - /* color management callbacks */ -typedef mng_bool (MNG_DECL *mng_processgamma) (mng_handle hHandle, - mng_uint32 iGamma); -typedef mng_bool (MNG_DECL *mng_processchroma) (mng_handle hHandle, - mng_uint32 iWhitepointx, - mng_uint32 iWhitepointy, - mng_uint32 iRedx, - mng_uint32 iRedy, - mng_uint32 iGreenx, - mng_uint32 iGreeny, - mng_uint32 iBluex, - mng_uint32 iBluey); -typedef mng_bool (MNG_DECL *mng_processsrgb) (mng_handle hHandle, - mng_uint8 iRenderingintent); -typedef mng_bool (MNG_DECL *mng_processiccp) (mng_handle hHandle, - mng_uint32 iProfilesize, - mng_ptr pProfile); -typedef mng_bool (MNG_DECL *mng_processarow) (mng_handle hHandle, - mng_uint32 iRowsamples, - mng_bool bIsRGBA16, - mng_ptr pRow); - - /* chunk access callback(s) */ -typedef mng_bool (MNG_DECL *mng_iteratechunk) (mng_handle hHandle, - mng_handle hChunk, - mng_chunkid iChunkid, - mng_uint32 iChunkseq); - -/* ************************************************************************** */ - -#endif /* _libmng_types_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_write.c b/Engine/lib/lmng/libmng_write.c deleted file mode 100644 index 79ff54438..000000000 --- a/Engine/lib/lmng/libmng_write.c +++ /dev/null @@ -1,198 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_write.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Write management (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the write management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * 0.5.1 - 05/16/2000 - G.Juyn * */ -/* * - moved the actual write_graphic functionality from * */ -/* * mng_hlapi to its appropriate function here * */ -/* * * */ -/* * 0.9.1 - 07/19/2000 - G.Juyn * */ -/* * - fixed writing of signature * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.8 - 07/06/2004 - G.R-P * */ -/* * - added conditionals around openstream/closestream * */ -/* * - defend against using undefined Open/Closestream function * */ -/* * 1.0.8 - 08/02/2004 - G.Juyn * */ -/* * - added conditional to allow easier writing of large MNG's * */ -/* * * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * 1.0.9 - 12/20/2004 - G.Juyn * */ -/* * - cleaned up macro-invocations (thanks to D. Airlie) * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_chunks.h" -#include "libmng_chunk_io.h" -#include "libmng_write.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#if defined(MNG_SUPPORT_READ) || defined(MNG_SUPPORT_WRITE) -mng_retcode mng_drop_chunks (mng_datap pData) -{ - mng_chunkp pChunk; - mng_chunkp pNext; - mng_cleanupchunk fCleanup; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_START); -#endif - - pChunk = pData->pFirstchunk; /* and get first stored chunk (if any) */ - - while (pChunk) /* more chunks to discard ? */ - { - pNext = ((mng_chunk_headerp)pChunk)->pNext; - /* call appropriate cleanup */ - fCleanup = ((mng_chunk_headerp)pChunk)->fCleanup; - fCleanup (pData, pChunk); - - pChunk = pNext; /* neeeext */ - } - - pData->pFirstchunk = MNG_NULL; - pData->pLastchunk = MNG_NULL; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_DROP_CHUNKS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_READ || MNG_SUPPORT_WRITE */ - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_WRITE_PROCS - -/* ************************************************************************** */ - -mng_retcode mng_write_graphic (mng_datap pData) -{ - mng_chunkp pChunk; - mng_retcode iRetcode; - mng_uint32 iWritten; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GRAPHIC, MNG_LC_START); -#endif - - pChunk = pData->pFirstchunk; /* we'll start with the first, thank you */ - - if (pChunk) /* is there anything to write ? */ - { /* open the file */ - if (!pData->bWriting) - { -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fOpenstream && !pData->fOpenstream ((mng_handle)pData)) - MNG_ERROR (pData, MNG_APPIOERROR); -#endif - { - pData->bWriting = MNG_TRUE; /* indicate writing */ - pData->iWritebufsize = 32768; /* get a temporary write buffer */ - /* reserve 12 bytes for length, chunkname & crc */ - MNG_ALLOC (pData, pData->pWritebuf, pData->iWritebufsize+12); - - /* write the signature */ - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_IHDR) - mng_put_uint32 (pData->pWritebuf, PNG_SIG); - else - if (((mng_chunk_headerp)pChunk)->iChunkname == MNG_UINT_JHDR) - mng_put_uint32 (pData->pWritebuf, JNG_SIG); - else - mng_put_uint32 (pData->pWritebuf, MNG_SIG); - - mng_put_uint32 (pData->pWritebuf+4, POST_SIG); - - if (!pData->fWritedata ((mng_handle)pData, pData->pWritebuf, 8, &iWritten)) - { - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12); - MNG_ERROR (pData, MNG_APPIOERROR); - } - - if (iWritten != 8) /* disk full ? */ - { - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12); - MNG_ERROR (pData, MNG_OUTPUTERROR); - } - } - } - - while (pChunk) /* so long as there's something to write */ - { /* let's call its output routine */ - iRetcode = ((mng_chunk_headerp)pChunk)->fWrite (pData, pChunk); - if (iRetcode) /* on error bail out */ - return iRetcode; - /* neeeext */ - pChunk = ((mng_chunk_headerp)pChunk)->pNext; - } - - if (!pData->bCreating) - { /* free the temporary buffer */ - MNG_FREE (pData, pData->pWritebuf, pData->iWritebufsize+12); - - pData->bWriting = MNG_FALSE; /* done writing */ - /* close the stream now */ -#ifndef MNG_NO_OPEN_CLOSE_STREAM - if (pData->fClosestream && !pData->fClosestream ((mng_handle)pData)) - MNG_ERROR (pData, MNG_APPIOERROR); -#endif - - } else { - /* cleanup the written chunks */ - iRetcode = mng_drop_chunks (pData); - if (iRetcode) /* on error bail out */ - return iRetcode; - } - } - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_WRITE_GRAPHIC, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_WRITE_PROCS */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - - diff --git a/Engine/lib/lmng/libmng_write.h b/Engine/lib/lmng/libmng_write.h deleted file mode 100644 index df058fb77..000000000 --- a/Engine/lib/lmng/libmng_write.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_write.h copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : Write management (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the write management routines * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * * */ -/* * 1.0.9 - 09/25/2004 - G.Juyn * */ -/* * - replaced MNG_TWEAK_LARGE_FILES with permanent solution * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_write_h_ -#define _libmng_write_h_ - -/* ************************************************************************** */ - -mng_retcode mng_drop_chunks (mng_datap pData); - -mng_retcode mng_write_graphic (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_write_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/libmng_zlib.c b/Engine/lib/lmng/libmng_zlib.c deleted file mode 100644 index 7d102e160..000000000 --- a/Engine/lib/lmng/libmng_zlib.c +++ /dev/null @@ -1,607 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_zlib.c copyright (c) 2000-2004 G.Juyn * */ -/* * version : 1.0.9 * */ -/* * * */ -/* * purpose : ZLIB library interface (implementation) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : implementation of the ZLIB library interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * 0.5.1 - 05/11/2000 - G.Juyn * */ -/* * - filled the deflatedata routine * */ -/* * 0.5.1 - 05/12/2000 - G.Juyn * */ -/* * - changed trace to macro for callback error-reporting * */ -/* * * */ -/* * 0.5.2 - 05/20/2000 - G.Juyn * */ -/* * - fixed for JNG alpha handling * */ -/* * 0.5.2 - 05/24/2000 - G.Juyn * */ -/* * - moved init of default zlib parms from here to * */ -/* * "mng_hlapi.c" * */ -/* * * */ -/* * 0.5.3 - 06/16/2000 - G.Juyn * */ -/* * - changed progressive-display processing * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* * 0.9.3 - 08/08/2000 - G.Juyn * */ -/* * - fixed compiler-warnings from Mozilla * */ -/* * 0.9.3 - 09/07/2000 - G.Juyn * */ -/* * - added support for new filter_types * */ -/* * * */ -/* * 1.0.5 - 08/07/2002 - G.Juyn * */ -/* * - added test-option for PNG filter method 193 (=no filter) * */ -/* * 1.0.5 - 08/19/2002 - G.Juyn * */ -/* * - B597134 - libmng pollutes the linker namespace * */ -/* * 1.0.5 - 09/19/2002 - G.Juyn * */ -/* * - added warning for too much IDAT data * */ -/* * * */ -/* * 1.0.6 - 07/07/2003 - G.R-P * */ -/* * - added MNG_NO_16BIT_SUPPORT support * */ -/* * * */ -/* * 1.0.9 - 10/09/2004 - G.R-P * */ -/* * - added MNG_NO_1_2_4BIT_SUPPORT support * */ -/* * * */ -/* ************************************************************************** */ - -#include "libmng.h" -#include "libmng_data.h" -#include "libmng_error.h" -#include "libmng_trace.h" -#ifdef __BORLANDC__ -#pragma hdrstop -#endif -#include "libmng_memory.h" -#include "libmng_pixels.h" -#include "libmng_filter.h" -#include "libmng_zlib.h" - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -/* ************************************************************************** */ - -#ifdef MNG_INCLUDE_ZLIB - -/* ************************************************************************** */ - -voidpf mngzlib_alloc (voidpf pData, - uInt iCount, - uInt iSize) -{ - voidpf pPtr; /* temporary space */ - -#ifdef MNG_INTERNAL_MEMMNGMT - pPtr = calloc (iCount, iSize); /* local allocation */ -#else - if (((mng_datap)pData)->fMemalloc) /* callback function set ? */ - pPtr = ((mng_datap)pData)->fMemalloc (iCount * iSize); - else - pPtr = Z_NULL; /* can't allocate! */ -#endif - - return pPtr; /* return the result */ -} - -/* ************************************************************************** */ - -void mngzlib_free (voidpf pData, - voidpf pAddress) -{ -#ifdef MNG_INTERNAL_MEMMNGMT - free (pAddress); /* free locally */ -#else - if (((mng_datap)pData)->fMemfree) /* callback set? */ - ((mng_datap)pData)->fMemfree (pAddress, 1); -#endif -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_initialize (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INITIALIZE, MNG_LC_START); -#endif - -#ifdef MNG_INTERNAL_MEMMNGMT - pData->sZlib.zalloc = Z_NULL; /* let zlib figure out memory management */ - pData->sZlib.zfree = Z_NULL; - pData->sZlib.opaque = Z_NULL; -#else /* use user-provided callbacks */ - pData->sZlib.zalloc = mngzlib_alloc; - pData->sZlib.zfree = mngzlib_free; - pData->sZlib.opaque = (voidpf)pData; -#endif - - pData->bInflating = MNG_FALSE; /* not performing any action yet */ - pData->bDeflating = MNG_FALSE; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INITIALIZE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_cleanup (mng_datap pData) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_CLEANUP, MNG_LC_START); -#endif - - if (pData->bInflating) /* force zlib cleanup */ - mngzlib_inflatefree (pData); - if (pData->bDeflating) - mngzlib_deflatefree (pData); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_CLEANUP, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_inflateinit (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEINIT, MNG_LC_START); -#endif - /* initialize zlib structures and such */ - iZrslt = inflateInit (&pData->sZlib); - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - - pData->bInflating = MNG_TRUE; /* really inflating something now */ - pData->sZlib.next_out = 0; /* force JIT initialization */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#ifdef MNG_SUPPORT_DISPLAY -mng_retcode mngzlib_inflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ - int iZrslt; - mng_retcode iRslt; - mng_ptr pSwap; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEROWS, MNG_LC_START); -#endif - - pData->sZlib.next_in = pIndata; /* let zlib know where to get stuff */ - pData->sZlib.avail_in = (uInt)iInlen; - - if (pData->sZlib.next_out == 0) /* initialize output variables ? */ - { /* let zlib know where to store stuff */ - pData->sZlib.next_out = pData->pWorkrow; - pData->sZlib.avail_out = (uInt)(pData->iRowsize + pData->iPixelofs); -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth < 8) - pData->sZlib.avail_out = (uInt)((pData->iPNGdepth*pData->iRowsize + 7)/8 - + pData->iPixelofs); -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - pData->sZlib.avail_out = (uInt)(2*pData->iRowsize + pData->iPixelofs); -#endif - } - - do - { /* now inflate a row */ - iZrslt = inflate (&pData->sZlib, Z_SYNC_FLUSH); - /* produced a full row ? */ - if (((iZrslt == Z_OK) || (iZrslt == Z_STREAM_END)) && - (pData->sZlib.avail_out == 0)) - { /* image not completed yet ? */ - if (pData->iRow < (mng_int32)pData->iDataheight) - { -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth == 1) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (pData->iRowsize+7)/8; - - for (iX = ((pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>7)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>6)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>5)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>3)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>1)&1); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&1); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 2) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (2*pData->iRowsize+7)/8; - - for (iX = ((2*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (2*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>6)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>4)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc)>>2)&3); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&3); - if (iX-- <= 0) - break; - pSrc++; - } - } - else if (pData->iPNGdepth == 4) - { - /* Inflate Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc + pData->iRowsize - (4*pData->iRowsize+7)/8; - - for (iX = ((4*pData->iRowsize+7)/8) ; iX > 0 ; iX--) - *pDest++ = *pSrc++; - - pDest = pData->pWorkrow+1; - pSrc = pDest + pData->iRowsize - (4*pData->iRowsize+7)/8; - for (iX = pData->iRowsize; ;) - { - *pDest++ = (((*pSrc)>>4)&0x0f); - if (iX-- <= 0) - break; - *pDest++ = (((*pSrc) )&0x0f); - if (iX-- <= 0) - break; - pSrc++; - } - } - if (pData->iPNGdepth < 8 && pData->iColortype == 0) - { - /* Expand samples to 8-bit by LBR */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8 multiplier[]={0,255,85,0,17,0,0,0,1}; - - for (iX = pData->iRowsize; iX > 0; iX--) - *pSrc++ *= multiplier[pData->iPNGdepth]; - } -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - { - /* Reduce Workrow to 8-bit */ - mng_int32 iX; - mng_uint8p pSrc = pData->pWorkrow+1; - mng_uint8p pDest = pSrc; - - for (iX = pData->iRowsize; iX > 0; iX--) - { - *pDest = *pSrc; - pDest++; - pSrc+=2; - } - } -#endif - -#ifdef FILTER192 /* has leveling info ? */ - if (pData->iFilterofs == MNG_FILTER_DIFFERING) - iRslt = init_rowdiffering (pData); - else -#endif - iRslt = MNG_NOERROR; - /* filter the row if necessary */ - if ((!iRslt) && (pData->iFilterofs < pData->iPixelofs ) && - (*(pData->pWorkrow + pData->iFilterofs)) ) - iRslt = mng_filter_a_row (pData); - else - iRslt = MNG_NOERROR; - /* additional leveling/differing ? */ - if ((!iRslt) && (pData->fDifferrow)) - { - iRslt = ((mng_differrow)pData->fDifferrow) (pData); - - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* make sure we're processing the right data */ - } - - if (!iRslt) - { -#ifdef MNG_INCLUDE_JNG - if (pData->bHasJHDR) /* is JNG alpha-channel ? */ - { /* just store in object ? */ - if ((!iRslt) && (pData->fStorerow)) - iRslt = ((mng_storerow)pData->fStorerow) (pData); - } - else -#endif /* MNG_INCLUDE_JNG */ - { /* process this row */ - if ((!iRslt) && (pData->fProcessrow)) - iRslt = ((mng_processrow)pData->fProcessrow) (pData); - /* store in object ? */ - if ((!iRslt) && (pData->fStorerow)) - iRslt = ((mng_storerow)pData->fStorerow) (pData); - /* color correction ? */ - if ((!iRslt) && (pData->fCorrectrow)) - iRslt = ((mng_correctrow)pData->fCorrectrow) (pData); - /* slap onto canvas ? */ - if ((!iRslt) && (pData->fDisplayrow)) - { - iRslt = ((mng_displayrow)pData->fDisplayrow) (pData); - - if (!iRslt) /* check progressive display refresh */ - iRslt = mng_display_progressive_check (pData); - - } - } - } - - if (iRslt) /* on error bail out */ - MNG_ERROR (pData, iRslt); - - if (!pData->fDifferrow) /* swap row-pointers */ - { - pSwap = pData->pWorkrow; - pData->pWorkrow = pData->pPrevrow; - pData->pPrevrow = pSwap; /* so prev points to the processed row! */ - } - - iRslt = mng_next_row (pData); /* adjust variables for next row */ - - if (iRslt) /* on error bail out */ - MNG_ERROR (pData, iRslt); - } - /* let zlib know where to store next output */ - pData->sZlib.next_out = pData->pWorkrow; - pData->sZlib.avail_out = (uInt)(pData->iRowsize + pData->iPixelofs); -#ifdef MNG_NO_1_2_4BIT_SUPPORT - if (pData->iPNGdepth < 8) - pData->sZlib.avail_out = (uInt)((pData->iPNGdepth*pData->iRowsize + 7)/8 - + pData->iPixelofs); -#endif -#ifdef MNG_NO_16BIT_SUPPORT - if (pData->iPNGdepth > 8) - pData->sZlib.avail_out = (uInt)(2*pData->iRowsize + pData->iPixelofs); -#endif - } - } /* until some error or EOI - or all pixels received */ - while ( (iZrslt == Z_OK) && (pData->sZlib.avail_in > 0) && - ( (pData->iRow < (mng_int32)pData->iDataheight) || - ( (pData->iPass >= 0) && (pData->iPass < 7) ) ) ); - /* on error bail out */ - if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END)) - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - /* too much data ? */ - if ((iZrslt == Z_OK) && (pData->sZlib.avail_in > 0)) - MNG_WARNING (pData, MNG_TOOMUCHIDAT); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEROWS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} -#endif /* MNG_SUPPORT_DISPLAY */ - -/* ************************************************************************** */ - -mng_retcode mngzlib_inflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEDATA, MNG_LC_START); -#endif - /* let zlib know where to get stuff */ - pData->sZlib.next_in = pIndata; - pData->sZlib.avail_in = (uInt)iInlen; - /* now inflate the data in one go! */ - iZrslt = inflate (&pData->sZlib, Z_FINISH); - /* not enough room in output-buffer ? */ - if ((iZrslt == Z_BUF_ERROR) || (pData->sZlib.avail_in > 0)) - return MNG_BUFOVERFLOW; - /* on error bail out */ - if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END)) - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_inflatefree (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEFREE, MNG_LC_START); -#endif - - pData->bInflating = MNG_FALSE; /* stopped it */ - - iZrslt = inflateEnd (&pData->sZlib); /* let zlib cleanup its own stuff */ - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_INFLATEFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflateinit (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEINIT, MNG_LC_START); -#endif - /* initialize zlib structures and such */ - iZrslt = deflateInit2 (&pData->sZlib, pData->iZlevel, pData->iZmethod, - pData->iZwindowbits, pData->iZmemlevel, - pData->iZstrategy); - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - - pData->bDeflating = MNG_TRUE; /* really deflating something now */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEINIT, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEROWS, MNG_LC_START); -#endif - - - - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEROWS, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEDATA, MNG_LC_START); -#endif - - pData->sZlib.next_in = pIndata; /* let zlib know where to get stuff */ - pData->sZlib.avail_in = (uInt)iInlen; - /* now deflate the data in one go! */ - iZrslt = deflate (&pData->sZlib, Z_FINISH); - /* not enough room in output-buffer ? */ - if ((iZrslt == Z_BUF_ERROR) || (pData->sZlib.avail_in > 0)) - return MNG_BUFOVERFLOW; - /* on error bail out */ - if ((iZrslt != Z_OK) && (iZrslt != Z_STREAM_END)) - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEDATA, MNG_LC_END); -#endif - - return MNG_NOERROR; -} - -/* ************************************************************************** */ - -mng_retcode mngzlib_deflatefree (mng_datap pData) -{ - int iZrslt; - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEFREE, MNG_LC_START); -#endif - - iZrslt = deflateEnd (&pData->sZlib); /* let zlib cleanup its own stuff */ - - if (iZrslt != Z_OK) /* on error bail out */ - MNG_ERRORZ (pData, (mng_uint32)iZrslt); - - pData->bDeflating = MNG_FALSE; /* stopped it */ - -#ifdef MNG_SUPPORT_TRACE - MNG_TRACE (pData, MNG_FN_ZLIB_DEFLATEFREE, MNG_LC_END); -#endif - - return MNG_NOERROR; /* done */ -} - -/* ************************************************************************** */ - -#endif /* MNG_INCLUDE_ZLIB */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ - diff --git a/Engine/lib/lmng/libmng_zlib.h b/Engine/lib/lmng/libmng_zlib.h deleted file mode 100644 index cfc391823..000000000 --- a/Engine/lib/lmng/libmng_zlib.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ************************************************************************** */ -/* * For conditions of distribution and use, * */ -/* * see copyright notice in libmng.h * */ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : libmng_zlib.h copyright (c) 2000-2002 G.Juyn * */ -/* * version : 1.0.0 * */ -/* * * */ -/* * purpose : ZLIB package interface (definition) * */ -/* * * */ -/* * author : G.Juyn * */ -/* * * */ -/* * comment : Definition of the ZLIB package interface * */ -/* * * */ -/* * changes : 0.5.1 - 05/08/2000 - G.Juyn * */ -/* * - changed strict-ANSI stuff * */ -/* * * */ -/* * 0.9.2 - 08/05/2000 - G.Juyn * */ -/* * - changed file-prefixes * */ -/* * * */ -/* ************************************************************************** */ - -#if defined(__BORLANDC__) && defined(MNG_STRICT_ANSI) -#pragma option -A /* force ANSI-C */ -#endif - -#ifndef _libmng_zlib_h_ -#define _libmng_zlib_h_ - -/* ************************************************************************** */ - -mng_retcode mngzlib_initialize (mng_datap pData); -mng_retcode mngzlib_cleanup (mng_datap pData); - -mng_retcode mngzlib_inflateinit (mng_datap pData); -mng_retcode mngzlib_inflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_inflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_inflatefree (mng_datap pData); - -mng_retcode mngzlib_deflateinit (mng_datap pData); -mng_retcode mngzlib_deflaterows (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_deflatedata (mng_datap pData, - mng_uint32 iInlen, - mng_uint8p pIndata); -mng_retcode mngzlib_deflatefree (mng_datap pData); - -/* ************************************************************************** */ - -#endif /* _libmng_zlib_h_ */ - -/* ************************************************************************** */ -/* * end of file * */ -/* ************************************************************************** */ diff --git a/Engine/lib/lmng/makefiles/Makefile.am b/Engine/lib/lmng/makefiles/Makefile.am deleted file mode 100644 index b53523e9a..000000000 --- a/Engine/lib/lmng/makefiles/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = 1.3 foreign no-dependencies - -# include the app subdirectories in the distribution -EXTRA_DIST = makefiles doc contrib - - -# libmng release @VERSION@ -libmng_la_LDFLAGS = -version-info 1:0:0 - -lib_LTLIBRARIES = libmng.la - -include_HEADERS = libmng.h libmng_conf.h libmng_types.h -noinst_HEADERS = libmng_chunk_io.h libmng_chunk_prc.h libmng_chunks.h \ - libmng_cms.h libmng_data.h libmng_display.h libmng_dither.h \ - libmng_error.h libmng_filter.h libmng_jpeg.h libmng_memory.h \ - libmng_object_prc.h libmng_objects.h libmng_pixels.h \ - libmng_read.h libmng_trace.h libmng_write.h libmng_zlib.h - -libmng_la_SOURCES = libmng_callback_xs.c libmng_chunk_io.c \ - libmng_chunk_prc.c libmng_chunk_xs.c libmng_cms.c \ - libmng_display.c libmng_dither.c libmng_error.c \ - libmng_filter.c libmng_hlapi.c libmng_jpeg.c \ - libmng_object_prc.c libmng_pixels.c libmng_prop_xs.c \ - libmng_read.c libmng_trace.c libmng_write.c libmng_zlib.c - -man_MANS = doc/man/libmng.3 doc/man/jng.5 doc/man/mng.5 - diff --git a/Engine/lib/lmng/makefiles/README b/Engine/lib/lmng/makefiles/README deleted file mode 100644 index 63faaafb0..000000000 --- a/Engine/lib/lmng/makefiles/README +++ /dev/null @@ -1,27 +0,0 @@ -For conditions of distribution and use, see copyright notice in libmng.h -or the file LICENSE in the top-level directory of the source distribution. - -This directory hosts the makefiles for a number of supported platforms. - -If you're using a system with POSIX shell capabilities, you can use the -'configure' script in the top-level directory, or generate it by running -'autogen.sh' if you have the necessary tools installed. - -Otherwise, copy the module for your environment (or the closest thing) -into the libmng source-directory and change it to your needs. If you -create a new file for a platform not on the list send it to me (gerard @ -libmng.com) and I'll be happy to include it in the next release! - - -Current files: - -makefile.bcb3 - Borland C++ Builder -makefile.vcwin32 - Microsoft Visual C++ -makefile.unix - generic Unix -makefile.linux - Linux ELF (builds shared library) -makefile.dj - DJGPP -makefile.mingw - builds a static library for mingw32 -makefile.mingwdll - builds a dynamic library for mingw32 -makefile.irix - builds a static library for SGI/IRIX (6.5.21) - -Makefile.am, configure.in and acinclude.m4 (if present) - automake/autoconf source diff --git a/Engine/lib/lmng/makefiles/configure.in b/Engine/lib/lmng/makefiles/configure.in deleted file mode 100644 index e7cb75c00..000000000 --- a/Engine/lib/lmng/makefiles/configure.in +++ /dev/null @@ -1,193 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT -AC_CONFIG_SRCDIR([libmng.h]) -AC_PREREQ(2.52) - -dnl this call will define PACKAGE and VERSION -dnl please use this as the primary reference for the version number -AM_INIT_AUTOMAKE(libmng, 1.0.9) - -dnl pass the version string on the the makefiles -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) - -dnl Checks for programs. -AC_PROG_CC -AC_ISC_POSIX -AM_C_PROTOTYPES -if test "x$U" != "x"; then - AC_MSG_ERROR(Compiler not ANSI compliant) -fi -AM_PROG_LIBTOOL -AC_PROG_INSTALL - -dnl support for files >2GB -AC_SYS_LARGEFILE - -dnl Check for required header files -AC_HEADER_STDC - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST - -dnl need pow and fabs -AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm")) - - -dnl what functionality we want to add (read, write, display). -dnl all on by default. see libmng_conf.h for full descriptions - -dnl not building a standard shared object? -AC_ARG_ENABLE(buildso, -[ --disable-buildso disable building standard shared object]) -if test "x$enable_buildso" != "xno"; then - AC_DEFINE(MNG_BUILD_SO) -fi - -dnl we only support the full mng spec for now (no LC or VLC) -AC_DEFINE(MNG_SUPPORT_FULL) - -dnl remove support in library to read images? -AC_ARG_ENABLE(read, -[ --disable-read remove read support from library]) -if test "x$enable_read" != "xno"; then - AC_DEFINE(MNG_SUPPORT_READ) -fi - -dnl remove support in library to write images? -AC_ARG_ENABLE(write, -[ --disable-write remove write support from library]) -if test "x$enable_write" != "xno"; then - AC_DEFINE(MNG_SUPPORT_WRITE) -fi - -dnl remove support in library to display images? -AC_ARG_ENABLE(display, -[ --disable-display remove display support from library]) -if test "x$enable_display" != "xno"; then - AC_DEFINE(MNG_SUPPORT_DISPLAY) -fi - -dnl remove support for 'dynamic' MNG? -AC_ARG_ENABLE(dynamic, -[ --disable-dynamic remove dynamic MNG support from library]) -if test "x$enable_dynamic" != "xno"; then - AC_DEFINE(MNG_SUPPORT_DYNAMICMNG) -fi - -dnl remove support in library to access chunks? -AC_ARG_ENABLE(chunks, -[ --disable-chunks remove support for chunk access]) -if test "x$enable_chunks" != "xno"; then - AC_DEFINE(MNG_ACCESS_CHUNKS) -fi - -dnl disable support for accessing chunks that have been previously read? -AC_ARG_ENABLE(storechunks, -[ --disable-storechunks remove support for access of previous chunks]) -if test "x$enable_storechunks" != "xno"; then - AC_DEFINE(MNG_STORE_CHUNKS) -fi - -dnl enable support for debug tracing callbacks and messages? -AC_ARG_ENABLE(trace, -[ --enable-trace include support for debug tracing callbacks],[ -if test "x$enable_trace" = "xyes"; then - AC_DEFINE(MNG_SUPPORT_TRACE) - AC_DEFINE(MNG_TRACE_TELLTALE) -fi -]) - -dnl verbose error text -dnl this should always be on -AC_DEFINE(MNG_ERROR_TELLTALE) - - -dnl libz is required. -AC_ARG_WITH(zlib, -[ --with-zlib[=DIR] use zlib include/library files in DIR],[ - if test -d "$withval"; then - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - fi -]) -AC_CHECK_HEADER(zlib.h, - AC_CHECK_LIB(z, gzread, , AC_MSG_ERROR(zlib library not found)), - AC_MSG_ERROR(zlib header not found) -) - -dnl check for jpeg library -AC_ARG_WITH(jpeg, -[ --with-jpeg[=DIR] use jpeg include/library files in DIR], -[with_jpeg=$withval],[with_jpeg=_auto]) - - if test "x$with_jpeg" != "xno" -a "x$with_jpeg" != "xyes" -a \ - "x$with_jpeg" != "x_auto"; then - # Save in case test with directory specified fails - _cppflags=${CPPFLAGS} - _ldflags=${LDFLAGS} - _restore=1 - - CPPFLAGS="${CPPFLAGS} -I$withval/include" - LDFLAGS="${LDFLAGS} -L$withval/lib" - else - _restore=0 - fi - - if test "x$with_jpeg" != "xno"; then - AC_CHECK_HEADER(jpeglib.h, - AC_CHECK_LIB(jpeg, jpeg_read_header, [ - LIBS="$LIBS -ljpeg" - AC_DEFINE(HAVE_LIBJPEG) - _restore=0 - ], - AC_MSG_WARN(jpeg library not found)), - AC_MSG_WARN(jpeg header not found) - ) - fi - - test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags - -dnl check for lcms library -AC_ARG_WITH(lcms, -[ --with-lcms[=DIR] use lcms include/library files in DIR], -[with_lcms=$withval],[with_lcms=_auto]) - - if test "x$with_lcms" != "xno" -a "x$with_lcms" != "xyes" -a \ - "x$with_lcms" != "x_auto"; then - # Save in case test with directory specified fails - _cppflags=$CPPFLAGS - _ldflags=$LDFLAGS - _restore=1 - - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - else - _restore=0 - fi - - if test "x$with_lcms" != "xno"; then - AC_CHECK_HEADER(lcms.h, [ - have_lcms=yes - AC_CHECK_LIB(lcms, cmsCreateRGBProfile, [ - LIBS="$LIBS -llcms" - AC_DEFINE(HAVE_LIBLCMS) - dnl for now this implies MNG_INCLUDE_LCMS in the headers: - AC_DEFINE(MNG_FULL_CMS) - _restore=0 - have_lcms=yes - ],[ - have_lcms=no - ]) - ]) - dnl give feedback only if the user asked specifically for lcms - if test "x$with_lcms" != "x_auto" -a "x$have_lcms" != "xyes"; then - AC_MSG_WARN([lcms not found... disabling CMS support]) - fi - fi - - test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags - -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/Engine/lib/lmng/makefiles/makefile.bcb3 b/Engine/lib/lmng/makefiles/makefile.bcb3 deleted file mode 100644 index 3ddcb2d13..000000000 --- a/Engine/lib/lmng/makefiles/makefile.bcb3 +++ /dev/null @@ -1,108 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for Borland C++ Builder. -# it works (at least) with Borland C++ Builder v3 - -# Configuration options are now in mng_conf.h -# this option forces dll compatibility -MNGOPT = -DMNG_BUILD_DLL - -# The name of your C compiler: -CC= bcc32 - -# compiler options: -CFLAGS= -WD -O2 -Hc -w-par -k -y -v -vi -c -tWD \ - -wuse -wucp -wstv -wstu -wsig -wpin -wnod -wnak -wdef -wcln -wbbf -wasm -wamp \ - -wamb -Tkh30000 -ff -5 -I.;..\zlib;..\jpgsrc6b;..\lcms\include $(MNGOPT) - -# source files -SOURCES= libmng_hlapi.c libmng_callback_xs.c libmng_prop_xs.c libmng_chunk_xs.c \ - libmng_chunk_descr.c libmng_read.c libmng_write.c libmng_display.c \ - libmng_object_prc.c libmng_chunk_prc.c libmng_chunk_io.c libmng_error.c \ - libmng_trace.c libmng_pixels.c libmng_filter.c libmng_dither.c \ - libmng_zlib.c libmng_jpeg.c libmng_cms.c - -# object files -OBJECTS= libmng_hlapi.obj libmng_callback_xs.obj libmng_prop_xs.obj libmng_chunk_xs.obj \ - libmng_chunk_descr.obj libmng_read.obj libmng_write.obj libmng_display.obj \ - libmng_object_prc.obj libmng_chunk_prc.obj libmng_chunk_io.obj libmng_error.obj \ - libmng_trace.obj libmng_pixels.obj libmng_filter.obj libmng_dither.obj \ - libmng_zlib.obj libmng_jpeg.obj libmng_cms.obj - -# type dependancies -.c.obj: - $(CC) $(CFLAGS) -c{ $<} - -# make options -all: libmng.lib - -clean: - - del *.obj - - del libmng.lib - -# file dependancies -libmng.lib: $(OBJECTS) - - del libmng.lib - tlib libmng.lib /E /C @&&| -+libmng_hlapi.obj +libmng_callback_xs.obj +libmng_prop_xs.obj +libmng_chunk_xs.obj & -+libmng_read.obj +libmng_write.obj +libmng_display.obj & -+libmng_object_prc.obj +libmng_chunk_prc.obj +libmng_chunk_io.obj +libmng_error.obj & -+libmng_trace.obj +libmng_pixels.obj +libmng_filter.obj +libmng_dither.obj & -+libmng_zlib.obj +libmng_jpeg.obj +libmng_cms.obj -| - -libmng_hlapi.obj: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.obj: libmng_callback_xs.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.obj: libmng_prop_xs.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.obj: libmng_chunk_xs.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_error.h libmng_trace.h -libmng_read.obj: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.obj: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.obj: libmng_display.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h \ - libmng_pixels.h libmng_display.h -libmng_object_prc.obj: libmng_object_prc.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.obj: libmng_chunk_descr.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_prc.obj: libmng_chunk_prc.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.obj: libmng_chunk_io.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h libmng_chunks.h \ - libmng_chunk_io.h libmng_chunk_prc libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.obj: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.obj: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.obj: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.obj: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.obj: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.obj: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.obj: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_pixels.h libmng_jpeg.h -libmng_cms.obj: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.dj b/Engine/lib/lmng/makefiles/makefile.dj deleted file mode 100644 index 2cef08881..000000000 --- a/Engine/lib/lmng/makefiles/makefile.dj +++ /dev/null @@ -1,155 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# This makefile have been tested on DJGPP v2 -# (Based on makefile.linux since both are GNU compilers) -# -# By Silvio Fonseca - gissi@sti.com.br - -#compiler -CC=gcc - -#default build options -OPTIONS= - -#DJGPP directory -prefix=C:/DJGPP -installprefix=C:\DJGPP - -#ZLIB Library and includes -ZLIBLIB=$(prefix)/lib -#ZLIBLIB=../zlib -ZLIBINC=$(prefix)/include -#ZLIBINC=../zlib - -#Jpeg library and includes -JPEGLIB=$(prefix)/lib -#JPEGLIB=../jpgsrc -JPEGINC=$(prefix)/include -#JPEGINC=../jpgsrc - -#Lcms library and includes -LCMSLIB=$(prefix)/lib -#LCMSLIB=../lcms -LCMSINC=$(prefix)/include -#LCMSINC=../lcms - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes #-Wconversion - -CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -funroll-loops \ - $(OPTIONS) $(ALIGN) # $(WARNMORE) -g -LDFLAGS=-L. -Wl,-rpath,. \ - -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ - -L$(JPEGLIB) -Wl,-rpath,$(JPEGLIB) \ - -L$(LCMSLIB) -Wl,-rpath,$(LCMSLIB) \ - -lmng -lz -ljpeg -llcms -lm -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -OBJSDLL = $(OBJS:.0=.pic.o) - -.SUFFIXES: .c .o .pic.o - -.c.pic.o: - $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c - -all: libmng.a - -libmng.a: $(OBJS) - ar rc $@ $(OBJS) - ranlib $@ - -install: libmng.a - -@md $(installprefix)\include $(installprefix)\lib - copy libmng.h $(installprefix)\include - copy libmng_conf.h $(installprefix)\include - copy libmng_types.h $(installprefix)\include - copy libmng.a $(installprefix)\lib - -clean: - del *.o - del libmng.a - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o libmng_hlapi.pic.o: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o libmng_callback_xs.pic.o: libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o libmng_prop_xs.pic.o: libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o libmng_chunk_xs.pic.o: libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o libmng_read.pic.o: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o libmng_write.pic.o: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o libmng_display.pic.o: libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o libmng_object_prc.pic.o: libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o libmng_chunk_descr.pic.o: libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h \ - libmng_chunk_prc.h libmng_memory.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o libmng_chunk_prc.pic.o: libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o libmng_chunk_io.pic.o: libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o libmng_error.pic.o: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o libmng_trace.pic.o: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o libmng_pixels.pic.o: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o libmng_filter.pic.o: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o libmng_dither.pic.o: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o libmng_zlib.pic.o: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o libmng_jpeg.pic.o: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o libmng_cms.pic.o: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.linux b/Engine/lib/lmng/makefiles/makefile.linux deleted file mode 100644 index e06a8294c..000000000 --- a/Engine/lib/lmng/makefiles/makefile.linux +++ /dev/null @@ -1,180 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for Linux ELF with gcc -# -# (this file is heavily copied from makefile.linux in the libpng package) - -# compiler -CC=gcc - -# default build options (this forces shared library compatibility!!) -#OPTIONS = -DMNG_BUILD_SO -OPTIONS = -DMNG_BUILD_SO -DMNG_FULL_CMS - -# where "make install" puts libmng.a,libmng.so*,libmng.h,libmng_conf.h,libmng_types.h -prefix=/usr/local - -# Where the zlib library and include files are located -#ZLIBLIB=../zlib -#ZLIBINC=../zlib -ZLIBLIB=/usr/local/lib -ZLIBINC=/usr/local/include - -# Where the jpeg library and include files are located -#JPEGLIB=../jpgsrc -#JPEGINC=../jpgsrc -JPEGLIB=/usr/local/lib -JPEGINC=/usr/local/include - -# Where the lcms library and include files are located -#LCMSLIB=../lcms/lib -#LCMSINC=../lcms/source -LCMSLIB=/usr/local/lib -LCMSINC=/usr/local/include - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ - -Wmissing-declarations -Wtraditional -Wcast-align \ - -Wstrict-prototypes -Wmissing-prototypes #-Wconversion - -# for pgcc version 2.95.1, -O3 is buggy; don't use it. - -CFLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -funroll-loops \ - $(OPTIONS) $(ALIGN) # $(WARNMORE) -g -LDFLAGS=-L. -Wl,-rpath,. \ - -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \ - -L$(JPEGLIB) -Wl,-rpath,$(JPEGLIB) \ - -L$(LCMSLIB) -Wl,-rpath,$(LCMSLIB) \ - -lmng -lz -ljpeg -llcms -lm - -RANLIB=ranlib -#RANLIB=echo - -# current version numbers -MNGMAJ = 1 -MNGMIN = 1.0.9 -MNGVER = $(MNGMAJ).$(MNGMIN) - -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -OBJSDLL = $(OBJS:.0=.pic.o) - -.SUFFIXES: .c .o .pic.o - -.c.pic.o: - $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c - -all: libmng.a libmng.so - -libmng.a: $(OBJS) - ar rc $@ $(OBJS) - $(RANLIB) $@ - -libmng.so: libmng.so.$(MNGMAJ) - ln -sf libmng.so.$(MNGMAJ) libmng.so - -libmng.so.$(MNGMAJ): libmng.so.$(MNGVER) - ln -sf libmng.so.$(MNGVER) libmng.so.$(MNGMAJ) - -libmng.so.$(MNGVER): $(OBJSDLL) -# $(CC) -shared -Wl,-soname,libmng.so.$(MNGMAJ) -o libmng.so.$(MNGVER) \ -# $(OBJSDLL) -L$(ZLIBLIB) -L$(JPEGLIB) -L$(LCMSLIB) -lz -lm -lc - $(CC) -shared -Wl,-soname,libmng.so.$(MNGMAJ) -o libmng.so.$(MNGVER) \ - $(OBJSDLL) -L$(ZLIBLIB) -L$(JPEGLIB) -ljpeg -L$(LCMSLIB) -llcms \ - -lz -lm -lc - -install: libmng.a libmng.so.$(MNGVER) - -@mkdir $(INCPATH) $(LIBPATH) - cp libmng.h libmng_conf.h libmng_types.h $(INCPATH) - chmod 644 $(INCPATH)/libmng.h $(INCPATH)/libmng_conf.h $(INCPATH)/libmng_types.h - cp libmng.a libmng.so.$(MNGVER) $(LIBPATH) - chmod 755 $(LIBPATH)/libmng.so.$(MNGVER) - -@/bin/rm -f $(LIBPATH)/libmng.so.$(MNGMAJ) $(LIBPATH)/libmng.so - (cd $(LIBPATH); ln -sf libmng.so.$(MNGVER) libmng.so.$(MNGMAJ); \ - ln -sf libmng.so.$(MNGMAJ) libmng.so) - -clean: - /bin/rm -f *.o libmng.a libmng.so* - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o libmng_hlapi.pic.o: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o libmng_callback_xs.pic.o: libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o libmng_prop_xs.pic.o: libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o libmng_chunk_xs.pic.o: libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o libmng_read.pic.o: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o libmng_write.pic.o: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o libmng_display.pic.o: libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o libmng_object_prc.pic.o: libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o libmng_chunk_descr.pic.o: libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h libmng_memory.h \ - libmng_chunk_prc.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o libmng_chunk_prc.pic.o: libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o libmng_chunk_io.pic.o: libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o libmng_error.pic.o: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o libmng_trace.pic.o: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o libmng_pixels.pic.o: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o libmng_filter.pic.o: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o libmng_dither.pic.o: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o libmng_zlib.pic.o: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o libmng_jpeg.pic.o: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o libmng_cms.pic.o: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.mingw b/Engine/lib/lmng/makefiles/makefile.mingw deleted file mode 100644 index 703ae3059..000000000 --- a/Engine/lib/lmng/makefiles/makefile.mingw +++ /dev/null @@ -1,164 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is for MinGW32, it have been tested with gcc 2.95.3, -# binutils 2.11.90 and mingw-runtime 1.0 -# -# By Benoit Blanchon - benoit.blanchon@laposte.net -# -# Note : this makefile builds a static library; although it's seems to be -# possible to build working DLL and import lib, I didn't manage do to it. -# If you do, please let me know. - -# outputs -LIBMNG_A = libmng.a -INSTALL_PREFIX = C:/MinGW/ -# maybe you sould replace with anti-slashes - -# default build options -OPTIONS = -DMNG_NO_CMS -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS - -# Where the zlib library and include files are located -ZLIBLIB=-lz -#ZLIBLIB=-L../zlib -lz -#ZLIBINC=-I../zlib - -# Where the jpeg library and include files are located -JPEGLIB=-ljpeg -#JPEGLIB=-L../jpgsrc -ljpeg -#JPEGINC=-I../jpgsrc - -# Where the lcms library and include files are located -#LCMSLIB=-llcms -#LCMSLIB=-L../lcms/lib -llcms -#LCMSINC=-I../lcms/source - -# file deletion command -RM=rm -f -#RM=del - -# directory creation command -MKDIR=mkdir -p - -# file copy command -COPY=cp -#COPY=copy - -# compiler -CC=gcc - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN) -LDFLAGS=-L. -lmng $(ZLIBLIB) $(JPEGLIB) $(LCMSLIB) -lm - -# library (.a) file creation command -AR= ar rc -# second step in .a creation (use "touch" if not needed) -AR2= ranlib - -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -.SUFFIXES: .c .o - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c - -all: $(LIBMNG_A) - -$(LIBMNG_A) : $(OBJS) - $(RM) $@ - $(AR) $@ $(OBJS) - $(AR2) $@ - -install : $(LIBMNG_A) - $(MKDIR) $(INSTALL_PREFIX)include - $(COPY) libmng.h $(INSTALL_PREFIX)include - $(COPY) libmng_conf.h $(INSTALL_PREFIX)include - $(COPY) libmng_types.h $(INSTALL_PREFIX)include - $(MKDIR) $(INSTALL_PREFIX)lib - $(COPY) $(LIBMNG_A) $(INSTALL_PREFIX)lib - -clean: - $(RM) *.o - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o : libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o : libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o : libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o : libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o : libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o : libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o : libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o : libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o : libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h \ - libmng_chunk_prc.h libmng_memory.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o : libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o : libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o : libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o : libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o : libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o : libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o : libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o : libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o : libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o : libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.mingwdll b/Engine/lib/lmng/makefiles/makefile.mingwdll deleted file mode 100644 index 283721828..000000000 --- a/Engine/lib/lmng/makefiles/makefile.mingwdll +++ /dev/null @@ -1,158 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is for MinGW32, it has been tested with gcc 3.1, -# binutils 2.12.90 and mingw-runtime 2.0 -# -# By Benoit Blanchon - benoit.blanchon@laposte.net -# DLL mods by F. Richter -# - -# outputs -LIBMNG_A = libmng.a -LIBMNG_DLL = libmng.1.dll -INSTALL_PREFIX = C:/MinGW/ -# maybe you sould replace with anti-slashes - -# default build options -OPTIONS = -DMNG_BUILD_DLL -DMNG_ACCESS_CHUNKS -DMNG_STORE_CHUNKS - -# Where the zlib library and include files are located -ZLIBLIB=-lz -#ZLIBLIB=-L../zlib -lz -#ZLIBINC=-I../zlib - -# Where the jpeg library and include files are located -JPEGLIB=-ljpeg -#JPEGLIB=-L../jpgsrc -ljpeg -#JPEGINC=-I../jpgsrc - -# Where the lcms library and include files are located -#LCMSLIB=-llcms -LCMSLIB=-L../lcms/lib -llcms -LCMSINC=-I../lcms/source - -# file deletion command -RM=rm -f -#RM=del - -# directory creation command -MKDIR=mkdir -p - -# file copy command -COPY=cp -#COPY=copy - -# compiler -CC=gcc - -ALIGN= -# for i386: -#ALIGN=-malign-loops=2 -malign-functions=2 - -CFLAGS=$(ZLIBINC) $(JPEGINC) $(LCMSINC) -Wall -O3 -funroll-loops $(OPTIONS) $(ALIGN) -s -LDFLAGS=-L. -lmng $(ZLIBLIB) $(JPEGLIB) $(LCMSLIB) -lm -s - -INCPATH=$(prefix)/include -LIBPATH=$(prefix)/lib - -OBJS = \ - libmng_callback_xs.o \ - libmng_chunk_io.o \ - libmng_chunk_descr.o \ - libmng_chunk_prc.o \ - libmng_chunk_xs.o \ - libmng_cms.o \ - libmng_display.o \ - libmng_dither.o \ - libmng_error.o \ - libmng_filter.o \ - libmng_hlapi.o \ - libmng_jpeg.o \ - libmng_object_prc.o \ - libmng_pixels.o \ - libmng_prop_xs.o \ - libmng_read.o \ - libmng_trace.o \ - libmng_write.o \ - libmng_zlib.o - -.SUFFIXES: .c .o - -.c.o: - $(CC) -c $(CFLAGS) -o $@ $*.c - -all: $(LIBMNG_A) - -$(LIBMNG_A): $(LIBMNG_DLL) - -$(LIBMNG_DLL) : $(OBJS) - dllwrap --implib=$(LIBMNG_A) --dllname=$(LIBMNG_DLL) $(OBJS) $(LDFLAGS) - -install : $(LIBMNG_A) - $(MKDIR) $(INSTALL_PREFIX)include - $(COPY) libmng.h $(INSTALL_PREFIX)include - $(COPY) libmng_conf.h $(INSTALL_PREFIX)include - $(COPY) libmng_types.h $(INSTALL_PREFIX)include - $(MKDIR) $(INSTALL_PREFIX)lib - $(COPY) $(LIBMNG_A) $(INSTALL_PREFIX)lib - -clean: - $(RM) *.o - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o : libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o : libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o : libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o : libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o : libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o : libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o : libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o : libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o : libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h \ - libmng_chunk_prc.h libmng_memory.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o : libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o : libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o : libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o : libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o : libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o : libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o : libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o : libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o : libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o : libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h - diff --git a/Engine/lib/lmng/makefiles/makefile.qnx b/Engine/lib/lmng/makefiles/makefile.qnx deleted file mode 100644 index 28f18d763..000000000 --- a/Engine/lib/lmng/makefiles/makefile.qnx +++ /dev/null @@ -1,160 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for QNX Neutrino - -# Configuration options are now in libmng_conf.h - -# The architecture of your target -# one of arm, mips, ppc, sh, x86 -ARCH = mips - -# The name of the library -LIBNAME = libmng -ARNAME = $(LIBNAME).a -SONAME = $(LIBNAME).so - -# current version numbers -MNGMAJ = 1 -MNGMIN = 0.9 -MNGVER = $(MNGMAJ).$(MNGMIN) - -# The artefact output folder -OBJDIR = bin - -# Location of jpeg header files -JPEG_INC = $(QNX_TARGET)/usr/include/jpeg - -# Location of zlib header files -ZLIB_INC = $(QNX_TARGET)/usr/include - -# Location of lcms header files -# (switch on MNG_FULL_CMS in libmng_conf.h if you want to use this) -LCMS_INC = $(QNX_TARGET)/usr/include/lcms - -# default build defines -DEF = -DEF_SO = -DMNG_BUILD_SO - -# compiler options: -CFLAGS = -O2 -funroll-loops - -# include paths -INC = -I$(ZLIB_INC) -I$(JPEG_INC) - -# The name of your C compiler: -CC = nto$(ARCH)-gcc - -# source files -SRC= \ - libmng_callback_xs.c \ - libmng_chunk_io.c \ - libmng_chunk_descr.c \ - libmng_chunk_prc.c \ - libmng_chunk_xs.c \ - libmng_cms.c \ - libmng_display.c \ - libmng_dither.c \ - libmng_error.c \ - libmng_filter.c \ - libmng_hlapi.c \ - libmng_jpeg.c \ - libmng_object_prc.c \ - libmng_pixels.c \ - libmng_prop_xs.c \ - libmng_read.c \ - libmng_trace.c \ - libmng_write.c \ - libmng_zlib.c - -# object files -OBJ=$(addprefix $(OBJDIR)/$(ARCH)/, $(SRC:%.c=%.o)) - -# object files for shared object -OBJ_SO=$(addprefix $(OBJDIR)/$(ARCH)/, $(SRC:%.c=%.pic.o)) - -# type dependancies -$(OBJDIR)/$(ARCH)/%.o: %.c - $(CC) $(CFLAGS) $(INC) $(DEF) -o $@ -c $< - -$(OBJDIR)/$(ARCH)/%.pic.o: %.c - $(CC) $(CFLAGS) $(INC) $(DEF_SO) -fPIC -o $@ -c $< - -all: init $(ARNAME) $(SONAME) - -init: - if [ ! -d $(OBJDIR)/$(ARCH) ]; then mkdir -p $(OBJDIR)/$(ARCH); fi - -$(ARNAME): $(OBJ) - ar r $(OBJDIR)/$(ARCH)/$(ARNAME) $(OBJ) - -$(SONAME): $(SONAME).$(MNGMAJ) - ln -sf $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGMAJ) $(OBJDIR)/$(ARCH)/$(SONAME) - -$(SONAME).$(MNGMAJ): $(SONAME).$(MNGVER) - ln -sf $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGVER) $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGMAJ) - -$(SONAME).$(MNGVER): $(OBJ_SO) - $(CC) -shared -Wl,-soname,$(SONAME).$(MNGMAJ) -o $(OBJDIR)/$(ARCH)/$(SONAME).$(MNGVER) $(OBJ_SO) \ - -lz -lm -ljpeg -# -lz -lm -ljpeg -llcms - -clean: - rm -f $(OBJ) $(OBJ_SO) - rm -f $(OBJDIR)/$(ARCH)/$(ARNAME) $(OBJDIR)/$(ARCH)/$(SONAME)* - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -libmng_hlapi.o libmng_hlapi.pic.o: libmng_hlapi.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_memory.h libmng_error.h libmng_trace.h libmng_read.h \ - libmng_write.h libmng_display.h libmng_zlib.h libmng_cms.h libmng_zlib.h -libmng_callback_xs.o libmng_callback_xs.pic.o: libmng_callback_xs.c libmng.h \ - libmng_conf.h libmng_types.h libmng_data.h libmng_error.h libmng_trace.h -libmng_prop_xs.o libmng_prop_xs.pic.o: libmng_prop_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_error.h libmng_trace.h libmng_cms.h -libmng_chunk_xs.o libmng_chunk_xs.pic.o: libmng_chunk_xs.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h \ - libmng_error.h libmng_trace.h -libmng_read.o libmng_read.pic.o: libmng_read.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_prc.h libmng_chunk_io.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_read.h libmng_display.h -libmng_write.o libmng_write.pic.o: libmng_write.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_write.h -libmng_display.o libmng_display.pic.o: libmng_display.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_zlib.h libmng_cms.h libmng_pixels.h \ - libmng_display.h -libmng_object_prc.o libmng_object_prc.pic.o: libmng_object_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h libmng_display.h libmng_pixels.h -libmng_chunk_descr.o libmng_chunk_descr.pic.o: libmng_chunk_descr.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_descr.h libmng_memory.h \ - libmng_chunk_prc.h libmng_error.h libmng_trace.h -libmng_chunk_prc.o libmng_chunk_prc.pic.o: libmng_chunk_prc.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_chunks.h libmng_chunk_prc.h libmng_memory.h \ - libmng_error.h libmng_trace.h -libmng_chunk_io.o libmng_chunk_io.pic.o: libmng_chunk_io.c libmng.h libmng_conf.h \ - libmng_types.h libmng_data.h libmng_objects.h libmng_object_prc.h \ - libmng_chunks.h libmng_chunk_io.h libmng_chunk_prc.h libmng_memory.h libmng_error.h \ - libmng_trace.h libmng_display.h libmng_zlib.h libmng_pixels.h -libmng_error.o libmng_error.pic.o: libmng_error.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_trace.o libmng_trace.pic.o: libmng_trace.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h -libmng_pixels.o libmng_pixels.pic.o: libmng_pixels.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_memory.h libmng_error.h libmng_trace.h \ - libmng_cms.h libmng_filter.h libmng_pixels.h -libmng_filter.o libmng_filter.pic.o: libmng_filter.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_filter.h -libmng_dither.o libmng_dither.pic.o: libmng_dither.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_error.h libmng_trace.h libmng_dither.h -libmng_zlib.o libmng_zlib.pic.o: libmng_zlib.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h \ - libmng_filter.h libmng_zlib.h -libmng_jpeg.o libmng_jpeg.pic.o: libmng_jpeg.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_memory.h libmng_error.h libmng_trace.h libmng_pixels.h libmng_jpeg.h -libmng_cms.o libmng_cms.pic.o: libmng_cms.c libmng.h libmng_conf.h libmng_types.h \ - libmng_data.h libmng_objects.h libmng_error.h libmng_trace.h libmng_cms.h diff --git a/Engine/lib/lmng/makefiles/makefile.unix b/Engine/lib/lmng/makefiles/makefile.unix deleted file mode 100644 index 4d3fd97f4..000000000 --- a/Engine/lib/lmng/makefiles/makefile.unix +++ /dev/null @@ -1,67 +0,0 @@ -# -# For conditions of distribution and use, see copyright notice in libmng.h -# -# makefile for libmng - THE MNG library -# this makefile is suitable for generic unix - -# Configuration options are now in libmng_conf.h - -# The name of your C compiler: -CC= cc - -# Location of jpeg header files -JPEG_INC= /cs/include/jpeg - -# Location of zlib header files -ZLIB_INC= /cs/include - -# Location of lcms header files -# (switch on MNG_FULL_CMS in libmng_conf.h if you want to use this) -LCMS_INC= /ltmp/lcms-1.06/source - -# compiler options: -CFLAGS= -O -I. -I$(ZLIB_INC) -I$(JPEG_INC) -I$(LCMS_INC) - -# source files -SOURCES= \ - libmng_callback_xs.c \ - libmng_chunk_io.c \ - libmng_chunk_descr.c \ - libmng_chunk_prc.c \ - libmng_chunk_xs.c \ - libmng_cms.c \ - libmng_display.c \ - libmng_dither.c \ - libmng_error.c \ - libmng_filter.c \ - libmng_hlapi.c \ - libmng_jpeg.c \ - libmng_object_prc.c \ - libmng_pixels.c \ - libmng_prop_xs.c \ - libmng_read.c \ - libmng_trace.c \ - libmng_write.c \ - libmng_zlib.c - -# object files -OBJECTS= $(SOURCES:%.c=%.o) - -# type dependancies -.c.o: - $(CC) $(CFLAGS) -c $< - -all: libmng.a - -clean: - /bin/rm -f $(OBJECTS) - /bin/rm -f libmng.a - /bin/rm -f *~ core - -libmng.a: $(OBJECTS) - ar r libmng.a $(OBJECTS) - -depend: - makedepend -- $(CFLAGS) $(IFLAGS) -- *.c - -# DO NOT DELETE diff --git a/Engine/lib/lmng/makefiles/makefile.vcwin32 b/Engine/lib/lmng/makefiles/makefile.vcwin32 deleted file mode 100644 index 6f9c2c047..000000000 --- a/Engine/lib/lmng/makefiles/makefile.vcwin32 +++ /dev/null @@ -1,99 +0,0 @@ -# makefile for libmng -# Copyright (C) 2000 AM(s98t269@stmail.eng.kagawa-u.ac.jp) -# For conditions of distribution and use, see copyright notice in libmng.h -# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib -# Assumes that libjpeg.lib, *.h have been copied to ..\jpgsrc6b -# Assumes that lcmsdll.lib and lcmsstat.lib have been copied to ..\lcms\lib\msvc -# To use, do "nmake /f makefiles\makefile.vcwin32" - -# -------- Microsoft Visual C++ 4.0 and later, no assembler code -------- - -CFLAGS= -Ox -GA3s -nologo -W3 -I..\zlib -I..\jpgsrc6b -I..\lcms\include - -CC=cl -LD=link -LDFLAGS= -O=.obj - -#uncomment next to put error messages in a file -#ERRFILE= >> mngerrs - -# variables -OBJS1 = libmng_callback_xs$(O) libmng_chunk_io$(O) libmng_chunk_prc$(O) libmng_chunk_descr$(0) -OBJS2 = libmng_chunk_xs$(O) libmng_cms$(O) libmng_display$(O) libmng_dither$(O) -OBJS3 = libmng_error$(O) libmng_filter$(O) libmng_hlapi$(O) libmng_jpeg$(O) -OBJS4 = libmng_object_prc$(O) libmng_pixels$(O) libmng_prop_xs$(O) -OBJS5 = libmng_read$(O) libmng_trace$(O) libmng_write$(O) libmng_zlib$(O) - -all: libmng.lib - -libmng_callback_xs$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_io$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_descr$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_prc$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_chunk_xs$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_cms$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_display$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_dither$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_error$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_filter$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_hlapi$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_jpeg$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_object_prc$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_pixels$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_prop_xs$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_read$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_trace$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_write$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng_zlib$(O): libmng.h libmng_data.h libmng_error.h libmng_trace.h - $(CC) -c $(CFLAGS) $*.c $(ERRFILE) - -libmng.lib: $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) - echo something to del > libmng.lib - del libmng.lib - lib /OUT:libmng.lib $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) - -mngtest.exe: mngtest.obj libmng.lib - $(LD) $(LDFLAGS) mngtest.obj libmng.lib ..\zlib\zlib.lib /OUT:mngtest.exe /SUBSYSTEM:CONSOLE - -test: mngtest.exe - mngtest - -# End of makefile for libmng - diff --git a/Engine/lib/lmng/special/mozcfg/mozlibmngconf.h b/Engine/lib/lmng/special/mozcfg/mozlibmngconf.h deleted file mode 100644 index 431b2eaf2..000000000 --- a/Engine/lib/lmng/special/mozcfg/mozlibmngconf.h +++ /dev/null @@ -1,218 +0,0 @@ -/* ************************************************************************** */ -/* * * */ -/* * project : libmng * */ -/* * file : mozlibmngconf.h copyright (c) G.R-P 2003-2005 * */ -/* * version : 1.0.10 * */ -/* * * */ -/* * purpose : special config file for Mozilla * */ -/* * * */ -/* * author : Glenn Randers-Pehrson * */ -/* * * */ -/* * comment : This is the configuration file designed to minimize * */ -/* * footprint for the integration with Mozilla. * */ -/* * * */ -/* * changes : * */ -/* * * */ -/* ************************************************************************** */ - -#ifndef _mozlibmng_conf_h_ -#define _mozlibmng_conf_h_ - -/* Mozilla defines */ - -/* One or none of these may be defined via MNG_CFLAGS in "configure" */ - -#if defined(MNG_BUILD_RAW_MNG) || \ - defined(MNG_BUILD_FULL_MNG) || \ - defined(MNG_BUILD_MOZ_MNG) || \ - defined(MNG_BUILD_MOZ_NO_JNG) || \ - defined(MNG_BUILD_WEB_MNG) || \ - defined(MNG_BUILD_WEB_NO_JNG) || \ - defined(MNG_BUILD_LC) || \ - defined(MNG_BUILD_LC_NO_JNG) || \ - defined(MNG_BUILD_VLC) -# define MNG_BUILD_DEFINED -#endif - -#ifndef MNG_BUILD_DEFINED -#define MNG_BUILD_FULL_MNG -#define MNG_BUILD_DEFINED -#endif - -#if defined(MNG_BUILD_FULL_MNG) -#define MNG_DISABLE_UNUSED -#endif - -#if defined(MNG_BUILD_MOZ_MNG) -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#endif - -#if defined(MNG_BUILD_MOZ_NO_JNG) -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_JNG -#endif - -#if defined(MNG_BUILD_WEB_MNG) -#define MNG_DISABLE_UNUSED -#define MNG_DISABLE_DELTA_PNG -#define MNG_ENABLE_FOOTPRINT -#define MNG_SKIPCHUNK_MAGN -#endif - -#if defined(MNG_BUILD_WEB_NO_JNG) -#define MNG_DISABLE_UNUSED -#define MNG_DISABLE_DELTA_PNG -#define MNG_ENABLE_FOOTPRINT -#define MNG_SKIPCHUNK_MAGN -#define MNG_DISABLE_JNG -#endif - -#if defined(MNG_BUILD_LC) -#define MNG_DISABLE_DELTA_PNG -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_16_BIT -#define MNG_DISABLE_NON_LC -#endif - -#if defined(MNG_BUILD_LC_NO_JNG) -#define MNG_DISABLE_DELTA_PNG -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_16_BIT -#define MNG_DISABLE_JNG -#define MNG_DISABLE_NON_LC -#endif - -#if defined(MNG_BUILD_VLC) -#define MNG_DISABLE_DELTA_PNG -#define MNG_DISABLE_UNUSED -#define MNG_ENABLE_FOOTPRINT -#define MNG_DISABLE_16_BIT -#define MNG_DISABLE_JNG -#define MNG_DISABLE_NON_LC -#define MNG_DISABLE_NON_VLC -#endif - -#if defined(MNG_ENABLE_FOOTPRINT) -/* Perform footprint optimizations */ -#define MNG_OPTIMIZE_FOOTPRINT_COMPOSE -#define MNG_OPTIMIZE_FOOTPRINT_DIV -#define MNG_OPTIMIZE_FOOTPRINT_SWITCH -#define MNG_DECREMENT_LOOPS -#define MNG_USE_ZLIB_CRC -#define MNG_OPTIMIZE_FOOTPRINT_INIT -#define MNG_OPTIMIZE_FOOTPRINT_MAGN -#define MNG_OPTIMIZE_OBJCLEANUP -#define MNG_OPTIMIZE_CHUNKINITFREE -#define MNG_OPTIMIZE_CHUNKASSIGN -#endif - -#if defined(MNG_DISABLE_UNUSED) -/* Eliminate unused features from libmng */ -#define MNG_NO_VERSION_QUERY_SUPPORT -#define MNG_NO_OLD_VERSIONS - -#ifdef MOZ_CAIRO_GFX -#define MNG_SKIPCANVAS_RGB8 -#define MNG_SKIPCANVAS_RGB8_A8 -#else -#define MNG_SKIPCANVAS_BGRA8_PM -#endif - -#define MNG_SKIPCANVAS_ABGR8 -#define MNG_SKIPCANVAS_ARGB8 -#define MNG_SKIPCANVAS_BGR8 -#define MNG_SKIPCANVAS_BGRX8 -#define MNG_SKIPCANVAS_BGRA8 -#define MNG_SKIPCANVAS_RGBA8_PM -#define MNG_SKIPCANVAS_ARGB8_PM -#define MNG_SKIPCANVAS_ABGR8_PM -#define MNG_SKIPCANVAS_RGBA8 -#define MNG_SKIPCANVAS_RGB555 -#define MNG_SKIPCANVAS_BGR555 -#define MNG_SKIPCANVAS_RGB565 -#define MNG_SKIPCANVAS_BGR565 -#define MNG_SKIPCANVAS_RGBA565 -#define MNG_SKIPCANVAS_BGRA565 -#define MNG_SKIPCANVAS_BGR565_A8 -#define MNG_SKIP_MAXCANVAS -#define MNG_SKIPCHUNK_tEXt -#define MNG_SKIPCHUNK_zTXt -#define MNG_SKIPCHUNK_iTXt -#define MNG_SKIPCHUNK_bKGD -#define MNG_SKIPCHUNK_cHRM -#define MNG_SKIPCHUNK_hIST -#define MNG_SKIPCHUNK_iCCP -#define MNG_SKIPCHUNK_pHYs -#define MNG_SKIPCHUNK_sBIT -#define MNG_SKIPCHUNK_sPLT -#define MNG_SKIPCHUNK_tIME -#define MNG_SKIPCHUNK_evNT -#define MNG_SKIPCHUNK_eXPI -#define MNG_SKIPCHUNK_fPRI -#define MNG_SKIPCHUNK_nEED -#define MNG_SKIPCHUNK_pHYg -/* Eliminate "critical" but safe-to-ignore chunks (see mng_read_unknown()) */ -#define MNG_SKIPCHUNK_SAVE -#define MNG_SKIPCHUNK_SEEK -#define MNG_SKIPCHUNK_DBYK -#define MNG_SKIPCHUNK_ORDR -/* Eliminate unused zlib and jpeg "get" and "set" accessors */ -#define MNG_NO_ACCESS_ZLIB -#define MNG_NO_ACCESS_JPEG -/* Eliminate other unused features */ -#define MNG_NO_SUPPORT_FUNCQUERY -#define MNG_NO_DISPLAY_GO_SUPPORTED -#define MNG_NO_CURRENT_INFO -#define MNG_NO_DFLT_INFO -#define MNG_NO_LOOP_SIGNALS_SUPPORTED -#define MNG_NO_OPEN_CLOSE_STREAM -#endif - -#if defined(MNG_DISABLE_16_BIT) -/* Eliminate 16-bit support from libmng */ -#define MNG_NO_16BIT_SUPPORT -#endif - -#if defined(MNG_DISABLE_DELTA_PNG) -/* Eliminate Delta-PNG feature from libmng */ -#define MNG_NO_DELTA_PNG -#endif - -#if defined(MNG_DISABLE_NON_LC) -/* Eliminate non-MNG-LC chunks */ -#define MNG_SKIPCHUNK_BASI -#define MNG_SKIPCHUNK_CLIP -#define MNG_SKIPCHUNK_CLON -#define MNG_SKIPCHUNK_DISC -#define MNG_SKIPCHUNK_MOVE -#define MNG_SKIPCHUNK_SHOW -#define MNG_SKIPCHUNK_PAST -#endif - -#if defined(MNG_DISABLE_JNG) -/* If you change this you should also manually remove or restore - jng-recognition in mozilla/modules/libpr0n/src/imgLoader.cpp */ -#define MNG_NO_INCLUDE_JNG -#endif - -#if defined(MNG_DISABLE_NON_VLC) -/* Eliminate non-MNG-VLC chunks */ -#define MNG_SKIPCHUNK_DEFI -#define MNG_SKIPCHUNK_FRAM -#define MNG_SKIPCHUNK_LOOP -#define MNG_SKIPCHUNK_MAGN -#endif - -#if defined(MNG_DISABLE_OPTIONAL_VLC) -/* Eliminate optional MNG-VLC chunks */ -#define MNG_SKIPCHUNK_TERM -#define MNG_SKIPCHUNK_BACK -#define MNG_SKIPCHUNK_gAMA -#define MNG_SKIPCHUNK_sRGB -#endif - -#endif /* _mozlibmng_conf_h */ diff --git a/Engine/lib/lmng/unmaintained/autogen.sh b/Engine/lib/lmng/unmaintained/autogen.sh deleted file mode 100644 index 308ae3739..000000000 --- a/Engine/lib/lmng/unmaintained/autogen.sh +++ /dev/null @@ -1,50 +0,0 @@ -# autogen.sh -# -# invoke the auto* tools to create the configureation system - -# move out configure.in -if ! test -f configure.in; then - echo "copying configure.in" - ln -s makefiles/configure.in . -fi - -# move out the macros and run aclocal -if test ! -f acinclude.m4 -a -r makefiles/acinclude.m4; then - echo "copying configure macros" - ln -s makefiles/acinclude.m4 . -fi - -# copy up our Makefile template -if ! test -f Makefile.am; then - echo "copying automake template" - ln -s makefiles/Makefile.am . -fi - -echo "running aclocal" -aclocal - -# libtool is named glibtool on MacOS X -for LIBTOOLIZE in libtoolize glibtoolize nope; do - ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break -done -if test x$LIBTOOLIZE = xnope; then - echo "error: Could not find libtoolize in the path!" - echo " You'll need to install a copy of libtool before continuing" - echo " with the generation of the build system." - echo - exit 1 -fi - -echo "running $LIBTOOLIZE" -$LIBTOOLIZE --automake - -echo "running automake" -automake --foreign --add-missing - -echo "building configure script" -autoconf - -# and finally invoke our new configure -./configure $* - -# end diff --git a/Engine/lib/lungif/dgif_lib.c b/Engine/lib/lungif/dgif_lib.c deleted file mode 100644 index 8a8794840..000000000 --- a/Engine/lib/lungif/dgif_lib.c +++ /dev/null @@ -1,1096 +0,0 @@ -/****************************************************************************** - * "Gif-Lib" - Yet another gif library. - * - * Written by: Gershon Elber IBM PC Ver 1.1, Aug. 1990 - ****************************************************************************** - * The kernel of the GIF Decoding process can be found here. - ****************************************************************************** - * History: - * 16 Jun 89 - Version 1.0 by Gershon Elber. - * 3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names). - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#if defined (__MSDOS__) && !defined(__DJGPP__) && !defined(__GNUC__) -#include -#include -#include -#else -#include -#include -#endif /* __MSDOS__ */ - -#ifdef __MACOSX__ -#define HAVE_FCNTL_H -#define HAVE_UNISTD_H -#endif - -#ifdef HAVE_IO_H -#include -#endif - - -#ifdef HAVE_FCNTL_H -#include -#endif /* HAVE_FCNTL_H */ -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include -#include -#include "gif_lib.h" -#include "gif_lib_private.h" - -#define COMMENT_EXT_FUNC_CODE 0xfe /* Extension function code for - comment. */ - -/* avoid extra function call in case we use fread (TVT) */ -#define READ(_gif,_buf,_len) \ - (((GifFilePrivateType*)_gif->Private)->Read ? \ - ((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \ - fread(_buf,1,_len,((GifFilePrivateType*)_gif->Private)->File)) - -static int DGifGetWord(GifFileType *GifFile, GifWord *Word); -static int DGifSetupDecompress(GifFileType *GifFile); -static int DGifDecompressLine(GifFileType *GifFile, GifPixelType *Line, - int LineLen); -static int DGifGetPrefixChar(GifPrefixType *Prefix, int Code, int ClearCode); -static int DGifDecompressInput(GifFileType *GifFile, int *Code); -static int DGifBufferedInput(GifFileType *GifFile, GifByteType *Buf, - GifByteType *NextByte); -#ifndef _GBA_NO_FILEIO - -/****************************************************************************** - * Open a new gif file for read, given by its name. - * Returns GifFileType pointer dynamically allocated which serves as the gif - * info record. _GifError is cleared if succesfull. - *****************************************************************************/ -GifFileType * -DGifOpenFileName(const char *FileName) { - int FileHandle; - GifFileType *GifFile; - - if ((FileHandle = open(FileName, O_RDONLY -#if defined(__MSDOS__) || defined(_OPEN_BINARY) - | O_BINARY -#endif /* __MSDOS__ || _OPEN_BINARY */ - )) == -1) { - _GifError = D_GIF_ERR_OPEN_FAILED; - return NULL; - } - - GifFile = DGifOpenFileHandle(FileHandle); - if (GifFile == (GifFileType *)NULL) - close(FileHandle); - return GifFile; -} - -/****************************************************************************** - * Update a new gif file, given its file handle. - * Returns GifFileType pointer dynamically allocated which serves as the gif - * info record. _GifError is cleared if succesfull. - *****************************************************************************/ -GifFileType * -DGifOpenFileHandle(int FileHandle) { - - unsigned char Buf[GIF_STAMP_LEN + 1]; - GifFileType *GifFile; - GifFilePrivateType *Private; - FILE *f; - - GifFile = (GifFileType *)malloc(sizeof(GifFileType)); - if (GifFile == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return NULL; - } - - memset(GifFile, '\0', sizeof(GifFileType)); - - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); - if (Private == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - free((char *)GifFile); - return NULL; - } -#ifdef __MSDOS__ - setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */ -#endif /* __MSDOS__ */ - - f = fdopen(FileHandle, "rb"); /* Make it into a stream: */ - -#ifdef __MSDOS__ - setvbuf(f, NULL, _IOFBF, GIF_FILE_BUFFER_SIZE); /* And inc. stream - buffer. */ -#endif /* __MSDOS__ */ - - GifFile->Private = (VoidPtr)Private; - Private->FileHandle = FileHandle; - Private->File = f; - Private->FileState = FILE_STATE_READ; - Private->Read = 0; /* don't use alternate input method (TVT) */ - GifFile->UserData = 0; /* TVT */ - - /* Lets see if this is a GIF file: */ - if (READ(GifFile, Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) { - _GifError = D_GIF_ERR_READ_FAILED; - fclose(f); - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - /* The GIF Version number is ignored at this time. Maybe we should do - * something more useful with it. */ - Buf[GIF_STAMP_LEN] = 0; - if (strncmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) { - _GifError = D_GIF_ERR_NOT_GIF_FILE; - fclose(f); - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - if (DGifGetScreenDesc(GifFile) == GIF_ERROR) { - fclose(f); - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - _GifError = 0; - - return GifFile; -} - -#endif /* _GBA_NO_FILEIO */ - -/****************************************************************************** - * GifFileType constructor with user supplied input function (TVT) - *****************************************************************************/ -GifFileType * -DGifOpen(void *userData, - InputFunc readFunc) { - - unsigned char Buf[GIF_STAMP_LEN + 1]; - GifFileType *GifFile; - GifFilePrivateType *Private; - - GifFile = (GifFileType *)malloc(sizeof(GifFileType)); - if (GifFile == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return NULL; - } - - memset(GifFile, '\0', sizeof(GifFileType)); - - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); - if (!Private) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - free((char *)GifFile); - return NULL; - } - - GifFile->Private = (VoidPtr)Private; - Private->FileHandle = 0; - Private->File = 0; - Private->FileState = FILE_STATE_READ; - - Private->Read = readFunc; /* TVT */ - GifFile->UserData = userData; /* TVT */ - - /* Lets see if this is a GIF file: */ - if (READ(GifFile, Buf, GIF_STAMP_LEN) != GIF_STAMP_LEN) { - _GifError = D_GIF_ERR_READ_FAILED; - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - /* The GIF Version number is ignored at this time. Maybe we should do - * something more useful with it. */ - Buf[GIF_STAMP_LEN] = 0; - if (strncmp(GIF_STAMP, Buf, GIF_VERSION_POS) != 0) { - _GifError = D_GIF_ERR_NOT_GIF_FILE; - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - if (DGifGetScreenDesc(GifFile) == GIF_ERROR) { - free((char *)Private); - free((char *)GifFile); - return NULL; - } - - _GifError = 0; - - return GifFile; -} - -/****************************************************************************** - * This routine should be called before any other DGif calls. Note that - * this routine is called automatically from DGif file open routines. - *****************************************************************************/ -int -DGifGetScreenDesc(GifFileType * GifFile) { - - int i, BitsPerPixel; - GifByteType Buf[3]; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - /* Put the screen descriptor into the file: */ - if (DGifGetWord(GifFile, &GifFile->SWidth) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->SHeight) == GIF_ERROR) - return GIF_ERROR; - - if (READ(GifFile, Buf, 3) != 3) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - GifFile->SColorResolution = (((Buf[0] & 0x70) + 1) >> 4) + 1; - BitsPerPixel = (Buf[0] & 0x07) + 1; - GifFile->SBackGroundColor = Buf[1]; - if (Buf[0] & 0x80) { /* Do we have global color map? */ - - GifFile->SColorMap = MakeMapObject(1 << BitsPerPixel, NULL); - if (GifFile->SColorMap == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - - /* Get the global color map: */ - for (i = 0; i < GifFile->SColorMap->ColorCount; i++) { - if (READ(GifFile, Buf, 3) != 3) { - FreeMapObject(GifFile->SColorMap); - GifFile->SColorMap = NULL; - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - GifFile->SColorMap->Colors[i].Red = Buf[0]; - GifFile->SColorMap->Colors[i].Green = Buf[1]; - GifFile->SColorMap->Colors[i].Blue = Buf[2]; - } - } else { - GifFile->SColorMap = NULL; - } - - return GIF_OK; -} - -/****************************************************************************** - * This routine should be called before any attempt to read an image. - *****************************************************************************/ -int -DGifGetRecordType(GifFileType * GifFile, - GifRecordType * Type) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - - switch (Buf) { - case ',': - *Type = IMAGE_DESC_RECORD_TYPE; - break; - case '!': - *Type = EXTENSION_RECORD_TYPE; - break; - case ';': - *Type = TERMINATE_RECORD_TYPE; - break; - default: - *Type = UNDEFINED_RECORD_TYPE; - _GifError = D_GIF_ERR_WRONG_RECORD; - return GIF_ERROR; - } - - return GIF_OK; -} - -/****************************************************************************** - * This routine should be called before any attempt to read an image. - * Note it is assumed the Image desc. header (',') has been read. - *****************************************************************************/ -int -DGifGetImageDesc(GifFileType * GifFile) { - - int i, BitsPerPixel; - GifByteType Buf[3]; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - SavedImage *sp; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (DGifGetWord(GifFile, &GifFile->Image.Left) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->Image.Top) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->Image.Width) == GIF_ERROR || - DGifGetWord(GifFile, &GifFile->Image.Height) == GIF_ERROR) - return GIF_ERROR; - if (READ(GifFile, Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - BitsPerPixel = (Buf[0] & 0x07) + 1; - GifFile->Image.Interlace = (Buf[0] & 0x40); - if (Buf[0] & 0x80) { /* Does this image have local color map? */ - - /*** FIXME: Why do we check both of these in order to do this? - * Why do we have both Image and SavedImages? */ - if (GifFile->Image.ColorMap && GifFile->SavedImages == NULL) - FreeMapObject(GifFile->Image.ColorMap); - - GifFile->Image.ColorMap = MakeMapObject(1 << BitsPerPixel, NULL); - if (GifFile->Image.ColorMap == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - - /* Get the image local color map: */ - for (i = 0; i < GifFile->Image.ColorMap->ColorCount; i++) { - if (READ(GifFile, Buf, 3) != 3) { - FreeMapObject(GifFile->Image.ColorMap); - _GifError = D_GIF_ERR_READ_FAILED; - GifFile->Image.ColorMap = NULL; - return GIF_ERROR; - } - GifFile->Image.ColorMap->Colors[i].Red = Buf[0]; - GifFile->Image.ColorMap->Colors[i].Green = Buf[1]; - GifFile->Image.ColorMap->Colors[i].Blue = Buf[2]; - } - } else if (GifFile->Image.ColorMap) { - FreeMapObject(GifFile->Image.ColorMap); - GifFile->Image.ColorMap = NULL; - } - - if (GifFile->SavedImages) { - if ((GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * - (GifFile->ImageCount + 1))) == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - } else { - if ((GifFile->SavedImages = - (SavedImage *) malloc(sizeof(SavedImage))) == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - } - - sp = &GifFile->SavedImages[GifFile->ImageCount]; - memcpy(&sp->ImageDesc, &GifFile->Image, sizeof(GifImageDesc)); - if (GifFile->Image.ColorMap != NULL) { - sp->ImageDesc.ColorMap = MakeMapObject( - GifFile->Image.ColorMap->ColorCount, - GifFile->Image.ColorMap->Colors); - if (sp->ImageDesc.ColorMap == NULL) { - _GifError = D_GIF_ERR_NOT_ENOUGH_MEM; - return GIF_ERROR; - } - } - sp->RasterBits = (unsigned char *)NULL; - sp->ExtensionBlockCount = 0; - sp->ExtensionBlocks = (ExtensionBlock *) NULL; - - GifFile->ImageCount++; - - Private->PixelCount = (long)GifFile->Image.Width * - (long)GifFile->Image.Height; - - DGifSetupDecompress(GifFile); /* Reset decompress algorithm parameters. */ - - return GIF_OK; -} - -/****************************************************************************** - * Get one full scanned line (Line) of length LineLen from GIF file. - *****************************************************************************/ -int -DGifGetLine(GifFileType * GifFile, - GifPixelType * Line, - int LineLen) { - - GifByteType *Dummy; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (!LineLen) - LineLen = GifFile->Image.Width; - -#if defined(__MSDOS__) || defined(__GNUC__) - if ((Private->PixelCount -= LineLen) > 0xffff0000UL) { -#else - if ((Private->PixelCount -= LineLen) > 0xffff0000) { -#endif /* __MSDOS__ */ - _GifError = D_GIF_ERR_DATA_TOO_BIG; - return GIF_ERROR; - } - - if (DGifDecompressLine(GifFile, Line, LineLen) == GIF_OK) { - if (Private->PixelCount == 0) { - /* We probably would not be called any more, so lets clean - * everything before we return: need to flush out all rest of - * image until empty block (size 0) detected. We use GetCodeNext. */ - do - if (DGifGetCodeNext(GifFile, &Dummy) == GIF_ERROR) - return GIF_ERROR; - while (Dummy != NULL) ; - } - return GIF_OK; - } else - return GIF_ERROR; -} - -/****************************************************************************** - * Put one pixel (Pixel) into GIF file. - *****************************************************************************/ -int -DGifGetPixel(GifFileType * GifFile, - GifPixelType Pixel) { - - GifByteType *Dummy; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } -#if defined(__MSDOS__) || defined(__GNUC__) - if (--Private->PixelCount > 0xffff0000UL) -#else - if (--Private->PixelCount > 0xffff0000) -#endif /* __MSDOS__ */ - { - _GifError = D_GIF_ERR_DATA_TOO_BIG; - return GIF_ERROR; - } - - if (DGifDecompressLine(GifFile, &Pixel, 1) == GIF_OK) { - if (Private->PixelCount == 0) { - /* We probably would not be called any more, so lets clean - * everything before we return: need to flush out all rest of - * image until empty block (size 0) detected. We use GetCodeNext. */ - do - if (DGifGetCodeNext(GifFile, &Dummy) == GIF_ERROR) - return GIF_ERROR; - while (Dummy != NULL) ; - } - return GIF_OK; - } else - return GIF_ERROR; -} - -/****************************************************************************** - * Get an extension block (see GIF manual) from gif file. This routine only - * returns the first data block, and DGifGetExtensionNext should be called - * after this one until NULL extension is returned. - * The Extension should NOT be freed by the user (not dynamically allocated). - * Note it is assumed the Extension desc. header ('!') has been read. - *****************************************************************************/ -int -DGifGetExtension(GifFileType * GifFile, - int *ExtCode, - GifByteType ** Extension) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - *ExtCode = Buf; - - return DGifGetExtensionNext(GifFile, Extension); -} - -/****************************************************************************** - * Get a following extension block (see GIF manual) from gif file. This - * routine should be called until NULL Extension is returned. - * The Extension should NOT be freed by the user (not dynamically allocated). - *****************************************************************************/ -int -DGifGetExtensionNext(GifFileType * GifFile, - GifByteType ** Extension) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - if (Buf > 0) { - *Extension = Private->Buf; /* Use private unused buffer. */ - (*Extension)[0] = Buf; /* Pascal strings notation (pos. 0 is len.). */ - if (READ(GifFile, &((*Extension)[1]), Buf) != Buf) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - } else - *Extension = NULL; - - return GIF_OK; -} - -/****************************************************************************** - * This routine should be called last, to close the GIF file. - *****************************************************************************/ -int -DGifCloseFile(GifFileType * GifFile) { - - GifFilePrivateType *Private; - FILE *File; - - if (GifFile == NULL) - return GIF_ERROR; - - Private = (GifFilePrivateType *) GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - File = Private->File; - - if (GifFile->Image.ColorMap) { - FreeMapObject(GifFile->Image.ColorMap); - GifFile->Image.ColorMap = NULL; - } - - if (GifFile->SColorMap) { - FreeMapObject(GifFile->SColorMap); - GifFile->SColorMap = NULL; - } - - if (Private) { - free((char *)Private); - Private = NULL; - } - - if (GifFile->SavedImages) { - FreeSavedImages(GifFile); - GifFile->SavedImages = NULL; - } - - free(GifFile); - - if (File && (fclose(File) != 0)) { - _GifError = D_GIF_ERR_CLOSE_FAILED; - return GIF_ERROR; - } - return GIF_OK; -} - -/****************************************************************************** - * Get 2 bytes (word) from the given file: - *****************************************************************************/ -static int -DGifGetWord(GifFileType * GifFile, - GifWord *Word) { - - unsigned char c[2]; - - if (READ(GifFile, c, 2) != 2) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - - *Word = (((unsigned int)c[1]) << 8) + c[0]; - return GIF_OK; -} - -/****************************************************************************** - * Get the image code in compressed form. This routine can be called if the - * information needed to be piped out as is. Obviously this is much faster - * than decoding and encoding again. This routine should be followed by calls - * to DGifGetCodeNext, until NULL block is returned. - * The block should NOT be freed by the user (not dynamically allocated). - *****************************************************************************/ -int -DGifGetCode(GifFileType * GifFile, - int *CodeSize, - GifByteType ** CodeBlock) { - - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - *CodeSize = Private->BitsPerPixel; - - return DGifGetCodeNext(GifFile, CodeBlock); -} - -/****************************************************************************** - * Continue to get the image code in compressed form. This routine should be - * called until NULL block is returned. - * The block should NOT be freed by the user (not dynamically allocated). - *****************************************************************************/ -int -DGifGetCodeNext(GifFileType * GifFile, - GifByteType ** CodeBlock) { - - GifByteType Buf; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (READ(GifFile, &Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - - if (Buf > 0) { - *CodeBlock = Private->Buf; /* Use private unused buffer. */ - (*CodeBlock)[0] = Buf; /* Pascal strings notation (pos. 0 is len.). */ - if (READ(GifFile, &((*CodeBlock)[1]), Buf) != Buf) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - } else { - *CodeBlock = NULL; - Private->Buf[0] = 0; /* Make sure the buffer is empty! */ - Private->PixelCount = 0; /* And local info. indicate image read. */ - } - - return GIF_OK; -} - -/****************************************************************************** - * Setup the LZ decompression for this image: - *****************************************************************************/ -static int -DGifSetupDecompress(GifFileType * GifFile) { - - int i, BitsPerPixel; - GifByteType CodeSize; - GifPrefixType *Prefix; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - READ(GifFile, &CodeSize, 1); /* Read Code size from file. */ - BitsPerPixel = CodeSize; - - Private->Buf[0] = 0; /* Input Buffer empty. */ - Private->BitsPerPixel = BitsPerPixel; - Private->ClearCode = (1 << BitsPerPixel); - Private->EOFCode = Private->ClearCode + 1; - Private->RunningCode = Private->EOFCode + 1; - Private->RunningBits = BitsPerPixel + 1; /* Number of bits per code. */ - Private->MaxCode1 = 1 << Private->RunningBits; /* Max. code + 1. */ - Private->StackPtr = 0; /* No pixels on the pixel stack. */ - Private->LastCode = NO_SUCH_CODE; - Private->CrntShiftState = 0; /* No information in CrntShiftDWord. */ - Private->CrntShiftDWord = 0; - - Prefix = Private->Prefix; - for (i = 0; i <= LZ_MAX_CODE; i++) - Prefix[i] = NO_SUCH_CODE; - - return GIF_OK; -} - -/****************************************************************************** - * The LZ decompression routine: - * This version decompress the given gif file into Line of length LineLen. - * This routine can be called few times (one per scan line, for example), in - * order the complete the whole image. - *****************************************************************************/ -static int -DGifDecompressLine(GifFileType * GifFile, - GifPixelType * Line, - int LineLen) { - - int i = 0; - int j, CrntCode, EOFCode, ClearCode, CrntPrefix, LastCode, StackPtr; - GifByteType *Stack, *Suffix; - GifPrefixType *Prefix; - GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private; - - StackPtr = Private->StackPtr; - Prefix = Private->Prefix; - Suffix = Private->Suffix; - Stack = Private->Stack; - EOFCode = Private->EOFCode; - ClearCode = Private->ClearCode; - LastCode = Private->LastCode; - - if (StackPtr != 0) { - /* Let pop the stack off before continueing to read the gif file: */ - while (StackPtr != 0 && i < LineLen) - Line[i++] = Stack[--StackPtr]; - } - - while (i < LineLen) { /* Decode LineLen items. */ - if (DGifDecompressInput(GifFile, &CrntCode) == GIF_ERROR) - return GIF_ERROR; - - if (CrntCode == EOFCode) { - /* Note however that usually we will not be here as we will stop - * decoding as soon as we got all the pixel, or EOF code will - * not be read at all, and DGifGetLine/Pixel clean everything. */ - if (i != LineLen - 1 || Private->PixelCount != 0) { - _GifError = D_GIF_ERR_EOF_TOO_SOON; - return GIF_ERROR; - } - i++; - } else if (CrntCode == ClearCode) { - /* We need to start over again: */ - for (j = 0; j <= LZ_MAX_CODE; j++) - Prefix[j] = NO_SUCH_CODE; - Private->RunningCode = Private->EOFCode + 1; - Private->RunningBits = Private->BitsPerPixel + 1; - Private->MaxCode1 = 1 << Private->RunningBits; - LastCode = Private->LastCode = NO_SUCH_CODE; - } else { - /* Its regular code - if in pixel range simply add it to output - * stream, otherwise trace to codes linked list until the prefix - * is in pixel range: */ - if (CrntCode < ClearCode) { - /* This is simple - its pixel scalar, so add it to output: */ - Line[i++] = CrntCode; - } else { - /* Its a code to needed to be traced: trace the linked list - * until the prefix is a pixel, while pushing the suffix - * pixels on our stack. If we done, pop the stack in reverse - * (thats what stack is good for!) order to output. */ - if (Prefix[CrntCode] == NO_SUCH_CODE) { - /* Only allowed if CrntCode is exactly the running code: - * In that case CrntCode = XXXCode, CrntCode or the - * prefix code is last code and the suffix char is - * exactly the prefix of last code! */ - if (CrntCode == Private->RunningCode - 2) { - CrntPrefix = LastCode; - Suffix[Private->RunningCode - 2] = - Stack[StackPtr++] = DGifGetPrefixChar(Prefix, - LastCode, - ClearCode); - } else { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - } else - CrntPrefix = CrntCode; - - /* Now (if image is O.K.) we should not get an NO_SUCH_CODE - * During the trace. As we might loop forever, in case of - * defective image, we count the number of loops we trace - * and stop if we got LZ_MAX_CODE. obviously we can not - * loop more than that. */ - j = 0; - while (j++ <= LZ_MAX_CODE && - CrntPrefix > ClearCode && CrntPrefix <= LZ_MAX_CODE) { - Stack[StackPtr++] = Suffix[CrntPrefix]; - CrntPrefix = Prefix[CrntPrefix]; - } - if (j >= LZ_MAX_CODE || CrntPrefix > LZ_MAX_CODE) { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - /* Push the last character on stack: */ - Stack[StackPtr++] = CrntPrefix; - - /* Now lets pop all the stack into output: */ - while (StackPtr != 0 && i < LineLen) - Line[i++] = Stack[--StackPtr]; - } - if (LastCode != NO_SUCH_CODE) { - Prefix[Private->RunningCode - 2] = LastCode; - - if (CrntCode == Private->RunningCode - 2) { - /* Only allowed if CrntCode is exactly the running code: - * In that case CrntCode = XXXCode, CrntCode or the - * prefix code is last code and the suffix char is - * exactly the prefix of last code! */ - Suffix[Private->RunningCode - 2] = - DGifGetPrefixChar(Prefix, LastCode, ClearCode); - } else { - Suffix[Private->RunningCode - 2] = - DGifGetPrefixChar(Prefix, CrntCode, ClearCode); - } - } - LastCode = CrntCode; - } - } - - Private->LastCode = LastCode; - Private->StackPtr = StackPtr; - - return GIF_OK; -} - -/****************************************************************************** - * Routine to trace the Prefixes linked list until we get a prefix which is - * not code, but a pixel value (less than ClearCode). Returns that pixel value. - * If image is defective, we might loop here forever, so we limit the loops to - * the maximum possible if image O.k. - LZ_MAX_CODE times. - *****************************************************************************/ -static int -DGifGetPrefixChar(GifPrefixType *Prefix, - int Code, - int ClearCode) { - - int i = 0; - - while (Code > ClearCode && i++ <= LZ_MAX_CODE) - Code = Prefix[Code]; - return Code; -} - -/****************************************************************************** - * Interface for accessing the LZ codes directly. Set Code to the real code - * (12bits), or to -1 if EOF code is returned. - *****************************************************************************/ -int -DGifGetLZCodes(GifFileType * GifFile, - int *Code) { - - GifByteType *CodeBlock; - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - if (!IS_READABLE(Private)) { - /* This file was NOT open for reading: */ - _GifError = D_GIF_ERR_NOT_READABLE; - return GIF_ERROR; - } - - if (DGifDecompressInput(GifFile, Code) == GIF_ERROR) - return GIF_ERROR; - - if (*Code == Private->EOFCode) { - /* Skip rest of codes (hopefully only NULL terminating block): */ - do { - if (DGifGetCodeNext(GifFile, &CodeBlock) == GIF_ERROR) - return GIF_ERROR; - } while (CodeBlock != NULL) ; - - *Code = -1; - } else if (*Code == Private->ClearCode) { - /* We need to start over again: */ - Private->RunningCode = Private->EOFCode + 1; - Private->RunningBits = Private->BitsPerPixel + 1; - Private->MaxCode1 = 1 << Private->RunningBits; - } - - return GIF_OK; -} - -/****************************************************************************** - * The LZ decompression input routine: - * This routine is responsable for the decompression of the bit stream from - * 8 bits (bytes) packets, into the real codes. - * Returns GIF_OK if read succesfully. - *****************************************************************************/ -static int -DGifDecompressInput(GifFileType * GifFile, - int *Code) { - - GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private; - - GifByteType NextByte; - static unsigned short CodeMasks[] = { - 0x0000, 0x0001, 0x0003, 0x0007, - 0x000f, 0x001f, 0x003f, 0x007f, - 0x00ff, 0x01ff, 0x03ff, 0x07ff, - 0x0fff - }; - /* The image can't contain more than LZ_BITS per code. */ - if (Private->RunningBits > LZ_BITS) { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - - while (Private->CrntShiftState < Private->RunningBits) { - /* Needs to get more bytes from input stream for next code: */ - if (DGifBufferedInput(GifFile, Private->Buf, &NextByte) == GIF_ERROR) { - return GIF_ERROR; - } - Private->CrntShiftDWord |= - ((unsigned long)NextByte) << Private->CrntShiftState; - Private->CrntShiftState += 8; - } - *Code = Private->CrntShiftDWord & CodeMasks[Private->RunningBits]; - - Private->CrntShiftDWord >>= Private->RunningBits; - Private->CrntShiftState -= Private->RunningBits; - - /* If code cannot fit into RunningBits bits, must raise its size. Note - * however that codes above 4095 are used for special signaling. - * If we're using LZ_BITS bits already and we're at the max code, just - * keep using the table as it is, don't increment Private->RunningCode. - */ - if (Private->RunningCode < LZ_MAX_CODE + 2 && - ++Private->RunningCode > Private->MaxCode1 && - Private->RunningBits < LZ_BITS) { - Private->MaxCode1 <<= 1; - Private->RunningBits++; - } - return GIF_OK; -} - -/****************************************************************************** - * This routines read one gif data block at a time and buffers it internally - * so that the decompression routine could access it. - * The routine returns the next byte from its internal buffer (or read next - * block in if buffer empty) and returns GIF_OK if succesful. - *****************************************************************************/ -static int -DGifBufferedInput(GifFileType * GifFile, - GifByteType * Buf, - GifByteType * NextByte) { - - if (Buf[0] == 0) { - /* Needs to read the next buffer - this one is empty: */ - if (READ(GifFile, Buf, 1) != 1) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - /* There shouldn't be any empty data blocks here as the LZW spec - * says the LZW termination code should come first. Therefore we - * shouldn't be inside this routine at that point. - */ - if (Buf[0] == 0) { - _GifError = D_GIF_ERR_IMAGE_DEFECT; - return GIF_ERROR; - } - if (READ(GifFile, &Buf[1], Buf[0]) != Buf[0]) { - _GifError = D_GIF_ERR_READ_FAILED; - return GIF_ERROR; - } - *NextByte = Buf[1]; - Buf[1] = 2; /* We use now the second place as last char read! */ - Buf[0]--; - } else { - *NextByte = Buf[Buf[1]++]; - Buf[0]--; - } - - return GIF_OK; -} -#ifndef _GBA_NO_FILEIO - -/****************************************************************************** - * This routine reads an entire GIF into core, hanging all its state info off - * the GifFileType pointer. Call DGifOpenFileName() or DGifOpenFileHandle() - * first to initialize I/O. Its inverse is EGifSpew(). - ******************************************************************************/ -int -DGifSlurp(GifFileType * GifFile) { - - int ImageSize; - GifRecordType RecordType; - SavedImage *sp; - GifByteType *ExtData; - SavedImage temp_save; - - temp_save.ExtensionBlocks = NULL; - temp_save.ExtensionBlockCount = 0; - - do { - if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) - return (GIF_ERROR); - - switch (RecordType) { - case IMAGE_DESC_RECORD_TYPE: - if (DGifGetImageDesc(GifFile) == GIF_ERROR) - return (GIF_ERROR); - - sp = &GifFile->SavedImages[GifFile->ImageCount - 1]; - ImageSize = sp->ImageDesc.Width * sp->ImageDesc.Height; - - sp->RasterBits = (unsigned char *)malloc(ImageSize * - sizeof(GifPixelType)); - if (sp->RasterBits == NULL) { - return GIF_ERROR; - } - if (DGifGetLine(GifFile, sp->RasterBits, ImageSize) == - GIF_ERROR) - return (GIF_ERROR); - if (temp_save.ExtensionBlocks) { - sp->ExtensionBlocks = temp_save.ExtensionBlocks; - sp->ExtensionBlockCount = temp_save.ExtensionBlockCount; - - temp_save.ExtensionBlocks = NULL; - temp_save.ExtensionBlockCount = 0; - - /* FIXME: The following is wrong. It is left in only for - * backwards compatibility. Someday it should go away. Use - * the sp->ExtensionBlocks->Function variable instead. */ - sp->Function = sp->ExtensionBlocks[0].Function; - } - break; - - case EXTENSION_RECORD_TYPE: - if (DGifGetExtension(GifFile, &temp_save.Function, &ExtData) == - GIF_ERROR) - return (GIF_ERROR); - while (ExtData != NULL) { - - /* Create an extension block with our data */ - if (AddExtensionBlock(&temp_save, ExtData[0], &ExtData[1]) - == GIF_ERROR) - return (GIF_ERROR); - - if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR) - return (GIF_ERROR); - temp_save.Function = 0; - } - break; - - case TERMINATE_RECORD_TYPE: - break; - - default: /* Should be trapped by DGifGetRecordType */ - break; - } - } while (RecordType != TERMINATE_RECORD_TYPE); - - /* Just in case the Gif has an extension block without an associated - * image... (Should we save this into a savefile structure with no image - * instead? Have to check if the present writing code can handle that as - * well.... */ - if (temp_save.ExtensionBlocks) - FreeExtension(&temp_save); - - return (GIF_OK); -} -#endif /* _GBA_NO_FILEIO */ diff --git a/Engine/lib/lungif/gif_err.c b/Engine/lib/lungif/gif_err.c deleted file mode 100644 index ea977bdf9..000000000 --- a/Engine/lib/lungif/gif_err.c +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * "Gif-Lib" - Yet another gif library. - * - * Written by: Gershon Elber IBM PC Ver 0.1, Jun. 1989 - ***************************************************************************** - * Handle error reporting for the GIF library. - ***************************************************************************** - * History: - * 17 Jun 89 - Version 1.0 by Gershon Elber. - ****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include "gif_lib.h" - -int _GifError = 0; - -/***************************************************************************** - * Return the last GIF error (0 if none) and reset the error. - ****************************************************************************/ -int -GifLastError(void) { - int i = _GifError; - - _GifError = 0; - - return i; -} -#ifndef _GBA_NO_FILEIO - -/***************************************************************************** - * Print the last GIF error to stderr. - ****************************************************************************/ -void -PrintGifError(void) { - char *Err; - - switch (_GifError) { - case E_GIF_ERR_OPEN_FAILED: - Err = "Failed to open given file"; - break; - case E_GIF_ERR_WRITE_FAILED: - Err = "Failed to Write to given file"; - break; - case E_GIF_ERR_HAS_SCRN_DSCR: - Err = "Screen Descriptor already been set"; - break; - case E_GIF_ERR_HAS_IMAG_DSCR: - Err = "Image Descriptor is still active"; - break; - case E_GIF_ERR_NO_COLOR_MAP: - Err = "Neither Global Nor Local color map"; - break; - case E_GIF_ERR_DATA_TOO_BIG: - Err = "#Pixels bigger than Width * Height"; - break; - case E_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Fail to allocate required memory"; - break; - case E_GIF_ERR_DISK_IS_FULL: - Err = "Write failed (disk full?)"; - break; - case E_GIF_ERR_CLOSE_FAILED: - Err = "Failed to close given file"; - break; - case E_GIF_ERR_NOT_WRITEABLE: - Err = "Given file was not opened for write"; - break; - case D_GIF_ERR_OPEN_FAILED: - Err = "Failed to open given file"; - break; - case D_GIF_ERR_READ_FAILED: - Err = "Failed to Read from given file"; - break; - case D_GIF_ERR_NOT_GIF_FILE: - Err = "Given file is NOT GIF file"; - break; - case D_GIF_ERR_NO_SCRN_DSCR: - Err = "No Screen Descriptor detected"; - break; - case D_GIF_ERR_NO_IMAG_DSCR: - Err = "No Image Descriptor detected"; - break; - case D_GIF_ERR_NO_COLOR_MAP: - Err = "Neither Global Nor Local color map"; - break; - case D_GIF_ERR_WRONG_RECORD: - Err = "Wrong record type detected"; - break; - case D_GIF_ERR_DATA_TOO_BIG: - Err = "#Pixels bigger than Width * Height"; - break; - case D_GIF_ERR_NOT_ENOUGH_MEM: - Err = "Fail to allocate required memory"; - break; - case D_GIF_ERR_CLOSE_FAILED: - Err = "Failed to close given file"; - break; - case D_GIF_ERR_NOT_READABLE: - Err = "Given file was not opened for read"; - break; - case D_GIF_ERR_IMAGE_DEFECT: - Err = "Image is defective, decoding aborted"; - break; - case D_GIF_ERR_EOF_TOO_SOON: - Err = "Image EOF detected, before image complete"; - break; - default: - Err = NULL; - break; - } - if (Err != NULL) - fprintf(stderr, "\nGIF-LIB error: %s.\n", Err); - else - fprintf(stderr, "\nGIF-LIB undefined error %d.\n", _GifError); -} -#endif /* _GBA_NO_FILEIO */ diff --git a/Engine/lib/lungif/gif_lib.h b/Engine/lib/lungif/gif_lib.h deleted file mode 100644 index 54acd91b4..000000000 --- a/Engine/lib/lungif/gif_lib.h +++ /dev/null @@ -1,336 +0,0 @@ -/****************************************************************************** - * In order to make life a little bit easier when using the GIF file format, - * this library was written, and which does all the dirty work... - * - * Written by Gershon Elber, Jun. 1989 - * Hacks by Eric S. Raymond, Sep. 1992 - ****************************************************************************** - * History: - * 14 Jun 89 - Version 1.0 by Gershon Elber. - * 3 Sep 90 - Version 1.1 by Gershon Elber (Support for Gif89, Unique names) - * 15 Sep 90 - Version 2.0 by Eric S. Raymond (Changes to suoport GIF slurp) - * 26 Jun 96 - Version 3.0 by Eric S. Raymond (Full GIF89 support) - * 17 Dec 98 - Version 4.0 by Toshio Kuratomi (Fix extension writing code) - *****************************************************************************/ - -#ifndef _GIF_LIB_H_ -#define _GIF_LIB_H_ 1 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define GIF_LIB_VERSION " Version 4.1, " - -#define GIF_ERROR 0 -#define GIF_OK 1 - -#ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ -#ifndef FALSE -#define FALSE 0 -#endif /* FALSE */ - -#ifndef NULL -#define NULL 0 -#endif /* NULL */ - -#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */ -#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1 -#define GIF_VERSION_POS 3 /* Version first character in stamp. */ -#define GIF87_STAMP "GIF87a" /* First chars in file - GIF stamp. */ -#define GIF89_STAMP "GIF89a" /* First chars in file - GIF stamp. */ - -#define GIF_FILE_BUFFER_SIZE 16384 /* Files uses bigger buffers than usual. */ - -typedef int GifBooleanType; -typedef unsigned char GifPixelType; -typedef unsigned char *GifRowType; -typedef unsigned char GifByteType; -#ifdef _GBA_OPTMEM - typedef unsigned short GifPrefixType; - typedef short GifWord; -#else - typedef unsigned int GifPrefixType; - typedef int GifWord; -#endif - -#define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg) -#define GIF_EXIT(Msg) { GIF_MESSAGE(Msg); exit(-3); } - -#ifdef SYSV -#define VoidPtr char * -#else -#define VoidPtr void * -#endif /* SYSV */ - -typedef struct GifColorType { - GifByteType Red, Green, Blue; -} GifColorType; - -typedef struct ColorMapObject { - int ColorCount; - int BitsPerPixel; - GifColorType *Colors; /* on malloc(3) heap */ -} ColorMapObject; - -typedef struct GifImageDesc { - GifWord Left, Top, Width, Height, /* Current image dimensions. */ - Interlace; /* Sequential/Interlaced lines. */ - ColorMapObject *ColorMap; /* The local color map */ -} GifImageDesc; - -typedef struct GifFileType { - GifWord SWidth, SHeight, /* Screen dimensions. */ - SColorResolution, /* How many colors can we generate? */ - SBackGroundColor; /* I hope you understand this one... */ - ColorMapObject *SColorMap; /* NULL if not exists. */ - int ImageCount; /* Number of current image */ - GifImageDesc Image; /* Block describing current image */ - struct SavedImage *SavedImages; /* Use this to accumulate file state */ - VoidPtr UserData; /* hook to attach user data (TVT) */ - VoidPtr Private; /* Don't mess with this! */ -} GifFileType; - -typedef enum { - UNDEFINED_RECORD_TYPE, - SCREEN_DESC_RECORD_TYPE, - IMAGE_DESC_RECORD_TYPE, /* Begin with ',' */ - EXTENSION_RECORD_TYPE, /* Begin with '!' */ - TERMINATE_RECORD_TYPE /* Begin with ';' */ -} GifRecordType; - -/* DumpScreen2Gif routine constants identify type of window/screen to dump. - * Note all values below 1000 are reserved for the IBMPC different display - * devices (it has many!) and are compatible with the numbering TC2.0 - * (Turbo C 2.0 compiler for IBM PC) gives to these devices. - */ -typedef enum { - GIF_DUMP_SGI_WINDOW = 1000, - GIF_DUMP_X_WINDOW = 1001 -} GifScreenDumpType; - -/* func type to read gif data from arbitrary sources (TVT) */ -typedef int (*InputFunc) (GifFileType *, GifByteType *, int); - -/* func type to write gif data ro arbitrary targets. - * Returns count of bytes written. (MRB) - */ -typedef int (*OutputFunc) (GifFileType *, const GifByteType *, int); - -/****************************************************************************** - * GIF89 extension function codes -******************************************************************************/ - -#define COMMENT_EXT_FUNC_CODE 0xfe /* comment */ -#define GRAPHICS_EXT_FUNC_CODE 0xf9 /* graphics control */ -#define PLAINTEXT_EXT_FUNC_CODE 0x01 /* plaintext */ -#define APPLICATION_EXT_FUNC_CODE 0xff /* application block */ - -/****************************************************************************** - * O.K., here are the routines one can access in order to encode GIF file: - * (GIF_LIB file EGIF_LIB.C). -******************************************************************************/ - -GifFileType *EGifOpenFileName(const char *GifFileName, - int GifTestExistance); -GifFileType *EGifOpenFileHandle(int GifFileHandle); -GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc); - -int EGifSpew(GifFileType * GifFile); -void EGifSetGifVersion(const char *Version); -int EGifPutScreenDesc(GifFileType * GifFile, - int GifWidth, int GifHeight, int GifColorRes, - int GifBackGround, - const ColorMapObject * GifColorMap); -int EGifPutImageDesc(GifFileType * GifFile, int GifLeft, int GifTop, - int Width, int GifHeight, int GifInterlace, - const ColorMapObject * GifColorMap); -int EGifPutLine(GifFileType * GifFile, GifPixelType * GifLine, - int GifLineLen); -int EGifPutPixel(GifFileType * GifFile, GifPixelType GifPixel); -int EGifPutComment(GifFileType * GifFile, const char *GifComment); -int EGifPutExtensionFirst(GifFileType * GifFile, int GifExtCode, - int GifExtLen, const VoidPtr GifExtension); -int EGifPutExtensionNext(GifFileType * GifFile, int GifExtCode, - int GifExtLen, const VoidPtr GifExtension); -int EGifPutExtensionLast(GifFileType * GifFile, int GifExtCode, - int GifExtLen, const VoidPtr GifExtension); -int EGifPutExtension(GifFileType * GifFile, int GifExtCode, int GifExtLen, - const VoidPtr GifExtension); -int EGifPutCode(GifFileType * GifFile, int GifCodeSize, - const GifByteType * GifCodeBlock); -int EGifPutCodeNext(GifFileType * GifFile, - const GifByteType * GifCodeBlock); -int EGifCloseFile(GifFileType * GifFile); - -#define E_GIF_ERR_OPEN_FAILED 1 /* And EGif possible errors. */ -#define E_GIF_ERR_WRITE_FAILED 2 -#define E_GIF_ERR_HAS_SCRN_DSCR 3 -#define E_GIF_ERR_HAS_IMAG_DSCR 4 -#define E_GIF_ERR_NO_COLOR_MAP 5 -#define E_GIF_ERR_DATA_TOO_BIG 6 -#define E_GIF_ERR_NOT_ENOUGH_MEM 7 -#define E_GIF_ERR_DISK_IS_FULL 8 -#define E_GIF_ERR_CLOSE_FAILED 9 -#define E_GIF_ERR_NOT_WRITEABLE 10 - -/****************************************************************************** - * O.K., here are the routines one can access in order to decode GIF file: - * (GIF_LIB file DGIF_LIB.C). - *****************************************************************************/ -#ifndef _GBA_NO_FILEIO -GifFileType *DGifOpenFileName(const char *GifFileName); -GifFileType *DGifOpenFileHandle(int GifFileHandle); -int DGifSlurp(GifFileType * GifFile); -#endif /* _GBA_NO_FILEIO */ -GifFileType *DGifOpen(void *userPtr, InputFunc readFunc); /* new one - * (TVT) */ -int DGifGetScreenDesc(GifFileType * GifFile); -int DGifGetRecordType(GifFileType * GifFile, GifRecordType * GifType); -int DGifGetImageDesc(GifFileType * GifFile); -int DGifGetLine(GifFileType * GifFile, GifPixelType * GifLine, int GifLineLen); -int DGifGetPixel(GifFileType * GifFile, GifPixelType GifPixel); -int DGifGetComment(GifFileType * GifFile, char *GifComment); -int DGifGetExtension(GifFileType * GifFile, int *GifExtCode, - GifByteType ** GifExtension); -int DGifGetExtensionNext(GifFileType * GifFile, GifByteType ** GifExtension); -int DGifGetCode(GifFileType * GifFile, int *GifCodeSize, - GifByteType ** GifCodeBlock); -int DGifGetCodeNext(GifFileType * GifFile, GifByteType ** GifCodeBlock); -int DGifGetLZCodes(GifFileType * GifFile, int *GifCode); -int DGifCloseFile(GifFileType * GifFile); - -#define D_GIF_ERR_OPEN_FAILED 101 /* And DGif possible errors. */ -#define D_GIF_ERR_READ_FAILED 102 -#define D_GIF_ERR_NOT_GIF_FILE 103 -#define D_GIF_ERR_NO_SCRN_DSCR 104 -#define D_GIF_ERR_NO_IMAG_DSCR 105 -#define D_GIF_ERR_NO_COLOR_MAP 106 -#define D_GIF_ERR_WRONG_RECORD 107 -#define D_GIF_ERR_DATA_TOO_BIG 108 -#define D_GIF_ERR_NOT_ENOUGH_MEM 109 -#define D_GIF_ERR_CLOSE_FAILED 110 -#define D_GIF_ERR_NOT_READABLE 111 -#define D_GIF_ERR_IMAGE_DEFECT 112 -#define D_GIF_ERR_EOF_TOO_SOON 113 - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file QUANTIZE.C. -******************************************************************************/ -int QuantizeBuffer(unsigned int Width, unsigned int Height, - int *ColorMapSize, GifByteType * RedInput, - GifByteType * GreenInput, GifByteType * BlueInput, - GifByteType * OutputBuffer, - GifColorType * OutputColorMap); - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file QPRINTF.C. -******************************************************************************/ -extern int GifQuietPrint; - -#ifdef HAVE_STDARG_H - extern void GifQprintf(char *Format, ...); -#elif defined (HAVE_VARARGS_H) - extern void GifQprintf(); -#endif /* HAVE_STDARG_H */ - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file GIF_ERR.C. -******************************************************************************/ -#ifndef _GBA_NO_FILEIO -extern void PrintGifError(void); -#endif /* _GBA_NO_FILEIO */ -extern int GifLastError(void); - -/****************************************************************************** - * O.K., here are the routines from GIF_LIB file DEV2GIF.C. -******************************************************************************/ -extern int DumpScreen2Gif(const char *FileName, - int ReqGraphDriver, - long ReqGraphMode1, - long ReqGraphMode2, - long ReqGraphMode3); - -/***************************************************************************** - * - * Everything below this point is new after version 1.2, supporting `slurp - * mode' for doing I/O in two big belts with all the image-bashing in core. - * - *****************************************************************************/ - -/****************************************************************************** - * Color Map handling from ALLOCGIF.C - *****************************************************************************/ - -extern ColorMapObject *MakeMapObject(int ColorCount, - const GifColorType * ColorMap); -extern void FreeMapObject(ColorMapObject * Object); -extern ColorMapObject *UnionColorMap(const ColorMapObject * ColorIn1, - const ColorMapObject * ColorIn2, - GifPixelType ColorTransIn2[]); -extern int BitSize(int n); - -/****************************************************************************** - * Support for the in-core structures allocation (slurp mode). - *****************************************************************************/ - -/* This is the in-core version of an extension record */ -typedef struct { - int ByteCount; - char *Bytes; /* on malloc(3) heap */ - int Function; /* Holds the type of the Extension block. */ -} ExtensionBlock; - -/* This holds an image header, its unpacked raster bits, and extensions */ -typedef struct SavedImage { - GifImageDesc ImageDesc; - unsigned char *RasterBits; /* on malloc(3) heap */ - int Function; /* DEPRECATED: Use ExtensionBlocks[x].Function instead */ - int ExtensionBlockCount; - ExtensionBlock *ExtensionBlocks; /* on malloc(3) heap */ -} SavedImage; - -extern void ApplyTranslation(SavedImage * Image, GifPixelType Translation[]); -extern void MakeExtension(SavedImage * New, int Function); -extern int AddExtensionBlock(SavedImage * New, int Len, - unsigned char ExtData[]); -extern void FreeExtension(SavedImage * Image); -extern SavedImage *MakeSavedImage(GifFileType * GifFile, - const SavedImage * CopyFrom); -extern void FreeSavedImages(GifFileType * GifFile); - -/****************************************************************************** - * The library's internal utility font - *****************************************************************************/ - -#define GIF_FONT_WIDTH 8 -#define GIF_FONT_HEIGHT 8 -extern unsigned char AsciiTable[][GIF_FONT_WIDTH]; - -#ifdef _WIN32 - extern void DrawGifText(SavedImage * Image, -#else - extern void DrawText(SavedImage * Image, -#endif - const int x, const int y, - const char *legend, const int color); - -extern void DrawBox(SavedImage * Image, - const int x, const int y, - const int w, const int d, const int color); - -void DrawRectangle(SavedImage * Image, - const int x, const int y, - const int w, const int d, const int color); - -extern void DrawBoxedText(SavedImage * Image, - const int x, const int y, - const char *legend, - const int border, const int bg, const int fg); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* _GIF_LIB_H */ diff --git a/Engine/lib/lungif/gif_lib_private.h b/Engine/lib/lungif/gif_lib_private.h deleted file mode 100644 index 84e3738ba..000000000 --- a/Engine/lib/lungif/gif_lib_private.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _GIF_LIB_PRIVATE_H -#define _GIF_LIB_PRIVATE_H - -#include "gif_lib.h" - -#define PROGRAM_NAME "LIBUNGIF" - -#ifdef SYSV -#define VersionStr "Gif library module,\t\tEric S. Raymond\n\ - (C) Copyright 1997 Eric S. Raymond\n" -#else -#define VersionStr PROGRAM_NAME " IBMPC " GIF_LIB_VERSION \ - " Eric S. Raymond, " __DATE__ ", " \ - __TIME__ "\n" "(C) Copyright 1997 Eric S. Raymond\n" -#endif /* SYSV */ - -#define LZ_MAX_CODE 4095 /* Biggest code possible in 12 bits. */ -#define LZ_BITS 12 - -#define FLUSH_OUTPUT 4096 /* Impossible code, to signal flush. */ -#define FIRST_CODE 4097 /* Impossible code, to signal first. */ -#define NO_SUCH_CODE 4098 /* Impossible code, to signal empty. */ - -#define FILE_STATE_WRITE 0x01 -#define FILE_STATE_SCREEN 0x02 -#define FILE_STATE_IMAGE 0x04 -#define FILE_STATE_READ 0x08 - -#define IS_READABLE(Private) (Private->FileState & FILE_STATE_READ) -#define IS_WRITEABLE(Private) (Private->FileState & FILE_STATE_WRITE) - -typedef struct GifFilePrivateType { - GifWord FileState, FileHandle, /* Where all this data goes to! */ - BitsPerPixel, /* Bits per pixel (Codes uses at least this + 1). */ - ClearCode, /* The CLEAR LZ code. */ - EOFCode, /* The EOF LZ code. */ - RunningCode, /* The next code algorithm can generate. */ - RunningBits, /* The number of bits required to represent RunningCode. */ - MaxCode1, /* 1 bigger than max. possible code, in RunningBits bits. */ - LastCode, /* The code before the current code. */ - CrntCode, /* Current algorithm code. */ - StackPtr, /* For character stack (see below). */ - CrntShiftState; /* Number of bits in CrntShiftDWord. */ - unsigned long CrntShiftDWord; /* For bytes decomposition into codes. */ - unsigned long PixelCount; /* Number of pixels in image. */ - FILE *File; /* File as stream. */ - InputFunc Read; /* function to read gif input (TVT) */ - OutputFunc Write; /* function to write gif output (MRB) */ - GifByteType Buf[256]; /* Compressed input is buffered here. */ - GifByteType Stack[LZ_MAX_CODE]; /* Decoded pixels are stacked here. */ - GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */ - GifPrefixType Prefix[LZ_MAX_CODE + 1]; -} GifFilePrivateType; - -extern int _GifError; - -#endif /* _GIF_LIB_PRIVATE_H */ diff --git a/Engine/lib/lungif/gifalloc.c b/Engine/lib/lungif/gifalloc.c deleted file mode 100644 index 79d23325b..000000000 --- a/Engine/lib/lungif/gifalloc.c +++ /dev/null @@ -1,443 +0,0 @@ -/***************************************************************************** - * "Gif-Lib" - Yet another gif library. - * - * Written by: Gershon Elber Ver 0.1, Jun. 1989 - * Extensively hacked by: Eric S. Raymond Ver 1.?, Sep 1992 - ***************************************************************************** - * GIF construction tools - ***************************************************************************** - * History: - * 15 Sep 92 - Version 1.0 by Eric Raymond. - ****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include "gif_lib.h" - -#define MAX(x, y) (((x) > (y)) ? (x) : (y)) - -/****************************************************************************** - * Miscellaneous utility functions - *****************************************************************************/ - -/* return smallest bitfield size n will fit in */ -int -BitSize(int n) { - - register int i; - - for (i = 1; i <= 8; i++) - if ((1 << i) >= n) - break; - return (i); -} - -/****************************************************************************** - * Color map object functions - *****************************************************************************/ - -/* - * Allocate a color map of given size; initialize with contents of - * ColorMap if that pointer is non-NULL. - */ -ColorMapObject * -MakeMapObject(int ColorCount, - const GifColorType * ColorMap) { - - ColorMapObject *Object; - - /*** FIXME: Our ColorCount has to be a power of two. Is it necessary to - * make the user know that or should we automatically round up instead? */ - if (ColorCount != (1 << BitSize(ColorCount))) { - return ((ColorMapObject *) NULL); - } - - Object = (ColorMapObject *)malloc(sizeof(ColorMapObject)); - if (Object == (ColorMapObject *) NULL) { - return ((ColorMapObject *) NULL); - } - - Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType)); - if (Object->Colors == (GifColorType *) NULL) { - return ((ColorMapObject *) NULL); - } - - Object->ColorCount = ColorCount; - Object->BitsPerPixel = BitSize(ColorCount); - - if (ColorMap) { - memcpy((char *)Object->Colors, - (char *)ColorMap, ColorCount * sizeof(GifColorType)); - } - - return (Object); -} - -/* - * Free a color map object - */ -void -FreeMapObject(ColorMapObject * Object) { - - if (Object != NULL) { - free(Object->Colors); - free(Object); - /*** FIXME: - * When we are willing to break API we need to make this function - * FreeMapObject(ColorMapObject **Object) - * and do this assignment to NULL here: - * *Object = NULL; - */ - } -} - -#ifdef DEBUG -void -DumpColorMap(ColorMapObject * Object, - FILE * fp) { - - if (Object) { - int i, j, Len = Object->ColorCount; - - for (i = 0; i < Len; i += 4) { - for (j = 0; j < 4 && j < Len; j++) { - fprintf(fp, "%3d: %02x %02x %02x ", i + j, - Object->Colors[i + j].Red, - Object->Colors[i + j].Green, - Object->Colors[i + j].Blue); - } - fprintf(fp, "\n"); - } - } -} -#endif /* DEBUG */ - -/* - * Compute the union of two given color maps and return it. If result can't - * fit into 256 colors, NULL is returned, the allocated union otherwise. - * ColorIn1 is copied as is to ColorUnion, while colors from ColorIn2 are - * copied iff they didn't exist before. ColorTransIn2 maps the old - * ColorIn2 into ColorUnion color map table. - */ -ColorMapObject * -UnionColorMap(const ColorMapObject * ColorIn1, - const ColorMapObject * ColorIn2, - GifPixelType ColorTransIn2[]) { - - int i, j, CrntSlot, RoundUpTo, NewBitSize; - ColorMapObject *ColorUnion; - - /* - * Allocate table which will hold the result for sure. - */ - ColorUnion = MakeMapObject(MAX(ColorIn1->ColorCount, - ColorIn2->ColorCount) * 2, NULL); - - if (ColorUnion == NULL) - return (NULL); - - /* Copy ColorIn1 to ColorUnionSize; */ - /*** FIXME: What if there are duplicate entries into the colormap to begin - * with? */ - for (i = 0; i < ColorIn1->ColorCount; i++) - ColorUnion->Colors[i] = ColorIn1->Colors[i]; - CrntSlot = ColorIn1->ColorCount; - - /* - * Potentially obnoxious hack: - * - * Back CrntSlot down past all contiguous {0, 0, 0} slots at the end - * of table 1. This is very useful if your display is limited to - * 16 colors. - */ - while (ColorIn1->Colors[CrntSlot - 1].Red == 0 - && ColorIn1->Colors[CrntSlot - 1].Green == 0 - && ColorIn1->Colors[CrntSlot - 1].Blue == 0) - CrntSlot--; - - /* Copy ColorIn2 to ColorUnionSize (use old colors if they exist): */ - for (i = 0; i < ColorIn2->ColorCount && CrntSlot <= 256; i++) { - /* Let's see if this color already exists: */ - /*** FIXME: Will it ever occur that ColorIn2 will contain duplicate - * entries? So we should search from 0 to CrntSlot rather than - * ColorIn1->ColorCount? - */ - for (j = 0; j < ColorIn1->ColorCount; j++) - if (memcmp (&ColorIn1->Colors[j], &ColorIn2->Colors[i], - sizeof(GifColorType)) == 0) - break; - - if (j < ColorIn1->ColorCount) - ColorTransIn2[i] = j; /* color exists in Color1 */ - else { - /* Color is new - copy it to a new slot: */ - ColorUnion->Colors[CrntSlot] = ColorIn2->Colors[i]; - ColorTransIn2[i] = CrntSlot++; - } - } - - if (CrntSlot > 256) { - FreeMapObject(ColorUnion); - return ((ColorMapObject *) NULL); - } - - NewBitSize = BitSize(CrntSlot); - RoundUpTo = (1 << NewBitSize); - - if (RoundUpTo != ColorUnion->ColorCount) { - register GifColorType *Map = ColorUnion->Colors; - - /* - * Zero out slots up to next power of 2. - * We know these slots exist because of the way ColorUnion's - * start dimension was computed. - */ - for (j = CrntSlot; j < RoundUpTo; j++) - Map[j].Red = Map[j].Green = Map[j].Blue = 0; - - /* perhaps we can shrink the map? */ - if (RoundUpTo < ColorUnion->ColorCount) - ColorUnion->Colors = (GifColorType *)realloc(Map, - sizeof(GifColorType) * RoundUpTo); - } - - ColorUnion->ColorCount = RoundUpTo; - ColorUnion->BitsPerPixel = NewBitSize; - - return (ColorUnion); -} - -/* - * Apply a given color translation to the raster bits of an image - */ -void -ApplyTranslation(SavedImage * Image, - GifPixelType Translation[]) { - - register int i; - register int RasterSize = Image->ImageDesc.Height * Image->ImageDesc.Width; - - for (i = 0; i < RasterSize; i++) - Image->RasterBits[i] = Translation[Image->RasterBits[i]]; -} - -/****************************************************************************** - * Extension record functions - *****************************************************************************/ - -void -MakeExtension(SavedImage * New, - int Function) { - - New->Function = Function; - /*** FIXME: - * Someday we might have to deal with multiple extensions. - * ??? Was this a note from Gershon or from me? Does the multiple - * extension blocks solve this or do we need multiple Functions? Or is - * this an obsolete function? (People should use AddExtensionBlock - * instead?) - * Looks like AddExtensionBlock needs to take the int Function argument - * then it can take the place of this function. Right now people have to - * use both. Fix AddExtensionBlock and add this to the deprecation list. - */ -} - -int -AddExtensionBlock(SavedImage * New, - int Len, - unsigned char ExtData[]) { - - ExtensionBlock *ep; - - if (New->ExtensionBlocks == NULL) - New->ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock)); - else - New->ExtensionBlocks = (ExtensionBlock *)realloc(New->ExtensionBlocks, - sizeof(ExtensionBlock) * - (New->ExtensionBlockCount + 1)); - - if (New->ExtensionBlocks == NULL) - return (GIF_ERROR); - - ep = &New->ExtensionBlocks[New->ExtensionBlockCount++]; - - ep->ByteCount=Len; - ep->Bytes = (char *)malloc(ep->ByteCount); - if (ep->Bytes == NULL) - return (GIF_ERROR); - - if (ExtData) { - memcpy(ep->Bytes, ExtData, Len); - ep->Function = New->Function; - } - - return (GIF_OK); -} - -void -FreeExtension(SavedImage * Image) -{ - ExtensionBlock *ep; - - if ((Image == NULL) || (Image->ExtensionBlocks == NULL)) { - return; - } - for (ep = Image->ExtensionBlocks; - ep < (Image->ExtensionBlocks + Image->ExtensionBlockCount); ep++) - (void)free((char *)ep->Bytes); - free((char *)Image->ExtensionBlocks); - Image->ExtensionBlocks = NULL; -} - -/****************************************************************************** - * Image block allocation functions -******************************************************************************/ - -/* Private Function: - * Frees the last image in the GifFile->SavedImages array - */ -void -FreeLastSavedImage(GifFileType *GifFile) { - - SavedImage *sp; - - if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) - return; - - /* Remove one SavedImage from the GifFile */ - GifFile->ImageCount--; - sp = &GifFile->SavedImages[GifFile->ImageCount]; - - /* Deallocate its Colormap */ - if (sp->ImageDesc.ColorMap) { - FreeMapObject(sp->ImageDesc.ColorMap); - sp->ImageDesc.ColorMap = NULL; - } - - /* Deallocate the image data */ - if (sp->RasterBits) - free((char *)sp->RasterBits); - - /* Deallocate any extensions */ - if (sp->ExtensionBlocks) - FreeExtension(sp); - - /*** FIXME: We could realloc the GifFile->SavedImages structure but is - * there a point to it? Saves some memory but we'd have to do it every - * time. If this is used in FreeSavedImages then it would be inefficient - * (The whole array is going to be deallocated.) If we just use it when - * we want to free the last Image it's convenient to do it here. - */ -} - -/* - * Append an image block to the SavedImages array - */ -SavedImage * -MakeSavedImage(GifFileType * GifFile, - const SavedImage * CopyFrom) { - - SavedImage *sp; - - if (GifFile->SavedImages == NULL) - GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage)); - else - GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * (GifFile->ImageCount + 1)); - - if (GifFile->SavedImages == NULL) - return ((SavedImage *)NULL); - else { - sp = &GifFile->SavedImages[GifFile->ImageCount++]; - memset((char *)sp, '\0', sizeof(SavedImage)); - - if (CopyFrom) { - memcpy((char *)sp, CopyFrom, sizeof(SavedImage)); - - /* - * Make our own allocated copies of the heap fields in the - * copied record. This guards against potential aliasing - * problems. - */ - - /* first, the local color map */ - if (sp->ImageDesc.ColorMap) { - sp->ImageDesc.ColorMap = MakeMapObject( - CopyFrom->ImageDesc.ColorMap->ColorCount, - CopyFrom->ImageDesc.ColorMap->Colors); - if (sp->ImageDesc.ColorMap == NULL) { - FreeLastSavedImage(GifFile); - return (SavedImage *)(NULL); - } - } - - /* next, the raster */ - sp->RasterBits = (unsigned char *)malloc(sizeof(GifPixelType) * - CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width); - if (sp->RasterBits == NULL) { - FreeLastSavedImage(GifFile); - return (SavedImage *)(NULL); - } - memcpy(sp->RasterBits, CopyFrom->RasterBits, - sizeof(GifPixelType) * CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width); - - /* finally, the extension blocks */ - if (sp->ExtensionBlocks) { - sp->ExtensionBlocks = (ExtensionBlock *)malloc( - sizeof(ExtensionBlock) * - CopyFrom->ExtensionBlockCount); - if (sp->ExtensionBlocks == NULL) { - FreeLastSavedImage(GifFile); - return (SavedImage *)(NULL); - } - memcpy(sp->ExtensionBlocks, CopyFrom->ExtensionBlocks, - sizeof(ExtensionBlock) * CopyFrom->ExtensionBlockCount); - - /* - * For the moment, the actual blocks can take their - * chances with free(). We'll fix this later. - *** FIXME: [Better check this out... Toshio] - * 2004 May 27: Looks like this was an ESR note. - * It means the blocks are shallow copied from InFile to - * OutFile. However, I don't see that in this code.... - * Did ESR fix it but never remove this note (And other notes - * in gifspnge?) - */ - } - } - - return (sp); - } -} - -void -FreeSavedImages(GifFileType * GifFile) { - - SavedImage *sp; - - if ((GifFile == NULL) || (GifFile->SavedImages == NULL)) { - return; - } - for (sp = GifFile->SavedImages; - sp < GifFile->SavedImages + GifFile->ImageCount; sp++) { - if (sp->ImageDesc.ColorMap) { - FreeMapObject(sp->ImageDesc.ColorMap); - sp->ImageDesc.ColorMap = NULL; - } - - if (sp->RasterBits) - free((char *)sp->RasterBits); - - if (sp->ExtensionBlocks) - FreeExtension(sp); - } - free((char *)GifFile->SavedImages); - GifFile->SavedImages=NULL; -} diff --git a/Tools/CMake/libraries/lmng.cmake b/Tools/CMake/libraries/lmng.cmake deleted file mode 100644 index 3564e362d..000000000 --- a/Tools/CMake/libraries/lmng.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright (c) 2014 GarageGames, LLC -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# ----------------------------------------------------------------------------- - -project(lmng) - - -addDef(MNG_OPTIMIZE_OBJCLEANUP) - -addInclude(${libDir}/lpng) -addInclude(${libDir}/zlib) -addInclude(${libDir}/ljpeg) - -finishLibrary("${libDir}/${PROJECT_NAME}") diff --git a/Tools/CMake/libraries/lungif.cmake b/Tools/CMake/libraries/lungif.cmake deleted file mode 100644 index 910a9922f..000000000 --- a/Tools/CMake/libraries/lungif.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# ----------------------------------------------------------------------------- -# Copyright (c) 2014 GarageGames, LLC -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# ----------------------------------------------------------------------------- - -project(lungif) - -addDef(_GBA_NO_FILEIO) - - -finishLibrary("${libDir}/${PROJECT_NAME}") diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 80b6e60b0..ccd0c0882 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -621,9 +621,7 @@ endif() ############################################################################### # Common Libraries ############################################################################### -addLib(lmng) addLib(lpng) -addLib(lungif) addLib(ljpeg) addLib(zlib) addLib(tinyxml) From 45879b67ffbd15cb5ebaf49fcbf384f6479ad713 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 10 Jan 2018 09:49:28 -0600 Subject: [PATCH 071/312] Loader files didn't properly get deleted with the libmng and lungif library removal. --- .../source/gfx/bitmap/loaders/bitmapGif.cpp | 232 ---------- .../source/gfx/bitmap/loaders/bitmapMng.cpp | 422 ------------------ 2 files changed, 654 deletions(-) delete mode 100644 Engine/source/gfx/bitmap/loaders/bitmapGif.cpp delete mode 100644 Engine/source/gfx/bitmap/loaders/bitmapMng.cpp diff --git a/Engine/source/gfx/bitmap/loaders/bitmapGif.cpp b/Engine/source/gfx/bitmap/loaders/bitmapGif.cpp deleted file mode 100644 index 56bf51cc6..000000000 --- a/Engine/source/gfx/bitmap/loaders/bitmapGif.cpp +++ /dev/null @@ -1,232 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/platform.h" - -#include "core/stream/fileStream.h" -#include "core/util/path.h" - -#include "gfx/bitmap/gBitmap.h" - -// This must come after our headers due to a conflicting definition of VoidPtr -#include "lungif/gif_lib.h" - - -using namespace Torque; - -static bool sReadGIF(Stream &stream, GBitmap *bitmap); -static bool sWriteGIF(GBitmap *bitmap, Stream &stream, U32 compressionLevel); - -static struct _privateRegisterGIF -{ - _privateRegisterGIF() - { - GBitmap::Registration reg; - - reg.extensions.push_back( "gif" ); - - reg.readFunc = sReadGIF; - reg.writeFunc = sWriteGIF; - - GBitmap::sRegisterFormat( reg ); - } -} sStaticRegisterGIF; - -//-------------------------------------- Replacement I/O for standard LIBjpeg -// functions. we don't wanna use -// FILE*'s... -static S32 gifReadDataFn(GifFileType *gifinfo, GifByteType *data, S32 length) -{ - Stream *stream = (Stream*)gifinfo->UserData; - AssertFatal(stream != NULL, "gifReadDataFn::No stream."); - int pos = stream->getPosition(); - if (stream->read(length, data)) - return length; - - if (stream->getStatus() == Stream::EOS) - return (stream->getPosition()-pos); - else - return 0; -} - - -//-------------------------------------- -#if 0 -// CodeReview - until we can write these, get rid of warning by disabling method. -static S32 gifWriteDataFn(GifFileType *gifinfo, GifByteType *data, S32 length) -{ - Stream *stream = (Stream*)gifinfo->UserData; - AssertFatal(stream != NULL, "gifWriteDataFn::No stream."); - if (stream->write(length, data)) - return length; - else - return 0; -} -#endif - -//-------------------------------------- -static bool sReadGIF( Stream &stream, GBitmap *bitmap ) -{ - PROFILE_SCOPE(sReadGIF); - GifFileType *gifinfo = DGifOpen( (void*)&stream, gifReadDataFn); - if (!gifinfo) - return false; - - GifRecordType recordType; - do - { - if (DGifGetRecordType(gifinfo, &recordType) == GIF_ERROR) - break; - - if (recordType == IMAGE_DESC_RECORD_TYPE) - { - if (DGifGetImageDesc(gifinfo) == GIF_ERROR) - break; - - GFXFormat format = (gifinfo->SBackGroundColor == 0 ) ? GFXFormatR8G8B8 : GFXFormatR8G8B8A8; - bitmap->allocateBitmap(gifinfo->SWidth, gifinfo->SHeight, false, format); - - // Assume no transparency until proven otherwise - bitmap->setHasTransparency(false); - - U32 gwidth = gifinfo->Image.Width ? gifinfo->Image.Width : bitmap->getWidth(); - U32 gheight= gifinfo->Image.Height ? gifinfo->Image.Height : bitmap->getHeight(); - U32 gifSize = gwidth * gheight; - U8 *data = new U8[gifSize]; - - if (DGifGetLine(gifinfo, data, gifSize) != GIF_ERROR) - { - // use the global or local color table ? - GifColorType *color = NULL; - if (gifinfo->Image.ColorMap) - color = gifinfo->Image.ColorMap->Colors; - else if (gifinfo->SColorMap) - color = gifinfo->SColorMap->Colors; - - if (color) - { - U8 *dst = bitmap->getAddress(gifinfo->Image.Left, gifinfo->Image.Top); - U8 *src = data; - U32 right = gifinfo->Image.Left + gwidth; - U32 bottom = gifinfo->Image.Top + gheight; - U32 next = (bitmap->getWidth() - gwidth) * bitmap->getBytesPerPixel(); - - if (format == GFXFormatR8G8B8A8) - { - for (U32 y=gifinfo->Image.Top; yImage.Left; xSBackGroundColor) - { - // this is a transparent pixel - dst[0] = 0; // red - dst[1] = 0; // green - dst[2] = 0; // blue - dst[3] = 0; // alpha - - bitmap->setHasTransparency(true); - } - else - { - dst[0] = color[*src].Red; - dst[1] = color[*src].Green; - dst[2] = color[*src].Blue; - dst[3] = 0; // alpha - } - dst += bitmap->getBytesPerPixel(); - } - dst += next; - } - } - else - { - for (U32 y=gifinfo->Image.Top; yImage.Left; xgetBytesPerPixel(); - } - dst += next; - } - } - delete [] data; - DGifCloseFile(gifinfo); - return true; - } - } - // failure - delete [] data; - break; - } - else if (recordType == EXTENSION_RECORD_TYPE) - { - GifByteType *extension; - S32 extCode; - - // Skip any extension blocks in file - if (DGifGetExtension(gifinfo, &extCode, &extension) != GIF_ERROR) - { - while (extension != NULL) - { - if (DGifGetExtensionNext(gifinfo, &extension) == GIF_ERROR) - { - return false; - } - } - } - else - { - return false; - } - } - - // There used to be a break right here. This caused the while condition to - // never get processed, and so it never looped through all the records in - // the GIF. I took a quick peek back at TGB and TGE histories and I am not - // sure where this change got made, but I can't figure out why the loading - // worked at all, ever, with that break in there. The only case I can think - // of is if the first record in the GIF was the bitmap data. - // [6/6/2007 Pat] - - }while (recordType != TERMINATE_RECORD_TYPE); - - - DGifCloseFile(gifinfo); - return true; -} - - -//-------------------------------------------------------------------------- -static bool sWriteGIF(GBitmap *bitmap, Stream &stream, U32 compressionLevel) -{ - TORQUE_UNUSED( bitmap ); - TORQUE_UNUSED( stream ); - TORQUE_UNUSED( compressionLevel ); - - return false; -} - - diff --git a/Engine/source/gfx/bitmap/loaders/bitmapMng.cpp b/Engine/source/gfx/bitmap/loaders/bitmapMng.cpp deleted file mode 100644 index 5caa67d93..000000000 --- a/Engine/source/gfx/bitmap/loaders/bitmapMng.cpp +++ /dev/null @@ -1,422 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "core/stream/stream.h" - -#include "gfx/bitmap/gBitmap.h" - -#include "core/color.h" - -#define MNG_NO_CMS -#define MNG_SUPPORT_READ -#define MNG_SUPPORT_WRITE -#define MNG_SUPPORT_DISPLAY -#define MNG_STORE_CHUNKS -#define MNG_ACCESS_CHUNKS - -#include "lmng/libmng.h" - - - -static bool sReadMNG(Stream &stream, GBitmap *bitmap); -static bool sWriteMNG(GBitmap *bitmap, Stream &stream, U32 compressionLevel); - -static struct _privateRegisterMNG -{ - _privateRegisterMNG() - { - GBitmap::Registration reg; - - reg.extensions.push_back( "jng" ); - reg.extensions.push_back( "mng" ); - - reg.readFunc = sReadMNG; - reg.writeFunc = sWriteMNG; - - GBitmap::sRegisterFormat( reg ); - } -} sStaticRegisterMNG; - - -typedef struct -{ - GBitmap* image; - Stream* stream; -} mngstuff; - -static mng_ptr mngMallocFn(mng_size_t size) -{ - mng_ptr data = dMalloc(size); - return dMemset(data, 0, size); -} - -static void mngFreeFn(mng_ptr p, mng_size_t size) -{ - dFree(p); -} - -static mng_bool mngOpenDataFn(mng_handle mng) -{ - return MNG_TRUE; -} - -static mng_bool mngCloseDataFn(mng_handle mng) -{ - return MNG_TRUE; -} - -static mng_bool mngReadDataFn(mng_handle mng, mng_ptr data, mng_uint32 length, mng_uint32 *bytesread) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - AssertFatal(mymng->stream != NULL, "No stream?"); - - bool success = mymng->stream->read(length, data); - *bytesread = length; // stupid hack - - AssertFatal(success, "MNG read catastrophic error!"); - if(success) - return MNG_TRUE; - else - return MNG_FALSE; -} - -#if 0 -// CodeReview - until we can write these, get rid of warning by disabling method. -static mng_bool mngWriteDataFn(mng_handle mng, mng_ptr data, mng_uint32 length, mng_uint32 *iWritten) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - AssertFatal(mymng->stream != NULL, "No stream?"); - - bool success = mymng->stream->write(length, data); - *iWritten = length; // stupid hack - - AssertFatal(success, "MNG write catastrophic error!"); - if(success) - return MNG_TRUE; - else - return MNG_FALSE; -} -#endif - -static mng_bool mngProcessHeaderFn(mng_handle mng, mng_uint32 width, mng_uint32 height) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - - GFXFormat format; - mng_uint8 colorType = mng_get_colortype(mng); - mng_uint8 alphaDepth = mng_get_alphadepth(mng); - switch(colorType) - { - case MNG_COLORTYPE_GRAY: - case MNG_COLORTYPE_JPEGGRAY: - format = GFXFormatR8G8B8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - break; - - case MNG_COLORTYPE_INDEXED: - if(alphaDepth >= 1) - { - format = GFXFormatR8G8B8A8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - } - else - { - format = GFXFormatR8G8B8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - } - - case MNG_COLORTYPE_RGB: - case MNG_COLORTYPE_JPEGCOLOR: - if(alphaDepth >= 1) - { - format = GFXFormatR8G8B8A8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - } - else - { - format = GFXFormatR8G8B8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGB8); - } - break; - - case MNG_COLORTYPE_RGBA: - case MNG_COLORTYPE_JPEGCOLORA: - format = GFXFormatR8G8B8A8; - mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8); - break; - - default: - // This case should never get hit, however it resolves a compiler - // warning - format = GFXFormat_FIRST; - AssertISV( false, "Unknown color format in bitmap MNG Loading" ); - } - - mymng->image->allocateBitmap(width, height, false, format); - return MNG_TRUE; -} - -static mng_ptr mngCanvasLineFn(mng_handle mng, mng_uint32 line) -{ - mngstuff *mymng = (mngstuff *)mng_get_userdata(mng); - return (mng_ptr) mymng->image->getAddress(0, line); -} - -static mng_bool mngRefreshFn(mng_handle mng, mng_uint32 x, mng_uint32 y, mng_uint32 w, mng_uint32 h) -{ - return MNG_TRUE; -} - -static mng_uint32 mngGetTicksFn(mng_handle mng) -{ - return 0; -} - -static mng_bool mngSetTimerFn(mng_handle mng, mng_uint32 msecs) -{ - return MNG_TRUE; -} - -static mng_bool mngFatalErrorFn(mng_handle mng, mng_int32 code, mng_int8 severity, mng_chunkid chunktype, mng_uint32 chunkseq, mng_int32 extra1, mng_int32 extra2, mng_pchar text) -{ - mng_cleanup(&mng); - - AssertISV(false, avar("Error reading MNG file:\n %s", (const char*)text)); - return MNG_FALSE; -} - -static bool sReadMNG(Stream &stream, GBitmap *bitmap) -{ - PROFILE_SCOPE(sReadMNG); - mngstuff mnginfo; - dMemset(&mnginfo, 0, sizeof(mngstuff)); - - mng_handle mng = mng_initialize(&mnginfo, mngMallocFn, mngFreeFn, MNG_NULL); - if(mng == NULL) - return false; - - // setup the callbacks - mng_setcb_errorproc(mng, mngFatalErrorFn); - mng_setcb_openstream(mng, mngOpenDataFn); - mng_setcb_closestream(mng, mngCloseDataFn); - mng_setcb_readdata(mng, mngReadDataFn); - mng_setcb_processheader(mng, mngProcessHeaderFn); - mng_setcb_getcanvasline(mng, mngCanvasLineFn); - mng_setcb_refresh(mng, mngRefreshFn); - mng_setcb_gettickcount(mng, mngGetTicksFn); - mng_setcb_settimer(mng, mngSetTimerFn); - - mnginfo.image = bitmap; - mnginfo.stream = &stream; - - mng_read(mng); - mng_display(mng); - - // hacks :( - // libmng doesn't support returning data in gray/gray alpha format, - // so we grab as RGB/RGBA and just cut off the g and b - mng_uint8 colorType = mng_get_colortype(mng); - switch(colorType) - { - case MNG_COLORTYPE_GRAY: - case MNG_COLORTYPE_JPEGGRAY: - { - GBitmap temp(*bitmap); - bitmap->deleteImage(); - bitmap->allocateBitmap(temp.getWidth(), temp.getHeight(), false, GFXFormatA8); - - // force getColor to read in in the same color value for each channel - // since the gray colortype has the real alpha in the first channel - temp.setFormat( GFXFormatA8 ); - - ColorI color; - for(U32 row = 0; row < bitmap->getHeight(); row++) - { - for(U32 col = 0; col < bitmap->getWidth(); col++) - { - temp.getColor(col, row, color); - bitmap->setColor(col, row, color); - } - } - } - - break; - } - - mng_cleanup(&mng); - - // Check this bitmap for transparency - bitmap->checkForTransparency(); - - return true; -} - -static bool sWriteMNG(GBitmap *bitmap, Stream &stream, U32 compressionLevel) -{ - TORQUE_UNUSED( bitmap ); - TORQUE_UNUSED( stream ); - TORQUE_UNUSED( compressionLevel ); - - return false; -#if 0 - // ONLY RGB bitmap writing supported at this time! - AssertFatal(getFormat() == GFXFormatR8G8B8 || getFormat() == GFXFormatR8G8B8A8 || getFormat() == GFXFormatA8, "GBitmap::writeMNG: ONLY RGB bitmap writing supported at this time."); - if(getFormat() != GFXFormatR8G8B8 && getFormat() != GFXFormatR8G8B8A8 && getFormat() != GFXFormatA8) - return (false); - - // maximum image size allowed - #define MAX_HEIGHT 4096 - if(getHeight() >= MAX_HEIGHT) - return false; - - mngstuff mnginfo; - dMemset(&mnginfo, 0, sizeof(mngstuff)); - mng_handle mng = mng_initialize(&mnginfo, mngMallocFn, mngFreeFn, MNG_NULL); - if(mng == NULL) { - return false; - } - - // setup the callbacks - mng_setcb_openstream(mng, mngOpenDataFn); - mng_setcb_closestream(mng, mngCloseDataFn); - mng_setcb_writedata(mng, mngWriteDataFn); - - // create the file in memory - mng_create(mng); - - mng_putchunk_defi(mng, 0, 0, 0, MNG_FALSE, 0, 0, MNG_FALSE, 0, getWidth(), 0, getHeight()); - - mnginfo.image = (GBitmap*)this; - mnginfo.stream = &stream; - - switch(getFormat()) { - case GFXFormatA8: - mng_putchunk_ihdr(mng, getWidth(), getHeight(), - MNG_BITDEPTH_8, - MNG_COLORTYPE_GRAY, - MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, - MNG_INTERLACE_NONE); - - // not implemented in lib yet - //mng_putimgdata_ihdr(mng, getWidth(), getHeight(), - // MNG_COLORTYPE_GRAY, - // MNG_BITDEPTH_8, - // MNG_COMPRESSION_DEFLATE, - // MNG_FILTER_ADAPTIVE, - // MNG_INTERLACE_NONE, - // MNG_CANVAS_GRAY8, mngCanvasLineFn); - break; - case GFXFormatR8G8B8: - mng_putchunk_ihdr(mng, getWidth(), getHeight(), - MNG_BITDEPTH_8, - MNG_COLORTYPE_RGB, - MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, - MNG_INTERLACE_NONE); - - // not implemented in lib yet - //mng_putimgdata_ihdr(mng, getWidth(), getHeight(), - // MNG_COLORTYPE_RGB, - // MNG_BITDEPTH_8, - // MNG_COMPRESSION_DEFLATE, - // MNG_FILTER_ADAPTIVE, - // MNG_INTERLACE_NONE, - // MNG_CANVAS_RGB8, mngCanvasLineFn); - break; - case GFXFormatR8G8B8A8: - mng_putchunk_ihdr(mng, getWidth(), getHeight(), - MNG_BITDEPTH_8, - MNG_COLORTYPE_RGBA, - MNG_COMPRESSION_DEFLATE, - MNG_FILTER_ADAPTIVE, - MNG_INTERLACE_NONE); - - // not implemented in lib yet - //mng_putimgdata_ihdr(mng, getWidth(), getHeight(), - // MNG_COLORTYPE_RGBA, - // MNG_BITDEPTH_8, - // MNG_COMPRESSION_DEFLATE, - // MNG_FILTER_ADAPTIVE, - // MNG_INTERLACE_NONE, - // MNG_CANVAS_RGBA8, mngCanvasLineFn); - break; - } - - - // below is a hack until libmng is mature enough to handle this itself - //----------------------------------------------------------------------------- - - - U8 *tmpbuffer = new U8[this->byteSize + getHeight()]; - if(tmpbuffer == 0) - { - mng_cleanup(&mng); - return false; - } - - // transfer data, add filterbyte - U32 effwdt = getWidth() * this->bytesPerPixel; - for(U32 Row = 0; Row < getHeight(); Row++) - { - // first Byte in each scanline is filterbyte: currently 0 -> no filter - tmpbuffer[Row * (effwdt + 1)] = 0; - - // copy the scanline - dMemcpy(tmpbuffer + Row * (effwdt + 1) + 1, getAddress(0, Row), effwdt); - } - - // compress data with zlib - U8 *dstbuffer = new U8[this->byteSize + getHeight()]; - if(dstbuffer == 0) - { - delete [] tmpbuffer; - mng_cleanup(&mng); - return false; - } - - U32 dstbufferSize = this->byteSize + getHeight(); - if(Z_OK != compress2((Bytef*)dstbuffer,(uLongf*)&dstbufferSize, (const Bytef*)tmpbuffer, dstbufferSize, 9)) - { - delete [] tmpbuffer; - delete [] dstbuffer; - mng_cleanup(&mng); - return false; - } - - mng_putchunk_idat(mng, dstbufferSize, (mng_ptr*)dstbuffer); - - - //----------------------------------------------------------------------------- - - - mng_putchunk_iend(mng); - - delete [] tmpbuffer; - delete [] dstbuffer; - - mng_write(mng); - mng_cleanup(&mng); - - return true; -#endif -} From 402ce9b2516bcf452e426653dff107df225d720f Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 16 Jan 2018 00:47:53 -0600 Subject: [PATCH 072/312] Adds a new function for defining static console fields on NetObjects - addNetworkedField() This lets you attach a 32 bit netMask to the field, so that when it is changed, it automatically flags the associated bitmasks on the netobject as dirty. This is to shortcut having to flag certain masks being marked as dirty through protected fields and just simplify/streamline the code. --- Engine/source/console/consoleObject.cpp | 11 ++- Engine/source/console/consoleObject.h | 4 +- Engine/source/console/simObject.cpp | 14 ++++ Engine/source/sim/netObject.cpp | 89 +++++++++++++++++++++++++ Engine/source/sim/netObject.h | 51 ++++++++++++++ 5 files changed, 167 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index d75405376..e1744c5e1 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -37,6 +37,7 @@ #include "console/engineTypes.h" #include "console/engineAPI.h" +#include "sim/netObject.h" IMPLEMENT_SCOPE( ConsoleAPI, Console,, "Functionality related to the legacy TorqueScript console system." ); @@ -372,6 +373,7 @@ void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDoc f.setDataFn = &defaultProtectedSetFn; f.getDataFn = &defaultProtectedGetFn; f.writeDataFn = &defaultProtectedWriteFn; + f.networkMask = 0; // Add to field list. sg_tempFieldList.push_back(f); @@ -396,6 +398,7 @@ void ConsoleObject::endGroup(const char* in_pGroupname) f.getDataFn = &defaultProtectedGetFn; f.writeDataFn = &defaultProtectedWriteFn; f.elementCount = 0; + f.networkMask = 0; // Add to field list. sg_tempFieldList.push_back(f); @@ -418,6 +421,7 @@ void ConsoleObject::addArray( const char *arrayName, S32 count ) f.setDataFn = &defaultProtectedSetFn; f.getDataFn = &defaultProtectedGetFn; f.writeDataFn = &defaultProtectedWriteFn; + f.networkMask = 0; // Add to field list. sg_tempFieldList.push_back(f); @@ -439,6 +443,7 @@ void ConsoleObject::endArray( const char *arrayName ) f.getDataFn = &defaultProtectedGetFn; f.writeDataFn = &defaultProtectedWriteFn; f.elementCount = 0; + f.networkMask = 0; // Add to field list. sg_tempFieldList.push_back(f); @@ -515,6 +520,7 @@ void ConsoleObject::addField(const char* in_pFieldname, f.setDataFn = &defaultProtectedSetFn; f.getDataFn = &defaultProtectedGetFn; f.writeDataFn = in_writeDataFn; + f.networkMask = 0; ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); AssertFatal(conType, "ConsoleObject::addField - invalid console type"); @@ -609,6 +615,7 @@ void ConsoleObject::addProtectedField(const char* in_pFieldname, f.setDataFn = in_setDataFn; f.getDataFn = in_getDataFn; f.writeDataFn = in_writeDataFn; + f.networkMask = 0; ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); AssertFatal(conType, "ConsoleObject::addProtectedField - invalid console type"); @@ -635,6 +642,7 @@ void ConsoleObject::addFieldV(const char* in_pFieldname, f.getDataFn = &defaultProtectedGetFn; f.writeDataFn = &defaultProtectedWriteFn; f.validator = v; + f.networkMask = 0; v->fieldIndex = sg_tempFieldList.size(); sg_tempFieldList.push_back(f); @@ -652,11 +660,12 @@ void ConsoleObject::addDeprecatedField(const char *fieldName) f.setDataFn = &defaultProtectedSetFn; f.getDataFn = &defaultProtectedGetFn; f.writeDataFn = &defaultProtectedWriteFn; + f.networkMask = 0; sg_tempFieldList.push_back(f); } - +//------------------------------------------------------------------ bool ConsoleObject::removeField(const char* in_pFieldname) { for (U32 i = 0; i < sg_tempFieldList.size(); i++) { diff --git a/Engine/source/console/consoleObject.h b/Engine/source/console/consoleObject.h index 2ff2bc5a3..30682d7f4 100644 --- a/Engine/source/console/consoleObject.h +++ b/Engine/source/console/consoleObject.h @@ -495,7 +495,8 @@ public: table( NULL ), validator( NULL ), setDataFn( NULL ), - getDataFn( NULL ) + getDataFn( NULL ), + networkMask(0) { doNotSubstitute = keepClearSubsOnly = false; } @@ -518,6 +519,7 @@ public: bool doNotSubstitute; bool keepClearSubsOnly; WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not. + U32 networkMask; }; typedef Vector FieldList; diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 0583606b0..ef688228f 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -41,6 +41,8 @@ #include "core/fileObject.h" #include "persistence/taml/tamlCustom.h" +#include "sim/netObject.h" + IMPLEMENT_CONOBJECT( SimObject ); // See full description in the new CHM manual @@ -912,6 +914,12 @@ void SimObject::assignFieldsFrom(SimObject *parent) if((*f->setDataFn)( this, NULL, bufferSecure ) ) Con::setData(f->type, (void *) (((const char *)this) + f->offset), j, 1, &fieldVal, f->table); + + if (f->networkMask != 0) + { + NetObject* netObj = static_cast(this); + netObj->setMaskBits(f->networkMask); + } } } } @@ -988,6 +996,12 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const if(fld->validator) fld->validator->validateType(this, (void *) (((const char *)this) + fld->offset)); + if (fld->networkMask != 0) + { + NetObject* netObj = static_cast(this); + netObj->setMaskBits(fld->networkMask); + } + onStaticModified( slotName, value ); return; diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index 76564fb16..e66a16940 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -493,3 +493,92 @@ void NetObject::removeScopeRef() } } +//Networked fields +//------------------------------------------------------------------ +void NetObject::addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + const char* in_pFieldDocs, + U32 flags, + U32 networkMask) +{ + addNetworkedField( + in_pFieldname, + in_fieldType, + in_fieldOffset, + 1, + in_pFieldDocs, + flags, + networkMask); +} + +void NetObject::addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + AbstractClassRep::WriteDataNotify in_writeDataFn, + const char* in_pFieldDocs, + U32 flags, + U32 networkMask) +{ + addNetworkedField( + in_pFieldname, + in_fieldType, + in_fieldOffset, + in_writeDataFn, + 1, + in_pFieldDocs, + flags, + networkMask); +} + +void NetObject::addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + const U32 in_elementCount, + const char* in_pFieldDocs, + U32 flags, + U32 networkMask) +{ + addNetworkedField(in_pFieldname, + in_fieldType, + in_fieldOffset, + &defaultProtectedWriteFn, + in_elementCount, + in_pFieldDocs, + flags, + networkMask); +} + +void NetObject::addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + AbstractClassRep::WriteDataNotify in_writeDataFn, + const U32 in_elementCount, + const char* in_pFieldDocs, + U32 flags, + U32 networkMask) +{ + AbstractClassRep::Field f; + f.pFieldname = StringTable->insert(in_pFieldname); + + if (in_pFieldDocs) + f.pFieldDocs = in_pFieldDocs; + + f.type = in_fieldType; + f.offset = in_fieldOffset; + f.elementCount = in_elementCount; + f.validator = NULL; + f.flag = flags; + + f.setDataFn = &defaultProtectedSetFn; + f.getDataFn = &defaultProtectedGetFn; + f.writeDataFn = in_writeDataFn; + + f.networkMask = networkMask; + + ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); + AssertFatal(conType, "ConsoleObject::addField - invalid console type"); + f.table = conType->getEnumTable(); + + sg_tempFieldList.push_back(f); +} \ No newline at end of file diff --git a/Engine/source/sim/netObject.h b/Engine/source/sim/netObject.h index a486936be..7ea1283c4 100644 --- a/Engine/source/sim/netObject.h +++ b/Engine/source/sim/netObject.h @@ -422,6 +422,57 @@ public: void removeScopeRef(); void setScopeRegistered(bool flag) { scope_registered = flag; } bool getScopeRegistered() const { return scope_registered; } + +protected: + /// Add a networked field + /// + /// A networked field is a regular field but with a bitmask flag associated to it. + /// When the field is set, it automatically triggers a call to setMaskBits with the mask associated to the field + /// in order to streamline simple networking code + /// Register a complex field. + /// + /// @param in_pFieldname Name of the field. + /// @param in_fieldType Type of the field. @see ConsoleDynamicTypes + /// @param in_fieldOffset Offset to the field from the start of the class; calculated using the Offset() macro. + /// @param in_elementCount Number of elements in this field. Arrays of elements are assumed to be contiguous in memory. + /// @param in_pFieldDocs Usage string for this field. @see console_autodoc + static void addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + const U32 in_elementCount = 1, + const char* in_pFieldDocs = NULL, + U32 flags = 0, + U32 networkMask = 0); + + static void addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + AbstractClassRep::WriteDataNotify in_writeDataFn, + const U32 in_elementCount = 1, + const char* in_pFieldDocs = NULL, + U32 flags = 0, + U32 networkMask = 0); + + /// Register a simple field. + /// + /// @param in_pFieldname Name of the field. + /// @param in_fieldType Type of the field. @see ConsoleDynamicTypes + /// @param in_fieldOffset Offset to the field from the start of the class; calculated using the Offset() macro. + /// @param in_pFieldDocs Usage string for this field. @see console_autodoc + static void addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + const char* in_pFieldDocs, + U32 flags = 0, + U32 networkMask = 0); + + static void addNetworkedField(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + AbstractClassRep::WriteDataNotify in_writeDataFn, + const char* in_pFieldDocs, + U32 flags = 0, + U32 networkMask = 0); }; //----------------------------------------------------------------------------- From d57287cf7577dc56d95ea77a87357299e4c61388 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 16 Jan 2018 13:40:09 -0600 Subject: [PATCH 073/312] adds an mWrap and mWrapF method for cycling values to within a given range. examples of usage would be say, keeping a rotation within 360 degrees, or hitting a tile boundary and resetting the offset --- Engine/source/math/mConsoleFunctions.cpp | 23 +++++++++++++++++++++++ Engine/source/math/mMathFn.h | 13 +++++++++++++ 2 files changed, 36 insertions(+) diff --git a/Engine/source/math/mConsoleFunctions.cpp b/Engine/source/math/mConsoleFunctions.cpp index 651889539..c9a1f4622 100644 --- a/Engine/source/math/mConsoleFunctions.cpp +++ b/Engine/source/math/mConsoleFunctions.cpp @@ -288,6 +288,29 @@ DefineConsoleFunction( mSaturate, F32, ( F32 v ),, return mClampF( v, 0.0f, 1.0f ); } +DefineConsoleFunction(mWrapF, F32, (F32 v, F32 min, F32 max), , + "Wrap the specified value between two bounds.\n" + "@param v Input value." + "@param min Minimum Bound." + "@param max Maximum Bound." + "@returns The specified value wrapped to the specified bounds." + "@ingroup Math") +{ + return mWrapF(v, min, max); +} + +DefineConsoleFunction(mWrap, S32, (S32 v, S32 min, S32 max), , + "Wrap the specified value between two bounds.\n" + "@param v Input value." + "@param min Minimum Bound." + "@param max Maximum Bound." + "@returns The specified value wrapped to the specified bounds." + "@ingroup Math") +{ + return mWrap(v, min, max); +} + + DefineConsoleFunction( getMax, F32, ( F32 v1, F32 v2 ),, "Calculate the greater of two specified numbers.\n" "@param v1 Input value." diff --git a/Engine/source/math/mMathFn.h b/Engine/source/math/mMathFn.h index 93596f63f..a5d2b6ebb 100644 --- a/Engine/source/math/mMathFn.h +++ b/Engine/source/math/mMathFn.h @@ -237,6 +237,19 @@ inline F32 mClampF(F32 val, F32 low, F32 high) return (F32) getMax(getMin(val, high), low); } +inline S32 mWrap(S32 val, S32 low, S32 high) +{ + int len = high - low; + return low + (val >= 0 ? val % len : -val % len ? len - (-val % len) : 0); + +} + +inline F32 mWrapF(F32 val, F32 low, F32 high) +{ + F32 t = fmod(val - low, high - low); + return t < 0 ? t + high : t + low; +} + /// Template function for doing a linear interpolation between any two /// types which implement operators for scalar multiply and addition. template From 3bc15057edeca21a71cbed8a5ac36379085b8def Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 16 Jan 2018 14:14:57 -0600 Subject: [PATCH 074/312] exposes getters for typevalidators. example usage FRangeValidator gravCoefFValidator(-10.f, 10.f); addFieldV( "gravityCoefficient", TYPEID< F32 >(), Offset(gravityCoefficient, ParticleData), &gravCoefFValidator, "Strength of gravity on the particles." ); <- clamps gravity within a -10 to 10 range when evaluating scriptt-set changes mClamp(gravityCoefficient,gravCoefFValidator.getMin(),gravCoefFValidator.getMax()) for any calculations done on the source side would do the same at the point that is called, with a singularl lookup spot for the range. --- Engine/source/console/typeValidators.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Engine/source/console/typeValidators.h b/Engine/source/console/typeValidators.h index 414721f5d..9ca949fa7 100644 --- a/Engine/source/console/typeValidators.h +++ b/Engine/source/console/typeValidators.h @@ -53,6 +53,8 @@ public: maxV = maxValue; } void validateType(SimObject *object, void *typePtr); + F32 getMin() { return minV; }; + F32 getMax() { return maxV; }; }; /// Signed integer min/max range validator @@ -66,6 +68,8 @@ public: maxV = maxValue; } void validateType(SimObject *object, void *typePtr); + F32 getMin() { return minV; }; + F32 getMax() { return maxV; }; }; /// Scaled integer field validator @@ -93,6 +97,7 @@ class Point3NormalizeValidator : public TypeValidator public: Point3NormalizeValidator(F32 normalizeLength = 1.0f) : length(normalizeLength) { } void validateType(SimObject *object, void *typePtr); + F32 getLength() { return length; }; }; namespace CommonValidators From f2dc291cf5d1275c5ef8ece906d9c6f6a0aba4ad Mon Sep 17 00:00:00 2001 From: rextimmy Date: Fri, 19 Jan 2018 22:34:26 +1000 Subject: [PATCH 075/312] PhysX 3.4 implementation --- Engine/source/T3D/physics/physicsPlugin.cpp | 7 +- Engine/source/T3D/physics/physicsPlugin.h | 4 + Engine/source/T3D/physics/physicsWorld.cpp | 2 + Engine/source/T3D/physics/physicsWorld.h | 6 + Engine/source/T3D/physics/physx3/px3.h | 44 ++- Engine/source/T3D/physics/physx3/px3Body.cpp | 67 ++-- Engine/source/T3D/physics/physx3/px3Body.h | 3 +- .../T3D/physics/physx3/px3Collision.cpp | 206 ++++++------ .../source/T3D/physics/physx3/px3Collision.h | 3 + .../source/T3D/physics/physx3/px3Player.cpp | 13 +- .../source/T3D/physics/physx3/px3Stream.cpp | 9 +- Engine/source/T3D/physics/physx3/px3Stream.h | 4 +- Engine/source/T3D/physics/physx3/px3World.cpp | 233 ++++++------- Engine/source/T3D/physics/physx3/px3World.h | 28 +- Tools/CMake/modules/module_physx3.cmake | 316 ++++++++++++------ 15 files changed, 527 insertions(+), 418 deletions(-) diff --git a/Engine/source/T3D/physics/physicsPlugin.cpp b/Engine/source/T3D/physics/physicsPlugin.cpp index b2f06b55e..9b908a13c 100644 --- a/Engine/source/T3D/physics/physicsPlugin.cpp +++ b/Engine/source/T3D/physics/physicsPlugin.cpp @@ -35,12 +35,11 @@ #include "T3D/physics/physicsWorld.h" #include "core/util/tNamedFactory.h" - PhysicsPlugin* PhysicsPlugin::smSingleton = NULL; PhysicsResetSignal PhysicsPlugin::smPhysicsResetSignal; bool PhysicsPlugin::smSinglePlayer = false; U32 PhysicsPlugin::smThreadCount = 2; - +bool PhysicsPlugin::smGpuAccelerationAllowed = false; String PhysicsPlugin::smServerWorldName( "server" ); String PhysicsPlugin::smClientWorldName( "client" ); @@ -51,6 +50,10 @@ AFTER_MODULE_INIT( Sim ) "@brief Informs the physics simulation if only a single player exists.\n\n" "If true, optimizations will be implemented to better cater to a single player environmnent.\n\n" "@ingroup Physics\n"); + Con::addVariable("$Physics::gpuAccelerationAllowed", TypeBool, &PhysicsPlugin::smGpuAccelerationAllowed, + "@brief Informs the physics plugin if it is allowed to use gpu acceleration.\n\n" + "Not all physics implemenations or gpus can support gpu acceleration, this simply informs the plugin if it is allowed to try and use it or not.\n\n" + "@ingroup Physics\n"); Con::addVariable( "$pref::Physics::threadCount", TypeS32, &PhysicsPlugin::smThreadCount, "@brief Number of threads to use in a single pass of the physics engine.\n\n" "Defaults to 2 if not set.\n\n" diff --git a/Engine/source/T3D/physics/physicsPlugin.h b/Engine/source/T3D/physics/physicsPlugin.h index 91c187473..bf5040941 100644 --- a/Engine/source/T3D/physics/physicsPlugin.h +++ b/Engine/source/T3D/physics/physicsPlugin.h @@ -96,6 +96,10 @@ public: /// @see PHYSICSPLUGIN static PhysicsPlugin* getSingleton() { return smSingleton; } + /// Allow gpu acceleration if supported + static bool smGpuAccelerationAllowed; + static bool gpuAccelerationAllowed() { return smGpuAccelerationAllowed; } + /// static bool activate( const char *library ); diff --git a/Engine/source/T3D/physics/physicsWorld.cpp b/Engine/source/T3D/physics/physicsWorld.cpp index 65b254885..7298987c3 100644 --- a/Engine/source/T3D/physics/physicsWorld.cpp +++ b/Engine/source/T3D/physics/physicsWorld.cpp @@ -26,6 +26,8 @@ //Physics timing F32 PhysicsWorld::smPhysicsStepTime = 1.0f / 60.f; //default 60fps U32 PhysicsWorld::smPhysicsMaxSubSteps = 4; +//Gpu acceleration +bool PhysicsWorld::smGpuEnabled = false; PhysicsWorld::PhysicsWorld() : mGravity( 0, 0, -20.0f ) // NOTE: This matches the gravity used for player objects. diff --git a/Engine/source/T3D/physics/physicsWorld.h b/Engine/source/T3D/physics/physicsWorld.h index a18cffb98..e03d088c5 100644 --- a/Engine/source/T3D/physics/physicsWorld.h +++ b/Engine/source/T3D/physics/physicsWorld.h @@ -49,6 +49,9 @@ protected: /// The current gravity force. Point3F mGravity; + /// Gpu acceleration + static bool smGpuEnabled; + public: /// The constructor. @@ -115,6 +118,9 @@ public: /// Physics timing static F32 smPhysicsStepTime; static U32 smPhysicsMaxSubSteps; + + /// Gpu acceleration + static bool isGpuEnabled() { return smGpuEnabled; } }; diff --git a/Engine/source/T3D/physics/physx3/px3.h b/Engine/source/T3D/physics/physx3/px3.h index 6db611b51..ef273e009 100644 --- a/Engine/source/T3D/physics/physx3/px3.h +++ b/Engine/source/T3D/physics/physx3/px3.h @@ -33,19 +33,43 @@ #define WIN32 #endif +// macOS _DEBUG & NDEBUG +#if defined(TORQUE_OS_MAC) && defined(TORQUE_DEBUG) && !defined(_DEBUG) + #define _DEBUG +#elif defined(TORQUE_OS_MAC) && defined(TORQUE_RELEASE) && !defined(NDEBUG) + #define NDEBUG +#endif + +// Linux _DEBUG & NDEBUG +#if defined(TORQUE_OS_LINUX) && defined(TORQUE_DEBUG) && !defined(_DEBUG) +#define _DEBUG +#elif defined(TORQUE_OS_LINUX) && defined(TORQUE_RELEASE) && !defined(NDEBUG) +#define NDEBUG +#endif + //------------------------------------------------------------------------- +//safe release template +template void SafeReleasePhysx(T* a) +{ + if (a) + { + a->release(); + a = NULL; + } +} + #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include extern physx::PxPhysics* gPhysics3SDK; diff --git a/Engine/source/T3D/physics/physx3/px3Body.cpp b/Engine/source/T3D/physics/physx3/px3Body.cpp index ec4e3b979..4bab75dc1 100644 --- a/Engine/source/T3D/physics/physx3/px3Body.cpp +++ b/Engine/source/T3D/physics/physx3/px3Body.cpp @@ -52,12 +52,9 @@ void Px3Body::_releaseActor() if ( !mActor ) return; - mWorld->releaseWriteLock(); - mActor->userData = NULL; - mActor->release(); - mActor = NULL; + SafeReleasePhysx(mActor); mBodyFlags = 0; if ( mMaterial ) @@ -80,7 +77,7 @@ bool Px3Body::init( PhysicsCollision *shape, AssertFatal( shape, "Px3Body::init - Got a null collision shape!" ); AssertFatal( dynamic_cast( shape ), "Px3Body::init - The collision shape is the wrong type!" ); AssertFatal( !((Px3Collision*)shape)->getShapes().empty(), "Px3Body::init - Got empty collision shape!" ); - + // Cleanup any previous actor. _releaseActor(); @@ -96,18 +93,20 @@ bool Px3Body::init( PhysicsCollision *shape, { mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY())); physx::PxRigidDynamic *actor = mActor->is(); - actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true); + actor->setRigidBodyFlag(physx::PxRigidBodyFlag::eKINEMATIC, true); actor->setMass(getMax( mass, 1.0f )); } else if ( mass > 0.0f ) { mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY())); + physx::PxRigidDynamic *actor = mActor->is(); + actor->setMaxAngularVelocity(80.f); } else { mActor = gPhysics3SDK->createRigidStatic(physx::PxTransform(physx::PxIDENTITY())); mIsStatic = true; - } + } mMaterial = gPhysics3SDK->createMaterial(0.6f,0.4f,0.1f); @@ -123,12 +122,13 @@ bool Px3Body::init( PhysicsCollision *shape, Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported."); } } - physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial); + + physx::PxShape * pShape = physx::PxRigidActorExt::createExclusiveShape(*mActor, *desc->pGeometry, *mMaterial); physx::PxFilterData colData; if(isDebris) colData.word0 = PX3_DEBRIS; else if(isTrigger) - colData.word0 = PX3_TRIGGER; + colData.word0 = PX3_TRIGGER; else colData.word0 = PX3_DEFAULT; @@ -149,10 +149,6 @@ bool Px3Body::init( PhysicsCollision *shape, physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass); } - // This sucks, but it has to happen if we want - // to avoid write lock errors from PhysX right now. - mWorld->releaseWriteLock(); - mWorld->getScene()->addActor(*mActor); mIsEnabled = true; @@ -178,9 +174,9 @@ void Px3Body::setMaterial( F32 restitution, actor->wakeUp(); } - mMaterial->setRestitution(restitution); - mMaterial->setStaticFriction(staticFriction); - mMaterial->setDynamicFriction(friction); + mMaterial->setRestitution(restitution); + mMaterial->setStaticFriction(staticFriction); + mMaterial->setDynamicFriction(friction); } @@ -322,15 +318,14 @@ Box3F Px3Body::getWorldBounds() physx::PxBounds3 bounds; bounds.setEmpty(); - physx::PxBounds3 shapeBounds; - + physx::PxBounds3 shapeBounds; U32 shapeCount = mActor->getNbShapes(); physx::PxShape **shapes = new physx::PxShape*[shapeCount]; mActor->getShapes(shapes, shapeCount); for ( U32 i = 0; i < shapeCount; i++ ) { - // Get the shape's bounds. + // Get the shape's bounds. shapeBounds = physx::PxShapeExt::getWorldBounds(*shapes[i],*mActor); // Combine them into the total bounds. bounds.include( shapeBounds ); @@ -350,10 +345,6 @@ void Px3Body::setSimulationEnabled( bool enabled ) if(mBodyFlags & BF_TRIGGER) return; - // This sucks, but it has to happen if we want - // to avoid write lock errors from PhysX right now. - mWorld->releaseWriteLock(); - U32 shapeCount = mActor->getNbShapes(); physx::PxShape **shapes = new physx::PxShape*[shapeCount]; mActor->getShapes(shapes, shapeCount); @@ -367,12 +358,6 @@ void Px3Body::setSimulationEnabled( bool enabled ) void Px3Body::setTransform( const MatrixF &transform ) { AssertFatal( mActor, "Px3Body::setTransform - The actor is null!" ); - - - // This sucks, but it has to happen if we want - // to avoid write lock errors from PhysX right now. - mWorld->releaseWriteLock(); - mActor->setGlobalPose(px3Cast(transform),false); @@ -380,7 +365,7 @@ void Px3Body::setTransform( const MatrixF &transform ) return; physx::PxRigidDynamic *actor = mActor->is(); - bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC; + bool kinematic = actor->getRigidBodyFlags() & physx::PxRigidBodyFlag::eKINEMATIC; // If its dynamic we have more to do. if ( isDynamic() && !kinematic ) { @@ -395,10 +380,6 @@ void Px3Body::applyCorrection( const MatrixF &transform ) AssertFatal( mActor, "Px3Body::applyCorrection - The actor is null!" ); AssertFatal( isDynamic(), "Px3Body::applyCorrection - This call is only for dynamics!" ); - // This sucks, but it has to happen if we want - // to avoid write lock errors from PhysX right now. - mWorld->releaseWriteLock(); - mActor->setGlobalPose( px3Cast(transform) ); } @@ -406,35 +387,27 @@ void Px3Body::applyImpulse( const Point3F &origin, const Point3F &force ) { AssertFatal( mActor, "Px3Body::applyImpulse - The actor is null!" ); - // This sucks, but it has to happen if we want - // to avoid write lock errors from PhysX right now. - mWorld->releaseWriteLock(); physx::PxRigidDynamic *actor = mActor->is(); if ( mIsEnabled && isDynamic() ) - physx::PxRigidBodyExt::addForceAtPos(*actor,px3Cast(force), - px3Cast(origin), - physx::PxForceMode::eIMPULSE); - + physx::PxRigidBodyExt::addForceAtPos( *actor,px3Cast(force), px3Cast(origin), physx::PxForceMode::eIMPULSE ); } -void Px3Body::applyTorque( const Point3F &torque ) +void Px3Body::applyTorque(const Point3F &torque) { AssertFatal(mActor, "Px3Body::applyImpulse - The actor is null!"); - mWorld->releaseWriteLock(); physx::PxRigidDynamic *actor = mActor->is(); if (mIsEnabled && isDynamic()) - actor->addTorque( px3Cast(torque), physx::PxForceMode::eFORCE, true); + actor->addTorque(px3Cast(torque), physx::PxForceMode::eFORCE, true); } -void Px3Body::applyForce( const Point3F &force ) +void Px3Body::applyForce(const Point3F &force) { AssertFatal(mActor, "Px3Body::applyTorque - The actor is null!"); - mWorld->releaseWriteLock(); physx::PxRigidDynamic *actor = mActor->is(); if (mIsEnabled && isDynamic()) - actor->addForce( px3Cast(force), physx::PxForceMode::eFORCE, true); + actor->addForce(px3Cast(force), physx::PxForceMode::eFORCE, true); } void Px3Body::findContact(SceneObject **contactObject, diff --git a/Engine/source/T3D/physics/physx3/px3Body.h b/Engine/source/T3D/physics/physx3/px3Body.h index 30f6f8895..ad348c122 100644 --- a/Engine/source/T3D/physics/physx3/px3Body.h +++ b/Engine/source/T3D/physics/physx3/px3Body.h @@ -40,7 +40,8 @@ class Px3World; class Px3Collision; struct Px3CollisionDesc; -namespace physx{ +namespace physx +{ class PxRigidActor; class PxMaterial; class PxShape; diff --git a/Engine/source/T3D/physics/physx3/px3Collision.cpp b/Engine/source/T3D/physics/physx3/px3Collision.cpp index e03a0f00b..ad8d8ad0b 100644 --- a/Engine/source/T3D/physics/physx3/px3Collision.cpp +++ b/Engine/source/T3D/physics/physx3/px3Collision.cpp @@ -36,136 +36,124 @@ Px3Collision::Px3Collision() } Px3Collision::~Px3Collision() -{ - - for ( U32 i=0; i < mColShapes.size(); i++ ) - { - Px3CollisionDesc *desc = mColShapes[i]; - delete desc->pGeometry; - // Delete the descriptor. - delete desc; - } +{ + for ( U32 i=0; i < mColShapes.size(); i++ ) + { + Px3CollisionDesc *desc = mColShapes[i]; + delete desc->pGeometry; + // Delete the descriptor. + delete desc; + } - mColShapes.clear(); + mColShapes.clear(); } void Px3Collision::addPlane( const PlaneF &plane ) { - physx::PxVec3 pos = px3Cast(plane.getPosition()); - Px3CollisionDesc *desc = new Px3CollisionDesc; + physx::PxVec3 pos = px3Cast(plane.getPosition()); + Px3CollisionDesc *desc = new Px3CollisionDesc; desc->pGeometry = new physx::PxPlaneGeometry(); desc->pose = physx::PxTransform(pos, physx::PxQuat(physx::PxHalfPi, physx::PxVec3(0.0f, -1.0f, 0.0f))); - mColShapes.push_back(desc); + mColShapes.push_back(desc); } void Px3Collision::addBox( const Point3F &halfWidth,const MatrixF &localXfm ) { - Px3CollisionDesc *desc = new Px3CollisionDesc; - desc->pGeometry = new physx::PxBoxGeometry(px3Cast(halfWidth)); - desc->pose = px3Cast(localXfm); - mColShapes.push_back(desc); + Px3CollisionDesc *desc = new Px3CollisionDesc; + desc->pGeometry = new physx::PxBoxGeometry(px3Cast(halfWidth)); + desc->pose = px3Cast(localXfm); + mColShapes.push_back(desc); } -void Px3Collision::addSphere( F32 radius, - const MatrixF &localXfm ) +void Px3Collision::addSphere( F32 radius, const MatrixF &localXfm ) { - Px3CollisionDesc *desc = new Px3CollisionDesc; - desc->pGeometry = new physx::PxSphereGeometry(radius); - desc->pose = px3Cast(localXfm); - mColShapes.push_back(desc); + Px3CollisionDesc *desc = new Px3CollisionDesc; + desc->pGeometry = new physx::PxSphereGeometry(radius); + desc->pose = px3Cast(localXfm); + mColShapes.push_back(desc); } -void Px3Collision::addCapsule( F32 radius, - F32 height, - const MatrixF &localXfm ) +void Px3Collision::addCapsule( F32 radius, F32 height, const MatrixF &localXfm ) { - Px3CollisionDesc *desc = new Px3CollisionDesc; - desc->pGeometry = new physx::PxCapsuleGeometry(radius,height*0.5);//uses half height - desc->pose = px3Cast(localXfm); - mColShapes.push_back(desc); + Px3CollisionDesc *desc = new Px3CollisionDesc; + desc->pGeometry = new physx::PxCapsuleGeometry(radius,height*0.5);//uses half height + desc->pose = px3Cast(localXfm); + mColShapes.push_back(desc); } -bool Px3Collision::addConvex( const Point3F *points, - U32 count, - const MatrixF &localXfm ) +bool Px3Collision::addConvex( const Point3F *points, U32 count, const MatrixF &localXfm ) { - physx::PxCooking *cooking = Px3World::getCooking(); - physx::PxConvexMeshDesc convexDesc; - convexDesc.points.data = points; - convexDesc.points.stride = sizeof(Point3F); - convexDesc.points.count = count; - convexDesc.flags = physx::PxConvexFlag::eFLIPNORMALS|physx::PxConvexFlag::eCOMPUTE_CONVEX | physx::PxConvexFlag::eINFLATE_CONVEX; + physx::PxCooking *cooking = Px3World::getCooking(); + physx::PxConvexMeshDesc convexDesc; + convexDesc.points.data = points; + convexDesc.points.stride = sizeof(Point3F); + convexDesc.points.count = count; + convexDesc.flags = physx::PxConvexFlag::eCOMPUTE_CONVEX | physx::PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES; + if(PhysicsWorld::isGpuEnabled()) + convexDesc.flags |= physx::PxConvexFlag::eGPU_COMPATIBLE; - Px3MemOutStream stream; - if(!cooking->cookConvexMesh(convexDesc,stream)) - return false; + Px3MemOutStream stream; + if(!cooking->cookConvexMesh(convexDesc,stream)) + return false; - physx::PxConvexMesh* convexMesh; - Px3MemInStream in(stream.getData(), stream.getSize()); - convexMesh = gPhysics3SDK->createConvexMesh(in); + physx::PxConvexMesh* convexMesh; + Px3MemInStream in(stream.getData(), stream.getSize()); + convexMesh = gPhysics3SDK->createConvexMesh(in); - Px3CollisionDesc *desc = new Px3CollisionDesc; + Px3CollisionDesc *desc = new Px3CollisionDesc; physx::PxVec3 scale = px3Cast(localXfm.getScale()); physx::PxQuat rotation = px3Cast(QuatF(localXfm)); physx::PxMeshScale meshScale(scale,rotation); - desc->pGeometry = new physx::PxConvexMeshGeometry(convexMesh,meshScale); - desc->pose = px3Cast(localXfm); - mColShapes.push_back(desc); - return true; + desc->pGeometry = new physx::PxConvexMeshGeometry(convexMesh,meshScale); + desc->pose = px3Cast(localXfm); + mColShapes.push_back(desc); + return true; } -bool Px3Collision::addTriangleMesh( const Point3F *vert, - U32 vertCount, - const U32 *index, - U32 triCount, - const MatrixF &localXfm ) +bool Px3Collision::addTriangleMesh( const Point3F *vert, U32 vertCount, const U32 *index, U32 triCount, const MatrixF &localXfm ) { - physx::PxCooking *cooking = Px3World::getCooking(); - physx::PxTriangleMeshDesc meshDesc; - meshDesc.points.count = vertCount; - meshDesc.points.data = vert; - meshDesc.points.stride = sizeof(Point3F); + physx::PxCooking *cooking = Px3World::getCooking(); + physx::PxTriangleMeshDesc meshDesc; + meshDesc.points.count = vertCount; + meshDesc.points.data = vert; + meshDesc.points.stride = sizeof(Point3F); - meshDesc.triangles.count = triCount; - meshDesc.triangles.data = index; - meshDesc.triangles.stride = 3*sizeof(U32); - meshDesc.flags = physx::PxMeshFlag::eFLIPNORMALS; + meshDesc.triangles.count = triCount; + meshDesc.triangles.data = index; + meshDesc.triangles.stride = 3*sizeof(U32); + meshDesc.flags = physx::PxMeshFlag::eFLIPNORMALS; - Px3MemOutStream stream; - if(!cooking->cookTriangleMesh(meshDesc,stream)) - return false; + Px3MemOutStream stream; + if(!cooking->cookTriangleMesh(meshDesc,stream)) + return false; - physx::PxTriangleMesh *mesh; - Px3MemInStream in(stream.getData(), stream.getSize()); - mesh = gPhysics3SDK->createTriangleMesh(in); + physx::PxTriangleMesh *mesh; + Px3MemInStream in(stream.getData(), stream.getSize()); + mesh = gPhysics3SDK->createTriangleMesh(in); - Px3CollisionDesc *desc = new Px3CollisionDesc; - desc->pGeometry = new physx::PxTriangleMeshGeometry(mesh); - desc->pose = px3Cast(localXfm); - mColShapes.push_back(desc); - return true; + Px3CollisionDesc *desc = new Px3CollisionDesc; + desc->pGeometry = new physx::PxTriangleMeshGeometry(mesh); + desc->pose = px3Cast(localXfm); + mColShapes.push_back(desc); + return true; } -bool Px3Collision::addHeightfield( const U16 *heights, - const bool *holes, - U32 blockSize, - F32 metersPerSample, - const MatrixF &localXfm ) +bool Px3Collision::addHeightfield( const U16 *heights, const bool *holes, U32 blockSize, F32 metersPerSample, const MatrixF &localXfm ) { - const F32 heightScale = 0.03125f; - physx::PxHeightFieldSample* samples = (physx::PxHeightFieldSample*) new physx::PxHeightFieldSample[blockSize*blockSize]; - memset(samples,0,blockSize*blockSize*sizeof(physx::PxHeightFieldSample)); + const F32 heightScale = 0.03125f; + physx::PxHeightFieldSample* samples = (physx::PxHeightFieldSample*) new physx::PxHeightFieldSample[blockSize*blockSize]; + memset(samples,0,blockSize*blockSize*sizeof(physx::PxHeightFieldSample)); - physx::PxHeightFieldDesc heightFieldDesc; - heightFieldDesc.nbColumns = blockSize; - heightFieldDesc.nbRows = blockSize; - heightFieldDesc.thickness = -10.f; - heightFieldDesc.convexEdgeThreshold = 0; - heightFieldDesc.format = physx::PxHeightFieldFormat::eS16_TM; - heightFieldDesc.samples.data = samples; - heightFieldDesc.samples.stride = sizeof(physx::PxHeightFieldSample); + physx::PxHeightFieldDesc heightFieldDesc; + heightFieldDesc.nbColumns = blockSize; + heightFieldDesc.nbRows = blockSize; + heightFieldDesc.thickness = -10.f; + heightFieldDesc.convexEdgeThreshold = 0; + heightFieldDesc.format = physx::PxHeightFieldFormat::eS16_TM; + heightFieldDesc.samples.data = samples; + heightFieldDesc.samples.stride = sizeof(physx::PxHeightFieldSample); - physx::PxU8 *currentByte = (physx::PxU8*)heightFieldDesc.samples.data; + physx::PxU8 *currentByte = (physx::PxU8*)heightFieldDesc.samples.data; for ( U32 row = 0; row < blockSize; row++ ) { const U32 tess = ( row + 1 ) % 2; @@ -177,7 +165,6 @@ bool Px3Collision::addHeightfield( const U16 *heights, U32 index = ( blockSize - row - 1 ) + ( column * blockSize ); currentSample->height = (physx::PxI16)heights[ index ]; - if ( holes && holes[ getMax( (S32)index - 1, 0 ) ] ) // row index for holes adjusted so PhysX collision shape better matches rendered terrain { currentSample->materialIndex0 = physx::PxHeightFieldMaterial::eHOLE; @@ -189,29 +176,30 @@ bool Px3Collision::addHeightfield( const U16 *heights, currentSample->materialIndex1 = 0; } - int flag = ( column + tess ) % 2; - if(flag) - currentSample->clearTessFlag(); - else - currentSample->setTessFlag(); + S32 flag = ( column + tess ) % 2; + if(flag) + currentSample->clearTessFlag(); + else + currentSample->setTessFlag(); currentByte += heightFieldDesc.samples.stride; } } - physx::PxHeightField * hf = gPhysics3SDK->createHeightField(heightFieldDesc); - physx::PxHeightFieldGeometry *geom = new physx::PxHeightFieldGeometry(hf,physx::PxMeshGeometryFlags(),heightScale,metersPerSample,metersPerSample); + physx::PxCooking *cooking = Px3World::getCooking(); + physx::PxHeightField * hf = cooking->createHeightField(heightFieldDesc,gPhysics3SDK->getPhysicsInsertionCallback()); + physx::PxHeightFieldGeometry *geom = new physx::PxHeightFieldGeometry(hf,physx::PxMeshGeometryFlags(),heightScale,metersPerSample,metersPerSample); - physx::PxTransform pose= physx::PxTransform(physx::PxQuat(Float_HalfPi, physx::PxVec3(1, 0, 0 ))); - physx::PxTransform pose1= physx::PxTransform(physx::PxQuat(Float_Pi, physx::PxVec3(0, 0, 1 ))); - physx::PxTransform pose2 = pose1 * pose; - pose2.p = physx::PxVec3(( blockSize - 1 ) * metersPerSample, 0, 0 ); - Px3CollisionDesc *desc = new Px3CollisionDesc; - desc->pGeometry = geom; - desc->pose = pose2; + physx::PxTransform pose= physx::PxTransform(physx::PxQuat(Float_HalfPi, physx::PxVec3(1, 0, 0 ))); + physx::PxTransform pose1= physx::PxTransform(physx::PxQuat(Float_Pi, physx::PxVec3(0, 0, 1 ))); + physx::PxTransform pose2 = pose1 * pose; + pose2.p = physx::PxVec3(( blockSize - 1 ) * metersPerSample, 0, 0 ); + Px3CollisionDesc *desc = new Px3CollisionDesc; + desc->pGeometry = geom; + desc->pose = pose2; - mColShapes.push_back(desc); + mColShapes.push_back(desc); SAFE_DELETE(samples); - return true; + return true; } diff --git a/Engine/source/T3D/physics/physx3/px3Collision.h b/Engine/source/T3D/physics/physx3/px3Collision.h index 69bf38778..8697b7f74 100644 --- a/Engine/source/T3D/physics/physx3/px3Collision.h +++ b/Engine/source/T3D/physics/physx3/px3Collision.h @@ -23,6 +23,9 @@ #ifndef _PX3COLLISION_H_ #define _PX3COLLISION_H_ +#ifndef _PHYSX3_H_ +#include "T3D/physics/physx3/px3.h" +#endif #ifndef _T3D_PHYSICS_PHYSICSCOLLISION_H_ #include "T3D/physics/physicsCollision.h" #endif diff --git a/Engine/source/T3D/physics/physx3/px3Player.cpp b/Engine/source/T3D/physics/physx3/px3Player.cpp index 10dc65e86..8c1d66546 100644 --- a/Engine/source/T3D/physics/physx3/px3Player.cpp +++ b/Engine/source/T3D/physics/physx3/px3Player.cpp @@ -53,7 +53,7 @@ void Px3Player::_releaseController() { mController->getActor()->userData = NULL; mWorld->getStaticChangedSignal().remove( this, &Px3Player::_onStaticChanged ); - mController->release(); + SafeReleasePhysx(mController); } } @@ -136,8 +136,6 @@ Point3F Px3Player::move( const VectorF &disp, CollisionList &outCol ) return newPos; } - mWorld->releaseWriteLock(); - mCollisionList = &outCol; physx::PxVec3 dispNx( disp.x, disp.y, disp.z ); @@ -151,8 +149,8 @@ Point3F Px3Player::move( const VectorF &disp, CollisionList &outCol ) physx::PxFilterData data; data.word0=groups; filter.mFilterData = &data; - filter.mFilterFlags = physx::PxSceneQueryFilterFlags(physx::PxControllerFlag::eCOLLISION_DOWN|physx::PxControllerFlag::eCOLLISION_SIDES|physx::PxControllerFlag::eCOLLISION_UP); - + filter.mFilterFlags = physx::PxQueryFlags(physx::PxQueryFlag::eDYNAMIC | physx::PxQueryFlag::eSTATIC); + mController->move( dispNx,0.0001f,0, filter ); Point3F newPos = px3Cast( mController->getPosition() ); @@ -272,7 +270,6 @@ void Px3Player::enableCollision() { AssertFatal( mController, "Px3Player::enableCollision - The controller is null!" ); - mWorld->releaseWriteLock(); px3GetFirstShape(mController->getActor())->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,true); } @@ -280,7 +277,6 @@ void Px3Player::disableCollision() { AssertFatal( mController, "Px3Player::disableCollision - The controller is null!" ); - mWorld->releaseWriteLock(); px3GetFirstShape(mController->getActor())->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,false); } @@ -293,8 +289,6 @@ void Px3Player::setTransform( const MatrixF &transform ) { AssertFatal( mController, "Px3Player::setTransform - The controller is null!" ); - mWorld->releaseWriteLock(); - Point3F newPos = transform.getPosition(); newPos.z += mOriginOffset; @@ -355,7 +349,6 @@ void Px3Player::setSpacials(const Point3F &nPos, const Point3F &nSize) F32 height = nSize.z - (radius * 2.0f); height -= mSkinWidth * 2.0f; - mWorld->releaseWriteLock(); mController->resize(height); px3GetFirstShape(mController->getActor())->getCapsuleGeometry(mGeometry); } \ No newline at end of file diff --git a/Engine/source/T3D/physics/physx3/px3Stream.cpp b/Engine/source/T3D/physics/physx3/px3Stream.cpp index f8374cf89..ec76508be 100644 --- a/Engine/source/T3D/physics/physx3/px3Stream.cpp +++ b/Engine/source/T3D/physics/physx3/px3Stream.cpp @@ -83,10 +83,7 @@ Px3ConsoleStream::~Px3ConsoleStream() { } -void Px3ConsoleStream::reportError( physx::PxErrorCode code, const char *message, const char* file, int line ) +void Px3ConsoleStream::reportError(physx::PxErrorCode::Enum code, const char* message, const char* file, int line) { - UTF8 info[1024]; - dSprintf( info, 1024, "File: %s\nLine: %d\n%s", file, line, message ); - Platform::AlertOK( "PhysX Error", info ); - // Con::printf( "PhysX Error:\n %s(%d) : %s\n", file, line, message ); -} \ No newline at end of file + Con::warnf( "PhysX Warning: %s(%d) : %s", file, line, message ); +} diff --git a/Engine/source/T3D/physics/physx3/px3Stream.h b/Engine/source/T3D/physics/physx3/px3Stream.h index b7538b5e2..bf1641a3b 100644 --- a/Engine/source/T3D/physics/physx3/px3Stream.h +++ b/Engine/source/T3D/physics/physx3/px3Stream.h @@ -62,11 +62,11 @@ protected: }; -class Px3ConsoleStream : public physx::PxDefaultErrorCallback +class Px3ConsoleStream : public physx::PxErrorCallback { protected: - virtual void reportError( physx::PxErrorCode code, const char *message, const char* file, int line ); + virtual void reportError(physx::PxErrorCode::Enum code, const char* message, const char* file, int line); public: diff --git a/Engine/source/T3D/physics/physx3/px3World.cpp b/Engine/source/T3D/physics/physx3/px3World.cpp index a3732634e..5a27e190f 100644 --- a/Engine/source/T3D/physics/physx3/px3World.cpp +++ b/Engine/source/T3D/physics/physx3/px3World.cpp @@ -41,27 +41,31 @@ #include "gfx/sim/debugDraw.h" #include "gfx/primBuilder.h" - physx::PxPhysics* gPhysics3SDK = NULL; physx::PxCooking* Px3World::smCooking = NULL; physx::PxFoundation* Px3World::smFoundation = NULL; -physx::PxProfileZoneManager* Px3World::smProfileZoneManager = NULL; -physx::PxDefaultCpuDispatcher* Px3World::smCpuDispatcher=NULL; +physx::PxDefaultCpuDispatcher* Px3World::smCpuDispatcher = NULL; +#ifndef TORQUE_OS_MAC +physx::PxCudaContextManager* Px3World::smCudaContextManager = NULL; +#endif Px3ConsoleStream* Px3World::smErrorCallback = NULL; -physx::PxVisualDebuggerConnection* Px3World::smPvdConnection=NULL; +physx::PxPvd* Px3World::smPvdConnection = NULL; +physx::PxPvdTransport* Px3World::smPvdTransport = NULL; physx::PxDefaultAllocator Px3World::smMemoryAlloc; -Px3World::Px3World(): mScene( NULL ), - mProcessList( NULL ), - mIsSimulating( false ), - mErrorReport( false ), - mTickCount( 0 ), +Px3World::Px3World() : + mScene( NULL ), mIsEnabled( false ), + mIsSimulating( false ), + mIsServer( false ), + mIsSceneLocked( false ), + mTickCount( 0 ), + mProcessList( NULL ), mEditorTimeScale( 1.0f ), - mAccumulator( 0 ), + mErrorReport( false ), mControllerManager(NULL), - mIsSceneLocked(false), - mRenderBuffer(NULL) + mRenderBuffer(NULL), + mAccumulator( 0 ) { } @@ -80,33 +84,25 @@ bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *se // then we cannot reset the SDK. if ( clientWorld || serverWorld ) return false; - - if(smPvdConnection) - smPvdConnection->release(); - - if(smCooking) - smCooking->release(); - - if(smCpuDispatcher) - smCpuDispatcher->release(); +#ifndef TORQUE_OS_MAC + SafeReleasePhysx(smCudaContextManager); +#endif + SafeReleasePhysx(smCpuDispatcher); + SafeReleasePhysx(smCooking); + smGpuEnabled = false; // Destroy the existing SDK. if ( gPhysics3SDK ) { PxCloseExtensions(); - gPhysics3SDK->release(); + SafeReleasePhysx(gPhysics3SDK); } - if(smErrorCallback) - { - SAFE_DELETE(smErrorCallback); - } + SafeReleasePhysx(smPvdConnection); + SafeReleasePhysx(smPvdTransport); - if(smFoundation) - { - smFoundation->release(); - SAFE_DELETE(smErrorCallback); - } + SAFE_DELETE(smErrorCallback); + SafeReleasePhysx(smFoundation); // If we're not supposed to restart... return. if ( destroyOnly ) @@ -114,20 +110,18 @@ bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *se bool memTrack = false; #ifdef TORQUE_DEBUG - memTrack = true; + memTrack = false; #endif - + smErrorCallback = new Px3ConsoleStream; - smFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, smMemoryAlloc, *smErrorCallback); - smProfileZoneManager = &physx::PxProfileZoneManager::createProfileZoneManager(smFoundation); - gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack,smProfileZoneManager); + smFoundation = PxCreateFoundation(PX_FOUNDATION_VERSION, smMemoryAlloc, *smErrorCallback); + smPvdConnection = PxCreatePvd(*smFoundation); + gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack, smPvdConnection); if ( !gPhysics3SDK ) { Con::errorf( "PhysX3 failed to initialize!" ); - Platform::messageBox( Con::getVariable( "$appName" ), - avar("PhysX3 could not be started!\r\n"), - MBOk, MIStop ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); Platform::forceShutdown( -1 ); // We shouldn't get here, but this shuts up @@ -135,33 +129,67 @@ bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *se return false; } - if(!PxInitExtensions(*gPhysics3SDK)) + if(!PxInitExtensions(*gPhysics3SDK, smPvdConnection)) { Con::errorf( "PhysX3 failed to initialize extensions!" ); - Platform::messageBox( Con::getVariable( "$appName" ), - avar("PhysX3 could not be started!\r\n"), - MBOk, MIStop ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); Platform::forceShutdown( -1 ); return false; } +//no gpu support on macOS +#ifndef TORQUE_OS_MAC + //check if we are allowed to use gpu acceleration + if (PhysicsPlugin::gpuAccelerationAllowed()) + { + // attempt to create a cuda context manager - only works on nvidia gpu (SM 3.0+ i.e kepler or better) + if (!smCpuDispatcher) + { + //check we have capable gpu, -1 means none found + S32 suggestedGpu = PxGetSuggestedCudaDeviceOrdinal(*smErrorCallback); + if (suggestedGpu != -1) + { + physx::PxCudaContextManagerDesc cudaContextManagerDesc; + smCudaContextManager = PxCreateCudaContextManager(*smFoundation, cudaContextManagerDesc); + if (smCudaContextManager) + smGpuEnabled = true; + } + } + } +#endif - smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, physx::PxCookingParams(physx::PxTolerancesScale())); + //cpu dispatcher + if (!smCpuDispatcher) + smCpuDispatcher = physx::PxDefaultCpuDispatcherCreate(PHYSICSMGR->getThreadCount()); + + physx::PxCookingParams params = physx::PxCookingParams(physx::PxTolerancesScale()); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = physx::PxMeshPreprocessingFlags(physx::PxMeshPreprocessingFlag::eWELD_VERTICES); +#ifndef TORQUE_OS_MAC + if(smGpuEnabled) + params.buildGPUData = true; +#endif + + smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, params); if(!smCooking) { Con::errorf( "PhysX3 failed to initialize cooking!" ); - Platform::messageBox( Con::getVariable( "$appName" ), - avar("PhysX3 could not be started!\r\n"), - MBOk, MIStop ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); Platform::forceShutdown( -1 ); return false; } + //TODO: enable/disable this from script #ifdef TORQUE_DEBUG - physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags()); - smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(), - "localhost", 5425, 100, connectionFlags); + if(!smPvdTransport) + smPvdTransport = physx::PxDefaultPvdSocketTransportCreate("localhost", 5425, 100); + + smPvdConnection->connect(*smPvdTransport, physx::PxPvdInstrumentationFlag::eALL); #endif + //use legacy heightfield + //TODO: new method causing crashes on collision in debug build (unified HeightFields) + PxRegisterLegacyHeightFields(*gPhysics3SDK); + return true; } @@ -169,8 +197,6 @@ void Px3World::destroyWorld() { getPhysicsResults(); - mRenderBuffer = NULL; - // Release the tick processing signals. if ( mProcessList ) { @@ -179,19 +205,9 @@ void Px3World::destroyWorld() mProcessList = NULL; } - if(mControllerManager) - { - mControllerManager->release(); - mControllerManager = NULL; - } - + SafeReleasePhysx(mControllerManager); // Destroy the scene. - if ( mScene ) - { - // Release the scene. - mScene->release(); - mScene = NULL; - } + SafeReleasePhysx(mScene); } bool Px3World::initWorld( bool isServer, ProcessList *processList ) @@ -203,27 +219,32 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList ) } mIsServer = isServer; - + physx::PxSceneDesc sceneDesc(gPhysics3SDK->getTolerancesScale()); sceneDesc.gravity = px3Cast(mGravity); sceneDesc.userData = this; - if(!sceneDesc.cpuDispatcher) - { - //Create shared cpu dispatcher - if(!smCpuDispatcher) - smCpuDispatcher = physx::PxDefaultCpuDispatcherCreate(PHYSICSMGR->getThreadCount()); - sceneDesc.cpuDispatcher = smCpuDispatcher; - Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount()); + sceneDesc.cpuDispatcher = smCpuDispatcher; + Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount()); + +#ifndef TORQUE_OS_MAC + if (smGpuEnabled) + { + sceneDesc.flags |= physx::PxSceneFlag::eENABLE_GPU_DYNAMICS; + sceneDesc.flags |= physx::PxSceneFlag::eENABLE_PCM; + sceneDesc.broadPhaseType = physx::PxBroadPhaseType::eGPU; + sceneDesc.gpuDispatcher = smCudaContextManager->getGpuDispatcher(); + Con::printf("PhysX3 using Gpu: %s", smCudaContextManager->getDeviceName()); } - +#endif + sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD; sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS; sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader; - mScene = gPhysics3SDK->createScene(sceneDesc); - //cache renderbuffer for use with debug drawing + mScene = gPhysics3SDK->createScene(sceneDesc); + mRenderBuffer = const_cast(&mScene->getRenderBuffer()); physx::PxDominanceGroupPair debrisDominance( 0.0f, 1.0f ); @@ -252,15 +273,16 @@ bool Px3World::_simulate(const F32 dt) if (numSimulationSubSteps) { //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt - S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps)? smPhysicsMaxSubSteps : numSimulationSubSteps; - + S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps) ? smPhysicsMaxSubSteps : numSimulationSubSteps; + for (S32 i=0;ifetchResults(true); + if(i > 0) + mScene->fetchResults(true); mScene->simulate(smPhysicsStepTime); } } - + mIsSimulating = true; return true; @@ -299,36 +321,6 @@ void Px3World::getPhysicsResults() mScene->fetchResults(true); mIsSimulating = false; mTickCount++; - - // Con::printf( "%s PhysXWorld::getPhysicsResults!", this == smClientWorld ? "Client" : "Server" ); -} - -void Px3World::releaseWriteLocks() -{ - Px3World *world = dynamic_cast( PHYSICSMGR->getWorld( "server" ) ); - - if ( world ) - world->releaseWriteLock(); - - world = dynamic_cast( PHYSICSMGR->getWorld( "client" ) ); - - if ( world ) - world->releaseWriteLock(); -} - -void Px3World::releaseWriteLock() -{ - if ( !mScene || !mIsSimulating ) - return; - - PROFILE_SCOPE(PxWorld_ReleaseWriteLock); - - // We use checkResults here to release the write lock - // but we do not change the simulation flag or increment - // the tick count... we may have gotten results, but the - // simulation hasn't really ticked! - mScene->checkResults( true ); - //AssertFatal( mScene->isWritable(), "PhysX3World::releaseWriteLock() - We should have been writable now!" ); } void Px3World::lockScenes() @@ -388,8 +380,7 @@ void Px3World::unlockScene() } bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ) -{ - +{ physx::PxVec3 orig = px3Cast( startPnt ); physx::PxVec3 dir = px3Cast( endPnt - startPnt ); physx::PxF32 maxDist = dir.magnitude(); @@ -398,15 +389,15 @@ bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo U32 groups = 0xffffffff; groups &= ~( PX3_TRIGGER ); // No trigger shapes! - physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::eIMPACT | physx::PxHitFlag::eNORMAL); + physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::ePOSITION | physx::PxHitFlag::eNORMAL); physx::PxQueryFilterData filterData(physx::PxQueryFlag::eSTATIC|physx::PxQueryFlag::eDYNAMIC); filterData.data.word0 = groups; physx::PxRaycastBuffer buf; if(!mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData)) - return false; + return false; if(!buf.hasBlock) - return false; + return false; const physx::PxRaycastHit hit = buf.block; physx::PxRigidActor *actor = hit.actor; @@ -425,8 +416,8 @@ bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo } if ( impulse.isZero() || - !actor->isRigidDynamic() || - actor->is()->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC ) + !actor->is() || + actor->is()->getRigidBodyFlags() & physx::PxRigidBodyFlag::eKINEMATIC ) return true; physx::PxRigidBody *body = actor->is(); @@ -453,7 +444,7 @@ PhysicsBody* Px3World::castRay( const Point3F &start, const Point3F &end, U32 bo groups &= ~( PX3_TRIGGER ); // triggers groups &= ~( PX3_DEBRIS ); // debris - physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::eIMPACT | physx::PxHitFlag::eNORMAL); + physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::ePOSITION | physx::PxHitFlag::eNORMAL); physx::PxQueryFilterData filterData; if(bodyTypes & BT_Static) filterData.flags |= physx::PxQueryFlag::eSTATIC; @@ -491,12 +482,12 @@ void Px3World::explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ) { physx::PxRigidActor *actor = buffer.touches[i].actor; - bool dynamic = actor->isRigidDynamic(); + bool dynamic = actor->is(); if ( !dynamic ) continue; - bool kinematic = actor->is()->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC; + bool kinematic = actor->is()->getRigidBodyFlags() & physx::PxRigidBodyFlag::eKINEMATIC; if ( kinematic ) continue; @@ -523,8 +514,6 @@ physx::PxController* Px3World::createController( physx::PxControllerDesc &desc ) if ( !mScene ) return NULL; - // We need the writelock! - releaseWriteLock(); physx::PxController* pController = mControllerManager->createController(desc); AssertFatal( pController, "Px3World::createController - Got a null!" ); return pController; @@ -543,7 +532,7 @@ static ColorI getDebugColor( physx::PxU32 packed ) void Px3World::onDebugDraw( const SceneRenderState *state ) { - if ( !mScene || !mRenderBuffer ) + if ( !mScene || !mRenderBuffer) return; mScene->setVisualizationParameter(physx::PxVisualizationParameter::eSCALE,1.0f); diff --git a/Engine/source/T3D/physics/physx3/px3World.h b/Engine/source/T3D/physics/physx3/px3World.h index 5399c3f0a..9005d2a07 100644 --- a/Engine/source/T3D/physics/physx3/px3World.h +++ b/Engine/source/T3D/physics/physx3/px3World.h @@ -23,15 +23,15 @@ #ifndef _PX3WORLD_H_ #define _PX3WORLD_H_ +#ifndef _PHYSX3_H_ +#include "T3D/physics/physx3/px3.h" +#endif #ifndef _T3D_PHYSICS_PHYSICSWORLD_H_ #include "T3D/physics/physicsWorld.h" #endif #ifndef _MMATH_H_ #include "math/mMath.h" #endif -#ifndef _PHYSX3_H_ -#include "T3D/physics/physx3/px3.h" -#endif #ifndef _TVECTOR_H_ #include "core/util/tVector.h" #endif @@ -51,26 +51,29 @@ enum Px3CollisionGroup class Px3World : public PhysicsWorld { protected: - physx::PxScene* mScene; bool mIsEnabled; bool mIsSimulating; bool mIsServer; - bool mIsSceneLocked; + bool mIsSceneLocked; U32 mTickCount; ProcessList *mProcessList; F32 mEditorTimeScale; bool mErrorReport; - physx::PxRenderBuffer *mRenderBuffer; physx::PxControllerManager* mControllerManager; + physx::PxRenderBuffer *mRenderBuffer; + F32 mAccumulator; static Px3ConsoleStream *smErrorCallback; static physx::PxDefaultAllocator smMemoryAlloc; static physx::PxFoundation* smFoundation; static physx::PxCooking *smCooking; - static physx::PxProfileZoneManager* smProfileZoneManager; static physx::PxDefaultCpuDispatcher* smCpuDispatcher; - static physx::PxVisualDebuggerConnection* smPvdConnection; - F32 mAccumulator; +#ifndef TORQUE_OS_MAC + static physx::PxCudaContextManager* smCudaContextManager; +#endif + static physx::PxPvd* smPvdConnection; + static physx::PxPvdTransport* smPvdTransport; + bool _simulate(const F32 dt); public: @@ -86,21 +89,20 @@ public: virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All ); virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); virtual bool isEnabled() const { return mIsEnabled; } - physx::PxScene* getScene(){ return mScene;} + physx::PxScene* getScene(){ return mScene; } void setEnabled( bool enabled ); U32 getTick() { return mTickCount; } void tickPhysics( U32 elapsedMs ); void getPhysicsResults(); void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } const F32 getEditorTimeScale() const { return mEditorTimeScale; } - void releaseWriteLock(); - bool isServer(){return mIsServer;} + bool isServer() { return mIsServer; } + physx::PxController* createController( physx::PxControllerDesc &desc ); void lockScene(); void unlockScene(); //static static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL ); - static void releaseWriteLocks(); static physx::PxCooking *getCooking(); static void lockScenes(); static void unlockScenes(); diff --git a/Tools/CMake/modules/module_physx3.cmake b/Tools/CMake/modules/module_physx3.cmake index 5545120ee..56984649f 100644 --- a/Tools/CMake/modules/module_physx3.cmake +++ b/Tools/CMake/modules/module_physx3.cmake @@ -1,5 +1,5 @@ # ----------------------------------------------------------------------------- -# Copyright (c) 2015 GarageGames, LLC +# Copyright (c) 2017 GarageGames, LLC # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to @@ -20,16 +20,18 @@ # IN THE SOFTWARE. # ----------------------------------------------------------------------------- -# module Physx 3.3 +# module Physx 3.4 -option(TORQUE_PHYSICS_PHYSX3 "Use PhysX 3.3 physics" OFF) +#do note the inconsistent upper/lower case nvidia use for directory names in physx + +option(TORQUE_PHYSICS_PHYSX3 "Use PhysX 3.4 physics" OFF) if( NOT TORQUE_PHYSICS_PHYSX3 ) - return() + return() endif() if("${PHYSX3_BASE_PATH}" STREQUAL "") - set(PHYSX3_BASE_PATH "" CACHE PATH "PhysX 3.3 path" FORCE) + set(PHYSX3_BASE_PATH "" CACHE PATH "PhysX 3.4 path" FORCE) endif() #still no path we can't go any further @@ -39,63 +41,177 @@ if("${PHYSX3_BASE_PATH}" STREQUAL "") endif() #set physx path -set(PHYSX3_PATH "${PHYSX3_BASE_PATH}/PhysXSDK") +set(PHYSX3_PATH "${PHYSX3_BASE_PATH}/PhysX_3.4") -# TODO linux support +# Windows/ Visual Studio if(MSVC) if(TORQUE_CPU_X32) - if(MSVC11) - set(PHYSX3_LIBPATH_PREFIX vc11win32) - elseif(MSVC12) - set(PHYSX3_LIBPATH_PREFIX vc12win32) - elseif(MSVC14) - set(PHYSX3_LIBPATH_PREFIX vc14win32) - else() - return() - endif() + if(MSVC11) + set(PHYSX3_LIBPATH_PREFIX vc11win32) + elseif(MSVC12) + set(PHYSX3_LIBPATH_PREFIX vc12win32) + elseif(MSVC14) + set(PHYSX3_LIBPATH_PREFIX vc14win32) + else() + message(FATAL_ERROR "This version of VS is not supported") + return() + endif() set(PHYSX3_LIBNAME_POSTFIX _x86) elseif(TORQUE_CPU_X64) - if(MSVC11) - set(PHYSX3_LIBPATH_PREFIX vc11win64) - elseif(MSVC12) - set(PHYSX3_LIBPATH_PREFIX vc12win64) - elseif(MSVC14) - set(PHYSX3_LIBPATH_PREFIX vc14win64) - else() - return() - endif() -set(PHYSX3_LIBNAME_POSTFIX _x64) + if(MSVC11) + set(PHYSX3_LIBPATH_PREFIX vc11win64) + elseif(MSVC12) + set(PHYSX3_LIBPATH_PREFIX vc12win64) + elseif(MSVC14) + set(PHYSX3_LIBPATH_PREFIX vc14win64) + else() + message(FATAL_ERROR "This version of VS is not supported") + return() + endif() + set(PHYSX3_LIBNAME_POSTFIX _x64) + endif() endif() -endif(MSVC) +# Only suport 64bit on macOS and linux +if(APPLE) + set(PHYSX3_LIBPATH_PREFIX osx64) + set(PHYSX3_LIBNAME_POSTFIX _x64) +elseif(UNIX) + set(PHYSX3_LIBPATH_PREFIX linux64) + set(PHYSX3_LIBNAME_POSTFIX _x64) +endif() -MACRO(FIND_PHYSX3_LIBRARY VARNAME LIBNAME WITHPOSTFIX) +MACRO(FIND_PHYSX3_LIBRARY VARNAME LIBNAME WITHPOSTFIX SEARCHDIR) - set(LIBPOSTFIX "") - if(${WITHPOSTFIX}) - set(LIBPOSTFIX ${PHYSX3_LIBNAME_POSTFIX}) - endif(${WITHPOSTFIX}) - find_library(PHYSX3_${VARNAME}_LIBRARY NAMES ${LIBNAME}${LIBPOSTFIX} - PATHS ${PHYSX3_PATH}/Lib/${PHYSX3_LIBPATH_PREFIX}) - find_library(PHYSX3_${VARNAME}_LIBRARY_DEBUG NAMES ${LIBNAME}DEBUG${LIBPOSTFIX} - PATHS ${PHYSX3_PATH}/Lib/${PHYSX3_LIBPATH_PREFIX}) + set(LIBPOSTFIX "") + if(${WITHPOSTFIX}) + set(LIBPOSTFIX ${PHYSX3_LIBNAME_POSTFIX}) + endif(${WITHPOSTFIX}) + #release + find_library(PHYSX3_${VARNAME}_LIBRARY NAMES ${LIBNAME}${LIBPOSTFIX} PATHS ${SEARCHDIR}${PHYSX3_LIBPATH_PREFIX}) + #debug + find_library(PHYSX3_${VARNAME}_LIBRARY_DEBUG NAMES ${LIBNAME}DEBUG${LIBPOSTFIX} PATHS ${SEARCHDIR}${PHYSX3_LIBPATH_PREFIX}) -ENDMACRO(FIND_PHYSX3_LIBRARY VARNAME LIBNAME) +ENDMACRO() -# Find the Libs, we just use the full path to save playing around with link_directories -FIND_PHYSX3_LIBRARY(CORE PhysX3 1) -FIND_PHYSX3_LIBRARY(COMMON PhysX3Common 1) -FIND_PHYSX3_LIBRARY(COOKING PhysX3Cooking 1) -FIND_PHYSX3_LIBRARY(CHARACTER PhysX3CharacterKinematic 1) -FIND_PHYSX3_LIBRARY(EXTENSIONS PhysX3Extensions 0) -FIND_PHYSX3_LIBRARY(TASK PxTask 0) -FIND_PHYSX3_LIBRARY(DEBUGGER PhysXVisualDebuggerSDK 0) -FIND_PHYSX3_LIBRARY(PROFILE PhysXProfileSDK 0) +# Find the Libs +if( WIN32 ) + FIND_PHYSX3_LIBRARY(CORE PhysX3 1 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(COMMON PhysX3Common 1 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(COOKING PhysX3Cooking 1 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(CHARACTER PhysX3CharacterKinematic 1 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(EXTENSIONS PhysX3Extensions 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(TASK PxTask 1 ${PHYSX3_BASE_PATH}/PxShared/Lib/) + FIND_PHYSX3_LIBRARY(FOUNDATION PxFoundation 1 ${PHYSX3_BASE_PATH}/PxShared/Lib/) + FIND_PHYSX3_LIBRARY(PVD PxPvdSDK 1 ${PHYSX3_BASE_PATH}/PxShared/Lib/) + + if(NOT PHYSX3_CORE_LIBRARY) + return() + endif() + + #Add the libs + set(PHYSX_LIBRARIES + ${PHYSX3_CORE_LIBRARY} + ${PHYSX3_COMMON_LIBRARY} + ${PHYSX3_EXTENSIONS_LIBRARY} + ${PHYSX3_COOKING_LIBRARY} + ${PHYSX3_CHARACTER_LIBRARY} + ${PHYSX3_TASK_LIBRARY} + ${PHYSX3_PVD_LIBRARY} + ${PHYSX3_FOUNDATION_LIBRARY} + ) + + set(PHYSX_LIBRARIES_DEBUG + ${PHYSX3_CORE_LIBRARY_DEBUG} + ${PHYSX3_COMMON_LIBRARY_DEBUG} + ${PHYSX3_EXTENSIONS_LIBRARY_DEBUG} + ${PHYSX3_COOKING_LIBRARY_DEBUG} + ${PHYSX3_CHARACTER_LIBRARY_DEBUG} + ${PHYSX3_TASK_LIBRARY_DEBUG} + ${PHYSX3_PVD_LIBRARY_DEBUG} + ${PHYSX3_FOUNDATION_LIBRARY_DEBUG} + ) +#macOS & linux +elseif(UNIX) + #common + FIND_PHYSX3_LIBRARY(EXTENSIONS PhysX3Extensions 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(CONTROLLER SimulationController 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(SCENEQUERY SceneQuery 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(LOWLEVEL LowLevel 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(LOWLEVEL_DYNAMICS LowLevelDynamics 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(LOWLEVEL_AABB LowLevelAABB 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(LOWLEVEL_CLOTH LowLevelCloth 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(LOWLEVEL_PARTICLES LowLevelParticles 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(TASK PxTask 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) + #platform dependent + if(APPLE) + FIND_PHYSX3_LIBRARY(CORE PhysX3 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(COMMON PhysX3Common 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(COOKING PhysX3Cooking 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(CHARACTER PhysX3CharacterKinematic 0 ${PHYSX3_PATH}/Lib/) + FIND_PHYSX3_LIBRARY(FOUNDATION PxFoundation 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) + FIND_PHYSX3_LIBRARY(PVD PxPvdSDK 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) + elseif() #linux + FIND_PHYSX3_LIBRARY(CORE PhysX3 1 ${PHYSX3_PATH}/Bin/) + FIND_PHYSX3_LIBRARY(COMMON PhysX3Common 1 ${PHYSX3_PATH}/Bin/) + FIND_PHYSX3_LIBRARY(CHARACTER PhysX3CharacterKinematic 1 ${PHYSX3_PATH}/Bin/) + FIND_PHYSX3_LIBRARY(COOKING PhysX3Cooking 1 ${PHYSX3_PATH}/Bin/) + FIND_PHYSX3_LIBRARY(FOUNDATION PxFoundation 1 ${PHYSX3_BASE_PATH}/PxShared/bin/) + FIND_PHYSX3_LIBRARY(PVD PxPvdSDK 1 ${PHYSX3_BASE_PATH}/PxShared/bin/) + FIND_PHYSX3_LIBRARY(CUDA PxCudaContextManager 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) + FIND_PHYSX3_LIBRARY(GPU PhysX3Gpu 1 ${PHYSX3_PATH}/Bin/) + FIND_PHYSX3_LIBRARY(XML PsFastXml 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) + endif() + + if(NOT PHYSX3_CORE_LIBRARY) + return() + endif() + + #Add the libs + set(PHYSX_LIBRARIES + ${PHYSX3_CORE_LIBRARY} + ${PHYSX3_GPU_LIBRARY} + ${PHYSX3_CHARACTER_LIBRARY} + ${PHYSX3_COOKING_LIBRARY} + ${PHYSX3_COMMON_LIBRARY} + ${PHYSX3_EXTENSIONS_LIBRARY} + ${PHYSX3_CONTROLLER_LIBRARY} + ${PHYSX3_SCENEQUERY_LIBRARY} + ${PHYSX3_LOWLEVEL_LIBRARY} + ${PHYSX3_LOWLEVEL_AABB_LIBRARY} + ${PHYSX3_LOWLEVEL_DYNAMICS_LIBRARY} + ${PHYSX3_LOWLEVEL_CLOTH_LIBRARY} + ${PHYSX3_LOWLEVEL_PARTICLES_LIBRARY} + ${PHYSX3_CUDA_LIBRARY} + ${PHYSX3_TASK_LIBRARY} + ${PHYSX3_XML_LIBRARY} + ${PHYSX3_FOUNDATION_LIBRARY} + ${PHYSX3_PVD_LIBRARY} + ) + + set(PHYSX_LIBRARIES_DEBUG + ${PHYSX3_CORE_LIBRARY_DEBUG} + ${PHYSX3_GPU_LIBRARY_DEBUG} + ${PHYSX3_CHARACTER_LIBRARY_DEBUG} + ${PHYSX3_COOKING_LIBRARY_DEBUG} + ${PHYSX3_COMMON_LIBRARY_DEBUG} + ${PHYSX3_EXTENSIONS_LIBRARY_DEBUG} + ${PHYSX3_CONTROLLER_LIBRARY_DEBUG} + ${PHYSX3_SCENEQUERY_LIBRARY_DEBUG} + ${PHYSX3_LOWLEVEL_LIBRARY_DEBUG} + ${PHYSX3_LOWLEVEL_AABB_LIBRARY_DEBUG} + ${PHYSX3_LOWLEVEL_DYNAMICS_LIBRARY_DEBUG} + ${PHYSX3_LOWLEVEL_CLOTH_LIBRARY_DEBUG} + ${PHYSX3_LOWLEVEL_PARTICLES_LIBRARY_DEBUG} + ${PHYSX3_CUDA_LIBRARY_DEBUG} + ${PHYSX3_TASK_LIBRARY_DEBUG} + ${PHYSX3_XML_LIBRARY_DEBUG} + ${PHYSX3_FOUNDATION_LIBRARY_DEBUG} + ${PHYSX3_PVD_LIBRARY_DEBUG} + ) -if(NOT PHYSX3_CORE_LIBRARY) - return() endif() # Defines @@ -106,56 +222,64 @@ addDef( "TORQUE_PHYSICS_ENABLED" ) addPath( "${srcDir}/T3D/physics/physx3" ) # Includes +addInclude( "${PHYSX3_BASE_PATH}/PxShared/include" ) +addInclude( "${PHYSX3_BASE_PATH}/PxShared/src/foundation/include" ) +addInclude( "${PHYSX3_BASE_PATH}/PxShared/src/pvd/include" ) addInclude( "${PHYSX3_PATH}/Include" ) -addInclude( "${PHYSX3_PATH}/Include/extensions" ) -addInclude( "${PHYSX3_PATH}/Include/foundation" ) -addInclude( "${PHYSX3_PATH}/Include/characterkinematic" ) -addInclude( "${PHYSX3_PATH}/Include/common" ) -#Add the libs -set(PHYSX_LIBRARIES_DEBUG - ${PHYSX3_CORE_LIBRARY_DEBUG} - ${PHYSX3_COMMON_LIBRARY_DEBUG} - ${PHYSX3_COOKING_LIBRARY_DEBUG} - ${PHYSX3_CHARACTER_LIBRARY_DEBUG} - ${PHYSX3_EXTENSIONS_LIBRARY_DEBUG} - ${PHYSX3_TASK_LIBRARY_DEBUG} - ${PHYSX3_DEBUGGER_LIBRARY_DEBUG} - ${PHYSX3_PROFILE_LIBRARY_DEBUG} -) +# Libs +addLibRelease( "${PHYSX_LIBRARIES}" ) +addLibDebug( "${PHYSX_LIBRARIES_DEBUG}" ) -set(PHYSX_LIBRARIES - ${PHYSX3_CORE_LIBRARY} - ${PHYSX3_COMMON_LIBRARY} - ${PHYSX3_COOKING_LIBRARY} - ${PHYSX3_CHARACTER_LIBRARY} - ${PHYSX3_EXTENSIONS_LIBRARY} - ${PHYSX3_TASK_LIBRARY} - ${PHYSX3_DEBUGGER_LIBRARY} - ${PHYSX3_PROFILE_LIBRARY} -) - -addLibRelease("${PHYSX_LIBRARIES}") -addLibDebug("${PHYSX_LIBRARIES_DEBUG}") - -#Install dll files +#Install files if( WIN32 ) - # File Copy for Release - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Release") - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CharacterKinematic${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Release") - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3Common${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Release") - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3Cooking${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Release") + # File Copy for Release + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3Gpu${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CharacterKinematic${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3Common${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3Cooking${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/PxFoundation${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/PxPvdSDK${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) - # File Copy for Debug - if(TORQUE_CPU_X32) - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/nvToolsExt32_1.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug") - elseif(TORQUE_CPU_X64) - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/nvToolsExt64_1.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug") - endif() - - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3DEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug") - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CharacterKinematicDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug") - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CommonDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug") - INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CookingDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS "Debug") - -endif(WIN32) + # File Copy + if(TORQUE_CPU_X32) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysXDevice.dll" DESTINATION "${projectOutDir}") + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/nvToolsExt32_1.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + elseif(TORQUE_CPU_X64) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysXDevice64.dll" DESTINATION "${projectOutDir}") + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/nvToolsExt64_1.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + endif() + + #File copy for Debug + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3DEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3GpuDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CharacterKinematicDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CommonDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/PhysX3CookingDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/PxFoundationDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/PxPvdSDKDEBUG${PHYSX3_LIBNAME_POSTFIX}.dll" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + +endif() + +#linux - apple xcode physx build generates static libs +if(UNIX AND NOT APPLE) + # File Copy for Release + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3CharacterKinematic${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3Common${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3Cooking${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/libPxFoundation${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/libPxPvdSDK${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3Gpu${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Release) + + # File Copy for Debug + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3DEBUG${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3CharacterKinematicDEBUG${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3CommonDEBUG${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3CookingDEBUG${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/libPxFoundationDEBUG${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_BASE_PATH}/PxShared/bin/${PHYSX3_LIBPATH_PREFIX}/libPxPvdSDKDEBUG${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + INSTALL(FILES "${PHYSX3_PATH}/Bin/${PHYSX3_LIBPATH_PREFIX}/libPhysX3GpuDEBUG${PHYSX3_LIBNAME_POSTFIX}.so" DESTINATION "${projectOutDir}" CONFIGURATIONS Debug) + +endif() From 0c65f9ee8ebf365ca35a55007842350a053f6705 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Tue, 23 Jan 2018 20:24:35 +0000 Subject: [PATCH 076/312] Phase 1: Add a #define test --- Engine/source/T3D/gameBase/gameBase.cpp | 17 +++++++++++++++++ Engine/source/T3D/gameBase/gameConnection.cpp | 4 ++++ Engine/source/app/game.cpp | 6 +++++- Engine/source/console/consoleObject.h | 2 +- Engine/source/sim/netObject.cpp | 8 +++++++- Engine/source/terrain/terrRender.cpp | 2 ++ 6 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index 4a98742c1..23b8a67bb 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -41,7 +41,9 @@ #include "T3D/aiConnection.h" #endif +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif //---------------------------------------------------------------------------- // Ghost update relative priority values @@ -256,8 +258,10 @@ GameBase::GameBase() GameBase::~GameBase() { +#ifdef TORQUE_AFX_ENABLED if (scope_registered) arcaneFX::unregisterScopedObject(this); +#endif } @@ -270,6 +274,7 @@ bool GameBase::onAdd() // Datablock must be initialized on the server. // Client datablock are initialized by the initial update. +#ifdef TORQUE_AFX_ENABLED if (isClientObject()) { if (scope_id > 0 && !scope_registered) @@ -280,6 +285,10 @@ bool GameBase::onAdd() if ( mDataBlock && !onNewDataBlock( mDataBlock, false ) ) return false; } +#else + if ( isServerObject() && mDataBlock && !onNewDataBlock( mDataBlock, false ) ) + return false; +#endif setProcessTick( true ); @@ -288,8 +297,10 @@ bool GameBase::onAdd() void GameBase::onRemove() { +#ifdef TORQUE_AFX_ENABLED if (scope_registered) arcaneFX::unregisterScopedObject(this); +#endif // EDITOR FEATURE: Remove us from the reload signal of our datablock. if ( mDataBlock ) mDataBlock->mReloadSignal.remove( this, &GameBase::_onDatablockModified ); @@ -314,9 +325,11 @@ bool GameBase::onNewDataBlock( GameBaseData *dptr, bool reload ) if ( !mDataBlock ) return false; +#ifdef TORQUE_AFX_ENABLED // Don't set mask when new datablock is a temp-clone. if (mDataBlock->isTempClone()) return true; +#endif setMaskBits(DataBlockMask); return true; @@ -570,11 +583,13 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream stream->writeFlag(mIsAiControlled); #endif +#ifdef TORQUE_AFX_ENABLED if (stream->writeFlag(mask & ScopeIdMask)) { if (stream->writeFlag(scope_refs > 0)) stream->writeInt(scope_id, SCOPE_ID_BITS); } +#endif return retMask; } @@ -613,11 +628,13 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream) mTicksSinceLastMove = 0; mIsAiControlled = stream->readFlag(); #endif +#ifdef TORQUE_AFX_ENABLED if (stream->readFlag()) { scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; scope_refs = 0; } +#endif } void GameBase::onMount( SceneObject *obj, S32 node ) diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index d39b5c249..b1da7bf8f 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -61,7 +61,9 @@ #include "core/stream/fileStream.h" #endif +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif //---------------------------------------------------------------------------- #define MAX_MOVE_PACKET_SENDS 4 @@ -2452,6 +2454,7 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),, return object->getVisibleGhostDistance(); } +#ifdef TORQUE_AFX_ENABLED // The object selection code here is, in part, based, on functionality described // in the following resource: // Object Selection in Torque by Dave Myers @@ -2580,6 +2583,7 @@ void GameConnection::onDeleteNotify(SimObject* obj) Parent::onDeleteNotify(obj); } +#endif #ifdef AFX_CAP_DATABLOCK_CACHE diff --git a/Engine/source/app/game.cpp b/Engine/source/app/game.cpp index b2b107d8c..05f63e84c 100644 --- a/Engine/source/app/game.cpp +++ b/Engine/source/app/game.cpp @@ -54,8 +54,10 @@ #include "gfx/gfxTextureManager.h" #include "sfx/sfxSystem.h" -// Including this header provides access to certain system-level AFX methods. +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif + #ifdef TORQUE_PLAYER // See matching #ifdef in editor/editor.cpp bool gEditingMission = false; @@ -242,9 +244,11 @@ ConsoleFunctionGroupEnd(Platform); bool clientProcess(U32 timeDelta) { +#ifdef TORQUE_AFX_ENABLED // Required heartbeat call on the client side which must come // before the advanceTime() calls are made to the scene objects. arcaneFX::advanceTime(timeDelta); +#endif bool ret = true; #ifndef TORQUE_TGB_ONLY diff --git a/Engine/source/console/consoleObject.h b/Engine/source/console/consoleObject.h index 2ff2bc5a3..0cf34e237 100644 --- a/Engine/source/console/consoleObject.h +++ b/Engine/source/console/consoleObject.h @@ -515,9 +515,9 @@ public: TypeValidator *validator; ///< Validator, if any. SetDataNotify setDataFn; ///< Set data notify Fn GetDataNotify getDataFn; ///< Get data notify Fn + WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not. bool doNotSubstitute; bool keepClearSubsOnly; - WriteDataNotify writeDataFn; ///< Function to determine whether data should be written or not. }; typedef Vector FieldList; diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index 76564fb16..dc3cea5f3 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -33,7 +33,9 @@ #include "console/consoleTypes.h" #include "console/engineAPI.h" +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif IMPLEMENT_CONOBJECT(NetObject); @@ -53,9 +55,11 @@ NetObject::NetObject() mPrevDirtyList = NULL; mNextDirtyList = NULL; mDirtyMaskBits = 0; +#ifdef TORQUE_AFX_ENABLED scope_id = 0; scope_refs = 0; scope_registered = false; +#endif } NetObject::~NetObject() @@ -470,6 +474,8 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),, //{ // return object->isServerObject(); //} + +#ifdef TORQUE_AFX_ENABLED U16 NetObject::addScopeRef() { if (scope_refs == 0) @@ -492,4 +498,4 @@ void NetObject::removeScopeRef() onScopeIdChange(); } } - +#endif diff --git a/Engine/source/terrain/terrRender.cpp b/Engine/source/terrain/terrRender.cpp index 15c294611..bb0ba8f5d 100644 --- a/Engine/source/terrain/terrRender.cpp +++ b/Engine/source/terrain/terrRender.cpp @@ -50,7 +50,9 @@ #include "gfx/gfxDrawUtil.h" +#ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" +#endif #include "afx/ce/afxZodiacMgr.h" #include "gfx/gfxTransformSaver.h" #include "gfx/bitmap/gBitmap.h" From b8f722e2f9dca76299b754a7e99370c5bffba560 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Tue, 23 Jan 2018 22:03:18 +0000 Subject: [PATCH 077/312] Phase 2: #ifdef for Zodiacs and particles --- Engine/source/T3D/fx/particleEmitter.h | 10 ++++++---- Engine/source/T3D/gameBase/gameConnection.cpp | 7 +++++++ Engine/source/T3D/gameBase/gameConnection.h | 5 +++-- Engine/source/T3D/groundPlane.cpp | 6 ++++-- Engine/source/T3D/tsStatic.cpp | 10 ++++++++-- Engine/source/environment/meshRoad.cpp | 5 ++++- Engine/source/terrain/terrRender.cpp | 8 ++++++-- 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Engine/source/T3D/fx/particleEmitter.h b/Engine/source/T3D/fx/particleEmitter.h index 0750ab864..c3df9dad6 100644 --- a/Engine/source/T3D/fx/particleEmitter.h +++ b/Engine/source/T3D/fx/particleEmitter.h @@ -47,10 +47,12 @@ class RenderPassManager; class ParticleData; -#define AFX_CAP_PARTICLE_POOLS -#if defined(AFX_CAP_PARTICLE_POOLS) -class afxParticlePoolData; -class afxParticlePool; +#ifdef TORQUE_AFX_ENABLED + #define AFX_CAP_PARTICLE_POOLS + #if defined(AFX_CAP_PARTICLE_POOLS) + class afxParticlePoolData; + class afxParticlePool; + #endif #endif //***************************************************************************** diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index b1da7bf8f..03f9e6202 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -194,12 +194,14 @@ bool GameConnection::client_cache_on = false; //---------------------------------------------------------------------------- GameConnection::GameConnection() { +#ifdef TORQUE_AFX_ENABLED mRolloverObj = NULL; mPreSelectedObj = NULL; mSelectedObj = NULL; mChangedSelectedObj = false; mPreSelectTimestamp = 0; zoned_in = false; +#endif #ifdef AFX_CAP_DATABLOCK_CACHE client_db_stream = new InfiniteBitStream; @@ -1177,6 +1179,7 @@ void GameConnection::readPacket(BitStream *bstream) { mMoveList->clientReadMovePacket(bstream); +#ifdef TORQUE_AFX_ENABLED // selected object - do we have a change in status? if (bstream->readFlag()) { @@ -1188,6 +1191,8 @@ void GameConnection::readPacket(BitStream *bstream) else setSelectedObj(NULL); } +#endif + bool hadFlash = mDamageFlash > 0 || mWhiteOut > 0; mDamageFlash = 0; mWhiteOut = 0; @@ -1431,6 +1436,7 @@ void GameConnection::writePacket(BitStream *bstream, PacketNotify *note) // all the damage flash & white out S32 gIndex = -1; +#ifdef TORQUE_AFX_ENABLED if (mChangedSelectedObj) { S32 gidx; @@ -1459,6 +1465,7 @@ void GameConnection::writePacket(BitStream *bstream, PacketNotify *note) } else bstream->writeFlag(false); +#endif if (!mControlObject.isNull()) { diff --git a/Engine/source/T3D/gameBase/gameConnection.h b/Engine/source/T3D/gameBase/gameConnection.h index 427c8ce8d..cffd89d2d 100644 --- a/Engine/source/T3D/gameBase/gameConnection.h +++ b/Engine/source/T3D/gameBase/gameConnection.h @@ -385,7 +385,8 @@ protected: DECLARE_CALLBACK( void, setLagIcon, (bool state) ); DECLARE_CALLBACK( void, onDataBlocksDone, (U32 sequence) ); DECLARE_CALLBACK( void, onFlash, (bool state) ); - + +#ifdef TORQUE_AFX_ENABLED // GameConnection is modified to keep track of object selections which are used in // spell targeting. This code stores the current object selection as well as the // current rollover object beneath the cursor. The rollover object is treated as a @@ -415,7 +416,7 @@ private: public: bool isZonedIn() const { return zoned_in; } void setZonedIn() { zoned_in = true; } - +#endif #ifdef AFX_CAP_DATABLOCK_CACHE private: static StringTableEntry server_cache_filename; diff --git a/Engine/source/T3D/groundPlane.cpp b/Engine/source/T3D/groundPlane.cpp index 5e23a28ce..9e0065adb 100644 --- a/Engine/source/T3D/groundPlane.cpp +++ b/Engine/source/T3D/groundPlane.cpp @@ -44,8 +44,9 @@ #include "T3D/physics/physicsPlugin.h" #include "T3D/physics/physicsBody.h" #include "T3D/physics/physicsCollision.h" - +#ifdef TORQUE_AFX_ENABLED #include "afx/ce/afxZodiacMgr.h" +#endif /// Minimum square size allowed. This is a cheap way to limit the amount /// of geometry possibly generated by the GroundPlane (vertex buffers have a @@ -362,8 +363,9 @@ void GroundPlane::prepRenderImage( SceneRenderState* state ) createGeometry( state->getCullingFrustum() ); if( mVertexBuffer.isNull() ) return; - +#ifdef TORQUE_AFX_ENABLED afxZodiacMgr::renderGroundPlaneZodiacs(state, this); +#endif // Add a render instance. RenderPassManager* pass = state->getRenderPass(); diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index b2f33f44a..13964e632 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -58,8 +58,9 @@ using namespace Torque; extern bool gEditingMission; - +#ifdef TORQUE_AFX_ENABLED #include "afx/ce/afxZodiacMgr.h" +#endif IMPLEMENT_CO_NETOBJECT_V1(TSStatic); @@ -136,7 +137,9 @@ TSStatic::TSStatic() mHasGradients = false; mInvertGradientRange = false; mGradientRangeUser.set(0.0f, 180.0f); +#ifdef TORQUE_AFX_ENABLED afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser); +#endif } TSStatic::~TSStatic() @@ -721,9 +724,10 @@ void TSStatic::prepRenderImage( SceneRenderState* state ) } } mShapeInstance->render( rdata ); - +#ifdef TORQUE_AFX_ENABLED if (!mIgnoreZodiacs && mDecalDetailsPtr != 0) afxZodiacMgr::renderPolysoupZodiacs(state, this); +#endif if ( mRenderNormalScalar > 0 ) { ObjectRenderInst *ri = state->getRenderPass()->allocInst(); @@ -1399,11 +1403,13 @@ void TSStatic::set_special_typing() void TSStatic::onStaticModified(const char* slotName, const char*newValue) { +#ifdef TORQUE_AFX_ENABLED if (slotName == afxZodiacData::GradientRangeSlot) { afxZodiacData::convertGradientRangeFromDegrees(mGradientRange, mGradientRangeUser); return; } +#endif set_special_typing(); } diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index fc1619afb..0d523f9a7 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -56,8 +56,9 @@ #include "T3D/physics/physicsBody.h" #include "T3D/physics/physicsCollision.h" #include "environment/nodeListManager.h" - +#ifdef TORQUE_AFX_ENABLED #include "afx/ce/afxZodiacMgr.h" +#endif #define MIN_METERS_PER_SEGMENT 1.0f #define MIN_NODE_DEPTH 0.25f @@ -829,7 +830,9 @@ void MeshRoad::prepRenderImage( SceneRenderState* state ) // otherwise obey the smShowRoad flag if ( smShowRoad || !smEditorOpen ) { +#ifdef TORQUE_AFX_ENABLED afxZodiacMgr::renderMeshRoadZodiacs(state, this); +#endif MeshRenderInst coreRI; coreRI.clear(); coreRI.objectToWorld = &MatrixF::Identity; diff --git a/Engine/source/terrain/terrRender.cpp b/Engine/source/terrain/terrRender.cpp index bb0ba8f5d..a6bc3dfae 100644 --- a/Engine/source/terrain/terrRender.cpp +++ b/Engine/source/terrain/terrRender.cpp @@ -52,8 +52,9 @@ #ifdef TORQUE_AFX_ENABLED #include "afx/arcaneFX.h" -#endif #include "afx/ce/afxZodiacMgr.h" +#endif + #include "gfx/gfxTransformSaver.h" #include "gfx/bitmap/gBitmap.h" #include "gfx/bitmap/ddsFile.h" @@ -430,7 +431,9 @@ void TerrainBlock::_renderBlock( SceneRenderState *state ) if ( isColorDrawPass ) lm = LIGHTMGR; +#ifdef TORQUE_AFX_ENABLED bool has_zodiacs = afxZodiacMgr::doesBlockContainZodiacs(state, this); +#endif for ( U32 i=0; i < renderCells.size(); i++ ) { TerrCell *cell = renderCells[i]; @@ -492,10 +495,11 @@ void TerrainBlock::_renderBlock( SceneRenderState *state ) } inst->defaultKey = (U32)cell->getMaterials(); - +#ifdef TORQUE_AFX_ENABLED if (has_zodiacs) afxZodiacMgr::renderTerrainZodiacs(state, this, cell); // Submit it for rendering. +#endif renderPass->addInst( inst ); } From cd6947c7e057308e0ccda87981e39caa2eb7cc41 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Tue, 23 Jan 2018 22:48:20 +0000 Subject: [PATCH 078/312] Phase 3: Adjust cmake files to add #define to torque config --- Tools/CMake/modules/module_afx.cmake | 7 +++---- Tools/CMake/torqueConfig.h.in | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Tools/CMake/modules/module_afx.cmake b/Tools/CMake/modules/module_afx.cmake index 177af6e6d..9775a3ae0 100644 --- a/Tools/CMake/modules/module_afx.cmake +++ b/Tools/CMake/modules/module_afx.cmake @@ -20,8 +20,7 @@ # IN THE SOFTWARE. # ----------------------------------------------------------------------------- -option(TORQUE_AFX "Enable AFX module" ON) -if(TORQUE_AFX) -# files -addPathRec( "${srcDir}/afx" ) +option(TORQUE_AFX_ENABLED "Enable AFX module" ON) +if(TORQUE_AFX_ENABLED) + addPathRec( "${srcDir}/afx" ) endif() \ No newline at end of file diff --git a/Tools/CMake/torqueConfig.h.in b/Tools/CMake/torqueConfig.h.in index e25cdf22d..886195e06 100644 --- a/Tools/CMake/torqueConfig.h.in +++ b/Tools/CMake/torqueConfig.h.in @@ -41,6 +41,9 @@ /// Human readable application version string. #define TORQUE_APP_VERSION_STRING "@TORQUE_APP_VERSION_STRING@" +/// Define me if you want to enable Arcane FX support. +#cmakedefine TORQUE_AFX_ENABLED + /// Define me if you want to enable multithreading support. #cmakedefine TORQUE_MULTITHREAD From 878e09acb200d5ca547443115902ae5281bbc06d Mon Sep 17 00:00:00 2001 From: chaigler Date: Wed, 24 Jan 2018 08:02:23 -0500 Subject: [PATCH 079/312] Removes dxerr libs from SDL2 SDL2 wa still linking against dxerr.lib and dxerr8.lib but not actually using any code that requires them. Both libs are deprecated and no longer included in the Windows SDKs. --- Engine/lib/sdl/CMakeLists.txt | 5 ----- Engine/lib/sdl/configure.in | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Engine/lib/sdl/CMakeLists.txt b/Engine/lib/sdl/CMakeLists.txt index 54a23f0c7..ef82e73a0 100644 --- a/Engine/lib/sdl/CMakeLists.txt +++ b/Engine/lib/sdl/CMakeLists.txt @@ -1166,11 +1166,6 @@ elseif(WINDOWS) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) list(APPEND EXTRA_LIBS dinput8) - if(CMAKE_COMPILER_IS_MINGW) - list(APPEND EXTRA_LIBS dxerr8) - elseif (NOT USE_WINSDK_DIRECTX) - list(APPEND EXTRA_LIBS dxerr) - endif() endif() if(HAVE_XINPUT_H) set(SDL_JOYSTICK_XINPUT 1) diff --git a/Engine/lib/sdl/configure.in b/Engine/lib/sdl/configure.in index 37c57e288..f38f02e34 100644 --- a/Engine/lib/sdl/configure.in +++ b/Engine/lib/sdl/configure.in @@ -3144,7 +3144,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau fi if test x$have_dinput = xyes; then AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ]) - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid" fi else AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) From b52cda0c665bc9b167e43cf7665b681805ceea98 Mon Sep 17 00:00:00 2001 From: chaigler Date: Wed, 24 Jan 2018 08:17:40 -0500 Subject: [PATCH 080/312] Remove legacy_stdio_definitions.lib Dependency was added by PR #1566. No longer needed now that DX SDK has been replaced. --- Tools/CMake/torque3d.cmake | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index ccd0c0882..f9a531f12 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -643,13 +643,6 @@ if(WIN32) if(TORQUE_OPENGL) addLib(OpenGL32.lib) endif() - - # JTH: DXSDK is compiled with older runtime, and MSVC 2015+ is when __vsnprintf is undefined. - # This is a workaround by linking with the older legacy library functions. - # See this for more info: http://stackoverflow.com/a/34230122 - if (MSVC14) - addLib(legacy_stdio_definitions.lib) - endif() endif() if (APPLE) From 37b0ec68f7da5646261b3ac384d8891ba93e1962 Mon Sep 17 00:00:00 2001 From: chaigler Date: Wed, 24 Jan 2018 16:27:29 -0500 Subject: [PATCH 081/312] Fixes linker errors when Basic Lighting is removed --- .../lighting/advanced/advancedLightManager.cpp | 3 +++ .../lighting/advanced/advancedLightManager.h | 10 ++++++++++ Engine/source/lighting/common/projectedShadow.cpp | 14 +++++++++++--- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Engine/source/lighting/advanced/advancedLightManager.cpp b/Engine/source/lighting/advanced/advancedLightManager.cpp index 0b14a12a4..3c851cf81 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightManager.cpp @@ -39,6 +39,9 @@ #include "gfx/gfxCardProfile.h" #include "gfx/gfxTextureProfile.h" +#ifndef TORQUE_BASIC_LIGHTING +F32 AdvancedLightManager::smProjectedShadowFilterDistance = 40.0f; +#endif ImplementEnumType( ShadowType, "\n\n" diff --git a/Engine/source/lighting/advanced/advancedLightManager.h b/Engine/source/lighting/advanced/advancedLightManager.h index ac03bad48..ca747d8a0 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.h +++ b/Engine/source/lighting/advanced/advancedLightManager.h @@ -97,6 +97,10 @@ public: LightShadowMap* findShadowMapForObject( SimObject *object ); +#ifndef TORQUE_BASIC_LIGHTING + static F32 getShadowFilterDistance() { return smProjectedShadowFilterDistance; } +#endif + protected: // LightManager @@ -138,6 +142,12 @@ protected: LightingShaderConstants* getLightingShaderConstants(GFXShaderConstBuffer* shader); +#ifndef TORQUE_BASIC_LIGHTING + /// This is used to determine the distance + /// at which the shadow filtering PostEffect + /// will be enabled for ProjectedShadow. + static F32 smProjectedShadowFilterDistance; +#endif }; #endif // _ADVANCEDLIGHTMANAGER_H_ diff --git a/Engine/source/lighting/common/projectedShadow.cpp b/Engine/source/lighting/common/projectedShadow.cpp index 1ad88cd10..2f4657018 100644 --- a/Engine/source/lighting/common/projectedShadow.cpp +++ b/Engine/source/lighting/common/projectedShadow.cpp @@ -43,7 +43,11 @@ #include "materials/materialFeatureTypes.h" #include "console/console.h" #include "postFx/postEffect.h" -#include "lighting/basic/basicLightManager.h" +#ifdef TORQUE_BASIC_LIGHTING +#include "lighting/basic/basicLightManager.h" +#else +#include "lighting/advanced/advancedLightManager.h" +#endif #include "lighting/shadowMap/shadowMatHook.h" #include "materials/materialManager.h" #include "lighting/shadowMap/lightShadowMap.h" @@ -529,8 +533,12 @@ void ProjectedShadow::_renderToTexture( F32 camDist, const TSRenderState &rdata mRenderTarget->resolve(); GFX->popActiveRenderTarget(); - // If we're close enough then filter the shadow. - if ( camDist < BasicLightManager::getShadowFilterDistance() ) + // If we're close enough then filter the shadow. +#ifdef TORQUE_BASIC_LIGHTING + if (camDist < BasicLightManager::getShadowFilterDistance()) +#else + if (camDist < AdvancedLightManager::getShadowFilterDistance()) +#endif { if ( !smShadowFilter ) { From 4a72d54782a977939cd667bf8a10a570c8b988fe Mon Sep 17 00:00:00 2001 From: chaigler Date: Wed, 24 Jan 2018 16:30:34 -0500 Subject: [PATCH 082/312] Fix assert on exit when Basic Lighting is removed Occurs because ShadowMapManager is destroyed before AdvancedLightManager. --- Engine/source/lighting/shadowMap/shadowMapManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Engine/source/lighting/shadowMap/shadowMapManager.cpp b/Engine/source/lighting/shadowMap/shadowMapManager.cpp index 0b58abc37..7b801cc41 100644 --- a/Engine/source/lighting/shadowMap/shadowMapManager.cpp +++ b/Engine/source/lighting/shadowMap/shadowMapManager.cpp @@ -41,6 +41,9 @@ GFX_ImplementTextureProfile(ShadowMapTexProfile, MODULE_BEGIN( ShadowMapManager ) +#ifndef TORQUE_BASIC_LIGHTING + MODULE_SHUTDOWN_AFTER(Scene) +#endif MODULE_INIT { From 99355022985f190773b7f88589aa24cbf15af787 Mon Sep 17 00:00:00 2001 From: chaigler Date: Wed, 24 Jan 2018 19:09:08 -0500 Subject: [PATCH 083/312] Ensure file is closed before returning Fix for #2012 --- Engine/lib/collada/src/dae/daeRawResolver.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Engine/lib/collada/src/dae/daeRawResolver.cpp b/Engine/lib/collada/src/dae/daeRawResolver.cpp index f297a36f4..b1ee18577 100644 --- a/Engine/lib/collada/src/dae/daeRawResolver.cpp +++ b/Engine/lib/collada/src/dae/daeRawResolver.cpp @@ -57,8 +57,11 @@ daeElement* daeRawResolver::resolveElement(const daeURI& uri) { daeElement *accessor; accessor = uri.getContainer(); - if ( accessor == NULL ) - return NULL; + if (accessor == NULL) + { + fclose(rawFile); + return NULL; + } src = accessor->getParentElement()->getParentElement(); daeElementRefArray children; accessor->getChildren( children ); From fa460b332e90c65437158e4852097446354b7b31 Mon Sep 17 00:00:00 2001 From: Johxz Date: Sat, 27 Jan 2018 20:18:58 -0600 Subject: [PATCH 084/312] add a check for toolbuild --- Templates/BaseGame/game/main.cs.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/main.cs.in b/Templates/BaseGame/game/main.cs.in index 2ec150c0d..3eed267df 100644 --- a/Templates/BaseGame/game/main.cs.in +++ b/Templates/BaseGame/game/main.cs.in @@ -42,8 +42,11 @@ setNetPort(0); startFileChangeNotifications(); // If we have editors, initialize them here as well -if(isFile("tools/main.cs") && !$isDedicated) - exec("tools/main.cs"); +if (isToolBuild()) +{ + if(isFile("tools/main.cs") && !$isDedicated) + exec("tools/main.cs"); +} ModuleDatabase.setModuleExtension("module"); ModuleDatabase.scanModules( "data", false ); From ae5a43de702aa011660dc8c16aa584d59b9a6824 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 14:48:02 -0600 Subject: [PATCH 085/312] Asset Browser initial implementation - Asset updates. Script execution on certain existing assets, new asset types and some tweaks to the managers. --- Engine/source/T3D/assets/ComponentAsset.cpp | 36 ++- Engine/source/T3D/assets/ComponentAsset.h | 21 +- Engine/source/T3D/assets/ExampleAsset.cpp | 11 +- Engine/source/T3D/assets/ExampleAsset.h | 5 - Engine/source/T3D/assets/GUIAsset.cpp | 222 ++++++++++++++++ Engine/source/T3D/assets/GUIAsset.h | 89 +++++++ Engine/source/T3D/assets/GameObjectAsset.cpp | 102 +++++++- Engine/source/T3D/assets/GameObjectAsset.h | 30 ++- Engine/source/T3D/assets/ImageAsset.cpp | 161 ++++++++++++ Engine/source/T3D/assets/ImageAsset.h | 90 +++++++ Engine/source/T3D/assets/LevelAsset.cpp | 126 +++++++++ Engine/source/T3D/assets/LevelAsset.h | 72 ++++++ Engine/source/T3D/assets/MaterialAsset.cpp | 241 ++++++++++++++++++ Engine/source/T3D/assets/MaterialAsset.h | 101 ++++++++ Engine/source/T3D/assets/ParticleAsset.cpp | 205 +++++++++++++++ Engine/source/T3D/assets/ParticleAsset.h | 89 +++++++ Engine/source/T3D/assets/PostEffectAsset.cpp | 129 ++++++++++ Engine/source/T3D/assets/PostEffectAsset.h | 71 ++++++ Engine/source/T3D/assets/ScriptAsset.cpp | 137 ++++++++++ Engine/source/T3D/assets/ScriptAsset.h | 69 +++++ .../source/T3D/assets/ShapeAnimationAsset.cpp | 131 ++++++++++ .../source/T3D/assets/ShapeAnimationAsset.h | 102 ++++++++ Engine/source/T3D/assets/ShapeAsset.cpp | 232 +++++++++++++++-- Engine/source/T3D/assets/ShapeAsset.h | 54 +++- Engine/source/T3D/assets/SoundAsset.cpp | 141 ++++++++++ Engine/source/T3D/assets/SoundAsset.h | 75 ++++++ .../source/T3D/assets/stateMachineAsset.cpp | 207 +++++++++++++++ Engine/source/T3D/assets/stateMachineAsset.h | 89 +++++++ Engine/source/assets/assetBase.cpp | 2 +- Engine/source/assets/assetBase.h | 1 + Engine/source/assets/assetManager.cpp | 28 ++ Engine/source/assets/assetManager.h | 21 +- Engine/source/module/moduleDefinition.cpp | 2 + Engine/source/module/moduleManager.cpp | 105 +++++++- Engine/source/module/moduleManager.h | 8 +- .../module/moduleManager_ScriptBinding.h | 45 ++++ .../BaseGame/game/core/CoreComponents.module | 3 + .../core/components/game/camera.asset.taml | 4 +- .../components/game/controlObject.asset.taml | 4 +- .../components/game/itemRotate.asset.taml | 4 +- .../components/game/playerSpawner.asset.taml | 4 +- 41 files changed, 3173 insertions(+), 96 deletions(-) create mode 100644 Engine/source/T3D/assets/GUIAsset.cpp create mode 100644 Engine/source/T3D/assets/GUIAsset.h create mode 100644 Engine/source/T3D/assets/ImageAsset.cpp create mode 100644 Engine/source/T3D/assets/ImageAsset.h create mode 100644 Engine/source/T3D/assets/LevelAsset.cpp create mode 100644 Engine/source/T3D/assets/LevelAsset.h create mode 100644 Engine/source/T3D/assets/MaterialAsset.cpp create mode 100644 Engine/source/T3D/assets/MaterialAsset.h create mode 100644 Engine/source/T3D/assets/ParticleAsset.cpp create mode 100644 Engine/source/T3D/assets/ParticleAsset.h create mode 100644 Engine/source/T3D/assets/PostEffectAsset.cpp create mode 100644 Engine/source/T3D/assets/PostEffectAsset.h create mode 100644 Engine/source/T3D/assets/ScriptAsset.cpp create mode 100644 Engine/source/T3D/assets/ScriptAsset.h create mode 100644 Engine/source/T3D/assets/ShapeAnimationAsset.cpp create mode 100644 Engine/source/T3D/assets/ShapeAnimationAsset.h create mode 100644 Engine/source/T3D/assets/SoundAsset.cpp create mode 100644 Engine/source/T3D/assets/SoundAsset.h create mode 100644 Engine/source/T3D/assets/stateMachineAsset.cpp create mode 100644 Engine/source/T3D/assets/stateMachineAsset.h diff --git a/Engine/source/T3D/assets/ComponentAsset.cpp b/Engine/source/T3D/assets/ComponentAsset.cpp index b329d391f..83045832e 100644 --- a/Engine/source/T3D/assets/ComponentAsset.cpp +++ b/Engine/source/T3D/assets/ComponentAsset.cpp @@ -74,7 +74,7 @@ ConsoleSetType(TypeComponentAssetPtr) if (pAssetPtr == NULL) { // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + //Con::warnf("(TypeComponentAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); return; } @@ -85,24 +85,20 @@ ConsoleSetType(TypeComponentAssetPtr) } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeComponentAssetPtr) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -ComponentAsset::ComponentAsset() : - mpOwningAssetManager(NULL), - mAssetInitialized(false), - mAcquireReferenceCount(0) +ComponentAsset::ComponentAsset() { - // Generate an asset definition. - mpAssetDefinition = new AssetDefinition(); + mComponentName = StringTable->EmptyString(); + mComponentClass = StringTable->EmptyString(); + mFriendlyName = StringTable->EmptyString(); + mComponentType = StringTable->EmptyString(); + mDescription = StringTable->EmptyString(); - mComponentName = StringTable->lookup(""); - mComponentClass = StringTable->lookup(""); - mFriendlyName = StringTable->lookup(""); - mComponentType = StringTable->lookup(""); - mDescription = StringTable->lookup(""); + mScriptFile = StringTable->EmptyString(); } //----------------------------------------------------------------------------- @@ -127,6 +123,8 @@ void ComponentAsset::initPersistFields() addField("friendlyName", TypeString, Offset(mFriendlyName, ComponentAsset), "The human-readble name for the component."); addField("componentType", TypeString, Offset(mComponentType, ComponentAsset), "The category of the component for organizing in the editor."); addField("description", TypeString, Offset(mDescription, ComponentAsset), "Simple description of the component."); + + addField("scriptFile", TypeString, Offset(mScriptFile, ComponentAsset), "A script file with additional scripted functionality for this component."); } //------------------------------------------------------------------------------ @@ -135,4 +133,16 @@ void ComponentAsset::copyTo(SimObject* object) { // Call to parent. Parent::copyTo(object); +} + +void ComponentAsset::initializeAsset() +{ + if(Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); +} + +void ComponentAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); } \ No newline at end of file diff --git a/Engine/source/T3D/assets/ComponentAsset.h b/Engine/source/T3D/assets/ComponentAsset.h index 1db53b8c8..9d803970b 100644 --- a/Engine/source/T3D/assets/ComponentAsset.h +++ b/Engine/source/T3D/assets/ComponentAsset.h @@ -44,17 +44,14 @@ class ComponentAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - StringTableEntry mComponentName; StringTableEntry mComponentClass; StringTableEntry mFriendlyName; StringTableEntry mComponentType; StringTableEntry mDescription; + StringTableEntry mScriptFile; + public: ComponentAsset(); virtual ~ComponentAsset(); @@ -69,12 +66,20 @@ public: StringTableEntry getComponentName() { return mComponentName; } StringTableEntry getComponentClass() { return mComponentClass; } StringTableEntry getFriendlyName() { return mFriendlyName; } - StringTableEntry getFriendlyType() { return mComponentType; } + StringTableEntry getComponentType() { return mComponentType; } StringTableEntry getDescription() { return mDescription; } + void setComponentName(StringTableEntry name) { mComponentName = name; } + void setComponentClass(StringTableEntry name) { mComponentClass = name; } + void setFriendlyName(StringTableEntry name) { mFriendlyName = name; } + void setComponentType(StringTableEntry typeName) { mComponentType = typeName; } + void setDescription(StringTableEntry description) { mDescription = description; } + + AssetDefinition* getAssetDefinition() { return mpAssetDefinition; } + protected: - virtual void initializeAsset(void) {} - virtual void onAssetRefresh(void) {} + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); }; DefineConsoleType(TypeComponentAssetPtr, ComponentAsset) diff --git a/Engine/source/T3D/assets/ExampleAsset.cpp b/Engine/source/T3D/assets/ExampleAsset.cpp index eed7a4d19..b8c43ac07 100644 --- a/Engine/source/T3D/assets/ExampleAsset.cpp +++ b/Engine/source/T3D/assets/ExampleAsset.cpp @@ -74,7 +74,7 @@ ConsoleSetType(TypeExampleAssetPtr) if (pAssetPtr == NULL) { // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + //Con::warnf("(TypeExampleAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); return; } @@ -85,18 +85,13 @@ ConsoleSetType(TypeExampleAssetPtr) } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeExampleAssetPtr) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -ExampleAsset::ExampleAsset() : -mpOwningAssetManager(NULL), -mAssetInitialized(false), -mAcquireReferenceCount(0) +ExampleAsset::ExampleAsset() { - // Generate an asset definition. - mpAssetDefinition = new AssetDefinition(); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/assets/ExampleAsset.h b/Engine/source/T3D/assets/ExampleAsset.h index 43532a6e5..b3a5a7695 100644 --- a/Engine/source/T3D/assets/ExampleAsset.h +++ b/Engine/source/T3D/assets/ExampleAsset.h @@ -43,11 +43,6 @@ class ExampleAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - public: ExampleAsset(); virtual ~ExampleAsset(); diff --git a/Engine/source/T3D/assets/GUIAsset.cpp b/Engine/source/T3D/assets/GUIAsset.cpp new file mode 100644 index 000000000..a011b56e3 --- /dev/null +++ b/Engine/source/T3D/assets/GUIAsset.cpp @@ -0,0 +1,222 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef GUI_ASSET_H +#include "GUIAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GUIAsset); + +ConsoleType(GUIAssetPtr, TypeGUIAssetPtr, GUIAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeGUIAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeGUIAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeGUIAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeGUIAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +GUIAsset::GUIAsset() +{ + mScriptFilePath = StringTable->EmptyString(); + mGUIFilePath = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +GUIAsset::~GUIAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void GUIAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFilePath", TypeString, Offset(mScriptFilePath, GUIAsset), "Path to the script file for the gui"); + addField("GUIFilePath", TypeString, Offset(mGUIFilePath, GUIAsset), "Path to the gui file"); +} + +//------------------------------------------------------------------------------ + +void GUIAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void GUIAsset::initializeAsset() +{ + if (Platform::isFile(mGUIFilePath)) + Con::executeFile(mGUIFilePath, false, false); + + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +void GUIAsset::onAssetRefresh() +{ + if (Platform::isFile(mGUIFilePath)) + Con::executeFile(mGUIFilePath, false, false); + + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeGUIAssetPtr); + +ConsoleDocClass(GuiInspectorTypeGUIAssetPtr, + "@brief Inspector field type for GUI Asset Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeGUIAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeGUIAssetPtr)->setInspectorFieldType("GuiInspectorTypeGUIAssetPtr"); +} + +GuiControl* GuiInspectorTypeGUIAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"GUIAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeGUIAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/GUIAsset.h b/Engine/source/T3D/assets/GUIAsset.h new file mode 100644 index 000000000..5668f9afd --- /dev/null +++ b/Engine/source/T3D/assets/GUIAsset.h @@ -0,0 +1,89 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef GUI_ASSET_H +#define GUI_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" + +//----------------------------------------------------------------------------- +class GUIAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mScriptFilePath; + StringTableEntry mGUIFilePath; + +public: + GUIAsset(); + virtual ~GUIAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(GUIAsset); + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); +}; + +DefineConsoleType(TypeGUIAssetPtr, GUIAsset) + + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeGUIAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeGUIAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/GameObjectAsset.cpp b/Engine/source/T3D/assets/GameObjectAsset.cpp index 6659504bd..45b33b086 100644 --- a/Engine/source/T3D/assets/GameObjectAsset.cpp +++ b/Engine/source/T3D/assets/GameObjectAsset.cpp @@ -74,7 +74,7 @@ ConsoleSetType(TypeGameObjectAssetPtr) if (pAssetPtr == NULL) { // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + //Con::warnf("(TypeGameObjectAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); return; } @@ -85,19 +85,13 @@ ConsoleSetType(TypeGameObjectAssetPtr) } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeGameObjectAssetPtr) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -GameObjectAsset::GameObjectAsset() : - mpOwningAssetManager(NULL), - mAssetInitialized(false), - mAcquireReferenceCount(0) +GameObjectAsset::GameObjectAsset() { - // Generate an asset definition. - mpAssetDefinition = new AssetDefinition(); - mGameObjectName = StringTable->lookup(""); mScriptFilePath = StringTable->lookup(""); mTAMLFilePath = StringTable->lookup(""); @@ -131,4 +125,94 @@ void GameObjectAsset::copyTo(SimObject* object) { // Call to parent. Parent::copyTo(object); +} + +void GameObjectAsset::initializeAsset() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +void GameObjectAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeGameObjectAssetPtr); + +ConsoleDocClass(GuiInspectorTypeGameObjectAssetPtr, + "@brief Inspector field type for Game Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeGameObjectAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeGameObjectAssetPtr)->setInspectorFieldType("GuiInspectorTypeGameObjectAssetPtr"); +} + +GuiControl* GuiInspectorTypeGameObjectAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"GameObjectAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeGameObjectAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; } \ No newline at end of file diff --git a/Engine/source/T3D/assets/GameObjectAsset.h b/Engine/source/T3D/assets/GameObjectAsset.h index 82230cd5c..954a11300 100644 --- a/Engine/source/T3D/assets/GameObjectAsset.h +++ b/Engine/source/T3D/assets/GameObjectAsset.h @@ -38,17 +38,15 @@ #ifndef _ASSET_FIELD_TYPES_H_ #include "assets/assetFieldTypes.h" #endif +#ifndef _GUI_INSPECTOR_TYPES_H_ +#include "gui/editor/guiInspectorTypes.h" +#endif //----------------------------------------------------------------------------- class GameObjectAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - StringTableEntry mGameObjectName; StringTableEntry mScriptFilePath; StringTableEntry mTAMLFilePath; @@ -65,11 +63,29 @@ public: DECLARE_CONOBJECT(GameObjectAsset); protected: - virtual void initializeAsset(void) {} - virtual void onAssetRefresh(void) {} + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); }; DefineConsoleType(TypeGameObjectAssetPtr, GameObjectAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeGameObjectAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeGameObjectAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + #endif // _ASSET_BASE_H_ diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp new file mode 100644 index 000000000..3e29b0bdf --- /dev/null +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -0,0 +1,161 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef IMAGE_ASSET_H +#include "ImageAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ImageAsset); + +ConsoleType(ImageAssetPtr, TypeImageAssetPtr, ImageAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeImageAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeImageAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeImageAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeImageAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ImageAsset::ImageAsset() +{ + mImageFileName = StringTable->EmptyString(); + + mImage = NULL; + mUseMips = true; + mIsHDRImage = false; + mIsValidImage = false; +} + +//----------------------------------------------------------------------------- + +ImageAsset::~ImageAsset() +{ +} + +//----------------------------------------------------------------------------- + +void ImageAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("imageFile", TypeString, Offset(mImageFileName, ImageAsset), "Path to the image file."); + addField("useMips", TypeBool, Offset(mUseMips, ImageAsset), "Should the image use mips? (Currently unused)."); + addField("isHDRImage", TypeBool, Offset(mIsHDRImage, ImageAsset), "Is the image in an HDR format? (Currently unused)"); +} + +//------------------------------------------------------------------------------ + +void ImageAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void ImageAsset::loadImage() +{ + SAFE_DELETE(mImage); + + if (mImageFileName) + { + if (!Platform::isFile(mImageFileName)) + { + Con::errorf("ImageAsset::initializeAsset: Attempted to load file %s but it was not valid!", mImageFileName); + return; + } + + mImage.set(mImageFileName, &GFXStaticTextureSRGBProfile, avar("%s() - mImage (line %d)", __FUNCTION__, __LINE__)); + + if (mImage) + { + mIsValidImage = true; + return; + } + } + + mIsValidImage = false; +} + +void ImageAsset::initializeAsset() +{ + loadImage(); +} + +void ImageAsset::onAssetRefresh() +{ + loadImage(); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h new file mode 100644 index 000000000..d289ac195 --- /dev/null +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -0,0 +1,90 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef IMAGE_ASSET_H +#define IMAGE_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gfx/bitmap/gBitmap.h" +#include "gfx/gfxTextureHandle.h" + +//----------------------------------------------------------------------------- +class ImageAsset : public AssetBase +{ + typedef AssetBase Parent; + + AssetManager* mpOwningAssetManager; + bool mAssetInitialized; + AssetDefinition* mpAssetDefinition; + U32 mAcquireReferenceCount; + + StringTableEntry mImageFileName; + + GFXTexHandle mImage; + + bool mIsValidImage; + bool mUseMips; + bool mIsHDRImage; + +public: + ImageAsset(); + virtual ~ImageAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ImageAsset); + + StringTableEntry getImageFileName() { return mImageFileName; } + + bool isValid() { return mIsValidImage; } + + GFXTexHandle* getImage() { return &mImage; } + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); + + void loadImage(); +}; + +DefineConsoleType(TypeImageAssetPtr, ImageAsset) + +#endif + diff --git a/Engine/source/T3D/assets/LevelAsset.cpp b/Engine/source/T3D/assets/LevelAsset.cpp new file mode 100644 index 000000000..849cdc8d7 --- /dev/null +++ b/Engine/source/T3D/assets/LevelAsset.cpp @@ -0,0 +1,126 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef LEVEL_ASSET_H +#include "LevelAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(LevelAsset); + +ConsoleType(LevelAssetPtr, TypeLevelAssetPtr, LevelAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeLevelAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeLevelAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeLevelAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeLevelAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +LevelAsset::LevelAsset() +{ + mLevelFile = StringTable->EmptyString(); + mPreviewImage = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +LevelAsset::~LevelAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void LevelAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("LevelFile", TypeString, Offset(mLevelFile, LevelAsset), "Path to the actual level file."); + addField("PreviewImage", TypeString, Offset(mPreviewImage, LevelAsset), "Path to the image used for selection preview."); +} + +//------------------------------------------------------------------------------ + +void LevelAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/LevelAsset.h b/Engine/source/T3D/assets/LevelAsset.h new file mode 100644 index 000000000..3fc58c183 --- /dev/null +++ b/Engine/source/T3D/assets/LevelAsset.h @@ -0,0 +1,72 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef LEVEL_ASSET_H +#define LEVEL_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +//----------------------------------------------------------------------------- +class LevelAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mLevelFile; + StringTableEntry mPreviewImage; + + bool mIsSubLevel; + StringTableEntry mMainLevelAsset; + +public: + LevelAsset(); + virtual ~LevelAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(LevelAsset); + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} +}; + +DefineConsoleType(TypeLevelAssetPtr, LevelAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp new file mode 100644 index 000000000..697f21e37 --- /dev/null +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -0,0 +1,241 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef MATERIALASSET_H +#include "MaterialAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(MaterialAsset); + +ConsoleType(MaterialAssetPtr, TypeMaterialAssetPtr, MaterialAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeMaterialAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeMaterialAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeMaterialAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeMaterialAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +MaterialAsset::MaterialAsset() +{ + mShaderGraphFile = ""; + mScriptFile = ""; + mMatDefinitionName = ""; +} + +//----------------------------------------------------------------------------- + +MaterialAsset::~MaterialAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void MaterialAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + //addField("shaderGraph", TypeRealString, Offset(mShaderGraphFile, MaterialAsset), ""); + addField("scriptFile", TypeRealString, Offset(mScriptFile, MaterialAsset), "Path to the file containing the material definition."); + addField("materialDefinitionName", TypeRealString, Offset(mMatDefinitionName, MaterialAsset), "Name of the material definition this asset is for."); +} + +void MaterialAsset::initializeAsset() +{ + // Call parent. + Parent::initializeAsset(); + + compileShader(); + + if (Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); +} + +void MaterialAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFile)) + Con::executeFile(mScriptFile, false, false); + + if (!mMatDefinitionName.isEmpty()) + { + Material* matDef; + if (!Sim::findObject(mMatDefinitionName.c_str(), matDef)) + { + Con::errorf("MaterialAsset: Unable to find the Material %s", mMatDefinitionName.c_str()); + return; + } + + matDef->reload(); + } +} + +//------------------------------------------------------------------------------ + +void MaterialAsset::compileShader() +{ +} + +void MaterialAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +ConsoleMethod(MaterialAsset, compileShader, void, 2, 2, "() - Compiles the material's generated shader, if any. Not yet implemented\n") +{ + object->compileShader(); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeMaterialAssetPtr); + +ConsoleDocClass(GuiInspectorTypeMaterialAssetPtr, + "@brief Inspector field type for Material Asset Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeMaterialAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeMaterialAssetPtr)->setInspectorFieldType("GuiInspectorTypeMaterialAssetPtr"); +} + +GuiControl* GuiInspectorTypeMaterialAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"MaterialAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Material Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeMaterialAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h new file mode 100644 index 000000000..2cb9f15b1 --- /dev/null +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef MATERIALASSET_H +#define MATERIALASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#ifndef _GFXDEVICE_H_ +#include "gfx/gfxDevice.h" +#endif + +#ifndef _GUI_INSPECTOR_TYPES_H_ +#include "gui/editor/guiInspectorTypes.h" +#endif + +#include "materials/matTextureTarget.h" +#include "materials/materialDefinition.h" +#include "materials/customMaterialDefinition.h" + +//----------------------------------------------------------------------------- +class MaterialAsset : public AssetBase +{ + typedef AssetBase Parent; + + String mShaderGraphFile; + String mScriptFile; + String mMatDefinitionName; + +public: + MaterialAsset(); + virtual ~MaterialAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + virtual void initializeAsset(); + virtual void onAssetRefresh(void); + + void compileShader(); + + String getMaterialDefinitionName() { return mMatDefinitionName; } + + /// Declare Console Object. + DECLARE_CONOBJECT(MaterialAsset); +}; + +DefineConsoleType(TypeMaterialAssetPtr, MaterialAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeMaterialAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeMaterialAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ParticleAsset.cpp b/Engine/source/T3D/assets/ParticleAsset.cpp new file mode 100644 index 000000000..bcefd2dfa --- /dev/null +++ b/Engine/source/T3D/assets/ParticleAsset.cpp @@ -0,0 +1,205 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef PARTICLE_ASSET_H +#include "ParticleAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ParticleAsset); + +ConsoleType(ParticleAssetPtr, TypeParticleAssetPtr, ParticleAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeParticleAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeParticleAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeParticleAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeParticleAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ParticleAsset::ParticleAsset() +{ + mScriptFilePath = StringTable->EmptyString(); + mDatablockFilePath = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +ParticleAsset::~ParticleAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void ParticleAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFilePath", TypeString, Offset(mScriptFilePath, ParticleAsset), "Path to the script file for the particle effect"); + addField("DatablockFilePath", TypeString, Offset(mDatablockFilePath, ParticleAsset), "Path to the datablock file"); +} + +//------------------------------------------------------------------------------ + +void ParticleAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeParticleAssetPtr); + +ConsoleDocClass(GuiInspectorTypeParticleAssetPtr, + "@brief Inspector field type for Partial Asset Objects\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeParticleAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeParticleAssetPtr)->setInspectorFieldType("GuiInspectorTypeParticleAssetPtr"); +} + +GuiControl* GuiInspectorTypeParticleAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ParticleAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeParticleAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ParticleAsset.h b/Engine/source/T3D/assets/ParticleAsset.h new file mode 100644 index 000000000..b446c2cf0 --- /dev/null +++ b/Engine/source/T3D/assets/ParticleAsset.h @@ -0,0 +1,89 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef PARTICLE_ASSET_H +#define PARTICLE_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" + +//----------------------------------------------------------------------------- +class ParticleAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mScriptFilePath; + StringTableEntry mDatablockFilePath; + +public: + ParticleAsset(); + virtual ~ParticleAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ParticleAsset); + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} +}; + +DefineConsoleType(TypeParticleAssetPtr, ParticleAsset) + + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeParticleAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeParticleAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/PostEffectAsset.cpp b/Engine/source/T3D/assets/PostEffectAsset.cpp new file mode 100644 index 000000000..4eb67a6a3 --- /dev/null +++ b/Engine/source/T3D/assets/PostEffectAsset.cpp @@ -0,0 +1,129 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef POSTEFFECT_ASSET_H +#include "PostEffectAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(PostEffectAsset); + +ConsoleType(PostEffectAssetPtr, TypePostEffectAssetPtr, PostEffectAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypePostEffectAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypePostEffectAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypePostEffectAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypePostEffectAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +PostEffectAsset::PostEffectAsset() +{ + mScriptFile = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +PostEffectAsset::~PostEffectAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void PostEffectAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFile", TypeString, Offset(mScriptFile, PostEffectAsset), "Path to the script file."); +} + +//------------------------------------------------------------------------------ + +void PostEffectAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void PostEffectAsset::initializeAsset() +{ + //mPostEffect = new PostEffect(); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/PostEffectAsset.h b/Engine/source/T3D/assets/PostEffectAsset.h new file mode 100644 index 000000000..381fa1576 --- /dev/null +++ b/Engine/source/T3D/assets/PostEffectAsset.h @@ -0,0 +1,71 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef POSTEFFECT_ASSET_H +#define POSTEFFECT_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "postFx/postEffect.h" + +//----------------------------------------------------------------------------- +class PostEffectAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mScriptFile; + +public: + PostEffectAsset(); + virtual ~PostEffectAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + virtual void initializeAsset(); + + /// Declare Console Object. + DECLARE_CONOBJECT(PostEffectAsset); + +protected: + virtual void onAssetRefresh(void) {} +}; + +DefineConsoleType(TypePostEffectAssetPtr, PostEffectAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ScriptAsset.cpp b/Engine/source/T3D/assets/ScriptAsset.cpp new file mode 100644 index 000000000..dbc5e7a2e --- /dev/null +++ b/Engine/source/T3D/assets/ScriptAsset.cpp @@ -0,0 +1,137 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SCRIPT_ASSET_H +#include "ScriptAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ScriptAsset); + +ConsoleType(ScriptAssetPtr, TypeScriptAssetPtr, ScriptAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeScriptAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeScriptAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeScriptAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeScriptAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ScriptAsset::ScriptAsset() +{ + mScriptFilePath = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +ScriptAsset::~ScriptAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void ScriptAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("scriptFilePath", TypeString, Offset(mScriptFilePath, ScriptAsset), "Path to the script file."); + addField("isServerSide", TypeBool, Offset(mIsServerSide, ScriptAsset), "Is this script file to be run on the server side?"); + +} + +//------------------------------------------------------------------------------ + +void ScriptAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void ScriptAsset::initializeAsset() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} + +void ScriptAsset::onAssetRefresh() +{ + if (Platform::isFile(mScriptFilePath)) + Con::executeFile(mScriptFilePath, false, false); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ScriptAsset.h b/Engine/source/T3D/assets/ScriptAsset.h new file mode 100644 index 000000000..8c12f2b88 --- /dev/null +++ b/Engine/source/T3D/assets/ScriptAsset.h @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SCRIPT_ASSET_H +#define SCRIPT_ASSET_H +#pragma once + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +//----------------------------------------------------------------------------- +class ScriptAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mScriptFilePath; + bool mIsServerSide; + +public: + ScriptAsset(); + virtual ~ScriptAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ScriptAsset); + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); +}; + +DefineConsoleType(TypeScriptAssetPtr, ScriptAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp new file mode 100644 index 000000000..ee10bbe40 --- /dev/null +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp @@ -0,0 +1,131 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef SHAPE_ANIMATION_ASSET_H +#include "ShapeAnimationAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +#include "core/resourceManager.h" + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(ShapeAnimationAsset); + +ConsoleType(ShapeAnimationAssetPtr, TypeShapeAnimationAssetPtr, ShapeAnimationAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeShapeAnimationAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeShapeAnimationAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeShapeAnimationAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeShapeAnimationAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +ShapeAnimationAsset::ShapeAnimationAsset() +{ +} + +//----------------------------------------------------------------------------- + +ShapeAnimationAsset::~ShapeAnimationAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void ShapeAnimationAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("animationFile", TypeFilename, Offset(mFileName, ShapeAnimationAsset), "Path to the file name containing the animation"); + addField("animationName", TypeString, Offset(mAnimationName, ShapeAnimationAsset), "Name of the animation"); + + addField("startFrame", TypeS32, Offset(mStartFrame, ShapeAnimationAsset), "What frame does this animation clip start on"); + addField("endFrame", TypeS32, Offset(mEndFrame, ShapeAnimationAsset), "What fram does this animation clip end on"); + addField("padRotation", TypeBool, Offset(mPadRotation, ShapeAnimationAsset), "Are the rotation values padded"); + addField("padTransforms", TypeBool, Offset(mPadTransforms, ShapeAnimationAsset), "Are the transform values padded"); +} + +//------------------------------------------------------------------------------ + +void ShapeAnimationAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.h b/Engine/source/T3D/assets/ShapeAnimationAsset.h new file mode 100644 index 000000000..673607d53 --- /dev/null +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.h @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SHAPE_ANIMATION_ASSET_H +#define SHAPE_ANIMATION_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +//----------------------------------------------------------------------------- +class ShapeAnimationAsset : public AssetBase +{ + typedef AssetBase Parent; + +protected: + StringTableEntry mFileName; + + // + StringTableEntry mAnimationName; + S32 mStartFrame; + S32 mEndFrame; + bool mPadRotation; + bool mPadTransforms; + +public: + ShapeAnimationAsset(); + virtual ~ShapeAnimationAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(ShapeAnimationAsset); + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} + +public: + StringTableEntry getAnimationFilename() { return mFileName; } + StringTableEntry getAnimationName() { return mAnimationName; } + + S32 getStartFrame() { return mStartFrame; } + S32 getEndFrame() { return mEndFrame; } + + bool getPadRotation() { return mPadRotation; } + bool getPadTransforms() { return mPadTransforms; } +}; + +DefineConsoleType(TypeShapeAnimationAssetPtr, ShapeAnimationAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +/*class GuiInspectorTypeShapeAnimationAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mShapeEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeShapeAnimationAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +};*/ + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index d8cbce453..099c3c117 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -49,14 +49,14 @@ IMPLEMENT_CONOBJECT(ShapeAsset); -ConsoleType(TestAssetPtr, TypeShapeAssetPtr, ShapeAsset, ASSET_ID_FIELD_PREFIX) +ConsoleType(assetIdString, TypeShapeAssetPtr, String, ASSET_ID_FIELD_PREFIX) //----------------------------------------------------------------------------- ConsoleGetType(TypeShapeAssetPtr) { // Fetch asset Id. - return (*((AssetPtr*)dptr)).getAssetId(); + return *((StringTableEntry*)dptr); } //----------------------------------------------------------------------------- @@ -69,33 +69,22 @@ ConsoleSetType(TypeShapeAssetPtr) // Yes, so fetch field value. const char* pFieldValue = argv[0]; - // Fetch asset pointer. - AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + // Fetch asset Id. + StringTableEntry* assetId = (StringTableEntry*)(dptr); - // Is the asset pointer the correct type? - if (pAssetPtr == NULL) - { - // No, so fail. - //Con::warnf("(TypeTextureAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); - return; - } - - // Set asset. - pAssetPtr->setAssetId(pFieldValue); + // Update asset value. + *assetId = StringTable->insert(pFieldValue); return; } // Warn. - Con::warnf("(TypeTextureAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeAssetId) - Cannot set multiple args to a single asset."); } //----------------------------------------------------------------------------- -ShapeAsset::ShapeAsset() : -mpOwningAssetManager(NULL), -mAssetInitialized(false), -mAcquireReferenceCount(0) +ShapeAsset::ShapeAsset() { } @@ -116,7 +105,21 @@ void ShapeAsset::initPersistFields() // Call parent. Parent::initPersistFields(); - addField("fileName", TypeFilename, Offset(mFileName, ShapeAsset), "Path to the script file we want to execute"); + addField("fileName", TypeFilename, Offset(mFileName, ShapeAsset), "Path to the shape file we want to render"); +} + +void ShapeAsset::setDataField(StringTableEntry slotName, const char *array, const char *value) +{ + Parent::setDataField(slotName, array, value); + + //Now, if it's a material slot of some fashion, set it up + StringTableEntry matSlotName = StringTable->insert("materialAsset"); + if (String(slotName).startsWith(matSlotName)) + { + StringTableEntry matId = StringTable->insert(value); + + mMaterialAssetIds.push_back(matId); + } } void ShapeAsset::initializeAsset() @@ -132,6 +135,45 @@ void ShapeAsset::initializeAsset() bool ShapeAsset::loadShape() { + mMaterialAssets.clear(); + mMaterialAssetIds.clear(); + + //First, load any material, animation, etc assets we may be referencing in our asset + // Find any asset dependencies. + AssetManager::typeAssetDependsOnHash::Iterator assetDependenciesItr = mpOwningAssetManager->getDependedOnAssets()->find(mpAssetDefinition->mAssetId); + + // Does the asset have any dependencies? + if (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end()) + { + // Iterate all dependencies. + while (assetDependenciesItr != mpOwningAssetManager->getDependedOnAssets()->end() && assetDependenciesItr->key == mpAssetDefinition->mAssetId) + { + StringTableEntry assetType = mpOwningAssetManager->getAssetType(assetDependenciesItr->value); + + if (assetType == StringTable->insert("MaterialAsset")) + { + mMaterialAssetIds.push_back(assetDependenciesItr->value); + + //Force the asset to become initialized if it hasn't been already + AssetPtr matAsset = assetDependenciesItr->value; + + mMaterialAssets.push_back(matAsset); + } + else if (assetType == StringTable->insert("ShapeAnimationAsset")) + { + mAnimationAssetIds.push_back(assetDependenciesItr->value); + + //Force the asset to become initialized if it hasn't been already + AssetPtr animAsset = assetDependenciesItr->value; + + mAnimationAssets.push_back(animAsset); + } + + // Next dependency. + assetDependenciesItr++; + } + } + mShape = ResourceManager::get().load(mFileName); if (!mShape) @@ -140,6 +182,19 @@ bool ShapeAsset::loadShape() return false; //if it failed to load, bail out } + //Now that we've successfully loaded our shape and have any materials and animations loaded + //we need to set up the animations we're using on our shape + for (U32 i = 0; i < mAnimationAssets.size(); i++) + { + String srcName; + String srcPath(mAnimationAssets[i]->getAnimationFilename()); + SplitSequencePathAndName(srcPath, srcName); + + if (!mShape->addSequence(srcPath, srcName, mAnimationAssets[i]->getAnimationName(), + mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms())) + return false; + } + return true; } @@ -153,4 +208,141 @@ void ShapeAsset::copyTo(SimObject* object) void ShapeAsset::onAssetRefresh(void) { + if (dStrcmp(mFileName, "") == 0) + return; + + loadShape(); +} + +void ShapeAsset::SplitSequencePathAndName(String& srcPath, String& srcName) +{ + srcName = ""; + + // Determine if there is a sequence name at the end of the source string, and + // if so, split the filename from the sequence name + S32 split = srcPath.find(' ', 0, String::Right); + S32 split2 = srcPath.find('\t', 0, String::Right); + if ((split == String::NPos) || (split2 > split)) + split = split2; + if (split != String::NPos) + { + split2 = split + 1; + while ((srcPath[split2] != '\0') && dIsspace(srcPath[split2])) + split2++; + + // now 'split' is at the end of the path, and 'split2' is at the start of the sequence name + srcName = srcPath.substr(split2); + srcPath = srcPath.erase(split, srcPath.length() - split); + } +} + +ShapeAnimationAsset* ShapeAsset::getAnimation(S32 index) +{ + if (index < mAnimationAssets.size()) + { + return mAnimationAssets[index]; + } + + return nullptr; +} + +DefineEngineMethod(ShapeAsset, getMaterialCount, S32, (), , + "Gets the number of materials for this shape asset.\n" + "@return Material count.\n") +{ + return object->getMaterialCount(); +} + +DefineEngineMethod(ShapeAsset, getAnimationCount, S32, (), , + "Gets the number of animations for this shape asset.\n" + "@return Animation count.\n") +{ + return object->getAnimationCount(); +} + +DefineEngineMethod(ShapeAsset, getAnimation, ShapeAnimationAsset*, (S32 index), (0), + "Gets a particular shape animation asset for this shape.\n" + "@param animation asset index.\n" + "@return Shape Animation Asset.\n") +{ + return object->getAnimation(index); +} +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeShapeAssetPtr); + +ConsoleDocClass(GuiInspectorTypeShapeAssetPtr, + "@brief Inspector field type for Shapes\n\n" + "Editor use only.\n\n" + "@internal" + ); + +void GuiInspectorTypeShapeAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeShapeAssetPtr)->setInspectorFieldType("GuiInspectorTypeShapeAssetPtr"); +} + +GuiControl* GuiInspectorTypeShapeAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"ShapeAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + setDataField(StringTable->insert("ComponentOwner"), NULL, String::ToString(mInspector->getComponentGroupTargetId()).c_str()); + + // Create "Open in ShapeEditor" button + mShapeEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.openShapeAsset(%d.getText());", retCtrl->getId()); + mShapeEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mShapeEdButton->setBitmap(bitmapName); + + mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mShapeEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mShapeEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor"); + + mShapeEdButton->registerObject(); + addObject(mShapeEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeShapeAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mShapeEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mShapeEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; } \ No newline at end of file diff --git a/Engine/source/T3D/assets/ShapeAsset.h b/Engine/source/T3D/assets/ShapeAsset.h index d727d0a1c..45fca7e86 100644 --- a/Engine/source/T3D/assets/ShapeAsset.h +++ b/Engine/source/T3D/assets/ShapeAsset.h @@ -44,21 +44,35 @@ #ifndef __RESOURCE_H__ #include "core/resource.h" #endif +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif +#ifndef MATERIALASSET_H +#include "MaterialAsset.h" +#endif +#ifndef SHAPE_ANIMATION_ASSET_H +#include "ShapeAnimationAsset.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" //----------------------------------------------------------------------------- class ShapeAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - protected: StringTableEntry mFileName; Resource mShape; + //Material assets we're dependent on and use + Vector mMaterialAssetIds; + Vector> mMaterialAssets; + + //Animation assets we're dependent on and use + Vector mAnimationAssetIds; + Vector> mAnimationAssets; + public: ShapeAsset(); virtual ~ShapeAsset(); @@ -67,6 +81,8 @@ public: static void initPersistFields(); virtual void copyTo(SimObject* object); + virtual void setDataField(StringTableEntry slotName, const char *array, const char *value); + virtual void initializeAsset(); /// Declare Console Object. @@ -78,11 +94,37 @@ public: Resource getShapeResource() { return mShape; } + void SplitSequencePathAndName(String& srcPath, String& srcName); + String getShapeFilename() { return mFileName; } + + U32 getShapeFilenameHash() { return _StringTable::hashString(mFileName); } + + S32 getMaterialCount() { return mMaterialAssets.size(); } + S32 getAnimationCount() { return mAnimationAssets.size(); } + ShapeAnimationAsset* getAnimation(S32 index); + protected: virtual void onAssetRefresh(void); }; -DefineConsoleType(TypeShapeAssetPtr, ShapeAsset) +DefineConsoleType(TypeShapeAssetPtr, S32) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeShapeAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mShapeEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeShapeAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; #endif diff --git a/Engine/source/T3D/assets/SoundAsset.cpp b/Engine/source/T3D/assets/SoundAsset.cpp new file mode 100644 index 000000000..f2978aa38 --- /dev/null +++ b/Engine/source/T3D/assets/SoundAsset.cpp @@ -0,0 +1,141 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef SOUND_ASSET_H +#include "SoundAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(SoundAsset); + +ConsoleType(SoundAssetPtr, TypeSoundAssetPtr, SoundAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeSoundAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeSoundAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeSoundAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeSoundAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +SoundAsset::SoundAsset() +{ + mSoundFilePath = StringTable->EmptyString(); + + mPitchAdjust = 0; + mVolumeAdjust = 0; + + //mSound = nullptr; +} + +//----------------------------------------------------------------------------- + +SoundAsset::~SoundAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void SoundAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("soundFilePath", TypeFilename, Offset(mSoundFilePath, SoundAsset), "Path to the sound file."); + + addField("pitchAdjust", TypeF32, Offset(mPitchAdjust, SoundAsset), "Adjustment of the pitch value"); + addField("volumeAdjust", TypeF32, Offset(mVolumeAdjust, SoundAsset), "Adjustment to the volume."); +} + +//------------------------------------------------------------------------------ + +void SoundAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +void SoundAsset::initializeAsset(void) +{ +} + +void SoundAsset::onAssetRefresh(void) +{ + +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/SoundAsset.h b/Engine/source/T3D/assets/SoundAsset.h new file mode 100644 index 000000000..bfe582823 --- /dev/null +++ b/Engine/source/T3D/assets/SoundAsset.h @@ -0,0 +1,75 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef SOUND_ASSET_H +#define SOUND_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +class SFXTrack; + +//----------------------------------------------------------------------------- +class SoundAsset : public AssetBase +{ + typedef AssetBase Parent; + +protected: + StringTableEntry mSoundFilePath; + F32 mPitchAdjust; + F32 mVolumeAdjust; + +public: + SoundAsset(); + virtual ~SoundAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(SoundAsset); + + StringTableEntry getSoundFilePath() { return mSoundFilePath; } + +protected: + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); +}; + +DefineConsoleType(TypeSoundAssetPtr, SoundAsset) + +#endif // _ASSET_BASE_H_ + diff --git a/Engine/source/T3D/assets/stateMachineAsset.cpp b/Engine/source/T3D/assets/stateMachineAsset.cpp new file mode 100644 index 000000000..99ba956a4 --- /dev/null +++ b/Engine/source/T3D/assets/stateMachineAsset.cpp @@ -0,0 +1,207 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef STATE_MACHINE_ASSET_H +#include "stateMachineAsset.h" +#endif + +#ifndef _ASSET_MANAGER_H_ +#include "assets/assetManager.h" +#endif + +#ifndef _CONSOLETYPES_H_ +#include "console/consoleTypes.h" +#endif + +#ifndef _TAML_ +#include "persistence/taml/taml.h" +#endif + +#ifndef _ASSET_PTR_H_ +#include "assets/assetPtr.h" +#endif + +// Debug Profiling. +#include "platform/profiler.h" + +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(StateMachineAsset); + +ConsoleType(StateMachineAssetPtr, TypeStateMachineAssetPtr, StateMachineAsset, ASSET_ID_FIELD_PREFIX) + +//----------------------------------------------------------------------------- + +ConsoleGetType(TypeStateMachineAssetPtr) +{ + // Fetch asset Id. + return (*((AssetPtr*)dptr)).getAssetId(); +} + +//----------------------------------------------------------------------------- + +ConsoleSetType(TypeStateMachineAssetPtr) +{ + // Was a single argument specified? + if (argc == 1) + { + // Yes, so fetch field value. + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + // No, so fail. + //Con::warnf("(TypeStateMachineAssetPtr) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); + + return; + } + + // Warn. + Con::warnf("(TypeStateMachineAssetPtr) - Cannot set multiple args to a single asset."); +} + +//----------------------------------------------------------------------------- + +StateMachineAsset::StateMachineAsset() +{ + mStateMachineFileName = StringTable->EmptyString(); +} + +//----------------------------------------------------------------------------- + +StateMachineAsset::~StateMachineAsset() +{ + // If the asset manager does not own the asset then we own the + // asset definition so delete it. + if (!getOwned()) + delete mpAssetDefinition; +} + +//----------------------------------------------------------------------------- + +void StateMachineAsset::initPersistFields() +{ + // Call parent. + Parent::initPersistFields(); + + addField("stateMachineFile", TypeString, Offset(mStateMachineFileName, StateMachineAsset), "Path to the state machine file."); +} + +//------------------------------------------------------------------------------ + +void StateMachineAsset::copyTo(SimObject* object) +{ + // Call to parent. + Parent::copyTo(object); +} + +DefineEngineMethod(StateMachineAsset, notifyAssetChanged, void, (),,"") +{ + ResourceManager::get().getChangedSignal().trigger(object->getStateMachineFileName()); +} + +//----------------------------------------------------------------------------- +// GuiInspectorTypeAssetId +//----------------------------------------------------------------------------- + +IMPLEMENT_CONOBJECT(GuiInspectorTypeStateMachineAssetPtr); + +ConsoleDocClass(GuiInspectorTypeStateMachineAssetPtr, + "@brief Inspector field type for State Machines\n\n" + "Editor use only.\n\n" + "@internal" +); + +void GuiInspectorTypeStateMachineAssetPtr::consoleInit() +{ + Parent::consoleInit(); + + ConsoleBaseType::getType(TypeStateMachineAssetPtr)->setInspectorFieldType("GuiInspectorTypeStateMachineAssetPtr"); +} + +GuiControl* GuiInspectorTypeStateMachineAssetPtr::constructEditControl() +{ + // Create base filename edit controls + GuiControl *retCtrl = Parent::constructEditControl(); + if (retCtrl == NULL) + return retCtrl; + + // Change filespec + char szBuffer[512]; + dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"StateMachineAsset\", \"AssetBrowser.changeAsset\", %d, %s);", + mInspector->getComponentGroupTargetId(), mCaption); + mBrowseButton->setField("Command", szBuffer); + + // Create "Open in ShapeEditor" button + mSMEdButton = new GuiBitmapButtonCtrl(); + + dSprintf(szBuffer, sizeof(szBuffer), "StateMachineEditor.loadStateMachineAsset(%d.getText()); Canvas.pushDialog(StateMachineEditor);", retCtrl->getId()); + mSMEdButton->setField("Command", szBuffer); + + char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor"; + mSMEdButton->setBitmap(bitmapName); + + mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile"); + mSMEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); + mSMEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000"); + mSMEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the State Machine Editor"); + + mSMEdButton->registerObject(); + addObject(mSMEdButton); + + return retCtrl; +} + +bool GuiInspectorTypeStateMachineAssetPtr::updateRects() +{ + S32 dividerPos, dividerMargin; + mInspector->getDivider(dividerPos, dividerMargin); + Point2I fieldExtent = getExtent(); + Point2I fieldPos = getPosition(); + + mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y); + mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y); + + bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent); + if (mBrowseButton != NULL) + { + mBrowseRect.set(fieldExtent.x - 32, 2, 14, fieldExtent.y - 4); + resized |= mBrowseButton->resize(mBrowseRect.point, mBrowseRect.extent); + } + + if (mSMEdButton != NULL) + { + RectI shapeEdRect(fieldExtent.x - 16, 2, 14, fieldExtent.y - 4); + resized |= mSMEdButton->resize(shapeEdRect.point, shapeEdRect.extent); + } + + return resized; +} \ No newline at end of file diff --git a/Engine/source/T3D/assets/stateMachineAsset.h b/Engine/source/T3D/assets/stateMachineAsset.h new file mode 100644 index 000000000..6452a6e6f --- /dev/null +++ b/Engine/source/T3D/assets/stateMachineAsset.h @@ -0,0 +1,89 @@ +#pragma once +//----------------------------------------------------------------------------- +// Copyright (c) 2013 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#ifndef STATE_MACHINE_ASSET_H +#define STATE_MACHINE_ASSET_H + +#ifndef _ASSET_BASE_H_ +#include "assets/assetBase.h" +#endif + +#ifndef _ASSET_DEFINITION_H_ +#include "assets/assetDefinition.h" +#endif + +#ifndef _STRINGUNIT_H_ +#include "string/stringUnit.h" +#endif + +#ifndef _ASSET_FIELD_TYPES_H_ +#include "assets/assetFieldTypes.h" +#endif + +#include "gui/editor/guiInspectorTypes.h" + +//----------------------------------------------------------------------------- +class StateMachineAsset : public AssetBase +{ + typedef AssetBase Parent; + + StringTableEntry mStateMachineFileName; + +public: + StateMachineAsset(); + virtual ~StateMachineAsset(); + + /// Engine. + static void initPersistFields(); + virtual void copyTo(SimObject* object); + + /// Declare Console Object. + DECLARE_CONOBJECT(StateMachineAsset); + + StringTableEntry getStateMachineFileName() { return mStateMachineFileName; } + +protected: + virtual void initializeAsset(void) {} + virtual void onAssetRefresh(void) {} +}; + +DefineConsoleType(TypeStateMachineAssetPtr, StateMachineAsset) + +//----------------------------------------------------------------------------- +// TypeAssetId GuiInspectorField Class +//----------------------------------------------------------------------------- +class GuiInspectorTypeStateMachineAssetPtr : public GuiInspectorTypeFileName +{ + typedef GuiInspectorTypeFileName Parent; +public: + + GuiBitmapButtonCtrl *mSMEdButton; + + DECLARE_CONOBJECT(GuiInspectorTypeStateMachineAssetPtr); + static void consoleInit(); + + virtual GuiControl* constructEditControl(); + virtual bool updateRects(); +}; + +#endif + diff --git a/Engine/source/assets/assetBase.cpp b/Engine/source/assets/assetBase.cpp index 85ec18834..39cd4115f 100644 --- a/Engine/source/assets/assetBase.cpp +++ b/Engine/source/assets/assetBase.cpp @@ -69,7 +69,7 @@ AssetBase::~AssetBase() // If the asset manager does not own the asset then we own the // asset definition so delete it. if (!getOwned()) - delete mpAssetDefinition; + SAFE_DELETE(mpAssetDefinition); } //----------------------------------------------------------------------------- diff --git a/Engine/source/assets/assetBase.h b/Engine/source/assets/assetBase.h index 8709c5474..73c6df1c0 100644 --- a/Engine/source/assets/assetBase.h +++ b/Engine/source/assets/assetBase.h @@ -62,6 +62,7 @@ class AssetBase : public SimObject typedef SimObject Parent; +protected: AssetManager* mpOwningAssetManager; bool mAssetInitialized; AssetDefinition* mpAssetDefinition; diff --git a/Engine/source/assets/assetManager.cpp b/Engine/source/assets/assetManager.cpp index 805c52c01..da610a895 100644 --- a/Engine/source/assets/assetManager.cpp +++ b/Engine/source/assets/assetManager.cpp @@ -61,6 +61,15 @@ #ifndef COMPONENTASSET_H #include "T3D/assets/ComponentAsset.h" #endif +#ifndef GUI_ASSET_H +#include "T3D/assets/GUIAsset.h" +#endif +#ifndef SCRIPT_ASSET_H +#include "T3D/assets/ScriptAsset.h" +#endif +#ifndef MATERIALASSET_H +#include "T3D/assets/MaterialAsset.h" +#endif // Script bindings. #include "assetManager_ScriptBinding.h" @@ -251,6 +260,18 @@ bool AssetManager::loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition) { assetBase = mTaml.read(assetDef->mAssetBaseFilePath); } + else if (assetDef->mAssetType == StringTable->insert("GUIAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } + else if (assetDef->mAssetType == StringTable->insert("ScriptAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } + else if (assetDef->mAssetType == StringTable->insert("MaterialAsset")) + { + assetBase = mTaml.read(assetDef->mAssetBaseFilePath); + } //load the asset now if valid if (assetBase) @@ -2369,6 +2390,13 @@ S32 AssetManager::findAssetLooseFile( AssetQuery* pAssetQuery, const char* pLoos //----------------------------------------------------------------------------- +AssetManager::typeAssetDependsOnHash* AssetManager::getDependedOnAssets() +{ + // Find any asset dependencies. + return &mAssetDependsOn; +} +//----------------------------------------------------------------------------- + bool AssetManager::scanDeclaredAssets( const char* pPath, const char* pExtension, const bool recurse, ModuleDefinition* pModuleDefinition ) { // Debug Profiling. diff --git a/Engine/source/assets/assetManager.h b/Engine/source/assets/assetManager.h index a8ac792a2..9271ea534 100644 --- a/Engine/source/assets/assetManager.h +++ b/Engine/source/assets/assetManager.h @@ -73,15 +73,18 @@ class AssetManager : public SimObject, public ModuleCallbacks { private: typedef SimObject Parent; - typedef StringTableEntry typeAssetId; - typedef StringTableEntry typeAssetName; - typedef StringTableEntry typeReferenceFilePath; - typedef HashMap typeDeclaredAssetsHash; - typedef HashTable typeReferencedAssetsHash; - typedef HashTable typeAssetDependsOnHash; - typedef HashTable typeAssetIsDependedOnHash; - typedef HashMap typeAssetPtrRefreshHash; +public: + typedef StringTableEntry typeAssetId; + typedef StringTableEntry typeAssetName; + typedef StringTableEntry typeReferenceFilePath; + typedef HashMap typeDeclaredAssetsHash; + typedef HashTable typeReferencedAssetsHash; + typedef HashTable typeAssetDependsOnHash; + typedef HashTable typeAssetIsDependedOnHash; + typedef HashMap typeAssetPtrRefreshHash; + +private: /// Declared assets. typeDeclaredAssetsHash mDeclaredAssets; @@ -368,6 +371,8 @@ public: S32 findTaggedAssets( AssetQuery* pAssetQuery, const char* pAssetTagNames, const bool assetQueryAsSource = false ); S32 findAssetLooseFile( AssetQuery* pAssetQuery, const char* pLooseFile, const bool assetQueryAsSource = false ); + typeAssetDependsOnHash* getDependedOnAssets(); + /// Declare Console Object. DECLARE_CONOBJECT( AssetManager ); diff --git a/Engine/source/module/moduleDefinition.cpp b/Engine/source/module/moduleDefinition.cpp index 795186aef..c8dae30d8 100644 --- a/Engine/source/module/moduleDefinition.cpp +++ b/Engine/source/module/moduleDefinition.cpp @@ -82,6 +82,8 @@ void ModuleDefinition::initPersistFields() // Call parent. Parent::initPersistFields(); + addProtectedField("ModuleId", TypeString, Offset(mModuleId, ModuleDefinition), &defaultProtectedSetFn, &defaultProtectedGetFn, ""); + /// Module configuration. addProtectedField( "ModuleId", TypeString, Offset(mModuleId, ModuleDefinition), &setModuleId, &defaultProtectedGetFn, "A unique string Id for the module. It can contain any characters except a comma or semi-colon (the asset scope character)." ); addProtectedField( "VersionId", TypeS32, Offset(mVersionId, ModuleDefinition), &setVersionId, &defaultProtectedGetFn, "The version Id. Breaking changes to a module should use a higher version Id." ); diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index 67a89e3e1..fa53728b7 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -70,7 +70,8 @@ S32 QSORT_CALLBACK moduleDefinitionVersionIdSort( const void* a, const void* b ) ModuleManager::ModuleManager() : mEnforceDependencies(true), mEchoInfo(true), - mDatabaseLocks( 0 ) + mDatabaseLocks( 0 ), + mIgnoreLoadedGroups(false) { // Set module extension. dStrcpy( mModuleExtension, MODULE_MANAGER_MODULE_DEFINITION_EXTENSION ); @@ -1300,6 +1301,106 @@ StringTableEntry ModuleManager::copyModule( ModuleDefinition* pSourceModuleDefin //----------------------------------------------------------------------------- +bool ModuleManager::renameModule(ModuleDefinition* pSourceModuleDefinition, const char* pNewModuleName) +{ + // Sanity! + AssertFatal(pSourceModuleDefinition != NULL, "Cannot copy module using a NULL source module definition."); + AssertFatal(pNewModuleName != NULL, "Cannot rename a module using a NULL module name."); + + // Fetch the source module Id. + StringTableEntry sourceModuleId = pSourceModuleDefinition->getModuleId(); + + // Is the source module definition registered with this module manager? + if (pSourceModuleDefinition->getModuleManager() != this) + { + // No, so warn. + Con::warnf("Module Manager: Cannot rename module Id '%s' as it is not registered with this module manager.", sourceModuleId); + return StringTable->EmptyString(); + } + + TamlModuleIdUpdateVisitor moduleIdUpdateVisitor; + moduleIdUpdateVisitor.setModuleIdFrom(sourceModuleId); + moduleIdUpdateVisitor.setModuleIdTo(pNewModuleName); + + Vector files; + + const char* pExtension = (const char*)"Taml"; + const U32 extensionLength = dStrlen(pExtension); + + Vector directories; + + StringTableEntry modulePath = pSourceModuleDefinition->getModulePath(); + + // Find directories. + if (!Platform::dumpDirectories(modulePath, directories, -1)) + { + // Warn. + Con::warnf("Module Manager: Cannot rename module Id '%s' in directory '%s' as sub-folder scanning/renaming failed.", + sourceModuleId, modulePath); + return false; + } + + // Iterate directories. + for (Vector::iterator basePathItr = directories.begin(); basePathItr != directories.end(); ++basePathItr) + { + // Fetch base path. + StringTableEntry basePath = *basePathItr; + + // Find files. + files.clear(); + if (!Platform::dumpPath(basePath, files, 0)) + { + // Warn. + Con::warnf("Module Manager: Cannot rename module Id '%s' in directory '%s' as sub-folder scanning/renaming failed.", + sourceModuleId, modulePath); + return false; + } + + // Iterate files. + for (Vector::iterator fileItr = files.begin(); fileItr != files.end(); ++fileItr) + { + // Fetch file info. + Platform::FileInfo* pFileInfo = fileItr; + + // Fetch filename. + const char* pFilename = pFileInfo->pFileName; + + // Find filename length. + const U32 filenameLength = dStrlen(pFilename); + + // Skip if extension is longer than filename. + if (extensionLength >= filenameLength) + continue; + + // Skip if extension not found. + if (dStricmp(pFilename + filenameLength - extensionLength, pExtension) != 0) + continue; + + char parseFileBuffer[1024]; + dSprintf(parseFileBuffer, sizeof(parseFileBuffer), "%s/%s", pFileInfo->pFullPath, pFilename); + + // Parse file. + if (!mTaml.parse(parseFileBuffer, moduleIdUpdateVisitor)) + { + // Warn. + Con::warnf("Module Manager: Failed to parse file '%s' whilst renaming module Id '%s' in directory '%s'.", + parseFileBuffer, sourceModuleId, modulePath); + return false; + } + } + } + + // Info. + if (mEchoInfo) + { + Con::printf("Module Manager: Finished renaming module Id '%s' to '%s'.", sourceModuleId, pNewModuleName); + } + + return true; +} + +//----------------------------------------------------------------------------- + bool ModuleManager::synchronizeDependencies( ModuleDefinition* pRootModuleDefinition, const char* pTargetDependencyPath ) { // Sanity! @@ -1986,7 +2087,7 @@ bool ModuleManager::registerModule( const char* pModulePath, const char* pModule } // Is the module group already loaded? - if ( findGroupLoaded( moduleGroup ) != NULL ) + if ( findGroupLoaded( moduleGroup ) != NULL && !mIgnoreLoadedGroups) { // Yes, so warn. Con::warnf( "Module Manager: Found module: '%s' but it is in a module group '%s' which has already been loaded.", diff --git a/Engine/source/module/moduleManager.h b/Engine/source/module/moduleManager.h index 9c7125610..60b81a5f3 100644 --- a/Engine/source/module/moduleManager.h +++ b/Engine/source/module/moduleManager.h @@ -120,6 +120,7 @@ private: char mModuleExtension[256]; Taml mTaml; SimSet mNotificationListeners; + bool mIgnoreLoadedGroups; // Module definition entry. struct ModuleDefinitionEntry : public typeModuleDefinitionVector @@ -161,6 +162,7 @@ public: bool scanModules( const char* pPath, const bool rootOnly = false ); /// Module unregister. + bool registerModule(const char* pModulePath, const char* pModuleFile); bool unregisterModule( const char* pModuleId, const U32 versionId ); /// Module (un)loading. @@ -179,6 +181,9 @@ public: StringTableEntry copyModule( ModuleDefinition* pSourceModuleDefinition, const char* pTargetModuleId, const char* pTargetPath, const bool useVersionPathing ); bool synchronizeDependencies( ModuleDefinition* pRootModuleDefinition, const char* pTargetDependencyPath ); + /// Editing modules + bool renameModule(ModuleDefinition* pSourceModuleDefinition, const char* pNewModuleName); + /// Module updates. inline bool isModuleMergeAvailable( void ) const { return Platform::isFile( getModuleMergeFilePath() ); } bool canMergeModules( const char* pMergeSourcePath ); @@ -188,10 +193,11 @@ public: void addListener( SimObject* pListener ); void removeListener( SimObject* pListener ); + void setIgnoreLoadedGroups(bool doIgnore) { mIgnoreLoadedGroups = doIgnore; } + private: void clearDatabase( void ); bool removeModuleDefinition( ModuleDefinition* pModuleDefinition ); - bool registerModule( const char* pModulePath, const char* pModuleFile ); void raiseModulePreLoadNotifications( ModuleDefinition* pModuleDefinition ); void raiseModulePostLoadNotifications( ModuleDefinition* pModuleDefinition ); diff --git a/Engine/source/module/moduleManager_ScriptBinding.h b/Engine/source/module/moduleManager_ScriptBinding.h index dc560d29a..8abc8aab5 100644 --- a/Engine/source/module/moduleManager_ScriptBinding.h +++ b/Engine/source/module/moduleManager_ScriptBinding.h @@ -46,6 +46,16 @@ DefineEngineMethod(ModuleManager, scanModules, bool, (const char* pRootPath, boo //----------------------------------------------------------------------------- +DefineEngineMethod(ModuleManager, registerModule, bool, (const char* pModulePath, const char* pModuleFile), ("", ""), + "Register the specified module.\n" + "@param moduleId The module Id to register.\n" + "@param versionId The version Id to register.\n" + "@return Whether the module was registered or not.\n") +{ + // Unregister the module. + return object->registerModule(pModulePath, pModuleFile); +} + DefineEngineMethod(ModuleManager, unregisterModule, bool, (const char* pModuleId, bool versionId), ("", false), "Unregister the specified module.\n" "@param moduleId The module Id to unregister.\n" @@ -246,6 +256,30 @@ DefineEngineMethod(ModuleManager, copyModule, String, (const char* sourceModuleD //----------------------------------------------------------------------------- +DefineEngineMethod(ModuleManager, renameModule, bool, (const char* sourceModuleDefinition, const char* pNewModuleName), +("", ""), +"Rename a module.\n" +"@param sourceModuleDefinition The module definition to rename.\n" +"@param pNewModuleName The new name the module should have.\n" +"@return Weither the rename was successful or not.\n") +{ + // Find the source module definition. + ModuleDefinition* pSourceModuleDefinition = dynamic_cast(Sim::findObject(sourceModuleDefinition)); + + // Was the module definition found? + if (pSourceModuleDefinition == NULL) + { + // No, so warn. + Con::warnf("ModuleManager::renameModule() - Could not find source module definition '%s'.", sourceModuleDefinition); + return ""; + } + + // Copy module. + return object->renameModule(pSourceModuleDefinition, pNewModuleName); +} + +//----------------------------------------------------------------------------- + DefineEngineMethod(ModuleManager, synchronizeDependencies, bool, (const char* rootModuleDefinition, const char* pTargetDependencyFolder), ("", ""), "Synchronize the module dependencies of a module definition to a target dependency folder.\n" "@param rootModuleDefinition The module definition used to determine dependencies.\n" @@ -342,3 +376,14 @@ DefineEngineMethod(ModuleManager, removeListener, void, (const char* listenerObj object->removeListener( pListener ); } + +//----------------------------------------------------------------------------- + +DefineEngineMethod(ModuleManager, ignoreLoadedGroups, void, (bool doIgnore), (false), + "Sets if the Module Manager should ingore laoded groups.\n" + "@param doIgnore Whether we should or should not ignore loaded groups.\n" + "@return No return value.\n") +{ + // Check whether the merge modules can current happen or not. + return object->setIgnoreLoadedGroups(doIgnore); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/CoreComponents.module b/Templates/BaseGame/game/core/CoreComponents.module index 7ca29196a..0636e3bb5 100644 --- a/Templates/BaseGame/game/core/CoreComponents.module +++ b/Templates/BaseGame/game/core/CoreComponents.module @@ -2,6 +2,9 @@ ModuleId="CoreComponentsModule" VersionId="1" Description="Module that implements the core engine-level components for the game." + ScriptFile="CoreComponents.cs" + CreateFunction="onCreate" + DestroyFunction="onDestroy" Group="Game"> + description="Allows the component owner to operate as a camera." + scriptFile="core/components/game/camera.cs" /> diff --git a/Templates/BaseGame/game/core/components/game/controlObject.asset.taml b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml index 93f58119f..19515e833 100644 --- a/Templates/BaseGame/game/core/components/game/controlObject.asset.taml +++ b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml @@ -6,5 +6,5 @@ componentClass="Component" friendlyName="Control Object" componentType="Game" - scriptFile="core/components/game/controlObject.cs" - description="Allows the component owner to be controlled by a client." /> + description="Allows the component owner to be controlled by a client." + scriptFile="core/components/game/controlObject.cs" /> diff --git a/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml index 806d0db19..4c0c1bec4 100644 --- a/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml +++ b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml @@ -6,5 +6,5 @@ componentClass="Component" friendlyName="Item Rotation" componentType="Game" - scriptFile="core/components/game/itemRotate.cs" - description="Rotates the entity around an axis, like an item pickup." /> + description="Rotates the entity around an axis, like an item pickup." + scriptFile="core/components/game/itemRotate.cs" /> diff --git a/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml index bf2b872ef..8a597aca4 100644 --- a/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml +++ b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml @@ -6,5 +6,5 @@ componentClass="Component" friendlyName="Player Spawner" componentType="Game" - scriptFile="core/components/game/playerSpawner.cs" - description="When a client connects, it spawns a player object for them and attaches them to it." /> + description="When a client connects, it spawns a player object for them and attaches them to it." + scriptFile="core/components/game/playerSpawner.cs" /> From 68efd8e22a3b48ddf5d63e54bf01f21a90f49944 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 14:57:02 -0600 Subject: [PATCH 086/312] Updates to component classes - Shift from ghosted components to entity-managed for networking Initial implementation of Systems through the Mesh Component --- .../animation/animationComponent.cpp | 84 ++-- .../T3D/components/camera/cameraComponent.cpp | 11 +- .../collision/collisionComponent.cpp | 2 - Engine/source/T3D/components/component.cpp | 37 +- Engine/source/T3D/components/component.h | 21 +- .../components/game/stateMachineComponent.cpp | 1 - .../components/physics/rigidBodyComponent.cpp | 4 +- .../T3D/components/render/meshComponent.cpp | 379 +++++++++++------- .../T3D/components/render/meshComponent.h | 41 +- .../render/meshComponent_ScriptBinding.h | 30 +- Engine/source/T3D/entity.cpp | 339 +++++++++++++--- Engine/source/T3D/entity.h | 43 +- Engine/source/scene/sceneManager.cpp | 5 + Engine/source/scene/sceneRenderState.cpp | 11 - .../BaseGame/game/core/CoreComponents.cs | 10 + 15 files changed, 706 insertions(+), 312 deletions(-) create mode 100644 Templates/BaseGame/game/core/CoreComponents.cs diff --git a/Engine/source/T3D/components/animation/animationComponent.cpp b/Engine/source/T3D/components/animation/animationComponent.cpp index e1a71511c..c8fd645d0 100644 --- a/Engine/source/T3D/components/animation/animationComponent.cpp +++ b/Engine/source/T3D/components/animation/animationComponent.cpp @@ -72,7 +72,6 @@ IMPLEMENT_CALLBACK(AnimationComponent, onAnimationTrigger, void, (Component* obj AnimationComponent::AnimationComponent() : Component() { mNetworked = true; - mNetFlags.set(Ghostable | ScopeAlways); mFriendlyName = "Animation(Component)"; mComponentType = "Render"; @@ -223,31 +222,19 @@ U32 AnimationComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stre { U32 retMask = Parent::packUpdate(con, mask, stream); - //early test if we lack an owner, ghost-wise - //no point in trying, just re-queue the mask and go - if (!mOwner || con->getGhostIndex(mOwner) == -1) + /*for (int i = 0; i < MaxScriptThreads; i++) { - stream->writeFlag(false); - return retMask |= ThreadMask; - } - else - { - stream->writeFlag(true); - - for (int i = 0; i < MaxScriptThreads; i++) + Thread& st = mAnimationThreads[i]; + if (stream->writeFlag((st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)))) { - Thread& st = mAnimationThreads[i]; - if (stream->writeFlag( (st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)) ) ) - { - stream->writeInt(st.sequence,ThreadSequenceBits); - stream->writeInt(st.state,2); - stream->write(st.timescale); - stream->write(st.position); - stream->writeFlag(st.atEnd); - stream->writeFlag(st.transition); - } + stream->writeInt(st.sequence, ThreadSequenceBits); + stream->writeInt(st.state, 2); + stream->write(st.timescale); + stream->write(st.position); + stream->writeFlag(st.atEnd); + stream->writeFlag(st.transition); } - } + }*/ return retMask; } @@ -256,29 +243,26 @@ void AnimationComponent::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con, stream); - if (stream->readFlag()) + /*for (S32 i = 0; i < MaxScriptThreads; i++) { - for (S32 i = 0; i < MaxScriptThreads; i++) + if (stream->readFlag()) { - if (stream->readFlag()) - { - Thread& st = mAnimationThreads[i]; - U32 seq = stream->readInt(ThreadSequenceBits); - st.state = stream->readInt(2); - stream->read( &st.timescale ); - stream->read( &st.position ); - st.atEnd = stream->readFlag(); - bool transition = stream->readFlag(); + Thread& st = mAnimationThreads[i]; + U32 seq = stream->readInt(ThreadSequenceBits); + st.state = stream->readInt(2); + stream->read( &st.timescale ); + stream->read( &st.position ); + st.atEnd = stream->readFlag(); + bool transition = stream->readFlag(); - if (!st.thread || st.sequence != seq && st.state != Thread::Destroy) - setThreadSequence(i, seq, false, transition); - else - updateThread(st); - - } + if (!st.thread || st.sequence != seq && st.state != Thread::Destroy) + setThreadSequence(i, seq, false, transition); + else + updateThread(st); } - } + }*/ } + void AnimationComponent::processTick() { Parent::processTick(); @@ -327,9 +311,6 @@ const char *AnimationComponent::getThreadSequenceName(U32 slot) bool AnimationComponent::setThreadSequence(U32 slot, S32 seq, bool reset, bool transition, F32 transTime) { - if (!mOwnerShapeInstance) - return false; - Thread& st = mAnimationThreads[slot]; if (st.thread && st.sequence == seq && st.state == Thread::Play && !reset) return true; @@ -340,7 +321,6 @@ bool AnimationComponent::setThreadSequence(U32 slot, S32 seq, bool reset, bool t if (seq < MaxSequenceIndex) { - setMaskBits(-1); setMaskBits(ThreadMaskN << slot); st.sequence = seq; st.transition = transition; @@ -647,7 +627,7 @@ void AnimationComponent::advanceThreads(F32 dt) st.atEnd = true; updateThread(st); - if (!isGhost()) + if (!isClientObject()) { Con::executef(this, "onAnimationEnd", st.thread->getSequenceName()); } @@ -660,7 +640,7 @@ void AnimationComponent::advanceThreads(F32 dt) mOwnerShapeInstance->advanceTime(dt, st.thread); } - if (mOwnerShapeInstance && !isGhost()) + if (mOwnerShapeInstance && !isClientObject()) { for (U32 i = 1; i < 32; i++) { @@ -672,8 +652,16 @@ void AnimationComponent::advanceThreads(F32 dt) } } - if (isGhost()) + if (isClientObject()) + { mOwnerShapeInstance->animate(); + /*mOwnerShapeInstance->animateGround(); + MatrixF groundTransform = mOwnerShapeInstance->getGroundTransform(); + if (groundTransform != MatrixF::Identity) + { + mOwner->setPosition(groundTransform.getPosition()); + }*/ + } } } } diff --git a/Engine/source/T3D/components/camera/cameraComponent.cpp b/Engine/source/T3D/components/camera/cameraComponent.cpp index 60c62fb3a..2cd1b7d08 100644 --- a/Engine/source/T3D/components/camera/cameraComponent.cpp +++ b/Engine/source/T3D/components/camera/cameraComponent.cpp @@ -79,6 +79,7 @@ CameraComponent::CameraComponent() : Component() mTargetNode = ""; mUseParentTransform = true; + mNetworked = true; mFriendlyName = "Camera(Component)"; } @@ -202,7 +203,7 @@ void CameraComponent::setCameraFov(F32 fov) void CameraComponent::onCameraScopeQuery(NetConnection *cr, CameraScopeQuery * query) { // update the camera query - query->camera = this; + query->camera = mOwner;//this; if(GameConnection * con = dynamic_cast(cr)) { @@ -357,7 +358,8 @@ U32 CameraComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) mTargetNodeIdx = nodeIndex; } - stream->writeInt(mTargetNodeIdx, 32); + if(stream->writeFlag(mTargetNodeIdx > -1)) + stream->writeInt(mTargetNodeIdx, 32); //send offsets here stream->writeCompressedPoint(mPosOffset); @@ -382,7 +384,10 @@ void CameraComponent::unpackUpdate(NetConnection *con, BitStream *stream) if(stream->readFlag()) { - mTargetNodeIdx = stream->readInt(32); + if (stream->readFlag()) + mTargetNodeIdx = stream->readInt(32); + else + mTargetNodeIdx = -1; stream->readCompressedPoint(&mPosOffset); diff --git a/Engine/source/T3D/components/collision/collisionComponent.cpp b/Engine/source/T3D/components/collision/collisionComponent.cpp index e680665dc..ccdf818f1 100644 --- a/Engine/source/T3D/components/collision/collisionComponent.cpp +++ b/Engine/source/T3D/components/collision/collisionComponent.cpp @@ -125,8 +125,6 @@ EndImplementEnumType; // CollisionComponent::CollisionComponent() : Component() { - mNetFlags.set(Ghostable | ScopeAlways); - mFriendlyName = "Collision(Component)"; mOwnerRenderInterface = NULL; diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index cbb2305c1..ff207d2c1 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -31,6 +31,7 @@ #include "console/engineAPI.h" #include "sim/netConnection.h" #include "console/consoleInternal.h" +#include "T3D/assets/MaterialAsset.h" #define DECLARE_NATIVE_COMPONENT( ComponentType ) \ Component* staticComponentTemplate = new ComponentType; \ @@ -52,7 +53,6 @@ Component::Component() mNetworked = false; - // [tom, 1/12/2007] We manage the memory for the description since it // could be loaded from a file and thus massive. This is accomplished with // protected fields, but since they still call Con::getData() the field @@ -66,7 +66,7 @@ Component::Component() mOriginatingAssetId = StringTable->EmptyString(); - mNetFlags.set(Ghostable); + mIsServerObject = true; } Component::~Component() @@ -198,7 +198,6 @@ void Component::onComponentRemove() { mOwner->onComponentAdded.remove(this, &Component::componentAddedToOwner); mOwner->onComponentRemoved.remove(this, &Component::componentRemovedFromOwner); - mOwner->onTransformSet.remove(this, &Component::ownerTransformSet); } mOwner = NULL; @@ -212,7 +211,6 @@ void Component::setOwner(Entity* owner) { mOwner->onComponentAdded.remove(this, &Component::componentAddedToOwner); mOwner->onComponentRemoved.remove(this, &Component::componentRemovedFromOwner); - mOwner->onTransformSet.remove(this, &Component::ownerTransformSet); mOwner->removeComponent(this, false); } @@ -223,11 +221,18 @@ void Component::setOwner(Entity* owner) { mOwner->onComponentAdded.notify(this, &Component::componentAddedToOwner); mOwner->onComponentRemoved.notify(this, &Component::componentRemovedFromOwner); - mOwner->onTransformSet.notify(this, &Component::ownerTransformSet); } if (isServerObject()) + { setMaskBits(OwnerMask); + + //if we have any outstanding maskbits, push them along to have the network update happen on the entity + if (mDirtyMaskBits != 0 && mOwner) + { + mOwner->setMaskBits(Entity::ComponentsUpdateMask); + } + } } void Component::componentAddedToOwner(Component *comp) @@ -240,16 +245,19 @@ void Component::componentRemovedFromOwner(Component *comp) return; } -void Component::ownerTransformSet(MatrixF *mat) +void Component::setMaskBits(U32 orMask) { - return; + AssertFatal(orMask != 0, "Invalid net mask bits set."); + + if (mOwner) + mOwner->setComponentNetMask(this, orMask); } U32 Component::packUpdate(NetConnection *con, U32 mask, BitStream *stream) { - U32 retMask = Parent::packUpdate(con, mask, stream); + U32 retMask = 0; - if (mask & OwnerMask) + /*if (mask & OwnerMask) { if (mOwner != NULL) { @@ -274,7 +282,7 @@ U32 Component::packUpdate(NetConnection *con, U32 mask, BitStream *stream) } } else - stream->writeFlag(false); + stream->writeFlag(false);*/ if (stream->writeFlag(mask & EnableMask)) { @@ -299,9 +307,7 @@ U32 Component::packUpdate(NetConnection *con, U32 mask, BitStream *stream) void Component::unpackUpdate(NetConnection *con, BitStream *stream) { - Parent::unpackUpdate(con, stream); - - if (stream->readFlag()) + /*if (stream->readFlag()) { if (stream->readFlag()) { @@ -317,7 +323,7 @@ void Component::unpackUpdate(NetConnection *con, BitStream *stream) //it's being nulled out setOwner(NULL); } - } + }*/ if (stream->readFlag()) { @@ -467,7 +473,7 @@ void Component::addComponentField(const char *fieldName, const char *desc, const else if (fieldType == StringTable->insert("vector")) fieldTypeMask = TypePoint3F; else if (fieldType == StringTable->insert("material")) - fieldTypeMask = TypeMaterialName; + fieldTypeMask = TypeMaterialAssetPtr; else if (fieldType == StringTable->insert("image")) fieldTypeMask = TypeImageFilename; else if (fieldType == StringTable->insert("shape")) @@ -488,6 +494,7 @@ void Component::addComponentField(const char *fieldName, const char *desc, const fieldTypeMask = TypeGameObjectAssetPtr; else fieldTypeMask = TypeString; + field.mFieldTypeName = fieldType; field.mFieldType = fieldTypeMask; diff --git a/Engine/source/T3D/components/component.h b/Engine/source/T3D/components/component.h index 4f84de17f..b585a30b0 100644 --- a/Engine/source/T3D/components/component.h +++ b/Engine/source/T3D/components/component.h @@ -64,9 +64,9 @@ struct ComponentField /// /// ////////////////////////////////////////////////////////////////////////// -class Component : public NetObject, public UpdateInterface +class Component : public SimObject, public UpdateInterface { - typedef NetObject Parent; + typedef SimObject Parent; protected: StringTableEntry mFriendlyName; @@ -92,6 +92,10 @@ protected: StringTableEntry mOriginatingAssetId; AssetPtr mOriginatingAsset; + U32 mDirtyMaskBits; + + bool mIsServerObject; + public: Component(); virtual ~Component(); @@ -113,7 +117,8 @@ public: //This is called when a different component is removed from our owner entity virtual void componentRemovedFromOwner(Component *comp); - virtual void ownerTransformSet(MatrixF *mat); + //Overridden by components that actually care + virtual void ownerTransformSet(MatrixF *mat) {} void setOwner(Entity* pOwner); inline Entity *getOwner() { return mOwner ? mOwner : NULL; } @@ -190,6 +195,16 @@ public: NextFreeMask = BIT(5) }; + virtual void setMaskBits(U32 orMask); + virtual void clearMaskBits() { + mDirtyMaskBits = 0; + } + + bool isServerObject() { return mIsServerObject; } + bool isClientObject() { return !mIsServerObject; } + + void setIsServerObject(bool isServerObj) { mIsServerObject = isServerObj; } + virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream); virtual void unpackUpdate(NetConnection *con, BitStream *stream); /// @} diff --git a/Engine/source/T3D/components/game/stateMachineComponent.cpp b/Engine/source/T3D/components/game/stateMachineComponent.cpp index 991d41ce1..d4e9a7d73 100644 --- a/Engine/source/T3D/components/game/stateMachineComponent.cpp +++ b/Engine/source/T3D/components/game/stateMachineComponent.cpp @@ -57,7 +57,6 @@ StateMachineComponent::StateMachineComponent() : Component() //doesn't need to be networked mNetworked = false; - mNetFlags.clear(); } StateMachineComponent::~StateMachineComponent() diff --git a/Engine/source/T3D/components/physics/rigidBodyComponent.cpp b/Engine/source/T3D/components/physics/rigidBodyComponent.cpp index 21e9ecdbe..200e0d65e 100644 --- a/Engine/source/T3D/components/physics/rigidBodyComponent.cpp +++ b/Engine/source/T3D/components/physics/rigidBodyComponent.cpp @@ -288,7 +288,7 @@ void RigidBodyComponent::processTick() return; // SINGLE PLAYER HACK!!!! - if (PHYSICSMGR->isSinglePlayer() && isClientObject() && getServerObject()) + /*if (PHYSICSMGR->isSinglePlayer() && isClientObject() && getServerObject()) { RigidBodyComponent *servObj = (RigidBodyComponent*)getServerObject(); mOwner->setTransform(servObj->mState.getTransform()); @@ -296,7 +296,7 @@ void RigidBodyComponent::processTick() mRenderState[1] = servObj->mRenderState[1]; return; - } + }*/ // Store the last render state. mRenderState[0] = mRenderState[1]; diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index c9eeee3c3..10186c873 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -45,52 +45,49 @@ #include "core/strings/findMatch.h" #include "T3D/components/render/meshComponent_ScriptBinding.h" +ImplementEnumType(BatchingMode, + "Type of mesh data available in a shape.\n" + "@ingroup gameObjects") +{ + MeshComponent::Individual, "Individual", "This mesh is rendered indivudally, wthout batching or instancing." +}, + { MeshComponent::StaticBatch, "Static Batching", "Statically batches this mesh together with others to reduce drawcalls." }, + //{ MeshComponent::DynamicBatch, "Dynamic Batching", "Dynamical batches this mesh together with others to reduce drawcalls each frame." }, + // { MeshComponent::Instanced, "Instanced", "This mesh is rendered as an instance, reducing draw overhead with others that share the same mesh and material." }, + EndImplementEnumType; + ////////////////////////////////////////////////////////////////////////// // Constructor/Destructor ////////////////////////////////////////////////////////////////////////// MeshComponent::MeshComponent() : Component() { - mShapeName = StringTable->insert(""); - mShapeAsset = StringTable->insert(""); - mShapeInstance = NULL; - - mChangingMaterials.clear(); - - mMaterials.clear(); - mFriendlyName = "Mesh Component"; mComponentType = "Render"; mDescription = getDescriptionText("Causes the object to render a non-animating 3d shape using the file provided."); mNetworked = true; - mNetFlags.set(Ghostable | ScopeAlways); + + mShapeName = StringTable->EmptyString(); + mShapeAsset = StringTable->EmptyString(); + + mMeshAsset = StringTable->EmptyString(); + mMeshAssetId = StringTable->EmptyString(); + + mInterfaceData = new MeshRenderSystemInterface(); + + mRenderMode = Individual; } -MeshComponent::~MeshComponent(){} +MeshComponent::~MeshComponent() +{ + if (mInterfaceData) + SAFE_DELETE(mInterfaceData); +} IMPLEMENT_CO_NETOBJECT_V1(MeshComponent); //========================================================================================== -void MeshComponent::boneObject::addObject(SimObject* object) -{ - SceneObject* sc = dynamic_cast(object); - - if(sc && mOwner) - { - if(TSShape* shape = mOwner->getShape()) - { - S32 nodeID = shape->findNode(mBoneName); - - //we may have a offset on the shape's center - //so make sure we accomodate for that when setting up the mount offsets - MatrixF mat = mOwner->getNodeTransform(nodeID); - - mOwner->getOwner()->mountObject(sc, nodeID, mat); - } - } -} - bool MeshComponent::onAdd() { if(! Parent::onAdd()) @@ -106,6 +103,12 @@ void MeshComponent::onComponentAdd() { Parent::onComponentAdd(); + if (isClientObject()) + mInterfaceData->mIsClient = true; + + // if (mInterfaceData != nullptr) + // mInterfaceData->mIsClient = isClientObject(); + //get the default shape, if any updateShape(); } @@ -113,10 +116,6 @@ void MeshComponent::onComponentAdd() void MeshComponent::onRemove() { Parent::onRemove(); - - mMeshAsset.clear(); - - SAFE_DELETE(mShapeInstance); } void MeshComponent::onComponentRemove() @@ -135,9 +134,14 @@ void MeshComponent::initPersistFields() { Parent::initPersistFields(); + addGroup("Rendering"); + addField("BatchingMode", TypeBatchingMode, Offset(mRenderMode, MeshComponent), + "The mode of batching this shape should be rendered with."); + endGroup("Rendering"); + //create a hook to our internal variables addGroup("Model"); - addProtectedField("MeshAsset", TypeAssetId, Offset(mShapeAsset, MeshComponent), &_setMesh, &defaultProtectedGetFn, + addProtectedField("MeshAsset", TypeShapeAssetPtr, Offset(mShapeAsset, MeshComponent), &_setMesh, &defaultProtectedGetFn, "The asset Id used for the mesh.", AbstractClassRep::FieldFlags::FIELD_ComponentInspectors); endGroup("Model"); } @@ -165,6 +169,9 @@ bool MeshComponent::_setShape( void *object, const char *index, const char *data bool MeshComponent::setMeshAsset(const char* assetName) { // Fetch the asset Id. + if (mInterfaceData == nullptr) + return false; + mMeshAssetId = StringTable->insert(assetName); mMeshAsset = mMeshAssetId; @@ -183,9 +190,129 @@ bool MeshComponent::setMeshAsset(const char* assetName) return true; } +void MeshComponent::updateShape() +{ + if (mInterfaceData == nullptr) + return; + + //if ((mShapeName && mShapeName[0] != '\0') || (mShapeAsset && mShapeAsset[0] != '\0')) + if ((mShapeName && mShapeName[0] != '\0') || (mMeshAssetId && mMeshAssetId[0] != '\0')) + + { + if (mMeshAsset == NULL) + return; + + mShape = mMeshAsset->getShape(); + + if (!mMeshAsset->getShape()) + return; + + setupShape(); + + //Do this on both the server and client + S32 materialCount = mMeshAsset->getShape()->materialList->getMaterialNameList().size(); + + if (isServerObject()) + { + //we need to update the editor + for (U32 i = 0; i < mFields.size(); i++) + { + //find any with the materialslot title and clear them out + if (FindMatch::isMatch("MaterialSlot*", mFields[i].mFieldName, false)) + { + setDataField(mFields[i].mFieldName, NULL, ""); + mFields.erase(i); + continue; + } + } + + //next, get a listing of our materials in the shape, and build our field list for them + char matFieldName[128]; + + if (materialCount > 0) + mComponentGroup = StringTable->insert("Materials"); + + for (U32 i = 0; i < materialCount; i++) + { + String materialname = mMeshAsset->getShape()->materialList->getMaterialName(i); + if (materialname == String("ShapeBounds")) + continue; + + dSprintf(matFieldName, 128, "MaterialSlot%d", i); + + addComponentField(matFieldName, "A material used in the shape file", "Material", materialname, ""); + } + + if (materialCount > 0) + mComponentGroup = ""; + } + + if (mOwner != NULL) + { + Point3F min, max, pos; + pos = mOwner->getPosition(); + + mOwner->getWorldToObj().mulP(pos); + + min = mMeshAsset->getShape()->bounds.minExtents; + max = mMeshAsset->getShape()->bounds.maxExtents; + + if (mInterfaceData) + { + mInterfaceData->mBounds.set(min, max); + mInterfaceData->mScale = mOwner->getScale(); + mInterfaceData->mTransform = mOwner->getRenderTransform(); + } + + mOwner->setObjectBox(Box3F(min, max)); + + mOwner->resetWorldBox(); + + if (mOwner->getSceneManager() != NULL) + mOwner->getSceneManager()->notifyObjectDirty(mOwner); + } + + if (isClientObject() && mInterfaceData) + { + if (mRenderMode == StaticBatch) + { + mInterfaceData->mStatic = true; + + OptimizedPolyList geom; + MatrixF transform = mInterfaceData->mTransform; + mInterfaceData->mGeometry.setTransform(&transform, mInterfaceData->mScale); + mInterfaceData->mGeometry.setObject(mOwner); + + mInterfaceData->mShapeInstance->buildPolyList(&mInterfaceData->mGeometry, 0); + } + else + { + mInterfaceData->mStatic = false; + } + + MeshRenderSystem::rebuildBuffers(); + } + + //finally, notify that our shape was changed + onShapeInstanceChanged.trigger(this); + } +} + +void MeshComponent::setupShape() +{ + mInterfaceData->mShapeInstance = new TSShapeInstance(mMeshAsset->getShape(), true); +} + void MeshComponent::_onResourceChanged( const Torque::Path &path ) { - if ( path != Torque::Path( mShapeName ) ) + if (mInterfaceData == nullptr) + return; + + String filePath; + if (mMeshAsset) + filePath = Torque::Path(mMeshAsset->getShapeFilename()); + + if (!mMeshAsset || path != Torque::Path(mMeshAsset->getShapeFilename()) ) return; updateShape(); @@ -216,6 +343,8 @@ U32 MeshComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) if (stream->writeFlag(mask & ShapeMask)) { stream->writeString(mShapeName); + + stream->writeInt(mRenderMode, 8); } if (stream->writeFlag( mask & MaterialMask )) @@ -226,7 +355,7 @@ U32 MeshComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) { stream->writeInt(mChangingMaterials[i].slot, 16); - NetStringHandle matNameStr = mChangingMaterials[i].matName.c_str(); + NetStringHandle matNameStr = mChangingMaterials[i].assetId.c_str(); con->packNetStringHandleU(stream, matNameStr); } @@ -243,6 +372,8 @@ void MeshComponent::unpackUpdate(NetConnection *con, BitStream *stream) if(stream->readFlag()) { mShapeName = stream->readSTString(); + + mRenderMode = (RenderMode)stream->readInt(8); setMeshAsset(mShapeName); updateShape(); } @@ -256,7 +387,10 @@ void MeshComponent::unpackUpdate(NetConnection *con, BitStream *stream) { matMap newMatMap; newMatMap.slot = stream->readInt(16); - newMatMap.matName = String(con->unpackNetStringHandleU(stream).getString()); + newMatMap.assetId = String(con->unpackNetStringHandleU(stream).getString()); + + //do the lookup, now + newMatMap.matAsset = AssetDatabase.acquireAsset(newMatMap.assetId); mChangingMaterials.push_back(newMatMap); } @@ -267,7 +401,7 @@ void MeshComponent::unpackUpdate(NetConnection *con, BitStream *stream) void MeshComponent::prepRenderImage( SceneRenderState *state ) { - if (!mEnabled || !mOwner || !mShapeInstance) + /*if (!mEnabled || !mOwner || !mShapeInstance) return; Point3F cameraOffset; @@ -300,114 +434,41 @@ void MeshComponent::prepRenderImage( SceneRenderState *state ) rdata.setLightQuery(&query); MatrixF mat = mOwner->getRenderTransform(); - Point3F renderPos = mat.getPosition(); - EulerF renderRot = mat.toEuler(); + + if (mOwner->isMounted()) + { + MatrixF wrldPos = mOwner->getWorldTransform(); + Point3F wrldPosPos = wrldPos.getPosition(); + + Point3F mntPs = mat.getPosition(); + EulerF mntRt = RotationF(mat).asEulerF(); + + bool tr = true; + } + mat.scale(objScale); GFX->setWorldMatrix(mat); - mShapeInstance->render(rdata); -} - -void MeshComponent::updateShape() -{ - bool isServer = isServerObject(); - - if ((mShapeName && mShapeName[0] != '\0') || (mShapeAsset && mShapeAsset[0] != '\0')) - { - if (mMeshAsset == NULL) - return; - - mShape = mMeshAsset->getShape(); - - if (!mShape) - return; - - setupShape(); - - //Do this on both the server and client - S32 materialCount = mShape->materialList->getMaterialNameList().size(); - - if(isServerObject()) - { - //we need to update the editor - for (U32 i = 0; i < mFields.size(); i++) - { - //find any with the materialslot title and clear them out - if (FindMatch::isMatch("MaterialSlot*", mFields[i].mFieldName, false)) - { - setDataField(mFields[i].mFieldName, NULL, ""); - mFields.erase(i); - continue; - } - } - - //next, get a listing of our materials in the shape, and build our field list for them - char matFieldName[128]; - - if(materialCount > 0) - mComponentGroup = StringTable->insert("Materials"); - - for(U32 i=0; i < materialCount; i++) - { - String materialname = mShape->materialList->getMaterialName(i); - if(materialname == String("ShapeBounds")) - continue; - - dSprintf(matFieldName, 128, "MaterialSlot%d", i); - - addComponentField(matFieldName, "A material used in the shape file", "TypeAssetId", materialname, ""); - } - - if(materialCount > 0) - mComponentGroup = ""; - } - - if(mOwner != NULL) - { - Point3F min, max, pos; - pos = mOwner->getPosition(); - - mOwner->getWorldToObj().mulP(pos); - - min = mShape->bounds.minExtents; - max = mShape->bounds.maxExtents; - - mShapeBounds.set(min, max); - - mOwner->setObjectBox(Box3F(min, max)); - - if( mOwner->getSceneManager() != NULL ) - mOwner->getSceneManager()->notifyObjectDirty( mOwner ); - } - - //finally, notify that our shape was changed - onShapeInstanceChanged.trigger(this); - } -} - -void MeshComponent::setupShape() -{ - mShapeInstance = new TSShapeInstance(mShape, true); + mShapeInstance->render(rdata);*/ } void MeshComponent::updateMaterials() { - if (mChangingMaterials.empty() || !mShape) + if (mChangingMaterials.empty() || !mMeshAsset->getShape()) return; - TSMaterialList* pMatList = mShapeInstance->getMaterialList(); + TSMaterialList* pMatList = mInterfaceData->mShapeInstance->getMaterialList(); pMatList->setTextureLookupPath(getShapeResource().getPath().getPath()); const Vector &materialNames = pMatList->getMaterialNameList(); for ( S32 i = 0; i < materialNames.size(); i++ ) { - const String &pName = materialNames[i]; - for(U32 m=0; m < mChangingMaterials.size(); m++) { if(mChangingMaterials[m].slot == i) { - pMatList->renameMaterial( i, mChangingMaterials[m].matName ); + //Fetch the actual material asset + pMatList->renameMaterial( i, mChangingMaterials[m].matAsset->getMaterialDefinitionName()); } } @@ -415,22 +476,31 @@ void MeshComponent::updateMaterials() } // Initialize the material instances - mShapeInstance->initMaterialList(); + mInterfaceData->mShapeInstance->initMaterialList(); } MatrixF MeshComponent::getNodeTransform(S32 nodeIdx) { - if (mShape) + if (mInterfaceData != nullptr && mMeshAsset->getShape()) { S32 nodeCount = getShape()->nodes.size(); if(nodeIdx >= 0 && nodeIdx < nodeCount) { //animate(); - MatrixF mountTransform = mShapeInstance->mNodeTransforms[nodeIdx]; - mountTransform.mul(mOwner->getRenderTransform()); + MatrixF nodeTransform = mInterfaceData->mShapeInstance->mNodeTransforms[nodeIdx]; + const Point3F& scale = mOwner->getScale(); - return mountTransform; + // The position of the node needs to be scaled. + Point3F position = nodeTransform.getPosition(); + position.convolve(scale); + nodeTransform.setPosition(position); + + MatrixF finalTransform = MatrixF::Identity; + + finalTransform.mul(mOwner->getRenderTransform(), nodeTransform); + + return finalTransform; } } @@ -439,7 +509,7 @@ MatrixF MeshComponent::getNodeTransform(S32 nodeIdx) S32 MeshComponent::getNodeByName(String nodeName) { - if (mShape) + if (mMeshAsset->getShape()) { S32 nodeIdx = getShape()->findNode(nodeName); @@ -485,12 +555,18 @@ void MeshComponent::onDynamicModified(const char* slotName, const char* newValue if(slot == -1) return; + //Safe to assume the inbound value for the material will be a MaterialAsset, so lets do a lookup on the name + MaterialAsset* matAsset = AssetDatabase.acquireAsset(newValue); + if (!matAsset) + return; + bool found = false; for(U32 i=0; i < mChangingMaterials.size(); i++) { if(mChangingMaterials[i].slot == slot) { - mChangingMaterials[i].matName = String(newValue); + mChangingMaterials[i].matAsset = matAsset; + mChangingMaterials[i].assetId = newValue; found = true; } } @@ -499,7 +575,8 @@ void MeshComponent::onDynamicModified(const char* slotName, const char* newValue { matMap newMatMap; newMatMap.slot = slot; - newMatMap.matName = String(newValue); + newMatMap.matAsset = matAsset; + newMatMap.assetId = newValue; mChangingMaterials.push_back(newMatMap); } @@ -510,14 +587,31 @@ void MeshComponent::onDynamicModified(const char* slotName, const char* newValue Parent::onDynamicModified(slotName, newValue); } -void MeshComponent::changeMaterial(U32 slot, const char* newMat) +void MeshComponent::changeMaterial(U32 slot, MaterialAsset* newMat) { char fieldName[512]; //update our respective field dSprintf(fieldName, 512, "materialSlot%d", slot); - setDataField(fieldName, NULL, newMat); + setDataField(fieldName, NULL, newMat->getAssetId()); +} + +bool MeshComponent::setMatInstField(U32 slot, const char* field, const char* value) +{ + TSMaterialList* pMatList = mInterfaceData->mShapeInstance->getMaterialList(); + pMatList->setTextureLookupPath(getShapeResource().getPath().getPath()); + + MaterialParameters* params = pMatList->getMaterialInst(slot)->getMaterialParameters(); + + if (pMatList->getMaterialInst(slot)->getFeatures().hasFeature(MFT_DiffuseColor)) + { + MaterialParameterHandle* handle = pMatList->getMaterialInst(slot)->getMaterialParameterHandle("DiffuseColor"); + + params->set(handle, LinearColorF(0, 0, 0)); + } + + return true; } void MeshComponent::onInspect() @@ -526,4 +620,13 @@ void MeshComponent::onInspect() void MeshComponent::onEndInspect() { +} + +void MeshComponent::ownerTransformSet(MatrixF *mat) +{ + if (mInterfaceData != nullptr) + { + MatrixF newTransform = *mat; + mInterfaceData->mTransform = newTransform; + } } \ No newline at end of file diff --git a/Engine/source/T3D/components/render/meshComponent.h b/Engine/source/T3D/components/render/meshComponent.h index 6adc2633e..587038d63 100644 --- a/Engine/source/T3D/components/render/meshComponent.h +++ b/Engine/source/T3D/components/render/meshComponent.h @@ -60,6 +60,8 @@ #include "gfx/gfxVertexFormat.h" #endif +#include "T3D/systems/render/meshRenderSystem.h" + class TSShapeInstance; class SceneRenderState; ////////////////////////////////////////////////////////////////////////// @@ -84,37 +86,38 @@ protected: StringTableEntry mShapeName; StringTableEntry mShapeAsset; TSShape* mShape; - Box3F mShapeBounds; + //Box3F mShapeBounds; Point3F mCenterOffset; + MeshRenderSystemInterface* mInterfaceData; + struct matMap { - String matName; + MaterialAsset* matAsset; + String assetId; U32 slot; }; Vector mChangingMaterials; Vector mMaterials; - class boneObject : public SimGroup +public: + enum RenderMode { - MeshComponent *mOwner; - public: - boneObject(MeshComponent *owner){ mOwner = owner; } - - StringTableEntry mBoneName; - S32 mItemID; - - virtual void addObject(SimObject *obj); + Individual = 0, + DynamicBatch, + StaticBatch, + Instanced }; - Vector mNodesList; +protected: + RenderMode mRenderMode; public: StringTableEntry mMeshAssetId; AssetPtr mMeshAsset; - TSShapeInstance* mShapeInstance; + //TSShapeInstance* mShapeInstance; public: MeshComponent(); @@ -132,7 +135,7 @@ public: virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream); virtual void unpackUpdate(NetConnection *con, BitStream *stream); - Box3F getShapeBounds() { return mShapeBounds; } + Box3F getShapeBounds() { return mInterfaceData->mBounds; } virtual MatrixF getNodeTransform(S32 nodeIdx); S32 getNodeByName(String nodeName); @@ -144,6 +147,8 @@ public: virtual void onComponentRemove(); virtual void onComponentAdd(); + virtual void ownerTransformSet(MatrixF *mat); + static bool _setMesh(void *object, const char *index, const char *data); static bool _setShape(void *object, const char *index, const char *data); const char* _getShape(void *object, const char *data); @@ -151,7 +156,7 @@ public: bool setMeshAsset(const char* assetName); virtual TSShape* getShape() { if (mMeshAsset) return mMeshAsset->getShape(); else return NULL; } - virtual TSShapeInstance* getShapeInstance() { return mShapeInstance; } + virtual TSShapeInstance* getShapeInstance() { return mInterfaceData->mShapeInstance; } Resource getShapeResource() { return mMeshAsset->getShapeResource(); } @@ -163,7 +168,8 @@ public: virtual void onDynamicModified(const char* slotName, const char* newValue); - void changeMaterial(U32 slot, const char* newMat); + void changeMaterial(U32 slot, MaterialAsset* newMat); + bool setMatInstField(U32 slot, const char* field, const char* value); virtual void onInspect(); virtual void onEndInspect(); @@ -180,4 +186,7 @@ public: } }; +typedef MeshComponent::RenderMode BatchingMode; +DefineEnumType(BatchingMode); + #endif diff --git a/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h b/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h index 5a19b8f08..396166def 100644 --- a/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h +++ b/Engine/source/T3D/components/render/meshComponent_ScriptBinding.h @@ -126,6 +126,28 @@ DefineEngineMethod(MeshComponent, getNodePosition, Point3F, return Point3F(0, 0, 0); } +DefineEngineMethod(MeshComponent, getNodeRotation, EulerF, + (S32 node), (-1), + "@brief Mount objB to this object at the desired slot with optional transform.\n\n" + + "@param objB Object to mount onto us\n" + "@param slot Mount slot ID\n" + "@param txfm (optional) mount offset transform\n" + "@return true if successful, false if failed (objB is not valid)") +{ + if (node != -1) + { + //BUG: Unsure how it broke, but atm the default transform passed in here is rotated 180 degrees. This doesn't happen + //for the SceneObject mountobject method. Hackish, but for now, just default to a clean MatrixF::Identity + //object->mountObjectToNode( objB, node, /*MatrixF::Identity*/txfm.getMatrix() ); + RotationF mat = object->getNodeTransform(node); + + return mat.asEulerF(RotationF::Degrees); + } + + return EulerF(0, 0, 0); +} + DefineEngineMethod(MeshComponent, getNodeByName, S32, (String nodeName), , "@brief Mount objB to this object at the desired slot with optional transform.\n\n" @@ -148,8 +170,14 @@ DefineEngineMethod(MeshComponent, getNodeByName, S32, return -1; } -DefineEngineMethod(MeshComponent, changeMaterial, void, (U32 slot, const char* newMat), (0, ""), +DefineEngineMethod(MeshComponent, changeMaterial, void, (U32 slot, MaterialAsset* newMat), (0, nullAsType()), "@brief Change one of the materials on the shape.\n\n") { object->changeMaterial(slot, newMat); +} + +DefineEngineMethod(MeshComponent, setMatInstField, bool, (U32 slot, const char* field, const char* value), (0, "", ""), + "@brief Change one of the materials on the shape.\n\n") +{ + return object->setMatInstField(slot, field, value); } \ No newline at end of file diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index d58d086c6..a7af19b33 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -47,7 +47,9 @@ #include "T3D/gameBase/std/stdMoveList.h" #include "T3D/prefab.h" +#include "T3D/gameBase/gameConnection.h" +#include // #include "gfx/sim/debugDraw.h" // @@ -118,6 +120,8 @@ Entity::Entity() mInitialized = false; + mLifetimeMS = 0; + mGameObjectAssetId = StringTable->insert(""); } @@ -147,6 +151,10 @@ void Entity::initPersistFields() endGroup("Transform"); + addGroup("Misc"); + addField("LifetimeMS", TypeS32, Offset(mLifetimeMS, Entity), "Object world orientation."); + endGroup("Misc"); + addGroup("GameObject"); addProtectedField("gameObjectName", TypeGameObjectAssetPtr, Offset(mGameObjectAsset, Entity), &_setGameObject, &defaultProtectedGetFn, "The asset Id used for the game object this entity is based on."); @@ -231,8 +239,19 @@ bool Entity::onAdd() addToScene(); //Make sure we get positioned - setMaskBits(TransformMask); - setMaskBits(NamespaceMask); + if (isServerObject()) + { + setMaskBits(TransformMask); + setMaskBits(NamespaceMask); + } + else + { + //We can shortcut the initialization here because stuff generally ghosts down in order, and onPostAdd isn't called on ghosts. + onPostAdd(); + } + + if (mLifetimeMS != 0) + mStartTimeMS = Platform::getRealMilliseconds(); return true; } @@ -245,6 +264,8 @@ void Entity::onRemove() onDataSet.removeAll(); + mGameObjectAsset.clear(); + Parent::onRemove(); } @@ -258,6 +279,27 @@ void Entity::onPostAdd() mComponents[i]->onComponentAdd(); } + //Set up the networked components + mNetworkedComponents.clear(); + for (U32 i = 0; i < mComponents.size(); i++) + { + if (mComponents[i]->isNetworked()) + { + NetworkedComponent netComp; + netComp.componentIndex = i; + netComp.updateState = NetworkedComponent::Adding; + netComp.updateMaskBits = -1; + + mNetworkedComponents.push_back(netComp); + } + } + + if (!mNetworkedComponents.empty()) + { + setMaskBits(AddComponentsMask); + setMaskBits(ComponentsUpdateMask); + } + if (isMethod("onAdd")) Con::executef(this, "onAdd"); } @@ -396,6 +438,14 @@ void Entity::processTick(const Move* move) mDelta.rot[1] = mRot.asQuatF(); setTransform(getPosition(), mRot); + + //Lifetime test + if (mLifetimeMS != 0) + { + S32 currentTime = Platform::getRealMilliseconds(); + if (currentTime - mStartTimeMS >= mLifetimeMS) + deleteObject(); + } } } @@ -446,62 +496,107 @@ U32 Entity::packUpdate(NetConnection *con, U32 mask, BitStream *stream) mathWrite(*stream, mObjBox); } - //pass our behaviors around - if (mask & ComponentsMask || mask & InitialUpdateMask) + if (stream->writeFlag(mask & AddComponentsMask)) { - stream->writeFlag(true); - //now, we run through a list of our to-be-sent behaviors and begin sending them - //if any fail, we keep our list and re-queue the mask - S32 componentCount = mToLoadComponents.size(); + U32 toAddComponentCount = 0; - //build our 'ready' list - //This requires both the instance and the instances' template to be prepped(if the template hasn't been ghosted, - //then we know we shouldn't be passing the instance's ghosts around yet) - U32 ghostedCompCnt = 0; - for (U32 i = 0; i < componentCount; i++) + for (U32 i = 0; i < mNetworkedComponents.size(); i++) { - if (con->getGhostIndex(mToLoadComponents[i]) != -1) - ghostedCompCnt++; - } - - if (ghostedCompCnt != 0) - { - stream->writeFlag(true); - - stream->writeFlag(mStartComponentUpdate); - - //if not all the behaviors have been ghosted, we'll need another pass - if (ghostedCompCnt != componentCount) - retMask |= ComponentsMask; - - //write the currently ghosted behavior count - stream->writeInt(ghostedCompCnt, 16); - - for (U32 i = 0; i < mToLoadComponents.size(); i++) + if (mNetworkedComponents[i].updateState == NetworkedComponent::Adding) { - //now fetch them and pass the ghost - S32 ghostIndex = con->getGhostIndex(mToLoadComponents[i]); - if (ghostIndex != -1) - { - stream->writeInt(ghostIndex, NetConnection::GhostIdBitSize); - mToLoadComponents.erase(i); - i--; - - mStartComponentUpdate = false; - } + toAddComponentCount++; } } - else if (componentCount) + + //you reaaaaally shouldn't have >255 networked components on a single entity + stream->writeInt(toAddComponentCount, 8); + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) { - //on the odd chance we have behaviors to ghost, but NONE of them have been yet, just set the flag now - stream->writeFlag(false); - retMask |= ComponentsMask; + NetworkedComponent::UpdateState state = mNetworkedComponents[i].updateState; + + if (mNetworkedComponents[i].updateState == NetworkedComponent::Adding) + { + const char* className = mComponents[mNetworkedComponents[i].componentIndex]->getClassName(); + stream->writeString(className, strlen(className)); + + mNetworkedComponents[i].updateState = NetworkedComponent::Updating; + } } - else - stream->writeFlag(false); } - else - stream->writeFlag(false); + + if (stream->writeFlag(mask & RemoveComponentsMask)) + { + /*U32 toRemoveComponentCount = 0; + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Adding) + { + toRemoveComponentCount++; + } + } + + //you reaaaaally shouldn't have >255 networked components on a single entity + stream->writeInt(toRemoveComponentCount, 8); + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Removing) + { + stream->writeInt(i, 16); + } + }*/ + + /*for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::UpdateState::Removing) + { + removeComponent(mComponents[mNetworkedComponents[i].componentIndex], true); + mNetworkedComponents.erase(i); + i--; + + } + }*/ + } + + //Update our components + if (stream->writeFlag(mask & ComponentsUpdateMask)) + { + U32 toUpdateComponentCount = 0; + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Updating) + { + toUpdateComponentCount++; + } + } + + //you reaaaaally shouldn't have >255 networked components on a single entity + stream->writeInt(toUpdateComponentCount, 8); + + bool forceUpdate = false; + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + if (mNetworkedComponents[i].updateState == NetworkedComponent::Updating) + { + stream->writeInt(i, 8); + + mNetworkedComponents[i].updateMaskBits = mComponents[mNetworkedComponents[i].componentIndex]->packUpdate(con, mNetworkedComponents[i].updateMaskBits, stream); + + if (mNetworkedComponents[i].updateMaskBits != 0) + forceUpdate = true; + else + mNetworkedComponents[i].updateState = NetworkedComponent::None; + } + } + + //If we have leftover, we need to re-iterate our packing + if (forceUpdate) + setMaskBits(ComponentsUpdateMask); + } /*if (stream->writeFlag(mask & NamespaceMask)) { @@ -594,25 +689,52 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) resetWorldBox(); } + //AddComponentMask if (stream->readFlag()) { - //are we passing any behaviors currently? - if (stream->readFlag()) + U32 addedComponentCount = stream->readInt(8); + + for (U32 i = 0; i < addedComponentCount; i++) { - //if we've just started the update, clear our behaviors - if (stream->readFlag()) - clearComponents(false); + char className[256] = ""; + stream->readString(className); - S32 componentCount = stream->readInt(16); + //Change to components, so iterate our list and create any new components + // Well, looks like we have to create a new object. + const char* componentType = className; - for (U32 i = 0; i < componentCount; i++) + ConsoleObject *object = ConsoleObject::create(componentType); + + // Finally, set currentNewObject to point to the new one. + Component* newComponent = dynamic_cast(object); + + if (newComponent) { - S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize); - addComponent(dynamic_cast(con->resolveGhost(gIndex))); + addComponent(newComponent); } } } + //RemoveComponentMask + if (stream->readFlag()) + { + + } + + //ComponentUpdateMask + if (stream->readFlag()) + { + U32 updatingComponents = stream->readInt(8); + + for (U32 i = 0; i < updatingComponents; i++) + { + U32 updateComponentIndex = stream->readInt(8); + + Component* comp = mComponents[updateComponentIndex]; + comp->unpackUpdate(con, stream); + } + } + /*if (stream->readFlag()) { if (stream->readFlag()) @@ -640,6 +762,26 @@ void Entity::unpackUpdate(NetConnection *con, BitStream *stream) }*/ } +void Entity::setComponentNetMask(Component* comp, U32 mask) +{ + setMaskBits(Entity::ComponentsUpdateMask); + + for (U32 i = 0; i < mNetworkedComponents.size(); i++) + { + U32 netCompId = mComponents[mNetworkedComponents[i].componentIndex]->getId(); + U32 compId = comp->getId(); + + if (netCompId == compId && + (mNetworkedComponents[i].updateState == NetworkedComponent::None || mNetworkedComponents[i].updateState == NetworkedComponent::Updating)) + { + mNetworkedComponents[i].updateState = NetworkedComponent::Updating; + mNetworkedComponents[i].updateMaskBits |= mask; + + break; + } + } +} + //Manipulation void Entity::setTransform(const MatrixF &mat) { @@ -758,7 +900,11 @@ void Entity::setTransform(Point3F position, RotationF rotation) // Update the transforms. Parent::setTransform(newMat); - onTransformSet.trigger(&newMat); + U32 compCount = mComponents.size(); + for (U32 i = 0; i < compCount; ++i) + { + mComponents[i]->ownerTransformSet(&newMat); + } Point3F newPos = newMat.getPosition(); RotationF newRot = newMat; @@ -800,7 +946,11 @@ void Entity::setRenderTransform(Point3F position, RotationF rotation) Parent::setRenderTransform(newMat); - onTransformSet.trigger(&newMat); + U32 compCount = mComponents.size(); + for (U32 i = 0; i < compCount; ++i) + { + mComponents[i]->ownerTransformSet(&newMat); + } } } @@ -1155,11 +1305,28 @@ bool Entity::addComponent(Component *comp) // Register the component with this owner. comp->setOwner(this); + comp->setIsServerObject(isServerObject()); + //if we've already been added and this is being added after the fact(at runtime), //then just go ahead and call it's onComponentAdd so it can get to work - if (mInitialized) + //if (mInitialized) + { comp->onComponentAdd(); + if (comp->isNetworked()) + { + NetworkedComponent netComp; + netComp.componentIndex = mComponents.size() - 1; + netComp.updateState = NetworkedComponent::Adding; + netComp.updateMaskBits = -1; + + mNetworkedComponents.push_back(netComp); + + setMaskBits(AddComponentsMask); + setMaskBits(ComponentsUpdateMask); + } + } + onComponentAdded.trigger(comp); return true; @@ -1269,7 +1436,7 @@ Component *Entity::getComponent(String componentType) Namespace *NS = comp->getNamespace(); //we shouldn't ever go past Component into net object, as we're no longer dealing with component classes - while (dStrcmp(NS->getName(), "NetObject")) + while (dStrcmp(NS->getName(), "SimObject")) { String namespaceName = NS->getName(); @@ -1497,7 +1664,8 @@ void Entity::notifyComponents(String signalFunction, String argA, String argB, S void Entity::setComponentsDirty() { - if (mToLoadComponents.empty()) + bool tmp = true; + /*if (mToLoadComponents.empty()) mStartComponentUpdate = true; //we need to build a list of behaviors that need to be pushed across the network @@ -1522,7 +1690,7 @@ void Entity::setComponentsDirty() } } - setMaskBits(ComponentsMask); + setMaskBits(ComponentsMask);*/ } void Entity::setComponentDirty(Component *comp, bool forceUpdate) @@ -1654,7 +1822,7 @@ ConsoleMethod(Entity, addComponents, void, 2, 2, "() - Add all fielded behaviors object->addComponents(); }*/ -ConsoleMethod(Entity, addComponent, bool, 3, 3, "(Component* bi) - Add a behavior to the object\n" +ConsoleMethod(Entity, addComponent, bool, 3, 3, "(ComponentInstance bi) - Add a behavior to the object\n" "@param bi The behavior instance to add" "@return (bool success) Whether or not the behavior was successfully added") { @@ -1679,7 +1847,7 @@ ConsoleMethod(Entity, addComponent, bool, 3, 3, "(Component* bi) - Add a behavio return false; } -ConsoleMethod(Entity, removeComponent, bool, 3, 4, "(Component* bi, [bool deleteBehavior = true])\n" +ConsoleMethod(Entity, removeComponent, bool, 3, 4, "(ComponentInstance bi, [bool deleteBehavior = true])\n" "@param bi The behavior instance to remove\n" "@param deleteBehavior Whether or not to delete the behavior\n" "@return (bool success) Whether the behavior was successfully removed") @@ -1834,4 +2002,43 @@ DefineConsoleMethod(Entity, notify, void, (String signalFunction, String argA, S return; object->notifyComponents(signalFunction, argA, argB, argC, argD, argE); +} + +DefineConsoleFunction(findEntitiesByTag, const char*, (SimGroup* searchingGroup, String tags), (nullAsType(), ""), +"Finds all entities that have the provided tags.\n" +"@param searchingGroup The SimGroup to search inside. If null, we'll search the entire dictionary(this can be slow!).\n" +"@param tags Word delimited list of tags to search for. If multiple tags are included, the list is eclusively parsed, requiring all tags provided to be found on an entity for a match.\n" +"@return A word list of IDs of entities that match the tag search terms.") +{ + //if (tags.isEmpty()) + return ""; + + /*if (searchingGroup == nullptr) + { + searchingGroup = Sim::getRootGroup(); + } + + StringTableEntry entityStr = StringTable->insert("Entity"); + + std::thread threadBob; + + std::thread::id a = threadBob.get_id(); + std::thread::id b = std::this_thread::get_id().; + + if (a == b) + { + //do + } + + for (SimGroup::iterator itr = searchingGroup->begin(); itr != searchingGroup->end(); itr++) + { + Entity* ent = dynamic_cast((*itr)); + + if (ent != nullptr) + { + ent->mTags. + } + } + + object->notifyComponents(signalFunction, argA, argB, argC, argD, argE);*/ } \ No newline at end of file diff --git a/Engine/source/T3D/entity.h b/Engine/source/T3D/entity.h index 1f160e5a9..db65f2866 100644 --- a/Engine/source/T3D/entity.h +++ b/Engine/source/T3D/entity.h @@ -58,7 +58,27 @@ private: Vector mComponents; - Vector mToLoadComponents; + //Bit of helper data to let us track and manage the adding, removal and updating of networked components + struct NetworkedComponent + { + U32 componentIndex; + + enum UpdateState + { + None, + Adding, + Removing, + Updating + }; + + UpdateState updateState; + + U32 updateMaskBits; + }; + + Vector mNetworkedComponents; + + U32 mComponentNetMask; bool mStartComponentUpdate; @@ -69,10 +89,12 @@ private: bool mInitialized; + String mTags; + Signal< void(Component*) > onComponentAdded; Signal< void(Component*) > onComponentRemoved; - Signal< void(MatrixF*) > onTransformSet; + S32 mLifetimeMS; protected: @@ -105,10 +127,12 @@ public: { TransformMask = Parent::NextFreeMask << 0, BoundsMask = Parent::NextFreeMask << 1, - ComponentsMask = Parent::NextFreeMask << 2, - NoWarpMask = Parent::NextFreeMask << 3, - NamespaceMask = Parent::NextFreeMask << 4, - NextFreeMask = Parent::NextFreeMask << 5 + ComponentsUpdateMask = Parent::NextFreeMask << 2, + AddComponentsMask = Parent::NextFreeMask << 3, + RemoveComponentsMask = Parent::NextFreeMask << 4, + NoWarpMask = Parent::NextFreeMask << 5, + NamespaceMask = Parent::NextFreeMask << 6, + NextFreeMask = Parent::NextFreeMask << 7 }; StateDelta mDelta; @@ -116,6 +140,8 @@ public: Move lastMove; + S32 mStartTimeMS; + // Entity(); ~Entity(); @@ -163,6 +189,9 @@ public: /// @param client Client that is now controlling this object virtual void setControllingClient(GameConnection *client); + // + //Networking + // // NetObject U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); void unpackUpdate(NetConnection *conn, BitStream *stream); @@ -170,6 +199,8 @@ public: void setComponentsDirty(); void setComponentDirty(Component *comp, bool forceUpdate = false); + void setComponentNetMask(Component* comp, U32 mask); + //Components virtual bool deferAddingComponents() const { return true; } diff --git a/Engine/source/scene/sceneManager.cpp b/Engine/source/scene/sceneManager.cpp index e40caecfc..aeca87092 100644 --- a/Engine/source/scene/sceneManager.cpp +++ b/Engine/source/scene/sceneManager.cpp @@ -38,6 +38,9 @@ #include "T3D/gameBase/gameConnection.h" #include "math/mathUtils.h" +#include "T3D/components/render/renderComponentInterface.h" +#include "T3D/systems/render/meshRenderSystem.h" + // For player object bounds workaround. #include "T3D/player.h" @@ -358,6 +361,8 @@ void SceneManager::_renderScene( SceneRenderState* state, U32 objectMask, SceneZ if( gEditingMission && state->isDiffusePass() ) objectMask = EDITOR_RENDER_TYPEMASK; + MeshRenderSystem::render(this, state); + // Update the zoning state and traverse zones. if( getZoneManager() ) diff --git a/Engine/source/scene/sceneRenderState.cpp b/Engine/source/scene/sceneRenderState.cpp index fa1966ab8..3dda18513 100644 --- a/Engine/source/scene/sceneRenderState.cpp +++ b/Engine/source/scene/sceneRenderState.cpp @@ -106,17 +106,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects ) object->prepRenderImage( this ); } - U32 interfaceCount = RenderComponentInterface::all.size(); - for (U32 i = 0; i < RenderComponentInterface::all.size(); i++) - { - Component* comp = dynamic_cast(RenderComponentInterface::all[i]); - - if (comp->isClientObject() && comp->isActive()) - { - RenderComponentInterface::all[i]->prepRenderImage(this); - } - } - PROFILE_END(); // Render what the objects have batched. diff --git a/Templates/BaseGame/game/core/CoreComponents.cs b/Templates/BaseGame/game/core/CoreComponents.cs new file mode 100644 index 000000000..5bdca8cd3 --- /dev/null +++ b/Templates/BaseGame/game/core/CoreComponents.cs @@ -0,0 +1,10 @@ + +function CoreComponentsModule::onCreate(%this) +{ + %classList = enumerateConsoleClasses( "Component" ); + + foreach$( %componentClass in %classList ) + { + echo("Native Component of type: " @ %componentClass); + } +} \ No newline at end of file From f731a91c786a793e556ed6aa76e6ea27397b34f0 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:03:44 -0600 Subject: [PATCH 087/312] Expansion of the guiDragAndDropCtrl - support for dragging to any control visible on the canvas. --- .../gui/containers/guiDragAndDropCtrl.cpp | 27 +++++++++++++++++-- .../gui/containers/guiDragAndDropCtrl.h | 4 +++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Engine/source/gui/containers/guiDragAndDropCtrl.cpp b/Engine/source/gui/containers/guiDragAndDropCtrl.cpp index 027fda6c8..a4aebe34c 100644 --- a/Engine/source/gui/containers/guiDragAndDropCtrl.cpp +++ b/Engine/source/gui/containers/guiDragAndDropCtrl.cpp @@ -152,14 +152,24 @@ ConsoleDocClass( GuiDragAndDropControl, "@ingroup GuiUtil" ); +IMPLEMENT_CALLBACK(GuiDragAndDropControl, onControlDragCancelled, void, (), (), + "Called when the we cancel out of the drag and drop action.\n" + "@see GuiDragAndDropControl::onControlDragCancelled"); //----------------------------------------------------------------------------- +GuiDragAndDropControl::GuiDragAndDropControl() : mDeleteOnMouseUp(true), mUseWholeCanvas(false) +{ + +} void GuiDragAndDropControl::initPersistFields() { addField( "deleteOnMouseUp", TypeBool, Offset( mDeleteOnMouseUp, GuiDragAndDropControl ), "If true, the control deletes itself when the left mouse button is released.\n\n" "If at this point, the drag&drop control still contains its payload, it will be deleted along with the control." ); + + addField("useWholeCanvas", TypeBool, Offset(mUseWholeCanvas, GuiDragAndDropControl), + "If true, the control can be tested against ANY control active on the canvas instead of just the direct parent.\n\n"); Parent::initPersistFields(); } @@ -226,8 +236,10 @@ void GuiDragAndDropControl::onMouseUp(const GuiEvent& event) mouseUnlock(); GuiControl* target = findDragTarget( event.mousePoint, "onControlDropped" ); - if( target ) - target->onControlDropped_callback( dynamic_cast< GuiControl* >( at( 0 ) ), getDropPoint() ); + if (target) + target->onControlDropped_callback(dynamic_cast(at(0)), getDropPoint()); + else + onControlDragCancelled_callback(); if( mDeleteOnMouseUp ) deleteObject(); @@ -239,6 +251,13 @@ GuiControl* GuiDragAndDropControl::findDragTarget( Point2I mousePoint, const cha { // If there are any children and we have a parent. GuiControl* parent = getParent(); + + if (mUseWholeCanvas) + { + parent->setVisible(false); + parent = getRoot(); + } + if (size() && parent) { mVisible = false; @@ -252,6 +271,10 @@ GuiControl* GuiDragAndDropControl::findDragTarget( Point2I mousePoint, const cha dropControl = dropControl->getParent(); } } + + if(mUseWholeCanvas) + parent->setVisible(true); + return NULL; } diff --git a/Engine/source/gui/containers/guiDragAndDropCtrl.h b/Engine/source/gui/containers/guiDragAndDropCtrl.h index a8ef0e7b3..aae34a08b 100644 --- a/Engine/source/gui/containers/guiDragAndDropCtrl.h +++ b/Engine/source/gui/containers/guiDragAndDropCtrl.h @@ -53,6 +53,8 @@ class GuiDragAndDropControl : public GuiControl /// If true, the control deletes itself when the left mouse button is released. bool mDeleteOnMouseUp; + bool mUseWholeCanvas; + /// Controls may want to react when they are dragged over, entered or exited. SimObjectPtr mLastTarget; @@ -81,6 +83,8 @@ class GuiDragAndDropControl : public GuiControl DECLARE_DESCRIPTION( "A special control that implements drag&drop behavior.\n" "The control will notify other controls as it moves across the canvas.\n" "Content can be attached through dynamic fields or child objects." ); + + DECLARE_CALLBACK(void, onControlDragCancelled, ()); }; #endif \ No newline at end of file From 5bf3d56a054bc635edebc33140d23d7c49534634 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:07:50 -0600 Subject: [PATCH 088/312] Addition to guiTreeViewCtrl - ability to find what item in the tree is under a given position. --- .../source/gui/controls/guiTreeViewCtrl.cpp | 21 +++++++++++++++++++ Engine/source/gui/controls/guiTreeViewCtrl.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index ca499a758..9d45147e1 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -2501,6 +2501,19 @@ const char * GuiTreeViewCtrl::getItemValue(S32 itemId) //----------------------------------------------------------------------------- +S32 GuiTreeViewCtrl::getItemAtPosition(Point2I position) +{ + BitSet32 hitFlags = 0; + Item* item; + + if (_hitTest(position, item, hitFlags)) + return item->mId; + else + return -1; +} + +//----------------------------------------------------------------------------- + bool GuiTreeViewCtrl::editItem( S32 itemId, const char* newText, const char* newValue ) { Item* item = getItem( itemId ); @@ -5550,3 +5563,11 @@ DefineEngineMethod( GuiTreeViewCtrl, clearFilterText, void, (),, { object->clearFilterText(); } + +DefineEngineMethod(GuiTreeViewCtrl, getItemAtPosition, S32, (Point2I position), (Point2I::Zero), + "Get the tree item at the passed in position.\n\n" + "@param position The position to check for what item is below it.\n" + "@return The id of the item under the position.") +{ + return object->getItemAtPosition(position); +} \ No newline at end of file diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.h b/Engine/source/gui/controls/guiTreeViewCtrl.h index 91f842b3d..686e3ea61 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.h +++ b/Engine/source/gui/controls/guiTreeViewCtrl.h @@ -513,6 +513,8 @@ class GuiTreeViewCtrl : public GuiArrayCtrl bool editItem( S32 itemId, const char* newText, const char* newValue ); bool markItem( S32 itemId, bool mark ); + + S32 getItemAtPosition(Point2I position); bool isItemSelected( S32 itemId ); From 727592d63ac7aa46b9c68a232d40b2975e039bd3 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:12:02 -0600 Subject: [PATCH 089/312] Small fixes to the inspector, and added the ability for the variableInspector to process command and filename field types. --- Engine/source/gui/editor/guiInspector.cpp | 8 ++++++-- Engine/source/gui/editor/inspector/variableInspector.cpp | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 63e112c9e..4551d03e8 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -54,7 +54,8 @@ GuiInspector::GuiInspector() mOverDivider( false ), mMovingDivider( false ), mHLField( NULL ), - mShowCustomFields( true ) + mShowCustomFields( true ), + mComponentGroupTargetId(-1) { mPadding = 1; } @@ -620,7 +621,10 @@ void GuiInspector::refresh() else compName = comp->getComponentName(); - GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(compName, this, comp); + StringBuilder captionString; + captionString.format("%s [%i]", compName.c_str(), comp->getId()); + + GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(captionString.data(), this, comp); if (compGroup != NULL) { compGroup->registerObject(); diff --git a/Engine/source/gui/editor/inspector/variableInspector.cpp b/Engine/source/gui/editor/inspector/variableInspector.cpp index 6e673bc34..edfaf2ed1 100644 --- a/Engine/source/gui/editor/inspector/variableInspector.cpp +++ b/Engine/source/gui/editor/inspector/variableInspector.cpp @@ -167,6 +167,10 @@ void GuiVariableInspector::addField(const char* name, const char* label, const c fieldTypeMask = TypeColorF; else if (newField.mFieldTypeName == StringTable->insert("ease")) fieldTypeMask = TypeEaseF; + else if (newField.mFieldTypeName == StringTable->insert("command")) + fieldTypeMask = TypeCommand; + else if (newField.mFieldTypeName == StringTable->insert("filename")) + fieldTypeMask = TypeStringFilename; else fieldTypeMask = -1; @@ -192,6 +196,7 @@ void GuiVariableInspector::addCallbackField(const char* name, const char* label, void GuiVariableInspector::clearFields() { mFields.clear(); + clearGroups(); update(); } From cfe977584dae1f5301adde38288073087f87990f Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:14:16 -0600 Subject: [PATCH 090/312] Added function to guiMenuBar to find a menu by name. --- Engine/source/gui/editor/guiMenuBar.cpp | 23 ++++++++++++++++++++++- Engine/source/gui/editor/guiMenuBar.h | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index 0fe8c3c71..fc9623498 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -1472,6 +1472,17 @@ PopupMenu* GuiMenuBar::getMenu(U32 index) return mMenuList[index].popupMenu; } +PopupMenu* GuiMenuBar::findMenu(StringTableEntry barTitle) +{ + for (U32 i = 0; i < mMenuList.size(); i++) + { + if (mMenuList[i].text == barTitle) + return mMenuList[i].popupMenu; + } + + return nullptr; +} + //----------------------------------------------------------------------------- // Console Methods //----------------------------------------------------------------------------- @@ -1506,4 +1517,14 @@ DefineConsoleMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)") DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType(), -1), "(object, pos) insert object at position") { object->insert(pObject, pos); -} \ No newline at end of file +} + +DefineConsoleMethod(GuiMenuBar, findMenu, S32, (StringTableEntry barTitle), (""), "(barTitle)") +{ + PopupMenu* menu = object->findMenu(barTitle); + + if (menu) + return menu->getId(); + else + return 0; +} diff --git a/Engine/source/gui/editor/guiMenuBar.h b/Engine/source/gui/editor/guiMenuBar.h index d266378e3..054be37cc 100644 --- a/Engine/source/gui/editor/guiMenuBar.h +++ b/Engine/source/gui/editor/guiMenuBar.h @@ -116,6 +116,7 @@ public: U32 getMenuListCount() { return mMenuList.size(); } PopupMenu* getMenu(U32 index); + PopupMenu* findMenu(StringTableEntry barTitle); DECLARE_CONOBJECT(GuiMenuBar); DECLARE_CALLBACK( void, onMouseInMenu, ( bool hasLeftMenu )); From 398b00f0ddc1a6e886a0d3ea0ba9d309113e1317 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:15:10 -0600 Subject: [PATCH 091/312] Minor fixes for guiPopupMenuCtrl to get the submenu arrow to render, as well as a sanity check. --- Engine/source/gui/editor/guiPopupMenuCtrl.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index 99c354102..d03a8bec1 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -59,7 +59,8 @@ void GuiPopupMenuBackgroundCtrl::onMouseDragged(const GuiEvent &event) void GuiPopupMenuBackgroundCtrl::close() { - getRoot()->removeObject(this); + if(getRoot()) + getRoot()->removeObject(this); mMenuBarCtrl = nullptr; } @@ -151,16 +152,22 @@ void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool s S32 bottom = top + 8; S32 middle = top + 4; - PrimBuild::begin(GFXTriangleList, 3); - if (selected || mouseOver) - PrimBuild::color(mProfile->mFontColorHL); - else - PrimBuild::color(mProfile->mFontColor); + //PrimBuild::begin(GFXTriangleList, 3); - PrimBuild::vertex2i(left, top); + ColorI color = ColorI::BLACK; + if (selected || mouseOver) + color = mProfile->mFontColorHL; + else + color = mProfile->mFontColor; + + GFX->getDrawUtil()->drawLine(Point2I(left, top), Point2I(right, middle), color); + GFX->getDrawUtil()->drawLine(Point2I(right, middle), Point2I(left, bottom), color); + GFX->getDrawUtil()->drawLine(Point2I(left, bottom), Point2I(left, top), color); + + /*PrimBuild::vertex2i(left, top); PrimBuild::vertex2i(right, middle); PrimBuild::vertex2i(left, bottom); - PrimBuild::end(); + PrimBuild::end();*/ } } From 35c0860418e55a81a8f064b3a7c7026e75e7c689 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:17:14 -0600 Subject: [PATCH 092/312] Added Sound Component --- .../T3D/components/audio/SoundComponent.cpp | 421 ++++++++++++++++++ .../T3D/components/audio/SoundComponent.h | 129 ++++++ 2 files changed, 550 insertions(+) create mode 100644 Engine/source/T3D/components/audio/SoundComponent.cpp create mode 100644 Engine/source/T3D/components/audio/SoundComponent.h diff --git a/Engine/source/T3D/components/audio/SoundComponent.cpp b/Engine/source/T3D/components/audio/SoundComponent.cpp new file mode 100644 index 000000000..179282d2a --- /dev/null +++ b/Engine/source/T3D/components/audio/SoundComponent.cpp @@ -0,0 +1,421 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "T3D/components/audio/SoundComponent.h" +#include "core/stream/bitStream.h" +#include "sim/netConnection.h" + +#include "sfx/sfxSystem.h" +#include "sfx/sfxSource.h" +#include "sfx/sfxTrack.h" +#include "sfx/sfxDescription.h" +#include "T3D/sfx/sfx3DWorld.h" + +#include "sfx/sfxTrack.h" +#include "sfx/sfxTypes.h" + +#include "renderInstance/renderPassManager.h" +#include "gfx/gfxDrawUtil.h" + +// Timeout for non-looping sounds on a channel +static SimTime sAudioTimeout = 500; + +extern bool gEditingMission; + +////////////////////////////////////////////////////////////////////////// +// Constructor/Destructor +////////////////////////////////////////////////////////////////////////// +SoundComponent::SoundComponent() : Component() +{ + //These flags inform that, in this particular component, we network down to the client, which enables the pack/unpackData functions to operate + mNetworked = true; + + mFriendlyName = "Sound(Component)"; + mComponentType = "Sound"; + mDescription = getDescriptionText("Stores up to 4 sounds for playback."); + + for (U32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) { + mSoundThread[slotNum].play = false; + mSoundThread[slotNum].profile = 0; + mSoundThread[slotNum].sound = 0; + + mSoundFile[slotNum] = NULL; + mPreviewSound[slotNum] = false; + mPlay[slotNum] = false; + } +} + +SoundComponent::~SoundComponent() +{ +} + +IMPLEMENT_CO_NETOBJECT_V1(SoundComponent); + +//Standard onAdd function, for when the component is created +bool SoundComponent::onAdd() +{ + if (!Parent::onAdd()) + return false; + + for (U32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + mPreviewSound[slotNum] = false; + + return true; +} + +//Standard onRemove function, when the component object is deleted +void SoundComponent::onRemove() +{ + Parent::onRemove(); +} + +//This is called when the component has been added to an entity +void SoundComponent::onComponentAdd() +{ + Parent::onComponentAdd(); + + Con::printf("We were added to an entity! SoundComponent reporting in for owner entity %i", mOwner->getId()); +} + +//This is called when the component has been removed from an entity +void SoundComponent::onComponentRemove() +{ + Con::printf("We were removed from our entity! SoundComponent signing off for owner entity %i", mOwner->getId()); + Parent::onComponentRemove(); +} + +//This is called any time a component is added to an entity. Every component currently owned by the entity is informed of the event. +//This allows you to do dependency behavior, like collisions being aware of a mesh component, etc +void SoundComponent::componentAddedToOwner(Component *comp) +{ + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + if (mPlay[slotNum]) + { + playAudio(slotNum, mSoundFile[slotNum]); + } + } + Con::printf("Our owner entity has a new component being added! SoundComponent welcomes component %i of type %s", comp->getId(), comp->getClassRep()->getNameSpace()); +} + +//This is called any time a component is removed from an entity. Every component current owned by the entity is informed of the event. +//This allows cleanup and dependency management. +void SoundComponent::componentRemovedFromOwner(Component *comp) +{ + Con::printf("Our owner entity has a removed a component! SoundComponent waves farewell to component %i of type %s", comp->getId(), comp->getClassRep()->getNameSpace()); +} + +//Regular init persist fields function to set up static fields. +void SoundComponent::initPersistFields() +{ + //addArray("Sounds", MaxSoundThreads); + addField("mSoundFile", TypeSFXTrackName, Offset(mSoundFile, SoundComponent), MaxSoundThreads, "If the text will not fit in the control, the deniedSound is played."); + addProtectedField("mPreviewSound", TypeBool, Offset(mPreviewSound, SoundComponent), + &_previewSound, &defaultProtectedGetFn, MaxSoundThreads, "Preview Sound", AbstractClassRep::FieldFlags::FIELD_ComponentInspectors); + addProtectedField("play", TypeBool, Offset(mPlay, SoundComponent), + &_autoplay, &defaultProtectedGetFn, MaxSoundThreads, "Whether playback of the emitter's sound should start as soon as the emitter object is added to the level.\n" + "If this is true, the emitter will immediately start to play when the level is loaded."); + //endArray("Sounds"); + Parent::initPersistFields(); +} + +bool SoundComponent::_previewSound(void *object, const char *index, const char *data) +{ + U32 slotNum = (index != NULL) ? dAtoui(index) : 0; + SoundComponent* component = reinterpret_cast< SoundComponent* >(object); + if (!component->mPreviewSound[slotNum]) + component->playAudio(slotNum, component->mSoundFile[slotNum]); + else + component->stopAudio(slotNum); + component->mPreviewSound[slotNum] = !component->mPreviewSound[slotNum]; + + return false; +} + +bool SoundComponent::_autoplay(void *object, const char *index, const char *data) +{ + U32 slotNum = (index != NULL) ? dAtoui(index) : 0; + SoundComponent* component = reinterpret_cast< SoundComponent* >(object); + component->mPlay[slotNum] = dAtoui(data); + if (component->mPlay[slotNum]) + component->playAudio(slotNum, component->mSoundFile[slotNum]); + else + component->stopAudio(slotNum); + + return false; +} + +U32 SoundComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stream) +{ + U32 retMask = Parent::packUpdate(con, mask, stream); + + if (mask & InitialUpdateMask) + { + // mask off sounds that aren't playing + S32 slotNum; + for (slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + if (!mSoundThread[slotNum].play) + mask &= ~(SoundMaskN << slotNum); + } + + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + stream->writeFlag(mPreviewSound[slotNum]); + + if (stream->writeFlag(mask & SoundMask)) + { + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + Sound& st = mSoundThread[slotNum]; + + if (stream->writeFlag(mask & (SoundMaskN << slotNum))) + { + if (stream->writeFlag(st.play)) + //stream->writeRangedU32(st.profile->getId(), DataBlockObjectIdFirst, + // DataBlockObjectIdLast); + stream->writeString(st.profile->getName()); + + } + } + } + + return retMask; +} + +void SoundComponent::unpackUpdate(NetConnection *con, BitStream *stream) +{ + Parent::unpackUpdate(con, stream); + + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + mPreviewSound[slotNum] = stream->readFlag(); + + if (stream->readFlag()) + { + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + if (stream->readFlag()) + { + Sound& st = mSoundThread[slotNum]; + st.play = stream->readFlag(); + if (st.play) + { + //st.profile = (SFXTrack*)stream->readRangedU32(DataBlockObjectIdFirst, + // DataBlockObjectIdLast); + char profileName[255]; + stream->readString(profileName); + + if (!Sim::findObject(profileName, st.profile)) + Con::errorf("Could not find SFXTrack"); + } + + //if (isProperlyAdded()) + updateAudioState(st); + } + } + } +} + +//This allows custom behavior in the event the owner is being edited +void SoundComponent::onInspect() +{ +} + +//This allows cleanup of the custom editor behavior if our owner stopped being edited +void SoundComponent::onEndInspect() +{ +} + +//Process tick update function, natch +void SoundComponent::processTick() +{ + Parent::processTick(); +} + +//Client-side advance function +void SoundComponent::advanceTime(F32 dt) +{ + +} + +//Client-side interpolation function +void SoundComponent::interpolateTick(F32 delta) +{ + +} + +void SoundComponent::prepRenderImage(SceneRenderState *state) +{ + if (!mEnabled || !mOwner || !gEditingMission) + return; + ObjectRenderInst* ri = state->getRenderPass()->allocInst< ObjectRenderInst >(); + + ri->renderDelegate.bind(this, &SoundComponent::_renderObject); + ri->type = RenderPassManager::RIT_Editor; + ri->defaultKey = 0; + ri->defaultKey2 = 0; + + state->getRenderPass()->addInst(ri); +} + +void SoundComponent::_renderObject(ObjectRenderInst *ri, + SceneRenderState *state, + BaseMatInstance *overrideMat) +{ + if (overrideMat) + return; + + GFXStateBlockDesc desc; + desc.setBlend(true); + + MatrixF camera = GFX->getWorldMatrix(); + camera.inverse(); + Point3F pos = mOwner->getPosition(); + + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + if (mPreviewSound[slotNum]) + { + Sound& st = mSoundThread[slotNum]; + if (st.sound && st.sound->getDescription()) + { + F32 minRad = st.sound->getDescription()->mMinDistance; + F32 falloffRad = st.sound->getDescription()->mMaxDistance; + SphereF sphere(pos, falloffRad); + if (sphere.isContained(camera.getPosition())) + desc.setCullMode(GFXCullNone); + + GFX->getDrawUtil()->drawSphere(desc, minRad, pos, ColorI(255, 0, 255, 64)); + GFX->getDrawUtil()->drawSphere(desc, falloffRad, pos, ColorI(128, 0, 128, 64)); + } + } + } +} + +void SoundComponent::playAudio(U32 slotNum, SFXTrack* _profile) +{ + AssertFatal(slotNum < MaxSoundThreads, "ShapeBase::playAudio() bad slot index"); + SFXTrack* profile = (_profile != NULL) ? _profile : mSoundFile[slotNum]; + Sound& st = mSoundThread[slotNum]; + if (profile && (!st.play || st.profile != profile)) + { + setMaskBits(SoundMaskN << slotNum); + st.play = true; + st.profile = profile; + updateAudioState(st); + } +} + +void SoundComponent::stopAudio(U32 slotNum) +{ + AssertFatal(slotNum < MaxSoundThreads, "ShapeBase::stopAudio() bad slot index"); + + Sound& st = mSoundThread[slotNum]; + if (st.play) + { + st.play = false; + setMaskBits(SoundMaskN << slotNum); + updateAudioState(st); + } +} + +void SoundComponent::updateServerAudio() +{ + // Timeout non-looping sounds + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + Sound& st = mSoundThread[slotNum]; + if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) + { + //clearMaskBits(SoundMaskN << slotNum); + st.play = false; + } + } +} + +void SoundComponent::updateAudioState(Sound& st) +{ + SFX_DELETE(st.sound); + + if (st.play && st.profile) + { + if (isClientObject()) + { + //if (Sim::findObject(SimObjectId((uintptr_t)st.profile), st.profile)) + // { + st.sound = SFX->createSource(st.profile, &mOwner->getTransform()); + if (st.sound) + st.sound->play(); + //} + else + st.play = false; + } + else + { + // Non-looping sounds timeout on the server + st.timeout = 0; + if (!st.profile->getDescription()->mIsLooping) + st.timeout = Sim::getCurrentTime() + sAudioTimeout; + } + } + else + st.play = false; +} + +void SoundComponent::updateAudioPos() +{ + for (S32 slotNum = 0; slotNum < MaxSoundThreads; slotNum++) + { + SFXSource* source = mSoundThread[slotNum].sound; + if (source) + source->setTransform(mOwner->getTransform()); + } +} + +//---------------------------------------------------------------------------- +DefineEngineMethod(SoundComponent, playAudio, bool, (S32 slot, SFXTrack* track), (0, nullAsType()), + "@brief Attach a sound to this shape and start playing it.\n\n" + + "@param slot Audio slot index for the sound (valid range is 0 - 3)\n" // 3 = ShapeBase::MaxSoundThreads-1 + "@param track SFXTrack to play\n" + "@return true if the sound was attached successfully, false if failed\n\n" + + "@see stopAudio()\n") +{ + if (track && slot >= 0 && slot < SoundComponent::MaxSoundThreads) { + object->playAudio(slot, track); + return true; + } + return false; +} + +DefineEngineMethod(SoundComponent, stopAudio, bool, (S32 slot), , + "@brief Stop a sound started with playAudio.\n\n" + + "@param slot audio slot index (started with playAudio)\n" + "@return true if the sound was stopped successfully, false if failed\n\n" + + "@see playAudio()\n") +{ + if (slot >= 0 && slot < SoundComponent::MaxSoundThreads) { + object->stopAudio(slot); + return true; + } + return false; +} \ No newline at end of file diff --git a/Engine/source/T3D/components/audio/SoundComponent.h b/Engine/source/T3D/components/audio/SoundComponent.h new file mode 100644 index 000000000..77dfef067 --- /dev/null +++ b/Engine/source/T3D/components/audio/SoundComponent.h @@ -0,0 +1,129 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef EXAMPLE_COMPONENT_H +#define EXAMPLE_COMPONENT_H +#pragma once + +#ifndef COMPONENT_H +#include "T3D/components/component.h" +#endif +#ifndef RENDER_COMPONENT_INTERFACE_H +#include "T3D/components/render/renderComponentInterface.h" +#endif + +class SFXSource; + +//SoundComponent +//A basic example of the various functions you can utilize to make your own component! +//This example doesn't really DO anything, persay, but you can readily copy it as a base +//and use it as a starting point for your own. +class SoundComponent : public Component, public RenderComponentInterface, public EditorInspectInterface +{ + typedef Component Parent; + +public: + enum PublicConstants + { + MaxSoundThreads = 4, ///< Should be a power of 2 + }; + + /// @name Network state masks + /// @{ + + /// + enum SoundComponentMasks + { + SoundMaskN = Parent::NextFreeMask << 6, ///< Extends + MaxSoundThreads bits + }; + + enum BaseMaskConstants + { + SoundMask = (SoundMaskN << MaxSoundThreads) - SoundMaskN, + }; + /// @name Scripted Sound + /// @{ + struct Sound { + bool play; ///< Are we playing this sound? + SimTime timeout; ///< Time until we stop playing this sound. + SFXTrack* profile; ///< Profile on server + SFXSource* sound; ///< Sound on client + Sound::Sound() + { + play = false; + timeout = 0; + profile = NULL; + sound = NULL; + } + }; + Sound mSoundThread[MaxSoundThreads]; + SFXTrack* mSoundFile[MaxSoundThreads]; + bool mPreviewSound[MaxSoundThreads]; + bool mPlay[MaxSoundThreads]; + /// @} + + SoundComponent(); + virtual ~SoundComponent(); + DECLARE_CONOBJECT(SoundComponent); + + virtual bool onAdd(); + virtual void onRemove(); + static void initPersistFields(); + static bool _previewSound(void *object, const char *index, const char *data); + static bool _autoplay(void *object, const char *index, const char *data); + + virtual U32 packUpdate(NetConnection *con, U32 mask, BitStream *stream); + virtual void unpackUpdate(NetConnection *con, BitStream *stream); + + virtual void onComponentRemove(); + virtual void onComponentAdd(); + + virtual void componentAddedToOwner(Component *comp); + virtual void componentRemovedFromOwner(Component *comp); + + virtual void onInspect(); + virtual void onEndInspect(); + + virtual void processTick(); + virtual void advanceTime(F32 dt); + virtual void interpolateTick(F32 delta); + + void prepRenderImage(SceneRenderState* state); + void _renderObject(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat); + + virtual void playAudio(U32 slotNum, SFXTrack* profile = NULL); + virtual void stopAudio(U32 slot); + virtual void updateServerAudio(); + virtual void updateAudioState(Sound& st); + virtual void updateAudioPos(); + + //why god why + virtual TSShape* getShape() { return NULL; }; + Signal< void(RenderComponentInterface*) > onShapeChanged; + virtual TSShapeInstance* getShapeInstance() { return NULL; }; + Signal< void(RenderComponentInterface*) > onShapeInstanceChanged; + virtual MatrixF getNodeTransform(S32 nodeIdx) { return MatrixF::Identity; }; + virtual Vector getNodeTransforms() { return NULL; }; + virtual void setNodeTransforms(Vector transforms) {}; +}; + +#endif \ No newline at end of file From d5b455a84cce4f76c8adb18fdecc9dcbe78ff423 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:18:05 -0600 Subject: [PATCH 093/312] Added helper functions for managing Game Objects --- .../BaseGame/game/core/helperFunctions.cs | 208 +++++++++++++++++- 1 file changed, 206 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/core/helperFunctions.cs b/Templates/BaseGame/game/core/helperFunctions.cs index 855b5164a..1b98f1ea5 100644 --- a/Templates/BaseGame/game/core/helperFunctions.cs +++ b/Templates/BaseGame/game/core/helperFunctions.cs @@ -202,7 +202,7 @@ function updateTSShapeLoadProgress(%progress, %msg) { // Check if the loading GUI is visible and use that instead of the // separate import progress GUI if possible - if ( isObject(LoadingGui) && LoadingGui.isAwake() ) + /* if ( isObject(LoadingGui) && LoadingGui.isAwake() ) { // Save/Restore load progress at the start/end of the import process if ( %progress == 0 ) @@ -245,7 +245,7 @@ function updateTSShapeLoadProgress(%progress, %msg) %textCtrl.setText(%msg); } - Canvas.repaint(33); + Canvas.repaint(33);*/ } /// A helper function which will return the ghosted client object @@ -952,3 +952,207 @@ function TestPManager::testObjectRemove(%doNotSave) TestPManager.removeObjectFromFile(AudioSim); } +//Game Object management +function findGameObject(%name) +{ + //find all GameObjectAssets + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) + return 0; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); + + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %assetName = AssetDatabase.getAssetName(%assetId); + + if(%assetName $= %name) + { + %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); + + %assetQuery.delete(); + return %gameObjectAsset; + } + } + + %assetQuery.delete(); + return 0; +} + +function spawnGameObject(%name, %addToMissionGroup) +{ + if(%addToMissionGroup $= "") + %addToMissionGroup = true; + + //First, check if this already exists in our GameObjectPool + if(isObject(GameObjectPool)) + { + %goCount = GameObjectPool.countKey(%name); + + //if we have some already in the pool, pull it out and use that + if(%goCount != 0) + { + %goIdx = GameObjectPool.getIndexFromKey(%name); + %go = GameObjectPool.getValue(%goIdx); + + %go.setHidden(false); + %go.setScopeAlways(); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%go); + else // clear instance on level exit + MissionCleanup.add(%go); + + //remove from the object pool's list + GameObjectPool.erase(%goIdx); + + return %go; + } + } + + //We have no existing pool, or no existing game objects of this type, so spawn a new one + + %gameObjectAsset = findGameObject(%name); + + if(isObject(%gameObjectAsset)) + { + %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%newSGOObject); + else // clear instance on level exit + MissionCleanup.add(%newSGOObject); + + return %newSGOObject; + } + + return 0; +} + +function saveGameObject(%name, %tamlPath, %scriptPath) +{ + %gameObjectAsset = findGameObject(%name); + + //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset + if(isObject(%gameObjectAsset)) + { + %assetID = %gameObjectAsset.getAssetId(); + + %gameObjectAsset.TAMLFilePath = %tamlPath; + %gameObjectAsset.scriptFilePath = %scriptPath; + + TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); + AssetDatabase.refreshAsset(%assetID); + } + else + { + //Doesn't exist, so make a new one + %gameObjectAsset = new GameObjectAsset() + { + assetName = %name @ "Asset"; + gameObjectName = %name; + TAMLFilePath = %tamlPath; + scriptFilePath = %scriptPath; + }; + + //Save it alongside the taml file + %path = filePath(%tamlPath); + + TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); + AssetDatabase.refreshAllAssets(true); + } +} + +//Allocates a number of a game object into a pool to be pulled from as needed +function allocateGameObjects(%name, %amount) +{ + //First, we need to make sure our pool exists + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + //Next, we loop and generate our game objects, and add them to the pool + for(%i=0; %i < %amount; %i++) + { + %go = spawnGameObject(%name, false); + + //When our object is in the pool, it's not "real", so we need to make sure + //that we don't ghost it to clients untill we actually spawn it. + %go.clearScopeAlways(); + + //We also hide it, so that we don't 'exist' in the scene until we spawn + %go.hidden = true; + + //Lastly, add us to the pool, with the key being our game object type + GameObjectPool.add(%name, %go); + } +} + +function Entity::delete(%this) +{ + //we want to intercept the delete call, and add it to our GameObjectPool + //if it's a game object + if(%this.gameObjectAsset !$= "") + { + %this.setHidden(true); + %this.clearScopeAlways(); + + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + GameObjectPool.add(%this.gameObjectAsset, %this); + + %missionSet = %this.getGroup(); + %missionSet.remove(%this); + } + else + { + %this.superClass.delete(); + } +} + +function clearGameObjectPool() +{ + if(isObject(GameObjectPool)) + { + %count = GameObjectPool.count(); + + for(%i=0; %i < %count; %i++) + { + %go = GameObjectPool.getValue(%i); + + %go.superClass.delete(); + } + + GameObjectPool.empty(); + } +} + +// +function switchCamera(%client, %newCamEntity) +{ + if(!isObject(%client) || !isObject(%newCamEntity)) + return error("SwitchCamera: No client or target camera!"); + + %cam = %newCamEntity.getComponent(CameraComponent); + + if(!isObject(%cam)) + return error("SwitchCamera: Target camera doesn't have a camera behavior!"); + + //TODO: Cleanup clientOwner for previous camera! + if(%cam.clientOwner == 0 || %cam.clientOwner $= "") + %cam.clientOwner = 0; + + %cam.scopeToClient(%client); + %cam.setDirty(); + + %client.setCameraObject(%newCamEntity); + %client.setControlCameraFov(%cam.FOV); + + %client.camera = %newCamEntity; +} \ No newline at end of file From 297c256a6133d50ec4c403a983aa6117c81ff6ca Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:19:36 -0600 Subject: [PATCH 094/312] Fixes server prefs to be force-loaded from defaults first before loading local prefs to avoid bad config files breaking everything. Also added error message in the even of unexpected failure to connect to local servers that normal errors don't catch(and returns to the main menu in this case) --- .../data/clientServer/scripts/server/server.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs b/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs index 4fd007b35..9f30ecf5d 100644 --- a/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs +++ b/Templates/BaseGame/game/data/clientServer/scripts/server/server.cs @@ -25,11 +25,14 @@ function initServer() echo("\n--------- Initializing " @ $appName @ ": Server Scripts ---------"); //load prefs + + //Force-load the defaults just so we don't have any mistakes + exec( "data/clientServer/scripts/server/defaults.cs" ); + + //Then, if the user has saved preferences, we load those over-top the defaults %prefPath = getPrefpath(); if ( isFile( %prefPath @ "/serverPrefs.cs" ) ) exec( %prefPath @ "/serverPrefs.cs" ); - else - exec( "data/clientServer/scripts/server/defaults.cs" ); exec( "data/clientServer/scripts/server/audio.cs" ); exec( "data/clientServer/scripts/server/commands.cs" ); @@ -99,6 +102,11 @@ function createAndConnectToLocalServer( %serverType, %level ) { %conn.delete(); destroyServer(); + + MessageBoxOK("Error starting local server!", "There was an error when trying to connect to the local server."); + + if(isObject(MainMenuGui)) + Canvas.setContent(MainMenuGui); return false; } @@ -201,7 +209,7 @@ function destroyServer() // End any running levels and shut down the physics sim onServerDestroyed(); - physicsDestroy(); + //physicsDestroy(); // Delete all the server objects if (isObject(ServerGroup)) From 746999ee8ce9dc0d432516058a7e354175551848 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:21:03 -0600 Subject: [PATCH 095/312] Modifies the chooslLevelDlg in the UI module to utilize LevelAssets for the non editor template level selection. --- .../game/data/clientServer/ClientServer.cs | 2 +- .../game/data/ui/scripts/chooseLevelDlg.cs | 54 ++++++++++++++++--- 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/Templates/BaseGame/game/data/clientServer/ClientServer.cs b/Templates/BaseGame/game/data/clientServer/ClientServer.cs index 3cf7aaa55..e8530f22e 100644 --- a/Templates/BaseGame/game/data/clientServer/ClientServer.cs +++ b/Templates/BaseGame/game/data/clientServer/ClientServer.cs @@ -46,7 +46,7 @@ function ClientServer::destroy( %this ) disconnect(); // Destroy the physics plugin. - physicsDestroy(); + //physicsDestroy(); sfxShutdown(); diff --git a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs index c5ae1e297..e04077f83 100644 --- a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs +++ b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs @@ -31,7 +31,11 @@ function ChooseLevelDlg::onWake( %this ) %this->LevelDescriptionLabel.visible = false; %this->LevelDescription.visible = false; - %count = LevelFilesList.count(); + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "LevelAsset")) + return; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); if(%count == 0) { @@ -39,7 +43,7 @@ function ChooseLevelDlg::onWake( %this ) if(IsDirectory("tools")) { MessageBoxYesNo("Error", "No levels were found in any modules. Do you want to load the editor and start a new level?", - "fastLoadWorldEdit(1);", + "EditorOpenMission();", "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); } else @@ -48,12 +52,18 @@ function ChooseLevelDlg::onWake( %this ) "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); } + %assetQuery.delete(); return; } - for ( %i=0; %i < %count; %i++ ) - { - %file = LevelFilesList.getKey( %i ); + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %levelAsset = AssetDatabase.acquireAsset(%assetId); + + %file = %levelAsset.LevelFile; + if ( !isFile(%file @ ".mis") && !isFile(%file) ) continue; @@ -66,7 +76,7 @@ function ChooseLevelDlg::onWake( %this ) continue; } - %this.addMissionFile( %file ); + %this.addLevelAsset( %levelAsset ); } // Also add the new level mission as defined in the world editor settings @@ -218,6 +228,38 @@ function ChooseLevelDlg::addMissionFile( %this, %file ) CL_levelList.addRow( CL_levelList.rowCount(), %levelName TAB %file TAB %levelDesc TAB %levelPreview ); } +function ChooseLevelDlg::addLevelAsset( %this, %levelAsset ) +{ + %file = %levelAsset.LevelFile; + + /*%levelName = fileBase(%file); + %levelDesc = "A Torque level"; + + %LevelInfoObject = getLevelInfo(%file); + + if (%LevelInfoObject != 0) + { + if(%LevelInfoObject.levelName !$= "") + %levelName = %LevelInfoObject.levelName; + else if(%LevelInfoObject.name !$= "") + %levelName = %LevelInfoObject.name; + + if (%LevelInfoObject.desc0 !$= "") + %levelDesc = %LevelInfoObject.desc0; + + if (%LevelInfoObject.preview !$= "") + %levelPreview = %LevelInfoObject.preview; + + %LevelInfoObject.delete(); + }*/ + + %levelName = %levelAsset.friendlyName; + %levelDesc = %levelAsset.description; + %levelPreview = %levelAsset.levelPreviewImage; + + CL_levelList.addRow( CL_levelList.rowCount(), %levelName TAB %file TAB %levelDesc TAB %levelPreview ); +} + function ChooseLevelDlg::onSleep( %this ) { // This is set from the outside, only stays true for a single wake/sleep From 682d43a6886d57543561d4d0f0c776f7530e507d Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:22:42 -0600 Subject: [PATCH 096/312] Tweaks to the GuiMenuBarProfile to have correct coloration and borders. Also added a new Centered Text Edit gui profile. --- .../BaseGame/game/tools/gui/profiles.ed.cs | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Templates/BaseGame/game/tools/gui/profiles.ed.cs b/Templates/BaseGame/game/tools/gui/profiles.ed.cs index 04e8df5b2..a1b120e0d 100644 --- a/Templates/BaseGame/game/tools/gui/profiles.ed.cs +++ b/Templates/BaseGame/game/tools/gui/profiles.ed.cs @@ -287,6 +287,31 @@ new GuiControlProfile( ToolsGuiTextEditProfile ) category = "Tools"; }; +if( !isObject( ToolsGuiTextEditCenterProfile ) ) +new GuiControlProfile (ToolsGuiTextEditCenterProfile) +{ + opaque = true; + //bitmap = "./images/textEditFrame"; + //hasBitmapArray = true; + border = -2; // fix to display textEdit img + //borderWidth = "1"; // fix to display textEdit img + //borderColor = "100 100 100"; + fillColor = "255 255 255 0"; + fillColorHL = "72 72 72"; + fillColorSEL = "255 255 255"; + fontColor = "196 196 196 255"; + fontColorHL = "255 255 255"; + fontColorSEL = "0 0 0"; + fontColorNA = "196 196 196 255"; + textOffset = "4 2"; + autoSizeWidth = false; + autoSizeHeight = true; + justify = "center"; + tab = true; + canKeyFocus = true; + category = "Tools"; +}; + if( !isObject( ToolsGuiNumericTextEditProfile ) ) new GuiControlProfile( ToolsGuiNumericTextEditProfile : ToolsGuiTextEditProfile ) { @@ -1068,10 +1093,14 @@ singleton GuiControlProfile( GuiMenuBarProfile ) { fillcolor = "255 255 255"; fillcolorHL = "213 231 248"; - borderColor = "98 163 229"; - borderColorHL = "122 177 232"; - border = 0; + + fontColorNA = "180 180 180"; + + border = 1; borderThickness = 1; + borderColor = "128 128 128"; + borderColorHL = "122 177 232"; + opaque = true; mouseOverSelected = true; category = "Editor"; From f0afa06b3054be20aa7bfadd8951a20199850030 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:23:46 -0600 Subject: [PATCH 097/312] Update gui editor to utilize new findMenu command for menubars rather than assuming menu names. --- .../tools/guiEditor/scripts/guiEditor.ed.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs index 61dc8c5e7..e68c2e3db 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.cs @@ -223,7 +223,7 @@ function GuiEditor::switchToWorldEditor( %this ) function GuiEditor::enableMenuItems(%this, %val) { - %menu = GuiEditCanvas.menuBar->EditMenu.getID(); + %menu = GuiEditCanvas.menuBar.findMenu("Edit").getID(); %menu.enableItem( 3, %val ); // cut %menu.enableItem( 4, %val ); // copy @@ -239,8 +239,8 @@ function GuiEditor::enableMenuItems(%this, %val) %menu.enableItem( 18, %val ); // group %menu.enableItem( 19, %val ); // ungroup - GuiEditCanvas.menuBar->LayoutMenu.enableAllItems( %val ); - GuiEditCanvas.menuBar->MoveMenu.enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Layout").enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Move").enableAllItems( %val ); } //--------------------------------------------------------------------------------------------- @@ -294,7 +294,7 @@ function GuiEditor::updateUndoMenu(%this) %nextUndo = %uman.getNextUndoName(); %nextRedo = %uman.getNextRedoName(); - %editMenu = GuiEditCanvas.menuBar->editMenu; + %editMenu = GuiEditCanvas.menuBar.findMenu("Edit"); %editMenu.setItemName( 0, "Undo " @ %nextUndo ); %editMenu.setItemName( 1, "Redo " @ %nextRedo ); @@ -443,7 +443,7 @@ function GuiEditor::setPreviewResolution( %this, %width, %height ) function GuiEditor::toggleEdgeSnap( %this ) { %this.snapToEdges = !%this.snapToEdges; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); GuiEditorEdgeSnapping_btn.setStateOn( %this.snapToEdges ); } @@ -452,7 +452,7 @@ function GuiEditor::toggleEdgeSnap( %this ) function GuiEditor::toggleCenterSnap( %this ) { %this.snapToCenters = !%this.snapToCenters; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); GuiEditorCenterSnapping_btn.setStateOn( %this.snapToCenters ); } @@ -461,7 +461,7 @@ function GuiEditor::toggleCenterSnap( %this ) function GuiEditor::toggleFullBoxSelection( %this ) { %this.fullBoxSelection = !%this.fullBoxSelection; - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); } //--------------------------------------------------------------------------------------------- @@ -469,7 +469,7 @@ function GuiEditor::toggleFullBoxSelection( %this ) function GuiEditor::toggleDrawGuides( %this ) { %this.drawGuides= !%this.drawGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); } //--------------------------------------------------------------------------------------------- @@ -477,7 +477,7 @@ function GuiEditor::toggleDrawGuides( %this ) function GuiEditor::toggleGuideSnap( %this ) { %this.snapToGuides = !%this.snapToGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); } //--------------------------------------------------------------------------------------------- @@ -485,7 +485,7 @@ function GuiEditor::toggleGuideSnap( %this ) function GuiEditor::toggleControlSnap( %this ) { %this.snapToControls = !%this.snapToControls; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); } //--------------------------------------------------------------------------------------------- @@ -493,7 +493,7 @@ function GuiEditor::toggleControlSnap( %this ) function GuiEditor::toggleCanvasSnap( %this ) { %this.snapToCanvas = !%this.snapToCanvas; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); } //--------------------------------------------------------------------------------------------- @@ -506,7 +506,7 @@ function GuiEditor::toggleGridSnap( %this ) else %this.setSnapToGrid( %this.snap2GridSize ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); GuiEditorSnapCheckBox.setStateOn( %this.snap2Grid ); } @@ -993,14 +993,14 @@ function GuiEditorGui::onWake( %this ) // Set up initial menu toggle states. - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); // Sync toolbar buttons. From 06e02c55829f326177bc202f7abd485bd7fc0407 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:24:16 -0600 Subject: [PATCH 098/312] Update the editor template level with a clearer name and description. --- Templates/BaseGame/game/tools/levels/BlankRoom.mis | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/tools/levels/BlankRoom.mis b/Templates/BaseGame/game/tools/levels/BlankRoom.mis index d8cd0768b..3d43918be 100644 --- a/Templates/BaseGame/game/tools/levels/BlankRoom.mis +++ b/Templates/BaseGame/game/tools/levels/BlankRoom.mis @@ -24,9 +24,9 @@ new SimGroup(MissionGroup) { soundDistanceModel = "Linear"; canSave = "1"; canSaveDynamicFields = "1"; - desc0 = "A blank room ready to be populated with Torque objects. Guns, anyone?"; + desc0 = "A blank room template that acts as a starting point."; enabled = "1"; - levelName = "Blank Room"; + levelName = "Blank Room Template"; }; new SkyBox(theSky) { Material = "BlankSkyMat"; From 5f5b90794edf107625703ea6676e3e73eb3540b1 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:25:41 -0600 Subject: [PATCH 099/312] Updates the shape editor to support editing a shape via assetID, as well as adding support for shape animation assets being selected when adding a new animation sequence to a shape. --- .../BaseGame/game/tools/shapeEditor/main.cs | 7 +++ .../shapeEditor/scripts/shapeEditor.ed.cs | 16 +++++- .../scripts/shapeEditorActions.ed.cs | 55 ++++++++++++++----- 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/Templates/BaseGame/game/tools/shapeEditor/main.cs b/Templates/BaseGame/game/tools/shapeEditor/main.cs index 721313e95..efbc1c538 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/main.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/main.cs @@ -145,6 +145,13 @@ function ShapeEditorPlugin::onWorldEditorStartup(%this) } } +function ShapeEditorPlugin::openShapeAsset(%this, %assetId) +{ + %this.selectedAssetId = %assetId; + %this.selectedAssetDef = AssetDatabase.acquireAsset(%assetId); + %this.open(%this.selectedAssetDef.fileName); +} + function ShapeEditorPlugin::open(%this, %filename) { if ( !%this.isActivated ) diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs index d79923776..9675ac7c9 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs @@ -611,6 +611,19 @@ function ShapeEdPropWindow::update_onShapeSelectionChanged( %this ) ShapeEdSequenceList.addItem( %name ); } ShapeEdThreadWindow.onAddThread(); // add thread 0 + + //Now, fetch any animation assets if we're utilizing a shape asset + if(ShapeEditorPlugin.selectedAssetId !$= "") + { + %animationAssetCount = ShapeEditorPlugin.selectedAssetDef.getAnimationCount(); + + for(%animIdx = 0; %animIdx < %animationAssetCount; %animIdx++) + { + %animAsset = ShapeEditorPlugin.selectedAssetDef.getAnimation(%animIdx); + + //ShapeEdSequenceList.addItem( %animAsset.assetName ); + } + } // --- DETAILS TAB --- // Add detail levels and meshes to tree @@ -789,7 +802,8 @@ function ShapeEdSeqNodeTabBook::onTabSelected( %this, %name, %index ) { case "Seq": ShapeEdPropWindow-->newBtn.ToolTip = "Add new sequence"; - ShapeEdPropWindow-->newBtn.Command = "ShapeEdSequences.onAddSequence();"; + //ShapeEdPropWindow-->newBtn.Command = "ShapeEdSequences.onAddSequence();"; + ShapeEdPropWindow-->newBtn.Command = "AssetBrowser.showDialog(\"ShapeAnimationAsset\", \"onAddAnimationAssetShapeEditor\", \"\", \"\", \"\");"; ShapeEdPropWindow-->newBtn.setActive( true ); ShapeEdPropWindow-->deleteBtn.ToolTip = "Delete selected sequence (cannot be undone)"; ShapeEdPropWindow-->deleteBtn.Command = "ShapeEdSequences.onDeleteSequence();"; diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs index 2c48b25a1..3847226f6 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs @@ -299,6 +299,12 @@ function ActionEditNodeTransform::undo( %this ) //------------------------------------------------------------------------------ // Add sequence +function onAddAnimationAssetShapeEditor(%selectedAnimation) +{ + echo("SELECTED MUH ASSET"); + ShapeEditor.doAddSequence(%selectedAnimation, 0, 0, 0); +} + function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end ) { %action = %this.createAction( ActionAddSequence, "Add sequence" ); @@ -313,23 +319,44 @@ function ShapeEditor::doAddSequence( %this, %seqName, %from, %start, %end ) function ActionAddSequence::doit( %this ) { - // If adding this sequence from an existing sequence, make a backup copy of - // the existing sequence first, so we can edit the start/end frames later - // without having to worry if the original source sequence has changed. - if ( ShapeEditor.shape.getSequenceIndex( %this.from ) >= 0 ) + if(ShapeEditorPlugin.selectedAssetId $= "") { - %this.from = ShapeEditor.getUniqueName( "sequence", "__backup__" @ %this.origFrom @ "_" ); - ShapeEditor.shape.addSequence( %this.origFrom, %this.from ); + // If adding this sequence from an existing sequence, make a backup copy of + // the existing sequence first, so we can edit the start/end frames later + // without having to worry if the original source sequence has changed. + if ( ShapeEditor.shape.getSequenceIndex( %this.from ) >= 0 ) + { + %this.from = ShapeEditor.getUniqueName( "sequence", "__backup__" @ %this.origFrom @ "_" ); + ShapeEditor.shape.addSequence( %this.origFrom, %this.from ); + } + + // Add the sequence + $collada::forceLoadDAE = EditorSettings.value( "forceLoadDAE" ); + %success = ShapeEditor.shape.addSequence( %this.from, %this.seqName, %this.start, %this.end ); + $collada::forceLoadDAE = false; + + if ( %success ) + { + ShapeEdPropWindow.update_onSequenceAdded( %this.seqName, -1 ); + return true; + } } - - // Add the sequence - $collada::forceLoadDAE = EditorSettings.value( "forceLoadDAE" ); - %success = ShapeEditor.shape.addSequence( %this.from, %this.seqName, %this.start, %this.end ); - $collada::forceLoadDAE = false; - - if ( %success ) + else { - ShapeEdPropWindow.update_onSequenceAdded( %this.seqName, -1 ); + %assetDef = AssetDatabase.acquireAsset(%this.seqName); + %moduleName = getWord(getToken(%this.seqName, ":", 0),0); + + %idx = ShapeEdSequenceList.rowCount(); + + %matSet = "ShapeEditorPlugin.selectedAssetDef.animationSequence"@%idx@"=\"@Asset="@%moduleName@":"@%this.seqName.assetName@"\";"; + eval(%matSet); + + %assetPath = AssetDatabase.getAssetFilePath(ShapeEditorPlugin.selectedAssetId); + + %assetImportSuccessful = TAMLWrite(ShapeEditorPlugin.selectedAssetDef, %assetPath); + + AssetDatabase.refreshAsset(ShapeEditorPlugin.selectedAssetId); + return true; } return false; From 168d4d9f0a6abcc7d867149eb067e648edec14ac Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:27:02 -0600 Subject: [PATCH 100/312] Updated the RMB popup menus for the scene tree to better organize them. Also removed redundant createGameObject function. --- .../tools/worldEditor/scripts/EditorGui.ed.cs | 346 ++++++------------ 1 file changed, 114 insertions(+), 232 deletions(-) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index 800229c8d..2d9e2ec53 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1570,6 +1570,27 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveObjectEntries = false; %haveLockAndHideEntries = true; + //Set up the generic pop-up pre-emptively if we haven't already + if( !isObject( ETContextPopup ) ) + { + %popup = new PopupMenu( ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; + item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + object = -1; + }; + } + // Handle multi-selection. if( %this.getSelectedItemsCount() > 1 ) { @@ -1616,12 +1637,67 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; }; } + + else if(%obj.isMemberOfClass("Entity")) + { + %popup = EntityObjectPopup; + if(!isObject(EntityObjectPopup)) + { + %popup = new PopupMenu( EntityObjectPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; + item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + item[ 8 ] = "-"; + item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; + item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; + item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; + item[ 12 ] = "-"; + item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; + item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; + item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; + + object = -1; + }; + } + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + EntityObjectPopup.enableItem(13, true); + EntityObjectPopup.enableItem(14, false); + EntityObjectPopup.enableItem(15, false); + } + else + { + EntityObjectPopup.enableItem(13, false); + EntityObjectPopup.enableItem(14, true); + EntityObjectPopup.enableItem(15, true); + } + + %popup.object = %obj; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + } // Open context menu if this is a SimGroup else if( !%obj.isMemberOfClass( "SceneObject" ) ) { %popup = ETSimGroupContextPopup; if( !isObject( %popup ) ) + { %popup = new PopupMenu( ETSimGroupContextPopup ) { superClass = "MenuBuilder"; @@ -1642,30 +1718,6 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) object = -1; }; - - if(%obj.isMemberOfClass("Entity")) - { - if( !isObject( GameObjectPopup ) ) - %popup = new PopupMenu( GameObjectPopup : ETSimGroupContextPopup ) - { - //item[ 12 ] = "-"; - item[ 12 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - item[ 13 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; - item[ 14 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; - }; - - if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) - { - GameObjectPopup.enableItem(12, true); - GameObjectPopup.enableItem(13, false); - GameObjectPopup.enableItem(14, false); - } - else - { - GameObjectPopup.enableItem(12, false); - GameObjectPopup.enableItem(13, true); - GameObjectPopup.enableItem(14, true); - } } %popup.object = %obj; @@ -1678,77 +1730,56 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveLockAndHideEntries = false; } - // Open generic context menu. - else + // Specialized version for ConvexShapes. + else if( %obj.isMemberOfClass( "ConvexShape" ) ) { - %popup = ETContextPopup; + %popup = ETConvexShapeContextPopup; if( !isObject( %popup ) ) - %popup = new PopupMenu( ETContextPopup ) + { + %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) { superClass = "MenuBuilder"; isPopup = "1"; - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; + item[ 8 ] = "-"; + item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; }; - - if(%obj.isMemberOfClass("Entity")) - { - %popup = ETEntityContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - }; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; } - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) + %popup.object = %obj; + %haveObjectEntries = true; + } + + // Specialized version for polyhedral objects. + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup = ETPolyObjectContextPopup; + if( !isObject( %popup ) ) { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; + %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; + item[ 8 ] = "-"; + item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + }; } + + %popup.object = %obj; + %haveObjectEntries = true; + } + + // Open generic context menu. + else + { + %popup = ETContextPopup; %popup.object = %obj; %haveObjectEntries = true; @@ -2279,155 +2310,6 @@ function EWorldEditor::deleteMissionObject( %this, %object ) EditorTree.buildVisibleTree( true ); } -function EWorldEditor::createGameObject( %this, %entity ) -{ - if(!isObject(GameObjectBuilder)) - { - new GuiControl(GameObjectBuilder, EditorGuiGroup) { - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "0 0"; - extent = "800 600"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - - new GuiWindowCtrl(GameObjectBuilderTargetWindow) { - profile = "ToolsGuiWindowProfile"; - horizSizing = "center"; - vertSizing = "center"; - position = "384 205"; - extent = "256 102"; - minExtent = "256 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - resizeWidth = "1"; - resizeHeight = "1"; - canMove = "1"; - canClose = "0"; - canMinimize = "0"; - canMaximize = "0"; - minSize = "50 50"; - text = "Create Object"; - - new GuiTextCtrl() { - profile = "GuiCenterTextProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "9 26"; - extent = "84 16"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - text = "Object Name:"; - }; - new GuiTextEditCtrl(GameObjectBuilderObjectName) { - class = ObjectBuilderGuiTextEditCtrl; - profile = "ToolsGuiTextEditProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "78 26"; - extent = "172 18"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - historySize = "0"; - }; - new GuiButtonCtrl(GameObjectBuilderOKButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "7 250"; - extent = "156 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "EWorldEditor.buildGameObject();"; - helpTag = "0"; - text = "Create New"; - Accelerator = "return"; - }; - new GuiButtonCtrl(GameObjectBuilderCancelButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "left"; - vertSizing = "bottom"; - position = "170 250"; - extent = "80 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "Canvas.popDialog(GameObjectBuilder);"; - helpTag = "0"; - text = "Cancel"; - Accelerator = "escape"; - }; - }; - }; - - GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88; - GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57; - GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57; - } - - GameObjectBuilderObjectName.text = ""; - GameObjectBuilder.selectedEntity = %entity; - - Canvas.pushDialog(GameObjectBuilder); -} - -function EWorldEditor::buildGameObject(%this) -{ - if(GameObjectBuilderObjectName.getText() $= "") - { - error("Attempted to make a new Game Object with no name!"); - Canvas.popDialog(GameObjectBuilder); - return; - } - - %path = EditorSettings.value( "WorldEditor/newGameObjectDir" ); - %className = GameObjectBuilderObjectName.getText(); - GameObjectBuilder.selectedEntity.class = %className; - Inspector.inspect(GameObjectBuilder.selectedEntity); - - %file = new FileObject(); - - if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) - { - %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); - %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); - - //todo, pre-write any event functions of interest - - %file.close(); - } - - //set up the paths - %tamlPath = %path @ "/" @ %className @ ".taml"; - %scriptPath = %path @ "/" @ %className @ ".cs"; - saveGameObject(%className, %tamlPath, %scriptPath); - - //reload it - execGameObjects(); - - //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. - TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath); - - GameObjectBuilder.selectedEntity = ""; - - Canvas.popDialog(GameObjectBuilder); -} - function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect ) { if( !isObject( %set ) ) From c729f603b81af17acb431c840e5b374eea511f68 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:27:51 -0600 Subject: [PATCH 101/312] Added convenience function to take control of selected entity if it supports it. --- .../game/tools/worldEditor/scripts/menuHandlers.ed.cs | 7 +++++++ .../BaseGame/game/tools/worldEditor/scripts/menus.ed.cs | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs index f476ccaeb..8c558bfef 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menuHandlers.ed.cs @@ -587,6 +587,13 @@ function makeSelectedAMesh() EditorTree.buildVisibleTree( true ); } +function EditorTakeControlOfEntity() +{ + %object = EWorldEditor.getSelectedObject(0); + switchCamera(localClientConnection, %object); + switchControlObject(localClientConnection, %object); +} + function EditorMount() { echo( "EditorMount" ); diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs index b225d3534..e0d53a76d 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/menus.ed.cs @@ -379,8 +379,10 @@ function EditorGui::buildMenus(%this) Item[17] = "Make Selection Prefab" TAB "" TAB "EditorMakePrefab();"; Item[18] = "Explode Selected Prefab" TAB "" TAB "EditorExplodePrefab();"; Item[19] = "-"; - Item[20] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; - Item[21] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; + Item[20] = "Take control of entity" TAB "" TAB "EditorTakeControlOfEntity();"; + Item[21] = "-"; + Item[22] = "Mount Selection A to B" TAB "" TAB "EditorMount();"; + Item[23] = "Unmount Selected Object" TAB "" TAB "EditorUnmount();"; }; } } From d22e7c98e1de0de9c7c2a68a5fbe61af4767fb60 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:28:58 -0600 Subject: [PATCH 102/312] Cleanup of the editor load function --- Templates/BaseGame/game/tools/main.cs | 115 ++++++++++++++++++++------ 1 file changed, 88 insertions(+), 27 deletions(-) diff --git a/Templates/BaseGame/game/tools/main.cs b/Templates/BaseGame/game/tools/main.cs index dd238eac0..0941c29a4 100644 --- a/Templates/BaseGame/game/tools/main.cs +++ b/Templates/BaseGame/game/tools/main.cs @@ -122,6 +122,17 @@ package Tools if( isFunction( %initializeFunction ) ) call( %initializeFunction ); } + + //Now, go through and load any tool-group modules + ModuleDatabase.setModuleExtension("module"); + + //Any common tool modules + ModuleDatabase.scanModules( "tools", false ); + ModuleDatabase.LoadGroup( "Tool" ); + + //Do any tools that come in with a gameplay package. These are usually specialized tools + //ModuleDatabase.scanModules( "data", false ); + //ModuleDatabase.LoadGroup( "Tool" ); // Popuplate the default SimObject icons that // are used by the various editors. @@ -214,6 +225,29 @@ package Tools } }; +function EditorCreateFakeGameSession(%fileName) +{ + // Create a local game server and connect to it. + if(isObject(ServerGroup)) + ServerGroup.delete(); + + new SimGroup(ServerGroup); + + if(isObject(ServerConnection)) + ServerConnection.delete(); + + new GameConnection(ServerConnection); + + // This calls GameConnection::onConnect. + ServerConnection.connectLocal(); + + $instantGroup = ServerGroup; + + $Game::MissionGroup = "MissionGroup"; + + exec(%file); +} + function fastLoadWorldEdit(%val) { if(%val) @@ -222,37 +256,64 @@ function fastLoadWorldEdit(%val) { onStart(); } - - if(!$Game::running) + + %timerId = startPrecisionTimer(); + + if( GuiEditorIsActive() ) + toggleGuiEditor(1); + + if( !$missionRunning ) { - //startGame(); - activatePackage( "BootEditor" ); - ChooseLevelDlg.launchInEditor = false; - StartGame("tools/levels/BlankRoom.mis", "SinglePlayer"); - - if(!isObject(Observer)) - { - datablock CameraData(Observer) {}; - } - - %cam = new Camera() - { - datablock = Observer; - }; - - %cam.scopeToClient(LocalClientConnection); - - LocalClientConnection.setCameraObject(%cam); - LocalClientConnection.setControlObject(%cam); - - LocalClientConnection.camera = %cam; - - %cam.setPosition("0 0 0"); + // Flag saying, when level is chosen, launch it with the editor open. + ChooseLevelDlg.launchInEditor = true; + Canvas.pushDialog( ChooseLevelDlg ); } else - { - toggleEditor(true); + { + pushInstantGroup(); + + if ( !isObject( Editor ) ) + { + Editor::create(); + MissionCleanup.add( Editor ); + MissionCleanup.add( Editor.getUndoManager() ); + } + + if( EditorIsActive() ) + { + if (theLevelInfo.type $= "DemoScene") + { + commandToServer('dropPlayerAtCamera'); + Editor.close("SceneGui"); + } + else + { + Editor.close("PlayGui"); + } + } + else + { + canvas.pushDialog( EditorLoadingGui ); + canvas.repaint(); + + Editor.open(); + + // Cancel the scheduled event to prevent + // the level from cycling after it's duration + // has elapsed. + cancel($Game::Schedule); + + if (theLevelInfo.type $= "DemoScene") + commandToServer('dropCameraAtPlayer', true); + + canvas.popDialog(EditorLoadingGui); + } + + popInstantGroup(); } + + %elapsed = stopPrecisionTimer( %timerId ); + warn( "Time spent in toggleEditor() : " @ %elapsed / 1000.0 @ " s" ); } } From 1278cf22a25cbd2a85f463dd9697a066cc9b089c Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:30:17 -0600 Subject: [PATCH 103/312] Initial implementation of the Asset Browser tool. --- .../tools/assetBrowser/art/animationIcon.png | Bin 0 -> 8177 bytes .../assetBrowser/art/clientScriptIcon.png | Bin 0 -> 14572 bytes .../tools/assetBrowser/art/componentIcon.png | Bin 0 -> 9050 bytes .../tools/assetBrowser/art/gameObjectIcon.png | Bin 0 -> 14773 bytes .../game/tools/assetBrowser/art/guiIcon.png | Bin 0 -> 5789 bytes .../game/tools/assetBrowser/art/levelIcon.png | Bin 0 -> 6797 bytes .../tools/assetBrowser/art/materialIcon.png | Bin 0 -> 7889 bytes .../tools/assetBrowser/art/postEffectIcon.png | Bin 0 -> 8615 bytes .../tools/assetBrowser/art/scriptIcon.png | Bin 0 -> 10044 bytes .../assetBrowser/art/serverScriptIcon.png | Bin 0 -> 14897 bytes .../game/tools/assetBrowser/art/soundIcon.png | Bin 0 -> 10582 bytes .../assetBrowser/art/stateMachineIcon.png | Bin 0 -> 13506 bytes .../tools/assetBrowser/assetImportConfigs.xml | 18 + .../assetBrowser/guis/GameObjectCreator.gui | 217 +++ .../assetBrowser/guis/addModuleWindow.gui | 142 ++ .../assetBrowser/guis/addPackageWindow.gui | 142 ++ .../tools/assetBrowser/guis/assetBrowser.gui | 934 ++++++++++ .../tools/assetBrowser/guis/assetImport.gui | 613 +++++++ .../tools/assetBrowser/guis/editAsset.gui | 147 ++ .../tools/assetBrowser/guis/editModule.gui | 147 ++ .../game/tools/assetBrowser/guis/newAsset.gui | 237 +++ .../assetBrowser/guis/newComponentAsset.gui | 434 +++++ .../tools/assetBrowser/guis/selectModule.gui | 144 ++ .../tools/assetBrowser/guis/selectPackage.gui | 144 ++ .../BaseGame/game/tools/assetBrowser/main.cs | 70 + .../assetBrowser/scripts/addModuleWindow.cs | 112 ++ .../assetBrowser/scripts/addPackageWindow.cs | 110 ++ .../assetBrowser/scripts/assetBrowser.cs | 1304 ++++++++++++++ .../tools/assetBrowser/scripts/assetImport.cs | 1525 +++++++++++++++++ .../assetBrowser/scripts/assetImportConfig.cs | 472 +++++ .../tools/assetBrowser/scripts/editAsset.cs | 371 ++++ .../tools/assetBrowser/scripts/editModule.cs | 127 ++ .../tools/assetBrowser/scripts/fieldTypes.cs | 127 ++ .../assetBrowser/scripts/gameObjectCreator.cs | 130 ++ .../tools/assetBrowser/scripts/newAsset.cs | 663 +++++++ .../tools/assetBrowser/scripts/popupMenus.cs | 154 ++ .../assetBrowser/scripts/selectModule.cs | 17 + .../assetBrowser/scripts/selectPackage.cs | 17 + 38 files changed, 8518 insertions(+) create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/postEffectIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/soundIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png create mode 100644 Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui create mode 100644 Templates/BaseGame/game/tools/assetBrowser/main.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs create mode 100644 Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/animationIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..381dcee849583825fed664f50d9314fda2d8eb3d GIT binary patch literal 8177 zcmeHMXH=70myTW)J0K!T^`e4?5<1eoDxy*~1W5Ss(PB!NRxcdhNvm;8NwJ^j$&D+F>W$kP?=>2Wgb zF52s)$u)B;4`ojQ2t)>P?ecHdn1Q(=EIKm`|9y1f^HuR7{}j))NanRny2VNEBgNh) z_OADj?LEDFpmfN$R?)N8e(L7H*Kz}cfY5L!Hxa;2kVI#Vy zX6q`t`G`b1A27N?{ng%nnIaI>M7`VbP?+>$C6q$OvdH=MN-I3=;*)i$zd=4HNX(>n zOtl)xy19oqIym=A3dS$n2Yx?r{8Q{Dh|%b`Z=%RBeu}7#IArImOwUuI{=TLB@#zgEVjCfCJ?uV zkDra@m35iC{a7}(tXP-&Uiw~ma3D>Y)~jWK#r9&9hojJz%VW%f`VP;E1gfSz(sSoY z$fxEGQ5`Nnt3gCn9L`zW7EzCo1V8=*p1aMAI{|LkvNRz&S}$sOWO{ILPL5vigkG$Q^ZM&QZD>wqk?&?-I`T*ii(a zDrg@SJj88IUAMe4N$16; z%N7=wxpa)AbVu`jPA3M3Rtb$?ZXVryspJ=9eTA-B(H4kz40f<#2}u-ryLozsbmytx zcz&HZW&P`u1J46Bvf~~CxtytwE}KgM{-6egnBCihsFLgQqJ$yr@O-)7)x2Dv*@PPz z;iHG4NB2{=NdoNt7=GjEfCEBgL%A+;fGL@k8J+0JZT@1N;}ONJc36IMju_+Y<#=Mj z&rw*cS0l4$F)?wHEi%->khd_9sD7EwoxB;##D(B}HYaJCf$*khA2XY$Uqy{XsYTY# zekX8`5MvnDa*-roL|tWwF^WVnB2TXV3~z*b}Ug*rt;C%n5jgI@|HR{=AIXsTvJ?vBs}7x#6$f(#6RL zO5);Kq2{FU@%4NeR}Qy?H*s!#SVayw~1WX6MumOa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FcB4K!u_rAXiEP$fZ&how6@N*-B5P2_=+9 z#cjt+K5Tr30u;delG)&Mr*6>yAezZKY&6;$C2W86DdbNK7*z#JY+s7M^K`Kq<5j4= z7XDJ?Uif12`+43z5CqYwKF{b#)R$DPGS-3Yq*>HFZRk!ew z^3mL)eFm^Nx}U>&{*?VER2K}+GfLU?@;f^mF%@(C0Dz)ayx_WT>z;Ku2@A|`rj{`lk$Q>s#m>nW2fgy2wa5z}e zuaCcV{``TZda?bFd2S;yeIQ@ptpJuLeuo>a8Vu38l*n}~73Qi&EPZjkStd(YGIgFM z>^y6vNfz7+1ECiiWUiLA1m4NL_ZF>Cm1}${eJT9o7I1T+Vsh+Z*-6LRizk=n1ghUx zxq$pHJMl;2DPxK`|DrC_1OVg(o8wmXkNfLvUj8ATkqsLyV3_lo z4wOAmlg}ePp;hHjbW&{ZxaQ0^YXtL|nP<5N^wjg%6h<9X?8=?d}n2gN`< zZ9L3!01H=>g#WMV{gaa2|5x=uJNd^2zyDKJJ^e}k4&c$wb1xnTtbjX%Tr;+~Ou6Xt G;NJk(1STH< literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/clientScriptIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..3f83a2ff3189fae48971c2975fb3e26b2696da03 GIT binary patch literal 14572 zcmeHu^;=X?*Y;rqr9%k?q(eX$N>N|{>FyK;kQ9_IVJJ~T=@x;ZyQDi5q@@R?L3)50 zY8aYteBSpj_^$7|zF(dn=A3=@>}#JLYp->$d#&?HTT_XQn4TB_05TP2d0hYi;ff%D z@HXyt{BG(Tcf<40RgwiNM;Nzp5BT;kG+qEebu7u{D+1gzk*l(a2LO=w{QKc0^N};) zDsNk`PF&SP2Yq8tITt4?Qot4yf9 z_;U88>>E>laq2f^F&Nv881dCH9s9>e?_d?y_Kavm+5s~2z1y+*n2rS4P$Dl^GpFGM zD(jR(07{CZysOH(@`Tle`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&Iv*or6Yz363+NHD6dI6HksCF5#|xyUUksQ zqf8PJ!tSQmOn1j`_NoWA86|I#ma$XArb2rBC9LC4gO!P%H~(Tb)qxy*X~?~osg$xF zB|OMy;x_7d)j;iPX_bev-kfsxaLEShRx+i?(7MsrRu|ja=~IDTYKec-iV_Zb6KtI| zGb7pIFd(_S%~S1uUm(5!I-fwvjAscT zugPl5Lh(k!wI;`Ii7q2jsZ4bUwv%=@$Ru{o4z7zG_!&V1!Vu6%V;nNWa1Qc|;WxB_ z&hfmS+@RNqSA}&ZiwpUY31_3QWArq*r$tKLJL@b4+Z$M-@$7=AA>5*hYM=d<1h)vt zkRS#*ThU=Q??NAJ7wgDO~|EZECp5|5xru z+-**$k^ll>$3lvnHS{JCFss3F<7G4w6=g%I6AYvi(`7&#n{UfAs|WINWy_L4=!ohao9g(ig1Sesmegn_d* z_3OB_tU4E8AY|JkQ&DWR_+N28&4m7G2zq=%bTJY6x@5+!YkXgu9+lvXrz&oWV zJH|Z)Bn`;7I(HcOb(l}lWK6?)qiW*yaGd$>&)Vm@0d=e=o7C806dke0^;hpp6?3$i z^Qn{5H}A^?hDB)8#uFT|O?(0!Yy_r_d@{DcFc>w)aMe0v8a-|#qKTo76figYYMANC z0@nt!@VX0++v2$&uwF!jAC|;)7+>)Mv!V|))Bk}QB32a;3F9w~9HI{OPS2bRT>?K- zs*9ZiSAO{mw=Z#Fv-kcnQ7O>g3A77plMtKCvL#q^N^^vVQo zJUK4iJ?akvnW`>vU?6QYbKjP02!sdI8 zb(G0}y*LJ6P^_#i*6p)y2nl`T+I{cg+yB!zMgomvlkgK;=|wUI=;8FPWA?AfFN05G zKYVx|!?$+_P?|R5m|)FcoZXykq|9=4i&tDV( literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/scriptIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..1a2433dea6c67e3abe4e89db66fac55c32c7db5b GIT bin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4C}fr1pkoueLX(osOR3-D_Fke(|4DybbErL>K3z zw15&F?Ly^Rq#OO>a)w>Pu3hUeca>O7(hchKMrr#H_ty(dZEzSU(}6M9J*1^vublz% zL4$k-vr6E*G0$<4ho*<3s$sWQV1nGcDEQUBWmXr(yB}VITHF z*gDy7&S(^J@Co$YMoKgmxCXXhzAD%~pEtNvIu;M7h0J9;wbQplt9uFIg+J_XM1xkrZ)l3{P;x*4g z7kL-y-O7H*GbOrexg7E1oST{Re;x_n#lUDLo zzZ?TlymIS&G3%=Sd*;(PjroJs1K2^(^}U!Taq~c>`&GDzxIo8(XG<1ZyKf$XO5+0& zY93xugcdmh-vTp&YIA8~>H0`sSY*OXL+Lj-6D=hzkWheK-%QwKsAq#}D*8Nx>q2BIQ=PdXmts-n=(avE zV*u>YT@s(y0(Q=V4~aqIq{_4j&nW-SF$&6LCkVUY~D?7Q%3mfvPP3t|1&zHwv^^;E> zf~W1+Y6bGZWoqrMn`Qkc0X$F?@8&moGeX#r1JP-Aj>$MH^D>Ygo+KJR`W#d04sMWt zPmCtef~Iim1?9|De_K3 zG&2a%J_$i2z!tpa>vXnnd@gg&4iuCr3S*Qi1*VHwJK4ViNM0jVN7;~-LoR?U>c<^v zCX5myn`RhL5=-GT{=^l2hQ7!1Z=A7K9OW8cpGwm+O|I5k$7Ktxnt#`A)e^f3_tvO; z=GsYgw6)4g)fXIM*UGudejMPftTo6^2dAOYlT-$TX<$DD6J=El?28&X^ zQM77SDIo4g993!l5(MX|xq5&Ljr5)ZGL!S?wP*+8p7~aFv-+~Myzo)NwSV6-T0qQE zwPrK(U&B)Y>H3~1JlWyd)5Zd2HpI5NYLL)%Kp5KBcT)(7{N7}-!7}Gv*lmalepda5 zkK=b)8_|t!^+y6UDaxYH9#@^mk9HhP_b~zoD7n%w+&#m748(Wmi)c^nh literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/serverScriptI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ZZLb-zq00LMy3i3F{AW~AT&WFznT>4KTV>1q#s=A!w(<&MWdolLVEgwO z{%)#{PWN1g98gbg?6{VpOZamQdKe2jmHBG*{^cE)kEy)&)sgsAye5C)@_Gz4t;Yxh z1rPv{!QlvGfIIuY9*p!KQ5xsHoF^b;;C~?K=Kt@W{w1UT5jp+4r~k_>_y0~17jq_= YMz1{4xS6F|;CzzmDmuz_Pi?~g7vXvhjsO4v literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/stateMachineIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..95ef798eec2267de8e28636ebd4b9ba740244bcc GIT binary patch literal 13506 zcmeHuXH-*Nw{Adr5fQM0AjN`o>Ak-o3etNof|SsE4`2fY6$R-{1VSfDCo~Zu(o29y zAfQqcnv_riA$ReeGwvAY-23AjemMk7u=pHkz~g+9IpoN}Jpb2*lS+%n(e$8PM67 zlOF#A7w1pfp#sN0aB=;lt&=7C2QE}WGmz8Z_y;axKr{cuT>YyZs+f!aNT>ey;Qra( zfsy_LEBP;r_=i^VUl#H2tR(%@jEfG+mS}Ws*^kOAGP$34gT72rk9&P@0JeQRr6s!A+g>xS`IP%A+ek-pXW7P8LrLksJE$BkLXqoP zM{16G^YV9)u`jN3XAQ><369(s zv61IxIWDy!RpO4sAU`=2sa2CUNCTu5rZKmHq<#%Q#pd;yyWc<5gUJ=GmYk|O^rf0H^r`4U@NCg$hUW;-Y^t6p@TAP>$h{+A0)iaOHw+2 zc6DXci8g#}j6-xf*jKWwW5n2rd<{t*-Uj{Iit*23&M_v8ggILxKi$0Vtxzlt3`x{A zUQrt7ulK9A9v3oQd>B$o_@U}Mak$2Gx3(ralSqe^_yZ=MP~ z=WEso=B_$@&fYfFW85E}hjCjRR{=Bk64i`_nc@ zRKSh;9}|mm8>d#iISt}`UO7^M_7XInV^~A7mKgU8`A#N6jDPnVSHdh-;Xyvcf$GDh z>lb;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e9`xbLr0Vk<+#U%yfB{Pr~aimb@7oKR4=xw z%IRjs^H*`P>BiBAp~-(GORjBftZXOZ*X=ot_^5`k#Ui@1ku8>qEx0bOYYE-S#8%Q) zCj+1?FF%Dq`gNkOm$e^_-+28jN#UU(NCEBlyKV$A#w{IP<>kh;*O*ea`VBktO;iQK zih?xrNcbqJy;lb3s3D>fCn$Y2n!_Y9T8Mw6eWOty6b{U`h{W%dH^>uRRTN6#Rr3@F z>EPGPRe4$LJxB~^#7$w{usrSeBQ`o-ydCdi_OwvR#H{>T(* zI>i}lm6g7<-R5vtCG@lHiNf`bT5hltM@8<@-#sb!BYh9MEzlFpy+gK+I2G=&=chC~ zCh~b-bWv53ha9>`r-VdUH{`Y7HODOULA3{qxS115|BFyDA_@k9I&zvr?tOM469)87 zXd>aN-jvC}MV8O0xfhhG5!MQf#N5rd$R^QzNwQ0HBInd>Ca+UKVA-PIr8||Swpbik9bfwA4K9he%=zhuR?vGfsbfI}7 zBYr&fZ-!U*_=1xPfdZ&!@R!hOZ)+s*_fbNUj%jGl7P1m#zSWt!phmL;REnw@29df0 z9YqVfh1+Ko7mX8Dvi(u+Ky@`L=RJTJ^{fFs*gz!HT5B}@p|4sq;zkAO=@Ue#&Fv@>@ zB;fxs#pVA`+W$naQaxGKf7gosotyt%OLGt=QfWS{izHtJEBx{4XjN BQEUJJ literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml new file mode 100644 index 000000000..a442ab0a8 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/assetImportConfigs.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui new file mode 100644 index 000000000..eb2bf15e6 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/GameObjectCreator.gui @@ -0,0 +1,217 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(GameObjectCreator) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + selectedEntity = "20054"; + + new GuiWindowCtrl(CreateGameObjectWindow) { + text = "Create GameObject"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(GameObjectCreator);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 322"; + extent = "368 123"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(GameObjectCreateBtn) { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 92"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_importAssetWindow.ImportAssets();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 92"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(GameObjectCreator);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(GameObjectCreatorObjectName) { + text = "Game Object Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 60"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(GameObjectCreatorPkgBtn) { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_addModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(GameObjectModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + text = "Characters"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(GameObjectCreatorName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "116 60"; + extent = "234 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui new file mode 100644 index 000000000..e8f35a13a --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/addModuleWindow.gui @@ -0,0 +1,142 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_AddModule) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + Enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_addModuleWindow) { + text = "Create New Module"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "88 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ModuleName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Module Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "72 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addModuleWindow.CreateNewModule();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addModuleWindow.Close();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui new file mode 100644 index 000000000..48a48f5be --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/addPackageWindow.gui @@ -0,0 +1,142 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_AddPackage) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + Enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_addPackageWindow) { + text = "Create New Package"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "88 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "PackageName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Package Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "72 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addPackageWindow.CreateNewPackage();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addPackageWindow.Close();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui new file mode 100644 index 000000000..fd06f7561 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetBrowser.gui @@ -0,0 +1,934 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + AddNewArtAssetPopup = "18801"; + AddNewAssetPopup = "18802"; + AddNewScriptAssetPopup = "18800"; + currentPreviewPage = "0"; + enabled = "1"; + importAssetFinalListArray = "20465"; + importAssetNewListArray = "20463"; + importAssetUnprocessedListArray = "20464"; + totalPages = "1"; + + new GuiWindowCtrl(AssetBrowser_addFilterWindow) { + text = "Create New Tag"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "321 334"; + extent = "381 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "64 35"; + extent = "196 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "tagName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Tag Name"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 35"; + extent = "52 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Create"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "64 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.createFilter( AssetBrowser_addFilterWindow-->tagName.getText() );AssetBrowser_addFilterWindow.setVisible(0);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "196 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_addFilterWindow.setVisible(0);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiWindowCtrl(AssetBrowserWindow) { + text = "Asset Browser"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "AssetBrowser::hideDialog();"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "256 107"; + extent = "512 554"; + minExtent = "383 274"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(CreateAssetButton) { + text = "New"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "3 22"; + extent = "45 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ImportAssetButton) { + text = "Import"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "50 22"; + extent = "45 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiWindowCtrl(TagFilterWindow) { + text = "New Window"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + docking = "None"; + margin = "4 4 4 4"; + padding = "0 0 0 0"; + anchorTop = "0"; + anchorBottom = "0"; + anchorLeft = "0"; + anchorRight = "0"; + position = "129 62"; + extent = "161 250"; + minExtent = "161 86"; + horizSizing = "windowRelative"; + vertSizing = "windowRelative"; + profile = "ToolsGuiToolbarWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "VisibilityLayerWindow"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "2 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 9"; + extent = "159 238"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl(TagFilterList) { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "-2"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "3 1"; + extent = "153 16"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "theVisOptionsList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiSplitContainer() { + orientation = "Vertical"; + splitterSize = "2"; + splitPoint = "149 100"; + fixedPanel = "None"; + fixedSize = "356"; + docking = "None"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "3 42"; + extent = "505 509"; + minExtent = "64 64"; + horizSizing = "relative"; + vertSizing = "height"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPanel() { + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 509"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "Panel1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 31"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "inspectorStyleRolloutDarkProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Filters"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "5 0"; + extent = "30 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconNew.png"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "113 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.viewTagsFilter();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Show assets grouped and filtered via tags."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconList.png"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "130 1"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.viewListFilter();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Views assets via module-oriented list tree."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 17"; + extent = "147 493"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "147 493"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiEditorScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiDefaultProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTreeViewCtrl(AssetBrowserFilterTree) { + tabSize = "16"; + textOffset = "2"; + fullRowSelect = "0"; + itemHeight = "21"; + destroyTreeOnSleep = "1"; + mouseDragging = "1"; + multipleSelections = "1"; + deleteObjectAllowed = "1"; + dragToItemAllowed = "1"; + clearAllOnSingleSelection = "1"; + showRoot = "1"; + useInspectorTooltips = "0"; + tooltipOnWidthOnly = "0"; + showObjectIds = "1"; + showClassNames = "1"; + showObjectNames = "1"; + showInternalNames = "1"; + showClassNameForUnnamedObjects = "0"; + compareToObjectID = "1"; + canRenameObjects = "1"; + renameInternal = "0"; + position = "1 1"; + extent = "145 294"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTreeViewProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "filterTree"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + }; + new GuiPanel() { + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "151 0"; + extent = "354 509"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "panel2"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 0"; + extent = "354 41"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "inspectorStyleRolloutDarkProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/new"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "42 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.createNewAsset();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Create New Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/delete"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "23 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showDeleteDialog();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(AssetBrowserSearchFilter) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + text = "\c2Filter..."; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "62 19"; + extent = "273 18"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserSearchFilterText"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(TagFilterButton) { + bitmap = "tools/gui/images/visible"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "4 19"; + extent = "20 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.toggleTagFilterPopup();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Assets"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "5 0"; + extent = "53 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/delete"; + bitmapMode = "Stretched"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "337 22"; + extent = "15 15"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.showDeleteDialog();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Asset"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "1"; + position = "1 40"; + extent = "354 468"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl(AssetListPanel) { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "1"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 0"; + extent = "354 448"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiEditorScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiDefaultProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl() { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "0"; + position = "1 1"; + extent = "352 254"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiModelessDialogProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiControl() { + position = "0 0"; + extent = "352 4"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiDynamicCtrlArrayControl() { + colCount = "3"; + colSize = "100"; + rowCount = "2"; + rowSize = "124"; + rowSpacing = "2"; + colSpacing = "2"; + frozen = "0"; + autoCellSize = "1"; + fillRowFirst = "1"; + dynamicSize = "1"; + padding = "0 0 0 0"; + position = "3 4"; + extent = "352 250"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "materialSelection"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiContainer() { + docking = "Bottom"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "0 448"; + extent = "354 20"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "ToolsGuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "materialPreviewControlContainer"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "242 491"; + extent = "53 19"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "SelectButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "300 491"; + extent = "52 19"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser.hideDialog();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui new file mode 100644 index 000000000..199ad91b8 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/assetImport.gui @@ -0,0 +1,613 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetImportCtrl) { + position = "0 0"; + extent = "1440 900"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(ImportAssetOptionsWindow) { + text = "Import Options"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "633 358"; + extent = "346 409"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "271 377"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetOptionsWindow.saveAssetOptions();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 26"; + extent = "326 344"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(ImportOptionsList) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "309 64"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiWindowCtrl(ImportAssetConfigEditorWindow) { + text = "Import Options Config"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "562 251"; + extent = "376 503"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Configuration Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "10 26"; + extent = "100 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(AssetImportConfigName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "113 25"; + extent = "250 18"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "301 471"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.saveAssetOptionsConfig();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 50"; + extent = "356 414"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(ImportOptionsConfigList) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "339 64"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiWindowCtrl(ImportAssetWindow) { + text = "Import Assets"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "0"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "536 205"; + extent = "368 502"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 470"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetWindow.ImportAssets();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 470"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "top"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ImportAssetModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_addModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Module"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Import Options Config:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 56"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ImportAssetConfigList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "126 53"; + extent = "175 22"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "305 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.addNewConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "New Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconInformation.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "325 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.editConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Edit Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconDelete.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "346 53"; + extent = "15 22"; + minExtent = "8 2"; + horizSizing = "left"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "ImportAssetConfigEditorWindow.deleteConfig();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Delete Config"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "dynamic"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 82"; + extent = "348 381"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiStackControl(ImportingAssetList) { + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "0"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "0"; + changeChildPosition = "1"; + position = "1 1"; + extent = "345 20"; + minExtent = "16 16"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui new file mode 100644 index 000000000..45d411f20 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editAsset.gui @@ -0,0 +1,147 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_editAsset) { + position = "0 0"; + extent = "1920 1080"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_editAssetWindow) { + text = "Asset Properties"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "1"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_editAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "710 375"; + extent = "500 329"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 21"; + extent = "498 283"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiInspector(AssetEditInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "481 101"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiInspectorProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Save"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "402 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_editAsset.saveAsset();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "450 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_editAsset);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui new file mode 100644 index 000000000..90ff639dd --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/editModule.gui @@ -0,0 +1,147 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_editModule) { + position = "0 0"; + extent = "1920 1080"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_editModuleWindow) { + text = "Module Properties"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "1"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_editModule);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "710 375"; + extent = "500 329"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOff"; + vScrollBar = "dynamic"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "1 21"; + extent = "498 283"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiInspector(ModuleEditInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "481 101"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiInspectorProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiButtonCtrl() { + text = "Save"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "402 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_editModule.saveModule();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "450 305"; + extent = "45 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_editModule);"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui new file mode 100644 index 000000000..09fcb997d --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newAsset.gui @@ -0,0 +1,237 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_newAsset) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(AssetBrowser_newAssetWindow) { + text = "Create Asset"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_newAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 140"; + extent = "368 450"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiButtonCtrl(NewAssetCreateBtn) { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "227 419"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "CreateNewAsset();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "295 419"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "AssetBrowser_newAssetWindow.onClose();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(NewAssetModuleList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl(NewAssetModuleBtn) { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_AddModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiControl(NewComponentAssetSettings) { + position = "12 120"; + extent = "344 107"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiScrollCtrl() { + willFirstRespond = "1"; + hScrollBar = "alwaysOn"; + vScrollBar = "alwaysOn"; + lockHorizScroll = "0"; + lockVertScroll = "0"; + constantThumbHeight = "0"; + childMargin = "0 0"; + mouseWheelScrollSpeed = "-1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "7 56"; + extent = "354 357"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiScrollProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiVariableInspector(NewAssetPropertiesInspector) { + dividerMargin = "5"; + showCustomFields = "1"; + stackingType = "Vertical"; + horizStacking = "Left to Right"; + vertStacking = "Top to Bottom"; + padding = "1"; + dynamicSize = "1"; + dynamicNonStackExtent = "0"; + dynamicPos = "0"; + changeChildSizeToFit = "1"; + changeChildPosition = "1"; + position = "1 1"; + extent = "337 338"; + minExtent = "16 16"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui new file mode 100644 index 000000000..65896dccc --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/newComponentAsset.gui @@ -0,0 +1,434 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_newComponentAsset) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new GuiWindowCtrl(AssetBrowser_newComponentAssetWindow) { + text = "Create Component"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(AssetBrowser_newComponentAsset);"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "328 250"; + extent = "368 268"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Target Module:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 30"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 27"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "NewComponentModuleList"; + class = "AssetBrowserModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "342 27"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "Canvas.pushDialog(AssetBrowser_AddModule);\nAssetBrowser_addModuleWindow.selectWindow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "NewComponentModuleBtn"; + class = "NewAssetModuleBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Component Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 83"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 83"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Parent Component:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 57"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrlEx(ParentComponentList) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 54"; + extent = "204 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + command = "NewAssetTypeList.onSelected();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentFriendlyName) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 109"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Friendly Name:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 109"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl(NewComponentGroup) { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 134"; + extent = "203 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Component Group:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 134"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiContainer() { + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "134 159"; + extent = "203 64"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiMLTextEditCtrl(NewComponentDescription) { + lineSpacing = "2"; + allowColorChars = "0"; + maxChars = "-1"; + useURLMouseCursor = "0"; + position = "1 0"; + extent = "201 64"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiTextEditProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTextCtrl() { + text = "Description:"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 159"; + extent = "116 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Done"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "224 240"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "createNewComponentAsset();"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "292 240"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_newComponentAsset);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui new file mode 100644 index 000000000..a1c4293ab --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/selectModule.gui @@ -0,0 +1,144 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_SelectModule) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_SelectModuleWindow) { + text = "Select Module"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "39 34"; + extent = "217 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserModuleList"; + internalName = "ModuleList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "260 32"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + class = "SelectPackage_NewAssetModuleBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_SelectModule);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_addModule);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui b/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui new file mode 100644 index 000000000..055763d35 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/guis/selectPackage.gui @@ -0,0 +1,144 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(AssetBrowser_SelectPackage) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiDefaultNonModalProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + enabled = "1"; + + new GuiWindowCtrl(AssetBrowser_SelectPackageWindow) { + text = "Select Package"; + resizeWidth = "1"; + resizeHeight = "1"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + edgeSnap = "1"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "362 334"; + extent = "299 99"; + minExtent = "48 92"; + horizSizing = "center"; + vertSizing = "center"; + profile = "ToolsGuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiPopUpMenuCtrlEx() { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + hotTrackCallback = "0"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "39 34"; + extent = "217 19"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "AssetBrowserPackageList"; + internalName = "PackageList"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiBitmapButtonCtrl() { + bitmap = "tools/gui/images/iconAdd.png"; + bitmapMode = "Centered"; + autoFitExtents = "0"; + useModifiers = "0"; + useStates = "1"; + masked = "0"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "260 32"; + extent = "22 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + class = "SelectPackage_NewAssetPackageBtn"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "88 68"; + extent = "126 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_SelectPackage);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Cancel"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "220 68"; + extent = "64 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog(AssetBrowser_addPackage);"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.cs b/Templates/BaseGame/game/tools/assetBrowser/main.cs new file mode 100644 index 000000000..32ae4682f --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/main.cs @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +if( !isObject( ToolsGuiDefaultNonModalProfile ) ) +new GuiControlProfile (ToolsGuiDefaultNonModalProfile : ToolsGuiDefaultProfile) +{ + modal = false; +}; + +function initializeAssetBrowser() +{ + echo(" % - Initializing Asset Browser"); + + exec("./guis/assetBrowser.gui"); + exec("./guis/addModuleWindow.gui"); + exec("./guis/gameObjectCreator.gui"); + exec("./guis/newAsset.gui"); + exec("./guis/newComponentAsset.gui"); + exec("./guis/editAsset.gui"); + exec("./guis/assetImport.gui"); + exec("./guis/selectModule.gui"); + exec("./guis/editModule.gui"); + + exec("./scripts/assetBrowser.cs"); + exec("./scripts/popupMenus.cs"); + exec("./scripts/addModuleWindow.cs"); + exec("./scripts/assetImport.cs"); + exec("./scripts/assetImportConfig.cs"); + exec("./scripts/gameObjectCreator.cs"); + exec("./scripts/newAsset.cs"); + exec("./scripts/editAsset.cs"); + exec("./scripts/editModule.cs"); + + exec("./scripts/fieldTypes.cs"); + + new ScriptObject( AssetBrowserPlugin ) + { + superClass = "EditorPlugin"; + }; + + Input::GetEventManager().subscribe( AssetBrowser, "BeginDropFiles" ); + Input::GetEventManager().subscribe( AssetBrowser, "DropFile" ); + Input::GetEventManager().subscribe( AssetBrowser, "EndDropFiles" ); + + AssetBrowser.buildPopupMenus(); +} + +function AssetBrowserPlugin::onWorldEditorStartup( %this ) +{ + // Add ourselves to the toolbar. + AssetBrowser.addToolbarButton(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs new file mode 100644 index 000000000..784ed7d63 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addModuleWindow.cs @@ -0,0 +1,112 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function AssetBrowser_addModuleWindow::onGainFirstResponder(%this) +{ + %this-->moduleName.setFirstResponder(); +} + +function AssetBrowser_addModuleWindow::close() +{ + Canvas.popDialog(AssetBrowser_addModule); + eval(AssetBrowser_addModuleWindow.callbackFunction); +} + +function AssetBrowser_addModuleWindow::CreateNewModule(%this) +{ + %newModuleName = %this-->moduleName.getText(); + + if(%newModuleName $= "") + return; + + echo("Creating a new Module named: " @ %newModuleName); + + %moduleFilePath = "data/" @ %newModuleName; + %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".module"; + %moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".cs"; + + %newModule = new ModuleDefinition() + { + ModuleId = %newModuleName; + versionId = 1; + ScriptFile = %newModuleName @ ".cs"; + CreateFunction="onCreate"; + DestroyFunction="onDestroy"; + Group = "Game"; + + new DeclaredAssets() + { + Extension = "asset.taml"; + Recurse = true; + }; + }; + + TAMLWrite(%newModule, %moduleDefinitionFilePath); + + //Now generate the script file for it + %file = new FileObject(); + + if(%file.openForWrite(%moduleScriptFilePath)) + { + %file.writeline("function " @ %newModuleName @ "::onCreate(%this)\n{\n\n}\n"); + %file.writeline("function " @ %newModuleName @ "::onDestroy(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //force a refresh of our modules list + ModuleDatabase.ignoreLoadedGroups(true); + ModuleDatabase.scanModules(); + %success = ModuleDatabase.loadExplicit(%newModuleName, 1); + ModuleDatabase.ignoreLoadedGroups(false); + + //force a reload of the Module lists + NewAssetModuleList.refresh(); + GameObjectModuleList.refresh(); + ImportAssetModuleList.refresh(); + + AssetBrowser.newModuleId = %newModuleName; + + Canvas.popDialog(AssetBrowser_addModule); + eval(AssetBrowser_addModuleWindow.callbackFunction); +} + +function AssetBrowserModuleList::onWake(%this) +{ + %this.refresh(); +} + +function AssetBrowserModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs new file mode 100644 index 000000000..90d999b8e --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/addPackageWindow.cs @@ -0,0 +1,110 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function AssetBrowser_addPackageWindow::onGainFirstResponder(%this) +{ + %this-->packageName.setFirstResponder(); +} + +function AssetBrowser_addPackageWindow::close() +{ + Canvas.popDialog(AssetBrowser_addPackage); + eval(AssetBrowser_addPackageWindow.callbackFunction); +} + +function AssetBrowser_addPackageWindow::CreateNewPackage(%this) +{ + %newPackageName = %this-->packageName.getText(); + + if(%newPackageName $= "") + return; + + echo("Creating a new package named: " @ %newPackageName); + + %moduleFilePath = "data/" @ %newPackageName; + %moduleDefinitionFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".module"; + %moduleScriptFilePath = %moduleFilePath @ "/" @ %newPackageName @ ".cs"; + + %newPackage = new ModuleDefinition() + { + ModuleId = %newPackageName; + versionId = 1; + ScriptFile = %newPackageName @ ".cs"; + CreateFunction="onCreate"; + DestroyFunction="onDestroy"; + Group = "Game"; + + new DeclaredAssets() + { + Extension = "asset.taml"; + Recurse = true; + }; + }; + + TAMLWrite(%newPackage, %moduleDefinitionFilePath); + + //Now generate the script file for it + %file = new FileObject(); + + if(%file.openForWrite(%moduleScriptFilePath)) + { + %file.writeline("function " @ %newPackageName @ "::onCreate(%this)\n{\n\n}\n"); + %file.writeline("function " @ %newPackageName @ "::onDestroy(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //force a refresh of our modules list + ModuleDatabase.ignoreLoadedGroups(true); + ModuleDatabase.scanModules(); + %success = ModuleDatabase.loadExplicit(%newPackageName, 1); + ModuleDatabase.ignoreLoadedGroups(false); + + //force a reload of the package lists + NewAssetPackageList.refresh(); + GameObjectPackageList.refresh(); + ImportAssetPackageList.refresh(); + + Canvas.popDialog(AssetBrowser_addPackage); + eval(AssetBrowser_addPackageWindow.callbackFunction); +} + +function AssetBrowserPackageList::onWake(%this) +{ + %this.refresh(); +} + +function AssetBrowserPackageList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs new file mode 100644 index 000000000..0979f219e --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs @@ -0,0 +1,1304 @@ + +new SimGroup(AssetBrowserPreviewCache); + +//AssetBrowser.addToolbarButton +function AssetBrowser::addToolbarButton(%this) +{ + %filename = expandFilename("tools/gui/images/iconOpen"); + %button = new GuiBitmapButtonCtrl() { + canSaveDynamicFields = "0"; + internalName = AssetBrowserBtn; + Enabled = "1"; + isContainer = "0"; + Profile = "ToolsGuiButtonProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + position = "180 0"; + Extent = "25 19"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Command = "AssetBrowser.ShowDialog();"; + tooltipprofile = "ToolsGuiToolTipProfile"; + ToolTip = "Asset Browser"; + hovertime = "750"; + bitmap = %filename; + bitmapMode = "Centered"; + buttonType = "PushButton"; + groupNum = "0"; + useMouseEvents = "0"; + }; + ToolsToolbarArray.add(%button); + EWToolsToolbar.setExtent((25 + 8) * (ToolsToolbarArray.getCount()) + 12 SPC "33"); +} +// +function AssetBrowser::onAdd(%this) +{ + %this.isReImportingAsset = false; +} + +function AssetBrowser::onWake(%this) +{ + %this.importAssetNewListArray = new ArrayObject(); + %this.importAssetUnprocessedListArray = new ArrayObject(); + %this.importAssetFinalListArray = new ArrayObject(); +} + +//Drag-Drop functionality +function AssetBrowser::selectAsset( %this, %asset ) +{ + if(AssetBrowser.selectCallback !$= "") + { + // The callback function should be ready to intake the returned material + //eval("materialEd_previewMaterial." @ %propertyField @ " = " @ %value @ ";"); + if( AssetBrowser.returnType $= "name" ) + { + eval( "" @ AssetBrowser.selectCallback @ "(" @ %name @ ");"); + } + else + { + %command = "" @ AssetBrowser.selectCallback @ "(\"" @ %asset @ "\");"; + eval(%command); + } + } + else + { + //try just setting the asset + %this.changeAsset(); + } + + Inspector.refresh(); + + AssetBrowser.hideDialog(); +} + +function AssetBrowser::showDialog( %this, %AssetTypeFilter, %selectCallback, %targetObj, %fieldName, %returnType) +{ + // Set the select callback + AssetBrowser.selectCallback = %selectCallback; + AssetBrowser.returnType = %returnType; + AssetBrowser.assetTypeFilter = %AssetTypeFilter; + AssetBrowser.fieldTargetObject = %targetObj; + AssetBrowser.fieldTargetName = %fieldName; + + Canvas.add(AssetBrowser); + AssetBrowser.setVisible(1); + AssetBrowserWindow.setVisible(1); + AssetBrowserWindow.selectWindow(); + + if(%selectCallback $= "") + { + //we're not in selection mode, so just hide the select button + %this-->SelectButton.setHidden(true); + } + else + { + %this-->SelectButton.setHidden(false); + } + + //AssetBrowser_importAssetWindow.setVisible(0); + //AssetBrowser_importAssetConfigWindow.setVisible(0); + AssetBrowser.loadFilters(); +} + +function AssetBrowser::hideDialog( %this ) +{ + AssetBrowser.setVisible(1); + AssetBrowserWindow.setVisible(1); + Canvas.popDialog(AssetBrowser_addModule); + Canvas.popDialog(ImportAssetWindow); + + Canvas.popDialog(AssetBrowser); +} + +function AssetBrowser::buildPreviewArray( %this, %asset, %moduleName ) +{ + %assetDesc = AssetDatabase.acquireAsset(%asset); + %assetName = AssetDatabase.getAssetName(%asset); + %previewImage = "core/art/warnmat"; + + AssetPreviewArray.empty(); + + // it may seem goofy why the checkbox can't be instanciated inside the container + // reason being its because we need to store the checkbox ctrl in order to make changes + // on it later in the function. + + %previewSize = "80 80"; + %previewBounds = 20; + + %assetType = AssetDatabase.getAssetType(%asset); + + %container = new GuiControl(){ + profile = "ToolsGuiDefaultProfile"; + Position = "0 0"; + Extent = %previewSize.x + %previewBounds SPC %previewSize.y + %previewBounds + 24; + HorizSizing = "right"; + VertSizing = "bottom"; + isContainer = "1"; + assetName = %assetName; + moduleName = %moduleName; + assetType = %assetType; + }; + + %tooltip = %assetName; + + if(%assetType $= "ShapeAsset") + { + %previewButton = new GuiObjectView() + { + className = "AssetPreviewControl"; + internalName = %matName; + HorizSizing = "right"; + VertSizing = "bottom"; + Profile = "ToolsGuiDefaultProfile"; + position = "7 4"; + extent = %previewSize; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + renderMissionArea = "0"; + GizmoProfile = "GlobalGizmoProfile"; + cameraZRot = "0"; + forceFOV = "0"; + gridColor = "0 0 0 0"; + renderNodes = "0"; + renderObjBox = "0"; + renderMounts = "0"; + renderColMeshes = "0"; + selectedNode = "-1"; + sunDiffuse = "255 255 255 255"; + sunAmbient = "180 180 180 255"; + timeScale = "1.0"; + fixedDetail = "0"; + orbitNode = "0"; + + new GuiBitmapButtonCtrl() + { + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "0 0"; + extent = %previewSize; + Variable = ""; + buttonType = "ToggleButton"; + bitmap = "tools/materialEditor/gui/cubemapBtnBorder"; + groupNum = "0"; + text = ""; + }; + }; + + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + + %previewButton.setModel(%asset.fileName); + //%previewButton.refreshShape(); + //%previewButton.currentDL = 0; + //%previewButton.fitToShape(); + + break; + } + } + } + else + { + if(%assetType $= "ComponentAsset") + { + %assetPath = "data/" @ %moduleName @ "/components/" @ %assetName @ ".cs"; + %doubleClickCommand = "EditorOpenFileInTorsion( "@%assetPath@", 0 );"; + + %previewImage = "tools/assetBrowser/art/componentIcon"; + + %assetFriendlyName = %assetDesc.friendlyName; + %assetDesc = %assetDesc.description; + %tooltip = %assetFriendlyName @ "\n" @ %assetDesc; + } + else if(%assetType $= "GameObjectAsset") + { + %assetPath = "data/" @ %moduleName @ "/gameObjects/" @ %assetName @ ".cs"; + %doubleClickCommand = "EditorOpenFileInTorsion( "@%assetPath@", 0 );"; + + %previewImage = "tools/assetBrowser/art/gameObjectIcon"; + + %tooltip = %assetDesc.gameObjectName; + } + else if(%assetType $= "ImageAsset") + { + //nab the image and use it for the preview + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + %previewImage = %asset.imageFile; + break; + } + } + } + else if(%assetType $= "StateMachineAsset") + { + %previewImage = "tools/assetBrowser/art/stateMachineIcon"; + } + else if(%assetType $= "SoundAsset") + { + %previewImage = "tools/assetBrowser/art/soundIcon"; + } + else if(%assetType $= "LevelAsset") + { + %previewImage = "tools/assetBrowser/art/levelIcon"; + } + else if(%assetType $= "PostEffectAsset") + { + %previewImage = "tools/assetBrowser/art/postEffectIcon"; + } + else if(%assetType $= "GUIAsset") + { + %previewImage = "tools/assetBrowser/art/guiIcon"; + } + else if(%assetType $= "ScriptAsset") + { + if(%assetDesc.isServerSide) + %previewImage = "tools/assetBrowser/art/serverScriptIcon"; + else + %previewImage = "tools/assetBrowser/art/clientScriptIcon"; + } + else if(%assetType $= "MaterialAsset") + { + %previewImage = ""; + //nab the image and use it for the preview + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + %name = AssetDatabase.getAssetName(%assetId); + + if(%name $= %assetName) + { + %asset = AssetDatabase.acquireAsset(%assetId); + %previewImage = %asset.materialDefinitionName.diffuseMap[0]; + break; + } + } + + if(%previewImage $= "") + %previewImage = "tools/assetBrowser/art/materialIcon"; + } + if(%assetType $= "ShapeAnimationAsset") + { + %previewImage = "tools/assetBrowser/art/animationIcon"; + } + + %previewButton = new GuiBitmapButtonCtrl() + { + className = "AssetPreviewControl"; + internalName = %assetName; + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "10 4"; + extent = %previewSize; + buttonType = "PushButton"; + bitmap = %previewImage; + Command = ""; + text = ""; + useStates = false; + + new GuiBitmapButtonCtrl() + { + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiButtonProfile"; + position = "0 0"; + extent = %previewSize; + Variable = ""; + buttonType = "toggleButton"; + bitmap = "tools/materialEditor/gui/cubemapBtnBorder"; + groupNum = "0"; + text = ""; + }; + }; + } + + %previewBorder = new GuiButtonCtrl(){ + class = "AssetPreviewButton"; + internalName = %assetName@"Border"; + HorizSizing = "right"; + VertSizing = "bottom"; + profile = "ToolsGuiThumbHighlightButtonProfile"; + position = "0 0"; + extent = %previewSize.x + %previewBounds SPC %previewSize.y + 24; + Variable = ""; + buttonType = "radioButton"; + tooltip = %tooltip; + Command = "AssetBrowser.updateSelection( $ThisControl.getParent().assetName, $ThisControl.getParent().moduleName );"; + altCommand = %doubleClickCommand; + groupNum = "0"; + useMouseEvents = true; + text = ""; + icon = %previewImage; + }; + + %previewNameCtrl = new GuiTextEditCtrl(){ + position = 0 SPC %previewSize.y + %previewBounds - 16; + profile = ToolsGuiTextEditCenterProfile; + extent = %previewSize.x + %previewBounds SPC 16; + text = %assetName; + originalAssetName = %assetName; //special internal field used in renaming assets + internalName = "AssetNameLabel"; + class = "AssetNameField"; + active = false; + }; + + %container.add(%previewButton); + %container.add(%previewBorder); + %container.add(%previewNameCtrl); + + // add to the gui control array + AssetBrowser-->materialSelection.add(%container); + + // add to the array object for reference later + AssetPreviewArray.add( %previewButton, %previewImage ); +} + +function AssetBrowser::loadImages( %this, %materialNum ) +{ + // this will save us from spinning our wheels in case we don't exist + /*if( !AssetBrowser.visible ) + return; + + // this schedule is here to dynamically load images + %previewButton = AssetPreviewArray.getKey(%materialNum); + %previewImage = AssetPreviewArray.getValue(%materialNum); + + if(%previewButton.getClassName() !$= "GuiObjectView") + { + %previewButton.setBitmap(%previewImage); + %previewButton.setText(""); + } + + %materialNum++; + + /*if( %materialNum < AssetPreviewArray.count() ) + { + %tempSchedule = %this.schedule(64, "loadImages", %materialNum); + MatEdScheduleArray.add( %tempSchedule, %materialNum ); + }*/ +} + +function AssetBrowser::loadFilters( %this ) +{ + AssetBrowser-->filterTree.clear(); + + AssetBrowser-->filterTree.buildIconTable(":tools/classIcons/prefab"); + + AssetBrowser-->filterTree.insertItem(0, "Assets"); + + //First, build our our list of active modules + %modulesList = ModuleDatabase.findModules(true); + + for(%i=0; %i < getWordCount(%modulesList); %i++) + { + %moduleName = getWord(%modulesList, %i).ModuleId; + + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1); + } + + //Next, go through and list the asset categories + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName $= "CoreComponentsModule") + continue; + + //first, see if this module Module is listed already + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %moduleName, "", "", 1, 1); + + %assetType = AssetDatabase.getAssetCategory(%assetId); + + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + if(%assetType $= "") + %assetType = "Misc"; + } + + if(AssetBrowser.assetTypeFilter !$= "" && AssetBrowser.assetTypeFilter !$= %assetType) + continue; + + %assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%moduleItemId, %assetType); + + if(%assetTypeId == 0) + %assetTypeId = AssetBrowser-->filterTree.insertItem(%moduleItemId, %assetType); + } + + AssetBrowser-->filterTree.buildVisibleTree(true); + + //special handling for selections + if(AssetBrowser.newModuleId !$= "") + { + AssetBrowser-->filterTree.clearSelection(); + %newModuleItem = AssetBrowser-->filterTree.findItemByName(AssetBrowser.newModuleId); + AssetBrowser-->filterTree.selectItem(%newModuleItem); + AssetBrowser.newModuleId = ""; + } + + %selectedItem = AssetBrowser-->filterTree.getSelectedItem(); + AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem); +} + +// create category and update current material if there is one +function AssetBrowser::createFilter( %this, %filter ) +{ + if( %filter $= %existingFilters ) + { + MessageBoxOK( "Error", "Can not create blank filter."); + return; + } + + for( %i = AssetBrowser.staticFilterObjects; %i < AssetBrowser-->filterArray.getCount() ; %i++ ) + { + %existingFilters = AssetBrowser-->filterArray.getObject(%i).getObject(0).filter; + if( %filter $= %existingFilters ) + { + MessageBoxOK( "Error", "Can not create two filters of the same name."); + return; + } + } + %container = new GuiControl(){ + profile = "ToolsGuiDefaultProfile"; + Position = "0 0"; + Extent = "128 18"; + HorizSizing = "right"; + VertSizing = "bottom"; + isContainer = "1"; + + new GuiCheckBoxCtrl(){ + Profile = "ToolsGuiCheckBoxListProfile"; + position = "5 1"; + Extent = "118 18"; + Command = ""; + groupNum = "0"; + buttonType = "ToggleButton"; + text = %filter @ " ( " @ MaterialFilterAllArray.countKey(%filter) @ " )"; + filter = %filter; + Command = "AssetBrowser.preloadFilter();"; + }; + }; + + AssetBrowser-->filterArray.add( %container ); + + // if selection exists, lets reselect it to refresh it + if( isObject(AssetBrowser.selectedMaterial) ) + AssetBrowser.updateSelection( AssetBrowser.selectedMaterial, AssetBrowser.selectedPreviewImagePath ); + + // material category text field to blank + AssetBrowser_addFilterWindow-->tagName.setText(""); +} + +function AssetBrowser::updateSelection( %this, %asset, %moduleName ) +{ + // the material selector will visually update per material information + // after we move away from the material. eg: if we remove a field from the material, + // the empty checkbox will still be there until you move fro and to the material again + + %isAssetBorder = 0; + eval("%isAssetBorder = isObject(AssetBrowser-->"@%asset@"Border);"); + if( %isAssetBorder ) + { + eval( "AssetBrowser-->"@%asset@"Border.setStateOn(1);"); + } + + %isAssetBorderPrevious = 0; + eval("%isAssetBorderPrevious = isObject(AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border);"); + if( %isAssetBorderPrevious ) + { + eval( "AssetBrowser-->"@%this.prevSelectedMaterialHL@"Border.setStateOn(0);"); + } + + AssetBrowser.selectedMaterial = %asset; + AssetBrowser.selectedAsset = %moduleName@":"@%asset; + AssetBrowser.selectedAssetDef = AssetDatabase.acquireAsset(AssetBrowser.selectedAsset); + //AssetBrowser.selectedPreviewImagePath = %previewImagePath; + + %this.prevSelectedMaterialHL = %asset; +} + +// +//needs to be deleted with the persistence manager and needs to be blanked out of the matmanager +//also need to update instances... i guess which is the tricky part.... +function AssetBrowser::showDeleteDialog( %this ) +{ + %material = AssetBrowser.selectedMaterial; + %secondFilter = "MaterialFilterMappedArray"; + %secondFilterName = "Mapped"; + + for( %i = 0; %i < MaterialFilterUnmappedArray.count(); %i++ ) + { + if( MaterialFilterUnmappedArray.getValue(%i) $= %material ) + { + %secondFilter = "MaterialFilterUnmappedArray"; + %secondFilterName = "Unmapped"; + break; + } + } + + if( isObject( %material ) ) + { + MessageBoxYesNoCancel("Delete Material?", + "Are you sure you want to delete

" @ %material.getName() @ "

Material deletion won't take affect until the engine is quit.", + "AssetBrowser.deleteMaterial( " @ %material @ ", " @ %secondFilter @ ", " @ %secondFilterName @" );", + "", + "" ); + } +} + +function AssetBrowser::deleteMaterial( %this, %materialName, %secondFilter, %secondFilterName ) +{ + if( !isObject( %materialName ) ) + return; + + for( %i = 0; %i <= MaterialFilterAllArray.countValue( %materialName ); %i++) + { + %index = MaterialFilterAllArray.getIndexFromValue( %materialName ); + MaterialFilterAllArray.erase( %index ); + } + MaterialFilterAllArrayCheckbox.setText("All ( " @ MaterialFilterAllArray.count() - 1 @ " ) "); + + %checkbox = %secondFilter @ "Checkbox"; + for( %k = 0; %k <= %secondFilter.countValue( %materialName ); %k++) + { + %index = %secondFilter.getIndexFromValue( %materialName ); + %secondFilter.erase( %index ); + } + %checkbox.setText( %secondFilterName @ " ( " @ %secondFilter.count() - 1 @ " ) "); + + for( %i = 0; %materialName.getFieldValue("materialTag" @ %i) !$= ""; %i++ ) + { + %materialTag = %materialName.getFieldValue("materialTag" @ %i); + + for( %j = AssetBrowser.staticFilterObjects; %j < AssetBrowser-->filterArray.getCount() ; %j++ ) + { + if( %materialTag $= AssetBrowser-->filterArray.getObject(%j).getObject(0).filter ) + { + %count = getWord( AssetBrowser-->filterArray.getObject(%j).getObject(0).getText(), 2 ); + %count--; + AssetBrowser-->filterArray.getObject(%j).getObject(0).setText( %materialTag @ " ( "@ %count @ " )"); + } + } + + } + + UnlistedMaterials.add( "unlistedMaterials", %materialName ); + + if( %materialName.getFilename() !$= "" && + %materialName.getFilename() !$= "tools/gui/AssetBrowser.ed.gui" && + %materialName.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed.cs" ) + { + AssetBrowserPerMan.removeObjectFromFile(%materialName); + AssetBrowserPerMan.saveDirty(); + } + + AssetBrowser.preloadFilter(); +} + +function AssetBrowser::thumbnailCountUpdate(%this) +{ + $Pref::AssetBrowser::ThumbnailCountIndex = AssetBrowser-->materialPreviewCountPopup.getSelected(); + AssetBrowser.LoadFilter( AssetBrowser.currentFilter, AssetBrowser.currentStaticFilter ); +} + +function AssetBrowser::toggleTagFilterPopup(%this) +{ + if(TagFilterWindow.visible) + TagFilterWindow.visible = false; + else + TagFilterWindow.visible = true; + + return; + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + //check that we don't re-add it + %moduleItemId = AssetBrowser-->filterTree.findItemByName(%moduleName); + + if(%moduleItemId == -1 || %moduleItemId == 0) + %moduleItemId = AssetBrowser-->filterTree.insertItem(1, %module.moduleId, "", "", 1, 1); + + //now, add the asset's category + %assetType = AssetDatabase.getAssetCategory(%assetId); + + %checkBox = new GuiCheckBoxCtrl() + { + canSaveDynamicFields = "0"; + isContainer = "0"; + Profile = "ToolsGuiCheckBoxListProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = (%textLength * 4) @ " 18"; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + Variable = %var; + tooltipprofile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + text = %text; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + useInactiveState = "0"; + Command = %cmd; + }; + + TagFilterList.add(%checkBox); + } +} + +function AssetBrowser::changeAsset(%this) +{ + //alright, we've selectd an asset for a field, so time to set it! + %cmd = %this.fieldTargetObject @ "." @ %this.fieldTargetName @ "=\"" @ %this.selectedAsset @ "\";"; + echo("Changing asset via the " @ %cmd @ " command"); + eval(%cmd); +} + +function AssetBrowser::reImportAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = AssetDatabase.getAssetType(EditAssetPopup.assetId); + + if(%assetType $= "ShapeAsset" || %assetType $= "ImageAsset" || %assetType $= "SoundAsset") + { + AssetBrowser.isAssetReImport = true; + AssetBrowser.reImportingAssetId = EditAssetPopup.assetId; + + AssetBrowser.onBeginDropFiles(); + AssetBrowser.onDropFile(%assetDef.originalFilePath); + AssetBrowser.onEndDropFiles(); + + %module = AssetDatabase.getAssetModule(EditAssetPopup.assetId); + + //get the selected module data + ImportAssetModuleList.setText(%module.ModuleId); + } +} + +//------------------------------------------------------------------------------ +function AssetPreviewButton::onRightClick(%this) +{ + AssetBrowser.selectedAssetPreview = %this.getParent(); + EditAssetPopup.assetId = %this.getParent().moduleName @ ":" @ %this.getParent().assetName; + %assetType = %this.getParent().assetType; + + //Do some enabling/disabling of options depending on asset type + EditAssetPopup.enableItem(0, true); + EditAssetPopup.enableItem(7, true); + + //Is it an editable type? + if(%assetType $= "ImageAsset" || %assetType $= "GameObjectAsset" || %assetType $= "SoundAsset") + { + EditAssetPopup.enableItem(0, false); + } + + //Is it an importable type? + if(%assetType $= "GameObjectAsset" || %assetType $= "ComponentAsset" || %assetType $= "GUIAsset" || %assetType $= "LevelAsset" + || %assetType $= "MaterialAsset" || %assetType $= "ParticleAsset" || %assetType $= "PostEffectAsset" || %assetType $= "ScriptAsset" + || %assetType $= "StateMachineAsset") + { + EditAssetPopup.enableItem(7, false); + } + + EditAssetPopup.showPopup(Canvas); +} + +function AssetListPanel::onRightMouseDown(%this) +{ + AddNewAssetPopup.showPopup(Canvas); +} + +//------------------------------------------------------------------------------ +function AssetBrowser::refreshPreviews(%this) +{ + AssetBrowserFilterTree.onSelect(AssetBrowser.selectedItem); +} + +function AssetBrowserFilterTree::onSelect(%this, %itemId) +{ + if(%itemId == 1) + //can't select root + return; + + //Make sure we have an actual module selected! + %parentId = %this.getParentItem(%itemId); + + if(%parentId != 1) + AssetBrowser.selectedModule = %this.getItemText(%parentId);//looks like we have one of the categories selected, not the module. Nab the parent so we have the correct thing! + else + AssetBrowser.selectedModule = %this.getItemText(%itemId); + + AssetBrowser.selectedItem = %itemId; + + //alright, we have a module or sub-filter selected, so now build our asset list based on that filter! + echo("Asset Browser Filter Tree selected filter #:" @ %itemId); + + // manage schedule array properly + if(!isObject(MatEdScheduleArray)) + new ArrayObject(MatEdScheduleArray); + + // if we select another list... delete all schedules that were created by + // previous load + for( %i = 0; %i < MatEdScheduleArray.count(); %i++ ) + cancel(MatEdScheduleArray.getKey(%i)); + + // we have to empty out the list; so when we create new schedules, these dont linger + MatEdScheduleArray.empty(); + + // manage preview array + if(!isObject(AssetPreviewArray)) + new ArrayObject(AssetPreviewArray); + + // we have to empty out the list; so when we create new guicontrols, these dont linger + AssetPreviewArray.empty(); + AssetBrowser-->materialSelection.deleteAllObjects(); + //AssetBrowser-->materialPreviewPagesStack.deleteAllObjects(); + + %assetArray = new ArrayObject(); + + //First, Query for our assets + %assetQuery = new AssetQuery(); + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + //module name per our selected filter: + %moduleItemId = %this.getParentItem(%itemId); + + //check if we've selected a Module + if(%moduleItemId == 1) + { + %FilterModuleName = %this.getItemText(%itemId); + } + else + { + %FilterModuleName = %this.getItemText(%moduleItemId); + } + + //now, we'll iterate through, and find the assets that are in this module, and this category + for( %i=0; %i < %numAssetsFound; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %moduleName = %module.moduleId; + + if(%FilterModuleName $= %moduleName) + { + //it's good, so test that the category is right! + %assetType = AssetDatabase.getAssetCategory(%assetId); + if(%assetType $= "") + { + %assetType = AssetDatabase.getAssetType(%assetId); + } + + if(%this.getItemText(%itemId) $= %assetType || (%assetType $= "" && %this.getItemText(%itemId) $= "Misc") + || %moduleItemId == 1) + { + //stop adding after previewsPerPage is hit + %assetName = AssetDatabase.getAssetName(%assetId); + + %searchText = AssetBrowserSearchFilter.getText(); + if(%searchText !$= "\c2Filter...") + { + if(strstr(strlwr(%assetName), strlwr(%searchText)) != -1) + %assetArray.add( %moduleName, %assetId); + } + else + { + //got it. + %assetArray.add( %moduleName, %assetId ); + } + } + } + } + + AssetBrowser.currentPreviewPage = 0; + AssetBrowser.totalPages = 1; + + for(%i=0; %i < %assetArray.count(); %i++) + AssetBrowser.buildPreviewArray( %assetArray.getValue(%i), %assetArray.getKey(%i) ); + + AssetBrowser.loadImages( 0 ); +} + +function AssetBrowserFilterTree::onRightMouseDown(%this, %itemId) +{ + if( %this.getSelectedItemsCount() > 0 && %itemId != 1) + { + //AddNewAssetPopup.showPopup(Canvas); + + //We have something clicked, so figure out if it's a sub-filter or a module filter, then push the correct + //popup menu + if(%this.getParentItem(%itemId) == 1) + { + //yep, module, push the all-inclusive popup + EditModulePopup.showPopup(Canvas); + //also set the module value for creation info + AssetBrowser.selectedModule = %this.getItemText(%itemId); + } + else + { + //get the parent, and thus our module + %moduleId = %this.getParentItem(%itemId); + + //set the module value for creation info + AssetBrowser.selectedModule = %this.getItemText(%moduleId); + + if(%this.getItemText(%itemId) $= "ComponentAsset") + { + AddNewComponentAssetPopup.showPopup(Canvas); + //Canvas.popDialog(AssetBrowser_newComponentAsset); + //AssetBrowser_newComponentAsset-->AssetBrowserModuleList.setText(AssetBrowser.selectedModule); + } + else + { + + } + } + } + else if( %this.getSelectedItemsCount() > 0 && %itemId == 1) + { + AddNewModulePopup.showPopup(Canvas); + } +} + +// +// +function AssetBrowserSearchFilterText::onWake( %this ) +{ + /*%filter = %this.treeView.getFilterText(); + if( %filter $= "" ) + %this.setText( "\c2Filter..." ); + else + %this.setText( %filter );*/ +} + +//------------------------------------------------------------------------------ + +function AssetBrowserSearchFilterText::onGainFirstResponder( %this ) +{ + %this.selectAllText(); +} + +//--------------------------------------------------------------------------------------------- + +// When Enter is pressed in the filter text control, pass along the text of the control +// as the treeview's filter. +function AssetBrowserSearchFilterText::onReturn( %this ) +{ + %text = %this.getText(); + if( %text $= "" ) + %this.reset(); + else + { + //%this.treeView.setFilterText( %text ); + %curItem = AssetBrowserFilterTree.getSelectedItem(); + AssetBrowserFilterTree.onSelect(%curItem); + } +} + +//--------------------------------------------------------------------------------------------- + +function AssetBrowserSearchFilterText::reset( %this ) +{ + %this.setText( "\c2Filter..." ); + //%this.treeView.clearFilterText(); + %curItem = AssetBrowserFilterTree.getSelectedItem(); + AssetBrowserFilterTree.onSelect(%curItem); +} + +//--------------------------------------------------------------------------------------------- + +function AssetBrowserSearchFilterText::onClick( %this ) +{ + %this.textCtrl.reset(); +} + +// +// +// +function AssetBrowser::reloadModules(%this) +{ + ModuleDatabase.unloadGroup("Game"); + + %modulesList = ModuleDatabase.findModules(); + + %count = getWordCount(%modulesList); + + for(%i=0; %i < %count; %i++) + { + %moduleId = getWord(%modulesList, %i).ModuleId; + ModuleDatabase.unloadExplicit(%moduleId); + } + + ModuleDatabase.scanModules(); + + %modulesList = ModuleDatabase.findModules(); + + %count = getWordCount(%modulesList); + + for(%i=0; %i < %count; %i++) + { + %moduleId = getWord(%modulesList, %i).ModuleId; + ModuleDatabase.loadExplicit(%moduleId); + } + + //ModuleDatabase.loadGroup("Game"); +} +// + +function AssetPreviewButton::onMouseDragged(%this) +{ + %payload = new GuiBitmapButtonCtrl(); + %payload.assignFieldsFrom( %this ); + %payload.className = "AssetPreviewControl"; + %payload.position = "0 0"; + %payload.dragSourceControl = %this; + %payload.bitmap = %this.icon; + %payload.extent.x /= 2; + %payload.extent.y /= 2; + + %xOffset = getWord( %payload.extent, 0 ) / 2; + %yOffset = getWord( %payload.extent, 1 ) / 2; + + // Compute the initial position of the GuiDragAndDrop control on the cavas based on the current + // mouse cursor position. + + %cursorpos = Canvas.getCursorPos(); + %xPos = getWord( %cursorpos, 0 ) - %xOffset; + %yPos = getWord( %cursorpos, 1 ) - %yOffset; + + if(!isObject(EditorDragAndDropLayer)) + { + new GuiControl(EditorDragAndDropLayer) + { + position = "0 0"; + extent = Canvas.extent; + }; + } + + // Create the drag control. + %ctrl = new GuiDragAndDropControl() + { + canSaveDynamicFields = "0"; + Profile = "GuiSolidDefaultProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %xPos SPC %yPos; + extent = %payload.extent; + MinExtent = "4 4"; + canSave = "1"; + Visible = "1"; + hovertime = "1000"; + + // Let the GuiDragAndDropControl delete itself on mouse-up. When the drag is aborted, + // this not only deletes the drag control but also our payload. + deleteOnMouseUp = true; + + useWholeCanvas = true; + + // To differentiate drags, use the namespace hierarchy to classify them. + // This will allow a color swatch drag to tell itself apart from a file drag, for example. + class = "AssetPreviewControlType_AssetDrop"; + }; + + // Add the temporary color swatch to the drag control as the payload. + %ctrl.add( %payload ); + + // Start drag by adding the drag control to the canvas and then calling startDragging(). + //Canvas.getContent().add( %ctrl ); + EditorDragAndDropLayer.add(%ctrl); + Canvas.pushDialog(EditorDragAndDropLayer); + + %ctrl.startDragging( %xOffset, %yOffset ); +} + +function AssetPreviewButton::onControlDragCancelled(%this) +{ + Canvas.popDialog(EditorDragAndDropLayer); +} + +function AssetPreviewButton::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + // If dropped on same button whence we came from, + // do nothing. + + if( %payload.dragSourceControl == %this ) + return; + + // If a swatch button control is dropped onto this control, + // copy it's color. + + if( %payload.isMemberOfClass( "AssetPreviewButton" ) ) + { + // If the swatch button is part of a color-type inspector field, + // remember the inspector field so we can later set the color + // through it. + + if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorI" ) ) + %this.parentGroup.apply( ColorFloatToInt( %payload.color ) ); + else if( %this.parentGroup.isMemberOfClass( "GuiInspectorTypeColorF" ) ) + %this.parentGroup.apply( %payload.color ); + else + %this.setColor( %payload.color ); + } +} + +function EWorldEditor::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + // If dropped on same button whence we came from, + // do nothing. + + if( %payload.dragSourceControl == %this ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + %pos = EWCreatorWindow.getCreateObjectPosition(); //LocalClientConnection.camera.position; + %module = %payload.dragSourceControl.parentGroup.moduleName; + %asset = %payload.dragSourceControl.parentGroup.assetName; + + if(%assetType $= "ImageAsset") + { + echo("DROPPED AN IMAGE ON THE EDITOR WINDOW!"); + } + else if(%assetType $= "ShapeAsset") + { + echo("DROPPED A SHAPE ON THE EDITOR WINDOW!"); + + %newEntity = new Entity() + { + position = %pos; + + new MeshComponent() + { + MeshAsset = %module @ ":" @ %asset; + }; + + //new CollisionComponent(){}; + }; + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + else if(%assetType $= "MaterialAsset") + { + echo("DROPPED A MATERIAL ON THE EDITOR WINDOW!"); + } + else if(%assetType $= "GameObjectAsset") + { + echo("DROPPED A GAME OBJECT ON THE EDITOR WINDOW!"); + + %GO = spawnGameObject(%asset, true); + + %pos = EWCreatorWindow.getCreateObjectPosition(); //LocalClientConnection.camera.position; + + %GO.position = %pos; + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%GO); + } + else if(%assetType $= "ComponentAsset") + { + %newEntity = new Entity() + { + position = %pos; + }; + + %assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset); + + if(%assetDef.componentClass $= "Component") + eval("$tmpVar = new " @ %assetDef.componentClass @ "() { class = " @ %assetDef.componentName @ "; }; %newEntity.add($tmpVar);"); + else + eval("$tmpVar = new " @ %assetDef.componentClass @ "() {}; %newEntity.add($tmpVar);"); + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + else if(%assetType $= "ScriptAsset") //do we want to do it this way? + { + %newEntity = new Entity() + { + position = %pos; + class = %asset; + }; + + MissionGroup.add(%newEntity); + + EWorldEditor.clearSelection(); + EWorldEditor.selectObject(%newEntity); + } + + EWorldEditor.isDirty = true; +} + +function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "ShapeAsset") + { + echo("DROPPED A SHAPE ON A SHAPE ASSET COMPONENT FIELD!"); + + %module = %payload.dragSourceControl.parentGroup.moduleName; + %asset = %payload.dragSourceControl.parentGroup.assetName; + + %targetComponent = %this.ComponentOwner; + %targetComponent.MeshAsset = %module @ ":" @ %asset; + + //Inspector.refresh(); + } + + EWorldEditor.isDirty= true; +} + +function GuiInspectorTypeImageAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "ImageAsset") + { + echo("DROPPED A IMAGE ON AN IMAGE ASSET COMPONENT FIELD!"); + } + + EWorldEditor.isDirty = true; +} + +function GuiInspectorTypeMaterialAssetPtr::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + // Make sure this is a color swatch drag operation. + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + + if(%assetType $= "MaterialAsset") + { + echo("DROPPED A MATERIAL ON A MATERIAL ASSET COMPONENT FIELD!"); + } + + EWorldEditor.isDirty = true; +} + +function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position ) +{ + Canvas.popDialog(EditorDragAndDropLayer); + + if( !%payload.parentGroup.isInNamespaceHierarchy( "AssetPreviewControlType_AssetDrop" ) ) + return; + + %assetType = %payload.dragSourceControl.parentGroup.assetType; + %assetName = %payload.dragSourceControl.parentGroup.assetName; + %moduleName = %payload.dragSourceControl.parentGroup.moduleName; + + echo("DROPPED A " @ %assetType @ " ON THE ASSET BROWSER NAVIGATION TREE!"); + + %item = %this.getItemAtPosition(%position); + + echo("DROPPED IT ON ITEM " @ %item); + + %parent = %this.getParentItem(%item); + + if(%parent == 1) + { + //we're a module entry, cool + %targetModuleName = %this.getItemText(%item); + echo("DROPPED IT ON MODULE " @ %targetModuleName); + + if(%moduleName !$= %targetModuleName) + { + //we're trying to move the asset to a different module! + MessageBoxYesNo( "Move Asset", "Do you wish to move asset " @ %assetName @ " to module " @ %targetModuleName @ "?", + "AssetBrowser.moveAsset("@%assetName@", "@%targetModuleName@");", ""); + } + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs new file mode 100644 index 000000000..8732ac8a5 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImport.cs @@ -0,0 +1,1525 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// +// +function isImageFormat(%fileExt) +{ + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") || (%fileExt $= ".tif")) + return true; + + return false; +} + +function isShapeFormat(%fileExt) +{ + if( (%fileExt $= ".dae") || (%fileExt $= ".dts") || (%fileExt $= ".fbx") || (%fileExt $= ".obj") || (%fileExt $= ".blend")) + return true; + + return false; +} + +function isSoundFormat(%fileExt) +{ + if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + return true; + + return false; +} + +function getImageInfo(%file) +{ + //we're going to populate a GuiTreeCtrl with info of the inbound image file +} + +//This lets us go and look for a image at the importing directory as long as it matches the material name +function findImageFile(%path, %materialName, %type) +{ + + if(isFile(%path @ "/" @ %materialName @ ".jpg")) + return %path @ "/" @ %materialName @ ".jpg"; + else if(isFile(%path @ "/" @ %materialName @ ".png")) + return %path @ "/" @ %materialName @ ".png"; + else if(isFile(%path @ "/" @ %materialName @ ".dds")) + return %path @ "/" @ %materialName @ ".dds"; + else if(isFile(%path @ "/" @ %materialName @ ".tif")) + return %path @ "/" @ %materialName @ ".tif"; +} + +function AssetBrowser::onBeginDropFiles( %this ) +{ + error("% DragDrop - Beginning files dropping."); + %this.importAssetNewListArray.empty(); + %this.importAssetUnprocessedListArray.empty(); + %this.importAssetFinalListArray.empty(); +} + +function AssetBrowser::onDropFile( %this, %filePath ) +{ + if(!%this.isVisible()) + return; + + %fileExt = fileExt( %filePath ); + //add it to our array! + if(isImageFormat(%fileExt)) + %this.addImportingAsset("Image", %filePath); + else if( isShapeFormat(%fileExt)) + %this.addImportingAsset("Model", %filePath); + else if( isSoundFormat(%fileExt)) + %this.addImportingAsset("Sound", %filePath); + else if (%fileExt $= ".zip") + %this.onDropZipFile(%filePath); +} + +function AssetBrowser::onDropZipFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + %zip = new ZipObject(); + %zip.openArchive(%filePath); + %count = %zip.getFileEntryCount(); + + echo("Dropped in a zip file with" SPC %count SPC "files inside!"); + + return; + for (%i = 0; %i < %count; %i++) + { + %fileEntry = %zip.getFileEntry(%i); + %fileFrom = getField(%fileEntry, 0); + + //First, we wanna scan to see if we have modules to contend with. If we do, we'll just plunk them in wholesale + //and not process their contents. + + //If not modules, it's likely an art pack or other mixed files, so we'll import them as normal + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") ) + %this.importAssetListArray.add("Image", %filePath); + else if( (%fileExt $= ".dae") || (%fileExt $= ".dts")) + %this.importAssetListArray.add("Model", %filePath); + else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + %this.importAssetListArray.add("Sound", %filePath); + else if( (%fileExt $= ".gui") || (%fileExt $= ".gui.dso")) + %this.importAssetListArray.add("GUI", %filePath); + //else if( (%fileExt $= ".cs") || (%fileExt $= ".dso")) + // %this.importAssetListArray.add("Script", %filePath); + else if( (%fileExt $= ".mis")) + %this.importAssetListArray.add("Level", %filePath); + + // For now, if it's a .cs file, we'll assume it's a behavior. + if (fileExt(%fileFrom) !$= ".cs") + continue; + + %fileTo = expandFilename("^game/behaviors/") @ fileName(%fileFrom); + %zip.extractFile(%fileFrom, %fileTo); + exec(%fileTo); + } +} + +function AssetBrowser::onDropImageFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + // File Information madness + %fileName = %filePath; + %fileOnlyName = fileName( %fileName ); + %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); + + // [neo, 5/17/2007 - #3117] + // Check if the file being dropped is already in data/images or a sub dir by checking if + // the file path up to length of check path is the same as check path. + %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); + + %checkPath = expandFilename( "^"@%defaultPath ); + %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); + %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); + + if( %checkPath !$= %fileBasePath ) + { + // No match so file is from outside images directory and we need to copy it in + %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + + // Move to final location + if( !pathCopy( %filePath, %fileNewLocation ) ) + return; + } + else + { + // Already in images path somewhere so just link to it + %fileNewLocation = %filePath; + } + + addResPath( filePath( %fileNewLocation ) ); + + %matName = fileBase( %fileName ); + + // Create Material + %imap = new Material(%matName) + { + mapTo = fileBase( %matName ); + diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + }; + //%imap.setName( %fileBase ); + //%imap.imageName = %fileNewLocation; + //%imap.imageMode = "FULL"; + //%imap.filterPad = false; + //%imap.compile(); + + %diffusecheck = %imap.diffuseMap[0]; + + // Bad Creation! + if( !isObject( %imap ) ) + return; + + %this.addDatablock( %fileBase, false ); +} + +function AssetBrowser::onDropSoundFile(%this, %filePath) +{ + if(!%this.isVisible()) + return; + + // File Information madness + %fileName = %filePath; + %fileOnlyName = fileName( %fileName ); + %fileBase = validateDatablockName(fileBase( %fileName ) @ "ImageMap"); + + // [neo, 5/17/2007 - #3117] + // Check if the file being dropped is already in data/images or a sub dir by checking if + // the file path up to length of check path is the same as check path. + %defaultPath = EditorSettings.value( "WorldEditor/defaultMaterialsPath" ); + + %checkPath = expandFilename( "^"@%defaultPath ); + %fileOnlyPath = expandFileName( %filePath ); //filePath( expandFileName( %filePath ) ); + %fileBasePath = getSubStr( %fileOnlyPath, 0, strlen( %checkPath ) ); + + if( %checkPath !$= %fileBasePath ) + { + // No match so file is from outside images directory and we need to copy it in + %fileNewLocation = expandFilename("^"@%defaultPath) @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + + // Move to final location + if( !pathCopy( %filePath, %fileNewLocation ) ) + return; + } + else + { + // Already in images path somewhere so just link to it + %fileNewLocation = %filePath; + } + + addResPath( filePath( %fileNewLocation ) ); + + %matName = fileBase( %fileName ); + + // Create Material + %imap = new Material(%matName) + { + mapTo = fileBase( %matName ); + diffuseMap[0] = %defaultPath @ "/" @ fileBase( %fileName ) @ fileExt( %fileName ); + }; + //%imap.setName( %fileBase ); + //%imap.imageName = %fileNewLocation; + //%imap.imageMode = "FULL"; + //%imap.filterPad = false; + //%imap.compile(); + + %diffusecheck = %imap.diffuseMap[0]; + + // Bad Creation! + if( !isObject( %imap ) ) + return; + + %this.addDatablock( %fileBase, false ); +} + +function AssetBrowser::onEndDropFiles( %this ) +{ + if(!%this.isVisible()) + return; + + //we have assets to import, so go ahead and display the window for that now + Canvas.pushDialog(AssetImportCtrl); + ImportAssetWindow.visible = true; + //ImportAssetWindow.validateAssets(); + ImportAssetWindow.refresh(); + ImportAssetWindow.selectWindow(); + + // Update object library + GuiFormManager::SendContentMessage($LBCreateSiderBar, %this, "refreshAll 1"); + + if(ImportAssetWindow.importConfigsList.count() == 0) + { + MessageBoxOK( "Warning", "No base import config. Please create an import configuration set to simplify asset importing."); + } +} +// +// +// + +function AssetBrowser::addImportingAsset( %this, %assetType, %filePath, %parentAssetItem ) +{ + %assetName = fileBase(%filePath); + %filePath = filePath(%filePath) @ "/" @ fileBase(%filePath) @ fileExt(%filePath); //sanitize the file path + + %moduleName = AssetBrowser.SelectedModule; + ImportAssetModuleList.text = %moduleName; + + //Add to our main list + %assetItem = new ScriptObject() + { + assetType = %assetType; + filePath = %filePath; + assetName = %assetName; + moduleName = %moduleName; + dirty = true; + parentAssetItem = %parentAssetItem; + status = ""; + statusType = ""; + statusInfo = ""; + skip = false; + }; + + //little bit of interception here + if(%assetItem.assetType $= "Model") + { + %fileExt = fileExt(%assetItem.filePath); + if(%fileExt $= ".dae") + { + %shapeInfo = new GuiTreeViewCtrl(); + enumColladaForImport(%assetItem.filePath, %shapeInfo); + } + else + { + %shapeInfo = GetShapeInfo(%assetItem.filePath); + } + + %assetItem.shapeInfo = %shapeInfo; + + %shapeItem = %assetItem.shapeInfo.findItemByName("Shape"); + %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem); + + %animItem = %assetItem.shapeInfo.findItemByName("Animations"); + %animCount = %assetItem.shapeInfo.getItemValue(%animItem); + + //If the model has shapes AND animations, then it's a normal shape with embedded animations + //if it has shapes and no animations it's a regular static mesh + //if it has no shapes and animations, it's a special case. This means it's a shape animation only file so it gets flagged as special + if(%shapeCount == 0 && %animCount != 0) + { + %assetItem.assetType = "Animation"; + } + else if(%shapeCount == 0 && %animCount == 0) + { + //either it imported wrong or it's a bad file we can't read. Either way, don't try importing it + error("Error - attempted to import a model file with no shapes or animations! Model in question was: " @ %filePath); + + %assetItem.delete(); + return 0; + } + } + + if(%parentAssetItem $= "") + { + %assetItem.parentDepth = 0; + %this.importAssetNewListArray.add(%assetItem); + %this.importAssetUnprocessedListArray.add(%assetItem); + } + else + { + %assetItem.parentDepth = %parentAssetItem.parentDepth + 1; + %parentIndex = %this.importAssetUnprocessedListArray.getIndexFromKey(%parentAssetItem); + + %parentAssetItem.dependencies = %parentAssetItem.dependencies SPC %assetItem; + trim(%parentAssetItem.dependencies); + + %this.importAssetUnprocessedListArray.insert(%assetItem, "", %parentIndex + 1); + } + + return %assetItem; +} + +// +function ImportAssetButton::onClick(%this) +{ + %dlg = new OpenFileDialog() + { + Filters = "Shape Files(*.dae, *.cached.dts)|*.dae;*.cached.dts|Images Files(*.jpg,*.png,*.tga,*.bmp,*.dds)|*.jpg;*.png;*.tga;*.bmp;*.dds|Any Files (*.*)|*.*|"; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = false; + OverwritePrompt = true; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = makeRelativePath( %dlg.FileName, getMainDotCSDir() ); + %file = fileBase( %fullPath ); + } + + %dlg.delete(); + + if ( !%ret ) + return; + + AssetBrowser.importAssetListArray.empty(); + + %fileExt = fileExt( %fullPath ); + //add it to our array! + if( (%fileExt $= ".png") || (%fileExt $= ".jpg") || (%fileExt $= ".bmp") || (%fileExt $= ".dds") ) + AssetBrowser.importAssetListArray.add("Image", %fullPath); + else if( (%fileExt $= ".dae") || (%fileExt $= ".dts")) + AssetBrowser.importAssetListArray.add("Model", %fullPath); + else if( (%fileExt $= ".ogg") || (%fileExt $= ".wav") || (%fileExt $= ".mp3")) + AssetBrowser.importAssetListArray.add("Sound", %fullPath); + else if (%fileExt $= ".zip") + AssetBrowser.onDropZipFile(%fullPath); + + ImportAssetConfigWindow.visible = true; + ImportAssetConfigWindow.refresh(); + ImportAssetConfigWindow.selectWindow(); +} +// + +// +function ImportAssetWindow::onWake(%this) +{ + //We've woken, meaning we're trying to import assets + //Lets refresh our list + if(!ImportAssetWindow.isVisible()) + return; + + $AssetBrowser::importConfigsFile = "tools/assetBrowser/assetImportConfigs.xml"; + + %this.reloadImportOptionConfigs(); +} + +function ImportAssetWindow::reloadImportOptionConfigs(%this) +{ + ImportAssetWindow.importConfigsList = new ArrayObject(); + ImportAssetConfigList.clear(); + + %xmlDoc = new SimXMLDocument(); + if(%xmlDoc.loadFile($AssetBrowser::importConfigsFile)) + { + //StateMachine element + %xmlDoc.pushFirstChildElement("AssetImportConfigs"); + + //Configs + %configCount = 0; + while(%xmlDoc.pushChildElement(%configCount)) + { + %configObj = new ScriptObject(){}; + + %configObj.Name = %xmlDoc.attribute("Name"); + + %xmlDoc.pushFirstChildElement("Mesh"); + %configObj.ImportMesh = %xmlDoc.attribute("ImportMesh"); + %configObj.DoUpAxisOverride = %xmlDoc.attribute("DoUpAxisOverride"); + %configObj.UpAxisOverride = %xmlDoc.attribute("UpAxisOverride"); + %configObj.DoScaleOverride = %xmlDoc.attribute("DoScaleOverride"); + %configObj.ScaleOverride = %xmlDoc.attribute("ScaleOverride"); + %configObj.IgnoreNodeScale = %xmlDoc.attribute("IgnoreNodeScale"); + %configObj.AdjustCenter = %xmlDoc.attribute("AdjustCenter"); + %configObj.AdjustFloor = %xmlDoc.attribute("AdjustFloor"); + %configObj.CollapseSubmeshes = %xmlDoc.attribute("CollapseSubmeshes"); + %configObj.LODType = %xmlDoc.attribute("LODType"); + %configObj.ImportedNodes = %xmlDoc.attribute("ImportedNodes"); + %configObj.IgnoreNodes = %xmlDoc.attribute("IgnoreNodes"); + %configObj.ImportMeshes = %xmlDoc.attribute("ImportMeshes"); + %configObj.IgnoreMeshes = %xmlDoc.attribute("IgnoreMeshes"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Materials"); + %configObj.ImportMaterials = %xmlDoc.attribute("ImportMaterials"); + %configObj.CreateComposites = %xmlDoc.attribute("CreateComposites"); + %configObj.UseDiffuseSuffixOnOriginImg = %xmlDoc.attribute("UseDiffuseSuffixOnOriginImg"); + %configObj.UseExistingMaterials = %xmlDoc.attribute("UseExistingMaterials"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Animations"); + %configObj.ImportAnimations = %xmlDoc.attribute("ImportAnimations"); + %configObj.SeparateAnimations = %xmlDoc.attribute("SeparateAnimations"); + %configObj.SeparateAnimationPrefix = %xmlDoc.attribute("SeparateAnimationPrefix"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Collisions"); + %configObj.GenerateCollisions = %xmlDoc.attribute("GenerateCollisions"); + %configObj.GenCollisionType = %xmlDoc.attribute("GenCollisionType"); + %configObj.CollisionMeshPrefix = %xmlDoc.attribute("CollisionMeshPrefix"); + %configObj.GenerateLOSCollisions = %xmlDoc.attribute("GenerateLOSCollisions"); + %configObj.GenLOSCollisionType = %xmlDoc.attribute("GenLOSCollisionType"); + %configObj.LOSCollisionMeshPrefix = %xmlDoc.attribute("LOSCollisionMeshPrefix"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Images"); + %configObj.ImageType = %xmlDoc.attribute("ImageType"); + %configObj.DiffuseTypeSuffixes = %xmlDoc.attribute("DiffuseTypeSuffixes"); + %configObj.NormalTypeSuffixes = %xmlDoc.attribute("NormalTypeSuffixes"); + %configObj.SpecularTypeSuffixes = %xmlDoc.attribute("SpecularTypeSuffixes"); + %configObj.MetalnessTypeSuffixes = %xmlDoc.attribute("MetalnessTypeSuffixes"); + %configObj.RoughnessTypeSuffixes = %xmlDoc.attribute("RoughnessTypeSuffixes"); + %configObj.SmoothnessTypeSuffixes = %xmlDoc.attribute("SmoothnessTypeSuffixes"); + %configObj.AOTypeSuffixes = %xmlDoc.attribute("AOTypeSuffixes"); + %configObj.CompositeTypeSuffixes = %xmlDoc.attribute("CompositeTypeSuffixes"); + %configObj.TextureFilteringMode = %xmlDoc.attribute("TextureFilteringMode"); + %configObj.UseMips = %xmlDoc.attribute("UseMips"); + %configObj.IsHDR = %xmlDoc.attribute("IsHDR"); + %configObj.Scaling = %xmlDoc.attribute("Scaling"); + %configObj.Compressed = %xmlDoc.attribute("Compressed"); + %configObj.GenerateMaterialOnImport = %xmlDoc.attribute("GenerateMaterialOnImport"); + %configObj.PopulateMaterialMaps = %xmlDoc.attribute("PopulateMaterialMaps"); + %xmlDoc.popElement(); + + %xmlDoc.pushFirstChildElement("Sounds"); + %configObj.VolumeAdjust = %xmlDoc.attribute("VolumeAdjust"); + %configObj.PitchAdjust = %xmlDoc.attribute("PitchAdjust"); + %configObj.Compressed = %xmlDoc.attribute("Compressed"); + %xmlDoc.popElement(); + + %xmlDoc.popElement(); + %configCount++; + + ImportAssetWindow.importConfigsList.add(%configObj); + } + + %xmlDoc.popElement(); + } + + for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++) + { + %configObj = ImportAssetWindow.importConfigsList.getKey(%i); + ImportAssetConfigList.add(%configObj.Name); + } + + ImportAssetConfigList.setSelected(0); +} + +function ImportAssetWindow::setImportOptions(%this, %optionsObj) +{ + //Todo, editor + load from files for preconfigs + + //Meshes + %optionsObj.ImportMesh = true; + %optionsObj.UpAxisOverride = "Z_AXIS"; + %optionsObj.OverrideScale = 1.0; + %optionsObj.IgnoreNodeScale = false; + %optionsObj.AdjustCenter = false; + %optionsObj.AdjustFloor = false; + %optionsObj.CollapseSubmeshes = false; + %optionsObj.LODType = "TrailingNumber"; + %optionsObj.TrailingNumber = 2; + %optionsObj.ImportedNodes = ""; + %optionsObj.IgnoreNodes = ""; + %optionsObj.ImportMeshes = ""; + %optionsObj.IgnoreMeshes = ""; + + //Materials + %optionsObj.ImportMaterials = true; + %optionsObj.CreateComposites = true; + + //Animations + %optionsObj.ImportAnimations = true; + %optionsObj.SeparateAnimations = true; + %optionsObj.SeparateAnimationPrefix = ""; + + //Collision + %optionsObj.GenerateCollisions = true; + %optionsObj.GenCollisionType = "CollisionMesh"; + %optionsObj.CollisionMeshPrefix = "Collision"; + %optionsObj.GenerateLOSCollisions = true; + %optionsObj.GenLOSCollisionType = "CollisionMesh"; + %optionsObj.LOSCollisionMeshPrefix = "LOS"; + + //Images + %optionsObj.ImageType = "Diffuse"; + %optionsObj.DiffuseTypeSuffixes = "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL"; + %optionsObj.NormalTypeSuffixes = "_NORMAL,_NORM"; + %optionsObj.SpecularTypeSuffixes = "_SPECULAR,_SPEC"; + %optionsObj.MetalnessTypeSuffixes = "_METAL,_MET,_METALNESS,_METALLIC"; + %optionsObj.RoughnessTypeSuffixes = "_ROUGH,_ROUGHNESS"; + %optionsObj.SmoothnessTypeSuffixes = "_SMOOTH,_SMOOTHNESS"; + %optionsObj.AOTypeSuffixes = "_AO,_AMBIENT,_AMBIENTOCCLUSION"; + %optionsObj.CompositeTypeSuffixes = "_COMP,_COMPOSITE"; + %optionsObj.TextureFilteringMode = "Bilinear"; + %optionsObj.UseMips = true; + %optionsObj.IsHDR = false; + %optionsObj.Scaling = 1.0; + %optionsObj.Compressed = true; + + //Sounds + %optionsObj.VolumeAdjust = 1.0; + %optionsObj.PitchAdjust = 1.0; + %optionsObj.Compressed = false; +} + +// +function ImportAssetWindow::processNewImportAssets(%this) +{ + %unprocessedCount = AssetBrowser.importAssetUnprocessedListArray.count(); + while(AssetBrowser.importAssetUnprocessedListArray.count() > 0) + { + %assetItem = AssetBrowser.importAssetUnprocessedListArray.getKey(0); + + %assetConfigObj = ImportAssetWindow.activeImportConfig.clone(); + %assetConfigObj.assetIndex = %i; + %assetConfigObj.assetName = %assetItem.assetName; + %assetItem.importConfig = %assetConfigObj; + + if(%assetItem.assetType $= "Model") + { + %fileExt = fileExt(%assetItem.filePath); + if(%fileExt $= ".dae") + { + %shapeInfo = new GuiTreeViewCtrl(); + enumColladaForImport(%assetItem.filePath, %shapeInfo); + } + else + { + %shapeInfo = GetShapeInfo(%assetItem.filePath); + } + + %assetItem.shapeInfo = %shapeInfo; + + %shapeItem = %assetItem.shapeInfo.findItemByName("Shape"); + %shapeCount = %assetItem.shapeInfo.getItemValue(%shapeItem); + + if(%assetConfigObj.ImportMesh == 1 && %shapeCount > 0) + { + + } + + %animItem = %assetItem.shapeInfo.findItemByName("Animations"); + %animCount = %assetItem.shapeInfo.getItemValue(%animItem); + + if(%assetConfigObj.ImportAnimations == 1 && %animCount > 0) + { + %animationItem = %assetItem.shapeInfo.getChild(%animItem); + + %animName = %assetItem.shapeInfo.getItemText(%animationItem); + //%animName = %assetItem.shapeInfo.getItemValue(%animationItem); + + AssetBrowser.addImportingAsset("Animation", %animName, %assetItem); + + %animationItem = %assetItem.shapeInfo.getNextSibling(%animationItem); + while(%animationItem != 0) + { + %animName = %assetItem.shapeInfo.getItemText(%animationItem); + //%animName = %assetItem.shapeInfo.getItemValue(%animationItem); + + AssetBrowser.addImportingAsset("Animation", %animName, %assetItem); + + %animationItem = %shapeInfo.getNextSibling(%animationItem); + } + } + + %matItem = %assetItem.shapeInfo.findItemByName("Materials"); + %matCount = %assetItem.shapeInfo.getItemValue(%matItem); + + if(%assetConfigObj.importMaterials == 1 && %matCount > 0) + { + %materialItem = %assetItem.shapeInfo.getChild(%matItem); + + %matName = %assetItem.shapeInfo.getItemText(%materialItem); + + %filePath = %assetItem.shapeInfo.getItemValue(%materialItem); + if(%filePath !$= "") + { + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + } + else + { + //we need to try and find our material, since the shapeInfo wasn't able to find it automatically + %filePath = findImageFile(filePath(%assetItem.filePath), %matName); + if(%filePath !$= "") + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + else + AssetBrowser.addImportingAsset("Material", %matName, %assetItem); + } + + %materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem); + while(%materialItem != 0) + { + %matName = %assetItem.shapeInfo.getItemText(%materialItem); + %filePath = %assetItem.shapeInfo.getItemValue(%materialItem); + if(%filePath !$= "") + { + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + } + else + { + //we need to try and find our material, since the shapeInfo wasn't able to find it automatically + %filePath = findImageFile(filePath(%assetItem.filePath), %matName); + if(%filePath !$= "") + AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + else + AssetBrowser.addImportingAsset("Material", %matName, %assetItem); + } + + %materialItem = %shapeInfo.getNextSibling(%materialItem); + } + } + } + else if(%assetItem.assetType $= "Animation") + { + //if we don't have our own file, that means we're gunna be using our parent shape's file so reference that + if(!isFile(%assetItem.filePath)) + { + %assetItem.filePath = %assetItem.parentAssetItem.filePath; + } + } + else if(%assetItem.assetType $= "Material") + { + //Iterate over to find appropriate images for + + //Fetch just the fileBase name + %fileDir = filePath(%assetItem.filePath); + %filename = fileBase(%assetItem.filePath); + %fileExt = fileExt(%assetItem.filePath); + + if(%assetItem.importConfig.PopulateMaterialMaps == 1) + { + if(%assetItem.diffuseImageAsset $= "") + { + //First, load our diffuse map, as set to the material in the shape + %diffuseAsset = AssetBrowser.addImportingAsset("Image", %fileDir @ "/" @ %filename @ %fileExt, %assetItem); + %assetItem.diffuseImageAsset = %diffuseAsset; + + if(%assetItem.importConfig.UseDiffuseSuffixOnOriginImg == 1) + { + %diffuseToken = getToken(%assetItem.importConfig.DiffuseTypeSuffixes, ",", 0); + %diffuseAsset.AssetName = %diffuseAsset.AssetName @ %diffuseToken; + } + } + + if(%assetItem.normalImageAsset $= "") + { + //Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any. + //First, normal map + %listCount = getTokenCount(%assetItem.importConfig.NormalTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.NormalTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.normalImageAsset = %normalAsset; + break; + } + } + } + if(%assetItem.specularImageAsset $= "") + { + //Specular + %listCount = getTokenCount(%assetItem.importConfig.SpecularTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.SpecularTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %specularAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.specularImageAsset = %specularAsset; + break; + } + } + } + + if(%assetItem.metalImageAsset $= "") + { + //Metal + %listCount = getTokenCount(%assetItem.importConfig.MetalnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.MetalnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.metalImageAsset = %metalAsset; + break; + } + } + } + + if(%assetItem.roughnessImageAsset $= "") + { + //Roughness + %listCount = getTokenCount(%assetItem.importConfig.RoughnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.RoughnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.roughnessImageAsset = %roughnessAsset; + break; + } + } + } + + if(%assetItem.smoothnessImageAsset $= "") + { + //Smoothness + %listCount = getTokenCount(%assetItem.importConfig.SmoothnessTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.SmoothnessTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.SmoothnessImageAsset = %smoothnessAsset; + break; + } + } + } + + if(%assetItem.AOImageAsset $= "") + { + //AO + %listCount = getTokenCount(%assetItem.importConfig.AOTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.AOTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.AOImageAsset = %AOAsset; + break; + } + } + } + + if(%assetItem.compositeImageAsset $= "") + { + //Composite + %listCount = getTokenCount(%assetItem.importConfig.CompositeTypeSuffixes, ","); + + %foundFile = 0; + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%assetItem.importConfig.CompositeTypeSuffixes, ",", %i); + + %targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt; + %foundFile = isFile(%targetFilePath); + + if(%foundFile) + { + %compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem); + %assetItem.compositeImageAsset = %compositeAsset; + break; + } + } + } + } + } + else if(%assetItem.assetType $= "Image") + { + if(%assetConfigObj.GenerateMaterialOnImport == 1 && %assetItem.parentAssetItem $= "") + { + %filePath = %assetItem.filePath; + if(%filePath !$= "") + %materialAsset = AssetBrowser.addImportingAsset("Material", %filePath, %assetItem); + + %materialAsset.diffuseImageAsset = %assetItem; + + if(%assetConfigObj.UseDiffuseSuffixOnOriginImg == 1) + { + %diffuseToken = getToken(%assetItem.importConfig.DiffuseTypeSuffixes, ",", 0); + %assetItem.AssetName = %assetItem.AssetName @ %diffuseToken; + } + } + } + + AssetBrowser.importAssetUnprocessedListArray.erase(0); + //Been processed, so add it to our final list + AssetBrowser.importAssetFinalListArray.add(%assetItem); + } +} + +function ImportAssetWindow::refresh(%this) +{ + ImportingAssetList.clear(); + + //Go through and process any newly, unprocessed assets + %this.processNewImportAssets(); + + if(AssetBrowser.importAssetUnprocessedListArray.count() == 0) + { + //We've processed them all, prep the assets for actual importing + //Initial set of assets + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + + for(%i=0; %i < %assetCount; %i++) + { + %assetItem = AssetBrowser.importAssetFinalListArray.getKey(%i); + %assetType = %assetItem.assetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + + //validate + %this.validateAsset(%assetItem); + + //Once validated, attempt any fixes for issues + %this.resolveIssue(%assetItem); + + //Make sure we size correctly + ImportingAssetList.extent.x = ImportingAssetList.getParent().extent.x - 15; + + //create! + %width = mRound(mRound(ImportingAssetList.extent.x) / 2); + %height = 20; + %indent = %assetItem.parentDepth * 16; + %toolTip = ""; + + %iconPath = "tools/gui/images/iconInformation"; + %configCommand = "ImportAssetOptionsWindow.editImportSettings(" @ %assetItem @ ");"; + + if(%assetType $= "Model" || %assetType $= "Animation" || %assetType $= "Image" || %assetType $= "Sound") + { + if(%assetItem.status $= "Error") + { + %iconPath = "tools/gui/images/iconError"; + %configCommand = "ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");"; + } + else if(%assetItem.status $= "Warning") + { + %iconPath = "tools/gui/images/iconWarn"; + %configCommand = "ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");"; + + if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset") + %assetName = %assetItem.assetName @ " "; + } + + %toolTip = %assetItem.statusInfo; + } + else + { + if(%assetItem.status $= "Error") + { + %iconPath = "tools/gui/images/iconError"; + %configCommand = "";//"ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");"; + } + else if(%assetItem.status $= "Warning") + { + %iconPath = "tools/gui/images/iconWarn"; + %configCommand = "";//"ImportAssetOptionsWindow.fixIssues(" @ %assetItem @ ");"; + + if(%assetItem.statusType $= "DuplicateAsset" || %assetItem.statusType $= "DuplicateImportAsset") + %assetName = %assetItem.assetName @ " "; + } + } + + %importEntry = new GuiControl() + { + position = "0 0"; + extent = ImportingAssetList.extent.x SPC %height; + + new GuiTextCtrl() + { + Text = %assetName; + position = %indent SPC "0"; + extent = %width - %indent SPC %height; + internalName = "AssetName"; + }; + + new GuiTextCtrl() + { + Text = %assetType; + position = %width SPC "0"; + extent = %width - %height - %height SPC %height; + internalName = "AssetType"; + }; + + new GuiBitmapButtonCtrl() + { + position = ImportingAssetList.extent.x - %height - %height SPC "0"; + extent = %height SPC %height; + command = %configCommand; + bitmap = %iconPath; + tooltip = %toolTip; + }; + new GuiBitmapButtonCtrl() + { + position = ImportingAssetList.extent.x - %height SPC "0"; + extent = %height SPC %height; + command = "ImportAssetOptionsWindow.deleteImportingAsset(" @ %assetItem @ ");"; + bitmap = "tools/gui/images/iconDelete"; + }; + }; + + ImportingAssetList.add(%importEntry); + } + } + else + { + //Continue processing + %this.refresh(); + } +} +// + +function ImportAssetWindow::validateAssets(%this) +{ + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + %moduleName = ImportAssetModuleList.getText(); + %assetQuery = new AssetQuery(); + + %hasIssues = false; + + //First, check the obvious: name collisions. We should have no asset that shares a similar name. + //If we do, prompt for it be renamed first before continuing + + for(%i=0; %i < %assetCount; %i++) + { + %assetItemA = AssetBrowser.importAssetFinalListArray.getKey(%i); + + //First, check our importing assets for name collisions + for(%j=0; %j < %assetCount; %j++) + { + %assetItemB = AssetBrowser.importAssetFinalListArray.getKey(%j); + if( (%assetItemA.assetName $= %assetItemB.assetName) && (%i != %j) ) + { + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!");*/ + + %assetItemA.status = "Warning"; + %assetItemA.statusType = "DuplicateImportAsset"; + %assetItemA.statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!"; + + %hasIssues = true; + } + } + + //No collisions of for this name in the importing assets. Now, check against the existing assets in the target module + if(!AssetBrowser.isAssetReImport) + { + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + %foundCollision = false; + for( %f=0; %f < %numAssetsFound; %f++) + { + %assetId = %assetQuery.getAsset(%f); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %testModuleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName !$= %testModuleName) + continue; + + %testAssetName = AssetDatabase.getAssetName(%assetId); + + if(%testAssetName $= %assetItemA.assetName) + { + %foundCollision = true; + + %assetItemA.status = "Warning"; + %assetItemA.statusType = "DuplicateAsset"; + %assetItemA.statusInfo = "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!"; + + break; + } + } + + if(%foundCollision == true) + { + %hasIssues = true; + + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!");*/ + + //%assetQuery.delete(); + //return false; + } + } + + if(!isFile(%assetItemA.filePath)) + { + %hasIssues = true; + %assetItemA.status = "error"; + %assetItemA.statusType = "MissingFile"; + %assetItemA.statusInfo = "Unable to find file to be imported. Please select asset file."; + } + } + + //Clean up our queries + %assetQuery.delete(); + + if(%hasIssues) + return false; + else + return true; +} + +function ImportAssetWindow::ImportAssets(%this) +{ + //do the actual importing, now! + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + + //get the selected module data + %moduleName = ImportAssetModuleList.getText(); + + %module = ModuleDatabase.findModule(%moduleName, 1); + + if(!isObject(%module)) + { + MessageBoxOK( "Error!", "No module selected. You must select or create a module for the assets to be added to."); + return; + } + + /*if(!%this.validateAssets()) + { + //Force a refresh, as some things may have changed, such as errors and failure info! + refresh(); + + return; + }*/ + + for(%i=0; %i < %assetCount; %i++) + { + %assetItem = AssetBrowser.importAssetFinalListArray.getKey(%i); + %assetType = %assetItem.AssetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + %assetImportSuccessful = false; + %assetId = %moduleName@":"@%assetName; + + if(%assetType $= "Image") + { + %assetPath = "data/" @ %moduleName @ "/Images"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ImageAsset() + { + assetName = %assetName; + versionId = 1; + imageFile = %assetFullPath; + originalFilePath = %filePath; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Model") + { + %assetPath = "data/" @ %moduleName @ "/Shapes"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ShapeAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + isNewShape = true; + }; + + %dependencyCount = getWordCount(%assetItem.dependencies); + for(%d=0; %d < %dependencyCount; %d++) + { + %dependencyAssetItem = getWord(%assetItem.dependencies, %d); + + %depAssetType = %dependencyAssetItem.assetType; + if(%depAssetType $= "Material") + { + %matSet = "%newAsset.materialSlot"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + if(%depAssetType $= "Animation") + { + %matSet = "%newAsset.animationSequence"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + } + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + + //now, force-load the file if it's collada + %fileExt = fileExt(%assetFullPath); + if(isSupportedFormat(getSubStr(%fileExt,1))) + { + %tempShape = new TSStatic() + { + shapeName = %assetFullPath; + }; + + %tempShape.delete(); + } + } + else if(%assetType $= "Animation") + { + %assetPath = "data/" @ %moduleName @ "/ShapeAnimations"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new ShapeAnimationAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + animationFile = %assetFullPath; + animationName = %assetName; + startFrame = 0; + endFrame = -1; + padRotation = false; + padTransforms = false; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Sound") + { + %assetPath = "data/" @ %moduleName @ "/Sounds"; + %assetFullPath = %assetPath @ "/" @ fileName(%filePath); + + %newAsset = new SoundAsset() + { + assetName = %assetName; + versionId = 1; + fileName = %assetFullPath; + originalFilePath = %filePath; + }; + + %assetImportSuccessful = TAMLWrite(%newAsset, %assetPath @ "/" @ %assetName @ ".asset.taml"); + + //and copy the file into the relevent directory + %doOverwrite = !AssetBrowser.isAssetReImport; + if(!pathCopy(%filePath, %assetFullPath, %doOverwrite)) + { + error("Unable to import asset: " @ %filePath); + } + } + else if(%assetType $= "Material") + { + %assetPath = "data/" @ %moduleName @ "/materials"; + %tamlpath = %assetPath @ "/" @ %assetName @ ".asset.taml"; + %sgfPath = %assetPath @ "/" @ %assetName @ ".sgf"; + %scriptPath = %assetPath @ "/" @ %assetName @ ".cs"; + + %newAsset = new MaterialAsset() + { + assetName = %assetName; + versionId = 1; + shaderGraph = %sgfPath; + scriptFile = %scriptPath; + originalFilePath = %filePath; + materialDefinitionName = %assetName; + }; + + %dependencyCount = getWordCount(%assetItem.dependencies); + for(%d=0; %d < %dependencyCount; %d++) + { + %dependencyAssetItem = getWord(%assetItem.dependencies, %d); + + %depAssetType = %dependencyAssetItem.assetType; + if(%depAssetType $= "Image") + { + %matSet = "%newAsset.imageMap"@%d@"=\"@Asset="@%moduleName@":"@%dependencyAssetItem.assetName@"\";"; + eval(%matSet); + } + } + + %assetImportSuccessful = TamlWrite(%newAsset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + %file.writeline("//--- OBJECT WRITE BEGIN ---"); + %file.writeline("singleton Material(" @ %assetName @ ") {"); + + //TODO: pass along the shape's target material for this just to be sure + %file.writeLine(" mapTo = \"" @ %assetName @ "\";"); + + if(%assetItem.diffuseImageAsset !$= "") + { + %diffuseAssetPath = "data/" @ %moduleName @ "/Images/" @ fileName(%assetItem.diffuseImageAsset.filePath); + %file.writeline(" DiffuseMap[0] = \"" @ %diffuseAssetPath @"\";"); + %file.writeline(" DiffuseMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.diffuseImageAsset.assetName @"\";"); + } + if(%assetItem.normalImageAsset) + { + %normalAssetPath = "data/" @ %moduleName @ "/Images/" @ fileName(%assetItem.normalImageAsset.filePath); + %file.writeline(" NormalMap[0] = \"" @ %normalAssetPath @"\";"); + %file.writeline(" NormalMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.normalImageAsset.assetName @"\";"); + } + /*if(%assetItem.specularImageAsset) + { + %file.writeline(" SpecularMap[0] = \"" @ %assetItem.specularImageAsset.filePath @"\";"); + %file.writeline(" SpecularMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.specularImageAsset.assetName @"\";"); + }*/ + if(%assetItem.roughnessImageAsset) + { + %file.writeline(" RoughMap[0] = \"" @ %assetItem.roughnessImageAsset.filePath @"\";"); + %file.writeline(" RoughMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.roughnessImageAsset.assetName @"\";"); + } + if(%assetItem.smoothnessImageAsset) + { + %file.writeline(" SmoothnessMap[0] = \"" @ %assetItem.smoothnessImageAsset.filePath @"\";"); + %file.writeline(" SmoothnessMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.smoothnessImageAsset.assetName @"\";"); + } + if(%assetItem.metalnessImageAsset) + { + %file.writeline(" MetalMap[0] = \"" @ %assetItem.metalnessImageAsset.filePath @"\";"); + %file.writeline(" MetalMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.metalnessImageAsset.assetName @"\";"); + } + if(%assetItem.AOImageAsset) + { + %file.writeline(" AOMap[0] = \"" @ %assetItem.AOImageAsset.filePath @"\";"); + %file.writeline(" AOMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.AOImageAsset.assetName @"\";"); + } + if(%assetItem.compositeImageAsset) + { + %file.writeline(" CompositeMap[0] = \"" @ %assetItem.compositeImageAsset.filePath @"\";"); + %file.writeline(" CompositeMapAsset[0] = \"" @ %moduleName @ ":" @ %assetItem.compositeImageAsset.assetName @"\";"); + } + %file.writeline("};"); + %file.writeline("//--- OBJECT WRITE END ---"); + + %file.close(); + } + } + + if(%assetImportSuccessful) + { + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + + if(!AssetBrowser.isAssetReImport) + AssetDatabase.addDeclaredAsset(%moduleDef, %assetPath @ "/" @ %assetName @ ".asset.taml"); + else + AssetDatabase.refreshAsset(%assetId); + } + } + + //force an update of any and all modules so we have an up-to-date asset list + AssetBrowser.loadFilters(); + AssetBrowser.refreshPreviews(); + Canvas.popDialog(AssetImportCtrl); + AssetBrowser.isAssetReImport = false; +} + +// +function ImportAssetWindow::validateAsset(%this, %assetItem) +{ + %assetCount = AssetBrowser.importAssetFinalListArray.count(); + %moduleName = ImportAssetModuleList.getText(); + + %hasIssues = false; + + //First, check the obvious: name collisions. We should have no asset that shares a similar name. + //If we do, prompt for it be renamed first before continuing + + for(%i=0; %i < %assetCount; %i++) + { + %assetItemA = AssetBrowser.importAssetFinalListArray.getKey(%i); + + if( (%assetItemA.assetName $= %assetItem.assetName) && (%assetItemA.getId() != %assetItem.getId()) ) + { + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItemB.assetName @ "\" of type \"" @ %assetItemB.assetType @ "\" have matching names.\nPlease rename one of them and try again!");*/ + + %assetItem.status = "Warning"; + %assetItem.statusType = "DuplicateImportAsset"; + %assetItem.statusInfo = "Duplicate asset names found with importing assets!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" and \"" @ + %assetItem.assetName @ "\" of type \"" @ %assetItem.assetType @ "\" have matching names.\nPlease rename one of them and try again!"; + + %hasIssues = true; + return false; + } + } + + //No collisions of for this name in the importing assets. Now, check against the existing assets in the target module + if(!AssetBrowser.isAssetReImport) + { + %assetQuery = new AssetQuery(); + + %numAssetsFound = AssetDatabase.findAllAssets(%assetQuery); + + %foundCollision = false; + for( %f=0; %f < %numAssetsFound; %f++) + { + %assetId = %assetQuery.getAsset(%f); + + //first, get the asset's module, as our major categories + %module = AssetDatabase.getAssetModule(%assetId); + + %testModuleName = %module.moduleId; + + //These are core, native-level components, so we're not going to be messing with this module at all, skip it + if(%moduleName !$= %testModuleName) + continue; + + %testAssetName = AssetDatabase.getAssetName(%assetId); + + if(%testAssetName $= %assetItem.assetName) + { + %foundCollision = true; + + %assetItem.status = "Warning"; + %assetItem.statusType = "DuplicateAsset"; + %assetItem.statusInfo = "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItem.assetName @ "\" of type \"" @ %assetItem.assetType @ "\" has a matching name.\nPlease rename it and try again!"; + + //Clean up our queries + %assetQuery.delete(); + + return false; + } + } + + if(%foundCollision == true) + { + %hasIssues = true; + + //yup, a collision, prompt for the change and bail out + /*MessageBoxOK( "Error!", "Duplicate asset names found with the target module!\nAsset \"" @ + %assetItemA.assetName @ "\" of type \"" @ %assetItemA.assetType @ "\" has a matching name.\nPlease rename it and try again!");*/ + + //%assetQuery.delete(); + //return false; + } + + //Clean up our queries + %assetQuery.delete(); + } + + if(!isFile(%assetItem.filePath)) + { + %hasIssues = true; + %assetItem.status = "error"; + %assetItem.statusType = "MissingFile"; + %assetItem.statusInfo = "Unable to find file to be imported. Please select asset file."; + + return false; + } + + return true; +} + +function ImportAssetWindow::resolveIssue(%this, %assetItem) +{ + if(%assetItem.status !$= "Warning") + return; + + //Ok, we actually have a warning, so lets resolve + if(%assetItem.statusType $= "DuplicateImportAsset" || %assetItem.statusType $= "DuplicateAsset") + { + + } + else if(%assetItem.statusType $= "MissingFile") + { + %this.findMissingFile(%assetItem); + } +} +// + +// +function ImportAssetModuleList::onWake(%this) +{ + %this.refresh(); +} + +function ImportAssetModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} +// diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs new file mode 100644 index 000000000..bdd4c2851 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs @@ -0,0 +1,472 @@ +function ImportAssetConfigList::onSelect( %this, %id, %text ) +{ + //Apply our settings to the assets + echo("Changed our import config!"); + AssetBrowser.importAssetUnprocessedListArray.empty(); + AssetBrowser.importAssetUnprocessedListArray.duplicate(AssetBrowser.importAssetNewListArray); + AssetBrowser.importAssetFinalListArray.empty(); + + ImportAssetWindow.activeImportConfigIndex = %id; + ImportAssetWindow.activeImportConfig = ImportAssetWindow.importConfigsList.getKey(%id); + ImportAssetWindow.refresh(); +} + +function ImportAssetOptionsWindow::findMissingFile(%this, %assetItem) +{ + if(%assetItem.assetType $= "Model") + %filters = "Shape Files(*.dae, *.cached.dts)|*.dae;*.cached.dts"; + else if(%assetItem.assetType $= "Image") + %filters = "Images Files(*.jpg,*.png,*.tga,*.bmp,*.dds)|*.jpg;*.png;*.tga;*.bmp;*.dds"; + + %dlg = new OpenFileDialog() + { + Filters = %filters; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = true; + OverwritePrompt = true; + forceRelativePath = false; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = %dlg.FileName;//makeRelativePath( %dlg.FileName, getMainDotCSDir() ); + } + + %dlg.delete(); + + if ( !%ret ) + return; + + %assetItem.filePath = %fullPath; + + ImportAssetWindow.refresh(); +} + +// +function ImportAssetOptionsWindow::editImportSettings(%this, %assetItem) +{ + ImportAssetOptionsWindow.setVisible(1); + ImportAssetOptionsWindow.selectWindow(); + + ImportOptionsList.clearFields(); + + %assetType = %assetItem.assetType; + %filePath = %assetItem.filePath; + %assetName = %assetItem.assetName; + %assetConfigObj = %assetItem.importConfig; + + ImportOptionsList.startGroup("Asset"); + ImportOptionsList.addField("AssetName", "Asset Name", "string", "", "NewAsset", "", %assetItem); + ImportOptionsList.endGroup(); + + if(%assetType $= "Model") + { + //Get the shape info, so we know what we're doing with the mesh + %shapeInfo = GetShapeInfo(%filePath); + %meshItem = %shapeInfo.findItemByName("Meshes"); + %matItem = %shapeInfo.findItemByName("Materials"); + + %meshCount = %shapeInfo.getItemValue(%meshItem); + %matCount = %shapeInfo.getItemValue(%matItem); + + %firstMat = %shapeInfo.getChild(%matItem); + echo("Mesh's first material texture path is: " @ %shapeInfo.getItemValue(%firstMat)); + + if(%meshCount > 0) + { + ImportOptionsList.startGroup("Mesh"); + ImportOptionsList.addField("AutogenCollisions", "Auto-gen Collisions", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("UpAxisOverride", "Up-Axis Override", "list", "", "Z_AXIS", "Z_AXIS,Y_AXIS,X_AXIS", %assetConfigObj); + ImportOptionsList.addField("OverrideScale", "Override Scale", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.addField("IgnoreNodeScale", "IgnoreNodeScaling", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("AdjustCenter", "Adjust Center", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("AdjustFloor", "Adjust Floor", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.addField("LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS", %assetConfigObj); + ImportOptionsList.endGroup(); + } + + if(%matItem > 0) + { + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addCallbackField("ImportMaterials", "Import Materials", "bool", "", "1", "", "ImportMaterialsChanged", %assetConfigObj); + ImportOptionsList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } + } + else if(%assetType $= "Material") + { + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addField("CreateComposites", "Create Composite Textures", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } + else if(%assetType $= "Image") + { + ImportOptionsList.startGroup("Formatting"); + ImportOptionsList.addField("ImageType", "Image Type", "string", "", "Diffuse", "", %assetConfigObj); + ImportOptionsList.addField("TextureFiltering", "Texture Filtering", "list", "", "Bilinear", "None,Bilinear,Trilinear", %assetConfigObj); + ImportOptionsList.addField("UseMips", "Use Mips", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.addField("IsHDR", "Is HDR", "bool", "", "0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Scaling"); + ImportOptionsList.addField("Scaling", "Scaling", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Compression"); + ImportOptionsList.addField("IsCompressed", "Is Compressed", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Material"); + ImportOptionsList.addField("GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("UseDiffuseSuffixOnOriginImg", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "", %optionsObj); + ImportOptionsList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsList.endGroup(); + } + else if(%assetType $= "Sound") + { + ImportOptionsList.startGroup("Adjustment"); + ImportOptionsList.addField("VolumeAdjust", "VolumeAdjustment", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.addField("PitchAdjust", "PitchAdjustment", "float", "", "1.0", "", %assetConfigObj); + ImportOptionsList.endGroup(); + + ImportOptionsList.startGroup("Compression"); + ImportOptionsList.addField("IsCompressed", "Is Compressed", "bool", "", "1", "", %assetConfigObj); + ImportOptionsList.endGroup(); + } +} + +function ImportAssetOptionsWindow::deleteImportingAsset(%this, %assetItem) +{ + %assetIndex = AssetBrowser.importAssetNewListArray.getIndexFromKey(%assetItem); + AssetBrowser.importAssetNewListArray.erase(%assetIndex); + + //check if we have any child assets and remove them as well + for(%i=0; %i < AssetBrowser.importAssetNewListArray.count(); %i++) + { + %asset = AssetBrowser.importAssetNewListArray.getKey(%i); + if(%asset.ParentAssetItem == %assetItem) + { + AssetBrowser.importAssetNewListArray.erase(%i); + %i--; + } + } + + %assetIndex = AssetBrowser.importAssetFinalListArray.getIndexFromKey(%assetItem); + AssetBrowser.importAssetFinalListArray.erase(%assetIndex); + + //check if we have any child assets and remove them as well + for(%i=0; %i < AssetBrowser.importAssetFinalListArray.count(); %i++) + { + %asset = AssetBrowser.importAssetFinalListArray.getKey(%i); + if(%asset.ParentAssetItem == %assetItem) + { + AssetBrowser.importAssetFinalListArray.erase(%i); + %i--; + } + } + + ImportAssetWindow.refresh(); + ImportAssetOptionsWindow.setVisible(0); +} + +function ImportAssetOptionsWindow::saveAssetOptions(%this) +{ + ImportAssetWindow.refresh(); + ImportAssetOptionsWindow.setVisible(0); +} + +function ImportOptionsList::ImportMaterialsChanged(%this, %fieldName, %newValue, %ownerObject) +{ + echo("CHANGED IF OUR IMPORTED MATERIALS WERE HAPPENING!"); +} + +function ImportAssetConfigEditorWindow::populateConfigList(%this, %optionsObj) +{ + AssetImportConfigName.setText(%optionsObj.Name); + + ImportOptionsConfigList.clear(); + + ImportOptionsConfigList.startGroup("Mesh"); + ImportOptionsConfigList.addCallbackField("ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh", %optionsObj); + ImportOptionsConfigList.addField("DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("UpAxisOverride", "Up-axis Override", "list", "", "Z_AXIS", "X_AXIS,Y_AXIS,Z_AXIS", %optionsObj); + ImportOptionsConfigList.addField("DoScaleOverride", "Do Scale Override", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("ScaleOverride", "Scale Override", "float", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreNodeScale", "Ignore Node Scale", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("AdjustCenter", "Adjust Center", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("AdjustFloor", "Adjust Floor", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS", %optionsObj); + //ImportOptionsConfigList.addField("TrailingNumber", "Trailing Number", "float", "", "2", "", %optionsObj, "Mesh"); + ImportOptionsConfigList.addField("ImportedNodes", "Imported Nodes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreNodes", "Ignore Nodes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("ImportMeshes", "Import Meshes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreMeshes", "Imported Meshes", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Materials + ImportOptionsConfigList.startGroup("Material"); + ImportOptionsConfigList.addField("ImportMaterials", "Import Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("CreateComposites", "Create Composites", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("UseDiffuseSuffixOnOriginImg", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IgnoreMaterials", "Ignore Materials", "command", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Animations + ImportOptionsConfigList.startGroup("Animations"); + ImportOptionsConfigList.addField("ImportAnimations", "Import Animations", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("SeparateAnimations", "Separate Animations", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("SeparateAnimationPrefix", "Separate Animation Prefix", "string", "", "", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Collision + ImportOptionsConfigList.startGroup("Collision"); + ImportOptionsConfigList.addField("GenerateCollisions", "Generate Collisions", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenCollisionType", "Generate Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull", %optionsObj); + ImportOptionsConfigList.addField("CollisionMeshPrefix", "CollisionMesh Prefix", "string", "", "Col", "", %optionsObj); + ImportOptionsConfigList.addField("GenerateLOSCollisions", "Generate LOS Collisions", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenLOSCollisionType", "Generate LOS Collision Type", "list", "", "CollisionMesh", "CollisionMesh,ConvexHull", %optionsObj); + ImportOptionsConfigList.addField("LOSCollisionMeshPrefix", "LOS CollisionMesh Prefix", "string", "", "LOS", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Images + ImportOptionsConfigList.startGroup("Image"); + ImportOptionsConfigList.addField("ImageType", "Image Type", "list", "", "N/A", "N/A,Diffuse,Normal,Specular,Metalness,Roughness,AO,Composite,GUI", %optionsObj); + ImportOptionsConfigList.addField("DiffuseTypeSuffixes", "Diffuse Type Suffixes", "command", "", "_ALBEDO,_DIFFUSE,_ALB,_DIF,_COLOR,_COL", "", %optionsObj); + ImportOptionsConfigList.addField("NormalTypeSuffixes", "Normal Type Suffixes", "command", "", "_NORMAL,_NORM", "", %optionsObj); + + if(EditorSettings.lightingModel $= "Legacy") + { + ImportOptionsConfigList.addField("SpecularTypeSuffixes", "Specular Type Suffixes", "command", "", "_SPECULAR,_SPEC", "", %optionsObj); + } + else + { + ImportOptionsConfigList.addField("MetalnessTypeSuffixes", "Metalness Type Suffixes", "command", "", "_METAL,_MET,_METALNESS,_METALLIC", "", %optionsObj); + ImportOptionsConfigList.addField("RoughnessTypeSuffixes", "Roughness Type Suffixes", "command", "", "_ROUGH,_ROUGHNESS", "", %optionsObj); + ImportOptionsConfigList.addField("SmoothnessTypeSuffixes", "Smoothness Type Suffixes", "command", "", "_SMOOTH,_SMOOTHNESS", "", %optionsObj); + ImportOptionsConfigList.addField("AOTypeSuffixes", "AO Type Suffixes", "command", "", "_AO,_AMBIENT,_AMBIENTOCCLUSION", "", %optionsObj); + ImportOptionsConfigList.addField("CompositeTypeSuffixes", "Composite Type Suffixes", "command", "", "_COMP,_COMPOSITE", "", %optionsObj); + } + + ImportOptionsConfigList.addField("TextureFilteringMode", "Texture Filtering Mode", "list", "", "Bilinear", "None,Bilinear,Trilinear", %optionsObj); + ImportOptionsConfigList.addField("UseMips", "Use Mipmaps", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("IsHDR", "Is HDR", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.addField("Scaling", "Scaling", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("Compressed", "Is Compressed", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("GenerateMaterialOnImport", "Generate Material On Import", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.addField("PopulateMaterialMaps", "Populate Material Maps", "bool", "", "1", "", %optionsObj); + ImportOptionsConfigList.endGroup(); + + //Sounds + ImportOptionsConfigList.startGroup("Sound"); + ImportOptionsConfigList.addField("VolumeAdjust", "Volume Adjustment", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("PitchAdjust", "Pitch Adjustment", "float", "", "1.0", "", %optionsObj); + ImportOptionsConfigList.addField("Compressed", "Is Compressed", "bool", "", "0", "", %optionsObj); + ImportOptionsConfigList.endGroup(); +} + +function ImportAssetConfigEditorWindow::addNewConfig(%this) +{ + ImportAssetConfigEditorWindow.setVisible(1); + ImportAssetConfigEditorWindow.selectWindow(); + + %optionsObj = new ScriptObject(){}; + + ImportAssetWindow.importConfigsList.add(%optionsObj); + + //Initial, blank configuration + %optionsObj.ImportMesh = true; + %optionsObj.DoUpAxisOverride = false; + %optionsObj.UpAxisOverride = "Z_AXIS"; + %optionsObj.DoScaleOverride = false; + %optionsObj.ScaleOverride = 1.0; + %optionsObj.IgnoreNodeScale = false; + %optionsObj.AdjustCenter = false; + %optionsObj.AdjustFloor = false; + %optionsObj.CollapseSubmeshes = false; + %optionsObj.LODType = "TrailingNumber"; + //%optionsObj.TrailingNumber = 2; + %optionsObj.ImportedNodes = ""; + %optionsObj.IgnoreNodes = ""; + %optionsObj.ImportMeshes = ""; + %optionsObj.IgnoreMeshes = ""; + + //Materials + %optionsObj.ImportMaterials = true; + %optionsObj.CreateComposites = true; + %optionsObj.UseDiffuseSuffixOnOriginImg = true; + %optionsObj.UseExistingMaterials = true; + + //Animations + %optionsObj.ImportAnimations = true; + %optionsObj.SeparateAnimations = true; + %optionsObj.SeparateAnimationPrefix = ""; + + //Collision + %optionsObj.GenerateCollisions = true; + %optionsObj.GenCollisionType = "CollisionMesh"; + %optionsObj.CollisionMeshPrefix = "Col"; + %optionsObj.GenerateLOSCollisions = true; + %optionsObj.GenLOSCollisionType = "CollisionMesh"; + %optionsObj.LOSCollisionMeshPrefix = "LOS"; + + //Images + %optionsObj.ImageType = "N/A"; + %optionsObj.DiffuseTypeSuffixes = "_ALBEDO;_DIFFUSE;_ALB;_DIF;_COLOR;_COL;_BASECOLOR;_BASE_COLOR"; + %optionsObj.NormalTypeSuffixes = "_NORMAL;_NORM"; + %optionsObj.SpecularTypeSuffixes = "_SPECULAR;_SPEC"; + %optionsObj.MetalnessTypeSuffixes = "_METAL;_MET;_METALNESS;_METALLIC"; + %optionsObj.RoughnessTypeSuffixes = "_ROUGH;_ROUGHNESS"; + %optionsObj.SmoothnessTypeSuffixes = "_SMOOTH;_SMOOTHNESS"; + %optionsObj.AOTypeSuffixes = "_AO;_AMBIENT;_AMBIENTOCCLUSION"; + %optionsObj.CompositeTypeSuffixes = "_COMP;_COMPOSITE"; + %optionsObj.TextureFilteringMode = "Bilinear"; + %optionsObj.UseMips = true; + %optionsObj.IsHDR = false; + %optionsObj.Scaling = 1.0; + %optionsObj.Compressed = true; + %optionsObj.GenerateMaterialOnImport = true; + %optionsObj.PopulateMaterialMaps = true; + + //Sounds + %optionsObj.VolumeAdjust = 1.0; + %optionsObj.PitchAdjust = 1.0; + %optionsObj.Compressed = false; + + //Hook in the UI + %this.populateConfigList(%optionsObj); +} + +function ImportAssetConfigEditorWindow::editConfig(%this) +{ + ImportAssetConfigEditorWindow.setVisible(1); + ImportAssetConfigEditorWindow.selectWindow(); + + %this.populateConfigList(ImportAssetWindow.activeImportConfig); +} + +function ImportAssetConfigEditorWindow::deleteConfig(%this) +{ + ImportAssetWindow.importConfigsList.erase(ImportAssetWindow.activeImportConfigIndex); + ImportAssetConfigList.setSelected(0); //update it + + ImportAssetConfigEditorWindow.saveAssetOptionsConfig(); +} + +function ImportAssetConfigEditorWindow::saveAssetOptionsConfig(%this) +{ + %xmlDoc = new SimXMLDocument(); + + %xmlDoc.pushNewElement("AssetImportConfigs"); + + for(%i = 0; %i < ImportAssetWindow.importConfigsList.count(); %i++) + { + %configObj = ImportAssetWindow.importConfigsList.getKey(%i); + + %xmlDoc.pushNewElement("Config"); + + if(%configObj.Name $= "") + %configObj.Name = AssetImportConfigName.getText(); + + %xmlDoc.setAttribute("Name", %configObj.Name); + + %xmlDoc.pushNewElement("Mesh"); + %xmlDoc.setAttribute("ImportMesh", %configObj.ImportMesh); + %xmlDoc.setAttribute("DoUpAxisOverride", %configObj.DoUpAxisOverride); + %xmlDoc.setAttribute("UpAxisOverride", %configObj.UpAxisOverride); + %xmlDoc.setAttribute("DoScaleOverride", %configObj.DoScaleOverride); + %xmlDoc.setAttribute("ScaleOverride", %configObj.ScaleOverride); + %xmlDoc.setAttribute("IgnoreNodeScale", %configObj.IgnoreNodeScale); + %xmlDoc.setAttribute("AdjustCenter", %configObj.AdjustCenter); + %xmlDoc.setAttribute("AdjustFloor", %configObj.AdjustFloor); + %xmlDoc.setAttribute("CollapseSubmeshes", %configObj.CollapseSubmeshes); + %xmlDoc.setAttribute("LODType", %configObj.LODType); + %xmlDoc.setAttribute("ImportedNodes", %configObj.ImportedNodes); + %xmlDoc.setAttribute("IgnoreNodes", %configObj.IgnoreNodes); + %xmlDoc.setAttribute("ImportMeshes", %configObj.ImportMeshes); + %xmlDoc.setAttribute("IgnoreMeshes", %configObj.IgnoreMeshes); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Materials"); + %xmlDoc.setAttribute("ImportMaterials", %configObj.ImportMaterials); + %xmlDoc.setAttribute("CreateComposites", %configObj.CreateComposites); + %xmlDoc.setAttribute("UseDiffuseSuffixOnOriginImg", %configObj.UseDiffuseSuffixOnOriginImg); + %xmlDoc.setAttribute("UseExistingMaterials", %configObj.UseExistingMaterials); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Animations"); + %xmlDoc.setAttribute("ImportAnimations", %configObj.ImportAnimations); + %xmlDoc.setAttribute("SeparateAnimations", %configObj.SeparateAnimations); + %xmlDoc.setAttribute("SeparateAnimationPrefix", %configObj.SeparateAnimationPrefix); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Collisions"); + %xmlDoc.setAttribute("GenerateCollisions", %configObj.GenerateCollisions); + %xmlDoc.setAttribute("GenCollisionType", %configObj.GenCollisionType); + %xmlDoc.setAttribute("CollisionMeshPrefix", %configObj.CollisionMeshPrefix); + %xmlDoc.setAttribute("GenerateLOSCollisions", %configObj.GenerateLOSCollisions); + %xmlDoc.setAttribute("GenLOSCollisionType", %configObj.GenLOSCollisionType); + %xmlDoc.setAttribute("LOSCollisionMeshPrefix", %configObj.LOSCollisionMeshPrefix); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Images"); + %xmlDoc.setAttribute("ImageType", %configObj.ImageType); + %xmlDoc.setAttribute("DiffuseTypeSuffixes", %configObj.DiffuseTypeSuffixes); + %xmlDoc.setAttribute("NormalTypeSuffixes", %configObj.NormalTypeSuffixes); + %xmlDoc.setAttribute("SpecularTypeSuffixes", %configObj.SpecularTypeSuffixes); + %xmlDoc.setAttribute("MetalnessTypeSuffixes", %configObj.MetalnessTypeSuffixes); + %xmlDoc.setAttribute("RoughnessTypeSuffixes", %configObj.RoughnessTypeSuffixes); + %xmlDoc.setAttribute("SmoothnessTypeSuffixes", %configObj.SmoothnessTypeSuffixes); + %xmlDoc.setAttribute("AOTypeSuffixes", %configObj.AOTypeSuffixes); + %xmlDoc.setAttribute("CompositeTypeSuffixes", %configObj.CompositeTypeSuffixes); + %xmlDoc.setAttribute("TextureFilteringMode", %configObj.TextureFilteringMode); + %xmlDoc.setAttribute("UseMips", %configObj.UseMips); + %xmlDoc.setAttribute("IsHDR", %configObj.IsHDR); + %xmlDoc.setAttribute("Scaling", %configObj.Scaling); + %xmlDoc.setAttribute("Compressed", %configObj.Compressed); + %xmlDoc.setAttribute("GenerateMaterialOnImport", %configObj.GenerateMaterialOnImport); + %xmlDoc.setAttribute("PopulateMaterialMaps", %configObj.PopulateMaterialMaps); + %xmlDoc.popElement(); + + %xmlDoc.pushNewElement("Sounds"); + %xmlDoc.setAttribute("VolumeAdjust", %configObj.VolumeAdjust); + %xmlDoc.setAttribute("PitchAdjust", %configObj.PitchAdjust); + %xmlDoc.setAttribute("Compressed", %configObj.Compressed); + %xmlDoc.popElement(); + + %xmlDoc.popElement(); + } + + %xmlDoc.popElement(); + + %xmlDoc.saveFile($AssetBrowser::importConfigsFile); + + ImportAssetConfigEditorWindow.setVisible(0); + ImportAssetWindow.reloadImportOptionConfigs(); +} + +function ImportOptionsConfigList::ToggleImportMesh(%this, %fieldName, %newValue, %ownerObject) +{ + %this.setFieldEnabled("DoUpAxisOverride", %newValue); + %this.setFieldEnabled("UpAxisOverride", %newValue); + %this.setFieldEnabled("DoScaleOverride", %newValue); + %this.setFieldEnabled("ScaleOverride", %newValue); + %this.setFieldEnabled("IgnoreNodeScale", %newValue); + %this.setFieldEnabled("AdjustCenter", %newValue); + %this.setFieldEnabled("AdjustFloor", %newValue); + %this.setFieldEnabled("CollapseSubmeshes", %newValue); + %this.setFieldEnabled("LODType", %newValue); + %this.setFieldEnabled("ImportedNodes", %newValue); + %this.setFieldEnabled("IgnoreNodes", %newValue); + %this.setFieldEnabled("ImportMeshes", %newValue); + %this.setFieldEnabled("IgnoreMeshes", %newValue); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs new file mode 100644 index 000000000..bc80f8977 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.cs @@ -0,0 +1,371 @@ +function AssetBrowser_editAsset::saveAsset(%this) +{ + %file = AssetDatabase.getAssetFilePath(%this.editedAssetId); + %success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file); + + AssetBrowser.loadFilters(); + + Canvas.popDialog(AssetBrowser_editAsset); +} + +function AssetBrowser::editAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = %assetDef.getClassName(); + + if(%assetType $= "MaterialAsset") + { + //if(EditorSettings.materialEditMode $= "MaterialEditor") + //{ + %assetDef.materialDefinitionName.reload(); + + EditorGui.setEditor(MaterialEditorPlugin); + + MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName; + MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName ); + + AssetBrowser.hideDialog(); + /*} + else + { + Canvas.pushDialog(ShaderEditor); + ShaderEditorGraph.loadGraph(%assetDef.shaderGraph); + $ShaderGen::targetShaderFile = filePath(%assetDef.shaderGraph) @"/"@fileBase(%assetDef.shaderGraph); + }*/ + } + else if(%assetType $= "StateMachineAsset") + { + eval("AssetBrowser.tempAsset = new " @ %assetDef.getClassName() @ "();"); + AssetBrowser.tempAsset.assignFieldsFrom(%assetDef); + + SMAssetEditInspector.inspect(AssetBrowser.tempAsset); + AssetBrowser_editAsset.editedAssetId = EditAssetPopup.assetId; + AssetBrowser_editAsset.editedAsset = AssetBrowser.tempAsset; + + //remove some of the groups we don't need: + for(%i=0; %i < SMAssetEditInspector.getCount(); %i++) + { + %caption = SMAssetEditInspector.getObject(%i).caption; + + if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing" + || %caption $= "Persistence" || %caption $= "Dynamic Fields") + { + SMAssetEditInspector.remove(SMAssetEditInspector.getObject(%i)); + %i--; + } + } + + Canvas.pushDialog(StateMachineEditor); + StateMachineEditor.loadStateMachineAsset(EditAssetPopup.assetId); + StateMachineEditor-->Window.text = "State Machine Editor ("@EditAssetPopup.assetId@")"; + } + else if(%assetType $= "ComponentAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFile; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "GameObjectAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFilePath; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "ScriptAsset") + { + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %scriptFile = %assetDef.scriptFilePath; + + EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + } + else if(%assetType $= "ShapeAsset") + { + %this.hideDialog(); + ShapeEditorPlugin.openShapeAsset(EditAssetPopup.assetId); + } + else if(%assetType $= "ShapeAnimationAsset") + { + %this.hideDialog(); + ShapeEditorPlugin.openShapeAsset(EditAssetPopup.assetId); + } + else if(%assetType $= "LevelAsset") + { + schedule( 1, 0, "EditorOpenMission", %assetDef.LevelFile); + } + else if(%assetType $= "GUIAsset") + { + if(!isObject(%assetDef.assetName)) + { + exec(%assetDef.GUIFilePath); + exec(%assetDef.mScriptFilePath); + } + + GuiEditContent(%assetDef.assetName); + } +} + +function AssetBrowser::editAssetInfo(%this) +{ + Canvas.pushDialog(AssetBrowser_editAsset); + + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + eval("AssetBrowser.tempAsset = new " @ %assetDef.getClassName() @ "();"); + AssetBrowser.tempAsset.assignFieldsFrom(%assetDef); + + AssetEditInspector.inspect(AssetBrowser.tempAsset); + AssetBrowser_editAsset.editedAssetId = EditAssetPopup.assetId; + AssetBrowser_editAsset.editedAsset = AssetBrowser.tempAsset; + + //remove some of the groups we don't need: + for(%i=0; %i < AssetEditInspector.getCount(); %i++) + { + %caption = AssetEditInspector.getObject(%i).caption; + + if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing" + || %caption $= "Persistence" || %caption $= "Dynamic Fields") + { + AssetEditInspector.remove(AssetEditInspector.getObject(%i)); + %i--; + } + } +} + +//------------------------------------------------------------ + +function AssetBrowser::refreshAsset(%this, %assetId) +{ + if(%assetId $= "") + { + //if we have no passed-in asset ID, we're probably going through the popup menu, so get our edit popup id + %assetId = EditAssetPopup.assetId; + } + + AssetDatabase.refreshAsset(%assetId); + AssetBrowser.refreshPreviews(); +} + +//------------------------------------------------------------ + +function AssetBrowser::renameAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + %curFirstResponder = AssetBrowser.getFirstResponder(); + + if(%curFirstResponder != 0) + %curFirstResponder.clearFirstResponder(); + + AssetBrowser.selectedAssetPreview-->AssetNameLabel.setActive(true); + AssetBrowser.selectedAssetPreview-->AssetNameLabel.setFirstResponder(); +} + +function AssetNameField::onReturn(%this) +{ + //if the name is different to the asset's original name, rename it! + %newName = %this.getText(); + if(%this.originalAssetName !$= %this.getText()) + { + %moduleName = AssetBrowser.selectedModule; + + //do a rename! + %success = AssetDatabase.renameDeclaredAsset(%moduleName @ ":" @ %this.originalAssetName, %moduleName @ ":" @ %this.getText()); + + if(%success) + { + %newAssetId = %moduleName @ ":" @ %this.getText(); + %assetPath = AssetDatabase.getAssetFilePath(%newAssetId); + + //Rename any associated files as well + %assetDef = AssetDatabase.acquireAsset(%newAssetId); + %assetType = %assetDef.getClassName(); + + //rename the file to match + %path = filePath(%assetPath); + + if(%assetType $= "ComponentAsset") + { + %oldScriptFilePath = %assetDef.scriptFile; + %scriptFilePath = filePath(%assetDef.scriptFile); + %scriptExt = fileExt(%assetDef.scriptFile); + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + + %assetDef.componentName = %newName; + %assetDef.scriptFile = %newScriptFileName; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + exec(%newScriptFileName); + } + else if(%assetType $= "StateMachineAsset") + { + %oldScriptFilePath = %assetDef.stateMachineFile; + %scriptFilePath = filePath(%assetDef.stateMachineFile); + %scriptExt = fileExt(%assetDef.stateMachineFile); + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + + %assetDef.stateMachineFile = %newScriptFileName; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + } + else if(%assetType $= "GameObjectAsset") + { + %oldScriptFilePath = %assetDef.scriptFilePath; + %scriptFilePath = filePath(%assetDef.scriptFilePath); + %scriptExt = fileExt(%assetDef.scriptFilePath); + + %oldGOFilePath = %assetDef.TAMLFilePath; + + %newScriptFileName = %scriptFilePath @ "/" @ %newName @ %scriptExt; + %newAssetFile = %path @ "/" @ %this.getText() @ ".asset.taml"; + %newGOFile = %path @ "/" @ %this.getText() @ ".taml"; + + %assetDef.gameObjectName = %newName; + %assetDef.scriptFilePath = %newScriptFileName; + %assetDef.TAMLFilePath = %newGOFile; + + TamlWrite(%assetDef, %newAssetFile); + fileDelete(%assetPath); + + pathCopy(%oldScriptFilePath, %newScriptFileName); + fileDelete(%oldScriptFilePath); + + pathCopy(%oldGOFilePath, %newGOFile); + fileDelete(%oldGOFilePath); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + exec(%newScriptFileName); + + //Rename in the TAML file as well + %file = new FileObject(); + if ( %file.openForRead( %newGOFile ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %this.originalAssetName, %newName) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newGOFile); + + %file.writeline(%editedFileContents); + + %file.close(); + } + } + } + } + + %this.clearFirstResponder(); + %this.setActive(false); +} + +//------------------------------------------------------------ + +function AssetBrowser::duplicateAsset(%this) +{ + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + + %this.setupCreateNewAsset(%assetDef.getClassName(), AssetBrowser.selectedModule); +} + +function AssetBrowser::deleteAsset(%this) +{ + //Find out what type it is + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %assetType = %assetDef.getClassName(); + + MessageBoxOKCancel("Warning!", "This will delete the selected asset and the files associated to it, do you wish to continue?", + "AssetBrowser.confirmDeleteAsset();", ""); +} + +function AssetBrowser::confirmDeleteAsset(%this) +{ + %currentSelectedItem = AssetBrowserFilterTree.getSelectedItem(); + %currentItemParent = AssetBrowserFilterTree.getParentItem(%currentSelectedItem); + + AssetDatabase.deleteAsset(EditAssetPopup.assetId, false); + + %this.loadFilters(); + + if(!AssetBrowserFilterTree.selectItem(%currentSelectedItem)) + { + //if it failed, that means we deleted the last item in that category, and we need to do the parent + AssetBrowserFilterTree.selectItem(%currentItemParent); + AssetBrowserFilterTree.expandItem(%currentItemParent); + } +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs new file mode 100644 index 000000000..996bec6f0 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editModule.cs @@ -0,0 +1,127 @@ +// +function AssetBrowser::CreateNewModule(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); + + AssetBrowser_addModuleWindow.callbackFunction = "AssetBrowser.loadFilters();"; +} + +function AssetBrowser_editModule::saveModule(%this) +{ + //Check what special actions we may need to do, such as renames + %moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1); + + %oldModuleName = %moduleDef.ModuleID; + + if(%oldModuleName !$= AssetBrowser.tempModule.ModuleID) + { + //rename the script file and script namespaces + %oldScriptFilePath = "data/" @ %oldModuleName @ "/" @ %moduleDef.scriptFile; + %newscriptFilePath = "data/" @ AssetBrowser.tempModule.ModuleID @ "/"; + %scriptExt = fileExt(%moduleDef.scriptFile); + + %newScriptFileName = %newscriptFilePath @ "/" @ AssetBrowser.tempModule.ModuleID @ %scriptExt; + %newScriptFileOldName = %newscriptFilePath @ "/" @ %oldModuleName @ %scriptExt; + + %moduleDef.ModuleId = AssetBrowser.tempModule.ModuleID; + %moduleDef.scriptFile = AssetBrowser.tempModule.ModuleID @ %scriptExt; + + ModuleDatabase.copyModule(%moduleDef, AssetBrowser.tempModule.ModuleID, "data/" @ AssetBrowser.tempModule.ModuleID); + + //Go through our scriptfile and replace the old namespace with the new + %editedFileContents = ""; + + %file = new FileObject(); + if ( %file.openForRead( %newScriptFileOldName ) ) + { + while ( !%file.isEOF() ) + { + %line = %file.readLine(); + %line = trim( %line ); + + %editedFileContents = %editedFileContents @ strreplace(%line, %oldModuleName, AssetBrowser.tempModule.ModuleID) @ "\n"; + } + + %file.close(); + } + + if(%editedFileContents !$= "") + { + %file.openForWrite(%newScriptFileName); + + %file.writeline(%editedFileContents); + + %file.close(); + } + + %success = fileDelete(%newScriptFileOldName); + + ModuleDatabase.unloadExplicit(%oldModuleName); + + %success = fileDelete("data/" @ %oldModuleName); + + ModuleDatabase.loadExplicit(AssetBrowser.tempModule.ModuleID); + } + + //Now, update the module file itself + //%file = ModuleDatabase.getAssetFilePath(%moduleDef.ModuleID); + //%success = TamlWrite(AssetBrowser_editAsset.editedAsset, %file); + + AssetBrowser.loadFilters(); + + Canvas.popDialog(AssetBrowser_editModule); +} + +function AssetBrowser::editModuleInfo(%this) +{ + Canvas.pushDialog(AssetBrowser_editModule); + + %moduleDef = ModuleDatabase.findModule(AssetBrowser.selectedModule, 1); + + AssetBrowser.tempModule = new ModuleDefinition(); + AssetBrowser.tempModule.assignFieldsFrom(%moduleDef); + + ModuleEditInspector.inspect(AssetBrowser.tempModule); + AssetBrowser_editModule.editedModuleId = AssetBrowser.selectedModule; + AssetBrowser_editModule.editedModule = AssetBrowser.tempModule; + + //remove some of the groups we don't need: + for(%i=0; %i < ModuleEditInspector.getCount(); %i++) + { + %caption = ModuleEditInspector.getObject(%i).caption; + + if(%caption $= "BuildId" || %caption $= "type" || %caption $= "Dependencies" || %caption $= "scriptFile" + || %caption $= "AssetTagsManifest" || %caption $= "ScopeSet" || %caption $= "ModulePath" + || %caption $= "ModuleFile" || %caption $= "ModuleFilePath" || %caption $= "ModuleScriptFilePath" ) + { + ModuleEditInspector.remove(ModuleEditInspector.getObject(%i)); + %i--; + } + } +} + +function AssetBrowser::renameModule(%this) +{ + +} + +function AssetBrowser::reloadModule(%this) +{ + ModuleDatabase.unregisterModule(AssetBrowser.SelectedModule, 1); + ModuleDatabase.loadExplicit(AssetBrowser.SelectedModule); +} + +function AssetBrowser::deleteModule(%this) +{ + +} + +function AssetBrowser::RefreshModuleDependencies(%this) +{ + //Iterate through all our modules + + //then, iterate through the module's assets + + //if an asset has a module that isn't us, queue that into the dependencies list +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs new file mode 100644 index 000000000..fe524ce65 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes.cs @@ -0,0 +1,127 @@ +function GuiVariableInspector::onInspectorFieldModified(%this, %targetObj, %fieldName, %index, %oldValue, %newValue) +{ + echo("FIELD CHANGED: " @ %fieldName @ " from " @ %oldValue @ " to " @ %newValue); +} + +function GuiInspectorVariableGroup::onConstructField(%this, %fieldName, %fieldLabel, %fieldTypeName, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj) +{ + %makeCommand = %this @ ".build" @ %fieldTypeName @ "Field(\""@ %fieldName @ "\",\"" @ %fieldLabel @ "\",\"" @ %fieldDesc @ "\",\"" @ + %fieldDefaultVal @ "\",\"" @ %fieldDataVals @ "\",\"" @ %ownerObj @"\");"; + eval(%makeCommand); +} + +function GuiInspectorVariableGroup::buildListField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %ownerObj) +{ + %extent = 200; + + %fieldCtrl = %this.createInspectorField(); + + %extent = %this.stack.getExtent(); + + %width = mRound(%extent/2); + %height = 20; + %inset = 10; + + /*%container = new GuiControl() { + canSaveDynamicFields = "0"; + Profile = "EditorContainerProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = "0 0"; + Extent = %extent.x SPC %height; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = %tooltip; + tooltipProfile = "EditorToolTipProfile"; + }; + + %labelControl = new GuiTextCtrl() { + canSaveDynamicFields = "0"; + Profile = "EditorFontHLBold"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %inset SPC "0"; + Extent = %width + %inset SPC %height; + MinExtent = "8 2"; + canSave = "0"; + Visible = "1"; + hovertime = "100"; + tooltip = %tooltip; + tooltipProfile = "EditorToolTipProfile"; + text = %fieldLabel; + maxLength = "1024"; + };*/ + + %editControl = new GuiPopUpMenuCtrl() { + class = "guiInspectorListField"; + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + maxLength = "1024"; + Margin = "0 0 0 0"; + Padding = "0 0 0 0"; + AnchorTop = "1"; + AnchorBottom = "0"; + AnchorLeft = "1"; + AnchorRight = "0"; + isContainer = "0"; + Profile = "ToolsGuiPopUpMenuProfile"; + HorizSizing = "right"; + VertSizing = "bottom"; + Position = %fieldCtrl.edit.position; + Extent = %fieldCtrl.edit.extent; + MinExtent = "8 2"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "ToolsGuiToolTipProfile"; + tooltip = %tooltip; + text = %fieldDefaultVal; + hovertime = "1000"; + ownerObject = %ownerObj; + fieldName = %fieldName; + }; + + //set the field value + if(getSubStr(%this.fieldName, 0, 1) $= "$") + { + if(%fieldName $= "") + %editControl.setText(%fieldName); + } + else + { + //regular variable + %setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");"; + eval(%setCommand); + } + + %listCount = getTokenCount(%fieldDataVals, ","); + + for(%i=0; %i < %listCount; %i++) + { + %entryText = getToken(%fieldDataVals, ",", %i); + %editControl.add(%entryText); + } + + %fieldCtrl.setCaption(%fieldLabel); + %fieldCtrl.setEditControl(%editControl); + + %this.addInspectorField(%fieldCtrl); +} + +function guiInspectorListField::onSelect( %this, %id, %text ) +{ + if(getSubStr(%this.fieldName, 0, 1) $= "$") + { + //ah, a global var, just do it straight, then + %setCommand = %this.fieldName @ " = \"" @ %text @ "\";"; + } + else + { + //regular variable + %setCommand = %this.ownerObject @ "." @ %this.fieldName @ " = \"" @ %text @ "\";"; + } + eval(%setCommand); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs new file mode 100644 index 000000000..a2c526251 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/gameObjectCreator.cs @@ -0,0 +1,130 @@ +function GameObjectModuleList::onWake(%this) +{ + %this.refresh(); +} + +function GameObjectModuleList::refresh(%this) +{ + %this.clear(); + + //First, get our list of modules + %moduleList = ModuleDatabase.findModules(); + + %count = getWordCount(%moduleList); + for(%i=0; %i < %count; %i++) + { + %moduleName = getWord(%moduleList, %i); + %this.add(%moduleName.ModuleId, %i); + } +} + +function GameObjectCreatorPkgBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); +} + +function GameObjectCreateBtn::onClick(%this) +{ + %className = GameObjectCreatorName.getText(); + + if(%className $= "") + { + error("Attempted to make a new Game Object with no name!"); + Canvas.popDialog(GameObjectCreator); + return; + } + + //First, find out if this one already exists. If so, we're obviously merely updating it + //also, exec any components that may exist + //find all GameObjectAssets + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) + return; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); + + %createNew = true; + + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); + + if(%gameObjectAsset.gameObjectName $= %className) + { + %createNew = false; + break; + } + } + + %selectedEntity = GameObjectCreator.selectedEntity; + + %selectedEntity.class = %className; + Inspector.inspect(%selectedEntity); + + if(%createNew) + { + //get the selected module data + %moduleName = GameObjectModuleList.getText(); + + %selectedEntity.gameObjectAsset = %moduleName @ ":" @ %className; + + %path = "data/" @ %moduleName @ "/gameObjects/"; + + %file = new FileObject(); + + if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) + { + %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); + %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); + + //todo, pre-write any event functions of interest + + %file.close(); + } + + //set up the paths + %tamlPath = %path @ %className @ ".taml"; + %scriptPath = %path @ %className @ ".cs"; + saveGameObject(%className, %tamlPath, %scriptPath); + + %asset = new GameObjectAsset() + { + AssetName = %className; + VersionId = 1; + gameObjectName=%className; + TAMLFilePath = %tamlPath; + scriptFilePath = %scriptPath; + }; + %assetPath = %path @ %className @ ".asset.taml"; + + //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. + TamlWrite(%selectedEntity, %tamlpath); + TamlWrite(%asset, %assetPath); + + GameObjectCreator.selectedEntity = ""; + + Canvas.popDialog(GameObjectCreator); + + //Load it + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + AssetDatabase.addDeclaredAsset(%moduleDef, %assetPath); + } + else + { + %moduleDef = AssetDatabase.getAssetModule(%assetId); + %moduleName = %moduleDef.ModuleId; + %path = "data/" @ %moduleName @ "/gameObjects/"; + + %selectedEntity.gameObjectAsset = %moduleName @ ":" @ %className; + + %tamlPath = %path @ %className @ ".taml"; + TamlWrite(%selectedEntity, %tamlpath); + + GameObjectCreator.selectedEntity = ""; + + Canvas.popDialog(GameObjectCreator); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs new file mode 100644 index 000000000..ee351a192 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.cs @@ -0,0 +1,663 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +function CreateAssetButton::onClick(%this) +{ + AddNewAssetPopup.showPopup(Canvas); +} + +function AssetBrowser_newAsset::onWake(%this) +{ + NewAssetModuleList.refresh(); + //NewComponentParentClass.setText("Component"); +} + +function AssetBrowser_newAssetWindow::onClose(%this) +{ + NewAssetPropertiesInspector.clearFields(); + Canvas.popDialog(AssetBrowser_newAsset); +} + +function NewAssetTypeList::onWake(%this) +{ + %this.refresh(); +} + +function NewAssetTypeList::refresh(%this) +{ + %this.clear(); + + //TODO: make this more automated + //%this.add("GameObject", 0); + %this.add("Component", 0); + %this.add("Image", 1); + %this.add("Material", 2); + %this.add("Shape", 3); + %this.add("Sound", 4); + %this.add("State Machine", 5); +} + +function NewAssetTypeList::onSelected(%this) +{ + %assetType = %this.getText(); + + if(%assetType $= "Component") + { + NewComponentAssetSettings.hidden = false; + } +} + +function NewAssetModuleBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); +} + +function AssetBrowser::setupCreateNewAsset(%this, %assetType, %moduleName) +{ + Canvas.pushDialog(AssetBrowser_newAsset); + + AssetBrowser_newAssetWindow.text = "New" SPC %assetType SPC "Asset"; + + NewAssetPropertiesInspector.clear(); + + NewAssetModuleList.setText(%moduleName); + + //get rid of the old one if we had one. + if(isObject(%this.newAssetSettings)) + %this.newAssetSettings.delete(); + + %this.newAssetSettings = new ScriptObject(); + + %this.newAssetSettings.assetType = %assetType; + %this.newAssetSettings.moduleName = %moduleName; + + %shortAssetTypeName = strreplace(%assetType, "Asset", ""); + + NewAssetPropertiesInspector.startGroup("General"); + NewAssetPropertiesInspector.addField("assetName", "New Asset Name", "String", "Name of the new asset", "New" @ %shortAssetTypeName, "", %this.newAssetSettings); + //NewAssetPropertiesInspector.addField("AssetType", "New Asset Type", "List", "Type of the new asset", %assetType, "Component,Image,Material,Shape,Sound,State Machine", %newAssetSettings); + + NewAssetPropertiesInspector.addField("friendlyName", "Friendly Name", "String", "Human-readable name of new asset", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("description", "Description", "Command", "Description of the new asset", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + + if(%assetType $= "ComponentAsset") + { + NewAssetPropertiesInspector.startGroup("Components"); + NewAssetPropertiesInspector.addField("parentClass", "New Asset Parent Class", "String", "Name of the new asset's parent class", "Component", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("componentGroup", "Component Group", "String", "Name of the group of components this component asset belongs to", "", "", %this.newAssetSettings); + //NewAssetPropertiesInspector.addField("componentName", "Component Name", "String", "Name of the new component", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + else if(%assetType $= "LevelAsset") + { + NewAssetPropertiesInspector.startGroup("Level"); + NewAssetPropertiesInspector.addField("levelPreviewImage", "LevePreviewImage", "Image", "Preview Image for the level", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + else if(%assetType $= "ScriptAsset") + { + NewAssetPropertiesInspector.startGroup("Script"); + NewAssetPropertiesInspector.addField("isServerScript", "Is Server Script", "bool", "Is this script used on the server?", "1", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + } + /*else if(%assetType $= "ShapeAnimationAsset") + { + NewAssetPropertiesInspector.startGroup("Animation"); + NewAssetPropertiesInspector.addField("sourceFile", "Source File", "filename", "Source file this animation will pull from", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("animationName", "Animation Name", "string", "Name of the animation clip when used in a shape", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("startFrame", "Starting Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("endFrame", "Ending Frame", "int", "Source file this animation will pull from", "", "", %this.newAssetSettings); + + NewAssetPropertiesInspector.addField("padRotation", "Pad Rotations", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); + NewAssetPropertiesInspector.addField("padTransforms", "Pad Transforms", "bool", "Source file this animation will pull from", "0", "", %this.newAssetSettings); + NewAssetPropertiesInspector.endGroup(); + }*/ + + return; + + if(%moduleName $= "") + { + Canvas.pushDialog(AssetBrowser_selectModule); + } + else + { + AssetBrowser.SelectedModule = %moduleName; + + if(%assetType $= "MaterialAsset") + { + createNewMaterialAsset("NewMaterial", %moduleName); + } + else if(%assetType $= "StateMachineAsset") + { + createNewStateMachineAsset("NewStateMachine", %moduleName); + } + else if(%assetType $= "ScriptAsset") + { + createNewScriptAsset("NewScriptAsset", %moduleName); + } + } +} + +//We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function +function CreateNewAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + if(%assetName $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no name!"); + return; + } + + //get the selected module data + %moduleName = NewAssetModuleList.getText(); + + if(%moduleName $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no module!"); + return; + } + + AssetBrowser.newAssetSettings.moduleName = %moduleName; + + %assetType = AssetBrowser.newAssetSettings.assetType; + if(%assetType $= "") + { + MessageBoxOK( "Error", "Attempted to make a new asset with no type!"); + return; + } + + if(%assetType $= "ComponentAsset") + { + //Canvas.popDialog(AssetBrowser_newComponentAsset); + //AssetBrowser_newComponentAsset-->AssetBrowserModuleList.setText(AssetBrowser.selectedModule); + %assetFilePath = createNewComponentAsset(%assetName, %path); + } + else if(%assetType $= "MaterialAsset") + { + %assetFilePath = createNewMaterialAsset(); + } + else if(%assetType $= "StateMachineAsset") + { + %assetFilePath = createNewStateMachineAsset(); + } + else if(%assetType $= "GUIAsset") + { + %assetFilePath = createNewGUIAsset(); + } + else if(%assetType $= "LevelAsset") + { + %assetFilePath = createNewLevelAsset(); + } + else if(%assetType $= "ScriptAsset") + { + %assetFilePath = createNewScriptAsset(); + } + else if(%assetType $= "ShapeAnimationAsset") + { + %assetFilePath = createShapeAnimationAsset(); + } + + Canvas.popDialog(AssetBrowser_newAsset); + + //Load it + %moduleDef = ModuleDatabase.findModule(%moduleName,1); + AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath); + + AssetBrowser.loadFilters(); +} + +function createNewComponentAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/components/" @ %assetName @ ".asset.taml"; + %scriptPath = %modulePath @ "/components/" @ %assetName @ ".cs"; + + %asset = new ComponentAsset() + { + AssetName = %assetName; + versionId = 1; + componentName = %assetName; + componentClass = AssetBrowser.newAssetSettings.parentClass; + friendlyName = AssetBrowser.newAssetSettings.friendlyName; + componentType = AssetBrowser.newAssetSettings.componentGroup; + description = AssetBrowser.newAssetSettings.description; + scriptFile = %scriptPath; + }; + + TamlWrite(%asset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + //TODO: enable ability to auto-embed a header for copyright or whatnot + %file.writeline("//onAdd is called when the component is created and then added to it's owner entity.\n"); + %file.writeline("//You would also add any script-defined component fields via addComponentField().\n"); + %file.writeline("function " @ %assetName @ "::onAdd(%this)\n{\n\n}\n"); + %file.writeline("//onAdd is called when the component is removed and deleted from it's owner entity."); + %file.writeline("function " @ %assetName @ "::onRemove(%this)\n{\n\n}\n"); + %file.writeline("//onClientConnect is called any time a new client connects to the server."); + %file.writeline("function " @ %assetName @ "::onClientConnect(%this, %client)\n{\n\n}\n"); + %file.writeline("//onClientDisconnect is called any time a client disconnects from the server."); + %file.writeline("function " @ %assetName @ "::onClientDisonnect(%this, %client)\n{\n\n}\n"); + %file.writeline("//update is called when the component does an update tick.\n"); + %file.writeline("function " @ %assetName @ "::Update(%this)\n{\n\n}\n"); + + %file.close(); + } + + Canvas.popDialog(AssetBrowser_newComponentAsset); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Components"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewMaterialAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %tamlpath = %modulePath @ "/materials/" @ %assetName @ ".asset.taml"; + %sgfPath = %modulePath @ "/materials/" @ %assetName @ ".sgf"; + + %asset = new MaterialAsset() + { + AssetName = %assetName; + versionId = 1; + shaderData = ""; + shaderGraph = %sgfPath; + }; + + TamlWrite(%asset, %tamlpath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Materials"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewScriptAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/scripts/" @ %assetName @ ".asset.taml"; + %scriptPath = %modulePath @ "/scripts/" @ %assetName @ ".cs"; + + %asset = new ScriptAsset() + { + AssetName = %assetName; + versionId = 1; + scriptFilePath = %scriptPath; + }; + + TamlWrite(%asset, %tamlpath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Scripts"); + + AssetBrowserFilterTree.onSelect(%smItem); + + %file = new FileObject(); + + if(%file.openForWrite(%scriptPath)) + { + %file.close(); + } + + return %tamlpath; +} + +function createNewStateMachineAsset() +{ + %assetName = AssetBrowser.newAssetSettings.assetName; + + %assetQuery = new AssetQuery(); + + %matchingAssetCount = AssetDatabase.findAssetName(%assetQuery, %assetName); + + %i=1; + while(%matchingAssetCount > 0) + { + %newAssetName = %assetName @ %i; + %i++; + + %matchingAssetCount = AssetDatabase.findAssetName(%assetQuery, %newAssetName); + } + + %assetName = %newAssetName; + + %assetQuery.delete(); + + %tamlpath = "data/" @ %moduleName @ "/stateMachines/" @ %assetName @ ".asset.taml"; + %smFilePath = "data/" @ %moduleName @ "/stateMachines/" @ %assetName @ ".xml"; + + %asset = new StateMachineAsset() + { + AssetName = %assetName; + versionId = 1; + stateMachineFile = %smFilePath; + }; + + %xmlDoc = new SimXMLDocument(); + %xmlDoc.saveFile(%smFilePath); + %xmlDoc.delete(); + + TamlWrite(%asset, %tamlpath); + + //Now write our XML file + %xmlFile = new FileObject(); + %xmlFile.openForWrite(%smFilePath); + %xmlFile.writeLine(""); + %xmlFile.writeLine(""); + %xmlFile.close(); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "StateMachines"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewGUIAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/GUIs/" @ %assetName @ ".asset.taml"; + %guipath = %modulePath @ "/GUIs/" @ %assetName @ ".gui"; + %scriptPath = %modulePath @ "/GUIs/" @ %assetName @ ".cs"; + + %asset = new GUIAsset() + { + AssetName = %assetName; + versionId = 1; + scriptFilePath = %scriptPath; + guiFilePath = %guipath; + }; + + TamlWrite(%asset, %tamlpath); + + %file = new FileObject(); + + if(%file.openForWrite(%guipath)) + { + %file.writeline("//--- OBJECT WRITE BEGIN ---"); + %file.writeline("%guiContent = new GuiControl(" @ %assetName @ ") {"); + %file.writeline(" position = \"0 0\";"); + %file.writeline(" extent = \"100 100\";"); + %file.writeline("};"); + %file.writeline("//--- OBJECT WRITE END ---"); + + %file.close(); + } + + if(%file.openForWrite(%scriptPath)) + { + %file.writeline("function " @ %assetName @ "::onWake(%this)\n{\n\n}\n"); + %file.writeline("function " @ %assetName @ "::onSleep(%this)\n{\n\n}\n"); + + %file.close(); + } + + //load the gui + exec(%guipath); + exec(%scriptPath); + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "GUIs"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewLevelAsset() +{ + %moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/levels/" @ %assetName @ ".asset.taml"; + %levelPath = %modulePath @ "/levels/" @ %assetName @ ".mis"; + + %asset = new LevelAsset() + { + AssetName = %assetName; + versionId = 1; + LevelFile = %levelPath; + LevelDescription = AssetBrowser.newAssetSettings.levelDescription; + PreviewImage = AssetBrowser.newAssetSettings.levelPreviewImage; + }; + + TamlWrite(%asset, %tamlpath); + + if(!pathCopy("tools/levels/BlankRoom.mis", %levelPath, false)) + { + echo("Unable to copy template level file!"); + } + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath; +} + +function createNewShapeAnimationAsset() +{ + %dlg = new OpenFileDialog() + { + Filters = "Animation Files(*.dae, *.cached.dts)|*.dae;*.cached.dts"; + DefaultPath = $Pref::WorldEditor::LastPath; + DefaultFile = ""; + ChangePath = false; + OverwritePrompt = true; + forceRelativePath = false; + //MultipleFiles = true; + }; + + %ret = %dlg.Execute(); + + if ( %ret ) + { + $Pref::WorldEditor::LastPath = filePath( %dlg.FileName ); + %fullPath = %dlg.FileName; + } + + %dlg.delete(); + + if ( !%ret ) + return; + + /*%moduleName = AssetBrowser.newAssetSettings.moduleName; + %modulePath = "data/" @ %moduleName; + + %assetName = AssetBrowser.newAssetSettings.assetName; + + %tamlpath = %modulePath @ "/levels/" @ %assetName @ ".asset.taml"; + %levelPath = %modulePath @ "/levels/" @ %assetName @ ".mis"; + + %asset = new ShapeAnimationAsset() + { + AssetName = %assetName; + versionId = 1; + LevelFile = %levelPath; + LevelDescription = AssetBrowser.newAssetSettings.levelDescription; + PreviewImage = AssetBrowser.newAssetSettings.levelPreviewImage; + }; + + TamlWrite(%asset, %tamlpath); + + if(!pathCopy("tools/levels/BlankRoom.mis", %levelPath, false)) + { + echo("Unable to copy template level file!"); + } + + %moduleDef = ModuleDatabase.findModule(%moduleName, 1); + AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath); + + AssetBrowser.loadFilters(); + + %treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName); + %smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels"); + + AssetBrowserFilterTree.onSelect(%smItem); + + return %tamlpath;*/ +} + +function ParentComponentList::onWake(%this) +{ + %this.refresh(); +} + +function ParentComponentList::refresh(%this) +{ + %this.clear(); + + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "ComponentAsset")) + return; //if we didn't find ANY, just exit + + // Find all the types. + %count = %assetQuery.getCount(); + + /*%categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentName = %componentAsset.componentName; + + if(%componentName $= "") + %componentName = %componentAsset.componentClass; + + %this.add(%componentName, %i); + }*/ + + %categories = ""; + for (%i = 0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentClass = %componentAsset.componentClass; + if (!isInList(%componentClass, %categories)) + %categories = %categories TAB %componentClass; + } + + %categories = trim(%categories); + + %index = 0; + %categoryCount = getFieldCount(%categories); + for (%i = 0; %i < %categoryCount; %i++) + { + %category = getField(%categories, %i); + %this.addCategory(%category); + + for (%j = 0; %j < %count; %j++) + { + %assetId = %assetQuery.getAsset(%j); + + %componentAsset = AssetDatabase.acquireAsset(%assetId); + %componentName = %componentAsset.componentName; + %componentClass = %componentAsset.componentClass; + + if (%componentClass $= %category) + { + if(%componentName !$= "") + %this.add(" "@%componentName, %i); + } + } + } +} + +//---------------------------------------------------------- +// Game Object creation +//---------------------------------------------------------- +function EWorldEditor::createGameObject( %this ) +{ + GameObjectCreatorObjectName.text = ""; + + %activeSelection = %this.getActiveSelection(); + if( %activeSelection.getCount() == 0 ) + return; + + GameObjectCreator.selectedEntity = %activeSelection.getObject( 0 ); + + Canvas.pushDialog(GameObjectCreator); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs new file mode 100644 index 000000000..12f422485 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.cs @@ -0,0 +1,154 @@ +function AssetBrowser::buildPopupMenus(%this) +{ + if( !isObject( AddNewModulePopup ) ) + { + new PopupMenu( AddNewModulePopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + isPopup = true; + + item[ 0 ] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();"; + item[ 1 ] = "Refresh Module Dependencies" TAB "" TAB "AssetBrowser.RefreshModuleDependencies();"; + }; + } + + if( !isObject( EditAssetPopup ) ) + { + new PopupMenu( EditAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Edit Asset" TAB "" TAB "AssetBrowser.editAsset();"; + item[ 1 ] = "Rename Asset" TAB "" TAB "AssetBrowser.renameAsset();"; + item[ 2 ] = "Refresh Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; + item[ 3 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();"; + item[ 4 ] = "-"; + Item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; + item[ 6 ] = "-"; + item[ 7 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();"; + item[ 8 ] = "-"; + item[ 9 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();"; + + jumpFileName = ""; + jumpLineNumber = ""; + }; + } + + if( !isObject( AddNewComponentAssetPopup ) ) + { + new PopupMenu( AddNewComponentAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + //item[ 0 ] = "Create Component" TAB "" TAB "Canvas.pushDialog(AssetBrowser_newComponentAsset); AssetBrowser_newComponentAsset-->NewComponentPackageList.setText(AssetBrowser.selectedModule);"; + item[ 0 ] = "Component" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ComponentAsset\", AssetBrowser.selectedModule);"; + + //list other common component types here to shortcut the creation process + }; + } + + if( !isObject( AddNewScriptAssetPopup ) ) + { + %this.AddNewScriptAssetPopup = new PopupMenu( AddNewScriptAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create Component" TAB AddNewComponentAssetPopup; + item[ 1 ] = "Create Script" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ScriptAsset\", AssetBrowser.selectedModule);"; + item[ 2 ] = "Create State Machine" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"StateMachineAsset\", AssetBrowser.selectedModule);"; + //item[ 3 ] = "-"; + //item[ 3 ] = "Create Game Object" TAB "" TAB "AssetBrowser.createNewGameObjectAsset(\"NewGameObject\", AssetBrowser.selectedModule);"; + }; + //%this.AddNewScriptAssetPopup.insertSubMenu(0, "Create Component", AddNewComponentAssetPopup); + } + + if( !isObject( AddNewArtAssetPopup ) ) + { + %this.AddNewArtAssetPopup = new PopupMenu( AddNewArtAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create Material" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"MaterialAsset\", AssetBrowser.selectedModule);";//"createNewMaterialAsset(\"NewMaterial\", AssetBrowser.selectedModule);"; + item[ 1 ] = "Create Image" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ImageAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewImageAsset(\"NewImage\", AssetBrowser.selectedModule);"; + item[ 2 ] = "-"; + item[ 3 ] = "Create Shape" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"Shape\", AssetBrowser.selectedModule);"; + item[ 4 ] = "Create Shape Animation" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ShapeAnimationAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewShapeAnimationAsset(\"NewShapeAnimation\", AssetBrowser.selectedModule);"; + item[ 5 ] = "-"; + item[ 6 ] = "Create GUI" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"GUIAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewGUIAsset(\"NewGUI\", AssetBrowser.selectedModule);"; + item[ 7 ] = "-"; + item[ 8 ] = "Create Post Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"PostEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewPostEffectAsset(\"NewPostEffect\", AssetBrowser.selectedModule);"; + item[ 9 ] = "-"; + item[ 10 ] = "Create Sound" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"SoundAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewSoundAsset(\"NewSound\", AssetBrowser.selectedModule);"; + item[ 11 ] = "-"; + item[ 12 ] = "Create Particle Effect" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"ParticleEffectAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewParticleEffectAsset(\"NewParticleEffect\", AssetBrowser.selectedModule);"; + }; + } + + if( !isObject( AddNewAssetPopup ) ) + { + %this.AddNewAssetPopup = new PopupMenu( AddNewAssetPopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + + item[0] = "Create Code Asset" TAB AddNewScriptAssetPopup; + item[1] = "-"; + item[2] = "Create Art Asset" TAB AddNewArtAssetPopup; + item[3] = "-"; + item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);"; + }; + } + + if( !isObject( EditModulePopup ) ) + { + new PopupMenu( EditModulePopup ) + { + superClass = "MenuBuilder"; + class = "EditorWorldMenu"; + //isPopup = true; + + item[ 0 ] = "Create New Asset" TAB AddNewAssetPopup; + item[ 1 ] = "Reload Module" TAB "" TAB "AssetBrowser.reloadModule();"; + Item[ 2 ] = "-"; + Item[ 3 ] = "Edit Module" TAB "" TAB "AssetBrowser.editModuleInfo();"; + Item[ 4 ] = "-"; + Item[ 5 ] = "Duplicate Module" TAB "" TAB "AssetBrowser.copyModule();"; + Item[ 6 ] = "-"; + Item[ 7 ] = "Delete Module" TAB "" TAB "AssetBrowser.deleteModule();"; + }; + } + + //Some assets are not yet ready/implemented, so disable their creation here + AddNewArtAssetPopup.enableItem(3, false); //shape + AddNewArtAssetPopup.enableItem(4, false); //shape animation + AddNewArtAssetPopup.enableItem(8, false); //post effect + AddNewArtAssetPopup.enableItem(10, false); //sound asset + AddNewArtAssetPopup.enableItem(12, false); //particle effect + + AddNewScriptAssetPopup.enableItem(2, false); //state machine +} + +function AddNewScriptAssetPopupMenu::onSelectItem(%this, %id, %text) +{ + return true; +} +function AddNewScriptAssetPopupMenu::setupDefaultState(%this) +{ + // Setup camera speed gui's. Both menu and editorgui + %this.setupGuiControls(); + + Parent::setupDefaultState(%this); +} + +function AddNewScriptAssetPopupMenu::setupGuiControls(%this) +{ +} diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs new file mode 100644 index 000000000..3c2c7c1ea --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectModule.cs @@ -0,0 +1,17 @@ +function AssetBrowser_selectModule::onWake(%this) +{ + AssetBrowser_SelectModuleWindow-->ModuleList.refresh(); +} + +function SelectModule_NewAssetModuleBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddModule); + AssetBrowser_addModuleWindow.selectWindow(); + + AssetBrowser_AddModule.callback = "AssetBrowser_selectModule.newModuleAdded();"; +} + +function AssetBrowser_selectModule::newModuleAdded(%this) +{ + AssetBrowser_SelectModuleWindow-->ModuleList.refresh(); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs new file mode 100644 index 000000000..42f66ddb1 --- /dev/null +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/selectPackage.cs @@ -0,0 +1,17 @@ +function AssetBrowser_selectPackage::onWake(%this) +{ + AssetBrowser_SelectPackageWindow-->packageList.refresh(); +} + +function SelectPackage_NewAssetPackageBtn::onClick(%this) +{ + Canvas.pushDialog(AssetBrowser_AddPackage); + AssetBrowser_addPackageWindow.selectWindow(); + + AssetBrowser_AddPackage.callback = "AssetBrowser_selectPackage.newPackageAdded();"; +} + +function AssetBrowser_selectPackage::newPackageAdded(%this) +{ + AssetBrowser_SelectPackageWindow-->packageList.refresh(); +} \ No newline at end of file From e9dbe788f6ee73ea7f2437aa1e6e32d52681b635 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 15:32:31 -0600 Subject: [PATCH 104/312] Added useful new icons for the editors. --- .../BaseGame/game/tools/gui/images/iconError.png | Bin 0 -> 723 bytes .../BaseGame/game/tools/gui/images/iconWarn.png | Bin 0 -> 1870 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Templates/BaseGame/game/tools/gui/images/iconError.png create mode 100644 Templates/BaseGame/game/tools/gui/images/iconWarn.png diff --git a/Templates/BaseGame/game/tools/gui/images/iconError.png b/Templates/BaseGame/game/tools/gui/images/iconError.png new file mode 100644 index 0000000000000000000000000000000000000000..b0947dd84e8b0eab66e1910c14add86053de6d98 GIT binary patch literal 723 zcmV;^0xbQBP)bEicT4o15K<t z2%%Ym%0h2K3c67#ecaq~&T7g`AD{i6-#Nc7tcjW3)VVxxK77CDdk*lArTyMWMj~~J zI3z*cO4wBlhEg&^;C@yVZF)9j90^E;BSFd3>pd5!)|;E5o$vyd1$#Y>jmb%DZe-U; zQKV(y#qc3ODjW$CQQxWCw{-pD1<>+5u$}^hfL3-An%|G?%U4JxmUftA&y}I^;R0YK z96qavXUcE1`aG8}fnuXDcP$)${1gBndY?cE3utV?*YOE_UQec3$?Mmi$Ce!cpolv? zzH(pb`9{$6Yfyd{oHq;BXlny(nXqRjP|?U@m5$7?5!T)y-GIN_G_hq^PFI;{h^BAfG=nGLgwaEEy>A`@vGy6aY%t z;H@q2_Z-}0{WW(f8BhRg5&%&2Q^D%)N+M9IdqK%8NbITj5_)iO+TlQPpdPt+9Bj+g zeG4oHva_>Lz5pnfhwGRN08kknL1lDgZ;?uYloPJg0VL;QU?m6km#F06wqBCXzKOxr z-T}@#pgEoUDUbrV2;TO4SeY8bwlLGAslfw>^geVy$V&EAl$GlhZFe9N283aN1*5n= z0C(*fq^3rZ$bQ;kje9!A7KRU<^4mvugG{p5O`^KCp%v~b-(HOAB#gOfm}IT7#*tsc ze|)Byhd1k#v_sO#-HNG72^-SM8O7AkQbs$*KN|R-^#en8O%>sG@_7IN002ovPDHLk FV1lu1Jxu@r literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/gui/images/iconWarn.png b/Templates/BaseGame/game/tools/gui/images/iconWarn.png new file mode 100644 index 0000000000000000000000000000000000000000..4c97ba74b669d26ff35a5d4d4897b58918a69d6f GIT binary patch literal 1870 zcmV-U2eJ5xP)G42oX?G6gHrU5HKc2i3!RgkvA~=-YXB?yF2eq_j_+=XJ^K+m2_sOce=ak z@9OIAs%n^^3A(RIjrRcJQ3O^3OMot59xw~&1g4mum4TbUb>JFs5jYE+QY9+?I{?Jv zAz&S_7FYx1>+C83jsk~(k5!3(+8O}y=ms_cuZ=XQPx0s$k8j08tfjnAr1G9fa7F5-;EL{}yilCuXdb$oEqsr7_*RDQz9`}!k%p6h zME7k6!55F7W(nVGpYbjc|DcRJ`3Ln_b|8AkTlhZfz?IF?bgFC)#lu$mnmF?%5&wX+ zjQj&4Ua4C6QEP(Ay5@o1(Ux{$W$+JNZ}dNM(Bl5H4umVq0Y6jh=rvg^_b2 zcbD6(bXKx%ugi7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Y-KGE^4;({*1qp@)UHW{8YELBasgZOsWR&q+^M2=8d--Dz#^Qtr}i(^6!DbD9@> z?qF()O#Mkxpf8QZJ&=Dny_2vXg5&ytBA3lQ{q~51Ma|Y%+T2oovB{Er6?_7f9^<~K zp~fUhRe{j!oUO{{s7f{`PcTV?#wTIYnJ77&Df;R71CX34D&v+YnMo6dbA=B#J6E_l zsj}5J!I>k>dZNvTfXv*PKx&NNcIlyS^hm#XDLH9ZR2j@^Ffc3^*3;+NC07*qo IM6N<$f@Fkoh5!Hn literal 0 HcmV?d00001 From 57284507f2ba6a00ea9d123684b8c174e9653cc2 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 16:58:00 -0600 Subject: [PATCH 105/312] Adds the Systems for the Entity-Component-Systems setup. --- Engine/source/T3D/systems/componentSystem.h | 30 ++ .../T3D/systems/render/meshRenderSystem.cpp | 375 ++++++++++++++++++ .../T3D/systems/render/meshRenderSystem.h | 207 ++++++++++ Engine/source/T3D/systems/updateSystem.cpp | 34 ++ Engine/source/T3D/systems/updateSystem.h | 16 + .../gui/containers/guiDragAndDropCtrl.h | 2 +- Tools/CMake/torque3d.cmake | 11 +- 7 files changed, 666 insertions(+), 9 deletions(-) create mode 100644 Engine/source/T3D/systems/componentSystem.h create mode 100644 Engine/source/T3D/systems/render/meshRenderSystem.cpp create mode 100644 Engine/source/T3D/systems/render/meshRenderSystem.h create mode 100644 Engine/source/T3D/systems/updateSystem.cpp create mode 100644 Engine/source/T3D/systems/updateSystem.h diff --git a/Engine/source/T3D/systems/componentSystem.h b/Engine/source/T3D/systems/componentSystem.h new file mode 100644 index 000000000..fc106a6a2 --- /dev/null +++ b/Engine/source/T3D/systems/componentSystem.h @@ -0,0 +1,30 @@ +#pragma once +#include "console/engineAPI.h" + +template +class SystemInterface +{ +public: + bool mIsEnabled; + bool mIsServer; + + static Vector all; + + SystemInterface() + { + all.push_back((T*)this); + } + + virtual ~SystemInterface() + { + for (U32 i = 0; i < all.size(); i++) + { + if (all[i] == (T*)this) + { + all.erase(i); + return; + } + } + } +}; +template Vector SystemInterface::all(0); \ No newline at end of file diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.cpp b/Engine/source/T3D/systems/render/meshRenderSystem.cpp new file mode 100644 index 000000000..214a63dfe --- /dev/null +++ b/Engine/source/T3D/systems/render/meshRenderSystem.cpp @@ -0,0 +1,375 @@ +#include "T3D/systems/render/meshRenderSystem.h" +#include "gfx/gfxTransformSaver.h" +#include "lighting/lightQuery.h" + +#include "renderInstance/renderPassManager.h" +#include "materials/materialManager.h" +#include "materials/baseMatInstance.h" + +Vector MeshRenderSystem::mBufferMaterials(0); +Vector MeshRenderSystem::mStaticBuffers(0); + +void MeshRenderSystem::render(SceneManager *sceneManager, SceneRenderState* state) +{ + Frustum viewFrustum = state->getCullingFrustum(); + MatrixF camTransform = state->getCameraTransform(); + + U32 count = MeshRenderSystemInterface::all.size(); + for (U32 i = 0; i < count; i++) + { + //Server side items exist for data, but we don't actually render them + bool isClient = MeshRenderSystemInterface::all[i]->mIsClient; + if (!MeshRenderSystemInterface::all[i]->mIsClient) + continue; + + bool isStatic = MeshRenderSystemInterface::all[i]->mStatic; + if (MeshRenderSystemInterface::all[i]->mStatic) + continue; + + //First, do frustum culling + if (viewFrustum.isCulled(MeshRenderSystemInterface::all[i]->mBounds)) + continue; + + // Set the query box for the container query. Never + // make it larger than the frustum's AABB. In the editor, + // always query the full frustum as that gives objects + // the opportunity to render editor visualizations even if + // they are otherwise not in view. + if (!state->getCullingFrustum().getBounds().isOverlapped(state->getRenderArea())) + { + // This handles fringe cases like flying backwards into a zone where you + // end up pretty much standing on a zone border and looking directly into + // its "walls". In that case the traversal area will be behind the frustum + // (remember that the camera isn't where visibility starts, it's the near + // distance). + + continue; + } + + //We can then sort our objects by range since we have it already, so we can do occlusion culling be rendering front-to-back + + //if we've made it this far, call down to the render function to actually display our stuff + renderInterface(i, state); + } + + //Static Batch rendering + if ( /*!mMaterialInst ||*/ !state) + return; + + BaseMatInstance *matInst = MATMGR->getWarningMatInstance(); + + // Get a handy pointer to our RenderPassmanager + RenderPassManager *renderPass = state->getRenderPass(); + + for (U32 i = 0; i < mStaticBuffers.size(); i++) + { + for (U32 b = 0; b < mStaticBuffers[i].buffers.size(); b++) + { + if (mStaticBuffers[i].buffers[b].vertData.empty()) + continue; + + MeshRenderInst *ri = renderPass->allocInst(); + + // Set our RenderInst as a standard mesh render + ri->type = RenderPassManager::RIT_Mesh; + + //If our material has transparency set on this will redirect it to proper render bin + if (matInst->getMaterial()->isTranslucent()) + { + ri->type = RenderPassManager::RIT_Translucent; + ri->translucentSort = true; + } + + // Calculate our sorting point + if (state) + { + // Calculate our sort point manually. + const Box3F& rBox = Box3F(1000);// getRenderWorldBox(); + ri->sortDistSq = rBox.getSqDistanceToPoint(state->getCameraPosition()); + } + else + ri->sortDistSq = 0.0f; + + // Set up our transforms + MatrixF objectToWorld = MatrixF::Identity;//getRenderTransform(); + //objectToWorld.scale(getScale()); + + ri->objectToWorld = renderPass->allocUniqueXform(objectToWorld); + ri->worldToCamera = renderPass->allocSharedXform(RenderPassManager::View); + ri->projection = renderPass->allocSharedXform(RenderPassManager::Projection); + + // If our material needs lights then fill the RIs + // light vector with the best lights. + /*if (matInst->isForwardLit()) + { + LightQuery query; + query.init(getWorldSphere()); + query.getLights(ri->lights, 8); + }*/ + + // Make sure we have an up-to-date backbuffer in case + // our Material would like to make use of it + // NOTICE: SFXBB is removed and refraction is disabled! + //ri->backBuffTex = GFX->getSfxBackBuffer(); + + // Set our Material + ri->matInst = matInst; + + // Set up our vertex buffer and primitive buffer + ri->vertBuff = &mStaticBuffers[i].buffers[b].vertexBuffer; + ri->primBuff = &mStaticBuffers[i].buffers[b].primitiveBuffer; + + ri->prim = renderPass->allocPrim(); + ri->prim->type = GFXTriangleList; + ri->prim->minIndex = 0; + ri->prim->startIndex = 0; + ri->prim->numPrimitives = mStaticBuffers[i].buffers[b].primData.size(); + ri->prim->startVertex = 0; + ri->prim->numVertices = mStaticBuffers[i].buffers[b].vertData.size(); + + // We sort by the material then vertex buffer + ri->defaultKey = matInst->getStateHint(); + ri->defaultKey2 = (uintptr_t)ri->vertBuff; // Not 64bit safe! + + // Submit our RenderInst to the RenderPassManager + state->getRenderPass()->addInst(ri); + } + } +} + +void MeshRenderSystem::renderInterface(U32 interfaceIndex, SceneRenderState* state) +{ + //Fetch + MeshRenderSystemInterface* interface = MeshRenderSystemInterface::all[interfaceIndex]; + + if (interface->mShapeInstance == nullptr) + return; + + Point3F cameraOffset; + interface->mTransform.getColumn(3, &cameraOffset); + cameraOffset -= state->getDiffuseCameraPosition(); + F32 dist = cameraOffset.len(); + if (dist < 0.01f) + dist = 0.01f; + + Point3F objScale = interface->mScale; + F32 invScale = (1.0f / getMax(getMax(objScale.x, objScale.y), objScale.z)); + + interface->mShapeInstance->setDetailFromDistance(state, dist * invScale); + + if (interface->mShapeInstance->getCurrentDetail() < 0) + return; + + GFXTransformSaver saver; + + // Set up our TS render state. + TSRenderState rdata; + rdata.setSceneState(state); + rdata.setFadeOverride(1.0f); + rdata.setOriginSort(false); + + // We might have some forward lit materials + // so pass down a query to gather lights. + LightQuery query; + query.init(interface->mSphere); + rdata.setLightQuery(&query); + + MatrixF mat = interface->mTransform; + + mat.scale(objScale); + GFX->setWorldMatrix(mat); + + interface->mShapeInstance->render(rdata); +} + +void MeshRenderSystem::rebuildBuffers() +{ + U32 BUFFER_SIZE = 65000; + Vector tempIndices; + tempIndices.reserve(4); + + Box3F newBounds = Box3F::Zero; + + mStaticBuffers.clear(); + + for (U32 i = 0; i < MeshRenderSystemInterface::all.size(); i++) + { + if (!MeshRenderSystemInterface::all[i]->mIsEnabled) + continue; + + if (!MeshRenderSystemInterface::all[i]->mIsClient || !MeshRenderSystemInterface::all[i]->mStatic) + continue; + + //TODO: Properly re-implement StaticElements to container owner interfaces and buffer sets + for (U32 j = 0; j < MeshRenderSystemInterface::all[i]->mGeometry.mPolyList.size(); j++) + { + const OptimizedPolyList::Poly& poly = MeshRenderSystemInterface::all[i]->mGeometry.mPolyList[j]; + + if (poly.vertexCount < 3) + continue; + + tempIndices.setSize(poly.vertexCount); + dMemset(tempIndices.address(), 0, poly.vertexCount); + + if (poly.type == OptimizedPolyList::TriangleStrip || + poly.type == OptimizedPolyList::TriangleFan) + { + tempIndices[0] = 0; + U32 idx = 1; + + for (U32 k = 1; k < poly.vertexCount; k += 2) + tempIndices[idx++] = k; + + for (U32 k = ((poly.vertexCount - 1) & (~0x1)); k > 0; k -= 2) + tempIndices[idx++] = k; + } + else if (poly.type == OptimizedPolyList::TriangleList) + { + for (U32 k = 0; k < poly.vertexCount; k++) + tempIndices[k] = k; + } + else + continue; + + //got our data, now insert it into the correct buffer! + S32 bufferId = findBufferSetByMaterial(poly.material); + + if (bufferId == -1) + { + //add a new buffer set if we didn't get a match! + BufferSet newSet; + newSet.surfaceMaterialId = poly.material; + + mStaticBuffers.push_back(newSet); + + bufferId = mStaticBuffers.size() - 1; + } + + //see if this would push us over our buffer size limit, if it is, make a new buffer for this set + if (mStaticBuffers[bufferId].buffers.last().vertData.size() + 3 > BUFFER_SIZE + || mStaticBuffers[bufferId].buffers.last().primData.size() + 1 > BUFFER_SIZE) + { + //yep, we'll overstep with this, so spool up a new buffer in this set + BufferSet::Buffers newBuffer = BufferSet::Buffers(); + mStaticBuffers[bufferId].buffers.push_back(newBuffer); + } + + const U32& firstIdx = MeshRenderSystemInterface::all[i]->mGeometry.mIndexList[poly.vertexStart]; + const OptimizedPolyList::VertIndex& firstVertIdx = MeshRenderSystemInterface::all[i]->mGeometry.mVertexList[firstIdx]; + + //Vector geomPoints = MeshRenderSystemInterface::all[i]->mGeometry.mPoints; + //Vector geomNormals = MeshRenderSystemInterface::all[i]->mGeometry.mNormals; + //Vector geoUVs = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s; + + for (U32 k = 1; k < poly.vertexCount - 1; k++) + { + const U32& secondIdx = MeshRenderSystemInterface::all[i]->mGeometry.mIndexList[poly.vertexStart + tempIndices[k]]; + const U32& thirdIdx = MeshRenderSystemInterface::all[i]->mGeometry.mIndexList[poly.vertexStart + tempIndices[k + 1]]; + + const OptimizedPolyList::VertIndex& secondVertIdx = MeshRenderSystemInterface::all[i]->mGeometry.mVertexList[secondIdx]; + const OptimizedPolyList::VertIndex& thirdVertIdx = MeshRenderSystemInterface::all[i]->mGeometry.mVertexList[thirdIdx]; + + Point3F points[3]; + points[0] = MeshRenderSystemInterface::all[i]->mGeometry.mPoints[firstVertIdx.vertIdx]; + points[1] = MeshRenderSystemInterface::all[i]->mGeometry.mPoints[secondVertIdx.vertIdx]; + points[2] = MeshRenderSystemInterface::all[i]->mGeometry.mPoints[thirdVertIdx.vertIdx]; + + Point3F normals[3]; + normals[0] = MeshRenderSystemInterface::all[i]->mGeometry.mNormals[firstVertIdx.normalIdx]; + normals[1] = MeshRenderSystemInterface::all[i]->mGeometry.mNormals[secondVertIdx.normalIdx]; + normals[2] = MeshRenderSystemInterface::all[i]->mGeometry.mNormals[thirdVertIdx.normalIdx]; + + Point3F tangents[3]; + tangents[0] = mCross(points[1] - points[0], normals[0]); + tangents[1] = mCross(points[2] - points[1], normals[1]); + tangents[2] = mCross(points[0] - points[2], normals[2]); + + Point2F uvs[3]; + uvs[0] = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s[firstVertIdx.uv0Idx]; + uvs[1] = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s[secondVertIdx.uv0Idx]; + uvs[2] = MeshRenderSystemInterface::all[i]->mGeometry.mUV0s[thirdVertIdx.uv0Idx]; + + mStaticBuffers[bufferId].vertCount += 3; + mStaticBuffers[bufferId].primCount += 1; + + for (U32 v = 0; v < 3; ++v) + { + //Build the vert and store it to the buffers! + GFXVertexPNTT bufVert; + bufVert.point = points[v]; + bufVert.normal = normals[v]; + bufVert.tangent = tangents[v]; + bufVert.texCoord = uvs[v]; + + newBounds.extend(points[v]); + + mStaticBuffers[bufferId].buffers.last().vertData.push_back(bufVert); + + U32 vertPrimId = mStaticBuffers[bufferId].buffers.last().vertData.size() - 1; + mStaticBuffers[bufferId].buffers.last().primData.push_back(vertPrimId); + + mStaticBuffers[bufferId].center += points[v]; + } + } + } + } + + //Now, iterate through the organized data and turn them into renderable buffers + for (U32 i = 0; i < mStaticBuffers.size(); i++) + { + for (U32 b = 0; b < mStaticBuffers[i].buffers.size(); b++) + { + BufferSet::Buffers& buffers = mStaticBuffers[i].buffers[b]; + + //if there's no data to be had in this buffer, just skip it + if (buffers.vertData.empty()) + continue; + + buffers.vertexBuffer.set(GFX, buffers.vertData.size(), GFXBufferTypeStatic); + GFXVertexPNTT *pVert = buffers.vertexBuffer.lock(); + + for (U32 v = 0; v < buffers.vertData.size(); v++) + { + pVert->normal = buffers.vertData[v].normal; + pVert->tangent = buffers.vertData[v].tangent; + //pVert->color = buffers.vertData[v].color; + pVert->point = buffers.vertData[v].point; + pVert->texCoord = buffers.vertData[v].texCoord; + + pVert++; + } + + buffers.vertexBuffer.unlock(); + + // Allocate PB + buffers.primitiveBuffer.set(GFX, buffers.primData.size(), buffers.primData.size() / 3, GFXBufferTypeStatic); + + U16 *pIndex; + buffers.primitiveBuffer.lock(&pIndex); + + for (U16 i = 0; i < buffers.primData.size(); i++) + { + *pIndex = i; + pIndex++; + } + + buffers.primitiveBuffer.unlock(); + } + + mStaticBuffers[i].center /= mStaticBuffers[i].vertCount; + } + + //mObjBox = newBounds; + //resetWorldBox(); +} + +U32 MeshRenderSystem::findBufferSetByMaterial(U32 matId) +{ + for (U32 i = 0; i < mStaticBuffers.size(); i++) + { + if (mStaticBuffers[i].surfaceMaterialId == matId) + return i; + } + + return -1; +} \ No newline at end of file diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.h b/Engine/source/T3D/systems/render/meshRenderSystem.h new file mode 100644 index 000000000..4bc2269db --- /dev/null +++ b/Engine/source/T3D/systems/render/meshRenderSystem.h @@ -0,0 +1,207 @@ +#pragma once +#include "scene/sceneRenderState.h" +#include "T3D/systems/componentSystem.h" +#include "ts/tsShape.h" +#include "ts/tsShapeInstance.h" +#include "T3D/assets/ShapeAsset.h" +#include "T3D/assets/MaterialAsset.h" + +#ifndef _GFXVERTEXBUFFER_H_ +#include "gfx/gfxVertexBuffer.h" +#endif +#ifndef _GFXPRIMITIVEBUFFER_H_ +#include "gfx/gfxPrimitiveBuffer.h" +#endif +#ifndef _OPTIMIZEDPOLYLIST_H_ +#include "collision/optimizedPolyList.h" +#endif + +class MeshRenderSystemInterface : public SystemInterface +{ +public: + TSShapeInstance * mShapeInstance; + + MatrixF mTransform; + Point3F mScale; + Box3F mBounds; + SphereF mSphere; + + bool mIsClient; + + struct matMap + { + //MaterialAsset* matAsset; + String assetId; + U32 slot; + }; + + Vector mChangingMaterials; + Vector mMaterials; + + //Static geometry stuff + bool mStatic; + + OptimizedPolyList mGeometry; + + MeshRenderSystemInterface() : SystemInterface(), mShapeInstance(nullptr), mTransform(MatrixF::Identity), mScale(Point3F::One), mIsClient(false), mStatic(false) + { + mBounds = Box3F(1); + mSphere = SphereF(); + } + + ~MeshRenderSystemInterface() + { + //SAFE_DELETE(mShape); + SAFE_DELETE(mShapeInstance); + } +}; + +class MeshRenderSystem +{ +protected: + /*struct StaticBatchElement + { + SimObject* owner; + OptimizedPolyList geometry; + String batchName; + }; + + static Vector mStaticElements;*/ + + //We retain the pushed geometry data for rendering here. It's static(unless forced to change through editing or whatnot) + //so rendering the batches is real fast + struct BufferMaterials + { + // The name of the Material we will use for rendering + String mMaterialName; + // The actual Material instance + BaseMatInstance* mMaterialInst; + + BufferMaterials() + { + mMaterialName = ""; + mMaterialInst = NULL; + } + }; + + static Vector mBufferMaterials; + + struct BufferSet + { + U32 surfaceMaterialId; + + U32 vertCount; + U32 primCount; + + Point3F center; + + struct Buffers + { + U32 vertStart; + U32 primStart; + U32 vertCount; + U32 primCount; + + Vector vertData; + Vector primData; + + GFXVertexBufferHandle< GFXVertexPNTT > vertexBuffer; + GFXPrimitiveBufferHandle primitiveBuffer; + + Buffers() + { + vertStart = 0; + primStart = 0; + vertCount = 0; + primCount = 0; + + vertexBuffer = NULL; + primitiveBuffer = NULL; + } + }; + + Vector buffers; + + BufferSet() + { + Buffers newBuffer; + buffers.push_back(newBuffer); + + surfaceMaterialId = 0; + + vertCount = 0; + primCount = 0; + + center = Point3F::Zero; + } + }; + + static Vector mStaticBuffers; + +public: + /*virtual void prepRenderImage(SceneRenderState *state); + + bool setMeshAsset(const char* assetName); + + virtual TSShape* getShape() { if (mMeshAsset) return mMeshAsset->getShape(); else return NULL; } + virtual TSShapeInstance* getShapeInstance() { return mShapeInstance; } + + Resource getShapeResource() { return mMeshAsset->getShapeResource(); } + + void _onResourceChanged(const Torque::Path &path); + + virtual bool castRayRendered(const Point3F &start, const Point3F &end, RayInfo *info); + + void mountObjectToNode(SceneObject* objB, String node, MatrixF txfm); + + virtual void onDynamicModified(const char* slotName, const char* newValue); + + void changeMaterial(U32 slot, MaterialAsset* newMat); + bool setMatInstField(U32 slot, const char* field, const char* value); + + virtual void onInspect(); + virtual void onEndInspect(); + + virtual Vector getNodeTransforms() + { + Vector bob; + return bob; + } + + virtual void setNodeTransforms(Vector transforms) + { + return; + }*/ + + /*MeshRenderSystem() + { + + } + virtual ~MeshRenderSystem() + { + smInterfaceList.clear(); + } + + static MeshComponentInterface* GetNewInterface() + { + smInterfaceList.increment(); + + return &smInterfaceList.last(); + } + + static void RemoveInterface(T* q) + { + smInterfaceList.erase(q); + }*/ + + //Core render function, which does all the real work + static void render(SceneManager *sceneManager, SceneRenderState* state); + + //Render our particular interface's data + static void renderInterface(U32 interfaceIndex, SceneRenderState* state); + + //Static Batch rendering + static void rebuildBuffers(); + + static U32 findBufferSetByMaterial(U32 matId); +}; \ No newline at end of file diff --git a/Engine/source/T3D/systems/updateSystem.cpp b/Engine/source/T3D/systems/updateSystem.cpp new file mode 100644 index 000000000..128329365 --- /dev/null +++ b/Engine/source/T3D/systems/updateSystem.cpp @@ -0,0 +1,34 @@ +#include "T3D/systems/updateSystem.h" + +void UpdateSystem::processTick() +{ + for (U32 i = 0; i < UpdateSystemInterface::all.size(); i++) + { + if (UpdateSystemInterface::all[i]->mIsEnabled) + { + //do work + } + } +} + +void UpdateSystem::advanceTime(U32 _tickMS) +{ + for (U32 i = 0; i < UpdateSystemInterface::all.size(); i++) + { + if (UpdateSystemInterface::all[i]->mIsEnabled) + { + //do work + } + } +} + +void UpdateSystem::interpolateTick(U32 _deltaMS) +{ + for (U32 i = 0; i < UpdateSystemInterface::all.size(); i++) + { + if (UpdateSystemInterface::all[i]->mIsEnabled) + { + //do work + } + } +} \ No newline at end of file diff --git a/Engine/source/T3D/systems/updateSystem.h b/Engine/source/T3D/systems/updateSystem.h new file mode 100644 index 000000000..b7d24eb88 --- /dev/null +++ b/Engine/source/T3D/systems/updateSystem.h @@ -0,0 +1,16 @@ +#pragma once +#include "componentSystem.h" + +class UpdateSystemInterface : public SystemInterface +{ +public: + bool mIsEnabled; +}; + +class UpdateSystem +{ +public: + static void processTick(); + static void advanceTime(U32 _tickMS); + static void interpolateTick(U32 _deltaMS); +}; \ No newline at end of file diff --git a/Engine/source/gui/containers/guiDragAndDropCtrl.h b/Engine/source/gui/containers/guiDragAndDropCtrl.h index aae34a08b..a9806a7ee 100644 --- a/Engine/source/gui/containers/guiDragAndDropCtrl.h +++ b/Engine/source/gui/containers/guiDragAndDropCtrl.h @@ -67,7 +67,7 @@ class GuiDragAndDropControl : public GuiControl public: - GuiDragAndDropControl() {} + GuiDragAndDropControl(); void startDragging(Point2I offset = Point2I(0, 0)); diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index ccd0c0882..b5745415e 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -325,18 +325,13 @@ addPath("${srcDir}/T3D/decal") addPath("${srcDir}/T3D/sfx") addPath("${srcDir}/T3D/gameBase") addPath("${srcDir}/T3D/turret") -addPath("${srcDir}/T3D/components/") -addPath("${srcDir}/T3D/components/animation") -addPath("${srcDir}/T3D/components/camera") -addPath("${srcDir}/T3D/components/collision") -addPath("${srcDir}/T3D/components/game") -addPath("${srcDir}/T3D/components/physics") -addPath("${srcDir}/T3D/components/render") +addPathRec("${srcDir}/T3D/components/") +addPathRec("${srcDir}/T3D/systems") addPath("${srcDir}/main/") addPath("${srcDir}/assets") addPath("${srcDir}/module") -addPath("${srcDir}/T3D/assets") +addPathRec("${srcDir}/T3D/assets") addPathRec("${srcDir}/persistence") addPathRec("${srcDir}/ts/collada") addPathRec("${srcDir}/ts/loader") From a6038d1801ad702f48065f4cd039767a52dd23e1 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 28 Jan 2018 16:59:43 -0600 Subject: [PATCH 106/312] Fixes issue with not detecting any non-template level meshes in the choose level dlg screen. --- .../game/data/ui/scripts/chooseLevelDlg.cs | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs index e04077f83..af260c27d 100644 --- a/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs +++ b/Templates/BaseGame/game/data/ui/scripts/chooseLevelDlg.cs @@ -32,26 +32,16 @@ function ChooseLevelDlg::onWake( %this ) %this->LevelDescription.visible = false; %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "LevelAsset")) - return; //if we didn't find ANY, just exit + AssetDatabase.findAssetType(%assetQuery, "LevelAsset"); %count = %assetQuery.getCount(); - if(%count == 0) + if(%count == 0 && !IsDirectory("tools")) { //We have no levels found. Prompt the user to open the editor to the default level if the tools are present - if(IsDirectory("tools")) - { - MessageBoxYesNo("Error", "No levels were found in any modules. Do you want to load the editor and start a new level?", - "EditorOpenMission();", - "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); - } - else - { - MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", - "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); - } - + MessageBoxOK("Error", "No levels were found in any modules. Please ensure you have modules loaded that contain gameplay code and level files.", + "Canvas.popDialog(ChooseLevelDlg); if(isObject(ChooseLevelDlg.returnGui) && ChooseLevelDlg.returnGui.isMethod(\"onReturnTo\")) ChooseLevelDlg.returnGui.onReturnTo();"); + %assetQuery.delete(); return; } From 4ae350da900819a784b1675e76564653da71e9be Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 29 Jan 2018 15:20:34 -0600 Subject: [PATCH 107/312] Hides the display of the 'camera axis' gizmo in the shape editor, as well as fixing it so that when you select a animation-only shapefile, it will correctly compute the shape bounds and thus render the bones correctly. --- .../source/gui/editor/guiShapeEdPreview.cpp | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 481544851..24b1e65f8 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -926,8 +926,8 @@ void GuiShapeEdPreview::handleMouseDown(const GuiEvent& event, GizmoMode mode) } } - if ( mode == RotateMode ) - mRenderCameraAxes = true; + //if ( mode == RotateMode ) + // mRenderCameraAxes = true; } void GuiShapeEdPreview::handleMouseUp(const GuiEvent& event, GizmoMode mode) @@ -941,8 +941,8 @@ void GuiShapeEdPreview::handleMouseUp(const GuiEvent& event, GizmoMode mode) mGizmo->on3DMouseUp( mLastEvent ); } - if ( mode == RotateMode ) - mRenderCameraAxes = false; + //if ( mode == RotateMode ) + // mRenderCameraAxes = false; } void GuiShapeEdPreview::handleMouseMove(const GuiEvent& event, GizmoMode mode) @@ -1164,6 +1164,19 @@ void GuiShapeEdPreview::computeSceneBounds(Box3F& bounds) { if ( mModel ) mModel->computeBounds( mCurrentDL, bounds ); + + if (bounds.getExtents().x < POINT_EPSILON || bounds.getExtents().y < POINT_EPSILON || bounds.getExtents().z < POINT_EPSILON) + { + bounds.set(Point3F::Zero); + + //We probably don't have any actual meshes in this model, so compute using the bones if we have them + for (S32 i = 0; i < mModel->getShape()->nodes.size(); i++) + { + Point3F nodePos = mModel->mNodeTransforms[i].getPosition(); + + bounds.extend(nodePos); + } + } } void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) From 0492dd8b9687c0923f11de86b020a308ad7bd800 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 29 Jan 2018 15:24:46 -0600 Subject: [PATCH 108/312] Tabs n' spaces --- Engine/source/gui/editor/guiShapeEdPreview.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 24b1e65f8..f04ef371a 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -1167,15 +1167,15 @@ void GuiShapeEdPreview::computeSceneBounds(Box3F& bounds) if (bounds.getExtents().x < POINT_EPSILON || bounds.getExtents().y < POINT_EPSILON || bounds.getExtents().z < POINT_EPSILON) { - bounds.set(Point3F::Zero); + bounds.set(Point3F::Zero); - //We probably don't have any actual meshes in this model, so compute using the bones if we have them - for (S32 i = 0; i < mModel->getShape()->nodes.size(); i++) - { - Point3F nodePos = mModel->mNodeTransforms[i].getPosition(); + //We probably don't have any actual meshes in this model, so compute using the bones if we have them + for (S32 i = 0; i < mModel->getShape()->nodes.size(); i++) + { + Point3F nodePos = mModel->mNodeTransforms[i].getPosition(); - bounds.extend(nodePos); - } + bounds.extend(nodePos); + } } } From 490c05ffd4a8e9bb64e1ad4276e846feed07b2bf Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 29 Jan 2018 22:16:42 -0600 Subject: [PATCH 109/312] Adds the ability to force the path returned by the file dialog to be relative. --- .../platform/nativeDialogs/fileDialog.cpp | 17 ++++++++++++++--- .../source/platform/nativeDialogs/fileDialog.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Engine/source/platform/nativeDialogs/fileDialog.cpp b/Engine/source/platform/nativeDialogs/fileDialog.cpp index 34e57e3e6..ad8bdfafb 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.cpp +++ b/Engine/source/platform/nativeDialogs/fileDialog.cpp @@ -122,6 +122,7 @@ FileDialog::FileDialog() : mData() // Default to File Must Exist Open Dialog style mData.mStyle = FileDialogData::FDS_OPEN | FileDialogData::FDS_MUSTEXIST; mChangePath = false; + mForceRelativePath = true; } FileDialog::~FileDialog() @@ -151,6 +152,8 @@ void FileDialog::initPersistFields() addProtectedField("changePath", TypeBool, Offset(mChangePath, FileDialog), &setChangePath, &getChangePath, "True/False whether to set the working directory to the directory returned by the dialog."); + addField("forceRelativePath", TypeBool, Offset(mForceRelativePath, FileDialog), "True/False whether to the path returned is always made to be relative."); + Parent::initPersistFields(); } @@ -267,7 +270,8 @@ bool FileDialog::Execute() } String resultPath = String(outPath).replace(rootDir, String("")); - resultPath = resultPath.replace(0, 1, String("")).c_str(); //kill '\\' prefix + if(resultPath[0] == '\\') + resultPath = resultPath.replace(0, 1, String("")).c_str(); //kill '\\' prefix resultPath = resultPath.replace(String("\\"), String("/")); // Did we select a file? @@ -280,7 +284,10 @@ bool FileDialog::Execute() if (mData.mStyle & FileDialogData::FDS_OPEN || mData.mStyle & FileDialogData::FDS_SAVE) { // Single file selection, do it the easy way - mData.mFile = Platform::makeRelativePathName(resultPath.c_str(), NULL); + if(mForceRelativePath) + mData.mFile = Platform::makeRelativePathName(resultPath.c_str(), NULL); + else + mData.mFile = resultPath.c_str(); } else if (mData.mStyle & FileDialogData::FDS_MULTIPLEFILES) { @@ -300,7 +307,11 @@ bool FileDialog::Execute() else { //nope, just one file, so set it as normal - setDataField(StringTable->insert("files"), "0", Platform::makeRelativePathName(resultPath.c_str(), NULL)); + if (mForceRelativePath) + setDataField(StringTable->insert("files"), "0", Platform::makeRelativePathName(resultPath.c_str(), NULL)); + else + setDataField(StringTable->insert("files"), "0", resultPath.c_str()); + setDataField(StringTable->insert("fileCount"), NULL, "1"); } } diff --git a/Engine/source/platform/nativeDialogs/fileDialog.h b/Engine/source/platform/nativeDialogs/fileDialog.h index b5b4ed618..7c08b51ae 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.h +++ b/Engine/source/platform/nativeDialogs/fileDialog.h @@ -106,6 +106,7 @@ protected: FileDialogData mData; ///< Stores platform agnostic information about the dialogs properties bool mChangePath; ///< Exposed ChangePath Property bool mBoolTranslator; ///< Internally used to translate boolean values into their respective bits of dialog style + bool mForceRelativePath; public: FileDialog(); From e35857ba92aabc58616f319b69604f0f61ec8a0f Mon Sep 17 00:00:00 2001 From: rextimmy Date: Thu, 1 Feb 2018 07:42:36 +1000 Subject: [PATCH 110/312] removed isSky from template sky material files. --- Templates/BaseGame/game/tools/base/images/materials.cs | 1 - Templates/Full/game/art/skies/Desert_Sky/materials.cs | 1 - Templates/Full/game/art/skies/night/materials.cs | 2 -- Templates/Full/game/core/art/skies/blank/materials.cs | 1 - 4 files changed, 5 deletions(-) diff --git a/Templates/BaseGame/game/tools/base/images/materials.cs b/Templates/BaseGame/game/tools/base/images/materials.cs index 11b766b04..a407c2ed2 100644 --- a/Templates/BaseGame/game/tools/base/images/materials.cs +++ b/Templates/BaseGame/game/tools/base/images/materials.cs @@ -16,7 +16,6 @@ singleton CubemapData( BlankSkyCubemap ) singleton Material( BlankSkyMat ) { cubemap = BlankSkyCubemap; - isSky = true; }; singleton Material(White) diff --git a/Templates/Full/game/art/skies/Desert_Sky/materials.cs b/Templates/Full/game/art/skies/Desert_Sky/materials.cs index 0ee4080d8..af6a979c8 100644 --- a/Templates/Full/game/art/skies/Desert_Sky/materials.cs +++ b/Templates/Full/game/art/skies/Desert_Sky/materials.cs @@ -34,5 +34,4 @@ singleton Material( DesertSkyMat ) { cubemap = DesertSkyCubemap; materialTag0 = "Skies"; - isSky = true; }; diff --git a/Templates/Full/game/art/skies/night/materials.cs b/Templates/Full/game/art/skies/night/materials.cs index 11f9f6348..79cc050fc 100644 --- a/Templates/Full/game/art/skies/night/materials.cs +++ b/Templates/Full/game/art/skies/night/materials.cs @@ -34,7 +34,6 @@ singleton Material( NightSkyMat ) { cubemap = NightCubemap; materialTag0 = "Skies"; - isSky = true; }; singleton Material( Moon_Glow_Mat ) @@ -51,5 +50,4 @@ singleton Material( Moon_Mat ) emissive = true; translucent = true; vertColor[ 0 ] = true; - isSky = true; }; diff --git a/Templates/Full/game/core/art/skies/blank/materials.cs b/Templates/Full/game/core/art/skies/blank/materials.cs index 39f268866..53709d11d 100644 --- a/Templates/Full/game/core/art/skies/blank/materials.cs +++ b/Templates/Full/game/core/art/skies/blank/materials.cs @@ -34,7 +34,6 @@ singleton Material( BlackSkyMat ) { cubemap = BlackSkyCubemap; materialTag0 = "Skies"; - isSky = true; }; singleton CubemapData( BlueSkyCubemap ) From dd68bf660ebd94af94abaa90ac374b9713cb9772 Mon Sep 17 00:00:00 2001 From: Johxz Date: Wed, 31 Jan 2018 20:46:17 -0600 Subject: [PATCH 111/312] delete old dml --- Templates/BaseGame/game/tools/base/images/sky_skybox.dml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 Templates/BaseGame/game/tools/base/images/sky_skybox.dml diff --git a/Templates/BaseGame/game/tools/base/images/sky_skybox.dml b/Templates/BaseGame/game/tools/base/images/sky_skybox.dml deleted file mode 100644 index 5ca0a1cb6..000000000 --- a/Templates/BaseGame/game/tools/base/images/sky_skybox.dml +++ /dev/null @@ -1,7 +0,0 @@ -skybox_1 -skybox_2 -skybox_3 -skybox_4 -skybox_5 -skybox_6 -skybox_6 \ No newline at end of file From b9adeb0f28f444d7fb87afd82c86c0fb2b36c0a7 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 1 Feb 2018 01:51:51 -0600 Subject: [PATCH 112/312] Corrects the clearFields function of the variableInspector and enables the callback field support. --- Engine/source/gui/editor/inspector/variableField.h | 1 + Engine/source/gui/editor/inspector/variableGroup.cpp | 3 +++ Engine/source/gui/editor/inspector/variableInspector.cpp | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Engine/source/gui/editor/inspector/variableField.h b/Engine/source/gui/editor/inspector/variableField.h index 39ba2e2b8..8bb382a58 100644 --- a/Engine/source/gui/editor/inspector/variableField.h +++ b/Engine/source/gui/editor/inspector/variableField.h @@ -57,6 +57,7 @@ public: protected: StringTableEntry mVariableName; + StringTableEntry mSetCallbackName; SimObject* mOwnerObject; }; diff --git a/Engine/source/gui/editor/inspector/variableGroup.cpp b/Engine/source/gui/editor/inspector/variableGroup.cpp index 2d03f7483..83e4f3c32 100644 --- a/Engine/source/gui/editor/inspector/variableGroup.cpp +++ b/Engine/source/gui/editor/inspector/variableGroup.cpp @@ -151,6 +151,9 @@ bool GuiInspectorVariableGroup::inspectGroup() fieldGui->setInspectorField(NULL, mFields[i]->mFieldLabel); fieldGui->setDocs(mFields[i]->mFieldDescription); + if(mFields[i]->mSetCallbackName != StringTable->EmptyString()) + fieldGui->setSpecialEditCallbackName(mFields[i]->mSetCallbackName); + /*if (mFields[i]->mSetCallbackName != StringTable->EmptyString()) { fieldGui->on.notify() diff --git a/Engine/source/gui/editor/inspector/variableInspector.cpp b/Engine/source/gui/editor/inspector/variableInspector.cpp index edfaf2ed1..115e48b83 100644 --- a/Engine/source/gui/editor/inspector/variableInspector.cpp +++ b/Engine/source/gui/editor/inspector/variableInspector.cpp @@ -195,8 +195,10 @@ void GuiVariableInspector::addCallbackField(const char* name, const char* label, void GuiVariableInspector::clearFields() { + mGroups.clear(); mFields.clear(); - clearGroups(); + clear(); + update(); } From c0f298e37d824187ed2fbd67db1cd5b168ee07ca Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 3 Feb 2018 13:40:33 +1000 Subject: [PATCH 113/312] Fixed physx3 linux cmake build --- Tools/CMake/modules/module_physx3.cmake | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Tools/CMake/modules/module_physx3.cmake b/Tools/CMake/modules/module_physx3.cmake index 56984649f..a2dd3fdd3 100644 --- a/Tools/CMake/modules/module_physx3.cmake +++ b/Tools/CMake/modules/module_physx3.cmake @@ -108,6 +108,7 @@ if( WIN32 ) FIND_PHYSX3_LIBRARY(PVD PxPvdSDK 1 ${PHYSX3_BASE_PATH}/PxShared/Lib/) if(NOT PHYSX3_CORE_LIBRARY) + message(FATAL_ERROR "Could not find core PhysX lib") return() endif() @@ -153,29 +154,29 @@ elseif(UNIX) FIND_PHYSX3_LIBRARY(CHARACTER PhysX3CharacterKinematic 0 ${PHYSX3_PATH}/Lib/) FIND_PHYSX3_LIBRARY(FOUNDATION PxFoundation 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) FIND_PHYSX3_LIBRARY(PVD PxPvdSDK 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) - elseif() #linux + else() #linux FIND_PHYSX3_LIBRARY(CORE PhysX3 1 ${PHYSX3_PATH}/Bin/) FIND_PHYSX3_LIBRARY(COMMON PhysX3Common 1 ${PHYSX3_PATH}/Bin/) + FIND_PHYSX3_LIBRARY(GPU PhysX3Gpu 1 ${PHYSX3_PATH}/Bin/) FIND_PHYSX3_LIBRARY(CHARACTER PhysX3CharacterKinematic 1 ${PHYSX3_PATH}/Bin/) FIND_PHYSX3_LIBRARY(COOKING PhysX3Cooking 1 ${PHYSX3_PATH}/Bin/) FIND_PHYSX3_LIBRARY(FOUNDATION PxFoundation 1 ${PHYSX3_BASE_PATH}/PxShared/bin/) FIND_PHYSX3_LIBRARY(PVD PxPvdSDK 1 ${PHYSX3_BASE_PATH}/PxShared/bin/) - FIND_PHYSX3_LIBRARY(CUDA PxCudaContextManager 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) - FIND_PHYSX3_LIBRARY(GPU PhysX3Gpu 1 ${PHYSX3_PATH}/Bin/) FIND_PHYSX3_LIBRARY(XML PsFastXml 0 ${PHYSX3_BASE_PATH}/PxShared/lib/) endif() if(NOT PHYSX3_CORE_LIBRARY) + message(FATAL_ERROR "Could not find core PhysX lib") return() endif() #Add the libs set(PHYSX_LIBRARIES ${PHYSX3_CORE_LIBRARY} - ${PHYSX3_GPU_LIBRARY} ${PHYSX3_CHARACTER_LIBRARY} ${PHYSX3_COOKING_LIBRARY} ${PHYSX3_COMMON_LIBRARY} + ${PHYSX3_GPU_LIBRARY} ${PHYSX3_EXTENSIONS_LIBRARY} ${PHYSX3_CONTROLLER_LIBRARY} ${PHYSX3_SCENEQUERY_LIBRARY} @@ -184,7 +185,6 @@ elseif(UNIX) ${PHYSX3_LOWLEVEL_DYNAMICS_LIBRARY} ${PHYSX3_LOWLEVEL_CLOTH_LIBRARY} ${PHYSX3_LOWLEVEL_PARTICLES_LIBRARY} - ${PHYSX3_CUDA_LIBRARY} ${PHYSX3_TASK_LIBRARY} ${PHYSX3_XML_LIBRARY} ${PHYSX3_FOUNDATION_LIBRARY} @@ -193,10 +193,10 @@ elseif(UNIX) set(PHYSX_LIBRARIES_DEBUG ${PHYSX3_CORE_LIBRARY_DEBUG} - ${PHYSX3_GPU_LIBRARY_DEBUG} ${PHYSX3_CHARACTER_LIBRARY_DEBUG} ${PHYSX3_COOKING_LIBRARY_DEBUG} ${PHYSX3_COMMON_LIBRARY_DEBUG} + ${PHYSX3_GPU_LIBRARY_DEBUG} ${PHYSX3_EXTENSIONS_LIBRARY_DEBUG} ${PHYSX3_CONTROLLER_LIBRARY_DEBUG} ${PHYSX3_SCENEQUERY_LIBRARY_DEBUG} @@ -205,7 +205,6 @@ elseif(UNIX) ${PHYSX3_LOWLEVEL_DYNAMICS_LIBRARY_DEBUG} ${PHYSX3_LOWLEVEL_CLOTH_LIBRARY_DEBUG} ${PHYSX3_LOWLEVEL_PARTICLES_LIBRARY_DEBUG} - ${PHYSX3_CUDA_LIBRARY_DEBUG} ${PHYSX3_TASK_LIBRARY_DEBUG} ${PHYSX3_XML_LIBRARY_DEBUG} ${PHYSX3_FOUNDATION_LIBRARY_DEBUG} From abc01fd3773b8928c18159fde4b416383779a422 Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sat, 3 Feb 2018 00:32:22 -0500 Subject: [PATCH 114/312] Fix Torque3D 64bit DSOs. Fix from Torque2D for 64bit string table entries. --- Engine/source/console/codeBlock.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index 3f5c3f292..f8f814f5b 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -409,6 +409,8 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) U32 totSize = codeLength + lineBreakPairCount * 2; code = new U32[totSize]; + // 0xFF is used as a flag to help compress the bytecode. + // If detected, the bytecode is only a U8. for (i = 0; i < codeLength; i++) { U8 b; @@ -442,7 +444,11 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) { U32 ip; st.read(&ip); +#ifdef TORQUE_CPU_X64 + *(U64*)(code + ip) = (U64)ste; +#else code[ip] = *((U32 *)&ste); +#endif } } From fd23f0d0e98ed95a32ac54ff54d69cb15e78300c Mon Sep 17 00:00:00 2001 From: rextimmy Date: Sun, 4 Feb 2018 09:32:39 +1000 Subject: [PATCH 115/312] gcc/clang build fix --- Engine/source/T3D/components/audio/SoundComponent.cpp | 3 ++- Engine/source/T3D/components/audio/SoundComponent.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/components/audio/SoundComponent.cpp b/Engine/source/T3D/components/audio/SoundComponent.cpp index 179282d2a..9552c2d67 100644 --- a/Engine/source/T3D/components/audio/SoundComponent.cpp +++ b/Engine/source/T3D/components/audio/SoundComponent.cpp @@ -359,7 +359,8 @@ void SoundComponent::updateAudioState(Sound& st) { //if (Sim::findObject(SimObjectId((uintptr_t)st.profile), st.profile)) // { - st.sound = SFX->createSource(st.profile, &mOwner->getTransform()); + MatrixF transform = mOwner->getTransform(); + st.sound = SFX->createSource(st.profile, &transform); if (st.sound) st.sound->play(); //} diff --git a/Engine/source/T3D/components/audio/SoundComponent.h b/Engine/source/T3D/components/audio/SoundComponent.h index 77dfef067..a56bc600e 100644 --- a/Engine/source/T3D/components/audio/SoundComponent.h +++ b/Engine/source/T3D/components/audio/SoundComponent.h @@ -67,7 +67,7 @@ public: SimTime timeout; ///< Time until we stop playing this sound. SFXTrack* profile; ///< Profile on server SFXSource* sound; ///< Sound on client - Sound::Sound() + Sound() { play = false; timeout = 0; From 14ae287c0c69cd5be9439f68f7843727194bdeb6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 4 Feb 2018 14:31:28 -0600 Subject: [PATCH 116/312] Bugfixes and improvements for the animation component and related asset behavior. Adds in ability to establish a shape animation asset as being cyclic or blended. Adds functionality for blended animations to integrated into shapeAssets. --- .../source/T3D/assets/ShapeAnimationAsset.cpp | 46 ++++++++++++++++++- .../source/T3D/assets/ShapeAnimationAsset.h | 28 ++++++++++- Engine/source/T3D/assets/ShapeAsset.cpp | 40 ++++++++++++++-- .../animation/animationComponent.cpp | 8 ++-- Engine/source/ts/collada/colladaImport.cpp | 13 +++++- .../scripts/shapeEditorActions.ed.cs | 10 ++-- 6 files changed, 130 insertions(+), 15 deletions(-) diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp index ee10bbe40..4c2b0283e 100644 --- a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp @@ -92,8 +92,13 @@ ConsoleSetType(TypeShapeAnimationAssetPtr) //----------------------------------------------------------------------------- -ShapeAnimationAsset::ShapeAnimationAsset() +ShapeAnimationAsset::ShapeAnimationAsset() : + mIsEmbedded(false), mIsCyclical(true), mIsBlend(false), mBlendFrame(0), mStartFrame(0), mEndFrame(-1), mPadRotation(true), mPadTransforms(false) { + mFileName = StringTable->EmptyString(); + mAnimationName = StringTable->EmptyString(); + + mBlendAnimAssetName = StringTable->EmptyString(); } //----------------------------------------------------------------------------- @@ -116,6 +121,14 @@ void ShapeAnimationAsset::initPersistFields() addField("animationFile", TypeFilename, Offset(mFileName, ShapeAnimationAsset), "Path to the file name containing the animation"); addField("animationName", TypeString, Offset(mAnimationName, ShapeAnimationAsset), "Name of the animation"); + addField("isEmbedded", TypeBool, Offset(mIsEmbedded, ShapeAnimationAsset), "If true, this animation asset just referrs to an embedded animation of a regular shape mesh. If false, it is a self-contained animation file"); + + addField("isCyclic", TypeBool, Offset(mIsCyclical, ShapeAnimationAsset), "Is this animation looping?"); + + addField("isBlend", TypeBool, Offset(mIsBlend, ShapeAnimationAsset), "Is this animation blended with another?"); + addField("blendRefAnimation", TypeString, Offset(mBlendAnimAssetName, ShapeAnimationAsset), "AssetID of the animation to reference for our blending"); + addField("blendFrame", TypeS32, Offset(mBlendFrame, ShapeAnimationAsset), "Which frame of the reference animation do we use for our blending"); + addField("startFrame", TypeS32, Offset(mStartFrame, ShapeAnimationAsset), "What frame does this animation clip start on"); addField("endFrame", TypeS32, Offset(mEndFrame, ShapeAnimationAsset), "What fram does this animation clip end on"); addField("padRotation", TypeBool, Offset(mPadRotation, ShapeAnimationAsset), "Are the rotation values padded"); @@ -128,4 +141,35 @@ void ShapeAnimationAsset::copyTo(SimObject* object) { // Call to parent. Parent::copyTo(object); +} + +void ShapeAnimationAsset::initializeAsset(void) +{ + if (!mIsEmbedded) + { + //If we're not embedded, we need to load in our initial shape and do some prepwork + + char filenameBuf[1024]; + Con::expandScriptFilename(filenameBuf, sizeof(filenameBuf), mFileName); + + mSourceShape = ResourceManager::get().load(filenameBuf); + + if (!mSourceShape->addSequence("ambient", "", mAnimationName, mStartFrame, mEndFrame, mPadRotation, mPadTransforms)) + { + Con::errorf("ShapeAnimationAsset::initializeAsset - Unable to do initial setup of the animation clip named %s for asset %s", mAnimationName, getAssetName()); + return; + } + + S32 sequenceId = mSourceShape->findSequence(mAnimationName); + + if(mIsCyclical) + mSourceShape->sequences[sequenceId].flags |= TSShape::Cyclic; + else + mSourceShape->sequences[sequenceId].flags &= (~(TSShape::Cyclic)); + } +} + +void ShapeAnimationAsset::onAssetRefresh(void) +{ + } \ No newline at end of file diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.h b/Engine/source/T3D/assets/ShapeAnimationAsset.h index 673607d53..0b7bf1790 100644 --- a/Engine/source/T3D/assets/ShapeAnimationAsset.h +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.h @@ -37,6 +37,12 @@ #ifndef _ASSET_FIELD_TYPES_H_ #include "assets/assetFieldTypes.h" #endif +#ifndef _TSSHAPE_H_ +#include "ts/tsShape.h" +#endif +#ifndef __RESOURCE_H__ +#include "core/resource.h" +#endif //----------------------------------------------------------------------------- class ShapeAnimationAsset : public AssetBase @@ -46,6 +52,15 @@ class ShapeAnimationAsset : public AssetBase protected: StringTableEntry mFileName; + bool mIsEmbedded; + bool mIsCyclical; + + bool mIsBlend; + + StringTableEntry mBlendAnimAssetName; + + S32 mBlendFrame; + // StringTableEntry mAnimationName; S32 mStartFrame; @@ -53,6 +68,8 @@ protected: bool mPadRotation; bool mPadTransforms; + Resource mSourceShape; + public: ShapeAnimationAsset(); virtual ~ShapeAnimationAsset(); @@ -65,18 +82,25 @@ public: DECLARE_CONOBJECT(ShapeAnimationAsset); protected: - virtual void initializeAsset(void) {} - virtual void onAssetRefresh(void) {} + virtual void initializeAsset(void); + virtual void onAssetRefresh(void); public: StringTableEntry getAnimationFilename() { return mFileName; } StringTableEntry getAnimationName() { return mAnimationName; } + StringTableEntry getBlendAnimationName() { return mBlendAnimAssetName; } S32 getStartFrame() { return mStartFrame; } S32 getEndFrame() { return mEndFrame; } bool getPadRotation() { return mPadRotation; } bool getPadTransforms() { return mPadTransforms; } + + bool isEmbedded() { return mIsEmbedded; } + bool isCyclic() { return mIsCyclical; } + bool isBlend() { return mIsBlend; } + + S32 getBlendFrame() { return mBlendFrame; } }; DefineConsoleType(TypeShapeAnimationAssetPtr, ShapeAnimationAsset) diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index 099c3c117..2bce369ea 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -182,17 +182,49 @@ bool ShapeAsset::loadShape() return false; //if it failed to load, bail out } + bool hasBlends = false; + //Now that we've successfully loaded our shape and have any materials and animations loaded //we need to set up the animations we're using on our shape - for (U32 i = 0; i < mAnimationAssets.size(); i++) + for (S32 i = mAnimationAssets.size()-1; i >= 0; --i) { - String srcName; + String srcName = mAnimationAssets[i]->getAnimationName(); String srcPath(mAnimationAssets[i]->getAnimationFilename()); - SplitSequencePathAndName(srcPath, srcName); + //SplitSequencePathAndName(srcPath, srcName); - if (!mShape->addSequence(srcPath, srcName, mAnimationAssets[i]->getAnimationName(), + if (!mShape->addSequence(srcPath, srcName, srcName, mAnimationAssets[i]->getStartFrame(), mAnimationAssets[i]->getEndFrame(), mAnimationAssets[i]->getPadRotation(), mAnimationAssets[i]->getPadTransforms())) return false; + + if (mAnimationAssets[i]->isBlend()) + hasBlends = true; + } + + //if any of our animations are blends, set those up now + if (hasBlends) + { + for (U32 i=0; i < mAnimationAssets.size(); ++i) + { + if (mAnimationAssets[i]->isBlend() && mAnimationAssets[i]->getBlendAnimationName() != StringTable->EmptyString()) + { + //gotta do a bit of logic here. + //First, we need to make sure the anim asset we depend on for our blend is loaded + AssetPtr blendAnimAsset = mAnimationAssets[i]->getBlendAnimationName(); + + if (blendAnimAsset.isNull()) + { + Con::errorf("ShapeAsset::initializeAsset - Unable to acquire reference animation asset %s for asset %s to blend!", mAnimationAssets[i]->getBlendAnimationName(), mAnimationAssets[i]->getAssetName()); + return false; + } + + String refAnimName = blendAnimAsset->getAnimationName(); + if (!mShape->setSequenceBlend(mAnimationAssets[i]->getAnimationName(), true, blendAnimAsset->getAnimationName(), mAnimationAssets[i]->getBlendFrame())) + { + Con::errorf("ShapeAnimationAsset::initializeAsset - Unable to set animation clip %s for asset %s to blend!", mAnimationAssets[i]->getAnimationName(), mAnimationAssets[i]->getAssetName()); + return false; + } + } + } } return true; diff --git a/Engine/source/T3D/components/animation/animationComponent.cpp b/Engine/source/T3D/components/animation/animationComponent.cpp index c8fd645d0..cd7c2534c 100644 --- a/Engine/source/T3D/components/animation/animationComponent.cpp +++ b/Engine/source/T3D/components/animation/animationComponent.cpp @@ -222,7 +222,7 @@ U32 AnimationComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stre { U32 retMask = Parent::packUpdate(con, mask, stream); - /*for (int i = 0; i < MaxScriptThreads; i++) + for (int i = 0; i < MaxScriptThreads; i++) { Thread& st = mAnimationThreads[i]; if (stream->writeFlag((st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)))) @@ -234,7 +234,7 @@ U32 AnimationComponent::packUpdate(NetConnection *con, U32 mask, BitStream *stre stream->writeFlag(st.atEnd); stream->writeFlag(st.transition); } - }*/ + } return retMask; } @@ -243,7 +243,7 @@ void AnimationComponent::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con, stream); - /*for (S32 i = 0; i < MaxScriptThreads; i++) + for (S32 i = 0; i < MaxScriptThreads; i++) { if (stream->readFlag()) { @@ -260,7 +260,7 @@ void AnimationComponent::unpackUpdate(NetConnection *con, BitStream *stream) else updateThread(st); } - }*/ + } } void AnimationComponent::processTick() diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index f3aea309e..1cc2909b0 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -198,7 +198,7 @@ DefineConsoleFunction( enumColladaForImport, bool, (const char * shapePath, cons for (S32 j = 0; j < libraryMats->getMaterial_array().getCount(); j++) { domMaterial* mat = libraryMats->getMaterial_array()[j]; - tree->insertItem(matsID, _GetNameOrId(mat), _GetNameOrId(mat), "", 0, 0); + tree->insertItem(matsID, _GetNameOrId(mat), "", "", 0, 0); } } @@ -256,5 +256,16 @@ DefineConsoleFunction( enumColladaForImport, bool, (const char * shapePath, cons else tree->setDataField(StringTable->insert("_upAxis"), 0, "Z_AXIS"); + char shapesStr[16]; + dSprintf(shapesStr, 16, "%i", stats.numMeshes); + char materialsStr[16]; + dSprintf(materialsStr, 16, "%i", stats.numMaterials); + char animationsStr[16]; + dSprintf(animationsStr, 16, "%i", stats.numClips); + + tree->setItemValue(nodesID, StringTable->insert(shapesStr)); + tree->setItemValue(matsID, StringTable->insert(materialsStr)); + tree->setItemValue(animsID, StringTable->insert(animationsStr)); + return true; } diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs index 3847226f6..15bd4cc9b 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.cs @@ -346,10 +346,11 @@ function ActionAddSequence::doit( %this ) %assetDef = AssetDatabase.acquireAsset(%this.seqName); %moduleName = getWord(getToken(%this.seqName, ":", 0),0); - %idx = ShapeEdSequenceList.rowCount(); + //TODO, properly ignore and ambient entries for our idx values, but only if they're there! + %idx = ShapeEdSequenceList.rowCount() - 2; - %matSet = "ShapeEditorPlugin.selectedAssetDef.animationSequence"@%idx@"=\"@Asset="@%moduleName@":"@%this.seqName.assetName@"\";"; - eval(%matSet); + %animSet = "ShapeEditorPlugin.selectedAssetDef.animationSequence"@%idx@"=\"@Asset="@%moduleName@":"@%assetDef.assetName@"\";"; + eval(%animSet); %assetPath = AssetDatabase.getAssetFilePath(ShapeEditorPlugin.selectedAssetId); @@ -357,6 +358,9 @@ function ActionAddSequence::doit( %this ) AssetDatabase.refreshAsset(ShapeEditorPlugin.selectedAssetId); + //force a refresh + ShapeEdPropWindow.update_onShapeSelectionChanged(); + return true; } return false; From abe4370c8a480acecf9f405b4700ec103a21f46f Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 4 Feb 2018 16:21:07 -0600 Subject: [PATCH 117/312] Some code cleanup, tweak and optimizations for assets, entities and components. --- Engine/source/T3D/assets/ImageAsset.cpp | 7 +------ Engine/source/T3D/assets/ImageAsset.h | 5 ----- Engine/source/T3D/assets/LevelAsset.cpp | 4 +++- Engine/source/T3D/assets/ScriptAsset.cpp | 2 +- .../animation/animationComponent.cpp | 3 +++ .../collision/collisionComponent.cpp | 8 ++++--- Engine/source/T3D/components/component.cpp | 11 ++++++++-- .../T3D/components/game/stateMachine.cpp | 4 ++++ .../source/T3D/components/game/stateMachine.h | 2 ++ .../physics/playerControllerComponent.cpp | 7 +++++-- .../T3D/components/render/meshComponent.cpp | 2 +- Engine/source/T3D/entity.cpp | 21 ++++++++++--------- Engine/source/T3D/entity.h | 14 ++++++------- .../T3D/systems/render/meshRenderSystem.cpp | 5 ++++- .../gui/editor/inspector/entityGroup.cpp | 3 ++- 15 files changed, 58 insertions(+), 40 deletions(-) diff --git a/Engine/source/T3D/assets/ImageAsset.cpp b/Engine/source/T3D/assets/ImageAsset.cpp index 3e29b0bdf..ff4c3ac70 100644 --- a/Engine/source/T3D/assets/ImageAsset.cpp +++ b/Engine/source/T3D/assets/ImageAsset.cpp @@ -90,14 +90,9 @@ ConsoleSetType(TypeImageAssetPtr) //----------------------------------------------------------------------------- -ImageAsset::ImageAsset() +ImageAsset::ImageAsset() : AssetBase(), mImage(nullptr), mUseMips(true), mIsHDRImage(false), mIsValidImage(false) { mImageFileName = StringTable->EmptyString(); - - mImage = NULL; - mUseMips = true; - mIsHDRImage = false; - mIsValidImage = false; } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index d289ac195..f5b52db07 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -47,11 +47,6 @@ class ImageAsset : public AssetBase { typedef AssetBase Parent; - AssetManager* mpOwningAssetManager; - bool mAssetInitialized; - AssetDefinition* mpAssetDefinition; - U32 mAcquireReferenceCount; - StringTableEntry mImageFileName; GFXTexHandle mImage; diff --git a/Engine/source/T3D/assets/LevelAsset.cpp b/Engine/source/T3D/assets/LevelAsset.cpp index 849cdc8d7..34084924a 100644 --- a/Engine/source/T3D/assets/LevelAsset.cpp +++ b/Engine/source/T3D/assets/LevelAsset.cpp @@ -90,10 +90,12 @@ ConsoleSetType(TypeLevelAssetPtr) //----------------------------------------------------------------------------- -LevelAsset::LevelAsset() +LevelAsset::LevelAsset() : AssetBase(), mIsSubLevel(false) { mLevelFile = StringTable->EmptyString(); mPreviewImage = StringTable->EmptyString(); + + mMainLevelAsset = StringTable->EmptyString(); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/assets/ScriptAsset.cpp b/Engine/source/T3D/assets/ScriptAsset.cpp index dbc5e7a2e..10c3be777 100644 --- a/Engine/source/T3D/assets/ScriptAsset.cpp +++ b/Engine/source/T3D/assets/ScriptAsset.cpp @@ -89,7 +89,7 @@ ConsoleSetType(TypeScriptAssetPtr) //----------------------------------------------------------------------------- -ScriptAsset::ScriptAsset() +ScriptAsset::ScriptAsset() : AssetBase(), mIsServerSide(true) { mScriptFilePath = StringTable->EmptyString(); } diff --git a/Engine/source/T3D/components/animation/animationComponent.cpp b/Engine/source/T3D/components/animation/animationComponent.cpp index c8fd645d0..1b4604ce5 100644 --- a/Engine/source/T3D/components/animation/animationComponent.cpp +++ b/Engine/source/T3D/components/animation/animationComponent.cpp @@ -613,6 +613,9 @@ void AnimationComponent::advanceThreads(F32 dt) if (!mOwnerRenderInst) return; + if (mOwnerShapeInstance == nullptr || !getShape()) + return; + for (U32 i = 0; i < MaxScriptThreads; i++) { Thread& st = mAnimationThreads[i]; diff --git a/Engine/source/T3D/components/collision/collisionComponent.cpp b/Engine/source/T3D/components/collision/collisionComponent.cpp index ccdf818f1..3736fbe04 100644 --- a/Engine/source/T3D/components/collision/collisionComponent.cpp +++ b/Engine/source/T3D/components/collision/collisionComponent.cpp @@ -142,10 +142,12 @@ CollisionComponent::CollisionComponent() : Component() StaticShapeObjectType | VehicleObjectType | VehicleBlockerObjectType | DynamicShapeObjectType | StaticObjectType | EntityObjectType | TriggerObjectType); - mPhysicsRep = NULL; - mPhysicsWorld = NULL; + mPhysicsRep = nullptr; + mPhysicsWorld = nullptr; - mTimeoutList = NULL; + mTimeoutList = nullptr; + + mAnimated = false; } CollisionComponent::~CollisionComponent() diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index ff207d2c1..181c892e5 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -67,6 +67,13 @@ Component::Component() mOriginatingAssetId = StringTable->EmptyString(); mIsServerObject = true; + + componentIdx = 0; + + mHidden = false; + mEnabled = true; + + mDirtyMaskBits = 0; } Component::~Component() @@ -535,7 +542,7 @@ const char * Component::getDescriptionText(const char *desc) if (desc == NULL) return NULL; - char *newDesc; + char *newDesc = ""; // [tom, 1/12/2007] If it isn't a file, just do it the easy way if (!Platform::isFile(desc)) @@ -568,7 +575,7 @@ const char * Component::getDescriptionText(const char *desc) } str.close(); - delete stream; + //delete stream; return newDesc; } diff --git a/Engine/source/T3D/components/game/stateMachine.cpp b/Engine/source/T3D/components/game/stateMachine.cpp index 335b69db3..fd1ef8505 100644 --- a/Engine/source/T3D/components/game/stateMachine.cpp +++ b/Engine/source/T3D/components/game/stateMachine.cpp @@ -30,6 +30,10 @@ StateMachine::StateMachine() mStartingState = ""; mCurCreateState = NULL; + + mStateMachineFile = StringTable->EmptyString(); + + mCurCreateState = nullptr; } StateMachine::~StateMachine() diff --git a/Engine/source/T3D/components/game/stateMachine.h b/Engine/source/T3D/components/game/stateMachine.h index 9ccc540e8..b440ab7fa 100644 --- a/Engine/source/T3D/components/game/stateMachine.h +++ b/Engine/source/T3D/components/game/stateMachine.h @@ -158,6 +158,8 @@ public: { if (index <= mFields.size()) return mFields[index]; + + return StateField(); //return a blank one } Signal< void(StateMachine*, S32 stateIdx) > onStateChanged; diff --git a/Engine/source/T3D/components/physics/playerControllerComponent.cpp b/Engine/source/T3D/components/physics/playerControllerComponent.cpp index 2c6cea6e9..761ac570c 100644 --- a/Engine/source/T3D/components/physics/playerControllerComponent.cpp +++ b/Engine/source/T3D/components/physics/playerControllerComponent.cpp @@ -119,8 +119,11 @@ PlayerControllerComponent::PlayerControllerComponent() : Component() mInputVelocity = Point3F(0, 0, 0); - mPhysicsRep = NULL; - mPhysicsWorld = NULL; + mPhysicsRep = nullptr; + mPhysicsWorld = nullptr; + + mOwnerCollisionInterface = nullptr; + mIntegrationCount = 0; } PlayerControllerComponent::~PlayerControllerComponent() diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index 10186c873..c87733bf8 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -59,7 +59,7 @@ ImplementEnumType(BatchingMode, ////////////////////////////////////////////////////////////////////////// // Constructor/Destructor ////////////////////////////////////////////////////////////////////////// -MeshComponent::MeshComponent() : Component() +MeshComponent::MeshComponent() : Component(), mShape(nullptr), mRenderMode(Individual) { mFriendlyName = "Mesh Component"; mComponentType = "Render"; diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index a7af19b33..62c0b031f 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -850,7 +850,7 @@ void Entity::setTransform(const MatrixF &mat) } } -void Entity::setTransform(Point3F position, RotationF rotation) +void Entity::setTransform(const Point3F& position, const RotationF& rotation) { MatrixF oldTransform = getTransform(); @@ -922,7 +922,7 @@ void Entity::setRenderTransform(const MatrixF &mat) Parent::setRenderTransform(mat); } -void Entity::setRenderTransform(Point3F position, RotationF rotation) +void Entity::setRenderTransform(const Point3F& position, const RotationF& rotation) { if (isMounted()) { @@ -977,7 +977,7 @@ MatrixF Entity::getTransform() } } -void Entity::setMountOffset(Point3F posOffset) +void Entity::setMountOffset(const Point3F& posOffset) { if (isMounted()) { @@ -987,7 +987,7 @@ void Entity::setMountOffset(Point3F posOffset) } } -void Entity::setMountRotation(EulerF rotOffset) +void Entity::setMountRotation(const EulerF& rotOffset) { if (isMounted()) { @@ -1111,11 +1111,12 @@ bool Entity::castRayRendered(const Point3F &start, const Point3F &end, RayInfo * bool Entity::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF &sphere) { - Vector updaters = getComponents(); + Con::errorf("Build Poly List not yet implemented as a passthrough for Entity"); + /*Vector updaters = getComponents(); for (Vector::iterator it = updaters.begin(); it != updaters.end(); it++) { return (*it)->buildPolyList(context, polyList, box, sphere); - } + }*/ return false; } @@ -1131,7 +1132,7 @@ void Entity::buildConvex(const Box3F& box, Convex* convex) // // Mounting and heirarchy manipulation -void Entity::mountObject(SceneObject* objB, MatrixF txfm) +void Entity::mountObject(SceneObject* objB, const MatrixF& txfm) { Parent::mountObject(objB, -1, txfm); Parent::addObject(objB); @@ -1604,7 +1605,7 @@ void Entity::onCameraScopeQuery(NetConnection* connection, CameraScopeQuery* que } } // -void Entity::setObjectBox(Box3F objBox) +void Entity::setObjectBox(const Box3F& objBox) { mObjBox = objBox; resetWorldBox(); @@ -1705,8 +1706,8 @@ void Entity::setComponentDirty(Component *comp, bool forceUpdate) } } - if (!found) - return; + //if (!found) + // return; //if(mToLoadComponents.empty()) // mStartComponentUpdate = true; diff --git a/Engine/source/T3D/entity.h b/Engine/source/T3D/entity.h index db65f2866..5bf9898ea 100644 --- a/Engine/source/T3D/entity.h +++ b/Engine/source/T3D/entity.h @@ -152,14 +152,14 @@ public: virtual void setTransform(const MatrixF &mat); virtual void setRenderTransform(const MatrixF &mat); - void setTransform(Point3F position, RotationF rotation); + void setTransform(const Point3F& position, const RotationF& rotation); - void setRenderTransform(Point3F position, RotationF rotation); + void setRenderTransform(const Point3F& position, const RotationF& rotation); virtual MatrixF getTransform(); virtual Point3F getPosition() const { return mPos; } - void setRotation(RotationF rotation) { + void setRotation(const RotationF& rotation) { mRot = rotation; setMaskBits(TransformMask); }; @@ -167,8 +167,8 @@ public: static bool _setGameObject(void *object, const char *index, const char *data); - void setMountOffset(Point3F posOffset); - void setMountRotation(EulerF rotOffset); + void setMountOffset(const Point3F& posOffset); + void setMountRotation(const EulerF& rotOffset); //static bool _setEulerRotation( void *object, const char *index, const char *data ); static bool _setPosition(void *object, const char *index, const char *data); @@ -181,7 +181,7 @@ public: virtual void getRenderMountTransform(F32 delta, S32 index, const MatrixF &xfm, MatrixF *outMat); virtual void mountObject(SceneObject *obj, S32 node, const MatrixF &xfm = MatrixF::Identity); - void mountObject(SceneObject* objB, MatrixF txfm); + void mountObject(SceneObject* objB, const MatrixF& txfm); void onMount(SceneObject *obj, S32 node); void onUnmount(SceneObject *obj, S32 node); @@ -218,7 +218,7 @@ public: return mComponents.size(); } - virtual void setObjectBox(Box3F objBox); + virtual void setObjectBox(const Box3F& objBox); void resetWorldBox() { Parent::resetWorldBox(); } void resetObjectBox() { Parent::resetObjectBox(); } diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.cpp b/Engine/source/T3D/systems/render/meshRenderSystem.cpp index 214a63dfe..f777b264b 100644 --- a/Engine/source/T3D/systems/render/meshRenderSystem.cpp +++ b/Engine/source/T3D/systems/render/meshRenderSystem.cpp @@ -11,6 +11,9 @@ Vector MeshRenderSystem::mStaticBuffers(0); void MeshRenderSystem::render(SceneManager *sceneManager, SceneRenderState* state) { + if (sceneManager == nullptr || state == nullptr) + return; + Frustum viewFrustum = state->getCullingFrustum(); MatrixF camTransform = state->getCameraTransform(); @@ -129,7 +132,7 @@ void MeshRenderSystem::render(SceneManager *sceneManager, SceneRenderState* stat // We sort by the material then vertex buffer ri->defaultKey = matInst->getStateHint(); - ri->defaultKey2 = (uintptr_t)ri->vertBuff; // Not 64bit safe! + ri->defaultKey2 = (U32)ri->vertBuff; // Not 64bit safe! // Submit our RenderInst to the RenderPassManager state->getRenderPass()->addInst(ri); diff --git a/Engine/source/gui/editor/inspector/entityGroup.cpp b/Engine/source/gui/editor/inspector/entityGroup.cpp index c833d336d..7b7559833 100644 --- a/Engine/source/gui/editor/inspector/entityGroup.cpp +++ b/Engine/source/gui/editor/inspector/entityGroup.cpp @@ -70,7 +70,8 @@ bool GuiInspectorEntityGroup::inspectGroup() { Entity* target = dynamic_cast(mParent->getInspectObject(0)); - Con::executef(this, "inspectObject", target->getIdString()); + if(target) + Con::executef(this, "inspectObject", target->getIdString()); } return true; From 8de2bf807fe26de44fc4403b10f6e9ee0ba5fd50 Mon Sep 17 00:00:00 2001 From: Johxz Date: Sun, 4 Feb 2018 21:49:50 -0600 Subject: [PATCH 118/312] update to bullet 2.87 --- Engine/lib/bullet/AUTHORS.txt | 9 +- Engine/lib/bullet/CMakeLists.txt | 182 ++- Engine/lib/bullet/README.md | 34 +- Engine/lib/bullet/VERSION | 2 +- .../BroadphaseCollision/btAxisSweep3.h | 1001 +------------- .../btAxisSweep3Internal.h | 1022 +++++++++++++++ .../btBroadphaseInterface.h | 6 +- .../BroadphaseCollision/btBroadphaseProxy.cpp | 1 + .../BroadphaseCollision/btBroadphaseProxy.h | 13 +- .../BroadphaseCollision/btDbvt.cpp | 110 +- .../BroadphaseCollision/btDbvt.h | 11 + .../BroadphaseCollision/btDbvtBroadphase.cpp | 9 +- .../BroadphaseCollision/btDbvtBroadphase.h | 4 +- .../btOverlappingPairCache.h | 14 +- .../btOverlappingPairCallback.h | 3 + .../BroadphaseCollision/btQuantizedBvh.cpp | 2 + .../BroadphaseCollision/btQuantizedBvh.h | 2 +- .../btSimpleBroadphase.cpp | 4 +- .../BroadphaseCollision/btSimpleBroadphase.h | 6 +- .../bullet/src/BulletCollision/CMakeLists.txt | 8 +- .../SphereTriangleDetector.cpp | 77 +- .../btActivatingCollisionAlgorithm.h | 3 +- .../btCollisionDispatcher.cpp | 3 - .../btCollisionDispatcherMt.cpp | 164 +++ .../btCollisionDispatcherMt.h | 39 + .../CollisionDispatch/btCollisionObject.cpp | 12 +- .../CollisionDispatch/btCollisionObject.h | 2 + .../CollisionDispatch/btCollisionWorld.cpp | 11 +- .../CollisionDispatch/btCollisionWorld.h | 14 +- .../btCollisionWorldImporter.cpp | 4 +- .../btCollisionWorldImporter.h | 1 - .../btCompoundCompoundCollisionAlgorithm.cpp | 11 + .../btCompoundCompoundCollisionAlgorithm.h | 2 - .../btConvexConcaveCollisionAlgorithm.cpp | 4 +- .../btConvexConvexAlgorithm.cpp | 50 +- .../btHashedSimplePairCache.h | 6 +- .../CollisionDispatch/btManifoldResult.cpp | 13 +- .../CollisionShapes/btBox2dShape.h | 3 +- .../CollisionShapes/btBoxShape.cpp | 4 +- .../btBvhTriangleMeshShape.cpp | 3 + .../CollisionShapes/btCapsuleShape.cpp | 26 +- .../CollisionShapes/btCapsuleShape.h | 34 +- .../CollisionShapes/btCollisionShape.cpp | 5 +- .../CollisionShapes/btConeShape.h | 12 +- .../CollisionShapes/btConvexHullShape.cpp | 5 +- .../CollisionShapes/btConvexInternalShape.h | 3 + .../CollisionShapes/btConvexShape.cpp | 10 +- .../CollisionShapes/btCylinderShape.cpp | 5 +- .../CollisionShapes/btCylinderShape.h | 10 +- .../CollisionShapes/btMinkowskiSumShape.cpp | 21 +- .../CollisionShapes/btMultiSphereShape.cpp | 5 +- .../CollisionShapes/btPolyhedralConvexShape.h | 4 +- .../CollisionShapes/btSphereShape.h | 3 + .../CollisionShapes/btStaticPlaneShape.h | 8 +- .../btStridingMeshInterface.cpp | 7 + .../CollisionShapes/btTriangleInfoMap.h | 7 + .../Gimpact/btCompoundFromGimpact.h | 20 +- .../Gimpact/btContactProcessing.h | 82 +- .../Gimpact/btContactProcessingStructs.h | 109 ++ .../BulletCollision/Gimpact/btGImpactBvh.h | 80 +- .../Gimpact/btGImpactBvhStructs.h | 105 ++ .../Gimpact/btGImpactQuantizedBvh.h | 69 +- .../Gimpact/btGImpactQuantizedBvhStructs.h | 91 ++ .../src/BulletCollision/Gimpact/gim_array.h | 2 +- .../Gimpact/gim_basic_geometry_operations.h | 7 +- .../Gimpact/gim_box_collision.h | 9 +- .../src/BulletCollision/Gimpact/gim_contact.h | 8 + .../Gimpact/gim_tri_collision.h | 3 +- .../btDiscreteCollisionDetectorInterface.h | 4 +- .../NarrowPhaseCollision/btManifoldPoint.h | 1 + .../btPersistentManifold.cpp | 3 + .../btPersistentManifold.h | 77 +- .../bullet/src/BulletDynamics/CMakeLists.txt | 2 + .../btKinematicCharacterController.cpp | 13 +- .../btConeTwistConstraint.cpp | 4 +- .../ConstraintSolver/btConeTwistConstraint.h | 2 +- .../ConstraintSolver/btContactConstraint.h | 4 +- .../ConstraintSolver/btContactSolverInfo.h | 15 +- .../ConstraintSolver/btGearConstraint.h | 8 + .../btGeneric6DofConstraint.cpp | 4 +- .../btGeneric6DofSpring2Constraint.cpp | 63 +- .../btGeneric6DofSpring2Constraint.h | 5 + .../ConstraintSolver/btHingeConstraint.cpp | 20 +- .../ConstraintSolver/btHingeConstraint.h | 10 +- .../btNNCGConstraintSolver.cpp | 115 +- .../btSequentialImpulseConstraintSolver.cpp | 416 +++--- .../btSequentialImpulseConstraintSolver.h | 26 +- .../ConstraintSolver/btSliderConstraint.cpp | 21 +- .../ConstraintSolver/btTypedConstraint.cpp | 2 +- .../Dynamics/btDiscreteDynamicsWorld.cpp | 14 +- .../Dynamics/btDiscreteDynamicsWorld.h | 4 +- .../Dynamics/btDiscreteDynamicsWorldMt.cpp | 171 ++- .../Dynamics/btDiscreteDynamicsWorldMt.h | 96 +- .../BulletDynamics/Dynamics/btDynamicsWorld.h | 7 +- .../BulletDynamics/Dynamics/btRigidBody.cpp | 5 + .../Dynamics/btSimpleDynamicsWorld.cpp | 2 +- .../Dynamics/btSimpleDynamicsWorld.h | 2 +- .../Dynamics/btSimulationIslandManagerMt.cpp | 41 +- .../Dynamics/btSimulationIslandManagerMt.h | 3 +- .../Featherstone/btMultiBody.cpp | 70 +- .../BulletDynamics/Featherstone/btMultiBody.h | 27 +- .../Featherstone/btMultiBodyConstraint.h | 14 +- .../btMultiBodyConstraintSolver.cpp | 181 ++- .../Featherstone/btMultiBodyDynamicsWorld.cpp | 16 +- .../Featherstone/btMultiBodyDynamicsWorld.h | 7 +- .../Featherstone/btMultiBodyFixedConstraint.h | 4 +- .../btMultiBodyGearConstraint.cpp | 184 +++ .../Featherstone/btMultiBodyGearConstraint.h | 117 ++ .../btMultiBodyJointLimitConstraint.cpp | 10 +- .../Featherstone/btMultiBodyJointMotor.cpp | 3 + .../Featherstone/btMultiBodyLink.h | 30 +- .../Featherstone/btMultiBodyLinkCollider.h | 47 +- .../Featherstone/btMultiBodyPoint2Point.h | 7 +- .../btMultiBodySliderConstraint.h | 4 +- .../BulletDynamics/Vehicle/btRaycastVehicle.h | 2 +- .../src/BulletDynamics/Vehicle/btWheelInfo.h | 2 + .../src/BulletInverseDynamics/IDConfig.hpp | 33 +- .../BulletInverseDynamics/IDErrorMessages.hpp | 7 +- .../src/BulletInverseDynamics/IDMath.cpp | 64 +- .../src/BulletInverseDynamics/IDMath.hpp | 3 +- .../BulletInverseDynamics/MultiBodyTree.cpp | 8 +- .../details/MultiBodyTreeImpl.cpp | 2 +- .../btDefaultSoftBodySolver.cpp | 12 +- .../bullet/src/BulletSoftBody/btSoftBody.cpp | 17 +- .../bullet/src/BulletSoftBody/btSoftBody.h | 9 +- .../src/BulletSoftBody/btSoftBodyHelpers.cpp | 4 +- .../src/BulletSoftBody/btSoftBodyInternals.h | 39 +- .../btSoftMultiBodyDynamicsWorld.cpp | 2 +- .../btSoftMultiBodyDynamicsWorld.h | 4 +- .../btSoftRigidCollisionAlgorithm.h | 4 +- .../btSoftRigidDynamicsWorld.cpp | 2 +- .../BulletSoftBody/btSoftRigidDynamicsWorld.h | 2 +- .../btSoftSoftCollisionAlgorithm.h | 4 +- .../bullet/src/BulletSoftBody/btSparseSDF.h | 2 +- Engine/lib/bullet/src/CMakeLists.txt | 6 +- .../lib/bullet/src/LinearMath/CMakeLists.txt | 1 + .../src/LinearMath/btAlignedObjectArray.h | 33 +- .../src/LinearMath/btConvexHullComputer.cpp | 15 +- Engine/lib/bullet/src/LinearMath/btHashMap.h | 43 +- .../lib/bullet/src/LinearMath/btIDebugDraw.h | 4 + .../lib/bullet/src/LinearMath/btMatrix3x3.h | 117 +- .../lib/bullet/src/LinearMath/btQuaternion.h | 40 +- .../lib/bullet/src/LinearMath/btQuickprof.cpp | 360 +++-- .../lib/bullet/src/LinearMath/btQuickprof.h | 68 +- Engine/lib/bullet/src/LinearMath/btScalar.h | 1027 ++++++++------- .../bullet/src/LinearMath/btSerializer.cpp | 1160 ++++------------- .../lib/bullet/src/LinearMath/btSerializer.h | 4 +- .../bullet/src/LinearMath/btSerializer64.cpp | 599 +++++++++ .../lib/bullet/src/LinearMath/btThreads.cpp | 522 +++++++- Engine/lib/bullet/src/LinearMath/btThreads.h | 109 +- .../bullet/src/LinearMath/btTransformUtil.h | 21 +- Engine/lib/bullet/src/LinearMath/btVector3.h | 15 +- .../lib/bullet/src/btBulletCollisionCommon.h | 1 - 153 files changed, 6111 insertions(+), 3756 deletions(-) create mode 100644 Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h create mode 100644 Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp create mode 100644 Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h create mode 100644 Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h create mode 100644 Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h create mode 100644 Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h create mode 100644 Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp create mode 100644 Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h create mode 100644 Engine/lib/bullet/src/LinearMath/btSerializer64.cpp diff --git a/Engine/lib/bullet/AUTHORS.txt b/Engine/lib/bullet/AUTHORS.txt index 556e6f641..1bff63207 100644 --- a/Engine/lib/bullet/AUTHORS.txt +++ b/Engine/lib/bullet/AUTHORS.txt @@ -2,17 +2,21 @@ Bullet Physics is created by Erwin Coumans with contributions from the following AMD Apple +Yunfei Bai Steve Baker Gino van den Bergen +Jeff Bingham Nicola Candussi Erin Catto Lawrence Chai Erwin Coumans -Christer Ericson Disney Animation +Benjamin Ellenberger +Christer Ericson Google Dirk Gregorius Marcus Hennix +Jasmine Hsu MBSim Development Team Takahiro Harada Simon Hobbs @@ -20,6 +24,7 @@ John Hsu Ole Kniemeyer Jay Lee Francisco Leon +lunkhound Vsevolod Klementjev Phil Knight John McCutchan @@ -32,9 +37,9 @@ Russel Smith Sony Jakub Stephien Marten Svanfeldt +Jie Tan Pierre Terdiman Steven Thompson Tamas Umenhoffer -Yunfei Bai If your name is missing, please send an email to erwin.coumans@gmail.com or file an issue at http://github.com/bulletphysics/bullet3 diff --git a/Engine/lib/bullet/CMakeLists.txt b/Engine/lib/bullet/CMakeLists.txt index 26e662c97..f0e62d396 100644 --- a/Engine/lib/bullet/CMakeLists.txt +++ b/Engine/lib/bullet/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 2.4.3) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - +cmake_policy(SET CMP0017 NEW) #this line has to appear before 'PROJECT' in order to be able to disable incremental linking SET(MSVC_INCREMENTAL_DEFAULT ON) PROJECT(BULLET_PHYSICS) -SET(BULLET_VERSION 2.85) +FILE (STRINGS "VERSION" BULLET_VERSION) IF(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) @@ -15,7 +15,6 @@ IF(COMMAND cmake_policy) endif(POLICY CMP0042) ENDIF(COMMAND cmake_policy) - IF (NOT CMAKE_BUILD_TYPE) # SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_BUILD_TYPE "Release") @@ -27,8 +26,33 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF) OPTION(USE_GRAPHICAL_BENCHMARK "Use Graphical Benchmark" ON) OPTION(BUILD_SHARED_LIBS "Use shared libraries" OFF) -OPTION(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" OFF) -OPTION(BULLET2_USE_THREAD_LOCKS "Build Bullet 2 libraries with mutex locking around certain operations" OFF) +OPTION(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" OFF) + +OPTION(BULLET2_USE_THREAD_LOCKS "Build Bullet 2 libraries with mutex locking around certain operations (required for multi-threading)" OFF) +IF (BULLET2_USE_THREAD_LOCKS) + OPTION(BULLET2_USE_OPEN_MP_MULTITHREADING "Build Bullet 2 with support for multi-threading with OpenMP (requires a compiler with OpenMP support)" OFF) + OPTION(BULLET2_USE_TBB_MULTITHREADING "Build Bullet 2 with support for multi-threading with Intel Threading Building Blocks (requires the TBB library to be already installed)" OFF) + IF (MSVC) + OPTION(BULLET2_USE_PPL_MULTITHREADING "Build Bullet 2 with support for multi-threading with Microsoft Parallel Patterns Library (requires MSVC compiler)" OFF) + ENDIF (MSVC) +ENDIF (BULLET2_USE_THREAD_LOCKS) + + +IF(NOT WIN32) + SET(DL ${CMAKE_DL_LIBS}) + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + MESSAGE("Linux") + SET(OSDEF -D_LINUX) + ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") + IF(APPLE) + MESSAGE("Apple") + SET(OSDEF -D_DARWIN) + ELSE(APPLE) + MESSAGE("BSD?") + SET(OSDEF -D_BSD) + ENDIF(APPLE) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") +ENDIF(NOT WIN32) OPTION(USE_MSVC_INCREMENTAL_LINKING "Use MSVC Incremental Linking" OFF) OPTION(USE_CUSTOM_VECTOR_MATH "Use custom vectormath library" OFF) @@ -85,15 +109,60 @@ IF(MSVC) ADD_DEFINITIONS(-D_WIN64) ELSE() OPTION(USE_MSVC_SSE "Use MSVC /arch:sse option" ON) + option(USE_MSVC_SSE2 "Compile your program with SSE2 instructions" ON) + IF (USE_MSVC_SSE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE") ENDIF() + IF (USE_MSVC_SSE2) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + ENDIF() + ENDIF() + + option(USE_MSVC_AVX "Compile your program with AVX instructions" OFF) + + IF(USE_MSVC_AVX) + add_definitions(/arch:AVX) + ENDIF() + OPTION(USE_MSVC_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON) IF (USE_MSVC_FAST_FLOATINGPOINT) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast") ENDIF() + OPTION(USE_MSVC_STRING_POOLING "Use MSVC /GF string pooling option" ON) + IF (USE_MSVC_STRING_POOLING) + SET(CMAKE_C_FLAGS "/GF ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "/GF ${CMAKE_CXX_FLAGS}") + ENDIF() + + OPTION(USE_MSVC_FUNCTION_LEVEL_LINKING "Use MSVC /Gy function level linking option" ON) + IF(USE_MSVC_FUNCTION_LEVEL_LINKING) + SET(CMAKE_C_FLAGS "/Gy ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "/Gy ${CMAKE_CXX_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF") + ENDIF(USE_MSVC_FUNCTION_LEVEL_LINKING) + + OPTION(USE_MSVC_EXEPTIONS "Use MSVC C++ exceptions option" OFF) + + + + OPTION(USE_MSVC_COMDAT_FOLDING "Use MSVC /OPT:ICF COMDAT folding option" ON) + + IF(USE_MSVC_COMDAT_FOLDING) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:ICF") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:ICF") + ENDIF() + + OPTION(USE_MSVC_DISABLE_RTTI "Use MSVC /GR- disabled RTTI flags option" ON) + IF(USE_MSVC_DISABLE_RTTI) + STRING(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI + SET(CMAKE_C_FLAGS "/GR- ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "/GR- ${CMAKE_CXX_FLAGS}") + ENDIF(USE_MSVC_DISABLE_RTTI) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267") ENDIF(MSVC) @@ -163,6 +232,30 @@ IF(BULLET2_USE_THREAD_LOCKS) ENDIF (NOT MSVC) ENDIF (BULLET2_USE_THREAD_LOCKS) +IF (BULLET2_USE_OPEN_MP_MULTITHREADING) + ADD_DEFINITIONS("-DBT_USE_OPENMP=1") + IF (MSVC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") + ELSE (MSVC) + # GCC, Clang + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") + ENDIF (MSVC) +ENDIF (BULLET2_USE_OPEN_MP_MULTITHREADING) + +IF (BULLET2_USE_TBB_MULTITHREADING) + SET (BULLET2_TBB_INCLUDE_DIR "not found" CACHE PATH "Directory for Intel TBB includes.") + SET (BULLET2_TBB_LIB_DIR "not found" CACHE PATH "Directory for Intel TBB libraries.") + find_library(TBB_LIBRARY tbb PATHS ${BULLET2_TBB_LIB_DIR}) + find_library(TBBMALLOC_LIBRARY tbbmalloc PATHS ${BULLET2_TBB_LIB_DIR}) + ADD_DEFINITIONS("-DBT_USE_TBB=1") + INCLUDE_DIRECTORIES( ${BULLET2_TBB_INCLUDE_DIR} ) + LINK_LIBRARIES( ${TBB_LIBRARY} ${TBBMALLOC_LIBRARY} ) +ENDIF (BULLET2_USE_TBB_MULTITHREADING) + +IF (BULLET2_USE_PPL_MULTITHREADING) + ADD_DEFINITIONS("-DBT_USE_PPL=1") +ENDIF (BULLET2_USE_PPL_MULTITHREADING) + IF (WIN32) OPTION(USE_GLUT "Use Glut" ON) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) @@ -208,19 +301,40 @@ IF (APPLE) ENDIF() OPTION(BUILD_BULLET3 "Set when you want to build Bullet 3" ON) +# Optional Python configuration +# builds pybullet automatically if all the requirements are met +SET(PYTHON_VERSION_PYBULLET "" CACHE STRING "Python version pybullet will use.") +SET(Python_ADDITIONAL_VERSIONS 3 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.7.12 2.7.10 2.7.3 ) +SET_PROPERTY(CACHE PYTHON_VERSION_PYBULLET PROPERTY STRINGS ${Python_ADDITIONAL_VERSIONS}) +SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build3/cmake ${CMAKE_MODULE_PATH}) +OPTION(EXACT_PYTHON_VERSION "Require Python and match PYTHON_VERSION_PYBULLET exactly, e.g. 2.7.12" OFF) +IF(EXACT_PYTHON_VERSION) + set(EXACT_PYTHON_VERSION_FLAG EXACT REQUIRED) +ENDIF(EXACT_PYTHON_VERSION) +# first find the python interpreter +FIND_PACKAGE(PythonInterp ${PYTHON_VERSION_PYBULLET} ${EXACT_PYTHON_VERSION_FLAG}) +# python library should exactly match that of the interpreter +FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_STRING} EXACT) +SET(DEFAULT_BUILD_PYBULLET OFF) +IF(PYTHONLIBS_FOUND) + SET(DEFAULT_BUILD_PYBULLET ON) +ENDIF(PYTHONLIBS_FOUND) +OPTION(BUILD_PYBULLET "Set when you want to build pybullet (Python bindings for Bullet)" ${DEFAULT_BUILD_PYBULLET}) -OPTION(BUILD_PYBULLET "Set when you want to build pybullet (experimental Python bindings for Bullet)" OFF) +OPTION(BUILD_ENET "Set when you want to build apps with enet UDP networking support" ON) +OPTION(BUILD_CLSOCKET "Set when you want to build apps with enet TCP networking support" ON) IF(BUILD_PYBULLET) - FIND_PACKAGE(PythonLibs) OPTION(BUILD_PYBULLET_NUMPY "Set when you want to build pybullet with NumPy support" OFF) OPTION(BUILD_PYBULLET_ENET "Set when you want to build pybullet with enet UDP networking support" ON) - - IF(BUILD_PYBULLET_NUMPY) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/build3/cmake) + OPTION(BUILD_PYBULLET_CLSOCKET "Set when you want to build pybullet with enet TCP networking support" ON) + + OPTION(BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" OFF) + + IF(BUILD_PYBULLET_NUMPY) #include(FindNumPy) FIND_PACKAGE(NumPy) if (PYTHON_NUMPY_FOUND) @@ -230,13 +344,25 @@ IF(BUILD_PYBULLET) message("NumPy not found") endif() ENDIF() - OPTION(BUILD_PYBULLET "Set when you want to build pybullet (experimental Python bindings for Bullet)" OFF) IF(WIN32) SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Shared Libs" FORCE) ELSE(WIN32) SET(BUILD_SHARED_LIBS ON CACHE BOOL "Shared Libs" FORCE) ENDIF(WIN32) + + IF(APPLE) + OPTION(BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" ON) + IF(NOT BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK) + add_definitions(-DB3_NO_PYTHON_FRAMEWORK) + ENDIF(NOT BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK) + OPTION(BUILD_PYBULLET_SHOW_PY_VERSION "Set when you want to show the PY_MAJOR_VERSION and PY_MAJOR_VERSION using #pragme message." OFF) + IF(BUILD_PYBULLET_SHOW_PY_VERSION) + add_definitions(-DB3_DUMP_PYTHON_VERSION) + ENDIF() + + ENDIF(APPLE) + ENDIF(BUILD_PYBULLET) IF(BUILD_BULLET3) @@ -272,14 +398,6 @@ IF(BUILD_BULLET2_DEMOS) SUBDIRS(examples) ENDIF() - IF (BULLET2_USE_THREAD_LOCKS) - OPTION(BULLET2_MULTITHREADED_OPEN_MP_DEMO "Build Bullet 2 MultithreadedDemo using OpenMP (requires a compiler with OpenMP support)" OFF) - OPTION(BULLET2_MULTITHREADED_TBB_DEMO "Build Bullet 2 MultithreadedDemo using Intel Threading Building Blocks (requires the TBB library to be already installed)" OFF) - IF (MSVC) - OPTION(BULLET2_MULTITHREADED_PPL_DEMO "Build Bullet 2 MultithreadedDemo using Microsoft Parallel Patterns Library (requires MSVC compiler)" OFF) - ENDIF (MSVC) - ENDIF (BULLET2_USE_THREAD_LOCKS) - ENDIF(BUILD_BULLET2_DEMOS) @@ -290,7 +408,6 @@ IF(BUILD_EXTRAS) ENDIF(BUILD_EXTRAS) -#Maya Dynamica plugin is moved to http://dynamica.googlecode.com SUBDIRS(src) @@ -305,7 +422,15 @@ ELSE() ENDIF() ENDIF() + IF(INSTALL_LIBS) + #INSTALL of other files requires CMake 2.6 + IF(BUILD_EXTRAS) + IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) + OPTION(INSTALL_EXTRA_LIBS "Set when you want extra libraries installed" ON) + ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) + ENDIF(BUILD_EXTRAS) + SET (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) SET (LIB_DESTINATION "lib${LIB_SUFFIX}" CACHE STRING "Library directory name") ## the following are directories where stuff will be installed to @@ -319,12 +444,8 @@ IF(INSTALL_LIBS) DESTINATION ${PKGCONFIG_INSTALL_PREFIX}) ENDIF(NOT MSVC) -ENDIF(INSTALL_LIBS) +ENDIF() -#INSTALL of other files requires CMake 2.6 -IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) - OPTION(INSTALL_EXTRA_LIBS "Set when you want extra libraries installed" OFF) -ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) OPTION(BUILD_UNIT_TESTS "Build Unit Tests" ON) @@ -335,9 +456,8 @@ ENDIF() set (BULLET_CONFIG_CMAKE_PATH lib${LIB_SUFFIX}/cmake/bullet ) list (APPEND BULLET_LIBRARIES LinearMath) -IF(BUILD_BULLET3) - list (APPEND BULLET_LIBRARIES BulletInverseDynamics) -ENDIF(BUILD_BULLET3) +list (APPEND BULLET_LIBRARIES Bullet3Common) +list (APPEND BULLET_LIBRARIES BulletInverseDynamics) list (APPEND BULLET_LIBRARIES BulletCollision) list (APPEND BULLET_LIBRARIES BulletDynamics) list (APPEND BULLET_LIBRARIES BulletSoftBody) @@ -346,7 +466,11 @@ configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/BulletConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/BulletConfig.cmake @ONLY ESCAPE_QUOTES ) -install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/UseBullet.cmake +OPTION(INSTALL_CMAKE_FILES "Install generated CMake files" ON) + +IF (INSTALL_CMAKE_FILES) + install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/UseBullet.cmake ${CMAKE_CURRENT_BINARY_DIR}/BulletConfig.cmake DESTINATION ${BULLET_CONFIG_CMAKE_PATH} ) +ENDIF (INSTALL_CMAKE_FILES) diff --git a/Engine/lib/bullet/README.md b/Engine/lib/bullet/README.md index 28821e4e3..6224da8b5 100644 --- a/Engine/lib/bullet/README.md +++ b/Engine/lib/bullet/README.md @@ -49,36 +49,48 @@ All source code files are licensed under the permissive zlib license **Windows** -Click on build_visual_studio.bat and open build3/vs2010/0MySolution.sln +Click on build_visual_studio_vr_pybullet_double.bat and open build3/vs2010/0MySolution.sln +When asked, convert the projects to a newer version of Visual Studio. +If you installed Python in the C:\ root directory, the batch file should find it automatically. +Otherwise, edit this batch file to choose where Python include/lib directories are located. **Windows Virtual Reality sandbox for HTC Vive and Oculus Rift** -Click on build_visual_studio_vr_pybullet_double.bat and open build3/vs2010/0MySolution.sln -Edit this batch file to choose where Python include/lib directories are located. Build and run the App_SharedMemoryPhysics_VR project, preferably in Release/optimized build. You can connect from Python pybullet to the sandbox using: ``` import pybullet as p -p.connect(p.SHARED_MEMORY) +p.connect(p.SHARED_MEMORY) #or (p.TCP, "localhost", 6667) or (p.UDP, "192.168.86.10",1234) ``` **Linux and Mac OSX gnu make** +Make sure cmake is installed (sudo apt-get install cmake, brew install cmake, or https://cmake.org) + In a terminal type: - cd build3 + ./build_cmake_pybullet_double.sh +This script will invoke cmake and build in the build_cmake directory. You can find pybullet in Bullet/examples/pybullet. +The BulletExampleBrowser binary will be in Bullet/examples/ExampleBrowser. + +You can also build Bullet using premake. There are premake executables in the build3 folder. Depending on your system (Linux 32bit, 64bit or Mac OSX) use one of the following lines - - ./premake4_linux gmake - ./premake4_linux64 gmake - ./premake4_osx gmake - +Using premake: +``` + cd build3 + ./premake4_linux gmake --double + ./premake4_linux64 gmake --double + ./premake4_osx gmake --double --enable_pybullet +``` Then - +``` cd gmake make +``` + +Note that on Linux, you need to use cmake to build pybullet, since the compiler has issues of mixing shared and static libraries. **Mac OSX Xcode** diff --git a/Engine/lib/bullet/VERSION b/Engine/lib/bullet/VERSION index 7cf322cf9..3274853c8 100644 --- a/Engine/lib/bullet/VERSION +++ b/Engine/lib/bullet/VERSION @@ -1 +1 @@ -2.85 +2.87 diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h index cd6e1a892..a3648df1a 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h @@ -25,1005 +25,7 @@ #include "btBroadphaseProxy.h" #include "btOverlappingPairCallback.h" #include "btDbvtBroadphase.h" - -//#define DEBUG_BROADPHASE 1 -#define USE_OVERLAP_TEST_ON_REMOVES 1 - -/// The internal templace class btAxisSweep3Internal implements the sweep and prune broadphase. -/// It uses quantized integers to represent the begin and end points for each of the 3 axis. -/// Dont use this class directly, use btAxisSweep3 or bt32BitAxisSweep3 instead. -template -class btAxisSweep3Internal : public btBroadphaseInterface -{ -protected: - - BP_FP_INT_TYPE m_bpHandleMask; - BP_FP_INT_TYPE m_handleSentinel; - -public: - - BT_DECLARE_ALIGNED_ALLOCATOR(); - - class Edge - { - public: - BP_FP_INT_TYPE m_pos; // low bit is min/max - BP_FP_INT_TYPE m_handle; - - BP_FP_INT_TYPE IsMax() const {return static_cast(m_pos & 1);} - }; - -public: - class Handle : public btBroadphaseProxy - { - public: - BT_DECLARE_ALIGNED_ALLOCATOR(); - - // indexes into the edge arrays - BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12 -// BP_FP_INT_TYPE m_uniqueId; - btBroadphaseProxy* m_dbvtProxy;//for faster raycast - //void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject - - SIMD_FORCE_INLINE void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;} - SIMD_FORCE_INLINE BP_FP_INT_TYPE GetNextFree() const {return m_minEdges[0];} - }; // 24 bytes + 24 for Edge structures = 44 bytes total per entry - - -protected: - btVector3 m_worldAabbMin; // overall system bounds - btVector3 m_worldAabbMax; // overall system bounds - - btVector3 m_quantize; // scaling factor for quantization - - BP_FP_INT_TYPE m_numHandles; // number of active handles - BP_FP_INT_TYPE m_maxHandles; // max number of handles - Handle* m_pHandles; // handles pool - - BP_FP_INT_TYPE m_firstFreeHandle; // free handles list - - Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries) - void* m_pEdgesRawPtr[3]; - - btOverlappingPairCache* m_pairCache; - - ///btOverlappingPairCallback is an additional optional user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. - btOverlappingPairCallback* m_userPairCallback; - - bool m_ownsPairCache; - - int m_invalidPair; - - ///additional dynamic aabb structure, used to accelerate ray cast queries. - ///can be disabled using a optional argument in the constructor - btDbvtBroadphase* m_raycastAccelerator; - btOverlappingPairCache* m_nullPairCache; - - - // allocation/deallocation - BP_FP_INT_TYPE allocHandle(); - void freeHandle(BP_FP_INT_TYPE handle); - - - bool testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1); - -#ifdef DEBUG_BROADPHASE - void debugPrintAxis(int axis,bool checkCardinality=true); -#endif //DEBUG_BROADPHASE - - //Overlap* AddOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); - //void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); - - - - void sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - void sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - void sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - void sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - -public: - - btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0,bool disableRaycastAccelerator = false); - - virtual ~btAxisSweep3Internal(); - - BP_FP_INT_TYPE getNumHandles() const - { - return m_numHandles; - } - - virtual void calculateOverlappingPairs(btDispatcher* dispatcher); - - BP_FP_INT_TYPE addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy); - void removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher); - void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); - SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;} - - virtual void resetPool(btDispatcher* dispatcher); - - void processAllOverlappingPairs(btOverlapCallback* callback); - - //Broadphase Interface - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy); - virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); - virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); - virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; - - virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); - virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback); - - - void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const; - ///unQuantize should be conservative: aabbMin/aabbMax should be larger then 'getAabb' result - void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; - - bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1); - - btOverlappingPairCache* getOverlappingPairCache() - { - return m_pairCache; - } - const btOverlappingPairCache* getOverlappingPairCache() const - { - return m_pairCache; - } - - void setOverlappingPairUserCallback(btOverlappingPairCallback* pairCallback) - { - m_userPairCallback = pairCallback; - } - const btOverlappingPairCallback* getOverlappingPairUserCallback() const - { - return m_userPairCallback; - } - - ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame - ///will add some transform later - virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const - { - aabbMin = m_worldAabbMin; - aabbMax = m_worldAabbMax; - } - - virtual void printStats() - { -/* printf("btAxisSweep3.h\n"); - printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles); - printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.getX(),m_worldAabbMin.getY(),m_worldAabbMin.getZ(), - m_worldAabbMax.getX(),m_worldAabbMax.getY(),m_worldAabbMax.getZ()); - */ - - } - -}; - -//////////////////////////////////////////////////////////////////// - - - - -#ifdef DEBUG_BROADPHASE -#include - -template -void btAxisSweep3::debugPrintAxis(int axis, bool checkCardinality) -{ - int numEdges = m_pHandles[0].m_maxEdges[axis]; - printf("SAP Axis %d, numEdges=%d\n",axis,numEdges); - - int i; - for (i=0;im_handle); - int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis]; - char beginOrEnd; - beginOrEnd=pEdge->IsMax()?'E':'B'; - printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_handle,pEdge->m_pos,handleIndex); - } - - if (checkCardinality) - btAssert(numEdges == m_numHandles*2+1); -} -#endif //DEBUG_BROADPHASE - -template -btBroadphaseProxy* btAxisSweep3Internal::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy) -{ - (void)shapeType; - BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,multiSapProxy); - - Handle* handle = getHandle(handleId); - - if (m_raycastAccelerator) - { - btBroadphaseProxy* rayProxy = m_raycastAccelerator->createProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,0); - handle->m_dbvtProxy = rayProxy; - } - return handle; -} - - - -template -void btAxisSweep3Internal::destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher) -{ - Handle* handle = static_cast(proxy); - if (m_raycastAccelerator) - m_raycastAccelerator->destroyProxy(handle->m_dbvtProxy,dispatcher); - removeHandle(static_cast(handle->m_uniqueId), dispatcher); -} - -template -void btAxisSweep3Internal::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) -{ - Handle* handle = static_cast(proxy); - handle->m_aabbMin = aabbMin; - handle->m_aabbMax = aabbMax; - updateHandle(static_cast(handle->m_uniqueId), aabbMin, aabbMax,dispatcher); - if (m_raycastAccelerator) - m_raycastAccelerator->setAabb(handle->m_dbvtProxy,aabbMin,aabbMax,dispatcher); - -} - -template -void btAxisSweep3Internal::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax) -{ - if (m_raycastAccelerator) - { - m_raycastAccelerator->rayTest(rayFrom,rayTo,rayCallback,aabbMin,aabbMax); - } else - { - //choose axis? - BP_FP_INT_TYPE axis = 0; - //for each proxy - for (BP_FP_INT_TYPE i=1;i -void btAxisSweep3Internal::aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback) -{ - if (m_raycastAccelerator) - { - m_raycastAccelerator->aabbTest(aabbMin,aabbMax,callback); - } else - { - //choose axis? - BP_FP_INT_TYPE axis = 0; - //for each proxy - for (BP_FP_INT_TYPE i=1;im_aabbMin,handle->m_aabbMax)) - { - callback.process(handle); - } - } - } - } -} - - - -template -void btAxisSweep3Internal::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const -{ - Handle* pHandle = static_cast(proxy); - aabbMin = pHandle->m_aabbMin; - aabbMax = pHandle->m_aabbMax; -} - - -template -void btAxisSweep3Internal::unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const -{ - Handle* pHandle = static_cast(proxy); - - unsigned short vecInMin[3]; - unsigned short vecInMax[3]; - - vecInMin[0] = m_pEdges[0][pHandle->m_minEdges[0]].m_pos ; - vecInMax[0] = m_pEdges[0][pHandle->m_maxEdges[0]].m_pos +1 ; - vecInMin[1] = m_pEdges[1][pHandle->m_minEdges[1]].m_pos ; - vecInMax[1] = m_pEdges[1][pHandle->m_maxEdges[1]].m_pos +1 ; - vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos ; - vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos +1 ; - - aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.getX()),(btScalar)(vecInMin[1]) / (m_quantize.getY()),(btScalar)(vecInMin[2]) / (m_quantize.getZ())); - aabbMin += m_worldAabbMin; - - aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.getX()),(btScalar)(vecInMax[1]) / (m_quantize.getY()),(btScalar)(vecInMax[2]) / (m_quantize.getZ())); - aabbMax += m_worldAabbMin; -} - - - - -template -btAxisSweep3Internal::btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache , bool disableRaycastAccelerator) -:m_bpHandleMask(handleMask), -m_handleSentinel(handleSentinel), -m_pairCache(pairCache), -m_userPairCallback(0), -m_ownsPairCache(false), -m_invalidPair(0), -m_raycastAccelerator(0) -{ - BP_FP_INT_TYPE maxHandles = static_cast(userMaxHandles+1);//need to add one sentinel handle - - if (!m_pairCache) - { - void* ptr = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16); - m_pairCache = new(ptr) btHashedOverlappingPairCache(); - m_ownsPairCache = true; - } - - if (!disableRaycastAccelerator) - { - m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache),16)) btNullPairCache(); - m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache); - m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs - } - - //btAssert(bounds.HasVolume()); - - // init bounds - m_worldAabbMin = worldAabbMin; - m_worldAabbMax = worldAabbMax; - - btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin; - - BP_FP_INT_TYPE maxInt = m_handleSentinel; - - m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize; - - // allocate handles buffer, using btAlignedAlloc, and put all handles on free list - m_pHandles = new Handle[maxHandles]; - - m_maxHandles = maxHandles; - m_numHandles = 0; - - // handle 0 is reserved as the null index, and is also used as the sentinel - m_firstFreeHandle = 1; - { - for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++) - m_pHandles[i].SetNextFree(static_cast(i + 1)); - m_pHandles[maxHandles - 1].SetNextFree(0); - } - - { - // allocate edge buffers - for (int i = 0; i < 3; i++) - { - m_pEdgesRawPtr[i] = btAlignedAlloc(sizeof(Edge)*maxHandles*2,16); - m_pEdges[i] = new(m_pEdgesRawPtr[i]) Edge[maxHandles * 2]; - } - } - //removed overlap management - - // make boundary sentinels - - m_pHandles[0].m_clientObject = 0; - - for (int axis = 0; axis < 3; axis++) - { - m_pHandles[0].m_minEdges[axis] = 0; - m_pHandles[0].m_maxEdges[axis] = 1; - - m_pEdges[axis][0].m_pos = 0; - m_pEdges[axis][0].m_handle = 0; - m_pEdges[axis][1].m_pos = m_handleSentinel; - m_pEdges[axis][1].m_handle = 0; -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - - } - -} - -template -btAxisSweep3Internal::~btAxisSweep3Internal() -{ - if (m_raycastAccelerator) - { - m_nullPairCache->~btOverlappingPairCache(); - btAlignedFree(m_nullPairCache); - m_raycastAccelerator->~btDbvtBroadphase(); - btAlignedFree (m_raycastAccelerator); - } - - for (int i = 2; i >= 0; i--) - { - btAlignedFree(m_pEdgesRawPtr[i]); - } - delete [] m_pHandles; - - if (m_ownsPairCache) - { - m_pairCache->~btOverlappingPairCache(); - btAlignedFree(m_pairCache); - } -} - -template -void btAxisSweep3Internal::quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const -{ -#ifdef OLD_CLAMPING_METHOD - ///problem with this clamping method is that the floating point during quantization might still go outside the range [(0|isMax) .. (m_handleSentinel&m_bpHandleMask]|isMax] - ///see http://code.google.com/p/bullet/issues/detail?id=87 - btVector3 clampedPoint(point); - clampedPoint.setMax(m_worldAabbMin); - clampedPoint.setMin(m_worldAabbMax); - btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize; - out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & m_bpHandleMask) | isMax); - out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & m_bpHandleMask) | isMax); - out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & m_bpHandleMask) | isMax); -#else - btVector3 v = (point - m_worldAabbMin) * m_quantize; - out[0]=(v[0]<=0)?(BP_FP_INT_TYPE)isMax:(v[0]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[0]&m_bpHandleMask)|isMax); - out[1]=(v[1]<=0)?(BP_FP_INT_TYPE)isMax:(v[1]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[1]&m_bpHandleMask)|isMax); - out[2]=(v[2]<=0)?(BP_FP_INT_TYPE)isMax:(v[2]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[2]&m_bpHandleMask)|isMax); -#endif //OLD_CLAMPING_METHOD -} - - -template -BP_FP_INT_TYPE btAxisSweep3Internal::allocHandle() -{ - btAssert(m_firstFreeHandle); - - BP_FP_INT_TYPE handle = m_firstFreeHandle; - m_firstFreeHandle = getHandle(handle)->GetNextFree(); - m_numHandles++; - - return handle; -} - -template -void btAxisSweep3Internal::freeHandle(BP_FP_INT_TYPE handle) -{ - btAssert(handle > 0 && handle < m_maxHandles); - - getHandle(handle)->SetNextFree(m_firstFreeHandle); - m_firstFreeHandle = handle; - - m_numHandles--; -} - - -template -BP_FP_INT_TYPE btAxisSweep3Internal::addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy) -{ - // quantize the bounds - BP_FP_INT_TYPE min[3], max[3]; - quantize(min, aabbMin, 0); - quantize(max, aabbMax, 1); - - // allocate a handle - BP_FP_INT_TYPE handle = allocHandle(); - - - Handle* pHandle = getHandle(handle); - - pHandle->m_uniqueId = static_cast(handle); - //pHandle->m_pOverlaps = 0; - pHandle->m_clientObject = pOwner; - pHandle->m_collisionFilterGroup = collisionFilterGroup; - pHandle->m_collisionFilterMask = collisionFilterMask; - pHandle->m_multiSapParentProxy = multiSapProxy; - - // compute current limit of edge arrays - BP_FP_INT_TYPE limit = static_cast(m_numHandles * 2); - - - // insert new edges just inside the max boundary edge - for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++) - { - - m_pHandles[0].m_maxEdges[axis] += 2; - - m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1]; - - m_pEdges[axis][limit - 1].m_pos = min[axis]; - m_pEdges[axis][limit - 1].m_handle = handle; - - m_pEdges[axis][limit].m_pos = max[axis]; - m_pEdges[axis][limit].m_handle = handle; - - pHandle->m_minEdges[axis] = static_cast(limit - 1); - pHandle->m_maxEdges[axis] = limit; - } - - // now sort the new edges to their correct position - sortMinDown(0, pHandle->m_minEdges[0], dispatcher,false); - sortMaxDown(0, pHandle->m_maxEdges[0], dispatcher,false); - sortMinDown(1, pHandle->m_minEdges[1], dispatcher,false); - sortMaxDown(1, pHandle->m_maxEdges[1], dispatcher,false); - sortMinDown(2, pHandle->m_minEdges[2], dispatcher,true); - sortMaxDown(2, pHandle->m_maxEdges[2], dispatcher,true); - - - return handle; -} - - -template -void btAxisSweep3Internal::removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher) -{ - - Handle* pHandle = getHandle(handle); - - //explicitly remove the pairs containing the proxy - //we could do it also in the sortMinUp (passing true) - ///@todo: compare performance - if (!m_pairCache->hasDeferredRemoval()) - { - m_pairCache->removeOverlappingPairsContainingProxy(pHandle,dispatcher); - } - - // compute current limit of edge arrays - int limit = static_cast(m_numHandles * 2); - - int axis; - - for (axis = 0;axis<3;axis++) - { - m_pHandles[0].m_maxEdges[axis] -= 2; - } - - // remove the edges by sorting them up to the end of the list - for ( axis = 0; axis < 3; axis++) - { - Edge* pEdges = m_pEdges[axis]; - BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis]; - pEdges[max].m_pos = m_handleSentinel; - - sortMaxUp(axis,max,dispatcher,false); - - - BP_FP_INT_TYPE i = pHandle->m_minEdges[axis]; - pEdges[i].m_pos = m_handleSentinel; - - - sortMinUp(axis,i,dispatcher,false); - - pEdges[limit-1].m_handle = 0; - pEdges[limit-1].m_pos = m_handleSentinel; - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis,false); -#endif //DEBUG_BROADPHASE - - - } - - - // free the handle - freeHandle(handle); - - -} - -template -void btAxisSweep3Internal::resetPool(btDispatcher* /*dispatcher*/) -{ - if (m_numHandles == 0) - { - m_firstFreeHandle = 1; - { - for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_maxHandles; i++) - m_pHandles[i].SetNextFree(static_cast(i + 1)); - m_pHandles[m_maxHandles - 1].SetNextFree(0); - } - } -} - - -extern int gOverlappingPairs; -//#include - -template -void btAxisSweep3Internal::calculateOverlappingPairs(btDispatcher* dispatcher) -{ - - if (m_pairCache->hasDeferredRemoval()) - { - - btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray(); - - //perform a sort, to find duplicates and to sort 'invalid' pairs to the end - overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - - - int i; - - btBroadphasePair previousPair; - previousPair.m_pProxy0 = 0; - previousPair.m_pProxy1 = 0; - previousPair.m_algorithm = 0; - - - for (i=0;iprocessOverlap(pair); - } else - { - needsRemoval = true; - } - } else - { - //remove duplicate - needsRemoval = true; - //should have no algorithm - btAssert(!pair.m_algorithm); - } - - if (needsRemoval) - { - m_pairCache->cleanOverlappingPair(pair,dispatcher); - - // m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1); - // m_overlappingPairArray.pop_back(); - pair.m_pProxy0 = 0; - pair.m_pProxy1 = 0; - m_invalidPair++; - gOverlappingPairs--; - } - - } - - ///if you don't like to skip the invalid pairs in the array, execute following code: - #define CLEAN_INVALID_PAIRS 1 - #ifdef CLEAN_INVALID_PAIRS - - //perform a sort, to sort 'invalid' pairs to the end - overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - #endif//CLEAN_INVALID_PAIRS - - //printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size()); - } - -} - - -template -bool btAxisSweep3Internal::testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) -{ - const Handle* pHandleA = static_cast(proxy0); - const Handle* pHandleB = static_cast(proxy1); - - //optimization 1: check the array index (memory address), instead of the m_pos - - for (int axis = 0; axis < 3; axis++) - { - if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] || - pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis]) - { - return false; - } - } - return true; -} - -template -bool btAxisSweep3Internal::testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1) -{ - //optimization 1: check the array index (memory address), instead of the m_pos - - if (pHandleA->m_maxEdges[axis0] < pHandleB->m_minEdges[axis0] || - pHandleB->m_maxEdges[axis0] < pHandleA->m_minEdges[axis0] || - pHandleA->m_maxEdges[axis1] < pHandleB->m_minEdges[axis1] || - pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1]) - { - return false; - } - return true; -} - -template -void btAxisSweep3Internal::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) -{ -// btAssert(bounds.IsFinite()); - //btAssert(bounds.HasVolume()); - - Handle* pHandle = getHandle(handle); - - // quantize the new bounds - BP_FP_INT_TYPE min[3], max[3]; - quantize(min, aabbMin, 0); - quantize(max, aabbMax, 1); - - // update changed edges - for (int axis = 0; axis < 3; axis++) - { - BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis]; - BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis]; - - int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos; - int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos; - - m_pEdges[axis][emin].m_pos = min[axis]; - m_pEdges[axis][emax].m_pos = max[axis]; - - // expand (only adds overlaps) - if (dmin < 0) - sortMinDown(axis, emin,dispatcher,true); - - if (dmax > 0) - sortMaxUp(axis, emax,dispatcher,true); - - // shrink (only removes overlaps) - if (dmin > 0) - sortMinUp(axis, emin,dispatcher,true); - - if (dmax < 0) - sortMaxDown(axis, emax,dispatcher,true); - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - } - - -} - - - - -// sorting a min edge downwards can only ever *add* overlaps -template -void btAxisSweep3Internal::sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) -{ - - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pPrev = pEdge - 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pEdge->m_pos < pPrev->m_pos) - { - Handle* pHandlePrev = getHandle(pPrev->m_handle); - - if (pPrev->IsMax()) - { - // if previous edge is a maximum check the bounds and add an overlap if necessary - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - if (updateOverlaps && testOverlap2D(pHandleEdge, pHandlePrev,axis1,axis2)) - { - m_pairCache->addOverlappingPair(pHandleEdge,pHandlePrev); - if (m_userPairCallback) - m_userPairCallback->addOverlappingPair(pHandleEdge,pHandlePrev); - - //AddOverlap(pEdge->m_handle, pPrev->m_handle); - - } - - // update edge reference in other handle - pHandlePrev->m_maxEdges[axis]++; - } - else - pHandlePrev->m_minEdges[axis]++; - - pHandleEdge->m_minEdges[axis]--; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pPrev; - *pPrev = swap; - - // decrement - pEdge--; - pPrev--; - } - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - -} - -// sorting a min edge upwards can only ever *remove* overlaps -template -void btAxisSweep3Internal::sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pNext = pEdge + 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) - { - Handle* pHandleNext = getHandle(pNext->m_handle); - - if (pNext->IsMax()) - { - Handle* handle0 = getHandle(pEdge->m_handle); - Handle* handle1 = getHandle(pNext->m_handle); - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - - // if next edge is maximum remove any overlap between the two handles - if (updateOverlaps -#ifdef USE_OVERLAP_TEST_ON_REMOVES - && testOverlap2D(handle0,handle1,axis1,axis2) -#endif //USE_OVERLAP_TEST_ON_REMOVES - ) - { - - - m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); - if (m_userPairCallback) - m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); - - } - - - // update edge reference in other handle - pHandleNext->m_maxEdges[axis]--; - } - else - pHandleNext->m_minEdges[axis]--; - - pHandleEdge->m_minEdges[axis]++; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pNext; - *pNext = swap; - - // increment - pEdge++; - pNext++; - } - - -} - -// sorting a max edge downwards can only ever *remove* overlaps -template -void btAxisSweep3Internal::sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) -{ - - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pPrev = pEdge - 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pEdge->m_pos < pPrev->m_pos) - { - Handle* pHandlePrev = getHandle(pPrev->m_handle); - - if (!pPrev->IsMax()) - { - // if previous edge was a minimum remove any overlap between the two handles - Handle* handle0 = getHandle(pEdge->m_handle); - Handle* handle1 = getHandle(pPrev->m_handle); - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - - if (updateOverlaps -#ifdef USE_OVERLAP_TEST_ON_REMOVES - && testOverlap2D(handle0,handle1,axis1,axis2) -#endif //USE_OVERLAP_TEST_ON_REMOVES - ) - { - //this is done during the overlappingpairarray iteration/narrowphase collision - - - m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); - if (m_userPairCallback) - m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); - - - - } - - // update edge reference in other handle - pHandlePrev->m_minEdges[axis]++;; - } - else - pHandlePrev->m_maxEdges[axis]++; - - pHandleEdge->m_maxEdges[axis]--; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pPrev; - *pPrev = swap; - - // decrement - pEdge--; - pPrev--; - } - - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - -} - -// sorting a max edge upwards can only ever *add* overlaps -template -void btAxisSweep3Internal::sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pNext = pEdge + 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) - { - Handle* pHandleNext = getHandle(pNext->m_handle); - - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - - if (!pNext->IsMax()) - { - // if next edge is a minimum check the bounds and add an overlap if necessary - if (updateOverlaps && testOverlap2D(pHandleEdge, pHandleNext,axis1,axis2)) - { - Handle* handle0 = getHandle(pEdge->m_handle); - Handle* handle1 = getHandle(pNext->m_handle); - m_pairCache->addOverlappingPair(handle0,handle1); - if (m_userPairCallback) - m_userPairCallback->addOverlappingPair(handle0,handle1); - } - - // update edge reference in other handle - pHandleNext->m_minEdges[axis]--; - } - else - pHandleNext->m_maxEdges[axis]--; - - pHandleEdge->m_maxEdges[axis]++; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pNext; - *pNext = swap; - - // increment - pEdge++; - pNext++; - } - -} - - - -//////////////////////////////////////////////////////////////////// - +#include "btAxisSweep3Internal.h" /// The btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase. /// It uses arrays rather then lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats. @@ -1048,4 +50,3 @@ public: }; #endif - diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h new file mode 100644 index 000000000..2c4d41bc0 --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h @@ -0,0 +1,1022 @@ +//Bullet Continuous Collision Detection and Physics Library +//Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +// +// btAxisSweep3.h +// +// Copyright (c) 2006 Simon Hobbs +// +// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. + +#ifndef BT_AXIS_SWEEP_3_INTERNAL_H +#define BT_AXIS_SWEEP_3_INTERNAL_H + +#include "LinearMath/btVector3.h" +#include "btOverlappingPairCache.h" +#include "btBroadphaseInterface.h" +#include "btBroadphaseProxy.h" +#include "btOverlappingPairCallback.h" +#include "btDbvtBroadphase.h" + +//#define DEBUG_BROADPHASE 1 +#define USE_OVERLAP_TEST_ON_REMOVES 1 + +/// The internal templace class btAxisSweep3Internal implements the sweep and prune broadphase. +/// It uses quantized integers to represent the begin and end points for each of the 3 axis. +/// Dont use this class directly, use btAxisSweep3 or bt32BitAxisSweep3 instead. +template +class btAxisSweep3Internal : public btBroadphaseInterface +{ +protected: + + BP_FP_INT_TYPE m_bpHandleMask; + BP_FP_INT_TYPE m_handleSentinel; + +public: + + BT_DECLARE_ALIGNED_ALLOCATOR(); + + class Edge + { + public: + BP_FP_INT_TYPE m_pos; // low bit is min/max + BP_FP_INT_TYPE m_handle; + + BP_FP_INT_TYPE IsMax() const {return static_cast(m_pos & 1);} + }; + +public: + class Handle : public btBroadphaseProxy + { + public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + + // indexes into the edge arrays + BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12 +// BP_FP_INT_TYPE m_uniqueId; + btBroadphaseProxy* m_dbvtProxy;//for faster raycast + //void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject + + SIMD_FORCE_INLINE void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;} + SIMD_FORCE_INLINE BP_FP_INT_TYPE GetNextFree() const {return m_minEdges[0];} + }; // 24 bytes + 24 for Edge structures = 44 bytes total per entry + + +protected: + btVector3 m_worldAabbMin; // overall system bounds + btVector3 m_worldAabbMax; // overall system bounds + + btVector3 m_quantize; // scaling factor for quantization + + BP_FP_INT_TYPE m_numHandles; // number of active handles + BP_FP_INT_TYPE m_maxHandles; // max number of handles + Handle* m_pHandles; // handles pool + + BP_FP_INT_TYPE m_firstFreeHandle; // free handles list + + Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries) + void* m_pEdgesRawPtr[3]; + + btOverlappingPairCache* m_pairCache; + + ///btOverlappingPairCallback is an additional optional user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. + btOverlappingPairCallback* m_userPairCallback; + + bool m_ownsPairCache; + + int m_invalidPair; + + ///additional dynamic aabb structure, used to accelerate ray cast queries. + ///can be disabled using a optional argument in the constructor + btDbvtBroadphase* m_raycastAccelerator; + btOverlappingPairCache* m_nullPairCache; + + + // allocation/deallocation + BP_FP_INT_TYPE allocHandle(); + void freeHandle(BP_FP_INT_TYPE handle); + + + bool testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1); + +#ifdef DEBUG_BROADPHASE + void debugPrintAxis(int axis,bool checkCardinality=true); +#endif //DEBUG_BROADPHASE + + //Overlap* AddOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); + //void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); + + + + void sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + void sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + void sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + void sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + +public: + + btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0,bool disableRaycastAccelerator = false); + + virtual ~btAxisSweep3Internal(); + + BP_FP_INT_TYPE getNumHandles() const + { + return m_numHandles; + } + + virtual void calculateOverlappingPairs(btDispatcher* dispatcher); + + BP_FP_INT_TYPE addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher); + void removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher); + void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); + SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;} + + virtual void resetPool(btDispatcher* dispatcher); + + void processAllOverlappingPairs(btOverlapCallback* callback); + + //Broadphase Interface + virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr , int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher); + virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); + virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); + virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; + + virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); + virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback); + + + void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const; + ///unQuantize should be conservative: aabbMin/aabbMax should be larger then 'getAabb' result + void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; + + bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1); + + btOverlappingPairCache* getOverlappingPairCache() + { + return m_pairCache; + } + const btOverlappingPairCache* getOverlappingPairCache() const + { + return m_pairCache; + } + + void setOverlappingPairUserCallback(btOverlappingPairCallback* pairCallback) + { + m_userPairCallback = pairCallback; + } + const btOverlappingPairCallback* getOverlappingPairUserCallback() const + { + return m_userPairCallback; + } + + ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame + ///will add some transform later + virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const + { + aabbMin = m_worldAabbMin; + aabbMax = m_worldAabbMax; + } + + virtual void printStats() + { +/* printf("btAxisSweep3.h\n"); + printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles); + printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.getX(),m_worldAabbMin.getY(),m_worldAabbMin.getZ(), + m_worldAabbMax.getX(),m_worldAabbMax.getY(),m_worldAabbMax.getZ()); + */ + + } + +}; + +//////////////////////////////////////////////////////////////////// + + + + +#ifdef DEBUG_BROADPHASE +#include + +template +void btAxisSweep3::debugPrintAxis(int axis, bool checkCardinality) +{ + int numEdges = m_pHandles[0].m_maxEdges[axis]; + printf("SAP Axis %d, numEdges=%d\n",axis,numEdges); + + int i; + for (i=0;im_handle); + int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis]; + char beginOrEnd; + beginOrEnd=pEdge->IsMax()?'E':'B'; + printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_handle,pEdge->m_pos,handleIndex); + } + + if (checkCardinality) + btAssert(numEdges == m_numHandles*2+1); +} +#endif //DEBUG_BROADPHASE + +template +btBroadphaseProxy* btAxisSweep3Internal::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher) +{ + (void)shapeType; + BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr,collisionFilterGroup,collisionFilterMask,dispatcher); + + Handle* handle = getHandle(handleId); + + if (m_raycastAccelerator) + { + btBroadphaseProxy* rayProxy = m_raycastAccelerator->createProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,dispatcher); + handle->m_dbvtProxy = rayProxy; + } + return handle; +} + + + +template +void btAxisSweep3Internal::destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher) +{ + Handle* handle = static_cast(proxy); + if (m_raycastAccelerator) + m_raycastAccelerator->destroyProxy(handle->m_dbvtProxy,dispatcher); + removeHandle(static_cast(handle->m_uniqueId), dispatcher); +} + +template +void btAxisSweep3Internal::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) +{ + Handle* handle = static_cast(proxy); + handle->m_aabbMin = aabbMin; + handle->m_aabbMax = aabbMax; + updateHandle(static_cast(handle->m_uniqueId), aabbMin, aabbMax,dispatcher); + if (m_raycastAccelerator) + m_raycastAccelerator->setAabb(handle->m_dbvtProxy,aabbMin,aabbMax,dispatcher); + +} + +template +void btAxisSweep3Internal::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax) +{ + if (m_raycastAccelerator) + { + m_raycastAccelerator->rayTest(rayFrom,rayTo,rayCallback,aabbMin,aabbMax); + } else + { + //choose axis? + BP_FP_INT_TYPE axis = 0; + //for each proxy + for (BP_FP_INT_TYPE i=1;i +void btAxisSweep3Internal::aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback) +{ + if (m_raycastAccelerator) + { + m_raycastAccelerator->aabbTest(aabbMin,aabbMax,callback); + } else + { + //choose axis? + BP_FP_INT_TYPE axis = 0; + //for each proxy + for (BP_FP_INT_TYPE i=1;im_aabbMin,handle->m_aabbMax)) + { + callback.process(handle); + } + } + } + } +} + + + +template +void btAxisSweep3Internal::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const +{ + Handle* pHandle = static_cast(proxy); + aabbMin = pHandle->m_aabbMin; + aabbMax = pHandle->m_aabbMax; +} + + +template +void btAxisSweep3Internal::unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const +{ + Handle* pHandle = static_cast(proxy); + + unsigned short vecInMin[3]; + unsigned short vecInMax[3]; + + vecInMin[0] = m_pEdges[0][pHandle->m_minEdges[0]].m_pos ; + vecInMax[0] = m_pEdges[0][pHandle->m_maxEdges[0]].m_pos +1 ; + vecInMin[1] = m_pEdges[1][pHandle->m_minEdges[1]].m_pos ; + vecInMax[1] = m_pEdges[1][pHandle->m_maxEdges[1]].m_pos +1 ; + vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos ; + vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos +1 ; + + aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.getX()),(btScalar)(vecInMin[1]) / (m_quantize.getY()),(btScalar)(vecInMin[2]) / (m_quantize.getZ())); + aabbMin += m_worldAabbMin; + + aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.getX()),(btScalar)(vecInMax[1]) / (m_quantize.getY()),(btScalar)(vecInMax[2]) / (m_quantize.getZ())); + aabbMax += m_worldAabbMin; +} + + + + +template +btAxisSweep3Internal::btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache , bool disableRaycastAccelerator) +:m_bpHandleMask(handleMask), +m_handleSentinel(handleSentinel), +m_pairCache(pairCache), +m_userPairCallback(0), +m_ownsPairCache(false), +m_invalidPair(0), +m_raycastAccelerator(0) +{ + BP_FP_INT_TYPE maxHandles = static_cast(userMaxHandles+1);//need to add one sentinel handle + + if (!m_pairCache) + { + void* ptr = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16); + m_pairCache = new(ptr) btHashedOverlappingPairCache(); + m_ownsPairCache = true; + } + + if (!disableRaycastAccelerator) + { + m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache),16)) btNullPairCache(); + m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache); + m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs + } + + //btAssert(bounds.HasVolume()); + + // init bounds + m_worldAabbMin = worldAabbMin; + m_worldAabbMax = worldAabbMax; + + btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin; + + BP_FP_INT_TYPE maxInt = m_handleSentinel; + + m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize; + + // allocate handles buffer, using btAlignedAlloc, and put all handles on free list + m_pHandles = new Handle[maxHandles]; + + m_maxHandles = maxHandles; + m_numHandles = 0; + + // handle 0 is reserved as the null index, and is also used as the sentinel + m_firstFreeHandle = 1; + { + for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++) + m_pHandles[i].SetNextFree(static_cast(i + 1)); + m_pHandles[maxHandles - 1].SetNextFree(0); + } + + { + // allocate edge buffers + for (int i = 0; i < 3; i++) + { + m_pEdgesRawPtr[i] = btAlignedAlloc(sizeof(Edge)*maxHandles*2,16); + m_pEdges[i] = new(m_pEdgesRawPtr[i]) Edge[maxHandles * 2]; + } + } + //removed overlap management + + // make boundary sentinels + + m_pHandles[0].m_clientObject = 0; + + for (int axis = 0; axis < 3; axis++) + { + m_pHandles[0].m_minEdges[axis] = 0; + m_pHandles[0].m_maxEdges[axis] = 1; + + m_pEdges[axis][0].m_pos = 0; + m_pEdges[axis][0].m_handle = 0; + m_pEdges[axis][1].m_pos = m_handleSentinel; + m_pEdges[axis][1].m_handle = 0; +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + + } + +} + +template +btAxisSweep3Internal::~btAxisSweep3Internal() +{ + if (m_raycastAccelerator) + { + m_nullPairCache->~btOverlappingPairCache(); + btAlignedFree(m_nullPairCache); + m_raycastAccelerator->~btDbvtBroadphase(); + btAlignedFree (m_raycastAccelerator); + } + + for (int i = 2; i >= 0; i--) + { + btAlignedFree(m_pEdgesRawPtr[i]); + } + delete [] m_pHandles; + + if (m_ownsPairCache) + { + m_pairCache->~btOverlappingPairCache(); + btAlignedFree(m_pairCache); + } +} + +template +void btAxisSweep3Internal::quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const +{ +#ifdef OLD_CLAMPING_METHOD + ///problem with this clamping method is that the floating point during quantization might still go outside the range [(0|isMax) .. (m_handleSentinel&m_bpHandleMask]|isMax] + ///see http://code.google.com/p/bullet/issues/detail?id=87 + btVector3 clampedPoint(point); + clampedPoint.setMax(m_worldAabbMin); + clampedPoint.setMin(m_worldAabbMax); + btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize; + out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & m_bpHandleMask) | isMax); + out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & m_bpHandleMask) | isMax); + out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & m_bpHandleMask) | isMax); +#else + btVector3 v = (point - m_worldAabbMin) * m_quantize; + out[0]=(v[0]<=0)?(BP_FP_INT_TYPE)isMax:(v[0]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[0]&m_bpHandleMask)|isMax); + out[1]=(v[1]<=0)?(BP_FP_INT_TYPE)isMax:(v[1]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[1]&m_bpHandleMask)|isMax); + out[2]=(v[2]<=0)?(BP_FP_INT_TYPE)isMax:(v[2]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[2]&m_bpHandleMask)|isMax); +#endif //OLD_CLAMPING_METHOD +} + + +template +BP_FP_INT_TYPE btAxisSweep3Internal::allocHandle() +{ + btAssert(m_firstFreeHandle); + + BP_FP_INT_TYPE handle = m_firstFreeHandle; + m_firstFreeHandle = getHandle(handle)->GetNextFree(); + m_numHandles++; + + return handle; +} + +template +void btAxisSweep3Internal::freeHandle(BP_FP_INT_TYPE handle) +{ + btAssert(handle > 0 && handle < m_maxHandles); + + getHandle(handle)->SetNextFree(m_firstFreeHandle); + m_firstFreeHandle = handle; + + m_numHandles--; +} + + +template +BP_FP_INT_TYPE btAxisSweep3Internal::addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher) +{ + // quantize the bounds + BP_FP_INT_TYPE min[3], max[3]; + quantize(min, aabbMin, 0); + quantize(max, aabbMax, 1); + + // allocate a handle + BP_FP_INT_TYPE handle = allocHandle(); + + + Handle* pHandle = getHandle(handle); + + pHandle->m_uniqueId = static_cast(handle); + //pHandle->m_pOverlaps = 0; + pHandle->m_clientObject = pOwner; + pHandle->m_collisionFilterGroup = collisionFilterGroup; + pHandle->m_collisionFilterMask = collisionFilterMask; + + // compute current limit of edge arrays + BP_FP_INT_TYPE limit = static_cast(m_numHandles * 2); + + + // insert new edges just inside the max boundary edge + for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++) + { + + m_pHandles[0].m_maxEdges[axis] += 2; + + m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1]; + + m_pEdges[axis][limit - 1].m_pos = min[axis]; + m_pEdges[axis][limit - 1].m_handle = handle; + + m_pEdges[axis][limit].m_pos = max[axis]; + m_pEdges[axis][limit].m_handle = handle; + + pHandle->m_minEdges[axis] = static_cast(limit - 1); + pHandle->m_maxEdges[axis] = limit; + } + + // now sort the new edges to their correct position + sortMinDown(0, pHandle->m_minEdges[0], dispatcher,false); + sortMaxDown(0, pHandle->m_maxEdges[0], dispatcher,false); + sortMinDown(1, pHandle->m_minEdges[1], dispatcher,false); + sortMaxDown(1, pHandle->m_maxEdges[1], dispatcher,false); + sortMinDown(2, pHandle->m_minEdges[2], dispatcher,true); + sortMaxDown(2, pHandle->m_maxEdges[2], dispatcher,true); + + + return handle; +} + + +template +void btAxisSweep3Internal::removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher) +{ + + Handle* pHandle = getHandle(handle); + + //explicitly remove the pairs containing the proxy + //we could do it also in the sortMinUp (passing true) + ///@todo: compare performance + if (!m_pairCache->hasDeferredRemoval()) + { + m_pairCache->removeOverlappingPairsContainingProxy(pHandle,dispatcher); + } + + // compute current limit of edge arrays + int limit = static_cast(m_numHandles * 2); + + int axis; + + for (axis = 0;axis<3;axis++) + { + m_pHandles[0].m_maxEdges[axis] -= 2; + } + + // remove the edges by sorting them up to the end of the list + for ( axis = 0; axis < 3; axis++) + { + Edge* pEdges = m_pEdges[axis]; + BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis]; + pEdges[max].m_pos = m_handleSentinel; + + sortMaxUp(axis,max,dispatcher,false); + + + BP_FP_INT_TYPE i = pHandle->m_minEdges[axis]; + pEdges[i].m_pos = m_handleSentinel; + + + sortMinUp(axis,i,dispatcher,false); + + pEdges[limit-1].m_handle = 0; + pEdges[limit-1].m_pos = m_handleSentinel; + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis,false); +#endif //DEBUG_BROADPHASE + + + } + + + // free the handle + freeHandle(handle); + + +} + +template +void btAxisSweep3Internal::resetPool(btDispatcher* /*dispatcher*/) +{ + if (m_numHandles == 0) + { + m_firstFreeHandle = 1; + { + for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_maxHandles; i++) + m_pHandles[i].SetNextFree(static_cast(i + 1)); + m_pHandles[m_maxHandles - 1].SetNextFree(0); + } + } +} + + +extern int gOverlappingPairs; +//#include + +template +void btAxisSweep3Internal::calculateOverlappingPairs(btDispatcher* dispatcher) +{ + + if (m_pairCache->hasDeferredRemoval()) + { + + btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray(); + + //perform a sort, to find duplicates and to sort 'invalid' pairs to the end + overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); + + overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); + m_invalidPair = 0; + + + int i; + + btBroadphasePair previousPair; + previousPair.m_pProxy0 = 0; + previousPair.m_pProxy1 = 0; + previousPair.m_algorithm = 0; + + + for (i=0;iprocessOverlap(pair); + } else + { + needsRemoval = true; + } + } else + { + //remove duplicate + needsRemoval = true; + //should have no algorithm + btAssert(!pair.m_algorithm); + } + + if (needsRemoval) + { + m_pairCache->cleanOverlappingPair(pair,dispatcher); + + // m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1); + // m_overlappingPairArray.pop_back(); + pair.m_pProxy0 = 0; + pair.m_pProxy1 = 0; + m_invalidPair++; + gOverlappingPairs--; + } + + } + + ///if you don't like to skip the invalid pairs in the array, execute following code: + #define CLEAN_INVALID_PAIRS 1 + #ifdef CLEAN_INVALID_PAIRS + + //perform a sort, to sort 'invalid' pairs to the end + overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); + + overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); + m_invalidPair = 0; + #endif//CLEAN_INVALID_PAIRS + + //printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size()); + } + +} + + +template +bool btAxisSweep3Internal::testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) +{ + const Handle* pHandleA = static_cast(proxy0); + const Handle* pHandleB = static_cast(proxy1); + + //optimization 1: check the array index (memory address), instead of the m_pos + + for (int axis = 0; axis < 3; axis++) + { + if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] || + pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis]) + { + return false; + } + } + return true; +} + +template +bool btAxisSweep3Internal::testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1) +{ + //optimization 1: check the array index (memory address), instead of the m_pos + + if (pHandleA->m_maxEdges[axis0] < pHandleB->m_minEdges[axis0] || + pHandleB->m_maxEdges[axis0] < pHandleA->m_minEdges[axis0] || + pHandleA->m_maxEdges[axis1] < pHandleB->m_minEdges[axis1] || + pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1]) + { + return false; + } + return true; +} + +template +void btAxisSweep3Internal::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) +{ +// btAssert(bounds.IsFinite()); + //btAssert(bounds.HasVolume()); + + Handle* pHandle = getHandle(handle); + + // quantize the new bounds + BP_FP_INT_TYPE min[3], max[3]; + quantize(min, aabbMin, 0); + quantize(max, aabbMax, 1); + + // update changed edges + for (int axis = 0; axis < 3; axis++) + { + BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis]; + BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis]; + + int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos; + int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos; + + m_pEdges[axis][emin].m_pos = min[axis]; + m_pEdges[axis][emax].m_pos = max[axis]; + + // expand (only adds overlaps) + if (dmin < 0) + sortMinDown(axis, emin,dispatcher,true); + + if (dmax > 0) + sortMaxUp(axis, emax,dispatcher,true); + + // shrink (only removes overlaps) + if (dmin > 0) + sortMinUp(axis, emin,dispatcher,true); + + if (dmax < 0) + sortMaxDown(axis, emax,dispatcher,true); + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + } + + +} + + + + +// sorting a min edge downwards can only ever *add* overlaps +template +void btAxisSweep3Internal::sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) +{ + + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pPrev = pEdge - 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pEdge->m_pos < pPrev->m_pos) + { + Handle* pHandlePrev = getHandle(pPrev->m_handle); + + if (pPrev->IsMax()) + { + // if previous edge is a maximum check the bounds and add an overlap if necessary + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + if (updateOverlaps && testOverlap2D(pHandleEdge, pHandlePrev,axis1,axis2)) + { + m_pairCache->addOverlappingPair(pHandleEdge,pHandlePrev); + if (m_userPairCallback) + m_userPairCallback->addOverlappingPair(pHandleEdge,pHandlePrev); + + //AddOverlap(pEdge->m_handle, pPrev->m_handle); + + } + + // update edge reference in other handle + pHandlePrev->m_maxEdges[axis]++; + } + else + pHandlePrev->m_minEdges[axis]++; + + pHandleEdge->m_minEdges[axis]--; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pPrev; + *pPrev = swap; + + // decrement + pEdge--; + pPrev--; + } + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + +} + +// sorting a min edge upwards can only ever *remove* overlaps +template +void btAxisSweep3Internal::sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) +{ + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pNext = pEdge + 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) + { + Handle* pHandleNext = getHandle(pNext->m_handle); + + if (pNext->IsMax()) + { + Handle* handle0 = getHandle(pEdge->m_handle); + Handle* handle1 = getHandle(pNext->m_handle); + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + + // if next edge is maximum remove any overlap between the two handles + if (updateOverlaps +#ifdef USE_OVERLAP_TEST_ON_REMOVES + && testOverlap2D(handle0,handle1,axis1,axis2) +#endif //USE_OVERLAP_TEST_ON_REMOVES + ) + { + + + m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); + if (m_userPairCallback) + m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); + + } + + + // update edge reference in other handle + pHandleNext->m_maxEdges[axis]--; + } + else + pHandleNext->m_minEdges[axis]--; + + pHandleEdge->m_minEdges[axis]++; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pNext; + *pNext = swap; + + // increment + pEdge++; + pNext++; + } + + +} + +// sorting a max edge downwards can only ever *remove* overlaps +template +void btAxisSweep3Internal::sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) +{ + + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pPrev = pEdge - 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pEdge->m_pos < pPrev->m_pos) + { + Handle* pHandlePrev = getHandle(pPrev->m_handle); + + if (!pPrev->IsMax()) + { + // if previous edge was a minimum remove any overlap between the two handles + Handle* handle0 = getHandle(pEdge->m_handle); + Handle* handle1 = getHandle(pPrev->m_handle); + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + + if (updateOverlaps +#ifdef USE_OVERLAP_TEST_ON_REMOVES + && testOverlap2D(handle0,handle1,axis1,axis2) +#endif //USE_OVERLAP_TEST_ON_REMOVES + ) + { + //this is done during the overlappingpairarray iteration/narrowphase collision + + + m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); + if (m_userPairCallback) + m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); + + + + } + + // update edge reference in other handle + pHandlePrev->m_minEdges[axis]++;; + } + else + pHandlePrev->m_maxEdges[axis]++; + + pHandleEdge->m_maxEdges[axis]--; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pPrev; + *pPrev = swap; + + // decrement + pEdge--; + pPrev--; + } + + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + +} + +// sorting a max edge upwards can only ever *add* overlaps +template +void btAxisSweep3Internal::sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) +{ + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pNext = pEdge + 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) + { + Handle* pHandleNext = getHandle(pNext->m_handle); + + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + + if (!pNext->IsMax()) + { + // if next edge is a minimum check the bounds and add an overlap if necessary + if (updateOverlaps && testOverlap2D(pHandleEdge, pHandleNext,axis1,axis2)) + { + Handle* handle0 = getHandle(pEdge->m_handle); + Handle* handle1 = getHandle(pNext->m_handle); + m_pairCache->addOverlappingPair(handle0,handle1); + if (m_userPairCallback) + m_userPairCallback->addOverlappingPair(handle0,handle1); + } + + // update edge reference in other handle + pHandleNext->m_minEdges[axis]--; + } + else + pHandleNext->m_maxEdges[axis]--; + + pHandleEdge->m_maxEdges[axis]++; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pNext; + *pNext = swap; + + // increment + pEdge++; + pNext++; + } + +} + +#endif diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h index f1bf00594..fb68e0024 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h @@ -41,6 +41,10 @@ struct btBroadphaseRayCallback : public btBroadphaseAabbCallback btScalar m_lambda_max; virtual ~btBroadphaseRayCallback() {} + +protected: + + btBroadphaseRayCallback() {} }; #include "LinearMath/btVector3.h" @@ -53,7 +57,7 @@ class btBroadphaseInterface public: virtual ~btBroadphaseInterface() {} - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy) =0; + virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher) =0; virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)=0; virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher)=0; virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const =0; diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp index f4d7341f8..0fd4ef46b 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp @@ -15,3 +15,4 @@ subject to the following restrictions: #include "btBroadphaseProxy.h" +BT_NOT_EMPTY_FILE // fix warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h index bb58b8289..adaf083a2 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h @@ -101,10 +101,10 @@ BT_DECLARE_ALIGNED_ALLOCATOR(); //Usually the client btCollisionObject or Rigidbody class void* m_clientObject; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; - void* m_multiSapParentProxy; - int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc. + int m_collisionFilterGroup; + int m_collisionFilterMask; + + int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc. btVector3 m_aabbMin; btVector3 m_aabbMax; @@ -115,18 +115,17 @@ BT_DECLARE_ALIGNED_ALLOCATOR(); } //used for memory pools - btBroadphaseProxy() :m_clientObject(0),m_multiSapParentProxy(0) + btBroadphaseProxy() :m_clientObject(0) { } - btBroadphaseProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask,void* multiSapParentProxy=0) + btBroadphaseProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr, int collisionFilterGroup, int collisionFilterMask) :m_clientObject(userPtr), m_collisionFilterGroup(collisionFilterGroup), m_collisionFilterMask(collisionFilterMask), m_aabbMin(aabbMin), m_aabbMax(aabbMax) { - m_multiSapParentProxy = multiSapParentProxy; } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp index 2ca20cdd8..d791d0741 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp @@ -229,25 +229,60 @@ static void fetchleaves(btDbvt* pdbvt, } // -static void split( const tNodeArray& leaves, - tNodeArray& left, - tNodeArray& right, +static bool leftOfAxis( const btDbvtNode* node, + const btVector3& org, + const btVector3& axis) +{ + return btDot(axis, node->volume.Center() - org) <= 0; +} + + +// Partitions leaves such that leaves[0, n) are on the +// left of axis, and leaves[n, count) are on the right +// of axis. returns N. +static int split( btDbvtNode** leaves, + int count, const btVector3& org, const btVector3& axis) { - left.resize(0); - right.resize(0); - for(int i=0,ni=leaves.size();ivolume.Center()-org)<0) - left.push_back(leaves[i]); - else - right.push_back(leaves[i]); + while(begin!=end && leftOfAxis(leaves[begin],org,axis)) + { + ++begin; + } + + if(begin==end) + { + break; + } + + while(begin!=end && !leftOfAxis(leaves[end-1],org,axis)) + { + --end; + } + + if(begin==end) + { + break; + } + + // swap out of place nodes + --end; + btDbvtNode* temp=leaves[begin]; + leaves[begin]=leaves[end]; + leaves[end]=temp; + ++begin; } + + return begin; } // -static btDbvtVolume bounds( const tNodeArray& leaves) +static btDbvtVolume bounds( btDbvtNode** leaves, + int count) { #if DBVT_MERGE_IMPL==DBVT_IMPL_SSE ATTRIBUTE_ALIGNED16(char locals[sizeof(btDbvtVolume)]); @@ -257,7 +292,7 @@ static btDbvtVolume bounds( const tNodeArray& leaves) #else btDbvtVolume volume=leaves[0]->volume; #endif - for(int i=1,ni=leaves.size();ivolume,volume); } @@ -266,15 +301,16 @@ static btDbvtVolume bounds( const tNodeArray& leaves) // static void bottomup( btDbvt* pdbvt, - tNodeArray& leaves) + btDbvtNode** leaves, + int count) { - while(leaves.size()>1) + while(count>1) { btScalar minsize=SIMD_INFINITY; int minidx[2]={-1,-1}; - for(int i=0;ivolume,leaves[j]->volume)); if(szparent = p; n[1]->parent = p; leaves[minidx[0]] = p; - leaves.swap(minidx[1],leaves.size()-1); - leaves.pop_back(); + leaves[minidx[1]] = leaves[count-1]; + --count; } } // static btDbvtNode* topdown(btDbvt* pdbvt, - tNodeArray& leaves, + btDbvtNode** leaves, + int count, int bu_treshold) { static const btVector3 axis[]={btVector3(1,0,0), btVector3(0,1,0), btVector3(0,0,1)}; - if(leaves.size()>1) + btAssert(bu_treshold>2); + if(count>1) { - if(leaves.size()>bu_treshold) + if(count>bu_treshold) { - const btDbvtVolume vol=bounds(leaves); + const btDbvtVolume vol=bounds(leaves,count); const btVector3 org=vol.Center(); - tNodeArray sets[2]; + int partition; int bestaxis=-1; - int bestmidp=leaves.size(); + int bestmidp=count; int splitcount[3][2]={{0,0},{0,0},{0,0}}; int i; - for( i=0;ivolume.Center()-org; for(int j=0;j<3;++j) @@ -338,29 +376,23 @@ static btDbvtNode* topdown(btDbvt* pdbvt, } if(bestaxis>=0) { - sets[0].reserve(splitcount[bestaxis][0]); - sets[1].reserve(splitcount[bestaxis][1]); - split(leaves,sets[0],sets[1],org,axis[bestaxis]); + partition=split(leaves,count,org,axis[bestaxis]); + btAssert(partition!=0 && partition!=count); } else { - sets[0].reserve(leaves.size()/2+1); - sets[1].reserve(leaves.size()/2); - for(int i=0,ni=leaves.size();ichilds[0]=topdown(pdbvt,sets[0],bu_treshold); - node->childs[1]=topdown(pdbvt,sets[1],bu_treshold); + node->childs[0]=topdown(pdbvt,&leaves[0],partition,bu_treshold); + node->childs[1]=topdown(pdbvt,&leaves[partition],count-partition,bu_treshold); node->childs[0]->parent=node; node->childs[1]->parent=node; return(node); } else { - bottomup(pdbvt,leaves); + bottomup(pdbvt,leaves,count); return(leaves[0]); } } @@ -444,7 +476,7 @@ void btDbvt::optimizeBottomUp() tNodeArray leaves; leaves.reserve(m_leaves); fetchleaves(this,m_root,leaves); - bottomup(this,leaves); + bottomup(this,&leaves[0],leaves.size()); m_root=leaves[0]; } } @@ -457,7 +489,7 @@ void btDbvt::optimizeTopDown(int bu_treshold) tNodeArray leaves; leaves.reserve(m_leaves); fetchleaves(this,m_root,leaves); - m_root=topdown(this,leaves,bu_treshold); + m_root=topdown(this,&leaves[0],leaves.size(),bu_treshold); } } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h index 1ca175723..b5a001458 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -942,7 +942,13 @@ inline void btDbvt::collideTV( const btDbvtNode* root, ATTRIBUTE_ALIGNED16(btDbvtVolume) volume(vol); btAlignedObjectArray stack; stack.resize(0); +#ifndef BT_DISABLE_STACK_TEMP_MEMORY + char tempmemory[SIMPLE_STACKSIZE*sizeof(const btDbvtNode*)]; + stack.initializeFromBuffer(tempmemory, 0, SIMPLE_STACKSIZE); +#else stack.reserve(SIMPLE_STACKSIZE); +#endif //BT_DISABLE_STACK_TEMP_MEMORY + stack.push_back(root); do { const btDbvtNode* n=stack[stack.size()-1]; @@ -1078,7 +1084,12 @@ inline void btDbvt::rayTest( const btDbvtNode* root, int depth=1; int treshold=DOUBLE_STACKSIZE-2; + char tempmemory[DOUBLE_STACKSIZE * sizeof(const btDbvtNode*)]; +#ifndef BT_DISABLE_STACK_TEMP_MEMORY + stack.initializeFromBuffer(tempmemory, DOUBLE_STACKSIZE, DOUBLE_STACKSIZE); +#else//BT_DISABLE_STACK_TEMP_MEMORY stack.resize(DOUBLE_STACKSIZE); +#endif //BT_DISABLE_STACK_TEMP_MEMORY stack[0]=root; btVector3 bounds[2]; do { diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp index 4f33db500..4d12b1c9c 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp @@ -168,10 +168,9 @@ btBroadphaseProxy* btDbvtBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax, int /*shapeType*/, void* userPtr, - short int collisionFilterGroup, - short int collisionFilterMask, - btDispatcher* /*dispatcher*/, - void* /*multiSapProxy*/) + int collisionFilterGroup, + int collisionFilterMask, + btDispatcher* /*dispatcher*/) { btDbvtProxy* proxy=new(btAlignedAlloc(sizeof(btDbvtProxy),16)) btDbvtProxy( aabbMin,aabbMax,userPtr, collisionFilterGroup, @@ -545,7 +544,9 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher) btDbvtProxy* current=m_stageRoots[m_stageCurrent]; if(current) { +#if DBVT_BP_ACCURATESLEEPING btDbvtTreeCollider collider(this); +#endif do { btDbvtProxy* next=current->links[1]; listremove(current,m_stageRoots[current->stage]); diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h index a61f00df0..8feb95d51 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h @@ -47,7 +47,7 @@ struct btDbvtProxy : btBroadphaseProxy btDbvtProxy* links[2]; int stage; /* ctor */ - btDbvtProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) : + btDbvtProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr, int collisionFilterGroup, int collisionFilterMask) : btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask) { links[0]=links[1]=0; @@ -105,7 +105,7 @@ struct btDbvtBroadphase : btBroadphaseInterface void optimize(); /* btBroadphaseInterface Implementation */ - btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy); + btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher); virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h index 146142704..f7be7d45b 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h @@ -90,7 +90,8 @@ public: }; /// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com -class btHashedOverlappingPairCache : public btOverlappingPairCache + +ATTRIBUTE_ALIGNED16(class) btHashedOverlappingPairCache : public btOverlappingPairCache { btBroadphasePairArray m_overlappingPairArray; btOverlapFilterCallback* m_overlapFilterCallback; @@ -103,6 +104,8 @@ protected: public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + btHashedOverlappingPairCache(); virtual ~btHashedOverlappingPairCache(); @@ -212,10 +215,9 @@ private: */ - - SIMD_FORCE_INLINE unsigned int getHash(unsigned int proxyId1, unsigned int proxyId2) + SIMD_FORCE_INLINE unsigned int getHash(unsigned int proxyId1, unsigned int proxyId2) { - int key = static_cast(((unsigned int)proxyId1) | (((unsigned int)proxyId2) <<16)); + unsigned int key = proxyId1 | (proxyId2 << 16); // Thomas Wang's hash key += ~(key << 15); @@ -224,13 +226,11 @@ private: key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); - return static_cast(key); + return key; } - - SIMD_FORCE_INLINE btBroadphasePair* internalFindPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1, int hash) { int proxyId1 = proxy0->getUid(); diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h index 9c7b6f813..3e069fa5e 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h @@ -23,6 +23,9 @@ struct btBroadphasePair; ///The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. class btOverlappingPairCallback { +protected: + btOverlappingPairCallback() {} + public: virtual ~btOverlappingPairCallback() { diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp index 93de49998..875d89c53 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp @@ -1336,6 +1336,8 @@ const char* btQuantizedBvh::serialize(void* dataBuffer, btSerializer* serializer memPtr->m_escapeIndex = m_contiguousNodes[i].m_escapeIndex; memPtr->m_subPart = m_contiguousNodes[i].m_subPart; memPtr->m_triangleIndex = m_contiguousNodes[i].m_triangleIndex; + // Fill padding with zeros to appease msan. + memset(memPtr->m_pad, 0, sizeof(memPtr->m_pad)); } serializer->finalizeChunk(chunk,"btOptimizedBvhNodeData",BT_ARRAY_CODE,(void*)&m_contiguousNodes[0]); } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h index 78382da79..3dd5ac9bb 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h @@ -169,7 +169,7 @@ typedef btAlignedObjectArray BvhSubtreeInfoArray; ///The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU. -///It is used by the btBvhTriangleMeshShape as midphase, and by the btMultiSapBroadphase. +///It is used by the btBvhTriangleMeshShape as midphase. ///It is recommended to use quantization for better performance and lower memory requirements. ATTRIBUTE_ALIGNED16(class) btQuantizedBvh { diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp index 752fcd0fe..f1d5f5476 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp @@ -84,7 +84,7 @@ btSimpleBroadphase::~btSimpleBroadphase() } -btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* /*dispatcher*/,void* multiSapProxy) +btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr , int collisionFilterGroup, int collisionFilterMask, btDispatcher* /*dispatcher*/) { if (m_numHandles >= m_maxHandles) { @@ -94,7 +94,7 @@ btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin, btAssert(aabbMin[0]<= aabbMax[0] && aabbMin[1]<= aabbMax[1] && aabbMin[2]<= aabbMax[2]); int newHandleIndex = allocHandle(); - btSimpleBroadphaseProxy* proxy = new (&m_pHandles[newHandleIndex])btSimpleBroadphaseProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy); + btSimpleBroadphaseProxy* proxy = new (&m_pHandles[newHandleIndex])btSimpleBroadphaseProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask); return proxy; } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h index 7cb3c40a0..d7a18e400 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h @@ -29,8 +29,8 @@ struct btSimpleBroadphaseProxy : public btBroadphaseProxy btSimpleBroadphaseProxy() {}; - btSimpleBroadphaseProxy(const btVector3& minpt,const btVector3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,void* multiSapProxy) - :btBroadphaseProxy(minpt,maxpt,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy) + btSimpleBroadphaseProxy(const btVector3& minpt,const btVector3& maxpt,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask) + :btBroadphaseProxy(minpt,maxpt,userPtr,collisionFilterGroup,collisionFilterMask) { (void)shapeType; } @@ -127,7 +127,7 @@ public: static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1); - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy); + virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr , int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher); virtual void calculateOverlappingPairs(btDispatcher* dispatcher); diff --git a/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt b/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt index 90741a126..85c5fc8b6 100644 --- a/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt +++ b/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt @@ -7,7 +7,6 @@ SET(BulletCollision_SRCS BroadphaseCollision/btDbvt.cpp BroadphaseCollision/btDbvtBroadphase.cpp BroadphaseCollision/btDispatcher.cpp - BroadphaseCollision/btMultiSapBroadphase.cpp BroadphaseCollision/btOverlappingPairCache.cpp BroadphaseCollision/btQuantizedBvh.cpp BroadphaseCollision/btSimpleBroadphase.cpp @@ -16,6 +15,7 @@ SET(BulletCollision_SRCS CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp CollisionDispatch/btBoxBoxDetector.cpp CollisionDispatch/btCollisionDispatcher.cpp + CollisionDispatch/btCollisionDispatcherMt.cpp CollisionDispatch/btCollisionObject.cpp CollisionDispatch/btCollisionWorld.cpp CollisionDispatch/btCollisionWorldImporter.cpp @@ -103,6 +103,7 @@ SET(Root_HDRS ../btBulletCollisionCommon.h ) SET(BroadphaseCollision_HDRS + BroadphaseCollision/btAxisSweep3Internal.h BroadphaseCollision/btAxisSweep3.h BroadphaseCollision/btBroadphaseInterface.h BroadphaseCollision/btBroadphaseProxy.h @@ -110,7 +111,6 @@ SET(BroadphaseCollision_HDRS BroadphaseCollision/btDbvt.h BroadphaseCollision/btDbvtBroadphase.h BroadphaseCollision/btDispatcher.h - BroadphaseCollision/btMultiSapBroadphase.h BroadphaseCollision/btOverlappingPairCache.h BroadphaseCollision/btOverlappingPairCallback.h BroadphaseCollision/btQuantizedBvh.h @@ -124,6 +124,7 @@ SET(CollisionDispatch_HDRS CollisionDispatch/btCollisionConfiguration.h CollisionDispatch/btCollisionCreateFunc.h CollisionDispatch/btCollisionDispatcher.h + CollisionDispatch/btCollisionDispatcherMt.h CollisionDispatch/btCollisionObject.h CollisionDispatch/btCollisionObjectWrapper.h CollisionDispatch/btCollisionWorld.h @@ -191,12 +192,15 @@ SET(CollisionShapes_HDRS SET(Gimpact_HDRS Gimpact/btBoxCollision.h Gimpact/btClipPolygon.h + Gimpact/btContactProcessingStructs.h Gimpact/btContactProcessing.h Gimpact/btGenericPoolAllocator.h Gimpact/btGeometryOperations.h + Gimpact/btGImpactBvhStructs.h Gimpact/btGImpactBvh.h Gimpact/btGImpactCollisionAlgorithm.h Gimpact/btGImpactMassUtil.h + Gimpact/btGImpactQuantizedBvhStructs.h Gimpact/btGImpactQuantizedBvh.h Gimpact/btGImpactShape.h Gimpact/btQuantization.h diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp index 006cc65a2..c81af9567 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp @@ -100,45 +100,54 @@ bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &po btScalar radiusWithThreshold = radius + contactBreakingThreshold; btVector3 normal = (vertices[1]-vertices[0]).cross(vertices[2]-vertices[0]); - normal.safeNormalize(); - btVector3 p1ToCentre = sphereCenter - vertices[0]; - btScalar distanceFromPlane = p1ToCentre.dot(normal); - if (distanceFromPlane < btScalar(0.)) - { - //triangle facing the other way - distanceFromPlane *= btScalar(-1.); - normal *= btScalar(-1.); - } - - bool isInsideContactPlane = distanceFromPlane < radiusWithThreshold; - - // Check for contact / intersection + btScalar l2 = normal.length2(); bool hasContact = false; btVector3 contactPoint; - if (isInsideContactPlane) { - if (facecontains(sphereCenter,vertices,normal)) { - // Inside the contact wedge - touches a point on the shell plane - hasContact = true; - contactPoint = sphereCenter - normal*distanceFromPlane; - } else { - // Could be inside one of the contact capsules - btScalar contactCapsuleRadiusSqr = radiusWithThreshold*radiusWithThreshold; - btVector3 nearestOnEdge; - for (int i = 0; i < m_triangle->getNumEdges(); i++) { - - btVector3 pa; - btVector3 pb; - - m_triangle->getEdge(i,pa,pb); - btScalar distanceSqr = SegmentSqrDistance(pa,pb,sphereCenter, nearestOnEdge); - if (distanceSqr < contactCapsuleRadiusSqr) { - // Yep, we're inside a capsule - hasContact = true; - contactPoint = nearestOnEdge; + if (l2 >= SIMD_EPSILON*SIMD_EPSILON) + { + normal /= btSqrt(l2); + + btVector3 p1ToCentre = sphereCenter - vertices[0]; + btScalar distanceFromPlane = p1ToCentre.dot(normal); + + if (distanceFromPlane < btScalar(0.)) + { + //triangle facing the other way + distanceFromPlane *= btScalar(-1.); + normal *= btScalar(-1.); + } + + bool isInsideContactPlane = distanceFromPlane < radiusWithThreshold; + + // Check for contact / intersection + + if (isInsideContactPlane) { + if (facecontains(sphereCenter, vertices, normal)) { + // Inside the contact wedge - touches a point on the shell plane + hasContact = true; + contactPoint = sphereCenter - normal*distanceFromPlane; + } + else { + // Could be inside one of the contact capsules + btScalar contactCapsuleRadiusSqr = radiusWithThreshold*radiusWithThreshold; + btVector3 nearestOnEdge; + for (int i = 0; i < m_triangle->getNumEdges(); i++) { + + btVector3 pa; + btVector3 pb; + + m_triangle->getEdge(i, pa, pb); + + btScalar distanceSqr = SegmentSqrDistance(pa, pb, sphereCenter, nearestOnEdge); + if (distanceSqr < contactCapsuleRadiusSqr) { + // Yep, we're inside a capsule + hasContact = true; + contactPoint = nearestOnEdge; + } + } - } } } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h index 489812b96..0e19f1ea3 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h @@ -24,12 +24,13 @@ class btActivatingCollisionAlgorithm : public btCollisionAlgorithm // btCollisionObject* m_colObj0; // btCollisionObject* m_colObj1; -public: +protected: btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci); btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap); +public: virtual ~btActivatingCollisionAlgorithm(); }; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp index 737067ef9..5739a1ef0 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp @@ -239,10 +239,7 @@ public: virtual bool processOverlap(btBroadphasePair& pair) { - BT_PROFILE("btCollisionDispatcher::processOverlap"); - (*m_dispatcher->getNearCallback())(pair,*m_dispatcher,m_dispatchInfo); - return false; } }; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp new file mode 100644 index 000000000..075860c50 --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp @@ -0,0 +1,164 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + + + +#include "btCollisionDispatcherMt.h" +#include "LinearMath/btQuickprof.h" + +#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" + +#include "BulletCollision/CollisionShapes/btCollisionShape.h" +#include "BulletCollision/CollisionDispatch/btCollisionObject.h" +#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h" +#include "LinearMath/btPoolAllocator.h" +#include "BulletCollision/CollisionDispatch/btCollisionConfiguration.h" +#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h" + + +btCollisionDispatcherMt::btCollisionDispatcherMt( btCollisionConfiguration* config, int grainSize ) + : btCollisionDispatcher( config ) +{ + m_batchUpdating = false; + m_grainSize = grainSize; // iterations per task +} + + +btPersistentManifold* btCollisionDispatcherMt::getNewManifold( const btCollisionObject* body0, const btCollisionObject* body1 ) +{ + //optional relative contact breaking threshold, turned on by default (use setDispatcherFlags to switch off feature for improved performance) + + btScalar contactBreakingThreshold = ( m_dispatcherFlags & btCollisionDispatcher::CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD ) ? + btMin( body0->getCollisionShape()->getContactBreakingThreshold( gContactBreakingThreshold ), body1->getCollisionShape()->getContactBreakingThreshold( gContactBreakingThreshold ) ) + : gContactBreakingThreshold; + + btScalar contactProcessingThreshold = btMin( body0->getContactProcessingThreshold(), body1->getContactProcessingThreshold() ); + + void* mem = m_persistentManifoldPoolAllocator->allocate( sizeof( btPersistentManifold ) ); + if ( NULL == mem ) + { + //we got a pool memory overflow, by default we fallback to dynamically allocate memory. If we require a contiguous contact pool then assert. + if ( ( m_dispatcherFlags&CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION ) == 0 ) + { + mem = btAlignedAlloc( sizeof( btPersistentManifold ), 16 ); + } + else + { + btAssert( 0 ); + //make sure to increase the m_defaultMaxPersistentManifoldPoolSize in the btDefaultCollisionConstructionInfo/btDefaultCollisionConfiguration + return 0; + } + } + btPersistentManifold* manifold = new( mem ) btPersistentManifold( body0, body1, 0, contactBreakingThreshold, contactProcessingThreshold ); + if ( !m_batchUpdating ) + { + // batch updater will update manifold pointers array after finishing, so + // only need to update array when not batch-updating + //btAssert( !btThreadsAreRunning() ); + manifold->m_index1a = m_manifoldsPtr.size(); + m_manifoldsPtr.push_back( manifold ); + } + + return manifold; +} + +void btCollisionDispatcherMt::releaseManifold( btPersistentManifold* manifold ) +{ + clearManifold( manifold ); + //btAssert( !btThreadsAreRunning() ); + if ( !m_batchUpdating ) + { + // batch updater will update manifold pointers array after finishing, so + // only need to update array when not batch-updating + int findIndex = manifold->m_index1a; + btAssert( findIndex < m_manifoldsPtr.size() ); + m_manifoldsPtr.swap( findIndex, m_manifoldsPtr.size() - 1 ); + m_manifoldsPtr[ findIndex ]->m_index1a = findIndex; + m_manifoldsPtr.pop_back(); + } + + manifold->~btPersistentManifold(); + if ( m_persistentManifoldPoolAllocator->validPtr( manifold ) ) + { + m_persistentManifoldPoolAllocator->freeMemory( manifold ); + } + else + { + btAlignedFree( manifold ); + } +} + +struct CollisionDispatcherUpdater : public btIParallelForBody +{ + btBroadphasePair* mPairArray; + btNearCallback mCallback; + btCollisionDispatcher* mDispatcher; + const btDispatcherInfo* mInfo; + + CollisionDispatcherUpdater() + { + mPairArray = NULL; + mCallback = NULL; + mDispatcher = NULL; + mInfo = NULL; + } + void forLoop( int iBegin, int iEnd ) const + { + for ( int i = iBegin; i < iEnd; ++i ) + { + btBroadphasePair* pair = &mPairArray[ i ]; + mCallback( *pair, *mDispatcher, *mInfo ); + } + } +}; + + +void btCollisionDispatcherMt::dispatchAllCollisionPairs( btOverlappingPairCache* pairCache, const btDispatcherInfo& info, btDispatcher* dispatcher ) +{ + int pairCount = pairCache->getNumOverlappingPairs(); + if ( pairCount == 0 ) + { + return; + } + CollisionDispatcherUpdater updater; + updater.mCallback = getNearCallback(); + updater.mPairArray = pairCache->getOverlappingPairArrayPtr(); + updater.mDispatcher = this; + updater.mInfo = &info; + + m_batchUpdating = true; + btParallelFor( 0, pairCount, m_grainSize, updater ); + m_batchUpdating = false; + + // reconstruct the manifolds array to ensure determinism + m_manifoldsPtr.resizeNoInitialize( 0 ); + + btBroadphasePair* pairs = pairCache->getOverlappingPairArrayPtr(); + for ( int i = 0; i < pairCount; ++i ) + { + if (btCollisionAlgorithm* algo = pairs[ i ].m_algorithm) + { + algo->getAllContactManifolds( m_manifoldsPtr ); + } + } + + // update the indices (used when releasing manifolds) + for ( int i = 0; i < m_manifoldsPtr.size(); ++i ) + { + m_manifoldsPtr[ i ]->m_index1a = i; + } +} + + diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h new file mode 100644 index 000000000..f1d7eafdc --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h @@ -0,0 +1,39 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef BT_COLLISION_DISPATCHER_MT_H +#define BT_COLLISION_DISPATCHER_MT_H + +#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" +#include "LinearMath/btThreads.h" + + +class btCollisionDispatcherMt : public btCollisionDispatcher +{ +public: + btCollisionDispatcherMt( btCollisionConfiguration* config, int grainSize = 40 ); + + virtual btPersistentManifold* getNewManifold( const btCollisionObject* body0, const btCollisionObject* body1 ) BT_OVERRIDE; + virtual void releaseManifold( btPersistentManifold* manifold ) BT_OVERRIDE; + + virtual void dispatchAllCollisionPairs( btOverlappingPairCache* pairCache, const btDispatcherInfo& info, btDispatcher* dispatcher ) BT_OVERRIDE; + +protected: + bool m_batchUpdating; + int m_grainSize; +}; + +#endif //BT_COLLISION_DISPATCHER_MT_H + diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp index fdecac162..b595c56bc 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp @@ -18,9 +18,11 @@ subject to the following restrictions: #include "LinearMath/btSerializer.h" btCollisionObject::btCollisionObject() - : m_anisotropicFriction(1.f,1.f,1.f), - m_hasAnisotropicFriction(false), - m_contactProcessingThreshold(BT_LARGE_FLOAT), + : m_interpolationLinearVelocity(0.f, 0.f, 0.f), + m_interpolationAngularVelocity(0.f, 0.f, 0.f), + m_anisotropicFriction(1.f,1.f,1.f), + m_hasAnisotropicFriction(false), + m_contactProcessingThreshold(BT_LARGE_FLOAT), m_broadphaseHandle(0), m_collisionShape(0), m_extensionPointer(0), @@ -48,6 +50,7 @@ btCollisionObject::btCollisionObject() m_updateRevision(0) { m_worldTransform.setIdentity(); + m_interpolationWorldTransform.setIdentity(); } btCollisionObject::~btCollisionObject() @@ -112,6 +115,9 @@ const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* seriali dataOut->m_ccdMotionThreshold = m_ccdMotionThreshold; dataOut->m_checkCollideWith = m_checkCollideWith; + // Fill padding with zeros to appease msan. + memset(dataOut->m_padding, 0, sizeof(dataOut->m_padding)); + return btCollisionObjectDataName; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h index 0cae21000..fec831bff 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h @@ -139,6 +139,8 @@ public: CF_DISABLE_SPU_COLLISION_PROCESSING = 64,//disable parallel/SPU processing CF_HAS_CONTACT_STIFFNESS_DAMPING = 128, CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR = 256, + CF_HAS_FRICTION_ANCHOR = 512, + CF_HAS_COLLISION_SOUND_TRIGGER = 1024 }; enum CollisionObjectTypes diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp index 3bbf7586e..c893b60d3 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp @@ -108,7 +108,7 @@ btCollisionWorld::~btCollisionWorld() -void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) +void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup, int collisionFilterMask) { btAssert(collisionObject); @@ -135,8 +135,7 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho collisionObject, collisionFilterGroup, collisionFilterMask, - m_dispatcher1,0 - )) ; + m_dispatcher1)) ; @@ -257,7 +256,7 @@ void btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject) int iObj = collisionObject->getWorldArrayIndex(); - btAssert(iObj >= 0 && iObj < m_collisionObjects.size()); // trying to remove an object that was never added or already removed previously? +// btAssert(iObj >= 0 && iObj < m_collisionObjects.size()); // trying to remove an object that was never added or already removed previously? if (iObj >= 0 && iObj < m_collisionObjects.size()) { btAssert(collisionObject == m_collisionObjects[iObj]); @@ -1334,7 +1333,7 @@ void btCollisionWorld::debugDrawObject(const btTransform& worldTransform, const // Draw a small simplex at the center of the object if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawFrames) { - getDebugDrawer()->drawTransform(worldTransform,1); + getDebugDrawer()->drawTransform(worldTransform,.1); } if (shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) @@ -1515,6 +1514,8 @@ void btCollisionWorld::debugDrawWorld() { if (getDebugDrawer()) { + getDebugDrawer()->clearLines(); + btIDebugDraw::DefaultColors defaultColors = getDebugDrawer()->getDefaultColors(); if ( getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints) diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h index 29d371116..eede2b28c 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h @@ -205,8 +205,8 @@ public: { btScalar m_closestHitFraction; const btCollisionObject* m_collisionObject; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; + int m_collisionFilterGroup; + int m_collisionFilterMask; //@BP Mod - Custom flags, currently used to enable backface culling on tri-meshes, see btRaycastCallback.h. Apply any of the EFlags defined there on m_flags here to invoke. unsigned int m_flags; @@ -340,8 +340,8 @@ public: struct ConvexResultCallback { btScalar m_closestHitFraction; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; + int m_collisionFilterGroup; + int m_collisionFilterMask; ConvexResultCallback() :m_closestHitFraction(btScalar(1.)), @@ -410,8 +410,8 @@ public: ///ContactResultCallback is used to report contact points struct ContactResultCallback { - short int m_collisionFilterGroup; - short int m_collisionFilterMask; + int m_collisionFilterGroup; + int m_collisionFilterMask; btScalar m_closestDistanceThreshold; ContactResultCallback() @@ -483,7 +483,7 @@ public: const btCollisionObjectWrapper* colObjWrap, ConvexResultCallback& resultCallback, btScalar allowedPenetration); - virtual void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter); + virtual void addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter); btCollisionObjectArray& getCollisionObjectArray() { diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp index 36dd04350..f2b083780 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp @@ -579,13 +579,13 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape( btCollisionS btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData; btCompoundShape* compoundShape = createCompoundShape(); - btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0]; + //btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0]; btAlignedObjectArray childShapes; for (int i=0;im_numChildShapes;i++) { - btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i]; + //btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i]; btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h index 9a6d16fbe..81c614272 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h @@ -124,7 +124,6 @@ public: btCollisionShape* getCollisionShapeByIndex(int index); int getNumRigidBodies() const; btCollisionObject* getRigidBodyByIndex(int index) const; - int getNumConstraints() const; int getNumBvhs() const; btOptimizedBvh* getBvhByIndex(int index) const; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp index 8dd7e4403..d4a1aa78e 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp @@ -24,6 +24,8 @@ subject to the following restrictions: #include "BulletCollision/CollisionDispatch/btManifoldResult.h" #include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h" +//USE_LOCAL_STACK will avoid most (often all) dynamic memory allocations due to resizing in processCollision and MycollideTT +#define USE_LOCAL_STACK 1 btShapePairCallback gCompoundCompoundChildShapePairCallback = 0; @@ -251,7 +253,12 @@ static inline void MycollideTT( const btDbvtNode* root0, int depth=1; int treshold=btDbvt::DOUBLE_STACKSIZE-4; btAlignedObjectArray stkStack; +#ifdef USE_LOCAL_STACK + ATTRIBUTE_ALIGNED16(btDbvt::sStkNN localStack[btDbvt::DOUBLE_STACKSIZE]); + stkStack.initializeFromBuffer(&localStack,btDbvt::DOUBLE_STACKSIZE,btDbvt::DOUBLE_STACKSIZE); +#else stkStack.resize(btDbvt::DOUBLE_STACKSIZE); +#endif stkStack[0]=btDbvt::sStkNN(root0,root1); do { btDbvt::sStkNN p=stkStack[--depth]; @@ -329,6 +336,10 @@ void btCompoundCompoundCollisionAlgorithm::processCollision (const btCollisionOb { int i; btManifoldArray manifoldArray; +#ifdef USE_LOCAL_STACK + btPersistentManifold localManifolds[4]; + manifoldArray.initializeFromBuffer(&localManifolds,0,4); +#endif btSimplePairArray& pairs = m_childCollisionAlgorithmCache->getOverlappingPairArray(); for (i=0;igetShapeType() == CAPSULE_SHAPE_PROXYTYPE) && (min1->getShapeType() == CAPSULE_SHAPE_PROXYTYPE)) { + //m_manifoldPtr->clearManifold(); + btCapsuleShape* capsuleA = (btCapsuleShape*) min0; btCapsuleShape* capsuleB = (btCapsuleShape*) min1; - // btVector3 localScalingA = capsuleA->getLocalScaling(); - // btVector3 localScalingB = capsuleB->getLocalScaling(); btScalar threshold = m_manifoldPtr->getContactBreakingThreshold(); @@ -329,6 +329,50 @@ void btConvexConvexAlgorithm ::processCollision (const btCollisionObjectWrapper* resultOut->refreshContactPoints(); return; } + + if ((min0->getShapeType() == CAPSULE_SHAPE_PROXYTYPE) && (min1->getShapeType() == SPHERE_SHAPE_PROXYTYPE)) + { + //m_manifoldPtr->clearManifold(); + + btCapsuleShape* capsuleA = (btCapsuleShape*) min0; + btSphereShape* capsuleB = (btSphereShape*) min1; + + btScalar threshold = m_manifoldPtr->getContactBreakingThreshold(); + + btScalar dist = capsuleCapsuleDistance(normalOnB, pointOnBWorld,capsuleA->getHalfHeight(),capsuleA->getRadius(), + 0.,capsuleB->getRadius(),capsuleA->getUpAxis(),1, + body0Wrap->getWorldTransform(),body1Wrap->getWorldTransform(),threshold); + + if (dist=(SIMD_EPSILON*SIMD_EPSILON)); + resultOut->addContactPoint(normalOnB,pointOnBWorld,dist); + } + resultOut->refreshContactPoints(); + return; + } + + if ((min0->getShapeType() == SPHERE_SHAPE_PROXYTYPE) && (min1->getShapeType() == CAPSULE_SHAPE_PROXYTYPE)) + { + //m_manifoldPtr->clearManifold(); + + btSphereShape* capsuleA = (btSphereShape*) min0; + btCapsuleShape* capsuleB = (btCapsuleShape*) min1; + + btScalar threshold = m_manifoldPtr->getContactBreakingThreshold(); + + btScalar dist = capsuleCapsuleDistance(normalOnB, pointOnBWorld,0.,capsuleA->getRadius(), + capsuleB->getHalfHeight(),capsuleB->getRadius(),1,capsuleB->getUpAxis(), + body0Wrap->getWorldTransform(),body1Wrap->getWorldTransform(),threshold); + + if (dist=(SIMD_EPSILON*SIMD_EPSILON)); + resultOut->addContactPoint(normalOnB,pointOnBWorld,dist); + } + resultOut->refreshContactPoints(); + return; + } #endif //BT_DISABLE_CAPSULE_CAPSULE_COLLIDER diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h index 186964d72..2aaf6201f 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h @@ -123,9 +123,9 @@ private: - SIMD_FORCE_INLINE unsigned int getHash(unsigned int indexA, unsigned int indexB) + SIMD_FORCE_INLINE unsigned int getHash(unsigned int indexA, unsigned int indexB) { - int key = static_cast(((unsigned int)indexA) | (((unsigned int)indexB) <<16)); + unsigned int key = indexA | (indexB << 16); // Thomas Wang's hash key += ~(key << 15); @@ -134,7 +134,7 @@ private: key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); - return static_cast(key); + return key; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp index be8e51d52..aa3d159f8 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp @@ -111,6 +111,7 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b return; bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject(); + bool isNewCollision = m_manifoldPtr->getNumContacts() == 0; btVector3 pointA = pointInWorld + normalOnBInWorld * depth; @@ -145,7 +146,13 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b newPt.m_combinedContactStiffness1 = calculateCombinedContactStiffness(m_body0Wrap->getCollisionObject(),m_body1Wrap->getCollisionObject()); newPt.m_contactPointFlags |= BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING; } - + + if ( (m_body0Wrap->getCollisionObject()->getCollisionFlags()& btCollisionObject::CF_HAS_FRICTION_ANCHOR) || + (m_body1Wrap->getCollisionObject()->getCollisionFlags()& btCollisionObject::CF_HAS_FRICTION_ANCHOR)) + { + newPt.m_contactPointFlags |= BT_CONTACT_FLAG_FRICTION_ANCHOR; + } + btPlaneSpace1(newPt.m_normalWorldOnB,newPt.m_lateralFrictionDir1,newPt.m_lateralFrictionDir2); @@ -187,5 +194,9 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b (*gContactAddedCallback)(m_manifoldPtr->getContactPoint(insertIndex),obj0Wrap,newPt.m_partId0,newPt.m_index0,obj1Wrap,newPt.m_partId1,newPt.m_index1); } + if (gContactStartedCallback && isNewCollision) + { + gContactStartedCallback(m_manifoldPtr); + } } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h index ce333783e..22bee4f2c 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h @@ -103,11 +103,12 @@ public: btScalar minDimension = boxHalfExtents.getX(); if (minDimension>boxHalfExtents.getY()) minDimension = boxHalfExtents.getY(); - setSafeMargin(minDimension); m_shapeType = BOX_2D_SHAPE_PROXYTYPE; btVector3 margin(getMargin(),getMargin(),getMargin()); m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin; + + setSafeMargin(minDimension); }; virtual void setMargin(btScalar collisionMargin) diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp index 3859138f1..72eeb3891 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp @@ -19,10 +19,10 @@ btBoxShape::btBoxShape( const btVector3& boxHalfExtents) { m_shapeType = BOX_SHAPE_PROXYTYPE; - setSafeMargin(boxHalfExtents); - btVector3 margin(getMargin(),getMargin(),getMargin()); m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin; + + setSafeMargin(boxHalfExtents); }; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp index 0940da1a4..61f465cb7 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp @@ -437,6 +437,9 @@ const char* btBvhTriangleMeshShape::serialize(void* dataBuffer, btSerializer* se trimeshData->m_triangleInfoMap = 0; } + // Fill padding with zeros to appease msan. + memset(trimeshData->m_pad3, 0, sizeof(trimeshData->m_pad3)); + return "btTriangleMeshShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp index 864df26e9..0345501ce 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp @@ -16,11 +16,11 @@ subject to the following restrictions: #include "btCapsuleShape.h" -#include "BulletCollision/CollisionShapes/btCollisionMargin.h" #include "LinearMath/btQuaternion.h" btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape () { + m_collisionMargin = radius; m_shapeType = CAPSULE_SHAPE_PROXYTYPE; m_upAxis = 1; m_implicitShapeDimensions.setValue(radius,0.5f*height,radius); @@ -48,14 +48,13 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter btVector3 vtx; btScalar newDot; - btScalar radius = getRadius(); - + { btVector3 pos(0,0,0); pos[getUpAxis()] = getHalfHeight(); - vtx = pos +vec*(radius) - vec * getMargin(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -67,7 +66,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter btVector3 pos(0,0,0); pos[getUpAxis()] = -getHalfHeight(); - vtx = pos +vec*(radius) - vec * getMargin(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -84,8 +83,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter { - btScalar radius = getRadius(); - + for (int j=0;j maxDot) { @@ -107,7 +105,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter { btVector3 pos(0,0,0); pos[getUpAxis()] = -getHalfHeight(); - vtx = pos +vec*(radius) - vec * getMargin(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -133,11 +131,9 @@ void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia) con btVector3 halfExtents(radius,radius,radius); halfExtents[getUpAxis()]+=getHalfHeight(); - btScalar margin = CONVEX_DISTANCE_MARGIN; - - btScalar lx=btScalar(2.)*(halfExtents[0]+margin); - btScalar ly=btScalar(2.)*(halfExtents[1]+margin); - btScalar lz=btScalar(2.)*(halfExtents[2]+margin); + btScalar lx=btScalar(2.)*(halfExtents[0]); + btScalar ly=btScalar(2.)*(halfExtents[1]); + btScalar lz=btScalar(2.)*(halfExtents[2]); const btScalar x2 = lx*lx; const btScalar y2 = ly*ly; const btScalar z2 = lz*lz; @@ -151,6 +147,7 @@ void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia) con btCapsuleShapeX::btCapsuleShapeX(btScalar radius,btScalar height) { + m_collisionMargin = radius; m_upAxis = 0; m_implicitShapeDimensions.setValue(0.5f*height, radius,radius); } @@ -162,6 +159,7 @@ btCapsuleShapeX::btCapsuleShapeX(btScalar radius,btScalar height) btCapsuleShapeZ::btCapsuleShapeZ(btScalar radius,btScalar height) { + m_collisionMargin = radius; m_upAxis = 2; m_implicitShapeDimensions.setValue(radius,radius,0.5f*height); } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h index f8c55ace4..7d64b46ab 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h @@ -48,21 +48,13 @@ public: virtual void setMargin(btScalar collisionMargin) { - //correct the m_implicitShapeDimensions for the margin - btVector3 oldMargin(getMargin(),getMargin(),getMargin()); - btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin; - - btConvexInternalShape::setMargin(collisionMargin); - btVector3 newMargin(getMargin(),getMargin(),getMargin()); - m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin; - + //don't override the margin for capsules, their entire radius == margin } virtual void getAabb (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const { btVector3 halfExtents(getRadius(),getRadius(),getRadius()); halfExtents[m_upAxis] = getRadius() + getHalfHeight(); - halfExtents += btVector3(getMargin(),getMargin(),getMargin()); btMatrix3x3 abs_b = t.getBasis().absolute(); btVector3 center = t.getOrigin(); btVector3 extent = halfExtents.dot3(abs_b[0], abs_b[1], abs_b[2]); @@ -94,14 +86,12 @@ public: virtual void setLocalScaling(const btVector3& scaling) { - btVector3 oldMargin(getMargin(),getMargin(),getMargin()); - btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin; - btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling; - - btConvexInternalShape::setLocalScaling(scaling); - - m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin; - + btVector3 unScaledImplicitShapeDimensions = m_implicitShapeDimensions / m_localScaling; + btConvexInternalShape::setLocalScaling(scaling); + m_implicitShapeDimensions = (unScaledImplicitShapeDimensions * scaling); + //update m_collisionMargin, since entire radius==margin + int radiusAxis = (m_upAxis+2)%3; + m_collisionMargin = m_implicitShapeDimensions[radiusAxis]; } virtual btVector3 getAnisotropicRollingFrictionDirection() const @@ -174,11 +164,17 @@ SIMD_FORCE_INLINE int btCapsuleShape::calculateSerializeBufferSize() const SIMD_FORCE_INLINE const char* btCapsuleShape::serialize(void* dataBuffer, btSerializer* serializer) const { btCapsuleShapeData* shapeData = (btCapsuleShapeData*) dataBuffer; - + btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer); shapeData->m_upAxis = m_upAxis; - + + // Fill padding with zeros to appease msan. + shapeData->m_padding[0] = 0; + shapeData->m_padding[1] = 0; + shapeData->m_padding[2] = 0; + shapeData->m_padding[3] = 0; + return "btCapsuleShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp index 39ee21cad..823e2788f 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp @@ -106,7 +106,10 @@ const char* btCollisionShape::serialize(void* dataBuffer, btSerializer* serializ serializer->serializeName(name); } shapeData->m_shapeType = m_shapeType; - //shapeData->m_padding//?? + + // Fill padding with zeros to appease msan. + memset(shapeData->m_padding, 0, sizeof(shapeData->m_padding)); + return "btCollisionShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h index 46d78d148..3b44e3f27 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h @@ -168,11 +168,17 @@ SIMD_FORCE_INLINE int btConeShape::calculateSerializeBufferSize() const SIMD_FORCE_INLINE const char* btConeShape::serialize(void* dataBuffer, btSerializer* serializer) const { btConeShapeData* shapeData = (btConeShapeData*) dataBuffer; - + btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer); - + shapeData->m_upIndex = m_coneIndices[1]; - + + // Fill padding with zeros to appease msan. + shapeData->m_padding[0] = 0; + shapeData->m_padding[1] = 0; + shapeData->m_padding[2] = 0; + shapeData->m_padding[3] = 0; + return "btConeShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp index c1aa6ca46..a7a959840 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp @@ -211,7 +211,10 @@ const char* btConvexHullShape::serialize(void* dataBuffer, btSerializer* seriali } serializer->finalizeChunk(chunk,btVector3DataName,BT_ARRAY_CODE,(void*)&m_unscaledPoints[0]); } - + + // Fill padding with zeros to appease msan. + memset(shapeData->m_padding3, 0, sizeof(shapeData->m_padding3)); + return "btConvexHullShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h index 37e04f5fc..1213b82fb 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h @@ -172,6 +172,9 @@ SIMD_FORCE_INLINE const char* btConvexInternalShape::serialize(void* dataBuffer, m_localScaling.serializeFloat(shapeData->m_localScaling); shapeData->m_collisionMargin = float(m_collisionMargin); + // Fill padding with zeros to appease msan. + shapeData->m_padding = 0; + return "btConvexInternalShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp index b56d72917..8d7fb054d 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp @@ -230,14 +230,13 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV btScalar halfHeight = capsuleShape->getHalfHeight(); int capsuleUpAxis = capsuleShape->getUpAxis(); - btScalar radius = capsuleShape->getRadius(); btVector3 supVec(0,0,0); btScalar maxDot(btScalar(-BT_LARGE_FLOAT)); btVector3 vec = vec0; btScalar lenSqr = vec.length2(); - if (lenSqr < btScalar(0.0001)) + if (lenSqr < SIMD_EPSILON*SIMD_EPSILON) { vec.setValue(1,0,0); } else @@ -251,8 +250,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV btVector3 pos(0,0,0); pos[capsuleUpAxis] = halfHeight; - //vtx = pos +vec*(radius); - vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV(); + vtx = pos; newDot = vec.dot(vtx); @@ -266,8 +264,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV btVector3 pos(0,0,0); pos[capsuleUpAxis] = -halfHeight; - //vtx = pos +vec*(radius); - vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -427,7 +424,6 @@ void btConvexShape::getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3 halfExtents(capsuleShape->getRadius(),capsuleShape->getRadius(),capsuleShape->getRadius()); int m_upAxis = capsuleShape->getUpAxis(); halfExtents[m_upAxis] = capsuleShape->getRadius() + capsuleShape->getHalfHeight(); - halfExtents += btVector3(capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual()); btMatrix3x3 abs_b = t.getBasis().absolute(); btVector3 center = t.getOrigin(); btVector3 extent = halfExtents.dot3(abs_b[0], abs_b[1], abs_b[2]); diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp index 6cfe43be4..604b3fc77 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp @@ -19,10 +19,11 @@ btCylinderShape::btCylinderShape (const btVector3& halfExtents) :btConvexInternalShape(), m_upAxis(1) { - setSafeMargin(halfExtents); - btVector3 margin(getMargin(),getMargin(),getMargin()); m_implicitShapeDimensions = (halfExtents * m_localScaling) - margin; + + setSafeMargin(halfExtents); + m_shapeType = CYLINDER_SHAPE_PROXYTYPE; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h index 6f796950e..a214a827c 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h @@ -199,11 +199,17 @@ SIMD_FORCE_INLINE int btCylinderShape::calculateSerializeBufferSize() const SIMD_FORCE_INLINE const char* btCylinderShape::serialize(void* dataBuffer, btSerializer* serializer) const { btCylinderShapeData* shapeData = (btCylinderShapeData*) dataBuffer; - + btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer); shapeData->m_upAxis = m_upAxis; - + + // Fill padding with zeros to appease msan. + shapeData->m_padding[0] = 0; + shapeData->m_padding[1] = 0; + shapeData->m_padding[2] = 0; + shapeData->m_padding[3] = 0; + return "btCylinderShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp index 06707e24e..899ef5005 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp @@ -55,6 +55,23 @@ btScalar btMinkowskiSumShape::getMargin() const void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const { (void)mass; - btAssert(0); - inertia.setValue(0,0,0); + //inertia of the AABB of the Minkowski sum + btTransform identity; + identity.setIdentity(); + btVector3 aabbMin,aabbMax; + getAabb(identity,aabbMin,aabbMax); + + btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5); + + btScalar margin = getMargin(); + + btScalar lx=btScalar(2.)*(halfExtents.x()+margin); + btScalar ly=btScalar(2.)*(halfExtents.y()+margin); + btScalar lz=btScalar(2.)*(halfExtents.z()+margin); + const btScalar x2 = lx*lx; + const btScalar y2 = ly*ly; + const btScalar z2 = lz*lz; + const btScalar scaledmass = mass * btScalar(0.08333333); + + inertia = scaledmass * (btVector3(y2+z2,x2+z2,x2+y2)); } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp index 88f6c4dcb..4195fa313 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp @@ -175,7 +175,10 @@ const char* btMultiSphereShape::serialize(void* dataBuffer, btSerializer* serial } serializer->finalizeChunk(chunk,"btPositionAndRadius",BT_ARRAY_CODE,(void*)&m_localPositionArray[0]); } - + + // Fill padding with zeros to appease msan. + memset(shapeData->m_padding, 0, sizeof(shapeData->m_padding)); + return "btMultiSphereShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h index 961d001a9..7bf8e01c1 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h @@ -93,10 +93,12 @@ protected: aabbMax = m_localAabbMax; } -public: +protected: btPolyhedralConvexAabbCachingShape(); +public: + inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const { diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h index b192efeeb..50561f7f5 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h @@ -29,8 +29,11 @@ public: btSphereShape (btScalar radius) : btConvexInternalShape () { m_shapeType = SPHERE_SHAPE_PROXYTYPE; + m_localScaling.setValue(1.0, 1.0, 1.0); + m_implicitShapeDimensions.setZero(); m_implicitShapeDimensions.setX(radius); m_collisionMargin = radius; + m_padding = 0; } virtual btVector3 localGetSupportingVertex(const btVector3& vec)const; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h index e6e328839..5e9eccc77 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h @@ -94,7 +94,13 @@ SIMD_FORCE_INLINE const char* btStaticPlaneShape::serialize(void* dataBuffer, bt m_localScaling.serializeFloat(planeData->m_localScaling); m_planeNormal.serializeFloat(planeData->m_planeNormal); planeData->m_planeConstant = float(m_planeConstant); - + + // Fill padding with zeros to appease msan. + planeData->m_pad[0] = 0; + planeData->m_pad[1] = 0; + planeData->m_pad[2] = 0; + planeData->m_pad[3] = 0; + return "btStaticPlaneShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp index b3d449676..78ddeb370 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp @@ -293,6 +293,9 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s tmpIndices[gfxindex].m_values[0] = tri_indices[0]; tmpIndices[gfxindex].m_values[1] = tri_indices[1]; tmpIndices[gfxindex].m_values[2] = tri_indices[2]; + // Fill padding with zeros to appease msan. + tmpIndices[gfxindex].m_pad[0] = 0; + tmpIndices[gfxindex].m_pad[1] = 0; } serializer->finalizeChunk(chunk,"btShortIntIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr); } @@ -311,6 +314,8 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s tmpIndices[gfxindex].m_values[0] = tri_indices[0]; tmpIndices[gfxindex].m_values[1] = tri_indices[1]; tmpIndices[gfxindex].m_values[2] = tri_indices[2]; + // Fill padding with zeros to appease msan. + tmpIndices[gfxindex].m_pad = 0; } serializer->finalizeChunk(chunk,"btCharIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr); } @@ -375,6 +380,8 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s serializer->finalizeChunk(chunk,"btMeshPartData",BT_ARRAY_CODE,chunk->m_oldPtr); } + // Fill padding with zeros to appease msan. + memset(trimeshData->m_padding, 0, sizeof(trimeshData->m_padding)); m_scaling.serializeFloat(trimeshData->m_scaling); return "btStridingMeshInterfaceData"; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h index 17deef89d..642758959 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h @@ -195,6 +195,13 @@ SIMD_FORCE_INLINE const char* btTriangleInfoMap::serialize(void* dataBuffer, btS serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*) &m_keyArray[0]); } + + // Fill padding with zeros to appease msan. + tmapData->m_padding[0] = 0; + tmapData->m_padding[1] = 0; + tmapData->m_padding[2] = 0; + tmapData->m_padding[3] = 0; + return "btTriangleInfoMapData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h index 02f8b678a..19f7ecddd 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h @@ -5,6 +5,22 @@ #include "btGImpactShape.h" #include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h" +ATTRIBUTE_ALIGNED16(class) btCompoundFromGimpactShape : public btCompoundShape +{ +public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + + virtual ~btCompoundFromGimpactShape() + { + /*delete all the btBU_Simplex1to4 ChildShapes*/ + for (int i = 0; i < m_children.size(); i++) + { + delete m_children[i].m_childShape; + } + } + +}; + struct MyCallback : public btTriangleRaycastCallback { int m_ignorePart; @@ -77,7 +93,7 @@ struct MyCallback : public btTriangleRaycastCallback btCompoundShape* btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimpactMesh, btScalar depth) { - btCompoundShape* colShape = new btCompoundShape(); + btCompoundShape* colShape = new btCompoundFromGimpactShape(); btTransform tr; tr.setIdentity(); @@ -90,4 +106,4 @@ btCompoundShape* btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimp return colShape; } -#endif //BT_COMPOUND_FROM_GIMPACT \ No newline at end of file +#endif //BT_COMPOUND_FROM_GIMPACT diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h index 0c66f8e10..d1027dbe6 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h @@ -27,86 +27,7 @@ subject to the following restrictions: #include "LinearMath/btTransform.h" #include "LinearMath/btAlignedObjectArray.h" #include "btTriangleShapeEx.h" - - - -/** -Configuration var for applying interpolation of contact normals -*/ -#define NORMAL_CONTACT_AVERAGE 1 - -#define CONTACT_DIFF_EPSILON 0.00001f - -///The GIM_CONTACT is an internal GIMPACT structure, similar to btManifoldPoint. -///@todo: remove and replace GIM_CONTACT by btManifoldPoint. -class GIM_CONTACT -{ -public: - btVector3 m_point; - btVector3 m_normal; - btScalar m_depth;//Positive value indicates interpenetration - btScalar m_distance;//Padding not for use - int m_feature1;//Face number - int m_feature2;//Face number -public: - GIM_CONTACT() - { - } - - GIM_CONTACT(const GIM_CONTACT & contact): - m_point(contact.m_point), - m_normal(contact.m_normal), - m_depth(contact.m_depth), - m_feature1(contact.m_feature1), - m_feature2(contact.m_feature2) - { - } - - GIM_CONTACT(const btVector3 &point,const btVector3 & normal, - btScalar depth, int feature1, int feature2): - m_point(point), - m_normal(normal), - m_depth(depth), - m_feature1(feature1), - m_feature2(feature2) - { - } - - //! Calcs key for coord classification - SIMD_FORCE_INLINE unsigned int calc_key_contact() const - { - int _coords[] = { - (int)(m_point[0]*1000.0f+1.0f), - (int)(m_point[1]*1333.0f), - (int)(m_point[2]*2133.0f+3.0f)}; - unsigned int _hash=0; - unsigned int *_uitmp = (unsigned int *)(&_coords[0]); - _hash = *_uitmp; - _uitmp++; - _hash += (*_uitmp)<<4; - _uitmp++; - _hash += (*_uitmp)<<8; - return _hash; - } - - SIMD_FORCE_INLINE void interpolate_normals( btVector3 * normals,int normal_count) - { - btVector3 vec_sum(m_normal); - for(int i=0;i { @@ -141,5 +62,4 @@ public: void merge_contacts_unique(const btContactArray & contacts); }; - #endif // GIM_CONTACT_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h new file mode 100644 index 000000000..efbc4a567 --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h @@ -0,0 +1,109 @@ +#ifndef BT_CONTACT_H_STRUCTS_INCLUDED +#define BT_CONTACT_H_STRUCTS_INCLUDED + +/*! \file gim_contact.h +\author Francisco Leon Najera +*/ +/* +This source file is part of GIMPACT Library. + +For the latest info, see http://gimpact.sourceforge.net/ + +Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. +email: projectileman@yahoo.com + + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +#include "LinearMath/btTransform.h" +#include "LinearMath/btAlignedObjectArray.h" +#include "btTriangleShapeEx.h" + + +/** +Configuration var for applying interpolation of contact normals +*/ +#define NORMAL_CONTACT_AVERAGE 1 + +#define CONTACT_DIFF_EPSILON 0.00001f + +///The GIM_CONTACT is an internal GIMPACT structure, similar to btManifoldPoint. +///@todo: remove and replace GIM_CONTACT by btManifoldPoint. +class GIM_CONTACT +{ +public: + btVector3 m_point; + btVector3 m_normal; + btScalar m_depth;//Positive value indicates interpenetration + btScalar m_distance;//Padding not for use + int m_feature1;//Face number + int m_feature2;//Face number +public: + GIM_CONTACT() + { + } + + GIM_CONTACT(const GIM_CONTACT & contact): + m_point(contact.m_point), + m_normal(contact.m_normal), + m_depth(contact.m_depth), + m_feature1(contact.m_feature1), + m_feature2(contact.m_feature2) + { + } + + GIM_CONTACT(const btVector3 &point,const btVector3 & normal, + btScalar depth, int feature1, int feature2): + m_point(point), + m_normal(normal), + m_depth(depth), + m_feature1(feature1), + m_feature2(feature2) + { + } + + //! Calcs key for coord classification + SIMD_FORCE_INLINE unsigned int calc_key_contact() const + { + int _coords[] = { + (int)(m_point[0]*1000.0f+1.0f), + (int)(m_point[1]*1333.0f), + (int)(m_point[2]*2133.0f+3.0f)}; + unsigned int _hash=0; + unsigned int *_uitmp = (unsigned int *)(&_coords[0]); + _hash = *_uitmp; + _uitmp++; + _hash += (*_uitmp)<<4; + _uitmp++; + _hash += (*_uitmp)<<8; + return _hash; + } + + SIMD_FORCE_INLINE void interpolate_normals( btVector3 * normals,int normal_count) + { + btVector3 vec_sum(m_normal); + for(int i=0;i @@ -74,59 +50,6 @@ public: } }; - -///GIM_BVH_DATA is an internal GIMPACT collision structure to contain axis aligned bounding box -struct GIM_BVH_DATA -{ - btAABB m_bound; - int m_data; -}; - -//! Node Structure for trees -class GIM_BVH_TREE_NODE -{ -public: - btAABB m_bound; -protected: - int m_escapeIndexOrDataIndex; -public: - GIM_BVH_TREE_NODE() - { - m_escapeIndexOrDataIndex = 0; - } - - SIMD_FORCE_INLINE bool isLeafNode() const - { - //skipindex is negative (internal node), triangleindex >=0 (leafnode) - return (m_escapeIndexOrDataIndex>=0); - } - - SIMD_FORCE_INLINE int getEscapeIndex() const - { - //btAssert(m_escapeIndexOrDataIndex < 0); - return -m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setEscapeIndex(int index) - { - m_escapeIndexOrDataIndex = -index; - } - - SIMD_FORCE_INLINE int getDataIndex() const - { - //btAssert(m_escapeIndexOrDataIndex >= 0); - - return m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setDataIndex(int index) - { - m_escapeIndexOrDataIndex = index; - } - -}; - - class GIM_BVH_DATA_ARRAY:public btAlignedObjectArray { }; @@ -392,5 +315,4 @@ public: btPairSet & collision_pairs); }; - #endif // GIM_BOXPRUNING_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h new file mode 100644 index 000000000..9342a572d --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h @@ -0,0 +1,105 @@ +#ifndef GIM_BOX_SET_STRUCT_H_INCLUDED +#define GIM_BOX_SET_STRUCT_H_INCLUDED + +/*! \file gim_box_set.h +\author Francisco Leon Najera +*/ +/* +This source file is part of GIMPACT Library. + +For the latest info, see http://gimpact.sourceforge.net/ + +Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. +email: projectileman@yahoo.com + + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + + +#include "LinearMath/btAlignedObjectArray.h" + +#include "btBoxCollision.h" +#include "btTriangleShapeEx.h" + +//! Overlapping pair +struct GIM_PAIR +{ + int m_index1; + int m_index2; + GIM_PAIR() + {} + + GIM_PAIR(const GIM_PAIR & p) + { + m_index1 = p.m_index1; + m_index2 = p.m_index2; + } + + GIM_PAIR(int index1, int index2) + { + m_index1 = index1; + m_index2 = index2; + } +}; + +///GIM_BVH_DATA is an internal GIMPACT collision structure to contain axis aligned bounding box +struct GIM_BVH_DATA +{ + btAABB m_bound; + int m_data; +}; + +//! Node Structure for trees +class GIM_BVH_TREE_NODE +{ +public: + btAABB m_bound; +protected: + int m_escapeIndexOrDataIndex; +public: + GIM_BVH_TREE_NODE() + { + m_escapeIndexOrDataIndex = 0; + } + + SIMD_FORCE_INLINE bool isLeafNode() const + { + //skipindex is negative (internal node), triangleindex >=0 (leafnode) + return (m_escapeIndexOrDataIndex>=0); + } + + SIMD_FORCE_INLINE int getEscapeIndex() const + { + //btAssert(m_escapeIndexOrDataIndex < 0); + return -m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setEscapeIndex(int index) + { + m_escapeIndexOrDataIndex = -index; + } + + SIMD_FORCE_INLINE int getDataIndex() const + { + //btAssert(m_escapeIndexOrDataIndex >= 0); + + return m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setDataIndex(int index) + { + m_escapeIndexOrDataIndex = index; + } + +}; + +#endif // GIM_BOXPRUNING_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h index e6e52fff4..42e5520fc 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h @@ -26,73 +26,7 @@ subject to the following restrictions: #include "btGImpactBvh.h" #include "btQuantization.h" - - - - - -///btQuantizedBvhNode is a compressed aabb node, 16 bytes. -///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range). -ATTRIBUTE_ALIGNED16 (struct) BT_QUANTIZED_BVH_NODE -{ - //12 bytes - unsigned short int m_quantizedAabbMin[3]; - unsigned short int m_quantizedAabbMax[3]; - //4 bytes - int m_escapeIndexOrDataIndex; - - BT_QUANTIZED_BVH_NODE() - { - m_escapeIndexOrDataIndex = 0; - } - - SIMD_FORCE_INLINE bool isLeafNode() const - { - //skipindex is negative (internal node), triangleindex >=0 (leafnode) - return (m_escapeIndexOrDataIndex>=0); - } - - SIMD_FORCE_INLINE int getEscapeIndex() const - { - //btAssert(m_escapeIndexOrDataIndex < 0); - return -m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setEscapeIndex(int index) - { - m_escapeIndexOrDataIndex = -index; - } - - SIMD_FORCE_INLINE int getDataIndex() const - { - //btAssert(m_escapeIndexOrDataIndex >= 0); - - return m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setDataIndex(int index) - { - m_escapeIndexOrDataIndex = index; - } - - SIMD_FORCE_INLINE bool testQuantizedBoxOverlapp( - unsigned short * quantizedMin,unsigned short * quantizedMax) const - { - if(m_quantizedAabbMin[0] > quantizedMax[0] || - m_quantizedAabbMax[0] < quantizedMin[0] || - m_quantizedAabbMin[1] > quantizedMax[1] || - m_quantizedAabbMax[1] < quantizedMin[1] || - m_quantizedAabbMin[2] > quantizedMax[2] || - m_quantizedAabbMax[2] < quantizedMin[2]) - { - return false; - } - return true; - } - -}; - - +#include "btGImpactQuantizedBvhStructs.h" class GIM_QUANTIZED_BVH_NODE_ARRAY:public btAlignedObjectArray { @@ -368,5 +302,4 @@ public: btPairSet & collision_pairs); }; - #endif // GIM_BOXPRUNING_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h new file mode 100644 index 000000000..7dd5a1b9d --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h @@ -0,0 +1,91 @@ +#ifndef GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED +#define GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED + +/*! \file btGImpactQuantizedBvh.h +\author Francisco Leon Najera +*/ +/* +This source file is part of GIMPACT Library. + +For the latest info, see http://gimpact.sourceforge.net/ + +Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. +email: projectileman@yahoo.com + + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +#include "btGImpactBvh.h" +#include "btQuantization.h" + +///btQuantizedBvhNode is a compressed aabb node, 16 bytes. +///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range). +ATTRIBUTE_ALIGNED16 (struct) BT_QUANTIZED_BVH_NODE +{ + //12 bytes + unsigned short int m_quantizedAabbMin[3]; + unsigned short int m_quantizedAabbMax[3]; + //4 bytes + int m_escapeIndexOrDataIndex; + + BT_QUANTIZED_BVH_NODE() + { + m_escapeIndexOrDataIndex = 0; + } + + SIMD_FORCE_INLINE bool isLeafNode() const + { + //skipindex is negative (internal node), triangleindex >=0 (leafnode) + return (m_escapeIndexOrDataIndex>=0); + } + + SIMD_FORCE_INLINE int getEscapeIndex() const + { + //btAssert(m_escapeIndexOrDataIndex < 0); + return -m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setEscapeIndex(int index) + { + m_escapeIndexOrDataIndex = -index; + } + + SIMD_FORCE_INLINE int getDataIndex() const + { + //btAssert(m_escapeIndexOrDataIndex >= 0); + + return m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setDataIndex(int index) + { + m_escapeIndexOrDataIndex = index; + } + + SIMD_FORCE_INLINE bool testQuantizedBoxOverlapp( + unsigned short * quantizedMin,unsigned short * quantizedMax) const + { + if(m_quantizedAabbMin[0] > quantizedMax[0] || + m_quantizedAabbMax[0] < quantizedMin[0] || + m_quantizedAabbMin[1] > quantizedMax[1] || + m_quantizedAabbMax[1] < quantizedMin[1] || + m_quantizedAabbMin[2] > quantizedMax[2] || + m_quantizedAabbMax[2] < quantizedMin[2]) + { + return false; + } + return true; + } + +}; + +#endif // GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h index 27e6f32fc..cda51a5fc 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h @@ -228,7 +228,7 @@ public: inline void push_back_memcpy(const T & obj) { this->growingCheck(); - irr_simd_memcpy(&m_data[m_size],&obj,sizeof(T)); + gim_simd_memcpy(&m_data[m_size],&obj,sizeof(T)); m_size++; } diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h index d98051da3..0c48cb60f 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h @@ -41,10 +41,13 @@ email: projectileman@yahoo.com - +#ifndef PLANEDIREPSILON #define PLANEDIREPSILON 0.0000001f -#define PARALELENORMALS 0.000001f +#endif +#ifndef PARALELENORMALS +#define PARALELENORMALS 0.000001f +#endif #define TRIANGLE_NORMAL(v1,v2,v3,n)\ {\ diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h index 9c572638a..a051b4fdb 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h @@ -97,6 +97,8 @@ email: projectileman@yahoo.com // return test_cross_edge_box(edge,absolute_edge,pointa,pointb,extend,1,0,0,1); //} +#ifndef TEST_CROSS_EDGE_BOX_MCR + #define TEST_CROSS_EDGE_BOX_MCR(edge,absolute_edge,pointa,pointb,_extend,i_dir_0,i_dir_1,i_comp_0,i_comp_1)\ {\ const btScalar dir0 = -edge[i_dir_0];\ @@ -113,6 +115,7 @@ email: projectileman@yahoo.com if(pmin>rad || -rad>pmax) return false;\ }\ +#endif #define TEST_CROSS_EDGE_BOX_X_AXIS_MCR(edge,absolute_edge,pointa,pointb,_extend)\ {\ @@ -190,8 +193,9 @@ public: } }; - +#ifndef BOX_PLANE_EPSILON #define BOX_PLANE_EPSILON 0.000001f +#endif //! Axis aligned box class GIM_AABB @@ -571,7 +575,7 @@ public: } }; - +#ifndef BT_BOX_COLLISION_H_INCLUDED //! Compairison of transformation objects SIMD_FORCE_INLINE bool btCompareTransformsEqual(const btTransform & t1,const btTransform & t2) { @@ -582,6 +586,7 @@ SIMD_FORCE_INLINE bool btCompareTransformsEqual(const btTransform & t1,const btT if(!(t1.getBasis().getRow(2) == t2.getBasis().getRow(2)) ) return false; return true; } +#endif diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h index 5d9f8ef81..b41c714b5 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h @@ -40,8 +40,15 @@ email: projectileman@yahoo.com /** Configuration var for applying interpolation of contact normals */ +#ifndef NORMAL_CONTACT_AVERAGE #define NORMAL_CONTACT_AVERAGE 1 +#endif + +#ifndef CONTACT_DIFF_EPSILON #define CONTACT_DIFF_EPSILON 0.00001f +#endif + +#ifndef BT_CONTACT_H_STRUCTS_INCLUDED /// Structure for collision results ///Functions for managing and sorting contacts resulting from a collision query. @@ -121,6 +128,7 @@ public: }; +#endif class gim_contact_array:public gim_array { diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h index 5b552a1ed..267f806e7 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h @@ -38,8 +38,9 @@ email: projectileman@yahoo.com - +#ifndef MAX_TRI_CLIPPING #define MAX_TRI_CLIPPING 16 +#endif //! Structure for collision struct GIM_TRIANGLE_CONTACT_DATA diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h index 46ce1ab75..0ea7b483c 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h @@ -67,10 +67,12 @@ struct btStorageResult : public btDiscreteCollisionDetectorInterface::Result btVector3 m_closestPointInB; btScalar m_distance; //negative means penetration ! + protected: btStorageResult() : m_distance(btScalar(BT_LARGE_FLOAT)) { - } + + public: virtual ~btStorageResult() {}; virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth) diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h index 04ab54ed9..571ad2c5f 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h @@ -41,6 +41,7 @@ enum btContactPointFlags BT_CONTACT_FLAG_HAS_CONTACT_CFM=2, BT_CONTACT_FLAG_HAS_CONTACT_ERP=4, BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING = 8, + BT_CONTACT_FLAG_FRICTION_ANCHOR = 16, }; /// ManifoldContactPoint collects and maintains persistent contactpoints. diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp index 4d92e853d..23aaece22 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp @@ -21,6 +21,8 @@ subject to the following restrictions: btScalar gContactBreakingThreshold = btScalar(0.02); ContactDestroyedCallback gContactDestroyedCallback = 0; ContactProcessedCallback gContactProcessedCallback = 0; +ContactStartedCallback gContactStartedCallback = 0; +ContactEndedCallback gContactEndedCallback = 0; ///gContactCalcArea3Points will approximate the convex hull area using 3 points ///when setting it to false, it will use 4 points to compute the area: it is more accurate but slower bool gContactCalcArea3Points = true; @@ -279,6 +281,7 @@ void btPersistentManifold::refreshContactPoints(const btTransform& trA,const btT removeContactPoint(i); } else { + //todo: friction anchor may require the contact to be around a bit longer //contact also becomes invalid when relative movement orthogonal to normal exceeds margin projectedPoint = manifoldPoint.m_positionWorldOnA - manifoldPoint.m_normalWorldOnB * manifoldPoint.m_distance1; projectedDifference = manifoldPoint.m_positionWorldOnB - projectedPoint; diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h index d220f2993..f872c8e1c 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h @@ -28,10 +28,18 @@ struct btCollisionResult; ///maximum contact breaking and merging threshold extern btScalar gContactBreakingThreshold; +#ifndef SWIG +class btPersistentManifold; + typedef bool (*ContactDestroyedCallback)(void* userPersistentData); typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,void* body1); +typedef void (*ContactStartedCallback)(btPersistentManifold* const &manifold); +typedef void (*ContactEndedCallback)(btPersistentManifold* const &manifold); extern ContactDestroyedCallback gContactDestroyedCallback; extern ContactProcessedCallback gContactProcessedCallback; +extern ContactStartedCallback gContactStartedCallback; +extern ContactEndedCallback gContactEndedCallback; +#endif //SWIG //the enum starts at 1024 to avoid type conflicts with btTypedConstraint enum btContactManifoldTypes @@ -51,8 +59,8 @@ enum btContactManifoldTypes ///note that some pairs of objects might have more then one contact manifold. -ATTRIBUTE_ALIGNED128( class) btPersistentManifold : public btTypedObject -//ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject +//ATTRIBUTE_ALIGNED128( class) btPersistentManifold : public btTypedObject +ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject { btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]; @@ -171,40 +179,60 @@ public: btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0); m_cachedPoints--; + + if (gContactEndedCallback && m_cachedPoints == 0) + { + gContactEndedCallback(this); + } } - void replaceContactPoint(const btManifoldPoint& newPoint,int insertIndex) + void replaceContactPoint(const btManifoldPoint& newPoint, int insertIndex) { btAssert(validContactDistance(newPoint)); #define MAINTAIN_PERSISTENCY 1 #ifdef MAINTAIN_PERSISTENCY - int lifeTime = m_pointCache[insertIndex].getLifeTime(); - btScalar appliedImpulse = m_pointCache[insertIndex].m_appliedImpulse; - btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].m_appliedImpulseLateral1; - btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].m_appliedImpulseLateral2; -// bool isLateralFrictionInitialized = m_pointCache[insertIndex].m_lateralFrictionInitialized; - - - - btAssert(lifeTime>=0); - void* cache = m_pointCache[insertIndex].m_userPersistentData; - - m_pointCache[insertIndex] = newPoint; - m_pointCache[insertIndex].m_userPersistentData = cache; - m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; - m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1; - m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2; - + int lifeTime = m_pointCache[insertIndex].getLifeTime(); + btScalar appliedImpulse = m_pointCache[insertIndex].m_appliedImpulse; + btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].m_appliedImpulseLateral1; + btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].m_appliedImpulseLateral2; + + bool replacePoint = true; + ///we keep existing contact points for friction anchors + ///if the friction force is within the Coulomb friction cone + if (newPoint.m_contactPointFlags & BT_CONTACT_FLAG_FRICTION_ANCHOR) + { + // printf("appliedImpulse=%f\n", appliedImpulse); + // printf("appliedLateralImpulse1=%f\n", appliedLateralImpulse1); + // printf("appliedLateralImpulse2=%f\n", appliedLateralImpulse2); + // printf("mu = %f\n", m_pointCache[insertIndex].m_combinedFriction); + btScalar mu = m_pointCache[insertIndex].m_combinedFriction; + btScalar eps = 0; //we could allow to enlarge or shrink the tolerance to check against the friction cone a bit, say 1e-7 + btScalar a = appliedLateralImpulse1 * appliedLateralImpulse1 + appliedLateralImpulse2 * appliedLateralImpulse2; + btScalar b = eps + mu * appliedImpulse; + b = b * b; + replacePoint = (a) > (b); + } + + if (replacePoint) + { + btAssert(lifeTime >= 0); + void* cache = m_pointCache[insertIndex].m_userPersistentData; + + m_pointCache[insertIndex] = newPoint; + m_pointCache[insertIndex].m_userPersistentData = cache; + m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; + m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1; + m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2; + } m_pointCache[insertIndex].m_lifeTime = lifeTime; #else clearUserCache(m_pointCache[insertIndex]); m_pointCache[insertIndex] = newPoint; - + #endif } - bool validContactDistance(const btManifoldPoint& pt) const { return pt.m_distance1 <= getContactBreakingThreshold(); @@ -220,6 +248,11 @@ public: { clearUserCache(m_pointCache[i]); } + + if (gContactEndedCallback && m_cachedPoints) + { + gContactEndedCallback(this); + } m_cachedPoints = 0; } diff --git a/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt b/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt index 4023d721e..f8a6f34ba 100644 --- a/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt +++ b/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt @@ -37,6 +37,7 @@ SET(BulletDynamics_SRCS Featherstone/btMultiBodyFixedConstraint.cpp Featherstone/btMultiBodySliderConstraint.cpp Featherstone/btMultiBodyJointMotor.cpp + Featherstone/btMultiBodyGearConstraint.cpp MLCPSolvers/btDantzigLCP.cpp MLCPSolvers/btMLCPSolver.cpp MLCPSolvers/btLemkeAlgorithm.cpp @@ -98,6 +99,7 @@ SET(Featherstone_HDRS Featherstone/btMultiBodyFixedConstraint.h Featherstone/btMultiBodySliderConstraint.h Featherstone/btMultiBodyJointMotor.h + Featherstone/btMultiBodyGearConstraint.h ) SET(MLCPSolvers_HDRS diff --git a/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp index 68fa5206c..cb1aa71a1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp @@ -137,8 +137,6 @@ btKinematicCharacterController::btKinematicCharacterController (btPairCachingGho m_ghostObject = ghostObject; m_up.setValue(0.0f, 0.0f, 1.0f); m_jumpAxis.setValue(0.0f, 0.0f, 1.0f); - setUp(up); - setStepHeight(stepHeight); m_addedMargin = 0.02; m_walkDirection.setValue(0.0,0.0,0.0); m_AngVel.setValue(0.0, 0.0, 0.0); @@ -156,13 +154,16 @@ btKinematicCharacterController::btKinematicCharacterController (btPairCachingGho m_wasOnGround = false; m_wasJumping = false; m_interpolateUp = true; - setMaxSlope(btRadians(45.0)); m_currentStepOffset = 0.0; m_maxPenetrationDepth = 0.2; full_drop = false; bounce_fix = false; m_linearDamping = btScalar(0.0); m_angularDamping = btScalar(0.0); + + setUp(up); + setStepHeight(stepHeight); + setMaxSlope(btRadians(45.0)); } btKinematicCharacterController::~btKinematicCharacterController () @@ -559,7 +560,7 @@ void btKinematicCharacterController::stepDown ( btCollisionWorld* collisionWorld break; } - if (m_ghostObject->hasContactResponse() && (callback.hasHit() && needsCollision(m_ghostObject, callback.m_hitCollisionObject)) || runonce == true) + if ((m_ghostObject->hasContactResponse() && (callback.hasHit() && needsCollision(m_ghostObject, callback.m_hitCollisionObject))) || runonce == true) { // we dropped a fraction of the height -> hit floor btScalar fraction = (m_currentPosition.getY() - callback.m_hitPointWorld.getY()) / 2; @@ -657,7 +658,7 @@ void btKinematicCharacterController::setLinearVelocity(const btVector3& velocity if (c != 0) { //there is a component in walkdirection for vertical velocity - btVector3 upComponent = m_up * (sinf(SIMD_HALF_PI - acosf(c)) * m_walkDirection.length()); + btVector3 upComponent = m_up * (btSin(SIMD_HALF_PI - btAcos(c)) * m_walkDirection.length()); m_walkDirection -= upComponent; m_verticalVelocity = (c < 0.0f ? -1 : 1) * upComponent.length(); @@ -751,7 +752,7 @@ void btKinematicCharacterController::playerStep ( btCollisionWorld* collisionWo m_wasOnGround = onGround(); //btVector3 lvel = m_walkDirection; - btScalar c = 0.0f; + //btScalar c = 0.0f; if (m_walkDirection.length2() > 0) { diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp index 09b7388b6..0572256f7 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp @@ -642,7 +642,7 @@ void btConeTwistConstraint::calcAngleInfo2(const btTransform& transA, const btTr btTransform trDeltaAB = trB * trPose * trA.inverse(); btQuaternion qDeltaAB = trDeltaAB.getRotation(); btVector3 swingAxis = btVector3(qDeltaAB.x(), qDeltaAB.y(), qDeltaAB.z()); - float swingAxisLen2 = swingAxis.length2(); + btScalar swingAxisLen2 = swingAxis.length2(); if(btFuzzyZero(swingAxisLen2)) { return; @@ -903,7 +903,7 @@ btVector3 btConeTwistConstraint::GetPointForAngle(btScalar fAngleInRadians, btSc // a^2 b^2 // Do the math and it should be clear. - float swingLimit = m_swingSpan1; // if xEllipse == 0, just use axis b (1) + btScalar swingLimit = m_swingSpan1; // if xEllipse == 0, just use axis b (1) if (fabs(xEllipse) > SIMD_EPSILON) { btScalar surfaceSlope2 = (yEllipse*yEllipse)/(xEllipse*xEllipse); diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h index b7636180c..7a33d01d1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h @@ -260,7 +260,7 @@ public: inline int getSolveSwingLimit() { - return m_solveTwistLimit; + return m_solveSwingLimit; } inline btScalar getTwistLimitSign() diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h index 477c79d17..adb226835 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h @@ -28,11 +28,13 @@ protected: btPersistentManifold m_contactManifold; -public: +protected: btContactConstraint(btPersistentManifold* contactManifold,btRigidBody& rbA,btRigidBody& rbB); +public: + void setContactManifold(btPersistentManifold* contactManifold); btPersistentManifold* getContactManifold() diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h index 739b066fe..28d0c1dd4 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h @@ -43,10 +43,13 @@ struct btContactSolverInfoData btScalar m_restitution; int m_numIterations; btScalar m_maxErrorReduction; - btScalar m_sor; - btScalar m_erp;//used as Baumgarte factor - btScalar m_erp2;//used in Split Impulse - btScalar m_globalCfm;//constraint force mixing + btScalar m_sor;//successive over-relaxation term + btScalar m_erp;//error reduction for non-contact constraints + btScalar m_erp2;//error reduction for contact constraints + btScalar m_globalCfm;//constraint force mixing for contacts and non-contacts + btScalar m_frictionERP;//error reduction for friction constraints + btScalar m_frictionCFM;//constraint force mixing for friction constraints + int m_splitImpulse; btScalar m_splitImpulsePenetrationThreshold; btScalar m_splitImpulseTurnErp; @@ -59,6 +62,7 @@ struct btContactSolverInfoData btScalar m_maxGyroscopicForce; btScalar m_singleAxisRollingFrictionThreshold; btScalar m_leastSquaresResidualThreshold; + btScalar m_restitutionVelocityThreshold; }; @@ -79,6 +83,8 @@ struct btContactSolverInfo : public btContactSolverInfoData m_erp = btScalar(0.2); m_erp2 = btScalar(0.2); m_globalCfm = btScalar(0.); + m_frictionERP = btScalar(0.2);//positional friction 'anchors' are disabled by default + m_frictionCFM = btScalar(0.); m_sor = btScalar(1.); m_splitImpulse = true; m_splitImpulsePenetrationThreshold = -.04f; @@ -92,6 +98,7 @@ struct btContactSolverInfo : public btContactSolverInfoData m_maxGyroscopicForce = 100.f; ///it is only used for 'explicit' version of gyroscopic force m_singleAxisRollingFrictionThreshold = 1e30f;///if the velocity is above this threshold, it will use a single constraint row (axis), otherwise 3 rows. m_leastSquaresResidualThreshold = 0.f; + m_restitutionVelocityThreshold = 0.2f;//if the relative velocity is below this threshold, there is zero restitution } }; diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h index f9afcb912..e4613455a 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h @@ -141,6 +141,14 @@ SIMD_FORCE_INLINE const char* btGearConstraint::serialize(void* dataBuffer, btSe gear->m_ratio = m_ratio; + // Fill padding with zeros to appease msan. +#ifndef BT_USE_DOUBLE_PRECISION + gear->m_padding[0] = 0; + gear->m_padding[1] = 0; + gear->m_padding[2] = 0; + gear->m_padding[3] = 0; +#endif + return btGearConstraintDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp index bc2b5a85d..fa17254ec 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp @@ -776,7 +776,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2( btConstraintInfo2 *info, int row, btVector3& ax1, int rotational,int rotAllowed) { int srow = row * info->rowskip; - int powered = limot->m_enableMotor; + bool powered = limot->m_enableMotor; int limit = limot->m_currentLimit; if (powered || limit) { // if the joint is powered, or has joint limits, add in the extra row @@ -840,7 +840,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2( } // if we're limited low and high simultaneously, the joint motor is // ineffective - if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = 0; + if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = false; info->m_constraintError[srow] = btScalar(0.f); if (powered) { diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp index 49ff78c26..f0976ee49 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp @@ -729,6 +729,21 @@ int btGeneric6DofSpring2Constraint::get_limit_motor_info2( if (limot->m_enableMotor && limot->m_servoMotor) { btScalar error = limot->m_currentPosition - limot->m_servoTarget; + btScalar curServoTarget = limot->m_servoTarget; + if (rotational) + { + if (error > SIMD_PI) + { + error -= SIMD_2_PI; + curServoTarget +=SIMD_2_PI; + } + if (error < -SIMD_PI) + { + error += SIMD_2_PI; + curServoTarget -=SIMD_2_PI; + } + } + calculateJacobi(limot,transA,transB,info,srow,ax1,rotational,rotAllowed); btScalar targetvelocity = error<0 ? -limot->m_targetVelocity : limot->m_targetVelocity; btScalar tag_vel = -targetvelocity; @@ -739,13 +754,13 @@ int btGeneric6DofSpring2Constraint::get_limit_motor_info2( btScalar hiLimit; if(limot->m_loLimit > limot->m_hiLimit) { - lowLimit = error > 0 ? limot->m_servoTarget : -SIMD_INFINITY; - hiLimit = error < 0 ? limot->m_servoTarget : SIMD_INFINITY; + lowLimit = error > 0 ? curServoTarget : -SIMD_INFINITY; + hiLimit = error < 0 ? curServoTarget : SIMD_INFINITY; } else { - lowLimit = error > 0 && limot->m_servoTarget>limot->m_loLimit ? limot->m_servoTarget : limot->m_loLimit; - hiLimit = error < 0 && limot->m_servoTargetm_hiLimit ? limot->m_servoTarget : limot->m_hiLimit; + lowLimit = error > 0 && curServoTarget>limot->m_loLimit ? curServoTarget : limot->m_loLimit; + hiLimit = error < 0 && curServoTargetm_hiLimit ? curServoTarget : limot->m_hiLimit; } mot_fact = getMotorFactor(limot->m_currentPosition, lowLimit, hiLimit, tag_vel, info->fps * limot->m_motorERP); } @@ -998,13 +1013,49 @@ void btGeneric6DofSpring2Constraint::setTargetVelocity(int index, btScalar veloc m_angularLimits[index - 3].m_targetVelocity = velocity; } -void btGeneric6DofSpring2Constraint::setServoTarget(int index, btScalar target) + + +void btGeneric6DofSpring2Constraint::setServoTarget(int index, btScalar targetOrg) { btAssert((index >= 0) && (index < 6)); if (index<3) - m_linearLimits.m_servoTarget[index] = target; + { + m_linearLimits.m_servoTarget[index] = targetOrg; + } else + { + //wrap between -PI and PI, see also + //https://stackoverflow.com/questions/4633177/c-how-to-wrap-a-float-to-the-interval-pi-pi + + btScalar target = targetOrg+SIMD_PI; + if (1) + { + btScalar m = target - SIMD_2_PI * floor(target/SIMD_2_PI); + // handle boundary cases resulted from floating-point cut off: + { + if (m>=SIMD_2_PI) + { + target = 0; + } else + { + if (m<0 ) + { + if (SIMD_2_PI+m == SIMD_2_PI) + target = 0; + else + target = SIMD_2_PI+m; + } + else + { + target = m; + } + } + } + target -= SIMD_PI; + } + m_angularLimits[index - 3].m_servoTarget = target; + } } void btGeneric6DofSpring2Constraint::setMaxMotorForce(int index, btScalar force) diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h index 193e51e3b..66d176958 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h @@ -664,6 +664,11 @@ SIMD_FORCE_INLINE const char* btGeneric6DofSpring2Constraint::serialize(void* da dof->m_rotateOrder = m_rotateOrder; + dof->m_padding1[0] = 0; + dof->m_padding1[1] = 0; + dof->m_padding1[2] = 0; + dof->m_padding1[3] = 0; + return btGeneric6DofSpring2ConstraintDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp index 76a150947..7e5e6f9e5 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp @@ -556,12 +556,8 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf } // if the hinge has joint limits or motor, add in the extra row - int powered = 0; - if(getEnableAngularMotor()) - { - powered = 1; - } - if(limit || powered) + bool powered = getEnableAngularMotor(); + if(limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -577,7 +573,7 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf btScalar histop = getUpperLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } info->m_constraintError[srow] = btScalar(0.0f); btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp; @@ -951,12 +947,8 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info } // if the hinge has joint limits or motor, add in the extra row - int powered = 0; - if(getEnableAngularMotor()) - { - powered = 1; - } - if(limit || powered) + bool powered = getEnableAngularMotor(); + if(limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -972,7 +964,7 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info btScalar histop = getUpperLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } info->m_constraintError[srow] = btScalar(0.0f); btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp; diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h index f26e72105..3c3df24db 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h @@ -314,7 +314,7 @@ public: { return m_enableAngularMotor; } - inline btScalar getMotorTargetVelosity() + inline btScalar getMotorTargetVelocity() { return m_motorTargetVelocity; } @@ -489,6 +489,14 @@ SIMD_FORCE_INLINE const char* btHingeConstraint::serialize(void* dataBuffer, btS hingeData->m_relaxationFactor = float(m_relaxationFactor); #endif + // Fill padding with zeros to appease msan. +#ifdef BT_USE_DOUBLE_PRECISION + hingeData->m_padding1[0] = 0; + hingeData->m_padding1[1] = 0; + hingeData->m_padding1[2] = 0; + hingeData->m_padding1[3] = 0; +#endif + return btHingeConstraintDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp index f110cd480..f3979be35 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp @@ -78,20 +78,6 @@ btScalar btNNCGConstraintSolver::solveSingleIteration(int iteration, btCollision btScalar deltaflengthsqr = 0; - - if (infoGlobal.m_solverMode & SOLVER_SIMD) - { - for (int j=0;jisEnabled()) - { - int bodyAid = getOrInitSolverBody(constraints[j]->getRigidBodyA(),infoGlobal.m_timeStep); - int bodyBid = getOrInitSolverBody(constraints[j]->getRigidBodyB(),infoGlobal.m_timeStep); - btSolverBody& bodyA = m_tmpSolverBodyPool[bodyAid]; - btSolverBody& bodyB = m_tmpSolverBodyPool[bodyBid]; - constraints[j]->solveConstraintObsolete(bodyA,bodyB,infoGlobal.m_timeStep); - } - } - ///solve all contact constraints - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - for (int j=0;jbtScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar deltaf = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - m_deltafCF[j] = deltaf; - deltaflengthsqr += deltaf*deltaf; - } else { - m_deltafCF[j] = 0; - } - } - - int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); - for (int j=0;jbtScalar(0)) - { - btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction*totalImpulse; - if (rollingFrictionMagnitude>rollingFrictionConstraint.m_friction) - rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - - rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; - rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; - - btScalar deltaf = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); - m_deltafCRF[j] = deltaf; - deltaflengthsqr += deltaf*deltaf; - } else { - m_deltafCRF[j] = 0; - } - } - } } @@ -362,10 +278,7 @@ btScalar btNNCGConstraintSolver::solveSingleIteration(int iteration, btCollision for (int j=0;jgetWorldTransform().getOrigin(); rel_pos2 = pos2 - colObj1->getWorldTransform().getOrigin(); - btVector3 vel1;// = rb0 ? rb0->getVelocityInLocalPoint(rel_pos1) : btVector3(0,0,0); - btVector3 vel2;// = rb1 ? rb1->getVelocityInLocalPoint(rel_pos2) : btVector3(0,0,0); - + btVector3 vel1; + btVector3 vel2; + solverBodyA->getVelocityInLocalPointNoDelta(rel_pos1,vel1); solverBodyB->getVelocityInLocalPointNoDelta(rel_pos2,vel2 ); @@ -1126,8 +1140,6 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m -// const btVector3& pos1 = cp.getPositionWorldOnA(); -// const btVector3& pos2 = cp.getPositionWorldOnB(); /////setup the friction constraints @@ -1172,6 +1184,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m ///In that case, you can set the target relative motion in each friction direction (cp.m_contactMotion1 and cp.m_contactMotion2) ///this will give a conveyor belt effect /// + if (!(infoGlobal.m_solverMode & SOLVER_ENABLE_FRICTION_DIRECTION_CACHING) || !(cp.m_contactPointFlags&BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED)) { cp.m_lateralFrictionDir1 = vel - cp.m_normalWorldOnB * rel_vel; @@ -1181,7 +1194,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m cp.m_lateralFrictionDir1 *= 1.f/btSqrt(lat_rel_vel); applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation,infoGlobal); if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { @@ -1189,7 +1202,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m cp.m_lateralFrictionDir2.normalize();//?? applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal); } } else @@ -1198,13 +1211,13 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal); if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal); } @@ -1216,10 +1229,10 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m } else { - addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation,cp.m_contactMotion1, cp.m_frictionCFM); + addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal, cp.m_contactMotion1, cp.m_frictionCFM); if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) - addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, cp.m_contactMotion2, cp.m_frictionCFM); + addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal, cp.m_contactMotion2, cp.m_frictionCFM); } setFrictionConstraintImpulse( solverConstraint, solverBodyIdA, solverBodyIdB, cp, infoGlobal); @@ -1251,6 +1264,14 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol BT_PROFILE("solveGroupCacheFriendlySetup"); (void)debugDrawer; + // if solver mode has changed, + if ( infoGlobal.m_solverMode != m_cachedSolverMode ) + { + // update solver functions to use SIMD or non-SIMD + bool useSimd = !!( infoGlobal.m_solverMode & SOLVER_SIMD ); + setupSolverFunctions( useSimd ); + m_cachedSolverMode = infoGlobal.m_solverMode; + } m_maxOverrideNumSolverIterations = 0; #ifdef BT_ADDITIONAL_DEBUG @@ -1530,7 +1551,8 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol sum += iMJaB.dot(solverConstraint.m_relpos2CrossNormal); btScalar fsum = btFabs(sum); btAssert(fsum > SIMD_EPSILON); - solverConstraint.m_jacDiagABInv = fsum>SIMD_EPSILON?btScalar(1.)/sum : 0.f; + btScalar sorRelaxation = 1.f;//todo: get from globalInfo? + solverConstraint.m_jacDiagABInv = fsum>SIMD_EPSILON?sorRelaxation/sum : 0.f; } @@ -1646,145 +1668,6 @@ btScalar btSequentialImpulseConstraintSolver::solveSingleIteration(int iteration } } - if (infoGlobal.m_solverMode & SOLVER_SIMD) - { - ///solve all joint constraints, using SIMD, if available - for (int j=0;jisEnabled()) - { - int bodyAid = getOrInitSolverBody(constraints[j]->getRigidBodyA(),infoGlobal.m_timeStep); - int bodyBid = getOrInitSolverBody(constraints[j]->getRigidBodyB(),infoGlobal.m_timeStep); - btSolverBody& bodyA = m_tmpSolverBodyPool[bodyAid]; - btSolverBody& bodyB = m_tmpSolverBodyPool[bodyBid]; - constraints[j]->solveConstraintObsolete(bodyA,bodyB,infoGlobal.m_timeStep); - } - } - - ///solve all contact constraints using SIMD, if available - if (infoGlobal.m_solverMode & SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS) - { - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - int multiplier = (infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)? 2 : 1; - - for (int c=0;cbtScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - leastSquaresResidual += residual*residual; - } - } - - if (infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS) - { - - btSolverConstraint& solveManifold = m_tmpSolverContactFrictionConstraintPool[m_orderFrictionConstraintPool[c*multiplier+1]]; - - if (totalImpulse>btScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - leastSquaresResidual += residual*residual; - } - } - } - } - - } - else//SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS - { - //solve the friction constraints after all contact constraints, don't interleave them - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - int j; - - for (j=0;jbtScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - leastSquaresResidual += residual*residual; - } - } - - - int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); - for (j=0;jbtScalar(0)) - { - btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction*totalImpulse; - if (rollingFrictionMagnitude>rollingFrictionConstraint.m_friction) - rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - - rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; - rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); - leastSquaresResidual += residual*residual; - } - } - - - } - } - } else - { - //non-SIMD version ///solve all joint constraints for (int j=0;jsolveConstraintObsolete(bodyA,bodyB,infoGlobal.m_timeStep); } } + ///solve all contact constraints - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - for (int j=0;jbtScalar(0)) + for (int c=0;cbtScalar(0)) + { + solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); + solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); + leastSquaresResidual += residual*residual; + } + } + + if (infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS) + { + + btSolverConstraint& solveManifold = m_tmpSolverContactFrictionConstraintPool[m_orderFrictionConstraintPool[c*multiplier+1]]; + + if (totalImpulse>btScalar(0)) + { + solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); + solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); + leastSquaresResidual += residual*residual; + } + } + } + } + + } + else//SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS + { + //solve the friction constraints after all contact constraints, don't interleave them + int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); + int j; + + for (j=0;jbtScalar(0)) + { + solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); + solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); + leastSquaresResidual += residual*residual; + } + } } - int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); - for (int j=0;jbtScalar(0)) + + int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); + for (int j=0;jrollingFrictionConstraint.m_friction) - rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; - rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; + btSolverConstraint& rollingFrictionConstraint = m_tmpSolverContactRollingFrictionConstraintPool[j]; + btScalar totalImpulse = m_tmpSolverContactConstraintPool[rollingFrictionConstraint.m_frictionIndex].m_appliedImpulse; + if (totalImpulse>btScalar(0)) + { + btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction*totalImpulse; + if (rollingFrictionMagnitude>rollingFrictionConstraint.m_friction) + rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); - leastSquaresResidual += residual*residual; + rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; + rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); + leastSquaresResidual += residual*residual; + } } - } + + } - } return leastSquaresResidual; } @@ -1863,7 +1811,6 @@ void btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIte int iteration; if (infoGlobal.m_splitImpulse) { - if (infoGlobal.m_solverMode & SOLVER_SIMD) { for ( iteration = 0;iteration=(infoGlobal.m_numIterations-1)) - { -#ifdef VERBOSE_RESIDUAL_PRINTF - printf("residual = %f at iteration #%d\n",leastSquaresResidual,iteration); -#endif - break; - } - } - } - } + } } } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h index 0dd31d142..16c7eb74c 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h @@ -56,12 +56,16 @@ protected: btSingleConstraintRowSolver m_resolveSingleConstraintRowGeneric; btSingleConstraintRowSolver m_resolveSingleConstraintRowLowerLimit; + btSingleConstraintRowSolver m_resolveSplitPenetrationImpulse; + int m_cachedSolverMode; // used to check if SOLVER_SIMD flag has been changed + void setupSolverFunctions( bool useSimd ); btScalar m_leastSquaresResidual; void setupFrictionConstraint( btSolverConstraint& solverConstraint, const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB, btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2, btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, + const btContactSolverInfo& infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.); void setupTorsionalFrictionConstraint( btSolverConstraint& solverConstraint, const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB, @@ -69,7 +73,7 @@ protected: btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity=0., btScalar cfmSlip=0.); - btSolverConstraint& addFrictionConstraint(const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity=0., btScalar cfmSlip=0.); + btSolverConstraint& addFrictionConstraint(const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, const btContactSolverInfo& infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.); btSolverConstraint& addTorsionalFrictionConstraint(const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint& cp,btScalar torsionalFriction, const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity=0, btScalar cfmSlip=0.f); @@ -85,20 +89,22 @@ protected: unsigned long m_btSeed2; - btScalar restitutionCurve(btScalar rel_vel, btScalar restitution); + btScalar restitutionCurve(btScalar rel_vel, btScalar restitution, btScalar velocityThreshold); virtual void convertContacts(btPersistentManifold** manifoldPtr, int numManifolds, const btContactSolverInfo& infoGlobal); void convertContact(btPersistentManifold* manifold,const btContactSolverInfo& infoGlobal); - btSimdScalar resolveSplitPenetrationSIMD( - btSolverBody& bodyA,btSolverBody& bodyB, - const btSolverConstraint& contactConstraint); + btSimdScalar resolveSplitPenetrationSIMD(btSolverBody& bodyA,btSolverBody& bodyB, const btSolverConstraint& contactConstraint) + { + return m_resolveSplitPenetrationImpulse( bodyA, bodyB, contactConstraint ); + } - btScalar resolveSplitPenetrationImpulseCacheFriendly( - btSolverBody& bodyA,btSolverBody& bodyB, - const btSolverConstraint& contactConstraint); + btSimdScalar resolveSplitPenetrationImpulseCacheFriendly(btSolverBody& bodyA,btSolverBody& bodyB, const btSolverConstraint& contactConstraint) + { + return m_resolveSplitPenetrationImpulse( bodyA, bodyB, contactConstraint ); + } //internal method int getOrInitSolverBody(btCollisionObject& body,btScalar timeStep); @@ -108,6 +114,10 @@ protected: btSimdScalar resolveSingleConstraintRowGenericSIMD(btSolverBody& bodyA,btSolverBody& bodyB,const btSolverConstraint& contactConstraint); btSimdScalar resolveSingleConstraintRowLowerLimit(btSolverBody& bodyA,btSolverBody& bodyB,const btSolverConstraint& contactConstraint); btSimdScalar resolveSingleConstraintRowLowerLimitSIMD(btSolverBody& bodyA,btSolverBody& bodyB,const btSolverConstraint& contactConstraint); + btSimdScalar resolveSplitPenetrationImpulse(btSolverBody& bodyA,btSolverBody& bodyB, const btSolverConstraint& contactConstraint) + { + return m_resolveSplitPenetrationImpulse( bodyA, bodyB, contactConstraint ); + } protected: diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp index f8f81bfe6..d63cef031 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp @@ -364,7 +364,6 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra int srow; btScalar limit_err; int limit; - int powered; // next two rows. // we want: velA + wA x relA == velB + wB x relB ... but this would @@ -470,13 +469,9 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra limit_err = getLinDepth() * signFact; limit = (limit_err > btScalar(0.0)) ? 2 : 1; } - powered = 0; - if(getPoweredLinMotor()) - { - powered = 1; - } + bool powered = getPoweredLinMotor(); // if the slider has joint limits or motor, add in the extra row - if (limit || powered) + if (limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -524,7 +519,7 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra btScalar histop = getUpperLinLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } info->m_constraintError[srow] = 0.; info->m_lowerLimit[srow] = 0.; @@ -609,12 +604,8 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra limit = (limit_err > btScalar(0.0)) ? 1 : 2; } // if the slider has joint limits, add in the extra row - powered = 0; - if(getPoweredAngMotor()) - { - powered = 1; - } - if(limit || powered) + powered = getPoweredAngMotor(); + if(limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -630,7 +621,7 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra btScalar histop = getUpperAngLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } currERP = (m_flags & BT_SLIDER_FLAGS_ERP_LIMANG) ? m_softnessLimAng : info->erp; if(powered) diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp index 736a64a1c..9f04f2805 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp @@ -19,7 +19,7 @@ subject to the following restrictions: #include "LinearMath/btSerializer.h" -#define DEFAULT_DEBUGDRAW_SIZE btScalar(0.3f) +#define DEFAULT_DEBUGDRAW_SIZE btScalar(0.05f) btTypedConstraint::btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA) :btTypedObject(type), diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp index 808f2720c..fc85b4f86 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp @@ -374,7 +374,7 @@ void btDiscreteDynamicsWorld::synchronizeSingleMotionState(btRigidBody* body) void btDiscreteDynamicsWorld::synchronizeMotionStates() { - BT_PROFILE("synchronizeMotionStates"); +// BT_PROFILE("synchronizeMotionStates"); if (m_synchronizeAllMotionStates) { //iterate over all collision objects @@ -402,7 +402,6 @@ int btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, { startProfiling(timeStep); - BT_PROFILE("stepSimulation"); int numSimulationSubSteps = 0; @@ -539,7 +538,7 @@ btVector3 btDiscreteDynamicsWorld::getGravity () const return m_gravity; } -void btDiscreteDynamicsWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) +void btDiscreteDynamicsWorld::addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup, int collisionFilterMask) { btCollisionWorld::addCollisionObject(collisionObject,collisionFilterGroup,collisionFilterMask); } @@ -578,14 +577,14 @@ void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body) } bool isDynamic = !(body->isStaticObject() || body->isKinematicObject()); - short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); - short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); + int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter); + int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); addCollisionObject(body,collisionFilterGroup,collisionFilterMask); } } -void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body, short group, short mask) +void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body, int group, int mask) { if (!body->isStaticOrKinematicObject() && !(body->getFlags() &BT_DISABLE_WORLD_GRAVITY)) { @@ -1512,6 +1511,9 @@ void btDiscreteDynamicsWorld::serializeDynamicsWorldInfo(btSerializer* serialize worldInfo->m_solverInfo.m_splitImpulse = getSolverInfo().m_splitImpulse; + // Fill padding with zeros to appease msan. + memset(worldInfo->m_solverInfo.m_padding, 0, sizeof(worldInfo->m_solverInfo.m_padding)); + #ifdef BT_USE_DOUBLE_PRECISION const char* structType = "btDynamicsWorldDoubleData"; #else//BT_USE_DOUBLE_PRECISION diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h index d2789cc6b..b0d19f48a 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h @@ -144,11 +144,11 @@ public: virtual btVector3 getGravity () const; - virtual void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=btBroadphaseProxy::StaticFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); + virtual void addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup=btBroadphaseProxy::StaticFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); virtual void addRigidBody(btRigidBody* body); - virtual void addRigidBody(btRigidBody* body, short group, short mask); + virtual void addRigidBody(btRigidBody* body, int group, int mask); virtual void removeRigidBody(btRigidBody* body); diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp index 5e51a994c..1d10bad92 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp @@ -108,8 +108,108 @@ struct InplaceSolverIslandCallbackMt : public btSimulationIslandManagerMt::Islan }; +/// +/// btConstraintSolverPoolMt +/// -btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration) +btConstraintSolverPoolMt::ThreadSolver* btConstraintSolverPoolMt::getAndLockThreadSolver() +{ + int i = 0; +#if BT_THREADSAFE + i = btGetCurrentThreadIndex() % m_solvers.size(); +#endif // #if BT_THREADSAFE + while ( true ) + { + ThreadSolver& solver = m_solvers[ i ]; + if ( solver.mutex.tryLock() ) + { + return &solver; + } + // failed, try the next one + i = ( i + 1 ) % m_solvers.size(); + } + return NULL; +} + +void btConstraintSolverPoolMt::init( btConstraintSolver** solvers, int numSolvers ) +{ + m_solverType = BT_SEQUENTIAL_IMPULSE_SOLVER; + m_solvers.resize( numSolvers ); + for ( int i = 0; i < numSolvers; ++i ) + { + m_solvers[ i ].solver = solvers[ i ]; + } + if ( numSolvers > 0 ) + { + m_solverType = solvers[ 0 ]->getSolverType(); + } +} + +// create the solvers for me +btConstraintSolverPoolMt::btConstraintSolverPoolMt( int numSolvers ) +{ + btAlignedObjectArray solvers; + solvers.reserve( numSolvers ); + for ( int i = 0; i < numSolvers; ++i ) + { + btConstraintSolver* solver = new btSequentialImpulseConstraintSolver(); + solvers.push_back( solver ); + } + init( &solvers[ 0 ], numSolvers ); +} + +// pass in fully constructed solvers (destructor will delete them) +btConstraintSolverPoolMt::btConstraintSolverPoolMt( btConstraintSolver** solvers, int numSolvers ) +{ + init( solvers, numSolvers ); +} + +btConstraintSolverPoolMt::~btConstraintSolverPoolMt() +{ + // delete all solvers + for ( int i = 0; i < m_solvers.size(); ++i ) + { + ThreadSolver& solver = m_solvers[ i ]; + delete solver.solver; + solver.solver = NULL; + } +} + +///solve a group of constraints +btScalar btConstraintSolverPoolMt::solveGroup( btCollisionObject** bodies, + int numBodies, + btPersistentManifold** manifolds, + int numManifolds, + btTypedConstraint** constraints, + int numConstraints, + const btContactSolverInfo& info, + btIDebugDraw* debugDrawer, + btDispatcher* dispatcher +) +{ + ThreadSolver* ts = getAndLockThreadSolver(); + ts->solver->solveGroup( bodies, numBodies, manifolds, numManifolds, constraints, numConstraints, info, debugDrawer, dispatcher ); + ts->mutex.unlock(); + return 0.0f; +} + +void btConstraintSolverPoolMt::reset() +{ + for ( int i = 0; i < m_solvers.size(); ++i ) + { + ThreadSolver& solver = m_solvers[ i ]; + solver.mutex.lock(); + solver.solver->reset(); + solver.mutex.unlock(); + } +} + + +/// +/// btDiscreteDynamicsWorldMt +/// + +btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher, btBroadphaseInterface* pairCache, btConstraintSolverPoolMt* constraintSolver, btCollisionConfiguration* collisionConfiguration) : btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration) { if (m_ownsIslandManager) @@ -124,8 +224,8 @@ btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,bt { void* mem = btAlignedAlloc(sizeof(btSimulationIslandManagerMt),16); btSimulationIslandManagerMt* im = new (mem) btSimulationIslandManagerMt(); - m_islandManager = im; im->setMinimumSolverBatchSize( m_solverInfo.m_minimumSolverBatchSize ); + m_islandManager = im; } } @@ -145,7 +245,7 @@ btDiscreteDynamicsWorldMt::~btDiscreteDynamicsWorldMt() } -void btDiscreteDynamicsWorldMt::solveConstraints(btContactSolverInfo& solverInfo) +void btDiscreteDynamicsWorldMt::solveConstraints(btContactSolverInfo& solverInfo) { BT_PROFILE("solveConstraints"); @@ -160,3 +260,68 @@ void btDiscreteDynamicsWorldMt::solveConstraints(btContactSolverInfo& solverInfo } +struct UpdaterUnconstrainedMotion : public btIParallelForBody +{ + btScalar timeStep; + btRigidBody** rigidBodies; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + for ( int i = iBegin; i < iEnd; ++i ) + { + btRigidBody* body = rigidBodies[ i ]; + if ( !body->isStaticOrKinematicObject() ) + { + //don't integrate/update velocities here, it happens in the constraint solver + body->applyDamping( timeStep ); + body->predictIntegratedTransform( timeStep, body->getInterpolationWorldTransform() ); + } + } + } +}; + + +void btDiscreteDynamicsWorldMt::predictUnconstraintMotion( btScalar timeStep ) +{ + BT_PROFILE( "predictUnconstraintMotion" ); + if ( m_nonStaticRigidBodies.size() > 0 ) + { + UpdaterUnconstrainedMotion update; + update.timeStep = timeStep; + update.rigidBodies = &m_nonStaticRigidBodies[ 0 ]; + int grainSize = 50; // num of iterations per task for task scheduler + btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update ); + } +} + + +void btDiscreteDynamicsWorldMt::createPredictiveContacts( btScalar timeStep ) +{ + BT_PROFILE( "createPredictiveContacts" ); + releasePredictiveContacts(); + if ( m_nonStaticRigidBodies.size() > 0 ) + { + UpdaterCreatePredictiveContacts update; + update.world = this; + update.timeStep = timeStep; + update.rigidBodies = &m_nonStaticRigidBodies[ 0 ]; + int grainSize = 50; // num of iterations per task for task scheduler + btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update ); + } +} + + +void btDiscreteDynamicsWorldMt::integrateTransforms( btScalar timeStep ) +{ + BT_PROFILE( "integrateTransforms" ); + if ( m_nonStaticRigidBodies.size() > 0 ) + { + UpdaterIntegrateTransforms update; + update.world = this; + update.timeStep = timeStep; + update.rigidBodies = &m_nonStaticRigidBodies[ 0 ]; + int grainSize = 50; // num of iterations per task for task scheduler + btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update ); + } +} + diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h index b28371b51..2f144cdda 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h @@ -18,24 +18,116 @@ subject to the following restrictions: #define BT_DISCRETE_DYNAMICS_WORLD_MT_H #include "btDiscreteDynamicsWorld.h" +#include "btSimulationIslandManagerMt.h" +#include "BulletDynamics/ConstraintSolver/btConstraintSolver.h" struct InplaceSolverIslandCallbackMt; +/// +/// btConstraintSolverPoolMt - masquerades as a constraint solver, but really it is a threadsafe pool of them. +/// +/// Each solver in the pool is protected by a mutex. When solveGroup is called from a thread, +/// the pool looks for a solver that isn't being used by another thread, locks it, and dispatches the +/// call to the solver. +/// So long as there are at least as many solvers as there are hardware threads, it should never need to +/// spin wait. +/// +class btConstraintSolverPoolMt : public btConstraintSolver +{ +public: + // create the solvers for me + explicit btConstraintSolverPoolMt( int numSolvers ); + + // pass in fully constructed solvers (destructor will delete them) + btConstraintSolverPoolMt( btConstraintSolver** solvers, int numSolvers ); + + virtual ~btConstraintSolverPoolMt(); + + ///solve a group of constraints + virtual btScalar solveGroup( btCollisionObject** bodies, + int numBodies, + btPersistentManifold** manifolds, + int numManifolds, + btTypedConstraint** constraints, + int numConstraints, + const btContactSolverInfo& info, + btIDebugDraw* debugDrawer, + btDispatcher* dispatcher + ) BT_OVERRIDE; + + virtual void reset() BT_OVERRIDE; + virtual btConstraintSolverType getSolverType() const BT_OVERRIDE { return m_solverType; } + +private: + const static size_t kCacheLineSize = 128; + struct ThreadSolver + { + btConstraintSolver* solver; + btSpinMutex mutex; + char _cachelinePadding[ kCacheLineSize - sizeof( btSpinMutex ) - sizeof( void* ) ]; // keep mutexes from sharing a cache line + }; + btAlignedObjectArray m_solvers; + btConstraintSolverType m_solverType; + + ThreadSolver* getAndLockThreadSolver(); + void init( btConstraintSolver** solvers, int numSolvers ); +}; + + + /// /// btDiscreteDynamicsWorldMt -- a version of DiscreteDynamicsWorld with some minor changes to support /// solving simulation islands on multiple threads. /// +/// Should function exactly like btDiscreteDynamicsWorld. +/// Also 3 methods that iterate over all of the rigidbodies can run in parallel: +/// - predictUnconstraintMotion +/// - integrateTransforms +/// - createPredictiveContacts +/// ATTRIBUTE_ALIGNED16(class) btDiscreteDynamicsWorldMt : public btDiscreteDynamicsWorld { protected: InplaceSolverIslandCallbackMt* m_solverIslandCallbackMt; - virtual void solveConstraints(btContactSolverInfo& solverInfo); + virtual void solveConstraints(btContactSolverInfo& solverInfo) BT_OVERRIDE; + + virtual void predictUnconstraintMotion( btScalar timeStep ) BT_OVERRIDE; + + struct UpdaterCreatePredictiveContacts : public btIParallelForBody + { + btScalar timeStep; + btRigidBody** rigidBodies; + btDiscreteDynamicsWorldMt* world; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + world->createPredictiveContactsInternal( &rigidBodies[ iBegin ], iEnd - iBegin, timeStep ); + } + }; + virtual void createPredictiveContacts( btScalar timeStep ) BT_OVERRIDE; + + struct UpdaterIntegrateTransforms : public btIParallelForBody + { + btScalar timeStep; + btRigidBody** rigidBodies; + btDiscreteDynamicsWorldMt* world; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + world->integrateTransformsInternal( &rigidBodies[ iBegin ], iEnd - iBegin, timeStep ); + } + }; + virtual void integrateTransforms( btScalar timeStep ) BT_OVERRIDE; public: BT_DECLARE_ALIGNED_ALLOCATOR(); - btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration); + btDiscreteDynamicsWorldMt(btDispatcher* dispatcher, + btBroadphaseInterface* pairCache, + btConstraintSolverPoolMt* constraintSolver, // Note this should be a solver-pool for multi-threading + btCollisionConfiguration* collisionConfiguration + ); virtual ~btDiscreteDynamicsWorldMt(); }; diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h index 4d65f5489..42d8fc0de 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h @@ -89,7 +89,7 @@ public: virtual void addRigidBody(btRigidBody* body) = 0; - virtual void addRigidBody(btRigidBody* body, short group, short mask) = 0; + virtual void addRigidBody(btRigidBody* body, int group, int mask) = 0; virtual void removeRigidBody(btRigidBody* body) = 0; @@ -135,6 +135,11 @@ public: return m_solverInfo; } + const btContactSolverInfo& getSolverInfo() const + { + return m_solverInfo; + } + ///obsolete, use addAction instead. virtual void addVehicle(btActionInterface* vehicle) {(void)vehicle;} diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp index 9402a658c..ca0714fcf 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp @@ -507,6 +507,11 @@ const char* btRigidBody::serialize(void* dataBuffer, class btSerializer* seriali rbd->m_linearSleepingThreshold=m_linearSleepingThreshold; rbd->m_angularSleepingThreshold = m_angularSleepingThreshold; + // Fill padding with zeros to appease msan. +#ifdef BT_USE_DOUBLE_PRECISION + memset(rbd->m_padding, 0, sizeof(rbd->m_padding)); +#endif + return btRigidBodyDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp index 35dd38840..6f63b87c8 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp @@ -155,7 +155,7 @@ void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body) } } -void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body, short group, short mask) +void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body, int group, int mask) { body->setGravity(m_gravity); diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h index d48d2e39c..44b7e7fb3 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h @@ -56,7 +56,7 @@ public: virtual void addRigidBody(btRigidBody* body); - virtual void addRigidBody(btRigidBody* body, short group, short mask); + virtual void addRigidBody(btRigidBody* body, int group, int mask); virtual void removeRigidBody(btRigidBody* body); diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp index ad63b6ee0..99b34353c 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp @@ -15,6 +15,7 @@ subject to the following restrictions: #include "LinearMath/btScalar.h" +#include "LinearMath/btThreads.h" #include "btSimulationIslandManagerMt.h" #include "BulletCollision/BroadphaseCollision/btDispatcher.h" #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" @@ -44,7 +45,7 @@ btSimulationIslandManagerMt::btSimulationIslandManagerMt() { m_minimumSolverBatchSize = calcBatchCost(0, 128, 0); m_batchIslandMinBodyCount = 32; - m_islandDispatch = defaultIslandDispatch; + m_islandDispatch = parallelIslandDispatch; m_batchIsland = NULL; } @@ -545,8 +546,9 @@ void btSimulationIslandManagerMt::mergeIslands() } -void btSimulationIslandManagerMt::defaultIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ) +void btSimulationIslandManagerMt::serialIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ) { + BT_PROFILE( "serialIslandDispatch" ); // serial dispatch btAlignedObjectArray& islands = *islandsPtr; for ( int i = 0; i < islands.size(); ++i ) @@ -565,6 +567,41 @@ void btSimulationIslandManagerMt::defaultIslandDispatch( btAlignedObjectArray* islandsPtr; + btSimulationIslandManagerMt::IslandCallback* callback; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + for ( int i = iBegin; i < iEnd; ++i ) + { + btSimulationIslandManagerMt::Island* island = ( *islandsPtr )[ i ]; + btPersistentManifold** manifolds = island->manifoldArray.size() ? &island->manifoldArray[ 0 ] : NULL; + btTypedConstraint** constraintsPtr = island->constraintArray.size() ? &island->constraintArray[ 0 ] : NULL; + callback->processIsland( &island->bodyArray[ 0 ], + island->bodyArray.size(), + manifolds, + island->manifoldArray.size(), + constraintsPtr, + island->constraintArray.size(), + island->id + ); + } + } +}; + +void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ) +{ + BT_PROFILE( "parallelIslandDispatch" ); + int grainSize = 1; // iterations per task + UpdateIslandDispatcher dispatcher; + dispatcher.islandsPtr = islandsPtr; + dispatcher.callback = callback; + btParallelFor( 0, islandsPtr->size(), grainSize, dispatcher ); +} + + ///@todo: this is random access, it can be walked 'cache friendly'! void btSimulationIslandManagerMt::buildAndProcessIslands( btDispatcher* dispatcher, btCollisionWorld* collisionWorld, diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h index 117061623..9a781aaef 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h @@ -59,7 +59,8 @@ public: ) = 0; }; typedef void( *IslandDispatchFunc ) ( btAlignedObjectArray* islands, IslandCallback* callback ); - static void defaultIslandDispatch( btAlignedObjectArray* islands, IslandCallback* callback ); + static void serialIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ); + static void parallelIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ); protected: btAlignedObjectArray m_allocatedIslands; // owner of all Islands btAlignedObjectArray m_activeIslands; // islands actively in use diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp index fbc2bbec4..8c7e499d8 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp @@ -52,6 +52,7 @@ namespace { bottom_out = -displacement.cross(top_out) + rotation_matrix * bottom_in; } +#if 0 void InverseSpatialTransform(const btMatrix3x3 &rotation_matrix, const btVector3 &displacement, const btVector3 &top_in, @@ -81,6 +82,8 @@ namespace { top_out = a_top.cross(b_top); bottom_out = a_bottom.cross(b_top) + a_top.cross(b_bottom); } +#endif + } @@ -151,6 +154,8 @@ void btMultiBody::setupFixed(int i, m_links[i].m_mass = mass; m_links[i].m_inertiaLocal = inertia; m_links[i].m_parent = parent; + m_links[i].setAxisTop(0, 0., 0., 0.); + m_links[i].setAxisBottom(0, btVector3(0,0,0)); m_links[i].m_zeroRotParentToThis = rotParentToThis; m_links[i].m_dVector = thisPivotToThisComOffset; m_links[i].m_eVector = parentComToThisPivotOffset; @@ -427,6 +432,13 @@ const btQuaternion & btMultiBody::getParentToLocalRot(int i) const btVector3 btMultiBody::localPosToWorld(int i, const btVector3 &local_pos) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + btVector3 result = local_pos; while (i != -1) { // 'result' is in frame i. transform it to frame parent(i) @@ -444,6 +456,13 @@ btVector3 btMultiBody::localPosToWorld(int i, const btVector3 &local_pos) const btVector3 btMultiBody::worldPosToLocal(int i, const btVector3 &world_pos) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + if (i == -1) { // world to base return quatRotate(getWorldToBaseRot(),(world_pos - getBasePos())); @@ -455,6 +474,14 @@ btVector3 btMultiBody::worldPosToLocal(int i, const btVector3 &world_pos) const btVector3 btMultiBody::localDirToWorld(int i, const btVector3 &local_dir) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + + btVector3 result = local_dir; while (i != -1) { result = quatRotate(getParentToLocalRot(i).inverse() , result); @@ -466,6 +493,13 @@ btVector3 btMultiBody::localDirToWorld(int i, const btVector3 &local_dir) const btVector3 btMultiBody::worldDirToLocal(int i, const btVector3 &world_dir) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + if (i == -1) { return quatRotate(getWorldToBaseRot(), world_dir); } else { @@ -490,7 +524,8 @@ void btMultiBody::compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const omega[0] = quatRotate(m_baseQuat ,getBaseOmega()); vel[0] = quatRotate(m_baseQuat ,getBaseVel()); - for (int i = 0; i < num_links; ++i) { + for (int i = 0; i < num_links; ++i) + { const int parent = m_links[i].m_parent; // transform parent vel into this frame, store in omega[i+1], vel[i+1] @@ -499,9 +534,24 @@ void btMultiBody::compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const omega[i+1], vel[i+1]); // now add qidot * shat_i - omega[i+1] += getJointVel(i) * m_links[i].getAxisTop(0); - vel[i+1] += getJointVel(i) * m_links[i].getAxisBottom(0); - } + //only supported for revolute/prismatic joints, todo: spherical and planar joints + switch(m_links[i].m_jointType) + { + case btMultibodyLink::ePrismatic: + case btMultibodyLink::eRevolute: + { + btVector3 axisTop = m_links[i].getAxisTop(0); + btVector3 axisBottom = m_links[i].getAxisBottom(0); + btScalar jointVel = getJointVel(i); + omega[i+1] += jointVel * axisTop; + vel[i+1] += jointVel * axisBottom; + break; + } + default: + { + } + } + } } btScalar btMultiBody::getKineticEnergy() const @@ -1206,7 +1256,7 @@ void btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar -void btMultiBody::solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, float result[6]) const +void btMultiBody::solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, btScalar result[6]) const { int num_links = getNumLinks(); ///solve I * x = rhs, so the result = invI * rhs @@ -1765,7 +1815,6 @@ void btMultiBody::goToSleep() void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep) { - int num_links = getNumLinks(); extern bool gDisableDeactivation; if (!m_canSleep || gDisableDeactivation) { @@ -1934,6 +1983,10 @@ const char* btMultiBody::serialize(void* dataBuffer, class btSerializer* seriali memPtr->m_parentIndex = getLink(i).m_parent; memPtr->m_jointDamping = getLink(i).m_jointDamping; memPtr->m_jointFriction = getLink(i).m_jointFriction; + memPtr->m_jointLowerLimit = getLink(i).m_jointLowerLimit; + memPtr->m_jointUpperLimit = getLink(i).m_jointUpperLimit; + memPtr->m_jointMaxForce = getLink(i).m_jointMaxForce; + memPtr->m_jointMaxVelocity = getLink(i).m_jointMaxVelocity; getLink(i).m_eVector.serialize(memPtr->m_parentComToThisComOffset); getLink(i).m_dVector.serialize(memPtr->m_thisPivotToThisComOffset); @@ -1978,5 +2031,10 @@ const char* btMultiBody::serialize(void* dataBuffer, class btSerializer* seriali } mbd->m_links = mbd->m_numLinks? (btMultiBodyLinkData*) serializer->getUniquePointer((void*)&m_links[0]):0; + // Fill padding with zeros to appease msan. +#ifdef BT_USE_DOUBLE_PRECISION + memset(mbd->m_padding, 0, sizeof(mbd->m_padding)); +#endif + return btMultiBodyDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h index 43aacbc44..655165ac1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h @@ -140,6 +140,15 @@ public: return m_baseCollider; } + btMultiBodyLinkCollider* getLinkCollider(int index) + { + if (index >= 0 && index < getNumLinks()) + { + return getLink(index).m_collider; + } + return 0; + } + // // get parent // input: link num from 0 to num_links-1 @@ -560,6 +569,8 @@ void addJointTorque(int i, btScalar Q); } void forwardKinematics(btAlignedObjectArray& scratch_q,btAlignedObjectArray& scratch_m); + void compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const; + void updateCollisionObjectWorldTransforms(btAlignedObjectArray& scratch_q,btAlignedObjectArray& scratch_m); virtual int calculateSerializeBufferSize() const; @@ -613,9 +624,8 @@ private: btMultiBody(const btMultiBody &); // not implemented void operator=(const btMultiBody &); // not implemented - void compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const; - void solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, float result[6]) const; + void solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, btScalar result[6]) const; void solveImatrix(const btSpatialForceVector &rhs, btSpatialMotionVector &result) const; void updateLinksDofOffsets() @@ -649,7 +659,6 @@ private: btVector3 m_baseConstraintTorque; // external torque applied to base. World frame. btAlignedObjectArray m_links; // array of m_links, excluding the base. index from 0 to num_links-1. - btAlignedObjectArray m_colliders; // @@ -727,7 +736,11 @@ struct btMultiBodyLinkDoubleData double m_jointDamping; double m_jointFriction; - + double m_jointLowerLimit; + double m_jointUpperLimit; + double m_jointMaxForce; + double m_jointMaxVelocity; + char *m_linkName; char *m_jointName; btCollisionObjectDoubleData *m_linkCollider; @@ -756,7 +769,11 @@ struct btMultiBodyLinkFloatData int m_posVarCount; float m_jointDamping; float m_jointFriction; - + float m_jointLowerLimit; + float m_jointUpperLimit; + float m_jointMaxForce; + float m_jointMaxVelocity; + char *m_linkName; char *m_jointName; btCollisionObjectFloatData *m_linkCollider; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h index 74c6f5a81..83521b950 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h @@ -39,7 +39,7 @@ struct btMultiBodyJacobianData }; -class btMultiBodyConstraint +ATTRIBUTE_ALIGNED16(class) btMultiBodyConstraint { protected: @@ -84,12 +84,18 @@ protected: public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + btMultiBodyConstraint(btMultiBody* bodyA,btMultiBody* bodyB,int linkA, int linkB, int numRows, bool isUnilateral); virtual ~btMultiBodyConstraint(); void updateJacobianSizes(); void allocateJacobiansMultiDof(); + //many constraints have setFrameInB/setPivotInB. Will use 'getConstraintType' later. + virtual void setFrameInB(const btMatrix3x3& frameInB) {} + virtual void setPivotInB(const btVector3& pivotInB){} + virtual void finalizeMultiDof()=0; virtual int getIslandIdA() const =0; @@ -177,6 +183,12 @@ public: virtual void debugDraw(class btIDebugDraw* drawer)=0; + virtual void setGearRatio(btScalar ratio) {} + virtual void setGearAuxLink(int gearAuxLink) {} + virtual void setRelativePositionTarget(btScalar relPosTarget){} + virtual void setErp(btScalar erp){} + + }; #endif //BT_MULTIBODY_CONSTRAINT_H diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp index 70e6c9922..1e2d07409 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp @@ -48,9 +48,11 @@ btScalar btMultiBodyConstraintSolver::solveSingleIteration(int iteration, btColl } //solve featherstone normal contact - for (int j=0;jm_multiBodyFrictionContactConstraints.size();j++) + for (int j1=0;j1m_multiBodyFrictionContactConstraints.size();j1++) { if (iteration < infoGlobal.m_numIterations) { - btMultiBodySolverConstraint& frictionConstraint = m_multiBodyFrictionContactConstraints[j]; + int index = j1;//iteration&1? j1 : m_multiBodyFrictionContactConstraints.size()-1-j1; + + btMultiBodySolverConstraint& frictionConstraint = m_multiBodyFrictionContactConstraints[index]; btScalar totalImpulse = m_multiBodyNormalContactConstraints[frictionConstraint.m_frictionIndex].m_appliedImpulse; //adjust friction limits here if (totalImpulse>btScalar(0)) @@ -240,32 +244,39 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol //cfm = 1 / ( dt * kp + kd ) //erp = dt * kp / ( dt * kp + kd ) - btScalar cfm = infoGlobal.m_globalCfm; - btScalar erp = infoGlobal.m_erp2; - - if ((cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) || (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP)) - { - if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) - cfm = cp.m_contactCFM; - if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP) - erp = cp.m_contactERP; - } else - { - if (cp.m_contactPointFlags & BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING) - { - btScalar denom = ( infoGlobal.m_timeStep * cp.m_combinedContactStiffness1 + cp.m_combinedContactDamping1 ); - if (denom < SIMD_EPSILON) - { - denom = SIMD_EPSILON; - } - cfm = btScalar(1) / denom; - erp = (infoGlobal.m_timeStep * cp.m_combinedContactStiffness1) / denom; - } - } - - cfm *= invTimeStep; + btScalar cfm; + btScalar erp; + if (isFriction) + { + cfm = infoGlobal.m_frictionCFM; + erp = infoGlobal.m_frictionERP; + } else + { + cfm = infoGlobal.m_globalCfm; + erp = infoGlobal.m_erp2; + if ((cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) || (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP)) + { + if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) + cfm = cp.m_contactCFM; + if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP) + erp = cp.m_contactERP; + } else + { + if (cp.m_contactPointFlags & BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING) + { + btScalar denom = ( infoGlobal.m_timeStep * cp.m_combinedContactStiffness1 + cp.m_combinedContactDamping1 ); + if (denom < SIMD_EPSILON) + { + denom = SIMD_EPSILON; + } + cfm = btScalar(1) / denom; + erp = (infoGlobal.m_timeStep * cp.m_combinedContactStiffness1) / denom; + } + } + } + cfm *= invTimeStep; if (multiBodyA) { @@ -425,8 +436,19 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol btScalar restitution = 0.f; - btScalar penetration = isFriction? 0 : cp.getDistance()+infoGlobal.m_linearSlop; - + btScalar distance = 0; + if (!isFriction) + { + distance = cp.getDistance()+infoGlobal.m_linearSlop; + } else + { + if (cp.m_contactPointFlags & BT_CONTACT_FLAG_FRICTION_ANCHOR) + { + distance = (cp.getPositionWorldOnA() - cp.getPositionWorldOnB()).dot(contactNormal); + } + } + + btScalar rel_vel = 0.f; int ndofA = 0; int ndofB = 0; @@ -469,7 +491,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol if(!isFriction) { - restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution); + restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution, infoGlobal.m_restitutionVelocityThreshold); if (restitution <= btScalar(0.)) { restitution = 0.f; @@ -521,15 +543,20 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol btScalar positionalError = 0.f; btScalar velocityError = restitution - rel_vel;// * damping; //note for friction restitution is always set to 0 (check above) so it is acutally velocityError = -rel_vel for friction - - if (penetration>0) + if (isFriction) { - positionalError = 0; - velocityError -= penetration / infoGlobal.m_timeStep; - + positionalError = -distance * erp/infoGlobal.m_timeStep; } else { - positionalError = -penetration * erp/infoGlobal.m_timeStep; + if (distance>0) + { + positionalError = 0; + velocityError -= distance / infoGlobal.m_timeStep; + + } else + { + positionalError = -distance * erp/infoGlobal.m_timeStep; + } } btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv; @@ -556,7 +583,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol } else { - solverConstraint.m_rhs = velocityImpulse; + solverConstraint.m_rhs = penetrationImpulse+velocityImpulse; solverConstraint.m_rhsPenetration = 0.f; solverConstraint.m_lowerLimit = -solverConstraint.m_friction; solverConstraint.m_upperLimit = solverConstraint.m_friction; @@ -602,7 +629,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu relaxation = infoGlobal.m_sor; - btScalar invTimeStep = btScalar(1)/infoGlobal.m_timeStep; + // btScalar invTimeStep = btScalar(1)/infoGlobal.m_timeStep; if (multiBodyA) @@ -638,12 +665,12 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu btScalar* delta = &m_data.m_deltaVelocitiesUnitImpulse[solverConstraint.m_jacAindex]; multiBodyA->calcAccelerationDeltasMultiDof(&m_data.m_jacobians[solverConstraint.m_jacAindex],delta,m_data.scratch_r, m_data.scratch_v); - btVector3 torqueAxis0 = constraintNormal; + btVector3 torqueAxis0 = -constraintNormal; solverConstraint.m_relpos1CrossNormal = torqueAxis0; solverConstraint.m_contactNormal1 = btVector3(0,0,0); } else { - btVector3 torqueAxis0 = constraintNormal; + btVector3 torqueAxis0 = -constraintNormal; solverConstraint.m_relpos1CrossNormal = torqueAxis0; solverConstraint.m_contactNormal1 = btVector3(0,0,0); solverConstraint.m_angularComponentA = rb0 ? rb0->getInvInertiaTensorWorld()*torqueAxis0*rb0->getAngularFactor() : btVector3(0,0,0); @@ -681,21 +708,20 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu multiBodyB->calcAccelerationDeltasMultiDof(&m_data.m_jacobians[solverConstraint.m_jacBindex],&m_data.m_deltaVelocitiesUnitImpulse[solverConstraint.m_jacBindex],m_data.scratch_r, m_data.scratch_v); btVector3 torqueAxis1 = constraintNormal; - solverConstraint.m_relpos2CrossNormal = -torqueAxis1; + solverConstraint.m_relpos2CrossNormal = torqueAxis1; solverConstraint.m_contactNormal2 = -btVector3(0,0,0); } else { btVector3 torqueAxis1 = constraintNormal; - solverConstraint.m_relpos2CrossNormal = -torqueAxis1; + solverConstraint.m_relpos2CrossNormal = torqueAxis1; solverConstraint.m_contactNormal2 = -btVector3(0,0,0); - solverConstraint.m_angularComponentB = rb1 ? rb1->getInvInertiaTensorWorld()*-torqueAxis1*rb1->getAngularFactor() : btVector3(0,0,0); + solverConstraint.m_angularComponentB = rb1 ? rb1->getInvInertiaTensorWorld()*torqueAxis1*rb1->getAngularFactor() : btVector3(0,0,0); } { - btVector3 vec; btScalar denom0 = 0.f; btScalar denom1 = 0.f; btScalar* jacB = 0; @@ -718,8 +744,8 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb0) { - vec = ( solverConstraint.m_angularComponentA).cross(rel_pos1); - denom0 = rb0->getInvMass() + constraintNormal.dot(vec); + btVector3 iMJaA = rb0?rb0->getInvInertiaTensorWorld()*solverConstraint.m_relpos1CrossNormal:btVector3(0,0,0); + denom0 = iMJaA.dot(solverConstraint.m_relpos1CrossNormal); } } if (multiBodyB) @@ -738,8 +764,8 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb1) { - vec = ( -solverConstraint.m_angularComponentB).cross(rel_pos2); - denom1 = rb1->getInvMass() + constraintNormal.dot(vec); + btVector3 iMJaB = rb1?rb1->getInvInertiaTensorWorld()*solverConstraint.m_relpos2CrossNormal:btVector3(0,0,0); + denom1 = iMJaB.dot(solverConstraint.m_relpos2CrossNormal); } } @@ -781,7 +807,10 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb0) { - rel_vel += rb0->getVelocityInLocalPoint(rel_pos1).dot(solverConstraint.m_contactNormal1); + btSolverBody* solverBodyA = &m_tmpSolverBodyPool[solverConstraint.m_solverBodyIdA]; + rel_vel += solverConstraint.m_contactNormal1.dot(rb0?solverBodyA->m_linearVelocity+solverBodyA->m_externalForceImpulse:btVector3(0,0,0)) + + solverConstraint.m_relpos1CrossNormal.dot(rb0?solverBodyA->m_angularVelocity:btVector3(0,0,0)); + } } if (multiBodyB) @@ -795,7 +824,10 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb1) { - rel_vel += rb1->getVelocityInLocalPoint(rel_pos2).dot(solverConstraint.m_contactNormal2); + btSolverBody* solverBodyB = &m_tmpSolverBodyPool[solverConstraint.m_solverBodyIdB]; + rel_vel += solverConstraint.m_contactNormal2.dot(rb1?solverBodyB->m_linearVelocity+solverBodyB->m_externalForceImpulse:btVector3(0,0,0)) + + solverConstraint.m_relpos2CrossNormal.dot(rb1?solverBodyB->m_angularVelocity:btVector3(0,0,0)); + } } @@ -803,7 +835,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu if(!isFriction) { - restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution); + restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution, infoGlobal.m_restitutionVelocityThreshold); if (restitution <= btScalar(0.)) { restitution = 0.f; @@ -817,13 +849,9 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { - btScalar positionalError = 0.f; - btScalar velocityError = restitution - rel_vel;// * damping; //note for friction restitution is always set to 0 (check above) so it is acutally velocityError = -rel_vel for friction + btScalar velocityError = 0 - rel_vel;// * damping; //note for friction restitution is always set to 0 (check above) so it is acutally velocityError = -rel_vel for friction - if (penetration>0) - { - velocityError -= penetration / infoGlobal.m_timeStep; - } + btScalar velocityImpulse = velocityError*solverConstraint.m_jacDiagABInv; @@ -995,6 +1023,33 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold* ///In that case, you can set the target relative motion in each friction direction (cp.m_contactMotion1 and cp.m_contactMotion2) ///this will give a conveyor belt effect /// + + btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2); + cp.m_lateralFrictionDir1.normalize(); + cp.m_lateralFrictionDir2.normalize(); + + if (rollingFriction > 0 ) + { + if (cp.m_combinedSpinningFriction>0) + { + addMultiBodyTorsionalFrictionConstraint(cp.m_normalWorldOnB,manifold,frictionIndex,cp,cp.m_combinedSpinningFriction, colObj0,colObj1, relaxation,infoGlobal); + } + if (cp.m_combinedRollingFriction>0) + { + + applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + + if (cp.m_lateralFrictionDir1.length()>0.001) + addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir1,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); + + if (cp.m_lateralFrictionDir2.length()>0.001) + addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir2,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); + } + rollingFriction--; + } if (!(infoGlobal.m_solverMode & SOLVER_ENABLE_FRICTION_DIRECTION_CACHING) || !(cp.m_contactPointFlags&BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED)) {/* cp.m_lateralFrictionDir1 = vel - cp.m_normalWorldOnB * rel_vel; @@ -1019,20 +1074,12 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold* } else */ { - btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2); + applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); addMultiBodyFrictionConstraint(cp.m_lateralFrictionDir1,manifold,frictionIndex,cp,colObj0,colObj1, relaxation,infoGlobal); - if (rollingFriction > 0) - { - addMultiBodyTorsionalFrictionConstraint(cp.m_normalWorldOnB,manifold,frictionIndex,cp,cp.m_combinedSpinningFriction, colObj0,colObj1, relaxation,infoGlobal); - addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir1,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); - addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir2,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); - - rollingFriction--; - } if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp index 4b33cf69d..9eacc2264 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp @@ -24,7 +24,7 @@ subject to the following restrictions: #include "LinearMath/btSerializer.h" -void btMultiBodyDynamicsWorld::addMultiBody(btMultiBody* body, short group, short mask) +void btMultiBodyDynamicsWorld::addMultiBody(btMultiBody* body, int group, int mask) { m_multiBodies.push_back(body); @@ -332,10 +332,10 @@ struct MultiBodyInplaceSolverIslandCallback : public btSimulationIslandManager:: } } - if (m_solverInfo->m_minimumSolverBatchSize<=1) - { - m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher); - } else + //if (m_solverInfo->m_minimumSolverBatchSize<=1) + //{ + // m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher); + //} else { for (i=0;im_multiBodies.size();i++) { btMultiBody* bod = m_multiBodies[i]; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h index 2c912da5c..c0c132bbb 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h @@ -58,7 +58,7 @@ public: virtual ~btMultiBodyDynamicsWorld (); - virtual void addMultiBody(btMultiBody* body, short group= btBroadphaseProxy::DefaultFilter, short mask=btBroadphaseProxy::AllFilter); + virtual void addMultiBody(btMultiBody* body, int group= btBroadphaseProxy::DefaultFilter, int mask=btBroadphaseProxy::AllFilter); virtual void removeMultiBody(btMultiBody* body); @@ -72,6 +72,11 @@ public: return m_multiBodies[mbIndex]; } + const btMultiBody* getMultiBody(int mbIndex) const + { + return m_multiBodies[mbIndex]; + } + virtual void addMultiBodyConstraint( btMultiBodyConstraint* constraint); virtual int getNumMultiBodyConstraints() const diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h index 26e28a74e..036025136 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h @@ -62,7 +62,7 @@ public: return m_pivotInB; } - void setPivotInB(const btVector3& pivotInB) + virtual void setPivotInB(const btVector3& pivotInB) { m_pivotInB = pivotInB; } @@ -82,7 +82,7 @@ public: return m_frameInB; } - void setFrameInB(const btMatrix3x3& frameInB) + virtual void setFrameInB(const btMatrix3x3& frameInB) { m_frameInB = frameInB; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp new file mode 100644 index 000000000..5fdb7007d --- /dev/null +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp @@ -0,0 +1,184 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2013 Erwin Coumans http://bulletphysics.org + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +///This file was written by Erwin Coumans + +#include "btMultiBodyGearConstraint.h" +#include "btMultiBody.h" +#include "btMultiBodyLinkCollider.h" +#include "BulletCollision/CollisionDispatch/btCollisionObject.h" + +btMultiBodyGearConstraint::btMultiBodyGearConstraint(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB, const btMatrix3x3& frameInA, const btMatrix3x3& frameInB) + :btMultiBodyConstraint(bodyA,bodyB,linkA,linkB,1,false), + m_gearRatio(1), + m_gearAuxLink(-1), + m_erp(0), + m_relativePositionTarget(0) +{ + +} + +void btMultiBodyGearConstraint::finalizeMultiDof() +{ + + allocateJacobiansMultiDof(); + + m_numDofsFinalized = m_jacSizeBoth; +} + +btMultiBodyGearConstraint::~btMultiBodyGearConstraint() +{ +} + + +int btMultiBodyGearConstraint::getIslandIdA() const +{ + + if (m_bodyA) + { + btMultiBodyLinkCollider* col = m_bodyA->getBaseCollider(); + if (col) + return col->getIslandTag(); + for (int i=0;igetNumLinks();i++) + { + if (m_bodyA->getLink(i).m_collider) + return m_bodyA->getLink(i).m_collider->getIslandTag(); + } + } + return -1; +} + +int btMultiBodyGearConstraint::getIslandIdB() const +{ + if (m_bodyB) + { + btMultiBodyLinkCollider* col = m_bodyB->getBaseCollider(); + if (col) + return col->getIslandTag(); + + for (int i=0;igetNumLinks();i++) + { + col = m_bodyB->getLink(i).m_collider; + if (col) + return col->getIslandTag(); + } + } + return -1; +} + + +void btMultiBodyGearConstraint::createConstraintRows(btMultiBodyConstraintArray& constraintRows, + btMultiBodyJacobianData& data, + const btContactSolverInfo& infoGlobal) +{ + // only positions need to be updated -- data.m_jacobians and force + // directions were set in the ctor and never change. + + if (m_numDofsFinalized != m_jacSizeBoth) + { + finalizeMultiDof(); + } + + //don't crash + if (m_numDofsFinalized != m_jacSizeBoth) + return; + + + if (m_maxAppliedImpulse==0.f) + return; + + // note: we rely on the fact that data.m_jacobians are + // always initialized to zero by the Constraint ctor + int linkDoF = 0; + unsigned int offsetA = 6 + (m_bodyA->getLink(m_linkA).m_dofOffset + linkDoF); + unsigned int offsetB = 6 + (m_bodyB->getLink(m_linkB).m_dofOffset + linkDoF); + + // row 0: the lower bound + jacobianA(0)[offsetA] = 1; + jacobianB(0)[offsetB] = m_gearRatio; + + btScalar posError = 0; + const btVector3 dummy(0, 0, 0); + + btScalar kp = 1; + btScalar kd = 1; + int numRows = getNumRows(); + + for (int row=0;rowgetJointPosMultiDof(m_linkA)[dof]; + btScalar currentVelocity = m_bodyA->getJointVelMultiDof(m_linkA)[dof]; + btScalar auxVel = 0; + + if (m_gearAuxLink>=0) + { + auxVel = m_bodyA->getJointVelMultiDof(m_gearAuxLink)[dof]; + } + currentVelocity += auxVel; + if (m_erp!=0) + { + btScalar currentPositionA = m_bodyA->getJointPosMultiDof(m_linkA)[dof]; + btScalar currentPositionB = m_gearRatio*m_bodyA->getJointPosMultiDof(m_linkB)[dof]; + btScalar diff = currentPositionB+currentPositionA; + btScalar desiredPositionDiff = this->m_relativePositionTarget; + posError = -m_erp*(desiredPositionDiff - diff); + } + + btScalar desiredRelativeVelocity = auxVel; + + fillMultiBodyConstraint(constraintRow,data,jacobianA(row),jacobianB(row),dummy,dummy,dummy,dummy,posError,infoGlobal,-m_maxAppliedImpulse,m_maxAppliedImpulse,false,1,false,desiredRelativeVelocity); + + constraintRow.m_orgConstraint = this; + constraintRow.m_orgDofIndex = row; + { + //expect either prismatic or revolute joint type for now + btAssert((m_bodyA->getLink(m_linkA).m_jointType == btMultibodyLink::eRevolute)||(m_bodyA->getLink(m_linkA).m_jointType == btMultibodyLink::ePrismatic)); + switch (m_bodyA->getLink(m_linkA).m_jointType) + { + case btMultibodyLink::eRevolute: + { + constraintRow.m_contactNormal1.setZero(); + constraintRow.m_contactNormal2.setZero(); + btVector3 revoluteAxisInWorld = quatRotate(m_bodyA->getLink(m_linkA).m_cachedWorldTransform.getRotation(),m_bodyA->getLink(m_linkA).m_axes[0].m_topVec); + constraintRow.m_relpos1CrossNormal=revoluteAxisInWorld; + constraintRow.m_relpos2CrossNormal=-revoluteAxisInWorld; + + break; + } + case btMultibodyLink::ePrismatic: + { + btVector3 prismaticAxisInWorld = quatRotate(m_bodyA->getLink(m_linkA).m_cachedWorldTransform.getRotation(),m_bodyA->getLink(m_linkA).m_axes[0].m_bottomVec); + constraintRow.m_contactNormal1=prismaticAxisInWorld; + constraintRow.m_contactNormal2=-prismaticAxisInWorld; + constraintRow.m_relpos1CrossNormal.setZero(); + constraintRow.m_relpos2CrossNormal.setZero(); + break; + } + default: + { + btAssert(0); + } + }; + + } + + } + +} + diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h new file mode 100644 index 000000000..0115de624 --- /dev/null +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h @@ -0,0 +1,117 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2013 Erwin Coumans http://bulletphysics.org + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +///This file was written by Erwin Coumans + +#ifndef BT_MULTIBODY_GEAR_CONSTRAINT_H +#define BT_MULTIBODY_GEAR_CONSTRAINT_H + +#include "btMultiBodyConstraint.h" + +class btMultiBodyGearConstraint : public btMultiBodyConstraint +{ +protected: + + btRigidBody* m_rigidBodyA; + btRigidBody* m_rigidBodyB; + btVector3 m_pivotInA; + btVector3 m_pivotInB; + btMatrix3x3 m_frameInA; + btMatrix3x3 m_frameInB; + btScalar m_gearRatio; + int m_gearAuxLink; + btScalar m_erp; + btScalar m_relativePositionTarget; + +public: + + //btMultiBodyGearConstraint(btMultiBody* body, int link, btRigidBody* bodyB, const btVector3& pivotInA, const btVector3& pivotInB, const btMatrix3x3& frameInA, const btMatrix3x3& frameInB); + btMultiBodyGearConstraint(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB, const btMatrix3x3& frameInA, const btMatrix3x3& frameInB); + + virtual ~btMultiBodyGearConstraint(); + + virtual void finalizeMultiDof(); + + virtual int getIslandIdA() const; + virtual int getIslandIdB() const; + + virtual void createConstraintRows(btMultiBodyConstraintArray& constraintRows, + btMultiBodyJacobianData& data, + const btContactSolverInfo& infoGlobal); + + const btVector3& getPivotInA() const + { + return m_pivotInA; + } + + void setPivotInA(const btVector3& pivotInA) + { + m_pivotInA = pivotInA; + } + + const btVector3& getPivotInB() const + { + return m_pivotInB; + } + + virtual void setPivotInB(const btVector3& pivotInB) + { + m_pivotInB = pivotInB; + } + + const btMatrix3x3& getFrameInA() const + { + return m_frameInA; + } + + void setFrameInA(const btMatrix3x3& frameInA) + { + m_frameInA = frameInA; + } + + const btMatrix3x3& getFrameInB() const + { + return m_frameInB; + } + + virtual void setFrameInB(const btMatrix3x3& frameInB) + { + m_frameInB = frameInB; + } + + virtual void debugDraw(class btIDebugDraw* drawer) + { + //todo(erwincoumans) + } + + virtual void setGearRatio(btScalar gearRatio) + { + m_gearRatio = gearRatio; + } + virtual void setGearAuxLink(int gearAuxLink) + { + m_gearAuxLink = gearAuxLink; + } + virtual void setRelativePositionTarget(btScalar relPosTarget) + { + m_relativePositionTarget = relPosTarget; + } + virtual void setErp(btScalar erp) + { + m_erp = erp; + } +}; + +#endif //BT_MULTIBODY_GEAR_CONSTRAINT_H diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp index 707817673..6d173b66a 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp @@ -110,7 +110,13 @@ void btMultiBodyJointLimitConstraint::createConstraintRows(btMultiBodyConstraint for (int row=0;row0) + { + continue; + } btScalar direction = row? -1 : 1; btMultiBodySolverConstraint& constraintRow = constraintRows.expandNonInitializing(); @@ -158,7 +164,7 @@ void btMultiBodyJointLimitConstraint::createConstraintRows(btMultiBodyConstraint } { - btScalar penetration = getPosition(row); + btScalar positionalError = 0.f; btScalar velocityError = - rel_vel;// * damping; btScalar erp = infoGlobal.m_erp2; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp index 2a88d806e..e0921178e 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp @@ -117,6 +117,9 @@ void btMultiBodyJointMotor::createConstraintRows(btMultiBodyConstraintArray& con if (m_numDofsFinalized != m_jacSizeBoth) return; + if (m_maxAppliedImpulse==0.f) + return; + const btScalar posError = 0; const btVector3 dummy(0, 0, 0); diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h index a25961116..01828e584 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h @@ -22,7 +22,8 @@ subject to the following restrictions: enum btMultiBodyLinkFlags { - BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION = 1 + BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION = 1, + BT_MULTIBODYLINKFLAGS_DISABLE_ALL_PARENT_COLLISION = 2, }; //both defines are now permanently enabled @@ -95,9 +96,18 @@ struct btMultibodyLink // m_axesBottom[1][2] = unit vectors along the translational axes on that plane btSpatialMotionVector m_axes[6]; void setAxisTop(int dof, const btVector3 &axis) { m_axes[dof].m_topVec = axis; } - void setAxisBottom(int dof, const btVector3 &axis) { m_axes[dof].m_bottomVec = axis; } - void setAxisTop(int dof, const btScalar &x, const btScalar &y, const btScalar &z) { m_axes[dof].m_topVec.setValue(x, y, z); } - void setAxisBottom(int dof, const btScalar &x, const btScalar &y, const btScalar &z) { m_axes[dof].m_bottomVec.setValue(x, y, z); } + void setAxisBottom(int dof, const btVector3 &axis) + { + m_axes[dof].m_bottomVec = axis; + } + void setAxisTop(int dof, const btScalar &x, const btScalar &y, const btScalar &z) + { + m_axes[dof].m_topVec.setValue(x, y, z); + } + void setAxisBottom(int dof, const btScalar &x, const btScalar &y, const btScalar &z) + { + m_axes[dof].m_bottomVec.setValue(x, y, z); + } const btVector3 & getAxisTop(int dof) const { return m_axes[dof].m_topVec; } const btVector3 & getAxisBottom(int dof) const { return m_axes[dof].m_bottomVec; } @@ -136,7 +146,11 @@ btVector3 m_appliedConstraintForce; // In WORLD frame btScalar m_jointDamping; //todo: implement this internally. It is unused for now, it is set by a URDF loader. User can apply manual damping. btScalar m_jointFriction; //todo: implement this internally. It is unused for now, it is set by a URDF loader. User can apply manual friction using a velocity motor. - + btScalar m_jointLowerLimit; //todo: implement this internally. It is unused for now, it is set by a URDF loader. + btScalar m_jointUpperLimit; //todo: implement this internally. It is unused for now, it is set by a URDF loader. + btScalar m_jointMaxForce; //todo: implement this internally. It is unused for now, it is set by a URDF loader. + btScalar m_jointMaxVelocity;//todo: implement this internally. It is unused for now, it is set by a URDF loader. + // ctor: set some sensible defaults btMultibodyLink() : m_mass(1), @@ -153,7 +167,11 @@ btVector3 m_appliedConstraintForce; // In WORLD frame m_jointName(0), m_userPtr(0), m_jointDamping(0), - m_jointFriction(0) + m_jointFriction(0), + m_jointLowerLimit(0), + m_jointUpperLimit(0), + m_jointMaxForce(0), + m_jointMaxVelocity(0) { m_inertiaLocal.setValue(1, 1, 1); diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h index 5080ea874..671e15d31 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h @@ -4,8 +4,8 @@ Copyright (c) 2013 Erwin Coumans http://bulletphysics.org This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -74,15 +74,48 @@ public: if (m_link>=0) { const btMultibodyLink& link = m_multiBody->getLink(this->m_link); - if ((link.m_flags&BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) && link.m_parent == other->m_link) - return false; + if (link.m_flags&BT_MULTIBODYLINKFLAGS_DISABLE_ALL_PARENT_COLLISION) + { + int parent_of_this = m_link; + while (1) + { + if (parent_of_this==-1) + break; + parent_of_this = m_multiBody->getLink(parent_of_this).m_parent; + if (parent_of_this==other->m_link) + { + return false; + } + } + } + else if (link.m_flags&BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) + { + if ( link.m_parent == other->m_link) + return false; + } + } - + if (other->m_link>=0) { const btMultibodyLink& otherLink = other->m_multiBody->getLink(other->m_link); - if ((otherLink.m_flags& BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) && otherLink.m_parent == this->m_link) - return false; + if (otherLink.m_flags& BT_MULTIBODYLINKFLAGS_DISABLE_ALL_PARENT_COLLISION) + { + int parent_of_other = other->m_link; + while (1) + { + if (parent_of_other==-1) + break; + parent_of_other = m_multiBody->getLink(parent_of_other).m_parent; + if (parent_of_other==this->m_link) + return false; + } + } + else if (otherLink.m_flags& BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) + { + if (otherLink.m_parent == this->m_link) + return false; + } } return true; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h index b2e219ac1..bf39acc5b 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h @@ -22,7 +22,7 @@ subject to the following restrictions: //#define BTMBP2PCONSTRAINT_BLOCK_ANGULAR_MOTION_TEST -class btMultiBodyPoint2Point : public btMultiBodyConstraint +ATTRIBUTE_ALIGNED16(class) btMultiBodyPoint2Point : public btMultiBodyConstraint { protected: @@ -34,6 +34,8 @@ protected: public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + btMultiBodyPoint2Point(btMultiBody* body, int link, btRigidBody* bodyB, const btVector3& pivotInA, const btVector3& pivotInB); btMultiBodyPoint2Point(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB); @@ -53,11 +55,12 @@ public: return m_pivotInB; } - void setPivotInB(const btVector3& pivotInB) + virtual void setPivotInB(const btVector3& pivotInB) { m_pivotInB = pivotInB; } + virtual void debugDraw(class btIDebugDraw* drawer); }; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h index 571dcd53b..0a6cf3df1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h @@ -63,7 +63,7 @@ public: return m_pivotInB; } - void setPivotInB(const btVector3& pivotInB) + virtual void setPivotInB(const btVector3& pivotInB) { m_pivotInB = pivotInB; } @@ -83,7 +83,7 @@ public: return m_frameInB; } - void setFrameInB(const btMatrix3x3& frameInB) + virtual void setFrameInB(const btMatrix3x3& frameInB) { m_frameInB = frameInB; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h index 82d44c73e..04656b912 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h +++ b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h @@ -19,7 +19,7 @@ class btDynamicsWorld; #include "btWheelInfo.h" #include "BulletDynamics/Dynamics/btActionInterface.h" -class btVehicleTuning; +//class btVehicleTuning; ///rayCast vehicle, very special constraint that turn a rigidbody into a vehicle. class btRaycastVehicle : public btActionInterface diff --git a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h index f916053ec..f991a57b6 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h +++ b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h @@ -79,6 +79,8 @@ struct btWheelInfo void* m_clientInfo;//can be used to store pointer to sync transforms... + btWheelInfo() {} + btWheelInfo(btWheelInfoConstructionInfo& ci) { diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp index c34f98941..ebb10e7a1 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp @@ -14,12 +14,22 @@ #ifdef BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H #include #define BT_ID_WO_BULLET -#define BT_ID_POW(a,b) std::pow(a,b) +#define BT_ID_SQRT(x) std::sqrt(x) +#define BT_ID_FABS(x) std::fabs(x) +#define BT_ID_COS(x) std::cos(x) +#define BT_ID_SIN(x) std::sin(x) +#define BT_ID_ATAN2(x, y) std::atan2(x, y) +#define BT_ID_POW(x, y) std::pow(x, y) #define BT_ID_SNPRINTF snprintf #define BT_ID_PI M_PI #define BT_ID_USE_DOUBLE_PRECISION #else -#define BT_ID_POW(a,b) btPow(a,b) +#define BT_ID_SQRT(x) btSqrt(x) +#define BT_ID_FABS(x) btFabs(x) +#define BT_ID_COS(x) btCos(x) +#define BT_ID_SIN(x) btSin(x) +#define BT_ID_ATAN2(x, y) btAtan2(x, y) +#define BT_ID_POW(x, y) btPow(x, y) #define BT_ID_PI SIMD_PI #ifdef _WIN32 #define BT_ID_SNPRINTF _snprintf @@ -58,6 +68,10 @@ typedef btScalar idScalar; #ifdef BT_USE_DOUBLE_PRECISION #define BT_ID_USE_DOUBLE_PRECISION #endif + +#ifndef BT_USE_INVERSE_DYNAMICS_WITH_BULLET2 + + // use bullet types for arrays and array indices #include "Bullet3Common/b3AlignedObjectArray.h" // this is to make it work with C++2003, otherwise we could do this: @@ -68,7 +82,20 @@ struct idArray { typedef b3AlignedObjectArray type; }; typedef int idArrayIdx; -#define ID_DECLARE_ALIGNED_ALLOCATOR B3_DECLARE_ALIGNED_ALLOCATOR +#define ID_DECLARE_ALIGNED_ALLOCATOR() B3_DECLARE_ALIGNED_ALLOCATOR() + +#else // BT_USE_INVERSE_DYNAMICS_WITH_BULLET2 + +#include "LinearMath/btAlignedObjectArray.h" +template +struct idArray { + typedef btAlignedObjectArray type; +}; +typedef int idArrayIdx; +#define ID_DECLARE_ALIGNED_ALLOCATOR() BT_DECLARE_ALIGNED_ALLOCATOR() + +#endif // BT_USE_INVERSE_DYNAMICS_WITH_BULLET2 + // use bullet's allocator functions #define idMalloc btAllocFunc diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp index a3866edc5..1dc22f860 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp @@ -5,7 +5,7 @@ /// name of file being compiled, without leading path components #define __INVDYN_FILE_WO_DIR__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) -#ifndef BT_ID_WO_BULLET +#if !defined(BT_ID_WO_BULLET) && !defined(BT_USE_INVERSE_DYNAMICS_WITH_BULLET2) #include "Bullet3Common/b3Logging.h" #define error_message(...) b3Error(__VA_ARGS__) #define warning_message(...) b3Warning(__VA_ARGS__) @@ -24,11 +24,6 @@ fprintf(stderr, "[Warning:%s:%d] ", __INVDYN_FILE_WO_DIR__, __LINE__); \ fprintf(stderr, __VA_ARGS__); \ } while (0) -#define warning_message(...) \ - do { \ - fprintf(stderr, "[Warning:%s:%d] ", __INVDYN_FILE_WO_DIR__, __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ - } while (0) #define id_printf(...) printf(__VA_ARGS__) #endif // BT_ID_WO_BULLET #endif diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp index 03452ca0c..99fe20e49 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp @@ -33,10 +33,22 @@ void setZero(mat33 &m) { m(2, 2) = 0; } +void skew(vec3& v, mat33* result) { + (*result)(0, 0) = 0.0; + (*result)(0, 1) = -v(2); + (*result)(0, 2) = v(1); + (*result)(1, 0) = v(2); + (*result)(1, 1) = 0.0; + (*result)(1, 2) = -v(0); + (*result)(2, 0) = -v(1); + (*result)(2, 1) = v(0); + (*result)(2, 2) = 0.0; +} + idScalar maxAbs(const vecx &v) { idScalar result = 0.0; for (int i = 0; i < v.size(); i++) { - const idScalar tmp = std::fabs(v(i)); + const idScalar tmp = BT_ID_FABS(v(i)); if (tmp > result) { result = tmp; } @@ -47,7 +59,7 @@ idScalar maxAbs(const vecx &v) { idScalar maxAbs(const vec3 &v) { idScalar result = 0.0; for (int i = 0; i < 3; i++) { - const idScalar tmp = std::fabs(v(i)); + const idScalar tmp = BT_ID_FABS(v(i)); if (tmp > result) { result = tmp; } @@ -69,7 +81,7 @@ idScalar maxAbsMat3x(const mat3x &m) { void mul(const mat33 &a, const mat3x &b, mat3x *result) { if (b.cols() != result->cols()) { - error_message("size missmatch. a.cols()= %d, b.cols()= %d\n", + error_message("size missmatch. b.cols()= %d, result->cols()= %d\n", static_cast(b.cols()), static_cast(result->cols())); abort(); } @@ -111,8 +123,8 @@ void sub(const mat3x &a, const mat3x &b, mat3x *result) { mat33 transformX(const idScalar &alpha) { mat33 T; - const idScalar cos_alpha = std::cos(alpha); - const idScalar sin_alpha = std::sin(alpha); + const idScalar cos_alpha = BT_ID_COS(alpha); + const idScalar sin_alpha = BT_ID_SIN(alpha); // [1 0 0] // [0 c s] // [0 -s c] @@ -133,8 +145,8 @@ mat33 transformX(const idScalar &alpha) { mat33 transformY(const idScalar &beta) { mat33 T; - const idScalar cos_beta = std::cos(beta); - const idScalar sin_beta = std::sin(beta); + const idScalar cos_beta = BT_ID_COS(beta); + const idScalar sin_beta = BT_ID_SIN(beta); // [c 0 -s] // [0 1 0] // [s 0 c] @@ -155,8 +167,8 @@ mat33 transformY(const idScalar &beta) { mat33 transformZ(const idScalar &gamma) { mat33 T; - const idScalar cos_gamma = std::cos(gamma); - const idScalar sin_gamma = std::sin(gamma); + const idScalar cos_gamma = BT_ID_COS(gamma); + const idScalar sin_gamma = BT_ID_SIN(gamma); // [ c s 0] // [-s c 0] // [ 0 0 1] @@ -190,10 +202,10 @@ mat33 tildeOperator(const vec3 &v) { } void getVecMatFromDH(idScalar theta, idScalar d, idScalar a, idScalar alpha, vec3 *r, mat33 *T) { - const idScalar sa = std::sin(alpha); - const idScalar ca = std::cos(alpha); - const idScalar st = std::sin(theta); - const idScalar ct = std::cos(theta); + const idScalar sa = BT_ID_SIN(alpha); + const idScalar ca = BT_ID_COS(alpha); + const idScalar st = BT_ID_SIN(theta); + const idScalar ct = BT_ID_COS(theta); (*r)(0) = a; (*r)(1) = -sa * d; @@ -213,8 +225,8 @@ void getVecMatFromDH(idScalar theta, idScalar d, idScalar a, idScalar alpha, vec } void bodyTParentFromAxisAngle(const vec3 &axis, const idScalar &angle, mat33 *T) { - const idScalar c = cos(angle); - const idScalar s = -sin(angle); + const idScalar c = BT_ID_COS(angle); + const idScalar s = -BT_ID_SIN(angle); const idScalar one_m_c = 1.0 - c; const idScalar &x = axis(0); @@ -347,19 +359,19 @@ bool isValidInertiaMatrix(const mat33 &I, const int index, bool has_fixed_joint) } } // check symmetry - if (std::fabs(I(1, 0) - I(0, 1)) > kIsZero) { + if (BT_ID_FABS(I(1, 0) - I(0, 1)) > kIsZero) { error_message("invalid inertia tensor for body %d I(1,0)!=I(0,1). I(1,0)-I(0,1)= " "%e\n", index, I(1, 0) - I(0, 1)); return false; } - if (std::fabs(I(2, 0) - I(0, 2)) > kIsZero) { + if (BT_ID_FABS(I(2, 0) - I(0, 2)) > kIsZero) { error_message("invalid inertia tensor for body %d I(2,0)!=I(0,2). I(2,0)-I(0,2)= " "%e\n", index, I(2, 0) - I(0, 2)); return false; } - if (std::fabs(I(1, 2) - I(2, 1)) > kIsZero) { + if (BT_ID_FABS(I(1, 2) - I(2, 1)) > kIsZero) { error_message("invalid inertia tensor body %d I(1,2)!=I(2,1). I(1,2)-I(2,1)= %e\n", index, I(1, 2) - I(2, 1)); return false; @@ -375,7 +387,7 @@ bool isValidTransformMatrix(const mat33 &m) { // check for unit length column vectors for (int i = 0; i < 3; i++) { const idScalar length_minus_1 = - std::fabs(m(0, i) * m(0, i) + m(1, i) * m(1, i) + m(2, i) * m(2, i) - 1.0); + BT_ID_FABS(m(0, i) * m(0, i) + m(1, i) * m(1, i) + m(2, i) * m(2, i) - 1.0); if (length_minus_1 > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (column %d not unit length)\n" "column = [%.18e %.18e %.18e]\n" @@ -386,17 +398,17 @@ bool isValidTransformMatrix(const mat33 &m) { } } // check for orthogonal column vectors - if (std::fabs(m(0, 0) * m(0, 1) + m(1, 0) * m(1, 1) + m(2, 0) * m(2, 1)) > kAxisLengthEpsilon) { + if (BT_ID_FABS(m(0, 0) * m(0, 1) + m(1, 0) * m(1, 1) + m(2, 0) * m(2, 1)) > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (columns 0 and 1 not orthogonal)\n"); print_mat(m); return false; } - if (std::fabs(m(0, 0) * m(0, 2) + m(1, 0) * m(1, 2) + m(2, 0) * m(2, 2)) > kAxisLengthEpsilon) { + if (BT_ID_FABS(m(0, 0) * m(0, 2) + m(1, 0) * m(1, 2) + m(2, 0) * m(2, 2)) > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (columns 0 and 2 not orthogonal)\n"); print_mat(m); return false; } - if (std::fabs(m(0, 1) * m(0, 2) + m(1, 1) * m(1, 2) + m(2, 1) * m(2, 2)) > kAxisLengthEpsilon) { + if (BT_ID_FABS(m(0, 1) * m(0, 2) + m(1, 1) * m(1, 2) + m(2, 1) * m(2, 2)) > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (columns 0 and 2 not orthogonal)\n"); print_mat(m); return false; @@ -411,15 +423,15 @@ bool isValidTransformMatrix(const mat33 &m) { } bool isUnitVector(const vec3 &vector) { - return std::fabs(vector(0) * vector(0) + vector(1) * vector(1) + vector(2) * vector(2) - 1.0) < + return BT_ID_FABS(vector(0) * vector(0) + vector(1) * vector(1) + vector(2) * vector(2) - 1.0) < kIsZero; } vec3 rpyFromMatrix(const mat33 &rot) { vec3 rpy; - rpy(2) = std::atan2(-rot(1, 0), rot(0, 0)); - rpy(1) = std::atan2(rot(2, 0), std::cos(rpy(2)) * rot(0, 0) - std::sin(rpy(0)) * rot(1, 0)); - rpy(0) = std::atan2(-rot(2, 0), rot(2, 2)); + rpy(2) = BT_ID_ATAN2(-rot(1, 0), rot(0, 0)); + rpy(1) = BT_ID_ATAN2(rot(2, 0), BT_ID_COS(rpy(2)) * rot(0, 0) - BT_ID_SIN(rpy(0)) * rot(1, 0)); + rpy(0) = BT_ID_ATAN2(-rot(2, 0), rot(2, 2)); return rpy; } } diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp index 63699712a..b355474d4 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp @@ -12,7 +12,8 @@ void setZero(vec3& v); void setZero(vecx& v); /// set all elements to zero void setZero(mat33& m); - +/// create a skew symmetric matrix from a vector (useful for cross product abstraction, e.g. v x a = V * a) +void skew(vec3& v, mat33* result); /// return maximum absolute value idScalar maxAbs(const vecx& v); #ifndef ID_LINEAR_MATH_USE_EIGEN diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp b/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp index 4235f138d..c67588d49 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp @@ -226,10 +226,10 @@ int MultiBodyTree::addBody(int body_index, int parent_index, JointType joint_typ warning_message( "axis of motion not a unit axis ([%f %f %f]), will use normalized vector\n", body_axis_of_motion(0), body_axis_of_motion(1), body_axis_of_motion(2)); - idScalar length = std::sqrt(std::pow(body_axis_of_motion(0), 2) + - std::pow(body_axis_of_motion(1), 2) + - std::pow(body_axis_of_motion(2), 2)); - if (length < std::sqrt(std::numeric_limits::min())) { + idScalar length = BT_ID_SQRT(BT_ID_POW(body_axis_of_motion(0), 2) + + BT_ID_POW(body_axis_of_motion(1), 2) + + BT_ID_POW(body_axis_of_motion(2), 2)); + if (length < BT_ID_SQRT(std::numeric_limits::min())) { error_message("axis of motion vector too short (%e)\n", length); return -1; } diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp b/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp index 847e5c6c7..b35c55df6 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp @@ -1013,7 +1013,7 @@ int MultiBodyTree::MultiBodyImpl::getBodyDotJacobianRotU(const int body_index, int MultiBodyTree::MultiBodyImpl::getBodyJacobianTrans(const int body_index, mat3x* world_jac_trans) const{ CHECK_IF_BODY_INDEX_IS_VALID(body_index); const RigidBody &body = m_body_list[body_index]; - mul(body.m_body_T_world.transpose(), body.m_body_Jac_T,world_jac_trans); + mul(body.m_body_T_world.transpose(), body.m_body_Jac_T, world_jac_trans); return 0; } diff --git a/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp b/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp index e90d24e6e..9c2040307 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp @@ -100,9 +100,9 @@ void btDefaultSoftBodySolver::copySoftBodyToVertexBuffer( const btSoftBody *cons for( int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex ) { btVector3 position = clothVertices[vertexIndex].m_x; - *(vertexPointer + 0) = position.getX(); - *(vertexPointer + 1) = position.getY(); - *(vertexPointer + 2) = position.getZ(); + *(vertexPointer + 0) = (float)position.getX(); + *(vertexPointer + 1) = (float)position.getY(); + *(vertexPointer + 2) = (float)position.getZ(); vertexPointer += vertexStride; } } @@ -115,9 +115,9 @@ void btDefaultSoftBodySolver::copySoftBodyToVertexBuffer( const btSoftBody *cons for( int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex ) { btVector3 normal = clothVertices[vertexIndex].m_n; - *(normalPointer + 0) = normal.getX(); - *(normalPointer + 1) = normal.getY(); - *(normalPointer + 2) = normal.getZ(); + *(normalPointer + 0) = (float)normal.getX(); + *(normalPointer + 1) = (float)normal.getY(); + *(normalPointer + 2) = (float)normal.getZ(); normalPointer += normalStride; } } diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp index d5de7c1b4..48efb0d8d 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp @@ -524,7 +524,7 @@ void btSoftBody::addAeroForceToNode(const btVector3& windVelocity,int nodeInde } else if (m_cfg.aeromodel == btSoftBody::eAeroModel::V_Point || m_cfg.aeromodel == btSoftBody::eAeroModel::V_OneSided || m_cfg.aeromodel == btSoftBody::eAeroModel::V_TwoSided) { - if (btSoftBody::eAeroModel::V_TwoSided) + if (m_cfg.aeromodel == btSoftBody::eAeroModel::V_TwoSided) nrm *= (btScalar)( (btDot(nrm,rel_v) < 0) ? -1 : +1); const btScalar dvn = btDot(rel_v,nrm); @@ -619,7 +619,7 @@ void btSoftBody::addAeroForceToFace(const btVector3& windVelocity,int faceInde } else if (m_cfg.aeromodel == btSoftBody::eAeroModel::F_OneSided || m_cfg.aeromodel == btSoftBody::eAeroModel::F_TwoSided) { - if (btSoftBody::eAeroModel::F_TwoSided) + if (m_cfg.aeromodel == btSoftBody::eAeroModel::F_TwoSided) nrm *= (btScalar)( (btDot(nrm,rel_v) < 0) ? -1 : +1); const btScalar dvn=btDot(rel_v,nrm); @@ -3003,6 +3003,7 @@ void btSoftBody::applyForces() // void btSoftBody::PSolve_Anchors(btSoftBody* psb,btScalar kst,btScalar ti) { + BT_PROFILE("PSolve_Anchors"); const btScalar kAHR=psb->m_cfg.kAHR*kst; const btScalar dt=psb->m_sst.sdt; for(int i=0,ni=psb->m_anchors.size();im_sst.sdt; const btScalar mrg = psb->getCollisionShape()->getMargin(); + btMultiBodyJacobianData jacobianData; for(int i=0,ni=psb->m_rcontacts.size();im_rcontacts[i]; @@ -3033,10 +3036,10 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb, btScalar kst, btScalar ti) if (cti.m_colObj->hasContactResponse()) { btVector3 va(0,0,0); - btRigidBody* rigidCol; - btMultiBodyLinkCollider* multibodyLinkCol; + btRigidBody* rigidCol=0; + btMultiBodyLinkCollider* multibodyLinkCol=0; btScalar* deltaV; - btMultiBodyJacobianData jacobianData; + if (cti.m_colObj->getInternalType() == btCollisionObject::CO_RIGID_BODY) { rigidCol = (btRigidBody*)btRigidBody::upcast(cti.m_colObj); @@ -3096,6 +3099,8 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb, btScalar kst, btScalar ti) // void btSoftBody::PSolve_SContacts(btSoftBody* psb,btScalar,btScalar ti) { + BT_PROFILE("PSolve_SContacts"); + for(int i=0,ni=psb->m_scontacts.size();im_scontacts[i]; @@ -3129,6 +3134,7 @@ void btSoftBody::PSolve_SContacts(btSoftBody* psb,btScalar,btScalar ti) // void btSoftBody::PSolve_Links(btSoftBody* psb,btScalar kst,btScalar ti) { +BT_PROFILE("PSolve_Links"); for(int i=0,ni=psb->m_links.size();im_links[i]; @@ -3151,6 +3157,7 @@ void btSoftBody::PSolve_Links(btSoftBody* psb,btScalar kst,btScalar ti) // void btSoftBody::VSolve_Links(btSoftBody* psb,btScalar kst) { + BT_PROFILE("VSolve_Links"); for(int i=0,ni=psb->m_links.size();im_links[i]; diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h index bd5846bfb..ada0dfd1a 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h @@ -232,15 +232,18 @@ public: int m_battach:1; // Attached }; /* Link */ - struct Link : Feature + ATTRIBUTE_ALIGNED16(struct) Link : Feature { + btVector3 m_c3; // gradient Node* m_n[2]; // Node pointers btScalar m_rl; // Rest length int m_bbending:1; // Bending link btScalar m_c0; // (ima+imb)*kLST btScalar m_c1; // rl^2 btScalar m_c2; // |gradient|^2/c0 - btVector3 m_c3; // gradient + + BT_DECLARE_ALIGNED_ALLOCATOR(); + }; /* Face */ struct Face : Feature @@ -614,7 +617,7 @@ public: RayFromToCaster(const btVector3& rayFrom,const btVector3& rayTo,btScalar mxt); void Process(const btDbvtNode* leaf); - static inline btScalar rayFromToTriangle(const btVector3& rayFrom, + static /*inline*/ btScalar rayFromToTriangle(const btVector3& rayFrom, const btVector3& rayTo, const btVector3& rayNormalizedDirection, const btVector3& a, diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp index 293a393e5..51fcd16da 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp @@ -123,8 +123,9 @@ static inline T average(const btAlignedObjectArray& items) return(sum(items)/n); } +#if 0 // -static inline btScalar tetravolume(const btVector3& x0, + inline static btScalar tetravolume(const btVector3& x0, const btVector3& x1, const btVector3& x2, const btVector3& x3) @@ -134,6 +135,7 @@ static inline btScalar tetravolume(const btVector3& x0, const btVector3 c=x3-x0; return(btDot(a,btCross(b,c))); } +#endif // #if 0 diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h index 759509a1d..1ad82616e 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h @@ -422,7 +422,7 @@ static inline btVector3 BaryCoord( const btVector3& a, } // -static btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn, +inline static btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn, const btVector3& a, const btVector3& b, const btScalar accuracy, @@ -451,6 +451,25 @@ static btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn, return(-1); } +inline static void EvaluateMedium( const btSoftBodyWorldInfo* wfi, + const btVector3& x, + btSoftBody::sMedium& medium) +{ + medium.m_velocity = btVector3(0,0,0); + medium.m_pressure = 0; + medium.m_density = wfi->air_density; + if(wfi->water_density>0) + { + const btScalar depth=-(btDot(x,wfi->water_normal)+wfi->water_offset); + if(depth>0) + { + medium.m_density = wfi->water_density; + medium.m_pressure = depth*wfi->water_density*wfi->m_gravity.length(); + } + } +} + + // static inline btVector3 NormalizeAny(const btVector3& v) { @@ -504,23 +523,7 @@ static inline btScalar VolumeOf( const btVector3& x0, } // -static void EvaluateMedium( const btSoftBodyWorldInfo* wfi, - const btVector3& x, - btSoftBody::sMedium& medium) -{ - medium.m_velocity = btVector3(0,0,0); - medium.m_pressure = 0; - medium.m_density = wfi->air_density; - if(wfi->water_density>0) - { - const btScalar depth=-(btDot(x,wfi->water_normal)+wfi->water_offset); - if(depth>0) - { - medium.m_density = wfi->water_density; - medium.m_pressure = depth*wfi->water_density*wfi->m_gravity.length(); - } - } -} + // static inline void ApplyClampedForce( btSoftBody::Node& n, diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp index ffa243ebf..4e76dca9d 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp @@ -125,7 +125,7 @@ void btSoftMultiBodyDynamicsWorld::solveSoftBodiesConstraints( btScalar timeStep } -void btSoftMultiBodyDynamicsWorld::addSoftBody(btSoftBody* body,short int collisionFilterGroup,short int collisionFilterMask) +void btSoftMultiBodyDynamicsWorld::addSoftBody(btSoftBody* body, int collisionFilterGroup, int collisionFilterMask) { m_softBodies.push_back(body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h index 2d0423a44..6d46a21db 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h @@ -20,7 +20,9 @@ subject to the following restrictions: #include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h" #include "BulletSoftBody/btSoftBody.h" +#ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H typedef btAlignedObjectArray btSoftBodyArray; +#endif class btSoftBodySolver; @@ -55,7 +57,7 @@ public: virtual void debugDrawWorld(); - void addSoftBody(btSoftBody* body,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter); + void addSoftBody(btSoftBody* body, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter); void removeSoftBody(btSoftBody* body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h index a9b513e36..93fcc6065 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h @@ -31,8 +31,8 @@ class btSoftRigidCollisionAlgorithm : public btCollisionAlgorithm // bool m_ownManifold; // btPersistentManifold* m_manifoldPtr; - btSoftBody* m_softBody; - btCollisionObject* m_rigidCollisionObject; + //btSoftBody* m_softBody; + //btCollisionObject* m_rigidCollisionObject; ///for rigid versus soft (instead of soft versus rigid), we use this swapped boolean bool m_isSwapped; diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp index 653d5a06b..204b4f576 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp @@ -125,7 +125,7 @@ void btSoftRigidDynamicsWorld::solveSoftBodiesConstraints( btScalar timeStep ) } -void btSoftRigidDynamicsWorld::addSoftBody(btSoftBody* body,short int collisionFilterGroup,short int collisionFilterMask) +void btSoftRigidDynamicsWorld::addSoftBody(btSoftBody* body, int collisionFilterGroup, int collisionFilterMask) { m_softBodies.push_back(body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h index 3e0efafd6..d921a6488 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h @@ -54,7 +54,7 @@ public: virtual void debugDrawWorld(); - void addSoftBody(btSoftBody* body,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter); + void addSoftBody(btSoftBody* body, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter); void removeSoftBody(btSoftBody* body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h index 43b1439cc..4eab7aea2 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h @@ -30,8 +30,8 @@ class btSoftSoftCollisionAlgorithm : public btCollisionAlgorithm bool m_ownManifold; btPersistentManifold* m_manifoldPtr; - btSoftBody* m_softBody0; - btSoftBody* m_softBody1; +// btSoftBody* m_softBody0; +// btSoftBody* m_softBody1; public: diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h b/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h index bcf0c7982..ba437c28e 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h @@ -185,7 +185,7 @@ struct btSparseSdf { ++nprobes; ++ncells; - int sz = sizeof(Cell); + //int sz = sizeof(Cell); if (ncells>m_clampCells) { static int numResets=0; diff --git a/Engine/lib/bullet/src/CMakeLists.txt b/Engine/lib/bullet/src/CMakeLists.txt index bbeabafbb..c30125c53 100644 --- a/Engine/lib/bullet/src/CMakeLists.txt +++ b/Engine/lib/bullet/src/CMakeLists.txt @@ -1,10 +1,10 @@ IF(BUILD_BULLET3) - SUBDIRS( Bullet3OpenCL Bullet3Serialize/Bullet2FileLoader Bullet3Dynamics Bullet3Collision Bullet3Geometry Bullet3Common ) - SUBDIRS( BulletInverseDynamics ) + SUBDIRS( Bullet3OpenCL Bullet3Serialize/Bullet2FileLoader Bullet3Dynamics Bullet3Collision Bullet3Geometry ) ENDIF(BUILD_BULLET3) -SUBDIRS( BulletSoftBody BulletCollision BulletDynamics LinearMath ) + +SUBDIRS( BulletInverseDynamics BulletSoftBody BulletCollision BulletDynamics LinearMath Bullet3Common) IF(INSTALL_LIBS) diff --git a/Engine/lib/bullet/src/LinearMath/CMakeLists.txt b/Engine/lib/bullet/src/LinearMath/CMakeLists.txt index 9c1980442..ede21d9a7 100644 --- a/Engine/lib/bullet/src/LinearMath/CMakeLists.txt +++ b/Engine/lib/bullet/src/LinearMath/CMakeLists.txt @@ -11,6 +11,7 @@ SET(LinearMath_SRCS btPolarDecomposition.cpp btQuickprof.cpp btSerializer.cpp + btSerializer64.cpp btThreads.cpp btVector3.cpp ) diff --git a/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h b/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h index 146ae72e8..f0b646529 100644 --- a/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h +++ b/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h @@ -475,16 +475,37 @@ protected: } return index; } + + // If the key is not in the array, return -1 instead of 0, + // since 0 also means the first element in the array. + int findLinearSearch2(const T& key) const + { + int index=-1; + int i; + + for (i=0;iedges = NULL; + v->next = v; + v->prev = v; + + result.minXy = v; + result.maxXy = v; + result.minYx = v; + result.maxYx = v; + } + + return; } - // lint -fallthrough + case 1: { Vertex* v = originalVertices[start]; diff --git a/Engine/lib/bullet/src/LinearMath/btHashMap.h b/Engine/lib/bullet/src/LinearMath/btHashMap.h index ca6f326b4..5e9cdb605 100644 --- a/Engine/lib/bullet/src/LinearMath/btHashMap.h +++ b/Engine/lib/bullet/src/LinearMath/btHashMap.h @@ -52,7 +52,7 @@ struct btHashString { int ret = 0 ; - while( ! (ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst) + while( ! (ret = *(const unsigned char *)src - *(const unsigned char *)dst) && *dst) ++src, ++dst; if ( ret < 0 ) @@ -79,6 +79,11 @@ class btHashInt { int m_uid; public: + + btHashInt() + { + } + btHashInt(int uid) :m_uid(uid) { } @@ -100,9 +105,10 @@ public: //to our success SIMD_FORCE_INLINE unsigned int getHash()const { - int key = m_uid; + unsigned int key = m_uid; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); + return key; } }; @@ -115,7 +121,7 @@ class btHashPtr union { const void* m_pointer; - int m_hashValues[2]; + unsigned int m_hashValues[2]; }; public: @@ -140,8 +146,7 @@ public: { const bool VOID_IS_8 = ((sizeof(void*)==8)); - int key = VOID_IS_8? m_hashValues[0]+m_hashValues[1] : m_hashValues[0]; - + unsigned int key = VOID_IS_8? m_hashValues[0]+m_hashValues[1] : m_hashValues[0]; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); return key; @@ -174,7 +179,7 @@ public: //to our success SIMD_FORCE_INLINE unsigned int getHash()const { - int key = m_uid; + unsigned int key = m_uid; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); return key; @@ -206,7 +211,7 @@ public: //to our success SIMD_FORCE_INLINE unsigned int getHash()const { - int key = m_uid; + unsigned int key = m_uid; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); return key; @@ -384,28 +389,38 @@ protected: const Value* getAtIndex(int index) const { btAssert(index < m_valueArray.size()); - - return &m_valueArray[index]; + btAssert(index>=0); + if (index>=0 && index < m_valueArray.size()) + { + return &m_valueArray[index]; + } + return 0; } Value* getAtIndex(int index) { btAssert(index < m_valueArray.size()); - - return &m_valueArray[index]; + btAssert(index>=0); + if (index>=0 && index < m_valueArray.size()) + { + return &m_valueArray[index]; + } + return 0; } Key getKeyAtIndex(int index) { btAssert(index < m_keyArray.size()); - return m_keyArray[index]; + btAssert(index>=0); + return m_keyArray[index]; } const Key getKeyAtIndex(int index) const { btAssert(index < m_keyArray.size()); - return m_keyArray[index]; - } + btAssert(index>=0); + return m_keyArray[index]; + } Value* operator[](const Key& key) { diff --git a/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h b/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h index a020c3f4e..936aaa896 100644 --- a/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h +++ b/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h @@ -469,6 +469,10 @@ class btIDebugDraw drawLine(transform*pt2,transform*pt3,color); } + virtual void clearLines() + { + } + virtual void flushLines() { } diff --git a/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h b/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h index 40cd1e086..9f642a177 100644 --- a/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h +++ b/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h @@ -647,92 +647,49 @@ public: return m_el[0].z() * v.x() + m_el[1].z() * v.y() + m_el[2].z() * v.z(); } + ///extractRotation is from "A robust method to extract the rotational part of deformations" + ///See http://dl.acm.org/citation.cfm?doid=2994258.2994269 + SIMD_FORCE_INLINE void extractRotation(btQuaternion &q,btScalar tolerance = 1.0e-9, int maxIter=100) + { + int iter =0; + btScalar w; + const btMatrix3x3& A=*this; + for(iter = 0; iter < maxIter; iter++) + { + btMatrix3x3 R(q); + btVector3 omega = (R.getColumn(0).cross(A.getColumn(0)) + R.getColumn(1).cross(A.getColumn(1)) + + R.getColumn(2).cross(A.getColumn(2)) + ) * (btScalar(1.0) / btFabs(R.getColumn(0).dot(A.getColumn(0)) + R.getColumn + (1).dot(A.getColumn(1)) + R.getColumn(2).dot(A.getColumn(2))) + + tolerance); + w = omega.norm(); + if(w < tolerance) + break; + q = btQuaternion(btVector3((btScalar(1.0) / w) * omega),w) * + q; + q.normalize(); + } + } - /**@brief diagonalizes this matrix by the Jacobi method. + + + /**@brief diagonalizes this matrix * @param rot stores the rotation from the coordinate system in which the matrix is diagonal to the original * coordinate system, i.e., old_this = rot * new_this * rot^T. * @param threshold See iteration - * @param iteration The iteration stops when all off-diagonal elements are less than the threshold multiplied - * by the sum of the absolute values of the diagonal, or when maxSteps have been executed. - * - * Note that this matrix is assumed to be symmetric. + * @param maxIter The iteration stops when we hit the given tolerance or when maxIter have been executed. */ - void diagonalize(btMatrix3x3& rot, btScalar threshold, int maxSteps) + void diagonalize(btMatrix3x3& rot, btScalar tolerance = 1.0e-9, int maxIter=100) { - rot.setIdentity(); - for (int step = maxSteps; step > 0; step--) - { - // find off-diagonal element [p][q] with largest magnitude - int p = 0; - int q = 1; - int r = 2; - btScalar max = btFabs(m_el[0][1]); - btScalar v = btFabs(m_el[0][2]); - if (v > max) - { - q = 2; - r = 1; - max = v; - } - v = btFabs(m_el[1][2]); - if (v > max) - { - p = 1; - q = 2; - r = 0; - max = v; - } - - btScalar t = threshold * (btFabs(m_el[0][0]) + btFabs(m_el[1][1]) + btFabs(m_el[2][2])); - if (max <= t) - { - if (max <= SIMD_EPSILON * t) - { - return; - } - step = 1; - } - - // compute Jacobi rotation J which leads to a zero for element [p][q] - btScalar mpq = m_el[p][q]; - btScalar theta = (m_el[q][q] - m_el[p][p]) / (2 * mpq); - btScalar theta2 = theta * theta; - btScalar cos; - btScalar sin; - if (theta2 * theta2 < btScalar(10 / SIMD_EPSILON)) - { - t = (theta >= 0) ? 1 / (theta + btSqrt(1 + theta2)) - : 1 / (theta - btSqrt(1 + theta2)); - cos = 1 / btSqrt(1 + t * t); - sin = cos * t; - } - else - { - // approximation for large theta-value, i.e., a nearly diagonal matrix - t = 1 / (theta * (2 + btScalar(0.5) / theta2)); - cos = 1 - btScalar(0.5) * t * t; - sin = cos * t; - } - - // apply rotation to matrix (this = J^T * this * J) - m_el[p][q] = m_el[q][p] = 0; - m_el[p][p] -= t * mpq; - m_el[q][q] += t * mpq; - btScalar mrp = m_el[r][p]; - btScalar mrq = m_el[r][q]; - m_el[r][p] = m_el[p][r] = cos * mrp - sin * mrq; - m_el[r][q] = m_el[q][r] = cos * mrq + sin * mrp; - - // apply rotation to rot (rot = rot * J) - for (int i = 0; i < 3; i++) - { - btVector3& row = rot[i]; - mrp = row[p]; - mrq = row[q]; - row[p] = cos * mrp - sin * mrq; - row[q] = cos * mrq + sin * mrp; - } - } + btQuaternion r; + r = btQuaternion::getIdentity(); + extractRotation(r,tolerance,maxIter); + rot.setRotation(r); + btMatrix3x3 rotInv = btMatrix3x3(r.inverse()); + btMatrix3x3 old = *this; + setValue(old.tdotx( rotInv[0]), old.tdoty( rotInv[0]), old.tdotz( rotInv[0]), + old.tdotx( rotInv[1]), old.tdoty( rotInv[1]), old.tdotz( rotInv[1]), + old.tdotx( rotInv[2]), old.tdoty( rotInv[2]), old.tdotz( rotInv[2])); } diff --git a/Engine/lib/bullet/src/LinearMath/btQuaternion.h b/Engine/lib/bullet/src/LinearMath/btQuaternion.h index 32f0f85d2..7bd39e6a3 100644 --- a/Engine/lib/bullet/src/LinearMath/btQuaternion.h +++ b/Engine/lib/bullet/src/LinearMath/btQuaternion.h @@ -141,11 +141,11 @@ public: * @param yaw Angle around Z * @param pitch Angle around Y * @param roll Angle around X */ - void setEulerZYX(const btScalar& yaw, const btScalar& pitch, const btScalar& roll) + void setEulerZYX(const btScalar& yawZ, const btScalar& pitchY, const btScalar& rollX) { - btScalar halfYaw = btScalar(yaw) * btScalar(0.5); - btScalar halfPitch = btScalar(pitch) * btScalar(0.5); - btScalar halfRoll = btScalar(roll) * btScalar(0.5); + btScalar halfYaw = btScalar(yawZ) * btScalar(0.5); + btScalar halfPitch = btScalar(pitchY) * btScalar(0.5); + btScalar halfRoll = btScalar(rollX) * btScalar(0.5); btScalar cosYaw = btCos(halfYaw); btScalar sinYaw = btSin(halfYaw); btScalar cosPitch = btCos(halfPitch); @@ -157,6 +157,28 @@ public: cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw, //z cosRoll * cosPitch * cosYaw + sinRoll * sinPitch * sinYaw); //formerly yzx } + + /**@brief Get the euler angles from this quaternion + * @param yaw Angle around Z + * @param pitch Angle around Y + * @param roll Angle around X */ + void getEulerZYX(btScalar& yawZ, btScalar& pitchY, btScalar& rollX) const + { + btScalar squ; + btScalar sqx; + btScalar sqy; + btScalar sqz; + btScalar sarg; + sqx = m_floats[0] * m_floats[0]; + sqy = m_floats[1] * m_floats[1]; + sqz = m_floats[2] * m_floats[2]; + squ = m_floats[3] * m_floats[3]; + rollX = btAtan2(2 * (m_floats[1] * m_floats[2] + m_floats[3] * m_floats[0]), squ - sqx - sqy + sqz); + sarg = btScalar(-2.) * (m_floats[0] * m_floats[2] - m_floats[3] * m_floats[1]); + pitchY = sarg <= btScalar(-1.0) ? btScalar(-0.5) * SIMD_PI: (sarg >= btScalar(1.0) ? btScalar(0.5) * SIMD_PI : btAsin(sarg)); + yawZ = btAtan2(2 * (m_floats[0] * m_floats[1] + m_floats[3] * m_floats[2]), squ + sqx - sqy - sqz); + } + /**@brief Add two quaternions * @param q The quaternion to add to this one */ SIMD_FORCE_INLINE btQuaternion& operator+=(const btQuaternion& q) @@ -333,7 +355,15 @@ public: { return btSqrt(length2()); } - + btQuaternion& safeNormalize() + { + btScalar l2 = length2(); + if (l2>SIMD_EPSILON) + { + normalize(); + } + return *this; + } /**@brief Normalize the quaternion * Such that x^2 + y^2 + z^2 +w^2 = 1 */ btQuaternion& normalize() diff --git a/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp b/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp index f587770e8..aed3104a6 100644 --- a/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp +++ b/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp @@ -14,11 +14,9 @@ // Ogre (www.ogre3d.org). #include "btQuickprof.h" - - -#if BT_THREADSAFE #include "btThreads.h" -#endif //#if BT_THREADSAFE + + #ifdef __CELLOS_LV2__ @@ -30,6 +28,10 @@ #if defined (SUNOS) || defined (__SUNOS__) #include #endif +#ifdef __APPLE__ +#include +#include +#endif #if defined(WIN32) || defined(_WIN32) @@ -55,6 +57,12 @@ #else //_WIN32 #include + +#ifdef BT_LINUX_REALTIME +//required linking against rt (librt) +#include +#endif //BT_LINUX_REALTIME + #endif //_WIN32 #define mymin(a,b) (a > b ? a : b) @@ -65,12 +73,14 @@ struct btClockData #ifdef BT_USE_WINDOWS_TIMERS LARGE_INTEGER mClockFrequency; LONGLONG mStartTick; - LONGLONG mPrevElapsedTime; LARGE_INTEGER mStartTime; #else #ifdef __CELLOS_LV2__ uint64_t mStartTime; #else +#ifdef __APPLE__ + uint64_t mStartTimeNano; +#endif struct timeval mStartTime; #endif #endif //__CELLOS_LV2__ @@ -111,7 +121,6 @@ void btClock::reset() #ifdef BT_USE_WINDOWS_TIMERS QueryPerformanceCounter(&m_data->mStartTime); m_data->mStartTick = GetTickCount64(); - m_data->mPrevElapsedTime = 0; #else #ifdef __CELLOS_LV2__ @@ -121,6 +130,9 @@ void btClock::reset() SYS_TIMEBASE_GET( newTime ); m_data->mStartTime = newTime; #else +#ifdef __APPLE__ + m_data->mStartTimeNano = mach_absolute_time(); +#endif gettimeofday(&m_data->mStartTime, 0); #endif #endif @@ -128,7 +140,7 @@ void btClock::reset() /// Returns the time in ms since the last call to reset or since /// the btClock was created. -unsigned long int btClock::getTimeMilliseconds() +unsigned long long int btClock::getTimeMilliseconds() { #ifdef BT_USE_WINDOWS_TIMERS LARGE_INTEGER currentTime; @@ -138,27 +150,6 @@ unsigned long int btClock::getTimeMilliseconds() // Compute the number of millisecond ticks elapsed. unsigned long msecTicks = (unsigned long)(1000 * elapsedTime / m_data->mClockFrequency.QuadPart); - // Check for unexpected leaps in the Win32 performance counter. - // (This is caused by unexpected data across the PCI to ISA - // bridge, aka south bridge. See Microsoft KB274323.) - unsigned long elapsedTicks = (unsigned long)(GetTickCount64() - m_data->mStartTick); - signed long msecOff = (signed long)(msecTicks - elapsedTicks); - if (msecOff < -100 || msecOff > 100) - { - // Adjust the starting time forwards. - LONGLONG msecAdjustment = mymin(msecOff * - m_data->mClockFrequency.QuadPart / 1000, elapsedTime - - m_data->mPrevElapsedTime); - m_data->mStartTime.QuadPart += msecAdjustment; - elapsedTime -= msecAdjustment; - - // Recompute the number of millisecond ticks elapsed. - msecTicks = (unsigned long)(1000 * elapsedTime / - m_data->mClockFrequency.QuadPart); - } - - // Store the current elapsed time for adjustments next time. - m_data->mPrevElapsedTime = elapsedTime; return msecTicks; #else @@ -184,41 +175,19 @@ unsigned long int btClock::getTimeMilliseconds() /// Returns the time in us since the last call to reset or since /// the Clock was created. -unsigned long int btClock::getTimeMicroseconds() +unsigned long long int btClock::getTimeMicroseconds() { #ifdef BT_USE_WINDOWS_TIMERS - LARGE_INTEGER currentTime; + //see https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx + LARGE_INTEGER currentTime, elapsedTime; + QueryPerformanceCounter(¤tTime); - LONGLONG elapsedTime = currentTime.QuadPart - + elapsedTime.QuadPart = currentTime.QuadPart - m_data->mStartTime.QuadPart; + elapsedTime.QuadPart *= 1000000; + elapsedTime.QuadPart /= m_data->mClockFrequency.QuadPart; - // Compute the number of millisecond ticks elapsed. - unsigned long msecTicks = (unsigned long)(1000 * elapsedTime / - m_data->mClockFrequency.QuadPart); - - // Check for unexpected leaps in the Win32 performance counter. - // (This is caused by unexpected data across the PCI to ISA - // bridge, aka south bridge. See Microsoft KB274323.) - unsigned long elapsedTicks = (unsigned long)(GetTickCount64() - m_data->mStartTick); - signed long msecOff = (signed long)(msecTicks - elapsedTicks); - if (msecOff < -100 || msecOff > 100) - { - // Adjust the starting time forwards. - LONGLONG msecAdjustment = mymin(msecOff * - m_data->mClockFrequency.QuadPart / 1000, elapsedTime - - m_data->mPrevElapsedTime); - m_data->mStartTime.QuadPart += msecAdjustment; - elapsedTime -= msecAdjustment; - } - - // Store the current elapsed time for adjustments next time. - m_data->mPrevElapsedTime = elapsedTime; - - // Convert to microseconds. - unsigned long usecTicks = (unsigned long)(1000000 * elapsedTime / - m_data->mClockFrequency.QuadPart); - - return usecTicks; + return (unsigned long long) elapsedTime.QuadPart; #else #ifdef __CELLOS_LV2__ @@ -240,6 +209,66 @@ unsigned long int btClock::getTimeMicroseconds() #endif } +unsigned long long int btClock::getTimeNanoseconds() +{ +#ifdef BT_USE_WINDOWS_TIMERS + //see https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx + LARGE_INTEGER currentTime, elapsedTime; + + QueryPerformanceCounter(¤tTime); + elapsedTime.QuadPart = currentTime.QuadPart - + m_data->mStartTime.QuadPart; + elapsedTime.QuadPart *= 1000000000; + elapsedTime.QuadPart /= m_data->mClockFrequency.QuadPart; + + return (unsigned long long) elapsedTime.QuadPart; +#else + +#ifdef __CELLOS_LV2__ + uint64_t freq=sys_time_get_timebase_frequency(); + double dFreq=((double) freq)/ 1e9; + typedef uint64_t ClockSize; + ClockSize newTime; + //__asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory"); + SYS_TIMEBASE_GET( newTime ); + + return (unsigned long int)((double(newTime-m_data->mStartTime)) / dFreq); +#else +#ifdef __APPLE__ + uint64_t ticks = mach_absolute_time() - m_data->mStartTimeNano; + static long double conversion = 0.0L; + if( 0.0L == conversion ) + { + // attempt to get conversion to nanoseconds + mach_timebase_info_data_t info; + int err = mach_timebase_info( &info ); + if( err ) + { + btAssert(0); + conversion = 1.; + } + conversion = info.numer / info.denom; + } + return (ticks * conversion); + + +#else//__APPLE__ + +#ifdef BT_LINUX_REALTIME + timespec ts; + clock_gettime(CLOCK_REALTIME,&ts); + return 1000000000*ts.tv_sec + ts.tv_nsec; +#else + struct timeval currentTime; + gettimeofday(¤tTime, 0); + return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1e9 + + (currentTime.tv_usec - m_data->mStartTime.tv_usec)*1000; +#endif //BT_LINUX_REALTIME + +#endif//__APPLE__ +#endif//__CELLOS_LV2__ +#endif +} /// Returns the time in s since the last call to reset or since @@ -258,7 +287,7 @@ static btClock gProfileClock; inline void Profile_Get_Ticks(unsigned long int * ticks) { - *ticks = gProfileClock.getTimeMicroseconds(); + *ticks = (unsigned long int)gProfileClock.getTimeMicroseconds(); } inline float Profile_Get_Tick_Rate(void) @@ -370,6 +399,7 @@ bool CProfileNode::Return( void ) if ( --RecursionCounter == 0 && TotalCalls != 0 ) { unsigned long int time; Profile_Get_Ticks(&time); + time-=StartTime; TotalTime += (float)time / Profile_Get_Tick_Rate(); } @@ -437,11 +467,71 @@ void CProfileIterator::Enter_Parent( void ) ** ***************************************************************************************************/ -CProfileNode CProfileManager::Root( "Root", NULL ); -CProfileNode * CProfileManager::CurrentNode = &CProfileManager::Root; + + + +CProfileNode gRoots[BT_QUICKPROF_MAX_THREAD_COUNT]={ + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL) +}; + + +CProfileNode* gCurrentNodes[BT_QUICKPROF_MAX_THREAD_COUNT]= +{ + &gRoots[ 0], &gRoots[ 1], &gRoots[ 2], &gRoots[ 3], + &gRoots[ 4], &gRoots[ 5], &gRoots[ 6], &gRoots[ 7], + &gRoots[ 8], &gRoots[ 9], &gRoots[10], &gRoots[11], + &gRoots[12], &gRoots[13], &gRoots[14], &gRoots[15], + &gRoots[16], &gRoots[17], &gRoots[18], &gRoots[19], + &gRoots[20], &gRoots[21], &gRoots[22], &gRoots[23], + &gRoots[24], &gRoots[25], &gRoots[26], &gRoots[27], + &gRoots[28], &gRoots[29], &gRoots[30], &gRoots[31], + &gRoots[32], &gRoots[33], &gRoots[34], &gRoots[35], + &gRoots[36], &gRoots[37], &gRoots[38], &gRoots[39], + &gRoots[40], &gRoots[41], &gRoots[42], &gRoots[43], + &gRoots[44], &gRoots[45], &gRoots[46], &gRoots[47], + &gRoots[48], &gRoots[49], &gRoots[50], &gRoots[51], + &gRoots[52], &gRoots[53], &gRoots[54], &gRoots[55], + &gRoots[56], &gRoots[57], &gRoots[58], &gRoots[59], + &gRoots[60], &gRoots[61], &gRoots[62], &gRoots[63], +}; + + int CProfileManager::FrameCounter = 0; unsigned long int CProfileManager::ResetTime = 0; +CProfileIterator * CProfileManager::Get_Iterator( void ) +{ + + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return 0; + + return new CProfileIterator( &gRoots[threadIndex]); +} + +void CProfileManager::CleanupMemory(void) +{ + for (int i=0;iGet_Name()) { - CurrentNode = CurrentNode->Get_Sub_Node( name ); + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return; + + if (name != gCurrentNodes[threadIndex]->Get_Name()) { + gCurrentNodes[threadIndex] = gCurrentNodes[threadIndex]->Get_Sub_Node( name ); } - CurrentNode->Call(); + gCurrentNodes[threadIndex]->Call(); } @@ -479,22 +565,22 @@ void CProfileManager::Start_Profile( const char * name ) *=============================================================================================*/ void CProfileManager::Stop_Profile( void ) { -#if BT_THREADSAFE - // profile system is not designed for profiling multiple threads - // disable collection on all but the main thread - if ( !btIsMainThread() ) - { - return; - } -#endif //#if BT_THREADSAFE + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return; + // Return will indicate whether we should back up to our parent (we may // be profiling a recursive function) - if (CurrentNode->Return()) { - CurrentNode = CurrentNode->Get_Parent(); + if (gCurrentNodes[threadIndex]->Return()) { + gCurrentNodes[threadIndex] = gCurrentNodes[threadIndex]->Get_Parent(); } } + + + + /*********************************************************************************************** * CProfileManager::Reset -- Reset the contents of the profiling system * * * @@ -503,8 +589,11 @@ void CProfileManager::Stop_Profile( void ) void CProfileManager::Reset( void ) { gProfileClock.reset(); - Root.Reset(); - Root.Call(); + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return; + gRoots[threadIndex].Reset(); + gRoots[threadIndex].Call(); FrameCounter = 0; Profile_Get_Ticks(&ResetTime); } @@ -594,4 +683,107 @@ void CProfileManager::dumpAll() +unsigned int btQuickprofGetCurrentThreadIndex2() +{ +#if BT_THREADSAFE + return btGetCurrentThreadIndex(); +#else // #if BT_THREADSAFE + const unsigned int kNullIndex = ~0U; +#ifdef _WIN32 + #if defined(__MINGW32__) || defined(__MINGW64__) + static __thread unsigned int sThreadIndex = kNullIndex; + #else + __declspec( thread ) static unsigned int sThreadIndex = kNullIndex; + #endif +#else +#ifdef __APPLE__ + #if TARGET_OS_IPHONE + unsigned int sThreadIndex = 0; + return -1; + #else + static __thread unsigned int sThreadIndex = kNullIndex; + #endif +#else//__APPLE__ +#if __linux__ + static __thread unsigned int sThreadIndex = kNullIndex; +#else + unsigned int sThreadIndex = 0; + return -1; +#endif +#endif//__APPLE__ + +#endif + static int gThreadCounter=0; + + if ( sThreadIndex == kNullIndex ) + { + sThreadIndex = gThreadCounter++; + } + return sThreadIndex; +#endif // #else // #if BT_THREADSAFE +} + +void btEnterProfileZoneDefault(const char* name) +{ + CProfileManager::Start_Profile( name ); +} +void btLeaveProfileZoneDefault() +{ + CProfileManager::Stop_Profile(); +} + + +#else +void btEnterProfileZoneDefault(const char* name) +{ +} +void btLeaveProfileZoneDefault() +{ +} #endif //BT_NO_PROFILE + + + + + +static btEnterProfileZoneFunc* bts_enterFunc = btEnterProfileZoneDefault; +static btLeaveProfileZoneFunc* bts_leaveFunc = btLeaveProfileZoneDefault; + +void btEnterProfileZone(const char* name) +{ + (bts_enterFunc)(name); +} +void btLeaveProfileZone() +{ + (bts_leaveFunc)(); +} + +btEnterProfileZoneFunc* btGetCurrentEnterProfileZoneFunc() +{ + return bts_enterFunc ; +} +btLeaveProfileZoneFunc* btGetCurrentLeaveProfileZoneFunc() +{ + return bts_leaveFunc; +} + + +void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc* enterFunc) +{ + bts_enterFunc = enterFunc; +} +void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc* leaveFunc) +{ + bts_leaveFunc = leaveFunc; +} + +CProfileSample::CProfileSample( const char * name ) +{ + btEnterProfileZone(name); +} + +CProfileSample::~CProfileSample( void ) +{ + btLeaveProfileZone(); +} + diff --git a/Engine/lib/bullet/src/LinearMath/btQuickprof.h b/Engine/lib/bullet/src/LinearMath/btQuickprof.h index 49545713b..7b38d71b9 100644 --- a/Engine/lib/bullet/src/LinearMath/btQuickprof.h +++ b/Engine/lib/bullet/src/LinearMath/btQuickprof.h @@ -36,12 +36,14 @@ public: /// Returns the time in ms since the last call to reset or since /// the btClock was created. - unsigned long int getTimeMilliseconds(); + unsigned long long int getTimeMilliseconds(); /// Returns the time in us since the last call to reset or since /// the Clock was created. - unsigned long int getTimeMicroseconds(); + unsigned long long int getTimeMicroseconds(); + unsigned long long int getTimeNanoseconds(); + /// Returns the time in s since the last call to reset or since /// the Clock was created. btScalar getTimeSeconds(); @@ -52,10 +54,28 @@ private: #endif //USE_BT_CLOCK +typedef void (btEnterProfileZoneFunc)(const char* msg); +typedef void (btLeaveProfileZoneFunc)(); +btEnterProfileZoneFunc* btGetCurrentEnterProfileZoneFunc(); +btLeaveProfileZoneFunc* btGetCurrentLeaveProfileZoneFunc(); + + + +void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc* enterFunc); +void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc* leaveFunc); + +#ifndef BT_NO_PROFILE // FIX redefinition //To disable built-in profiling, please comment out next line -#define BT_NO_PROFILE 1 +//#define BT_NO_PROFILE 1 +#endif //BT_NO_PROFILE + #ifndef BT_NO_PROFILE +//btQuickprofGetCurrentThreadIndex will return -1 if thread index cannot be determined, +//otherwise returns thread index in range [0..maxThreads] +unsigned int btQuickprofGetCurrentThreadIndex2(); +const unsigned int BT_QUICKPROF_MAX_THREAD_COUNT = 64; + #include //@todo remove this, backwards compatibility #include "btAlignedAllocator.h" @@ -151,21 +171,21 @@ public: static void Start_Profile( const char * name ); static void Stop_Profile( void ); - static void CleanupMemory(void) - { - Root.CleanupMemory(); - } + static void CleanupMemory(void); +// { +// Root.CleanupMemory(); +// } static void Reset( void ); static void Increment_Frame_Counter( void ); static int Get_Frame_Count_Since_Reset( void ) { return FrameCounter; } static float Get_Time_Since_Reset( void ); - static CProfileIterator * Get_Iterator( void ) - { - - return new CProfileIterator( &Root ); - } + static CProfileIterator * Get_Iterator( void ); +// { +// +// return new CProfileIterator( &Root ); +// } static void Release_Iterator( CProfileIterator * iterator ) { delete ( iterator); } static void dumpRecursive(CProfileIterator* profileIterator, int spacing); @@ -173,37 +193,27 @@ public: static void dumpAll(); private: - static CProfileNode Root; - static CProfileNode * CurrentNode; + static int FrameCounter; static unsigned long int ResetTime; }; + + +#endif //#ifndef BT_NO_PROFILE + ///ProfileSampleClass is a simple way to profile a function's scope ///Use the BT_PROFILE macro at the start of scope to time class CProfileSample { public: - CProfileSample( const char * name ) - { - CProfileManager::Start_Profile( name ); - } + CProfileSample( const char * name ); - ~CProfileSample( void ) - { - CProfileManager::Stop_Profile(); - } + ~CProfileSample( void ); }; - #define BT_PROFILE( name ) CProfileSample __profile( name ) -#else - -#define BT_PROFILE( name ) - -#endif //#ifndef BT_NO_PROFILE - #endif //BT_QUICK_PROF_H diff --git a/Engine/lib/bullet/src/LinearMath/btScalar.h b/Engine/lib/bullet/src/LinearMath/btScalar.h index df907e128..bffb2ce27 100644 --- a/Engine/lib/bullet/src/LinearMath/btScalar.h +++ b/Engine/lib/bullet/src/LinearMath/btScalar.h @@ -12,59 +12,76 @@ subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ - - #ifndef BT_SCALAR_H #define BT_SCALAR_H - #ifdef BT_MANAGED_CODE //Aligned data types not supported in managed code #pragma unmanaged #endif - #include -#include //size_t for MSVC 6.0 +#include //size_t for MSVC 6.0 #include /* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/ -#define BT_BULLET_VERSION 285 +#define BT_BULLET_VERSION 287 -inline int btGetVersion() +inline int btGetVersion() { return BT_BULLET_VERSION; } -#if defined(DEBUG) || defined (_DEBUG) -#define BT_DEBUG + +// The following macro "BT_NOT_EMPTY_FILE" can be put into a file +// in order suppress the MS Visual C++ Linker warning 4221 +// +// warning LNK4221: no public symbols found; archive member will be inaccessible +// +// This warning occurs on PC and XBOX when a file compiles out completely +// has no externally visible symbols which may be dependant on configuration +// #defines and options. +// +// see more https://stackoverflow.com/questions/1822887/what-is-the-best-way-to-eliminate-ms-visual-c-linker-warning-warning-lnk422 + +#if defined (_MSC_VER) + #define BT_NOT_EMPTY_FILE_CAT_II(p, res) res + #define BT_NOT_EMPTY_FILE_CAT_I(a, b) BT_NOT_EMPTY_FILE_CAT_II(~, a ## b) + #define BT_NOT_EMPTY_FILE_CAT(a, b) BT_NOT_EMPTY_FILE_CAT_I(a, b) + #define BT_NOT_EMPTY_FILE namespace { char BT_NOT_EMPTY_FILE_CAT(NoEmptyFileDummy, __COUNTER__); } +#else + #define BT_NOT_EMPTY_FILE #endif +// clang and most formatting tools don't support indentation of preprocessor guards, so turn it off +// clang-format off +#if defined(DEBUG) || defined (_DEBUG) + #define BT_DEBUG +#endif + #ifdef _WIN32 - - #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300) - - #define SIMD_FORCE_INLINE inline - #define ATTRIBUTE_ALIGNED16(a) a - #define ATTRIBUTE_ALIGNED64(a) a - #define ATTRIBUTE_ALIGNED128(a) a - #elif (_M_ARM) - #define SIMD_FORCE_INLINE __forceinline - #define ATTRIBUTE_ALIGNED16(a) __declspec() a - #define ATTRIBUTE_ALIGNED64(a) __declspec() a - #define ATTRIBUTE_ALIGNED128(a) __declspec () a - #else - //#define BT_HAS_ALIGNED_ALLOCATOR - #pragma warning(disable : 4324) // disable padding warning + #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300) + #define SIMD_FORCE_INLINE inline + #define ATTRIBUTE_ALIGNED16(a) a + #define ATTRIBUTE_ALIGNED64(a) a + #define ATTRIBUTE_ALIGNED128(a) a + #elif defined(_M_ARM) + #define SIMD_FORCE_INLINE __forceinline + #define ATTRIBUTE_ALIGNED16(a) __declspec() a + #define ATTRIBUTE_ALIGNED64(a) __declspec() a + #define ATTRIBUTE_ALIGNED128(a) __declspec () a + #else//__MINGW32__ + //#define BT_HAS_ALIGNED_ALLOCATOR + #pragma warning(disable : 4324) // disable padding warning // #pragma warning(disable:4530) // Disable the exception disable but used in MSCV Stl warning. - #pragma warning(disable:4996) //Turn off warnings about deprecated C routines + #pragma warning(disable:4996) //Turn off warnings about deprecated C routines // #pragma warning(disable:4786) // Disable the "debug name too long" warning - #define SIMD_FORCE_INLINE __forceinline - #define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a - #define ATTRIBUTE_ALIGNED64(a) __declspec(align(64)) a - #define ATTRIBUTE_ALIGNED128(a) __declspec (align(128)) a + #define SIMD_FORCE_INLINE __forceinline + #define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a + #define ATTRIBUTE_ALIGNED64(a) __declspec(align(64)) a + #define ATTRIBUTE_ALIGNED128(a) __declspec (align(128)) a #ifdef _XBOX #define BT_USE_VMX128 @@ -100,28 +117,28 @@ inline int btGetVersion() #endif//_XBOX - #endif //__MINGW32__ + #endif //__MINGW32__ -#ifdef BT_DEBUG - #ifdef _MSC_VER - #include - #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }} - #else//_MSC_VER - #include - #define btAssert assert - #endif//_MSC_VER -#else + #ifdef BT_DEBUG + #ifdef _MSC_VER + #include + #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }} + #else//_MSC_VER + #include + #define btAssert assert + #endif//_MSC_VER + #else #define btAssert(x) -#endif + #endif //btFullAssert is optional, slows down a lot #define btFullAssert(x) #define btLikely(_c) _c #define btUnlikely(_c) _c -#else +#else//_WIN32 -#if defined (__CELLOS_LV2__) + #if defined (__CELLOS_LV2__) #define SIMD_FORCE_INLINE inline __attribute__((always_inline)) #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) @@ -129,217 +146,249 @@ inline int btGetVersion() #ifndef assert #include #endif -#ifdef BT_DEBUG -#ifdef __SPU__ -#include -#define printf spu_printf - #define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} -#else - #define btAssert assert -#endif + #ifdef BT_DEBUG + #ifdef __SPU__ + #include + #define printf spu_printf + #define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} + #else + #define btAssert assert + #endif -#else - #define btAssert(x) -#endif + #else//BT_DEBUG + #define btAssert(x) + #endif//BT_DEBUG //btFullAssert is optional, slows down a lot #define btFullAssert(x) #define btLikely(_c) _c #define btUnlikely(_c) _c -#else + #else//defined (__CELLOS_LV2__) -#ifdef USE_LIBSPE2 + #ifdef USE_LIBSPE2 - #define SIMD_FORCE_INLINE __inline - #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) - #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) - #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) - #ifndef assert - #include - #endif -#ifdef BT_DEBUG - #define btAssert assert -#else - #define btAssert(x) -#endif - //btFullAssert is optional, slows down a lot - #define btFullAssert(x) + #define SIMD_FORCE_INLINE __inline + #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) + #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) + #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) + #ifndef assert + #include + #endif + #ifdef BT_DEBUG + #define btAssert assert + #else + #define btAssert(x) + #endif + //btFullAssert is optional, slows down a lot + #define btFullAssert(x) - #define btLikely(_c) __builtin_expect((_c), 1) - #define btUnlikely(_c) __builtin_expect((_c), 0) + #define btLikely(_c) __builtin_expect((_c), 1) + #define btUnlikely(_c) __builtin_expect((_c), 0) -#else + #else//USE_LIBSPE2 //non-windows systems -#if (defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION))) - #if defined (__i386__) || defined (__x86_64__) - #define BT_USE_SIMD_VECTOR3 - #define BT_USE_SSE - //BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries - //if apps run into issues, we will disable the next line - #define BT_USE_SSE_IN_API - #ifdef BT_USE_SSE - // include appropriate SSE level - #if defined (__SSE4_1__) - #include - #elif defined (__SSSE3__) - #include - #elif defined (__SSE3__) - #include - #else - #include - #endif - #endif //BT_USE_SSE - #elif defined( __ARM_NEON__ ) - #ifdef __clang__ - #define BT_USE_NEON 1 - #define BT_USE_SIMD_VECTOR3 + #if (defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION))) + #if defined (__i386__) || defined (__x86_64__) + #define BT_USE_SIMD_VECTOR3 + #define BT_USE_SSE + //BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries + //if apps run into issues, we will disable the next line + #define BT_USE_SSE_IN_API + #ifdef BT_USE_SSE + // include appropriate SSE level + #if defined (__SSE4_1__) + #include + #elif defined (__SSSE3__) + #include + #elif defined (__SSE3__) + #include + #else + #include + #endif + #endif //BT_USE_SSE + #elif defined( __ARM_NEON__ ) + #ifdef __clang__ + #define BT_USE_NEON 1 + #define BT_USE_SIMD_VECTOR3 - #if defined BT_USE_NEON && defined (__clang__) - #include - #endif//BT_USE_NEON - #endif //__clang__ - #endif//__arm__ + #if defined BT_USE_NEON && defined (__clang__) + #include + #endif//BT_USE_NEON + #endif //__clang__ + #endif//__arm__ - #define SIMD_FORCE_INLINE inline __attribute__ ((always_inline)) -///@todo: check out alignment methods for other platforms/compilers - #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) - #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) - #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) - #ifndef assert - #include - #endif + #define SIMD_FORCE_INLINE inline __attribute__ ((always_inline)) + ///@todo: check out alignment methods for other platforms/compilers + #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) + #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) + #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) + #ifndef assert + #include + #endif - #if defined(DEBUG) || defined (_DEBUG) - #if defined (__i386__) || defined (__x86_64__) - #include - #define btAssert(x)\ - {\ - if(!(x))\ - {\ - printf("Assert %s in line %d, file %s\n",#x, __LINE__, __FILE__);\ - asm volatile ("int3");\ - }\ - } - #else//defined (__i386__) || defined (__x86_64__) - #define btAssert assert - #endif//defined (__i386__) || defined (__x86_64__) - #else//defined(DEBUG) || defined (_DEBUG) - #define btAssert(x) - #endif//defined(DEBUG) || defined (_DEBUG) + #if defined(DEBUG) || defined (_DEBUG) + #if defined (__i386__) || defined (__x86_64__) + #include + #define btAssert(x)\ + {\ + if(!(x))\ + {\ + printf("Assert %s in line %d, file %s\n",#x, __LINE__, __FILE__);\ + asm volatile ("int3");\ + }\ + } + #else//defined (__i386__) || defined (__x86_64__) + #define btAssert assert + #endif//defined (__i386__) || defined (__x86_64__) + #else//defined(DEBUG) || defined (_DEBUG) + #define btAssert(x) + #endif//defined(DEBUG) || defined (_DEBUG) - //btFullAssert is optional, slows down a lot - #define btFullAssert(x) - #define btLikely(_c) _c - #define btUnlikely(_c) _c + //btFullAssert is optional, slows down a lot + #define btFullAssert(x) + #define btLikely(_c) _c + #define btUnlikely(_c) _c -#else + #else//__APPLE__ - #define SIMD_FORCE_INLINE inline - ///@todo: check out alignment methods for other platforms/compilers - ///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) - ///#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) - ///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) - #define ATTRIBUTE_ALIGNED16(a) a - #define ATTRIBUTE_ALIGNED64(a) a - #define ATTRIBUTE_ALIGNED128(a) a - #ifndef assert - #include - #endif + #define SIMD_FORCE_INLINE inline + ///@todo: check out alignment methods for other platforms/compilers + ///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) + ///#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) + ///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) + #define ATTRIBUTE_ALIGNED16(a) a + #define ATTRIBUTE_ALIGNED64(a) a + #define ATTRIBUTE_ALIGNED128(a) a + #ifndef assert + #include + #endif -#if defined(DEBUG) || defined (_DEBUG) - #define btAssert assert -#else - #define btAssert(x) -#endif + #if defined(DEBUG) || defined (_DEBUG) + #define btAssert assert + #else + #define btAssert(x) + #endif - //btFullAssert is optional, slows down a lot - #define btFullAssert(x) - #define btLikely(_c) _c - #define btUnlikely(_c) _c -#endif //__APPLE__ - -#endif // LIBSPE2 - -#endif //__CELLOS_LV2__ -#endif + //btFullAssert is optional, slows down a lot + #define btFullAssert(x) + #define btLikely(_c) _c + #define btUnlikely(_c) _c + #endif //__APPLE__ + #endif // LIBSPE2 + #endif //__CELLOS_LV2__ +#endif//_WIN32 ///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision. #if defined(BT_USE_DOUBLE_PRECISION) - -typedef double btScalar; -//this number could be bigger in double precision -#define BT_LARGE_FLOAT 1e30 + typedef double btScalar; + //this number could be bigger in double precision + #define BT_LARGE_FLOAT 1e30 #else - -typedef float btScalar; -//keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX -#define BT_LARGE_FLOAT 1e18f + typedef float btScalar; + //keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX + #define BT_LARGE_FLOAT 1e18f #endif #ifdef BT_USE_SSE -typedef __m128 btSimdFloat4; -#endif//BT_USE_SSE + typedef __m128 btSimdFloat4; +#endif //BT_USE_SSE -#if defined (BT_USE_SSE) -//#if defined BT_USE_SSE_IN_API && defined (BT_USE_SSE) -#ifdef _WIN32 +#if defined(BT_USE_SSE) + //#if defined BT_USE_SSE_IN_API && defined (BT_USE_SSE) + #ifdef _WIN32 -#ifndef BT_NAN -static int btNanMask = 0x7F800001; -#define BT_NAN (*(float*)&btNanMask) -#endif + #ifndef BT_NAN + static int btNanMask = 0x7F800001; + #define BT_NAN (*(float *)&btNanMask) + #endif -#ifndef BT_INFINITY -static int btInfinityMask = 0x7F800000; -#define BT_INFINITY (*(float*)&btInfinityMask) -inline int btGetInfinityMask()//suppress stupid compiler warning -{ - return btInfinityMask; -} -#endif + #ifndef BT_INFINITY + static int btInfinityMask = 0x7F800000; + #define BT_INFINITY (*(float *)&btInfinityMask) + inline int btGetInfinityMask() //suppress stupid compiler warning + { + return btInfinityMask; + } + #endif -//use this, in case there are clashes (such as xnamath.h) -#ifndef BT_NO_SIMD_OPERATOR_OVERLOADS -inline __m128 operator + (const __m128 A, const __m128 B) -{ - return _mm_add_ps(A, B); -} -inline __m128 operator - (const __m128 A, const __m128 B) -{ - return _mm_sub_ps(A, B); -} -inline __m128 operator * (const __m128 A, const __m128 B) -{ - return _mm_mul_ps(A, B); -} -#endif //BT_NO_SIMD_OPERATOR_OVERLOADS + //use this, in case there are clashes (such as xnamath.h) + #ifndef BT_NO_SIMD_OPERATOR_OVERLOADS + inline __m128 operator+(const __m128 A, const __m128 B) + { + return _mm_add_ps(A, B); + } -#define btCastfTo128i(a) (_mm_castps_si128(a)) -#define btCastfTo128d(a) (_mm_castps_pd(a)) -#define btCastiTo128f(a) (_mm_castsi128_ps(a)) -#define btCastdTo128f(a) (_mm_castpd_ps(a)) -#define btCastdTo128i(a) (_mm_castpd_si128(a)) -#define btAssign128(r0,r1,r2,r3) _mm_setr_ps(r0,r1,r2,r3) + inline __m128 operator-(const __m128 A, const __m128 B) + { + return _mm_sub_ps(A, B); + } -#else//_WIN32 + inline __m128 operator*(const __m128 A, const __m128 B) + { + return _mm_mul_ps(A, B); + } + #endif //BT_NO_SIMD_OPERATOR_OVERLOADS -#define btCastfTo128i(a) ((__m128i)(a)) -#define btCastfTo128d(a) ((__m128d)(a)) -#define btCastiTo128f(a) ((__m128) (a)) -#define btCastdTo128f(a) ((__m128) (a)) -#define btCastdTo128i(a) ((__m128i)(a)) -#define btAssign128(r0,r1,r2,r3) (__m128){r0,r1,r2,r3} -#define BT_INFINITY INFINITY -#define BT_NAN NAN -#endif//_WIN32 -#else + #define btCastfTo128i(a) (_mm_castps_si128(a)) + #define btCastfTo128d(a) (_mm_castps_pd(a)) + #define btCastiTo128f(a) (_mm_castsi128_ps(a)) + #define btCastdTo128f(a) (_mm_castpd_ps(a)) + #define btCastdTo128i(a) (_mm_castpd_si128(a)) + #define btAssign128(r0, r1, r2, r3) _mm_setr_ps(r0, r1, r2, r3) + + #else //_WIN32 + + #define btCastfTo128i(a) ((__m128i)(a)) + #define btCastfTo128d(a) ((__m128d)(a)) + #define btCastiTo128f(a) ((__m128)(a)) + #define btCastdTo128f(a) ((__m128)(a)) + #define btCastdTo128i(a) ((__m128i)(a)) + #define btAssign128(r0, r1, r2, r3) \ + (__m128) { r0, r1, r2, r3 } + #define BT_INFINITY INFINITY + #define BT_NAN NAN + #endif //_WIN32 +#else//BT_USE_SSE + + #ifdef BT_USE_NEON + #include + + typedef float32x4_t btSimdFloat4; + #define BT_INFINITY INFINITY + #define BT_NAN NAN + #define btAssign128(r0, r1, r2, r3) \ + (float32x4_t) { r0, r1, r2, r3 } + #else //BT_USE_NEON + + #ifndef BT_INFINITY + struct btInfMaskConverter + { + union { + float mask; + int intmask; + }; + btInfMaskConverter(int _mask = 0x7F800000) + : intmask(_mask) + { + } + }; + static btInfMaskConverter btInfinityMask = 0x7F800000; + #define BT_INFINITY (btInfinityMask.mask) + inline int btGetInfinityMask() //suppress stupid compiler warning + { + return btInfinityMask.intmask; + } + #endif + #endif //BT_USE_NEON + +#endif //BT_USE_SSE #ifdef BT_USE_NEON #include @@ -347,193 +396,181 @@ inline __m128 operator * (const __m128 A, const __m128 B) typedef float32x4_t btSimdFloat4; #define BT_INFINITY INFINITY #define BT_NAN NAN - #define btAssign128(r0,r1,r2,r3) (float32x4_t){r0,r1,r2,r3} -#else//BT_USE_NEON - - #ifndef BT_INFINITY - struct btInfMaskConverter - { - union { - float mask; - int intmask; - }; - btInfMaskConverter(int mask=0x7F800000) - :intmask(mask) - { - } - }; - static btInfMaskConverter btInfinityMask = 0x7F800000; - #define BT_INFINITY (btInfinityMask.mask) - inline int btGetInfinityMask()//suppress stupid compiler warning - { - return btInfinityMask.intmask; - } - #endif + #define btAssign128(r0, r1, r2, r3) \ + (float32x4_t) { r0, r1, r2, r3 } #endif//BT_USE_NEON -#endif //BT_USE_SSE - -#ifdef BT_USE_NEON -#include - -typedef float32x4_t btSimdFloat4; -#define BT_INFINITY INFINITY -#define BT_NAN NAN -#define btAssign128(r0,r1,r2,r3) (float32x4_t){r0,r1,r2,r3} -#endif - - - - - -#define BT_DECLARE_ALIGNED_ALLOCATOR() \ - SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ - SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); } \ - SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; } \ - SIMD_FORCE_INLINE void operator delete(void*, void*) { } \ - SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ - SIMD_FORCE_INLINE void operator delete[](void* ptr) { btAlignedFree(ptr); } \ - SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; } \ - SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \ - - +#define BT_DECLARE_ALIGNED_ALLOCATOR() \ + SIMD_FORCE_INLINE void *operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); } \ + SIMD_FORCE_INLINE void operator delete(void *ptr) { btAlignedFree(ptr); } \ + SIMD_FORCE_INLINE void *operator new(size_t, void *ptr) { return ptr; } \ + SIMD_FORCE_INLINE void operator delete(void *, void *) {} \ + SIMD_FORCE_INLINE void *operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); } \ + SIMD_FORCE_INLINE void operator delete[](void *ptr) { btAlignedFree(ptr); } \ + SIMD_FORCE_INLINE void *operator new[](size_t, void *ptr) { return ptr; } \ + SIMD_FORCE_INLINE void operator delete[](void *, void *) {} #if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS) - -SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) { return sqrt(x); } -SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); } -SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); } -SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); } -SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); } -SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { if (xbtScalar(1)) x=btScalar(1); return acos(x); } -SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { if (xbtScalar(1)) x=btScalar(1); return asin(x); } -SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); } -SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x, y); } -SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); } -SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); } -SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); } -SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmod(x,y); } -#else - -SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) -{ -#ifdef USE_APPROXIMATION -#ifdef __LP64__ - float xhalf = 0.5f*y; - int i = *(int*)&y; - i = 0x5f375a86 - (i>>1); - y = *(float*)&i; - y = y*(1.5f - xhalf*y*y); - y = y*(1.5f - xhalf*y*y); - y = y*(1.5f - xhalf*y*y); - y=1/y; - return y; -#else - double x, z, tempf; - unsigned long *tfptr = ((unsigned long *)&tempf) + 1; - tempf = y; - *tfptr = (0xbfcdd90a - *tfptr)>>1; /* estimate of 1/sqrt(y) */ - x = tempf; - z = y*btScalar(0.5); - x = (btScalar(1.5)*x)-(x*x)*(x*z); /* iteration formula */ - x = (btScalar(1.5)*x)-(x*x)*(x*z); - x = (btScalar(1.5)*x)-(x*x)*(x*z); - x = (btScalar(1.5)*x)-(x*x)*(x*z); - x = (btScalar(1.5)*x)-(x*x)*(x*z); - return x*y; -#endif -#else - return sqrtf(y); -#endif -} -SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabsf(x); } -SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); } -SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); } -SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); } -SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { - if (xbtScalar(1)) - x=btScalar(1); - return acosf(x); -} -SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { - if (xbtScalar(1)) - x=btScalar(1); - return asinf(x); -} -SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); } -SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); } -SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); } -SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); } -SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); } -SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmodf(x,y); } - -#endif + SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) + { + return sqrt(x); + } + SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); } + SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); } + SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); } + SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); } + SIMD_FORCE_INLINE btScalar btAcos(btScalar x) + { + if (x < btScalar(-1)) x = btScalar(-1); + if (x > btScalar(1)) x = btScalar(1); + return acos(x); + } + SIMD_FORCE_INLINE btScalar btAsin(btScalar x) + { + if (x < btScalar(-1)) x = btScalar(-1); + if (x > btScalar(1)) x = btScalar(1); + return asin(x); + } + SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); } + SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x, y); } + SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); } + SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); } + SIMD_FORCE_INLINE btScalar btPow(btScalar x, btScalar y) { return pow(x, y); } + SIMD_FORCE_INLINE btScalar btFmod(btScalar x, btScalar y) { return fmod(x, y); } -#define SIMD_PI btScalar(3.1415926535897932384626433832795029) -#define SIMD_2_PI (btScalar(2.0) * SIMD_PI) -#define SIMD_HALF_PI (SIMD_PI * btScalar(0.5)) +#else//BT_USE_DOUBLE_PRECISION + + SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) + { + #ifdef USE_APPROXIMATION + #ifdef __LP64__ + float xhalf = 0.5f * y; + int i = *(int *)&y; + i = 0x5f375a86 - (i >> 1); + y = *(float *)&i; + y = y * (1.5f - xhalf * y * y); + y = y * (1.5f - xhalf * y * y); + y = y * (1.5f - xhalf * y * y); + y = 1 / y; + return y; + #else + double x, z, tempf; + unsigned long *tfptr = ((unsigned long *)&tempf) + 1; + tempf = y; + *tfptr = (0xbfcdd90a - *tfptr) >> 1; /* estimate of 1/sqrt(y) */ + x = tempf; + z = y * btScalar(0.5); + x = (btScalar(1.5) * x) - (x * x) * (x * z); /* iteration formula */ + x = (btScalar(1.5) * x) - (x * x) * (x * z); + x = (btScalar(1.5) * x) - (x * x) * (x * z); + x = (btScalar(1.5) * x) - (x * x) * (x * z); + x = (btScalar(1.5) * x) - (x * x) * (x * z); + return x * y; + #endif + #else + return sqrtf(y); + #endif + } + SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabsf(x); } + SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); } + SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); } + SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); } + SIMD_FORCE_INLINE btScalar btAcos(btScalar x) + { + if (x < btScalar(-1)) + x = btScalar(-1); + if (x > btScalar(1)) + x = btScalar(1); + return acosf(x); + } + SIMD_FORCE_INLINE btScalar btAsin(btScalar x) + { + if (x < btScalar(-1)) + x = btScalar(-1); + if (x > btScalar(1)) + x = btScalar(1); + return asinf(x); + } + SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); } + SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); } + SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); } + SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); } + SIMD_FORCE_INLINE btScalar btPow(btScalar x, btScalar y) { return powf(x, y); } + SIMD_FORCE_INLINE btScalar btFmod(btScalar x, btScalar y) { return fmodf(x, y); } + +#endif//BT_USE_DOUBLE_PRECISION + +#define SIMD_PI btScalar(3.1415926535897932384626433832795029) +#define SIMD_2_PI (btScalar(2.0) * SIMD_PI) +#define SIMD_HALF_PI (SIMD_PI * btScalar(0.5)) #define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0)) -#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) +#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) #define SIMDSQRT12 btScalar(0.7071067811865475244008443621048490) - -#define btRecipSqrt(x) ((btScalar)(btScalar(1.0)/btSqrt(btScalar(x)))) /* reciprocal square root */ -#define btRecip(x) (btScalar(1.0)/btScalar(x)) +#define btRecipSqrt(x) ((btScalar)(btScalar(1.0) / btSqrt(btScalar(x)))) /* reciprocal square root */ +#define btRecip(x) (btScalar(1.0) / btScalar(x)) #ifdef BT_USE_DOUBLE_PRECISION -#define SIMD_EPSILON DBL_EPSILON -#define SIMD_INFINITY DBL_MAX -#define BT_ONE 1.0 -#define BT_ZERO 0.0 -#define BT_TWO 2.0 -#define BT_HALF 0.5 + #define SIMD_EPSILON DBL_EPSILON + #define SIMD_INFINITY DBL_MAX + #define BT_ONE 1.0 + #define BT_ZERO 0.0 + #define BT_TWO 2.0 + #define BT_HALF 0.5 #else -#define SIMD_EPSILON FLT_EPSILON -#define SIMD_INFINITY FLT_MAX -#define BT_ONE 1.0f -#define BT_ZERO 0.0f -#define BT_TWO 2.0f -#define BT_HALF 0.5f + #define SIMD_EPSILON FLT_EPSILON + #define SIMD_INFINITY FLT_MAX + #define BT_ONE 1.0f + #define BT_ZERO 0.0f + #define BT_TWO 2.0f + #define BT_HALF 0.5f #endif -SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x) +// clang-format on + +SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x) { btScalar coeff_1 = SIMD_PI / 4.0f; btScalar coeff_2 = 3.0f * coeff_1; btScalar abs_y = btFabs(y); btScalar angle; - if (x >= 0.0f) { + if (x >= 0.0f) + { btScalar r = (x - abs_y) / (x + abs_y); angle = coeff_1 - coeff_1 * r; - } else { + } + else + { btScalar r = (x + abs_y) / (abs_y - x); angle = coeff_2 - coeff_1 * r; } return (y < 0.0f) ? -angle : angle; } -SIMD_FORCE_INLINE bool btFuzzyZero(btScalar x) { return btFabs(x) < SIMD_EPSILON; } +SIMD_FORCE_INLINE bool btFuzzyZero(btScalar x) { return btFabs(x) < SIMD_EPSILON; } -SIMD_FORCE_INLINE bool btEqual(btScalar a, btScalar eps) { +SIMD_FORCE_INLINE bool btEqual(btScalar a, btScalar eps) +{ return (((a) <= eps) && !((a) < -eps)); } -SIMD_FORCE_INLINE bool btGreaterEqual (btScalar a, btScalar eps) { +SIMD_FORCE_INLINE bool btGreaterEqual(btScalar a, btScalar eps) +{ return (!((a) <= eps)); } - -SIMD_FORCE_INLINE int btIsNegative(btScalar x) { - return x < btScalar(0.0) ? 1 : 0; +SIMD_FORCE_INLINE int btIsNegative(btScalar x) +{ + return x < btScalar(0.0) ? 1 : 0; } SIMD_FORCE_INLINE btScalar btRadians(btScalar x) { return x * SIMD_RADS_PER_DEG; } SIMD_FORCE_INLINE btScalar btDegrees(btScalar x) { return x * SIMD_DEGS_PER_RAD; } -#define BT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name +#define BT_DECLARE_HANDLE(name) \ + typedef struct name##__ \ + { \ + int unused; \ + } * name #ifndef btFsel SIMD_FORCE_INLINE btScalar btFsel(btScalar a, btScalar b, btScalar c) @@ -541,60 +578,57 @@ SIMD_FORCE_INLINE btScalar btFsel(btScalar a, btScalar b, btScalar c) return a >= 0 ? b : c; } #endif -#define btFsels(a,b,c) (btScalar)btFsel(a,b,c) - +#define btFsels(a, b, c) (btScalar) btFsel(a, b, c) SIMD_FORCE_INLINE bool btMachineIsLittleEndian() { - long int i = 1; - const char *p = (const char *) &i; - if (p[0] == 1) // Lowest address contains the least significant byte - return true; - else - return false; + long int i = 1; + const char *p = (const char *)&i; + if (p[0] == 1) // Lowest address contains the least significant byte + return true; + else + return false; } - - ///btSelect avoids branches, which makes performance much better for consoles like Playstation 3 and XBox 360 ///Thanks Phil Knight. See also http://www.cellperformance.com/articles/2006/04/more_techniques_for_eliminatin_1.html -SIMD_FORCE_INLINE unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero) +SIMD_FORCE_INLINE unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero) { - // Set testNz to 0xFFFFFFFF if condition is nonzero, 0x00000000 if condition is zero - // Rely on positive value or'ed with its negative having sign bit on - // and zero value or'ed with its negative (which is still zero) having sign bit off - // Use arithmetic shift right, shifting the sign bit through all 32 bits - unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); - unsigned testEqz = ~testNz; - return ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); + // Set testNz to 0xFFFFFFFF if condition is nonzero, 0x00000000 if condition is zero + // Rely on positive value or'ed with its negative having sign bit on + // and zero value or'ed with its negative (which is still zero) having sign bit off + // Use arithmetic shift right, shifting the sign bit through all 32 bits + unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); + unsigned testEqz = ~testNz; + return ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); } SIMD_FORCE_INLINE int btSelect(unsigned condition, int valueIfConditionNonZero, int valueIfConditionZero) { - unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); - unsigned testEqz = ~testNz; - return static_cast((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); + unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); + unsigned testEqz = ~testNz; + return static_cast((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); } SIMD_FORCE_INLINE float btSelect(unsigned condition, float valueIfConditionNonZero, float valueIfConditionZero) { #ifdef BT_HAVE_NATIVE_FSEL - return (float)btFsel((btScalar)condition - btScalar(1.0f), valueIfConditionNonZero, valueIfConditionZero); + return (float)btFsel((btScalar)condition - btScalar(1.0f), valueIfConditionNonZero, valueIfConditionZero); #else - return (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero; + return (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero; #endif } -template SIMD_FORCE_INLINE void btSwap(T& a, T& b) +template +SIMD_FORCE_INLINE void btSwap(T &a, T &b) { T tmp = a; a = b; b = tmp; } - //PCK: endian swapping functions SIMD_FORCE_INLINE unsigned btSwapEndian(unsigned val) { - return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24)); + return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24)); } SIMD_FORCE_INLINE unsigned short btSwapEndian(unsigned short val) @@ -609,127 +643,127 @@ SIMD_FORCE_INLINE unsigned btSwapEndian(int val) SIMD_FORCE_INLINE unsigned short btSwapEndian(short val) { - return btSwapEndian((unsigned short) val); + return btSwapEndian((unsigned short)val); } ///btSwapFloat uses using char pointers to swap the endianness ////btSwapFloat/btSwapDouble will NOT return a float, because the machine might 'correct' invalid floating point values -///Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. -///When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. -///In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. +///Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. +///When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. +///In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. ///so instead of returning a float/double, we return integer/long long integer -SIMD_FORCE_INLINE unsigned int btSwapEndianFloat(float d) +SIMD_FORCE_INLINE unsigned int btSwapEndianFloat(float d) { - unsigned int a = 0; - unsigned char *dst = (unsigned char *)&a; - unsigned char *src = (unsigned char *)&d; + unsigned int a = 0; + unsigned char *dst = (unsigned char *)&a; + unsigned char *src = (unsigned char *)&d; - dst[0] = src[3]; - dst[1] = src[2]; - dst[2] = src[1]; - dst[3] = src[0]; - return a; + dst[0] = src[3]; + dst[1] = src[2]; + dst[2] = src[1]; + dst[3] = src[0]; + return a; } // unswap using char pointers -SIMD_FORCE_INLINE float btUnswapEndianFloat(unsigned int a) +SIMD_FORCE_INLINE float btUnswapEndianFloat(unsigned int a) { - float d = 0.0f; - unsigned char *src = (unsigned char *)&a; - unsigned char *dst = (unsigned char *)&d; + float d = 0.0f; + unsigned char *src = (unsigned char *)&a; + unsigned char *dst = (unsigned char *)&d; - dst[0] = src[3]; - dst[1] = src[2]; - dst[2] = src[1]; - dst[3] = src[0]; - - return d; -} - - -// swap using char pointers -SIMD_FORCE_INLINE void btSwapEndianDouble(double d, unsigned char* dst) -{ - unsigned char *src = (unsigned char *)&d; - - dst[0] = src[7]; - dst[1] = src[6]; - dst[2] = src[5]; - dst[3] = src[4]; - dst[4] = src[3]; - dst[5] = src[2]; - dst[6] = src[1]; - dst[7] = src[0]; - -} - -// unswap using char pointers -SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char *src) -{ - double d = 0.0; - unsigned char *dst = (unsigned char *)&d; - - dst[0] = src[7]; - dst[1] = src[6]; - dst[2] = src[5]; - dst[3] = src[4]; - dst[4] = src[3]; - dst[5] = src[2]; - dst[6] = src[1]; - dst[7] = src[0]; + dst[0] = src[3]; + dst[1] = src[2]; + dst[2] = src[1]; + dst[3] = src[0]; return d; } -template -SIMD_FORCE_INLINE void btSetZero(T* a, int n) +// swap using char pointers +SIMD_FORCE_INLINE void btSwapEndianDouble(double d, unsigned char *dst) { - T* acurr = a; - size_t ncurr = n; - while (ncurr > 0) - { - *(acurr++) = 0; - --ncurr; - } + unsigned char *src = (unsigned char *)&d; + + dst[0] = src[7]; + dst[1] = src[6]; + dst[2] = src[5]; + dst[3] = src[4]; + dst[4] = src[3]; + dst[5] = src[2]; + dst[6] = src[1]; + dst[7] = src[0]; } +// unswap using char pointers +SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char *src) +{ + double d = 0.0; + unsigned char *dst = (unsigned char *)&d; + + dst[0] = src[7]; + dst[1] = src[6]; + dst[2] = src[5]; + dst[3] = src[4]; + dst[4] = src[3]; + dst[5] = src[2]; + dst[6] = src[1]; + dst[7] = src[0]; + + return d; +} + +template +SIMD_FORCE_INLINE void btSetZero(T *a, int n) +{ + T *acurr = a; + size_t ncurr = n; + while (ncurr > 0) + { + *(acurr++) = 0; + --ncurr; + } +} SIMD_FORCE_INLINE btScalar btLargeDot(const btScalar *a, const btScalar *b, int n) -{ - btScalar p0,q0,m0,p1,q1,m1,sum; - sum = 0; - n -= 2; - while (n >= 0) { - p0 = a[0]; q0 = b[0]; - m0 = p0 * q0; - p1 = a[1]; q1 = b[1]; - m1 = p1 * q1; - sum += m0; - sum += m1; - a += 2; - b += 2; - n -= 2; - } - n += 2; - while (n > 0) { - sum += (*a) * (*b); - a++; - b++; - n--; - } - return sum; +{ + btScalar p0, q0, m0, p1, q1, m1, sum; + sum = 0; + n -= 2; + while (n >= 0) + { + p0 = a[0]; + q0 = b[0]; + m0 = p0 * q0; + p1 = a[1]; + q1 = b[1]; + m1 = p1 * q1; + sum += m0; + sum += m1; + a += 2; + b += 2; + n -= 2; + } + n += 2; + while (n > 0) + { + sum += (*a) * (*b); + a++; + b++; + n--; + } + return sum; } - // returns normalized value in range [-SIMD_PI, SIMD_PI] -SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians) +SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians) { angleInRadians = btFmod(angleInRadians, SIMD_2_PI); - if(angleInRadians < -SIMD_PI) + if (angleInRadians < -SIMD_PI) { return angleInRadians + SIMD_2_PI; } - else if(angleInRadians > SIMD_PI) + else if (angleInRadians > SIMD_PI) { return angleInRadians - SIMD_2_PI; } @@ -739,45 +773,38 @@ SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians) } } - - ///rudimentary class to provide type info struct btTypedObject { btTypedObject(int objectType) - :m_objectType(objectType) + : m_objectType(objectType) { } - int m_objectType; + int m_objectType; inline int getObjectType() const { return m_objectType; } }; - - ///align a pointer to the provided alignment, upwards -template T* btAlignPointer(T* unalignedPtr, size_t alignment) +template +T *btAlignPointer(T *unalignedPtr, size_t alignment) { - struct btConvertPointerSizeT { - union - { - T* ptr; - size_t integer; + union { + T *ptr; + size_t integer; }; }; - btConvertPointerSizeT converter; - - + btConvertPointerSizeT converter; + const size_t bit_mask = ~(alignment - 1); - converter.ptr = unalignedPtr; - converter.integer += alignment-1; + converter.ptr = unalignedPtr; + converter.integer += alignment - 1; converter.integer &= bit_mask; return converter.ptr; } - -#endif //BT_SCALAR_H +#endif //BT_SCALAR_H diff --git a/Engine/lib/bullet/src/LinearMath/btSerializer.cpp b/Engine/lib/bullet/src/LinearMath/btSerializer.cpp index 2b5740b40..fcd2255ad 100644 --- a/Engine/lib/bullet/src/LinearMath/btSerializer.cpp +++ b/Engine/lib/bullet/src/LinearMath/btSerializer.cpp @@ -1,5 +1,5 @@ char sBulletDNAstr[]= { -char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-128),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), +char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-124),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), char(95),char(99),char(97),char(112),char(97),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(100),char(97),char(116),char(97),char(0),char(109),char(95), char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(115),char(0),char(109),char(95),char(99),char(111), char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(115),char(0),char(109),char(95),char(99),char(111),char(110), @@ -306,884 +306,294 @@ char(117),char(110),char(116),char(0),char(109),char(95),char(106),char(111),cha char(106),char(111),char(105),char(110),char(116),char(86),char(101),char(108),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(84), char(111),char(114),char(113),char(117),char(101),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(68),char(97),char(109),char(112), char(105),char(110),char(103),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116), -char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114), -char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115), -char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97), -char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115), -char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101), -char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(0),char(0),char(0),char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0), -char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115),char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104), -char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103),char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102), -char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0),char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105), -char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116),char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83), -char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97),char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99), -char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116), -char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116), -char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117), -char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102), -char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), -char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101), -char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108), -char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), -char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97), -char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104), -char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114), -char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101), -char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80), -char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101), -char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114), +char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95), +char(106),char(111),char(105),char(110),char(116),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(106),char(111), +char(105),char(110),char(116),char(77),char(97),char(120),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(77), +char(97),char(120),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97), +char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108), +char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105), +char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97), +char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97), +char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78), +char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0), +char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0),char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115), +char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104),char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103), +char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102),char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0), +char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105),char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116), +char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83),char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97), +char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108), +char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114), +char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111), +char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117), +char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), +char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101), +char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122), +char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110), +char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97), +char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114), +char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116), +char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97),char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), +char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104), +char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110), +char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114), char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101), -char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117), -char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117), -char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103), -char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116), -char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118), -char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111), -char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117),char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68), char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99), -char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116), -char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115), -char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121), -char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68), -char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111), -char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70), -char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111), -char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114), -char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105), -char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108), -char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110), -char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72), -char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), +char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115), +char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111), +char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70), +char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121), +char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100), +char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114), +char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111),char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84), +char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112), +char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), +char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111), +char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80), +char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67), -char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50), -char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84), -char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), +char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117), +char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116), char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110), -char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101), -char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116), -char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71), -char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105), -char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100), -char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83), -char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111), -char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83), -char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0), -char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), -char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111), -char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84), -char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110), -char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110), -char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101), -char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107), -char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111), -char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117), -char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116), -char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0), -char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0), -char(8),char(0),char(0),char(0),char(12),char(0),char(36),char(0),char(8),char(0),char(16),char(0),char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0), -char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0),char(16),char(0),char(84),char(0),char(-124),char(0),char(12),char(0), -char(52),char(0),char(52),char(0),char(20),char(0),char(64),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(4),char(0),char(32),char(0),char(28),char(0), -char(60),char(0),char(56),char(0),char(76),char(0),char(76),char(0),char(24),char(0),char(60),char(0),char(60),char(0),char(60),char(0),char(16),char(0),char(64),char(0), -char(68),char(0),char(-32),char(1),char(8),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0),char(104),char(0),char(-16),char(1),char(-80),char(3),char(8),char(0), -char(52),char(0),char(52),char(0),char(0),char(0),char(68),char(0),char(84),char(0),char(-124),char(0),char(116),char(0),char(92),char(1),char(-36),char(0),char(-116),char(1), -char(124),char(1),char(-44),char(0),char(-4),char(0),char(-52),char(1),char(92),char(1),char(116),char(2),char(-124),char(2),char(-76),char(4),char(-52),char(0),char(108),char(1), -char(92),char(0),char(-116),char(0),char(16),char(0),char(100),char(0),char(20),char(0),char(36),char(0),char(100),char(0),char(92),char(0),char(104),char(0),char(-64),char(0), -char(92),char(1),char(104),char(0),char(-76),char(1),char(-48),char(2),char(120),char(1),char(-64),char(0),char(100),char(0),char(0),char(0),char(83),char(84),char(82),char(67), -char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0),char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0), -char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0),char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0), -char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0), -char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0), -char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0),char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0), -char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0),char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0), -char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0), -char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0), -char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0),char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0), -char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0), -char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0),char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0), -char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), -char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0), -char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0),char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0), -char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0), -char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0),char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0), -char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0),char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0), -char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0), -char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0),char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0), -char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0),char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0), -char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0),char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0), -char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0),char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0), -char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0),char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0), -char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0),char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0), -char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0),char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0), -char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0),char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0), -char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0),char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0), -char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0),char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0), -char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0),char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0), -char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0), -char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0), -char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0),char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0), -char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0),char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0), -char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0),char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0), -char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0),char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0), -char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0), -char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0),char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0), -char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0),char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0), -char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0), -char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0),char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0), -char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0),char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), +char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), +char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110), +char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54), +char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114), +char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112), +char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), +char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97), +char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114), +char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101), +char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116), +char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83), +char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84),char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110),char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110),char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116), +char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100), +char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108), +char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111), +char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0),char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0), +char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(0),char(0),char(12),char(0),char(36),char(0),char(8),char(0),char(16),char(0), +char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0),char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0), +char(16),char(0),char(84),char(0),char(-124),char(0),char(12),char(0),char(52),char(0),char(52),char(0),char(20),char(0),char(64),char(0),char(4),char(0),char(4),char(0), +char(8),char(0),char(4),char(0),char(32),char(0),char(28),char(0),char(60),char(0),char(56),char(0),char(76),char(0),char(76),char(0),char(24),char(0),char(60),char(0), +char(60),char(0),char(60),char(0),char(16),char(0),char(64),char(0),char(68),char(0),char(-32),char(1),char(8),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0), +char(104),char(0),char(-16),char(1),char(-80),char(3),char(8),char(0),char(52),char(0),char(52),char(0),char(0),char(0),char(68),char(0),char(84),char(0),char(-124),char(0), +char(116),char(0),char(92),char(1),char(-36),char(0),char(-116),char(1),char(124),char(1),char(-44),char(0),char(-4),char(0),char(-52),char(1),char(92),char(1),char(116),char(2), +char(-124),char(2),char(-76),char(4),char(-52),char(0),char(108),char(1),char(92),char(0),char(-116),char(0),char(16),char(0),char(100),char(0),char(20),char(0),char(36),char(0), +char(100),char(0),char(92),char(0),char(104),char(0),char(-64),char(0),char(92),char(1),char(104),char(0),char(-76),char(1),char(-16),char(2),char(-120),char(1),char(-64),char(0), +char(100),char(0),char(0),char(0),char(83),char(84),char(82),char(67),char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0), +char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0),char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0), +char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0),char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0), +char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0), +char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0), +char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0),char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0), +char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0),char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0), +char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0), +char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0), +char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0), +char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0), +char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0),char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0), +char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0), +char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0), +char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), +char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0), +char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0), +char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0), +char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0), +char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0),char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0), +char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0),char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0), +char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0),char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0), +char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0),char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0), +char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0),char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0), +char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0),char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0), +char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0),char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0), +char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0), +char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0),char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0), +char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0),char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0), +char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0),char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0), +char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0), +char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0), +char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0), +char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0),char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0), +char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0),char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0), +char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0),char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0), +char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0),char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0), +char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0), +char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0),char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0), +char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0), +char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0),char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0), +char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0), +char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0), +char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0), +char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0), +char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0), +char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0),char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0), +char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0),char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0),char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0), -char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0), -char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0),char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0), -char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0), -char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0), -char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0), -char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0), -char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0),char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0), -char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0),char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0), -char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), -char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0),char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0), -char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0), -char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0),char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0), -char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0),char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0), -char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0), -char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0),char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0), -char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0),char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0), -char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0),char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0), -char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0),char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0), -char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0),char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0), -char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0), -char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0),char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0), -char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0),char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0), -char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0),char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0), -char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0),char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), -char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0),char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0), -char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), -char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), -char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0), -char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0), -char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0), -char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0),char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0), -char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0), -char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0), -char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0), -char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0), -char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), -char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0), -char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0), -char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0), -char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0), -char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0),char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0), -char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0),char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0),char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0), -char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0), -char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0), -char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0), -char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0), -char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), -char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0), -char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0),char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0), -char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0),char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0), -char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0), -char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0),char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0), -char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0),char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0), -char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0), -char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0), -char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0), -char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0),char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0), -char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0),char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0), -char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), -char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0), -char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0),char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0), -char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0),char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0), +char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0),char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0), +char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0), +char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0),char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0), +char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0),char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0), +char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0), +char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0),char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0), +char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0),char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0), +char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), +char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0), +char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0),char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0), +char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0),char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0), +char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0),char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0), +char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0),char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0), +char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0),char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), +char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0),char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0), +char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0),char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0), +char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0),char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0), +char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0),char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0), +char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0), +char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0),char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0), +char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0), +char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0), +char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0),char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0), +char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0), +char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0), +char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), +char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), +char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0), +char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0),char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0), +char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0), +char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0), +char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0), +char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0), +char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), +char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0),char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0), +char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0), +char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0), +char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0), +char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0),char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), +char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), +char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0), +char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0),char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0), +char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0),char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0), +char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0), +char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0),char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0), +char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0),char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0), +char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), +char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0), +char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0),char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0), +char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0),char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0), char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0), -char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0), -char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0),char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), -char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0),char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0),char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0), -char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0), -char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0),char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0), -char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0),char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0), -char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0),char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0), -char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0),char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0), -char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1),char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1),char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1),char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1), -char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1),char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1), -char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1),char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1), -char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1),char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1), -char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1),char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1), -char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1),char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1), -char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1),char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1), -char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1),char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0), -char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1),char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1), -char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1),char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1), -char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0),char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1), -char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1), -char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1),char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1), -char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1),char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1), -char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1),char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1), -char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1),char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1), -char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1),char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1), -char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1),char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1), -char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0), -char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1),char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1), -char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1),char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1), -char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1),char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1), -char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1),char(86),char(0),char(103),char(1),char(91),char(0),char(20),char(0), -char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1),char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1), -char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1), -char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1),char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1), -char(8),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(49),char(0),char(121),char(1),char(0),char(0),char(122),char(1), -char(92),char(0),char(20),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1),char(13),char(0),char(107),char(1), -char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1),char(4),char(0),char(111),char(1), -char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1),char(4),char(0),char(113),char(1), -char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(50),char(0),char(121),char(1), -char(0),char(0),char(122),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(123),char(1),char(14),char(0),char(124),char(1),char(8),char(0),char(125),char(1), -char(0),char(0),char(126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(127),char(1),char(0),char(0),char(122),char(1),char(4),char(0),char(97),char(1), -char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(127),char(1), -char(19),char(0),char(123),char(1),char(13),char(0),char(124),char(1),char(7),char(0),char(125),char(1),char(4),char(0),char(97),char(1),}; +char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0), +char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0),char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0), +char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0),char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0), +char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0), +char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0),char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0), +char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0),char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0), +char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0), +char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0), +char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0), +char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0), +char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0), +char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0), +char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0),char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0), +char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0),char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0), +char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0),char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0), +char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0),char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0), +char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0),char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0), +char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0),char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1), +char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1), +char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1), +char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1),char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1), +char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1),char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1), +char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1),char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1), +char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1),char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1), +char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1),char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1), +char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1),char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1), +char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1),char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1), +char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0),char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1), +char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1), +char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1),char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0), +char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1),char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1), +char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1),char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1), +char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1),char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1), +char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1),char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1), +char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1),char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1), +char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1),char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1), +char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1),char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1), +char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1),char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1), +char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0),char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1), +char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1),char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1), +char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1),char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1), +char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1),char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1), +char(86),char(0),char(103),char(1),char(91),char(0),char(24),char(0),char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1), +char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1),char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1), +char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1),char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1), +char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1),char(8),char(0),char(118),char(1),char(8),char(0),char(119),char(1),char(8),char(0),char(120),char(1), +char(8),char(0),char(121),char(1),char(8),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(49),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(92),char(0),char(24),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1), +char(13),char(0),char(107),char(1),char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1), +char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1), +char(4),char(0),char(113),char(1),char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(7),char(0),char(119),char(1),char(7),char(0),char(120),char(1), +char(7),char(0),char(121),char(1),char(7),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(50),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(127),char(1),char(14),char(0),char(-128),char(1),char(8),char(0),char(-127),char(1), +char(0),char(0),char(-126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(-125),char(1),char(0),char(0),char(126),char(1),char(4),char(0),char(97),char(1), +char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(-126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(-125),char(1), +char(19),char(0),char(127),char(1),char(13),char(0),char(-128),char(1),char(7),char(0),char(-127),char(1),char(4),char(0),char(97),char(1),}; int sBulletDNAlen= sizeof(sBulletDNAstr); - -char sBulletDNAstr64[]= { -char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-128),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), -char(95),char(99),char(97),char(112),char(97),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(100),char(97),char(116),char(97),char(0),char(109),char(95), -char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(115),char(0),char(109),char(95),char(99),char(111), -char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(115),char(0),char(109),char(95),char(99),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(115),char(0),char(42),char(102),char(105),char(114),char(115),char(116),char(0),char(42),char(108),char(97),char(115), -char(116),char(0),char(109),char(95),char(102),char(108),char(111),char(97),char(116),char(115),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(108),char(91),char(51), -char(93),char(0),char(109),char(95),char(98),char(97),char(115),char(105),char(115),char(0),char(109),char(95),char(111),char(114),char(105),char(103),char(105),char(110),char(0),char(109), -char(95),char(114),char(111),char(111),char(116),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98), -char(116),char(114),char(101),char(101),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100), -char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(91),char(51),char(93),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122), -char(101),char(100),char(65),char(97),char(98),char(98),char(77),char(97),char(120),char(91),char(51),char(93),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77), -char(105),char(110),char(79),char(114),char(103),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77),char(97),char(120),char(79),char(114),char(103),char(0),char(109), -char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98),char(80),char(97), -char(114),char(116),char(0),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109), -char(95),char(112),char(97),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101), -char(120),char(79),char(114),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(98), -char(118),char(104),char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(0),char(109),char(95),char(98),char(118),char(104),char(65),char(97),char(98),char(98),char(77), -char(97),char(120),char(0),char(109),char(95),char(98),char(118),char(104),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110), -char(0),char(109),char(95),char(99),char(117),char(114),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(117),char(115), -char(101),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(110),char(117),char(109),char(67), -char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(76),char(101),char(97),char(102),char(78),char(111),char(100),char(101),char(115),char(0),char(109), -char(95),char(110),char(117),char(109),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117), -char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(0),char(42),char(109),char(95),char(99),char(111),char(110),char(116),char(105),char(103),char(117),char(111), -char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105), -char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116), -char(114),char(0),char(42),char(109),char(95),char(115),char(117),char(98),char(84),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(80),char(116),char(114),char(0), -char(109),char(95),char(116),char(114),char(97),char(118),char(101),char(114),char(115),char(97),char(108),char(77),char(111),char(100),char(101),char(0),char(109),char(95),char(110),char(117), -char(109),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(72),char(101),char(97),char(100),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(110), -char(97),char(109),char(101),char(0),char(109),char(95),char(115),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(112),char(97), -char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110), -char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(83),char(99),char(97), -char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(108),char(97),char(110),char(101),char(78),char(111),char(114),char(109),char(97),char(108),char(0),char(109), -char(95),char(112),char(108),char(97),char(110),char(101),char(67),char(111),char(110),char(115),char(116),char(97),char(110),char(116),char(0),char(109),char(95),char(105),char(109),char(112), -char(108),char(105),char(99),char(105),char(116),char(83),char(104),char(97),char(112),char(101),char(68),char(105),char(109),char(101),char(110),char(115),char(105),char(111),char(110),char(115), -char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(109), -char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(111),char(115),char(0),char(109),char(95),char(114),char(97),char(100), -char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108), -char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(42),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(80),char(111), -char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95),char(108),char(111),char(99), -char(97),char(108),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(83),char(105),char(122),char(101),char(0), -char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(0),char(109),char(95),char(112),char(97),char(100),char(91),char(50),char(93),char(0),char(109),char(95),char(118), -char(97),char(108),char(117),char(101),char(115),char(91),char(51),char(93),char(0),char(109),char(95),char(112),char(97),char(100),char(0),char(42),char(109),char(95),char(118),char(101), -char(114),char(116),char(105),char(99),char(101),char(115),char(51),char(102),char(0),char(42),char(109),char(95),char(118),char(101),char(114),char(116),char(105),char(99),char(101),char(115), -char(51),char(100),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(51),char(50),char(0),char(42),char(109),char(95),char(51), -char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(42),char(109),char(95),char(51),char(105),char(110),char(100),char(105),char(99),char(101), -char(115),char(56),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(109),char(95),char(110),char(117), -char(109),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(101),char(114),char(116), -char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(115),char(80),char(116),char(114), -char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(101),char(115),char(104), -char(80),char(97),char(114),char(116),char(115),char(0),char(109),char(95),char(109),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99), -char(101),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(70),char(108),char(111),char(97),char(116),char(66), -char(118),char(104),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(68),char(111),char(117),char(98),char(108), -char(101),char(66),char(118),char(104),char(0),char(42),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111), -char(77),char(97),char(112),char(0),char(109),char(95),char(112),char(97),char(100),char(51),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(114),char(105),char(109), -char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(116),char(114),char(97),char(110),char(115), -char(102),char(111),char(114),char(109),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(0),char(109), -char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104), -char(105),char(108),char(100),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104), -char(97),char(112),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(104),char(105),char(108),char(100),char(83),char(104),char(97), -char(112),char(101),char(115),char(0),char(109),char(95),char(117),char(112),char(65),char(120),char(105),char(115),char(0),char(109),char(95),char(117),char(112),char(73),char(110),char(100), -char(101),char(120),char(0),char(109),char(95),char(102),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(48),char(86), -char(49),char(65),char(110),char(103),char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(49),char(86),char(50),char(65),char(110),char(103), -char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(50),char(86),char(48),char(65),char(110),char(103),char(108),char(101),char(0),char(42), -char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(110),char(101), -char(120),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(65),char(114),char(114),char(97),char(121),char(80), -char(116),char(114),char(0),char(42),char(109),char(95),char(107),char(101),char(121),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95), -char(99),char(111),char(110),char(118),char(101),char(120),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(112),char(108),char(97),char(110), -char(97),char(114),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(101),char(113),char(117),char(97),char(108),char(86),char(101),char(114), -char(116),char(101),char(120),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(68), -char(105),char(115),char(116),char(97),char(110),char(99),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(122), -char(101),char(114),char(111),char(65),char(114),char(101),char(97),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110), -char(101),char(120),char(116),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(83), -char(105),char(122),char(101),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(97),char(108),char(117),char(101),char(115),char(0),char(109),char(95),char(110),char(117), -char(109),char(75),char(101),char(121),char(115),char(0),char(109),char(95),char(103),char(105),char(109),char(112),char(97),char(99),char(116),char(83),char(117),char(98),char(84),char(121), -char(112),char(101),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115), -char(70),char(108),char(111),char(97),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100), -char(80),char(111),char(105),char(110),char(116),char(115),char(68),char(111),char(117),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117), -char(109),char(85),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(112),char(97), -char(100),char(100),char(105),char(110),char(103),char(51),char(91),char(52),char(93),char(0),char(42),char(109),char(95),char(98),char(114),char(111),char(97),char(100),char(112),char(104), -char(97),char(115),char(101),char(72),char(97),char(110),char(100),char(108),char(101),char(0),char(42),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105), -char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(42),char(109),char(95),char(114),char(111),char(111),char(116),char(67),char(111),char(108),char(108),char(105), -char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(109),char(95),char(119),char(111),char(114),char(108),char(100),char(84),char(114),char(97), -char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), -char(111),char(110),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105), -char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105),char(111),char(110),char(76),char(105),char(110),char(101),char(97),char(114),char(86),char(101), -char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), -char(111),char(110),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95), -char(97),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(99),char(116),char(80),char(114),char(111),char(99),char(101),char(115),char(115),char(105),char(110),char(103),char(84), -char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(100),char(101),char(97),char(99),char(116),char(105),char(118),char(97),char(116), -char(105),char(111),char(110),char(84),char(105),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109), -char(95),char(114),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99), -char(111),char(110),char(116),char(97),char(99),char(116),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(99),char(111),char(110),char(116), -char(97),char(99),char(116),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105), -char(116),char(117),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(104),char(105),char(116),char(70),char(114),char(97),char(99),char(116),char(105),char(111),char(110), -char(0),char(109),char(95),char(99),char(99),char(100),char(83),char(119),char(101),char(112),char(116),char(83),char(112),char(104),char(101),char(114),char(101),char(82),char(97),char(100), -char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(99),char(100),char(77),char(111),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115), -char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(104),char(97),char(115),char(65),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105), -char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111), -char(110),char(70),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(105),char(115),char(108),char(97),char(110),char(100),char(84),char(97),char(103),char(49),char(0), -char(109),char(95),char(99),char(111),char(109),char(112),char(97),char(110),char(105),char(111),char(110),char(73),char(100),char(0),char(109),char(95),char(97),char(99),char(116),char(105), -char(118),char(97),char(116),char(105),char(111),char(110),char(83),char(116),char(97),char(116),char(101),char(49),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114), -char(110),char(97),char(108),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104),char(101),char(99),char(107),char(67),char(111),char(108),char(108),char(105), -char(100),char(101),char(87),char(105),char(116),char(104),char(0),char(109),char(95),char(116),char(97),char(117),char(0),char(109),char(95),char(100),char(97),char(109),char(112),char(105), -char(110),char(103),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(116),char(101),char(112),char(0),char(109),char(95),char(109),char(97),char(120),char(69), -char(114),char(114),char(111),char(114),char(82),char(101),char(100),char(117),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(115),char(111),char(114),char(0), -char(109),char(95),char(101),char(114),char(112),char(0),char(109),char(95),char(101),char(114),char(112),char(50),char(0),char(109),char(95),char(103),char(108),char(111),char(98),char(97), -char(108),char(67),char(102),char(109),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(80), -char(101),char(110),char(101),char(116),char(114),char(97),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), -char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(84),char(117),char(114),char(110),char(69),char(114), -char(112),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(111),char(112),char(0),char(109),char(95),char(119),char(97),char(114), -char(109),char(115),char(116),char(97),char(114),char(116),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(109),char(97), -char(120),char(71),char(121),char(114),char(111),char(115),char(99),char(111),char(112),char(105),char(99),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(115), -char(105),char(110),char(103),char(108),char(101),char(65),char(120),char(105),char(115),char(82),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99), -char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110),char(117),char(109),char(73), -char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(77),char(111), -char(100),char(101),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105),char(110),char(103),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(82), -char(101),char(115),char(116),char(105),char(116),char(117),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), -char(109),char(95),char(109),char(105),char(110),char(105),char(109),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(66),char(97),char(116),char(99),char(104), -char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0), -char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(0),char(109),char(95),char(103),char(114),char(97),char(118),char(105), -char(116),char(121),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116), -char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(84),char(101),char(110), -char(115),char(111),char(114),char(87),char(111),char(114),char(108),char(100),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(86),char(101),char(108), -char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99), -char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0), -char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(103),char(114),char(97), -char(118),char(105),char(116),char(121),char(95),char(97),char(99),char(99),char(101),char(108),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95), -char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(76),char(111),char(99),char(97),char(108),char(0),char(109),char(95),char(116),char(111), -char(116),char(97),char(108),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(116),char(111),char(116),char(97),char(108),char(84),char(111),char(114),char(113), -char(117),char(101),char(0),char(109),char(95),char(105),char(110),char(118),char(101),char(114),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(108), -char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108), -char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110), -char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(97),char(100), -char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(76),char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110), -char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105), -char(116),char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103), -char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116), -char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70), -char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(101),char(101),char(112),char(105), -char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), -char(114),char(83),char(108),char(101),char(101),char(112),char(105),char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109), -char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109), -char(95),char(110),char(117),char(109),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(82),char(111),char(119),char(115),char(0),char(110), -char(117),char(98),char(0),char(42),char(109),char(95),char(114),char(98),char(65),char(0),char(42),char(109),char(95),char(114),char(98),char(66),char(0),char(109),char(95),char(111), -char(98),char(106),char(101),char(99),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(100),char(0),char(109),char(95),char(110),char(101),char(101),char(100),char(115),char(70),char(101),char(101), -char(100),char(98),char(97),char(99),char(107),char(0),char(109),char(95),char(97),char(112),char(112),char(108),char(105),char(101),char(100),char(73),char(109),char(112),char(117),char(108), -char(115),char(101),char(0),char(109),char(95),char(100),char(98),char(103),char(68),char(114),char(97),char(119),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(100), -char(105),char(115),char(97),char(98),char(108),char(101),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(115),char(66),char(101),char(116),char(119), -char(101),char(101),char(110),char(76),char(105),char(110),char(107),char(101),char(100),char(66),char(111),char(100),char(105),char(101),char(115),char(0),char(109),char(95),char(111),char(118), -char(101),char(114),char(114),char(105),char(100),char(101),char(78),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(116),char(101),char(114),char(97), -char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(98),char(114),char(101),char(97),char(107),char(105),char(110),char(103),char(73),char(109),char(112),char(117), -char(108),char(115),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(105),char(115),char(69),char(110),char(97), -char(98),char(108),char(101),char(100),char(0),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(121), -char(112),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(112), -char(105),char(118),char(111),char(116),char(73),char(110),char(65),char(0),char(109),char(95),char(112),char(105),char(118),char(111),char(116),char(73),char(110),char(66),char(0),char(109), -char(95),char(114),char(98),char(65),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(114),char(98),char(66),char(70),char(114),char(97),char(109),char(101), -char(0),char(109),char(95),char(117),char(115),char(101),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99),char(101),char(70),char(114),char(97),char(109),char(101), -char(65),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(79),char(110),char(108),char(121),char(0),char(109),char(95),char(101),char(110), -char(97),char(98),char(108),char(101),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(0),char(109),char(95),char(109), -char(111),char(116),char(111),char(114),char(84),char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109), -char(95),char(109),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(108), -char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(117),char(112),char(112),char(101),char(114),char(76),char(105),char(109), -char(105),char(116),char(0),char(109),char(95),char(108),char(105),char(109),char(105),char(116),char(83),char(111),char(102),char(116),char(110),char(101),char(115),char(115),char(0),char(109), -char(95),char(98),char(105),char(97),char(115),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(114),char(101),char(108),char(97),char(120),char(97), -char(116),char(105),char(111),char(110),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103), -char(49),char(91),char(52),char(93),char(0),char(109),char(95),char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(49),char(0),char(109),char(95), -char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(50),char(0),char(109),char(95),char(116),char(119),char(105),char(115),char(116),char(83),char(112), -char(97),char(110),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105), -char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), -char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116), -char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), -char(0),char(109),char(95),char(117),char(115),char(101),char(76),char(105),char(110),char(101),char(97),char(114),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99), -char(101),char(70),char(114),char(97),char(109),char(101),char(65),char(0),char(109),char(95),char(117),char(115),char(101),char(79),char(102),char(102),char(115),char(101),char(116),char(70), -char(111),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95), -char(54),char(100),char(111),char(102),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(69),char(110),char(97), -char(98),char(108),char(101),char(100),char(91),char(54),char(93),char(0),char(109),char(95),char(101),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), -char(109),char(80),char(111),char(105),char(110),char(116),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(83),char(116), -char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(68), -char(97),char(109),char(112),char(105),char(110),char(103),char(91),char(54),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(66),char(111), -char(117),char(110),char(99),char(101),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80), -char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(108), -char(105),char(110),char(101),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(108),char(105),char(110),char(101), -char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(84), -char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(108),char(105),char(110),char(101), -char(97),char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(108),char(105), -char(110),char(101),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(108),char(105), -char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0), -char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110), -char(103),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), -char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(110),char(97),char(98),char(108), -char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(101), -char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), -char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105), -char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(76), -char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112), -char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52), -char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(66),char(111),char(117),char(110),char(99),char(101),char(0),char(109),char(95), -char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103), -char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), -char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(77), -char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(84),char(97),char(114), -char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), -char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(97),char(110),char(103), -char(117),char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(97),char(110), -char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115), -char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112), -char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98), -char(114),char(105),char(117),char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69), -char(110),char(97),char(98),char(108),char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117), -char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97), -char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52), -char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105), -char(102),char(102),char(110),char(101),char(115),char(115),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(97), -char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76), -char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(114),char(111),char(116),char(97),char(116),char(101),char(79),char(114), -char(100),char(101),char(114),char(0),char(109),char(95),char(97),char(120),char(105),char(115),char(73),char(110),char(65),char(0),char(109),char(95),char(97),char(120),char(105),char(115), -char(73),char(110),char(66),char(0),char(109),char(95),char(114),char(97),char(116),char(105),char(111),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), -char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83), -char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109),char(101),char(83),char(116),char(105), -char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(0),char(109), -char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(112),char(114),char(101),char(118),char(105),char(111),char(117),char(115), -char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0), -char(109),char(95),char(97),char(99),char(99),char(117),char(109),char(117),char(108),char(97),char(116),char(101),char(100),char(70),char(111),char(114),char(99),char(101),char(0),char(109), -char(95),char(110),char(111),char(114),char(109),char(97),char(108),char(0),char(109),char(95),char(97),char(114),char(101),char(97),char(0),char(109),char(95),char(97),char(116),char(116), -char(97),char(99),char(104),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(50),char(93), -char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(76),char(101),char(110),char(103),char(116),char(104),char(0),char(109),char(95),char(98),char(98),char(101),char(110), -char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(51), -char(93),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(65),char(114),char(101),char(97),char(0),char(109),char(95),char(99),char(48),char(91),char(52),char(93), -char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(52),char(93),char(0),char(109),char(95), -char(114),char(101),char(115),char(116),char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(99),char(49),char(0),char(109),char(95),char(99),char(50), -char(0),char(109),char(95),char(99),char(48),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(70),char(114),char(97),char(109),char(101),char(0),char(42), -char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110), -char(100),char(101),char(120),char(0),char(109),char(95),char(97),char(101),char(114),char(111),char(77),char(111),char(100),char(101),char(108),char(0),char(109),char(95),char(98),char(97), -char(117),char(109),char(103),char(97),char(114),char(116),char(101),char(0),char(109),char(95),char(100),char(114),char(97),char(103),char(0),char(109),char(95),char(108),char(105),char(102), -char(116),char(0),char(109),char(95),char(112),char(114),char(101),char(115),char(115),char(117),char(114),char(101),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109), -char(101),char(0),char(109),char(95),char(100),char(121),char(110),char(97),char(109),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(109),char(95),char(112),char(111),char(115),char(101),char(77),char(97),char(116),char(99),char(104),char(0),char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(67), -char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(107),char(105),char(110), -char(101),char(116),char(105),char(99),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0), -char(109),char(95),char(115),char(111),char(102),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115), -char(115),char(0),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109), -char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114), -char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105),char(110),char(101),char(116),char(105),char(99),char(67), -char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102), -char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115), -char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73), -char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105), -char(110),char(101),char(116),char(105),char(99),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83), -char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116), -char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(109),char(97),char(120), -char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(99),char(97),char(108),char(101),char(0),char(109), -char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0), -char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115), -char(0),char(109),char(95),char(100),char(114),char(105),char(102),char(116),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), -char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), -char(95),char(114),char(111),char(116),char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(101),char(0),char(109),char(95),char(97),char(113),char(113),char(0),char(109), -char(95),char(99),char(111),char(109),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(115),char(0),char(42),char(109), -char(95),char(119),char(101),char(105),char(103),char(104),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(80),char(111),char(115),char(105),char(116),char(105), -char(111),char(110),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(87),char(101),char(105),char(103),char(116),char(115),char(0),char(109),char(95),char(98),char(118), -char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(98),char(102),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(97), -char(109),char(101),char(120),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(108),char(111),char(99),char(105),char(105),char(0),char(109),char(95),char(105),char(110), -char(118),char(119),char(105),char(0),char(109),char(95),char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109), -char(95),char(100),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(108),char(118),char(0),char(109), -char(95),char(97),char(118),char(0),char(42),char(109),char(95),char(102),char(114),char(97),char(109),char(101),char(114),char(101),char(102),char(115),char(0),char(42),char(109),char(95), -char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(115),char(115),char(101), -char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(114),char(97),char(109),char(101),char(82),char(101),char(102),char(115),char(0),char(109),char(95),char(110), -char(117),char(109),char(78),char(111),char(100),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(115),char(115),char(101),char(115),char(0), -char(109),char(95),char(105),char(100),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(105),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(110), -char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(105),char(109),char(112),char(117),char(108),char(115), -char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(108),char(100),char(97),char(109), -char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97), -char(116),char(99),char(104),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97),char(120),char(83),char(101),char(108),char(102),char(67),char(111),char(108),char(108), -char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(115),char(101),char(108),char(102),char(67), -char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(70),char(97),char(99),char(116),char(111), -char(114),char(0),char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(105),char(110),char(115),char(65),char(110),char(99),char(104),char(111),char(114),char(0),char(109), -char(95),char(99),char(111),char(108),char(108),char(105),char(100),char(101),char(0),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(110), -char(100),char(101),char(120),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121), -char(66),char(0),char(109),char(95),char(114),char(101),char(102),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(99),char(102),char(109),char(0),char(109),char(95), -char(115),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(100),char(101),char(108),char(101),char(116),char(101),char(0),char(109),char(95),char(114),char(101),char(108), -char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(91),char(50),char(93),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(116), -char(121),char(112),char(101),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(66),char(116),char(121),char(112),char(101),char(0),char(109),char(95),char(106),char(111), -char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(101),char(0),char(42),char(42),char(109),char(95), -char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(42),char(109),char(95),char(110),char(111),char(100),char(101),char(115),char(0),char(42), -char(109),char(95),char(108),char(105),char(110),char(107),char(115),char(0),char(42),char(109),char(95),char(102),char(97),char(99),char(101),char(115),char(0),char(42),char(109),char(95), -char(116),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(42),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114), -char(115),char(0),char(42),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(106),char(111),char(105), -char(110),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(109), -char(95),char(110),char(117),char(109),char(76),char(105),char(110),char(107),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(97),char(99),char(101),char(115), -char(0),char(109),char(95),char(110),char(117),char(109),char(84),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(109),char(95),char(110), -char(117),char(109),char(65),char(110),char(99),char(104),char(111),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(108),char(117),char(115),char(116), -char(101),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(74),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(99),char(111), -char(110),char(102),char(105),char(103),char(0),char(109),char(95),char(122),char(101),char(114),char(111),char(82),char(111),char(116),char(80),char(97),char(114),char(101),char(110),char(116), -char(84),char(111),char(84),char(104),char(105),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(67),char(111),char(109),char(84),char(111), -char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116),char(0),char(109),char(95),char(116),char(104),char(105),char(115), -char(80),char(105),char(118),char(111),char(116),char(84),char(111),char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116), -char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(84),char(111),char(112),char(91),char(54),char(93),char(0),char(109), -char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(66),char(111),char(116),char(116),char(111),char(109),char(91),char(54),char(93),char(0), -char(109),char(95),char(108),char(105),char(110),char(107),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(108),char(105),char(110),char(107), -char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(0),char(109), -char(95),char(100),char(111),char(102),char(67),char(111),char(117),char(110),char(116),char(0),char(109),char(95),char(112),char(111),char(115),char(86),char(97),char(114),char(67),char(111), -char(117),char(110),char(116),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(80),char(111),char(115),char(91),char(55),char(93),char(0),char(109),char(95), -char(106),char(111),char(105),char(110),char(116),char(86),char(101),char(108),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(84), -char(111),char(114),char(113),char(117),char(101),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(68),char(97),char(109),char(112), -char(105),char(110),char(103),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116), -char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114), -char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115), -char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97), -char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115), -char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101), -char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(0),char(0),char(0),char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0), -char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115),char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104), -char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103),char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102), -char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0),char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105), -char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116),char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83), -char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97),char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99), -char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116), -char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116), -char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117), -char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102), -char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), -char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101), -char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108), -char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), -char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97), -char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104), -char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114), -char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101), -char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80), -char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101), -char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114), -char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101), -char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117), -char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117), -char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103), -char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116), -char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118), -char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111), -char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), -char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99), -char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116), -char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115), -char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121), -char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68), -char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111), -char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70), -char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111), -char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114), -char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105), -char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108), -char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110), -char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72), -char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67), -char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50), -char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84), -char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), -char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110), -char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101), -char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116), -char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71), -char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105), -char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100), -char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83), -char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111), -char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83), -char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0), -char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), -char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111), -char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84), -char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110), -char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110), -char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101), -char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107), -char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111), -char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117), -char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116), -char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0), -char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0), -char(8),char(0),char(0),char(0),char(16),char(0),char(48),char(0),char(16),char(0),char(16),char(0),char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0), -char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0),char(16),char(0),char(96),char(0),char(-112),char(0),char(16),char(0), -char(56),char(0),char(56),char(0),char(20),char(0),char(72),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(4),char(0),char(56),char(0),char(32),char(0), -char(80),char(0),char(72),char(0),char(96),char(0),char(80),char(0),char(32),char(0),char(64),char(0),char(64),char(0),char(64),char(0),char(16),char(0),char(72),char(0), -char(80),char(0),char(-16),char(1),char(24),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0),char(104),char(0),char(0),char(2),char(-64),char(3),char(8),char(0), -char(64),char(0),char(64),char(0),char(0),char(0),char(80),char(0),char(96),char(0),char(-112),char(0),char(-128),char(0),char(104),char(1),char(-24),char(0),char(-104),char(1), -char(-120),char(1),char(-32),char(0),char(8),char(1),char(-40),char(1),char(104),char(1),char(-128),char(2),char(-112),char(2),char(-64),char(4),char(-40),char(0),char(120),char(1), -char(104),char(0),char(-104),char(0),char(16),char(0),char(104),char(0),char(24),char(0),char(40),char(0),char(104),char(0),char(96),char(0),char(104),char(0),char(-56),char(0), -char(104),char(1),char(112),char(0),char(-24),char(1),char(-32),char(2),char(-120),char(1),char(-48),char(0),char(112),char(0),char(0),char(0),char(83),char(84),char(82),char(67), -char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0),char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0), -char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0),char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0), -char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0), -char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0), -char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0),char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0), -char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0),char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0), -char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0), -char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0), -char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0),char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0), -char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0), -char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0),char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0), -char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), -char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0), -char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0),char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0), -char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0), -char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0),char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0), -char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0),char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0), -char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0), -char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0),char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0), -char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0),char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0), -char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0),char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0), -char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0),char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0), -char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0),char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0), -char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0),char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0), -char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0),char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0), -char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0),char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0), -char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0),char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0), -char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0),char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0), -char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0),char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0), -char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0), -char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0), -char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0),char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0), -char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0),char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0), -char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0),char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0), -char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0),char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0), -char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0), -char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0),char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0), -char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0),char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0), -char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0), -char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0),char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0), -char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0),char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), -char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0), -char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0), -char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0),char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0), -char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0), -char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0), -char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0), -char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0), -char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0),char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0), -char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0),char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0), -char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), -char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0),char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0), -char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0), -char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0),char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0), -char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0),char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0), -char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0), -char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0),char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0), -char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0),char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0), -char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0),char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0), -char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0),char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0), -char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0),char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0), -char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0), -char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0),char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0), -char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0),char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0), -char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0),char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0), -char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0),char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), -char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0),char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0), -char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), -char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), -char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0), -char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0), -char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0), -char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0),char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0), -char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0), -char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0), -char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0), -char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0), -char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), -char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0), -char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0), -char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0), -char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0), -char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0),char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0), -char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0),char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0),char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0), -char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0), -char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0), -char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0), -char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0), -char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), -char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0), -char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0),char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0), -char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0),char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0), -char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0), -char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0),char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0), -char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0),char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0), -char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0), -char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0), -char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0), -char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0),char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0), -char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0),char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0), -char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), -char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0), -char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0),char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0), -char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0),char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0), -char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0), -char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0), -char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0),char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), -char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0),char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0),char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0), -char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0), -char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0),char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0), -char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0),char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0), -char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0),char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0), -char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0),char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0), -char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1),char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1),char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1),char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1), -char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1),char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1), -char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1),char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1), -char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1),char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1), -char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1),char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1), -char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1),char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1), -char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1),char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1), -char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1),char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0), -char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1),char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1), -char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1),char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1), -char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0),char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1), -char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1), -char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1),char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1), -char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1),char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1), -char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1),char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1), -char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1),char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1), -char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1),char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1), -char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1),char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1), -char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0), -char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1),char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1), -char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1),char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1), -char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1),char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1), -char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1),char(86),char(0),char(103),char(1),char(91),char(0),char(20),char(0), -char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1),char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1), -char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1), -char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1),char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1), -char(8),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(49),char(0),char(121),char(1),char(0),char(0),char(122),char(1), -char(92),char(0),char(20),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1),char(13),char(0),char(107),char(1), -char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1),char(4),char(0),char(111),char(1), -char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1),char(4),char(0),char(113),char(1), -char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(50),char(0),char(121),char(1), -char(0),char(0),char(122),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(123),char(1),char(14),char(0),char(124),char(1),char(8),char(0),char(125),char(1), -char(0),char(0),char(126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(127),char(1),char(0),char(0),char(122),char(1),char(4),char(0),char(97),char(1), -char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(127),char(1), -char(19),char(0),char(123),char(1),char(13),char(0),char(124),char(1),char(7),char(0),char(125),char(1),char(4),char(0),char(97),char(1),}; -int sBulletDNAlen64= sizeof(sBulletDNAstr64); diff --git a/Engine/lib/bullet/src/LinearMath/btSerializer.h b/Engine/lib/bullet/src/LinearMath/btSerializer.h index 6f03df158..89b4d7468 100644 --- a/Engine/lib/bullet/src/LinearMath/btSerializer.h +++ b/Engine/lib/bullet/src/LinearMath/btSerializer.h @@ -26,7 +26,7 @@ subject to the following restrictions: -///only the 32bit versions for now + extern char sBulletDNAstr[]; extern int sBulletDNAlen; extern char sBulletDNAstr64[]; @@ -505,7 +505,7 @@ public: buffer[9] = '2'; buffer[10] = '8'; - buffer[11] = '5'; + buffer[11] = '7'; } diff --git a/Engine/lib/bullet/src/LinearMath/btSerializer64.cpp b/Engine/lib/bullet/src/LinearMath/btSerializer64.cpp new file mode 100644 index 000000000..05f59202d --- /dev/null +++ b/Engine/lib/bullet/src/LinearMath/btSerializer64.cpp @@ -0,0 +1,599 @@ +char sBulletDNAstr64[]= { +char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-124),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), +char(95),char(99),char(97),char(112),char(97),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(100),char(97),char(116),char(97),char(0),char(109),char(95), +char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(115),char(0),char(109),char(95),char(99),char(111), +char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(115),char(0),char(109),char(95),char(99),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(115),char(0),char(42),char(102),char(105),char(114),char(115),char(116),char(0),char(42),char(108),char(97),char(115), +char(116),char(0),char(109),char(95),char(102),char(108),char(111),char(97),char(116),char(115),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(108),char(91),char(51), +char(93),char(0),char(109),char(95),char(98),char(97),char(115),char(105),char(115),char(0),char(109),char(95),char(111),char(114),char(105),char(103),char(105),char(110),char(0),char(109), +char(95),char(114),char(111),char(111),char(116),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98), +char(116),char(114),char(101),char(101),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100), +char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(91),char(51),char(93),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122), +char(101),char(100),char(65),char(97),char(98),char(98),char(77),char(97),char(120),char(91),char(51),char(93),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77), +char(105),char(110),char(79),char(114),char(103),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77),char(97),char(120),char(79),char(114),char(103),char(0),char(109), +char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98),char(80),char(97), +char(114),char(116),char(0),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109), +char(95),char(112),char(97),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101), +char(120),char(79),char(114),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(98), +char(118),char(104),char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(0),char(109),char(95),char(98),char(118),char(104),char(65),char(97),char(98),char(98),char(77), +char(97),char(120),char(0),char(109),char(95),char(98),char(118),char(104),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110), +char(0),char(109),char(95),char(99),char(117),char(114),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(117),char(115), +char(101),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(110),char(117),char(109),char(67), +char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(76),char(101),char(97),char(102),char(78),char(111),char(100),char(101),char(115),char(0),char(109), +char(95),char(110),char(117),char(109),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117), +char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(0),char(42),char(109),char(95),char(99),char(111),char(110),char(116),char(105),char(103),char(117),char(111), +char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105), +char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116), +char(114),char(0),char(42),char(109),char(95),char(115),char(117),char(98),char(84),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(80),char(116),char(114),char(0), +char(109),char(95),char(116),char(114),char(97),char(118),char(101),char(114),char(115),char(97),char(108),char(77),char(111),char(100),char(101),char(0),char(109),char(95),char(110),char(117), +char(109),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(72),char(101),char(97),char(100),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(110), +char(97),char(109),char(101),char(0),char(109),char(95),char(115),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(112),char(97), +char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110), +char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(83),char(99),char(97), +char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(108),char(97),char(110),char(101),char(78),char(111),char(114),char(109),char(97),char(108),char(0),char(109), +char(95),char(112),char(108),char(97),char(110),char(101),char(67),char(111),char(110),char(115),char(116),char(97),char(110),char(116),char(0),char(109),char(95),char(105),char(109),char(112), +char(108),char(105),char(99),char(105),char(116),char(83),char(104),char(97),char(112),char(101),char(68),char(105),char(109),char(101),char(110),char(115),char(105),char(111),char(110),char(115), +char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(109), +char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(111),char(115),char(0),char(109),char(95),char(114),char(97),char(100), +char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108), +char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(42),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(80),char(111), +char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95),char(108),char(111),char(99), +char(97),char(108),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(83),char(105),char(122),char(101),char(0), +char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(0),char(109),char(95),char(112),char(97),char(100),char(91),char(50),char(93),char(0),char(109),char(95),char(118), +char(97),char(108),char(117),char(101),char(115),char(91),char(51),char(93),char(0),char(109),char(95),char(112),char(97),char(100),char(0),char(42),char(109),char(95),char(118),char(101), +char(114),char(116),char(105),char(99),char(101),char(115),char(51),char(102),char(0),char(42),char(109),char(95),char(118),char(101),char(114),char(116),char(105),char(99),char(101),char(115), +char(51),char(100),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(51),char(50),char(0),char(42),char(109),char(95),char(51), +char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(42),char(109),char(95),char(51),char(105),char(110),char(100),char(105),char(99),char(101), +char(115),char(56),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(109),char(95),char(110),char(117), +char(109),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(101),char(114),char(116), +char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(115),char(80),char(116),char(114), +char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(101),char(115),char(104), +char(80),char(97),char(114),char(116),char(115),char(0),char(109),char(95),char(109),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99), +char(101),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(70),char(108),char(111),char(97),char(116),char(66), +char(118),char(104),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(68),char(111),char(117),char(98),char(108), +char(101),char(66),char(118),char(104),char(0),char(42),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111), +char(77),char(97),char(112),char(0),char(109),char(95),char(112),char(97),char(100),char(51),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(114),char(105),char(109), +char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(116),char(114),char(97),char(110),char(115), +char(102),char(111),char(114),char(109),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(0),char(109), +char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104), +char(105),char(108),char(100),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104), +char(97),char(112),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(104),char(105),char(108),char(100),char(83),char(104),char(97), +char(112),char(101),char(115),char(0),char(109),char(95),char(117),char(112),char(65),char(120),char(105),char(115),char(0),char(109),char(95),char(117),char(112),char(73),char(110),char(100), +char(101),char(120),char(0),char(109),char(95),char(102),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(48),char(86), +char(49),char(65),char(110),char(103),char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(49),char(86),char(50),char(65),char(110),char(103), +char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(50),char(86),char(48),char(65),char(110),char(103),char(108),char(101),char(0),char(42), +char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(110),char(101), +char(120),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(65),char(114),char(114),char(97),char(121),char(80), +char(116),char(114),char(0),char(42),char(109),char(95),char(107),char(101),char(121),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95), +char(99),char(111),char(110),char(118),char(101),char(120),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(112),char(108),char(97),char(110), +char(97),char(114),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(101),char(113),char(117),char(97),char(108),char(86),char(101),char(114), +char(116),char(101),char(120),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(68), +char(105),char(115),char(116),char(97),char(110),char(99),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(122), +char(101),char(114),char(111),char(65),char(114),char(101),char(97),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110), +char(101),char(120),char(116),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(83), +char(105),char(122),char(101),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(97),char(108),char(117),char(101),char(115),char(0),char(109),char(95),char(110),char(117), +char(109),char(75),char(101),char(121),char(115),char(0),char(109),char(95),char(103),char(105),char(109),char(112),char(97),char(99),char(116),char(83),char(117),char(98),char(84),char(121), +char(112),char(101),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115), +char(70),char(108),char(111),char(97),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100), +char(80),char(111),char(105),char(110),char(116),char(115),char(68),char(111),char(117),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117), +char(109),char(85),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(112),char(97), +char(100),char(100),char(105),char(110),char(103),char(51),char(91),char(52),char(93),char(0),char(42),char(109),char(95),char(98),char(114),char(111),char(97),char(100),char(112),char(104), +char(97),char(115),char(101),char(72),char(97),char(110),char(100),char(108),char(101),char(0),char(42),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105), +char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(42),char(109),char(95),char(114),char(111),char(111),char(116),char(67),char(111),char(108),char(108),char(105), +char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(109),char(95),char(119),char(111),char(114),char(108),char(100),char(84),char(114),char(97), +char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), +char(111),char(110),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105), +char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105),char(111),char(110),char(76),char(105),char(110),char(101),char(97),char(114),char(86),char(101), +char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), +char(111),char(110),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95), +char(97),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), +char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(99),char(116),char(80),char(114),char(111),char(99),char(101),char(115),char(115),char(105),char(110),char(103),char(84), +char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(100),char(101),char(97),char(99),char(116),char(105),char(118),char(97),char(116), +char(105),char(111),char(110),char(84),char(105),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109), +char(95),char(114),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99), +char(111),char(110),char(116),char(97),char(99),char(116),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(99),char(111),char(110),char(116), +char(97),char(99),char(116),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105), +char(116),char(117),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(104),char(105),char(116),char(70),char(114),char(97),char(99),char(116),char(105),char(111),char(110), +char(0),char(109),char(95),char(99),char(99),char(100),char(83),char(119),char(101),char(112),char(116),char(83),char(112),char(104),char(101),char(114),char(101),char(82),char(97),char(100), +char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(99),char(100),char(77),char(111),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115), +char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(104),char(97),char(115),char(65),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105), +char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111), +char(110),char(70),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(105),char(115),char(108),char(97),char(110),char(100),char(84),char(97),char(103),char(49),char(0), +char(109),char(95),char(99),char(111),char(109),char(112),char(97),char(110),char(105),char(111),char(110),char(73),char(100),char(0),char(109),char(95),char(97),char(99),char(116),char(105), +char(118),char(97),char(116),char(105),char(111),char(110),char(83),char(116),char(97),char(116),char(101),char(49),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114), +char(110),char(97),char(108),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104),char(101),char(99),char(107),char(67),char(111),char(108),char(108),char(105), +char(100),char(101),char(87),char(105),char(116),char(104),char(0),char(109),char(95),char(116),char(97),char(117),char(0),char(109),char(95),char(100),char(97),char(109),char(112),char(105), +char(110),char(103),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(116),char(101),char(112),char(0),char(109),char(95),char(109),char(97),char(120),char(69), +char(114),char(114),char(111),char(114),char(82),char(101),char(100),char(117),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(115),char(111),char(114),char(0), +char(109),char(95),char(101),char(114),char(112),char(0),char(109),char(95),char(101),char(114),char(112),char(50),char(0),char(109),char(95),char(103),char(108),char(111),char(98),char(97), +char(108),char(67),char(102),char(109),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(80), +char(101),char(110),char(101),char(116),char(114),char(97),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), +char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(84),char(117),char(114),char(110),char(69),char(114), +char(112),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(111),char(112),char(0),char(109),char(95),char(119),char(97),char(114), +char(109),char(115),char(116),char(97),char(114),char(116),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(109),char(97), +char(120),char(71),char(121),char(114),char(111),char(115),char(99),char(111),char(112),char(105),char(99),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(115), +char(105),char(110),char(103),char(108),char(101),char(65),char(120),char(105),char(115),char(82),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99), +char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110),char(117),char(109),char(73), +char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(77),char(111), +char(100),char(101),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105),char(110),char(103),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(82), +char(101),char(115),char(116),char(105),char(116),char(117),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), +char(109),char(95),char(109),char(105),char(110),char(105),char(109),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(66),char(97),char(116),char(99),char(104), +char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0), +char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(0),char(109),char(95),char(103),char(114),char(97),char(118),char(105), +char(116),char(121),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116), +char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(84),char(101),char(110), +char(115),char(111),char(114),char(87),char(111),char(114),char(108),char(100),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(86),char(101),char(108), +char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99), +char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0), +char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(103),char(114),char(97), +char(118),char(105),char(116),char(121),char(95),char(97),char(99),char(99),char(101),char(108),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95), +char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(76),char(111),char(99),char(97),char(108),char(0),char(109),char(95),char(116),char(111), +char(116),char(97),char(108),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(116),char(111),char(116),char(97),char(108),char(84),char(111),char(114),char(113), +char(117),char(101),char(0),char(109),char(95),char(105),char(110),char(118),char(101),char(114),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(108), +char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108), +char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110), +char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(97),char(100), +char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(76),char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110), +char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105), +char(116),char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103), +char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116), +char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70), +char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(101),char(101),char(112),char(105), +char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), +char(114),char(83),char(108),char(101),char(101),char(112),char(105),char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109), +char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109), +char(95),char(110),char(117),char(109),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(82),char(111),char(119),char(115),char(0),char(110), +char(117),char(98),char(0),char(42),char(109),char(95),char(114),char(98),char(65),char(0),char(42),char(109),char(95),char(114),char(98),char(66),char(0),char(109),char(95),char(111), +char(98),char(106),char(101),char(99),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110),char(115), +char(116),char(114),char(97),char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(100),char(0),char(109),char(95),char(110),char(101),char(101),char(100),char(115),char(70),char(101),char(101), +char(100),char(98),char(97),char(99),char(107),char(0),char(109),char(95),char(97),char(112),char(112),char(108),char(105),char(101),char(100),char(73),char(109),char(112),char(117),char(108), +char(115),char(101),char(0),char(109),char(95),char(100),char(98),char(103),char(68),char(114),char(97),char(119),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(100), +char(105),char(115),char(97),char(98),char(108),char(101),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(115),char(66),char(101),char(116),char(119), +char(101),char(101),char(110),char(76),char(105),char(110),char(107),char(101),char(100),char(66),char(111),char(100),char(105),char(101),char(115),char(0),char(109),char(95),char(111),char(118), +char(101),char(114),char(114),char(105),char(100),char(101),char(78),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(116),char(101),char(114),char(97), +char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(98),char(114),char(101),char(97),char(107),char(105),char(110),char(103),char(73),char(109),char(112),char(117), +char(108),char(115),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(105),char(115),char(69),char(110),char(97), +char(98),char(108),char(101),char(100),char(0),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(121), +char(112),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(112), +char(105),char(118),char(111),char(116),char(73),char(110),char(65),char(0),char(109),char(95),char(112),char(105),char(118),char(111),char(116),char(73),char(110),char(66),char(0),char(109), +char(95),char(114),char(98),char(65),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(114),char(98),char(66),char(70),char(114),char(97),char(109),char(101), +char(0),char(109),char(95),char(117),char(115),char(101),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99),char(101),char(70),char(114),char(97),char(109),char(101), +char(65),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(79),char(110),char(108),char(121),char(0),char(109),char(95),char(101),char(110), +char(97),char(98),char(108),char(101),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(0),char(109),char(95),char(109), +char(111),char(116),char(111),char(114),char(84),char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109), +char(95),char(109),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(108), +char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(117),char(112),char(112),char(101),char(114),char(76),char(105),char(109), +char(105),char(116),char(0),char(109),char(95),char(108),char(105),char(109),char(105),char(116),char(83),char(111),char(102),char(116),char(110),char(101),char(115),char(115),char(0),char(109), +char(95),char(98),char(105),char(97),char(115),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(114),char(101),char(108),char(97),char(120),char(97), +char(116),char(105),char(111),char(110),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103), +char(49),char(91),char(52),char(93),char(0),char(109),char(95),char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(49),char(0),char(109),char(95), +char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(50),char(0),char(109),char(95),char(116),char(119),char(105),char(115),char(116),char(83),char(112), +char(97),char(110),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105), +char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), +char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116), +char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), +char(0),char(109),char(95),char(117),char(115),char(101),char(76),char(105),char(110),char(101),char(97),char(114),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99), +char(101),char(70),char(114),char(97),char(109),char(101),char(65),char(0),char(109),char(95),char(117),char(115),char(101),char(79),char(102),char(102),char(115),char(101),char(116),char(70), +char(111),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95), +char(54),char(100),char(111),char(102),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(69),char(110),char(97), +char(98),char(108),char(101),char(100),char(91),char(54),char(93),char(0),char(109),char(95),char(101),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), +char(109),char(80),char(111),char(105),char(110),char(116),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(83),char(116), +char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(68), +char(97),char(109),char(112),char(105),char(110),char(103),char(91),char(54),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(66),char(111), +char(117),char(110),char(99),char(101),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80), +char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(108), +char(105),char(110),char(101),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(108),char(105),char(110),char(101), +char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(84), +char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(108),char(105),char(110),char(101), +char(97),char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(108),char(105), +char(110),char(101),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(108),char(105), +char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0), +char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110), +char(103),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), +char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(110),char(97),char(98),char(108), +char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(101), +char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), +char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105), +char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(76), +char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112), +char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52), +char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(66),char(111),char(117),char(110),char(99),char(101),char(0),char(109),char(95), +char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103), +char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), +char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(77), +char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(84),char(97),char(114), +char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), +char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(97),char(110),char(103), +char(117),char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(97),char(110), +char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115), +char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112), +char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98), +char(114),char(105),char(117),char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69), +char(110),char(97),char(98),char(108),char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117), +char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97), +char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52), +char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105), +char(102),char(102),char(110),char(101),char(115),char(115),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(97), +char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76), +char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(114),char(111),char(116),char(97),char(116),char(101),char(79),char(114), +char(100),char(101),char(114),char(0),char(109),char(95),char(97),char(120),char(105),char(115),char(73),char(110),char(65),char(0),char(109),char(95),char(97),char(120),char(105),char(115), +char(73),char(110),char(66),char(0),char(109),char(95),char(114),char(97),char(116),char(105),char(111),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), +char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83), +char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109),char(101),char(83),char(116),char(105), +char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(0),char(109), +char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(112),char(114),char(101),char(118),char(105),char(111),char(117),char(115), +char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0), +char(109),char(95),char(97),char(99),char(99),char(117),char(109),char(117),char(108),char(97),char(116),char(101),char(100),char(70),char(111),char(114),char(99),char(101),char(0),char(109), +char(95),char(110),char(111),char(114),char(109),char(97),char(108),char(0),char(109),char(95),char(97),char(114),char(101),char(97),char(0),char(109),char(95),char(97),char(116),char(116), +char(97),char(99),char(104),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(50),char(93), +char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(76),char(101),char(110),char(103),char(116),char(104),char(0),char(109),char(95),char(98),char(98),char(101),char(110), +char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(51), +char(93),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(65),char(114),char(101),char(97),char(0),char(109),char(95),char(99),char(48),char(91),char(52),char(93), +char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(52),char(93),char(0),char(109),char(95), +char(114),char(101),char(115),char(116),char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(99),char(49),char(0),char(109),char(95),char(99),char(50), +char(0),char(109),char(95),char(99),char(48),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(70),char(114),char(97),char(109),char(101),char(0),char(42), +char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110), +char(100),char(101),char(120),char(0),char(109),char(95),char(97),char(101),char(114),char(111),char(77),char(111),char(100),char(101),char(108),char(0),char(109),char(95),char(98),char(97), +char(117),char(109),char(103),char(97),char(114),char(116),char(101),char(0),char(109),char(95),char(100),char(114),char(97),char(103),char(0),char(109),char(95),char(108),char(105),char(102), +char(116),char(0),char(109),char(95),char(112),char(114),char(101),char(115),char(115),char(117),char(114),char(101),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109), +char(101),char(0),char(109),char(95),char(100),char(121),char(110),char(97),char(109),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), +char(109),char(95),char(112),char(111),char(115),char(101),char(77),char(97),char(116),char(99),char(104),char(0),char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(67), +char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(107),char(105),char(110), +char(101),char(116),char(105),char(99),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0), +char(109),char(95),char(115),char(111),char(102),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115), +char(115),char(0),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109), +char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114), +char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105),char(110),char(101),char(116),char(105),char(99),char(67), +char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102), +char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115), +char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73), +char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105), +char(110),char(101),char(116),char(105),char(99),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83), +char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116), +char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(109),char(97),char(120), +char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(99),char(97),char(108),char(101),char(0),char(109), +char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0), +char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115), +char(0),char(109),char(95),char(100),char(114),char(105),char(102),char(116),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), +char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), +char(95),char(114),char(111),char(116),char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(101),char(0),char(109),char(95),char(97),char(113),char(113),char(0),char(109), +char(95),char(99),char(111),char(109),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(115),char(0),char(42),char(109), +char(95),char(119),char(101),char(105),char(103),char(104),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(80),char(111),char(115),char(105),char(116),char(105), +char(111),char(110),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(87),char(101),char(105),char(103),char(116),char(115),char(0),char(109),char(95),char(98),char(118), +char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(98),char(102),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(97), +char(109),char(101),char(120),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(108),char(111),char(99),char(105),char(105),char(0),char(109),char(95),char(105),char(110), +char(118),char(119),char(105),char(0),char(109),char(95),char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109), +char(95),char(100),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(108),char(118),char(0),char(109), +char(95),char(97),char(118),char(0),char(42),char(109),char(95),char(102),char(114),char(97),char(109),char(101),char(114),char(101),char(102),char(115),char(0),char(42),char(109),char(95), +char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(115),char(115),char(101), +char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(114),char(97),char(109),char(101),char(82),char(101),char(102),char(115),char(0),char(109),char(95),char(110), +char(117),char(109),char(78),char(111),char(100),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(115),char(115),char(101),char(115),char(0), +char(109),char(95),char(105),char(100),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(105),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(110), +char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(105),char(109),char(112),char(117),char(108),char(115), +char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(108),char(100),char(97),char(109), +char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97), +char(116),char(99),char(104),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97),char(120),char(83),char(101),char(108),char(102),char(67),char(111),char(108),char(108), +char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(115),char(101),char(108),char(102),char(67), +char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(70),char(97),char(99),char(116),char(111), +char(114),char(0),char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(105),char(110),char(115),char(65),char(110),char(99),char(104),char(111),char(114),char(0),char(109), +char(95),char(99),char(111),char(108),char(108),char(105),char(100),char(101),char(0),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(110), +char(100),char(101),char(120),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121), +char(66),char(0),char(109),char(95),char(114),char(101),char(102),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(99),char(102),char(109),char(0),char(109),char(95), +char(115),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(100),char(101),char(108),char(101),char(116),char(101),char(0),char(109),char(95),char(114),char(101),char(108), +char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(91),char(50),char(93),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(116), +char(121),char(112),char(101),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(66),char(116),char(121),char(112),char(101),char(0),char(109),char(95),char(106),char(111), +char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(101),char(0),char(42),char(42),char(109),char(95), +char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(42),char(109),char(95),char(110),char(111),char(100),char(101),char(115),char(0),char(42), +char(109),char(95),char(108),char(105),char(110),char(107),char(115),char(0),char(42),char(109),char(95),char(102),char(97),char(99),char(101),char(115),char(0),char(42),char(109),char(95), +char(116),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(42),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114), +char(115),char(0),char(42),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(106),char(111),char(105), +char(110),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(109), +char(95),char(110),char(117),char(109),char(76),char(105),char(110),char(107),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(97),char(99),char(101),char(115), +char(0),char(109),char(95),char(110),char(117),char(109),char(84),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(109),char(95),char(110), +char(117),char(109),char(65),char(110),char(99),char(104),char(111),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(108),char(117),char(115),char(116), +char(101),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(74),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(99),char(111), +char(110),char(102),char(105),char(103),char(0),char(109),char(95),char(122),char(101),char(114),char(111),char(82),char(111),char(116),char(80),char(97),char(114),char(101),char(110),char(116), +char(84),char(111),char(84),char(104),char(105),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(67),char(111),char(109),char(84),char(111), +char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116),char(0),char(109),char(95),char(116),char(104),char(105),char(115), +char(80),char(105),char(118),char(111),char(116),char(84),char(111),char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116), +char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(84),char(111),char(112),char(91),char(54),char(93),char(0),char(109), +char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(66),char(111),char(116),char(116),char(111),char(109),char(91),char(54),char(93),char(0), +char(109),char(95),char(108),char(105),char(110),char(107),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(108),char(105),char(110),char(107), +char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(0),char(109), +char(95),char(100),char(111),char(102),char(67),char(111),char(117),char(110),char(116),char(0),char(109),char(95),char(112),char(111),char(115),char(86),char(97),char(114),char(67),char(111), +char(117),char(110),char(116),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(80),char(111),char(115),char(91),char(55),char(93),char(0),char(109),char(95), +char(106),char(111),char(105),char(110),char(116),char(86),char(101),char(108),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(84), +char(111),char(114),char(113),char(117),char(101),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(68),char(97),char(109),char(112), +char(105),char(110),char(103),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), +char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95), +char(106),char(111),char(105),char(110),char(116),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(106),char(111), +char(105),char(110),char(116),char(77),char(97),char(120),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(77), +char(97),char(120),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97), +char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108), +char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105), +char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97), +char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97), +char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78), +char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0), +char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0),char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115), +char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104),char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103), +char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102),char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0), +char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105),char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116), +char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83),char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97), +char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108), +char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114), +char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111), +char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117), +char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), +char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101), +char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122), +char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110), +char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97), +char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114), +char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116), +char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97),char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), +char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104), +char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110), +char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114), +char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117),char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99), +char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115), +char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111), +char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70), +char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121), +char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100), +char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114), +char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111),char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84), +char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112), +char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), +char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111), +char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80), +char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), +char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117), +char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), +char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110), +char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54), +char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114), +char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112), +char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), +char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97), +char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114), +char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101), +char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116), +char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83), +char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84),char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110),char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110),char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116), +char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100), +char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108), +char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111), +char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0),char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0), +char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(0),char(0),char(16),char(0),char(48),char(0),char(16),char(0),char(16),char(0), +char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0),char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0), +char(16),char(0),char(96),char(0),char(-112),char(0),char(16),char(0),char(56),char(0),char(56),char(0),char(20),char(0),char(72),char(0),char(4),char(0),char(4),char(0), +char(8),char(0),char(4),char(0),char(56),char(0),char(32),char(0),char(80),char(0),char(72),char(0),char(96),char(0),char(80),char(0),char(32),char(0),char(64),char(0), +char(64),char(0),char(64),char(0),char(16),char(0),char(72),char(0),char(80),char(0),char(-16),char(1),char(24),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0), +char(104),char(0),char(0),char(2),char(-64),char(3),char(8),char(0),char(64),char(0),char(64),char(0),char(0),char(0),char(80),char(0),char(96),char(0),char(-112),char(0), +char(-128),char(0),char(104),char(1),char(-24),char(0),char(-104),char(1),char(-120),char(1),char(-32),char(0),char(8),char(1),char(-40),char(1),char(104),char(1),char(-128),char(2), +char(-112),char(2),char(-64),char(4),char(-40),char(0),char(120),char(1),char(104),char(0),char(-104),char(0),char(16),char(0),char(104),char(0),char(24),char(0),char(40),char(0), +char(104),char(0),char(96),char(0),char(104),char(0),char(-56),char(0),char(104),char(1),char(112),char(0),char(-24),char(1),char(0),char(3),char(-104),char(1),char(-48),char(0), +char(112),char(0),char(0),char(0),char(83),char(84),char(82),char(67),char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0), +char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0),char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0), +char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0),char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0), +char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0), +char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0), +char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0),char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0), +char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0),char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0), +char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0), +char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0), +char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0), +char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0), +char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0),char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0), +char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0), +char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0), +char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), +char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0), +char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0), +char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0), +char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0), +char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0),char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0), +char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0),char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0), +char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0),char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0), +char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0),char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0), +char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0),char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0), +char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0),char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0), +char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0),char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0), +char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0), +char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0),char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0), +char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0),char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0), +char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0),char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0), +char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0), +char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0), +char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0), +char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0),char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0), +char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0),char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0), +char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0),char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0), +char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0),char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0), +char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0), +char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0),char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0), +char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0), +char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0),char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0), +char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0), +char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0), +char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0), +char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0), +char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0), +char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0),char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0), +char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0),char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0),char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), +char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0), +char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0),char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0), +char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0), +char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0),char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0), +char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0),char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0), +char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0), +char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0),char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0), +char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0),char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0), +char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), +char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0), +char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0),char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0), +char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0),char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0), +char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0),char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0), +char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0),char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0), +char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0),char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), +char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0),char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0), +char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0),char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0), +char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0),char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0), +char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0),char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0), +char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0), +char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0),char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0), +char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0), +char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0), +char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0),char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0), +char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0), +char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0), +char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), +char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), +char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0), +char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0),char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0), +char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0), +char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0), +char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0), +char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0), +char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), +char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0),char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0), +char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0), +char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0), +char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0), +char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0),char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), +char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), +char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0), +char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0),char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0), +char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0),char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0), +char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0), +char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0),char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0), +char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0),char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0), +char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), +char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0), +char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0),char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0), +char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0),char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0), +char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0), +char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0), +char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0),char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0), +char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0),char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0), +char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0), +char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0),char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0), +char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0),char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0), +char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0), +char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0), +char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0), +char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0), +char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0), +char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0), +char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0),char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0), +char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0),char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0), +char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0),char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0), +char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0),char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0), +char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0),char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0), +char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0),char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1), +char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1), +char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1), +char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1),char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1), +char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1),char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1), +char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1),char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1), +char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1),char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1), +char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1),char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1), +char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1),char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1), +char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1),char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1), +char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0),char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1), +char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1), +char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1),char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0), +char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1),char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1), +char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1),char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1), +char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1),char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1), +char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1),char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1), +char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1),char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1), +char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1),char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1), +char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1),char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1), +char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1),char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1), +char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0),char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1), +char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1),char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1), +char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1),char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1), +char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1),char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1), +char(86),char(0),char(103),char(1),char(91),char(0),char(24),char(0),char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1), +char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1),char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1), +char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1),char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1), +char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1),char(8),char(0),char(118),char(1),char(8),char(0),char(119),char(1),char(8),char(0),char(120),char(1), +char(8),char(0),char(121),char(1),char(8),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(49),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(92),char(0),char(24),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1), +char(13),char(0),char(107),char(1),char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1), +char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1), +char(4),char(0),char(113),char(1),char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(7),char(0),char(119),char(1),char(7),char(0),char(120),char(1), +char(7),char(0),char(121),char(1),char(7),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(50),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(127),char(1),char(14),char(0),char(-128),char(1),char(8),char(0),char(-127),char(1), +char(0),char(0),char(-126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(-125),char(1),char(0),char(0),char(126),char(1),char(4),char(0),char(97),char(1), +char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(-126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(-125),char(1), +char(19),char(0),char(127),char(1),char(13),char(0),char(-128),char(1),char(7),char(0),char(-127),char(1),char(4),char(0),char(97),char(1),}; +int sBulletDNAlen64= sizeof(sBulletDNAstr64); diff --git a/Engine/lib/bullet/src/LinearMath/btThreads.cpp b/Engine/lib/bullet/src/LinearMath/btThreads.cpp index 4bef499f7..59a7ea36e 100644 --- a/Engine/lib/bullet/src/LinearMath/btThreads.cpp +++ b/Engine/lib/bullet/src/LinearMath/btThreads.cpp @@ -14,7 +14,40 @@ subject to the following restrictions: #include "btThreads.h" +#include "btQuickprof.h" +#include // for min and max + +#if BT_USE_OPENMP && BT_THREADSAFE + +#include + +#endif // #if BT_USE_OPENMP && BT_THREADSAFE + + +#if BT_USE_PPL && BT_THREADSAFE + +// use Microsoft Parallel Patterns Library (installed with Visual Studio 2010 and later) +#include // if you get a compile error here, check whether your version of Visual Studio includes PPL +// Visual Studio 2010 and later should come with it +#include // for GetProcessorCount() + +#endif // #if BT_USE_PPL && BT_THREADSAFE + + +#if BT_USE_TBB && BT_THREADSAFE + +// use Intel Threading Building Blocks for thread management +#define __TBB_NO_IMPLICIT_LINKAGE 1 +#include +#include +#include +#include + +#endif // #if BT_USE_TBB && BT_THREADSAFE + + +#if BT_THREADSAFE // // Lightweight spin-mutex based on atomics // Using ordinary system-provided mutexes like Windows critical sections was noticeably slower @@ -22,8 +55,6 @@ subject to the following restrictions: // context switching. // -#if BT_THREADSAFE - #if __cplusplus >= 201103L // for anything claiming full C++11 compliance, use C++11 atomics @@ -169,28 +200,107 @@ void btSpinMutex::unlock() #endif //#else //#elif USE_MSVC_INTRINSICS +#else //#if BT_THREADSAFE + +// These should not be called ever +void btSpinMutex::lock() +{ + btAssert( !"unimplemented btSpinMutex::lock() called" ); +} + +void btSpinMutex::unlock() +{ + btAssert( !"unimplemented btSpinMutex::unlock() called" ); +} + +bool btSpinMutex::tryLock() +{ + btAssert( !"unimplemented btSpinMutex::tryLock() called" ); + return true; +} + +#define THREAD_LOCAL_STATIC static + +#endif // #else //#if BT_THREADSAFE + struct ThreadsafeCounter { unsigned int mCounter; btSpinMutex mMutex; - ThreadsafeCounter() {mCounter=0;} + ThreadsafeCounter() + { + mCounter = 0; + --mCounter; // first count should come back 0 + } unsigned int getNext() { // no need to optimize this with atomics, it is only called ONCE per thread! mMutex.lock(); - unsigned int val = mCounter++; + mCounter++; + if ( mCounter >= BT_MAX_THREAD_COUNT ) + { + btAssert( !"thread counter exceeded" ); + // wrap back to the first worker index + mCounter = 1; + } + unsigned int val = mCounter; mMutex.unlock(); return val; } }; + +static btITaskScheduler* gBtTaskScheduler; +static int gThreadsRunningCounter = 0; // useful for detecting if we are trying to do nested parallel-for calls +static btSpinMutex gThreadsRunningCounterMutex; static ThreadsafeCounter gThreadCounter; -// return a unique index per thread, starting with 0 and counting up +// +// BT_DETECT_BAD_THREAD_INDEX tries to detect when there are multiple threads assigned the same thread index. +// +// BT_DETECT_BAD_THREAD_INDEX is a developer option to test if +// certain assumptions about how the task scheduler manages its threads +// holds true. +// The main assumption is: +// - when the threadpool is resized, the task scheduler either +// 1. destroys all worker threads and creates all new ones in the correct number, OR +// 2. never destroys a worker thread +// +// We make that assumption because we can't easily enumerate the worker threads of a task scheduler +// to assign nice sequential thread-indexes. We also do not get notified if a worker thread is destroyed, +// so we can't tell when a thread-index is no longer being used. +// We allocate thread-indexes as needed with a sequential global thread counter. +// +// Our simple thread-counting scheme falls apart if the task scheduler destroys some threads but +// continues to re-use other threads and the application repeatedly resizes the thread pool of the +// task scheduler. +// In order to prevent the thread-counter from exceeding the global max (BT_MAX_THREAD_COUNT), we +// wrap the thread counter back to 1. This should only happen if the worker threads have all been +// destroyed and re-created. +// +// BT_DETECT_BAD_THREAD_INDEX only works for Win32 right now, +// but could be adapted to work with pthreads +#define BT_DETECT_BAD_THREAD_INDEX 0 + +#if BT_DETECT_BAD_THREAD_INDEX + +typedef DWORD ThreadId_t; +const static ThreadId_t kInvalidThreadId = 0; +ThreadId_t gDebugThreadIds[ BT_MAX_THREAD_COUNT ]; + +static ThreadId_t getDebugThreadId() +{ + return GetCurrentThreadId(); +} + +#endif // #if BT_DETECT_BAD_THREAD_INDEX + + +// return a unique index per thread, main thread is 0, worker threads are in [1, BT_MAX_THREAD_COUNT) unsigned int btGetCurrentThreadIndex() { const unsigned int kNullIndex = ~0U; @@ -198,7 +308,30 @@ unsigned int btGetCurrentThreadIndex() if ( sThreadIndex == kNullIndex ) { sThreadIndex = gThreadCounter.getNext(); + btAssert( sThreadIndex < BT_MAX_THREAD_COUNT ); } +#if BT_DETECT_BAD_THREAD_INDEX + if ( gBtTaskScheduler && sThreadIndex > 0 ) + { + ThreadId_t tid = getDebugThreadId(); + // if not set + if ( gDebugThreadIds[ sThreadIndex ] == kInvalidThreadId ) + { + // set it + gDebugThreadIds[ sThreadIndex ] = tid; + } + else + { + if ( gDebugThreadIds[ sThreadIndex ] != tid ) + { + // this could indicate the task scheduler is breaking our assumptions about + // how threads are managed when threadpool is resized + btAssert( !"there are 2 or more threads with the same thread-index!" ); + __debugbreak(); + } + } + } +#endif // #if BT_DETECT_BAD_THREAD_INDEX return sThreadIndex; } @@ -207,24 +340,383 @@ bool btIsMainThread() return btGetCurrentThreadIndex() == 0; } +void btResetThreadIndexCounter() +{ + // for when all current worker threads are destroyed + btAssert( btIsMainThread() ); + gThreadCounter.mCounter = 0; +} + +btITaskScheduler::btITaskScheduler( const char* name ) +{ + m_name = name; + m_savedThreadCounter = 0; + m_isActive = false; +} + +void btITaskScheduler::activate() +{ + // gThreadCounter is used to assign a thread-index to each worker thread in a task scheduler. + // The main thread is always thread-index 0, and worker threads are numbered from 1 to 63 (BT_MAX_THREAD_COUNT-1) + // The thread-indexes need to be unique amongst the threads that can be running simultaneously. + // Since only one task scheduler can be used at a time, it is OK for a pair of threads that belong to different + // task schedulers to share the same thread index because they can't be running at the same time. + // So each task scheduler needs to keep its own thread counter value + if ( !m_isActive ) + { + gThreadCounter.mCounter = m_savedThreadCounter; // restore saved thread counter + m_isActive = true; + } +} + +void btITaskScheduler::deactivate() +{ + if ( m_isActive ) + { + m_savedThreadCounter = gThreadCounter.mCounter; // save thread counter + m_isActive = false; + } +} + +void btPushThreadsAreRunning() +{ + gThreadsRunningCounterMutex.lock(); + gThreadsRunningCounter++; + gThreadsRunningCounterMutex.unlock(); +} + +void btPopThreadsAreRunning() +{ + gThreadsRunningCounterMutex.lock(); + gThreadsRunningCounter--; + gThreadsRunningCounterMutex.unlock(); +} + +bool btThreadsAreRunning() +{ + return gThreadsRunningCounter != 0; +} + + +void btSetTaskScheduler( btITaskScheduler* ts ) +{ + int threadId = btGetCurrentThreadIndex(); // make sure we call this on main thread at least once before any workers run + if ( threadId != 0 ) + { + btAssert( !"btSetTaskScheduler must be called from the main thread!" ); + return; + } + if ( gBtTaskScheduler ) + { + // deactivate old task scheduler + gBtTaskScheduler->deactivate(); + } + gBtTaskScheduler = ts; + if ( ts ) + { + // activate new task scheduler + ts->activate(); + } +} + + +btITaskScheduler* btGetTaskScheduler() +{ + return gBtTaskScheduler; +} + + +void btParallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) +{ +#if BT_THREADSAFE + +#if BT_DETECT_BAD_THREAD_INDEX + if ( !btThreadsAreRunning() ) + { + // clear out thread ids + for ( int i = 0; i < BT_MAX_THREAD_COUNT; ++i ) + { + gDebugThreadIds[ i ] = kInvalidThreadId; + } + } +#endif // #if BT_DETECT_BAD_THREAD_INDEX + + btAssert( gBtTaskScheduler != NULL ); // call btSetTaskScheduler() with a valid task scheduler first! + gBtTaskScheduler->parallelFor( iBegin, iEnd, grainSize, body ); + #else // #if BT_THREADSAFE -// These should not be called ever -void btSpinMutex::lock() -{ - btAssert(!"unimplemented btSpinMutex::lock() called"); + // non-parallel version of btParallelFor + btAssert( !"called btParallelFor in non-threadsafe build. enable BT_THREADSAFE" ); + body.forLoop( iBegin, iEnd ); + +#endif// #if BT_THREADSAFE } -void btSpinMutex::unlock() + +/// +/// btTaskSchedulerSequential -- non-threaded implementation of task scheduler +/// (really just useful for testing performance of single threaded vs multi) +/// +class btTaskSchedulerSequential : public btITaskScheduler { - btAssert(!"unimplemented btSpinMutex::unlock() called"); +public: + btTaskSchedulerSequential() : btITaskScheduler( "Sequential" ) {} + virtual int getMaxNumThreads() const BT_OVERRIDE { return 1; } + virtual int getNumThreads() const BT_OVERRIDE { return 1; } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE {} + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_sequential" ); + body.forLoop( iBegin, iEnd ); + } +}; + + +#if BT_USE_OPENMP && BT_THREADSAFE +/// +/// btTaskSchedulerOpenMP -- wrapper around OpenMP task scheduler +/// +class btTaskSchedulerOpenMP : public btITaskScheduler +{ + int m_numThreads; +public: + btTaskSchedulerOpenMP() : btITaskScheduler( "OpenMP" ) + { + m_numThreads = 0; + } + virtual int getMaxNumThreads() const BT_OVERRIDE + { + return omp_get_max_threads(); + } + virtual int getNumThreads() const BT_OVERRIDE + { + return m_numThreads; + } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE + { + // With OpenMP, because it is a standard with various implementations, we can't + // know for sure if every implementation has the same behavior of destroying all + // previous threads when resizing the threadpool + m_numThreads = ( std::max )( 1, ( std::min )( int( BT_MAX_THREAD_COUNT ), numThreads ) ); + omp_set_num_threads( 1 ); // hopefully, all previous threads get destroyed here + omp_set_num_threads( m_numThreads ); + m_savedThreadCounter = 0; + if ( m_isActive ) + { + btResetThreadIndexCounter(); + } + } + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_OpenMP" ); + btPushThreadsAreRunning(); +#pragma omp parallel for schedule( static, 1 ) + for ( int i = iBegin; i < iEnd; i += grainSize ) + { + BT_PROFILE( "OpenMP_job" ); + body.forLoop( i, ( std::min )( i + grainSize, iEnd ) ); + } + btPopThreadsAreRunning(); + } +}; +#endif // #if BT_USE_OPENMP && BT_THREADSAFE + + +#if BT_USE_TBB && BT_THREADSAFE +/// +/// btTaskSchedulerTBB -- wrapper around Intel Threaded Building Blocks task scheduler +/// +class btTaskSchedulerTBB : public btITaskScheduler +{ + int m_numThreads; + tbb::task_scheduler_init* m_tbbSchedulerInit; + +public: + btTaskSchedulerTBB() : btITaskScheduler( "IntelTBB" ) + { + m_numThreads = 0; + m_tbbSchedulerInit = NULL; + } + ~btTaskSchedulerTBB() + { + if ( m_tbbSchedulerInit ) + { + delete m_tbbSchedulerInit; + m_tbbSchedulerInit = NULL; + } + } + + virtual int getMaxNumThreads() const BT_OVERRIDE + { + return tbb::task_scheduler_init::default_num_threads(); + } + virtual int getNumThreads() const BT_OVERRIDE + { + return m_numThreads; + } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE + { + m_numThreads = ( std::max )( 1, ( std::min )( int(BT_MAX_THREAD_COUNT), numThreads ) ); + if ( m_tbbSchedulerInit ) + { + // destroys all previous threads + delete m_tbbSchedulerInit; + m_tbbSchedulerInit = NULL; + } + m_tbbSchedulerInit = new tbb::task_scheduler_init( m_numThreads ); + m_savedThreadCounter = 0; + if ( m_isActive ) + { + btResetThreadIndexCounter(); + } + } + struct BodyAdapter + { + const btIParallelForBody* mBody; + + void operator()( const tbb::blocked_range& range ) const + { + BT_PROFILE( "TBB_job" ); + mBody->forLoop( range.begin(), range.end() ); + } + }; + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_TBB" ); + // TBB dispatch + BodyAdapter tbbBody; + tbbBody.mBody = &body; + btPushThreadsAreRunning(); + tbb::parallel_for( tbb::blocked_range( iBegin, iEnd, grainSize ), + tbbBody, + tbb::simple_partitioner() + ); + btPopThreadsAreRunning(); + } +}; +#endif // #if BT_USE_TBB && BT_THREADSAFE + + +#if BT_USE_PPL && BT_THREADSAFE +/// +/// btTaskSchedulerPPL -- wrapper around Microsoft Parallel Patterns Lib task scheduler +/// +class btTaskSchedulerPPL : public btITaskScheduler +{ + int m_numThreads; +public: + btTaskSchedulerPPL() : btITaskScheduler( "PPL" ) + { + m_numThreads = 0; + } + virtual int getMaxNumThreads() const BT_OVERRIDE + { + return concurrency::GetProcessorCount(); + } + virtual int getNumThreads() const BT_OVERRIDE + { + return m_numThreads; + } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE + { + // capping the thread count for PPL due to a thread-index issue + const int maxThreadCount = (std::min)(int(BT_MAX_THREAD_COUNT), 31); + m_numThreads = ( std::max )( 1, ( std::min )( maxThreadCount, numThreads ) ); + using namespace concurrency; + if ( CurrentScheduler::Id() != -1 ) + { + CurrentScheduler::Detach(); + } + SchedulerPolicy policy; + { + // PPL seems to destroy threads when threadpool is shrunk, but keeps reusing old threads + // force it to destroy old threads + policy.SetConcurrencyLimits( 1, 1 ); + CurrentScheduler::Create( policy ); + CurrentScheduler::Detach(); + } + policy.SetConcurrencyLimits( m_numThreads, m_numThreads ); + CurrentScheduler::Create( policy ); + m_savedThreadCounter = 0; + if ( m_isActive ) + { + btResetThreadIndexCounter(); + } + } + struct BodyAdapter + { + const btIParallelForBody* mBody; + int mGrainSize; + int mIndexEnd; + + void operator()( int i ) const + { + BT_PROFILE( "PPL_job" ); + mBody->forLoop( i, ( std::min )( i + mGrainSize, mIndexEnd ) ); + } + }; + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_PPL" ); + // PPL dispatch + BodyAdapter pplBody; + pplBody.mBody = &body; + pplBody.mGrainSize = grainSize; + pplBody.mIndexEnd = iEnd; + btPushThreadsAreRunning(); + // note: MSVC 2010 doesn't support partitioner args, so avoid them + concurrency::parallel_for( iBegin, + iEnd, + grainSize, + pplBody + ); + btPopThreadsAreRunning(); + } +}; +#endif // #if BT_USE_PPL && BT_THREADSAFE + + +// create a non-threaded task scheduler (always available) +btITaskScheduler* btGetSequentialTaskScheduler() +{ + static btTaskSchedulerSequential sTaskScheduler; + return &sTaskScheduler; } -bool btSpinMutex::tryLock() + +// create an OpenMP task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetOpenMPTaskScheduler() { - btAssert(!"unimplemented btSpinMutex::tryLock() called"); - return true; +#if BT_USE_OPENMP && BT_THREADSAFE + static btTaskSchedulerOpenMP sTaskScheduler; + return &sTaskScheduler; +#else + return NULL; +#endif } -#endif // #else // #if BT_THREADSAFE + +// create an Intel TBB task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetTBBTaskScheduler() +{ +#if BT_USE_TBB && BT_THREADSAFE + static btTaskSchedulerTBB sTaskScheduler; + return &sTaskScheduler; +#else + return NULL; +#endif +} + + +// create a PPL task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetPPLTaskScheduler() +{ +#if BT_USE_PPL && BT_THREADSAFE + static btTaskSchedulerPPL sTaskScheduler; + return &sTaskScheduler; +#else + return NULL; +#endif +} diff --git a/Engine/lib/bullet/src/LinearMath/btThreads.h b/Engine/lib/bullet/src/LinearMath/btThreads.h index db710979f..05fd15ec8 100644 --- a/Engine/lib/bullet/src/LinearMath/btThreads.h +++ b/Engine/lib/bullet/src/LinearMath/btThreads.h @@ -19,6 +19,23 @@ subject to the following restrictions: #include "btScalar.h" // has definitions like SIMD_FORCE_INLINE +#if defined (_MSC_VER) && _MSC_VER >= 1600 +// give us a compile error if any signatures of overriden methods is changed +#define BT_OVERRIDE override +#endif + +#ifndef BT_OVERRIDE +#define BT_OVERRIDE +#endif + +const unsigned int BT_MAX_THREAD_COUNT = 64; // only if BT_THREADSAFE is 1 + +// for internal use only +bool btIsMainThread(); +bool btThreadsAreRunning(); +unsigned int btGetCurrentThreadIndex(); +void btResetThreadIndexCounter(); // notify that all worker threads have been destroyed + /// /// btSpinMutex -- lightweight spin-mutex implemented with atomic ops, never puts /// a thread to sleep because it is designed to be used with a task scheduler @@ -39,38 +56,100 @@ public: bool tryLock(); }; -#if BT_THREADSAFE -// for internal Bullet use only +// +// NOTE: btMutex* is for internal Bullet use only +// +// If BT_THREADSAFE is undefined or 0, should optimize away to nothing. +// This is good because for the single-threaded build of Bullet, any calls +// to these functions will be optimized out. +// +// However, for users of the multi-threaded build of Bullet this is kind +// of bad because if you call any of these functions from external code +// (where BT_THREADSAFE is undefined) you will get unexpected race conditions. +// SIMD_FORCE_INLINE void btMutexLock( btSpinMutex* mutex ) { +#if BT_THREADSAFE mutex->lock(); +#endif // #if BT_THREADSAFE } SIMD_FORCE_INLINE void btMutexUnlock( btSpinMutex* mutex ) { +#if BT_THREADSAFE mutex->unlock(); +#endif // #if BT_THREADSAFE } SIMD_FORCE_INLINE bool btMutexTryLock( btSpinMutex* mutex ) { +#if BT_THREADSAFE return mutex->tryLock(); +#else + return true; +#endif // #if BT_THREADSAFE } -// for internal use only -bool btIsMainThread(); -unsigned int btGetCurrentThreadIndex(); -const unsigned int BT_MAX_THREAD_COUNT = 64; -#else +// +// btIParallelForBody -- subclass this to express work that can be done in parallel +// +class btIParallelForBody +{ +public: + virtual ~btIParallelForBody() {} + virtual void forLoop( int iBegin, int iEnd ) const = 0; +}; + +// +// btITaskScheduler -- subclass this to implement a task scheduler that can dispatch work to +// worker threads +// +class btITaskScheduler +{ +public: + btITaskScheduler( const char* name ); + virtual ~btITaskScheduler() {} + const char* getName() const { return m_name; } + + virtual int getMaxNumThreads() const = 0; + virtual int getNumThreads() const = 0; + virtual void setNumThreads( int numThreads ) = 0; + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) = 0; + + // internal use only + virtual void activate(); + virtual void deactivate(); + +protected: + const char* m_name; + unsigned int m_savedThreadCounter; + bool m_isActive; +}; + +// set the task scheduler to use for all calls to btParallelFor() +// NOTE: you must set this prior to using any of the multi-threaded "Mt" classes +void btSetTaskScheduler( btITaskScheduler* ts ); + +// get the current task scheduler +btITaskScheduler* btGetTaskScheduler(); + +// get non-threaded task scheduler (always available) +btITaskScheduler* btGetSequentialTaskScheduler(); + +// get OpenMP task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetOpenMPTaskScheduler(); + +// get Intel TBB task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetTBBTaskScheduler(); + +// get PPL task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetPPLTaskScheduler(); + +// btParallelFor -- call this to dispatch work like a for-loop +// (iterations may be done out of order, so no dependencies are allowed) +void btParallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ); -// for internal Bullet use only -// if BT_THREADSAFE is undefined or 0, should optimize away to nothing -SIMD_FORCE_INLINE void btMutexLock( btSpinMutex* ) {} -SIMD_FORCE_INLINE void btMutexUnlock( btSpinMutex* ) {} -SIMD_FORCE_INLINE bool btMutexTryLock( btSpinMutex* ) {return true;} #endif - - -#endif //BT_THREADS_H diff --git a/Engine/lib/bullet/src/LinearMath/btTransformUtil.h b/Engine/lib/bullet/src/LinearMath/btTransformUtil.h index 2303c2742..182cc43fa 100644 --- a/Engine/lib/bullet/src/LinearMath/btTransformUtil.h +++ b/Engine/lib/bullet/src/LinearMath/btTransformUtil.h @@ -47,13 +47,19 @@ public: #ifdef QUATERNION_DERIVATIVE btQuaternion predictedOrn = curTrans.getRotation(); predictedOrn += (angvel * predictedOrn) * (timeStep * btScalar(0.5)); - predictedOrn.normalize(); + predictedOrn.safeNormalize(); #else //Exponential map //google for "Practical Parameterization of Rotations Using the Exponential Map", F. Sebastian Grassia btVector3 axis; - btScalar fAngle = angvel.length(); + btScalar fAngle2 = angvel.length2(); + btScalar fAngle = 0; + if (fAngle2>SIMD_EPSILON) + { + fAngle = btSqrt(fAngle2); + } + //limit the angular motion if (fAngle*timeStep > ANGULAR_MOTION_THRESHOLD) { @@ -74,9 +80,16 @@ public: btQuaternion orn0 = curTrans.getRotation(); btQuaternion predictedOrn = dorn * orn0; - predictedOrn.normalize(); + predictedOrn.safeNormalize(); #endif - predictedTransform.setRotation(predictedOrn); + if (predictedOrn.length2()>SIMD_EPSILON) + { + predictedTransform.setRotation(predictedOrn); + } + else + { + predictedTransform.setBasis(curTrans.getBasis()); + } } static void calculateVelocityQuaternion(const btVector3& pos0,const btVector3& pos1,const btQuaternion& orn0,const btQuaternion& orn1,btScalar timeStep,btVector3& linVel,btVector3& angVel) diff --git a/Engine/lib/bullet/src/LinearMath/btVector3.h b/Engine/lib/bullet/src/LinearMath/btVector3.h index 487670009..fdf3fd796 100644 --- a/Engine/lib/bullet/src/LinearMath/btVector3.h +++ b/Engine/lib/bullet/src/LinearMath/btVector3.h @@ -291,14 +291,16 @@ public: SIMD_FORCE_INLINE btVector3& safeNormalize() { - btVector3 absVec = this->absolute(); - int maxIndex = absVec.maxAxis(); - if (absVec[maxIndex]>0) + btScalar l2 = length2(); + //triNormal.normalize(); + if (l2 >= SIMD_EPSILON*SIMD_EPSILON) { - *this /= absVec[maxIndex]; - return *this /= length(); + (*this) /= btSqrt(l2); + } + else + { + setValue(1, 0, 0); } - setValue(1,0,0); return *this; } @@ -1157,7 +1159,6 @@ public: if (m_floats[3] > maxVal) { maxIndex = 3; - maxVal = m_floats[3]; } return maxIndex; diff --git a/Engine/lib/bullet/src/btBulletCollisionCommon.h b/Engine/lib/bullet/src/btBulletCollisionCommon.h index af981b5d3..948e02eb4 100644 --- a/Engine/lib/bullet/src/btBulletCollisionCommon.h +++ b/Engine/lib/bullet/src/btBulletCollisionCommon.h @@ -52,7 +52,6 @@ subject to the following restrictions: #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" #include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h" #include "BulletCollision/BroadphaseCollision/btAxisSweep3.h" -#include "BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h" #include "BulletCollision/BroadphaseCollision/btDbvtBroadphase.h" ///Math library & Utils From c7579f76fca5bf77187d5f16ef48c0353e050242 Mon Sep 17 00:00:00 2001 From: Johxz Date: Sun, 4 Feb 2018 22:26:02 -0600 Subject: [PATCH 119/312] update to libogg v133 --- Engine/lib/libogg/CHANGES | 6 +++++ Engine/lib/libogg/include/ogg/ogg.h | 2 +- Engine/lib/libogg/include/ogg/os_types.h | 33 ++++++++++++------------ Engine/lib/libogg/src/bitwise.c | 2 +- Engine/lib/libogg/src/framing.c | 33 ++++++++++++++++++++++-- 5 files changed, 56 insertions(+), 20 deletions(-) diff --git a/Engine/lib/libogg/CHANGES b/Engine/lib/libogg/CHANGES index 3f2e0fb26..6814e31be 100644 --- a/Engine/lib/libogg/CHANGES +++ b/Engine/lib/libogg/CHANGES @@ -1,3 +1,9 @@ +Version 1.3.3 (2017 November 7) + + * Fix and issue with corrupt continued packet handling. + * Update Windows projects and build settings. + * Remove Mac OS 9 build support. + Version 1.3.2 (2014 May 27) * Fix an bug in oggpack_writecopy(). diff --git a/Engine/lib/libogg/include/ogg/ogg.h b/Engine/lib/libogg/include/ogg/ogg.h index cea4ebed7..7609fc24d 100644 --- a/Engine/lib/libogg/include/ogg/ogg.h +++ b/Engine/lib/libogg/include/ogg/ogg.h @@ -11,7 +11,7 @@ ******************************************************************** function: toplevel libogg include - last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $ + last mod: $Id$ ********************************************************************/ #ifndef _OGG_H diff --git a/Engine/lib/libogg/include/ogg/os_types.h b/Engine/lib/libogg/include/ogg/os_types.h index 8bf82107e..b8f56308b 100644 --- a/Engine/lib/libogg/include/ogg/os_types.h +++ b/Engine/lib/libogg/include/ogg/os_types.h @@ -11,7 +11,7 @@ ******************************************************************** function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os_types.h 19098 2014-02-26 19:06:45Z giles $ + last mod: $Id$ ********************************************************************/ #ifndef _OS_TYPES_H @@ -49,23 +49,24 @@ typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; # else - /* MSVC/Borland */ - typedef __int64 ogg_int64_t; - typedef __int32 ogg_int32_t; - typedef unsigned __int32 ogg_uint32_t; - typedef __int16 ogg_int16_t; - typedef unsigned __int16 ogg_uint16_t; +# if defined(_MSC_VER) && (_MSC_VER >= 1800) /* MSVC 2013 and newer */ +# include + typedef int16_t ogg_int16_t; + typedef uint16_t ogg_uint16_t; + typedef int32_t ogg_int32_t; + typedef uint32_t ogg_uint32_t; + typedef int64_t ogg_int64_t; + typedef uint64_t ogg_uint64_t; +# else + /* MSVC/Borland */ + typedef __int64 ogg_int64_t; + typedef __int32 ogg_int32_t; + typedef unsigned __int32 ogg_uint32_t; + typedef __int16 ogg_int16_t; + typedef unsigned __int16 ogg_uint16_t; +# endif # endif -#elif defined(__MACOS__) - -# include - typedef SInt16 ogg_int16_t; - typedef UInt16 ogg_uint16_t; - typedef SInt32 ogg_int32_t; - typedef UInt32 ogg_uint32_t; - typedef SInt64 ogg_int64_t; - #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ # include diff --git a/Engine/lib/libogg/src/bitwise.c b/Engine/lib/libogg/src/bitwise.c index 145901d18..fa2b57202 100644 --- a/Engine/lib/libogg/src/bitwise.c +++ b/Engine/lib/libogg/src/bitwise.c @@ -11,7 +11,7 @@ ******************************************************************** function: packing variable sized words into an octet stream - last mod: $Id: bitwise.c 19149 2014-05-27 16:26:23Z giles $ + last mod: $Id$ ********************************************************************/ diff --git a/Engine/lib/libogg/src/framing.c b/Engine/lib/libogg/src/framing.c index 3a2f0a605..79fc715c8 100644 --- a/Engine/lib/libogg/src/framing.c +++ b/Engine/lib/libogg/src/framing.c @@ -12,7 +12,7 @@ function: code raw packets into framed OggSquish stream and decode Ogg streams back into raw packets - last mod: $Id: framing.c 18758 2013-01-08 16:29:56Z tterribe $ + last mod: $Id$ note: The CRC code is directly derived from public domain code by Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html @@ -875,6 +875,7 @@ int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){ some segments */ if(continued){ if(os->lacing_fill<1 || + (os->lacing_vals[os->lacing_fill-1]&0xff)<255 || os->lacing_vals[os->lacing_fill-1]==0x400){ bos=0; for(;segptrpacket!=op2->packet){ + fprintf(stderr,"op1->packet != op2->packet\n"); + return(1); + } + if(op1->bytes!=op2->bytes){ + fprintf(stderr,"op1->bytes != op2->bytes\n"); + return(1); + } + if(op1->b_o_s!=op2->b_o_s){ + fprintf(stderr,"op1->b_o_s != op2->b_o_s\n"); + return(1); + } + if(op1->e_o_s!=op2->e_o_s){ + fprintf(stderr,"op1->e_o_s != op2->e_o_s\n"); + return(1); + } + if(op1->granulepos!=op2->granulepos){ + fprintf(stderr,"op1->granulepos != op2->granulepos\n"); + return(1); + } + if(op1->packetno!=op2->packetno){ + fprintf(stderr,"op1->packetno != op2->packetno\n"); + return(1); + } + return(0); +} + void test_pack(const int *pl, const int **headers, int byteskip, int pageskip, int packetskip){ unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */ @@ -1600,7 +1629,7 @@ void test_pack(const int *pl, const int **headers, int byteskip, ogg_stream_packetout(&os_de,&op_de); /* just catching them all */ /* verify peek and out match */ - if(memcmp(&op_de,&op_de2,sizeof(op_de))){ + if(compare_packet(&op_de,&op_de2)){ fprintf(stderr,"packetout != packetpeek! pos=%ld\n", depacket); exit(1); From 9d01f7a97351fe1c65fc5d00a0a504e2af9254e2 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Mon, 5 Feb 2018 23:02:02 +0000 Subject: [PATCH 120/312] Remove nested CLASSDOC Macro --- Engine/source/console/consoleObject.h | 4 ---- Engine/source/console/engineTypes.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Engine/source/console/consoleObject.h b/Engine/source/console/consoleObject.h index 2ff2bc5a3..f187c741c 100644 --- a/Engine/source/console/consoleObject.h +++ b/Engine/source/console/consoleObject.h @@ -1263,10 +1263,6 @@ inline bool& ConsoleObject::getDynamicGroupExpand() EnginePropertyTable _propTable( sizeof( _props ) / sizeof( _props[ 0 ] ) - 1, _props ); \ } } -/// Add an auto-doc for a class. -#define ConsoleDocClass( className, docString ) \ - CLASSDOC( className, docString ) - /// @} //------------------------------------------------------------------------------ diff --git a/Engine/source/console/engineTypes.h b/Engine/source/console/engineTypes.h index 321e39686..2217ee770 100644 --- a/Engine/source/console/engineTypes.h +++ b/Engine/source/console/engineTypes.h @@ -576,7 +576,7 @@ namespace _Private { uintptr_t( ( ( const char* ) &( ( ( ThisType* ) 16 )->fieldName ) ) - 16 ) // Artificial offset to avoid compiler warnings. /// -#define CLASSDOC( className, doc ) \ +#define ConsoleDocClass( className, doc ) \ template<> const char* EngineClassTypeInfo< className, className::_ClassBase >::smDocString = doc; From 40fff8ef5010572e2e03c27e1978c30ff8b0089c Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 8 Feb 2018 16:00:11 -0600 Subject: [PATCH 121/312] Stabilizes the add/remove behavior of menubars by also tracking the modeless background control the menubars use for proper cleanup as well. Also fixes an issue where the findMenu call wasn't properly translating the incoming string to StringTableEntry. --- Engine/source/gui/core/guiCanvas.cpp | 23 +++++++++++++++-------- Engine/source/gui/core/guiCanvas.h | 1 + Engine/source/gui/editor/guiMenuBar.cpp | 5 +++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 5202e57bf..71a4eb760 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -133,7 +133,8 @@ GuiCanvas::GuiCanvas(): GuiControl(), mLastRenderMs(0), mPlatformWindow(NULL), mDisplayWindow(true), - mMenuBarCtrl(NULL) + mMenuBarCtrl(nullptr), + mMenuBackground(nullptr) { setBounds(0, 0, 640, 480); mAwake = true; @@ -296,8 +297,11 @@ void GuiCanvas::setMenuBar(SimObject *obj) mMenuBarCtrl = dynamic_cast(obj); //remove old menubar - if( oldMenuBar ) - Parent::removeObject( oldMenuBar ); + if (oldMenuBar) + { + Parent::removeObject(oldMenuBar); + Parent::removeObject(mMenuBackground); //also remove the modeless wrapper + } // set new menubar if (mMenuBarCtrl) @@ -312,14 +316,17 @@ void GuiCanvas::setMenuBar(SimObject *obj) return; } - GuiControl* menuBackground = new GuiControl(); - menuBackground->registerObject(); + if (mMenuBackground == nullptr) + { + mMenuBackground = new GuiControl(); + mMenuBackground->registerObject(); - menuBackground->setControlProfile(profile); + mMenuBackground->setControlProfile(profile); + } - menuBackground->addObject(mMenuBarCtrl); + mMenuBackground->addObject(mMenuBarCtrl); - Parent::addObject(menuBackground); + Parent::addObject(mMenuBackground); } // update window accelerator keys diff --git a/Engine/source/gui/core/guiCanvas.h b/Engine/source/gui/core/guiCanvas.h index b193bfbf1..f9f4a37af 100644 --- a/Engine/source/gui/core/guiCanvas.h +++ b/Engine/source/gui/core/guiCanvas.h @@ -198,6 +198,7 @@ protected: static CanvasSizeChangeSignal smCanvasSizeChangeSignal; GuiControl *mMenuBarCtrl; + GuiControl* mMenuBackground; public: DECLARE_CONOBJECT(GuiCanvas); diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index fc9623498..dc168436b 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -1519,9 +1519,10 @@ DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nu object->insert(pObject, pos); } -DefineConsoleMethod(GuiMenuBar, findMenu, S32, (StringTableEntry barTitle), (""), "(barTitle)") +DefineConsoleMethod(GuiMenuBar, findMenu, S32, (const char* barTitle), (""), "(barTitle)") { - PopupMenu* menu = object->findMenu(barTitle); + StringTableEntry barTitleStr = StringTable->insert(barTitle); + PopupMenu* menu = object->findMenu(barTitleStr); if (menu) return menu->getId(); From 4d10f02890550b0750730efed412ba67947faae6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 8 Feb 2018 16:04:50 -0600 Subject: [PATCH 122/312] Tabs&Spaces --- Engine/source/gui/core/guiCanvas.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 71a4eb760..efb0674ea 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -134,7 +134,7 @@ GuiCanvas::GuiCanvas(): GuiControl(), mPlatformWindow(NULL), mDisplayWindow(true), mMenuBarCtrl(nullptr), - mMenuBackground(nullptr) + mMenuBackground(nullptr) { setBounds(0, 0, 640, 480); mAwake = true; @@ -297,11 +297,11 @@ void GuiCanvas::setMenuBar(SimObject *obj) mMenuBarCtrl = dynamic_cast(obj); //remove old menubar - if (oldMenuBar) - { - Parent::removeObject(oldMenuBar); - Parent::removeObject(mMenuBackground); //also remove the modeless wrapper - } + if (oldMenuBar) + { + Parent::removeObject(oldMenuBar); + Parent::removeObject(mMenuBackground); //also remove the modeless wrapper + } // set new menubar if (mMenuBarCtrl) @@ -316,15 +316,15 @@ void GuiCanvas::setMenuBar(SimObject *obj) return; } - if (mMenuBackground == nullptr) - { - mMenuBackground = new GuiControl(); - mMenuBackground->registerObject(); + if (mMenuBackground == nullptr) + { + mMenuBackground = new GuiControl(); + mMenuBackground->registerObject(); - mMenuBackground->setControlProfile(profile); - } + mMenuBackground->setControlProfile(profile); + } - mMenuBackground->addObject(mMenuBarCtrl); + mMenuBackground->addObject(mMenuBarCtrl); Parent::addObject(mMenuBackground); } From 7af5c4392fc379b2bda173dca693ea8d06809306 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 11 Feb 2018 02:09:53 -0600 Subject: [PATCH 123/312] Update meshRenderSystem.cpp --- Engine/source/T3D/systems/render/meshRenderSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.cpp b/Engine/source/T3D/systems/render/meshRenderSystem.cpp index f777b264b..fe1ec6f84 100644 --- a/Engine/source/T3D/systems/render/meshRenderSystem.cpp +++ b/Engine/source/T3D/systems/render/meshRenderSystem.cpp @@ -132,7 +132,7 @@ void MeshRenderSystem::render(SceneManager *sceneManager, SceneRenderState* stat // We sort by the material then vertex buffer ri->defaultKey = matInst->getStateHint(); - ri->defaultKey2 = (U32)ri->vertBuff; // Not 64bit safe! + ri->defaultKey2 = (uintptr_t)ri->vertBuff; // Submit our RenderInst to the RenderPassManager state->getRenderPass()->addInst(ri); @@ -375,4 +375,4 @@ U32 MeshRenderSystem::findBufferSetByMaterial(U32 matId) } return -1; -} \ No newline at end of file +} From c357fdb8974324de055f2b3abe63c12086b5051f Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Sun, 11 Feb 2018 14:14:47 +0000 Subject: [PATCH 124/312] ShaderModelAutoGen --- .../BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl | 2 +- Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl | 2 +- Templates/Full/game/shaders/common/postFx/ssao/SSAO_Blur_P.hlsl | 2 +- Templates/Full/game/shaders/common/postFx/ssao/SSAO_P.hlsl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl index a47261397..5bdf9a77d 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl @@ -20,7 +20,7 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#include "../../ShaderModelAutoGen.hlsl" +#include "../../shaderModelAutoGen.hlsl" #include "./../postFx.hlsl" TORQUE_UNIFORM_SAMPLER2D(occludeMap, 0); diff --git a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl index 67365e846..ff31a4b8b 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl @@ -20,7 +20,7 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#include "../../ShaderModelAutoGen.hlsl" +#include "../../shaderModelAutoGen.hlsl" #include "./../postFx.hlsl" #define DOSMALL diff --git a/Templates/Full/game/shaders/common/postFx/ssao/SSAO_Blur_P.hlsl b/Templates/Full/game/shaders/common/postFx/ssao/SSAO_Blur_P.hlsl index a47261397..5bdf9a77d 100644 --- a/Templates/Full/game/shaders/common/postFx/ssao/SSAO_Blur_P.hlsl +++ b/Templates/Full/game/shaders/common/postFx/ssao/SSAO_Blur_P.hlsl @@ -20,7 +20,7 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#include "../../ShaderModelAutoGen.hlsl" +#include "../../shaderModelAutoGen.hlsl" #include "./../postFx.hlsl" TORQUE_UNIFORM_SAMPLER2D(occludeMap, 0); diff --git a/Templates/Full/game/shaders/common/postFx/ssao/SSAO_P.hlsl b/Templates/Full/game/shaders/common/postFx/ssao/SSAO_P.hlsl index 67365e846..ff31a4b8b 100644 --- a/Templates/Full/game/shaders/common/postFx/ssao/SSAO_P.hlsl +++ b/Templates/Full/game/shaders/common/postFx/ssao/SSAO_P.hlsl @@ -20,7 +20,7 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#include "../../ShaderModelAutoGen.hlsl" +#include "../../shaderModelAutoGen.hlsl" #include "./../postFx.hlsl" #define DOSMALL From 7b36a618a6c11fdd4ca287bf9b25ec65801a42e6 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Sun, 11 Feb 2018 14:29:39 +0000 Subject: [PATCH 125/312] PostFX.hlsl --- Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaV.hlsl | 2 +- Templates/Full/game/shaders/common/postFx/fxaa/fxaaV.hlsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaV.hlsl b/Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaV.hlsl index 3bef0a4d3..f2974c587 100644 --- a/Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaV.hlsl +++ b/Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaV.hlsl @@ -21,7 +21,7 @@ //----------------------------------------------------------------------------- #include "./../../torque.hlsl" -#include "./../postFX.hlsl" +#include "./../postFx.hlsl" struct VertToPix { diff --git a/Templates/Full/game/shaders/common/postFx/fxaa/fxaaV.hlsl b/Templates/Full/game/shaders/common/postFx/fxaa/fxaaV.hlsl index 3bef0a4d3..f2974c587 100644 --- a/Templates/Full/game/shaders/common/postFx/fxaa/fxaaV.hlsl +++ b/Templates/Full/game/shaders/common/postFx/fxaa/fxaaV.hlsl @@ -21,7 +21,7 @@ //----------------------------------------------------------------------------- #include "./../../torque.hlsl" -#include "./../postFX.hlsl" +#include "./../postFx.hlsl" struct VertToPix { From 54426f12955c21f98c9af7df827a54dc09f66d0a Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Sun, 11 Feb 2018 17:27:04 +0000 Subject: [PATCH 126/312] rock_* fixes --- .../game/art/shapes/weapons/Grenade/materials.cs | 8 ++++---- .../Grenade/{rock_diffuse.DDS => rock_d.dds} | Bin .../Grenade/{rock_normals.DDS => rock_n.dds} | Bin .../Grenade/{rock_specular.DDS => rock_s.dds} | Bin 4 files changed, 4 insertions(+), 4 deletions(-) rename Templates/Full/game/art/shapes/weapons/Grenade/{rock_diffuse.DDS => rock_d.dds} (100%) rename Templates/Full/game/art/shapes/weapons/Grenade/{rock_normals.DDS => rock_n.dds} (100%) rename Templates/Full/game/art/shapes/weapons/Grenade/{rock_specular.DDS => rock_s.dds} (100%) diff --git a/Templates/Full/game/art/shapes/weapons/Grenade/materials.cs b/Templates/Full/game/art/shapes/weapons/Grenade/materials.cs index 569f28ed0..ba26267da 100644 --- a/Templates/Full/game/art/shapes/weapons/Grenade/materials.cs +++ b/Templates/Full/game/art/shapes/weapons/Grenade/materials.cs @@ -49,11 +49,11 @@ singleton Material(debri_debris) { mapTo = "debris"; diffuseColor[0] = "0.7 0.7 0.7 1"; - diffuseMap[0] = "rock_diffuse.dds"; - normalMap[0] = "rock_normals.dds"; + diffuseMap[0] = "rock_d"; + normalMap[0] = "rock_n"; + specularMap[0] = "rock_s"; specular[0] = "1 1 1 0"; - specularPower[0] = "50"; - specularMap[0] = "rock_specular.dds"; + specularPower[0] = "50"; castShadows = "0"; translucentBlendOp = "None"; materialTag0 = "Weapon"; diff --git a/Templates/Full/game/art/shapes/weapons/Grenade/rock_diffuse.DDS b/Templates/Full/game/art/shapes/weapons/Grenade/rock_d.dds similarity index 100% rename from Templates/Full/game/art/shapes/weapons/Grenade/rock_diffuse.DDS rename to Templates/Full/game/art/shapes/weapons/Grenade/rock_d.dds diff --git a/Templates/Full/game/art/shapes/weapons/Grenade/rock_normals.DDS b/Templates/Full/game/art/shapes/weapons/Grenade/rock_n.dds similarity index 100% rename from Templates/Full/game/art/shapes/weapons/Grenade/rock_normals.DDS rename to Templates/Full/game/art/shapes/weapons/Grenade/rock_n.dds diff --git a/Templates/Full/game/art/shapes/weapons/Grenade/rock_specular.DDS b/Templates/Full/game/art/shapes/weapons/Grenade/rock_s.dds similarity index 100% rename from Templates/Full/game/art/shapes/weapons/Grenade/rock_specular.DDS rename to Templates/Full/game/art/shapes/weapons/Grenade/rock_s.dds From 7e0e46d66c667598271b85a3a507aea4fd5c9554 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 12 Feb 2018 00:02:20 -0600 Subject: [PATCH 127/312] Removes the folder insert for the scripted object creator grid, which was causing a UI screwup making the scripted objects overlap and jumble up. Also reorgs the popup controls to match what's in the BaseGame template's setup, which should fix editor popups. --- .../worldEditor/scripts/editorPrefs.ed.cs | 3 +- .../tools/worldEditor/scripts/EditorGui.ed.cs | 324 +++++++----------- .../worldEditor/scripts/editorPrefs.ed.cs | 1 - .../worldEditor/scripts/editors/creator.ed.cs | 46 --- 4 files changed, 117 insertions(+), 257 deletions(-) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editorPrefs.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/editorPrefs.ed.cs index 1704e06ad..876ae120a 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editorPrefs.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editorPrefs.ed.cs @@ -34,7 +34,6 @@ EditorSettings.setDefaultValue( "orthoFOV", "50" ); EditorSettings.setDefaultValue( "orthoShowGrid", "1" ); EditorSettings.setDefaultValue( "currentEditor", "WorldEditorInspectorPlugin" ); EditorSettings.setDefaultValue( "newLevelFile", "tools/levels/BlankRoom.mis" ); -EditorSettings.setDefaultValue( "newGameObjectDir", "scripts/server/gameObjects" ); if( isFile( "C:/Program Files/Torsion/Torsion.exe" ) ) EditorSettings.setDefaultValue( "torsionPath", "C:/Program Files/Torsion/Torsion.exe" ); @@ -128,7 +127,7 @@ EditorSettings.setDefaultValue( "renderInfoText", "1" ); EditorSettings.beginGroup( "Grid" ); EditorSettings.setDefaultValue( "gridColor", "255 255 255 20" ); -EditorSettings.setDefaultValue( "gridSize", "10 10 10" ); +EditorSettings.setDefaultValue( "gridSize", "1 1 1" ); EditorSettings.setDefaultValue( "snapToGrid", "0" ); //<-- Not currently used EditorSettings.setDefaultValue( "renderPlane", "0" ); EditorSettings.setDefaultValue( "renderPlaneHashes", "0" ); diff --git a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs index 535d00880..2d9e2ec53 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1302,6 +1302,7 @@ function VisibilityDropdownToggle() { EVisibility.setVisible(true); visibilityToggleBtn.setStateOn(1); + EVisibility.setExtent("200 540"); } } @@ -1569,6 +1570,27 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveObjectEntries = false; %haveLockAndHideEntries = true; + //Set up the generic pop-up pre-emptively if we haven't already + if( !isObject( ETContextPopup ) ) + { + %popup = new PopupMenu( ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; + item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + object = -1; + }; + } + // Handle multi-selection. if( %this.getSelectedItemsCount() > 1 ) { @@ -1615,12 +1637,67 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; }; } + + else if(%obj.isMemberOfClass("Entity")) + { + %popup = EntityObjectPopup; + if(!isObject(EntityObjectPopup)) + { + %popup = new PopupMenu( EntityObjectPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; + + item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; + item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; + item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; + item[ 3 ] = "-"; + item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; + item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; + item[ 6 ] = "-"; + item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + item[ 8 ] = "-"; + item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; + item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; + item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; + item[ 12 ] = "-"; + item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; + item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; + item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; + + object = -1; + }; + } + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + EntityObjectPopup.enableItem(13, true); + EntityObjectPopup.enableItem(14, false); + EntityObjectPopup.enableItem(15, false); + } + else + { + EntityObjectPopup.enableItem(13, false); + EntityObjectPopup.enableItem(14, true); + EntityObjectPopup.enableItem(15, true); + } + + %popup.object = %obj; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + } // Open context menu if this is a SimGroup else if( !%obj.isMemberOfClass( "SceneObject" ) ) { %popup = ETSimGroupContextPopup; if( !isObject( %popup ) ) + { %popup = new PopupMenu( ETSimGroupContextPopup ) { superClass = "MenuBuilder"; @@ -1641,6 +1718,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) object = -1; }; + } %popup.object = %obj; @@ -1652,77 +1730,56 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveLockAndHideEntries = false; } - // Open generic context menu. - else + // Specialized version for ConvexShapes. + else if( %obj.isMemberOfClass( "ConvexShape" ) ) { - %popup = ETContextPopup; + %popup = ETConvexShapeContextPopup; if( !isObject( %popup ) ) - %popup = new PopupMenu( ETContextPopup ) + { + %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) { superClass = "MenuBuilder"; isPopup = "1"; - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; + item[ 8 ] = "-"; + item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; }; - - if(%obj.isMemberOfClass("Entity")) - { - %popup = ETEntityContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETEntityContextPopup : ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - }; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; } - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) + %popup.object = %obj; + %haveObjectEntries = true; + } + + // Specialized version for polyhedral objects. + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup = ETPolyObjectContextPopup; + if( !isObject( %popup ) ) { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; + %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) + { + superClass = "MenuBuilder"; + isPopup = "1"; - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; + item[ 8 ] = "-"; + item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + }; } + + %popup.object = %obj; + %haveObjectEntries = true; + } + + // Open generic context menu. + else + { + %popup = ETContextPopup; %popup.object = %obj; %haveObjectEntries = true; @@ -2253,155 +2310,6 @@ function EWorldEditor::deleteMissionObject( %this, %object ) EditorTree.buildVisibleTree( true ); } -function EWorldEditor::createGameObject( %this, %entity ) -{ - if(!isObject(GameObjectBuilder)) - { - new GuiControl(GameObjectBuilder, EditorGuiGroup) { - profile = "ToolsGuiDefaultProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "0 0"; - extent = "800 600"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - - new GuiWindowCtrl(GameObjectBuilderTargetWindow) { - profile = "ToolsGuiWindowProfile"; - horizSizing = "center"; - vertSizing = "center"; - position = "384 205"; - extent = "256 102"; - minExtent = "256 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - resizeWidth = "1"; - resizeHeight = "1"; - canMove = "1"; - canClose = "0"; - canMinimize = "0"; - canMaximize = "0"; - minSize = "50 50"; - text = "Create Object"; - - new GuiTextCtrl() { - profile = "GuiCenterTextProfile"; - horizSizing = "right"; - vertSizing = "bottom"; - position = "9 26"; - extent = "84 16"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - text = "Object Name:"; - }; - new GuiTextEditCtrl(GameObjectBuilderObjectName) { - class = ObjectBuilderGuiTextEditCtrl; - profile = "ToolsGuiTextEditProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "78 26"; - extent = "172 18"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - helpTag = "0"; - historySize = "0"; - }; - new GuiButtonCtrl(GameObjectBuilderOKButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "width"; - vertSizing = "bottom"; - position = "7 250"; - extent = "156 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "EWorldEditor.buildGameObject();"; - helpTag = "0"; - text = "Create New"; - Accelerator = "return"; - }; - new GuiButtonCtrl(GameObjectBuilderCancelButton) { - profile = "ToolsGuiButtonProfile"; - horizSizing = "left"; - vertSizing = "bottom"; - position = "170 250"; - extent = "80 24"; - minExtent = "8 8"; - visible = "1"; - setFirstResponder = "0"; - modal = "1"; - command = "Canvas.popDialog(GameObjectBuilder);"; - helpTag = "0"; - text = "Cancel"; - Accelerator = "escape"; - }; - }; - }; - - GameObjectBuilderTargetWindow.extent = getWord(GameObjectBuilderTargetWindow.extent, 0) SPC 88; - GameObjectBuilderOKButton.position = getWord(GameObjectBuilderOKButton.position, 0) SPC 57; - GameObjectBuilderCancelButton.position = getWord(GameObjectBuilderCancelButton.position, 0) SPC 57; - } - - GameObjectBuilderObjectName.text = ""; - GameObjectBuilder.selectedEntity = %entity; - - Canvas.pushDialog(GameObjectBuilder); -} - -function EWorldEditor::buildGameObject(%this) -{ - if(GameObjectBuilderObjectName.getText() $= "") - { - error("Attempted to make a new Game Object with no name!"); - Canvas.popDialog(GameObjectBuilder); - return; - } - - %path = EditorSettings.value( "WorldEditor/newGameObjectDir" ); - %className = GameObjectBuilderObjectName.getText(); - GameObjectBuilder.selectedEntity.class = %className; - Inspector.inspect(GameObjectBuilder.selectedEntity); - - %file = new FileObject(); - - if(%file.openForWrite(%path @ "\\" @ %className @ ".cs")) - { - %file.writeline("function " @ %className @ "::onAdd(%this)\n{\n\n}\n"); - %file.writeline("function " @ %className @ "::onRemove(%this)\n{\n\n}\n"); - - //todo, pre-write any event functions of interest - - %file.close(); - } - - //set up the paths - %tamlPath = %path @ "/" @ %className @ ".taml"; - %scriptPath = %path @ "/" @ %className @ ".cs"; - saveGameObject(%className, %tamlPath, %scriptPath); - - //reload it - execGameObjects(); - - //now, add the script file and a ref to the taml into our SGO manifest so we can readily spawn it later. - TamlWrite(GameObjectBuilder.selectedEntity, %tamlpath); - - GameObjectBuilder.selectedEntity = ""; - - Canvas.popDialog(GameObjectBuilder); -} - function EWorldEditor::selectAllObjectsInSet( %this, %set, %deselect ) { if( !isObject( %set ) ) diff --git a/Templates/Full/game/tools/worldEditor/scripts/editorPrefs.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/editorPrefs.ed.cs index 35cc85edb..876ae120a 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/editorPrefs.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/editorPrefs.ed.cs @@ -34,7 +34,6 @@ EditorSettings.setDefaultValue( "orthoFOV", "50" ); EditorSettings.setDefaultValue( "orthoShowGrid", "1" ); EditorSettings.setDefaultValue( "currentEditor", "WorldEditorInspectorPlugin" ); EditorSettings.setDefaultValue( "newLevelFile", "tools/levels/BlankRoom.mis" ); -EditorSettings.setDefaultValue( "newGameObjectDir", "scripts/server/gameObjects" ); if( isFile( "C:/Program Files/Torsion/Torsion.exe" ) ) EditorSettings.setDefaultValue( "torsionPath", "C:/Program Files/Torsion/Torsion.exe" ); diff --git a/Templates/Full/game/tools/worldEditor/scripts/editors/creator.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/editors/creator.ed.cs index 0e2813d57..006031668 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/editors/creator.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/editors/creator.ed.cs @@ -304,36 +304,6 @@ function EWCreatorWindow::navigate( %this, %address ) %this.addShapeIcon( %obj ); } } - - //Add a separate folder for Game Objects - if(isClass("Entity")) - { - if(%address $= "") - { - %this.addFolderIcon("GameObjects"); - } - else - { - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return 0; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(isFile(%gameObjectAsset.TAMLFilePath)) - { - %this.addGameObjectIcon( %gameObjectAsset.gameObjectName ); - } - } - } - } } if ( %this.tab $= "Meshes" ) @@ -768,22 +738,6 @@ function EWCreatorWindow::addPrefabIcon( %this, %fullPath ) %this.contentCtrl.addGuiControl( %ctrl ); } -function EWCreatorWindow::addGameObjectIcon( %this, %gameObjectName ) -{ - %ctrl = %this.createIcon(); - - %ctrl.altCommand = "spawnGameObject( \"" @ %gameObjectName @ "\", true );"; - %ctrl.iconBitmap = EditorIconRegistry::findIconByClassName( "Prefab" ); - %ctrl.text = %gameObjectName; - %ctrl.class = "CreatorGameObjectIconBtn"; - %ctrl.tooltip = "Spawn the " @ %gameObjectName @ " GameObject"; - - %ctrl.buttonType = "radioButton"; - %ctrl.groupNum = "-1"; - - %this.contentCtrl.addGuiControl( %ctrl ); -} - function CreatorPopupMenu::onSelect( %this, %id, %text ) { %split = strreplace( %text, "/", " " ); From 05c5f9ff14074e290445150fc75af0c598e47f96 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Mon, 12 Feb 2018 12:35:01 +0000 Subject: [PATCH 128/312] Fixed defects in Turret material, Fixed TP Ryder material and added a spec map --- .../art/shapes/weapons/Ryder/TP_Ryder_S.dds | Bin 0 -> 32896 bytes .../game/art/shapes/weapons/Ryder/materials.cs | 2 +- .../game/art/shapes/weapons/Turret/materials.cs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 Templates/Full/game/art/shapes/weapons/Ryder/TP_Ryder_S.dds diff --git a/Templates/Full/game/art/shapes/weapons/Ryder/TP_Ryder_S.dds b/Templates/Full/game/art/shapes/weapons/Ryder/TP_Ryder_S.dds new file mode 100644 index 0000000000000000000000000000000000000000..9b7688e7ef964d790c61cec8e7107a0c3b1b659d GIT binary patch literal 32896 zcmbTf4^&&%l`nh{@Ny9$R_6`1n77hM)YM1>yLcXTO&=jJA+J_m(v0nks6oi!XKF)Z zdy>c^vO%hn*hD1p%rwN)%s5fRV8m5GX;bP{1mtHjwG%r{I*p9$SQa%-jD?Y$KeC8G zy5DbKL6c_QtnXVNtLbm;bI-jx_w0T4+5gV=>?gN^5UTO~zf(|axz#=tc{@(ojfigT#%h)MGpSySfBTRJcU4CBr ze)MnEsF;|HyDQn>jlXd^vs!=mh)Z1$%9AUL;7y5~8hWf|7xicI36d-M<%FrHW zg#$DXf=$>#7`7#(`LVNzgjyyNn!=|O6H2?n`rg($m!gGpI4oUuMKi}zli*V|r}Bx` z79g|g^?eF8SMt*Fu^KLe)!|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Eym@%JV%r=BE@|Wx0s+&YcG4etCaKD-JJ8SC!oX-J0f{hi3tJK** zrw|7TcLMx@*q0?q!!o#AO+-;f`e8NF&-w7E8|zQNzqxrE^k$b1Zt@H3pbv6Th_sKk zL;sM*l>tFJm4RxOZ6R4lD*5TB0S$Ovg8F3WV_a8^sPEQ|`-fq7!7m*@x%sj0!5>hV zKTmz_Nbjb-2b@Z0NShj)8rg4_OlCsR`2GZ`WQlRvU)V0A-e@)k zbeq;bF*5$x9>z~56?Z4&Cl#~)qzUoz`ax}R7xpzz9o32WN=4~^AK2L?2qpmo)* zYH4QUjvA~>fcDg^xOEQkJ5RIR$$VF}0lkG3ep<}$u~R~;%kn;m1M;Qx)M%9y@)GT+ zxvS2?kF=xC8#38Q{XWgdw>Mr|-8*w(QvB!J{u0OiYhNu`8NcOpMpiM8nH3vvE@6Fw z`jGQ+84eIq2UbdgBoQyx&iFAx#(qjKFA>jv4f|1P7ZXNf&E^?ep;LRNO z5ch#~M(`UfY(Zyu9)`^`fYE1+0KjZbHeSC*G0{@uH5a`dto^=^M8%&Gu!}8F6 z;v(T-0#Zv!!a4}>>FS!|{qL+C$x>diZDcd`ovz&Fs8a*q6i6Cd)TzTfQ^ z)F><9S3_+|?W8|XkMkaA-{QOymF1+_9$yQ;XGlL+#n7~jz}Zhnf-hgBo+g&$QNP=1Yb4wEpPSPmgUa)pZPAv@0- dLA_l8UvOPS36-xauxI$Zg8#<8(6N;({{u)&=nnt@ literal 0 HcmV?d00001 diff --git a/Templates/Full/game/art/shapes/weapons/Ryder/materials.cs b/Templates/Full/game/art/shapes/weapons/Ryder/materials.cs index 3661bcae1..47dc020ea 100644 --- a/Templates/Full/game/art/shapes/weapons/Ryder/materials.cs +++ b/Templates/Full/game/art/shapes/weapons/Ryder/materials.cs @@ -39,7 +39,7 @@ singleton Material(TP_Ryder_Base) mapTo = "TP_Ryder_Base"; diffuseMap[0] = "./TP_Ryder_D.dds"; normalMap[0] = "./TP_Ryder_N.dds"; - specularMap[0] = "./TP_Ryder_D.dds"; + specularMap[0] = "./TP_Ryder_S.dds"; specular[0] = "1.0 1.0 1.0 1"; specularPower[0] = "10"; translucentBlendOp = "None"; diff --git a/Templates/Full/game/art/shapes/weapons/Turret/materials.cs b/Templates/Full/game/art/shapes/weapons/Turret/materials.cs index 4ed4768d9..95b361714 100644 --- a/Templates/Full/game/art/shapes/weapons/Turret/materials.cs +++ b/Templates/Full/game/art/shapes/weapons/Turret/materials.cs @@ -29,7 +29,7 @@ singleton Material(Turret_Base) translucentBlendOp = "None"; normalMap[0] = "art/shapes/weapons/Turret/Turret_N.dds"; pixelSpecular[0] = "1"; - specularMap[0] = "art/shapes/weapons/Turret/Turret_D.dds"; + specularMap[0] = "art/shapes/weapons/Turret/Turret_S.dds"; useAnisotropic[0] = "1"; castDynamicShadows = true; materialTag0 = "Weapon"; From ef437835d778e5a8d71c32c7b4a63b1148a2d341 Mon Sep 17 00:00:00 2001 From: Marc Chapman Date: Mon, 12 Feb 2018 16:20:18 +0000 Subject: [PATCH 129/312] Profile change for specular files --- Engine/source/materials/processedMaterial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/materials/processedMaterial.cpp b/Engine/source/materials/processedMaterial.cpp index 1622d50e6..b38e0a400 100644 --- a/Engine/source/materials/processedMaterial.cpp +++ b/Engine/source/materials/processedMaterial.cpp @@ -456,7 +456,7 @@ void ProcessedMaterial::_setStageData() // SpecularMap if( mMaterial->mSpecularMapFilename[i].isNotEmpty() ) { - mStages[i].setTex( MFT_SpecularMap, _createTexture( mMaterial->mSpecularMapFilename[i], &GFXStaticTextureProfile) ); + mStages[i].setTex( MFT_SpecularMap, _createTexture( mMaterial->mSpecularMapFilename[i], &GFXStaticTextureSRGBProfile) ); if(!mStages[i].getTex( MFT_SpecularMap )) mMaterial->logError("Failed to load specular map %s for stage %i", _getTexturePath(mMaterial->mSpecularMapFilename[i]).c_str(), i); } From c662e4ec2e5d4e3a08204d4732282bd9132cd0c2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Feb 2018 11:48:13 -0600 Subject: [PATCH 130/312] don't try to physically interact with a prefab with invalid entries --- Engine/source/T3D/prefab.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Engine/source/T3D/prefab.cpp b/Engine/source/T3D/prefab.cpp index 6d357565f..6d32e2fd6 100644 --- a/Engine/source/T3D/prefab.cpp +++ b/Engine/source/T3D/prefab.cpp @@ -528,6 +528,11 @@ bool Prefab::isValidChild( SimObject *simobj, bool logWarnings ) bool Prefab::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere) { Vector foundObjects; + if (mChildGroup.isNull() || mChildGroup->empty()) + { + Con::warnf("Bad Prefab Config! %s has no valid entries!", getName()); + return false; + } mChildGroup->findObjectByType(foundObjects); for (S32 i = 0; i < foundObjects.size(); i++) From 81a7fabe3cf27f07f89da0e10551f18f9c612658 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 12 Feb 2018 21:36:19 -0600 Subject: [PATCH 131/312] Implements hold and context keybind functionality, enabling the ability to have actionmap binds for holding down a button(complete with hold time return if needed) and context binds for being able to have different events for tapping and holding on the same key. --- Engine/source/sim/actionMap.cpp | 230 +++++++++++++++++++++++++++++++- Engine/source/sim/actionMap.h | 35 ++++- 2 files changed, 259 insertions(+), 6 deletions(-) diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index f96e02585..841f3e39b 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -269,7 +269,13 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const if (getKeyString(rNode.action, objectbuffer) == false) continue; - const char* command = (rNode.flags & Node::BindCmd) ? "bindCmd" : "bind"; + const char* command; + if (rNode.flags & Node::BindCmd) + command = "bindCmd"; + else if (rNode.flags & Node::Held) + command = "held"; + else + command = "bind"; dSprintf(lineBuffer, 1023, "%s.%s(%s, \"%s%s\"", getName(), @@ -324,7 +330,16 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const } else dStrcat(lineBuffer, ", \"\""); - } else { + } + else if (rNode.flags & Node::Held) + { + dStrcat(lineBuffer, ", "); + dStrcat(lineBuffer, rNode.consoleFunction); + + dStrcat(lineBuffer, ", "); + dStrcat(lineBuffer, rNode.contextEvent->mConsoleFunctionHeld); + } + else { dStrcat(lineBuffer, ", "); dStrcat(lineBuffer, rNode.consoleFunction); } @@ -353,7 +368,13 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const if (getKeyString(rNode.action, keybuffer) == false) continue; - const char* command = (rNode.flags & Node::BindCmd) ? "bindCmd" : "bind"; + const char* command; + if (rNode.flags & Node::BindCmd) + command = "bindCmd"; + else if (rNode.flags & Node::Held) + command = "held"; + else + command = "bind"; char finalBuffer[1024]; dSprintf(finalBuffer, 1023, "%s.%s(%s, \"%s%s\"", @@ -407,7 +428,16 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const } else dStrcat(finalBuffer, ", \"\""); - } else { + } + else if (rNode.flags & Node::Held) + { + dStrcat(finalBuffer, ", "); + dStrcat(finalBuffer, rNode.consoleFunction); + + dStrcat(finalBuffer, ", "); + dStrcat(finalBuffer, rNode.contextEvent->mConsoleFunctionHeld); + } + else { dStrcat(finalBuffer, ", "); dStrcat(finalBuffer, rNode.consoleFunction); } @@ -794,6 +824,17 @@ const char* ActionMap::getCommand( const char* device, const char* action ) ( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) ); return( returnString ); } + if (mapNode->flags & Node::Held) + { + S32 bufferLen = dStrlen(mapNode->consoleFunction) + dStrlen(mapNode->contextEvent->mConsoleFunctionHeld) + 2; + char* returnString = Con::getReturnBuffer(bufferLen); + + dSprintf(returnString, bufferLen, "%st%s", + (mapNode->consoleFunction ? mapNode->consoleFunction : ""), + (mapNode->contextEvent->mConsoleFunctionHeld ? mapNode->contextEvent->mConsoleFunctionHeld : "")); + + return(returnString); + } else return( mapNode->consoleFunction ); } @@ -1310,6 +1351,76 @@ bool ActionMap::processBind(const U32 argc, const char** argv, SimObject* object return true; } +//------------------------------------------------------------------------------ +bool ActionMap::processHoldBind(const char *device, const char *action, const char *holdFunc, const char *tapFunc, const U32 holdTime, const bool holdOnly, const bool retHoldTime) +{ + U32 deviceType; + U32 deviceInst; + + if (!getDeviceTypeAndInstance(device, deviceType, deviceInst)) + { + Con::printf("processBindCmd: unknown device: %s", device); + return false; + } + + // Ok, we now have the deviceType and instance. Create an event descriptor + // for the bind... + // + EventDescriptor eventDescriptor; + if (createEventDescriptor(action, &eventDescriptor) == false) { + Con::printf("Could not create a description for binding: %s", action); + return false; + } + + // SI_POV == SI_MOVE, and the POV works fine with bindCmd, so we have to add these manually. + if ((eventDescriptor.eventCode == SI_XAXIS) || + (eventDescriptor.eventCode == SI_YAXIS) || + (eventDescriptor.eventCode == SI_ZAXIS) || + (eventDescriptor.eventCode == SI_RXAXIS) || + (eventDescriptor.eventCode == SI_RYAXIS) || + (eventDescriptor.eventCode == SI_RZAXIS) || + (eventDescriptor.eventCode == SI_SLIDER) || + (eventDescriptor.eventCode == SI_XPOV) || + (eventDescriptor.eventCode == SI_YPOV) || + (eventDescriptor.eventCode == SI_XPOV2) || + (eventDescriptor.eventCode == SI_YPOV2)) + { + Con::warnf("ActionMap::processBindCmd - Cannot use 'bindCmd' with a move event type. Use 'bind' instead."); + return false; + } + + // Event has now been described, and device determined. we need now to extract + // any modifiers that the action map will apply to incoming events before + // calling the bound function... + // + // DMMTODO + F32 deadZoneBegin = 0.0f; + F32 deadZoneEnd = 0.0f; + F32 scaleFactor = 1.0f; + + // Ensure that the console function is properly specified? + // + // DMMTODO + + // Create the full bind entry, and place it in the map + // + // DMMTODO + Node* pBindNode = getNode(deviceType, deviceInst, + eventDescriptor.flags, + eventDescriptor.eventCode); + + pBindNode->flags = Node::Held; + pBindNode->deadZoneBegin = deadZoneBegin; + pBindNode->deadZoneEnd = deadZoneEnd; + pBindNode->scaleFactor = scaleFactor; + pBindNode->consoleFunction = StringTable->insert(dStrdup(tapFunc)); + + pBindNode->contextEvent = new ContextAction(StringTable->insert(dStrdup(holdFunc)), holdTime, pBindNode, holdOnly); + pBindNode->contextEvent->mReturnHoldTime = retHoldTime; + + return true; +} + //------------------------------------------------------------------------------ bool ActionMap::processAction(const InputEventInfo* pEvent) { @@ -1328,7 +1439,9 @@ bool ActionMap::processAction(const InputEventInfo* pEvent) // Enter the break into the table if this is a make event... // Do this now rather than after command is processed because // command might add a binding which can move the vector of nodes. - enterBreakEvent(pEvent, pNode); + // Filter to prevent Hold buttons from being eaten + if (!(pNode->flags & Node::Held)) + enterBreakEvent(pEvent, pNode); // Whadda ya know, we have this bound. Set up, and call the console // function associated with it... @@ -1369,6 +1482,15 @@ bool ActionMap::processAction(const InputEventInfo* pEvent) if(pNode->makeConsoleCommand) Con::evaluate(pNode->makeConsoleCommand); } + else if (pNode->flags & Node::Held) + { + //check if we're already holding, if not, start our timer + if (!pNode->contextEvent->mActive) { + pNode->contextEvent->mActive = true; + pNode->contextEvent->mStartTime = Sim::getCurrentTime(); + pNode->contextEvent->mEventValue = value; + } + } else if ( pNode->consoleFunction[0] ) { argv[0] = pNode->consoleFunction; @@ -1529,6 +1651,20 @@ bool ActionMap::processAction(const InputEventInfo* pEvent) } else if (pEvent->action == SI_BREAK) { + const Node* button = findNode(pEvent->deviceType, pEvent->deviceInst, + pEvent->modifier, pEvent->objInst); + + if (button != NULL) + { + if (button->flags == Node::Held) + { + if (!button->contextEvent->mBreakEvent) + button->contextEvent->mBreakEvent = true; + + return true; + } + } + return checkBreakTable(pEvent); } else if (pEvent->action == SI_VALUE) @@ -1808,6 +1944,78 @@ void ActionMap::fireBreakEvent( U32 i, F32 fValue ) smBreakTable.erase(i); } +//------------------------------------------------------------------------------ +//Context actions +ContextAction::ContextAction(StringTableEntry func, F32 minHoldTime, ActionMap::Node* button, bool holdOnly) + : mStartTime(0), mEventValue(1.0f), mBreakEvent(false), mDidHold(false), mActive(false), mReturnHoldTime(false) +{ + mButton = button; + mMinHoldTime = minHoldTime; + mConsoleFunctionHeld = func; + + mHoldOnly = holdOnly; +} + +void ContextAction::processTick() +{ + if (mActive) + { + F32 currTime = Sim::getCurrentTime(); + static const char *argv[2]; + + //see if this key even is still active + if (!mBreakEvent) + { + //are we only checking if it's holding? + if (mHoldOnly) + { + //yes, we are, and since it's held, we fire off our function + if (mReturnHoldTime) + { + argv[0] = mConsoleFunctionHeld; + argv[1] = Con::getFloatArg(mEventValue); + argv[2] = Con::getFloatArg((currTime - mStartTime)); + Con::execute(3, argv); + } + else + { + argv[0] = mConsoleFunctionHeld; + argv[1] = Con::getFloatArg(mEventValue); + Con::execute(2, argv); + } + } + //if we don't care if we're just holding, check our time + //have we passed our min limit? + else if ((currTime - mStartTime) >= mMinHoldTime) + { + //holy crap, we have, fire off our hold function + mDidHold = true; + argv[0] = mConsoleFunctionHeld; + argv[1] = Con::getFloatArg(mEventValue); + Con::execute(2, argv); + } + //otherwise we haven't yet, so keep our active status + return; + } + //hmm, apparently not, so see if we tapped the key instead + else + { + if (!mHoldOnly && !mDidHold) + { + //yes, we tapped and we care, so fire off the tap function. + argv[0] = mButton->consoleFunction; + argv[1] = Con::getFloatArg(mEventValue); + Con::execute(2, argv); + } + //otherwise we don't care and we're done, so reset everything + mActive = false; + mStartTime = 0; + mBreakEvent = false; + mDidHold = false; + } + } +} + //------------------------------------------------------------------------------ // Console interop version. @@ -1959,6 +2167,18 @@ DefineEngineMethod( ActionMap, bindCmd, bool, ( const char* device, const char* return object->processBindCmd( device, action, makeCmd, breakCmd ); } +DefineEngineMethod(ActionMap, bindContext, void, (const char* device, const char* action, const char* holdFunction, const char* tapFunction, U32 holdTime), + ("", "", "", "", 0), "actionMap.bindCmd( device, action, holdFunction, tapFunction, holdTime)") +{ + object->processHoldBind(device, action, holdFunction, tapFunction, holdTime, false); +} + +DefineEngineMethod(ActionMap, bindHold, void, (const char* device, const char* action, const char* holdFunction, bool returnHoldTime), + ("", "", "", false), "actionMap.bindCmd( device, action, holdFunction, returnHoldTime)") +{ + object->processHoldBind(device, action, holdFunction, "", 0, true, returnHoldTime); +} + DefineEngineMethod( ActionMap, unbind, bool, ( const char* device, const char* action ),, "@brief Removes the binding on an input device and action.\n" "@param device The device to unbind from. Can be a keyboard, mouse, joystick or a gamepad.\n" diff --git a/Engine/source/sim/actionMap.h b/Engine/source/sim/actionMap.h index 7b3d55261..c2c4cbd72 100644 --- a/Engine/source/sim/actionMap.h +++ b/Engine/source/sim/actionMap.h @@ -32,7 +32,11 @@ #ifndef _SIMBASE_H_ #include "console/simBase.h" #endif +#ifndef _ITICKABLE_H_ +#include "core/iTickable.h" +#endif +class ContextAction; struct InputEventInfo; struct EventDescriptor @@ -48,6 +52,7 @@ struct EventDescriptor class ActionMap : public SimObject { typedef SimObject Parent; + friend class ContextAction; protected: bool onAdd(); @@ -62,7 +67,9 @@ class ActionMap : public SimObject HasDeadZone = BIT(2), ///< Dead zone is present. Inverted = BIT(3), ///< Input is inverted. NonLinear = BIT(4), ///< Input should be re-fit to a non-linear scale - BindCmd = BIT(5) ///< Bind a console command to this. + BindCmd = BIT(5), ///< Bind a console command to this. + Held = BIT(6), + DoubleTap = BIT(7) }; U32 flags; ///< @see Node::Flags @@ -75,6 +82,7 @@ class ActionMap : public SimObject char *makeConsoleCommand; ///< Console command to execute when we make this command. char *breakConsoleCommand; ///< Console command to execute when we break this command. + ContextAction* contextEvent; ///< Event that kicks off via context-keybind actions such as holding or double-tapping }; /// Used to represent a devices. @@ -143,6 +151,7 @@ class ActionMap : public SimObject bool processBind(const U32 argc, const char** argv, SimObject* object = NULL); bool processBindCmd(const char *device, const char *action, const char *makeCmd, const char *breakCmd); bool processUnbind(const char *device, const char *action, SimObject* object = NULL); + bool processHoldBind(const char *device, const char *action, const char *holdFunc, const char *tapFunc, const U32 holdTime, const bool holdOnly, const bool returnHoldTime = false); /// @name Console Interface Functions /// @{ @@ -185,4 +194,28 @@ class ActionMap : public SimObject DECLARE_CONOBJECT(ActionMap); }; +class ContextAction : public ITickable +{ + ActionMap::Node* mButton; ///< our button we're holding + F32 mMinHoldTime; ///< minimum time to qualify as 'held'. If we hold less than this, + ///< it's a 'press', otherwise it's a 'held' +public: + F32 mStartTime; ///< Our timestamp when we first pressed. + F32 mEventValue; ///< Event value from our key event. + StringTableEntry mConsoleFunctionHeld; ///< Console function to call with new values if we held over + ///< a certain time. + + bool mHoldOnly; ///< does this only care if we're holding? + ///< true means that it only fires a function while holding + ///< false time-contexts it + bool mBreakEvent; ///< Button is no longer being pressed! + bool mDidHold; ///< did we, at some point in the process, hold the button? + bool mActive; ///< do we be tickin? + bool mReturnHoldTime; ///< Do we return back our time held? + + ContextAction(StringTableEntry func, F32 minHoldTime, ActionMap::Node* button, bool holdOnly); + virtual void processTick(); + virtual void interpolateTick(F32 delta) {} + virtual void advanceTime(F32 timeDelta) {} +}; #endif // _ACTIONMAP_H_ From 8bc4858fa30be6a9eeb81d4fe76b690bc6db67e3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Feb 2018 02:51:28 -0600 Subject: [PATCH 132/312] companion to #2203: corrects a couple backend profile assignment mismatches found with @rextimmys debug spew --- Engine/source/gfx/sim/cubemapData.cpp | 2 +- Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/gfx/sim/cubemapData.cpp b/Engine/source/gfx/sim/cubemapData.cpp index 35e921b5b..647615263 100644 --- a/Engine/source/gfx/sim/cubemapData.cpp +++ b/Engine/source/gfx/sim/cubemapData.cpp @@ -111,7 +111,7 @@ void CubemapData::createMap() { if (!mCubeFaceFile[i].isEmpty()) { - if (!mCubeFace[i].set(mCubeFaceFile[i], &GFXStaticTextureSRGBProfile, avar("%s() - mCubeFace[%d] (line %d)", __FUNCTION__, i, __LINE__))) + if (!mCubeFace[i].set(mCubeFaceFile[i], &GFXStaticTextureProfile, avar("%s() - mCubeFace[%d] (line %d)", __FUNCTION__, i, __LINE__))) { Con::errorf("CubemapData::createMap - Failed to load texture '%s'", mCubeFaceFile[i].c_str()); initSuccess = false; diff --git a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp index b357fc3b5..2e9b6d0aa 100644 --- a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp @@ -307,22 +307,22 @@ void GuiBitmapButtonCtrl::setBitmap( const String& name ) if( mUseModifiers ) baseName += modifiers[ i ]; - mTextures[ i ].mTextureNormal = GFXTexHandle( baseName, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__)); + mTextures[ i ].mTextureNormal = GFXTexHandle( baseName, &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__)); if( mUseStates ) { if( !mTextures[ i ].mTextureNormal ) - mTextures[ i ].mTextureNormal = GFXTexHandle( baseName + s_n, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__)); + mTextures[ i ].mTextureNormal = GFXTexHandle( baseName + s_n, &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__)); - mTextures[ i ].mTextureHilight = GFXTexHandle( baseName + s_h, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureHighlight (line %d)", __FUNCTION__, __LINE__)); + mTextures[ i ].mTextureHilight = GFXTexHandle( baseName + s_h, &GFXDefaultGUIProfile, avar("%s() - mTextureHighlight (line %d)", __FUNCTION__, __LINE__)); if( !mTextures[ i ].mTextureHilight ) mTextures[ i ].mTextureHilight = mTextures[ i ].mTextureNormal; - mTextures[ i ].mTextureDepressed = GFXTexHandle( baseName + s_d, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__)); + mTextures[ i ].mTextureDepressed = GFXTexHandle( baseName + s_d, &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__)); if( !mTextures[ i ].mTextureDepressed ) mTextures[ i ].mTextureDepressed = mTextures[ i ].mTextureHilight; - mTextures[ i ].mTextureInactive = GFXTexHandle( baseName + s_i, &GFXTexturePersistentSRGBProfile, avar("%s() - mTextureInactive (line %d)", __FUNCTION__, __LINE__)); + mTextures[ i ].mTextureInactive = GFXTexHandle( baseName + s_i, &GFXDefaultGUIProfile, avar("%s() - mTextureInactive (line %d)", __FUNCTION__, __LINE__)); if( !mTextures[ i ].mTextureInactive ) mTextures[ i ].mTextureInactive = mTextures[ i ].mTextureNormal; } From 6ac08c62905e7582e0aec36240286f4e05a6a559 Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 14 Feb 2018 01:03:25 -0600 Subject: [PATCH 133/312] Updates the basegame template as well. --- .../worldEditor/scripts/editors/creator.ed.cs | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.cs index 0e2813d57..006031668 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.cs @@ -304,36 +304,6 @@ function EWCreatorWindow::navigate( %this, %address ) %this.addShapeIcon( %obj ); } } - - //Add a separate folder for Game Objects - if(isClass("Entity")) - { - if(%address $= "") - { - %this.addFolderIcon("GameObjects"); - } - else - { - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return 0; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(isFile(%gameObjectAsset.TAMLFilePath)) - { - %this.addGameObjectIcon( %gameObjectAsset.gameObjectName ); - } - } - } - } } if ( %this.tab $= "Meshes" ) @@ -768,22 +738,6 @@ function EWCreatorWindow::addPrefabIcon( %this, %fullPath ) %this.contentCtrl.addGuiControl( %ctrl ); } -function EWCreatorWindow::addGameObjectIcon( %this, %gameObjectName ) -{ - %ctrl = %this.createIcon(); - - %ctrl.altCommand = "spawnGameObject( \"" @ %gameObjectName @ "\", true );"; - %ctrl.iconBitmap = EditorIconRegistry::findIconByClassName( "Prefab" ); - %ctrl.text = %gameObjectName; - %ctrl.class = "CreatorGameObjectIconBtn"; - %ctrl.tooltip = "Spawn the " @ %gameObjectName @ " GameObject"; - - %ctrl.buttonType = "radioButton"; - %ctrl.groupNum = "-1"; - - %this.contentCtrl.addGuiControl( %ctrl ); -} - function CreatorPopupMenu::onSelect( %this, %id, %text ) { %split = strreplace( %text, "/", " " ); From ff2d18cc076c1734bb92a044805220c7891bf033 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 26 Feb 2018 20:45:18 -0600 Subject: [PATCH 134/312] tell switchable graphics supported systems that they need to use the beefier GPU --- Engine/source/main/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Engine/source/main/main.cpp b/Engine/source/main/main.cpp index f74430fc1..b5fea8a07 100644 --- a/Engine/source/main/main.cpp +++ b/Engine/source/main/main.cpp @@ -283,6 +283,14 @@ int main(int argc, const char **argv) #include "app/mainLoop.h" #include "T3D/gameFunctions.h" +#if defined(WIN32) || defined(_WIN32) //tell switchable graphics supported systems that they need to use the beefier GPU +extern "C" { __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; } +extern "C" { __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 0x00000001; } +#else +extern "C" { int NvOptimusEnablement = 1; } +extern "C" { int AmdPowerXpressRequestHighPerformance = 1; } +#endif + // Entry point for your game. // // This is build by default using the "StandardMainLoop" toolkit. Feel free From 488fba16c12feb319d598fa9b77a0e3f5ceab15a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 26 Feb 2018 22:34:21 -0600 Subject: [PATCH 135/312] requested revision: use dword just in case of compiler shenanigans --- Engine/source/main/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Engine/source/main/main.cpp b/Engine/source/main/main.cpp index b5fea8a07..ad3556913 100644 --- a/Engine/source/main/main.cpp +++ b/Engine/source/main/main.cpp @@ -283,9 +283,11 @@ int main(int argc, const char **argv) #include "app/mainLoop.h" #include "T3D/gameFunctions.h" -#if defined(WIN32) || defined(_WIN32) //tell switchable graphics supported systems that they need to use the beefier GPU -extern "C" { __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; } -extern "C" { __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 0x00000001; } +#if defined(WIN32) || defined(_WIN32) +//tell switchable graphics supported systems that they need to use the beefier GPU +#include +extern "C" { __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; } +extern "C" { __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; } #else extern "C" { int NvOptimusEnablement = 1; } extern "C" { int AmdPowerXpressRequestHighPerformance = 1; } From 5daa5ade2d21bd1ecad52aabbb474e11750fc069 Mon Sep 17 00:00:00 2001 From: Johxz Date: Wed, 28 Feb 2018 13:01:06 -0600 Subject: [PATCH 136/312] delete old files --- .../btMultiSapBroadphase.cpp | 489 ------------------ .../btMultiSapBroadphase.h | 151 ------ 2 files changed, 640 deletions(-) delete mode 100644 Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp delete mode 100644 Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp deleted file mode 100644 index 81369fe9b..000000000 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "btMultiSapBroadphase.h" - -#include "btSimpleBroadphase.h" -#include "LinearMath/btAabbUtil2.h" -#include "btQuantizedBvh.h" - -/// btSapBroadphaseArray m_sapBroadphases; - -/// btOverlappingPairCache* m_overlappingPairs; -extern int gOverlappingPairs; - -/* -class btMultiSapSortedOverlappingPairCache : public btSortedOverlappingPairCache -{ -public: - - virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) - { - return btSortedOverlappingPairCache::addOverlappingPair((btBroadphaseProxy*)proxy0->m_multiSapParentProxy,(btBroadphaseProxy*)proxy1->m_multiSapParentProxy); - } -}; - -*/ - -btMultiSapBroadphase::btMultiSapBroadphase(int /*maxProxies*/,btOverlappingPairCache* pairCache) -:m_overlappingPairs(pairCache), -m_optimizedAabbTree(0), -m_ownsPairCache(false), -m_invalidPair(0) -{ - if (!m_overlappingPairs) - { - m_ownsPairCache = true; - void* mem = btAlignedAlloc(sizeof(btSortedOverlappingPairCache),16); - m_overlappingPairs = new (mem)btSortedOverlappingPairCache(); - } - - struct btMultiSapOverlapFilterCallback : public btOverlapFilterCallback - { - virtual ~btMultiSapOverlapFilterCallback() - {} - // return true when pairs need collision - virtual bool needBroadphaseCollision(btBroadphaseProxy* childProxy0,btBroadphaseProxy* childProxy1) const - { - btBroadphaseProxy* multiProxy0 = (btBroadphaseProxy*)childProxy0->m_multiSapParentProxy; - btBroadphaseProxy* multiProxy1 = (btBroadphaseProxy*)childProxy1->m_multiSapParentProxy; - - bool collides = (multiProxy0->m_collisionFilterGroup & multiProxy1->m_collisionFilterMask) != 0; - collides = collides && (multiProxy1->m_collisionFilterGroup & multiProxy0->m_collisionFilterMask); - - return collides; - } - }; - - void* mem = btAlignedAlloc(sizeof(btMultiSapOverlapFilterCallback),16); - m_filterCallback = new (mem)btMultiSapOverlapFilterCallback(); - - m_overlappingPairs->setOverlapFilterCallback(m_filterCallback); -// mem = btAlignedAlloc(sizeof(btSimpleBroadphase),16); -// m_simpleBroadphase = new (mem) btSimpleBroadphase(maxProxies,m_overlappingPairs); -} - -btMultiSapBroadphase::~btMultiSapBroadphase() -{ - if (m_ownsPairCache) - { - m_overlappingPairs->~btOverlappingPairCache(); - btAlignedFree(m_overlappingPairs); - } -} - - -void btMultiSapBroadphase::buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax) -{ - m_optimizedAabbTree = new btQuantizedBvh(); - m_optimizedAabbTree->setQuantizationValues(bvhAabbMin,bvhAabbMax); - QuantizedNodeArray& nodes = m_optimizedAabbTree->getLeafNodeArray(); - for (int i=0;igetBroadphaseAabb(aabbMin,aabbMax); - m_optimizedAabbTree->quantize(&node.m_quantizedAabbMin[0],aabbMin,0); - m_optimizedAabbTree->quantize(&node.m_quantizedAabbMax[0],aabbMax,1); - int partId = 0; - node.m_escapeIndexOrTriangleIndex = (partId<<(31-MAX_NUM_PARTS_IN_BITS)) | i; - nodes.push_back(node); - } - m_optimizedAabbTree->buildInternal(); -} - -btBroadphaseProxy* btMultiSapBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* /*ignoreMe*/) -{ - //void* ignoreMe -> we could think of recursive multi-sap, if someone is interested - - void* mem = btAlignedAlloc(sizeof(btMultiSapProxy),16); - btMultiSapProxy* proxy = new (mem)btMultiSapProxy(aabbMin, aabbMax,shapeType,userPtr, collisionFilterGroup,collisionFilterMask); - m_multiSapProxies.push_back(proxy); - - ///this should deal with inserting/removal into child broadphases - setAabb(proxy,aabbMin,aabbMax,dispatcher); - return proxy; -} - -void btMultiSapBroadphase::destroyProxy(btBroadphaseProxy* /*proxy*/,btDispatcher* /*dispatcher*/) -{ - ///not yet - btAssert(0); - -} - - -void btMultiSapBroadphase::addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase) -{ - void* mem = btAlignedAlloc(sizeof(btBridgeProxy),16); - btBridgeProxy* bridgeProxyRef = new(mem) btBridgeProxy; - bridgeProxyRef->m_childProxy = childProxy; - bridgeProxyRef->m_childBroadphase = childBroadphase; - parentMultiSapProxy->m_bridgeProxies.push_back(bridgeProxyRef); -} - - -bool boxIsContainedWithinBox(const btVector3& amin,const btVector3& amax,const btVector3& bmin,const btVector3& bmax); -bool boxIsContainedWithinBox(const btVector3& amin,const btVector3& amax,const btVector3& bmin,const btVector3& bmax) -{ -return -amin.getX() >= bmin.getX() && amax.getX() <= bmax.getX() && -amin.getY() >= bmin.getY() && amax.getY() <= bmax.getY() && -amin.getZ() >= bmin.getZ() && amax.getZ() <= bmax.getZ(); -} - - - - - - -void btMultiSapBroadphase::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const -{ - btMultiSapProxy* multiProxy = static_cast(proxy); - aabbMin = multiProxy->m_aabbMin; - aabbMax = multiProxy->m_aabbMax; -} - -void btMultiSapBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin,const btVector3& aabbMax) -{ - for (int i=0;i - -void btMultiSapBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher) -{ - btMultiSapProxy* multiProxy = static_cast(proxy); - multiProxy->m_aabbMin = aabbMin; - multiProxy->m_aabbMax = aabbMax; - - -// bool fullyContained = false; -// bool alreadyInSimple = false; - - - - - struct MyNodeOverlapCallback : public btNodeOverlapCallback - { - btMultiSapBroadphase* m_multiSap; - btMultiSapProxy* m_multiProxy; - btDispatcher* m_dispatcher; - - MyNodeOverlapCallback(btMultiSapBroadphase* multiSap,btMultiSapProxy* multiProxy,btDispatcher* dispatcher) - :m_multiSap(multiSap), - m_multiProxy(multiProxy), - m_dispatcher(dispatcher) - { - - } - - virtual void processNode(int /*nodeSubPart*/, int broadphaseIndex) - { - btBroadphaseInterface* childBroadphase = m_multiSap->getBroadphaseArray()[broadphaseIndex]; - - int containingBroadphaseIndex = -1; - //already found? - for (int i=0;im_bridgeProxies.size();i++) - { - - if (m_multiProxy->m_bridgeProxies[i]->m_childBroadphase == childBroadphase) - { - containingBroadphaseIndex = i; - break; - } - } - if (containingBroadphaseIndex<0) - { - //add it - btBroadphaseProxy* childProxy = childBroadphase->createProxy(m_multiProxy->m_aabbMin,m_multiProxy->m_aabbMax,m_multiProxy->m_shapeType,m_multiProxy->m_clientObject,m_multiProxy->m_collisionFilterGroup,m_multiProxy->m_collisionFilterMask, m_dispatcher,m_multiProxy); - m_multiSap->addToChildBroadphase(m_multiProxy,childProxy,childBroadphase); - - } - } - }; - - MyNodeOverlapCallback myNodeCallback(this,multiProxy,dispatcher); - - - - - if (m_optimizedAabbTree) - m_optimizedAabbTree->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax); - - int i; - - for ( i=0;im_bridgeProxies.size();i++) - { - btVector3 worldAabbMin,worldAabbMax; - multiProxy->m_bridgeProxies[i]->m_childBroadphase->getBroadphaseAabb(worldAabbMin,worldAabbMax); - bool overlapsBroadphase = TestAabbAgainstAabb2(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax); - if (!overlapsBroadphase) - { - //remove it now - btBridgeProxy* bridgeProxy = multiProxy->m_bridgeProxies[i]; - - btBroadphaseProxy* childProxy = bridgeProxy->m_childProxy; - bridgeProxy->m_childBroadphase->destroyProxy(childProxy,dispatcher); - - multiProxy->m_bridgeProxies.swap( i,multiProxy->m_bridgeProxies.size()-1); - multiProxy->m_bridgeProxies.pop_back(); - - } - } - - - /* - - if (1) - { - - //find broadphase that contain this multiProxy - int numChildBroadphases = getBroadphaseArray().size(); - for (int i=0;igetBroadphaseAabb(worldAabbMin,worldAabbMax); - bool overlapsBroadphase = TestAabbAgainstAabb2(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax); - - // fullyContained = fullyContained || boxIsContainedWithinBox(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax); - int containingBroadphaseIndex = -1; - - //if already contains this - - for (int i=0;im_bridgeProxies.size();i++) - { - if (multiProxy->m_bridgeProxies[i]->m_childBroadphase == childBroadphase) - { - containingBroadphaseIndex = i; - } - alreadyInSimple = alreadyInSimple || (multiProxy->m_bridgeProxies[i]->m_childBroadphase == m_simpleBroadphase); - } - - if (overlapsBroadphase) - { - if (containingBroadphaseIndex<0) - { - btBroadphaseProxy* childProxy = childBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher); - childProxy->m_multiSapParentProxy = multiProxy; - addToChildBroadphase(multiProxy,childProxy,childBroadphase); - } - } else - { - if (containingBroadphaseIndex>=0) - { - //remove - btBridgeProxy* bridgeProxy = multiProxy->m_bridgeProxies[containingBroadphaseIndex]; - - btBroadphaseProxy* childProxy = bridgeProxy->m_childProxy; - bridgeProxy->m_childBroadphase->destroyProxy(childProxy,dispatcher); - - multiProxy->m_bridgeProxies.swap( containingBroadphaseIndex,multiProxy->m_bridgeProxies.size()-1); - multiProxy->m_bridgeProxies.pop_back(); - } - } - } - - - ///If we are in no other child broadphase, stick the proxy in the global 'simple' broadphase (brute force) - ///hopefully we don't end up with many entries here (can assert/provide feedback on stats) - if (0)//!multiProxy->m_bridgeProxies.size()) - { - ///we don't pass the userPtr but our multisap proxy. We need to patch this, before processing an actual collision - ///this is needed to be able to calculate the aabb overlap - btBroadphaseProxy* childProxy = m_simpleBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher); - childProxy->m_multiSapParentProxy = multiProxy; - addToChildBroadphase(multiProxy,childProxy,m_simpleBroadphase); - } - } - - if (!multiProxy->m_bridgeProxies.size()) - { - ///we don't pass the userPtr but our multisap proxy. We need to patch this, before processing an actual collision - ///this is needed to be able to calculate the aabb overlap - btBroadphaseProxy* childProxy = m_simpleBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher); - childProxy->m_multiSapParentProxy = multiProxy; - addToChildBroadphase(multiProxy,childProxy,m_simpleBroadphase); - } -*/ - - - //update - for ( i=0;im_bridgeProxies.size();i++) - { - btBridgeProxy* bridgeProxyRef = multiProxy->m_bridgeProxies[i]; - bridgeProxyRef->m_childBroadphase->setAabb(bridgeProxyRef->m_childProxy,aabbMin,aabbMax,dispatcher); - } - -} -bool stopUpdating=false; - - - -class btMultiSapBroadphasePairSortPredicate -{ - public: - - bool operator() ( const btBroadphasePair& a1, const btBroadphasePair& b1 ) const - { - btMultiSapBroadphase::btMultiSapProxy* aProxy0 = a1.m_pProxy0 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy0->m_multiSapParentProxy : 0; - btMultiSapBroadphase::btMultiSapProxy* aProxy1 = a1.m_pProxy1 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy1->m_multiSapParentProxy : 0; - btMultiSapBroadphase::btMultiSapProxy* bProxy0 = b1.m_pProxy0 ? (btMultiSapBroadphase::btMultiSapProxy*)b1.m_pProxy0->m_multiSapParentProxy : 0; - btMultiSapBroadphase::btMultiSapProxy* bProxy1 = b1.m_pProxy1 ? (btMultiSapBroadphase::btMultiSapProxy*)b1.m_pProxy1->m_multiSapParentProxy : 0; - - return aProxy0 > bProxy0 || - (aProxy0 == bProxy0 && aProxy1 > bProxy1) || - (aProxy0 == bProxy0 && aProxy1 == bProxy1 && a1.m_algorithm > b1.m_algorithm); - } -}; - - - ///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb -void btMultiSapBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher) -{ - -// m_simpleBroadphase->calculateOverlappingPairs(dispatcher); - - if (!stopUpdating && getOverlappingPairCache()->hasDeferredRemoval()) - { - - btBroadphasePairArray& overlappingPairArray = getOverlappingPairCache()->getOverlappingPairArray(); - - // quicksort(overlappingPairArray,0,overlappingPairArray.size()); - - overlappingPairArray.quickSort(btMultiSapBroadphasePairSortPredicate()); - - //perform a sort, to find duplicates and to sort 'invalid' pairs to the end - // overlappingPairArray.heapSort(btMultiSapBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - - - int i; - - btBroadphasePair previousPair; - previousPair.m_pProxy0 = 0; - previousPair.m_pProxy1 = 0; - previousPair.m_algorithm = 0; - - - for (i=0;im_multiSapParentProxy : 0; - btMultiSapProxy* aProxy1 = pair.m_pProxy1 ? (btMultiSapProxy*)pair.m_pProxy1->m_multiSapParentProxy : 0; - btMultiSapProxy* bProxy0 = previousPair.m_pProxy0 ? (btMultiSapProxy*)previousPair.m_pProxy0->m_multiSapParentProxy : 0; - btMultiSapProxy* bProxy1 = previousPair.m_pProxy1 ? (btMultiSapProxy*)previousPair.m_pProxy1->m_multiSapParentProxy : 0; - - bool isDuplicate = (aProxy0 == bProxy0) && (aProxy1 == bProxy1); - - previousPair = pair; - - bool needsRemoval = false; - - if (!isDuplicate) - { - bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1); - - if (hasOverlap) - { - needsRemoval = false;//callback->processOverlap(pair); - } else - { - needsRemoval = true; - } - } else - { - //remove duplicate - needsRemoval = true; - //should have no algorithm - btAssert(!pair.m_algorithm); - } - - if (needsRemoval) - { - getOverlappingPairCache()->cleanOverlappingPair(pair,dispatcher); - - // m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1); - // m_overlappingPairArray.pop_back(); - pair.m_pProxy0 = 0; - pair.m_pProxy1 = 0; - m_invalidPair++; - gOverlappingPairs--; - } - - } - - ///if you don't like to skip the invalid pairs in the array, execute following code: - #define CLEAN_INVALID_PAIRS 1 - #ifdef CLEAN_INVALID_PAIRS - - //perform a sort, to sort 'invalid' pairs to the end - //overlappingPairArray.heapSort(btMultiSapBroadphasePairSortPredicate()); - overlappingPairArray.quickSort(btMultiSapBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - #endif//CLEAN_INVALID_PAIRS - - //printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size()); - } - - -} - - -bool btMultiSapBroadphase::testAabbOverlap(btBroadphaseProxy* childProxy0,btBroadphaseProxy* childProxy1) -{ - btMultiSapProxy* multiSapProxy0 = (btMultiSapProxy*)childProxy0->m_multiSapParentProxy; - btMultiSapProxy* multiSapProxy1 = (btMultiSapProxy*)childProxy1->m_multiSapParentProxy; - - return TestAabbAgainstAabb2(multiSapProxy0->m_aabbMin,multiSapProxy0->m_aabbMax, - multiSapProxy1->m_aabbMin,multiSapProxy1->m_aabbMax); - -} - - -void btMultiSapBroadphase::printStats() -{ -/* printf("---------------------------------\n"); - - printf("btMultiSapBroadphase.h\n"); - printf("numHandles = %d\n",m_multiSapProxies.size()); - //find broadphase that contain this multiProxy - int numChildBroadphases = getBroadphaseArray().size(); - for (int i=0;iprintStats(); - - } - */ - -} - -void btMultiSapBroadphase::resetPool(btDispatcher* dispatcher) -{ - // not yet -} diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h deleted file mode 100644 index 7bcfe6b13..000000000 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#ifndef BT_MULTI_SAP_BROADPHASE -#define BT_MULTI_SAP_BROADPHASE - -#include "btBroadphaseInterface.h" -#include "LinearMath/btAlignedObjectArray.h" -#include "btOverlappingPairCache.h" - - -class btBroadphaseInterface; -class btSimpleBroadphase; - - -typedef btAlignedObjectArray btSapBroadphaseArray; - -///The btMultiSapBroadphase is a research project, not recommended to use in production. Use btAxisSweep3 or btDbvtBroadphase instead. -///The btMultiSapBroadphase is a broadphase that contains multiple SAP broadphases. -///The user can add SAP broadphases that cover the world. A btBroadphaseProxy can be in multiple child broadphases at the same time. -///A btQuantizedBvh acceleration structures finds overlapping SAPs for each btBroadphaseProxy. -///See http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=328 -///and http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1329 -class btMultiSapBroadphase :public btBroadphaseInterface -{ - btSapBroadphaseArray m_sapBroadphases; - - btSimpleBroadphase* m_simpleBroadphase; - - btOverlappingPairCache* m_overlappingPairs; - - class btQuantizedBvh* m_optimizedAabbTree; - - - bool m_ownsPairCache; - - btOverlapFilterCallback* m_filterCallback; - - int m_invalidPair; - - struct btBridgeProxy - { - btBroadphaseProxy* m_childProxy; - btBroadphaseInterface* m_childBroadphase; - }; - - -public: - - struct btMultiSapProxy : public btBroadphaseProxy - { - - ///array with all the entries that this proxy belongs to - btAlignedObjectArray m_bridgeProxies; - btVector3 m_aabbMin; - btVector3 m_aabbMax; - - int m_shapeType; - -/* void* m_userPtr; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; -*/ - btMultiSapProxy(const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) - :btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask), - m_aabbMin(aabbMin), - m_aabbMax(aabbMax), - m_shapeType(shapeType) - { - m_multiSapParentProxy =this; - } - - - }; - -protected: - - - btAlignedObjectArray m_multiSapProxies; - -public: - - btMultiSapBroadphase(int maxProxies = 16384,btOverlappingPairCache* pairCache=0); - - - btSapBroadphaseArray& getBroadphaseArray() - { - return m_sapBroadphases; - } - - const btSapBroadphaseArray& getBroadphaseArray() const - { - return m_sapBroadphases; - } - - virtual ~btMultiSapBroadphase(); - - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy); - virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); - virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher); - virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; - - virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin=btVector3(0,0,0),const btVector3& aabbMax=btVector3(0,0,0)); - - void addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase); - - ///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb - virtual void calculateOverlappingPairs(btDispatcher* dispatcher); - - bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1); - - virtual btOverlappingPairCache* getOverlappingPairCache() - { - return m_overlappingPairs; - } - virtual const btOverlappingPairCache* getOverlappingPairCache() const - { - return m_overlappingPairs; - } - - ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame - ///will add some transform later - virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const - { - aabbMin.setValue(-BT_LARGE_FLOAT,-BT_LARGE_FLOAT,-BT_LARGE_FLOAT); - aabbMax.setValue(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT); - } - - void buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax); - - virtual void printStats(); - - void quicksort (btBroadphasePairArray& a, int lo, int hi); - - ///reset broadphase internal structures, to ensure determinism/reproducability - virtual void resetPool(btDispatcher* dispatcher); - -}; - -#endif //BT_MULTI_SAP_BROADPHASE From 594866f24ceeeaff7246ef3492911bd72857b36f Mon Sep 17 00:00:00 2001 From: Johxz Date: Wed, 28 Feb 2018 22:15:31 -0600 Subject: [PATCH 137/312] update recast --- .../lib/recast/DebugUtils/Include/DebugDraw.h | 3 + .../recast/DebugUtils/Source/DebugDraw.cpp | 15 +- .../DebugUtils/Source/DetourDebugDraw.cpp | 31 +- .../DebugUtils/Source/RecastDebugDraw.cpp | 18 +- .../lib/recast/Detour/Include/DetourAssert.h | 25 +- .../lib/recast/Detour/Include/DetourCommon.h | 18 + .../lib/recast/Detour/Include/DetourNavMesh.h | 2 +- .../Detour/Include/DetourNavMeshBuilder.h | 3 +- .../Detour/Include/DetourNavMeshQuery.h | 53 +- .../lib/recast/Detour/Source/DetourAssert.cpp | 35 ++ .../lib/recast/Detour/Source/DetourCommon.cpp | 4 +- .../recast/Detour/Source/DetourNavMesh.cpp | 61 +- .../Detour/Source/DetourNavMeshBuilder.cpp | 127 +++-- .../Detour/Source/DetourNavMeshQuery.cpp | 519 +++++++++++------- .../recast/DetourCrowd/Include/DetourCrowd.h | 13 +- .../recast/DetourCrowd/Source/DetourCrowd.cpp | 9 +- .../Source/DetourObstacleAvoidance.cpp | 3 + .../DetourCrowd/Source/DetourPathCorridor.cpp | 4 +- .../Source/DetourProximityGrid.cpp | 1 + .../DetourTileCache/Include/DetourTileCache.h | 52 +- .../Include/DetourTileCacheBuilder.h | 6 + .../Source/DetourTileCache.cpp | 150 ++++- .../Source/DetourTileCacheBuilder.cpp | 102 +++- Engine/lib/recast/README.md | 89 +++ Engine/lib/recast/Recast/Include/Recast.h | 10 +- .../lib/recast/Recast/Include/RecastAlloc.h | 1 - .../lib/recast/Recast/Include/RecastAssert.h | 27 +- Engine/lib/recast/Recast/Source/Recast.cpp | 45 +- .../lib/recast/Recast/Source/RecastAlloc.cpp | 2 + .../lib/recast/Recast/Source/RecastAssert.cpp | 35 ++ .../lib/recast/Recast/Source/RecastLayers.cpp | 65 ++- .../lib/recast/Recast/Source/RecastMesh.cpp | 2 +- .../recast/Recast/Source/RecastMeshDetail.cpp | 5 +- .../lib/recast/Recast/Source/RecastRegion.cpp | 10 +- 34 files changed, 1138 insertions(+), 407 deletions(-) create mode 100644 Engine/lib/recast/Detour/Source/DetourAssert.cpp create mode 100644 Engine/lib/recast/README.md create mode 100644 Engine/lib/recast/Recast/Source/RecastAssert.cpp diff --git a/Engine/lib/recast/DebugUtils/Include/DebugDraw.h b/Engine/lib/recast/DebugUtils/Include/DebugDraw.h index 0b8c59352..00b544d1c 100644 --- a/Engine/lib/recast/DebugUtils/Include/DebugDraw.h +++ b/Engine/lib/recast/DebugUtils/Include/DebugDraw.h @@ -66,6 +66,9 @@ struct duDebugDraw /// End drawing primitives. virtual void end() = 0; + + /// Compute a color for given area. + virtual unsigned int areaToCol(unsigned int area); }; inline unsigned int duRGBA(int r, int g, int b, int a) diff --git a/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp b/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp index a009def36..d0179bca2 100644 --- a/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp +++ b/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp @@ -20,13 +20,26 @@ #include #include "DebugDraw.h" #include "DetourMath.h" +#include "DetourNavMesh.h" duDebugDraw::~duDebugDraw() { // Empty } - + +unsigned int duDebugDraw::areaToCol(unsigned int area) +{ + if (area == 0) + { + // Treat zero area type as default. + return duRGBA(0, 192, 255, 255); + } + else + { + return duIntToCol(area, 255); + } +} inline int bit(int a, int b) { diff --git a/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp b/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp index e2db1078f..dd4bad3fd 100644 --- a/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp +++ b/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp @@ -121,6 +121,7 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh dtPolyRef base = mesh.getPolyRefBase(tile); int tileNum = mesh.decodePolyIdTile(base); + const unsigned int tileColor = duIntToCol(tileNum, 128); dd->depthMask(false); @@ -139,16 +140,9 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh else { if (flags & DU_DRAWNAVMESH_COLOR_TILES) - { - col = duIntToCol(tileNum, 128); - } + col = tileColor; else - { - if (p->getArea() == 0) // Treat zero area type as default. - col = duRGBA(0,192,255,64); - else - col = duIntToCol(p->getArea(), 64); - } + col = duTransCol(dd->areaToCol(p->getArea()), 64); } for (int j = 0; j < pd->triCount; ++j) @@ -184,8 +178,8 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh if (query && query->isInClosedList(base | (dtPolyRef)i)) col = duRGBA(255,196,0,220); else - col = duDarkenCol(duIntToCol(p->getArea(), 220)); - + col = duDarkenCol(duTransCol(dd->areaToCol(p->getArea()), 220)); + const dtOffMeshConnection* con = &tile->offMeshCons[i - tile->header->offMeshBase]; const float* va = &tile->verts[p->verts[0]*3]; const float* vb = &tile->verts[p->verts[1]*3]; @@ -451,7 +445,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re dd->depthMask(false); - const unsigned int c = (col & 0x00ffffff) | (64 << 24); + const unsigned int c = duTransCol(col, 64); const unsigned int ip = (unsigned int)(poly - tile->polys); if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) @@ -462,7 +456,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re // Connection arc. duAppendArc(dd, con->pos[0],con->pos[1],con->pos[2], con->pos[3],con->pos[4],con->pos[5], 0.25f, - (con->flags & 1) ? 0.6f : 0, 0.6f, c); + (con->flags & 1) ? 0.6f : 0.0f, 0.6f, c); dd->end(); } @@ -559,15 +553,15 @@ void duDebugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLay const int lidx = x+y*w; const int lh = (int)layer.heights[lidx]; if (lh == 0xff) continue; + const unsigned char area = layer.areas[lidx]; - unsigned int col; if (area == 63) col = duLerpCol(color, duRGBA(0,192,255,64), 32); else if (area == 0) col = duLerpCol(color, duRGBA(0,0,0,64), 32); else - col = duLerpCol(color, duIntToCol(area, 255), 32); + col = duLerpCol(color, dd->areaToCol(area), 32); const float fx = bmin[0] + x*cs; const float fy = bmin[1] + (lh+1)*ch; @@ -743,14 +737,15 @@ void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyM for (int i = 0; i < lmesh.npolys; ++i) { const unsigned short* p = &lmesh.polys[i*nvp*2]; + const unsigned char area = lmesh.areas[i]; unsigned int color; - if (lmesh.areas[i] == DT_TILECACHE_WALKABLE_AREA) + if (area == DT_TILECACHE_WALKABLE_AREA) color = duRGBA(0,192,255,64); - else if (lmesh.areas[i] == DT_TILECACHE_NULL_AREA) + else if (area == DT_TILECACHE_NULL_AREA) color = duRGBA(0,0,0,64); else - color = duIntToCol(lmesh.areas[i], 255); + color = dd->areaToCol(area); unsigned short vi[3]; for (int j = 2; j < nvp; ++j) diff --git a/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp b/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp index 82050bde0..c1a73a168 100644 --- a/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp +++ b/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp @@ -198,7 +198,7 @@ void duDebugDrawHeightfieldWalkable(duDebugDraw* dd, const rcHeightfield& hf) else if (s->area == RC_NULL_AREA) fcol[0] = duRGBA(64,64,64,255); else - fcol[0] = duMultCol(duIntToCol(s->area, 255), 200); + fcol[0] = duMultCol(dd->areaToCol(s->area), 200); duAppendBox(dd, fx, orig[1]+s->smin*ch, fz, fx+cs, orig[1] + s->smax*ch, fz+cs, fcol); s = s->next; @@ -230,13 +230,14 @@ void duDebugDrawCompactHeightfieldSolid(duDebugDraw* dd, const rcCompactHeightfi { const rcCompactSpan& s = chf.spans[i]; + const unsigned char area = chf.areas[i]; unsigned int color; - if (chf.areas[i] == RC_WALKABLE_AREA) + if (area == RC_WALKABLE_AREA) color = duRGBA(0,192,255,64); - else if (chf.areas[i] == RC_NULL_AREA) + else if (area == RC_NULL_AREA) color = duRGBA(0,0,0,64); else - color = duIntToCol(chf.areas[i], 255); + color = dd->areaToCol(area); const float fy = chf.bmin[1] + (s.y+1)*ch; dd->vertex(fx, fy, fz, color); @@ -403,7 +404,7 @@ void duDebugDrawHeightfieldLayer(duDebugDraw* dd, const struct rcHeightfieldLaye else if (area == RC_NULL_AREA) col = duLerpCol(color, duRGBA(0,0,0,64), 32); else - col = duLerpCol(color, duIntToCol(area, 255), 32); + col = duLerpCol(color, dd->areaToCol(area), 32); const float fx = layer.bmin[0] + x*cs; const float fy = layer.bmin[1] + (lh+1)*ch; @@ -866,14 +867,15 @@ void duDebugDrawPolyMesh(duDebugDraw* dd, const struct rcPolyMesh& mesh) for (int i = 0; i < mesh.npolys; ++i) { const unsigned short* p = &mesh.polys[i*nvp*2]; + const unsigned char area = mesh.areas[i]; unsigned int color; - if (mesh.areas[i] == RC_WALKABLE_AREA) + if (area == RC_WALKABLE_AREA) color = duRGBA(0,192,255,64); - else if (mesh.areas[i] == RC_NULL_AREA) + else if (area == RC_NULL_AREA) color = duRGBA(0,0,0,64); else - color = duIntToCol(mesh.areas[i], 255); + color = dd->areaToCol(area); unsigned short vi[3]; for (int j = 2; j < nvp; ++j) diff --git a/Engine/lib/recast/Detour/Include/DetourAssert.h b/Engine/lib/recast/Detour/Include/DetourAssert.h index 3cf652288..e05fd66fa 100644 --- a/Engine/lib/recast/Detour/Include/DetourAssert.h +++ b/Engine/lib/recast/Detour/Include/DetourAssert.h @@ -23,11 +23,34 @@ // Feel free to change the file and include your own implementation instead. #ifdef NDEBUG + // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ # define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) + #else + +/// An assertion failure function. +// @param[in] expression asserted expression. +// @param[in] file Filename of the failed assertion. +// @param[in] line Line number of the failed assertion. +/// @see dtAssertFailSetCustom +typedef void (dtAssertFailFunc)(const char* expression, const char* file, int line); + +/// Sets the base custom assertion failure function to be used by Detour. +/// @param[in] assertFailFunc The function to be invoked in case of failure of #dtAssert +void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc); + +/// Gets the base custom assertion failure function to be used by Detour. +dtAssertFailFunc* dtAssertFailGetCustom(); + # include -# define dtAssert assert +# define dtAssert(expression) \ + { \ + dtAssertFailFunc* failFunc = dtAssertFailGetCustom(); \ + if(failFunc == NULL) { assert(expression); } \ + else if(!(expression)) { (*failFunc)(#expression, __FILE__, __LINE__); } \ + } + #endif #endif // DETOURASSERT_H diff --git a/Engine/lib/recast/Detour/Include/DetourCommon.h b/Engine/lib/recast/Detour/Include/DetourCommon.h index 2afba0d78..739858cd9 100644 --- a/Engine/lib/recast/Detour/Include/DetourCommon.h +++ b/Engine/lib/recast/Detour/Include/DetourCommon.h @@ -20,6 +20,7 @@ #define DETOURCOMMON_H #include "DetourMath.h" +#include /** @defgroup detour Detour @@ -482,6 +483,23 @@ inline void dtSwapEndian(float* v) void dtRandomPointInConvexPoly(const float* pts, const int npts, float* areas, const float s, const float t, float* out); +template +TypeToRetrieveAs* dtGetThenAdvanceBufferPointer(const unsigned char*& buffer, const size_t distanceToAdvance) +{ + TypeToRetrieveAs* returnPointer = reinterpret_cast(buffer); + buffer += distanceToAdvance; + return returnPointer; +} + +template +TypeToRetrieveAs* dtGetThenAdvanceBufferPointer(unsigned char*& buffer, const size_t distanceToAdvance) +{ + TypeToRetrieveAs* returnPointer = reinterpret_cast(buffer); + buffer += distanceToAdvance; + return returnPointer; +} + + /// @} #endif // DETOURCOMMON_H diff --git a/Engine/lib/recast/Detour/Include/DetourNavMesh.h b/Engine/lib/recast/Detour/Include/DetourNavMesh.h index 8ecd57e46..02ee5e78c 100644 --- a/Engine/lib/recast/Detour/Include/DetourNavMesh.h +++ b/Engine/lib/recast/Detour/Include/DetourNavMesh.h @@ -635,7 +635,7 @@ private: dtPolyRef* polys, const int maxPolys) const; /// Find nearest polygon within a tile. dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const float* center, - const float* extents, float* nearestPt) const; + const float* halfExtents, float* nearestPt) const; /// Returns closest point on polygon. void closestPointOnPoly(dtPolyRef ref, const float* pos, float* closest, bool* posOverPoly) const; diff --git a/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h b/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h index c80d17176..9425a7a78 100644 --- a/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h +++ b/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h @@ -145,4 +145,5 @@ function. @see dtCreateNavMeshData -*/ \ No newline at end of file +*/ + diff --git a/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h b/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h index ad425fb0c..1c23e4857 100644 --- a/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h +++ b/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h @@ -148,7 +148,18 @@ struct dtRaycastHit float pathCost; }; +/// Provides custom polygon query behavior. +/// Used by dtNavMeshQuery::queryPolygons. +/// @ingroup detour +class dtPolyQuery +{ +public: + virtual ~dtPolyQuery() { } + /// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons. + /// This can be called multiple times for a single query. + virtual void process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count) = 0; +}; /// Provides the ability to perform pathfinding related queries against /// a navigation mesh. @@ -182,7 +193,7 @@ public: const float* startPos, const float* endPos, const dtQueryFilter* filter, dtPolyRef* path, int* pathCount, const int maxPath) const; - + /// Finds the straight path from the start to the end position within the polygon corridor. /// @param[in] startPos Path start position. [(x, y, z)] /// @param[in] endPos Path end position. [(x, y, z)] @@ -285,33 +296,55 @@ public: dtPolyRef* resultRef, dtPolyRef* resultParent, float* resultCost, int* resultCount, const int maxResult) const; + /// Gets a path from the explored nodes in the previous search. + /// @param[in] endRef The reference id of the end polygon. + /// @param[out] path An ordered list of polygon references representing the path. (Start to end.) + /// [(polyRef) * @p pathCount] + /// @param[out] pathCount The number of polygons returned in the @p path array. + /// @param[in] maxPath The maximum number of polygons the @p path array can hold. [Limit: >= 0] + /// @returns The status flags. Returns DT_FAILURE | DT_INVALID_PARAM if any parameter is wrong, or if + /// @p endRef was not explored in the previous search. Returns DT_SUCCESS | DT_BUFFER_TOO_SMALL + /// if @p path cannot contain the entire path. In this case it is filled to capacity with a partial path. + /// Otherwise returns DT_SUCCESS. + /// @remarks The result of this function depends on the state of the query object. For that reason it should only + /// be used immediately after one of the two Dijkstra searches, findPolysAroundCircle or findPolysAroundShape. + dtStatus getPathFromDijkstraSearch(dtPolyRef endRef, dtPolyRef* path, int* pathCount, int maxPath) const; + /// @} /// @name Local Query Functions ///@{ /// Finds the polygon nearest to the specified center point. /// @param[in] center The center of the search box. [(x, y, z)] - /// @param[in] extents The search distance along each axis. [(x, y, z)] + /// @param[in] halfExtents The search distance along each axis. [(x, y, z)] /// @param[in] filter The polygon filter to apply to the query. /// @param[out] nearestRef The reference id of the nearest polygon. /// @param[out] nearestPt The nearest point on the polygon. [opt] [(x, y, z)] /// @returns The status flags for the query. - dtStatus findNearestPoly(const float* center, const float* extents, + dtStatus findNearestPoly(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* nearestRef, float* nearestPt) const; /// Finds polygons that overlap the search box. /// @param[in] center The center of the search box. [(x, y, z)] - /// @param[in] extents The search distance along each axis. [(x, y, z)] + /// @param[in] halfExtents The search distance along each axis. [(x, y, z)] /// @param[in] filter The polygon filter to apply to the query. /// @param[out] polys The reference ids of the polygons that overlap the query box. /// @param[out] polyCount The number of polygons in the search result. /// @param[in] maxPolys The maximum number of polygons the search result can hold. /// @returns The status flags for the query. - dtStatus queryPolygons(const float* center, const float* extents, + dtStatus queryPolygons(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* polys, int* polyCount, const int maxPolys) const; + /// Finds polygons that overlap the search box. + /// @param[in] center The center of the search box. [(x, y, z)] + /// @param[in] halfExtents The search distance along each axis. [(x, y, z)] + /// @param[in] filter The polygon filter to apply to the query. + /// @param[in] query The query. Polygons found will be batched together and passed to this query. + dtStatus queryPolygons(const float* center, const float* halfExtents, + const dtQueryFilter* filter, dtPolyQuery* query) const; + /// Finds the non-overlapping navigation polygons in the local neighbourhood around the center position. /// @param[in] startRef The reference id of the polygon where the search starts. /// @param[in] centerPos The center of the query circle. [(x, y, z)] @@ -479,12 +512,9 @@ private: dtNavMeshQuery(const dtNavMeshQuery&); dtNavMeshQuery& operator=(const dtNavMeshQuery&); - /// Returns neighbour tile based on side. - dtMeshTile* getNeighbourTileAt(int x, int y, int side) const; - /// Queries polygons within a tile. - int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, const dtQueryFilter* filter, - dtPolyRef* polys, const int maxPolys) const; + void queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, + const dtQueryFilter* filter, dtPolyQuery* query) const; /// Returns portal points between two polygons. dtStatus getPortalPoints(dtPolyRef from, dtPolyRef to, float* left, float* right, @@ -508,6 +538,9 @@ private: dtStatus appendPortals(const int startIdx, const int endIdx, const float* endPos, const dtPolyRef* path, float* straightPath, unsigned char* straightPathFlags, dtPolyRef* straightPathRefs, int* straightPathCount, const int maxStraightPath, const int options) const; + + // Gets the path leading to the specified end node. + dtStatus getPathToNode(struct dtNode* endNode, dtPolyRef* path, int* pathCount, int maxPath) const; const dtNavMesh* m_nav; ///< Pointer to navmesh data. diff --git a/Engine/lib/recast/Detour/Source/DetourAssert.cpp b/Engine/lib/recast/Detour/Source/DetourAssert.cpp new file mode 100644 index 000000000..5e019e0cf --- /dev/null +++ b/Engine/lib/recast/Detour/Source/DetourAssert.cpp @@ -0,0 +1,35 @@ +// +// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// + +#include "DetourAssert.h" + +#ifndef NDEBUG + +static dtAssertFailFunc* sAssertFailFunc = 0; + +void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc) +{ + sAssertFailFunc = assertFailFunc; +} + +dtAssertFailFunc* dtAssertFailGetCustom() +{ + return sAssertFailFunc; +} + +#endif diff --git a/Engine/lib/recast/Detour/Source/DetourCommon.cpp b/Engine/lib/recast/Detour/Source/DetourCommon.cpp index 26fe65c17..41d0d7bd3 100644 --- a/Engine/lib/recast/Detour/Source/DetourCommon.cpp +++ b/Engine/lib/recast/Detour/Source/DetourCommon.cpp @@ -342,8 +342,8 @@ void dtRandomPointInConvexPoly(const float* pts, const int npts, float* areas, // Find sub triangle weighted by area. const float thr = s*areasum; float acc = 0.0f; - float u = 0.0f; - int tri = 0; + float u = 1.0f; + int tri = npts - 1; for (int i = 2; i < npts; i++) { const float dacc = areas[i]; if (thr >= acc && thr < (acc+dacc)) diff --git a/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp b/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp index bb6c9e4b7..b81a2567b 100644 --- a/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp +++ b/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp @@ -304,7 +304,7 @@ int dtNavMesh::findConnectingPolys(const float* va, const float* vb, if (!tile) return 0; float amin[2], amax[2]; - calcSlabEndPoints(va,vb, amin,amax, side); + calcSlabEndPoints(va, vb, amin, amax, side); const float apos = getSlabCoord(va, side); // Remove links pointing to 'side' and compact the links array. @@ -470,12 +470,12 @@ void dtNavMesh::connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int if (targetPoly->firstLink == DT_NULL_LINK) continue; - const float ext[3] = { targetCon->rad, target->header->walkableClimb, targetCon->rad }; + const float halfExtents[3] = { targetCon->rad, target->header->walkableClimb, targetCon->rad }; // Find polygon to connect to. const float* p = &targetCon->pos[3]; float nearestPt[3]; - dtPolyRef ref = findNearestPolyInTile(tile, p, ext, nearestPt); + dtPolyRef ref = findNearestPolyInTile(tile, p, halfExtents, nearestPt); if (!ref) continue; // findNearestPoly may return too optimistic results, further check to make sure. @@ -570,12 +570,12 @@ void dtNavMesh::baseOffMeshLinks(dtMeshTile* tile) dtOffMeshConnection* con = &tile->offMeshCons[i]; dtPoly* poly = &tile->polys[con->poly]; - const float ext[3] = { con->rad, tile->header->walkableClimb, con->rad }; + const float halfExtents[3] = { con->rad, tile->header->walkableClimb, con->rad }; // Find polygon to connect to. const float* p = &con->pos[0]; // First vertex float nearestPt[3]; - dtPolyRef ref = findNearestPolyInTile(tile, p, ext, nearestPt); + dtPolyRef ref = findNearestPolyInTile(tile, p, halfExtents, nearestPt); if (!ref) continue; // findNearestPoly may return too optimistic results, further check to make sure. if (dtSqr(nearestPt[0]-p[0])+dtSqr(nearestPt[2]-p[2]) > dtSqr(con->rad)) @@ -651,9 +651,9 @@ void dtNavMesh::closestPointOnPoly(dtPolyRef ref, const float* pos, float* close if (!dtDistancePtPolyEdgesSqr(pos, verts, nv, edged, edget)) { // Point is outside the polygon, dtClamp to nearest edge. - float dmin = FLT_MAX; - int imin = -1; - for (int i = 0; i < nv; ++i) + float dmin = edged[0]; + int imin = 0; + for (int i = 1; i < nv; ++i) { if (edged[i] < dmin) { @@ -687,7 +687,7 @@ void dtNavMesh::closestPointOnPoly(dtPolyRef ref, const float* pos, float* close v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; } float h; - if (dtClosestHeightPointTriangle(pos, v[0], v[1], v[2], h)) + if (dtClosestHeightPointTriangle(closest, v[0], v[1], v[2], h)) { closest[1] = h; break; @@ -696,12 +696,12 @@ void dtNavMesh::closestPointOnPoly(dtPolyRef ref, const float* pos, float* close } dtPolyRef dtNavMesh::findNearestPolyInTile(const dtMeshTile* tile, - const float* center, const float* extents, + const float* center, const float* halfExtents, float* nearestPt) const { float bmin[3], bmax[3]; - dtVsub(bmin, center, extents); - dtVadd(bmax, center, extents); + dtVsub(bmin, center, halfExtents); + dtVadd(bmax, center, halfExtents); // Get nearby polygons from proximity grid. dtPolyRef polys[128]; @@ -917,14 +917,14 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, const int offMeshLinksSize = dtAlign4(sizeof(dtOffMeshConnection)*header->offMeshConCount); unsigned char* d = data + headerSize; - tile->verts = (float*)d; d += vertsSize; - tile->polys = (dtPoly*)d; d += polysSize; - tile->links = (dtLink*)d; d += linksSize; - tile->detailMeshes = (dtPolyDetail*)d; d += detailMeshesSize; - tile->detailVerts = (float*)d; d += detailVertsSize; - tile->detailTris = (unsigned char*)d; d += detailTrisSize; - tile->bvTree = (dtBVNode*)d; d += bvtreeSize; - tile->offMeshCons = (dtOffMeshConnection*)d; d += offMeshLinksSize; + tile->verts = dtGetThenAdvanceBufferPointer(d, vertsSize); + tile->polys = dtGetThenAdvanceBufferPointer(d, polysSize); + tile->links = dtGetThenAdvanceBufferPointer(d, linksSize); + tile->detailMeshes = dtGetThenAdvanceBufferPointer(d, detailMeshesSize); + tile->detailVerts = dtGetThenAdvanceBufferPointer(d, detailVertsSize); + tile->detailTris = dtGetThenAdvanceBufferPointer(d, detailTrisSize); + tile->bvTree = dtGetThenAdvanceBufferPointer(d, bvtreeSize); + tile->offMeshCons = dtGetThenAdvanceBufferPointer(d, offMeshLinksSize); // If there are no items in the bvtree, reset the tree pointer. if (!bvtreeSize) @@ -943,7 +943,10 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, tile->flags = flags; connectIntLinks(tile); + + // Base off-mesh connections to their starting polygons and connect connections inside the tile. baseOffMeshLinks(tile); + connectExtOffMeshLinks(tile, tile, -1); // Create connections with neighbour tiles. static const int MAX_NEIS = 32; @@ -954,11 +957,11 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, nneis = getTilesAt(header->x, header->y, neis, MAX_NEIS); for (int j = 0; j < nneis; ++j) { - if (neis[j] != tile) - { - connectExtLinks(tile, neis[j], -1); - connectExtLinks(neis[j], tile, -1); - } + if (neis[j] == tile) + continue; + + connectExtLinks(tile, neis[j], -1); + connectExtLinks(neis[j], tile, -1); connectExtOffMeshLinks(tile, neis[j], -1); connectExtOffMeshLinks(neis[j], tile, -1); } @@ -1322,8 +1325,8 @@ dtStatus dtNavMesh::storeTileState(const dtMeshTile* tile, unsigned char* data, if (maxDataSize < sizeReq) return DT_FAILURE | DT_BUFFER_TOO_SMALL; - dtTileState* tileState = (dtTileState*)data; data += dtAlign4(sizeof(dtTileState)); - dtPolyState* polyStates = (dtPolyState*)data; data += dtAlign4(sizeof(dtPolyState) * tile->header->polyCount); + dtTileState* tileState = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtTileState))); + dtPolyState* polyStates = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtPolyState) * tile->header->polyCount)); // Store tile state. tileState->magic = DT_NAVMESH_STATE_MAGIC; @@ -1354,8 +1357,8 @@ dtStatus dtNavMesh::restoreTileState(dtMeshTile* tile, const unsigned char* data if (maxDataSize < sizeReq) return DT_FAILURE | DT_INVALID_PARAM; - const dtTileState* tileState = (const dtTileState*)data; data += dtAlign4(sizeof(dtTileState)); - const dtPolyState* polyStates = (const dtPolyState*)data; data += dtAlign4(sizeof(dtPolyState) * tile->header->polyCount); + const dtTileState* tileState = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtTileState))); + const dtPolyState* polyStates = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtPolyState) * tile->header->polyCount)); // Check that the restore is possible. if (tileState->magic != DT_NAVMESH_STATE_MAGIC) diff --git a/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp b/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp index 1bf271bed..e93a97629 100644 --- a/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp +++ b/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp @@ -106,7 +106,6 @@ inline int longestAxis(unsigned short x, unsigned short y, unsigned short z) if (z > maxVal) { axis = 2; - maxVal = z; } return axis; } @@ -169,45 +168,72 @@ static void subdivide(BVItem* items, int nitems, int imin, int imax, int& curNod } } -static int createBVTree(const unsigned short* verts, const int /*nverts*/, - const unsigned short* polys, const int npolys, const int nvp, - const float cs, const float ch, - const int /*nnodes*/, dtBVNode* nodes) +static int createBVTree(dtNavMeshCreateParams* params, dtBVNode* nodes, int /*nnodes*/) { // Build tree - BVItem* items = (BVItem*)dtAlloc(sizeof(BVItem)*npolys, DT_ALLOC_TEMP); - for (int i = 0; i < npolys; i++) + float quantFactor = 1 / params->cs; + BVItem* items = (BVItem*)dtAlloc(sizeof(BVItem)*params->polyCount, DT_ALLOC_TEMP); + for (int i = 0; i < params->polyCount; i++) { BVItem& it = items[i]; it.i = i; - // Calc polygon bounds. - const unsigned short* p = &polys[i*nvp*2]; - it.bmin[0] = it.bmax[0] = verts[p[0]*3+0]; - it.bmin[1] = it.bmax[1] = verts[p[0]*3+1]; - it.bmin[2] = it.bmax[2] = verts[p[0]*3+2]; - - for (int j = 1; j < nvp; ++j) + // Calc polygon bounds. Use detail meshes if available. + if (params->detailMeshes) { - if (p[j] == MESH_NULL_IDX) break; - unsigned short x = verts[p[j]*3+0]; - unsigned short y = verts[p[j]*3+1]; - unsigned short z = verts[p[j]*3+2]; - - if (x < it.bmin[0]) it.bmin[0] = x; - if (y < it.bmin[1]) it.bmin[1] = y; - if (z < it.bmin[2]) it.bmin[2] = z; - - if (x > it.bmax[0]) it.bmax[0] = x; - if (y > it.bmax[1]) it.bmax[1] = y; - if (z > it.bmax[2]) it.bmax[2] = z; + int vb = (int)params->detailMeshes[i*4+0]; + int ndv = (int)params->detailMeshes[i*4+1]; + float bmin[3]; + float bmax[3]; + + const float* dv = ¶ms->detailVerts[vb*3]; + dtVcopy(bmin, dv); + dtVcopy(bmax, dv); + + for (int j = 1; j < ndv; j++) + { + dtVmin(bmin, &dv[j * 3]); + dtVmax(bmax, &dv[j * 3]); + } + + // BV-tree uses cs for all dimensions + it.bmin[0] = (unsigned short)dtClamp((int)((bmin[0] - params->bmin[0])*quantFactor), 0, 0xffff); + it.bmin[1] = (unsigned short)dtClamp((int)((bmin[1] - params->bmin[1])*quantFactor), 0, 0xffff); + it.bmin[2] = (unsigned short)dtClamp((int)((bmin[2] - params->bmin[2])*quantFactor), 0, 0xffff); + + it.bmax[0] = (unsigned short)dtClamp((int)((bmax[0] - params->bmin[0])*quantFactor), 0, 0xffff); + it.bmax[1] = (unsigned short)dtClamp((int)((bmax[1] - params->bmin[1])*quantFactor), 0, 0xffff); + it.bmax[2] = (unsigned short)dtClamp((int)((bmax[2] - params->bmin[2])*quantFactor), 0, 0xffff); + } + else + { + const unsigned short* p = ¶ms->polys[i*params->nvp * 2]; + it.bmin[0] = it.bmax[0] = params->verts[p[0] * 3 + 0]; + it.bmin[1] = it.bmax[1] = params->verts[p[0] * 3 + 1]; + it.bmin[2] = it.bmax[2] = params->verts[p[0] * 3 + 2]; + + for (int j = 1; j < params->nvp; ++j) + { + if (p[j] == MESH_NULL_IDX) break; + unsigned short x = params->verts[p[j] * 3 + 0]; + unsigned short y = params->verts[p[j] * 3 + 1]; + unsigned short z = params->verts[p[j] * 3 + 2]; + + if (x < it.bmin[0]) it.bmin[0] = x; + if (y < it.bmin[1]) it.bmin[1] = y; + if (z < it.bmin[2]) it.bmin[2] = z; + + if (x > it.bmax[0]) it.bmax[0] = x; + if (y > it.bmax[1]) it.bmax[1] = y; + if (z > it.bmax[2]) it.bmax[2] = z; + } + // Remap y + it.bmin[1] = (unsigned short)dtMathFloorf((float)it.bmin[1] * params->ch / params->cs); + it.bmax[1] = (unsigned short)dtMathCeilf((float)it.bmax[1] * params->ch / params->cs); } - // Remap y - it.bmin[1] = (unsigned short)dtMathFloorf((float)it.bmin[1]*ch/cs); - it.bmax[1] = (unsigned short)dtMathCeilf((float)it.bmax[1]*ch/cs); } int curNode = 0; - subdivide(items, npolys, 0, npolys, curNode, nodes); + subdivide(items, params->polyCount, 0, params->polyCount, curNode, nodes); dtFree(items); @@ -421,15 +447,16 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData, memset(data, 0, dataSize); unsigned char* d = data; - dtMeshHeader* header = (dtMeshHeader*)d; d += headerSize; - float* navVerts = (float*)d; d += vertsSize; - dtPoly* navPolys = (dtPoly*)d; d += polysSize; - d += linksSize; - dtPolyDetail* navDMeshes = (dtPolyDetail*)d; d += detailMeshesSize; - float* navDVerts = (float*)d; d += detailVertsSize; - unsigned char* navDTris = (unsigned char*)d; d += detailTrisSize; - dtBVNode* navBvtree = (dtBVNode*)d; d += bvTreeSize; - dtOffMeshConnection* offMeshCons = (dtOffMeshConnection*)d; d += offMeshConsSize; + + dtMeshHeader* header = dtGetThenAdvanceBufferPointer(d, headerSize); + float* navVerts = dtGetThenAdvanceBufferPointer(d, vertsSize); + dtPoly* navPolys = dtGetThenAdvanceBufferPointer(d, polysSize); + d += linksSize; // Ignore links; just leave enough space for them. They'll be created on load. + dtPolyDetail* navDMeshes = dtGetThenAdvanceBufferPointer(d, detailMeshesSize); + float* navDVerts = dtGetThenAdvanceBufferPointer(d, detailVertsSize); + unsigned char* navDTris = dtGetThenAdvanceBufferPointer(d, detailTrisSize); + dtBVNode* navBvtree = dtGetThenAdvanceBufferPointer(d, bvTreeSize); + dtOffMeshConnection* offMeshCons = dtGetThenAdvanceBufferPointer(d, offMeshConsSize); // Store header @@ -595,11 +622,9 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData, } // Store and create BVtree. - // TODO: take detail mesh into account! use byte per bbox extent? if (params->buildBvTree) { - createBVTree(params->verts, params->vertCount, params->polys, params->polyCount, - nvp, params->cs, params->ch, params->polyCount*2, navBvtree); + createBVTree(params, navBvtree, 2*params->polyCount); } // Store Off-Mesh connections. @@ -705,14 +730,16 @@ bool dtNavMeshDataSwapEndian(unsigned char* data, const int /*dataSize*/) const int offMeshLinksSize = dtAlign4(sizeof(dtOffMeshConnection)*header->offMeshConCount); unsigned char* d = data + headerSize; - float* verts = (float*)d; d += vertsSize; - dtPoly* polys = (dtPoly*)d; d += polysSize; - /*dtLink* links = (dtLink*)d;*/ d += linksSize; - dtPolyDetail* detailMeshes = (dtPolyDetail*)d; d += detailMeshesSize; - float* detailVerts = (float*)d; d += detailVertsSize; - /*unsigned char* detailTris = (unsigned char*)d;*/ d += detailTrisSize; - dtBVNode* bvTree = (dtBVNode*)d; d += bvtreeSize; - dtOffMeshConnection* offMeshCons = (dtOffMeshConnection*)d; d += offMeshLinksSize; + float* verts = dtGetThenAdvanceBufferPointer(d, vertsSize); + dtPoly* polys = dtGetThenAdvanceBufferPointer(d, polysSize); + d += linksSize; // Ignore links; they technically should be endian-swapped but all their data is overwritten on load anyway. + //dtLink* links = dtGetThenAdvanceBufferPointer(d, linksSize); + dtPolyDetail* detailMeshes = dtGetThenAdvanceBufferPointer(d, detailMeshesSize); + float* detailVerts = dtGetThenAdvanceBufferPointer(d, detailVertsSize); + d += detailTrisSize; // Ignore detail tris; single bytes can't be endian-swapped. + //unsigned char* detailTris = dtGetThenAdvanceBufferPointer(d, detailTrisSize); + dtBVNode* bvTree = dtGetThenAdvanceBufferPointer(d, bvtreeSize); + dtOffMeshConnection* offMeshCons = dtGetThenAdvanceBufferPointer(d, offMeshLinksSize); // Vertices for (int i = 0; i < header->vertCount*3; ++i) diff --git a/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp b/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp index 87706c1de..90999f2f6 100644 --- a/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp +++ b/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp @@ -542,9 +542,9 @@ dtStatus dtNavMeshQuery::closestPointOnPoly(dtPolyRef ref, const float* pos, flo if (!dtDistancePtPolyEdgesSqr(pos, verts, nv, edged, edget)) { // Point is outside the polygon, dtClamp to nearest edge. - float dmin = FLT_MAX; - int imin = -1; - for (int i = 0; i < nv; ++i) + float dmin = edged[0]; + int imin = 0; + for (int i = 1; i < nv; ++i) { if (edged[i] < dmin) { @@ -578,7 +578,7 @@ dtStatus dtNavMeshQuery::closestPointOnPoly(dtPolyRef ref, const float* pos, flo v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; } float h; - if (dtClosestHeightPointTriangle(pos, v[0], v[1], v[2], h)) + if (dtClosestHeightPointTriangle(closest, v[0], v[1], v[2], h)) { closest[1] = h; break; @@ -628,9 +628,9 @@ dtStatus dtNavMeshQuery::closestPointOnPolyBoundary(dtPolyRef ref, const float* else { // Point is outside the polygon, dtClamp to nearest edge. - float dmin = FLT_MAX; - int imin = -1; - for (int i = 0; i < nv; ++i) + float dmin = edged[0]; + int imin = 0; + for (int i = 1; i < nv; ++i) { if (edged[i] < dmin) { @@ -699,16 +699,67 @@ dtStatus dtNavMeshQuery::getPolyHeight(dtPolyRef ref, const float* pos, float* h return DT_FAILURE | DT_INVALID_PARAM; } +class dtFindNearestPolyQuery : public dtPolyQuery +{ + const dtNavMeshQuery* m_query; + const float* m_center; + float m_nearestDistanceSqr; + dtPolyRef m_nearestRef; + float m_nearestPoint[3]; + +public: + dtFindNearestPolyQuery(const dtNavMeshQuery* query, const float* center) + : m_query(query), m_center(center), m_nearestDistanceSqr(FLT_MAX), m_nearestRef(0), m_nearestPoint() + { + } + + dtPolyRef nearestRef() const { return m_nearestRef; } + const float* nearestPoint() const { return m_nearestPoint; } + + void process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count) + { + dtIgnoreUnused(polys); + + for (int i = 0; i < count; ++i) + { + dtPolyRef ref = refs[i]; + float closestPtPoly[3]; + float diff[3]; + bool posOverPoly = false; + float d; + m_query->closestPointOnPoly(ref, m_center, closestPtPoly, &posOverPoly); + + // If a point is directly over a polygon and closer than + // climb height, favor that instead of straight line nearest point. + dtVsub(diff, m_center, closestPtPoly); + if (posOverPoly) + { + d = dtAbs(diff[1]) - tile->header->walkableClimb; + d = d > 0 ? d*d : 0; + } + else + { + d = dtVlenSqr(diff); + } + + if (d < m_nearestDistanceSqr) + { + dtVcopy(m_nearestPoint, closestPtPoly); + + m_nearestDistanceSqr = d; + m_nearestRef = ref; + } + } + } +}; + /// @par /// /// @note If the search box does not intersect any polygons the search will /// return #DT_SUCCESS, but @p nearestRef will be zero. So if in doubt, check /// @p nearestRef before using @p nearestPt. /// -/// @warning This function is not suitable for large area searches. If the search -/// extents overlaps more than MAX_SEARCH (128) polygons it may return an invalid result. -/// -dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* extents, +dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* nearestRef, float* nearestPt) const { @@ -717,70 +768,29 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* exten if (!nearestRef) return DT_FAILURE | DT_INVALID_PARAM; - // Get nearby polygons from proximity grid. - const int MAX_SEARCH = 128; - dtPolyRef polys[MAX_SEARCH]; - int polyCount = 0; - if (dtStatusFailed(queryPolygons(center, extents, filter, polys, &polyCount, MAX_SEARCH))) - return DT_FAILURE | DT_INVALID_PARAM; - - *nearestRef = 0; + dtFindNearestPolyQuery query(this, center); - if (polyCount == 0) - return DT_SUCCESS; - - // Find nearest polygon amongst the nearby polygons. - dtPolyRef nearest = 0; - float nearestPoint[3]; + dtStatus status = queryPolygons(center, halfExtents, filter, &query); + if (dtStatusFailed(status)) + return status; - float nearestDistanceSqr = FLT_MAX; - for (int i = 0; i < polyCount; ++i) - { - dtPolyRef ref = polys[i]; - float closestPtPoly[3]; - float diff[3]; - bool posOverPoly = false; - float d = 0; - closestPointOnPoly(ref, center, closestPtPoly, &posOverPoly); - - // If a point is directly over a polygon and closer than - // climb height, favor that instead of straight line nearest point. - dtVsub(diff, center, closestPtPoly); - if (posOverPoly) - { - const dtMeshTile* tile = 0; - const dtPoly* poly = 0; - m_nav->getTileAndPolyByRefUnsafe(polys[i], &tile, &poly); - d = dtAbs(diff[1]) - tile->header->walkableClimb; - d = d > 0 ? d*d : 0; - } - else - { - d = dtVlenSqr(diff); - } - - if (d < nearestDistanceSqr) - { - dtVcopy(nearestPoint, closestPtPoly); - - nearestDistanceSqr = d; - nearest = ref; - } - } - - *nearestRef = nearest; - - if (nearestPt) - dtVcopy(nearestPt, nearestPoint); + *nearestRef = query.nearestRef(); + // Only override nearestPt if we actually found a poly so the nearest point + // is valid. + if (nearestPt && *nearestRef) + dtVcopy(nearestPt, query.nearestPoint()); return DT_SUCCESS; } -int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, - const dtQueryFilter* filter, - dtPolyRef* polys, const int maxPolys) const +void dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, + const dtQueryFilter* filter, dtPolyQuery* query) const { dtAssert(m_nav); + static const int batchSize = 32; + dtPolyRef polyRefs[batchSize]; + dtPoly* polys[batchSize]; + int n = 0; if (tile->bvTree) { @@ -789,7 +799,7 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi const float* tbmin = tile->header->bmin; const float* tbmax = tile->header->bmax; const float qfac = tile->header->bvQuantFactor; - + // Calculate quantized box unsigned short bmin[3], bmax[3]; // dtClamp query box to world box. @@ -806,25 +816,34 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi bmax[0] = (unsigned short)(qfac * maxx + 1) | 1; bmax[1] = (unsigned short)(qfac * maxy + 1) | 1; bmax[2] = (unsigned short)(qfac * maxz + 1) | 1; - + // Traverse tree const dtPolyRef base = m_nav->getPolyRefBase(tile); - int n = 0; while (node < end) { const bool overlap = dtOverlapQuantBounds(bmin, bmax, node->bmin, node->bmax); const bool isLeafNode = node->i >= 0; - + if (isLeafNode && overlap) { dtPolyRef ref = base | (dtPolyRef)node->i; if (filter->passFilter(ref, tile, &tile->polys[node->i])) { - if (n < maxPolys) - polys[n++] = ref; + polyRefs[n] = ref; + polys[n] = &tile->polys[node->i]; + + if (n == batchSize - 1) + { + query->process(tile, polys, polyRefs, batchSize); + n = 0; + } + else + { + n++; + } } } - + if (overlap || isLeafNode) node++; else @@ -833,17 +852,14 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi node += escapeIndex; } } - - return n; } else { float bmin[3], bmax[3]; - int n = 0; const dtPolyRef base = m_nav->getPolyRefBase(tile); for (int i = 0; i < tile->header->polyCount; ++i) { - const dtPoly* p = &tile->polys[i]; + dtPoly* p = &tile->polys[i]; // Do not return off-mesh connection polygons. if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) continue; @@ -861,16 +877,63 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi dtVmin(bmin, v); dtVmax(bmax, v); } - if (dtOverlapBounds(qmin,qmax, bmin,bmax)) + if (dtOverlapBounds(qmin, qmax, bmin, bmax)) { - if (n < maxPolys) - polys[n++] = ref; + polyRefs[n] = ref; + polys[n] = p; + + if (n == batchSize - 1) + { + query->process(tile, polys, polyRefs, batchSize); + n = 0; + } + else + { + n++; + } } } - return n; } + + // Process the last polygons that didn't make a full batch. + if (n > 0) + query->process(tile, polys, polyRefs, n); } +class dtCollectPolysQuery : public dtPolyQuery +{ + dtPolyRef* m_polys; + const int m_maxPolys; + int m_numCollected; + bool m_overflow; + +public: + dtCollectPolysQuery(dtPolyRef* polys, const int maxPolys) + : m_polys(polys), m_maxPolys(maxPolys), m_numCollected(0), m_overflow(false) + { + } + + int numCollected() const { return m_numCollected; } + bool overflowed() const { return m_overflow; } + + void process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count) + { + dtIgnoreUnused(tile); + dtIgnoreUnused(polys); + + int numLeft = m_maxPolys - m_numCollected; + int toCopy = count; + if (toCopy > numLeft) + { + m_overflow = true; + toCopy = numLeft; + } + + memcpy(m_polys + m_numCollected, refs, (size_t)toCopy * sizeof(dtPolyRef)); + m_numCollected += toCopy; + } +}; + /// @par /// /// If no polygons are found, the function will return #DT_SUCCESS with a @@ -880,15 +943,41 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi /// be filled to capacity. The method of choosing which polygons from the /// full set are included in the partial result set is undefined. /// -dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* extents, +dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* polys, int* polyCount, const int maxPolys) const +{ + if (!polys || !polyCount || maxPolys < 0) + return DT_FAILURE | DT_INVALID_PARAM; + + dtCollectPolysQuery collector(polys, maxPolys); + + dtStatus status = queryPolygons(center, halfExtents, filter, &collector); + if (dtStatusFailed(status)) + return status; + + *polyCount = collector.numCollected(); + return collector.overflowed() ? DT_SUCCESS | DT_BUFFER_TOO_SMALL : DT_SUCCESS; +} + +/// @par +/// +/// The query will be invoked with batches of polygons. Polygons passed +/// to the query have bounding boxes that overlap with the center and halfExtents +/// passed to this function. The dtPolyQuery::process function is invoked multiple +/// times until all overlapping polygons have been processed. +/// +dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* halfExtents, + const dtQueryFilter* filter, dtPolyQuery* query) const { dtAssert(m_nav); - + + if (!center || !halfExtents || !filter || !query) + return DT_FAILURE | DT_INVALID_PARAM; + float bmin[3], bmax[3]; - dtVsub(bmin, center, extents); - dtVadd(bmax, center, extents); + dtVsub(bmin, center, halfExtents); + dtVadd(bmax, center, halfExtents); // Find tiles the query touches. int minx, miny, maxx, maxy; @@ -898,7 +987,6 @@ dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* extents static const int MAX_NEIS = 32; const dtMeshTile* neis[MAX_NEIS]; - int n = 0; for (int y = miny; y <= maxy; ++y) { for (int x = minx; x <= maxx; ++x) @@ -906,16 +994,10 @@ dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* extents const int nneis = m_nav->getTilesAt(x,y,neis,MAX_NEIS); for (int j = 0; j < nneis; ++j) { - n += queryPolygonsInTile(neis[j], bmin, bmax, filter, polys+n, maxPolys-n); - if (n >= maxPolys) - { - *polyCount = n; - return DT_SUCCESS | DT_BUFFER_TOO_SMALL; - } + queryPolygonsInTile(neis[j], bmin, bmax, filter, query); } } } - *polyCount = n; return DT_SUCCESS; } @@ -940,18 +1022,14 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, dtAssert(m_nodePool); dtAssert(m_openList); - *pathCount = 0; - - if (!startRef || !endRef) - return DT_FAILURE | DT_INVALID_PARAM; - - if (!maxPath) - return DT_FAILURE | DT_INVALID_PARAM; + if (pathCount) + *pathCount = 0; // Validate input - if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef)) + if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) || + !startPos || !endPos || !filter || maxPath <= 0 || !path || !pathCount) return DT_FAILURE | DT_INVALID_PARAM; - + if (startRef == endRef) { path[0] = startRef; @@ -974,7 +1052,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, dtNode* lastBestNode = startNode; float lastBestNodeCost = startNode->total; - dtStatus status = DT_SUCCESS; + bool outOfNodes = false; while (!m_openList->empty()) { @@ -1032,7 +1110,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide); if (!neighbourNode) { - status |= DT_OUT_OF_NODES; + outOfNodes = true; continue; } @@ -1111,42 +1189,59 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, } } } - + + dtStatus status = getPathToNode(lastBestNode, path, pathCount, maxPath); + if (lastBestNode->id != endRef) status |= DT_PARTIAL_RESULT; - - // Reverse the path. - dtNode* prev = 0; - dtNode* node = lastBestNode; - do - { - dtNode* next = m_nodePool->getNodeAtIdx(node->pidx); - node->pidx = m_nodePool->getNodeIdx(prev); - prev = node; - node = next; - } - while (node); - - // Store path - node = prev; - int n = 0; - do - { - path[n++] = node->id; - if (n >= maxPath) - { - status |= DT_BUFFER_TOO_SMALL; - break; - } - node = m_nodePool->getNodeAtIdx(node->pidx); - } - while (node); - - *pathCount = n; + + if (outOfNodes) + status |= DT_OUT_OF_NODES; return status; } +dtStatus dtNavMeshQuery::getPathToNode(dtNode* endNode, dtPolyRef* path, int* pathCount, int maxPath) const +{ + // Find the length of the entire path. + dtNode* curNode = endNode; + int length = 0; + do + { + length++; + curNode = m_nodePool->getNodeAtIdx(curNode->pidx); + } while (curNode); + + // If the path cannot be fully stored then advance to the last node we will be able to store. + curNode = endNode; + int writeCount; + for (writeCount = length; writeCount > maxPath; writeCount--) + { + dtAssert(curNode); + + curNode = m_nodePool->getNodeAtIdx(curNode->pidx); + } + + // Write path + for (int i = writeCount - 1; i >= 0; i--) + { + dtAssert(curNode); + + path[i] = curNode->id; + curNode = m_nodePool->getNodeAtIdx(curNode->pidx); + } + + dtAssert(!curNode); + + *pathCount = dtMin(length, maxPath); + + if (length > maxPath) + return DT_SUCCESS | DT_BUFFER_TOO_SMALL; + + return DT_SUCCESS; +} + + /// @par /// /// @warning Calling any non-slice methods before calling finalizeSlicedFindPath() @@ -1639,10 +1734,17 @@ dtStatus dtNavMeshQuery::appendVertex(const float* pos, const unsigned char flag if (straightPathRefs) straightPathRefs[(*straightPathCount)] = ref; (*straightPathCount)++; - // If reached end of path or there is no space to append more vertices, return. - if (flags == DT_STRAIGHTPATH_END || (*straightPathCount) >= maxStraightPath) + + // If there is no space to append more vertices, return. + if ((*straightPathCount) >= maxStraightPath) { - return DT_SUCCESS | (((*straightPathCount) >= maxStraightPath) ? DT_BUFFER_TOO_SMALL : 0); + return DT_SUCCESS | DT_BUFFER_TOO_SMALL; + } + + // If reached end of path, return. + if (flags == DT_STRAIGHTPATH_END) + { + return DT_SUCCESS; } } return DT_IN_PROGRESS; @@ -1767,10 +1869,12 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en for (int i = 0; i < pathSize; ++i) { float left[3], right[3]; - unsigned char fromType, toType; + unsigned char toType; if (i+1 < pathSize) { + unsigned char fromType; // fromType is ignored. + // Next portal. if (dtStatusFailed(getPortalPoints(path[i], path[i+1], left, right, fromType, toType))) { @@ -1786,12 +1890,14 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en // Apeend portals along the current straight path segment. if (options & (DT_STRAIGHTPATH_AREA_CROSSINGS | DT_STRAIGHTPATH_ALL_CROSSINGS)) { - stat = appendPortals(apexIndex, i, closestEndPos, path, + // Ignore status return value as we're just about to return anyway. + appendPortals(apexIndex, i, closestEndPos, path, straightPath, straightPathFlags, straightPathRefs, straightPathCount, maxStraightPath, options); } - stat = appendVertex(closestEndPos, 0, path[i], + // Ignore status return value as we're just about to return anyway. + appendVertex(closestEndPos, 0, path[i], straightPath, straightPathFlags, straightPathRefs, straightPathCount, maxStraightPath); @@ -1812,7 +1918,7 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en dtVcopy(left, closestEndPos); dtVcopy(right, closestEndPos); - fromType = toType = DT_POLYTYPE_GROUND; + toType = DT_POLYTYPE_GROUND; } // Right vertex. @@ -1929,7 +2035,8 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en } } - stat = appendVertex(closestEndPos, DT_STRAIGHTPATH_END, 0, + // Ignore status return value as we're just about to return anyway. + appendVertex(closestEndPos, DT_STRAIGHTPATH_END, 0, straightPath, straightPathFlags, straightPathRefs, straightPathCount, maxStraightPath); @@ -2400,10 +2507,10 @@ dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, cons const dtMeshTile* prevTile, *tile, *nextTile; const dtPoly* prevPoly, *poly, *nextPoly; - dtPolyRef curRef, nextRef; + dtPolyRef curRef; // The API input has been checked already, skip checking internal data. - nextRef = curRef = startRef; + curRef = startRef; tile = 0; poly = 0; m_nav->getTileAndPolyByRefUnsafe(curRef, &tile, &poly); @@ -2458,7 +2565,7 @@ dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, cons } // Follow neighbours. - nextRef = 0; + dtPolyRef nextRef = 0; for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = tile->links[i].next) { @@ -2649,20 +2756,6 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* dtStatus status = DT_SUCCESS; int n = 0; - if (n < maxResult) - { - if (resultRef) - resultRef[n] = startNode->id; - if (resultParent) - resultParent[n] = 0; - if (resultCost) - resultCost[n] = 0; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } const float radiusSqr = dtSqr(radius); @@ -2687,6 +2780,21 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* parentRef = m_nodePool->getNodeAtIdx(bestNode->pidx)->id; if (parentRef) m_nav->getTileAndPolyByRefUnsafe(parentRef, &parentTile, &parentPoly); + + if (n < maxResult) + { + if (resultRef) + resultRef[n] = bestRef; + if (resultParent) + resultParent[n] = parentRef; + if (resultCost) + resultCost[n] = bestNode->total; + ++n; + } + else + { + status |= DT_BUFFER_TOO_SMALL; + } for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestTile->links[i].next) { @@ -2730,14 +2838,19 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* if (neighbourNode->flags == 0) dtVlerp(neighbourNode->pos, va, vb, 0.5f); - const float total = bestNode->total + dtVdist(bestNode->pos, neighbourNode->pos); + float cost = filter->getCost( + bestNode->pos, neighbourNode->pos, + parentRef, parentTile, parentPoly, + bestRef, bestTile, bestPoly, + neighbourRef, neighbourTile, neighbourPoly); + + const float total = bestNode->total + cost; // The node is already in open list and the new result is worse, skip. if ((neighbourNode->flags & DT_NODE_OPEN) && total >= neighbourNode->total) continue; neighbourNode->id = neighbourRef; - neighbourNode->flags = (neighbourNode->flags & ~DT_NODE_CLOSED); neighbourNode->pidx = m_nodePool->getNodeIdx(bestNode); neighbourNode->total = total; @@ -2747,20 +2860,6 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* } else { - if (n < maxResult) - { - if (resultRef) - resultRef[n] = neighbourNode->id; - if (resultParent) - resultParent[n] = m_nodePool->getNodeAtIdx(neighbourNode->pidx)->id; - if (resultCost) - resultCost[n] = neighbourNode->total; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } neighbourNode->flags = DT_NODE_OPEN; m_openList->push(neighbourNode); } @@ -2829,20 +2928,6 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v dtStatus status = DT_SUCCESS; int n = 0; - if (n < maxResult) - { - if (resultRef) - resultRef[n] = startNode->id; - if (resultParent) - resultParent[n] = 0; - if (resultCost) - resultCost[n] = 0; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } while (!m_openList->empty()) { @@ -2865,6 +2950,22 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v parentRef = m_nodePool->getNodeAtIdx(bestNode->pidx)->id; if (parentRef) m_nav->getTileAndPolyByRefUnsafe(parentRef, &parentTile, &parentPoly); + + if (n < maxResult) + { + if (resultRef) + resultRef[n] = bestRef; + if (resultParent) + resultParent[n] = parentRef; + if (resultCost) + resultCost[n] = bestNode->total; + + ++n; + } + else + { + status |= DT_BUFFER_TOO_SMALL; + } for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestTile->links[i].next) { @@ -2910,14 +3011,19 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v if (neighbourNode->flags == 0) dtVlerp(neighbourNode->pos, va, vb, 0.5f); - const float total = bestNode->total + dtVdist(bestNode->pos, neighbourNode->pos); + float cost = filter->getCost( + bestNode->pos, neighbourNode->pos, + parentRef, parentTile, parentPoly, + bestRef, bestTile, bestPoly, + neighbourRef, neighbourTile, neighbourPoly); + + const float total = bestNode->total + cost; // The node is already in open list and the new result is worse, skip. if ((neighbourNode->flags & DT_NODE_OPEN) && total >= neighbourNode->total) continue; neighbourNode->id = neighbourRef; - neighbourNode->flags = (neighbourNode->flags & ~DT_NODE_CLOSED); neighbourNode->pidx = m_nodePool->getNodeIdx(bestNode); neighbourNode->total = total; @@ -2927,20 +3033,6 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v } else { - if (n < maxResult) - { - if (resultRef) - resultRef[n] = neighbourNode->id; - if (resultParent) - resultParent[n] = m_nodePool->getNodeAtIdx(neighbourNode->pidx)->id; - if (resultCost) - resultCost[n] = neighbourNode->total; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } neighbourNode->flags = DT_NODE_OPEN; m_openList->push(neighbourNode); } @@ -2952,6 +3044,21 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v return status; } +dtStatus dtNavMeshQuery::getPathFromDijkstraSearch(dtPolyRef endRef, dtPolyRef* path, int* pathCount, int maxPath) const +{ + if (!m_nav->isValidPolyRef(endRef) || !path || !pathCount || maxPath < 0) + return DT_FAILURE | DT_INVALID_PARAM; + + *pathCount = 0; + + dtNode* endNode; + if (m_nodePool->findNodes(endRef, &endNode, 1) != 1 || + (endNode->flags & DT_NODE_CLOSED) == 0) + return DT_FAILURE | DT_INVALID_PARAM; + + return getPathToNode(endNode, path, pathCount, maxPath); +} + /// @par /// /// This method is optimized for a small search radius and small number of result diff --git a/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h b/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h index 2a2003b16..952050878 100644 --- a/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h +++ b/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h @@ -217,7 +217,7 @@ class dtCrowd dtPolyRef* m_pathResult; int m_maxPathResult; - float m_ext[3]; + float m_agentPlacementHalfExtents[3]; dtQueryFilter m_filters[DT_CROWD_MAX_QUERY_FILTER_TYPE]; @@ -325,9 +325,13 @@ public: /// @return The filter used by the crowd. inline dtQueryFilter* getEditableFilter(const int i) { return (i >= 0 && i < DT_CROWD_MAX_QUERY_FILTER_TYPE) ? &m_filters[i] : 0; } - /// Gets the search extents [(x, y, z)] used by the crowd for query operations. - /// @return The search extents used by the crowd. [(x, y, z)] - const float* getQueryExtents() const { return m_ext; } + /// Gets the search halfExtents [(x, y, z)] used by the crowd for query operations. + /// @return The search halfExtents used by the crowd. [(x, y, z)] + const float* getQueryHalfExtents() const { return m_agentPlacementHalfExtents; } + + /// Same as getQueryHalfExtents. Left to maintain backwards compatibility. + /// @return The search halfExtents used by the crowd. [(x, y, z)] + const float* getQueryExtents() const { return m_agentPlacementHalfExtents; } /// Gets the velocity sample count. /// @return The velocity sample count. @@ -453,3 +457,4 @@ A higher value will result in agents trying to stay farther away from each other the cost of more difficult steering in tight spaces. */ + diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp index f9f436077..1e76e40ce 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp @@ -386,7 +386,8 @@ bool dtCrowd::init(const int maxAgents, const float maxAgentRadius, dtNavMesh* n m_maxAgents = maxAgents; m_maxAgentRadius = maxAgentRadius; - dtVset(m_ext, m_maxAgentRadius*2.0f,m_maxAgentRadius*1.5f,m_maxAgentRadius*2.0f); + // Larger than agent radius because it is also used for agent recovery. + dtVset(m_agentPlacementHalfExtents, m_maxAgentRadius*2.0f, m_maxAgentRadius*1.5f, m_maxAgentRadius*2.0f); m_grid = dtAllocProximityGrid(); if (!m_grid) @@ -531,7 +532,7 @@ int dtCrowd::addAgent(const float* pos, const dtCrowdAgentParams* params) float nearest[3]; dtPolyRef ref = 0; dtVcopy(nearest, pos); - dtStatus status = m_navquery->findNearestPoly(pos, m_ext, &m_filters[ag->params.queryFilterType], &ref, nearest); + dtStatus status = m_navquery->findNearestPoly(pos, m_agentPlacementHalfExtents, &m_filters[ag->params.queryFilterType], &ref, nearest); if (dtStatusFailed(status)) { dtVcopy(nearest, pos); @@ -965,7 +966,7 @@ void dtCrowd::checkPathValidity(dtCrowdAgent** agents, const int nagents, const float nearest[3]; dtVcopy(nearest, agentPos); agentRef = 0; - m_navquery->findNearestPoly(ag->npos, m_ext, &m_filters[ag->params.queryFilterType], &agentRef, nearest); + m_navquery->findNearestPoly(ag->npos, m_agentPlacementHalfExtents, &m_filters[ag->params.queryFilterType], &agentRef, nearest); dtVcopy(agentPos, nearest); if (!agentRef) @@ -1001,7 +1002,7 @@ void dtCrowd::checkPathValidity(dtCrowdAgent** agents, const int nagents, const float nearest[3]; dtVcopy(nearest, ag->targetPos); ag->targetRef = 0; - m_navquery->findNearestPoly(ag->targetPos, m_ext, &m_filters[ag->params.queryFilterType], &ag->targetRef, nearest); + m_navquery->findNearestPoly(ag->targetPos, m_agentPlacementHalfExtents, &m_filters[ag->params.queryFilterType], &ag->targetRef, nearest); dtVcopy(ag->targetPos, nearest); replan = true; } diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp index 8466c813a..94f7df6ad 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp @@ -207,6 +207,9 @@ void dtFreeObstacleAvoidanceQuery(dtObstacleAvoidanceQuery* ptr) dtObstacleAvoidanceQuery::dtObstacleAvoidanceQuery() : + m_invHorizTime(0), + m_vmax(0), + m_invVmax(0), m_maxCircles(0), m_circles(0), m_ncircles(0), diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp index 54a2ab8b8..e54d4637d 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp @@ -431,7 +431,7 @@ Behavior: - The new position will be located in the adjusted corridor's first polygon. The expected use case is that the desired position will be 'near' the current corridor. What is considered 'near' -depends on local polygon density, query search extents, etc. +depends on local polygon density, query search half extents, etc. The resulting position will differ from the desired position if the desired position is not on the navigation mesh, or it can't be reached using a local search. @@ -470,7 +470,7 @@ Behavior: - The corridor is automatically adjusted (shorted or lengthened) in order to remain valid. - The new target will be located in the adjusted corridor's last polygon. -The expected use case is that the desired target will be 'near' the current corridor. What is considered 'near' depends on local polygon density, query search extents, etc. +The expected use case is that the desired target will be 'near' the current corridor. What is considered 'near' depends on local polygon density, query search half extents, etc. The resulting target will differ from the desired target if the desired target is not on the navigation mesh, or it can't be reached using a local search. */ diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp index 7af8efa01..fc1e2e136 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp @@ -48,6 +48,7 @@ inline int hashPos2(int x, int y, int n) dtProximityGrid::dtProximityGrid() : m_cellSize(0), + m_invCellSize(0), m_pool(0), m_poolHead(0), m_poolSize(0), diff --git a/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h b/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h index 9c7e01c35..75713366d 100644 --- a/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h +++ b/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h @@ -35,13 +35,47 @@ enum ObstacleState DT_OBSTACLE_REMOVING, }; +enum ObstacleType +{ + DT_OBSTACLE_CYLINDER, + DT_OBSTACLE_BOX, // AABB + DT_OBSTACLE_ORIENTED_BOX, // OBB +}; + +struct dtObstacleCylinder +{ + float pos[ 3 ]; + float radius; + float height; +}; + +struct dtObstacleBox +{ + float bmin[ 3 ]; + float bmax[ 3 ]; +}; + +struct dtObstacleOrientedBox +{ + float center[ 3 ]; + float halfExtents[ 3 ]; + float rotAux[ 2 ]; //{ cos(0.5f*angle)*sin(-0.5f*angle); cos(0.5f*angle)*cos(0.5f*angle) - 0.5 } +}; + static const int DT_MAX_TOUCHED_TILES = 8; struct dtTileCacheObstacle { - float pos[3], radius, height; + union + { + dtObstacleCylinder cylinder; + dtObstacleBox box; + dtObstacleOrientedBox orientedBox; + }; + dtCompressedTileRef touched[DT_MAX_TOUCHED_TILES]; dtCompressedTileRef pending[DT_MAX_TOUCHED_TILES]; unsigned short salt; + unsigned char type; unsigned char state; unsigned char ntouched; unsigned char npending; @@ -105,13 +139,27 @@ public: dtStatus removeTile(dtCompressedTileRef ref, unsigned char** data, int* dataSize); + // Cylinder obstacle. dtStatus addObstacle(const float* pos, const float radius, const float height, dtObstacleRef* result); + + // Aabb obstacle. + dtStatus addBoxObstacle(const float* bmin, const float* bmax, dtObstacleRef* result); + + // Box obstacle: can be rotated in Y. + dtStatus addBoxObstacle(const float* center, const float* halfExtents, const float yRadians, dtObstacleRef* result); + dtStatus removeObstacle(const dtObstacleRef ref); dtStatus queryTiles(const float* bmin, const float* bmax, dtCompressedTileRef* results, int* resultCount, const int maxResults) const; - dtStatus update(const float /*dt*/, class dtNavMesh* navmesh); + /// Updates the tile cache by rebuilding tiles touched by unfinished obstacle requests. + /// @param[in] dt The time step size. Currently not used. + /// @param[in] navmesh The mesh to affect when rebuilding tiles. + /// @param[out] upToDate Whether the tile cache is fully up to date with obstacle requests and tile rebuilds. + /// If the tile cache is up to date another (immediate) call to update will have no effect; + /// otherwise another call will continue processing obstacle requests and tile rebuilds. + dtStatus update(const float dt, class dtNavMesh* navmesh, bool* upToDate = 0); dtStatus buildNavMeshTilesAt(const int tx, const int ty, class dtNavMesh* navmesh); diff --git a/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h b/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h index 854183c91..ff6109193 100644 --- a/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h +++ b/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h @@ -127,6 +127,12 @@ void dtFreeTileCachePolyMesh(dtTileCacheAlloc* alloc, dtTileCachePolyMesh* lmesh dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, const float* pos, const float radius, const float height, const unsigned char areaId); +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* bmin, const float* bmax, const unsigned char areaId); + +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* center, const float* halfExtents, const float* rotAux, const unsigned char areaId); + dtStatus dtBuildTileCacheRegions(dtTileCacheAlloc* alloc, dtTileCacheLayer& layer, const int walkableClimb); diff --git a/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp b/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp index 9d8fac2ce..a82cd1350 100644 --- a/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp +++ b/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp @@ -77,6 +77,7 @@ dtTileCache::dtTileCache() : m_nupdate(0) { memset(&m_params, 0, sizeof(m_params)); + memset(m_reqs, 0, sizeof(ObstacleRequest) * MAX_REQUESTS); } dtTileCache::~dtTileCache() @@ -369,9 +370,10 @@ dtStatus dtTileCache::addObstacle(const float* pos, const float radius, const fl memset(ob, 0, sizeof(dtTileCacheObstacle)); ob->salt = salt; ob->state = DT_OBSTACLE_PROCESSING; - dtVcopy(ob->pos, pos); - ob->radius = radius; - ob->height = height; + ob->type = DT_OBSTACLE_CYLINDER; + dtVcopy(ob->cylinder.pos, pos); + ob->cylinder.radius = radius; + ob->cylinder.height = height; ObstacleRequest* req = &m_reqs[m_nreqs++]; memset(req, 0, sizeof(ObstacleRequest)); @@ -384,6 +386,79 @@ dtStatus dtTileCache::addObstacle(const float* pos, const float radius, const fl return DT_SUCCESS; } +dtStatus dtTileCache::addBoxObstacle(const float* bmin, const float* bmax, dtObstacleRef* result) +{ + if (m_nreqs >= MAX_REQUESTS) + return DT_FAILURE | DT_BUFFER_TOO_SMALL; + + dtTileCacheObstacle* ob = 0; + if (m_nextFreeObstacle) + { + ob = m_nextFreeObstacle; + m_nextFreeObstacle = ob->next; + ob->next = 0; + } + if (!ob) + return DT_FAILURE | DT_OUT_OF_MEMORY; + + unsigned short salt = ob->salt; + memset(ob, 0, sizeof(dtTileCacheObstacle)); + ob->salt = salt; + ob->state = DT_OBSTACLE_PROCESSING; + ob->type = DT_OBSTACLE_BOX; + dtVcopy(ob->box.bmin, bmin); + dtVcopy(ob->box.bmax, bmax); + + ObstacleRequest* req = &m_reqs[m_nreqs++]; + memset(req, 0, sizeof(ObstacleRequest)); + req->action = REQUEST_ADD; + req->ref = getObstacleRef(ob); + + if (result) + *result = req->ref; + + return DT_SUCCESS; +} + +dtStatus dtTileCache::addBoxObstacle(const float* center, const float* halfExtents, const float yRadians, dtObstacleRef* result) +{ + if (m_nreqs >= MAX_REQUESTS) + return DT_FAILURE | DT_BUFFER_TOO_SMALL; + + dtTileCacheObstacle* ob = 0; + if (m_nextFreeObstacle) + { + ob = m_nextFreeObstacle; + m_nextFreeObstacle = ob->next; + ob->next = 0; + } + if (!ob) + return DT_FAILURE | DT_OUT_OF_MEMORY; + + unsigned short salt = ob->salt; + memset(ob, 0, sizeof(dtTileCacheObstacle)); + ob->salt = salt; + ob->state = DT_OBSTACLE_PROCESSING; + ob->type = DT_OBSTACLE_ORIENTED_BOX; + dtVcopy(ob->orientedBox.center, center); + dtVcopy(ob->orientedBox.halfExtents, halfExtents); + + float coshalf= cosf(0.5f*yRadians); + float sinhalf = sinf(-0.5f*yRadians); + ob->orientedBox.rotAux[0] = coshalf*sinhalf; + ob->orientedBox.rotAux[1] = coshalf*coshalf - 0.5f; + + ObstacleRequest* req = &m_reqs[m_nreqs++]; + memset(req, 0, sizeof(ObstacleRequest)); + req->action = REQUEST_ADD; + req->ref = getObstacleRef(ob); + + if (result) + *result = req->ref; + + return DT_SUCCESS; +} + dtStatus dtTileCache::removeObstacle(const dtObstacleRef ref) { if (!ref) @@ -440,7 +515,8 @@ dtStatus dtTileCache::queryTiles(const float* bmin, const float* bmax, return DT_SUCCESS; } -dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh) +dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh, + bool* upToDate) { if (m_nupdate == 0) { @@ -499,12 +575,13 @@ dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh) m_nreqs = 0; } + dtStatus status = DT_SUCCESS; // Process updates if (m_nupdate) { // Build mesh const dtCompressedTileRef ref = m_update[0]; - dtStatus status = buildNavMeshTile(ref, navmesh); + status = buildNavMeshTile(ref, navmesh); m_nupdate--; if (m_nupdate > 0) memmove(m_update, m_update+1, m_nupdate*sizeof(dtCompressedTileRef)); @@ -547,12 +624,12 @@ dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh) } } } - - if (dtStatusFailed(status)) - return status; } - return DT_SUCCESS; + if (upToDate) + *upToDate = m_nupdate == 0 && m_nreqs == 0; + + return status; } @@ -604,8 +681,21 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh* continue; if (contains(ob->touched, ob->ntouched, ref)) { - dtMarkCylinderArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, - ob->pos, ob->radius, ob->height, 0); + if (ob->type == DT_OBSTACLE_CYLINDER) + { + dtMarkCylinderArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, + ob->cylinder.pos, ob->cylinder.radius, ob->cylinder.height, 0); + } + else if (ob->type == DT_OBSTACLE_BOX) + { + dtMarkBoxArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, + ob->box.bmin, ob->box.bmax, 0); + } + else if (ob->type == DT_OBSTACLE_ORIENTED_BOX) + { + dtMarkBoxArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, + ob->orientedBox.center, ob->orientedBox.halfExtents, ob->orientedBox.rotAux, 0); + } } } @@ -616,7 +706,7 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh* bc.lcset = dtAllocTileCacheContourSet(m_talloc); if (!bc.lcset) - return status; + return DT_FAILURE | DT_OUT_OF_MEMORY; status = dtBuildTileCacheContours(m_talloc, *bc.layer, walkableClimbVx, m_params.maxSimplificationError, *bc.lcset); if (dtStatusFailed(status)) @@ -624,7 +714,7 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh* bc.lmesh = dtAllocTileCachePolyMesh(m_talloc); if (!bc.lmesh) - return status; + return DT_FAILURE | DT_OUT_OF_MEMORY; status = dtBuildTileCachePolyMesh(m_talloc, *bc.lcset, *bc.lmesh); if (dtStatusFailed(status)) return status; @@ -699,10 +789,32 @@ void dtTileCache::calcTightTileBounds(const dtTileCacheLayerHeader* header, floa void dtTileCache::getObstacleBounds(const struct dtTileCacheObstacle* ob, float* bmin, float* bmax) const { - bmin[0] = ob->pos[0] - ob->radius; - bmin[1] = ob->pos[1]; - bmin[2] = ob->pos[2] - ob->radius; - bmax[0] = ob->pos[0] + ob->radius; - bmax[1] = ob->pos[1] + ob->height; - bmax[2] = ob->pos[2] + ob->radius; + if (ob->type == DT_OBSTACLE_CYLINDER) + { + const dtObstacleCylinder &cl = ob->cylinder; + + bmin[0] = cl.pos[0] - cl.radius; + bmin[1] = cl.pos[1]; + bmin[2] = cl.pos[2] - cl.radius; + bmax[0] = cl.pos[0] + cl.radius; + bmax[1] = cl.pos[1] + cl.height; + bmax[2] = cl.pos[2] + cl.radius; + } + else if (ob->type == DT_OBSTACLE_BOX) + { + dtVcopy(bmin, ob->box.bmin); + dtVcopy(bmax, ob->box.bmax); + } + else if (ob->type == DT_OBSTACLE_ORIENTED_BOX) + { + const dtObstacleOrientedBox &orientedBox = ob->orientedBox; + + float maxr = 1.41f*dtMax(orientedBox.halfExtents[0], orientedBox.halfExtents[2]); + bmin[0] = orientedBox.center[0] - maxr; + bmax[0] = orientedBox.center[0] + maxr; + bmin[1] = orientedBox.center[1] - orientedBox.halfExtents[1]; + bmax[1] = orientedBox.center[1] + orientedBox.halfExtents[1]; + bmin[2] = orientedBox.center[2] - maxr; + bmax[2] = orientedBox.center[2] + maxr; + } } diff --git a/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp b/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp index 2c82cf0a9..1bbbcc483 100644 --- a/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp +++ b/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp @@ -29,9 +29,7 @@ template class dtFixedArray dtTileCacheAlloc* m_alloc; T* m_ptr; const int m_size; - inline T* operator=(T* p); inline void operator=(dtFixedArray& p); - inline dtFixedArray(); public: inline dtFixedArray(dtTileCacheAlloc* a, const int s) : m_alloc(a), m_ptr((T*)a->alloc(sizeof(T)*s)), m_size(s) {} inline ~dtFixedArray() { if (m_alloc) m_alloc->free(m_ptr); } @@ -2004,6 +2002,98 @@ dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const fl return DT_SUCCESS; } +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* bmin, const float* bmax, const unsigned char areaId) +{ + const int w = (int)layer.header->width; + const int h = (int)layer.header->height; + const float ics = 1.0f/cs; + const float ich = 1.0f/ch; + + int minx = (int)floorf((bmin[0]-orig[0])*ics); + int miny = (int)floorf((bmin[1]-orig[1])*ich); + int minz = (int)floorf((bmin[2]-orig[2])*ics); + int maxx = (int)floorf((bmax[0]-orig[0])*ics); + int maxy = (int)floorf((bmax[1]-orig[1])*ich); + int maxz = (int)floorf((bmax[2]-orig[2])*ics); + + if (maxx < 0) return DT_SUCCESS; + if (minx >= w) return DT_SUCCESS; + if (maxz < 0) return DT_SUCCESS; + if (minz >= h) return DT_SUCCESS; + + if (minx < 0) minx = 0; + if (maxx >= w) maxx = w-1; + if (minz < 0) minz = 0; + if (maxz >= h) maxz = h-1; + + for (int z = minz; z <= maxz; ++z) + { + for (int x = minx; x <= maxx; ++x) + { + const int y = layer.heights[x+z*w]; + if (y < miny || y > maxy) + continue; + layer.areas[x+z*w] = areaId; + } + } + + return DT_SUCCESS; +} + +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* center, const float* halfExtents, const float* rotAux, const unsigned char areaId) +{ + const int w = (int)layer.header->width; + const int h = (int)layer.header->height; + const float ics = 1.0f/cs; + const float ich = 1.0f/ch; + + float cx = (center[0] - orig[0])*ics; + float cz = (center[2] - orig[2])*ics; + + float maxr = 1.41f*dtMax(halfExtents[0], halfExtents[2]); + int minx = (int)floorf(cx - maxr*ics); + int maxx = (int)floorf(cx + maxr*ics); + int minz = (int)floorf(cz - maxr*ics); + int maxz = (int)floorf(cz + maxr*ics); + int miny = (int)floorf((center[1]-halfExtents[1]-orig[1])*ich); + int maxy = (int)floorf((center[1]+halfExtents[1]-orig[1])*ich); + + if (maxx < 0) return DT_SUCCESS; + if (minx >= w) return DT_SUCCESS; + if (maxz < 0) return DT_SUCCESS; + if (minz >= h) return DT_SUCCESS; + + if (minx < 0) minx = 0; + if (maxx >= w) maxx = w-1; + if (minz < 0) minz = 0; + if (maxz >= h) maxz = h-1; + + float xhalf = halfExtents[0]*ics + 0.5f; + float zhalf = halfExtents[2]*ics + 0.5f; + + for (int z = minz; z <= maxz; ++z) + { + for (int x = minx; x <= maxx; ++x) + { + float x2 = 2.0f*(float(x) - cx); + float z2 = 2.0f*(float(z) - cz); + float xrot = rotAux[1]*x2 + rotAux[0]*z2; + if (xrot > xhalf || xrot < -xhalf) + continue; + float zrot = rotAux[1]*z2 - rotAux[0]*x2; + if (zrot > zhalf || zrot < -zhalf) + continue; + const int y = layer.heights[x+z*w]; + if (y < miny || y > maxy) + continue; + layer.areas[x+z*w] = areaId; + } + } + + return DT_SUCCESS; +} dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp, dtTileCacheLayerHeader* header, @@ -2027,7 +2117,11 @@ dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp, const int bufferSize = gridSize*3; unsigned char* buffer = (unsigned char*)dtAlloc(bufferSize, DT_ALLOC_TEMP); if (!buffer) + { + dtFree(data); return DT_FAILURE | DT_OUT_OF_MEMORY; + } + memcpy(buffer, heights, gridSize); memcpy(buffer+gridSize, areas, gridSize); memcpy(buffer+gridSize*2, cons, gridSize); @@ -2038,7 +2132,11 @@ dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp, int compressedSize = 0; dtStatus status = comp->compress(buffer, bufferSize, compressed, maxCompressedSize, &compressedSize); if (dtStatusFailed(status)) + { + dtFree(buffer); + dtFree(data); return status; + } *outData = data; *outDataSize = headerSize + compressedSize; diff --git a/Engine/lib/recast/README.md b/Engine/lib/recast/README.md new file mode 100644 index 000000000..7db799636 --- /dev/null +++ b/Engine/lib/recast/README.md @@ -0,0 +1,89 @@ + +Recast & Detour +=============== + +[![Travis (Linux) Build Status](https://travis-ci.org/recastnavigation/recastnavigation.svg?branch=master)](https://travis-ci.org/recastnavigation/recastnavigation) +[![Appveyor (Windows) Build Status](https://ci.appveyor.com/api/projects/status/20w84u25b3f8h179/branch/master?svg=true)](https://ci.appveyor.com/project/recastnavigation/recastnavigation/branch/master) + +[![Issue Stats](http://www.issuestats.com/github/recastnavigation/recastnavigation/badge/pr?style=flat)](http://www.issuestats.com/github/recastnavigation/recastnavigation) +[![Issue Stats](http://www.issuestats.com/github/recastnavigation/recastnavigation/badge/issue?style=flat)](http://www.issuestats.com/github/recastnavigation/recastnavigation) + +![screenshot of a navmesh baked with the sample program](/RecastDemo/screenshot.png?raw=true) + +## Recast + +Recast is state of the art navigation mesh construction toolset for games. + +* It is automatic, which means that you can throw any level geometry at it and you will get robust mesh out +* It is fast which means swift turnaround times for level designers +* It is open source so it comes with full source and you can customize it to your heart's content. + +The Recast process starts with constructing a voxel mold from a level geometry +and then casting a navigation mesh over it. The process consists of three steps, +building the voxel mold, partitioning the mold into simple regions, peeling off +the regions as simple polygons. + +1. The voxel mold is build from the input triangle mesh by rasterizing the triangles into a multi-layer heightfield. Some simple filters are then applied to the mold to prune out locations where the character would not be able to move. +2. The walkable areas described by the mold are divided into simple overlayed 2D regions. The resulting regions have only one non-overlapping contour, which simplifies the final step of the process tremendously. +3. The navigation polygons are peeled off from the regions by first tracing the boundaries and then simplifying them. The resulting polygons are finally converted to convex polygons which makes them perfect for pathfinding and spatial reasoning about the level. + + +## Detour + +Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly. + +Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows you to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes. + + +## Recast Demo + +You can find a comprehensive demo project in RecastDemo folder. It is a kitchen sink demo containing all the functionality of the library. If you are new to Recast & Detour, check out [Sample_SoloMesh.cpp](/RecastDemo/Source/Sample_SoloMesh.cpp) to get started with building navmeshes and [NavMeshTesterTool.cpp](/RecastDemo/Source/NavMeshTesterTool.cpp) to see how Detour can be used to find paths. + +### Building RecastDemo + +RecastDemo uses [premake5](http://premake.github.io/) to build platform specific projects. Download it and make sure it's available on your path, or specify the path to it. + +#### Linux + +- Install SDl2 and its dependencies according to your distro's guidelines. +- run `premake5 gmake` from the `RecastDemo` folder. +- `cd Build/gmake` then `make` +- Run `RecastDemo\Bin\RecastDemo` + +#### OSX + +- Grab the latest SDL2 development library dmg from [here](https://www.libsdl.org/download-2.0.php) and place `SDL2.framework` in `/Library/Frameworks/` +- Navigate to the `RecastDemo` folder and run `premake5 xcode4` +- Open `Build/xcode4/recastnavigation.xcworkspace` +- Select the "RecastDemo" project in the left pane, go to the "BuildPhases" tab and expand "Link Binary With Libraries" +- Remove the existing entry for SDL2 (it should have a white box icon) and re-add it by hitting the plus, selecting "Add Other", and selecting `/Library/Frameworks/SDL2.framework`. It should now have a suitcase icon. +- Set the RecastDemo project as the target and build. + +#### Windows + +- Grab the latest SDL2 development library release from [here](https://www.libsdl.org/download-2.0.php) and unzip it `RecastDemo\Contrib`. Rename the SDL folder such that the path `RecastDemo\Contrib\SDL\lib\x86` is valid. +- Run `"premake5" vs2015` from the `RecastDemo` folder +- Open the solution, build, and run. + +### Running Unit tests + +- Follow the instructions to build RecastDemo above. Premake should generate another build target called "Tests". +- Build the "Tests" project. This will generate an executable named "Tests" in `RecastDemo/Bin/` +- Run the "Tests" executable. It will execute all the unit tests, indicate those that failed, and display a count of those that succeeded. + +## Integrating with your own project + +It is recommended to add the source directories `DebugUtils`, `Detour`, `DetourCrowd`, `DetourTileCache`, and `Recast` into your own project depending on which parts of the project you need. For example your level building tool could include `DebugUtils`, `Recast`, and `Detour`, and your game runtime could just include `Detour`. + +## Contributing + +See the [Contributing document](CONTRIBUTING.md) for guidelines for making contributions. + +## Discuss + +- Discuss Recast & Detour: http://groups.google.com/group/recastnavigation +- Development blog: http://digestingduck.blogspot.com/ + +## License + +Recast & Detour is licensed under ZLib license, see License.txt for more information. diff --git a/Engine/lib/recast/Recast/Include/Recast.h b/Engine/lib/recast/Recast/Include/Recast.h index 2adcdcb34..e85c0d2e2 100644 --- a/Engine/lib/recast/Recast/Include/Recast.h +++ b/Engine/lib/recast/Recast/Include/Recast.h @@ -293,6 +293,9 @@ struct rcSpanPool /// @ingroup recast struct rcHeightfield { + rcHeightfield(); + ~rcHeightfield(); + int width; ///< The width of the heightfield. (Along the x-axis in cell units.) int height; ///< The height of the heightfield. (Along the z-axis in cell units.) float bmin[3]; ///< The minimum bounds in world space. [(x, y, z)] @@ -302,6 +305,11 @@ struct rcHeightfield rcSpan** spans; ///< Heightfield of spans (width*height). rcSpanPool* pools; ///< Linked list of span pools. rcSpan* freelist; ///< The next free span. + +private: + // Explicitly-disabled copy constructor and copy assignment operator. + rcHeightfield(const rcHeightfield&); + rcHeightfield& operator=(const rcHeightfield&); }; /// Provides information on the content of a cell column in a compact heightfield. @@ -886,7 +894,7 @@ bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv, bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt, rcHeightfield& solid, const int flagMergeThr = 1); -/// Marks non-walkable spans as walkable if their maximum is within @p walkableClimp of a walkable neihbor. +/// Marks non-walkable spans as walkable if their maximum is within @p walkableClimp of a walkable neighbor. /// @ingroup recast /// @param[in,out] ctx The build context to use during the operation. /// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable. diff --git a/Engine/lib/recast/Recast/Include/RecastAlloc.h b/Engine/lib/recast/Recast/Include/RecastAlloc.h index f1608fb55..3cdd450d4 100644 --- a/Engine/lib/recast/Recast/Include/RecastAlloc.h +++ b/Engine/lib/recast/Recast/Include/RecastAlloc.h @@ -123,7 +123,6 @@ public: template class rcScopedDelete { T* ptr; - inline T* operator=(T* p); public: /// Constructs an instance with a null pointer. diff --git a/Engine/lib/recast/Recast/Include/RecastAssert.h b/Engine/lib/recast/Recast/Include/RecastAssert.h index 2aca0d9a1..e7cc10e49 100644 --- a/Engine/lib/recast/Recast/Include/RecastAssert.h +++ b/Engine/lib/recast/Recast/Include/RecastAssert.h @@ -23,11 +23,34 @@ // Feel free to change the file and include your own implementation instead. #ifdef NDEBUG + // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ -# define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) +# define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) + #else + +/// An assertion failure function. +// @param[in] expression asserted expression. +// @param[in] file Filename of the failed assertion. +// @param[in] line Line number of the failed assertion. +/// @see rcAssertFailSetCustom +typedef void (rcAssertFailFunc)(const char* expression, const char* file, int line); + +/// Sets the base custom assertion failure function to be used by Recast. +/// @param[in] assertFailFunc The function to be used in case of failure of #dtAssert +void rcAssertFailSetCustom(rcAssertFailFunc *assertFailFunc); + +/// Gets the base custom assertion failure function to be used by Recast. +rcAssertFailFunc* rcAssertFailGetCustom(); + # include -# define rcAssert assert +# define rcAssert(expression) \ + { \ + rcAssertFailFunc* failFunc = rcAssertFailGetCustom(); \ + if(failFunc == NULL) { assert(expression); } \ + else if(!(expression)) { (*failFunc)(#expression, __FILE__, __LINE__); } \ + } + #endif #endif // RECASTASSERT_H diff --git a/Engine/lib/recast/Recast/Source/Recast.cpp b/Engine/lib/recast/Recast/Source/Recast.cpp index 46bc8b781..8308d1973 100644 --- a/Engine/lib/recast/Recast/Source/Recast.cpp +++ b/Engine/lib/recast/Recast/Source/Recast.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "Recast.h" #include "RecastAlloc.h" #include "RecastAssert.h" @@ -72,23 +73,39 @@ void rcContext::log(const rcLogCategory category, const char* format, ...) rcHeightfield* rcAllocHeightfield() { - rcHeightfield* hf = (rcHeightfield*)rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM); - memset(hf, 0, sizeof(rcHeightfield)); - return hf; + return new (rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM)) rcHeightfield; +} + +rcHeightfield::rcHeightfield() + : width() + , height() + , bmin() + , bmax() + , cs() + , ch() + , spans() + , pools() + , freelist() +{ +} + +rcHeightfield::~rcHeightfield() +{ + // Delete span array. + rcFree(spans); + // Delete span pools. + while (pools) + { + rcSpanPool* next = pools->next; + rcFree(pools); + pools = next; + } } void rcFreeHeightField(rcHeightfield* hf) { if (!hf) return; - // Delete span array. - rcFree(hf->spans); - // Delete span pools. - while (hf->pools) - { - rcSpanPool* next = hf->pools->next; - rcFree(hf->pools); - hf->pools = next; - } + hf->~rcHeightfield(); rcFree(hf); } @@ -109,7 +126,6 @@ void rcFreeCompactHeightfield(rcCompactHeightfield* chf) rcFree(chf); } - rcHeightfieldLayerSet* rcAllocHeightfieldLayerSet() { rcHeightfieldLayerSet* lset = (rcHeightfieldLayerSet*)rcAlloc(sizeof(rcHeightfieldLayerSet), RC_ALLOC_PERM); @@ -245,11 +261,12 @@ static void calcTriNormal(const float* v0, const float* v1, const float* v2, flo /// /// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, - const float* verts, int /*nv*/, + const float* verts, int nv, const int* tris, int nt, unsigned char* areas) { rcIgnoreUnused(ctx); + rcIgnoreUnused(nv); const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI); diff --git a/Engine/lib/recast/Recast/Source/RecastAlloc.cpp b/Engine/lib/recast/Recast/Source/RecastAlloc.cpp index ee1039f2f..453b5fa6a 100644 --- a/Engine/lib/recast/Recast/Source/RecastAlloc.cpp +++ b/Engine/lib/recast/Recast/Source/RecastAlloc.cpp @@ -19,6 +19,7 @@ #include #include #include "RecastAlloc.h" +#include "RecastAssert.h" static void *rcAllocDefault(size_t size, rcAllocHint) { @@ -77,6 +78,7 @@ void rcIntArray::doResize(int n) if (!m_cap) m_cap = n; while (m_cap < n) m_cap *= 2; int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP); + rcAssert(newData); if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int)); rcFree(m_data); m_data = newData; diff --git a/Engine/lib/recast/Recast/Source/RecastAssert.cpp b/Engine/lib/recast/Recast/Source/RecastAssert.cpp new file mode 100644 index 000000000..6297d4202 --- /dev/null +++ b/Engine/lib/recast/Recast/Source/RecastAssert.cpp @@ -0,0 +1,35 @@ +// +// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// + +#include "RecastAssert.h" + +#ifndef NDEBUG + +static rcAssertFailFunc* sRecastAssertFailFunc = 0; + +void rcAssertFailSetCustom(rcAssertFailFunc *assertFailFunc) +{ + sRecastAssertFailFunc = assertFailFunc; +} + +rcAssertFailFunc* rcAssertFailGetCustom() +{ + return sRecastAssertFailFunc; +} + +#endif diff --git a/Engine/lib/recast/Recast/Source/RecastLayers.cpp b/Engine/lib/recast/Recast/Source/RecastLayers.cpp index 22a357eff..acc97e44f 100644 --- a/Engine/lib/recast/Recast/Source/RecastLayers.cpp +++ b/Engine/lib/recast/Recast/Source/RecastLayers.cpp @@ -27,7 +27,9 @@ #include "RecastAssert.h" -static const int RC_MAX_LAYERS = RC_NOT_CONNECTED; +// Must be 255 or smaller (not 256) because layer IDs are stored as +// a byte where 255 is a special value. +static const int RC_MAX_LAYERS = 63; static const int RC_MAX_NEIS = 16; struct rcLayerRegion @@ -42,25 +44,31 @@ struct rcLayerRegion }; -static void addUnique(unsigned char* a, unsigned char& an, unsigned char v) -{ - const int n = (int)an; - for (int i = 0; i < n; ++i) - if (a[i] == v) - return; - a[an] = v; - an++; -} - static bool contains(const unsigned char* a, const unsigned char an, const unsigned char v) { const int n = (int)an; for (int i = 0; i < n; ++i) + { if (a[i] == v) return true; + } return false; } +static bool addUnique(unsigned char* a, unsigned char& an, int anMax, unsigned char v) +{ + if (contains(a, an, v)) + return true; + + if ((int)an >= anMax) + return false; + + a[an] = v; + an++; + return true; +} + + inline bool overlapRange(const unsigned short amin, const unsigned short amax, const unsigned short bmin, const unsigned short bmax) { @@ -258,8 +266,13 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, const int ay = y + rcGetDirOffsetY(dir); const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir); const unsigned char rai = srcReg[ai]; - if (rai != 0xff && rai != ri && regs[ri].nneis < RC_MAX_NEIS) - addUnique(regs[ri].neis, regs[ri].nneis, rai); + if (rai != 0xff && rai != ri) + { + // Don't check return value -- if we cannot add the neighbor + // it will just cause a few more regions to be created, which + // is fine. + addUnique(regs[ri].neis, regs[ri].nneis, RC_MAX_NEIS, rai); + } } } @@ -274,8 +287,13 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, { rcLayerRegion& ri = regs[lregs[i]]; rcLayerRegion& rj = regs[lregs[j]]; - addUnique(ri.layers, ri.nlayers, lregs[j]); - addUnique(rj.layers, rj.nlayers, lregs[i]); + + if (!addUnique(ri.layers, ri.nlayers, RC_MAX_LAYERS, lregs[j]) || + !addUnique(rj.layers, rj.nlayers, RC_MAX_LAYERS, lregs[i])) + { + ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: layer overflow (too many overlapping walkable platforms). Try increasing RC_MAX_LAYERS."); + return false; + } } } } @@ -338,7 +356,13 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, regn.layerId = layerId; // Merge current layers to root. for (int k = 0; k < regn.nlayers; ++k) - addUnique(root.layers, root.nlayers, regn.layers[k]); + { + if (!addUnique(root.layers, root.nlayers, RC_MAX_LAYERS, regn.layers[k])) + { + ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: layer overflow (too many overlapping walkable platforms). Try increasing RC_MAX_LAYERS."); + return false; + } + } root.ymin = rcMin(root.ymin, regn.ymin); root.ymax = rcMax(root.ymax, regn.ymax); } @@ -416,7 +440,14 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, rj.layerId = newId; // Add overlaid layers from 'rj' to 'ri'. for (int k = 0; k < rj.nlayers; ++k) - addUnique(ri.layers, ri.nlayers, rj.layers[k]); + { + if (!addUnique(ri.layers, ri.nlayers, RC_MAX_LAYERS, rj.layers[k])) + { + ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: layer overflow (too many overlapping walkable platforms). Try increasing RC_MAX_LAYERS."); + return false; + } + } + // Update height bounds. ri.ymin = rcMin(ri.ymin, rj.ymin); ri.ymax = rcMax(ri.ymax, rj.ymax); diff --git a/Engine/lib/recast/Recast/Source/RecastMesh.cpp b/Engine/lib/recast/Recast/Source/RecastMesh.cpp index 9b6f04e30..e99eaebb7 100644 --- a/Engine/lib/recast/Recast/Source/RecastMesh.cpp +++ b/Engine/lib/recast/Recast/Source/RecastMesh.cpp @@ -379,7 +379,7 @@ static int triangulate(int n, const int* verts, int* indices, int* tris) // We might get here because the contour has overlapping segments, like this: // // A o-o=====o---o B - // / |C D| \ + // / |C D| \. // o o o o // : : : : // We'll try to recover by loosing up the inCone test a bit so that a diagonal diff --git a/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp b/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp index f1270cf20..f953132f7 100644 --- a/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp +++ b/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp @@ -647,11 +647,10 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin, int hull[MAX_VERTS]; int nhull = 0; - nverts = 0; + nverts = nin; for (int i = 0; i < nin; ++i) rcVcopy(&verts[i*3], &in[i*3]); - nverts = nin; edges.resize(0); tris.resize(0); @@ -777,7 +776,7 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin, // Tessellate the base mesh. // We're using the triangulateHull instead of delaunayHull as it tends to - // create a bit better triangulation for long thing triangles when there + // create a bit better triangulation for long thin triangles when there // are no internal points. triangulateHull(nverts, verts, nhull, hull, tris); diff --git a/Engine/lib/recast/Recast/Source/RecastRegion.cpp b/Engine/lib/recast/Recast/Source/RecastRegion.cpp index 54acf4b73..38a2bd6bf 100644 --- a/Engine/lib/recast/Recast/Source/RecastRegion.cpp +++ b/Engine/lib/recast/Recast/Source/RecastRegion.cpp @@ -1575,12 +1575,6 @@ bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf, // Make sure border will not overflow. const int bw = rcMin(w, borderSize); const int bh = rcMin(h, borderSize); - - if (regionId > 0xFFFB) - { - ctx->log(RC_LOG_ERROR, "rcBuildRegions: Region ID overflow"); - return false; - } // Paint regions paintRectRegion(0, bw, 0, h, regionId|RC_BORDER_REG, chf, srcReg); regionId++; @@ -1690,7 +1684,7 @@ bool rcBuildLayerRegions(rcContext* ctx, rcCompactHeightfield& chf, rcScopedDelete srcReg((unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_TEMP)); if (!srcReg) { - ctx->log(RC_LOG_ERROR, "rcBuildRegionsMonotone: Out of memory 'src' (%d).", chf.spanCount); + ctx->log(RC_LOG_ERROR, "rcBuildLayerRegions: Out of memory 'src' (%d).", chf.spanCount); return false; } memset(srcReg,0,sizeof(unsigned short)*chf.spanCount); @@ -1699,7 +1693,7 @@ bool rcBuildLayerRegions(rcContext* ctx, rcCompactHeightfield& chf, rcScopedDelete sweeps((rcSweepSpan*)rcAlloc(sizeof(rcSweepSpan)*nsweeps, RC_ALLOC_TEMP)); if (!sweeps) { - ctx->log(RC_LOG_ERROR, "rcBuildRegionsMonotone: Out of memory 'sweeps' (%d).", nsweeps); + ctx->log(RC_LOG_ERROR, "rcBuildLayerRegions: Out of memory 'sweeps' (%d).", nsweeps); return false; } From cf4261db4aca16df48adb55cdbedf972a6b848ee Mon Sep 17 00:00:00 2001 From: Johxz Date: Wed, 28 Feb 2018 22:42:42 -0600 Subject: [PATCH 138/312] update readme version files --- Engine/lib/recast/Readme.txt | 42 ----------------------------------- Engine/lib/recast/version.txt | 1 + 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 Engine/lib/recast/Readme.txt diff --git a/Engine/lib/recast/Readme.txt b/Engine/lib/recast/Readme.txt deleted file mode 100644 index bb9808ff2..000000000 --- a/Engine/lib/recast/Readme.txt +++ /dev/null @@ -1,42 +0,0 @@ - -Recast & Detour -=============== - -## Recast - -Recast is state of the art navigation mesh construction toolset for games. - -* It is automatic, which means that you can throw any level geometry at it and you will get robust mesh out -* It is fast which means swift turnaround times for level designers -* It is open source so it comes with full source and you can customize it to your heart's content. - -The Recast process starts with constructing a voxel mold from a level geometry -and then casting a navigation mesh over it. The process consists of three steps, -building the voxel mold, partitioning the mold into simple regions, peeling off -the regions as simple polygons. - -1. The voxel mold is build from the input triangle mesh by rasterizing the triangles into a multi-layer heightfield. Some simple filters are then applied to the mold to prune out locations where the character would not be able to move. -2. The walkable areas described by the mold are divided into simple overlayed 2D regions. The resulting regions have only one non-overlapping contour, which simplifies the final step of the process tremendously. -3. The navigation polygons are peeled off from the regions by first tracing the boundaries and then simplifying them. The resulting polygons are finally converted to convex polygons which makes them perfect for pathfinding and spatial reasoning about the level. - -## Detour - -Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly. - -Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows you to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes. - -## Integrating with your own project - -It is recommended to add the source directories `DebugUtils`, `Detour`, `DetourCrowd`, `DetourTileCache`, and `Recast` into your own project depending on which parts of the project you need. For example your level building tool could include DebugUtils, Recast, and Detour, and your game runtime could just include Detour. - -## Discuss - -- Discuss Recast & Detour: http://groups.google.com/group/recastnavigation -- Development blog: http://digestingduck.blogspot.com/ - -## License - -Recast & Detour is licensed under ZLib license, see License.txt for more information. - -## Download -Latest code available at https://github.com/recastnavigation/recastnavigation diff --git a/Engine/lib/recast/version.txt b/Engine/lib/recast/version.txt index 9769f55cc..43c6dbfb0 100644 --- a/Engine/lib/recast/version.txt +++ b/Engine/lib/recast/version.txt @@ -1,4 +1,5 @@ +5d41860 on Jan 5, 2018 1.5.1 released this on Feb 22 2016 From 49639a908f0e91760fae4f04a66be9e60145905d Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 1 Mar 2018 01:51:18 -0600 Subject: [PATCH 139/312] Expanded mesh baking functionality, now supporting baking of LODs and Collision meshes --- Engine/source/T3D/tsStatic.cpp | 101 ++ Engine/source/T3D/tsStatic.h | 3 + Engine/source/gui/worldEditor/worldEditor.cpp | 27 +- Engine/source/scene/sceneObject.h | 21 + Engine/source/ts/collada/colladaUtils.cpp | 1283 ++++++++++++++++- Engine/source/ts/collada/colladaUtils.h | 137 +- Engine/source/ts/tsShapeConstruct.cpp | 14 + 7 files changed, 1578 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 13964e632..9eaab881b 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1073,6 +1073,97 @@ bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList return true; } +bool TSStatic::buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) +{ + if (!mShapeInstance) + return false; + + if (mCollisionType == Bounds) + { + ColladaUtils::ExportData::colMesh* colMesh; + exportData->colMeshes.increment(); + colMesh = &exportData->colMeshes.last(); + + colMesh->mesh.setTransform(&mObjToWorld, mObjScale); + colMesh->mesh.setObject(this); + + colMesh->mesh.addBox(mObjBox); + + colMesh->colMeshName = String::ToString("ColBox%d-1", exportData->colMeshes.size()); + } + else if (mCollisionType == VisibleMesh) + { + ColladaUtils::ExportData::colMesh* colMesh; + exportData->colMeshes.increment(); + colMesh = &exportData->colMeshes.last(); + + colMesh->mesh.setTransform(&mObjToWorld, mObjScale); + colMesh->mesh.setObject(this); + + mShapeInstance->buildPolyList(&colMesh->mesh, 0); + + colMesh->colMeshName = String::ToString("ColMesh%d-1", exportData->colMeshes.size()); + } + else if (mCollisionType == CollisionMesh) + { + // Everything else is done from the collision meshes + // which may be built from either the visual mesh or + // special collision geometry. + for (U32 i = 0; i < mCollisionDetails.size(); i++) + { + ColladaUtils::ExportData::colMesh* colMesh; + exportData->colMeshes.increment(); + colMesh = &exportData->colMeshes.last(); + + colMesh->mesh.setTransform(&mObjToWorld, mObjScale); + colMesh->mesh.setObject(this); + + mShapeInstance->buildPolyListOpcode(mCollisionDetails[i], &colMesh->mesh, box); + + colMesh->colMeshName = String::ToString("ColMesh%d-1", exportData->colMeshes.size()); + } + } + + //Next, process the LOD levels and materials. + if (isServerObject() && getClientObject()) + { + TSStatic* clientShape = dynamic_cast(getClientObject()); + U32 numDetails = clientShape->mShapeInstance->getNumDetails() - 1; + + exportData->meshData.increment(); + + //Prep a meshData for this shape in particular + ColladaUtils::ExportData::meshLODData* meshData = &exportData->meshData.last(); + + //Fill out the info we'll need later to actually append our mesh data for the detail levels during the processing phase + meshData->shapeInst = clientShape->mShapeInstance; + meshData->originatingObject = this; + meshData->meshTransform = mObjToWorld; + meshData->scale = mObjScale; + + //Iterate over all our detail levels + for (U32 i = 0; i < clientShape->mShapeInstance->getNumDetails(); i++) + { + TSShape::Detail detail = clientShape->mShapeInstance->getShape()->details[i]; + + String detailName = String::ToLower(clientShape->mShapeInstance->getShape()->getName(detail.nameIndex)); + + //Skip it if it's a collision or line of sight element + if (detailName.startsWith("col") || detailName.startsWith("los")) + continue; + + meshData->meshDetailLevels.increment(); + + ColladaUtils::ExportData::detailLevel* curDetail = &meshData->meshDetailLevels.last(); + + //Make sure we denote the size this detail level has + curDetail->size = detail.size; + } + } + + return true; +} + void TSStatic::buildConvex(const Box3F& box, Convex* convex) { if ( mCollisionType == None ) @@ -1279,6 +1370,16 @@ void TSStatic::onUnmount( SceneObject *obj, S32 node ) _updateShouldTick(); } +U32 TSStatic::getNumDetails() +{ + if (isServerObject() && getClientObject()) + { + TSStatic* clientShape = dynamic_cast(getClientObject()); + return clientShape->mShapeInstance->getNumDetails(); + } + return 0; +}; + //------------------------------------------------------------------------ //These functions are duplicated in tsStatic and shapeBase. //They each function a little differently; but achieve the same purpose of gathering diff --git a/Engine/source/T3D/tsStatic.h b/Engine/source/T3D/tsStatic.h index 224086c71..2df45a861 100644 --- a/Engine/source/T3D/tsStatic.h +++ b/Engine/source/T3D/tsStatic.h @@ -138,6 +138,7 @@ protected: bool castRay(const Point3F &start, const Point3F &end, RayInfo* info); bool castRayRendered(const Point3F &start, const Point3F &end, RayInfo* info); bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere); + bool buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); void buildConvex(const Box3F& box, Convex* convex); bool _createShape(); @@ -237,6 +238,8 @@ public: TSShapeInstance* getShapeInstance() const { return mShapeInstance; } + U32 getNumDetails(); + const Vector& getCollisionDetails() const { return mCollisionDetails; } const Vector& getLOSDetails() const { return mLOSDetails; } diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index 7846ec094..ca6c966ae 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -3927,15 +3927,38 @@ void WorldEditor::makeSelectionAMesh(const char *filename) OptimizedPolyList polyList; polyList.setBaseTransform(orientation); + ColladaUtils::ExportData exportData; + for (S32 i = 0; i < objectList.size(); i++) { SceneObject *pObj = objectList[i]; - if (!pObj->buildPolyList(PLC_Export, &polyList, pObj->getWorldBox(), pObj->getWorldSphere())) + if (!pObj->buildExportPolyList(PLC_Export, &exportData, pObj->getWorldBox(), pObj->getWorldSphere())) Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId()); } + //Now that we have all of our mesh data, process it so we can correctly collapse everything. + exportData.processData(); + + //recenter generated visual mesh results + for (U32 dl = 0; dl < exportData.colMeshes.size(); dl++) + { + for (U32 pnt = 0; pnt < exportData.colMeshes[dl].mesh.mPoints.size(); pnt++) + { + exportData.colMeshes[dl].mesh.mPoints[pnt] -= centroid; + } + } + + //recenter generated collision mesh results + for (U32 dl = 0; dl < exportData.detailLevels.size(); dl++) + { + for (U32 pnt = 0; pnt < exportData.detailLevels[dl].mesh.mPoints.size(); pnt++) + { + exportData.detailLevels[dl].mesh.mPoints[pnt] -= centroid; + } + } + // Use a ColladaUtils function to do the actual export to a Collada file - ColladaUtils::exportToCollada(filename, polyList); + ColladaUtils::exportToCollada(filename, exportData); // // Allocate TSStatic object and add to level. diff --git a/Engine/source/scene/sceneObject.h b/Engine/source/scene/sceneObject.h index 549246c9e..3e7fab355 100644 --- a/Engine/source/scene/sceneObject.h +++ b/Engine/source/scene/sceneObject.h @@ -60,6 +60,9 @@ #include "gfx/gfxDevice.h" #endif +#ifndef _COLLADA_UTILS_H_ +#include "ts/collada/colladaUtils.h" +#endif class SceneManager; class SceneRenderState; @@ -550,6 +553,24 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce const Box3F& box, const SphereF& sphere ) { return false; } + /// Builds a list of polygons which intersect a bounding volume for exporting + /// + /// This will use either the sphere or the box, not both, the + /// SceneObject implementation ignores sphere. + /// + /// @see AbstractPolyList + /// @param context A contentual hint as to the type of polylist to build. + /// @param polyList Poly list build (out) + /// @param box Box bounding volume + /// @param sphere Sphere bounding volume + /// + virtual bool buildExportPolyList(PolyListContext context, + ColladaUtils::ExportData *exportData, + const Box3F& box, + const SphereF& sphere) { + return false; + } + /// Casts a ray and obtain collision information, returns true if RayInfo is modified. /// /// @param start Start point of ray diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index e88abe372..32c559077 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -1277,6 +1277,289 @@ void ColladaUtils::exportColladaMaterials(TiXmlElement* rootNode, const Optimize } +void ColladaUtils::exportColladaMaterials(TiXmlElement* rootNode, const ExportData& exportData, const Torque::Path& colladaFile) +{ + // First the image library + TiXmlElement* imgLibNode = new TiXmlElement("library_images"); + rootNode->LinkEndChild(imgLibNode); + + Vector matNames; + + for (U32 i = 0; i < exportData.materials.size(); i++) + { + BaseMatInstance* baseInst = exportData.materials[i]; + + matNames.push_back(String::ToString("Material%d", i)); + + Material* mat = dynamic_cast(baseInst->getMaterial()); + if (!mat) + continue; + + String diffuseMap; + + if (mat->getName() && mat->getName()[0]) + matNames.last() = mat->mMapTo; + + // Handle an auto-generated "Default Material" specially + if (mat->isAutoGenerated()) + { + Torque::Path diffusePath; + + if (mat->mDiffuseMapFilename[0].isNotEmpty()) + diffusePath = mat->mDiffuseMapFilename[0]; + else + diffusePath = String("warningMat"); + + matNames.last() = diffusePath.getFileName(); + diffuseMap += diffusePath.getFullFileName(); + } + else + { + if (mat->mDiffuseMapFilename[0].isNotEmpty()) + diffuseMap += mat->mDiffuseMapFilename[0]; + else + diffuseMap += "warningMat"; + } + + Torque::Path diffusePath = findTexture(colladaFile.getPath() + "/" + diffuseMap); + + // If we didn't get a path + if (diffusePath.getFullPath().isNotEmpty()) + diffuseMap = Torque::Path::MakeRelativePath(diffusePath, colladaFile); + + TiXmlElement* imageNode = new TiXmlElement("image"); + imgLibNode->LinkEndChild(imageNode); + imageNode->SetAttribute("id", avar("%s", matNames.last().c_str())); + imageNode->SetAttribute("name", avar("%s", matNames.last().c_str())); + + TiXmlElement* initNode = new TiXmlElement("init_from"); + imageNode->LinkEndChild(initNode); + TiXmlText* initText = new TiXmlText(avar("file://%s", diffuseMap.c_str())); // "the file://" is needed to load the texture in some old apps (ex: 3ds Max 2009) + initNode->LinkEndChild(initText); + } + + // Next the effects library + TiXmlElement* effectLibNode = new TiXmlElement("library_effects"); + rootNode->LinkEndChild(effectLibNode); + + for (U32 i = 0; i < exportData.materials.size(); i++) + { + BaseMatInstance* baseInst = exportData.materials[i]; + + Material* mat = dynamic_cast(baseInst->getMaterial()); + if (!mat) + continue; + + TiXmlElement* effectNode = new TiXmlElement("effect"); + effectLibNode->LinkEndChild(effectNode); + effectNode->SetAttribute("id", avar("%s-effect", matNames[i].c_str())); + effectNode->SetAttribute("name", avar("%s-effect", matNames[i].c_str())); + + TiXmlElement* profileNode = new TiXmlElement("profile_COMMON"); + effectNode->LinkEndChild(profileNode); + + // --------------------------- + TiXmlElement* newParamNode = new TiXmlElement("newparam"); + profileNode->LinkEndChild(newParamNode); + newParamNode->SetAttribute("sid", avar("%s-surface", matNames[i].c_str())); + + TiXmlElement* surfaceNode = new TiXmlElement("surface"); + newParamNode->LinkEndChild(surfaceNode); + surfaceNode->SetAttribute("type", "2D"); + + TiXmlElement* initNode2 = new TiXmlElement("init_from"); + surfaceNode->LinkEndChild(initNode2); + TiXmlText* init2Text = new TiXmlText(avar("%s", matNames[i].c_str())); + initNode2->LinkEndChild(init2Text); + + TiXmlElement* formatNode = new TiXmlElement("format"); + surfaceNode->LinkEndChild(formatNode); + TiXmlText* formatText = new TiXmlText("A8R8G8B8"); + formatNode->LinkEndChild(formatText); + + // --------------------------- + TiXmlElement* newParam2Node = new TiXmlElement("newparam"); + profileNode->LinkEndChild(newParam2Node); + newParam2Node->SetAttribute("sid", avar("%s-sampler", matNames[i].c_str())); + + TiXmlElement* sampler2DNode = new TiXmlElement("sampler2D"); + newParam2Node->LinkEndChild(sampler2DNode); + + TiXmlElement* sourceSampler2DNode = new TiXmlElement("source"); + sampler2DNode->LinkEndChild(sourceSampler2DNode); + TiXmlText* sourceSampler2DText = new TiXmlText(avar("%s-surface", matNames[i].c_str())); + sourceSampler2DNode->LinkEndChild(sourceSampler2DText); + + // --------------------------- + + TiXmlElement* techniqueNode = new TiXmlElement("technique"); + profileNode->LinkEndChild(techniqueNode); + techniqueNode->SetAttribute("sid", "common"); + + TiXmlElement* blinnNode = new TiXmlElement("blinn"); + techniqueNode->LinkEndChild(blinnNode); + + // --------------------------- + TiXmlElement* emissionNode = new TiXmlElement("emission"); + blinnNode->LinkEndChild(emissionNode); + + TiXmlElement* colorEmissionNode = new TiXmlElement("color"); + emissionNode->LinkEndChild(colorEmissionNode); + colorEmissionNode->SetAttribute("sid", "emission"); + + TiXmlText* colorEmissionNodeText = new TiXmlText("0.0 0.0 0.0 1.0"); + colorEmissionNode->LinkEndChild(colorEmissionNodeText); + + // --------------------------- + TiXmlElement* ambientNode = new TiXmlElement("ambient"); + blinnNode->LinkEndChild(ambientNode); + + TiXmlElement* colorAmbientNode = new TiXmlElement("color"); + ambientNode->LinkEndChild(colorAmbientNode); + colorAmbientNode->SetAttribute("sid", "ambient"); + + TiXmlText* colorAmbientNodeText = new TiXmlText("0.0 0.0 0.0 1.0"); + colorAmbientNode->LinkEndChild(colorAmbientNodeText); + + // --------------------------- + TiXmlElement* diffuseNode = new TiXmlElement("diffuse"); + blinnNode->LinkEndChild(diffuseNode); + TiXmlElement* textureDiffuseNode = new TiXmlElement("texture"); + diffuseNode->LinkEndChild(textureDiffuseNode); + textureDiffuseNode->SetAttribute("texture", avar("%s-sampler", matNames[i].c_str())); + textureDiffuseNode->SetAttribute("texcoord", "UVMap"); + + // Extra info useful for getting the texture to show up correctly in MAYA and 3DS Max + TiXmlElement* extraNode = new TiXmlElement("extra"); + textureDiffuseNode->LinkEndChild(extraNode); + + TiXmlElement* extraTechNode = new TiXmlElement("technique"); + extraNode->LinkEndChild(extraTechNode); + extraTechNode->SetAttribute("profile", "MAYA"); + + TiXmlElement* extraWrapUNode = new TiXmlElement("wrapU"); + extraTechNode->LinkEndChild(extraWrapUNode); + extraWrapUNode->SetAttribute("sid", "wrapU0"); + + TiXmlText* extraWrapUText = new TiXmlText("TRUE"); + extraWrapUNode->LinkEndChild(extraWrapUText); + + TiXmlElement* extraWrapVNode = new TiXmlElement("wrapV"); + extraTechNode->LinkEndChild(extraWrapVNode); + extraWrapVNode->SetAttribute("sid", "wrapV0"); + + TiXmlText* extraWrapVText = new TiXmlText("TRUE"); + extraWrapVNode->LinkEndChild(extraWrapVText); + + TiXmlElement* extraBlendNode = new TiXmlElement("blend_mode"); + extraTechNode->LinkEndChild(extraBlendNode); + + TiXmlText* extraBlendText = new TiXmlText("ADD"); + extraBlendNode->LinkEndChild(extraBlendText); + + // --------------------------- + TiXmlElement* specularNode = new TiXmlElement("specular"); + blinnNode->LinkEndChild(specularNode); + + TiXmlElement* colorSpecularNode = new TiXmlElement("color"); + specularNode->LinkEndChild(colorSpecularNode); + colorSpecularNode->SetAttribute("sid", "specular"); + + TiXmlText* colorSpecularNodeText = new TiXmlText("0.5 0.5 0.5 1.0"); + colorSpecularNode->LinkEndChild(colorSpecularNodeText); + + // --------------------------- + TiXmlElement* shininessNode = new TiXmlElement("shininess"); + blinnNode->LinkEndChild(shininessNode); + + TiXmlElement* colorShininessNode = new TiXmlElement("float"); + shininessNode->LinkEndChild(colorShininessNode); + colorShininessNode->SetAttribute("sid", "shininess"); + + TiXmlText* colorShininessNodeText = new TiXmlText("1.0"); + colorShininessNode->LinkEndChild(colorShininessNodeText); + + // --------------------------- + TiXmlElement* reflectiveNode = new TiXmlElement("reflective"); + blinnNode->LinkEndChild(reflectiveNode); + + TiXmlElement* colorReflectiveNode = new TiXmlElement("color"); + reflectiveNode->LinkEndChild(colorReflectiveNode); + colorReflectiveNode->SetAttribute("sid", "reflective"); + + TiXmlText* colorReflectiveNodeText = new TiXmlText("0.0 0.0 0.0 1.0"); + colorReflectiveNode->LinkEndChild(colorReflectiveNodeText); + + // --------------------------- + TiXmlElement* reflectivityNode = new TiXmlElement("reflectivity"); + blinnNode->LinkEndChild(reflectivityNode); + + TiXmlElement* floatReflectivityNode = new TiXmlElement("float"); + reflectivityNode->LinkEndChild(floatReflectivityNode); + floatReflectivityNode->SetAttribute("sid", "reflectivity"); + + TiXmlText* floatReflectivityText = new TiXmlText("0.5"); + floatReflectivityNode->LinkEndChild(floatReflectivityText); + + // --------------------------- + TiXmlElement* transparentNode = new TiXmlElement("transparent"); + blinnNode->LinkEndChild(transparentNode); + transparentNode->SetAttribute("opaque", "RGB_ZERO"); + + TiXmlElement* colorTransparentNode = new TiXmlElement("color"); + transparentNode->LinkEndChild(colorTransparentNode); + colorTransparentNode->SetAttribute("sid", "transparent"); + + TiXmlText* colorTransparentNodeText = new TiXmlText("0.0 0.0 0.0 1.0"); + colorTransparentNode->LinkEndChild(colorTransparentNodeText); + + // --------------------------- + TiXmlElement* transparencyNode = new TiXmlElement("transparency"); + blinnNode->LinkEndChild(transparencyNode); + + TiXmlElement* floatTransparencyNode = new TiXmlElement("float"); + transparencyNode->LinkEndChild(floatTransparencyNode); + floatTransparencyNode->SetAttribute("sid", "transparency"); + + TiXmlText* floatTransparencyText = new TiXmlText("0.0"); + floatTransparencyNode->LinkEndChild(floatTransparencyText); + + // --------------------------- + TiXmlElement* refractionNode = new TiXmlElement("index_of_refraction"); + blinnNode->LinkEndChild(refractionNode); + + TiXmlElement* colorRefractionNode = new TiXmlElement("float"); + refractionNode->LinkEndChild(colorRefractionNode); + colorRefractionNode->SetAttribute("sid", "index_of_refraction"); + + TiXmlText* colorRefractionNodeText = new TiXmlText("1"); + colorRefractionNode->LinkEndChild(colorRefractionNodeText); + } + + // Finally the material library + TiXmlElement* matLibNode = new TiXmlElement("library_materials"); + rootNode->LinkEndChild(matLibNode); + + for (U32 i = 0; i < exportData.materials.size(); i++) + { + BaseMatInstance* baseInst = exportData.materials[i]; + + Material* mat = dynamic_cast(baseInst->getMaterial()); + if (!mat) + continue; + + TiXmlElement* materialNode = new TiXmlElement("material"); + matLibNode->LinkEndChild(materialNode); + materialNode->SetAttribute("id", avar("%s-material", matNames[i].c_str())); + materialNode->SetAttribute("name", matNames[i].c_str()); + + TiXmlElement* instEffectNode = new TiXmlElement("instance_effect"); + materialNode->LinkEndChild(instEffectNode); + instEffectNode->SetAttribute("url", avar("#%s-effect", matNames[i].c_str())); + } + +} + void ColladaUtils::exportColladaTriangles(TiXmlElement* meshNode, const OptimizedPolyList& mesh, const String& meshName, const Vector& matNames) { // Start at -1 so we will export polygons that do not have a material. @@ -1396,6 +1679,252 @@ void ColladaUtils::exportColladaTriangles(TiXmlElement* meshNode, const Optimize } } +void ColladaUtils::exportColladaTriangles(TiXmlElement* meshNode, const ExportData& exportData, const U32 detailLevel, const String& meshName) +{ + // Calculate the number of triangles that uses this Material + U32 triangleCount = 0; + + const ExportData::detailLevel* dl = &exportData.detailLevels[detailLevel]; + + for (S32 i = 0; i < dl->materialRefList.size(); i++) + { + int matIdx; + dl->materialRefList.tryGetValue(i, matIdx); + BaseMatInstance* baseInst = exportData.materials[matIdx]; + + Material* mat = dynamic_cast(baseInst->getMaterial()); + if (!mat) + continue; + + String matName; + + if (mat->getName() && mat->getName()[0]) + matName = mat->mMapTo; + + for (U32 j = 0; j < dl->mesh.mPolyList.size(); j++) + { + const OptimizedPolyList::Poly& poly = dl->mesh.mPolyList[j]; + + if (poly.material != i) + continue; + + if (poly.vertexCount < 3) + continue; + + if (poly.type == OptimizedPolyList::TriangleList || + poly.type == OptimizedPolyList::TriangleFan || + poly.type == OptimizedPolyList::TriangleStrip) + { + triangleCount += poly.vertexCount - 2; + } + else + AssertISV(false, "ColladaUtils::exportColladaTriangles(): Unknown Poly type!"); + } + + // Make sure that we are actually using this Material + if (triangleCount == 0) + continue; + + TiXmlElement* trianglesNode = new TiXmlElement("triangles"); + meshNode->LinkEndChild(trianglesNode); + trianglesNode->SetAttribute("material", (i > -1) ? avar("%s-material", matName.c_str()) : ""); + trianglesNode->SetAttribute("count", avar("%d", triangleCount)); + + TiXmlElement* trianglesVertInputNode = new TiXmlElement("input"); + trianglesNode->LinkEndChild(trianglesVertInputNode); + trianglesVertInputNode->SetAttribute("semantic", "VERTEX"); + trianglesVertInputNode->SetAttribute("source", avar("#%s-mesh-vertices", meshName.c_str())); + trianglesVertInputNode->SetAttribute("offset", "0"); + + TiXmlElement* trianglesNormalInputNode = new TiXmlElement("input"); + trianglesNode->LinkEndChild(trianglesNormalInputNode); + trianglesNormalInputNode->SetAttribute("semantic", "NORMAL"); + trianglesNormalInputNode->SetAttribute("source", avar("#%s-mesh-normals", meshName.c_str())); + trianglesNormalInputNode->SetAttribute("offset", "1"); + + TiXmlElement* trianglesUV0InputNode = new TiXmlElement("input"); + trianglesNode->LinkEndChild(trianglesUV0InputNode); + trianglesUV0InputNode->SetAttribute("semantic", "TEXCOORD"); + trianglesUV0InputNode->SetAttribute("source", avar("#%s-mesh-map-0", meshName.c_str())); + trianglesUV0InputNode->SetAttribute("offset", "2"); + trianglesUV0InputNode->SetAttribute("set", "0"); + + TiXmlElement* polyNode = new TiXmlElement("p"); + trianglesNode->LinkEndChild(polyNode); + + Vector tempIndices; + tempIndices.reserve(4); + + for (U32 j = 0; j < dl->mesh.mPolyList.size(); j++) + { + const OptimizedPolyList::Poly& poly = dl->mesh.mPolyList[j]; + + if (poly.vertexCount < 3) + continue; + + if (poly.material != i) + continue; + + tempIndices.setSize(poly.vertexCount); + dMemset(tempIndices.address(), 0, poly.vertexCount); + + if (poly.type == OptimizedPolyList::TriangleStrip) + { + tempIndices[0] = 0; + U32 idx = 1; + + for (U32 k = 1; k < poly.vertexCount; k += 2) + tempIndices[idx++] = k; + + for (U32 k = ((poly.vertexCount - 1) & (~0x1)); k > 0; k -= 2) + tempIndices[idx++] = k; + } + else if (poly.type == OptimizedPolyList::TriangleList || + poly.type == OptimizedPolyList::TriangleFan) + { + for (U32 k = 0; k < poly.vertexCount; k++) + tempIndices[k] = k; + } + else + AssertISV(false, "ColladaUtils::exportColladaTriangles(): Unknown Poly type!"); + + const U32& firstIdx = dl->mesh.mIndexList[poly.vertexStart]; + const OptimizedPolyList::VertIndex& firstVertIdx = dl->mesh.mVertexList[firstIdx]; + + for (U32 k = 1; k < poly.vertexCount - 1; k++) + { + const U32& secondIdx = dl->mesh.mIndexList[poly.vertexStart + tempIndices[k]]; + const U32& thirdIdx = dl->mesh.mIndexList[poly.vertexStart + tempIndices[k + 1]]; + + const OptimizedPolyList::VertIndex& secondVertIdx = dl->mesh.mVertexList[secondIdx]; + const OptimizedPolyList::VertIndex& thirdVertIdx = dl->mesh.mVertexList[thirdIdx]; + + // Note the reversed winding on the triangles + const char* tri = avar("%d %d %d %d %d %d %d %d %d ", + thirdVertIdx.vertIdx, thirdVertIdx.normalIdx, thirdVertIdx.uv0Idx, + secondVertIdx.vertIdx, secondVertIdx.normalIdx, secondVertIdx.uv0Idx, + firstVertIdx.vertIdx, firstVertIdx.normalIdx, firstVertIdx.uv0Idx); + + TiXmlText* triangleText = new TiXmlText(tri); + polyNode->LinkEndChild(triangleText); + } + } + } +} + +void ColladaUtils::exportColladaCollisionTriangles(TiXmlElement* meshNode, const ExportData& exportData, const U32 collisionIdx) +{ + // Calculate the number of triangles that uses this Material + U32 triangleCount = 0; + + const ExportData::colMesh* col = &exportData.colMeshes[collisionIdx]; + + String meshName = col->colMeshName; + + for (U32 j = 0; j < col->mesh.mPolyList.size(); j++) + { + const OptimizedPolyList::Poly& poly = col->mesh.mPolyList[j]; + + if (poly.vertexCount < 3) + continue; + + if (poly.type == OptimizedPolyList::TriangleList || + poly.type == OptimizedPolyList::TriangleFan || + poly.type == OptimizedPolyList::TriangleStrip) + { + triangleCount += poly.vertexCount - 2; + } + else + AssertISV(false, "ColladaUtils::exportColladaCollisionTriangles(): Unknown Poly type!"); + } + + // Make sure that we are actually using this Material + if (triangleCount == 0) + return; + + TiXmlElement* trianglesNode = new TiXmlElement("triangles"); + meshNode->LinkEndChild(trianglesNode); + trianglesNode->SetAttribute("material", ""); + trianglesNode->SetAttribute("count", avar("%d", triangleCount)); + + TiXmlElement* trianglesVertInputNode = new TiXmlElement("input"); + trianglesNode->LinkEndChild(trianglesVertInputNode); + trianglesVertInputNode->SetAttribute("semantic", "VERTEX"); + trianglesVertInputNode->SetAttribute("source", avar("#%s-mesh-vertices", meshName.c_str())); + trianglesVertInputNode->SetAttribute("offset", "0"); + + TiXmlElement* trianglesNormalInputNode = new TiXmlElement("input"); + trianglesNode->LinkEndChild(trianglesNormalInputNode); + trianglesNormalInputNode->SetAttribute("semantic", "NORMAL"); + trianglesNormalInputNode->SetAttribute("source", avar("#%s-mesh-normals", meshName.c_str())); + trianglesNormalInputNode->SetAttribute("offset", "1"); + + TiXmlElement* trianglesUV0InputNode = new TiXmlElement("input"); + trianglesNode->LinkEndChild(trianglesUV0InputNode); + trianglesUV0InputNode->SetAttribute("semantic", "TEXCOORD"); + trianglesUV0InputNode->SetAttribute("source", avar("#%s-mesh-map-0", meshName.c_str())); + trianglesUV0InputNode->SetAttribute("offset", "2"); + trianglesUV0InputNode->SetAttribute("set", "0"); + + TiXmlElement* polyNode = new TiXmlElement("p"); + trianglesNode->LinkEndChild(polyNode); + + Vector tempIndices; + tempIndices.reserve(4); + + for (U32 j = 0; j < col->mesh.mPolyList.size(); j++) + { + const OptimizedPolyList::Poly& poly = col->mesh.mPolyList[j]; + + if (poly.vertexCount < 3) + continue; + + tempIndices.setSize(poly.vertexCount); + dMemset(tempIndices.address(), 0, poly.vertexCount); + + if (poly.type == OptimizedPolyList::TriangleStrip) + { + tempIndices[0] = 0; + U32 idx = 1; + + for (U32 k = 1; k < poly.vertexCount; k += 2) + tempIndices[idx++] = k; + + for (U32 k = ((poly.vertexCount - 1) & (~0x1)); k > 0; k -= 2) + tempIndices[idx++] = k; + } + else if (poly.type == OptimizedPolyList::TriangleList || + poly.type == OptimizedPolyList::TriangleFan) + { + for (U32 k = 0; k < poly.vertexCount; k++) + tempIndices[k] = k; + } + else + AssertISV(false, "ColladaUtils::exportColladaTriangles(): Unknown Poly type!"); + + const U32& firstIdx = col->mesh.mIndexList[poly.vertexStart]; + const OptimizedPolyList::VertIndex& firstVertIdx = col->mesh.mVertexList[firstIdx]; + + for (U32 k = 1; k < poly.vertexCount - 1; k++) + { + const U32& secondIdx = col->mesh.mIndexList[poly.vertexStart + tempIndices[k]]; + const U32& thirdIdx = col->mesh.mIndexList[poly.vertexStart + tempIndices[k + 1]]; + + const OptimizedPolyList::VertIndex& secondVertIdx = col->mesh.mVertexList[secondIdx]; + const OptimizedPolyList::VertIndex& thirdVertIdx = col->mesh.mVertexList[thirdIdx]; + + // Note the reversed winding on the triangles + const char* tri = avar("%d %d %d %d %d %d %d %d %d ", + thirdVertIdx.vertIdx, thirdVertIdx.normalIdx, thirdVertIdx.uv0Idx, + secondVertIdx.vertIdx, secondVertIdx.normalIdx, secondVertIdx.uv0Idx, + firstVertIdx.vertIdx, firstVertIdx.normalIdx, firstVertIdx.uv0Idx); + + TiXmlText* triangleText = new TiXmlText(tri); + polyNode->LinkEndChild(triangleText); + } + } +} + void ColladaUtils::exportColladaMesh(TiXmlElement* rootNode, const OptimizedPolyList& mesh, const String& meshName, const Vector& matNames) { TiXmlElement* libGeomsNode = new TiXmlElement("library_geometries"); @@ -1576,6 +2105,380 @@ void ColladaUtils::exportColladaMesh(TiXmlElement* rootNode, const OptimizedPoly } +void ColladaUtils::exportColladaMesh(TiXmlElement* rootNode, const ExportData& exportData, const String& meshName) +{ + TiXmlElement* libGeomsNode = new TiXmlElement("library_geometries"); + rootNode->LinkEndChild(libGeomsNode); + + for (U32 d = 0; d < exportData.detailLevels.size(); d++) + { + char lodMeshName[256]; + dSprintf(lodMeshName, 256, "%s%d", meshName.c_str(), exportData.detailLevels[d].size); + + char lodMeshID[256]; + dSprintf(lodMeshID, 256, "%s-mesh", lodMeshName); + + TiXmlElement* geometryNode = new TiXmlElement("geometry"); + libGeomsNode->LinkEndChild(geometryNode); + geometryNode->SetAttribute("id", lodMeshID); + geometryNode->SetAttribute("name", lodMeshName); + + TiXmlElement* meshNode = new TiXmlElement("mesh"); + geometryNode->LinkEndChild(meshNode); + + // Save out the vertices + TiXmlElement* vertsSourceNode = new TiXmlElement("source"); + meshNode->LinkEndChild(vertsSourceNode); + vertsSourceNode->SetAttribute("id", avar("%s-mesh-positions", lodMeshName)); + + TiXmlElement* vertsNode = new TiXmlElement("float_array"); + vertsSourceNode->LinkEndChild(vertsNode); + vertsNode->SetAttribute("id", avar("%s-mesh-positions-array", lodMeshName)); + vertsNode->SetAttribute("count", avar("%d", exportData.detailLevels[d].mesh.mPoints.size() * 3)); + + for (U32 i = 0; i < exportData.detailLevels[d].mesh.mPoints.size(); i++) + { + const Point3F& vert = exportData.detailLevels[d].mesh.mPoints[i]; + + TiXmlText* vertText = new TiXmlText(avar("%.4f %.4f %.4f ", vert.x, vert.y, vert.z)); + vertsNode->LinkEndChild(vertText); + } + + // Save the vertex accessor + TiXmlElement* vertsTechNode = new TiXmlElement("technique_common"); + vertsSourceNode->LinkEndChild(vertsTechNode); + + TiXmlElement* vertsAccNode = new TiXmlElement("accessor"); + vertsTechNode->LinkEndChild(vertsAccNode); + vertsAccNode->SetAttribute("source", avar("#%s-mesh-positions-array", lodMeshName)); + vertsAccNode->SetAttribute("count", avar("%d", exportData.detailLevels[d].mesh.mPoints.size())); + vertsAccNode->SetAttribute("stride", "3"); + + TiXmlElement* vertsAccXNode = new TiXmlElement("param"); + vertsAccNode->LinkEndChild(vertsAccXNode); + vertsAccXNode->SetAttribute("name", "X"); + vertsAccXNode->SetAttribute("type", "float"); + + TiXmlElement* vertsAccYNode = new TiXmlElement("param"); + vertsAccNode->LinkEndChild(vertsAccYNode); + vertsAccYNode->SetAttribute("name", "Y"); + vertsAccYNode->SetAttribute("type", "float"); + + TiXmlElement* vertsAccZNode = new TiXmlElement("param"); + vertsAccNode->LinkEndChild(vertsAccZNode); + vertsAccZNode->SetAttribute("name", "Z"); + vertsAccZNode->SetAttribute("type", "float"); + + // Save out the normals + TiXmlElement* normalsSourceNode = new TiXmlElement("source"); + meshNode->LinkEndChild(normalsSourceNode); + normalsSourceNode->SetAttribute("id", avar("%s-mesh-normals", lodMeshName)); + + TiXmlElement* normalsNode = new TiXmlElement("float_array"); + normalsSourceNode->LinkEndChild(normalsNode); + normalsNode->SetAttribute("id", avar("%s-mesh-normals-array", lodMeshName)); + normalsNode->SetAttribute("count", avar("%d", exportData.detailLevels[d].mesh.mNormals.size() * 3)); + + for (U32 i = 0; i < exportData.detailLevels[d].mesh.mNormals.size(); i++) + { + const Point3F& normal = exportData.detailLevels[d].mesh.mNormals[i]; + + TiXmlText* normalText = new TiXmlText(avar("%.4f %.4f %.4f ", normal.x, normal.y, normal.z)); + normalsNode->LinkEndChild(normalText); + } + + // Save the normals accessor + TiXmlElement* normalsTechNode = new TiXmlElement("technique_common"); + normalsSourceNode->LinkEndChild(normalsTechNode); + + TiXmlElement* normalsAccNode = new TiXmlElement("accessor"); + normalsTechNode->LinkEndChild(normalsAccNode); + normalsAccNode->SetAttribute("source", avar("#%s-mesh-normals-array", lodMeshName)); + normalsAccNode->SetAttribute("count", avar("%d", exportData.detailLevels[d].mesh.mNormals.size())); + normalsAccNode->SetAttribute("stride", "3"); + + TiXmlElement* normalsAccXNode = new TiXmlElement("param"); + normalsAccNode->LinkEndChild(normalsAccXNode); + normalsAccXNode->SetAttribute("name", "X"); + normalsAccXNode->SetAttribute("type", "float"); + + TiXmlElement* normalsAccYNode = new TiXmlElement("param"); + normalsAccNode->LinkEndChild(normalsAccYNode); + normalsAccYNode->SetAttribute("name", "Y"); + normalsAccYNode->SetAttribute("type", "float"); + + TiXmlElement* normalsAccZNode = new TiXmlElement("param"); + normalsAccNode->LinkEndChild(normalsAccZNode); + normalsAccZNode->SetAttribute("name", "Z"); + normalsAccZNode->SetAttribute("type", "float"); + + // Save out the uvs + TiXmlElement* uv0SourceNode = new TiXmlElement("source"); + meshNode->LinkEndChild(uv0SourceNode); + uv0SourceNode->SetAttribute("id", avar("%s-mesh-map-0", lodMeshName)); + + TiXmlElement* uv0Node = new TiXmlElement("float_array"); + uv0SourceNode->LinkEndChild(uv0Node); + uv0Node->SetAttribute("id", avar("%s-mesh-map-0-array", lodMeshName)); + uv0Node->SetAttribute("count", avar("%d", exportData.detailLevels[d].mesh.mUV0s.size() * 2)); + + for (U32 i = 0; i < exportData.detailLevels[d].mesh.mUV0s.size(); i++) + { + const Point2F& uv0 = exportData.detailLevels[d].mesh.mUV0s[i]; + + TiXmlText* uv0Text = new TiXmlText(avar("%.4f %.4f ", uv0.x, 1.0f - uv0.y)); // COLLADA uvs are upside down compared to Torque + uv0Node->LinkEndChild(uv0Text); + } + + // Save the uv0 accessor + TiXmlElement* uv0TechNode = new TiXmlElement("technique_common"); + uv0SourceNode->LinkEndChild(uv0TechNode); + + TiXmlElement* uv0AccNode = new TiXmlElement("accessor"); + uv0TechNode->LinkEndChild(uv0AccNode); + uv0AccNode->SetAttribute("source", avar("#%s-mesh-map-0-array", lodMeshName)); + uv0AccNode->SetAttribute("count", avar("%d", exportData.detailLevels[d].mesh.mUV0s.size())); + uv0AccNode->SetAttribute("stride", "2"); + + TiXmlElement* uv0AccSNode = new TiXmlElement("param"); + uv0AccNode->LinkEndChild(uv0AccSNode); + uv0AccSNode->SetAttribute("name", "S"); + uv0AccSNode->SetAttribute("type", "float"); + + TiXmlElement* uv0AccTNode = new TiXmlElement("param"); + uv0AccNode->LinkEndChild(uv0AccTNode); + uv0AccTNode->SetAttribute("name", "T"); + uv0AccTNode->SetAttribute("type", "float"); + + // Define the vertices position array + TiXmlElement* verticesNode = new TiXmlElement("vertices"); + meshNode->LinkEndChild(verticesNode); + verticesNode->SetAttribute("id", avar("%s-mesh-vertices", lodMeshName)); + + TiXmlElement* verticesInputNode = new TiXmlElement("input"); + verticesNode->LinkEndChild(verticesInputNode); + verticesInputNode->SetAttribute("semantic", "POSITION"); + verticesInputNode->SetAttribute("source", avar("#%s-mesh-positions", lodMeshName)); + + Vector mapNames; + + //exportColladaTriangles(meshNode, exportData.detailLevels[d].mesh, lodMeshName, mapNames); + exportColladaTriangles(meshNode, exportData, d, lodMeshName); + + // Extra info useful for COLLADAMaya importer (OpenCOLLADA) + TiXmlElement* extraGeoNode = new TiXmlElement("extra"); + libGeomsNode->LinkEndChild(extraGeoNode); + + TiXmlElement* extraGeoNodeTech = new TiXmlElement("technique"); + extraGeoNode->LinkEndChild(extraGeoNodeTech); + extraGeoNodeTech->SetAttribute("profile", "OpenCOLLADAMaya"); + + TiXmlElement* mayaNode2Id = new TiXmlElement("originalMayaNodeId"); + extraGeoNodeTech->LinkEndChild(mayaNode2Id); + mayaNode2Id->SetAttribute("sid", "originalMayaNodeId"); + TiXmlText* mayaIdMesh = new TiXmlText(avar("%s", lodMeshName)); + mayaNode2Id->LinkEndChild(mayaIdMesh); + + TiXmlElement* doubleSidedId = new TiXmlElement("double_sided"); + extraGeoNodeTech->LinkEndChild(doubleSidedId); + doubleSidedId->SetAttribute("sid", "double_sided"); + TiXmlText* doubleSideIdText = new TiXmlText("1"); + doubleSidedId->LinkEndChild(doubleSideIdText); + + TiXmlElement* paramExtraNode = new TiXmlElement("param"); + extraGeoNodeTech->LinkEndChild(paramExtraNode); + paramExtraNode->SetAttribute("sid", "colladaId"); + paramExtraNode->SetAttribute("type", "string"); + + TiXmlText* mayaParamMesh = new TiXmlText(avar("%s-mesh", lodMeshName)); + paramExtraNode->LinkEndChild(mayaParamMesh); + } + + //And now collisions + for (U32 d = 0; d < exportData.colMeshes.size(); d++) + { + const char* colMeshName = exportData.colMeshes[d].colMeshName; + + char colMeshId[256]; + dSprintf(colMeshId, 256, "%s-mesh", colMeshName); + + TiXmlElement* geometryNode = new TiXmlElement("geometry"); + libGeomsNode->LinkEndChild(geometryNode); + geometryNode->SetAttribute("id", colMeshId); + geometryNode->SetAttribute("name", colMeshName); + + TiXmlElement* meshNode = new TiXmlElement("mesh"); + geometryNode->LinkEndChild(meshNode); + + // Save out the vertices + TiXmlElement* vertsSourceNode = new TiXmlElement("source"); + meshNode->LinkEndChild(vertsSourceNode); + vertsSourceNode->SetAttribute("id", avar("%s-mesh-positions", colMeshName)); + + TiXmlElement* vertsNode = new TiXmlElement("float_array"); + vertsSourceNode->LinkEndChild(vertsNode); + vertsNode->SetAttribute("id", avar("%s-mesh-positions-array", colMeshName)); + vertsNode->SetAttribute("count", avar("%d", exportData.colMeshes[d].mesh.mPoints.size() * 3)); + + for (U32 i = 0; i < exportData.colMeshes[d].mesh.mPoints.size(); i++) + { + const Point3F& vert = exportData.colMeshes[d].mesh.mPoints[i]; + + TiXmlText* vertText = new TiXmlText(avar("%.4f %.4f %.4f ", vert.x, vert.y, vert.z)); + vertsNode->LinkEndChild(vertText); + } + + // Save the vertex accessor + TiXmlElement* vertsTechNode = new TiXmlElement("technique_common"); + vertsSourceNode->LinkEndChild(vertsTechNode); + + TiXmlElement* vertsAccNode = new TiXmlElement("accessor"); + vertsTechNode->LinkEndChild(vertsAccNode); + vertsAccNode->SetAttribute("source", avar("#%s-mesh-positions-array", colMeshName)); + vertsAccNode->SetAttribute("count", avar("%d", exportData.colMeshes[d].mesh.mPoints.size())); + vertsAccNode->SetAttribute("stride", "3"); + + TiXmlElement* vertsAccXNode = new TiXmlElement("param"); + vertsAccNode->LinkEndChild(vertsAccXNode); + vertsAccXNode->SetAttribute("name", "X"); + vertsAccXNode->SetAttribute("type", "float"); + + TiXmlElement* vertsAccYNode = new TiXmlElement("param"); + vertsAccNode->LinkEndChild(vertsAccYNode); + vertsAccYNode->SetAttribute("name", "Y"); + vertsAccYNode->SetAttribute("type", "float"); + + TiXmlElement* vertsAccZNode = new TiXmlElement("param"); + vertsAccNode->LinkEndChild(vertsAccZNode); + vertsAccZNode->SetAttribute("name", "Z"); + vertsAccZNode->SetAttribute("type", "float"); + + // Save out the normals + TiXmlElement* normalsSourceNode = new TiXmlElement("source"); + meshNode->LinkEndChild(normalsSourceNode); + normalsSourceNode->SetAttribute("id", avar("%s-mesh-normals", colMeshName)); + + TiXmlElement* normalsNode = new TiXmlElement("float_array"); + normalsSourceNode->LinkEndChild(normalsNode); + normalsNode->SetAttribute("id", avar("%s-mesh-normals-array", colMeshName)); + normalsNode->SetAttribute("count", avar("%d", exportData.colMeshes[d].mesh.mNormals.size() * 3)); + + for (U32 i = 0; i < exportData.colMeshes[d].mesh.mNormals.size(); i++) + { + const Point3F& normal = exportData.colMeshes[d].mesh.mNormals[i]; + + TiXmlText* normalText = new TiXmlText(avar("%.4f %.4f %.4f ", normal.x, normal.y, normal.z)); + normalsNode->LinkEndChild(normalText); + } + + // Save the normals accessor + TiXmlElement* normalsTechNode = new TiXmlElement("technique_common"); + normalsSourceNode->LinkEndChild(normalsTechNode); + + TiXmlElement* normalsAccNode = new TiXmlElement("accessor"); + normalsTechNode->LinkEndChild(normalsAccNode); + normalsAccNode->SetAttribute("source", avar("#%s-mesh-normals-array", colMeshName)); + normalsAccNode->SetAttribute("count", avar("%d", exportData.colMeshes[d].mesh.mNormals.size())); + normalsAccNode->SetAttribute("stride", "3"); + + TiXmlElement* normalsAccXNode = new TiXmlElement("param"); + normalsAccNode->LinkEndChild(normalsAccXNode); + normalsAccXNode->SetAttribute("name", "X"); + normalsAccXNode->SetAttribute("type", "float"); + + TiXmlElement* normalsAccYNode = new TiXmlElement("param"); + normalsAccNode->LinkEndChild(normalsAccYNode); + normalsAccYNode->SetAttribute("name", "Y"); + normalsAccYNode->SetAttribute("type", "float"); + + TiXmlElement* normalsAccZNode = new TiXmlElement("param"); + normalsAccNode->LinkEndChild(normalsAccZNode); + normalsAccZNode->SetAttribute("name", "Z"); + normalsAccZNode->SetAttribute("type", "float"); + + // Save out the uvs + TiXmlElement* uv0SourceNode = new TiXmlElement("source"); + meshNode->LinkEndChild(uv0SourceNode); + uv0SourceNode->SetAttribute("id", avar("%s-mesh-map-0", colMeshName)); + + TiXmlElement* uv0Node = new TiXmlElement("float_array"); + uv0SourceNode->LinkEndChild(uv0Node); + uv0Node->SetAttribute("id", avar("%s-mesh-map-0-array", colMeshName)); + uv0Node->SetAttribute("count", avar("%d", exportData.colMeshes[d].mesh.mUV0s.size() * 2)); + + for (U32 i = 0; i < exportData.colMeshes[d].mesh.mUV0s.size(); i++) + { + const Point2F& uv0 = exportData.colMeshes[d].mesh.mUV0s[i]; + + TiXmlText* uv0Text = new TiXmlText(avar("%.4f %.4f ", uv0.x, 1.0f - uv0.y)); // COLLADA uvs are upside down compared to Torque + uv0Node->LinkEndChild(uv0Text); + } + + // Save the uv0 accessor + TiXmlElement* uv0TechNode = new TiXmlElement("technique_common"); + uv0SourceNode->LinkEndChild(uv0TechNode); + + TiXmlElement* uv0AccNode = new TiXmlElement("accessor"); + uv0TechNode->LinkEndChild(uv0AccNode); + uv0AccNode->SetAttribute("source", avar("#%s-mesh-map-0-array", colMeshName)); + uv0AccNode->SetAttribute("count", avar("%d", exportData.colMeshes[d].mesh.mUV0s.size())); + uv0AccNode->SetAttribute("stride", "2"); + + TiXmlElement* uv0AccSNode = new TiXmlElement("param"); + uv0AccNode->LinkEndChild(uv0AccSNode); + uv0AccSNode->SetAttribute("name", "S"); + uv0AccSNode->SetAttribute("type", "float"); + + TiXmlElement* uv0AccTNode = new TiXmlElement("param"); + uv0AccNode->LinkEndChild(uv0AccTNode); + uv0AccTNode->SetAttribute("name", "T"); + uv0AccTNode->SetAttribute("type", "float"); + + // Define the vertices position array + TiXmlElement* verticesNode = new TiXmlElement("vertices"); + meshNode->LinkEndChild(verticesNode); + verticesNode->SetAttribute("id", avar("%s-mesh-vertices", colMeshName)); + + TiXmlElement* verticesInputNode = new TiXmlElement("input"); + verticesNode->LinkEndChild(verticesInputNode); + verticesInputNode->SetAttribute("semantic", "POSITION"); + verticesInputNode->SetAttribute("source", avar("#%s-mesh-positions", colMeshName)); + + Vector mapNames; + + //exportColladaTriangles(meshNode, exportData.detailLevels[d].mesh, lodMeshName, mapNames); + exportColladaCollisionTriangles(meshNode, exportData, d); + + // Extra info useful for COLLADAMaya importer (OpenCOLLADA) + TiXmlElement* extraGeoNode = new TiXmlElement("extra"); + libGeomsNode->LinkEndChild(extraGeoNode); + + TiXmlElement* extraGeoNodeTech = new TiXmlElement("technique"); + extraGeoNode->LinkEndChild(extraGeoNodeTech); + extraGeoNodeTech->SetAttribute("profile", "OpenCOLLADAMaya"); + + TiXmlElement* mayaNode2Id = new TiXmlElement("originalMayaNodeId"); + extraGeoNodeTech->LinkEndChild(mayaNode2Id); + mayaNode2Id->SetAttribute("sid", "originalMayaNodeId"); + TiXmlText* mayaIdMesh = new TiXmlText(avar("%s", colMeshName)); + mayaNode2Id->LinkEndChild(mayaIdMesh); + + TiXmlElement* doubleSidedId = new TiXmlElement("double_sided"); + extraGeoNodeTech->LinkEndChild(doubleSidedId); + doubleSidedId->SetAttribute("sid", "double_sided"); + TiXmlText* doubleSideIdText = new TiXmlText("1"); + doubleSidedId->LinkEndChild(doubleSideIdText); + + TiXmlElement* paramExtraNode = new TiXmlElement("param"); + extraGeoNodeTech->LinkEndChild(paramExtraNode); + paramExtraNode->SetAttribute("sid", "colladaId"); + paramExtraNode->SetAttribute("type", "string"); + + TiXmlText* mayaParamMesh = new TiXmlText(avar("%s-mesh", colMeshName)); + paramExtraNode->LinkEndChild(mayaParamMesh); + } +} + void ColladaUtils::exportColladaScene(TiXmlElement* rootNode, const String& meshName, const Vector& matNames) { TiXmlElement* libSceneNode = new TiXmlElement("library_visual_scenes"); @@ -1695,6 +2598,244 @@ void ColladaUtils::exportColladaScene(TiXmlElement* rootNode, const String& mesh instVisSceneNode->SetAttribute("url", "#RootNode"); } +void ColladaUtils::exportColladaScene(TiXmlElement* rootNode, const ExportData& exportData, const String& meshName) +{ + TiXmlElement* libSceneNode = new TiXmlElement("library_visual_scenes"); + rootNode->LinkEndChild(libSceneNode); + + TiXmlElement* visSceneNode = new TiXmlElement("visual_scene"); + libSceneNode->LinkEndChild(visSceneNode); + visSceneNode->SetAttribute("id", "RootNode"); + visSceneNode->SetAttribute("name", "RootNode"); + + for (U32 d = 0; d < exportData.detailLevels.size(); d++) + { + char lodMeshName[256]; + dSprintf(lodMeshName, 256, "%s%d", meshName.c_str(), exportData.detailLevels[d].size); + + TiXmlElement* nodeNode = new TiXmlElement("node"); + visSceneNode->LinkEndChild(nodeNode); + nodeNode->SetAttribute("id", lodMeshName); + nodeNode->SetAttribute("name", lodMeshName); + nodeNode->SetAttribute("type", "NODE"); + + TiXmlElement* instanceGeomNode = new TiXmlElement("instance_geometry"); + nodeNode->LinkEndChild(instanceGeomNode); + instanceGeomNode->SetAttribute("url", avar("#%s%d-mesh", meshName.c_str(), exportData.detailLevels[d].size)); + instanceGeomNode->SetAttribute("name", lodMeshName); + + TiXmlElement* bindMatNode = new TiXmlElement("bind_material"); + instanceGeomNode->LinkEndChild(bindMatNode); + + TiXmlElement* techniqueNode = new TiXmlElement("technique_common"); + bindMatNode->LinkEndChild(techniqueNode); + + // Bind the materials + for (U32 i = 0; i < exportData.detailLevels[d].materialRefList.size(); i++) + { + int matIdx; + exportData.detailLevels[d].materialRefList.tryGetValue(i, matIdx); + BaseMatInstance* baseInst = exportData.materials[matIdx]; + + Material* mat = dynamic_cast(baseInst->getMaterial()); + if (!mat) + continue; + + String matName; + + if (mat->getName() && mat->getName()[0]) + matName = mat->mMapTo; + + TiXmlElement* instMatNode = new TiXmlElement("instance_material"); + techniqueNode->LinkEndChild(instMatNode); + instMatNode->SetAttribute("symbol", avar("%s-material", matName.c_str())); + instMatNode->SetAttribute("target", avar("#%s-material", matName.c_str())); + TiXmlElement* bindVertexNode = new TiXmlElement("bind_vertex_input"); + instMatNode->LinkEndChild(bindVertexNode); + //bindVertexNode->SetAttribute("semantic", avar("%s-mesh-map-0", meshName.c_str())); + bindVertexNode->SetAttribute("semantic", "UVMap"); + bindVertexNode->SetAttribute("input_semantic", "TEXCOORD"); + bindVertexNode->SetAttribute("input_set", "0"); + } + + // Extra info useful for COLLADAMax importer (OpenCOLLADA) + TiXmlElement* extraInsGeoNode = new TiXmlElement("extra"); + nodeNode->LinkEndChild(extraInsGeoNode); + + TiXmlElement* extraInsGeoTechNode = new TiXmlElement("technique"); + extraInsGeoNode->LinkEndChild(extraInsGeoTechNode); + extraInsGeoTechNode->SetAttribute("profile", "OpenCOLLADA"); + + TiXmlElement* castShadowsNode = new TiXmlElement("cast_shadows"); + extraInsGeoTechNode->LinkEndChild(castShadowsNode); + castShadowsNode->SetAttribute("sid", "cast_shadows"); + castShadowsNode->SetAttribute("type", "bool"); + + TiXmlText* castShadowsText = new TiXmlText("1"); + castShadowsNode->LinkEndChild(castShadowsText); + + //----------------------------- + TiXmlElement* receiveShadowsNode = new TiXmlElement("receive_shadows"); + extraInsGeoTechNode->LinkEndChild(receiveShadowsNode); + receiveShadowsNode->SetAttribute("sid", "receive_shadows"); + receiveShadowsNode->SetAttribute("type", "bool"); + + TiXmlText* receiveShadowsText = new TiXmlText("1"); + receiveShadowsNode->LinkEndChild(receiveShadowsText); + + //----------------------------- + TiXmlElement* primaryVisibiltyNode = new TiXmlElement("primary_visibility"); + extraInsGeoTechNode->LinkEndChild(primaryVisibiltyNode); + primaryVisibiltyNode->SetAttribute("sid", "primary_visibility"); + primaryVisibiltyNode->SetAttribute("type", "int"); + + TiXmlText* primaryVisibiltyText = new TiXmlText("1"); + primaryVisibiltyNode->LinkEndChild(primaryVisibiltyText); + + //----------------------------- + TiXmlElement* secondaryVisibilityNode = new TiXmlElement("secondary_visibility"); + extraInsGeoTechNode->LinkEndChild(secondaryVisibilityNode); + secondaryVisibilityNode->SetAttribute("sid", "secondary_visibility"); + secondaryVisibilityNode->SetAttribute("type", "int"); + + TiXmlText* secondaryVisibilityText = new TiXmlText("1"); + secondaryVisibilityNode->LinkEndChild(secondaryVisibilityText); + + // Extra info useful for COLLADAMaya importer (OpenCOLLADA) + TiXmlElement* extra2InsGeoNode = new TiXmlElement("extra"); + nodeNode->LinkEndChild(extra2InsGeoNode); + + TiXmlElement* extra2InsGeoTechNode = new TiXmlElement("technique"); + extra2InsGeoNode->LinkEndChild(extra2InsGeoTechNode); + extra2InsGeoTechNode->SetAttribute("profile", "OpenCOLLADAMaya"); + + TiXmlElement* mayaNodeId = new TiXmlElement("originalMayaNodeId"); + extra2InsGeoTechNode->LinkEndChild(mayaNodeId); + mayaNodeId->SetAttribute("sid", "originalMayaNodeId"); + mayaNodeId->SetAttribute("type", "string"); + + TiXmlText* mayaNodeIdMesh = new TiXmlText(lodMeshName); + mayaNodeId->LinkEndChild(mayaNodeIdMesh); + + TiXmlElement* paramExtraNode = new TiXmlElement("param"); + extra2InsGeoTechNode->LinkEndChild(paramExtraNode); + paramExtraNode->SetAttribute("sid", "colladaId"); + paramExtraNode->SetAttribute("type", "string"); + + TiXmlText* mayaParamMesh = new TiXmlText(lodMeshName); + paramExtraNode->LinkEndChild(mayaParamMesh); + } + + //Collisions + for (U32 d = 0; d < exportData.colMeshes.size(); d++) + { + const char* colMeshName = exportData.colMeshes[d].colMeshName; + + TiXmlElement* nodeNode = new TiXmlElement("node"); + visSceneNode->LinkEndChild(nodeNode); + nodeNode->SetAttribute("id", colMeshName); + nodeNode->SetAttribute("name", colMeshName); + nodeNode->SetAttribute("type", "NODE"); + + TiXmlElement* instanceGeomNode = new TiXmlElement("instance_geometry"); + nodeNode->LinkEndChild(instanceGeomNode); + instanceGeomNode->SetAttribute("url", avar("#%s-mesh", colMeshName)); + instanceGeomNode->SetAttribute("name", colMeshName); + + TiXmlElement* bindMatNode = new TiXmlElement("bind_material"); + instanceGeomNode->LinkEndChild(bindMatNode); + + TiXmlElement* techniqueNode = new TiXmlElement("technique_common"); + bindMatNode->LinkEndChild(techniqueNode); + + TiXmlElement* instMatNode = new TiXmlElement("instance_material"); + techniqueNode->LinkEndChild(instMatNode); + instMatNode->SetAttribute("symbol", avar("%s-material", colMeshName)); + instMatNode->SetAttribute("target", avar("#%s-material", colMeshName)); + TiXmlElement* bindVertexNode = new TiXmlElement("bind_vertex_input"); + instMatNode->LinkEndChild(bindVertexNode); + //bindVertexNode->SetAttribute("semantic", avar("%s-mesh-map-0", meshName.c_str())); + bindVertexNode->SetAttribute("semantic", "UVMap"); + bindVertexNode->SetAttribute("input_semantic", "TEXCOORD"); + bindVertexNode->SetAttribute("input_set", "0"); + + // Extra info useful for COLLADAMax importer (OpenCOLLADA) + TiXmlElement* extraInsGeoNode = new TiXmlElement("extra"); + nodeNode->LinkEndChild(extraInsGeoNode); + + TiXmlElement* extraInsGeoTechNode = new TiXmlElement("technique"); + extraInsGeoNode->LinkEndChild(extraInsGeoTechNode); + extraInsGeoTechNode->SetAttribute("profile", "OpenCOLLADA"); + + TiXmlElement* castShadowsNode = new TiXmlElement("cast_shadows"); + extraInsGeoTechNode->LinkEndChild(castShadowsNode); + castShadowsNode->SetAttribute("sid", "cast_shadows"); + castShadowsNode->SetAttribute("type", "bool"); + + TiXmlText* castShadowsText = new TiXmlText("1"); + castShadowsNode->LinkEndChild(castShadowsText); + + //----------------------------- + TiXmlElement* receiveShadowsNode = new TiXmlElement("receive_shadows"); + extraInsGeoTechNode->LinkEndChild(receiveShadowsNode); + receiveShadowsNode->SetAttribute("sid", "receive_shadows"); + receiveShadowsNode->SetAttribute("type", "bool"); + + TiXmlText* receiveShadowsText = new TiXmlText("1"); + receiveShadowsNode->LinkEndChild(receiveShadowsText); + + //----------------------------- + TiXmlElement* primaryVisibiltyNode = new TiXmlElement("primary_visibility"); + extraInsGeoTechNode->LinkEndChild(primaryVisibiltyNode); + primaryVisibiltyNode->SetAttribute("sid", "primary_visibility"); + primaryVisibiltyNode->SetAttribute("type", "int"); + + TiXmlText* primaryVisibiltyText = new TiXmlText("1"); + primaryVisibiltyNode->LinkEndChild(primaryVisibiltyText); + + //----------------------------- + TiXmlElement* secondaryVisibilityNode = new TiXmlElement("secondary_visibility"); + extraInsGeoTechNode->LinkEndChild(secondaryVisibilityNode); + secondaryVisibilityNode->SetAttribute("sid", "secondary_visibility"); + secondaryVisibilityNode->SetAttribute("type", "int"); + + TiXmlText* secondaryVisibilityText = new TiXmlText("1"); + secondaryVisibilityNode->LinkEndChild(secondaryVisibilityText); + + // Extra info useful for COLLADAMaya importer (OpenCOLLADA) + TiXmlElement* extra2InsGeoNode = new TiXmlElement("extra"); + nodeNode->LinkEndChild(extra2InsGeoNode); + + TiXmlElement* extra2InsGeoTechNode = new TiXmlElement("technique"); + extra2InsGeoNode->LinkEndChild(extra2InsGeoTechNode); + extra2InsGeoTechNode->SetAttribute("profile", "OpenCOLLADAMaya"); + + TiXmlElement* mayaNodeId = new TiXmlElement("originalMayaNodeId"); + extra2InsGeoTechNode->LinkEndChild(mayaNodeId); + mayaNodeId->SetAttribute("sid", "originalMayaNodeId"); + mayaNodeId->SetAttribute("type", "string"); + + TiXmlText* mayaNodeIdMesh = new TiXmlText(colMeshName); + mayaNodeId->LinkEndChild(mayaNodeIdMesh); + + TiXmlElement* paramExtraNode = new TiXmlElement("param"); + extra2InsGeoTechNode->LinkEndChild(paramExtraNode); + paramExtraNode->SetAttribute("sid", "colladaId"); + paramExtraNode->SetAttribute("type", "string"); + + TiXmlText* mayaParamMesh = new TiXmlText(colMeshName); + paramExtraNode->LinkEndChild(mayaParamMesh); + } + //----------------------------- + + TiXmlElement* sceneNode = new TiXmlElement("scene"); + rootNode->LinkEndChild(sceneNode); + + TiXmlElement* instVisSceneNode = new TiXmlElement("instance_visual_scene"); + sceneNode->LinkEndChild(instVisSceneNode); + instVisSceneNode->SetAttribute("url", "#RootNode"); +} + void ColladaUtils::exportToCollada(const Torque::Path& colladaFile, const OptimizedPolyList& mesh, const String& meshName) { // Get the mesh name @@ -1728,11 +2869,14 @@ void ColladaUtils::exportToCollada(const Torque::Path& colladaFile, const Optimi exportColladaMaterials(rootNode, mesh, mapNames, colladaFile); + S32 suffix; + String baseMeshName = String::GetTrailingNumber(outMeshName, suffix); + // Save out our geometry - exportColladaMesh(rootNode, mesh, outMeshName, mapNames); + exportColladaMesh(rootNode, mesh, baseMeshName, mapNames); // Save out our scene nodes - exportColladaScene(rootNode, outMeshName, mapNames); + exportColladaScene(rootNode, baseMeshName, mapNames); // Write out the actual Collada file char fullPath[MAX_PATH_LENGTH]; @@ -1740,4 +2884,139 @@ void ColladaUtils::exportToCollada(const Torque::Path& colladaFile, const Optimi if (!doc.SaveFile(fullPath)) Con::errorf("ColladaUtils::exportToCollada(): Unable to export to %s", fullPath); +} + +void ColladaUtils::exportToCollada(const Torque::Path& colladaFile, const ExportData& exportData) +{ + // Get the mesh name + String outMeshName = colladaFile.getFileName(); + + // The XML document that will hold all of our data + TiXmlDocument doc; + + // Add a standard XML declaration to the top + TiXmlDeclaration* xmlDecl = new TiXmlDeclaration("1.0", "utf-8", ""); + doc.LinkEndChild(xmlDecl); + + // Create our Collada root node and populate a couple standard attributes + TiXmlElement* rootNode = new TiXmlElement("COLLADA"); + rootNode->SetAttribute("xmlns", "http://www.collada.org/2005/11/COLLADASchema"); + rootNode->SetAttribute("version", "1.4.1"); + //rootNode->SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); //T3D Collada loader complaint about this. + + + // Add the root node to the document + doc.LinkEndChild(rootNode); + + // Save out our header info + exportColladaHeader(rootNode); + + // Save out the materials + Vector mapNames; + + exportColladaMaterials(rootNode, exportData, colladaFile); + + S32 suffix; + String baseMeshName = String::GetTrailingNumber(outMeshName, suffix); + + // Save out our geometry + exportColladaMesh(rootNode, exportData, baseMeshName); + + // Save out our scene nodes + exportColladaScene(rootNode, exportData, baseMeshName); + + // Write out the actual Collada file + char fullPath[MAX_PATH_LENGTH]; + Platform::makeFullPathName(colladaFile.getFullPath(), fullPath, MAX_PATH_LENGTH); + + if (!doc.SaveFile(fullPath)) + Con::errorf("ColladaUtils::exportToCollada(): Unable to export to %s", fullPath); +} + +void ColladaUtils::ExportData::processData() +{ + //This pref dictates if we 'backfill' lower LODs with higher ones if any given mesh being exported lacks that level. + //For example, if there are 2 meshes, and one has 500, 200, 100 and the other has 500 and 200 - if this setting is on, the second mesh + //will backfill the 200 to the 100 so it has all levels filled. If it's off, the second mesh will not render at the 100 level + bool fillLowDetailLevels = dAtob(Con::getVariable("$exportMesh::fillLowDetailLevels", "1")); + + S32 numDetailLevels = numberOfDetailLevels(); + + detailLevels.clear(); + detailLevels.setSize(numDetailLevels); + + for (U32 m = 0; m < meshData.size(); ++m) + { + for (U32 i = 0; i < numDetailLevels; ++i) + { + //Get our target size + S32 targetDetailLevelSize = getDetailLevelSize(i); + + //alright, step through each meshdata and propagate the polyList info 'up' to fill + detailLevel* curDetail = &detailLevels[i]; + + curDetail->size = targetDetailLevelSize; + + //Do we have a detail level for this? + S32 detailLevelIdx = -1; + + for (S32 mdl = i; mdl >= 0; mdl--) + { + //walk backwards as needed to find our first valid detail level for this mesh. if we find none, just move on + S32 testDetailLevelSize = getDetailLevelSize(mdl); + detailLevelIdx = meshData[m].hasDetailLevel(testDetailLevelSize); + + if (detailLevelIdx != -1) + break; + } + + if (detailLevelIdx == -1) + { + //found nothing backwards, so lets check if we're configured to back-fill the first detail levels + if (fillLowDetailLevels) + { + //if so, search forward, find the first valid detail and fill it in + for (S32 mdl = 0; mdl < numDetailLevels; mdl++) + { + //walk backwards as needed to find our first valid detail level for this mesh. if we find none, just move on + S32 testDetailLevelSize = getDetailLevelSize(mdl); + detailLevelIdx = meshData[m].hasDetailLevel(testDetailLevelSize); + + if (detailLevelIdx != -1) + break; + } + } + } + + //If we found the detail level index, go ahead and build out the data for it + if (detailLevelIdx != -1) + { + curDetail->mesh.setTransform(&meshData[m].meshTransform, meshData[m].scale); + curDetail->mesh.setObject(meshData[m].originatingObject); + + if (!meshData[m].shapeInst->buildPolyList(&curDetail->mesh, detailLevelIdx)) + { + Con::errorf("TSStatic::buildExportPolyList - failed to build polylist for LOD %i", i); + continue; + } + + //lastly, get material + for (U32 m = 0; m < curDetail->mesh.mMaterialList.size(); m++) + { + S32 matIdx = hasMaterialInstance(curDetail->mesh.mMaterialList[m]); + + if (matIdx == -1) + { + //cool, haven't already got this material, so lets store it out + materials.push_back(curDetail->mesh.mMaterialList[m]); + curDetail->materialRefList.insert(m, materials.size() - 1); + } + else + { + curDetail->materialRefList.insert(m, matIdx); + } + } + } + } + } } \ No newline at end of file diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 04592126e..4997a8803 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -50,6 +50,10 @@ #include "console/console.h" #endif +#ifndef _TSSHAPEINSTANCE_H_ +#include "ts/tsShapeInstance.h" +#endif + #include "platform/tmm_off.h" #include "dae.h" @@ -63,6 +67,7 @@ #include "dom/domCOLLADA.h" #include "platform/tmm_on.h" +#include "core/strings/findMatch.h" namespace ColladaUtils { @@ -100,7 +105,7 @@ namespace ColladaUtils { upAxis = UPAXISTYPE_COUNT; unit = -1.0f; - lodType = DetectDTS; + lodType = TrailingNumber; singleDetailSize = 2; matNamePrefix = ""; alwaysImport = ""; @@ -117,6 +122,123 @@ namespace ColladaUtils ImportOptions& getOptions(); + struct ExportData + { + struct detailLevel + { + OptimizedPolyList mesh; + S32 size; + Map materialRefList; + }; + + struct meshLODData + { + Vector meshDetailLevels; + TSShapeInstance* shapeInst; + MatrixF meshTransform; + SceneObject* originatingObject; + + Point3F scale; + + S32 hasDetailLevel(S32 size) + { + for (U32 i = 0; i < meshDetailLevels.size(); ++i) + { + U32 mdlSize = meshDetailLevels[i].size; + + if (mdlSize == size) + return i; + } + + return -1; + } + }; + + struct colMesh + { + OptimizedPolyList mesh; + String colMeshName; + }; + + Vector detailLevels; + Vector meshData; + Vector colMeshes; + Vector materials; + + void processData(); + + S32 hasDetailLevel(U32 dl) + { + for (U32 i = 0; i < detailLevels.size(); i++) + { + if (detailLevels[i].size == dl) + return i; + } + + return -1; + } + + S32 hasMaterialInstance(BaseMatInstance* matInst) + { + for (U32 i = 0; i < materials.size(); i++) + { + if (materials[i] == matInst) + return i; + } + + return -1; + } + + S32 numberOfDetailLevels() + { + Vector detailLevelIdxs; + + for (U32 i = 0; i < meshData.size(); ++i) + { + for (U32 d = 0; d < meshData[i].meshDetailLevels.size(); ++d) + { + detailLevelIdxs.push_back_unique(meshData[i].meshDetailLevels[d].size); + } + } + + return detailLevelIdxs.size(); + } + + static S32 _Sort(const S32 *p1, const S32 *p2) + { + S32 e1 = (*p1); + S32 e2 = (*p2); + + if (e1 > e2) + return 1; + else if (e1 < e2) + return -1; + + return 0; + } + + S32 getDetailLevelSize(U32 detailIdx) + { + Vector detailLevelIdxs; + + for (U32 i = 0; i < meshData.size(); ++i) + { + for (U32 d = 0; d < meshData[i].meshDetailLevels.size(); ++d) + { + S32 mdlSize = meshData[i].meshDetailLevels[d].size; + detailLevelIdxs.push_back_unique(mdlSize); + } + } + + if (detailIdx >= detailLevelIdxs.size()) + return -1; + + detailLevelIdxs.sort(&_Sort); + + return detailLevelIdxs[detailIdx]; + } + }; + void convertTransform(MatrixF& m); void collapsePath(std::string& path); @@ -139,8 +261,15 @@ namespace ColladaUtils void exportColladaMesh(TiXmlElement* rootNode, const OptimizedPolyList& mesh, const String& meshName, const Vector& matNames); void exportColladaScene(TiXmlElement* rootNode, const String& meshName, const Vector& matNames); + void exportColladaMaterials(TiXmlElement* rootNode, const ExportData& exportData, const Torque::Path& colladaFile); + void exportColladaMesh(TiXmlElement* rootNode, const ExportData& exportData, const String& meshName); + void exportColladaCollisionTriangles(TiXmlElement* meshNode, const ExportData& exportData, const U32 collisionIdx); + void exportColladaTriangles(TiXmlElement* meshNode, const ExportData& exportData, const U32 detailLevel, const String& meshName); + void exportColladaScene(TiXmlElement* rootNode, const ExportData& exportData, const String& meshName); + // Export an OptimizedPolyList to a simple Collada file void exportToCollada(const Torque::Path& colladaFile, const OptimizedPolyList& mesh, const String& meshName = String::EmptyString); + void exportToCollada(const Torque::Path& colladaFile, const ExportData& exportData); }; //----------------------------------------------------------------------------- @@ -535,7 +664,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTrian continue; domUint* pSrcData = &(P->getValue()[0]); - S32 numTriangles = (P->getValue().getCount() / stride) - 2; + size_t numTriangles = (P->getValue().getCount() / stride) - 2; // Convert the strip back to a triangle list domUint* v0 = pSrcData; @@ -576,7 +705,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriangl continue; domUint* pSrcData = &(P->getValue()[0]); - S32 numTriangles = (P->getValue().getCount() / stride) - 2; + size_t numTriangles = (P->getValue().getCount() / stride) - 2; // Convert the fan back to a triangle list domUint* v0 = pSrcData + stride; @@ -608,7 +737,7 @@ template<> inline const domListOfUInts *ColladaPrimitive::getTriang continue; domUint* pSrcData = &(P->getValue()[0]); - S32 numPoints = P->getValue().getCount() / stride; + size_t numPoints = P->getValue().getCount() / stride; // Use a simple tri-fan (centered at the first point) method of // converting the polygon to triangles. diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index dd2a67644..fc5465401 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -135,6 +135,20 @@ IMPLEMENT_CONOBJECT(TSShapeConstructor); TSShapeConstructor::TSShapeConstructor() : mShapePath(""), mLoadingShape(false) { + mOptions.upAxis = UPAXISTYPE_COUNT; + mOptions.unit = -1.0f; + mOptions.lodType = ColladaUtils::ImportOptions::TrailingNumber; + mOptions.singleDetailSize = 2; + mOptions.matNamePrefix = ""; + mOptions.alwaysImport = ""; + mOptions.neverImport = String(Con::getVariable("$TSShapeConstructor::neverImport")); + mOptions.alwaysImportMesh = ""; + mOptions.neverImportMesh = String(Con::getVariable("$TSShapeConstructor::neverImportMesh")); + mOptions.ignoreNodeScale = false; + mOptions.adjustCenter = false; + mOptions.adjustFloor = false; + mOptions.forceUpdateMaterials = false; + mOptions.useDiffuseNames = false; mShape = NULL; } From 787b8be82c1a5d6183308596c8ae865a6f858092 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 4 Mar 2018 15:10:44 -0600 Subject: [PATCH 140/312] Adds handling for the proper updated exporting of mesh for convexShapes --- Engine/source/T3D/convexShape.cpp | 51 +++++++++++++++++++++++ Engine/source/T3D/convexShape.h | 1 + Engine/source/ts/collada/colladaUtils.cpp | 26 ++++++++++-- Engine/source/ts/collada/colladaUtils.h | 5 +++ 4 files changed, 80 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index b5134be65..ceaa75616 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -697,6 +697,57 @@ bool ConvexShape::buildPolyList( PolyListContext context, AbstractPolyList *plis return true; } +bool ConvexShape::buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) +{ + if (mGeometry.points.empty()) + return false; + + //Get the collision mesh geometry + { + ColladaUtils::ExportData::colMesh* colMesh; + exportData->colMeshes.increment(); + colMesh = &exportData->colMeshes.last(); + + colMesh->mesh.setTransform(&mObjToWorld, mObjScale); + colMesh->mesh.setObject(this); + + //Just get the visible + buildPolyList(PLC_Export, &colMesh->mesh, getWorldBox(), getWorldSphere()); + + colMesh->colMeshName = String::ToString("ColMesh%d-1", exportData->colMeshes.size()); + } + + //Next, process the geometry and materials. + //Convex shapes only have the one 'level', so we'll just rely on the export post-process to back-fill + if (isServerObject() && getClientObject()) + { + ConvexShape* clientShape = dynamic_cast(getClientObject()); + + exportData->meshData.increment(); + + //Prep a meshData for this shape in particular + ColladaUtils::ExportData::meshLODData* meshData = &exportData->meshData.last(); + + //Fill out the info we'll need later to actually append our mesh data for the detail levels during the processing phase + meshData->shapeInst = nullptr; + meshData->originatingObject = this; + meshData->meshTransform = mObjToWorld; + meshData->scale = mObjScale; + meshData->fillWithSingleDetail = true; + + meshData->meshDetailLevels.increment(); + + ColladaUtils::ExportData::detailLevel* curDetail = &meshData->meshDetailLevels.last(); + + //Make sure we denote the size this detail level has + curDetail->size = getNextPow2(getObjBox().len()); + + bool t = true; + } + + return true; +} + void ConvexShape::_export( OptimizedPolyList *plist, const Box3F &box, const SphereF &sphere ) { BaseMatInstance *matInst = mMaterialInst; diff --git a/Engine/source/T3D/convexShape.h b/Engine/source/T3D/convexShape.h index d0f30eeaa..32d0122f5 100644 --- a/Engine/source/T3D/convexShape.h +++ b/Engine/source/T3D/convexShape.h @@ -172,6 +172,7 @@ public: virtual void prepRenderImage( SceneRenderState *state ); virtual void buildConvex( const Box3F &box, Convex *convex ); virtual bool buildPolyList( PolyListContext context, AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere ); + virtual bool buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); virtual bool castRay( const Point3F &start, const Point3F &end, RayInfo *info ); virtual bool collideBox( const Point3F &start, const Point3F &end, RayInfo *info ); diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index 32c559077..8ad5bff9b 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -26,6 +26,9 @@ #include "ts/collada/colladaUtils.h" #include "materials/matInstance.h" +//special handling for export classes +#include "T3D/convexShape.h" + using namespace ColladaUtils; #define MAX_PATH_LENGTH 256 @@ -2994,10 +2997,27 @@ void ColladaUtils::ExportData::processData() curDetail->mesh.setTransform(&meshData[m].meshTransform, meshData[m].scale); curDetail->mesh.setObject(meshData[m].originatingObject); - if (!meshData[m].shapeInst->buildPolyList(&curDetail->mesh, detailLevelIdx)) + if (meshData[m].shapeInst != nullptr) { - Con::errorf("TSStatic::buildExportPolyList - failed to build polylist for LOD %i", i); - continue; + + if (!meshData[m].shapeInst->buildPolyList(&curDetail->mesh, detailLevelIdx)) + { + Con::errorf("TSStatic::buildExportPolyList - failed to build polylist for LOD %i", i); + continue; + } + } + else + { + //special handling classes + ConvexShape* convexShp = dynamic_cast(meshData[m].originatingObject); + if (convexShp != nullptr) + { + if (!convexShp->buildPolyList(PLC_Export, &curDetail->mesh, meshData[m].originatingObject->getWorldBox(), meshData[m].originatingObject->getWorldSphere())) + { + Con::errorf("TSStatic::buildExportPolyList - failed to build ConvexShape polylist for LOD %i", i); + continue; + } + } } //lastly, get material diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 4997a8803..62a453ed3 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -140,6 +140,8 @@ namespace ColladaUtils Point3F scale; + bool fillWithSingleDetail; + S32 hasDetailLevel(S32 size) { for (U32 i = 0; i < meshDetailLevels.size(); ++i) @@ -152,6 +154,9 @@ namespace ColladaUtils return -1; } + + meshLODData() : shapeInst(nullptr), meshTransform(true), originatingObject(nullptr), scale(0), fillWithSingleDetail(false) + {} }; struct colMesh From 8dedcf456abb18932dab7207d60361ef07f09d73 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 4 Mar 2018 16:03:39 -0600 Subject: [PATCH 141/312] Cleanup of export function to remove redundant arg Removed unused var Cleaned up collision export on convexShape Added prefab export functionality --- Engine/source/T3D/convexShape.cpp | 6 ++---- Engine/source/T3D/convexShape.h | 2 +- Engine/source/T3D/prefab.cpp | 13 +++++++++++++ Engine/source/T3D/prefab.h | 2 ++ Engine/source/T3D/tsStatic.cpp | 2 +- Engine/source/T3D/tsStatic.h | 2 +- Engine/source/gui/worldEditor/worldEditor.cpp | 2 +- Engine/source/scene/sceneObject.h | 3 +-- Engine/source/ts/collada/colladaUtils.h | 4 +--- 9 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index ceaa75616..d73d387bd 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -697,7 +697,7 @@ bool ConvexShape::buildPolyList( PolyListContext context, AbstractPolyList *plis return true; } -bool ConvexShape::buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) +bool ConvexShape::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) { if (mGeometry.points.empty()) return false; @@ -740,9 +740,7 @@ bool ConvexShape::buildExportPolyList(PolyListContext context, ColladaUtils::Exp ColladaUtils::ExportData::detailLevel* curDetail = &meshData->meshDetailLevels.last(); //Make sure we denote the size this detail level has - curDetail->size = getNextPow2(getObjBox().len()); - - bool t = true; + curDetail->size = 512; } return true; diff --git a/Engine/source/T3D/convexShape.h b/Engine/source/T3D/convexShape.h index 32d0122f5..413877a36 100644 --- a/Engine/source/T3D/convexShape.h +++ b/Engine/source/T3D/convexShape.h @@ -172,7 +172,7 @@ public: virtual void prepRenderImage( SceneRenderState *state ); virtual void buildConvex( const Box3F &box, Convex *convex ); virtual bool buildPolyList( PolyListContext context, AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere ); - virtual bool buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); + virtual bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); virtual bool castRay( const Point3F &start, const Point3F &end, RayInfo *info ); virtual bool collideBox( const Point3F &start, const Point3F &end, RayInfo *info ); diff --git a/Engine/source/T3D/prefab.cpp b/Engine/source/T3D/prefab.cpp index 6d357565f..a30a24217 100644 --- a/Engine/source/T3D/prefab.cpp +++ b/Engine/source/T3D/prefab.cpp @@ -538,6 +538,19 @@ bool Prefab::buildPolyList(PolyListContext context, AbstractPolyList* polyList, return true; } +bool Prefab::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &sphere) +{ + Vector foundObjects; + mChildGroup->findObjectByType(foundObjects); + + for (S32 i = 0; i < foundObjects.size(); i++) + { + foundObjects[i]->buildExportPolyList(exportData, box, sphere); + } + + return true; +} + ExplodePrefabUndoAction::ExplodePrefabUndoAction( Prefab *prefab ) : UndoAction( "Explode Prefab" ) { diff --git a/Engine/source/T3D/prefab.h b/Engine/source/T3D/prefab.h index 48d87c232..fd1ebc2a4 100644 --- a/Engine/source/T3D/prefab.h +++ b/Engine/source/T3D/prefab.h @@ -98,6 +98,8 @@ public: bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere); + bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); + protected: void _closeFile( bool removeFileNotify ); diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 9eaab881b..68b5333df 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1073,7 +1073,7 @@ bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList return true; } -bool TSStatic::buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) +bool TSStatic::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &) { if (!mShapeInstance) return false; diff --git a/Engine/source/T3D/tsStatic.h b/Engine/source/T3D/tsStatic.h index 2df45a861..9c6918c8d 100644 --- a/Engine/source/T3D/tsStatic.h +++ b/Engine/source/T3D/tsStatic.h @@ -138,7 +138,7 @@ protected: bool castRay(const Point3F &start, const Point3F &end, RayInfo* info); bool castRayRendered(const Point3F &start, const Point3F &end, RayInfo* info); bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere); - bool buildExportPolyList(PolyListContext context, ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); + bool buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F &box, const SphereF &); void buildConvex(const Box3F& box, Convex* convex); bool _createShape(); diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index ca6c966ae..b66ead790 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -3932,7 +3932,7 @@ void WorldEditor::makeSelectionAMesh(const char *filename) for (S32 i = 0; i < objectList.size(); i++) { SceneObject *pObj = objectList[i]; - if (!pObj->buildExportPolyList(PLC_Export, &exportData, pObj->getWorldBox(), pObj->getWorldSphere())) + if (!pObj->buildExportPolyList(&exportData, pObj->getWorldBox(), pObj->getWorldSphere())) Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId()); } diff --git a/Engine/source/scene/sceneObject.h b/Engine/source/scene/sceneObject.h index 3e7fab355..34060acce 100644 --- a/Engine/source/scene/sceneObject.h +++ b/Engine/source/scene/sceneObject.h @@ -564,8 +564,7 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce /// @param box Box bounding volume /// @param sphere Sphere bounding volume /// - virtual bool buildExportPolyList(PolyListContext context, - ColladaUtils::ExportData *exportData, + virtual bool buildExportPolyList(ColladaUtils::ExportData *exportData, const Box3F& box, const SphereF& sphere) { return false; diff --git a/Engine/source/ts/collada/colladaUtils.h b/Engine/source/ts/collada/colladaUtils.h index 62a453ed3..144a62c7b 100644 --- a/Engine/source/ts/collada/colladaUtils.h +++ b/Engine/source/ts/collada/colladaUtils.h @@ -140,8 +140,6 @@ namespace ColladaUtils Point3F scale; - bool fillWithSingleDetail; - S32 hasDetailLevel(S32 size) { for (U32 i = 0; i < meshDetailLevels.size(); ++i) @@ -155,7 +153,7 @@ namespace ColladaUtils return -1; } - meshLODData() : shapeInst(nullptr), meshTransform(true), originatingObject(nullptr), scale(0), fillWithSingleDetail(false) + meshLODData() : shapeInst(nullptr), meshTransform(true), originatingObject(nullptr), scale(0) {} }; From 53f35e7fb1ce747336af1014f7c852d2ec9b4d2f Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Mon, 5 Mar 2018 23:48:09 -0500 Subject: [PATCH 142/312] Removed unused macString.mm that has old versions of string functions with no bounds checking --- Engine/source/platformMac/macString.mm | 69 -------------------------- 1 file changed, 69 deletions(-) delete mode 100644 Engine/source/platformMac/macString.mm diff --git a/Engine/source/platformMac/macString.mm b/Engine/source/platformMac/macString.mm deleted file mode 100644 index 3a255d924..000000000 --- a/Engine/source/platformMac/macString.mm +++ /dev/null @@ -1,69 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#import "platform/platform.h" -#import -#import -#import -#import -#import -#import "core/strings/stringFunctions.h" - -char *dStrnew(const char *src) -{ - char *buffer = new char[dStrlen(src) + 1]; - dStrcpy(buffer, src); - return buffer; -} - -char* dStrstr(char *str1, char *str2) -{ - return strstr(str1,str2); -} - -int dSprintf(char *buffer, dsize_t /*bufferSize*/, const char *format, ...) -{ - va_list args; - va_start(args, format); - S32 len = vsprintf(buffer, format, args); - va_end(args); - return (len); -} - - -int dVsprintf(char *buffer, dsize_t /*bufferSize*/, const char *format, va_list arglist) -{ - S32 len = vsprintf(buffer, format, arglist); - - return (len); -} - -int dFflushStdout() -{ - return fflush(stdout); -} - -int dFflushStderr() -{ - return fflush(stderr); -} - From 7769da9434ab7f3ccbac40daf7d34d4f02444594 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 6 Mar 2018 00:48:44 -0500 Subject: [PATCH 143/312] Use strncat instead of strcat to prevent some buffer overflows --- Engine/source/T3D/shapeImage.cpp | 2 +- Engine/source/afx/arcaneFX.cpp | 6 +- Engine/source/afx/rpg/afxRPGMagicSpell.cpp | 2 +- Engine/source/app/net/net.cpp | 4 +- Engine/source/console/codeInterpreter.cpp | 22 +++--- Engine/source/console/compiledEval.cpp | 4 +- Engine/source/console/console.cpp | 4 +- Engine/source/console/consoleFunctions.cpp | 6 +- Engine/source/console/consoleInternal.cpp | 18 ++--- Engine/source/console/consoleObject.cpp | 12 +-- Engine/source/console/fieldBrushObject.cpp | 2 +- Engine/source/console/persistenceManager.cpp | 8 +- Engine/source/console/scriptFilename.cpp | 2 +- Engine/source/console/simFieldDictionary.cpp | 2 +- Engine/source/console/simObject.cpp | 12 +-- Engine/source/console/telnetDebugger.cpp | 10 +-- Engine/source/core/strings/stringFunctions.h | 14 +++- Engine/source/core/strings/stringUnit.cpp | 6 +- Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp | 2 +- Engine/source/gui/containers/guiFormCtrl.cpp | 4 +- .../gui/controls/guiDirectoryFileListCtrl.cpp | 2 +- Engine/source/gui/controls/guiListBoxCtrl.cpp | 2 +- Engine/source/gui/editor/guiFilterCtrl.cpp | 4 +- .../source/gui/worldEditor/terrainEditor.cpp | 8 +- .../source/materials/materialDefinition.cpp | 10 +-- Engine/source/platform/profiler.cpp | 4 +- Engine/source/platformPOSIX/posixVolume.cpp | 2 +- .../source/platformWin32/winDInputDevice.cpp | 14 ++-- Engine/source/platformWin32/winFileio.cpp | 9 ++- Engine/source/sim/actionMap.cpp | 78 +++++++++---------- Engine/source/sim/netStringTable.cpp | 2 +- Engine/source/terrain/terrData.cpp | 4 +- 32 files changed, 147 insertions(+), 134 deletions(-) diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index 627e8e433..4319baa4e 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -522,7 +522,7 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr) if (stateSequence[j] && stateSequence[j][0] && stateSequenceRandomFlash[j]) { char bufferVis[128]; dStrncpy(bufferVis, stateSequence[j], 100); - dStrcat(bufferVis, "_vis"); + dStrcat(bufferVis, "_vis", 128); s.sequenceVis[i] = shape[i]->findSequence(bufferVis); } if (s.sequenceVis[i] != -1) diff --git a/Engine/source/afx/arcaneFX.cpp b/Engine/source/afx/arcaneFX.cpp index 59da040ea..8ec0e9760 100644 --- a/Engine/source/afx/arcaneFX.cpp +++ b/Engine/source/afx/arcaneFX.cpp @@ -908,7 +908,7 @@ ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)" char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i]); + dStrcat(ret, argv[i], len); Con::printf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; @@ -928,7 +928,7 @@ ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)" char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i]); + dStrcat(ret, argv[i], len); Con::warnf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; @@ -948,7 +948,7 @@ ConsoleFunction(errorThru, const char*, 2, 0, "(string passthru, string text...) char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i]); + dStrcat(ret, argv[i], len); Con::errorf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; diff --git a/Engine/source/afx/rpg/afxRPGMagicSpell.cpp b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp index dae982fa8..6490ad260 100644 --- a/Engine/source/afx/rpg/afxRPGMagicSpell.cpp +++ b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp @@ -227,7 +227,7 @@ char* afxRPGMagicSpellData::formatDesc(char* buffer, int len) const { dStrcpy(target_str, _afxRPGMagicSpell_TargetType::_sEnumTable[i].mName); if (spell_target != TARGET_FREE && target_optional) - dStrcat(target_str, " (opt)"); + dStrcat(target_str, " (opt)", 32); } break; } diff --git a/Engine/source/app/net/net.cpp b/Engine/source/app/net/net.cpp index ab08da057..f668d2651 100644 --- a/Engine/source/app/net/net.cpp +++ b/Engine/source/app/net/net.cpp @@ -129,7 +129,7 @@ if(conn->isConnectionToServer()) { dStrcpy(mBuf, "clientCmd"); - dStrcat(mBuf, rmtCommandName); + dStrcat(mBuf, rmtCommandName, 1024); char *temp = mArgv[1]; mArgv[1] = mBuf; @@ -140,7 +140,7 @@ else { dStrcpy(mBuf, "serverCmd"); - dStrcat(mBuf, rmtCommandName); + dStrcat(mBuf, rmtCommandName, 1024); char *temp = mArgv[1]; dSprintf(idBuf, sizeof(idBuf), "%d", conn->getId()); diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index a0e13502f..0b5986fda 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -420,13 +420,13 @@ exitLabel: if (gEvalState.traceOn) { sTraceBuffer[0] = 0; - dStrcat(sTraceBuffer, "Leaving "); + dStrcat(sTraceBuffer, "Leaving ", 1024); if (packageName) { - dStrcat(sTraceBuffer, "["); - dStrcat(sTraceBuffer, packageName); - dStrcat(sTraceBuffer, "]"); + dStrcat(sTraceBuffer, "[", 1024); + dStrcat(sTraceBuffer, packageName, 1024); + dStrcat(sTraceBuffer, "]", 1024); } if (thisNamespace && thisNamespace->mName) { @@ -471,13 +471,13 @@ void CodeInterpreter::parseArgs(U32 &ip) if (gEvalState.traceOn) { sTraceBuffer[0] = 0; - dStrcat(sTraceBuffer, "Entering "); + dStrcat(sTraceBuffer, "Entering ", 1024); if (mExec.packageName) { - dStrcat(sTraceBuffer, "["); - dStrcat(sTraceBuffer, mExec.packageName); - dStrcat(sTraceBuffer, "]"); + dStrcat(sTraceBuffer, "[", 1024); + dStrcat(sTraceBuffer, mExec.packageName, 1024); + dStrcat(sTraceBuffer, "]", 1024); } if (mExec.thisNamespace && mExec.thisNamespace->mName) { @@ -491,11 +491,11 @@ void CodeInterpreter::parseArgs(U32 &ip) } for (S32 i = 0; i < wantedArgc; i++) { - dStrcat(sTraceBuffer, mExec.argv[i + 1]); + dStrcat(sTraceBuffer, mExec.argv[i + 1], 1024); if (i != wantedArgc - 1) - dStrcat(sTraceBuffer, ", "); + dStrcat(sTraceBuffer, ", ", 1024); } - dStrcat(sTraceBuffer, ")"); + dStrcat(sTraceBuffer, ")", 1024); Con::printf("%s", sTraceBuffer); } diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index dc6f8a5f5..73969afb2 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -70,9 +70,9 @@ namespace Con ret[0] = 0; for (walk = ns; walk; walk = walk->mParent) { - dStrcat(ret, walk->mName); + dStrcat(ret, walk->mName, size); if (walk->mParent) - dStrcat(ret, " -> "); + dStrcat(ret, " -> ", size); } return ret; } diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index c3779de63..ff204a448 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -2176,8 +2176,8 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor } // Format the output path. - dStrncat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer)); - dStrncat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer)); + dStrcat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer)); + dStrcat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer)); // Are we ensuring the trailing slash? if (ensureTrailingSlash) diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index df89a788a..16c20c3c3 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -1889,7 +1889,7 @@ ConsoleFunction( echo, void, 2, 0, "( string message... ) " char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 1; i < argc; i++) - dStrcat(ret, argv[i]); + dStrcat(ret, argv[i], len); Con::printf("%s", ret); ret[0] = 0; @@ -1913,7 +1913,7 @@ ConsoleFunction( warn, void, 2, 0, "( string message... ) " char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 1; i < argc; i++) - dStrcat(ret, argv[i]); + dStrcat(ret, argv[i], len); Con::warnf(ConsoleLogEntry::General, "%s", ret); ret[0] = 0; @@ -1937,7 +1937,7 @@ ConsoleFunction( error, void, 2, 0, "( string message... ) " char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 1; i < argc; i++) - dStrcat(ret, argv[i]); + dStrcat(ret, argv[i], len); Con::errorf(ConsoleLogEntry::General, "%s", ret); ret[0] = 0; diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index eadee5d7b..3f5c78f67 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -900,21 +900,21 @@ DefineEngineFunction(backtrace, void, (), , buf[0] = 0; for (U32 i = 0; i < gEvalState.getStackDepth(); i++) { - dStrcat(buf, "->"); + dStrcat(buf, "->", totalSize); if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage) { - dStrcat(buf, "["); - dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage); - dStrcat(buf, "]"); + dStrcat(buf, "[", totalSize); + dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mEntryList->mPackage, totalSize); + dStrcat(buf, "]", totalSize); } if (gEvalState.stack[i]->scopeNamespace && gEvalState.stack[i]->scopeNamespace->mName) { - dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mName); - dStrcat(buf, "::"); + dStrcat(buf, gEvalState.stack[i]->scopeNamespace->mName, totalSize); + dStrcat(buf, "::", totalSize); } if (gEvalState.stack[i]->scopeName) - dStrcat(buf, gEvalState.stack[i]->scopeName); + dStrcat(buf, gEvalState.stack[i]->scopeName, totalSize); } Con::printf("BackTrace: %s", buf); @@ -1362,7 +1362,7 @@ void Namespace::addScriptCallback(const char *funcName, const char *usage, Conso char lilBuffer[32]; dStrcpy(buffer, funcName); dSprintf(lilBuffer, 32, "_%d_cb", uid++); - dStrcat(buffer, lilBuffer); + dStrcat(buffer, lilBuffer, 1024); Entry *ent = createLocalEntry(StringTable->insert(buffer)); trashCache(); @@ -1383,7 +1383,7 @@ void Namespace::markGroup(const char* name, const char* usage) char lilBuffer[32]; dStrcpy(buffer, name); dSprintf(lilBuffer, 32, "_%d", uid++); - dStrcat(buffer, lilBuffer); + dStrcat(buffer, lilBuffer, 1024); Entry *ent = createLocalEntry(StringTable->insert(buffer)); trashCache(); diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index e1744c5e1..32c84f20b 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -356,7 +356,7 @@ void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDoc char* pFieldNameBuf = suppressSpaces(in_pGroupname); // Append group type to fieldname. - dStrcat(pFieldNameBuf, "_begingroup"); + dStrcat(pFieldNameBuf, "_begingroup", 1024); // Create Field. AbstractClassRep::Field f; @@ -385,7 +385,7 @@ void ConsoleObject::endGroup(const char* in_pGroupname) char* pFieldNameBuf = suppressSpaces(in_pGroupname); // Append group type to fieldname. - dStrcat(pFieldNameBuf, "_endgroup"); + dStrcat(pFieldNameBuf, "_endgroup", 1024); // Create Field. AbstractClassRep::Field f; @@ -407,7 +407,7 @@ void ConsoleObject::endGroup(const char* in_pGroupname) void ConsoleObject::addArray( const char *arrayName, S32 count ) { char *nameBuff = suppressSpaces(arrayName); - dStrcat(nameBuff, "_beginarray"); + dStrcat(nameBuff, "_beginarray", 1024); // Create Field. AbstractClassRep::Field f; @@ -430,7 +430,7 @@ void ConsoleObject::addArray( const char *arrayName, S32 count ) void ConsoleObject::endArray( const char *arrayName ) { char *nameBuff = suppressSpaces(arrayName); - dStrcat(nameBuff, "_endarray"); + dStrcat(nameBuff, "_endarray", 1024); // Create Field. AbstractClassRep::Field f; @@ -776,8 +776,8 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu dStrcpy( ret, classes[ 0 ]->getClassName() ); for( U32 i = 1; i < classes.size(); i ++ ) { - dStrcat( ret, "\t" ); - dStrcat( ret, classes[ i ]->getClassName() ); + dStrcat( ret, "\t", bufSize ); + dStrcat( ret, classes[ i ]->getClassName(), bufSize ); } return ret; diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index 407a57cb3..e96387cae 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -275,7 +275,7 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim // Copy string element. dStrcpy( tempBuf, StringUnit::getUnit( groupList, groupIndex, " \t\n" ) ); // Append internal name. - dStrcat( tempBuf, "_begingroup" ); + dStrcat( tempBuf, "_begingroup", 256 ); // Store Group. groups.push_back( StringTable->insert( tempBuf ) ); } diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index c4af549ed..db7b7254e 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -967,10 +967,10 @@ void PersistenceManager::updateToken( const U32 lineNumber, const U32 linePositi // Build the new line with the // preString + newValue + postString - dStrcat(newLine, preString); + dStrcat(newLine, preString, newLineLen); if ( newValue ) - dStrcat(newLine, newValue); - dStrcat(newLine, postString); + dStrcat(newLine, newValue, newLineLen); + dStrcat(newLine, postString, newLineLen); // Clear our existing line if (mLineBuffer[lineNumber]) @@ -1243,7 +1243,7 @@ PersistenceManager::ParsedObject* PersistenceManager::writeNewObject(SimObject* char* indent = getObjectIndent(parentObject); if (parentObject) - dStrcat(indent, " \0"); + dStrcat(indent, " \0", 2048); // Write out the beginning of the object declaration const char* dclToken = "new"; diff --git a/Engine/source/console/scriptFilename.cpp b/Engine/source/console/scriptFilename.cpp index 7a72756af..9455826f7 100644 --- a/Engine/source/console/scriptFilename.cpp +++ b/Engine/source/console/scriptFilename.cpp @@ -325,7 +325,7 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src) *filename = 0; if(*test[i].replace) dSprintf(filename, size, "%s/", test[i].replace); - dStrcat(filename, rel); + dStrcat(filename, rel, size); return true; } diff --git a/Engine/source/console/simFieldDictionary.cpp b/Engine/source/console/simFieldDictionary.cpp index f68a8689b..397b51d23 100644 --- a/Engine/source/console/simFieldDictionary.cpp +++ b/Engine/source/console/simFieldDictionary.cpp @@ -281,7 +281,7 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop dSprintf(expandedBuffer, nBufferSize, "%s%s%s = \"", typeName, *typeName ? " " : "", (*itr)->slotName); if ((*itr)->value) expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), (*itr)->value); - dStrcat(expandedBuffer, "\";\r\n"); + dStrcat(expandedBuffer, "\";\r\n", nBufferSize); stream.write(dStrlen(expandedBuffer), expandedBuffer); } diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index ef688228f..0d2e5eb32 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -347,7 +347,7 @@ void SimObject::writeFields(Stream &stream, U32 tabStop) } expandEscape((char*)expandedBuffer + dStrlen(expandedBuffer), val); - dStrcat(expandedBuffer, "\";\r\n"); + dStrcat(expandedBuffer, "\";\r\n", expandedBufferSize); stream.writeTabs(tabStop); stream.write(dStrlen(expandedBuffer),expandedBuffer); @@ -1029,7 +1029,7 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const { char buf[256]; dStrcpy(buf, slotName); - dStrcat(buf, array); + dStrcat(buf, array, 256); StringTableEntry permanentSlotName = StringTable->insert(buf); mFieldDictionary->setFieldValue(permanentSlotName, value); onDynamicModified( permanentSlotName, value ); @@ -1070,7 +1070,7 @@ const char *SimObject::getDataField(StringTableEntry slotName, const char *array { static char buf[256]; dStrcpy(buf, slotName); - dStrcat(buf, array); + dStrcat(buf, array, 256); if (const char* val = mFieldDictionary->getFieldValue(StringTable->insert(buf))) return val; } @@ -1311,7 +1311,7 @@ U32 SimObject::getDataFieldType( StringTableEntry slotName, const char* array ) { static char buf[256]; dStrcpy( buf, slotName ); - dStrcat( buf, array ); + dStrcat( buf, array, 256 ); return mFieldDictionary->getFieldType( StringTable->insert( buf ) ); } @@ -1334,7 +1334,7 @@ void SimObject::setDataFieldType(const U32 fieldTypeId, StringTableEntry slotNam { static char buf[256]; dStrcpy( buf, slotName ); - dStrcat( buf, array ); + dStrcat( buf, array, 256 ); mFieldDictionary->setFieldType( StringTable->insert( buf ), fieldTypeId ); onDynamicModified( slotName, mFieldDictionary->getFieldValue(slotName) ); @@ -1355,7 +1355,7 @@ void SimObject::setDataFieldType(const char *typeName, StringTableEntry slotName { static char buf[256]; dStrcpy( buf, slotName ); - dStrcat( buf, array ); + dStrcat( buf, array, 256 ); StringTableEntry permanentSlotName = StringTable->insert(buf); mFieldDictionary->setFieldType( permanentSlotName, typeName ); diff --git a/Engine/source/console/telnetDebugger.cpp b/Engine/source/console/telnetDebugger.cpp index 7db6e9710..7cb39dc83 100644 --- a/Engine/source/console/telnetDebugger.cpp +++ b/Engine/source/console/telnetDebugger.cpp @@ -470,19 +470,19 @@ void TelnetDebugger::sendBreak() if ( ns ) { if ( ns->mParent && ns->mParent->mPackage && ns->mParent->mPackage[0] ) { - dStrcat( scope, ns->mParent->mPackage ); - dStrcat( scope, "::" ); + dStrcat( scope, ns->mParent->mPackage, MaxCommandSize ); + dStrcat( scope, "::", MaxCommandSize ); } if ( ns->mName && ns->mName[0] ) { - dStrcat( scope, ns->mName ); - dStrcat( scope, "::" ); + dStrcat( scope, ns->mName, MaxCommandSize ); + dStrcat( scope, "::", MaxCommandSize ); } } const char *function = gEvalState.stack[i]->scopeName; if ((!function) || (!function[0])) function = ""; - dStrcat( scope, function ); + dStrcat( scope, function, MaxCommandSize ); U32 line=0, inst; U32 ip = gEvalState.stack[i]->ip; diff --git a/Engine/source/core/strings/stringFunctions.h b/Engine/source/core/strings/stringFunctions.h index 6a3d54548..4c79bf32d 100644 --- a/Engine/source/core/strings/stringFunctions.h +++ b/Engine/source/core/strings/stringFunctions.h @@ -32,6 +32,10 @@ #include "platform/types.h" #endif +#ifndef _PLATFORMASSERT_H_ +#include "platform/platformAssert.h" +#endif + #if defined(TORQUE_OS_WIN) // These standard functions are not defined on Win32 and other Microsoft platforms... #define strcasecmp _stricmp @@ -47,14 +51,22 @@ //------------------------------------------------------------------------------ // standard string functions [defined in platformString.cpp] +/// @deprecated Use dStrcat(char *, const char *, dsize_t) instead inline char *dStrcat(char *dst, const char *src) { + AssertFatal(false, "dStrcat without length is deprecated"); return strcat(dst,src); } +inline char *dStrcat(char *dst, const char *src, dsize_t len) +{ + return strncat(dst,src,len - 1); //Safety because strncat copies at most len+1 characters +} + inline char *dStrncat(char *dst, const char *src, dsize_t len) { - return strncat(dst,src,len); + AssertFatal(false, "Use dStrcat with length"); + return dStrcat(dst, src, len); } inline S32 dStrcmp(const char *str1, const char *str2) diff --git a/Engine/source/core/strings/stringUnit.cpp b/Engine/source/core/strings/stringUnit.cpp index dc666f38c..0012d60e6 100644 --- a/Engine/source/core/strings/stringUnit.cpp +++ b/Engine/source/core/strings/stringUnit.cpp @@ -164,7 +164,7 @@ namespace StringUnit // replace this unit ret[sz] = '\0'; - dStrcat(ret, replace); + dStrcat(ret, replace, 2048); // copy remaining chunks sz = dStrcspn(string, set); // skip chunk we're replacing @@ -172,7 +172,7 @@ namespace StringUnit return ret; string += sz; - dStrcat(ret, string); + dStrcat(ret, string, 2048); return ret; } @@ -211,7 +211,7 @@ namespace StringUnit } string += sz + 1; // skip the extra field delimiter - dStrcat(ret, string); + dStrcat(ret, string, 2048); return ret; } } diff --git a/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp b/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp index 3f3245c91..d909750b9 100644 --- a/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp +++ b/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp @@ -129,7 +129,7 @@ void GFXGLDevice::enumerateAdapters( Vector &adapterList ) if (renderer) { dStrcpy(toAdd->mName, renderer); - dStrncat(toAdd->mName, " OpenGL", GFXAdapter::MaxAdapterNameLen); + dStrcat(toAdd->mName, " OpenGL", GFXAdapter::MaxAdapterNameLen); } else dStrcpy(toAdd->mName, "OpenGL"); diff --git a/Engine/source/gui/containers/guiFormCtrl.cpp b/Engine/source/gui/containers/guiFormCtrl.cpp index f94e6c234..a185af1e2 100644 --- a/Engine/source/gui/containers/guiFormCtrl.cpp +++ b/Engine/source/gui/containers/guiFormCtrl.cpp @@ -219,8 +219,8 @@ bool GuiFormCtrl::resize(const Point2I &newPosition, const Point2I &newExtent) for(S32 i=strlen; i>=0; --i) { dStrcpy(buf, ""); - dStrncat(buf, (const char*)mCaption, i); - dStrcat(buf, "..."); + dStrcat(buf, (const char*)mCaption, i); + dStrcat(buf, "...", i); textWidth = mProfile->mFont->getStrWidth(buf); diff --git a/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp b/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp index c244af658..420ddc575 100644 --- a/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp +++ b/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp @@ -195,7 +195,7 @@ DefineEngineMethod( GuiDirectoryFileListCtrl, getSelectedFiles, const char*, (), dMemset( itemBuffer, 0, itemBufSize ); dSprintf( itemBuffer, itemBufSize, " %s", itemText ); - dStrcat( returnBuffer, itemBuffer ); + dStrcat( returnBuffer, itemBuffer, itemBufSize ); } return returnBuffer; diff --git a/Engine/source/gui/controls/guiListBoxCtrl.cpp b/Engine/source/gui/controls/guiListBoxCtrl.cpp index 8c0dabb11..d47914d3d 100644 --- a/Engine/source/gui/controls/guiListBoxCtrl.cpp +++ b/Engine/source/gui/controls/guiListBoxCtrl.cpp @@ -458,7 +458,7 @@ DefineEngineMethod( GuiListBoxCtrl, getSelectedItems, const char*, (),, { UTF8 retFormat[12]; dSprintf( retFormat, 12, "%d ", (*i) ); - dStrcat( retBuffer, retFormat ); + dStrcat( retBuffer, retFormat, 12 ); } return retBuffer; diff --git a/Engine/source/gui/editor/guiFilterCtrl.cpp b/Engine/source/gui/editor/guiFilterCtrl.cpp index a00d4f670..6b7662bd5 100644 --- a/Engine/source/gui/editor/guiFilterCtrl.cpp +++ b/Engine/source/gui/editor/guiFilterCtrl.cpp @@ -70,8 +70,8 @@ DefineConsoleMethod( GuiFilterCtrl, getValue, const char*, (), , "Return a tuple for (U32 i=0; i < filter->size(); i++) { char value[32]; - dSprintf(value, 31, "%1.5f ", *(filter->begin()+i) ); - dStrcat(buffer, value); + dSprintf(value, 32, "%1.5f ", *(filter->begin()+i) ); + dStrcat(buffer, value, 32); } return buffer; diff --git a/Engine/source/gui/worldEditor/terrainEditor.cpp b/Engine/source/gui/worldEditor/terrainEditor.cpp index 59d8adaca..8e81d84e3 100644 --- a/Engine/source/gui/worldEditor/terrainEditor.cpp +++ b/Engine/source/gui/worldEditor/terrainEditor.cpp @@ -2495,8 +2495,8 @@ DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, ( ret[0] = 0; for(U32 i = 0; i < list.size(); ++i) { - dStrcat( ret, list[i] ); - dStrcat( ret, "\n" ); + dStrcat( ret, list[i], size ); + dStrcat( ret, "\n", size ); } return ret; @@ -2709,8 +2709,8 @@ DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets th ret[0] = 0; for(U32 i = 0; i < terr->getMaterialCount(); i++) { - dStrcat( ret, terr->getMaterialName(i) ); - dStrcat( ret, "\n" ); + dStrcat( ret, terr->getMaterialName(i), 4096 ); + dStrcat( ret, "\n", 4096 ); } return ret; diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index d4ec8ed7d..d116fe0f3 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -661,28 +661,28 @@ DefineConsoleMethod( Material, getAnimFlags, const char*, (U32 id), , "" ) if(dStrcmp( animFlags, "" ) == 0) dStrcpy( animFlags, "$Rotate" ); else - dStrcat( animFlags, " | $Rotate"); + dStrcat( animFlags, " | $Rotate", 512); } if(object->mAnimFlags[ id ] & Material::Wave) { if(dStrcmp( animFlags, "" ) == 0) dStrcpy( animFlags, "$Wave" ); else - dStrcat( animFlags, " | $Wave"); + dStrcat( animFlags, " | $Wave", 512); } if(object->mAnimFlags[ id ] & Material::Scale) { if(dStrcmp( animFlags, "" ) == 0) dStrcpy( animFlags, "$Scale" ); else - dStrcat( animFlags, " | $Scale"); + dStrcat( animFlags, " | $Scale", 512); } if(object->mAnimFlags[ id ] & Material::Sequence) { if(dStrcmp( animFlags, "" ) == 0) dStrcpy( animFlags, "$Sequence" ); else - dStrcat( animFlags, " | $Sequence"); + dStrcat( animFlags, " | $Sequence", 512); } return animFlags; @@ -718,4 +718,4 @@ bool Material::_setAccuEnabled( void *object, const char *index, const char *dat AccumulationVolume::refreshVolumes(); } return true; -} \ No newline at end of file +} diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index 444679284..e70eb6c02 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -329,8 +329,8 @@ const char * Profiler::constructProfilePath(ProfilerData * pd) U32 mark = FrameAllocator::getWaterMark(); char * buf = (char*)FrameAllocator::alloc(len+1); dStrcpy(buf,pd->mParent->mPath); - dStrcat(buf,connector); - dStrcat(buf,pd->mRoot->mName); + dStrcat(buf,connector,len); + dStrcat(buf,pd->mRoot->mName,len); const char * ret = StringTable->insert(buf); FrameAllocator::setWaterMark(mark); diff --git a/Engine/source/platformPOSIX/posixVolume.cpp b/Engine/source/platformPOSIX/posixVolume.cpp index 0f39bea3c..271df1e18 100644 --- a/Engine/source/platformPOSIX/posixVolume.cpp +++ b/Engine/source/platformPOSIX/posixVolume.cpp @@ -585,7 +585,7 @@ bool Platform::FS::InstallFileSystems() { // add trailing '/' if it isn't there if (buffer[dStrlen(buffer) - 1] != '/') - dStrcat(buffer, "/"); + dStrcat(buffer, "/", PATH_MAX); Platform::FS::SetCwd(buffer); } diff --git a/Engine/source/platformWin32/winDInputDevice.cpp b/Engine/source/platformWin32/winDInputDevice.cpp index a88f9ff1d..1bfed04f8 100644 --- a/Engine/source/platformWin32/winDInputDevice.cpp +++ b/Engine/source/platformWin32/winDInputDevice.cpp @@ -1552,25 +1552,25 @@ const char* DInputDevice::getJoystickAxesString() switch ( mObjInfo[i].mInst ) { case SI_XAXIS: - dStrcat( buf, "\tX" ); + dStrcat( buf, "\tX", 64 ); break; case SI_YAXIS: - dStrcat( buf, "\tY" ); + dStrcat( buf, "\tY", 64 ); break; case SI_ZAXIS: - dStrcat( buf, "\tZ" ); + dStrcat( buf, "\tZ", 64 ); break; case SI_RXAXIS: - dStrcat( buf, "\tR" ); + dStrcat( buf, "\tR", 64 ); break; case SI_RYAXIS: - dStrcat( buf, "\tU" ); + dStrcat( buf, "\tU", 64 ); break; case SI_RZAXIS: - dStrcat( buf, "\tV" ); + dStrcat( buf, "\tV", 64 ); break; case SI_SLIDER: - dStrcat( buf, "\tS" ); + dStrcat( buf, "\tS", 64 ); break; } } diff --git a/Engine/source/platformWin32/winFileio.cpp b/Engine/source/platformWin32/winFileio.cpp index 85f8676a3..1fba156f5 100644 --- a/Engine/source/platformWin32/winFileio.cpp +++ b/Engine/source/platformWin32/winFileio.cpp @@ -158,7 +158,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) Platform::clearExcludedDirectories(); - TempAlloc< char > tempBuf( to.size * 3 + MAX_PATH * 3 ); + S32 tempBufSize = to.size * 3 + MAX_PATH * 3; + TempAlloc< char > tempBuf( tempBufSize ); // Create all the directories. for (S32 i = 0; i < directoryInfo.size(); i++) @@ -168,7 +169,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) char* toDir = tempBuf; Platform::makeFullPathName(fromDir + dStrlen(fromName) + (dStricmp(fromDir, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName); if(*(toDir + dStrlen(toDir) - 1) != '/') - dStrcat(toDir, "/"); + dStrcat(toDir, "/", tempBufSize); forwardslash(toDir); if (!Platform::createPath(toDir)) @@ -191,8 +192,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) char* toFile = tempBuf; Platform::makeFullPathName(fileInfo[i].pFullPath + dStrlen(fromName) + (dStricmp(fileInfo[i].pFullPath, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName); - dStrcat(toFile, "/"); - dStrcat(toFile, fileInfo[i].pFileName); + dStrcat(toFile, "/", tempBufSize); + dStrcat(toFile, fileInfo[i].pFileName, tempBufSize); backslash(fromFile); backslash(toFile); diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 841f3e39b..4e5f6948a 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -249,7 +249,7 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const iostrm->write( dStrlen( lineBuffer ), lineBuffer ); } - dSprintf(lineBuffer, 1023, "if (isObject(%s)) %s.delete();\n" + dSprintf(lineBuffer, 1024, "if (isObject(%s)) %s.delete();\n" "new ActionMap(%s);\n", getName(), getName(), getName()); iostrm->write(dStrlen(lineBuffer), lineBuffer); @@ -277,7 +277,7 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const else command = "bind"; - dSprintf(lineBuffer, 1023, "%s.%s(%s, \"%s%s\"", + dSprintf(lineBuffer, 1024, "%s.%s(%s, \"%s%s\"", getName(), command, devbuffer, @@ -298,53 +298,53 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const buff[curr++] = 'I'; buff[curr] = '\0'; - dStrcat(lineBuffer, buff); + dStrcat(lineBuffer, buff, 1024); } if (rNode.flags & Node::HasDeadZone) { char buff[64]; dSprintf(buff, 63, ", \"%g %g\"", rNode.deadZoneBegin, rNode.deadZoneEnd); - dStrcat(lineBuffer, buff); + dStrcat(lineBuffer, buff, 1024); } if (rNode.flags & Node::HasScale) { char buff[64]; dSprintf(buff, 63, ", %g", rNode.scaleFactor); - dStrcat(lineBuffer, buff); + dStrcat(lineBuffer, buff, 1024); } if (rNode.flags & Node::BindCmd) { if (rNode.makeConsoleCommand) { - dStrcat(lineBuffer, ", \""); + dStrcat(lineBuffer, ", \"", 1024); U32 pos = dStrlen(lineBuffer); expandEscape(lineBuffer + pos, rNode.makeConsoleCommand); - dStrcat(lineBuffer, "\""); + dStrcat(lineBuffer, "\"", 1024); } else { - dStrcat(lineBuffer, ", \"\""); + dStrcat(lineBuffer, ", \"\"", 1024); } if (rNode.breakConsoleCommand) { - dStrcat(lineBuffer, ", \""); + dStrcat(lineBuffer, ", \"", 1024); U32 pos = dStrlen(lineBuffer); expandEscape(lineBuffer + pos, rNode.breakConsoleCommand); - dStrcat(lineBuffer, "\""); + dStrcat(lineBuffer, "\"", 1024); } else - dStrcat(lineBuffer, ", \"\""); + dStrcat(lineBuffer, ", \"\"", 1024); } else if (rNode.flags & Node::Held) { - dStrcat(lineBuffer, ", "); - dStrcat(lineBuffer, rNode.consoleFunction); + dStrcat(lineBuffer, ", ", 1024); + dStrcat(lineBuffer, rNode.consoleFunction, 1024); - dStrcat(lineBuffer, ", "); - dStrcat(lineBuffer, rNode.contextEvent->mConsoleFunctionHeld); + dStrcat(lineBuffer, ", ", 1024); + dStrcat(lineBuffer, rNode.contextEvent->mConsoleFunctionHeld, 1024); } else { - dStrcat(lineBuffer, ", "); - dStrcat(lineBuffer, rNode.consoleFunction); + dStrcat(lineBuffer, ", ", 1024); + dStrcat(lineBuffer, rNode.consoleFunction, 1024); } - dStrcat(lineBuffer, ");\n"); + dStrcat(lineBuffer, ");\n", 1024); iostrm->write(dStrlen(lineBuffer), lineBuffer); } } @@ -377,7 +377,7 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const command = "bind"; char finalBuffer[1024]; - dSprintf(finalBuffer, 1023, "%s.%s(%s, \"%s%s\"", + dSprintf(finalBuffer, 1024, "%s.%s(%s, \"%s%s\"", getName(), command, devbuffer, @@ -398,51 +398,51 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const buff[curr++] = 'I'; buff[curr] = '\0'; - dStrcat(finalBuffer, buff); + dStrcat(finalBuffer, buff, 1024); } if (rNode.flags & Node::HasDeadZone) { char buff[64]; dSprintf(buff, 63, ", \"%g %g\"", rNode.deadZoneBegin, rNode.deadZoneEnd); - dStrcat(finalBuffer, buff); + dStrcat(finalBuffer, buff, 1024); } if (rNode.flags & Node::HasScale) { char buff[64]; dSprintf(buff, 63, ", %g", rNode.scaleFactor); - dStrcat(finalBuffer, buff); + dStrcat(finalBuffer, buff, 1024); } if (rNode.flags & Node::BindCmd) { if (rNode.makeConsoleCommand) { - dStrcat(finalBuffer, ", \""); - dStrcat(finalBuffer, rNode.makeConsoleCommand); - dStrcat(finalBuffer, "\""); + dStrcat(finalBuffer, ", \"", 1024); + dStrcat(finalBuffer, rNode.makeConsoleCommand, 1024); + dStrcat(finalBuffer, "\"", 1024); } else { - dStrcat(finalBuffer, ", \"\""); + dStrcat(finalBuffer, ", \"\"", 1024); } if (rNode.breakConsoleCommand) { - dStrcat(finalBuffer, ", \""); - dStrcat(finalBuffer, rNode.breakConsoleCommand); - dStrcat(finalBuffer, "\""); + dStrcat(finalBuffer, ", \"", 1024); + dStrcat(finalBuffer, rNode.breakConsoleCommand, 1024); + dStrcat(finalBuffer, "\"", 1024); } else - dStrcat(finalBuffer, ", \"\""); + dStrcat(finalBuffer, ", \"\"", 1024); } else if (rNode.flags & Node::Held) { - dStrcat(finalBuffer, ", "); - dStrcat(finalBuffer, rNode.consoleFunction); + dStrcat(finalBuffer, ", ", 1024); + dStrcat(finalBuffer, rNode.consoleFunction, 1024); - dStrcat(finalBuffer, ", "); - dStrcat(finalBuffer, rNode.contextEvent->mConsoleFunctionHeld); + dStrcat(finalBuffer, ", ", 1024); + dStrcat(finalBuffer, rNode.contextEvent->mConsoleFunctionHeld, 1024); } else { - dStrcat(finalBuffer, ", "); - dStrcat(finalBuffer, rNode.consoleFunction); + dStrcat(finalBuffer, ", ", 1024); + dStrcat(finalBuffer, rNode.consoleFunction, 1024); } - dStrcat(finalBuffer, ");"); + dStrcat(finalBuffer, ");", 1024); Con::printf(finalBuffer); } } @@ -786,8 +786,8 @@ const char* ActionMap::getBinding( const char* command ) { dSprintf( buffer, sizeof( buffer ), "%s\t%s%s", deviceBuffer, modifierString, keyBuffer ); if ( returnString[0] ) - dStrcat( returnString, "\t" ); - dStrcat( returnString, buffer ); + dStrcat( returnString, "\t", 1024 ); + dStrcat( returnString, buffer, 1024 ); } } diff --git a/Engine/source/sim/netStringTable.cpp b/Engine/source/sim/netStringTable.cpp index 117d0a020..d1a25e826 100644 --- a/Engine/source/sim/netStringTable.cpp +++ b/Engine/source/sim/netStringTable.cpp @@ -239,7 +239,7 @@ void NetStringTable::expandString(NetStringHandle &inString, char *buf, U32 bufS } buf[bufSize - 1] = 0; } else { - dStrcat(buf, ""); + dStrcat(buf, "", bufSize); } } diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index a97ec7e98..8665fa9f4 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -1306,7 +1306,7 @@ DefineEngineMethod( TerrainBlock, save, bool, ( const char* fileName),, dStrcpy(filename,fileName); char *ext = dStrrchr(filename, '.'); if (!ext || dStricmp(ext, ".ter") != 0) - dStrcat(filename, ".ter"); + dStrcat(filename, ".ter", 256); return static_cast(object)->save(filename); } @@ -1316,7 +1316,7 @@ DefineEngineMethod( TerrainBlock, save, bool, ( const char* fileName),, // dStrcpy(filename,argv[2]); // char *ext = dStrrchr(filename, '.'); // if (!ext || dStricmp(ext, ".ter") != 0) -// dStrcat(filename, ".ter"); +// dStrcat(filename, ".ter", 256); // return static_cast(object)->save(filename); //} From 79c34c68dbee952fa9cea2cd72ea8b8519608c04 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 6 Mar 2018 01:59:05 -0500 Subject: [PATCH 144/312] Use strncpy instead of strcpy because again, buffer overflows --- Engine/source/T3D/components/component.cpp | 2 +- Engine/source/T3D/decal/decalManager.cpp | 2 +- Engine/source/T3D/fx/particle.cpp | 2 +- Engine/source/T3D/fx/particleEmitter.cpp | 2 +- Engine/source/T3D/item.cpp | 4 +- Engine/source/afx/afxMagicMissile.cpp | 2 +- Engine/source/afx/ce/afxParticleEmitter.cpp | 6 +-- Engine/source/afx/ea/afxEA_PhraseEffect.cpp | 6 +-- Engine/source/afx/rpg/afxRPGMagicSpell.cpp | 8 ++-- Engine/source/afx/ui/afxSpellButton.cpp | 16 ++++---- Engine/source/afx/xm/afxXM_PathConform.cpp | 2 +- Engine/source/app/badWordFilter.cpp | 6 +-- Engine/source/app/banList.cpp | 2 +- Engine/source/app/mainLoop.cpp | 2 +- Engine/source/app/net/net.cpp | 6 +-- Engine/source/app/net/netExamples.cpp | 4 +- Engine/source/app/net/serverQuery.cpp | 38 +++++++++---------- Engine/source/console/CMDscan.cpp | 2 +- Engine/source/console/SimXMLDocument.cpp | 4 +- Engine/source/console/astAlloc.cpp | 2 +- Engine/source/console/codeInterpreter.cpp | 26 ++++++------- Engine/source/console/compiler.cpp | 4 +- Engine/source/console/console.cpp | 30 +++++++-------- Engine/source/console/console.h | 2 +- Engine/source/console/consoleDoc.cpp | 4 +- Engine/source/console/consoleFunctions.cpp | 36 +++++++++--------- Engine/source/console/consoleInternal.cpp | 10 ++--- Engine/source/console/consoleObject.cpp | 2 +- Engine/source/console/fieldBrushObject.cpp | 4 +- Engine/source/console/fileSystemFunctions.cpp | 16 ++++---- Engine/source/console/persistenceManager.cpp | 2 +- Engine/source/console/scriptFilename.cpp | 8 ++-- Engine/source/console/sim.cpp | 4 +- Engine/source/console/simDatablock.cpp | 4 +- Engine/source/console/simObject.cpp | 16 ++++---- Engine/source/console/simObjectMemento.cpp | 2 +- Engine/source/console/stringStack.h | 2 +- Engine/source/core/stream/bitStream.cpp | 4 +- Engine/source/core/stringTable.cpp | 2 +- Engine/source/core/strings/findMatch.cpp | 6 +-- .../source/core/strings/stringFunctions.cpp | 2 +- Engine/source/core/strings/stringFunctions.h | 19 +++++++++- Engine/source/core/tokenizer.cpp | 6 +-- Engine/source/core/util/zip/centralDir.cpp | 2 +- Engine/source/gfx/Null/gfxNullDevice.cpp | 4 +- Engine/source/gfx/gfxStructs.cpp | 4 +- Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp | 4 +- .../source/gfx/gl/win32/gfxGLDevice.win.cpp | 4 +- Engine/source/gfx/screenshot.cpp | 2 +- Engine/source/gui/containers/guiFormCtrl.cpp | 2 +- .../source/gui/controls/guiAnimBitmapCtrl.cpp | 4 +- .../source/gui/controls/guiFileTreeCtrl.cpp | 2 +- Engine/source/gui/controls/guiPopUpCtrl.cpp | 9 +++-- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 9 +++-- Engine/source/gui/controls/guiTabPageCtrl.cpp | 2 +- .../source/gui/controls/guiTreeViewCtrl.cpp | 8 ++-- Engine/source/gui/core/guiControl.cpp | 2 +- Engine/source/gui/editor/guiDebugger.cpp | 6 +-- Engine/source/gui/editor/guiEditCtrl.cpp | 2 +- Engine/source/gui/editor/guiFilterCtrl.cpp | 2 +- Engine/source/gui/utility/messageVector.cpp | 2 +- Engine/source/i18n/lang.cpp | 18 ++++----- .../source/materials/materialDefinition.cpp | 10 ++--- Engine/source/module/moduleDefinition.h | 6 +-- Engine/source/module/moduleManager.cpp | 4 +- Engine/source/persistence/taml/taml.cpp | 4 +- Engine/source/persistence/taml/tamlCustom.cpp | 2 +- Engine/source/persistence/taml/tamlCustom.h | 4 +- .../source/persistence/taml/tamlWriteNode.h | 4 +- .../platform/nativeDialogs/fileDialog.cpp | 2 +- Engine/source/platform/platformFileIO.cpp | 2 +- Engine/source/platform/platformMemory.cpp | 2 +- Engine/source/platform/platformNet.cpp | 6 +-- Engine/source/platform/platformRedBook.cpp | 2 +- Engine/source/platform/profiler.cpp | 18 ++++----- Engine/source/platformMac/macFileIO.mm | 2 +- .../platformWin32/minidump/winMiniDump.cpp | 2 +- .../nativeDialogs/fileDialog.cpp | 10 ++--- .../source/platformWin32/winDInputDevice.cpp | 2 +- Engine/source/platformWin32/winFileio.cpp | 30 +++++++-------- Engine/source/platformWin32/winRedbook.cpp | 2 +- Engine/source/platformWin32/winWindow.cpp | 2 +- Engine/source/sfx/openal/sfxALProvider.cpp | 4 +- .../source/shaderGen/GLSL/shaderCompGLSL.cpp | 4 +- Engine/source/shaderGen/langElement.cpp | 4 +- Engine/source/shaderGen/shaderGen.cpp | 4 +- Engine/source/sim/actionMap.cpp | 12 +++--- Engine/source/sim/netDownload.cpp | 2 +- Engine/source/sim/netStringTable.cpp | 4 +- Engine/source/terrain/terrData.cpp | 4 +- Engine/source/util/messaging/eventManager.cpp | 2 +- Engine/source/util/undo.cpp | 4 +- 92 files changed, 298 insertions(+), 279 deletions(-) diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index 181c892e5..1ef7904e9 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -548,7 +548,7 @@ const char * Component::getDescriptionText(const char *desc) if (!Platform::isFile(desc)) { newDesc = new char[dStrlen(desc) + 1]; - dStrcpy(newDesc, desc); + dStrcpy(newDesc, desc, dStrlen(desc) + 1); return newDesc; } diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index ab53842e5..2a286ea37 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -1495,7 +1495,7 @@ bool DecalManager::_createDataFile() // See if we know our current mission name char missionName[1024]; - dStrcpy( missionName, Con::getVariable( "$Client::MissionFile" ) ); + dStrcpy( missionName, Con::getVariable( "$Client::MissionFile" ), 1024 ); char *dot = dStrstr((const char*)missionName, ".mis"); if(dot) *dot = '\0'; diff --git a/Engine/source/T3D/fx/particle.cpp b/Engine/source/T3D/fx/particle.cpp index 823376fc7..a528af0d1 100644 --- a/Engine/source/T3D/fx/particle.cpp +++ b/Engine/source/T3D/fx/particle.cpp @@ -595,7 +595,7 @@ bool ParticleData::preload(bool server, String &errorStr) animTexFrames.clear(); char* tokCopy = new char[dStrlen(animTexFramesString) + 1]; - dStrcpy(tokCopy, animTexFramesString); + dStrcpy(tokCopy, animTexFramesString, dStrlen(animTexFramesString) + 1); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index 4005607d7..00dbadb97 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -609,7 +609,7 @@ bool ParticleEmitterData::onAdd() // First we parse particleString into a list of particle name tokens Vector dataBlocks(__FILE__, __LINE__); char* tokCopy = new char[dStrlen(particleString) + 1]; - dStrcpy(tokCopy, particleString); + dStrcpy(tokCopy, particleString, dStrlen(particleString) + 1); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index e6d21b93a..b710842d7 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -1254,7 +1254,7 @@ DefineEngineMethod( Item, getLastStickyPos, const char*, (),, object->mStickyCollisionPos.y, object->mStickyCollisionPos.z); else - dStrcpy(ret, "0 0 0"); + dStrcpy(ret, "0 0 0", bufSize); return ret; } @@ -1277,7 +1277,7 @@ DefineEngineMethod( Item, getLastStickyNormal, const char *, (),, object->mStickyCollisionNormal.y, object->mStickyCollisionNormal.z); else - dStrcpy(ret, "0 0 0"); + dStrcpy(ret, "0 0 0", bufSize); return ret; } diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 36ecd1777..690e3c74b 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -447,7 +447,7 @@ bool afxMagicMissileData::onAdd() // make a copy of points_string char* tokCopy = new char[dStrlen(wiggle_axis_string) + 1]; - dStrcpy(tokCopy, wiggle_axis_string); + dStrcpy(tokCopy, wiggle_axis_string, dStrlen(wiggle_axis_string) + 1); // extract tokens one by one, adding them to dataBlocks char* currTok = dStrtok(tokCopy, " \t"); diff --git a/Engine/source/afx/ce/afxParticleEmitter.cpp b/Engine/source/afx/ce/afxParticleEmitter.cpp index 3983b27ba..2f7643c8f 100644 --- a/Engine/source/afx/ce/afxParticleEmitter.cpp +++ b/Engine/source/afx/ce/afxParticleEmitter.cpp @@ -142,7 +142,7 @@ bool afxParticleEmitterData::onAdd() { Vector dataBlocks(__FILE__, __LINE__); char* tokCopy = new char[dStrlen(tpaths_string) + 1]; - dStrcpy(tokCopy, tpaths_string); + dStrcpy(tokCopy, tpaths_string, dStrlen(tpaths_string) + 1); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) @@ -468,7 +468,7 @@ bool afxParticleEmitterPathData::onAdd() { Vector dataBlocks(__FILE__, __LINE__); char* tokCopy = new char[dStrlen(epaths_string) + 1]; - dStrcpy(tokCopy, epaths_string); + dStrcpy(tokCopy, epaths_string, dStrlen(epaths_string) + 1); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) @@ -553,7 +553,7 @@ void afxParticleEmitterPathData::onPerformSubstitutions() { Vector dataBlocks(__FILE__, __LINE__); char* tokCopy = new char[dStrlen(epaths_string) + 1]; - dStrcpy(tokCopy, epaths_string); + dStrcpy(tokCopy, epaths_string, dStrlen(epaths_string) + 1); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/afx/ea/afxEA_PhraseEffect.cpp b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp index 4448e1967..e253ab1ee 100644 --- a/Engine/source/afx/ea/afxEA_PhraseEffect.cpp +++ b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp @@ -272,10 +272,10 @@ void afxEA_PhraseEffect::trigger_new_phrase() if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING) { char obj_str[32]; - dStrcpy(obj_str, Con::getIntArg(choreographer->getId())); + dStrcpy(obj_str, Con::getIntArg(choreographer->getId()), 32); char index_str[32]; - dStrcpy(index_str, Con::getIntArg(group_index)); + dStrcpy(index_str, Con::getIntArg(group_index), 32); char buffer[1024]; char* b = buffer; @@ -382,4 +382,4 @@ bool afxEA_PhraseEffectDesc::requiresStop(const afxEffectWrapperData* ew, const return (timing.lifetime < 0); } -//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// \ No newline at end of file +//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/rpg/afxRPGMagicSpell.cpp b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp index 6490ad260..3e9362435 100644 --- a/Engine/source/afx/rpg/afxRPGMagicSpell.cpp +++ b/Engine/source/afx/rpg/afxRPGMagicSpell.cpp @@ -194,7 +194,7 @@ char* afxRPGMagicSpellData::fmt_placeholder_desc(char* buffer, int len) const { char pack_str[32]; if (source_pack == ST_NULLSTRING) - dStrcpy(pack_str, "unknown"); + dStrcpy(pack_str, "unknown", 32); else dSprintf(pack_str, 32, "%s", source_pack); @@ -225,7 +225,7 @@ char* afxRPGMagicSpellData::formatDesc(char* buffer, int len) const { if (spell_target != TARGET_NOTHING) { - dStrcpy(target_str, _afxRPGMagicSpell_TargetType::_sEnumTable[i].mName); + dStrcpy(target_str, _afxRPGMagicSpell_TargetType::_sEnumTable[i].mName, 32); if (spell_target != TARGET_FREE && target_optional) dStrcat(target_str, " (opt)", 32); } @@ -245,13 +245,13 @@ char* afxRPGMagicSpellData::formatDesc(char* buffer, int len) const char casting_str[32]; if (casting_dur <= 0) - dStrcpy(casting_str, "instant"); + dStrcpy(casting_str, "instant", 32); else dSprintf(casting_str, 32, "%.1f sec cast", casting_dur); char pack_str[32]; if (source_pack == ST_NULLSTRING) - dStrcpy(pack_str, "unknown"); + dStrcpy(pack_str, "unknown", 32); else dSprintf(pack_str, 32, "%s", source_pack); diff --git a/Engine/source/afx/ui/afxSpellButton.cpp b/Engine/source/afx/ui/afxSpellButton.cpp index 2ca1e4473..632d2e652 100644 --- a/Engine/source/afx/ui/afxSpellButton.cpp +++ b/Engine/source/afx/ui/afxSpellButton.cpp @@ -171,10 +171,11 @@ void afxSpellButton::setBitmap(const char *name, bool placeholder) if (placeholder) { - dStrcpy(buffer, name); + dStrcpy(buffer, name, 1024); + S32 pLen = 1024 - dStrlen(buffer); p = buffer + dStrlen(buffer); - dStrcpy(p, "_i"); + dStrcpy(p, "_i", pLen); mTextureInactive.set(buffer, COOLDOWN_PROFILE); mTextureNormal = mTextureInactive; mTextureHilight = mTextureInactive; @@ -183,19 +184,20 @@ void afxSpellButton::setBitmap(const char *name, bool placeholder) } else { - dStrcpy(buffer, name); + dStrcpy(buffer, name, 1024); + S32 pLen = 1024 - dStrlen(buffer); p = buffer + dStrlen(buffer); - dStrcpy(p, "_n"); + dStrcpy(p, "_n", pLen); mTextureNormal.set(buffer, COOLDOWN_PROFILE); - dStrcpy(p, "_h"); + dStrcpy(p, "_h", pLen); mTextureHilight.set(buffer, COOLDOWN_PROFILE); if (!mTextureHilight) mTextureHilight = mTextureNormal; - dStrcpy(p, "_d"); + dStrcpy(p, "_d", pLen); mTextureDepressed.set(buffer, COOLDOWN_PROFILE); if (!mTextureDepressed) mTextureDepressed = mTextureHilight; - dStrcpy(p, "_i"); + dStrcpy(p, "_i", pLen); mTextureInactive.set(buffer, COOLDOWN_PROFILE); if (!mTextureInactive) mTextureInactive = mTextureNormal; diff --git a/Engine/source/afx/xm/afxXM_PathConform.cpp b/Engine/source/afx/xm/afxXM_PathConform.cpp index af9b7869f..3fde74699 100644 --- a/Engine/source/afx/xm/afxXM_PathConform.cpp +++ b/Engine/source/afx/xm/afxXM_PathConform.cpp @@ -195,7 +195,7 @@ bool afxXM_PathConformData::onAdd() { Vector dataBlocks(__FILE__, __LINE__); char* tokCopy = new char[dStrlen(paths_string) + 1]; - dStrcpy(tokCopy, paths_string); + dStrcpy(tokCopy, paths_string, dStrlen(paths_string) + 1); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index d0547e5ee..d789bc1c4 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -50,7 +50,7 @@ BadWordFilter::BadWordFilter() { VECTOR_SET_ASSOCIATION( filterTables ); - dStrcpy(defaultReplaceStr, "knqwrtlzs"); + dStrcpy(defaultReplaceStr, "knqwrtlzs", 32); filterTables.push_back(new FilterTable); curOffset = 0; } @@ -147,7 +147,7 @@ bool BadWordFilter::setDefaultReplaceStr(const char *str) U32 len = dStrlen(str); if(len < 2 || len >= sizeof(defaultReplaceStr)) return false; - dStrcpy(defaultReplaceStr, str); + dStrcpy(defaultReplaceStr, str, 32); return true; } @@ -287,7 +287,7 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const replaceStr = gBadWordFilter->getDefaultReplaceStr(); char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); - dStrcpy(ret, baseString); + dStrcpy(ret, baseString, dStrlen(baseString)); gBadWordFilter->filterString(ret, replaceStr); return ret; } diff --git a/Engine/source/app/banList.cpp b/Engine/source/app/banList.cpp index 952b49a05..4e7de54a2 100644 --- a/Engine/source/app/banList.cpp +++ b/Engine/source/app/banList.cpp @@ -86,7 +86,7 @@ void BanList::addBan(S32 uniqueId, const char *TA, S32 banTime) } BanInfo b; - dStrcpy(b.transportAddress, TA); + dStrcpy(b.transportAddress, TA, 128); b.uniqueId = uniqueId; b.bannedUntil = banTime; diff --git a/Engine/source/app/mainLoop.cpp b/Engine/source/app/mainLoop.cpp index 5fc4aa8c0..b08363f8a 100644 --- a/Engine/source/app/mainLoop.cpp +++ b/Engine/source/app/mainLoop.cpp @@ -495,7 +495,7 @@ bool StandardMainLoop::handleCommandLine( S32 argc, const char **argv ) S32 pathLen = dStrlen( fdd.mFile ); FrameTemp szPathCopy( pathLen + 1); - dStrcpy( szPathCopy, fdd.mFile ); + dStrcpy( szPathCopy, fdd.mFile, pathLen + 1 ); //forwardslash( szPathCopy ); const char *path = dStrrchr(szPathCopy, '/'); diff --git a/Engine/source/app/net/net.cpp b/Engine/source/app/net/net.cpp index f668d2651..c5f1be189 100644 --- a/Engine/source/app/net/net.cpp +++ b/Engine/source/app/net/net.cpp @@ -128,7 +128,7 @@ const char *rmtCommandName = dStrchr(mArgv[1], ' ') + 1; if(conn->isConnectionToServer()) { - dStrcpy(mBuf, "clientCmd"); + dStrcpy(mBuf, "clientCmd", 1024); dStrcat(mBuf, rmtCommandName, 1024); char *temp = mArgv[1]; @@ -139,7 +139,7 @@ } else { - dStrcpy(mBuf, "serverCmd"); + dStrcpy(mBuf, "serverCmd", 1024); dStrcat(mBuf, rmtCommandName, 1024); char *temp = mArgv[1]; @@ -409,7 +409,7 @@ ConsoleFunction( buildTaggedString, const char*, 2, 11, "(string format, ...)" S32 strLength = dStrlen(argStr); if (strLength > strMaxLength) goto done; - dStrcpy(strBufPtr, argStr); + dStrcpy(strBufPtr, argStr, strMaxLength); strBufPtr += strLength; strMaxLength -= strLength; fmtStrPtr += 2; diff --git a/Engine/source/app/net/netExamples.cpp b/Engine/source/app/net/netExamples.cpp index 81065ce6a..1f53c6d21 100644 --- a/Engine/source/app/net/netExamples.cpp +++ b/Engine/source/app/net/netExamples.cpp @@ -110,7 +110,7 @@ public: SimpleNetObject() { mNetFlags.set(ScopeAlways | Ghostable); - dStrcpy(message, "Hello World!"); + dStrcpy(message, "Hello World!", 256); } U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream) { @@ -125,7 +125,7 @@ public: void setMessage(const char *msg) { setMaskBits(1); - dStrcpy(message, msg); + dStrcpy(message, msg, 256); } DECLARE_CONOBJECT(SimpleNetObject); diff --git a/Engine/source/app/net/serverQuery.cpp b/Engine/source/app/net/serverQuery.cpp index 4c91caf70..12a83c454 100644 --- a/Engine/source/app/net/serverQuery.cpp +++ b/Engine/source/app/net/serverQuery.cpp @@ -394,12 +394,12 @@ void queryLanServers(U32 port, U8 flags, const char* gameType, const char* missi if ( !sActiveFilter.gameType || dStricmp( sActiveFilter.gameType, "Any" ) != 0 ) { sActiveFilter.gameType = (char*) dRealloc( sActiveFilter.gameType, 4 ); - dStrcpy( sActiveFilter.gameType, "Any" ); + dStrcpy( sActiveFilter.gameType, "Any", 4 ); } if ( !sActiveFilter.missionType || dStricmp( sActiveFilter.missionType, "Any" ) != 0 ) { sActiveFilter.missionType = (char*) dRealloc( sActiveFilter.missionType, 4 ); - dStrcpy( sActiveFilter.missionType, "Any" ); + dStrcpy( sActiveFilter.missionType, "Any", 4 ); } sActiveFilter.queryFlags = 0; sActiveFilter.minPlayers = minPlayers; @@ -511,13 +511,13 @@ void queryMasterServer(U8 flags, const char* gameType, const char* missionType, if ( !sActiveFilter.gameType || dStrcmp( sActiveFilter.gameType, gameType ) != 0 ) { sActiveFilter.gameType = (char*) dRealloc( sActiveFilter.gameType, dStrlen( gameType ) + 1 ); - dStrcpy( sActiveFilter.gameType, gameType ); + dStrcpy( sActiveFilter.gameType, gameType, dStrlen(gameType) + 1 ); } if ( !sActiveFilter.missionType || dStrcmp( sActiveFilter.missionType, missionType ) != 0 ) { sActiveFilter.missionType = (char*) dRealloc( sActiveFilter.missionType, dStrlen( missionType ) + 1 ); - dStrcpy( sActiveFilter.missionType, missionType ); + dStrcpy( sActiveFilter.missionType, missionType, dStrlen(missionType) + 1 ); } sActiveFilter.queryFlags = flags | ServerFilter::NewStyleResponse; @@ -970,7 +970,7 @@ static void pushServerFavorites() ServerInfo* si = findOrCreateServerInfo( &addr ); AssertFatal(si, "pushServerFavorites - failed to create Server Info!" ); si->name = (char*) dRealloc( (void*) si->name, dStrlen( serverName ) + 1 ); - dStrcpy( si->name, serverName ); + dStrcpy( si->name, serverName, dStrlen(serverName) + 1 ); si->isFavorite = true; pushPingRequest( &addr ); } @@ -1054,13 +1054,13 @@ void addFakeServers( S32 howMany ) char buf[256]; dSprintf( buf, 255, "Fake server #%d", sNumFakeServers ); newServer.name = (char*) dMalloc( dStrlen( buf ) + 1 ); - dStrcpy( newServer.name, buf ); + dStrcpy( newServer.name, buf, strlen(buf) + 1 ); newServer.gameType = (char*) dMalloc( 5 ); - dStrcpy( newServer.gameType, "Fake" ); - newServer.missionType = (char*) dMalloc( 4 ); - dStrcpy( newServer.missionType, "FakeMissionType" ); + dStrcpy( newServer.gameType, "Fake", 5 ); + newServer.missionType = (char*) dMalloc( 16 ); + dStrcpy( newServer.missionType, "FakeMissionType", 16 ); newServer.missionName = (char*) dMalloc( 14 ); - dStrcpy( newServer.missionName, "FakeMapName" ); + dStrcpy( newServer.missionName, "FakeMapName", 14 ); Net::stringToAddress( "IP:198.74.33.35:28000", &newServer.address ); newServer.ping = (U32)( Platform::getRandom() * 200.0f ); newServer.cpuSpeed = 470; @@ -1353,9 +1353,9 @@ static void processPingsAndQueries( U32 session, bool schedule ) char msg[64]; U32 foundCount = gServerList.size(); if ( foundCount == 0 ) - dStrcpy( msg, "No servers found." ); + dStrcpy( msg, "No servers found.", 64 ); else if ( foundCount == 1 ) - dStrcpy( msg, "One server found." ); + dStrcpy( msg, "One server found.", 64 ); else dSprintf( msg, sizeof( msg ), "%d servers found.", foundCount ); @@ -1754,7 +1754,7 @@ static void handleGameMasterInfoRequest( const NetAddress* address, U32 key, U8 const char* guidList = Con::getVariable( "Server::GuidList" ); char* buf = new char[dStrlen( guidList ) + 1]; - dStrcpy( buf, guidList ); + dStrcpy( buf, guidList, dStrlen(guidList) + 1 ); char* temp = dStrtok( buf, "\t" ); temp8 = 0; for ( ; temp && temp8 < playerCount; temp8++ ) @@ -1949,7 +1949,7 @@ static void handleGamePingResponse( const NetAddress* address, BitStream* stream if ( !si->name ) { si->name = (char*) dMalloc( dStrlen( buf ) + 1 ); - dStrcpy( si->name, buf ); + dStrcpy( si->name, buf, dStrlen(buf) + 1 ); } // Set the server up to be queried: @@ -2051,7 +2051,7 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream if ( !si->gameType || dStricmp( si->gameType, stringBuf ) != 0 ) { si->gameType = (char*) dRealloc( (void*) si->gameType, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->gameType, stringBuf ); + dStrcpy( si->gameType, stringBuf, dStrlen(stringBuf) + 1 ); // Test against the active filter: if ( applyFilter && dStricmp( sActiveFilter.gameType, "any" ) != 0 @@ -2068,7 +2068,7 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream if ( !si->missionType || dStrcmp( si->missionType, stringBuf ) != 0 ) { si->missionType = (char*) dRealloc( (void*) si->missionType, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->missionType, stringBuf ); + dStrcpy( si->missionType, stringBuf, dStrlen(stringBuf) + 1 ); // Test against the active filter: if ( applyFilter && dStricmp( sActiveFilter.missionType, "any" ) != 0 @@ -2089,7 +2089,7 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream if ( !si->missionName || dStrcmp( si->missionName, stringBuf ) != 0 ) { si->missionName = (char*) dRealloc( (void*) si->missionName, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->missionName, stringBuf ); + dStrcpy( si->missionName, stringBuf, dStrlen(stringBuf) + 1 ); } // Get the server status: @@ -2158,7 +2158,7 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream if ( !si->statusString || ( isUpdate && dStrcmp( si->statusString, stringBuf ) != 0 ) ) { si->infoString = (char*) dRealloc( (void*) si->infoString, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->infoString, stringBuf ); + dStrcpy( si->infoString, stringBuf, dStrlen(stringBuf) + 1 ); } // Get the content string: @@ -2166,7 +2166,7 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream if ( !si->statusString || ( isUpdate && dStrcmp( si->statusString, stringBuf ) != 0 ) ) { si->statusString = (char*) dRealloc( (void*) si->statusString, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->statusString, stringBuf ); + dStrcpy( si->statusString, stringBuf, dStrlen(stringBuf) + 1 ); } // Update the server browser gui! diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 733460b09..c780fd2a6 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -2341,7 +2341,7 @@ static int Sc_ScanString(int ret) return -1; char* buffer = (char*)consoleAlloc(dStrlen(CMDtext)); - dStrcpy(buffer, CMDtext + 1); + dStrcpy(buffer, CMDtext + 1, dStrlen(CMDtext)); CMDlval.str = MakeToken< char* >(buffer, lineIndex); return ret; diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index b2960105b..4071ae138 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -833,7 +833,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) continue; FrameTemp valCopy( dStrlen( val ) + 1 ); - dStrcpy( (char *)valCopy, val ); + dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 ); if (!pObject->writeField(itr->pFieldname, valCopy)) continue; @@ -873,7 +873,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) // continue; // FrameTemp valCopy( dStrlen( val ) + 1 ); - // dStrcpy( (char *)valCopy, val ); + // dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 ); // if (!pObject->writeField(itr->pFieldname, valCopy)) // continue; diff --git a/Engine/source/console/astAlloc.cpp b/Engine/source/console/astAlloc.cpp index 75fbe151c..e897af247 100644 --- a/Engine/source/console/astAlloc.cpp +++ b/Engine/source/console/astAlloc.cpp @@ -241,7 +241,7 @@ StrConstNode *StrConstNode::alloc(S32 lineNumber, char *str, bool tag, bool doc) ret->str = (char *)consoleAlloc(dStrlen(str) + 1); ret->tag = tag; ret->doc = doc; - dStrcpy(ret->str, str); + dStrcpy(ret->str, str, dStrlen(str) + 1); return ret; } diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 0b5986fda..46d58476e 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -95,19 +95,17 @@ static void getFieldComponent(SimObject* object, StringTableEntry field, const c // Translate xyzw and rgba into the indexed component // of the variable or field. - // - // Review: Should we use strncpy to prevent a buffer overflow? if (subField == xyzw[0] || subField == rgba[0]) - dStrcpy(val, StringUnit::getUnit(prevVal, 0, " \t\n")); + dStrcpy(val, StringUnit::getUnit(prevVal, 0, " \t\n"), 128); else if (subField == xyzw[1] || subField == rgba[1]) - dStrcpy(val, StringUnit::getUnit(prevVal, 1, " \t\n")); + dStrcpy(val, StringUnit::getUnit(prevVal, 1, " \t\n"), 128); else if (subField == xyzw[2] || subField == rgba[2]) - dStrcpy(val, StringUnit::getUnit(prevVal, 2, " \t\n")); + dStrcpy(val, StringUnit::getUnit(prevVal, 2, " \t\n"), 128); else if (subField == xyzw[3] || subField == rgba[3]) - dStrcpy(val, StringUnit::getUnit(prevVal, 3, " \t\n")); + dStrcpy(val, StringUnit::getUnit(prevVal, 3, " \t\n"), 128); else val[0] = 0; @@ -157,19 +155,17 @@ static void setFieldComponent(SimObject* object, StringTableEntry field, const c // Insert the value into the specified // component of the string. - // - // Review: Should we use strncpy to prevent a buffer overflow? if (subField == xyzw[0] || subField == rgba[0]) - dStrcpy(val, StringUnit::setUnit(prevVal, 0, strValue, " \t\n")); + dStrcpy(val, StringUnit::setUnit(prevVal, 0, strValue, " \t\n"), 128); else if (subField == xyzw[1] || subField == rgba[1]) - dStrcpy(val, StringUnit::setUnit(prevVal, 1, strValue, " \t\n")); + dStrcpy(val, StringUnit::setUnit(prevVal, 1, strValue, " \t\n"), 128); else if (subField == xyzw[2] || subField == rgba[2]) - dStrcpy(val, StringUnit::setUnit(prevVal, 2, strValue, " \t\n")); + dStrcpy(val, StringUnit::setUnit(prevVal, 2, strValue, " \t\n"), 128); else if (subField == xyzw[3] || subField == rgba[3]) - dStrcpy(val, StringUnit::setUnit(prevVal, 3, strValue, " \t\n")); + dStrcpy(val, StringUnit::setUnit(prevVal, 3, strValue, " \t\n"), 128); if (val[0] != 0) { @@ -1729,7 +1725,7 @@ OPCodeReturn CodeInterpreter::op_setcurfield(U32 &ip) { // Save the previous field for parsing vector fields. mPrevField = mCurField; - dStrcpy(prevFieldArray, curFieldArray); + dStrcpy(prevFieldArray, curFieldArray, 256); mCurField = CodeToSTE(mCodeBlock->code, ip); curFieldArray[0] = 0; ip += 2; @@ -1738,7 +1734,7 @@ OPCodeReturn CodeInterpreter::op_setcurfield(U32 &ip) OPCodeReturn CodeInterpreter::op_setcurfield_array(U32 &ip) { - dStrcpy(curFieldArray, STR.getStringValue()); + dStrcpy(curFieldArray, STR.getStringValue(), 256); return OPCodeReturn::success; } @@ -1771,7 +1767,7 @@ OPCodeReturn CodeInterpreter::op_setcurfield_this(U32 &ip) mCurObject = mThisObject; mPrevField = mCurField; - dStrcpy(prevFieldArray, curFieldArray); + dStrcpy(prevFieldArray, curFieldArray, 256); mCurField = CodeToSTE(mCodeBlock->code, ip); curFieldArray[0] = 0; ip += 2; diff --git a/Engine/source/console/compiler.cpp b/Engine/source/console/compiler.cpp index 0330f4d59..716b9e377 100644 --- a/Engine/source/console/compiler.cpp +++ b/Engine/source/console/compiler.cpp @@ -164,7 +164,7 @@ U32 CompilerStringTable::add(const char *str, bool caseSens, bool tag) newStr->string = (char *)consoleAlloc(len); newStr->len = len; newStr->tag = tag; - dStrcpy(newStr->string, str); + dStrcpy(newStr->string, str, len); // Put into the hash table. hashTable[str] = newStr; @@ -195,7 +195,7 @@ char *CompilerStringTable::build() char *ret = new char[totalLen]; dMemset(ret, 0, totalLen); for (Entry *walk = list; walk; walk = walk->next) - dStrcpy(ret + walk->start, walk->string); + dStrcpy(ret + walk->start, walk->string, totalLen - walk->start); return ret; } diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index ff204a448..fd5d343d2 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -440,7 +440,7 @@ U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forw { // If not... // Save it for checking next time. - dStrcpy(tabBuffer, inputBuffer); + dStrcpy(tabBuffer, inputBuffer, MaxCompletionBufferSize); // Scan backward from the cursor position to find the base to complete from. S32 p = cursorPos; while ((p > 0) && (inputBuffer[p - 1] != ' ') && (inputBuffer[p - 1] != '.') && (inputBuffer[p - 1] != '(')) @@ -527,7 +527,7 @@ U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forw } // Save the modified input buffer for checking next time. - dStrcpy(tabBuffer, inputBuffer); + dStrcpy(tabBuffer, inputBuffer, MaxCompletionBufferSize); // Return the new (maybe) cursor position. return cursorPos; @@ -647,7 +647,7 @@ static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, co entry.mType = type; #ifndef TORQUE_SHIPPING // this is equivalent to a memory leak, turn it off in ship build entry.mString = (const char *)consoleLogChunker.alloc(dStrlen(pos) + 1); - dStrcpy(const_cast(entry.mString), pos); + dStrcpy(const_cast(entry.mString), pos, dStrlen(pos) + 1); // This prevents infinite recursion if the console itself needs to // re-allocate memory to accommodate the new console log entry, and @@ -1271,7 +1271,7 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript) scriptFile = NULL; dsoModifiedTime = dsoFile->getModifiedTime(); - dStrcpy(nameBuffer, scriptFileName); + dStrcpy(nameBuffer, scriptFileName, 512); } // If we're supposed to be compiling this file, check to see if there's a DSO @@ -2097,12 +2097,12 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor if (ensureTrailingSlash) { // Yes, so ensure it. - Con::ensureTrailingSlash(pDstPath, pSrcPath); + Con::ensureTrailingSlash(pDstPath, pSrcPath, size); } else { // No, so just use the source path. - dStrcpy(pDstPath, pSrcPath); + dStrcpy(pDstPath, pSrcPath, size); } return false; @@ -2118,7 +2118,7 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor if (ensureTrailingSlash) { // Yes, so ensure it. - Con::ensureTrailingSlash(pathBuffer, pathBuffer); + Con::ensureTrailingSlash(pathBuffer, pathBuffer, size); } // Strip repeat slashes. @@ -2143,12 +2143,12 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor if (ensureTrailingSlash) { // Yes, so ensure it. - Con::ensureTrailingSlash(pDstPath, pSrcPath); + Con::ensureTrailingSlash(pDstPath, pSrcPath, size); } else { // No, so just use the source path. - dStrcpy(pDstPath, pSrcPath); + dStrcpy(pDstPath, pSrcPath, size); } return false; @@ -2183,7 +2183,7 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor if (ensureTrailingSlash) { // Yes, so ensure it. - Con::ensureTrailingSlash(pathBuffer, pathBuffer); + Con::ensureTrailingSlash(pathBuffer, pathBuffer, size); } // Strip repeat slashes. @@ -2208,7 +2208,7 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor if (ensureTrailingSlash) { // Yes, so ensure it. - Con::ensureTrailingSlash(pathBuffer, pathBuffer); + Con::ensureTrailingSlash(pathBuffer, pathBuffer, size); } // Strip repeat slashes. @@ -2300,10 +2300,10 @@ void collapsePath(char* pDstPath, U32 size, const char* pSrcPath, const char* pW } -void ensureTrailingSlash(char* pDstPath, const char* pSrcPath) +void ensureTrailingSlash(char* pDstPath, const char* pSrcPath, S32 dstSize) { // Copy to target. - dStrcpy(pDstPath, pSrcPath); + dStrcpy(pDstPath, pSrcPath, dstSize); // Find trailing character index. S32 trailIndex = dStrlen(pDstPath); @@ -2353,7 +2353,7 @@ StringTableEntry getDSOPath(const char *scriptPath) else { StringTableEntry strippedPath = Platform::stripBasePath(scriptPath); - dStrcpy(relPath, strippedPath); + dStrcpy(relPath, strippedPath, 1024); char *slash = dStrrchr(relPath, '/'); if (slash) @@ -2616,7 +2616,7 @@ const char *ConsoleValue::getStringValue() else if(newLen > bufferLen) sval = (char *) dRealloc(sval, newLen); - dStrcpy(sval, internalValue); + dStrcpy(sval, internalValue, newLen); bufferLen = newLen; return sval; diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 4009a5393..a734cefbf 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -491,7 +491,7 @@ namespace Con bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWorkingDirectoryHint = NULL, const bool ensureTrailingSlash = false); void collapsePath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWorkingDirectoryHint = NULL); bool isBasePath(const char* SrcPath, const char* pBasePath); - void ensureTrailingSlash(char* pDstPath, const char* pSrcPath); + void ensureTrailingSlash(char* pDstPath, const char* pSrcPath, S32 dstSize); bool stripRepeatSlashes(char* pDstPath, const char* pSrcPath, S32 dstSize); StringTableEntry getDSOPath(const char *scriptPath); diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index 4fb6921dd..f4b74402b 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -90,7 +90,7 @@ void printClassHeader(const char* usage, const char * className, const char * su // Copy Usage Document S32 usageLen = dStrlen( usage ); FrameTemp usageStr( usageLen ); - dStrcpy( usageStr, usage ); + dStrcpy( usageStr, usage, usageLen ); // Print Header Con::printf( "/*!" ); @@ -117,7 +117,7 @@ void printClassHeader(const char* usage, const char * className, const char * su } // Copy line and update usagePtr - dStrcpy( lineStr, usagePtr ); + dStrcpy( lineStr, usagePtr, 2048 ); usagePtr = (newLine != NULL ) ? newLine : usagePtr; lineLen = dStrlen( lineStr ); diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 16c20c3c3..3ffe200ce 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -561,12 +561,13 @@ DefineConsoleFunction( stripChars, const char*, ( const char* str, const char* c "@endtsexample\n" "@ingroup Strings" ) { - char* ret = Con::getReturnBuffer( dStrlen( str ) + 1 ); - dStrcpy( ret, str ); + S32 len = dStrlen(str) + 1; + char* ret = Con::getReturnBuffer( len ); + dStrcpy( ret, str, len ); U32 pos = dStrcspn( ret, chars ); while ( pos < dStrlen( ret ) ) { - dStrcpy( ret + pos, ret + pos + 1 ); + dStrcpy( ret + pos, ret + pos + 1, len - pos ); pos = dStrcspn( ret, chars ); } return( ret ); @@ -585,7 +586,7 @@ DefineConsoleFunction( strlwr, const char*, ( const char* str ),, "@ingroup Strings" ) { char *ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str); + dStrcpy(ret, str, dStrlen(str) + 1); return dStrlwr(ret); } @@ -602,7 +603,7 @@ DefineConsoleFunction( strupr, const char*, ( const char* str ),, "@ingroup Strings" ) { char *ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str); + dStrcpy(ret, str, dStrlen(str) + 1); return dStrupr(ret); } @@ -663,7 +664,8 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char count++; } } - char *ret = Con::getReturnBuffer(dStrlen(source) + 1 + (toLen - fromLen) * count); + S32 retLen = dStrlen(source) + 1 + (toLen - fromLen) * count; + char *ret = Con::getReturnBuffer(retLen); U32 scanp = 0; U32 dstp = 0; for(;;) @@ -671,13 +673,13 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char const char *scan = dStrstr(source + scanp, from); if(!scan) { - dStrcpy(ret + dstp, source + scanp); + dStrcpy(ret + dstp, source + scanp, retLen - dstp); return ret; } U32 len = scan - (source + scanp); - dStrncpy(ret + dstp, source + scanp, len); + dStrncpy(ret + dstp, source + scanp, getMin(len, retLen - dstp)); dstp += len; - dStrcpy(ret + dstp, to); + dStrcpy(ret + dstp, to, retLen - dstp); dstp += toLen; scanp += len + fromLen; } @@ -901,8 +903,8 @@ DefineConsoleFunction( startsWith, bool, ( const char* str, const char* prefix, char* targetBuf = new char[ targetLen + 1 ]; // copy src and target into buffers - dStrcpy( srcBuf, str ); - dStrcpy( targetBuf, prefix ); + dStrcpy( srcBuf, str, srcLen + 1 ); + dStrcpy( targetBuf, prefix, targetLen + 1 ); // reassign src/target pointers to lowercase versions str = dStrlwr( srcBuf ); @@ -952,8 +954,8 @@ DefineConsoleFunction( endsWith, bool, ( const char* str, const char* suffix, bo char* targetBuf = new char[ targetLen + 1 ]; // copy src and target into buffers - dStrcpy( srcBuf, str ); - dStrcpy( targetBuf, suffix ); + dStrcpy( srcBuf, str, srcLen + 1 ); + dStrcpy( targetBuf, suffix, targetLen + 1 ); // reassign src/target pointers to lowercase versions str = dStrlwr( srcBuf ); @@ -1825,7 +1827,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),, return ""; char* ret = Con::getReturnBuffer( dStrlen( word + 1 ) + 1 ); - dStrcpy( ret, word + 1 ); + dStrcpy( ret, word + 1, dStrlen(word + 1) + 1 ); return ret; } else @@ -1889,7 +1891,7 @@ ConsoleFunction( echo, void, 2, 0, "( string message... ) " char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 1; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::printf("%s", ret); ret[0] = 0; @@ -1913,7 +1915,7 @@ ConsoleFunction( warn, void, 2, 0, "( string message... ) " char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 1; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::warnf(ConsoleLogEntry::General, "%s", ret); ret[0] = 0; @@ -1937,7 +1939,7 @@ ConsoleFunction( error, void, 2, 0, "( string message... ) " char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 1; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::errorf(ConsoleLogEntry::General, "%s", ret); ret[0] = 0; diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index 3f5c78f67..61a63ae1e 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -125,7 +125,7 @@ StringValue & StringValue::operator=(const char *string) { S32 len = dStrlen(string); if (len < size) - dStrcpy(val, string); + dStrcpy(val, string, size); else { size = len; @@ -569,7 +569,7 @@ void ConsoleValue::setStringValue(const char * value) type = TypeInternalString; bufferLen = newLen; - dStrcpy(sval, value); + dStrcpy(sval, value, newLen); } else Con::setData(type, dataPtr, 0, 1, &value, enumTable); @@ -702,7 +702,7 @@ Dictionary::Entry* Dictionary::addVariable(const char *name, if (name[0] != '$') { scratchBuffer[0] = '$'; - dStrcpy(scratchBuffer + 1, name); + dStrcpy(scratchBuffer + 1, name, 1023); name = scratchBuffer; } @@ -1360,7 +1360,7 @@ void Namespace::addScriptCallback(const char *funcName, const char *usage, Conso static U32 uid = 0; char buffer[1024]; char lilBuffer[32]; - dStrcpy(buffer, funcName); + dStrcpy(buffer, funcName, 1024); dSprintf(lilBuffer, 32, "_%d_cb", uid++); dStrcat(buffer, lilBuffer, 1024); @@ -1381,7 +1381,7 @@ void Namespace::markGroup(const char* name, const char* usage) static U32 uid = 0; char buffer[1024]; char lilBuffer[32]; - dStrcpy(buffer, name); + dStrcpy(buffer, name, 1024); dSprintf(lilBuffer, 32, "_%d", uid++); dStrcat(buffer, lilBuffer, 1024); diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 32c84f20b..4064d47da 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -773,7 +773,7 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu dQsort( classes.address(), classes.size(), sizeof( AbstractClassRep* ), ACRCompare ); char* ret = Con::getReturnBuffer( bufSize ); - dStrcpy( ret, classes[ 0 ]->getClassName() ); + dStrcpy( ret, classes[ 0 ]->getClassName(), bufSize ); for( U32 i = 1; i < classes.size(); i ++ ) { dStrcat( ret, "\t", bufSize ); diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index e96387cae..0caf00e48 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -273,7 +273,7 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim for ( U32 groupIndex = 0; groupIndex < groupCount; ++groupIndex ) { // Copy string element. - dStrcpy( tempBuf, StringUnit::getUnit( groupList, groupIndex, " \t\n" ) ); + dStrcpy( tempBuf, StringUnit::getUnit( groupList, groupIndex, " \t\n" ), 256 ); // Append internal name. dStrcat( tempBuf, "_begingroup", 256 ); // Store Group. @@ -416,7 +416,7 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList for ( U32 fieldIndex = 0; fieldIndex < fieldCount; ++fieldIndex ) { // Copy string element. - dStrcpy( tempBuf, StringUnit::getUnit( fieldList, fieldIndex, " \t\n" ) ); + dStrcpy( tempBuf, StringUnit::getUnit( fieldList, fieldIndex, " \t\n" ), bufferSizes ); // Store field. fields.push_back( StringTable->insert( tempBuf ) ); diff --git a/Engine/source/console/fileSystemFunctions.cpp b/Engine/source/console/fileSystemFunctions.cpp index d8531ff7c..ec2d9c17d 100644 --- a/Engine/source/console/fileSystemFunctions.cpp +++ b/Engine/source/console/fileSystemFunctions.cpp @@ -495,7 +495,7 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ), // Copy the directory names to the buffer. for (S32 i = 0; i < directories.size(); i++) { - dStrcpy(p, directories[i]); + dStrcpy(p, directories[i], length - (p - buffer)); p += dStrlen(directories[i]); // Tab separated. p[0] = '\t'; @@ -537,7 +537,7 @@ DefineEngineFunction( fileModifiedTime, String, ( const char* fileName ),, String fileStr = Platform::localTimeToString( lt ); char *buffer = Con::getReturnBuffer( fileStr.size() ); - dStrcpy( buffer, fileStr ); + dStrcpy( buffer, fileStr, fileStr.size() ); return buffer; } @@ -560,7 +560,7 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),, String fileStr = Platform::localTimeToString( lt ); char *buffer = Con::getReturnBuffer( fileStr.size() ); - dStrcpy( buffer, fileStr ); + dStrcpy( buffer, fileStr, fileStr.size() ); return buffer; } @@ -609,7 +609,7 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),, S32 pathLen = dStrlen( fileName ); FrameTemp szPathCopy( pathLen + 1); - dStrcpy( szPathCopy, fileName ); + dStrcpy( szPathCopy, fileName, pathLen + 1 ); forwardslash( szPathCopy ); const char *path = dStrrchr(szPathCopy, '/'); @@ -618,7 +618,7 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),, else path++; char *ret = Con::getReturnBuffer(dStrlen(path) + 1); - dStrcpy(ret, path); + dStrcpy(ret, path, dStrlen(path) + 1); char *ext = dStrrchr(ret, '.'); if(ext) *ext = 0; @@ -635,7 +635,7 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),, S32 pathLen = dStrlen( fileName ); FrameTemp szPathCopy( pathLen + 1); - dStrcpy( szPathCopy, fileName ); + dStrcpy( szPathCopy, fileName, pathLen + 1 ); forwardslash( szPathCopy ); const char *name = dStrrchr(szPathCopy, '/'); @@ -644,7 +644,7 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),, else name++; char *ret = Con::getReturnBuffer(dStrlen(name)); - dStrcpy(ret, name); + dStrcpy(ret, name, dStrlen(name)); return ret; } @@ -658,7 +658,7 @@ DefineEngineFunction(filePath, String, ( const char* fileName ),, S32 pathLen = dStrlen( fileName ); FrameTemp szPathCopy( pathLen + 1); - dStrcpy( szPathCopy, fileName ); + dStrcpy( szPathCopy, fileName, pathLen + 1 ); forwardslash( szPathCopy ); const char *path = dStrrchr(szPathCopy, '/'); diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index db7b7254e..df2dd8b01 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -950,7 +950,7 @@ void PersistenceManager::updateToken( const U32 lineNumber, const U32 linePositi char* postString = ( char* ) dMalloc( postStringLen + 1 ); if( needQuotes ) postString[ 0 ] = '"'; - dStrcpy( &postString[ needQuotes ? 1 : 0 ], postStringSrc ); + dStrcpy( &postString[ needQuotes ? 1 : 0 ], postStringSrc, postStringLen + (needQuotes ? 0 : 1) ); postString[ postStringLen ] = 0; // Calculate the length of our new line diff --git a/Engine/source/console/scriptFilename.cpp b/Engine/source/console/scriptFilename.cpp index 9455826f7..332f01d26 100644 --- a/Engine/source/console/scriptFilename.cpp +++ b/Engine/source/console/scriptFilename.cpp @@ -189,7 +189,7 @@ bool expandToolScriptFilename(char *filename, U32 size, const char *src) // Relative to script directory if(cbFullPath) { - dStrcpy(varBuf, cbFullPath); + dStrcpy(varBuf, cbFullPath, 1024); slash = dStrrchr(varBuf, '/'); if(slash) *slash = 0; @@ -219,7 +219,7 @@ bool expandOldScriptFilename(char *filename, U32 size, const char *src) const StringTableEntry cbName = CodeBlock::getCurrentCodeBlockName(); if (!cbName) { - dStrcpy(filename, src); + dStrcpy(filename, src, size); return true; } @@ -244,7 +244,7 @@ bool expandOldScriptFilename(char *filename, U32 size, const char *src) *filename = 0; return false; } - dStrcpy(filename, src); + dStrcpy(filename, src, size); return true; } @@ -264,7 +264,7 @@ bool expandOldScriptFilename(char *filename, U32 size, const char *src) } dStrncpy(filename, cbName, length); - dStrcpy(filename+length, src+1); + dStrcpy(filename+length, src+1, size - length); return true; } diff --git a/Engine/source/console/sim.cpp b/Engine/source/console/sim.cpp index 0ea902b5c..cb01e8019 100644 --- a/Engine/source/console/sim.cpp +++ b/Engine/source/console/sim.cpp @@ -216,7 +216,7 @@ DefineConsoleFunction( getUniqueName, const char*, (const char * baseName), , return NULL; char *buffer = Con::getReturnBuffer( outName.size() ); - dStrcpy( buffer, outName ); + dStrcpy( buffer, outName, outName.size() ); return buffer; } @@ -241,7 +241,7 @@ DefineConsoleFunction( getUniqueInternalName, const char*, (const char * baseNam return NULL; char *buffer = Con::getReturnBuffer( outName.size() ); - dStrcpy( buffer, outName ); + dStrcpy( buffer, outName, outName.size() ); return buffer; } diff --git a/Engine/source/console/simDatablock.cpp b/Engine/source/console/simDatablock.cpp index ce689c054..e2984c16a 100644 --- a/Engine/source/console/simDatablock.cpp +++ b/Engine/source/console/simDatablock.cpp @@ -198,10 +198,10 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o } char obj_str[32]; - dStrcpy(obj_str, Con::getIntArg(obj->getId())); + dStrcpy(obj_str, Con::getIntArg(obj->getId()), 32); char index_str[32]; - dStrcpy(index_str, Con::getIntArg(index)); + dStrcpy(index_str, Con::getIntArg(index), 32); for (S32 i = 0; i < substitutions.size(); i++) { diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 0d2e5eb32..b47448414 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -320,7 +320,7 @@ void SimObject::writeFields(Stream &stream, U32 tabStop) U32 nBufferSize = dStrlen( val ) + 1; FrameTemp valCopy( nBufferSize ); - dStrcpy( (char *)valCopy, val ); + dStrcpy( (char *)valCopy, val, nBufferSize ); if (!writeField(f->pFieldname, valCopy)) continue; @@ -402,12 +402,12 @@ bool SimObject::save(const char *pcFileName, bool bOnlySelected, const char *pre char docRoot[256]; char modRoot[256]; - dStrcpy(docRoot, pcFileName); + dStrcpy(docRoot, pcFileName, 256); char *p = dStrrchr(docRoot, '/'); if (p) *++p = '\0'; else docRoot[0] = '\0'; - dStrcpy(modRoot, pcFileName); + dStrcpy(modRoot, pcFileName, 256); p = dStrchr(modRoot, '/'); if (p) *++p = '\0'; else modRoot[0] = '\0'; @@ -1028,7 +1028,7 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const else { char buf[256]; - dStrcpy(buf, slotName); + dStrcpy(buf, slotName, 256); dStrcat(buf, array, 256); StringTableEntry permanentSlotName = StringTable->insert(buf); mFieldDictionary->setFieldValue(permanentSlotName, value); @@ -1069,7 +1069,7 @@ const char *SimObject::getDataField(StringTableEntry slotName, const char *array else { static char buf[256]; - dStrcpy(buf, slotName); + dStrcpy(buf, slotName, 256); dStrcat(buf, array, 256); if (const char* val = mFieldDictionary->getFieldValue(StringTable->insert(buf))) return val; @@ -1310,7 +1310,7 @@ U32 SimObject::getDataFieldType( StringTableEntry slotName, const char* array ) else { static char buf[256]; - dStrcpy( buf, slotName ); + dStrcpy( buf, slotName, 256 ); dStrcat( buf, array, 256 ); return mFieldDictionary->getFieldType( StringTable->insert( buf ) ); @@ -1333,7 +1333,7 @@ void SimObject::setDataFieldType(const U32 fieldTypeId, StringTableEntry slotNam else { static char buf[256]; - dStrcpy( buf, slotName ); + dStrcpy( buf, slotName, 256 ); dStrcat( buf, array, 256 ); mFieldDictionary->setFieldType( StringTable->insert( buf ), fieldTypeId ); @@ -1354,7 +1354,7 @@ void SimObject::setDataFieldType(const char *typeName, StringTableEntry slotName else { static char buf[256]; - dStrcpy( buf, slotName ); + dStrcpy( buf, slotName, 256 ); dStrcat( buf, array, 256 ); StringTableEntry permanentSlotName = StringTable->insert(buf); diff --git a/Engine/source/console/simObjectMemento.cpp b/Engine/source/console/simObjectMemento.cpp index ef2e8f732..93a9db118 100644 --- a/Engine/source/console/simObjectMemento.cpp +++ b/Engine/source/console/simObjectMemento.cpp @@ -137,7 +137,7 @@ SimObject *SimObjectMemento::restore() const tempBuffer = ( char* ) dMalloc( dStrlen( mState ) + uniqueNameLen + 1 ); dMemcpy( tempBuffer, mState, numCharsToLeftParen ); dMemcpy( &tempBuffer[ numCharsToLeftParen ], uniqueName, uniqueNameLen ); - dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ] ); + dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ], dStrlen(mState) - numCharsToLeftParen + 1 ); } Con::evaluate( tempBuffer ); diff --git a/Engine/source/console/stringStack.h b/Engine/source/console/stringStack.h index d76ad71ec..0550bb61e 100644 --- a/Engine/source/console/stringStack.h +++ b/Engine/source/console/stringStack.h @@ -176,7 +176,7 @@ struct StringStack mLen = dStrlen(s); validateBufferSize(mStart + mLen + 2); - dStrcpy(mBuffer + mStart, s); + dStrcpy(mBuffer + mStart, s, mBufferSize - mStart); } /// Get the top of the stack, as a StringTableEntry. diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index f80389640..3ee527a04 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -668,13 +668,13 @@ void BitStream::readString(char buf[256]) { S32 offset = readInt(8); HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, stringBuffer + offset); - dStrcpy(buf, stringBuffer); + dStrcpy(buf, stringBuffer, 256); return; } } HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, buf); if(stringBuffer) - dStrcpy(stringBuffer, buf); + dStrcpy(stringBuffer, buf, 256); } void BitStream::writeString(const char *string, S32 maxLen) diff --git a/Engine/source/core/stringTable.cpp b/Engine/source/core/stringTable.cpp index 9a71603ae..17f2ca235 100644 --- a/Engine/source/core/stringTable.cpp +++ b/Engine/source/core/stringTable.cpp @@ -145,7 +145,7 @@ StringTableEntry _StringTable::insert(const char* _val, const bool caseSens) *walk = (Node *) mempool.alloc(sizeof(Node)); (*walk)->next = 0; (*walk)->val = (char *) mempool.alloc(dStrlen(val) + 1); - dStrcpy((*walk)->val, val); + dStrcpy((*walk)->val, val, dStrlen(val) + 1); ret = (*walk)->val; itemCount ++; } diff --git a/Engine/source/core/strings/findMatch.cpp b/Engine/source/core/strings/findMatch.cpp index 1bb35128e..bfa7d5a3b 100644 --- a/Engine/source/core/strings/findMatch.cpp +++ b/Engine/source/core/strings/findMatch.cpp @@ -72,7 +72,7 @@ void FindMatch::setExpression( const char *_expression ) delete [] expression; expression = new char[dStrlen(_expression) + 1]; - dStrcpy(expression, _expression); + dStrcpy(expression, _expression, dStrlen(_expression) + 1); dStrupr(expression); } @@ -82,7 +82,7 @@ bool FindMatch::findMatch( const char *str, bool caseSensitive ) return false; char nstr[512]; - dStrcpy( nstr,str ); + dStrcpy( nstr,str,512 ); dStrupr(nstr); if ( isMatch( expression, nstr, caseSensitive ) ) { @@ -143,7 +143,7 @@ bool FindMatch::isMatchMultipleExprs( const char *exps, const char *str, bool ca S32 len = dStrlen(exps); char *e = new char[len+1]; - dStrcpy(e,exps); + dStrcpy(e,exps,len+1); // [tom, 12/18/2006] This no longer supports space separated expressions as // they don't work when the paths have spaces in. diff --git a/Engine/source/core/strings/stringFunctions.cpp b/Engine/source/core/strings/stringFunctions.cpp index 3fe24c7f1..93db4fd47 100644 --- a/Engine/source/core/strings/stringFunctions.cpp +++ b/Engine/source/core/strings/stringFunctions.cpp @@ -216,7 +216,7 @@ S32 dStrnatcasecmp(const nat_char* a, const nat_char* b) { char *dStrdup_r(const char *src, const char *fileName, dsize_t lineNumber) { char *buffer = (char *) dMalloc_r(dStrlen(src) + 1, fileName, lineNumber); - dStrcpy(buffer, src); + dStrcpy(buffer, src, dStrlen(src) + 1); return buffer; } diff --git a/Engine/source/core/strings/stringFunctions.h b/Engine/source/core/strings/stringFunctions.h index 4c79bf32d..e4307a092 100644 --- a/Engine/source/core/strings/stringFunctions.h +++ b/Engine/source/core/strings/stringFunctions.h @@ -47,6 +47,7 @@ #endif // defined(TORQUE_OS_WIN) +#define DEBUG_CHECK_OVERFLOW 1 //------------------------------------------------------------------------------ // standard string functions [defined in platformString.cpp] @@ -60,12 +61,16 @@ inline char *dStrcat(char *dst, const char *src) inline char *dStrcat(char *dst, const char *src, dsize_t len) { +#ifdef DEBUG_CHECK_OVERFLOW + if (strlen(src) >= len) { + AssertWarn(false, "dStrcat out of range"); + } +#endif return strncat(dst,src,len - 1); //Safety because strncat copies at most len+1 characters } inline char *dStrncat(char *dst, const char *src, dsize_t len) { - AssertFatal(false, "Use dStrcat with length"); return dStrcat(dst, src, len); } @@ -94,9 +99,21 @@ inline S32 dStrnicmp(const char *str1, const char *str2, dsize_t len) return strncasecmp( str1, str2, len ); } +/// @deprecated Use strcpy(char *, const char *, dsize_t) instead inline char *dStrcpy(char *dst, const char *src) { + AssertFatal(false, "dStrcpy without length is deprecated"); return strcpy(dst,src); +} + +inline char *dStrcpy(char *dst, const char *src, dsize_t len) +{ +#ifdef DEBUG_CHECK_OVERFLOW + if (strlen(src) >= len) { + AssertWarn(false, "dStrcpy out of range"); + } +#endif + return strncpy(dst,src,len); } inline char *dStrncpy(char *dst, const char *src, dsize_t len) diff --git a/Engine/source/core/tokenizer.cpp b/Engine/source/core/tokenizer.cpp index a51d3d5ad..6d155d18a 100644 --- a/Engine/source/core/tokenizer.cpp +++ b/Engine/source/core/tokenizer.cpp @@ -61,7 +61,7 @@ bool Tokenizer::openFile(const char* pFileName) delete pStream; return false; } - dStrcpy(mFileName, pFileName); + dStrcpy(mFileName, pFileName, 1024); mBufferSize = pStream->getStreamSize(); mpBuffer = new char[mBufferSize]; @@ -99,7 +99,7 @@ void Tokenizer::setBuffer(const char* buffer, U32 bufferSize) mBufferSize = bufferSize; mpBuffer = new char[mBufferSize + 1]; - dStrcpy(mpBuffer, buffer); + dStrcpy(mpBuffer, buffer, mBufferSize + 1); reset(); @@ -634,4 +634,4 @@ bool Tokenizer::endOfFile() return false; else return true; -} \ No newline at end of file +} diff --git a/Engine/source/core/util/zip/centralDir.cpp b/Engine/source/core/util/zip/centralDir.cpp index e107df2e8..bf5bef92e 100644 --- a/Engine/source/core/util/zip/centralDir.cpp +++ b/Engine/source/core/util/zip/centralDir.cpp @@ -178,7 +178,7 @@ void CentralDir::setFileComment(const char *comment) { SAFE_DELETE_ARRAY(mFileComment); mFileComment = new char [dStrlen(comment)+1]; - dStrcpy(mFileComment, comment); + dStrcpy(mFileComment, comment, dStrlen(comment)+1); } //----------------------------------------------------------------------------- diff --git a/Engine/source/gfx/Null/gfxNullDevice.cpp b/Engine/source/gfx/Null/gfxNullDevice.cpp index f22e3bc7a..6b2b0b659 100644 --- a/Engine/source/gfx/Null/gfxNullDevice.cpp +++ b/Engine/source/gfx/Null/gfxNullDevice.cpp @@ -309,7 +309,7 @@ void GFXNullDevice::enumerateAdapters( Vector &adapterList ) vm.resolution.set(800,600); toAdd->mAvailableModes.push_back(vm); - dStrcpy(toAdd->mName, "GFX Null Device"); + dStrcpy(toAdd->mName, "GFX Null Device", GFXAdapter::MaxAdapterNameLen); adapterList.push_back(toAdd); } @@ -342,4 +342,4 @@ public: } }; -static GFXNullRegisterDevice pNullRegisterDevice; \ No newline at end of file +static GFXNullRegisterDevice pNullRegisterDevice; diff --git a/Engine/source/gfx/gfxStructs.cpp b/Engine/source/gfx/gfxStructs.cpp index dca361af1..ff8726b8b 100644 --- a/Engine/source/gfx/gfxStructs.cpp +++ b/Engine/source/gfx/gfxStructs.cpp @@ -40,7 +40,7 @@ void GFXVideoMode::parseFromString( const char *str ) // Copy the string, as dStrtok is destructive char *tempBuf = new char[dStrlen( str ) + 1]; - dStrcpy( tempBuf, str ); + dStrcpy( tempBuf, str, dStrlen(str) + 1 ); #define PARSE_ELEM(type, var, func, tokParam, sep) \ if(const char *ptr = dStrtok( tokParam, sep)) \ @@ -76,4 +76,4 @@ void GFXShaderMacro::stringize( const Vector ¯os, String *ou } (*outString) += ";"; } -} \ No newline at end of file +} diff --git a/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp b/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp index d909750b9..79308ce1c 100644 --- a/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp +++ b/Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp @@ -128,11 +128,11 @@ void GFXGLDevice::enumerateAdapters( Vector &adapterList ) if (renderer) { - dStrcpy(toAdd->mName, renderer); + dStrcpy(toAdd->mName, renderer, GFXAdapter::MaxAdapterNameLen); dStrcat(toAdd->mName, " OpenGL", GFXAdapter::MaxAdapterNameLen); } else - dStrcpy(toAdd->mName, "OpenGL"); + dStrcpy(toAdd->mName, "OpenGL", GFXAdapter::MaxAdapterNameLen); toAdd->mType = OpenGL; toAdd->mShaderModel = 0.f; diff --git a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp index eaf7d1449..cb71ca48c 100644 --- a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp +++ b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp @@ -129,11 +129,11 @@ void GFXGLDevice::enumerateAdapters( Vector &adapterList ) if (renderer) { - dStrcpy(toAdd->mName, renderer); + dStrcpy(toAdd->mName, renderer, GFXAdapter::MaxAdapterNameLen); dStrncat(toAdd->mName, " OpenGL", GFXAdapter::MaxAdapterNameLen); } else - dStrcpy(toAdd->mName, "OpenGL"); + dStrcpy(toAdd->mName, "OpenGL", GFXAdapter::MaxAdapterNameLen); toAdd->mType = OpenGL; toAdd->mShaderModel = 0.f; diff --git a/Engine/source/gfx/screenshot.cpp b/Engine/source/gfx/screenshot.cpp index f10802bf3..1ba48d75d 100644 --- a/Engine/source/gfx/screenshot.cpp +++ b/Engine/source/gfx/screenshot.cpp @@ -55,7 +55,7 @@ ScreenShot::ScreenShot() void ScreenShot::setPending( const char *filename, bool writeJPG, S32 tiles, F32 overlap ) { - dStrcpy( mFilename, filename ); + dStrcpy( mFilename, filename, 256 ); mWriteJPG = writeJPG; mTiles = getMax( tiles, 1 ); mPixelOverlap.set(getMin(overlap, 0.25f), getMin(overlap, 0.25f)); diff --git a/Engine/source/gui/containers/guiFormCtrl.cpp b/Engine/source/gui/containers/guiFormCtrl.cpp index a185af1e2..0c562d49d 100644 --- a/Engine/source/gui/containers/guiFormCtrl.cpp +++ b/Engine/source/gui/containers/guiFormCtrl.cpp @@ -218,7 +218,7 @@ bool GuiFormCtrl::resize(const Point2I &newPosition, const Point2I &newExtent) S32 strlen = dStrlen((const char*)mCaption); for(S32 i=strlen; i>=0; --i) { - dStrcpy(buf, ""); + dStrcpy(buf, "", i); dStrcat(buf, (const char*)mCaption, i); dStrcat(buf, "...", i); diff --git a/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp b/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp index eff5f1410..1f29caddc 100644 --- a/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp +++ b/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp @@ -168,7 +168,7 @@ bool guiAnimBitmapCtrl::ptSetFrameRanges(void *object, const char *index, const return true; } char* tokCopy = new char[dStrlen(data) + 1]; - dStrcpy(tokCopy, data); + dStrcpy(tokCopy, data, dStrlen(data) + 1); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) @@ -291,4 +291,4 @@ void guiAnimBitmapCtrl::onRender(Point2I offset, const RectI &updateRect) } renderChildControls(offset, updateRect); -} \ No newline at end of file +} diff --git a/Engine/source/gui/controls/guiFileTreeCtrl.cpp b/Engine/source/gui/controls/guiFileTreeCtrl.cpp index db38fbe58..b6531fbaa 100644 --- a/Engine/source/gui/controls/guiFileTreeCtrl.cpp +++ b/Engine/source/gui/controls/guiFileTreeCtrl.cpp @@ -276,7 +276,7 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path ) char szPathCopy [ 1024 ]; dMemset( szPathCopy, 0, 1024 ); - dStrcpy( szPathCopy, path ); + dStrcpy( szPathCopy, path, 1024 ); // Jump over the first character if it's a root / char *curPos = szPathCopy; diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index af172221a..0697c6a36 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -566,13 +566,14 @@ void GuiPopUpMenuCtrl::setBitmap( const char *name ) { char buffer[1024]; char *p; - dStrcpy(buffer, name); + dStrcpy(buffer, name, 1024); p = buffer + dStrlen(buffer); + S32 pLen = 1024 - dStrlen(buffer); - dStrcpy(p, "_n"); + dStrcpy(p, "_n", pLen); mTextureNormal = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) ); - dStrcpy(p, "_d"); + dStrcpy(p, "_d", pLen); mTextureDepressed = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__) ); if ( !mTextureDepressed ) mTextureDepressed = mTextureNormal; @@ -637,7 +638,7 @@ void GuiPopUpMenuCtrl::addEntry( const char *buf, S32 id, U32 scheme ) mIdMax = id; Entry e; - dStrcpy( e.buf, buf ); + dStrcpy( e.buf, buf, 256 ); e.id = id; e.scheme = scheme; diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 3c6415117..fc7811e69 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -771,13 +771,14 @@ void GuiPopUpMenuCtrlEx::setBitmap(const char *name) { char buffer[1024]; char *p; - dStrcpy(buffer, name); + dStrcpy(buffer, name, 1024); p = buffer + dStrlen(buffer); + S32 pLen = 1024 - dStrlen(buffer); - dStrcpy(p, "_n"); + dStrcpy(p, "_n", pLen); mTextureNormal = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureNormal (line %d)", __FUNCTION__, __LINE__) ); - dStrcpy(p, "_d"); + dStrcpy(p, "_d", pLen); mTextureDepressed = GFXTexHandle( (StringTableEntry)buffer, &GFXDefaultGUIProfile, avar("%s() - mTextureDepressed (line %d)", __FUNCTION__, __LINE__) ); if ( !mTextureDepressed ) mTextureDepressed = mTextureNormal; @@ -840,7 +841,7 @@ void GuiPopUpMenuCtrlEx::addEntry(const char *buf, S32 id, U32 scheme) mIdMax = id; Entry e; - dStrcpy( e.buf, buf ); + dStrcpy( e.buf, buf, 256 ); e.id = id; e.scheme = scheme; diff --git a/Engine/source/gui/controls/guiTabPageCtrl.cpp b/Engine/source/gui/controls/guiTabPageCtrl.cpp index ada0a2712..c87363cde 100644 --- a/Engine/source/gui/controls/guiTabPageCtrl.cpp +++ b/Engine/source/gui/controls/guiTabPageCtrl.cpp @@ -50,7 +50,7 @@ GuiTabPageCtrl::GuiTabPageCtrl(void) { setExtent(Point2I(100, 200)); mFitBook = false; - dStrcpy(mText,(UTF8*)"TabPage"); + dStrcpy(mText,(UTF8*)"TabPage", MAX_STRING_LENGTH); mActive = true; mIsContainer = true; } diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 9d45147e1..a4c5aff70 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -4754,15 +4754,15 @@ StringTableEntry GuiTreeViewCtrl::getTextToRoot( S32 itemId, const char * delimi dMemset( bufferOne, 0, sizeof(bufferOne) ); dMemset( bufferTwo, 0, sizeof(bufferTwo) ); - dStrcpy( bufferOne, item->getText() ); + dStrcpy( bufferOne, item->getText(), 1024 ); Item *prevNode = item->mParent; while ( prevNode ) { dMemset( bufferNodeText, 0, sizeof(bufferNodeText) ); - dStrcpy( bufferNodeText, prevNode->getText() ); + dStrcpy( bufferNodeText, prevNode->getText(), 128 ); dSprintf( bufferTwo, 1024, "%s%s%s",bufferNodeText, delimiter, bufferOne ); - dStrcpy( bufferOne, bufferTwo ); + dStrcpy( bufferOne, bufferTwo, 1024 ); dMemset( bufferTwo, 0, sizeof(bufferTwo) ); prevNode = prevNode->mParent; } @@ -5570,4 +5570,4 @@ DefineEngineMethod(GuiTreeViewCtrl, getItemAtPosition, S32, (Point2I position), "@return The id of the item under the position.") { return object->getItemAtPosition(position); -} \ No newline at end of file +} diff --git a/Engine/source/gui/core/guiControl.cpp b/Engine/source/gui/core/guiControl.cpp index 968fc9a16..6fded2e92 100644 --- a/Engine/source/gui/core/guiControl.cpp +++ b/Engine/source/gui/core/guiControl.cpp @@ -2570,7 +2570,7 @@ DefineEngineMethod( GuiControl, findHitControls, const char*, ( S32 x, S32 y, S3 return ""; char* buffer = Con::getReturnBuffer( s.size() ); - dStrcpy( buffer, s.c_str() ); + dStrcpy( buffer, s.c_str(), s.size() ); return buffer; } diff --git a/Engine/source/gui/editor/guiDebugger.cpp b/Engine/source/gui/editor/guiDebugger.cpp index b77a909e4..fb888538a 100644 --- a/Engine/source/gui/editor/guiDebugger.cpp +++ b/Engine/source/gui/editor/guiDebugger.cpp @@ -431,7 +431,7 @@ bool DbgFileView::findMouseOverVariable() { S32 stringPosition = pt.x - gFileXOffset; char tempBuf[256], *varNamePtr = &tempBuf[1]; - dStrcpy(tempBuf, mFileView[cell.y].text); + dStrcpy(tempBuf, mFileView[cell.y].text, 256); //find the current mouse over char S32 charNum = findMouseOverChar(mFileView[cell.y].text, stringPosition); @@ -526,7 +526,7 @@ void DbgFileView::onPreRender() { setUpdate(); char oldVar[256]; - dStrcpy(oldVar, mMouseOverVariable); + dStrcpy(oldVar, mMouseOverVariable, 256); bool found = findMouseOverVariable(); if (found && mPCCurrentLine >= 0) { @@ -685,7 +685,7 @@ void DbgFileView::onRenderCell(Point2I offset, Point2I cell, bool selected, bool { S32 startPos, endPos; char tempBuf[256]; - dStrcpy(tempBuf, mFileView[cell.y].text); + dStrcpy(tempBuf, mFileView[cell.y].text, 256); //get the end coord tempBuf[mBlockEnd] = '\0'; diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 09644d990..571d1df84 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -2626,7 +2626,7 @@ DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , " String str = String::ToString( "%i %i %i %i", bounds.point.x, bounds.point.y, bounds.extent.x, bounds.extent.y ); char* buffer = Con::getReturnBuffer( str.length() ); - dStrcpy( buffer, str.c_str() ); + dStrcpy( buffer, str.c_str(), str.length() ); return buffer; } diff --git a/Engine/source/gui/editor/guiFilterCtrl.cpp b/Engine/source/gui/editor/guiFilterCtrl.cpp index 6b7662bd5..67a0232ae 100644 --- a/Engine/source/gui/editor/guiFilterCtrl.cpp +++ b/Engine/source/gui/editor/guiFilterCtrl.cpp @@ -239,7 +239,7 @@ void Filter::set(S32 argc, const char *argv[]) if (argc == 1) { // in the form of one string "1.0 1.0 1.0" char list[1024]; - dStrcpy(list, *argv); // strtok modifies the string so we need to copy it + dStrcpy(list, *argv, 1024); // strtok modifies the string so we need to copy it char *value = dStrtok(list, " "); while (value) { diff --git a/Engine/source/gui/utility/messageVector.cpp b/Engine/source/gui/utility/messageVector.cpp index 2ee18387f..19255e38b 100644 --- a/Engine/source/gui/utility/messageVector.cpp +++ b/Engine/source/gui/utility/messageVector.cpp @@ -500,7 +500,7 @@ void MessageVector::insertLine(const U32 position, U32 len = dStrlen(newMessage) + 1; char* copy = new char[len]; - dStrcpy(copy, newMessage); + dStrcpy(copy, newMessage, len); mMessageLines.insert(position); mMessageLines[position].message = copy; diff --git a/Engine/source/i18n/lang.cpp b/Engine/source/i18n/lang.cpp index 24f2e2d59..3ed0d344c 100644 --- a/Engine/source/i18n/lang.cpp +++ b/Engine/source/i18n/lang.cpp @@ -43,7 +43,7 @@ LangFile::LangFile(const UTF8 *langName /* = NULL */) if(langName) { mLangName = new UTF8 [dStrlen(langName) + 1]; - dStrcpy(mLangName, langName); + dStrcpy(mLangName, langName, dStrlen(langName) + 1); } else mLangName = NULL; @@ -137,7 +137,7 @@ const UTF8 * LangFile::getString(U32 id) U32 LangFile::addString(const UTF8 *str) { UTF8 *newstr = new UTF8 [dStrlen(str) + 1]; - dStrcpy(newstr, str); + dStrcpy(newstr, str, dStrlen(str) + 1); mStringTable.push_back(newstr); return mStringTable.size() - 1; } @@ -157,7 +157,7 @@ void LangFile::setString(U32 id, const UTF8 *str) SAFE_DELETE_ARRAY(mStringTable[id]); UTF8 *newstr = new UTF8 [dStrlen(str) + 1]; - dStrcpy(newstr, str); + dStrcpy(newstr, str, dStrlen(str) + 1); mStringTable[id] = newstr; } @@ -167,7 +167,7 @@ void LangFile::setLangName(const UTF8 *newName) delete [] mLangName; mLangName = new UTF8 [dStrlen(newName) + 1]; - dStrcpy(mLangName, newName); + dStrcpy(mLangName, newName, dStrlen(newName) + 1); } void LangFile::setLangFile(const UTF8 *langFile) @@ -176,7 +176,7 @@ void LangFile::setLangFile(const UTF8 *langFile) delete [] mLangFile; mLangFile = new UTF8 [dStrlen(langFile) + 1]; - dStrcpy(mLangFile, langFile); + dStrcpy(mLangFile, langFile, dStrlen(langFile) + 1); } bool LangFile::activateLanguage() @@ -350,7 +350,7 @@ DefineConsoleMethod(LangTable, getString, const char *, (U32 id), , if(str != NULL) { char * ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str); + dStrcpy(ret, str, dStrlen(str) + 1); return ret; } @@ -388,7 +388,7 @@ DefineConsoleMethod(LangTable, getLangName, const char *, (S32 langId), , "(int if(str != NULL) { char * ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str); + dStrcpy(ret, str, dStrlen(str) + 1); return ret; } @@ -414,7 +414,7 @@ UTF8 *sanitiseVarName(const UTF8 *varName, UTF8 *buffer, U32 bufsize) return NULL; } - dStrcpy(buffer, (const UTF8*)"I18N::"); + dStrcpy(buffer, (const UTF8*)"I18N::", bufsize); UTF8 *dptr = buffer + 6; const UTF8 *sptr = varName; @@ -575,4 +575,4 @@ ConsoleFunction(CompileLanguage, void, 2, 3, "(string inputFile, [bool createMap delete mapStream; } } -//end lang_ localization \ No newline at end of file +//end lang_ localization diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index d116fe0f3..3ef1b1d01 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -654,33 +654,33 @@ DefineConsoleMethod( Material, getAnimFlags, const char*, (U32 id), , "" ) if(object->mAnimFlags[ id ] & Material::Scroll) { if(dStrcmp( animFlags, "" ) == 0) - dStrcpy( animFlags, "$Scroll" ); + dStrcpy( animFlags, "$Scroll", 512 ); } if(object->mAnimFlags[ id ] & Material::Rotate) { if(dStrcmp( animFlags, "" ) == 0) - dStrcpy( animFlags, "$Rotate" ); + dStrcpy( animFlags, "$Rotate", 512 ); else dStrcat( animFlags, " | $Rotate", 512); } if(object->mAnimFlags[ id ] & Material::Wave) { if(dStrcmp( animFlags, "" ) == 0) - dStrcpy( animFlags, "$Wave" ); + dStrcpy( animFlags, "$Wave", 512 ); else dStrcat( animFlags, " | $Wave", 512); } if(object->mAnimFlags[ id ] & Material::Scale) { if(dStrcmp( animFlags, "" ) == 0) - dStrcpy( animFlags, "$Scale" ); + dStrcpy( animFlags, "$Scale", 512 ); else dStrcat( animFlags, " | $Scale", 512); } if(object->mAnimFlags[ id ] & Material::Sequence) { if(dStrcmp( animFlags, "" ) == 0) - dStrcpy( animFlags, "$Sequence" ); + dStrcpy( animFlags, "$Sequence", 512 ); else dStrcat( animFlags, " | $Sequence", 512); } diff --git a/Engine/source/module/moduleDefinition.h b/Engine/source/module/moduleDefinition.h index 42deff44d..8652876cf 100644 --- a/Engine/source/module/moduleDefinition.h +++ b/Engine/source/module/moduleDefinition.h @@ -254,11 +254,11 @@ protected: for ( U32 dependencyIndex = 0; dependencyIndex < dependencyWordCount; ++dependencyIndex ) { // Fetch slot. - dStrcpy( slotUnit, StringUnit::getUnit( pDependencyValue, dependencyIndex, "," ) ); + dStrcpy( slotUnit, StringUnit::getUnit( pDependencyValue, dependencyIndex, "," ), 256 ); // Fetch slot name and value. - dStrcpy( slotName, StringUnit::getUnit( slotUnit, 0, "=" ) ); - dStrcpy( slotValue, StringUnit::getUnit( slotUnit, 1, "=" ) ); + dStrcpy( slotName, StringUnit::getUnit( slotUnit, 0, "=" ), 256 ); + dStrcpy( slotValue, StringUnit::getUnit( slotUnit, 1, "=" ), 256 ); // Fetch module Id. StringTableEntry moduleId = StringTable->insert( slotName ); diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index fa53728b7..ec45ad918 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -74,7 +74,7 @@ ModuleManager::ModuleManager() : mIgnoreLoadedGroups(false) { // Set module extension. - dStrcpy( mModuleExtension, MODULE_MANAGER_MODULE_DEFINITION_EXTENSION ); + dStrcpy( mModuleExtension, MODULE_MANAGER_MODULE_DEFINITION_EXTENSION, 256 ); } //----------------------------------------------------------------------------- @@ -155,7 +155,7 @@ bool ModuleManager::setModuleExtension( const char* pExtension ) } // Set module extension. - dStrcpy( mModuleExtension, pExtension ); + dStrcpy( mModuleExtension, pExtension, 256 ); return true; } diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index f364ed0ce..9b9c3bfa7 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -708,7 +708,7 @@ ImplementEnumType(_TamlFormatMode, U32 nBufferSize = dStrlen(pFieldValue) + 1; FrameTemp valueCopy(nBufferSize); - dStrcpy((char *)valueCopy, pFieldValue); + dStrcpy((char *)valueCopy, pFieldValue, nBufferSize); // Skip if field should not be written. if (!pSimObject->writeField(fieldName, valueCopy)) @@ -1547,4 +1547,4 @@ ImplementEnumType(_TamlFormatMode, TiXmlElement* pAnyElement = new TiXmlElement("xs:any"); pAnyElement->SetAttribute("processContents", "skip"); pSequenceElement->LinkEndChild(pAnyElement); - } \ No newline at end of file + } diff --git a/Engine/source/persistence/taml/tamlCustom.cpp b/Engine/source/persistence/taml/tamlCustom.cpp index 83c063a61..e45984dd4 100644 --- a/Engine/source/persistence/taml/tamlCustom.cpp +++ b/Engine/source/persistence/taml/tamlCustom.cpp @@ -53,7 +53,7 @@ void TamlCustomField::set( const char* pFieldName, const char* pFieldValue ) } #endif // Copy field value. - dStrcpy( mFieldValue, pFieldValue ); + dStrcpy( mFieldValue, pFieldValue, MAX_TAML_NODE_FIELDVALUE_LENGTH ); } //----------------------------------------------------------------------------- diff --git a/Engine/source/persistence/taml/tamlCustom.h b/Engine/source/persistence/taml/tamlCustom.h index 261c77dde..2f3ba857e 100644 --- a/Engine/source/persistence/taml/tamlCustom.h +++ b/Engine/source/persistence/taml/tamlCustom.h @@ -334,7 +334,7 @@ public: // Sanity! AssertFatal( fieldNameLength < sizeof(fieldNameBuffer), "TamlCustomField: Field name is too long." ); - dStrcpy( fieldNameBuffer, mFieldName ); + dStrcpy( fieldNameBuffer, mFieldName, 1024 ); fieldNameBuffer[fieldNameLength-1] = 0; StringTableEntry fieldName = StringTable->insert( fieldNameBuffer ); @@ -782,4 +782,4 @@ private: TamlCustomNodeVector mNodes; }; -#endif // _TAML_CUSTOM_H_ \ No newline at end of file +#endif // _TAML_CUSTOM_H_ diff --git a/Engine/source/persistence/taml/tamlWriteNode.h b/Engine/source/persistence/taml/tamlWriteNode.h index 5ec722045..015224589 100644 --- a/Engine/source/persistence/taml/tamlWriteNode.h +++ b/Engine/source/persistence/taml/tamlWriteNode.h @@ -54,7 +54,7 @@ public: // Allocate and copy the value. mpValue = new char[ dStrlen(pValue)+1 ]; - dStrcpy( (char *)mpValue, pValue ); + dStrcpy( (char *)mpValue, pValue, dStrlen(pValue) + 1 ); } @@ -113,4 +113,4 @@ public: TamlCustomNodes mCustomNodes; }; -#endif // _TAML_WRITE_NODE_H_ \ No newline at end of file +#endif // _TAML_WRITE_NODE_H_ diff --git a/Engine/source/platform/nativeDialogs/fileDialog.cpp b/Engine/source/platform/nativeDialogs/fileDialog.cpp index ad8bdfafb..21bdfefa3 100644 --- a/Engine/source/platform/nativeDialogs/fileDialog.cpp +++ b/Engine/source/platform/nativeDialogs/fileDialog.cpp @@ -433,7 +433,7 @@ bool FileDialog::setDefaultPath(void *object, const char *index, const char *dat // Copy and Backslash the path (Windows dialogs are VERY picky about this format) static char szPathValidate[512]; - dStrcpy(szPathValidate, data); + dStrcpy(szPathValidate, data, 512); Platform::makeFullPathName(data, szPathValidate, sizeof(szPathValidate)); //backslash( szPathValidate ); diff --git a/Engine/source/platform/platformFileIO.cpp b/Engine/source/platform/platformFileIO.cpp index 15fd9ad6d..a9ace740b 100644 --- a/Engine/source/platform/platformFileIO.cpp +++ b/Engine/source/platform/platformFileIO.cpp @@ -534,7 +534,7 @@ StringTableEntry Platform::makeRelativePathName(const char *path, const char *to // Copy the rest if(*branch) - dStrcpy(bufPtr, branch + 1); + dStrcpy(bufPtr, branch + 1, temp.size - (bufPtr - temp.ptr)); else *--bufPtr = 0; diff --git a/Engine/source/platform/platformMemory.cpp b/Engine/source/platform/platformMemory.cpp index d295a45e4..5f7aa926d 100644 --- a/Engine/source/platform/platformMemory.cpp +++ b/Engine/source/platform/platformMemory.cpp @@ -1130,7 +1130,7 @@ static void logFree(const AllocatedHeader* hdr) void enableLogging(const char* fileName) { - dStrcpy(gLogFilename, fileName); + dStrcpy(gLogFilename, fileName, 256); if (!gEnableLogging) { gEnableLogging = true; diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index a77d29474..47b655ed2 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -280,7 +280,7 @@ namespace PlatformNetState if (addressString[0] == '[') { // Must be ipv6 notation - dStrcpy(outAddress, addressString+1); + dStrcpy(outAddress, addressString+1, 256); addressString = outAddress; portString = dStrchr(outAddress, ']'); @@ -305,7 +305,7 @@ namespace PlatformNetState } else { - dStrcpy(outAddress, addressString); + dStrcpy(outAddress, addressString, 256); addressString = outAddress; // Check to see if we have multiple ":" which would indicate this is an ipv6 address @@ -546,7 +546,7 @@ static PolledSocket* addPolledSocket(NetSocket handleFd, SOCKET fd, S32 state, sock->handleFd = handleFd; sock->state = state; if (remoteAddr) - dStrcpy(sock->remoteAddr, remoteAddr); + dStrcpy(sock->remoteAddr, remoteAddr, 256); if (port != -1) sock->remotePort = port; gPolledSockets.push_back(sock); diff --git a/Engine/source/platform/platformRedBook.cpp b/Engine/source/platform/platformRedBook.cpp index d95a0eb92..82b1bae2d 100644 --- a/Engine/source/platform/platformRedBook.cpp +++ b/Engine/source/platform/platformRedBook.cpp @@ -94,7 +94,7 @@ void RedBook::setLastError(const char * error) if(!error || dStrlen(error) >= sizeof(smLastError)) setLastError("Invalid error string passed"); else - dStrcpy(smLastError, error); + dStrcpy(smLastError, error, 1024); } const char * RedBook::getLastError() diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index e70eb6c02..d623443ab 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -328,9 +328,9 @@ const char * Profiler::constructProfilePath(ProfilerData * pd) U32 mark = FrameAllocator::getWaterMark(); char * buf = (char*)FrameAllocator::alloc(len+1); - dStrcpy(buf,pd->mParent->mPath); - dStrcat(buf,connector,len); - dStrcat(buf,pd->mRoot->mName,len); + dStrcpy(buf,pd->mParent->mPath,len+1); + dStrcat(buf,connector,len+1); + dStrcat(buf,pd->mRoot->mName,len+1); const char * ret = StringTable->insert(buf); FrameAllocator::setWaterMark(mark); @@ -433,7 +433,7 @@ void Profiler::dumpToFile(const char* fileName) AssertFatal(dStrlen(fileName) < DumpFileNameLength, "Error, dump filename too long"); mDumpToFile = true; mDumpToConsole = false; - dStrcpy(mDumpFileName, fileName); + dStrcpy(mDumpFileName, fileName, DumpFileNameLength); } void Profiler::hashPop(ProfilerRootData *expected) @@ -645,11 +645,11 @@ void Profiler::dump() AssertFatal(success, "Cannot write profile dump to specified file!"); char buffer[1024]; - dStrcpy(buffer, "Profiler Data Dump:\n"); + dStrcpy(buffer, "Profiler Data Dump:\n", 1024); fws.write(dStrlen(buffer), buffer); - dStrcpy(buffer, "Ordered by non-sub total time -\n"); + dStrcpy(buffer, "Ordered by non-sub total time -\n", 1024); fws.write(dStrlen(buffer), buffer); - dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n"); + dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n", 1024); fws.write(dStrlen(buffer), buffer); for(U32 i = 0; i < rootVector.size(); i++) @@ -665,9 +665,9 @@ void Profiler::dump() rootVector[i]->mTotalTime = 0; rootVector[i]->mSubTime = 0; } - dStrcpy(buffer, "\nOrdered by non-sub total time -\n"); + dStrcpy(buffer, "\nOrdered by non-sub total time -\n", 1024); fws.write(dStrlen(buffer), buffer); - dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n"); + dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n", 1024); fws.write(dStrlen(buffer), buffer); mCurrentProfilerData->mTotalTime = endHighResolutionTimer(mCurrentProfilerData->mStartTime); diff --git a/Engine/source/platformMac/macFileIO.mm b/Engine/source/platformMac/macFileIO.mm index f11b5b052..767dbca8e 100644 --- a/Engine/source/platformMac/macFileIO.mm +++ b/Engine/source/platformMac/macFileIO.mm @@ -894,7 +894,7 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve { char child[1024]; if ( (basePath[dStrlen(basePath) - 1]) == '/') - dStrcpy (child, d->d_name); + dStrcpy (child, d->d_name, 1024); else dSprintf(child, 1024, "/%s", d->d_name); if (currentDepth < recurseDepth || recurseDepth == -1) diff --git a/Engine/source/platformWin32/minidump/winMiniDump.cpp b/Engine/source/platformWin32/minidump/winMiniDump.cpp index fbe2b96f6..267b6fc3f 100644 --- a/Engine/source/platformWin32/minidump/winMiniDump.cpp +++ b/Engine/source/platformWin32/minidump/winMiniDump.cpp @@ -144,7 +144,7 @@ INT CreateMiniDump( LPEXCEPTION_POINTERS ExceptionInfo) //copy over the pdb file char pdbName[1024]; - dStrcpy(pdbName, exeName); + dStrcpy(pdbName, exeName, 1024); dStrncat(pdbName, ".pdb", 4); dSprintf(fromFile, 2048, "%s/%s", Platform::getCurrentDirectory(), pdbName ); dSprintf(fileName, 2048, "%s/%s", crashPath, pdbName ); diff --git a/Engine/source/platformWin32/nativeDialogs/fileDialog.cpp b/Engine/source/platformWin32/nativeDialogs/fileDialog.cpp index 1d64139ee..e73bbe65b 100644 --- a/Engine/source/platformWin32/nativeDialogs/fileDialog.cpp +++ b/Engine/source/platformWin32/nativeDialogs/fileDialog.cpp @@ -142,7 +142,7 @@ static UINT_PTR CALLBACK FolderHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPA #ifdef UNICODE convertUTF16toUTF8(buf, filePath); #else - dStrcpy( filePath, buf ); + dStrcpy( filePath, buf, MAX_PATH ); #endif // [tom, 12/8/2006] Hack to remove files from the list because @@ -333,8 +333,8 @@ bool FileDialog::Execute() char pszFile[MAX_PATH]; char pszFilter[1024]; char pszFileTitle[MAX_PATH]; - dStrcpy( pszFile, mData.mDefaultFile ); - dStrcpy( pszFilter, mData.mFilters ); + dStrcpy( pszFile, mData.mDefaultFile, MAX_PATH ); + dStrcpy( pszFilter, mData.mFilters, 1024 ); const char* pszInitialDir = mData.mDefaultPath; const char* pszTitle = mData.mTitle; @@ -447,7 +447,7 @@ bool FileDialog::Execute() convertUTF16toUTF8DoubleNULL( (UTF16*)pszFile, (UTF8*)pszResult, sizeof(pszResult)); #else if(pszFileTitle[0] || ! ( mData.mStyle & FileDialogData::FDS_OPEN && mData.mStyle & FileDialogData::FDS_MULTIPLEFILES )) - dStrcpy(pszResult,pszFile); + dStrcpy(pszResult,pszFile,MAX_PATH); else { // [tom, 1/4/2007] pszResult is a double-NULL terminated, NULL separated list in this case so we can't just dSstrcpy() @@ -614,7 +614,7 @@ bool FileDialog::setDefaultPath( void *object, const char *index, const char *da // Copy and Backslash the path (Windows dialogs are VERY picky about this format) static char szPathValidate[512]; - dStrcpy( szPathValidate, data ); + dStrcpy( szPathValidate, data, 512 ); Platform::makeFullPathName( data,szPathValidate, sizeof(szPathValidate)); backslash( szPathValidate ); diff --git a/Engine/source/platformWin32/winDInputDevice.cpp b/Engine/source/platformWin32/winDInputDevice.cpp index 1bfed04f8..c2969c65c 100644 --- a/Engine/source/platformWin32/winDInputDevice.cpp +++ b/Engine/source/platformWin32/winDInputDevice.cpp @@ -1576,7 +1576,7 @@ const char* DInputDevice::getJoystickAxesString() } char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); - dStrcpy( returnString, buf ); + dStrcpy( returnString, buf, dStrlen(buf) + 1 ); return( returnString ); } diff --git a/Engine/source/platformWin32/winFileio.cpp b/Engine/source/platformWin32/winFileio.cpp index 1fba156f5..83b7e1859 100644 --- a/Engine/source/platformWin32/winFileio.cpp +++ b/Engine/source/platformWin32/winFileio.cpp @@ -56,7 +56,7 @@ bool dFileDelete(const char * name) #ifdef UNICODE convertUTF8toUTF16N( name, buf, buf.size ); #else - dStrcpy( buf, name ); + dStrcpy( buf, name, buf.size ); #endif backslash( buf ); @@ -88,8 +88,8 @@ bool dFileRename(const char *oldName, const char *newName) convertUTF8toUTF16N( oldName, oldf, oldf.size ); convertUTF8toUTF16N( newName, newf, newf.size ); #else - dStrcpy(oldf, oldName); - dStrcpy(newf, newName); + dStrcpy(oldf, oldName, oldf.size); + dStrcpy(newf, newName, newf.size); #endif backslash(oldf); backslash(newf); @@ -106,7 +106,7 @@ bool dFileTouch(const char * name) #ifdef UNICODE convertUTF8toUTF16N( name, buf, buf.size ); #else - dStrcpy( buf, name ); + dStrcpy( buf, name, buf.size ); #endif backslash( buf ); @@ -133,8 +133,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) convertUTF8toUTF16N( fromName, from, from.size ); convertUTF8toUTF16N( toName, to, to.size ); #else - dStrcpy( from, fromName ); - dStrcpy( to, toName ); + dStrcpy( from, fromName, from.size ); + dStrcpy( to, toName, to.size ); #endif backslash( from ); @@ -270,7 +270,7 @@ File::FileStatus File::open(const char *filename, const AccessMode openMode) #ifdef UNICODE convertUTF8toUTF16N( filename, fname, fname.size ); #else - dStrcpy(fname, filename); + dStrcpy(fname, filename, fname.size); #endif backslash( fname ); @@ -679,7 +679,7 @@ bool Platform::getFileTimes(const char *filePath, FileTime *createTime, FileTime #ifdef UNICODE convertUTF8toUTF16N( filePath, fp, fp.size ); #else - dStrcpy( fp, filePath ); + dStrcpy( fp, filePath, fp.size ); #endif backslash( fp ); @@ -834,7 +834,7 @@ bool Platform::setCurrentDirectory(StringTableEntry newDir) #ifdef UNICODE convertUTF8toUTF16N( newDir, buf, buf.size - 1 ); #else - dStrcpy( buf, newDir ); + dStrcpy( buf, newDir, buf.size ); #endif backslash( buf ); @@ -949,7 +949,7 @@ bool Platform::isFile(const char *pFilePath) #ifdef UNICODE convertUTF8toUTF16N( pFilePath, buf, buf.size ); #else - dStrcpy( buf, pFilePath ); + dStrcpy( buf, pFilePath, buf.size ); #endif backslash( buf ); @@ -988,7 +988,7 @@ S32 Platform::getFileSize(const char *pFilePath) #ifdef UNICODE convertUTF8toUTF16N( pFilePath, buf, buf.size ); #else - dStrcpy( buf, pFilePath ); + dStrcpy( buf, pFilePath, buf.size ); #endif backslash( buf ); @@ -1025,7 +1025,7 @@ bool Platform::isDirectory(const char *pDirPath) #ifdef UNICODE convertUTF8toUTF16N( pDirPath, buf, buf.size ); #else - dStrcpy( buf, pDirPath ); + dStrcpy( buf, pDirPath, buf.size ); #endif backslash( buf ); @@ -1072,8 +1072,8 @@ bool Platform::isSubDirectory(const char *pParent, const char *pDir) convertUTF8toUTF16N( fileName, file, file.size ); convertUTF8toUTF16N( pDir, dir, dir.size ); #else - dStrcpy( file, fileName ); - dStrcpy( dir, pDir ); + dStrcpy( file, fileName, file.size ); + dStrcpy( dir, pDir, dir.size ); #endif backslash( file ); @@ -1257,7 +1257,7 @@ bool Platform::hasSubDirectory(const char *pPath) // Compose our search string - Format : ([path]/[subpath]/*) char trail = pPath[ dStrlen(pPath) - 1 ]; if( trail == '/' ) - dStrcpy( searchBuf, pPath ); + dStrcpy( searchBuf, pPath, 1024 ); else dSprintf(searchBuf, 1024, "%s/*", pPath ); diff --git a/Engine/source/platformWin32/winRedbook.cpp b/Engine/source/platformWin32/winRedbook.cpp index 309f7513a..40b030c64 100644 --- a/Engine/source/platformWin32/winRedbook.cpp +++ b/Engine/source/platformWin32/winRedbook.cpp @@ -84,7 +84,7 @@ void installRedBookDevices() { Win32RedBookDevice * device = new Win32RedBookDevice; device->mDeviceName = new char[dStrlen(str) + 1]; - dStrcpy(device->mDeviceName, str); + dStrcpy(device->mDeviceName, str, dStrlen(str) + 1); RedBook::installDevice(device); } diff --git a/Engine/source/platformWin32/winWindow.cpp b/Engine/source/platformWin32/winWindow.cpp index 74738f3b5..63fb5ea54 100644 --- a/Engine/source/platformWin32/winWindow.cpp +++ b/Engine/source/platformWin32/winWindow.cpp @@ -606,7 +606,7 @@ const char* Platform::getLoginPassword() if ( RegQueryValueEx( regKey, dT("LoginPassword"), NULL, NULL, buf, &size ) == ERROR_SUCCESS ) { returnString = Con::getReturnBuffer( size + 1 ); - dStrcpy( returnString, (const char*) buf ); + dStrcpy( returnString, (const char*) buf, size + 1 ); } RegCloseKey( regKey ); diff --git a/Engine/source/sfx/openal/sfxALProvider.cpp b/Engine/source/sfx/openal/sfxALProvider.cpp index dc6714b5a..47b2444b3 100644 --- a/Engine/source/sfx/openal/sfxALProvider.cpp +++ b/Engine/source/sfx/openal/sfxALProvider.cpp @@ -114,7 +114,7 @@ void SFXALProvider::init() dSprintf( temp, sizeof( temp ), "[EAX %d.0] %s", eax, ( mALDL->IsExtensionSupported( i, SFXALEAXRAM ) ? "EAX-RAM" : "" ) ); } else - dStrcpy( temp, "" ); + dStrcpy( temp, "", 256 ); info->driver = String::ToString( deviceFormat, major, minor, temp ); info->hasHardware = eax > 0; @@ -144,4 +144,4 @@ SFXDevice *SFXALProvider::createDevice( const String& deviceName, bool useHardwa return new SFXALDevice( this, mOpenAL, info->name, useHardware, maxBuffers ); return NULL; -} \ No newline at end of file +} diff --git a/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp index 66d746ebe..db449b49f 100644 --- a/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderCompGLSL.cpp @@ -142,7 +142,7 @@ void AppVertConnectorGLSL::sortVars() void AppVertConnectorGLSL::setName( char *newName ) { - dStrcpy( (char*)mName, newName ); + dStrcpy( (char*)mName, newName, 32 ); } void AppVertConnectorGLSL::reset() @@ -287,7 +287,7 @@ void VertPixelConnectorGLSL::sortVars() void VertPixelConnectorGLSL::setName( char *newName ) { - dStrcpy( (char*)mName, newName ); + dStrcpy( (char*)mName, newName, 32 ); } void VertPixelConnectorGLSL::reset() diff --git a/Engine/source/shaderGen/langElement.cpp b/Engine/source/shaderGen/langElement.cpp index 59e9a3bde..e4870bb14 100644 --- a/Engine/source/shaderGen/langElement.cpp +++ b/Engine/source/shaderGen/langElement.cpp @@ -87,7 +87,7 @@ U32 Var::texUnitCount = 0; Var::Var() { - dStrcpy( (char*)type, "float4" ); + dStrcpy( (char*)type, "float4", 32 ); structName[0] = '\0'; connectName[0] = '\0'; constSortPos = cspUninit; @@ -209,4 +209,4 @@ void MultiLine::print( Stream &stream ) { mStatementList[i]->print( stream ); } -} \ No newline at end of file +} diff --git a/Engine/source/shaderGen/shaderGen.cpp b/Engine/source/shaderGen/shaderGen.cpp index a182588d5..6b19ba0f5 100644 --- a/Engine/source/shaderGen/shaderGen.cpp +++ b/Engine/source/shaderGen/shaderGen.cpp @@ -153,8 +153,8 @@ void ShaderGen::generateShader( const MaterialFeatureData &featureData, dSprintf( vertShaderName, sizeof(vertShaderName), "shadergen:/%s_V.%s", cacheName, mFileEnding.c_str() ); dSprintf( pixShaderName, sizeof(pixShaderName), "shadergen:/%s_P.%s", cacheName, mFileEnding.c_str() ); - dStrcpy( vertFile, vertShaderName ); - dStrcpy( pixFile, pixShaderName ); + dStrcpy( vertFile, vertShaderName, 256 ); + dStrcpy( pixFile, pixShaderName, 256 ); // this needs to change - need to optimize down to ps v.1.1 *pixVersion = GFX->getPixelShaderVersion(); diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 4e5f6948a..948d066c1 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -245,7 +245,7 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const else { // IMPORTANT -- do NOT change the following line, it identifies the file as an input map file - dStrcpy( lineBuffer, "// Torque Input Map File\n" ); + dStrcpy( lineBuffer, "// Torque Input Map File\n", 1024 ); iostrm->write( dStrlen( lineBuffer ), lineBuffer ); } @@ -453,7 +453,7 @@ void ActionMap::dumpActionMap(const char* fileName, const bool append) const bool ActionMap::createEventDescriptor(const char* pEventString, EventDescriptor* pDescriptor) { char copyBuffer[256]; - dStrcpy(copyBuffer, pEventString); + dStrcpy(copyBuffer, pEventString, 256); // Do we have modifiers? char* pSpace = dStrchr(copyBuffer, ' '); @@ -909,7 +909,7 @@ const char* ActionMap::getDeadZone( const char* device, const char* action ) char buf[64]; dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd ); char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); - dStrcpy( returnString, buf ); + dStrcpy( returnString, buf, dStrlen(buf) + 1 ); return( returnString ); } else @@ -995,7 +995,7 @@ bool ActionMap::getDeviceName(const U32 deviceType, const U32 deviceInstance, ch { switch (deviceType) { case KeyboardDeviceType: - dStrcpy(buffer, "keyboard"); + dStrcpy(buffer, "keyboard", 16); break; case MouseDeviceType: @@ -1135,7 +1135,7 @@ bool ActionMap::getKeyString(const U32 action, char* buffer) for (U32 i = 0; gAsciiMap[i].asciiCode != 0xFFFF; i++) { if (gAsciiMap[i].asciiCode == asciiCode) { - dStrcpy(buffer, gAsciiMap[i].pDescription); + dStrcpy(buffer, gAsciiMap[i].pDescription, 16); return true; } } @@ -1166,7 +1166,7 @@ bool ActionMap::getKeyString(const U32 action, char* buffer) const char* desc = INPUTMGR->findVirtualMapDescFromCode(action); if(desc) { - dStrcpy(buffer, desc); + dStrcpy(buffer, desc, 16); return true; } } diff --git a/Engine/source/sim/netDownload.cpp b/Engine/source/sim/netDownload.cpp index 00fc6f0fc..b523ef0ad 100644 --- a/Engine/source/sim/netDownload.cpp +++ b/Engine/source/sim/netDownload.cpp @@ -53,7 +53,7 @@ public: for(U32 i = 0; i < nameCount; i++) { - dStrcpy(mFileNames[i], (*nameList)[i]); + dStrcpy(mFileNames[i], (*nameList)[i], 256); //Con::printf("Sending request for file %s", mFileNames[i]); } } diff --git a/Engine/source/sim/netStringTable.cpp b/Engine/source/sim/netStringTable.cpp index d1a25e826..c21377885 100644 --- a/Engine/source/sim/netStringTable.cpp +++ b/Engine/source/sim/netStringTable.cpp @@ -97,7 +97,7 @@ U32 NetStringTable::addString(const char *string) } table[e].refCount++; table[e].string = (char *) allocator->alloc(dStrlen(string) + 1); - dStrcpy(table[e].string, string); + dStrcpy(table[e].string, string, dStrlen(string) + 1); table[e].next = hashTable[bucket]; hashTable[bucket] = e; table[e].link = firstValid; @@ -179,7 +179,7 @@ void NetStringTable::repack() table[walk].string = (char *) newAllocator->alloc(dStrlen(prevStr) + 1); - dStrcpy(table[walk].string, prevStr); + dStrcpy(table[walk].string, prevStr, dStrlen(prevStr) + 1); } delete allocator; allocator = newAllocator; diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index 8665fa9f4..37f523356 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -1303,7 +1303,7 @@ DefineEngineMethod( TerrainBlock, save, bool, ( const char* fileName),, "@return True if file save was successful, false otherwise") { char filename[256]; - dStrcpy(filename,fileName); + dStrcpy(filename,fileName,256); char *ext = dStrrchr(filename, '.'); if (!ext || dStricmp(ext, ".ter") != 0) dStrcat(filename, ".ter", 256); @@ -1313,7 +1313,7 @@ DefineEngineMethod( TerrainBlock, save, bool, ( const char* fileName),, //ConsoleMethod(TerrainBlock, save, bool, 3, 3, "(string fileName) - saves the terrain block's terrain file to the specified file name.") //{ // char filename[256]; -// dStrcpy(filename,argv[2]); +// dStrcpy(filename,argv[2],256); // char *ext = dStrrchr(filename, '.'); // if (!ext || dStricmp(ext, ".ter") != 0) // dStrcat(filename, ".ter", 256); diff --git a/Engine/source/util/messaging/eventManager.cpp b/Engine/source/util/messaging/eventManager.cpp index f39bf13b0..5463e1efc 100644 --- a/Engine/source/util/messaging/eventManager.cpp +++ b/Engine/source/util/messaging/eventManager.cpp @@ -289,7 +289,7 @@ bool EventManager::subscribe(SimObject *callbackObj, const char* event, const ch else { cb = new char[dStrlen(callback) + 1]; - dStrcpy(cb, callback); + dStrcpy(cb, callback, dStrlen(callback) + 1); } // Create the subscriber object. diff --git a/Engine/source/util/undo.cpp b/Engine/source/util/undo.cpp index fd23033fa..11334a793 100644 --- a/Engine/source/util/undo.cpp +++ b/Engine/source/util/undo.cpp @@ -546,7 +546,7 @@ DefineConsoleMethod(UndoManager, getNextUndoName, const char *, (),, "UndoManage if(!name) return NULL; char *ret = Con::getReturnBuffer(dStrlen(name) + 1); - dStrcpy(ret, name); + dStrcpy(ret, name, dStrlen(name) + 1); return ret; } @@ -557,7 +557,7 @@ DefineConsoleMethod(UndoManager, getNextRedoName, const char *, (),, "UndoManage if(!name) return NULL; char *ret = Con::getReturnBuffer(dStrlen(name) + 1); - dStrcpy(ret, name); + dStrcpy(ret, name, dStrlen(name) + 1); return ret; } From c4533b4dc4d15bd594b3d73f013009d05468fd04 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 6 Mar 2018 02:35:46 -0500 Subject: [PATCH 145/312] Actual buffer overflow bug found because of these fixes --- Engine/source/console/fileSystemFunctions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/fileSystemFunctions.cpp b/Engine/source/console/fileSystemFunctions.cpp index ec2d9c17d..0fdafec85 100644 --- a/Engine/source/console/fileSystemFunctions.cpp +++ b/Engine/source/console/fileSystemFunctions.cpp @@ -643,8 +643,8 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),, name = szPathCopy; else name++; - char *ret = Con::getReturnBuffer(dStrlen(name)); - dStrcpy(ret, name, dStrlen(name)); + char *ret = Con::getReturnBuffer(dStrlen(name) + 1); + dStrcpy(ret, name, dStrlen(name) + 1); return ret; } From 396fe5b0adf68790a85d5a3bd72e48d937f2bafd Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 6 Mar 2018 02:37:42 -0500 Subject: [PATCH 146/312] Cleaning up the checks --- Engine/source/core/strings/stringFunctions.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Engine/source/core/strings/stringFunctions.h b/Engine/source/core/strings/stringFunctions.h index e4307a092..c2058c119 100644 --- a/Engine/source/core/strings/stringFunctions.h +++ b/Engine/source/core/strings/stringFunctions.h @@ -47,21 +47,23 @@ #endif // defined(TORQUE_OS_WIN) -#define DEBUG_CHECK_OVERFLOW 1 +#define DEBUG_CHECK_STRING_OVERFLOW //------------------------------------------------------------------------------ // standard string functions [defined in platformString.cpp] +#ifdef UNSAFE_STRING_FUNCTIONS /// @deprecated Use dStrcat(char *, const char *, dsize_t) instead inline char *dStrcat(char *dst, const char *src) { AssertFatal(false, "dStrcat without length is deprecated"); return strcat(dst,src); } +#endif inline char *dStrcat(char *dst, const char *src, dsize_t len) { -#ifdef DEBUG_CHECK_OVERFLOW +#ifdef DEBUG_CHECK_STRING_OVERFLOW if (strlen(src) >= len) { AssertWarn(false, "dStrcat out of range"); } @@ -99,16 +101,18 @@ inline S32 dStrnicmp(const char *str1, const char *str2, dsize_t len) return strncasecmp( str1, str2, len ); } +#ifdef UNSAFE_STRING_FUNCTIONS /// @deprecated Use strcpy(char *, const char *, dsize_t) instead inline char *dStrcpy(char *dst, const char *src) { AssertFatal(false, "dStrcpy without length is deprecated"); return strcpy(dst,src); } +#endif inline char *dStrcpy(char *dst, const char *src, dsize_t len) { -#ifdef DEBUG_CHECK_OVERFLOW +#ifdef DEBUG_CHECK_STRING_OVERFLOW if (strlen(src) >= len) { AssertWarn(false, "dStrcpy out of range"); } From e6e97e660cedb2fcc5f36fbe2c3c3f9d95f73349 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 7 Mar 2018 00:44:28 -0500 Subject: [PATCH 147/312] Missed a couple +1s here and there --- Engine/source/afx/arcaneFX.cpp | 6 +++--- Engine/source/app/badWordFilter.cpp | 2 +- Engine/source/console/SimXMLDocument.cpp | 4 ++-- Engine/source/console/console.cpp | 4 ++-- Engine/source/console/persistenceManager.cpp | 6 +++--- Engine/source/gui/editor/guiEditCtrl.cpp | 4 ++-- Engine/source/platformWin32/winFileio.cpp | 9 ++++----- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Engine/source/afx/arcaneFX.cpp b/Engine/source/afx/arcaneFX.cpp index 8ec0e9760..cec0c870a 100644 --- a/Engine/source/afx/arcaneFX.cpp +++ b/Engine/source/afx/arcaneFX.cpp @@ -908,7 +908,7 @@ ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)" char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::printf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; @@ -928,7 +928,7 @@ ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)" char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::warnf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; @@ -948,7 +948,7 @@ ConsoleFunction(errorThru, const char*, 2, 0, "(string passthru, string text...) char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; for(i = 2; i < argc; i++) - dStrcat(ret, argv[i], len); + dStrcat(ret, argv[i], len + 1); Con::errorf("%s -- [%s]", ret, argv[1].getStringValue()); ret[0] = 0; diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index d789bc1c4..0a13a9c29 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -287,7 +287,7 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const replaceStr = gBadWordFilter->getDefaultReplaceStr(); char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); - dStrcpy(ret, baseString, dStrlen(baseString)); + dStrcpy(ret, baseString, dStrlen(baseString) + 1); gBadWordFilter->filterString(ret, replaceStr); return ret; } diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index 4071ae138..156533503 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -833,7 +833,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) continue; FrameTemp valCopy( dStrlen( val ) + 1 ); - dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 ); + dStrcpy( (char *)valCopy, val, valCopy.size() ); if (!pObject->writeField(itr->pFieldname, valCopy)) continue; @@ -873,7 +873,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID) // continue; // FrameTemp valCopy( dStrlen( val ) + 1 ); - // dStrcpy( (char *)valCopy, val, dStrlen(val) + 1 ); + // dStrcpy( (char *)valCopy, val, valCopy.size() ); // if (!pObject->writeField(itr->pFieldname, valCopy)) // continue; diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index fd5d343d2..be472f197 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -2176,8 +2176,8 @@ bool expandPath(char* pDstPath, U32 size, const char* pSrcPath, const char* pWor } // Format the output path. - dStrcat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer)); - dStrcat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer)); + dStrncat(pathBuffer, "/", sizeof(pathBuffer) - 1 - strlen(pathBuffer)); + dStrncat(pathBuffer, pSrc, sizeof(pathBuffer) - 1 - strlen(pathBuffer)); // Are we ensuring the trailing slash? if (ensureTrailingSlash) diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index df2dd8b01..56812cd4b 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -967,10 +967,10 @@ void PersistenceManager::updateToken( const U32 lineNumber, const U32 linePositi // Build the new line with the // preString + newValue + postString - dStrcat(newLine, preString, newLineLen); + dStrcat(newLine, preString, newLineLen + 1); if ( newValue ) - dStrcat(newLine, newValue, newLineLen); - dStrcat(newLine, postString, newLineLen); + dStrcat(newLine, newValue, newLineLen + 1); + dStrcat(newLine, postString, newLineLen + 1); // Clear our existing line if (mLineBuffer[lineNumber]) diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 571d1df84..bf20e8568 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -2625,8 +2625,8 @@ DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , " RectI bounds = object->getSelectionGlobalBounds(); String str = String::ToString( "%i %i %i %i", bounds.point.x, bounds.point.y, bounds.extent.x, bounds.extent.y ); - char* buffer = Con::getReturnBuffer( str.length() ); - dStrcpy( buffer, str.c_str(), str.length() ); + char* buffer = Con::getReturnBuffer( str.size() ); + dStrcpy( buffer, str.c_str(), str.size() ); return buffer; } diff --git a/Engine/source/platformWin32/winFileio.cpp b/Engine/source/platformWin32/winFileio.cpp index 83b7e1859..3e1974ae4 100644 --- a/Engine/source/platformWin32/winFileio.cpp +++ b/Engine/source/platformWin32/winFileio.cpp @@ -158,8 +158,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) Platform::clearExcludedDirectories(); - S32 tempBufSize = to.size * 3 + MAX_PATH * 3; - TempAlloc< char > tempBuf( tempBufSize ); + TempAlloc< char > tempBuf( to.size * 3 + MAX_PATH * 3 ); // Create all the directories. for (S32 i = 0; i < directoryInfo.size(); i++) @@ -169,7 +168,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) char* toDir = tempBuf; Platform::makeFullPathName(fromDir + dStrlen(fromName) + (dStricmp(fromDir, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName); if(*(toDir + dStrlen(toDir) - 1) != '/') - dStrcat(toDir, "/", tempBufSize); + dStrcat(toDir, "/", tempBuf.size); forwardslash(toDir); if (!Platform::createPath(toDir)) @@ -192,8 +191,8 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) char* toFile = tempBuf; Platform::makeFullPathName(fileInfo[i].pFullPath + dStrlen(fromName) + (dStricmp(fileInfo[i].pFullPath, fromName) ? 1 : 0), tempBuf, tempBuf.size, toName); - dStrcat(toFile, "/", tempBufSize); - dStrcat(toFile, fileInfo[i].pFileName, tempBufSize); + dStrcat(toFile, "/", tempBuf.size); + dStrcat(toFile, fileInfo[i].pFileName, tempBuf.size); backslash(fromFile); backslash(toFile); From dce7f5f6b3425400641e89890b0b53a59660d2c1 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 7 Mar 2018 00:49:46 -0500 Subject: [PATCH 148/312] Engine was also using raw strcat/strcpy --- Engine/source/cinterface/cinterface.cpp | 4 ++-- Engine/source/persistence/taml/fsTinyXml.cpp | 2 +- Engine/source/persistence/taml/xml/tamlXmlParser.cpp | 2 +- Engine/source/platform/platformCPUCount.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/cinterface/cinterface.cpp b/Engine/source/cinterface/cinterface.cpp index f195cd7e7..4f6f1900c 100644 --- a/Engine/source/cinterface/cinterface.cpp +++ b/Engine/source/cinterface/cinterface.cpp @@ -182,8 +182,8 @@ extern "C" { void torque_setexecutablepath(const char* directory) { - gExecutablePath = new char[strlen(directory)+1]; - strcpy(gExecutablePath, directory); + gExecutablePath = new char[dStrlen(directory)+1]; + dStrcpy(gExecutablePath, directory, dStrlen(directory)+1); } // set Torque 3D into web deployment mode (disable fullscreen exlusive mode, etc) diff --git a/Engine/source/persistence/taml/fsTinyXml.cpp b/Engine/source/persistence/taml/fsTinyXml.cpp index 441169742..9fdf3f812 100644 --- a/Engine/source/persistence/taml/fsTinyXml.cpp +++ b/Engine/source/persistence/taml/fsTinyXml.cpp @@ -33,7 +33,7 @@ bool fsTiXmlDocument::LoadFile( const char * pFilename, TiXmlEncoding encoding ) #ifdef TORQUE_OS_ANDROID if (strlen(pFilename) > strlen(filenameBuffer)) { - strcpy(filenameBuffer, pFilename); + dStrcpy(filenameBuffer, pFilename, 1024); } #endif diff --git a/Engine/source/persistence/taml/xml/tamlXmlParser.cpp b/Engine/source/persistence/taml/xml/tamlXmlParser.cpp index b479fa07e..6ba33dd98 100644 --- a/Engine/source/persistence/taml/xml/tamlXmlParser.cpp +++ b/Engine/source/persistence/taml/xml/tamlXmlParser.cpp @@ -53,7 +53,7 @@ bool TamlXmlParser::accept( const char* pFilename, TamlVisitor& visitor ) #ifdef TORQUE_OS_ANDROID if (strlen(pFilename) > strlen(filenameBuffer)) { - strcpy(filenameBuffer, pFilename); + dStrcpy(filenameBuffer, pFilename, 1024); } #endif diff --git a/Engine/source/platform/platformCPUCount.cpp b/Engine/source/platform/platformCPUCount.cpp index fc066f75d..a3fe99d67 100644 --- a/Engine/source/platform/platformCPUCount.cpp +++ b/Engine/source/platform/platformCPUCount.cpp @@ -523,7 +523,7 @@ next: tblPkgID[j] = apicID & PackageIDMask; sprintf(tmp," AffinityMask = %d; Initial APIC = %d; Physical ID = %d, Core ID = %d, SMT ID = %d\n", dwAffinityMask, apicID, tblPkgID[j], tblCoreID[j], tblSMTID[j]); - strcat(g_s3Levels, tmp); + dStrcat(g_s3Levels, tmp, 2048); numLPEnabled ++; // Number of available logical processors in the system. @@ -654,4 +654,4 @@ next: } // namespace CPUInfo #endif -#endif \ No newline at end of file +#endif From d9a723d5333947bbdb6e47fc64dc65471b07b2b7 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 7 Mar 2018 01:13:56 -0500 Subject: [PATCH 149/312] More cats and cpys in files that xcode doesn't see --- Engine/source/afx/ce/afxAudioBank.cpp | 2 +- Engine/source/console/CMDscan.l | 8 ++++---- Engine/source/console/consoleXMLExport.cpp | 4 ++-- Engine/source/core/frameAllocator.h | 2 +- Engine/source/core/util/zip/test/zipTestWrite.cpp | 4 ++-- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 12 ++++++------ .../platform/input/leapMotion/leapMotionDevice.cpp | 2 +- .../platform/input/oculusVR/oculusVRDevice.cpp | 2 +- .../source/platform/input/openVR/openVRProvider.cpp | 2 +- .../platform/input/razerHydra/razerHydraDevice.cpp | 2 +- Engine/source/platformX86UNIX/x86UNIXFileio.cpp | 10 +++++----- .../source/platformX86UNIX/x86UNIXInput.client.cpp | 2 +- Engine/source/platformX86UNIX/x86UNIXNet.cpp | 6 +++--- .../platformX86UNIX/x86UNIXOGLVideo.client.cpp | 2 +- Engine/source/platformX86UNIX/x86UNIXRedbook.cpp | 2 +- Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp | 2 +- Engine/source/sim/actionMap.cpp | 2 +- Engine/source/sim/connectionStringTable.cpp | 2 +- Engine/source/sim/netObject.h | 8 ++++---- Engine/source/sqlite/SQLiteObject.cpp | 6 +++--- Engine/source/testing/unitTesting.cpp | 4 ++-- 21 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Engine/source/afx/ce/afxAudioBank.cpp b/Engine/source/afx/ce/afxAudioBank.cpp index 2aa148474..82537419d 100644 --- a/Engine/source/afx/ce/afxAudioBank.cpp +++ b/Engine/source/afx/ce/afxAudioBank.cpp @@ -184,7 +184,7 @@ void afxAudioBank::packData(BitStream* stream) if(!mFilename) buffer[0] = 0; else - dStrcpy(buffer, mFilename); + dStrcpy(buffer, mFilename, 256); stream->writeString(buffer); */ diff --git a/Engine/source/console/CMDscan.l b/Engine/source/console/CMDscan.l index d9b92b6d2..c4bdc1bf3 100644 --- a/Engine/source/console/CMDscan.l +++ b/Engine/source/console/CMDscan.l @@ -71,7 +71,7 @@ inline int isatty(int) { return 0; } buf[n++] = (char) c; \ result = n; \ } - + // General helper stuff. static int lineIndex; @@ -411,10 +411,10 @@ static int Sc_ScanString(int ret) CMDtext[CMDleng - 1] = 0; if(!collapseEscape(CMDtext+1)) return -1; - + char* buffer = ( char* ) consoleAlloc( dStrlen( CMDtext ) ); - dStrcpy( buffer, CMDtext + 1 ); - + dStrcpy( buffer, CMDtext + 1, dStrlen( CMDtext ) ); + CMDlval.str = MakeToken< char* >( buffer, lineIndex ); return ret; } diff --git a/Engine/source/console/consoleXMLExport.cpp b/Engine/source/console/consoleXMLExport.cpp index 953a016cf..79e302595 100644 --- a/Engine/source/console/consoleXMLExport.cpp +++ b/Engine/source/console/consoleXMLExport.cpp @@ -319,8 +319,8 @@ DefineConsoleFunction( consoleExportXML, const char*, (), ,"Exports console defi Con::XMLExport xmlExport; String xml; xmlExport.exportXML(xml); - char* ret = Con::getReturnBuffer(xml.length() + 1); - dStrcpy(ret, xml.c_str()); + char* ret = Con::getReturnBuffer(xml.size()); + dStrcpy(ret, xml.c_str(), xml.size()); return ret; } diff --git a/Engine/source/core/frameAllocator.h b/Engine/source/core/frameAllocator.h index 86884085c..2e03e6fc2 100644 --- a/Engine/source/core/frameAllocator.h +++ b/Engine/source/core/frameAllocator.h @@ -185,7 +185,7 @@ public: /// the FrameAllocator. For example: /// @code /// FrameTemp tempStr(32); // NOTE! This parameter is NOT THE SIZE IN BYTES. See constructor docs. -/// dStrcat( tempStr, SomeOtherString ); +/// dStrcat( tempStr, SomeOtherString, 32 * sizeof(char) ); /// tempStr[2] = 'l'; /// Con::printf( tempStr ); /// Con::printf( "Foo: %s", ~tempStr ); diff --git a/Engine/source/core/util/zip/test/zipTestWrite.cpp b/Engine/source/core/util/zip/test/zipTestWrite.cpp index 889cf6948..d23f9a657 100644 --- a/Engine/source/core/util/zip/test/zipTestWrite.cpp +++ b/Engine/source/core/util/zip/test/zipTestWrite.cpp @@ -95,7 +95,7 @@ private: { // Find a unique filename U32 count = 1; - dStrcpy(fileBuf, filename); + dStrcpy(fileBuf, filename, bufSize); while(zip->findFileInfo(fileBuf)) { @@ -109,7 +109,7 @@ private: } } else if(fileBuf && bufSize > 0) - dStrcpy(fileBuf, filename); + dStrcpy(fileBuf, filename, bufSize); // Try and write to the file Stream * stream = zip->openFile(fileBuf ? fileBuf : filename, ZipArchive::Write); diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index fc7811e69..2c8f5342a 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -390,7 +390,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol U32 r, g, b; char buf[64]; - dStrcpy( buf, argv[3] ); + dStrcpy( buf, argv[3], 64 ); char* temp = dStrtok( buf, " \0" ); r = temp ? dAtoi( temp ) : 0; temp = dStrtok( NULL, " \0" ); @@ -399,7 +399,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol b = temp ? dAtoi( temp ) : 0; fontColor.set( r, g, b ); - dStrcpy( buf, argv[4] ); + dStrcpy( buf, argv[4], 64 ); temp = dStrtok( buf, " \0" ); r = temp ? dAtoi( temp ) : 0; temp = dStrtok( NULL, " \0" ); @@ -408,7 +408,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol b = temp ? dAtoi( temp ) : 0; fontColorHL.set( r, g, b ); - dStrcpy( buf, argv[5] ); + dStrcpy( buf, argv[5], 64 ); temp = dStrtok( buf, " \0" ); r = temp ? dAtoi( temp ) : 0; temp = dStrtok( NULL, " \0" ); @@ -426,7 +426,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol // U32 r, g, b; // char buf[64]; // -// dStrcpy( buf, argv[3] ); +// dStrcpy( buf, argv[3], 64 ); // char* temp = dStrtok( buf, " \0" ); // r = temp ? dAtoi( temp ) : 0; // temp = dStrtok( NULL, " \0" ); @@ -435,7 +435,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol // b = temp ? dAtoi( temp ) : 0; // fontColor.set( r, g, b ); // -// dStrcpy( buf, argv[4] ); +// dStrcpy( buf, argv[4], 64 ); // temp = dStrtok( buf, " \0" ); // r = temp ? dAtoi( temp ) : 0; // temp = dStrtok( NULL, " \0" ); @@ -444,7 +444,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, addScheme, void, (S32 id, ColorI fontCol // b = temp ? dAtoi( temp ) : 0; // fontColorHL.set( r, g, b ); // -// dStrcpy( buf, argv[5] ); +// dStrcpy( buf, argv[5], 64 ); // temp = dStrtok( buf, " \0" ); // r = temp ? dAtoi( temp ) : 0; // temp = dStrtok( NULL, " \0" ); diff --git a/Engine/source/platform/input/leapMotion/leapMotionDevice.cpp b/Engine/source/platform/input/leapMotion/leapMotionDevice.cpp index 5e4aef681..9bbb3eaaf 100644 --- a/Engine/source/platform/input/leapMotion/leapMotionDevice.cpp +++ b/Engine/source/platform/input/leapMotion/leapMotionDevice.cpp @@ -82,7 +82,7 @@ U32 LeapMotionDevice::LM_FRAME = 0; LeapMotionDevice::LeapMotionDevice() { // From IInputDevice - dStrcpy(mName, "leapmotion"); + dStrcpy(mName, "leapmotion", 30); mDeviceType = INPUTMGR->getNextDeviceType(); mController = NULL; diff --git a/Engine/source/platform/input/oculusVR/oculusVRDevice.cpp b/Engine/source/platform/input/oculusVR/oculusVRDevice.cpp index 229bc0429..e2ffb411a 100644 --- a/Engine/source/platform/input/oculusVR/oculusVRDevice.cpp +++ b/Engine/source/platform/input/oculusVR/oculusVRDevice.cpp @@ -86,7 +86,7 @@ F32 OculusVRDevice::smPositionTrackingScale = 1.0f; OculusVRDevice::OculusVRDevice() { // From IInputDevice - dStrcpy(mName, "oculusvr"); + dStrcpy(mName, "oculusvr", 30); mDeviceType = INPUTMGR->getNextDeviceType(); // diff --git a/Engine/source/platform/input/openVR/openVRProvider.cpp b/Engine/source/platform/input/openVR/openVRProvider.cpp index 9fa31e4cc..53cc228f5 100644 --- a/Engine/source/platform/input/openVR/openVRProvider.cpp +++ b/Engine/source/platform/input/openVR/openVRProvider.cpp @@ -493,7 +493,7 @@ OpenVRProvider::OpenVRProvider() : mDrawCanvas(NULL), mGameConnection(NULL) { - dStrcpy(mName, "openvr"); + dStrcpy(mName, "openvr", 30); mDeviceType = INPUTMGR->getNextDeviceType(); buildInputCodeTable(); GFXDevice::getDeviceEventSignal().notify(this, &OpenVRProvider::_handleDeviceEvent); diff --git a/Engine/source/platform/input/razerHydra/razerHydraDevice.cpp b/Engine/source/platform/input/razerHydra/razerHydraDevice.cpp index 8a36bd9d6..e2d87129d 100644 --- a/Engine/source/platform/input/razerHydra/razerHydraDevice.cpp +++ b/Engine/source/platform/input/razerHydra/razerHydraDevice.cpp @@ -91,7 +91,7 @@ U32 RazerHydraDevice::RH_FRAME = 0; RazerHydraDevice::RazerHydraDevice() { // From IInputDevice - dStrcpy(mName, "razerhydra"); + dStrcpy(mName, "razerhydra", 30); mDeviceType = INPUTMGR->getNextDeviceType(); // diff --git a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp index 6e51b85e1..40f5fedae 100644 --- a/Engine/source/platformX86UNIX/x86UNIXFileio.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXFileio.cpp @@ -211,7 +211,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) dStrncpy(pathEl, currChar, pathElLen); pathEl[pathElLen] = '\0'; dStrncpy(testPath, tempBuf, MaxPath); - dStrcat(testPath, pathEl); + dStrcat(testPath, pathEl, MaxPath); if (stat(testPath, &filestat) != -1) { dStrncpy(tempBuf, testPath, MaxPath); @@ -226,7 +226,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) if (dStricmp(pathEl, ent->d_name) == 0) { foundMatch = true; - dStrcat(tempBuf, ent->d_name); + dStrcat(tempBuf, ent->d_name, MaxPath); break; } } @@ -238,7 +238,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) } if (*termChar == '/') { - dStrcat(tempBuf, "/"); + dStrcat(tempBuf, "/", MaxPath); termChar++; currChar = termChar; } @@ -935,7 +935,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) TempAlloc< UTF8 > buf( dStrlen( newDir ) + 2 ); - dStrcpy( buf, newDir ); + dStrcpy( buf, newDir, buf.size ); ForwardSlash( buf ); return chdir( buf ) == 0; @@ -1267,7 +1267,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite) { char child[1024]; if ( (basePath[dStrlen(basePath) - 1]) == '/') - dStrcpy (child, d->d_name); + dStrcpy (child, d->d_name, 1024); else dSprintf(child, 1024, "/%s", d->d_name); if (currentDepth < recurseDepth || recurseDepth == -1) diff --git a/Engine/source/platformX86UNIX/x86UNIXInput.client.cpp b/Engine/source/platformX86UNIX/x86UNIXInput.client.cpp index 37e3ee179..2776601a7 100644 --- a/Engine/source/platformX86UNIX/x86UNIXInput.client.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXInput.client.cpp @@ -554,7 +554,7 @@ bool XClipboard::setClipboard(const char *text) checkTDataSize(len); // copy the data into the storage buffer - dStrcpy(mTData, text); + dStrcpy(mTData, text, mTDataSize); // tell X that we own the clipboard. (we'll get events // if an app tries to paste) diff --git a/Engine/source/platformX86UNIX/x86UNIXNet.cpp b/Engine/source/platformX86UNIX/x86UNIXNet.cpp index e186b8f8a..2cfb81521 100644 --- a/Engine/source/platformX86UNIX/x86UNIXNet.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXNet.cpp @@ -97,7 +97,7 @@ static Socket* addPolledSocket(NetSocket& fd, S32 state, sock->fd = fd; sock->state = state; if (remoteAddr) - dStrcpy(sock->remoteAddr, remoteAddr); + dStrcpy(sock->remoteAddr, remoteAddr, 256); if (port != -1) sock->remotePort = port; gPolledSockets.push_back(sock); @@ -242,7 +242,7 @@ NetSocket Net::openConnectTo(const char *addressString) if(!dStrnicmp(addressString, "ip:", 3)) addressString += 3; // eat off the ip: char remoteAddr[256]; - dStrcpy(remoteAddr, addressString); + dStrcpy(remoteAddr, addressString, 256); char *portString = dStrchr(remoteAddr, ':'); @@ -814,7 +814,7 @@ bool Net::stringToAddress(const char *addressString, NetAddress *address) if(strlen(addressString) > 255) return false; - dStrcpy(remoteAddr, addressString); + dStrcpy(remoteAddr, addressString, 256); char *portString = dStrchr(remoteAddr, ':'); if(portString) diff --git a/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp b/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp index 16f906f69..384aade9e 100644 --- a/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp @@ -41,7 +41,7 @@ bool InitOpenGL() // Get the video settings from the prefs: const char* resString = Con::getVariable( "$pref::Video::resolution" ); char* tempBuf = new char[dStrlen( resString ) + 1]; - dStrcpy( tempBuf, resString ); + dStrcpy( tempBuf, resString, dStrlen(resString) + 1 ); char* temp = dStrtok( tempBuf, " x\0" ); U32 width = ( temp ? dAtoi( temp ) : 800 ); temp = dStrtok( NULL, " x\0" ); diff --git a/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp b/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp index 65741218f..3484a56ce 100644 --- a/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp @@ -102,7 +102,7 @@ void UnixRedBookDevice::setDeviceInfo(S32 deviceId, const char *deviceName) #if !defined(__FreeBSD__) mDeviceId = deviceId; mDeviceName = new char[dStrlen(deviceName) + 1]; - dStrcpy(mDeviceName, deviceName); + dStrcpy(mDeviceName, deviceName, dStrlen(deviceName) + 1); #endif // !defined(__FreeBSD__) } diff --git a/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp index b01419a8b..66c23d353 100644 --- a/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderCompHLSL.cpp @@ -232,7 +232,7 @@ void ShaderConnectorHLSL::sortVars() void ShaderConnectorHLSL::setName( char *newName ) { - dStrcpy( (char*)mName, newName ); + dStrcpy( (char*)mName, newName, 32 ); } void ShaderConnectorHLSL::reset() diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 948d066c1..1d0fbe8b5 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -1159,7 +1159,7 @@ bool ActionMap::getKeyString(const U32 action, char* buffer) } //for (U32 i = 0; gVirtualMap[i].code != 0xFFFFFFFF; i++) { // if (gVirtualMap[i].code == action) { - // dStrcpy(buffer, gVirtualMap[i].pDescription); + // dStrcpy(buffer, gVirtualMap[i].pDescription, 16); // return true; // } //} diff --git a/Engine/source/sim/connectionStringTable.cpp b/Engine/source/sim/connectionStringTable.cpp index dddd935b2..c3fa4dff6 100644 --- a/Engine/source/sim/connectionStringTable.cpp +++ b/Engine/source/sim/connectionStringTable.cpp @@ -71,7 +71,7 @@ public: static char buffer[512]; dSprintf(buffer, sizeof(buffer), "%s - \"", getClassName()); expandEscape(buffer + dStrlen(buffer), mString.getString()); - dStrcat(buffer, "\""); + dStrcat(buffer, "\"", 512); return buffer; } #endif diff --git a/Engine/source/sim/netObject.h b/Engine/source/sim/netObject.h index 7ea1283c4..bbc913c26 100644 --- a/Engine/source/sim/netObject.h +++ b/Engine/source/sim/netObject.h @@ -132,8 +132,8 @@ struct GhostInfo; /// // the ScopeAlways flag indicates that the object is always scoped /// // on all active connections. /// mNetFlags.set(ScopeAlways | Ghostable); -/// dStrcpy(message1, "Hello World 1!"); -/// dStrcpy(message2, "Hello World 2!"); +/// dStrcpy(message1, "Hello World 1!", bufLen); +/// dStrcpy(message2, "Hello World 2!", bufLen); /// } /// @endcode /// @@ -187,12 +187,12 @@ struct GhostInfo; /// void setMessage1(const char *msg) /// { /// setMaskBits(Message1Mask); -/// dStrcpy(message1, msg); +/// dStrcpy(message1, msg, bufLen); /// } /// void setMessage2(const char *msg) /// { /// setMaskBits(Message2Mask); -/// dStrcpy(message2, msg); +/// dStrcpy(message2, msg, bufLen); /// } /// @endcode /// diff --git a/Engine/source/sqlite/SQLiteObject.cpp b/Engine/source/sqlite/SQLiteObject.cpp index 7fe06de5f..a2900ab30 100644 --- a/Engine/source/sqlite/SQLiteObject.cpp +++ b/Engine/source/sqlite/SQLiteObject.cpp @@ -158,18 +158,18 @@ S32 Callback(void *pArg, S32 argc, char **argv, char **columnNames) // DBEUG CODE // Con::printf("%s = %s\n", columnNames[i], argv[i] ? argv[i] : "NULL"); name = new char[dStrlen(columnNames[i]) + 1]; - dStrcpy(name, columnNames[i]); + dStrcpy(name, columnNames[i], dStrlen(columnNames[i]) + 1); pRow->vColumnNames.push_back(name); if (argv[i]) { value = new char[dStrlen(argv[i]) + 1]; - dStrcpy(value, argv[i]); + dStrcpy(value, argv[i], dStrlen(argv[i]) + 1); pRow->vColumnValues.push_back(value); } else { value = new char[10]; - dStrcpy(value, "NULL"); + dStrcpy(value, "NULL", 10); pRow->vColumnValues.push_back(value); } } diff --git a/Engine/source/testing/unitTesting.cpp b/Engine/source/testing/unitTesting.cpp index 2724bf637..a86a28eb3 100644 --- a/Engine/source/testing/unitTesting.cpp +++ b/Engine/source/testing/unitTesting.cpp @@ -99,8 +99,8 @@ DefineConsoleFunction( runAllUnitTests, int, (const char* testSpecs), (""), testArgc = 2; testArgv = new char*[2]; testArgv[0] = NULL; // Program name is unused by googletest. - testArgv[1] = new char[specs.length()+1]; - dStrcpy(testArgv[1], specs); + testArgv[1] = new char[specs.size()]; + dStrcpy(testArgv[1], specs, specs.size()); } // Initialize Google Test. From e01272d72d977f9844194c278ec4976ccadc7fef Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 7 Mar 2018 01:30:44 -0600 Subject: [PATCH 150/312] Missed a cleanup line. --- Engine/source/T3D/convexShape.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index d73d387bd..bc23798d0 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -733,7 +733,6 @@ bool ConvexShape::buildExportPolyList(ColladaUtils::ExportData* exportData, cons meshData->originatingObject = this; meshData->meshTransform = mObjToWorld; meshData->scale = mObjScale; - meshData->fillWithSingleDetail = true; meshData->meshDetailLevels.increment(); From a46cadc4876cccfa6c855591e7ce387cff484a43 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 7 Mar 2018 03:58:28 -0500 Subject: [PATCH 151/312] Let dStrncat use strncat because it's probably set up for that --- Engine/source/core/strings/stringFunctions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/core/strings/stringFunctions.h b/Engine/source/core/strings/stringFunctions.h index c2058c119..c296da871 100644 --- a/Engine/source/core/strings/stringFunctions.h +++ b/Engine/source/core/strings/stringFunctions.h @@ -73,7 +73,7 @@ inline char *dStrcat(char *dst, const char *src, dsize_t len) inline char *dStrncat(char *dst, const char *src, dsize_t len) { - return dStrcat(dst, src, len); + return strncat(dst, src, len); } inline S32 dStrcmp(const char *str1, const char *str2) From a061923c1ed6f5912b0d46d72e35df2b253d5ea9 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 8 Mar 2018 00:45:24 -0500 Subject: [PATCH 152/312] Better to use strlcat and strlcpy and move them to the cpp file. Provided an implementation for platforms that don't support them (macOS only currently) --- .../source/core/strings/stringFunctions.cpp | 61 +++++++++++++++++++ Engine/source/core/strings/stringFunctions.h | 32 +++++----- 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/Engine/source/core/strings/stringFunctions.cpp b/Engine/source/core/strings/stringFunctions.cpp index 93db4fd47..668c9d649 100644 --- a/Engine/source/core/strings/stringFunctions.cpp +++ b/Engine/source/core/strings/stringFunctions.cpp @@ -381,6 +381,67 @@ char* dStrlwr(char *str) #endif } +//------------------------------------------------------------------------------ + +S32 dStrlcat(char *dst, const char *src, dsize_t dstSize) +{ + //TODO: Do other platforms support strlcat in their libc +#ifdef TORQUE_OS_MAC + S32 len = strlcat(dst, src, dstSize); + + AssertWarn(len < dstSize, "Buffer too small in call to dStrlcat!"); + + return len; +#else //TORQUE_OS_MAC + S32 dstLen = dStrlen(dst); + S32 srcLen = dStrlen(src); + S32 copyLen = srcLen; + + //Check for buffer overflow and don't allow it. Warn on debug so we can fix it + AssertWarn(dstLen + copyLen < dstSize, "Buffer too small in call to dStrlcat!"); + if (dstLen + copyLen + 1 > dstSize) + { + copyLen = dstSize - dstLen - 1; + } + + //Copy src after dst and null terminate + memcpy(dst + dstLen, src, copyLen); + dst[dstLen + copyLen] = 0; + + //Return the length of the string we would have generated + return dstLen + srcLen; +#endif //TORQUE_OS_MAC +} + +S32 dStrlcpy(char *dst, const char *src, dsize_t dstSize) +{ + //TODO: Do other platforms support strlcpy in their libc +#ifdef TORQUE_OS_MAC + S32 len = strlcpy(dst, src, dstSize); + + AssertWarn(len < dstSize, "Buffer too small in call to dStrlcpy!"); + + return len; +#else //TORQUE_OS_MAC + S32 srcLen = dStrlen(src); + S32 copyLen = srcLen; + + //Check for buffer overflow and don't allow it. Warn on debug so we can fix it + AssertWarn(copyLen < dstSize, "Buffer too small in call to dStrlcpy!"); + if (srcLen + 1 > dstSize) + { + copyLen = dstSize - 1; + } + + //Copy src and null terminate + memcpy(dst, src, copyLen); + dst[copyLen] = 0; + + //Return the length of the string we would have generated + return srcLen; +#endif //TORQUE_OS_MAC +} + //------------------------------------------------------------------------------ // standard I/O functions diff --git a/Engine/source/core/strings/stringFunctions.h b/Engine/source/core/strings/stringFunctions.h index c296da871..918273423 100644 --- a/Engine/source/core/strings/stringFunctions.h +++ b/Engine/source/core/strings/stringFunctions.h @@ -47,11 +47,14 @@ #endif // defined(TORQUE_OS_WIN) -#define DEBUG_CHECK_STRING_OVERFLOW - //------------------------------------------------------------------------------ // standard string functions [defined in platformString.cpp] +// Buffer size bounds checking "safe" versions of strcat and strcpy. Ideally you +// should use these and check if they return >= dstSize and throw an error if so. +extern S32 dStrlcat(char *dst, const char *src, dsize_t dstSize); +extern S32 dStrlcpy(char *dst, const char *src, dsize_t dstSize); + #ifdef UNSAFE_STRING_FUNCTIONS /// @deprecated Use dStrcat(char *, const char *, dsize_t) instead inline char *dStrcat(char *dst, const char *src) @@ -61,14 +64,15 @@ inline char *dStrcat(char *dst, const char *src) } #endif -inline char *dStrcat(char *dst, const char *src, dsize_t len) +/// Concatenate strings. +/// @note The third parameter is the size of the destination buffer like strlcat +/// instead of the number of characters to copy like strncat. This is done +/// under the assumption that being easier to use will make this safer. +/// If you want the original behavior use dStrncat. +inline char *dStrcat(char *dst, const char *src, dsize_t dstSize) { -#ifdef DEBUG_CHECK_STRING_OVERFLOW - if (strlen(src) >= len) { - AssertWarn(false, "dStrcat out of range"); - } -#endif - return strncat(dst,src,len - 1); //Safety because strncat copies at most len+1 characters + dStrlcat(dst, src, dstSize); + return dst; } inline char *dStrncat(char *dst, const char *src, dsize_t len) @@ -110,14 +114,10 @@ inline char *dStrcpy(char *dst, const char *src) } #endif -inline char *dStrcpy(char *dst, const char *src, dsize_t len) +inline char *dStrcpy(char *dst, const char *src, dsize_t dstSize) { -#ifdef DEBUG_CHECK_STRING_OVERFLOW - if (strlen(src) >= len) { - AssertWarn(false, "dStrcpy out of range"); - } -#endif - return strncpy(dst,src,len); + dStrlcpy(dst, src, dstSize); + return dst; } inline char *dStrncpy(char *dst, const char *src, dsize_t len) From 34b2d91e899df10212186d58583507bf20a78737 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 8 Mar 2018 00:45:43 -0500 Subject: [PATCH 153/312] Speaking of badly sized mac things --- Engine/source/platform/types.mac.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Engine/source/platform/types.mac.h b/Engine/source/platform/types.mac.h index e700afac0..fb31d5ea7 100644 --- a/Engine/source/platform/types.mac.h +++ b/Engine/source/platform/types.mac.h @@ -27,10 +27,11 @@ #define FN_CDECL #define STDCALL +#include // size_t is needed to overload new // size_t tends to be OS and compiler specific and may need to // be if/def'ed in the future -typedef unsigned long dsize_t; +typedef size_t dsize_t; /** Platform dependent file date-time structure. The defination of this structure From eab086e1846fb8e52762ef91dcd1b0a4b41dba91 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 8 Mar 2018 00:51:52 -0500 Subject: [PATCH 154/312] A buffer overflow in enumerateConsoleClassesByCategory --- Engine/source/console/consoleObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 4064d47da..52e2d9256 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -888,7 +888,7 @@ DefineEngineFunction( enumerateConsoleClassesByCategory, const char*, ( String c && ( repCategory[ categoryLength ] == ' ' || repCategory[ categoryLength ] == '\0' ) ) { classes.push_back( rep ); - bufSize += dStrlen( rep->getClassName() + 1 ); + bufSize += dStrlen( rep->getClassName() ) + 1; } } From 47d5b6ead7b7bb158261203d167ac3f3ea6ec277 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 8 Mar 2018 20:59:40 -0500 Subject: [PATCH 155/312] As suggested, extract strlen calls from sizes into variables so it isn't called twice --- Engine/source/T3D/components/component.cpp | 5 +- Engine/source/T3D/fx/particle.cpp | 5 +- Engine/source/T3D/fx/particleEmitter.cpp | 5 +- Engine/source/afx/afxMagicMissile.cpp | 5 +- Engine/source/afx/ce/afxParticleEmitter.cpp | 15 +++-- Engine/source/afx/xm/afxXM_PathConform.cpp | 5 +- Engine/source/app/badWordFilter.cpp | 5 +- Engine/source/app/net/serverQuery.cpp | 55 +++++++++++-------- Engine/source/cinterface/cinterface.cpp | 5 +- Engine/source/console/CMDscan.cpp | 5 +- Engine/source/console/CMDscan.l | 5 +- Engine/source/console/astAlloc.cpp | 5 +- Engine/source/console/console.cpp | 5 +- Engine/source/console/consoleFunctions.cpp | 15 +++-- Engine/source/console/fileSystemFunctions.cpp | 10 ++-- Engine/source/console/simObjectMemento.cpp | 5 +- Engine/source/core/stringTable.cpp | 5 +- Engine/source/core/strings/findMatch.cpp | 5 +- .../source/core/strings/stringFunctions.cpp | 5 +- Engine/source/core/util/zip/centralDir.cpp | 5 +- Engine/source/gfx/gfxStructs.cpp | 5 +- .../source/gui/controls/guiAnimBitmapCtrl.cpp | 5 +- Engine/source/i18n/lang.cpp | 35 +++++++----- .../source/persistence/taml/tamlWriteNode.h | 5 +- .../source/platformWin32/winDInputDevice.cpp | 5 +- Engine/source/platformWin32/winRedbook.cpp | 5 +- .../x86UNIXOGLVideo.client.cpp | 5 +- .../source/platformX86UNIX/x86UNIXRedbook.cpp | 5 +- Engine/source/sim/actionMap.cpp | 5 +- Engine/source/sim/netStringTable.cpp | 10 ++-- Engine/source/sqlite/SQLiteObject.cpp | 10 ++-- Engine/source/util/messaging/eventManager.cpp | 5 +- Engine/source/util/undo.cpp | 10 ++-- 33 files changed, 171 insertions(+), 114 deletions(-) diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index 1ef7904e9..c7f9dcc2c 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -547,8 +547,9 @@ const char * Component::getDescriptionText(const char *desc) // [tom, 1/12/2007] If it isn't a file, just do it the easy way if (!Platform::isFile(desc)) { - newDesc = new char[dStrlen(desc) + 1]; - dStrcpy(newDesc, desc, dStrlen(desc) + 1); + dsize_t newDescLen = dStrlen(desc) + 1; + newDesc = new char[newDescLen]; + dStrcpy(newDesc, desc, newDescLen); return newDesc; } diff --git a/Engine/source/T3D/fx/particle.cpp b/Engine/source/T3D/fx/particle.cpp index a528af0d1..66539ab24 100644 --- a/Engine/source/T3D/fx/particle.cpp +++ b/Engine/source/T3D/fx/particle.cpp @@ -594,8 +594,9 @@ bool ParticleData::preload(bool server, String &errorStr) animTexFrames.clear(); - char* tokCopy = new char[dStrlen(animTexFramesString) + 1]; - dStrcpy(tokCopy, animTexFramesString, dStrlen(animTexFramesString) + 1); + dsize_t tokLen = dStrlen(animTexFramesString) + 1; + char* tokCopy = new char[tokLen]; + dStrcpy(tokCopy, animTexFramesString, tokLen); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index 00dbadb97..cab153574 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -608,8 +608,9 @@ bool ParticleEmitterData::onAdd() // First we parse particleString into a list of particle name tokens Vector dataBlocks(__FILE__, __LINE__); - char* tokCopy = new char[dStrlen(particleString) + 1]; - dStrcpy(tokCopy, particleString, dStrlen(particleString) + 1); + dsize_t tokLen = dStrlen(particleString) + 1; + char* tokCopy = new char[tokLen]; + dStrcpy(tokCopy, particleString, tokLen); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 690e3c74b..be42a9941 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -446,8 +446,9 @@ bool afxMagicMissileData::onAdd() Vector dataBlocks(__FILE__, __LINE__); // make a copy of points_string - char* tokCopy = new char[dStrlen(wiggle_axis_string) + 1]; - dStrcpy(tokCopy, wiggle_axis_string, dStrlen(wiggle_axis_string) + 1); + dsize_t tokCopyLen = dStrlen(wiggle_axis_string) + 1; + char* tokCopy = new char[tokCopyLen]; + dStrcpy(tokCopy, wiggle_axis_string, tokCopyLen); // extract tokens one by one, adding them to dataBlocks char* currTok = dStrtok(tokCopy, " \t"); diff --git a/Engine/source/afx/ce/afxParticleEmitter.cpp b/Engine/source/afx/ce/afxParticleEmitter.cpp index 2f7643c8f..1d76b2475 100644 --- a/Engine/source/afx/ce/afxParticleEmitter.cpp +++ b/Engine/source/afx/ce/afxParticleEmitter.cpp @@ -141,8 +141,9 @@ bool afxParticleEmitterData::onAdd() if (tpaths_string != ST_NULLSTRING) { Vector dataBlocks(__FILE__, __LINE__); - char* tokCopy = new char[dStrlen(tpaths_string) + 1]; - dStrcpy(tokCopy, tpaths_string, dStrlen(tpaths_string) + 1); + dsize_t tokCopyLen = dStrlen(tpaths_string) + 1; + char* tokCopy = new char[tokCopyLen]; + dStrcpy(tokCopy, tpaths_string, tokCopyLen); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) @@ -467,8 +468,9 @@ bool afxParticleEmitterPathData::onAdd() if (epaths_string != ST_NULLSTRING) { Vector dataBlocks(__FILE__, __LINE__); - char* tokCopy = new char[dStrlen(epaths_string) + 1]; - dStrcpy(tokCopy, epaths_string, dStrlen(epaths_string) + 1); + dsize_t tokCopyLen = dStrlen(epaths_string) + 1; + char* tokCopy = new char[tokCopyLen]; + dStrcpy(tokCopy, epaths_string, tokCopyLen); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) @@ -552,8 +554,9 @@ void afxParticleEmitterPathData::onPerformSubstitutions() if (epaths_string != ST_NULLSTRING) { Vector dataBlocks(__FILE__, __LINE__); - char* tokCopy = new char[dStrlen(epaths_string) + 1]; - dStrcpy(tokCopy, epaths_string, dStrlen(epaths_string) + 1); + dsize_t tokCopyLen = dStrlen(epaths_string) + 1; + char* tokCopy = new char[tokCopyLen]; + dStrcpy(tokCopy, epaths_string, tokCopyLen); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/afx/xm/afxXM_PathConform.cpp b/Engine/source/afx/xm/afxXM_PathConform.cpp index 3fde74699..07bd86d92 100644 --- a/Engine/source/afx/xm/afxXM_PathConform.cpp +++ b/Engine/source/afx/xm/afxXM_PathConform.cpp @@ -194,8 +194,9 @@ bool afxXM_PathConformData::onAdd() if (paths_string != ST_NULLSTRING) { Vector dataBlocks(__FILE__, __LINE__); - char* tokCopy = new char[dStrlen(paths_string) + 1]; - dStrcpy(tokCopy, paths_string, dStrlen(paths_string) + 1); + dsize_t tokCopyLen = dStrlen(paths_string) + 1; + char* tokCopy = new char[tokCopyLen]; + dStrcpy(tokCopy, paths_string, tokCopyLen); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index 0a13a9c29..2983a8bb5 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -286,8 +286,9 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const else replaceStr = gBadWordFilter->getDefaultReplaceStr(); - char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); - dStrcpy(ret, baseString, dStrlen(baseString) + 1); + dsize_t retLen = dStrlen(baseString) + 1; + char *ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, baseString, retLen); gBadWordFilter->filterString(ret, replaceStr); return ret; } diff --git a/Engine/source/app/net/serverQuery.cpp b/Engine/source/app/net/serverQuery.cpp index 12a83c454..05d31e531 100644 --- a/Engine/source/app/net/serverQuery.cpp +++ b/Engine/source/app/net/serverQuery.cpp @@ -510,14 +510,16 @@ void queryMasterServer(U8 flags, const char* gameType, const char* missionType, // Update the active filter: if ( !sActiveFilter.gameType || dStrcmp( sActiveFilter.gameType, gameType ) != 0 ) { - sActiveFilter.gameType = (char*) dRealloc( sActiveFilter.gameType, dStrlen( gameType ) + 1 ); - dStrcpy( sActiveFilter.gameType, gameType, dStrlen(gameType) + 1 ); + dsize_t gameTypeLen = dStrlen(gameType) + 1; + sActiveFilter.gameType = (char*) dRealloc( sActiveFilter.gameType, gameTypeLen ); + dStrcpy( sActiveFilter.gameType, gameType, gameTypeLen ); } if ( !sActiveFilter.missionType || dStrcmp( sActiveFilter.missionType, missionType ) != 0 ) { - sActiveFilter.missionType = (char*) dRealloc( sActiveFilter.missionType, dStrlen( missionType ) + 1 ); - dStrcpy( sActiveFilter.missionType, missionType, dStrlen(missionType) + 1 ); + dsize_t missionTypeLen = dStrlen(missionType) + 1; + sActiveFilter.missionType = (char*) dRealloc( sActiveFilter.missionType, missionTypeLen ); + dStrcpy( sActiveFilter.missionType, missionType, missionTypeLen ); } sActiveFilter.queryFlags = flags | ServerFilter::NewStyleResponse; @@ -969,8 +971,9 @@ static void pushServerFavorites() Net::stringToAddress( addrString, &addr ); ServerInfo* si = findOrCreateServerInfo( &addr ); AssertFatal(si, "pushServerFavorites - failed to create Server Info!" ); - si->name = (char*) dRealloc( (void*) si->name, dStrlen( serverName ) + 1 ); - dStrcpy( si->name, serverName, dStrlen(serverName) + 1 ); + dsize_t nameLen = dStrlen(serverName) + 1; + si->name = (char*) dRealloc( (void*) si->name, nameLen ); + dStrcpy( si->name, serverName, nameLen ); si->isFavorite = true; pushPingRequest( &addr ); } @@ -1053,8 +1056,9 @@ void addFakeServers( S32 howMany ) newServer.maxPlayers = 64; char buf[256]; dSprintf( buf, 255, "Fake server #%d", sNumFakeServers ); - newServer.name = (char*) dMalloc( dStrlen( buf ) + 1 ); - dStrcpy( newServer.name, buf, strlen(buf) + 1 ); + dsize_t nameLen = dStrlen(buf) + 1; + newServer.name = (char*) dMalloc( nameLen ); + dStrcpy( newServer.name, buf, nameLen ); newServer.gameType = (char*) dMalloc( 5 ); dStrcpy( newServer.gameType, "Fake", 5 ); newServer.missionType = (char*) dMalloc( 16 ); @@ -1753,8 +1757,9 @@ static void handleGameMasterInfoRequest( const NetAddress* address, U32 key, U8 out->write( playerCount ); const char* guidList = Con::getVariable( "Server::GuidList" ); - char* buf = new char[dStrlen( guidList ) + 1]; - dStrcpy( buf, guidList, dStrlen(guidList) + 1 ); + dsize_t bufLen = dStrlen(guidList) + 1; + char* buf = new char[bufLen]; + dStrcpy( buf, guidList, bufLen ); char* temp = dStrtok( buf, "\t" ); temp8 = 0; for ( ; temp && temp8 < playerCount; temp8++ ) @@ -1948,8 +1953,9 @@ static void handleGamePingResponse( const NetAddress* address, BitStream* stream stream->readString( buf ); if ( !si->name ) { - si->name = (char*) dMalloc( dStrlen( buf ) + 1 ); - dStrcpy( si->name, buf, dStrlen(buf) + 1 ); + dsize_t bufLen = dStrlen(buf) + 1; + si->name = (char*) dMalloc(bufLen); + dStrcpy( si->name, buf, bufLen ); } // Set the server up to be queried: @@ -2050,8 +2056,9 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream stream->readString( stringBuf ); if ( !si->gameType || dStricmp( si->gameType, stringBuf ) != 0 ) { - si->gameType = (char*) dRealloc( (void*) si->gameType, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->gameType, stringBuf, dStrlen(stringBuf) + 1 ); + dsize_t gameTypeLen = dStrlen(stringBuf) + 1; + si->gameType = (char*) dRealloc( (void*) si->gameType, gameTypeLen ); + dStrcpy( si->gameType, stringBuf, gameTypeLen ); // Test against the active filter: if ( applyFilter && dStricmp( sActiveFilter.gameType, "any" ) != 0 @@ -2067,8 +2074,9 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream stream->readString( stringBuf ); if ( !si->missionType || dStrcmp( si->missionType, stringBuf ) != 0 ) { - si->missionType = (char*) dRealloc( (void*) si->missionType, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->missionType, stringBuf, dStrlen(stringBuf) + 1 ); + dsize_t missionTypeLen = dStrlen(stringBuf) + 1; + si->missionType = (char*) dRealloc( (void*) si->missionType, missionTypeLen ); + dStrcpy( si->missionType, stringBuf, missionTypeLen ); // Test against the active filter: if ( applyFilter && dStricmp( sActiveFilter.missionType, "any" ) != 0 @@ -2088,8 +2096,9 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream *temp = '\0'; if ( !si->missionName || dStrcmp( si->missionName, stringBuf ) != 0 ) { - si->missionName = (char*) dRealloc( (void*) si->missionName, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->missionName, stringBuf, dStrlen(stringBuf) + 1 ); + dsize_t missionNameLen = dStrlen(stringBuf) + 1; + si->missionName = (char*) dRealloc( (void*) si->missionName, missionNameLen ); + dStrcpy( si->missionName, stringBuf, missionNameLen ); } // Get the server status: @@ -2157,16 +2166,18 @@ static void handleGameInfoResponse( const NetAddress* address, BitStream* stream stream->readString( stringBuf ); if ( !si->statusString || ( isUpdate && dStrcmp( si->statusString, stringBuf ) != 0 ) ) { - si->infoString = (char*) dRealloc( (void*) si->infoString, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->infoString, stringBuf, dStrlen(stringBuf) + 1 ); + dsize_t infoLen = dStrlen(stringBuf) + 1; + si->infoString = (char*) dRealloc( (void*) si->infoString, infoLen ); + dStrcpy( si->infoString, stringBuf, infoLen ); } // Get the content string: readLongCString( stream, stringBuf ); if ( !si->statusString || ( isUpdate && dStrcmp( si->statusString, stringBuf ) != 0 ) ) { - si->statusString = (char*) dRealloc( (void*) si->statusString, dStrlen( stringBuf ) + 1 ); - dStrcpy( si->statusString, stringBuf, dStrlen(stringBuf) + 1 ); + dsize_t statusLen = dStrlen(stringBuf) + 1; + si->statusString = (char*) dRealloc( (void*) si->statusString, statusLen ); + dStrcpy( si->statusString, stringBuf, statusLen ); } // Update the server browser gui! diff --git a/Engine/source/cinterface/cinterface.cpp b/Engine/source/cinterface/cinterface.cpp index 4f6f1900c..aa0fae035 100644 --- a/Engine/source/cinterface/cinterface.cpp +++ b/Engine/source/cinterface/cinterface.cpp @@ -182,8 +182,9 @@ extern "C" { void torque_setexecutablepath(const char* directory) { - gExecutablePath = new char[dStrlen(directory)+1]; - dStrcpy(gExecutablePath, directory, dStrlen(directory)+1); + dsize_t pathLen = dStrlen(directory) + 1; + gExecutablePath = new char[pathLen]; + dStrcpy(gExecutablePath, directory, pathLen); } // set Torque 3D into web deployment mode (disable fullscreen exlusive mode, etc) diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index c780fd2a6..c30ac7bc9 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -2340,8 +2340,9 @@ static int Sc_ScanString(int ret) if (!collapseEscape(CMDtext + 1)) return -1; - char* buffer = (char*)consoleAlloc(dStrlen(CMDtext)); - dStrcpy(buffer, CMDtext + 1, dStrlen(CMDtext)); + dsize_t bufferLen = dStrlen(CMDtext); + char* buffer = (char*)consoleAlloc(bufferLen); + dStrcpy(buffer, CMDtext + 1, bufferLen); CMDlval.str = MakeToken< char* >(buffer, lineIndex); return ret; diff --git a/Engine/source/console/CMDscan.l b/Engine/source/console/CMDscan.l index c4bdc1bf3..e9069fe15 100644 --- a/Engine/source/console/CMDscan.l +++ b/Engine/source/console/CMDscan.l @@ -412,8 +412,9 @@ static int Sc_ScanString(int ret) if(!collapseEscape(CMDtext+1)) return -1; - char* buffer = ( char* ) consoleAlloc( dStrlen( CMDtext ) ); - dStrcpy( buffer, CMDtext + 1, dStrlen( CMDtext ) ); + dsize_t bufferLen = dStrlen( CMDtext ); + char* buffer = ( char* ) consoleAlloc( bufferLen ); + dStrcpy( buffer, CMDtext + 1, bufferLen ); CMDlval.str = MakeToken< char* >( buffer, lineIndex ); return ret; diff --git a/Engine/source/console/astAlloc.cpp b/Engine/source/console/astAlloc.cpp index e897af247..521b6dbcc 100644 --- a/Engine/source/console/astAlloc.cpp +++ b/Engine/source/console/astAlloc.cpp @@ -238,10 +238,11 @@ StrConstNode *StrConstNode::alloc(S32 lineNumber, char *str, bool tag, bool doc) StrConstNode *ret = (StrConstNode *)consoleAlloc(sizeof(StrConstNode)); constructInPlace(ret); ret->dbgLineNumber = lineNumber; - ret->str = (char *)consoleAlloc(dStrlen(str) + 1); + dsize_t retStrLen = dStrlen(str) + 1; + ret->str = (char *)consoleAlloc(retStrLen); ret->tag = tag; ret->doc = doc; - dStrcpy(ret->str, str, dStrlen(str) + 1); + dStrcpy(ret->str, str, retStrLen); return ret; } diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index be472f197..dc7dde340 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -646,8 +646,9 @@ static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, co entry.mLevel = level; entry.mType = type; #ifndef TORQUE_SHIPPING // this is equivalent to a memory leak, turn it off in ship build - entry.mString = (const char *)consoleLogChunker.alloc(dStrlen(pos) + 1); - dStrcpy(const_cast(entry.mString), pos, dStrlen(pos) + 1); + dsize_t logStringLen = dStrlen(pos) + 1; + entry.mString = (const char *)consoleLogChunker.alloc(logStringLen); + dStrcpy(const_cast(entry.mString), pos, logStringLen); // This prevents infinite recursion if the console itself needs to // re-allocate memory to accommodate the new console log entry, and diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 3ffe200ce..d32b30d31 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -585,8 +585,9 @@ DefineConsoleFunction( strlwr, const char*, ( const char* str ),, "@see strupr\n" "@ingroup Strings" ) { - char *ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str, dStrlen(str) + 1); + dsize_t retLen = dStrlen(str) + 1; + char *ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, str, retLen); return dStrlwr(ret); } @@ -602,8 +603,9 @@ DefineConsoleFunction( strupr, const char*, ( const char* str ),, "@see strlwr\n" "@ingroup Strings" ) { - char *ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str, dStrlen(str) + 1); + dsize_t retLen = dStrlen(str) + 1; + char *ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, str, retLen); return dStrupr(ret); } @@ -1826,8 +1828,9 @@ DefineEngineFunction( detag, const char*, ( const char* str ),, if( word == NULL ) return ""; - char* ret = Con::getReturnBuffer( dStrlen( word + 1 ) + 1 ); - dStrcpy( ret, word + 1, dStrlen(word + 1) + 1 ); + dsize_t retLen = dStrlen(word + 1) + 1; + char* ret = Con::getReturnBuffer(retLen); + dStrcpy( ret, word + 1, retLen ); return ret; } else diff --git a/Engine/source/console/fileSystemFunctions.cpp b/Engine/source/console/fileSystemFunctions.cpp index 0fdafec85..23ef01c24 100644 --- a/Engine/source/console/fileSystemFunctions.cpp +++ b/Engine/source/console/fileSystemFunctions.cpp @@ -617,8 +617,9 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),, path = szPathCopy; else path++; - char *ret = Con::getReturnBuffer(dStrlen(path) + 1); - dStrcpy(ret, path, dStrlen(path) + 1); + dsize_t retLen = dStrlen(path) + 1; + char *ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, path, retLen); char *ext = dStrrchr(ret, '.'); if(ext) *ext = 0; @@ -643,8 +644,9 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),, name = szPathCopy; else name++; - char *ret = Con::getReturnBuffer(dStrlen(name) + 1); - dStrcpy(ret, name, dStrlen(name) + 1); + dsize_t retLen = dStrlen(name) + 1; + char *ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, name, retLen); return ret; } diff --git a/Engine/source/console/simObjectMemento.cpp b/Engine/source/console/simObjectMemento.cpp index 93a9db118..949349442 100644 --- a/Engine/source/console/simObjectMemento.cpp +++ b/Engine/source/console/simObjectMemento.cpp @@ -134,10 +134,11 @@ SimObject *SimObjectMemento::restore() const return NULL; U32 numCharsToLeftParen = pLeftParen - mState; - tempBuffer = ( char* ) dMalloc( dStrlen( mState ) + uniqueNameLen + 1 ); + dsize_t tempBufferLen = dStrlen(mState) + uniqueNameLen + 1; + tempBuffer = ( char* ) dMalloc( tempBufferLen ); dMemcpy( tempBuffer, mState, numCharsToLeftParen ); dMemcpy( &tempBuffer[ numCharsToLeftParen ], uniqueName, uniqueNameLen ); - dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ], dStrlen(mState) - numCharsToLeftParen + 1 ); + dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ], tempBufferLen - numCharsToLeftParen - uniqueNameLen ); } Con::evaluate( tempBuffer ); diff --git a/Engine/source/core/stringTable.cpp b/Engine/source/core/stringTable.cpp index 17f2ca235..d29519198 100644 --- a/Engine/source/core/stringTable.cpp +++ b/Engine/source/core/stringTable.cpp @@ -142,10 +142,11 @@ StringTableEntry _StringTable::insert(const char* _val, const bool caseSens) } char *ret = 0; if(!*walk) { + dsize_t valLen = dStrlen(val) + 1; *walk = (Node *) mempool.alloc(sizeof(Node)); (*walk)->next = 0; - (*walk)->val = (char *) mempool.alloc(dStrlen(val) + 1); - dStrcpy((*walk)->val, val, dStrlen(val) + 1); + (*walk)->val = (char *) mempool.alloc(valLen); + dStrcpy((*walk)->val, val, valLen); ret = (*walk)->val; itemCount ++; } diff --git a/Engine/source/core/strings/findMatch.cpp b/Engine/source/core/strings/findMatch.cpp index bfa7d5a3b..97829a5ca 100644 --- a/Engine/source/core/strings/findMatch.cpp +++ b/Engine/source/core/strings/findMatch.cpp @@ -71,8 +71,9 @@ void FindMatch::setExpression( const char *_expression ) { delete [] expression; - expression = new char[dStrlen(_expression) + 1]; - dStrcpy(expression, _expression, dStrlen(_expression) + 1); + dsize_t expressionLen = dStrlen(_expression) + 1; + expression = new char[expressionLen]; + dStrcpy(expression, _expression, expressionLen); dStrupr(expression); } diff --git a/Engine/source/core/strings/stringFunctions.cpp b/Engine/source/core/strings/stringFunctions.cpp index 668c9d649..77f7214d0 100644 --- a/Engine/source/core/strings/stringFunctions.cpp +++ b/Engine/source/core/strings/stringFunctions.cpp @@ -215,8 +215,9 @@ S32 dStrnatcasecmp(const nat_char* a, const nat_char* b) { char *dStrdup_r(const char *src, const char *fileName, dsize_t lineNumber) { - char *buffer = (char *) dMalloc_r(dStrlen(src) + 1, fileName, lineNumber); - dStrcpy(buffer, src, dStrlen(src) + 1); + dsize_t bufferLen = dStrlen(src) + 1; + char *buffer = (char *) dMalloc_r(bufferLen, fileName, lineNumber); + dStrcpy(buffer, src, bufferLen); return buffer; } diff --git a/Engine/source/core/util/zip/centralDir.cpp b/Engine/source/core/util/zip/centralDir.cpp index bf5bef92e..7646bac7a 100644 --- a/Engine/source/core/util/zip/centralDir.cpp +++ b/Engine/source/core/util/zip/centralDir.cpp @@ -177,8 +177,9 @@ bool CentralDir::write(Stream *stream) void CentralDir::setFileComment(const char *comment) { SAFE_DELETE_ARRAY(mFileComment); - mFileComment = new char [dStrlen(comment)+1]; - dStrcpy(mFileComment, comment, dStrlen(comment)+1); + dsize_t commentLen = dStrlen(comment) + 1; + mFileComment = new char [commentLen]; + dStrcpy(mFileComment, comment, commentLen); } //----------------------------------------------------------------------------- diff --git a/Engine/source/gfx/gfxStructs.cpp b/Engine/source/gfx/gfxStructs.cpp index ff8726b8b..7f64c6ee6 100644 --- a/Engine/source/gfx/gfxStructs.cpp +++ b/Engine/source/gfx/gfxStructs.cpp @@ -39,8 +39,9 @@ void GFXVideoMode::parseFromString( const char *str ) return; // Copy the string, as dStrtok is destructive - char *tempBuf = new char[dStrlen( str ) + 1]; - dStrcpy( tempBuf, str, dStrlen(str) + 1 ); + dsize_t tempBufLen = dStrlen(str) + 1; + char *tempBuf = new char[tempBufLen]; + dStrcpy( tempBuf, str, tempBufLen ); #define PARSE_ELEM(type, var, func, tokParam, sep) \ if(const char *ptr = dStrtok( tokParam, sep)) \ diff --git a/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp b/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp index 1f29caddc..26ce32376 100644 --- a/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp +++ b/Engine/source/gui/controls/guiAnimBitmapCtrl.cpp @@ -167,8 +167,9 @@ bool guiAnimBitmapCtrl::ptSetFrameRanges(void *object, const char *index, const pData->mCurFrameIndex = pData->mNumFrames; return true; } - char* tokCopy = new char[dStrlen(data) + 1]; - dStrcpy(tokCopy, data, dStrlen(data) + 1); + dsize_t tokLen = dStrlen(data) + 1; + char* tokCopy = new char[tokLen]; + dStrcpy(tokCopy, data, tokLen); char* currTok = dStrtok(tokCopy, " \t"); while (currTok != NULL) diff --git a/Engine/source/i18n/lang.cpp b/Engine/source/i18n/lang.cpp index 3ed0d344c..7e1efe4a5 100644 --- a/Engine/source/i18n/lang.cpp +++ b/Engine/source/i18n/lang.cpp @@ -42,8 +42,9 @@ LangFile::LangFile(const UTF8 *langName /* = NULL */) if(langName) { - mLangName = new UTF8 [dStrlen(langName) + 1]; - dStrcpy(mLangName, langName, dStrlen(langName) + 1); + dsize_t langNameLen = dStrlen(langName) + 1; + mLangName = new UTF8 [langNameLen]; + dStrcpy(mLangName, langName, langNameLen); } else mLangName = NULL; @@ -136,8 +137,9 @@ const UTF8 * LangFile::getString(U32 id) U32 LangFile::addString(const UTF8 *str) { - UTF8 *newstr = new UTF8 [dStrlen(str) + 1]; - dStrcpy(newstr, str, dStrlen(str) + 1); + dsize_t newstrLen = dStrlen(str) + 1; + UTF8 *newstr = new UTF8 [newstrLen]; + dStrcpy(newstr, str, newstrLen); mStringTable.push_back(newstr); return mStringTable.size() - 1; } @@ -156,8 +158,9 @@ void LangFile::setString(U32 id, const UTF8 *str) SAFE_DELETE_ARRAY(mStringTable[id]); - UTF8 *newstr = new UTF8 [dStrlen(str) + 1]; - dStrcpy(newstr, str, dStrlen(str) + 1); + dsize_t newstrLen = dStrlen(str) + 1; + UTF8 *newstr = new UTF8 [newstrLen]; + dStrcpy(newstr, str, newstrLen); mStringTable[id] = newstr; } @@ -166,8 +169,9 @@ void LangFile::setLangName(const UTF8 *newName) if(mLangName) delete [] mLangName; - mLangName = new UTF8 [dStrlen(newName) + 1]; - dStrcpy(mLangName, newName, dStrlen(newName) + 1); + dsize_t langNameLen = dStrlen(newName) + 1; + mLangName = new UTF8 [langNameLen]; + dStrcpy(mLangName, newName, langNameLen); } void LangFile::setLangFile(const UTF8 *langFile) @@ -175,8 +179,9 @@ void LangFile::setLangFile(const UTF8 *langFile) if(mLangFile) delete [] mLangFile; - mLangFile = new UTF8 [dStrlen(langFile) + 1]; - dStrcpy(mLangFile, langFile, dStrlen(langFile) + 1); + dsize_t langFileLen = dStrlen(langFile) + 1; + mLangFile = new UTF8 [langFileLen]; + dStrcpy(mLangFile, langFile, langFileLen); } bool LangFile::activateLanguage() @@ -349,8 +354,9 @@ DefineConsoleMethod(LangTable, getString, const char *, (U32 id), , const char * str = (const char*)object->getString(id); if(str != NULL) { - char * ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str, dStrlen(str) + 1); + dsize_t retLen = dStrlen(str) + 1; + char * ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, str, retLen); return ret; } @@ -387,8 +393,9 @@ DefineConsoleMethod(LangTable, getLangName, const char *, (S32 langId), , "(int const char * str = (const char*)object->getLangName(langId); if(str != NULL) { - char * ret = Con::getReturnBuffer(dStrlen(str) + 1); - dStrcpy(ret, str, dStrlen(str) + 1); + dsize_t retLen = dStrlen(str) + 1; + char * ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, str, retLen); return ret; } diff --git a/Engine/source/persistence/taml/tamlWriteNode.h b/Engine/source/persistence/taml/tamlWriteNode.h index 015224589..b406a54d8 100644 --- a/Engine/source/persistence/taml/tamlWriteNode.h +++ b/Engine/source/persistence/taml/tamlWriteNode.h @@ -53,8 +53,9 @@ public: mName = name; // Allocate and copy the value. - mpValue = new char[ dStrlen(pValue)+1 ]; - dStrcpy( (char *)mpValue, pValue, dStrlen(pValue) + 1 ); + dsize_t valueLen = dStrlen(pValue) + 1; + mpValue = new char[ valueLen ]; + dStrcpy( (char *)mpValue, pValue, valueLen ); } diff --git a/Engine/source/platformWin32/winDInputDevice.cpp b/Engine/source/platformWin32/winDInputDevice.cpp index c2969c65c..9ce308090 100644 --- a/Engine/source/platformWin32/winDInputDevice.cpp +++ b/Engine/source/platformWin32/winDInputDevice.cpp @@ -1575,8 +1575,9 @@ const char* DInputDevice::getJoystickAxesString() } } - char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); - dStrcpy( returnString, buf, dStrlen(buf) + 1 ); + dsize_t returnLen = dStrlen(buf) + 1; + char* returnString = Con::getReturnBuffer(returnLen); + dStrcpy( returnString, buf, returnLen ); return( returnString ); } diff --git a/Engine/source/platformWin32/winRedbook.cpp b/Engine/source/platformWin32/winRedbook.cpp index 40b030c64..beef38dd0 100644 --- a/Engine/source/platformWin32/winRedbook.cpp +++ b/Engine/source/platformWin32/winRedbook.cpp @@ -83,8 +83,9 @@ void installRedBookDevices() if(::GetDriveTypeA(str) == DRIVE_CDROM) { Win32RedBookDevice * device = new Win32RedBookDevice; - device->mDeviceName = new char[dStrlen(str) + 1]; - dStrcpy(device->mDeviceName, str, dStrlen(str) + 1); + dsize_t deviceNameLen = dStrlen(str) + 1; + device->mDeviceName = new char[deviceNameLen]; + dStrcpy(device->mDeviceName, str, deviceNameLen); RedBook::installDevice(device); } diff --git a/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp b/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp index 384aade9e..9db3236c5 100644 --- a/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXOGLVideo.client.cpp @@ -40,8 +40,9 @@ bool InitOpenGL() // Get the video settings from the prefs: const char* resString = Con::getVariable( "$pref::Video::resolution" ); - char* tempBuf = new char[dStrlen( resString ) + 1]; - dStrcpy( tempBuf, resString, dStrlen(resString) + 1 ); + dsize_t tempBufLen = dStrlen(resString) + 1; + char* tempBuf = new char[tempBufLen]; + dStrcpy( tempBuf, resString, tempBufLen ); char* temp = dStrtok( tempBuf, " x\0" ); U32 width = ( temp ? dAtoi( temp ) : 800 ); temp = dStrtok( NULL, " x\0" ); diff --git a/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp b/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp index 3484a56ce..d24902230 100644 --- a/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXRedbook.cpp @@ -101,8 +101,9 @@ void UnixRedBookDevice::setDeviceInfo(S32 deviceId, const char *deviceName) { #if !defined(__FreeBSD__) mDeviceId = deviceId; - mDeviceName = new char[dStrlen(deviceName) + 1]; - dStrcpy(mDeviceName, deviceName, dStrlen(deviceName) + 1); + dsize_t deviceNameLen = dStrlen(deviceName) + 1; + mDeviceName = new char[deviceNameLen]; + dStrcpy(mDeviceName, deviceName, deviceNameLen); #endif // !defined(__FreeBSD__) } diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index 1d0fbe8b5..ca2932e84 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -908,8 +908,9 @@ const char* ActionMap::getDeadZone( const char* device, const char* action ) { char buf[64]; dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd ); - char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 ); - dStrcpy( returnString, buf, dStrlen(buf) + 1 ); + dsize_t returnLen = dStrlen(buf) + 1; + char* returnString = Con::getReturnBuffer( returnLen ); + dStrcpy( returnString, buf, returnLen ); return( returnString ); } else diff --git a/Engine/source/sim/netStringTable.cpp b/Engine/source/sim/netStringTable.cpp index c21377885..83a059eff 100644 --- a/Engine/source/sim/netStringTable.cpp +++ b/Engine/source/sim/netStringTable.cpp @@ -96,8 +96,9 @@ U32 NetStringTable::addString(const char *string) size = newSize; } table[e].refCount++; - table[e].string = (char *) allocator->alloc(dStrlen(string) + 1); - dStrcpy(table[e].string, string, dStrlen(string) + 1); + dsize_t stringLen = dStrlen(string) + 1; + table[e].string = (char *) allocator->alloc(stringLen); + dStrcpy(table[e].string, string, stringLen); table[e].next = hashTable[bucket]; hashTable[bucket] = e; table[e].link = firstValid; @@ -178,8 +179,9 @@ void NetStringTable::repack() const char *prevStr = table[walk].string; - table[walk].string = (char *) newAllocator->alloc(dStrlen(prevStr) + 1); - dStrcpy(table[walk].string, prevStr, dStrlen(prevStr) + 1); + dsize_t prevStrLen = dStrlen(prevStr) + 1; + table[walk].string = (char *) newAllocator->alloc(prevStrLen); + dStrcpy(table[walk].string, prevStr, prevStrLen); } delete allocator; allocator = newAllocator; diff --git a/Engine/source/sqlite/SQLiteObject.cpp b/Engine/source/sqlite/SQLiteObject.cpp index a2900ab30..4cba76720 100644 --- a/Engine/source/sqlite/SQLiteObject.cpp +++ b/Engine/source/sqlite/SQLiteObject.cpp @@ -157,13 +157,15 @@ S32 Callback(void *pArg, S32 argc, char **argv, char **columnNames) { // DBEUG CODE // Con::printf("%s = %s\n", columnNames[i], argv[i] ? argv[i] : "NULL"); - name = new char[dStrlen(columnNames[i]) + 1]; - dStrcpy(name, columnNames[i], dStrlen(columnNames[i]) + 1); + dsize_t columnNameLen = dStrlen(columnNames[i]) + 1; + name = new char[columnNameLen]; + dStrcpy(name, columnNames[i], columnNameLen); pRow->vColumnNames.push_back(name); if (argv[i]) { - value = new char[dStrlen(argv[i]) + 1]; - dStrcpy(value, argv[i], dStrlen(argv[i]) + 1); + dsize_t valueLen = dStrlen(argv[i]) + 1; + value = new char[valueLen]; + dStrcpy(value, argv[i], valueLen); pRow->vColumnValues.push_back(value); } else diff --git a/Engine/source/util/messaging/eventManager.cpp b/Engine/source/util/messaging/eventManager.cpp index 5463e1efc..0edfa98fc 100644 --- a/Engine/source/util/messaging/eventManager.cpp +++ b/Engine/source/util/messaging/eventManager.cpp @@ -288,8 +288,9 @@ bool EventManager::subscribe(SimObject *callbackObj, const char* event, const ch } else { - cb = new char[dStrlen(callback) + 1]; - dStrcpy(cb, callback, dStrlen(callback) + 1); + dsize_t cbLen = dStrlen(callback) + 1; + cb = new char[cbLen]; + dStrcpy(cb, callback, cbLen); } // Create the subscriber object. diff --git a/Engine/source/util/undo.cpp b/Engine/source/util/undo.cpp index 11334a793..7ea0acc8c 100644 --- a/Engine/source/util/undo.cpp +++ b/Engine/source/util/undo.cpp @@ -545,8 +545,9 @@ DefineConsoleMethod(UndoManager, getNextUndoName, const char *, (),, "UndoManage const char *name = object->getNextUndoName(); if(!name) return NULL; - char *ret = Con::getReturnBuffer(dStrlen(name) + 1); - dStrcpy(ret, name, dStrlen(name) + 1); + dsize_t retLen = dStrlen(name) + 1; + char *ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, name, retLen); return ret; } @@ -556,8 +557,9 @@ DefineConsoleMethod(UndoManager, getNextRedoName, const char *, (),, "UndoManage const char *name = object->getNextRedoName(); if(!name) return NULL; - char *ret = Con::getReturnBuffer(dStrlen(name) + 1); - dStrcpy(ret, name, dStrlen(name) + 1); + dsize_t retLen = dStrlen(name) + 1; + char *ret = Con::getReturnBuffer(retLen); + dStrcpy(ret, name, retLen); return ret; } From 2e7d406860b9b83536b4f1b42e25cbcbf19a47d6 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 02:36:52 -0500 Subject: [PATCH 156/312] variable naming cleanup due to locals overriding in multiple places. objectname to mObjectName+ getName() refs in dictionary. --- Engine/source/console/simDictionary.cpp | 28 ++++++++++++------------- Engine/source/console/simObject.cpp | 20 +++++++++--------- Engine/source/console/simObject.h | 6 +++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Engine/source/console/simDictionary.cpp b/Engine/source/console/simDictionary.cpp index b733d9fcc..4f5aac411 100644 --- a/Engine/source/console/simDictionary.cpp +++ b/Engine/source/console/simDictionary.cpp @@ -45,13 +45,13 @@ SimNameDictionary::~SimNameDictionary() void SimNameDictionary::insert(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; - SimObject* checkForDup = find(obj->objectName); + SimObject* checkForDup = find(obj->getName()); if (checkForDup) - Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->objectName); + Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->getName()); Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY @@ -64,7 +64,7 @@ void SimNameDictionary::insert(SimObject* obj) dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize); } - S32 idx = HashPointer(obj->objectName) % hashTableSize; + S32 idx = HashPointer(obj->getName()) % hashTableSize; obj->nextNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; @@ -86,7 +86,7 @@ void SimNameDictionary::insert(SimObject* obj) { SimObject* next = object->nextNameObject; - idx = HashPointer(object->objectName) % newHashTableSize; + idx = HashPointer(object->getName()) % newHashTableSize; object->nextNameObject = newHashTable[idx]; newHashTable[idx] = object; @@ -118,7 +118,7 @@ SimObject* SimNameDictionary::find(StringTableEntry name) SimObject *walk = hashTable[idx]; while (walk) { - if (walk->objectName == name) + if (walk->getName() == name) { Mutex::unlockMutex(mutex); return walk; @@ -139,12 +139,12 @@ SimObject* SimNameDictionary::find(StringTableEntry name) void SimNameDictionary::remove(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; + SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize]; while (*walk) { if (*walk == obj) @@ -190,12 +190,12 @@ SimManagerNameDictionary::~SimManagerNameDictionary() void SimManagerNameDictionary::insert(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - S32 idx = HashPointer(obj->objectName) % hashTableSize; + S32 idx = HashPointer(obj->getName()) % hashTableSize; obj->nextManagerNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; @@ -217,7 +217,7 @@ void SimManagerNameDictionary::insert(SimObject* obj) { SimObject* next = object->nextManagerNameObject; - idx = HashPointer(object->objectName) % newHashTableSize; + idx = HashPointer(object->getName()) % newHashTableSize; object->nextManagerNameObject = newHashTable[idx]; newHashTable[idx] = object; @@ -247,7 +247,7 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) SimObject *walk = hashTable[idx]; while (walk) { - if (walk->objectName == name) + if (walk->getName() == name) { Mutex::unlockMutex(mutex); return walk; @@ -267,13 +267,13 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) void SimManagerNameDictionary::remove(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; #ifndef USE_NEW_SIMDICTIONARY Mutex::lockMutex(mutex); - SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; + SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize]; while (*walk) { if (*walk == obj) diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index ef688228f..c4b6848c9 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -71,7 +71,7 @@ namespace Sim SimObject::SimObject() { - objectName = NULL; + mObjectName = NULL; mOriginalName = NULL; mInternalName = NULL; nextNameObject = nullptr; @@ -128,10 +128,10 @@ SimObject::~SimObject() AssertFatal(nextNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from dictionary: name %s, id %i", - objectName, mId)); + mObjectName, mId)); AssertFatal(nextManagerNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from manager dictionary: name %s, id %i", - objectName,mId)); + mObjectName,mId)); AssertFatal(mFlags.test(Added) == 0, "SimObject::object " "missing call to SimObject::onRemove"); } @@ -149,7 +149,7 @@ void SimObject::initPersistFields() { addGroup( "Ungrouped" ); - addProtectedField( "name", TypeName, Offset(objectName, SimObject), &setProtectedName, &defaultProtectedGetFn, + addProtectedField( "name", TypeName, Offset(mObjectName, SimObject), &setProtectedName, &defaultProtectedGetFn, "Optional global name of this object." ); endGroup( "Ungrouped" ); @@ -211,8 +211,8 @@ String SimObject::describeSelf() const if( mId != 0 ) desc = avar( "%s|id: %i", desc.c_str(), mId ); - if( objectName ) - desc = avar( "%s|name: %s", desc.c_str(), objectName ); + if(mObjectName) + desc = avar( "%s|name: %s", desc.c_str(), mObjectName); if( mInternalName ) desc = avar( "%s|internal: %s", desc.c_str(), mInternalName ); if( mNameSpace ) @@ -754,9 +754,9 @@ void SimObject::setId(SimObjectId newId) void SimObject::assignName(const char *name) { - if( objectName && !isNameChangeAllowed() ) + if(mObjectName && !isNameChangeAllowed() ) { - Con::errorf( "SimObject::assignName - not allowed to change name of object '%s'", objectName ); + Con::errorf( "SimObject::assignName - not allowed to change name of object '%s'", mObjectName); return; } @@ -781,7 +781,7 @@ void SimObject::assignName(const char *name) Sim::gNameDictionary->remove( this ); } - objectName = newName; + mObjectName = newName; if( mGroup ) mGroup->mNameDictionary.insert( this ); @@ -1373,7 +1373,7 @@ SimObject::SimObject(const SimObject& other, bool temp_clone) { is_temp_clone = temp_clone; - objectName = other.objectName; + mObjectName = other.mObjectName; mOriginalName = other.mOriginalName; nextNameObject = other.nextNameObject; nextManagerNameObject = other.nextManagerNameObject; diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 2119ea6a9..585944df7 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -293,7 +293,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks }; // dictionary information stored on the object - StringTableEntry objectName; + StringTableEntry mObjectName; StringTableEntry mOriginalName; SimObject* nextNameObject; SimObject* nextManagerNameObject; @@ -358,7 +358,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks { static_cast(object)->setSuperClassNamespace(data); return false; }; static bool writeObjectName(void* obj, StringTableEntry pFieldName) - { SimObject* simObject = static_cast(obj); return simObject->objectName != NULL && simObject->objectName != StringTable->EmptyString(); } + { SimObject* simObject = static_cast(obj); return simObject->mObjectName != NULL && simObject->mObjectName != StringTable->EmptyString(); } static bool writeCanSaveDynamicFields(void* obj, StringTableEntry pFieldName) { return static_cast(obj)->mCanSaveFieldDictionary == false; } static bool writeInternalName(void* obj, StringTableEntry pFieldName) @@ -761,7 +761,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks const char* getIdString() const { return mIdString; } /// Return the name of this object. - StringTableEntry getName() const { return objectName; } + StringTableEntry getName() const { return mObjectName; } /// Return the SimGroup that this object is contained in. Never NULL except for /// RootGroup and unregistered objects. From 2369645a5a7bc20685ae83f21c6df9bc90c44b19 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 03:58:19 -0500 Subject: [PATCH 157/312] simset::objectList to simset::mObjectList --- Engine/source/console/simManager.cpp | 2 +- Engine/source/console/simSet.cpp | 56 +++++++++---------- Engine/source/console/simSet.h | 30 +++++----- .../forest/editor/forestBrushElement.cpp | 4 +- Engine/source/scene/simPath.cpp | 2 +- 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index 4f12fa85f..fc8a77edd 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -612,6 +612,6 @@ void SimDataBlockGroup::sort() if(mLastModifiedKey != SimDataBlock::getNextModifiedKey()) { mLastModifiedKey = SimDataBlock::getNextModifiedKey(); - dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey); + dQsort(mObjectList.address(), mObjectList.size(),sizeof(SimObject *),compareModifiedKey); } } diff --git a/Engine/source/console/simSet.cpp b/Engine/source/console/simSet.cpp index c44b09c36..718e5f158 100644 --- a/Engine/source/console/simSet.cpp +++ b/Engine/source/console/simSet.cpp @@ -118,7 +118,7 @@ IMPLEMENT_CALLBACK( SimSet, onObjectRemoved, void, ( SimObject* object ), ( obje SimSet::SimSet() { - VECTOR_SET_ASSOCIATION( objectList ); + VECTOR_SET_ASSOCIATION(mObjectList); mMutex = Mutex::createMutex(); } @@ -139,7 +139,7 @@ void SimSet::addObject( SimObject* obj ) lock(); - const bool added = objectList.pushBack( obj ); + const bool added = mObjectList.pushBack( obj ); if( added ) deleteNotify( obj ); @@ -159,7 +159,7 @@ void SimSet::removeObject( SimObject* obj ) { lock(); - const bool removed = objectList.remove( obj ); + const bool removed = mObjectList.remove( obj ); if( removed ) clearNotify( obj ); @@ -182,7 +182,7 @@ void SimSet::pushObject( SimObject* obj ) lock(); - bool added = objectList.pushBackForce( obj ); + bool added = mObjectList.pushBackForce( obj ); if( added ) deleteNotify( obj ); @@ -200,15 +200,15 @@ void SimSet::pushObject( SimObject* obj ) void SimSet::popObject() { - if( objectList.empty() ) + if(mObjectList.empty() ) { AssertWarn(false, "Stack underflow in SimSet::popObject"); return; } lock(); - SimObject* object = objectList.last(); - objectList.pop_back(); + SimObject* object = mObjectList.last(); + mObjectList.pop_back(); clearNotify( object ); unlock(); @@ -223,7 +223,7 @@ void SimSet::popObject() void SimSet::scriptSort( const String &scriptCallbackFn ) { lock(); - objectList.scriptSort( scriptCallbackFn ); + mObjectList.scriptSort( scriptCallbackFn ); unlock(); } @@ -303,8 +303,8 @@ bool SimSet::reOrder( SimObject *obj, SimObject *target ) if ( itrS != (end()-1) ) { // remove object from its current location and push to back of list - objectList.erase(itrS); - objectList.push_back(obj); + mObjectList.erase(itrS); + mObjectList.push_back(obj); } } else @@ -314,12 +314,12 @@ bool SimSet::reOrder( SimObject *obj, SimObject *target ) // target must be in list return false; - objectList.erase(itrS); + mObjectList.erase(itrS); // once itrS has been erased, itrD won't be pointing at the // same place anymore - re-find... itrD = find(begin(),end(),target); - objectList.insert(itrD, obj); + mObjectList.insert(itrD, obj); } return true; @@ -340,15 +340,15 @@ void SimSet::onRemove() MutexHandle handle; handle.lock( mMutex ); - if( !objectList.empty() ) + if( !mObjectList.empty() ) { - objectList.sortId(); + mObjectList.sortId(); // This backwards iterator loop doesn't work if the // list is empty, check the size first. - for( SimObjectList::iterator ptr = objectList.end() - 1; - ptr >= objectList.begin(); ptr -- ) + for( SimObjectList::iterator ptr = mObjectList.end() - 1; + ptr >= mObjectList.begin(); ptr -- ) clearNotify( *ptr ); } @@ -417,8 +417,8 @@ void SimSet::deleteAllObjects() lock(); while( !empty() ) { - SimObject* object = objectList.last(); - objectList.pop_back(); + SimObject* object = mObjectList.last(); + mObjectList.pop_back(); object->deleteObject(); } @@ -536,7 +536,7 @@ SimObject* SimSet::findObjectByLineNumber(const char* fileName, S32 declarationL SimObject* SimSet::getRandom() { if (size() > 0) - return objectList[mRandI(0, size() - 1)]; + return mObjectList[mRandI(0, size() - 1)]; return NULL; } @@ -640,7 +640,7 @@ void SimGroup::_addObject( SimObject* obj, bool forcePushBack ) if( obj->getGroup() ) obj->getGroup()->removeObject( obj ); - if( forcePushBack ? objectList.pushBack( obj ) : objectList.pushBackForce( obj ) ) + if( forcePushBack ? mObjectList.pushBack( obj ) : mObjectList.pushBackForce( obj ) ) { mNameDictionary.insert( obj ); obj->mGroup = this; @@ -685,7 +685,7 @@ void SimGroup::_removeObjectNoLock( SimObject* obj ) obj->onGroupRemove(); mNameDictionary.remove( obj ); - objectList.remove( obj ); + mObjectList.remove( obj ); obj->mGroup = 0; getSetModificationSignal().trigger( SetObjectRemoved, this, obj ); @@ -709,14 +709,14 @@ void SimGroup::popObject() MutexHandle handle; handle.lock( mMutex ); - if( objectList.empty() ) + if(mObjectList.empty() ) { AssertWarn( false, "SimGroup::popObject - Stack underflow" ); return; } - SimObject* object = objectList.last(); - objectList.pop_back(); + SimObject* object = mObjectList.last(); + mObjectList.pop_back(); object->onGroupRemove(); object->mGroup = NULL; @@ -736,9 +736,9 @@ void SimGroup::popObject() void SimGroup::onRemove() { lock(); - if( !objectList.empty() ) + if( !mObjectList.empty() ) { - objectList.sortId(); + mObjectList.sortId(); clear(); } SimObject::onRemove(); @@ -752,10 +752,10 @@ void SimGroup::clear() lock(); while( size() > 0 ) { - SimObject* object = objectList.last(); + SimObject* object = mObjectList.last(); object->onGroupRemove(); - objectList.pop_back(); + mObjectList.pop_back(); mNameDictionary.remove( object ); object->mGroup = 0; diff --git a/Engine/source/console/simSet.h b/Engine/source/console/simSet.h index 9712e7945..7f49b03ed 100644 --- a/Engine/source/console/simSet.h +++ b/Engine/source/console/simSet.h @@ -114,7 +114,7 @@ class SimSet : public SimObject, public TamlChildren protected: - SimObjectList objectList; + SimObjectList mObjectList; void *mMutex; /// Signal that is triggered when objects are added or removed from the set. @@ -144,14 +144,14 @@ class SimSet : public SimObject, public TamlChildren /// typedef SimObjectList::iterator iterator; typedef SimObjectList::value_type value; - SimObject* front() { return objectList.front(); } - SimObject* first() { return objectList.first(); } - SimObject* last() { return objectList.last(); } - bool empty() const { return objectList.empty(); } - S32 size() const { return objectList.size(); } - iterator begin() { return objectList.begin(); } - iterator end() { return objectList.end(); } - value operator[] (S32 index) { return objectList[U32(index)]; } + SimObject* front() { return mObjectList.front(); } + SimObject* first() { return mObjectList.first(); } + SimObject* last() { return mObjectList.last(); } + bool empty() const { return mObjectList.empty(); } + S32 size() const { return mObjectList.size(); } + iterator begin() { return mObjectList.begin(); } + iterator end() { return mObjectList.end(); } + value operator[] (S32 index) { return mObjectList[U32(index)]; } inline iterator find( iterator first, iterator last, SimObject *obj) { return ::find(first, last, obj); } @@ -163,7 +163,7 @@ class SimSet : public SimObject, public TamlChildren virtual bool reOrder( SimObject *obj, SimObject *target=0 ); /// Return the object at the given index. - SimObject* at(S32 index) const { return objectList.at(index); } + SimObject* at(S32 index) const { return mObjectList.at(index); } /// Remove all objects from this set. virtual void clear(); @@ -263,7 +263,7 @@ class SimSet : public SimObject, public TamlChildren #ifdef TORQUE_DEBUG_GUARD inline void _setVectorAssoc( const char *file, const U32 line ) { - objectList.setFileAssociation( file, line ); + mObjectList.setFileAssociation( file, line ); } #endif @@ -324,9 +324,9 @@ void SimSet::findObjectByType( Vector &foundObjects ) // Loop through our child objects. - SimObjectList::iterator itr = objectList.begin(); + SimObjectList::iterator itr = mObjectList.begin(); - for ( ; itr != objectList.end(); itr++ ) + for ( ; itr != mObjectList.end(); itr++ ) { curObj = dynamic_cast( *itr ); curSet = dynamic_cast( *itr ); @@ -358,9 +358,9 @@ void SimSet::findObjectByCallback( bool ( *fn )( T* ), Vector &foundObjects // Loop through our child objects. - SimObjectList::iterator itr = objectList.begin(); + SimObjectList::iterator itr = mObjectList.begin(); - for ( ; itr != objectList.end(); itr++ ) + for ( ; itr != mObjectList.end(); itr++ ) { curObj = dynamic_cast( *itr ); curSet = dynamic_cast( *itr ); diff --git a/Engine/source/forest/editor/forestBrushElement.cpp b/Engine/source/forest/editor/forestBrushElement.cpp index f61834c9e..bfdedd2b8 100644 --- a/Engine/source/forest/editor/forestBrushElement.cpp +++ b/Engine/source/forest/editor/forestBrushElement.cpp @@ -172,8 +172,8 @@ SimGroup* ForestBrush::getGroup() bool ForestBrush::containsItemData( const ForestItemData *inData ) { - SimObjectList::iterator iter = objectList.begin(); - for ( ; iter != objectList.end(); iter++ ) + SimObjectList::iterator iter = mObjectList.begin(); + for ( ; iter != mObjectList.end(); iter++ ) { ForestBrushElement *pElement = dynamic_cast(*iter); diff --git a/Engine/source/scene/simPath.cpp b/Engine/source/scene/simPath.cpp index e3769df3c..2145af3cc 100644 --- a/Engine/source/scene/simPath.cpp +++ b/Engine/source/scene/simPath.cpp @@ -194,7 +194,7 @@ void Path::onRemove() /// Sort the markers objects into sequence order void Path::sortMarkers() { - dQsort(objectList.address(), objectList.size(), sizeof(SimObject*), cmpPathObject); + dQsort(mObjectList.address(), mObjectList.size(), sizeof(SimObject*), cmpPathObject); } void Path::updatePath() From 5fdad8fe3b3293bb4f6e13c698f88f35ef2815eb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 04:03:46 -0500 Subject: [PATCH 158/312] local obectName doubleup --- Engine/source/persistence/taml/json/tamlJSONReader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/persistence/taml/json/tamlJSONReader.cpp b/Engine/source/persistence/taml/json/tamlJSONReader.cpp index 7cbc114a9..cc545ca24 100644 --- a/Engine/source/persistence/taml/json/tamlJSONReader.cpp +++ b/Engine/source/persistence/taml/json/tamlJSONReader.cpp @@ -192,7 +192,7 @@ SimObject* TamlJSONReader::parseType( const rapidjson::Value::ConstMemberIterato for( rapidjson::Value::ConstMemberIterator objectMemberItr = typeValue.MemberBegin(); objectMemberItr != typeValue.MemberEnd(); ++objectMemberItr ) { // Fetch name and value. - const rapidjson::Value& objectName = objectMemberItr->name; + const rapidjson::Value& objName = objectMemberItr->name; const rapidjson::Value& objectValue = objectMemberItr->value; // Skip if not an object. @@ -200,7 +200,7 @@ SimObject* TamlJSONReader::parseType( const rapidjson::Value::ConstMemberIterato continue; // Find the period character in the name. - const char* pPeriod = dStrchr( objectName.GetString(), '.' ); + const char* pPeriod = dStrchr( objName.GetString(), '.' ); // Did we find the period? if ( pPeriod == NULL ) From fa2ee65d331fc768c9b3ff55b681b6421b7d20c8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 04:04:41 -0500 Subject: [PATCH 159/312] overgeneralised variable 'name' clarified between use-cases --- Engine/source/ts/tsDump.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/ts/tsDump.cpp b/Engine/source/ts/tsDump.cpp index 57461c04e..987b2b757 100644 --- a/Engine/source/ts/tsDump.cpp +++ b/Engine/source/ts/tsDump.cpp @@ -197,10 +197,10 @@ void TSShapeInstance::dump(Stream & stream) dumpLine("\r\n Sequences:\r\n"); for (i = 0; i < mShape->sequences.size(); i++) { - const char *name = "(none)"; + const char *seqName = "(none)"; if (mShape->sequences[i].nameIndex != -1) - name = mShape->getName(mShape->sequences[i].nameIndex); - dumpLine(avar(" %3d: %s%s%s\r\n", i, name, + seqName = mShape->getName(mShape->sequences[i].nameIndex); + dumpLine(avar(" %3d: %s%s%s\r\n", i, seqName, mShape->sequences[i].isCyclic() ? " (cyclic)" : "", mShape->sequences[i].isBlend() ? " (blend)" : "")); } @@ -212,9 +212,9 @@ void TSShapeInstance::dump(Stream & stream) for (i=0; i<(S32)ml->size(); i++) { U32 flags = ml->getFlags(i); - const String& name = ml->getMaterialName(i); + const String& matName = ml->getMaterialName(i); dumpLine(avar( - " material #%i: '%s'%s.", i, name.c_str(), + " material #%i: '%s'%s.", i, matName.c_str(), flags & (TSMaterialList::S_Wrap|TSMaterialList::T_Wrap) ? "" : " not tiled") ); if (flags & TSMaterialList::Translucent) From bca01fa976f5bc49f8aeb202ea4c64d6c9d8d6c6 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 04:37:41 -0500 Subject: [PATCH 160/312] nother set of generic 'object' varnames, all of which referenced different things --- Engine/source/gui/worldEditor/worldEditor.cpp | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index 7846ec094..da87b6bda 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -3036,25 +3036,25 @@ bool WorldEditor::alignByAxis( S32 axis ) if(mSelected->size() < 2) return true; - SceneObject* object = dynamic_cast< SceneObject* >( ( *mSelected )[ 0 ] ); - if( !object ) + SceneObject* primaryObj = dynamic_cast< SceneObject* >( ( *mSelected )[ 0 ] ); + if( !primaryObj) return false; submitUndo( mSelected, "Align By Axis" ); // All objects will be repositioned to line up with the // first selected object - Point3F pos = object->getPosition(); + Point3F pos = primaryObj->getPosition(); for(S32 i=0; isize(); ++i) { - SceneObject* object = dynamic_cast< SceneObject* >( ( *mSelected )[ i ] ); - if( !object ) + SceneObject* additionalObj = dynamic_cast< SceneObject* >( ( *mSelected )[ i ] ); + if( !additionalObj) continue; - Point3F objPos = object->getPosition(); + Point3F objPos = additionalObj->getPosition(); objPos[axis] = pos[axis]; - object->setPosition(objPos); + additionalObj->setPosition(objPos); } return true; @@ -4050,8 +4050,8 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c // Create the object. - SceneObject* object = dynamic_cast< SceneObject* >( classRep->create() ); - if( !Object ) + SceneObject* polyObj = dynamic_cast< SceneObject* >( classRep->create() ); + if( !polyObj) { Con::errorf( "WorldEditor::createPolyhedralObject - Could not create SceneObject with class '%s'", className ); return NULL; @@ -4069,7 +4069,7 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c for( U32 i = 0; i < numPoints; ++ i ) { static StringTableEntry sPoint = StringTable->insert( "point" ); - object->setDataField( sPoint, NULL, EngineMarshallData( points[ i ] ) ); + polyObj->setDataField( sPoint, NULL, EngineMarshallData( points[ i ] ) ); } // Add the plane data. @@ -4085,7 +4085,7 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c char buffer[ 1024 ]; dSprintf( buffer, sizeof( buffer ), "%g %g %g %g", plane.x, plane.y, plane.z, plane.d ); - object->setDataField( sPlane, NULL, buffer ); + polyObj->setDataField( sPlane, NULL, buffer ); } // Add the edge data. @@ -4104,24 +4104,24 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c edge.vertex[ 0 ], edge.vertex[ 1 ] ); - object->setDataField( sEdge, NULL, buffer ); + polyObj->setDataField( sEdge, NULL, buffer ); } // Set the transform. - object->setTransform( savedTransform ); - object->setScale( savedScale ); + polyObj->setTransform( savedTransform ); + polyObj->setScale( savedScale ); // Register and return the object. - if( !object->registerObject() ) + if( !polyObj->registerObject() ) { Con::errorf( "WorldEditor::createPolyhedralObject - Failed to register object!" ); - delete object; + delete polyObj; return NULL; } - return object; + return polyObj; } //----------------------------------------------------------------------------- From 8ec82013ca0d8113aab665628df14a04456a7502 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 14:30:49 -0500 Subject: [PATCH 161/312] corrects PopupMenu::checkItem() not checking the item. also prepends m to member variables for the MenuItem class to correct a few more locals hiding classvar reports. --- Engine/source/gui/editor/guiMenuBar.cpp | 14 +-- Engine/source/gui/editor/guiPopupMenuCtrl.cpp | 10 +- Engine/source/gui/editor/popupMenu.cpp | 104 +++++++++--------- Engine/source/gui/editor/popupMenu.h | 48 ++++---- 4 files changed, 91 insertions(+), 85 deletions(-) diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index dc168436b..89958fa5b 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -1369,19 +1369,19 @@ void GuiMenuBar::buildWindowAcceleratorMap(WindowInputGenerator &inputGenerator) { for (U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if (!mMenuList[i].popupMenu->mMenuItems[item].accelerator) + if (!mMenuList[i].popupMenu->mMenuItems[item].mAccelerator) { - mMenuList[i].popupMenu->mMenuItems[item].accelerator = 0; + mMenuList[i].popupMenu->mMenuItems[item].mAccelerator = 0; continue; } EventDescriptor accelEvent; - ActionMap::createEventDescriptor(mMenuList[i].popupMenu->mMenuItems[item].accelerator, &accelEvent); + ActionMap::createEventDescriptor(mMenuList[i].popupMenu->mMenuItems[item].mAccelerator, &accelEvent); //now we have a modifier, and a key, add them to the canvas - inputGenerator.addAcceleratorKey(this, mMenuList[i].popupMenu->mMenuItems[item].cmd, accelEvent.eventCode, accelEvent.flags); + inputGenerator.addAcceleratorKey(this, mMenuList[i].popupMenu->mMenuItems[item].mCMD, accelEvent.eventCode, accelEvent.flags); - mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex = mCurAcceleratorIndex; + mMenuList[i].popupMenu->mMenuItems[item].mAcceleratorIndex = mCurAcceleratorIndex; mCurAcceleratorIndex++; } } @@ -1403,7 +1403,7 @@ void GuiMenuBar::acceleratorKeyPress(U32 index) for(U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if(mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex == index) + if(mMenuList[i].popupMenu->mMenuItems[item].mAcceleratorIndex == index) { // first, call the script callback for menu selection: onMenuSelect_callback(mMenuList[i].popupMenu->getId(), mMenuList[i].text); @@ -1454,7 +1454,7 @@ void GuiMenuBar::insert(SimObject* pObject, S32 pos) newMenu.drawBitmapOnly = false; newMenu.drawBorder = true; newMenu.bitmapIndex = -1; - newMenu.text = menu->barTitle; + newMenu.text = menu->mBarTitle; newMenu.visible = true; newMenu.popupMenu = menu; diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index d03a8bec1..1d72b794c 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -100,7 +100,7 @@ GuiPopupMenuTextListCtrl::GuiPopupMenuTextListCtrl() void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver) { //check if we're a real entry, or if it's a divider - if (mPopup->mMenuItems[cell.y].isSpacer) + if (mPopup->mMenuItems[cell.y].mIsSpacer) { S32 yp = offset.y + mCellSize.y / 2; GFX->getDrawUtil()->drawLine(offset.x + 5, yp, offset.x + mCellSize.x - 5, yp, ColorI(128, 128, 128)); @@ -214,8 +214,8 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event) if (item) { - if (item->enabled) - dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->text.isNotEmpty() ? item->text : "")); + if (item->mEnabled) + dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : "")); } } @@ -247,9 +247,9 @@ void GuiPopupMenuTextListCtrl::onCellHighlighted(Point2I cell) { MenuItem *list = &mPopup->mMenuItems[selectionIndex]; - if (list->isSubmenu && list->subMenu != nullptr) + if (list->mIsSubmenu && list->mSubMenu != nullptr) { - list->subMenu->showPopup(getRoot(), getPosition().x + mCellSize.x, getPosition().y + (selectionIndex * mCellSize.y)); + list->mSubMenu->showPopup(getRoot(), getPosition().x + mCellSize.x, getPosition().y + (selectionIndex * mCellSize.y)); } } } \ No newline at end of file diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 0e5db18da..63b5241e3 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -46,14 +46,20 @@ public: //----------------------------------------------------------------------------- PopupMenu::PopupMenu() { - bitmapIndex = -1; + mMenuItems = NULL; + mMenuBarCtrl = nullptr; - barTitle = StringTable->EmptyString(); + mBarTitle = StringTable->EmptyString(); + mBounds = RectI(0, 0, 64, 64); + mVisible = true; - mMenuBarCtrl = nullptr; - mTextList = nullptr; + mBitmapIndex = -1; + mDrawBitmapOnly = false; + mDrawBorder = false; - isSubmenu = false; + mTextList = nullptr; + + mIsSubmenu = false; } PopupMenu::~PopupMenu() @@ -76,7 +82,7 @@ void PopupMenu::initPersistFields() { Parent::initPersistFields(); - addField("barTitle", TypeCaseString, Offset(barTitle, PopupMenu), ""); + addField("barTitle", TypeCaseString, Offset(mBarTitle, PopupMenu), ""); } //----------------------------------------------------------------------------- @@ -134,28 +140,28 @@ S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, c String titleString = title; MenuItem newItem; - newItem.id = pos; - newItem.text = titleString; - newItem.cmd = cmd; + newItem.mID = pos; + newItem.mText = titleString; + newItem.mCMD = cmd; if (titleString.isEmpty() || titleString == String("-")) - newItem.isSpacer = true; + newItem.mIsSpacer = true; else - newItem.isSpacer = false; + newItem.mIsSpacer = false; if (accelerator[0]) - newItem.accelerator = dStrdup(accelerator); + newItem.mAccelerator = dStrdup(accelerator); else - newItem.accelerator = NULL; + newItem.mAccelerator = NULL; - newItem.visible = true; - newItem.isChecked = false; - newItem.acceleratorIndex = 0; - newItem.enabled = !newItem.isSpacer; + newItem.mVisible = true; + newItem.mIsChecked = false; + newItem.mAcceleratorIndex = 0; + newItem.mEnabled = !newItem.mIsSpacer; - newItem.isSubmenu = false; - newItem.subMenu = nullptr; - newItem.subMenuParentMenu = nullptr; + newItem.mIsSubmenu = false; + newItem.mSubMenu = nullptr; + newItem.mSubMenuParentMenu = nullptr; mMenuItems.push_back(newItem); @@ -166,11 +172,11 @@ S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) { S32 itemPos = insertItem(pos, title, "", ""); - mMenuItems[itemPos].isSubmenu = true; - mMenuItems[itemPos].subMenu = submenu; - mMenuItems[itemPos].subMenuParentMenu = this; + mMenuItems[itemPos].mIsSubmenu = true; + mMenuItems[itemPos].mSubMenu = submenu; + mMenuItems[itemPos].mSubMenuParentMenu = this; - submenu->isSubmenu = true; + submenu->mIsSubmenu = true; return itemPos; } @@ -181,15 +187,15 @@ bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, con for (U32 i = 0; i < mMenuItems.size(); i++) { - if (mMenuItems[i].text == titleString) + if (mMenuItems[i].mText == titleString) { - mMenuItems[i].id = pos; - mMenuItems[i].cmd = cmd; + mMenuItems[i].mID = pos; + mMenuItems[i].mCMD = cmd; if (accelerator && accelerator[0]) - mMenuItems[i].accelerator = dStrdup(accelerator); + mMenuItems[i].mAccelerator = dStrdup(accelerator); else - mMenuItems[i].accelerator = NULL; + mMenuItems[i].mAccelerator = NULL; return true; } } @@ -211,7 +217,7 @@ void PopupMenu::enableItem(S32 pos, bool enable) if (mMenuItems.size() < pos || pos < 0) return; - mMenuItems[pos].enabled = enable; + mMenuItems[pos].mEnabled = enable; } void PopupMenu::checkItem(S32 pos, bool checked) @@ -219,24 +225,24 @@ void PopupMenu::checkItem(S32 pos, bool checked) if (mMenuItems.size() < pos || pos < 0) return; - if (checked && mMenuItems[pos].checkGroup != -1) + if (checked && mMenuItems[pos].mCheckGroup != -1) { // first, uncheck everything in the group: for (U32 i = 0; i < mMenuItems.size(); i++) - if (mMenuItems[i].checkGroup == mMenuItems[pos].checkGroup && mMenuItems[i].isChecked) - mMenuItems[i].isChecked = false; + if (mMenuItems[i].mCheckGroup == mMenuItems[pos].mCheckGroup && mMenuItems[i].mIsChecked) + mMenuItems[i].mIsChecked = false; } - mMenuItems[pos].isChecked; + mMenuItems[pos].mIsChecked = checked; } void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) { for (U32 i = 0; i < mMenuItems.size(); i++) { - if (mMenuItems[i].id >= firstPos && mMenuItems[i].id <= lastPos) + if (mMenuItems[i].mID >= firstPos && mMenuItems[i].mID <= lastPos) { - mMenuItems[i].isChecked = false; + mMenuItems[i].mIsChecked = false; } } } @@ -246,7 +252,7 @@ bool PopupMenu::isItemChecked(S32 pos) if (mMenuItems.size() < pos || pos < 0) return false; - return mMenuItems[pos].isChecked; + return mMenuItems[pos].mIsChecked; } U32 PopupMenu::getItemCount() @@ -305,7 +311,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) if (!backgroundCtrl || !mTextList) return; - if (!isSubmenu) + if (!mIsSubmenu) { //if we're a 'parent' menu, then tell the background to clear out all existing other popups @@ -354,11 +360,11 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) for (U32 i = 0; i < mMenuItems.size(); i++) { - if (!mMenuItems[i].visible) + if (!mMenuItems[i].mVisible) continue; - S32 iTextWidth = font->getStrWidth(mMenuItems[i].text.c_str()); - S32 iAcceleratorWidth = mMenuItems[i].accelerator ? font->getStrWidth(mMenuItems[i].accelerator) : 0; + S32 iTextWidth = font->getStrWidth(mMenuItems[i].mText.c_str()); + S32 iAcceleratorWidth = mMenuItems[i].mAccelerator ? font->getStrWidth(mMenuItems[i].mAccelerator) : 0; if (iTextWidth > textWidth) textWidth = iTextWidth; @@ -378,7 +384,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) for (U32 i = 0; i < mMenuItems.size(); i++) { - if (!mMenuItems[i].visible) + if (!mMenuItems[i].mVisible) continue; char buf[512]; @@ -386,17 +392,17 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) // If this menu item is a submenu, then set the isSubmenu to 2 to indicate // an arrow should be drawn. Otherwise set the isSubmenu normally. char isSubmenu = 1; - if (mMenuItems[i].isSubmenu) + if (mMenuItems[i].mIsSubmenu) isSubmenu = 2; char bitmapIndex = 1; - if (mMenuItems[i].bitmapIndex >= 0 && (mMenuItems[i].bitmapIndex * 3 <= profile->mBitmapArrayRects.size())) - bitmapIndex = mMenuItems[i].bitmapIndex + 2; + if (mMenuItems[i].mBitmapIndex >= 0 && (mMenuItems[i].mBitmapIndex * 3 <= profile->mBitmapArrayRects.size())) + bitmapIndex = mMenuItems[i].mBitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, mMenuItems[i].text.c_str(), mMenuItems[i].accelerator ? mMenuItems[i].accelerator : ""); + dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, mMenuItems[i].mText.c_str(), mMenuItems[i].mAccelerator ? mMenuItems[i].mAccelerator : ""); mTextList->addEntry(entryCount, buf); - if (!mMenuItems[i].enabled) + if (!mMenuItems[i].mEnabled) mTextList->setEntryActive(entryCount, false); entryCount++; @@ -437,8 +443,8 @@ void PopupMenu::hidePopupSubmenus() { for (U32 i = 0; i < mMenuItems.size(); i++) { - if (mMenuItems[i].subMenu != nullptr) - mMenuItems[i].subMenu->hidePopup(); + if (mMenuItems[i].mSubMenu != nullptr) + mMenuItems[i].mSubMenu->hidePopup(); } } diff --git a/Engine/source/gui/editor/popupMenu.h b/Engine/source/gui/editor/popupMenu.h index 9a6dd0821..66a67b1ff 100644 --- a/Engine/source/gui/editor/popupMenu.h +++ b/Engine/source/gui/editor/popupMenu.h @@ -34,27 +34,27 @@ class GuiPopupMenuBackgroundCtrl; struct MenuItem // an individual item in a pull-down menu { - String text; // the text of the menu item - U32 id; // a script-assigned identifier - char *accelerator; // the keyboard accelerator shortcut for the menu item - U32 acceleratorIndex; // index of this accelerator - bool enabled; // true if the menu item is selectable - bool visible; // true if the menu item is visible - S32 bitmapIndex; // index of the bitmap in the bitmap array - S32 checkGroup; // the group index of the item visa vi check marks - + String mText; // the text of the menu item + U32 mID; // a script-assigned identifier + char *mAccelerator; // the keyboard accelerator shortcut for the menu item + U32 mAcceleratorIndex; // index of this accelerator + bool mEnabled; // true if the menu item is selectable + bool mVisible; // true if the menu item is visible + S32 mBitmapIndex; // index of the bitmap in the bitmap array + S32 mCheckGroup; // the group index of the item visa vi check marks - // only one item in the group can be checked. - bool isSubmenu; // This menu item has a submenu that will be displayed + bool mIsSubmenu; // This menu item has a submenu that will be displayed - bool isChecked; + bool mIsChecked; - bool isSpacer; + bool mIsSpacer; - bool isMenubarEntry; + bool mIsMenubarEntry; - PopupMenu* subMenuParentMenu; // For a submenu, this is the parent menu - PopupMenu* subMenu; - String cmd; + PopupMenu* mSubMenuParentMenu; // For a submenu, this is the parent menu + PopupMenu* mSubMenu; + String mCMD; }; // PopupMenu represents a menu. @@ -72,16 +72,16 @@ protected: GuiMenuBar* mMenuBarCtrl; - StringTableEntry barTitle; + StringTableEntry mBarTitle; - RectI bounds; - bool visible; + RectI mBounds; + bool mVisible; - S32 bitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) - bool drawBitmapOnly; // Draw only the bitmap and not the text - bool drawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) + S32 mBitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) + bool mDrawBitmapOnly; // Draw only the bitmap and not the text + bool mDrawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) - bool isSubmenu; + bool mIsSubmenu; //This is the gui control that renders our popup GuiPopupMenuTextListCtrl *mTextList; @@ -175,8 +175,8 @@ public: virtual bool onMessageReceived(StringTableEntry queue, const char* event, const char* data ); virtual bool onMessageObjectReceived(StringTableEntry queue, Message *msg ); - bool isVisible() { return visible; } - void setVisible(bool isVis) { visible = isVis; } + bool isVisible() { return mVisible; } + void setVisible(bool isVis) { mVisible = isVis; } GuiMenuBar* getMenuBarCtrl(); }; From c875f44bd1d6b9a284c0b1f9ced354a5bb4f2cfe Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 16:00:10 -0500 Subject: [PATCH 162/312] clarified several variable 'r' definitions, as well as a doubleup of a sucessive S32 txt_w = mProfile->mFont->getStrWidth( buff ); pair --- Engine/source/gui/controls/guiPopUpCtrl.cpp | 62 ++++++++++----------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index af172221a..33f3c0d30 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -190,9 +190,9 @@ void GuiPopupTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selec if(drawbox) { Point2I coloredboxsize(15,10); - RectI r(offset.x + mProfile->mTextOffset.x, offset.y+2, coloredboxsize.x, coloredboxsize.y); - GFX->getDrawUtil()->drawRectFill( r, boxColor); - GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0)); + RectI boxBounds(offset.x + mProfile->mTextOffset.x, offset.y+2, coloredboxsize.x, coloredboxsize.y); + GFX->getDrawUtil()->drawRectFill(boxBounds, boxColor); + GFX->getDrawUtil()->drawRect(boxBounds, ColorI(0,0,0)); textXOffset += coloredboxsize.x + mProfile->mTextOffset.x; } @@ -854,23 +854,23 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) GFXDrawUtil* drawUtil = GFX->getDrawUtil(); - RectI r( offset, getExtent() ); + RectI baseRect( offset, getExtent() ); if ( mInAction ) { - S32 l = r.point.x, r2 = r.point.x + r.extent.x - 1; - S32 t = r.point.y, b = r.point.y + r.extent.y - 1; + S32 left = baseRect.point.x, right = baseRect.point.x + baseRect.extent.x - 1; + S32 top = baseRect.point.y, bottom = baseRect.point.y + baseRect.extent.y - 1; // Do we render a bitmap border or lines? if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // Render the fixed, filled in border - renderFixedBitmapBordersFilled(r, 3, mProfile ); + renderFixedBitmapBordersFilled(baseRect, 3, mProfile ); } else { //renderSlightlyLoweredBox(r, mProfile); - drawUtil->drawRectFill( r, mProfile->mFillColor ); + drawUtil->drawRectFill(baseRect, mProfile->mFillColor ); } // Draw a bitmap over the background? @@ -890,10 +890,10 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) ) { - drawUtil->drawLine( l, t, l, b, colorWhite ); - drawUtil->drawLine( l, t, r2, t, colorWhite ); - drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor ); - drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor ); + drawUtil->drawLine(left, top, left, bottom, colorWhite ); + drawUtil->drawLine(left, top, right, top, colorWhite ); + drawUtil->drawLine(left + 1, bottom, right, bottom, mProfile->mBorderColor ); + drawUtil->drawLine(right, top + 1, right, bottom - 1, mProfile->mBorderColor ); } } @@ -902,19 +902,19 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // TODO: Add onMouseEnter() and onMouseLeave() and a definition of mMouseOver (see guiButtonBaseCtrl) for this to work. if ( mMouseOver ) { - S32 l = r.point.x, r2 = r.point.x + r.extent.x - 1; - S32 t = r.point.y, b = r.point.y + r.extent.y - 1; + S32 left = baseRect.point.x, right = baseRect.point.x + baseRect.extent.x - 1; + S32 top = baseRect.point.y, bottom = baseRect.point.y + baseRect.extent.y - 1; // Do we render a bitmap border or lines? if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // Render the fixed, filled in border - renderFixedBitmapBordersFilled( r, 2, mProfile ); + renderFixedBitmapBordersFilled(baseRect, 2, mProfile ); } else { - drawUtil->drawRectFill( r, mProfile->mFillColorHL ); + drawUtil->drawRectFill(baseRect, mProfile->mFillColorHL ); } // Draw a bitmap over the background? @@ -928,10 +928,10 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) ) { - drawUtil->drawLine( l, t, l, b, colorWhite ); - drawUtil->drawLine( l, t, r2, t, colorWhite ); - drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor ); - drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor ); + drawUtil->drawLine(left, top, left, bottom, colorWhite); + drawUtil->drawLine(left, top, right, top, colorWhite); + drawUtil->drawLine(left + 1, bottom, right, bottom, mProfile->mBorderColor); + drawUtil->drawLine(right, top + 1, right, bottom - 1, mProfile->mBorderColor); } } else @@ -940,11 +940,11 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // Render the fixed, filled in border - renderFixedBitmapBordersFilled( r, 1, mProfile ); + renderFixedBitmapBordersFilled(baseRect, 1, mProfile ); } else { - drawUtil->drawRectFill( r, mProfile->mFillColorNA ); + drawUtil->drawRectFill(baseRect, mProfile->mFillColorNA ); } // Draw a bitmap over the background? @@ -958,7 +958,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) ) { - drawUtil->drawRect( r, mProfile->mBorderColorNA ); + drawUtil->drawRect( baseRect, mProfile->mBorderColorNA ); } } // renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above. @@ -1028,9 +1028,9 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) if ( drawbox ) { Point2I coloredboxsize( 15, 10 ); - RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); - drawUtil->drawRectFill( r, boxColor); - drawUtil->drawRect( r, ColorI(0,0,0)); + RectI boxBounds( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); + drawUtil->drawRectFill(boxBounds, boxColor); + drawUtil->drawRect(boxBounds, ColorI(0,0,0)); localStart.x += coloredboxsize.x + mProfile->mTextOffset.x; } @@ -1054,18 +1054,18 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Draw the second column to the right getColumn( mText, buff, 1, "\t" ); - S32 txt_w = mProfile->mFont->getStrWidth( buff ); + S32 colTxt_w = mProfile->mFont->getStrWidth( buff ); if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // We're making use of a bitmap border, so take into account the // right cap of the border. RectI* bitmapBounds = mProfile->mBitmapArrayRects.address(); - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - bitmapBounds[2].extent.x, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } else { - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - 12, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } @@ -1078,10 +1078,10 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) if ( !(mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size()) ) { // Draw a triangle (down arrow) - S32 left = r.point.x + r.extent.x - 12; + S32 left = baseRect.point.x + baseRect.extent.x - 12; S32 right = left + 8; S32 middle = left + 4; - S32 top = r.extent.y / 2 + r.point.y - 4; + S32 top = baseRect.extent.y / 2 + baseRect.point.y - 4; S32 bottom = top + 8; PrimBuild::color( mProfile->mFontColor ); From 015f07e50e73d5a7e9cf8d8c7e76ccb98004f859 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 17:41:22 -0500 Subject: [PATCH 163/312] cleans up extra=extra complaint --- Engine/source/afx/afxChoreographer.cpp | 4 ++-- Engine/source/afx/afxChoreographer.h | 4 ++-- Engine/source/afx/afxEffectron.cpp | 6 +++--- Engine/source/afx/afxMagicSpell.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/afx/afxChoreographer.cpp b/Engine/source/afx/afxChoreographer.cpp index 5473552f5..e0f20fa75 100644 --- a/Engine/source/afx/afxChoreographer.cpp +++ b/Engine/source/afx/afxChoreographer.cpp @@ -142,7 +142,7 @@ afxChoreographer::afxChoreographer() lod = 0; exec_conds_mask = 0; choreographer_id = 0; - extra = 0; + mExtra = 0; started_with_newop = false; postpone_activation = false; remapped_cons_sent = false; // CONSTRAINT REMAPPING @@ -179,7 +179,7 @@ afxChoreographer::~afxChoreographer() void afxChoreographer::initPersistFields() { // conditionals - addField("extra", TYPEID(), Offset(extra, afxChoreographer), + addField("extra", TYPEID(), Offset(mExtra, afxChoreographer), "..."); addField("postponeActivation", TypeBool, Offset(postpone_activation, afxChoreographer), "..."); diff --git a/Engine/source/afx/afxChoreographer.h b/Engine/source/afx/afxChoreographer.h index 3665e1306..e3b83585e 100644 --- a/Engine/source/afx/afxChoreographer.h +++ b/Engine/source/afx/afxChoreographer.h @@ -121,7 +121,7 @@ protected: U8 ranking; U8 lod; U32 exec_conds_mask; - SimObject* extra; + SimObject* mExtra; Vector explicit_clients; bool started_with_newop; bool postpone_activation; @@ -182,7 +182,7 @@ public: void clearChoreographerId() { choreographer_id = 0; } U32 getChoreographerId() { return choreographer_id; } void setGhostConstraintObject(SceneObject*, StringTableEntry cons_name); - void setExtra(SimObject* extra) { this->extra = extra; } + void setExtra(SimObject* extra) { mExtra = extra; } void addExplicitClient(NetConnection* conn); void removeExplicitClient(NetConnection* conn); U32 getExplicitClientCount() { return explicit_clients.size(); } diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp index b33fd9d99..5a1bacbf4 100644 --- a/Engine/source/afx/afxEffectron.cpp +++ b/Engine/source/afx/afxEffectron.cpp @@ -407,9 +407,9 @@ U32 afxEffectron::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) if (stream->writeFlag(mask & InitialUpdateMask)) { // pack extra object's ghost index or scope id if not yet ghosted - if (stream->writeFlag(dynamic_cast(extra) != 0)) + if (stream->writeFlag(dynamic_cast(mExtra) != 0)) { - NetObject* net_extra = (NetObject*)extra; + NetObject* net_extra = (NetObject*)mExtra; S32 ghost_idx = conn->getGhostIndex(net_extra); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); @@ -476,7 +476,7 @@ void afxEffectron::unpackUpdate(NetConnection * conn, BitStream * stream) if (stream->readFlag()) // is ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - extra = dynamic_cast(conn->resolveGhost(ghost_idx)); + mExtra = dynamic_cast(conn->resolveGhost(ghost_idx)); } else { diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 7aeb93da8..39621f8cd 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -1089,9 +1089,9 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) if (stream->writeFlag(mask & InitialUpdateMask)) { // pack extra object's ghost index or scope id if not yet ghosted - if (stream->writeFlag(dynamic_cast(extra) != 0)) + if (stream->writeFlag(dynamic_cast(mExtra) != 0)) { - NetObject* net_extra = (NetObject*)extra; + NetObject* net_extra = (NetObject*)mExtra; S32 ghost_idx = conn->getGhostIndex(net_extra); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); @@ -1252,7 +1252,7 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) if (stream->readFlag()) // is ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - extra = dynamic_cast(conn->resolveGhost(ghost_idx)); + mExtra = dynamic_cast(conn->resolveGhost(ghost_idx)); } else { From f59b92bf4e1f80e0de66cff3e07b4ee4018f7f69 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 19:10:55 -0500 Subject: [PATCH 164/312] winconsole many, many i vars. worldEditor path arguement, lockPtr doubleup. volume.cpp: uneccesary duplicated FileNode::Attributes attr; def --- Engine/source/core/volume.cpp | 1 - Engine/source/gui/worldEditor/worldEditor.cpp | 12 ++++++------ Engine/source/platformWin32/winConsole.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Engine/source/core/volume.cpp b/Engine/source/core/volume.cpp index 4c3c85b4e..3630f7ffb 100644 --- a/Engine/source/core/volume.cpp +++ b/Engine/source/core/volume.cpp @@ -808,7 +808,6 @@ bool MountSystem::isDirectory(const Path& path, FileSystemRef fsRef) if (fnRef.isNull()) return false; - FileNode::Attributes attr; if (fnRef->getAttributes(&attr)) return attr.flags & FileNode::Directory; return false; diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index da87b6bda..0a5b6f47b 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -1454,16 +1454,16 @@ void WorldEditor::renderSplinePath(SimPath::Path *path) } - CameraSpline::Knot::Path path; + CameraSpline::Knot::Path tPath; switch (pathmarker->mSmoothingType) { - case Marker::SmoothingTypeLinear: path = CameraSpline::Knot::LINEAR; break; + case Marker::SmoothingTypeLinear: tPath = CameraSpline::Knot::LINEAR; break; case Marker::SmoothingTypeSpline: - default: path = CameraSpline::Knot::SPLINE; break; + default: tPath = CameraSpline::Knot::SPLINE; break; } - spline.push_back(new CameraSpline::Knot(pos, rot, 1.0f, type, path)); + spline.push_back(new CameraSpline::Knot(pos, rot, 1.0f, type, tPath)); } F32 t = 0.0f; @@ -1559,8 +1559,8 @@ void WorldEditor::renderSplinePath(SimPath::Path *path) // Reset for next pass... vIdx = 0; - void *lockPtr = vb.lock(); - if(!lockPtr) return; + void *nextlockPtr = vb.lock(); + if(!nextlockPtr) return; } } diff --git a/Engine/source/platformWin32/winConsole.cpp b/Engine/source/platformWin32/winConsole.cpp index cc92c2c15..93ce3c68e 100644 --- a/Engine/source/platformWin32/winConsole.cpp +++ b/Engine/source/platformWin32/winConsole.cpp @@ -176,12 +176,12 @@ void WinConsole::process() S32 outpos = 0; ReadConsoleInput(stdIn, rec, 20, &numEvents); - DWORD i; - for(i = 0; i < numEvents; i++) + DWORD evt; + for(evt = 0; evt < numEvents; evt++) { - if(rec[i].EventType == KEY_EVENT) + if(rec[evt].EventType == KEY_EVENT) { - KEY_EVENT_RECORD *ke = &(rec[i].Event.KeyEvent); + KEY_EVENT_RECORD *ke = &(rec[evt].Event.KeyEvent); if(ke->bKeyDown) { switch (ke->uChar.AsciiChar) From 76602509e36de8549ddf90209a5ddd88f53c8dea Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 23:07:34 -0500 Subject: [PATCH 165/312] delta to mDelta to resolve another class var vs method var confusionpoint --- Engine/source/T3D/item.cpp | 68 ++++++++++++++--------------- Engine/source/T3D/item.h | 2 +- Engine/source/T3D/proximityMine.cpp | 4 +- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index e6d21b93a..d8f8cad1e 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -320,8 +320,8 @@ Item::Item() mAtRest = true; mAtRestCounter = 0; mInLiquid = false; - delta.warpTicks = 0; - delta.dt = 1; + mDelta.warpTicks = 0; + mDelta.dt = 1; mCollisionObject = 0; mCollisionTimeout = 0; mPhysicsRep = NULL; @@ -350,7 +350,7 @@ bool Item::onAdd() if (mStatic) mAtRest = true; - mObjToWorld.getColumn(3,&delta.pos); + mObjToWorld.getColumn(3,&mDelta.pos); // Setup the box for our convex object... mObjBox.getCenter(&mConvex.mCenter); @@ -564,21 +564,21 @@ void Item::processTick(const Move* move) mCollisionObject = 0; // Warp to catch up to server - if (delta.warpTicks > 0) + if (mDelta.warpTicks > 0) { - delta.warpTicks--; + mDelta.warpTicks--; // Set new pos. MatrixF mat = mObjToWorld; - mat.getColumn(3,&delta.pos); - delta.pos += delta.warpOffset; - mat.setColumn(3,delta.pos); + mat.getColumn(3,&mDelta.pos); + mDelta.pos += mDelta.warpOffset; + mat.setColumn(3, mDelta.pos); Parent::setTransform(mat); // Backstepping - delta.posVec.x = -delta.warpOffset.x; - delta.posVec.y = -delta.warpOffset.y; - delta.posVec.z = -delta.warpOffset.z; + mDelta.posVec.x = -mDelta.warpOffset.x; + mDelta.posVec.y = -mDelta.warpOffset.y; + mDelta.posVec.z = -mDelta.warpOffset.z; } else { @@ -601,7 +601,7 @@ void Item::processTick(const Move* move) else { // Need to clear out last updatePos or warp interpolation - delta.posVec.set(0,0,0); + mDelta.posVec.set(0,0,0); } } } @@ -613,11 +613,11 @@ void Item::interpolateTick(F32 dt) return; // Client side interpolation - Point3F pos = delta.pos + delta.posVec * dt; + Point3F pos = mDelta.pos + mDelta.posVec * dt; MatrixF mat = mRenderObjToWorld; mat.setColumn(3,pos); setRenderTransform(mat); - delta.dt = dt; + mDelta.dt = dt; } @@ -733,7 +733,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt) // Try and move Point3F pos; mObjToWorld.getColumn(3,&pos); - delta.posVec = pos; + mDelta.posVec = pos; bool contact = false; bool nonStatic = false; @@ -959,9 +959,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt) // If on the client, calculate delta for backstepping if (isGhost()) { - delta.pos = pos; - delta.posVec -= pos; - delta.dt = 1; + mDelta.pos = pos; + mDelta.posVec -= pos; + mDelta.dt = 1; } // Update transform @@ -1131,40 +1131,40 @@ void Item::unpackUpdate(NetConnection *connection, BitStream *stream) if (stream->readFlag() && isProperlyAdded()) { // Determin number of ticks to warp based on the average // of the client and server velocities. - delta.warpOffset = pos - delta.pos; + mDelta.warpOffset = pos - mDelta.pos; F32 as = (speed + mVelocity.len()) * 0.5f * TickSec; - F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks; - delta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f); + F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks; + mDelta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f); - if (delta.warpTicks) + if (mDelta.warpTicks) { // Setup the warp to start on the next tick, only the // object's position is warped. - if (delta.warpTicks > sMaxWarpTicks) - delta.warpTicks = sMaxWarpTicks; - delta.warpOffset /= (F32)delta.warpTicks; + if (mDelta.warpTicks > sMaxWarpTicks) + mDelta.warpTicks = sMaxWarpTicks; + mDelta.warpOffset /= (F32)mDelta.warpTicks; } else { // Going to skip the warp, server and client are real close. // Adjust the frame interpolation to move smoothly to the // new position within the current tick. - Point3F cp = delta.pos + delta.posVec * delta.dt; - VectorF vec = delta.pos - cp; + Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; + VectorF vec = mDelta.pos - cp; F32 vl = vec.len(); if (vl) { - F32 s = delta.posVec.len() / vl; - delta.posVec = (cp - pos) * s; + F32 s = mDelta.posVec.len() / vl; + mDelta.posVec = (cp - pos) * s; } - delta.pos = pos; + mDelta.pos = pos; mat.setColumn(3,pos); } } else { // Set the item to the server position - delta.warpTicks = 0; - delta.posVec.set(0,0,0); - delta.pos = pos; - delta.dt = 0; + mDelta.warpTicks = 0; + mDelta.posVec.set(0,0,0); + mDelta.pos = pos; + mDelta.dt = 0; mat.setColumn(3,pos); } } diff --git a/Engine/source/T3D/item.h b/Engine/source/T3D/item.h index 68720952b..be79e7f9d 100644 --- a/Engine/source/T3D/item.h +++ b/Engine/source/T3D/item.h @@ -88,7 +88,7 @@ class Item: public ShapeBase Point3F warpOffset; F32 dt; }; - StateDelta delta; + StateDelta mDelta; // Static attributes ItemData* mDataBlock; diff --git a/Engine/source/T3D/proximityMine.cpp b/Engine/source/T3D/proximityMine.cpp index bf43ab8c9..2102ef7e1 100644 --- a/Engine/source/T3D/proximityMine.cpp +++ b/Engine/source/T3D/proximityMine.cpp @@ -386,8 +386,8 @@ void ProximityMine::setDeployedPos( const Point3F& pos, const Point3F& normal ) MathUtils::getMatrixFromUpVector( normal, &mat ); mat.setPosition( pos + normal * mObjBox.minExtents.z ); - delta.pos = pos; - delta.posVec.set(0, 0, 0); + mDelta.pos = pos; + mDelta.posVec.set(0, 0, 0); ShapeBase::setTransform( mat ); if ( mPhysicsRep ) From a5ab4acd01ff27627a69a06084e6176fc989e90b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 23:09:20 -0500 Subject: [PATCH 166/312] pos to mSeqPos to resolve a method entry vs class entry --- Engine/source/ts/tsShapeInstance.h | 2 +- Engine/source/ts/tsThread.cpp | 62 +++++++++++++++--------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index c483c8792..c29f0eac2 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -727,7 +727,7 @@ class TSThread TSShapeInstance * mShapeInstance; ///< Instance of the shape that this thread animates S32 sequence; ///< Sequence this thread will perform - F32 pos; + F32 mSeqPos; F32 timeScale; ///< How fast to play through the sequence diff --git a/Engine/source/ts/tsThread.cpp b/Engine/source/ts/tsThread.cpp index 656310bec..4cb1088d9 100644 --- a/Engine/source/ts/tsThread.cpp +++ b/Engine/source/ts/tsThread.cpp @@ -170,17 +170,17 @@ void TSThread::setSequence(S32 seq, F32 toPos) sequence = seq; priority = getSequence()->priority; - pos = toPos; + mSeqPos = toPos; makePath = getSequence()->makePath(); path.start = path.end = 0; path.loop = 0; // 1.0f doesn't exist on cyclic sequences - if (pos>0.9999f && getSequence()->isCyclic()) - pos = 0.9999f; + if (mSeqPos>0.9999f && getSequence()->isCyclic()) + mSeqPos = 0.9999f; // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mSeqPos,getSequence(),&keyNum1,&keyNum2,&keyPos); } void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool continuePlay) @@ -207,7 +207,7 @@ void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool conti // set time characteristics of transition transitionData.oldSequence = sequence; - transitionData.oldPos = pos; + transitionData.oldPos = mSeqPos; transitionData.duration = duration; transitionData.pos = 0.0f; transitionData.direction = timeScale>0.0f ? 1.0f : -1.0f; @@ -219,17 +219,17 @@ void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool conti // set target sequence data sequence = seq; priority = getSequence()->priority; - pos = toPos; + mSeqPos = toPos; makePath = getSequence()->makePath(); path.start = path.end = 0; path.loop = 0; // 1.0f doesn't exist on cyclic sequences - if (pos>0.9999f && getSequence()->isCyclic()) - pos = 0.9999f; + if (mSeqPos>0.9999f && getSequence()->isCyclic()) + mSeqPos = 0.9999f; // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mSeqPos,getSequence(),&keyNum1,&keyNum2,&keyPos); } bool TSThread::isInTransition() @@ -322,12 +322,12 @@ void TSThread::activateTriggers(F32 a, F32 b) F32 TSThread::getPos() { - return transitionData.inTransition ? transitionData.pos : pos; + return transitionData.inTransition ? transitionData.pos : mSeqPos; } F32 TSThread::getTime() { - return transitionData.inTransition ? transitionData.pos * transitionData.duration : pos * getSequence()->duration; + return transitionData.inTransition ? transitionData.pos * transitionData.duration : mSeqPos * getSequence()->duration; } F32 TSThread::getDuration() @@ -378,48 +378,48 @@ void TSThread::advancePos(F32 delta) if (makePath) { - path.start = pos; - pos += delta; + path.start = mSeqPos; + mSeqPos += delta; if (!getSequence()->isCyclic()) { - pos = mClampF(pos , 0.0f, 1.0f); + mSeqPos = mClampF(mSeqPos, 0.0f, 1.0f); path.loop = 0; } else { - path.loop = (S32)pos; - if (pos < 0.0f) + path.loop = (S32)mSeqPos; + if (mSeqPos < 0.0f) path.loop--; - pos -= path.loop; + mSeqPos -= path.loop; // following necessary because of floating point roundoff errors - if (pos < 0.0f) pos += 1.0f; - if (pos >= 1.0f) pos -= 1.0f; + if (mSeqPos < 0.0f) mSeqPos += 1.0f; + if (mSeqPos >= 1.0f) mSeqPos -= 1.0f; } - path.end = pos; + path.end = mSeqPos; animateTriggers(); // do this automatically...no need for user to call it - AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (1)"); - AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (2)"); + AssertFatal(mSeqPos >=0.0f && mSeqPos <=1.0f,"TSThread::advancePos (1)"); + AssertFatal(!getSequence()->isCyclic() || mSeqPos<1.0f,"TSThread::advancePos (2)"); } else { - pos += delta; + mSeqPos += delta; if (!getSequence()->isCyclic()) - pos = mClampF(pos, 0.0f, 1.0f); + mSeqPos = mClampF(mSeqPos, 0.0f, 1.0f); else { - pos -= S32(pos); + mSeqPos -= S32(mSeqPos); // following necessary because of floating point roundoff errors - if (pos < 0.0f) pos += 1.0f; - if (pos >= 1.0f) pos -= 1.0f; + if (mSeqPos < 0.0f) mSeqPos += 1.0f; + if (mSeqPos >= 1.0f) mSeqPos -= 1.0f; } - AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (3)"); - AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (4)"); + AssertFatal(mSeqPos >=0.0f && mSeqPos <=1.0f,"TSThread::advancePos (3)"); + AssertFatal(!getSequence()->isCyclic() || mSeqPos<1.0f,"TSThread::advancePos (4)"); } // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mSeqPos,getSequence(),&keyNum1,&keyNum2,&keyPos); } void TSThread::advanceTime(F32 delta) @@ -459,7 +459,7 @@ void TSThread::setKeyframeNumber(S32 kf) keyNum1 = keyNum2 = kf; keyPos = 0; - pos = 0; + mSeqPos = 0; } TSThread::TSThread(TSShapeInstance * _shapeInst) From 2b6b1acdd6933d706d16edabe0d627764c7f0b78 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 00:57:31 -0500 Subject: [PATCH 167/312] many *many* generic is and js --- Engine/source/ts/tsShape.cpp | 30 ++++++++++++++--------------- Engine/source/ts/tsShapeOldRead.cpp | 28 +++++++++++++-------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 8b0146567..52a77cf9f 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -566,8 +566,8 @@ void TSShape::initObjects() if (accel != NULL) { delete[] accel->vertexList; delete[] accel->normalList; - for (S32 j = 0; j < accel->numVerts; j++) - delete[] accel->emitStrings[j]; + for (S32 vertID = 0; vertID < accel->numVerts; vertID++) + delete[] accel->emitStrings[vertID]; delete[] accel->emitStrings; delete accel; } @@ -683,9 +683,9 @@ void TSShape::initVertexBuffers() U32 vertsInBuffer = mShapeVertexData.size / mVertexSize; U32 indsInBuffer = ibIndices - indicesStart; - for (U32 i = 0; i < primStart; i++) + for (U32 primID = 0; primID < primStart; primID++) { - GFXPrimitive &prim = mShapeVertexIndices->mPrimitiveArray[i]; + GFXPrimitive &prim = mShapeVertexIndices->mPrimitiveArray[primID]; if (prim.type != GFXTriangleList && prim.type != GFXTriangleStrip) { @@ -1303,10 +1303,10 @@ void TSShape::assembleShape() S32 oldSz = groundTranslations.size(); groundTranslations.setSize(oldSz+seq.numGroundFrames); groundRotations.setSize(oldSz+seq.numGroundFrames); - for (S32 j=0;j 10000 ) || - ( details[i].maxError == 0 ) || ( details[i].maxError > 10000 ) ) + if ( ( details[erID].averageError == 0 ) || ( details[erID].averageError > 10000 ) || + ( details[erID].maxError == 0 ) || ( details[erID].maxError > 10000 ) ) { - details[i].averageError = details[i].maxError = -1.0f; + details[erID].averageError = details[erID].maxError = -1.0f; } } @@ -1740,8 +1740,8 @@ void TSShape::disassembleShape() { // Legacy details => no explicit autobillboard parameters U32 legacyDetailSize32 = 7; // only store the first 7 4-byte values of each detail - for ( S32 i = 0; i < details.size(); i++ ) - tsalloc.copyToBuffer32( (S32*)&details[i], legacyDetailSize32 ); + for ( S32 bbID = 0; bbID < details.size(); bbID++ ) + tsalloc.copyToBuffer32( (S32*)&details[bbID], legacyDetailSize32 ); } tsalloc.setGuard(); diff --git a/Engine/source/ts/tsShapeOldRead.cpp b/Engine/source/ts/tsShapeOldRead.cpp index d20175a2e..9b06aff75 100644 --- a/Engine/source/ts/tsShapeOldRead.cpp +++ b/Engine/source/ts/tsShapeOldRead.cpp @@ -647,27 +647,27 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) nodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes); // remap node transforms from temporary arrays - for (S32 j = 0; j < nodeMap.size(); j++) + for (S32 nodeID = 0; nodeID < nodeMap.size(); nodeID++) { - if (nodeMap[j] < 0) + if (nodeMap[nodeID] < 0) continue; - if (newTransMembership.test(nodeMap[j])) + if (newTransMembership.test(nodeMap[nodeID])) { - S32 src = seq.numKeyframes * seq.translationMatters.count(j); - S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[j]); + S32 src = seq.numKeyframes * seq.translationMatters.count(nodeID); + S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[nodeID]); dCopyArray(&nodeTranslations[dest], &seqTranslations[src], seq.numKeyframes); } - if (newRotMembership.test(nodeMap[j])) + if (newRotMembership.test(nodeMap[nodeID])) { - S32 src = seq.numKeyframes * seq.rotationMatters.count(j); - S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[j]); + S32 src = seq.numKeyframes * seq.rotationMatters.count(nodeID); + S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[nodeID]); dCopyArray(&nodeRotations[dest], &seqRotations[src], seq.numKeyframes); } - if (newScaleMembership.test(nodeMap[j])) + if (newScaleMembership.test(nodeMap[nodeID])) { - S32 src = seq.numKeyframes * seq.scaleMatters.count(j); - S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[j]); + S32 src = seq.numKeyframes * seq.scaleMatters.count(nodeID); + S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[nodeID]); if (seq.flags & TSShape::ArbitraryScale) { dCopyArray(&nodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes); @@ -713,10 +713,10 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) S32 oldSz = triggers.size(); s->read(&sz); triggers.setSize(oldSz+sz); - for (S32 i=0; iread(&triggers[i+oldSz].state); - s->read(&triggers[i+oldSz].pos); + s->read(&triggers[triggerID +oldSz].state); + s->read(&triggers[triggerID +oldSz].pos); } if (smInitOnRead) From 654fc29dc2a652648f4f354f32567355e9011216 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 01:05:15 -0500 Subject: [PATCH 168/312] bounds to mBounds conflict avoidance --- .../T3D/components/render/meshComponent.cpp | 4 ++-- Engine/source/T3D/debris.cpp | 2 +- .../source/T3D/examples/renderShapeExample.cpp | 2 +- Engine/source/T3D/fx/explosion.cpp | 2 +- Engine/source/T3D/fx/groundCover.cpp | 2 +- Engine/source/T3D/physics/physicsDebris.cpp | 2 +- Engine/source/T3D/physics/physicsShape.cpp | 6 +++--- Engine/source/T3D/projectile.cpp | 2 +- Engine/source/T3D/shapeBase.cpp | 14 +++++++------- Engine/source/T3D/tsStatic.cpp | 2 +- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 2 +- Engine/source/afx/afxMagicMissile.cpp | 2 +- Engine/source/afx/ce/afxModel.cpp | 2 +- Engine/source/environment/VolumetricFog.cpp | 4 ++-- Engine/source/forest/ts/tsForestItemData.h | 2 +- Engine/source/gui/editor/guiShapeEdPreview.cpp | 10 +++++----- Engine/source/lighting/common/blobShadow.cpp | 2 +- Engine/source/ts/loader/tsShapeLoader.cpp | 10 +++++----- Engine/source/ts/tsCollision.cpp | 2 +- Engine/source/ts/tsShape.cpp | 8 ++++---- Engine/source/ts/tsShape.h | 2 +- Engine/source/ts/tsShapeConstruct.cpp | 16 ++++++++-------- 22 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index c87733bf8..ad7ce0a5c 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -254,8 +254,8 @@ void MeshComponent::updateShape() mOwner->getWorldToObj().mulP(pos); - min = mMeshAsset->getShape()->bounds.minExtents; - max = mMeshAsset->getShape()->bounds.maxExtents; + min = mMeshAsset->getShape()->mBounds.minExtents; + max = mMeshAsset->getShape()->mBounds.maxExtents; if (mInterfaceData) { diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 57d9a0577..23f18890b 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -669,7 +669,7 @@ bool Debris::onAdd() // Setup our bounding box if( mDataBlock->shape ) { - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; } else { diff --git a/Engine/source/T3D/examples/renderShapeExample.cpp b/Engine/source/T3D/examples/renderShapeExample.cpp index 0e60c3801..5f0847b90 100644 --- a/Engine/source/T3D/examples/renderShapeExample.cpp +++ b/Engine/source/T3D/examples/renderShapeExample.cpp @@ -213,7 +213,7 @@ void RenderShapeExample::createShape() } // Update the bounding box - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; resetWorldBox(); setRenderTransform(mObjToWorld); diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index 0236da6e9..4da7b2902 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -1384,7 +1384,7 @@ bool Explosion::explode() mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f); mObjScale.convolve(mDataBlock->explosionScale); - mObjBox = mDataBlock->explosionShape->bounds; + mObjBox = mDataBlock->explosionShape->mBounds; resetWorldBox(); } diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 63b5e3a2f..6e859e554 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1142,7 +1142,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index, const F32 typeMaxElevation = mMaxElevation[type]; const F32 typeMinElevation = mMinElevation[type]; const bool typeIsShape = mShapeInstances[ type ] != NULL; - const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->bounds : Box3F(); + const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F(); const F32 typeWindScale = mWindScale[type]; StringTableEntry typeLayer = mLayer[type]; const bool typeInvertLayer = mInvertLayer[type]; diff --git a/Engine/source/T3D/physics/physicsDebris.cpp b/Engine/source/T3D/physics/physicsDebris.cpp index a2e2026b3..44d421c86 100644 --- a/Engine/source/T3D/physics/physicsDebris.cpp +++ b/Engine/source/T3D/physics/physicsDebris.cpp @@ -358,7 +358,7 @@ bool PhysicsDebris::onAdd() } // Setup our bounding box - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; resetWorldBox(); // Add it to the client scene. diff --git a/Engine/source/T3D/physics/physicsShape.cpp b/Engine/source/T3D/physics/physicsShape.cpp index 574707003..d4e0a3313 100644 --- a/Engine/source/T3D/physics/physicsShape.cpp +++ b/Engine/source/T3D/physics/physicsShape.cpp @@ -308,10 +308,10 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer ) { //no collision so we create a simple box collision shape from the shapes bounds and alert the user Con::warnf( "PhysicsShapeData::preload - No collision found for shape '%s', auto-creating one", shapeName ); - Point3F halfWidth = shape->bounds.getExtents() * 0.5f; + Point3F halfWidth = shape->mBounds.getExtents() * 0.5f; colShape = PHYSICSMGR->createCollision(); MatrixF centerXfm(true); - centerXfm.setPosition(shape->bounds.getCenter()); + centerXfm.setPosition(shape->mBounds.getCenter()); colShape->addBox(halfWidth, centerXfm); return true; } @@ -707,7 +707,7 @@ bool PhysicsShape::_createShape() return false; // Set the world box. - mObjBox = db->shape->bounds; + mObjBox = db->shape->mBounds; resetWorldBox(); // If this is the server and its a client only simulation diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index 7e77385a2..e457f6b2d 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -828,7 +828,7 @@ bool Projectile::onAdd() // Setup our bounding box if (bool(mDataBlock->projectileShape) == true) - mObjBox = mDataBlock->projectileShape->bounds; + mObjBox = mDataBlock->projectileShape->mBounds; else mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 643a5955d..923714a5d 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -405,17 +405,17 @@ bool ShapeBaseData::preload(bool server, String &errorStr) mShape->computeBounds(collisionDetails.last(), collisionBounds.last()); mShape->getAccelerator(collisionDetails.last()); - if (!mShape->bounds.isContained(collisionBounds.last())) + if (!mShape->mBounds.isContained(collisionBounds.last())) { if (!silent_bbox_check) Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last()); - collisionBounds.last() = mShape->bounds; + collisionBounds.last() = mShape->mBounds; } else if (collisionBounds.last().isValidBox() == false) { if (!silent_bbox_check) Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last()); - collisionBounds.last() = mShape->bounds; + collisionBounds.last() = mShape->mBounds; } // The way LOS works is that it will check to see if there is a LOS detail that matches @@ -482,7 +482,7 @@ bool ShapeBaseData::preload(bool server, String &errorStr) damageSequence = mShape->findSequence("Damage"); // - F32 w = mShape->bounds.len_y() / 2; + F32 w = mShape->mBounds.len_y() / 2; if (cameraMaxDist < w) cameraMaxDist = w; // just parse up the string and collect the remappings in txr_tag_remappings. @@ -707,7 +707,7 @@ DefineEngineMethod( ShapeBaseData, checkDeployPos, bool, ( TransformF txfm ),, MatrixF mat = txfm.getMatrix(); - Box3F objBox = object->mShape->bounds; + Box3F objBox = object->mShape->mBounds; Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f; objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f; objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f; @@ -1275,7 +1275,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) } } - mObjBox = mDataBlock->mShape->bounds; + mObjBox = mDataBlock->mShape->mBounds; resetWorldBox(); // Set the initial mesh hidden state. @@ -2801,7 +2801,7 @@ void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *stat MatrixF mat; getRenderImageTransform( ri->objectIndex, &mat ); - const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->bounds; + const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->mBounds; drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat ); } diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 13964e632..97ae395df 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -373,7 +373,7 @@ bool TSStatic::_createShape() NetConnection::filesWereDownloaded() ) return false; - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; resetWorldBox(); mShapeInstance = new TSShapeInstance( mShape, isClientObject() ); diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 17cfdfe6a..05524867a 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -111,7 +111,7 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr) // Determinw wheel radius from the shape's bounding box. // The tire should be built with it's hub axis along the // object's Y axis. - radius = shape->bounds.len_z() / 2; + radius = shape->mBounds.len_z() / 2; } return true; diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 36ecd1777..1cae8526c 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -1116,7 +1116,7 @@ bool afxMagicMissile::onAdd() // Setup our bounding box if (bool(mDataBlock->projectileShape) == true) - mObjBox = mDataBlock->projectileShape->bounds; + mObjBox = mDataBlock->projectileShape->mBounds; else mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); resetWorldBox(); diff --git a/Engine/source/afx/ce/afxModel.cpp b/Engine/source/afx/ce/afxModel.cpp index 688cd08ad..6962aea51 100644 --- a/Engine/source/afx/ce/afxModel.cpp +++ b/Engine/source/afx/ce/afxModel.cpp @@ -397,7 +397,7 @@ bool afxModel::onAdd() // setup our bounding box if (mDataBlock->shape) - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; else mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 9235611d1..c000f535b 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -347,7 +347,7 @@ bool VolumetricFog::LoadShape() return false; } - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; mRadius = mShape->radius; resetWorldBox(); @@ -560,7 +560,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream) mShape = ResourceManager::get().load(mShapeName); if (bool(mShape) == false) return retMask; - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; mRadius = mShape->radius; resetWorldBox(); mObjSize = mWorldBox.getGreatestDiagonalLength(); diff --git a/Engine/source/forest/ts/tsForestItemData.h b/Engine/source/forest/ts/tsForestItemData.h index 46252361b..089da98d5 100644 --- a/Engine/source/forest/ts/tsForestItemData.h +++ b/Engine/source/forest/ts/tsForestItemData.h @@ -88,7 +88,7 @@ public: const Vector& getLOSDetails() const { return mLOSDetails; } // ForestItemData - const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Zero; } + const Box3F& getObjBox() const { return mShape ? mShape->mBounds : Box3F::Zero; } bool render( TSRenderState *rdata, const ForestItem& item ) const; ForestCellBatch* allocateBatch() const; bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const; diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index f04ef371a..e373a246b 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -853,7 +853,7 @@ void GuiShapeEdPreview::exportToCollada( const String& path ) if ( mModel ) { MatrixF orientation( true ); - orientation.setPosition( mModel->getShape()->bounds.getCenter() ); + orientation.setPosition( mModel->getShape()->mBounds.getCenter() ); orientation.inverse(); OptimizedPolyList polyList; @@ -1138,8 +1138,8 @@ bool GuiShapeEdPreview::getCameraTransform(MatrixF* cameraMatrix) cameraMatrix->identity(); if ( mModel ) { - Point3F camPos = mModel->getShape()->bounds.getCenter(); - F32 offset = mModel->getShape()->bounds.len(); + Point3F camPos = mModel->getShape()->mBounds.getCenter(); + F32 offset = mModel->getShape()->mBounds.len(); switch (mDisplayType) { @@ -1442,7 +1442,7 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect) // Render the shape bounding box if ( mRenderBounds ) { - Point3F boxSize = mModel->getShape()->bounds.maxExtents - mModel->getShape()->bounds.minExtents; + Point3F boxSize = mModel->getShape()->mBounds.maxExtents - mModel->getShape()->mBounds.minExtents; GFXStateBlockDesc desc; desc.fillMode = GFXFillWireframe; @@ -1544,7 +1544,7 @@ void GuiShapeEdPreview::renderSunDirection() const { // Render four arrows aiming in the direction of the sun's light ColorI color = LinearColorF( mFakeSun->getColor()).toColorI(); - F32 length = mModel->getShape()->bounds.len() * 0.8f; + F32 length = mModel->getShape()->mBounds.len() * 0.8f; // Get the sun's vectors Point3F fwd = mFakeSun->getTransform().getForwardVector(); diff --git a/Engine/source/lighting/common/blobShadow.cpp b/Engine/source/lighting/common/blobShadow.cpp index a564ff654..3db211762 100644 --- a/Engine/source/lighting/common/blobShadow.cpp +++ b/Engine/source/lighting/common/blobShadow.cpp @@ -182,7 +182,7 @@ void BlobShadow::setRadius(F32 radius) void BlobShadow::setRadius(TSShapeInstance * shapeInstance, const Point3F & scale) { - const Box3F & bounds = shapeInstance->getShape()->bounds; + const Box3F & bounds = shapeInstance->getShape()->mBounds; F32 dx = 0.5f * (bounds.maxExtents.x-bounds.minExtents.x) * scale.x; F32 dy = 0.5f * (bounds.maxExtents.y-bounds.minExtents.y) * scale.y; F32 dz = 0.5f * (bounds.maxExtents.z-bounds.minExtents.z) * scale.z; diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 61c183d27..94f5e4fbf 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1220,12 +1220,12 @@ void TSShapeLoader::install() } } - computeBounds(shape->bounds); - if (!shape->bounds.isValidBox()) - shape->bounds = Box3F(1.0f); + computeBounds(shape->mBounds); + if (!shape->mBounds.isValidBox()) + shape->mBounds = Box3F(1.0f); - shape->bounds.getCenter(&shape->center); - shape->radius = (shape->bounds.maxExtents - shape->center).len(); + shape->mBounds.getCenter(&shape->center); + shape->radius = (shape->mBounds.maxExtents - shape->center).len(); shape->tubeRadius = shape->radius; shape->init(); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 1d04b409e..f5c2d77b4 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -414,7 +414,7 @@ void TSShapeInstance::computeBounds(S32 dl, Box3F & bounds) // use shape bounds for imposter details if (ss < 0) { - bounds = mShape->bounds; + bounds = mShape->mBounds; return; } diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 52a77cf9f..649e4e6ba 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -1198,7 +1198,7 @@ void TSShape::assembleShape() tsalloc.get32((S32*)&radius,1); tsalloc.get32((S32*)&tubeRadius,1); tsalloc.get32((S32*)¢er,3); - tsalloc.get32((S32*)&bounds,6); + tsalloc.get32((S32*)&mBounds,6); tsalloc.checkGuard(); @@ -1673,7 +1673,7 @@ void TSShape::disassembleShape() tsalloc.copyToBuffer32((S32*)&radius,1); tsalloc.copyToBuffer32((S32*)&tubeRadius,1); tsalloc.copyToBuffer32((S32*)¢er,3); - tsalloc.copyToBuffer32((S32*)&bounds,6); + tsalloc.copyToBuffer32((S32*)&mBounds,6); tsalloc.setGuard(); @@ -2063,8 +2063,8 @@ void TSShape::createEmptyShape() radius = 0.866025f; tubeRadius = 0.707107f; center.set(0.0f, 0.5f, 0.0f); - bounds.minExtents.set(-0.5f, 0.0f, -0.5f); - bounds.maxExtents.set(0.5f, 1.0f, 0.5f); + mBounds.minExtents.set(-0.5f, 0.0f, -0.5f); + mBounds.maxExtents.set(0.5f, 1.0f, 0.5f); mExporterVersion = 124; mSmallestVisibleSize = 2; diff --git a/Engine/source/ts/tsShape.h b/Engine/source/ts/tsShape.h index e72dd8617..d6196c986 100644 --- a/Engine/source/ts/tsShape.h +++ b/Engine/source/ts/tsShape.h @@ -357,7 +357,7 @@ class TSShape F32 radius; F32 tubeRadius; Point3F center; - Box3F bounds; + Box3F mBounds; /// @} diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index dd2a67644..612b5dcf7 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1445,7 +1445,7 @@ DefineTSShapeConstructorMethod( getBounds, Box3F, (),, "Get the bounding box for the shape.\n" "@return Bounding box \"minX minY minZ maxX maxY maxZ\"" ) { - return mShape->bounds; + return mShape->mBounds; }} DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, @@ -1457,9 +1457,9 @@ DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, // Set shape bounds TSShape* shape = mShape; - shape->bounds = bbox; - shape->bounds.getCenter( &shape->center ); - shape->radius = ( shape->bounds.maxExtents - shape->center ).len(); + shape->mBounds = bbox; + shape->mBounds.getCenter( &shape->center ); + shape->radius = ( shape->mBounds.maxExtents - shape->center ).len(); shape->tubeRadius = shape->radius; ADD_TO_CHANGE_SET(); @@ -2200,12 +2200,12 @@ void TSShapeConstructor::ChangeSet::write(TSShape* shape, Stream& stream, const for (U32 j = 1; j < cmd.argc; j++) { // Use relative paths when possible - String str( cmd.argv[j] ); - if ( str.startsWith( savePath ) ) - str = str.substr( savePath.length() + 1 ); + String relStr( cmd.argv[j] ); + if (relStr.startsWith( savePath ) ) + relStr = relStr.substr( savePath.length() + 1 ); stream.writeText( ", \"" ); - stream.write( str.length(), str.c_str() ); + stream.write(relStr.length(), relStr.c_str() ); stream.writeText( "\"" ); } } From 4fc6ce7b8bd12c14a5ce8eaa648e80cf1a6fa259 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 02:11:57 -0500 Subject: [PATCH 169/312] buf clarification. mModifLightRays logic cleanup --- Engine/source/environment/VolumetricFog.cpp | 25 +++++++++------------ 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index c000f535b..d32f13d6c 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -620,25 +620,20 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream) stream->read(&mLightRayMod); if (isTicking()) { - char buf[20]; - dSprintf(buf, sizeof(buf), "%3.7f", mGlowStrength); - Con::setVariable("$VolFogGlowPostFx::glowStrength", buf); + char glowStrBuf[20]; + dSprintf(glowStrBuf, sizeof(glowStrBuf), "%3.7f", mGlowStrength); + Con::setVariable("$VolFogGlowPostFx::glowStrength", glowStrBuf); if (mUseGlow && !glowFX->isEnabled()) glowFX->enable(); if (!mUseGlow && glowFX->isEnabled()) glowFX->disable(); - if (mModifLightRays) - { - char buf[20]; - dSprintf(buf, sizeof(buf), "%3.7f", mOldLightRayStrength * mLightRayMod); - Con::setVariable("$LightRayPostFX::brightScalar", buf); - } - if (!mModifLightRays) - { - char buf[20]; - dSprintf(buf, sizeof(buf), "%3.7f", mOldLightRayStrength); - Con::setVariable("$LightRayPostFX::brightScalar", buf); - } + + F32 rayStrength = mOldLightRayStrength; + if (mModifLightRays) + rayStrength *= mLightRayMod; + char rayStrBuf[20]; + dSprintf(rayStrBuf, sizeof(rayStrBuf), "%3.7f", rayStrength); + Con::setVariable("$LightRayPostFX::brightScalar", rayStrBuf); } } if (stream->readFlag())//Volumetric Fog From af0922e1758d516e1b2ad8f0660002f112ad6f75 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 02:12:59 -0500 Subject: [PATCH 170/312] remove inside a remove after a remove... yeah.... No. --- Engine/source/core/tSparseArray.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/core/tSparseArray.h b/Engine/source/core/tSparseArray.h index 5a15b1f81..4f3800447 100644 --- a/Engine/source/core/tSparseArray.h +++ b/Engine/source/core/tSparseArray.h @@ -113,14 +113,14 @@ inline void SparseArray::insert(T* pObject, U32 key) template inline T* SparseArray::remove(U32 key) { - U32 remove = key % mModulus; - Node* probe = &mSentryTables[remove]; + U32 sentryID = key % mModulus; + Node* probe = &mSentryTables[sentryID]; while (probe->next != NULL) { if (probe->next->key == key) { - Node* remove = probe->next; - T* pReturn = remove->pObject; - probe->next = remove->next; - delete remove; + Node* nextProbe = probe->next; + T* pReturn = nextProbe->pObject; + probe->next = nextProbe->next; + delete nextProbe; return pReturn; } probe = probe->next; From e2d27952aabefd149246977e57e93d20ff44daf5 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 11:36:36 -0500 Subject: [PATCH 171/312] tsmesh: parentMesh and indicies to mParentMesh and mIndicies (usual deal, complaints about method vars or temp ones potentially conflicting with class vars) --- Engine/source/environment/VolumetricFog.cpp | 8 +- Engine/source/ts/loader/appMesh.cpp | 2 +- Engine/source/ts/tsCollision.cpp | 18 +-- Engine/source/ts/tsMesh.cpp | 158 ++++++++++---------- Engine/source/ts/tsMesh.h | 4 +- Engine/source/ts/tsMeshFit.cpp | 26 ++-- Engine/source/ts/tsShape.cpp | 16 +- Engine/source/ts/tsShapeEdit.cpp | 18 +-- 8 files changed, 125 insertions(+), 125 deletions(-) diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index d32f13d6c..067dd0c5d 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -421,8 +421,8 @@ bool VolumetricFog::LoadShape() det_size[i].indices = new Vector(); - for (U32 k = 0; k < mesh->indices.size(); k++) - det_size[i].indices->push_back(mesh->indices[k]); + for (U32 k = 0; k < mesh->mIndices.size(); k++) + det_size[i].indices->push_back(mesh->mIndices[k]); U32 primitivesSize = mesh->primitives.size(); for (U32 k = 0; k < primitivesSize; k++) @@ -436,7 +436,7 @@ bool VolumetricFog::LoadShape() pInfo.numPrimitives = draw.numElements / 3; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex); break; @@ -445,7 +445,7 @@ bool VolumetricFog::LoadShape() pInfo.numPrimitives = draw.numElements - 2; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex); break; diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index c06a5909e..aff73df67 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -151,7 +151,7 @@ TSMesh* AppMesh::constructTSMesh() tsmesh->norms = normals; tsmesh->tverts = uvs; tsmesh->primitives = primitives; - tsmesh->indices = indices; + tsmesh->mIndices = indices; tsmesh->colors = colors; tsmesh->tverts2 = uv2s; diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index f5c2d77b4..fc2d22ec1 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1377,16 +1377,16 @@ void TSMesh::prepOpcodeCollision() else { // Have to walk the tristrip to get a count... may have degenerates - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -1421,9 +1421,9 @@ void TSMesh::prepOpcodeCollision() { for ( S32 j = 0; j < draw.numElements; ) { - curIts->mVRef[2] = base + indices[start + j + 0]; - curIts->mVRef[1] = base + indices[start + j + 1]; - curIts->mVRef[0] = base + indices[start + j + 2]; + curIts->mVRef[2] = base + mIndices[start + j + 0]; + curIts->mVRef[1] = base + mIndices[start + j + 1]; + curIts->mVRef[0] = base + mIndices[start + j + 2]; curIts->mMatIdx = matIndex; curIts++; @@ -1434,16 +1434,16 @@ void TSMesh::prepOpcodeCollision() { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index b52a50b96..528d7f56c 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -386,9 +386,9 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { for ( S32 j = 0; j < draw.numElements; ) { - U32 idx0 = base + indices[start + j + 0]; - U32 idx1 = base + indices[start + j + 1]; - U32 idx2 = base + indices[start + j + 2]; + U32 idx0 = base + mIndices[start + j + 0]; + U32 idx1 = base + mIndices[start + j + 1]; + U32 idx2 = base + mIndices[start + j + 2]; polyList->begin(material,surfaceKey++); polyList->vertex( idx0 ); polyList->vertex( idx1 ); @@ -402,16 +402,16 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -452,24 +452,24 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { for ( S32 j = 0; j < draw.numElements; j += 3 ) { - PlaneF plane( cf->mVertexList[base + indices[start + j + 0]], - cf->mVertexList[base + indices[start + j + 1]], - cf->mVertexList[base + indices[start + j + 2]]); + PlaneF plane( cf->mVertexList[base + mIndices[start + j + 0]], + cf->mVertexList[base + mIndices[start + j + 1]], + cf->mVertexList[base + mIndices[start + j + 2]]); cf->mFaceList.increment(); ConvexFeature::Face& lastFace = cf->mFaceList.last(); lastFace.normal = plane; - lastFace.vertex[0] = base + indices[start + j + 0]; - lastFace.vertex[1] = base + indices[start + j + 1]; - lastFace.vertex[2] = base + indices[start + j + 2]; + lastFace.vertex[0] = base + mIndices[start + j + 0]; + lastFace.vertex[1] = base + mIndices[start + j + 1]; + lastFace.vertex[2] = base + mIndices[start + j + 2]; for ( U32 l = 0; l < 3; l++ ) { U32 newEdge0, newEdge1; - U32 zero = base + indices[start + j + l]; - U32 one = base + indices[start + j + ((l+1)%3)]; + U32 zero = base + mIndices[start + j + l]; + U32 one = base + mIndices[start + j + ((l+1)%3)]; newEdge0 = getMin( zero, one ); newEdge1 = getMax( zero, one ); bool found = false; @@ -496,15 +496,15 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -802,9 +802,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { for ( S32 j = 0; j < draw.numElements-2; j += 3 ) { - idx0 = indices[drawStart + j + 0]; - idx1 = indices[drawStart + j + 1]; - idx2 = indices[drawStart + j + 2]; + idx0 = mIndices[drawStart + j + 0]; + idx1 = mIndices[drawStart + j + 1]; + idx2 = mIndices[drawStart + j + 2]; F32 cur_t = 0; Point2F b; @@ -828,15 +828,15 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::castRayRendered (2)" ); - idx0 = indices[drawStart + 0]; - idx2 = indices[drawStart + 1]; + idx0 = mIndices[drawStart + 0]; + idx2 = mIndices[drawStart + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = indices[drawStart + j]; + idx2 = mIndices[drawStart + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -964,25 +964,25 @@ bool TSMesh::buildConvexHull() if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { for ( j = 0; j < draw.numElements; j += 3 ) - if ( addToHull( indices[start + j + 0] + firstVert, - indices[start + j + 1] + firstVert, - indices[start + j + 2] + firstVert ) && frame == 0 ) + if ( addToHull( mIndices[start + j + 0] + firstVert, + mIndices[start + j + 1] + firstVert, + mIndices[start + j + 2] + firstVert ) && frame == 0 ) planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } else { AssertFatal( (draw.matIndex&TSDrawPrimitive::Strip) == TSDrawPrimitive::Strip,"TSMesh::buildConvexHull (2)" ); - U32 idx0 = indices[start + 0] + firstVert; + U32 idx0 = mIndices[start + 0] + firstVert; U32 idx1; - U32 idx2 = indices[start + 1] + firstVert; + U32 idx2 = mIndices[start + 1] + firstVert; U32 * nextIdx = &idx1; for ( j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1 ); - idx2 = indices[start + j] + firstVert; + idx2 = mIndices[start + j] + firstVert; if ( addToHull( idx0, idx1, idx2 ) && frame == 0 ) planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } @@ -1149,9 +1149,9 @@ S32 TSMesh::getNumPolys() const j < primitives[i].start+primitives[i].numElements-2; j++ ) { - if ((indices[j] != indices[j+1]) && - (indices[j] != indices[j+2]) && - (indices[j+1] != indices[j+2])) + if ((mIndices[j] != mIndices[j+1]) && + (mIndices[j] != mIndices[j+2]) && + (mIndices[j+1] != mIndices[j+2])) count++; } break; @@ -1167,7 +1167,7 @@ TSMesh::TSMesh() : meshType( StandardMeshType ) VECTOR_SET_ASSOCIATION( planeNormals ); VECTOR_SET_ASSOCIATION( planeConstants ); VECTOR_SET_ASSOCIATION( planeMaterials ); - parentMesh = -1; + mParentMesh = -1; mOptTree = NULL; mOpMeshInterface = NULL; @@ -2382,7 +2382,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr pInfo.numPrimitives = draw.numElements / 3; pInfo.startIndex = startIndex + draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = (indices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this + pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); pInfo.startVertex += startVertex; @@ -2393,7 +2393,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr pInfo.numPrimitives = draw.numElements - 2; pInfo.startIndex = startIndex + draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = (indices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this + pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); pInfo.startVertex += startVertex; @@ -2406,7 +2406,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr *piArray++ = pInfo; } - dCopyArray(ibIndices, indices.address(), indices.size()); + dCopyArray(ibIndices, mIndices.address(), mIndices.size()); } void TSMesh::assemble( bool skip ) @@ -2415,7 +2415,7 @@ void TSMesh::assemble( bool skip ) numFrames = tsalloc.get32(); numMatFrames = tsalloc.get32(); - parentMesh = tsalloc.get32(); + mParentMesh = tsalloc.get32(); tsalloc.get32( (S32*)&mBounds, 6 ); tsalloc.get32( (S32*)&mCenter, 3 ); mRadius = (F32)tsalloc.get32(); @@ -2435,21 +2435,21 @@ void TSMesh::assemble( bool skip ) } S32 numVerts = tsalloc.get32(); - S32 *ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); + S32 *ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); verts.set( (Point3F*)ptr32, numVerts ); S32 numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); tverts.set( (Point2F*)ptr32, numTVerts ); if ( TSShape::smReadVersion > 25 ) { numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); tverts2.set( (Point2F*)ptr32, numTVerts ); S32 numVColors = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, numVColors, (S32**)smColorsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, numVColors, (S32**)smColorsList.address(), skip ); colors.set( (ColorI*)ptr32, numVColors ); } @@ -2457,27 +2457,27 @@ void TSMesh::assemble( bool skip ) if ( TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals) { // we have encoded normals and we want to use them... - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // adva nce past norms, don't use norms.set( NULL, 0 ); - ptr8 = getSharedData8( parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); + ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); encodedNorms.set( ptr8, numVerts ); } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); norms.set( (Point3F*)ptr32, numVerts ); - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use encodedNorms.set( NULL, 0 ); } else { // no encoded normals... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); norms.set( (Point3F*)ptr32, numVerts ); encodedNorms.set( NULL, 0 ); } @@ -2554,7 +2554,7 @@ void TSMesh::assemble( bool skip ) // store output primitives.set(primOut, szPrimOut); - indices.set(indOut, szIndOut); + mIndices.set(indOut, szIndOut); // delete temporary arrays if necessary if (deleteInputArrays) @@ -2596,7 +2596,7 @@ void TSMesh::disassemble() tsalloc.set32( numFrames ); tsalloc.set32( numMatFrames ); - tsalloc.set32( parentMesh ); + tsalloc.set32(mParentMesh); tsalloc.copyToBuffer32( (S32*)&mBounds, 6 ); tsalloc.copyToBuffer32( (S32*)&mCenter, 3 ); tsalloc.set32( (S32)mRadius ); @@ -2637,33 +2637,33 @@ void TSMesh::disassemble() { // verts... tsalloc.set32(verts.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); // if no parent mesh, then save off our verts // tverts... tsalloc.set32(tverts.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)tverts.address(), 2 * tverts.size()); // if no parent mesh, then save off our tverts if (TSShape::smVersion > 25) { // tverts2... tsalloc.set32(tverts2.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)tverts2.address(), 2 * tverts2.size()); // if no parent mesh, then save off our tverts // colors tsalloc.set32(colors.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)colors.address(), colors.size()); // if no parent mesh, then save off our tverts } // norms... - if (parentMesh < 0) // if no parent mesh, then save off our norms + if (mParentMesh < 0) // if no parent mesh, then save off our norms tsalloc.copyToBuffer32((S32*)norms.address(), 3 * norms.size()); // norms.size()==verts.size() or error... // encoded norms... - if (parentMesh < 0) + if (mParentMesh < 0) { // if no parent mesh, compute encoded normals and copy over for (S32 i = 0; i < norms.size(); i++) @@ -2676,7 +2676,7 @@ void TSMesh::disassemble() // optimize triangle draw order during disassemble { - FrameTemp tmpIdxs(indices.size()); + FrameTemp tmpIdxs(mIndices.size()); for ( S32 i = 0; i < primitives.size(); i++ ) { const TSDrawPrimitive& prim = primitives[i]; @@ -2685,8 +2685,8 @@ void TSMesh::disassemble() if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements, - indices.address() + prim.start, tmpIdxs.address()); - dCopyArray(indices.address() + prim.start, tmpIdxs.address(), + mIndices.address() + prim.start, tmpIdxs.address()); + dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(), prim.numElements); } } @@ -2699,8 +2699,8 @@ void TSMesh::disassemble() tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size()); // indices... - tsalloc.set32(indices.size()); - tsalloc.copyToBuffer32((S32*)indices.address(),indices.size()); + tsalloc.set32(mIndices.size()); + tsalloc.copyToBuffer32((S32*)mIndices.address(),mIndices.size()); } else { @@ -2717,10 +2717,10 @@ void TSMesh::disassemble() } // indices - tsalloc.set32(indices.size()); - Vector s16_indices(indices.size()); - for (S32 i=0; i s16_indices(mIndices.size()); + for (S32 i=0; i 21 && TSMesh::smUseEncodedNormals) { // we have encoded normals and we want to use them... - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.getPointer32(numVerts * 3); // advance past norms, don't use batchData.initialNorms.set(NULL, 0); - ptr8 = getSharedData8(parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip); + ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip); encodedNorms.set(ptr8, numVerts); // Note: we don't set the encoded normals flag because we handle them in updateSkin and // hide the fact that we are using them from base class (TSMesh) @@ -2779,10 +2779,10 @@ void TSSkinMesh::assemble( bool skip ) else if (TSShape::smReadVersion > 21) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32(parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); batchData.initialNorms.set((Point3F*)ptr32, numVerts); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.getPointer8(numVerts); // advance past encoded normls, don't use encodedNorms.set(NULL, 0); @@ -2790,7 +2790,7 @@ void TSSkinMesh::assemble( bool skip ) else { // no encoded normals... - ptr32 = getSharedData32(parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); batchData.initialNorms.set((Point3F*)ptr32, numVerts); encodedNorms.set(NULL, 0); } @@ -2815,21 +2815,21 @@ void TSSkinMesh::assemble( bool skip ) } sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); batchData.initialTransforms.set( ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smVertexIndexList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smVertexIndexList.address(), skip ); vertexIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smBoneIndexList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smBoneIndexList.address(), skip ); boneIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smWeightList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smWeightList.address(), skip ); weight.set( (F32*)ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smNodeIndexList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smNodeIndexList.address(), skip ); batchData.nodeIndex.set( ptr32, sz ); tsalloc.checkGuard(); @@ -2883,7 +2883,7 @@ void TSSkinMesh::disassemble() { tsalloc.set32(batchData.initialVerts.size()); // if we have no parent mesh, then save off our verts & norms - if (parentMesh < 0) + if (mParentMesh < 0) { tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); @@ -2900,7 +2900,7 @@ void TSSkinMesh::disassemble() } tsalloc.set32( batchData.initialTransforms.size() ); - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.initialTransforms.address(), batchData.initialTransforms.size() * 16 ); if (!mVertexData.isReady()) @@ -2920,7 +2920,7 @@ void TSSkinMesh::disassemble() if (TSShape::smVersion < 27) { - if (parentMesh < 0) + if (mParentMesh < 0) { tsalloc.copyToBuffer32((S32*)vertexIndex.address(), vertexIndex.size()); @@ -2931,7 +2931,7 @@ void TSSkinMesh::disassemble() } tsalloc.set32( batchData.nodeIndex.size() ); - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.nodeIndex.address(), batchData.nodeIndex.size() ); tsalloc.setGuard(); @@ -3035,7 +3035,7 @@ void TSMesh::createTangents(const Vector &_verts, const Vector U32 p1Index = 0; U32 p2Index = 0; - U32 *baseIdx = &indices[draw.start]; + U32 *baseIdx = &mIndices[draw.start]; const U32 numElements = (U32)draw.numElements; diff --git a/Engine/source/ts/tsMesh.h b/Engine/source/ts/tsMesh.h index ab0a602fd..bc9793b27 100644 --- a/Engine/source/ts/tsMesh.h +++ b/Engine/source/ts/tsMesh.h @@ -268,7 +268,7 @@ protected: public: - S32 parentMesh; ///< index into shapes mesh list + S32 mParentMesh; ///< index into shapes mesh list S32 numFrames; S32 numMatFrames; S32 vertsPerFrame; @@ -333,7 +333,7 @@ protected: Vector primitives; Vector encodedNorms; - Vector indices; + Vector mIndices; /// billboard data Point3F billboardAxis; diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index 7ea2049c9..25b56ff32 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -251,19 +251,19 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) const TSDrawPrimitive& draw = mesh->primitives[i]; if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { - mIndices.merge( &mesh->indices[draw.start], draw.numElements ); + mIndices.merge( &mesh->mIndices[draw.start], draw.numElements ); } else { - U32 idx0 = mesh->indices[draw.start + 0]; + U32 idx0 = mesh->mIndices[draw.start + 0]; U32 idx1; - U32 idx2 = mesh->indices[draw.start + 1]; + U32 idx2 = mesh->mIndices[draw.start + 1]; U32 *nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = mesh->indices[draw.start + j]; + idx2 = mesh->mIndices[draw.start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -329,12 +329,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT mesh->setFlags(0); mesh->mNumVerts = numVerts; - mesh->indices.reserve( numTris * 3 ); + mesh->mIndices.reserve( numTris * 3 ); for ( S32 i = 0; i < numTris; i++ ) { - mesh->indices.push_back( indices[i*3 + 0] ); - mesh->indices.push_back( indices[i*3 + 2] ); - mesh->indices.push_back( indices[i*3 + 1] ); + mesh->mIndices.push_back( indices[i*3 + 0] ); + mesh->mIndices.push_back( indices[i*3 + 2] ); + mesh->mIndices.push_back( indices[i*3 + 1] ); } mesh->verts.set( verts, numVerts ); @@ -345,12 +345,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT mesh->norms[iNorm] = Point3F::Zero; // Sum triangle normals for each vertex - for (S32 iInd = 0; iInd < mesh->indices.size(); iInd += 3) + for (S32 iInd = 0; iInd < mesh->mIndices.size(); iInd += 3) { // Compute the normal for this triangle - S32 idx0 = mesh->indices[iInd + 0]; - S32 idx1 = mesh->indices[iInd + 1]; - S32 idx2 = mesh->indices[iInd + 2]; + S32 idx0 = mesh->mIndices[iInd + 0]; + S32 idx1 = mesh->mIndices[iInd + 1]; + S32 idx2 = mesh->mIndices[iInd + 2]; const Point3F& v0 = mesh->verts[idx0]; const Point3F& v1 = mesh->verts[idx1]; @@ -377,7 +377,7 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT // Add a single triangle-list primitive mesh->primitives.increment(); mesh->primitives.last().start = 0; - mesh->primitives.last().numElements = mesh->indices.size(); + mesh->primitives.last().numElements = mesh->mIndices.size(); mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed | TSDrawPrimitive::NoMaterial; diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 649e4e6ba..c5bc3000b 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -585,14 +585,14 @@ void TSShape::initObjects() if (!mesh) continue; - if (mesh->parentMesh >= meshes.size()) + if (mesh->mParentMesh >= meshes.size()) { - Con::warnf("Mesh %i has a bad parentMeshObject (%i)", iter - meshes.begin(), mesh->parentMesh); + Con::warnf("Mesh %i has a bad parentMeshObject (%i)", iter - meshes.begin(), mesh->mParentMesh); } - if (mesh->parentMesh >= 0 && mesh->parentMesh < meshes.size()) + if (mesh->mParentMesh >= 0 && mesh->mParentMesh < meshes.size()) { - mesh->parentMeshObject = meshes[mesh->parentMesh]; + mesh->parentMeshObject = meshes[mesh->mParentMesh]; } else { @@ -622,7 +622,7 @@ void TSShape::initVertexBuffers() mesh->getMeshType() != TSMesh::SkinMeshType)) continue; - destIndices += mesh->indices.size(); + destIndices += mesh->mIndices.size(); destPrims += mesh->primitives.size(); } @@ -661,14 +661,14 @@ void TSShape::initVertexBuffers() vertStart += mesh->mNumVerts; primStart += mesh->primitives.size(); - indStart += mesh->indices.size(); + indStart += mesh->mIndices.size(); mesh->mVB = mShapeVertexBuffer; mesh->mPB = mShapeVertexIndices; // Advance piInput += mesh->primitives.size(); - ibIndices += mesh->indices.size(); + ibIndices += mesh->mIndices.size(); if (TSSkinMesh::smDebugSkinVerts && mesh->getMeshType() == TSMesh::SkinMeshType) { @@ -845,7 +845,7 @@ void TSShape::initVertexFeatures() mesh->mVertOffset = destVertex; destVertex += mesh->mVertSize * mesh->getNumVerts(); - destIndices += mesh->indices.size(); + destIndices += mesh->mIndices.size(); count += 1; } diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index 94379de4d..c0c540a66 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -756,13 +756,13 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex) if (meshes[k] == NULL) continue; - if (meshes[k]->parentMesh == idxToRemove) + if (meshes[k]->mParentMesh == idxToRemove) { - meshes[k]->parentMesh = -1; + meshes[k]->mParentMesh = -1; } - else if (meshes[k]->parentMesh > idxToRemove) + else if (meshes[k]->mParentMesh > idxToRemove) { - meshes[k]->parentMesh--; + meshes[k]->mParentMesh--; } } @@ -800,13 +800,13 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex) if (meshes[k] == NULL) continue; - if (meshes[k]->parentMesh == idxToRemove) + if (meshes[k]->mParentMesh == idxToRemove) { - meshes[k]->parentMesh = -1; + meshes[k]->mParentMesh = -1; } - else if (meshes[k]->parentMesh > idxToRemove) + else if (meshes[k]->mParentMesh > idxToRemove) { - meshes[k]->parentMesh--; + meshes[k]->mParentMesh--; } } @@ -937,7 +937,7 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const return mesh; // return an empty mesh // Copy mesh elements - mesh->indices = srcMesh->indices; + mesh->mIndices = srcMesh->mIndices; mesh->primitives = srcMesh->primitives; mesh->numFrames = srcMesh->numFrames; mesh->numMatFrames = srcMesh->numMatFrames; From 4915db0a323c99f1c409430d56a629fc776fc7f7 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 12:16:17 -0500 Subject: [PATCH 172/312] clarified the texture-atlas varnames a bit. (shadow vars cleanup) --- Engine/source/ts/tsLastDetail.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Engine/source/ts/tsLastDetail.cpp b/Engine/source/ts/tsLastDetail.cpp index 863e79f3f..842b28a0e 100644 --- a/Engine/source/ts/tsLastDetail.cpp +++ b/Engine/source/ts/tsLastDetail.cpp @@ -420,24 +420,24 @@ void TSLastDetail::_update() imposterCap->end(); - Point2I texSize( destBmp.getWidth(mip), destBmp.getHeight(mip) ); + Point2I atlasSize( destBmp.getWidth(mip), destBmp.getHeight(mip) ); // Ok... pack in bitmaps till we run out. - for ( S32 y=0; y+currDim <= texSize.y; ) + for ( S32 y=0; y+currDim <= atlasSize.y; ) { - for ( S32 x=0; x+currDim <= texSize.x; ) + for ( S32 x=0; x+currDim <= atlasSize.x; ) { // Copy the next bitmap to the dest texture. - GBitmap* bmp = bitmaps.first(); + GBitmap* cell = bitmaps.first(); bitmaps.pop_front(); - destBmp.copyRect( bmp, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); - delete bmp; + destBmp.copyRect(cell, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); + delete cell; // Copy the next normal to the dest texture. - GBitmap* normalmap = normalmaps.first(); + GBitmap* cellNormalmap = normalmaps.first(); normalmaps.pop_front(); - destNormal.copyRect( normalmap, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); - delete normalmap; + destNormal.copyRect(cellNormalmap, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); + delete cellNormalmap; // Did we finish? if ( bitmaps.empty() ) From 064dfbc4f4dd48d1dd8fe53c9dc0d1c43c1d3f2d Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 14:22:51 -0500 Subject: [PATCH 173/312] tsignal::order to ::mOrder. yet another potential conflict with a class member vs a method input --- Engine/source/core/util/tSignal.cpp | 6 +++--- Engine/source/core/util/tSignal.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/core/util/tSignal.cpp b/Engine/source/core/util/tSignal.cpp index 30980a715..d323bec0c 100644 --- a/Engine/source/core/util/tSignal.cpp +++ b/Engine/source/core/util/tSignal.cpp @@ -28,9 +28,9 @@ void SignalBase::DelegateLink::insert(DelegateLink* node, F32 order) { // Note: can only legitimately be called on list head DelegateLink * walk = next; - while (order >= walk->order && walk->next != this) + while (order >= walk->mOrder && walk->next != this) walk = walk->next; - if (order >= walk->order) + if (order >= walk->mOrder) { // insert after walk node->prev = walk; @@ -46,7 +46,7 @@ void SignalBase::DelegateLink::insert(DelegateLink* node, F32 order) walk->prev->next = node; walk->prev = node; } - node->order = order; + node->mOrder = order; } void SignalBase::DelegateLink::unlink() diff --git a/Engine/source/core/util/tSignal.h b/Engine/source/core/util/tSignal.h index 4960ba8dd..f5531e217 100644 --- a/Engine/source/core/util/tSignal.h +++ b/Engine/source/core/util/tSignal.h @@ -53,7 +53,7 @@ public: SignalBase() { mList.next = mList.prev = &mList; - mList.order = 0.5f; + mList.mOrder = 0.5f; } ~SignalBase(); @@ -72,7 +72,7 @@ protected: struct DelegateLink { DelegateLink *next,*prev; - F32 order; + F32 mOrder; void insert(DelegateLink* node, F32 order); void unlink(); @@ -191,7 +191,7 @@ public: for ( DelegateLink *ptr = base.mList.next; ptr != &base.mList; ptr = ptr->next ) { DelegateLinkImpl *del = static_cast( ptr ); - notify( del->mDelegate, del->order ); + notify( del->mDelegate, del->mOrder ); } } From e5a6f4ee3da18b09f4a05f690b0a9b367292aae3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 14:26:17 -0500 Subject: [PATCH 174/312] TSMesh::castRayOpcode method var clarifications/match for .h file --- Engine/source/ts/tsCollision.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index fc2d22ec1..8fafbed9e 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1499,14 +1499,14 @@ static Point3F texGenAxis[18] = }; -bool TSMesh::castRayOpcode( const Point3F &s, const Point3F &e, RayInfo *info, TSMaterialList *materials ) +bool TSMesh::castRayOpcode( const Point3F &start, const Point3F &end, RayInfo *info, TSMaterialList *materials ) { Opcode::RayCollider ray; Opcode::CollisionFaces cfs; - IceMaths::Point dir( e.x - s.x, e.y - s.y, e.z - s.z ); + IceMaths::Point dir(end.x - start.x, end.y - start.y, end.z - start.z ); const F32 rayLen = dir.Magnitude(); - IceMaths::Ray vec( Point(s.x, s.y, s.z), dir.Normalize() ); + IceMaths::Ray vec( Point(start.x, start.y, start.z), dir.Normalize() ); ray.SetDestination( &cfs); ray.SetFirstContact( false ); From c98f257cae1db5a9d4e1045c743c39685104a9f3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 14:53:23 -0500 Subject: [PATCH 175/312] more compiler compliant cleanups plus a full set of tsMesh::foo to tsmesh::mFoo class var conversions for consistency --- Engine/source/environment/VolumetricFog.cpp | 4 +- .../source/gui/editor/guiShapeEdPreview.cpp | 6 +- Engine/source/ts/loader/appMesh.cpp | 16 +- Engine/source/ts/loader/tsShapeLoader.cpp | 2 +- Engine/source/ts/tsCollision.cpp | 12 +- Engine/source/ts/tsMesh.cpp | 354 +++++++++--------- Engine/source/ts/tsMesh.h | 44 +-- Engine/source/ts/tsMeshFit.cpp | 68 ++-- Engine/source/ts/tsShape.cpp | 48 +-- Engine/source/ts/tsShapeConstruct.cpp | 8 +- Engine/source/ts/tsShapeEdit.cpp | 16 +- Engine/source/ts/tsSortedMesh.cpp | 6 +- Engine/source/ts/tsSortedMesh.h | 2 +- 13 files changed, 293 insertions(+), 293 deletions(-) diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 067dd0c5d..ba655ffa9 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -424,10 +424,10 @@ bool VolumetricFog::LoadShape() for (U32 k = 0; k < mesh->mIndices.size(); k++) det_size[i].indices->push_back(mesh->mIndices[k]); - U32 primitivesSize = mesh->primitives.size(); + U32 primitivesSize = mesh->mPrimitives.size(); for (U32 k = 0; k < primitivesSize; k++) { - const TSDrawPrimitive & draw = mesh->primitives[k]; + const TSDrawPrimitive & draw = mesh->mPrimitives[k]; GFXPrimitiveType drawType = GFXdrawTypes[draw.matIndex >> 30]; switch (drawType) { diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index e373a246b..300b6e95e 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -1244,9 +1244,9 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) continue; // Count the number of draw calls and materials - mNumDrawCalls += mesh->primitives.size(); - for ( S32 iPrim = 0; iPrim < mesh->primitives.size(); iPrim++ ) - usedMaterials.push_back_unique( mesh->primitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); + mNumDrawCalls += mesh->mPrimitives.size(); + for ( S32 iPrim = 0; iPrim < mesh->mPrimitives.size(); iPrim++ ) + usedMaterials.push_back_unique( mesh->mPrimitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); // For skinned meshes, count the number of bones and weights if ( mesh->getMeshType() == TSMesh::SkinMeshType ) diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index aff73df67..bd5c291e0 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -147,13 +147,13 @@ TSMesh* AppMesh::constructTSMesh() } // Copy mesh elements - tsmesh->verts = points; - tsmesh->norms = normals; - tsmesh->tverts = uvs; - tsmesh->primitives = primitives; + tsmesh->mVerts = points; + tsmesh->mNorms = normals; + tsmesh->mTverts = uvs; + tsmesh->mPrimitives = primitives; tsmesh->mIndices = indices; - tsmesh->colors = colors; - tsmesh->tverts2 = uv2s; + tsmesh->mColors = colors; + tsmesh->mTverts2 = uv2s; // Finish initializing the shape tsmesh->setFlags(flags); @@ -162,8 +162,8 @@ TSMesh* AppMesh::constructTSMesh() tsmesh->numFrames = numFrames; tsmesh->numMatFrames = numMatFrames; tsmesh->vertsPerFrame = vertsPerFrame; - tsmesh->createTangents(tsmesh->verts, tsmesh->norms); - tsmesh->encodedNorms.set(NULL,0); + tsmesh->createTangents(tsmesh->mVerts, tsmesh->mNorms); + tsmesh->mEncodedNorms.set(NULL,0); return tsmesh; } diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 94f5e4fbf..5fa76d0fc 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1172,7 +1172,7 @@ void TSShapeLoader::install() { TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; - if (mesh && !mesh->primitives.size()) + if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 8fafbed9e..7dc10271b 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1364,9 +1364,9 @@ void TSMesh::prepOpcodeCollision() // Figure out how many triangles we have... U32 triCount = 0; const U32 base = 0; - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1396,7 +1396,7 @@ void TSMesh::prepOpcodeCollision() } // Just do the first trilist for now. - mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : verts.size() ); + mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : mVerts.size() ); mi->SetNbTriangles( triCount ); // Stuff everything into appropriate arrays. @@ -1407,9 +1407,9 @@ void TSMesh::prepOpcodeCollision() mOpPoints = pts; // add the polys... - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1467,7 +1467,7 @@ void TSMesh::prepOpcodeCollision() } else { - pts[i].Set( verts[i].x, verts[i].y, verts[i].z ); + pts[i].Set( mVerts[i].x, mVerts[i].y, mVerts[i].z ); } } diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index 528d7f56c..5e767bd66 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -122,7 +122,7 @@ void TSMesh::innerRender( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb GFX->setVertexBuffer( vb ); GFX->setPrimitiveBuffer( pb ); - for( U32 p = 0; p < primitives.size(); p++ ) + for( U32 p = 0; p < mPrimitives.size(); p++ ) GFX->drawPrimitive( p ); } @@ -223,9 +223,9 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, // NOTICE: SFXBB is removed and refraction is disabled! //coreRI->backBuffTex = GFX->getSfxBackBuffer(); - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive &draw = primitives[i]; + const TSDrawPrimitive &draw = mPrimitives[i]; // We need to have a material. if ( draw.matIndex & TSDrawPrimitive::NoMaterial ) @@ -253,7 +253,7 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, #ifndef TORQUE_OS_MAC // Get the instancing material if this mesh qualifies. - if ( meshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) + if (mMeshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) if (matInst && !matInst->getFeatures().hasFeature(MFT_HardwareSkinning)) matInst = InstancingMaterialHook::getInstancingMat( matInst ); @@ -293,13 +293,13 @@ const Point3F * TSMesh::getNormals( S32 firstVert ) if ( getFlags( UseEncodedNormals ) ) { gNormalStore.setSize( vertsPerFrame ); - for ( S32 i = 0; i < encodedNorms.size(); i++ ) - gNormalStore[i] = decodeNormal( encodedNorms[ i + firstVert ] ); + for ( S32 i = 0; i < mEncodedNorms.size(); i++ ) + gNormalStore[i] = decodeNormal(mEncodedNorms[ i + firstVert ] ); return gNormalStore.address(); } - return &norms[firstVert]; + return &mNorms[firstVert]; } //----------------------------------------------------- @@ -352,28 +352,28 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { // Don't use vertex() method as we want to retain the original indices OptimizedPolyList::VertIndex vert; - vert.vertIdx = opList->insertPoint( verts[ i + firstVert ] ); - vert.normalIdx = opList->insertNormal( norms[ i + firstVert ] ); - vert.uv0Idx = opList->insertUV0( tverts[ i + firstVert ] ); + vert.vertIdx = opList->insertPoint( mVerts[ i + firstVert ] ); + vert.normalIdx = opList->insertNormal( mNorms[ i + firstVert ] ); + vert.uv0Idx = opList->insertUV0( mTverts[ i + firstVert ] ); if ( hasTVert2 ) - vert.uv1Idx = opList->insertUV1( tverts2[ i + firstVert ] ); + vert.uv1Idx = opList->insertUV1(mTverts[ i + firstVert ] ); opList->mVertexList.push_back( vert ); } } else { - base = polyList->addPointAndNormal( verts[firstVert], norms[firstVert] ); + base = polyList->addPointAndNormal( mVerts[firstVert], mNorms[firstVert] ); for ( i = 1; i < vertsPerFrame; i++ ) - polyList->addPointAndNormal( verts[ i + firstVert ], norms[ i + firstVert ] ); + polyList->addPointAndNormal(mVerts[ i + firstVert ], mNorms[ i + firstVert ] ); } } } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -440,9 +440,9 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -627,7 +627,7 @@ void TSMesh::support( S32 frame, const Point3F &v, F32 *currMaxDP, Point3F *curr bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList* materials ) { - if ( planeNormals.empty() ) + if ( mPlaneNormals.empty() ) buildConvexHull(); // if haven't done it yet... // Keep track of startTime and endTime. They start out at just under 0 and just over 1, respectively. @@ -657,15 +657,15 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray S32 * pplane = &curPlane; bool * pfound = &found; - S32 startPlane = frame * planesPerFrame; - for ( S32 i = startPlane; i < startPlane + planesPerFrame; i++ ) + S32 startPlane = frame * mPlanesPerFrame; + for ( S32 i = startPlane; i < startPlane + mPlanesPerFrame; i++ ) { // if start & end outside, no collision // if start & end inside, continue // if start outside, end inside, or visa versa, find intersection of line with plane // then update intersection of line with hull (using startTime and endTime) - F32 dot1 = mDot( planeNormals[i], start ) - planeConstants[i]; - F32 dot2 = mDot( planeNormals[i], end) - planeConstants[i]; + F32 dot1 = mDot(mPlaneNormals[i], start ) - mPlaneConstants[i]; + F32 dot2 = mDot(mPlaneNormals[i], end) - mPlaneConstants[i]; if ( dot1 * dot2 > 0.0f ) { // same side of the plane...which side -- dot==0 considered inside @@ -747,10 +747,10 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray // setup rayInfo if ( found && rayInfo ) { - curMaterial = planeMaterials[ curPlane - startPlane ]; + curMaterial = mPlaneMaterials[ curPlane - startPlane ]; rayInfo->t = (F32)startNum/(F32)startDen; // finally divide... - rayInfo->normal = planeNormals[curPlane]; + rayInfo->normal = mPlaneNormals[curPlane]; if (materials && materials->size() > 0) rayInfo->material = materials->getMaterialInst( curMaterial ); @@ -785,9 +785,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & BaseMatInstance* bestMaterial = NULL; Point3F dir = end - start; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 drawStart = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::castRayRendered (1)" ); @@ -927,35 +927,35 @@ bool TSMesh::addToHull( U32 idx0, U32 idx1, U32 idx2 ) normal.normalize(); F32 k = mDot( normal, mVertexData.getBase(idx0).vert() ); - for ( S32 i = 0; i < planeNormals.size(); i++ ) + for ( S32 i = 0; i < mPlaneNormals.size(); i++ ) { - if ( mDot( planeNormals[i], normal ) > 0.99f && mFabs( k-planeConstants[i] ) < 0.01f ) + if ( mDot(mPlaneNormals[i], normal ) > 0.99f && mFabs( k- mPlaneConstants[i] ) < 0.01f ) return false; // this is a repeat... } // new plane, add it to the list... - planeNormals.push_back( normal ); - planeConstants.push_back( k ); + mPlaneNormals.push_back( normal ); + mPlaneConstants.push_back( k ); return true; } bool TSMesh::buildConvexHull() { // already done, return without error - if ( planeNormals.size() ) + if (mPlaneNormals.size() ) return true; bool error = false; // should probably only have 1 frame, but just in case... - planesPerFrame = 0; + mPlanesPerFrame = 0; S32 frame, i, j; for ( frame = 0; frame < numFrames; frame++ ) { S32 firstVert = vertsPerFrame * frame; - S32 firstPlane = planeNormals.size(); - for ( i = 0; i < primitives.size(); i++ ) + S32 firstPlane = mPlaneNormals.size(); + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildConvexHull (1)" ); @@ -967,7 +967,7 @@ bool TSMesh::buildConvexHull() if ( addToHull( mIndices[start + j + 0] + firstVert, mIndices[start + j + 1] + firstVert, mIndices[start + j + 2] + firstVert ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } else { @@ -984,51 +984,51 @@ bool TSMesh::buildConvexHull() nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1 ); idx2 = mIndices[start + j] + firstVert; if ( addToHull( idx0, idx1, idx2 ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } } } // make sure all the verts on this frame are inside all the planes for ( i = 0; i < vertsPerFrame; i++ ) - for ( j = firstPlane; j < planeNormals.size(); j++ ) - if ( mDot( mVertexData.getBase(firstVert + i).vert(), planeNormals[j] ) - planeConstants[j] < 0.01 ) // .01 == a little slack + for ( j = firstPlane; j < mPlaneNormals.size(); j++ ) + if ( mDot( mVertexData.getBase(firstVert + i).vert(), mPlaneNormals[j] ) - mPlaneConstants[j] < 0.01 ) // .01 == a little slack error = true; if ( frame == 0 ) - planesPerFrame = planeNormals.size(); + mPlanesPerFrame = mPlaneNormals.size(); - if ( (frame + 1) * planesPerFrame != planeNormals.size() ) + if ( (frame + 1) * mPlanesPerFrame != mPlaneNormals.size() ) { // eek, not all frames have same number of planes... - while ( (frame + 1) * planesPerFrame > planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame > mPlaneNormals.size() ) { // we're short, duplicate last plane till we match - U32 sz = planeNormals.size(); - planeNormals.increment(); - planeNormals.last() = planeNormals[sz-1]; - planeConstants.increment(); - planeConstants.last() = planeConstants[sz-1]; + U32 sz = mPlaneNormals.size(); + mPlaneNormals.increment(); + mPlaneNormals.last() = mPlaneNormals[sz-1]; + mPlaneConstants.increment(); + mPlaneConstants.last() = mPlaneConstants[sz-1]; } - while ( (frame + 1) * planesPerFrame < planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame < mPlaneNormals.size() ) { // harsh -- last frame has more than other frames // duplicate last plane in each frame for ( S32 k = frame - 1; k >= 0; k-- ) { - planeNormals.insert( k * planesPerFrame + planesPerFrame ); - planeNormals[k * planesPerFrame + planesPerFrame] = planeNormals[k * planesPerFrame + planesPerFrame - 1]; - planeConstants.insert( k * planesPerFrame + planesPerFrame ); - planeConstants[k * planesPerFrame + planesPerFrame] = planeConstants[k * planesPerFrame + planesPerFrame - 1]; + mPlaneNormals.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame - 1]; + mPlaneConstants.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame - 1]; if ( k == 0 ) { - planeMaterials.increment(); - planeMaterials.last() = planeMaterials[planeMaterials.size() - 2]; + mPlaneMaterials.increment(); + mPlaneMaterials.last() = mPlaneMaterials[mPlaneMaterials.size() - 2]; } } - planesPerFrame++; + mPlanesPerFrame++; } } - AssertFatal( (frame + 1) * planesPerFrame == planeNormals.size(),"TSMesh::buildConvexHull (3)" ); + AssertFatal( (frame + 1) * mPlanesPerFrame == mPlaneNormals.size(),"TSMesh::buildConvexHull (3)" ); } return !error; } @@ -1051,7 +1051,7 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, AssertFatal(!mVertexData.isReady() || (mVertexData.isReady() && mNumVerts == mVertexData.size() && mNumVerts == vertsPerFrame), "vertex number mismatch"); - if(verts.size() == 0 && mVertexData.isReady() && mVertexData.size() > 0) + if(mVerts.size() == 0 && mVertexData.isReady() && mVertexData.size() > 0) { baseVert = &mVertexData.getBase(0).vert(); stride = mVertexData.vertSize(); @@ -1066,11 +1066,11 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, } else { - baseVert = verts.address(); + baseVert = mVerts.address(); stride = sizeof(Point3F); if ( frame < 0 ) - numVerts = verts.size(); + numVerts = mVerts.size(); else { baseVert += frame * vertsPerFrame; @@ -1131,22 +1131,22 @@ void TSMesh::computeBounds( const Point3F *v, S32 numVerts, S32 stride, const Ma S32 TSMesh::getNumPolys() const { S32 count = 0; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - switch (primitives[i].matIndex & TSDrawPrimitive::TypeMask) + switch (mPrimitives[i].matIndex & TSDrawPrimitive::TypeMask) { case TSDrawPrimitive::Triangles: - count += primitives[i].numElements / 3; + count += mPrimitives[i].numElements / 3; break; case TSDrawPrimitive::Fan: - count += primitives[i].numElements - 2; + count += mPrimitives[i].numElements - 2; break; case TSDrawPrimitive::Strip: // Don't count degenerate triangles - for ( S32 j = primitives[i].start; - j < primitives[i].start+primitives[i].numElements-2; + for ( S32 j = mPrimitives[i].start; + j < mPrimitives[i].start+ mPrimitives[i].numElements-2; j++ ) { if ((mIndices[j] != mIndices[j+1]) && @@ -1162,11 +1162,11 @@ S32 TSMesh::getNumPolys() const //----------------------------------------------------- -TSMesh::TSMesh() : meshType( StandardMeshType ) +TSMesh::TSMesh() : mMeshType( StandardMeshType ) { - VECTOR_SET_ASSOCIATION( planeNormals ); - VECTOR_SET_ASSOCIATION( planeConstants ); - VECTOR_SET_ASSOCIATION( planeMaterials ); + VECTOR_SET_ASSOCIATION(mPlaneNormals ); + VECTOR_SET_ASSOCIATION(mPlaneConstants ); + VECTOR_SET_ASSOCIATION(mPlaneMaterials ); mParentMesh = -1; mOptTree = NULL; @@ -1181,7 +1181,7 @@ TSMesh::TSMesh() : meshType( StandardMeshType ) mVertSize = 0; mVertOffset = 0; - parentMeshObject = NULL; + mParentMeshObject = NULL; } //----------------------------------------------------- @@ -1326,8 +1326,8 @@ void TSSkinMesh::createSkinBatchData() } else { - batchData.initialNorms = norms; - batchData.initialVerts = verts; + batchData.initialNorms = mNorms; + batchData.initialVerts = mVerts; } // Build the batch operations @@ -1546,10 +1546,10 @@ void TSSkinMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 fra { TORQUE_UNUSED(frame); - if (verts.size() != 0) + if (mVerts.size() != 0) { // Use unskinned verts - TSMesh::computeBounds( verts.address(), verts.size(), sizeof(Point3F), transform, bounds, center, radius ); + TSMesh::computeBounds(mVerts.address(), mVerts.size(), sizeof(Point3F), transform, bounds, center, radius ); } else if (frame <= 0 && batchData.initialVerts.size() > 0) { @@ -2368,10 +2368,10 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr // go through and create PrimitiveInfo array GFXPrimitive pInfo; - U32 primitivesSize = primitives.size(); + U32 primitivesSize = mPrimitives.size(); for (U32 i = 0; i < primitivesSize; i++) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType(draw.matIndex >> 30); @@ -2436,21 +2436,21 @@ void TSMesh::assemble( bool skip ) S32 numVerts = tsalloc.get32(); S32 *ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); - verts.set( (Point3F*)ptr32, numVerts ); + mVerts.set( (Point3F*)ptr32, numVerts ); S32 numTVerts = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); - tverts.set( (Point2F*)ptr32, numTVerts ); + mTverts.set( (Point2F*)ptr32, numTVerts ); if ( TSShape::smReadVersion > 25 ) { numTVerts = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); - tverts2.set( (Point2F*)ptr32, numTVerts ); + mTverts2.set( (Point2F*)ptr32, numTVerts ); S32 numVColors = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, numVColors, (S32**)smColorsList.address(), skip ); - colors.set( (ColorI*)ptr32, numVColors ); + mColors.set( (ColorI*)ptr32, numVColors ); } S8 *ptr8; @@ -2459,27 +2459,27 @@ void TSMesh::assemble( bool skip ) // we have encoded normals and we want to use them... if (mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // adva nce past norms, don't use - norms.set( NULL, 0 ); + mNorms.set( NULL, 0 ); ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); - encodedNorms.set( ptr8, numVerts ); + mEncodedNorms.set( ptr8, numVerts ); } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); + mNorms.set( (Point3F*)ptr32, numVerts ); if (mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use - encodedNorms.set( NULL, 0 ); + mEncodedNorms.set( NULL, 0 ); } else { // no encoded normals... ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); - encodedNorms.set( NULL, 0 ); + mNorms.set( (Point3F*)ptr32, numVerts ); + mEncodedNorms.set( NULL, 0 ); } // copy the primitives and indices...how we do this depends on what @@ -2553,7 +2553,7 @@ void TSMesh::assemble( bool skip ) AssertFatal(chkPrim==szPrimOut && chkInd==szIndOut,"TSMesh::primitive conversion"); // store output - primitives.set(primOut, szPrimOut); + mPrimitives.set(primOut, szPrimOut); mIndices.set(indOut, szIndOut); // delete temporary arrays if necessary @@ -2569,7 +2569,7 @@ void TSMesh::assemble( bool skip ) vertsPerFrame = tsalloc.get32(); U32 flags = (U32)tsalloc.get32(); - if ( encodedNorms.size() ) + if ( mEncodedNorms.size() ) flags |= UseEncodedNormals; setFlags( flags ); @@ -2577,9 +2577,9 @@ void TSMesh::assemble( bool skip ) // Set color & tvert2 flags if we have an old version if (TSShape::smReadVersion < 27) { - if (colors.size() > 0) setFlags(HasColor); - if (tverts2.size() > 0) setFlags(HasTVert2); - mNumVerts = verts.size(); + if (mColors.size() > 0) setFlags(HasColor); + if (mTverts2.size() > 0) setFlags(HasTVert2); + mNumVerts = mVerts.size(); } tsalloc.checkGuard(); @@ -2587,7 +2587,7 @@ void TSMesh::assemble( bool skip ) if ( tsalloc.allocShape32( 0 ) && TSShape::smReadVersion < 19 ) computeBounds(); // only do this if we copied the data... - createTangents(verts, norms); + createTangents(mVerts, mNorms); } void TSMesh::disassemble() @@ -2636,39 +2636,39 @@ void TSMesh::disassemble() else { // verts... - tsalloc.set32(verts.size()); + tsalloc.set32(mVerts.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); // if no parent mesh, then save off our verts + tsalloc.copyToBuffer32((S32*)mVerts.address(), 3 * mVerts.size()); // if no parent mesh, then save off our verts // tverts... - tsalloc.set32(tverts.size()); + tsalloc.set32(mTverts.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)tverts.address(), 2 * tverts.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mTverts.address(), 2 * mTverts.size()); // if no parent mesh, then save off our tverts if (TSShape::smVersion > 25) { // tverts2... - tsalloc.set32(tverts2.size()); + tsalloc.set32(mTverts2.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)tverts2.address(), 2 * tverts2.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mTverts2.address(), 2 * mTverts2.size()); // if no parent mesh, then save off our tverts // colors - tsalloc.set32(colors.size()); + tsalloc.set32(mColors.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)colors.address(), colors.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mColors.address(), mColors.size()); // if no parent mesh, then save off our tverts } // norms... if (mParentMesh < 0) // if no parent mesh, then save off our norms - tsalloc.copyToBuffer32((S32*)norms.address(), 3 * norms.size()); // norms.size()==verts.size() or error... + tsalloc.copyToBuffer32((S32*)mNorms.address(), 3 * mNorms.size()); // norms.size()==verts.size() or error... // encoded norms... if (mParentMesh < 0) { // if no parent mesh, compute encoded normals and copy over - for (S32 i = 0; i < norms.size(); i++) + for (S32 i = 0; i < mNorms.size(); i++) { - U8 normIdx = encodedNorms.size() ? encodedNorms[i] : encodeNormal(norms[i]); + U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal(mNorms[i]); tsalloc.copyToBuffer8((S8*)&normIdx, 1); } } @@ -2677,14 +2677,14 @@ void TSMesh::disassemble() // optimize triangle draw order during disassemble { FrameTemp tmpIdxs(mIndices.size()); - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive& prim = primitives[i]; + const TSDrawPrimitive& prim = mPrimitives[i]; // only optimize triangle lists (strips and fans are assumed to be already optimized) if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { - TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements, + TriListOpt::OptimizeTriangleOrdering(mVerts.size(), prim.numElements, mIndices.address() + prim.start, tmpIdxs.address()); dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(), prim.numElements); @@ -2695,8 +2695,8 @@ void TSMesh::disassemble() if (TSShape::smVersion > 25) { // primitives... - tsalloc.set32( primitives.size() ); - tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size()); + tsalloc.set32(mPrimitives.size() ); + tsalloc.copyToBuffer32((S32*)mPrimitives.address(),3* mPrimitives.size()); // indices... tsalloc.set32(mIndices.size()); @@ -2705,15 +2705,15 @@ void TSMesh::disassemble() else { // primitives - tsalloc.set32( primitives.size() ); - for (S32 i=0; i &_verts, const Vector Point3F *tan1 = tan0.address() + numVerts; dMemset( tan0.address(), 0, sizeof(Point3F) * 2 * numVerts ); - U32 numPrimatives = primitives.size(); + U32 numPrimatives = mPrimitives.size(); for (S32 i = 0; i < numPrimatives; i++ ) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType( draw.matIndex >> 30 ); U32 p1Index = 0; @@ -3066,7 +3066,7 @@ void TSMesh::createTangents(const Vector &_verts, const Vector } } - tangents.setSize( numVerts ); + mTangents.setSize( numVerts ); // fill out final info from accumulated basis data for( U32 i = 0; i < numVerts; i++ ) @@ -3077,12 +3077,12 @@ void TSMesh::createTangents(const Vector &_verts, const Vector Point3F tempPt = t - n * mDot( n, t ); tempPt.normalize(); - tangents[i] = tempPt; + mTangents[i] = tempPt; Point3F cp; mCross( n, t, &cp ); - tangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; + mTangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; } } @@ -3090,7 +3090,7 @@ void TSMesh::convertToVertexData() { if (!mVertexData.isReady()) { - _convertToVertexData(mVertexData, verts, norms); + _convertToVertexData(mVertexData, mVerts, mNorms); } } @@ -3111,39 +3111,39 @@ void TSSkinMesh::convertToVertexData() void TSMesh::copySourceVertexDataFrom(const TSMesh* srcMesh) { - verts = srcMesh->verts; - tverts = srcMesh->tverts; - norms = srcMesh->norms; - colors = srcMesh->colors; - tverts2 = srcMesh->tverts2; + mVerts = srcMesh->mVerts; + mTverts = srcMesh->mTverts; + mNorms = srcMesh->mNorms; + mColors = srcMesh->mColors; + mTverts2 = srcMesh->mTverts2; - if (verts.size() == 0) + if (mVerts.size() == 0) { bool hasTVert2 = srcMesh->getHasTVert2(); bool hasColor = srcMesh->getHasColor(); - verts.setSize(srcMesh->mNumVerts); - tverts.setSize(srcMesh->mNumVerts); - norms.setSize(srcMesh->mNumVerts); + mVerts.setSize(srcMesh->mNumVerts); + mTverts.setSize(srcMesh->mNumVerts); + mNorms.setSize(srcMesh->mNumVerts); if (hasColor) - colors.setSize(mNumVerts); + mColors.setSize(mNumVerts); if (hasTVert2) - tverts2.setSize(mNumVerts); + mTverts2.setSize(mNumVerts); // Fill arrays for (U32 i = 0; i < mNumVerts; i++) { const __TSMeshVertexBase &cv = srcMesh->mVertexData.getBase(i); const __TSMeshVertex_3xUVColor &cvc = srcMesh->mVertexData.getColor(i); - verts[i] = cv.vert(); - tverts[i] = cv.tvert(); - norms[i] = cv.normal(); + mVerts[i] = cv.vert(); + mTverts[i] = cv.tvert(); + mNorms[i] = cv.normal(); if (hasColor) - cvc.color().getColor(&colors[i]); + cvc.color().getColor(&mColors[i]); if (hasTVert2) - tverts2[i] = cvc.tvert2(); + mTverts2[i] = cvc.tvert2(); } } } @@ -3173,21 +3173,21 @@ void TSSkinMesh::copySourceVertexDataFrom(const TSMesh* srcMesh) U32 TSMesh::getNumVerts() { - return mVertexData.isReady() ? mNumVerts : verts.size(); + return mVertexData.isReady() ? mNumVerts : mVerts.size(); } void TSMesh::_convertToVertexData(TSMeshVertexArray &outArray, const Vector &_verts, const Vector &_norms) { // Update tangents list - createTangents(verts, norms); + createTangents(mVerts, mNorms); AssertFatal(_verts.size() == mNumVerts, "vert count mismatch"); - AssertFatal(!getHasColor() || colors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); - AssertFatal(!getHasTVert2() || tverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); + AssertFatal(!getHasColor() || mColors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); + AssertFatal(!getHasTVert2() || mTverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); AssertFatal(!outArray.isReady(), "Mesh already converted to aligned data! Re-check code!"); AssertFatal(_verts.size() == _norms.size() && - _verts.size() == tangents.size(), + _verts.size() == mTangents.size(), "Vectors: verts, norms, tangents must all be the same size"); AssertFatal(mVertSize == outArray.vertSize(), "Size inconsistency"); @@ -3206,18 +3206,18 @@ void TSMesh::_convertToVertexData(TSMeshVertexArray &outArray, const Vector 0 || meshType & HasColor; } - U32 getHasTVert2() const { return tverts2.size() > 0 || meshType & HasTVert2; } - void setFlags(U32 flag) { meshType |= flag; } - void clearFlags(U32 flag) { meshType &= ~flag; } - U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return meshType & flag; } + U32 getMeshType() const { return mMeshType & TypeMask; } + U32 getHasColor() const { return mColors.size() > 0 || mMeshType & HasColor; } + U32 getHasTVert2() const { return mTverts2.size() > 0 || mMeshType & HasTVert2; } + void setFlags(U32 flag) { mMeshType |= flag; } + void clearFlags(U32 flag) { mMeshType &= ~flag; } + U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return mMeshType & flag; } const Point3F* getNormals( S32 firstVert ); @@ -319,34 +319,34 @@ protected: /// @name Vertex data /// @{ - FreeableVector verts; - FreeableVector norms; - FreeableVector tverts; - FreeableVector tangents; + FreeableVector mVerts; + FreeableVector mNorms; + FreeableVector mTverts; + FreeableVector mTangents; // Optional second texture uvs. - FreeableVector tverts2; + FreeableVector mTverts2; // Optional vertex colors data. - FreeableVector colors; + FreeableVector mColors; /// @} - Vector primitives; - Vector encodedNorms; + Vector mPrimitives; + Vector mEncodedNorms; Vector mIndices; /// billboard data - Point3F billboardAxis; + Point3F mBillboardAxis; /// @name Convex Hull Data /// Convex hulls are convex (no angles >= 180º) meshes used for collision /// @{ - Vector planeNormals; - Vector planeConstants; - Vector planeMaterials; - S32 planesPerFrame; - U32 mergeBufferStart; + Vector mPlaneNormals; + Vector mPlaneConstants; + Vector mPlaneMaterials; + S32 mPlanesPerFrame; + U32 mMergeBufferStart; /// @} /// @name Render Methods diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index 25b56ff32..0beb2d9a2 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -246,9 +246,9 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) { // Add indices S32 indicesBase = mIndices.size(); - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - const TSDrawPrimitive& draw = mesh->primitives[i]; + const TSDrawPrimitive& draw = mesh->mPrimitives[i]; if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { mIndices.merge( &mesh->mIndices[draw.start], draw.numElements ); @@ -282,7 +282,7 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) S32 count, stride; U8* pVert; - if ( mesh->mVertexData.isReady() && mesh->verts.size() == 0 ) + if ( mesh->mVertexData.isReady() && mesh->mVerts.size() == 0 ) { count = mesh->mVertexData.size(); stride = mesh->mVertexData.vertSize(); @@ -290,9 +290,9 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) } else { - count = mesh->verts.size(); + count = mesh->mVerts.size(); stride = sizeof(Point3F); - pVert = (U8*)mesh->verts.address(); + pVert = (U8*)mesh->mVerts.address(); } MatrixF objMat; @@ -337,12 +337,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT mesh->mIndices.push_back( indices[i*3 + 1] ); } - mesh->verts.set( verts, numVerts ); + mesh->mVerts.set( verts, numVerts ); // Compute mesh normals - mesh->norms.setSize( mesh->verts.size() ); - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm] = Point3F::Zero; + mesh->mNorms.setSize( mesh->mVerts.size() ); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm] = Point3F::Zero; // Sum triangle normals for each vertex for (S32 iInd = 0; iInd < mesh->mIndices.size(); iInd += 3) @@ -352,38 +352,38 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT S32 idx1 = mesh->mIndices[iInd + 1]; S32 idx2 = mesh->mIndices[iInd + 2]; - const Point3F& v0 = mesh->verts[idx0]; - const Point3F& v1 = mesh->verts[idx1]; - const Point3F& v2 = mesh->verts[idx2]; + const Point3F& v0 = mesh->mVerts[idx0]; + const Point3F& v1 = mesh->mVerts[idx1]; + const Point3F& v2 = mesh->mVerts[idx2]; Point3F n; mCross(v2 - v0, v1 - v0, &n); n.normalize(); // remove this to use 'weighted' normals (large triangles will have more effect) - mesh->norms[idx0] += n; - mesh->norms[idx1] += n; - mesh->norms[idx2] += n; + mesh->mNorms[idx0] += n; + mesh->mNorms[idx1] += n; + mesh->mNorms[idx2] += n; } // Normalize the vertex normals (this takes care of averaging the triangle normals) - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm].normalize(); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm].normalize(); // Set some dummy UVs - mesh->tverts.setSize( numVerts ); - for ( S32 j = 0; j < mesh->tverts.size(); j++ ) - mesh->tverts[j].set( 0, 0 ); + mesh->mTverts.setSize( numVerts ); + for ( S32 j = 0; j < mesh->mTverts.size(); j++ ) + mesh->mTverts[j].set( 0, 0 ); // Add a single triangle-list primitive - mesh->primitives.increment(); - mesh->primitives.last().start = 0; - mesh->primitives.last().numElements = mesh->mIndices.size(); - mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles | + mesh->mPrimitives.increment(); + mesh->mPrimitives.last().start = 0; + mesh->mPrimitives.last().numElements = mesh->mIndices.size(); + mesh->mPrimitives.last().matIndex = TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed | TSDrawPrimitive::NoMaterial; - mesh->createTangents( mesh->verts, mesh->norms ); - mesh->encodedNorms.set( NULL,0 ); + mesh->createTangents( mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set( NULL,0 ); return mesh; } @@ -404,13 +404,13 @@ void MeshFit::addBox( const Point3F& sides, const MatrixF& mat ) if ( !mesh ) return; - if (mesh->verts.size() > 0) + if (mesh->mVerts.size() > 0) { - for (S32 i = 0; i < mesh->verts.size(); i++) + for (S32 i = 0; i < mesh->mVerts.size(); i++) { - Point3F v = mesh->verts[i]; + Point3F v = mesh->mVerts[i]; v.convolve(sides); - mesh->verts[i] = v; + mesh->mVerts[i] = v; } mesh->mVertexData.setReady(false); @@ -799,7 +799,7 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons MatrixF mat( txfm.getMatrix() ); // Transform the mesh vertices - if ( mesh->mVertexData.isReady() && mesh->verts.size() == 0 ) + if ( mesh->mVertexData.isReady() && mesh->mVerts.size() == 0 ) { for (S32 i = 0; i < mesh->mVertexData.size(); i++) { @@ -811,10 +811,10 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons } else { - for (S32 i = 0; i < mesh->verts.size(); i++) + for (S32 i = 0; i < mesh->mVerts.size(); i++) { - Point3F v(mesh->verts[i]); - mat.mulP( v, &mesh->verts[i] ); + Point3F v(mesh->mVerts[i]); + mat.mulP( v, &mesh->mVerts[i] ); } } diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index c5bc3000b..f1f77d91a 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -592,11 +592,11 @@ void TSShape::initObjects() if (mesh->mParentMesh >= 0 && mesh->mParentMesh < meshes.size()) { - mesh->parentMeshObject = meshes[mesh->mParentMesh]; + mesh->mParentMeshObject = meshes[mesh->mParentMesh]; } else { - mesh->parentMeshObject = NULL; + mesh->mParentMeshObject = NULL; } mesh->mVertexFormat = &mVertexFormat; @@ -623,7 +623,7 @@ void TSShape::initVertexBuffers() continue; destIndices += mesh->mIndices.size(); - destPrims += mesh->primitives.size(); + destPrims += mesh->mPrimitives.size(); } // For HW skinning we can just use the static buffer @@ -660,14 +660,14 @@ void TSShape::initVertexBuffers() AssertFatal(mesh->mVertOffset / mVertexSize == vertStart, "offset mismatch"); vertStart += mesh->mNumVerts; - primStart += mesh->primitives.size(); + primStart += mesh->mPrimitives.size(); indStart += mesh->mIndices.size(); mesh->mVB = mShapeVertexBuffer; mesh->mPB = mShapeVertexIndices; // Advance - piInput += mesh->primitives.size(); + piInput += mesh->mPrimitives.size(); ibIndices += mesh->mIndices.size(); if (TSSkinMesh::smDebugSkinVerts && mesh->getMeshType() == TSMesh::SkinMeshType) @@ -906,12 +906,12 @@ void TSShape::initVertexFeatures() mesh->mVertexData.setReady(true); #ifdef TORQUE_DEBUG - AssertFatal(mesh->mNumVerts == mesh->verts.size(), "vert mismatch"); + AssertFatal(mesh->mNumVerts == mesh->mVerts.size(), "vert mismatch"); for (U32 i = 0; i < mesh->mNumVerts; i++) { - Point3F v1 = mesh->verts[i]; + Point3F v1 = mesh->mVerts[i]; Point3F v2 = mesh->mVertexData.getBase(i).vert(); - AssertFatal(mesh->verts[i] == mesh->mVertexData.getBase(i).vert(), "vert data mismatch"); + AssertFatal(mesh->mVerts[i] == mesh->mVertexData.getBase(i).vert(), "vert data mismatch"); } if (mesh->getMeshType() == TSMesh::SkinMeshType) @@ -987,11 +987,11 @@ void TSShape::initMaterialList() if (!mesh) continue; - for (k=0; kprimitives.size(); k++) + for (k=0; kmPrimitives.size(); k++) { - if (mesh->primitives[k].matIndex & TSDrawPrimitive::NoMaterial) + if (mesh->mPrimitives[k].matIndex & TSDrawPrimitive::NoMaterial) continue; - S32 flags = materialList->getFlags(mesh->primitives[k].matIndex & TSDrawPrimitive::MaterialMask); + S32 flags = materialList->getFlags(mesh->mPrimitives[k].matIndex & TSDrawPrimitive::MaterialMask); if (flags & TSMaterialList::AuxiliaryMap) continue; if (flags & TSMaterialList::Translucent) @@ -1001,7 +1001,7 @@ void TSShape::initMaterialList() break; } } - if (k!=mesh->primitives.size()) + if (k!=mesh->mPrimitives.size()) break; } if (j!=obj.numMeshes) @@ -1521,15 +1521,15 @@ void TSShape::assembleShape() // fill in location of verts, tverts, and normals for detail levels if (mesh && meshType!=TSMesh::DecalMeshType) { - TSMesh::smVertsList[i] = mesh->verts.address(); - TSMesh::smTVertsList[i] = mesh->tverts.address(); + TSMesh::smVertsList[i] = mesh->mVerts.address(); + TSMesh::smTVertsList[i] = mesh->mTverts.address(); if (smReadVersion >= 26) { - TSMesh::smTVerts2List[i] = mesh->tverts2.address(); - TSMesh::smColorsList[i] = mesh->colors.address(); + TSMesh::smTVerts2List[i] = mesh->mTverts2.address(); + TSMesh::smColorsList[i] = mesh->mColors.address(); } - TSMesh::smNormsList[i] = mesh->norms.address(); - TSMesh::smEncodedNormsList[i] = mesh->encodedNorms.address(); + TSMesh::smNormsList[i] = mesh->mNorms.address(); + TSMesh::smEncodedNormsList[i] = mesh->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now if (meshType==TSMesh::SkinMeshType) { @@ -1617,9 +1617,9 @@ void TSShape::assembleShape() if (skin) { TSMesh::smVertsList[i] = skin->batchData.initialVerts.address(); - TSMesh::smTVertsList[i] = skin->tverts.address(); + TSMesh::smTVertsList[i] = skin->mTverts.address(); TSMesh::smNormsList[i] = skin->batchData.initialNorms.address(); - TSMesh::smEncodedNormsList[i] = skin->encodedNorms.address(); + TSMesh::smEncodedNormsList[i] = skin->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now TSSkinMesh::smInitTransformList[i] = skin->batchData.initialTransforms.address(); TSSkinMesh::smVertexIndexList[i] = skin->vertexIndex.address(); @@ -1805,15 +1805,15 @@ bool TSShape::canWriteOldFormat() const continue; // Cannot use old format if using the new functionality (COLORs, 2nd UV set) - if (meshes[i]->tverts2.size() || meshes[i]->colors.size()) + if (meshes[i]->mTverts2.size() || meshes[i]->mColors.size()) return false; // Cannot use old format if any primitive has too many triangles // (ie. cannot fit in a S16) - for (S32 j = 0; j < meshes[i]->primitives.size(); j++) + for (S32 j = 0; j < meshes[i]->mPrimitives.size(); j++) { - if ((meshes[i]->primitives[j].start + - meshes[i]->primitives[j].numElements) >= (1 << 15)) + if ((meshes[i]->mPrimitives[j].start + + meshes[i]->mPrimitives[j].numElements) >= (1 << 15)) { return false; } diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 612b5dcf7..50b500828 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1340,7 +1340,7 @@ DefineTSShapeConstructorMethod( getMeshMaterial, const char*, ( const char* name GET_MESH( getMeshMaterial, mesh, name, "" ); // Return the name of the first material attached to this mesh - S32 matIndex = mesh->primitives[0].matIndex & TSDrawPrimitive::MaterialMask; + S32 matIndex = mesh->mPrimitives[0].matIndex & TSDrawPrimitive::MaterialMask; if ((matIndex >= 0) && (matIndex < mShape->materialList->size())) return mShape->materialList->getMaterialName( matIndex ); else @@ -1377,10 +1377,10 @@ DefineTSShapeConstructorMethod( setMeshMaterial, bool, ( const char* meshName, c } // Set this material for all primitives in the mesh - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - U32 matType = mesh->primitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); - mesh->primitives[i].matIndex = ( matType | matIndex ); + U32 matType = mesh->mPrimitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); + mesh->mPrimitives[i].matIndex = ( matType | matIndex ); } ADD_TO_CHANGE_SET(); diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index c0c540a66..f1b35a928 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -938,7 +938,7 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const // Copy mesh elements mesh->mIndices = srcMesh->mIndices; - mesh->primitives = srcMesh->primitives; + mesh->mPrimitives = srcMesh->mPrimitives; mesh->numFrames = srcMesh->numFrames; mesh->numMatFrames = srcMesh->numMatFrames; mesh->vertsPerFrame = srcMesh->vertsPerFrame; @@ -948,8 +948,8 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const // Copy vertex data in an *unpacked* form mesh->copySourceVertexDataFrom(srcMesh); - mesh->createTangents(mesh->verts, mesh->norms); - mesh->encodedNorms.set(NULL, 0); + mesh->createTangents(mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set(NULL, 0); mesh->computeBounds(); @@ -1108,12 +1108,12 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String // Copy materials used by the source mesh (only if from a different shape) if (srcShape != this) { - for (S32 i = 0; i < mesh->primitives.size(); i++) + for (S32 i = 0; i < mesh->mPrimitives.size(); i++) { - if (!(mesh->primitives[i].matIndex & TSDrawPrimitive::NoMaterial)) + if (!(mesh->mPrimitives[i].matIndex & TSDrawPrimitive::NoMaterial)) { - S32 drawType = (mesh->primitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); - S32 srcMatIndex = mesh->primitives[i].matIndex & TSDrawPrimitive::MaterialMask; + S32 drawType = (mesh->mPrimitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); + S32 srcMatIndex = mesh->mPrimitives[i].matIndex & TSDrawPrimitive::MaterialMask; const String& matName = srcShape->materialList->getMaterialName(srcMatIndex); // Add the material if it does not already exist @@ -1124,7 +1124,7 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String materialList->push_back(matName, srcShape->materialList->getFlags(srcMatIndex)); } - mesh->primitives[i].matIndex = drawType | destMatIndex; + mesh->mPrimitives[i].matIndex = drawType | destMatIndex; } } } diff --git a/Engine/source/ts/tsSortedMesh.cpp b/Engine/source/ts/tsSortedMesh.cpp index e2c5b489c..8a88ff319 100644 --- a/Engine/source/ts/tsSortedMesh.cpp +++ b/Engine/source/ts/tsSortedMesh.cpp @@ -86,10 +86,10 @@ S32 TSSortedMesh::getNumPolys() Cluster & cluster = clusters[cIdx]; for (S32 i=cluster.startPrimitive; i Date: Tue, 13 Mar 2018 15:31:00 -0500 Subject: [PATCH 176/312] cleaned up member::radius --- Engine/source/T3D/guiMaterialPreview.cpp | 2 +- Engine/source/T3D/guiObjectView.cpp | 2 +- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 2 +- Engine/source/environment/VolumetricFog.cpp | 4 ++-- Engine/source/gui/editor/guiShapeEdPreview.cpp | 4 ++-- Engine/source/lighting/common/blobShadow.cpp | 2 +- Engine/source/ts/loader/tsShapeLoader.cpp | 4 ++-- Engine/source/ts/tsLastDetail.cpp | 2 +- Engine/source/ts/tsShape.cpp | 6 +++--- Engine/source/ts/tsShape.h | 2 +- Engine/source/ts/tsShapeConstruct.cpp | 4 ++-- Engine/source/ts/tsShapeInstance.cpp | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Engine/source/T3D/guiMaterialPreview.cpp b/Engine/source/T3D/guiMaterialPreview.cpp index 1fa053a12..05d42b87f 100644 --- a/Engine/source/T3D/guiMaterialPreview.cpp +++ b/Engine/source/T3D/guiMaterialPreview.cpp @@ -269,7 +269,7 @@ void GuiMaterialPreview::setObjectModel(const char* modelName) // Initialize camera values: mOrbitPos = mModel->getShape()->center; - mMinOrbitDist = mModel->getShape()->radius; + mMinOrbitDist = mModel->getShape()->mRadius; lastRenderTime = Platform::getVirtualMilliseconds(); } diff --git a/Engine/source/T3D/guiObjectView.cpp b/Engine/source/T3D/guiObjectView.cpp index 13c46380c..5330a1ee6 100644 --- a/Engine/source/T3D/guiObjectView.cpp +++ b/Engine/source/T3D/guiObjectView.cpp @@ -367,7 +367,7 @@ void GuiObjectView::setObjectModel( const String& modelName ) // Initialize camera values. mOrbitPos = mModel->getShape()->center; - mMinOrbitDist = mModel->getShape()->radius; + mMinOrbitDist = mModel->getShape()->mRadius; // Initialize animation. diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 05524867a..455dee9f5 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -400,7 +400,7 @@ bool WheeledVehicleData::preload(bool server, String &errorStr) MatrixF imat(1); SphereF sphere; sphere.center = mShape->center; - sphere.radius = mShape->radius; + sphere.radius = mShape->mRadius; PlaneExtractorPolyList polyList; polyList.mPlaneList = &rigidBody.mPlaneList; polyList.setTransform(&imat, Point3F(1,1,1)); diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index ba655ffa9..e0b1c6227 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -348,7 +348,7 @@ bool VolumetricFog::LoadShape() } mObjBox = mShape->mBounds; - mRadius = mShape->radius; + mRadius = mShape->mRadius; resetWorldBox(); if (!isClientObject()) @@ -561,7 +561,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream) if (bool(mShape) == false) return retMask; mObjBox = mShape->mBounds; - mRadius = mShape->radius; + mRadius = mShape->mRadius; resetWorldBox(); mObjSize = mWorldBox.getGreatestDiagonalLength(); mObjScale = getScale(); diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 300b6e95e..bb83d85d7 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -366,8 +366,8 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName) mOrbitPos = shape->center; // Set camera move and zoom speed according to model size - mMoveSpeed = shape->radius / sMoveScaler; - mZoomSpeed = shape->radius / sZoomScaler; + mMoveSpeed = shape->mRadius / sMoveScaler; + mZoomSpeed = shape->mRadius / sZoomScaler; // Reset node selection mHoverNode = -1; diff --git a/Engine/source/lighting/common/blobShadow.cpp b/Engine/source/lighting/common/blobShadow.cpp index 3db211762..f0d87be28 100644 --- a/Engine/source/lighting/common/blobShadow.cpp +++ b/Engine/source/lighting/common/blobShadow.cpp @@ -95,7 +95,7 @@ bool BlobShadow::shouldRender(F32 camDist) if (mShapeBase && mShapeBase->getFadeVal() < TSMesh::VISIBILITY_EPSILON) return false; - F32 shadowLen = 10.0f * mShapeInstance->getShape()->radius; + F32 shadowLen = 10.0f * mShapeInstance->getShape()->mRadius; Point3F pos = mShapeInstance->getShape()->center; // this is a bit of a hack...move generic shadows towards feet/base of shape diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 5fa76d0fc..11779eb6b 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1225,8 +1225,8 @@ void TSShapeLoader::install() shape->mBounds = Box3F(1.0f); shape->mBounds.getCenter(&shape->center); - shape->radius = (shape->mBounds.maxExtents - shape->center).len(); - shape->tubeRadius = shape->radius; + shape->mRadius = (shape->mBounds.maxExtents - shape->center).len(); + shape->tubeRadius = shape->mRadius; shape->init(); shape->finalizeEditable(); diff --git a/Engine/source/ts/tsLastDetail.cpp b/Engine/source/ts/tsLastDetail.cpp index 842b28a0e..19fd7e140 100644 --- a/Engine/source/ts/tsLastDetail.cpp +++ b/Engine/source/ts/tsLastDetail.cpp @@ -82,7 +82,7 @@ TSLastDetail::TSLastDetail( TSShape *shape, mDl = dl; mDim = getMax( dim, (S32)32 ); - mRadius = mShape->radius; + mRadius = mShape->mRadius; mCenter = mShape->center; mCachePath = cachePath; diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index f1f77d91a..681388d6d 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -1195,7 +1195,7 @@ void TSShape::assembleShape() tsalloc.checkGuard(); // get bounds... - tsalloc.get32((S32*)&radius,1); + tsalloc.get32((S32*)&mRadius,1); tsalloc.get32((S32*)&tubeRadius,1); tsalloc.get32((S32*)¢er,3); tsalloc.get32((S32*)&mBounds,6); @@ -1670,7 +1670,7 @@ void TSShape::disassembleShape() tsalloc.setGuard(); // get bounds... - tsalloc.copyToBuffer32((S32*)&radius,1); + tsalloc.copyToBuffer32((S32*)&mRadius,1); tsalloc.copyToBuffer32((S32*)&tubeRadius,1); tsalloc.copyToBuffer32((S32*)¢er,3); tsalloc.copyToBuffer32((S32*)&mBounds,6); @@ -2060,7 +2060,7 @@ void TSShape::createEmptyShape() names[1] = StringTable->insert("Mesh2"); names[2] = StringTable->insert("Mesh"); - radius = 0.866025f; + mRadius = 0.866025f; tubeRadius = 0.707107f; center.set(0.0f, 0.5f, 0.0f); mBounds.minExtents.set(-0.5f, 0.0f, -0.5f); diff --git a/Engine/source/ts/tsShape.h b/Engine/source/ts/tsShape.h index d6196c986..164e378a9 100644 --- a/Engine/source/ts/tsShape.h +++ b/Engine/source/ts/tsShape.h @@ -354,7 +354,7 @@ class TSShape /// @name Bounding /// @{ - F32 radius; + F32 mRadius; F32 tubeRadius; Point3F center; Box3F mBounds; diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 50b500828..24fb85726 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1459,8 +1459,8 @@ DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, shape->mBounds = bbox; shape->mBounds.getCenter( &shape->center ); - shape->radius = ( shape->mBounds.maxExtents - shape->center ).len(); - shape->tubeRadius = shape->radius; + shape->mRadius = ( shape->mBounds.maxExtents - shape->center ).len(); + shape->tubeRadius = shape->mRadius; ADD_TO_CHANGE_SET(); return true; diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index 98d6b39ea..f9a74e446 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -662,7 +662,7 @@ S32 TSShapeInstance::setDetailFromDistance( const SceneRenderState *state, F32 s // We're inlining SceneRenderState::projectRadius here to // skip the unnessasary divide by zero protection. - F32 pixelRadius = ( mShape->radius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale; + F32 pixelRadius = ( mShape->mRadius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale; F32 pixelSize = pixelRadius * smDetailAdjust; if ( pixelSize < smSmallestVisiblePixelSize ) { From 3c9747163055e7a709e37c69984bab5e5c6ead0f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:27:24 -0500 Subject: [PATCH 177/312] substitution statements conformed to standard class:mVar standard --- Engine/source/console/simDatablock.cpp | 46 +++++++++++++------------- Engine/source/console/simDatablock.h | 6 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Engine/source/console/simDatablock.cpp b/Engine/source/console/simDatablock.cpp index ce689c054..85d2ee8f8 100644 --- a/Engine/source/console/simDatablock.cpp +++ b/Engine/source/console/simDatablock.cpp @@ -62,20 +62,20 @@ SimDataBlock::SimDataBlock() SimDataBlock::SubstitutionStatement::SubstitutionStatement(StringTableEntry slot, S32 idx, const char* value) { - this->slot = slot; - this->idx = idx; - this->value = dStrdup(value); + this->mSlot = slot; + this->mIdx = idx; + this->mValue = dStrdup(value); } SimDataBlock::SubstitutionStatement::~SubstitutionStatement() { - dFree(value); + dFree(mValue); } void SimDataBlock::SubstitutionStatement::replaceValue(const char* value) { - dFree(this->value); - this->value = dStrdup(value); + dFree(this->mValue); + this->mValue = dStrdup(value); } // this is the copy-constructor for creating temp-clones. @@ -109,7 +109,7 @@ void SimDataBlock::addSubstitution(StringTableEntry slot, S32 idx, const char* s for (S32 i = 0; i < substitutions.size(); i++) { - if (substitutions[i] && substitutions[i]->slot == slot && substitutions[i]->idx == idx) + if (substitutions[i] && substitutions[i]->mSlot == slot && substitutions[i]->mIdx == idx) { if (empty_subs) { @@ -137,8 +137,8 @@ const char* SimDataBlock::getSubstitution(StringTableEntry slot, S32 idx) { for (S32 i = 0; i < substitutions.size(); i++) { - if (substitutions[i] && substitutions[i]->slot == slot && substitutions[i]->idx == idx) - return substitutions[i]->value; + if (substitutions[i] && substitutions[i]->mSlot == slot && substitutions[i]->mIdx == idx) + return substitutions[i]->mValue; } return 0; @@ -147,7 +147,7 @@ const char* SimDataBlock::getSubstitution(StringTableEntry slot, S32 idx) bool SimDataBlock::fieldHasSubstitution(StringTableEntry slot) { for (S32 i = 0; i < substitutions.size(); i++) - if (substitutions[i] && substitutions[i]->slot == slot) + if (substitutions[i] && substitutions[i]->mSlot == slot) return true; return false; } @@ -156,7 +156,7 @@ void SimDataBlock::printSubstitutions() { for (S32 i = 0; i < substitutions.size(); i++) if (substitutions[i]) - Con::errorf("SubstitutionStatement[%s] = \"%s\" -- %d", substitutions[i]->slot, substitutions[i]->value, i); + Con::errorf("SubstitutionStatement[%s] = \"%s\" -- %d", substitutions[i]->mSlot, substitutions[i]->mValue, i); } void SimDataBlock::copySubstitutionsFrom(SimDataBlock* other) @@ -170,7 +170,7 @@ void SimDataBlock::copySubstitutionsFrom(SimDataBlock* other) if (other->substitutions[i]) { SubstitutionStatement* subs = other->substitutions[i]; - substitutions.push_back(new SubstitutionStatement(subs->slot, subs->idx, subs->value)); + substitutions.push_back(new SubstitutionStatement(subs->mSlot, subs->mIdx, subs->mValue)); } } } @@ -212,7 +212,7 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o char* b = buffer; // perform special token expansion (%% and ##) - const char* v = substitutions[i]->value; + const char* v = substitutions[i]->mValue; while (*v != '\0') { // identify "%%" tokens and replace with id @@ -258,7 +258,7 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o if (Compiler::gSyntaxError) { Con::errorf("Field Substitution Failed: field=\"%s\" substitution=\"%s\" -- syntax error", - substitutions[i]->slot, substitutions[i]->value); + substitutions[i]->mSlot, substitutions[i]->mValue); Compiler::gSyntaxError = false; return; } @@ -267,7 +267,7 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o if (result == 0 || result[0] == '\0') { Con::errorf("Field Substitution Failed: field=\"%s\" substitution=\"%s\" -- empty result", - substitutions[i]->slot, substitutions[i]->value); + substitutions[i]->mSlot, substitutions[i]->mValue); return; } @@ -282,29 +282,29 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o result = ""; } - const AbstractClassRep::Field* field = dblock->getClassRep()->findField(substitutions[i]->slot); + const AbstractClassRep::Field* field = dblock->getClassRep()->findField(substitutions[i]->mSlot); if (!field) { // this should be very unlikely... - Con::errorf("Field Substitution Failed: unknown field, \"%s\".", substitutions[i]->slot); + Con::errorf("Field Substitution Failed: unknown field, \"%s\".", substitutions[i]->mSlot); continue; } if (field->keepClearSubsOnly && result[0] != '\0') { Con::errorf("Field Substitution Failed: field \"%s\" of datablock %s only allows \"$$ ~~\" (keep) and \"$$ ~0\" (clear) field substitutions. [%s]", - substitutions[i]->slot, this->getClassName(), this->getName()); + substitutions[i]->mSlot, this->getClassName(), this->getName()); continue; } // substitute the field value with its replacement - Con::setData(field->type, (void*)(((const char*)(dblock)) + field->offset), substitutions[i]->idx, 1, &result, field->table, field->flag); + Con::setData(field->type, (void*)(((const char*)(dblock)) + field->offset), substitutions[i]->mIdx, 1, &result, field->table, field->flag); //dStrncpy(buffer, result, 255); //Con::errorf("SUBSTITUTION %s.%s[%d] = %s idx=%s", Con::getIntArg(getId()), substitutions[i]->slot, substitutions[i]->idx, buffer, index_str); // notify subclasses of a field modification - dblock->onStaticModified(substitutions[i]->slot); + dblock->onStaticModified(substitutions[i]->mSlot); } } @@ -366,9 +366,9 @@ void SimDataBlock::packData(BitStream* stream) if (substitutions[i]) { stream->writeFlag(true); - stream->writeString(substitutions[i]->slot); - stream->write(substitutions[i]->idx); - stream->writeString(substitutions[i]->value); + stream->writeString(substitutions[i]->mSlot); + stream->write(substitutions[i]->mIdx); + stream->writeString(substitutions[i]->mValue); } } stream->writeFlag(false); diff --git a/Engine/source/console/simDatablock.h b/Engine/source/console/simDatablock.h index d6a7dcd52..21856bb46 100644 --- a/Engine/source/console/simDatablock.h +++ b/Engine/source/console/simDatablock.h @@ -179,9 +179,9 @@ public: protected: struct SubstitutionStatement { - StringTableEntry slot; - S32 idx; - char* value; + StringTableEntry mSlot; + S32 mIdx; + char* mValue; SubstitutionStatement(StringTableEntry slot, S32 idx, const char* value); ~SubstitutionStatement(); void replaceValue(const char* value); From 9dd9d2f9b78c320667e9727c47be13a983bcdc79 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:29:03 -0500 Subject: [PATCH 178/312] scenecontainer cleanup --- Engine/source/scene/sceneContainer.cpp | 34 +++++++++++++------------- Engine/source/scene/sceneContainer.h | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index 6f6202414..66722a079 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -60,26 +60,26 @@ static Box3F sBoundingBox; SceneContainer::Link::Link() { - next = prev = this; + mNext = mPrev = this; } //----------------------------------------------------------------------------- void SceneContainer::Link::unlink() { - next->prev = prev; - prev->next = next; - next = prev = this; + mNext->mPrev = mPrev; + mPrev->mNext = mNext; + mNext = mPrev = this; } //----------------------------------------------------------------------------- void SceneContainer::Link::linkAfter(SceneContainer::Link* ptr) { - next = ptr->next; - next->prev = this; - prev = ptr; - prev->next = this; + mNext = ptr->mNext; + mNext->mPrev = this; + mPrev = ptr; + mPrev->mNext = this; } //============================================================================= @@ -93,8 +93,8 @@ SceneContainer::SceneContainer() mSearchInProgress = false; mCurrSeqKey = 0; - mEnd.next = mEnd.prev = &mStart; - mStart.next = mStart.prev = &mEnd; + mEnd.mNext = mEnd.mPrev = &mStart; + mStart.mNext = mStart.mPrev = &mEnd; mBinArray = new SceneObjectRef[csmNumBins * csmNumBins]; for (U32 i = 0; i < csmNumBins; i++) @@ -760,7 +760,7 @@ void SceneContainer::findObjectList( const Frustum &frustum, U32 mask, Vector *outFound ) { - for ( Link* itr = mStart.next; itr != &mEnd; itr = itr->next ) + for ( Link* itr = mStart.mNext; itr != &mEnd; itr = itr->mNext) { SceneObject* ptr = static_cast( itr ); if ( ( ptr->getTypeMask() & mask ) != 0 ) @@ -772,7 +772,7 @@ void SceneContainer::findObjectList( U32 mask, Vector *outFound ) void SceneContainer::findObjects( U32 mask, FindCallback callback, void *key ) { - for (Link* itr = mStart.next; itr != &mEnd; itr = itr->next) { + for (Link* itr = mStart.mNext; itr != &mEnd; itr = itr->mNext) { SceneObject* ptr = static_cast(itr); if ((ptr->getTypeMask() & mask) != 0 && !ptr->mCollisionCount) (*callback)(ptr,key); @@ -859,10 +859,10 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en F32 currentT = 2.0; mCurrSeqKey++; - SceneObjectRef* chain = mOverflowBin.nextInBin; - while (chain) + SceneObjectRef* overflowChain = mOverflowBin.nextInBin; + while (overflowChain) { - SceneObject* ptr = chain->object; + SceneObject* ptr = overflowChain->object; if (ptr->getContainerSeqKey() != mCurrSeqKey) { ptr->setContainerSeqKey(mCurrSeqKey); @@ -897,7 +897,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en } } } - chain = chain->nextInBin; + overflowChain = overflowChain->nextInBin; } // These are just for rasterizing the line against the grid. We want the x coord @@ -1138,7 +1138,7 @@ bool SceneContainer::collideBox(const Point3F &start, const Point3F &end, U32 ma AssertFatal( info->userData == NULL, "SceneContainer::collideBox - RayInfo->userData cannot be used here!" ); F32 currentT = 2; - for (Link* itr = mStart.next; itr != &mEnd; itr = itr->next) + for (Link* itr = mStart.mNext; itr != &mEnd; itr = itr->mNext) { SceneObject* ptr = static_cast(itr); if (ptr->getTypeMask() & mask && !ptr->mCollisionCount) diff --git a/Engine/source/scene/sceneContainer.h b/Engine/source/scene/sceneContainer.h index a98548964..2437eb396 100644 --- a/Engine/source/scene/sceneContainer.h +++ b/Engine/source/scene/sceneContainer.h @@ -151,8 +151,8 @@ class SceneContainer struct Link { - Link* next; - Link* prev; + Link* mNext; + Link* mPrev; Link(); void unlink(); void linkAfter(Link* ptr); From f36826605fb20ea60331d18674e7e7c3257a2de8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:30:33 -0500 Subject: [PATCH 179/312] simobject, dictionary, stringtable, and taml clarificationsand cleanups --- Engine/source/console/simFieldDictionary.cpp | 24 ++++++++++---------- Engine/source/console/simObject.cpp | 6 ++--- Engine/source/core/stringTable.cpp | 2 +- Engine/source/persistence/taml/taml.cpp | 8 +++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Engine/source/console/simFieldDictionary.cpp b/Engine/source/console/simFieldDictionary.cpp index f68a8689b..2c9f474ae 100644 --- a/Engine/source/console/simFieldDictionary.cpp +++ b/Engine/source/console/simFieldDictionary.cpp @@ -245,17 +245,17 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop const AbstractClassRep::FieldList &list = obj->getFieldList(); Vector flist(__FILE__, __LINE__); - for (U32 i = 0; i < HashTableSize; i++) + for (U32 curEntry = 0; curEntry < HashTableSize; curEntry++) { - for (Entry *walk = mHashTable[i]; walk; walk = walk->next) + for (Entry *walk = mHashTable[curEntry]; walk; walk = walk->next) { // make sure we haven't written this out yet: - U32 i; - for (i = 0; i < list.size(); i++) - if (list[i].pFieldname == walk->slotName) + U32 curField; + for (curField = 0; curField < list.size(); curField++) + if (list[curField].pFieldname == walk->slotName) break; - if (i != list.size()) + if (curField != list.size()) continue; @@ -293,17 +293,17 @@ void SimFieldDictionary::printFields(SimObject *obj) char expandedBuffer[4096]; Vector flist(__FILE__, __LINE__); - for (U32 i = 0; i < HashTableSize; i++) + for (U32 curEntry = 0; curEntry < HashTableSize; curEntry++) { - for (Entry *walk = mHashTable[i]; walk; walk = walk->next) + for (Entry *walk = mHashTable[curEntry]; walk; walk = walk->next) { // make sure we haven't written this out yet: - U32 i; - for (i = 0; i < list.size(); i++) - if (list[i].pFieldname == walk->slotName) + U32 curField; + for (curField = 0; curField < list.size(); curField++) + if (list[curField].pFieldname == walk->slotName) break; - if (i != list.size()) + if (curField != list.size()) continue; flist.push_back(walk); diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index c4b6848c9..c3044df0e 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -529,17 +529,17 @@ void SimObject::onTamlCustomRead(TamlCustomNodes const& customNodes) for (TamlCustomFieldVector::const_iterator fieldItr = fields.begin(); fieldItr != fields.end(); ++fieldItr) { // Fetch field. - const TamlCustomField* pField = *fieldItr; + const TamlCustomField* cField = *fieldItr; // Fetch field name. - StringTableEntry fieldName = pField->getFieldName(); + StringTableEntry fieldName = cField->getFieldName(); const AbstractClassRep::Field* field = findField(fieldName); // Check common fields. if (field) { - setDataField(fieldName, buf, pField->getFieldValue()); + setDataField(fieldName, buf, cField->getFieldValue()); } else { diff --git a/Engine/source/core/stringTable.cpp b/Engine/source/core/stringTable.cpp index 9a71603ae..cbdfaec40 100644 --- a/Engine/source/core/stringTable.cpp +++ b/Engine/source/core/stringTable.cpp @@ -232,7 +232,7 @@ void _StringTable::resize(const U32 _newSize) walk = head; while(walk) { U32 key; - Node *temp = walk; + temp = walk; walk = walk->next; key = hashString(temp->val); diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index f364ed0ce..b9144e8ed 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -1241,8 +1241,8 @@ ImplementEnumType(_TamlFormatMode, // ************************************************************* // Generate the engine type elements. - TiXmlComment* pComment = new TiXmlComment("Type Elements"); - pSchemaElement->LinkEndChild(pComment); + TiXmlComment* tComment = new TiXmlComment("Type Elements"); + pSchemaElement->LinkEndChild(tComment); for (AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass()) { // Add type. @@ -1260,8 +1260,8 @@ ImplementEnumType(_TamlFormatMode, { // Add complex type comment. dSprintf(buffer, sizeof(buffer), " %s Type ", pType->getClassName()); - TiXmlComment* pComment = new TiXmlComment(buffer); - pSchemaElement->LinkEndChild(pComment); + TiXmlComment* ctComment = new TiXmlComment(buffer); + pSchemaElement->LinkEndChild(ctComment); // Add complex type. TiXmlElement* pComplexTypeElement = new TiXmlElement("xs:complexType"); From 2e2e08f32db040c3b3957b7c899aeec8555af5b0 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:33:13 -0500 Subject: [PATCH 180/312] terrain file I/O and opengl rendering cleanup --- Engine/source/terrain/glsl/terrFeatureGLSL.cpp | 3 --- Engine/source/terrain/terrFile.cpp | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 4492ca01b..2acd40871 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -569,9 +569,6 @@ void TerrainDetailMapFeatGLSL::processPix( Vector &component // amount so that it fades out with the layer blending. if ( fd.features.hasFeature( MFT_TerrainParallaxMap, detailIndex ) ) { - // Get the rest of our inputs. - Var *normalMap = _getNormalMapTex(); - // Call the library function to do the rest. if (fd.features.hasFeature(MFT_IsBC3nm, detailIndex)) { diff --git a/Engine/source/terrain/terrFile.cpp b/Engine/source/terrain/terrFile.cpp index 3a639d0b0..1ae32dc73 100644 --- a/Engine/source/terrain/terrFile.cpp +++ b/Engine/source/terrain/terrFile.cpp @@ -110,11 +110,11 @@ void TerrainFile::_buildGridMap() mGridMap.compact(); // Assign memory from the pool to each grid level. - TerrainSquare *sq = mGridMapPool.address(); + TerrainSquare *grid = mGridMapPool.address(); for ( S32 i = mGridLevels; i >= 0; i-- ) { - mGridMap[i] = sq; - sq += 1 << ( 2 * ( mGridLevels - i ) ); + mGridMap[i] = grid; + grid += 1 << ( 2 * ( mGridLevels - i ) ); } for( S32 i = mGridLevels; i >= 0; i-- ) From 190a647254a12a6ef1c474dd0819ecf0ac27bcc1 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:54:35 -0500 Subject: [PATCH 181/312] animation clarification --- Engine/source/ts/tsAnimate.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/ts/tsAnimate.cpp b/Engine/source/ts/tsAnimate.cpp index 135f8a4b9..ef88d1eb8 100644 --- a/Engine/source/ts/tsAnimate.cpp +++ b/Engine/source/ts/tsAnimate.cpp @@ -212,11 +212,11 @@ void TSShapeInstance::animateNodes(S32 ss) for (i=0; i=start && nodeIndex=start && nodeIdxsetNodeTransform(this, nodeIndex, smNodeLocalTransforms[nodeIndex]); - smNodeLocalTransformDirty.set(nodeIndex); + mNodeCallbacks[i].callback->setNodeTransform(this, nodeIdx, smNodeLocalTransforms[nodeIdx]); + smNodeLocalTransformDirty.set(nodeIdx); } } From 6cbab6d117135a8c1cc813d7bdecbb0921cfbb37 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 18:03:10 -0500 Subject: [PATCH 182/312] serverquery cleanup --- Engine/source/app/net/serverQuery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/app/net/serverQuery.cpp b/Engine/source/app/net/serverQuery.cpp index 4c91caf70..1b1f5f0e0 100644 --- a/Engine/source/app/net/serverQuery.cpp +++ b/Engine/source/app/net/serverQuery.cpp @@ -1297,7 +1297,7 @@ static void processPingsAndQueries( U32 session, bool schedule ) if ( !gPingList.size() && !waitingForMaster ) { // Start the query phase: - for ( U32 i = 0; i < gQueryList.size() && i < gMaxConcurrentQueries; ) + for ( i = 0; i < gQueryList.size() && i < gMaxConcurrentQueries; ) { Ping &p = gQueryList[i]; if ( p.time + gPingTimeout < time ) From 407e3d95b2ff2c4cf6ebca39f72a25b6771ee1e3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 18:05:30 -0500 Subject: [PATCH 183/312] SFXMemoryStream::read clarification. --- Engine/source/sfx/sfxMemoryStream.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/sfx/sfxMemoryStream.cpp b/Engine/source/sfx/sfxMemoryStream.cpp index d7e04785f..6dcdbc60c 100644 --- a/Engine/source/sfx/sfxMemoryStream.cpp +++ b/Engine/source/sfx/sfxMemoryStream.cpp @@ -80,13 +80,13 @@ U32 SFXMemoryStream::read( U8* buffer, U32 length ) if( numBytesLeftInCurrentPacket ) { - const U32 numBytesToCopy = getMin( numBytesLeftInCurrentPacket, numBytesLeftToCopy ); - dMemcpy( &buffer[ bufferOffset ], &mCurrentPacket->data[ mCurrentPacketOffset ], numBytesToCopy ); + const U32 remainingNumBytesToCopy = getMin( numBytesLeftInCurrentPacket, numBytesLeftToCopy ); + dMemcpy( &buffer[ bufferOffset ], &mCurrentPacket->data[ mCurrentPacketOffset ], remainingNumBytesToCopy); - bufferOffset += numBytesToCopy; - mCurrentPacketOffset += numBytesToCopy; - numBytesLeftInCurrentPacket -= numBytesToCopy; - numBytesLeftToCopy -= numBytesToCopy; + bufferOffset += remainingNumBytesToCopy; + mCurrentPacketOffset += remainingNumBytesToCopy; + numBytesLeftInCurrentPacket -= remainingNumBytesToCopy; + numBytesLeftToCopy -= remainingNumBytesToCopy; } // Discard the packet if there's no data left. From 02541ab1f9dafb3b216ab3f1bce68131051a3d82 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 18:07:58 -0500 Subject: [PATCH 184/312] shader hooks and gen cleanups --- Engine/source/materials/shaderData.cpp | 10 +++++----- Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 6 +++--- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Engine/source/materials/shaderData.cpp b/Engine/source/materials/shaderData.cpp index 3a80c0ac5..d8f4befaf 100644 --- a/Engine/source/materials/shaderData.cpp +++ b/Engine/source/materials/shaderData.cpp @@ -363,17 +363,17 @@ bool ShaderData::_checkDefinition(GFXShader *shader) { if( !shader->findShaderConstHandle( String::ToString("$rtParams%d", pos)) ) { - String error = String::ToString("ShaderData(%s) sampler[%d] used but rtParams%d not used in shader compilation. Possible error", shader->getPixelShaderFile().c_str(), pos, pos); - Con::errorf( error ); + String errStr = String::ToString("ShaderData(%s) sampler[%d] used but rtParams%d not used in shader compilation. Possible error", shader->getPixelShaderFile().c_str(), pos, pos); + Con::errorf(errStr); error = true; } } if(!find) { - String error = String::ToString("ShaderData(%s) sampler %s not defined", shader->getPixelShaderFile().c_str(), samplers[i].c_str()); - Con::errorf(error ); - GFXAssertFatal(0, error ); + String errStr = String::ToString("ShaderData(%s) sampler %s not defined", shader->getPixelShaderFile().c_str(), samplers[i].c_str()); + Con::errorf(errStr); + GFXAssertFatal(0, errStr); error = true; } } diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 5a6f5abd2..ab9bdb25b 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -1105,7 +1105,7 @@ void DiffuseFeatureGLSL::processPix( Vector &componentList, targ = ShaderFeature::RenderTarget1; col = (Var*)LangElement::find("col1"); - MultiLine * meta = new MultiLine; + meta = new MultiLine; if (!col) { // create color var @@ -1154,7 +1154,7 @@ void DiffuseVertColorFeatureGLSL::processVert( Vector< ShaderComponent* >& comp ShaderConnector* connectComp = dynamic_cast< ShaderConnector* >( componentList[ C_CONNECTOR ] ); AssertFatal( connectComp, "DiffuseVertColorFeatureGLSL::processVert - C_CONNECTOR is not a ShaderConnector" ); - Var* outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "vec4" ); @@ -1455,7 +1455,7 @@ void VertLitGLSL::processVert( Vector &componentList, { // Grab the connector color ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); - Var *outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "vec4" ); diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index c665d0044..6a3c296a8 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -1109,7 +1109,6 @@ void DiffuseFeatureHLSL::processPix( Vector &componentList, targ = ShaderFeature::RenderTarget1; col = (Var*)LangElement::find("col1"); - MultiLine * meta = new MultiLine; if (!col) { // create color var @@ -1158,7 +1157,7 @@ void DiffuseVertColorFeatureHLSL::processVert( Vector< ShaderComponent* >& comp ShaderConnector* connectComp = dynamic_cast< ShaderConnector* >( componentList[ C_CONNECTOR ] ); AssertFatal( connectComp, "DiffuseVertColorFeatureGLSL::processVert - C_CONNECTOR is not a ShaderConnector" ); - Var* outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "float4" ); @@ -1487,7 +1486,7 @@ void VertLitHLSL::processVert( Vector &componentList, // Grab the connector color ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); - Var *outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "float4" ); From 3d55bf614193190877669d4c77cc74aa252fda0b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 19:27:47 -0500 Subject: [PATCH 185/312] clean up unnecessary global char buffer[100] define --- Engine/source/afx/afxCamera.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index 63ad635ac..d6fb5f21b 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -450,8 +450,6 @@ const char* afxCamera::getMode() //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // Console Methods -static char buffer[100]; - ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8, "(GameBase orbitObject, TransformF mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" "Set the camera to orbit around some given object.\n\n" @@ -493,6 +491,7 @@ ConsoleMethod( afxCamera, getPosition, const char *, 2, 2, "()" "@returns A string of form \"x y z\".") { Point3F& pos = object->getPosition(); + char buffer[100]; dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); return buffer; } @@ -558,6 +557,7 @@ ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, P ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()") { const Point3F& pos = object->getThirdPersonOffset(); + char buffer[100]; dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); return buffer; } @@ -565,6 +565,7 @@ ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()") ConsoleMethod(afxCamera, getThirdPersonCOIOffset, const char *, 2, 2, "()") { const Point3F& pos = object->getThirdPersonCOIOffset(); + char buffer[100]; dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); return buffer; } From 6e0c24023fc0aec23f904f129a1a5241c9e30a62 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 19:29:08 -0500 Subject: [PATCH 186/312] MountedImage& image = mMountedImageList[i]; clarification cases --- Engine/source/T3D/shapeBase.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 923714a5d..71f826aa4 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -3315,23 +3315,23 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream) bool datablockChange = image.dataBlock != imageData; if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle)) { - MountedImage& image = mMountedImageList[i]; - image.scriptAnimPrefix = scriptDesiredAnimPrefix; + MountedImage& neoImage = mMountedImageList[i]; + neoImage.scriptAnimPrefix = scriptDesiredAnimPrefix; setImage( i, imageData, - skinDesiredNameHandle, image.loaded, - image.ammo, image.triggerDown, image.altTriggerDown, - image.motion, image.genericTrigger[0], image.genericTrigger[1], image.genericTrigger[2], image.genericTrigger[3], - image.target); + skinDesiredNameHandle, neoImage.loaded, + neoImage.ammo, neoImage.triggerDown, neoImage.altTriggerDown, + neoImage.motion, neoImage.genericTrigger[0], neoImage.genericTrigger[1], neoImage.genericTrigger[2], neoImage.genericTrigger[3], + neoImage.target); } if (!datablockChange && image.scriptAnimPrefix != scriptDesiredAnimPrefix) { // We don't have a new image, but we do have a new script anim prefix to work with. // Notify the image of this change. - MountedImage& image = mMountedImageList[i]; - image.scriptAnimPrefix = scriptDesiredAnimPrefix; - updateAnimThread(i, getImageShapeIndex(image)); + MountedImage& animImage = mMountedImageList[i]; + animImage.scriptAnimPrefix = scriptDesiredAnimPrefix; + updateAnimThread(i, getImageShapeIndex(animImage)); } bool isFiring = stream->readFlag(); @@ -3586,8 +3586,8 @@ void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFe U32 numVerts = emitString[currPos++]; for (i = 0; i < numVerts; i++) { cf->mVertexList.increment(); - U32 index = emitString[currPos++]; - mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last()); + U32 vListIDx = emitString[currPos++]; + mat.mulP(pAccel->vertexList[vListIDx], &cf->mVertexList.last()); } U32 numEdges = emitString[currPos++]; From 96169bc151673b98902ca3e6f9b477996996fa1a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:24:37 -0500 Subject: [PATCH 187/312] ribbon classvar cleanup --- Engine/source/T3D/fx/ribbon.cpp | 6 +++--- Engine/source/T3D/fx/ribbon.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/T3D/fx/ribbon.cpp b/Engine/source/T3D/fx/ribbon.cpp index 9dddd8131..a3d788590 100644 --- a/Engine/source/T3D/fx/ribbon.cpp +++ b/Engine/source/T3D/fx/ribbon.cpp @@ -508,10 +508,10 @@ void Ribbon::prepRenderImage(SceneRenderState *state) // Set up our vertex buffer and primitive buffer if(mUpdateBuffers) - createBuffers(state, verts, primBuffer, segments); + createBuffers(state, mVerts, mPrimBuffer, segments); - ri->vertBuff = &verts; - ri->primBuff = &primBuffer; + ri->vertBuff = &mVerts; + ri->primBuff = &mPrimBuffer; ri->visibility = 1.0f; ri->prim = renderPass->allocPrim(); diff --git a/Engine/source/T3D/fx/ribbon.h b/Engine/source/T3D/fx/ribbon.h index 36faf03c1..954dd3cf0 100644 --- a/Engine/source/T3D/fx/ribbon.h +++ b/Engine/source/T3D/fx/ribbon.h @@ -99,8 +99,8 @@ class Ribbon : public GameBase BaseMatInstance *mRibbonMat; MaterialParameterHandle* mRadiusSC; MaterialParameterHandle* mRibbonProjSC; - GFXPrimitiveBufferHandle primBuffer; - GFXVertexBufferHandle verts; + GFXPrimitiveBufferHandle mPrimBuffer; + GFXVertexBufferHandle mVerts; protected: From aad3578d1c7ac4329cd899683494400145bea9df Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:25:02 -0500 Subject: [PATCH 188/312] sfx shadowvar cleanup --- Engine/source/sfx/sfxDevice.cpp | 4 ++-- Engine/source/sfx/sfxSoundscape.cpp | 12 ++++++------ Engine/source/sfx/sfxSystem.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Engine/source/sfx/sfxDevice.cpp b/Engine/source/sfx/sfxDevice.cpp index 3bb37f68f..4e9576774 100644 --- a/Engine/source/sfx/sfxDevice.cpp +++ b/Engine/source/sfx/sfxDevice.cpp @@ -168,9 +168,9 @@ void SFXDevice::_removeBuffer( SFXBuffer* buffer ) BufferIterator iter = find( mBuffers.begin(), mBuffers.end(), buffer ); if( iter != mBuffers.end() ) { - SFXBuffer* buffer = *iter; + SFXBuffer* curBuf = *iter; - mStatNumBufferBytes -= buffer->getMemoryUsed(); + mStatNumBufferBytes -= curBuf->getMemoryUsed(); mStatNumBuffers --; mBuffers.erase( iter ); diff --git a/Engine/source/sfx/sfxSoundscape.cpp b/Engine/source/sfx/sfxSoundscape.cpp index afd41f842..855ebd2be 100644 --- a/Engine/source/sfx/sfxSoundscape.cpp +++ b/Engine/source/sfx/sfxSoundscape.cpp @@ -174,18 +174,18 @@ void SFXSoundscapeManager::update() // Activate SFXStates on the ambience. For state slots that // have changed, deactivate states that we have already activated. - for( U32 i = 0; i < SFXAmbience::MaxStates; ++ i ) + for( U32 ambState = 0; ambState < SFXAmbience::MaxStates; ++ambState) { - SFXState* state = ambience->getState( i ); - if( soundscape->mStates[ i ] != state ) + SFXState* state = ambience->getState(ambState); + if( soundscape->mStates[ambState] != state ) { - if( soundscape->mStates[ i ] ) - soundscape->mStates[ i ]->deactivate(); + if( soundscape->mStates[ambState] ) + soundscape->mStates[ambState]->deactivate(); if( state ) state->activate(); - soundscape->mStates[ i ] = state; + soundscape->mStates[ambState] = state; } } diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index 0ad80df6e..28cfde3e9 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -674,9 +674,9 @@ void SFXSystem::_onRemoveSource( SFXSource* source ) { // Check if it was a play once source. - Vector< SFXSource* >::iterator iter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); - if ( iter != mPlayOnceSources.end() ) - mPlayOnceSources.erase_fast( iter ); + Vector< SFXSource* >::iterator sourceIter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); + if (sourceIter != mPlayOnceSources.end() ) + mPlayOnceSources.erase_fast(sourceIter); // Update the stats. @@ -684,9 +684,9 @@ void SFXSystem::_onRemoveSource( SFXSource* source ) if( dynamic_cast< SFXSound* >( source ) ) { - SFXSoundVector::iterator iter = find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) ); - if( iter != mSounds.end() ) - mSounds.erase_fast( iter ); + SFXSoundVector::iterator vectorIter = find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) ); + if(vectorIter != mSounds.end() ) + mSounds.erase_fast(vectorIter); mStatNumSounds = mSounds.size(); } From 33ebe3444090714901ba8159280e07ac670361bb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:25:45 -0500 Subject: [PATCH 189/312] more gfx shadowvar cleanups --- .../advanced/glsl/advancedLightingFeaturesGLSL.cpp | 2 +- .../advanced/hlsl/advancedLightingFeaturesHLSL.cpp | 4 ++-- .../source/lighting/shadowMap/pssmLightShadowMap.cpp | 2 +- Engine/source/materials/processedShaderMaterial.cpp | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp index f1223f7b0..9ac194cff 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp @@ -350,7 +350,7 @@ void DeferredBumpFeatGLSL::processPix( Vector &componentList, if (fd.features.hasFeature(MFT_DetailNormalMap)) { - Var *bumpMap = (Var*)LangElement::find("detailBumpMap"); + bumpMap = (Var*)LangElement::find("detailBumpMap"); if (!bumpMap) { bumpMap = new Var; bumpMap->setType("sampler2D"); diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index 7255ea564..7e3564350 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -367,7 +367,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &componentList, if ( fd.features.hasFeature( MFT_DetailNormalMap ) ) { - Var *bumpMap = (Var*)LangElement::find( "detailBumpMap" ); + bumpMap = (Var*)LangElement::find( "detailBumpMap" ); if ( !bumpMap ) { bumpMap = new Var; @@ -378,7 +378,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &componentList, bumpMap->constNum = Var::getTexUnitNum(); } - Var* bumpMapTex = (Var*)LangElement::find("detailBumpMap"); + bumpMapTex = (Var*)LangElement::find("detailBumpMap"); if (!bumpMapTex) { bumpMap->setType("SamplerState"); diff --git a/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp b/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp index d276fe3a5..c9ac7e2e3 100644 --- a/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp +++ b/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp @@ -254,7 +254,7 @@ void PSSMLightShadowMap::_render( RenderPassManager* renderPass, for (U32 i = 0; i < mNumSplits; i++) { - GFXTransformSaver saver; + GFXTransformSaver splitSaver; // Calculate a sub-frustum Frustum subFrustum(fullFrustum); diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 4fb2acc94..e433a354c 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -531,9 +531,9 @@ bool ProcessedShaderMaterial::_createPasses( MaterialFeatureData &stageFeatures, ShaderRenderPassData passData; U32 texIndex = 0; - for( U32 i=0; i < FEATUREMGR->getFeatureCount(); i++ ) + for( U32 featureIDx=0; featureIDx < FEATUREMGR->getFeatureCount(); featureIDx++ ) { - const FeatureInfo &info = FEATUREMGR->getAt( i ); + const FeatureInfo &info = FEATUREMGR->getAt(featureIDx); if ( !stageFeatures.features.hasFeature( *info.type ) ) continue; @@ -562,7 +562,7 @@ bool ProcessedShaderMaterial::_createPasses( MaterialFeatureData &stageFeatures, #if defined(TORQUE_DEBUG) && defined( TORQUE_OPENGL) if(oldTexNumber != texIndex) { - for(int i = oldTexNumber; i < texIndex; i++) + for(int texNum = oldTexNumber; texNum < texIndex; texNum++) { AssertFatal(passData.mSamplerNames[ oldTexNumber ].isNotEmpty(), avar( "ERROR: ShaderGen feature %s don't set used sampler name", info.feature->getName().c_str()) ); } @@ -579,9 +579,9 @@ bool ProcessedShaderMaterial::_createPasses( MaterialFeatureData &stageFeatures, } #if defined(TORQUE_DEBUG) && defined( TORQUE_OPENGL) - for(int i = 0; i < texIndex; i++) + for(int samplerIDx = 0; samplerIDx < texIndex; samplerIDx++) { - AssertFatal(passData.mSamplerNames[ i ].isNotEmpty(),""); + AssertFatal(passData.mSamplerNames[samplerIDx].isNotEmpty(),""); } #endif From ebf3f2d97182f9e0eca114e9aa302a50e330fb58 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:26:27 -0500 Subject: [PATCH 190/312] reflector classvar cleanups --- Engine/source/scene/reflector.cpp | 34 +++++++++++++++---------------- Engine/source/scene/reflector.h | 8 ++++---- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Engine/source/scene/reflector.cpp b/Engine/source/scene/reflector.cpp index 5d9bdc3a8..ecaabc43a 100644 --- a/Engine/source/scene/reflector.cpp +++ b/Engine/source/scene/reflector.cpp @@ -315,20 +315,20 @@ void CubeReflector::updateReflection( const ReflectParams ¶ms ) const GFXFormat reflectFormat = REFLECTMGR->getReflectFormat(); if ( texResize || - cubemap.isNull() || - cubemap->getFormat() != reflectFormat ) + mCubemap.isNull() || + mCubemap->getFormat() != reflectFormat ) { - cubemap = GFX->createCubemap(); - cubemap->initDynamic( texDim, reflectFormat ); + mCubemap = GFX->createCubemap(); + mCubemap->initDynamic( texDim, reflectFormat ); } - GFXTexHandle depthBuff = LightShadowMap::_getDepthTarget( texDim, texDim ); + mDepthBuff = LightShadowMap::_getDepthTarget( texDim, texDim ); - if ( renderTarget.isNull() ) - renderTarget = GFX->allocRenderToTextureTarget(); + if ( mRenderTarget.isNull() ) + mRenderTarget = GFX->allocRenderToTextureTarget(); GFX->pushActiveRenderTarget(); - renderTarget->attachTexture( GFXTextureTarget::DepthStencil, depthBuff ); + mRenderTarget->attachTexture( GFXTextureTarget::DepthStencil, mDepthBuff ); F32 oldVisibleDist = gClientSceneGraph->getVisibleDistance(); @@ -407,8 +407,8 @@ void CubeReflector::updateFace( const ReflectParams ¶ms, U32 faceidx ) GFX->setWorldMatrix(matView); GFX->clearTextureStateImmediate(0); - renderTarget->attachTexture( GFXTextureTarget::Color0, cubemap, faceidx ); - GFX->setActiveRenderTarget( renderTarget ); + mRenderTarget->attachTexture( GFXTextureTarget::Color0, mCubemap, faceidx ); + GFX->setActiveRenderTarget(mRenderTarget); GFX->clear( GFXClearStencil | GFXClearTarget | GFXClearZBuffer, gCanvasClearColor, 1.0f, 0 ); SceneRenderState reflectRenderState @@ -427,7 +427,7 @@ void CubeReflector::updateFace( const ReflectParams ¶ms, U32 faceidx ) LIGHTMGR->unregisterAllLights(); // Clean up. - renderTarget->resolve(); + mRenderTarget->resolve(); } F32 CubeReflector::calcFaceScore( const ReflectParams ¶ms, U32 faceidx ) @@ -746,18 +746,18 @@ void PlaneReflector::setGFXMatrices( const MatrixF &camTrans ) MatrixF relCamTrans = invObjTrans * camTrans; MatrixF camReflectTrans = getCameraReflection( relCamTrans ); - MatrixF camTrans = mObject->getRenderTransform() * camReflectTrans; - camTrans.inverse(); + MatrixF objTrans = mObject->getRenderTransform() * camReflectTrans; + objTrans.inverse(); - GFX->setWorldMatrix( camTrans ); + GFX->setWorldMatrix(objTrans); // use relative reflect transform for modelview since clip plane is in object space - camTrans = camReflectTrans; - camTrans.inverse(); + objTrans = camReflectTrans; + objTrans.inverse(); // set new projection matrix gClientSceneGraph->setNonClipProjection( (MatrixF&) GFX->getProjectionMatrix() ); - MatrixF clipProj = getFrustumClipProj( camTrans ); + MatrixF clipProj = getFrustumClipProj(objTrans); GFX->setProjectionMatrix( clipProj ); } else diff --git a/Engine/source/scene/reflector.h b/Engine/source/scene/reflector.h index c0646d30d..fd0f3e08c 100644 --- a/Engine/source/scene/reflector.h +++ b/Engine/source/scene/reflector.h @@ -153,16 +153,16 @@ public: virtual void unregisterReflector(); virtual void updateReflection( const ReflectParams ¶ms ); - GFXCubemap* getCubemap() const { return cubemap; } + GFXCubemap* getCubemap() const { return mCubemap; } void updateFace( const ReflectParams ¶ms, U32 faceidx ); F32 calcFaceScore( const ReflectParams ¶ms, U32 faceidx ); protected: - GFXTexHandle depthBuff; - GFXTextureTargetRef renderTarget; - GFXCubemapHandle cubemap; + GFXTexHandle mDepthBuff; + GFXTextureTargetRef mRenderTarget; + GFXCubemapHandle mCubemap; U32 mLastTexSize; class CubeFaceReflector : public ReflectorBase From 386efa06025a27019ff3bf6eee6650934cceea7b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:27:31 -0500 Subject: [PATCH 191/312] netObject classvar cleanups --- Engine/source/T3D/gameBase/gameBase.cpp | 14 +++++++------- Engine/source/afx/afxChoreographer.cpp | 4 ++-- Engine/source/sim/netObject.cpp | 22 +++++++++++----------- Engine/source/sim/netObject.h | 12 ++++++------ Engine/source/util/scopeTracker.h | 6 +++--- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index 23b8a67bb..d6afda811 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -259,7 +259,7 @@ GameBase::GameBase() GameBase::~GameBase() { #ifdef TORQUE_AFX_ENABLED - if (scope_registered) + if (mScope_registered) arcaneFX::unregisterScopedObject(this); #endif } @@ -277,7 +277,7 @@ bool GameBase::onAdd() #ifdef TORQUE_AFX_ENABLED if (isClientObject()) { - if (scope_id > 0 && !scope_registered) + if (mScope_id > 0 && !mScope_registered) arcaneFX::registerScopedObject(this); } else @@ -298,7 +298,7 @@ bool GameBase::onAdd() void GameBase::onRemove() { #ifdef TORQUE_AFX_ENABLED - if (scope_registered) + if (mScope_registered) arcaneFX::unregisterScopedObject(this); #endif // EDITOR FEATURE: Remove us from the reload signal of our datablock. @@ -586,8 +586,8 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream #ifdef TORQUE_AFX_ENABLED if (stream->writeFlag(mask & ScopeIdMask)) { - if (stream->writeFlag(scope_refs > 0)) - stream->writeInt(scope_id, SCOPE_ID_BITS); + if (stream->writeFlag(mScope_refs > 0)) + stream->writeInt(mScope_id, SCOPE_ID_BITS); } #endif return retMask; @@ -631,8 +631,8 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream) #ifdef TORQUE_AFX_ENABLED if (stream->readFlag()) { - scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; - scope_refs = 0; + mScope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; + mScope_refs = 0; } #endif } diff --git a/Engine/source/afx/afxChoreographer.cpp b/Engine/source/afx/afxChoreographer.cpp index e0f20fa75..d1b4d9069 100644 --- a/Engine/source/afx/afxChoreographer.cpp +++ b/Engine/source/afx/afxChoreographer.cpp @@ -331,9 +331,9 @@ void afxChoreographer::unpack_constraint_info(NetConnection* conn, BitStream* st { if (stream->readFlag()) { - U16 scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mScope_id = stream->readInt(NetObject::SCOPE_ID_BITS); bool is_shape = stream->readFlag(); - addObjectConstraint(scope_id, cons_name, is_shape); + addObjectConstraint(mScope_id, cons_name, is_shape); } } } diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index a77869883..25c5e3657 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -56,9 +56,9 @@ NetObject::NetObject() mNextDirtyList = NULL; mDirtyMaskBits = 0; #ifdef TORQUE_AFX_ENABLED - scope_id = 0; - scope_refs = 0; - scope_registered = false; + mScope_id = 0; + mScope_refs = 0; + mScope_registered = false; #endif } @@ -478,23 +478,23 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),, #ifdef TORQUE_AFX_ENABLED U16 NetObject::addScopeRef() { - if (scope_refs == 0) + if (mScope_refs == 0) { - scope_id = arcaneFX::generateScopeId(); + mScope_id = arcaneFX::generateScopeId(); onScopeIdChange(); } - scope_refs++; - return scope_id; + mScope_refs++; + return mScope_id; } void NetObject::removeScopeRef() { - if (scope_refs == 0) + if (mScope_refs == 0) return; - scope_refs--; - if (scope_refs == 0) + mScope_refs--; + if (mScope_refs == 0) { - scope_id = 0; + mScope_id = 0; onScopeIdChange(); } } diff --git a/Engine/source/sim/netObject.h b/Engine/source/sim/netObject.h index 7ea1283c4..1ba588944 100644 --- a/Engine/source/sim/netObject.h +++ b/Engine/source/sim/netObject.h @@ -411,17 +411,17 @@ public: /// @} protected: - U16 scope_id; - U16 scope_refs; - bool scope_registered; + U16 mScope_id; + U16 mScope_refs; + bool mScope_registered; virtual void onScopeIdChange() { } public: enum { SCOPE_ID_BITS = 14 }; - U16 getScopeId() const { return scope_id; } + U16 getScopeId() const { return mScope_id; } U16 addScopeRef(); void removeScopeRef(); - void setScopeRegistered(bool flag) { scope_registered = flag; } - bool getScopeRegistered() const { return scope_registered; } + void setScopeRegistered(bool flag) { mScope_registered = flag; } + bool getScopeRegistered() const { return mScope_registered; } protected: /// Add a networked field diff --git a/Engine/source/util/scopeTracker.h b/Engine/source/util/scopeTracker.h index c58711ca0..ecbf0fac9 100644 --- a/Engine/source/util/scopeTracker.h +++ b/Engine/source/util/scopeTracker.h @@ -515,11 +515,11 @@ void ScopeTracker< NUM_DIMENSIONS, Object >::updateObject( Object object ) while( !mPotentialScopeInObjects.empty() ) { - Object object = mPotentialScopeInObjects.last(); + Object obj = mPotentialScopeInObjects.last(); mPotentialScopeInObjects.decrement(); - if( Deref( object ).isInScope() ) - _onScopeIn( object ); + if( Deref(obj).isInScope() ) + _onScopeIn(obj); } } else From 1e65a01cf9c5536d8efff52b24f22da794c2e514 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:29:09 -0500 Subject: [PATCH 192/312] shadowvar cleanups for scattersky and accumulationVolume --- Engine/source/T3D/accumulationVolume.cpp | 6 +++--- Engine/source/environment/scatterSky.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/T3D/accumulationVolume.cpp b/Engine/source/T3D/accumulationVolume.cpp index 2d44d7178..4c2e8b009 100644 --- a/Engine/source/T3D/accumulationVolume.cpp +++ b/Engine/source/T3D/accumulationVolume.cpp @@ -206,11 +206,11 @@ void AccumulationVolume::buildSilhouette( const SceneCameraState& cameraState, V if( mTransformDirty ) { - const U32 numPoints = mPolyhedron.getNumPoints(); + const U32 numPolyPoints = mPolyhedron.getNumPoints(); const PolyhedronType::PointType* points = getPolyhedron().getPoints(); - mWSPoints.setSize( numPoints ); - for( U32 i = 0; i < numPoints; ++ i ) + mWSPoints.setSize(numPolyPoints); + for( U32 i = 0; i < numPolyPoints; ++ i ) { Point3F p = points[ i ]; p.convolve( getScale() ); diff --git a/Engine/source/environment/scatterSky.cpp b/Engine/source/environment/scatterSky.cpp index 1b3a60843..2f8d17d00 100644 --- a/Engine/source/environment/scatterSky.cpp +++ b/Engine/source/environment/scatterSky.cpp @@ -690,13 +690,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state ) mMatrixSet->setSceneProjection(GFX->getProjectionMatrix()); mMatrixSet->setWorld(GFX->getWorldMatrix()); - ObjectRenderInst *ri = renderPass->allocInst(); - ri->renderDelegate.bind( this, &ScatterSky::_renderMoon ); - ri->type = RenderPassManager::RIT_Sky; + ObjectRenderInst *moonRI = renderPass->allocInst(); + moonRI->renderDelegate.bind( this, &ScatterSky::_renderMoon ); + moonRI->type = RenderPassManager::RIT_Sky; // Render after sky objects and before CloudLayer! - ri->defaultKey = 5; - ri->defaultKey2 = 0; - renderPass->addInst(ri); + moonRI->defaultKey = 5; + moonRI->defaultKey2 = 0; + renderPass->addInst(moonRI); } } @@ -1346,7 +1346,7 @@ void ScatterSky::_getColor( const Point3F &pos, LinearColorF *outColor ) for ( U32 i = 0; i < 2; i++ ) { F32 fHeight = v3SamplePoint.len(); - F32 fDepth = mExp( scaleOverScaleDepth * (mSphereInnerRadius - smViewerHeight) ); + fDepth = mExp( scaleOverScaleDepth * (mSphereInnerRadius - smViewerHeight) ); F32 fLightAngle = mDot( mLightDir, v3SamplePoint ) / fHeight; F32 fCameraAngle = mDot( v3Ray, v3SamplePoint ) / fHeight; From d80f35bb7d83088d265cd30688055a52cc72b9b2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 13:12:26 -0500 Subject: [PATCH 193/312] layer, and playerControllerComponent shadowvar cleanups --- .../physics/playerControllerComponent.cpp | 7 +- Engine/source/T3D/player.cpp | 218 +++++++++--------- Engine/source/T3D/player.h | 2 +- 3 files changed, 113 insertions(+), 114 deletions(-) diff --git a/Engine/source/T3D/components/physics/playerControllerComponent.cpp b/Engine/source/T3D/components/physics/playerControllerComponent.cpp index 761ac570c..5b7455bfc 100644 --- a/Engine/source/T3D/components/physics/playerControllerComponent.cpp +++ b/Engine/source/T3D/components/physics/playerControllerComponent.cpp @@ -441,16 +441,15 @@ void PlayerControllerComponent::updateMove() // get the head pitch and add it to the moveVec // This more accurate swim vector calc comes from Matt Fairfax - MatrixF xRot, zRot; + MatrixF xRot; xRot.set(EulerF(mOwner->getRotation().asEulerF().x, 0, 0)); - zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z)); + zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z));//reset prior uses MatrixF rot; rot.mul(zRot, xRot); rot.getColumn(0, &moveVec); moveVec *= move->x; - VectorF tv; - rot.getColumn(1, &tv); + rot.getColumn(1, &tv);//reset prior uses moveVec += tv * move->y; rot.getColumn(2, &tv); moveVec += tv * move->z; diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 15b57046a..0399f6694 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -1577,20 +1577,20 @@ Player::Player() { mTypeMask |= PlayerObjectType | DynamicShapeObjectType; - delta.pos = mAnchorPoint = Point3F(0,0,100); - delta.rot = delta.head = Point3F(0,0,0); - delta.rotOffset.set(0.0f,0.0f,0.0f); - delta.warpOffset.set(0.0f,0.0f,0.0f); - delta.posVec.set(0.0f,0.0f,0.0f); - delta.rotVec.set(0.0f,0.0f,0.0f); - delta.headVec.set(0.0f,0.0f,0.0f); - delta.warpTicks = 0; - delta.dt = 1.0f; - delta.move = NullMove; + mDelta.pos = mAnchorPoint = Point3F(0,0,100); + mDelta.rot = mDelta.head = Point3F(0,0,0); + mDelta.rotOffset.set(0.0f,0.0f,0.0f); + mDelta.warpOffset.set(0.0f,0.0f,0.0f); + mDelta.posVec.set(0.0f,0.0f,0.0f); + mDelta.rotVec.set(0.0f,0.0f,0.0f); + mDelta.headVec.set(0.0f,0.0f,0.0f); + mDelta.warpTicks = 0; + mDelta.dt = 1.0f; + mDelta.move = NullMove; mPredictionCount = sMaxPredictionTicks; - mObjToWorld.setColumn(3,delta.pos); - mRot = delta.rot; - mHead = delta.head; + mObjToWorld.setColumn(3, mDelta.pos); + mRot = mDelta.rot; + mHead = mDelta.head; mVelocity.set(0.0f, 0.0f, 0.0f); mDataBlock = 0; mHeadHThread = mHeadVThread = mRecoilThread = mImageStateThread = 0; @@ -2103,30 +2103,30 @@ void Player::processTick(const Move* move) } } // Warp to catch up to server - if (delta.warpTicks > 0) { - delta.warpTicks--; + if (mDelta.warpTicks > 0) { + mDelta.warpTicks--; // Set new pos - getTransform().getColumn(3, &delta.pos); - delta.pos += delta.warpOffset; - delta.rot += delta.rotOffset; + getTransform().getColumn(3, &mDelta.pos); + mDelta.pos += mDelta.warpOffset; + mDelta.rot += mDelta.rotOffset; // Wrap yaw to +/-PI - if (delta.rot.z < - M_PI_F) - delta.rot.z += M_2PI_F; - else if (delta.rot.z > M_PI_F) - delta.rot.z -= M_2PI_F; + if (mDelta.rot.z < - M_PI_F) + mDelta.rot.z += M_2PI_F; + else if (mDelta.rot.z > M_PI_F) + mDelta.rot.z -= M_2PI_F; if (!ignore_updates) { - setPosition(delta.pos,delta.rot); + setPosition(mDelta.pos, mDelta.rot); } updateDeathOffsets(); updateLookAnimation(); // Backstepping - delta.posVec = -delta.warpOffset; - delta.rotVec = -delta.rotOffset; + mDelta.posVec = -mDelta.warpOffset; + mDelta.rotVec = -mDelta.rotOffset; } else { // If there is no move, the player is either an @@ -2139,7 +2139,7 @@ void Player::processTick(const Move* move) if (mPredictionCount-- <= 0) return; - move = &delta.move; + move = &mDelta.move; } else move = &NullMove; @@ -2215,8 +2215,8 @@ void Player::interpolateTick(F32 dt) // Client side interpolation Parent::interpolateTick(dt); - Point3F pos = delta.pos + delta.posVec * dt; - Point3F rot = delta.rot + delta.rotVec * dt; + Point3F pos = mDelta.pos + mDelta.posVec * dt; + Point3F rot = mDelta.rot + mDelta.rotVec * dt; if (!ignore_updates) setRenderPosition(pos,rot,dt); @@ -2237,7 +2237,7 @@ void Player::interpolateTick(F32 dt) */ updateLookAnimation(dt); - delta.dt = dt; + mDelta.dt = dt; } void Player::advanceTime(F32 dt) @@ -2561,7 +2561,7 @@ void Player::updateMove(const Move* move) } move = &my_move; } - delta.move = *move; + mDelta.move = *move; #ifdef TORQUE_OPENVR if (mControllers[0]) @@ -2611,7 +2611,7 @@ void Player::updateMove(const Move* move) // Update current orientation if (mDamageState == Enabled) { F32 prevZRot = mRot.z; - delta.headVec = mHead; + mDelta.headVec = mHead; bool doStandardMove = true; bool absoluteDelta = false; @@ -2772,29 +2772,29 @@ void Player::updateMove(const Move* move) mRot.z -= M_2PI_F; } - delta.rot = mRot; - delta.rotVec.x = delta.rotVec.y = 0.0f; - delta.rotVec.z = prevZRot - mRot.z; - if (delta.rotVec.z > M_PI_F) - delta.rotVec.z -= M_2PI_F; - else if (delta.rotVec.z < -M_PI_F) - delta.rotVec.z += M_2PI_F; + mDelta.rot = mRot; + mDelta.rotVec.x = mDelta.rotVec.y = 0.0f; + mDelta.rotVec.z = prevZRot - mRot.z; + if (mDelta.rotVec.z > M_PI_F) + mDelta.rotVec.z -= M_2PI_F; + else if (mDelta.rotVec.z < -M_PI_F) + mDelta.rotVec.z += M_2PI_F; - delta.head = mHead; - delta.headVec -= mHead; + mDelta.head = mHead; + mDelta.headVec -= mHead; if (absoluteDelta) { - delta.headVec = Point3F(0, 0, 0); - delta.rotVec = Point3F(0, 0, 0); + mDelta.headVec = Point3F(0, 0, 0); + mDelta.rotVec = Point3F(0, 0, 0); } for(U32 i=0; i<3; ++i) { - if (delta.headVec[i] > M_PI_F) - delta.headVec[i] -= M_2PI_F; - else if (delta.headVec[i] < -M_PI_F) - delta.headVec[i] += M_2PI_F; + if (mDelta.headVec[i] > M_PI_F) + mDelta.headVec[i] -= M_2PI_F; + else if (mDelta.headVec[i] < -M_PI_F) + mDelta.headVec[i] += M_2PI_F; } } MatrixF zRot; @@ -3028,7 +3028,7 @@ void Player::updateMove(const Move* move) // get the head pitch and add it to the moveVec // This more accurate swim vector calc comes from Matt Fairfax - MatrixF xRot, zRot; + MatrixF xRot; xRot.set(EulerF(mHead.x, 0, 0)); zRot.set(EulerF(0, 0, mRot.z)); MatrixF rot; @@ -3583,7 +3583,7 @@ void Player::updateLookAnimation(F32 dt) return; } // Calculate our interpolated head position. - Point3F renderHead = delta.head + delta.headVec * dt; + Point3F renderHead = mDelta.head + mDelta.headVec * dt; // Adjust look pos. This assumes that the animations match // the min and max look angles provided in the datablock. @@ -4421,8 +4421,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire if (!found && hasImageBasePrefix && hasScriptPrefix) { - String seqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName; - S32 index = mShapeInstance->getShape()->findSequence(seqName); + String comboSeqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName; + S32 index = mShapeInstance->getShape()->findSequence(comboSeqName); if (index != -1) { seqIndex = index; @@ -4432,8 +4432,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire if (!found && hasImageBasePrefix) { - String seqName = String(imageBasePrefix) + String("_") + baseSeqName; - S32 index = mShapeInstance->getShape()->findSequence(seqName); + String imgSeqName = String(imageBasePrefix) + String("_") + baseSeqName; + S32 index = mShapeInstance->getShape()->findSequence(imgSeqName); if (index != -1) { seqIndex = index; @@ -4443,8 +4443,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire if (!found && hasScriptPrefix) { - String seqName = String(scriptPrefix) + String("_") + baseSeqName; - S32 index = mShapeInstance->getShape()->findSequence(seqName); + String scriptSeqName = String(scriptPrefix) + String("_") + baseSeqName; + S32 index = mShapeInstance->getShape()->findSequence(scriptSeqName); if (index != -1) { seqIndex = index; @@ -5113,7 +5113,7 @@ void Player::_handleCollision( const Collision &collision ) bool Player::updatePos(const F32 travelTime) { PROFILE_SCOPE(Player_UpdatePos); - getTransform().getColumn(3,&delta.posVec); + getTransform().getColumn(3,&mDelta.posVec); // When mounted to another object, only Z rotation used. if (isMounted()) { @@ -5205,7 +5205,7 @@ bool Player::updatePos(const F32 travelTime) else { if ( mVelocity.isZero() ) - newPos = delta.posVec; + newPos = mDelta.posVec; else newPos = _move( travelTime, &col ); @@ -5222,9 +5222,9 @@ bool Player::updatePos(const F32 travelTime) // If on the client, calc delta for backstepping if (isClientObject()) { - delta.pos = newPos; - delta.posVec = delta.posVec - delta.pos; - delta.dt = 1.0f; + mDelta.pos = newPos; + mDelta.posVec = mDelta.posVec - mDelta.pos; + mDelta.dt = 1.0f; } setPosition( newPos, mRot ); @@ -5460,8 +5460,8 @@ bool Player::displaceObject(const Point3F& displacement) sBalance--; - getTransform().getColumn(3, &delta.pos); - delta.posVec.set(0.0f, 0.0f, 0.0f); + getTransform().getColumn(3, &mDelta.pos); + mDelta.posVec.set(0.0f, 0.0f, 0.0f); return result; } @@ -5480,8 +5480,8 @@ bool Player::displaceObject(const Point3F& displacement) bool result = updatePos(dt); - mObjToWorld.getColumn(3, &delta.pos); - delta.posVec.set(0.0f, 0.0f, 0.0f); + mObjToWorld.getColumn(3, &mDelta.pos); + mDelta.posVec.set(0.0f, 0.0f, 0.0f); return result; } @@ -5684,10 +5684,10 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank) // Eye transform in world space. We only use the eye position // from the animation and supply our own rotation. MatrixF pmat,xmat,zmat; - xmat.set(EulerF(delta.head.x + delta.headVec.x * delta.dt, 0.0f, 0.0f)); + xmat.set(EulerF(mDelta.head.x + mDelta.headVec.x * mDelta.dt, 0.0f, 0.0f)); if (mUseHeadZCalc) - zmat.set(EulerF(0.0f, 0.0f, delta.head.z + delta.headVec.z * delta.dt)); + zmat.set(EulerF(0.0f, 0.0f, mDelta.head.z + mDelta.headVec.z * mDelta.dt)); else zmat.identity(); @@ -5697,7 +5697,7 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank) MatrixF imat; imat.mul(zmat, xmat); MatrixF ymat; - ymat.set(EulerF(0.0f, delta.head.y + delta.headVec.y * delta.dt, 0.0f)); + ymat.set(EulerF(0.0f, mDelta.head.y + mDelta.headVec.y * mDelta.dt, 0.0f)); pmat.mul(imat, ymat); } else @@ -6234,7 +6234,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream) stream->read(&mVelocity.y); stream->read(&mVelocity.z); stream->setCompressionPoint(pos); - delta.pos = pos; + mDelta.pos = pos; mJumpSurfaceLastContact = stream->readInt(4); if (stream->readFlag()) @@ -6257,7 +6257,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream) } } else - pos = delta.pos; + pos = mDelta.pos; stream->read(&mHead.x); if(stream->readFlag()) { @@ -6269,8 +6269,8 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream) rot.x = rot.y = 0; if (!ignore_updates) setPosition(pos,rot); - delta.head = mHead; - delta.rot = rot; + mDelta.head = mHead; + mDelta.rot = rot; if (stream->readFlag()) { S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize); @@ -6348,7 +6348,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->writeFloat(mRot.z / M_2PI_F, 7); stream->writeSignedFloat(mHead.x / (mDataBlock->maxLookAngle - mDataBlock->minLookAngle), 6); stream->writeSignedFloat(mHead.z / mDataBlock->maxFreelookAngle, 6); - delta.move.pack(stream); + mDelta.move.pack(stream); stream->writeFlag(!(mask & NoWarpMask)); } // Ghost need energy to predict reliably @@ -6454,67 +6454,67 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) rot.z = stream->readFloat(7) * M_2PI_F; mHead.x = stream->readSignedFloat(6) * (mDataBlock->maxLookAngle - mDataBlock->minLookAngle); mHead.z = stream->readSignedFloat(6) * mDataBlock->maxFreelookAngle; - delta.move.unpack(stream); + mDelta.move.unpack(stream); - delta.head = mHead; - delta.headVec.set(0.0f, 0.0f, 0.0f); + mDelta.head = mHead; + mDelta.headVec.set(0.0f, 0.0f, 0.0f); if (stream->readFlag() && isProperlyAdded()) { // Determine number of ticks to warp based on the average // of the client and server velocities. - delta.warpOffset = pos - delta.pos; + mDelta.warpOffset = pos - mDelta.pos; F32 as = (speed + mVelocity.len()) * 0.5f * TickSec; - F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks; - delta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); + F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks; + mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - if (delta.warpTicks) + if (mDelta.warpTicks) { // Setup the warp to start on the next tick. - if (delta.warpTicks > sMaxWarpTicks) - delta.warpTicks = sMaxWarpTicks; - delta.warpOffset /= (F32)delta.warpTicks; + if (mDelta.warpTicks > sMaxWarpTicks) + mDelta.warpTicks = sMaxWarpTicks; + mDelta.warpOffset /= (F32)mDelta.warpTicks; - delta.rotOffset = rot - delta.rot; + mDelta.rotOffset = rot - mDelta.rot; // Ignore small rotation differences - if (mFabs(delta.rotOffset.z) < 0.001f) - delta.rotOffset.z = 0; + if (mFabs(mDelta.rotOffset.z) < 0.001f) + mDelta.rotOffset.z = 0; // Wrap rotation to +/-PI - if(delta.rotOffset.z < - M_PI_F) - delta.rotOffset.z += M_2PI_F; - else if(delta.rotOffset.z > M_PI_F) - delta.rotOffset.z -= M_2PI_F; + if(mDelta.rotOffset.z < - M_PI_F) + mDelta.rotOffset.z += M_2PI_F; + else if(mDelta.rotOffset.z > M_PI_F) + mDelta.rotOffset.z -= M_2PI_F; - delta.rotOffset /= (F32)delta.warpTicks; + mDelta.rotOffset /= (F32)mDelta.warpTicks; } else { // Going to skip the warp, server and client are real close. // Adjust the frame interpolation to move smoothly to the // new position within the current tick. - Point3F cp = delta.pos + delta.posVec * delta.dt; - if (delta.dt == 0) + Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; + if (mDelta.dt == 0) { - delta.posVec.set(0.0f, 0.0f, 0.0f); - delta.rotVec.set(0.0f, 0.0f, 0.0f); + mDelta.posVec.set(0.0f, 0.0f, 0.0f); + mDelta.rotVec.set(0.0f, 0.0f, 0.0f); } else { - F32 dti = 1.0f / delta.dt; - delta.posVec = (cp - pos) * dti; - delta.rotVec.z = mRot.z - rot.z; + F32 dti = 1.0f / mDelta.dt; + mDelta.posVec = (cp - pos) * dti; + mDelta.rotVec.z = mRot.z - rot.z; - if(delta.rotVec.z > M_PI_F) - delta.rotVec.z -= M_2PI_F; - else if(delta.rotVec.z < -M_PI_F) - delta.rotVec.z += M_2PI_F; + if(mDelta.rotVec.z > M_PI_F) + mDelta.rotVec.z -= M_2PI_F; + else if(mDelta.rotVec.z < -M_PI_F) + mDelta.rotVec.z += M_2PI_F; - delta.rotVec.z *= dti; + mDelta.rotVec.z *= dti; } - delta.pos = pos; - delta.rot = rot; + mDelta.pos = pos; + mDelta.rot = rot; if (!ignore_updates) setPosition(pos,rot); } @@ -6522,12 +6522,12 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) else { // Set the player to the server position - delta.pos = pos; - delta.rot = rot; - delta.posVec.set(0.0f, 0.0f, 0.0f); - delta.rotVec.set(0.0f, 0.0f, 0.0f); - delta.warpTicks = 0; - delta.dt = 0.0f; + mDelta.pos = pos; + mDelta.rot = rot; + mDelta.posVec.set(0.0f, 0.0f, 0.0f); + mDelta.rotVec.set(0.0f, 0.0f, 0.0f); + mDelta.warpTicks = 0; + mDelta.dt = 0.0f; if (!ignore_updates) setPosition(pos,rot); } diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index 0b4545114..3e1cb5e50 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -436,7 +436,7 @@ protected: Point3F rotOffset; /// @} }; - StateDelta delta; ///< Used for interpolation on the client. @see StateDelta + StateDelta mDelta; ///< Used for interpolation on the client. @see StateDelta S32 mPredictionCount; ///< Number of ticks to predict // Current pos, vel etc. From f559cf4231cfb45aefbfcd3a57d6b3f843943887 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 13:14:39 -0500 Subject: [PATCH 194/312] Polytope::intersect variable differerntiation. --- Engine/source/collision/polytope.cpp | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Engine/source/collision/polytope.cpp b/Engine/source/collision/polytope.cpp index f07116583..127c0a1f3 100644 --- a/Engine/source/collision/polytope.cpp +++ b/Engine/source/collision/polytope.cpp @@ -193,19 +193,19 @@ void Polytope::intersect(SimObject* object,const BSPNode* root) // Split the edge into each volume mEdgeList.increment(2); - Edge& e0 = mEdgeList.last(); - e0.next = frontVolume.edgeList; + Edge& ev0 = mEdgeList.last(); + ev0.next = frontVolume.edgeList; frontVolume.edgeList = mEdgeList.size() - 1; - Edge& e1 = *(&e0 - 1); - e1.next = backVolume.edgeList; + Edge& ev1 = *(&ev0 - 1); + ev1.next = backVolume.edgeList; backVolume.edgeList = frontVolume.edgeList - 1; - e0.vertex[0] = edge.vertex[s]; - e1.vertex[0] = edge.vertex[s ^ 1]; - e0.vertex[1] = e1.vertex[1] = mVertexList.size() - 1; - e0.face[0] = e1.face[0] = edge.face[0]; - e0.face[1] = e1.face[1] = edge.face[1]; + ev0.vertex[0] = edge.vertex[s]; + ev1.vertex[0] = edge.vertex[s ^ 1]; + ev0.vertex[1] = ev1.vertex[1] = mVertexList.size() - 1; + ev0.face[0] = ev1.face[0] = edge.face[0]; + ev0.face[1] = ev1.face[1] = edge.face[1]; // Add new edges on the plane, one to each volume for (S32 f = 0; f < 2; f++) { @@ -214,19 +214,19 @@ void Polytope::intersect(SimObject* object,const BSPNode* root) face.vertex = mVertexList.size() - 1; else { mEdgeList.increment(2); - Edge& e0 = mEdgeList.last(); - e0.next = frontVolume.edgeList; + Edge& ep0 = mEdgeList.last(); + ep0.next = frontVolume.edgeList; frontVolume.edgeList = mEdgeList.size() - 1; - Edge& e1 = *(&e0 - 1); - e1.next = backVolume.edgeList; + Edge& ep1 = *(&ep0 - 1); + ep1.next = backVolume.edgeList; backVolume.edgeList = frontVolume.edgeList - 1; - e1.vertex[0] = e0.vertex[0] = face.vertex; - e1.vertex[1] = e0.vertex[1] = mVertexList.size() - 1; - e1.face[0] = e0.face[0] = edge.face[f]; - e1.face[1] = mFaceList.size() - 1; - e0.face[1] = e1.face[1] - 1; + ep1.vertex[0] = ep0.vertex[0] = face.vertex; + ep1.vertex[1] = ep0.vertex[1] = mVertexList.size() - 1; + ep1.face[0] = ep0.face[0] = edge.face[f]; + ep1.face[1] = mFaceList.size() - 1; + ep0.face[1] = ep1.face[1] - 1; } } } From 50482de41e751201b51b9a52b3157c0c7c2a692a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 13:15:14 -0500 Subject: [PATCH 195/312] duplicate var+assignment --- Engine/source/platform/platformNet.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index a77d29474..6c6d3b234 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -1842,8 +1842,6 @@ void Net::addressToString(const NetAddress *address, char addressString[256]) { char buffer[256]; buffer[0] = '\0'; - sockaddr_in ipAddr; - NetAddressToIPSocket(address, &ipAddr); inet_ntop(AF_INET, &(ipAddr.sin_addr), buffer, sizeof(buffer)); if (ipAddr.sin_port == 0) dSprintf(addressString, 256, "IP:%s", buffer); From 789979d58a608ddd20f8501d1429bec712d74434 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:10:43 -0500 Subject: [PATCH 196/312] duplicated ghostinfo itterator --- Engine/source/sim/netGhost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/sim/netGhost.cpp b/Engine/source/sim/netGhost.cpp index 1b51b0dde..d903d7473 100644 --- a/Engine/source/sim/netGhost.cpp +++ b/Engine/source/sim/netGhost.cpp @@ -428,7 +428,7 @@ void NetConnection::ghostWritePacket(BitStream *bstream, PacketNotify *notify) // for(i = mGhostZeroUpdateIndex - 1; i >= 0 && !bstream->isFull(); i--) { - GhostInfo *walk = mGhostArray[i]; + walk = mGhostArray[i]; if(walk->flags & (GhostInfo::KillingGhost | GhostInfo::Ghosting)) continue; From d0e47ee1eee6f94a1ef65ae15f396b5f8edd1b25 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:13:44 -0500 Subject: [PATCH 197/312] davmesh debug draw membervar cleanup --- Engine/source/navigation/navMesh.cpp | 38 ++++++++++++++-------------- Engine/source/navigation/navMesh.h | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Engine/source/navigation/navMesh.cpp b/Engine/source/navigation/navMesh.cpp index c9bbb1fa4..04283fd1f 100644 --- a/Engine/source/navigation/navMesh.cpp +++ b/Engine/source/navigation/navMesh.cpp @@ -1232,10 +1232,10 @@ bool NavMesh::createCoverPoints() float segs[MAX_SEGS*6]; int nsegs = 0; query->getPolyWallSegments(ref, &f, segs, NULL, &nsegs, MAX_SEGS); - for(int j = 0; j < nsegs; ++j) + for(int segIDx = 0; segIDx < nsegs; ++segIDx) { - const float* sa = &segs[j*6]; - const float* sb = &segs[j*6+3]; + const float* sa = &segs[segIDx *6]; + const float* sb = &segs[segIDx *6+3]; Point3F a = RCtoDTS(sa), b = RCtoDTS(sb); F32 len = (b - a).len(); if(len < mWalkableRadius * 2) @@ -1244,7 +1244,7 @@ bool NavMesh::createCoverPoints() edge.normalize(); // Number of points to try placing - for now, one at each end. U32 pointCount = (len > mWalkableRadius * 4) ? 2 : 1; - for(U32 i = 0; i < pointCount; i++) + for(U32 pointIDx = 0; pointIDx < pointCount; pointIDx++) { MatrixF mat; Point3F pos; @@ -1254,10 +1254,10 @@ bool NavMesh::createCoverPoints() // Otherwise, stand off from edge ends. else { - if(i % 2) - pos = a + edge * (i/2+1) * mWalkableRadius; + if(pointIDx % 2) + pos = a + edge * (pointIDx /2+1) * mWalkableRadius; else - pos = b - edge * (i/2+1) * mWalkableRadius; + pos = b - edge * (pointIDx /2+1) * mWalkableRadius; } CoverPointData data; if(testEdgeCover(pos, edge, data)) @@ -1332,7 +1332,7 @@ bool NavMesh::testEdgeCover(const Point3F &pos, const VectorF &dir, CoverPointDa void NavMesh::renderToDrawer() { - dd.clear(); + mDbgDraw.clear(); // Recast debug draw NetObject *no = getServerObject(); if(no) @@ -1341,12 +1341,12 @@ void NavMesh::renderToDrawer() if(n->nm) { - dd.beginGroup(0); - duDebugDrawNavMesh (&dd, *n->nm, 0); - dd.beginGroup(1); - duDebugDrawNavMeshPortals(&dd, *n->nm); - dd.beginGroup(2); - duDebugDrawNavMeshBVTree (&dd, *n->nm); + mDbgDraw.beginGroup(0); + duDebugDrawNavMesh (&mDbgDraw, *n->nm, 0); + mDbgDraw.beginGroup(1); + duDebugDrawNavMeshPortals(&mDbgDraw, *n->nm); + mDbgDraw.beginGroup(2); + duDebugDrawNavMeshBVTree (&mDbgDraw, *n->nm); } } } @@ -1398,16 +1398,16 @@ void NavMesh::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInsta int alpha = 80; if(!n->isSelected() || !Con::getBoolVariable("$Nav::EditorOpen")) alpha = 20; - dd.overrideColor(duRGBA(255, 0, 0, alpha)); + mDbgDraw.overrideColor(duRGBA(255, 0, 0, alpha)); } else { - dd.cancelOverride(); + mDbgDraw.cancelOverride(); } - if((!gEditingMission && n->mAlwaysRender) || (gEditingMission && Con::getBoolVariable("$Nav::Editor::renderMesh", 1))) dd.renderGroup(0); - if(Con::getBoolVariable("$Nav::Editor::renderPortals")) dd.renderGroup(1); - if(Con::getBoolVariable("$Nav::Editor::renderBVTree")) dd.renderGroup(2); + if((!gEditingMission && n->mAlwaysRender) || (gEditingMission && Con::getBoolVariable("$Nav::Editor::renderMesh", 1))) mDbgDraw.renderGroup(0); + if(Con::getBoolVariable("$Nav::Editor::renderPortals")) mDbgDraw.renderGroup(1); + if(Con::getBoolVariable("$Nav::Editor::renderBVTree")) mDbgDraw.renderGroup(2); } } diff --git a/Engine/source/navigation/navMesh.h b/Engine/source/navigation/navMesh.h index ff279c3be..75efcdacb 100644 --- a/Engine/source/navigation/navMesh.h +++ b/Engine/source/navigation/navMesh.h @@ -407,7 +407,7 @@ private: /// @name Rendering /// @{ - duDebugDrawTorque dd; + duDebugDrawTorque mDbgDraw; void renderToDrawer(); From d979cf9d2d4c0f4d9a8239b36b693a0e12636b60 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:18:00 -0500 Subject: [PATCH 198/312] PolyhedronVectorData core membervar cleanups --- .../components/collision/collisionTrigger.cpp | 48 ++++---- Engine/source/T3D/occlusionVolume.cpp | 6 +- Engine/source/T3D/physicalZone.cpp | 48 ++++---- Engine/source/T3D/trigger.cpp | 116 +++++++++--------- Engine/source/collision/extrudedPolyList.cpp | 14 +-- Engine/source/collision/optimizedPolyList.cpp | 26 ++-- Engine/source/math/mPolyhedron.cpp | 28 ++--- Engine/source/math/mPolyhedron.h | 66 +++++----- Engine/source/math/mPolyhedron.impl.h | 6 +- .../scene/mixin/scenePolyhedralObject.impl.h | 18 +-- Engine/source/scene/sceneContainer.cpp | 6 +- 11 files changed, 191 insertions(+), 191 deletions(-) diff --git a/Engine/source/T3D/components/collision/collisionTrigger.cpp b/Engine/source/T3D/components/collision/collisionTrigger.cpp index 7d1f50706..efac30b55 100644 --- a/Engine/source/T3D/components/collision/collisionTrigger.cpp +++ b/Engine/source/T3D/components/collision/collisionTrigger.cpp @@ -357,12 +357,12 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) { mCollisionTriggerPolyhedron = rPolyhedron; - if (mCollisionTriggerPolyhedron.pointList.size() != 0) { + if (mCollisionTriggerPolyhedron.mPointList.size() != 0) { mObjBox.minExtents.set(1e10, 1e10, 1e10); mObjBox.maxExtents.set(-1e10, -1e10, -1e10); - for (U32 i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++) { - mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.pointList[i]); - mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.pointList[i]); + for (U32 i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++) { + mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.mPointList[i]); + mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.mPointList[i]); } } else { @@ -374,7 +374,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) setTransform(xform); mClippedList.clear(); - mClippedList.mPlaneList = mCollisionTriggerPolyhedron.planeList; + mClippedList.mPlaneList = mCollisionTriggerPolyhedron.mPlaneList; // for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++) // mClippedList.mPlaneList[i].neg(); @@ -412,7 +412,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) bool CollisionTrigger::testObject(GameBase* enter) { - if (mCollisionTriggerPolyhedron.pointList.size() == 0) + if (mCollisionTriggerPolyhedron.mPointList.size() == 0) return false; mClippedList.clear(); @@ -507,17 +507,17 @@ U32 CollisionTrigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream // Write the polyhedron if (stream->writeFlag(mask & PolyMask)) { - stream->write(mCollisionTriggerPolyhedron.pointList.size()); - for (i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++) - mathWrite(*stream, mCollisionTriggerPolyhedron.pointList[i]); + stream->write(mCollisionTriggerPolyhedron.mPointList.size()); + for (i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++) + mathWrite(*stream, mCollisionTriggerPolyhedron.mPointList[i]); - stream->write(mCollisionTriggerPolyhedron.planeList.size()); - for (i = 0; i < mCollisionTriggerPolyhedron.planeList.size(); i++) - mathWrite(*stream, mCollisionTriggerPolyhedron.planeList[i]); + stream->write(mCollisionTriggerPolyhedron.mPlaneList.size()); + for (i = 0; i < mCollisionTriggerPolyhedron.mPlaneList.size(); i++) + mathWrite(*stream, mCollisionTriggerPolyhedron.mPlaneList[i]); - stream->write(mCollisionTriggerPolyhedron.edgeList.size()); - for (i = 0; i < mCollisionTriggerPolyhedron.edgeList.size(); i++) { - const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.edgeList[i]; + stream->write(mCollisionTriggerPolyhedron.mEdgeList.size()); + for (i = 0; i < mCollisionTriggerPolyhedron.mEdgeList.size(); i++) { + const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.mEdgeList[i]; stream->write(rEdge.face[0]); stream->write(rEdge.face[1]); @@ -555,19 +555,19 @@ void CollisionTrigger::unpackUpdate(NetConnection* con, BitStream* stream) { Polyhedron tempPH; stream->read(&size); - tempPH.pointList.setSize(size); - for (i = 0; i < tempPH.pointList.size(); i++) - mathRead(*stream, &tempPH.pointList[i]); + tempPH.mPointList.setSize(size); + for (i = 0; i < tempPH.mPointList.size(); i++) + mathRead(*stream, &tempPH.mPointList[i]); stream->read(&size); - tempPH.planeList.setSize(size); - for (i = 0; i < tempPH.planeList.size(); i++) - mathRead(*stream, &tempPH.planeList[i]); + tempPH.mPlaneList.setSize(size); + for (i = 0; i < tempPH.mPlaneList.size(); i++) + mathRead(*stream, &tempPH.mPlaneList[i]); stream->read(&size); - tempPH.edgeList.setSize(size); - for (i = 0; i < tempPH.edgeList.size(); i++) { - Polyhedron::Edge& rEdge = tempPH.edgeList[i]; + tempPH.mEdgeList.setSize(size); + for (i = 0; i < tempPH.mEdgeList.size(); i++) { + Polyhedron::Edge& rEdge = tempPH.mEdgeList[i]; stream->read(&rEdge.face[0]); stream->read(&rEdge.face[1]); diff --git a/Engine/source/T3D/occlusionVolume.cpp b/Engine/source/T3D/occlusionVolume.cpp index 7accbd507..9d55042e2 100644 --- a/Engine/source/T3D/occlusionVolume.cpp +++ b/Engine/source/T3D/occlusionVolume.cpp @@ -167,11 +167,11 @@ void OcclusionVolume::buildSilhouette( const SceneCameraState& cameraState, Vect if( mTransformDirty ) { - const U32 numPoints = mPolyhedron.getNumPoints(); + const U32 numPolyPoints = mPolyhedron.getNumPoints(); const PolyhedronType::PointType* points = getPolyhedron().getPoints(); - mWSPoints.setSize( numPoints ); - for( U32 i = 0; i < numPoints; ++ i ) + mWSPoints.setSize(numPolyPoints); + for( U32 i = 0; i < numPolyPoints; ++ i ) { Point3F p = points[ i ]; p.convolve( getScale() ); diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index f8454be5b..ba7dd90bb 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -283,17 +283,17 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream) if (stream->writeFlag(mask & PolyhedronMask)) { // Write the polyhedron - stream->write(mPolyhedron.pointList.size()); - for (i = 0; i < mPolyhedron.pointList.size(); i++) - mathWrite(*stream, mPolyhedron.pointList[i]); + stream->write(mPolyhedron.mPointList.size()); + for (i = 0; i < mPolyhedron.mPointList.size(); i++) + mathWrite(*stream, mPolyhedron.mPointList[i]); - stream->write(mPolyhedron.planeList.size()); - for (i = 0; i < mPolyhedron.planeList.size(); i++) - mathWrite(*stream, mPolyhedron.planeList[i]); + stream->write(mPolyhedron.mPlaneList.size()); + for (i = 0; i < mPolyhedron.mPlaneList.size(); i++) + mathWrite(*stream, mPolyhedron.mPlaneList[i]); - stream->write(mPolyhedron.edgeList.size()); - for (i = 0; i < mPolyhedron.edgeList.size(); i++) { - const Polyhedron::Edge& rEdge = mPolyhedron.edgeList[i]; + stream->write(mPolyhedron.mEdgeList.size()); + for (i = 0; i < mPolyhedron.mEdgeList.size(); i++) { + const Polyhedron::Edge& rEdge = mPolyhedron.mEdgeList[i]; stream->write(rEdge.face[0]); stream->write(rEdge.face[1]); @@ -340,19 +340,19 @@ void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream) // Read the polyhedron stream->read(&size); - tempPH.pointList.setSize(size); - for (i = 0; i < tempPH.pointList.size(); i++) - mathRead(*stream, &tempPH.pointList[i]); + tempPH.mPointList.setSize(size); + for (i = 0; i < tempPH.mPointList.size(); i++) + mathRead(*stream, &tempPH.mPointList[i]); stream->read(&size); - tempPH.planeList.setSize(size); - for (i = 0; i < tempPH.planeList.size(); i++) - mathRead(*stream, &tempPH.planeList[i]); + tempPH.mPlaneList.setSize(size); + for (i = 0; i < tempPH.mPlaneList.size(); i++) + mathRead(*stream, &tempPH.mPlaneList[i]); stream->read(&size); - tempPH.edgeList.setSize(size); - for (i = 0; i < tempPH.edgeList.size(); i++) { - Polyhedron::Edge& rEdge = tempPH.edgeList[i]; + tempPH.mEdgeList.setSize(size); + for (i = 0; i < tempPH.mEdgeList.size(); i++) { + Polyhedron::Edge& rEdge = tempPH.mEdgeList[i]; stream->read(&rEdge.face[0]); stream->read(&rEdge.face[1]); @@ -408,12 +408,12 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron) { mPolyhedron = rPolyhedron; - if (mPolyhedron.pointList.size() != 0) { + if (mPolyhedron.mPointList.size() != 0) { mObjBox.minExtents.set(1e10, 1e10, 1e10); mObjBox.maxExtents.set(-1e10, -1e10, -1e10); - for (U32 i = 0; i < mPolyhedron.pointList.size(); i++) { - mObjBox.minExtents.setMin(mPolyhedron.pointList[i]); - mObjBox.maxExtents.setMax(mPolyhedron.pointList[i]); + for (U32 i = 0; i < mPolyhedron.mPointList.size(); i++) { + mObjBox.minExtents.setMin(mPolyhedron.mPointList[i]); + mObjBox.maxExtents.setMax(mPolyhedron.mPointList[i]); } } else { mObjBox.minExtents.set(-0.5, -0.5, -0.5); @@ -424,7 +424,7 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron) setTransform(xform); mClippedList.clear(); - mClippedList.mPlaneList = mPolyhedron.planeList; + mClippedList.mPlaneList = mPolyhedron.mPlaneList; MatrixF base(true); base.scale(Point3F(1.0/mObjScale.x, @@ -481,7 +481,7 @@ bool PhysicalZone::testObject(SceneObject* enter) // all. And whats the point of building a convex if no collision methods // are implemented? - if (mPolyhedron.pointList.size() == 0) + if (mPolyhedron.mPointList.size() == 0) return false; mClippedList.clear(); diff --git a/Engine/source/T3D/trigger.cpp b/Engine/source/T3D/trigger.cpp index 64305314f..52d6898eb 100644 --- a/Engine/source/T3D/trigger.cpp +++ b/Engine/source/T3D/trigger.cpp @@ -245,16 +245,16 @@ ConsoleGetType( TypeTriggerPolyhedron ) Polyhedron* pPoly = reinterpret_cast(dptr); // First point is corner, need to find the three vectors...` - Point3F origin = pPoly->pointList[0]; + Point3F origin = pPoly->mPointList[0]; U32 currVec = 0; Point3F vecs[3]; - for (i = 0; i < pPoly->edgeList.size(); i++) { - const U32 *vertex = pPoly->edgeList[i].vertex; + for (i = 0; i < pPoly->mEdgeList.size(); i++) { + const U32 *vertex = pPoly->mEdgeList[i].vertex; if (vertex[0] == 0) - vecs[currVec++] = pPoly->pointList[vertex[1]] - origin; + vecs[currVec++] = pPoly->mPointList[vertex[1]] - origin; else if (vertex[1] == 0) - vecs[currVec++] = pPoly->pointList[vertex[0]] - origin; + vecs[currVec++] = pPoly->mPointList[vertex[0]] - origin; } AssertFatal(currVec == 3, "Internal error: Bad trigger polyhedron"); @@ -302,45 +302,45 @@ ConsoleSetType( TypeTriggerPolyhedron ) // edges with CCW instead of CW order for face[0] and that it b) lets plane // normals face outwards rather than inwards. - pPoly->pointList.setSize(8); - pPoly->pointList[0] = origin; - pPoly->pointList[1] = origin + vecs[0]; - pPoly->pointList[2] = origin + vecs[1]; - pPoly->pointList[3] = origin + vecs[2]; - pPoly->pointList[4] = origin + vecs[0] + vecs[1]; - pPoly->pointList[5] = origin + vecs[0] + vecs[2]; - pPoly->pointList[6] = origin + vecs[1] + vecs[2]; - pPoly->pointList[7] = origin + vecs[0] + vecs[1] + vecs[2]; + pPoly->mPointList.setSize(8); + pPoly->mPointList[0] = origin; + pPoly->mPointList[1] = origin + vecs[0]; + pPoly->mPointList[2] = origin + vecs[1]; + pPoly->mPointList[3] = origin + vecs[2]; + pPoly->mPointList[4] = origin + vecs[0] + vecs[1]; + pPoly->mPointList[5] = origin + vecs[0] + vecs[2]; + pPoly->mPointList[6] = origin + vecs[1] + vecs[2]; + pPoly->mPointList[7] = origin + vecs[0] + vecs[1] + vecs[2]; Point3F normal; - pPoly->planeList.setSize(6); + pPoly->mPlaneList.setSize(6); mCross(vecs[2], vecs[0], &normal); - pPoly->planeList[0].set(origin, normal); + pPoly->mPlaneList[0].set(origin, normal); mCross(vecs[0], vecs[1], &normal); - pPoly->planeList[1].set(origin, normal); + pPoly->mPlaneList[1].set(origin, normal); mCross(vecs[1], vecs[2], &normal); - pPoly->planeList[2].set(origin, normal); + pPoly->mPlaneList[2].set(origin, normal); mCross(vecs[1], vecs[0], &normal); - pPoly->planeList[3].set(pPoly->pointList[7], normal); + pPoly->mPlaneList[3].set(pPoly->mPointList[7], normal); mCross(vecs[2], vecs[1], &normal); - pPoly->planeList[4].set(pPoly->pointList[7], normal); + pPoly->mPlaneList[4].set(pPoly->mPointList[7], normal); mCross(vecs[0], vecs[2], &normal); - pPoly->planeList[5].set(pPoly->pointList[7], normal); + pPoly->mPlaneList[5].set(pPoly->mPointList[7], normal); - pPoly->edgeList.setSize(12); - pPoly->edgeList[0].vertex[0] = 0; pPoly->edgeList[0].vertex[1] = 1; pPoly->edgeList[0].face[0] = 0; pPoly->edgeList[0].face[1] = 1; - pPoly->edgeList[1].vertex[0] = 1; pPoly->edgeList[1].vertex[1] = 5; pPoly->edgeList[1].face[0] = 0; pPoly->edgeList[1].face[1] = 4; - pPoly->edgeList[2].vertex[0] = 5; pPoly->edgeList[2].vertex[1] = 3; pPoly->edgeList[2].face[0] = 0; pPoly->edgeList[2].face[1] = 3; - pPoly->edgeList[3].vertex[0] = 3; pPoly->edgeList[3].vertex[1] = 0; pPoly->edgeList[3].face[0] = 0; pPoly->edgeList[3].face[1] = 2; - pPoly->edgeList[4].vertex[0] = 3; pPoly->edgeList[4].vertex[1] = 6; pPoly->edgeList[4].face[0] = 3; pPoly->edgeList[4].face[1] = 2; - pPoly->edgeList[5].vertex[0] = 6; pPoly->edgeList[5].vertex[1] = 2; pPoly->edgeList[5].face[0] = 2; pPoly->edgeList[5].face[1] = 5; - pPoly->edgeList[6].vertex[0] = 2; pPoly->edgeList[6].vertex[1] = 0; pPoly->edgeList[6].face[0] = 2; pPoly->edgeList[6].face[1] = 1; - pPoly->edgeList[7].vertex[0] = 1; pPoly->edgeList[7].vertex[1] = 4; pPoly->edgeList[7].face[0] = 4; pPoly->edgeList[7].face[1] = 1; - pPoly->edgeList[8].vertex[0] = 4; pPoly->edgeList[8].vertex[1] = 2; pPoly->edgeList[8].face[0] = 1; pPoly->edgeList[8].face[1] = 5; - pPoly->edgeList[9].vertex[0] = 4; pPoly->edgeList[9].vertex[1] = 7; pPoly->edgeList[9].face[0] = 4; pPoly->edgeList[9].face[1] = 5; - pPoly->edgeList[10].vertex[0] = 5; pPoly->edgeList[10].vertex[1] = 7; pPoly->edgeList[10].face[0] = 3; pPoly->edgeList[10].face[1] = 4; - pPoly->edgeList[11].vertex[0] = 7; pPoly->edgeList[11].vertex[1] = 6; pPoly->edgeList[11].face[0] = 3; pPoly->edgeList[11].face[1] = 5; + pPoly->mEdgeList.setSize(12); + pPoly->mEdgeList[0].vertex[0] = 0; pPoly->mEdgeList[0].vertex[1] = 1; pPoly->mEdgeList[0].face[0] = 0; pPoly->mEdgeList[0].face[1] = 1; + pPoly->mEdgeList[1].vertex[0] = 1; pPoly->mEdgeList[1].vertex[1] = 5; pPoly->mEdgeList[1].face[0] = 0; pPoly->mEdgeList[1].face[1] = 4; + pPoly->mEdgeList[2].vertex[0] = 5; pPoly->mEdgeList[2].vertex[1] = 3; pPoly->mEdgeList[2].face[0] = 0; pPoly->mEdgeList[2].face[1] = 3; + pPoly->mEdgeList[3].vertex[0] = 3; pPoly->mEdgeList[3].vertex[1] = 0; pPoly->mEdgeList[3].face[0] = 0; pPoly->mEdgeList[3].face[1] = 2; + pPoly->mEdgeList[4].vertex[0] = 3; pPoly->mEdgeList[4].vertex[1] = 6; pPoly->mEdgeList[4].face[0] = 3; pPoly->mEdgeList[4].face[1] = 2; + pPoly->mEdgeList[5].vertex[0] = 6; pPoly->mEdgeList[5].vertex[1] = 2; pPoly->mEdgeList[5].face[0] = 2; pPoly->mEdgeList[5].face[1] = 5; + pPoly->mEdgeList[6].vertex[0] = 2; pPoly->mEdgeList[6].vertex[1] = 0; pPoly->mEdgeList[6].face[0] = 2; pPoly->mEdgeList[6].face[1] = 1; + pPoly->mEdgeList[7].vertex[0] = 1; pPoly->mEdgeList[7].vertex[1] = 4; pPoly->mEdgeList[7].face[0] = 4; pPoly->mEdgeList[7].face[1] = 1; + pPoly->mEdgeList[8].vertex[0] = 4; pPoly->mEdgeList[8].vertex[1] = 2; pPoly->mEdgeList[8].face[0] = 1; pPoly->mEdgeList[8].face[1] = 5; + pPoly->mEdgeList[9].vertex[0] = 4; pPoly->mEdgeList[9].vertex[1] = 7; pPoly->mEdgeList[9].face[0] = 4; pPoly->mEdgeList[9].face[1] = 5; + pPoly->mEdgeList[10].vertex[0] = 5; pPoly->mEdgeList[10].vertex[1] = 7; pPoly->mEdgeList[10].face[0] = 3; pPoly->mEdgeList[10].face[1] = 4; + pPoly->mEdgeList[11].vertex[0] = 7; pPoly->mEdgeList[11].vertex[1] = 6; pPoly->mEdgeList[11].face[0] = 3; pPoly->mEdgeList[11].face[1] = 5; } @@ -569,12 +569,12 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) { mTriggerPolyhedron = rPolyhedron; - if (mTriggerPolyhedron.pointList.size() != 0) { + if (mTriggerPolyhedron.mPointList.size() != 0) { mObjBox.minExtents.set(1e10, 1e10, 1e10); mObjBox.maxExtents.set(-1e10, -1e10, -1e10); - for (U32 i = 0; i < mTriggerPolyhedron.pointList.size(); i++) { - mObjBox.minExtents.setMin(mTriggerPolyhedron.pointList[i]); - mObjBox.maxExtents.setMax(mTriggerPolyhedron.pointList[i]); + for (U32 i = 0; i < mTriggerPolyhedron.mPointList.size(); i++) { + mObjBox.minExtents.setMin(mTriggerPolyhedron.mPointList[i]); + mObjBox.maxExtents.setMax(mTriggerPolyhedron.mPointList[i]); } } else { mObjBox.minExtents.set(-0.5, -0.5, -0.5); @@ -585,7 +585,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) setTransform(xform); mClippedList.clear(); - mClippedList.mPlaneList = mTriggerPolyhedron.planeList; + mClippedList.mPlaneList = mTriggerPolyhedron.mPlaneList; // for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++) // mClippedList.mPlaneList[i].neg(); @@ -623,7 +623,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) bool Trigger::testObject(GameBase* enter) { - if (mTriggerPolyhedron.pointList.size() == 0) + if (mTriggerPolyhedron.mPointList.size() == 0) return false; mClippedList.clear(); @@ -731,17 +731,17 @@ U32 Trigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream) // Write the polyhedron if( stream->writeFlag( mask & PolyMask ) ) { - stream->write(mTriggerPolyhedron.pointList.size()); - for (i = 0; i < mTriggerPolyhedron.pointList.size(); i++) - mathWrite(*stream, mTriggerPolyhedron.pointList[i]); + stream->write(mTriggerPolyhedron.mPointList.size()); + for (i = 0; i < mTriggerPolyhedron.mPointList.size(); i++) + mathWrite(*stream, mTriggerPolyhedron.mPointList[i]); - stream->write(mTriggerPolyhedron.planeList.size()); - for (i = 0; i < mTriggerPolyhedron.planeList.size(); i++) - mathWrite(*stream, mTriggerPolyhedron.planeList[i]); + stream->write(mTriggerPolyhedron.mPlaneList.size()); + for (i = 0; i < mTriggerPolyhedron.mPlaneList.size(); i++) + mathWrite(*stream, mTriggerPolyhedron.mPlaneList[i]); - stream->write(mTriggerPolyhedron.edgeList.size()); - for (i = 0; i < mTriggerPolyhedron.edgeList.size(); i++) { - const Polyhedron::Edge& rEdge = mTriggerPolyhedron.edgeList[i]; + stream->write(mTriggerPolyhedron.mEdgeList.size()); + for (i = 0; i < mTriggerPolyhedron.mEdgeList.size(); i++) { + const Polyhedron::Edge& rEdge = mTriggerPolyhedron.mEdgeList[i]; stream->write(rEdge.face[0]); stream->write(rEdge.face[1]); @@ -779,19 +779,19 @@ void Trigger::unpackUpdate(NetConnection* con, BitStream* stream) { Polyhedron tempPH; stream->read(&size); - tempPH.pointList.setSize(size); - for (i = 0; i < tempPH.pointList.size(); i++) - mathRead(*stream, &tempPH.pointList[i]); + tempPH.mPointList.setSize(size); + for (i = 0; i < tempPH.mPointList.size(); i++) + mathRead(*stream, &tempPH.mPointList[i]); stream->read(&size); - tempPH.planeList.setSize(size); - for (i = 0; i < tempPH.planeList.size(); i++) - mathRead(*stream, &tempPH.planeList[i]); + tempPH.mPlaneList.setSize(size); + for (i = 0; i < tempPH.mPlaneList.size(); i++) + mathRead(*stream, &tempPH.mPlaneList[i]); stream->read(&size); - tempPH.edgeList.setSize(size); - for (i = 0; i < tempPH.edgeList.size(); i++) { - Polyhedron::Edge& rEdge = tempPH.edgeList[i]; + tempPH.mEdgeList.setSize(size); + for (i = 0; i < tempPH.mEdgeList.size(); i++) { + Polyhedron::Edge& rEdge = tempPH.mEdgeList[i]; stream->read(&rEdge.face[0]); stream->read(&rEdge.face[1]); diff --git a/Engine/source/collision/extrudedPolyList.cpp b/Engine/source/collision/extrudedPolyList.cpp index 0e3b744a8..24de5af29 100644 --- a/Engine/source/collision/extrudedPolyList.cpp +++ b/Engine/source/collision/extrudedPolyList.cpp @@ -72,11 +72,11 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector) mPolyPlaneList.clear(); // Determine which faces will be extruded. - mExtrudedList.setSize(pt.planeList.size()); + mExtrudedList.setSize(pt.mPlaneList.size()); - for (U32 f = 0; f < pt.planeList.size(); f++) + for (U32 f = 0; f < pt.mPlaneList.size(); f++) { - const PlaneF& face = pt.planeList[f]; + const PlaneF& face = pt.mPlaneList[f]; ExtrudedFace& eface = mExtrudedList[f]; F32 dot = mDot(face,vector); eface.active = dot > EqualEpsilon; @@ -96,9 +96,9 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector) } // Produce extruded planes for bounding and internal edges - for (U32 e = 0; e < pt.edgeList.size(); e++) + for (U32 e = 0; e < pt.mEdgeList.size(); e++) { - Polyhedron::Edge const& edge = pt.edgeList[e]; + Polyhedron::Edge const& edge = pt.mEdgeList[e]; ExtrudedFace& ef1 = mExtrudedList[edge.face[0]]; ExtrudedFace& ef2 = mExtrudedList[edge.face[1]]; if (ef1.active || ef2.active) @@ -106,8 +106,8 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector) // Assumes that the edge points are clockwise // for face[0]. - const Point3F& p1 = pt.pointList[edge.vertex[1]]; - const Point3F &p2 = pt.pointList[edge.vertex[0]]; + const Point3F& p1 = pt.mPointList[edge.vertex[1]]; + const Point3F &p2 = pt.mPointList[edge.vertex[0]]; Point3F p3 = p2 + vector; mPlaneList.increment(2); diff --git a/Engine/source/collision/optimizedPolyList.cpp b/Engine/source/collision/optimizedPolyList.cpp index 6d56332b4..d8a1704c7 100644 --- a/Engine/source/collision/optimizedPolyList.cpp +++ b/Engine/source/collision/optimizedPolyList.cpp @@ -370,12 +370,12 @@ Polyhedron OptimizedPolyList::toPolyhedron() const for( U32 i = 0; i < numPoints; ++ i ) { bool isDuplicate = false; - for( U32 npoint = 0; npoint < polyhedron.pointList.size(); ++ npoint ) + for( U32 npoint = 0; npoint < polyhedron.mPointList.size(); ++ npoint ) { if( npoint == i ) continue; - if( !polyhedron.pointList[ npoint ].equal( mPoints[ i ] ) ) + if( !polyhedron.mPointList[ npoint ].equal( mPoints[ i ] ) ) continue; pointRemap[ i ] = npoint; @@ -384,8 +384,8 @@ Polyhedron OptimizedPolyList::toPolyhedron() const if( !isDuplicate ) { - pointRemap[ i ] = polyhedron.pointList.size(); - polyhedron.pointList.push_back( mPoints[ i ] ); + pointRemap[ i ] = polyhedron.mPointList.size(); + polyhedron.mPointList.push_back( mPoints[ i ] ); } } @@ -399,13 +399,13 @@ Polyhedron OptimizedPolyList::toPolyhedron() const // Add the plane. - const U32 polyIndex = polyhedron.planeList.size(); - polyhedron.planeList.push_back( mPlaneList[ poly.plane ] ); + const U32 polyIndex = polyhedron.mPlaneList.size(); + polyhedron.mPlaneList.push_back( mPlaneList[ poly.plane ] ); // Account for polyhedrons expecting planes to // face inwards. - polyhedron.planeList.last().invert(); + polyhedron.mPlaneList.last().invert(); // Gather remapped indices according to the // current polygon type. @@ -500,7 +500,7 @@ Polyhedron OptimizedPolyList::toPolyhedron() const U32 lastIndex = 0; for( S32 n = indexList.size() - 1; n >= 0; -- n ) { - polyhedron.edgeList.push_back( + polyhedron.mEdgeList.push_back( Polyhedron::Edge( polyIndex, 0, // face1 filled later indexList[ lastIndex ], indexList[ n ] @@ -514,16 +514,16 @@ Polyhedron OptimizedPolyList::toPolyhedron() const // Finally, consolidate the edge list by merging all edges that // are shared by polygons. - for( U32 i = 0; i < polyhedron.edgeList.size(); ++ i ) + for( U32 i = 0; i < polyhedron.mEdgeList.size(); ++ i ) { - Polyhedron::Edge& edge = polyhedron.edgeList[ i ]; + Polyhedron::Edge& edge = polyhedron.mEdgeList[ i ]; // Find the corresponding duplicate edge, if any, and merge // it into our current edge. - for( U32 n = i + 1; n < polyhedron.edgeList.size(); ++ n ) + for( U32 n = i + 1; n < polyhedron.mEdgeList.size(); ++ n ) { - const Polyhedron::Edge& thisEdge = polyhedron.edgeList[ n ]; + const Polyhedron::Edge& thisEdge = polyhedron.mEdgeList[ n ]; if( ( thisEdge.vertex[ 0 ] == edge.vertex[ 1 ] && thisEdge.vertex[ 1 ] == edge.vertex[ 0 ] ) || @@ -531,7 +531,7 @@ Polyhedron OptimizedPolyList::toPolyhedron() const thisEdge.vertex[ 1 ] == edge.vertex[ 1 ] ) ) { edge.face[ 1 ] = thisEdge.face[ 0 ]; - polyhedron.edgeList.erase( n ); + polyhedron.mEdgeList.erase( n ); break; } } diff --git a/Engine/source/math/mPolyhedron.cpp b/Engine/source/math/mPolyhedron.cpp index c9b1e60a3..7a1b75c97 100644 --- a/Engine/source/math/mPolyhedron.cpp +++ b/Engine/source/math/mPolyhedron.cpp @@ -137,8 +137,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) S32 v1index = -1; bool v1Existed = false; - for( U32 nvert = 0; nvert < pointList.size(); ++ nvert ) - if( pointList[ nvert ].equal( v1, 0.001f ) ) + for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert ) + if(mPointList[ nvert ].equal( v1, 0.001f ) ) { v1index = nvert; v1Existed = true; @@ -149,8 +149,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) S32 v2index = -1; bool v2Existed = false; - for( U32 nvert = 0; nvert < pointList.size(); ++ nvert ) - if( pointList[ nvert ].equal( v2, 0.001f ) ) + for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert ) + if(mPointList[ nvert ].equal( v2, 0.001f ) ) { v2index = nvert; v2Existed = true; @@ -161,30 +161,30 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) if( !v1Existed ) { - v1index = pointList.size(); - pointList.push_back( v1 ); + v1index = mPointList.size(); + mPointList.push_back( v1 ); } // Add vertex 2, if necessary. if( !v2Existed ) { - v2index = pointList.size(); - pointList.push_back( v2 ); + v2index = mPointList.size(); + mPointList.push_back( v2 ); } // If both v1 and v2 already existed in the point // set, this must be an edge that we are sharing so try // to find it. - const U32 thisPlaneIndex = planeList.size(); + const U32 thisPlaneIndex = mPlaneList.size(); bool foundExistingEdge = false; if( v1Existed && v2Existed ) { - for( U32 nedge = 0; nedge < edgeList.size(); ++ nedge ) + for( U32 nedge = 0; nedge < mEdgeList.size(); ++ nedge ) { - Edge& edge = edgeList[ nedge ]; + Edge& edge = mEdgeList[ nedge ]; if( ( edge.vertex[ 0 ] == v1index && edge.vertex[ 1 ] == v2index ) || ( edge.vertex[ 0 ] == v2index && edge.vertex[ 1 ] == v1index ) ) @@ -222,13 +222,13 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) if( !invert ) { - edgeList.push_back( + mEdgeList.push_back( Edge( thisPlaneIndex, 0, v1index, v2index ) ); } else { - edgeList.push_back( + mEdgeList.push_back( Edge( thisPlaneIndex, 0, v2index, v1index ) ); } @@ -242,6 +242,6 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) // If this plane produced edges, add it. if( haveEdges ) - planeList.push_back( currentPlane ); + mPlaneList.push_back( currentPlane ); } } diff --git a/Engine/source/math/mPolyhedron.h b/Engine/source/math/mPolyhedron.h index dbb874817..e7054423f 100644 --- a/Engine/source/math/mPolyhedron.h +++ b/Engine/source/math/mPolyhedron.h @@ -124,42 +124,42 @@ struct PolyhedronVectorData : public PolyhedronData typedef Vector< Edge > EdgeListType; /// List of planes. Note that by default, the normals facing *inwards*. - PlaneListType planeList; + PlaneListType mPlaneList; /// List of vertices. - PointListType pointList; + PointListType mPointList; /// List of edges. - EdgeListType edgeList; + EdgeListType mEdgeList; PolyhedronVectorData() { - VECTOR_SET_ASSOCIATION( pointList ); - VECTOR_SET_ASSOCIATION( planeList ); - VECTOR_SET_ASSOCIATION( edgeList ); + VECTOR_SET_ASSOCIATION(mPointList); + VECTOR_SET_ASSOCIATION(mPlaneList); + VECTOR_SET_ASSOCIATION(mEdgeList); } /// @name Accessors /// @{ /// Return the number of planes that make up this polyhedron. - U32 getNumPlanes() const { return planeList.size(); } + U32 getNumPlanes() const { return mPlaneList.size(); } /// Return the planes that make up the polyhedron. /// @note The normals of these planes are facing *inwards*. - PlaneF* getPlanes() const { return planeList.address(); } + PlaneF* getPlanes() const { return mPlaneList.address(); } /// Return the number of points that this polyhedron has. - U32 getNumPoints() const { return pointList.size(); } + U32 getNumPoints() const { return mPointList.size(); } /// - Point3F* getPoints() const { return pointList.address(); } + Point3F* getPoints() const { return mPointList.address(); } /// Return the number of edges that this polyhedron has. - U32 getNumEdges() const { return edgeList.size(); } + U32 getNumEdges() const { return mEdgeList.size(); } /// - Edge* getEdges() const { return edgeList.address(); } + Edge* getEdges() const { return mEdgeList.address(); } /// @} @@ -168,9 +168,9 @@ struct PolyhedronVectorData : public PolyhedronData void buildBox( const MatrixF& mat, const Box3F& box, bool invertNormals = false ) { - pointList.setSize( 8 ); - planeList.setSize( 6 ); - edgeList.setSize( 12 ); + mPointList.setSize( 8 ); + mPlaneList.setSize( 6 ); + mEdgeList.setSize( 12 ); buildBoxData( *this, mat, box, invertNormals ); } @@ -190,13 +190,13 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData protected: /// List of planes. Note that by default, the normals facing *inwards*. - PlaneListType planeList; + PlaneListType mPlaneList; /// List of vertices. - PointListType pointList; + PointListType mPointList; /// List of edges. - EdgeListType edgeList; + EdgeListType mEdgeList; public: @@ -204,26 +204,26 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData /// @{ /// Return the number of planes that make up this polyhedron. - U32 getNumPlanes() const { return planeList.size(); } + U32 getNumPlanes() const { return mPlaneList.size(); } /// Return the planes that make up the polyhedron. /// @note The normals of these planes are facing *inwards*. - const PlaneF* getPlanes() const { return planeList.address(); } - PlaneF* getPlanes() { return planeList.address(); } + const PlaneF* getPlanes() const { return mPlaneList.address(); } + PlaneF* getPlanes() { return mPlaneList.address(); } /// Return the number of points that this polyhedron has. - U32 getNumPoints() const { return pointList.size(); } + U32 getNumPoints() const { return mPointList.size(); } /// - const Point3F* getPoints() const { return pointList.address(); } - Point3F* getPoints() { return pointList.address(); } + const Point3F* getPoints() const { return mPointList.address(); } + Point3F* getPoints() { return mPointList.address(); } /// Return the number of edges that this polyhedron has. - U32 getNumEdges() const { return edgeList.size(); } + U32 getNumEdges() const { return mEdgeList.size(); } /// - const Edge* getEdges() const { return edgeList.address(); } - Edge* getEdges() { return edgeList.address(); } + const Edge* getEdges() const { return mEdgeList.address(); } + Edge* getEdges() { return mEdgeList.address(); } /// @} }; @@ -239,13 +239,13 @@ struct PolyhedronFixedVectorData : public PolyhedronData protected: /// List of planes. Note that by default, the normals facing *inwards*. - PlaneListType planeList; + PlaneListType mPlaneList; /// List of vertices. - PointListType pointList; + PointListType mPointList; /// List of edges. - EdgeListType edgeList; + EdgeListType mEdgeList; public: @@ -302,9 +302,9 @@ struct PolyhedronImpl : public Base /// Construct a polyhedron described by the given planes and edges. PolyhedronImpl( PlaneListType planes, PointListType points, EdgeListType edges ) { - this->planeList = planes; - this->pointList = points; - this->edgeList = edges; + this->mPlaneList = planes; + this->mPointList = points; + this->mEdgeList = edges; } /// Return the AABB around the polyhedron. diff --git a/Engine/source/math/mPolyhedron.impl.h b/Engine/source/math/mPolyhedron.impl.h index 796f11350..bb7f199c1 100644 --- a/Engine/source/math/mPolyhedron.impl.h +++ b/Engine/source/math/mPolyhedron.impl.h @@ -462,7 +462,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B // Corner points. - typename Polyhedron::PointListType& pointList = poly.pointList; + typename Polyhedron::PointListType& pointList = poly.mPointList; pointList[ 0 ] = min; // near left bottom pointList[ 1 ] = min + yvec; // far left bottom @@ -475,7 +475,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B // Side planes. - typename Polyhedron::PlaneListType& planeList = poly.planeList; + typename Polyhedron::PlaneListType& planeList = poly.mPlaneList; const F32 pos = invertNormals ? -1.f : 1.f; const F32 neg = - pos; @@ -490,7 +490,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B // The edges are constructed so that the vertices // are oriented clockwise for face[0]. - typename Polyhedron::EdgeType* edge = &poly.edgeList[ 0 ]; + typename Polyhedron::EdgeType* edge = &poly.mEdgeList[ 0 ]; for( U32 i = 0; i < 4; ++ i ) { diff --git a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h index b01eb9691..4ce8998f0 100644 --- a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h +++ b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h @@ -215,27 +215,27 @@ void ScenePolyhedralObject< Base, P >::unpackUpdate( NetConnection* connection, // Read planes. const U32 numPlanes = stream->readInt( 8 ); - mPolyhedron.planeList.setSize( numPlanes ); + mPolyhedron.mPlaneList.setSize( numPlanes ); for( U32 i = 0; i < numPlanes; ++ i ) - mathRead( *stream, &mPolyhedron.planeList[ i ] ); + mathRead( *stream, &mPolyhedron.mPlaneList[ i ] ); // Read points. const U32 numPoints = stream->readInt( 8 ); - mPolyhedron.pointList.setSize( numPoints ); + mPolyhedron.mPointList.setSize( numPoints ); for( U32 i = 0; i < numPoints; ++ i ) - mathRead( *stream, &mPolyhedron.pointList[ i ] ); + mathRead( *stream, &mPolyhedron.mPointList[ i ] ); // Read edges. const U32 numEdges = stream->readInt( 8 ); - mPolyhedron.edgeList.setSize( numEdges ); + mPolyhedron.mEdgeList.setSize( numEdges ); for( U32 i = 0; i < numEdges; ++ i ) { - typename PolyhedronType::EdgeType& edge = mPolyhedron.edgeList[ i ]; + typename PolyhedronType::EdgeType& edge = mPolyhedron.mEdgeList[ i ]; edge.face[ 0 ] = stream->readInt( 8 ); edge.face[ 1 ] = stream->readInt( 8 ); @@ -344,7 +344,7 @@ bool ScenePolyhedralObject< Base, P >::_setPlane( void* object, const char* inde &plane.d ); - obj->mPolyhedron.planeList.push_back( plane ); + obj->mPolyhedron.mPlaneList.push_back( plane ); obj->setMaskBits( PolyMask ); obj->mIsBox = false; @@ -366,7 +366,7 @@ bool ScenePolyhedralObject< Base, P >::_setPoint( void* object, const char* inde &point[ 2 ] ); - obj->mPolyhedron.pointList.push_back( point ); + obj->mPolyhedron.mPointList.push_back( point ); obj->setMaskBits( PolyMask ); obj->mIsBox = false; @@ -389,7 +389,7 @@ bool ScenePolyhedralObject< Base, P >::_setEdge( void* object, const char* index &edge.vertex[ 1 ] ); - obj->mPolyhedron.edgeList.push_back( edge ); + obj->mPolyhedron.mEdgeList.push_back( edge ); obj->setMaskBits( PolyMask ); obj->mIsBox = false; diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index 66722a079..0d2573b27 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -586,10 +586,10 @@ void SceneContainer::polyhedronFindObjects(const Polyhedron& polyhedron, U32 mas Box3F box; box.minExtents.set(1e9, 1e9, 1e9); box.maxExtents.set(-1e9, -1e9, -1e9); - for (i = 0; i < polyhedron.pointList.size(); i++) + for (i = 0; i < polyhedron.mPointList.size(); i++) { - box.minExtents.setMin(polyhedron.pointList[i]); - box.maxExtents.setMax(polyhedron.pointList[i]); + box.minExtents.setMin(polyhedron.mPointList[i]); + box.maxExtents.setMax(polyhedron.mPointList[i]); } if ( mask == WaterObjectType || From 300d9eefbf3302fcb4530e21b3a4ea9ac6f82f80 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:45:45 -0500 Subject: [PATCH 199/312] ease member vars tagged as member vars --- Engine/source/math/mEase.cpp | 146 +++++++++++++++---------------- Engine/source/math/mEase.h | 6 +- Engine/source/math/mathIO.h | 16 ++-- Engine/source/math/mathTypes.cpp | 8 +- 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/Engine/source/math/mEase.cpp b/Engine/source/math/mEase.cpp index 0eca22fef..e1ff97d5f 100644 --- a/Engine/source/math/mEase.cpp +++ b/Engine/source/math/mEase.cpp @@ -6,158 +6,158 @@ EaseF::EaseF() { - dir = 0; - type = 0; - param[0] = param[1] = -1.0f; + mDir = 0; + mType = 0; + mParam[0] = mParam[1] = -1.0f; } EaseF::EaseF(const EaseF &ease) { - this->dir = ease.dir; - this->type = ease.type; - this->param[0] = ease.param[0]; - this->param[1] = ease.param[1]; + this->mDir = ease.mDir; + this->mType = ease.mType; + this->mParam[0] = ease.mParam[0]; + this->mParam[1] = ease.mParam[1]; } EaseF::EaseF(const S32 dir, const S32 type) { - this->dir = dir; - this->type = type; - this->param[0] = this->param[1] = -1.0f; + this->mDir = dir; + this->mType = type; + this->mParam[0] = this->mParam[1] = -1.0f; } EaseF::EaseF(const S32 dir, const S32 type, F32 param[2]) { - this->dir = dir; - this->type = type; - this->param[0] = param[0]; - this->param[1] = param[1]; + this->mDir = dir; + this->mType = type; + this->mParam[0] = param[0]; + this->mParam[1] = param[1]; } void EaseF::set(const S32 dir, const S32 type) { - this->dir = dir; - this->type = type; - this->param[0] = this->param[1] = -1.0f; + this->mDir = dir; + this->mType = type; + this->mParam[0] = this->mParam[1] = -1.0f; } void EaseF::set(const S32 dir, const S32 type, F32 param[2]) { - this->dir = dir; - this->type = type; - this->param[0] = param[0]; - this->param[1] = param[1]; + this->mDir = dir; + this->mType = type; + this->mParam[0] = param[0]; + this->mParam[1] = param[1]; } void EaseF::set(const S32 dir, const S32 type, F32 param0, F32 param1) { - this->dir = dir; - this->type = type; - this->param[0] = param0; - this->param[1] = param1; + this->mDir = dir; + this->mType = type; + this->mParam[0] = param0; + this->mParam[1] = param1; } void EaseF::set(const char *s) { - dSscanf(s,"%d %d %f %f",&dir,&type,¶m[0],¶m[1]); + dSscanf(s,"%d %d %f %f",&mDir,&mType,&mParam[0],&mParam[1]); } F32 EaseF::getValue(F32 t, F32 b, F32 c, F32 d) const { F32 value = 0; - if (type == Ease::Linear) + if (mType == Ease::Linear) { value = mLinearTween(t,b, c, d); } - else if (type == Ease::Quadratic) + else if (mType == Ease::Quadratic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInQuad(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutQuad(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutQuad(t,b, c, d); } - else if (type == Ease::Cubic) + else if (mType == Ease::Cubic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInCubic(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutCubic(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutCubic(t,b, c, d); } - else if (type == Ease::Quartic) + else if (mType == Ease::Quartic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInQuart(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutQuart(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutQuart(t,b, c, d); } - else if (type == Ease::Quintic) + else if (mType == Ease::Quintic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInQuint(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutQuint(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutQuint(t,b, c, d); } - else if (type == Ease::Sinusoidal) + else if (mType == Ease::Sinusoidal) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInSine(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutSine(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutSine(t,b, c, d); } - else if (type == Ease::Exponential) + else if (mType == Ease::Exponential) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInExpo(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutExpo(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutExpo(t,b, c, d); } - else if (type == Ease::Circular) + else if (mType == Ease::Circular) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInCirc(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutCirc(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutCirc(t,b, c, d); } - else if (type == Ease::Elastic) + else if (mType == Ease::Elastic) { - if (dir == Ease::In) - value = mEaseInElastic(t,b, c, d, param[0], param[1]); - else if (dir == Ease::Out) - value = mEaseOutElastic(t,b, c, d, param[0], param[1]); - else if (dir == Ease::InOut) - value = mEaseInOutElastic(t,b, c, d, param[0], param[1]); + if (mDir == Ease::In) + value = mEaseInElastic(t,b, c, d, mParam[0], mParam[1]); + else if (mDir == Ease::Out) + value = mEaseOutElastic(t,b, c, d, mParam[0], mParam[1]); + else if (mDir == Ease::InOut) + value = mEaseInOutElastic(t,b, c, d, mParam[0], mParam[1]); } - else if (type == Ease::Back) + else if (mType == Ease::Back) { - if (dir == Ease::In) - value = mEaseInBack(t,b, c, d, param[0]); - else if (dir == Ease::Out) - value = mEaseOutBack(t,b, c, d, param[0]); - else if (dir == Ease::InOut) - value = mEaseInOutBack(t,b, c, d, param[0]); + if (mDir == Ease::In) + value = mEaseInBack(t,b, c, d, mParam[0]); + else if (mDir == Ease::Out) + value = mEaseOutBack(t,b, c, d, mParam[0]); + else if (mDir == Ease::InOut) + value = mEaseInOutBack(t,b, c, d, mParam[0]); } - else if (type == Ease::Bounce) + else if (mType == Ease::Bounce) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInBounce(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutBounce(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutBounce(t,b, c, d); } else diff --git a/Engine/source/math/mEase.h b/Engine/source/math/mEase.h index 8689f7fbb..33dcb1467 100644 --- a/Engine/source/math/mEase.h +++ b/Engine/source/math/mEase.h @@ -76,9 +76,9 @@ class EaseF : public Ease { //-------------------------------------- Public data public: - S32 dir; // inout, in, out - S32 type; // linear, etc... - F32 param[2]; // optional params + S32 mDir; // inout, in, out + S32 mType; // linear, etc... + F32 mParam[2]; // optional params //-------------------------------------- Public interface public: diff --git a/Engine/source/math/mathIO.h b/Engine/source/math/mathIO.h index 6acbc1b52..23fdfe438 100644 --- a/Engine/source/math/mathIO.h +++ b/Engine/source/math/mathIO.h @@ -142,10 +142,10 @@ inline bool mathRead(Stream& stream, QuatF* q) inline bool mathRead(Stream& stream, EaseF* e) { - bool success = stream.read( &e->dir ); - success &= stream.read( &e->type ); - success &= stream.read( &e->param[ 0 ] ); - success &= stream.read( &e->param[ 1 ] ); + bool success = stream.read( &e->mDir ); + success &= stream.read( &e->mType ); + success &= stream.read( &e->mParam[ 0 ] ); + success &= stream.read( &e->mParam[ 1 ] ); return success; } @@ -270,10 +270,10 @@ inline bool mathWrite(Stream& stream, const QuatF& q) inline bool mathWrite(Stream& stream, const EaseF& e) { - bool success = stream.write(e.dir); - success &= stream.write(e.type); - success &= stream.write(e.param[0]); - success &= stream.write(e.param[1]); + bool success = stream.write(e.mDir); + success &= stream.write(e.mType); + success &= stream.write(e.mParam[0]); + success &= stream.write(e.mParam[1]); return success; } diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index 1d1011d0f..7f3e44225 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -557,7 +557,7 @@ ConsoleGetType( TypeEaseF ) static const U32 bufSize = 256; char* returnBuffer = Con::getReturnBuffer(bufSize); dSprintf(returnBuffer, bufSize, "%d %d %g %g", - pEase->dir, pEase->type, pEase->param[0], pEase->param[1]); + pEase->mDir, pEase->mType, pEase->mParam[0], pEase->mParam[1]); return returnBuffer; } @@ -567,11 +567,11 @@ ConsoleSetType( TypeEaseF ) EaseF* pDst = (EaseF*)dptr; // defaults... - pDst->param[0] = -1.0f; - pDst->param[1] = -1.0f; + pDst->mParam[0] = -1.0f; + pDst->mParam[1] = -1.0f; if (argc == 1) { U32 args = dSscanf(argv[0], "%d %d %f %f", // the two params are optional and assumed -1 if not present... - &pDst->dir, &pDst->type, &pDst->param[0],&pDst->param[1]); + &pDst->mDir, &pDst->mType, &pDst->mParam[0],&pDst->mParam[1]); if( args < 2 ) Con::warnf( "Warning, EaseF probably not read properly" ); } else { From cffc9d3afe364a3e2ba6493365c57539ee546600 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:38:44 -0500 Subject: [PATCH 200/312] doubleup on Q defintion for baycentric coord calcs --- Engine/source/math/mathUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/math/mathUtils.cpp b/Engine/source/math/mathUtils.cpp index dfc418deb..98ab052ed 100644 --- a/Engine/source/math/mathUtils.cpp +++ b/Engine/source/math/mathUtils.cpp @@ -1086,9 +1086,9 @@ bool mRayQuadCollide( const Quad &quad, - (beta * (alpha_11 - 1.0f)) - 1.0f; F32 C = alpha; F32 D = (B * B) - (4.0f * A * C); - F32 Q = -0.5f * (B + (B < 0.0f ? -1.0f : 1.0f) ) * mSqrt(D); - u = Q / A; - if ((u < 0.0f) || (u > 1.0f)) u = C / Q; + F32 F = -0.5f * (B + (B < 0.0f ? -1.0f : 1.0f) ) * mSqrt(D); + u = F / A; + if ((u < 0.0f) || (u > 1.0f)) u = C / F; v = beta / ((u * (beta_11 - 1.0f)) + 1.0f); } From 871b498d73a999a5dae0897101054829b3787ece Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:39:50 -0500 Subject: [PATCH 201/312] doubleup on dt (usually denotes delta-time. in this case also incorporates time-of-collision) --- Engine/source/T3D/item.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index d8f8cad1e..a4fc7a339 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -891,9 +891,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt) if (collisionList.getTime() < 1.0) { // Set to collision point - F32 dt = time * collisionList.getTime(); - pos += mVelocity * dt; - time -= dt; + F32 cdt = time * collisionList.getTime(); + pos += mVelocity * cdt; + time -= cdt; // Pick the most resistant surface F32 bd = 0; From e85af7b4d8de85563a73070156c2af36c690730f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:41:29 -0500 Subject: [PATCH 202/312] XXXVehicle::updateEmitter cleanups --- Engine/source/T3D/vehicles/flyingVehicle.cpp | 8 ++++---- Engine/source/T3D/vehicles/hoverVehicle.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 855850ea8..3040d94b1 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -731,10 +731,10 @@ void FlyingVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitte } } else { - for (S32 j = idx; j < idx + count; j++) - if (bool(mJetEmitter[j])) { - mJetEmitter[j]->deleteWhenEmpty(); - mJetEmitter[j] = 0; + for (S32 k = idx; k < idx + count; k++) + if (bool(mJetEmitter[k])) { + mJetEmitter[k]->deleteWhenEmpty(); + mJetEmitter[k] = 0; } } } diff --git a/Engine/source/T3D/vehicles/hoverVehicle.cpp b/Engine/source/T3D/vehicles/hoverVehicle.cpp index 35784d26b..1da29360b 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.cpp +++ b/Engine/source/T3D/vehicles/hoverVehicle.cpp @@ -965,10 +965,10 @@ void HoverVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitter } } else { - for (S32 j = idx; j < idx + count; j++) - if (bool(mJetEmitter[j])) { - mJetEmitter[j]->deleteWhenEmpty(); - mJetEmitter[j] = 0; + for (S32 k = idx; k < idx + count; k++) + if (bool(mJetEmitter[k])) { + mJetEmitter[k]->deleteWhenEmpty(); + mJetEmitter[k] = 0; } } } From d11a942f6d8575b4df1c9e12308b90630ddf8fa2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:42:18 -0500 Subject: [PATCH 203/312] shadowvar cleanup --- Engine/source/T3D/systems/render/meshRenderSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.cpp b/Engine/source/T3D/systems/render/meshRenderSystem.cpp index fe1ec6f84..39b163601 100644 --- a/Engine/source/T3D/systems/render/meshRenderSystem.cpp +++ b/Engine/source/T3D/systems/render/meshRenderSystem.cpp @@ -350,9 +350,9 @@ void MeshRenderSystem::rebuildBuffers() U16 *pIndex; buffers.primitiveBuffer.lock(&pIndex); - for (U16 i = 0; i < buffers.primData.size(); i++) + for (U16 primDataIDx = 0; primDataIDx < buffers.primData.size(); primDataIDx++) { - *pIndex = i; + *pIndex = primDataIDx; pIndex++; } From 1b548e5304984f598649715bba7006cb08bf68a7 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:43:03 -0500 Subject: [PATCH 204/312] cleanups for decal and mesh road, and the meshroad and river editors --- Engine/source/environment/decalRoad.cpp | 22 +++---- .../editors/guiMeshRoadEditorCtrl.cpp | 6 +- .../editors/guiRiverEditorCtrl.cpp | 6 +- Engine/source/environment/meshRoad.cpp | 60 +++++++------------ 4 files changed, 40 insertions(+), 54 deletions(-) diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index edf4c725b..00359f7bb 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -1265,7 +1265,7 @@ void DecalRoad::_generateEdges() // for ( U32 i = 0; i < mEdges.size(); i++ ) { - RoadEdge *edge = &mEdges[i]; + edge = &mEdges[i]; edge->p0 = edge->p1 - edge->rvec * edge->width * 0.5f; edge->p2 = edge->p1 + edge->rvec * edge->width * 0.5f; _getTerrainHeight( edge->p0 ); @@ -1467,20 +1467,20 @@ void DecalRoad::_captureVerts() for ( U32 i = 0; i < clipperList.size(); i++ ) { ClippedPolyList *clipper = &clipperList[i]; - RoadEdge &edge = mEdges[i]; - RoadEdge &nextEdge = mEdges[i+1]; + edge = &mEdges[i]; + nextEdge = &mEdges[i+1]; - VectorF segFvec = nextEdge.p1 - edge.p1; + VectorF segFvec = nextEdge->p1 - edge->p1; F32 segLen = segFvec.len(); segFvec.normalize(); F32 texLen = segLen / mTextureLength; texEnd = texStart + texLen; - BiQuadToSqr quadToSquare( Point2F( edge.p0.x, edge.p0.y ), - Point2F( edge.p2.x, edge.p2.y ), - Point2F( nextEdge.p2.x, nextEdge.p2.y ), - Point2F( nextEdge.p0.x, nextEdge.p0.y ) ); + BiQuadToSqr quadToSquare( Point2F( edge->p0.x, edge->p0.y ), + Point2F( edge->p2.x, edge->p2.y ), + Point2F( nextEdge->p2.x, nextEdge->p2.y ), + Point2F( nextEdge->p0.x, nextEdge->p0.y ) ); // if ( i % mSegmentsPerBatch == 0 ) @@ -1572,12 +1572,12 @@ void DecalRoad::_captureVerts() Box3F box; for ( U32 i = 0; i < mBatches.size(); i++ ) { - const RoadBatch &batch = mBatches[i]; + batch = &mBatches[i]; if ( i == 0 ) - box = batch.bounds; + box = batch->bounds; else - box.intersect( batch.bounds ); + box.intersect( batch->bounds ); } mWorldBox = box; diff --git a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp index e1a612b00..d36fb5cd9 100644 --- a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp @@ -1132,11 +1132,11 @@ void GuiMeshRoadEditorCtrl::setSelectedNode( S32 node ) mSelNode = node; if ( mSelNode != -1 ) { - const MeshRoadNode &node = mSelRoad->mNodes[mSelNode]; + const MeshRoadNode &curNode = mSelRoad->mNodes[mSelNode]; MatrixF objMat = mSelRoad->getNodeTransform(mSelNode); - Point3F objScale( node.width, 1.0f, node.depth ); - Point3F worldPos = node.point; + Point3F objScale(curNode.width, 1.0f, curNode.depth ); + Point3F worldPos = curNode.point; mGizmo->set( objMat, worldPos, objScale ); } diff --git a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp index 01ab745a8..103d6e380 100644 --- a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp @@ -1277,11 +1277,11 @@ void GuiRiverEditorCtrl::setSelectedNode( S32 node ) mSelNode = node; if ( mSelNode != -1 ) { - const RiverNode &node = mSelRiver->mNodes[mSelNode]; + const RiverNode &curNode = mSelRiver->mNodes[mSelNode]; MatrixF objMat = mSelRiver->getNodeTransform(mSelNode); - Point3F objScale( node.width, 1.0f, node.depth ); - Point3F worldPos = node.point; + Point3F objScale(curNode.width, 1.0f, curNode.depth ); + Point3F worldPos = curNode.point; mGizmo->set( objMat, worldPos, objScale ); } diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index 0d523f9a7..1ed6768fb 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -1681,54 +1681,40 @@ void MeshRoad::_generateSlices() } } } - - // - // Calculate uvec, fvec, and rvec for all slices - // - + MatrixF mat(true); - - for ( U32 i = 0; i < mSlices.size(); i++ ) - { - calcSliceTransform( i, mat ); - mat.getColumn( 0, &mSlices[i].rvec ); - mat.getColumn( 1, &mSlices[i].fvec ); - mat.getColumn( 2, &mSlices[i].uvec ); - } - - // - // Calculate p0/p2/pb0/pb2 for all slices - // - for ( U32 i = 0; i < mSlices.size(); i++ ) - { - MeshRoadSlice *slice = &mSlices[i]; - slice->p0 = slice->p1 - slice->rvec * slice->width * 0.5f; - slice->p2 = slice->p1 + slice->rvec * slice->width * 0.5f; - slice->pb0 = slice->p0 - slice->uvec * slice->depth; - slice->pb2 = slice->p2 - slice->uvec * slice->depth; - } - - // Generate the object/world bounds Box3F box; for ( U32 i = 0; i < mSlices.size(); i++ ) { - const MeshRoadSlice &slice = mSlices[i]; + // Calculate uvec, fvec, and rvec for all slices + calcSliceTransform( i, mat ); + MeshRoadSlice *slicePtr = &mSlices[i]; + mat.getColumn( 0, &slicePtr->rvec ); + mat.getColumn( 1, &slicePtr->fvec ); + mat.getColumn( 2, &slicePtr->uvec ); + // Calculate p0/p2/pb0/pb2 for all slices + slicePtr->p0 = slicePtr->p1 - slicePtr->rvec * slicePtr->width * 0.5f; + slicePtr->p2 = slicePtr->p1 + slicePtr->rvec * slicePtr->width * 0.5f; + slicePtr->pb0 = slicePtr->p0 - slicePtr->uvec * slicePtr->depth; + slicePtr->pb2 = slicePtr->p2 - slicePtr->uvec * slicePtr->depth; + + // Generate or extend the object/world bounds if ( i == 0 ) { - box.minExtents = slice.p0; - box.maxExtents = slice.p2; - box.extend( slice.pb0 ); - box.extend( slice.pb2 ); + box.minExtents = slicePtr->p0; + box.maxExtents = slicePtr->p2; + box.extend(slicePtr->pb0 ); + box.extend(slicePtr->pb2 ); } else { - box.extend( slice.p0 ); - box.extend( slice.p2 ); - box.extend( slice.pb0 ); - box.extend( slice.pb2 ); + box.extend(slicePtr->p0 ); + box.extend(slicePtr->p2 ); + box.extend(slicePtr->pb0 ); + box.extend(slicePtr->pb2 ); } - } + } mWorldBox = box; resetObjectBox(); From 1138637718b281ddc125bf8ffa29219f5f29c178 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 18:44:51 -0500 Subject: [PATCH 205/312] crashfix from prior commit --- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 6a3c296a8..547e77d31 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -1116,7 +1116,7 @@ void DiffuseFeatureHLSL::processPix( Vector &componentList, col->setType("fragout"); col->setName(getOutputTargetVarName(targ)); col->setStructName("OUT"); - meta->addStatement(new GenOp(" @ = float4(1.0);\r\n", col)); + meta->addStatement(new GenOp(" @ = float4(1.0,1.0,1.0,1.0);\r\n", col)); } } From 75897d8191d33cbe1d4eafb210441593ed74419d Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 19:07:03 -0500 Subject: [PATCH 206/312] shadowvar cleanup --- Engine/source/gui/containers/guiWindowCtrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index 5ef2a71af..5077ae348 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -357,7 +357,7 @@ void GuiWindowCtrl::moveToCollapseGroup(GuiWindowCtrl* hitWindow, bool orientati } else { - S32 groupVec = hitWindow->mCollapseGroup; + groupVec = hitWindow->mCollapseGroup; if(orientation == 0) parent->mCollapseGroupVec[groupVec].push_front(this); From 25920aeee95f82256183350e9c155b2409708ee9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 00:43:29 -0500 Subject: [PATCH 207/312] frustum definition duplication(s) --- Engine/source/gui/3d/guiTSControl.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Engine/source/gui/3d/guiTSControl.cpp b/Engine/source/gui/3d/guiTSControl.cpp index d19d58aee..3e2c192c9 100644 --- a/Engine/source/gui/3d/guiTSControl.cpp +++ b/Engine/source/gui/3d/guiTSControl.cpp @@ -432,8 +432,6 @@ void GuiTSCtrl::_internalRender(RectI guiViewport, RectI renderViewport, Frustum if (mRenderStyle == RenderStyleStereoSideBySide && debugDraw->willDraw()) { // For SBS we need to render over each viewport - Frustum frustum; - GFX->setViewport(mLastCameraQuery.stereoViewports[0]); MathUtils::makeFovPortFrustum(&frustum, mLastCameraQuery.ortho, mLastCameraQuery.nearPlane, mLastCameraQuery.farPlane, mLastCameraQuery.fovPort[0]); GFX->setFrustum(frustum); @@ -543,7 +541,6 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect) GFX->setStereoTargets(mLastCameraQuery.stereoTargets); MatrixF myTransforms[2]; - Frustum frustum; if (smUseLatestDisplayTransform) { From a0eebd01c81caccb2f12affe41f92e183d6c4752 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 00:52:03 -0500 Subject: [PATCH 208/312] refactor to avoid shadowvars --- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 12 +++++------ Engine/source/gui/editor/guiGraphCtrl.cpp | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 3c6415117..02f588e1e 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -1210,9 +1210,9 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect) if ( drawbox ) { Point2I coloredboxsize( 15, 10 ); - RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); - drawUtil->drawRectFill( r, boxColor); - drawUtil->drawRect( r, ColorI(0,0,0)); + RectI boxBounds( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); + drawUtil->drawRectFill(boxBounds, boxColor); + drawUtil->drawRect(boxBounds, ColorI(0,0,0)); localStart.x += coloredboxsize.x + mProfile->mTextOffset.x; } @@ -1236,18 +1236,18 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect) // Draw the second column to the right getColumn( mText, buff, 1, "\t" ); - S32 txt_w = mProfile->mFont->getStrWidth( buff ); + S32 colTxt_w = mProfile->mFont->getStrWidth( buff ); if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // We're making use of a bitmap border, so take into account the // right cap of the border. RectI* bitmapBounds = mProfile->mBitmapArrayRects.address(); - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - bitmapBounds[2].extent.x, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } else { - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - 12, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } diff --git a/Engine/source/gui/editor/guiGraphCtrl.cpp b/Engine/source/gui/editor/guiGraphCtrl.cpp index 8b1c14108..41e4d0d14 100644 --- a/Engine/source/gui/editor/guiGraphCtrl.cpp +++ b/Engine/source/gui/editor/guiGraphCtrl.cpp @@ -168,7 +168,7 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) F32 Scale = F32( getExtent().y ) / F32( mGraphMax[ k ] * 1.05 ); const S32 numSamples = mGraphData[ k ].size(); - + F32 graphOffset; switch( mGraphType[ k ] ) { case Bar: @@ -180,21 +180,21 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) PrimBuild::begin( GFXTriangleStrip, 4 ); PrimBuild::color( mGraphColor[ k ] ); - F32 offset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 ); + graphOffset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 ); PrimBuild::vertex2f( globalPos.x + prevOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY ); PrimBuild::vertex2f( globalPos.x + prevOffset, midPointY ); - prevOffset = offset; + prevOffset = graphOffset; PrimBuild::end(); } @@ -209,12 +209,12 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) for( S32 sample = 0; sample < numSamples; ++ sample ) { - F32 offset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); + graphOffset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); } @@ -234,9 +234,9 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) for( S32 sample = 0; sample < numSamples; ++ sample ) { - F32 offset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); + graphOffset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); } From f0c29172ca851f344b939b3193d16d871453e339 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 14:50:54 -0500 Subject: [PATCH 209/312] gui shadowvar cleanups --- Engine/source/gui/controls/guiDecoyCtrl.cpp | 1 - .../gui/controls/guiDirectoryFileListCtrl.cpp | 2 +- .../source/gui/controls/guiTreeViewCtrl.cpp | 24 ++++++++----------- Engine/source/gui/core/guiCanvas.cpp | 10 ++++---- Engine/source/gui/editor/guiEditCtrl.cpp | 14 +++++------ Engine/source/gui/editor/guiFilterCtrl.cpp | 18 +++++++------- Engine/source/gui/editor/guiInspector.cpp | 10 ++++---- .../source/gui/editor/guiInspectorTypes.cpp | 1 - Engine/source/navigation/guiNavEditorCtrl.cpp | 6 ++--- 9 files changed, 40 insertions(+), 46 deletions(-) diff --git a/Engine/source/gui/controls/guiDecoyCtrl.cpp b/Engine/source/gui/controls/guiDecoyCtrl.cpp index 56e2d9467..f7fd881e8 100644 --- a/Engine/source/gui/controls/guiDecoyCtrl.cpp +++ b/Engine/source/gui/controls/guiDecoyCtrl.cpp @@ -142,7 +142,6 @@ void GuiDecoyCtrl::onMouseMove(const GuiEvent &event) if(mIsDecoy == true) { mVisible = false; - GuiControl *parent = getParent(); GuiControl *tempControl = parent->findHitControl(localPoint); //the decoy control has the responsibility of keeping track of the decoyed controls status diff --git a/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp b/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp index c244af658..2752bb9dd 100644 --- a/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp +++ b/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp @@ -189,7 +189,7 @@ DefineEngineMethod( GuiDirectoryFileListCtrl, getSelectedFiles, const char*, (), // Fetch the remaining entries for( S32 i = 1; i < ItemVector.size(); i++ ) { - StringTableEntry itemText = object->getItemText( ItemVector[i] ); + itemText = object->getItemText( ItemVector[i] ); if( !itemText ) continue; diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 9d45147e1..266151587 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -3004,10 +3004,10 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) { if( !mActive || !mAwake || !mVisible ) return; - + + BitSet32 hitFlags = 0; if( isMethod("onMouseUp") ) { - BitSet32 hitFlags = 0; Item* item; S32 hitItemId = -1; @@ -3025,7 +3025,7 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) return; } - BitSet32 hitFlags = 0; + hitFlags = 0; Item *item; bool hitCheck = _hitTest( event.mousePoint, item, hitFlags ); mRenamingItem = NULL; @@ -3061,7 +3061,7 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) { Parent::onMouseMove( event ); - BitSet32 hitFlags = 0; + hitFlags = 0; if( !_hitTest( event.mousePoint, newItem2, hitFlags ) ) { if( !mShowRoot ) @@ -3794,16 +3794,12 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) if (item->isInspectorData()) { Entity* e = dynamic_cast(item->getObject()); - //if (item->mScriptInfo.mText != StringTable->insert("Components")) - { - Entity* e = dynamic_cast(item->getObject()); - if (e) - { - if (item->isExpanded()) - e->onInspect(); - else - e->onEndInspect(); - } + if (e) + { + if (item->isExpanded()) + e->onInspect(); + else + e->onEndInspect(); } } diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index efb0674ea..fd0b65ae0 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -1530,9 +1530,9 @@ void GuiCanvas::popDialogControl(GuiControl *gui) if (size() > 0) { - GuiControl *ctrl = static_cast(last()); - if( ctrl->getFirstResponder() ) - ctrl->getFirstResponder()->setFirstResponder(); + GuiControl *lastCtrl = static_cast(last()); + if(lastCtrl->getFirstResponder() ) + lastCtrl->getFirstResponder()->setFirstResponder(); } else { @@ -1547,8 +1547,8 @@ void GuiCanvas::popDialogControl(GuiControl *gui) if (size() > 0) { - GuiControl *ctrl = static_cast(last()); - ctrl->buildAcceleratorMap(); + GuiControl *lastCtrl = static_cast(last()); + lastCtrl->buildAcceleratorMap(); } refreshMouseControl(); } diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 09644d990..f81619efe 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -542,10 +542,10 @@ void GuiEditCtrl::onMouseDragged( const GuiEvent &event ) // Snap the mouse cursor to grid if active. Do this on the mouse cursor so that we handle // incremental drags correctly. - Point2I mousePoint = event.mousePoint; - snapToGrid( mousePoint ); + Point2I dragPoint = event.mousePoint; + snapToGrid(dragPoint); - Point2I delta = mousePoint - mLastDragPos; + Point2I delta = dragPoint - mLastDragPos; // If CTRL is down, apply smart snapping. @@ -584,7 +584,7 @@ void GuiEditCtrl::onMouseDragged( const GuiEvent &event ) // Remember drag point. - mLastDragPos = mousePoint; + mLastDragPos = dragPoint; } else if (mMouseDownMode == MovingSelection && mSelectedControls.size()) { @@ -770,7 +770,7 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect) ( mMouseDownMode == MovingSelection || mMouseDownMode == SizingSelection ) && ( mGridSnap.x || mGridSnap.y ) ) { - Point2I cext = getContentControl()->getExtent(); + cext = getContentControl()->getExtent(); Point2I coff = getContentControl()->localToGlobalCoord(Point2I(0,0)); // create point-dots @@ -847,8 +847,8 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect) if( mSnapTargets[ axis ] ) { - RectI bounds = mSnapTargets[ axis ]->getGlobalBounds(); - drawer->drawRect( bounds, ColorI( 128, 128, 128, 128 ) ); + RectI snapBounds = mSnapTargets[ axis ]->getGlobalBounds(); + drawer->drawRect(snapBounds, ColorI( 128, 128, 128, 128 ) ); } } } diff --git a/Engine/source/gui/editor/guiFilterCtrl.cpp b/Engine/source/gui/editor/guiFilterCtrl.cpp index a00d4f670..41dfa13a6 100644 --- a/Engine/source/gui/editor/guiFilterCtrl.cpp +++ b/Engine/source/gui/editor/guiFilterCtrl.cpp @@ -177,9 +177,9 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect) Point2I pos = offset; Point2I ext = getExtent(); - RectI r(pos, ext); - GFX->getDrawUtil()->drawRectFill(r, ColorI(255,255,255)); - GFX->getDrawUtil()->drawRect(r, ColorI(0,0,0)); + RectI bgRect(pos, ext); + GFX->getDrawUtil()->drawRectFill(bgRect, ColorI(255,255,255)); + GFX->getDrawUtil()->drawRect(bgRect, ColorI(0,0,0)); // shrink by 2 pixels pos.x += 2; @@ -218,13 +218,13 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect) // draw the knots for (U32 k=0; k < mFilter.size(); k++) { - RectI r; - r.point.x = (S32)(((F32)ext.x/(F32)(mFilter.size()-1)*(F32)k)); - r.point.y = (S32)(ext.y - ((F32)ext.y * mFilter[k])); - r.point += pos + Point2I(-2,-2); - r.extent = Point2I(5,5); + RectI knotRect; + knotRect.point.x = (S32)(((F32)ext.x/(F32)(mFilter.size()-1)*(F32)k)); + knotRect.point.y = (S32)(ext.y - ((F32)ext.y * mFilter[k])); + knotRect.point += pos + Point2I(-2,-2); + knotRect.extent = Point2I(5,5); - GFX->getDrawUtil()->drawRectFill(r, ColorI(255,0,0)); + GFX->getDrawUtil()->drawRectFill(knotRect, ColorI(255,0,0)); } renderChildControls(offset, updateRect); diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 4551d03e8..de6e43361 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -658,18 +658,18 @@ void GuiInspector::refresh() if( !group && !isGroupFiltered( itr->pGroupname ) ) { - GuiInspectorGroup *group = new GuiInspectorGroup( itr->pGroupname, this ); + GuiInspectorGroup *newGroup = new GuiInspectorGroup( itr->pGroupname, this ); - group->registerObject(); - if( !group->getNumFields() ) + newGroup->registerObject(); + if( !newGroup->getNumFields() ) { #ifdef DEBUG_SPEW Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'", - group->getCaption().c_str() ); + newGroup->getCaption().c_str() ); #endif // The group ended up having no fields. Remove it. - group->deleteObject(); + newGroup->deleteObject(); } else { diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index f31d4facd..a90da6587 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -1035,7 +1035,6 @@ GuiControl* GuiInspectorTypeEaseF::constructEditControl() mBrowseButton = new GuiButtonCtrl(); { RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) ); - char szBuffer[512]; dSprintf( szBuffer, sizeof( szBuffer ), "GetEaseF(%d.getText(), \"%d.apply\", %d.getRoot());", retCtrl->getId(), getId(), getId() ); mBrowseButton->setField( "Command", szBuffer ); mBrowseButton->setField( "text", "E" ); diff --git a/Engine/source/navigation/guiNavEditorCtrl.cpp b/Engine/source/navigation/guiNavEditorCtrl.cpp index bc605c054..64ae03b6c 100644 --- a/Engine/source/navigation/guiNavEditorCtrl.cpp +++ b/Engine/source/navigation/guiNavEditorCtrl.cpp @@ -535,10 +535,10 @@ void GuiNavEditorCtrl::renderScene(const RectI & updateRect) GFXStateBlockDesc desc; desc.setBlend(false); desc.setZReadWrite(true ,true); - MatrixF mat(true); - mat.setPosition(mLinkStart); + MatrixF linkMat(true); + linkMat.setPosition(mLinkStart); Point3F scale(0.8f, 0.8f, 0.8f); - GFX->getDrawUtil()->drawTransform(desc, mat, &scale); + GFX->getDrawUtil()->drawTransform(desc, linkMat, &scale); } } From 46ac677906fa1315a8a7c3093d1290d30a0be748 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 15:36:38 -0500 Subject: [PATCH 210/312] local 'duplicates' of scratchbuffer global shifted to varBuffer --- Engine/source/console/console.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index c3779de63..9605357a5 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -841,9 +841,9 @@ void setIntVariable(const char *varName, S32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char varBuffer[32]; + dSprintf(varBuffer, sizeof(varBuffer), "%d", value); + obj->setDataField(StringTable->insert(objField), 0, varBuffer); } else { @@ -860,9 +860,9 @@ void setFloatVariable(const char *varName, F32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char varBuffer[32]; + dSprintf(varBuffer, sizeof(varBuffer), "%g", value); + obj->setDataField(StringTable->insert(objField), 0, varBuffer); } else { From 610667f760bfdcc59f11a1caca2af24132459a3f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 15:37:04 -0500 Subject: [PATCH 211/312] groundcover shadowvar cleanup --- Engine/source/T3D/fx/groundCover.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 6e859e554..52ea5ef17 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1184,9 +1184,9 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index, terrainBlock = dynamic_cast< TerrainBlock* >( terrainBlocks.first() ); else { - for ( U32 i = 0; i < terrainBlocks.size(); i++ ) + for ( U32 blockIDx = 0; blockIDx < terrainBlocks.size(); blockIDx++ ) { - TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ i ] ); + TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ blockIDx ] ); if( !terrain ) continue; From 77e9f3c6d4dacdc8d0107478b0be709017bed739 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 17:31:28 -0500 Subject: [PATCH 212/312] CollisionState membervar clarification --- Engine/source/T3D/rigidShape.cpp | 6 +- Engine/source/T3D/vehicles/vehicle.cpp | 6 +- Engine/source/collision/convex.cpp | 18 +-- Engine/source/collision/convex.h | 8 +- Engine/source/collision/gjk.cpp | 204 ++++++++++++------------- Engine/source/collision/gjk.h | 18 +-- 6 files changed, 130 insertions(+), 130 deletions(-) diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index c7f876305..69144461f 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -1194,7 +1194,7 @@ bool RigidShape::updateCollision(F32 dt) mCollisionList.clear(); CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol); - if (state && state->dist <= mDataBlock->collisionTol) + if (state && state->mDist <= mDataBlock->collisionTol) { //resolveDisplacement(ns,state,dt); mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol); @@ -1326,8 +1326,8 @@ bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt) bool RigidShape::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt) { - SceneObject* obj = (state->a->getObject() == this)? - state->b->getObject(): state->a->getObject(); + SceneObject* obj = (state->mA->getObject() == this)? + state->mB->getObject(): state->mA->getObject(); if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0)) { diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index cdfff2827..a173d61fd 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -1364,7 +1364,7 @@ bool Vehicle::updateCollision(F32 dt) mCollisionList.clear(); CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol); - if (state && state->dist <= mDataBlock->collisionTol) + if (state && state->mDist <= mDataBlock->collisionTol) { //resolveDisplacement(ns,state,dt); mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol); @@ -1497,8 +1497,8 @@ bool Vehicle::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt) { PROFILE_SCOPE( Vehicle_ResolveDisplacement ); - SceneObject* obj = (state->a->getObject() == this)? - state->b->getObject(): state->a->getObject(); + SceneObject* obj = (state->mA->getObject() == this)? + state->mB->getObject(): state->mA->getObject(); if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0)) { diff --git a/Engine/source/collision/convex.cpp b/Engine/source/collision/convex.cpp index 0fda42812..01583c9f0 100644 --- a/Engine/source/collision/convex.cpp +++ b/Engine/source/collision/convex.cpp @@ -520,7 +520,7 @@ void Convex::updateStateList(const MatrixF& mat, const Point3F& scale, const Poi // Destroy states which are no longer intersecting for (CollisionStateList* itr = mList.mNext; itr != &mList; itr = itr->mNext) { - Convex* cv = (itr->mState->a == this)? itr->mState->b: itr->mState->a; + Convex* cv = (itr->mState->mA == this)? itr->mState->mB: itr->mState->mA; cv->mTag = sTag; if (!box1.isOverlapped(cv->getBoundingBox())) { CollisionState* cs = itr->mState; @@ -568,9 +568,9 @@ CollisionState* Convex::findClosestState(const MatrixF& mat, const Point3F& scal state->swap(); // Prepare scaled version of transform - MatrixF bxform = state->b->getTransform(); + MatrixF bxform = state->mB->getTransform(); temp = bxform; - Point3F bscale = state->b->getScale(); + Point3F bscale = state->mB->getScale(); bxform.scale(bscale); MatrixF bxforminv(true); bxforminv.scale(Point3F(1.0f/bscale.x, 1.0f/bscale.y, 1.0f/bscale.z)); @@ -613,7 +613,7 @@ bool Convex::getCollisionInfo(const MatrixF& mat, const Point3F& scale, Collisio if (state->mLista != itr) state->swap(); - if (state->dist <= tol) + if (state->mDist <= tol) { fa.reset(); fb.reset(); @@ -628,18 +628,18 @@ bool Convex::getCollisionInfo(const MatrixF& mat, const Point3F& scale, Collisio MatrixF imat = omat; imat.inverse(); - imat.mulV(-state->v,&v); + imat.mulV(-state->mDistvec,&v); getFeatures(omat,v,&fa); - imat = state->b->getTransform(); - imat.scale(state->b->getScale()); + imat = state->mB->getTransform(); + imat.scale(state->mB->getScale()); MatrixF bxform = imat; imat.inverse(); - imat.mulV(state->v,&v); + imat.mulV(state->mDistvec,&v); - state->b->getFeatures(bxform,v,&fb); + state->mB->getFeatures(bxform,v,&fb); fa.collide(fb,cList,tol); } diff --git a/Engine/source/collision/convex.h b/Engine/source/collision/convex.h index 5de048abc..fa6106f83 100644 --- a/Engine/source/collision/convex.h +++ b/Engine/source/collision/convex.h @@ -100,11 +100,11 @@ struct CollisionState { CollisionStateList* mLista; CollisionStateList* mListb; - Convex* a; - Convex* b; + Convex* mA; + Convex* mB; - F32 dist; // Current estimated distance - VectorF v; // Vector between closest points + F32 mDist; // Current estimated distance + VectorF mDistvec; // Vector between closest points // CollisionState(); diff --git a/Engine/source/collision/gjk.cpp b/Engine/source/collision/gjk.cpp index 5dff5ec92..e9debee81 100644 --- a/Engine/source/collision/gjk.cpp +++ b/Engine/source/collision/gjk.cpp @@ -46,7 +46,7 @@ S32 num_irregularities = 0; GjkCollisionState::GjkCollisionState() { - a = b = 0; + mA = mB = 0; } GjkCollisionState::~GjkCollisionState() @@ -58,9 +58,9 @@ GjkCollisionState::~GjkCollisionState() void GjkCollisionState::swap() { - Convex* t = a; a = b; b = t; + Convex* t = mA; mA = mB; mB = t; CollisionStateList* l = mLista; mLista = mListb; mListb = l; - v.neg(); + mDistvec.neg(); } @@ -70,44 +70,44 @@ void GjkCollisionState::compute_det() { // Dot new point with current set for (S32 i = 0, bit = 1; i < 4; ++i, bit <<=1) - if (bits & bit) - dp[i][last] = dp[last][i] = mDot(y[i], y[last]); - dp[last][last] = mDot(y[last], y[last]); + if (mBits & bit) + mDP[i][mLast] = mDP[mLast][i] = mDot(mY[i], mY[mLast]); + mDP[mLast][mLast] = mDot(mY[mLast], mY[mLast]); // Calulate the determinent - det[last_bit][last] = 1; + mDet[mLast_bit][mLast] = 1; for (S32 j = 0, sj = 1; j < 4; ++j, sj <<= 1) { - if (bits & sj) { - S32 s2 = sj | last_bit; - det[s2][j] = dp[last][last] - dp[last][j]; - det[s2][last] = dp[j][j] - dp[j][last]; + if (mBits & sj) { + S32 s2 = sj | mLast_bit; + mDet[s2][j] = mDP[mLast][mLast] - mDP[mLast][j]; + mDet[s2][mLast] = mDP[j][j] - mDP[j][mLast]; for (S32 k = 0, sk = 1; k < j; ++k, sk <<= 1) { - if (bits & sk) { + if (mBits & sk) { S32 s3 = sk | s2; - det[s3][k] = det[s2][j] * (dp[j][j] - dp[j][k]) + - det[s2][last] * (dp[last][j] - dp[last][k]); - det[s3][j] = det[sk | last_bit][k] * (dp[k][k] - dp[k][j]) + - det[sk | last_bit][last] * (dp[last][k] - dp[last][j]); - det[s3][last] = det[sk | sj][k] * (dp[k][k] - dp[k][last]) + - det[sk | sj][j] * (dp[j][k] - dp[j][last]); + mDet[s3][k] = mDet[s2][j] * (mDP[j][j] - mDP[j][k]) + + mDet[s2][mLast] * (mDP[mLast][j] - mDP[mLast][k]); + mDet[s3][j] = mDet[sk | mLast_bit][k] * (mDP[k][k] - mDP[k][j]) + + mDet[sk | mLast_bit][mLast] * (mDP[mLast][k] - mDP[mLast][j]); + mDet[s3][mLast] = mDet[sk | sj][k] * (mDP[k][k] - mDP[k][mLast]) + + mDet[sk | sj][j] * (mDP[j][k] - mDP[j][mLast]); } } } } - if (all_bits == 15) { - det[15][0] = det[14][1] * (dp[1][1] - dp[1][0]) + - det[14][2] * (dp[2][1] - dp[2][0]) + - det[14][3] * (dp[3][1] - dp[3][0]); - det[15][1] = det[13][0] * (dp[0][0] - dp[0][1]) + - det[13][2] * (dp[2][0] - dp[2][1]) + - det[13][3] * (dp[3][0] - dp[3][1]); - det[15][2] = det[11][0] * (dp[0][0] - dp[0][2]) + - det[11][1] * (dp[1][0] - dp[1][2]) + - det[11][3] * (dp[3][0] - dp[3][2]); - det[15][3] = det[7][0] * (dp[0][0] - dp[0][3]) + - det[7][1] * (dp[1][0] - dp[1][3]) + - det[7][2] * (dp[2][0] - dp[2][3]); + if (mAll_bits == 15) { + mDet[15][0] = mDet[14][1] * (mDP[1][1] - mDP[1][0]) + + mDet[14][2] * (mDP[2][1] - mDP[2][0]) + + mDet[14][3] * (mDP[3][1] - mDP[3][0]); + mDet[15][1] = mDet[13][0] * (mDP[0][0] - mDP[0][1]) + + mDet[13][2] * (mDP[2][0] - mDP[2][1]) + + mDet[13][3] * (mDP[3][0] - mDP[3][1]); + mDet[15][2] = mDet[11][0] * (mDP[0][0] - mDP[0][2]) + + mDet[11][1] * (mDP[1][0] - mDP[1][2]) + + mDet[11][3] * (mDP[3][0] - mDP[3][2]); + mDet[15][3] = mDet[7][0] * (mDP[0][0] - mDP[0][3]) + + mDet[7][1] * (mDP[1][0] - mDP[1][3]) + + mDet[7][2] * (mDP[2][0] - mDP[2][3]); } } @@ -120,8 +120,8 @@ inline void GjkCollisionState::compute_vector(S32 bits, VectorF& v) v.set(0, 0, 0); for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) { if (bits & bit) { - sum += det[bits][i]; - v += y[i] * det[bits][i]; + sum += mDet[bits][i]; + v += mY[i] * mDet[bits][i]; } } v *= 1 / sum; @@ -133,13 +133,13 @@ inline void GjkCollisionState::compute_vector(S32 bits, VectorF& v) inline bool GjkCollisionState::valid(S32 s) { for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) { - if (all_bits & bit) { + if (mAll_bits & bit) { if (s & bit) { - if (det[s][i] <= 0) + if (mDet[s][i] <= 0) return false; } else - if (det[s | bit][i] > 0) + if (mDet[s | bit][i] > 0) return false; } } @@ -152,19 +152,19 @@ inline bool GjkCollisionState::valid(S32 s) inline bool GjkCollisionState::closest(VectorF& v) { compute_det(); - for (S32 s = bits; s; --s) { - if ((s & bits) == s) { - if (valid(s | last_bit)) { - bits = s | last_bit; - if (bits != 15) - compute_vector(bits, v); + for (S32 s = mBits; s; --s) { + if ((s & mBits) == s) { + if (valid(s | mLast_bit)) { + mBits = s | mLast_bit; + if (mBits != 15) + compute_vector(mBits, v); return true; } } } - if (valid(last_bit)) { - bits = last_bit; - v = y[last]; + if (valid(mLast_bit)) { + mBits = mLast_bit; + v = mY[mLast]; return true; } return false; @@ -176,7 +176,7 @@ inline bool GjkCollisionState::closest(VectorF& v) inline bool GjkCollisionState::degenerate(const VectorF& w) { for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) - if ((all_bits & bit) && y[i] == w) + if ((mAll_bits & bit) && mY[i] == w) return true; return false; } @@ -186,11 +186,11 @@ inline bool GjkCollisionState::degenerate(const VectorF& w) inline void GjkCollisionState::nextBit() { - last = 0; - last_bit = 1; - while (bits & last_bit) { - ++last; - last_bit <<= 1; + mLast = 0; + mLast_bit = 1; + while (mBits & mLast_bit) { + ++mLast; + mLast_bit <<= 1; } } @@ -203,11 +203,11 @@ inline void GjkCollisionState::nextBit() void GjkCollisionState::set(Convex* aa, Convex* bb, const MatrixF& a2w, const MatrixF& b2w) { - a = aa; - b = bb; + mA = aa; + mB = bb; - bits = 0; - all_bits = 0; + mBits = 0; + mAll_bits = 0; reset(a2w,b2w); // link @@ -223,10 +223,10 @@ void GjkCollisionState::set(Convex* aa, Convex* bb, void GjkCollisionState::reset(const MatrixF& a2w, const MatrixF& b2w) { VectorF zero(0,0,0),sa,sb; - a2w.mulP(a->support(zero),&sa); - b2w.mulP(b->support(zero),&sb); - v = sa - sb; - dist = v.len(); + a2w.mulP(mA->support(zero),&sa); + b2w.mulP(mB->support(zero),&sb); + mDistvec = sa - sb; + mDist = mDistvec.len(); } @@ -237,18 +237,18 @@ void GjkCollisionState::getCollisionInfo(const MatrixF& mat, Collision* info) AssertFatal(false, "GjkCollisionState::getCollisionInfo() - There remain scaling problems here."); // This assumes that the shapes do not intersect Point3F pa,pb; - if (bits) { + if (mBits) { getClosestPoints(pa,pb); mat.mulP(pa,&info->point); - b->getTransform().mulP(pb,&pa); + mB->getTransform().mulP(pb,&pa); info->normal = info->point - pa; } else { - mat.mulP(p[last],&info->point); - info->normal = v; + mat.mulP(mP[mLast],&info->point); + info->normal = mDistvec; } info->normal.normalize(); - info->object = b->getObject(); + info->object = mB->getObject(); } void GjkCollisionState::getClosestPoints(Point3F& p1, Point3F& p2) @@ -257,10 +257,10 @@ void GjkCollisionState::getClosestPoints(Point3F& p1, Point3F& p2) p1.set(0, 0, 0); p2.set(0, 0, 0); for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) { - if (bits & bit) { - sum += det[bits][i]; - p1 += p[i] * det[bits][i]; - p2 += q[i] * det[bits][i]; + if (mBits & bit) { + sum += mDet[mBits][i]; + p1 += mP[i] * mDet[mBits][i]; + p2 += mQ[i] * mDet[mBits][i]; } } F32 s = 1 / sum; @@ -282,40 +282,40 @@ bool GjkCollisionState::intersect(const MatrixF& a2w, const MatrixF& b2w) w2b.inverse(); reset(a2w,b2w); - bits = 0; - all_bits = 0; + mBits = 0; + mAll_bits = 0; do { nextBit(); VectorF va,sa; - w2a.mulV(-v,&va); - p[last] = a->support(va); - a2w.mulP(p[last],&sa); + w2a.mulV(-mDistvec,&va); + mP[mLast] = mA->support(va); + a2w.mulP(mP[mLast],&sa); VectorF vb,sb; - w2b.mulV(v,&vb); - q[last] = b->support(vb); - b2w.mulP(q[last],&sb); + w2b.mulV(mDistvec,&vb); + mQ[mLast] = mB->support(vb); + b2w.mulP(mQ[mLast],&sb); VectorF w = sa - sb; - if (mDot(v,w) > 0) + if (mDot(mDistvec,w) > 0) return false; if (degenerate(w)) { ++num_irregularities; return false; } - y[last] = w; - all_bits = bits | last_bit; + mY[mLast] = w; + mAll_bits = mBits | mLast_bit; ++num_iterations; - if (!closest(v) || num_iterations > sIteration) { + if (!closest(mDistvec) || num_iterations > sIteration) { ++num_irregularities; return false; } } - while (bits < 15 && v.lenSquared() > sEpsilon2); + while (mBits < 15 && mDistvec.lenSquared() > sEpsilon2); return true; } @@ -337,51 +337,51 @@ F32 GjkCollisionState::distance(const MatrixF& a2w, const MatrixF& b2w, } reset(a2w,b2w); - bits = 0; - all_bits = 0; + mBits = 0; + mAll_bits = 0; F32 mu = 0; do { nextBit(); VectorF va,sa; - w2a.mulV(-v,&va); - p[last] = a->support(va); - a2w.mulP(p[last],&sa); + w2a.mulV(-mDistvec,&va); + mP[mLast] = mA->support(va); + a2w.mulP(mP[mLast],&sa); VectorF vb,sb; - w2b.mulV(v,&vb); - q[last] = b->support(vb); - b2w.mulP(q[last],&sb); + w2b.mulV(mDistvec,&vb); + mQ[mLast] = mB->support(vb); + b2w.mulP(mQ[mLast],&sb); VectorF w = sa - sb; - F32 nm = mDot(v, w) / dist; + F32 nm = mDot(mDistvec, w) / mDist; if (nm > mu) mu = nm; if (mu > dontCareDist) return mu; - if (mFabs(dist - mu) <= dist * rel_error) - return dist; + if (mFabs(mDist - mu) <= mDist * rel_error) + return mDist; ++num_iterations; if (degenerate(w) || num_iterations > sIteration) { ++num_irregularities; - return dist; + return mDist; } - y[last] = w; - all_bits = bits | last_bit; + mY[mLast] = w; + mAll_bits = mBits | mLast_bit; - if (!closest(v)) { + if (!closest(mDistvec)) { ++num_irregularities; - return dist; + return mDist; } - dist = v.len(); + mDist = mDistvec.len(); } - while (bits < 15 && dist > sTolerance) ; + while (mBits < 15 && mDist > sTolerance) ; - if (bits == 15 && mu <= 0) - dist = 0; - return dist; + if (mBits == 15 && mu <= 0) + mDist = 0; + return mDist; } diff --git a/Engine/source/collision/gjk.h b/Engine/source/collision/gjk.h index b35f4570d..906007bb3 100644 --- a/Engine/source/collision/gjk.h +++ b/Engine/source/collision/gjk.h @@ -43,17 +43,17 @@ struct GjkCollisionState: public CollisionState { /// @name Temporary values /// @{ - Point3F p[4]; ///< support points of object A in local coordinates - Point3F q[4]; ///< support points of object B in local coordinates - VectorF y[4]; ///< support points of A - B in world coordinates + Point3F mP[4]; ///< support points of object A in local coordinates + Point3F mQ[4]; ///< support points of object B in local coordinates + VectorF mY[4]; ///< support points of A - B in world coordinates - S32 bits; ///< identifies current simplex - S32 all_bits; ///< all_bits = bits | last_bit - F32 det[16][4]; ///< cached sub-determinants - F32 dp[4][4]; ///< cached dot products + S32 mBits; ///< identifies current simplex + S32 mAll_bits; ///< all_bits = bits | last_bit + F32 mDet[16][4]; ///< cached sub-determinants + F32 mDP[4][4]; ///< cached dot products - S32 last; ///< identifies last found support point - S32 last_bit; ///< last_bit = 1< Date: Thu, 15 Mar 2018 20:44:13 -0500 Subject: [PATCH 213/312] gfxDrawutil, gizmo shadowvar cleanups --- Engine/source/gfx/gfxDrawUtil.cpp | 14 +++++++------- Engine/source/gui/worldEditor/gizmo.cpp | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/gfx/gfxDrawUtil.cpp b/Engine/source/gfx/gfxDrawUtil.cpp index 0e7a4b3e9..131d7ccaa 100644 --- a/Engine/source/gfx/gfxDrawUtil.cpp +++ b/Engine/source/gfx/gfxDrawUtil.cpp @@ -1041,9 +1041,9 @@ void GFXDrawUtil::_drawSolidPolyhedron( const GFXStateBlockDesc &desc, const Any continue; } - U32 numPoints = poly.extractFace( i, &indices[ idx ], numIndices - idx ); - numIndicesForPoly[ numPolys ] = numPoints; - idx += numPoints; + U32 polyIDx = poly.extractFace( i, &indices[ idx ], numIndices - idx ); + numIndicesForPoly[ numPolys ] = polyIDx; + idx += polyIDx; numPolys ++; } @@ -1083,11 +1083,11 @@ void GFXDrawUtil::drawObjectBox( const GFXStateBlockDesc &desc, const Point3F &s PrimBuild::color( color ); PrimBuild::begin( GFXLineList, 48 ); - static const Point3F cubePoints[8] = + Point3F cubePts[8]; + for (U32 i = 0; i < 8; i++) { - Point3F(-0.5, -0.5, -0.5), Point3F(-0.5, -0.5, 0.5), Point3F(-0.5, 0.5, -0.5), Point3F(-0.5, 0.5, 0.5), - Point3F( 0.5, -0.5, -0.5), Point3F( 0.5, -0.5, 0.5), Point3F( 0.5, 0.5, -0.5), Point3F( 0.5, 0.5, 0.5) - }; + cubePts[i] = cubePoints[i]/2; + } // 8 corner points of the box for ( U32 i = 0; i < 8; i++ ) diff --git a/Engine/source/gui/worldEditor/gizmo.cpp b/Engine/source/gui/worldEditor/gizmo.cpp index 029cae110..a74202f81 100644 --- a/Engine/source/gui/worldEditor/gizmo.cpp +++ b/Engine/source/gui/worldEditor/gizmo.cpp @@ -612,12 +612,12 @@ bool Gizmo::collideAxisGizmo( const Gui3DMouseEvent & event ) Point3F(mOrigin + (p1 + p2) * scale) }; - Point3F end = camPos + event.vec * smProjectDistance; - F32 t = plane.intersect(camPos, end); + Point3F endProj = camPos + event.vec * smProjectDistance; + F32 t = plane.intersect(camPos, endProj); if ( t >= 0 && t <= 1 ) { Point3F pos; - pos.interpolate(camPos, end, t); + pos.interpolate(camPos, endProj, t); // check if inside our 'poly' of this axisIdx vector... bool inside = true; From bb9d181615d35b6074eb397a1bf4e247db943a64 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 20:45:18 -0500 Subject: [PATCH 214/312] tinyxml core class uses a 'value' variable. method io and tempvars altered to work around the 'conflict' --- Engine/source/persistence/taml/fsTinyXml.cpp | 6 +++--- Engine/source/persistence/taml/fsTinyXml.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/persistence/taml/fsTinyXml.cpp b/Engine/source/persistence/taml/fsTinyXml.cpp index 441169742..8afe7f16c 100644 --- a/Engine/source/persistence/taml/fsTinyXml.cpp +++ b/Engine/source/persistence/taml/fsTinyXml.cpp @@ -199,16 +199,16 @@ void fsTiXmlAttribute::Print( FileStream& stream, int depth, TIXML_STRING* str ) { TIXML_STRING n, v; - TiXmlString value = TiXmlString(Value()); + TiXmlString val = TiXmlString(Value()); EncodeString( NameTStr(), &n ); - EncodeString( value, &v ); + EncodeString( val, &v ); for ( int i=0; i< depth; i++ ) { stream.writeText( " " ); } - if (value.find ('\"') == TIXML_STRING::npos) { + if (val.find ('\"') == TIXML_STRING::npos) { const char* pValue = v.c_str(); char buffer[4096]; const S32 length = dSprintf(buffer, sizeof(buffer), "%s=\"%s\"", n.c_str(), pValue); diff --git a/Engine/source/persistence/taml/fsTinyXml.h b/Engine/source/persistence/taml/fsTinyXml.h index 864abec09..5040abf1a 100644 --- a/Engine/source/persistence/taml/fsTinyXml.h +++ b/Engine/source/persistence/taml/fsTinyXml.h @@ -129,7 +129,7 @@ public: attrib->SetValue( _value ); } } - void SetAttribute( const char * name, int value ) + void SetAttribute( const char * name, int _value) { TiXmlAttribute* attrib = attributeSet.Find( name ); if(!attrib) @@ -139,7 +139,7 @@ public: attrib->SetName( name ); } if ( attrib ) { - attrib->SetIntValue( value ); + attrib->SetIntValue(_value); } } TiXmlNode* Identify( const char* p, TiXmlEncoding encoding ); From d810e6d208bc64e0c7bd1953a3937d462b70d827 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 20:47:25 -0500 Subject: [PATCH 215/312] forest shadowvar cleanups --- Engine/source/forest/forestCollision.cpp | 2 +- Engine/source/forest/forestWindEmitter.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/forest/forestCollision.cpp b/Engine/source/forest/forestCollision.cpp index 213f15775..468c901dc 100644 --- a/Engine/source/forest/forestCollision.cpp +++ b/Engine/source/forest/forestCollision.cpp @@ -151,7 +151,7 @@ void ForestConvex::getFeatures( const MatrixF &mat, const VectorF &n, ConvexFeat for (i = 0; i < numVerts; i++) { cf->mVertexList.increment(); - U32 index = emitString[currPos++]; + index = emitString[currPos++]; mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last()); } diff --git a/Engine/source/forest/forestWindEmitter.cpp b/Engine/source/forest/forestWindEmitter.cpp index 46b879214..f02adbee6 100644 --- a/Engine/source/forest/forestWindEmitter.cpp +++ b/Engine/source/forest/forestWindEmitter.cpp @@ -150,10 +150,10 @@ void ForestWind::processTick() mCurrentInterp = 0; mCurrentTarget.set( 0, 0 ); - Point2F windDir( mDirection.x, mDirection.y ); - windDir.normalizeSafe(); + Point2F windNorm( mDirection.x, mDirection.y ); + windNorm.normalizeSafe(); - mCurrentTarget = finalVec + windDir; + mCurrentTarget = finalVec + windNorm; } else { From 248c5e9e6958b1a1581bc817a18facec7cb65f3b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 21:41:17 -0500 Subject: [PATCH 216/312] shadowvar cleanup --- Engine/source/T3D/gameBase/gameBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index d6afda811..ad7e4d983 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -455,7 +455,7 @@ F32 GameBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 u // Projectiles are more interesting if they // are heading for us. wInterest = 0.30f; - F32 dot = -mDot(pos,getVelocity()); + dot = -mDot(pos,getVelocity()); if (dot > 0.0f) wInterest += 0.20 * dot; } From 5282b37d9f7473a4cd6dcae1aa9f888e8ed9dadf Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 11:13:26 -0500 Subject: [PATCH 217/312] shadowvar cleanup --- Engine/source/T3D/entity.cpp | 2 -- Engine/source/console/engineDoc.cpp | 8 ++++---- Engine/source/console/fieldBrushObject.cpp | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index 62c0b031f..8e9426a23 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -1542,11 +1542,9 @@ void Entity::write(Stream &stream, U32 tabStop, U32 flags) if (mComponents.size() > 0) { // Pack out the behaviors into fields - U32 i = 0; for (U32 i = 0; i < mComponents.size(); i++) { writeTabs(stream, tabStop + 1); - char buffer[1024]; dSprintf(buffer, sizeof(buffer), "new %s() {\r\n", mComponents[i]->getClassName()); stream.write(dStrlen(buffer), buffer); //bi->writeFields( stream, tabStop + 2 ); diff --git a/Engine/source/console/engineDoc.cpp b/Engine/source/console/engineDoc.cpp index 5625418b7..cbbc7249d 100644 --- a/Engine/source/console/engineDoc.cpp +++ b/Engine/source/console/engineDoc.cpp @@ -248,13 +248,13 @@ static void dumpFunction( Stream &stream, const char* brief = dStrstr( doc, "@brief" ); if( !brief ) { - String brief = entry->getBriefDescription( &doc ); + String briefStr = entry->getBriefDescription( &doc ); - brief.trim(); - if( !brief.isEmpty() ) + briefStr.trim(); + if( !briefStr.isEmpty() ) { stream.writeText( "@brief " ); - stream.writeText( brief ); + stream.writeText(briefStr); stream.writeText( "\r\n\r\n" ); } } diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index 407a57cb3..3e91f711a 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -449,10 +449,10 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList // Yes, so is this field name selected? // Iterate fields... - for ( U32 fieldIndex = 0; fieldIndex < fields.size(); ++fieldIndex ) + for ( U32 findFieldIDx = 0; findFieldIDx < fields.size(); ++findFieldIDx) { // Field selected? - if ( staticField.pFieldname == fields[fieldIndex] ) + if ( staticField.pFieldname == fields[findFieldIDx] ) { // Yes, so flag as such. fieldSpecified = true; From 36c3a4d371578f1e4c15cd756ac12e7eb1412ed2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 16:21:53 -0500 Subject: [PATCH 218/312] (crashfix) clean up shadowvar followup. --- Engine/source/gui/editor/guiInspector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index de6e43361..06e06d996 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -673,8 +673,8 @@ void GuiInspector::refresh() } else { - mGroups.push_back( group ); - addObject( group ); + mGroups.push_back(newGroup); + addObject(newGroup); } } } From c3698c1db6219296158b0af05e55407f0a88178f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 17:12:22 -0500 Subject: [PATCH 219/312] unnecessarily duplicated var definitions --- Engine/source/T3D/decal/decalManager.cpp | 34 ++++++++++---------- Engine/source/collision/depthSortList.cpp | 2 +- Engine/source/collision/earlyOutPolyList.cpp | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index ab53842e5..2aa3bc2e0 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -1302,14 +1302,14 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // Loop through batches allocating buffers and submitting render instances. for ( U32 i = 0; i < batches.size(); i++ ) { - DecalBatch ¤tBatch = batches[i]; + currentBatch = &batches[i]; // Copy data into the system memory arrays, from all decals in this batch... DecalVertex *vpPtr = vertData; U16 *pbPtr = indexData; - U32 lastDecal = currentBatch.startDecal + currentBatch.decalCount; + U32 lastDecal = currentBatch->startDecal + currentBatch->decalCount; U32 voffset = 0; U32 ioffset = 0; @@ -1317,13 +1317,13 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // This is an ugly hack for ProjectedShadow! GFXTextureObject *customTex = NULL; - for ( U32 j = currentBatch.startDecal; j < lastDecal; j++ ) + for ( U32 j = currentBatch->startDecal; j < lastDecal; j++ ) { - DecalInstance *dinst = mDecalQueue[j]; + dinst = mDecalQueue[j]; const U32 indxCount = - (dinst->mIndxCount > currentBatch.iCount) ? - currentBatch.iCount : dinst->mIndxCount; + (dinst->mIndxCount > currentBatch->iCount) ? + currentBatch->iCount : dinst->mIndxCount; for ( U32 k = 0; k < indxCount; k++ ) { *( pbPtr + ioffset + k ) = dinst->mIndices[k] + voffset; @@ -1332,8 +1332,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) ioffset += indxCount; const U32 vertCount = - (dinst->mVertCount > currentBatch.vCount) ? - currentBatch.vCount : dinst->mVertCount; + (dinst->mVertCount > currentBatch->vCount) ? + currentBatch->vCount : dinst->mVertCount; dMemcpy( vpPtr + voffset, dinst->mVerts, sizeof( DecalVertex ) * vertCount ); voffset += vertCount; @@ -1342,8 +1342,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) customTex = *dinst->mCustomTex; } - AssertFatal( ioffset == currentBatch.iCount, "bad" ); - AssertFatal( voffset == currentBatch.vCount, "bad" ); + AssertFatal( ioffset == currentBatch->iCount, "bad" ); + AssertFatal( voffset == currentBatch->vCount, "bad" ); // Get handles to video memory buffers we will be filling... @@ -1385,9 +1385,9 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) pb->lock( &pbPtr ); // Memcpy from system to video memory. - const U32 vpCount = sizeof( DecalVertex ) * currentBatch.vCount; + const U32 vpCount = sizeof( DecalVertex ) * currentBatch->vCount; dMemcpy( vpPtr, vertData, vpCount ); - const U32 pbCount = sizeof( U16 ) * currentBatch.iCount; + const U32 pbCount = sizeof( U16 ) * currentBatch->iCount; dMemcpy( pbPtr, indexData, pbCount ); pb->unlock(); @@ -1400,7 +1400,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // Get the best lights for the current camera position // if the materail is forward lit and we haven't got them yet. - if ( currentBatch.matInst->isForwardLit() && !baseRenderInst.lights[0] ) + if ( currentBatch->matInst->isForwardLit() && !baseRenderInst.lights[0] ) { LightQuery query; query.init( rootFrustum.getPosition(), @@ -1416,15 +1416,15 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) ri->primBuff = pb; ri->vertBuff = vb; - ri->matInst = currentBatch.matInst; + ri->matInst = currentBatch->matInst; ri->prim = renderPass->allocPrim(); ri->prim->type = GFXTriangleList; ri->prim->minIndex = 0; ri->prim->startIndex = 0; - ri->prim->numPrimitives = currentBatch.iCount / 3; + ri->prim->numPrimitives = currentBatch->iCount / 3; ri->prim->startVertex = 0; - ri->prim->numVertices = currentBatch.vCount; + ri->prim->numVertices = currentBatch->vCount; // Ugly hack for ProjectedShadow! if ( customTex ) @@ -1433,7 +1433,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // The decal bin will contain render instances for both decals and decalRoad's. // Dynamic decals render last, then editor decals and roads in priority order. // DefaultKey is sorted in descending order. - ri->defaultKey = currentBatch.dynamic ? 0xFFFFFFFF : (U32)currentBatch.priority; + ri->defaultKey = currentBatch->dynamic ? 0xFFFFFFFF : (U32)currentBatch->priority; ri->defaultKey2 = 1;//(U32)lastDecal->mDataBlock; renderPass->addInst( ri ); diff --git a/Engine/source/collision/depthSortList.cpp b/Engine/source/collision/depthSortList.cpp index 87a50fab5..2ead81479 100644 --- a/Engine/source/collision/depthSortList.cpp +++ b/Engine/source/collision/depthSortList.cpp @@ -123,7 +123,7 @@ void DepthSortList::setExtents(Poly & poly, PolyExtents & polyExtents) polyExtents.zMin = polyExtents.zMax = p.z; for (S32 i=poly.vertexStart+1; i 0) { iv.mask = 1 << i; break; From d95af847e4620b383fc86b4132eacede22c71c1f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 17:14:12 -0500 Subject: [PATCH 220/312] flipped debug rendering on for convexShapes, and added the following prefs: $pref::convexDBG::ShowWorldBox = (bool); $pref::convexDBG::ShowEdges = (bool); <-----------aparantly nonfucntional $pref::convexDBG::ShowFaceColors = (bool); $pref::convexDBG::ShowWinding = (bool); $pref::convexDBG::ShowSurfaceTransforms = (bool); --- Engine/source/T3D/convexShape.cpp | 35 ++++++++++--------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index b5134be65..f97b543f6 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -492,7 +492,6 @@ void ConvexShape::unpackUpdate( NetConnection *conn, BitStream *stream ) void ConvexShape::prepRenderImage( SceneRenderState *state ) { - /* if ( state->isDiffusePass() ) { ObjectRenderInst *ri2 = state->getRenderPass()->allocInst(); @@ -500,8 +499,7 @@ void ConvexShape::prepRenderImage( SceneRenderState *state ) ri2->type = RenderPassManager::RIT_Editor; state->getRenderPass()->addInst( ri2 ); } - */ - + if ( mVertexBuffer.isNull() || !state) return; @@ -747,21 +745,10 @@ bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *in F32 t; F32 tmin = F32_MAX; S32 hitFace = -1; - Point3F hitPnt, pnt; + Point3F pnt; VectorF rayDir( end - start ); rayDir.normalizeSafe(); - - if ( false ) - { - PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) ); - Point3F sp( 0,0,-1 ); - Point3F ep( 0,0,1 ); - - F32 t = plane.intersect( sp, ep ); - Point3F hitPnt; - hitPnt.interpolate( sp, ep, t ); - } - + for ( S32 i = 0; i < planeCount; i++ ) { // Don't hit the back-side of planes. @@ -1180,11 +1167,11 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B GFX->setTexture( 0, NULL ); // Render world box. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowWorldBox", false)) { Box3F wbox( mWorldBox ); - //if ( getServerObject() ) - // Box3F wbox = static_cast( getServerObject() )->mWorldBox; + if ( getServerObject() ) + wbox = static_cast( getServerObject() )->mWorldBox; GFXStateBlockDesc desc; desc.setCullMode( GFXCullNone ); desc.setFillModeWireframe(); @@ -1196,7 +1183,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B const Vector< ConvexShape::Face > &faceList = mGeometry.faces; // Render Edges. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowEdges", false)) { GFXTransformSaver saver; //GFXFrustumSaver fsaver; @@ -1250,7 +1237,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B objToWorld.scale( mObjScale ); // Render faces centers/colors. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowFaceColors", false)) { GFXStateBlockDesc desc; desc.setCullMode( GFXCullNone ); @@ -1274,7 +1261,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B } // Render winding order. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowWinding", false)) { GFXStateBlockDesc desc; desc.setCullMode( GFXCullNone ); @@ -1331,7 +1318,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B } // Render surface transforms. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowSurfaceTransforms", false)) { GFXStateBlockDesc desc; desc.setBlend( false ); @@ -1341,7 +1328,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B for ( S32 i = 0; i < mSurfaces.size(); i++ ) { - MatrixF objToWorld( mObjToWorld ); + objToWorld = mObjToWorld; objToWorld.scale( mObjScale ); MatrixF renderMat; From e4bd3e8295a86a697c937c1fdca302735c2ec400 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 17:40:25 -0500 Subject: [PATCH 221/312] shadowvar cleanup --- Engine/source/gui/controls/guiTreeViewCtrl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 266151587..881f76ed4 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -3026,25 +3026,25 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) } hitFlags = 0; - Item *item; - bool hitCheck = _hitTest( event.mousePoint, item, hitFlags ); + Item *hitItem; + bool hitCheck = _hitTest( event.mousePoint, hitItem, hitFlags ); mRenamingItem = NULL; if( hitCheck ) { if ( event.mouseClickCount == 1 && !mMouseDragged && mPossibleRenameItem != NULL ) { - if ( item == mPossibleRenameItem ) - showItemRenameCtrl( item ); + if (hitItem == mPossibleRenameItem ) + showItemRenameCtrl(hitItem); } else // If mouseUp occurs on the same item as mouse down { - bool wasSelected = isSelected( item ); + bool wasSelected = isSelected(hitItem); bool multiSelect = getSelectedItemsCount() > 1; - if( wasSelected && multiSelect && item == mTempItem ) + if( wasSelected && multiSelect && hitItem == mTempItem ) { clearSelection(); - addSelection( item->mId ); + addSelection( hitItem->mId ); } } } From 53ce915dcfe39f1b5558e23bbe83e30beb224b4a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 18:40:32 -0500 Subject: [PATCH 222/312] collada/ts chain shadowvar and member var clenaups --- Engine/source/ts/collada/colladaAppMesh.cpp | 14 +- Engine/source/ts/collada/colladaImport.cpp | 6 +- .../source/ts/collada/colladaShapeLoader.cpp | 22 +- Engine/source/ts/collada/colladaUtils.cpp | 4 +- Engine/source/ts/loader/tsShapeLoader.cpp | 454 +++++++++--------- Engine/source/ts/loader/tsShapeLoader.h | 28 +- 6 files changed, 264 insertions(+), 264 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index c1420d1cd..5a928dae0 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -147,12 +147,12 @@ private: end = start; // Get the set for this input - const domInputLocalOffset* localOffset = daeSafeCast(input); + domInputLocalOffset* localOffset = daeSafeCast(input); domUint newSet = localOffset ? localOffset->getSet() : 0; // Add the input to the right place in the list (somewhere between start and end) for (S32 i = start; i <= end; i++) { - const domInputLocalOffset* localOffset = daeSafeCast(sortedInputs[i]); + localOffset = daeSafeCast(sortedInputs[i]); domUint set = localOffset ? localOffset->getSet() : 0xFFFFFFFF; if (newSet < set) { for (S32 j = i + 1; j <= end; j++) @@ -181,10 +181,10 @@ private: const char* semantic = SourceTypeToSemantic( type ); for (S32 iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++) { - domInputLocal* input = vertices->getInput_array().get(iInput); - if (dStrEqual(input->getSemantic(), semantic)) + domInputLocal* vInput = vertices->getInput_array().get(iInput); + if (dStrEqual(vInput->getSemantic(), semantic)) { - source = daeSafeCast(findInputSource(input)); + source = daeSafeCast(findInputSource(vInput)); break; } } @@ -966,7 +966,7 @@ void ColladaAppMesh::lookupSkinData() // Determine the offset into the vindices array for each vertex (since each // vertex may have multiple [bone, weight] pairs in the array) Vector vindicesOffset; - const domInt* vindices = (domInt*)weights_v.getRaw(0); + domInt* vindices = (domInt*)weights_v.getRaw(0); for (S32 iWeight = 0; iWeight < weights_vcount.getCount(); iWeight++) { // Store the offset into the vindices array for this vertex vindicesOffset.push_back(vindices - (domInt*)weights_v.getRaw(0)); @@ -977,7 +977,7 @@ void ColladaAppMesh::lookupSkinData() bool tooManyWeightsWarning = false; for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); - const domInt* vindices = (domInt*)weights_v.getRaw(0); + vindices = (domInt*)weights_v.getRaw(0); vindices += vindicesOffset[vertTuples[iVert].vertex]; S32 nonZeroWeightCount = 0; diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index 1cc2909b0..ded830d5c 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -120,9 +120,9 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen for (S32 i = 0; i < node->getInstance_node_array().getCount(); i++) { domInstance_node* instnode = node->getInstance_node_array()[i]; - domNode* node = daeSafeCast(instnode->getUrl().getElement()); - if (node) - processNode(tree, node, nodeID, stats); + domNode* dNode = daeSafeCast(instnode->getUrl().getElement()); + if (dNode) + processNode(tree, dNode, nodeID, stats); } } diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index afb53fdaf..1ac98e072 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -239,14 +239,14 @@ void ColladaShapeLoader::enumerateScene() for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) { const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib]; for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++) - appSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); + mAppSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); } // Process all animations => this attaches animation channels to the targeted // Collada elements, and determines the length of the sequence if it is not // already specified in the Collada element - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { - ColladaAppSequence* appSeq = dynamic_cast(appSequences[iSeq]); + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { + ColladaAppSequence* appSeq = dynamic_cast(mAppSequences[iSeq]); F32 maxEndTime = 0; F32 minFrameTime = 1000.0f; for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) { @@ -317,7 +317,7 @@ void ColladaShapeLoader::enumerateScene() } // Make sure that the scene has a bounds node (for getting the root scene transform) - if (!boundsNode) + if (!mBoundsNode) { domVisual_scene* visualScene = root->getLibrary_visual_scenes_array()[0]->getVisual_scene_array()[0]; domNode* dombounds = daeSafeCast( visualScene->createAndPlace( "node" ) ); @@ -354,7 +354,7 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) ColladaUtils::getOptions().adjustFloor) ) { // Compute shape offset - Point3F shapeOffset = Point3F::Zero; + Point3F shapeOffset = Point3F::Zero; if ( ColladaUtils::getOptions().adjustCenter ) { bounds.getCenter( &shapeOffset ); @@ -368,24 +368,24 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) bounds.maxExtents += shapeOffset; // Now adjust all positions for root level nodes (nodes with no parent) - for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++) + for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++) { - if ( !appNodes[iNode]->isParentRoot() ) + if ( !mAppNodes[iNode]->isParentRoot() ) continue; // Adjust default translation - shape->defaultTranslations[iNode] += shapeOffset; + mShape->defaultTranslations[iNode] += shapeOffset; // Adjust animated translations - for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++) { - const TSShape::Sequence& seq = shape->sequences[iSeq]; + const TSShape::Sequence& seq = mShape->sequences[iSeq]; if ( seq.translationMatters.test(iNode) ) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame; - shape->nodeTranslations[index] += shapeOffset; + mShape->nodeTranslations[index] += shapeOffset; } } } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index e88abe372..2294ff7be 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -263,10 +263,10 @@ void AnimData::parseTargetString(const char* target, S32 fullCount, const char* targetValueCount = 1; } } - else if (const char* p = dStrrchr(target, '.')) { + else if (const char* p2 = dStrrchr(target, '.')) { // Check for named elements for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) { - if (!dStrcmp(p, elements[iElem])) { + if (!dStrcmp(p2, elements[iElem])) { targetValueOffset = iElem; targetValueCount = 1; break; diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 11779eb6b..35cc9c8bd 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -44,7 +44,7 @@ const F32 TSShapeLoader::DefaultTime = -1.0f; const F64 TSShapeLoader::MinFrameRate = 15.0f; const F64 TSShapeLoader::MaxFrameRate = 60.0f; const F64 TSShapeLoader::AppGroundFrameRate = 10.0f; -Torque::Path TSShapeLoader::shapePath; +Torque::Path TSShapeLoader::mShapePath; Vector TSShapeLoader::smFormats; @@ -73,7 +73,7 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) if (node->mParentIndex >= 0) { - AppNode *parent = appNodes[node->mParentIndex]; + AppNode *parent = mAppNodes[node->mParentIndex]; MatrixF m2 = parent->getNodeTransform(t); @@ -84,10 +84,10 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) // get local transform by pre-multiplying by inverted parent transform m1 = m2.inverse() * m1; } - else if (boundsNode && node != boundsNode) + else if (mBoundsNode && node != mBoundsNode) { // make transform relative to bounds node transform at time=t - MatrixF mb = boundsNode->getNodeTransform(t); + MatrixF mb = mBoundsNode->getNodeTransform(t); zapScale(mb); m1 = mb.inverse() * m1; } @@ -133,22 +133,22 @@ void TSShapeLoader::updateProgress(S32 major, const char* msg, S32 numMinor, S32 TSShape* TSShapeLoader::generateShape(const Torque::Path& path) { - shapePath = path; - shape = new TSShape(); + mShapePath = path; + mShape = new TSShape(); - shape->mExporterVersion = 124; - shape->mSmallestVisibleSize = 999999; - shape->mSmallestVisibleDL = 0; - shape->mReadVersion = 24; - shape->mFlags = 0; - shape->mSequencesConstructed = 0; + mShape->mExporterVersion = 124; + mShape->mSmallestVisibleSize = 999999; + mShape->mSmallestVisibleDL = 0; + mShape->mReadVersion = 24; + mShape->mFlags = 0; + mShape->mSequencesConstructed = 0; // Get all nodes, objects and sequences in the shape updateProgress(Load_EnumerateScene, "Enumerating scene..."); enumerateScene(); - if (!subshapes.size()) + if (!mSubshapes.size()) { - delete shape; + delete mShape; Con::errorf("Failed to load shape \"%s\", no subshapes found", path.getFullPath().c_str()); return NULL; } @@ -178,7 +178,7 @@ TSShape* TSShapeLoader::generateShape(const Torque::Path& path) // Install the TS memory helper into a TSShape object. install(); - return shape; + return mShape; } bool TSShapeLoader::processNode(AppNode* node) @@ -186,20 +186,20 @@ bool TSShapeLoader::processNode(AppNode* node) // Detect bounds node if ( node->isBounds() ) { - if ( boundsNode ) + if ( mBoundsNode ) { Con::warnf( "More than one bounds node found" ); return false; } - boundsNode = node; + mBoundsNode = node; // Process bounds geometry - MatrixF boundsMat(boundsNode->getNodeTransform(DefaultTime)); + MatrixF boundsMat(mBoundsNode->getNodeTransform(DefaultTime)); boundsMat.inverse(); zapScale(boundsMat); - for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = boundsNode->getMesh(iMesh); + AppMesh* mesh = mBoundsNode->getMesh(iMesh); MatrixF transform = mesh->getMeshTransform(DefaultTime); transform.mulL(boundsMat); mesh->lockMesh(DefaultTime, transform); @@ -215,10 +215,10 @@ bool TSShapeLoader::processNode(AppNode* node) } // Add this node to the subshape (create one if needed) - if ( subshapes.size() == 0 ) - subshapes.push_back( new TSShapeLoader::Subshape ); + if (mSubshapes.size() == 0 ) + mSubshapes.push_back( new TSShapeLoader::Subshape ); - subshapes.last()->branches.push_back( node ); + mSubshapes.last()->branches.push_back( node ); return true; } @@ -263,8 +263,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (appNode->isBounds()) return; - S32 subShapeNum = shape->subShapeFirstNode.size()-1; - Subshape* subshape = subshapes[subShapeNum]; + S32 subShapeNum = mShape->subShapeFirstNode.size()-1; + Subshape* subshape = mSubshapes[subShapeNum]; // Check if we should collapse this node S32 myIndex; @@ -275,16 +275,16 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu else { // Check that adding this node will not exceed the maximum node count - if (shape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->nodes.size() >= MAX_TS_SET_SIZE) return; - myIndex = shape->nodes.size(); - String nodeName = getUniqueName(appNode->getName(), cmpShapeName, shape->names); + myIndex = mShape->nodes.size(); + String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->names); // Create the 3space node - shape->nodes.increment(); - TSShape::Node& lastNode = shape->nodes.last(); - lastNode.nameIndex = shape->addName(nodeName); + mShape->nodes.increment(); + TSShape::Node& lastNode = mShape->nodes.last(); + lastNode.nameIndex = mShape->addName(nodeName); lastNode.parentIndex = parentIndex; lastNode.firstObject = -1; lastNode.firstChild = -1; @@ -292,8 +292,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu // Add the AppNode to a matching list (so AppNodes can be accessed using 3space // node indices) - appNodes.push_back(appNode); - appNodes.last()->mParentIndex = parentIndex; + mAppNodes.push_back(appNode); + mAppNodes.last()->mParentIndex = parentIndex; // Check for NULL detail or AutoBillboard nodes (no children or geometry) if ((appNode->getNumChildNodes() == 0) && @@ -304,7 +304,7 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (dStrEqual(dname, "nulldetail") && (size != 0x7FFFFFFF)) { - shape->addDetail("detail", size, subShapeNum); + mShape->addDetail("detail", size, subShapeNum); } else if (appNode->isBillboard() && (size != 0x7FFFFFFF)) { @@ -323,9 +323,9 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu appNode->getInt("BB::DIM", dim); appNode->getBool("BB::INCLUDE_POLES", includePoles); - S32 detIndex = shape->addDetail( "bbDetail", size, -1 ); + S32 detIndex = mShape->addDetail( "bbDetail", size, -1 ); - TSShape::Detail& detIndexDetail = shape->details[detIndex]; + TSShape::Detail& detIndexDetail = mShape->details[detIndex]; detIndexDetail.bbEquatorSteps = numEquatorSteps; detIndexDetail.bbPolarSteps = numPolarSteps; detIndexDetail.bbDetailLevel = dl; @@ -357,23 +357,23 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu void TSShapeLoader::generateSubshapes() { - for (U32 iSub = 0; iSub < subshapes.size(); iSub++) + for (U32 iSub = 0; iSub < mSubshapes.size(); iSub++) { - updateProgress(Load_GenerateSubshapes, "Generating subshapes...", subshapes.size(), iSub); + updateProgress(Load_GenerateSubshapes, "Generating subshapes...", mSubshapes.size(), iSub); - Subshape* subshape = subshapes[iSub]; + Subshape* subshape = mSubshapes[iSub]; // Recurse through the node hierarchy, adding 3space nodes and // collecting geometry - S32 firstNode = shape->nodes.size(); - shape->subShapeFirstNode.push_back(firstNode); + S32 firstNode = mShape->nodes.size(); + mShape->subShapeFirstNode.push_back(firstNode); for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++) recurseSubshape(subshape->branches[iBranch], -1, true); - shape->subShapeNumNodes.push_back(shape->nodes.size() - firstNode); + mShape->subShapeNumNodes.push_back(mShape->nodes.size() - firstNode); - if (shape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->nodes.size() >= MAX_TS_SET_SIZE) { Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.", MAX_TS_SET_SIZE); @@ -400,10 +400,10 @@ bool cmpMeshNameAndSize(const String& key, const Vector& names, void* ar void TSShapeLoader::generateObjects() { - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) { - Subshape* subshape = subshapes[iSub]; - shape->subShapeFirstObject.push_back(shape->objects.size()); + Subshape* subshape = mSubshapes[iSub]; + mShape->subShapeFirstObject.push_back(mShape->objects.size()); // Get the names and sizes of the meshes for this subshape Vector meshNames; @@ -464,18 +464,18 @@ void TSShapeLoader::generateObjects() if (!lastName || (meshNames[iMesh] != *lastName)) { - shape->objects.increment(); - TSShape::Object& lastObject = shape->objects.last(); - lastObject.nameIndex = shape->addName(meshNames[iMesh]); + mShape->objects.increment(); + TSShape::Object& lastObject = mShape->objects.last(); + lastObject.nameIndex = mShape->addName(meshNames[iMesh]); lastObject.nodeIndex = subshape->objNodes[iMesh]; - lastObject.startMeshIndex = appMeshes.size(); + lastObject.startMeshIndex = mAppMeshes.size(); lastObject.numMeshes = 0; lastName = &meshNames[iMesh]; } // Add this mesh to the object - appMeshes.push_back(mesh); - shape->objects.last().numMeshes++; + mAppMeshes.push_back(mesh); + mShape->objects.last().numMeshes++; // Set mesh flags mesh->flags = 0; @@ -498,9 +498,9 @@ void TSShapeLoader::generateObjects() } // Attempt to add the detail (will fail if it already exists) - S32 oldNumDetails = shape->details.size(); - shape->addDetail(detailName, mesh->detailSize, iSub); - if (shape->details.size() > oldNumDetails) + S32 oldNumDetails = mShape->details.size(); + mShape->addDetail(detailName, mesh->detailSize, iSub); + if (mShape->details.size() > oldNumDetails) { Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has" " been added automatically)", mesh->getName(false), detailName, mesh->detailSize); @@ -508,18 +508,18 @@ void TSShapeLoader::generateObjects() } // Get object count for this subshape - shape->subShapeNumObjects.push_back(shape->objects.size() - shape->subShapeFirstObject.last()); + mShape->subShapeNumObjects.push_back(mShape->objects.size() - mShape->subShapeFirstObject.last()); } } void TSShapeLoader::generateSkins() { Vector skins; - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { - for (S32 iMesh = 0; iMesh < shape->objects[iObject].numMeshes; iMesh++) + for (S32 iMesh = 0; iMesh < mShape->objects[iObject].numMeshes; iMesh++) { - AppMesh* mesh = appMeshes[shape->objects[iObject].startMeshIndex + iMesh]; + AppMesh* mesh = mAppMeshes[mShape->objects[iObject].startMeshIndex + iMesh]; if (mesh->isSkin()) skins.push_back(mesh); } @@ -543,12 +543,12 @@ void TSShapeLoader::generateSkins() { // Find the node that matches this bone skin->nodeIndex[iBone] = -1; - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppMeshes.size(); iNode++) { - if (appNodes[iNode]->isEqual(skin->bones[iBone])) + if (mAppNodes[iNode]->isEqual(skin->bones[iBone])) { delete skin->bones[iBone]; - skin->bones[iBone] = appNodes[iNode]; + skin->bones[iBone] = mAppNodes[iNode]; skin->nodeIndex[iBone] = iNode; break; } @@ -566,18 +566,18 @@ void TSShapeLoader::generateSkins() void TSShapeLoader::generateDefaultStates() { // Generate default object states (includes initial geometry) - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...", - shape->objects.size(), iObject); + mShape->objects.size(), iObject); - TSShape::Object& obj = shape->objects[iObject]; + TSShape::Object& obj = mShape->objects[iObject]; // Calculate the objectOffset for each mesh at T=0 for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; - AppNode* appNode = obj.nodeIndex >= 0 ? appNodes[obj.nodeIndex] : boundsNode; + AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; + AppNode* appNode = obj.nodeIndex >= 0 ? mAppNodes[obj.nodeIndex] : mBoundsNode; MatrixF meshMat(appMesh->getMeshTransform(DefaultTime)); MatrixF nodeMat(appMesh->isSkin() ? meshMat : appNode->getNodeTransform(DefaultTime)); @@ -587,16 +587,16 @@ void TSShapeLoader::generateDefaultStates() appMesh->objectOffset = nodeMat.inverse() * meshMat; } - generateObjectState(shape->objects[iObject], DefaultTime, true, true); + generateObjectState(mShape->objects[iObject], DefaultTime, true, true); } // Generate default node transforms - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Determine the default translation and rotation for the node QuatF rot, srot; Point3F trans, scale; - generateNodeTransform(appNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); + generateNodeTransform(mAppNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); // Add default node translation and rotation addNodeRotation(rot, true); @@ -606,20 +606,20 @@ void TSShapeLoader::generateDefaultStates() void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame) { - shape->objectStates.increment(); - TSShape::ObjectState& state = shape->objectStates.last(); + mShape->objectStates.increment(); + TSShape::ObjectState& state = mShape->objectStates.last(); state.frameIndex = 0; state.matFrameIndex = 0; - state.vis = mClampF(appMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); + state.vis = mClampF(mAppMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); if (addFrame || addMatFrame) { generateFrame(obj, t, addFrame, addMatFrame); // set the frame number for the object state - state.frameIndex = appMeshes[obj.startMeshIndex]->numFrames - 1; - state.matFrameIndex = appMeshes[obj.startMeshIndex]->numMatFrames - 1; + state.frameIndex = mAppMeshes[obj.startMeshIndex]->numFrames - 1; + state.matFrameIndex = mAppMeshes[obj.startMeshIndex]->numMatFrames - 1; } } @@ -627,7 +627,7 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo { for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; + AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; U32 oldNumPoints = appMesh->points.size(); U32 oldNumUvs = appMesh->uvs.size(); @@ -704,13 +704,13 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo void TSShapeLoader::generateMaterialList() { // Install the materials into the material list - shape->materialList = new TSMaterialList; + mShape->materialList = new TSMaterialList; for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++) { updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::appMaterials.size(), iMat); AppMaterial* appMat = AppMesh::appMaterials[iMat]; - shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); + mShape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); } } @@ -720,38 +720,38 @@ void TSShapeLoader::generateMaterialList() void TSShapeLoader::generateSequences() { - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { - updateProgress(Load_GenerateSequences, "Generating sequences...", appSequences.size(), iSeq); + updateProgress(Load_GenerateSequences, "Generating sequences...", mAppSequences.size(), iSeq); // Initialize the sequence - appSequences[iSeq]->setActive(true); + mAppSequences[iSeq]->setActive(true); - shape->sequences.increment(); - TSShape::Sequence& seq = shape->sequences.last(); + mShape->sequences.increment(); + TSShape::Sequence& seq = mShape->sequences.last(); - seq.nameIndex = shape->addName(appSequences[iSeq]->getName()); - seq.toolBegin = appSequences[iSeq]->getStart(); - seq.priority = appSequences[iSeq]->getPriority(); - seq.flags = appSequences[iSeq]->getFlags(); + seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName()); + seq.toolBegin = mAppSequences[iSeq]->getStart(); + seq.priority = mAppSequences[iSeq]->getPriority(); + seq.flags = mAppSequences[iSeq]->getFlags(); // Compute duration and number of keyframes (then adjust time between frames to match) - seq.duration = appSequences[iSeq]->getEnd() - appSequences[iSeq]->getStart(); - seq.numKeyframes = (S32)(seq.duration * appSequences[iSeq]->fps + 0.5f) + 1; + seq.duration = mAppSequences[iSeq]->getEnd() - mAppSequences[iSeq]->getStart(); + seq.numKeyframes = (S32)(seq.duration * mAppSequences[iSeq]->fps + 0.5f) + 1; seq.sourceData.start = 0; seq.sourceData.end = seq.numKeyframes-1; seq.sourceData.total = seq.numKeyframes; // Set membership arrays (ie. which nodes and objects are affected by this sequence) - setNodeMembership(seq, appSequences[iSeq]); - setObjectMembership(seq, appSequences[iSeq]); + setNodeMembership(seq, mAppSequences[iSeq]); + setObjectMembership(seq, mAppSequences[iSeq]); // Generate keyframes generateNodeAnimation(seq); - generateObjectAnimation(seq, appSequences[iSeq]); - generateGroundAnimation(seq, appSequences[iSeq]); - generateFrameTriggers(seq, appSequences[iSeq]); + generateObjectAnimation(seq, mAppSequences[iSeq]); + generateGroundAnimation(seq, mAppSequences[iSeq]); + generateFrameTriggers(seq, mAppSequences[iSeq]); // Set sequence flags seq.dirtyFlags = 0; @@ -765,11 +765,11 @@ void TSShapeLoader::generateSequences() seq.dirtyFlags |= TSShapeInstance::MatFrameDirty; // Set shape flags (only the most significant scale type) - U32 curVal = shape->mFlags & TSShape::AnyScale; - shape->mFlags &= ~(TSShape::AnyScale); - shape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) + U32 curVal = mShape->mFlags & TSShape::AnyScale; + mShape->mFlags &= ~(TSShape::AnyScale); + mShape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) - appSequences[iSeq]->setActive(false); + mAppSequences[iSeq]->setActive(false); } } @@ -798,16 +798,16 @@ void TSShapeLoader::setNodeMembership(TSShape::Sequence& seq, const AppSequence* void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node rotations are different to // the default rotation QuatF defaultRot; - shape->defaultRotations[iNode].getQuatF(&defaultRot); + mShape->defaultRotations[iNode].getQuatF(&defaultRot); for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (nodeRotCache[iNode][iFrame] != defaultRot) + if (mNodeRotCache[iNode][iFrame] != defaultRot) { seq.rotationMatters.set(iNode); break; @@ -818,15 +818,15 @@ void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) void TSShapeLoader::setTranslationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node translations are different to // the default translation - Point3F& defaultTrans = shape->defaultTranslations[iNode]; + Point3F& defaultTrans = mShape->defaultTranslations[iNode]; for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (!nodeTransCache[iNode][iFrame].equal(defaultTrans)) + if (!mNodeTransCache[iNode][iFrame].equal(defaultTrans)) { seq.translationMatters.set(iNode); break; @@ -843,16 +843,16 @@ void TSShapeLoader::setScaleMembership(TSShape::Sequence& seq) U32 alignedScaleCount = 0; U32 uniformScaleCount = 0; - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node scales are not the unit scale for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - Point3F& scale = nodeScaleCache[iNode][iFrame]; + Point3F& scale = mNodeScaleCache[iNode][iFrame]; if (!unitScale.equal(scale)) { // Determine what type of scale this is - if (!nodeScaleRotCache[iNode][iFrame].isIdentity()) + if (!mNodeScaleRotCache[iNode][iFrame].isIdentity()) arbitraryScaleCount++; else if (scale.x != scale.y || scale.y != scale.z) alignedScaleCount++; @@ -880,12 +880,12 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size()) seq.matFrameMatters.clearAll(); // UV animation (size = objects.size()) - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { - if (!appMeshes[shape->objects[iObject].startMeshIndex]) + if (!mAppMeshes[mShape->objects[iObject].startMeshIndex]) continue; - if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) + if (mAppMeshes[mShape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) seq.visMatters.set(iObject); // Morph and UV animation has been deprecated //if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq)) @@ -898,18 +898,18 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc void TSShapeLoader::clearNodeTransformCache() { // clear out the transform caches - for (S32 i = 0; i < nodeRotCache.size(); i++) - delete [] nodeRotCache[i]; - nodeRotCache.clear(); - for (S32 i = 0; i < nodeTransCache.size(); i++) - delete [] nodeTransCache[i]; - nodeTransCache.clear(); - for (S32 i = 0; i < nodeScaleRotCache.size(); i++) - delete [] nodeScaleRotCache[i]; - nodeScaleRotCache.clear(); - for (S32 i = 0; i < nodeScaleCache.size(); i++) - delete [] nodeScaleCache[i]; - nodeScaleCache.clear(); + for (S32 i = 0; i < mNodeRotCache.size(); i++) + delete [] mNodeRotCache[i]; + mNodeRotCache.clear(); + for (S32 i = 0; i < mNodeTransCache.size(); i++) + delete [] mNodeTransCache[i]; + mNodeTransCache.clear(); + for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) + delete [] mNodeScaleRotCache[i]; + mNodeScaleRotCache.clear(); + for (S32 i = 0; i < mNodeScaleCache.size(); i++) + delete [] mNodeScaleCache[i]; + mNodeScaleCache.clear(); } void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequence* appSeq) @@ -917,28 +917,28 @@ void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequ // clear out the transform caches and set it up for this sequence clearNodeTransformCache(); - nodeRotCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeRotCache.size(); i++) - nodeRotCache[i] = new QuatF[seq.numKeyframes]; - nodeTransCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeTransCache.size(); i++) - nodeTransCache[i] = new Point3F[seq.numKeyframes]; - nodeScaleRotCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeScaleRotCache.size(); i++) - nodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; - nodeScaleCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeScaleCache.size(); i++) - nodeScaleCache[i] = new Point3F[seq.numKeyframes]; + mNodeRotCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeRotCache.size(); i++) + mNodeRotCache[i] = new QuatF[seq.numKeyframes]; + mNodeTransCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeTransCache.size(); i++) + mNodeTransCache[i] = new Point3F[seq.numKeyframes]; + mNodeScaleRotCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) + mNodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; + mNodeScaleCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeScaleCache.size(); i++) + mNodeScaleCache[i] = new Point3F[seq.numKeyframes]; // get the node transforms for every frame for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { - generateNodeTransform(appNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), - nodeRotCache[iNode][iFrame], nodeTransCache[iNode][iFrame], - nodeScaleRotCache[iNode][iFrame], nodeScaleCache[iNode][iFrame]); + generateNodeTransform(mAppNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), + mNodeRotCache[iNode][iFrame], mNodeTransCache[iNode][iFrame], + mNodeScaleRotCache[iNode][iFrame], mNodeScaleCache[iNode][iFrame]); } } } @@ -949,57 +949,57 @@ void TSShapeLoader::addNodeRotation(QuatF& rot, bool defaultVal) rot16.set(rot); if (!defaultVal) - shape->nodeRotations.push_back(rot16); + mShape->nodeRotations.push_back(rot16); else - shape->defaultRotations.push_back(rot16); + mShape->defaultRotations.push_back(rot16); } void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal) { if (!defaultVal) - shape->nodeTranslations.push_back(trans); + mShape->nodeTranslations.push_back(trans); else - shape->defaultTranslations.push_back(trans); + mShape->defaultTranslations.push_back(trans); } void TSShapeLoader::addNodeUniformScale(F32 scale) { - shape->nodeUniformScales.push_back(scale); + mShape->nodeUniformScales.push_back(scale); } void TSShapeLoader::addNodeAlignedScale(Point3F& scale) { - shape->nodeAlignedScales.push_back(scale); + mShape->nodeAlignedScales.push_back(scale); } void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale) { Quat16 rot16; rot16.set(qrot); - shape->nodeArbitraryScaleRots.push_back(rot16); - shape->nodeArbitraryScaleFactors.push_back(scale); + mShape->nodeArbitraryScaleRots.push_back(rot16); + mShape->nodeArbitraryScaleFactors.push_back(scale); } void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) { - seq.baseRotation = shape->nodeRotations.size(); - seq.baseTranslation = shape->nodeTranslations.size(); - seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? shape->nodeArbitraryScaleRots.size() : - (seq.flags & TSShape::AlignedScale) ? shape->nodeAlignedScales.size() : - shape->nodeUniformScales.size(); + seq.baseRotation = mShape->nodeRotations.size(); + seq.baseTranslation = mShape->nodeTranslations.size(); + seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->nodeArbitraryScaleRots.size() : + (seq.flags & TSShape::AlignedScale) ? mShape->nodeAlignedScales.size() : + mShape->nodeUniformScales.size(); - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { if (seq.rotationMatters.test(iNode)) - addNodeRotation(nodeRotCache[iNode][iFrame], false); + addNodeRotation(mNodeRotCache[iNode][iFrame], false); if (seq.translationMatters.test(iNode)) - addNodeTranslation(nodeTransCache[iNode][iFrame], false); + addNodeTranslation(mNodeTransCache[iNode][iFrame], false); if (seq.scaleMatters.test(iNode)) { - QuatF& rot = nodeScaleRotCache[iNode][iFrame]; - Point3F scale = nodeScaleCache[iNode][iFrame]; + QuatF& rot = mNodeScaleRotCache[iNode][iFrame]; + Point3F scale = mNodeScaleCache[iNode][iFrame]; if (seq.flags & TSShape::ArbitraryScale) addNodeArbitraryScale(rot, scale); @@ -1014,9 +1014,9 @@ void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.baseObjectState = shape->objectStates.size(); + seq.baseObjectState = mShape->objectStates.size(); - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { bool visMatters = seq.visMatters.test(iObject); bool frameMatters = seq.frameMatters.test(iObject); @@ -1027,7 +1027,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - generateObjectState(shape->objects[iObject], time, frameMatters, matFrameMatters); + generateObjectState(mShape->objects[iObject], time, frameMatters, matFrameMatters); } } } @@ -1035,10 +1035,10 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.firstGroundFrame = shape->groundTranslations.size(); + seq.firstGroundFrame = mShape->groundTranslations.size(); seq.numGroundFrames = 0; - if (!boundsNode) + if (!mBoundsNode) return; // Check if the bounds node is animated by this sequence @@ -1047,7 +1047,7 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq seq.flags |= TSShape::MakePath; // Get ground transform at the start of the sequence - MatrixF invStartMat = boundsNode->getNodeTransform(appSeq->getStart()); + MatrixF invStartMat = mBoundsNode->getNodeTransform(appSeq->getStart()); zapScale(invStartMat); invStartMat.inverse(); @@ -1056,22 +1056,22 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numGroundFrames - 1); // Determine delta bounds node transform at 't' - MatrixF mat = boundsNode->getNodeTransform(time); + MatrixF mat = mBoundsNode->getNodeTransform(time); zapScale(mat); mat = invStartMat * mat; // Add ground transform Quat16 rotation; rotation.set(QuatF(mat)); - shape->groundTranslations.push_back(mat.getPosition()); - shape->groundRotations.push_back(rotation); + mShape->groundTranslations.push_back(mat.getPosition()); + mShape->groundRotations.push_back(rotation); } } void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq) { // Initialize triggers - seq.firstTrigger = shape->triggers.size(); + seq.firstTrigger = mShape->triggers.size(); seq.numTriggers = appSeq->getNumTriggers(); if (!seq.numTriggers) return; @@ -1081,8 +1081,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // Add triggers for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - shape->triggers.increment(); - appSeq->getTrigger(iTrigger, shape->triggers.last()); + mShape->triggers.increment(); + appSeq->getTrigger(iTrigger, mShape->triggers.last()); } // Track the triggers that get turned off by this shape...normally, triggers @@ -1092,7 +1092,7 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque U32 offTriggers = 0; for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - U32 state = shape->triggers[seq.firstTrigger+iTrigger].state; + U32 state = mShape->triggers[seq.firstTrigger+iTrigger].state; if ((state & TSShape::Trigger::StateOn) == 0) offTriggers |= (state & TSShape::Trigger::StateMask); } @@ -1100,8 +1100,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // We now know which states are turned off, set invert on all those (including when turned on) for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - if (shape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) - shape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; + if (mShape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) + mShape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; } } @@ -1113,36 +1113,36 @@ void TSShapeLoader::sortDetails() // Insert NULL meshes where required - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) { Vector validDetails; - shape->getSubShapeDetails(iSub, validDetails); + mShape->getSubShapeDetails(iSub, validDetails); for (S32 iDet = 0; iDet < validDetails.size(); iDet++) { - TSShape::Detail &detail = shape->details[validDetails[iDet]]; + TSShape::Detail &detail = mShape->details[validDetails[iDet]]; if (detail.subShapeNum >= 0) detail.objectDetailNum = iDet; - for (S32 iObj = shape->subShapeFirstObject[iSub]; - iObj < (shape->subShapeFirstObject[iSub] + shape->subShapeNumObjects[iSub]); + for (S32 iObj = mShape->subShapeFirstObject[iSub]; + iObj < (mShape->subShapeFirstObject[iSub] + mShape->subShapeNumObjects[iSub]); iObj++) { - TSShape::Object &object = shape->objects[iObj]; + TSShape::Object &object = mShape->objects[iObj]; // Insert a NULL mesh for this detail level if required (ie. if the // object does not already have a mesh with an equal or higher detail) S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1; - if (appMeshes[object.startMeshIndex + meshIndex]->detailSize < shape->details[iDet].size) + if (mAppMeshes[object.startMeshIndex + meshIndex]->detailSize < mShape->details[iDet].size) { // Add a NULL mesh - appMeshes.insert(object.startMeshIndex + iDet, NULL); + mAppMeshes.insert(object.startMeshIndex + iDet, NULL); object.numMeshes++; // Fixup the start index for the other objects - for (S32 k = iObj+1; k < shape->objects.size(); k++) - shape->objects[k].startMeshIndex++; + for (S32 k = iObj+1; k < mShape->objects.size(); k++) + mShape->objects[k].startMeshIndex++; } } } @@ -1157,79 +1157,79 @@ void TSShapeLoader::install() { // Arrays that are filled in by ts shape init, but need // to be allocated beforehand. - shape->subShapeFirstTranslucentObject.setSize(shape->subShapeFirstObject.size()); + mShape->subShapeFirstTranslucentObject.setSize(mShape->subShapeFirstObject.size()); // Construct TS sub-meshes - shape->meshes.setSize(appMeshes.size()); - for (U32 m = 0; m < appMeshes.size(); m++) - shape->meshes[m] = appMeshes[m] ? appMeshes[m]->constructTSMesh() : NULL; + mShape->meshes.setSize(mAppMeshes.size()); + for (U32 m = 0; m < mAppMeshes.size(); m++) + mShape->meshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL; // Remove empty meshes and objects - for (S32 iObj = shape->objects.size()-1; iObj >= 0; iObj--) + for (S32 iObj = mShape->objects.size()-1; iObj >= 0; iObj--) { - TSShape::Object& obj = shape->objects[iObj]; + TSShape::Object& obj = mShape->objects[iObj]; for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--) { - TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; + TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh]; if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); - shape->removeMeshFromObject(iObj, iMesh); + mShape->removeMeshFromObject(iObj, iMesh); iMesh -= (oldMeshCount - obj.numMeshes - 1); // handle when more than one mesh is removed } } if (!obj.numMeshes) - shape->removeObject(shape->getName(obj.nameIndex)); + mShape->removeObject(mShape->getName(obj.nameIndex)); } // Add a dummy object if needed so the shape loads and renders ok - if (!shape->details.size()) + if (!mShape->details.size()) { - shape->addDetail("detail", 2, 0); - shape->subShapeNumObjects.last() = 1; + mShape->addDetail("detail", 2, 0); + mShape->subShapeNumObjects.last() = 1; - shape->meshes.push_back(NULL); + mShape->meshes.push_back(NULL); - shape->objects.increment(); + mShape->objects.increment(); - TSShape::Object& lastObject = shape->objects.last(); - lastObject.nameIndex = shape->addName("dummy"); + TSShape::Object& lastObject = mShape->objects.last(); + lastObject.nameIndex = mShape->addName("dummy"); lastObject.nodeIndex = 0; lastObject.startMeshIndex = 0; lastObject.numMeshes = 1; - shape->objectStates.increment(); - shape->objectStates.last().frameIndex = 0; - shape->objectStates.last().matFrameIndex = 0; - shape->objectStates.last().vis = 1.0f; + mShape->objectStates.increment(); + mShape->objectStates.last().frameIndex = 0; + mShape->objectStates.last().matFrameIndex = 0; + mShape->objectStates.last().vis = 1.0f; } // Update smallest visible detail - shape->mSmallestVisibleDL = -1; - shape->mSmallestVisibleSize = 999999; - for (S32 i = 0; i < shape->details.size(); i++) + mShape->mSmallestVisibleDL = -1; + mShape->mSmallestVisibleSize = 999999; + for (S32 i = 0; i < mShape->details.size(); i++) { - if ((shape->details[i].size >= 0) && - (shape->details[i].size < shape->mSmallestVisibleSize)) + if ((mShape->details[i].size >= 0) && + (mShape->details[i].size < mShape->mSmallestVisibleSize)) { - shape->mSmallestVisibleDL = i; - shape->mSmallestVisibleSize = shape->details[i].size; + mShape->mSmallestVisibleDL = i; + mShape->mSmallestVisibleSize = mShape->details[i].size; } } - computeBounds(shape->mBounds); - if (!shape->mBounds.isValidBox()) - shape->mBounds = Box3F(1.0f); + computeBounds(mShape->mBounds); + if (!mShape->mBounds.isValidBox()) + mShape->mBounds = Box3F(1.0f); - shape->mBounds.getCenter(&shape->center); - shape->mRadius = (shape->mBounds.maxExtents - shape->center).len(); - shape->tubeRadius = shape->mRadius; + mShape->mBounds.getCenter(&mShape->center); + mShape->mRadius = (mShape->mBounds.maxExtents - mShape->center).len(); + mShape->tubeRadius = mShape->mRadius; - shape->init(); - shape->finalizeEditable(); + mShape->init(); + mShape->finalizeEditable(); } void TSShapeLoader::computeBounds(Box3F& bounds) @@ -1238,11 +1238,11 @@ void TSShapeLoader::computeBounds(Box3F& bounds) bounds = Box3F::Invalid; // Use bounds node geometry if present - if ( boundsNode && boundsNode->getNumMesh() ) + if (mBoundsNode && mBoundsNode->getNumMesh() ) { - for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = boundsNode->getMesh( iMesh ); + AppMesh* mesh = mBoundsNode->getMesh( iMesh ); if ( !mesh ) continue; @@ -1255,9 +1255,9 @@ void TSShapeLoader::computeBounds(Box3F& bounds) else { // Compute bounds based on all geometry in the model - for (S32 iMesh = 0; iMesh < appMeshes.size(); iMesh++) + for (S32 iMesh = 0; iMesh < mAppMeshes.size(); iMesh++) { - AppMesh* mesh = appMeshes[iMesh]; + AppMesh* mesh = mAppMeshes[iMesh]; if ( !mesh ) continue; @@ -1279,14 +1279,14 @@ TSShapeLoader::~TSShapeLoader() AppMesh::appMaterials.clear(); // Delete Subshapes - delete boundsNode; - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) - delete subshapes[iSub]; + delete mBoundsNode; + for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) + delete mSubshapes[iSub]; // Delete AppSequences - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) - delete appSequences[iSeq]; - appSequences.clear(); + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) + delete mAppSequences[iSeq]; + mAppSequences.clear(); } // Static functions to handle supported formats for shape loader. diff --git a/Engine/source/ts/loader/tsShapeLoader.h b/Engine/source/ts/loader/tsShapeLoader.h index 32b462e46..9c9518bca 100644 --- a/Engine/source/ts/loader/tsShapeLoader.h +++ b/Engine/source/ts/loader/tsShapeLoader.h @@ -101,24 +101,24 @@ public: protected: // Variables used during loading that must be held until the shape is deleted - TSShape* shape; - Vector appMeshes; + TSShape* mShape; + Vector mAppMeshes; // Variables used during loading, but that can be discarded afterwards - static Torque::Path shapePath; + static Torque::Path mShapePath; - AppNode* boundsNode; - Vector appNodes; ///< Nodes in the loaded shape - Vector appSequences; + AppNode* mBoundsNode; + Vector mAppNodes; ///< Nodes in the loaded shape + Vector mAppSequences; - Vector subshapes; + Vector mSubshapes; - Vector nodeRotCache; - Vector nodeTransCache; - Vector nodeScaleRotCache; - Vector nodeScaleCache; + Vector mNodeRotCache; + Vector mNodeTransCache; + Vector mNodeScaleRotCache; + Vector mNodeScaleCache; - Point3F shapeOffset; ///< Offset used to translate the shape origin + Point3F mShapeOffset; ///< Offset used to translate the shape origin //-------------------------------------------------------------------------- @@ -183,10 +183,10 @@ protected: void install(); public: - TSShapeLoader() : boundsNode(0) { } + TSShapeLoader() : mBoundsNode(0) { } virtual ~TSShapeLoader(); - static const Torque::Path& getShapePath() { return shapePath; } + static const Torque::Path& getShapePath() { return mShapePath; } static void zapScale(MatrixF& mat); From db519a3dd5e001335924e9849245bc0626b561ca Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:03:02 -0500 Subject: [PATCH 223/312] local shadowvar cleanup --- Engine/source/collision/clippedPolyList.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/collision/clippedPolyList.cpp b/Engine/source/collision/clippedPolyList.cpp index 5fd665d87..f2a643a3d 100644 --- a/Engine/source/collision/clippedPolyList.cpp +++ b/Engine/source/collision/clippedPolyList.cpp @@ -270,10 +270,10 @@ void ClippedPolyList::end() iv.mask = 0; // Test against the remaining planes - for (U32 i = p + 1; i < mPlaneList.size(); i++) - if (mPlaneList[i].distToPlane(iv.point) > 0) + for (U32 rP = p + 1; rP < mPlaneList.size(); rP++) + if (mPlaneList[rP].distToPlane(iv.point) > 0) { - iv.mask = 1 << i; + iv.mask = 1 << rP; break; } } From e80b66464eb3377d83fc536d8313a4080a850c88 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:04:14 -0500 Subject: [PATCH 224/312] ast shadowvar cleanup --- Engine/source/console/ast.h | 4 ++-- Engine/source/console/astNodes.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/ast.h b/Engine/source/console/ast.h index 65b20a926..f81971413 100644 --- a/Engine/source/console/ast.h +++ b/Engine/source/console/ast.h @@ -52,7 +52,7 @@ enum TypeReq /// each representing a different language construct. struct StmtNode { - StmtNode *next; ///< Next entry in parse tree. + StmtNode *mNext; ///< Next entry in parse tree. StmtNode(); virtual ~StmtNode() {} @@ -62,7 +62,7 @@ struct StmtNode /// void append(StmtNode *next); - StmtNode *getNext() const { return next; } + StmtNode *getNext() const { return mNext; } /// @} diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index 6ea557703..876a4383a 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -140,7 +140,7 @@ void StmtNode::addBreakLine(CodeStream &code) StmtNode::StmtNode() { - next = NULL; + mNext = NULL; dbgFileName = CodeBlock::smCurrentParser->getCurrentFile(); } @@ -151,9 +151,9 @@ void StmtNode::setPackage(StringTableEntry) void StmtNode::append(StmtNode *next) { StmtNode *walk = this; - while (walk->next) - walk = walk->next; - walk->next = next; + while (walk->mNext) + walk = walk->mNext; + walk->mNext = next; } From a0b15128574991ba5c71c167ba5fb9b3a69651d0 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:04:43 -0500 Subject: [PATCH 225/312] bitstream shadowvar cleanup --- Engine/source/core/stream/bitStream.cpp | 40 ++++++++++++------------- Engine/source/core/stream/bitStream.h | 6 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index f80389640..2a62b4964 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -78,7 +78,7 @@ ResizeBitStream::ResizeBitStream(U32 minSpace, U32 initialSize) : BitStream(NULL ResizeBitStream::~ResizeBitStream() { - dFree(dataPtr); + dFree(mDataPtr); } void ResizeBitStream::validate() @@ -86,7 +86,7 @@ void ResizeBitStream::validate() if(getPosition() + mMinSpace > bufSize) { bufSize = getPosition() + mMinSpace * 2; - dataPtr = (U8 *) dRealloc(dataPtr, bufSize); + mDataPtr = (U8 *) dRealloc(mDataPtr, bufSize); maxReadBitNum = bufSize << 3; maxWriteBitNum = bufSize << 3; @@ -148,7 +148,7 @@ HuffmanProcessor HuffmanProcessor::g_huffProcessor; void BitStream::setBuffer(void *bufPtr, S32 size, S32 maxSize) { - dataPtr = (U8 *) bufPtr; + mDataPtr = (U8 *) bufPtr; bitNum = 0; bufSize = size; maxReadBitNum = size << 3; @@ -178,7 +178,7 @@ U32 BitStream::getStreamSize() U8 *BitStream::getBytePtr() { - return dataPtr + getPosition(); + return mDataPtr + getPosition(); } @@ -194,7 +194,7 @@ U32 BitStream::getWriteByteSize() void BitStream::clear() { - dMemset(dataPtr, 0, bufSize); + dMemset(mDataPtr, 0, bufSize); } void BitStream::writeClassId(U32 classId, U32 classType, U32 classGroup) @@ -242,9 +242,9 @@ void BitStream::writeBits(S32 bitCount, const void *bitPtr) for(S32 srcBitNum = 0;srcBitNum < bitCount;srcBitNum++) { if((*(ptr + (srcBitNum >> 3)) & (1 << (srcBitNum & 0x7))) != 0) - *(dataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); else - *(dataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); bitNum++; } } @@ -252,14 +252,14 @@ void BitStream::writeBits(S32 bitCount, const void *bitPtr) void BitStream::setBit(S32 bitCount, bool set) { if(set) - *(dataPtr + (bitCount >> 3)) |= (1 << (bitCount & 0x7)); + *(mDataPtr + (bitCount >> 3)) |= (1 << (bitCount & 0x7)); else - *(dataPtr + (bitCount >> 3)) &= ~(1 << (bitCount & 0x7)); + *(mDataPtr + (bitCount >> 3)) &= ~(1 << (bitCount & 0x7)); } bool BitStream::testBit(S32 bitCount) { - return (*(dataPtr + (bitCount >> 3)) & (1 << (bitCount & 0x7))) != 0; + return (*(mDataPtr + (bitCount >> 3)) & (1 << (bitCount & 0x7))) != 0; } bool BitStream::writeFlag(bool val) @@ -271,9 +271,9 @@ bool BitStream::writeFlag(bool val) return false; } if(val) - *(dataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); else - *(dataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); bitNum++; return (val); } @@ -289,7 +289,7 @@ void BitStream::readBits(S32 bitCount, void *bitPtr) AssertWarn(false, "Out of range read"); return; } - U8 *stPtr = dataPtr + (bitNum >> 3); + U8 *stPtr = mDataPtr + (bitNum >> 3); S32 byteCount = (bitCount + 7) >> 3; U8 *ptr = (U8 *) bitPtr; @@ -298,7 +298,7 @@ void BitStream::readBits(S32 bitCount, void *bitPtr) S32 upShift = 8 - downShift; U8 curB = *stPtr; - const U8 *stEnd = dataPtr + bufSize; + const U8 *stEnd = mDataPtr + bufSize; while(byteCount--) { stPtr++; @@ -628,7 +628,7 @@ void InfiniteBitStream::validate(U32 upcomingBytes) if(getPosition() + upcomingBytes + mMinSpace > bufSize) { bufSize = getPosition() + upcomingBytes + mMinSpace; - dataPtr = (U8 *) dRealloc(dataPtr, bufSize); + mDataPtr = (U8 *) dRealloc(mDataPtr, bufSize); maxReadBitNum = bufSize << 3; maxWriteBitNum = bufSize << 3; @@ -643,11 +643,11 @@ void InfiniteBitStream::compact() // Copy things... bufSize = getPosition() + mMinSpace * 2; - dMemcpy(tmp, dataPtr, oldSize); + dMemcpy(tmp, mDataPtr, oldSize); // And clean up. - dFree(dataPtr); - dataPtr = tmp; + dFree(mDataPtr); + mDataPtr = tmp; maxReadBitNum = bufSize << 3; maxWriteBitNum = bufSize << 3; @@ -655,7 +655,7 @@ void InfiniteBitStream::compact() void InfiniteBitStream::writeToStream(Stream &s) { - s.write(getPosition(), dataPtr); + s.write(getPosition(), mDataPtr); } //------------------------------------------------------------------------------ @@ -781,7 +781,7 @@ void HuffmanProcessor::generateCodes(BitStream& rBS, S32 index, S32 depth) // leaf node, copy the code in, and back out... HuffLeaf& rLeaf = m_huffLeaves[-(index + 1)]; - dMemcpy(&rLeaf.code, rBS.dataPtr, sizeof(rLeaf.code)); + dMemcpy(&rLeaf.code, rBS.mDataPtr, sizeof(rLeaf.code)); rLeaf.numBits = depth; } else { HuffNode& rNode = m_huffNodes[index]; diff --git a/Engine/source/core/stream/bitStream.h b/Engine/source/core/stream/bitStream.h index 93287b938..b0bb2f22a 100644 --- a/Engine/source/core/stream/bitStream.h +++ b/Engine/source/core/stream/bitStream.h @@ -53,7 +53,7 @@ class QuatF; class BitStream : public Stream { protected: - U8 *dataPtr; + U8 *mDataPtr; S32 bitNum; S32 bufSize; bool error; @@ -68,7 +68,7 @@ public: static void sendPacketStream(const NetAddress *addr); void setBuffer(void *bufPtr, S32 bufSize, S32 maxSize = 0); - U8* getBuffer() { return dataPtr; } + U8* getBuffer() { return mDataPtr; } U8* getBytePtr(); U32 getReadByteSize(); @@ -337,7 +337,7 @@ inline bool BitStream::readFlag() return false; } S32 mask = 1 << (bitNum & 0x7); - bool ret = (*(dataPtr + (bitNum >> 3)) & mask) != 0; + bool ret = (*(mDataPtr + (bitNum >> 3)) & mask) != 0; bitNum++; return ret; } From 189595670a9058c8def9d36c8ee4dced5490d95e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:05:19 -0500 Subject: [PATCH 226/312] shadowvar cleanup --- .../source/T3D/components/animation/animationComponent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/components/animation/animationComponent.cpp b/Engine/source/T3D/components/animation/animationComponent.cpp index 42871259d..cb7808b8b 100644 --- a/Engine/source/T3D/components/animation/animationComponent.cpp +++ b/Engine/source/T3D/components/animation/animationComponent.cpp @@ -645,12 +645,12 @@ void AnimationComponent::advanceThreads(F32 dt) if (mOwnerShapeInstance && !isClientObject()) { - for (U32 i = 1; i < 32; i++) + for (U32 stateIDx = 1; stateIDx < 32; stateIDx++) { - if (mOwnerShapeInstance->getTriggerState(i)) + if (mOwnerShapeInstance->getTriggerState(stateIDx)) { const char* animName = st.thread->getSequenceName().c_str(); - onAnimationTrigger_callback(this, animName, i); + onAnimationTrigger_callback(this, animName, stateIDx); } } } From 9b8c950701e0ce7c70e26b9a9a7eeb21ae4e14fa Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:05:47 -0500 Subject: [PATCH 227/312] console membervar cleanup --- Engine/source/console/codeBlock.cpp | 4 +- Engine/source/console/console.cpp | 98 +++++++++++----------- Engine/source/console/console.h | 34 ++++---- Engine/source/console/consoleFunctions.cpp | 6 +- 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index f8f814f5b..dc8910f48 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -392,14 +392,14 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) if (size) { globalFloats = new F64[size]; - for (U32 i = 0; i < size; i++) + for (i = 0; i < size; i++) st.read(&globalFloats[i]); } st.read(&size); if (size) { functionFloats = new F64[size]; - for (U32 i = 0; i < size; i++) + for (i = 0; i < size; i++) st.read(&functionFloats[i]); } U32 codeLength; diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index 9605357a5..983aa40ba 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -49,7 +49,7 @@ ExprEvalState gEvalState; StmtNode *gStatementList; StmtNode *gAnonFunctionList; U32 gAnonFunctionID = 0; -ConsoleConstructor *ConsoleConstructor::first = NULL; +ConsoleConstructor *ConsoleConstructor::mFirst = NULL; bool gWarnUndefinedScriptVariables; static char scratchBuffer[4096]; @@ -85,47 +85,47 @@ static const char * prependPercent ( const char * name ) //-------------------------------------- void ConsoleConstructor::init( const char *cName, const char *fName, const char *usg, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { - mina = minArgs; - maxa = maxArgs; - funcName = fName; - usage = usg; - className = cName; - sc = 0; fc = 0; vc = 0; bc = 0; ic = 0; - callback = group = false; - next = first; - ns = false; - first = this; - toolOnly = isToolOnly; - this->header = header; + mMina = minArgs; + mMaxa = maxArgs; + mFuncName = fName; + mUsage = usg; + mClassName = cName; + mSC = 0; mFC = 0; mVC = 0; mBC = 0; mIC = 0; + mCallback = mGroup = false; + mNext = mFirst; + mNS = false; + mFirst = this; + mToolOnly = isToolOnly; + mHeader = header; } void ConsoleConstructor::setup() { - for(ConsoleConstructor *walk = first; walk; walk = walk->next) + for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext) { #ifdef TORQUE_DEBUG walk->validate(); #endif - if( walk->sc ) - Con::addCommand( walk->className, walk->funcName, walk->sc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->ic ) - Con::addCommand( walk->className, walk->funcName, walk->ic, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->fc ) - Con::addCommand( walk->className, walk->funcName, walk->fc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->vc ) - Con::addCommand( walk->className, walk->funcName, walk->vc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->bc ) - Con::addCommand( walk->className, walk->funcName, walk->bc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->group ) - Con::markCommandGroup( walk->className, walk->funcName, walk->usage ); - else if( walk->callback ) - Con::noteScriptCallback( walk->className, walk->funcName, walk->usage, walk->header ); - else if( walk->ns ) + if( walk->mSC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mSC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mIC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mIC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mFC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mFC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mVC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mVC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mBC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mBC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mGroup ) + Con::markCommandGroup( walk->mClassName, walk->mFuncName, walk->mUsage); + else if( walk->mClassName) + Con::noteScriptCallback( walk->mClassName, walk->mFuncName, walk->mUsage, walk->mHeader); + else if( walk->mNS ) { - Namespace* ns = Namespace::find( StringTable->insert( walk->className ) ); + Namespace* ns = Namespace::find( StringTable->insert( walk->mClassName) ); if( ns ) - ns->mUsage = walk->usage; + ns->mUsage = walk->mUsage; } else { @@ -137,38 +137,38 @@ void ConsoleConstructor::setup() ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, StringCallback sfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - sc = sfunc; + mSC = sfunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, IntCallback ifunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - ic = ifunc; + mIC = ifunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, FloatCallback ffunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - fc = ffunc; + mFC = ffunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, VoidCallback vfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - vc = vfunc; + mVC = vfunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, BoolCallback bfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - bc = bfunc; + mBC = bfunc; } ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupName, const char* aUsage) { - init(className, groupName, usage, -1, -2); + init(className, groupName, mUsage, -1, -2); - group = true; + mGroup = true; // Somewhere, the entry list is getting flipped, partially. // so we have to do tricks to deal with making sure usage @@ -179,36 +179,36 @@ ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupN if(aUsage) lastUsage = (char *)aUsage; - usage = lastUsage; + mUsage = lastUsage; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header ) { init( className, callbackName, usage, -2, -3, false, header ); - callback = true; - ns = true; + mCallback = true; + mNS = true; } void ConsoleConstructor::validate() { #ifdef TORQUE_DEBUG // Don't do the following check if we're not a method/func. - if(this->group) + if(mGroup) return; // In debug, walk the list and make sure this isn't a duplicate. - for(ConsoleConstructor *walk = first; walk; walk = walk->next) + for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext) { // Skip mismatching func/method names. - if(dStricmp(walk->funcName, this->funcName)) + if(dStricmp(walk->mFuncName, mFuncName)) continue; // Don't compare functions with methods or vice versa. - if(bool(this->className) != bool(walk->className)) + if(bool(mClassName) != bool(walk->mClassName)) continue; // Skip mismatching classnames, if they're present. - if(this->className && walk->className && dStricmp(walk->className, this->className)) + if(mClassName && walk->mClassName && dStricmp(walk->mClassName, mClassName)) continue; // If we encounter ourselves, stop searching; this prevents duplicate @@ -218,13 +218,13 @@ void ConsoleConstructor::validate() break; // Match! - if(this->className) + if(mClassName) { - AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", this->className, this->funcName)); + AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", mClassName, mFuncName)); } else { - AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", this->funcName)); + AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", mFuncName)); } } #endif diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 4009a5393..e1e64bea2 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -972,38 +972,38 @@ public: /// @ref console_autodoc /// @{ - StringCallback sc; ///< A function/method that returns a string. - IntCallback ic; ///< A function/method that returns an int. - FloatCallback fc; ///< A function/method that returns a float. - VoidCallback vc; ///< A function/method that returns nothing. - BoolCallback bc; ///< A function/method that returns a bool. - bool group; ///< Indicates that this is a group marker. - bool ns; ///< Indicates that this is a namespace marker. + StringCallback mSC; ///< A function/method that returns a string. + IntCallback mIC; ///< A function/method that returns an int. + FloatCallback mFC; ///< A function/method that returns a float. + VoidCallback mVC; ///< A function/method that returns nothing. + BoolCallback mBC; ///< A function/method that returns a bool. + bool mGroup; ///< Indicates that this is a group marker. + bool mNS; ///< Indicates that this is a namespace marker. /// @deprecated Unused. - bool callback; ///< Is this a callback into script? + bool mCallback; ///< Is this a callback into script? /// @} /// Minimum number of arguments expected by the function. - S32 mina; + S32 mMina; /// Maximum number of arguments accepted by the funtion. Zero for varargs. - S32 maxa; + S32 mMaxa; /// Name of the function/method. - const char* funcName; + const char* mFuncName; /// Name of the class namespace to which to add the method. - const char* className; + const char* mClassName; /// Usage string for documentation. - const char* usage; + const char* mUsage; /// Whether this is a TORQUE_TOOLS only function. - bool toolOnly; + bool mToolOnly; /// The extended function header. - ConsoleFunctionHeader* header; + ConsoleFunctionHeader* mHeader; /// @name ConsoleConstructor Innards /// @@ -1066,8 +1066,8 @@ public: /// @{ /// - ConsoleConstructor *next; - static ConsoleConstructor *first; + ConsoleConstructor *mNext; + static ConsoleConstructor *mFirst; void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index df89a788a..fa5ab3a2b 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -668,13 +668,13 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char U32 dstp = 0; for(;;) { - const char *scan = dStrstr(source + scanp, from); - if(!scan) + const char *subScan = dStrstr(source + scanp, from); + if(!subScan) { dStrcpy(ret + dstp, source + scanp); return ret; } - U32 len = scan - (source + scanp); + U32 len = subScan - (source + scanp); dStrncpy(ret + dstp, source + scanp, len); dstp += len; dStrcpy(ret + dstp, to); From 41507d2dd54a1a5b6bf242826c5902d1444e4a62 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:28:01 -0500 Subject: [PATCH 228/312] shadowvar cleanup --- Engine/source/assets/assetManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/assets/assetManager.cpp b/Engine/source/assets/assetManager.cpp index da610a895..c2591a84f 100644 --- a/Engine/source/assets/assetManager.cpp +++ b/Engine/source/assets/assetManager.cpp @@ -1353,10 +1353,10 @@ bool AssetManager::refreshAsset( const char* pAssetId ) } // Refresh depended-on assets. - for ( Vector::iterator isDependedOnItr = dependedOn.begin(); isDependedOnItr != dependedOn.end(); ++isDependedOnItr ) + for ( Vector::iterator refreshItr = dependedOn.begin(); refreshItr != dependedOn.end(); ++refreshItr) { // Refresh dependency asset. - refreshAsset( *isDependedOnItr ); + refreshAsset( *refreshItr); } } } From 8f947d52519b49242f63c2197631c4a8c84dfdb4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sat, 17 Mar 2018 14:37:07 -0500 Subject: [PATCH 229/312] Adds a convenience function to refresh the console dialog. --- Engine/source/gui/controls/guiConsole.cpp | 6 ++++++ Engine/source/gui/controls/guiConsole.h | 4 ++++ Templates/BaseGame/game/core/console/main.cs | 2 ++ Templates/Full/game/core/art/gui/console.gui | 2 ++ 4 files changed, 14 insertions(+) diff --git a/Engine/source/gui/controls/guiConsole.cpp b/Engine/source/gui/controls/guiConsole.cpp index b8987e8df..d063272bf 100644 --- a/Engine/source/gui/controls/guiConsole.cpp +++ b/Engine/source/gui/controls/guiConsole.cpp @@ -284,4 +284,10 @@ DefineEngineMethod(GuiConsole, toggleNormalFilter, void, (), , "Toggles the normal messages filter.") { object->toggleNormalFilter(); +} + +DefineEngineMethod(GuiConsole, refresh, void, (), , + "Refreshes the displayed messages.") +{ + object->refresh(); } \ No newline at end of file diff --git a/Engine/source/gui/controls/guiConsole.h b/Engine/source/gui/controls/guiConsole.h index 8b9450e09..2ef9eb7c8 100644 --- a/Engine/source/gui/controls/guiConsole.h +++ b/Engine/source/gui/controls/guiConsole.h @@ -89,6 +89,10 @@ class GuiConsole : public GuiArrayCtrl { setDisplayFilters(mDisplayErrors, mDisplayWarnings, !mDisplayNormalMessages); } + void refresh() + { + setDisplayFilters(mDisplayErrors, mDisplayWarnings, mDisplayNormalMessages); + } void refreshLogText(); }; diff --git a/Templates/BaseGame/game/core/console/main.cs b/Templates/BaseGame/game/core/console/main.cs index 47894f7e4..3d89234b8 100644 --- a/Templates/BaseGame/game/core/console/main.cs +++ b/Templates/BaseGame/game/core/console/main.cs @@ -104,6 +104,8 @@ function ConsoleDlg::onWake(%this) ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); + + ConsoleMessageLogView.refresh(); } function ConsoleDlg::setAlpha( %this, %alpha) diff --git a/Templates/Full/game/core/art/gui/console.gui b/Templates/Full/game/core/art/gui/console.gui index 16300e4ac..fd3a2c0e5 100644 --- a/Templates/Full/game/core/art/gui/console.gui +++ b/Templates/Full/game/core/art/gui/console.gui @@ -317,6 +317,8 @@ function ConsoleDlg::onWake(%this) ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); + + ConsoleMessageLogView.refresh(); } function ConsoleDlgErrorFilterBtn::onClick(%this) From c0b50792f72124b8da5d5665328476e68f222dd4 Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 18 Mar 2018 16:11:07 +1000 Subject: [PATCH 230/312] physx support for vs 2017 --- Tools/CMake/modules/module_physx3.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tools/CMake/modules/module_physx3.cmake b/Tools/CMake/modules/module_physx3.cmake index a2dd3fdd3..e8065740f 100644 --- a/Tools/CMake/modules/module_physx3.cmake +++ b/Tools/CMake/modules/module_physx3.cmake @@ -52,6 +52,9 @@ if(TORQUE_CPU_X32) set(PHYSX3_LIBPATH_PREFIX vc12win32) elseif(MSVC14) set(PHYSX3_LIBPATH_PREFIX vc14win32) + #VS 2017 uses 14.x toolchain so can't use MSVC15 + elseif(MSVC_VERSION GREATER_OR_EQUAL_TO 1910) + set(PHYSX3_LIBPATH_PREFIX vc15win32) else() message(FATAL_ERROR "This version of VS is not supported") return() @@ -65,6 +68,9 @@ elseif(TORQUE_CPU_X64) set(PHYSX3_LIBPATH_PREFIX vc12win64) elseif(MSVC14) set(PHYSX3_LIBPATH_PREFIX vc14win64) + #VS 2017 uses 14.x toolchain so can't use MSVC15 + elseif(MSVC_VERSION GREATER_OR_EQUAL_TO 1910) + set(PHYSX3_LIBPATH_PREFIX vc15win64) else() message(FATAL_ERROR "This version of VS is not supported") return() From cd28a786b41e32c823e372f2d7e3806d216aea5b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 18 Mar 2018 18:51:10 -0500 Subject: [PATCH 231/312] stop linux/mac undefined MSVC versioncheck spam. --- Engine/source/console/engineFunctions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index a7c2e214f..0e39983e4 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -108,11 +108,11 @@ private: std::tie(std::get(args)...) = defaultArgs; } -#if _MSC_VER >= 1910 +#if defined(_MSC_VER) && (_MSC_VER >= 1910) template struct DodgyVCHelper { - using type = typename std::enable_if::type; + using type = typename std::enable_if::type; }; template using MaybeSelfEnabled = typename DodgyVCHelper::type; From 04d767ab9b6cce9a892632f4e9aa2b49703b226e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 19 Mar 2018 16:18:57 -0500 Subject: [PATCH 232/312] stop linux/mac undefined MSVC versioncheck spam. --- Engine/source/console/engineFunctions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index 0e39983e4..0f2a3f45d 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -112,7 +112,7 @@ private: template struct DodgyVCHelper { - using type = typename std::enable_if::type; + using type = typename std::enable_if::type; }; template using MaybeSelfEnabled = typename DodgyVCHelper::type; From dd626417a32557507e6b958e0e4aba8c037feaa6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 26 Mar 2018 23:31:10 -0500 Subject: [PATCH 233/312] Includes some renderbin declarations that are needed for AFX that got missed in the original PR. --- Templates/BaseGame/game/core/renderManager.cs | 10 ++++++++++ .../Full/game/core/scripts/client/renderManager.cs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/Templates/BaseGame/game/core/renderManager.cs b/Templates/BaseGame/game/core/renderManager.cs index 4a80a45b1..e9644c1ea 100644 --- a/Templates/BaseGame/game/core/renderManager.cs +++ b/Templates/BaseGame/game/core/renderManager.cs @@ -88,6 +88,16 @@ function initRenderManager() // Resolve format change token last. DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } ); + + // AFX CODE BLOCK (interior-zodiacs)(polysoup-zodiacs) << + if(isObject(afxZodiacTerrainRenderer)) + { + DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } ); + DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } ); + DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } ); + DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44; } ); + DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55; } ); // for selection-highlighting + } } /// This is the Default PostFX state block. Put here to prevent any missing object diff --git a/Templates/Full/game/core/scripts/client/renderManager.cs b/Templates/Full/game/core/scripts/client/renderManager.cs index f9f0988d2..b52143918 100644 --- a/Templates/Full/game/core/scripts/client/renderManager.cs +++ b/Templates/Full/game/core/scripts/client/renderManager.cs @@ -87,6 +87,16 @@ function initRenderManager() // Resolve format change token last. DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } ); + + // AFX CODE BLOCK (interior-zodiacs)(polysoup-zodiacs) << + if(isObject(afxZodiacTerrainRenderer)) + { + DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } ); + DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } ); + DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } ); + DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44; } ); + DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55; } ); // for selection-highlighting + } } /// This post effect is used to copy data from the non-MSAA back-buffer to the From 96093bd3ecc02c4b30b965903340ac475467e0c3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 27 Mar 2018 14:57:23 -0500 Subject: [PATCH 234/312] augmentation to drawArrow to allow one to explicitly define a radius. --- Engine/source/gfx/gfxDrawUtil.cpp | 8 ++++---- Engine/source/gfx/gfxDrawUtil.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/gfx/gfxDrawUtil.cpp b/Engine/source/gfx/gfxDrawUtil.cpp index 0e7a4b3e9..ac25b3f15 100644 --- a/Engine/source/gfx/gfxDrawUtil.cpp +++ b/Engine/source/gfx/gfxDrawUtil.cpp @@ -1382,7 +1382,7 @@ void GFXDrawUtil::drawCylinder( const GFXStateBlockDesc &desc, const Point3F &ba mDevice->popWorldMatrix(); } -void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color ) +void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color, F32 baseRad ) { GFXTransformSaver saver; @@ -1398,8 +1398,8 @@ void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start // Calculate the radius of the cone given that we want the cone to have // an angle of 25 degrees (just because it looks good). - F32 coneLen = ( end - coneBase ).len(); - F32 coneDiameter = mTan( mDegToRad(25.0f) ) * coneLen; + F32 coneLen = (baseRad != 0.0f) ? baseRad * 4.0 :( end - coneBase ).len(); + F32 coneDiameter = (baseRad != 0.0f) ? baseRad*4.0f : mTan( mDegToRad(25.0f) ) * coneLen; // Draw the cone on at the arrow's tip. drawCone( desc, coneBase, end, coneDiameter / 2.0f, color ); @@ -1412,7 +1412,7 @@ void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start Point3F coneDiff = end - coneBase; // Draw the cylinder. - F32 stickRadius = len * 0.025f; + F32 stickRadius = (baseRad != 0.0f) ? baseRad : len * 0.025f; drawCylinder( desc, start, end - coneDiff, stickRadius, color ); } diff --git a/Engine/source/gfx/gfxDrawUtil.h b/Engine/source/gfx/gfxDrawUtil.h index 7decad785..47f6581cf 100644 --- a/Engine/source/gfx/gfxDrawUtil.h +++ b/Engine/source/gfx/gfxDrawUtil.h @@ -115,7 +115,7 @@ public: void drawCapsule( const GFXStateBlockDesc &desc, const Point3F ¢er, F32 radius, F32 height, const ColorI &color, const MatrixF *xfm = NULL ); void drawCone( const GFXStateBlockDesc &desc, const Point3F &basePnt, const Point3F &tipPnt, F32 baseRadius, const ColorI &color ); void drawCylinder( const GFXStateBlockDesc &desc, const Point3F &basePnt, const Point3F &tipPnt, F32 baseRadius, const ColorI &color ); - void drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color ); + void drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color, F32 baseRad = 0.0f); void drawFrustum( const Frustum& f, const ColorI &color ); /// Draw a solid or wireframe (depending on fill mode of @a desc) polyhedron with the given color. From e8ac28b46356ed96e98efe4ec9b36037e1ed1286 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 27 Mar 2018 14:58:40 -0500 Subject: [PATCH 235/312] visualization augmentations for PhysicalZone. colorizes based on force vector, scales based on lengths --- Engine/source/T3D/physicalZone.cpp | 89 +++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 15 deletions(-) diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index f8454be5b..cd7da39d0 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -212,8 +212,10 @@ void PhysicalZone::onRemove() void PhysicalZone::inspectPostApply() { - setPolyhedron(mPolyhedron); Parent::inspectPostApply(); + + setPolyhedron(mPolyhedron); + setMaskBits(PolyhedronMask | MoveMask | SettingsMask | FadeMask); } //------------------------------------------------------------------------------ @@ -248,30 +250,87 @@ void PhysicalZone::prepRenderImage( SceneRenderState *state ) } -void PhysicalZone::renderObject( ObjectRenderInst *ri, - SceneRenderState *state, - BaseMatInstance *overrideMat ) +void PhysicalZone::renderObject(ObjectRenderInst *ri, + SceneRenderState *state, + BaseMatInstance *overrideMat) { if (overrideMat) return; - + GFXStateBlockDesc desc; - desc.setZReadWrite( true, false ); - desc.setBlend( true ); - desc.setCullMode( GFXCullNone ); - + desc.setZReadWrite(true, false); + desc.setBlend(true); + desc.setCullMode(GFXCullNone); + GFXTransformSaver saver; + + GFXDrawUtil *drawer = GFX->getDrawUtil(); + + Point3F start = getBoxCenter(); + Box3F obb = mObjBox; //object bounding box + + F32 baseForce = 10000; //roughly the ammount of force needed to push a player back as it walks into a zone. (used for visual scaling) + + Point3F forceDir = getForce(&start); + F32 forceLen = forceDir.len()/ baseForce; + forceDir.normalizeSafe(); + ColorI guideCol = LinearColorF(mFabs(forceDir.x), mFabs(forceDir.y), mFabs(forceDir.z), 0.125).toColorI(); + + if (force_type == VECTOR) + { + Point3F endPos = start + (forceDir * mMax(forceLen,0.75f)); + drawer->drawArrow(desc, start, endPos, guideCol, 0.05f); + } MatrixF mat = getRenderTransform(); - mat.scale( getScale() ); + mat.scale(getScale()); + + GFX->multWorld(mat); + start = obb.getCenter(); + + if (force_type == VECTOR) + { + drawer->drawPolyhedron(desc, mPolyhedron, ColorI(0, 255, 0, 45)); + } + else if (force_type == SPHERICAL) + { + F32 rad = obb.getBoundingSphere().radius/ 2; + drawer->drawSphere(desc, rad, start, ColorI(0, 255, 0, 45)); - GFX->multWorld( mat ); + rad = (rad + forceLen / 2)/2; + desc.setFillModeWireframe(); + drawer->drawSphere(desc, rad, start, ColorI(0, 0, 255, 255)); + } + else + { + Point3F bottomPos = start; + bottomPos.z -= obb.len_z() / 2; + + Point3F topPos = start; + topPos.z += obb.len_z() / 2; + F32 rad = obb.len_x() / 2; + drawer->drawCylinder(desc, bottomPos, topPos, rad, ColorI(0, 255, 0, 45)); - GFXDrawUtil *drawer = GFX->getDrawUtil(); - drawer->drawPolyhedron( desc, mPolyhedron, ColorI( 0, 255, 0, 45 ) ); + Point3F force_vec = mAppliedForce; //raw relative-applied force here as oposed to derived + F32 hieght = (force_vec.z / baseForce); + if (force_vec.z<0) + bottomPos.z = (bottomPos.z + hieght)/2; + else + topPos.z = (topPos.z + hieght) / 2; + + if (force_vec.x > force_vec.y) + rad = (rad + (force_vec.x / baseForce)) / 2; + else + rad = (rad + (force_vec.y / baseForce)) / 2; + + + desc.setFillModeWireframe(); + drawer->drawCylinder(desc, bottomPos, topPos, rad, guideCol); + } + desc.setFillModeWireframe(); - drawer->drawPolyhedron( desc, mPolyhedron, ColorI::BLACK ); + drawer->drawPolyhedron(desc, mPolyhedron, ColorI::BLACK); } //-------------------------------------------------------------------------- @@ -325,7 +384,7 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream) stream->writeFlag(mActive); - return retMask; + return retMask; } void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream) From 8ab76967e07d7e79ac6b8815a427aff83195231e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 27 Mar 2018 20:25:46 -0500 Subject: [PATCH 236/312] retooled spherical force ammount display to be based on mAppliedForce --- Engine/source/T3D/physicalZone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index cd7da39d0..fac190b67 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -297,7 +297,7 @@ void PhysicalZone::renderObject(ObjectRenderInst *ri, F32 rad = obb.getBoundingSphere().radius/ 2; drawer->drawSphere(desc, rad, start, ColorI(0, 255, 0, 45)); - rad = (rad + forceLen / 2)/2; + rad = (rad + (mAppliedForce.most() / baseForce))/2; desc.setFillModeWireframe(); drawer->drawSphere(desc, rad, start, ColorI(0, 0, 255, 255)); } From 9fbeb3e2d0bf64e382da745bdd5b695e3f93e8f9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 17:50:17 -0500 Subject: [PATCH 237/312] void ColladaUtils::ExportData::processData() var clarifications --- Engine/source/ts/collada/colladaUtils.cpp | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index a3c217bf5..974d2a8ed 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -2948,7 +2948,7 @@ void ColladaUtils::ExportData::processData() detailLevels.clear(); detailLevels.setSize(numDetailLevels); - for (U32 m = 0; m < meshData.size(); ++m) + for (U32 meshNum = 0; meshNum < meshData.size(); ++meshNum) { for (U32 i = 0; i < numDetailLevels; ++i) { @@ -2967,7 +2967,7 @@ void ColladaUtils::ExportData::processData() { //walk backwards as needed to find our first valid detail level for this mesh. if we find none, just move on S32 testDetailLevelSize = getDetailLevelSize(mdl); - detailLevelIdx = meshData[m].hasDetailLevel(testDetailLevelSize); + detailLevelIdx = meshData[meshNum].hasDetailLevel(testDetailLevelSize); if (detailLevelIdx != -1) break; @@ -2983,7 +2983,7 @@ void ColladaUtils::ExportData::processData() { //walk backwards as needed to find our first valid detail level for this mesh. if we find none, just move on S32 testDetailLevelSize = getDetailLevelSize(mdl); - detailLevelIdx = meshData[m].hasDetailLevel(testDetailLevelSize); + detailLevelIdx = meshData[meshNum].hasDetailLevel(testDetailLevelSize); if (detailLevelIdx != -1) break; @@ -2994,13 +2994,13 @@ void ColladaUtils::ExportData::processData() //If we found the detail level index, go ahead and build out the data for it if (detailLevelIdx != -1) { - curDetail->mesh.setTransform(&meshData[m].meshTransform, meshData[m].scale); - curDetail->mesh.setObject(meshData[m].originatingObject); + curDetail->mesh.setTransform(&meshData[meshNum].meshTransform, meshData[meshNum].scale); + curDetail->mesh.setObject(meshData[meshNum].originatingObject); - if (meshData[m].shapeInst != nullptr) + if (meshData[meshNum].shapeInst != nullptr) { - if (!meshData[m].shapeInst->buildPolyList(&curDetail->mesh, detailLevelIdx)) + if (!meshData[meshNum].shapeInst->buildPolyList(&curDetail->mesh, detailLevelIdx)) { Con::errorf("TSStatic::buildExportPolyList - failed to build polylist for LOD %i", i); continue; @@ -3009,10 +3009,10 @@ void ColladaUtils::ExportData::processData() else { //special handling classes - ConvexShape* convexShp = dynamic_cast(meshData[m].originatingObject); + ConvexShape* convexShp = dynamic_cast(meshData[meshNum].originatingObject); if (convexShp != nullptr) { - if (!convexShp->buildPolyList(PLC_Export, &curDetail->mesh, meshData[m].originatingObject->getWorldBox(), meshData[m].originatingObject->getWorldSphere())) + if (!convexShp->buildPolyList(PLC_Export, &curDetail->mesh, meshData[meshNum].originatingObject->getWorldBox(), meshData[meshNum].originatingObject->getWorldSphere())) { Con::errorf("TSStatic::buildExportPolyList - failed to build ConvexShape polylist for LOD %i", i); continue; @@ -3021,19 +3021,19 @@ void ColladaUtils::ExportData::processData() } //lastly, get material - for (U32 m = 0; m < curDetail->mesh.mMaterialList.size(); m++) + for (U32 matNum = 0; matNum < curDetail->mesh.mMaterialList.size(); matNum++) { - S32 matIdx = hasMaterialInstance(curDetail->mesh.mMaterialList[m]); + S32 matIdx = hasMaterialInstance(curDetail->mesh.mMaterialList[matNum]); if (matIdx == -1) { //cool, haven't already got this material, so lets store it out - materials.push_back(curDetail->mesh.mMaterialList[m]); - curDetail->materialRefList.insert(m, materials.size() - 1); + materials.push_back(curDetail->mesh.mMaterialList[matNum]); + curDetail->materialRefList.insert(matNum, materials.size() - 1); } else { - curDetail->materialRefList.insert(m, matIdx); + curDetail->materialRefList.insert(matNum, matIdx); } } } From 1aa6ace486bf943a799894979f414f1e2e6d5185 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 17:54:49 -0500 Subject: [PATCH 238/312] afx wave scalar and color membervar cleanups --- Engine/source/afx/xm/afxXM_WaveColor.cpp | 52 ++++++++-------- Engine/source/afx/xm/afxXM_WaveScalar.cpp | 76 +++++++++++------------ 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Engine/source/afx/xm/afxXM_WaveColor.cpp b/Engine/source/afx/xm/afxXM_WaveColor.cpp index 851ccfc4d..af823d58f 100644 --- a/Engine/source/afx/xm/afxXM_WaveColor.cpp +++ b/Engine/source/afx/xm/afxXM_WaveColor.cpp @@ -35,10 +35,10 @@ class afxXM_WaveInterp_Color : public afxXM_WaveInterp { protected: - LinearColorF a_set, b_set; - LinearColorF a_var, b_var; - LinearColorF a, b; - bool sync_var; + LinearColorF mA_set, mB_set; + LinearColorF mA_var, mB_var; + LinearColorF mA, mB; + bool mSync_var; public: afxXM_WaveInterp_Color(); @@ -51,36 +51,36 @@ public: afxXM_WaveInterp_Color::afxXM_WaveInterp_Color() { - a_set.set(0.0f, 0.0f, 0.0f, 0.0f); - b_set.set(1.0f, 1.0f, 1.0f, 1.0f); - a_var.set(0.0f, 0.0f, 0.0f, 0.0f); - b_var.set(0.0f, 0.0f, 0.0f, 0.0f); - sync_var = false; - a.set(0.0f, 0.0f, 0.0f, 0.0f); - b.set(1.0f, 1.0f, 1.0f, 1.0f); + mA_set.set(0.0f, 0.0f, 0.0f, 0.0f); + mB_set.set(1.0f, 1.0f, 1.0f, 1.0f); + mA_var.set(0.0f, 0.0f, 0.0f, 0.0f); + mB_var.set(0.0f, 0.0f, 0.0f, 0.0f); + mSync_var = false; + mA.set(0.0f, 0.0f, 0.0f, 0.0f); + mB.set(1.0f, 1.0f, 1.0f, 1.0f); } void afxXM_WaveInterp_Color::set(LinearColorF& a, LinearColorF& b, LinearColorF& a_var, LinearColorF& b_var, bool sync_var) { - a_set = a; - b_set = b; - this->a_var = a_var; - this->b_var = b_var; - this->sync_var = sync_var; - this->a = a; - this->b = b; + mA_set = a; + mB_set = b; + mA_var = a_var; + mB_var = b_var; + mSync_var = sync_var; + mA = a; + mB = b; } inline void afxXM_WaveInterp_Color::pulse() { LinearColorF temp_color; F32 rand_t = gRandGen.randF()*2.0f; - temp_color.interpolate(-a_var, a_var, rand_t); - a = a_set + temp_color; - if (!sync_var) + temp_color.interpolate(-mA_var, mA_var, rand_t); + mA = mA_set + temp_color; + if (!mSync_var) rand_t = gRandGen.randF()*2.0f; - temp_color.interpolate(-b_var, b_var, rand_t); - b = b_set + temp_color; + temp_color.interpolate(-mB_var, mB_var, rand_t); + mB = mB_set + temp_color; } //~~~~~~~~~~~~~~~~~~~~// @@ -91,7 +91,7 @@ public: virtual void interpolate(F32 t, afxXM_Params& params) { LinearColorF temp_color; - temp_color.interpolate(a, b, t); + temp_color.interpolate(mA, mB, t); params.color += temp_color; } }; @@ -104,7 +104,7 @@ public: virtual void interpolate(F32 t, afxXM_Params& params) { LinearColorF temp_color; - temp_color.interpolate(a, b, t); + temp_color.interpolate(mA, mB, t); params.color *= temp_color; } }; @@ -116,7 +116,7 @@ class afxXM_WaveInterp_Color_Rep : public afxXM_WaveInterp_Color public: virtual void interpolate(F32 t, afxXM_Params& params) { - params.color.interpolate(a, b, t); + params.color.interpolate(mA, mB, t); } }; diff --git a/Engine/source/afx/xm/afxXM_WaveScalar.cpp b/Engine/source/afx/xm/afxXM_WaveScalar.cpp index d05b1d579..7b7947abb 100644 --- a/Engine/source/afx/xm/afxXM_WaveScalar.cpp +++ b/Engine/source/afx/xm/afxXM_WaveScalar.cpp @@ -35,10 +35,10 @@ class afxXM_WaveInterp_Scalar : public afxXM_WaveInterp { protected: - F32 a_set, b_set; - F32 a_var, b_var; - F32 a, b; - bool sync_var; + F32 mA_set, mB_set; + F32 mA_var, mB_var; + F32 mA, mB; + bool mSync_var; public: afxXM_WaveInterp_Scalar(); @@ -51,33 +51,33 @@ public: afxXM_WaveInterp_Scalar::afxXM_WaveInterp_Scalar() { - a_set = 0.0f; - b_set = 1.0f; - a_var = 0.0f; - b_var = 0.0; - sync_var = false; - a = 0.0f; - b = 1.0f; + mA_set = 0.0f; + mB_set = 1.0f; + mA_var = 0.0f; + mB_var = 0.0; + mSync_var = false; + mA = 0.0f; + mB = 1.0f; } void afxXM_WaveInterp_Scalar::set(F32 a, F32 b, F32 a_var, F32 b_var, bool sync_var) { - a_set = a; - b_set = b; - this->a_var = a_var; - this->b_var = b_var; - this->sync_var = sync_var; - this->a = a; - this->b = b; + mA_set = a; + mB_set = b; + mA_var = a_var; + mB_var = b_var; + mSync_var = sync_var; + mA = a; + mA = b; } inline void afxXM_WaveInterp_Scalar::pulse() { F32 rand_t = gRandGen.randF()*2.0f; - a = a_set + rand_t*a_var - a_var; - if (!sync_var) + mA = mA_set + rand_t*mA_var - mA_var; + if (!mSync_var) rand_t = gRandGen.randF()*2.0f; - b = b_set + rand_t*b_var - b_var; + mB = mB_set + rand_t*mB_var - mB_var; } //~~~~~~~~~~~~~~~~~~~~// @@ -90,7 +90,7 @@ public: afxXM_WaveInterp_Scalar_Add(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((F32*)(((char*)(¶ms)) + offset)) += lerp(t, a, b); + *((F32*)(((char*)(¶ms)) + offset)) += lerp(t, mA, mB); } }; @@ -104,7 +104,7 @@ public: afxXM_WaveInterp_Scalar_Mul(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((F32*)(((char*)(¶ms)) + offset)) *= lerp(t, a, b); + *((F32*)(((char*)(¶ms)) + offset)) *= lerp(t, mA, mB); } }; @@ -118,7 +118,7 @@ public: afxXM_WaveInterp_Scalar_Rep(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((F32*)(((char*)(¶ms)) + offset)) = lerp(t, a, b); + *((F32*)(((char*)(¶ms)) + offset)) = lerp(t, mA, mB); } }; @@ -132,7 +132,7 @@ public: afxXM_WaveInterp_Scalar_PointAdd(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t, mA, mB); Point3F point_at_t(scalar_at_t, scalar_at_t, scalar_at_t); *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; } @@ -148,7 +148,7 @@ public: afxXM_WaveInterp_Scalar_PointMul(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((Point3F*)(((char*)(¶ms)) + offset)) *= lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) *= lerp(t, mA, mB); } }; @@ -162,7 +162,7 @@ public: afxXM_WaveInterp_Scalar_PointRep(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t,mA, mB); Point3F point_at_t(scalar_at_t, scalar_at_t, scalar_at_t); *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; } @@ -179,7 +179,7 @@ public: afxXM_WaveInterp_Scalar_Axis_PointAdd(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - Point3F point_at_t = axis*lerp(t, a, b); + Point3F point_at_t = axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; } }; @@ -195,7 +195,7 @@ public: { Point3F local_axis(axis); params.ori.mulV(local_axis); - Point3F point_at_t = local_axis*lerp(t, a, b); + Point3F point_at_t = local_axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; } }; @@ -211,7 +211,7 @@ public: afxXM_WaveInterp_Scalar_Axis_PointMul(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - Point3F point_at_t = axis*lerp(t, a, b); + Point3F point_at_t = axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) *= point_at_t; } }; @@ -227,7 +227,7 @@ public: { Point3F local_axis(axis); params.ori.mulV(local_axis); - Point3F point_at_t = local_axis*lerp(t, a, b); + Point3F point_at_t = local_axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) *= point_at_t; } }; @@ -243,7 +243,7 @@ public: afxXM_WaveInterp_Scalar_Axis_PointRep(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - Point3F point_at_t = axis*lerp(t, a, b); + Point3F point_at_t = axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; } }; @@ -259,7 +259,7 @@ public: { Point3F local_axis(axis); params.ori.mulV(local_axis); - Point3F point_at_t = local_axis*lerp(t, a, b); + Point3F point_at_t = local_axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; } }; @@ -272,7 +272,7 @@ public: afxXM_WaveInterp_Scalar_ColorAdd() : afxXM_WaveInterp_Scalar() { } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t, mA, mB); LinearColorF color_at_t(scalar_at_t, scalar_at_t, scalar_at_t, scalar_at_t); params.color += color_at_t; } @@ -286,7 +286,7 @@ public: afxXM_WaveInterp_Scalar_ColorMul() : afxXM_WaveInterp_Scalar() { } virtual void interpolate(F32 t, afxXM_Params& params) { - params.color *= lerp(t, a, b); + params.color *= lerp(t, mA, mB); } }; @@ -298,7 +298,7 @@ public: afxXM_WaveInterp_Scalar_ColorRep() : afxXM_WaveInterp_Scalar() { } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t, mA, mB); params.color.set(scalar_at_t, scalar_at_t, scalar_at_t, scalar_at_t); } }; @@ -313,7 +313,7 @@ public: afxXM_WaveInterp_Scalar_OriMul(Point3F& ax) : afxXM_WaveInterp_Scalar() { axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 theta = mDegToRad(lerp(t, a, b)); + F32 theta = mDegToRad(lerp(t, mA, mB)); AngAxisF rot_aa(axis, theta); MatrixF rot_xfm; rot_aa.setMatrix(&rot_xfm); params.ori.mul(rot_xfm); @@ -330,7 +330,7 @@ public: afxXM_WaveInterp_Scalar_OriRep(Point3F& ax) : afxXM_WaveInterp_Scalar() { axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 theta = mDegToRad(lerp(t, a, b)); + F32 theta = mDegToRad(lerp(t, mA, mB)); AngAxisF rot_aa(axis, theta); rot_aa.setMatrix(¶ms.ori); } From adb60f81df46ba332b758e0c590c2ef5904b0da1 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 18:39:59 -0500 Subject: [PATCH 239/312] afx constraint membervar cleanups --- Engine/source/afx/afxConstraint.cpp | 358 ++++++++++++------------- Engine/source/afx/afxConstraint.h | 32 +-- Engine/source/afx/afxEffectWrapper.cpp | 6 +- 3 files changed, 198 insertions(+), 198 deletions(-) diff --git a/Engine/source/afx/afxConstraint.cpp b/Engine/source/afx/afxConstraint.cpp index 78a506c02..ab4aa59f0 100644 --- a/Engine/source/afx/afxConstraint.cpp +++ b/Engine/source/afx/afxConstraint.cpp @@ -56,25 +56,25 @@ afxConstraintDef::afxConstraintDef() bool afxConstraintDef::isDefined() { - return (def_type != CONS_UNDEFINED); + return (mDef_type != CONS_UNDEFINED); } bool afxConstraintDef::isArbitraryObject() { - return ((cons_src_name != ST_NULLSTRING) && (def_type == CONS_SCENE)); + return ((mCons_src_name != ST_NULLSTRING) && (mDef_type == CONS_SCENE)); } void afxConstraintDef::reset() { - cons_src_name = ST_NULLSTRING; - cons_node_name = ST_NULLSTRING; - def_type = CONS_UNDEFINED; - history_time = 0; - sample_rate = 30; - runs_on_server = false; - runs_on_client = false; - pos_at_box_center = false; - treat_as_camera = false; + mCons_src_name = ST_NULLSTRING; + mCons_node_name = ST_NULLSTRING; + mDef_type = CONS_UNDEFINED; + mHistory_time = 0; + mSample_rate = 30; + mRuns_on_server = false; + mRuns_on_client = false; + mPos_at_box_center = false; + mTreat_as_camera = false; } bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, @@ -85,11 +85,11 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, if (spec == 0 || spec[0] == '\0') return false; - history_time = 0.0f; - sample_rate = 30; + mHistory_time = 0.0f; + mSample_rate = 30; - this->runs_on_server = runs_on_server; - this->runs_on_client = runs_on_client; + mRuns_on_server = runs_on_server; + mRuns_on_client = runs_on_client; // spec should be in one of these forms: // CONSTRAINT_NAME (only) @@ -157,7 +157,7 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, for (S32 i = 0; i < n_words; i++) { if (dStrcmp(words[i], "#center") == 0) - pos_at_box_center = true; + mPos_at_box_center = true; else if (dStrncmp(words[i], "#history(", 9) == 0) hist_spec = words[i]; else @@ -193,9 +193,9 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, S32 args = dSscanf(hist_spec,"%g %d", &hist_age, &hist_rate); if (args > 0) - history_time = hist_age; + mHistory_time = hist_age; if (args > 1) - sample_rate = hist_rate; + mSample_rate = hist_rate; } } } @@ -212,8 +212,8 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, return false; } - cons_src_name = cons_name_key; - def_type = CONS_PREDEFINED; + mCons_src_name = cons_name_key; + mDef_type = CONS_PREDEFINED; dFree(buffer); return true; } @@ -221,10 +221,10 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, // "#scene.NAME" or "#scene.NAME.NODE"" if (cons_name_key == SCENE_CONS_KEY) { - cons_src_name = StringTable->insert(words2[1]); + mCons_src_name = StringTable->insert(words2[1]); if (n_words2 > 2) - cons_node_name = StringTable->insert(words2[2]); - def_type = CONS_SCENE; + mCons_node_name = StringTable->insert(words2[2]); + mDef_type = CONS_SCENE; dFree(buffer); return true; } @@ -232,10 +232,10 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, // "#effect.NAME" or "#effect.NAME.NODE" if (cons_name_key == EFFECT_CONS_KEY) { - cons_src_name = StringTable->insert(words2[1]); + mCons_src_name = StringTable->insert(words2[1]); if (n_words2 > 2) - cons_node_name = StringTable->insert(words2[2]); - def_type = CONS_EFFECT; + mCons_node_name = StringTable->insert(words2[2]); + mDef_type = CONS_EFFECT; dFree(buffer); return true; } @@ -249,10 +249,10 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, return false; } - cons_src_name = StringTable->insert(words2[1]); + mCons_src_name = StringTable->insert(words2[1]); if (n_words2 > 2) - cons_node_name = StringTable->insert(words2[2]); - def_type = CONS_GHOST; + mCons_node_name = StringTable->insert(words2[2]); + mDef_type = CONS_GHOST; dFree(buffer); return true; } @@ -260,9 +260,9 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, // "CONSTRAINT_NAME.NODE" if (n_words2 == 2) { - cons_src_name = cons_name_key; - cons_node_name = StringTable->insert(words2[1]); - def_type = CONS_PREDEFINED; + mCons_src_name = cons_name_key; + mCons_node_name = StringTable->insert(words2[1]); + mDef_type = CONS_PREDEFINED; dFree(buffer); return true; } @@ -372,8 +372,8 @@ S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which) for (S32 i = 0; i < constraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.def_type && - which == cons->cons_def.cons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.mDef_type && + which == cons->cons_def.mCons_src_name) { return i; } @@ -387,8 +387,8 @@ S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which) for (S32 i = 0; i < constraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.def_type && - which == cons->cons_def.cons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.mDef_type && + which == cons->cons_def.mCons_src_name) { return i; } @@ -472,8 +472,8 @@ afxConstraintID afxConstraintMgr::createReferenceEffect(StringTableEntry which, { afxEffectConstraint* cons = new afxEffectConstraint(this, which); //cons->cons_def = def; - cons->cons_def.def_type = afxConstraintDef::CONS_EFFECT; - cons->cons_def.cons_src_name = which; + cons->cons_def.mDef_type = afxConstraintDef::CONS_EFFECT; + cons->cons_def.mCons_src_name = which; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); constraints_v.push_back(list); @@ -489,7 +489,7 @@ void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Poin if (!pt_cons) { afxConstraint* cons = CONS_BY_ID(id); - pt_cons = newPointCons(this, cons->cons_def.history_time > 0.0f); + pt_cons = newPointCons(this, cons->cons_def.mHistory_time > 0.0f); pt_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = pt_cons; delete cons; @@ -514,7 +514,7 @@ void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm) if (!xfm_cons) { afxConstraint* cons = CONS_BY_ID(id); - xfm_cons = newTransformCons(this, cons->cons_def.history_time > 0.0f); + xfm_cons = newTransformCons(this, cons->cons_def.mHistory_time > 0.0f); xfm_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = xfm_cons; delete cons; @@ -541,7 +541,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f); + shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); shape_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = shape_cons; delete cons; @@ -578,7 +578,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f); + shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); shape_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = shape_cons; delete cons; @@ -602,7 +602,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) if (!initialized) Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); - if (!CONS_BY_ID(id)->cons_def.treat_as_camera) + if (!CONS_BY_ID(id)->cons_def.mTreat_as_camera) { ShapeBase* shape = dynamic_cast(obj); if (shape) @@ -618,7 +618,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f); + obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); obj_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = obj_cons; delete cons; @@ -659,7 +659,7 @@ void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f); + obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); obj_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = obj_cons; delete cons; @@ -709,52 +709,52 @@ void afxConstraintMgr::invalidateReference(afxConstraintID id) void afxConstraintMgr::create_constraint(const afxConstraintDef& def) { - if (def.def_type == afxConstraintDef::CONS_UNDEFINED) + if (def.mDef_type == afxConstraintDef::CONS_UNDEFINED) return; //Con::printf("CON - %s [%s] [%s] h=%g", def.cons_type_name, def.cons_src_name, def.cons_node_name, def.history_time); - bool want_history = (def.history_time > 0.0f); + bool want_history = (def.mHistory_time > 0.0f); // constraint is an arbitrary named scene object // - if (def.def_type == afxConstraintDef::CONS_SCENE) + if (def.mDef_type == afxConstraintDef::CONS_SCENE) { - if (def.cons_src_name == ST_NULLSTRING) + if (def.mCons_src_name == ST_NULLSTRING) return; // find the arbitrary object by name SceneObject* arb_obj; if (on_server) { - arb_obj = dynamic_cast(Sim::findObject(def.cons_src_name)); + arb_obj = dynamic_cast(Sim::findObject(def.mCons_src_name)); if (!arb_obj) Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on server.", - def.cons_src_name); + def.mCons_src_name); } else { - arb_obj = find_object_from_name(def.cons_src_name); + arb_obj = find_object_from_name(def.mCons_src_name); if (!arb_obj) Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on client.", - def.cons_src_name); + def.mCons_src_name); } // if it's a shapeBase object, create a Shape or ShapeNode constraint if (dynamic_cast(arb_obj)) { - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { - afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history); + afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set((ShapeBase*)arb_obj); afxConstraintList* list = new afxConstraintList(); list->push_back(cons); constraints_v.push_back(list); } - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { - afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history); + afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set((ShapeBase*)arb_obj); afxConstraintList* list = constraints_v[constraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center) @@ -763,7 +763,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) } else { - afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.cons_src_name, def.cons_node_name, want_history); + afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.mCons_src_name, def.mCons_node_name, want_history); sub->cons_def = def; sub->set((ShapeBase*)arb_obj); afxConstraintList* list = constraints_v[constraints_v.size()-1]; @@ -774,9 +774,9 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // if it's not a shapeBase object, create an Object constraint else if (arb_obj) { - if (!def.pos_at_box_center) + if (!def.mPos_at_box_center) { - afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history); + afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set(arb_obj); afxConstraintList* list = new afxConstraintList(); // OBJECT CONS-LIST (#scene) @@ -785,7 +785,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) } else // if (def.pos_at_box_center) { - afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history); + afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set(arb_obj); afxConstraintList* list = constraints_v[constraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center) @@ -797,24 +797,24 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // constraint is an arbitrary named effect // - else if (def.def_type == afxConstraintDef::CONS_EFFECT) + else if (def.mDef_type == afxConstraintDef::CONS_EFFECT) { - if (def.cons_src_name == ST_NULLSTRING) + if (def.mCons_src_name == ST_NULLSTRING) return; // create an Effect constraint - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { - afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name); + afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); cons->cons_def = def; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); constraints_v.push_back(list); } // create an Effect #center constraint - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { - afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name); + afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); cons->cons_def = def; afxConstraintList* list = constraints_v[constraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect) if (list && (*list)[0]) @@ -823,7 +823,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // create an EffectNode constraint else { - afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.cons_src_name, def.cons_node_name); + afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.mCons_src_name, def.mCons_node_name); sub->cons_def = def; afxConstraintList* list = constraints_v[constraints_v.size()-1]; if (list && (*list)[0]) @@ -839,25 +839,25 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) afxConstraint* cons_ctr = 0; afxConstraint* sub = 0; - if (def.def_type == afxConstraintDef::CONS_GHOST) + if (def.mDef_type == afxConstraintDef::CONS_GHOST) { for (S32 i = 0; i < predefs.size(); i++) { - if (predefs[i].name == def.cons_src_name) + if (predefs[i].name == def.mCons_src_name) { - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); cons->cons_def = def; } - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); cons_ctr->cons_def = def; } else { - sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); sub->cons_def = def; } break; @@ -868,7 +868,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) { for (S32 i = 0; i < predefs.size(); i++) { - if (predefs[i].name == def.cons_src_name) + if (predefs[i].name == def.mCons_src_name) { switch (predefs[i].type) { @@ -881,26 +881,26 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) cons->cons_def = def; break; case OBJECT_CONSTRAINT: - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); cons->cons_def = def; } - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); cons_ctr->cons_def = def; } else { - sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); sub->cons_def = def; } break; case CAMERA_CONSTRAINT: cons = newObjectCons(this, want_history); cons->cons_def = def; - cons->cons_def.treat_as_camera = true; + cons->cons_def.mTreat_as_camera = true; break; } break; @@ -927,29 +927,29 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) list->push_back(sub); } else - Con::printf("predef not found %s", def.cons_src_name); + Con::printf("predef not found %s", def.mCons_src_name); } } afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) { - if (def.def_type == afxConstraintDef::CONS_UNDEFINED) + if (def.mDef_type == afxConstraintDef::CONS_UNDEFINED) return afxConstraintID(); - if (def.cons_src_name != ST_NULLSTRING) + if (def.mCons_src_name != ST_NULLSTRING) { for (S32 i = 0; i < constraints_v.size(); i++) { afxConstraintList* list = constraints_v[i]; afxConstraint* cons = (*list)[0]; - if (def.cons_src_name == cons->cons_def.cons_src_name) + if (def.mCons_src_name == cons->cons_def.mCons_src_name) { for (S32 j = 0; j < list->size(); j++) { afxConstraint* sub = (*list)[j]; - if (def.cons_node_name == sub->cons_def.cons_node_name && - def.pos_at_box_center == sub->cons_def.pos_at_box_center && - def.cons_src_name == sub->cons_def.cons_src_name) + if (def.mCons_node_name == sub->cons_def.mCons_node_name && + def.mPos_at_box_center == sub->cons_def.mPos_at_box_center && + def.mCons_src_name == sub->cons_def.mCons_src_name) { return afxConstraintID(i, j); } @@ -957,14 +957,14 @@ afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) // if we're here, it means the root object name matched but the node name // did not. - if (def.def_type == afxConstraintDef::CONS_PREDEFINED && !def.pos_at_box_center) + if (def.mDef_type == afxConstraintDef::CONS_PREDEFINED && !def.mPos_at_box_center) { afxShapeConstraint* shape_cons = dynamic_cast(cons); if (shape_cons) { //Con::errorf("Append a Node constraint [%s.%s] [%d,%d]", def.cons_src_name, def.cons_node_name, i, list->size()); - bool want_history = (def.history_time > 0.0f); - afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + bool want_history = (def.mHistory_time > 0.0f); + afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); sub->cons_def = def; ((afxShapeConstraint*)sub)->set(shape_cons->shape); list->push_back(sub); @@ -1010,19 +1010,19 @@ S32 QSORT_CALLBACK cmp_cons_defs(const void* a, const void* b) afxConstraintDef* def_a = (afxConstraintDef*) a; afxConstraintDef* def_b = (afxConstraintDef*) b; - if (def_a->def_type == def_b->def_type) + if (def_a->mDef_type == def_b->mDef_type) { - if (def_a->cons_src_name == def_b->cons_src_name) + if (def_a->mCons_src_name == def_b->mCons_src_name) { - if (def_a->pos_at_box_center == def_b->pos_at_box_center) - return (def_a->cons_node_name - def_b->cons_node_name); + if (def_a->mPos_at_box_center == def_b->mPos_at_box_center) + return (def_a->mCons_node_name - def_b->mCons_node_name); else - return (def_a->pos_at_box_center) ? 1 : -1; + return (def_a->mPos_at_box_center) ? 1 : -1; } - return (def_a->cons_src_name - def_b->cons_src_name); + return (def_a->mCons_src_name - def_b->mCons_src_name); } - return (def_a->def_type - def_b->def_type); + return (def_a->mDef_type - def_b->mDef_type); } void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bool on_server, F32 scoping_dist) @@ -1048,7 +1048,7 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo Vector ghost_defs; for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].def_type == afxConstraintDef::CONS_GHOST && all_defs[i].cons_src_name != ST_NULLSTRING) + if (all_defs[i].mDef_type == afxConstraintDef::CONS_GHOST && all_defs[i].mCons_src_name != ST_NULLSTRING) ghost_defs.push_back(all_defs[i]); if (ghost_defs.size() > 0) @@ -1058,13 +1058,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo dQsort(ghost_defs.address(), ghost_defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); S32 last = 0; - defineConstraint(OBJECT_CONSTRAINT, ghost_defs[0].cons_src_name); + defineConstraint(OBJECT_CONSTRAINT, ghost_defs[0].mCons_src_name); for (S32 i = 1; i < ghost_defs.size(); i++) { - if (ghost_defs[last].cons_src_name != ghost_defs[i].cons_src_name) + if (ghost_defs[last].mCons_src_name != ghost_defs[i].mCons_src_name) { - defineConstraint(OBJECT_CONSTRAINT, ghost_defs[i].cons_src_name); + defineConstraint(OBJECT_CONSTRAINT, ghost_defs[i].mCons_src_name); last++; } } @@ -1077,13 +1077,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo if (on_server) { for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].runs_on_server) + if (all_defs[i].mRuns_on_server) defs.push_back(all_defs[i]); } else { for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].runs_on_client) + if (all_defs[i].mRuns_on_client) defs.push_back(all_defs[i]); } @@ -1099,17 +1099,17 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo S32 last = 0; // manufacture root-object def if absent - if (defs[0].cons_node_name != ST_NULLSTRING) + if (defs[0].mCons_node_name != ST_NULLSTRING) { afxConstraintDef root_def = defs[0]; - root_def.cons_node_name = ST_NULLSTRING; + root_def.mCons_node_name = ST_NULLSTRING; unique_defs.push_back(root_def); last++; } - else if (defs[0].pos_at_box_center) + else if (defs[0].mPos_at_box_center) { afxConstraintDef root_def = defs[0]; - root_def.pos_at_box_center = false; + root_def.mPos_at_box_center = false; unique_defs.push_back(root_def); last++; } @@ -1118,19 +1118,19 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo for (S32 i = 1; i < defs.size(); i++) { - if (unique_defs[last].cons_node_name != defs[i].cons_node_name || - unique_defs[last].cons_src_name != defs[i].cons_src_name || - unique_defs[last].pos_at_box_center != defs[i].pos_at_box_center || - unique_defs[last].def_type != defs[i].def_type) + if (unique_defs[last].mCons_node_name != defs[i].mCons_node_name || + unique_defs[last].mCons_src_name != defs[i].mCons_src_name || + unique_defs[last].mPos_at_box_center != defs[i].mPos_at_box_center || + unique_defs[last].mDef_type != defs[i].mDef_type) { // manufacture root-object def if absent - if (defs[i].cons_src_name != ST_NULLSTRING && unique_defs[last].cons_src_name != defs[i].cons_src_name) + if (defs[i].mCons_src_name != ST_NULLSTRING && unique_defs[last].mCons_src_name != defs[i].mCons_src_name) { - if (defs[i].cons_node_name != ST_NULLSTRING || defs[i].pos_at_box_center) + if (defs[i].mCons_node_name != ST_NULLSTRING || defs[i].mPos_at_box_center) { afxConstraintDef root_def = defs[i]; - root_def.cons_node_name = ST_NULLSTRING; - root_def.pos_at_box_center = false; + root_def.mCons_node_name = ST_NULLSTRING; + root_def.mPos_at_box_center = false; unique_defs.push_back(root_def); last++; } @@ -1140,10 +1140,10 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo } else { - if (defs[i].history_time > unique_defs[last].history_time) - unique_defs[last].history_time = defs[i].history_time; - if (defs[i].sample_rate > unique_defs[last].sample_rate) - unique_defs[last].sample_rate = defs[i].sample_rate; + if (defs[i].mHistory_time > unique_defs[last].mHistory_time) + unique_defs[last].mHistory_time = defs[i].mHistory_time; + if (defs[i].mSample_rate > unique_defs[last].mSample_rate) + unique_defs[last].mSample_rate = defs[i].mSample_rate; } } @@ -1161,7 +1161,7 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo defs.clear(); for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].runs_on_client && all_defs[i].isArbitraryObject()) + if (all_defs[i].mRuns_on_client && all_defs[i].isArbitraryObject()) defs.push_back(all_defs[i]); if (defs.size() < 1) @@ -1172,13 +1172,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); S32 last = 0; - names_on_server.push_back(defs[0].cons_src_name); + names_on_server.push_back(defs[0].mCons_src_name); for (S32 i = 1; i < defs.size(); i++) { - if (names_on_server[last] != defs[i].cons_src_name) + if (names_on_server[last] != defs[i].mCons_src_name) { - names_on_server.push_back(defs[i].cons_src_name); + names_on_server.push_back(defs[i].mCons_src_name); last++; } } @@ -1418,7 +1418,7 @@ void afxPointConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) afxTransformConstraint::afxTransformConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - xfm.identity(); + mXfm.identity(); } afxTransformConstraint::~afxTransformConstraint() @@ -1427,7 +1427,7 @@ afxTransformConstraint::~afxTransformConstraint() void afxTransformConstraint::set(const MatrixF& xfm) { - this->xfm = xfm; + mXfm = xfm; is_defined = true; is_valid = true; change_code++; @@ -1438,7 +1438,7 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p { if (cam_pos) { - Point3F dir = (*cam_pos) - xfm.getPosition(); + Point3F dir = (*cam_pos) - mXfm.getPosition(); F32 dist_sq = dir.lenSquared(); if (dist_sq > mgr->getScopingDistanceSquared()) { @@ -1448,8 +1448,8 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p is_valid = true; } - last_xfm = xfm; - last_pos = xfm.getPosition(); + last_xfm = mXfm; + last_pos = mXfm.getPosition(); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1533,7 +1533,7 @@ void afxShapeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) if (shape) { last_xfm = shape->getRenderTransform(); - if (cons_def.pos_at_box_center) + if (cons_def.mPos_at_box_center) last_pos = shape->getBoxCenter(); else last_pos = shape->getRenderPosition(); @@ -1757,46 +1757,46 @@ void afxShapeNodeConstraint::onDeleteNotify(SimObject* obj) afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - arb_name = ST_NULLSTRING; - obj = 0; - scope_id = 0; - is_camera = false; + mArb_name = ST_NULLSTRING; + mObj = 0; + mScope_id = 0; + mIs_camera = false; } afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxConstraint(mgr) { - this->arb_name = arb_name; - obj = 0; - scope_id = 0; - is_camera = false; + mArb_name = arb_name; + mObj = 0; + mScope_id = 0; + mIs_camera = false; } afxObjectConstraint::~afxObjectConstraint() { - if (obj) - clearNotify(obj); + if (mObj) + clearNotify(mObj); } void afxObjectConstraint::set(SceneObject* obj) { - if (this->obj) + if (mObj) { - scope_id = 0; - clearNotify(this->obj); + mScope_id = 0; + clearNotify(mObj); } - this->obj = obj; + mObj = obj; - if (this->obj) + if (mObj) { - deleteNotify(this->obj); - scope_id = this->obj->getScopeId(); + deleteNotify(mObj); + mScope_id = mObj->getScopeId(); } - if (this->obj != NULL) + if (mObj != NULL) { - is_camera = this->obj->isCamera(); + mIs_camera = mObj->isCamera(); is_defined = true; is_valid = true; @@ -1809,11 +1809,11 @@ void afxObjectConstraint::set(SceneObject* obj) void afxObjectConstraint::set_scope_id(U16 scope_id) { - if (obj) - clearNotify(obj); + if (mObj) + clearNotify(mObj); - obj = 0; - this->scope_id = scope_id; + mObj = 0; + mScope_id = scope_id; is_defined = (scope_id > 0); is_valid = false; @@ -1825,52 +1825,52 @@ void afxObjectConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) if (gone_missing) return; - if (obj) + if (mObj) { - if (!is_camera && cons_def.treat_as_camera && dynamic_cast(obj)) + if (!mIs_camera && cons_def.mTreat_as_camera && dynamic_cast(mObj)) { - ShapeBase* cam_obj = (ShapeBase*) obj; + ShapeBase* cam_obj = (ShapeBase*) mObj; F32 pov = 1.0f; cam_obj->getCameraTransform(&pov, &last_xfm); last_xfm.getColumn(3, &last_pos); } else { - last_xfm = obj->getRenderTransform(); - if (cons_def.pos_at_box_center) - last_pos = obj->getBoxCenter(); + last_xfm = mObj->getRenderTransform(); + if (cons_def.mPos_at_box_center) + last_pos = mObj->getBoxCenter(); else - last_pos = obj->getRenderPosition(); + last_pos = mObj->getRenderPosition(); } } } void afxObjectConstraint::restoreObject(SceneObject* obj) { - if (this->obj) + if (mObj) { - scope_id = 0; - clearNotify(this->obj); + mScope_id = 0; + clearNotify(mObj); } - this->obj = obj; + mObj = obj; - if (this->obj) + if (mObj) { - deleteNotify(this->obj); - scope_id = this->obj->getScopeId(); + deleteNotify(mObj); + mScope_id = mObj->getScopeId(); } - is_valid = (this->obj != NULL); + is_valid = (mObj != NULL); } void afxObjectConstraint::onDeleteNotify(SimObject* obj) { - if (this->obj == dynamic_cast(obj)) + if (mObj == dynamic_cast(obj)) { - this->obj = 0; + mObj = 0; is_valid = false; - if (scope_id > 0) + if (mScope_id > 0) mgr->postMissingConstraintObject(this, true); } @@ -1879,14 +1879,14 @@ void afxObjectConstraint::onDeleteNotify(SimObject* obj) U32 afxObjectConstraint::getTriggers() { - TSStatic* ts_static = dynamic_cast(obj); + TSStatic* ts_static = dynamic_cast(mObj); if (ts_static) { TSShapeInstance* obj_inst = ts_static->getShapeInstance(); return (obj_inst) ? obj_inst->getTriggerStateMask() : 0; } - ShapeBase* shape_base = dynamic_cast(obj); + ShapeBase* shape_base = dynamic_cast(mObj); if (shape_base) { TSShapeInstance* obj_inst = shape_base->getShapeInstance(); @@ -1922,7 +1922,7 @@ bool afxEffectConstraint::getPosition(Point3F& pos, F32 hist) if (!effect || !effect->inScope()) return false; - if (cons_def.pos_at_box_center) + if (cons_def.mPos_at_box_center) effect->getUpdatedBoxCenter(pos); else effect->getUpdatedPosition(pos); @@ -2266,7 +2266,7 @@ void afxPointHistConstraint::set(Point3F point, Point3F vector) if (!samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(point, vector); @@ -2325,7 +2325,7 @@ void afxTransformHistConstraint::set(const MatrixF& xfm) if (!samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(xfm); @@ -2390,7 +2390,7 @@ void afxShapeHistConstraint::set(ShapeBase* shape) if (shape && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(shape); @@ -2401,7 +2401,7 @@ void afxShapeHistConstraint::set_scope_id(U16 scope_id) if (scope_id > 0 && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2472,7 +2472,7 @@ void afxShapeNodeHistConstraint::set(ShapeBase* shape) if (shape && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(shape); @@ -2483,7 +2483,7 @@ void afxShapeNodeHistConstraint::set_scope_id(U16 scope_id) if (scope_id > 0 && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2553,7 +2553,7 @@ void afxObjectHistConstraint::set(SceneObject* obj) if (obj && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(obj); @@ -2564,7 +2564,7 @@ void afxObjectHistConstraint::set_scope_id(U16 scope_id) if (scope_id > 0 && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set_scope_id(scope_id); diff --git a/Engine/source/afx/afxConstraint.h b/Engine/source/afx/afxConstraint.h index d2ea324ae..3774613d0 100644 --- a/Engine/source/afx/afxConstraint.h +++ b/Engine/source/afx/afxConstraint.h @@ -47,17 +47,17 @@ struct afxConstraintDef : public afxEffectDefs CONS_GHOST }; - DefType def_type; + DefType mDef_type; - StringTableEntry cons_src_name; - StringTableEntry cons_node_name; - F32 history_time; - U8 sample_rate; + StringTableEntry mCons_src_name; + StringTableEntry mCons_node_name; + F32 mHistory_time; + U8 mSample_rate; - bool runs_on_server; - bool runs_on_client; - bool pos_at_box_center; - bool treat_as_camera; + bool mRuns_on_server; + bool mRuns_on_client; + bool mPos_at_box_center; + bool mTreat_as_camera; /*C*/ afxConstraintDef(); @@ -298,7 +298,7 @@ class afxTransformConstraint : public afxConstraint typedef afxConstraint Parent; protected: - MatrixF xfm; + MatrixF mXfm; public: /*C*/ afxTransformConstraint(afxConstraintMgr*); @@ -404,10 +404,10 @@ class afxObjectConstraint : public afxConstraint typedef afxConstraint Parent; protected: - StringTableEntry arb_name; - SceneObject* obj; - U16 scope_id; - bool is_camera; + StringTableEntry mArb_name; + SceneObject* mObj; + U16 mScope_id; + bool mIs_camera; public: afxObjectConstraint(afxConstraintMgr*); @@ -418,9 +418,9 @@ public: virtual void set_scope_id(U16 scope_id); virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); - virtual SceneObject* getSceneObject() { return obj; } + virtual SceneObject* getSceneObject() { return mObj; } virtual void restoreObject(SceneObject*); - virtual U16 getScopeId() { return scope_id; } + virtual U16 getScopeId() { return mScope_id; } virtual U32 getTriggers(); virtual void onDeleteNotify(SimObject*); diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp index 7011b5f06..0f33585f6 100644 --- a/Engine/source/afx/afxEffectWrapper.cpp +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -990,7 +990,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* pos_constraint = getPosConstraint(); if (pos_constraint) { - bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.history_time); + bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.mHistory_time); if (!valid) getUnconstrainedPosition(CONS_POS); setScopeStatus(valid); @@ -1013,7 +1013,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* orient_constraint = getOrientConstraint(); if (orient_constraint) { - orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.history_time); + orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.mHistory_time); } else { @@ -1022,7 +1022,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* aim_constraint = getAimConstraint(); if (aim_constraint) - aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.history_time); + aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.mHistory_time); else CONS_AIM.zero(); From 593680fb3f657589a7277e16805f360e08005429 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 28 Mar 2018 20:52:10 -0400 Subject: [PATCH 240/312] Move StringStack methods into the cpp file --- Engine/source/console/stringStack.cpp | 179 ++++++++++++++++++++++++++ Engine/source/console/stringStack.h | 172 +++---------------------- 2 files changed, 198 insertions(+), 153 deletions(-) diff --git a/Engine/source/console/stringStack.cpp b/Engine/source/console/stringStack.cpp index 681de2898..7081756c0 100644 --- a/Engine/source/console/stringStack.cpp +++ b/Engine/source/console/stringStack.cpp @@ -24,6 +24,185 @@ #include "console/consoleInternal.h" #include "console/stringStack.h" +StringStack::StringStack() +{ + mBufferSize = 0; + mBuffer = NULL; + mArgBufferSize = 0; + mArgBuffer = NULL; + mNumFrames = 0; + mStart = 0; + mLen = 0; + mStartStackSize = 0; + mFunctionOffset = 0; + validateBufferSize(8192); + validateArgBufferSize(2048); + dMemset(mBuffer, '\0', mBufferSize); + dMemset(mArgBuffer, '\0', mArgBufferSize); +} + +StringStack::~StringStack() +{ + if( mBuffer ) + dFree( mBuffer ); + if( mArgBuffer ) + dFree( mArgBuffer ); +} + +void StringStack::validateBufferSize(U32 size) +{ + if(size > mBufferSize) + { + mBufferSize = size + 2048; + mBuffer = (char *) dRealloc(mBuffer, mBufferSize); + } +} + +void StringStack::validateArgBufferSize(U32 size) +{ + if(size > mArgBufferSize) + { + mArgBufferSize = size + 2048; + mArgBuffer = (char *) dRealloc(mArgBuffer, mArgBufferSize); + } +} + +void StringStack::setIntValue(U32 i) +{ + validateBufferSize(mStart + 32); + dSprintf(mBuffer + mStart, 32, "%d", i); + mLen = dStrlen(mBuffer + mStart); +} + +void StringStack::setFloatValue(F64 v) +{ + validateBufferSize(mStart + 32); + dSprintf(mBuffer + mStart, 32, "%g", v); + mLen = dStrlen(mBuffer + mStart); +} + +char *StringStack::getReturnBuffer(U32 size) +{ + if(size > ReturnBufferSpace) + { + AssertFatal(Con::isMainThread(), "Manipulating return buffer from a secondary thread!"); + validateArgBufferSize(size); + return mArgBuffer; + } + else + { + validateBufferSize(mStart + size); + return mBuffer + mStart; + } +} + +char *StringStack::getArgBuffer(U32 size) +{ + AssertFatal(Con::isMainThread(), "Manipulating console arg buffer from a secondary thread!"); + validateBufferSize(mStart + mFunctionOffset + size); + char *ret = mBuffer + mStart + mFunctionOffset; + mFunctionOffset += size; + return ret; +} + +void StringStack::clearFunctionOffset() +{ + //Con::printf("StringStack mFunctionOffset = 0 (from %i)", mFunctionOffset); + mFunctionOffset = 0; +} + +void StringStack::setStringValue(const char *s) +{ + if(!s) + { + mLen = 0; + mBuffer[mStart] = 0; + return; + } + mLen = dStrlen(s); + + validateBufferSize(mStart + mLen + 2); + dStrcpy(mBuffer + mStart, s, mBufferSize - mStart); +} + +void StringStack::advance() +{ + mStartOffsets[mStartStackSize++] = mStart; + mStart += mLen; + mLen = 0; +} + +void StringStack::advanceChar(char c) +{ + mStartOffsets[mStartStackSize++] = mStart; + mStart += mLen; + mBuffer[mStart] = c; + mBuffer[mStart+1] = 0; + mStart += 1; + mLen = 0; +} + +void StringStack::push() +{ + advanceChar(0); +} + +void StringStack::rewind() +{ + mStart = mStartOffsets[--mStartStackSize]; + mLen = dStrlen(mBuffer + mStart); +} + +void StringStack::rewindTerminate() +{ + mBuffer[mStart] = 0; + mStart = mStartOffsets[--mStartStackSize]; + mLen = dStrlen(mBuffer + mStart); +} + +U32 StringStack::compare() +{ + // Figure out the 1st and 2nd item offsets. + U32 oldStart = mStart; + mStart = mStartOffsets[--mStartStackSize]; + + // Compare current and previous strings. + U32 ret = !dStricmp(mBuffer + mStart, mBuffer + oldStart); + + // Put an empty string on the top of the stack. + mLen = 0; + mBuffer[mStart] = 0; + + return ret; +} + +void StringStack::pushFrame() +{ + //Con::printf("StringStack pushFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); + mFrameOffsets[mNumFrames++] = mStartStackSize; + mStartOffsets[mStartStackSize++] = mStart; + mStart += ReturnBufferSpace; + validateBufferSize(0); +} + +void StringStack::popFrame() +{ + //Con::printf("StringStack popFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); + mStartStackSize = mFrameOffsets[--mNumFrames]; + mStart = mStartOffsets[mStartStackSize]; + mLen = 0; +} + +void StringStack::clearFrames() +{ + //Con::printf("StringStack clearFrames"); + mNumFrames = 0; + mStart = 0; + mLen = 0; + mStartStackSize = 0; + mFunctionOffset = 0; +} + void ConsoleValueStack::getArgcArgv(StringTableEntry name, U32 *argc, ConsoleValueRef **in_argv, bool popStackFrame /* = false */) { diff --git a/Engine/source/console/stringStack.h b/Engine/source/console/stringStack.h index 0550bb61e..f8a300143 100644 --- a/Engine/source/console/stringStack.h +++ b/Engine/source/console/stringStack.h @@ -79,105 +79,31 @@ struct StringStack U32 mArgBufferSize; char *mArgBuffer; - void validateBufferSize(U32 size) - { - if(size > mBufferSize) - { - mBufferSize = size + 2048; - mBuffer = (char *) dRealloc(mBuffer, mBufferSize); - } - } + void validateBufferSize(U32 size); + void validateArgBufferSize(U32 size); - void validateArgBufferSize(U32 size) - { - if(size > mArgBufferSize) - { - mArgBufferSize = size + 2048; - mArgBuffer = (char *) dRealloc(mArgBuffer, mArgBufferSize); - } - } - - StringStack() - { - mBufferSize = 0; - mBuffer = NULL; - mArgBufferSize = 0; - mArgBuffer = NULL; - mNumFrames = 0; - mStart = 0; - mLen = 0; - mStartStackSize = 0; - mFunctionOffset = 0; - validateBufferSize(8192); - validateArgBufferSize(2048); - dMemset(mBuffer, '\0', mBufferSize); - dMemset(mArgBuffer, '\0', mArgBufferSize); - } - ~StringStack() - { - if( mBuffer ) - dFree( mBuffer ); - if( mArgBuffer ) - dFree( mArgBuffer ); - } + StringStack(); + ~StringStack(); /// Set the top of the stack to be an integer value. - void setIntValue(U32 i) - { - validateBufferSize(mStart + 32); - dSprintf(mBuffer + mStart, 32, "%d", i); - mLen = dStrlen(mBuffer + mStart); - } + void setIntValue(U32 i); /// Set the top of the stack to be a float value. - void setFloatValue(F64 v) - { - validateBufferSize(mStart + 32); - dSprintf(mBuffer + mStart, 32, "%g", v); - mLen = dStrlen(mBuffer + mStart); - } + void setFloatValue(F64 v); /// Return a temporary buffer we can use to return data. - char* getReturnBuffer(U32 size) - { - AssertFatal(Con::isMainThread(), "Manipulating return buffer from a secondary thread!"); - validateArgBufferSize(size); - return mArgBuffer; - } + char* getReturnBuffer(U32 size); /// Return a buffer we can use for arguments. /// /// This updates the function offset. - char *getArgBuffer(U32 size) - { - AssertFatal(Con::isMainThread(), "Manipulating console arg buffer from a secondary thread!"); - validateBufferSize(mStart + mFunctionOffset + size); - char *ret = mBuffer + mStart + mFunctionOffset; - mFunctionOffset += size; - return ret; - } + char *getArgBuffer(U32 size); /// Clear the function offset. - void clearFunctionOffset() - { - //Con::printf("StringStack mFunctionOffset = 0 (from %i)", mFunctionOffset); - mFunctionOffset = 0; - } + void clearFunctionOffset(); /// Set a string value on the top of the stack. - void setStringValue(const char *s) - { - if(!s) - { - mLen = 0; - mBuffer[mStart] = 0; - return; - } - mLen = dStrlen(s); - - validateBufferSize(mStart + mLen + 2); - dStrcpy(mBuffer + mStart, s, mBufferSize - mStart); - } + void setStringValue(const char *s); /// Get the top of the stack, as a StringTableEntry. /// @@ -226,33 +152,17 @@ struct StringStack /// /// @note You should use StringStack::push, not this, if you want to /// properly push the stack. - void advance() - { - mStartOffsets[mStartStackSize++] = mStart; - mStart += mLen; - mLen = 0; - } + void advance(); /// Advance the start stack, placing a single character, null-terminated strong /// on the top. /// /// @note You should use StringStack::push, not this, if you want to /// properly push the stack. - void advanceChar(char c) - { - mStartOffsets[mStartStackSize++] = mStart; - mStart += mLen; - mBuffer[mStart] = c; - mBuffer[mStart+1] = 0; - mStart += 1; - mLen = 0; - } + void advanceChar(char c); /// Push the stack, placing a zero-length string on the top. - void push() - { - advanceChar(0); - } + void push(); inline void setLen(U32 newlen) { @@ -260,64 +170,20 @@ struct StringStack } /// Pop the start stack. - void rewind() - { - mStart = mStartOffsets[--mStartStackSize]; - mLen = dStrlen(mBuffer + mStart); - } + void rewind(); // Terminate the current string, and pop the start stack. - void rewindTerminate() - { - mBuffer[mStart] = 0; - mStart = mStartOffsets[--mStartStackSize]; - mLen = dStrlen(mBuffer + mStart); - } + void rewindTerminate(); /// Compare 1st and 2nd items on stack, consuming them in the process, /// and returning true if they matched, false if they didn't. - U32 compare() - { - // Figure out the 1st and 2nd item offsets. - U32 oldStart = mStart; - mStart = mStartOffsets[--mStartStackSize]; + U32 compare(); - // Compare current and previous strings. - U32 ret = !dStricmp(mBuffer + mStart, mBuffer + oldStart); + void pushFrame(); - // Put an empty string on the top of the stack. - mLen = 0; - mBuffer[mStart] = 0; + void popFrame(); - return ret; - } - - void pushFrame() - { - //Con::printf("StringStack pushFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); - mFrameOffsets[mNumFrames++] = mStartStackSize; - mStartOffsets[mStartStackSize++] = mStart; - mStart += ReturnBufferSpace; - validateBufferSize(0); - } - - void popFrame() - { - //Con::printf("StringStack popFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); - mStartStackSize = mFrameOffsets[--mNumFrames]; - mStart = mStartOffsets[mStartStackSize]; - mLen = 0; - } - - void clearFrames() - { - //Con::printf("StringStack clearFrames"); - mNumFrames = 0; - mStart = 0; - mLen = 0; - mStartStackSize = 0; - mFunctionOffset = 0; - } + void clearFrames(); /// Get the arguments for a function call from the stack. void getArgcArgv(StringTableEntry name, U32 *argc, const char ***in_argv, bool popStackFrame = false); From 18dee487f90717f034cdc4b17ac32ef2bb426261 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 28 Mar 2018 20:52:46 -0400 Subject: [PATCH 241/312] Use a circular buffer for getReturnBuffer because StringStack's would get clobbered too quickly --- Engine/source/console/compiledEval.cpp | 9 +-- Engine/source/console/returnBuffer.cpp | 83 ++++++++++++++++++++++++++ Engine/source/console/returnBuffer.h | 49 +++++++++++++++ 3 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 Engine/source/console/returnBuffer.cpp create mode 100644 Engine/source/console/returnBuffer.h diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 73969afb2..47f5717ad 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -41,6 +41,7 @@ #include "core/frameAllocator.h" #include "console/codeInterpreter.h" +#include "console/returnBuffer.h" #ifndef TORQUE_TGB_ONLY #include "materials/materialDefinition.h" @@ -101,17 +102,17 @@ F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line) namespace Con { + ReturnBuffer retBuffer; char *getReturnBuffer(U32 bufferSize) - { - return STR.getReturnBuffer(bufferSize); + return retBuffer.getBuffer(bufferSize); } char *getReturnBuffer(const char *stringToCopy) { U32 len = dStrlen(stringToCopy) + 1; - char *ret = STR.getReturnBuffer(len); + char *ret = retBuffer.getBuffer(len); dMemcpy(ret, stringToCopy, len); return ret; } @@ -119,7 +120,7 @@ namespace Con char* getReturnBuffer(const String& str) { const U32 size = str.size(); - char* ret = STR.getReturnBuffer(size); + char* ret = retBuffer.getBuffer(size); dMemcpy(ret, str.c_str(), size); return ret; } diff --git a/Engine/source/console/returnBuffer.cpp b/Engine/source/console/returnBuffer.cpp new file mode 100644 index 000000000..6813339ea --- /dev/null +++ b/Engine/source/console/returnBuffer.cpp @@ -0,0 +1,83 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "returnBuffer.h" + +ReturnBuffer::ReturnBuffer() +{ + mBuffer = nullptr; + mBufferSize = 0; + mStart = 0; + + //Decent starting alloc of ~1 page = 4kb + ensureSize(4 * 1024); +} + +ReturnBuffer::~ReturnBuffer() +{ + if (mBuffer) + { + dFree(mBuffer); + } +} + +void ReturnBuffer::ensureSize(U32 newSize) +{ + //Round up to nearest multiple of 16 bytes + if (newSize & 0xF) + { + newSize = (newSize & ~0xF) + 0x10; + } + if (mBuffer == NULL) + { + //First alloc + mBuffer = (char *)dMalloc(newSize * sizeof(char)); + mBufferSize = newSize; + } + else if (mBufferSize < newSize) + { + //Just use the expected size + mBuffer = (char *)dRealloc(mBuffer, newSize * sizeof(char)); + mBufferSize = newSize; + } +} + +char *ReturnBuffer::getBuffer(U32 size, U32 alignment) +{ + ensureSize(size); + + //Align the start if necessary + if (mStart % alignment != 0) + { + mStart += alignment - (mStart % alignment); + } + + if (size + mStart > mBufferSize) + { + //Restart + mStart = 0; + } + char *buffer = mBuffer + mStart; + mStart += size; + + return buffer; +} diff --git a/Engine/source/console/returnBuffer.h b/Engine/source/console/returnBuffer.h new file mode 100644 index 000000000..9fa374cb5 --- /dev/null +++ b/Engine/source/console/returnBuffer.h @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _RETURNBUFFER_H_ +#define _RETURNBUFFER_H_ + +#ifndef _PLATFORM_H_ + #include +#endif + +/// Simple circular buffer class for temporary return storage. +class ReturnBuffer +{ + char *mBuffer; + U32 mBufferSize; + U32 mStart; + + /// Possibly expand the buffer to be larger than newSize + void ensureSize(U32 newSize); + +public: + ReturnBuffer(); + ~ReturnBuffer(); + + /// Get a temporary buffer with a given size (and alignment) + /// @note The buffer will be re-used so do not consider it permanent + char *getBuffer(U32 size, U32 alignment = 16); +}; + +#endif //_RETURNBUFFER_H_ From fa2b0761a7a914eb9e3277dd1fb97d7eadff7b9c Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 23:37:19 -0500 Subject: [PATCH 242/312] more afx constraint mmebervar cleanups --- Engine/source/afx/afxConstraint.cpp | 826 ++++++++++++++-------------- Engine/source/afx/afxConstraint.h | 120 ++-- 2 files changed, 473 insertions(+), 473 deletions(-) diff --git a/Engine/source/afx/afxConstraint.cpp b/Engine/source/afx/afxConstraint.cpp index ab4aa59f0..a739148f5 100644 --- a/Engine/source/afx/afxConstraint.cpp +++ b/Engine/source/afx/afxConstraint.cpp @@ -287,15 +287,15 @@ void afxConstraintDef::gather_cons_defs(Vector& defs, afxEffec afxConstraint::afxConstraint(afxConstraintMgr* mgr) { - this->mgr = mgr; - is_defined = false; - is_valid = false; - last_pos.zero(); - last_xfm.identity(); - history_time = 0.0f; - is_alive = true; - gone_missing = false; - change_code = 0; + mMgr = mgr; + mIs_defined = false; + mIs_valid = false; + mLast_pos.zero(); + mLast_xfm.identity(); + mHistory_time = 0.0f; + mIs_alive = true; + mGone_missing = false; + mChange_code = 0; } afxConstraint::~afxConstraint() @@ -342,26 +342,26 @@ inline afxObjectConstraint* newObjectCons(afxConstraintMgr* mgr, StringTableEntr //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // afxConstraintMgr -#define CONS_BY_ID(id) ((*constraints_v[(id).index])[(id).sub_index]) -#define CONS_BY_IJ(i,j) ((*constraints_v[(i)])[(j)]) +#define CONS_BY_ID(id) ((*mConstraints_v[(id).index])[(id).sub_index]) +#define CONS_BY_IJ(i,j) ((*mConstraints_v[(i)])[(j)]) afxConstraintMgr::afxConstraintMgr() { - starttime = 0; - on_server = false; - initialized = false; - scoping_dist_sq = 1000.0f*1000.0f; + mStartTime = 0; + mOn_server = false; + mInitialized = false; + mScoping_dist_sq = 1000.0f*1000.0f; missing_objs = &missing_objs_a; missing_objs2 = &missing_objs_b; } afxConstraintMgr::~afxConstraintMgr() { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - for (S32 j = 0; j < (*constraints_v[i]).size(); j++) + for (S32 j = 0; j < (*mConstraints_v[i]).size(); j++) delete CONS_BY_IJ(i,j); - delete constraints_v[i]; + delete mConstraints_v[i]; } } @@ -369,11 +369,11 @@ afxConstraintMgr::~afxConstraintMgr() S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which) { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.mDef_type && - which == cons->cons_def.mCons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT != cons->mCons_def.mDef_type && + which == cons->mCons_def.mCons_src_name) { return i; } @@ -384,11 +384,11 @@ S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which) S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which) { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.mDef_type && - which == cons->cons_def.mCons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT == cons->mCons_def.mDef_type && + which == cons->mCons_def.mCons_src_name) { return i; } @@ -401,7 +401,7 @@ S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which) void afxConstraintMgr::defineConstraint(U32 type, StringTableEntry name) { preDef predef = { name, type }; - predefs.push_back(predef); + mPredefs.push_back(predef); } afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point, @@ -472,11 +472,11 @@ afxConstraintID afxConstraintMgr::createReferenceEffect(StringTableEntry which, { afxEffectConstraint* cons = new afxEffectConstraint(this, which); //cons->cons_def = def; - cons->cons_def.mDef_type = afxConstraintDef::CONS_EFFECT; - cons->cons_def.mCons_src_name = which; + cons->mCons_def.mDef_type = afxConstraintDef::CONS_EFFECT; + cons->mCons_def.mCons_src_name = which; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); return setReferenceEffect(which, ew); } @@ -489,8 +489,8 @@ void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Poin if (!pt_cons) { afxConstraint* cons = CONS_BY_ID(id); - pt_cons = newPointCons(this, cons->cons_def.mHistory_time > 0.0f); - pt_cons->cons_def = cons->cons_def; + pt_cons = newPointCons(this, cons->mCons_def.mHistory_time > 0.0f); + pt_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = pt_cons; delete cons; } @@ -498,7 +498,7 @@ void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Poin pt_cons->set(point, vector); // nullify all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -514,8 +514,8 @@ void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm) if (!xfm_cons) { afxConstraint* cons = CONS_BY_ID(id); - xfm_cons = newTransformCons(this, cons->cons_def.mHistory_time > 0.0f); - xfm_cons->cons_def = cons->cons_def; + xfm_cons = newTransformCons(this, cons->mCons_def.mHistory_time > 0.0f); + xfm_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = xfm_cons; delete cons; } @@ -523,7 +523,7 @@ void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm) xfm_cons->set(xfm); // nullify all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -541,8 +541,8 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); - shape_cons->cons_def = cons->cons_def; + shape_cons = newShapeCons(this, cons->mCons_def.mHistory_time > 0.0f); + shape_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = shape_cons; delete cons; } @@ -551,7 +551,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) shape_cons->set(shape); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -578,8 +578,8 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); - shape_cons->cons_def = cons->cons_def; + shape_cons = newShapeCons(this, cons->mCons_def.mHistory_time > 0.0f); + shape_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = shape_cons; delete cons; } @@ -588,7 +588,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) shape_cons->set_scope_id(scope_id); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -599,10 +599,10 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) // Assigns an existing scene-object to the constraint matching the given constraint-id. void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) { - if (!initialized) + if (!mInitialized) Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); - if (!CONS_BY_ID(id)->cons_def.mTreat_as_camera) + if (!CONS_BY_ID(id)->mCons_def.mTreat_as_camera) { ShapeBase* shape = dynamic_cast(obj); if (shape) @@ -618,8 +618,8 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); - obj_cons->cons_def = cons->cons_def; + obj_cons = newObjectCons(this, cons->mCons_def.mHistory_time > 0.0f); + obj_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = obj_cons; delete cons; } @@ -627,7 +627,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) obj_cons->set(obj); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -644,7 +644,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) // given constraint-id. void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope_id, bool is_shape) { - if (!initialized) + if (!mInitialized) Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); if (is_shape) @@ -659,8 +659,8 @@ void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); - obj_cons->cons_def = cons->cons_def; + obj_cons = newObjectCons(this, cons->mCons_def.mHistory_time > 0.0f); + obj_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = obj_cons; delete cons; } @@ -668,7 +668,7 @@ void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope obj_cons->set_scope_id(scope_id); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -685,7 +685,7 @@ void afxConstraintMgr::setReferenceEffect(afxConstraintID id, afxEffectWrapper* eff_cons->set(ew); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -704,7 +704,7 @@ void afxConstraintMgr::invalidateReference(afxConstraintID id) { afxConstraint* cons = CONS_BY_ID(id); if (cons) - cons->is_valid = false; + cons->mIs_valid = false; } void afxConstraintMgr::create_constraint(const afxConstraintDef& def) @@ -725,7 +725,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // find the arbitrary object by name SceneObject* arb_obj; - if (on_server) + if (mOn_server) { arb_obj = dynamic_cast(Sim::findObject(def.mCons_src_name)); if (!arb_obj) @@ -746,27 +746,27 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set((ShapeBase*)arb_obj); afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } else if (def.mPos_at_box_center) { afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set((ShapeBase*)arb_obj); - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center) + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center) if (list && (*list)[0]) list->push_back(cons); } else { afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.mCons_src_name, def.mCons_node_name, want_history); - sub->cons_def = def; + sub->mCons_def = def; sub->set((ShapeBase*)arb_obj); - afxConstraintList* list = constraints_v[constraints_v.size()-1]; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; if (list && (*list)[0]) list->push_back(sub); } @@ -777,18 +777,18 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (!def.mPos_at_box_center) { afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set(arb_obj); afxConstraintList* list = new afxConstraintList(); // OBJECT CONS-LIST (#scene) list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } else // if (def.pos_at_box_center) { afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set(arb_obj); - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center) + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center) if (list && (*list)[0]) list->push_back(cons); } @@ -806,17 +806,17 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); - cons->cons_def = def; + cons->mCons_def = def; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } // create an Effect #center constraint else if (def.mPos_at_box_center) { afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); - cons->cons_def = def; - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect) + cons->mCons_def = def; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect) if (list && (*list)[0]) list->push_back(cons); } @@ -824,8 +824,8 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) else { afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.mCons_src_name, def.mCons_node_name); - sub->cons_def = def; - afxConstraintList* list = constraints_v[constraints_v.size()-1]; + sub->mCons_def = def; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; if (list && (*list)[0]) list->push_back(sub); } @@ -841,24 +841,24 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (def.mDef_type == afxConstraintDef::CONS_GHOST) { - for (S32 i = 0; i < predefs.size(); i++) + for (S32 i = 0; i < mPredefs.size(); i++) { - if (predefs[i].name == def.mCons_src_name) + if (mPredefs[i].name == def.mCons_src_name) { if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; } else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); - cons_ctr->cons_def = def; + cons_ctr->mCons_def = def; } else { sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); - sub->cons_def = def; + sub->mCons_def = def; } break; } @@ -866,41 +866,41 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) } else { - for (S32 i = 0; i < predefs.size(); i++) + for (S32 i = 0; i < mPredefs.size(); i++) { - if (predefs[i].name == def.mCons_src_name) + if (mPredefs[i].name == def.mCons_src_name) { - switch (predefs[i].type) + switch (mPredefs[i].type) { case POINT_CONSTRAINT: cons = newPointCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; break; case TRANSFORM_CONSTRAINT: cons = newTransformCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; break; case OBJECT_CONSTRAINT: if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; } else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); - cons_ctr->cons_def = def; + cons_ctr->mCons_def = def; } else { sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); - sub->cons_def = def; + sub->mCons_def = def; } break; case CAMERA_CONSTRAINT: cons = newObjectCons(this, want_history); - cons->cons_def = def; - cons->cons_def.mTreat_as_camera = true; + cons->mCons_def = def; + cons->mCons_def.mTreat_as_camera = true; break; } break; @@ -912,17 +912,17 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) { afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } - else if (cons_ctr && constraints_v.size() > 0) + else if (cons_ctr && mConstraints_v.size() > 0) { - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // PREDEF-NODE CONS-LIST + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // PREDEF-NODE CONS-LIST if (list && (*list)[0]) list->push_back(cons_ctr); } - else if (sub && constraints_v.size() > 0) + else if (sub && mConstraints_v.size() > 0) { - afxConstraintList* list = constraints_v[constraints_v.size()-1]; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; if (list && (*list)[0]) list->push_back(sub); } @@ -938,18 +938,18 @@ afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) if (def.mCons_src_name != ST_NULLSTRING) { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - afxConstraintList* list = constraints_v[i]; + afxConstraintList* list = mConstraints_v[i]; afxConstraint* cons = (*list)[0]; - if (def.mCons_src_name == cons->cons_def.mCons_src_name) + if (def.mCons_src_name == cons->mCons_def.mCons_src_name) { for (S32 j = 0; j < list->size(); j++) { afxConstraint* sub = (*list)[j]; - if (def.mCons_node_name == sub->cons_def.mCons_node_name && - def.mPos_at_box_center == sub->cons_def.mPos_at_box_center && - def.mCons_src_name == sub->cons_def.mCons_src_name) + if (def.mCons_node_name == sub->mCons_def.mCons_node_name && + def.mPos_at_box_center == sub->mCons_def.mPos_at_box_center && + def.mCons_src_name == sub->mCons_def.mCons_src_name) { return afxConstraintID(i, j); } @@ -965,8 +965,8 @@ afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) //Con::errorf("Append a Node constraint [%s.%s] [%d,%d]", def.cons_src_name, def.cons_node_name, i, list->size()); bool want_history = (def.mHistory_time > 0.0f); afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); - sub->cons_def = def; - ((afxShapeConstraint*)sub)->set(shape_cons->shape); + sub->mCons_def = def; + ((afxShapeConstraint*)sub)->set(shape_cons->mShape); list->push_back(sub); return afxConstraintID(i, list->size()-1); @@ -995,11 +995,11 @@ afxConstraint* afxConstraintMgr::getConstraint(afxConstraintID id) void afxConstraintMgr::sample(F32 dt, U32 now, const Point3F* cam_pos) { - U32 elapsed = now - starttime; + U32 elapsed = now - mStartTime; - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - afxConstraintList* list = constraints_v[i]; + afxConstraintList* list = mConstraints_v[i]; for (S32 j = 0; j < list->size(); j++) (*list)[j]->sample(dt, elapsed, cam_pos); } @@ -1027,16 +1027,16 @@ S32 QSORT_CALLBACK cmp_cons_defs(const void* a, const void* b) void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bool on_server, F32 scoping_dist) { - initialized = true; - this->on_server = on_server; + mInitialized = true; + mOn_server = on_server; if (scoping_dist > 0.0) - scoping_dist_sq = scoping_dist*scoping_dist; + mScoping_dist_sq = scoping_dist*scoping_dist; else { SceneManager* sg = (on_server) ? gServerSceneGraph : gClientSceneGraph; F32 vis_dist = (sg) ? sg->getVisibleDistance() : 1000.0f; - scoping_dist_sq = vis_dist*vis_dist; + mScoping_dist_sq = vis_dist*vis_dist; } if (all_defs.size() < 1) @@ -1157,7 +1157,7 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo // if (on_server) { - names_on_server.clear(); + mNames_on_server.clear(); defs.clear(); for (S32 i = 0; i < all_defs.size(); i++) @@ -1172,13 +1172,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); S32 last = 0; - names_on_server.push_back(defs[0].mCons_src_name); + mNames_on_server.push_back(defs[0].mCons_src_name); for (S32 i = 1; i < defs.size(); i++) { - if (names_on_server[last] != defs[i].mCons_src_name) + if (mNames_on_server[last] != defs[i].mCons_src_name) { - names_on_server.push_back(defs[i].mCons_src_name); + mNames_on_server.push_back(defs[i].mCons_src_name); last++; } } @@ -1188,13 +1188,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo void afxConstraintMgr::packConstraintNames(NetConnection* conn, BitStream* stream) { // pack any named constraint names and ghost indices - if (stream->writeFlag(names_on_server.size() > 0)) //-- ANY NAMED CONS_BY_ID? + if (stream->writeFlag(mNames_on_server.size() > 0)) //-- ANY NAMED CONS_BY_ID? { - stream->write(names_on_server.size()); - for (S32 i = 0; i < names_on_server.size(); i++) + stream->write(mNames_on_server.size()); + for (S32 i = 0; i < mNames_on_server.size(); i++) { - stream->writeString(names_on_server[i]); - NetObject* obj = dynamic_cast(Sim::findObject(names_on_server[i])); + stream->writeString(mNames_on_server[i]); + NetObject* obj = dynamic_cast(Sim::findObject(mNames_on_server[i])); if (!obj) { //Con::printf("CONSTRAINT-OBJECT %s does not exist.", names_on_server[i]); @@ -1219,13 +1219,13 @@ void afxConstraintMgr::unpackConstraintNames(BitStream* stream) { if (stream->readFlag()) //-- ANY NAMED CONS_BY_ID? { - names_on_server.clear(); + mNames_on_server.clear(); S32 sz; stream->read(&sz); for (S32 i = 0; i < sz; i++) { - names_on_server.push_back(stream->readSTString()); + mNames_on_server.push_back(stream->readSTString()); S32 ghost_id; stream->read(&ghost_id); - ghost_ids.push_back(ghost_id); + mGhost_ids.push_back(ghost_id); } } } @@ -1234,17 +1234,17 @@ void afxConstraintMgr::unpackConstraintNames(BitStream* stream) SceneObject* afxConstraintMgr::find_object_from_name(StringTableEntry name) { - if (names_on_server.size() > 0) + if (mNames_on_server.size() > 0) { - for (S32 i = 0; i < names_on_server.size(); i++) - if (names_on_server[i] == name) + for (S32 i = 0; i < mNames_on_server.size(); i++) + if (mNames_on_server[i] == name) { - if (ghost_ids[i] == -1) + if (mGhost_ids[i] == -1) return 0; NetConnection* conn = NetConnection::getConnectionToServer(); if (!conn) return 0; - return dynamic_cast(conn->resolveGhost(ghost_ids[i])); + return dynamic_cast(conn->resolveGhost(mGhost_ids[i])); } } @@ -1283,7 +1283,7 @@ void afxConstraintMgr::clearAllScopeableObjs() void afxConstraintMgr::postMissingConstraintObject(afxConstraint* cons, bool is_deleting) { - if (cons->gone_missing) + if (cons->mGone_missing) return; if (!is_deleting) @@ -1296,7 +1296,7 @@ void afxConstraintMgr::postMissingConstraintObject(afxConstraint* cons, bool is_ } } - cons->gone_missing = true; + cons->mGone_missing = true; missing_objs->push_back(cons); } @@ -1306,7 +1306,7 @@ void afxConstraintMgr::restoreScopedObject(SceneObject* obj, afxChoreographer* c { if ((*missing_objs)[i]->getScopeId() == obj->getScopeId()) { - (*missing_objs)[i]->gone_missing = false; + (*missing_objs)[i]->mGone_missing = false; (*missing_objs)[i]->restoreObject(obj); if (ch) ch->restoreObject(obj); @@ -1329,9 +1329,9 @@ void afxConstraintMgr::adjustProcessOrdering(afxChoreographer* ch) cons_sources.push_back(ch); // collect all the ProcessObject related constraint sources - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - afxConstraintList* list = constraints_v[i]; + afxConstraintList* list = mConstraints_v[i]; afxConstraint* cons = (*list)[0]; if (cons) { @@ -1375,8 +1375,8 @@ void afxConstraintMgr::adjustProcessOrdering(afxChoreographer* ch) afxPointConstraint::afxPointConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - point.zero(); - vector.set(0,0,1); + mPoint.zero(); + mVector.set(0,0,1); } afxPointConstraint::~afxPointConstraint() @@ -1385,11 +1385,11 @@ afxPointConstraint::~afxPointConstraint() void afxPointConstraint::set(Point3F point, Point3F vector) { - this->point = point; - this->vector = vector; - is_defined = true; - is_valid = true; - change_code++; + mPoint = point; + mVector = vector; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } @@ -1397,19 +1397,19 @@ void afxPointConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { if (cam_pos) { - Point3F dir = (*cam_pos) - point; + Point3F dir = (*cam_pos) - mPoint; F32 dist_sq = dir.lenSquared(); - if (dist_sq > mgr->getScopingDistanceSquared()) + if (dist_sq > mMgr->getScopingDistanceSquared()) { - is_valid = false; + mIs_valid = false; return; } - is_valid = true; + mIs_valid = true; } - last_pos = point; - last_xfm.identity(); - last_xfm.setPosition(point); + mLast_pos = mPoint; + mLast_xfm.identity(); + mLast_xfm.setPosition(mPoint); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1428,9 +1428,9 @@ afxTransformConstraint::~afxTransformConstraint() void afxTransformConstraint::set(const MatrixF& xfm) { mXfm = xfm; - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } @@ -1440,16 +1440,16 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p { Point3F dir = (*cam_pos) - mXfm.getPosition(); F32 dist_sq = dir.lenSquared(); - if (dist_sq > mgr->getScopingDistanceSquared()) + if (dist_sq > mMgr->getScopingDistanceSquared()) { - is_valid = false; + mIs_valid = false; return; } - is_valid = true; + mIs_valid = true; } - last_xfm = mXfm; - last_pos = mXfm.getPosition(); + mLast_xfm = mXfm; + mLast_pos = mXfm.getPosition(); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1458,115 +1458,115 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - arb_name = ST_NULLSTRING; - shape = 0; - scope_id = 0; - clip_tag = 0; - lock_tag = 0; + mArb_name = ST_NULLSTRING; + mShape = 0; + mScope_id = 0; + mClip_tag = 0; + mLock_tag = 0; } afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxConstraint(mgr) { - this->arb_name = arb_name; - shape = 0; - scope_id = 0; - clip_tag = 0; - lock_tag = 0; + mArb_name = arb_name; + mShape = 0; + mScope_id = 0; + mClip_tag = 0; + mLock_tag = 0; } afxShapeConstraint::~afxShapeConstraint() { - if (shape) - clearNotify(shape); + if (mShape) + clearNotify(mShape); } void afxShapeConstraint::set(ShapeBase* shape) { - if (this->shape) + if (mShape) { - scope_id = 0; - clearNotify(this->shape); - if (clip_tag > 0) - remapAnimation(clip_tag, shape); - if (lock_tag > 0) - unlockAnimation(lock_tag); + mScope_id = 0; + clearNotify(mShape); + if (mClip_tag > 0) + remapAnimation(mClip_tag, shape); + if (mLock_tag > 0) + unlockAnimation(mLock_tag); } - this->shape = shape; + mShape = shape; - if (this->shape) + if (mShape) { - deleteNotify(this->shape); - scope_id = this->shape->getScopeId(); + deleteNotify(mShape); + mScope_id = mShape->getScopeId(); } - if (this->shape != NULL) + if (mShape != NULL) { - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } else - is_valid = false; + mIs_valid = false; } void afxShapeConstraint::set_scope_id(U16 scope_id) { - if (shape) - clearNotify(shape); + if (mShape) + clearNotify(mShape); - shape = 0; - this->scope_id = scope_id; + mShape = 0; + mScope_id = scope_id; - is_defined = (this->scope_id > 0); - is_valid = false; - mgr->postMissingConstraintObject(this); + mIs_defined = (mScope_id > 0); + mIs_valid = false; + mMgr->postMissingConstraintObject(this); } void afxShapeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { - if (gone_missing) + if (mGone_missing) return; - if (shape) + if (mShape) { - last_xfm = shape->getRenderTransform(); - if (cons_def.mPos_at_box_center) - last_pos = shape->getBoxCenter(); + mLast_xfm = mShape->getRenderTransform(); + if (mCons_def.mPos_at_box_center) + mLast_pos = mShape->getBoxCenter(); else - last_pos = shape->getRenderPosition(); + mLast_pos = mShape->getRenderPosition(); } } void afxShapeConstraint::restoreObject(SceneObject* obj) { - if (this->shape) + if (mShape) { - scope_id = 0; - clearNotify(this->shape); + mScope_id = 0; + clearNotify(mShape); } - this->shape = (ShapeBase* )obj; + mShape = (ShapeBase* )obj; - if (this->shape) + if (mShape) { - deleteNotify(this->shape); - scope_id = this->shape->getScopeId(); + deleteNotify(mShape); + mScope_id = mShape->getScopeId(); } - is_valid = (this->shape != NULL); + mIs_valid = (mShape != NULL); } void afxShapeConstraint::onDeleteNotify(SimObject* obj) { - if (shape == dynamic_cast(obj)) + if (mShape == dynamic_cast(obj)) { - shape = 0; - is_valid = false; - if (scope_id > 0) - mgr->postMissingConstraintObject(this, true); + mShape = 0; + mIs_valid = false; + if (mScope_id > 0) + mMgr->postMissingConstraintObject(this, true); } Parent::onDeleteNotify(obj); @@ -1574,12 +1574,12 @@ void afxShapeConstraint::onDeleteNotify(SimObject* obj) U32 afxShapeConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) { - if (!shape) + if (!mShape) return 0; - if (shape->isServerObject()) + if (mShape->isServerObject()) { - AIPlayer* ai_player = dynamic_cast(shape); + AIPlayer* ai_player = dynamic_cast(mShape); if (ai_player && !ai_player->isBlendAnimation(clip)) { ai_player->saveMoveState(); @@ -1587,16 +1587,16 @@ U32 afxShapeConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 tra } } - clip_tag = shape->playAnimation(clip, pos, rate, trans, false/*hold*/, true/*wait*/, is_death_anim); - return clip_tag; + mClip_tag = mShape->playAnimation(clip, pos, rate, trans, false/*hold*/, true/*wait*/, is_death_anim); + return mClip_tag; } void afxShapeConstraint::remapAnimation(U32 tag, ShapeBase* other_shape) { - if (clip_tag == 0) + if (mClip_tag == 0) return; - if (!shape) + if (!mShape) return; if (!other_shape) @@ -1605,83 +1605,83 @@ void afxShapeConstraint::remapAnimation(U32 tag, ShapeBase* other_shape) return; } - Con::errorf("remapAnimation -- Clip name, %s.", shape->getLastClipName(tag)); + Con::errorf("remapAnimation -- Clip name, %s.", mShape->getLastClipName(tag)); - if (shape->isClientObject()) + if (mShape->isClientObject()) { - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } else { - AIPlayer* ai_player = dynamic_cast(shape); + AIPlayer* ai_player = dynamic_cast(mShape); if (ai_player) ai_player->restartMove(tag); else - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } - clip_tag = 0; + mClip_tag = 0; } void afxShapeConstraint::resetAnimation(U32 tag) { - if (clip_tag == 0) + if (mClip_tag == 0) return; - if (!shape) + if (!mShape) return; - if (shape->isClientObject()) + if (mShape->isClientObject()) { - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } else { - AIPlayer* ai_player = dynamic_cast(shape); + AIPlayer* ai_player = dynamic_cast(mShape); if (ai_player) ai_player->restartMove(tag); else - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } - if ((tag & 0x80000000) == 0 && tag == clip_tag) - clip_tag = 0; + if ((tag & 0x80000000) == 0 && tag == mClip_tag) + mClip_tag = 0; } U32 afxShapeConstraint::lockAnimation() { - if (!shape) + if (!mShape) return 0; - lock_tag = shape->lockAnimation(); - return lock_tag; + mLock_tag = mShape->lockAnimation(); + return mLock_tag; } void afxShapeConstraint::unlockAnimation(U32 tag) { - if (lock_tag == 0) + if (mLock_tag == 0) return; - if (!shape) + if (!mShape) return; - shape->unlockAnimation(tag); - lock_tag = 0; + mShape->unlockAnimation(tag); + mLock_tag = 0; } F32 afxShapeConstraint::getAnimClipDuration(const char* clip) { - return (shape) ? shape->getAnimationDuration(clip) : 0.0f; + return (mShape) ? mShape->getAnimationDuration(clip) : 0.0f; } S32 afxShapeConstraint::getDamageState() { - return (shape) ? shape->getDamageState() : -1; + return (mShape) ? mShape->getDamageState() : -1; } U32 afxShapeConstraint::getTriggers() { - return (shape) ? shape->getShapeInstance()->getTriggerStateMask() : 0; + return (mShape) ? mShape->getShapeInstance()->getTriggerStateMask() : 0; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1690,45 +1690,45 @@ U32 afxShapeConstraint::getTriggers() afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr) : afxShapeConstraint(mgr) { - arb_node = ST_NULLSTRING; - shape_node_ID = -1; + mArb_node = ST_NULLSTRING; + mShape_node_ID = -1; } afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name, StringTableEntry arb_node) : afxShapeConstraint(mgr, arb_name) { - this->arb_node = arb_node; - shape_node_ID = -1; + mArb_node = arb_node; + mShape_node_ID = -1; } void afxShapeNodeConstraint::set(ShapeBase* shape) { if (shape) { - shape_node_ID = shape->getShape()->findNode(arb_node); - if (shape_node_ID == -1) - Con::errorf("Failed to find node [%s]", arb_node); + mShape_node_ID = shape->getShape()->findNode(mArb_node); + if (mShape_node_ID == -1) + Con::errorf("Failed to find node [%s]", mArb_node); } else - shape_node_ID = -1; + mShape_node_ID = -1; Parent::set(shape); } void afxShapeNodeConstraint::set_scope_id(U16 scope_id) { - shape_node_ID = -1; + mShape_node_ID = -1; Parent::set_scope_id(scope_id); } void afxShapeNodeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { - if (shape && shape_node_ID != -1) + if (mShape && mShape_node_ID != -1) { - last_xfm = shape->getRenderTransform(); - last_xfm.scale(shape->getScale()); - last_xfm.mul(shape->getShapeInstance()->mNodeTransforms[shape_node_ID]); - last_pos = last_xfm.getPosition(); + mLast_xfm = mShape->getRenderTransform(); + mLast_xfm.scale(mShape->getScale()); + mLast_xfm.mul(mShape->getShapeInstance()->mNodeTransforms[mShape_node_ID]); + mLast_pos = mLast_xfm.getPosition(); } } @@ -1737,12 +1737,12 @@ void afxShapeNodeConstraint::restoreObject(SceneObject* obj) ShapeBase* shape = dynamic_cast(obj); if (shape) { - shape_node_ID = shape->getShape()->findNode(arb_node); - if (shape_node_ID == -1) - Con::errorf("Failed to find node [%s]", arb_node); + mShape_node_ID = shape->getShape()->findNode(mArb_node); + if (mShape_node_ID == -1) + Con::errorf("Failed to find node [%s]", mArb_node); } else - shape_node_ID = -1; + mShape_node_ID = -1; Parent::restoreObject(obj); } @@ -1757,7 +1757,7 @@ void afxShapeNodeConstraint::onDeleteNotify(SimObject* obj) afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - mArb_name = ST_NULLSTRING; + mArb_name = ST_NULLSTRING; mObj = 0; mScope_id = 0; mIs_camera = false; @@ -1798,13 +1798,13 @@ void afxObjectConstraint::set(SceneObject* obj) { mIs_camera = mObj->isCamera(); - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } else - is_valid = false; + mIs_valid = false; } void afxObjectConstraint::set_scope_id(U16 scope_id) @@ -1815,32 +1815,32 @@ void afxObjectConstraint::set_scope_id(U16 scope_id) mObj = 0; mScope_id = scope_id; - is_defined = (scope_id > 0); - is_valid = false; - mgr->postMissingConstraintObject(this); + mIs_defined = (scope_id > 0); + mIs_valid = false; + mMgr->postMissingConstraintObject(this); } void afxObjectConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { - if (gone_missing) + if (mGone_missing) return; if (mObj) { - if (!mIs_camera && cons_def.mTreat_as_camera && dynamic_cast(mObj)) + if (!mIs_camera && mCons_def.mTreat_as_camera && dynamic_cast(mObj)) { ShapeBase* cam_obj = (ShapeBase*) mObj; F32 pov = 1.0f; - cam_obj->getCameraTransform(&pov, &last_xfm); - last_xfm.getColumn(3, &last_pos); + cam_obj->getCameraTransform(&pov, &mLast_xfm); + mLast_xfm.getColumn(3, &mLast_pos); } else { - last_xfm = mObj->getRenderTransform(); - if (cons_def.mPos_at_box_center) - last_pos = mObj->getBoxCenter(); + mLast_xfm = mObj->getRenderTransform(); + if (mCons_def.mPos_at_box_center) + mLast_pos = mObj->getBoxCenter(); else - last_pos = mObj->getRenderPosition(); + mLast_pos = mObj->getRenderPosition(); } } } @@ -1861,7 +1861,7 @@ void afxObjectConstraint::restoreObject(SceneObject* obj) mScope_id = mObj->getScopeId(); } - is_valid = (mObj != NULL); + mIs_valid = (mObj != NULL); } void afxObjectConstraint::onDeleteNotify(SimObject* obj) @@ -1869,9 +1869,9 @@ void afxObjectConstraint::onDeleteNotify(SimObject* obj) if (mObj == dynamic_cast(obj)) { mObj = 0; - is_valid = false; + mIs_valid = false; if (mScope_id > 0) - mgr->postMissingConstraintObject(this, true); + mMgr->postMissingConstraintObject(this, true); } Parent::onDeleteNotify(obj); @@ -1902,15 +1902,15 @@ U32 afxObjectConstraint::getTriggers() afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - effect_name = ST_NULLSTRING; - effect = 0; + mEffect_name = ST_NULLSTRING; + mEffect = 0; } afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr, StringTableEntry effect_name) : afxConstraint(mgr) { - this->effect_name = effect_name; - effect = 0; + mEffect_name = effect_name; + mEffect = 0; } afxEffectConstraint::~afxEffectConstraint() @@ -1919,68 +1919,68 @@ afxEffectConstraint::~afxEffectConstraint() bool afxEffectConstraint::getPosition(Point3F& pos, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - if (cons_def.mPos_at_box_center) - effect->getUpdatedBoxCenter(pos); + if (mCons_def.mPos_at_box_center) + mEffect->getUpdatedBoxCenter(pos); else - effect->getUpdatedPosition(pos); + mEffect->getUpdatedPosition(pos); return true; } bool afxEffectConstraint::getTransform(MatrixF& xfm, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - effect->getUpdatedTransform(xfm); + mEffect->getUpdatedTransform(xfm); return true; } bool afxEffectConstraint::getAltitudes(F32& terrain_alt, F32& interior_alt) { - if (!effect) + if (!mEffect) return false; - effect->getAltitudes(terrain_alt, interior_alt); + mEffect->getAltitudes(terrain_alt, interior_alt); return true; } void afxEffectConstraint::set(afxEffectWrapper* effect) { - this->effect = effect; + mEffect = effect; - if (this->effect != NULL) + if (mEffect != NULL) { - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; } else - is_valid = false; + mIs_valid = false; } U32 afxEffectConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) { - return (effect) ? effect->setAnimClip(clip, pos, rate, trans) : 0; + return (mEffect) ? mEffect->setAnimClip(clip, pos, rate, trans) : 0; } void afxEffectConstraint::resetAnimation(U32 tag) { - if (effect) - effect->resetAnimation(tag); + if (mEffect) + mEffect->resetAnimation(tag); } F32 afxEffectConstraint::getAnimClipDuration(const char* clip) { - return (effect) ? getAnimClipDuration(clip) : 0; + return (mEffect) ? getAnimClipDuration(clip) : 0; } U32 afxEffectConstraint::getTriggers() { - return (effect) ? effect->getTriggers() : 0; + return (mEffect) ? mEffect->getTriggers() : 0; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1989,47 +1989,47 @@ U32 afxEffectConstraint::getTriggers() afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr) : afxEffectConstraint(mgr) { - effect_node = ST_NULLSTRING; - effect_node_ID = -1; + mEffect_node = ST_NULLSTRING; + mEffect_node_ID = -1; } afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr, StringTableEntry name, StringTableEntry node) : afxEffectConstraint(mgr, name) { - this->effect_node = node; - effect_node_ID = -1; + mEffect_node = node; + mEffect_node_ID = -1; } bool afxEffectNodeConstraint::getPosition(Point3F& pos, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance(); + TSShapeInstance* ts_shape_inst = mEffect->getTSShapeInstance(); if (!ts_shape_inst) return false; - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) { - TSShape* ts_shape = effect->getTSShape(); - effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + TSShape* ts_shape = mEffect->getTSShape(); + mEffect_node_ID = (ts_shape) ? ts_shape->findNode(mEffect_node) : -1; } - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) return false; - effect->getUpdatedTransform(last_xfm); + mEffect->getUpdatedTransform(mLast_xfm); Point3F scale; - effect->getUpdatedScale(scale); + mEffect->getUpdatedScale(scale); - MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID]; + MatrixF gag = ts_shape_inst->mNodeTransforms[mEffect_node_ID]; gag.setPosition( gag.getPosition()*scale ); MatrixF xfm; - xfm.mul(last_xfm, gag); + xfm.mul(mLast_xfm, gag); // pos = xfm.getPosition(); @@ -2038,31 +2038,31 @@ bool afxEffectNodeConstraint::getPosition(Point3F& pos, F32 hist) bool afxEffectNodeConstraint::getTransform(MatrixF& xfm, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance(); + TSShapeInstance* ts_shape_inst = mEffect->getTSShapeInstance(); if (!ts_shape_inst) return false; - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) { - TSShape* ts_shape = effect->getTSShape(); - effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + TSShape* ts_shape = mEffect->getTSShape(); + mEffect_node_ID = (ts_shape) ? ts_shape->findNode(mEffect_node) : -1; } - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) return false; - effect->getUpdatedTransform(last_xfm); + mEffect->getUpdatedTransform(mLast_xfm); Point3F scale; - effect->getUpdatedScale(scale); + mEffect->getUpdatedScale(scale); - MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID]; + MatrixF gag = ts_shape_inst->mNodeTransforms[mEffect_node_ID]; gag.setPosition( gag.getPosition()*scale ); - xfm.mul(last_xfm, gag); + xfm.mul(mLast_xfm, gag); return true; } @@ -2072,10 +2072,10 @@ void afxEffectNodeConstraint::set(afxEffectWrapper* effect) if (effect) { TSShape* ts_shape = effect->getTSShape(); - effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + mEffect_node_ID = (ts_shape) ? ts_shape->findNode(mEffect_node) : -1; } else - effect_node_ID = -1; + mEffect_node_ID = -1; Parent::set(effect); } @@ -2085,13 +2085,13 @@ void afxEffectNodeConstraint::set(afxEffectWrapper* effect) afxSampleBuffer::afxSampleBuffer() { - buffer_sz = 0; - buffer_ms = 0; - ms_per_sample = 33; - elapsed_ms = 0; - last_sample_ms = 0; - next_sample_num = 0; - n_samples = 0; + mBuffer_sz = 0; + mBuffer_ms = 0; + mMS_per_sample = 33; + mElapsed_ms = 0; + mLast_sample_ms = 0; + mNext_sample_num = 0; + mNum_samples = 0; } afxSampleBuffer::~afxSampleBuffer() @@ -2100,27 +2100,27 @@ afxSampleBuffer::~afxSampleBuffer() void afxSampleBuffer::configHistory(F32 hist_len, U8 sample_rate) { - buffer_sz = mCeil(hist_len*sample_rate) + 1; - ms_per_sample = mCeil(1000.0f/sample_rate); - buffer_ms = buffer_sz*ms_per_sample; + mBuffer_sz = mCeil(hist_len*sample_rate) + 1; + mMS_per_sample = mCeil(1000.0f/sample_rate); + mBuffer_ms = mBuffer_sz*mMS_per_sample; } void afxSampleBuffer::recordSample(F32 dt, U32 elapsed_ms, void* data) { - this->elapsed_ms = elapsed_ms; + mElapsed_ms = elapsed_ms; if (!data) return; - U32 now_sample_num = elapsed_ms/ms_per_sample; - if (next_sample_num <= now_sample_num) + U32 now_sample_num = elapsed_ms/mMS_per_sample; + if (mNext_sample_num <= now_sample_num) { - last_sample_ms = elapsed_ms; - while (next_sample_num <= now_sample_num) + mLast_sample_ms = elapsed_ms; + while (mNext_sample_num <= now_sample_num) { - recSample(next_sample_num % buffer_sz, data); - next_sample_num++; - n_samples++; + recSample(mNext_sample_num % mBuffer_sz, data); + mNext_sample_num++; + mNum_samples++; } } } @@ -2130,7 +2130,7 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx) bool in_bounds = true; U32 lag_ms = lag*1000.0f; - U32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms; + U32 rec_ms = (mElapsed_ms < mBuffer_ms) ? mElapsed_ms : mBuffer_ms; if (lag_ms > rec_ms) { // hasn't produced enough history @@ -2138,8 +2138,8 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx) in_bounds = false; } - U32 latest_sample_num = last_sample_ms/ms_per_sample; - U32 then_sample_num = (elapsed_ms - lag_ms)/ms_per_sample; + U32 latest_sample_num = mLast_sample_ms/mMS_per_sample; + U32 then_sample_num = (mElapsed_ms - lag_ms)/mMS_per_sample; if (then_sample_num > latest_sample_num) { @@ -2148,7 +2148,7 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx) in_bounds = false; } - idx = then_sample_num % buffer_sz; + idx = then_sample_num % mBuffer_sz; return in_bounds; } @@ -2157,7 +2157,7 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, bool in_bounds = true; F32 lag_ms = lag*1000.0f; - F32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms; + F32 rec_ms = (mElapsed_ms < mBuffer_ms) ? mElapsed_ms : mBuffer_ms; if (lag_ms > rec_ms) { // hasn't produced enough history @@ -2165,9 +2165,9 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, in_bounds = false; } - F32 per_samp = ms_per_sample; - F32 latest_sample_num = last_sample_ms/per_samp; - F32 then_sample_num = (elapsed_ms - lag_ms)/per_samp; + F32 per_samp = mMS_per_sample; + F32 latest_sample_num = mLast_sample_ms/per_samp; + F32 then_sample_num = (mElapsed_ms - lag_ms)/per_samp; U32 latest_sample_num_i = latest_sample_num; U32 then_sample_num_i = then_sample_num; @@ -2177,14 +2177,14 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, if (latest_sample_num_i < then_sample_num_i) in_bounds = false; t = 0.0; - idx1 = then_sample_num_i % buffer_sz; + idx1 = then_sample_num_i % mBuffer_sz; idx2 = idx1; } else { t = then_sample_num - then_sample_num_i; - idx1 = then_sample_num_i % buffer_sz; - idx2 = (then_sample_num_i+1) % buffer_sz; + idx1 = then_sample_num_i % mBuffer_sz; + idx2 = (then_sample_num_i+1) % mBuffer_sz; } return in_bounds; @@ -2195,27 +2195,27 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, afxSampleXfmBuffer::afxSampleXfmBuffer() { - xfm_buffer = 0; + mXfm_buffer = 0; } afxSampleXfmBuffer::~afxSampleXfmBuffer() { - delete [] xfm_buffer; + delete [] mXfm_buffer; } void afxSampleXfmBuffer::configHistory(F32 hist_len, U8 sample_rate) { - if (!xfm_buffer) + if (!mXfm_buffer) { afxSampleBuffer::configHistory(hist_len, sample_rate); - if (buffer_sz > 0) - xfm_buffer = new MatrixF[buffer_sz]; + if (mBuffer_sz > 0) + mXfm_buffer = new MatrixF[mBuffer_sz]; } } void afxSampleXfmBuffer::recSample(U32 idx, void* data) { - xfm_buffer[idx] = *((MatrixF*)data); + mXfm_buffer[idx] = *((MatrixF*)data); } void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds) @@ -2226,13 +2226,13 @@ void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds) if (idx1 == idx2) { - MatrixF* m1 = &xfm_buffer[idx1]; + MatrixF* m1 = &mXfm_buffer[idx1]; *((MatrixF*)data) = *m1; } else { - MatrixF* m1 = &xfm_buffer[idx1]; - MatrixF* m2 = &xfm_buffer[idx2]; + MatrixF* m1 = &mXfm_buffer[idx1]; + MatrixF* m2 = &mXfm_buffer[idx2]; Point3F p1 = m1->getPosition(); Point3F p2 = m2->getPosition(); @@ -2253,20 +2253,20 @@ void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds) afxPointHistConstraint::afxPointHistConstraint(afxConstraintMgr* mgr) : afxPointConstraint(mgr) { - samples = 0; + mSamples = 0; } afxPointHistConstraint::~afxPointHistConstraint() { - delete samples; + delete mSamples; } void afxPointHistConstraint::set(Point3F point, Point3F vector) { - if (!samples) + if (!mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(point, vector); @@ -2279,9 +2279,9 @@ void afxPointHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2290,7 +2290,7 @@ bool afxPointHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2301,7 +2301,7 @@ bool afxPointHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2312,20 +2312,20 @@ bool afxPointHistConstraint::getTransform(MatrixF& xfm, F32 hist) afxTransformHistConstraint::afxTransformHistConstraint(afxConstraintMgr* mgr) : afxTransformConstraint(mgr) { - samples = 0; + mSamples = 0; } afxTransformHistConstraint::~afxTransformHistConstraint() { - delete samples; + delete mSamples; } void afxTransformHistConstraint::set(const MatrixF& xfm) { - if (!samples) + if (!mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(xfm); @@ -2338,9 +2338,9 @@ void afxTransformHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* c if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2349,7 +2349,7 @@ bool afxTransformHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2360,7 +2360,7 @@ bool afxTransformHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2371,26 +2371,26 @@ bool afxTransformHistConstraint::getTransform(MatrixF& xfm, F32 hist) afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr) : afxShapeConstraint(mgr) { - samples = 0; + mSamples = 0; } afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxShapeConstraint(mgr, arb_name) { - samples = 0; + mSamples = 0; } afxShapeHistConstraint::~afxShapeHistConstraint() { - delete samples; + delete mSamples; } void afxShapeHistConstraint::set(ShapeBase* shape) { - if (shape && !samples) + if (shape && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(shape); @@ -2398,10 +2398,10 @@ void afxShapeHistConstraint::set(ShapeBase* shape) void afxShapeHistConstraint::set_scope_id(U16 scope_id) { - if (scope_id > 0 && !samples) + if (scope_id > 0 && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2414,9 +2414,9 @@ void afxShapeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2425,7 +2425,7 @@ bool afxShapeHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2436,7 +2436,7 @@ bool afxShapeHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2452,27 +2452,27 @@ void afxShapeHistConstraint::onDeleteNotify(SimObject* obj) afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr) : afxShapeNodeConstraint(mgr) { - samples = 0; + mSamples = 0; } afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name, StringTableEntry arb_node) : afxShapeNodeConstraint(mgr, arb_name, arb_node) { - samples = 0; + mSamples = 0; } afxShapeNodeHistConstraint::~afxShapeNodeHistConstraint() { - delete samples; + delete mSamples; } void afxShapeNodeHistConstraint::set(ShapeBase* shape) { - if (shape && !samples) + if (shape && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(shape); @@ -2480,10 +2480,10 @@ void afxShapeNodeHistConstraint::set(ShapeBase* shape) void afxShapeNodeHistConstraint::set_scope_id(U16 scope_id) { - if (scope_id > 0 && !samples) + if (scope_id > 0 && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2496,9 +2496,9 @@ void afxShapeNodeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* c if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2507,7 +2507,7 @@ bool afxShapeNodeHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2518,7 +2518,7 @@ bool afxShapeNodeHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2534,26 +2534,26 @@ void afxShapeNodeHistConstraint::onDeleteNotify(SimObject* obj) afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr) : afxObjectConstraint(mgr) { - samples = 0; + mSamples = 0; } afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxObjectConstraint(mgr, arb_name) { - samples = 0; + mSamples = 0; } afxObjectHistConstraint::~afxObjectHistConstraint() { - delete samples; + delete mSamples; } void afxObjectHistConstraint::set(SceneObject* obj) { - if (obj && !samples) + if (obj && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(obj); @@ -2561,10 +2561,10 @@ void afxObjectHistConstraint::set(SceneObject* obj) void afxObjectHistConstraint::set_scope_id(U16 scope_id) { - if (scope_id > 0 && !samples) + if (scope_id > 0 && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2577,9 +2577,9 @@ void afxObjectHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_ if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2588,7 +2588,7 @@ bool afxObjectHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2599,7 +2599,7 @@ bool afxObjectHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } diff --git a/Engine/source/afx/afxConstraint.h b/Engine/source/afx/afxConstraint.h index 3774613d0..a17ed3b29 100644 --- a/Engine/source/afx/afxConstraint.h +++ b/Engine/source/afx/afxConstraint.h @@ -94,30 +94,30 @@ class afxConstraint : public SimObject, public afxEffectDefs typedef SimObject Parent; protected: - afxConstraintMgr* mgr; - afxConstraintDef cons_def; - bool is_defined; - bool is_valid; - Point3F last_pos; - MatrixF last_xfm; - F32 history_time; - bool is_alive; - bool gone_missing; - U32 change_code; + afxConstraintMgr* mMgr; + afxConstraintDef mCons_def; + bool mIs_defined; + bool mIs_valid; + Point3F mLast_pos; + MatrixF mLast_xfm; + F32 mHistory_time; + bool mIs_alive; + bool mGone_missing; + U32 mChange_code; public: /*C*/ afxConstraint(afxConstraintMgr*); virtual ~afxConstraint(); virtual bool getPosition(Point3F& pos, F32 hist=0.0f) - { pos = last_pos; return is_valid; } + { pos = mLast_pos; return mIs_valid; } virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f) - { xfm = last_xfm; return is_valid;} + { xfm = mLast_xfm; return mIs_valid;} virtual bool getAltitudes(F32& terrain_alt, F32& interior_alt) { return false; } - virtual bool isDefined() { return is_defined; } - virtual bool isValid() { return is_valid; } - virtual U32 getChangeCode() { return change_code; } + virtual bool isDefined() { return mIs_defined; } + virtual bool isValid() { return mIs_valid; } + virtual U32 getChangeCode() { return mChange_code; } virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) { return 0; }; @@ -127,8 +127,8 @@ public: virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; } virtual S32 getDamageState() { return -1; } - virtual void setLivingState(bool state) { is_alive = state; }; - virtual bool getLivingState() { return is_alive; }; + virtual void setLivingState(bool state) { mIs_alive = state; }; + virtual bool getLivingState() { return mIs_alive; }; virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)=0; @@ -175,15 +175,15 @@ class afxConstraintMgr : public afxEffectDefs U32 type; }; - Vector constraints_v; + Vector mConstraints_v; - Vector names_on_server; - Vector ghost_ids; - Vector predefs; - U32 starttime; - bool on_server; - bool initialized; - F32 scoping_dist_sq; + Vector mNames_on_server; + Vector mGhost_ids; + Vector mPredefs; + U32 mStartTime; + bool mOn_server; + bool mInitialized; + F32 mScoping_dist_sq; SceneObject* find_object_from_name(StringTableEntry); S32 find_cons_idx_from_name(StringTableEntry); @@ -221,7 +221,7 @@ public: void sample(F32 dt, U32 now, const Point3F* cam_pos=0); - void setStartTime(U32 timestamp) { starttime = timestamp; } + void setStartTime(U32 timestamp) { mStartTime = timestamp; } void initConstraintDefs(Vector&, bool on_server, F32 scoping_dist=-1.0f); void packConstraintNames(NetConnection* conn, BitStream* stream); void unpackConstraintNames(BitStream* stream); @@ -245,7 +245,7 @@ public: void restoreScopedObject(SceneObject*, afxChoreographer* ch); void adjustProcessOrdering(afxChoreographer*); - F32 getScopingDistanceSquared() const { return scoping_dist_sq; } + F32 getScopingDistanceSquared() const { return mScoping_dist_sq; } }; inline afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point) @@ -270,8 +270,8 @@ class afxPointConstraint : public afxConstraint typedef afxConstraint Parent; protected: - Point3F point; - Point3F vector; + Point3F mPoint; + Point3F mVector; public: /*C*/ afxPointConstraint(afxConstraintMgr*); @@ -329,11 +329,11 @@ class afxShapeConstraint : public afxConstraint typedef afxConstraint Parent; protected: - StringTableEntry arb_name; - ShapeBase* shape; - U16 scope_id; - U32 clip_tag; - U32 lock_tag; + StringTableEntry mArb_name; + ShapeBase* mShape; + U16 mScope_id; + U32 mClip_tag; + U32 mLock_tag; public: /*C*/ afxShapeConstraint(afxConstraintMgr*); @@ -354,9 +354,9 @@ public: virtual S32 getDamageState(); - virtual SceneObject* getSceneObject() { return shape; } + virtual SceneObject* getSceneObject() { return mShape; } virtual void restoreObject(SceneObject*); - virtual U16 getScopeId() { return scope_id; } + virtual U16 getScopeId() { return mScope_id; } virtual U32 getTriggers(); virtual void onDeleteNotify(SimObject*); @@ -373,8 +373,8 @@ class afxShapeNodeConstraint : public afxShapeConstraint typedef afxShapeConstraint Parent; protected: - StringTableEntry arb_node; - S32 shape_node_ID; + StringTableEntry mArb_node; + S32 mShape_node_ID; public: /*C*/ afxShapeNodeConstraint(afxConstraintMgr*); @@ -385,7 +385,7 @@ public: virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); virtual void restoreObject(SceneObject*); - S32 getNodeID() const { return shape_node_ID; } + S32 getNodeID() const { return mShape_node_ID; } virtual void onDeleteNotify(SimObject*); }; @@ -441,11 +441,11 @@ class afxEffectConstraint : public afxConstraint typedef afxConstraint Parent; protected: - StringTableEntry effect_name; - afxEffectWrapper* effect; - U32 clip_tag; - bool is_death_clip; - U32 lock_tag; + StringTableEntry mEffect_name; + afxEffectWrapper* mEffect; + U32 mClip_tag; + bool mIs_death_clip; + U32 mLock_tag; public: /*C*/ afxEffectConstraint(afxConstraintMgr*); @@ -480,8 +480,8 @@ class afxEffectNodeConstraint : public afxEffectConstraint typedef afxEffectConstraint Parent; protected: - StringTableEntry effect_node; - S32 effect_node_ID; + StringTableEntry mEffect_node; + S32 mEffect_node_ID; public: /*C*/ afxEffectNodeConstraint(afxConstraintMgr*); @@ -492,7 +492,7 @@ public: virtual void set(afxEffectWrapper* effect); - S32 getNodeID() const { return effect_node_ID; } + S32 getNodeID() const { return mEffect_node_ID; } }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -501,13 +501,13 @@ public: class afxSampleBuffer { protected: - U32 buffer_sz; - U32 buffer_ms; - U32 ms_per_sample; - U32 elapsed_ms; - U32 last_sample_ms; - U32 next_sample_num; - U32 n_samples; + U32 mBuffer_sz; + U32 mBuffer_ms; + U32 mMS_per_sample; + U32 mElapsed_ms; + U32 mLast_sample_ms; + U32 mNext_sample_num; + U32 mNum_samples; virtual void recSample(U32 idx, void* data) = 0; bool compute_idx_from_lag(F32 lag, U32& idx); @@ -530,7 +530,7 @@ class afxSampleXfmBuffer : public afxSampleBuffer typedef afxSampleBuffer Parent; protected: - MatrixF* xfm_buffer; + MatrixF* mXfm_buffer; virtual void recSample(U32 idx, void* data); @@ -552,7 +552,7 @@ class afxPointHistConstraint : public afxPointConstraint typedef afxPointConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxPointHistConstraint(afxConstraintMgr*); @@ -575,7 +575,7 @@ class afxTransformHistConstraint : public afxTransformConstraint typedef afxTransformConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxTransformHistConstraint(afxConstraintMgr*); @@ -598,7 +598,7 @@ class afxShapeHistConstraint : public afxShapeConstraint typedef afxShapeConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxShapeHistConstraint(afxConstraintMgr*); @@ -625,7 +625,7 @@ class afxShapeNodeHistConstraint : public afxShapeNodeConstraint typedef afxShapeNodeConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxShapeNodeHistConstraint(afxConstraintMgr*); @@ -654,7 +654,7 @@ class afxObjectHistConstraint : public afxObjectConstraint typedef afxObjectConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: afxObjectHistConstraint(afxConstraintMgr*); From f0686647422f9abf677153656c8394657a756392 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 23:41:47 -0500 Subject: [PATCH 243/312] gamebase mmebervar cleanups. mPacked in particular is likely to geta followup for other cleaning. --- Engine/source/T3D/debris.cpp | 2 +- Engine/source/T3D/fx/particleEmitter.cpp | 2 +- Engine/source/T3D/gameBase/gameBase.cpp | 14 +++++++------- Engine/source/T3D/gameBase/gameBase.h | 4 ++-- Engine/source/T3D/shapeBase.cpp | 2 +- Engine/source/T3D/shapeImage.cpp | 6 +++--- Engine/source/T3D/vehicles/flyingVehicle.cpp | 4 ++-- Engine/source/T3D/vehicles/hoverVehicle.cpp | 4 ++-- Engine/source/T3D/vehicles/vehicle.cpp | 2 +- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 2 +- Engine/source/afx/afxEffectGroup.cpp | 2 +- Engine/source/afx/afxEffectWrapper.cpp | 4 ++-- Engine/source/afx/afxEffectron.cpp | 2 +- Engine/source/afx/afxMagicSpell.cpp | 12 ++++++------ Engine/source/afx/afxSelectron.cpp | 6 +++--- Engine/source/afx/afxSpellBook.cpp | 2 +- Engine/source/afx/ce/afxLightBase_T3D.cpp | 4 ++-- Engine/source/afx/ce/afxPhraseEffect.cpp | 2 +- 18 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 23f18890b..24014d5c8 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -396,7 +396,7 @@ void DebrisData::packData(BitStream* stream) if( stream->writeFlag( explosion ) ) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)explosion): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)explosion): explosion->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); } diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index cab153574..079ea84b8 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -412,7 +412,7 @@ void ParticleEmitterData::packData(BitStream* stream) #if defined(AFX_CAP_PARTICLE_POOLS) if (stream->writeFlag(pool_datablock)) { - stream->writeRangedU32(packed ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); stream->write(pool_index); stream->writeFlag(pool_depth_fade); stream->writeFlag(pool_radial_fade); diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index ad7e4d983..17c050309 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -127,13 +127,13 @@ IMPLEMENT_CALLBACK( GameBase, setControl, void, ( bool controlled ), ( controlle GameBaseData::GameBaseData() { - category = ""; - packed = false; + mCategory = ""; + mPacked = false; } GameBaseData::GameBaseData(const GameBaseData& other, bool temp_clone) : SimDataBlock(other, temp_clone) { - packed = other.packed; - category = other.category; + mPacked = other.mPacked; + mCategory = other.mCategory; //mReloadSignal = other.mReloadSignal; // DO NOT copy the mReloadSignal member. } @@ -158,7 +158,7 @@ void GameBaseData::initPersistFields() { addGroup("Scripting"); - addField( "category", TypeCaseString, Offset( category, GameBaseData ), + addField( "category", TypeCaseString, Offset(mCategory, GameBaseData ), "The group that this datablock will show up in under the \"Scripted\" " "tab in the World Editor Library." ); @@ -171,14 +171,14 @@ bool GameBaseData::preload(bool server, String &errorStr) { if (!Parent::preload(server, errorStr)) return false; - packed = false; + mPacked = false; return true; } void GameBaseData::unpackData(BitStream* stream) { Parent::unpackData(stream); - packed = true; + mPacked = true; } //---------------------------------------------------------------------------- diff --git a/Engine/source/T3D/gameBase/gameBase.h b/Engine/source/T3D/gameBase/gameBase.h index e6cf5c973..2571c1426 100644 --- a/Engine/source/T3D/gameBase/gameBase.h +++ b/Engine/source/T3D/gameBase/gameBase.h @@ -91,8 +91,8 @@ private: public: - bool packed; - StringTableEntry category; + bool mPacked; + StringTableEntry mCategory; // Signal triggered when this datablock is modified. // GameBase objects referencing this datablock notify with this signal. diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 71f826aa4..652e5ce35 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -808,7 +808,7 @@ void ShapeBaseData::packData(BitStream* stream) if( stream->writeFlag( debris != NULL ) ) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)debris): + stream->writeRangedU32(mPacked? SimObjectId((uintptr_t)debris): debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); } diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index 4319baa4e..56d413a2b 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -1019,7 +1019,7 @@ void ShapeBaseImageData::packData(BitStream* stream) // Write the projectile datablock if (stream->writeFlag(projectile)) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)projectile): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)projectile): projectile->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); stream->writeFlag(cloakable); @@ -1050,7 +1050,7 @@ void ShapeBaseImageData::packData(BitStream* stream) if( stream->writeFlag( casing ) ) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)casing): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)casing): casing->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); } @@ -1139,7 +1139,7 @@ void ShapeBaseImageData::packData(BitStream* stream) if (stream->writeFlag(s.emitter)) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)s.emitter): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)s.emitter): s.emitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); stream->write(s.emitterTime); diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 3040d94b1..2ee5bc375 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -244,7 +244,7 @@ void FlyingVehicleData::packData(BitStream* stream) { if (stream->writeFlag(sound[i])) { - SimObjectId writtenId = packed ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId(); + SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId(); stream->writeRangedU32(writtenId, DataBlockObjectIdFirst, DataBlockObjectIdLast); } } @@ -253,7 +253,7 @@ void FlyingVehicleData::packData(BitStream* stream) { if (stream->writeFlag(jetEmitter[j])) { - SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); + SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast); } } diff --git a/Engine/source/T3D/vehicles/hoverVehicle.cpp b/Engine/source/T3D/vehicles/hoverVehicle.cpp index 1da29360b..1f1d259b5 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.cpp +++ b/Engine/source/T3D/vehicles/hoverVehicle.cpp @@ -362,14 +362,14 @@ void HoverVehicleData::packData(BitStream* stream) for (S32 i = 0; i < MaxSounds; i++) if (stream->writeFlag(sound[i])) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)sound[i]): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)sound[i]): sound[i]->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); for (S32 j = 0; j < MaxJetEmitters; j++) { if (stream->writeFlag(jetEmitter[j])) { - SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); + SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast); } } diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index a173d61fd..18a7c4466 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -277,7 +277,7 @@ void VehicleData::packData(BitStream* stream) stream->write(body.friction); for (i = 0; i < Body::MaxSounds; i++) if (stream->writeFlag(body.sound[i])) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)body.sound[i]): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)body.sound[i]): body.sound[i]->getId(),DataBlockObjectIdFirst, DataBlockObjectIdLast); diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 455dee9f5..f4f272fd3 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -477,7 +477,7 @@ void WheeledVehicleData::packData(BitStream* stream) Parent::packData(stream); if (stream->writeFlag(tireEmitter)) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)tireEmitter): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)tireEmitter): tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); for (S32 i = 0; i < MaxSounds; i++) diff --git a/Engine/source/afx/afxEffectGroup.cpp b/Engine/source/afx/afxEffectGroup.cpp index a7e97f25e..749dbbddb 100644 --- a/Engine/source/afx/afxEffectGroup.cpp +++ b/Engine/source/afx/afxEffectGroup.cpp @@ -184,7 +184,7 @@ void afxEffectGroupData::packData(BitStream* stream) stream->write(timing.fade_in_time); stream->write(timing.fade_out_time); - pack_fx(stream, fx_list, packed); + pack_fx(stream, fx_list, mPacked); } void afxEffectGroupData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp index 0f33585f6..33f73f787 100644 --- a/Engine/source/afx/afxEffectWrapper.cpp +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -380,7 +380,7 @@ void afxEffectWrapperData::packData(BitStream* stream) { Parent::packData(stream); - writeDatablockID(stream, effect_data, packed); + writeDatablockID(stream, effect_data, mPacked); stream->writeString(effect_name); @@ -419,7 +419,7 @@ void afxEffectWrapperData::packData(BitStream* stream) stream->write(scale_factor); // modifiers - pack_mods(stream, xfm_modifiers, packed); + pack_mods(stream, xfm_modifiers, mPacked); mathWrite(*stream, forced_bbox); stream->write(update_forced_bbox); diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp index 5a1bacbf4..b1b7f7eff 100644 --- a/Engine/source/afx/afxEffectron.cpp +++ b/Engine/source/afx/afxEffectron.cpp @@ -157,7 +157,7 @@ void afxEffectronData::packData(BitStream* stream) stream->write(duration); stream->write(n_loops); - pack_fx(stream, fx_list, packed); + pack_fx(stream, fx_list, mPacked); } void afxEffectronData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 39621f8cd..3302d3f35 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -326,15 +326,15 @@ void afxMagicSpellData::packData(BitStream* stream) stream->writeFlag(do_move_interrupts); stream->write(move_interrupt_speed); - writeDatablockID(stream, missile_db, packed); + writeDatablockID(stream, missile_db, mPacked); stream->write(launch_on_server_signal); stream->write(primary_target_types); - pack_fx(stream, casting_fx_list, packed); - pack_fx(stream, launch_fx_list, packed); - pack_fx(stream, delivery_fx_list, packed); - pack_fx(stream, impact_fx_list, packed); - pack_fx(stream, linger_fx_list, packed); + pack_fx(stream, casting_fx_list, mPacked); + pack_fx(stream, launch_fx_list, mPacked); + pack_fx(stream, delivery_fx_list, mPacked); + pack_fx(stream, impact_fx_list, mPacked); + pack_fx(stream, linger_fx_list, mPacked); } void afxMagicSpellData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxSelectron.cpp b/Engine/source/afx/afxSelectron.cpp index 148bcceca..81b60c836 100644 --- a/Engine/source/afx/afxSelectron.cpp +++ b/Engine/source/afx/afxSelectron.cpp @@ -230,9 +230,9 @@ void afxSelectronData::packData(BitStream* stream) stream->write(obj_type_style); stream->write(obj_type_mask); - pack_fx(stream, main_fx_list, packed); - pack_fx(stream, select_fx_list, packed); - pack_fx(stream, deselect_fx_list, packed); + pack_fx(stream, main_fx_list, mPacked); + pack_fx(stream, select_fx_list, mPacked); + pack_fx(stream, deselect_fx_list, mPacked); } void afxSelectronData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxSpellBook.cpp b/Engine/source/afx/afxSpellBook.cpp index 42d28d550..cce22129b 100644 --- a/Engine/source/afx/afxSpellBook.cpp +++ b/Engine/source/afx/afxSpellBook.cpp @@ -116,7 +116,7 @@ void afxSpellBookData::packData(BitStream* stream) stream->write(pages_per_book); for (S32 i = 0; i < pages_per_book*spells_per_page; i++) - writeDatablockID(stream, rpg_spells[i], packed); + writeDatablockID(stream, rpg_spells[i], mPacked); } void afxSpellBookData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/ce/afxLightBase_T3D.cpp b/Engine/source/afx/ce/afxLightBase_T3D.cpp index 209bc7426..56b76ccca 100644 --- a/Engine/source/afx/ce/afxLightBase_T3D.cpp +++ b/Engine/source/afx/ce/afxLightBase_T3D.cpp @@ -176,8 +176,8 @@ void afxT3DLightBaseData::packData(BitStream* stream) stream->write( mAnimState.animationPhase ); stream->write( mFlareScale ); - writeDatablockID(stream, mAnimationData, packed); - writeDatablockID(stream, mFlareData, packed); + writeDatablockID(stream, mAnimationData, mPacked); + writeDatablockID(stream, mFlareData, mPacked); } void afxT3DLightBaseData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/ce/afxPhraseEffect.cpp b/Engine/source/afx/ce/afxPhraseEffect.cpp index 3710e2fe6..5df7dfc26 100644 --- a/Engine/source/afx/ce/afxPhraseEffect.cpp +++ b/Engine/source/afx/ce/afxPhraseEffect.cpp @@ -235,7 +235,7 @@ void afxPhraseEffectData::packData(BitStream* stream) stream->writeString(on_trig_cmd); - pack_fx(stream, fx_list, packed); + pack_fx(stream, fx_list, mPacked); } void afxPhraseEffectData::unpackData(BitStream* stream) From ec4043604ed4104fad36cdfd8770ddbc87edd065 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 29 Mar 2018 00:44:10 -0500 Subject: [PATCH 244/312] Remove a now-unneeded fix for offsetof on new versions of Visual Studio. --- Engine/source/console/consoleTypes.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Engine/source/console/consoleTypes.h b/Engine/source/console/consoleTypes.h index df3fc000f..a5da7661e 100644 --- a/Engine/source/console/consoleTypes.h +++ b/Engine/source/console/consoleTypes.h @@ -48,13 +48,6 @@ template inline const T nullAsType(){ return nullptr; } /// @ingroup console_system Console System /// @{ -#if _MSC_VER >= 1911 - #ifdef offsetof - #undef offsetof - #endif // offsetof - #define offsetof(s,m) ((size_t)&reinterpret_cast((((s*)0)->m))) -#endif - #ifndef Offset #define Offset(x, cls) offsetof(cls, x) #endif From 8353d87a4978fe6219268e82c20d6e554d847fdb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 03:40:24 -0500 Subject: [PATCH 245/312] afx path 3d membervar cleanup --- Engine/source/afx/util/afxPath3D.cpp | 120 +++++++++++++-------------- Engine/source/afx/util/afxPath3D.h | 12 +-- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/Engine/source/afx/util/afxPath3D.cpp b/Engine/source/afx/util/afxPath3D.cpp index f37b141d9..5997bdc12 100644 --- a/Engine/source/afx/util/afxPath3D.cpp +++ b/Engine/source/afx/util/afxPath3D.cpp @@ -29,7 +29,7 @@ #include "afx/util/afxPath3D.h" -afxPath3D::afxPath3D() : start_time(0), num_points(0), loop_type(LOOP_CONSTANT) +afxPath3D::afxPath3D() : mStart_time(0), mNum_points(0), mLoop_type(LOOP_CONSTANT) { } @@ -39,88 +39,88 @@ afxPath3D::~afxPath3D() void afxPath3D::sortAll() { - curve.sort(); - curve_parameters.sort(); + mCurve.sort(); + mCurve_parameters.sort(); } void afxPath3D::setStartTime( F32 time ) { - start_time = time; + mStart_time = time; } void afxPath3D::setLoopType( U32 loop_type ) { - this->loop_type = loop_type; + mLoop_type = loop_type; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// F32 afxPath3D::getEndTime() { - return end_time; + return mEnd_time; } int afxPath3D::getNumPoints() { - return num_points; + return mNum_points; } Point3F afxPath3D::getPointPosition( int index ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return Point3F(0.0f, 0.0f, 0.0f); - return curve.getPoint(index); + return mCurve.getPoint(index); } F32 afxPath3D::getPointTime( int index ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return 0.0f; - return curve_parameters.getKeyTime(index); + return mCurve_parameters.getKeyTime(index); } F32 afxPath3D::getPointParameter( int index ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return 0.0f; - return curve_parameters.getKeyValue(index); + return mCurve_parameters.getKeyValue(index); } Point2F afxPath3D::getParameterSegment( F32 time ) { - return curve_parameters.getSegment(time); + return mCurve_parameters.getSegment(time); } void afxPath3D::setPointPosition( int index, Point3F &p ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return; - curve.setPoint(index, p); + mCurve.setPoint(index, p); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// F32 afxPath3D::calcCurveTime( F32 time ) { - if( time <= start_time ) + if( time <= mStart_time ) return 0.0f; - if( time <= end_time ) - return time-start_time; + if( time <= mEnd_time ) + return time-mStart_time; - switch( loop_type ) + switch( mLoop_type ) { case LOOP_CYCLE : { - return mFmod( time-start_time, end_time-start_time ); + return mFmod( time-mStart_time, mEnd_time-mStart_time ); } case LOOP_OSCILLATE : { - F32 t1 = time-start_time; - F32 t2 = end_time-start_time; + F32 t1 = time- mStart_time; + F32 t2 = mEnd_time - mStart_time; if( (int)(t1/t2) % 2 ) // odd segment return t2 - mFmod( t1, t2 ); @@ -129,26 +129,26 @@ F32 afxPath3D::calcCurveTime( F32 time ) } case LOOP_CONSTANT : default: - return end_time; + return mEnd_time; } } Point3F afxPath3D::evaluateAtTime( F32 time ) { F32 ctime = calcCurveTime( time ); - F32 param = curve_parameters.evaluate( ctime ); - return curve.evaluate(param); + F32 param = mCurve_parameters.evaluate( ctime ); + return mCurve.evaluate(param); } Point3F afxPath3D::evaluateAtTime(F32 t0, F32 t1) { F32 ctime = calcCurveTime(t0); - F32 param = curve_parameters.evaluate( ctime ); - Point3F p0 = curve.evaluate(param); + F32 param = mCurve_parameters.evaluate( ctime ); + Point3F p0 = mCurve.evaluate(param); ctime = calcCurveTime(t1); - param = curve_parameters.evaluate( ctime ); - Point3F p1 = curve.evaluate(param); + param = mCurve_parameters.evaluate( ctime ); + Point3F p1 = mCurve.evaluate(param); return p1-p0; } @@ -156,21 +156,21 @@ Point3F afxPath3D::evaluateAtTime(F32 t0, F32 t1) Point3F afxPath3D::evaluateTangentAtTime( F32 time ) { F32 ctime = calcCurveTime( time ); - F32 param = curve_parameters.evaluate( ctime ); - return curve.evaluateTangent(param); + F32 param = mCurve_parameters.evaluate( ctime ); + return mCurve.evaluateTangent(param); } Point3F afxPath3D::evaluateTangentAtPoint( int index ) { - F32 param = curve_parameters.getKeyValue(index); - return curve.evaluateTangent(param); + F32 param = mCurve_parameters.getKeyValue(index); + return mCurve.evaluateTangent(param); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_time, F32 end_time ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -179,10 +179,10 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_tim { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); } - curve.computeTangents(); + mCurve.computeTangents(); initPathParametersNEW( curve_points, start_time, end_time ); @@ -191,7 +191,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_tim void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -200,7 +200,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed ) { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); } initPathParameters( curve_points, speed ); @@ -211,7 +211,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed ) void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 point_times[], F32 time_offset, F32 time_factor ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -220,20 +220,20 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); - curve_parameters.addKey( (point_times[i]+time_offset)*time_factor, param ); + mCurve_parameters.addKey( (point_times[i]+time_offset)*time_factor, param ); } // Set end time - end_time = (point_times[num_points-1]+time_offset)*time_factor; + mEnd_time = (point_times[num_points-1]+time_offset)*time_factor; sortAll(); } void afxPath3D::buildPath( int num_points, Point3F curve_points[], Point2F curve_params[] ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -242,22 +242,22 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], Point2F curve { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); } // for (int i = 0; i < num_points; i++) - curve_parameters.addKey( curve_params[i] ); + mCurve_parameters.addKey( curve_params[i] ); // Set end time - end_time = curve_params[num_points - 1].x; + mEnd_time = curve_params[num_points - 1].x; sortAll(); } void afxPath3D::reBuildPath() { - curve.computeTangents(); + mCurve.computeTangents(); sortAll(); } @@ -265,7 +265,7 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed ) { // Compute the time for each point dependent on the speed of the character and the // distance it must travel (approximately!) - int num_segments = num_points - 1; + int num_segments = mNum_points - 1; F32 *point_distances = new F32[num_segments]; for( int i = 0; i < num_segments; i++ ) { @@ -283,14 +283,14 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed ) last_time = times[i]; } - curve_parameters.addKey( 0, 0.0f );//start_time, 0.0f ); - F32 param_inc = 1.0f / (F32)(num_points - 1); + mCurve_parameters.addKey( 0, 0.0f );//start_time, 0.0f ); + F32 param_inc = 1.0f / (F32)(mNum_points - 1); F32 param = 0.0f + param_inc; for( int i = 0; i < num_segments; i++, param += param_inc ) - curve_parameters.addKey( times[i], param ); + mCurve_parameters.addKey( times[i], param ); // Set end time - end_time = times[num_segments-1]; + mEnd_time = times[num_segments-1]; if (point_distances) delete [] point_distances; @@ -300,7 +300,7 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed ) void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F32 end_time ) { - int num_segments = num_points - 1; + int num_segments = mNum_points - 1; F32 *point_distances = new F32[num_segments]; F32 total_distance = 0.0f; for( int i = 0; i < num_segments; i++ ) @@ -315,19 +315,19 @@ void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F F32 duration = end_time - start_time; F32 time = 0.0f; //start_time; - curve_parameters.addKey( time, 0.0f ); - F32 param_inc = 1.0f / (F32)(num_points - 1); + mCurve_parameters.addKey( time, 0.0f ); + F32 param_inc = 1.0f / (F32)(mNum_points - 1); F32 param = 0.0f + param_inc; for( int i=0; i < num_segments; i++, param += param_inc ) { time += (point_distances[i]/total_distance) * duration; - curve_parameters.addKey( time, param ); + mCurve_parameters.addKey( time, param ); } // Set end time ???? //end_time = time; - this->start_time = start_time; - this->end_time = end_time; + mStart_time = start_time; + mEnd_time = end_time; if (point_distances) delete [] point_distances; @@ -336,7 +336,7 @@ void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F void afxPath3D::print() { // curve.print(); - curve_parameters.print(); + mCurve_parameters.print(); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxPath3D.h b/Engine/source/afx/util/afxPath3D.h index 77d2e2ad2..9c01767b6 100644 --- a/Engine/source/afx/util/afxPath3D.h +++ b/Engine/source/afx/util/afxPath3D.h @@ -37,13 +37,13 @@ class afxPath3D : public EngineObject { private: // Path-related data - afxCurve3D curve; - afxAnimCurve curve_parameters; - int num_points; + afxCurve3D mCurve; + afxAnimCurve mCurve_parameters; + int mNum_points; // Time data - F32 start_time; - F32 end_time; + F32 mStart_time; + F32 mEnd_time; public: /*C*/ afxPath3D( ); @@ -83,7 +83,7 @@ public: LOOP_OSCILLATE }; - U32 loop_type; + U32 mLoop_type; void setLoopType(U32); private: From 0df2cf1b9d8d069223ec566a03e69001eadc703b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 03:41:34 -0500 Subject: [PATCH 246/312] afx magic spell membervar cleanup (plus an additional shadowvar one in magic missile) --- Engine/source/afx/afxMagicMissile.cpp | 22 +- Engine/source/afx/afxMagicSpell.cpp | 1224 ++++++++++++------------- Engine/source/afx/afxMagicSpell.h | 124 +-- 3 files changed, 685 insertions(+), 685 deletions(-) diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index b0549e35d..87d919510 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -532,9 +532,9 @@ bool afxMagicMissileData::preload(bool server, String &errorStr) Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); */ - String errorStr; - if( !sfxResolve( &sound, errorStr ) ) - Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", errorStr.c_str()); + String sfxErrorStr; + if( !sfxResolve( &sound, sfxErrorStr) ) + Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", sfxErrorStr.c_str()); if (!lightDesc && lightDescId != 0) if (Sim::findObject(lightDescId, lightDesc) == false) @@ -1864,7 +1864,7 @@ SceneObject* afxMagicMissile::get_default_launcher() const if (mDataBlock->reverse_targeting) { if (dynamic_cast(choreographer)) - launch_cons_obj = ((afxMagicSpell*)choreographer)->target; + launch_cons_obj = ((afxMagicSpell*)choreographer)->mTarget; if (!launch_cons_obj) { Con::errorf("afxMagicMissile::get_launch_data(): missing target constraint object for reverse targeted missile."); @@ -1874,7 +1874,7 @@ SceneObject* afxMagicMissile::get_default_launcher() const else { if (dynamic_cast(choreographer)) - launch_cons_obj = ((afxMagicSpell*)choreographer)->caster; + launch_cons_obj = ((afxMagicSpell*)choreographer)->mCaster; if (!launch_cons_obj) { Con::errorf("afxMagicMissile::get_launch_data(): missing launch constraint object missile."); @@ -2036,17 +2036,17 @@ void afxMagicMissile::launch() { if (mDataBlock->reverse_targeting) { - missile_target = spell->caster; - collide_exempt = spell->target; + missile_target = spell->mCaster; + collide_exempt = spell->mTarget; } else { - missile_target = spell->target; - collide_exempt = spell->caster; + missile_target = spell->mTarget; + collide_exempt = spell->mCaster; } - if (spell->caster) - processAfter(spell->caster); + if (spell->mCaster) + processAfter(spell->mCaster); if (missile_target) deleteNotify(missile_target); if (collide_exempt) diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 3302d3f35..f9fb2ba01 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -53,19 +53,19 @@ void afxMagicSpellData::ewValidator::validateType(SimObject* object, void* typeP switch (id) { case CASTING_PHRASE: - spelldata->casting_fx_list.push_back(*ew); + spelldata->mCasting_fx_list.push_back(*ew); break; case LAUNCH_PHRASE: - spelldata->launch_fx_list.push_back(*ew); + spelldata->mLaunch_fx_list.push_back(*ew); break; case DELIVERY_PHRASE: - spelldata->delivery_fx_list.push_back(*ew); + spelldata->mDelivery_fx_list.push_back(*ew); break; case IMPACT_PHRASE: - spelldata->impact_fx_list.push_back(*ew); + spelldata->mImpact_fx_list.push_back(*ew); break; case LINGER_PHRASE: - spelldata->linger_fx_list.push_back(*ew); + spelldata->mLinger_fx_list.push_back(*ew); break; } *ew = 0; @@ -140,70 +140,70 @@ IMPLEMENT_CALLBACK( afxMagicSpellData, onActivate, void, afxMagicSpellData::afxMagicSpellData() { - casting_dur = 0.0f; - delivery_dur = 0.0f; - linger_dur = 0.0f; + mCasting_dur = 0.0f; + mDelivery_dur = 0.0f; + mLinger_dur = 0.0f; - n_casting_loops = 1; - n_delivery_loops = 1; - n_linger_loops = 1; + mNum_casting_loops = 1; + mNum_delivery_loops = 1; + mNum_linger_loops = 1; - extra_casting_time = 0.0f; - extra_delivery_time = 0.0f; - extra_linger_time = 0.0f; + mExtra_casting_time = 0.0f; + mExtra_delivery_time = 0.0f; + mExtra_linger_time = 0.0f; // interrupt flags - do_move_interrupts = true; - move_interrupt_speed = 2.0f; + mDo_move_interrupts = true; + mMove_interrupt_speed = 2.0f; // delivers projectile spells - missile_db = 0; - launch_on_server_signal = false; - primary_target_types = PlayerObjectType; + mMissile_db = 0; + mLaunch_on_server_signal = false; + mPrimary_target_types = PlayerObjectType; // dummy entry holds effect-wrapper pointer while a special validator // grabs it and adds it to an appropriate effects list - dummy_fx_entry = NULL; + mDummy_fx_entry = NULL; // marked true if datablock ids need to // be converted into pointers - do_id_convert = false; + mDo_id_convert = false; } afxMagicSpellData::afxMagicSpellData(const afxMagicSpellData& other, bool temp_clone) : afxChoreographerData(other, temp_clone) { - casting_dur = other.casting_dur; - delivery_dur = other.delivery_dur; - linger_dur = other.linger_dur; - n_casting_loops = other.n_casting_loops; - n_delivery_loops = other.n_delivery_loops; - n_linger_loops = other.n_linger_loops; - extra_casting_time = other.extra_casting_time; - extra_delivery_time = other.extra_delivery_time; - extra_linger_time = other.extra_linger_time; - do_move_interrupts = other.do_move_interrupts; - move_interrupt_speed = other.move_interrupt_speed; - missile_db = other.missile_db; - launch_on_server_signal = other.launch_on_server_signal; - primary_target_types = other.primary_target_types; + mCasting_dur = other.mCasting_dur; + mDelivery_dur = other.mDelivery_dur; + mLinger_dur = other.mLinger_dur; + mNum_casting_loops = other.mNum_casting_loops; + mNum_delivery_loops = other.mNum_delivery_loops; + mNum_linger_loops = other.mNum_linger_loops; + mExtra_casting_time = other.mExtra_casting_time; + mExtra_delivery_time = other.mExtra_delivery_time; + mExtra_linger_time = other.mExtra_linger_time; + mDo_move_interrupts = other.mDo_move_interrupts; + mMove_interrupt_speed = other.mMove_interrupt_speed; + mMissile_db = other.mMissile_db; + mLaunch_on_server_signal = other.mLaunch_on_server_signal; + mPrimary_target_types = other.mPrimary_target_types; - dummy_fx_entry = other.dummy_fx_entry; - do_id_convert = other.do_id_convert; + mDummy_fx_entry = other.mDummy_fx_entry; + mDo_id_convert = other.mDo_id_convert; - casting_fx_list = other.casting_fx_list; - launch_fx_list = other.launch_fx_list; - delivery_fx_list = other.delivery_fx_list; - impact_fx_list = other.impact_fx_list; - linger_fx_list = other.linger_fx_list; + mCasting_fx_list = other.mCasting_fx_list; + mLaunch_fx_list = other.mLaunch_fx_list; + mDelivery_fx_list = other.mDelivery_fx_list; + mImpact_fx_list = other.mImpact_fx_list; + mLinger_fx_list = other.mLinger_fx_list; } void afxMagicSpellData::reloadReset() { - casting_fx_list.clear(); - launch_fx_list.clear(); - delivery_fx_list.clear(); - impact_fx_list.clear(); - linger_fx_list.clear(); + mCasting_fx_list.clear(); + mLaunch_fx_list.clear(); + mDelivery_fx_list.clear(); + mImpact_fx_list.clear(); + mLinger_fx_list.clear(); } #define myOffset(field) Offset(field, afxMagicSpellData) @@ -219,54 +219,54 @@ void afxMagicSpellData::initPersistFields() // for each effect list, dummy_fx_entry is set and then a validator adds it to the appropriate effects list addGroup("Casting Stage"); - addField("castingDur", TypeF32, myOffset(casting_dur), + addField("castingDur", TypeF32, myOffset(mCasting_dur), "..."); - addField("numCastingLoops", TypeS32, myOffset(n_casting_loops), + addField("numCastingLoops", TypeS32, myOffset(mNum_casting_loops), "..."); - addField("extraCastingTime", TypeF32, myOffset(extra_casting_time), + addField("extraCastingTime", TypeF32, myOffset(mExtra_casting_time), "..."); - addFieldV("addCastingEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_castingPhrase, + addFieldV("addCastingEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_castingPhrase, "..."); endGroup("Casting Stage"); addGroup("Delivery Stage"); - addField("deliveryDur", TypeF32, myOffset(delivery_dur), + addField("deliveryDur", TypeF32, myOffset(mDelivery_dur), "..."); - addField("numDeliveryLoops", TypeS32, myOffset(n_delivery_loops), + addField("numDeliveryLoops", TypeS32, myOffset(mNum_delivery_loops), "..."); - addField("extraDeliveryTime", TypeF32, myOffset(extra_delivery_time), + addField("extraDeliveryTime", TypeF32, myOffset(mExtra_delivery_time), "..."); - addFieldV("addLaunchEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_launchPhrase, + addFieldV("addLaunchEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_launchPhrase, "..."); - addFieldV("addDeliveryEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_deliveryPhrase, + addFieldV("addDeliveryEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_deliveryPhrase, "..."); endGroup("Delivery Stage"); addGroup("Linger Stage"); - addField("lingerDur", TypeF32, myOffset(linger_dur), + addField("lingerDur", TypeF32, myOffset(mLinger_dur), "..."); - addField("numLingerLoops", TypeS32, myOffset(n_linger_loops), + addField("numLingerLoops", TypeS32, myOffset(mNum_linger_loops), "..."); - addField("extraLingerTime", TypeF32, myOffset(extra_linger_time), + addField("extraLingerTime", TypeF32, myOffset(mExtra_linger_time), "..."); - addFieldV("addImpactEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_impactPhrase, + addFieldV("addImpactEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_impactPhrase, "..."); - addFieldV("addLingerEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_lingerPhrase, + addFieldV("addLingerEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_lingerPhrase, "..."); endGroup("Linger Stage"); // interrupt flags - addField("allowMovementInterrupts", TypeBool, myOffset(do_move_interrupts), + addField("allowMovementInterrupts", TypeBool, myOffset(mDo_move_interrupts), "..."); - addField("movementInterruptSpeed", TypeF32, myOffset(move_interrupt_speed), + addField("movementInterruptSpeed", TypeF32, myOffset(mMove_interrupt_speed), "..."); // delivers projectile spells - addField("missile", TYPEID(), myOffset(missile_db), + addField("missile", TYPEID(), myOffset(mMissile_db), "..."); - addField("launchOnServerSignal", TypeBool, myOffset(launch_on_server_signal), + addField("launchOnServerSignal", TypeBool, myOffset(mLaunch_on_server_signal), "..."); - addField("primaryTargetTypes", TypeS32, myOffset(primary_target_types), + addField("primaryTargetTypes", TypeS32, myOffset(mPrimary_target_types), "..."); @@ -286,8 +286,8 @@ bool afxMagicSpellData::onAdd() if (Parent::onAdd() == false) return false; - if (missile_db != NULL && delivery_dur == 0.0) - delivery_dur = -1; + if (mMissile_db != NULL && mDelivery_dur == 0.0) + mDelivery_dur = -1; return true; } @@ -311,61 +311,61 @@ void afxMagicSpellData::packData(BitStream* stream) { Parent::packData(stream); - stream->write(casting_dur); - stream->write(delivery_dur); - stream->write(linger_dur); + stream->write(mCasting_dur); + stream->write(mDelivery_dur); + stream->write(mLinger_dur); // - stream->write(n_casting_loops); - stream->write(n_delivery_loops); - stream->write(n_linger_loops); + stream->write(mNum_casting_loops); + stream->write(mNum_delivery_loops); + stream->write(mNum_linger_loops); // - stream->write(extra_casting_time); - stream->write(extra_delivery_time); - stream->write(extra_linger_time); + stream->write(mExtra_casting_time); + stream->write(mExtra_delivery_time); + stream->write(mExtra_linger_time); - stream->writeFlag(do_move_interrupts); - stream->write(move_interrupt_speed); + stream->writeFlag(mDo_move_interrupts); + stream->write(mMove_interrupt_speed); - writeDatablockID(stream, missile_db, mPacked); - stream->write(launch_on_server_signal); - stream->write(primary_target_types); + writeDatablockID(stream, mMissile_db, mPacked); + stream->write(mLaunch_on_server_signal); + stream->write(mPrimary_target_types); - pack_fx(stream, casting_fx_list, mPacked); - pack_fx(stream, launch_fx_list, mPacked); - pack_fx(stream, delivery_fx_list, mPacked); - pack_fx(stream, impact_fx_list, mPacked); - pack_fx(stream, linger_fx_list, mPacked); + pack_fx(stream, mCasting_fx_list, mPacked); + pack_fx(stream, mLaunch_fx_list, mPacked); + pack_fx(stream, mDelivery_fx_list, mPacked); + pack_fx(stream, mImpact_fx_list, mPacked); + pack_fx(stream, mLinger_fx_list, mPacked); } void afxMagicSpellData::unpackData(BitStream* stream) { Parent::unpackData(stream); - stream->read(&casting_dur); - stream->read(&delivery_dur); - stream->read(&linger_dur); + stream->read(&mCasting_dur); + stream->read(&mDelivery_dur); + stream->read(&mLinger_dur); // - stream->read(&n_casting_loops); - stream->read(&n_delivery_loops); - stream->read(&n_linger_loops); + stream->read(&mNum_casting_loops); + stream->read(&mNum_delivery_loops); + stream->read(&mNum_linger_loops); // - stream->read(&extra_casting_time); - stream->read(&extra_delivery_time); - stream->read(&extra_linger_time); + stream->read(&mExtra_casting_time); + stream->read(&mExtra_delivery_time); + stream->read(&mExtra_linger_time); - do_move_interrupts = stream->readFlag(); - stream->read(&move_interrupt_speed); + mDo_move_interrupts = stream->readFlag(); + stream->read(&mMove_interrupt_speed); - missile_db = (afxMagicMissileData*) readDatablockID(stream); - stream->read(&launch_on_server_signal); - stream->read(&primary_target_types); + mMissile_db = (afxMagicMissileData*) readDatablockID(stream); + stream->read(&mLaunch_on_server_signal); + stream->read(&mPrimary_target_types); - do_id_convert = true; - unpack_fx(stream, casting_fx_list); - unpack_fx(stream, launch_fx_list); - unpack_fx(stream, delivery_fx_list); - unpack_fx(stream, impact_fx_list); - unpack_fx(stream, linger_fx_list); + mDo_id_convert = true; + unpack_fx(stream, mCasting_fx_list); + unpack_fx(stream, mLaunch_fx_list); + unpack_fx(stream, mDelivery_fx_list); + unpack_fx(stream, mImpact_fx_list); + unpack_fx(stream, mLinger_fx_list); } bool afxMagicSpellData::writeField(StringTableEntry fieldname, const char* value) @@ -414,25 +414,25 @@ bool afxMagicSpellData::preload(bool server, String &errorStr) // Resolve objects transmitted from server if (!server) { - if (do_id_convert) + if (mDo_id_convert) { - SimObjectId missile_id = SimObjectId((uintptr_t)missile_db); + SimObjectId missile_id = SimObjectId((uintptr_t)mMissile_db); if (missile_id != 0) { // try to convert id to pointer - if (!Sim::findObject(missile_id, missile_db)) + if (!Sim::findObject(missile_id, mMissile_db)) { Con::errorf(ConsoleLogEntry::General, "afxMagicSpellData::preload() -- bad datablockId: 0x%x (missile)", missile_id); } } - expand_fx_list(casting_fx_list, "casting"); - expand_fx_list(launch_fx_list, "launch"); - expand_fx_list(delivery_fx_list, "delivery"); - expand_fx_list(impact_fx_list, "impact"); - expand_fx_list(linger_fx_list, "linger"); - do_id_convert = false; + expand_fx_list(mCasting_fx_list, "casting"); + expand_fx_list(mLaunch_fx_list, "launch"); + expand_fx_list(mDelivery_fx_list, "delivery"); + expand_fx_list(mImpact_fx_list, "impact"); + expand_fx_list(mLinger_fx_list, "linger"); + mDo_id_convert = false; } } @@ -441,14 +441,14 @@ bool afxMagicSpellData::preload(bool server, String &errorStr) void afxMagicSpellData::gatherConstraintDefs(Vector& defs) { - afxConstraintDef::gather_cons_defs(defs, casting_fx_list); - afxConstraintDef::gather_cons_defs(defs, launch_fx_list); - afxConstraintDef::gather_cons_defs(defs, delivery_fx_list); - afxConstraintDef::gather_cons_defs(defs, impact_fx_list); - afxConstraintDef::gather_cons_defs(defs, linger_fx_list); + afxConstraintDef::gather_cons_defs(defs, mCasting_fx_list); + afxConstraintDef::gather_cons_defs(defs, mLaunch_fx_list); + afxConstraintDef::gather_cons_defs(defs, mDelivery_fx_list); + afxConstraintDef::gather_cons_defs(defs, mImpact_fx_list); + afxConstraintDef::gather_cons_defs(defs, mLinger_fx_list); - if (missile_db) - missile_db->gather_cons_defs(defs); + if (mMissile_db) + mMissile_db->gather_cons_defs(defs); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// @@ -472,7 +472,7 @@ DefineEngineMethod(afxMagicSpellData, addCastingEffect, void, (afxEffectBaseData return; } - object->casting_fx_list.push_back(effect); + object->mCasting_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addLaunchEffect, void, (afxEffectBaseData* effect),, @@ -488,7 +488,7 @@ DefineEngineMethod(afxMagicSpellData, addLaunchEffect, void, (afxEffectBaseData* return; } - object->launch_fx_list.push_back(effect); + object->mLaunch_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addDeliveryEffect, void, (afxEffectBaseData* effect),, @@ -504,7 +504,7 @@ DefineEngineMethod(afxMagicSpellData, addDeliveryEffect, void, (afxEffectBaseDat return; } - object->delivery_fx_list.push_back(effect); + object->mDelivery_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addImpactEffect, void, (afxEffectBaseData* effect),, @@ -520,7 +520,7 @@ DefineEngineMethod(afxMagicSpellData, addImpactEffect, void, (afxEffectBaseData* return; } - object->impact_fx_list.push_back(effect); + object->mImpact_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addLingerEffect, void, (afxEffectBaseData* effect),, @@ -536,7 +536,7 @@ DefineEngineMethod(afxMagicSpellData, addLingerEffect, void, (afxEffectBaseData* return; } - object->linger_fx_list.push_back(effect); + object->mLinger_fx_list.push_back(effect); } @@ -568,9 +568,9 @@ IMPLEMENT_GLOBAL_CALLBACK( onCastingEnd, void, (), (), class CastingPhrase_C : public afxPhrase { typedef afxPhrase Parent; - ShapeBase* caster; - bool notify_castbar; - F32 castbar_progress; + ShapeBase* mCaster; + bool mNotify_castbar; + F32 mCastbar_progress; public: /*C*/ CastingPhrase_C(ShapeBase* caster, bool notify_castbar); virtual void start(F32 startstamp, F32 timestamp); @@ -582,17 +582,17 @@ public: CastingPhrase_C::CastingPhrase_C(ShapeBase* c, bool notify) : afxPhrase(false, true) { - caster = c; - notify_castbar = notify; - castbar_progress = 0.0f; + mCaster = c; + mNotify_castbar = notify; + mCastbar_progress = 0.0f; } void CastingPhrase_C::start(F32 startstamp, F32 timestamp) { Parent::start(startstamp, timestamp); //START - if (notify_castbar) + if (mNotify_castbar) { - castbar_progress = 0.0f; + mCastbar_progress = 0.0f; onCastingStart_callback(); } } @@ -601,16 +601,16 @@ void CastingPhrase_C::update(F32 dt, F32 timestamp) { Parent::update(dt, timestamp); - if (!notify_castbar) + if (!mNotify_castbar) return; if (dur > 0 && n_loops > 0) { F32 nfrac = (timestamp - starttime)/(dur*n_loops); - if (nfrac - castbar_progress > 1.0f/200.0f) + if (nfrac - mCastbar_progress > 1.0f/200.0f) { - castbar_progress = (nfrac < 1.0f) ? nfrac : 1.0f; - onCastingProgressUpdate_callback(castbar_progress); + mCastbar_progress = (nfrac < 1.0f) ? nfrac : 1.0f; + onCastingProgressUpdate_callback(mCastbar_progress); } } } @@ -618,20 +618,20 @@ void CastingPhrase_C::update(F32 dt, F32 timestamp) void CastingPhrase_C::stop(F32 timestamp) { Parent::stop(timestamp); - if (notify_castbar) + if (mCastbar_progress) { onCastingEnd_callback(); - notify_castbar = false; + mNotify_castbar = false; } } void CastingPhrase_C::interrupt(F32 timestamp) { Parent::interrupt(timestamp); - if (notify_castbar) + if (mNotify_castbar) { onCastingEnd_callback(); - notify_castbar = false; + mNotify_castbar = false; } } @@ -733,25 +733,25 @@ void afxMagicSpell::init() //mNetFlags.set(Ghostable | ScopeAlways); mNetFlags.clear(Ghostable | ScopeAlways); - datablock = NULL; - exeblock = NULL; - missile_db = NULL; + mDatablock = NULL; + mExeblock = NULL; + mMissile_db = NULL; - caster = NULL; - target = NULL; + mCaster = NULL; + mTarget = NULL; - caster_field = NULL; - target_field = NULL; + mCaster_field = NULL; + mTarget_field = NULL; - caster_scope_id = 0; - target_scope_id = 0; - target_is_shape = false; + mCaster_scope_id = 0; + mTarget_scope_id = 0; + mTarget_is_shape = false; - constraints_initialized = false; - scoping_initialized = false; + mConstraints_initialized = false; + mScoping_initialized = false; - spell_state = (U8) INACTIVE_STATE; - spell_elapsed = 0; + mSpell_state = (U8) INACTIVE_STATE; + mSpell_elapsed = 0; // define named constraints constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, CASTER_CONS); @@ -764,24 +764,24 @@ void afxMagicSpell::init() for (S32 i = 0; i < NUM_PHRASES; i++) { - phrases[i] = NULL; - tfactors[i] = 1.0f; + mPhrases[i] = NULL; + mTfactors[i] = 1.0f; } - notify_castbar = false; - overall_time_factor = 1.0f; + mNotify_castbar = false; + mOverall_time_factor = 1.0f; - camera_cons_obj = 0; + mCamera_cons_obj = 0; - marks_mask = 0; + mMarks_mask = 0; - missile = NULL; - missile_is_armed = false; - impacted_obj = NULL; - impact_pos.zero(); - impact_norm.set(0,0,1); - impacted_scope_id = 0; - impacted_is_shape = false; + mMissile = NULL; + mMissile_is_armed = false; + mImpacted_obj = NULL; + mImpact_pos.zero(); + mImpact_norm.set(0,0,1); + mImpacted_scope_id = 0; + mImpacted_is_shape = false; } afxMagicSpell::afxMagicSpell() @@ -795,18 +795,18 @@ afxMagicSpell::afxMagicSpell(ShapeBase* caster, SceneObject* target) started_with_newop = false; init(); - this->caster = caster; + mCaster = caster; if (caster) { - caster_field = caster; + mCaster_field = caster; deleteNotify(caster); processAfter(caster); } - this->target = target; + mTarget = target; if (target) { - target_field = target; + mTarget_field = target; deleteNotify(target); } } @@ -815,26 +815,26 @@ afxMagicSpell::~afxMagicSpell() { for (S32 i = 0; i < NUM_PHRASES; i++) { - if (phrases[i]) + if (mPhrases[i]) { - phrases[i]->interrupt(spell_elapsed); - delete phrases[i]; + mPhrases[i]->interrupt(mSpell_elapsed); + delete mPhrases[i]; } } - if (missile) - missile->deleteObject(); + if (mMissile) + mMissile->deleteObject(); - if (missile_db && missile_db->isTempClone()) + if (mMissile_db && mMissile_db->isTempClone()) { - delete missile_db; - missile_db = 0; + delete mMissile_db; + mMissile_db = 0; } - if (datablock && datablock->isTempClone()) + if (mDatablock && mDatablock->isTempClone()) { - delete datablock; - datablock = 0; + delete mDatablock; + mDatablock = 0; } } @@ -844,8 +844,8 @@ afxMagicSpell::~afxMagicSpell() bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload) { - datablock = dynamic_cast(dptr); - if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + mDatablock = dynamic_cast(dptr); + if (!mDatablock || !Parent::onNewDataBlock(dptr, reload)) return false; if (isServerObject() && started_with_newop) @@ -855,18 +855,18 @@ bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload) assignDynamicFieldsFrom(dptr, arcaneFX::sParameterFieldPrefix, true); } - exeblock = datablock; - missile_db = datablock->missile_db; + mExeblock = mDatablock; + mMissile_db = mDatablock->mMissile_db; if (isClientObject()) { // make a temp datablock clone if there are substitutions - if (datablock->getSubstitutionCount() > 0) + if (mDatablock->getSubstitutionCount() > 0) { - afxMagicSpellData* orig_db = datablock; - datablock = new afxMagicSpellData(*orig_db, true); - exeblock = orig_db; - missile_db = datablock->missile_db; + afxMagicSpellData* orig_db = mDatablock; + mDatablock = new afxMagicSpellData(*orig_db, true); + mExeblock = orig_db; + mMissile_db = mDatablock->mMissile_db; // Don't perform substitutions yet, the spell's dynamic fields haven't // arrived yet and the substitutions may refer to them. Hold off and do // in in the onAdd() method. @@ -875,13 +875,13 @@ bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload) else if (started_with_newop) { // make a temp datablock clone if there are substitutions - if (datablock->getSubstitutionCount() > 0) + if (mDatablock->getSubstitutionCount() > 0) { - afxMagicSpellData* orig_db = datablock; - datablock = new afxMagicSpellData(*orig_db, true); - exeblock = orig_db; - orig_db->performSubstitutions(datablock, this, ranking); - missile_db = datablock->missile_db; + afxMagicSpellData* orig_db = mDatablock; + mDatablock = new afxMagicSpellData(*orig_db, true); + mExeblock = orig_db; + orig_db->performSubstitutions(mDatablock, this, ranking); + mMissile_db = mDatablock->mMissile_db; } } @@ -913,12 +913,12 @@ bool afxMagicSpell::onAdd() if (isClientObject()) { - if (datablock->isTempClone()) + if (mDatablock->isTempClone()) { - afxMagicSpellData* orig_db = (afxMagicSpellData*)exeblock; - orig_db->performSubstitutions(datablock, this, ranking); - missile_db = datablock->missile_db; - notify_castbar = (notify_castbar && (datablock->casting_dur > 0.0f)); + afxMagicSpellData* orig_db = (afxMagicSpellData*)mExeblock; + orig_db->performSubstitutions(mDatablock, this, ranking); + mMissile_db = mDatablock->mMissile_db; + mNotify_castbar = (mNotify_castbar && (mDatablock->mCasting_dur > 0.0f)); } } else if (started_with_newop && !postpone_activation) @@ -940,37 +940,37 @@ void afxMagicSpell::onDeleteNotify(SimObject* obj) { // caster deleted? ShapeBase* shape = dynamic_cast(obj); - if (shape == caster) + if (shape == mCaster) { clearProcessAfter(); - caster = NULL; - caster_field = NULL; - caster_scope_id = 0; + mCaster = NULL; + mCaster_field = NULL; + mCaster_scope_id = 0; } // target deleted? SceneObject* scene_obj = dynamic_cast(obj); - if (scene_obj == target) + if (scene_obj == mTarget) { - target = NULL; - target_field = NULL; - target_scope_id = 0; - target_is_shape = false; + mTarget = NULL; + mTarget_field = NULL; + mTarget_scope_id = 0; + mTarget_is_shape = false; } // impacted_obj deleted? - if (scene_obj == impacted_obj) + if (scene_obj == mImpacted_obj) { - impacted_obj = NULL; - impacted_scope_id = 0; - impacted_is_shape = false; + mImpacted_obj = NULL; + mImpacted_scope_id = 0; + mImpacted_is_shape = false; } // missile deleted? afxMagicMissile* missile = dynamic_cast(obj); - if (missile != NULL && missile == this->missile) + if (missile != NULL && missile == mMissile) { - this->missile = NULL; + mMissile = NULL; } // something else @@ -980,9 +980,9 @@ void afxMagicSpell::onDeleteNotify(SimObject* obj) // static void afxMagicSpell::initPersistFields() { - addField("caster", TYPEID(), Offset(caster_field, afxMagicSpell), + addField("caster", TYPEID(), Offset(mCaster_field, afxMagicSpell), "..."); - addField("target", TYPEID(), Offset(target_field, afxMagicSpell), + addField("target", TYPEID(), Offset(mTarget_field, afxMagicSpell), "..."); Parent::initPersistFields(); @@ -993,31 +993,31 @@ void afxMagicSpell::initPersistFields() void afxMagicSpell::pack_constraint_info(NetConnection* conn, BitStream* stream) { // pack caster's ghost index or scope id if not yet ghosted - if (stream->writeFlag(caster != NULL)) + if (stream->writeFlag(mCaster != NULL)) { - S32 ghost_idx = conn->getGhostIndex(caster); + S32 ghost_idx = conn->getGhostIndex(mCaster); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); else { - bool bit = (caster) ? (caster->getScopeId() > 0) : false; + bool bit = (mCaster) ? (mCaster->getScopeId() > 0) : false; if (stream->writeFlag(bit)) - stream->writeInt(caster->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeInt(mCaster->getScopeId(), NetObject::SCOPE_ID_BITS); } } // pack target's ghost index or scope id if not yet ghosted - if (stream->writeFlag(target != NULL)) + if (stream->writeFlag(mTarget != NULL)) { - S32 ghost_idx = conn->getGhostIndex(target); + S32 ghost_idx = conn->getGhostIndex(mTarget); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); else { - if (stream->writeFlag(target->getScopeId() > 0)) + if (stream->writeFlag(mTarget->getScopeId() > 0)) { - stream->writeInt(target->getScopeId(), NetObject::SCOPE_ID_BITS); - stream->writeFlag(dynamic_cast(target) != NULL); // is shape? + stream->writeInt(mTarget->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(mTarget) != NULL); // is shape? } } } @@ -1027,51 +1027,51 @@ void afxMagicSpell::pack_constraint_info(NetConnection* conn, BitStream* stream) void afxMagicSpell::unpack_constraint_info(NetConnection* conn, BitStream* stream) { - caster = NULL; - caster_field = NULL; - caster_scope_id = 0; + mCaster = NULL; + mCaster_field = NULL; + mCaster_scope_id = 0; if (stream->readFlag()) // has caster { if (stream->readFlag()) // has ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - caster = dynamic_cast(conn->resolveGhost(ghost_idx)); - if (caster) + mCaster = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (mCaster) { - caster_field = caster; - deleteNotify(caster); - processAfter(caster); + mCaster_field = mCaster; + deleteNotify(mCaster); + processAfter(mCaster); } } else { if (stream->readFlag()) // has scope_id (is always a shape) - caster_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mCaster_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); } } - target = NULL; - target_field = NULL; - target_scope_id = 0; - target_is_shape = false; + mTarget = NULL; + mTarget_field = NULL; + mTarget_scope_id = 0; + mTarget_is_shape = false; if (stream->readFlag()) // has target { if (stream->readFlag()) // has ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - target = dynamic_cast(conn->resolveGhost(ghost_idx)); - if (target) + mTarget = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (mTarget) { - target_field = target; - deleteNotify(target); + mTarget_field = mTarget; + deleteNotify(mTarget); } } else { if (stream->readFlag()) // has scope_id { - target_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); - target_is_shape = stream->readFlag(); // is shape? + mTarget_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mTarget_is_shape = stream->readFlag(); // is shape? } } } @@ -1108,12 +1108,12 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) stream->write(exec_conds_mask); // flag if this client owns the spellcaster - bool client_owns_caster = is_caster_client(caster, dynamic_cast(conn)); + bool client_owns_caster = is_caster_client(mCaster, dynamic_cast(conn)); stream->writeFlag(client_owns_caster); // pack per-phrase time-factor values for (S32 i = 0; i < NUM_PHRASES; i++) - stream->write(tfactors[i]); + stream->write(mTfactors[i]); // flag if this conn is zoned-in yet bool zoned_in = client_owns_caster; @@ -1129,10 +1129,10 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) // StateEvent or SyncEvent if (stream->writeFlag((mask & StateEventMask) || (mask & SyncEventMask))) { - stream->write(marks_mask); - stream->write(spell_state); + stream->write(mMarks_mask); + stream->write(mSpell_state); stream->write(state_elapsed()); - stream->write(spell_elapsed); + stream->write(mSpell_elapsed); } // SyncEvent @@ -1142,44 +1142,44 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) } // LaunchEvent - if (stream->writeFlag((mask & LaunchEventMask) && (marks_mask & MARK_LAUNCH) && missile)) + if (stream->writeFlag((mask & LaunchEventMask) && (mMarks_mask & MARK_LAUNCH) && mMissile)) { F32 vel; Point3F vel_vec; - missile->getStartingVelocityValues(vel, vel_vec); + mMissile->getStartingVelocityValues(vel, vel_vec); // pack launch vector and velocity stream->write(vel); mathWrite(*stream, vel_vec); } // ImpactEvent - if (stream->writeFlag(((mask & ImpactEventMask) || (mask & SyncEventMask)) && (marks_mask & MARK_IMPACT))) + if (stream->writeFlag(((mask & ImpactEventMask) || (mask & SyncEventMask)) && (mMarks_mask & MARK_IMPACT))) { // pack impact objects's ghost index or scope id if not yet ghosted - if (stream->writeFlag(impacted_obj != NULL)) + if (stream->writeFlag(mImpacted_obj != NULL)) { - S32 ghost_idx = conn->getGhostIndex(impacted_obj); + S32 ghost_idx = conn->getGhostIndex(mImpacted_obj); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); else { - if (stream->writeFlag(impacted_obj->getScopeId() > 0)) + if (stream->writeFlag(mImpacted_obj->getScopeId() > 0)) { - stream->writeInt(impacted_obj->getScopeId(), NetObject::SCOPE_ID_BITS); - stream->writeFlag(dynamic_cast(impacted_obj) != NULL); + stream->writeInt(mImpacted_obj->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(mImpacted_obj) != NULL); } } } // pack impact position and normal - mathWrite(*stream, impact_pos); - mathWrite(*stream, impact_norm); + mathWrite(*stream, mImpact_pos); + mathWrite(*stream, mImpact_norm); stream->write(exec_conds_mask); ShapeBase* temp_shape; - stream->writeFlag(caster != 0 && caster->getDamageState() == ShapeBase::Enabled); - temp_shape = dynamic_cast(target); + stream->writeFlag(mCaster != 0 && mCaster->getDamageState() == ShapeBase::Enabled); + temp_shape = dynamic_cast(mTarget); stream->writeFlag(temp_shape != 0 && temp_shape->getDamageState() == ShapeBase::Enabled); - temp_shape = dynamic_cast(impacted_obj); + temp_shape = dynamic_cast(mImpacted_obj); stream->writeFlag(temp_shape != 0 && temp_shape->getDamageState() == ShapeBase::Enabled); } @@ -1201,14 +1201,14 @@ bool afxMagicSpell::remap_builtin_constraint(SceneObject* obj, const char* cons_ return true; if (cons_name_ste == TARGET_CONS) { - if (obj && target && obj != target && !target_cons_id.undefined()) + if (obj && mTarget && obj != mTarget && !mTarget_cons_id.undefined()) { - target = obj; - constraint_mgr->setReferenceObject(target_cons_id, target); + mTarget = obj; + constraint_mgr->setReferenceObject(mTarget_cons_id, mTarget); if (isServerObject()) { - if (target->isScopeable()) - constraint_mgr->addScopeableObject(target); + if (mTarget->isScopeable()) + constraint_mgr->addScopeableObject(mTarget); } } return true; @@ -1271,11 +1271,11 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) // enable castbar updates bool client_owns_caster = stream->readFlag(); if (client_owns_caster) - notify_castbar = Con::isFunction("onCastingStart"); + mNotify_castbar = Con::isFunction("onCastingStart"); // unpack per-phrase time-factor values for (S32 i = 0; i < NUM_PHRASES; i++) - stream->read(&tfactors[i]); + stream->read(&mTfactors[i]); // if client is marked as fully zoned in if ((zoned_in = stream->readFlag()) == true) @@ -1294,7 +1294,7 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) stream->read(&new_spell_state); stream->read(&new_state_elapsed); stream->read(&new_spell_elapsed); - marks_mask = new_marks_mask; + mMarks_mask = new_marks_mask; } // SyncEvent @@ -1310,42 +1310,42 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) F32 vel; Point3F vel_vec; stream->read(&vel); mathRead(*stream, &vel_vec); - if (missile) + if (mMissile) { - missile->setStartingVelocity(vel); - missile->setStartingVelocityVector(vel_vec); + mMissile->setStartingVelocity(vel); + mMissile->setStartingVelocityVector(vel_vec); } } // ImpactEvent if (stream->readFlag()) { - if (impacted_obj) - clearNotify(impacted_obj); - impacted_obj = NULL; - impacted_scope_id = 0; - impacted_is_shape = false; + if (mImpacted_obj) + clearNotify(mImpacted_obj); + mImpacted_obj = NULL; + mImpacted_scope_id = 0; + mImpacted_is_shape = false; if (stream->readFlag()) // is impacted_obj { if (stream->readFlag()) // is ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - impacted_obj = dynamic_cast(conn->resolveGhost(ghost_idx)); - if (impacted_obj) - deleteNotify(impacted_obj); + mImpacted_obj = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (mImpacted_obj) + deleteNotify(mImpacted_obj); } else { if (stream->readFlag()) // has scope_id { - impacted_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); - impacted_is_shape = stream->readFlag(); // is shape? + mImpacted_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mImpacted_is_shape = stream->readFlag(); // is shape? } } } - mathRead(*stream, &impact_pos); - mathRead(*stream, &impact_norm); + mathRead(*stream, &mImpact_pos); + mathRead(*stream, &mImpact_norm); stream->read(&exec_conds_mask); bool caster_alive = stream->readFlag(); @@ -1353,18 +1353,18 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) bool impacted_alive = stream->readFlag(); afxConstraint* cons; - if ((cons = constraint_mgr->getConstraint(caster_cons_id)) != 0) + if ((cons = constraint_mgr->getConstraint(mCaster_cons_id)) != 0) cons->setLivingState(caster_alive); - if ((cons = constraint_mgr->getConstraint(target_cons_id)) != 0) + if ((cons = constraint_mgr->getConstraint(mTarget_cons_id)) != 0) cons->setLivingState(target_alive); - if ((cons = constraint_mgr->getConstraint(impacted_cons_id)) != 0) + if ((cons = constraint_mgr->getConstraint(mImpacted_cons_id)) != 0) cons->setLivingState(impacted_alive); } //~~~~~~~~~~~~~~~~~~~~// if (!zoned_in) - spell_state = LATE_STATE; + mSpell_state = LATE_STATE; // need to adjust state info to get all synced up with spell on server if (do_sync_event && !initial_update) @@ -1383,23 +1383,23 @@ bool afxMagicSpell::state_expired() { afxPhrase* phrase = NULL; - switch (spell_state) + switch (mSpell_state) { case CASTING_STATE: - phrase = phrases[CASTING_PHRASE]; + phrase = mPhrases[CASTING_PHRASE]; break; case DELIVERY_STATE: - phrase = phrases[DELIVERY_PHRASE]; + phrase = mPhrases[DELIVERY_PHRASE]; break; case LINGER_STATE: - phrase = phrases[LINGER_PHRASE]; + phrase = mPhrases[LINGER_PHRASE]; break; } if (phrase) { - if (phrase->expired(spell_elapsed)) - return (!phrase->recycle(spell_elapsed)); + if (phrase->expired(mSpell_elapsed)) + return (!phrase->recycle(mSpell_elapsed)); return false; } @@ -1410,83 +1410,83 @@ F32 afxMagicSpell::state_elapsed() { afxPhrase* phrase = NULL; - switch (spell_state) + switch (mSpell_state) { case CASTING_STATE: - phrase = phrases[CASTING_PHRASE]; + phrase = mPhrases[CASTING_PHRASE]; break; case DELIVERY_STATE: - phrase = phrases[DELIVERY_PHRASE]; + phrase = mPhrases[DELIVERY_PHRASE]; break; case LINGER_STATE: - phrase = phrases[LINGER_PHRASE]; + phrase = mPhrases[LINGER_PHRASE]; break; } - return (phrase) ? phrase->elapsed(spell_elapsed) : 0.0f; + return (phrase) ? phrase->elapsed(mSpell_elapsed) : 0.0f; } void afxMagicSpell::init_constraints() { - if (constraints_initialized) + if (mConstraints_initialized) { //Con::printf("CONSTRAINTS ALREADY INITIALIZED"); return; } Vector defs; - datablock->gatherConstraintDefs(defs); + mDatablock->gatherConstraintDefs(defs); constraint_mgr->initConstraintDefs(defs, isServerObject()); if (isServerObject()) { - caster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, caster); - target_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, target); + mCaster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, mCaster); + mTarget_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, mTarget); #if defined(AFX_CAP_SCOPE_TRACKING) - if (caster && caster->isScopeable()) - constraint_mgr->addScopeableObject(caster); + if (mCaster && mCaster->isScopeable()) + constraint_mgr->addScopeableObject(mCaster); - if (target && target->isScopeable()) - constraint_mgr->addScopeableObject(target); + if (mTarget && mTarget->isScopeable()) + constraint_mgr->addScopeableObject(mTarget); #endif // find local camera - camera_cons_obj = get_camera(); - if (camera_cons_obj) - camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + mCamera_cons_obj = get_camera(); + if (mCamera_cons_obj) + mCamera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, mCamera_cons_obj); } else // if (isClientObject()) { - if (caster) - caster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, caster); - else if (caster_scope_id > 0) - caster_cons_id = constraint_mgr->setReferenceObjectByScopeId(CASTER_CONS, caster_scope_id, true); + if (mCaster) + mCaster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, mCaster); + else if (mCaster_scope_id > 0) + mCaster_cons_id = constraint_mgr->setReferenceObjectByScopeId(CASTER_CONS, mCaster_scope_id, true); - if (target) - target_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, target); - else if (target_scope_id > 0) - target_cons_id = constraint_mgr->setReferenceObjectByScopeId(TARGET_CONS, target_scope_id, target_is_shape); + if (mTarget) + mTarget_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, mTarget); + else if (mTarget_scope_id > 0) + mTarget_cons_id = constraint_mgr->setReferenceObjectByScopeId(TARGET_CONS, mTarget_scope_id, mTarget_is_shape); // find local camera - camera_cons_obj = get_camera(); - if (camera_cons_obj) - camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + mCamera_cons_obj = get_camera(); + if (mCamera_cons_obj) + mCamera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, mCamera_cons_obj); // find local listener Point3F listener_pos; listener_pos = SFX->getListener().getTransform().getPosition(); - listener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos); + mListener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos); } constraint_mgr->adjustProcessOrdering(this); - constraints_initialized = true; + mConstraints_initialized = true; } void afxMagicSpell::init_scoping() { - if (scoping_initialized) + if (mScoping_initialized) { //Con::printf("SCOPING ALREADY INITIALIZED"); return; @@ -1504,65 +1504,65 @@ void afxMagicSpell::init_scoping() mNetFlags.set(Ghostable); setScopeAlways(); } - scoping_initialized = true; + mScoping_initialized = true; } } void afxMagicSpell::setup_casting_fx() { if (isServerObject()) - phrases[CASTING_PHRASE] = new afxPhrase(isServerObject(), true); + mPhrases[CASTING_PHRASE] = new afxPhrase(isServerObject(), true); else - phrases[CASTING_PHRASE] = new CastingPhrase_C(caster, notify_castbar); + mPhrases[CASTING_PHRASE] = new CastingPhrase_C(mCaster, mNotify_castbar); - if (phrases[CASTING_PHRASE]) - phrases[CASTING_PHRASE]->init(datablock->casting_fx_list, datablock->casting_dur, this, - tfactors[CASTING_PHRASE], datablock->n_casting_loops, 0, - datablock->extra_casting_time); + if (mPhrases[CASTING_PHRASE]) + mPhrases[CASTING_PHRASE]->init(mDatablock->mCasting_fx_list, mDatablock->mCasting_dur, this, + mTfactors[CASTING_PHRASE], mDatablock->mNum_casting_loops, 0, + mDatablock->mExtra_casting_time); } void afxMagicSpell::setup_launch_fx() { - phrases[LAUNCH_PHRASE] = new afxPhrase(isServerObject(), false); - if (phrases[LAUNCH_PHRASE]) - phrases[LAUNCH_PHRASE]->init(datablock->launch_fx_list, -1, this, - tfactors[LAUNCH_PHRASE], 1); + mPhrases[LAUNCH_PHRASE] = new afxPhrase(isServerObject(), false); + if (mPhrases[LAUNCH_PHRASE]) + mPhrases[LAUNCH_PHRASE]->init(mDatablock->mLaunch_fx_list, -1, this, + mTfactors[LAUNCH_PHRASE], 1); } void afxMagicSpell::setup_delivery_fx() { - phrases[DELIVERY_PHRASE] = new afxPhrase(isServerObject(), true); - if (phrases[DELIVERY_PHRASE]) + mPhrases[DELIVERY_PHRASE] = new afxPhrase(isServerObject(), true); + if (mPhrases[DELIVERY_PHRASE]) { - phrases[DELIVERY_PHRASE]->init(datablock->delivery_fx_list, datablock->delivery_dur, this, - tfactors[DELIVERY_PHRASE], datablock->n_delivery_loops, 0, - datablock->extra_delivery_time); + mPhrases[DELIVERY_PHRASE]->init(mDatablock->mDelivery_fx_list, mDatablock->mDelivery_dur, this, + mTfactors[DELIVERY_PHRASE], mDatablock->mNum_delivery_loops, 0, + mDatablock->mExtra_delivery_time); } } void afxMagicSpell::setup_impact_fx() { - phrases[IMPACT_PHRASE] = new afxPhrase(isServerObject(), false); - if (phrases[IMPACT_PHRASE]) + mPhrases[IMPACT_PHRASE] = new afxPhrase(isServerObject(), false); + if (mPhrases[IMPACT_PHRASE]) { - phrases[IMPACT_PHRASE]->init(datablock->impact_fx_list, -1, this, - tfactors[IMPACT_PHRASE], 1); + mPhrases[IMPACT_PHRASE]->init(mDatablock->mImpact_fx_list, -1, this, + mTfactors[IMPACT_PHRASE], 1); } } void afxMagicSpell::setup_linger_fx() { - phrases[LINGER_PHRASE] = new afxPhrase(isServerObject(), true); - if (phrases[LINGER_PHRASE]) - phrases[LINGER_PHRASE]->init(datablock->linger_fx_list, datablock->linger_dur, this, - tfactors[LINGER_PHRASE], datablock->n_linger_loops, 0, - datablock->extra_linger_time); + mPhrases[LINGER_PHRASE] = new afxPhrase(isServerObject(), true); + if (mPhrases[LINGER_PHRASE]) + mPhrases[LINGER_PHRASE]->init(mDatablock->mLinger_fx_list, mDatablock->mLinger_dur, this, + mTfactors[LINGER_PHRASE], mDatablock->mNum_linger_loops, 0, + mDatablock->mExtra_linger_time); } bool afxMagicSpell::cleanup_over() { for (S32 i = 0; i < NUM_PHRASES; i++) - if (phrases[i] && !phrases[i]->isEmpty()) + if (mPhrases[i] && !mPhrases[i]->isEmpty()) return false; return true; @@ -1576,67 +1576,67 @@ bool afxMagicSpell::cleanup_over() void afxMagicSpell::init_missile_s(afxMagicMissileData* mm_db) { - if (missile) - clearNotify(missile); + if (mMissile) + clearNotify(mMissile); // create the missile - missile = new afxMagicMissile(true, false); - missile->setSubstitutionData(this, ranking); - missile->setDataBlock(mm_db); - missile->setChoreographer(this); - if (!missile->registerObject()) + mMissile = new afxMagicMissile(true, false); + mMissile->setSubstitutionData(this, ranking); + mMissile->setDataBlock(mm_db); + mMissile->setChoreographer(this); + if (!mMissile->registerObject()) { Con::errorf("afxMagicSpell: failed to register missile instance."); - delete missile; - missile = NULL; + delete mMissile; + mMissile = NULL; } - if (missile) + if (mMissile) { - deleteNotify(missile); - registerForCleanup(missile); + deleteNotify(mMissile); + registerForCleanup(mMissile); } } void afxMagicSpell::launch_missile_s() { - if (missile) + if (mMissile) { - missile->launch(); - constraint_mgr->setReferenceObject(MISSILE_CONS, missile); + mMissile->launch(); + constraint_mgr->setReferenceObject(MISSILE_CONS, mMissile); } } void afxMagicSpell::init_missile_c(afxMagicMissileData* mm_db) { - if (missile) - clearNotify(missile); + if (mMissile) + clearNotify(mMissile); // create the missile - missile = new afxMagicMissile(false, true); - missile->setSubstitutionData(this, ranking); - missile->setDataBlock(mm_db); - missile->setChoreographer(this); - if (!missile->registerObject()) + mMissile = new afxMagicMissile(false, true); + mMissile->setSubstitutionData(this, ranking); + mMissile->setDataBlock(mm_db); + mMissile->setChoreographer(this); + if (!mMissile->registerObject()) { Con::errorf("afxMagicSpell: failed to register missile instance."); - delete missile; - missile = NULL; + delete mMissile; + mMissile = NULL; } - if (missile) + if (mMissile) { - deleteNotify(missile); - registerForCleanup(missile); + deleteNotify(mMissile); + registerForCleanup(mMissile); } } void afxMagicSpell::launch_missile_c() { - if (missile) + if (mMissile) { - missile->launch(); - constraint_mgr->setReferenceObject(MISSILE_CONS, missile); + mMissile->launch(); + constraint_mgr->setReferenceObject(MISSILE_CONS, mMissile); } } @@ -1652,19 +1652,19 @@ void afxMagicSpell::impactNotify(const Point3F& p, const Point3F& n, SceneObject return; ///impact_time_ms = spell_elapsed_ms; - if (impacted_obj) - clearNotify(impacted_obj); - impacted_obj = obj; - impact_pos = p; - impact_norm = n; + if (mImpacted_obj) + clearNotify(mImpacted_obj); + mImpacted_obj = obj; + mImpact_pos = p; + mImpact_norm = n; - if (impacted_obj != NULL) + if (mImpacted_obj != NULL) { - deleteNotify(impacted_obj); + deleteNotify(mImpacted_obj); exec_conds_mask |= IMPACTED_SOMETHING; - if (impacted_obj == target) + if (mImpacted_obj == mTarget) exec_conds_mask |= IMPACTED_TARGET; - if (impacted_obj->getTypeMask() & datablock->primary_target_types) + if (mImpacted_obj->getTypeMask() & mDatablock->mPrimary_target_types) exec_conds_mask |= IMPACTED_PRIMARY; } @@ -1673,9 +1673,9 @@ void afxMagicSpell::impactNotify(const Point3F& p, const Point3F& n, SceneObject postSpellEvent(IMPACT_EVENT); - if (missile) - clearNotify(missile); - missile = NULL; + if (mMissile) + clearNotify(mMissile); + mMissile = NULL; } void afxMagicSpell::executeScriptEvent(const char* method, afxConstraint* cons, @@ -1692,9 +1692,9 @@ void afxMagicSpell::executeScriptEvent(const char* method, afxConstraint* cons, aa.axis.x, aa.axis.y, aa.axis.z, aa.angle); // CALL SCRIPT afxChoreographerData::method(%spell, %caster, %constraint, %transform, %data) - Con::executef(exeblock, method, + Con::executef(mExeblock, method, getIdString(), - (caster) ? caster->getIdString() : "", + (mCaster) ? mCaster->getIdString() : "", (cons_obj) ? cons_obj->getIdString() : "", arg_buf, data); @@ -1709,7 +1709,7 @@ void afxMagicSpell::inflictDamage(const char * label, const char* flavor, SimObj // CALL SCRIPT afxMagicSpellData::onDamage() // onDamage(%spell, %label, %type, %damaged_obj, %amount, %count, %pos, %ad_amount, // %radius, %impulse) - datablock->onDamage_callback(this, label, flavor, target_id, amount, n, pos, ad_amount, radius, impulse); + mDatablock->onDamage_callback(this, label, flavor, target_id, amount, n, pos, ad_amount, radius, impulse); } @@ -1718,68 +1718,68 @@ void afxMagicSpell::inflictDamage(const char * label, const char* flavor, SimObj void afxMagicSpell::process_server() { - if (spell_state != INACTIVE_STATE) - spell_elapsed += TickSec; + if (mSpell_state != INACTIVE_STATE) + mSpell_elapsed += TickSec; - U8 pending_state = spell_state; + U8 pending_state = mSpell_state; // check for state changes - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: - if (marks_mask & MARK_ACTIVATE) + if (mMarks_mask & MARK_ACTIVATE) pending_state = CASTING_STATE; break; case CASTING_STATE: - if (datablock->casting_dur > 0.0f && datablock->do_move_interrupts && is_caster_moving()) + if (mDatablock->mCasting_dur > 0.0f && mDatablock->mDo_move_interrupts && is_caster_moving()) { - displayScreenMessage(caster, "SPELL INTERRUPTED."); + displayScreenMessage(mCaster, "SPELL INTERRUPTED."); postSpellEvent(INTERRUPT_SPELL_EVENT); } - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_CASTING) + else if (mMarks_mask & MARK_END_CASTING) pending_state = DELIVERY_STATE; - else if (marks_mask & MARK_LAUNCH) + else if (mMarks_mask & MARK_LAUNCH) pending_state = DELIVERY_STATE; else if (state_expired()) pending_state = DELIVERY_STATE; break; case DELIVERY_STATE: - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_DELIVERY) + else if (mMarks_mask & MARK_END_DELIVERY) pending_state = LINGER_STATE; - else if (marks_mask & MARK_IMPACT) + else if (mMarks_mask & MARK_IMPACT) pending_state = LINGER_STATE; else if (state_expired()) pending_state = LINGER_STATE; break; case LINGER_STATE: - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_LINGER) + else if (mMarks_mask & MARK_END_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_SHUTDOWN) + else if (mMarks_mask & MARK_SHUTDOWN) pending_state = CLEANUP_STATE; else if (state_expired()) pending_state = CLEANUP_STATE; break; case CLEANUP_STATE: - if ((marks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) + if ((mMarks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) pending_state = DONE_STATE; break; } - if (spell_state != pending_state) + if (mSpell_state != pending_state) change_state_s(pending_state); - if (spell_state == INACTIVE_STATE) + if (mSpell_state == INACTIVE_STATE) return; //--------------------------// @@ -1788,23 +1788,23 @@ void afxMagicSpell::process_server() constraint_mgr->sample(TickSec, Platform::getVirtualMilliseconds()); for (S32 i = 0; i < NUM_PHRASES; i++) - if (phrases[i]) - phrases[i]->update(TickSec, spell_elapsed); + if (mPhrases[i]) + mPhrases[i]->update(TickSec, mSpell_elapsed); - if (missile_is_armed) + if (mMissile_is_armed) { launch_missile_s(); - missile_is_armed = false; + mMissile_is_armed = false; } } void afxMagicSpell::change_state_s(U8 pending_state) { - if (spell_state == pending_state) + if (mSpell_state == pending_state) return; // LEAVING THIS STATE - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: break; @@ -1823,7 +1823,7 @@ void afxMagicSpell::change_state_s(U8 pending_state) break; } - spell_state = pending_state; + mSpell_state = pending_state; // ENTERING THIS STATE switch (pending_state) @@ -1851,29 +1851,29 @@ void afxMagicSpell::enter_done_state_s() { postSpellEvent(DEACTIVATE_EVENT); - if (marks_mask & MARK_INTERRUPTS) + if (mMarks_mask & MARK_INTERRUPTS) { Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + 500); } else { - F32 done_time = spell_elapsed; + F32 done_time = mSpell_elapsed; for (S32 i = 0; i < NUM_PHRASES; i++) { - if (phrases[i]) + if (mPhrases[i]) { F32 phrase_done; - if (phrases[i]->willStop() && phrases[i]->isInfinite()) - phrase_done = spell_elapsed + phrases[i]->calcAfterLife(); + if (mPhrases[i]->willStop() && mPhrases[i]->isInfinite()) + phrase_done = mSpell_elapsed + mPhrases[i]->calcAfterLife(); else - phrase_done = phrases[i]->calcDoneTime(); + phrase_done = mPhrases[i]->calcDoneTime(); if (phrase_done > done_time) done_time = phrase_done; } } - F32 time_left = done_time - spell_elapsed; + F32 time_left = done_time - mSpell_elapsed; if (time_left < 0) time_left = 0; @@ -1881,7 +1881,7 @@ void afxMagicSpell::enter_done_state_s() } // CALL SCRIPT afxMagicSpellData::onDeactivate(%spell) - datablock->onDeactivate_callback(this); + mDatablock->onDeactivate_callback(this); } void afxMagicSpell::enter_casting_state_s() @@ -1891,90 +1891,90 @@ void afxMagicSpell::enter_casting_state_s() // stamp constraint-mgr starting time and reset spell timer constraint_mgr->setStartTime(Platform::getVirtualMilliseconds()); - spell_elapsed = 0; + mSpell_elapsed = 0; setup_dynamic_constraints(); // start casting effects setup_casting_fx(); - if (phrases[CASTING_PHRASE]) - phrases[CASTING_PHRASE]->start(spell_elapsed, spell_elapsed); + if (mPhrases[CASTING_PHRASE]) + mPhrases[CASTING_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); // initialize missile - if (missile_db) + if (mMissile_db) { - missile_db = missile_db->cloneAndPerformSubstitutions(this, ranking); - init_missile_s(missile_db); + mMissile_db = mMissile_db->cloneAndPerformSubstitutions(this, ranking); + init_missile_s(mMissile_db); } } void afxMagicSpell::leave_casting_state_s() { - if (phrases[CASTING_PHRASE]) + if (mPhrases[CASTING_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) { //Con::printf("INTERRUPT CASTING (S)"); - phrases[CASTING_PHRASE]->interrupt(spell_elapsed); + mPhrases[CASTING_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING CASTING (S)"); - phrases[CASTING_PHRASE]->stop(spell_elapsed); + mPhrases[CASTING_PHRASE]->stop(mSpell_elapsed); } } - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) { // CALL SCRIPT afxMagicSpellData::onInterrupt(%spell, %caster) - datablock->onInterrupt_callback(this, caster); + mDatablock->onInterrupt_callback(this, mCaster); } } void afxMagicSpell::enter_delivery_state_s() { // CALL SCRIPT afxMagicSpellData::onLaunch(%spell, %caster, %target, %missile) - datablock->onLaunch_callback(this, caster, target, missile); + mDatablock->onLaunch_callback(this, mCaster, mTarget, mMissile); - if (datablock->launch_on_server_signal) + if (mDatablock->mLaunch_on_server_signal) postSpellEvent(LAUNCH_EVENT); - missile_is_armed = true; + mMissile_is_armed = true; // start launch effects setup_launch_fx(); - if (phrases[LAUNCH_PHRASE]) - phrases[LAUNCH_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[LAUNCH_PHRASE]) + mPhrases[LAUNCH_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START // start delivery effects setup_delivery_fx(); - if (phrases[DELIVERY_PHRASE]) - phrases[DELIVERY_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[DELIVERY_PHRASE]) + mPhrases[DELIVERY_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START } void afxMagicSpell::leave_delivery_state_s() { - if (phrases[DELIVERY_PHRASE]) + if (mPhrases[DELIVERY_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) { //Con::printf("INTERRUPT DELIVERY (S)"); - phrases[DELIVERY_PHRASE]->interrupt(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING DELIVERY (S)"); - phrases[DELIVERY_PHRASE]->stop(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->stop(mSpell_elapsed); } } - if (!missile && !(marks_mask & MARK_IMPACT)) + if (!mMissile && !(mMarks_mask & MARK_IMPACT)) { - if (target) + if (mTarget) { - Point3F p = afxMagicSpell::getShapeImpactPos(target); + Point3F p = afxMagicSpell::getShapeImpactPos(mTarget); Point3F n = Point3F(0,0,1); - impactNotify(p, n, target); + impactNotify(p, n, mTarget); } else { @@ -1987,57 +1987,57 @@ void afxMagicSpell::leave_delivery_state_s() void afxMagicSpell::enter_linger_state_s() { - if (impacted_obj) + if (mImpacted_obj) { - impacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, impacted_obj); + mImpacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, mImpacted_obj); #if defined(AFX_CAP_SCOPE_TRACKING) - if (impacted_obj->isScopeable()) - constraint_mgr->addScopeableObject(impacted_obj); + if (mImpacted_obj->isScopeable()) + constraint_mgr->addScopeableObject(mImpacted_obj); #endif } else - constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, impact_pos, impact_norm); - constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, mImpact_pos, mImpact_norm); + constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, mImpact_pos, mImpact_norm); constraint_mgr->setReferenceObject(MISSILE_CONS, 0); // start impact effects setup_impact_fx(); - if (phrases[IMPACT_PHRASE]) - phrases[IMPACT_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[IMPACT_PHRASE]) + mPhrases[IMPACT_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START // start linger effects setup_linger_fx(); - if (phrases[LINGER_PHRASE]) - phrases[LINGER_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[LINGER_PHRASE]) + mPhrases[LINGER_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START #if 0 // code temporarily replaced with old callback technique in order to avoid engine bug. // CALL SCRIPT afxMagicSpellData::onImpact(%spell, %caster, %impactedObj, %impactedPos, %impactedNorm) - datablock->onImpact_callback(this, caster, impacted_obj, impact_pos, impact_norm); + mDatablock->onImpact_callback(this, mCaster, mImpacted_obj, mImpact_pos, mImpact_norm); #else char pos_buf[128]; - dSprintf(pos_buf, sizeof(pos_buf), "%g %g %g", impact_pos.x, impact_pos.y, impact_pos.z); + dSprintf(pos_buf, sizeof(pos_buf), "%g %g %g", mImpact_pos.x, mImpact_pos.y, mImpact_pos.z); char norm_buf[128]; - dSprintf(norm_buf, sizeof(norm_buf), "%g %g %g", impact_norm.x, impact_norm.y, impact_norm.z); - Con::executef(exeblock, "onImpact", getIdString(), - (caster) ? caster->getIdString(): "", - (impacted_obj) ? impacted_obj->getIdString(): "", + dSprintf(norm_buf, sizeof(norm_buf), "%g %g %g", mImpact_norm.x, mImpact_norm.y, mImpact_norm.z); + Con::executef(mExeblock, "onImpact", getIdString(), + (mCaster) ? mCaster->getIdString(): "", + (mImpacted_obj) ? mImpacted_obj->getIdString(): "", pos_buf, norm_buf); #endif } void afxMagicSpell::leave_linger_state_s() { - if (phrases[LINGER_PHRASE]) + if (mPhrases[LINGER_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) { //Con::printf("INTERRUPT LINGER (S)"); - phrases[LINGER_PHRASE]->interrupt(spell_elapsed); + mPhrases[LINGER_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING LINGER (S)"); - phrases[LINGER_PHRASE]->stop(spell_elapsed); + mPhrases[LINGER_PHRASE]->stop(mSpell_elapsed); } } } @@ -2049,25 +2049,25 @@ void afxMagicSpell::leave_linger_state_s() void afxMagicSpell::process_client(F32 dt) { - spell_elapsed += dt; //SPELL_ELAPSED + mSpell_elapsed += dt; //SPELL_ELAPSED - U8 pending_state = spell_state; + U8 pending_state = mSpell_state; // check for state changes - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: - if (marks_mask & MARK_ACTIVATE) + if (mMarks_mask & MARK_ACTIVATE) pending_state = CASTING_STATE; break; case CASTING_STATE: - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_CASTING) + else if (mMarks_mask & MARK_END_CASTING) pending_state = DELIVERY_STATE; - else if (datablock->launch_on_server_signal) + else if (mDatablock->mLaunch_on_server_signal) { - if (marks_mask & MARK_LAUNCH) + if (mMarks_mask & MARK_LAUNCH) pending_state = DELIVERY_STATE; } else @@ -2077,45 +2077,45 @@ void afxMagicSpell::process_client(F32 dt) } break; case DELIVERY_STATE: - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_DELIVERY) + else if (mMarks_mask & MARK_END_DELIVERY) pending_state = LINGER_STATE; - else if (marks_mask & MARK_IMPACT) + else if (mMarks_mask & MARK_IMPACT) pending_state = LINGER_STATE; else state_expired(); break; case LINGER_STATE: - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_LINGER) + else if (mMarks_mask & MARK_END_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_SHUTDOWN) + else if (mMarks_mask & MARK_SHUTDOWN) pending_state = CLEANUP_STATE; else if (state_expired()) pending_state = CLEANUP_STATE; break; case CLEANUP_STATE: - if ((marks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) + if ((mMarks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) pending_state = DONE_STATE; break; } - if (spell_state != pending_state) + if (mSpell_state != pending_state) change_state_c(pending_state); - if (spell_state == INACTIVE_STATE) + if (mSpell_state == INACTIVE_STATE) return; //--------------------------// // update the listener constraint position - if (!listener_cons_id.undefined()) + if (!mListener_cons_id.undefined()) { Point3F listener_pos; listener_pos = SFX->getListener().getTransform().getPosition(); - constraint_mgr->setReferencePoint(listener_cons_id, listener_pos); + constraint_mgr->setReferencePoint(mListener_cons_id, listener_pos); } // find local camera position @@ -2123,10 +2123,10 @@ void afxMagicSpell::process_client(F32 dt) SceneObject* current_cam = get_camera(&cam_pos); // detect camera changes - if (!camera_cons_id.undefined() && current_cam != camera_cons_obj) + if (!mCamera_cons_id.undefined() && current_cam != mCamera_cons_obj) { - constraint_mgr->setReferenceObject(camera_cons_id, current_cam); - camera_cons_obj = current_cam; + constraint_mgr->setReferenceObject(mCamera_cons_id, current_cam); + mCamera_cons_obj = current_cam; } // sample the constraints @@ -2134,23 +2134,23 @@ void afxMagicSpell::process_client(F32 dt) // update active effects lists for (S32 i = 0; i < NUM_PHRASES; i++) - if (phrases[i]) - phrases[i]->update(dt, spell_elapsed); + if (mPhrases[i]) + mPhrases[i]->update(dt, mSpell_elapsed); - if (missile_is_armed) + if (mMissile_is_armed) { launch_missile_c(); - missile_is_armed = false; + mMissile_is_armed = false; } } void afxMagicSpell::change_state_c(U8 pending_state) { - if (spell_state == pending_state) + if (mSpell_state == pending_state) return; // LEAVING THIS STATE - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: break; @@ -2169,7 +2169,7 @@ void afxMagicSpell::change_state_c(U8 pending_state) break; } - spell_state = pending_state; + mSpell_state = pending_state; // ENTERING THIS STATE switch (pending_state) @@ -2177,13 +2177,13 @@ void afxMagicSpell::change_state_c(U8 pending_state) case INACTIVE_STATE: break; case CASTING_STATE: - enter_casting_state_c(spell_elapsed); + enter_casting_state_c(mSpell_elapsed); break; case DELIVERY_STATE: - enter_delivery_state_c(spell_elapsed); + enter_delivery_state_c(mSpell_elapsed); break; case LINGER_STATE: - enter_linger_state_c(spell_elapsed); + enter_linger_state_c(mSpell_elapsed); break; case CLEANUP_STATE: break; @@ -2195,113 +2195,113 @@ void afxMagicSpell::change_state_c(U8 pending_state) void afxMagicSpell::enter_casting_state_c(F32 starttime) { // stamp constraint-mgr starting time - constraint_mgr->setStartTime(Platform::getVirtualMilliseconds() - (U32)(spell_elapsed*1000)); + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds() - (U32)(mSpell_elapsed *1000)); //spell_elapsed = 0; //SPELL_ELAPSED setup_dynamic_constraints(); // start casting effects and castbar setup_casting_fx(); - if (phrases[CASTING_PHRASE]) - phrases[CASTING_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[CASTING_PHRASE]) + mPhrases[CASTING_PHRASE]->start(starttime, mSpell_elapsed); //START // initialize missile - if (missile_db) + if (mMissile_db) { - missile_db = missile_db->cloneAndPerformSubstitutions(this, ranking); - init_missile_c(missile_db); + mMissile_db = mMissile_db->cloneAndPerformSubstitutions(this, ranking); + init_missile_c(mMissile_db); } } void afxMagicSpell::leave_casting_state_c() { - if (phrases[CASTING_PHRASE]) + if (mPhrases[CASTING_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) { //Con::printf("INTERRUPT CASTING (C)"); - phrases[CASTING_PHRASE]->interrupt(spell_elapsed); + mPhrases[CASTING_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING CASTING (C)"); - phrases[CASTING_PHRASE]->stop(spell_elapsed); + mPhrases[CASTING_PHRASE]->stop(mSpell_elapsed); } } } void afxMagicSpell::enter_delivery_state_c(F32 starttime) { - missile_is_armed = true; + mMissile_is_armed = true; setup_launch_fx(); - if (phrases[LAUNCH_PHRASE]) - phrases[LAUNCH_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[LAUNCH_PHRASE]) + mPhrases[LAUNCH_PHRASE]->start(starttime, mSpell_elapsed); //START setup_delivery_fx(); - if (phrases[DELIVERY_PHRASE]) - phrases[DELIVERY_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[DELIVERY_PHRASE]) + mPhrases[DELIVERY_PHRASE]->start(starttime, mSpell_elapsed); //START } void afxMagicSpell::leave_delivery_state_c() { - if (missile) + if (mMissile) { - clearNotify(missile); - missile->deleteObject(); - missile = NULL; + clearNotify(mMissile); + mMissile->deleteObject(); + mMissile = NULL; } - if (phrases[DELIVERY_PHRASE]) + if (mPhrases[DELIVERY_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) { //Con::printf("INTERRUPT DELIVERY (C)"); - phrases[DELIVERY_PHRASE]->interrupt(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING DELIVERY (C)"); - phrases[DELIVERY_PHRASE]->stop(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->stop(mSpell_elapsed); } } } void afxMagicSpell::enter_linger_state_c(F32 starttime) { - if (impacted_obj) - impacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, impacted_obj); - else if (impacted_scope_id > 0) - impacted_cons_id = constraint_mgr->setReferenceObjectByScopeId(IMPACTED_OBJECT_CONS, impacted_scope_id, impacted_is_shape); + if (mImpacted_obj) + mImpacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, mImpacted_obj); + else if (mImpacted_scope_id > 0) + mImpacted_cons_id = constraint_mgr->setReferenceObjectByScopeId(IMPACTED_OBJECT_CONS, mImpacted_scope_id, mImpacted_is_shape); else - constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, impact_pos, impact_norm); - constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, mImpact_pos, mImpact_norm); + constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, mImpact_pos, mImpact_norm); constraint_mgr->setReferenceObject(MISSILE_CONS, 0); setup_impact_fx(); - if (phrases[IMPACT_PHRASE]) - phrases[IMPACT_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[IMPACT_PHRASE]) + mPhrases[IMPACT_PHRASE]->start(starttime, mSpell_elapsed); //START setup_linger_fx(); - if (phrases[LINGER_PHRASE]) + if (mPhrases[LINGER_PHRASE]) { - phrases[LINGER_PHRASE]->start(starttime, spell_elapsed); //START + mPhrases[LINGER_PHRASE]->start(starttime, mSpell_elapsed); //START } } void afxMagicSpell::leave_linger_state_c() { - if (phrases[LINGER_PHRASE]) + if (mPhrases[LINGER_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) { //Con::printf("INTERRUPT LINGER (C)"); - phrases[LINGER_PHRASE]->interrupt(spell_elapsed); + mPhrases[LINGER_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING LINGER (C)"); - phrases[LINGER_PHRASE]->stop(spell_elapsed); + mPhrases[LINGER_PHRASE]->stop(mSpell_elapsed); } } } @@ -2312,15 +2312,15 @@ void afxMagicSpell::sync_client(U16 marks, U8 state, F32 elapsed, F32 spell_elap // marks, name_from_state(spell_state), name_from_state(state), elapsed, // spell_elapsed); - if (spell_state != LATE_STATE) + if (mSpell_state != LATE_STATE) return; - marks_mask = marks; + mMarks_mask = marks; // don't want to be started on late zoning clients - if (!datablock->exec_on_new_clients) + if (!mDatablock->exec_on_new_clients) { - spell_state = DONE_STATE; + mSpell_state = DONE_STATE; } // it looks like we're ghosting pretty late and @@ -2328,31 +2328,31 @@ void afxMagicSpell::sync_client(U16 marks, U8 state, F32 elapsed, F32 spell_elap else if ((marks & (MARK_INTERRUPTS | MARK_DEACTIVATE | MARK_SHUTDOWN)) || (((marks & MARK_IMPACT) || (marks & MARK_END_DELIVERY)) && (marks & MARK_END_LINGER))) { - spell_state = DONE_STATE; + mSpell_state = DONE_STATE; } // it looks like we should be in the linger state. else if ((marks & MARK_IMPACT) || (((marks & MARK_LAUNCH) || (marks & MARK_END_CASTING)) && (marks & MARK_END_DELIVERY))) { - spell_state = LINGER_STATE; - this->spell_elapsed = spell_elapsed; + mSpell_state = LINGER_STATE; + mSpell_elapsed = spell_elapsed; enter_linger_state_c(spell_elapsed-elapsed); } // it looks like we should be in the delivery state. else if ((marks & MARK_LAUNCH) || (marks & MARK_END_CASTING)) { - spell_state = DELIVERY_STATE; - this->spell_elapsed = spell_elapsed; + mSpell_state = DELIVERY_STATE; + mSpell_elapsed = spell_elapsed; enter_delivery_state_c(spell_elapsed-elapsed); } // it looks like we should be in the casting state. else if (marks & MARK_ACTIVATE) { - spell_state = CASTING_STATE; //SPELL_STATE - this->spell_elapsed = spell_elapsed; + mSpell_state = CASTING_STATE; //SPELL_STATE + mSpell_elapsed = spell_elapsed; enter_casting_state_c(spell_elapsed-elapsed); } } @@ -2367,39 +2367,39 @@ void afxMagicSpell::postSpellEvent(U8 event) switch (event) { case ACTIVATE_EVENT: - marks_mask |= MARK_ACTIVATE; + mMarks_mask |= MARK_ACTIVATE; break; case LAUNCH_EVENT: - marks_mask |= MARK_LAUNCH; + mMarks_mask |= MARK_LAUNCH; setMaskBits(LaunchEventMask); break; case IMPACT_EVENT: - marks_mask |= MARK_IMPACT; + mMarks_mask |= MARK_IMPACT; setMaskBits(ImpactEventMask); break; case SHUTDOWN_EVENT: - marks_mask |= MARK_SHUTDOWN; + mMarks_mask |= MARK_SHUTDOWN; break; case DEACTIVATE_EVENT: - marks_mask |= MARK_DEACTIVATE; + mMarks_mask |= MARK_DEACTIVATE; break; case INTERRUPT_PHASE_EVENT: - if (spell_state == CASTING_STATE) - marks_mask |= MARK_END_CASTING; - else if (spell_state == DELIVERY_STATE) - marks_mask |= MARK_END_DELIVERY; - else if (spell_state == LINGER_STATE) - marks_mask |= MARK_END_LINGER; + if (mSpell_state == CASTING_STATE) + mMarks_mask |= MARK_END_CASTING; + else if (mSpell_state == DELIVERY_STATE) + mMarks_mask |= MARK_END_DELIVERY; + else if (mSpell_state == LINGER_STATE) + mMarks_mask |= MARK_END_LINGER; break; case INTERRUPT_SPELL_EVENT: - if (spell_state == CASTING_STATE) - marks_mask |= MARK_INTERRUPT_CASTING; - else if (spell_state == DELIVERY_STATE) - marks_mask |= MARK_INTERRUPT_DELIVERY; - else if (spell_state == LINGER_STATE) - marks_mask |= MARK_INTERRUPT_LINGER; - else if (spell_state == CLEANUP_STATE) - marks_mask |= MARK_INTERRUPT_CLEANUP; + if (mSpell_state == CASTING_STATE) + mMarks_mask |= MARK_INTERRUPT_CASTING; + else if (mSpell_state == DELIVERY_STATE) + mMarks_mask |= MARK_INTERRUPT_DELIVERY; + else if (mSpell_state == LINGER_STATE) + mMarks_mask |= MARK_INTERRUPT_LINGER; + else if (mSpell_state == CLEANUP_STATE) + mMarks_mask |= MARK_INTERRUPT_CLEANUP; break; } } @@ -2407,7 +2407,7 @@ void afxMagicSpell::postSpellEvent(U8 event) void afxMagicSpell::resolveTimeFactors() { for (S32 i = 0; i < NUM_PHRASES; i++) - tfactors[i] *= overall_time_factor; + mTfactors[i] *= mOverall_time_factor; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -2416,10 +2416,10 @@ void afxMagicSpell::finish_startup() { #if !defined(BROKEN_POINT_IN_WATER) // test if caster is in water - if (caster) + if (mCaster) { - Point3F pos = caster->getPosition(); - if (caster->pointInWater(pos)) + Point3F pos = mCaster->getPosition(); + if (mCaster->pointInWater(pos)) exec_conds_mask |= CASTER_IN_WATER; } #endif @@ -2480,7 +2480,7 @@ afxMagicSpell::cast_spell(afxMagicSpellData* datablock, ShapeBase* caster, Scene // create a new spell instance afxMagicSpell* spell = new afxMagicSpell(caster, target); spell->setDataBlock(datablock); - spell->exeblock = exeblock; + spell->mExeblock = exeblock; spell->setExtra(extra); // copy dynamic fields from the param holder to the spell @@ -2527,28 +2527,28 @@ Point3F afxMagicSpell::getShapeImpactPos(SceneObject* obj) void afxMagicSpell::restoreObject(SceneObject* obj) { - if (obj->getScopeId() == caster_scope_id && dynamic_cast(obj) != NULL) + if (obj->getScopeId() == mCaster_scope_id && dynamic_cast(obj) != NULL) { - caster_scope_id = 0; - caster = (ShapeBase*)obj; - caster_field = caster; - deleteNotify(caster); - processAfter(caster); + mCaster_scope_id = 0; + mCaster = (ShapeBase*)obj; + mCaster_field = mCaster; + deleteNotify(mCaster); + processAfter(mCaster); } - if (obj->getScopeId() == target_scope_id) + if (obj->getScopeId() == mTarget_scope_id) { - target_scope_id = 0; - target = obj; - target_field = target; - deleteNotify(target); + mTarget_scope_id = 0; + mTarget = obj; + mTarget_field = mTarget; + deleteNotify(mTarget); } - if (obj->getScopeId() == impacted_scope_id) + if (obj->getScopeId() == mImpacted_scope_id) { - impacted_scope_id = 0; - impacted_obj = obj; - deleteNotify(impacted_obj); + mImpacted_scope_id = 0; + mImpacted_obj = obj; + deleteNotify(mImpacted_obj); } } @@ -2561,23 +2561,23 @@ bool afxMagicSpell::activationCallInit(bool postponed) return false; } - if (!caster_field) + if (!mCaster_field) { Con::errorf("afxMagicSpell::activate() -- no spellcaster specified."); return false; } - caster = dynamic_cast(caster_field); - if (!caster) + mCaster = dynamic_cast(mCaster_field); + if (!mCaster) { Con::errorf("afxMagicSpell::activate() -- spellcaster is not a ShapeBase derived object."); return false; } - if (target_field) + if (mTarget_field) { - target = dynamic_cast(target_field); - if (!target) + mTarget = dynamic_cast(mTarget_field); + if (!mTarget) Con::warnf("afxMagicSpell::activate() -- target is not a SceneObject derived object."); } @@ -2591,11 +2591,11 @@ void afxMagicSpell::activate() // to happen prior to object registration. Sim::postEvent(this, new SpellFinishStartupEvent, Sim::getCurrentTime()); - caster_field = caster; - target_field = target; + mCaster_field = mCaster; + mTarget_field = mTarget; // CALL SCRIPT afxMagicSpellData::onActivate(%spell, %caster, %target) - datablock->onActivate_callback(this, caster, target); + mDatablock->onActivate_callback(this, mCaster, mTarget); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxMagicSpell.h b/Engine/source/afx/afxMagicSpell.h index 1f760e48b..f7545bdb8 100644 --- a/Engine/source/afx/afxMagicSpell.h +++ b/Engine/source/afx/afxMagicSpell.h @@ -68,36 +68,36 @@ class afxMagicSpellData : public afxChoreographerData, public afxMagicSpellDefs void validateType(SimObject *object, void *typePtr); }; - bool do_id_convert; + bool mDo_id_convert; public: - F32 casting_dur; - F32 delivery_dur; - F32 linger_dur; + F32 mCasting_dur; + F32 mDelivery_dur; + F32 mLinger_dur; // - S32 n_casting_loops; - S32 n_delivery_loops; - S32 n_linger_loops; + S32 mNum_casting_loops; + S32 mNum_delivery_loops; + S32 mNum_linger_loops; // - F32 extra_casting_time; - F32 extra_delivery_time; - F32 extra_linger_time; + F32 mExtra_casting_time; + F32 mExtra_delivery_time; + F32 mExtra_linger_time; // - bool do_move_interrupts; - F32 move_interrupt_speed; + bool mDo_move_interrupts; + F32 mMove_interrupt_speed; // - afxMagicMissileData* missile_db; - bool launch_on_server_signal; - U32 primary_target_types; + afxMagicMissileData* mMissile_db; + bool mLaunch_on_server_signal; + U32 mPrimary_target_types; // - afxEffectWrapperData* dummy_fx_entry; + afxEffectWrapperData* mDummy_fx_entry; // various effects lists - afxEffectList casting_fx_list; - afxEffectList launch_fx_list; - afxEffectList delivery_fx_list; - afxEffectList impact_fx_list; - afxEffectList linger_fx_list; + afxEffectList mCasting_fx_list; + afxEffectList mLaunch_fx_list; + afxEffectList mDelivery_fx_list; + afxEffectList mImpact_fx_list; + afxEffectList mLinger_fx_list; void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); void unpack_fx(BitStream* stream, afxEffectList& fx); @@ -222,39 +222,39 @@ private: static StringTableEntry IMPACTED_OBJECT_CONS; private: - afxMagicSpellData* datablock; - SimObject* exeblock; - afxMagicMissileData* missile_db; + afxMagicSpellData* mDatablock; + SimObject* mExeblock; + afxMagicMissileData* mMissile_db; - ShapeBase* caster; - SceneObject* target; - SimObject* caster_field; - SimObject* target_field; + ShapeBase* mCaster; + SceneObject* mTarget; + SimObject* mCaster_field; + SimObject* mTarget_field; - U16 caster_scope_id; - U16 target_scope_id; - bool target_is_shape; + U16 mCaster_scope_id; + U16 mTarget_scope_id; + bool mTarget_is_shape; - bool constraints_initialized; - bool scoping_initialized; + bool mConstraints_initialized; + bool mScoping_initialized; - U8 spell_state; - F32 spell_elapsed; + U8 mSpell_state; + F32 mSpell_elapsed; - afxConstraintID listener_cons_id; - afxConstraintID caster_cons_id; - afxConstraintID target_cons_id; - afxConstraintID impacted_cons_id; - afxConstraintID camera_cons_id; - SceneObject* camera_cons_obj; + afxConstraintID mListener_cons_id; + afxConstraintID mCaster_cons_id; + afxConstraintID mTarget_cons_id; + afxConstraintID mImpacted_cons_id; + afxConstraintID mCamera_cons_id; + SceneObject* mCamera_cons_obj; - afxPhrase* phrases[NUM_PHRASES]; - F32 tfactors[NUM_PHRASES]; + afxPhrase* mPhrases[NUM_PHRASES]; + F32 mTfactors[NUM_PHRASES]; - bool notify_castbar; - F32 overall_time_factor; + bool mNotify_castbar; + F32 mOverall_time_factor; - U16 marks_mask; + U16 mMarks_mask; private: void init(); @@ -278,13 +278,13 @@ protected: virtual void unpack_constraint_info(NetConnection* conn, BitStream* stream); private: - afxMagicMissile* missile; - bool missile_is_armed; - SceneObject* impacted_obj; - Point3F impact_pos; - Point3F impact_norm; - U16 impacted_scope_id; - bool impacted_is_shape; + afxMagicMissile* mMissile; + bool mMissile_is_armed; + SceneObject* mImpacted_obj; + Point3F mImpact_pos; + Point3F mImpact_norm; + U16 mImpacted_scope_id; + bool mImpacted_is_shape; void init_missile_s(afxMagicMissileData* mm); void launch_missile_s(); @@ -353,15 +353,15 @@ public: void postSpellEvent(U8 event); void resolveTimeFactors(); - void setTimeFactor(F32 f) { overall_time_factor = (f > 0) ? f : 1.0f; } - F32 getTimeFactor() { return overall_time_factor; } - void setTimeFactor(U8 phase, F32 f) { tfactors[phase] = (f > 0) ? f : 1.0f; } - F32 getTimeFactor(U8 phase) { return tfactors[phase]; } + void setTimeFactor(F32 f) { mOverall_time_factor = (f > 0) ? f : 1.0f; } + F32 getTimeFactor() { return mOverall_time_factor; } + void setTimeFactor(U8 phase, F32 f) { mTfactors[phase] = (f > 0) ? f : 1.0f; } + F32 getTimeFactor(U8 phase) { return mTfactors[phase]; } - ShapeBase* getCaster() const { return caster; } - SceneObject* getTarget() const { return target; } - afxMagicMissile* getMissile() const { return missile; } - SceneObject* getImpactedObject() const { return impacted_obj; } + ShapeBase* getCaster() const { return mCaster; } + SceneObject* getTarget() const { return mTarget; } + afxMagicMissile* getMissile() const { return mMissile; } + SceneObject* getImpactedObject() const { return mImpacted_obj; } virtual void restoreObject(SceneObject*); @@ -377,7 +377,7 @@ public: inline bool afxMagicSpell::is_caster_moving() { - return (caster) ? (caster->getVelocity().len() > datablock->move_interrupt_speed) : false; + return (mCaster) ? (mCaster->getVelocity().len() > mDatablock->mMove_interrupt_speed) : false; } inline bool afxMagicSpell::is_caster_client(ShapeBase* caster, GameConnection* conn) From b6076c55dd687d28ee991ce7cb485a2ed82cf698 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 17:46:57 -0500 Subject: [PATCH 247/312] afxEffectWrapper membervar cleanup --- Engine/source/afx/afxEffectVector.cpp | 10 +- Engine/source/afx/afxEffectWrapper.cpp | 316 +++++++++--------- Engine/source/afx/afxEffectWrapper.h | 122 +++---- Engine/source/afx/ea/afxEA_AnimClip.cpp | 10 +- Engine/source/afx/ea/afxEA_AreaDamage.cpp | 8 +- Engine/source/afx/ea/afxEA_AudioBank.cpp | 6 +- Engine/source/afx/ea/afxEA_Billboard.cpp | 14 +- Engine/source/afx/ea/afxEA_CameraPuppet.cpp | 10 +- Engine/source/afx/ea/afxEA_CameraShake.cpp | 6 +- Engine/source/afx/ea/afxEA_CollisionEvent.cpp | 14 +- Engine/source/afx/ea/afxEA_ConsoleMessage.cpp | 2 +- Engine/source/afx/ea/afxEA_Damage.cpp | 20 +- Engine/source/afx/ea/afxEA_Debris.cpp | 16 +- Engine/source/afx/ea/afxEA_Explosion.cpp | 10 +- Engine/source/afx/ea/afxEA_FootSwitch.cpp | 2 +- Engine/source/afx/ea/afxEA_GuiController.cpp | 12 +- Engine/source/afx/ea/afxEA_GuiText.cpp | 14 +- Engine/source/afx/ea/afxEA_MachineGun.cpp | 16 +- Engine/source/afx/ea/afxEA_Model.cpp | 18 +- Engine/source/afx/ea/afxEA_Mooring.cpp | 10 +- .../source/afx/ea/afxEA_ParticleEmitter.cpp | 48 +-- Engine/source/afx/ea/afxEA_PhraseEffect.cpp | 24 +- Engine/source/afx/ea/afxEA_PhysicalZone.cpp | 8 +- Engine/source/afx/ea/afxEA_PlayerMovement.cpp | 2 +- Engine/source/afx/ea/afxEA_PlayerPuppet.cpp | 10 +- Engine/source/afx/ea/afxEA_PointLight_T3D.cpp | 10 +- Engine/source/afx/ea/afxEA_Projectile.cpp | 32 +- Engine/source/afx/ea/afxEA_ScriptEvent.cpp | 6 +- Engine/source/afx/ea/afxEA_Sound.cpp | 8 +- Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp | 10 +- Engine/source/afx/ea/afxEA_StaticShape.cpp | 28 +- Engine/source/afx/ea/afxEA_Zodiac.cpp | 64 ++-- Engine/source/afx/ea/afxEA_ZodiacPlane.cpp | 34 +- Engine/source/afx/forces/afxEA_Force.cpp | 10 +- .../source/afx/xm/afxXM_AltitudeConform.cpp | 88 +++-- .../source/afx/xm/afxXM_MountedImageNode.cpp | 46 +-- 36 files changed, 531 insertions(+), 533 deletions(-) diff --git a/Engine/source/afx/afxEffectVector.cpp b/Engine/source/afx/afxEffectVector.cpp index b3d03e4c6..47e0d1aee 100644 --- a/Engine/source/afx/afxEffectVector.cpp +++ b/Engine/source/afx/afxEffectVector.cpp @@ -40,7 +40,7 @@ void afxEffectVector::filter_client_server() for (S32 i = 0; i < fx_v->size(); i++) { - if ((*fx_v)[i]->datablock->runsHere(on_server)) + if ((*fx_v)[i]->mDatablock->runsHere(on_server)) fx_v2->push_back((*fx_v)[i]); else { @@ -68,15 +68,15 @@ void afxEffectVector::calc_fx_dur_and_afterlife() if (ew) { F32 ew_dur; - if (ew->ew_timing.lifetime < 0) + if (ew->mEW_timing.lifetime < 0) { - if (phrase_dur > ew->ew_timing.delay) + if (phrase_dur > ew->mEW_timing.delay) ew_dur = phrase_dur + ew->afterStopTime(); else - ew_dur = ew->ew_timing.delay + ew->afterStopTime(); + ew_dur = ew->mEW_timing.delay + ew->afterStopTime(); } else - ew_dur = ew->ew_timing.delay + ew->ew_timing.lifetime + ew->ew_timing.fade_out_time; + ew_dur = ew->mEW_timing.delay + ew->mEW_timing.lifetime + ew->mEW_timing.fade_out_time; if (ew_dur > total_fx_dur) total_fx_dur = ew_dur; diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp index 33f73f787..5906947ee 100644 --- a/Engine/source/afx/afxEffectWrapper.cpp +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -681,55 +681,55 @@ ConsoleDocClass( afxEffectWrapper, afxEffectWrapper::afxEffectWrapper() { - choreographer = 0; - datablock = 0; - cons_mgr = 0; + mChoreographer = 0; + mDatablock = 0; + mCons_mgr = 0; - cond_alive = true; - elapsed = 0; - life_end = 0; - life_elapsed = 0; - stopped = false; - n_updates = 0; - fade_value = 1.0f; - last_fade_value = 0.0f; - fade_in_end = 0.0; - fade_out_start = 0.0f; - in_scope = true; - is_aborted = false; - do_fade_inout = false; - do_fades = false; - full_lifetime = 0; + mCond_alive = true; + mElapsed = 0; + mLife_end = 0; + mLife_elapsed = 0; + mStopped = false; + mNum_updates = 0; + mFade_value = 1.0f; + mLast_fade_value = 0.0f; + mFade_in_end = 0.0; + mFade_out_start = 0.0f; + mIn_scope = true; + mIs_aborted = false; + mDo_fade_inout = false; + mDo_fades = false; + mFull_lifetime = 0; - time_factor = 1.0f; - prop_time_factor = 1.0f; + mTime_factor = 1.0f; + mProp_time_factor = 1.0f; - live_scale_factor = 1.0f; - live_fade_factor = 1.0f; - terrain_altitude = -1.0f; - interior_altitude = -1.0f; + mLive_scale_factor = 1.0f; + mLive_fade_factor = 1.0f; + mTerrain_altitude = -1.0f; + mInterior_altitude = -1.0f; - group_index = 0; + mGroup_index = 0; - dMemset(xfm_modifiers, 0, sizeof(xfm_modifiers)); + dMemset(mXfm_modifiers, 0, sizeof(mXfm_modifiers)); } afxEffectWrapper::~afxEffectWrapper() { for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++) - if (xfm_modifiers[i]) - delete xfm_modifiers[i]; + if (mXfm_modifiers[i]) + delete mXfm_modifiers[i]; - if (datablock && datablock->effect_name != ST_NULLSTRING) + if (mDatablock && mDatablock->effect_name != ST_NULLSTRING) { - choreographer->removeNamedEffect(this); - if (datablock->use_as_cons_obj && !effect_cons_id.undefined()) - cons_mgr->setReferenceEffect(effect_cons_id, 0); + mChoreographer->removeNamedEffect(this); + if (mDatablock->use_as_cons_obj && !mEffect_cons_id.undefined()) + mCons_mgr->setReferenceEffect(mEffect_cons_id, 0); } - if (datablock && datablock->isTempClone()) - delete datablock; - datablock = 0; + if (mDatablock && mDatablock->isTempClone()) + delete mDatablock; + mDatablock = 0; } #undef myOffset @@ -737,9 +737,9 @@ afxEffectWrapper::~afxEffectWrapper() void afxEffectWrapper::initPersistFields() { - addField("liveScaleFactor", TypeF32, myOffset(live_scale_factor), + addField("liveScaleFactor", TypeF32, myOffset(mLive_scale_factor), "..."); - addField("liveFadeFactor", TypeF32, myOffset(live_fade_factor), + addField("liveFadeFactor", TypeF32, myOffset(mLive_fade_factor), "..."); Parent::initPersistFields(); @@ -754,37 +754,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer, AssertFatal(datablock != NULL, "Datablock is missing."); AssertFatal(cons_mgr != NULL, "Constraint manager is missing."); - this->choreographer = choreographer; - this->datablock = datablock; - this->cons_mgr = cons_mgr; + mChoreographer = choreographer; + mDatablock = datablock; + mCons_mgr = cons_mgr; ea_set_datablock(datablock->effect_data); - ew_timing = datablock->ewd_timing; - if (ew_timing.life_bias != 1.0f) + mEW_timing = datablock->ewd_timing; + if (mEW_timing.life_bias != 1.0f) { - if (ew_timing.lifetime > 0) - ew_timing.lifetime *= ew_timing.life_bias; - ew_timing.fade_in_time *= ew_timing.life_bias; - ew_timing.fade_out_time *= ew_timing.life_bias; + if (mEW_timing.lifetime > 0) + mEW_timing.lifetime *= mEW_timing.life_bias; + mEW_timing.fade_in_time *= mEW_timing.life_bias; + mEW_timing.fade_out_time *= mEW_timing.life_bias; } - pos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def); - orient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def); - aim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def); - life_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def); + mPos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def); + mOrient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def); + mAim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def); + mLife_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def); - this->time_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor; + mTime_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor; if (datablock->propagate_time_factor) - prop_time_factor = time_factor; + mProp_time_factor = time_factor; if (datablock->runsHere(choreographer->isServerObject())) { for (int i = 0; i < MAX_XFM_MODIFIERS && datablock->xfm_modifiers[i] != 0; i++) { - xfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject()); - AssertFatal(xfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName())); - if (xfm_modifiers[i] == 0) + mXfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject()); + AssertFatal(mXfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName())); + if (mXfm_modifiers[i] == 0) Con::errorf("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()); } } @@ -795,9 +795,9 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer, choreographer->addNamedEffect(this); if (datablock->use_as_cons_obj) { - effect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this); - if (effect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject())) - effect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this); + mEffect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this); + if (mEffect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject())) + mEffect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this); } } } @@ -805,37 +805,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer, void afxEffectWrapper::prestart() { // modify timing values by time_factor - if (ew_timing.lifetime > 0) - ew_timing.lifetime *= time_factor; - ew_timing.delay *= time_factor; - ew_timing.fade_in_time *= time_factor; - ew_timing.fade_out_time *= time_factor; + if (mEW_timing.lifetime > 0) + mEW_timing.lifetime *= mTime_factor; + mEW_timing.delay *= mTime_factor; + mEW_timing.fade_in_time *= mTime_factor; + mEW_timing.fade_out_time *= mTime_factor; - if (ew_timing.lifetime < 0) + if (mEW_timing.lifetime < 0) { - full_lifetime = INFINITE_LIFETIME; - life_end = INFINITE_LIFETIME; + mFull_lifetime = INFINITE_LIFETIME; + mLife_end = INFINITE_LIFETIME; } else { - full_lifetime = ew_timing.lifetime + ew_timing.fade_out_time; - life_end = ew_timing.delay + ew_timing.lifetime; + mFull_lifetime = mEW_timing.lifetime + mEW_timing.fade_out_time; + mLife_end = mEW_timing.delay + mEW_timing.lifetime; } - if ((ew_timing.fade_in_time + ew_timing.fade_out_time) > 0.0f) + if ((mEW_timing.fade_in_time + mEW_timing.fade_out_time) > 0.0f) { - fade_in_end = ew_timing.delay + ew_timing.fade_in_time; - if (full_lifetime == INFINITE_LIFETIME) - fade_out_start = INFINITE_LIFETIME; + mFade_in_end = mEW_timing.delay + mEW_timing.fade_in_time; + if (mFull_lifetime == INFINITE_LIFETIME) + mFade_out_start = INFINITE_LIFETIME; else - fade_out_start = ew_timing.delay + ew_timing.lifetime; - do_fade_inout = true; + mFade_out_start = mEW_timing.delay + mEW_timing.lifetime; + mDo_fade_inout = true; } - if (!do_fade_inout && datablock->vis_keys != NULL && datablock->vis_keys->numKeys() > 0) + if (!mDo_fade_inout && mDatablock->vis_keys != NULL && mDatablock->vis_keys->numKeys() > 0) { //do_fades = true; - fade_out_start = ew_timing.delay + ew_timing.lifetime; + mFade_out_start = mEW_timing.delay + mEW_timing.lifetime; } } @@ -843,22 +843,22 @@ bool afxEffectWrapper::start(F32 timestamp) { if (!ea_is_enabled()) { - Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", datablock->getName()); + Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", mDatablock->getName()); return false; } afxConstraint* life_constraint = getLifeConstraint(); if (life_constraint) - cond_alive = life_constraint->getLivingState(); + mCond_alive = life_constraint->getLivingState(); - elapsed = timestamp; + mElapsed = timestamp; for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++) { - if (!xfm_modifiers[i]) + if (!mXfm_modifiers[i]) break; else - xfm_modifiers[i]->start(timestamp); + mXfm_modifiers[i]->start(timestamp); } if (!ea_start()) @@ -874,109 +874,109 @@ bool afxEffectWrapper::start(F32 timestamp) bool afxEffectWrapper::test_life_conds() { afxConstraint* life_constraint = getLifeConstraint(); - if (!life_constraint || datablock->life_conds == 0) + if (!life_constraint || mDatablock->life_conds == 0) return true; S32 now_state = life_constraint->getDamageState(); - if ((datablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled) + if ((mDatablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled) return true; - if ((datablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled) + if ((mDatablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled) return true; - if ((datablock->life_conds & DYING) != 0) - return (cond_alive && now_state == ShapeBase::Disabled); + if ((mDatablock->life_conds & DYING) != 0) + return (mCond_alive && now_state == ShapeBase::Disabled); return false; } bool afxEffectWrapper::update(F32 dt) { - elapsed += dt; + mElapsed += dt; // life_elapsed won't exceed full_lifetime - life_elapsed = getMin(elapsed - ew_timing.delay, full_lifetime); + mLife_elapsed = getMin(mElapsed - mEW_timing.delay, mFull_lifetime); // update() returns early if elapsed is outside of active timing range // (delay <= elapsed <= delay+lifetime) // note: execution is always allowed beyond this point at least once, // even if elapsed exceeds the lifetime. - if (elapsed < ew_timing.delay) + if (mElapsed < mEW_timing.delay) { setScopeStatus(false); return false; } - if (!datablock->requiresStop(ew_timing) && ew_timing.lifetime < 0) + if (!mDatablock->requiresStop(mEW_timing) && mEW_timing.lifetime < 0) { - F32 afterlife = elapsed - ew_timing.delay; - if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0))) + F32 afterlife = mElapsed - mEW_timing.delay; + if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0))) { - setScopeStatus(ew_timing.residue_lifetime > 0.0f); + setScopeStatus(mEW_timing.residue_lifetime > 0.0f); return false; } } else { - F32 afterlife = elapsed - (full_lifetime + ew_timing.delay); - if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0))) + F32 afterlife = mElapsed - (mFull_lifetime + mEW_timing.delay); + if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0))) { - setScopeStatus(ew_timing.residue_lifetime > 0.0f); + setScopeStatus(mEW_timing.residue_lifetime > 0.0f); return false; } } // first time here, test if required conditions for effect are met - if (n_updates == 0) + if (mNum_updates == 0) { if (!test_life_conds()) { - elapsed = full_lifetime + ew_timing.delay; + mElapsed = mFull_lifetime + mEW_timing.delay; setScopeStatus(false); - n_updates++; + mNum_updates++; return false; } } setScopeStatus(true); - n_updates++; + mNum_updates++; // calculate current fade value if enabled - if (do_fade_inout) + if (mDo_fade_inout) { - if (ew_timing.fade_in_time > 0 && elapsed <= fade_in_end) + if (mEW_timing.fade_in_time > 0 && mElapsed <= mFade_in_end) { - F32 t = mClampF((elapsed-ew_timing.delay)/ew_timing.fade_in_time, 0.0f, 1.0f); - fade_value = afxEase::t(t, ew_timing.fadein_ease.x,ew_timing.fadein_ease.y); - do_fades = true; + F32 t = mClampF((mElapsed - mEW_timing.delay)/ mEW_timing.fade_in_time, 0.0f, 1.0f); + mFade_value = afxEase::t(t, mEW_timing.fadein_ease.x, mEW_timing.fadein_ease.y); + mDo_fades = true; } - else if (elapsed > fade_out_start) + else if (mElapsed > mFade_out_start) { - if (ew_timing.fade_out_time == 0) - fade_value = 0.0f; + if (mEW_timing.fade_out_time == 0) + mFade_value = 0.0f; else { - F32 t = mClampF(1.0f-(elapsed-fade_out_start)/ew_timing.fade_out_time, 0.0f, 1.0f); - fade_value = afxEase::t(t, ew_timing.fadeout_ease.x,ew_timing.fadeout_ease.y); + F32 t = mClampF(1.0f-(mElapsed - mFade_out_start)/ mEW_timing.fade_out_time, 0.0f, 1.0f); + mFade_value = afxEase::t(t, mEW_timing.fadeout_ease.x, mEW_timing.fadeout_ease.y); } - do_fades = true; + mDo_fades = true; } else { - fade_value = 1.0f; - do_fades = false; + mFade_value = 1.0f; + mDo_fades = false; } } else { - fade_value = 1.0; - do_fades = false; + mFade_value = 1.0; + mDo_fades = false; } - if (datablock->vis_keys && datablock->vis_keys->numKeys() > 0) + if (mDatablock->vis_keys && mDatablock->vis_keys->numKeys() > 0) { - F32 vis = datablock->vis_keys->evaluate(elapsed-ew_timing.delay); - fade_value *= mClampF(vis, 0.0f, 1.0f); - do_fades = (fade_value < 1.0f); + F32 vis = mDatablock->vis_keys->evaluate(mElapsed - mEW_timing.delay); + mFade_value *= mClampF(vis, 0.0f, 1.0f); + mDo_fades = (mFade_value < 1.0f); } // DEAL WITH CONSTRAINTS @@ -990,17 +990,17 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* pos_constraint = getPosConstraint(); if (pos_constraint) { - bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.mHistory_time); + bool valid = pos_constraint->getPosition(CONS_POS, mDatablock->pos_cons_def.mHistory_time); if (!valid) getUnconstrainedPosition(CONS_POS); setScopeStatus(valid); - if (valid && datablock->borrow_altitudes) + if (valid && mDatablock->borrow_altitudes) { F32 terr_alt, inter_alt; if (pos_constraint->getAltitudes(terr_alt, inter_alt)) { - terrain_altitude = terr_alt; - interior_altitude = inter_alt; + mTerrain_altitude = terr_alt; + mInterior_altitude = inter_alt; } } } @@ -1013,7 +1013,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* orient_constraint = getOrientConstraint(); if (orient_constraint) { - orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.mHistory_time); + orient_constraint->getTransform(CONS_XFM, mDatablock->pos_cons_def.mHistory_time); } else { @@ -1022,11 +1022,11 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* aim_constraint = getAimConstraint(); if (aim_constraint) - aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.mHistory_time); + aim_constraint->getPosition(CONS_AIM, mDatablock->pos_cons_def.mHistory_time); else CONS_AIM.zero(); - CONS_SCALE.set(datablock->scale_factor, datablock->scale_factor, datablock->scale_factor); + CONS_SCALE.set(mDatablock->scale_factor, mDatablock->scale_factor, mDatablock->scale_factor); /* if (datablock->isPositional() && CONS_POS.isZero() && in_scope) @@ -1035,44 +1035,44 @@ bool afxEffectWrapper::update(F32 dt) getBaseColor(CONS_COLOR); - params.vis = fade_value; + params.vis = mFade_value; // apply modifiers for (int i = 0; i < MAX_XFM_MODIFIERS; i++) { - if (!xfm_modifiers[i]) + if (!mXfm_modifiers[i]) break; else - xfm_modifiers[i]->updateParams(dt, life_elapsed, params); + mXfm_modifiers[i]->updateParams(dt, mLife_elapsed, params); } // final pos/orient is determined - updated_xfm = CONS_XFM; - updated_pos = CONS_POS; - updated_aim = CONS_AIM; - updated_xfm.setPosition(updated_pos); - updated_scale = CONS_SCALE; - updated_color = CONS_COLOR; + mUpdated_xfm = CONS_XFM; + mUpdated_pos = CONS_POS; + mUpdated_aim = CONS_AIM; + mUpdated_xfm.setPosition(mUpdated_pos); + mUpdated_scale = CONS_SCALE; + mUpdated_color = CONS_COLOR; if (params.vis > 1.0f) - fade_value = 1.0f; + mFade_value = 1.0f; else - fade_value = params.vis; + mFade_value = params.vis; - if (last_fade_value != fade_value) + if (mLast_fade_value != mFade_value) { - do_fades = true; - last_fade_value = fade_value; + mDo_fades = true; + mLast_fade_value = mFade_value; } else { - do_fades = (fade_value < 1.0f); + mDo_fades = (mFade_value < 1.0f); } if (!ea_update(dt)) { - is_aborted = true; - Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", datablock->getName()); + mIs_aborted = true; + Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", mDatablock->getName()); } return true; @@ -1080,44 +1080,44 @@ bool afxEffectWrapper::update(F32 dt) void afxEffectWrapper::stop() { - if (!datablock->requiresStop(ew_timing)) + if (!mDatablock->requiresStop(mEW_timing)) return; - stopped = true; + mStopped = true; // this resets full_lifetime so it starts to shrink or fade - if (full_lifetime == INFINITE_LIFETIME) + if (mFull_lifetime == INFINITE_LIFETIME) { - full_lifetime = (elapsed - ew_timing.delay) + afterStopTime(); - life_end = elapsed; - if (ew_timing.fade_out_time > 0) - fade_out_start = elapsed; + mFull_lifetime = (mElapsed - mEW_timing.delay) + afterStopTime(); + mLife_end = mElapsed; + if (mEW_timing.fade_out_time > 0) + mFade_out_start = mElapsed; } } void afxEffectWrapper::cleanup(bool was_stopped) { ea_finish(was_stopped); - if (!effect_cons_id.undefined()) + if (!mEffect_cons_id.undefined()) { - cons_mgr->setReferenceEffect(effect_cons_id, 0); - effect_cons_id = afxConstraintID(); + mCons_mgr->setReferenceEffect(mEffect_cons_id, 0); + mEffect_cons_id = afxConstraintID(); } } void afxEffectWrapper::setScopeStatus(bool in_scope) { - if (this->in_scope != in_scope) + if (mIn_scope != in_scope) { - this->in_scope = in_scope; + mIn_scope = in_scope; ea_set_scope_status(in_scope); } } bool afxEffectWrapper::isDone() { - if (!datablock->is_looping) - return (elapsed >= (life_end + ew_timing.fade_out_time)); + if (!mDatablock->is_looping) + return (mElapsed >= (mLife_end + mEW_timing.fade_out_time)); return false; } @@ -1136,7 +1136,7 @@ afxEffectWrapper* afxEffectWrapper::ew_create(afxChoreographer* choreograph if (adapter) { - adapter->group_index = (datablock->group_index != -1) ? datablock->group_index : group_index; + adapter->mGroup_index = (datablock->group_index != -1) ? datablock->group_index : group_index; adapter->ew_init(choreographer, datablock, cons_mgr, time_factor); } diff --git a/Engine/source/afx/afxEffectWrapper.h b/Engine/source/afx/afxEffectWrapper.h index 8d5ef646c..79459f76f 100644 --- a/Engine/source/afx/afxEffectWrapper.h +++ b/Engine/source/afx/afxEffectWrapper.h @@ -255,59 +255,59 @@ private: bool test_life_conds(); protected: - afxEffectWrapperData* datablock; + afxEffectWrapperData* mDatablock; - afxEffectTimingData ew_timing; + afxEffectTimingData mEW_timing; - F32 fade_in_end; - F32 fade_out_start; - F32 full_lifetime; + F32 mFade_in_end; + F32 mFade_out_start; + F32 mFull_lifetime; - F32 time_factor; - F32 prop_time_factor; + F32 mTime_factor; + F32 mProp_time_factor; - afxChoreographer* choreographer; - afxConstraintMgr* cons_mgr; + afxChoreographer* mChoreographer; + afxConstraintMgr* mCons_mgr; - afxConstraintID pos_cons_id; - afxConstraintID orient_cons_id; - afxConstraintID aim_cons_id; - afxConstraintID life_cons_id; + afxConstraintID mPos_cons_id; + afxConstraintID mOrient_cons_id; + afxConstraintID mAim_cons_id; + afxConstraintID mLife_cons_id; - afxConstraintID effect_cons_id; + afxConstraintID mEffect_cons_id; - F32 elapsed; - F32 life_elapsed; - F32 life_end; - bool stopped; - bool cond_alive; + F32 mElapsed; + F32 mLife_elapsed; + F32 mLife_end; + bool mStopped; + bool mCond_alive; - U32 n_updates; + U32 mNum_updates; - MatrixF updated_xfm; - Point3F updated_pos; - Point3F updated_aim; - Point3F updated_scale; - LinearColorF updated_color; + MatrixF mUpdated_xfm; + Point3F mUpdated_pos; + Point3F mUpdated_aim; + Point3F mUpdated_scale; + LinearColorF mUpdated_color; - F32 fade_value; - F32 last_fade_value; + F32 mFade_value; + F32 mLast_fade_value; - bool do_fade_inout; - bool do_fades; - bool in_scope; - bool is_aborted; + bool mDo_fade_inout; + bool mDo_fades; + bool mIn_scope; + bool mIs_aborted; - U8 effect_flags; + U8 mEffect_flags; - afxXM_Base* xfm_modifiers[MAX_XFM_MODIFIERS]; + afxXM_Base* mXfm_modifiers[MAX_XFM_MODIFIERS]; - F32 live_scale_factor; - F32 live_fade_factor; - F32 terrain_altitude; - F32 interior_altitude; + F32 mLive_scale_factor; + F32 mLive_fade_factor; + F32 mTerrain_altitude; + F32 mInterior_altitude; - S32 group_index; + S32 mGroup_index; public: /*C*/ afxEffectWrapper(); @@ -316,18 +316,18 @@ public: void ew_init(afxChoreographer*, afxEffectWrapperData*, afxConstraintMgr*, F32 time_factor); - F32 getFullLifetime() { return ew_timing.lifetime + ew_timing.fade_out_time; } - F32 getTimeFactor() { return time_factor; } - afxConstraint* getPosConstraint() { return cons_mgr->getConstraint(pos_cons_id); } - afxConstraint* getOrientConstraint() { return cons_mgr->getConstraint(orient_cons_id); } - afxConstraint* getAimConstraint() { return cons_mgr->getConstraint(aim_cons_id); } - afxConstraint* getLifeConstraint() { return cons_mgr->getConstraint(life_cons_id); } - afxChoreographer* getChoreographer() { return choreographer; } + F32 getFullLifetime() { return mEW_timing.lifetime + mEW_timing.fade_out_time; } + F32 getTimeFactor() { return mTime_factor; } + afxConstraint* getPosConstraint() { return mCons_mgr->getConstraint(mPos_cons_id); } + afxConstraint* getOrientConstraint() { return mCons_mgr->getConstraint(mOrient_cons_id); } + afxConstraint* getAimConstraint() { return mCons_mgr->getConstraint(mAim_cons_id); } + afxConstraint* getLifeConstraint() { return mCons_mgr->getConstraint(mLife_cons_id); } + afxChoreographer* getChoreographer() { return mChoreographer; } virtual bool isDone(); virtual bool deleteWhenStopped() { return false; } - F32 afterStopTime() { return ew_timing.fade_out_time; } - bool isAborted() const { return is_aborted; } + F32 afterStopTime() { return mEW_timing.fade_out_time; } + bool isAborted() const { return mIs_aborted; } void prestart(); bool start(F32 timestamp); @@ -345,11 +345,11 @@ public: virtual SceneObject* ea_get_scene_object() const { return 0; } U32 ea_get_triggers() const { return 0; } - void getUpdatedPosition(Point3F& pos) { pos = updated_pos;} - void getUpdatedTransform(MatrixF& xfm) { xfm = updated_xfm; } - void getUpdatedScale(Point3F& scale) { scale = updated_scale; } - void getUpdatedColor(LinearColorF& color) { color = updated_color; } - virtual void getUpdatedBoxCenter(Point3F& pos) { pos = updated_pos;} + void getUpdatedPosition(Point3F& pos) { pos = mUpdated_pos;} + void getUpdatedTransform(MatrixF& xfm) { xfm = mUpdated_xfm; } + void getUpdatedScale(Point3F& scale) { scale = mUpdated_scale; } + void getUpdatedColor(LinearColorF& color) { color = mUpdated_color; } + virtual void getUpdatedBoxCenter(Point3F& pos) { pos = mUpdated_pos;} virtual void getUnconstrainedPosition(Point3F& pos) { pos.zero();} virtual void getUnconstrainedTransform(MatrixF& xfm) { xfm.identity(); } @@ -358,9 +358,9 @@ public: SceneObject* getSceneObject() const { return ea_get_scene_object(); } U32 getTriggers() const { return ea_get_triggers(); } - F32 getMass() { return datablock->mass; } - Point3F getDirection() { return datablock->direction; } - F32 getSpeed() { return datablock->speed; } + F32 getMass() { return mDatablock->mass; } + Point3F getDirection() { return mDatablock->direction; } + F32 getSpeed() { return mDatablock->speed; } virtual TSShape* getTSShape() { return 0; } virtual TSShapeInstance* getTSShapeInstance() { return 0; } @@ -369,14 +369,14 @@ public: virtual void resetAnimation(U32 tag) { } virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; } - void setTerrainAltitude(F32 alt) { terrain_altitude = alt; } - void setInteriorAltitude(F32 alt) { interior_altitude = alt; } - void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = terrain_altitude; inter_alt = interior_altitude; } + void setTerrainAltitude(F32 alt) { mTerrain_altitude = alt; } + void setInteriorAltitude(F32 alt) { mInterior_altitude = alt; } + void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = mTerrain_altitude; inter_alt = mInterior_altitude; } - void setGroupIndex(S32 idx) { group_index = idx; } - S32 getGroupIndex() const { return group_index; } + void setGroupIndex(S32 idx) { mGroup_index = idx; } + S32 getGroupIndex() const { return mGroup_index; } - bool inScope() const { return in_scope; } + bool inScope() const { return mIn_scope; } public: static void initPersistFields(); diff --git a/Engine/source/afx/ea/afxEA_AnimClip.cpp b/Engine/source/afx/ea/afxEA_AnimClip.cpp index 4e635a1db..601d54515 100644 --- a/Engine/source/afx/ea/afxEA_AnimClip.cpp +++ b/Engine/source/afx/ea/afxEA_AnimClip.cpp @@ -89,10 +89,10 @@ bool afxEA_AnimClip::ea_start() do_runtime_substitutions(); afxConstraint* pos_constraint = getPosConstraint(); - if (full_lifetime == INFINITE_LIFETIME && pos_constraint != 0) + if (mFull_lifetime == INFINITE_LIFETIME && pos_constraint != 0) anim_lifetime = pos_constraint->getAnimClipDuration(clip_data->clip_name); else - anim_lifetime = full_lifetime; + anim_lifetime = mFull_lifetime; anim_tag = 0; lock_tag = 0; @@ -127,8 +127,8 @@ bool afxEA_AnimClip::ea_update(F32 dt) if (go_for_it) { - F32 rate = clip_data->rate/prop_time_factor; - F32 pos = mFmod(life_elapsed, anim_lifetime)/anim_lifetime; + F32 rate = clip_data->rate/mProp_time_factor; + F32 pos = mFmod(mLife_elapsed, anim_lifetime)/anim_lifetime; pos = mFmod(pos + clip_data->pos_offset, 1.0); if (clip_data->rate < 0) pos = 1.0f - pos; @@ -164,7 +164,7 @@ void afxEA_AnimClip::do_runtime_substitutions() // clone the datablock and perform substitutions afxAnimClipData* orig_db = clip_data; clip_data = new afxAnimClipData(*orig_db, true); - orig_db->performSubstitutions(clip_data, choreographer, group_index); + orig_db->performSubstitutions(clip_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_AreaDamage.cpp b/Engine/source/afx/ea/afxEA_AreaDamage.cpp index 3c5d26aae..a9a6036fb 100644 --- a/Engine/source/afx/ea/afxEA_AreaDamage.cpp +++ b/Engine/source/afx/ea/afxEA_AreaDamage.cpp @@ -133,7 +133,7 @@ void afxEA_AreaDamage::do_runtime_substitutions() // clone the datablock and perform substitutions afxAreaDamageData* orig_db = damage_data; damage_data = new afxAreaDamageData(*orig_db, true); - orig_db->performSubstitutions(damage_data, choreographer, group_index); + orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index); } } @@ -204,8 +204,8 @@ void afxEA_AreaDamage::notify_damage_source(ShapeBase* damaged, F32 damage, cons char *posArg = Con::getArgBuffer(64); dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); - Con::executef(choreographer->getDataBlock(), "onInflictedAreaDamage", - choreographer->getIdString(), + Con::executef(mChoreographer->getDataBlock(), "onInflictedAreaDamage", + mChoreographer->getIdString(), damaged->getIdString(), Con::getFloatArg(damage), flavor, @@ -221,7 +221,7 @@ void afxEA_AreaDamage::apply_damage(ShapeBase* shape, F32 damage, const char* fl dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); Con::executef(shape, "damage", - choreographer->getIdString(), + mChoreographer->getIdString(), posArg, Con::getFloatArg(damage), flavor); diff --git a/Engine/source/afx/ea/afxEA_AudioBank.cpp b/Engine/source/afx/ea/afxEA_AudioBank.cpp index 3cf7bd912..6ae095dcf 100644 --- a/Engine/source/afx/ea/afxEA_AudioBank.cpp +++ b/Engine/source/afx/ea/afxEA_AudioBank.cpp @@ -125,8 +125,8 @@ bool afxEA_AudioBank::ea_update(F32 dt) if (sound_handle) { - sound_handle->setTransform(updated_xfm); - sound_handle->setVolume(updated_scale.x*fade_value); + sound_handle->setTransform(mUpdated_xfm); + sound_handle->setVolume(mUpdated_scale.x*mFade_value); } return true; @@ -143,7 +143,7 @@ void afxEA_AudioBank::ea_finish(bool was_stopped) void afxEA_AudioBank::do_runtime_substitutions() { - sound_bank = sound_bank->cloneAndPerformSubstitutions(choreographer, group_index); + sound_bank = sound_bank->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ea/afxEA_Billboard.cpp b/Engine/source/afx/ea/afxEA_Billboard.cpp index 254dab1d6..012b364f9 100644 --- a/Engine/source/afx/ea/afxEA_Billboard.cpp +++ b/Engine/source/afx/ea/afxEA_Billboard.cpp @@ -108,18 +108,18 @@ bool afxEA_Billboard::ea_update(F32 dt) deleteNotify(bb); ///bb->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); - bb->setSortPriority(datablock->sort_priority); + bb->setSortPriority(mDatablock->sort_priority); } if (bb) { - bb->live_color = updated_color; - if (do_fades) + bb->live_color = mUpdated_color; + if (mDo_fades) { - bb->setFadeAmount(fade_value); + bb->setFadeAmount(mFade_value); } - bb->setTransform(updated_xfm); - bb->setScale(updated_scale); + bb->setTransform(mUpdated_xfm); + bb->setScale(mUpdated_scale); } return true; @@ -162,7 +162,7 @@ void afxEA_Billboard::do_runtime_substitutions() // clone the datablock and perform substitutions afxBillboardData* orig_db = bb_data; bb_data = new afxBillboardData(*orig_db, true); - orig_db->performSubstitutions(bb_data, choreographer, group_index); + orig_db->performSubstitutions(bb_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_CameraPuppet.cpp b/Engine/source/afx/ea/afxEA_CameraPuppet.cpp index b307bcb2f..51a3a3dd9 100644 --- a/Engine/source/afx/ea/afxEA_CameraPuppet.cpp +++ b/Engine/source/afx/ea/afxEA_CameraPuppet.cpp @@ -83,8 +83,8 @@ bool afxEA_CameraPuppet::ea_start() do_runtime_substitutions(); - afxConstraintID obj_id = cons_mgr->getConstraintId(puppet_data->cam_def); - cam_cons = cons_mgr->getConstraint(obj_id); + afxConstraintID obj_id = mCons_mgr->getConstraintId(puppet_data->cam_def); + cam_cons = mCons_mgr->getConstraint(obj_id); SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; if (obj && obj->isClientObject()) @@ -105,9 +105,9 @@ bool afxEA_CameraPuppet::ea_update(F32 dt) { SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; - if (obj && in_scope) + if (obj && mIn_scope) { - obj->setTransform(updated_xfm); + obj->setTransform(mUpdated_xfm); } return true; @@ -153,7 +153,7 @@ void afxEA_CameraPuppet::do_runtime_substitutions() // clone the datablock and perform substitutions afxCameraPuppetData* orig_db = puppet_data; puppet_data = new afxCameraPuppetData(*orig_db, true); - orig_db->performSubstitutions(puppet_data, choreographer, group_index); + orig_db->performSubstitutions(puppet_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_CameraShake.cpp b/Engine/source/afx/ea/afxEA_CameraShake.cpp index 9c26e32b6..2e5a461fa 100644 --- a/Engine/source/afx/ea/afxEA_CameraShake.cpp +++ b/Engine/source/afx/ea/afxEA_CameraShake.cpp @@ -91,7 +91,7 @@ bool afxEA_CameraShake::ea_start() if (aim_constraint && pos_constraint) { - if (full_lifetime <= 0 || full_lifetime == INFINITE_LIFETIME) + if (mFull_lifetime <= 0 || mFull_lifetime == INFINITE_LIFETIME) { Con::errorf("afxEA_CameraShake::ea_start() -- effect requires a finite lifetime."); return false; @@ -106,7 +106,7 @@ bool afxEA_CameraShake::ea_start() if (dist < shake_data->camShakeRadius) { camera_shake = new CameraShake; - camera_shake->setDuration(full_lifetime); + camera_shake->setDuration(mFull_lifetime); camera_shake->setFrequency(shake_data->camShakeFreq); F32 falloff = dist/shake_data->camShakeRadius; @@ -161,7 +161,7 @@ void afxEA_CameraShake::do_runtime_substitutions() // clone the datablock and perform substitutions afxCameraShakeData* orig_db = shake_data; shake_data = new afxCameraShakeData(*orig_db, true); - orig_db->performSubstitutions(shake_data, choreographer, group_index); + orig_db->performSubstitutions(shake_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_CollisionEvent.cpp b/Engine/source/afx/ea/afxEA_CollisionEvent.cpp index b06492acc..73b6fa707 100644 --- a/Engine/source/afx/ea/afxEA_CollisionEvent.cpp +++ b/Engine/source/afx/ea/afxEA_CollisionEvent.cpp @@ -107,16 +107,16 @@ bool afxEA_CollisionEvent::ea_update(F32 dt) afxConstraint* pos_constraint = getPosConstraint(); set_shape((pos_constraint) ? dynamic_cast(pos_constraint->getSceneObject()) : 0); - if (choreographer && trigger_mask != 0) + if (mChoreographer && trigger_mask != 0) { if (triggered) { - choreographer->setTriggerMask(trigger_mask | choreographer->getTriggerMask()); + mChoreographer->setTriggerMask(trigger_mask | mChoreographer->getTriggerMask()); triggered = false; } else { - choreographer->setTriggerMask(~trigger_mask & choreographer->getTriggerMask()); + mChoreographer->setTriggerMask(~trigger_mask & mChoreographer->getTriggerMask()); } } @@ -136,7 +136,7 @@ void afxEA_CollisionEvent::do_runtime_substitutions() // clone the datablock and perform substitutions afxCollisionEventData* orig_db = script_data; script_data = new afxCollisionEventData(*orig_db, true); - orig_db->performSubstitutions(script_data, choreographer, group_index); + orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index); } } @@ -162,7 +162,7 @@ void afxEA_CollisionEvent::set_shape(ShapeBase* new_shape) void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, const VectorF& vel) { - if (obj0 != shape || !choreographer || !choreographer->getDataBlock()) + if (obj0 != shape || !mChoreographer || !mChoreographer->getDataBlock()) return; if (script_data->method_name != ST_NULLSTRING) @@ -171,8 +171,8 @@ void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, dSprintf(arg_buf, 256, "%g %g %g", vel.x, vel.y, vel.z); // CALL SCRIPT afxChoreographerData::method(%spell, %obj0, %obj1, %velocity) - Con::executef(choreographer->getDataBlock(), script_data->method_name, - choreographer->getIdString(), + Con::executef(mChoreographer->getDataBlock(), script_data->method_name, + mChoreographer->getIdString(), (obj0) ? obj0->getIdString() : "", (obj1) ? obj1->getIdString() : "", arg_buf, diff --git a/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp b/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp index cb08cfa72..0f80a194a 100644 --- a/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp +++ b/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp @@ -98,7 +98,7 @@ void afxEA_ConsoleMessage::do_runtime_substitutions() // clone the datablock and perform substitutions afxConsoleMessageData* orig_db = message_data; message_data = new afxConsoleMessageData(*orig_db, true); - orig_db->performSubstitutions(message_data, choreographer, group_index); + orig_db->performSubstitutions(message_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Damage.cpp b/Engine/source/afx/ea/afxEA_Damage.cpp index e0691eae3..a338bfa38 100644 --- a/Engine/source/afx/ea/afxEA_Damage.cpp +++ b/Engine/source/afx/ea/afxEA_Damage.cpp @@ -101,7 +101,7 @@ bool afxEA_Damage::ea_start() if (damage_data->repeats > 1) { - dot_delta_ms = full_lifetime/(damage_data->repeats - 1); + dot_delta_ms = mFull_lifetime /(damage_data->repeats - 1); next_dot_time = dot_delta_ms; } @@ -122,15 +122,15 @@ bool afxEA_Damage::ea_update(F32 dt) if (aim_cons && aim_cons->getSceneObject()) impacted_obj_id = aim_cons->getSceneObject()->getId(); - if (choreographer) - choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + if (mChoreographer) + mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, repeat_cnt, damage_data->ad_amount, damage_data->radius, impact_pos, damage_data->impulse); repeat_cnt++; } else if (repeat_cnt < damage_data->repeats) { - if (next_dot_time <= life_elapsed) + if (next_dot_time <= mLife_elapsed) { // CONSTRAINT REMAPPING << afxConstraint* aim_cons = getAimConstraint(); @@ -138,8 +138,8 @@ bool afxEA_Damage::ea_update(F32 dt) impacted_obj_id = aim_cons->getSceneObject()->getId(); // CONSTRAINT REMAPPING >> - if (choreographer) - choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + if (mChoreographer) + mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, repeat_cnt, 0, 0, impact_pos, 0); next_dot_time += dot_delta_ms; repeat_cnt++; @@ -153,10 +153,10 @@ void afxEA_Damage::ea_finish(bool was_stopped) { if (started && (repeat_cnt < damage_data->repeats)) { - if (next_dot_time <= life_elapsed) + if (next_dot_time <= mLife_elapsed) { - if (choreographer) - choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + if (mChoreographer) + mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, repeat_cnt, 0, 0, impact_pos, 0); } } @@ -172,7 +172,7 @@ void afxEA_Damage::do_runtime_substitutions() // clone the datablock and perform substitutions afxDamageData* orig_db = damage_data; damage_data = new afxDamageData(*orig_db, true); - orig_db->performSubstitutions(damage_data, choreographer, group_index); + orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Debris.cpp b/Engine/source/afx/ea/afxEA_Debris.cpp index e4a46fc6b..678c02726 100644 --- a/Engine/source/afx/ea/afxEA_Debris.cpp +++ b/Engine/source/afx/ea/afxEA_Debris.cpp @@ -78,7 +78,7 @@ afxEA_Debris::~afxEA_Debris() bool afxEA_Debris::isDone() { - return (datablock->use_as_cons_obj) ? debris_done : exploded; + return (mDatablock->use_as_cons_obj) ? debris_done : exploded; } void afxEA_Debris::ea_set_datablock(SimDataBlock* db) @@ -106,21 +106,21 @@ bool afxEA_Debris::ea_update(F32 dt) { if (exploded && debris) { - if (in_scope) + if (mIn_scope) { - updated_xfm = debris->getRenderTransform(); - updated_xfm.getColumn(3, &updated_pos); + mUpdated_xfm = debris->getRenderTransform(); + mUpdated_xfm.getColumn(3, &mUpdated_pos); } } if (!exploded && debris) { - if (in_scope) + if (mIn_scope) { Point3F dir_vec(0,1,0); - updated_xfm.mulV(dir_vec); + mUpdated_xfm.mulV(dir_vec); - debris->init(updated_pos, dir_vec); + debris->init(mUpdated_pos, dir_vec); if (!debris->registerObject()) { delete debris; @@ -165,7 +165,7 @@ void afxEA_Debris::do_runtime_substitutions() // clone the datablock and perform substitutions DebrisData* orig_db = debris_data; debris_data = new DebrisData(*orig_db, true); - orig_db->performSubstitutions(debris_data, choreographer, group_index); + orig_db->performSubstitutions(debris_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Explosion.cpp b/Engine/source/afx/ea/afxEA_Explosion.cpp index f8e424f84..d8fcd3377 100644 --- a/Engine/source/afx/ea/afxEA_Explosion.cpp +++ b/Engine/source/afx/ea/afxEA_Explosion.cpp @@ -81,7 +81,7 @@ bool afxEA_Explosion::ea_start() do_runtime_substitutions(); explosion = new Explosion(); - explosion->setSubstitutionData(choreographer, group_index); + explosion->setSubstitutionData(mChoreographer, mGroup_index); explosion->setDataBlock(explosion_data); return true; @@ -91,10 +91,10 @@ bool afxEA_Explosion::ea_update(F32 dt) { if (!exploded && explosion) { - if (in_scope) + if (mIn_scope) { - Point3F norm(0,0,1); updated_xfm.mulV(norm); - explosion->setInitialState(updated_pos, norm); + Point3F norm(0,0,1); mUpdated_xfm.mulV(norm); + explosion->setInitialState(mUpdated_pos, norm); if (!explosion->registerObject()) { delete explosion; @@ -117,7 +117,7 @@ void afxEA_Explosion::ea_finish(bool was_stopped) void afxEA_Explosion::do_runtime_substitutions() { - explosion_data = explosion_data->cloneAndPerformSubstitutions(choreographer, group_index); + explosion_data = explosion_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ea/afxEA_FootSwitch.cpp b/Engine/source/afx/ea/afxEA_FootSwitch.cpp index 822dfb1e4..7bac59d85 100644 --- a/Engine/source/afx/ea/afxEA_FootSwitch.cpp +++ b/Engine/source/afx/ea/afxEA_FootSwitch.cpp @@ -145,7 +145,7 @@ void afxEA_FootSwitch::do_runtime_substitutions() // clone the datablock and perform substitutions afxFootSwitchData* orig_db = footfall_data; footfall_data = new afxFootSwitchData(*orig_db, true); - orig_db->performSubstitutions(footfall_data, choreographer, group_index); + orig_db->performSubstitutions(footfall_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_GuiController.cpp b/Engine/source/afx/ea/afxEA_GuiController.cpp index 9387278e7..e4fe1251e 100644 --- a/Engine/source/afx/ea/afxEA_GuiController.cpp +++ b/Engine/source/afx/ea/afxEA_GuiController.cpp @@ -146,7 +146,7 @@ bool afxEA_GuiController::ea_update(F32 dt) if (ts_ctrl && !controller_data->preserve_pos) { Point3F screen_pos; - if (ts_ctrl->project(updated_pos, &screen_pos)) + if (ts_ctrl->project(mUpdated_pos, &screen_pos)) { const Point2I ext = gui_control->getExtent(); Point2I newpos(screen_pos.x - ext.x/2, screen_pos.y - ext.y/2); @@ -155,12 +155,12 @@ bool afxEA_GuiController::ea_update(F32 dt) } if (progress_base) - progress_base->setProgress((ew_timing.lifetime > 0.0) ? life_elapsed/ew_timing.lifetime : 0.0f); + progress_base->setProgress((mEW_timing.lifetime > 0.0) ? mLife_elapsed / mEW_timing.lifetime : 0.0f); else if (progress_ctrl) - progress_ctrl->setScriptValue((ew_timing.lifetime > 0.0) ? avar("%g", life_elapsed/ew_timing.lifetime) : 0); + progress_ctrl->setScriptValue((mEW_timing.lifetime > 0.0) ? avar("%g", mLife_elapsed / mEW_timing.lifetime) : 0); - if (do_fades) - gui_control->setFadeAmount(fade_value); + if (mDo_fades) + gui_control->setFadeAmount(mFade_value); return true; } @@ -182,7 +182,7 @@ void afxEA_GuiController::do_runtime_substitutions() // clone the datablock and perform substitutions afxGuiControllerData* orig_db = controller_data; controller_data = new afxGuiControllerData(*orig_db, true); - orig_db->performSubstitutions(controller_data, choreographer, group_index); + orig_db->performSubstitutions(controller_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_GuiText.cpp b/Engine/source/afx/ea/afxEA_GuiText.cpp index 7dfc77422..41b8e4346 100644 --- a/Engine/source/afx/ea/afxEA_GuiText.cpp +++ b/Engine/source/afx/ea/afxEA_GuiText.cpp @@ -105,9 +105,9 @@ bool afxEA_GuiText::ea_update(F32 dt) case USER_TEXT: { LinearColorF temp_clr = text_clr; - if (do_fades) - temp_clr.alpha = fade_value; - afxGuiTextHud::addTextItem(updated_pos, text_data->text_str, temp_clr); + if (mDo_fades) + temp_clr.alpha = mFade_value; + afxGuiTextHud::addTextItem(mUpdated_pos, text_data->text_str, temp_clr); } break; case SHAPE_NAME: @@ -127,9 +127,9 @@ bool afxEA_GuiText::ea_update(F32 dt) if (name && name[0] != '\0') { LinearColorF temp_clr = text_clr; - if (do_fades) - temp_clr.alpha = fade_value; - afxGuiTextHud::addTextItem(updated_pos, name, temp_clr, cons_obj); + if (mDo_fades) + temp_clr.alpha = mFade_value; + afxGuiTextHud::addTextItem(mUpdated_pos, name, temp_clr, cons_obj); } } break; @@ -146,7 +146,7 @@ void afxEA_GuiText::do_runtime_substitutions() // clone the datablock and perform substitutions afxGuiTextData* orig_db = text_data; text_data = new afxGuiTextData(*orig_db, true); - orig_db->performSubstitutions(text_data, choreographer, group_index); + orig_db->performSubstitutions(text_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_MachineGun.cpp b/Engine/source/afx/ea/afxEA_MachineGun.cpp index 0db257b87..32b09c267 100644 --- a/Engine/source/afx/ea/afxEA_MachineGun.cpp +++ b/Engine/source/afx/ea/afxEA_MachineGun.cpp @@ -110,15 +110,15 @@ bool afxEA_MachineGun::ea_update(F32 dt) { if (!shooting) { - start_time = elapsed; + start_time = mElapsed; shooting = true; } else { F32 next_shot = start_time + (shot_count+1)*shot_gap; - while (next_shot < elapsed) + while (next_shot < mElapsed) { - if (in_scope) + if (mIn_scope) launch_projectile(); next_shot += shot_gap; shot_count++; @@ -141,7 +141,7 @@ void afxEA_MachineGun::launch_projectile() if (bullet_data->getSubstitutionCount() > 0) { next_bullet = new ProjectileData(*bullet_data, true); - bullet_data->performSubstitutions(next_bullet, choreographer, group_index); + bullet_data->performSubstitutions(next_bullet, mChoreographer, mGroup_index); } projectile->onNewDataBlock(next_bullet, false); @@ -151,10 +151,10 @@ void afxEA_MachineGun::launch_projectile() afxConstraint* pos_cons = getPosConstraint(); ShapeBase* src_obj = (pos_cons) ? (dynamic_cast(pos_cons->getSceneObject())) : 0; - Point3F dir_vec = updated_aim - updated_pos; + Point3F dir_vec = mUpdated_aim - mUpdated_pos; dir_vec.normalizeSafe(); dir_vec *= muzzle_vel; - projectile->init(updated_pos, dir_vec, src_obj); + projectile->init(mUpdated_pos, dir_vec, src_obj); if (!projectile->registerObject()) { delete projectile; @@ -162,7 +162,7 @@ void afxEA_MachineGun::launch_projectile() Con::errorf("afxEA_MachineGun::launch_projectile() -- projectile failed to register."); } if (projectile) - projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); + projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString()); } void afxEA_MachineGun::do_runtime_substitutions() @@ -173,7 +173,7 @@ void afxEA_MachineGun::do_runtime_substitutions() // clone the datablock and perform substitutions afxMachineGunData* orig_db = gun_data; gun_data = new afxMachineGunData(*orig_db, true); - orig_db->performSubstitutions(gun_data, choreographer, group_index); + orig_db->performSubstitutions(gun_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Model.cpp b/Engine/source/afx/ea/afxEA_Model.cpp index 23179ebe4..004acd887 100644 --- a/Engine/source/afx/ea/afxEA_Model.cpp +++ b/Engine/source/afx/ea/afxEA_Model.cpp @@ -119,18 +119,18 @@ bool afxEA_Model::ea_update(F32 dt) } deleteNotify(model); - model->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); - model->setSortPriority(datablock->sort_priority); + model->setSequenceRateFactor(mDatablock->rate_factor/ mProp_time_factor); + model->setSortPriority(mDatablock->sort_priority); } if (model) { - if (do_fades) + if (mDo_fades) { - model->setFadeAmount(fade_value); + model->setFadeAmount(mFade_value); } - model->setTransform(updated_xfm); - model->setScale(updated_scale); + model->setTransform(mUpdated_xfm); + model->setScale(mUpdated_scale); } return true; @@ -141,10 +141,10 @@ void afxEA_Model::ea_finish(bool was_stopped) if (!model) return; - if (in_scope && ew_timing.residue_lifetime > 0) + if (mIn_scope && mEW_timing.residue_lifetime > 0) { clearNotify(model); - afxResidueMgr::add(ew_timing.residue_lifetime, ew_timing.residue_fadetime, model); + afxResidueMgr::add(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, model); model = 0; } else @@ -203,7 +203,7 @@ void afxEA_Model::do_runtime_substitutions() // clone the datablock and perform substitutions afxModelData* orig_db = model_data; model_data = new afxModelData(*orig_db, true); - orig_db->performSubstitutions(model_data, choreographer, group_index); + orig_db->performSubstitutions(model_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Mooring.cpp b/Engine/source/afx/ea/afxEA_Mooring.cpp index a4e8743ee..307575149 100644 --- a/Engine/source/afx/ea/afxEA_Mooring.cpp +++ b/Engine/source/afx/ea/afxEA_Mooring.cpp @@ -92,11 +92,11 @@ bool afxEA_Mooring::ea_update(F32 dt) { if (!obj) { - if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) + if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) { obj = new afxMooring(mooring_data->networking, - choreographer->getChoreographerId(), - datablock->effect_name); + mChoreographer->getChoreographerId(), + mDatablock->effect_name); } else { @@ -116,7 +116,7 @@ bool afxEA_Mooring::ea_update(F32 dt) if (obj) { - obj->setTransform(updated_xfm); + obj->setTransform(mUpdated_xfm); } return true; @@ -142,7 +142,7 @@ void afxEA_Mooring::do_runtime_substitutions() // clone the datablock and perform substitutions afxMooringData* orig_db = mooring_data; mooring_data = new afxMooringData(*orig_db, true); - orig_db->performSubstitutions(mooring_data, choreographer, group_index); + orig_db->performSubstitutions(mooring_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp b/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp index 7f289b893..18835e1bc 100644 --- a/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp +++ b/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp @@ -84,28 +84,28 @@ bool afxEA_ParticleEmitter::ea_start() { afxParticleEmitterVector* pe = new afxParticleEmitterVector(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } else if (dynamic_cast(emitter_data)) { afxParticleEmitterCone* pe = new afxParticleEmitterCone(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } else if (dynamic_cast(emitter_data)) { afxParticleEmitterPath* pe = new afxParticleEmitterPath(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } else if (dynamic_cast(emitter_data)) { afxParticleEmitterDisc* pe = new afxParticleEmitterDisc(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } } @@ -120,7 +120,7 @@ bool afxEA_ParticleEmitter::ea_start() // here we find or create any required particle-pools if (emitter_data->pool_datablock) { - afxParticlePool* pool = choreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index); + afxParticlePool* pool = mChoreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index); if (!pool) { afxParticlePoolData* pool_data = emitter_data->pool_datablock; @@ -129,7 +129,7 @@ bool afxEA_ParticleEmitter::ea_start() // clone the datablock and perform substitutions afxParticlePoolData* orig_db = pool_data; pool_data = new afxParticlePoolData(*orig_db, true); - orig_db->performSubstitutions(pool_data, choreographer, group_index); + orig_db->performSubstitutions(pool_data, mChoreographer, mGroup_index); } pool = new afxParticlePool(); @@ -143,8 +143,8 @@ bool afxEA_ParticleEmitter::ea_start() } if (pool) { - pool->setChoreographer(choreographer); - choreographer->registerParticlePool(pool); + pool->setChoreographer(mChoreographer); + mChoreographer->registerParticlePool(pool); } } if (pool) @@ -160,12 +160,12 @@ bool afxEA_ParticleEmitter::ea_start() return false; } - if (datablock->forced_bbox.isValidBox()) + if (mDatablock->forced_bbox.isValidBox()) { do_bbox_update = true; } - emitter->setSortPriority(datablock->sort_priority); + emitter->setSortPriority(mDatablock->sort_priority); deleteNotify(emitter); return true; @@ -173,26 +173,26 @@ bool afxEA_ParticleEmitter::ea_start() bool afxEA_ParticleEmitter::ea_update(F32 dt) { - if (emitter && in_scope) + if (emitter && mIn_scope) { if (do_bbox_update) { Box3F bbox = emitter->getObjBox(); - bbox.minExtents = updated_pos + datablock->forced_bbox.minExtents; - bbox.maxExtents = updated_pos + datablock->forced_bbox.maxExtents; + bbox.minExtents = mUpdated_pos + mDatablock->forced_bbox.minExtents; + bbox.maxExtents = mUpdated_pos + mDatablock->forced_bbox.maxExtents; emitter->setForcedObjBox(bbox); emitter->setTransform(emitter->getTransform()); - if (!datablock->update_forced_bbox) + if (!mDatablock->update_forced_bbox) do_bbox_update = false; } - if (do_fades) - emitter->setFadeAmount(fade_value); + if (mDo_fades) + emitter->setFadeAmount(mFade_value); - emitter->emitParticlesExt(updated_xfm, updated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000)); + emitter->emitParticlesExt(mUpdated_xfm, mUpdated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000)); } return true; @@ -209,7 +209,7 @@ void afxEA_ParticleEmitter::ea_finish(bool was_stopped) // note - fully faded particles are not always // invisible, so they are still kept alive and // deleted via deleteWhenEmpty(). - if (ew_timing.fade_out_time > 0.0f) + if (mEW_timing.fade_out_time > 0.0f) emitter->setFadeAmount(0.0f); if (dynamic_cast(emitter)) ((afxParticleEmitter*)emitter)->setAFXOwner(0); @@ -240,32 +240,32 @@ void afxEA_ParticleEmitter::do_runtime_substitutions() { afxParticleEmitterVectorData* orig_db = (afxParticleEmitterVectorData*)emitter_data; emitter_data = new afxParticleEmitterVectorData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } else if (dynamic_cast(emitter_data)) { afxParticleEmitterConeData* orig_db = (afxParticleEmitterConeData*)emitter_data; emitter_data = new afxParticleEmitterConeData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } else if (dynamic_cast(emitter_data)) { afxParticleEmitterPathData* orig_db = (afxParticleEmitterPathData*)emitter_data; emitter_data = new afxParticleEmitterPathData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } else if (dynamic_cast(emitter_data)) { afxParticleEmitterDiscData* orig_db = (afxParticleEmitterDiscData*)emitter_data; emitter_data = new afxParticleEmitterDiscData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } } else { ParticleEmitterData* orig_db = emitter_data; emitter_data = new ParticleEmitterData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } if (clone_particles) @@ -277,7 +277,7 @@ void afxEA_ParticleEmitter::do_runtime_substitutions() // clone the datablock and perform substitutions ParticleData* orig_db = emitter_data->particleDataBlocks[i]; emitter_data->particleDataBlocks[i] = new ParticleData(*orig_db, true); - orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], choreographer, group_index); + orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], mChoreographer, mGroup_index); } } } diff --git a/Engine/source/afx/ea/afxEA_PhraseEffect.cpp b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp index e253ab1ee..1e14d2c6a 100644 --- a/Engine/source/afx/ea/afxEA_PhraseEffect.cpp +++ b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp @@ -137,7 +137,7 @@ void afxEA_PhraseEffect::grab_player_triggers(U32& trigger_mask) bool afxEA_PhraseEffect::ea_update(F32 dt) { - if (fade_value >= 1.0f) + if (mFade_value >= 1.0f) { // // Choreographer Triggers: @@ -145,7 +145,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt) // They must be set explicitly by calls to afxChoreographer // console-methods, setTriggerBit(), or clearTriggerBit(). // - U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : choreographer->getTriggerMask(); + U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : mChoreographer->getTriggerMask(); // // Constraint Triggers: @@ -191,7 +191,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt) { for (S32 i = 0; i < active_phrases->size(); i++) { - (*active_phrases)[i]->stop(life_elapsed); + (*active_phrases)[i]->stop(mLife_elapsed); } } } @@ -240,7 +240,7 @@ void afxEA_PhraseEffect::ea_finish(bool was_stopped) { for (S32 i = 0; i < active_phrases->size(); i++) { - (*active_phrases)[i]->stop(life_elapsed); + (*active_phrases)[i]->stop(mLife_elapsed); } } @@ -252,7 +252,7 @@ void afxEA_PhraseEffect::do_runtime_substitutions() // clone the datablock and perform substitutions afxPhraseEffectData* orig_db = phrase_fx_data; phrase_fx_data = new afxPhraseEffectData(*orig_db, true); - orig_db->performSubstitutions(phrase_fx_data, choreographer, group_index); + orig_db->performSubstitutions(phrase_fx_data, mChoreographer, mGroup_index); } } @@ -260,8 +260,8 @@ void afxEA_PhraseEffect::trigger_new_phrase() { //afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), /*willStop=*/false); bool will_stop = phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS; - afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), will_stop); - phrase->init(phrase_fx_data->fx_list, datablock->ewd_timing.lifetime, choreographer, time_factor, phrase_fx_data->n_loops, group_index); + afxPhrase* phrase = new afxPhrase(mChoreographer->isServerObject(), will_stop); + phrase->init(phrase_fx_data->fx_list, mDatablock->ewd_timing.lifetime, mChoreographer, mTime_factor, phrase_fx_data->n_loops, mGroup_index); phrase->start(0, 0); if (phrase->isEmpty()) { @@ -272,10 +272,10 @@ void afxEA_PhraseEffect::trigger_new_phrase() if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING) { char obj_str[32]; - dStrcpy(obj_str, Con::getIntArg(choreographer->getId()), 32); + dStrcpy(obj_str, Con::getIntArg(mChoreographer->getId()), 32); char index_str[32]; - dStrcpy(index_str, Con::getIntArg(group_index), 32); + dStrcpy(index_str, Con::getIntArg(mGroup_index), 32); char buffer[1024]; char* b = buffer; @@ -331,9 +331,9 @@ void afxEA_PhraseEffect::update_active_phrases(F32 dt) for (S32 i = 0; i < active_phrases->size(); i++) { afxPhrase* phrase = (*active_phrases)[i]; - if (phrase->expired(life_elapsed)) - phrase->recycle(life_elapsed); - phrase->update(dt, life_elapsed); + if (phrase->expired(mLife_elapsed)) + phrase->recycle(mLife_elapsed); + phrase->update(dt, mLife_elapsed); } } diff --git a/Engine/source/afx/ea/afxEA_PhysicalZone.cpp b/Engine/source/afx/ea/afxEA_PhysicalZone.cpp index 02012c358..7dbc8062f 100644 --- a/Engine/source/afx/ea/afxEA_PhysicalZone.cpp +++ b/Engine/source/afx/ea/afxEA_PhysicalZone.cpp @@ -127,9 +127,9 @@ bool afxEA_PhysicalZone::ea_update(F32 dt) set_cons_object((pos_constraint) ? pos_constraint->getSceneObject() : 0); } - if (do_fades) - physical_zone->setFadeAmount(fade_value); - physical_zone->setTransform(updated_xfm); + if (mDo_fades) + physical_zone->setFadeAmount(mFade_value); + physical_zone->setTransform(mUpdated_xfm); } return true; @@ -172,7 +172,7 @@ void afxEA_PhysicalZone::do_runtime_substitutions() // clone the datablock and perform substitutions afxPhysicalZoneData* orig_db = zone_data; zone_data = new afxPhysicalZoneData(*orig_db, true); - orig_db->performSubstitutions(zone_data, choreographer, group_index); + orig_db->performSubstitutions(zone_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_PlayerMovement.cpp b/Engine/source/afx/ea/afxEA_PlayerMovement.cpp index 03aac77b2..a563201cc 100644 --- a/Engine/source/afx/ea/afxEA_PlayerMovement.cpp +++ b/Engine/source/afx/ea/afxEA_PlayerMovement.cpp @@ -136,7 +136,7 @@ void afxEA_PlayerMovement::do_runtime_substitutions() // clone the datablock and perform substitutions afxPlayerMovementData* orig_db = movement_data; movement_data = new afxPlayerMovementData(*orig_db, true); - orig_db->performSubstitutions(movement_data, choreographer, group_index); + orig_db->performSubstitutions(movement_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp b/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp index 08c446956..822a69b06 100644 --- a/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp +++ b/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp @@ -80,8 +80,8 @@ bool afxEA_PlayerPuppet::ea_start() do_runtime_substitutions(); - afxConstraintID obj_id = cons_mgr->getConstraintId(mover_data->obj_def); - obj_cons = cons_mgr->getConstraint(obj_id); + afxConstraintID obj_id = mCons_mgr->getConstraintId(mover_data->obj_def); + obj_cons = mCons_mgr->getConstraint(obj_id); Player* player = dynamic_cast((obj_cons) ? obj_cons->getSceneObject() : 0); if (player) @@ -94,9 +94,9 @@ bool afxEA_PlayerPuppet::ea_update(F32 dt) { SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0; - if (obj && in_scope) + if (obj && mIn_scope) { - obj->setTransform(updated_xfm); + obj->setTransform(mUpdated_xfm); } return true; @@ -138,7 +138,7 @@ void afxEA_PlayerPuppet::do_runtime_substitutions() // clone the datablock and perform substitutions afxPlayerPuppetData* orig_db = mover_data; mover_data = new afxPlayerPuppetData(*orig_db, true); - orig_db->performSubstitutions(mover_data, choreographer, group_index); + orig_db->performSubstitutions(mover_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp index 3035da8d3..d0e87bf19 100644 --- a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp @@ -203,12 +203,12 @@ bool afxEA_T3DPointLight::ea_update(F32 dt) light->setConstraintObject(cons_obj); #endif - light->setLiveColor(updated_color); + light->setLiveColor(mUpdated_color); - if (do_fades) - light->setFadeAmount(fade_value*updated_scale.x); + if (mDo_fades) + light->setFadeAmount(mFade_value*mUpdated_scale.x); - light->updateTransform(updated_xfm); + light->updateTransform(mUpdated_xfm); // scale should not be updated this way. It messes up the culling. //light->setScale(updated_scale); @@ -254,7 +254,7 @@ void afxEA_T3DPointLight::do_runtime_substitutions() // clone the datablock and perform substitutions afxT3DPointLightData* orig_db = light_data; light_data = new afxT3DPointLightData(*orig_db, true); - orig_db->performSubstitutions(light_data, choreographer, group_index); + orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Projectile.cpp b/Engine/source/afx/ea/afxEA_Projectile.cpp index 104d5abb2..0f26d79b3 100644 --- a/Engine/source/afx/ea/afxEA_Projectile.cpp +++ b/Engine/source/afx/ea/afxEA_Projectile.cpp @@ -92,7 +92,7 @@ afxEA_Projectile::~afxEA_Projectile() bool afxEA_Projectile::isDone() { - return (datablock->use_as_cons_obj || datablock->use_ghost_as_cons_obj) ? projectile_done : impacted; + return (mDatablock->use_as_cons_obj || mDatablock->use_ghost_as_cons_obj) ? projectile_done : impacted; } void afxEA_Projectile::ea_set_datablock(SimDataBlock* db) @@ -117,8 +117,8 @@ bool afxEA_Projectile::ea_start() } else { - if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) - projectile = new afxProjectile(afx_projectile_data->networking, choreographer->getChoreographerId(), datablock->effect_name); + if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) + projectile = new afxProjectile(afx_projectile_data->networking, mChoreographer->getChoreographerId(), mDatablock->effect_name); else projectile = new afxProjectile(afx_projectile_data->networking, 0, ST_NULLSTRING); projectile->ignoreSourceTimeout = afx_projectile_data->ignore_src_timeout; @@ -127,8 +127,8 @@ bool afxEA_Projectile::ea_start() projectile->dynamicCollisionMask = afx_projectile_data->dynamicCollisionMask; projectile->staticCollisionMask = afx_projectile_data->staticCollisionMask; } - afxConstraintID launch_pos_id = cons_mgr->getConstraintId(afx_projectile_data->launch_pos_def); - launch_cons = cons_mgr->getConstraint(launch_pos_id); + afxConstraintID launch_pos_id = mCons_mgr->getConstraintId(afx_projectile_data->launch_pos_def); + launch_cons = mCons_mgr->getConstraint(launch_pos_id); launch_dir_bias = afx_projectile_data->launch_dir_bias; } @@ -141,7 +141,7 @@ bool afxEA_Projectile::ea_update(F32 dt) { if (!launched && projectile) { - if (in_scope) + if (mIn_scope) { afxConstraint* pos_cons = getPosConstraint(); ShapeBase* src_obj = (pos_cons) ? (dynamic_cast(pos_cons->getSceneObject())) : 0; @@ -155,19 +155,19 @@ bool afxEA_Projectile::ea_update(F32 dt) { case afxProjectileData::OrientConstraint: dir_vec.set(0,0,1); - updated_xfm.mulV(dir_vec); + mUpdated_xfm.mulV(dir_vec); break; case afxProjectileData::LaunchDirField: dir_vec.set(0,0,1); break; case afxProjectileData::TowardPos2Constraint: default: - dir_vec = updated_aim - updated_pos; + dir_vec = mUpdated_aim - mUpdated_pos; break; } } else - dir_vec = updated_aim - updated_pos; + dir_vec = mUpdated_aim - mUpdated_pos; dir_vec.normalizeSafe(); if (!launch_dir_bias.isZero()) @@ -184,7 +184,7 @@ bool afxEA_Projectile::ea_update(F32 dt) projectile->init(launch_pos, dir_vec, (launch_obj) ? launch_obj : src_obj); } else - projectile->init(updated_pos, dir_vec, src_obj); + projectile->init(mUpdated_pos, dir_vec, src_obj); if (!projectile->registerObject()) { @@ -197,7 +197,7 @@ bool afxEA_Projectile::ea_update(F32 dt) deleteNotify(projectile); if (projectile) - projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); + projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString()); } launched = true; @@ -205,10 +205,10 @@ bool afxEA_Projectile::ea_update(F32 dt) if (launched && projectile) { - if (in_scope) + if (mIn_scope) { - updated_xfm = projectile->getRenderTransform(); - updated_xfm.getColumn(3, &updated_pos); + mUpdated_xfm = projectile->getRenderTransform(); + mUpdated_xfm.getColumn(3, &mUpdated_pos); } } @@ -247,7 +247,7 @@ void afxEA_Projectile::do_runtime_substitutions() afxProjectileData* orig_db = (afxProjectileData*)projectile_data; afx_projectile_data = new afxProjectileData(*orig_db, true); projectile_data = afx_projectile_data; - orig_db->performSubstitutions(projectile_data, choreographer, group_index); + orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index); } else { @@ -255,7 +255,7 @@ void afxEA_Projectile::do_runtime_substitutions() ProjectileData* orig_db = projectile_data; afx_projectile_data = 0; projectile_data = new ProjectileData(*orig_db, true); - orig_db->performSubstitutions(projectile_data, choreographer, group_index); + orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index); } } } diff --git a/Engine/source/afx/ea/afxEA_ScriptEvent.cpp b/Engine/source/afx/ea/afxEA_ScriptEvent.cpp index ca5de9966..a80c1b8d2 100644 --- a/Engine/source/afx/ea/afxEA_ScriptEvent.cpp +++ b/Engine/source/afx/ea/afxEA_ScriptEvent.cpp @@ -91,10 +91,10 @@ bool afxEA_ScriptEvent::ea_start() bool afxEA_ScriptEvent::ea_update(F32 dt) { - if (!ran_script && choreographer != NULL) + if (!ran_script && mChoreographer != NULL) { afxConstraint* pos_constraint = getPosConstraint(); - choreographer->executeScriptEvent(script_data->method_name, pos_constraint, updated_xfm, + mChoreographer->executeScriptEvent(script_data->method_name, pos_constraint, mUpdated_xfm, script_data->script_data); ran_script = true; } @@ -115,7 +115,7 @@ void afxEA_ScriptEvent::do_runtime_substitutions() // clone the datablock and perform substitutions afxScriptEventData* orig_db = script_data; script_data = new afxScriptEventData(*orig_db, true); - orig_db->performSubstitutions(script_data, choreographer, group_index); + orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Sound.cpp b/Engine/source/afx/ea/afxEA_Sound.cpp index 3b7f69a88..36ceebcd3 100644 --- a/Engine/source/afx/ea/afxEA_Sound.cpp +++ b/Engine/source/afx/ea/afxEA_Sound.cpp @@ -108,15 +108,15 @@ bool afxEA_Sound::ea_update(F32 dt) { if (!sound_handle) { - sound_handle = SFX->createSource(sound_prof, &updated_xfm, 0); + sound_handle = SFX->createSource(sound_prof, &mUpdated_xfm, 0); if (sound_handle) sound_handle->play(); } if (sound_handle) { - sound_handle->setTransform(updated_xfm); - sound_handle->setVolume((in_scope) ? updated_scale.x*fade_value : 0.0f); + sound_handle->setTransform(mUpdated_xfm); + sound_handle->setVolume((mIn_scope) ? mUpdated_scale.x*mFade_value : 0.0f); deleteNotify(sound_handle); } @@ -134,7 +134,7 @@ void afxEA_Sound::ea_finish(bool was_stopped) void afxEA_Sound::do_runtime_substitutions() { - sound_prof = sound_prof->cloneAndPerformSubstitutions(choreographer, group_index); + sound_prof = sound_prof->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); sound_desc = sound_prof->getDescription(); } diff --git a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp index eebab60c8..9e847fa1e 100644 --- a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp @@ -207,12 +207,12 @@ bool afxEA_T3DSpotLight::ea_update(F32 dt) light->setConstraintObject(cons_obj); #endif - light->setLiveColor(updated_color); + light->setLiveColor(mUpdated_color); - if (do_fades) - light->setFadeAmount(fade_value); + if (mDo_fades) + light->setFadeAmount(mFade_value); - light->updateTransform(updated_xfm); + light->updateTransform(mUpdated_xfm); // scale should not be updated this way. It messes up the culling. //light->setScale(updated_scale); @@ -258,7 +258,7 @@ void afxEA_T3DSpotLight::do_runtime_substitutions() // clone the datablock and perform substitutions afxT3DSpotLightData* orig_db = light_data; light_data = new afxT3DSpotLightData(*orig_db, true); - orig_db->performSubstitutions(light_data, choreographer, group_index); + orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_StaticShape.cpp b/Engine/source/afx/ea/afxEA_StaticShape.cpp index 7f0b35351..20e276335 100644 --- a/Engine/source/afx/ea/afxEA_StaticShape.cpp +++ b/Engine/source/afx/ea/afxEA_StaticShape.cpp @@ -97,7 +97,7 @@ bool afxEA_StaticShape::ea_start() do_runtime_substitutions(); // fades are handled using startFade() calls. - do_fades = false; + mDo_fades = false; return true; } @@ -108,8 +108,8 @@ bool afxEA_StaticShape::ea_update(F32 dt) { // create and register effect static_shape = new afxStaticShape(); - if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) - static_shape->init(choreographer->getChoreographerId(), datablock->effect_name); + if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) + static_shape->init(mChoreographer->getChoreographerId(), mDatablock->effect_name); static_shape->onNewDataBlock(shape_data, false); if (!static_shape->registerObject()) @@ -122,26 +122,26 @@ bool afxEA_StaticShape::ea_update(F32 dt) deleteNotify(static_shape); registerForCleanup(static_shape); - if (ew_timing.fade_in_time > 0.0f) - static_shape->startFade(ew_timing.fade_in_time, 0, false); + if (mEW_timing.fade_in_time > 0.0f) + static_shape->startFade(mEW_timing.fade_in_time, 0, false); } if (static_shape) { - if (!fade_out_started && elapsed > fade_out_start) + if (!fade_out_started && mElapsed > mFade_out_start) { if (!do_spawn) { - if (ew_timing.fade_out_time > 0.0f) - static_shape->startFade(ew_timing.fade_out_time, 0, true); + if (mEW_timing.fade_out_time > 0.0f) + static_shape->startFade(mEW_timing.fade_out_time, 0, true); } fade_out_started = true; } - if (in_scope) + if (mIn_scope) { - static_shape->setTransform(updated_xfm); - static_shape->setScale(updated_scale); + static_shape->setTransform(mUpdated_xfm); + static_shape->setScale(mUpdated_scale); } } @@ -155,7 +155,7 @@ void afxEA_StaticShape::ea_finish(bool was_stopped) if (do_spawn) { - Con::executef(shape_data, "onSpawn", static_shape->getIdString(), datablock->effect_name); + Con::executef(shape_data, "onSpawn", static_shape->getIdString(), mDatablock->effect_name); clearNotify(static_shape); } else @@ -204,13 +204,13 @@ void afxEA_StaticShape::do_runtime_substitutions() { afxStaticShapeData* orig_db = (afxStaticShapeData*)shape_data; shape_data = new afxStaticShapeData(*orig_db, true); - orig_db->performSubstitutions(shape_data, choreographer, group_index); + orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index); } else { StaticShapeData* orig_db = shape_data; shape_data = new StaticShapeData(*orig_db, true); - orig_db->performSubstitutions(shape_data, choreographer, group_index); + orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index); } } } diff --git a/Engine/source/afx/ea/afxEA_Zodiac.cpp b/Engine/source/afx/ea/afxEA_Zodiac.cpp index d5fb5dd9c..9e76f50ad 100644 --- a/Engine/source/afx/ea/afxEA_Zodiac.cpp +++ b/Engine/source/afx/ea/afxEA_Zodiac.cpp @@ -108,16 +108,16 @@ F32 afxEA_Zodiac::calc_facing_angle() inline F32 afxEA_Zodiac::calc_terrain_alt_bias() { - if (terrain_altitude >= zode_data->altitude_max) + if (mTerrain_altitude >= zode_data->altitude_max) return 0.0f; - return 1.0f - (terrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range; + return 1.0f - (mTerrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range; } inline F32 afxEA_Zodiac::calc_interior_alt_bias() { - if (interior_altitude >= zode_data->altitude_max) + if (mInterior_altitude >= zode_data->altitude_max) return 0.0f; - return 1.0f - (interior_altitude - zode_data->altitude_falloff)/altitude_falloff_range; + return 1.0f - (mInterior_altitude - zode_data->altitude_falloff)/altitude_falloff_range; } afxEA_Zodiac::afxEA_Zodiac() @@ -170,13 +170,13 @@ bool afxEA_Zodiac::ea_start() bool afxEA_Zodiac::ea_update(F32 dt) { - if (!in_scope) + if (!mIn_scope) return true; //~~~~~~~~~~~~~~~~~~~~// // Zodiac Color - zode_color = updated_color; + zode_color = mUpdated_color; if (live_color_factor > 0.0) { @@ -190,15 +190,15 @@ bool afxEA_Zodiac::ea_update(F32 dt) //Con::printf("LIVE-COLOR-FACTOR is ZERO"); } - if (do_fades) + if (mDo_fades) { - if (fade_value < 0.01f) + if (mFade_value < 0.01f) return true; // too transparent if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) - zode_color *= fade_value*live_fade_factor; + zode_color *= mFade_value * mLive_fade_factor; else - zode_color.alpha *= fade_value*live_fade_factor; + zode_color.alpha *= mFade_value * mLive_fade_factor; } if (zode_color.alpha < 0.01f) @@ -208,22 +208,22 @@ bool afxEA_Zodiac::ea_update(F32 dt) // Zodiac // scale and grow zode - zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate; + zode_radius = zode_data->radius_xy*mUpdated_scale.x + mLife_elapsed *zode_data->growth_rate; // zode is growing - if (life_elapsed < zode_data->grow_in_time) + if (mLife_elapsed < zode_data->grow_in_time) { - F32 t = life_elapsed/zode_data->grow_in_time; + F32 t = mLife_elapsed /zode_data->grow_in_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f); } // zode is shrinking - else if (full_lifetime - life_elapsed < zode_data->shrink_out_time) + else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time) { - F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time; + F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f); } - zode_radius *= live_scale_factor; + zode_radius *= mLive_scale_factor; if (zode_radius < 0.001f) return true; // too small @@ -238,7 +238,7 @@ bool afxEA_Zodiac::ea_update(F32 dt) //~~~~~~~~~~~~~~~~~~~~// // Zodiac Position - zode_pos = updated_pos; + zode_pos = mUpdated_pos; //~~~~~~~~~~~~~~~~~~~~// // Zodiac Rotation @@ -249,7 +249,7 @@ bool afxEA_Zodiac::ea_update(F32 dt) if (orient_constraint) { VectorF shape_vec; - updated_xfm.getColumn(1, &shape_vec); + mUpdated_xfm.getColumn(1, &shape_vec); shape_vec.z = 0.0f; shape_vec.normalize(); F32 pitch, yaw; @@ -258,14 +258,14 @@ bool afxEA_Zodiac::ea_update(F32 dt) } } - zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor); + zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor); zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f); //~~~~~~~~~~~~~~~~~~~~// // post zodiac if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) { - if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_terrain_alt_bias(); if (alt_bias > 0.0f) @@ -287,7 +287,7 @@ bool afxEA_Zodiac::ea_update(F32 dt) if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0) { - if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_interior_alt_bias(); if (alt_bias > 0.0f) @@ -310,17 +310,17 @@ bool afxEA_Zodiac::ea_update(F32 dt) void afxEA_Zodiac::ea_finish(bool was_stopped) { - if (in_scope && ew_timing.residue_lifetime > 0) + if (mIn_scope && mEW_timing.residue_lifetime > 0) { - if (do_fades) + if (mDo_fades) { - if (fade_value < 0.01f) + if (mFade_value < 0.01f) return; - zode_color.alpha *= fade_value; + zode_color.alpha *= mFade_value; } if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) { - if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_terrain_alt_bias(); if (alt_bias > 0.0f) @@ -332,20 +332,20 @@ void afxEA_Zodiac::ea_finish(bool was_stopped) if (zode_data->altitude_fades) zode_color.alpha *= alt_bias; became_residue = true; - afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, alt_rad, + afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, alt_rad, alt_clr, zode_angle); } } else { became_residue = true; - afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, zode_radius, + afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, zode_radius, zode_color, zode_angle); } } if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0) { - if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_interior_alt_bias(); if (alt_bias > 0.0f) @@ -361,7 +361,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped) if (became_residue) temp_zode = new afxZodiacData(*zode_data, true); became_residue = true; - afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, alt_rad, + afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, alt_rad, zode_vrange, alt_clr, zode_angle); } @@ -372,7 +372,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped) if (became_residue) temp_zode = new afxZodiacData(*zode_data, true); became_residue = true; - afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, zode_radius, + afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, zode_radius, zode_vrange, zode_color, zode_angle); } } @@ -387,7 +387,7 @@ void afxEA_Zodiac::do_runtime_substitutions() // clone the datablock and perform substitutions afxZodiacData* orig_db = zode_data; zode_data = new afxZodiacData(*orig_db, true); - orig_db->performSubstitutions(zode_data, choreographer, group_index); + orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp b/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp index ca4271860..43246f8f1 100644 --- a/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp +++ b/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp @@ -174,42 +174,42 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt) if (pzode) { //LinearColorF zode_color = zode_data->color; - LinearColorF zode_color = updated_color; + LinearColorF zode_color = mUpdated_color; if (live_color_factor > 0.0) zode_color.interpolate(zode_color, live_color, live_color_factor); - if (do_fades) + if (mDo_fades) { if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) - zode_color *= fade_value*live_fade_factor; + zode_color *= mFade_value *mLive_fade_factor; else - zode_color.alpha *= fade_value*live_fade_factor; + zode_color.alpha *= mFade_value * mLive_fade_factor; } // scale and grow zode //F32 zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate; - F32 zode_radius = zode_data->radius_xy + life_elapsed*zode_data->growth_rate; + F32 zode_radius = zode_data->radius_xy + mLife_elapsed *zode_data->growth_rate; // zode is growing - if (life_elapsed < zode_data->grow_in_time) + if (mLife_elapsed < zode_data->grow_in_time) { - F32 t = life_elapsed/zode_data->grow_in_time; + F32 t = mLife_elapsed /zode_data->grow_in_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f); } // zode is shrinking - else if (full_lifetime - life_elapsed < zode_data->shrink_out_time) + else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time) { - F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time; + F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f); } - zode_radius *= live_scale_factor; + zode_radius *= mLive_scale_factor; if (zode_data->respect_ori_cons && !zode_data->use_full_xfm) { VectorF shape_vec; - updated_xfm.getColumn(1, &shape_vec); + mUpdated_xfm.getColumn(1, &shape_vec); shape_vec.normalize(); F32 ang; @@ -246,7 +246,7 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt) zode_angle_offset = mRadToDeg(ang); } - F32 zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor); + F32 zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor); zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f); aa_rot.angle = mDegToRad(zode_angle); @@ -258,13 +258,13 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt) pzode->setRadius(zode_radius); if (zode_data->use_full_xfm) { - updated_xfm.mul(spin_xfm); - pzode->setTransform(updated_xfm); + mUpdated_xfm.mul(spin_xfm); + pzode->setTransform(mUpdated_xfm); } else pzode->setTransform(spin_xfm); - pzode->setPosition(updated_pos); - pzode->setScale(updated_scale); + pzode->setPosition(mUpdated_pos); + pzode->setScale(mUpdated_scale); } return true; @@ -307,7 +307,7 @@ void afxEA_ZodiacPlane::do_runtime_substitutions() // clone the datablock and perform substitutions afxZodiacPlaneData* orig_db = zode_data; zode_data = new afxZodiacPlaneData(*orig_db, true); - orig_db->performSubstitutions(zode_data, choreographer, group_index); + orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/forces/afxEA_Force.cpp b/Engine/source/afx/forces/afxEA_Force.cpp index 7ec2332f1..4f2ac1273 100644 --- a/Engine/source/afx/forces/afxEA_Force.cpp +++ b/Engine/source/afx/forces/afxEA_Force.cpp @@ -95,7 +95,7 @@ bool afxEA_Force::ea_start() do_runtime_substitutions(); - force_set_mgr = choreographer->getForceSetMgr(); + force_set_mgr = mChoreographer->getForceSetMgr(); return true; } @@ -109,7 +109,7 @@ bool afxEA_Force::ea_update(F32 dt) { delete force; force = 0; - Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", datablock->getName()); + Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", mDatablock->getName()); return false; } force->onNewDataBlock(force_data, false); @@ -123,8 +123,8 @@ bool afxEA_Force::ea_update(F32 dt) if (force) // && in_scope) { - if (do_fades) - force->setFadeAmount(fade_value); + if (mDo_fades) + force->setFadeAmount(mFade_value); force->update(dt); } @@ -145,7 +145,7 @@ void afxEA_Force::ea_finish(bool was_stopped) void afxEA_Force::do_runtime_substitutions() { - force_data = force_data->cloneAndPerformSubstitutions(choreographer, group_index); + force_data = force_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp index 02ce4634b..d2be81cc8 100644 --- a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp +++ b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp @@ -60,13 +60,13 @@ class afxXM_AltitudeConform : public afxXM_WeightedBase { typedef afxXM_WeightedBase Parent; - afxXM_AltitudeConformData* db; - SceneContainer* container; - bool do_freeze; - bool is_frozen; - F32 terrain_alt; - F32 interior_alt; - Point3F conformed_pos; + afxXM_AltitudeConformData* mConformData; + SceneContainer* mContainer; + bool mDo_freeze; + bool mIs_frozen; + F32 mTerrain_alt; + F32 mInterior_alt; + Point3F mConformed_pos; public: /*C*/ afxXM_AltitudeConform(afxXM_AltitudeConformData*, afxEffectWrapper*, bool on_server); @@ -157,24 +157,24 @@ afxXM_Base* afxXM_AltitudeConformData::create(afxEffectWrapper* fx, bool on_serv afxXM_AltitudeConform::afxXM_AltitudeConform(afxXM_AltitudeConformData* db, afxEffectWrapper* fxw, bool on_server) : afxXM_WeightedBase(db, fxw) { - this->db = db; - container = (on_server) ? &gServerContainer : &gClientContainer; - do_freeze = db->do_freeze; - is_frozen = false; - terrain_alt = -1.0f; - interior_alt = -1.0f; - conformed_pos.zero(); + mConformData = db; + mContainer = (on_server) ? &gServerContainer : &gClientContainer; + mDo_freeze = db->do_freeze; + mIs_frozen = false; + mTerrain_alt = -1.0f; + mInterior_alt = -1.0f; + mConformed_pos.zero(); } void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) { - if (is_frozen) + if (mIs_frozen) { - if (terrain_alt >= 0.0f) - fx_wrapper->setTerrainAltitude(terrain_alt); - if (interior_alt >= 0.0f) - fx_wrapper->setInteriorAltitude(interior_alt); - params.pos = conformed_pos; + if (mTerrain_alt >= 0.0f) + fx_wrapper->setTerrainAltitude(mTerrain_alt); + if (mInterior_alt >= 0.0f) + fx_wrapper->setInteriorAltitude(mInterior_alt); + params.pos = mConformed_pos; return; } @@ -185,53 +185,51 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para // find primary ground Point3F above_pos(params.pos); above_pos.z += 0.1f; Point3F below_pos(params.pos); below_pos.z -= 10000; - hit1 = container->castRay(above_pos, below_pos, db->interior_types | db->terrain_types, &rInfo1); + hit1 = mContainer->castRay(above_pos, below_pos, mConformData->interior_types | mConformData->terrain_types, &rInfo1); // find secondary ground if (hit1 && rInfo1.object) { - hit1_is_interior = ((rInfo1.object->getTypeMask() & db->interior_types) != 0); - U32 mask = (hit1_is_interior) ? db->terrain_types : db->interior_types; - Point3F above_pos(params.pos); above_pos.z += 0.1f; - Point3F below_pos(params.pos); below_pos.z -= 10000; - hit2 = container->castRay(above_pos, below_pos, mask, &rInfo2); + hit1_is_interior = ((rInfo1.object->getTypeMask() & mConformData->interior_types) != 0); + U32 mask = (hit1_is_interior) ? mConformData->terrain_types : mConformData->interior_types; + hit2 = mContainer->castRay(above_pos, below_pos, mask, &rInfo2); } if (hit1) { F32 wt_factor = calc_weight_factor(elapsed); F32 incoming_z = params.pos.z; - F32 ground1_z = rInfo1.point.z + db->height; + F32 ground1_z = rInfo1.point.z + mConformData->height; F32 pos_z = ground1_z + (1.0f - wt_factor)*(incoming_z - ground1_z); if (hit1_is_interior) { - interior_alt = incoming_z - pos_z; - fx_wrapper->setInteriorAltitude(interior_alt); - if (db->do_interiors) + mInterior_alt = incoming_z - pos_z; + fx_wrapper->setInteriorAltitude(mInterior_alt); + if (mConformData->do_interiors) params.pos.z = pos_z; } else { - terrain_alt = incoming_z - pos_z; - fx_wrapper->setTerrainAltitude(terrain_alt); - if (db->do_terrain) + mTerrain_alt = incoming_z - pos_z; + fx_wrapper->setTerrainAltitude(mTerrain_alt); + if (mConformData->do_terrain) params.pos.z = pos_z; } if (hit2) { - F32 ground2_z = rInfo2.point.z + db->height; + F32 ground2_z = rInfo2.point.z + mConformData->height; F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z); if (hit1_is_interior) { - terrain_alt = incoming_z - z2; - fx_wrapper->setTerrainAltitude(terrain_alt); + mTerrain_alt = incoming_z - z2; + fx_wrapper->setTerrainAltitude(mTerrain_alt); } else { - interior_alt = incoming_z - z2; - fx_wrapper->setInteriorAltitude(interior_alt); + mInterior_alt = incoming_z - z2; + fx_wrapper->setInteriorAltitude(mInterior_alt); } } @@ -241,19 +239,19 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para RayInfo rInfo0; Point3F lookup_from_pos(params.pos); lookup_from_pos.z -= 0.1f; Point3F lookup_to_pos(params.pos); lookup_to_pos.z += 10000; - if (container->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0)) + if (mContainer->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0)) { - F32 ground2_z = rInfo0.point.z + db->height; + F32 ground2_z = rInfo0.point.z + mConformData->height; F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z); - terrain_alt = z2 - incoming_z; - fx_wrapper->setTerrainAltitude(terrain_alt); + mTerrain_alt = z2 - incoming_z; + fx_wrapper->setTerrainAltitude(mTerrain_alt); } } - if (do_freeze) + if (mDo_freeze) { - conformed_pos = params.pos; - is_frozen = true; + mConformed_pos = params.pos; + mIs_frozen = true; } } } diff --git a/Engine/source/afx/xm/afxXM_MountedImageNode.cpp b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp index 8f54f2d9d..b4b244011 100644 --- a/Engine/source/afx/xm/afxXM_MountedImageNode.cpp +++ b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp @@ -63,11 +63,11 @@ class afxXM_MountedImageNode : public afxXM_Base { typedef afxXM_Base Parent; - StringTableEntry node_name; - U32 image_slot; - S32 node_ID; - ShapeBase* shape; - afxConstraint* cons; + StringTableEntry mNode_name; + U32 mImage_slot; + S32 mNode_ID; + ShapeBase* mShape; + afxConstraint* mCons; afxConstraint* find_constraint(); @@ -163,11 +163,11 @@ afxXM_Base* afxXM_MountedImageNodeData::create(afxEffectWrapper* fx, bool on_ser afxXM_MountedImageNode::afxXM_MountedImageNode(afxXM_MountedImageNodeData* db, afxEffectWrapper* fxw) : afxXM_Base(db, fxw) { - image_slot = db->image_slot; - node_name = db->node_name; - cons = 0; - node_ID = -1; - shape = 0; + mImage_slot = db->image_slot; + mNode_name = db->node_name; + mCons = 0; + mNode_ID = -1; + mShape = 0; } // find the first constraint with a shape by checking pos @@ -189,41 +189,41 @@ void afxXM_MountedImageNode::start(F32 timestamp) { // constraint won't change over the modifier's // lifetime so we find it here in start(). - cons = find_constraint(); - if (!cons) + mCons = find_constraint(); + if (!mCons) Con::errorf(ConsoleLogEntry::General, "afxXM_MountedImageNode: failed to find a ShapeBase derived constraint source."); } void afxXM_MountedImageNode::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) { - if (!cons) + if (!mCons) return; // validate shape // The shape must be validated in case it gets deleted // of goes out scope. - SceneObject* scene_object = cons->getSceneObject(); - if (scene_object != (SceneObject*)shape) + SceneObject* scene_object = mCons->getSceneObject(); + if (scene_object != (SceneObject*)mShape) { - shape = dynamic_cast(scene_object); - if (shape && node_name != ST_NULLSTRING) + mShape = dynamic_cast(scene_object); + if (mShape && mNode_name != ST_NULLSTRING) { - node_ID = shape->getNodeIndex(image_slot, node_name); - if (node_ID < 0) + mNode_ID = mShape->getNodeIndex(mImage_slot, mNode_name); + if (mNode_ID < 0) { Con::errorf(ConsoleLogEntry::General, "afxXM_MountedImageNode: failed to find nodeName, \"%s\".", - node_name); + mNode_name); } } else - node_ID = -1; + mNode_ID = -1; } - if (shape) + if (mShape) { - shape->getImageTransform(image_slot, node_ID, ¶ms.ori); + mShape->getImageTransform(mImage_slot, mNode_ID, ¶ms.ori); params.pos = params.ori.getPosition(); } } From 17b627e05f0fed6ffb9f9333c448bdba64121285 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 19:40:34 -0500 Subject: [PATCH 248/312] afxforceset membervar cleanups --- Engine/source/afx/forces/afxForceSet.cpp | 38 ++++++++++++------------ Engine/source/afx/forces/afxForceSet.h | 26 ++++++++-------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Engine/source/afx/forces/afxForceSet.cpp b/Engine/source/afx/forces/afxForceSet.cpp index 49658022f..0d650e3b4 100644 --- a/Engine/source/afx/forces/afxForceSet.cpp +++ b/Engine/source/afx/forces/afxForceSet.cpp @@ -32,21 +32,21 @@ afxForceSet::afxForceSet(const char* name) { - this->name = (name) ? StringTable->insert(name) : ST_NULLSTRING; - update_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it. - elapsed_dt = 0.0f; - elapsed_ms = 0; - num_updates = 0; - last_num_updates = 0; + mName = (name) ? StringTable->insert(name) : ST_NULLSTRING; + mUpdate_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it. + mElapsed_dt = 0.0f; + mElapsed_ms = 0; + mNum_updates = 0; + mLast_num_updates = 0; } void afxForceSet::remove(afxForce* force) { - for (S32 i = 0; i < force_v.size(); i++) + for (S32 i = 0; i < mForce_v.size(); i++) { - if (force_v[i] == force) + if (mForce_v[i] == force) { - force_v.erase(i); + mForce_v.erase(i); return; } } @@ -56,23 +56,23 @@ S32 afxForceSet::updateDT(F32 dt) { U32 now = Platform::getVirtualMilliseconds(); - if (elapsed_ms == now) - return last_num_updates; + if (mElapsed_ms == now) + return mLast_num_updates; - elapsed_ms = now; - elapsed_dt += dt; + mElapsed_ms = now; + mElapsed_dt += dt; - if (elapsed_dt < update_dt) + if (mElapsed_dt < mUpdate_dt) { - last_num_updates = 0; + mLast_num_updates = 0; return 0; } - num_updates = mFloor(elapsed_dt/update_dt); - elapsed_dt -= update_dt*num_updates; - last_num_updates = num_updates; + mNum_updates = mFloor(mElapsed_dt/mUpdate_dt); + mElapsed_dt -= mUpdate_dt*mNum_updates; + mLast_num_updates = mNum_updates; - return num_updates; + return mNum_updates; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/forces/afxForceSet.h b/Engine/source/afx/forces/afxForceSet.h index 8c42a2dd3..7c0cabc54 100644 --- a/Engine/source/afx/forces/afxForceSet.h +++ b/Engine/source/afx/forces/afxForceSet.h @@ -32,28 +32,28 @@ class afxForce; class afxForceSet { - Vector force_v; - StringTableEntry name; + Vector mForce_v; + StringTableEntry mName; // tick-based updating - F32 update_dt; // constant update interval, in seconds - F32 elapsed_dt; // runtime elapsed delta, in seconds - U32 elapsed_ms; - S32 num_updates; - S32 last_num_updates; + F32 mUpdate_dt; // constant update interval, in seconds + F32 mElapsed_dt; // runtime elapsed delta, in seconds + U32 mElapsed_ms; + S32 mNum_updates; + S32 mLast_num_updates; public: /*C*/ afxForceSet(const char* name=0); - void add(afxForce* force) { force_v.push_back(force); } + void add(afxForce* force) { mForce_v.push_back(force); } void remove(afxForce* force); - S32 count() { return force_v.size(); } - afxForce* getForce(S32 idx) { return force_v[idx]; } - const char* getName() const { return name; } + S32 count() { return mForce_v.size(); } + afxForce* getForce(S32 idx) { return mForce_v[idx]; } + const char* getName() const { return mName; } - void setUpdateDT(F32 update_dt) { this->update_dt = update_dt; } - F32 getUpdateDT() { return update_dt; } + void setUpdateDT(F32 update_dt) { mUpdate_dt = update_dt; } + F32 getUpdateDT() { return mUpdate_dt; } S32 updateDT(F32 dt); }; From 0ebd75604d71b2a19631649cf5ca1a37a7997023 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Fri, 30 Mar 2018 02:27:43 -0400 Subject: [PATCH 249/312] Badly sized buffer in dumpConsoleClasses --- Engine/source/console/consoleDoc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index f4b74402b..d9ff78020 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -88,7 +88,7 @@ void printClassHeader(const char* usage, const char * className, const char * su if((usage != NULL) && strlen(usage)) { // Copy Usage Document - S32 usageLen = dStrlen( usage ); + S32 usageLen = dStrlen( usage ) + 1; FrameTemp usageStr( usageLen ); dStrcpy( usageStr, usage, usageLen ); From b486ab73bd53766450caf3e95f2e96fde33e3359 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Fri, 30 Mar 2018 02:28:04 -0400 Subject: [PATCH 250/312] CodeBlock::getFunctionArgs used the wrong offsets --- Engine/source/console/codeBlock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index f8f814f5b..6b60e7789 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -698,10 +698,10 @@ String CodeBlock::getFunctionArgs(U32 ip) { StringBuilder str; - U32 fnArgc = code[ip + 5]; + U32 fnArgc = code[ip + 8]; for (U32 i = 0; i < fnArgc; ++i) { - StringTableEntry var = CodeToSTE(code, ip + (i * 2) + 6); + StringTableEntry var = CodeToSTE(code, ip + (i * 2) + 9); if (i != 0) str.append(", "); From e0b79d4dc89598a7d50dbee807382f4ddbca6c50 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:49:35 -0500 Subject: [PATCH 251/312] afx staticshape membervar cleanups --- Engine/source/afx/ce/afxStaticShape.cpp | 42 ++++++++++++------------- Engine/source/afx/ce/afxStaticShape.h | 12 +++---- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Engine/source/afx/ce/afxStaticShape.cpp b/Engine/source/afx/ce/afxStaticShape.cpp index 5eb4fb815..4bef19629 100644 --- a/Engine/source/afx/ce/afxStaticShape.cpp +++ b/Engine/source/afx/ce/afxStaticShape.cpp @@ -122,11 +122,11 @@ ConsoleDocClass( afxStaticShape, afxStaticShape::afxStaticShape() { - afx_data = 0; - is_visible = true; - chor_id = 0; - hookup_with_chor = false; - ghost_cons_name = ST_NULLSTRING; + mAFX_data = 0; + mIs_visible = true; + mChor_id = 0; + mHookup_with_chor = false; + mGhost_cons_name = ST_NULLSTRING; } afxStaticShape::~afxStaticShape() @@ -135,8 +135,8 @@ afxStaticShape::~afxStaticShape() void afxStaticShape::init(U32 chor_id, StringTableEntry cons_name) { - this->chor_id = chor_id; - ghost_cons_name = cons_name; + mChor_id = chor_id; + mGhost_cons_name = cons_name; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// @@ -147,7 +147,7 @@ bool afxStaticShape::onNewDataBlock(GameBaseData* dptr, bool reload) if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) return false; - afx_data = dynamic_cast(mDataBlock); + mAFX_data = dynamic_cast(mDataBlock); if (!mShapeInstance) return true; @@ -156,10 +156,10 @@ bool afxStaticShape::onNewDataBlock(GameBaseData* dptr, bool reload) // if datablock is afxStaticShapeData we get the sequence setting // directly from the datablock on the client-side only - if (afx_data) + if (mAFX_data) { if (isClientObject()) - seq_name = afx_data->sequence; + seq_name = mAFX_data->sequence; } // otherwise datablock is stock StaticShapeData and we look for // a sequence name on a dynamic field on the server. @@ -188,13 +188,13 @@ void afxStaticShape::advanceTime(F32 dt) { Parent::advanceTime(dt); - if (hookup_with_chor) + if (mHookup_with_chor) { - afxChoreographer* chor = arcaneFX::findClientChoreographer(chor_id); + afxChoreographer* chor = arcaneFX::findClientChoreographer(mChor_id); if (chor) { - chor->setGhostConstraintObject(this, ghost_cons_name); - hookup_with_chor = false; + chor->setGhostConstraintObject(this, mGhost_cons_name); + mHookup_with_chor = false; } } } @@ -206,8 +206,8 @@ U32 afxStaticShape::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) // InitialUpdate if (stream->writeFlag(mask & InitialUpdateMask)) { - stream->write(chor_id); - stream->writeString(ghost_cons_name); + stream->write(mChor_id); + stream->writeString(mGhost_cons_name); } return retMask; @@ -222,11 +222,11 @@ void afxStaticShape::unpackUpdate(NetConnection * conn, BitStream * stream) // InitialUpdate if (stream->readFlag()) { - stream->read(&chor_id); - ghost_cons_name = stream->readSTString(); + stream->read(&mChor_id); + mGhost_cons_name = stream->readSTString(); - if (chor_id != 0 && ghost_cons_name != ST_NULLSTRING) - hookup_with_chor = true; + if (mChor_id != 0 && mGhost_cons_name != ST_NULLSTRING) + mHookup_with_chor = true; } } @@ -234,7 +234,7 @@ void afxStaticShape::unpackUpdate(NetConnection * conn, BitStream * stream) void afxStaticShape::prepRenderImage(SceneRenderState* state) { - if (is_visible) + if (mIs_visible) Parent::prepRenderImage(state); } diff --git a/Engine/source/afx/ce/afxStaticShape.h b/Engine/source/afx/ce/afxStaticShape.h index ed84e0774..ad3c895e3 100644 --- a/Engine/source/afx/ce/afxStaticShape.h +++ b/Engine/source/afx/ce/afxStaticShape.h @@ -66,11 +66,11 @@ class afxStaticShape : public StaticShape private: StaticShapeData* mDataBlock; - afxStaticShapeData* afx_data; - bool is_visible; - U32 chor_id; - bool hookup_with_chor; - StringTableEntry ghost_cons_name; + afxStaticShapeData* mAFX_data; + bool mIs_visible; + U32 mChor_id; + bool mHookup_with_chor; + StringTableEntry mGhost_cons_name; protected: virtual void prepRenderImage(SceneRenderState*); @@ -87,7 +87,7 @@ public: virtual void unpackUpdate(NetConnection*, BitStream*); const char* getShapeFileName() const { return mDataBlock->shapeName; } - void setVisibility(bool flag) { is_visible = flag; } + void setVisibility(bool flag) { mIs_visible = flag; } DECLARE_CONOBJECT(afxStaticShape); DECLARE_CATEGORY("AFX"); From 4375e5f1457bc57d21a8df746110f005ea9bb7a8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:50:12 -0500 Subject: [PATCH 252/312] afx mooring membervar cleanups --- Engine/source/afx/ea/afxEA_Mooring.cpp | 52 +++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_Mooring.cpp b/Engine/source/afx/ea/afxEA_Mooring.cpp index 307575149..76982679b 100644 --- a/Engine/source/afx/ea/afxEA_Mooring.cpp +++ b/Engine/source/afx/ea/afxEA_Mooring.cpp @@ -37,8 +37,8 @@ class afxEA_Mooring : public afxEffectWrapper { typedef afxEffectWrapper Parent; - afxMooringData* mooring_data; - afxMooring* obj; + afxMooringData* mMooring_data; + afxMooring* mObj; void do_runtime_substitutions(); @@ -57,27 +57,27 @@ public: afxEA_Mooring::afxEA_Mooring() { - mooring_data = 0; - obj = 0; + mMooring_data = 0; + mObj = 0; } afxEA_Mooring::~afxEA_Mooring() { - if (obj) - obj->deleteObject(); - if (mooring_data && mooring_data->isTempClone()) - delete mooring_data; - mooring_data = 0; + if (mObj) + mObj->deleteObject(); + if (mMooring_data && mMooring_data->isTempClone()) + delete mMooring_data; + mMooring_data = 0; } void afxEA_Mooring::ea_set_datablock(SimDataBlock* db) { - mooring_data = dynamic_cast(db); + mMooring_data = dynamic_cast(db); } bool afxEA_Mooring::ea_start() { - if (!mooring_data) + if (!mMooring_data) { Con::errorf("afxEA_Mooring::ea_start() -- missing or incompatible datablock."); return false; @@ -90,33 +90,33 @@ bool afxEA_Mooring::ea_start() bool afxEA_Mooring::ea_update(F32 dt) { - if (!obj) + if (!mObj) { if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) { - obj = new afxMooring(mooring_data->networking, + mObj = new afxMooring(mMooring_data->networking, mChoreographer->getChoreographerId(), mDatablock->effect_name); } else { - obj = new afxMooring(mooring_data->networking, 0, ST_NULLSTRING); + mObj = new afxMooring(mMooring_data->networking, 0, ST_NULLSTRING); } - obj->onNewDataBlock(mooring_data, false); - if (!obj->registerObject()) + mObj->onNewDataBlock(mMooring_data, false); + if (!mObj->registerObject()) { - delete obj; - obj = 0; + delete mObj; + mObj = 0; Con::errorf("afxEA_Mooring::ea_update() -- effect failed to register."); return false; } - deleteNotify(obj); + deleteNotify(mObj); } - if (obj) + if (mObj) { - obj->setTransform(mUpdated_xfm); + mObj->setTransform(mUpdated_xfm); } return true; @@ -128,7 +128,7 @@ void afxEA_Mooring::ea_finish(bool was_stopped) void afxEA_Mooring::onDeleteNotify(SimObject* obj) { - if (this->obj == obj) + if (mObj == obj) obj = 0; Parent::onDeleteNotify(obj); @@ -137,12 +137,12 @@ void afxEA_Mooring::onDeleteNotify(SimObject* obj) void afxEA_Mooring::do_runtime_substitutions() { // only clone the datablock if there are substitutions - if (mooring_data->getSubstitutionCount() > 0) + if (mMooring_data->getSubstitutionCount() > 0) { // clone the datablock and perform substitutions - afxMooringData* orig_db = mooring_data; - mooring_data = new afxMooringData(*orig_db, true); - orig_db->performSubstitutions(mooring_data, mChoreographer, mGroup_index); + afxMooringData* orig_db = mMooring_data; + mMooring_data = new afxMooringData(*orig_db, true); + orig_db->performSubstitutions(mMooring_data, mChoreographer, mGroup_index); } } From 58f15d5235671da980d121cd2799c8e6f25678bf Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:51:17 -0500 Subject: [PATCH 253/312] a pair of afx audio-class membervar cleanups --- Engine/source/afx/ea/afxEA_AudioBank.cpp | 4 ++-- Engine/source/afx/ea/afxEA_Sound.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_AudioBank.cpp b/Engine/source/afx/ea/afxEA_AudioBank.cpp index 6ae095dcf..6a52ca345 100644 --- a/Engine/source/afx/ea/afxEA_AudioBank.cpp +++ b/Engine/source/afx/ea/afxEA_AudioBank.cpp @@ -150,7 +150,7 @@ void afxEA_AudioBank::do_runtime_substitutions() class afxEA_SoundBankDesc : public afxEffectAdapterDesc, public afxEffectDefs { - static afxEA_SoundBankDesc desc; + static afxEA_SoundBankDesc mDesc; public: virtual bool testEffectType(const SimDataBlock*) const; @@ -162,7 +162,7 @@ public: virtual afxEffectWrapper* create() const { return new afxEA_AudioBank; } }; -afxEA_SoundBankDesc afxEA_SoundBankDesc::desc; +afxEA_SoundBankDesc afxEA_SoundBankDesc::mDesc; bool afxEA_SoundBankDesc::testEffectType(const SimDataBlock* db) const { diff --git a/Engine/source/afx/ea/afxEA_Sound.cpp b/Engine/source/afx/ea/afxEA_Sound.cpp index 36ceebcd3..335800d84 100644 --- a/Engine/source/afx/ea/afxEA_Sound.cpp +++ b/Engine/source/afx/ea/afxEA_Sound.cpp @@ -150,7 +150,7 @@ void afxEA_Sound::onDeleteNotify(SimObject* obj) class afxEA_SoundDesc : public afxEffectAdapterDesc, public afxEffectDefs { - static afxEA_SoundDesc desc; + static afxEA_SoundDesc mDesc; public: virtual bool testEffectType(const SimDataBlock*) const; @@ -162,7 +162,7 @@ public: virtual afxEffectWrapper* create() const { return new afxEA_Sound; } }; -afxEA_SoundDesc afxEA_SoundDesc::desc; +afxEA_SoundDesc afxEA_SoundDesc::mDesc; bool afxEA_SoundDesc::testEffectType(const SimDataBlock* db) const { From 88cdf37f7d9e5431d6c32f4ed056072bf86e48f9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:51:44 -0500 Subject: [PATCH 254/312] afx camera membervar cleanups --- Engine/source/afx/afxCamera.cpp | 258 ++++++++++++++++---------------- Engine/source/afx/afxCamera.h | 30 ++-- 2 files changed, 144 insertions(+), 144 deletions(-) diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index d6fb5f21b..84acee518 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -99,11 +99,11 @@ afxCamera::afxCamera() { mNetFlags.clear(Ghostable); mTypeMask |= CameraObjectType; - delta.pos = Point3F(0,0,100); - delta.rot = Point3F(0,0,0); - delta.posVec = delta.rotVec = VectorF(0,0,0); - mObjToWorld.setColumn(3,delta.pos); - mRot = delta.rot; + mDelta.pos = Point3F(0,0,100); + mDelta.rot = Point3F(0,0,0); + mDelta.posVec = mDelta.rotVec = VectorF(0,0,0); + mObjToWorld.setColumn(3, mDelta.pos); + mRot = mDelta.rot; mMinOrbitDist = 0; mMaxOrbitDist = 0; @@ -111,19 +111,19 @@ afxCamera::afxCamera() mOrbitObject = NULL; mPosition.set(0.f, 0.f, 0.f); mObservingClientObject = false; - mode = FlyMode; + mMode = FlyMode; - cam_subject = NULL; - coi_offset.set(0, 0, 2); - cam_offset.set(0, 0, 0); - cam_distance = 0.0f; - cam_angle = 0.0f; - cam_dirty = false; + mCam_subject = NULL; + mCoi_offset.set(0, 0, 2); + mCam_offset.set(0, 0, 0); + mCam_distance = 0.0f; + mCam_angle = 0.0f; + mCam_dirty = false; - flymode_saved = false; - third_person_snap_s = 1; - third_person_snap_c = 1; - flymode_saved_pos.zero(); + mFlymode_saved = false; + mThird_person_snap_s = 1; + mThird_person_snap_c = 1; + mFlymode_saved_pos.zero(); mDamageState = Disabled; } @@ -136,7 +136,7 @@ afxCamera::~afxCamera() void afxCamera::cam_update(F32 dt, bool on_server) { - if (mode == ThirdPersonMode && cam_subject) + if (mMode == ThirdPersonMode && mCam_subject) cam_update_3pov(dt, on_server); } @@ -176,9 +176,9 @@ Point3F &afxCamera::getPosition() //---------------------------------------------------------------------------- void afxCamera::setFlyMode() { - mode = FlyMode; - if (flymode_saved) - snapToPosition(flymode_saved_pos); + mMode = FlyMode; + if (mFlymode_saved) + snapToPosition(mFlymode_saved_pos); if (bool(mOrbitObject)) { @@ -202,11 +202,11 @@ void afxCamera::setOrbitMode(GameBase *obj, Point3F &pos, AngAxisF &rot, F32 min processAfter(mOrbitObject); deleteNotify(mOrbitObject); mOrbitObject->getWorldBox().getCenter(&mPosition); - mode = OrbitObjectMode; + mMode = OrbitObjectMode; } else { - mode = OrbitPointMode; + mMode = OrbitPointMode; mPosition = pos; } @@ -278,14 +278,14 @@ void afxCamera::snapToPosition(const Point3F& tPos) { MatrixF transMat; - if (cam_subject) + if (mCam_subject) { // get the subject's transform - MatrixF objToWorld = cam_subject->getRenderTransform(); + MatrixF objToWorld = mCam_subject->getRenderTransform(); // transform the center-of-interest to world-space Point3F objPos; - objToWorld.mulP(coi_offset, &objPos); + objToWorld.mulP(mCoi_offset, &objPos); // find normalized direction vector looking from camera to coi VectorF dirVec = objPos - tPos; @@ -308,31 +308,31 @@ void afxCamera::snapToPosition(const Point3F& tPos) void afxCamera::setCameraSubject(SceneObject* new_subject) { // cleanup any existing chase subject - if (cam_subject) + if (mCam_subject) { - if (dynamic_cast(cam_subject)) + if (dynamic_cast(mCam_subject)) clearProcessAfter(); - clearNotify(cam_subject); + clearNotify(mCam_subject); } - cam_subject = new_subject; + mCam_subject = new_subject; // set associations with new chase subject - if (cam_subject) + if (mCam_subject) { - if (dynamic_cast(cam_subject)) - processAfter((GameBase*)cam_subject); - deleteNotify(cam_subject); + if (dynamic_cast(mCam_subject)) + processAfter((GameBase*)mCam_subject); + deleteNotify(mCam_subject); } - mode = (cam_subject) ? ThirdPersonMode : FlyMode; + mMode = (mCam_subject) ? ThirdPersonMode : FlyMode; setMaskBits(SubjectMask); } void afxCamera::setThirdPersonOffset(const Point3F& offset) { // new method - if (cam_distance > 0.0f) + if (mCam_distance > 0.0f) { if (isClientObject()) { @@ -342,25 +342,25 @@ void afxCamera::setThirdPersonOffset(const Point3F& offset) // this auto switches to/from first person if (conn->isFirstPerson()) { - if (cam_distance >= 1.0f) + if (mCam_distance >= 1.0f) conn->setFirstPerson(false); } else { - if (cam_distance < 1.0f) + if (mCam_distance < 1.0f) conn->setFirstPerson(true); } } } - cam_offset = offset; - cam_dirty = true; + mCam_offset = offset; + mCam_dirty = true; return; } // old backwards-compatible method - if (offset.y != cam_offset.y && isClientObject()) + if (offset.y != mCam_offset.y && isClientObject()) { GameConnection* conn = GameConnection::getConnectionToServer(); if (conn) @@ -379,62 +379,62 @@ void afxCamera::setThirdPersonOffset(const Point3F& offset) } } - cam_offset = offset; - cam_dirty = true; + mCam_offset = offset; + mCam_dirty = true; } void afxCamera::setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset) { - this->coi_offset = coi_offset; + mCoi_offset = coi_offset; setThirdPersonOffset(offset); } void afxCamera::setThirdPersonDistance(F32 distance) { - cam_distance = distance; - cam_dirty = true; + mCam_distance = distance; + mCam_dirty = true; } F32 afxCamera::getThirdPersonDistance() { - return cam_distance; + return mCam_distance; } void afxCamera::setThirdPersonAngle(F32 angle) { - cam_angle = angle; - cam_dirty = true; + mCam_angle = angle; + mCam_dirty = true; } F32 afxCamera::getThirdPersonAngle() { - return cam_angle; + return mCam_angle; } void afxCamera::setThirdPersonMode() { - mode = ThirdPersonMode; - flymode_saved_pos = getPosition(); - flymode_saved = true; - cam_dirty = true; - third_person_snap_s++; + mMode = ThirdPersonMode; + mFlymode_saved_pos = getPosition(); + mFlymode_saved = true; + mCam_dirty = true; + mThird_person_snap_s++; } void afxCamera::setThirdPersonSnap() { - if (mode == ThirdPersonMode) - third_person_snap_s += 2; + if (mMode == ThirdPersonMode) + mThird_person_snap_s += 2; } void afxCamera::setThirdPersonSnapClient() { - if (mode == ThirdPersonMode) - third_person_snap_c++; + if (mMode == ThirdPersonMode) + mThird_person_snap_c++; } const char* afxCamera::getMode() { - switch (mode) + switch (mMode) { case ThirdPersonMode: return "ThirdPerson"; @@ -593,17 +593,17 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) { Point3F goal_pos; Point3F curr_pos = getRenderPosition(); - MatrixF xfm = cam_subject->getRenderTransform(); - Point3F coi = cam_subject->getRenderPosition() + coi_offset; + MatrixF xfm = mCam_subject->getRenderTransform(); + Point3F coi = mCam_subject->getRenderPosition() + mCoi_offset; // for player subjects, pitch is adjusted - Player* player_subj = dynamic_cast(cam_subject); + Player* player_subj = dynamic_cast(mCam_subject); if (player_subj) { - if (cam_distance > 0.0f) + if (mCam_distance > 0.0f) { // rotate xfm by amount of cam_angle - F32 look_yaw = player_subj->getHeadRotation().z + mDegToRad(-cam_angle); + F32 look_yaw = player_subj->getHeadRotation().z + mDegToRad(-mCam_angle); MatrixF look_yaw_mtx(EulerF(0,0,look_yaw)); xfm.mul(look_yaw_mtx); @@ -612,9 +612,9 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) MatrixF head_pitch_mtx(EulerF(head_pitch,0,0)); xfm.mul(head_pitch_mtx); - VectorF behind_vec(0, -cam_distance, 0); + VectorF behind_vec(0, -mCam_distance, 0); xfm.mulP(behind_vec, &goal_pos); - goal_pos += cam_offset; + goal_pos += mCam_offset; } else // old backwards-compatible method { @@ -623,15 +623,15 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) MatrixF head_pitch_mtx(EulerF(head_pitch,0,0)); xfm.mul(head_pitch_mtx); - VectorF behind_vec(0, cam_offset.y, 0); + VectorF behind_vec(0, mCam_offset.y, 0); xfm.mulP(behind_vec, &goal_pos); - goal_pos.z += cam_offset.z; + goal_pos.z += mCam_offset.z; } } // for non-player subjects, camera will follow, but pitch won't adjust. else { - xfm.mulP(cam_offset, &goal_pos); + xfm.mulP(mCam_offset, &goal_pos); } // avoid view occlusion @@ -639,7 +639,7 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) { // snap to final position if path to goal is blocked if (test_blocked_line(curr_pos, goal_pos)) - third_person_snap_c++; + mThird_person_snap_c++; } // place camera into its final position @@ -653,11 +653,11 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) F32 time_inc = 1.0f/speed_factor; // snap to final position - if (on_server || (third_person_snap_c > 0 || dt > time_inc)) + if (on_server || (mThird_person_snap_c > 0 || dt > time_inc)) { snapToPosition(goal_pos); - if (!on_server && third_person_snap_c > 0) - third_person_snap_c--; + if (!on_server && mThird_person_snap_c > 0) + mThird_person_snap_c--; return; } // interpolate to final position @@ -732,13 +732,13 @@ void afxCamera::onDeleteNotify(SimObject *obj) if (obj == (SimObject*)mOrbitObject) { mOrbitObject = NULL; - if (mode == OrbitObjectMode) - mode = OrbitPointMode; + if (mMode == OrbitObjectMode) + mMode = OrbitPointMode; } - if (obj == cam_subject) + if (obj == mCam_subject) { - cam_subject = NULL; + mCam_subject = NULL; } } @@ -748,12 +748,12 @@ void afxCamera::advanceTime(F32 dt) if (gSFX3DWorld) { - if (mode == ThirdPersonMode && cam_subject) + if (mMode == ThirdPersonMode && mCam_subject) { - if (gSFX3DWorld->getListener() != cam_subject) - gSFX3DWorld->setListener(cam_subject); + if (gSFX3DWorld->getListener() != mCam_subject) + gSFX3DWorld->setListener(mCam_subject); } - else if (mode == FlyMode) + else if (mMode == FlyMode) { if (gSFX3DWorld->getListener() != this) gSFX3DWorld->setListener(this); @@ -772,15 +772,15 @@ void afxCamera::processTick(const Move* move) if (move) { // UPDATE ORIENTATION // - delta.rotVec = mRot; - mObjToWorld.getColumn(3, &delta.posVec); + mDelta.rotVec = mRot; + mObjToWorld.getColumn(3, &mDelta.posVec); mRot.x = mClampF(mRot.x + move->pitch, -MaxPitch, MaxPitch); mRot.z += move->yaw; // ORBIT MODE // - if (mode == OrbitObjectMode || mode == OrbitPointMode) + if (mMode == OrbitObjectMode || mMode == OrbitPointMode) { - if(mode == OrbitObjectMode && bool(mOrbitObject)) + if(mMode == OrbitObjectMode && bool(mOrbitObject)) { // If this is a shapebase, use its render eye transform // to avoid jittering. @@ -823,10 +823,10 @@ void afxCamera::processTick(const Move* move) // If on the client, calc delta for backstepping if (isClientObject()) { - delta.pos = pos; - delta.rot = mRot; - delta.posVec = delta.posVec - delta.pos; - delta.rotVec = delta.rotVec - delta.rot; + mDelta.pos = pos; + mDelta.rot = mRot; + mDelta.posVec = mDelta.posVec - mDelta.pos; + mDelta.rotVec = mDelta.rotVec - mDelta.rot; } else { @@ -847,14 +847,14 @@ void afxCamera::interpolateTick(F32 dt) { Parent::interpolateTick(dt); - if (mode == ThirdPersonMode) + if (mMode == ThirdPersonMode) return; - Point3F rot = delta.rot + delta.rotVec * dt; + Point3F rot = mDelta.rot + mDelta.rotVec * dt; - if(mode == OrbitObjectMode || mode == OrbitPointMode) + if(mMode == OrbitObjectMode || mMode == OrbitPointMode) { - if(mode == OrbitObjectMode && bool(mOrbitObject)) + if(mMode == OrbitObjectMode && bool(mOrbitObject)) { // If this is a shapebase, use its render eye transform // to avoid jittering. @@ -880,7 +880,7 @@ void afxCamera::interpolateTick(F32 dt) { // NOTE - posVec is 0,0,0 unless cam is control-object and process tick is // updating the delta - Point3F pos = delta.pos + delta.posVec * dt; + Point3F pos = mDelta.pos + mDelta.posVec * dt; set_cam_pos(pos,rot); } } @@ -896,19 +896,19 @@ void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream) bstream->write(mRot.x); // SND X ROT bstream->write(mRot.z); // SND Z ROT - if (bstream->writeFlag(cam_dirty)) + if (bstream->writeFlag(mCam_dirty)) { - mathWrite(*bstream, cam_offset); // SND CAM_OFFSET - mathWrite(*bstream, coi_offset); // SND COI_OFFSET - bstream->write(cam_distance); - bstream->write(cam_angle); - cam_dirty = false; + mathWrite(*bstream, mCam_offset); // SND CAM_OFFSET + mathWrite(*bstream, mCoi_offset); // SND COI_OFFSET + bstream->write(mCam_distance); + bstream->write(mCam_angle); + mCam_dirty = false; } - U32 writeMode = mode; + U32 writeMode = mMode; Point3F writePos = mPosition; S32 gIndex = -1; - if (mode == OrbitObjectMode) + if (mMode == OrbitObjectMode) { gIndex = bool(mOrbitObject) ? connection->getGhostIndex(mOrbitObject): -1; if(gIndex == -1) @@ -921,9 +921,9 @@ void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream) bstream->writeRangedU32(writeMode, CameraFirstMode, CameraLastMode); // SND MODE if (writeMode == ThirdPersonMode) { - bstream->write(third_person_snap_s > 0); // SND SNAP - if (third_person_snap_s > 0) - third_person_snap_s--; + bstream->write(mThird_person_snap_s > 0); // SND SNAP + if (mThird_person_snap_s > 0) + mThird_person_snap_s--; } if (writeMode == OrbitObjectMode || writeMode == OrbitPointMode) @@ -956,34 +956,34 @@ void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream) Point3F new_cam_offset, new_coi_offset; mathRead(*bstream, &new_cam_offset); // RCV CAM_OFFSET mathRead(*bstream, &new_coi_offset); // RCV COI_OFFSET - bstream->read(&cam_distance); - bstream->read(&cam_angle); + bstream->read(&mCam_distance); + bstream->read(&mCam_angle); setThirdPersonOffset(new_cam_offset, new_coi_offset); } GameBase* obj = 0; - mode = bstream->readRangedU32(CameraFirstMode, // RCV MODE + mMode = bstream->readRangedU32(CameraFirstMode, // RCV MODE CameraLastMode); - if (mode == ThirdPersonMode) + if (mMode == ThirdPersonMode) { bool snap; bstream->read(&snap); if (snap) - third_person_snap_c++; + mThird_person_snap_c++; } mObservingClientObject = false; - if (mode == OrbitObjectMode || mode == OrbitPointMode) { + if (mMode == OrbitObjectMode || mMode == OrbitPointMode) { bstream->read(&mMinOrbitDist); bstream->read(&mMaxOrbitDist); bstream->read(&mCurOrbitDist); - if(mode == OrbitObjectMode) + if(mMode == OrbitObjectMode) { mObservingClientObject = bstream->readFlag(); S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize); obj = static_cast(connection->resolveGhost(gIndex)); } - if (mode == OrbitPointMode) + if (mMode == OrbitPointMode) bstream->readCompressedPoint(&mPosition); } if (obj != (GameBase*)mOrbitObject) { @@ -998,14 +998,14 @@ void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream) } } - if (mode == ThirdPersonMode) + if (mMode == ThirdPersonMode) return; set_cam_pos(pos,rot); - delta.pos = pos; - delta.rot = rot; - delta.rotVec.set(0,0,0); - delta.posVec.set(0,0,0); + mDelta.pos = pos; + mDelta.rot = rot; + mDelta.rotVec.set(0,0,0); + mDelta.posVec.set(0,0,0); } U32 afxCamera::packUpdate(NetConnection* conn, U32 mask, BitStream *bstream) @@ -1029,10 +1029,10 @@ U32 afxCamera::packUpdate(NetConnection* conn, U32 mask, BitStream *bstream) if (bstream->writeFlag(mask & SubjectMask)) { - S32 ghost_id = (cam_subject) ? conn->getGhostIndex(cam_subject) : -1; + S32 ghost_id = (mCam_subject) ? conn->getGhostIndex(mCam_subject) : -1; if (bstream->writeFlag(ghost_id != -1)) bstream->writeRangedU32(U32(ghost_id), 0, NetConnection::MaxGhostCount); - else if (cam_subject) + else if (mCam_subject) retMask |= SubjectMask; } @@ -1057,9 +1057,9 @@ void afxCamera::unpackUpdate(NetConnection *conn, BitStream *bstream) set_cam_pos(pos,rot); // New delta for client side interpolation - delta.pos = pos; - delta.rot = rot; - delta.posVec = delta.rotVec = VectorF(0,0,0); + mDelta.pos = pos; + mDelta.rot = rot; + mDelta.posVec = mDelta.rotVec = VectorF(0,0,0); } if (bstream->readFlag()) @@ -1067,18 +1067,18 @@ void afxCamera::unpackUpdate(NetConnection *conn, BitStream *bstream) if (bstream->readFlag()) { S32 ghost_id = bstream->readRangedU32(0, NetConnection::MaxGhostCount); - cam_subject = dynamic_cast(conn->resolveGhost(ghost_id)); + mCam_subject = dynamic_cast(conn->resolveGhost(ghost_id)); } else - cam_subject = NULL; + mCam_subject = NULL; } } // Override to ensure both are kept in scope void afxCamera::onCameraScopeQuery(NetConnection* conn, CameraScopeQuery* query) { - if (cam_subject) - conn->objectInScope(cam_subject); + if (mCam_subject) + conn->objectInScope(mCam_subject); Parent::onCameraScopeQuery(conn, query); } @@ -1156,7 +1156,7 @@ void afxCamera::setCameraFov(F32 fov) F32 afxCamera::getDamageFlash() const { - if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) + if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) { const GameBase *castObj = mOrbitObject; const ShapeBase* psb = dynamic_cast(castObj); @@ -1169,7 +1169,7 @@ F32 afxCamera::getDamageFlash() const F32 afxCamera::getWhiteOut() const { - if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) + if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) { const GameBase *castObj = mOrbitObject; const ShapeBase* psb = dynamic_cast(castObj); diff --git a/Engine/source/afx/afxCamera.h b/Engine/source/afx/afxCamera.h index 934f293cf..957f182f6 100644 --- a/Engine/source/afx/afxCamera.h +++ b/Engine/source/afx/afxCamera.h @@ -88,9 +88,9 @@ class afxCamera: public ShapeBase }; private: - int mode; + int mMode; Point3F mRot; - StateDelta delta; + StateDelta mDelta; SimObjectPtr mOrbitObject; F32 mMinOrbitDist; @@ -99,17 +99,17 @@ private: Point3F mPosition; bool mObservingClientObject; - SceneObject* cam_subject; - Point3F cam_offset; - Point3F coi_offset; - F32 cam_distance; - F32 cam_angle; - bool cam_dirty; + SceneObject* mCam_subject; + Point3F mCam_offset; + Point3F mCoi_offset; + F32 mCam_distance; + F32 mCam_angle; + bool mCam_dirty; - bool flymode_saved; - Point3F flymode_saved_pos; - S8 third_person_snap_c; - S8 third_person_snap_s; + bool mFlymode_saved; + Point3F mFlymode_saved_pos; + S8 mThird_person_snap_c; + S8 mThird_person_snap_s; void set_cam_pos(const Point3F& pos, const Point3F& viewRot); void cam_update(F32 dt, bool on_server); @@ -130,8 +130,8 @@ public: void setCameraSubject(SceneObject* subject); void setThirdPersonOffset(const Point3F& offset); void setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset); - const Point3F& getThirdPersonOffset() const { return cam_offset; } - const Point3F& getThirdPersonCOIOffset() const { return coi_offset; } + const Point3F& getThirdPersonOffset() const { return mCam_offset; } + const Point3F& getThirdPersonCOIOffset() const { return mCoi_offset; } void setThirdPersonDistance(F32 distance); F32 getThirdPersonDistance(); void setThirdPersonAngle(F32 angle); @@ -147,7 +147,7 @@ public: DECLARE_CATEGORY("AFX"); private: // 3POV SECTION - U32 blockers_mask_3pov; + U32 mBlockers_mask_3pov; void cam_update_3pov(F32 dt, bool on_server); bool avoid_blocked_view(const Point3F& start, const Point3F& end, Point3F& newpos); From fa3839f11cc79e9172ed571da4d80f205e5491f9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:52:22 -0500 Subject: [PATCH 255/312] afx point and spot light membervar cleanups --- Engine/source/afx/ea/afxEA_PointLight_T3D.cpp | 10 +++++----- Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp index d0e87bf19..ebbfecc47 100644 --- a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp @@ -66,10 +66,10 @@ public: class PointLightProxy : public PointLight { - F32 fade_amt; + F32 mFade_amt; public: - PointLightProxy() { fade_amt = 1.0f; } + PointLightProxy() { mFade_amt = 1.0f; } void force_ghost() { @@ -79,7 +79,7 @@ public: void setFadeAmount(F32 fade_amt) { - this->fade_amt = fade_amt; + mFade_amt = fade_amt; mLight->setBrightness(mBrightness*fade_amt); } @@ -125,10 +125,10 @@ public: void submitLights(LightManager* lm, bool staticLighting) { - if (mAnimState.active && mAnimationData && fade_amt < 1.0f) + if (mAnimState.active && mAnimationData && mFade_amt < 1.0f) { F32 mBrightness_save = mBrightness; - mBrightness *= fade_amt; + mBrightness *= mFade_amt; PointLight::submitLights(lm, staticLighting); mBrightness = mBrightness_save; return; diff --git a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp index 9e847fa1e..fac4d4ff0 100644 --- a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp @@ -66,10 +66,10 @@ public: class SpotLightProxy : public SpotLight { - F32 fade_amt; + F32 mFade_amt; public: - SpotLightProxy() { fade_amt = 1.0f; } + SpotLightProxy() { mFade_amt = 1.0f; } void force_ghost() { @@ -79,7 +79,7 @@ public: void setFadeAmount(F32 fade_amt) { - this->fade_amt = fade_amt; + mFade_amt = fade_amt; mLight->setBrightness(mBrightness*fade_amt); } @@ -130,10 +130,10 @@ public: void submitLights(LightManager* lm, bool staticLighting) { - if (mAnimState.active && mAnimationData && fade_amt < 1.0f) + if (mAnimState.active && mAnimationData && mFade_amt < 1.0f) { F32 mBrightness_save = mBrightness; - mBrightness *= fade_amt; + mBrightness *= mFade_amt; SpotLight::submitLights(lm, staticLighting); mBrightness = mBrightness_save; return; From fa6b65a9812ca24c4eec3b7c8f35fe2b1ccdcaee Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:53:07 -0500 Subject: [PATCH 256/312] afx footswitch membervar cleanups --- Engine/source/afx/ea/afxEA_FootSwitch.cpp | 58 +++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_FootSwitch.cpp b/Engine/source/afx/ea/afxEA_FootSwitch.cpp index 7bac59d85..e2cfb016b 100644 --- a/Engine/source/afx/ea/afxEA_FootSwitch.cpp +++ b/Engine/source/afx/ea/afxEA_FootSwitch.cpp @@ -40,8 +40,8 @@ class afxEA_FootSwitch : public afxEffectWrapper { typedef afxEffectWrapper Parent; - afxFootSwitchData* footfall_data; - Player* player; + afxFootSwitchData* mFootfall_data; + Player* mPlayer; void do_runtime_substitutions(); @@ -62,38 +62,38 @@ public: afxEA_FootSwitch::afxEA_FootSwitch() { - footfall_data = 0; - player = 0; + mFootfall_data = 0; + mPlayer = 0; } inline void afxEA_FootSwitch::set_overrides(Player* player) { - if (footfall_data->override_all) + if (mFootfall_data->override_all) player->overrideFootfallFX(); else - player->overrideFootfallFX(footfall_data->override_decals, - footfall_data->override_sounds, - footfall_data->override_dust); + player->overrideFootfallFX(mFootfall_data->override_decals, + mFootfall_data->override_sounds, + mFootfall_data->override_dust); } inline void afxEA_FootSwitch::clear_overrides(Player* player) { - if (footfall_data->override_all) + if (mFootfall_data->override_all) player->restoreFootfallFX(); else - player->restoreFootfallFX(footfall_data->override_decals, - footfall_data->override_sounds, - footfall_data->override_dust); + player->restoreFootfallFX(mFootfall_data->override_decals, + mFootfall_data->override_sounds, + mFootfall_data->override_dust); } void afxEA_FootSwitch::ea_set_datablock(SimDataBlock* db) { - footfall_data = dynamic_cast(db); + mFootfall_data = dynamic_cast(db); } bool afxEA_FootSwitch::ea_start() { - if (!footfall_data) + if (!mFootfall_data) { Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock."); return false; @@ -102,25 +102,25 @@ bool afxEA_FootSwitch::ea_start() do_runtime_substitutions(); afxConstraint* pos_cons = getPosConstraint(); - player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; - if (player) - set_overrides(player); + mPlayer = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; + if (mPlayer) + set_overrides(mPlayer); return true; } bool afxEA_FootSwitch::ea_update(F32 dt) { - if (!player) + if (!mPlayer) return true; afxConstraint* pos_cons = getPosConstraint(); Player* temp_player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; - if (temp_player && temp_player != player) + if (temp_player && temp_player != mPlayer) { - player = temp_player; - if (player) - set_overrides(player); + mPlayer = temp_player; + if (mPlayer) + set_overrides(mPlayer); } return true; @@ -128,24 +128,24 @@ bool afxEA_FootSwitch::ea_update(F32 dt) void afxEA_FootSwitch::ea_finish(bool was_stopped) { - if (!player) + if (!mPlayer) return; afxConstraint* pos_cons = getPosConstraint(); Player* temp_player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; - if (temp_player == player) - clear_overrides(player); + if (temp_player == mPlayer) + clear_overrides(mPlayer); } void afxEA_FootSwitch::do_runtime_substitutions() { // only clone the datablock if there are substitutions - if (footfall_data->getSubstitutionCount() > 0) + if (mFootfall_data->getSubstitutionCount() > 0) { // clone the datablock and perform substitutions - afxFootSwitchData* orig_db = footfall_data; - footfall_data = new afxFootSwitchData(*orig_db, true); - orig_db->performSubstitutions(footfall_data, mChoreographer, mGroup_index); + afxFootSwitchData* orig_db = mFootfall_data; + mFootfall_data = new afxFootSwitchData(*orig_db, true); + orig_db->performSubstitutions(mFootfall_data, mChoreographer, mGroup_index); } } From b7a6f6140c76ed861402eda91598e62a111d64f3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:54:48 -0500 Subject: [PATCH 257/312] afx effect-vector and phrase membervar cleanups --- Engine/source/afx/afxEffectVector.cpp | 144 +++++++++++++------------- Engine/source/afx/afxEffectVector.h | 32 +++--- Engine/source/afx/afxMagicSpell.cpp | 4 +- Engine/source/afx/afxPhrase.cpp | 120 ++++++++++----------- Engine/source/afx/afxPhrase.h | 38 +++---- 5 files changed, 169 insertions(+), 169 deletions(-) diff --git a/Engine/source/afx/afxEffectVector.cpp b/Engine/source/afx/afxEffectVector.cpp index 47e0d1aee..5de0a5e40 100644 --- a/Engine/source/afx/afxEffectVector.cpp +++ b/Engine/source/afx/afxEffectVector.cpp @@ -38,52 +38,52 @@ void afxEffectVector::filter_client_server() if (empty()) return; - for (S32 i = 0; i < fx_v->size(); i++) + for (S32 i = 0; i < mFX_v->size(); i++) { - if ((*fx_v)[i]->mDatablock->runsHere(on_server)) - fx_v2->push_back((*fx_v)[i]); + if ((*mFX_v)[i]->mDatablock->runsHere(mOn_server)) + mFX_v2->push_back((*mFX_v)[i]); else { - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); } void afxEffectVector::calc_fx_dur_and_afterlife() { - total_fx_dur = 0.0f; - after_life = 0.0f; + mTotal_fx_dur = 0.0f; + mAfter_life = 0.0f; if (empty()) return; - for (S32 i = 0; i < fx_v->size(); i++) + for (S32 i = 0; i < mFX_v->size(); i++) { - afxEffectWrapper* ew = (*fx_v)[i]; + afxEffectWrapper* ew = (*mFX_v)[i]; if (ew) { F32 ew_dur; if (ew->mEW_timing.lifetime < 0) { - if (phrase_dur > ew->mEW_timing.delay) - ew_dur = phrase_dur + ew->afterStopTime(); + if (mPhrase_dur > ew->mEW_timing.delay) + ew_dur = mPhrase_dur + ew->afterStopTime(); else ew_dur = ew->mEW_timing.delay + ew->afterStopTime(); } else ew_dur = ew->mEW_timing.delay + ew->mEW_timing.lifetime + ew->mEW_timing.fade_out_time; - if (ew_dur > total_fx_dur) - total_fx_dur = ew_dur; + if (ew_dur > mTotal_fx_dur) + mTotal_fx_dur = ew_dur; F32 after = ew->afterStopTime(); - if (after > after_life) - after_life = after; + if (after > mAfter_life) + mAfter_life = after; } } } @@ -92,19 +92,19 @@ void afxEffectVector::calc_fx_dur_and_afterlife() afxEffectVector::afxEffectVector() { - fx_v = 0; - fx_v2 = 0; - active = false; - on_server = false; - total_fx_dur = 0; - after_life = 0; + mFX_v = 0; + mFX_v2 = 0; + mActive = false; + mOn_server = false; + mTotal_fx_dur = 0; + mAfter_life = 0; } afxEffectVector::~afxEffectVector() { stop(true); - delete fx_v; - delete fx_v2; + delete mFX_v; + delete mFX_v2; } void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effects, bool will_stop, F32 time_factor, @@ -189,7 +189,7 @@ void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effect afxEffectWrapper* effect; effect = afxEffectWrapper::ew_create(chor, ewd, cons_mgr, time_factor, group_index); if (effect) - fx_v->push_back(effect); + mFX_v->push_back(effect); } } else @@ -205,14 +205,14 @@ void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effect void afxEffectVector::ev_init(afxChoreographer* chor, afxEffectList& effects, bool on_server, bool will_stop, F32 time_factor, F32 phrase_dur, S32 group_index) { - this->on_server = on_server; - this->phrase_dur = phrase_dur; + mOn_server = on_server; + mPhrase_dur = phrase_dur; - fx_v = new Vector; + mFX_v = new Vector; effects_init(chor, effects, will_stop, time_factor, group_index); - fx_v2 = new Vector(fx_v->size()); + mFX_v2 = new Vector(mFX_v->size()); } void afxEffectVector::start(F32 timestamp) @@ -222,8 +222,8 @@ void afxEffectVector::start(F32 timestamp) // At this point both client and server effects are in the list. // Timing adjustments are made during prestart(). - for (S32 i = 0; i < fx_v->size(); i++) - (*fx_v)[i]->prestart(); + for (S32 i = 0; i < mFX_v->size(); i++) + (*mFX_v)[i]->prestart(); // duration and afterlife values are pre-calculated here calc_fx_dur_and_afterlife(); @@ -232,58 +232,58 @@ void afxEffectVector::start(F32 timestamp) // don't belong here, filter_client_server(); - active = true; + mActive = true; - for (S32 j = 0; j < fx_v->size(); j++) + for (S32 j = 0; j < mFX_v->size(); j++) { - if ((*fx_v)[j]->start(timestamp)) - fx_v2->push_back((*fx_v)[j]); + if ((*mFX_v)[j]->start(timestamp)) + mFX_v2->push_back((*mFX_v)[j]); else { - delete (*fx_v)[j]; - (*fx_v)[j] = 0; + delete (*mFX_v)[j]; + (*mFX_v)[j] = 0; } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); } void afxEffectVector::update(F32 dt) { if (empty()) { - active = false; + mActive = false; return; } - for (int i = 0; i < fx_v->size(); i++) + for (int i = 0; i < mFX_v->size(); i++) { - (*fx_v)[i]->update(dt); + (*mFX_v)[i]->update(dt); - if ((*fx_v)[i]->isDone() || (*fx_v)[i]->isAborted()) + if ((*mFX_v)[i]->isDone() || (*mFX_v)[i]->isAborted()) { // effect has ended, cleanup and delete - (*fx_v)[i]->cleanup(); - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + (*mFX_v)[i]->cleanup(); + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } else { // effect is still going, so keep it around - fx_v2->push_back((*fx_v)[i]); + mFX_v2->push_back((*mFX_v)[i]); } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); if (empty()) { - active = false; - delete fx_v; fx_v =0; - delete fx_v2; fx_v2 = 0; + mActive = false; + delete mFX_v; mFX_v =0; + delete mFX_v2; mFX_v2 = 0; } } @@ -291,37 +291,37 @@ void afxEffectVector::stop(bool force_cleanup) { if (empty()) { - active = false; + mActive = false; return; } - for (int i = 0; i < fx_v->size(); i++) + for (int i = 0; i < mFX_v->size(); i++) { - (*fx_v)[i]->stop(); + (*mFX_v)[i]->stop(); - if (force_cleanup || (*fx_v)[i]->deleteWhenStopped()) + if (force_cleanup || (*mFX_v)[i]->deleteWhenStopped()) { // effect is over when stopped, cleanup and delete - (*fx_v)[i]->cleanup(); - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + (*mFX_v)[i]->cleanup(); + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } else { // effect needs to fadeout or something, so keep it around - fx_v2->push_back((*fx_v)[i]); + mFX_v2->push_back((*mFX_v)[i]); } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); if (empty()) { - active = false; - delete fx_v; fx_v =0; - delete fx_v2; fx_v2 = 0; + mActive = false; + delete mFX_v; mFX_v =0; + delete mFX_v2; mFX_v2 = 0; } } @@ -329,27 +329,27 @@ void afxEffectVector::interrupt() { if (empty()) { - active = false; + mActive = false; return; } - for (int i = 0; i < fx_v->size(); i++) + for (int i = 0; i < mFX_v->size(); i++) { - (*fx_v)[i]->stop(); - (*fx_v)[i]->cleanup(); - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + (*mFX_v)[i]->stop(); + (*mFX_v)[i]->cleanup(); + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); if (empty()) { - active = false; - delete fx_v; fx_v =0; - delete fx_v2; fx_v2 = 0; + mActive = false; + delete mFX_v; mFX_v =0; + delete mFX_v2; mFX_v2 = 0; } } diff --git a/Engine/source/afx/afxEffectVector.h b/Engine/source/afx/afxEffectVector.h index 49dc11908..837dfe2ce 100644 --- a/Engine/source/afx/afxEffectVector.h +++ b/Engine/source/afx/afxEffectVector.h @@ -37,14 +37,14 @@ class afxChoreographer; class afxEffectVector { - Vector* fx_v; - Vector* fx_v2; + Vector* mFX_v; + Vector* mFX_v2; - bool active; - bool on_server; - F32 phrase_dur; - F32 total_fx_dur; - F32 after_life; + bool mActive; + bool mOn_server; + F32 mPhrase_dur; + F32 mTotal_fx_dur; + F32 mAfter_life; void swap_vecs(); void filter_client_server(); @@ -64,21 +64,21 @@ public: void update(F32 dt); void stop(bool force_cleanup=false); void interrupt(); - bool empty() { return (!fx_v || fx_v->empty()); } - bool isActive() { return active; } - S32 count() { return (fx_v) ? fx_v->size() : 0; } + bool empty() { return (!mFX_v || mFX_v->empty()); } + bool isActive() { return mActive; } + S32 count() { return (mFX_v) ? mFX_v->size() : 0; } - F32 getTotalDur() { return total_fx_dur; } - F32 getAfterLife() { return after_life; } + F32 getTotalDur() { return mTotal_fx_dur; } + F32 getAfterLife() { return mAfter_life; } - Vector* getFX() { return fx_v; } + Vector* getFX() { return mFX_v; } }; inline void afxEffectVector::swap_vecs() { - Vector* tmp = fx_v; - fx_v = fx_v2; - fx_v2 = tmp; + Vector* tmp = mFX_v; + mFX_v = mFX_v2; + mFX_v2 = tmp; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index f9fb2ba01..513df0d13 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -604,9 +604,9 @@ void CastingPhrase_C::update(F32 dt, F32 timestamp) if (!mNotify_castbar) return; - if (dur > 0 && n_loops > 0) + if (mDur > 0 && mNum_loops > 0) { - F32 nfrac = (timestamp - starttime)/(dur*n_loops); + F32 nfrac = (timestamp - mStartTime)/(mDur*mNum_loops); if (nfrac - mCastbar_progress > 1.0f/200.0f) { mCastbar_progress = (nfrac < 1.0f) ? nfrac : 1.0f; diff --git a/Engine/source/afx/afxPhrase.cpp b/Engine/source/afx/afxPhrase.cpp index 3e0a2bee0..3f4e44167 100644 --- a/Engine/source/afx/afxPhrase.cpp +++ b/Engine/source/afx/afxPhrase.cpp @@ -34,51 +34,51 @@ void afxPhrase::init_fx(S32 group_index) { - fx->ev_init(init_chor, *init_fx_list, on_server, will_stop, init_time_factor, init_dur, group_index); + mFX->ev_init(mInit_chor, *mInit_fx_list, mOn_server, mWill_stop, mInit_time_factor, mInit_dur, group_index); } //~~~~~~~~~~~~~~~~~~~~// afxPhrase::afxPhrase(bool on_server, bool will_stop) { - this->on_server = on_server; - this->will_stop = will_stop; + mOn_server = on_server; + mWill_stop = will_stop; - init_fx_list = NULL; - init_dur = 0.0f; - init_chor = NULL; - init_time_factor = 1.0f; + mInit_fx_list = NULL; + mInit_dur = 0.0f; + mInit_chor = NULL; + mInit_time_factor = 1.0f; - fx = new afxEffectVector; - fx2 = NULL; - starttime = 0; - dur = 0; + mFX = new afxEffectVector; + mFX2 = NULL; + mStartTime = 0; + mDur = 0; - n_loops = 1; - loop_cnt = 1; + mNum_loops = 1; + mLoop_cnt = 1; - extra_time = 0.0f; - extra_stoptime = 0.0f; + mExtra_time = 0.0f; + mExtra_stoptime = 0.0f; } afxPhrase::~afxPhrase() { - delete fx; - delete fx2; + delete mFX; + delete mFX2; }; void afxPhrase::init(afxEffectList& fx_list, F32 dur, afxChoreographer* chor, F32 time_factor, S32 n_loops, S32 group_index, F32 extra_time) { - init_fx_list = &fx_list; - init_dur = dur; - init_chor = chor; - init_time_factor = time_factor; + mInit_fx_list = &fx_list; + mInit_dur = dur; + mInit_chor = chor; + mInit_time_factor = time_factor; - this->n_loops = n_loops; - this->extra_time = extra_time; - this->dur = (init_dur < 0) ? init_dur : init_dur*init_time_factor; + mNum_loops = n_loops; + mExtra_time = extra_time; + mDur = (mInit_dur < 0) ? mInit_dur : mInit_dur*mInit_time_factor; init_fx(group_index); } @@ -86,30 +86,30 @@ afxPhrase::init(afxEffectList& fx_list, F32 dur, afxChoreographer* chor, F32 tim void afxPhrase::start(F32 startstamp, F32 timestamp) { - starttime = startstamp; + mStartTime = startstamp; F32 loopstart = timestamp - startstamp; - if (dur > 0 && loopstart > dur) + if (mDur > 0 && loopstart > mDur) { - loop_cnt += (S32) (loopstart/dur); - loopstart = mFmod(loopstart, dur); + mLoop_cnt += (S32) (loopstart/ mDur); + loopstart = mFmod(loopstart, mDur); } - if (!fx->empty()) - fx->start(loopstart); + if (!mFX->empty()) + mFX->start(loopstart); } void afxPhrase::update(F32 dt, F32 timestamp) { - if (fx->isActive()) - fx->update(dt); + if (mFX->isActive()) + mFX->update(dt); - if (fx2 && fx2->isActive()) - fx2->update(dt); + if (mFX2 && mFX2->isActive()) + mFX2->update(dt); - if (extra_stoptime > 0 && timestamp > extra_stoptime) + if (mExtra_stoptime > 0 && timestamp > mExtra_stoptime) { stop(timestamp); } @@ -118,54 +118,54 @@ afxPhrase::update(F32 dt, F32 timestamp) void afxPhrase::stop(F32 timestamp) { - if (extra_time > 0 && !(extra_stoptime > 0)) + if (mExtra_time > 0 && !(mExtra_stoptime > 0)) { - extra_stoptime = timestamp + extra_time; + mExtra_stoptime = timestamp + mExtra_time; return; } - if (fx->isActive()) - fx->stop(); + if (mFX->isActive()) + mFX->stop(); - if (fx2 && fx2->isActive()) - fx2->stop(); + if (mFX2 && mFX2->isActive()) + mFX2->stop(); } bool afxPhrase::expired(F32 timestamp) { - if (dur < 0) + if (mDur < 0) return false; - return ((timestamp - starttime) > loop_cnt*dur); + return ((timestamp - mStartTime) > mLoop_cnt*mDur); } F32 afxPhrase::elapsed(F32 timestamp) { - return (timestamp - starttime); + return (timestamp - mStartTime); } bool afxPhrase::recycle(F32 timestamp) { - if (n_loops < 0 || loop_cnt < n_loops) + if (mNum_loops < 0 || mLoop_cnt < mNum_loops) { - if (fx2) - delete fx2; + if (mFX2) + delete mFX2; - fx2 = fx; + mFX2 = mFX; - fx = new afxEffectVector; + mFX = new afxEffectVector; init_fx(); - if (fx2 && !fx2->empty()) - fx2->stop(); + if (mFX2 && !mFX2->empty()) + mFX2->stop(); - if (!fx->empty()) - fx->start(0.0F); + if (!mFX->empty()) + mFX->start(0.0F); - loop_cnt++; + mLoop_cnt++; return true; } @@ -175,21 +175,21 @@ afxPhrase::recycle(F32 timestamp) void afxPhrase::interrupt(F32 timestamp) { - if (fx->isActive()) - fx->interrupt(); + if (mFX->isActive()) + mFX->interrupt(); - if (fx2 && fx2->isActive()) - fx2->interrupt(); + if (mFX2 && mFX2->isActive()) + mFX2->interrupt(); } F32 afxPhrase::calcDoneTime() { - return starttime + fx->getTotalDur(); + return mStartTime + mFX->getTotalDur(); } F32 afxPhrase::calcAfterLife() { - return fx->getAfterLife(); + return mFX->getAfterLife(); } diff --git a/Engine/source/afx/afxPhrase.h b/Engine/source/afx/afxPhrase.h index 2525c2656..12803dc5f 100644 --- a/Engine/source/afx/afxPhrase.h +++ b/Engine/source/afx/afxPhrase.h @@ -38,23 +38,23 @@ class afxEffectVector; class afxPhrase { protected: - afxEffectList* init_fx_list; - F32 init_dur; - afxChoreographer* init_chor; - F32 init_time_factor; - F32 extra_time; + afxEffectList* mInit_fx_list; + F32 mInit_dur; + afxChoreographer* mInit_chor; + F32 mInit_time_factor; + F32 mExtra_time; - afxEffectVector* fx; - afxEffectVector* fx2; + afxEffectVector* mFX; + afxEffectVector* mFX2; - bool on_server; - bool will_stop; + bool mOn_server; + bool mWill_stop; - F32 starttime; - F32 dur; - S32 n_loops; - S32 loop_cnt; - F32 extra_stoptime; + F32 mStartTime; + F32 mDur; + S32 mNum_loops; + S32 mLoop_cnt; + F32 mExtra_stoptime; void init_fx(S32 group_index=0); @@ -73,13 +73,13 @@ public: virtual bool recycle(F32 timestamp); virtual F32 elapsed(F32 timestamp); - bool isEmpty() { return fx->empty(); } - bool isInfinite() { return (init_dur < 0); } + bool isEmpty() { return mFX->empty(); } + bool isInfinite() { return (mInit_dur < 0); } F32 calcDoneTime(); F32 calcAfterLife(); - bool willStop() { return will_stop; } - bool onServer() { return on_server; } - S32 count() { return fx->count(); } + bool willStop() { return mWill_stop; } + bool onServer() { return mOn_server; } + S32 count() { return mFX->count(); } }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// From c386e90348e04b18de816dc7e2aaa1290b106410 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 1 Apr 2018 17:48:10 -0500 Subject: [PATCH 258/312] further membervar issue with PolyhedronFixedVectorData template found with clang. --- Engine/source/math/mPolyhedron.h | 10 +++++----- Templates/AFXDemo/game/shaders/procedural/.gitignore | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 Templates/AFXDemo/game/shaders/procedural/.gitignore diff --git a/Engine/source/math/mPolyhedron.h b/Engine/source/math/mPolyhedron.h index e7054423f..8888d531d 100644 --- a/Engine/source/math/mPolyhedron.h +++ b/Engine/source/math/mPolyhedron.h @@ -254,23 +254,23 @@ struct PolyhedronFixedVectorData : public PolyhedronData /// @{ /// Return the number of planes that make up this polyhedron. - U32 getNumPlanes() const { return planeList.size(); } + U32 getNumPlanes() const { return mPlaneList.size(); } /// Return the planes that make up the polyhedron. /// @note The normals of these planes are facing *inwards*. - PlaneF* getPlanes() const { return planeList.address(); } + PlaneF* getPlanes() const { return mPlaneList.address(); } /// Return the number of points that this polyhedron has. - U32 getNumPoints() const { return pointList.size(); } + U32 getNumPoints() const { return mPointList.size(); } /// - Point3F* getPoints() const { return pointList.address(); } + Point3F* getPoints() const { return mPointList.address(); } /// Return the number of edges that this polyhedron has. U32 getNumEdges() const { return edgeList.size(); } /// - Edge* getEdges() const { return edgeList.address(); } + Edge* getEdges() const { return mEdgeList.address(); } /// @} diff --git a/Templates/AFXDemo/game/shaders/procedural/.gitignore b/Templates/AFXDemo/game/shaders/procedural/.gitignore new file mode 100644 index 000000000..1bc0e838a --- /dev/null +++ b/Templates/AFXDemo/game/shaders/procedural/.gitignore @@ -0,0 +1 @@ +# Keep directory in git repo From 0c316dab469b8287c29bc7eabf050fa23e5b4b8c Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 1 Apr 2018 23:16:13 -0500 Subject: [PATCH 259/312] Revert "collada/ts chain shadowvar and member var clenaups" This reverts commit 3ce15b33eb9375cc05298273a2029438b10f5216. --- Engine/source/ts/collada/colladaAppMesh.cpp | 14 +- Engine/source/ts/collada/colladaImport.cpp | 6 +- .../source/ts/collada/colladaShapeLoader.cpp | 22 +- Engine/source/ts/collada/colladaUtils.cpp | 4 +- Engine/source/ts/loader/tsShapeLoader.cpp | 454 +++++++++--------- Engine/source/ts/loader/tsShapeLoader.h | 28 +- 6 files changed, 264 insertions(+), 264 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index 5a928dae0..c1420d1cd 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -147,12 +147,12 @@ private: end = start; // Get the set for this input - domInputLocalOffset* localOffset = daeSafeCast(input); + const domInputLocalOffset* localOffset = daeSafeCast(input); domUint newSet = localOffset ? localOffset->getSet() : 0; // Add the input to the right place in the list (somewhere between start and end) for (S32 i = start; i <= end; i++) { - localOffset = daeSafeCast(sortedInputs[i]); + const domInputLocalOffset* localOffset = daeSafeCast(sortedInputs[i]); domUint set = localOffset ? localOffset->getSet() : 0xFFFFFFFF; if (newSet < set) { for (S32 j = i + 1; j <= end; j++) @@ -181,10 +181,10 @@ private: const char* semantic = SourceTypeToSemantic( type ); for (S32 iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++) { - domInputLocal* vInput = vertices->getInput_array().get(iInput); - if (dStrEqual(vInput->getSemantic(), semantic)) + domInputLocal* input = vertices->getInput_array().get(iInput); + if (dStrEqual(input->getSemantic(), semantic)) { - source = daeSafeCast(findInputSource(vInput)); + source = daeSafeCast(findInputSource(input)); break; } } @@ -966,7 +966,7 @@ void ColladaAppMesh::lookupSkinData() // Determine the offset into the vindices array for each vertex (since each // vertex may have multiple [bone, weight] pairs in the array) Vector vindicesOffset; - domInt* vindices = (domInt*)weights_v.getRaw(0); + const domInt* vindices = (domInt*)weights_v.getRaw(0); for (S32 iWeight = 0; iWeight < weights_vcount.getCount(); iWeight++) { // Store the offset into the vindices array for this vertex vindicesOffset.push_back(vindices - (domInt*)weights_v.getRaw(0)); @@ -977,7 +977,7 @@ void ColladaAppMesh::lookupSkinData() bool tooManyWeightsWarning = false; for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); - vindices = (domInt*)weights_v.getRaw(0); + const domInt* vindices = (domInt*)weights_v.getRaw(0); vindices += vindicesOffset[vertTuples[iVert].vertex]; S32 nonZeroWeightCount = 0; diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index ded830d5c..1cc2909b0 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -120,9 +120,9 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen for (S32 i = 0; i < node->getInstance_node_array().getCount(); i++) { domInstance_node* instnode = node->getInstance_node_array()[i]; - domNode* dNode = daeSafeCast(instnode->getUrl().getElement()); - if (dNode) - processNode(tree, dNode, nodeID, stats); + domNode* node = daeSafeCast(instnode->getUrl().getElement()); + if (node) + processNode(tree, node, nodeID, stats); } } diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 1ac98e072..afb53fdaf 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -239,14 +239,14 @@ void ColladaShapeLoader::enumerateScene() for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) { const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib]; for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++) - mAppSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); + appSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); } // Process all animations => this attaches animation channels to the targeted // Collada elements, and determines the length of the sequence if it is not // already specified in the Collada element - for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { - ColladaAppSequence* appSeq = dynamic_cast(mAppSequences[iSeq]); + for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { + ColladaAppSequence* appSeq = dynamic_cast(appSequences[iSeq]); F32 maxEndTime = 0; F32 minFrameTime = 1000.0f; for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) { @@ -317,7 +317,7 @@ void ColladaShapeLoader::enumerateScene() } // Make sure that the scene has a bounds node (for getting the root scene transform) - if (!mBoundsNode) + if (!boundsNode) { domVisual_scene* visualScene = root->getLibrary_visual_scenes_array()[0]->getVisual_scene_array()[0]; domNode* dombounds = daeSafeCast( visualScene->createAndPlace( "node" ) ); @@ -354,7 +354,7 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) ColladaUtils::getOptions().adjustFloor) ) { // Compute shape offset - Point3F shapeOffset = Point3F::Zero; + Point3F shapeOffset = Point3F::Zero; if ( ColladaUtils::getOptions().adjustCenter ) { bounds.getCenter( &shapeOffset ); @@ -368,24 +368,24 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) bounds.maxExtents += shapeOffset; // Now adjust all positions for root level nodes (nodes with no parent) - for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++) + for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++) { - if ( !mAppNodes[iNode]->isParentRoot() ) + if ( !appNodes[iNode]->isParentRoot() ) continue; // Adjust default translation - mShape->defaultTranslations[iNode] += shapeOffset; + shape->defaultTranslations[iNode] += shapeOffset; // Adjust animated translations - for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++) { - const TSShape::Sequence& seq = mShape->sequences[iSeq]; + const TSShape::Sequence& seq = shape->sequences[iSeq]; if ( seq.translationMatters.test(iNode) ) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame; - mShape->nodeTranslations[index] += shapeOffset; + shape->nodeTranslations[index] += shapeOffset; } } } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index 974d2a8ed..c9b7872b1 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -266,10 +266,10 @@ void AnimData::parseTargetString(const char* target, S32 fullCount, const char* targetValueCount = 1; } } - else if (const char* p2 = dStrrchr(target, '.')) { + else if (const char* p = dStrrchr(target, '.')) { // Check for named elements for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) { - if (!dStrcmp(p2, elements[iElem])) { + if (!dStrcmp(p, elements[iElem])) { targetValueOffset = iElem; targetValueCount = 1; break; diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 35cc9c8bd..11779eb6b 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -44,7 +44,7 @@ const F32 TSShapeLoader::DefaultTime = -1.0f; const F64 TSShapeLoader::MinFrameRate = 15.0f; const F64 TSShapeLoader::MaxFrameRate = 60.0f; const F64 TSShapeLoader::AppGroundFrameRate = 10.0f; -Torque::Path TSShapeLoader::mShapePath; +Torque::Path TSShapeLoader::shapePath; Vector TSShapeLoader::smFormats; @@ -73,7 +73,7 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) if (node->mParentIndex >= 0) { - AppNode *parent = mAppNodes[node->mParentIndex]; + AppNode *parent = appNodes[node->mParentIndex]; MatrixF m2 = parent->getNodeTransform(t); @@ -84,10 +84,10 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) // get local transform by pre-multiplying by inverted parent transform m1 = m2.inverse() * m1; } - else if (mBoundsNode && node != mBoundsNode) + else if (boundsNode && node != boundsNode) { // make transform relative to bounds node transform at time=t - MatrixF mb = mBoundsNode->getNodeTransform(t); + MatrixF mb = boundsNode->getNodeTransform(t); zapScale(mb); m1 = mb.inverse() * m1; } @@ -133,22 +133,22 @@ void TSShapeLoader::updateProgress(S32 major, const char* msg, S32 numMinor, S32 TSShape* TSShapeLoader::generateShape(const Torque::Path& path) { - mShapePath = path; - mShape = new TSShape(); + shapePath = path; + shape = new TSShape(); - mShape->mExporterVersion = 124; - mShape->mSmallestVisibleSize = 999999; - mShape->mSmallestVisibleDL = 0; - mShape->mReadVersion = 24; - mShape->mFlags = 0; - mShape->mSequencesConstructed = 0; + shape->mExporterVersion = 124; + shape->mSmallestVisibleSize = 999999; + shape->mSmallestVisibleDL = 0; + shape->mReadVersion = 24; + shape->mFlags = 0; + shape->mSequencesConstructed = 0; // Get all nodes, objects and sequences in the shape updateProgress(Load_EnumerateScene, "Enumerating scene..."); enumerateScene(); - if (!mSubshapes.size()) + if (!subshapes.size()) { - delete mShape; + delete shape; Con::errorf("Failed to load shape \"%s\", no subshapes found", path.getFullPath().c_str()); return NULL; } @@ -178,7 +178,7 @@ TSShape* TSShapeLoader::generateShape(const Torque::Path& path) // Install the TS memory helper into a TSShape object. install(); - return mShape; + return shape; } bool TSShapeLoader::processNode(AppNode* node) @@ -186,20 +186,20 @@ bool TSShapeLoader::processNode(AppNode* node) // Detect bounds node if ( node->isBounds() ) { - if ( mBoundsNode ) + if ( boundsNode ) { Con::warnf( "More than one bounds node found" ); return false; } - mBoundsNode = node; + boundsNode = node; // Process bounds geometry - MatrixF boundsMat(mBoundsNode->getNodeTransform(DefaultTime)); + MatrixF boundsMat(boundsNode->getNodeTransform(DefaultTime)); boundsMat.inverse(); zapScale(boundsMat); - for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = mBoundsNode->getMesh(iMesh); + AppMesh* mesh = boundsNode->getMesh(iMesh); MatrixF transform = mesh->getMeshTransform(DefaultTime); transform.mulL(boundsMat); mesh->lockMesh(DefaultTime, transform); @@ -215,10 +215,10 @@ bool TSShapeLoader::processNode(AppNode* node) } // Add this node to the subshape (create one if needed) - if (mSubshapes.size() == 0 ) - mSubshapes.push_back( new TSShapeLoader::Subshape ); + if ( subshapes.size() == 0 ) + subshapes.push_back( new TSShapeLoader::Subshape ); - mSubshapes.last()->branches.push_back( node ); + subshapes.last()->branches.push_back( node ); return true; } @@ -263,8 +263,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (appNode->isBounds()) return; - S32 subShapeNum = mShape->subShapeFirstNode.size()-1; - Subshape* subshape = mSubshapes[subShapeNum]; + S32 subShapeNum = shape->subShapeFirstNode.size()-1; + Subshape* subshape = subshapes[subShapeNum]; // Check if we should collapse this node S32 myIndex; @@ -275,16 +275,16 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu else { // Check that adding this node will not exceed the maximum node count - if (mShape->nodes.size() >= MAX_TS_SET_SIZE) + if (shape->nodes.size() >= MAX_TS_SET_SIZE) return; - myIndex = mShape->nodes.size(); - String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->names); + myIndex = shape->nodes.size(); + String nodeName = getUniqueName(appNode->getName(), cmpShapeName, shape->names); // Create the 3space node - mShape->nodes.increment(); - TSShape::Node& lastNode = mShape->nodes.last(); - lastNode.nameIndex = mShape->addName(nodeName); + shape->nodes.increment(); + TSShape::Node& lastNode = shape->nodes.last(); + lastNode.nameIndex = shape->addName(nodeName); lastNode.parentIndex = parentIndex; lastNode.firstObject = -1; lastNode.firstChild = -1; @@ -292,8 +292,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu // Add the AppNode to a matching list (so AppNodes can be accessed using 3space // node indices) - mAppNodes.push_back(appNode); - mAppNodes.last()->mParentIndex = parentIndex; + appNodes.push_back(appNode); + appNodes.last()->mParentIndex = parentIndex; // Check for NULL detail or AutoBillboard nodes (no children or geometry) if ((appNode->getNumChildNodes() == 0) && @@ -304,7 +304,7 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (dStrEqual(dname, "nulldetail") && (size != 0x7FFFFFFF)) { - mShape->addDetail("detail", size, subShapeNum); + shape->addDetail("detail", size, subShapeNum); } else if (appNode->isBillboard() && (size != 0x7FFFFFFF)) { @@ -323,9 +323,9 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu appNode->getInt("BB::DIM", dim); appNode->getBool("BB::INCLUDE_POLES", includePoles); - S32 detIndex = mShape->addDetail( "bbDetail", size, -1 ); + S32 detIndex = shape->addDetail( "bbDetail", size, -1 ); - TSShape::Detail& detIndexDetail = mShape->details[detIndex]; + TSShape::Detail& detIndexDetail = shape->details[detIndex]; detIndexDetail.bbEquatorSteps = numEquatorSteps; detIndexDetail.bbPolarSteps = numPolarSteps; detIndexDetail.bbDetailLevel = dl; @@ -357,23 +357,23 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu void TSShapeLoader::generateSubshapes() { - for (U32 iSub = 0; iSub < mSubshapes.size(); iSub++) + for (U32 iSub = 0; iSub < subshapes.size(); iSub++) { - updateProgress(Load_GenerateSubshapes, "Generating subshapes...", mSubshapes.size(), iSub); + updateProgress(Load_GenerateSubshapes, "Generating subshapes...", subshapes.size(), iSub); - Subshape* subshape = mSubshapes[iSub]; + Subshape* subshape = subshapes[iSub]; // Recurse through the node hierarchy, adding 3space nodes and // collecting geometry - S32 firstNode = mShape->nodes.size(); - mShape->subShapeFirstNode.push_back(firstNode); + S32 firstNode = shape->nodes.size(); + shape->subShapeFirstNode.push_back(firstNode); for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++) recurseSubshape(subshape->branches[iBranch], -1, true); - mShape->subShapeNumNodes.push_back(mShape->nodes.size() - firstNode); + shape->subShapeNumNodes.push_back(shape->nodes.size() - firstNode); - if (mShape->nodes.size() >= MAX_TS_SET_SIZE) + if (shape->nodes.size() >= MAX_TS_SET_SIZE) { Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.", MAX_TS_SET_SIZE); @@ -400,10 +400,10 @@ bool cmpMeshNameAndSize(const String& key, const Vector& names, void* ar void TSShapeLoader::generateObjects() { - for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) + for (S32 iSub = 0; iSub < subshapes.size(); iSub++) { - Subshape* subshape = mSubshapes[iSub]; - mShape->subShapeFirstObject.push_back(mShape->objects.size()); + Subshape* subshape = subshapes[iSub]; + shape->subShapeFirstObject.push_back(shape->objects.size()); // Get the names and sizes of the meshes for this subshape Vector meshNames; @@ -464,18 +464,18 @@ void TSShapeLoader::generateObjects() if (!lastName || (meshNames[iMesh] != *lastName)) { - mShape->objects.increment(); - TSShape::Object& lastObject = mShape->objects.last(); - lastObject.nameIndex = mShape->addName(meshNames[iMesh]); + shape->objects.increment(); + TSShape::Object& lastObject = shape->objects.last(); + lastObject.nameIndex = shape->addName(meshNames[iMesh]); lastObject.nodeIndex = subshape->objNodes[iMesh]; - lastObject.startMeshIndex = mAppMeshes.size(); + lastObject.startMeshIndex = appMeshes.size(); lastObject.numMeshes = 0; lastName = &meshNames[iMesh]; } // Add this mesh to the object - mAppMeshes.push_back(mesh); - mShape->objects.last().numMeshes++; + appMeshes.push_back(mesh); + shape->objects.last().numMeshes++; // Set mesh flags mesh->flags = 0; @@ -498,9 +498,9 @@ void TSShapeLoader::generateObjects() } // Attempt to add the detail (will fail if it already exists) - S32 oldNumDetails = mShape->details.size(); - mShape->addDetail(detailName, mesh->detailSize, iSub); - if (mShape->details.size() > oldNumDetails) + S32 oldNumDetails = shape->details.size(); + shape->addDetail(detailName, mesh->detailSize, iSub); + if (shape->details.size() > oldNumDetails) { Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has" " been added automatically)", mesh->getName(false), detailName, mesh->detailSize); @@ -508,18 +508,18 @@ void TSShapeLoader::generateObjects() } // Get object count for this subshape - mShape->subShapeNumObjects.push_back(mShape->objects.size() - mShape->subShapeFirstObject.last()); + shape->subShapeNumObjects.push_back(shape->objects.size() - shape->subShapeFirstObject.last()); } } void TSShapeLoader::generateSkins() { Vector skins; - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { - for (S32 iMesh = 0; iMesh < mShape->objects[iObject].numMeshes; iMesh++) + for (S32 iMesh = 0; iMesh < shape->objects[iObject].numMeshes; iMesh++) { - AppMesh* mesh = mAppMeshes[mShape->objects[iObject].startMeshIndex + iMesh]; + AppMesh* mesh = appMeshes[shape->objects[iObject].startMeshIndex + iMesh]; if (mesh->isSkin()) skins.push_back(mesh); } @@ -543,12 +543,12 @@ void TSShapeLoader::generateSkins() { // Find the node that matches this bone skin->nodeIndex[iBone] = -1; - for (S32 iNode = 0; iNode < mAppMeshes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { - if (mAppNodes[iNode]->isEqual(skin->bones[iBone])) + if (appNodes[iNode]->isEqual(skin->bones[iBone])) { delete skin->bones[iBone]; - skin->bones[iBone] = mAppNodes[iNode]; + skin->bones[iBone] = appNodes[iNode]; skin->nodeIndex[iBone] = iNode; break; } @@ -566,18 +566,18 @@ void TSShapeLoader::generateSkins() void TSShapeLoader::generateDefaultStates() { // Generate default object states (includes initial geometry) - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...", - mShape->objects.size(), iObject); + shape->objects.size(), iObject); - TSShape::Object& obj = mShape->objects[iObject]; + TSShape::Object& obj = shape->objects[iObject]; // Calculate the objectOffset for each mesh at T=0 for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; - AppNode* appNode = obj.nodeIndex >= 0 ? mAppNodes[obj.nodeIndex] : mBoundsNode; + AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; + AppNode* appNode = obj.nodeIndex >= 0 ? appNodes[obj.nodeIndex] : boundsNode; MatrixF meshMat(appMesh->getMeshTransform(DefaultTime)); MatrixF nodeMat(appMesh->isSkin() ? meshMat : appNode->getNodeTransform(DefaultTime)); @@ -587,16 +587,16 @@ void TSShapeLoader::generateDefaultStates() appMesh->objectOffset = nodeMat.inverse() * meshMat; } - generateObjectState(mShape->objects[iObject], DefaultTime, true, true); + generateObjectState(shape->objects[iObject], DefaultTime, true, true); } // Generate default node transforms - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Determine the default translation and rotation for the node QuatF rot, srot; Point3F trans, scale; - generateNodeTransform(mAppNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); + generateNodeTransform(appNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); // Add default node translation and rotation addNodeRotation(rot, true); @@ -606,20 +606,20 @@ void TSShapeLoader::generateDefaultStates() void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame) { - mShape->objectStates.increment(); - TSShape::ObjectState& state = mShape->objectStates.last(); + shape->objectStates.increment(); + TSShape::ObjectState& state = shape->objectStates.last(); state.frameIndex = 0; state.matFrameIndex = 0; - state.vis = mClampF(mAppMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); + state.vis = mClampF(appMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); if (addFrame || addMatFrame) { generateFrame(obj, t, addFrame, addMatFrame); // set the frame number for the object state - state.frameIndex = mAppMeshes[obj.startMeshIndex]->numFrames - 1; - state.matFrameIndex = mAppMeshes[obj.startMeshIndex]->numMatFrames - 1; + state.frameIndex = appMeshes[obj.startMeshIndex]->numFrames - 1; + state.matFrameIndex = appMeshes[obj.startMeshIndex]->numMatFrames - 1; } } @@ -627,7 +627,7 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo { for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; + AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; U32 oldNumPoints = appMesh->points.size(); U32 oldNumUvs = appMesh->uvs.size(); @@ -704,13 +704,13 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo void TSShapeLoader::generateMaterialList() { // Install the materials into the material list - mShape->materialList = new TSMaterialList; + shape->materialList = new TSMaterialList; for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++) { updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::appMaterials.size(), iMat); AppMaterial* appMat = AppMesh::appMaterials[iMat]; - mShape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); + shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); } } @@ -720,38 +720,38 @@ void TSShapeLoader::generateMaterialList() void TSShapeLoader::generateSequences() { - for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { - updateProgress(Load_GenerateSequences, "Generating sequences...", mAppSequences.size(), iSeq); + updateProgress(Load_GenerateSequences, "Generating sequences...", appSequences.size(), iSeq); // Initialize the sequence - mAppSequences[iSeq]->setActive(true); + appSequences[iSeq]->setActive(true); - mShape->sequences.increment(); - TSShape::Sequence& seq = mShape->sequences.last(); + shape->sequences.increment(); + TSShape::Sequence& seq = shape->sequences.last(); - seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName()); - seq.toolBegin = mAppSequences[iSeq]->getStart(); - seq.priority = mAppSequences[iSeq]->getPriority(); - seq.flags = mAppSequences[iSeq]->getFlags(); + seq.nameIndex = shape->addName(appSequences[iSeq]->getName()); + seq.toolBegin = appSequences[iSeq]->getStart(); + seq.priority = appSequences[iSeq]->getPriority(); + seq.flags = appSequences[iSeq]->getFlags(); // Compute duration and number of keyframes (then adjust time between frames to match) - seq.duration = mAppSequences[iSeq]->getEnd() - mAppSequences[iSeq]->getStart(); - seq.numKeyframes = (S32)(seq.duration * mAppSequences[iSeq]->fps + 0.5f) + 1; + seq.duration = appSequences[iSeq]->getEnd() - appSequences[iSeq]->getStart(); + seq.numKeyframes = (S32)(seq.duration * appSequences[iSeq]->fps + 0.5f) + 1; seq.sourceData.start = 0; seq.sourceData.end = seq.numKeyframes-1; seq.sourceData.total = seq.numKeyframes; // Set membership arrays (ie. which nodes and objects are affected by this sequence) - setNodeMembership(seq, mAppSequences[iSeq]); - setObjectMembership(seq, mAppSequences[iSeq]); + setNodeMembership(seq, appSequences[iSeq]); + setObjectMembership(seq, appSequences[iSeq]); // Generate keyframes generateNodeAnimation(seq); - generateObjectAnimation(seq, mAppSequences[iSeq]); - generateGroundAnimation(seq, mAppSequences[iSeq]); - generateFrameTriggers(seq, mAppSequences[iSeq]); + generateObjectAnimation(seq, appSequences[iSeq]); + generateGroundAnimation(seq, appSequences[iSeq]); + generateFrameTriggers(seq, appSequences[iSeq]); // Set sequence flags seq.dirtyFlags = 0; @@ -765,11 +765,11 @@ void TSShapeLoader::generateSequences() seq.dirtyFlags |= TSShapeInstance::MatFrameDirty; // Set shape flags (only the most significant scale type) - U32 curVal = mShape->mFlags & TSShape::AnyScale; - mShape->mFlags &= ~(TSShape::AnyScale); - mShape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) + U32 curVal = shape->mFlags & TSShape::AnyScale; + shape->mFlags &= ~(TSShape::AnyScale); + shape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) - mAppSequences[iSeq]->setActive(false); + appSequences[iSeq]->setActive(false); } } @@ -798,16 +798,16 @@ void TSShapeLoader::setNodeMembership(TSShape::Sequence& seq, const AppSequence* void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Check if any of the node rotations are different to // the default rotation QuatF defaultRot; - mShape->defaultRotations[iNode].getQuatF(&defaultRot); + shape->defaultRotations[iNode].getQuatF(&defaultRot); for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (mNodeRotCache[iNode][iFrame] != defaultRot) + if (nodeRotCache[iNode][iFrame] != defaultRot) { seq.rotationMatters.set(iNode); break; @@ -818,15 +818,15 @@ void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) void TSShapeLoader::setTranslationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Check if any of the node translations are different to // the default translation - Point3F& defaultTrans = mShape->defaultTranslations[iNode]; + Point3F& defaultTrans = shape->defaultTranslations[iNode]; for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (!mNodeTransCache[iNode][iFrame].equal(defaultTrans)) + if (!nodeTransCache[iNode][iFrame].equal(defaultTrans)) { seq.translationMatters.set(iNode); break; @@ -843,16 +843,16 @@ void TSShapeLoader::setScaleMembership(TSShape::Sequence& seq) U32 alignedScaleCount = 0; U32 uniformScaleCount = 0; - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Check if any of the node scales are not the unit scale for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - Point3F& scale = mNodeScaleCache[iNode][iFrame]; + Point3F& scale = nodeScaleCache[iNode][iFrame]; if (!unitScale.equal(scale)) { // Determine what type of scale this is - if (!mNodeScaleRotCache[iNode][iFrame].isIdentity()) + if (!nodeScaleRotCache[iNode][iFrame].isIdentity()) arbitraryScaleCount++; else if (scale.x != scale.y || scale.y != scale.z) alignedScaleCount++; @@ -880,12 +880,12 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size()) seq.matFrameMatters.clearAll(); // UV animation (size = objects.size()) - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { - if (!mAppMeshes[mShape->objects[iObject].startMeshIndex]) + if (!appMeshes[shape->objects[iObject].startMeshIndex]) continue; - if (mAppMeshes[mShape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) + if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) seq.visMatters.set(iObject); // Morph and UV animation has been deprecated //if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq)) @@ -898,18 +898,18 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc void TSShapeLoader::clearNodeTransformCache() { // clear out the transform caches - for (S32 i = 0; i < mNodeRotCache.size(); i++) - delete [] mNodeRotCache[i]; - mNodeRotCache.clear(); - for (S32 i = 0; i < mNodeTransCache.size(); i++) - delete [] mNodeTransCache[i]; - mNodeTransCache.clear(); - for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) - delete [] mNodeScaleRotCache[i]; - mNodeScaleRotCache.clear(); - for (S32 i = 0; i < mNodeScaleCache.size(); i++) - delete [] mNodeScaleCache[i]; - mNodeScaleCache.clear(); + for (S32 i = 0; i < nodeRotCache.size(); i++) + delete [] nodeRotCache[i]; + nodeRotCache.clear(); + for (S32 i = 0; i < nodeTransCache.size(); i++) + delete [] nodeTransCache[i]; + nodeTransCache.clear(); + for (S32 i = 0; i < nodeScaleRotCache.size(); i++) + delete [] nodeScaleRotCache[i]; + nodeScaleRotCache.clear(); + for (S32 i = 0; i < nodeScaleCache.size(); i++) + delete [] nodeScaleCache[i]; + nodeScaleCache.clear(); } void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequence* appSeq) @@ -917,28 +917,28 @@ void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequ // clear out the transform caches and set it up for this sequence clearNodeTransformCache(); - mNodeRotCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeRotCache.size(); i++) - mNodeRotCache[i] = new QuatF[seq.numKeyframes]; - mNodeTransCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeTransCache.size(); i++) - mNodeTransCache[i] = new Point3F[seq.numKeyframes]; - mNodeScaleRotCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) - mNodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; - mNodeScaleCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeScaleCache.size(); i++) - mNodeScaleCache[i] = new Point3F[seq.numKeyframes]; + nodeRotCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeRotCache.size(); i++) + nodeRotCache[i] = new QuatF[seq.numKeyframes]; + nodeTransCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeTransCache.size(); i++) + nodeTransCache[i] = new Point3F[seq.numKeyframes]; + nodeScaleRotCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeScaleRotCache.size(); i++) + nodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; + nodeScaleCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeScaleCache.size(); i++) + nodeScaleCache[i] = new Point3F[seq.numKeyframes]; // get the node transforms for every frame for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { - generateNodeTransform(mAppNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), - mNodeRotCache[iNode][iFrame], mNodeTransCache[iNode][iFrame], - mNodeScaleRotCache[iNode][iFrame], mNodeScaleCache[iNode][iFrame]); + generateNodeTransform(appNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), + nodeRotCache[iNode][iFrame], nodeTransCache[iNode][iFrame], + nodeScaleRotCache[iNode][iFrame], nodeScaleCache[iNode][iFrame]); } } } @@ -949,57 +949,57 @@ void TSShapeLoader::addNodeRotation(QuatF& rot, bool defaultVal) rot16.set(rot); if (!defaultVal) - mShape->nodeRotations.push_back(rot16); + shape->nodeRotations.push_back(rot16); else - mShape->defaultRotations.push_back(rot16); + shape->defaultRotations.push_back(rot16); } void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal) { if (!defaultVal) - mShape->nodeTranslations.push_back(trans); + shape->nodeTranslations.push_back(trans); else - mShape->defaultTranslations.push_back(trans); + shape->defaultTranslations.push_back(trans); } void TSShapeLoader::addNodeUniformScale(F32 scale) { - mShape->nodeUniformScales.push_back(scale); + shape->nodeUniformScales.push_back(scale); } void TSShapeLoader::addNodeAlignedScale(Point3F& scale) { - mShape->nodeAlignedScales.push_back(scale); + shape->nodeAlignedScales.push_back(scale); } void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale) { Quat16 rot16; rot16.set(qrot); - mShape->nodeArbitraryScaleRots.push_back(rot16); - mShape->nodeArbitraryScaleFactors.push_back(scale); + shape->nodeArbitraryScaleRots.push_back(rot16); + shape->nodeArbitraryScaleFactors.push_back(scale); } void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) { - seq.baseRotation = mShape->nodeRotations.size(); - seq.baseTranslation = mShape->nodeTranslations.size(); - seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->nodeArbitraryScaleRots.size() : - (seq.flags & TSShape::AlignedScale) ? mShape->nodeAlignedScales.size() : - mShape->nodeUniformScales.size(); + seq.baseRotation = shape->nodeRotations.size(); + seq.baseTranslation = shape->nodeTranslations.size(); + seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? shape->nodeArbitraryScaleRots.size() : + (seq.flags & TSShape::AlignedScale) ? shape->nodeAlignedScales.size() : + shape->nodeUniformScales.size(); - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { if (seq.rotationMatters.test(iNode)) - addNodeRotation(mNodeRotCache[iNode][iFrame], false); + addNodeRotation(nodeRotCache[iNode][iFrame], false); if (seq.translationMatters.test(iNode)) - addNodeTranslation(mNodeTransCache[iNode][iFrame], false); + addNodeTranslation(nodeTransCache[iNode][iFrame], false); if (seq.scaleMatters.test(iNode)) { - QuatF& rot = mNodeScaleRotCache[iNode][iFrame]; - Point3F scale = mNodeScaleCache[iNode][iFrame]; + QuatF& rot = nodeScaleRotCache[iNode][iFrame]; + Point3F scale = nodeScaleCache[iNode][iFrame]; if (seq.flags & TSShape::ArbitraryScale) addNodeArbitraryScale(rot, scale); @@ -1014,9 +1014,9 @@ void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.baseObjectState = mShape->objectStates.size(); + seq.baseObjectState = shape->objectStates.size(); - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { bool visMatters = seq.visMatters.test(iObject); bool frameMatters = seq.frameMatters.test(iObject); @@ -1027,7 +1027,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - generateObjectState(mShape->objects[iObject], time, frameMatters, matFrameMatters); + generateObjectState(shape->objects[iObject], time, frameMatters, matFrameMatters); } } } @@ -1035,10 +1035,10 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.firstGroundFrame = mShape->groundTranslations.size(); + seq.firstGroundFrame = shape->groundTranslations.size(); seq.numGroundFrames = 0; - if (!mBoundsNode) + if (!boundsNode) return; // Check if the bounds node is animated by this sequence @@ -1047,7 +1047,7 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq seq.flags |= TSShape::MakePath; // Get ground transform at the start of the sequence - MatrixF invStartMat = mBoundsNode->getNodeTransform(appSeq->getStart()); + MatrixF invStartMat = boundsNode->getNodeTransform(appSeq->getStart()); zapScale(invStartMat); invStartMat.inverse(); @@ -1056,22 +1056,22 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numGroundFrames - 1); // Determine delta bounds node transform at 't' - MatrixF mat = mBoundsNode->getNodeTransform(time); + MatrixF mat = boundsNode->getNodeTransform(time); zapScale(mat); mat = invStartMat * mat; // Add ground transform Quat16 rotation; rotation.set(QuatF(mat)); - mShape->groundTranslations.push_back(mat.getPosition()); - mShape->groundRotations.push_back(rotation); + shape->groundTranslations.push_back(mat.getPosition()); + shape->groundRotations.push_back(rotation); } } void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq) { // Initialize triggers - seq.firstTrigger = mShape->triggers.size(); + seq.firstTrigger = shape->triggers.size(); seq.numTriggers = appSeq->getNumTriggers(); if (!seq.numTriggers) return; @@ -1081,8 +1081,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // Add triggers for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - mShape->triggers.increment(); - appSeq->getTrigger(iTrigger, mShape->triggers.last()); + shape->triggers.increment(); + appSeq->getTrigger(iTrigger, shape->triggers.last()); } // Track the triggers that get turned off by this shape...normally, triggers @@ -1092,7 +1092,7 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque U32 offTriggers = 0; for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - U32 state = mShape->triggers[seq.firstTrigger+iTrigger].state; + U32 state = shape->triggers[seq.firstTrigger+iTrigger].state; if ((state & TSShape::Trigger::StateOn) == 0) offTriggers |= (state & TSShape::Trigger::StateMask); } @@ -1100,8 +1100,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // We now know which states are turned off, set invert on all those (including when turned on) for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - if (mShape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) - mShape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; + if (shape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) + shape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; } } @@ -1113,36 +1113,36 @@ void TSShapeLoader::sortDetails() // Insert NULL meshes where required - for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) + for (S32 iSub = 0; iSub < subshapes.size(); iSub++) { Vector validDetails; - mShape->getSubShapeDetails(iSub, validDetails); + shape->getSubShapeDetails(iSub, validDetails); for (S32 iDet = 0; iDet < validDetails.size(); iDet++) { - TSShape::Detail &detail = mShape->details[validDetails[iDet]]; + TSShape::Detail &detail = shape->details[validDetails[iDet]]; if (detail.subShapeNum >= 0) detail.objectDetailNum = iDet; - for (S32 iObj = mShape->subShapeFirstObject[iSub]; - iObj < (mShape->subShapeFirstObject[iSub] + mShape->subShapeNumObjects[iSub]); + for (S32 iObj = shape->subShapeFirstObject[iSub]; + iObj < (shape->subShapeFirstObject[iSub] + shape->subShapeNumObjects[iSub]); iObj++) { - TSShape::Object &object = mShape->objects[iObj]; + TSShape::Object &object = shape->objects[iObj]; // Insert a NULL mesh for this detail level if required (ie. if the // object does not already have a mesh with an equal or higher detail) S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1; - if (mAppMeshes[object.startMeshIndex + meshIndex]->detailSize < mShape->details[iDet].size) + if (appMeshes[object.startMeshIndex + meshIndex]->detailSize < shape->details[iDet].size) { // Add a NULL mesh - mAppMeshes.insert(object.startMeshIndex + iDet, NULL); + appMeshes.insert(object.startMeshIndex + iDet, NULL); object.numMeshes++; // Fixup the start index for the other objects - for (S32 k = iObj+1; k < mShape->objects.size(); k++) - mShape->objects[k].startMeshIndex++; + for (S32 k = iObj+1; k < shape->objects.size(); k++) + shape->objects[k].startMeshIndex++; } } } @@ -1157,79 +1157,79 @@ void TSShapeLoader::install() { // Arrays that are filled in by ts shape init, but need // to be allocated beforehand. - mShape->subShapeFirstTranslucentObject.setSize(mShape->subShapeFirstObject.size()); + shape->subShapeFirstTranslucentObject.setSize(shape->subShapeFirstObject.size()); // Construct TS sub-meshes - mShape->meshes.setSize(mAppMeshes.size()); - for (U32 m = 0; m < mAppMeshes.size(); m++) - mShape->meshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL; + shape->meshes.setSize(appMeshes.size()); + for (U32 m = 0; m < appMeshes.size(); m++) + shape->meshes[m] = appMeshes[m] ? appMeshes[m]->constructTSMesh() : NULL; // Remove empty meshes and objects - for (S32 iObj = mShape->objects.size()-1; iObj >= 0; iObj--) + for (S32 iObj = shape->objects.size()-1; iObj >= 0; iObj--) { - TSShape::Object& obj = mShape->objects[iObj]; + TSShape::Object& obj = shape->objects[iObj]; for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--) { - TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh]; + TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); - mShape->removeMeshFromObject(iObj, iMesh); + shape->removeMeshFromObject(iObj, iMesh); iMesh -= (oldMeshCount - obj.numMeshes - 1); // handle when more than one mesh is removed } } if (!obj.numMeshes) - mShape->removeObject(mShape->getName(obj.nameIndex)); + shape->removeObject(shape->getName(obj.nameIndex)); } // Add a dummy object if needed so the shape loads and renders ok - if (!mShape->details.size()) + if (!shape->details.size()) { - mShape->addDetail("detail", 2, 0); - mShape->subShapeNumObjects.last() = 1; + shape->addDetail("detail", 2, 0); + shape->subShapeNumObjects.last() = 1; - mShape->meshes.push_back(NULL); + shape->meshes.push_back(NULL); - mShape->objects.increment(); + shape->objects.increment(); - TSShape::Object& lastObject = mShape->objects.last(); - lastObject.nameIndex = mShape->addName("dummy"); + TSShape::Object& lastObject = shape->objects.last(); + lastObject.nameIndex = shape->addName("dummy"); lastObject.nodeIndex = 0; lastObject.startMeshIndex = 0; lastObject.numMeshes = 1; - mShape->objectStates.increment(); - mShape->objectStates.last().frameIndex = 0; - mShape->objectStates.last().matFrameIndex = 0; - mShape->objectStates.last().vis = 1.0f; + shape->objectStates.increment(); + shape->objectStates.last().frameIndex = 0; + shape->objectStates.last().matFrameIndex = 0; + shape->objectStates.last().vis = 1.0f; } // Update smallest visible detail - mShape->mSmallestVisibleDL = -1; - mShape->mSmallestVisibleSize = 999999; - for (S32 i = 0; i < mShape->details.size(); i++) + shape->mSmallestVisibleDL = -1; + shape->mSmallestVisibleSize = 999999; + for (S32 i = 0; i < shape->details.size(); i++) { - if ((mShape->details[i].size >= 0) && - (mShape->details[i].size < mShape->mSmallestVisibleSize)) + if ((shape->details[i].size >= 0) && + (shape->details[i].size < shape->mSmallestVisibleSize)) { - mShape->mSmallestVisibleDL = i; - mShape->mSmallestVisibleSize = mShape->details[i].size; + shape->mSmallestVisibleDL = i; + shape->mSmallestVisibleSize = shape->details[i].size; } } - computeBounds(mShape->mBounds); - if (!mShape->mBounds.isValidBox()) - mShape->mBounds = Box3F(1.0f); + computeBounds(shape->mBounds); + if (!shape->mBounds.isValidBox()) + shape->mBounds = Box3F(1.0f); - mShape->mBounds.getCenter(&mShape->center); - mShape->mRadius = (mShape->mBounds.maxExtents - mShape->center).len(); - mShape->tubeRadius = mShape->mRadius; + shape->mBounds.getCenter(&shape->center); + shape->mRadius = (shape->mBounds.maxExtents - shape->center).len(); + shape->tubeRadius = shape->mRadius; - mShape->init(); - mShape->finalizeEditable(); + shape->init(); + shape->finalizeEditable(); } void TSShapeLoader::computeBounds(Box3F& bounds) @@ -1238,11 +1238,11 @@ void TSShapeLoader::computeBounds(Box3F& bounds) bounds = Box3F::Invalid; // Use bounds node geometry if present - if (mBoundsNode && mBoundsNode->getNumMesh() ) + if ( boundsNode && boundsNode->getNumMesh() ) { - for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = mBoundsNode->getMesh( iMesh ); + AppMesh* mesh = boundsNode->getMesh( iMesh ); if ( !mesh ) continue; @@ -1255,9 +1255,9 @@ void TSShapeLoader::computeBounds(Box3F& bounds) else { // Compute bounds based on all geometry in the model - for (S32 iMesh = 0; iMesh < mAppMeshes.size(); iMesh++) + for (S32 iMesh = 0; iMesh < appMeshes.size(); iMesh++) { - AppMesh* mesh = mAppMeshes[iMesh]; + AppMesh* mesh = appMeshes[iMesh]; if ( !mesh ) continue; @@ -1279,14 +1279,14 @@ TSShapeLoader::~TSShapeLoader() AppMesh::appMaterials.clear(); // Delete Subshapes - delete mBoundsNode; - for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) - delete mSubshapes[iSub]; + delete boundsNode; + for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + delete subshapes[iSub]; // Delete AppSequences - for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) - delete mAppSequences[iSeq]; - mAppSequences.clear(); + for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) + delete appSequences[iSeq]; + appSequences.clear(); } // Static functions to handle supported formats for shape loader. diff --git a/Engine/source/ts/loader/tsShapeLoader.h b/Engine/source/ts/loader/tsShapeLoader.h index 9c9518bca..32b462e46 100644 --- a/Engine/source/ts/loader/tsShapeLoader.h +++ b/Engine/source/ts/loader/tsShapeLoader.h @@ -101,24 +101,24 @@ public: protected: // Variables used during loading that must be held until the shape is deleted - TSShape* mShape; - Vector mAppMeshes; + TSShape* shape; + Vector appMeshes; // Variables used during loading, but that can be discarded afterwards - static Torque::Path mShapePath; + static Torque::Path shapePath; - AppNode* mBoundsNode; - Vector mAppNodes; ///< Nodes in the loaded shape - Vector mAppSequences; + AppNode* boundsNode; + Vector appNodes; ///< Nodes in the loaded shape + Vector appSequences; - Vector mSubshapes; + Vector subshapes; - Vector mNodeRotCache; - Vector mNodeTransCache; - Vector mNodeScaleRotCache; - Vector mNodeScaleCache; + Vector nodeRotCache; + Vector nodeTransCache; + Vector nodeScaleRotCache; + Vector nodeScaleCache; - Point3F mShapeOffset; ///< Offset used to translate the shape origin + Point3F shapeOffset; ///< Offset used to translate the shape origin //-------------------------------------------------------------------------- @@ -183,10 +183,10 @@ protected: void install(); public: - TSShapeLoader() : mBoundsNode(0) { } + TSShapeLoader() : boundsNode(0) { } virtual ~TSShapeLoader(); - static const Torque::Path& getShapePath() { return mShapePath; } + static const Torque::Path& getShapePath() { return shapePath; } static void zapScale(MatrixF& mat); From 0e3c128ec4dd1eb35ed1521735149cda69bed5c4 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 2 Apr 2018 03:06:58 -0500 Subject: [PATCH 260/312] slimmed down shadowvar cleanups, plus removal of an unused membervar. --- Engine/source/ts/collada/colladaAppMesh.cpp | 10 +++++----- Engine/source/ts/collada/colladaImport.cpp | 6 +++--- Engine/source/ts/collada/colladaUtils.cpp | 4 ++-- Engine/source/ts/loader/tsShapeLoader.h | 2 -- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index c1420d1cd..a6bb56f04 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -152,7 +152,7 @@ private: // Add the input to the right place in the list (somewhere between start and end) for (S32 i = start; i <= end; i++) { - const domInputLocalOffset* localOffset = daeSafeCast(sortedInputs[i]); + localOffset = daeSafeCast(sortedInputs[i]); domUint set = localOffset ? localOffset->getSet() : 0xFFFFFFFF; if (newSet < set) { for (S32 j = i + 1; j <= end; j++) @@ -181,10 +181,10 @@ private: const char* semantic = SourceTypeToSemantic( type ); for (S32 iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++) { - domInputLocal* input = vertices->getInput_array().get(iInput); - if (dStrEqual(input->getSemantic(), semantic)) + domInputLocal* vInput = vertices->getInput_array().get(iInput); + if (dStrEqual(vInput->getSemantic(), semantic)) { - source = daeSafeCast(findInputSource(input)); + source = daeSafeCast(findInputSource(vInput)); break; } } @@ -977,7 +977,7 @@ void ColladaAppMesh::lookupSkinData() bool tooManyWeightsWarning = false; for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); - const domInt* vindices = (domInt*)weights_v.getRaw(0); + vindices = (domInt*)weights_v.getRaw(0); vindices += vindicesOffset[vertTuples[iVert].vertex]; S32 nonZeroWeightCount = 0; diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index 1cc2909b0..ded830d5c 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -120,9 +120,9 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen for (S32 i = 0; i < node->getInstance_node_array().getCount(); i++) { domInstance_node* instnode = node->getInstance_node_array()[i]; - domNode* node = daeSafeCast(instnode->getUrl().getElement()); - if (node) - processNode(tree, node, nodeID, stats); + domNode* dNode = daeSafeCast(instnode->getUrl().getElement()); + if (dNode) + processNode(tree, dNode, nodeID, stats); } } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index c9b7872b1..974d2a8ed 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -266,10 +266,10 @@ void AnimData::parseTargetString(const char* target, S32 fullCount, const char* targetValueCount = 1; } } - else if (const char* p = dStrrchr(target, '.')) { + else if (const char* p2 = dStrrchr(target, '.')) { // Check for named elements for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) { - if (!dStrcmp(p, elements[iElem])) { + if (!dStrcmp(p2, elements[iElem])) { targetValueOffset = iElem; targetValueCount = 1; break; diff --git a/Engine/source/ts/loader/tsShapeLoader.h b/Engine/source/ts/loader/tsShapeLoader.h index 32b462e46..e58496ce7 100644 --- a/Engine/source/ts/loader/tsShapeLoader.h +++ b/Engine/source/ts/loader/tsShapeLoader.h @@ -118,8 +118,6 @@ protected: Vector nodeScaleRotCache; Vector nodeScaleCache; - Point3F shapeOffset; ///< Offset used to translate the shape origin - //-------------------------------------------------------------------------- // Collect the nodes, objects and sequences for the scene From 5d8b367de853a25361a85fd303d665d20777c5ea Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Mon, 2 Apr 2018 23:38:17 -0400 Subject: [PATCH 261/312] Remove unused variables and cleanup precision warnings as dSprintf takes a U32 for the size of the buffer to use. --- Engine/source/console/codeInterpreter.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 46d58476e..f465e16e0 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -426,12 +426,12 @@ exitLabel: } if (thisNamespace && thisNamespace->mName) { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s::%s() - return %s", thisNamespace->mName, mThisFunctionName, STR.getStringValue()); } else { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s() - return %s", mThisFunctionName, STR.getStringValue()); } Con::printf("%s", sTraceBuffer); @@ -477,12 +477,12 @@ void CodeInterpreter::parseArgs(U32 &ip) } if (mExec.thisNamespace && mExec.thisNamespace->mName) { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s::%s(", mExec.thisNamespace->mName, mThisFunctionName); } else { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s(", mThisFunctionName); } for (S32 i = 0; i < wantedArgc; i++) @@ -2373,9 +2373,6 @@ OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip) { const char* nsName = ""; - Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; - const char * nsUsage = mNSEntry->mUsage; - #ifndef TORQUE_DEBUG // [tom, 12/13/2006] This stops tools functions from working in the console, // which is useful behavior when debugging so I'm ifdefing this out for debug builds. @@ -2567,8 +2564,6 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) } else { - Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; - const char * nsUsage = mNSEntry->mUsage; const char* nsName = ns ? ns->mName : ""; #ifndef TORQUE_DEBUG // [tom, 12/13/2006] This stops tools functions from working in the console, From 11064fb1dc54f050e7121bb9626c141daa91d6eb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 2 Apr 2018 23:58:54 -0500 Subject: [PATCH 262/312] stray fork contamination cleanup --- Templates/AFXDemo/game/shaders/procedural/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Templates/AFXDemo/game/shaders/procedural/.gitignore diff --git a/Templates/AFXDemo/game/shaders/procedural/.gitignore b/Templates/AFXDemo/game/shaders/procedural/.gitignore deleted file mode 100644 index 1bc0e838a..000000000 --- a/Templates/AFXDemo/game/shaders/procedural/.gitignore +++ /dev/null @@ -1 +0,0 @@ -# Keep directory in git repo From 570c6844f9d6f0b8fdf294381ac36b21326737b4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 3 Apr 2018 23:58:03 -0500 Subject: [PATCH 263/312] Makes it so the SDL directory files aren't copied during a template file install. --- Tools/CMake/torque3d.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index f5813ccba..d746913fb 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -477,7 +477,7 @@ if(TORQUE_SDL) set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library" FORCE) set(SDL_STATIC OFF CACHE BOOL "Build a static version of the library" FORCE) endif() - add_subdirectory( ${libDir}/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl2) + add_subdirectory( ${libDir}/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl2 EXCLUDE_FROM_ALL) link_directories( ${libDir}/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl2) endif() From 12134ceb2b87e0f180eb67f44e2fafd5ec66d49e Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Tue, 10 Apr 2018 22:21:40 -0400 Subject: [PATCH 264/312] Check for NULL on the thisObject before using it. Also cleanup break to goto. --- Engine/source/console/codeInterpreter.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 46d58476e..cd25d47f3 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -400,11 +400,11 @@ ConsoleValueRef CodeInterpreter::exec(U32 ip, breakContinueLabel: OPCodeReturn ret = (this->*gOpCodeArray[mCurrentInstruction])(ip); if (ret == OPCodeReturn::exitCode) - goto exitLabel; + break; else if (ret == OPCodeReturn::breakContinue) goto breakContinueLabel; } -exitLabel: + if (telDebuggerOn && setFrame < 0) TelDebugger->popStackFrame(); @@ -2133,7 +2133,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) if (!mExec.noCalls && !(routingId == MethodOnComponent)) { Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); - if (callType == FuncCallExprNode::MethodCall) + if (callType == FuncCallExprNode::MethodCall && gEvalState.thisObject != NULL) { Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", @@ -2522,9 +2522,17 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) if (!mExec.noCalls) { Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - mThisObject->getName() ? mThisObject->getName() : "", - mThisObject->getId(), Con::getNamespaceList(ns)); + if (mThisObject) + { + Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", + mThisObject->getName() ? mThisObject->getName() : "", + mThisObject->getId(), Con::getNamespaceList(ns)); + } + else + { + // At least let the scripter know that they access the object. + Con::warnf(ConsoleLogEntry::General, " Object is NULL."); + } } STR.popFrame(); CSTK.popFrame(); From c75eecbf53836f73d9d6fcaff31d24c120571eab Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Thu, 12 Apr 2018 23:14:57 -0400 Subject: [PATCH 265/312] fix this pointer in op_callfunc_this --- Engine/source/console/codeInterpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index cd25d47f3..8f5d829ed 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -2511,7 +2511,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) ip += 2; CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); - Namespace *ns = mThisObject->getNamespace(); + Namespace *ns = mThisObject ? mThisObject->getNamespace() : NULL; if (ns) mNSEntry = ns->lookup(fnName); else From c6ec1f8d86bf9a2a926394fa3b106b090353310d Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sat, 14 Apr 2018 10:59:09 -0400 Subject: [PATCH 266/312] Added better script interpreter logging. --- Engine/source/console/codeInterpreter.cpp | 36 ++++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 8f5d829ed..7654a6da1 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -2132,12 +2132,27 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) { if (!mExec.noCalls && !(routingId == MethodOnComponent)) { - Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); - if (callType == FuncCallExprNode::MethodCall && gEvalState.thisObject != NULL) + if (callType == FuncCallExprNode::MethodCall) { - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", - gEvalState.thisObject->getId(), Con::getNamespaceList(ns)); + if (gEvalState.thisObject != NULL) + { + // Try to use the name instead of the id + StringTableEntry name = gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : gEvalState.thisObject->getIdString(); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns)); + } + else + { + // NULL. + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName); + } + } + else if (callType == FuncCallExprNode::ParentCall) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown parent call %s.", mCodeBlock->getFileLine(ip - 6), fnName); + } + else + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName); } } STR.popFrame(); @@ -2328,7 +2343,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip) { if (!mExec.noCalls) { - Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName); } STR.popFrame(); CSTK.popFrame(); @@ -2521,17 +2536,16 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) { if (!mExec.noCalls) { - Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); if (mThisObject) { - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - mThisObject->getName() ? mThisObject->getName() : "", - mThisObject->getId(), Con::getNamespaceList(ns)); + // Try to use the name instead of the id + StringTableEntry name = mThisObject->getName() ? mThisObject->getName() : mThisObject->getIdString(); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns)); } else { // At least let the scripter know that they access the object. - Con::warnf(ConsoleLogEntry::General, " Object is NULL."); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName); } } STR.popFrame(); From cecf109f93d13056ed5c82ed7fc3c7538635a092 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Sat, 14 Apr 2018 17:51:29 -0400 Subject: [PATCH 267/312] Higher resolution torque icon, 1024x1024 for macOS, 256x256 for Windows. --- Tools/CMake/torque.icns | Bin 27205 -> 248361 bytes Tools/CMake/torque.ico | Bin 25214 -> 36805 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Tools/CMake/torque.icns b/Tools/CMake/torque.icns index 10d3dce34710ea36d1daf62a1c58dc8657cc5740..50aa70257ae6cb51b0c5fa327547526b84e44896 100644 GIT binary patch literal 248361 zcmdSAWmp{Dwk}%T&`2ZQxVr~;3+_&W2Pe3@251}-2#`R4paBvz0TKw1;1)=*;KAKp zg43t-t-aR$&f0sO^W5jTe{TJ#8smMZj2dIss980uoF2RT0BGMie8k*b004vq{LdR2 z=zqgGs}%pP3v3`iqWukcghXD+{!QoFL?S<8{u98m8ofm#kq`f=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#fNglEf_HONTRj2$KH)p`yU#vq|0Zv|NAKwz0O)}= z6OVnEb8hBO(m(Z$tAE1m-zUvJbsp~#Z{r;y?>;y1{_v))JIpcIdHM#FwY2{6{xR`; znCVAT&MDh=TiUvIKWSysx7(X#+^_R2h<=+f_dsa3wM~5Hf#1_V-b?zNXUY`UTi+A+ zn|so-$71VY?rGwg0W>=%&&=ZuXwMxi+P3@6J-?yC+t1skY}vody86c((hceXlLzi| zlgB}M@`ZP*N_TL~nwI^W4BoYF^LIy05Av|C@4KjPxM#V?U2>w^q@`N+?6GLMH&eX9 zy@NhB=tr4woi}+*>(7Q$HuSj7)RaL@zh9arr*?mKnQMSI#OnUX?4Nngsks;X_0PGn zX&>g+B(|F>VaDU^i_8s=^ zx&zWYaNT)-mqzO(@M`t^wL$BD)IFb-AKY=R={>H;>PiQF1Ddrz8xL>cw+D_LXQJKi zw92$i_3xpsaT9j8#?CQtALuS8t zgN|K3wJm#o7grjH`5hzfBEMVel!Ex$fAY<4H=px&@ZXaJG4Jo=#^zAJ-6b(axD~$L zW$Fd*cX?&Ox4XEiNWR-`3&Yy5N)mryKmMkc{i(@cRQ?p?KJz(?b!zGM`Zsaa^f0*&AO%8hOJ+`;~8qF7dZq_l*Pk+&$ zn|gzGtgq?7j#jogb)l&Tb$eHOY4M+bpxZOmdziX|X9~XY`ab9O;^IHvamSE>-Kr^Ne$VGwhJ_qwBMz zTwksS=Mnp$o28A7Lz!Nhd23+bybEUR;99qXH>-?Y#BU+0cdK>4!2J#)->mA$x2p$; F{|~!ycEJDu From e718841467e197c021529edd9adee75b24833769 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Tue, 17 Apr 2018 16:33:56 +0200 Subject: [PATCH 268/312] Eliminate DefineConsoleFunction --- Engine/source/T3D/aiClient.cpp | 2 +- Engine/source/T3D/entity.cpp | 2 +- Engine/source/T3D/gameBase/gameProcess.cpp | 2 +- Engine/source/T3D/gameFunctions.cpp | 4 +- Engine/source/T3D/physics/physicsPlugin.cpp | 26 +-- Engine/source/app/game.cpp | 22 +-- Engine/source/app/net/serverQuery.cpp | 20 +- Engine/source/app/version.cpp | 14 +- .../source/assets/assetQuery_ScriptBinding.h | 4 +- Engine/source/cinterface/cinterface.cpp | 2 +- Engine/source/console/console.cpp | 6 +- Engine/source/console/consoleDoc.cpp | 4 +- Engine/source/console/consoleFunctions.cpp | 182 +++++++++--------- Engine/source/console/consoleXMLExport.cpp | 2 +- Engine/source/console/engineAPI.h | 18 -- Engine/source/console/sim.cpp | 24 +-- Engine/source/console/simDatablock.cpp | 4 +- Engine/source/console/telnetConsole.cpp | 2 +- Engine/source/console/telnetDebugger.cpp | 6 +- Engine/source/core/dnet.cpp | 2 +- Engine/source/core/stringBuffer.cpp | 4 +- Engine/source/core/util/str.cpp | 2 +- .../environment/VolumetricFogRTManager.cpp | 2 +- Engine/source/gfx/gfxDevice.cpp | 2 +- Engine/source/gfx/gl/gfxGLDeviceProfiler.cpp | 2 +- Engine/source/i18n/i18n.cpp | 4 +- .../advanced/advancedLightManager.cpp | 2 +- Engine/source/lighting/shadowManager.cpp | 2 +- Engine/source/materials/materialManager.cpp | 10 +- Engine/source/math/mConsoleFunctions.cpp | 70 +++---- Engine/source/math/mRotation.cpp | 20 +- Engine/source/math/mathTypes.cpp | 44 ++--- Engine/source/navigation/navMesh.cpp | 10 +- Engine/source/platform/platformFileIO.cpp | 8 +- Engine/source/platform/platformMemory.cpp | 4 +- Engine/source/platform/platformRedBook.cpp | 20 +- Engine/source/platform/platformTimer.cpp | 4 +- Engine/source/platformWin32/cardProfile.cpp | 2 +- Engine/source/platformWin32/winConsole.cpp | 2 +- .../source/platformWin32/winDirectInput.cpp | 20 +- Engine/source/platformWin32/winExec.cpp | 2 +- Engine/source/platformWin32/winInput.cpp | 6 +- Engine/source/platformWin32/winWindow.cpp | 2 +- Engine/source/scene/pathManager.cpp | 4 +- Engine/source/scene/sceneManager.cpp | 4 +- Engine/source/sfx/sfxSystem.cpp | 6 +- Engine/source/sim/netInterface.cpp | 2 +- Engine/source/terrain/terrData.cpp | 6 +- Engine/source/ts/collada/colladaImport.cpp | 2 +- Engine/source/ts/collada/colladaLights.cpp | 2 +- Engine/source/ts/loader/tsShapeLoader.cpp | 4 +- Engine/source/ts/tsLastDetail.cpp | 2 +- Engine/source/util/fpsTracker.cpp | 2 +- Engine/source/util/messaging/dispatcher.cpp | 14 +- Engine/source/util/sampler.cpp | 6 +- 55 files changed, 314 insertions(+), 332 deletions(-) diff --git a/Engine/source/T3D/aiClient.cpp b/Engine/source/T3D/aiClient.cpp index 0fab8f428..1f4be793b 100644 --- a/Engine/source/T3D/aiClient.cpp +++ b/Engine/source/T3D/aiClient.cpp @@ -526,7 +526,7 @@ DefineConsoleMethod( AIClient, getLocation, Point3F, (),, "ai.getLocation();" ) /** * Adds an AI Player to the game */ -DefineConsoleFunction( aiAddPlayer, S32, (const char * name, const char * ns), (""), "'playerName'[, 'AIClassType'] );") +DefineEngineFunction( aiAddPlayer, S32, (const char * name, const char * ns), (""), "'playerName'[, 'AIClassType'] );") { // Create the player AIClient *aiPlayer = new AIClient(); diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index 62c0b031f..fe0303652 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -2005,7 +2005,7 @@ DefineConsoleMethod(Entity, notify, void, (String signalFunction, String argA, S object->notifyComponents(signalFunction, argA, argB, argC, argD, argE); } -DefineConsoleFunction(findEntitiesByTag, const char*, (SimGroup* searchingGroup, String tags), (nullAsType(), ""), +DefineEngineFunction(findEntitiesByTag, const char*, (SimGroup* searchingGroup, String tags), (nullAsType(), ""), "Finds all entities that have the provided tags.\n" "@param searchingGroup The SimGroup to search inside. If null, we'll search the entire dictionary(this can be slow!).\n" "@param tags Word delimited list of tags to search for. If multiple tags are included, the list is eclusively parsed, requiring all tags provided to be found on an entity for a match.\n" diff --git a/Engine/source/T3D/gameBase/gameProcess.cpp b/Engine/source/T3D/gameBase/gameProcess.cpp index 2df8a850e..6aa5c0e63 100644 --- a/Engine/source/T3D/gameBase/gameProcess.cpp +++ b/Engine/source/T3D/gameBase/gameProcess.cpp @@ -34,7 +34,7 @@ ClientProcessList* ClientProcessList::smClientProcessList = NULL; ServerProcessList* ServerProcessList::smServerProcessList = NULL; static U32 gNetOrderNextId = 0; -DefineConsoleFunction( dumpProcessList, void, ( ), , +DefineEngineFunction( dumpProcessList, void, ( ), , "Dumps all ProcessObjects in ServerProcessList and ClientProcessList to the console." ) { Con::printf( "client process list:" ); diff --git a/Engine/source/T3D/gameFunctions.cpp b/Engine/source/T3D/gameFunctions.cpp index 23d048f7c..c49c75cb3 100644 --- a/Engine/source/T3D/gameFunctions.cpp +++ b/Engine/source/T3D/gameFunctions.cpp @@ -114,7 +114,7 @@ static U32 sgServerQueryIndex = 0; //SERVER FUNCTIONS ONLY ConsoleFunctionGroupBegin( Containers, "Spatial query functions. Server side only!"); -DefineConsoleFunction( containerFindFirst, const char*, (U32 typeMask, Point3F origin, Point3F size), , "(int mask, Point3F point, float x, float y, float z)" +DefineEngineFunction( containerFindFirst, const char*, (U32 typeMask, Point3F origin, Point3F size), , "(int mask, Point3F point, float x, float y, float z)" "@brief Find objects matching the bitmask type within a box centered at point, with extents x, y, z.\n\n" "@returns The first object found, or an empty string if nothing was found. Thereafter, you can get more " "results using containerFindNext()." @@ -146,7 +146,7 @@ DefineConsoleFunction( containerFindFirst, const char*, (U32 typeMask, Point3F o return buff; } -DefineConsoleFunction( containerFindNext, const char*, (), , "()" +DefineEngineFunction( containerFindNext, const char*, (), , "()" "@brief Get more results from a previous call to containerFindFirst().\n\n" "@note You must call containerFindFirst() to begin the search.\n" "@returns The next object found, or an empty string if nothing else was found.\n" diff --git a/Engine/source/T3D/physics/physicsPlugin.cpp b/Engine/source/T3D/physics/physicsPlugin.cpp index b2f06b55e..fec6f2186 100644 --- a/Engine/source/T3D/physics/physicsPlugin.cpp +++ b/Engine/source/T3D/physics/physicsPlugin.cpp @@ -124,31 +124,31 @@ void PhysicsPlugin::_debugDraw( SceneManager *graph, const SceneRenderState *sta world->onDebugDraw( state ); } -DefineConsoleFunction( physicsPluginPresent, bool, (), , "physicsPluginPresent()" +DefineEngineFunction( physicsPluginPresent, bool, (), , "physicsPluginPresent()" "@brief Returns true if a physics plugin exists and is initialized.\n\n" "@ingroup Physics" ) { return PHYSICSMGR != NULL; } -DefineConsoleFunction( physicsInit, bool, (const char * library), ("default"), "physicsInit( [string library] )") +DefineEngineFunction( physicsInit, bool, (const char * library), ("default"), "physicsInit( [string library] )") { return PhysicsPlugin::activate( library ); } -DefineConsoleFunction( physicsDestroy, void, (), , "physicsDestroy()") +DefineEngineFunction( physicsDestroy, void, (), , "physicsDestroy()") { if ( PHYSICSMGR ) PHYSICSMGR->destroyPlugin(); } -DefineConsoleFunction( physicsInitWorld, bool, (const char * worldName), , "physicsInitWorld( String worldName )") +DefineEngineFunction( physicsInitWorld, bool, (const char * worldName), , "physicsInitWorld( String worldName )") { bool res = PHYSICSMGR && PHYSICSMGR->createWorld( String( worldName ) ); return res; } -DefineConsoleFunction( physicsDestroyWorld, void, (const char * worldName), , "physicsDestroyWorld( String worldName )") +DefineEngineFunction( physicsDestroyWorld, void, (const char * worldName), , "physicsDestroyWorld( String worldName )") { if ( PHYSICSMGR ) PHYSICSMGR->destroyWorld( worldName ); @@ -157,19 +157,19 @@ DefineConsoleFunction( physicsDestroyWorld, void, (const char * worldName), , "p // Control/query of the stop/started state // of the currently running simulation. -DefineConsoleFunction( physicsStartSimulation, void, (const char * worldName), , "physicsStartSimulation( String worldName )") +DefineEngineFunction( physicsStartSimulation, void, (const char * worldName), , "physicsStartSimulation( String worldName )") { if ( PHYSICSMGR ) PHYSICSMGR->enableSimulation( String( worldName ), true ); } -DefineConsoleFunction( physicsStopSimulation, void, (const char * worldName), , "physicsStopSimulation( String worldName )") +DefineEngineFunction( physicsStopSimulation, void, (const char * worldName), , "physicsStopSimulation( String worldName )") { if ( PHYSICSMGR ) PHYSICSMGR->enableSimulation( String( worldName ), false ); } -DefineConsoleFunction( physicsSimulationEnabled, bool, (), , "physicsStopSimulation( String worldName )") +DefineEngineFunction( physicsSimulationEnabled, bool, (), , "physicsStopSimulation( String worldName )") { return PHYSICSMGR && PHYSICSMGR->isSimulationEnabled(); } @@ -177,14 +177,14 @@ DefineConsoleFunction( physicsSimulationEnabled, bool, (), , "physicsStopSimulat // Used for slowing down time on the // physics simulation, and for pausing/restarting // the simulation. -DefineConsoleFunction( physicsSetTimeScale, void, (F32 scale), , "physicsSetTimeScale( F32 scale )") +DefineEngineFunction( physicsSetTimeScale, void, (F32 scale), , "physicsSetTimeScale( F32 scale )") { if ( PHYSICSMGR ) PHYSICSMGR->setTimeScale( scale ); } // Get the currently set time scale. -DefineConsoleFunction( physicsGetTimeScale, F32, (), , "physicsGetTimeScale()") +DefineEngineFunction( physicsGetTimeScale, F32, (), , "physicsGetTimeScale()") { return PHYSICSMGR && PHYSICSMGR->getTimeScale(); } @@ -193,7 +193,7 @@ DefineConsoleFunction( physicsGetTimeScale, F32, (), , "physicsGetTimeScale()") // physics simulation that they should store // their current state for later restoration, // such as when the editor is closed. -DefineConsoleFunction( physicsStoreState, void, (), , "physicsStoreState()") +DefineEngineFunction( physicsStoreState, void, (), , "physicsStoreState()") { PhysicsPlugin::getPhysicsResetSignal().trigger( PhysicsResetEvent_Store ); } @@ -201,13 +201,13 @@ DefineConsoleFunction( physicsStoreState, void, (), , "physicsStoreState()") // Used to send a signal to objects in the // physics simulation that they should restore // their saved state, such as when the editor is opened. -DefineConsoleFunction( physicsRestoreState, void, (), , "physicsRestoreState()") +DefineEngineFunction( physicsRestoreState, void, (), , "physicsRestoreState()") { if ( PHYSICSMGR ) PHYSICSMGR->reset(); } -DefineConsoleFunction( physicsDebugDraw, void, (bool enable), , "physicsDebugDraw( bool enable )") +DefineEngineFunction( physicsDebugDraw, void, (bool enable), , "physicsDebugDraw( bool enable )") { if ( PHYSICSMGR ) PHYSICSMGR->enableDebugDraw( enable ); diff --git a/Engine/source/app/game.cpp b/Engine/source/app/game.cpp index 05f63e84c..d7a3377f6 100644 --- a/Engine/source/app/game.cpp +++ b/Engine/source/app/game.cpp @@ -67,7 +67,7 @@ bool gEditingMission = false; ConsoleFunctionGroupBegin( InputManagement, "Functions that let you deal with input from scripts" ); -DefineConsoleFunction( deactivateDirectInput, void, (), , +DefineEngineFunction( deactivateDirectInput, void, (), , "()" "@brief Disables DirectInput.\n\n" "Also deactivates any connected joysticks.\n\n" @@ -77,7 +77,7 @@ DefineConsoleFunction( deactivateDirectInput, void, (), , Input::deactivate(); } -DefineConsoleFunction( activateDirectInput, void, (), , +DefineEngineFunction( activateDirectInput, void, (), , "()" "@brief Activates DirectInput.\n\n" "Also activates any connected joysticks." @@ -91,7 +91,7 @@ ConsoleFunctionGroupEnd( InputManagement ); //-------------------------------------------------------------------------- static const U32 MaxPlayerNameLength = 16; -DefineConsoleFunction( strToPlayerName, const char*, (const char* ptr ), , "strToPlayerName(string);" ) +DefineEngineFunction( strToPlayerName, const char*, (const char* ptr ), , "strToPlayerName(string);" ) { // Strip leading spaces and underscores: @@ -147,7 +147,7 @@ DefineConsoleFunction( strToPlayerName, const char*, (const char* ptr ), , "strT ConsoleFunctionGroupBegin( Platform , "General platform functions."); -DefineConsoleFunction( lockMouse, void, (bool isLocked ), , "(bool isLocked)" +DefineEngineFunction( lockMouse, void, (bool isLocked ), , "(bool isLocked)" "@brief Lock or unlock the mouse to the window.\n\n" "When true, prevents the mouse from leaving the bounds of the game window.\n\n" "@ingroup Input") @@ -156,7 +156,7 @@ DefineConsoleFunction( lockMouse, void, (bool isLocked ), , "(bool isLocked)" } -DefineConsoleFunction( setNetPort, bool, (int port, bool bind), (true), "(int port, bool bind=true)" +DefineEngineFunction( setNetPort, bool, (int port, bool bind), (true), "(int port, bool bind=true)" "@brief Set the network port for the game to use.\n\n" "@param port The port to use.\n" @@ -171,28 +171,28 @@ DefineConsoleFunction( setNetPort, bool, (int port, bool bind), (true), "(int po return Net::openPort((S32)port, bind); } -DefineConsoleFunction(isAddressTypeAvailable, bool, (int addressType), , "(protocol id)" +DefineEngineFunction(isAddressTypeAvailable, bool, (int addressType), , "(protocol id)" "@brief Determines if a specified address type can be reached.\n\n" "@ingroup Networking") { return Net::isAddressTypeAvailable((NetAddress::Type)addressType); } -DefineConsoleFunction( closeNetPort, void, (), , "()" +DefineEngineFunction( closeNetPort, void, (), , "()" "@brief Closes the current network port\n\n" "@ingroup Networking") { Net::closePort(); } -DefineConsoleFunction( saveJournal, void, (const char * filename), , "(string filename)" +DefineEngineFunction( saveJournal, void, (const char * filename), , "(string filename)" "Save the journal to the specified file.\n\n" "@ingroup Platform") { Journal::Record(filename); } -DefineConsoleFunction( playJournal, void, (const char * filename), , "(string filename)" +DefineEngineFunction( playJournal, void, (const char * filename), , "(string filename)" "@brief Begin playback of a journal from a specified field.\n\n" "@param filename Name and path of file journal file\n" "@ingroup Platform") @@ -202,7 +202,7 @@ DefineConsoleFunction( playJournal, void, (const char * filename), , "(string fi Journal::Play(filename); } -DefineConsoleFunction( getSimTime, S32, (), , "()" +DefineEngineFunction( getSimTime, S32, (), , "()" "Return the current sim time in milliseconds.\n\n" "@brief Sim time is time since the game started.\n\n" "@ingroup Platform") @@ -210,7 +210,7 @@ DefineConsoleFunction( getSimTime, S32, (), , "()" return Sim::getCurrentTime(); } -DefineConsoleFunction( getRealTime, S32, (), , "()" +DefineEngineFunction( getRealTime, S32, (), , "()" "@brief Return the current real time in milliseconds.\n\n" "Real time is platform defined; typically time since the computer booted.\n\n" "@ingroup Platform") diff --git a/Engine/source/app/net/serverQuery.cpp b/Engine/source/app/net/serverQuery.cpp index 05d31e531..ef3f9daa9 100644 --- a/Engine/source/app/net/serverQuery.cpp +++ b/Engine/source/app/net/serverQuery.cpp @@ -429,7 +429,7 @@ void queryLanServers(U32 port, U8 flags, const char* gameType, const char* missi //----------------------------------------------------------------------------- -DefineConsoleFunction( queryAllServers +DefineEngineFunction( queryAllServers , void, ( U32 lanPort , U32 flags , const char * gameType @@ -455,7 +455,7 @@ DefineConsoleFunction( queryAllServers } -DefineConsoleFunction( queryLanServers +DefineEngineFunction( queryLanServers , void, ( U32 lanPort , U32 flags , const char * gameType @@ -560,7 +560,7 @@ void queryMasterServer(U8 flags, const char* gameType, const char* missionType, processMasterServerQuery( gPingSession ); } -DefineConsoleFunction( queryMasterServer +DefineEngineFunction( queryMasterServer , void, ( U32 flags , const char * gameType , const char * missionType @@ -582,7 +582,7 @@ DefineConsoleFunction( queryMasterServer //----------------------------------------------------------------------------- -DefineConsoleFunction( querySingleServer +DefineEngineFunction( querySingleServer , void, ( const char* addrText, U8 flags ) , (0), "querySingleServer(address, flags);" ) { @@ -668,7 +668,7 @@ void cancelServerQuery() } } -DefineConsoleFunction( cancelServerQuery, void, (), , "cancelServerQuery();" ) +DefineEngineFunction( cancelServerQuery, void, (), , "cancelServerQuery();" ) { cancelServerQuery(); } @@ -696,14 +696,14 @@ void stopServerQuery() } } -DefineConsoleFunction( stopServerQuery, void, (), , "stopServerQuery();" ) +DefineEngineFunction( stopServerQuery, void, (), , "stopServerQuery();" ) { stopServerQuery(); } //----------------------------------------------------------------------------- -DefineConsoleFunction( startHeartbeat, void, (), , "startHeartbeat();" ) +DefineEngineFunction( startHeartbeat, void, (), , "startHeartbeat();" ) { if (validateAuthenticatedServer()) { gHeartbeatSeq++; @@ -711,19 +711,19 @@ DefineConsoleFunction( startHeartbeat, void, (), , "startHeartbeat();" ) } } -DefineConsoleFunction( stopHeartbeat, void, (), , "stopHeartbeat();" ) +DefineEngineFunction( stopHeartbeat, void, (), , "stopHeartbeat();" ) { gHeartbeatSeq++; } //----------------------------------------------------------------------------- -DefineConsoleFunction( getServerCount, int, (), , "getServerCount();" ) +DefineEngineFunction( getServerCount, int, (), , "getServerCount();" ) { return gServerList.size(); } -DefineConsoleFunction( setServerInfo, bool, (U32 index), , "setServerInfo(index);" ) +DefineEngineFunction( setServerInfo, bool, (U32 index), , "setServerInfo(index);" ) { if (index < gServerList.size()) { ServerInfo& info = gServerList[index]; diff --git a/Engine/source/app/version.cpp b/Engine/source/app/version.cpp index bced8730a..7a26adb3d 100644 --- a/Engine/source/app/version.cpp +++ b/Engine/source/app/version.cpp @@ -92,44 +92,44 @@ const char* getCompileTimeString() ConsoleFunctionGroupBegin( CompileInformation, "Functions to get version information about the current executable." ); -DefineConsoleFunction( getVersionNumber, S32, (), , "Get the version of the engine build, as a string.\n\n" +DefineEngineFunction( getVersionNumber, S32, (), , "Get the version of the engine build, as a string.\n\n" "@ingroup Debugging") { return getVersionNumber(); } -DefineConsoleFunction( getAppVersionNumber, S32, (), , "Get the version of the application build, as a string.\n\n" +DefineEngineFunction( getAppVersionNumber, S32, (), , "Get the version of the application build, as a string.\n\n" "@ingroup Debugging") { return getAppVersionNumber(); } -DefineConsoleFunction( getVersionString, const char*, (), , "Get the version of the engine build, as a human readable string.\n\n" +DefineEngineFunction( getVersionString, const char*, (), , "Get the version of the engine build, as a human readable string.\n\n" "@ingroup Debugging") { return getVersionString(); } -DefineConsoleFunction( getAppVersionString, const char*, (), , "Get the version of the aplication build, as a human readable string.\n\n" +DefineEngineFunction( getAppVersionString, const char*, (), , "Get the version of the aplication build, as a human readable string.\n\n" "@ingroup Debugging") { return getAppVersionString(); } -DefineConsoleFunction( getEngineName, const char*, (), , "Get the name of the engine product that this is running from, as a string.\n\n" +DefineEngineFunction( getEngineName, const char*, (), , "Get the name of the engine product that this is running from, as a string.\n\n" "@ingroup Debugging") { return getEngineProductString(); } -DefineConsoleFunction( getCompileTimeString, const char*, (), , "Get the time of compilation.\n\n" +DefineEngineFunction( getCompileTimeString, const char*, (), , "Get the time of compilation.\n\n" "@ingroup Debugging") { return getCompileTimeString(); } -DefineConsoleFunction( getBuildString, const char*, (), , "Get the type of build, \"Debug\" or \"Release\".\n\n" +DefineEngineFunction( getBuildString, const char*, (), , "Get the type of build, \"Debug\" or \"Release\".\n\n" "@ingroup Debugging") { #ifdef TORQUE_DEBUG diff --git a/Engine/source/assets/assetQuery_ScriptBinding.h b/Engine/source/assets/assetQuery_ScriptBinding.h index 3324054e1..1656d2eb3 100644 --- a/Engine/source/assets/assetQuery_ScriptBinding.h +++ b/Engine/source/assets/assetQuery_ScriptBinding.h @@ -26,7 +26,7 @@ #include "console/engineAPI.h" -DefineConsoleMethod(AssetQuery, clear, void, (),,"Clears all asset Id results." +DefineEngineMethod(AssetQuery, clear, void, (),,"Clears all asset Id results." "Clears all asset Id results.\n" "@return () No return value.\n") { @@ -36,7 +36,7 @@ DefineConsoleMethod(AssetQuery, clear, void, (),,"Clears all asset Id results." //----------------------------------------------------------------------------- -DefineConsoleMethod(AssetQuery, set, bool, (S32 queryId), , +DefineEngineMethod(AssetQuery, set, bool, (S32 queryId), , "Sets the asset query to a copy of the specified asset query.\n" "@param assetQuery The asset query to copy.\n" "@return Whether the operation succeeded or not.\n") diff --git a/Engine/source/cinterface/cinterface.cpp b/Engine/source/cinterface/cinterface.cpp index aa0fae035..0820b3cf8 100644 --- a/Engine/source/cinterface/cinterface.cpp +++ b/Engine/source/cinterface/cinterface.cpp @@ -436,7 +436,7 @@ extern "C" { // By default, it is marked as secure by the web plugins and then can be called from // Javascript on the web page to ensure that function calls across the language // boundry are working with arguments and return values -DefineConsoleFunction( testJavaScriptBridge, const char *, (const char* arg1, const char* arg2, const char* arg3), , "testBridge(arg1, arg2, arg3)") +DefineEngineFunction( testJavaScriptBridge, const char *, (const char* arg1, const char* arg2, const char* arg3), , "testBridge(arg1, arg2, arg3)") { S32 failed = 0; if (dStrcmp(arg1,"one")) diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index dc7dde340..55880f30f 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -277,7 +277,7 @@ bool useTimestamp = false; ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console."); -DefineConsoleFunction( cls, void, (), , "()" +DefineEngineFunction( cls, void, (), , "()" "@brief Clears the console output.\n\n" "@ingroup Console") { @@ -287,14 +287,14 @@ DefineConsoleFunction( cls, void, (), , "()" consoleLog.setSize(0); }; -DefineConsoleFunction( getClipboard, const char*, (), , "()" +DefineEngineFunction( getClipboard, const char*, (), , "()" "@brief Get text from the clipboard.\n\n" "@internal") { return Platform::getClipboard(); }; -DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)" +DefineEngineFunction( setClipboard, bool, (const char* text), , "(string text)" "@brief Set the system clipboard.\n\n" "@internal") { diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index f4b74402b..59ea543a1 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -41,7 +41,7 @@ ConsoleFunctionGroupBegin(ConsoleDoc, "Console self-documentation functions. These output psuedo C++ suitable for feeeding through Doxygen or another auto documentation tool."); -DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngine), ( true, true ), +DefineEngineFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngine), ( true, true ), "@brief Dumps all declared console classes to the console.\n\n" "@param dumpScript Optional parameter specifying whether or not classes defined in script should be dumped.\n" "@param dumpEngine Optional parameter specifying whether or not classes defined in the engine should be dumped.\n" @@ -50,7 +50,7 @@ DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngi Namespace::dumpClasses( dumpScript, dumpEngine ); } -DefineConsoleFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEngine ), ( true, true ), +DefineEngineFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEngine ), ( true, true ), "@brief Dumps all declared console functions to the console.\n" "@param dumpScript Optional parameter specifying whether or not functions defined in script should be dumped.\n" "@param dumpEngine Optional parameter specitying whether or not functions defined in the engine should be dumped.\n" diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index d32b30d31..258f7911f 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -184,7 +184,7 @@ bool isValidPort(U16 port) //----------------------------------------------------------------------------- -DefineConsoleFunction( strasc, int, ( const char* chr ),, +DefineEngineFunction( strasc, int, ( const char* chr ),, "Return the integer character code value corresponding to the first character in the given string.\n" "@param chr a (one-character) string.\n" "@return the UTF32 code value for the first character in the given string.\n" @@ -195,7 +195,7 @@ DefineConsoleFunction( strasc, int, ( const char* chr ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( strformat, const char*, ( const char* format, const char* value ),, +DefineEngineFunction( strformat, const char*, ( const char* format, const char* value ),, "Format the given value as a string using printf-style formatting.\n" "@param format A printf-style format string.\n" "@param value The value argument matching the given format string.\n\n" @@ -252,7 +252,7 @@ DefineConsoleFunction( strformat, const char*, ( const char* format, const char* //----------------------------------------------------------------------------- -DefineConsoleFunction( strcmp, S32, ( const char* str1, const char* str2 ),, +DefineEngineFunction( strcmp, S32, ( const char* str1, const char* str2 ),, "Compares two strings using case-sensitive comparison.\n" "@param str1 The first string.\n" "@param str2 The second string.\n" @@ -271,7 +271,7 @@ DefineConsoleFunction( strcmp, S32, ( const char* str1, const char* str2 ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( stricmp, S32, ( const char* str1, const char* str2 ),, +DefineEngineFunction( stricmp, S32, ( const char* str1, const char* str2 ),, "Compares two strings using case-insensitive comparison.\n" "@param str1 The first string.\n" "@param str2 The second string.\n" @@ -290,7 +290,7 @@ DefineConsoleFunction( stricmp, S32, ( const char* str1, const char* str2 ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( strnatcmp, S32, ( const char* str1, const char* str2 ),, +DefineEngineFunction( strnatcmp, S32, ( const char* str1, const char* str2 ),, "Compares two strings using \"natural order\" case-sensitive comparison.\n" "Natural order means that rather than solely comparing single character code values, strings are ordered in a " "natural way. For example, the string \"hello10\" is considered greater than the string \"hello2\" even though " @@ -325,7 +325,7 @@ DefineConsoleFunction( strnatcmp, S32, ( const char* str1, const char* str2 ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( strinatcmp, S32, ( const char* str1, const char* str2 ),, +DefineEngineFunction( strinatcmp, S32, ( const char* str1, const char* str2 ),, "Compares two strings using \"natural order\" case-insensitive comparison.\n" "Natural order means that rather than solely comparing single character code values, strings are ordered in a " "natural way. For example, the string \"hello10\" is considered greater than the string \"hello2\" even though " @@ -360,7 +360,7 @@ DefineConsoleFunction( strinatcmp, S32, ( const char* str1, const char* str2 ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( strlen, S32, ( const char* str ),, +DefineEngineFunction( strlen, S32, ( const char* str ),, "Get the length of the given string in bytes.\n" "@note This does not return a true character count for strings with multi-byte characters!\n" "@param str A string.\n" @@ -371,7 +371,7 @@ DefineConsoleFunction( strlen, S32, ( const char* str ),, } //----------------------------------------------------------------------------- -DefineConsoleFunction( strlenskip, S32, ( const char* str, const char* first, const char* last ),, +DefineEngineFunction( strlenskip, S32, ( const char* str, const char* first, const char* last ),, "Calculate the length of a string in characters, skipping everything between and including first and last.\n" "@param str A string.\n" "@param first First character to look for to skip block of text.\n" @@ -406,7 +406,7 @@ DefineConsoleFunction( strlenskip, S32, ( const char* str, const char* first, co //----------------------------------------------------------------------------- -DefineConsoleFunction( strstr, S32, ( const char* string, const char* substring ),, +DefineEngineFunction( strstr, S32, ( const char* string, const char* substring ),, "Find the start of @a substring in the given @a string searching from left to right.\n" "@param string The string to search.\n" "@param substring The string to search for.\n" @@ -425,7 +425,7 @@ DefineConsoleFunction( strstr, S32, ( const char* string, const char* substring //----------------------------------------------------------------------------- -DefineConsoleFunction( strpos, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ), +DefineEngineFunction( strpos, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ), "Find the start of @a needle in @a haystack searching from left to right beginning at the given offset.\n" "@param haystack The string to search.\n" "@param needle The string to search for.\n" @@ -450,7 +450,7 @@ DefineConsoleFunction( strpos, S32, ( const char* haystack, const char* needle, //----------------------------------------------------------------------------- -DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ), +DefineEngineFunction( strposr, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ), "Find the start of @a needle in @a haystack searching from right to left beginning at the given offset.\n" "@param haystack The string to search.\n" "@param needle The string to search for.\n" @@ -477,7 +477,7 @@ DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle, //----------------------------------------------------------------------------- -DefineConsoleFunction( ltrim, const char*, ( const char* str ),, +DefineEngineFunction( ltrim, const char*, ( const char* str ),, "Remove leading whitespace from the string.\n" "@param str A string.\n" "@return A string that is the same as @a str but with any leading (i.e. leftmost) whitespace removed.\n\n" @@ -496,7 +496,7 @@ DefineConsoleFunction( ltrim, const char*, ( const char* str ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( rtrim, const char*, ( const char* str ),, +DefineEngineFunction( rtrim, const char*, ( const char* str ),, "Remove trailing whitespace from the string.\n" "@param str A string.\n" "@return A string that is the same as @a str but with any trailing (i.e. rightmost) whitespace removed.\n\n" @@ -523,7 +523,7 @@ DefineConsoleFunction( rtrim, const char*, ( const char* str ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( trim, const char*, ( const char* str ),, +DefineEngineFunction( trim, const char*, ( const char* str ),, "Remove leading and trailing whitespace from the string.\n" "@param str A string.\n" "@return A string that is the same as @a str but with any leading (i.e. leftmost) and trailing (i.e. rightmost) whitespace removed.\n\n" @@ -551,7 +551,7 @@ DefineConsoleFunction( trim, const char*, ( const char* str ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( stripChars, const char*, ( const char* str, const char* chars ),, +DefineEngineFunction( stripChars, const char*, ( const char* str, const char* chars ),, "Remove all occurrences of characters contained in @a chars from @a str.\n" "@param str The string to filter characters out from.\n" "@param chars A string of characters to filter out from @a str.\n" @@ -575,7 +575,7 @@ DefineConsoleFunction( stripChars, const char*, ( const char* str, const char* c //----------------------------------------------------------------------------- -DefineConsoleFunction( strlwr, const char*, ( const char* str ),, +DefineEngineFunction( strlwr, const char*, ( const char* str ),, "Return an all lower-case version of the given string.\n" "@param str A string.\n" "@return A version of @a str with all characters converted to lower-case.\n\n" @@ -593,7 +593,7 @@ DefineConsoleFunction( strlwr, const char*, ( const char* str ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( strupr, const char*, ( const char* str ),, +DefineEngineFunction( strupr, const char*, ( const char* str ),, "Return an all upper-case version of the given string.\n" "@param str A string.\n" "@return A version of @a str with all characters converted to upper-case.\n\n" @@ -611,7 +611,7 @@ DefineConsoleFunction( strupr, const char*, ( const char* str ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( strchr, const char*, ( const char* str, const char* chr ),, +DefineEngineFunction( strchr, const char*, ( const char* str, const char* chr ),, "Find the first occurrence of the given character in @a str.\n" "@param str The string to search.\n" "@param chr The character to search for. Only the first character from the string is taken.\n" @@ -625,7 +625,7 @@ DefineConsoleFunction( strchr, const char*, ( const char* str, const char* chr ) //----------------------------------------------------------------------------- -DefineConsoleFunction( strrchr, const char*, ( const char* str, const char* chr ),, +DefineEngineFunction( strrchr, const char*, ( const char* str, const char* chr ),, "Find the last occurrence of the given character in @a str." "@param str The string to search.\n" "@param chr The character to search for. Only the first character from the string is taken.\n" @@ -639,7 +639,7 @@ DefineConsoleFunction( strrchr, const char*, ( const char* str, const char* chr //----------------------------------------------------------------------------- -DefineConsoleFunction( strreplace, const char*, ( const char* source, const char* from, const char* to ),, +DefineEngineFunction( strreplace, const char*, ( const char* source, const char* from, const char* to ),, "Replace all occurrences of @a from in @a source with @a to.\n" "@param source The string in which to replace the occurrences of @a from.\n" "@param from The string to replace in @a source.\n" @@ -690,7 +690,7 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char //----------------------------------------------------------------------------- -DefineConsoleFunction( strrepeat, const char*, ( const char* str, S32 numTimes, const char* delimiter ), ( "" ), +DefineEngineFunction( strrepeat, const char*, ( const char* str, S32 numTimes, const char* delimiter ), ( "" ), "Return a string that repeats @a str @a numTimes number of times delimiting each occurrence with @a delimiter.\n" "@param str The string to repeat multiple times.\n" "@param numTimes The number of times to repeat @a str in the result string.\n" @@ -717,7 +717,7 @@ DefineConsoleFunction( strrepeat, const char*, ( const char* str, S32 numTimes, //----------------------------------------------------------------------------- -DefineConsoleFunction( getSubStr, const char*, ( const char* str, S32 start, S32 numChars ), ( -1 ), +DefineEngineFunction( getSubStr, const char*, ( const char* str, S32 start, S32 numChars ), ( -1 ), "@brief Return a substring of @a str starting at @a start and continuing either through to the end of @a str " "(if @a numChars is -1) or for @a numChars characters (except if this would exceed the actual source " "string length).\n" @@ -758,7 +758,7 @@ DefineConsoleFunction( getSubStr, const char*, ( const char* str, S32 start, S32 //----------------------------------------------------------------------------- -DefineConsoleFunction( strIsMatchExpr, bool, ( const char* pattern, const char* str, bool caseSensitive ), ( false ), +DefineEngineFunction( strIsMatchExpr, bool, ( const char* pattern, const char* str, bool caseSensitive ), ( false ), "Match a pattern against a string.\n" "@param pattern The wildcard pattern to match against. The pattern can include characters, '*' to match " "any number of characters and '?' to match a single character.\n" @@ -777,7 +777,7 @@ DefineConsoleFunction( strIsMatchExpr, bool, ( const char* pattern, const char* //----------------------------------------------------------------------------- -DefineConsoleFunction( strIsMatchMultipleExpr, bool, ( const char* patterns, const char* str, bool caseSensitive ), ( false ), +DefineEngineFunction( strIsMatchMultipleExpr, bool, ( const char* patterns, const char* str, bool caseSensitive ), ( false ), "Match a multiple patterns against a single string.\n" "@param patterns A tab-separated list of patterns. Each pattern can include charaters, '*' to match " "any number of characters and '?' to match a single character. Each of the patterns is tried in turn.\n" @@ -796,7 +796,7 @@ DefineConsoleFunction( strIsMatchMultipleExpr, bool, ( const char* patterns, con //----------------------------------------------------------------------------- -DefineConsoleFunction( getTrailingNumber, S32, ( const char* str ),, +DefineEngineFunction( getTrailingNumber, S32, ( const char* str ),, "Get the numeric suffix of the given input string.\n" "@param str The string from which to read out the numeric suffix.\n" "@return The numeric value of the number suffix of @a str or -1 if @a str has no such suffix.\n\n" @@ -813,7 +813,7 @@ DefineConsoleFunction( getTrailingNumber, S32, ( const char* str ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( stripTrailingNumber, String, ( const char* str ),, +DefineEngineFunction( stripTrailingNumber, String, ( const char* str ),, "Strip a numeric suffix from the given string.\n" "@param str The string from which to strip its numeric suffix.\n" "@return The string @a str without its number suffix or the original string @a str if it has no such suffix.\n\n" @@ -829,7 +829,7 @@ DefineConsoleFunction( stripTrailingNumber, String, ( const char* str ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( getFirstNumber, String, ( const char* str ),, +DefineEngineFunction( getFirstNumber, String, ( const char* str ),, "Get the first occuring number from @a str.\n" "@param str The string from which to read out the first number.\n" "@return String representation of the number or "" if no number.\n\n") @@ -841,7 +841,7 @@ DefineConsoleFunction( getFirstNumber, String, ( const char* str ),, //---------------------------------------------------------------- -DefineConsoleFunction( isspace, bool, ( const char* str, S32 index ),, +DefineEngineFunction( isspace, bool, ( const char* str, S32 index ),, "Test whether the character at the given position is a whitespace character.\n" "Characters such as tab, space, or newline are considered whitespace.\n" "@param str The string to test.\n" @@ -858,7 +858,7 @@ DefineConsoleFunction( isspace, bool, ( const char* str, S32 index ),, //---------------------------------------------------------------- -DefineConsoleFunction( isalnum, bool, ( const char* str, S32 index ),, +DefineEngineFunction( isalnum, bool, ( const char* str, S32 index ),, "Test whether the character at the given position is an alpha-numeric character.\n" "Alpha-numeric characters are characters that are either alphabetic (a-z, A-Z) or numbers (0-9).\n" "@param str The string to test.\n" @@ -875,7 +875,7 @@ DefineConsoleFunction( isalnum, bool, ( const char* str, S32 index ),, //---------------------------------------------------------------- -DefineConsoleFunction( startsWith, bool, ( const char* str, const char* prefix, bool caseSensitive ), ( false ), +DefineEngineFunction( startsWith, bool, ( const char* str, const char* prefix, bool caseSensitive ), ( false ), "Test whether the given string begins with the given prefix.\n" "@param str The string to test.\n" "@param prefix The potential prefix of @a str.\n" @@ -924,7 +924,7 @@ DefineConsoleFunction( startsWith, bool, ( const char* str, const char* prefix, //---------------------------------------------------------------- -DefineConsoleFunction( endsWith, bool, ( const char* str, const char* suffix, bool caseSensitive ), ( false ), +DefineEngineFunction( endsWith, bool, ( const char* str, const char* suffix, bool caseSensitive ), ( false ), "@brief Test whether the given string ends with the given suffix.\n\n" "@param str The string to test.\n" "@param suffix The potential suffix of @a str.\n" @@ -978,7 +978,7 @@ DefineConsoleFunction( endsWith, bool, ( const char* str, const char* suffix, bo //---------------------------------------------------------------- -DefineConsoleFunction( strchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ), +DefineEngineFunction( strchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ), "Find the first occurrence of the given character in the given string.\n" "@param str The string to search.\n" "@param chr The character to look for. Only the first character of this string will be searched for.\n" @@ -998,7 +998,7 @@ DefineConsoleFunction( strchrpos, S32, ( const char* str, const char* chr, S32 s //---------------------------------------------------------------- -DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ), +DefineEngineFunction( strrchrpos, S32, ( const char* str, const char* chr, S32 start ), ( 0 ), "Find the last occurrence of the given character in the given string.\n" "@param str The string to search.\n" "@param chr The character to look for. Only the first character of this string will be searched for.\n" @@ -1025,7 +1025,7 @@ DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32 //---------------------------------------------------------------- -DefineConsoleFunction(ColorFloatToInt, ColorI, (LinearColorF color), , +DefineEngineFunction(ColorFloatToInt, ColorI, (LinearColorF color), , "Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n" "@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n" "@return Converted color value (0 - 255)\n\n" @@ -1037,7 +1037,7 @@ DefineConsoleFunction(ColorFloatToInt, ColorI, (LinearColorF color), , return color.toColorI(); } -DefineConsoleFunction(ColorIntToFloat, LinearColorF, (ColorI color), , +DefineEngineFunction(ColorIntToFloat, LinearColorF, (ColorI color), , "Convert from a integer color to an float color (0 to 255 to 0.0 - 1.0).\n" "@param color Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n" "@return Converted color value (0.0 - 1.0)\n\n" @@ -1049,7 +1049,7 @@ DefineConsoleFunction(ColorIntToFloat, LinearColorF, (ColorI color), , return LinearColorF(color); } -DefineConsoleFunction(ColorRGBToHEX, const char*, (ColorI color), , +DefineEngineFunction(ColorRGBToHEX, const char*, (ColorI color), , "Convert from a integer RGB (red, green, blue) color to hex color value (0 to 255 to 00 - FF).\n" "@param color Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. It excepts an alpha, but keep in mind this will not be converted.\n" "@return Hex color value (#000000 - #FFFFFF), alpha isn't handled/converted so it is only the RGB value\n\n" @@ -1061,7 +1061,7 @@ DefineConsoleFunction(ColorRGBToHEX, const char*, (ColorI color), , return Con::getReturnBuffer(color.getHex()); } -DefineConsoleFunction(ColorRGBToHSB, const char*, (ColorI color), , +DefineEngineFunction(ColorRGBToHSB, const char*, (ColorI color), , "Convert from a integer RGB (red, green, blue) color to HSB (hue, saturation, brightness). HSB is also know as HSL or HSV as well, with the last letter standing for lightness or value.\n" "@param color Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. It excepts an alpha, but keep in mind this will not be converted.\n" "@return HSB color value, alpha isn't handled/converted so it is only the RGB value\n\n" @@ -1075,7 +1075,7 @@ DefineConsoleFunction(ColorRGBToHSB, const char*, (ColorI color), , return Con::getReturnBuffer(s); } -DefineConsoleFunction(ColorHEXToRGB, ColorI, (const char* hex), , +DefineEngineFunction(ColorHEXToRGB, ColorI, (const char* hex), , "Convert from a hex color value to an integer RGB (red, green, blue) color (00 - FF to 0 to 255).\n" "@param hex Hex color value (#000000 - #FFFFFF) to be converted to an RGB (red, green, blue) value.\n" "@return Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. Alpha isn't handled/converted so only pay attention to the RGB value\n\n" @@ -1089,7 +1089,7 @@ DefineConsoleFunction(ColorHEXToRGB, ColorI, (const char* hex), , return color; } -DefineConsoleFunction(ColorHSBToRGB, ColorI, (Point3I hsb), , +DefineEngineFunction(ColorHSBToRGB, ColorI, (Point3I hsb), , "Convert from a HSB (hue, saturation, brightness) to an integer RGB (red, green, blue) color. HSB is also know as HSL or HSV as well, with the last letter standing for lightness or value.\n" "@param hsb HSB (hue, saturation, brightness) value to be converted.\n" "@return Integer color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha. Alpha isn't handled/converted so only pay attention to the RGB value\n\n" @@ -1105,7 +1105,7 @@ DefineConsoleFunction(ColorHSBToRGB, ColorI, (Point3I hsb), , //---------------------------------------------------------------- -DefineConsoleFunction( strToggleCaseToWords, const char*, ( const char* str ),, +DefineEngineFunction( strToggleCaseToWords, const char*, ( const char* str ),, "Parse a Toggle Case word into separate words.\n" "@param str The string to parse.\n" "@return new string space separated.\n\n" @@ -1130,7 +1130,7 @@ DefineConsoleFunction( strToggleCaseToWords, const char*, ( const char* str ),, //---------------------------------------------------------------- // Warning: isInt and isFloat are very 'strict' and might need to be adjusted to allow other values. //seanmc -DefineConsoleFunction( isInt, bool, ( const char* str),, +DefineEngineFunction( isInt, bool, ( const char* str),, "Returns true if the string is an integer.\n" "@param str The string to test.\n" "@return true if @a str is an integer and false if not\n\n" @@ -1144,7 +1144,7 @@ DefineConsoleFunction( isInt, bool, ( const char* str),, //---------------------------------------------------------------- -DefineConsoleFunction( isFloat, bool, ( const char* str, bool sciOk), (false), +DefineEngineFunction( isFloat, bool, ( const char* str, bool sciOk), (false), "Returns true if the string is a float.\n" "@param str The string to test.\n" "@param sciOk Test for correct scientific notation and accept it (ex. 1.2e+14)" @@ -1159,7 +1159,7 @@ DefineConsoleFunction( isFloat, bool, ( const char* str, bool sciOk), (false), //---------------------------------------------------------------- -DefineConsoleFunction( isValidPort, bool, ( const char* str),, +DefineEngineFunction( isValidPort, bool, ( const char* str),, "Returns true if the string is a valid port number.\n" "@param str The string to test.\n" "@return true if @a str is a port and false if not\n\n" @@ -1179,7 +1179,7 @@ DefineConsoleFunction( isValidPort, bool, ( const char* str),, //---------------------------------------------------------------- -DefineConsoleFunction( isValidIP, bool, ( const char* str),, +DefineEngineFunction( isValidIP, bool, ( const char* str),, "Returns true if the string is a valid ip address, excepts localhost.\n" "@param str The string to test.\n" "@return true if @a str is a valid ip address and false if not\n\n" @@ -1214,7 +1214,7 @@ ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]" //----------------------------------------------------------------------------- -DefineConsoleFunction( getWord, const char*, ( const char* text, S32 index ),, +DefineEngineFunction( getWord, const char*, ( const char* text, S32 index ),, "Extract the word at the given @a index in the whitespace-separated list in @a text.\n" "Words in @a text must be separated by newlines, spaces, and/or tabs.\n" "@param text A whitespace-separated list of words.\n" @@ -1235,7 +1235,7 @@ DefineConsoleFunction( getWord, const char*, ( const char* text, S32 index ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( getWords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ), +DefineEngineFunction( getWords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ), "Extract a range of words from the given @a startIndex onwards thru @a endIndex.\n" "Words in @a text must be separated by newlines, spaces, and/or tabs.\n" "@param text A whitespace-separated list of words.\n" @@ -1262,7 +1262,7 @@ DefineConsoleFunction( getWords, const char*, ( const char* text, S32 startIndex //----------------------------------------------------------------------------- -DefineConsoleFunction( setWord, const char*, ( const char* text, S32 index, const char* replacement ),, +DefineEngineFunction( setWord, const char*, ( const char* text, S32 index, const char* replacement ),, "Replace the word in @a text at the given @a index with @a replacement.\n" "Words in @a text must be separated by newlines, spaces, and/or tabs.\n" "@param text A whitespace-separated list of words.\n" @@ -1284,7 +1284,7 @@ DefineConsoleFunction( setWord, const char*, ( const char* text, S32 index, cons //----------------------------------------------------------------------------- -DefineConsoleFunction( removeWord, const char*, ( const char* text, S32 index ),, +DefineEngineFunction( removeWord, const char*, ( const char* text, S32 index ),, "Remove the word in @a text at the given @a index.\n" "Words in @a text must be separated by newlines, spaces, and/or tabs.\n" "@param text A whitespace-separated list of words.\n" @@ -1304,7 +1304,7 @@ DefineConsoleFunction( removeWord, const char*, ( const char* text, S32 index ), //----------------------------------------------------------------------------- -DefineConsoleFunction( getWordCount, S32, ( const char* text ),, +DefineEngineFunction( getWordCount, S32, ( const char* text ),, "Return the number of whitespace-separated words in @a text.\n" "Words in @a text must be separated by newlines, spaces, and/or tabs.\n" "@param text A whitespace-separated list of words.\n" @@ -1365,7 +1365,7 @@ DefineEngineFunction( weekdayNumToStr, String, ( S32 num, bool abbreviate ), (fa //----------------------------------------------------------------------------- -DefineConsoleFunction( getField, const char*, ( const char* text, S32 index ),, +DefineEngineFunction( getField, const char*, ( const char* text, S32 index ),, "Extract the field at the given @a index in the newline and/or tab separated list in @a text.\n" "Fields in @a text must be separated by newlines and/or tabs.\n" "@param text A list of fields separated by newlines and/or tabs.\n" @@ -1385,7 +1385,7 @@ DefineConsoleFunction( getField, const char*, ( const char* text, S32 index ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( getFields, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ), +DefineEngineFunction( getFields, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ), "Extract a range of fields from the given @a startIndex onwards thru @a endIndex.\n" "Fields in @a text must be separated by newlines and/or tabs.\n" "@param text A list of fields separated by newlines and/or tabs.\n" @@ -1411,7 +1411,7 @@ DefineConsoleFunction( getFields, const char*, ( const char* text, S32 startInde //----------------------------------------------------------------------------- -DefineConsoleFunction( setField, const char*, ( const char* text, S32 index, const char* replacement ),, +DefineEngineFunction( setField, const char*, ( const char* text, S32 index, const char* replacement ),, "Replace the field in @a text at the given @a index with @a replacement.\n" "Fields in @a text must be separated by newlines and/or tabs.\n" "@param text A list of fields separated by newlines and/or tabs.\n" @@ -1432,7 +1432,7 @@ DefineConsoleFunction( setField, const char*, ( const char* text, S32 index, con //----------------------------------------------------------------------------- -DefineConsoleFunction( removeField, const char*, ( const char* text, S32 index ),, +DefineEngineFunction( removeField, const char*, ( const char* text, S32 index ),, "Remove the field in @a text at the given @a index.\n" "Fields in @a text must be separated by newlines and/or tabs.\n" "@param text A list of fields separated by newlines and/or tabs.\n" @@ -1451,7 +1451,7 @@ DefineConsoleFunction( removeField, const char*, ( const char* text, S32 index ) //----------------------------------------------------------------------------- -DefineConsoleFunction( getFieldCount, S32, ( const char* text ),, +DefineEngineFunction( getFieldCount, S32, ( const char* text ),, "Return the number of newline and/or tab separated fields in @a text.\n" "@param text A list of fields separated by newlines and/or tabs.\n" "@return The number of newline and/or tab sepearated elements in @a text.\n\n" @@ -1467,7 +1467,7 @@ DefineConsoleFunction( getFieldCount, S32, ( const char* text ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( getRecord, const char*, ( const char* text, S32 index ),, +DefineEngineFunction( getRecord, const char*, ( const char* text, S32 index ),, "Extract the record at the given @a index in the newline-separated list in @a text.\n" "Records in @a text must be separated by newlines.\n" "@param text A list of records separated by newlines.\n" @@ -1487,7 +1487,7 @@ DefineConsoleFunction( getRecord, const char*, ( const char* text, S32 index ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( getRecords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ), +DefineEngineFunction( getRecords, const char*, ( const char* text, S32 startIndex, S32 endIndex ), ( -1 ), "Extract a range of records from the given @a startIndex onwards thru @a endIndex.\n" "Records in @a text must be separated by newlines.\n" "@param text A list of records separated by newlines.\n" @@ -1513,7 +1513,7 @@ DefineConsoleFunction( getRecords, const char*, ( const char* text, S32 startInd //----------------------------------------------------------------------------- -DefineConsoleFunction( setRecord, const char*, ( const char* text, S32 index, const char* replacement ),, +DefineEngineFunction( setRecord, const char*, ( const char* text, S32 index, const char* replacement ),, "Replace the record in @a text at the given @a index with @a replacement.\n" "Records in @a text must be separated by newlines.\n" "@param text A list of records separated by newlines.\n" @@ -1534,7 +1534,7 @@ DefineConsoleFunction( setRecord, const char*, ( const char* text, S32 index, co //----------------------------------------------------------------------------- -DefineConsoleFunction( removeRecord, const char*, ( const char* text, S32 index ),, +DefineEngineFunction( removeRecord, const char*, ( const char* text, S32 index ),, "Remove the record in @a text at the given @a index.\n" "Records in @a text must be separated by newlines.\n" "@param text A list of records separated by newlines.\n" @@ -1553,7 +1553,7 @@ DefineConsoleFunction( removeRecord, const char*, ( const char* text, S32 index //----------------------------------------------------------------------------- -DefineConsoleFunction( getRecordCount, S32, ( const char* text ),, +DefineEngineFunction( getRecordCount, S32, ( const char* text ),, "Return the number of newline-separated records in @a text.\n" "@param text A list of records separated by newlines.\n" "@return The number of newline-sepearated elements in @a text.\n\n" @@ -1569,7 +1569,7 @@ DefineConsoleFunction( getRecordCount, S32, ( const char* text ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( firstWord, const char*, ( const char* text ),, +DefineEngineFunction( firstWord, const char*, ( const char* text ),, "Return the first word in @a text.\n" "@param text A list of words separated by newlines, spaces, and/or tabs.\n" "@return The word at index 0 in @a text or \"\" if @a text is empty.\n\n" @@ -1585,7 +1585,7 @@ DefineConsoleFunction( firstWord, const char*, ( const char* text ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( restWords, const char*, ( const char* text ),, +DefineEngineFunction( restWords, const char*, ( const char* text ),, "Return all but the first word in @a text.\n" "@param text A list of words separated by newlines, spaces, and/or tabs.\n" "@return @a text with the first word removed.\n\n" @@ -1619,7 +1619,7 @@ static bool isInSet(char c, const char *set) return false; } -DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* token, const char* delim), , "( string str, string token, string delimiters ) " +DefineEngineFunction( nextToken, const char*, ( const char* str1, const char* token, const char* delim), , "( string str, string token, string delimiters ) " "Tokenize a string using a set of delimiting characters.\n" "This function first skips all leading charaters in @a str that are contained in @a delimiters. " "From that position, it then scans for the next character in @a str that is contained in @a delimiters and stores all characters " @@ -1688,7 +1688,7 @@ DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* t //----------------------------------------------------------------------------- -DefineConsoleFunction( getToken, const char*, ( const char* text, const char* delimiters, S32 index ),, +DefineEngineFunction( getToken, const char*, ( const char* text, const char* delimiters, S32 index ),, "Extract the substring at the given @a index in the @a delimiters separated list in @a text.\n" "@param text A @a delimiters list of substrings.\n" "@param delimiters Character or characters that separate the list of substrings in @a text.\n" @@ -1709,7 +1709,7 @@ DefineConsoleFunction( getToken, const char*, ( const char* text, const char* de //----------------------------------------------------------------------------- -DefineConsoleFunction( getTokens, const char*, ( const char* text, const char* delimiters, S32 startIndex, S32 endIndex ), ( -1 ), +DefineEngineFunction( getTokens, const char*, ( const char* text, const char* delimiters, S32 startIndex, S32 endIndex ), ( -1 ), "Extract a range of substrings separated by @a delimiters at the given @a startIndex onwards thru @a endIndex.\n" "@param text A @a delimiters list of substrings.\n" "@param delimiters Character or characters that separate the list of substrings in @a text.\n" @@ -1736,7 +1736,7 @@ DefineConsoleFunction( getTokens, const char*, ( const char* text, const char* d //----------------------------------------------------------------------------- -DefineConsoleFunction( setToken, const char*, ( const char* text, const char* delimiters, S32 index, const char* replacement ),, +DefineEngineFunction( setToken, const char*, ( const char* text, const char* delimiters, S32 index, const char* replacement ),, "Replace the substring in @a text separated by @a delimiters at the given @a index with @a replacement.\n" "@param text A @a delimiters list of substrings.\n" "@param delimiters Character or characters that separate the list of substrings in @a text.\n" @@ -1758,7 +1758,7 @@ DefineConsoleFunction( setToken, const char*, ( const char* text, const char* de //----------------------------------------------------------------------------- -DefineConsoleFunction( removeToken, const char*, ( const char* text, const char* delimiters, S32 index ),, +DefineEngineFunction( removeToken, const char*, ( const char* text, const char* delimiters, S32 index ),, "Remove the substring in @a text separated by @a delimiters at the given @a index.\n" "@param text A @a delimiters list of substrings.\n" "@param delimiters Character or characters that separate the list of substrings in @a text.\n" @@ -1778,7 +1778,7 @@ DefineConsoleFunction( removeToken, const char*, ( const char* text, const char* //----------------------------------------------------------------------------- -DefineConsoleFunction( getTokenCount, S32, ( const char* text, const char* delimiters),, +DefineEngineFunction( getTokenCount, S32, ( const char* text, const char* delimiters),, "Return the number of @a delimiters substrings in @a text.\n" "@param text A @a delimiters list of substrings.\n" "@param delimiters Character or characters that separate the list of substrings in @a text.\n" @@ -1837,7 +1837,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),, return str; } -DefineConsoleFunction( getTag, const char*, ( const char* textTagString ), , "( string textTagString ) " +DefineEngineFunction( getTag, const char*, ( const char* textTagString ), , "( string textTagString ) " "@brief Extracts the tag from a tagged string\n\n" "Should only be used within the context of a function that receives a tagged " @@ -1968,7 +1968,7 @@ DefineEngineFunction( debugv, void, ( const char* variableName ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( expandEscape, const char*, ( const char* text ),, +DefineEngineFunction( expandEscape, const char*, ( const char* text ),, "@brief Replace all characters in @a text that need to be escaped for the string to be a valid string literal with their " "respective escape sequences.\n\n" "All characters in @a text that cannot appear in a string literal will be replaced by an escape sequence (\\\\n, \\\\t, etc).\n\n" @@ -1990,7 +1990,7 @@ DefineConsoleFunction( expandEscape, const char*, ( const char* text ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( collapseEscape, const char*, ( const char* text ),, +DefineEngineFunction( collapseEscape, const char*, ( const char* text ),, "Replace all escape sequences in @a text with their respective character codes.\n\n" "This function replaces all escape sequences (\\\\n, \\\\t, etc) in the given string " "with the respective characters they represent.\n\n" @@ -2046,7 +2046,7 @@ DefineEngineFunction( setLogMode, void, ( S32 mode ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( quit, void, ( ),, +DefineEngineFunction( quit, void, ( ),, "Shut down the engine and exit its process.\n" "This function cleanly uninitializes the engine and then exits back to the system with a process " "exit status indicating a clean exit.\n\n" @@ -2059,7 +2059,7 @@ DefineConsoleFunction( quit, void, ( ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( realQuit, void, (), , "") +DefineEngineFunction( realQuit, void, (), , "") { Platform::postQuitMessage(0); } @@ -2067,7 +2067,7 @@ DefineConsoleFunction( realQuit, void, (), , "") //----------------------------------------------------------------------------- -DefineConsoleFunction( quitWithErrorMessage, void, ( const char* message, S32 status ), (0), +DefineEngineFunction( quitWithErrorMessage, void, ( const char* message, S32 status ), (0), "Display an error message box showing the given @a message and then shut down the engine and exit its process.\n" "This function cleanly uninitialized the engine and then exits back to the system with a process " "exit status indicating an error.\n\n" @@ -2088,7 +2088,7 @@ DefineConsoleFunction( quitWithErrorMessage, void, ( const char* message, S32 st //----------------------------------------------------------------------------- -DefineConsoleFunction( quitWithStatus, void, ( S32 status ), (0), +DefineEngineFunction( quitWithStatus, void, ( S32 status ), (0), "Shut down the engine and exit its process.\n" "This function cleanly uninitializes the engine and then exits back to the system with a given " "return status code.\n\n" @@ -2259,7 +2259,7 @@ ConsoleFunction( call, const char *, 2, 0, "( string functionName, string args.. static U32 execDepth = 0; static U32 journalDepth = 1; -DefineConsoleFunction( getDSOPath, const char*, ( const char* scriptFileName ),, +DefineEngineFunction( getDSOPath, const char*, ( const char* scriptFileName ),, "Get the absolute path to the file in which the compiled code for the given script file will be stored.\n" "@param scriptFileName %Path to the .cs script file.\n" "@return The absolute path to the .dso file for the given script file.\n\n" @@ -2373,12 +2373,12 @@ DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool jou return Con::executeFile(fileName, noCalls, journalScript); } -DefineConsoleFunction( eval, const char*, ( const char* consoleString ), , "eval(consoleString)" ) +DefineEngineFunction( eval, const char*, ( const char* consoleString ), , "eval(consoleString)" ) { return Con::evaluate(consoleString, false, NULL); } -DefineConsoleFunction( getVariable, const char*, ( const char* varName ), , "(string varName)\n" +DefineEngineFunction( getVariable, const char*, ( const char* varName ), , "(string varName)\n" "@brief Returns the value of the named variable or an empty string if not found.\n\n" "@varName Name of the variable to search for\n" "@return Value contained by varName, \"\" if the variable does not exist\n" @@ -2387,7 +2387,7 @@ DefineConsoleFunction( getVariable, const char*, ( const char* varName ), , "(st return Con::getVariable(varName); } -DefineConsoleFunction( setVariable, void, ( const char* varName, const char* value ), , "(string varName, string value)\n" +DefineEngineFunction( setVariable, void, ( const char* varName, const char* value ), , "(string varName, string value)\n" "@brief Sets the value of the named variable.\n\n" "@param varName Name of the variable to locate\n" "@param value New value of the variable\n" @@ -2397,7 +2397,7 @@ DefineConsoleFunction( setVariable, void, ( const char* varName, const char* val return Con::setVariable(varName, value); } -DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)" +DefineEngineFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)" "@brief Determines if a function exists or not\n\n" "@param funcName String containing name of the function\n" "@return True if the function exists, false if not\n" @@ -2406,7 +2406,7 @@ DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string fu return Con::isFunction(funcName); } -DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)" +DefineEngineFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)" "@brief Provides the name of the package the function belongs to\n\n" "@param funcName String containing name of the function\n" "@return The name of the function's package\n" @@ -2419,7 +2419,7 @@ DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ) return nse->mPackage; } -DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" +DefineEngineFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" "@brief Determines if a class/namespace method exists\n\n" "@param namespace Class or namespace, such as Player\n" "@param method Name of the function to search for\n" @@ -2434,7 +2434,7 @@ DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* meth return true; } -DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" +DefineEngineFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" "@brief Provides the name of the package the method belongs to\n\n" "@param namespace Class or namespace, such as Player\n" "@param method Name of the funciton to search for\n" @@ -2452,7 +2452,7 @@ DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, c return nse->mPackage; } -DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)" +DefineEngineFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)" "@brief Determines if a variable exists and contains a value\n" "@param varName Name of the variable to search for\n" "@return True if the variable was defined in script, false if not\n" @@ -2590,14 +2590,14 @@ DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varVa //----------------------------------------------------------------------------- -DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()" +DefineEngineFunction( isCurrentScriptToolScript, bool, (), , "()" "Returns true if the calling script is a tools script.\n" "@hide") { return Con::isCurrentScriptToolScript(); } -DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)" +DefineEngineFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)" "@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n" "@param File path of mod folder\n" "@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n" @@ -2609,7 +2609,7 @@ DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , //----------------------------------------------------------------------------- -DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group])" +DefineEngineFunction( pushInstantGroup, void, ( String group ),("") , "([group])" "@brief Pushes the current $instantGroup on a stack " "and sets it to the given value (or clears it).\n\n" "@note Currently only used for editors\n" @@ -2622,7 +2622,7 @@ DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group] Con::pushInstantGroup(); } -DefineConsoleFunction( popInstantGroup, void, (), , "()" +DefineEngineFunction( popInstantGroup, void, (), , "()" "@brief Pop and restore the last setting of $instantGroup off the stack.\n\n" "@note Currently only used for editors\n\n" "@ingroup Editors\n" @@ -2633,7 +2633,7 @@ DefineConsoleFunction( popInstantGroup, void, (), , "()" //----------------------------------------------------------------------------- -DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])" +DefineEngineFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])" "@note Appears to be useless in Torque 3D, should be deprecated\n" "@internal") { @@ -2670,7 +2670,7 @@ ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls //----------------------------------------------------------------------------- -DefineConsoleFunction( export, void, ( const char* pattern, const char* filename, bool append ), ( "", false ), +DefineEngineFunction( export, void, ( const char* pattern, const char* filename, bool append ), ( "", false ), "Write out the definitions of all global variables matching the given name @a pattern.\n" "If @a fileName is not \"\", the variable definitions are written to the specified file. Otherwise the " "definitions will be printed to the console.\n\n" @@ -2723,7 +2723,7 @@ DefineEngineFunction( deleteVariables, void, ( const char* pattern ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( trace, void, ( bool enable ), ( true ), +DefineEngineFunction( trace, void, ( bool enable ), ( true ), "Enable or disable tracing in the script code VM.\n\n" "When enabled, the script code runtime will trace the invocation and returns " "from all functions that are called and log them to the console. This is helpful in " @@ -2739,7 +2739,7 @@ DefineConsoleFunction( trace, void, ( bool enable ), ( true ), #if defined(TORQUE_DEBUG) || !defined(TORQUE_SHIPPING) -DefineConsoleFunction( debug, void, (),, +DefineEngineFunction( debug, void, (),, "Drops the engine into the native C++ debugger.\n\n" "This function triggers a debug break and drops the process into the IDE's debugger. If the process is not " "running with a debugger attached it will generate a runtime error on most platforms.\n\n" diff --git a/Engine/source/console/consoleXMLExport.cpp b/Engine/source/console/consoleXMLExport.cpp index 79e302595..e3431acdf 100644 --- a/Engine/source/console/consoleXMLExport.cpp +++ b/Engine/source/console/consoleXMLExport.cpp @@ -314,7 +314,7 @@ namespace Con { }; // namespace Con -DefineConsoleFunction( consoleExportXML, const char*, (), ,"Exports console definition XML representation" ) +DefineEngineFunction( consoleExportXML, const char*, (), ,"Exports console definition XML representation" ) { Con::XMLExport xmlExport; String xml; diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 049cce54d..2eef409b6 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -860,24 +860,6 @@ public: // while being only visible in the console interop. When we drop the console system, // these macros can be removed and all definitions that make use of them can be removed // as well. -#define DefineConsoleFunction( name, returnType, args, defaultArgs, usage ) \ - static inline returnType _fn ## name ## impl args; \ - static _EngineFunctionDefaultArguments< void args > _fn ## name ## DefaultArgs defaultArgs; \ - static _EngineConsoleThunkType< returnType >::ReturnType _ ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv ) \ - { \ - return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 1, returnType args >::thunk( \ - argc, argv, &_fn ## name ## impl, _fn ## name ## DefaultArgs \ - ) ); \ - } \ - static ConsoleFunctionHeader _ ## name ## header \ - ( #returnType, #args, #defaultArgs ); \ - static ConsoleConstructor \ - _ ## name ## obj( NULL, #name, _EngineConsoleThunkType< returnType >::CallbackType( _ ## name ## caster ), usage, \ - _EngineConsoleThunk< 1, returnType args >::NUM_ARGS - _EngineConsoleThunkCountArgs() defaultArgs, \ - _EngineConsoleThunk< 1, returnType args >::NUM_ARGS, \ - false, &_ ## name ## header \ - ); \ - static inline returnType _fn ## name ## impl args #define DefineConsoleMethod( className, name, returnType, args, defaultArgs, usage ) \ struct _ ## className ## name ## frame \ diff --git a/Engine/source/console/sim.cpp b/Engine/source/console/sim.cpp index cb01e8019..6bb194db3 100644 --- a/Engine/source/console/sim.cpp +++ b/Engine/source/console/sim.cpp @@ -86,7 +86,7 @@ namespace Sim ConsoleFunctionGroupBegin ( SimFunctions, "Functions relating to Sim."); -DefineConsoleFunction( nameToID, S32, (const char * objectName), ,"nameToID(object)") +DefineEngineFunction( nameToID, S32, (const char * objectName), ,"nameToID(object)") { SimObject *obj = Sim::findObject(objectName); if(obj) @@ -95,7 +95,7 @@ DefineConsoleFunction( nameToID, S32, (const char * objectName), ,"nameToID(obje return -1; } -DefineConsoleFunction( isObject, bool, (const char * objectName), ,"isObject(object)") +DefineEngineFunction( isObject, bool, (const char * objectName), ,"isObject(object)") { if (!dStrcmp(objectName, "0") || !dStrcmp(objectName, "")) return false; @@ -133,7 +133,7 @@ ConsoleDocFragment _spawnObject1( "bool spawnObject(class [, dataBlock, name, properties, script]);" ); -DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass +DefineEngineFunction( spawnObject, S32, ( const char * spawnClass , const char * spawnDataBlock , const char * spawnName , const char * spawnProperties @@ -149,33 +149,33 @@ DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass return -1; } -DefineConsoleFunction( cancel, void, (S32 eventId), ,"cancel(eventId)") +DefineEngineFunction( cancel, void, (S32 eventId), ,"cancel(eventId)") { Sim::cancelEvent(eventId); } -DefineConsoleFunction( cancelAll, void, (const char * objectId), ,"cancelAll(objectId): cancel pending events on the specified object. Events will be automatically cancelled if object is deleted.") +DefineEngineFunction( cancelAll, void, (const char * objectId), ,"cancelAll(objectId): cancel pending events on the specified object. Events will be automatically cancelled if object is deleted.") { Sim::cancelPendingEvents(Sim::findObject(objectId)); } -DefineConsoleFunction( isEventPending, bool, (S32 scheduleId), ,"isEventPending(%scheduleId);") +DefineEngineFunction( isEventPending, bool, (S32 scheduleId), ,"isEventPending(%scheduleId);") { return Sim::isEventPending(scheduleId); } -DefineConsoleFunction( getEventTimeLeft, S32, (S32 scheduleId), ,"getEventTimeLeft(scheduleId) Get the time left in ms until this event will trigger.") +DefineEngineFunction( getEventTimeLeft, S32, (S32 scheduleId), ,"getEventTimeLeft(scheduleId) Get the time left in ms until this event will trigger.") { return Sim::getEventTimeLeft(scheduleId); } -DefineConsoleFunction( getScheduleDuration, S32, (S32 scheduleId), ,"getScheduleDuration(%scheduleId);" ) +DefineEngineFunction( getScheduleDuration, S32, (S32 scheduleId), ,"getScheduleDuration(%scheduleId);" ) { S32 ret = Sim::getScheduleDuration(scheduleId); return ret; } -DefineConsoleFunction( getTimeSinceStart, S32, (S32 scheduleId), ,"getTimeSinceStart(%scheduleId);" ) +DefineEngineFunction( getTimeSinceStart, S32, (S32 scheduleId), ,"getTimeSinceStart(%scheduleId);" ) { S32 ret = Sim::getTimeSinceStart(scheduleId); return ret; @@ -202,7 +202,7 @@ ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, isConnected(); } -DefineConsoleFunction( dbgDisconnect, void, (), , "()" +DefineEngineFunction( dbgDisconnect, void, (), , "()" "Forcibly disconnects any attached script debugging client.\n" "@internal Primarily used for Torsion and other debugging tools") { diff --git a/Engine/source/core/dnet.cpp b/Engine/source/core/dnet.cpp index a5fe53f6c..e7d1b6ae0 100644 --- a/Engine/source/core/dnet.cpp +++ b/Engine/source/core/dnet.cpp @@ -50,7 +50,7 @@ static const char *packetTypeNames[] = //----------------------------------------------------------------- //----------------------------------------------------------------- //----------------------------------------------------------------- -DefineConsoleFunction( DNetSetLogging, void, (bool enabled), , "(bool enabled)" +DefineEngineFunction( DNetSetLogging, void, (bool enabled), , "(bool enabled)" "@brief Enables logging of the connection protocols\n\n" "When enabled a lot of network debugging information is sent to the console.\n" "@param enabled True to enable, false to disable\n" diff --git a/Engine/source/core/stringBuffer.cpp b/Engine/source/core/stringBuffer.cpp index 3d15a6183..a55446885 100644 --- a/Engine/source/core/stringBuffer.cpp +++ b/Engine/source/core/stringBuffer.cpp @@ -48,12 +48,12 @@ void dumpAllStrings(); }; - DefineConsoleFunction( sbmDumpStats, void, (), , "()") + DefineEngineFunction( sbmDumpStats, void, (), , "()") { StringBufferManager::getManager().dumpStats(); } - DefineConsoleFunction( sbmDumpStrings, void, (), , "()") + DefineEngineFunction( sbmDumpStrings, void, (), , "()") { StringBufferManager::getManager().dumpAllStrings(); } diff --git a/Engine/source/core/util/str.cpp b/Engine/source/core/util/str.cpp index 63580e2b4..1a15b8b85 100644 --- a/Engine/source/core/util/str.cpp +++ b/Engine/source/core/util/str.cpp @@ -480,7 +480,7 @@ static U32 sgStringInstances; #endif -DefineConsoleFunction( dumpStringMemStats, void, (), , "()" +DefineEngineFunction( dumpStringMemStats, void, (), , "()" "@brief Dumps information about String memory usage\n\n" "@ingroup Debugging\n" "@ingroup Strings\n") diff --git a/Engine/source/environment/VolumetricFogRTManager.cpp b/Engine/source/environment/VolumetricFogRTManager.cpp index 7b7b00d50..9eca811f9 100644 --- a/Engine/source/environment/VolumetricFogRTManager.cpp +++ b/Engine/source/environment/VolumetricFogRTManager.cpp @@ -283,7 +283,7 @@ VolumetricFogRTManager* VolumetricFogRTManager::get() return gVolumetricFogRTManager; } -DefineConsoleFunction(SetFogVolumeQuality, S32, (U32 new_quality), , +DefineEngineFunction(SetFogVolumeQuality, S32, (U32 new_quality), , "@brief Resizes the rendertargets of the Volumetric Fog object.\n" "@params new_quality new quality for the rendertargets 1 = full size, 2 = halfsize, 3 = 1/3, 4 = 1/4 ...") { diff --git a/Engine/source/gfx/gfxDevice.cpp b/Engine/source/gfx/gfxDevice.cpp index 28add7718..806cf4baf 100644 --- a/Engine/source/gfx/gfxDevice.cpp +++ b/Engine/source/gfx/gfxDevice.cpp @@ -1333,7 +1333,7 @@ DefineEngineFunction( getBestHDRFormat, GFXFormat, (),, return format; } -DefineConsoleFunction(ResetGFX, void, (), , "forces the gbuffer to be reinitialized in cases of improper/lack of buffer clears.") +DefineEngineFunction(ResetGFX, void, (), , "forces the gbuffer to be reinitialized in cases of improper/lack of buffer clears.") { GFX->beginReset(); } \ No newline at end of file diff --git a/Engine/source/gfx/gl/gfxGLDeviceProfiler.cpp b/Engine/source/gfx/gl/gfxGLDeviceProfiler.cpp index 254141b71..02155a4f1 100644 --- a/Engine/source/gfx/gl/gfxGLDeviceProfiler.cpp +++ b/Engine/source/gfx/gl/gfxGLDeviceProfiler.cpp @@ -86,7 +86,7 @@ protected: GFXProfiler gfxProfiler; -DefineConsoleFunction(printGFXGLTimers, void,(), ,"") +DefineEngineFunction(printGFXGLTimers, void,(), ,"") { gfxProfiler.printTimes(); } diff --git a/Engine/source/i18n/i18n.cpp b/Engine/source/i18n/i18n.cpp index 359c76fa4..1de738abd 100644 --- a/Engine/source/i18n/i18n.cpp +++ b/Engine/source/i18n/i18n.cpp @@ -58,7 +58,7 @@ const UTF8 *getCoreString(S32 id) //----------------------------------------------------------------------------- -DefineConsoleFunction( getCoreLangTable, S32, (), , "()" +DefineEngineFunction( getCoreLangTable, S32, (), , "()" "@brief Gets the primary LangTable used by the game\n\n" "@return ID of the core LangTable\n" "@ingroup Localization") @@ -69,7 +69,7 @@ DefineConsoleFunction( getCoreLangTable, S32, (), , "()" return 0; } -DefineConsoleFunction( setCoreLangTable, void, (const char * lgTable), , "(string LangTable)" +DefineEngineFunction( setCoreLangTable, void, (const char * lgTable), , "(string LangTable)" "@brief Sets the primary LangTable used by the game\n\n" "@param LangTable ID of the core LangTable\n" "@ingroup Localization") diff --git a/Engine/source/lighting/advanced/advancedLightManager.cpp b/Engine/source/lighting/advanced/advancedLightManager.cpp index 3c851cf81..6d251ec58 100644 --- a/Engine/source/lighting/advanced/advancedLightManager.cpp +++ b/Engine/source/lighting/advanced/advancedLightManager.cpp @@ -705,7 +705,7 @@ LightShadowMap* AdvancedLightManager::findShadowMapForObject( SimObject *object return sceneLight->getLight()->getExtended()->getShadowMap(); } -DefineConsoleFunction( setShadowVizLight, const char*, (const char* name), (""), "") +DefineEngineFunction( setShadowVizLight, const char*, (const char* name), (""), "") { static const String DebugTargetName( "AL_ShadowVizTexture" ); diff --git a/Engine/source/lighting/shadowManager.cpp b/Engine/source/lighting/shadowManager.cpp index 68a234c70..288ff54c9 100644 --- a/Engine/source/lighting/shadowManager.cpp +++ b/Engine/source/lighting/shadowManager.cpp @@ -54,7 +54,7 @@ SceneManager* ShadowManager::getSceneManager() //------------------------------------------------------------------------------ // Runtime switching of shadow systems. Requires correct world to be pushed at console. -DefineConsoleFunction( setShadowManager, bool, (const char* sShadowSystemName), (""), "string sShadowSystemName") +DefineEngineFunction( setShadowManager, bool, (const char* sShadowSystemName), (""), "string sShadowSystemName") { /* // Make sure this new one exists diff --git a/Engine/source/materials/materialManager.cpp b/Engine/source/materials/materialManager.cpp index 4b28988b7..0f8519bb5 100644 --- a/Engine/source/materials/materialManager.cpp +++ b/Engine/source/materials/materialManager.cpp @@ -454,14 +454,14 @@ bool MaterialManager::_handleGFXEvent( GFXDevice::GFXDeviceEventType event_ ) return true; } -DefineConsoleFunction( reInitMaterials, void, (),, +DefineEngineFunction( reInitMaterials, void, (),, "@brief Flushes all procedural shaders and re-initializes all active material instances.\n\n" "@ingroup Materials") { MATMGR->flushAndReInitInstances(); } -DefineConsoleFunction( addMaterialMapping, void, (const char * texName, const char * matName), , "(string texName, string matName)\n" +DefineEngineFunction( addMaterialMapping, void, (const char * texName, const char * matName), , "(string texName, string matName)\n" "@brief Maps the given texture to the given material.\n\n" "Generates a console warning before overwriting.\n\n" "Material maps are used by terrain and interiors for triggering " @@ -472,7 +472,7 @@ DefineConsoleFunction( addMaterialMapping, void, (const char * texName, const ch MATMGR->mapMaterial(texName, matName); } -DefineConsoleFunction( getMaterialMapping, const char*, (const char * texName), , "(string texName)\n" +DefineEngineFunction( getMaterialMapping, const char*, (const char * texName), , "(string texName)\n" "@brief Returns the name of the material mapped to this texture.\n\n" "If no materials are found, an empty string is returned.\n\n" "@param texName Name of the texture\n\n" @@ -481,14 +481,14 @@ DefineConsoleFunction( getMaterialMapping, const char*, (const char * texName), return MATMGR->getMapEntry(texName).c_str(); } -DefineConsoleFunction( dumpMaterialInstances, void, (), , +DefineEngineFunction( dumpMaterialInstances, void, (), , "@brief Dumps a formatted list of currently allocated material instances to the console.\n\n" "@ingroup Materials") { MATMGR->dumpMaterialInstances(); } -DefineConsoleFunction( getMapEntry, const char*, (const char * texName), , +DefineEngineFunction( getMapEntry, const char*, (const char * texName), , "@hide") { return MATMGR->getMapEntry( String(texName) ); diff --git a/Engine/source/math/mConsoleFunctions.cpp b/Engine/source/math/mConsoleFunctions.cpp index c9a1f4622..0b5541f2f 100644 --- a/Engine/source/math/mConsoleFunctions.cpp +++ b/Engine/source/math/mConsoleFunctions.cpp @@ -31,7 +31,7 @@ #include "console/engineAPI.h" -DefineConsoleFunction( mSolveQuadratic, const char*, ( F32 a, F32 b, F32 c ),, +DefineEngineFunction( mSolveQuadratic, const char*, ( F32 a, F32 b, F32 c ),, "Solve a quadratic equation (2nd degree polynomial) of form a*x^2 + b*x + c = 0.\n" "@param a First Coefficient." "@param b Second Coefficient." @@ -49,7 +49,7 @@ DefineConsoleFunction( mSolveQuadratic, const char*, ( F32 a, F32 b, F32 c ),, return retBuffer; } -DefineConsoleFunction( mSolveCubic, const char*, ( F32 a, F32 b, F32 c, F32 d ),, +DefineEngineFunction( mSolveCubic, const char*, ( F32 a, F32 b, F32 c, F32 d ),, "Solve a cubic equation (3rd degree polynomial) of form a*x^3 + b*x^2 + c*x + d = 0.\n" "@param a First Coefficient." "@param b Second Coefficient." @@ -68,7 +68,7 @@ DefineConsoleFunction( mSolveCubic, const char*, ( F32 a, F32 b, F32 c, F32 d ), return retBuffer; } -DefineConsoleFunction( mSolveQuartic, const char*, ( F32 a, F32 b, F32 c, F32 d, F32 e ),, +DefineEngineFunction( mSolveQuartic, const char*, ( F32 a, F32 b, F32 c, F32 d, F32 e ),, "Solve a quartic equation (4th degree polynomial) of form a*x^4 + b*x^3 + c*x^2 + d*x + e = 0.\n" "@param a First Coefficient." "@param b Second Coefficient." @@ -87,7 +87,7 @@ DefineConsoleFunction( mSolveQuartic, const char*, ( F32 a, F32 b, F32 c, F32 d, return retBuffer; } -DefineConsoleFunction( mFloor, S32, ( F32 v ),, +DefineEngineFunction( mFloor, S32, ( F32 v ),, "Round v down to the nearest integer.\n" "@param v Number to convert to integer." "@returns Number converted to integer." @@ -96,7 +96,7 @@ DefineConsoleFunction( mFloor, S32, ( F32 v ),, return (S32)mFloor( v ); } -DefineConsoleFunction( mRound, S32, ( F32 v ),, +DefineEngineFunction( mRound, S32, ( F32 v ),, "Round v to the nth decimal place or the nearest whole number by default." "@param v Value to roundn" "@return The rounded value as a S32." @@ -105,7 +105,7 @@ DefineConsoleFunction( mRound, S32, ( F32 v ),, return mRound(v); } -DefineConsoleFunction( mRoundColour, F32, ( F32 v, S32 n ), (0), +DefineEngineFunction( mRoundColour, F32, ( F32 v, S32 n ), (0), "Round v to the nth decimal place or the nearest whole number by default." "@param v Value to roundn" "@param n Number of decimal places to round to, 0 by defaultn" @@ -118,7 +118,7 @@ DefineConsoleFunction( mRoundColour, F32, ( F32 v, S32 n ), (0), return mRound(v, n); } -DefineConsoleFunction( mCeil, S32, ( F32 v ),, +DefineEngineFunction( mCeil, S32, ( F32 v ),, "Round v up to the nearest integer.\n" "@param v Number to convert to integer." "@returns Number converted to integer." @@ -127,7 +127,7 @@ DefineConsoleFunction( mCeil, S32, ( F32 v ),, return (S32)mCeil( v ); } -DefineConsoleFunction( mFloatLength, const char*, ( F32 v, U32 precision ),, +DefineEngineFunction( mFloatLength, const char*, ( F32 v, U32 precision ),, "Formats the specified number to the given number of decimal places.\n" "@param v Number to format." "@param precision Number of decimal places to format to (1-9)." @@ -148,7 +148,7 @@ DefineConsoleFunction( mFloatLength, const char*, ( F32 v, U32 precision ),, //------------------------------------------------------------------------------ -DefineConsoleFunction( mAbs, F32, ( F32 v ),, +DefineEngineFunction( mAbs, F32, ( F32 v ),, "Calculate absolute value of specified value.\n" "@param v Input Value." "@returns Absolute value of specified value." @@ -157,7 +157,7 @@ DefineConsoleFunction( mAbs, F32, ( F32 v ),, return mFabs( v ); } -DefineConsoleFunction( mFMod, F32, ( F32 v, F32 d ),, +DefineEngineFunction( mFMod, F32, ( F32 v, F32 d ),, "Calculate the remainder of v/d.\n" "@param v Input Value." "@param d Divisor Value." @@ -167,7 +167,7 @@ DefineConsoleFunction( mFMod, F32, ( F32 v, F32 d ),, return mFmod( v, d ); } -DefineConsoleFunction( mSqrt, F32, ( F32 v ),, +DefineEngineFunction( mSqrt, F32, ( F32 v ),, "Calculate the square-root of v.\n" "@param v Input Value." "@returns The square-root of the input value." @@ -176,7 +176,7 @@ DefineConsoleFunction( mSqrt, F32, ( F32 v ),, return mSqrt (v ); } -DefineConsoleFunction( mPow, F32, ( F32 v, F32 p ),, +DefineEngineFunction( mPow, F32, ( F32 v, F32 p ),, "Calculate b raised to the p-th power.\n" "@param v Input Value." "@param p Power to raise value by." @@ -186,7 +186,7 @@ DefineConsoleFunction( mPow, F32, ( F32 v, F32 p ),, return mPow( v, p ); } -DefineConsoleFunction( mLog, F32, ( F32 v ),, +DefineEngineFunction( mLog, F32, ( F32 v ),, "Calculate the natural logarithm of v.\n" "@param v Input Value." "@returns The natural logarithm of the input value." @@ -195,7 +195,7 @@ DefineConsoleFunction( mLog, F32, ( F32 v ),, return mLog( v ); } -DefineConsoleFunction( mSin, F32, ( F32 v ),, +DefineEngineFunction( mSin, F32, ( F32 v ),, "Calculate the sine of v.\n" "@param v Input Value (in radians)." "@returns The sine of the input value." @@ -204,7 +204,7 @@ DefineConsoleFunction( mSin, F32, ( F32 v ),, return mSin( v ); } -DefineConsoleFunction( mCos, F32, ( F32 v ),, +DefineEngineFunction( mCos, F32, ( F32 v ),, "Calculate the cosine of v.\n" "@param v Input Value (in radians)." "@returns The cosine of the input value." @@ -213,7 +213,7 @@ DefineConsoleFunction( mCos, F32, ( F32 v ),, return mCos( v ); } -DefineConsoleFunction( mTan, F32, ( F32 v ),, +DefineEngineFunction( mTan, F32, ( F32 v ),, "Calculate the tangent of v.\n" "@param v Input Value (in radians)." "@returns The tangent of the input value." @@ -222,7 +222,7 @@ DefineConsoleFunction( mTan, F32, ( F32 v ),, return mTan( v ); } -DefineConsoleFunction( mAsin, F32, ( F32 v ),, +DefineEngineFunction( mAsin, F32, ( F32 v ),, "Calculate the arc-sine of v.\n" "@param v Input Value (in radians)." "@returns The arc-sine of the input value." @@ -231,7 +231,7 @@ DefineConsoleFunction( mAsin, F32, ( F32 v ),, return mAsin( v ); } -DefineConsoleFunction( mAcos, F32, ( F32 v ),, +DefineEngineFunction( mAcos, F32, ( F32 v ),, "Calculate the arc-cosine of v.\n" "@param v Input Value (in radians)." "@returns The arc-cosine of the input value." @@ -240,7 +240,7 @@ DefineConsoleFunction( mAcos, F32, ( F32 v ),, return mAcos( v ); } -DefineConsoleFunction( mAtan, F32, ( F32 rise, F32 run ),, +DefineEngineFunction( mAtan, F32, ( F32 rise, F32 run ),, "Calculate the arc-tangent (slope) of a line defined by rise and run.\n" "@param rise of line." "@param run of line." @@ -250,7 +250,7 @@ DefineConsoleFunction( mAtan, F32, ( F32 rise, F32 run ),, return mAtan2( rise, run ); } -DefineConsoleFunction( mRadToDeg, F32, ( F32 radians ),, +DefineEngineFunction( mRadToDeg, F32, ( F32 radians ),, "Convert specified radians into degrees.\n" "@param radians Input Value (in radians)." "@returns The specified radians value converted to degrees." @@ -259,7 +259,7 @@ DefineConsoleFunction( mRadToDeg, F32, ( F32 radians ),, return mRadToDeg( radians ); } -DefineConsoleFunction( mDegToRad, F32, ( F32 degrees ),, +DefineEngineFunction( mDegToRad, F32, ( F32 degrees ),, "Convert specified degrees into radians.\n" "@param degrees Input Value (in degrees)." "@returns The specified degrees value converted to radians." @@ -268,7 +268,7 @@ DefineConsoleFunction( mDegToRad, F32, ( F32 degrees ),, return mDegToRad( degrees ); } -DefineConsoleFunction( mClamp, F32, ( F32 v, F32 min, F32 max ),, +DefineEngineFunction( mClamp, F32, ( F32 v, F32 min, F32 max ),, "Clamp the specified value between two bounds.\n" "@param v Input value." "@param min Minimum Bound." @@ -279,7 +279,7 @@ DefineConsoleFunction( mClamp, F32, ( F32 v, F32 min, F32 max ),, return mClampF( v, min, max ); } -DefineConsoleFunction( mSaturate, F32, ( F32 v ),, +DefineEngineFunction( mSaturate, F32, ( F32 v ),, "Clamp the specified value between 0 and 1 (inclusive).\n" "@param v Input value." "@returns The specified value clamped between 0 and 1 (inclusive)." @@ -288,7 +288,7 @@ DefineConsoleFunction( mSaturate, F32, ( F32 v ),, return mClampF( v, 0.0f, 1.0f ); } -DefineConsoleFunction(mWrapF, F32, (F32 v, F32 min, F32 max), , +DefineEngineFunction(mWrapF, F32, (F32 v, F32 min, F32 max), , "Wrap the specified value between two bounds.\n" "@param v Input value." "@param min Minimum Bound." @@ -299,7 +299,7 @@ DefineConsoleFunction(mWrapF, F32, (F32 v, F32 min, F32 max), , return mWrapF(v, min, max); } -DefineConsoleFunction(mWrap, S32, (S32 v, S32 min, S32 max), , +DefineEngineFunction(mWrap, S32, (S32 v, S32 min, S32 max), , "Wrap the specified value between two bounds.\n" "@param v Input value." "@param min Minimum Bound." @@ -311,7 +311,7 @@ DefineConsoleFunction(mWrap, S32, (S32 v, S32 min, S32 max), , } -DefineConsoleFunction( getMax, F32, ( F32 v1, F32 v2 ),, +DefineEngineFunction( getMax, F32, ( F32 v1, F32 v2 ),, "Calculate the greater of two specified numbers.\n" "@param v1 Input value." "@param v2 Input value." @@ -321,7 +321,7 @@ DefineConsoleFunction( getMax, F32, ( F32 v1, F32 v2 ),, return getMax( v1, v2 ); } -DefineConsoleFunction( getMin, F32, ( F32 v1, F32 v2 ),, +DefineEngineFunction( getMin, F32, ( F32 v1, F32 v2 ),, "Calculate the lesser of two specified numbers.\n" "@param v1 Input value." "@param v2 Input value." @@ -331,7 +331,7 @@ DefineConsoleFunction( getMin, F32, ( F32 v1, F32 v2 ),, return getMin( v1, v2 ); } -DefineConsoleFunction( mLerp, F32, ( F32 v1, F32 v2, F32 time ),, +DefineEngineFunction( mLerp, F32, ( F32 v1, F32 v2, F32 time ),, "Calculate linearly interpolated value between two specified numbers using specified normalized time.\n" "@param v1 Interpolate From Input value." "@param v2 Interpolate To Input value." @@ -342,7 +342,7 @@ DefineConsoleFunction( mLerp, F32, ( F32 v1, F32 v2, F32 time ),, return mLerp( v1, v2, time ); } -DefineConsoleFunction( mPi, F32, (),, +DefineEngineFunction( mPi, F32, (),, "Return the value of PI (half-circle in radians).\n" "@returns The value of PI." "@ingroup Math" ) @@ -350,7 +350,7 @@ DefineConsoleFunction( mPi, F32, (),, return M_PI_F; } -DefineConsoleFunction( m2Pi, F32, (),, +DefineEngineFunction( m2Pi, F32, (),, "Return the value of 2*PI (full-circle in radians).\n" "@returns The value of 2*PI." "@ingroup Math" ) @@ -358,7 +358,7 @@ DefineConsoleFunction( m2Pi, F32, (),, return M_2PI_F; } -DefineConsoleFunction( mIsPow2, bool, ( S32 v ),, +DefineEngineFunction( mIsPow2, bool, ( S32 v ),, "Returns whether the value is an exact power of two.\n" "@param v Input value." "@returns Whether the specified value is an exact power of two." @@ -367,7 +367,7 @@ DefineConsoleFunction( mIsPow2, bool, ( S32 v ),, return isPow2( v ); } -DefineConsoleFunction( mRandomDir, Point3F, (Point3F axis, F32 angleMin, F32 angleMax),, +DefineEngineFunction( mRandomDir, Point3F, (Point3F axis, F32 angleMin, F32 angleMax),, "Returns a randomized direction based on a starting axis and the min/max angles.\n" "@param axis Main axis to deviate the direction from." "@param angleMin minimum amount of deviation from the axis." @@ -378,7 +378,7 @@ DefineConsoleFunction( mRandomDir, Point3F, (Point3F axis, F32 angleMin, F32 ang return MathUtils::randomDir(axis, angleMin, angleMax); } -DefineConsoleFunction( mRandomPointInSphere, Point3F, (F32 radius), , +DefineEngineFunction( mRandomPointInSphere, Point3F, (F32 radius), , "Returns a randomized point inside a sphere of a given radius.\n" "@param radius The radius of the sphere to find a point in." "@returns Randomized point inside a sphere." @@ -387,7 +387,7 @@ DefineConsoleFunction( mRandomPointInSphere, Point3F, (F32 radius), , return MathUtils::randomPointInSphere(radius); } -DefineConsoleFunction( mGetAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB), , +DefineEngineFunction( mGetAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB), , "Returns angle between two vectors.\n" "@param vecA First input vector." "@param vecB Second input vector." @@ -397,7 +397,7 @@ DefineConsoleFunction( mGetAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB return MathUtils::getAngleBetweenVectors(vecA, vecB); } -DefineConsoleFunction(mGetSignedAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB, VectorF norm), (VectorF::Zero, VectorF::Zero, VectorF::Zero), +DefineEngineFunction(mGetSignedAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB, VectorF norm), (VectorF::Zero, VectorF::Zero, VectorF::Zero), "Returns signed angle between two vectors, using a normal for orientation.\n" "@param vecA First input vector." "@param vecB Second input vector." diff --git a/Engine/source/math/mRotation.cpp b/Engine/source/math/mRotation.cpp index 6d9bc3b35..43b696d4a 100644 --- a/Engine/source/math/mRotation.cpp +++ b/Engine/source/math/mRotation.cpp @@ -325,7 +325,7 @@ TEST(Maths, RotationF_Calculations) }; #endif -DefineConsoleFunction(AddRotation, RotationF, (RotationF a, RotationF b), , +DefineEngineFunction(AddRotation, RotationF, (RotationF a, RotationF b), , "Adds two rotations together.\n" "@param a Rotation one." "@param b Rotation two." @@ -335,7 +335,7 @@ DefineConsoleFunction(AddRotation, RotationF, (RotationF a, RotationF b), , return a + b; } -DefineConsoleFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , +DefineEngineFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , "Subtracts two rotations.\n" "@param a Rotation one." "@param b Rotation two." @@ -345,7 +345,7 @@ DefineConsoleFunction(SubtractRotation, RotationF, (RotationF a, RotationF b), , return a - b; } -DefineConsoleFunction(InterpolateRotation, RotationF, (RotationF a, RotationF b, F32 factor), , +DefineEngineFunction(InterpolateRotation, RotationF, (RotationF a, RotationF b, F32 factor), , "Interpolates between two rotations.\n" "@param a Rotation one." "@param b Rotation two." @@ -358,7 +358,7 @@ DefineConsoleFunction(InterpolateRotation, RotationF, (RotationF a, RotationF b, return result; } -DefineConsoleFunction(RotationLookAt, RotationF, (Point3F origin, Point3F target, Point3F up), +DefineEngineFunction(RotationLookAt, RotationF, (Point3F origin, Point3F target, Point3F up), (Point3F(0, 0, 0), Point3F(0, 0, 0), Point3F(0, 0, 1)), "Provides a rotation orientation to look at a target from a given position.\n" "@param origin Position of the object doing the looking." @@ -372,7 +372,7 @@ DefineConsoleFunction(RotationLookAt, RotationF, (Point3F origin, Point3F target return result; } -DefineConsoleFunction(setRotationRightVector, RotationF, (RotationF rot, VectorF rightVec), , +DefineEngineFunction(setRotationRightVector, RotationF, (RotationF rot, VectorF rightVec), , "Sets the right vector of the rotation.\n" "@param Starting rotation." "@param New up vector." @@ -383,7 +383,7 @@ DefineConsoleFunction(setRotationRightVector, RotationF, (RotationF rot, VectorF return rot; } -DefineConsoleFunction(setRotationUpVector, RotationF, (RotationF rot, VectorF upVec), , +DefineEngineFunction(setRotationUpVector, RotationF, (RotationF rot, VectorF upVec), , "Sets the up vector of the rotation.\n" "@param Starting rotation." "@param New up vector." @@ -394,14 +394,14 @@ DefineConsoleFunction(setRotationUpVector, RotationF, (RotationF rot, VectorF up return rot; } -DefineConsoleFunction(getRotationForwardVector, VectorF, (RotationF rot), , +DefineEngineFunction(getRotationForwardVector, VectorF, (RotationF rot), , "Get the forward vector of a rotation.\n" "@ingroup Math") { return rot.asMatrixF().getForwardVector(); } -DefineConsoleFunction(getRotationRightVector, VectorF, (RotationF rot), , +DefineEngineFunction(getRotationRightVector, VectorF, (RotationF rot), , "Gets the right vector of a rotation.\n" "@param Our rotation." "@ingroup Math") @@ -409,7 +409,7 @@ DefineConsoleFunction(getRotationRightVector, VectorF, (RotationF rot), , return rot.asMatrixF().getRightVector(); } -DefineConsoleFunction(getRotationUpVector, VectorF, (RotationF rot), , +DefineEngineFunction(getRotationUpVector, VectorF, (RotationF rot), , "Gets the up vector of a rotation.\n" "@param Our rotation." "@ingroup Math") @@ -417,7 +417,7 @@ DefineConsoleFunction(getRotationUpVector, VectorF, (RotationF rot), , return rot.asMatrixF().getUpVector(); } -DefineConsoleFunction(getRotationDirection, Point3F, (RotationF rot),, +DefineEngineFunction(getRotationDirection, Point3F, (RotationF rot),, "Gets the direction from the rotation's angles.\n" "@param Our rotation." "@ingroup Math") diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index 1d1011d0f..30b550abc 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -631,7 +631,7 @@ ConsoleSetType(TypeRotationF) //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorAdd, VectorF, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorAdd, VectorF, ( VectorF a, VectorF b ),, "Add two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -659,7 +659,7 @@ DefineConsoleFunction( VectorAdd, VectorF, ( VectorF a, VectorF b ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorSub, VectorF, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorSub, VectorF, ( VectorF a, VectorF b ),, "Subtract two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -689,7 +689,7 @@ DefineConsoleFunction( VectorSub, VectorF, ( VectorF a, VectorF b ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorScale, VectorF, ( VectorF a, F32 scalar ),, +DefineEngineFunction( VectorScale, VectorF, ( VectorF a, F32 scalar ),, "Scales a vector by a scalar.\n" "@param a The vector to scale.\n" "@param scalar The scale factor.\n" @@ -716,7 +716,7 @@ DefineConsoleFunction( VectorScale, VectorF, ( VectorF a, F32 scalar ),, { return a * scalar; } -DefineConsoleFunction( VectorMul, VectorF, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorMul, VectorF, ( VectorF a, VectorF b ),, "Multiplies two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -744,7 +744,7 @@ DefineConsoleFunction( VectorMul, VectorF, ( VectorF a, VectorF b ),, return a * b; } -DefineConsoleFunction( VectorDiv, VectorF, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorDiv, VectorF, ( VectorF a, VectorF b ),, "Divide two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -779,7 +779,7 @@ DefineConsoleFunction( VectorDiv, VectorF, ( VectorF a, VectorF b ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorNormalize, VectorF, ( VectorF v ),, +DefineEngineFunction( VectorNormalize, VectorF, ( VectorF v ),, "Brings a vector into its unit form, i.e. such that it has the magnitute 1.\n" "@param v The vector to normalize.\n" "@return The vector @a v scaled to length 1.\n\n" @@ -811,7 +811,7 @@ DefineConsoleFunction( VectorNormalize, VectorF, ( VectorF v ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorDot, F32, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorDot, F32, ( VectorF a, VectorF b ),, "Compute the dot product of two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -841,7 +841,7 @@ DefineConsoleFunction( VectorDot, F32, ( VectorF a, VectorF b ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorCross, VectorF, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorCross, VectorF, ( VectorF a, VectorF b ),, "Calculcate the cross product of two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -873,7 +873,7 @@ DefineConsoleFunction( VectorCross, VectorF, ( VectorF a, VectorF b ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorDist, F32, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorDist, F32, ( VectorF a, VectorF b ),, "Compute the distance between two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -906,7 +906,7 @@ DefineConsoleFunction( VectorDist, F32, ( VectorF a, VectorF b ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorMidPoint, VectorF, ( VectorF a, VectorF b ),, +DefineEngineFunction( VectorMidPoint, VectorF, ( VectorF a, VectorF b ),, "Gets the midpoint between the two vectors.\n" "@param a The first vector.\n" "@param b The second vector.\n" @@ -934,7 +934,7 @@ DefineConsoleFunction( VectorMidPoint, VectorF, ( VectorF a, VectorF b ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorLen, F32, ( VectorF v ),, +DefineEngineFunction( VectorLen, F32, ( VectorF v ),, "Calculate the magnitude of the given vector.\n" "@param v A vector.\n" "@return The length of vector @a v.\n\n" @@ -963,7 +963,7 @@ DefineConsoleFunction( VectorLen, F32, ( VectorF v ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( VectorOrthoBasis, MatrixF, ( AngAxisF aa ),, +DefineEngineFunction( VectorOrthoBasis, MatrixF, ( AngAxisF aa ),, "Create an orthogonal basis from the given vector.\n" "@param aaf The vector to create the orthogonal basis from.\n" "@return A matrix representing the orthogonal basis.\n" @@ -977,7 +977,7 @@ DefineConsoleFunction( VectorOrthoBasis, MatrixF, ( AngAxisF aa ),, //----------------------------------------------------------------------------- //ConsoleFunction(VectorRot, const char*, 3, 3, "(Vector3F, float) rotate a vector in 2d") -DefineConsoleFunction( VectorRot, const char*, (Point3F v, F32 angle), , "(Vector3F, float) rotate a vector in 2d") +DefineEngineFunction( VectorRot, const char*, (Point3F v, F32 angle), , "(Vector3F, float) rotate a vector in 2d") { //VectorF v(0,0,0); //dSscanf(argv[1],"%g %g %g",&v.x,&v.y,&v.z); @@ -996,7 +996,7 @@ DefineConsoleFunction( VectorRot, const char*, (Point3F v, F32 angle), , "(Vecto return returnBuffer; } -DefineConsoleFunction( VectorLerp, VectorF, ( VectorF a, VectorF b, F32 t ),, +DefineEngineFunction( VectorLerp, VectorF, ( VectorF a, VectorF b, F32 t ),, "Linearly interpolate between two vectors by @a t.\n" "@param a Vector to start interpolation from.\n" "@param b Vector to interpolate to.\n" @@ -1032,7 +1032,7 @@ DefineConsoleFunction( VectorLerp, VectorF, ( VectorF a, VectorF b, F32 t ),, return c; } -DefineConsoleFunction(VectorReflect, VectorF, (VectorF vec, VectorF normal), , +DefineEngineFunction(VectorReflect, VectorF, (VectorF vec, VectorF normal), , "Compute the reflection of a vector based on a normal.\n" "@param a The vector.\n" "@param b The normal.\n" @@ -1046,7 +1046,7 @@ DefineConsoleFunction(VectorReflect, VectorF, (VectorF vec, VectorF normal), , //----------------------------------------------------------------------------- -DefineConsoleFunction( MatrixCreate, TransformF, ( VectorF position, AngAxisF orientation ),, +DefineEngineFunction( MatrixCreate, TransformF, ( VectorF position, AngAxisF orientation ),, "Create a transform from the given translation and orientation.\n" "@param position The translation vector for the transform.\n" "@param orientation The axis and rotation that orients the transform.\n" @@ -1059,7 +1059,7 @@ DefineConsoleFunction( MatrixCreate, TransformF, ( VectorF position, AngAxisF or //----------------------------------------------------------------------------- -DefineConsoleFunction( MatrixCreateFromEuler, TransformF, ( Point3F angles ),, +DefineEngineFunction( MatrixCreateFromEuler, TransformF, ( Point3F angles ),, "@Create a matrix from the given rotations.\n\n" "@param Vector3F X, Y, and Z rotation in *radians*.\n" "@return A transform based on the given orientation.\n" @@ -1074,7 +1074,7 @@ DefineConsoleFunction( MatrixCreateFromEuler, TransformF, ( Point3F angles ),, //----------------------------------------------------------------------------- -DefineConsoleFunction( MatrixMultiply, TransformF, ( TransformF left, TransformF right ),, +DefineEngineFunction( MatrixMultiply, TransformF, ( TransformF left, TransformF right ),, "@brief Multiply the two matrices.\n\n" "@param left First transform.\n" "@param right Right transform.\n" @@ -1091,7 +1091,7 @@ DefineConsoleFunction( MatrixMultiply, TransformF, ( TransformF left, TransformF //----------------------------------------------------------------------------- -DefineConsoleFunction( MatrixMulVector, VectorF, ( TransformF transform, VectorF vector ),, +DefineEngineFunction( MatrixMulVector, VectorF, ( TransformF transform, VectorF vector ),, "@brief Multiply the vector by the transform assuming that w=0.\n\n" "This function will multiply the given vector by the given transform such that translation will " "not affect the vector.\n\n" @@ -1107,7 +1107,7 @@ DefineConsoleFunction( MatrixMulVector, VectorF, ( TransformF transform, VectorF //----------------------------------------------------------------------------- -DefineConsoleFunction( MatrixMulPoint, Point3F, ( TransformF transform, Point3F point ),, +DefineEngineFunction( MatrixMulPoint, Point3F, ( TransformF transform, Point3F point ),, "@brief Multiply the given point by the given transform assuming that w=1.\n\n" "This function will multiply the given vector such that translation with take effect.\n" "@param transform A transform.\n" @@ -1124,7 +1124,7 @@ ConsoleFunctionGroupEnd(MatrixMath); //------------------------------------------------------------------------------ -DefineConsoleFunction( getBoxCenter, Point3F, ( Box3F box ),, +DefineEngineFunction( getBoxCenter, Point3F, ( Box3F box ),, "Get the center point of an axis-aligned box.\n\n" "@param b A Box3F, in string format using \"minExtentX minExtentY minExtentZ maxExtentX maxExtentY maxExtentZ\"\n" "@return Center of the box.\n" @@ -1176,7 +1176,7 @@ F32 mRandF() return gRandGen.randF(); } -DefineConsoleFunction(getRandom, F32, (S32 a, S32 b), (S32_MAX, S32_MAX), +DefineEngineFunction(getRandom, F32, (S32 a, S32 b), (S32_MAX, S32_MAX), "( int a, int b ) " "@brief Returns a random number based on parameters passed in..\n\n" "If no parameters are passed in, getRandom() will return a float between 0.0 and 1.0. If one " diff --git a/Engine/source/navigation/navMesh.cpp b/Engine/source/navigation/navMesh.cpp index c9bbb1fa4..f4adf9992 100644 --- a/Engine/source/navigation/navMesh.cpp +++ b/Engine/source/navigation/navMesh.cpp @@ -95,13 +95,13 @@ EventManager *NavMesh::getEventManager() return smEventManager; } -DefineConsoleFunction(getNavMeshEventManager, S32, (),, +DefineEngineFunction(getNavMeshEventManager, S32, (),, "@brief Get the EventManager object for all NavMesh updates.") { return NavMesh::getEventManager()->getId(); } -DefineConsoleFunction(NavMeshUpdateAll, void, (S32 objid, bool remove), (0, false), +DefineEngineFunction(NavMeshUpdateAll, void, (S32 objid, bool remove), (0, false), "@brief Update all NavMesh tiles that intersect the given object's world box.") { SceneObject *obj; @@ -123,7 +123,7 @@ DefineConsoleFunction(NavMeshUpdateAll, void, (S32 objid, bool remove), (0, fals obj->enableCollision(); } -DefineConsoleFunction(NavMeshUpdateAroundObject, void, (S32 objid, bool remove), (0, false), +DefineEngineFunction(NavMeshUpdateAroundObject, void, (S32 objid, bool remove), (0, false), "@brief Update all NavMesh tiles that intersect the given object's world box.") { SceneObject *obj; @@ -146,7 +146,7 @@ DefineConsoleFunction(NavMeshUpdateAroundObject, void, (S32 objid, bool remove), } -DefineConsoleFunction(NavMeshIgnore, void, (S32 objid, bool _ignore), (0, true), +DefineEngineFunction(NavMeshIgnore, void, (S32 objid, bool _ignore), (0, true), "@brief Flag this object as not generating a navmesh result.") { SceneObject *obj; @@ -156,7 +156,7 @@ DefineConsoleFunction(NavMeshIgnore, void, (S32 objid, bool _ignore), (0, true), obj->mPathfindingIgnore = _ignore; } -DefineConsoleFunction(NavMeshUpdateOne, void, (S32 meshid, S32 objid, bool remove), (0, 0, false), +DefineEngineFunction(NavMeshUpdateOne, void, (S32 meshid, S32 objid, bool remove), (0, 0, false), "@brief Update all tiles in a given NavMesh that intersect the given object's world box.") { NavMesh *mesh; diff --git a/Engine/source/platform/platformFileIO.cpp b/Engine/source/platform/platformFileIO.cpp index a9ace740b..788ed4f62 100644 --- a/Engine/source/platform/platformFileIO.cpp +++ b/Engine/source/platform/platformFileIO.cpp @@ -38,7 +38,7 @@ StringTableEntry Platform::getTemporaryDirectory() return path; } -DefineConsoleFunction( getTemporaryDirectory, const char *, (), , +DefineEngineFunction( getTemporaryDirectory, const char *, (), , "@brief Returns the OS temporary directory, \"C:/Users/Mich/AppData/Local/Temp\" for example\n\n" "@note This can be useful to adhering to OS standards and practices, " "but not really used in Torque 3D right now.\n" @@ -66,7 +66,7 @@ StringTableEntry Platform::getTemporaryFileName() return StringTable->insert(buf); } -DefineConsoleFunction( getTemporaryFileName, const char *, (), , +DefineEngineFunction( getTemporaryFileName, const char *, (), , "@brief Creates a name and extension for a potential temporary file\n\n" "This does not create the actual file. It simply creates a random name " "for a file that does not exist.\n\n" @@ -611,12 +611,12 @@ StringTableEntry Platform::getPrefsPath(const char *file /* = NULL */) //----------------------------------------------------------------------------- -DefineConsoleFunction( getUserDataDirectory, const char *, (), , "getUserDataDirectory()") +DefineEngineFunction( getUserDataDirectory, const char *, (), , "getUserDataDirectory()") { return Platform::getUserDataDirectory(); } -DefineConsoleFunction( getUserHomeDirectory, const char *, (), , "getUserHomeDirectory()") +DefineEngineFunction( getUserHomeDirectory, const char *, (), , "getUserHomeDirectory()") { return Platform::getUserHomeDirectory(); } diff --git a/Engine/source/platform/platformMemory.cpp b/Engine/source/platform/platformMemory.cpp index 5f7aa926d..f10113308 100644 --- a/Engine/source/platform/platformMemory.cpp +++ b/Engine/source/platform/platformMemory.cpp @@ -885,7 +885,7 @@ void logDumpTraverse(MemDumpLog *sizes, TreeNode *header, U32 depth) } #ifdef TORQUE_DEBUG -DefineConsoleFunction( validateMemory, void, ( ),, +DefineEngineFunction( validateMemory, void, ( ),, "@brief Used to validate memory space for the game.\n\n" "@ingroup Debugging" ) { @@ -893,7 +893,7 @@ DefineConsoleFunction( validateMemory, void, ( ),, } #endif -DefineConsoleFunction( freeMemoryDump, void, ( ),, +DefineEngineFunction( freeMemoryDump, void, ( ),, "@brief Dumps some useful statistics regarding free memory.\n\n" "Dumps an analysis of \'free chunks\' of memory. " "Does not print how much memory is free.\n\n" diff --git a/Engine/source/platform/platformRedBook.cpp b/Engine/source/platform/platformRedBook.cpp index 82b1bae2d..acbc0bc7a 100644 --- a/Engine/source/platform/platformRedBook.cpp +++ b/Engine/source/platform/platformRedBook.cpp @@ -211,7 +211,7 @@ bool RedBook::setVolume(F32 volume) ConsoleFunctionGroupBegin( Redbook, "Control functions for Redbook audio (ie, CD audio)."); -DefineConsoleFunction( redbookOpen, bool, (const char * device), (""), "(string device=NULL)" +DefineEngineFunction( redbookOpen, bool, (const char * device), (""), "(string device=NULL)" "@brief Deprecated\n\n" "@internal") { @@ -221,28 +221,28 @@ DefineConsoleFunction( redbookOpen, bool, (const char * device), (""), "(string return(RedBook::open(device)); } -DefineConsoleFunction( redbookClose, bool, (), , "Close the current Redbook device." +DefineEngineFunction( redbookClose, bool, (), , "Close the current Redbook device." "@brief Deprecated\n\n" "@internal") { return(RedBook::close()); } -DefineConsoleFunction( redbookPlay, bool, (S32 track), , "(int track) Play the selected track." +DefineEngineFunction( redbookPlay, bool, (S32 track), , "(int track) Play the selected track." "@brief Deprecated\n\n" "@internal") { return(RedBook::play(track)); } -DefineConsoleFunction( redbookStop, bool, (), , "Stop playing." +DefineEngineFunction( redbookStop, bool, (), , "Stop playing." "@brief Deprecated\n\n" "@internal") { return(RedBook::stop()); } -DefineConsoleFunction( redbookGetTrackCount, S32, (), , "Return the number of tracks." +DefineEngineFunction( redbookGetTrackCount, S32, (), , "Return the number of tracks." "@brief Deprecated\n\n" "@internal") { @@ -252,7 +252,7 @@ DefineConsoleFunction( redbookGetTrackCount, S32, (), , "Return the number of tr return(trackCount); } -DefineConsoleFunction( redbookGetVolume, F32, (), , "Get the volume." +DefineEngineFunction( redbookGetVolume, F32, (), , "Get the volume." "@brief Deprecated\n\n" "@internal") { @@ -263,28 +263,28 @@ DefineConsoleFunction( redbookGetVolume, F32, (), , "Get the volume." return(vol); } -DefineConsoleFunction( redbookSetVolume, bool, (F32 volume), , "(float volume) Set playback volume." +DefineEngineFunction( redbookSetVolume, bool, (F32 volume), , "(float volume) Set playback volume." "@brief Deprecated\n\n" "@internal") { return(RedBook::setVolume(volume)); } -DefineConsoleFunction( redbookGetDeviceCount, S32, (), , "get the number of redbook devices." +DefineEngineFunction( redbookGetDeviceCount, S32, (), , "get the number of redbook devices." "@brief Deprecated\n\n" "@internal") { return(RedBook::getDeviceCount()); } -DefineConsoleFunction( redbookGetDeviceName, const char *, (S32 index), , "(int index) Get name of specified Redbook device." +DefineEngineFunction( redbookGetDeviceName, const char *, (S32 index), , "(int index) Get name of specified Redbook device." "@brief Deprecated\n\n" "@internal") { return(RedBook::getDeviceName(index)); } -DefineConsoleFunction( redbookGetLastError, const char *, (), , "Get a string explaining the last redbook error." +DefineEngineFunction( redbookGetLastError, const char *, (), , "Get a string explaining the last redbook error." "@brief Deprecated\n\n" "@internal") { diff --git a/Engine/source/platform/platformTimer.cpp b/Engine/source/platform/platformTimer.cpp index 1da010c5a..e3be91fe9 100644 --- a/Engine/source/platform/platformTimer.cpp +++ b/Engine/source/platform/platformTimer.cpp @@ -160,12 +160,12 @@ S32 ScriptTimerMan::stopTimer( S32 id ) ScriptTimerMan gScriptTimerMan; -DefineConsoleFunction( startPrecisionTimer, S32, (), , "startPrecisionTimer() - Create and start a high resolution platform timer. Returns the timer id." ) +DefineEngineFunction( startPrecisionTimer, S32, (), , "startPrecisionTimer() - Create and start a high resolution platform timer. Returns the timer id." ) { return gScriptTimerMan.startTimer(); } -DefineConsoleFunction( stopPrecisionTimer, S32, ( S32 id), , "stopPrecisionTimer( S32 id ) - Stop and destroy timer with the passed id. Returns the elapsed milliseconds." ) +DefineEngineFunction( stopPrecisionTimer, S32, ( S32 id), , "stopPrecisionTimer( S32 id ) - Stop and destroy timer with the passed id. Returns the elapsed milliseconds." ) { return gScriptTimerMan.stopTimer( id ); } \ No newline at end of file diff --git a/Engine/source/platformWin32/cardProfile.cpp b/Engine/source/platformWin32/cardProfile.cpp index a4658f98c..dbfad0fe6 100644 --- a/Engine/source/platformWin32/cardProfile.cpp +++ b/Engine/source/platformWin32/cardProfile.cpp @@ -74,7 +74,7 @@ void initDisplayDeviceInfo() Con::setVariable( "$PCI_DEV", dev ); } -DefineConsoleFunction( initDisplayDeviceInfo, void, (), , "()" +DefineEngineFunction( initDisplayDeviceInfo, void, (), , "()" "@brief Initializes variables that track device and vendor information/IDs\n\n" "@ingroup Rendering") { diff --git a/Engine/source/platformWin32/winConsole.cpp b/Engine/source/platformWin32/winConsole.cpp index cc92c2c15..66c9bb3c0 100644 --- a/Engine/source/platformWin32/winConsole.cpp +++ b/Engine/source/platformWin32/winConsole.cpp @@ -38,7 +38,7 @@ namespace Con extern bool alwaysUseDebugOutput; } -DefineConsoleFunction( enableWinConsole, void, (bool flag), , "enableWinConsole(bool);") +DefineEngineFunction( enableWinConsole, void, (bool flag), , "enableWinConsole(bool);") { WindowsConsole->enable(flag); } diff --git a/Engine/source/platformWin32/winDirectInput.cpp b/Engine/source/platformWin32/winDirectInput.cpp index 2fd8084ef..fd016496f 100644 --- a/Engine/source/platformWin32/winDirectInput.cpp +++ b/Engine/source/platformWin32/winDirectInput.cpp @@ -769,7 +769,7 @@ void DInputManager::processXInput( void ) mXInputStateReset = false; } } -DefineConsoleFunction( enableJoystick, bool, (), , "()" +DefineEngineFunction( enableJoystick, bool, (), , "()" "@brief Enables use of the joystick.\n\n" "@note DirectInput must be enabled and active to use this function.\n\n" "@ingroup Input") @@ -778,7 +778,7 @@ DefineConsoleFunction( enableJoystick, bool, (), , "()" } //------------------------------------------------------------------------------ -DefineConsoleFunction( disableJoystick, void, (), , "()" +DefineEngineFunction( disableJoystick, void, (), , "()" "@brief Disables use of the joystick.\n\n" "@note DirectInput must be enabled and active to use this function.\n\n" "@ingroup Input") @@ -787,7 +787,7 @@ DefineConsoleFunction( disableJoystick, void, (), , "()" } //------------------------------------------------------------------------------ -DefineConsoleFunction( isJoystickEnabled, bool, (), , "()" +DefineEngineFunction( isJoystickEnabled, bool, (), , "()" "@brief Queries input manager to see if a joystick is enabled\n\n" "@return 1 if a joystick exists and is enabled, 0 if it's not.\n" "@ingroup Input") @@ -796,7 +796,7 @@ DefineConsoleFunction( isJoystickEnabled, bool, (), , "()" } //------------------------------------------------------------------------------ -DefineConsoleFunction( enableXInput, bool, (), , "()" +DefineEngineFunction( enableXInput, bool, (), , "()" "@brief Enables XInput for Xbox 360 controllers.\n\n" "@note XInput is enabled by default. Disable to use an Xbox 360 " "Controller as a joystick device.\n\n" @@ -811,7 +811,7 @@ DefineConsoleFunction( enableXInput, bool, (), , "()" } //------------------------------------------------------------------------------ -DefineConsoleFunction( disableXInput, void, (), , "()" +DefineEngineFunction( disableXInput, void, (), , "()" "@brief Disables XInput for Xbox 360 controllers.\n\n" "@ingroup Input") { @@ -819,7 +819,7 @@ DefineConsoleFunction( disableXInput, void, (), , "()" } //------------------------------------------------------------------------------ -DefineConsoleFunction( resetXInput, void, (), , "()" +DefineEngineFunction( resetXInput, void, (), , "()" "@brief Rebuilds the XInput section of the InputManager\n\n" "Requests a full refresh of events for all controllers. Useful when called at the beginning " "of game code after actionMaps are set up to hook up all appropriate events.\n\n" @@ -836,7 +836,7 @@ DefineConsoleFunction( resetXInput, void, (), , "()" } //------------------------------------------------------------------------------ -DefineConsoleFunction( isXInputConnected, bool, (S32 controllerID), , "( int controllerID )" +DefineEngineFunction( isXInputConnected, bool, (S32 controllerID), , "( int controllerID )" "@brief Checks to see if an Xbox 360 controller is connected\n\n" "@param controllerID Zero-based index of the controller to check.\n" "@return 1 if the controller is connected, 0 if it isn't, and 205 if XInput " @@ -849,7 +849,7 @@ DefineConsoleFunction( isXInputConnected, bool, (S32 controllerID), , "( int con } //------------------------------------------------------------------------------ -DefineConsoleFunction( getXInputState, int, (S32 controllerID, const char * properties, bool current), (false), "( int controllerID, string property, bool currentD )" +DefineEngineFunction( getXInputState, int, (S32 controllerID, const char * properties, bool current), (false), "( int controllerID, string property, bool currentD )" "@brief Queries the current state of a connected Xbox 360 controller.\n\n" "XInput Properties:\n\n" " - XI_THUMBLX, XI_THUMBLY - X and Y axes of the left thumbstick. \n" @@ -905,7 +905,7 @@ DefineConsoleFunction( getXInputState, int, (S32 controllerID, const char * prop } //------------------------------------------------------------------------------ -DefineConsoleFunction( echoInputState, void, (), , "()" +DefineEngineFunction( echoInputState, void, (), , "()" "@brief Prints information to the console stating if DirectInput and a Joystick are enabled and active.\n\n" "@ingroup Input") { @@ -921,7 +921,7 @@ DefineConsoleFunction( echoInputState, void, (), , "()" Con::printf( "DirectInput is not enabled." ); } -DefineConsoleFunction( rumble, void, (const char * device, F32 xRumble, F32 yRumble), , "(string device, float xRumble, float yRumble)" +DefineEngineFunction( rumble, void, (const char * device, F32 xRumble, F32 yRumble), , "(string device, float xRumble, float yRumble)" "@brief Activates the vibration motors in the specified controller.\n\n" "The controller will constantly at it's xRumble and yRumble intensities until " "changed or told to stop." diff --git a/Engine/source/platformWin32/winExec.cpp b/Engine/source/platformWin32/winExec.cpp index 6ec218929..3b9ad52b9 100644 --- a/Engine/source/platformWin32/winExec.cpp +++ b/Engine/source/platformWin32/winExec.cpp @@ -136,7 +136,7 @@ void ExecuteThread::run(void *arg /* = 0 */) // Console Functions //----------------------------------------------------------------------------- -DefineConsoleFunction( shellExecute, bool, (const char * executable, const char * args, const char * directory), ("", ""), "(string executable, string args, string directory)" +DefineEngineFunction( shellExecute, bool, (const char * executable, const char * args, const char * directory), ("", ""), "(string executable, string args, string directory)" "@brief Launches an outside executable or batch file\n\n" "@param executable Name of the executable or batch file\n" "@param args Optional list of arguments, in string format, to pass to the executable\n" diff --git a/Engine/source/platformWin32/winInput.cpp b/Engine/source/platformWin32/winInput.cpp index 2424eabdb..77eb38511 100644 --- a/Engine/source/platformWin32/winInput.cpp +++ b/Engine/source/platformWin32/winInput.cpp @@ -157,13 +157,13 @@ void Input::init() } //------------------------------------------------------------------------------ -DefineConsoleFunction( isJoystickDetected, bool, (), , "isJoystickDetected()") +DefineEngineFunction( isJoystickDetected, bool, (), , "isJoystickDetected()") { return( DInputDevice::joystickDetected() ); } //------------------------------------------------------------------------------ -DefineConsoleFunction( getJoystickAxes, const char*, (U32 deviceID), , "getJoystickAxes( instance )") +DefineEngineFunction( getJoystickAxes, const char*, (U32 deviceID), , "getJoystickAxes( instance )") { DInputManager* mgr = dynamic_cast( Input::getManager() ); if ( mgr ) @@ -505,7 +505,7 @@ void Input::log( const char* format, ... ) va_end( argptr ); } -DefineConsoleFunction( inputLog, void, (const char * log), , "inputLog( string )") +DefineEngineFunction( inputLog, void, (const char * log), , "inputLog( string )") { Input::log( "%s\n", log ); } diff --git a/Engine/source/platformWin32/winWindow.cpp b/Engine/source/platformWin32/winWindow.cpp index 63fb5ea54..0ce0f7cba 100644 --- a/Engine/source/platformWin32/winWindow.cpp +++ b/Engine/source/platformWin32/winWindow.cpp @@ -643,7 +643,7 @@ bool Platform::setLoginPassword( const char* password ) // as commentary on Koreans as a nationality. Thank you for your // attention. //-------------------------------------- -DefineConsoleFunction( isKoreanBuild, bool, ( ), , "isKoreanBuild()") +DefineEngineFunction( isKoreanBuild, bool, ( ), , "isKoreanBuild()") { HKEY regKey; bool result = false; diff --git a/Engine/source/scene/pathManager.cpp b/Engine/source/scene/pathManager.cpp index 2f1c423c3..7d9c88140 100644 --- a/Engine/source/scene/pathManager.cpp +++ b/Engine/source/scene/pathManager.cpp @@ -207,12 +207,12 @@ void PathManager::clearPaths() #endif } -DefineConsoleFunction( clearServerPaths, void, ( ), , "") +DefineEngineFunction( clearServerPaths, void, ( ), , "") { gServerPathManager->clearPaths(); } -DefineConsoleFunction( clearClientPaths, void, ( ), , "") +DefineEngineFunction( clearClientPaths, void, ( ), , "") { gClientPathManager->clearPaths(); } diff --git a/Engine/source/scene/sceneManager.cpp b/Engine/source/scene/sceneManager.cpp index aeca87092..706bc0da5 100644 --- a/Engine/source/scene/sceneManager.cpp +++ b/Engine/source/scene/sceneManager.cpp @@ -720,7 +720,7 @@ RenderPassManager* SceneManager::getDefaultRenderPass() const //----------------------------------------------------------------------------- -DefineConsoleFunction( sceneDumpZoneStates, void, ( bool updateFirst ), ( true ), +DefineEngineFunction( sceneDumpZoneStates, void, ( bool updateFirst ), ( true ), "Dump the current zoning states of all zone spaces in the scene to the console.\n\n" "@param updateFirst If true, zoning states are brought up to date first; if false, the zoning states " "are dumped as is.\n\n" @@ -745,7 +745,7 @@ DefineConsoleFunction( sceneDumpZoneStates, void, ( bool updateFirst ), ( true ) //----------------------------------------------------------------------------- -DefineConsoleFunction( sceneGetZoneOwner, SceneObject*, ( U32 zoneId ),, +DefineEngineFunction( sceneGetZoneOwner, SceneObject*, ( U32 zoneId ),, "Return the SceneObject that contains the given zone.\n\n" "@param zoneId ID of zone.\n" "@return A SceneObject or NULL if the given @a zoneId is invalid.\n\n" diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index b02d4fc67..0377aff90 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -1442,7 +1442,7 @@ static ConsoleDocFragment _sfxCreateSource4( NULL, "SFXSound sfxCreateSource( SFXDescription description, string filename, float x, float y, float z );" ); -DefineConsoleFunction( sfxCreateSource, S32, ( const char * sfxType, const char * arg0, const char * arg1, const char * arg2, const char * arg3 ), ("", "", "", ""), +DefineEngineFunction( sfxCreateSource, S32, ( const char * sfxType, const char * arg0, const char * arg1, const char * arg2, const char * arg3 ), ("", "", "", ""), "( SFXTrack track | ( SFXDescription description, string filename ) [, float x, float y, float z ] ) " "Creates a new paused sound source using a profile or a description " "and filename. The return value is the source which must be " @@ -1547,7 +1547,7 @@ static ConsoleDocFragment _sfxPlay3( NULL, "void sfxPlay( SFXTrack track, float x, float y, float z );" ); -DefineConsoleFunction( sfxPlay, S32, ( const char * trackName, const char * pointOrX, const char * y, const char * z ), ( "", "", ""), +DefineEngineFunction( sfxPlay, S32, ( const char * trackName, const char * pointOrX, const char * y, const char * z ), ( "", "", ""), "Start playing the given source or create a new source for the given track and play it.\n" "@hide" ) { @@ -1657,7 +1657,7 @@ static ConsoleDocFragment _sPlayOnce4( "SFXSource sfxPlayOnce( SFXDescription description, string filename, float x, float y, float z, float fadeInTime=-1 );" ); -DefineConsoleFunction( sfxPlayOnce, S32, ( const char * sfxType, const char * arg0, const char * arg1, const char * arg2, const char * arg3, const char* arg4 ), ("", "", "", "", "-1.0f"), +DefineEngineFunction( sfxPlayOnce, S32, ( const char * sfxType, const char * arg0, const char * arg1, const char * arg2, const char * arg3, const char* arg4 ), ("", "", "", "", "-1.0f"), "SFXSource sfxPlayOnce( ( SFXTrack track | SFXDescription description, string filename ) [, float x, float y, float z, float fadeInTime=-1 ] ) " "Create a new play-once source for the given profile or description+filename and start playback of the source.\n" "@hide" ) diff --git a/Engine/source/sim/netInterface.cpp b/Engine/source/sim/netInterface.cpp index 6d312df8a..fd2c51bc4 100644 --- a/Engine/source/sim/netInterface.cpp +++ b/Engine/source/sim/netInterface.cpp @@ -638,7 +638,7 @@ void NetInterface::computeNetMD5(const NetAddress *address, U32 connectSequence, ConsoleFunctionGroupBegin(NetInterface, "Global control functions for the netInterfaces."); -DefineConsoleFunction( allowConnections, void, ( bool allow ), , "allowConnections(bool allow)" +DefineEngineFunction( allowConnections, void, ( bool allow ), , "allowConnections(bool allow)" "@brief Sets whether or not the global NetInterface allows connections from remote hosts.\n\n" "@param allow Set to true to allow remote connections.\n" diff --git a/Engine/source/terrain/terrData.cpp b/Engine/source/terrain/terrData.cpp index 37f523356..78e991b63 100644 --- a/Engine/source/terrain/terrData.cpp +++ b/Engine/source/terrain/terrData.cpp @@ -147,7 +147,7 @@ ConsoleDocFragment _getTerrainUnderWorldPoint2( "bool getTerrainUnderWorldPoint( F32 x, F32 y, F32 z);" ); -DefineConsoleFunction( getTerrainUnderWorldPoint, S32, (const char* ptOrX, const char* y, const char* z), ("", ""), +DefineEngineFunction( getTerrainUnderWorldPoint, S32, (const char* ptOrX, const char* y, const char* z), ("", ""), "(Point3F x/y/z) Gets the terrain block that is located under the given world point.\n" "@param x/y/z The world coordinates (floating point values) you wish to query at. " "These can be formatted as either a string (\"x y z\") or separately as (x, y, z)\n" @@ -1338,7 +1338,7 @@ ConsoleDocFragment _getTerrainHeight2( "bool getTerrainHeight( F32 x, F32 y);" ); -DefineConsoleFunction( getTerrainHeight, F32, (const char* ptOrX, const char* y), (""), "(Point2 pos) - gets the terrain height at the specified position." +DefineEngineFunction( getTerrainHeight, F32, (const char* ptOrX, const char* y), (""), "(Point2 pos) - gets the terrain height at the specified position." "@param pos The world space point, minus the z (height) value\n Can be formatted as either (\"x y\") or (x,y)\n" "@return Returns the terrain height at the given point as an F32 value.\n" "@hide") @@ -1383,7 +1383,7 @@ ConsoleDocFragment _getTerrainHeightBelowPosition2( "bool getTerrainHeightBelowPosition( F32 x, F32 y);" ); -DefineConsoleFunction( getTerrainHeightBelowPosition, F32, (const char* ptOrX, const char* y, const char* z), ("", ""), +DefineEngineFunction( getTerrainHeightBelowPosition, F32, (const char* ptOrX, const char* y, const char* z), ("", ""), "(Point3F pos) - gets the terrain height at the specified position." "@param pos The world space point. Can be formatted as either (\"x y z\") or (x,y,z)\n" "@note This function is useful if you simply want to grab the terrain height underneath an object.\n" diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index 1cc2909b0..465e157ec 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -126,7 +126,7 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen } } -DefineConsoleFunction( enumColladaForImport, bool, (const char * shapePath, const char * ctrl), , +DefineEngineFunction( enumColladaForImport, bool, (const char * shapePath, const char * ctrl), , "(string shapePath, GuiTreeViewCtrl ctrl) Collect scene information from " "a COLLADA file and store it in a GuiTreeView control. This function is " "used by the COLLADA import gui to show a preview of the scene contents " diff --git a/Engine/source/ts/collada/colladaLights.cpp b/Engine/source/ts/collada/colladaLights.cpp index bb699e4ff..fcc4bb67d 100644 --- a/Engine/source/ts/collada/colladaLights.cpp +++ b/Engine/source/ts/collada/colladaLights.cpp @@ -139,7 +139,7 @@ static void processNodeLights(AppNode* appNode, const MatrixF& offset, SimGroup* } // Load lights from a collada file and add to the scene. -DefineConsoleFunction( loadColladaLights, bool, (const char * filename, const char * parentGroup, const char * baseObject), ("", ""), +DefineEngineFunction( loadColladaLights, bool, (const char * filename, const char * parentGroup, const char * baseObject), ("", ""), "(string filename, SimGroup parentGroup=MissionGroup, SimObject baseObject=-1)" "Load all light instances from a COLLADA (.dae) file and add to the scene.\n" "@param filename COLLADA filename to load lights from\n" diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 61c183d27..2ae067627 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1325,14 +1325,14 @@ String TSShapeLoader::getFormatFilters() return output.end(); } -DefineConsoleFunction( getFormatExtensions, const char*, ( ),, +DefineEngineFunction( getFormatExtensions, const char*, ( ),, "Returns a list of supported shape format extensions separated by tabs." "Example output: *.dsq TAB *.dae TAB") { return Con::getReturnBuffer(TSShapeLoader::getFormatExtensions()); } -DefineConsoleFunction( getFormatFilters, const char*, ( ),, +DefineEngineFunction( getFormatFilters, const char*, ( ),, "Returns a list of supported shape formats in filter form.\n" "Example output: DSQ Files|*.dsq|COLLADA Files|*.dae|") { diff --git a/Engine/source/ts/tsLastDetail.cpp b/Engine/source/ts/tsLastDetail.cpp index 9619903b0..21dc8b415 100644 --- a/Engine/source/ts/tsLastDetail.cpp +++ b/Engine/source/ts/tsLastDetail.cpp @@ -543,7 +543,7 @@ void TSLastDetail::updateImposterImages( bool forceUpdate ) GFX->endScene(); } -DefineConsoleFunction( tsUpdateImposterImages, void, (bool forceUpdate), (false), "tsUpdateImposterImages( bool forceupdate )") +DefineEngineFunction( tsUpdateImposterImages, void, (bool forceUpdate), (false), "tsUpdateImposterImages( bool forceupdate )") { TSLastDetail::updateImposterImages(forceUpdate); } diff --git a/Engine/source/util/fpsTracker.cpp b/Engine/source/util/fpsTracker.cpp index ebf49b458..4013344e4 100644 --- a/Engine/source/util/fpsTracker.cpp +++ b/Engine/source/util/fpsTracker.cpp @@ -88,7 +88,7 @@ void FPSTracker::update() } } -DefineConsoleFunction( resetFPSTracker, void, (), , "()" +DefineEngineFunction( resetFPSTracker, void, (), , "()" "@brief Reset FPS stats (fps::)\n\n" "@ingroup Game") { diff --git a/Engine/source/util/messaging/dispatcher.cpp b/Engine/source/util/messaging/dispatcher.cpp index 2ae20ba17..d21f0dfdb 100644 --- a/Engine/source/util/messaging/dispatcher.cpp +++ b/Engine/source/util/messaging/dispatcher.cpp @@ -331,7 +331,7 @@ extern void unlockDispatcherMutex() using namespace Dispatcher; -DefineConsoleFunction( isQueueRegistered, bool, (const char * queueName), , "(string queueName)" +DefineEngineFunction( isQueueRegistered, bool, (const char * queueName), , "(string queueName)" "@brief Determines if a dispatcher queue exists\n\n" "@param queueName String containing the name of queue\n" "@ingroup Messaging") @@ -339,7 +339,7 @@ DefineConsoleFunction( isQueueRegistered, bool, (const char * queueName), , "(st return Dispatcher::isQueueRegistered(queueName); } -DefineConsoleFunction( registerMessageQueue, void, (const char *queueName), , "(string queueName)" +DefineEngineFunction( registerMessageQueue, void, (const char *queueName), , "(string queueName)" "@brief Registeres a dispatcher queue\n\n" "@param queueName String containing the name of queue\n" "@ingroup Messaging") @@ -347,7 +347,7 @@ DefineConsoleFunction( registerMessageQueue, void, (const char *queueName), , "( return Dispatcher::registerMessageQueue(queueName); } -DefineConsoleFunction( unregisterMessageQueue, void, (const char *queueName), , "(string queueName)" +DefineEngineFunction( unregisterMessageQueue, void, (const char *queueName), , "(string queueName)" "@brief Unregisters a dispatcher queue\n\n" "@param queueName String containing the name of queue\n" "@ingroup Messaging") @@ -357,7 +357,7 @@ DefineConsoleFunction( unregisterMessageQueue, void, (const char *queueName), , //----------------------------------------------------------------------------- -DefineConsoleFunction( registerMessageListener, bool, (const char *queueName, const char *listenerName), , "(string queueName, string listener)" +DefineEngineFunction( registerMessageListener, bool, (const char *queueName, const char *listenerName), , "(string queueName, string listener)" "@brief Registers an event message\n\n" "@param queueName String containing the name of queue to attach listener to\n" "@param listener Name of event messenger\n" @@ -373,7 +373,7 @@ DefineConsoleFunction( registerMessageListener, bool, (const char *queueName, co return Dispatcher::registerMessageListener(queueName, listener); } -DefineConsoleFunction( unregisterMessageListener, void, (const char *queueName, const char *listenerName), , "(string queueName, string listener)" +DefineEngineFunction( unregisterMessageListener, void, (const char *queueName, const char *listenerName), , "(string queueName, string listener)" "@brief Unregisters an event message\n\n" "@param queueName String containing the name of queue\n" "@param listener Name of event messenger\n" @@ -391,7 +391,7 @@ DefineConsoleFunction( unregisterMessageListener, void, (const char *queueName, //----------------------------------------------------------------------------- -DefineConsoleFunction( dispatchMessage, bool, (const char *queueName, const char *message, const char *data), (""), "(string queueName, string message, string data)" +DefineEngineFunction( dispatchMessage, bool, (const char *queueName, const char *message, const char *data), (""), "(string queueName, string message, string data)" "@brief Dispatch a message to a queue\n\n" "@param queueName Queue to dispatch the message to\n" "@param message Message to dispatch\n" @@ -403,7 +403,7 @@ DefineConsoleFunction( dispatchMessage, bool, (const char *queueName, const char return Dispatcher::dispatchMessage(queueName, message, data); } -DefineConsoleFunction( dispatchMessageObject, bool, (const char *queueName, const char *message), ("", ""), "(string queueName, string message)" +DefineEngineFunction( dispatchMessageObject, bool, (const char *queueName, const char *message), ("", ""), "(string queueName, string message)" "@brief Dispatch a message object to a queue\n\n" "@param queueName Queue to dispatch the message to\n" "@param message Message to dispatch\n" diff --git a/Engine/source/util/sampler.cpp b/Engine/source/util/sampler.cpp index 7e163d004..f4d051e1e 100644 --- a/Engine/source/util/sampler.cpp +++ b/Engine/source/util/sampler.cpp @@ -394,7 +394,7 @@ SAMPLE_FUNC( const char* ); // Console Functions. //-------------------------------------------------------------------------------- -DefineConsoleFunction( beginSampling, void, (const char * location, const char * backend), ("CSV"), "(location, [backend]) -" +DefineEngineFunction( beginSampling, void, (const char * location, const char * backend), ("CSV"), "(location, [backend]) -" "@brief Takes a string informing the backend where to store " "sample data and optionally a name of the specific logging " "backend to use. The default is the CSV backend. In most " @@ -408,14 +408,14 @@ DefineConsoleFunction( beginSampling, void, (const char * location, const char * beginSampling( location, backend ); } -DefineConsoleFunction( stopSampling, void, (), , "()" +DefineEngineFunction( stopSampling, void, (), , "()" "@brief Stops the rendering sampler\n\n" "@ingroup Rendering\n") { stopSampling(); } -DefineConsoleFunction( enableSamples, void, (const char * pattern, bool state), (true), "(pattern, [state]) -" +DefineEngineFunction( enableSamples, void, (const char * pattern, bool state), (true), "(pattern, [state]) -" "@brief Enable sampling for all keys that match the given name " "pattern. Slashes are treated as separators.\n\n" "@ingroup Rendering") From 76908eae3caea80ff131c8988b96c7d73c4558e8 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Tue, 17 Apr 2018 21:01:50 +0200 Subject: [PATCH 269/312] Eliminate DefineConsoleMethod --- Engine/source/T3D/aiClient.cpp | 24 +++--- Engine/source/T3D/aiConnection.cpp | 14 ++-- Engine/source/T3D/aiPlayer.cpp | 2 +- .../camera/cameraComponent_ScriptBinding.h | 10 +-- .../collisionComponent_ScriptBinding.h | 14 ++-- Engine/source/T3D/components/component.cpp | 4 +- Engine/source/T3D/entity.cpp | 20 ++--- Engine/source/T3D/lightBase.cpp | 4 +- Engine/source/T3D/missionMarker.cpp | 2 +- Engine/source/T3D/physics/physicsDebris.cpp | 2 +- Engine/source/T3D/staticShape.cpp | 4 +- .../source/assets/assetQuery_ScriptBinding.h | 4 +- Engine/source/console/SimXMLDocument.cpp | 4 +- Engine/source/console/consoleLogger.cpp | 4 +- Engine/source/console/engineAPI.h | 2 +- Engine/source/console/fieldBrushObject.cpp | 8 +- Engine/source/console/persistenceManager.cpp | 26 +++---- Engine/source/console/simDatablock.cpp | 2 +- Engine/source/console/simObject.cpp | 58 +++++++------- Engine/source/console/simPersistSet.cpp | 2 +- Engine/source/console/simSet.cpp | 6 +- Engine/source/core/fileObject.cpp | 2 +- .../editors/guiMeshRoadEditorCtrl.cpp | 30 +++---- .../editors/guiRiverEditorCtrl.cpp | 28 +++---- .../environment/editors/guiRoadEditorCtrl.cpp | 22 +++--- Engine/source/environment/skyBox.cpp | 2 +- Engine/source/environment/sun.cpp | 4 +- .../forest/editor/forestBrushElement.cpp | 2 +- .../source/forest/editor/forestBrushTool.cpp | 2 +- .../source/forest/editor/forestEditorCtrl.cpp | 12 +-- .../forest/editor/forestSelectionTool.cpp | 12 +-- Engine/source/forest/forest.cpp | 8 +- .../source/gfx/video/theoraTextureObject.cpp | 6 +- .../gui/buttons/guiToolboxButtonCtrl.cpp | 6 +- Engine/source/gui/controls/guiBitmapCtrl.cpp | 2 +- Engine/source/gui/controls/guiColorPicker.cpp | 6 +- .../source/gui/controls/guiFileTreeCtrl.cpp | 6 +- .../source/gui/controls/guiGradientCtrl.cpp | 4 +- .../source/gui/controls/guiMaterialCtrl.cpp | 2 +- Engine/source/gui/controls/guiPopUpCtrl.cpp | 38 ++++----- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 18 ++--- Engine/source/gui/core/guiCanvas.cpp | 24 +++--- Engine/source/gui/core/guiControl.cpp | 2 +- Engine/source/gui/editor/guiDebugger.cpp | 16 ++-- Engine/source/gui/editor/guiEditCtrl.cpp | 56 ++++++------- Engine/source/gui/editor/guiFilterCtrl.cpp | 4 +- Engine/source/gui/editor/guiMenuBar.cpp | 12 +-- .../gui/editor/guiParticleGraphCtrl.cpp | 60 +++++++------- .../gui/editor/inspector/componentGroup.cpp | 2 +- .../gui/editor/inspector/dynamicField.cpp | 2 +- .../gui/editor/inspector/dynamicGroup.cpp | 6 +- Engine/source/gui/editor/inspector/field.cpp | 18 ++--- .../gui/editor/inspector/variableGroup.cpp | 4 +- .../editor/inspector/variableInspector.cpp | 16 ++-- Engine/source/gui/editor/popupMenu.cpp | 20 ++--- .../gui/game/guiIdleCamFadeBitmapCtrl.cpp | 4 +- Engine/source/gui/shiny/guiTickCtrl.cpp | 2 +- Engine/source/gui/utility/messageVector.cpp | 2 +- Engine/source/gui/worldEditor/creator.cpp | 18 ++--- Engine/source/gui/worldEditor/editor.cpp | 10 +-- .../worldEditor/guiConvexShapeEditorCtrl.cpp | 16 ++-- .../gui/worldEditor/guiDecalEditorCtrl.cpp | 22 +++--- .../gui/worldEditor/guiMissionAreaEditor.cpp | 4 +- .../gui/worldEditor/guiTerrPreviewCtrl.cpp | 14 ++-- .../source/gui/worldEditor/terrainActions.cpp | 2 +- .../source/gui/worldEditor/terrainEditor.cpp | 78 +++++++++---------- Engine/source/gui/worldEditor/worldEditor.cpp | 2 +- Engine/source/i18n/lang.cpp | 14 ++-- .../source/materials/materialDefinition.cpp | 14 ++-- Engine/source/math/util/tResponseCurve.cpp | 6 +- Engine/source/scene/sceneObject.cpp | 2 +- Engine/source/sfx/sfxSource.cpp | 2 +- Engine/source/terrain/terrExport.cpp | 4 +- Engine/source/util/messaging/eventManager.cpp | 18 ++--- Engine/source/util/messaging/message.cpp | 6 +- Engine/source/util/settings.cpp | 22 +++--- Engine/source/util/undo.cpp | 34 ++++---- 77 files changed, 483 insertions(+), 483 deletions(-) diff --git a/Engine/source/T3D/aiClient.cpp b/Engine/source/T3D/aiClient.cpp index 1f4be793b..8801e3460 100644 --- a/Engine/source/T3D/aiClient.cpp +++ b/Engine/source/T3D/aiClient.cpp @@ -418,7 +418,7 @@ void AIClient::onAdd( const char *nameSpace ) { /** * Sets the move speed for an AI object */ -DefineConsoleMethod( AIClient, setMoveSpeed, void, (F32 speed), , "ai.setMoveSpeed( float );" ) +DefineEngineMethod( AIClient, setMoveSpeed, void, (F32 speed), , "ai.setMoveSpeed( float );" ) { AIClient *ai = static_cast( object ); ai->setMoveSpeed( speed ); @@ -427,7 +427,7 @@ DefineConsoleMethod( AIClient, setMoveSpeed, void, (F32 speed), , "ai.setMoveSpe /** * Stops all AI movement, halt! */ -DefineConsoleMethod( AIClient, stop, void, (),, "ai.stop();" ) +DefineEngineMethod( AIClient, stop, void, (),, "ai.stop();" ) { AIClient *ai = static_cast( object ); ai->setMoveMode( AIClient::ModeStop ); @@ -436,7 +436,7 @@ DefineConsoleMethod( AIClient, stop, void, (),, "ai.stop();" ) /** * Tells the AI to aim at the location provided */ -DefineConsoleMethod( AIClient, setAimLocation, void, (Point3F v), , "ai.setAimLocation( x y z );" ) +DefineEngineMethod( AIClient, setAimLocation, void, (Point3F v), , "ai.setAimLocation( x y z );" ) { AIClient *ai = static_cast( object ); @@ -446,7 +446,7 @@ DefineConsoleMethod( AIClient, setAimLocation, void, (Point3F v), , "ai.setAimLo /** * Tells the AI to move to the location provided */ -DefineConsoleMethod( AIClient, setMoveDestination, void, (Point3F v), , "ai.setMoveDestination( x y z );" ) +DefineEngineMethod( AIClient, setMoveDestination, void, (Point3F v), , "ai.setMoveDestination( x y z );" ) { AIClient *ai = static_cast( object ); @@ -456,7 +456,7 @@ DefineConsoleMethod( AIClient, setMoveDestination, void, (Point3F v), , "ai.setM /** * Returns the point the AI is aiming at */ -DefineConsoleMethod( AIClient, getAimLocation, Point3F, (),, "ai.getAimLocation();" ) +DefineEngineMethod( AIClient, getAimLocation, Point3F, (),, "ai.getAimLocation();" ) { AIClient *ai = static_cast( object ); return ai->getAimLocation(); @@ -465,7 +465,7 @@ DefineConsoleMethod( AIClient, getAimLocation, Point3F, (),, "ai.getAimLocation( /** * Returns the point the AI is set to move to */ -DefineConsoleMethod( AIClient, getMoveDestination, Point3F, (),, "ai.getMoveDestination();" ) +DefineEngineMethod( AIClient, getMoveDestination, Point3F, (),, "ai.getMoveDestination();" ) { AIClient *ai = static_cast( object ); return ai->getMoveDestination(); @@ -474,7 +474,7 @@ DefineConsoleMethod( AIClient, getMoveDestination, Point3F, (),, "ai.getMoveDest /** * Sets the bots target object */ -DefineConsoleMethod( AIClient, setTargetObject, void, (const char * objName), , "ai.setTargetObject( obj );" ) +DefineEngineMethod( AIClient, setTargetObject, void, (const char * objName), , "ai.setTargetObject( obj );" ) { AIClient *ai = static_cast( object ); @@ -489,7 +489,7 @@ DefineConsoleMethod( AIClient, setTargetObject, void, (const char * objName), , /** * Gets the object the AI is targeting */ -DefineConsoleMethod( AIClient, getTargetObject, S32, (),, "ai.getTargetObject();" ) +DefineEngineMethod( AIClient, getTargetObject, S32, (),, "ai.getTargetObject();" ) { AIClient *ai = static_cast( object ); @@ -499,7 +499,7 @@ DefineConsoleMethod( AIClient, getTargetObject, S32, (),, "ai.getTargetObject(); /** * Tells the bot the mission is cycling */ -DefineConsoleMethod( AIClient, missionCycleCleanup, void, (),, "ai.missionCycleCleanup();" ) +DefineEngineMethod( AIClient, missionCycleCleanup, void, (),, "ai.missionCycleCleanup();" ) { AIClient *ai = static_cast( object ); ai->missionCycleCleanup(); @@ -508,7 +508,7 @@ DefineConsoleMethod( AIClient, missionCycleCleanup, void, (),, "ai.missionCycleC /** * Sets the AI to run mode */ -DefineConsoleMethod( AIClient, move, void, (),, "ai.move();" ) +DefineEngineMethod( AIClient, move, void, (),, "ai.move();" ) { AIClient *ai = static_cast( object ); ai->setMoveMode( AIClient::ModeMove ); @@ -517,7 +517,7 @@ DefineConsoleMethod( AIClient, move, void, (),, "ai.move();" ) /** * Gets the AI's location in the world */ -DefineConsoleMethod( AIClient, getLocation, Point3F, (),, "ai.getLocation();" ) +DefineEngineMethod( AIClient, getLocation, Point3F, (),, "ai.getLocation();" ) { AIClient *ai = static_cast( object ); return ai->getLocation(); @@ -559,7 +559,7 @@ DefineEngineFunction( aiAddPlayer, S32, (const char * name, const char * ns), (" /** * Tells the AI to move forward 100 units...TEST FXN */ -DefineConsoleMethod( AIClient, moveForward, void, (),, "ai.moveForward();" ) +DefineEngineMethod( AIClient, moveForward, void, (),, "ai.moveForward();" ) { AIClient *ai = static_cast( object ); diff --git a/Engine/source/T3D/aiConnection.cpp b/Engine/source/T3D/aiConnection.cpp index af60b1d3c..21564d5eb 100644 --- a/Engine/source/T3D/aiConnection.cpp +++ b/Engine/source/T3D/aiConnection.cpp @@ -160,7 +160,7 @@ ConsoleFunction(aiConnect, S32 , 2, 20, "(...)" //----------------------------------------------------------------------------- -DefineConsoleMethod(AIConnection, setMove, void, (const char * field, F32 value), ,"(string field, float value)" +DefineEngineMethod(AIConnection, setMove, void, (const char * field, F32 value), ,"(string field, float value)" "Set a field on the current move.\n\n" "@param field One of {'x','y','z','yaw','pitch','roll'}\n" "@param value Value to set field to.") @@ -190,7 +190,7 @@ DefineConsoleMethod(AIConnection, setMove, void, (const char * field, F32 value) object->setMove(&move); } -DefineConsoleMethod(AIConnection,getMove,F32, (const char * field), ,"(string field)" +DefineEngineMethod(AIConnection,getMove,F32, (const char * field), ,"(string field)" "Get the given field of a move.\n\n" "@param field One of {'x','y','z','yaw','pitch','roll'}\n" "@returns The requested field on the current move.") @@ -212,7 +212,7 @@ DefineConsoleMethod(AIConnection,getMove,F32, (const char * field), ,"(string fi } -DefineConsoleMethod(AIConnection,setFreeLook,void,(bool isFreeLook), ,"(bool isFreeLook)" +DefineEngineMethod(AIConnection,setFreeLook,void,(bool isFreeLook), ,"(bool isFreeLook)" "Enable/disable freelook on the current move.") { Move move = object->getMove(); @@ -220,7 +220,7 @@ DefineConsoleMethod(AIConnection,setFreeLook,void,(bool isFreeLook), ,"(bool isF object->setMove(&move); } -DefineConsoleMethod(AIConnection, getFreeLook, bool, (), ,"getFreeLook()" +DefineEngineMethod(AIConnection, getFreeLook, bool, (), ,"getFreeLook()" "Is freelook on for the current move?") { return object->getMove().freeLook; @@ -229,7 +229,7 @@ DefineConsoleMethod(AIConnection, getFreeLook, bool, (), ,"getFreeLook()" //----------------------------------------------------------------------------- -DefineConsoleMethod(AIConnection,setTrigger,void, (S32 idx, bool set), ,"(int trigger, bool set)" +DefineEngineMethod(AIConnection,setTrigger,void, (S32 idx, bool set), ,"(int trigger, bool set)" "Set a trigger.") { if (idx >= 0 && idx < MaxTriggerKeys) @@ -240,7 +240,7 @@ DefineConsoleMethod(AIConnection,setTrigger,void, (S32 idx, bool set), ,"(int tr } } -DefineConsoleMethod(AIConnection,getTrigger,bool, (S32 idx), ,"(int trigger)" +DefineEngineMethod(AIConnection,getTrigger,bool, (S32 idx), ,"(int trigger)" "Is the given trigger set?") { if (idx >= 0 && idx < MaxTriggerKeys) @@ -251,7 +251,7 @@ DefineConsoleMethod(AIConnection,getTrigger,bool, (S32 idx), ,"(int trigger)" //----------------------------------------------------------------------------- -DefineConsoleMethod(AIConnection,getAddress,const char*,(), ,"") +DefineEngineMethod(AIConnection,getAddress,const char*,(), ,"") { // Override the netConnection method to return to indicate // this is an ai connection. diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index 6e1c39328..565bb742c 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -1251,7 +1251,7 @@ ConsoleDocFragment _setAimObject( "void setAimObject(GameBase targetObject, Point3F offset);" ); -DefineConsoleMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )" +DefineEngineMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )" "Sets the bot's target object. Optionally set an offset from target location." "@hide") { diff --git a/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h b/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h index 2c3f1dbef..d3b7f9883 100644 --- a/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h +++ b/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h @@ -30,7 +30,7 @@ ConsoleMethod(CameraComponent, getMode, const char*, 2, 2, "() - We get the firs return "fly"; } -DefineConsoleMethod(CameraComponent, getForwardVector, VectorF, (), , +DefineEngineMethod(CameraComponent, getForwardVector, VectorF, (), , "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -44,7 +44,7 @@ DefineConsoleMethod(CameraComponent, getForwardVector, VectorF, (), , return returnVec; } -DefineConsoleMethod(CameraComponent, getRightVector, VectorF, (), , +DefineEngineMethod(CameraComponent, getRightVector, VectorF, (), , "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -58,7 +58,7 @@ DefineConsoleMethod(CameraComponent, getRightVector, VectorF, (), , return returnVec; } -DefineConsoleMethod(CameraComponent, getUpVector, VectorF, (), , +DefineEngineMethod(CameraComponent, getUpVector, VectorF, (), , "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -72,14 +72,14 @@ DefineConsoleMethod(CameraComponent, getUpVector, VectorF, (), , return returnVec; } -DefineConsoleMethod(CameraComponent, setForwardVector, void, (VectorF newForward), (VectorF(0, 0, 0)), +DefineEngineMethod(CameraComponent, setForwardVector, void, (VectorF newForward), (VectorF(0, 0, 0)), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { object->setForwardVector(newForward); } -DefineConsoleMethod(CameraComponent, getWorldPosition, Point3F, (), , +DefineEngineMethod(CameraComponent, getWorldPosition, Point3F, (), , "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { diff --git a/Engine/source/T3D/components/collision/collisionComponent_ScriptBinding.h b/Engine/source/T3D/components/collision/collisionComponent_ScriptBinding.h index 3b8e83d11..30c41da2b 100644 --- a/Engine/source/T3D/components/collision/collisionComponent_ScriptBinding.h +++ b/Engine/source/T3D/components/collision/collisionComponent_ScriptBinding.h @@ -24,21 +24,21 @@ #include "T3D/components/collision/collisionComponent.h" #include "materials/baseMatInstance.h" -DefineConsoleMethod(CollisionComponent, getNumberOfContacts, S32, (), , +DefineEngineMethod(CollisionComponent, getNumberOfContacts, S32, (), , "Gets the number of contacts this collider has hit.\n" "@return The number of static fields defined on the object.") { return object->getCollisionList()->getCount(); } -DefineConsoleMethod(CollisionComponent, getBestContact, S32, (), , +DefineEngineMethod(CollisionComponent, getBestContact, S32, (), , "Gets the number of contacts this collider has hit.\n" "@return The number of static fields defined on the object.") { return 0; } -DefineConsoleMethod(CollisionComponent, getContactNormal, Point3F, (), , +DefineEngineMethod(CollisionComponent, getContactNormal, Point3F, (), , "Gets the number of contacts this collider has hit.\n" "@return The number of static fields defined on the object.") { @@ -53,7 +53,7 @@ DefineConsoleMethod(CollisionComponent, getContactNormal, Point3F, (), , return Point3F::Zero; } -DefineConsoleMethod(CollisionComponent, getContactMaterial, S32, (), , +DefineEngineMethod(CollisionComponent, getContactMaterial, S32, (), , "Gets the number of contacts this collider has hit.\n" "@return The number of static fields defined on the object.") { @@ -69,7 +69,7 @@ DefineConsoleMethod(CollisionComponent, getContactMaterial, S32, (), , return 0; } -DefineConsoleMethod(CollisionComponent, getContactObject, S32, (), , +DefineEngineMethod(CollisionComponent, getContactObject, S32, (), , "Gets the number of contacts this collider has hit.\n" "@return The number of static fields defined on the object.") { @@ -81,7 +81,7 @@ DefineConsoleMethod(CollisionComponent, getContactObject, S32, (), , return 0; } -DefineConsoleMethod(CollisionComponent, getContactPoint, Point3F, (), , +DefineEngineMethod(CollisionComponent, getContactPoint, Point3F, (), , "Gets the number of contacts this collider has hit.\n" "@return The number of static fields defined on the object.") { @@ -96,7 +96,7 @@ DefineConsoleMethod(CollisionComponent, getContactPoint, Point3F, (), , return Point3F::Zero; } -DefineConsoleMethod(CollisionComponent, getContactTime, S32, (), , +DefineEngineMethod(CollisionComponent, getContactTime, S32, (), , "Gets the number of contacts this collider has hit.\n" "@return The number of static fields defined on the object.") { diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index c7f9dcc2c..83fc015f1 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -633,7 +633,7 @@ ConsoleMethod(Component, endGroup, void, 2, 2, "()\n" object->endFieldGroup(); } -DefineConsoleMethod(Component, addComponentField, void, (String fieldName, String fieldDesc, String fieldType, String defValue, String userData, bool hidden), +DefineEngineMethod(Component, addComponentField, void, (String fieldName, String fieldDesc, String fieldType, String defValue, String userData, bool hidden), ("", "", "", "", "", false), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") @@ -678,7 +678,7 @@ ConsoleMethod(Component, setComponentield, const char *, 3, 3, "(int index) - Ge return buf; } -DefineConsoleMethod(Component, getComponentFieldType, const char *, (String fieldName), , +DefineEngineMethod(Component, getComponentFieldType, const char *, (String fieldName), , "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index fe0303652..587eb145b 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -1800,7 +1800,7 @@ DefineEngineMethod(Entity, setBox, void, } -/*DefineConsoleMethod(Entity, callOnComponents, void, (const char* functionName), , +/*DefineEngineMethod(Entity, callOnComponents, void, (const char* functionName), , "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -1875,7 +1875,7 @@ ConsoleMethod(Entity, getComponentByIndex, S32, 3, 3, "(int index) - Gets a part return (comp != NULL) ? comp->getId() : 0; } -DefineConsoleMethod(Entity, getComponent, S32, (String componentName), (""), +DefineEngineMethod(Entity, getComponent, S32, (String componentName), (""), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -1916,7 +1916,7 @@ ConsoleMethod(Entity, getComponentCount, S32, 2, 2, "() - Get the count of behav return object->getComponentCount(); } -DefineConsoleMethod(Entity, setComponentDirty, void, (S32 componentID, bool forceUpdate), (0, false), +DefineEngineMethod(Entity, setComponentDirty, void, (S32 componentID, bool forceUpdate), (0, false), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -1925,7 +1925,7 @@ DefineConsoleMethod(Entity, setComponentDirty, void, (S32 componentID, bool forc object->setComponentDirty(comp, forceUpdate);*/ } -DefineConsoleMethod(Entity, getMoveVector, VectorF, (),, +DefineEngineMethod(Entity, getMoveVector, VectorF, (),, "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -1939,7 +1939,7 @@ DefineConsoleMethod(Entity, getMoveVector, VectorF, (),, return VectorF::Zero; } -DefineConsoleMethod(Entity, getMoveRotation, VectorF, (), , +DefineEngineMethod(Entity, getMoveRotation, VectorF, (), , "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -1953,7 +1953,7 @@ DefineConsoleMethod(Entity, getMoveRotation, VectorF, (), , return VectorF::Zero; } -DefineConsoleMethod(Entity, getMoveTrigger, bool, (S32 triggerNum), (0), +DefineEngineMethod(Entity, getMoveTrigger, bool, (S32 triggerNum), (0), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { @@ -1974,28 +1974,28 @@ DefineEngineMethod(Entity, getForwardVector, VectorF, (), , return forVec; } -DefineConsoleMethod(Entity, setForwardVector, void, (VectorF newForward), (VectorF(0,0,0)), +DefineEngineMethod(Entity, setForwardVector, void, (VectorF newForward), (VectorF(0,0,0)), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { object->setForwardVector(newForward); } -DefineConsoleMethod(Entity, lookAt, void, (Point3F lookPosition),, +DefineEngineMethod(Entity, lookAt, void, (Point3F lookPosition),, "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { //object->setForwardVector(newForward); } -DefineConsoleMethod(Entity, rotateTo, void, (Point3F lookPosition, F32 degreePerSecond), (1.0), +DefineEngineMethod(Entity, rotateTo, void, (Point3F lookPosition, F32 degreePerSecond), (1.0), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { //object->setForwardVector(newForward); } -DefineConsoleMethod(Entity, notify, void, (String signalFunction, String argA, String argB, String argC, String argD, String argE), +DefineEngineMethod(Entity, notify, void, (String signalFunction, String argA, String argB, String argC, String argD, String argE), ("", "", "", "", "", ""), "Triggers a signal call to all components for a certain function.") { diff --git a/Engine/source/T3D/lightBase.cpp b/Engine/source/T3D/lightBase.cpp index 6cc739ed3..007f2ca32 100644 --- a/Engine/source/T3D/lightBase.cpp +++ b/Engine/source/T3D/lightBase.cpp @@ -440,7 +440,7 @@ static ConsoleDocFragment _lbplayAnimation2( "void playAnimation(LightAnimData anim);" ); -DefineConsoleMethod( LightBase, playAnimation, void, (const char * anim), (""), "( [LightAnimData anim] )\t" +DefineEngineMethod( LightBase, playAnimation, void, (const char * anim), (""), "( [LightAnimData anim] )\t" "Plays a light animation on the light. If no LightAnimData is passed the " "existing one is played." "@hide") @@ -484,7 +484,7 @@ void LightBase::playAnimation( LightAnimData *animData ) } } -DefineConsoleMethod( LightBase, pauseAnimation, void, (), , "Stops the light animation." ) +DefineEngineMethod( LightBase, pauseAnimation, void, (), , "Stops the light animation." ) { object->pauseAnimation(); } diff --git a/Engine/source/T3D/missionMarker.cpp b/Engine/source/T3D/missionMarker.cpp index 1480e2f1f..ff4fc3c0d 100644 --- a/Engine/source/T3D/missionMarker.cpp +++ b/Engine/source/T3D/missionMarker.cpp @@ -494,7 +494,7 @@ ConsoleDocFragment _SpawnSpherespawnObject1( "bool spawnObject(string additionalProps);" ); -DefineConsoleMethod(SpawnSphere, spawnObject, S32, (String additionalProps), , +DefineEngineMethod(SpawnSphere, spawnObject, S32, (String additionalProps), , "([string additionalProps]) Spawns the object based on the SpawnSphere's " "class, datablock, properties, and script settings. Allows you to pass in " "extra properties." diff --git a/Engine/source/T3D/physics/physicsDebris.cpp b/Engine/source/T3D/physics/physicsDebris.cpp index a2e2026b3..90a225ff4 100644 --- a/Engine/source/T3D/physics/physicsDebris.cpp +++ b/Engine/source/T3D/physics/physicsDebris.cpp @@ -238,7 +238,7 @@ void PhysicsDebrisData::unpackData(BitStream* stream) shapeName = stream->readSTString(); } -DefineConsoleMethod( PhysicsDebrisData, preload, void, (), , +DefineEngineMethod( PhysicsDebrisData, preload, void, (), , "@brief Loads some information to have readily available at simulation time.\n\n" "Forces generation of shaders, materials, and other data used by the %PhysicsDebris object. " "This function should be used while a level is loading in order to shorten " diff --git a/Engine/source/T3D/staticShape.cpp b/Engine/source/T3D/staticShape.cpp index 874e31059..9bc7369e1 100644 --- a/Engine/source/T3D/staticShape.cpp +++ b/Engine/source/T3D/staticShape.cpp @@ -314,7 +314,7 @@ void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream) // This appears to be legacy T2 stuff // Marked internal, as this is flagged to be deleted // [8/1/2010 mperry] -DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)" +DefineEngineMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)" "@internal") { if(!object->isServerObject()) @@ -322,7 +322,7 @@ DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(b object->setPowered(isPowered); } -DefineConsoleMethod( StaticShape, getPoweredState, bool, (), , "@internal") +DefineEngineMethod( StaticShape, getPoweredState, bool, (), , "@internal") { if(!object->isServerObject()) return(false); diff --git a/Engine/source/assets/assetQuery_ScriptBinding.h b/Engine/source/assets/assetQuery_ScriptBinding.h index 1656d2eb3..71cc58f1a 100644 --- a/Engine/source/assets/assetQuery_ScriptBinding.h +++ b/Engine/source/assets/assetQuery_ScriptBinding.h @@ -59,7 +59,7 @@ DefineEngineMethod(AssetQuery, set, bool, (S32 queryId), , //----------------------------------------------------------------------------- -DefineConsoleMethod(AssetQuery, getCount, S32, (), , +DefineEngineMethod(AssetQuery, getCount, S32, (), , "Gets the count of asset Id results.\n" "@return (int)The count of asset Id results.\n") { @@ -68,7 +68,7 @@ DefineConsoleMethod(AssetQuery, getCount, S32, (), , //----------------------------------------------------------------------------- -DefineConsoleMethod(AssetQuery, getAsset, const char*, (S32 resultIndex), (-1), +DefineEngineMethod(AssetQuery, getAsset, const char*, (S32 resultIndex), (-1), "Gets the asset Id at the specified query result index.\n" "@param resultIndex The query result index to use.\n" "@return (assetId)The asset Id at the specified index or NULL if not valid.\n") diff --git a/Engine/source/console/SimXMLDocument.cpp b/Engine/source/console/SimXMLDocument.cpp index 156533503..df45888d1 100644 --- a/Engine/source/console/SimXMLDocument.cpp +++ b/Engine/source/console/SimXMLDocument.cpp @@ -571,7 +571,7 @@ DefineEngineMethod( SimXMLDocument, attribute, const char*, ( const char* attrib } // These two methods don't make a lot of sense the way TS works. Leaving them in for backwards-compatibility. -DefineConsoleMethod( SimXMLDocument, attributeF32, F32, (const char * attributeName), , "(string attributeName)" +DefineEngineMethod( SimXMLDocument, attributeF32, F32, (const char * attributeName), , "(string attributeName)" "@brief Get float attribute from the current Element on the stack.\n\n" "@param attributeName Name of attribute to retrieve.\n" "@return The value of the given attribute in the form of a float.\n" @@ -580,7 +580,7 @@ DefineConsoleMethod( SimXMLDocument, attributeF32, F32, (const char * attributeN return dAtof( object->attribute( attributeName ) ); } -DefineConsoleMethod(SimXMLDocument, attributeS32, S32, (const char * attributeName), , "(string attributeName)" +DefineEngineMethod(SimXMLDocument, attributeS32, S32, (const char * attributeName), , "(string attributeName)" "@brief Get int attribute from the current Element on the stack.\n\n" "@param attributeName Name of attribute to retrieve.\n" "@return The value of the given attribute in the form of an integer.\n" diff --git a/Engine/source/console/consoleLogger.cpp b/Engine/source/console/consoleLogger.cpp index 84347a332..fc2095eae 100644 --- a/Engine/source/console/consoleLogger.cpp +++ b/Engine/source/console/consoleLogger.cpp @@ -225,7 +225,7 @@ void ConsoleLogger::log( const char *consoleLine ) //----------------------------------------------------------------------------- -DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file" +DefineEngineMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file" "@tsexample\n" "// Create the logger\n" "// Will automatically start writing to testLogging.txt with normal priority\n" @@ -247,7 +247,7 @@ DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger //----------------------------------------------------------------------------- -DefineConsoleMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file" +DefineEngineMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file" "@tsexample\n" "// Create the logger\n" "// Will automatically start writing to testLogging.txt with normal priority\n" diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 2eef409b6..ca7ca8a1d 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -861,7 +861,7 @@ public: // these macros can be removed and all definitions that make use of them can be removed // as well. -#define DefineConsoleMethod( className, name, returnType, args, defaultArgs, usage ) \ +#define DefineEngineMethod( className, name, returnType, args, defaultArgs, usage ) \ struct _ ## className ## name ## frame \ { \ typedef className ObjectType; \ diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index 0caf00e48..6ec9ace0d 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -123,7 +123,7 @@ static char* suppressSpaces(const char* in_pname) //----------------------------------------------------------------------------- // Query Groups. //----------------------------------------------------------------------------- -DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* simObjName), , "(simObject) Query available static-field groups for selected object./\n" +DefineEngineMethod(FieldBrushObject, queryGroups, const char*, (const char* simObjName), , "(simObject) Query available static-field groups for selected object./\n" "@param simObject Object to query static-field groups on.\n" "@return Space-seperated static-field group list.") { @@ -191,7 +191,7 @@ DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* sim //----------------------------------------------------------------------------- // Query Fields. //----------------------------------------------------------------------------- -DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* simObjName, const char* groupList), (""), "(simObject, [groupList]) Query available static-fields for selected object./\n" +DefineEngineMethod(FieldBrushObject, queryFields, const char*, (const char* simObjName, const char* groupList), (""), "(simObject, [groupList]) Query available static-fields for selected object./\n" "@param simObject Object to query static-fields on.\n" "@param groupList groups to filter static-fields against.\n" "@return Space-seperated static-field list.") @@ -366,7 +366,7 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim //----------------------------------------------------------------------------- // Copy Fields. //----------------------------------------------------------------------------- -DefineConsoleMethod(FieldBrushObject, copyFields, void, (const char* simObjName, const char* pFieldList), (""), "(simObject, [fieldList]) Copy selected static-fields for selected object./\n" +DefineEngineMethod(FieldBrushObject, copyFields, void, (const char* simObjName, const char* pFieldList), (""), "(simObject, [fieldList]) Copy selected static-fields for selected object./\n" "@param simObject Object to copy static-fields from.\n" "@param fieldList fields to filter static-fields against.\n" "@return No return value.") @@ -500,7 +500,7 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList //----------------------------------------------------------------------------- // Paste Fields. //----------------------------------------------------------------------------- -DefineConsoleMethod(FieldBrushObject, pasteFields, void, (const char* simObjName), , "(simObject) Paste copied static-fields to selected object./\n" +DefineEngineMethod(FieldBrushObject, pasteFields, void, (const char* simObjName), , "(simObject) Paste copied static-fields to selected object./\n" "@param simObject Object to paste static-fields to.\n" "@return No return value.") { diff --git a/Engine/source/console/persistenceManager.cpp b/Engine/source/console/persistenceManager.cpp index 56812cd4b..75f209237 100644 --- a/Engine/source/console/persistenceManager.cpp +++ b/Engine/source/console/persistenceManager.cpp @@ -2190,14 +2190,14 @@ void PersistenceManager::deleteObjectsFromFile(const char* fileName) clearAll(); } -DefineConsoleMethod( PersistenceManager, deleteObjectsFromFile, void, ( const char * fileName ), , "( fileName )" +DefineEngineMethod( PersistenceManager, deleteObjectsFromFile, void, ( const char * fileName ), , "( fileName )" "Delete all of the objects that are created from the given file." ) { // Delete Objects. object->deleteObjectsFromFile( fileName ); } -DefineConsoleMethod( PersistenceManager, setDirty, void, ( const char * objName, const char * fileName ), (""), "(SimObject object, [filename])" +DefineEngineMethod( PersistenceManager, setDirty, void, ( const char * objName, const char * fileName ), (""), "(SimObject object, [filename])" "Mark an existing SimObject as dirty (will be written out when saveDirty() is called).") { SimObject *dirtyObject = NULL; @@ -2226,7 +2226,7 @@ DefineConsoleMethod( PersistenceManager, setDirty, void, ( const char * objName } } -DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objName ), , "(SimObject object)" +DefineEngineMethod( PersistenceManager, removeDirty, void, ( const char * objName ), , "(SimObject object)" "Remove a SimObject from the dirty list.") { SimObject *dirtyObject = NULL; @@ -2243,7 +2243,7 @@ DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objNa object->removeDirty(dirtyObject); } -DefineConsoleMethod( PersistenceManager, isDirty, bool, ( const char * objName ), , "(SimObject object)" +DefineEngineMethod( PersistenceManager, isDirty, bool, ( const char * objName ), , "(SimObject object)" "Returns true if the SimObject is on the dirty list.") { SimObject *dirtyObject = NULL; @@ -2262,19 +2262,19 @@ DefineConsoleMethod( PersistenceManager, isDirty, bool, ( const char * objName ) return false; } -DefineConsoleMethod( PersistenceManager, hasDirty, bool, (), , "()" +DefineEngineMethod( PersistenceManager, hasDirty, bool, (), , "()" "Returns true if the manager has dirty objects to save." ) { return object->hasDirty(); } -DefineConsoleMethod( PersistenceManager, getDirtyObjectCount, S32, (), , "()" +DefineEngineMethod( PersistenceManager, getDirtyObjectCount, S32, (), , "()" "Returns the number of dirty objects." ) { return object->getDirtyList().size(); } -DefineConsoleMethod( PersistenceManager, getDirtyObject, S32, (S32 index), , "( index )" +DefineEngineMethod( PersistenceManager, getDirtyObject, S32, (S32 index), , "( index )" "Returns the ith dirty object." ) { if ( index < 0 || index >= object->getDirtyList().size() ) @@ -2290,7 +2290,7 @@ DefineConsoleMethod( PersistenceManager, getDirtyObject, S32, (S32 index), , "( return ( dirtyObject.getObject() ) ? dirtyObject.getObject()->getId() : 0; } -DefineConsoleMethod( PersistenceManager, listDirty, void, (), , "()" +DefineEngineMethod( PersistenceManager, listDirty, void, (), , "()" "Prints the dirty list to the console.") { const PersistenceManager::DirtyList dirtyList = object->getDirtyList(); @@ -2318,13 +2318,13 @@ DefineConsoleMethod( PersistenceManager, listDirty, void, (), , "()" } } -DefineConsoleMethod( PersistenceManager, saveDirty, bool, (), , "()" +DefineEngineMethod( PersistenceManager, saveDirty, bool, (), , "()" "Saves all of the SimObject's on the dirty list to their respective files.") { return object->saveDirty(); } -DefineConsoleMethod( PersistenceManager, saveDirtyObject, bool, (const char * objName), , "(SimObject object)" +DefineEngineMethod( PersistenceManager, saveDirtyObject, bool, (const char * objName), , "(SimObject object)" "Save a dirty SimObject to it's file.") { SimObject *dirtyObject = NULL; @@ -2342,13 +2342,13 @@ DefineConsoleMethod( PersistenceManager, saveDirtyObject, bool, (const char * ob return false; } -DefineConsoleMethod( PersistenceManager, clearAll, void, (), , "()" +DefineEngineMethod( PersistenceManager, clearAll, void, (), , "()" "Clears all the tracked objects without saving them." ) { object->clearAll(); } -DefineConsoleMethod( PersistenceManager, removeObjectFromFile, void, (const char * objName, const char * filename),("") , "(SimObject object, [filename])" +DefineEngineMethod( PersistenceManager, removeObjectFromFile, void, (const char * objName, const char * filename),("") , "(SimObject object, [filename])" "Remove an existing SimObject from a file (can optionally specify a different file than \ the one it was created in.") { @@ -2371,7 +2371,7 @@ DefineConsoleMethod( PersistenceManager, removeObjectFromFile, void, (const char } } -DefineConsoleMethod( PersistenceManager, removeField, void, (const char * objName, const char * fieldName), , "(SimObject object, string fieldName)" +DefineEngineMethod( PersistenceManager, removeField, void, (const char * objName, const char * fieldName), , "(SimObject object, string fieldName)" "Remove a specific field from an object declaration.") { SimObject *dirtyObject = NULL; diff --git a/Engine/source/console/simDatablock.cpp b/Engine/source/console/simDatablock.cpp index 6181fe810..771b1f039 100644 --- a/Engine/source/console/simDatablock.cpp +++ b/Engine/source/console/simDatablock.cpp @@ -428,7 +428,7 @@ void SimDataBlock::write(Stream &stream, U32 tabStop, U32 flags) //----------------------------------------------------------------------------- -DefineConsoleMethod( SimDataBlock, reloadOnLocalClient, void, (),, +DefineEngineMethod( SimDataBlock, reloadOnLocalClient, void, (),, "Reload the datablock. This can only be used with a local client configuration." ) { // Make sure we're running a local client. diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index b47448414..62ac25fd1 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -2271,7 +2271,7 @@ DefineEngineMethod( SimObject, dumpGroupHierarchy, void, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, isMethod, bool, ( const char* methodName ),, +DefineEngineMethod( SimObject, isMethod, bool, ( const char* methodName ),, "Test whether the given method is defined on this object.\n" "@param The name of the method.\n" "@return True if the object implements the given method." ) @@ -2291,7 +2291,7 @@ DefineEngineMethod( SimObject, isChildOfGroup, bool, ( SimGroup* group ),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getClassNamespace, const char*, (),, +DefineEngineMethod( SimObject, getClassNamespace, const char*, (),, "Get the name of the class namespace assigned to this object.\n" "@return The name of the 'class' namespace." ) { @@ -2300,7 +2300,7 @@ DefineConsoleMethod( SimObject, getClassNamespace, const char*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getSuperClassNamespace, const char*, (),, +DefineEngineMethod( SimObject, getSuperClassNamespace, const char*, (),, "Get the name of the superclass namespace assigned to this object.\n" "@return The name of the 'superClass' namespace." ) { @@ -2309,7 +2309,7 @@ DefineConsoleMethod( SimObject, getSuperClassNamespace, const char*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, setClassNamespace, void, ( const char* name ),, +DefineEngineMethod( SimObject, setClassNamespace, void, ( const char* name ),, "Assign a class namespace to this object.\n" "@param name The name of the 'class' namespace for this object." ) { @@ -2318,7 +2318,7 @@ DefineConsoleMethod( SimObject, setClassNamespace, void, ( const char* name ),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, setSuperClassNamespace, void, ( const char* name ),, +DefineEngineMethod( SimObject, setSuperClassNamespace, void, ( const char* name ),, "Assign a superclass namespace to this object.\n" "@param name The name of the 'superClass' namespace for this object." ) { @@ -2345,7 +2345,7 @@ DefineEngineMethod( SimObject, setIsSelected, void, ( bool state ), ( true ), //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, isExpanded, bool, (),, +DefineEngineMethod( SimObject, isExpanded, bool, (),, "Get whether the object has been marked as expanded. (in editor)\n" "@return True if the object is marked expanded." ) { @@ -2354,7 +2354,7 @@ DefineConsoleMethod( SimObject, isExpanded, bool, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, setIsExpanded, void, ( bool state ), ( true ), +DefineEngineMethod( SimObject, setIsExpanded, void, ( bool state ), ( true ), "Set whether the object has been marked as expanded. (in editor)\n" "@param state True if the object is to be marked expanded; false if not." ) { @@ -2363,7 +2363,7 @@ DefineConsoleMethod( SimObject, setIsExpanded, void, ( bool state ), ( true ), //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getFilename, const char*, (),, +DefineEngineMethod( SimObject, getFilename, const char*, (),, "Returns the filename the object is attached to.\n" "@return The name of the file the object is associated with; usually the file the object was loaded from." ) { @@ -2372,7 +2372,7 @@ DefineConsoleMethod( SimObject, getFilename, const char*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, setFilename, void, ( const char* fileName ),, +DefineEngineMethod( SimObject, setFilename, void, ( const char* fileName ),, "Sets the object's file name and path\n" "@param fileName The name of the file to associate this object with." ) { @@ -2381,7 +2381,7 @@ DefineConsoleMethod( SimObject, setFilename, void, ( const char* fileName ),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getDeclarationLine, S32, (),, +DefineEngineMethod( SimObject, getDeclarationLine, S32, (),, "Get the line number at which the object is defined in its file.\n\n" "@return The line number of the object's definition in script.\n" "@see getFilename()") @@ -2418,7 +2418,7 @@ DefineEngineFunction( debugEnumInstances, void, ( const char* className, const c //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, assignFieldsFrom, void, ( SimObject* fromObject ),, +DefineEngineMethod( SimObject, assignFieldsFrom, void, ( SimObject* fromObject ),, "Copy fields from another object onto this one. The objects must " "be of same type. Everything from the object will overwrite what's " "in this object; extra fields in this object will remain. This " @@ -2439,7 +2439,7 @@ DefineEngineMethod( SimObject, assignPersistentId, void, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getCanSave, bool, (),, +DefineEngineMethod( SimObject, getCanSave, bool, (),, "Get whether the object will be included in saves.\n" "@return True if the object will be saved; false otherwise." ) { @@ -2448,7 +2448,7 @@ DefineConsoleMethod( SimObject, getCanSave, bool, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, setCanSave, void, ( bool value ), ( true ), +DefineEngineMethod( SimObject, setCanSave, void, ( bool value ), ( true ), "Set whether the object will be included in saves.\n" "@param value If true, the object will be included in saves; if false, it will be excluded." ) { @@ -2529,7 +2529,7 @@ DefineEngineMethod( SimObject, setHidden, void, ( bool value ), ( true ), //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, dumpMethods, ArrayObject*, (),, +DefineEngineMethod( SimObject, dumpMethods, ArrayObject*, (),, "List the methods defined on this object.\n\n" "Each description is a newline-separated vector with the following elements:\n" "- Minimum number of arguments.\n" @@ -2776,7 +2776,7 @@ DefineEngineMethod( SimObject, dump, void, ( bool detailed ), ( false ), //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, save, bool, ( const char* fileName, bool selectedOnly, const char* preAppendString ), ( false, "" ), +DefineEngineMethod( SimObject, save, bool, ( const char* fileName, bool selectedOnly, const char* preAppendString ), ( false, "" ), "Save out the object to the given file.\n" "@param fileName The name of the file to save to." "@param selectedOnly If true, only objects marked as selected will be saved out.\n" @@ -2808,7 +2808,7 @@ DefineEngineMethod( SimObject, getName, const char*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getClassName, const char*, (),, +DefineEngineMethod( SimObject, getClassName, const char*, (),, "Get the name of the C++ class which the object is an instance of.\n" "@return The name of the C++ class of the object." ) { @@ -2818,7 +2818,7 @@ DefineConsoleMethod( SimObject, getClassName, const char*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, isField, bool, ( const char* fieldName ),, +DefineEngineMethod( SimObject, isField, bool, ( const char* fieldName ),, "Test whether the given field is defined on this object.\n" "@param fieldName The name of the field.\n" "@return True if the object implements the given field." ) @@ -2828,7 +2828,7 @@ DefineConsoleMethod( SimObject, isField, bool, ( const char* fieldName ),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getFieldValue, const char*, ( const char* fieldName, S32 index ), ( -1 ), +DefineEngineMethod( SimObject, getFieldValue, const char*, ( const char* fieldName, S32 index ), ( -1 ), "Return the value of the given field on this object.\n" "@param fieldName The name of the field. If it includes a field index, the index is parsed out.\n" "@param index Optional parameter to specify the index of an array field separately.\n" @@ -2872,7 +2872,7 @@ DefineConsoleMethod( SimObject, getFieldValue, const char*, ( const char* fieldN //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, setFieldValue, bool, ( const char* fieldName, const char* value, S32 index ), ( -1 ), +DefineEngineMethod( SimObject, setFieldValue, bool, ( const char* fieldName, const char* value, S32 index ), ( -1 ), "Set the value of the given field on this object.\n" "@param fieldName The name of the field to assign to. If it includes an array index, the index will be parsed out.\n" "@param value The new value to assign to the field.\n" @@ -2919,7 +2919,7 @@ DefineConsoleMethod( SimObject, setFieldValue, bool, ( const char* fieldName, co //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getFieldType, const char*, ( const char* fieldName ),, +DefineEngineMethod( SimObject, getFieldType, const char*, ( const char* fieldName ),, "Get the console type code of the given field.\n" "@return The numeric type code for the underlying console type of the given field." ) { @@ -2934,7 +2934,7 @@ DefineConsoleMethod( SimObject, getFieldType, const char*, ( const char* fieldNa //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, setFieldType, void, ( const char* fieldName, const char* type ),, +DefineEngineMethod( SimObject, setFieldType, void, ( const char* fieldName, const char* type ),, "Set the console type code for the given field.\n" "@param fieldName The name of the dynamic field to change to type for.\n" "@param type The name of the console type.\n" @@ -2974,7 +2974,7 @@ DefineEngineMethod( SimObject, getInternalName, const char*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, dumpClassHierarchy, void, (),, +DefineEngineMethod( SimObject, dumpClassHierarchy, void, (),, "Dump the native C++ class hierarchy of this object's C++ class to the console." ) { object->dumpClassHierarchy(); @@ -2982,7 +2982,7 @@ DefineConsoleMethod( SimObject, dumpClassHierarchy, void, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, isMemberOfClass, bool, ( const char* className ),, +DefineEngineMethod( SimObject, isMemberOfClass, bool, ( const char* className ),, "Test whether this object is a member of the specified class.\n" "@param className Name of a native C++ class.\n" "@return True if this object is an instance of the given C++ class or any of its super classes." ) @@ -3004,7 +3004,7 @@ DefineConsoleMethod( SimObject, isMemberOfClass, bool, ( const char* className ) //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, isInNamespaceHierarchy, bool, ( const char* name ),, +DefineEngineMethod( SimObject, isInNamespaceHierarchy, bool, ( const char* name ),, "Test whether the namespace of this object is a direct or indirect child to the given namespace.\n" "@param name The name of a namespace.\n" "@return True if the given namespace name is within the namespace hierarchy of this object." ) @@ -3039,7 +3039,7 @@ DefineEngineMethod( SimObject, getGroup, SimGroup*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, delete, void, (),, +DefineEngineMethod( SimObject, delete, void, (),, "Delete and remove the object." ) { object->deleteObject(); @@ -3067,7 +3067,7 @@ ConsoleMethod( SimObject,schedule, S32, 4, 0, "( float time, string method, stri //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getDynamicFieldCount, S32, (),, +DefineEngineMethod( SimObject, getDynamicFieldCount, S32, (),, "Get the number of dynamic fields defined on the object.\n" "@return The number of dynamic fields defined on the object." ) { @@ -3081,7 +3081,7 @@ DefineConsoleMethod( SimObject, getDynamicFieldCount, S32, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getDynamicField, const char*, ( S32 index ),, +DefineEngineMethod( SimObject, getDynamicField, const char*, ( S32 index ),, "Get a value of a dynamic field by index.\n" "@param index The index of the dynamic field.\n" "@return The value of the dynamic field at the given index or \"\"." ) @@ -3113,7 +3113,7 @@ DefineConsoleMethod( SimObject, getDynamicField, const char*, ( S32 index ),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getFieldCount, S32, (),, +DefineEngineMethod( SimObject, getFieldCount, S32, (),, "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object." ) { @@ -3135,7 +3135,7 @@ DefineConsoleMethod( SimObject, getFieldCount, S32, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimObject, getField, const char*, ( S32 index ),, +DefineEngineMethod( SimObject, getField, const char*, ( S32 index ),, "Retrieve the value of a static field by index.\n" "@param index The index of the static field.\n" "@return The value of the static field with the given index or \"\"." ) diff --git a/Engine/source/console/simPersistSet.cpp b/Engine/source/console/simPersistSet.cpp index 2dea6416e..00840c649 100644 --- a/Engine/source/console/simPersistSet.cpp +++ b/Engine/source/console/simPersistSet.cpp @@ -187,7 +187,7 @@ void SimPersistSet::addObject( SimObject* object ) //----------------------------------------------------------------------------- -DefineConsoleMethod( SimPersistSet, resolvePersistentIds, void, (), , "() - Try to bind unresolved persistent IDs in the set." ) +DefineEngineMethod( SimPersistSet, resolvePersistentIds, void, (), , "() - Try to bind unresolved persistent IDs in the set." ) { object->resolvePIDs(); } diff --git a/Engine/source/console/simSet.cpp b/Engine/source/console/simSet.cpp index c44b09c36..545c411b7 100644 --- a/Engine/source/console/simSet.cpp +++ b/Engine/source/console/simSet.cpp @@ -954,7 +954,7 @@ DefineEngineMethod( SimSet, clear, void, (),, //----------------------------------------------------------------------------- //UNSAFE; don't want this in the new API -DefineConsoleMethod( SimSet, deleteAllObjects, void, (), , "() Delete all objects in the set." ) +DefineEngineMethod( SimSet, deleteAllObjects, void, (), , "() Delete all objects in the set." ) { object->deleteAllObjects(); } @@ -1026,7 +1026,7 @@ DEFINE_CALLIN( fnSimSet_getCountRecursive, getCountRecursive, SimSet, U32, ( Sim return set->sizeRecursive(); } -DefineConsoleMethod( SimSet, getFullCount, S32, (), , "() Get the number of direct and indirect child objects contained in the set.\n" +DefineEngineMethod( SimSet, getFullCount, S32, (), , "() Get the number of direct and indirect child objects contained in the set.\n" "@return The number of objects contained in the set as well as in other sets contained directly or indirectly in the set." ) { return object->sizeRecursive(); @@ -1122,7 +1122,7 @@ DefineEngineMethod( SimSet, pushToBack, void, ( SimObject* obj ),, //----------------------------------------------------------------------------- -DefineConsoleMethod( SimSet, sort, void, ( const char * callbackFunction ), , "( string callbackFunction ) Sort the objects in the set using the given comparison function.\n" +DefineEngineMethod( SimSet, sort, void, ( const char * callbackFunction ), , "( string callbackFunction ) Sort the objects in the set using the given comparison function.\n" "@param callbackFunction Name of a function that takes two object arguments A and B and returns -1 if A is less, 1 if B is less, and 0 if both are equal." ) { object->scriptSort( callbackFunction ); diff --git a/Engine/source/core/fileObject.cpp b/Engine/source/core/fileObject.cpp index e872d7838..c0f9b17ae 100644 --- a/Engine/source/core/fileObject.cpp +++ b/Engine/source/core/fileObject.cpp @@ -484,7 +484,7 @@ static ConsoleDocFragment _FileObjectwriteObject2( "FileObject", "void writeObject( SimObject* object, string prepend);"); -DefineConsoleMethod( FileObject, writeObject, void, (const char * simName, const char * objName), (""), "FileObject.writeObject(SimObject, object prepend)" +DefineEngineMethod( FileObject, writeObject, void, (const char * simName, const char * objName), (""), "FileObject.writeObject(SimObject, object prepend)" "@hide") { SimObject* obj = Sim::findObject( simName ); diff --git a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp index e1a612b00..23b79e904 100644 --- a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp @@ -1185,67 +1185,67 @@ void GuiMeshRoadEditorCtrl::matchTerrainToRoad() // with the terrain underneath it. } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, deleteNode, void, (), , "deleteNode()" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, deleteNode, void, (), , "deleteNode()" ) { object->deleteSelectedNode(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, getMode, const char*, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, getMode, const char*, (), , "" ) { return object->getMode(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, setMode, void, (const char * mode), , "setMode( String mode )" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, setMode, void, (const char * mode), , "setMode( String mode )" ) { String newMode = ( mode ); object->setMode( newMode ); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeWidth, F32, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, getNodeWidth, F32, (), , "" ) { return object->getNodeWidth(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeWidth, void, ( F32 width ), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, setNodeWidth, void, ( F32 width ), , "" ) { object->setNodeWidth( width ); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeDepth, F32, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, getNodeDepth, F32, (), , "" ) { return object->getNodeDepth(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" ) { object->setNodeDepth( depth ); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodePosition, Point3F, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, getNodePosition, Point3F, (), , "" ) { return object->getNodePosition(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, (Point3F pos), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, setNodePosition, void, (Point3F pos), , "" ) { object->setNodePosition( pos ); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, getNodeNormal, Point3F, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, getNodeNormal, Point3F, (), , "" ) { return object->getNodeNormal(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, setNodeNormal, void, (Point3F normal), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, setNodeNormal, void, (Point3F normal), , "" ) { object->setNodeNormal( normal ); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, setSelectedRoad, void, (const char * objName), (""), "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, setSelectedRoad, void, (const char * objName), (""), "" ) { if ( String::isEmpty(objName) ) object->setSelectedRoad(NULL); @@ -1257,7 +1257,7 @@ DefineConsoleMethod( GuiMeshRoadEditorCtrl, setSelectedRoad, void, (const char * } } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) { MeshRoad *road = object->getSelectedRoad(); if ( !road ) @@ -1266,14 +1266,14 @@ DefineConsoleMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) return road->getId(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, regenerate, void, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, regenerate, void, (), , "" ) { MeshRoad *road = object->getSelectedRoad(); if ( road ) road->regenerate(); } -DefineConsoleMethod( GuiMeshRoadEditorCtrl, matchTerrainToRoad, void, (), , "" ) +DefineEngineMethod( GuiMeshRoadEditorCtrl, matchTerrainToRoad, void, (), , "" ) { object->matchTerrainToRoad(); } diff --git a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp index 01ab745a8..1b2dd02d3 100644 --- a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp @@ -1393,66 +1393,66 @@ void GuiRiverEditorCtrl::_renderSelectedRiver( ObjectRenderInst *ri, SceneRender } } -DefineConsoleMethod( GuiRiverEditorCtrl, deleteNode, void, (), , "deleteNode()" ) +DefineEngineMethod( GuiRiverEditorCtrl, deleteNode, void, (), , "deleteNode()" ) { object->deleteSelectedNode(); } -DefineConsoleMethod( GuiRiverEditorCtrl, getMode, const char*, (), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, getMode, const char*, (), , "" ) { return object->getMode(); } -DefineConsoleMethod( GuiRiverEditorCtrl, setMode, void, ( const char * mode ), , "setMode( String mode )" ) +DefineEngineMethod( GuiRiverEditorCtrl, setMode, void, ( const char * mode ), , "setMode( String mode )" ) { String newMode = ( mode ); object->setMode( newMode ); } -DefineConsoleMethod( GuiRiverEditorCtrl, getNodeWidth, F32, (), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, getNodeWidth, F32, (), , "" ) { return object->getNodeWidth(); } -DefineConsoleMethod( GuiRiverEditorCtrl, setNodeWidth, void, ( F32 width ), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, setNodeWidth, void, ( F32 width ), , "" ) { object->setNodeWidth( width ); } -DefineConsoleMethod( GuiRiverEditorCtrl, getNodeDepth, F32, (), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, getNodeDepth, F32, (), , "" ) { return object->getNodeDepth(); } -DefineConsoleMethod( GuiRiverEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, setNodeDepth, void, ( F32 depth ), , "" ) { object->setNodeDepth( depth ); } -DefineConsoleMethod( GuiRiverEditorCtrl, getNodePosition, Point3F, (), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, getNodePosition, Point3F, (), , "" ) { return object->getNodePosition(); } -DefineConsoleMethod( GuiRiverEditorCtrl, setNodePosition, void, (Point3F pos), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, setNodePosition, void, (Point3F pos), , "" ) { object->setNodePosition( pos ); } -DefineConsoleMethod( GuiRiverEditorCtrl, getNodeNormal, Point3F, (), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, getNodeNormal, Point3F, (), , "" ) { return object->getNodeNormal(); } -DefineConsoleMethod( GuiRiverEditorCtrl, setNodeNormal, void, (Point3F normal), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, setNodeNormal, void, (Point3F normal), , "" ) { object->setNodeNormal( normal ); } -DefineConsoleMethod( GuiRiverEditorCtrl, setSelectedRiver, void, (const char * objName), (""), "" ) +DefineEngineMethod( GuiRiverEditorCtrl, setSelectedRiver, void, (const char * objName), (""), "" ) { if (dStrcmp( objName,"" )==0) object->setSelectedRiver(NULL); @@ -1464,7 +1464,7 @@ DefineConsoleMethod( GuiRiverEditorCtrl, setSelectedRiver, void, (const char * o } } -DefineConsoleMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" ) { River *river = object->getSelectedRiver(); if ( !river ) @@ -1473,7 +1473,7 @@ DefineConsoleMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" ) return river->getId(); } -DefineConsoleMethod( GuiRiverEditorCtrl, regenerate, void, (), , "" ) +DefineEngineMethod( GuiRiverEditorCtrl, regenerate, void, (), , "" ) { River *river = object->getSelectedRiver(); if ( river ) diff --git a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp index 167a5db45..7a2ec8a96 100644 --- a/Engine/source/environment/editors/guiRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRoadEditorCtrl.cpp @@ -1037,45 +1037,45 @@ void GuiRoadEditorCtrl::submitUndo( const UTF8 *name ) undoMan->addAction( action ); } -DefineConsoleMethod( GuiRoadEditorCtrl, deleteNode, void, (), , "deleteNode()" ) +DefineEngineMethod( GuiRoadEditorCtrl, deleteNode, void, (), , "deleteNode()" ) { object->deleteSelectedNode(); } -DefineConsoleMethod( GuiRoadEditorCtrl, getMode, const char*, (), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, getMode, const char*, (), , "" ) { return object->getMode(); } -DefineConsoleMethod( GuiRoadEditorCtrl, setMode, void, ( const char * mode ), , "setMode( String mode )" ) +DefineEngineMethod( GuiRoadEditorCtrl, setMode, void, ( const char * mode ), , "setMode( String mode )" ) { String newMode = ( mode ); object->setMode( newMode ); } -DefineConsoleMethod( GuiRoadEditorCtrl, getNodeWidth, F32, (), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, getNodeWidth, F32, (), , "" ) { return object->getNodeWidth(); } -DefineConsoleMethod( GuiRoadEditorCtrl, setNodeWidth, void, ( F32 width ), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, setNodeWidth, void, ( F32 width ), , "" ) { object->setNodeWidth( width ); } -DefineConsoleMethod( GuiRoadEditorCtrl, getNodePosition, Point3F, (), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, getNodePosition, Point3F, (), , "" ) { return object->getNodePosition(); } -DefineConsoleMethod( GuiRoadEditorCtrl, setNodePosition, void, ( Point3F pos ), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, setNodePosition, void, ( Point3F pos ), , "" ) { object->setNodePosition( pos ); } -DefineConsoleMethod( GuiRoadEditorCtrl, setSelectedRoad, void, ( const char * pathRoad ), (""), "" ) +DefineEngineMethod( GuiRoadEditorCtrl, setSelectedRoad, void, ( const char * pathRoad ), (""), "" ) { if (dStrcmp( pathRoad,"")==0 ) object->setSelectedRoad(NULL); @@ -1087,7 +1087,7 @@ DefineConsoleMethod( GuiRoadEditorCtrl, setSelectedRoad, void, ( const char * pa } } -DefineConsoleMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) { DecalRoad *road = object->getSelectedRoad(); if ( road ) @@ -1096,12 +1096,12 @@ DefineConsoleMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" ) return NULL; } -DefineConsoleMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" ) { return object->getSelectedNode(); } -DefineConsoleMethod( GuiRoadEditorCtrl, deleteRoad, void, (), , "" ) +DefineEngineMethod( GuiRoadEditorCtrl, deleteRoad, void, (), , "" ) { object->deleteSelectedRoad(); } diff --git a/Engine/source/environment/skyBox.cpp b/Engine/source/environment/skyBox.cpp index daadcf885..8aca8d266 100644 --- a/Engine/source/environment/skyBox.cpp +++ b/Engine/source/environment/skyBox.cpp @@ -640,7 +640,7 @@ BaseMatInstance* SkyBox::_getMaterialInstance() return mMatInstance; } -DefineConsoleMethod( SkyBox, postApply, void, (), , "") +DefineEngineMethod( SkyBox, postApply, void, (), , "") { object->inspectPostApply(); } \ No newline at end of file diff --git a/Engine/source/environment/sun.cpp b/Engine/source/environment/sun.cpp index d83d7078b..7063e1a27 100644 --- a/Engine/source/environment/sun.cpp +++ b/Engine/source/environment/sun.cpp @@ -558,12 +558,12 @@ void Sun::_onUnselected() Parent::_onUnselected(); } -DefineConsoleMethod(Sun, apply, void, (), , "") +DefineEngineMethod(Sun, apply, void, (), , "") { object->inspectPostApply(); } -DefineConsoleMethod(Sun, animate, void, ( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation ), , "animate( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation )") +DefineEngineMethod(Sun, animate, void, ( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation ), , "animate( F32 duration, F32 startAzimuth, F32 endAzimuth, F32 startElevation, F32 endElevation )") { object->animate(duration, startAzimuth, endAzimuth, startElevation, endElevation); diff --git a/Engine/source/forest/editor/forestBrushElement.cpp b/Engine/source/forest/editor/forestBrushElement.cpp index f61834c9e..bbee91e5a 100644 --- a/Engine/source/forest/editor/forestBrushElement.cpp +++ b/Engine/source/forest/editor/forestBrushElement.cpp @@ -187,7 +187,7 @@ bool ForestBrush::containsItemData( const ForestItemData *inData ) return false; } -DefineConsoleMethod( ForestBrush, containsItemData, bool, ( const char * obj ), , "( ForestItemData obj )" ) +DefineEngineMethod( ForestBrush, containsItemData, bool, ( const char * obj ), , "( ForestItemData obj )" ) { ForestItemData *data = NULL; if ( !Sim::findObject( obj, data ) ) diff --git a/Engine/source/forest/editor/forestBrushTool.cpp b/Engine/source/forest/editor/forestBrushTool.cpp index ae71951b5..d0d64d517 100644 --- a/Engine/source/forest/editor/forestBrushTool.cpp +++ b/Engine/source/forest/editor/forestBrushTool.cpp @@ -682,7 +682,7 @@ bool ForestBrushTool::getGroundAt( const Point3F &worldPt, F32 *zValueOut, Vecto return true; } -DefineConsoleMethod( ForestBrushTool, collectElements, void, (), , "" ) +DefineEngineMethod( ForestBrushTool, collectElements, void, (), , "" ) { object->collectElements(); } \ No newline at end of file diff --git a/Engine/source/forest/editor/forestEditorCtrl.cpp b/Engine/source/forest/editor/forestEditorCtrl.cpp index d8b54ba9c..db8a58f3c 100644 --- a/Engine/source/forest/editor/forestEditorCtrl.cpp +++ b/Engine/source/forest/editor/forestEditorCtrl.cpp @@ -370,24 +370,24 @@ bool ForestEditorCtrl::isDirty() return foundDirty; } -DefineConsoleMethod( ForestEditorCtrl, updateActiveForest, void, (), , "()" ) +DefineEngineMethod( ForestEditorCtrl, updateActiveForest, void, (), , "()" ) { object->updateActiveForest( true ); } -DefineConsoleMethod( ForestEditorCtrl, setActiveTool, void, ( const char * toolName ), , "( ForestTool tool )" ) +DefineEngineMethod( ForestEditorCtrl, setActiveTool, void, ( const char * toolName ), , "( ForestTool tool )" ) { ForestTool *tool = dynamic_cast( Sim::findObject( toolName ) ); object->setActiveTool( tool ); } -DefineConsoleMethod( ForestEditorCtrl, getActiveTool, S32, (), , "()" ) +DefineEngineMethod( ForestEditorCtrl, getActiveTool, S32, (), , "()" ) { ForestTool *tool = object->getActiveTool(); return tool ? tool->getId() : 0; } -DefineConsoleMethod( ForestEditorCtrl, deleteMeshSafe, void, ( const char * obj ), , "( ForestItemData obj )" ) +DefineEngineMethod( ForestEditorCtrl, deleteMeshSafe, void, ( const char * obj ), , "( ForestItemData obj )" ) { ForestItemData *db; if ( !Sim::findObject( obj, db ) ) @@ -396,12 +396,12 @@ DefineConsoleMethod( ForestEditorCtrl, deleteMeshSafe, void, ( const char * obj object->deleteMeshSafe( db ); } -DefineConsoleMethod( ForestEditorCtrl, isDirty, bool, (), , "" ) +DefineEngineMethod( ForestEditorCtrl, isDirty, bool, (), , "" ) { return object->isDirty(); } -DefineConsoleMethod(ForestEditorCtrl, setActiveForest, void, (const char * obj), , "( Forest obj )") +DefineEngineMethod(ForestEditorCtrl, setActiveForest, void, (const char * obj), , "( Forest obj )") { Forest *forestObject; if (!Sim::findObject(obj, forestObject)) diff --git a/Engine/source/forest/editor/forestSelectionTool.cpp b/Engine/source/forest/editor/forestSelectionTool.cpp index a453f4e99..f6689c9b8 100644 --- a/Engine/source/forest/editor/forestSelectionTool.cpp +++ b/Engine/source/forest/editor/forestSelectionTool.cpp @@ -563,32 +563,32 @@ void ForestSelectionTool::onUndoAction() mBounds.intersect( mSelection[i].getWorldBox() ); } -DefineConsoleMethod( ForestSelectionTool, getSelectionCount, S32, (), , "" ) +DefineEngineMethod( ForestSelectionTool, getSelectionCount, S32, (), , "" ) { return object->getSelectionCount(); } -DefineConsoleMethod( ForestSelectionTool, deleteSelection, void, (), , "" ) +DefineEngineMethod( ForestSelectionTool, deleteSelection, void, (), , "" ) { object->deleteSelection(); } -DefineConsoleMethod( ForestSelectionTool, clearSelection, void, (), , "" ) +DefineEngineMethod( ForestSelectionTool, clearSelection, void, (), , "" ) { object->clearSelection(); } -DefineConsoleMethod( ForestSelectionTool, cutSelection, void, (), , "" ) +DefineEngineMethod( ForestSelectionTool, cutSelection, void, (), , "" ) { object->cutSelection(); } -DefineConsoleMethod( ForestSelectionTool, copySelection, void, (), , "" ) +DefineEngineMethod( ForestSelectionTool, copySelection, void, (), , "" ) { object->copySelection(); } -DefineConsoleMethod( ForestSelectionTool, pasteSelection, void, (), , "" ) +DefineEngineMethod( ForestSelectionTool, pasteSelection, void, (), , "" ) { object->pasteSelection(); } diff --git a/Engine/source/forest/forest.cpp b/Engine/source/forest/forest.cpp index e6b2fd8bd..985f34151 100644 --- a/Engine/source/forest/forest.cpp +++ b/Engine/source/forest/forest.cpp @@ -361,22 +361,22 @@ void Forest::saveDataFile( const char *path ) mData->write( mDataFileName ); } -DefineConsoleMethod( Forest, saveDataFile, void, (const char * path), (""), "saveDataFile( [path] )" ) +DefineEngineMethod( Forest, saveDataFile, void, (const char * path), (""), "saveDataFile( [path] )" ) { object->saveDataFile( path ); } -DefineConsoleMethod(Forest, isDirty, bool, (), , "()") +DefineEngineMethod(Forest, isDirty, bool, (), , "()") { return object->getData() && object->getData()->isDirty(); } -DefineConsoleMethod(Forest, regenCells, void, (), , "()") +DefineEngineMethod(Forest, regenCells, void, (), , "()") { object->getData()->regenCells(); } -DefineConsoleMethod(Forest, clear, void, (), , "()" ) +DefineEngineMethod(Forest, clear, void, (), , "()" ) { object->clear(); } diff --git a/Engine/source/gfx/video/theoraTextureObject.cpp b/Engine/source/gfx/video/theoraTextureObject.cpp index 13e73402b..e83314870 100644 --- a/Engine/source/gfx/video/theoraTextureObject.cpp +++ b/Engine/source/gfx/video/theoraTextureObject.cpp @@ -191,7 +191,7 @@ void TheoraTextureObject::play() //----------------------------------------------------------------------------- -DefineConsoleMethod( TheoraTextureObject, play, void, (),, +DefineEngineMethod( TheoraTextureObject, play, void, (),, "Start playback of the video." ) { object->play(); @@ -199,7 +199,7 @@ DefineConsoleMethod( TheoraTextureObject, play, void, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( TheoraTextureObject, stop, void, (),, +DefineEngineMethod( TheoraTextureObject, stop, void, (),, "Stop playback of the video." ) { object->stop(); @@ -207,7 +207,7 @@ DefineConsoleMethod( TheoraTextureObject, stop, void, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( TheoraTextureObject, pause, void, (),, +DefineEngineMethod( TheoraTextureObject, pause, void, (),, "Pause playback of the video." ) { object->pause(); diff --git a/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp b/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp index fb2b9a5f9..c3e7cf8a2 100644 --- a/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiToolboxButtonCtrl.cpp @@ -92,17 +92,17 @@ void GuiToolboxButtonCtrl::onSleep() //------------------------------------- -DefineConsoleMethod( GuiToolboxButtonCtrl, setNormalBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is active") +DefineEngineMethod( GuiToolboxButtonCtrl, setNormalBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is active") { object->setNormalBitmap(name); } -DefineConsoleMethod( GuiToolboxButtonCtrl, setLoweredBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled") +DefineEngineMethod( GuiToolboxButtonCtrl, setLoweredBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled") { object->setLoweredBitmap(name); } -DefineConsoleMethod( GuiToolboxButtonCtrl, setHoverBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled") +DefineEngineMethod( GuiToolboxButtonCtrl, setHoverBitmap, void, ( const char * name ), , "( filepath name ) sets the bitmap that shows when the button is disabled") { object->setHoverBitmap(name); } diff --git a/Engine/source/gui/controls/guiBitmapCtrl.cpp b/Engine/source/gui/controls/guiBitmapCtrl.cpp index 769445dc3..855b78900 100644 --- a/Engine/source/gui/controls/guiBitmapCtrl.cpp +++ b/Engine/source/gui/controls/guiBitmapCtrl.cpp @@ -261,7 +261,7 @@ static ConsoleDocFragment _sGuiBitmapCtrlSetBitmap2( //"Set the bitmap displayed in the control. Note that it is limited in size, to 256x256." -DefineConsoleMethod( GuiBitmapCtrl, setBitmap, void, ( const char * fileRoot, bool resize), ( false), +DefineEngineMethod( GuiBitmapCtrl, setBitmap, void, ( const char * fileRoot, bool resize), ( false), "( String filename | String filename, bool resize ) Assign an image to the control.\n\n" "@hide" ) { diff --git a/Engine/source/gui/controls/guiColorPicker.cpp b/Engine/source/gui/controls/guiColorPicker.cpp index 98f9620b3..d0e3034b6 100644 --- a/Engine/source/gui/controls/guiColorPicker.cpp +++ b/Engine/source/gui/controls/guiColorPicker.cpp @@ -658,17 +658,17 @@ void GuiColorPickerCtrl::setScriptValue(const char *value) setValue(newValue); } -DefineConsoleMethod(GuiColorPickerCtrl, getSelectorPos, Point2I, (), , "Gets the current position of the selector") +DefineEngineMethod(GuiColorPickerCtrl, getSelectorPos, Point2I, (), , "Gets the current position of the selector") { return object->getSelectorPos(); } -DefineConsoleMethod(GuiColorPickerCtrl, setSelectorPos, void, (Point2I newPos), , "Sets the current position of the selector") +DefineEngineMethod(GuiColorPickerCtrl, setSelectorPos, void, (Point2I newPos), , "Sets the current position of the selector") { object->setSelectorPos(newPos); } -DefineConsoleMethod(GuiColorPickerCtrl, updateColor, void, (), , "Forces update of pick color") +DefineEngineMethod(GuiColorPickerCtrl, updateColor, void, (), , "Forces update of pick color") { object->updateColor(); } diff --git a/Engine/source/gui/controls/guiFileTreeCtrl.cpp b/Engine/source/gui/controls/guiFileTreeCtrl.cpp index b6531fbaa..8513fb82b 100644 --- a/Engine/source/gui/controls/guiFileTreeCtrl.cpp +++ b/Engine/source/gui/controls/guiFileTreeCtrl.cpp @@ -379,18 +379,18 @@ void GuiFileTreeCtrl::recurseInsert( Item* parent, StringTableEntry path ) } -DefineConsoleMethod( GuiFileTreeCtrl, getSelectedPath, const char*, (), , "getSelectedPath() - returns the currently selected path in the tree") +DefineEngineMethod( GuiFileTreeCtrl, getSelectedPath, const char*, (), , "getSelectedPath() - returns the currently selected path in the tree") { const String& path = object->getSelectedPath(); return Con::getStringArg( path ); } -DefineConsoleMethod( GuiFileTreeCtrl, setSelectedPath, bool, (const char * path), , "setSelectedPath(path) - expands the tree to the specified path") +DefineEngineMethod( GuiFileTreeCtrl, setSelectedPath, bool, (const char * path), , "setSelectedPath(path) - expands the tree to the specified path") { return object->setSelectedPath( path ); } -DefineConsoleMethod( GuiFileTreeCtrl, reload, void, (), , "() - Reread the directory tree hierarchy." ) +DefineEngineMethod( GuiFileTreeCtrl, reload, void, (), , "() - Reread the directory tree hierarchy." ) { object->updateTree(); } diff --git a/Engine/source/gui/controls/guiGradientCtrl.cpp b/Engine/source/gui/controls/guiGradientCtrl.cpp index 20454b73d..112f3859d 100644 --- a/Engine/source/gui/controls/guiGradientCtrl.cpp +++ b/Engine/source/gui/controls/guiGradientCtrl.cpp @@ -601,7 +601,7 @@ void GuiGradientCtrl::sortColorRange() dQsort( mAlphaRange.address(), mAlphaRange.size(), sizeof(ColorRange), _numIncreasing); } -DefineConsoleMethod(GuiGradientCtrl, getColorCount, S32, (), , "Get color count") +DefineEngineMethod(GuiGradientCtrl, getColorCount, S32, (), , "Get color count") { if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange ) return object->mColorRange.size(); @@ -611,7 +611,7 @@ DefineConsoleMethod(GuiGradientCtrl, getColorCount, S32, (), , "Get color count" return 0; } -DefineConsoleMethod(GuiGradientCtrl, getColor, LinearColorF, (S32 idx), , "Get color value") +DefineEngineMethod(GuiGradientCtrl, getColor, LinearColorF, (S32 idx), , "Get color value") { if( object->getDisplayMode() == GuiGradientCtrl::pHorizColorRange ) diff --git a/Engine/source/gui/controls/guiMaterialCtrl.cpp b/Engine/source/gui/controls/guiMaterialCtrl.cpp index edfb12e76..d6e5cf833 100644 --- a/Engine/source/gui/controls/guiMaterialCtrl.cpp +++ b/Engine/source/gui/controls/guiMaterialCtrl.cpp @@ -167,7 +167,7 @@ void GuiMaterialCtrl::onRender( Point2I offset, const RectI &updateRect ) GFX->setTexture( 0, NULL ); } -DefineConsoleMethod( GuiMaterialCtrl, setMaterial, bool, ( const char * materialName ), , "( string materialName )" +DefineEngineMethod( GuiMaterialCtrl, setMaterial, bool, ( const char * materialName ), , "( string materialName )" "Set the material to be displayed in the control." ) { return object->setMaterial( materialName ); diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index 0697c6a36..88eb5c59f 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -300,82 +300,82 @@ void GuiPopUpMenuCtrl::initPersistFields(void) } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrl, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)") +DefineEngineMethod( GuiPopUpMenuCtrl, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)") { object->addEntry(name, idNum, scheme); } -DefineConsoleMethod( GuiPopUpMenuCtrl, addScheme, void, (U32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL), , +DefineEngineMethod( GuiPopUpMenuCtrl, addScheme, void, (U32 id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL), , "(int id, ColorI fontColor, ColorI fontColorHL, ColorI fontColorSEL)") { object->addScheme( id, fontColor, fontColorHL, fontColorSEL ); } -DefineConsoleMethod( GuiPopUpMenuCtrl, getText, const char*, (), , "") +DefineEngineMethod( GuiPopUpMenuCtrl, getText, const char*, (), , "") { return object->getText(); } -DefineConsoleMethod( GuiPopUpMenuCtrl, clear, void, (), , "Clear the popup list.") +DefineEngineMethod( GuiPopUpMenuCtrl, clear, void, (), , "Clear the popup list.") { object->clear(); } //FIXME: clashes with SimSet.sort -DefineConsoleMethod(GuiPopUpMenuCtrl, sort, void, (), , "Sort the list alphabetically.") +DefineEngineMethod(GuiPopUpMenuCtrl, sort, void, (), , "Sort the list alphabetically.") { object->sort(); } // Added to sort the entries by ID -DefineConsoleMethod(GuiPopUpMenuCtrl, sortID, void, (), , "Sort the list by ID.") +DefineEngineMethod(GuiPopUpMenuCtrl, sortID, void, (), , "Sort the list by ID.") { object->sortID(); } -DefineConsoleMethod( GuiPopUpMenuCtrl, forceOnAction, void, (), , "") +DefineEngineMethod( GuiPopUpMenuCtrl, forceOnAction, void, (), , "") { object->onAction(); } -DefineConsoleMethod( GuiPopUpMenuCtrl, forceClose, void, (), , "") +DefineEngineMethod( GuiPopUpMenuCtrl, forceClose, void, (), , "") { object->closePopUp(); } -DefineConsoleMethod( GuiPopUpMenuCtrl, getSelected, S32, (), , "Gets the selected index") +DefineEngineMethod( GuiPopUpMenuCtrl, getSelected, S32, (), , "Gets the selected index") { return object->getSelected(); } -DefineConsoleMethod( GuiPopUpMenuCtrl, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])") +DefineEngineMethod( GuiPopUpMenuCtrl, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])") { object->setSelected( id, scriptCallback ); } -DefineConsoleMethod( GuiPopUpMenuCtrl, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])") +DefineEngineMethod( GuiPopUpMenuCtrl, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])") { object->setFirstSelected( scriptCallback ); } -DefineConsoleMethod( GuiPopUpMenuCtrl, setNoneSelected, void, (), , "") +DefineEngineMethod( GuiPopUpMenuCtrl, setNoneSelected, void, (), , "") { object->setNoneSelected(); } -DefineConsoleMethod( GuiPopUpMenuCtrl, getTextById, const char*, (S32 id), , "(int id)") +DefineEngineMethod( GuiPopUpMenuCtrl, getTextById, const char*, (S32 id), , "(int id)") { return(object->getTextById(id)); } -DefineConsoleMethod( GuiPopUpMenuCtrl, changeTextById, void, ( S32 id, const char * text ), , "( int id, string text )" ) +DefineEngineMethod( GuiPopUpMenuCtrl, changeTextById, void, ( S32 id, const char * text ), , "( int id, string text )" ) { object->setEntryText( id, text ); } -DefineConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, (const char * className, const char * enumName), , "(string class, string enum)" +DefineEngineMethod( GuiPopUpMenuCtrl, setEnumContent, void, (const char * className, const char * enumName), , "(string class, string enum)" "This fills the popup with a classrep's field enumeration type info.\n\n" "More of a helper function than anything. If console access to the field list is added, " "at least for the enumerated types, then this should go away..") @@ -429,20 +429,20 @@ DefineConsoleMethod( GuiPopUpMenuCtrl, setEnumContent, void, (const char * class } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrl, findText, S32, (const char * text), , "(string text)" +DefineEngineMethod( GuiPopUpMenuCtrl, findText, S32, (const char * text), , "(string text)" "Returns the position of the first entry containing the specified text or -1 if not found.") { return( object->findText( text ) ); } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrl, size, S32, (), , "Get the size of the menu - the number of entries in it.") +DefineEngineMethod( GuiPopUpMenuCtrl, size, S32, (), , "Get the size of the menu - the number of entries in it.") { return( object->getNumEntries() ); } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrl, replaceText, void, (bool doReplaceText), , "(bool doReplaceText)") +DefineEngineMethod( GuiPopUpMenuCtrl, replaceText, void, (bool doReplaceText), , "(bool doReplaceText)") { object->replaceText(S32(doReplaceText)); } @@ -532,7 +532,7 @@ void GuiPopUpMenuCtrl::clearEntry( S32 entry ) } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrl, clearEntry, void, (S32 entry), , "(S32 entry)") +DefineEngineMethod( GuiPopUpMenuCtrl, clearEntry, void, (S32 entry), , "(S32 entry)") { object->clearEntry(entry); } diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 2c8f5342a..1a39c95af 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -364,7 +364,7 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExAdd( "void add(string name, S32 idNum, S32 scheme=0);" ); -DefineConsoleMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)") +DefineEngineMethod( GuiPopUpMenuCtrlEx, add, void, (const char * name, S32 idNum, U32 scheme), ("", -1, 0), "(string name, int idNum, int scheme=0)") { object->addEntry(name, idNum, scheme); } @@ -525,7 +525,7 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExsetSelected( "setSelected(int id, bool scriptCallback=true);" ); -DefineConsoleMethod( GuiPopUpMenuCtrlEx, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])" +DefineEngineMethod( GuiPopUpMenuCtrlEx, setSelected, void, (S32 id, bool scriptCallback), (true), "(int id, [scriptCallback=true])" "@hide") { object->setSelected( id, scriptCallback ); @@ -539,7 +539,7 @@ ConsoleDocFragment _GuiPopUpMenuCtrlExsetFirstSelected( ); -DefineConsoleMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])" +DefineEngineMethod( GuiPopUpMenuCtrlEx, setFirstSelected, void, (bool scriptCallback), (true), "([scriptCallback=true])" "@hide") { object->setFirstSelected( scriptCallback ); @@ -561,7 +561,7 @@ DefineEngineMethod( GuiPopUpMenuCtrlEx, getTextById, const char*, (S32 id),, } -DefineConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, ColorI, (S32 id), , +DefineEngineMethod( GuiPopUpMenuCtrlEx, getColorById, ColorI, (S32 id), , "@brief Get color of an entry's box\n\n" "@param id ID number of entry to query\n\n" "@return ColorI in the format of \"Red Green Blue Alpha\", each of with is a value between 0 - 255") @@ -572,7 +572,7 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, getColorById, ColorI, (S32 id), , } -DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * className, const char * enumName ), , +DefineEngineMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * className, const char * enumName ), , "@brief This fills the popup with a classrep's field enumeration type info.\n\n" "More of a helper function than anything. If console access to the field list is added, " "at least for the enumerated types, then this should go away.\n\n" @@ -628,7 +628,7 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, setEnumContent, void, ( const char * cl } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, (const char * text), , "(string text)" +DefineEngineMethod( GuiPopUpMenuCtrlEx, findText, S32, (const char * text), , "(string text)" "Returns the id of the first entry containing the specified text or -1 if not found." "@param text String value used for the query\n\n" "@return Numerical ID of entry containing the text.") @@ -637,7 +637,7 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, findText, S32, (const char * text), , " } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, (), , +DefineEngineMethod( GuiPopUpMenuCtrlEx, size, S32, (), , "@brief Get the size of the menu\n\n" "@return Number of entries in the menu\n") { @@ -645,7 +645,7 @@ DefineConsoleMethod( GuiPopUpMenuCtrlEx, size, S32, (), , } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrlEx, replaceText, void, (S32 boolVal), , +DefineEngineMethod( GuiPopUpMenuCtrlEx, replaceText, void, (S32 boolVal), , "@brief Flag that causes each new text addition to replace the current entry\n\n" "@param True to turn on replacing, false to disable it") { @@ -737,7 +737,7 @@ void GuiPopUpMenuCtrlEx::clearEntry( S32 entry ) } //------------------------------------------------------------------------------ -DefineConsoleMethod( GuiPopUpMenuCtrlEx, clearEntry, void, (S32 entry), , "(S32 entry)") +DefineEngineMethod( GuiPopUpMenuCtrlEx, clearEntry, void, (S32 entry), , "(S32 entry)") { object->clearEntry(entry); } diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index efb0674ea..885d157a0 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -2139,7 +2139,7 @@ ConsoleDocFragment _pushDialog( "void pushDialog( GuiControl ctrl, int layer=0, bool center=false);" ); -DefineConsoleMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)" +DefineEngineMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)" "@hide") { GuiControl *gui; @@ -2176,7 +2176,7 @@ ConsoleDocFragment _popDialog2( "void popDialog();" ); -DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType()), "(GuiControl ctrl=NULL)" +DefineEngineMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType()), "(GuiControl ctrl=NULL)" "@hide") { if (gui) @@ -2204,7 +2204,7 @@ ConsoleDocFragment _popLayer2( "void popLayer(S32 layer);" ); -DefineConsoleMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)" +DefineEngineMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)" "@hide") { @@ -2362,7 +2362,7 @@ ConsoleDocFragment _setCursorPos2( "bool setCursorPos( F32 posX, F32 posY);" ); -DefineConsoleMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)" +DefineEngineMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)" "@hide") { @@ -2647,7 +2647,7 @@ DefineEngineMethod( GuiCanvas, setWindowPosition, void, ( Point2I position ),, object->getPlatformWindow()->setPosition( position ); } -DefineConsoleMethod( GuiCanvas, isFullscreen, bool, (), , "() - Is this canvas currently fullscreen?" ) +DefineEngineMethod( GuiCanvas, isFullscreen, bool, (), , "() - Is this canvas currently fullscreen?" ) { if (Platform::getWebDeployment()) return false; @@ -2658,14 +2658,14 @@ DefineConsoleMethod( GuiCanvas, isFullscreen, bool, (), , "() - Is this canvas c return object->getPlatformWindow()->getVideoMode().fullScreen; } -DefineConsoleMethod( GuiCanvas, minimizeWindow, void, (), , "() - minimize this canvas' window." ) +DefineEngineMethod( GuiCanvas, minimizeWindow, void, (), , "() - minimize this canvas' window." ) { PlatformWindow* window = object->getPlatformWindow(); if ( window ) window->minimize(); } -DefineConsoleMethod( GuiCanvas, isMinimized, bool, (), , "()" ) +DefineEngineMethod( GuiCanvas, isMinimized, bool, (), , "()" ) { PlatformWindow* window = object->getPlatformWindow(); if ( window ) @@ -2674,7 +2674,7 @@ DefineConsoleMethod( GuiCanvas, isMinimized, bool, (), , "()" ) return false; } -DefineConsoleMethod( GuiCanvas, isMaximized, bool, (), , "()" ) +DefineEngineMethod( GuiCanvas, isMaximized, bool, (), , "()" ) { PlatformWindow* window = object->getPlatformWindow(); if ( window ) @@ -2683,21 +2683,21 @@ DefineConsoleMethod( GuiCanvas, isMaximized, bool, (), , "()" ) return false; } -DefineConsoleMethod( GuiCanvas, maximizeWindow, void, (), , "() - maximize this canvas' window." ) +DefineEngineMethod( GuiCanvas, maximizeWindow, void, (), , "() - maximize this canvas' window." ) { PlatformWindow* window = object->getPlatformWindow(); if ( window ) window->maximize(); } -DefineConsoleMethod( GuiCanvas, restoreWindow, void, (), , "() - restore this canvas' window." ) +DefineEngineMethod( GuiCanvas, restoreWindow, void, (), , "() - restore this canvas' window." ) { PlatformWindow* window = object->getPlatformWindow(); if( window ) window->restore(); } -DefineConsoleMethod( GuiCanvas, setFocus, void, (), , "() - Claim OS input focus for this canvas' window.") +DefineEngineMethod( GuiCanvas, setFocus, void, (), , "() - Claim OS input focus for this canvas' window.") { PlatformWindow* window = object->getPlatformWindow(); if( window ) @@ -2712,7 +2712,7 @@ DefineEngineMethod( GuiCanvas, setMenuBar, void, ( GuiControl* menu ),, return object->setMenuBar( menu ); } -DefineConsoleMethod( GuiCanvas, setVideoMode, void, +DefineEngineMethod( GuiCanvas, setVideoMode, void, (U32 width, U32 height, bool fullscreen, U32 bitDepth, U32 refreshRate, U32 antialiasLevel), ( false, 0, 0, 0), "(int width, int height, bool fullscreen, [int bitDepth], [int refreshRate], [int antialiasLevel] )\n" diff --git a/Engine/source/gui/core/guiControl.cpp b/Engine/source/gui/core/guiControl.cpp index 6fded2e92..5526c2cc6 100644 --- a/Engine/source/gui/core/guiControl.cpp +++ b/Engine/source/gui/core/guiControl.cpp @@ -2898,7 +2898,7 @@ static ConsoleDocFragment _sGuiControlSetExtent2( "GuiControl", // The class to place the method in; use NULL for functions. "void setExtent( Point2I p );" ); // The definition string. -DefineConsoleMethod( GuiControl, setExtent, void, ( const char* extOrX, const char* y ), (""), +DefineEngineMethod( GuiControl, setExtent, void, ( const char* extOrX, const char* y ), (""), "( Point2I p | int x, int y ) Set the width and height of the control.\n\n" "@hide" ) { diff --git a/Engine/source/gui/editor/guiDebugger.cpp b/Engine/source/gui/editor/guiDebugger.cpp index fb888538a..7c60d4359 100644 --- a/Engine/source/gui/editor/guiDebugger.cpp +++ b/Engine/source/gui/editor/guiDebugger.cpp @@ -66,13 +66,13 @@ DbgFileView::DbgFileView() mSize.set(1, 0); } -DefineConsoleMethod(DbgFileView, setCurrentLine, void, (S32 line, bool selected), , "(int line, bool selected)" +DefineEngineMethod(DbgFileView, setCurrentLine, void, (S32 line, bool selected), , "(int line, bool selected)" "Set the current highlighted line.") { object->setCurrentLine(line, selected); } -DefineConsoleMethod(DbgFileView, getCurrentLine, const char *, (), , "()" +DefineEngineMethod(DbgFileView, getCurrentLine, const char *, (), , "()" "Get the currently executing file and line, if any.\n\n" "@returns A string containing the file, a tab, and then the line number." " Use getField() with this.") @@ -84,38 +84,38 @@ DefineConsoleMethod(DbgFileView, getCurrentLine, const char *, (), , "()" return ret; } -DefineConsoleMethod(DbgFileView, open, bool, (const char * filename), , "(string filename)" +DefineEngineMethod(DbgFileView, open, bool, (const char * filename), , "(string filename)" "Open a file for viewing.\n\n" "@note This loads the file from the local system.") { return object->openFile(filename); } -DefineConsoleMethod(DbgFileView, clearBreakPositions, void, (), , "()" +DefineEngineMethod(DbgFileView, clearBreakPositions, void, (), , "()" "Clear all break points in the current file.") { object->clearBreakPositions(); } -DefineConsoleMethod(DbgFileView, setBreakPosition, void, (U32 line), , "(int line)" +DefineEngineMethod(DbgFileView, setBreakPosition, void, (U32 line), , "(int line)" "Set a breakpoint at the specified line.") { object->setBreakPosition(line); } -DefineConsoleMethod(DbgFileView, setBreak, void, (U32 line), , "(int line)" +DefineEngineMethod(DbgFileView, setBreak, void, (U32 line), , "(int line)" "Set a breakpoint at the specified line.") { object->setBreakPointStatus(line, true); } -DefineConsoleMethod(DbgFileView, removeBreak, void, (U32 line), , "(int line)" +DefineEngineMethod(DbgFileView, removeBreak, void, (U32 line), , "(int line)" "Remove a breakpoint from the specified line.") { object->setBreakPointStatus(line, false); } -DefineConsoleMethod(DbgFileView, findString, bool, (const char * findThis), , "(string findThis)" +DefineEngineMethod(DbgFileView, findString, bool, (const char * findThis), , "(string findThis)" "Find the specified string in the currently viewed file and " "scroll it into view.") { diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 6eb290142..be4179421 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -2468,7 +2468,7 @@ void GuiEditCtrl::startMouseGuideDrag( guideAxis axis, U32 guideIndex, bool lock //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the toplevel control edited inside the GUI editor." ) +DefineEngineMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the toplevel control edited inside the GUI editor." ) { GuiControl* ctrl = object->getContentControl(); if( ctrl ) @@ -2479,7 +2479,7 @@ DefineConsoleMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." ) +DefineEngineMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." ) { if (ctrl) object->setContentControl(ctrl); @@ -2487,7 +2487,7 @@ DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)") +DefineEngineMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)") { if (ctrl) object->addNewControl(ctrl); @@ -2495,28 +2495,28 @@ DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiC //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, addSelection, void, (S32 id), , "selects a control.") +DefineEngineMethod( GuiEditCtrl, addSelection, void, (S32 id), , "selects a control.") { object->addSelection(id); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, removeSelection, void, (S32 id), , "deselects a control.") +DefineEngineMethod( GuiEditCtrl, removeSelection, void, (S32 id), , "deselects a control.") { object->removeSelection(id); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, clearSelection, void, (), , "Clear selected controls list.") +DefineEngineMethod( GuiEditCtrl, clearSelection, void, (), , "Clear selected controls list.") { object->clearSelection(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)") +DefineEngineMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)") { if (ctrl) object->setSelection(ctrl, false); @@ -2524,7 +2524,7 @@ DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiContr //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)") +DefineEngineMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)") { if (addSet) object->setCurrentAddSet(addSet); @@ -2532,7 +2532,7 @@ DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, getCurrentAddSet, S32, (), , "Returns the set to which new controls will be added") +DefineEngineMethod( GuiEditCtrl, getCurrentAddSet, S32, (), , "Returns the set to which new controls will be added") { const GuiControl* add = object->getCurrentAddSet(); return add ? add->getId() : 0; @@ -2540,49 +2540,49 @@ DefineConsoleMethod( GuiEditCtrl, getCurrentAddSet, S32, (), , "Returns the set //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, toggle, void, (), , "Toggle activation.") +DefineEngineMethod( GuiEditCtrl, toggle, void, (), , "Toggle activation.") { object->setEditMode( !object->isActive() ); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, justify, void, (U32 mode), , "(int mode)" ) +DefineEngineMethod( GuiEditCtrl, justify, void, (U32 mode), , "(int mode)" ) { object->justifySelection( (GuiEditCtrl::Justification)mode ); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, bringToFront, void, (), , "") +DefineEngineMethod( GuiEditCtrl, bringToFront, void, (), , "") { object->bringToFront(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, pushToBack, void, (), , "") +DefineEngineMethod( GuiEditCtrl, pushToBack, void, (), , "") { object->pushToBack(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, deleteSelection, void, (), , "() - Delete the selected controls.") +DefineEngineMethod( GuiEditCtrl, deleteSelection, void, (), , "() - Delete the selected controls.") { object->deleteSelection(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, moveSelection, void, (S32 dx, S32 dy), , "Move all controls in the selection by (dx,dy) pixels.") +DefineEngineMethod( GuiEditCtrl, moveSelection, void, (S32 dx, S32 dy), , "Move all controls in the selection by (dx,dy) pixels.") { object->moveAndSnapSelection(Point2I(dx, dy)); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, saveSelection, void, (const char * filename), (nullAsType()), "( string fileName=null ) - Save selection to file or clipboard.") +DefineEngineMethod( GuiEditCtrl, saveSelection, void, (const char * filename), (nullAsType()), "( string fileName=null ) - Save selection to file or clipboard.") { object->saveSelection( filename ); @@ -2590,7 +2590,7 @@ DefineConsoleMethod( GuiEditCtrl, saveSelection, void, (const char * filename), //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, loadSelection, void, (const char * filename), (nullAsType()), "( string fileName=null ) - Load selection from file or clipboard.") +DefineEngineMethod( GuiEditCtrl, loadSelection, void, (const char * filename), (nullAsType()), "( string fileName=null ) - Load selection from file or clipboard.") { object->loadSelection( filename ); @@ -2598,7 +2598,7 @@ DefineConsoleMethod( GuiEditCtrl, loadSelection, void, (const char * filename), //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, selectAll, void, (), , "()") +DefineEngineMethod( GuiEditCtrl, selectAll, void, (), , "()") { object->selectAll(); } @@ -2613,14 +2613,14 @@ DefineEngineMethod( GuiEditCtrl, getSelection, SimSet*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, getNumSelected, S32, (), , "() - Return the number of controls currently selected." ) +DefineEngineMethod( GuiEditCtrl, getNumSelected, S32, (), , "() - Return the number of controls currently selected." ) { return object->getNumSelected(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , "() - Returns global bounds of current selection as vector 'x y width height'." ) +DefineEngineMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , "() - Returns global bounds of current selection as vector 'x y width height'." ) { RectI bounds = object->getSelectionGlobalBounds(); String str = String::ToString( "%i %i %i %i", bounds.point.x, bounds.point.y, bounds.extent.x, bounds.extent.y ); @@ -2633,7 +2633,7 @@ DefineConsoleMethod( GuiEditCtrl, getSelectionGlobalBounds, const char*, (), , " //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, selectParents, void, ( bool addToSelection ), (false), "( bool addToSelection=false ) - Select parents of currently selected controls." ) +DefineEngineMethod( GuiEditCtrl, selectParents, void, ( bool addToSelection ), (false), "( bool addToSelection=false ) - Select parents of currently selected controls." ) { object->selectParents( addToSelection ); @@ -2641,7 +2641,7 @@ DefineConsoleMethod( GuiEditCtrl, selectParents, void, ( bool addToSelection ), //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, selectChildren, void, ( bool addToSelection ), (false), "( bool addToSelection=false ) - Select children of currently selected controls." ) +DefineEngineMethod( GuiEditCtrl, selectChildren, void, ( bool addToSelection ), (false), "( bool addToSelection=false ) - Select children of currently selected controls." ) { object->selectChildren( addToSelection ); @@ -2657,14 +2657,14 @@ DefineEngineMethod( GuiEditCtrl, getTrash, SimGroup*, (),, //----------------------------------------------------------------------------- -DefineConsoleMethod(GuiEditCtrl, setSnapToGrid, void, (U32 gridsize), , "GuiEditCtrl.setSnapToGrid(gridsize)") +DefineEngineMethod(GuiEditCtrl, setSnapToGrid, void, (U32 gridsize), , "GuiEditCtrl.setSnapToGrid(gridsize)") { object->setSnapToGrid(gridsize); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, readGuides, void, ( GuiControl* ctrl, S32 axis ), (-1), "( GuiControl ctrl [, int axis ] ) - Read the guides from the given control." ) +DefineEngineMethod( GuiEditCtrl, readGuides, void, ( GuiControl* ctrl, S32 axis ), (-1), "( GuiControl ctrl [, int axis ] ) - Read the guides from the given control." ) { // Find the control. @@ -2694,7 +2694,7 @@ DefineConsoleMethod( GuiEditCtrl, readGuides, void, ( GuiControl* ctrl, S32 axis //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, writeGuides, void, ( GuiControl* ctrl, S32 axis ), ( -1), "( GuiControl ctrl [, int axis ] ) - Write the guides to the given control." ) +DefineEngineMethod( GuiEditCtrl, writeGuides, void, ( GuiControl* ctrl, S32 axis ), ( -1), "( GuiControl ctrl [, int axis ] ) - Write the guides to the given control." ) { // Find the control. @@ -2724,7 +2724,7 @@ DefineConsoleMethod( GuiEditCtrl, writeGuides, void, ( GuiControl* ctrl, S32 axi //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, clearGuides, void, ( S32 axis ), (-1), "( [ int axis ] ) - Clear all currently set guide lines." ) +DefineEngineMethod( GuiEditCtrl, clearGuides, void, ( S32 axis ), (-1), "( [ int axis ] ) - Clear all currently set guide lines." ) { if( axis != -1 ) { @@ -2745,7 +2745,7 @@ DefineConsoleMethod( GuiEditCtrl, clearGuides, void, ( S32 axis ), (-1), "( [ in //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, fitIntoParents, void, (bool width, bool height), (true, true), "( bool width=true, bool height=true ) - Fit selected controls into their parents." ) +DefineEngineMethod( GuiEditCtrl, fitIntoParents, void, (bool width, bool height), (true, true), "( bool width=true, bool height=true ) - Fit selected controls into their parents." ) { object->fitIntoParents( width, height ); @@ -2753,7 +2753,7 @@ DefineConsoleMethod( GuiEditCtrl, fitIntoParents, void, (bool width, bool height //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiEditCtrl, getMouseMode, const char*, (), , "() - Return the current mouse mode." ) +DefineEngineMethod( GuiEditCtrl, getMouseMode, const char*, (), , "() - Return the current mouse mode." ) { switch( object->getMouseMode() ) { diff --git a/Engine/source/gui/editor/guiFilterCtrl.cpp b/Engine/source/gui/editor/guiFilterCtrl.cpp index 67a0232ae..c0d9c2a72 100644 --- a/Engine/source/gui/editor/guiFilterCtrl.cpp +++ b/Engine/source/gui/editor/guiFilterCtrl.cpp @@ -60,7 +60,7 @@ void GuiFilterCtrl::initPersistFields() Parent::initPersistFields(); } -DefineConsoleMethod( GuiFilterCtrl, getValue, const char*, (), , "Return a tuple containing all the values in the filter." +DefineEngineMethod( GuiFilterCtrl, getValue, const char*, (), , "Return a tuple containing all the values in the filter." "@internal") { static char buffer[512]; @@ -89,7 +89,7 @@ ConsoleMethod( GuiFilterCtrl, setValue, void, 3, 20, "(f1, f2, ...)" object->set(filter); } -DefineConsoleMethod( GuiFilterCtrl, identity, void, (), , "Reset the filtering." +DefineEngineMethod( GuiFilterCtrl, identity, void, (), , "Reset the filtering." "@internal") { object->identity(); diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index dc168436b..efe534358 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -1486,7 +1486,7 @@ PopupMenu* GuiMenuBar::findMenu(StringTableEntry barTitle) //----------------------------------------------------------------------------- // Console Methods //----------------------------------------------------------------------------- -DefineConsoleMethod(GuiMenuBar, attachToCanvas, void, (const char *canvas, S32 pos), , "(GuiCanvas, pos)") +DefineEngineMethod(GuiMenuBar, attachToCanvas, void, (const char *canvas, S32 pos), , "(GuiCanvas, pos)") { GuiCanvas* canv = dynamic_cast(Sim::findObject(canvas)); if (canv) @@ -1495,7 +1495,7 @@ DefineConsoleMethod(GuiMenuBar, attachToCanvas, void, (const char *canvas, S32 p } } -DefineConsoleMethod(GuiMenuBar, removeFromCanvas, void, (), , "()") +DefineEngineMethod(GuiMenuBar, removeFromCanvas, void, (), , "()") { GuiCanvas* canvas = object->getRoot(); @@ -1503,23 +1503,23 @@ DefineConsoleMethod(GuiMenuBar, removeFromCanvas, void, (), , "()") canvas->setMenuBar(nullptr); } -DefineConsoleMethod(GuiMenuBar, getMenuCount, S32, (), , "()") +DefineEngineMethod(GuiMenuBar, getMenuCount, S32, (), , "()") { return object->getMenuListCount(); } -DefineConsoleMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)") +DefineEngineMethod(GuiMenuBar, getMenu, S32, (S32 index), (0), "(Index)") { return object->getMenu(index)->getId(); } //----------------------------------------------------------------------------- -DefineConsoleMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType(), -1), "(object, pos) insert object at position") +DefineEngineMethod(GuiMenuBar, insert, void, (SimObject* pObject, S32 pos), (nullAsType(), -1), "(object, pos) insert object at position") { object->insert(pObject, pos); } -DefineConsoleMethod(GuiMenuBar, findMenu, S32, (const char* barTitle), (""), "(barTitle)") +DefineEngineMethod(GuiMenuBar, findMenu, S32, (const char* barTitle), (""), "(barTitle)") { StringTableEntry barTitleStr = StringTable->insert(barTitle); PopupMenu* menu = object->findMenu(barTitleStr); diff --git a/Engine/source/gui/editor/guiParticleGraphCtrl.cpp b/Engine/source/gui/editor/guiParticleGraphCtrl.cpp index 342646fb1..4b71a1518 100644 --- a/Engine/source/gui/editor/guiParticleGraphCtrl.cpp +++ b/Engine/source/gui/editor/guiParticleGraphCtrl.cpp @@ -1004,7 +1004,7 @@ bool GuiParticleGraphCtrl::renderGraphTooltip(Point2I cursorPos, StringTableEntr return true; } -DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPoint, void, (S32 point), , "(int point)" +DefineEngineMethod(GuiParticleGraphCtrl, setSelectedPoint, void, (S32 point), , "(int point)" "Set the selected point on the graph.\n" "@return No return value") { @@ -1016,7 +1016,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPoint, void, (S32 point), , object->setSelectedPoint( point ); } -DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPlot, void, (S32 plotID), , "(int plotID)" +DefineEngineMethod(GuiParticleGraphCtrl, setSelectedPlot, void, (S32 plotID), , "(int plotID)" "Set the selected plot (a.k.a. graph)." "@return No return value" ) { @@ -1028,7 +1028,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setSelectedPlot, void, (S32 plotID), , object->setSelectedPlot( plotID ); } -DefineConsoleMethod(GuiParticleGraphCtrl, clearGraph, void, (S32 plotID), , "(int plotID)" +DefineEngineMethod(GuiParticleGraphCtrl, clearGraph, void, (S32 plotID), , "(int plotID)" "Clear the graph of the given plot." "@return No return value") { @@ -1040,14 +1040,14 @@ DefineConsoleMethod(GuiParticleGraphCtrl, clearGraph, void, (S32 plotID), , "(in object->clearGraph( plotID ); } -DefineConsoleMethod(GuiParticleGraphCtrl, clearAllGraphs, void, (), , "()" +DefineEngineMethod(GuiParticleGraphCtrl, clearAllGraphs, void, (), , "()" "Clear all of the graphs." "@return No return value") { object->clearAllGraphs(); } -DefineConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, S32, (S32 plotID, F32 x, F32 y, bool setAdded), (true), "(int plotID, float x, float y, bool setAdded = true;)" +DefineEngineMethod(GuiParticleGraphCtrl, addPlotPoint, S32, (S32 plotID, F32 x, F32 y, bool setAdded), (true), "(int plotID, float x, float y, bool setAdded = true;)" "Add a data point to the given plot." "@return") { @@ -1060,7 +1060,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, S32, (S32 plotID, F32 x, return object->addPlotPoint( plotID, Point2F(x, y), setAdded); } -DefineConsoleMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)\n" +DefineEngineMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)\n" "Insert a data point to the given plot and plot position.\n" "@param plotID The plot you want to access\n" "@param i The data point.\n" @@ -1075,7 +1075,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S3 object->insertPlotPoint( plotID, i, Point2F(x, y)); } -DefineConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, S32, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)" +DefineEngineMethod(GuiParticleGraphCtrl, changePlotPoint, S32, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)" "Change a data point to the given plot and plot position.\n" "@param plotID The plot you want to access\n" "@param i The data point.\n" @@ -1090,21 +1090,21 @@ DefineConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, S32, (S32 plotID, S32 return object->changePlotPoint( plotID, i, Point2F(x, y)); } -DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, S32, (), , "() " +DefineEngineMethod(GuiParticleGraphCtrl, getSelectedPlot, S32, (), , "() " "Gets the selected Plot (a.k.a. graph).\n" "@return The plot's ID.") { return object->getSelectedPlot(); } -DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, S32, (), , "()" +DefineEngineMethod(GuiParticleGraphCtrl, getSelectedPoint, S32, (), , "()" "Gets the selected Point on the Plot (a.k.a. graph)." "@return The last selected point ID") { return object->getSelectedPoint(); } -DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S32 samples), , "(int plotID, int samples)" +DefineEngineMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S32 samples), , "(int plotID, int samples)" "@return Returns true or false whether or not the point in the plot passed is an existing point.") { @@ -1119,7 +1119,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S3 return object->isExistingPoint(plotID, samples); } -DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S32 samples), , "(int plotID, int samples)" +DefineEngineMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S32 samples), , "(int plotID, int samples)" "Get a data point from the plot specified, samples from the start of the graph." "@return The data point ID") { @@ -1137,7 +1137,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S3 return object->getPlotPoint(plotID, samples); } -DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x, F32 y), , "(int plotID, float x, float y)\n" +DefineEngineMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x, F32 y), , "(int plotID, float x, float y)\n" "Gets the index of the point passed on the plotID passed (graph ID).\n" "@param plotID The plot you wish to check.\n" "@param x,y The coordinates of the point to get.\n" @@ -1151,7 +1151,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x, return object->getPlotIndex(plotID, x, y); } -DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, LinearColorF, (S32 plotID), , "(int plotID)" +DefineEngineMethod(GuiParticleGraphCtrl, getGraphColor, LinearColorF, (S32 plotID), , "(int plotID)" "Get the color of the graph passed." "@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"") { @@ -1165,7 +1165,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, LinearColorF, (S32 plot } -DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (S32 plotID), , "(int plotID) " +DefineEngineMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (S32 plotID), , "(int plotID) " "Get the minimum values of the graph ranges.\n" "@return Returns the minimum of the range formatted as \"x-min y-min\"") { @@ -1177,7 +1177,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (S32 plotID), , return object->getGraphMin(plotID); } -DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , "(int plotID) " +DefineEngineMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , "(int plotID) " "Get the maximum values of the graph ranges.\n" "@return Returns the maximum of the range formatted as \"x-max y-max\"") { @@ -1190,7 +1190,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , } -DefineConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID), , "(int plotID) " +DefineEngineMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID), , "(int plotID) " "Get the name of the graph passed.\n" "@return Returns the name of the plot") { @@ -1207,7 +1207,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID return retBuffer; } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMin, void, (S32 plotID, F32 minX, F32 minY), , "(int plotID, float minX, float minY) " +DefineEngineMethod(GuiParticleGraphCtrl, setGraphMin, void, (S32 plotID, F32 minX, F32 minY), , "(int plotID, float minX, float minY) " "Set the min values of the graph of plotID.\n" "@param plotID The plot to modify\n" "@param minX,minY The minimum bound of the value range.\n" @@ -1223,7 +1223,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMin, void, (S32 plotID, F32 mi object->setGraphMin(plotID, Point2F(minX, minY)); } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinX, void, (S32 plotID, F32 minX), , "(int plotID, float minX) " +DefineEngineMethod(GuiParticleGraphCtrl, setGraphMinX, void, (S32 plotID, F32 minX), , "(int plotID, float minX) " "Set the min X value of the graph of plotID.\n" "@param plotID The plot to modify.\n" "@param minX The minimum x value.\n" @@ -1239,7 +1239,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinX, void, (S32 plotID, F32 m object->setGraphMinX(plotID, minX); } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinY, void, (S32 plotID, F32 minX), , "(int plotID, float minY) " +DefineEngineMethod(GuiParticleGraphCtrl, setGraphMinY, void, (S32 plotID, F32 minX), , "(int plotID, float minY) " "Set the min Y value of the graph of plotID." "@param plotID The plot to modify.\n" "@param minY The minimum y value.\n" @@ -1255,7 +1255,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMinY, void, (S32 plotID, F32 m object->setGraphMinY(plotID, minX); } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMax, void, (S32 plotID, F32 maxX, F32 maxY), , "(int plotID, float maxX, float maxY) " +DefineEngineMethod(GuiParticleGraphCtrl, setGraphMax, void, (S32 plotID, F32 maxX, F32 maxY), , "(int plotID, float maxX, float maxY) " "Set the max values of the graph of plotID." "@param plotID The plot to modify\n" "@param maxX,maxY The maximum bound of the value range.\n" @@ -1271,7 +1271,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMax, void, (S32 plotID, F32 ma object->setGraphMax(plotID, Point2F(maxX, maxY)); } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxX, void, (S32 plotID, F32 maxX), , "(int plotID, float maxX)" +DefineEngineMethod(GuiParticleGraphCtrl, setGraphMaxX, void, (S32 plotID, F32 maxX), , "(int plotID, float maxX)" "Set the max X value of the graph of plotID." "@param plotID The plot to modify.\n" "@param maxX The maximum x value.\n" @@ -1287,7 +1287,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxX, void, (S32 plotID, F32 m object->setGraphMaxX(plotID, maxX); } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxY, void, (S32 plotID, F32 maxX), , "(int plotID, float maxY)" +DefineEngineMethod(GuiParticleGraphCtrl, setGraphMaxY, void, (S32 plotID, F32 maxX), , "(int plotID, float maxY)" "Set the max Y value of the graph of plotID." "@param plotID The plot to modify.\n" "@param maxY The maximum y value.\n" @@ -1303,7 +1303,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphMaxY, void, (S32 plotID, F32 m object->setGraphMaxY(plotID, maxX); } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphHidden, void, (S32 plotID, bool isHidden), , "(int plotID, bool isHidden)" +DefineEngineMethod(GuiParticleGraphCtrl, setGraphHidden, void, (S32 plotID, bool isHidden), , "(int plotID, bool isHidden)" "Set whether the graph number passed is hidden or not." "@return No return value.") { @@ -1317,7 +1317,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphHidden, void, (S32 plotID, boo object->setGraphHidden(plotID, isHidden); } -DefineConsoleMethod(GuiParticleGraphCtrl, setAutoGraphMax, void, (bool autoMax), , "(bool autoMax) " +DefineEngineMethod(GuiParticleGraphCtrl, setAutoGraphMax, void, (bool autoMax), , "(bool autoMax) " "Set whether the max will automatically be set when adding points " "(ie if you add a value over the current max, the max is increased to that value).\n" "@return No return value.") @@ -1325,35 +1325,35 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setAutoGraphMax, void, (bool autoMax), object->setAutoGraphMax(autoMax); } -DefineConsoleMethod(GuiParticleGraphCtrl, setAutoRemove, void, (bool autoRemove), , "(bool autoRemove) " +DefineEngineMethod(GuiParticleGraphCtrl, setAutoRemove, void, (bool autoRemove), , "(bool autoRemove) " "Set whether or not a point should be deleted when you drag another one over it." "@return No return value.") { object->setAutoRemove(autoRemove); } -DefineConsoleMethod(GuiParticleGraphCtrl, setRenderAll, void, (bool autoRemove), , "(bool renderAll)" +DefineEngineMethod(GuiParticleGraphCtrl, setRenderAll, void, (bool autoRemove), , "(bool renderAll)" "Set whether or not a position should be rendered on every point or just the last selected." "@return No return value.") { object->setRenderAll(autoRemove); } -DefineConsoleMethod(GuiParticleGraphCtrl, setPointXMovementClamped, void, (bool autoRemove), , "(bool clamped)" +DefineEngineMethod(GuiParticleGraphCtrl, setPointXMovementClamped, void, (bool autoRemove), , "(bool clamped)" "Set whether the x position of the selected graph point should be clamped" "@return No return value.") { object->setPointXMovementClamped(autoRemove); } -DefineConsoleMethod(GuiParticleGraphCtrl, setRenderGraphTooltip, void, (bool autoRemove), , "(bool renderGraphTooltip)" +DefineEngineMethod(GuiParticleGraphCtrl, setRenderGraphTooltip, void, (bool autoRemove), , "(bool renderGraphTooltip)" "Set whether or not to render the graph tooltip." "@return No return value.") { object->setRenderGraphTooltip(autoRemove); } -DefineConsoleMethod(GuiParticleGraphCtrl, setGraphName, void, (S32 plotID, const char * graphName), , "(int plotID, string graphName) " +DefineEngineMethod(GuiParticleGraphCtrl, setGraphName, void, (S32 plotID, const char * graphName), , "(int plotID, string graphName) " "Set the name of the given plot.\n" "@param plotID The plot to modify.\n" "@param graphName The name to set on the plot.\n" @@ -1369,7 +1369,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, setGraphName, void, (S32 plotID, const object->setGraphName(plotID, graphName); } -DefineConsoleMethod(GuiParticleGraphCtrl, resetSelectedPoint, void, (), , "()" +DefineEngineMethod(GuiParticleGraphCtrl, resetSelectedPoint, void, (), , "()" "This will reset the currently selected point to nothing." "@return No return value.") { diff --git a/Engine/source/gui/editor/inspector/componentGroup.cpp b/Engine/source/gui/editor/inspector/componentGroup.cpp index 6e16db173..27aec03fa 100644 --- a/Engine/source/gui/editor/inspector/componentGroup.cpp +++ b/Engine/source/gui/editor/inspector/componentGroup.cpp @@ -524,7 +524,7 @@ ConsoleMethod(GuiInspectorComponentGroup, removeDynamicField, void, 3, 3, "") { } -DefineConsoleMethod(GuiInspectorComponentGroup, getComponent, S32, (), ,"") +DefineEngineMethod(GuiInspectorComponentGroup, getComponent, S32, (), ,"") { return object->getComponent()->getId(); } diff --git a/Engine/source/gui/editor/inspector/dynamicField.cpp b/Engine/source/gui/editor/inspector/dynamicField.cpp index d028a6c7a..092af36f4 100644 --- a/Engine/source/gui/editor/inspector/dynamicField.cpp +++ b/Engine/source/gui/editor/inspector/dynamicField.cpp @@ -316,7 +316,7 @@ void GuiInspectorDynamicField::_executeSelectedCallback() Con::executef( mInspector, "onFieldSelected", mDynField->slotName, "TypeDynamicField" ); } -DefineConsoleMethod( GuiInspectorDynamicField, renameField, void, (const char* newDynamicFieldName),, "field.renameField(newDynamicFieldName);" ) +DefineEngineMethod( GuiInspectorDynamicField, renameField, void, (const char* newDynamicFieldName),, "field.renameField(newDynamicFieldName);" ) { object->renameField( newDynamicFieldName ); } diff --git a/Engine/source/gui/editor/inspector/dynamicGroup.cpp b/Engine/source/gui/editor/inspector/dynamicGroup.cpp index 3d9879919..931a00836 100644 --- a/Engine/source/gui/editor/inspector/dynamicGroup.cpp +++ b/Engine/source/gui/editor/inspector/dynamicGroup.cpp @@ -188,7 +188,7 @@ void GuiInspectorDynamicGroup::updateAllFields() inspectGroup(); } -DefineConsoleMethod(GuiInspectorDynamicGroup, inspectGroup, bool, (), , "Refreshes the dynamic fields in the inspector.") +DefineEngineMethod(GuiInspectorDynamicGroup, inspectGroup, bool, (), , "Refreshes the dynamic fields in the inspector.") { return object->inspectGroup(); } @@ -263,11 +263,11 @@ void GuiInspectorDynamicGroup::addDynamicField() instantExpand(); } -DefineConsoleMethod( GuiInspectorDynamicGroup, addDynamicField, void, (), , "obj.addDynamicField();" ) +DefineEngineMethod( GuiInspectorDynamicGroup, addDynamicField, void, (), , "obj.addDynamicField();" ) { object->addDynamicField(); } -DefineConsoleMethod( GuiInspectorDynamicGroup, removeDynamicField, void, (), , "" ) +DefineEngineMethod( GuiInspectorDynamicGroup, removeDynamicField, void, (), , "" ) { } diff --git a/Engine/source/gui/editor/inspector/field.cpp b/Engine/source/gui/editor/inspector/field.cpp index f8efaca02..2808ee140 100644 --- a/Engine/source/gui/editor/inspector/field.cpp +++ b/Engine/source/gui/editor/inspector/field.cpp @@ -688,59 +688,59 @@ void GuiInspectorField::_setFieldDocs( StringTableEntry docs ) //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiInspectorField, getInspector, S32, (), , "() - Return the GuiInspector to which this field belongs." ) +DefineEngineMethod( GuiInspectorField, getInspector, S32, (), , "() - Return the GuiInspector to which this field belongs." ) { return object->getInspector()->getId(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiInspectorField, getInspectedFieldName, const char*, (), , "() - Return the name of the field edited by this inspector field." ) +DefineEngineMethod( GuiInspectorField, getInspectedFieldName, const char*, (), , "() - Return the name of the field edited by this inspector field." ) { return object->getFieldName(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiInspectorField, getInspectedFieldType, const char*, (), , "() - Return the type of the field edited by this inspector field." ) +DefineEngineMethod( GuiInspectorField, getInspectedFieldType, const char*, (), , "() - Return the type of the field edited by this inspector field." ) { return object->getFieldType(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiInspectorField, apply, void, ( const char * newValue, bool callbacks ), (true), "( string newValue, bool callbacks=true ) - Set the field's value. Suppress callbacks for undo if callbacks=false." ) +DefineEngineMethod( GuiInspectorField, apply, void, ( const char * newValue, bool callbacks ), (true), "( string newValue, bool callbacks=true ) - Set the field's value. Suppress callbacks for undo if callbacks=false." ) { object->setData( newValue, callbacks ); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiInspectorField, applyWithoutUndo, void, (const char * data), , "() - Set field value without recording undo (same as 'apply( value, false )')." ) +DefineEngineMethod( GuiInspectorField, applyWithoutUndo, void, (const char * data), , "() - Set field value without recording undo (same as 'apply( value, false )')." ) { object->setData( data, false ); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiInspectorField, getData, const char*, (), , "() - Return the value currently displayed on the field." ) +DefineEngineMethod( GuiInspectorField, getData, const char*, (), , "() - Return the value currently displayed on the field." ) { return object->getData(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( GuiInspectorField, reset, void, (), , "() - Reset to default value." ) +DefineEngineMethod( GuiInspectorField, reset, void, (), , "() - Reset to default value." ) { object->resetData(); } -DefineConsoleMethod(GuiInspectorField, setCaption, void, (String newCaption),, "() - Reset to default value.") +DefineEngineMethod(GuiInspectorField, setCaption, void, (String newCaption),, "() - Reset to default value.") { object->setCaption(StringTable->insert(newCaption.c_str())); } -DefineConsoleMethod(GuiInspectorField, setEditControl, void, (GuiControl* editCtrl), (nullAsType()), "() - Reset to default value.") +DefineEngineMethod(GuiInspectorField, setEditControl, void, (GuiControl* editCtrl), (nullAsType()), "() - Reset to default value.") { object->setEditControl(editCtrl); } diff --git a/Engine/source/gui/editor/inspector/variableGroup.cpp b/Engine/source/gui/editor/inspector/variableGroup.cpp index 83e4f3c32..cb23d9c6e 100644 --- a/Engine/source/gui/editor/inspector/variableGroup.cpp +++ b/Engine/source/gui/editor/inspector/variableGroup.cpp @@ -250,12 +250,12 @@ GuiInspectorField* GuiInspectorVariableGroup::createInspectorField() return NULL; } -DefineConsoleMethod(GuiInspectorVariableGroup, createInspectorField, GuiInspectorField*, (),, "createInspectorField()") +DefineEngineMethod(GuiInspectorVariableGroup, createInspectorField, GuiInspectorField*, (),, "createInspectorField()") { return object->createInspectorField(); } -DefineConsoleMethod(GuiInspectorVariableGroup, addInspectorField, void, (GuiInspectorField* field), (nullAsType()), "addInspectorField( GuiInspectorFieldObject )") +DefineEngineMethod(GuiInspectorVariableGroup, addInspectorField, void, (GuiInspectorField* field), (nullAsType()), "addInspectorField( GuiInspectorFieldObject )") { object->addInspectorField(field); } \ No newline at end of file diff --git a/Engine/source/gui/editor/inspector/variableInspector.cpp b/Engine/source/gui/editor/inspector/variableInspector.cpp index 115e48b83..10d640fc9 100644 --- a/Engine/source/gui/editor/inspector/variableInspector.cpp +++ b/Engine/source/gui/editor/inspector/variableInspector.cpp @@ -216,17 +216,17 @@ void GuiVariableInspector::setFieldEnabled(const char* name, bool enabled) } } -DefineConsoleMethod(GuiVariableInspector, startGroup, void, (const char* name),, "startGroup( groupName )") +DefineEngineMethod(GuiVariableInspector, startGroup, void, (const char* name),, "startGroup( groupName )") { object->startGroup(name); } -DefineConsoleMethod(GuiVariableInspector, endGroup, void, (),, "endGroup()") +DefineEngineMethod(GuiVariableInspector, endGroup, void, (),, "endGroup()") { object->endGroup(); } -DefineConsoleMethod(GuiVariableInspector, addField, void, (const char* name, const char* label, const char* typeName, +DefineEngineMethod(GuiVariableInspector, addField, void, (const char* name, const char* label, const char* typeName, const char* description, const char* defaultValue, const char* dataValues, SimObject* ownerObj), ("","","","","", "", nullAsType()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, ownerObject )") { @@ -236,7 +236,7 @@ DefineConsoleMethod(GuiVariableInspector, addField, void, (const char* name, con object->addField(name, label, typeName, description, defaultValue, dataValues, ownerObj); } -DefineConsoleMethod(GuiVariableInspector, addCallbackField, void, (const char* name, const char* label, const char* typeName, +DefineEngineMethod(GuiVariableInspector, addCallbackField, void, (const char* name, const char* label, const char* typeName, const char* description, const char* defaultValue, const char* dataValues, const char* callbackName, SimObject* ownerObj), ("", "", "", "", "", "", nullAsType()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, callbackName, ownerObject )") { @@ -246,22 +246,22 @@ DefineConsoleMethod(GuiVariableInspector, addCallbackField, void, (const char* n object->addCallbackField(name, label, typeName, description, defaultValue, dataValues, callbackName, ownerObj); } -DefineConsoleMethod(GuiVariableInspector, update, void, (), , "update()") +DefineEngineMethod(GuiVariableInspector, update, void, (), , "update()") { object->update(); } -DefineConsoleMethod(GuiVariableInspector, clearFields, void, (), , "clearFields()") +DefineEngineMethod(GuiVariableInspector, clearFields, void, (), , "clearFields()") { object->clearFields(); } -DefineConsoleMethod(GuiVariableInspector, setFieldEnabled, void, (const char* fieldName, bool isEnabled), (true), "setFieldEnabled( fieldName, isEnabled )") +DefineEngineMethod(GuiVariableInspector, setFieldEnabled, void, (const char* fieldName, bool isEnabled), (true), "setFieldEnabled( fieldName, isEnabled )") { object->setFieldEnabled(fieldName, isEnabled); } -DefineConsoleMethod( GuiVariableInspector, loadVars, void, ( const char * searchString ), , "loadVars( searchString )" ) +DefineEngineMethod( GuiVariableInspector, loadVars, void, ( const char * searchString ), , "loadVars( searchString )" ) { object->loadVars( searchString ); } \ No newline at end of file diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 0e5db18da..4dac1525e 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -445,17 +445,17 @@ void PopupMenu::hidePopupSubmenus() //----------------------------------------------------------------------------- // Console Methods //----------------------------------------------------------------------------- -DefineConsoleMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd), ("", "", ""), "(pos[, title][, accelerator][, cmd])") +DefineEngineMethod(PopupMenu, insertItem, S32, (S32 pos, const char * title, const char * accelerator, const char* cmd), ("", "", ""), "(pos[, title][, accelerator][, cmd])") { return object->insertItem(pos, title, accelerator, cmd); } -DefineConsoleMethod(PopupMenu, removeItem, void, (S32 pos), , "(pos)") +DefineEngineMethod(PopupMenu, removeItem, void, (S32 pos), , "(pos)") { object->removeItem(pos); } -DefineConsoleMethod(PopupMenu, insertSubMenu, S32, (S32 pos, String title, String subMenu), , "(pos, title, subMenu)") +DefineEngineMethod(PopupMenu, insertSubMenu, S32, (S32 pos, String title, String subMenu), , "(pos, title, subMenu)") { PopupMenu *mnu = dynamic_cast(Sim::findObject(subMenu)); if(mnu == NULL) @@ -466,40 +466,40 @@ DefineConsoleMethod(PopupMenu, insertSubMenu, S32, (S32 pos, String title, Strin return object->insertSubMenu(pos, title, mnu); } -DefineConsoleMethod(PopupMenu, setItem, bool, (S32 pos, const char * title, const char * accelerator, const char *cmd), (""), "(pos, title[, accelerator][, cmd])") +DefineEngineMethod(PopupMenu, setItem, bool, (S32 pos, const char * title, const char * accelerator, const char *cmd), (""), "(pos, title[, accelerator][, cmd])") { return object->setItem(pos, title, accelerator, cmd); } //----------------------------------------------------------------------------- -DefineConsoleMethod(PopupMenu, enableItem, void, (S32 pos, bool enabled), , "(pos, enabled)") +DefineEngineMethod(PopupMenu, enableItem, void, (S32 pos, bool enabled), , "(pos, enabled)") { object->enableItem(pos, enabled); } -DefineConsoleMethod(PopupMenu, checkItem, void, (S32 pos, bool checked), , "(pos, checked)") +DefineEngineMethod(PopupMenu, checkItem, void, (S32 pos, bool checked), , "(pos, checked)") { object->checkItem(pos, checked); } -DefineConsoleMethod(PopupMenu, checkRadioItem, void, (S32 firstPos, S32 lastPos, S32 checkPos), , "(firstPos, lastPos, checkPos)") +DefineEngineMethod(PopupMenu, checkRadioItem, void, (S32 firstPos, S32 lastPos, S32 checkPos), , "(firstPos, lastPos, checkPos)") { object->checkRadioItem(firstPos, lastPos, checkPos); } -DefineConsoleMethod(PopupMenu, isItemChecked, bool, (S32 pos), , "(pos)") +DefineEngineMethod(PopupMenu, isItemChecked, bool, (S32 pos), , "(pos)") { return object->isItemChecked(pos); } -DefineConsoleMethod(PopupMenu, getItemCount, S32, (), , "()") +DefineEngineMethod(PopupMenu, getItemCount, S32, (), , "()") { return object->getItemCount(); } //----------------------------------------------------------------------------- -DefineConsoleMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") +DefineEngineMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") { GuiCanvas *pCanvas = dynamic_cast(Sim::findObject(canvasName)); object->showPopup(pCanvas, x, y); diff --git a/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp b/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp index 17cc97548..e53d70486 100644 --- a/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp +++ b/Engine/source/gui/game/guiIdleCamFadeBitmapCtrl.cpp @@ -177,13 +177,13 @@ ConsoleDocClass( GuiIdleCamFadeBitmapCtrl, "This is going to be deprecated, and any useful code ported to FadeinBitmap\n\n" "@internal"); -DefineConsoleMethod(GuiIdleCamFadeBitmapCtrl, fadeIn, void, (), , "()" +DefineEngineMethod(GuiIdleCamFadeBitmapCtrl, fadeIn, void, (), , "()" "@internal") { object->fadeIn(); } -DefineConsoleMethod(GuiIdleCamFadeBitmapCtrl, fadeOut, void, (), , "()" +DefineEngineMethod(GuiIdleCamFadeBitmapCtrl, fadeOut, void, (), , "()" "@internal") { object->fadeOut(); diff --git a/Engine/source/gui/shiny/guiTickCtrl.cpp b/Engine/source/gui/shiny/guiTickCtrl.cpp index fa788ea7b..02eca4599 100644 --- a/Engine/source/gui/shiny/guiTickCtrl.cpp +++ b/Engine/source/gui/shiny/guiTickCtrl.cpp @@ -59,7 +59,7 @@ static ConsoleDocFragment _setProcessTicks( "void setProcessTicks( bool tick )" ); -DefineConsoleMethod( GuiTickCtrl, setProcessTicks, void, (bool tick), (true), "( [tick = true] ) - This will set this object to either be processing ticks or not" ) +DefineEngineMethod( GuiTickCtrl, setProcessTicks, void, (bool tick), (true), "( [tick = true] ) - This will set this object to either be processing ticks or not" ) { object->setProcessTicks(tick); } \ No newline at end of file diff --git a/Engine/source/gui/utility/messageVector.cpp b/Engine/source/gui/utility/messageVector.cpp index 19255e38b..97fd33382 100644 --- a/Engine/source/gui/utility/messageVector.cpp +++ b/Engine/source/gui/utility/messageVector.cpp @@ -258,7 +258,7 @@ static ConsoleDocFragment _MessageVectordump2( "MessageVector", "void dump( string filename, string header);"); -DefineConsoleMethod( MessageVector, dump, void, (const char * filename, const char * header), (""), "(string filename, string header=NULL)" +DefineEngineMethod( MessageVector, dump, void, (const char * filename, const char * header), (""), "(string filename, string header=NULL)" "Dump the message vector to a file, optionally prefixing a header." "@hide") { diff --git a/Engine/source/gui/worldEditor/creator.cpp b/Engine/source/gui/worldEditor/creator.cpp index 28fc15e84..99264f4ba 100644 --- a/Engine/source/gui/worldEditor/creator.cpp +++ b/Engine/source/gui/worldEditor/creator.cpp @@ -219,7 +219,7 @@ void CreatorTree::sort() } //------------------------------------------------------------------------------ -DefineConsoleMethod( CreatorTree, addGroup, S32, (S32 group, const char * name, const char * value), , "(string group, string name, string value)") +DefineEngineMethod( CreatorTree, addGroup, S32, (S32 group, const char * name, const char * value), , "(string group, string name, string value)") { CreatorTree::Node * grp = object->findNode(group); @@ -236,7 +236,7 @@ DefineConsoleMethod( CreatorTree, addGroup, S32, (S32 group, const char * name, return(node ? node->getId() : -1); } -DefineConsoleMethod( CreatorTree, addItem, S32, (S32 group, const char * name, const char * value), , "(Node group, string name, string value)") +DefineEngineMethod( CreatorTree, addItem, S32, (S32 group, const char * name, const char * value), , "(Node group, string name, string value)") { CreatorTree::Node * grp = object->findNode(group); @@ -249,7 +249,7 @@ DefineConsoleMethod( CreatorTree, addItem, S32, (S32 group, const char * name, c } //------------------------------------------------------------------------------ -DefineConsoleMethod( CreatorTree, fileNameMatch, bool, (const char * world, const char * type, const char * filename), , "(string world, string type, string filename)") +DefineEngineMethod( CreatorTree, fileNameMatch, bool, (const char * world, const char * type, const char * filename), , "(string world, string type, string filename)") { // argv[2] - world short // argv[3] - type short @@ -269,12 +269,12 @@ DefineConsoleMethod( CreatorTree, fileNameMatch, bool, (const char * world, cons return(!dStrnicmp(filename+1, type, typeLen)); } -DefineConsoleMethod( CreatorTree, getSelected, S32, (), , "Return a handle to the currently selected item.") +DefineEngineMethod( CreatorTree, getSelected, S32, (), , "Return a handle to the currently selected item.") { return(object->getSelected()); } -DefineConsoleMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group g)") +DefineEngineMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group g)") { CreatorTree::Node * node = object->findNode(dAtoi(group)); if(node && node->isGroup()) @@ -282,24 +282,24 @@ DefineConsoleMethod( CreatorTree, isGroup, bool, (const char * group), , "(Group return(false); } -DefineConsoleMethod( CreatorTree, getName, const char*, (const char * item), , "(Node item)") +DefineEngineMethod( CreatorTree, getName, const char*, (const char * item), , "(Node item)") { CreatorTree::Node * node = object->findNode(dAtoi(item)); return(node ? node->mName : 0); } -DefineConsoleMethod( CreatorTree, getValue, const char*, (S32 nodeValue), , "(Node n)") +DefineEngineMethod( CreatorTree, getValue, const char*, (S32 nodeValue), , "(Node n)") { CreatorTree::Node * node = object->findNode(nodeValue); return(node ? node->mValue : 0); } -DefineConsoleMethod( CreatorTree, clear, void, (), , "Clear the tree.") +DefineEngineMethod( CreatorTree, clear, void, (), , "Clear the tree.") { object->clear(); } -DefineConsoleMethod( CreatorTree, getParent, S32, (S32 nodeValue), , "(Node n)") +DefineEngineMethod( CreatorTree, getParent, S32, (S32 nodeValue), , "(Node n)") { CreatorTree::Node * node = object->findNode(nodeValue); if(node && node->mParent) diff --git a/Engine/source/gui/worldEditor/editor.cpp b/Engine/source/gui/worldEditor/editor.cpp index 2f05c96ad..c60127540 100644 --- a/Engine/source/gui/worldEditor/editor.cpp +++ b/Engine/source/gui/worldEditor/editor.cpp @@ -128,7 +128,7 @@ static GameBase * getControlObj() return(control); } -DefineConsoleMethod( EditManager, setBookmark, void, (S32 val), , "(int slot)") +DefineEngineMethod( EditManager, setBookmark, void, (S32 val), , "(int slot)") { if(val < 0 || val > 9) return; @@ -138,7 +138,7 @@ DefineConsoleMethod( EditManager, setBookmark, void, (S32 val), , "(int slot)") object->mBookmarks[val] = control->getTransform(); } -DefineConsoleMethod( EditManager, gotoBookmark, void, (S32 val), , "(int slot)") +DefineEngineMethod( EditManager, gotoBookmark, void, (S32 val), , "(int slot)") { if(val < 0 || val > 9) return; @@ -148,17 +148,17 @@ DefineConsoleMethod( EditManager, gotoBookmark, void, (S32 val), , "(int slot)") control->setTransform(object->mBookmarks[val]); } -DefineConsoleMethod( EditManager, editorEnabled, void, (), , "Perform the onEditorEnabled callback on all SimObjects and set gEditingMission true" ) +DefineEngineMethod( EditManager, editorEnabled, void, (), , "Perform the onEditorEnabled callback on all SimObjects and set gEditingMission true" ) { object->editorEnabled(); } -DefineConsoleMethod( EditManager, editorDisabled, void, (), , "Perform the onEditorDisabled callback on all SimObjects and set gEditingMission false" ) +DefineEngineMethod( EditManager, editorDisabled, void, (), , "Perform the onEditorDisabled callback on all SimObjects and set gEditingMission false" ) { object->editorDisabled(); } -DefineConsoleMethod( EditManager, isEditorEnabled, bool, (), , "Return the value of gEditingMission." ) +DefineEngineMethod( EditManager, isEditorEnabled, bool, (), , "Return the value of gEditingMission." ) { return gEditingMission; } \ No newline at end of file diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp index 6bc043d09..02c2138e3 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp @@ -2179,43 +2179,43 @@ void GuiConvexEditorCtrl::splitSelectedFace() updateGizmoPos(); } -DefineConsoleMethod( GuiConvexEditorCtrl, hollowSelection, void, (), , "" ) +DefineEngineMethod( GuiConvexEditorCtrl, hollowSelection, void, (), , "" ) { object->hollowSelection(); } -DefineConsoleMethod( GuiConvexEditorCtrl, recenterSelection, void, (), , "" ) +DefineEngineMethod( GuiConvexEditorCtrl, recenterSelection, void, (), , "" ) { object->recenterSelection(); } -DefineConsoleMethod( GuiConvexEditorCtrl, hasSelection, S32, (), , "" ) +DefineEngineMethod( GuiConvexEditorCtrl, hasSelection, S32, (), , "" ) { return object->hasSelection(); } -DefineConsoleMethod( GuiConvexEditorCtrl, handleDelete, void, (), , "" ) +DefineEngineMethod( GuiConvexEditorCtrl, handleDelete, void, (), , "" ) { object->handleDelete(); } -DefineConsoleMethod( GuiConvexEditorCtrl, handleDeselect, void, (), , "" ) +DefineEngineMethod( GuiConvexEditorCtrl, handleDeselect, void, (), , "" ) { object->handleDeselect(); } -DefineConsoleMethod( GuiConvexEditorCtrl, dropSelectionAtScreenCenter, void, (), , "" ) +DefineEngineMethod( GuiConvexEditorCtrl, dropSelectionAtScreenCenter, void, (), , "" ) { object->dropSelectionAtScreenCenter(); } -DefineConsoleMethod( GuiConvexEditorCtrl, selectConvex, void, (ConvexShape *convex), , "( ConvexShape )" ) +DefineEngineMethod( GuiConvexEditorCtrl, selectConvex, void, (ConvexShape *convex), , "( ConvexShape )" ) { if (convex) object->setSelection( convex, -1 ); } -DefineConsoleMethod( GuiConvexEditorCtrl, splitSelectedFace, void, (), , "" ) +DefineEngineMethod( GuiConvexEditorCtrl, splitSelectedFace, void, (), , "" ) { object->splitSelectedFace(); } \ No newline at end of file diff --git a/Engine/source/gui/worldEditor/guiDecalEditorCtrl.cpp b/Engine/source/gui/worldEditor/guiDecalEditorCtrl.cpp index 6712d7762..1d76d3d30 100644 --- a/Engine/source/gui/worldEditor/guiDecalEditorCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiDecalEditorCtrl.cpp @@ -784,12 +784,12 @@ void GuiDecalEditorCtrl::setMode( String mode, bool sourceShortcut = false ) Con::executef( this, "paletteSync", mMode ); } -DefineConsoleMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, (), , "deleteSelectedDecal()" ) +DefineEngineMethod( GuiDecalEditorCtrl, deleteSelectedDecal, void, (), , "deleteSelectedDecal()" ) { object->deleteSelectedDecal(); } -DefineConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const char * datablock ), , "deleteSelectedDecalDatablock( String datablock )" ) +DefineEngineMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const char * datablock ), , "deleteSelectedDecalDatablock( String datablock )" ) { String lookupName( datablock ); if( lookupName == String::EmptyString ) @@ -798,22 +798,22 @@ DefineConsoleMethod( GuiDecalEditorCtrl, deleteDecalDatablock, void, ( const cha object->deleteDecalDatablock( lookupName ); } -DefineConsoleMethod( GuiDecalEditorCtrl, setMode, void, ( String newMode ), , "setMode( String mode )()" ) +DefineEngineMethod( GuiDecalEditorCtrl, setMode, void, ( String newMode ), , "setMode( String mode )()" ) { object->setMode( newMode ); } -DefineConsoleMethod( GuiDecalEditorCtrl, getMode, const char*, (), , "getMode()" ) +DefineEngineMethod( GuiDecalEditorCtrl, getMode, const char*, (), , "getMode()" ) { return object->mMode; } -DefineConsoleMethod( GuiDecalEditorCtrl, getDecalCount, S32, (), , "getDecalCount()" ) +DefineEngineMethod( GuiDecalEditorCtrl, getDecalCount, S32, (), , "getDecalCount()" ) { return gDecalManager->mDecalInstanceVec.size(); } -DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 id ), , "getDecalTransform()" ) +DefineEngineMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 id ), , "getDecalTransform()" ) { DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id]; @@ -835,7 +835,7 @@ DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 i return returnBuffer; } -DefineConsoleMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, ( U32 id ), , "getDecalLookupName( S32 )()" ) +DefineEngineMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, ( U32 id ), , "getDecalLookupName( S32 )()" ) { DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id]; if( decalInstance == NULL ) @@ -844,7 +844,7 @@ DefineConsoleMethod( GuiDecalEditorCtrl, getDecalLookupName, const char*, ( U32 return decalInstance->mDataBlock->lookupName; } -DefineConsoleMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "selectDecal( S32 )()" ) +DefineEngineMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "selectDecal( S32 )()" ) { DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id]; if( decalInstance == NULL ) @@ -853,7 +853,7 @@ DefineConsoleMethod( GuiDecalEditorCtrl, selectDecal, void, ( U32 id ), , "selec object->selectDecal( decalInstance ); } -DefineConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3F pos, Point3F tan,F32 size ), , "editDecalDetails( S32 )()" ) +DefineEngineMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point3F pos, Point3F tan,F32 size ), , "editDecalDetails( S32 )()" ) { DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id]; if( decalInstance == NULL ) @@ -872,14 +872,14 @@ DefineConsoleMethod( GuiDecalEditorCtrl, editDecalDetails, void, ( U32 id, Point gDecalManager->notifyDecalModified( decalInstance ); } -DefineConsoleMethod( GuiDecalEditorCtrl, getSelectionCount, S32, (), , "" ) +DefineEngineMethod( GuiDecalEditorCtrl, getSelectionCount, S32, (), , "" ) { if ( object->mSELDecal != NULL ) return 1; return 0; } -DefineConsoleMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, ( const char * dbFrom, const char * dbTo ), , "" ) +DefineEngineMethod( GuiDecalEditorCtrl, retargetDecalDatablock, void, ( const char * dbFrom, const char * dbTo ), , "" ) { if( dStrcmp( dbFrom, "" ) != 0 && dStrcmp( dbTo, "" ) != 0 ) object->retargetDecalDatablock( dbFrom, dbTo ); diff --git a/Engine/source/gui/worldEditor/guiMissionAreaEditor.cpp b/Engine/source/gui/worldEditor/guiMissionAreaEditor.cpp index 411fd074a..839d39017 100644 --- a/Engine/source/gui/worldEditor/guiMissionAreaEditor.cpp +++ b/Engine/source/gui/worldEditor/guiMissionAreaEditor.cpp @@ -95,7 +95,7 @@ void GuiMissionAreaEditorCtrl::setSelectedMissionArea( MissionArea *missionArea Con::executef( this, "onMissionAreaSelected" ); } -DefineConsoleMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (const char * missionAreaName), (""), "" ) +DefineEngineMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (const char * missionAreaName), (""), "" ) { if ( dStrcmp( missionAreaName, "" )==0 ) object->setSelectedMissionArea(NULL); @@ -107,7 +107,7 @@ DefineConsoleMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (co } } -DefineConsoleMethod( GuiMissionAreaEditorCtrl, getSelectedMissionArea, const char*, (), , "" ) +DefineEngineMethod( GuiMissionAreaEditorCtrl, getSelectedMissionArea, const char*, (), , "" ) { MissionArea *missionArea = object->getSelectedMissionArea(); if ( !missionArea ) diff --git a/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp b/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp index 18db8de5f..0d3c988bf 100644 --- a/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiTerrPreviewCtrl.cpp @@ -88,35 +88,35 @@ void GuiTerrPreviewCtrl::initPersistFields() } -DefineConsoleMethod( GuiTerrPreviewCtrl, reset, void, (), , "Reset the view of the terrain.") +DefineEngineMethod( GuiTerrPreviewCtrl, reset, void, (), , "Reset the view of the terrain.") { object->reset(); } -DefineConsoleMethod( GuiTerrPreviewCtrl, setRoot, void, (), , "Add the origin to the root and reset the origin.") +DefineEngineMethod( GuiTerrPreviewCtrl, setRoot, void, (), , "Add the origin to the root and reset the origin.") { object->setRoot(); } -DefineConsoleMethod( GuiTerrPreviewCtrl, getRoot, Point2F, (), , "Return a Point2F representing the position of the root.") +DefineEngineMethod( GuiTerrPreviewCtrl, getRoot, Point2F, (), , "Return a Point2F representing the position of the root.") { return object->getRoot(); } -DefineConsoleMethod( GuiTerrPreviewCtrl, setOrigin, void, (Point2F pos), , "(float x, float y)" +DefineEngineMethod( GuiTerrPreviewCtrl, setOrigin, void, (Point2F pos), , "(float x, float y)" "Set the origin of the view.") { object->setOrigin( pos ); } -DefineConsoleMethod( GuiTerrPreviewCtrl, getOrigin, Point2F, (), , "Return a Point2F containing the position of the origin.") +DefineEngineMethod( GuiTerrPreviewCtrl, getOrigin, Point2F, (), , "Return a Point2F containing the position of the origin.") { return object->getOrigin(); } -DefineConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a 4-tuple containing: root_x root_y origin_x origin_y") +DefineEngineMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a 4-tuple containing: root_x root_y origin_x origin_y") { Point2F r = object->getRoot(); Point2F o = object->getOrigin(); @@ -126,7 +126,7 @@ DefineConsoleMethod( GuiTerrPreviewCtrl, getValue, const char*, (), , "Returns a return valuebuf; } -DefineConsoleMethod( GuiTerrPreviewCtrl, setValue, void, (const char * tuple), , "Accepts a 4-tuple in the same form as getValue returns.\n\n" +DefineEngineMethod( GuiTerrPreviewCtrl, setValue, void, (const char * tuple), , "Accepts a 4-tuple in the same form as getValue returns.\n\n" "@see GuiTerrPreviewCtrl::getValue()") { Point2F r,o; diff --git a/Engine/source/gui/worldEditor/terrainActions.cpp b/Engine/source/gui/worldEditor/terrainActions.cpp index 11360f82d..b64cade26 100644 --- a/Engine/source/gui/worldEditor/terrainActions.cpp +++ b/Engine/source/gui/worldEditor/terrainActions.cpp @@ -795,7 +795,7 @@ void TerrainSmoothAction::smooth( TerrainBlock *terrain, F32 factor, U32 steps ) redo(); } -DefineConsoleMethod( TerrainSmoothAction, smooth, void, ( TerrainBlock *terrain, F32 factor, U32 steps ), , "( TerrainBlock obj, F32 factor, U32 steps )") +DefineEngineMethod( TerrainSmoothAction, smooth, void, ( TerrainBlock *terrain, F32 factor, U32 steps ), , "( TerrainBlock obj, F32 factor, U32 steps )") { if (terrain) object->smooth( terrain, factor, mClamp( steps, 1, 13 ) ); diff --git a/Engine/source/gui/worldEditor/terrainEditor.cpp b/Engine/source/gui/worldEditor/terrainEditor.cpp index 8e81d84e3..f1bf5fd58 100644 --- a/Engine/source/gui/worldEditor/terrainEditor.cpp +++ b/Engine/source/gui/worldEditor/terrainEditor.cpp @@ -2403,7 +2403,7 @@ void TerrainEditor::reorderMaterial( S32 index, S32 orderPos ) //------------------------------------------------------------------------------ -DefineConsoleMethod( TerrainEditor, attachTerrain, void, (const char * terrain), (""), "(TerrainBlock terrain)") +DefineEngineMethod( TerrainEditor, attachTerrain, void, (const char * terrain), (""), "(TerrainBlock terrain)") { SimSet * missionGroup = dynamic_cast(Sim::findObject("MissionGroup")); if (!missionGroup) @@ -2459,12 +2459,12 @@ DefineConsoleMethod( TerrainEditor, attachTerrain, void, (const char * terrain), } } -DefineConsoleMethod( TerrainEditor, getTerrainBlockCount, S32, (), , "()") +DefineEngineMethod( TerrainEditor, getTerrainBlockCount, S32, (), , "()") { return object->getTerrainBlockCount(); } -DefineConsoleMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 index)") +DefineEngineMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 index)") { TerrainBlock* tb = object->getTerrainBlock(index); if(!tb) @@ -2473,7 +2473,7 @@ DefineConsoleMethod( TerrainEditor, getTerrainBlock, S32, (S32 index), , "(S32 i return tb->getId(); } -DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (), , "() gets the list of current terrain materials for all terrain blocks.") +DefineEngineMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, (), , "() gets the list of current terrain materials for all terrain blocks.") { Vector list; object->getTerrainBlocksMaterialList(list); @@ -2502,23 +2502,23 @@ DefineConsoleMethod(TerrainEditor, getTerrainBlocksMaterialList, const char *, ( return ret; } -DefineConsoleMethod( TerrainEditor, setBrushType, void, (String type), , "(string type)" +DefineEngineMethod( TerrainEditor, setBrushType, void, (String type), , "(string type)" "One of box, ellipse, selection.") { object->setBrushType(type); } -DefineConsoleMethod( TerrainEditor, getBrushType, const char*, (), , "()") +DefineEngineMethod( TerrainEditor, getBrushType, const char*, (), , "()") { return object->getBrushType(); } -DefineConsoleMethod( TerrainEditor, setBrushSize, void, ( S32 w, S32 h), (0), "(int w [, int h])") +DefineEngineMethod( TerrainEditor, setBrushSize, void, ( S32 w, S32 h), (0), "(int w [, int h])") { object->setBrushSize( w, h==0?w:h ); } -DefineConsoleMethod( TerrainEditor, getBrushSize, const char*, (), , "()") +DefineEngineMethod( TerrainEditor, getBrushSize, const char*, (), , "()") { Point2I size = object->getBrushSize(); @@ -2528,74 +2528,74 @@ DefineConsoleMethod( TerrainEditor, getBrushSize, const char*, (), , "()") return ret; } -DefineConsoleMethod( TerrainEditor, setBrushPressure, void, (F32 pressure), , "(float pressure)") +DefineEngineMethod( TerrainEditor, setBrushPressure, void, (F32 pressure), , "(float pressure)") { object->setBrushPressure( pressure ); } -DefineConsoleMethod( TerrainEditor, getBrushPressure, F32, (), , "()") +DefineEngineMethod( TerrainEditor, getBrushPressure, F32, (), , "()") { return object->getBrushPressure(); } -DefineConsoleMethod( TerrainEditor, setBrushSoftness, void, (F32 softness), , "(float softness)") +DefineEngineMethod( TerrainEditor, setBrushSoftness, void, (F32 softness), , "(float softness)") { object->setBrushSoftness( softness ); } -DefineConsoleMethod( TerrainEditor, getBrushSoftness, F32, (), , "()") +DefineEngineMethod( TerrainEditor, getBrushSoftness, F32, (), , "()") { return object->getBrushSoftness(); } -DefineConsoleMethod( TerrainEditor, getBrushPos, const char*, (), , "Returns a Point2I.") +DefineEngineMethod( TerrainEditor, getBrushPos, const char*, (), , "Returns a Point2I.") { return object->getBrushPos(); } -DefineConsoleMethod( TerrainEditor, setBrushPos, void, (Point2I pos), , "Location") +DefineEngineMethod( TerrainEditor, setBrushPos, void, (Point2I pos), , "Location") { object->setBrushPos(pos); } -DefineConsoleMethod( TerrainEditor, setAction, void, (const char * action_name), , "(string action_name)") +DefineEngineMethod( TerrainEditor, setAction, void, (const char * action_name), , "(string action_name)") { object->setAction(action_name); } -DefineConsoleMethod( TerrainEditor, getActionName, const char*, (U32 index), , "(int num)") +DefineEngineMethod( TerrainEditor, getActionName, const char*, (U32 index), , "(int num)") { return (object->getActionName(index)); } -DefineConsoleMethod( TerrainEditor, getNumActions, S32, (), , "") +DefineEngineMethod( TerrainEditor, getNumActions, S32, (), , "") { return(object->getNumActions()); } -DefineConsoleMethod( TerrainEditor, getCurrentAction, const char*, (), , "") +DefineEngineMethod( TerrainEditor, getCurrentAction, const char*, (), , "") { return object->getCurrentAction(); } -DefineConsoleMethod( TerrainEditor, resetSelWeights, void, (bool clear), , "(bool clear)") +DefineEngineMethod( TerrainEditor, resetSelWeights, void, (bool clear), , "(bool clear)") { object->resetSelWeights(clear); } -DefineConsoleMethod( TerrainEditor, clearSelection, void, (), , "") +DefineEngineMethod( TerrainEditor, clearSelection, void, (), , "") { object->clearSelection(); } -DefineConsoleMethod( TerrainEditor, processAction, void, (String action), (""), "(string action=NULL)") +DefineEngineMethod( TerrainEditor, processAction, void, (String action), (""), "(string action=NULL)") { object->processAction(action); } -DefineConsoleMethod( TerrainEditor, getActiveTerrain, S32, (), , "") +DefineEngineMethod( TerrainEditor, getActiveTerrain, S32, (), , "") { S32 ret = 0; @@ -2607,27 +2607,27 @@ DefineConsoleMethod( TerrainEditor, getActiveTerrain, S32, (), , "") return ret; } -DefineConsoleMethod( TerrainEditor, getNumTextures, S32, (), , "") +DefineEngineMethod( TerrainEditor, getNumTextures, S32, (), , "") { return object->getNumTextures(); } -DefineConsoleMethod( TerrainEditor, markEmptySquares, void, (), , "") +DefineEngineMethod( TerrainEditor, markEmptySquares, void, (), , "") { object->markEmptySquares(); } -DefineConsoleMethod( TerrainEditor, mirrorTerrain, void, (S32 mirrorIndex), , "") +DefineEngineMethod( TerrainEditor, mirrorTerrain, void, (S32 mirrorIndex), , "") { object->mirrorTerrain(mirrorIndex); } -DefineConsoleMethod(TerrainEditor, setTerraformOverlay, void, (bool overlayEnable), , "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.") +DefineEngineMethod(TerrainEditor, setTerraformOverlay, void, (bool overlayEnable), , "(bool overlayEnable) - sets the terraformer current heightmap to draw as an overlay over the current terrain.") { // XA: This one needs to be implemented :) } -DefineConsoleMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String matName ), , +DefineEngineMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String matName ), , "( int index, string matName )\n" "Changes the material name at the index." ) { @@ -2645,7 +2645,7 @@ DefineConsoleMethod(TerrainEditor, updateMaterial, bool, ( U32 index, String mat return true; } -DefineConsoleMethod(TerrainEditor, addMaterial, S32, ( String matName ), , +DefineEngineMethod(TerrainEditor, addMaterial, S32, ( String matName ), , "( string matName )\n" "Adds a new material." ) { @@ -2660,7 +2660,7 @@ DefineConsoleMethod(TerrainEditor, addMaterial, S32, ( String matName ), , return true; } -DefineConsoleMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( int index ) - Remove the material at the given index." ) +DefineEngineMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( int index ) - Remove the material at the given index." ) { TerrainBlock *terr = object->getClientTerrain(); if ( !terr ) @@ -2689,7 +2689,7 @@ DefineConsoleMethod( TerrainEditor, removeMaterial, void, ( S32 index ), , "( in object->setGridUpdateMinMax(); } -DefineConsoleMethod(TerrainEditor, getMaterialCount, S32, (), , +DefineEngineMethod(TerrainEditor, getMaterialCount, S32, (), , "Returns the current material count." ) { TerrainBlock *terr = object->getClientTerrain(); @@ -2699,7 +2699,7 @@ DefineConsoleMethod(TerrainEditor, getMaterialCount, S32, (), , return 0; } -DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets the list of current terrain materials.") +DefineEngineMethod(TerrainEditor, getMaterials, const char *, (), , "() gets the list of current terrain materials.") { TerrainBlock *terr = object->getClientTerrain(); if ( !terr ) @@ -2716,7 +2716,7 @@ DefineConsoleMethod(TerrainEditor, getMaterials, const char *, (), , "() gets th return ret; } -DefineConsoleMethod( TerrainEditor, getMaterialName, const char*, (S32 index), , "( int index ) - Returns the name of the material at the given index." ) +DefineEngineMethod( TerrainEditor, getMaterialName, const char*, (S32 index), , "( int index ) - Returns the name of the material at the given index." ) { TerrainBlock *terr = object->getClientTerrain(); if ( !terr ) @@ -2732,7 +2732,7 @@ DefineConsoleMethod( TerrainEditor, getMaterialName, const char*, (S32 index), , return Con::getReturnBuffer( name ); } -DefineConsoleMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "( string name ) - Returns the index of the material with the given name or -1." ) +DefineEngineMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "( string name ) - Returns the index of the material with the given name or -1." ) { TerrainBlock *terr = object->getClientTerrain(); if ( !terr ) @@ -2747,13 +2747,13 @@ DefineConsoleMethod( TerrainEditor, getMaterialIndex, S32, ( String name ), , "( return -1; } -DefineConsoleMethod( TerrainEditor, reorderMaterial, void, ( S32 index, S32 orderPos ), , "( int index, int order ) " +DefineEngineMethod( TerrainEditor, reorderMaterial, void, ( S32 index, S32 orderPos ), , "( int index, int order ) " "- Reorder material at the given index to the new position, changing the order in which it is rendered / blended." ) { object->reorderMaterial( index, orderPos ); } -DefineConsoleMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, (const char * ptOrX, const char * Y, const char * Z), ("", "", ""), +DefineEngineMethod(TerrainEditor, getTerrainUnderWorldPoint, S32, (const char * ptOrX, const char * Y, const char * Z), ("", "", ""), "(x/y/z) Gets the terrain block that is located under the given world point.\n" "@param x/y/z The world coordinates (floating point values) you wish to query at. " "These can be formatted as either a string (\"x y z\") or separately as (x, y, z)\n" @@ -2822,12 +2822,12 @@ void TerrainEditor::initPersistFields() Parent::initPersistFields(); } -DefineConsoleMethod( TerrainEditor, getSlopeLimitMinAngle, F32, (), , "") +DefineEngineMethod( TerrainEditor, getSlopeLimitMinAngle, F32, (), , "") { return object->mSlopeMinAngle; } -DefineConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , "") +DefineEngineMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , "") { if ( angle < 0.0f ) angle = 0.0f; @@ -2838,12 +2838,12 @@ DefineConsoleMethod( TerrainEditor, setSlopeLimitMinAngle, F32, (F32 angle), , " return angle; } -DefineConsoleMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, (), , "") +DefineEngineMethod( TerrainEditor, getSlopeLimitMaxAngle, F32, (), , "") { return object->mSlopeMaxAngle; } -DefineConsoleMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "") +DefineEngineMethod( TerrainEditor, setSlopeLimitMaxAngle, F32, (F32 angle), , "") { if ( angle > 90.0f ) angle = 90.0f; diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index b66ead790..24e710091 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -3252,7 +3252,7 @@ DefineEngineMethod( WorldEditor, getActiveSelection, S32, (),, return object->getActiveSelectionSet()->getId(); } -DefineConsoleMethod( WorldEditor, setActiveSelection, void, ( WorldEditorSelection* selection), , +DefineEngineMethod( WorldEditor, setActiveSelection, void, ( WorldEditorSelection* selection), , "Set the currently active WorldEditorSelection object.\n" "@param selection A WorldEditorSelectionSet object to use for the selection container.") { diff --git a/Engine/source/i18n/lang.cpp b/Engine/source/i18n/lang.cpp index 7e1efe4a5..b1fa76c6a 100644 --- a/Engine/source/i18n/lang.cpp +++ b/Engine/source/i18n/lang.cpp @@ -329,7 +329,7 @@ void LangTable::setCurrentLanguage(S32 langid) -DefineConsoleMethod(LangTable, addLanguage, S32, (String filename, String languageName), ("", ""), +DefineEngineMethod(LangTable, addLanguage, S32, (String filename, String languageName), ("", ""), "(string filename, [string languageName])" "@brief Adds a language to the table\n\n" "@param filename Name and path to the language file\n" @@ -343,7 +343,7 @@ DefineConsoleMethod(LangTable, addLanguage, S32, (String filename, String langua return object->addLanguage(scriptFilenameBuffer, (const UTF8*)languageName); } -DefineConsoleMethod(LangTable, getString, const char *, (U32 id), , +DefineEngineMethod(LangTable, getString, const char *, (U32 id), , "(string filename)" "@brief Grabs a string from the specified table\n\n" "If an invalid is passed, the function will attempt to " @@ -363,14 +363,14 @@ DefineConsoleMethod(LangTable, getString, const char *, (U32 id), , return ""; } -DefineConsoleMethod(LangTable, setDefaultLanguage, void, (S32 langId), , "(int language)" +DefineEngineMethod(LangTable, setDefaultLanguage, void, (S32 langId), , "(int language)" "@brief Sets the default language table\n\n" "@param language ID of the table\n") { object->setDefaultLanguage(langId); } -DefineConsoleMethod(LangTable, setCurrentLanguage, void, (S32 langId), , +DefineEngineMethod(LangTable, setCurrentLanguage, void, (S32 langId), , "(int language)" "@brief Sets the current language table for grabbing text\n\n" "@param language ID of the table\n") @@ -378,14 +378,14 @@ DefineConsoleMethod(LangTable, setCurrentLanguage, void, (S32 langId), , object->setCurrentLanguage(langId); } -DefineConsoleMethod(LangTable, getCurrentLanguage, S32, (), , "()" +DefineEngineMethod(LangTable, getCurrentLanguage, S32, (), , "()" "@brief Get the ID of the current language table\n\n" "@return Numerical ID of the current language table") { return object->getCurrentLanguage(); } -DefineConsoleMethod(LangTable, getLangName, const char *, (S32 langId), , "(int language)" +DefineEngineMethod(LangTable, getLangName, const char *, (S32 langId), , "(int language)" "@brief Return the readable name of the language table\n\n" "@param language Numerical ID of the language table to access\n\n" "@return String containing the name of the table, NULL if ID was invalid or name was never specified") @@ -402,7 +402,7 @@ DefineConsoleMethod(LangTable, getLangName, const char *, (S32 langId), , "(int return ""; } -DefineConsoleMethod(LangTable, getNumLang, S32, (), , "()" +DefineEngineMethod(LangTable, getNumLang, S32, (), , "()" "@brief Used to find out how many languages are in the table\n\n" "@return Size of the vector containing the languages, numerical") { diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 3ef1b1d01..9fd3f857a 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -629,25 +629,25 @@ void Material::StageData::getFeatureSet( FeatureSet *outFeatures ) const } } -DefineConsoleMethod( Material, flush, void, (),, +DefineEngineMethod( Material, flush, void, (),, "Flushes all material instances that use this material." ) { object->flush(); } -DefineConsoleMethod( Material, reload, void, (),, +DefineEngineMethod( Material, reload, void, (),, "Reloads all material instances that use this material." ) { object->reload(); } -DefineConsoleMethod( Material, dumpInstances, void, (),, +DefineEngineMethod( Material, dumpInstances, void, (),, "Dumps a formatted list of the currently allocated material instances for this material to the console." ) { MATMGR->dumpMaterialInstances( object ); } -DefineConsoleMethod( Material, getAnimFlags, const char*, (U32 id), , "" ) +DefineEngineMethod( Material, getAnimFlags, const char*, (U32 id), , "" ) { char * animFlags = Con::getReturnBuffer(512); @@ -688,19 +688,19 @@ DefineConsoleMethod( Material, getAnimFlags, const char*, (U32 id), , "" ) return animFlags; } -DefineConsoleMethod(Material, getFilename, const char*, (),, "Get filename of material") +DefineEngineMethod(Material, getFilename, const char*, (),, "Get filename of material") { SimObject *material = static_cast(object); return material->getFilename(); } -DefineConsoleMethod( Material, isAutoGenerated, bool, (),, +DefineEngineMethod( Material, isAutoGenerated, bool, (),, "Returns true if this Material was automatically generated by MaterialList::mapMaterials()" ) { return object->isAutoGenerated(); } -DefineConsoleMethod( Material, setAutoGenerated, void, (bool isAutoGenerated), , +DefineEngineMethod( Material, setAutoGenerated, void, (bool isAutoGenerated), , "setAutoGenerated(bool isAutoGenerated): Set whether or not the Material is autogenerated." ) { object->setAutoGenerated(isAutoGenerated); diff --git a/Engine/source/math/util/tResponseCurve.cpp b/Engine/source/math/util/tResponseCurve.cpp index 2c1d5c53c..f6c7cfb74 100644 --- a/Engine/source/math/util/tResponseCurve.cpp +++ b/Engine/source/math/util/tResponseCurve.cpp @@ -64,17 +64,17 @@ void SimResponseCurve::clear() mCurve.clear(); } -DefineConsoleMethod( SimResponseCurve, addPoint, void, ( F32 value, F32 time ), , "addPoint( F32 value, F32 time )" ) +DefineEngineMethod( SimResponseCurve, addPoint, void, ( F32 value, F32 time ), , "addPoint( F32 value, F32 time )" ) { object->addPoint( value, time ); } -DefineConsoleMethod( SimResponseCurve, getValue, F32, ( F32 time ), , "getValue( F32 time )" ) +DefineEngineMethod( SimResponseCurve, getValue, F32, ( F32 time ), , "getValue( F32 time )" ) { return object->getValue( time ); } -DefineConsoleMethod( SimResponseCurve, clear, void, (), , "clear()" ) +DefineEngineMethod( SimResponseCurve, clear, void, (), , "clear()" ) { object->clear(); } \ No newline at end of file diff --git a/Engine/source/scene/sceneObject.cpp b/Engine/source/scene/sceneObject.cpp index a6be00320..ff7b6496c 100644 --- a/Engine/source/scene/sceneObject.cpp +++ b/Engine/source/scene/sceneObject.cpp @@ -1517,7 +1517,7 @@ DefineEngineMethod( SceneObject, isGlobalBounds, bool, (),, return object->isGlobalBounds(); } -DefineConsoleMethod(SceneObject, setForwardVector, void, (VectorF newForward, VectorF upVector), (VectorF(0, 0, 0), VectorF(0, 0, 1)), +DefineEngineMethod(SceneObject, setForwardVector, void, (VectorF newForward, VectorF upVector), (VectorF(0, 0, 0), VectorF(0, 0, 1)), "Sets the forward vector of a scene object, making it face Y+ along the new vector.\n" "@param The new forward vector to set.\n" "@param (Optional) The up vector to use to help orient the rotation.") diff --git a/Engine/source/sfx/sfxSource.cpp b/Engine/source/sfx/sfxSource.cpp index e40dd5073..2beb34634 100644 --- a/Engine/source/sfx/sfxSource.cpp +++ b/Engine/source/sfx/sfxSource.cpp @@ -1569,7 +1569,7 @@ static ConsoleDocFragment _sSetTransform2( "void setTransform( Point3F position, Point3F direction )" ); -DefineConsoleMethod( SFXSource, setTransform, void, ( const char * position, const char * direction ), ( "" ), +DefineEngineMethod( SFXSource, setTransform, void, ( const char * position, const char * direction ), ( "" ), "( vector position [, vector direction ] ) " "Set the position and orientation of a 3D sound source.\n" "@hide" ) diff --git a/Engine/source/terrain/terrExport.cpp b/Engine/source/terrain/terrExport.cpp index 8941c8b26..78b63eeb1 100644 --- a/Engine/source/terrain/terrExport.cpp +++ b/Engine/source/terrain/terrExport.cpp @@ -137,7 +137,7 @@ bool TerrainBlock::exportLayerMaps( const UTF8 *filePrefix, const String &format return true; } -DefineConsoleMethod( TerrainBlock, exportHeightMap, bool, (const char * fileNameStr, const char * format), ( "png"), "(string filename, [string format]) - export the terrain block's heightmap to a bitmap file (default: png)" ) +DefineEngineMethod( TerrainBlock, exportHeightMap, bool, (const char * fileNameStr, const char * format), ( "png"), "(string filename, [string format]) - export the terrain block's heightmap to a bitmap file (default: png)" ) { UTF8 fileName[1024]; Con::expandScriptFilename( fileName, sizeof( fileName ), fileNameStr ); @@ -145,7 +145,7 @@ DefineConsoleMethod( TerrainBlock, exportHeightMap, bool, (const char * fileName return object->exportHeightMap( fileName, format ); } -DefineConsoleMethod( TerrainBlock, exportLayerMaps, bool, (const char * filePrefixStr, const char * format), ( "png"), "(string filePrefix, [string format]) - export the terrain block's layer maps to bitmap files (default: png)" ) +DefineEngineMethod( TerrainBlock, exportLayerMaps, bool, (const char * filePrefixStr, const char * format), ( "png"), "(string filePrefix, [string format]) - export the terrain block's layer maps to bitmap files (default: png)" ) { UTF8 filePrefix[1024]; Con::expandScriptFilename( filePrefix, sizeof( filePrefix ), filePrefixStr ); diff --git a/Engine/source/util/messaging/eventManager.cpp b/Engine/source/util/messaging/eventManager.cpp index 0edfa98fc..03b03228e 100644 --- a/Engine/source/util/messaging/eventManager.cpp +++ b/Engine/source/util/messaging/eventManager.cpp @@ -420,7 +420,7 @@ void EventManager::dumpSubscribers() //----------------------------------------------------------------------------- // Console Methods //----------------------------------------------------------------------------- -DefineConsoleMethod( EventManager, registerEvent, bool, ( const char * evt ), , "( String event )\n" +DefineEngineMethod( EventManager, registerEvent, bool, ( const char * evt ), , "( String event )\n" "Register an event with the event manager.\n" "@param event The event to register.\n" "@return Whether or not the event was registered successfully." ) @@ -428,14 +428,14 @@ DefineConsoleMethod( EventManager, registerEvent, bool, ( const char * evt ), , return object->registerEvent( evt ); } -DefineConsoleMethod( EventManager, unregisterEvent, void, ( const char * evt ), , "( String event )\n" +DefineEngineMethod( EventManager, unregisterEvent, void, ( const char * evt ), , "( String event )\n" "Remove an event from the EventManager.\n" "@param event The event to remove.\n" ) { object->unregisterEvent( evt ); } -DefineConsoleMethod( EventManager, isRegisteredEvent, bool, ( const char * evt ), , "( String event )\n" +DefineEngineMethod( EventManager, isRegisteredEvent, bool, ( const char * evt ), , "( String event )\n" "Check if an event is registered or not.\n" "@param event The event to check.\n" "@return Whether or not the event exists." ) @@ -443,7 +443,7 @@ DefineConsoleMethod( EventManager, isRegisteredEvent, bool, ( const char * evt ) return object->isRegisteredEvent( evt ); } -DefineConsoleMethod( EventManager, postEvent, bool, ( const char * evt, const char * data ), (""), "( String event, String data )\n" +DefineEngineMethod( EventManager, postEvent, bool, ( const char * evt, const char * data ), (""), "( String event, String data )\n" "~Trigger an event.\n" "@param event The event to trigger.\n" "@param data The data associated with the event.\n" @@ -458,7 +458,7 @@ DefineConsoleMethod( EventManager, postEvent, bool, ( const char * evt, const ch return object->postEvent( evt, data ); } -DefineConsoleMethod( EventManager, subscribe, bool, ( const char * listenerName, const char * evt, const char * callback ), (""), "( SimObject listener, String event, String callback )\n\n" +DefineEngineMethod( EventManager, subscribe, bool, ( const char * listenerName, const char * evt, const char * callback ), (""), "( SimObject listener, String event, String callback )\n\n" "Subscribe a listener to an event.\n" "@param listener The listener to subscribe.\n" "@param event The event to subscribe to.\n" @@ -476,7 +476,7 @@ DefineConsoleMethod( EventManager, subscribe, bool, ( const char * listenerName, return object->subscribe( cbObj, evt, callback ); } -DefineConsoleMethod( EventManager, remove, void, ( const char * listenerName, const char * evt), , "( SimObject listener, String event )\n\n" +DefineEngineMethod( EventManager, remove, void, ( const char * listenerName, const char * evt), , "( SimObject listener, String event )\n\n" "Remove a listener from an event.\n" "@param listener The listener to remove.\n" "@param event The event to be removed from.\n") @@ -487,7 +487,7 @@ DefineConsoleMethod( EventManager, remove, void, ( const char * listenerName, co object->remove( listener, evt ); } -DefineConsoleMethod( EventManager, removeAll, void, ( const char * listenerName ), , "( SimObject listener )\n\n" +DefineEngineMethod( EventManager, removeAll, void, ( const char * listenerName ), , "( SimObject listener )\n\n" "Remove a listener from all events.\n" "@param listener The listener to remove.\n") { @@ -498,13 +498,13 @@ DefineConsoleMethod( EventManager, removeAll, void, ( const char * listenerName object->removeAll( listener ); } -DefineConsoleMethod( EventManager, dumpEvents, void, (), , "()\n\n" +DefineEngineMethod( EventManager, dumpEvents, void, (), , "()\n\n" "Print all registered events to the console." ) { object->dumpEvents(); } -DefineConsoleMethod( EventManager, dumpSubscribers, void, ( const char * listenerName ), (""), "( String event )\n\n" +DefineEngineMethod( EventManager, dumpSubscribers, void, ( const char * listenerName ), (""), "( String event )\n\n" "Print all subscribers to an event to the console.\n" "@param event The event whose subscribers are to be printed. If this parameter isn't specified, all events will be dumped." ) { diff --git a/Engine/source/util/messaging/message.cpp b/Engine/source/util/messaging/message.cpp index 7e2b7af08..137242c56 100644 --- a/Engine/source/util/messaging/message.cpp +++ b/Engine/source/util/messaging/message.cpp @@ -155,19 +155,19 @@ const char *Message::getType() // Console Methods //----------------------------------------------------------------------------- -DefineConsoleMethod(Message, getType, const char *, (), , "() Get message type (script class name or C++ class name if no script defined class)") +DefineEngineMethod(Message, getType, const char *, (), , "() Get message type (script class name or C++ class name if no script defined class)") { return object->getType(); } //----------------------------------------------------------------------------- -DefineConsoleMethod(Message, addReference, void, (), , "() Increment the reference count for this message") +DefineEngineMethod(Message, addReference, void, (), , "() Increment the reference count for this message") { object->addReference(); } -DefineConsoleMethod(Message, freeReference, void, (), , "() Decrement the reference count for this message") +DefineEngineMethod(Message, freeReference, void, (), , "() Decrement the reference count for this message") { object->freeReference(); } diff --git a/Engine/source/util/settings.cpp b/Engine/source/util/settings.cpp index b57b77bb4..60f58966e 100644 --- a/Engine/source/util/settings.cpp +++ b/Engine/source/util/settings.cpp @@ -482,12 +482,12 @@ const char* Settings::findNextValue() } // make sure to replace the strings -DefineConsoleMethod(Settings, findFirstValue, const char*, ( const char* pattern, bool deepSearch, bool includeDefaults ), ("", false, false), "settingObj.findFirstValue();") +DefineEngineMethod(Settings, findFirstValue, const char*, ( const char* pattern, bool deepSearch, bool includeDefaults ), ("", false, false), "settingObj.findFirstValue();") { return object->findFirstValue( pattern, deepSearch, includeDefaults ); } -DefineConsoleMethod(Settings, findNextValue, const char*, (), , "settingObj.findNextValue();") +DefineEngineMethod(Settings, findNextValue, const char*, (), , "settingObj.findNextValue();") { return object->findNextValue(); } @@ -644,7 +644,7 @@ void SettingSaveNode::buildDocument(SimXMLDocument *document, bool skipWrite) document->popElement(); } -DefineConsoleMethod(Settings, setValue, void, (const char * settingName, const char * value), (""), "settingObj.setValue(settingName, value);") +DefineEngineMethod(Settings, setValue, void, (const char * settingName, const char * value), (""), "settingObj.setValue(settingName, value);") { StringTableEntry fieldName = StringTable->insert( settingName ); @@ -654,13 +654,13 @@ DefineConsoleMethod(Settings, setValue, void, (const char * settingName, const c object->setValue( fieldName ); } -DefineConsoleMethod(Settings, setDefaultValue, void, (const char * settingName, const char * value), , "settingObj.setDefaultValue(settingName, value);") +DefineEngineMethod(Settings, setDefaultValue, void, (const char * settingName, const char * value), , "settingObj.setDefaultValue(settingName, value);") { StringTableEntry fieldName = StringTable->insert( settingName ); object->setDefaultValue( fieldName, value ); } -DefineConsoleMethod(Settings, value, const char*, (const char * settingName, const char * defaultValue), (""), "settingObj.value(settingName, defaultValue);") +DefineEngineMethod(Settings, value, const char*, (const char * settingName, const char * defaultValue), (""), "settingObj.value(settingName, defaultValue);") { StringTableEntry fieldName = StringTable->insert( settingName ); @@ -672,7 +672,7 @@ DefineConsoleMethod(Settings, value, const char*, (const char * settingName, con return ""; } -DefineConsoleMethod(Settings, remove, void, (const char * settingName, bool includeDefaults), (false), "settingObj.remove(settingName, includeDefaults = false);") +DefineEngineMethod(Settings, remove, void, (const char * settingName, bool includeDefaults), (false), "settingObj.remove(settingName, includeDefaults = false);") { // there's a problem with some fields not being removed properly, but works if you run it twice, // a temporary solution for now is simply to call the remove twice @@ -687,27 +687,27 @@ ConsoleMethod(Settings, write, bool, 2, 2, "%success = settingObj.write();") return object->write(); } -DefineConsoleMethod(Settings, read, bool, (), , "%success = settingObj.read();") +DefineEngineMethod(Settings, read, bool, (), , "%success = settingObj.read();") { return object->read(); } -DefineConsoleMethod(Settings, beginGroup, void, (const char * groupName, bool includeDefaults), (false), "settingObj.beginGroup(groupName, fromStart = false);") +DefineEngineMethod(Settings, beginGroup, void, (const char * groupName, bool includeDefaults), (false), "settingObj.beginGroup(groupName, fromStart = false);") { object->beginGroup( groupName, includeDefaults ); } -DefineConsoleMethod(Settings, endGroup, void, (), , "settingObj.endGroup();") +DefineEngineMethod(Settings, endGroup, void, (), , "settingObj.endGroup();") { object->endGroup(); } -DefineConsoleMethod(Settings, clearGroups, void, (), , "settingObj.clearGroups();") +DefineEngineMethod(Settings, clearGroups, void, (), , "settingObj.clearGroups();") { object->clearGroups(); } -DefineConsoleMethod(Settings, getCurrentGroups, const char*, (), , "settingObj.getCurrentGroups();") +DefineEngineMethod(Settings, getCurrentGroups, const char*, (), , "settingObj.getCurrentGroups();") { return object->getCurrentGroups(); } \ No newline at end of file diff --git a/Engine/source/util/undo.cpp b/Engine/source/util/undo.cpp index 7ea0acc8c..ae6163774 100644 --- a/Engine/source/util/undo.cpp +++ b/Engine/source/util/undo.cpp @@ -145,7 +145,7 @@ void CompoundUndoAction::onDeleteNotify( SimObject* object ) Parent::onDeleteNotify( object ); } -DefineConsoleMethod( CompoundUndoAction, addAction, void, (const char * objName), , "addAction( UndoAction )" ) +DefineEngineMethod( CompoundUndoAction, addAction, void, (const char * objName), , "addAction( UndoAction )" ) { UndoAction *action; if ( Sim::findObject( objName, action ) ) @@ -206,7 +206,7 @@ UndoManager& UndoManager::getDefaultManager() return *defaultMan; } -DefineConsoleMethod(UndoManager, clearAll, void, (),, "Clears the undo manager.") +DefineEngineMethod(UndoManager, clearAll, void, (),, "Clears the undo manager.") { object->clearAll(); } @@ -344,7 +344,7 @@ void UndoManager::redo() (*react).redo(); } -DefineConsoleMethod(UndoManager, getUndoCount, S32, (),, "") +DefineEngineMethod(UndoManager, getUndoCount, S32, (),, "") { return object->getUndoCount(); } @@ -354,7 +354,7 @@ S32 UndoManager::getUndoCount() return mUndoStack.size(); } -DefineConsoleMethod(UndoManager, getUndoName, const char*, (S32 index), , "(index)") +DefineEngineMethod(UndoManager, getUndoName, const char*, (S32 index), , "(index)") { return object->getUndoName(index); } @@ -367,7 +367,7 @@ const char* UndoManager::getUndoName(S32 index) return NULL; } -DefineConsoleMethod(UndoManager, getUndoAction, S32, (S32 index), , "(index)") +DefineEngineMethod(UndoManager, getUndoAction, S32, (S32 index), , "(index)") { UndoAction * action = object->getUndoAction(index); if ( !action ) @@ -386,7 +386,7 @@ UndoAction* UndoManager::getUndoAction(S32 index) return NULL; } -DefineConsoleMethod(UndoManager, getRedoCount, S32, (),, "") +DefineEngineMethod(UndoManager, getRedoCount, S32, (),, "") { return object->getRedoCount(); } @@ -396,7 +396,7 @@ S32 UndoManager::getRedoCount() return mRedoStack.size(); } -DefineConsoleMethod(UndoManager, getRedoName, const char*, (S32 index), , "(index)") +DefineEngineMethod(UndoManager, getRedoName, const char*, (S32 index), , "(index)") { return object->getRedoName(index); } @@ -409,7 +409,7 @@ const char* UndoManager::getRedoName(S32 index) return NULL; } -DefineConsoleMethod(UndoManager, getRedoAction, S32, (S32 index), , "(index)") +DefineEngineMethod(UndoManager, getRedoAction, S32, (S32 index), , "(index)") { UndoAction * action = object->getRedoAction(index); @@ -501,7 +501,7 @@ void UndoManager::popCompound( bool discard ) } //----------------------------------------------------------------------------- -DefineConsoleMethod(UndoAction, addToManager, void, (const char * undoManager), (""), "action.addToManager([undoManager])") +DefineEngineMethod(UndoAction, addToManager, void, (const char * undoManager), (""), "action.addToManager([undoManager])") { UndoManager *theMan = NULL; if (!String::isEmpty(undoManager)) @@ -515,32 +515,32 @@ DefineConsoleMethod(UndoAction, addToManager, void, (const char * undoManager), //----------------------------------------------------------------------------- -DefineConsoleMethod( UndoAction, undo, void, (),, "() - Undo action contained in undo." ) +DefineEngineMethod( UndoAction, undo, void, (),, "() - Undo action contained in undo." ) { object->undo(); } //----------------------------------------------------------------------------- -DefineConsoleMethod( UndoAction, redo, void, (),, "() - Reo action contained in undo." ) +DefineEngineMethod( UndoAction, redo, void, (),, "() - Reo action contained in undo." ) { object->redo(); } //----------------------------------------------------------------------------- -DefineConsoleMethod(UndoManager, undo, void, (),, "UndoManager.undo();") +DefineEngineMethod(UndoManager, undo, void, (),, "UndoManager.undo();") { object->undo(); } //----------------------------------------------------------------------------- -DefineConsoleMethod(UndoManager, redo, void, (),, "UndoManager.redo();") +DefineEngineMethod(UndoManager, redo, void, (),, "UndoManager.redo();") { object->redo(); } //----------------------------------------------------------------------------- -DefineConsoleMethod(UndoManager, getNextUndoName, const char *, (),, "UndoManager.getNextUndoName();") +DefineEngineMethod(UndoManager, getNextUndoName, const char *, (),, "UndoManager.getNextUndoName();") { const char *name = object->getNextUndoName(); if(!name) @@ -552,7 +552,7 @@ DefineConsoleMethod(UndoManager, getNextUndoName, const char *, (),, "UndoManage } //----------------------------------------------------------------------------- -DefineConsoleMethod(UndoManager, getNextRedoName, const char *, (),, "UndoManager.getNextRedoName();") +DefineEngineMethod(UndoManager, getNextRedoName, const char *, (),, "UndoManager.getNextRedoName();") { const char *name = object->getNextRedoName(); if(!name) @@ -565,7 +565,7 @@ DefineConsoleMethod(UndoManager, getNextRedoName, const char *, (),, "UndoManage //----------------------------------------------------------------------------- -DefineConsoleMethod( UndoManager, pushCompound, const char*, ( String name ), ("\"\""), "( string name=\"\" ) - Push a CompoundUndoAction onto the compound stack for assembly." ) +DefineEngineMethod( UndoManager, pushCompound, const char*, ( String name ), ("\"\""), "( string name=\"\" ) - Push a CompoundUndoAction onto the compound stack for assembly." ) { CompoundUndoAction* action = object->pushCompound( name ); @@ -580,7 +580,7 @@ DefineConsoleMethod( UndoManager, pushCompound, const char*, ( String name ), (" //----------------------------------------------------------------------------- -DefineConsoleMethod( UndoManager, popCompound, void, ( bool discard ), (false), "( bool discard=false ) - Pop the current CompoundUndoAction off the stack." ) +DefineEngineMethod( UndoManager, popCompound, void, ( bool discard ), (false), "( bool discard=false ) - Pop the current CompoundUndoAction off the stack." ) { if( !object->getCompoundStackDepth() ) { From 6be736ff85c896b88c0bad2fcc8f93e1b8f4365d Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Tue, 17 Apr 2018 21:03:16 +0200 Subject: [PATCH 270/312] Eliminate DefineConsoleStaticMethod --- Engine/source/console/engineAPI.h | 54 ------------------------------- Engine/source/gfx/gfxInit.cpp | 2 +- 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index ca7ca8a1d..6d0484171 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -855,60 +855,6 @@ public: ); \ static inline returnType _fn ## className ## name ## impl args - -// Convenience macros to allow defining functions that use the new marshalling features -// while being only visible in the console interop. When we drop the console system, -// these macros can be removed and all definitions that make use of them can be removed -// as well. - -#define DefineEngineMethod( className, name, returnType, args, defaultArgs, usage ) \ - struct _ ## className ## name ## frame \ - { \ - typedef className ObjectType; \ - className* object; \ - inline returnType _exec args const; \ - }; \ - static _EngineFunctionDefaultArguments< _EngineMethodTrampoline< _ ## className ## name ## frame, void args >::FunctionType > \ - _fn ## className ## name ## DefaultArgs defaultArgs; \ - static _EngineConsoleThunkType< returnType >::ReturnType _ ## className ## name ## caster( SimObject* object, S32 argc, ConsoleValueRef *argv ) \ - { \ - _ ## className ## name ## frame frame; \ - frame.object = static_cast< className* >( object ); \ - return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 2, returnType args >::thunk( \ - argc, argv, &_ ## className ## name ## frame::_exec, &frame, _fn ## className ## name ## DefaultArgs \ - ) ); \ - } \ - static ConsoleFunctionHeader _ ## className ## name ## header \ - ( #returnType, #args, #defaultArgs ); \ - static ConsoleConstructor \ - className ## name ## obj( #className, #name, \ - _EngineConsoleThunkType< returnType >::CallbackType( _ ## className ## name ## caster ), usage, \ - _EngineConsoleThunk< 2, returnType args >::NUM_ARGS - _EngineConsoleThunkCountArgs() defaultArgs, \ - _EngineConsoleThunk< 2, returnType args >::NUM_ARGS, \ - false, &_ ## className ## name ## header \ - ); \ - returnType _ ## className ## name ## frame::_exec args const - -#define DefineConsoleStaticMethod( className, name, returnType, args, defaultArgs, usage ) \ - static inline returnType _fn ## className ## name ## impl args; \ - static _EngineFunctionDefaultArguments< void args > _fn ## className ## name ## DefaultArgs defaultArgs; \ - static _EngineConsoleThunkType< returnType >::ReturnType _ ## className ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv )\ - { \ - return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 1, returnType args >::thunk( \ - argc, argv, &_fn ## className ## name ## impl, _fn ## className ## name ## DefaultArgs \ - ) ); \ - } \ - static ConsoleFunctionHeader _ ## className ## name ## header \ - ( #returnType, #args, #defaultArgs, true ); \ - static ConsoleConstructor \ - _ ## className ## name ## obj( #className, #name, _EngineConsoleThunkType< returnType >::CallbackType( _ ## className ## name ## caster ), usage, \ - _EngineConsoleThunk< 1, returnType args >::NUM_ARGS - _EngineConsoleThunkCountArgs() defaultArgs, \ - _EngineConsoleThunk< 1, returnType args >::NUM_ARGS, \ - false, &_ ## className ## name ## header \ - ); \ - static inline returnType _fn ## className ## name ## impl args - - // The following three macros are only temporary. They allow to define engineAPI functions using the framework // here in this file while being visible only in the new API. When the console interop is removed, these macros // can be removed and all their uses be replaced with their corresponding versions that now still include support diff --git a/Engine/source/gfx/gfxInit.cpp b/Engine/source/gfx/gfxInit.cpp index 21572b957..cc7f897bb 100644 --- a/Engine/source/gfx/gfxInit.cpp +++ b/Engine/source/gfx/gfxInit.cpp @@ -536,7 +536,7 @@ DefineEngineStaticMethod( GFXInit, getAdapterModeCount, S32, ( S32 index ),, return adapters[index]->mAvailableModes.size(); } -DefineConsoleStaticMethod( GFXInit, getAdapterMode, String, ( S32 index, S32 modeIndex ),, +DefineEngineStaticMethod( GFXInit, getAdapterMode, String, ( S32 index, S32 modeIndex ),, "Gets the details of the specified adapter mode.\n\n" "@param index Index of the adapter to query.\n" "@param modeIndex Index of the mode to get data from.\n" From 2bbc716db67f2e52d7e190c9cc8deec9256268f0 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Tue, 17 Apr 2018 21:41:29 +0200 Subject: [PATCH 271/312] Eliminate unnecessary uses of ConsoleFunction --- Engine/source/T3D/gameBase/gameConnection.cpp | 30 ++++---- Engine/source/afx/arcaneFX.cpp | 70 +++++-------------- Engine/source/app/game.cpp | 6 +- Engine/source/console/consoleFunctions.cpp | 25 +++---- Engine/source/console/scriptFilename.cpp | 30 ++++---- Engine/source/core/color.cpp | 59 ++++++---------- Engine/source/core/frameAllocator.cpp | 4 +- Engine/source/core/resourceManager.cpp | 11 ++- Engine/source/gfx/gl/gfxGLDevice.cpp | 2 +- Engine/source/i18n/lang.cpp | 6 +- Engine/source/platform/platformAssert.cpp | 8 +-- Engine/source/platformSDL/sdlInput.cpp | 10 +-- 12 files changed, 103 insertions(+), 158 deletions(-) diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index cfe87de6d..7c5effdc5 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -2722,33 +2722,32 @@ void GameConnection::resetDatablockCache() afx_saved_db_cache_CRC = 0xffffffff; } -ConsoleFunction(resetDatablockCache, void, 1, 1, "resetDatablockCache()") +DefineEngineFunction(resetDatablockCache, void, (),,"") { GameConnection::resetDatablockCache(); } -ConsoleFunction(isDatablockCacheSaved, bool, 1, 1, "resetDatablockCache()") +DefineEngineFunction(isDatablockCacheSaved, bool, (),,"") { return afx_saved_db_cache; } -ConsoleFunction(getDatablockCacheCRC, S32, 1, 1, "getDatablockCacheCRC()") +DefineEngineFunction(getDatablockCacheCRC, S32, (),,"") { return (S32)afx_saved_db_cache_CRC; } -ConsoleFunction(extractDatablockCacheCRC, S32, 2, 2, "extractDatablockCacheCRC(filename)") +DefineEngineFunction(extractDatablockCacheCRC, S32, (const char* fileName),,"") { FileStream f_stream; - const char* fileName = argv[1]; - if(!f_stream.open(fileName, Torque::FS::File::Read)) + if (!f_stream.open(fileName, Torque::FS::File::Read)) { Con::errorf("Failed to open file '%s'.", fileName); return -1; } U32 stream_sz = f_stream.getStreamSize(); - if (stream_sz < 4*32) + if (stream_sz < 4 * 32) { Con::errorf("File '%s' is not a valid datablock cache.", fileName); f_stream.close(); @@ -2777,17 +2776,16 @@ ConsoleFunction(extractDatablockCacheCRC, S32, 2, 2, "extractDatablockCacheCRC(f return (S32)crc_code; } -ConsoleFunction(setDatablockCacheCRC, void, 2, 2, "setDatablockCacheCRC(crc)") +DefineEngineFunction(setDatablockCacheCRC, void, (U32 crc), , "") { GameConnection *conn = GameConnection::getConnectionToServer(); - if(!conn) + if (!conn) return; - U32 crc_u = (U32)dAtoi(argv[1]); - conn->setServerCacheCRC(crc_u); + conn->setServerCacheCRC(crc); } -ConsoleMethod( GameConnection, saveDatablockCache, void, 2, 2, "saveDatablockCache()") +DefineEngineMethod(GameConnection, saveDatablockCache, void, (),, "") { if (GameConnection::serverCacheEnabled() && !afx_saved_db_cache) { @@ -2802,14 +2800,14 @@ ConsoleMethod( GameConnection, saveDatablockCache, void, 2, 2, "saveDatablockCac Con::expandScriptFilename(filename_buffer, sizeof(filename_buffer), filename.c_str()); Torque::Path givenPath(Torque::Path::CompressPath(filename_buffer)); Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(givenPath); - if ( fileRef == NULL ) + if (fileRef == NULL) Con::errorf("saveDatablockCache() failed to get CRC for file '%s'.", filename.c_str()); else afx_saved_db_cache_CRC = (S32)fileRef->getChecksum(); } } -ConsoleMethod( GameConnection, loadDatablockCache, void, 2, 2, "loadDatablockCache()") +DefineEngineMethod(GameConnection, loadDatablockCache, void, (),, "") { if (GameConnection::clientCacheEnabled()) { @@ -2817,7 +2815,7 @@ ConsoleMethod( GameConnection, loadDatablockCache, void, 2, 2, "loadDatablockCac } } -ConsoleMethod( GameConnection, loadDatablockCache_Begin, bool, 2, 2, "loadDatablockCache_Begin()") +DefineEngineMethod(GameConnection, loadDatablockCache_Begin, bool, (),, "") { if (GameConnection::clientCacheEnabled()) { @@ -2827,7 +2825,7 @@ ConsoleMethod( GameConnection, loadDatablockCache_Begin, bool, 2, 2, "loadDatabl return false; } -ConsoleMethod( GameConnection, loadDatablockCache_Continue, bool, 2, 2, "loadDatablockCache_Continue()") +DefineEngineMethod(GameConnection, loadDatablockCache_Continue, bool, (),, "") { if (GameConnection::clientCacheEnabled()) { diff --git a/Engine/source/afx/arcaneFX.cpp b/Engine/source/afx/arcaneFX.cpp index cec0c870a..4252183c1 100644 --- a/Engine/source/afx/arcaneFX.cpp +++ b/Engine/source/afx/arcaneFX.cpp @@ -584,69 +584,33 @@ DefineEngineFunction(getRandomDir, Point3F, (Point3F axis, float thetaMin, float return MathUtils::randomDir(axis, thetaMin, thetaMax, phiMin, phiMax); } -ConsoleFunction( MatrixInverseMulVector, const char*, 3, 3, "(MatrixF xfrm, Point3F vector)" - "@brief Multiply the vector by the affine inverse of the transform.\n\n" - "@ingroup AFX") +DefineEngineFunction(MatrixInverseMulVector, Point3F, (MatrixF xfrm, Point3F vector),, + "@brief Multiply the vector by the affine inverse of the transform.\n\n" + "@ingroup AFX") { - Point3F pos1(0.0f,0.0f,0.0f); - AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f); - dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle); - - MatrixF temp1(true); - aa1.setMatrix(&temp1); - temp1.setColumn(3, pos1); - - Point3F vec1(0.0f,0.0f,0.0f); - dSscanf(argv[2], "%g %g %g", &vec1.x, &vec1.y, &vec1.z); - - temp1.affineInverse(); + xfrm.affineInverse(); Point3F result; - temp1.mulV(vec1, &result); + xfrm.mulV(vector, &result); - char* ret = Con::getReturnBuffer(256); - dSprintf(ret, 255, "%g %g %g", result.x, result.y, result.z); - return ret; + return result; } -ConsoleFunction(moveTransformAbs, const char*, 3, 3, "(MatrixF xfrm, Point3F pos)" - "@brief Move the transform to the new absolute position.\n\n" - "@ingroup AFX") +DefineEngineFunction(moveTransformAbs, MatrixF, (MatrixF xfrm, Point3F pos),, + "@brief Move the transform to the new absolute position.\n\n" + "@ingroup AFX") { - Point3F pos1(0.0f,0.0f,0.0f); - AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f); - dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle); - - Point3F pos2(0.0f,0.0f,0.0f); - dSscanf(argv[2], "%g %g %g", &pos2.x, &pos2.y, &pos2.z); - - char* returnBuffer = Con::getReturnBuffer(256); - dSprintf(returnBuffer, 255, "%g %g %g %g %g %g %g", - pos2.x, pos2.y, pos2.z, - aa1.axis.x, aa1.axis.y, aa1.axis.z, - aa1.angle); - return returnBuffer; + xfrm.setPosition(pos); + return xfrm; } -ConsoleFunction(moveTransformRel, const char*, 3, 3, "(MatrixF xfrm, Point3F pos)" - "@brief Move the transform to the new relative position.\n\n" - "@ingroup AFX") +DefineEngineFunction(moveTransformRel, MatrixF, (MatrixF xfrm, Point3F pos),, + "@brief Move the transform to the new relative position.\n\n" + "@ingroup AFX") { - Point3F pos1(0.0f,0.0f,0.0f); - AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f); - dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle); - - Point3F pos2(0.0f,0.0f,0.0f); - dSscanf(argv[2], "%g %g %g", &pos2.x, &pos2.y, &pos2.z); - - pos2 += pos1; - - char* returnBuffer = Con::getReturnBuffer(256); - dSprintf(returnBuffer, 255, "%g %g %g %g %g %g %g", - pos2.x, pos2.y, pos2.z, - aa1.axis.x, aa1.axis.y, aa1.axis.z, - aa1.angle); - return returnBuffer; + pos += xfrm.getPosition(); + xfrm.setPosition(pos); + return xfrm; } DefineEngineFunction(getFreeTargetPosition, Point3F, (),, diff --git a/Engine/source/app/game.cpp b/Engine/source/app/game.cpp index d7a3377f6..5878accd6 100644 --- a/Engine/source/app/game.cpp +++ b/Engine/source/app/game.cpp @@ -218,8 +218,10 @@ DefineEngineFunction( getRealTime, S32, (), , "()" return Platform::getRealMilliseconds(); } -ConsoleFunction( getLocalTime, const char *, 1, 1, "Return the current local time as: weekday month day year hour min sec.\n\n" - "Local time is platform defined.") +DefineEngineFunction(getLocalTime, const char*, (),, + "@brief Return the current local time as: weekday month day year hour min sec.\n\n" + "Local time is platform defined." + "@ingroup Platform") { Platform::LocalTime lt; Platform::getLocalTime(lt); diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 258f7911f..565c79206 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -2646,26 +2646,23 @@ DefineEngineFunction( getPrefsPath, const char *, ( const char* relativeFileName //----------------------------------------------------------------------------- -ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )" - "@brief Manually execute a special script file that contains game or editor preferences\n\n" - "@param relativeFileName Name and path to file from project folder\n" - "@param noCalls Deprecated\n" - "@param journalScript Deprecated\n" - "@return True if script was successfully executed\n" - "@note Appears to be useless in Torque 3D, should be deprecated\n" - "@ingroup Scripting") +DefineEngineFunction(execPrefs, bool, (const char* relativeFileName, bool noCalls, bool journalScript),(false, false), + "@brief Manually execute a special script file that contains game or editor preferences\n\n" + "@param relativeFileName Name and path to file from project folder\n" + "@param noCalls Deprecated\n" + "@param journalScript Deprecated\n" + "@return True if script was successfully executed\n" + "@note Appears to be useless in Torque 3D, should be deprecated\n" + "@ingroup Scripting") { - const char *filename = Platform::getPrefsPath(argv[1]); - if(filename == NULL || *filename == 0) + if (relativeFileName == NULL || *relativeFileName == 0) return false; // Scripts do this a lot, so we may as well help them out - if(! Platform::isFile(filename) && ! Torque::FS::IsFile(filename)) + if (!Platform::isFile(relativeFileName) && !Torque::FS::IsFile(relativeFileName)) return true; - argv[0] = "exec"; - argv[1] = filename; - return dAtob(Con::execute(argc, argv)); + return Con::executeFile(relativeFileName, noCalls, journalScript); } //----------------------------------------------------------------------------- diff --git a/Engine/source/console/scriptFilename.cpp b/Engine/source/console/scriptFilename.cpp index 332f01d26..b0cacf2bc 100644 --- a/Engine/source/console/scriptFilename.cpp +++ b/Engine/source/console/scriptFilename.cpp @@ -27,7 +27,7 @@ #include "core/tSimpleHashTable.h" #include "core/strings/stringFunctions.h" #include "core/stringTable.h" -#include "console/console.h" +#include "console/engineAPI.h" #include "console/compiler.h" @@ -342,28 +342,26 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src) // Console Functions //----------------------------------------------------------------------------- -ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)" - "@brief Grabs the full path of a specified file\n\n" - "@param filename Name of the local file to locate\n" - "@return String containing the full filepath on disk\n" - "@ingroup FileSystem") +DefineEngineFunction(expandFilename, const char*, (const char* filename),, + "@brief Grabs the full path of a specified file\n\n" + "@param filename Name of the local file to locate\n" + "@return String containing the full filepath on disk\n" + "@ingroup FileSystem") { - TORQUE_UNUSED(argc); static const U32 bufSize = 1024; - char* ret = Con::getReturnBuffer( bufSize ); - Con::expandScriptFilename(ret, bufSize, argv[1]); + char* ret = Con::getReturnBuffer(bufSize); + Con::expandScriptFilename(ret, bufSize, filename); return ret; } -ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)" - "@brief Retrofits a filepath that uses old Torque style\n\n" - "@return String containing filepath with new formatting\n" - "@ingroup FileSystem") +DefineEngineFunction(expandOldFilename, const char*, (const char* filename),, + "@brief Retrofits a filepath that uses old Torque style\n\n" + "@return String containing filepath with new formatting\n" + "@ingroup FileSystem") { - TORQUE_UNUSED(argc); static const U32 bufSize = 1024; - char* ret = Con::getReturnBuffer( bufSize ); - Con::expandOldScriptFilename(ret, bufSize, argv[1]); + char* ret = Con::getReturnBuffer(bufSize); + Con::expandOldScriptFilename(ret, bufSize, filename); return ret; } diff --git a/Engine/source/core/color.cpp b/Engine/source/core/color.cpp index 273a2a658..1fea8cfec 100644 --- a/Engine/source/core/color.cpp +++ b/Engine/source/core/color.cpp @@ -536,80 +536,67 @@ float LinearColorF::sSrgbToLinear[256] = #endif //----------------------------------------------------------------------------- -ConsoleFunction( getStockColorCount, S32, 1, 1, "() - Gets a count of available stock colors.\n" - "@return A count of available stock colors." ) +DefineEngineFunction(getStockColorCount, S32, (),, + "@brief Gets a count of available stock colors.\n" + "@return A count of available stock colors.") { return StockColor::getCount(); } //----------------------------------------------------------------------------- -ConsoleFunction( getStockColorName, const char*, 2, 2, "(stockColorIndex) - Gets the stock color name at the specified index.\n" +DefineEngineFunction(getStockColorName, const char*, (S32 stockColorIndex),, + "@brief Gets the stock color name at the specified index.\n" "@param stockColorIndex The zero-based index of the stock color name to retrieve.\n" - "@return The stock color name at the specified index or nothing if the string is invalid." ) + "@return The stock color name at the specified index or nothing if the string is invalid.") { - // Fetch stock color index. - const S32 stockColorIndex = dAtoi(argv[1]); - // Fetch the color item. - const StockColorItem* pColorItem = StockColor::getColorItem( stockColorIndex ); + const StockColorItem* pColorItem = StockColor::getColorItem(stockColorIndex); return pColorItem == NULL ? NULL : pColorItem->getColorName(); } //----------------------------------------------------------------------------- -ConsoleFunction( isStockColor, bool, 2, 2, "(stockColorName) - Gets whether the specified name is a stock color or not.\n" +DefineEngineFunction(isStockColor, bool, (const char* stockColorName),, + "@brief Gets whether the specified name is a stock color or not.\n" "@param stockColorName - The stock color name to test for.\n" - "@return Whether the specified name is a stock color or not.\n" ) + "@return Whether the specified name is a stock color or not.\n") { - // Fetch stock color name. - const char* pStockColorName = argv[1]; - // Return whether this is a stock color name or not. - return StockColor::isColor( pStockColorName ); + return StockColor::isColor(stockColorName); } //----------------------------------------------------------------------------- -ConsoleFunction( getStockColorF, const char*, 2, 2, "(stockColorName) - Gets a floating-point-based stock color by name.\n" +DefineEngineFunction(getStockColorF, LinearColorF, (const char* stockColorName),, + "@brief Gets a floating-point-based stock color by name.\n" "@param stockColorName - The stock color name to retrieve.\n" - "@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n" ) + "@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n") { - // Fetch stock color name. - const char* pStockColorName = argv[1]; - // Return nothing if stock color name is invalid. - if ( !StockColor::isColor( pStockColorName ) ) + if (!StockColor::isColor(stockColorName)) return StringTable->EmptyString(); // Fetch stock color. - const LinearColorF& color = StockColor::colorF( pStockColorName ); + const LinearColorF& color = StockColor::colorF(stockColorName); - // Format stock color. - char* returnBuffer = Con::getReturnBuffer(256); - dSprintf(returnBuffer, 256, "%g %g %g %g", color.red, color.green, color.blue, color.alpha); - return(returnBuffer); + return color; } //----------------------------------------------------------------------------- -ConsoleFunction( getStockColorI, const char*, 2, 2, "(stockColorName) - Gets a byte-based stock color by name.\n" +DefineEngineFunction(getStockColorI, ColorI, (const char* stockColorName),, + "@brief Gets a byte-based stock color by name.\n" "@param stockColorName - The stock color name to retrieve.\n" - "@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n" ) + "@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n") { - // Fetch stock color name. - const char* pStockColorName = argv[1]; - // Return nothing if stock color name is invalid. - if ( !StockColor::isColor( pStockColorName ) ) + if (!StockColor::isColor(stockColorName)) return StringTable->EmptyString(); // Fetch stock color. - const ColorI& color = StockColor::colorI( pStockColorName ); + const ColorI& color = StockColor::colorI(stockColorName); - // Format stock color. - char* returnBuffer = Con::getReturnBuffer(256); - dSprintf(returnBuffer, 256, "%d %d %d %d", color.red, color.green, color.blue, color.alpha); - return(returnBuffer); + return color; } \ No newline at end of file diff --git a/Engine/source/core/frameAllocator.cpp b/Engine/source/core/frameAllocator.cpp index 846328290..5c9530271 100644 --- a/Engine/source/core/frameAllocator.cpp +++ b/Engine/source/core/frameAllocator.cpp @@ -21,7 +21,7 @@ //----------------------------------------------------------------------------- #include "core/frameAllocator.h" -#include "console/console.h" +#include "console/engineAPI.h" U8* FrameAllocator::smBuffer = NULL; U32 FrameAllocator::smWaterMark = 0; @@ -30,7 +30,7 @@ U32 FrameAllocator::smHighWaterMark = 0; #ifdef TORQUE_DEBUG U32 FrameAllocator::smMaxFrameAllocation = 0; -ConsoleFunction(getMaxFrameAllocation, S32, 1,1, "getMaxFrameAllocation();") +DefineEngineFunction(getMaxFrameAllocation, S32, (),,"") { return FrameAllocator::getMaxFrameAllocation(); } diff --git a/Engine/source/core/resourceManager.cpp b/Engine/source/core/resourceManager.cpp index 09b889f95..c5b6e0fa6 100644 --- a/Engine/source/core/resourceManager.cpp +++ b/Engine/source/core/resourceManager.cpp @@ -222,18 +222,17 @@ ResourceBase ResourceManager::nextResource() ConsoleFunctionGroupBegin(ResourceManagerFunctions, "Resource management functions."); -ConsoleFunction(resourceDump, void, 1, 1, "()" - "@brief List the currently managed resources\n\n" - "Currently used by editors only, internal\n" - "@ingroup Editors\n" - "@internal") +DefineEngineFunction(resourceDump, void, (),, + "@brief List the currently managed resources\n\n" + "Currently used by editors only, internal\n" + "@ingroup Editors\n" + "@internal") { #ifdef TORQUE_DEBUG ResourceManager::get().dumpToConsole(); #endif } - DefineEngineFunction( reloadResource, void, ( const char* path ),, "Force the resource at specified input path to be reloaded\n" "@param path Path to the resource to be reloaded\n\n" diff --git a/Engine/source/gfx/gl/gfxGLDevice.cpp b/Engine/source/gfx/gl/gfxGLDevice.cpp index d2a1853ee..9eda76ebc 100644 --- a/Engine/source/gfx/gl/gfxGLDevice.cpp +++ b/Engine/source/gfx/gl/gfxGLDevice.cpp @@ -992,7 +992,7 @@ public: static GFXGLRegisterDevice pGLRegisterDevice; -ConsoleFunction(cycleResources, void, 1, 1, "") +DefineEngineFunction(cycleResources, void, (),, "") { static_cast(GFX)->zombify(); static_cast(GFX)->resurrect(); diff --git a/Engine/source/i18n/lang.cpp b/Engine/source/i18n/lang.cpp index b1fa76c6a..724d88abe 100644 --- a/Engine/source/i18n/lang.cpp +++ b/Engine/source/i18n/lang.cpp @@ -508,14 +508,15 @@ bool compiledFileNeedsUpdate(UTF8* filename) return false; } -ConsoleFunction(CompileLanguage, void, 2, 3, "(string inputFile, [bool createMap]) Compiles a LSO language file." +DefineEngineFunction(CompileLanguage, void, (const char* inputFile, bool createMap), (false), + "@brief Compiles a LSO language file." " if createIndex is true, will also create languageMap.cs with" " the global variables for each string index." " The input file must follow this example layout:" " TXT_HELLO_WORLD = Hello world in english!") { UTF8 scriptFilenameBuffer[1024]; - Con::expandScriptFilename((char*)scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]); + Con::expandScriptFilename((char*)scriptFilenameBuffer, sizeof(scriptFilenameBuffer), inputFile); if (!Torque::FS::IsFile(scriptFilenameBuffer)) { @@ -532,7 +533,6 @@ ConsoleFunction(CompileLanguage, void, 2, 3, "(string inputFile, [bool createMap if (compiledFileNeedsUpdate(scriptFilenameBuffer)) { - bool createMap = argc > 2 ? dAtob(argv[2]) : false; FileStream *mapStream = NULL; if (createMap) { diff --git a/Engine/source/platform/platformAssert.cpp b/Engine/source/platform/platformAssert.cpp index 5fe428fad..1a4b08694 100644 --- a/Engine/source/platform/platformAssert.cpp +++ b/Engine/source/platform/platformAssert.cpp @@ -23,7 +23,7 @@ #include #include "core/strings/stringFunctions.h" -#include "console/console.h" +#include "console/engineAPI.h" //-------------------------------------- STATIC Declaration @@ -167,8 +167,8 @@ const char* avar(const char *message, ...) //----------------------------------------------------------------------------- -ConsoleFunction( Assert, void, 3, 3, "(condition, message) - Fatal Script Assertion" ) +DefineEngineFunction(Assert, void, (bool condition, const char* message),, "Fatal Script Assertion") { - // Process Assertion. - AssertISV( dAtob(argv[1]), argv[2] ); + // Process Assertion. + AssertISV(condition, message); } diff --git a/Engine/source/platformSDL/sdlInput.cpp b/Engine/source/platformSDL/sdlInput.cpp index 69ef30b20..eb9e3dd8e 100644 --- a/Engine/source/platformSDL/sdlInput.cpp +++ b/Engine/source/platformSDL/sdlInput.cpp @@ -21,7 +21,7 @@ //----------------------------------------------------------------------------- #include "platform/platformInput.h" -#include "console/console.h" +#include "console/engineAPI.h" #include "core/util/journal/process.h" #include "windowManager/platformWindowMgr.h" @@ -97,16 +97,16 @@ void Input::init() } //------------------------------------------------------------------------------ -ConsoleFunction( isJoystickDetected, bool, 1, 1, "isJoystickDetected()" ) +DefineEngineFunction(isJoystickDetected, bool, (),, "") { - return( SDL_NumJoysticks() > 0 ); + return(SDL_NumJoysticks() > 0); } //------------------------------------------------------------------------------ -ConsoleFunction( getJoystickAxes, const char*, 2, 2, "getJoystickAxes( instance )" ) +DefineEngineFunction(getJoystickAxes, const char*, (const char* instance), , "") { // TODO SDL - return( "" ); + return(""); } //------------------------------------------------------------------------------ From 0fff33869cd6cc2828c35408067200c1d9b837d4 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Tue, 17 Apr 2018 22:36:32 +0200 Subject: [PATCH 272/312] Eliminate unnecessary uses of ConsoleMethod --- Engine/source/T3D/assets/MaterialAsset.cpp | 2 +- .../camera/cameraComponent_ScriptBinding.h | 3 +- Engine/source/T3D/components/component.cpp | 41 ++++--- Engine/source/T3D/entity.cpp | 31 ++--- Engine/source/T3D/gameBase/gameConnection.cpp | 22 ++-- Engine/source/T3D/player.cpp | 20 ++-- Engine/source/afx/afxCamera.cpp | 110 ++++++++---------- Engine/source/gui/core/guiCanvas.cpp | 23 ++-- .../source/gui/editor/guiInspectorTypes.cpp | 13 +-- .../gui/editor/inspector/componentGroup.cpp | 9 +- .../gui/editor/inspector/entityGroup.cpp | 8 +- .../gui/editor/inspector/mountingGroup.cpp | 8 +- .../gui/worldEditor/worldEditorSelection.cpp | 45 +++---- Engine/source/navigation/guiNavEditorCtrl.cpp | 7 +- Engine/source/util/settings.cpp | 3 +- 15 files changed, 155 insertions(+), 190 deletions(-) diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 697f21e37..6cf3561a1 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -157,7 +157,7 @@ void MaterialAsset::copyTo(SimObject* object) Parent::copyTo(object); } -ConsoleMethod(MaterialAsset, compileShader, void, 2, 2, "() - Compiles the material's generated shader, if any. Not yet implemented\n") +DefineEngineMethod(MaterialAsset, compileShader, void, (), , "Compiles the material's generated shader, if any. Not yet implemented\n") { object->compileShader(); } diff --git a/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h b/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h index d3b7f9883..412d8e5b6 100644 --- a/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h +++ b/Engine/source/T3D/components/camera/cameraComponent_ScriptBinding.h @@ -24,7 +24,8 @@ #include "T3D/components/camera/cameraComponent.h" //Basically, this only exists for backwards compatibility for parts of the editors -ConsoleMethod(CameraComponent, getMode, const char*, 2, 2, "() - We get the first behavior of the requested type on our owner object.\n" +DefineEngineMethod(CameraComponent, getMode, const char*, (),, + "@brief We get the first behavior of the requested type on our owner object.\n" "@return (string name) The type of the behavior we're requesting") { return "fly"; diff --git a/Engine/source/T3D/components/component.cpp b/Engine/source/T3D/components/component.cpp index 83fc015f1..92c9dda44 100644 --- a/Engine/source/T3D/components/component.cpp +++ b/Engine/source/T3D/components/component.cpp @@ -605,8 +605,8 @@ void Component::addDependency(StringTableEntry name) ////////////////////////////////////////////////////////////////////////// // Console Methods ////////////////////////////////////////////////////////////////////////// -ConsoleMethod(Component, beginGroup, void, 3, 3, "(groupName)\n" - "Starts the grouping for following fields being added to be grouped into\n" +DefineEngineMethod(Component, beginGroup, void, (String groupName),, + "@brief Starts the grouping for following fields being added to be grouped into\n" "@param groupName The name of this group\n" "@param desc The Description of this field\n" "@param type The DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)\n" @@ -616,11 +616,11 @@ ConsoleMethod(Component, beginGroup, void, 3, 3, "(groupName)\n" "-object: the T2D object type that are valid choices for the field. The object types observe inheritance, so if you have a t2dSceneObject field you will be able to choose t2dStaticSrpites, t2dAnimatedSprites, etc.\n" "@return Nothing\n") { - object->beginFieldGroup(argv[2]); + object->beginFieldGroup(groupName); } -ConsoleMethod(Component, endGroup, void, 2, 2, "()\n" - "Ends the grouping for prior fields being added to be grouped into\n" +DefineEngineMethod(Component, endGroup, void, (),, + "@brief Ends the grouping for prior fields being added to be grouped into\n" "@param groupName The name of this group\n" "@param desc The Description of this field\n" "@param type The DataType for this field (default, int, float, Point2F, bool, enum, Object, keybind, color)\n" @@ -641,7 +641,8 @@ DefineEngineMethod(Component, addComponentField, void, (String fieldName, String object->addComponentField(fieldName, fieldDesc, fieldType, defValue, userData, hidden); } -ConsoleMethod(Component, getComponentFieldCount, S32, 2, 2, "() - Get the number of ComponentField's on this object\n" +DefineEngineMethod(Component, getComponentFieldCount, S32, (),, + "@brief Get the number of ComponentField's on this object\n" "@return Returns the number of BehaviorFields as a nonnegative integer\n") { return object->getComponentFieldCount(); @@ -650,11 +651,12 @@ ConsoleMethod(Component, getComponentFieldCount, S32, 2, 2, "() - Get the number // [tom, 1/12/2007] Field accessors split into multiple methods to allow space // for long descriptions and type data. -ConsoleMethod(Component, getComponentField, const char *, 3, 3, "(int index) - Gets a Tab-Delimited list of information about a ComponentField specified by Index\n" +DefineEngineMethod(Component, getComponentField, const char *, (S32 index),, + "@brief Gets a Tab-Delimited list of information about a ComponentField specified by Index\n" "@param index The index of the behavior\n" "@return FieldName, FieldType and FieldDefaultValue, each separated by a TAB character.\n") { - ComponentField *field = object->getComponentField(dAtoi(argv[2])); + ComponentField *field = object->getComponentField(index); if (field == NULL) return ""; @@ -664,11 +666,12 @@ ConsoleMethod(Component, getComponentField, const char *, 3, 3, "(int index) - G return buf; } -ConsoleMethod(Component, setComponentield, const char *, 3, 3, "(int index) - Gets a Tab-Delimited list of information about a ComponentField specified by Index\n" +DefineEngineMethod(Component, setComponentield, const char *, (S32 index),, + "@brief Gets a Tab-Delimited list of information about a ComponentField specified by Index\n" "@param index The index of the behavior\n" "@return FieldName, FieldType and FieldDefaultValue, each separated by a TAB character.\n") { - ComponentField *field = object->getComponentField(dAtoi(argv[2])); + ComponentField *field = object->getComponentField(index); if (field == NULL) return ""; @@ -689,36 +692,40 @@ DefineEngineMethod(Component, getComponentFieldType, const char *, (String field return field->mFieldTypeName;; } -ConsoleMethod(Component, getBehaviorFieldUserData, const char *, 3, 3, "(int index) - Gets the UserData associated with a field by index in the field list\n" +DefineEngineMethod(Component, getBehaviorFieldUserData, const char *, (S32 index),, + "@brief Gets the UserData associated with a field by index in the field list\n" "@param index The index of the behavior\n" "@return Returns a string representing the user data of this field\n") { - ComponentField *field = object->getComponentField(dAtoi(argv[2])); + ComponentField *field = object->getComponentField(index); if (field == NULL) return ""; return field->mUserData; } -ConsoleMethod(Component, getComponentFieldDescription, const char *, 3, 3, "(int index) - Gets a field description by index\n" +DefineEngineMethod(Component, getComponentFieldDescription, const char *, (S32 index),, + "@brief Gets a field description by index\n" "@param index The index of the behavior\n" "@return Returns a string representing the description of this field\n") { - ComponentField *field = object->getComponentField(dAtoi(argv[2])); + ComponentField *field = object->getComponentField(index); if (field == NULL) return ""; return field->mFieldDescription ? field->mFieldDescription : ""; } -ConsoleMethod(Component, addDependency, void, 3, 3, "(string behaviorName) - Gets a field description by index\n" +DefineEngineMethod(Component, addDependency, void, (String behaviorName),, + "@brief Gets a field description by index\n" "@param index The index of the behavior\n" "@return Returns a string representing the description of this field\n") { - object->addDependency(argv[2]); + object->addDependency(behaviorName); } -ConsoleMethod(Component, setDirty, void, 2, 2, "() - Gets a field description by index\n" +DefineEngineMethod(Component, setDirty, void, (),, + "@brief Gets a field description by index\n" "@param index The index of the behavior\n" "@return Returns a string representing the description of this field\n") { diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index 587eb145b..c13eb61fa 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -1823,12 +1823,11 @@ ConsoleMethod(Entity, addComponents, void, 2, 2, "() - Add all fielded behaviors object->addComponents(); }*/ -ConsoleMethod(Entity, addComponent, bool, 3, 3, "(ComponentInstance bi) - Add a behavior to the object\n" +DefineEngineMethod(Entity, addComponent, bool, (Component* comp),, + "@brief Add a behavior to the object\n" "@param bi The behavior instance to add" "@return (bool success) Whether or not the behavior was successfully added") { - Component *comp = dynamic_cast(Sim::findObject(argv[2])); - if (comp != NULL) { bool success = object->addComponent(comp); @@ -1848,40 +1847,33 @@ ConsoleMethod(Entity, addComponent, bool, 3, 3, "(ComponentInstance bi) - Add a return false; } -ConsoleMethod(Entity, removeComponent, bool, 3, 4, "(ComponentInstance bi, [bool deleteBehavior = true])\n" +DefineEngineMethod(Entity, removeComponent, bool, (Component* comp, bool deleteComponent), (true), "@param bi The behavior instance to remove\n" "@param deleteBehavior Whether or not to delete the behavior\n" "@return (bool success) Whether the behavior was successfully removed") { - bool deleteComponent = true; - if (argc > 3) - deleteComponent = dAtob(argv[3]); - - return object->removeComponent(dynamic_cast(Sim::findObject(argv[2])), deleteComponent); + return object->removeComponent(comp, deleteComponent); } -ConsoleMethod(Entity, clearComponents, void, 2, 2, "() - Clear all behavior instances\n" +DefineEngineMethod(Entity, clearComponents, void, (),, "Clear all behavior instances\n" "@return No return value") { object->clearComponents(); } -ConsoleMethod(Entity, getComponentByIndex, S32, 3, 3, "(int index) - Gets a particular behavior\n" +DefineEngineMethod(Entity, getComponentByIndex, Component*, (S32 index),, + "@brief Gets a particular behavior\n" "@param index The index of the behavior to get\n" "@return (ComponentInstance bi) The behavior instance you requested") { - Component *comp = object->getComponent(dAtoi(argv[2])); - - return (comp != NULL) ? comp->getId() : 0; + return object->getComponent(index); } -DefineEngineMethod(Entity, getComponent, S32, (String componentName), (""), +DefineEngineMethod(Entity, getComponent, Component*, (String componentName), (""), "Get the number of static fields on the object.\n" "@return The number of static fields defined on the object.") { - Component *comp = object->getComponent(componentName); - - return (comp != NULL) ? comp->getId() : 0; + return object->getComponent(componentName); } /*ConsoleMethod(Entity, getBehaviorByType, S32, 3, 3, "(string BehaviorTemplateName) - gets a behavior\n" @@ -1910,7 +1902,8 @@ DefineEngineMethod(Entity, getComponent, S32, (String componentName), (""), return object->reOrder(inst, idx); }*/ -ConsoleMethod(Entity, getComponentCount, S32, 2, 2, "() - Get the count of behaviors on an object\n" +DefineEngineMethod(Entity, getComponentCount, S32, (),, + "@brief Get the count of behaviors on an object\n" "@return (int count) The number of behaviors on an object") { return object->getComponentCount(); diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index 7c5effdc5..2376e7180 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -2451,41 +2451,37 @@ DefineEngineMethod( GameConnection, getVisibleGhostDistance, F32, (),, // Object Selection in Torque by Dave Myers // http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7335 -ConsoleMethod(GameConnection, setSelectedObj, bool, 3, 4, "(object, [propagate_to_client])") +DefineEngineMethod(GameConnection, setSelectedObj, bool, (SceneObject* obj, bool propagate_to_client), (false), "") { - SceneObject* pending_selection; - if (!Sim::findObject(argv[2], pending_selection)) + if (!obj) return false; - bool propagate_to_client = (argc > 3) ? dAtob(argv[3]) : false; - object->setSelectedObj(pending_selection, propagate_to_client); + object->setSelectedObj(obj, propagate_to_client); return true; } -ConsoleMethod(GameConnection, getSelectedObj, S32, 2, 2, "()") +DefineEngineMethod(GameConnection, getSelectedObj, SimObject*, (),, "") { - SimObject* selected = object->getSelectedObj(); - return (selected) ? selected->getId(): -1; + return object->getSelectedObj(); } -ConsoleMethod(GameConnection, clearSelectedObj, void, 2, 3, "([propagate_to_client])") +DefineEngineMethod(GameConnection, clearSelectedObj, void, (bool propagate_to_client), (false), "") { - bool propagate_to_client = (argc > 2) ? dAtob(argv[2]) : false; object->setSelectedObj(NULL, propagate_to_client); } -ConsoleMethod(GameConnection, setPreSelectedObjFromRollover, void, 2, 2, "()") +DefineEngineMethod(GameConnection, setPreSelectedObjFromRollover, void, (),, "") { object->setPreSelectedObjFromRollover(); } -ConsoleMethod(GameConnection, clearPreSelectedObj, void, 2, 2, "()") +DefineEngineMethod(GameConnection, clearPreSelectedObj, void, (),, "") { object->clearPreSelectedObj(); } -ConsoleMethod(GameConnection, setSelectedObjFromPreSelected, void, 2, 2, "()") +DefineEngineMethod(GameConnection, setSelectedObjFromPreSelected, void, (),, "") { object->setSelectedObjFromPreSelected(); } diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 15b57046a..fa43394ca 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -7517,7 +7517,7 @@ U32 Player::lockAnimation() return last_anim_lock_tag; } -ConsoleMethod(Player, isAnimationLocked, bool, 2, 2, "isAnimationLocked()") +DefineEngineMethod(Player, isAnimationLocked, bool, (),, "") { return object->isAnimationLocked(); } @@ -7533,14 +7533,13 @@ void Player::setLookAnimationOverride(bool flag) #endif } -ConsoleMethod(Player, setLookAnimationOverride, void, 3, 3, "setLookAnimationOverride(flag)") +DefineEngineMethod(Player, setLookAnimationOverride, void, (bool flag),, "") { - object->setLookAnimationOverride(dAtob(argv[2])); + object->setLookAnimationOverride(flag); } -ConsoleMethod(Player, copyHeadRotation, void, 3, 3, "copyHeadRotation(other_player)") +DefineEngineMethod(Player, copyHeadRotation, void, (Player* other_player),, "") { - Player* other_player = dynamic_cast(Sim::findObject(argv[2])); if (other_player) object->copyHeadRotation(other_player); } @@ -7609,9 +7608,9 @@ void Player::restoreMovement(U32 tag) } } -ConsoleMethod(Player, setMovementSpeedBias, void, 3, 3, "setMovementSpeedBias(F32 bias)") +DefineEngineMethod(Player, setMovementSpeedBias, void, (F32 bias),, "setMovementSpeedBias(F32 bias)") { - object->setMovementSpeedBias(dAtof(argv[2])); + object->setMovementSpeedBias(bias); } void Player::overrideFootfallFX(bool decals, bool sounds, bool dust) @@ -7642,12 +7641,11 @@ void Player::setControllers(Vector controllerList) mControllers[1] = controllerList.size() > 1 ? controllerList[1] : NULL; } -ConsoleMethod(Player, setVRControllers, void, 4, 4, "") +DefineEngineMethod(Player, setVRControllers, void, (OpenVRTrackedObject* controllerL, OpenVRTrackedObject* controllerR,, "") { - OpenVRTrackedObject *controllerL, *controllerR; Vector list; - if (Sim::findObject(argv[2], controllerL)) + if (controllerL) { list.push_back(controllerL); } @@ -7656,7 +7654,7 @@ ConsoleMethod(Player, setVRControllers, void, 4, 4, "") list.push_back(NULL); } - if (Sim::findObject(argv[3], controllerR)) + if (controllerR) { list.push_back(controllerR); } diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index 63ad635ac..1aad5f455 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -483,105 +483,91 @@ ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8, object->setOrbitMode(orbitObject, pos, aa, minDis, maxDis, curDis, (argc == 8) ? dAtob(argv[7]) : false); } -ConsoleMethod( afxCamera, setFlyMode, void, 2, 2, "()" "Set the camera to be able to fly freely.") +DefineEngineMethod(afxCamera, setFlyMode, void, (),, + "@brief Set the camera to be able to fly freely.") { - object->setFlyMode(); + object->setFlyMode(); } -ConsoleMethod( afxCamera, getPosition, const char *, 2, 2, "()" - "Get the position of the camera.\n\n" - "@returns A string of form \"x y z\".") -{ - Point3F& pos = object->getPosition(); - dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); - return buffer; +DefineEngineMethod(afxCamera, getPosition, Point3F, (),, + "@brief Get the position of the camera.\n\n" + "@returns The position of the camera.") +{ + return object->getPosition(); } -ConsoleMethod(afxCamera, setCameraSubject, bool, 3, 3, "") -{ - SceneObject* subject; - if (!Sim::findObject(argv[2], subject)) - { - Con::errorf("Camera subject \"%s\" not found.", argv[2].getStringValue()); - return false; - } - - object->setCameraSubject(subject); - - return true; +DefineEngineMethod(afxCamera, setCameraSubject, bool, (SceneObject* subject),, "") +{ + if (!subject) + { + Con::errorf("Camera subject not found."); + return false; + } + + object->setCameraSubject(subject); + + return true; } -ConsoleMethod(afxCamera, setThirdPersonDistance, bool, 3, 3, "") -{ - F32 distance; - dSscanf(argv[2], "%f", &distance); +DefineEngineMethod(afxCamera, setThirdPersonDistance, bool, (F32 distance),, "") +{ + object->setThirdPersonDistance(distance); - object->setThirdPersonDistance(distance); - - return true; + return true; } -ConsoleMethod(afxCamera, getThirdPersonDistance, F32, 2, 2, "") +DefineEngineMethod(afxCamera, getThirdPersonDistance, F32, (),, "") { return object->getThirdPersonDistance(); } -ConsoleMethod(afxCamera, setThirdPersonAngle, bool, 3, 3, "") -{ - F32 angle; - dSscanf(argv[2], "%f", &angle); +DefineEngineMethod(afxCamera, setThirdPersonAngle, bool, (F32 distance),, "") +{ + object->setThirdPersonAngle(distance); - object->setThirdPersonAngle(angle); - - return true; + return true; } -ConsoleMethod(afxCamera, getThirdPersonAngle, F32, 2, 2, "") +DefineEngineMethod(afxCamera, getThirdPersonAngle, F32, (),, "") { return object->getThirdPersonAngle(); } -ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, Point3F coi_offset])") +DefineEngineMethod(afxCamera, setThirdPersonOffset, void, (Point3F offset, Point3F coi_offset), (Point3F::Max), "") { - Point3F offset; - dSscanf(argv[2], "%f %f %f", &offset.x, &offset.y, &offset.z); - if (argc > 3) - { - Point3F coi_offset; - dSscanf(argv[3], "%f %f %f", &coi_offset.x, &coi_offset.y, &coi_offset.z); - object->setThirdPersonOffset(offset, coi_offset); - } - else - object->setThirdPersonOffset(offset); + if (coi_offset == Point3F::Max) + { + object->setThirdPersonOffset(offset); + } + else + { + object->setThirdPersonOffset(offset, coi_offset); + } } -ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()") +DefineEngineMethod(afxCamera, getThirdPersonOffset, Point3F, (),, "") { - const Point3F& pos = object->getThirdPersonOffset(); - dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); - return buffer; + return object->getThirdPersonOffset(); } -ConsoleMethod(afxCamera, getThirdPersonCOIOffset, const char *, 2, 2, "()") +DefineEngineMethod(afxCamera, getThirdPersonCOIOffset, Point3F, (),, "") { - const Point3F& pos = object->getThirdPersonCOIOffset(); - dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); - return buffer; + return object->getThirdPersonCOIOffset(); } -ConsoleMethod(afxCamera, setThirdPersonMode, void, 2, 2, "()") +DefineEngineMethod(afxCamera, setThirdPersonMode, void, (),, "") { - object->setThirdPersonMode(); + object->setThirdPersonMode(); } -ConsoleMethod(afxCamera, setThirdPersonSnap, void, 2, 2, "()") +DefineEngineMethod(afxCamera, setThirdPersonSnap, void, (),, "") { - object->setThirdPersonSnap(); + object->setThirdPersonSnap(); } -ConsoleMethod(afxCamera, getMode, const char *, 2, 2, "()") +DefineEngineMethod(afxCamera, getMode, const char*, (),, "") { - return object->getMode(); + return object->getMode(); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index 885d157a0..5b5ca637b 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -2812,7 +2812,7 @@ DefineEngineMethod( GuiCanvas, setVideoMode, void, Con::setVariable( "$pref::Video::mode", vm.toString() ); } -ConsoleMethod( GuiCanvas, showWindow, void, 2, 2, "" ) +DefineEngineMethod(GuiCanvas, showWindow, void, (),, "") { if (!object->getPlatformWindow()) return; @@ -2822,7 +2822,7 @@ ConsoleMethod( GuiCanvas, showWindow, void, 2, 2, "" ) object->getPlatformWindow()->setDisplayWindow(true); } -ConsoleMethod( GuiCanvas, hideWindow, void, 2, 2, "" ) +DefineEngineMethod(GuiCanvas, hideWindow, void, (),, "") { if (!object->getPlatformWindow()) return; @@ -2832,30 +2832,29 @@ ConsoleMethod( GuiCanvas, hideWindow, void, 2, 2, "" ) object->getPlatformWindow()->setDisplayWindow(false); } -ConsoleMethod( GuiCanvas, cursorClick, void, 4, 4, "button, isDown" ) +DefineEngineMethod(GuiCanvas, cursorClick, void, (S32 buttonId, bool isDown), , "") { - const S32 buttonId = dAtoi(argv[2]); - const bool isDown = dAtob(argv[3]); - object->cursorClick(buttonId, isDown); } -ConsoleMethod( GuiCanvas, cursorNudge, void, 4, 4, "x, y" ) +DefineEngineMethod(GuiCanvas, cursorNudge, void, (F32 x, F32 y), , "") { - object->cursorNudge(dAtof(argv[2]), dAtof(argv[3])); + object->cursorNudge(x, y); } + // This function allows resetting of the video-mode from script. It was motivated by // the need to temporarily disable vsync during datablock cache load to avoid a // significant slowdown. bool AFX_forceVideoReset = false; -ConsoleMethod( GuiCanvas, resetVideoMode, void, 2,2, "()") + +DefineEngineMethod(GuiCanvas, resetVideoMode, void, (), , "") { PlatformWindow* window = object->getPlatformWindow(); - if( window ) + if (window) { - GFXWindowTarget* gfx_target = window->getGFXTarget(); - if ( gfx_target ) + GFXWindowTarget* gfx_target = window->getGFXTarget(); + if (gfx_target) { AFX_forceVideoReset = true; gfx_target->resetMode(); diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index f31d4facd..4c07f4959 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -601,13 +601,12 @@ void GuiInspectorTypeFileName::updateValue() } } -ConsoleMethod( GuiInspectorTypeFileName, apply, void, 3,3, "apply(newValue);" ) +DefineEngineMethod(GuiInspectorTypeFileName, apply, void, (String path), , "") { - String path( (const char*)argv[2] ); - if ( path.isNotEmpty() ) - path = Platform::makeRelativePathName( path, Platform::getMainDotCsDir() ); - - object->setData( path.c_str() ); + if (path.isNotEmpty()) + path = Platform::makeRelativePathName(path, Platform::getMainDotCsDir()); + + object->setData(path.c_str()); } @@ -1502,7 +1501,7 @@ void GuiInspectorTypeBitMask32::updateData() setData( data ); } -ConsoleMethod( GuiInspectorTypeBitMask32, applyBit, void, 2,2, "apply();" ) +DefineEngineMethod( GuiInspectorTypeBitMask32, applyBit, void, (),, "" ) { object->updateData(); } diff --git a/Engine/source/gui/editor/inspector/componentGroup.cpp b/Engine/source/gui/editor/inspector/componentGroup.cpp index 27aec03fa..e81eec63d 100644 --- a/Engine/source/gui/editor/inspector/componentGroup.cpp +++ b/Engine/source/gui/editor/inspector/componentGroup.cpp @@ -469,7 +469,7 @@ void GuiInspectorComponentGroup::onRightMouseUp(const GuiEvent &event) Con::executef(this, "onRightMouseUp", event.mousePoint); } -ConsoleMethod(GuiInspectorComponentGroup, inspectGroup, bool, 2, 2, "Refreshes the dynamic fields in the inspector.") +DefineEngineMethod(GuiInspectorComponentGroup, inspectGroup, bool, (),, "Refreshes the dynamic fields in the inspector.") { return object->inspectGroup(); } @@ -515,16 +515,17 @@ AbstractClassRep::Field* GuiInspectorComponentGroup::findObjectBehaviorField(Com } return NULL; } -ConsoleMethod(GuiInspectorComponentGroup, addDynamicField, void, 2, 2, "obj.addDynamicField();") + +DefineEngineMethod(GuiInspectorComponentGroup, addDynamicField, void, (), , "obj.addDynamicField();") { object->addDynamicField(); } -ConsoleMethod(GuiInspectorComponentGroup, removeDynamicField, void, 3, 3, "") +DefineEngineMethod(GuiInspectorComponentGroup, removeDynamicField, void, (), , "") { } -DefineEngineMethod(GuiInspectorComponentGroup, getComponent, S32, (), ,"") +DefineEngineMethod(GuiInspectorComponentGroup, getComponent, S32, (), , "") { return object->getComponent()->getId(); } diff --git a/Engine/source/gui/editor/inspector/entityGroup.cpp b/Engine/source/gui/editor/inspector/entityGroup.cpp index 7b7559833..de4897165 100644 --- a/Engine/source/gui/editor/inspector/entityGroup.cpp +++ b/Engine/source/gui/editor/inspector/entityGroup.cpp @@ -87,7 +87,8 @@ void GuiInspectorEntityGroup::onMouseMove(const GuiEvent &event) { //mParent->mOverDivider = false; } -ConsoleMethod(GuiInspectorEntityGroup, inspectGroup, bool, 2, 2, "Refreshes the dynamic fields in the inspector.") + +DefineEngineMethod(GuiInspectorEntityGroup, inspectGroup, bool, (),, "Refreshes the dynamic fields in the inspector.") { return object->inspectGroup(); } @@ -128,11 +129,12 @@ AbstractClassRep::Field* GuiInspectorEntityGroup::findObjectBehaviorField(Compon } return NULL; } -ConsoleMethod(GuiInspectorEntityGroup, addDynamicField, void, 2, 2, "obj.addDynamicField();") + +DefineEngineMethod(GuiInspectorEntityGroup, addDynamicField, void, (), , "obj.addDynamicField();") { object->addDynamicField(); } -ConsoleMethod(GuiInspectorEntityGroup, removeDynamicField, void, 3, 3, "") +DefineEngineMethod(GuiInspectorEntityGroup, removeDynamicField, void, (), , "") { } diff --git a/Engine/source/gui/editor/inspector/mountingGroup.cpp b/Engine/source/gui/editor/inspector/mountingGroup.cpp index 7afa53105..759139658 100644 --- a/Engine/source/gui/editor/inspector/mountingGroup.cpp +++ b/Engine/source/gui/editor/inspector/mountingGroup.cpp @@ -242,7 +242,8 @@ void GuiInspectorMountingGroup::onMouseMove(const GuiEvent &event) //mParent->mOverDivider = false; bool test = false; } -ConsoleMethod(GuiInspectorMountingGroup, inspectGroup, bool, 2, 2, "Refreshes the dynamic fields in the inspector.") + +DefineEngineMethod(GuiInspectorMountingGroup, inspectGroup, bool, (),, "Refreshes the dynamic fields in the inspector.") { return object->inspectGroup(); } @@ -319,12 +320,13 @@ AbstractClassRep::Field* GuiInspectorMountingGroup::findObjectComponentField(Com } return NULL; } -ConsoleMethod( GuiInspectorMountingGroup, addDynamicField, void, 2, 2, "obj.addDynamicField();" ) + +DefineEngineMethod(GuiInspectorMountingGroup, addDynamicField, void, (), , "obj.addDynamicField();") { object->addDynamicField(); } -ConsoleMethod( GuiInspectorMountingGroup, removeDynamicField, void, 3, 3, "" ) +DefineEngineMethod(GuiInspectorMountingGroup, removeDynamicField, void, (), , "") { } diff --git a/Engine/source/gui/worldEditor/worldEditorSelection.cpp b/Engine/source/gui/worldEditor/worldEditorSelection.cpp index 00311adea..472ac46ef 100644 --- a/Engine/source/gui/worldEditor/worldEditorSelection.cpp +++ b/Engine/source/gui/worldEditor/worldEditorSelection.cpp @@ -657,58 +657,42 @@ void WorldEditorSelection::setSize(const VectorF & newsize) //----------------------------------------------------------------------------- -ConsoleMethod( WorldEditorSelection, containsGlobalBounds, bool, 2, 2, "() - True if an object with global bounds is contained in the selection." ) +DefineEngineMethod( WorldEditorSelection, containsGlobalBounds, bool, (),, "True if an object with global bounds is contained in the selection." ) { return object->containsGlobalBounds(); } //----------------------------------------------------------------------------- -ConsoleMethod( WorldEditorSelection, getCentroid, const char*, 2, 2, "() - Return the median of all object positions in the selection." ) +DefineEngineMethod( WorldEditorSelection, getCentroid, Point3F, (),, "Return the median of all object positions in the selection." ) { - static const U32 bufSize = 256; - char* buffer = Con::getReturnBuffer( bufSize ); const Point3F& centroid = object->getCentroid(); - - dSprintf( buffer, bufSize, "%g %g %g", centroid.x, centroid.y, centroid.z ); - return buffer; + return centroid; } //----------------------------------------------------------------------------- -ConsoleMethod( WorldEditorSelection, getBoxCentroid, const char*, 2, 2, "() - Return the center of the bounding box around the selection." ) +DefineEngineMethod( WorldEditorSelection, getBoxCentroid, Point3F, (),, "Return the center of the bounding box around the selection." ) { - static const U32 bufSize = 256; - char* buffer = Con::getReturnBuffer( bufSize ); const Point3F& boxCentroid = object->getBoxCentroid(); - - dSprintf( buffer, bufSize, "%g %g %g", boxCentroid.x, boxCentroid.y, boxCentroid.z ); - return buffer; + return boxCentroid; } //----------------------------------------------------------------------------- -ConsoleMethod( WorldEditorSelection, offset, void, 3, 4, "( vector delta, float gridSnap=0 ) - Move all objects in the selection by the given delta." ) -{ - F32 x, y, z; - dSscanf( argv[ 3 ], "%g %g %g", &x, &y, &z ); - - F32 gridSnap = 0.f; - if( argc > 3 ) - gridSnap = dAtof( argv[ 3 ] ); - - object->offset( Point3F( x, y, z ), gridSnap ); +DefineEngineMethod(WorldEditorSelection, offset, void, (Point3F delta, F32 gridSnap), (0.0f), "Move all objects in the selection by the given delta.") +{ + object->offset( delta, gridSnap ); WorldEditor::updateClientTransforms( object ); } //----------------------------------------------------------------------------- -ConsoleMethod( WorldEditorSelection, union, void, 3, 3, "( SimSet set ) - Add all objects in the given set to this selection." ) +DefineEngineMethod( WorldEditorSelection, union, void, (SimSet* selection),, "Add all objects in the given set to this selection." ) { - SimSet* selection; - if( !Sim::findObject( argv[ 2 ], selection ) ) + if( !selection) { - Con::errorf( "WorldEditorSelection::union - no SimSet '%s'", (const char*)argv[ 2 ] ); + Con::errorf( "WorldEditorSelection::union - no SimSet"); return; } @@ -719,12 +703,11 @@ ConsoleMethod( WorldEditorSelection, union, void, 3, 3, "( SimSet set ) - Add al //----------------------------------------------------------------------------- -ConsoleMethod( WorldEditorSelection, subtract, void, 3, 3, "( SimSet ) - Remove all objects in the given set from this selection." ) +DefineEngineMethod( WorldEditorSelection, subtract, void, (SimSet* selection),, "Remove all objects in the given set from this selection." ) { - SimSet* selection; - if( !Sim::findObject( argv[ 2 ], selection ) ) + if( !selection ) { - Con::errorf( "WorldEditorSelection::subtract - no SimSet '%s'", (const char*)argv[ 2 ] ); + Con::errorf( "WorldEditorSelection::subtract - no SimSet" ); return; } diff --git a/Engine/source/navigation/guiNavEditorCtrl.cpp b/Engine/source/navigation/guiNavEditorCtrl.cpp index bc605c054..7ef0fb87e 100644 --- a/Engine/source/navigation/guiNavEditorCtrl.cpp +++ b/Engine/source/navigation/guiNavEditorCtrl.cpp @@ -627,13 +627,12 @@ void GuiNavEditorCtrl::_prepRenderImage(SceneManager* sceneGraph, const SceneRen }*/ } -ConsoleMethod(GuiNavEditorCtrl, getMode, const char*, 2, 2, "") +DefineEngineMethod(GuiNavEditorCtrl, getMode, const char*, (), , "") { return object->getMode(); } -ConsoleMethod(GuiNavEditorCtrl, setMode, void, 3, 3, "setMode(String mode)") +DefineEngineMethod(GuiNavEditorCtrl, setMode, void, (String mode),, "setMode(String mode)") { - String newMode = (argv[2]); - object->setMode(newMode); + object->setMode(mode); } diff --git a/Engine/source/util/settings.cpp b/Engine/source/util/settings.cpp index 60f58966e..96fd2d5c8 100644 --- a/Engine/source/util/settings.cpp +++ b/Engine/source/util/settings.cpp @@ -681,9 +681,8 @@ DefineEngineMethod(Settings, remove, void, (const char * settingName, bool inclu object->remove( settingName, includeDefaults ); } -ConsoleMethod(Settings, write, bool, 2, 2, "%success = settingObj.write();") +DefineEngineMethod(Settings, write, bool, (),, "%success = settingObj.write();") { - TORQUE_UNUSED(argc); TORQUE_UNUSED(argv); return object->write(); } From 6b524ae58a678a3610de036eaa5004d90687acf9 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Wed, 18 Apr 2018 14:19:07 +0200 Subject: [PATCH 273/312] Eliminate ConsoleStaticMethod --- Engine/source/console/console.h | 18 --------- .../gui/worldEditor/editorIconRegistry.cpp | 35 +++++++--------- .../gui/worldEditor/editorIconRegistry.h | 3 ++ Engine/source/postFx/postEffectVis.cpp | 25 ++++++------ Engine/source/postFx/postEffectVis.h | 5 +++ Engine/source/terrain/terrImport.cpp | 40 ++++++------------- 6 files changed, 47 insertions(+), 79 deletions(-) diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index a734cefbf..358b738f9 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -1220,15 +1220,6 @@ public: ConsoleConstructor cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage1,minArgs,maxArgs); \ inline returnType cm_##className##_##name(className *object, S32 argc, ConsoleValueRef *argv) -# define ConsoleStaticMethod(className,name,returnType,minArgs,maxArgs,usage1) \ - inline returnType cm_##className##_##name(S32, ConsoleValueRef *); \ - returnType cm_##className##_##name##_caster(SimObject *object, S32 argc, ConsoleValueRef *argv) { \ - conmethod_return_##returnType ) cm_##className##_##name(argc,argv); \ - }; \ - ConsoleConstructor \ - cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage1,minArgs,maxArgs); \ - inline returnType cm_##className##_##name(S32 argc, ConsoleValueRef *argv) - # define ConsoleMethodGroupEnd(className, groupName) \ static ConsoleConstructor cc_##className##_##groupName##_GroupEnd(#className,#groupName,NULL) @@ -1268,15 +1259,6 @@ public: className##name##obj(#className,#name,c##className##name##caster,"",minArgs,maxArgs); \ static inline returnType c##className##name(className *object, S32 argc, ConsoleValueRef *argv) -# define ConsoleStaticMethod(className,name,returnType,minArgs,maxArgs,usage1) \ - static inline returnType c##className##name(S32, ConsoleValueRef*); \ - static returnType c##className##name##caster(SimObject *object, S32 argc, ConsoleValueRef *argv) { \ - conmethod_return_##returnType ) c##className##name(argc,argv); \ - }; \ - static ConsoleConstructor \ - className##name##obj(#className,#name,c##className##name##caster,"",minArgs,maxArgs); \ - static inline returnType c##className##name(S32 argc, ConsoleValueRef *argv) - #define ConsoleDoc( text ) #endif diff --git a/Engine/source/gui/worldEditor/editorIconRegistry.cpp b/Engine/source/gui/worldEditor/editorIconRegistry.cpp index 8507d2ad2..b75a28335 100644 --- a/Engine/source/gui/worldEditor/editorIconRegistry.cpp +++ b/Engine/source/gui/worldEditor/editorIconRegistry.cpp @@ -23,7 +23,7 @@ #include "platform/platform.h" #include "gui/worldEditor/editorIconRegistry.h" -#include "console/console.h" +#include "console/engineAPI.h" #include "console/simBase.h" @@ -36,6 +36,8 @@ ConsoleDoc( "@internal" ); +IMPLEMENT_STATIC_CLASS(EditorIconRegistry,, ""); + EditorIconRegistry::EditorIconRegistry() { } @@ -168,51 +170,42 @@ void EditorIconRegistry::clear() mDefaultIcon.free(); } -ConsoleStaticMethod( EditorIconRegistry, add, void, 3, 4, "( String className, String imageFile [, bool overwrite = true] )" +DefineEngineStaticMethod( EditorIconRegistry, add, void, (String className, String imageFile, bool overwrite), (true), "@internal") { - bool overwrite = true; - if ( argc > 3 ) - overwrite = dAtob( argv[3] ); - - gEditorIcons.add( argv[1], argv[2], overwrite ); + gEditorIcons.add( className, imageFile, overwrite ); } -ConsoleStaticMethod( EditorIconRegistry, loadFromPath, void, 2, 3, "( String imagePath [, bool overwrite = true] )" +DefineEngineStaticMethod( EditorIconRegistry, loadFromPath, void, (String imagePath, bool overwrite), (true), "@internal") { - bool overwrite = true; - if ( argc > 2 ) - overwrite = dAtob( argv[2] ); - - gEditorIcons.loadFromPath( argv[1], overwrite ); + gEditorIcons.loadFromPath( imagePath, overwrite ); } -ConsoleStaticMethod( EditorIconRegistry, clear, void, 1, 1, "" +DefineEngineStaticMethod( EditorIconRegistry, clear, void, (),, "@internal") { gEditorIcons.clear(); } -ConsoleStaticMethod( EditorIconRegistry, findIconByClassName, const char*, 2, 2, "( String className )\n" - "Returns the file path to the icon file if found." +DefineEngineStaticMethod( EditorIconRegistry, findIconByClassName, const char*, (String className),, + "@brief Returns the file path to the icon file if found." "@internal") { - GFXTexHandle icon = gEditorIcons.findIcon( argv[1] ); + GFXTexHandle icon = gEditorIcons.findIcon( className ); if ( icon.isNull() ) return NULL; return icon->mPath; } -ConsoleStaticMethod( EditorIconRegistry, findIconBySimObject, const char*, 2, 2, "( SimObject )\n" +DefineEngineStaticMethod( EditorIconRegistry, findIconBySimObject, const char*, (SimObject* obj),, "Returns the file path to the icon file if found." "@internal") { - SimObject *obj = NULL; - if ( !Sim::findObject( argv[1], obj ) ) + if ( !obj ) { - Con::warnf( "EditorIconRegistry::findIcon, parameter %d was not a SimObject!", (const char*)argv[1] ); + Con::warnf( "EditorIconRegistry::findIcon, parameter was not a SimObject!"); return NULL; } diff --git a/Engine/source/gui/worldEditor/editorIconRegistry.h b/Engine/source/gui/worldEditor/editorIconRegistry.h index 35580d74c..a058b7ae7 100644 --- a/Engine/source/gui/worldEditor/editorIconRegistry.h +++ b/Engine/source/gui/worldEditor/editorIconRegistry.h @@ -30,6 +30,8 @@ #include "core/util/tDictionary.h" #endif +#include "console/engineAPI.h" + class SimObject; class AbstractClassRep; @@ -40,6 +42,7 @@ class AbstractClassRep; class EditorIconRegistry { public: + DECLARE_STATIC_CLASS(EditorIconRegistry); EditorIconRegistry(); ~EditorIconRegistry(); diff --git a/Engine/source/postFx/postEffectVis.cpp b/Engine/source/postFx/postEffectVis.cpp index bf507e162..b00ee55ae 100644 --- a/Engine/source/postFx/postEffectVis.cpp +++ b/Engine/source/postFx/postEffectVis.cpp @@ -41,6 +41,8 @@ ConsoleDoc( "@ingroup GFX\n" ); +IMPLEMENT_STATIC_CLASS(PfxVis, , "") + MODULE_BEGIN( PostEffectVis ) MODULE_INIT @@ -374,7 +376,8 @@ static ConsoleDocFragment _PfxVisclear( "PfxVis", "void clear();" ); -ConsoleStaticMethod( PfxVis, clear, void, 1, 1, "()" + +DefineEngineStaticMethod( PfxVis, clear, void, (),, "@hide") { PFXVIS->clear(); @@ -391,16 +394,15 @@ static ConsoleDocFragment _PfxVisopen( "PfxVis", "void open(PostEffect effect, bool clear);" ); -ConsoleStaticMethod( PfxVis, open, void, 2, 3, "( PostEffect, [bool clear = false] )" +DefineEngineStaticMethod( PfxVis, open, void, (PostEffect* pfx, bool clear), (false), "( PostEffect, [bool clear = false] )" "@hide") { - if ( argc == 3 && dAtob( argv[2] ) ) + if ( clear ) PFXVIS->clear(); - PostEffect *pfx; - if ( !Sim::findObject( argv[1], pfx ) ) + if ( !pfx ) { - Con::errorf( "PfxVis::add, argument %s was not a PostEffect", (const char*)argv[1] ); + Con::errorf( "PfxVis::add, argument was not a PostEffect"); return; } @@ -415,7 +417,7 @@ static ConsoleDocFragment _PfxVishide( "PfxVis", "void hide();" ); -ConsoleStaticMethod( PfxVis, hide, void, 1, 1, "()" +DefineEngineStaticMethod( PfxVis, hide, void, (),, "@hide") { PFXVIS->setVisible( false ); @@ -429,7 +431,7 @@ static ConsoleDocFragment _PfxVisshow( "PfxVis", "void show();" ); -ConsoleStaticMethod( PfxVis, show, void, 1, 1, "()" +DefineEngineStaticMethod( PfxVis, show, void, (),, "@hide") { PFXVIS->setVisible( true ); @@ -444,13 +446,12 @@ static ConsoleDocFragment _PfxVisonWindowClosed( "PfxVis", "void onWindowClosed(GuiWindowCtrl *ctrl);" ); -ConsoleStaticMethod( PfxVis, onWindowClosed, void, 2, 2, "( GuiWindowCtrl )" +DefineEngineStaticMethod( PfxVis, onWindowClosed, void, (GuiWindowCtrl* ctrl),, "@hide") { - GuiWindowCtrl *ctrl; - if ( !Sim::findObject( argv[1], ctrl ) ) + if ( !ctrl ) { - Con::errorf( "PfxVis::onWindowClosed, argument %s was not a GuiWindowCtrl", (const char*)argv[1] ); + Con::errorf( "PfxVis::onWindowClosed, argument was not a GuiWindowCtrl"); return; } diff --git a/Engine/source/postFx/postEffectVis.h b/Engine/source/postFx/postEffectVis.h index 972a7ea78..0ef807a58 100644 --- a/Engine/source/postFx/postEffectVis.h +++ b/Engine/source/postFx/postEffectVis.h @@ -104,6 +104,11 @@ public: static const char* getSingletonName() { return "PostEffectVis"; } }; +class PfxVis +{ + DECLARE_STATIC_CLASS(PfxVis) +}; + /// Returns the PostEffectVis singleton. #define PFXVIS ManagedSingleton::instance() diff --git a/Engine/source/terrain/terrImport.cpp b/Engine/source/terrain/terrImport.cpp index ad9a8d98b..063a80c93 100644 --- a/Engine/source/terrain/terrImport.cpp +++ b/Engine/source/terrain/terrImport.cpp @@ -33,15 +33,9 @@ using namespace Torque; -ConsoleStaticMethod( TerrainBlock, createNew, S32, 5, 5, - "TerrainBlock.create( String terrainName, U32 resolution, String materialName, bool genNoise )\n" +DefineEngineStaticMethod( TerrainBlock, createNew, S32, (String terrainName, U32 resolution, String materialName, bool genNoise),, "" ) { - const UTF8 *terrainName = argv[1]; - U32 resolution = dAtoi( argv[2] ); - const UTF8 *materialName = argv[3]; - bool genNoise = dAtob( argv[4] ); - Vector materials; materials.push_back( materialName ); @@ -82,17 +76,17 @@ ConsoleStaticMethod( TerrainBlock, createNew, S32, 5, 5, noise.setSeed( 134208587 ); // Set up some defaults. - F32 octaves = 3.0f; - U32 freq = 4; - F32 roughness = 0.0f; + const F32 octaves = 3.0f; + const U32 freq = 4; + const F32 roughness = 0.0f; noise.fBm( &floatHeights, blockSize, freq, 1.0f - roughness, octaves ); F32 height = 0; F32 omax, omin; noise.getMinMax( &floatHeights, &omin, &omax, blockSize ); - - F32 terrscale = 300.0f / (omax - omin); + + const F32 terrscale = 300.0f / (omax - omin); for ( S32 y = 0; y < blockSize; y++ ) { for ( S32 x = 0; x < blockSize; x++ ) @@ -111,7 +105,7 @@ ConsoleStaticMethod( TerrainBlock, createNew, S32, 5, 5, terrain->updateGridMaterials( Point2I::Zero, Point2I( blockSize, blockSize ) ); } - terrain->registerObject( terrainName ); + terrain->registerObject( terrainName.c_str() ); // Add to mission group! SimGroup *missionGroup; @@ -121,21 +115,11 @@ ConsoleStaticMethod( TerrainBlock, createNew, S32, 5, 5, return terrain->getId(); } -ConsoleStaticMethod( TerrainBlock, import, S32, 7, 8, - "( String terrainName, String heightMap, F32 metersPerPixel, F32 heightScale, String materials, String opacityLayers[, bool flipYAxis=true] )\n" +DefineEngineStaticMethod( TerrainBlock, import, S32, (String terrainName, String heightMapFile, F32 metersPerPixel, F32 heightScale, String opacityLayerFiles, String materialsStr, bool flipYAxis), (true), "" ) { - // Get the parameters. - const UTF8 *terrainName = argv[1]; - const UTF8 *hmap = argv[2]; - F32 metersPerPixel = dAtof(argv[3]); - F32 heightScale = dAtof(argv[4]); - const UTF8 *opacityFiles = argv[5]; - const UTF8 *materialsStr = argv[6]; - bool flipYAxis = argc == 8? dAtob(argv[7]) : true; - // First load the height map and validate it. - Resource heightmap = GBitmap::load( hmap ); + Resource heightmap = GBitmap::load(heightMapFile); if ( !heightmap ) { Con::errorf( "Heightmap failed to load!" ); @@ -155,7 +139,7 @@ ConsoleStaticMethod( TerrainBlock, import, S32, 7, 8, return 0; } - U32 fileCount = StringUnit::getUnitCount( opacityFiles, "\n" ); + U32 fileCount = StringUnit::getUnitCount(opacityLayerFiles, "\n" ); Vector layerMap; layerMap.setSize( terrSize * terrSize ); { @@ -163,7 +147,7 @@ ConsoleStaticMethod( TerrainBlock, import, S32, 7, 8, for ( U32 i = 0; i < fileCount; i++ ) { - String fileNameWithChannel = StringUnit::getUnit( opacityFiles, i, "\n" ); + String fileNameWithChannel = StringUnit::getUnit(opacityLayerFiles, i, "\n" ); String fileName = StringUnit::getUnit( fileNameWithChannel, 0, "\t" ); String channel = StringUnit::getUnit( fileNameWithChannel, 1, "\t" ); @@ -251,7 +235,7 @@ ConsoleStaticMethod( TerrainBlock, import, S32, 7, 8, } // Do we have an existing terrain with that name... then update it! - TerrainBlock *terrain = dynamic_cast( Sim::findObject( terrainName ) ); + TerrainBlock *terrain = dynamic_cast( Sim::findObject( terrainName.c_str() ) ); if ( terrain ) terrain->import( (*heightmap), heightScale, metersPerPixel, layerMap, materials, flipYAxis ); else From 7d91d0a5776763147043953acb5ca5ef2e36d4b0 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Fri, 20 Apr 2018 22:09:58 +0200 Subject: [PATCH 274/312] Eliminate ConsoleFunction and ConsoleMethod, replace with DefineEngineStringlyVariadic --- Engine/source/T3D/aiConnection.cpp | 2 +- Engine/source/T3D/gameBase/gameConnection.cpp | 2 +- Engine/source/afx/afxCamera.cpp | 2 +- Engine/source/afx/afxMagicSpell.cpp | 44 +++++++------- Engine/source/afx/arcaneFX.cpp | 14 ++--- Engine/source/app/net/net.cpp | 6 +- Engine/source/cinterface/c_scripting.cpp | 2 +- Engine/source/console/console.h | 14 ----- Engine/source/console/consoleFunctions.cpp | 10 ++-- Engine/source/console/engineAPI.h | 58 +++++++++++++++++++ Engine/source/console/sim.cpp | 2 +- Engine/source/console/simObject.cpp | 4 +- Engine/source/console/simSet.cpp | 24 ++------ Engine/source/gui/editor/guiFilterCtrl.cpp | 2 +- Engine/source/gui/editor/guiGraphCtrl.cpp | 2 +- Engine/source/gui/worldEditor/worldEditor.cpp | 2 +- Engine/source/platformWin32/winMath.cpp | 2 +- Engine/source/sim/actionMap.cpp | 4 +- 18 files changed, 112 insertions(+), 84 deletions(-) diff --git a/Engine/source/T3D/aiConnection.cpp b/Engine/source/T3D/aiConnection.cpp index 21564d5eb..42ed1dff3 100644 --- a/Engine/source/T3D/aiConnection.cpp +++ b/Engine/source/T3D/aiConnection.cpp @@ -130,7 +130,7 @@ static inline F32 moveClamp(F32 v) //----------------------------------------------------------------------------- /// Construct and connect an AI connection object -ConsoleFunction(aiConnect, S32 , 2, 20, "(...)" +DefineEngineStringlyVariadicFunction(aiConnect, S32 , 2, 20, "(...)" "@brief Creates a new AIConnection, and passes arguments to its onConnect script callback.\n\n" "@returns The newly created AIConnection\n" "@see GameConnection for parameter information\n" diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index 2376e7180..dc5f69367 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -326,7 +326,7 @@ DefineEngineMethod( GameConnection, setJoinPassword, void, (const char* password object->setJoinPassword(password); } -ConsoleMethod(GameConnection, setConnectArgs, void, 3, 17, +DefineEngineStringlyVariadicMethod(GameConnection, setConnectArgs, void, 3, 17, "(const char* args) @brief On the client, pass along a variable set of parameters to the server.\n\n" "Once the connection is established with the server, the server calls its onConnect() method " diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index 1aad5f455..3c460dad8 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -452,7 +452,7 @@ const char* afxCamera::getMode() static char buffer[100]; -ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8, +DefineEngineStringlyVariadicMethod(afxCamera, setOrbitMode, void, 7, 8, "(GameBase orbitObject, TransformF mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" "Set the camera to orbit around some given object.\n\n" "@param orbitObject Object we want to orbit.\n" diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 7aeb93da8..b7f2714ea 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -2633,29 +2633,29 @@ DefineEngineMethod(afxMagicSpell, getImpactedObject, S32, (),, return (imp_obj) ? imp_obj->getId() : -1; } -ConsoleMethod(afxMagicSpell, setTimeFactor, void, 3, 4, "(F32 factor) or (string phase, F32 factor)" - "Sets the time-factor for the spell, either overall or for a specific phrase.\n\n" - "@ingroup AFX") +DefineEngineStringlyVariadicMethod(afxMagicSpell, setTimeFactor, void, 3, 4, "(F32 factor) or (string phase, F32 factor)" + "Sets the time-factor for the spell, either overall or for a specific phrase.\n\n" + "@ingroup AFX") { - if (argc == 3) - object->setTimeFactor(dAtof(argv[2])); - else - { - if (dStricmp(argv[2], "overall") == 0) - object->setTimeFactor(dAtof(argv[3])); - else if (dStricmp(argv[2], "casting") == 0) - object->setTimeFactor(afxMagicSpell::CASTING_PHRASE, dAtof(argv[3])); - else if (dStricmp(argv[2], "launch") == 0) - object->setTimeFactor(afxMagicSpell::LAUNCH_PHRASE, dAtof(argv[3])); - else if (dStricmp(argv[2], "delivery") == 0) - object->setTimeFactor(afxMagicSpell::DELIVERY_PHRASE, dAtof(argv[3])); - else if (dStricmp(argv[2], "impact") == 0) - object->setTimeFactor(afxMagicSpell::IMPACT_PHRASE, dAtof(argv[3])); - else if (dStricmp(argv[2], "linger") == 0) - object->setTimeFactor(afxMagicSpell::LINGER_PHRASE, dAtof(argv[3])); - else - Con::errorf("afxMagicSpell::setTimeFactor() -- unknown spell phrase [%s].", argv[2].getStringValue()); - } + if (argc == 3) + object->setTimeFactor(dAtof(argv[2])); + else + { + if (dStricmp(argv[2], "overall") == 0) + object->setTimeFactor(dAtof(argv[3])); + else if (dStricmp(argv[2], "casting") == 0) + object->setTimeFactor(afxMagicSpell::CASTING_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "launch") == 0) + object->setTimeFactor(afxMagicSpell::LAUNCH_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "delivery") == 0) + object->setTimeFactor(afxMagicSpell::DELIVERY_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "impact") == 0) + object->setTimeFactor(afxMagicSpell::IMPACT_PHRASE, dAtof(argv[3])); + else if (dStricmp(argv[2], "linger") == 0) + object->setTimeFactor(afxMagicSpell::LINGER_PHRASE, dAtof(argv[3])); + else + Con::errorf("afxMagicSpell::setTimeFactor() -- unknown spell phrase [%s].", argv[2].getStringValue()); + } } DefineEngineMethod(afxMagicSpell, interruptStage, void, (),, diff --git a/Engine/source/afx/arcaneFX.cpp b/Engine/source/afx/arcaneFX.cpp index 4252183c1..385c056f6 100644 --- a/Engine/source/afx/arcaneFX.cpp +++ b/Engine/source/afx/arcaneFX.cpp @@ -860,18 +860,18 @@ DefineEngineFunction(getMaxF, F32, (float a, float b),, return getMax(a, b); } -ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)" - "Like echo(), but first argument is returned.\n" - "@ingroup AFX") +DefineEngineStringlyVariadicFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)" + "Like echo(), but first argument is returned.\n" + "@ingroup AFX") { U32 len = 0; S32 i; - for(i = 2; i < argc; i++) + for (i = 2; i < argc; i++) len += dStrlen(argv[i]); char *ret = Con::getReturnBuffer(len + 1); ret[0] = 0; - for(i = 2; i < argc; i++) + for (i = 2; i < argc; i++) dStrcat(ret, argv[i], len + 1); Con::printf("%s -- [%s]", ret, argv[1].getStringValue()); @@ -880,7 +880,7 @@ ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)" return argv[1]; } -ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)" +DefineEngineStringlyVariadicFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)" "Like warn(), but first argument is returned.\n" "@ingroup AFX") { @@ -900,7 +900,7 @@ ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)" return argv[1]; } -ConsoleFunction(errorThru, const char*, 2, 0, "(string passthru, string text...)" +DefineEngineStringlyVariadicFunction(errorThru, const char*, 2, 0, "(string passthru, string text...)" "Like error(), but first argument is returned.\n" "@ingroup AFX") { diff --git a/Engine/source/app/net/net.cpp b/Engine/source/app/net/net.cpp index c5f1be189..abec3ccc1 100644 --- a/Engine/source/app/net/net.cpp +++ b/Engine/source/app/net/net.cpp @@ -212,7 +212,7 @@ ConsoleDocClass( RemoteCommandEvent, ConsoleFunctionGroupBegin( Net, "Functions for use with the network; tagged strings and remote commands."); -ConsoleFunction( commandToServer, void, 2, RemoteCommandEvent::MaxRemoteCommandArgs + 1, "(string func, ...)" +DefineEngineStringlyVariadicFunction( commandToServer, void, 2, RemoteCommandEvent::MaxRemoteCommandArgs + 1, "(string func, ...)" "@brief Send a command to the server.\n\n" "@param func Name of the server command being called\n" @@ -255,7 +255,7 @@ ConsoleFunction( commandToServer, void, 2, RemoteCommandEvent::MaxRemoteCommandA RemoteCommandEvent::sendRemoteCommand(conn, args.count(), args); } -ConsoleFunction( commandToClient, void, 3, RemoteCommandEvent::MaxRemoteCommandArgs + 2, "(NetConnection client, string func, ...)" +DefineEngineStringlyVariadicFunction( commandToClient, void, 3, RemoteCommandEvent::MaxRemoteCommandArgs + 2, "(NetConnection client, string func, ...)" "@brief Send a command from the server to the client\n\n" "@param client The numeric ID of a client GameConnection\n" @@ -349,7 +349,7 @@ DefineEngineFunction(getTaggedString, const char* , (const char *tag), (""), -ConsoleFunction( buildTaggedString, const char*, 2, 11, "(string format, ...)" +DefineEngineStringlyVariadicFunction( buildTaggedString, const char*, 2, 11, "(string format, ...)" "@brief Build a string using the specified tagged string format.\n\n" "This function takes an already tagged string (passed in as a tagged string ID) and one " diff --git a/Engine/source/cinterface/c_scripting.cpp b/Engine/source/cinterface/c_scripting.cpp index 1138cbc1c..f10effde2 100644 --- a/Engine/source/cinterface/c_scripting.cpp +++ b/Engine/source/cinterface/c_scripting.cpp @@ -420,7 +420,7 @@ extern "C" { } -ConsoleFunction(TestFunction2Args, const char *, 3, 3, "testFunction(arg1, arg2)") +DefineEngineStringlyVariadicFunction(TestFunction2Args, const char *, 3, 3, "testFunction(arg1, arg2)") { return "Return Value"; } diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 358b738f9..dfa3cd5a8 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -1191,11 +1191,6 @@ public: # define ConsoleFunctionGroupBegin(groupName, usage) \ static ConsoleConstructor cfg_ConsoleFunctionGroup_##groupName##_GroupBegin(NULL,#groupName,usage) -# define ConsoleFunction(name,returnType,minArgs,maxArgs,usage1) \ - returnType cf_##name(SimObject *, S32, ConsoleValueRef *argv); \ - ConsoleConstructor cc_##name##_obj(NULL,#name,cf_##name,usage1,minArgs,maxArgs); \ - returnType cf_##name(SimObject *, S32 argc, ConsoleValueRef *argv) - # define ConsoleToolFunction(name,returnType,minArgs,maxArgs,usage1) \ returnType ctf_##name(SimObject *, S32, ConsoleValueRef *argv); \ ConsoleConstructor cc_##name##_obj(NULL,#name,ctf_##name,usage1,minArgs,maxArgs, true); \ @@ -1211,15 +1206,6 @@ public: # define ConsoleMethodGroupBegin(className, groupName, usage) \ static ConsoleConstructor cc_##className##_##groupName##_GroupBegin(#className,#groupName,usage) -# define ConsoleMethod(className,name,returnType,minArgs,maxArgs,usage1) \ - inline returnType cm_##className##_##name(className *, S32, ConsoleValueRef *argv); \ - returnType cm_##className##_##name##_caster(SimObject *object, S32 argc, ConsoleValueRef *argv) { \ - AssertFatal( dynamic_cast( object ), "Object passed to " #name " is not a " #className "!" ); \ - conmethod_return_##returnType ) cm_##className##_##name(static_cast(object),argc,argv); \ - }; \ - ConsoleConstructor cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage1,minArgs,maxArgs); \ - inline returnType cm_##className##_##name(className *object, S32 argc, ConsoleValueRef *argv) - # define ConsoleMethodGroupEnd(className, groupName) \ static ConsoleConstructor cc_##className##_##groupName##_GroupEnd(#className,#groupName,NULL) diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 565c79206..33c1c9a5f 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -1200,7 +1200,7 @@ DefineEngineFunction( isValidIP, bool, ( const char* str),, // Torque won't normally add another string if it already exists with another casing, // so this forces the addition. It should be called once near the start, such as in main.cs. -ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]" +DefineEngineStringlyVariadicFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]" "Adds case sensitive strings to the StringTable.") { for(int i = 1; i < argc; i++) @@ -1879,7 +1879,7 @@ DefineEngineFunction( getTag, const char*, ( const char* textTagString ), , "( s //----------------------------------------------------------------------------- -ConsoleFunction( echo, void, 2, 0, "( string message... ) " +DefineEngineStringlyVariadicFunction( echo, void, 2, 0, "( string message... ) " "@brief Logs a message to the console.\n\n" "Concatenates all given arguments to a single string and prints the string to the console. " "A newline is added automatically after the text.\n\n" @@ -1902,7 +1902,7 @@ ConsoleFunction( echo, void, 2, 0, "( string message... ) " //----------------------------------------------------------------------------- -ConsoleFunction( warn, void, 2, 0, "( string message... ) " +DefineEngineStringlyVariadicFunction( warn, void, 2, 0, "( string message... ) " "@brief Logs a warning message to the console.\n\n" "Concatenates all given arguments to a single string and prints the string to the console as a warning " "message (in the in-game console, these will show up using a turquoise font by default). " @@ -1926,7 +1926,7 @@ ConsoleFunction( warn, void, 2, 0, "( string message... ) " //----------------------------------------------------------------------------- -ConsoleFunction( error, void, 2, 0, "( string message... ) " +DefineEngineStringlyVariadicFunction( error, void, 2, 0, "( string message... ) " "@brief Logs an error message to the console.\n\n" "Concatenates all given arguments to a single string and prints the string to the console as an error " "message (in the in-game console, these will show up using a red font by default). " @@ -2236,7 +2236,7 @@ DefineEngineFunction( generateUUID, Torque::UUID, (),, //----------------------------------------------------------------------------- -ConsoleFunction( call, const char *, 2, 0, "( string functionName, string args... ) " +DefineEngineStringlyVariadicFunction( call, const char *, 2, 0, "( string functionName, string args... ) " "Apply the given arguments to the specified global function and return the result of the call.\n\n" "@param functionName The name of the function to call. This function must be in the global namespace, i.e. " "you cannot call a function in a namespace through #call. Use eval() for that.\n" diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index 6d0484171..ab1717745 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -855,6 +855,64 @@ public: ); \ static inline returnType _fn ## className ## name ## impl args +# define DefineEngineStringlyVariadicFunction(name,returnType,minArgs,maxArgs,usage) \ + static inline returnType _fn ## name ## impl (SimObject *, S32 argc, ConsoleValueRef *argv); \ + TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \ + (S32 argc, const char** argv) \ + { \ + _CHECK_ENGINE_INITIALIZED( name, returnType ); \ + StringStackConsoleWrapper args(argc, argv); \ + return EngineTypeTraits< returnType >::ReturnValue( \ + _fn ## name ## impl(NULL, args.count(), args) \ + ); \ + } \ + static _EngineFunctionDefaultArguments< void (S32 argc, const char** argv) > _fn ## name ## DefaultArgs; \ + static EngineFunctionInfo _fn ## name ## FunctionInfo( \ + #name, \ + &_SCOPE<>()(), \ + usage, \ + #returnType " " #name "(S32 argc, const char** argv)", \ + "fn" #name, \ + TYPE< returnType (S32 argc, const char** argv) >(), \ + &_fn ## name ## DefaultArgs, \ + ( void* ) &fn ## name, \ + 0 \ + ); \ + ConsoleConstructor cc_##name##_obj(NULL,#name,_fn ## name ## impl,usage,minArgs,maxArgs); \ + returnType _fn ## name ## impl(SimObject *, S32 argc, ConsoleValueRef *argv) + +# define DefineEngineStringlyVariadicMethod(className, name,returnType,minArgs,maxArgs,usage) \ + static inline returnType _fn ## className ## _ ## name ## impl (className* object, S32 argc, ConsoleValueRef* argv); \ + TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \ + (className* object, S32 argc, const char** argv) \ + { \ + _CHECK_ENGINE_INITIALIZED( name, returnType ); \ + StringStackConsoleWrapper args(argc, argv); \ + return EngineTypeTraits< returnType >::ReturnValue( \ + _fn ## className ## _ ## name ## impl(object, args.count(), args) \ + ); \ + } \ + static _EngineFunctionDefaultArguments< void (className* object, S32 argc, const char** argv) > _fn ## className ## _ ## name ## DefaultArgs; \ + static EngineFunctionInfo _fn ## className ## _ ## name ## FunctionInfo( \ + #name, \ + &_SCOPE<>()(), \ + usage, \ + #returnType " " #name "(SimObject* object, S32 argc, const char** argv)", \ + "fn" #className "_" #name, \ + TYPE< returnType (SimObject* object, S32 argc, const char** argv) >(), \ + &_fn ## className ## _ ## name ## DefaultArgs, \ + ( void* ) &fn ## className ## _ ## name, \ + 0 \ + ); \ + returnType cm_##className##_##name##_caster(SimObject* object, S32 argc, ConsoleValueRef* argv) { \ + AssertFatal( dynamic_cast( object ), "Object passed to " #name " is not a " #className "!" ); \ + conmethod_return_##returnType ) _fn ## className ## _ ## name ## impl(static_cast(object),argc,argv); \ + }; \ + ConsoleConstructor cc_##className##_##name##_obj(#className,#name,cm_##className##_##name##_caster,usage,minArgs,maxArgs); \ + static inline returnType _fn ## className ## _ ## name ## impl(className *object, S32 argc, ConsoleValueRef *argv) + + + // The following three macros are only temporary. They allow to define engineAPI functions using the framework // here in this file while being visible only in the new API. When the console interop is removed, these macros // can be removed and all their uses be replaced with their corresponding versions that now still include support diff --git a/Engine/source/console/sim.cpp b/Engine/source/console/sim.cpp index 6bb194db3..1fbcdd748 100644 --- a/Engine/source/console/sim.cpp +++ b/Engine/source/console/sim.cpp @@ -181,7 +181,7 @@ DefineEngineFunction( getTimeSinceStart, S32, (S32 scheduleId), ,"getTimeSinceSt return ret; } -ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, )") +DefineEngineStringlyVariadicFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, )") { U32 timeDelta = U32(dAtof(argv[1])); SimObject *refObject = Sim::findObject(argv[2]); diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index 62ac25fd1..02d7eec40 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -2945,7 +2945,7 @@ DefineEngineMethod( SimObject, setFieldType, void, ( const char* fieldName, cons //----------------------------------------------------------------------------- -ConsoleMethod( SimObject, call, const char*, 3, 0, "( string method, string args... ) Dynamically call a method on an object.\n" +DefineEngineStringlyVariadicMethod( SimObject, call, const char*, 3, 0, "( string method, string args... ) Dynamically call a method on an object.\n" "@param method Name of method to call.\n" "@param args Zero or more arguments for the method.\n" "@return The result of the method call." ) @@ -3047,7 +3047,7 @@ DefineEngineMethod( SimObject, delete, void, (),, //----------------------------------------------------------------------------- -ConsoleMethod( SimObject,schedule, S32, 4, 0, "( float time, string method, string args... ) Delay an invocation of a method.\n" +DefineEngineStringlyVariadicMethod( SimObject,schedule, S32, 4, 0, "( float time, string method, string args... ) Delay an invocation of a method.\n" "@param time The number of milliseconds after which to invoke the method. This is a soft limit.\n" "@param method The method to call.\n" "@param args The arguments with which to call the method.\n" diff --git a/Engine/source/console/simSet.cpp b/Engine/source/console/simSet.cpp index 545c411b7..e04416d30 100644 --- a/Engine/source/console/simSet.cpp +++ b/Engine/source/console/simSet.cpp @@ -895,15 +895,7 @@ DefineEngineMethod( SimSet, listObjects, void, (),, //----------------------------------------------------------------------------- -DEFINE_CALLIN( fnSimSet_add, add, SimSet, void, ( SimSet* set, SimObject* object ),,, - "Add the given object to the set.\n" - "@param object An object." ) -{ - if( object ) - set->addObject( object ); -} - -ConsoleMethod( SimSet, add, void, 3, 0, +DefineEngineStringlyVariadicMethod( SimSet, add, void, 3, 0, "( SimObject objects... ) Add the given objects to the set.\n" "@param objects The objects to add to the set." ) { @@ -919,15 +911,7 @@ ConsoleMethod( SimSet, add, void, 3, 0, //----------------------------------------------------------------------------- -DEFINE_CALLIN( fnSimSet_remove, remove, SimSet, void, ( SimSet* set, SimObject* object ),,, - "Remove the given object from the set.\n" - "@param object An object." ) -{ - if( object ) - set->removeObject( object ); -} - -ConsoleMethod( SimSet, remove, void, 3, 0, +DefineEngineStringlyVariadicMethod( SimSet, remove, void, 3, 0, "( SimObject objects... ) Remove the given objects from the set.\n" "@param objects The objects to remove from the set." ) { @@ -970,7 +954,7 @@ DefineEngineMethod( SimSet, getRandom, SimObject*, (),, //----------------------------------------------------------------------------- -ConsoleMethod( SimSet, callOnChildren, void, 3, 0, +DefineEngineStringlyVariadicMethod( SimSet, callOnChildren, void, 3, 0, "( string method, string args... ) Call a method on all objects contained in the set.\n\n" "@param method The name of the method to call.\n" "@param args The arguments to the method.\n\n" @@ -982,7 +966,7 @@ ConsoleMethod( SimSet, callOnChildren, void, 3, 0, //----------------------------------------------------------------------------- -ConsoleMethod( SimSet, callOnChildrenNoRecurse, void, 3, 0, +DefineEngineStringlyVariadicMethod( SimSet, callOnChildrenNoRecurse, void, 3, 0, "( string method, string args... ) Call a method on all objects contained in the set.\n\n" "@param method The name of the method to call.\n" "@param args The arguments to the method.\n\n" diff --git a/Engine/source/gui/editor/guiFilterCtrl.cpp b/Engine/source/gui/editor/guiFilterCtrl.cpp index c0d9c2a72..7870abe24 100644 --- a/Engine/source/gui/editor/guiFilterCtrl.cpp +++ b/Engine/source/gui/editor/guiFilterCtrl.cpp @@ -77,7 +77,7 @@ DefineEngineMethod( GuiFilterCtrl, getValue, const char*, (), , "Return a tuple return buffer; } -ConsoleMethod( GuiFilterCtrl, setValue, void, 3, 20, "(f1, f2, ...)" +DefineEngineStringlyVariadicMethod( GuiFilterCtrl, setValue, void, 3, 20, "(f1, f2, ...)" "Reset the filter to use the specified points, spread equidistantly across the domain." "@internal") { diff --git a/Engine/source/gui/editor/guiGraphCtrl.cpp b/Engine/source/gui/editor/guiGraphCtrl.cpp index 8b1c14108..343f56e24 100644 --- a/Engine/source/gui/editor/guiGraphCtrl.cpp +++ b/Engine/source/gui/editor/guiGraphCtrl.cpp @@ -407,7 +407,7 @@ DefineEngineMethod( GuiGraphCtrl, setGraphType, void, ( S32 plotId, GuiGraphType //----------------------------------------------------------------------------- -ConsoleMethod( GuiGraphCtrl, matchScale, void, 3, GuiGraphCtrl::MaxPlots + 2, "( int plotID1, int plotID2, ... ) " +DefineEngineStringlyVariadicMethod( GuiGraphCtrl, matchScale, void, 3, GuiGraphCtrl::MaxPlots + 2, "( int plotID1, int plotID2, ... ) " "Set the scale of all specified plots to the maximum scale among them.\n\n" "@param plotID1 Index of plotting curve.\n" "@param plotID2 Index of plotting curve." ) diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index 24e710091..1f95b6376 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -3225,7 +3225,7 @@ void WorldEditor::setEditorTool(EditorTool* newTool) //------------------------------------------------------------------------------ -ConsoleMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)") +DefineEngineStringlyVariadicMethod( WorldEditor, ignoreObjClass, void, 3, 0, "(string class_name, ...)") { object->ignoreObjClass(argc, argv); } diff --git a/Engine/source/platformWin32/winMath.cpp b/Engine/source/platformWin32/winMath.cpp index 50e5fdbc6..3b6e3ec15 100644 --- a/Engine/source/platformWin32/winMath.cpp +++ b/Engine/source/platformWin32/winMath.cpp @@ -33,7 +33,7 @@ extern void mInstall_AMD_Math(); extern void mInstall_Library_SSE(); //-------------------------------------- -ConsoleFunction( mathInit, void, 1, 10, "( ... )" +DefineEngineStringlyVariadicFunction( mathInit, void, 1, 10, "( ... )" "@brief Install the math library with specified extensions.\n\n" "Possible parameters are:\n\n" " - 'DETECT' Autodetect math lib settings.\n\n" diff --git a/Engine/source/sim/actionMap.cpp b/Engine/source/sim/actionMap.cpp index ca2932e84..a69ec4bea 100644 --- a/Engine/source/sim/actionMap.cpp +++ b/Engine/source/sim/actionMap.cpp @@ -2077,7 +2077,7 @@ static ConsoleDocFragment _ActionMapbind2( "ActionMap", "bool bind( string device, string action, string flag, string deadZone, string scale, string command );"); -ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier, spec, mod...], command )" +DefineEngineStringlyVariadicMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier, spec, mod...], command )" "@hide") { StringStackWrapper args(argc - 2, argv + 2); @@ -2126,7 +2126,7 @@ static ConsoleDocFragment _ActionMapbindObj2( "ActionMap", "bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );"); -ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier, spec, mod...], command, object)" +DefineEngineStringlyVariadicMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier, spec, mod...], command, object)" "@hide") { SimObject* simObject = Sim::findObject(argv[argc - 1]); From b0be06c33de319d3a1fc3505b83ad7f2565a395b Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 09:03:04 +0200 Subject: [PATCH 275/312] Add initPersistFields to mPropertyTable --- Engine/source/console/consoleObject.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Engine/source/console/consoleObject.h b/Engine/source/console/consoleObject.h index 7eea3144e..08cb0dcec 100644 --- a/Engine/source/console/consoleObject.h +++ b/Engine/source/console/consoleObject.h @@ -662,6 +662,27 @@ public: // Finally, do any class specific initialization... T::initPersistFields(); T::consoleInit(); + + EnginePropertyTable::Property* props = new EnginePropertyTable::Property[sg_tempFieldList.size()]; + + for (int i = 0; i < sg_tempFieldList.size(); ++i) + { + EnginePropertyTable::Property prop; + prop.mDocString = sg_tempFieldList[i].pFieldDocs; + prop.mName = sg_tempFieldList[i].pFieldname; + prop.mNumElements = sg_tempFieldList[i].elementCount; + prop.mFlags = 0; + if (sg_tempFieldList[i].type == StartGroupFieldType) + prop.mFlags |= EnginePropertyGroupBegin; + if (sg_tempFieldList[i].type == EndGroupFieldType) + prop.mFlags |= EnginePropertyGroupEnd; + props[i] = prop; + } + + _smPropertyTable = EnginePropertyTable(sg_tempFieldList.size(), props); + smPropertyTable = _smPropertyTable; + + const_cast(mTypeInfo)->mPropertyTable = &_smPropertyTable; // Let the base finish up. AbstractClassRep::init(); From c1a234cae667655b3988add3fb1c66962f780f34 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 09:06:16 +0200 Subject: [PATCH 276/312] Fix EngineAPI xml generation, utilizing fixed_tuple for default args --- Engine/source/console/engineFunctions.h | 9 +- Engine/source/console/engineXMLExport.cpp | 2 +- Engine/source/console/fixedTuple.h | 153 ++++++++++++++++++++++ 3 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 Engine/source/console/fixedTuple.h diff --git a/Engine/source/console/engineFunctions.h b/Engine/source/console/engineFunctions.h index 0f2a3f45d..eb935d995 100644 --- a/Engine/source/console/engineFunctions.h +++ b/Engine/source/console/engineFunctions.h @@ -25,6 +25,10 @@ #include +#ifndef _FIXEDTUPLE_H_ +#include "fixedTuple.h" +#endif + #ifndef _ENGINEEXPORTS_H_ #include "console/engineExports.h" #endif @@ -94,6 +98,7 @@ template struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments { template using DefVST = typename EngineTypeTraits::DefaultArgumentValueStoreType; + fixed_tuple ...> mFixedArgs; std::tuple ...> mArgs; private: using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >; @@ -130,7 +135,9 @@ private: public: template _EngineFunctionDefaultArguments(TailTs ...tail) : EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...)) - {} + { + fixed_tuple_mutator...), void(DefVST...)>::copy(mArgs, mFixedArgs); + } }; #pragma pack( pop ) diff --git a/Engine/source/console/engineXMLExport.cpp b/Engine/source/console/engineXMLExport.cpp index ce12121e8..51951c52b 100644 --- a/Engine/source/console/engineXMLExport.cpp +++ b/Engine/source/console/engineXMLExport.cpp @@ -197,7 +197,7 @@ static String getDefaultArgumentValue( const EngineFunctionInfo* function, const //TODO: for now we store string literals in ASCII; needs to be sorted out if( TYPE< const char* >() == type ) { - const char* val = getArgValue< const char* >( defaultArgs, offset ); + const char* val = reinterpret_cast< const char* >(defaultArgs->getArgs() + offset); value = val; } diff --git a/Engine/source/console/fixedTuple.h b/Engine/source/console/fixedTuple.h new file mode 100644 index 000000000..871cd7011 --- /dev/null +++ b/Engine/source/console/fixedTuple.h @@ -0,0 +1,153 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _FIXEDTUPLE_H_ +#define _FIXEDTUPLE_H_ +/// @name Fixed-layout tuple definition +/// These structs and templates serve as a way to pass arguments from external +/// applications and into the T3D console system. +/// They work as std::tuple, but they ensure a standardized fixed memory +/// layout. Allowing for unmanaged calls with these tuples as the parameter +/// lists. +/// +/// The implementation is from a SO solution: +/// https://codereview.stackexchange.com/a/52279 +/// As out use-case is pretty simple, this code could probably be simplified by +/// stripping out a lot of extra functionality. But eh. +/// +/// @{ + +template +struct fixed_tuple; + +template +struct fixed_tuple +{ + T first; + fixed_tuple rest; + + fixed_tuple() = default; + template ::type>::value>::type> + fixed_tuple(U&& u, Us&&...tail) : + first(::std::forward(u)), + rest(::std::forward(tail)...) {} +}; + +template +struct fixed_tuple +{ + T first; + + fixed_tuple() = default; + template ::type>::value>::type> + fixed_tuple(U&& u) : + first(::std::forward(u)) {} +}; + +template <> +struct fixed_tuple<> {}; + + +template < ::std::size_t i, class T> +struct fixed_tuple_element; + +template < ::std::size_t i, class T, class... Ts> +struct fixed_tuple_element > + : fixed_tuple_element > +{}; + +template +struct fixed_tuple_element<0, fixed_tuple > +{ + using type = T; +}; + +template < ::std::size_t i> +struct fixed_tuple_accessor +{ + template + static inline typename fixed_tuple_element >::type & get(fixed_tuple & t) + { + return fixed_tuple_accessor::get(t.rest); + } + + template + static inline const typename fixed_tuple_element >::type & get(const fixed_tuple & t) + { + return fixed_tuple_accessor::get(t.rest); + } +}; + +template <> +struct fixed_tuple_accessor<0> +{ + template + static inline typename fixed_tuple_element<0, fixed_tuple >::type & get(fixed_tuple & t) + { + return t.first; + } + + template + static inline const typename fixed_tuple_element<0, fixed_tuple >::type & get(const fixed_tuple & t) + { + return t.first; + } +}; + +template< typename T1, typename T2 > +struct fixed_tuple_mutator {}; + +template +struct fixed_tuple_mutator +{ + template + static inline typename std::enable_if::type + copy_r_t_l(fixed_tuple& src, fixed_tuple& dest) + { } + + template + static inline typename std::enable_if::type + copy_r_t_l(fixed_tuple& src, fixed_tuple& dest) + { + fixed_tuple_accessor::get(dest) = fixed_tuple_accessor::get(src); + copy_r_t_l(src, dest); + } + + template + static inline typename std::enable_if::type + copy(std::tuple& src, fixed_tuple& dest) + { } + + template + static inline typename std::enable_if::type + copy(std::tuple& src, fixed_tuple& dest) + { + fixed_tuple_accessor::get(dest) = std::get(src); + copy(src, dest); + } +}; + + +/// @} + + +#endif // !_FIXEDTUPLE_H_ \ No newline at end of file From fb412ff1081a198946d071f2f62d4466e2cc9d90 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 09:08:26 +0200 Subject: [PATCH 277/312] Add Type information for Properties in EngineXMLExport --- Engine/source/console/consoleObject.h | 2 + Engine/source/console/engineTypeInfo.h | 6 + Engine/source/console/engineXMLExport.cpp | 750 +++++++++++----------- 3 files changed, 395 insertions(+), 363 deletions(-) diff --git a/Engine/source/console/consoleObject.h b/Engine/source/console/consoleObject.h index 08cb0dcec..b15cd88ab 100644 --- a/Engine/source/console/consoleObject.h +++ b/Engine/source/console/consoleObject.h @@ -676,6 +676,8 @@ public: prop.mFlags |= EnginePropertyGroupBegin; if (sg_tempFieldList[i].type == EndGroupFieldType) prop.mFlags |= EnginePropertyGroupEnd; + prop.mType = sg_tempFieldList[i].type; + props[i] = prop; } diff --git a/Engine/source/console/engineTypeInfo.h b/Engine/source/console/engineTypeInfo.h index 7a9f7122c..9f9c0d12f 100644 --- a/Engine/source/console/engineTypeInfo.h +++ b/Engine/source/console/engineTypeInfo.h @@ -231,6 +231,9 @@ class EnginePropertyTable /// Combination of EnginePropertyFlags. U32 mFlags; + + /// Type-id of the property + U32 mType; /// Return the name of the property. const char* getName() const { return mName; } @@ -255,6 +258,9 @@ class EnginePropertyTable /// bool hideInInspectors() const { return ( mFlags & EnginePropertyHideInInspectors ); } + + /// Return the type-id of the property. + U32 getType() const { return mType; } }; protected: diff --git a/Engine/source/console/engineXMLExport.cpp b/Engine/source/console/engineXMLExport.cpp index 51951c52b..ae1b182bb 100644 --- a/Engine/source/console/engineXMLExport.cpp +++ b/Engine/source/console/engineXMLExport.cpp @@ -35,32 +35,32 @@ /// actually having to access them directly in the DLL as native entities. -static void exportScope( const EngineExportScope* scope, SimXMLDocument* xml, bool addNode = false ); +static void exportScope(const EngineExportScope* scope, SimXMLDocument* xml, bool addNode = false); -static String getTypeName( const EngineTypeInfo* type ) +static String getTypeName(const EngineTypeInfo* type) { - if( !type ) + if (!type) { - static String sVoid( "void" ); + static String sVoid("void"); return sVoid; } - + return type->getFullyQualifiedExportName(); } -static const char* getDocString( const EngineExport* exportInfo ) +static const char* getDocString(const EngineExport* exportInfo) { - if( !exportInfo->getDocString() ) + if (!exportInfo->getDocString()) return ""; - + return exportInfo->getDocString(); } template< typename T > -inline T getArgValue( const EngineFunctionDefaultArguments* defaultArgs, U32 offset ) +inline T getArgValue(const EngineFunctionDefaultArguments* defaultArgs, U32 offset) { - return *reinterpret_cast< const T* >( defaultArgs->getArgs() + offset ); + return *reinterpret_cast< const T* >(defaultArgs->getArgs() + offset); } @@ -71,14 +71,14 @@ static const char* sExportFilterList[] = "Console", // Console namespace }; -static bool isExportFiltered( const EngineExport* exportInfo ) +static bool isExportFiltered(const EngineExport* exportInfo) { String qualifiedName = exportInfo->getFullyQualifiedExportName(); - - for( U32 i = 0; i < ( sizeof( sExportFilterList ) / sizeof( sExportFilterList[ 0 ] ) ); ++ i ) - if( qualifiedName.compare( sExportFilterList[ i ] ) == 0 ) + + for (U32 i = 0; i < (sizeof(sExportFilterList) / sizeof(sExportFilterList[0])); ++i) + if (qualifiedName.compare(sExportFilterList[i]) == 0) return true; - + return false; } @@ -90,248 +90,248 @@ static bool isExportFiltered( const EngineExport* exportInfo ) //----------------------------------------------------------------------------- /// Helper to parse argument names out of a prototype string. -static Vector< String > parseFunctionArgumentNames( const EngineFunctionInfo* function ) +static Vector< String > parseFunctionArgumentNames(const EngineFunctionInfo* function) { Vector< String > argNames; - + const char* prototype = function->getPrototypeString(); - if( !prototype ) + if (!prototype) return argNames; - - const U32 prototypeLength = dStrlen( prototype ); - const char* prototypeEnd = &prototype[ prototypeLength ]; + + const U32 prototypeLength = dStrlen(prototype); + const char* prototypeEnd = &prototype[prototypeLength]; const char* ptr = prototypeEnd - 1; - + // Search for right parenthesis. - while( ptr >= prototype && *ptr != ')' ) - ptr --; - - if( ptr < prototype ) + while (ptr >= prototype && *ptr != ')') + ptr--; + + if (ptr < prototype) return argNames; - ptr --; - - while( ptr >= prototype && *ptr != '(' ) + ptr--; + + while (ptr >= prototype && *ptr != '(') { // Skip back over spaces. - - while( ptr >= prototype && dIsspace( *ptr ) ) - ptr --; - if( ptr < prototype ) + + while (ptr >= prototype && dIsspace(*ptr)) + ptr--; + if (ptr < prototype) return argNames; - + // Parse out name. - + const char* end = ptr + 1; - while( ptr > prototype && dIsalnum( *ptr ) ) - ptr --; + while (ptr > prototype && dIsalnum(*ptr)) + ptr--; const char* start = ptr + 1; - + // Skip back over spaces. - while( ptr >= prototype && dIsspace( *ptr ) ) - ptr --; - + while (ptr >= prototype && dIsspace(*ptr)) + ptr--; + // If we're sure we don't have just a type name without an // argument name, copy out the argument name name. - if( ptr >= prototype && *ptr != ',' && *ptr != '(' && end > start ) - argNames.push_front( String( start, end - start ) ); + if (ptr >= prototype && *ptr != ',' && *ptr != '(' && end > start) + argNames.push_front(String(start, end - start)); else - argNames.push_front( "" ); - + argNames.push_front(""); + // Skip back to comma or opening parenthesis. - + U32 parenNestingCount = 0; - while( ptr >= prototype ) + while (ptr >= prototype) { - if( *ptr == ')' ) - parenNestingCount ++; - else if( *ptr == '(' ) - parenNestingCount --; - else if( *ptr == ',' && parenNestingCount == 0 ) + if (*ptr == ')') + parenNestingCount++; + else if (*ptr == '(') + parenNestingCount--; + else if (*ptr == ',' && parenNestingCount == 0) { - ptr --; + ptr--; break; } - else if( *ptr == '(' && parenNestingCount == 0 ) + else if (*ptr == '(' && parenNestingCount == 0) break; - - ptr --; + + ptr--; } } - + // Add 'this' parameter if this is a method. - - if( dStrncmp( prototype, "virtual ", sizeof( "virtual " ) - 1 ) == 0 ) - argNames.push_front( "this" ); + + if (dStrncmp(prototype, "virtual ", sizeof("virtual ") - 1) == 0) + argNames.push_front("this"); return argNames; } //----------------------------------------------------------------------------- -static String getDefaultArgumentValue( const EngineFunctionInfo* function, const EngineTypeInfo* type, U32 offset ) +static String getDefaultArgumentValue(const EngineFunctionInfo* function, const EngineTypeInfo* type, U32 offset) { String value; const EngineFunctionDefaultArguments* defaultArgs = function->getDefaultArguments(); - - switch( type->getTypeKind() ) + + switch (type->getTypeKind()) { - case EngineTypeKindPrimitive: - { - #define PRIMTYPE( tp ) \ + case EngineTypeKindPrimitive: + { +#define PRIMTYPE( tp ) \ if( TYPE< tp >() == type ) \ { \ tp val = getArgValue< tp >( defaultArgs, offset ); \ value = String::ToString( val ); \ } - - PRIMTYPE( bool ); - PRIMTYPE( S8 ); - PRIMTYPE( U8 ); - PRIMTYPE( S32 ); - PRIMTYPE( U32 ); - PRIMTYPE( F32 ); - PRIMTYPE( F64 ); - - //TODO: for now we store string literals in ASCII; needs to be sorted out - if( TYPE< const char* >() == type ) - { - const char* val = reinterpret_cast< const char* >(defaultArgs->getArgs() + offset); - value = val; - } - - #undef PRIMTYPE - break; - } - - case EngineTypeKindEnum: + + PRIMTYPE(bool); + PRIMTYPE(S8); + PRIMTYPE(U8); + PRIMTYPE(S32); + PRIMTYPE(U32); + PRIMTYPE(F32); + PRIMTYPE(F64); + + //TODO: for now we store string literals in ASCII; needs to be sorted out + if (TYPE< const char* >() == type) { - S32 val = getArgValue< S32 >( defaultArgs, offset ); - AssertFatal( type->getEnumTable(), "engineXMLExport - Enum type without table!" ); - - const EngineEnumTable& table = *( type->getEnumTable() ); - const U32 numValues = table.getNumValues(); - - for( U32 i = 0; i < numValues; ++ i ) - if( table[ i ].getInt() == val ) - { - value = table[ i ].getName(); - break; - } - - break; + const char* val = reinterpret_cast(defaultArgs->getArgs() + offset); + value = val; } - case EngineTypeKindBitfield: - { - S32 val = getArgValue< S32 >( defaultArgs, offset ); - AssertFatal( type->getEnumTable(), "engineXMLExport - Bitfield type without table!" ); - - const EngineEnumTable& table = *( type->getEnumTable() ); - const U32 numValues = table.getNumValues(); - - bool isFirst = true; - for( U32 i = 0; i < numValues; ++ i ) - if( table[ i ].getInt() & val ) - { - if( !isFirst ) - value += '|'; - - value = table[ i ].getName(); - isFirst = false; - } - - break; - } - - case EngineTypeKindStruct: - { - //TODO: struct type default argument values - break; - } - - case EngineTypeKindClass: - case EngineTypeKindFunction: - { - // For these two kinds, we support "null" as the only valid - // default value. - - const void* ptr = getArgValue< const void* >( defaultArgs, offset ); - if( !ptr ) - value = "null"; - break; - } - - default: - break; +#undef PRIMTYPE + break; } - + + case EngineTypeKindEnum: + { + S32 val = getArgValue< S32 >(defaultArgs, offset); + AssertFatal(type->getEnumTable(), "engineXMLExport - Enum type without table!"); + + const EngineEnumTable& table = *(type->getEnumTable()); + const U32 numValues = table.getNumValues(); + + for (U32 i = 0; i < numValues; ++i) + if (table[i].getInt() == val) + { + value = table[i].getName(); + break; + } + + break; + } + + case EngineTypeKindBitfield: + { + S32 val = getArgValue< S32 >(defaultArgs, offset); + AssertFatal(type->getEnumTable(), "engineXMLExport - Bitfield type without table!"); + + const EngineEnumTable& table = *(type->getEnumTable()); + const U32 numValues = table.getNumValues(); + + bool isFirst = true; + for (U32 i = 0; i < numValues; ++i) + if (table[i].getInt() & val) + { + if (!isFirst) + value += '|'; + + value = table[i].getName(); + isFirst = false; + } + + break; + } + + case EngineTypeKindStruct: + { + //TODO: struct type default argument values + break; + } + + case EngineTypeKindClass: + case EngineTypeKindFunction: + { + // For these two kinds, we support "null" as the only valid + // default value. + + const void* ptr = getArgValue< const void* >(defaultArgs, offset); + if (!ptr) + value = "null"; + break; + } + + default: + break; + } + return value; } //----------------------------------------------------------------------------- -static void exportFunction( const EngineFunctionInfo* function, SimXMLDocument* xml ) +static void exportFunction(const EngineFunctionInfo* function, SimXMLDocument* xml) { - if( isExportFiltered( function ) ) + if (isExportFiltered(function)) return; - - xml->pushNewElement( "EngineFunction" ); - - xml->setAttribute( "name", function->getExportName() ); - xml->setAttribute( "returnType", getTypeName( function->getReturnType() ) ); - xml->setAttribute( "symbol", function->getBindingName() ); - xml->setAttribute( "isCallback", function->isCallout() ? "1" : "0" ); - xml->setAttribute( "isVariadic", function->getFunctionType()->isVariadic() ? "1" : "0" ); - xml->setAttribute( "docs", getDocString( function ) ); - - xml->pushNewElement( "arguments" ); - - const U32 numArguments = function->getNumArguments(); - const U32 numDefaultArguments = ( function->getDefaultArguments() ? function->getDefaultArguments()->mNumDefaultArgs : 0 ); - const U32 firstDefaultArg = numArguments - numDefaultArguments; - - Vector< String > argumentNames = parseFunctionArgumentNames( function ); - const U32 numArgumentNames = argumentNames.size(); - - // Accumulated offset in function argument frame vector. - U32 argFrameOffset = 0; - - for( U32 i = 0; i < numArguments; ++ i ) - { - xml->pushNewElement( "EngineFunctionArgument" ); - const EngineTypeInfo* type = function->getArgumentType( i ); - AssertFatal( type != NULL, "exportFunction - Argument cannot have type void!" ); - - String argName; - if( i < numArgumentNames ) - argName = argumentNames[ i ]; - - xml->setAttribute( "name", argName ); - xml->setAttribute( "type", getTypeName( type ) ); - - if( i >= firstDefaultArg ) - { - String defaultValue = getDefaultArgumentValue( function, type, argFrameOffset ); - xml->setAttribute( "defaultValue", defaultValue ); - } - xml->popElement(); - - if( type->getTypeKind() == EngineTypeKindStruct ) - argFrameOffset += type->getInstanceSize(); - else - argFrameOffset += type->getValueSize(); - - #ifdef _PACK_BUG_WORKAROUNDS - if( argFrameOffset % 4 > 0 ) - argFrameOffset += 4 - ( argFrameOffset % 4 ); - #endif - } - + xml->pushNewElement("EngineFunction"); + + xml->setAttribute("name", function->getExportName()); + xml->setAttribute("returnType", getTypeName(function->getReturnType())); + xml->setAttribute("symbol", function->getBindingName()); + xml->setAttribute("isCallback", function->isCallout() ? "1" : "0"); + xml->setAttribute("isVariadic", function->getFunctionType()->isVariadic() ? "1" : "0"); + xml->setAttribute("docs", getDocString(function)); + + xml->pushNewElement("arguments"); + + const U32 numArguments = function->getNumArguments(); + const U32 numDefaultArguments = (function->getDefaultArguments() ? function->getDefaultArguments()->mNumDefaultArgs : 0); + const U32 firstDefaultArg = numArguments - numDefaultArguments; + + Vector< String > argumentNames = parseFunctionArgumentNames(function); + const U32 numArgumentNames = argumentNames.size(); + + // Accumulated offset in function argument frame vector. + U32 argFrameOffset = 0; + + for (U32 i = 0; i < numArguments; ++i) + { + xml->pushNewElement("EngineFunctionArgument"); + const EngineTypeInfo* type = function->getArgumentType(i); + AssertFatal(type != NULL, "exportFunction - Argument cannot have type void!"); + + String argName; + if (i < numArgumentNames) + argName = argumentNames[i]; + + xml->setAttribute("name", argName); + xml->setAttribute("type", getTypeName(type)); + + if (i >= firstDefaultArg) + { + String defaultValue = getDefaultArgumentValue(function, type, argFrameOffset); + xml->setAttribute("defaultValue", defaultValue); + } + xml->popElement(); - + + if (type->getTypeKind() == EngineTypeKindStruct) + argFrameOffset += type->getInstanceSize(); + else + argFrameOffset += type->getValueSize(); + +#ifdef _PACK_BUG_WORKAROUNDS + if (argFrameOffset % 4 > 0) + argFrameOffset += 4 - (argFrameOffset % 4); +#endif + } + + xml->popElement(); + xml->popElement(); } @@ -343,148 +343,172 @@ static void exportFunction( const EngineFunctionInfo* function, SimXMLDocument* //----------------------------------------------------------------------------- -static void exportType( const EngineTypeInfo* type, SimXMLDocument* xml ) +static void exportType(const EngineTypeInfo* type, SimXMLDocument* xml) { // Don't export anonymous types. - if( !type->getTypeName()[ 0 ] ) + if (!type->getTypeName()[0]) return; - - if( isExportFiltered( type ) ) - return; - - const char* nodeName = NULL; - switch( type->getTypeKind() ) - { - case EngineTypeKindPrimitive: - nodeName = "EnginePrimitiveType"; - break; - - case EngineTypeKindEnum: - nodeName = "EngineEnumType"; - break; - - case EngineTypeKindBitfield: - nodeName = "EngineBitfieldType"; - break; - - case EngineTypeKindStruct: - nodeName = "EngineStructType"; - break; - - case EngineTypeKindClass: - nodeName = "EngineClassType"; - break; - - default: - return; - } - - xml->pushNewElement( nodeName ); - xml->setAttribute( "name", type->getTypeName() ); - xml->setAttribute( "size", String::ToString( type->getInstanceSize() ) ); - xml->setAttribute( "isAbstract", type->isAbstract() ? "1" : "0" ); - xml->setAttribute( "isInstantiable", type->isInstantiable() ? "1" : "0" ); - xml->setAttribute( "isDisposable", type->isDisposable() ? "1" : "0" ); - xml->setAttribute( "isSingleton", type->isSingleton() ? "1" : "0" ); - xml->setAttribute( "docs", getDocString( type ) ); - - if( type->getSuperType() ) - xml->setAttribute( "superType", getTypeName( type->getSuperType() ) ); - - if( type->getEnumTable() ) + if (isExportFiltered(type)) + return; + + const char* nodeName = NULL; + switch (type->getTypeKind()) + { + case EngineTypeKindPrimitive: + nodeName = "EnginePrimitiveType"; + break; + + case EngineTypeKindEnum: + nodeName = "EngineEnumType"; + break; + + case EngineTypeKindBitfield: + nodeName = "EngineBitfieldType"; + break; + + case EngineTypeKindStruct: + nodeName = "EngineStructType"; + break; + + case EngineTypeKindClass: + nodeName = "EngineClassType"; + break; + + default: + return; + } + + xml->pushNewElement(nodeName); + + xml->setAttribute("name", type->getTypeName()); + xml->setAttribute("size", String::ToString(type->getInstanceSize())); + xml->setAttribute("isAbstract", type->isAbstract() ? "1" : "0"); + xml->setAttribute("isInstantiable", type->isInstantiable() ? "1" : "0"); + xml->setAttribute("isDisposable", type->isDisposable() ? "1" : "0"); + xml->setAttribute("isSingleton", type->isSingleton() ? "1" : "0"); + xml->setAttribute("docs", getDocString(type)); + + if (type->getSuperType()) + xml->setAttribute("superType", getTypeName(type->getSuperType())); + + if (type->getEnumTable()) + { + xml->pushNewElement("enums"); + + const EngineEnumTable& table = *(type->getEnumTable()); + const U32 numValues = table.getNumValues(); + + for (U32 i = 0; i < numValues; ++i) { - xml->pushNewElement( "enums" ); - - const EngineEnumTable& table = *( type->getEnumTable() ); - const U32 numValues = table.getNumValues(); - - for( U32 i = 0; i < numValues; ++ i ) - { - xml->pushNewElement( "EngineEnum" ); - - xml->setAttribute( "name", table[ i ].getName() ); - xml->setAttribute( "value", String::ToString( table[ i ].getInt() ) ); - xml->setAttribute( "docs", table[ i ].getDocString() ? table[ i ].getDocString() : "" ); - - xml->popElement(); - } - + xml->pushNewElement("EngineEnum"); + + xml->setAttribute("name", table[i].getName()); + xml->setAttribute("value", String::ToString(table[i].getInt())); + xml->setAttribute("docs", table[i].getDocString() ? table[i].getDocString() : ""); + xml->popElement(); } - else if( type->getFieldTable() ) + + xml->popElement(); + } + else if (type->getFieldTable()) + { + xml->pushNewElement("fields"); + + const EngineFieldTable& table = *(type->getFieldTable()); + const U32 numFields = table.getNumFields(); + + for (U32 i = 0; i < numFields; ++i) { - xml->pushNewElement( "fields" ); - - const EngineFieldTable& table = *( type->getFieldTable() ); - const U32 numFields = table.getNumFields(); - - for( U32 i = 0; i < numFields; ++ i ) - { - const EngineFieldTable::Field& field = table[ i ]; - - xml->pushNewElement( "EngineField" ); - - xml->setAttribute( "name", field.getName() ); - xml->setAttribute( "type", getTypeName( field.getType() ) ); - xml->setAttribute( "offset", String::ToString( field.getOffset() ) ); - xml->setAttribute( "indexedSize", String::ToString( field.getNumElements() ) ); - xml->setAttribute( "docs", field.getDocString() ? field.getDocString() : "" ); - - xml->popElement(); - } - + const EngineFieldTable::Field& field = table[i]; + + xml->pushNewElement("EngineField"); + + xml->setAttribute("name", field.getName()); + xml->setAttribute("type", getTypeName(field.getType())); + xml->setAttribute("offset", String::ToString(field.getOffset())); + xml->setAttribute("indexedSize", String::ToString(field.getNumElements())); + xml->setAttribute("docs", field.getDocString() ? field.getDocString() : ""); + xml->popElement(); } - else if( type->getPropertyTable() ) + + xml->popElement(); + } + else if (type->getPropertyTable()) + { + xml->pushNewElement("properties"); + + const EnginePropertyTable& table = *(type->getPropertyTable()); + const U32 numProperties = table.getNumProperties(); + U32 groupNestingDepth = 0; + + for (U32 i = 0; i < numProperties; ++i) { - xml->pushNewElement( "properties" ); - - const EnginePropertyTable& table = *( type->getPropertyTable() ); - const U32 numProperties = table.getNumProperties(); - U32 groupNestingDepth = 0; - - for( U32 i = 0; i < numProperties; ++ i ) + const EnginePropertyTable::Property& property = table[i]; + + if (property.isGroupBegin()) + { + groupNestingDepth++; + xml->pushNewElement("EnginePropertyGroup"); + + xml->setAttribute("name", property.getName()); + xml->setAttribute("indexedSize", String::ToString(property.getNumElements())); + xml->setAttribute("docs", property.getDocString() ? property.getDocString() : ""); + + xml->pushNewElement("properties"); + } + else if (property.isGroupEnd()) + { + groupNestingDepth--; + xml->popElement(); + xml->popElement(); + } + else + { + if (property.getType() == AbstractClassRep::StartArrayFieldType + || property.getType() == AbstractClassRep::EndArrayFieldType) { + continue; + } + xml->pushNewElement("EngineProperty"); + + xml->setAttribute("name", property.getName()); + xml->setAttribute("indexedSize", String::ToString(property.getNumElements())); + xml->setAttribute("isConstant", property.isConstant() ? "1" : "0"); + xml->setAttribute("isTransient", property.isTransient() ? "1" : "0"); + xml->setAttribute("isVisible", property.hideInInspectors() ? "0" : "1"); + xml->setAttribute("docs", property.getDocString() ? property.getDocString() : ""); + + + const bool isDeprecated = (property.getType() == AbstractClassRep::DeprecatedFieldType); + + if (isDeprecated) { - const EnginePropertyTable::Property& property = table[ i ]; - - if( property.isGroupBegin() ) + xml->setAttribute("type", "deprecated"); + } + else + { + ConsoleBaseType *cbt = ConsoleBaseType::getType(property.getType()); + if (cbt != NULL) { - groupNestingDepth ++; - xml->pushNewElement( "EnginePropertyGroup" ); - - xml->setAttribute( "name", property.getName() ); - xml->setAttribute( "indexedSize", String::ToString( property.getNumElements() ) ); - xml->setAttribute( "docs", property.getDocString() ? property.getDocString() : "" ); - - xml->pushNewElement( "properties" ); - } - else if( property.isGroupEnd() ) - { - groupNestingDepth --; - xml->popElement(); - xml->popElement(); + xml->setAttribute("type", cbt->getTypeClassName()); } else { - xml->pushNewElement( "EngineProperty" ); - - xml->setAttribute( "name", property.getName() ); - xml->setAttribute( "indexedSize", String::ToString( property.getNumElements() ) ); - xml->setAttribute( "isConstant", property.isConstant() ? "1" : "0" ); - xml->setAttribute( "isTransient", property.isTransient() ? "1" : "0" ); - xml->setAttribute( "isVisible", property.hideInInspectors() ? "0" : "1" ); - xml->setAttribute( "docs", property.getDocString() ? property.getDocString() : "" ); - - xml->popElement(); + xml->setAttribute("type", "unknown"); } } - - AssertFatal( !groupNestingDepth, "exportType - Property group nesting mismatch!" ); - xml->popElement(); - } - exportScope( type, xml ); - + + xml->popElement(); + } + } + + AssertFatal(!groupNestingDepth, "exportType - Property group nesting mismatch!"); + xml->popElement(); + } + exportScope(type, xml); + xml->popElement(); } @@ -496,63 +520,63 @@ static void exportType( const EngineTypeInfo* type, SimXMLDocument* xml ) //----------------------------------------------------------------------------- -static void exportScope( const EngineExportScope* scope, SimXMLDocument* xml, bool addNode ) +static void exportScope(const EngineExportScope* scope, SimXMLDocument* xml, bool addNode) { - if( addNode ) + if (addNode) { - if( isExportFiltered( scope ) ) + if (isExportFiltered(scope)) return; - - xml->pushNewElement( "EngineExportScope" ); - - xml->setAttribute( "name", scope->getExportName() ); - xml->setAttribute( "docs", getDocString( scope ) ); + + xml->pushNewElement("EngineExportScope"); + + xml->setAttribute("name", scope->getExportName()); + xml->setAttribute("docs", getDocString(scope)); } // Dump all contained exports. - - xml->pushNewElement( "exports" ); - - for( const EngineExport* exportInfo = scope->getExports(); exportInfo != NULL; exportInfo = exportInfo->getNextExport() ) + + xml->pushNewElement("exports"); + + for (const EngineExport* exportInfo = scope->getExports(); exportInfo != NULL; exportInfo = exportInfo->getNextExport()) + { + switch (exportInfo->getExportKind()) { - switch( exportInfo->getExportKind() ) - { - case EngineExportKindScope: - exportScope( static_cast< const EngineExportScope* >( exportInfo ), xml, true ); - break; - - case EngineExportKindFunction: - exportFunction( static_cast< const EngineFunctionInfo* >( exportInfo ), xml ); - break; - - case EngineExportKindType: - exportType( static_cast< const EngineTypeInfo* >( exportInfo ), xml ); - break; - - default: - break; - } + case EngineExportKindScope: + exportScope(static_cast< const EngineExportScope* >(exportInfo), xml, true); + break; + + case EngineExportKindFunction: + exportFunction(static_cast< const EngineFunctionInfo* >(exportInfo), xml); + break; + + case EngineExportKindType: + exportType(static_cast< const EngineTypeInfo* >(exportInfo), xml); + break; + + default: + break; } - + } + xml->popElement(); - - if( addNode ) + + if (addNode) xml->popElement(); } //----------------------------------------------------------------------------- -DefineEngineFunction( exportEngineAPIToXML, SimXMLDocument*, (),, +DefineEngineFunction(exportEngineAPIToXML, SimXMLDocument*, (), , "Create a XML document containing a dump of the entire exported engine API.\n\n" "@return A SimXMLDocument containing a dump of the engine's export information or NULL if the operation failed.\n\n" - "@ingroup Console" ) + "@ingroup Console") { SimXMLDocument* xml = new SimXMLDocument; xml->registerObject(); - Sim::getRootGroup()->addObject( xml ); + Sim::getRootGroup()->addObject(xml); xml->addHeader(); - - exportScope( EngineExportScope::getGlobalScope(), xml, true ); - + + exportScope(EngineExportScope::getGlobalScope(), xml, true); + return xml; -} +} \ No newline at end of file From 33df2945314f42049e09b5c484cd3e117cd16863 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 09:21:21 +0200 Subject: [PATCH 278/312] Mark EngineAPI as initialized, otherwise it can't be used --- Engine/source/app/mainLoop.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Engine/source/app/mainLoop.cpp b/Engine/source/app/mainLoop.cpp index b08363f8a..36998169f 100644 --- a/Engine/source/app/mainLoop.cpp +++ b/Engine/source/app/mainLoop.cpp @@ -267,6 +267,9 @@ void StandardMainLoop::init() ThreadPool::GlobalThreadPool::createSingleton(); + // Set engineAPI initialized to true + engineAPI::gIsInitialized = true; + // Initialize modules. EngineModuleManager::initializeSystem(); From 780e1dc73fad59b6ebcd36b8074e066ce0f7118d Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 09:22:12 +0200 Subject: [PATCH 279/312] Use FixedTuple in EngineTrampoline, to make memory-layout consistent --- Engine/source/console/engineAPI.h | 43 ++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/engineAPI.h b/Engine/source/console/engineAPI.h index ab1717745..5fa20a82c 100644 --- a/Engine/source/console/engineAPI.h +++ b/Engine/source/console/engineAPI.h @@ -26,6 +26,10 @@ #include #include +#ifndef _FIXEDTUPLE_H_ +#include "fixedTuple.h" +#endif + #ifndef _CONSOLETYPES_H_ #include "console/consoleTypes.h" #endif @@ -347,6 +351,8 @@ struct _EngineTrampoline< R( ArgTs ... ) > { typedef std::tuple Args; std::tuple argT; + typedef fixed_tuple FixedArgs; + fixed_tuple fixedArgT; }; template< typename T > @@ -365,6 +371,7 @@ struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampoli private: using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >; using ArgsType = typename Super::Args; + using FixedArgsType = typename Super::FixedArgs; template struct Seq {}; template struct Gens : Gens {}; @@ -374,6 +381,11 @@ private: static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq) { return R( fn(std::get(args) ...) ); } + + template + static R dispatchHelper(typename Super::FunctionType fn, const FixedArgsType& args, Seq) { + return R( fn(fixed_tuple_accessor::get(args) ...) ); + } using SeqType = typename Gens::type; public: @@ -381,6 +393,11 @@ public: { return dispatchHelper(fn, args, SeqType()); } + + static R jmp(typename Super::FunctionType fn, const FixedArgsType& args ) + { + return dispatchHelper(fn, args, SeqType()); + } }; // Trampolines for engine methods @@ -398,6 +415,7 @@ struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTram private: using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >; using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args; + using FixedArgsType = typename Super::FixedArgs; template struct Seq {}; template struct Gens : Gens {}; @@ -408,6 +426,11 @@ private: return R( f._exec(std::get(args) ...) ); } + template + static R dispatchHelper(Frame f, const FixedArgsType& args, Seq) { + return R( f._exec(fixed_tuple_accessor::get(args) ...) ); + } + using SeqType = typename Gens::type; public: static R jmp( typename Frame::ObjectType* object, const ArgsType& args ) @@ -417,6 +440,14 @@ public: f.object = object; return dispatchHelper(f, args, SeqType()); } + + static R jmp( typename Frame::ObjectType* object, const FixedArgsType& args ) + { + + Frame f; + f.object = object; + return dispatchHelper(f, args, SeqType()); + } }; /// @} @@ -683,7 +714,7 @@ public: #define DefineEngineFunction( name, returnType, args, defaultArgs, usage ) \ static inline returnType _fn ## name ## impl args; \ TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \ - ( _EngineFunctionTrampoline< returnType args >::Args a ) \ + ( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \ { \ _CHECK_ENGINE_INITIALIZED( name, returnType ); \ return EngineTypeTraits< returnType >::ReturnValue( \ @@ -702,7 +733,7 @@ public: ( void* ) &fn ## name, \ 0 \ ); \ - static _EngineConsoleThunkType< returnType >::ReturnType _ ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv ) \ + static _EngineConsoleThunkType< returnType >::ReturnType _ ## name ## caster( SimObject*, S32 argc, ConsoleValueRef *argv ) \ { \ return _EngineConsoleThunkType< returnType >::ReturnType( _EngineConsoleThunk< 1, returnType args >::thunk( \ argc, argv, &_fn ## name ## impl, _fn ## name ## DefaultArgs \ @@ -737,7 +768,7 @@ public: #define _DefineMethodTrampoline( className, name, returnType, args ) \ TORQUE_API EngineTypeTraits< returnType >::ReturnValueType \ - fn ## className ## _ ## name ( className* object, _EngineMethodTrampoline< _ ## className ## name ## frame, returnType args >::Args a ) \ + fn ## className ## _ ## name ( className* object, _EngineMethodTrampoline< _ ## className ## name ## frame, returnType args >::FixedArgs a )\ { \ _CHECK_ENGINE_INITIALIZED( className::name, returnType ); \ return EngineTypeTraits< returnType >::ReturnValue( \ @@ -820,7 +851,7 @@ public: #define DefineEngineStaticMethod( className, name, returnType, args, defaultArgs, usage ) \ static inline returnType _fn ## className ## name ## impl args; \ TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \ - ( _EngineFunctionTrampoline< returnType args >::Args a ) \ + ( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \ { \ _CHECK_ENGINE_INITIALIZED( className::name, returnType ); \ return EngineTypeTraits< returnType >::ReturnValue( \ @@ -920,7 +951,7 @@ public: #define DefineNewEngineFunction( name, returnType, args, defaultArgs, usage ) \ static inline returnType _fn ## name ## impl args; \ TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## name \ - ( _EngineFunctionTrampoline< returnType args >::Args a ) \ + ( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \ { \ _CHECK_ENGINE_INITIALIZED( name, returnType ); \ return EngineTypeTraits< returnType >::ReturnValue( \ @@ -967,7 +998,7 @@ public: #define DefineNewEngineStaticMethod( className, name, returnType, args, defaultArgs, usage ) \ static inline returnType _fn ## className ## name ## impl args; \ TORQUE_API EngineTypeTraits< returnType >::ReturnValueType fn ## className ## _ ## name \ - ( _EngineFunctionTrampoline< returnType args >::Args a ) \ + ( _EngineFunctionTrampoline< returnType args >::FixedArgs a ) \ { \ _CHECK_ENGINE_INITIALIZED( className::name, returnType ); \ return EngineTypeTraits< returnType >::ReturnValue( \ From 2fe623b7616e49ebda19be7607a8de6b91dd6675 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 09:23:38 +0200 Subject: [PATCH 280/312] Pass structs by value, not by reference, in EngineAPI. This simplifies call-layout through EngineAPI --- Engine/source/console/engineTypes.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/console/engineTypes.h b/Engine/source/console/engineTypes.h index 2217ee770..51d2ef84d 100644 --- a/Engine/source/console/engineTypes.h +++ b/Engine/source/console/engineTypes.h @@ -236,16 +236,16 @@ template< typename T > struct _EngineStructTypeTraits { typedef T Type; - typedef const T& ValueType; + typedef const T ValueType; typedef void SuperType; // Structs get passed in as pointers and passed out as full copies. - typedef T* ArgumentValueType; + typedef T ArgumentValueType; typedef T ReturnValueType; typedef T DefaultArgumentValueStoreType; typedef ReturnValueType ReturnValue; - static ValueType ArgumentToValue( ArgumentValueType val ) { return *val; } + static ValueType ArgumentToValue( ArgumentValueType val ) { return val; } static const EngineTypeInfo* const TYPEINFO; }; From 13eb392c98706f65aa10c2a95c17c8a4f6fff465 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 09:29:57 +0200 Subject: [PATCH 281/312] Add a method to set the 'MainDotCsDir' when no main.cs is available --- Engine/source/platform/platformFileIO.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Engine/source/platform/platformFileIO.cpp b/Engine/source/platform/platformFileIO.cpp index 788ed4f62..58123dbb1 100644 --- a/Engine/source/platform/platformFileIO.cpp +++ b/Engine/source/platform/platformFileIO.cpp @@ -620,3 +620,8 @@ DefineEngineFunction( getUserHomeDirectory, const char *, (), , "getUserHomeDire { return Platform::getUserHomeDirectory(); } + +DefineEngineFunction(setMainDotCsDir, void, (const char* path), , "setMainDotCsDir()") +{ + Platform::setMainDotCsDir(StringTable->insert(path)); +} \ No newline at end of file From 96c71a4d5d7b594b2cdfbca741f604a26f2ab599 Mon Sep 17 00:00:00 2001 From: rextimmy Date: Sat, 21 Apr 2018 18:19:17 +1000 Subject: [PATCH 282/312] Corrects a problem with the D3D11 texture lock/unlock mechanism --- .../gfx/D3D11/gfxD3D11TextureObject.cpp | 109 +++++++++--------- .../source/gfx/D3D11/gfxD3D11TextureObject.h | 3 +- 2 files changed, 55 insertions(+), 57 deletions(-) diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp index 7fdd8201e..7c33e1c16 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp @@ -65,59 +65,56 @@ GFXLockedRect *GFXD3D11TextureObject::lock(U32 mipLevel /*= 0*/, RectI *inRect / { AssertFatal( !mLocked, "GFXD3D11TextureObject::lock - The texture is already locked!" ); - D3D11_MAPPED_SUBRESOURCE mapInfo; - - if( mProfile->isRenderTarget() ) + if( !mStagingTex || + mStagingTex->getWidth() != getWidth() || + mStagingTex->getHeight() != getHeight() ) { - //AssertFatal( 0, "GFXD3D11TextureObject::lock - Need to handle mapping render targets" ); - if( !mLockTex || - mLockTex->getWidth() != getWidth() || - mLockTex->getHeight() != getHeight() ) - { - mLockTex.set( getWidth(), getHeight(), mFormat, &GFXSystemMemTextureProfile, avar("%s() - mLockTex (line %d)", __FUNCTION__, __LINE__) ); - } + mStagingTex.set( getWidth(), getHeight(), mFormat, &GFXSystemMemTextureProfile, avar("%s() - mLockTex (line %d)", __FUNCTION__, __LINE__) ); + } - PROFILE_START(GFXD3D11TextureObject_lockRT); + ID3D11DeviceContext* pContext = D3D11DEVICECONTEXT; + D3D11_MAPPED_SUBRESOURCE mapInfo; + U32 offset = 0; + mLockedSubresource = D3D11CalcSubresource(mipLevel, 0, getMipLevels()); + GFXD3D11TextureObject* pD3DStagingTex = (GFXD3D11TextureObject*)&(*mStagingTex); - GFXD3D11Device* dev = D3D11; + //map staging texture + HRESULT hr = pContext->Map(pD3DStagingTex->get2DTex(), mLockedSubresource, D3D11_MAP_READ, 0, &mapInfo); - GFXD3D11TextureObject* to = (GFXD3D11TextureObject*) &(*mLockTex); - dev->getDeviceContext()->CopyResource(to->get2DTex(), mD3DTexture); + if (FAILED(hr)) + AssertFatal(false, "GFXD3D11TextureObject:lock - failed to map render target resource!"); - mLockedSubresource = D3D11CalcSubresource(0, 0, 1); - HRESULT hr = dev->getDeviceContext()->Map(to->get2DTex(), mLockedSubresource, D3D11_MAP_READ, 0, &mapInfo); - - if (FAILED(hr)) - AssertFatal(false, "GFXD3D11TextureObject:lock- failed to map render target resource!"); + const U32 width = mTextureSize.x >> mipLevel; + const U32 height = mTextureSize.y >> mipLevel; - mLocked = true; + //calculate locked box region and offset + if (inRect) + { + if ((inRect->point.x + inRect->extent.x > width) || (inRect->point.y + inRect->extent.y > height)) + AssertFatal(false, "GFXD3D11TextureObject::lock - Rectangle too big!"); + mLockBox.top = inRect->point.y; + mLockBox.left = inRect->point.x; + mLockBox.bottom = inRect->point.y + inRect->extent.y; + mLockBox.right = inRect->point.x + inRect->extent.x; + mLockBox.back = 1; + mLockBox.front = 0; - PROFILE_END(); + //calculate offset + offset = inRect->point.x * getFormatByteSize() + inRect->point.y * mapInfo.RowPitch; } else { - RECT r; - - if(inRect) - { - r.top = inRect->point.y; - r.left = inRect->point.x; - r.bottom = inRect->point.y + inRect->extent.y; - r.right = inRect->point.x + inRect->extent.x; - } - - mLockedSubresource = D3D11CalcSubresource(mipLevel, 0, getMipLevels()); - HRESULT hr = D3D11DEVICECONTEXT->Map(mD3DTexture, mLockedSubresource, D3D11_MAP_WRITE_DISCARD, 0, &mapInfo); - - if ( FAILED(hr) ) - AssertFatal(false, "GFXD3D11TextureObject::lock - Failed to map subresource."); - - mLocked = true; - + mLockBox.top = 0; + mLockBox.left = 0; + mLockBox.bottom = height; + mLockBox.right = width; + mLockBox.back = 1; + mLockBox.front = 0; } - mLockRect.pBits = static_cast(mapInfo.pData); + mLocked = true; + mLockRect.pBits = static_cast(mapInfo.pData) + offset; mLockRect.Pitch = mapInfo.RowPitch; return (GFXLockedRect*)&mLockRect; @@ -127,22 +124,22 @@ void GFXD3D11TextureObject::unlock(U32 mipLevel) { AssertFatal( mLocked, "GFXD3D11TextureObject::unlock - Attempting to unlock a surface that has not been locked" ); - if( mProfile->isRenderTarget() ) - { - //AssertFatal( 0, "GFXD3D11TextureObject::unlock - Need to handle mapping render targets" ); - GFXD3D11TextureObject* to = (GFXD3D11TextureObject*)&(*mLockTex); - - D3D11->getDeviceContext()->Unmap(to->get2DTex(), mLockedSubresource); - - mLockedSubresource = 0; - mLocked = false; - } - else - { - D3D11DEVICECONTEXT->Unmap(get2DTex(), mLockedSubresource); - mLockedSubresource = 0; - mLocked = false; - } + //profile in the unlock function because all the heavy lifting is done here + PROFILE_START(GFXD3D11TextureObject_lockRT); + + ID3D11DeviceContext* pContext = D3D11DEVICECONTEXT; + GFXD3D11TextureObject* pD3DStagingTex = (GFXD3D11TextureObject*)&(*mStagingTex); + ID3D11Texture2D *pStagingTex = pD3DStagingTex->get2DTex(); + + //unmap staging texture + pContext->Unmap(pStagingTex, mLockedSubresource); + //copy lock box region from the staging texture to our regular texture + pContext->CopySubresourceRegion(mD3DTexture, mLockedSubresource, mLockBox.left, mLockBox.top, 0, pStagingTex, mLockedSubresource, &mLockBox); + + PROFILE_END(); + + mLockedSubresource = 0; + mLocked = false; } void GFXD3D11TextureObject::release() diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h index b50cc2465..2152cc62a 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h @@ -31,8 +31,9 @@ class GFXD3D11TextureObject : public GFXTextureObject { protected: static U32 mTexCount; - GFXTexHandle mLockTex; + GFXTexHandle mStagingTex; DXGI_MAPPED_RECT mLockRect; + D3D11_BOX mLockBox; bool mLocked; U32 mLockedSubresource; From ae1f5a3c8956cfae3bfb76e37494470955faf12e Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 10:11:01 +0200 Subject: [PATCH 283/312] Update the CInterface --- .../source/cinterface/c_consoleInterface.cpp | 143 +---- .../source/cinterface/c_controlInterface.cpp | 239 +++++++++ Engine/source/cinterface/c_controlInterface.h | 48 ++ Engine/source/cinterface/c_scripting.cpp | 426 --------------- Engine/source/cinterface/c_simInterface.cpp | 54 ++ .../cinterface/c_simdatablockInterface.cpp | 40 ++ .../cinterface/c_simobjectInterface.cpp | 71 +++ Engine/source/cinterface/cinterface.cpp | 499 +++--------------- Engine/source/cinterface/cinterface.h | 39 +- Engine/source/platformMac/macFileIO.mm | 2 +- 10 files changed, 576 insertions(+), 985 deletions(-) create mode 100644 Engine/source/cinterface/c_controlInterface.cpp create mode 100644 Engine/source/cinterface/c_controlInterface.h delete mode 100644 Engine/source/cinterface/c_scripting.cpp create mode 100644 Engine/source/cinterface/c_simInterface.cpp create mode 100644 Engine/source/cinterface/c_simdatablockInterface.cpp create mode 100644 Engine/source/cinterface/c_simobjectInterface.cpp diff --git a/Engine/source/cinterface/c_consoleInterface.cpp b/Engine/source/cinterface/c_consoleInterface.cpp index 21a2e48fd..09b406da3 100644 --- a/Engine/source/cinterface/c_consoleInterface.cpp +++ b/Engine/source/cinterface/c_consoleInterface.cpp @@ -20,154 +20,59 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#include "platform/platform.h" -#include "console/compiler.h" #include "console/consoleInternal.h" #include "console/simSet.h" +#include "console/engineAPI.h" -extern "C" { - - // SimObject C interface - const char *SimObject_GetName(SimObject *so) +namespace Con +{ + DefineNewEngineFunction(AddConsumer, void, (ConsumerCallback cb), , "") { - return so->getName(); + addConsumer(cb); } - U32 SimObject_GetId(SimObject *so) + DefineNewEngineFunction(RemoveConsumer, void, (ConsumerCallback cb), , "") { - return so->getId(); + removeConsumer(cb); } - const char *SimObject_GetClassName(SimObject *so) + DefineNewEngineFunction(GetConsoleString, String, (String name),, "") { - return so->getClassName(); + return getVariable(StringTable->insert(name)); } - void *SimObject_GetFieldList(SimObject *so, S32 &outNumFields) + DefineNewEngineFunction(SetConsoleString, void, (String name, String value),, "") { - const AbstractClassRep::FieldList &fl = so->getFieldList(); - outNumFields = fl.size(); - return fl.address(); + setVariable(StringTable->insert(name), StringTable->insert(value)); } - bool SimObject_IsLocked(SimObject *so) + DefineNewEngineFunction(GetConsoleInt, S32, (String name),, "") { - return so->isLocked(); + return getIntVariable(StringTable->insert(name)); } - void SimObject_SetDataField(SimObject *so, const char *fieldName, const char *arr, const char *val) + DefineNewEngineFunction(SetConsoleInt, void, (String name, S32 value),, "") { - so->setDataField(StringTable->insert(fieldName), arr, val); + setIntVariable(StringTable->insert(name), value); } - const char *SimObject_GetDataField(SimObject *so, const char *fieldName, const char *arr) + DefineNewEngineFunction(GetConsoleFloat, F32, (String name),, "") { - return so->getDataField(StringTable->insert(fieldName), arr); + return getFloatVariable(StringTable->insert(name)); } - void SimObject_InspectPreApply(SimObject *so) + DefineNewEngineFunction(SetConsoleFloat, void, (String name, F32 value),, "") { - so->inspectPreApply(); + setFloatVariable(StringTable->insert(name), value); } - void SimObject_InspectPostApply(SimObject *so) + DefineNewEngineFunction(GetConsoleBool, bool, (String name),, "") { - so->inspectPostApply(); + return getBoolVariable(StringTable->insert(name)); } - // Con C interface - void Con_AddConsumer(ConsumerCallback cb) + DefineNewEngineFunction(SetConsoleBool, void, (String name, bool value),, "") { - Con::addConsumer(cb); + setBoolVariable(StringTable->insert(name), value); } - - void Con_RemoveConsumer(ConsumerCallback cb) - { - Con::removeConsumer(cb); - } - - void Con_AddCommand_String(StringCallback cb, const char *nameSpace, const char *funcName, const char* usage, S32 minArgs, S32 maxArgs) - { - if (!nameSpace || !dStrlen(nameSpace)) - Con::addCommand(funcName, cb, usage, minArgs + 1, maxArgs + 1); - else - Con::addCommand(nameSpace, funcName, cb, usage, minArgs + 1, maxArgs + 1); - } - - // ConsoleBaseType C interface - ConsoleBaseType *ConsoleBaseType_GetTypeById(const S32 typeId) - { - return ConsoleBaseType::getType(typeId); - } - - S32 ConsoleBaseType_GetTypeId(ConsoleBaseType *cbt) - { - return cbt->getTypeID(); - } - - S32 ConsoleBaseType_GetTypeSize(ConsoleBaseType *cbt) - { - return cbt->getTypeSize(); - } - - const char *ConsoleBaseType_GetTypeName(ConsoleBaseType *cbt) - { - return cbt->getTypeName(); - } - - const char *ConsoleBaseType_GetInspectorFieldType(ConsoleBaseType *cbt) - { - return cbt->getInspectorFieldType(); - } - - void ConsoleBaseType_SetData(ConsoleBaseType *cbt, void *dptr, S32 argc, const char **argv, const EnumTable *tbl, BitSet32 flag) - { - return cbt->setData(dptr, argc, argv, tbl, flag); - } - - const char *ConsoleBaseType_GetData(ConsoleBaseType *cbt, void *dptr, const EnumTable *tbl, BitSet32 flag) - { - return cbt->getData(dptr, tbl, flag); - } - - // Abstract Class Rep - AbstractClassRep *AbstractClassRep_GetCommonParent(AbstractClassRep *acr, AbstractClassRep *otheracr) - { - return acr->getCommonParent(otheracr); - } - - AbstractClassRep *AbstractClassRep_FindClassRep(const char* in_pClassName) - { - return AbstractClassRep::findClassRep(in_pClassName); - } - - U32 AbstractClassRep_GetFieldStructSize() - { - return sizeof(AbstractClassRep::Field); - } - - // Sim C interface - SimObject *Sim_FindObjectByString(const char *param) - { - return Sim::findObject(param); - } - - SimObject *Sim_FindObjectById(S32 param) - { - return Sim::findObject(param); - } - - // Sim Set - SimObject **SimSet_Begin(SimObject *simObject) - { - return dynamic_cast(simObject)->begin(); - } - - SimObject **SimSet_End(SimObject *simObject) - { - return dynamic_cast(simObject)->end(); - } - -}; - - +} \ No newline at end of file diff --git a/Engine/source/cinterface/c_controlInterface.cpp b/Engine/source/cinterface/c_controlInterface.cpp new file mode 100644 index 000000000..4a07d49db --- /dev/null +++ b/Engine/source/cinterface/c_controlInterface.cpp @@ -0,0 +1,239 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "c_controlInterface.h" + +#include "console/consoleInternal.h" +#include "console/simSet.h" +#include "app/mainLoop.h" +#include "windowManager/platformWindow.h" +#include "windowManager/platformWindowMgr.h" + +#ifdef TORQUE_OS_WIN +#include "windowManager/win32/win32Window.h" +#include "windowManager/win32/winDispatch.h" +extern void createFontInit(void); +extern void createFontShutdown(void); +#endif + + +#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) +extern S32 CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo); +#endif + +extern bool LinkConsoleFunctions; + +extern "C" { + + // reset the engine, unloading any current level and returning to the main menu + void torque_reset() + { + Con::evaluate("disconnect();"); + } + + // initialize Torque 3D including argument handling + bool torque_engineinit(S32 argc, const char **argv) + { + +#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) + __try { +#endif + + LinkConsoleFunctions = true; + +#if defined(_MSC_VER) + createFontInit(); +#endif + + // Initialize the subsystems. + StandardMainLoop::init(); + + // Handle any command line args. + if (!StandardMainLoop::handleCommandLine(argc, argv)) + { + Platform::AlertOK("Error", "Failed to initialize game, shutting down."); + return false; + } + +#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) + } + + __except (CreateMiniDump(GetExceptionInformation())) + { + _exit(0); + } +#endif + + return true; + + } + + // tick Torque 3D's main loop + S32 torque_enginetick() + { + +#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) + __try { +#endif + + bool ret = StandardMainLoop::doMainLoop(); + return ret; + +#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) + } + __except (CreateMiniDump(GetExceptionInformation())) + { + _exit(0); + } +#endif + + } + + S32 torque_getreturnstatus() + { + return StandardMainLoop::getReturnStatus(); + } + + // signal an engine shutdown (as with the quit(); console command) + void torque_enginesignalshutdown() + { + Con::evaluate("quit();"); + } + + // shutdown the engine + S32 torque_engineshutdown() + { + +#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) + __try { +#endif + + // Clean everything up. + StandardMainLoop::shutdown(); + +#if defined(_MSC_VER) + createFontShutdown(); +#endif + +#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) + } + + __except (CreateMiniDump(GetExceptionInformation())) + { + _exit(0); + } +#endif + + // Return. + return true; + + } + + bool torque_isdebugbuild() + { +#ifdef _DEBUG + return true; +#else + return false; +#endif + + } + + // set Torque 3D into web deployment mode (disable fullscreen exlusive mode, etc) + void torque_setwebdeployment() + { + Platform::setWebDeployment(true); + } + + // resize the Torque 3D child window to the specified width and height + void torque_resizewindow(S32 width, S32 height) + { + if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) + PlatformWindowManager::get()->getFirstWindow()->setSize(Point2I(width, height)); + } + +#if defined(TORQUE_OS_WIN) && !defined(TORQUE_SDL) + // retrieve the hwnd of our render window + void* torque_gethwnd() + { + if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) + { + Win32Window* w = (Win32Window*)PlatformWindowManager::get()->getFirstWindow(); + return (void *)w->getHWND(); + } + + return NULL; + } + + // directly add a message to the Torque 3D event queue, bypassing the Windows event queue + // this is useful in the case of the IE plugin, where we are hooking into an application + // level message, and posting to the windows queue would cause a hang + void torque_directmessage(U32 message, U32 wparam, U32 lparam) + { + if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) + { + Win32Window* w = (Win32Window*)PlatformWindowManager::get()->getFirstWindow(); + Dispatch(DelayedDispatch, w->getHWND(), message, wparam, lparam); + } + } + +#endif + +#ifdef TORQUE_OS_WIN + void torque_inputevent(S32 type, S32 value1, S32 value2) + { + if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) + { + Win32Window* w = (Win32Window*)PlatformWindowManager::get()->getFirstWindow(); + WindowId devId = w->getWindowId(); + + switch (type) + { + case 0: + w->mouseEvent.trigger(devId, 0, value1, value2, w->isMouseLocked()); + break; + case 1: + if (value2) + w->buttonEvent.trigger(devId, 0, IA_MAKE, value1); + else + w->buttonEvent.trigger(devId, 0, IA_BREAK, value1); + break; + + } + } + } +#endif + + static char* gExecutablePath = NULL; + + const char* torque_getexecutablepath() + { + return gExecutablePath; + } + + void torque_setexecutablepath(const char* directory) + { + dsize_t pathLen = dStrlen(directory) + 1; + gExecutablePath = new char[pathLen]; + dStrcpy(gExecutablePath, directory, pathLen); + } +} \ No newline at end of file diff --git a/Engine/source/cinterface/c_controlInterface.h b/Engine/source/cinterface/c_controlInterface.h new file mode 100644 index 000000000..229b07b88 --- /dev/null +++ b/Engine/source/cinterface/c_controlInterface.h @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef C_CONTROLINTERFACE_H +#define C_CONTROLINTERFACE_H +#include "platform/platformDlibrary.h" +#include "console/engineFunctions.h" + +TORQUE_API void torque_reset(); +TORQUE_API bool torque_engineinit(S32 argc, const char **argv); +TORQUE_API S32 torque_enginetick(); +TORQUE_API S32 torque_getreturnstatus(); +TORQUE_API void torque_enginesignalshutdown(); +TORQUE_API S32 torque_engineshutdown(); +TORQUE_API bool torque_isdebugbuild(); +TORQUE_API void torque_setwebdeployment(); +TORQUE_API void torque_resizewindow(S32 width, S32 height); + +#if defined(TORQUE_OS_WIN) && !defined(TORQUE_SDL) +TORQUE_API void* torque_gethwnd(); +TORQUE_API void torque_directmessage(U32 message, U32 wparam, U32 lparam); +#endif +#ifdef TORQUE_OS_WIN +TORQUE_API void torque_inputevent(S32 type, S32 value1, S32 value2); +#endif + +TORQUE_API const char* torque_getexecutablepath(); + +#endif // C_CONTROLINTERFACE_H diff --git a/Engine/source/cinterface/c_scripting.cpp b/Engine/source/cinterface/c_scripting.cpp deleted file mode 100644 index f10effde2..000000000 --- a/Engine/source/cinterface/c_scripting.cpp +++ /dev/null @@ -1,426 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -#include "platform/platform.h" -#include "console/compiler.h" -#include "console/console.h" -#include "console/consoleInternal.h" -#include "core/util/tDictionary.h" -#include "app/mainLoop.h" - -// External scripting cinterface, suitable for import into any scripting system which support "C" interfaces (C#, Python, Lua, Java, etc) - -#ifdef TORQUE_OS_WIN -#include "windowManager/win32/win32Window.h" -#include "windowManager/win32/winDispatch.h" -#endif - -extern "C" { - - struct MarshalNativeEntry - { - const char* nameSpace; - const char* name; - Namespace::Entry* entry; - S32 minArgs; - S32 maxArgs; - S32 cbType; - }; - - - static Namespace::Entry* GetEntry(const char* nameSpace, const char* name) - { - Namespace* ns = NULL; - - if (!nameSpace || !dStrlen(nameSpace)) - ns = Namespace::mGlobalNamespace; - else - { - nameSpace = StringTable->insert(nameSpace); - ns = Namespace::find(nameSpace); //can specify a package here, maybe need, maybe not - } - - if (!ns) - return NULL; - - name = StringTable->insert(name); - - Namespace::Entry* entry = ns->lookupRecursive(name); - - return entry; - } - - const char * script_getconsolexml() - { - Namespace::Entry* entry = GetEntry("", "consoleExportXML"); - - if (!entry) - return ""; - - static const char* exportArgv[1] = { "consoleExportXML" }; - static StringStackConsoleWrapper exportCmd(1, exportArgv); - - return entry->cb.mStringCallbackFunc(NULL, exportCmd.argc, exportCmd.argv); - } - - MarshalNativeEntry* script_get_namespace_entry(const char* nameSpace, const char* name) - { - static MarshalNativeEntry mentry; - - Namespace::Entry* e = GetEntry(nameSpace, name); - - if (!e) - return NULL; - - mentry.nameSpace = e->mNamespace->mName; - mentry.name = e->mFunctionName; - mentry.minArgs = e->mMinArgs; - mentry.maxArgs = e->mMaxArgs; - mentry.cbType = e->mType; - mentry.entry = e; - - return &mentry; - } - - void* script_get_stringtable_entry(const char* string) - { - return (void*)StringTable->insert(string); - } - - // FIELD ACCESS - - // fieldNames must be from stringTable coming in! See Engine.stringTable - - const char* script_simobject_getfield_string(U32 id, const char* fieldName) - { - SimObject *object = Sim::findObject( id ); - if( object ) - { - return (const char *) object->getDataField(fieldName, ""); - } - return ""; - } - - void script_simobject_setfield_string(U32 objectId, const char* fieldName, const char* v) - { - SimObject *object = Sim::findObject( objectId ); - if( object ) - { - object->setDataField(fieldName, "", v); - } - } - - - bool script_simobject_getfield_bool(U32 objectId, const char* fieldName) - { - SimObject *object = Sim::findObject( objectId ); - if( object ) - { - const char *v = object->getDataField(fieldName, ""); - - return dAtob(v); - } - - return false; - } - - void script_simobject_setfield_bool(U32 objectId, const char* fieldName, bool v) - { - SimObject *object = Sim::findObject( objectId ); - if( object ) - { - object->setDataField(fieldName, "", v ? "1" : "0"); - } - } - - S32 script_simobject_getfield_int(U32 objectId, const char* fieldName) - { - SimObject *object = Sim::findObject( objectId ); - if( object ) - { - const char *v = object->getDataField(fieldName, ""); - - return dAtoi(v); - } - - return false; - } - - void script_simobject_setfield_int(U32 objectId, const char* fieldName, S32 v) - { - SimObject *object = Sim::findObject( objectId ); - if( object ) - { - // this seems pretty lame, though it is how it is handled in consoleType.cpp - char buf[256]; - dSprintf(buf, 256, "%d", v ); - object->setDataField(fieldName, "", buf); - } - } - - F32 script_simobject_getfield_float(U32 objectId, const char* fieldName) - { - SimObject *object = Sim::findObject( objectId ); - if( object ) - { - const char *v = object->getDataField(fieldName, ""); - - return dAtof(v); - } - - return false; - } - - void script_simobject_setfield_float(U32 objectId, const char* fieldName, F32 v) - { - SimObject *object = Sim::findObject( objectId ); - if( object ) - { - char buf[256]; - dSprintf(buf, 256, "%g", v ); - object->setDataField(fieldName, "", buf); - } - } - - const char* script_call_namespace_entry_string(Namespace::Entry* entry, S32 argc, const char** argv) - { - // maxArgs improper on a number of console function/methods - if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs) - return ""; - - SimObject* o = NULL; - - if (entry->mNamespace && entry->mNamespace->isClass()) - { - o = Sim::findObject(dAtoi(argv[1])); - if (!o) - return ""; - } - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mStringCallbackFunc(o, args.count(), args); - } - - bool script_call_namespace_entry_bool(Namespace::Entry* entry, S32 argc, const char** argv) - { - // maxArgs improper on a number of console function/methods - if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs) - return false; - - SimObject* o = NULL; - - if (entry->mNamespace && entry->mNamespace->isClass()) - { - o = Sim::findObject(dAtoi(argv[1])); - if (!o) - return false; - } - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mBoolCallbackFunc(o, args.count(), args); - } - - S32 script_call_namespace_entry_int(Namespace::Entry* entry, S32 argc, const char** argv) - { - // maxArgs improper on a number of console function/methods - if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs) - return 0; - - SimObject* o = NULL; - - if (entry->mNamespace && entry->mNamespace->isClass()) - { - o = Sim::findObject(dAtoi(argv[1])); - if (!o) - return 0; - } - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mIntCallbackFunc(o, args.count(), args); - } - - F32 script_call_namespace_entry_float(Namespace::Entry* entry, S32 argc, const char** argv) - { - // maxArgs improper on a number of console function/methods - if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs) - return 0.0f; - - SimObject* o = NULL; - - if (entry->mNamespace && entry->mNamespace->isClass()) - { - o = Sim::findObject(dAtoi(argv[1])); - if (!o) - return 0.0f; - } - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mFloatCallbackFunc(o, args.count(), args); - } - - - void script_call_namespace_entry_void(Namespace::Entry* entry, S32 argc, const char** argv) - { - // maxArgs improper on a number of console function/methods - if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs) - return; - - SimObject* o = NULL; - - if (entry->mNamespace && entry->mNamespace->isClass()) - { - Sim::findObject(dAtoi(argv[1])); - if (!o) - return; - } - - StringStackConsoleWrapper args(argc, argv); - entry->cb.mVoidCallbackFunc(o, args.count(), args); - } - - S32 script_simobject_get_id(SimObject* so) - { - return so->getId(); - } - - S32 script_simobject_find(const char* classname, const char* name) - { - SimObject *object; - if( Sim::findObject( name, object ) ) - { - // if we specified a classname do type checking - if (classname && dStrlen(classname)) - { - AbstractClassRep* ocr = object->getClassRep(); - while (ocr) - { - if (!dStricmp(ocr->getClassName(), classname)) - return object->getId(); - ocr = ocr->getParentClass(); - } - - } - - // invalid type - return 0; - } - - // didn't find object - return 0; - } - - void script_export_callback_string(StringCallback cb, const char *nameSpace, const char *funcName, const char* usage, S32 minArgs, S32 maxArgs) - { - if (!nameSpace || !dStrlen(nameSpace)) - Con::addCommand(funcName, cb, usage, minArgs + 1, maxArgs + 1); - else - Con::addCommand(nameSpace, funcName, cb, usage, minArgs + 1, maxArgs + 1); - } - - void script_export_callback_void(VoidCallback cb, const char *nameSpace, const char *funcName, const char* usage, S32 minArgs, S32 maxArgs) - { - - if (!nameSpace || !dStrlen(nameSpace)) - Con::addCommand(funcName, cb, usage, minArgs + 1, maxArgs + 1); - else - Con::addCommand(nameSpace, funcName, cb, usage, minArgs + 1, maxArgs + 1); - - - - // example of package support - // note that Parent:: does not work with this, at least not yet anyway - - /* - Namespace* ns; - - StringTableEntry nspace = NULL; - - if (nameSpace && dStrlen(nameSpace)) - nspace = StringTable->insert(nameSpace); - - Namespace::unlinkPackages(); - ns = Namespace::find(nspace, StringTable->insert("fps")); - ns->addCommand(StringTable->insert(funcName), cb, StringTable->insert(usage), minArgs + 1, maxArgs + 1 ); - Namespace::relinkPackages(); - */ - } - - void script_export_callback_bool(BoolCallback cb, const char *nameSpace, const char *funcName, const char* usage, S32 minArgs, S32 maxArgs) - { - if (!nameSpace || !dStrlen(nameSpace)) - Con::addCommand(funcName, cb, usage, minArgs + 1, maxArgs + 1); - else - Con::addCommand(nameSpace, funcName, cb, usage, minArgs + 1, maxArgs + 1); - } - - void script_export_callback_int(IntCallback cb, const char *nameSpace, const char *funcName, const char* usage, S32 minArgs, S32 maxArgs) - { - if (!nameSpace || !dStrlen(nameSpace)) - Con::addCommand(funcName, cb, usage, minArgs + 1, maxArgs + 1); - else - Con::addCommand(nameSpace, funcName, cb, usage, minArgs + 1, maxArgs + 1); - } - - void script_export_callback_float(FloatCallback cb, const char *nameSpace, const char *funcName, const char* usage, S32 minArgs, S32 maxArgs) - { - if (!nameSpace || !dStrlen(nameSpace)) - Con::addCommand(funcName, cb, usage, minArgs + 1, maxArgs + 1); - else - Con::addCommand(nameSpace, funcName, cb, usage, minArgs + 1, maxArgs + 1); - } - - -#ifdef TORQUE_OS_WIN - - void script_input_event(S32 type, S32 value1, S32 value2) - { - if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) - { - Win32Window* w = (Win32Window*) PlatformWindowManager::get()->getFirstWindow(); - WindowId devId = w->getWindowId(); - - switch (type) - { - case 0: - w->mouseEvent.trigger(devId,0,value1,value2,w->isMouseLocked()); - break; - case 1: - if (value2) - w->buttonEvent.trigger(devId,0,IA_MAKE,value1); - else - w->buttonEvent.trigger(devId,0,IA_BREAK,value1); - break; - - } - - } - - } -#endif - -} - - -DefineEngineStringlyVariadicFunction(TestFunction2Args, const char *, 3, 3, "testFunction(arg1, arg2)") -{ - return "Return Value"; -} diff --git a/Engine/source/cinterface/c_simInterface.cpp b/Engine/source/cinterface/c_simInterface.cpp new file mode 100644 index 000000000..26130a685 --- /dev/null +++ b/Engine/source/cinterface/c_simInterface.cpp @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "console/consoleInternal.h" +#include "console/simDatablock.h" +#include "console/simSet.h" +#include "console/engineAPI.h" + +namespace Sim +{ + DefineNewEngineFunction(FindObjectById, SimObject*, (U32 pId), , "") + { + return Sim::findObject(pId); + } + + DefineNewEngineFunction(FindObjectByName, SimObject*, (String pName), , "") + { + return Sim::findObject(StringTable->insert(pName)); + } + + DefineNewEngineFunction(FindDataBlockByName, SimObject*, (String pName), , "") + { + return Sim::getDataBlockGroup()->findObject(StringTable->insert(pName)); + } + + DefineNewEngineFunction(WrapObject, SimObjectPtr*, (SimObject* pObject), , "") + { + return new SimObjectPtr(pObject); + } + + DefineNewEngineFunction(DeleteObjectPtr, void, (SimObjectPtr* pObjectPtr), , "") + { + delete pObjectPtr; + } +} \ No newline at end of file diff --git a/Engine/source/cinterface/c_simdatablockInterface.cpp b/Engine/source/cinterface/c_simdatablockInterface.cpp new file mode 100644 index 000000000..2d7f862a3 --- /dev/null +++ b/Engine/source/cinterface/c_simdatablockInterface.cpp @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "console/simDatablock.h" +#include "console/engineAPI.h" + +DefineNewEngineMethod(SimDataBlock, AssignId, void, (),, "") +{ + object->assignId(); +} + +DefineNewEngineMethod(SimDataBlock, Preload, void, (),, "") +{ + static String errorStr; + if (!object->preload(true, errorStr)) + { + Con::errorf(ConsoleLogEntry::General, "Preload failed for %s: %s.", + object->getName(), errorStr.c_str()); + object->deleteObject(); + } +} \ No newline at end of file diff --git a/Engine/source/cinterface/c_simobjectInterface.cpp b/Engine/source/cinterface/c_simobjectInterface.cpp new file mode 100644 index 000000000..757ba243b --- /dev/null +++ b/Engine/source/cinterface/c_simobjectInterface.cpp @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "c_simobjectInterface.h" + +#include "console/engineAPI.h" +#include "console/simObject.h" + +DefineNewEngineMethod(SimObject, RegisterObject, bool, (),,"") +{ + return object->registerObject(); +} + +DefineNewEngineMethod(SimObject, GetField, String, (String fieldName, String arrayIndex),, "") +{ + return object->getDataField(StringTable->insert(fieldName), StringTable->insert(arrayIndex)); +} + +DefineNewEngineMethod(SimObject, SetField, void, (String fieldName, String arrayIndex, String value),, "") +{ + object->setDataField(StringTable->insert(fieldName), StringTable->insert(arrayIndex), StringTable->insert(value)); +} + +DefineNewEngineMethod(SimObject, CopyFrom, void, (SimObject* parent),, "") +{ + if (parent) + { + object->setCopySource(parent); + object->assignFieldsFrom(parent); + } +} + +DefineNewEngineMethod(SimObject, SetMods, void, (bool modStaticFields, bool modDynamicFields), , "") +{ + object->setModStaticFields(modStaticFields); + object->setModDynamicFields(modDynamicFields); +} + +DefineNewEngineMethod(SimObject, IsLocked, bool, (), , "") +{ + return object->isLocked(); +} + +DefineNewEngineMethod(SimObject, InspectPreApply, void, (), , "") +{ + object->inspectPreApply(); +} + +DefineNewEngineMethod(SimObject, InspectPostApply, void, (), , "") +{ + object->inspectPostApply(); +} \ No newline at end of file diff --git a/Engine/source/cinterface/cinterface.cpp b/Engine/source/cinterface/cinterface.cpp index 0820b3cf8..e62db2c91 100644 --- a/Engine/source/cinterface/cinterface.cpp +++ b/Engine/source/cinterface/cinterface.cpp @@ -19,449 +19,78 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE. //----------------------------------------------------------------------------- +#include "cinterface.h" -#include "platform/platform.h" #include "console/compiler.h" -#include "console/consoleInternal.h" -#include "console/engineAPI.h" -#include "core/util/tDictionary.h" -#include "core/strings/stringFunctions.h" -#include "app/mainLoop.h" #include "windowManager/platformWindow.h" -#include "windowManager/platformWindowMgr.h" -#ifdef TORQUE_OS_WIN -#include "windowManager/win32/win32Window.h" -#include "windowManager/win32/winDispatch.h" -extern void createFontInit(void); -extern void createFontShutdown(void); -#endif - -#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) - extern S32 CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo); -#endif - -static HashTable gSecureScript; - -extern bool LinkConsoleFunctions; - -extern "C" { - - // reset the engine, unloading any current level and returning to the main menu - void torque_reset() - { - Con::evaluate("disconnect();"); - } - - // initialize Torque 3D including argument handling - S32 torque_engineinit(S32 argc, const char **argv) - { - -#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) - __try { -#endif - - LinkConsoleFunctions = true; - -#if defined(_MSC_VER) - createFontInit(); -#endif - - // Initialize the subsystems. - StandardMainLoop::init(); - - // Handle any command line args. - if(!StandardMainLoop::handleCommandLine(argc, argv)) - { - Platform::AlertOK("Error", "Failed to initialize game, shutting down."); - return false; - } - -#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) - } - - __except( CreateMiniDump(GetExceptionInformation()) ) - { - _exit(0); - } -#endif - - return true; - - } - - // tick Torque 3D's main loop - S32 torque_enginetick() - { - -#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) - __try { -#endif - - bool ret = StandardMainLoop::doMainLoop(); - return ret; - -#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) - } - __except( CreateMiniDump(GetExceptionInformation()) ) - { - _exit(0); - } -#endif - - - - } - - S32 torque_getreturnstatus() - { - return StandardMainLoop::getReturnStatus(); - } - - // signal an engine shutdown (as with the quit(); console command) - void torque_enginesignalshutdown() - { - Con::evaluate("quit();"); - } - - // shutdown the engine - S32 torque_engineshutdown() - { - -#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) - __try { -#endif - - // Clean everything up. - StandardMainLoop::shutdown(); - -#if defined(_MSC_VER) - createFontShutdown(); -#endif - -#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) - } - - __except( CreateMiniDump(GetExceptionInformation()) ) - { - _exit(0); - } -#endif - - // Return. - return true; - - } - - bool torque_isdebugbuild() - { -#ifdef _DEBUG - return true; -#else - return false; -#endif - - } - - S32 torque_getconsolebool(const char* name) - { - return Con::getBoolVariable(name); - } - - void torque_setconsolebool(const char* name, bool value) - { - Con::setBoolVariable(name, value); - } - - static char* gExecutablePath = NULL; - - const char* torque_getexecutablepath() - { - return gExecutablePath; - } - - void torque_setexecutablepath(const char* directory) - { - dsize_t pathLen = dStrlen(directory) + 1; - gExecutablePath = new char[pathLen]; - dStrcpy(gExecutablePath, directory, pathLen); - } - - // set Torque 3D into web deployment mode (disable fullscreen exlusive mode, etc) - void torque_setwebdeployment() - { - Platform::setWebDeployment(true); - } - - // Get a console variable - const char* torque_getvariable(const char* name) - { - return Con::getVariable(StringTable->insert(name)); - } - - // Set a console variable - void torque_setvariable(const char* name, const char* value) - { - Con::setVariable(StringTable->insert(name), StringTable->insert(value)); - } - - static Namespace::Entry* GetEntry(const char* nameSpace, const char* name) - { - Namespace* ns = NULL; - - if (!nameSpace || !dStrlen(nameSpace)) - ns = Namespace::mGlobalNamespace; - else - { - nameSpace = StringTable->insert(nameSpace); - ns = Namespace::find(nameSpace); //can specify a package here, maybe need, maybe not - } - - if (!ns) - return NULL; - - name = StringTable->insert(name); - - Namespace::Entry* entry = ns->lookupRecursive(name); - - return entry; - } - - // Export a function to the Torque 3D console system which matches the StringCallback function prototype - // specify the nameSpace, functionName, usage, min and max arguments - void torque_exportstringcallback(StringCallback cb, const char *nameSpace, const char *funcName, const char* usage, S32 minArgs, S32 maxArgs) - { - if (!nameSpace || !dStrlen(nameSpace)) - Con::addCommand(funcName, cb, usage, minArgs + 1, maxArgs + 1); - else - Con::addCommand(nameSpace, funcName, cb, usage, minArgs + 1, maxArgs + 1); - } - - void torque_callvoidfunction(const char* nameSpace, const char* name, S32 argc, const char ** argv) - { - - Namespace::Entry* entry = GetEntry(nameSpace, name); - - if (!entry) - return; - - StringStackConsoleWrapper args(argc, argv); - entry->cb.mVoidCallbackFunc(NULL, args.count(), args); - } - - F32 torque_callfloatfunction(const char* nameSpace, const char* name, S32 argc, const char ** argv) - { - - Namespace::Entry* entry = GetEntry(nameSpace, name); - - if (!entry) - return 0.0f; - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mFloatCallbackFunc(NULL, args.count(), args); - } - - S32 torque_callintfunction(const char* nameSpace, const char* name, S32 argc, const char ** argv) - { - - Namespace::Entry* entry = GetEntry(nameSpace, name); - - if (!entry) - return 0; - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mIntCallbackFunc(NULL, args.count(), args); - } - - - const char * torque_callstringfunction(const char* nameSpace, const char* name, S32 argc, const char ** argv) - { - Namespace::Entry* entry = GetEntry(nameSpace, name); - - if (!entry) - return ""; - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mStringCallbackFunc(NULL, args.count(), args); - } - - bool torque_callboolfunction(const char* nameSpace, const char* name, S32 argc, const char ** argv) - { - Namespace::Entry* entry = GetEntry(nameSpace, name); - - if (!entry) - return false; - - StringStackConsoleWrapper args(argc, argv); - return entry->cb.mBoolCallbackFunc(NULL, args.count(), args); - } - - - const char * torque_callscriptfunction(const char* nameSpace, const char* name, S32 argc, const char ** argv) - { - Namespace::Entry* entry = GetEntry(nameSpace, name); - - if (!entry) - return ""; - - if(!entry->mFunctionOffset) - return ""; - - StringStackConsoleWrapper args(argc, argv); - const char* ret = entry->mCode->exec(entry->mFunctionOffset, StringTable->insert(name), entry->mNamespace, args.count(), args, false, entry->mPackage); - - if (!ret || !dStrlen(ret)) - return ""; - - return ret; - - } - - - // Call a TorqueScript console function that has been marked as secure - const char* torque_callsecurefunction(const char* nameSpace, const char* name, S32 argc, const char ** argv) - { - static const char* invalidChars = "()=:{}"; - String s = nameSpace; - s += "::"; - s += name; - s = String::ToUpper(s); - - if (!gSecureScript.count(StringTable->insert(s.c_str()))) - { - Con::warnf("\nAttempt to call insecure script: %s\n", s.c_str()); - return ""; - } - - // scan through for invalid characters - for (S32 i = 0; i < argc ; i++) - for (S32 j = 0; j < dStrlen(invalidChars) ; j++) - for (S32 k = 0; k < dStrlen(argv[i]); k++) - if (invalidChars[j] == argv[i][k]) - { - Con::warnf("\nInvalid parameter passed to secure script: %s, %s\n", s.c_str(), argv[i]); - return ""; - } - - Namespace::Entry* entry = GetEntry(nameSpace, name); - - if (!entry) - return ""; - - static char returnBuffer[32]; - - switch(entry->mType) - { - case Namespace::Entry::ConsoleFunctionType: - return torque_callscriptfunction(nameSpace, name, argc, argv); - - case Namespace::Entry::StringCallbackType: - return torque_callstringfunction(nameSpace, name, argc, argv); - - case Namespace::Entry::IntCallbackType: - dSprintf(returnBuffer, sizeof(returnBuffer), "%d", torque_callintfunction(nameSpace, name, argc, argv)); - return returnBuffer; - - case Namespace::Entry::FloatCallbackType: - dSprintf(returnBuffer, sizeof(returnBuffer), "%g", torque_callfloatfunction(nameSpace, name, argc, argv)); - return returnBuffer; - - case Namespace::Entry::VoidCallbackType: - torque_callvoidfunction(nameSpace, name, argc, argv); - return ""; - - case Namespace::Entry::BoolCallbackType: - dSprintf(returnBuffer, sizeof(returnBuffer), "%d", (U32) torque_callboolfunction(nameSpace, name, argc, argv)); - return returnBuffer; - }; - - return ""; - - } - - // Set a TorqueScript console function as secure and available for JavaScript via the callScript plugin method - void torque_addsecurefunction(const char* nameSpace, const char* fname) - { - String s = nameSpace; - s += "::"; - s += fname; - s = String::ToUpper(s); - - gSecureScript.insertEqual(StringTable->insert(s.c_str()), StringTable->insert(s.c_str())); - } - - - // Evaluate arbitrary TorqueScript (ONLY CALL torque_evaluate FROM TRUSTED CODE!!!) - const char* torque_evaluate(const char* code) - { - return Con::evaluate(code); - } - - // resize the Torque 3D child window to the specified width and height - void torque_resizewindow(S32 width, S32 height) - { - if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) - PlatformWindowManager::get()->getFirstWindow()->setSize(Point2I(width,height)); - } - -#if defined(TORQUE_OS_WIN) && !defined(TORQUE_SDL) - // retrieve the hwnd of our render window - void* torque_gethwnd() - { - if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) - { - Win32Window* w = (Win32Window*) PlatformWindowManager::get()->getFirstWindow(); - return (void *) w->getHWND(); - } - - return NULL; - } - - // directly add a message to the Torque 3D event queue, bypassing the Windows event queue - // this is useful in the case of the IE plugin, where we are hooking into an application - // level message, and posting to the windows queue would cause a hang - void torque_directmessage(U32 message, U32 wparam, U32 lparam) - { - if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) - { - Win32Window* w = (Win32Window*) PlatformWindowManager::get()->getFirstWindow(); - Dispatch(DelayedDispatch,w->getHWND(),message,wparam,lparam); - } - } - -#endif -} - -// This function is solely to test the TorqueScript <-> Javascript binding -// By default, it is marked as secure by the web plugins and then can be called from -// Javascript on the web page to ensure that function calls across the language -// boundry are working with arguments and return values -DefineEngineFunction( testJavaScriptBridge, const char *, (const char* arg1, const char* arg2, const char* arg3), , "testBridge(arg1, arg2, arg3)") +CInterface& CInterface::GetCInterface() { - S32 failed = 0; - if (dStrcmp(arg1,"one")) - failed = 2; - if (dStrcmp(arg2,"two")) - failed = 2; - if (dStrcmp(arg3,"three")) - failed = 2; - - - //attempt to call from TorqueScript -> JavaScript - const char* jret = Con::evaluate("JS::bridgeCallback(\"one\",\"two\",\"three\");"); - - if (dStrcmp(jret,"42")) - failed = 3; - - static const U32 bufSize = 256; - char *ret = Con::getReturnBuffer(bufSize); - - dSprintf(ret, bufSize, "%i", failed); - - return ret; + static CInterface INSTANCE; + return INSTANCE; } +bool CInterface::isMethod(const char* className, const char* methodName) +{ + return GetCInterface()._isMethod(className, methodName); +} +const char* CInterface::CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result) +{ + return GetCInterface()._CallFunction(nameSpace, name, argv, argc, result); +} +const char* CInterface::CallMethod(SimObject* obj, const char* name, const char **argv, int argc, bool *res) +{ + return GetCInterface()._CallMethod(obj->getClassName(), obj->getClassNamespace(), obj->getId(), name, argv, argc, res); +} +void CInterface::CallMain(bool *res) +{ + GetCInterface()._CallMain(res); +} +bool CInterface::_isMethod(const char* className, const char* methodName) const +{ + if (mIsMethodCallback) + return mIsMethodCallback(className, methodName); + + return NULL; +} + +const char* CInterface::_CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result) const +{ + if (mFunctionCallback) + return mFunctionCallback(nameSpace, name, argv, argc, result); + + *result = false; + return NULL; +} + +const char* CInterface::_CallMethod(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *res) const +{ + if (mMethodCallback) + return mMethodCallback(className, classNamespace, object, name, argv, argc, res); + + *res = false; + return NULL; +} + +void CInterface::_CallMain(bool *res) const +{ + if (mMainCallback) + { + *res = true; + mMainCallback(); + return; + } + + *res = false; +} + +TORQUE_API void SetCallbacks(void* ptr, void* methodPtr, void* isMethodPtr, void* mainPtr) { + CInterface::GetCInterface().SetCallFunctionCallback(ptr); + CInterface::GetCInterface().SetCallMethodCallback(methodPtr); + CInterface::GetCInterface().SetCallIsMethodCallback(isMethodPtr); + CInterface::GetCInterface().SetMainCallback(mainPtr); +} \ No newline at end of file diff --git a/Engine/source/cinterface/cinterface.h b/Engine/source/cinterface/cinterface.h index d7f839331..a1dcbcc9e 100644 --- a/Engine/source/cinterface/cinterface.h +++ b/Engine/source/cinterface/cinterface.h @@ -21,10 +21,41 @@ //----------------------------------------------------------------------------- #pragma once +#include "platform/platformDlibrary.h" +#include "console/engineAPI.h" +#include "console/simBase.h" -// cinterface can override this (useful for plugins, etc) -extern "C" { +#define CALL_CINTERFACE_FUNCTION(name, ...){const char *v[] = { __VA_ARGS__ }; CInterface::CallFunction(name, v, sizeof(v) / sizeof(*v));} -const char* torque_getexecutablepath(); +class CInterface { + typedef bool(*IsMethodCallback)(const char* className, const char* methodName); + typedef void(*CallMainCallback)(); + typedef const char* (*CallFunctionCallback)(const char* nameSpace, const char* name, const char **argv, int argc, bool *result); + typedef const char* (*CallMethodCallback)(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *result); + IsMethodCallback mIsMethodCallback; + CallFunctionCallback mFunctionCallback; + CallMethodCallback mMethodCallback; + CallMainCallback mMainCallback; + const char* _CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result) const; + const char* _CallMethod(const char* className, const char* classNamespace, U32 object, const char* name, const char **argv, int argc, bool *res) const; + void _CallMain(bool *res) const; + bool _isMethod(const char* className, const char* methodName) const; +public: + CInterface() + { + mFunctionCallback = NULL; + mMethodCallback = NULL; + mIsMethodCallback = NULL; + mMainCallback = NULL; + } -} + static const char* CallFunction(const char* nameSpace, const char* name, const char **argv, int argc, bool *result); + static const char* CallMethod(SimObject* obj, const char* name, const char **argv, int argc, bool *res); + static void CallMain(bool *res); + static bool isMethod(const char* className, const char* methodName); + static CInterface& GetCInterface(); + void SetCallFunctionCallback(void* ptr) { mFunctionCallback = (CallFunctionCallback)ptr; }; + void SetCallMethodCallback(void* ptr) { mMethodCallback = (CallMethodCallback)ptr; }; + void SetCallIsMethodCallback(void* ptr) { mIsMethodCallback = (IsMethodCallback)ptr; }; + void SetMainCallback(void* ptr) { mMainCallback = (CallMainCallback)ptr; }; +}; \ No newline at end of file diff --git a/Engine/source/platformMac/macFileIO.mm b/Engine/source/platformMac/macFileIO.mm index 767dbca8e..e4d182dc1 100644 --- a/Engine/source/platformMac/macFileIO.mm +++ b/Engine/source/platformMac/macFileIO.mm @@ -37,7 +37,7 @@ #import "core/strings/stringFunctions.h" #import "console/console.h" #import "platform/profiler.h" -#import "cinterface/cinterface.h" +#import "cinterface/c_controlInterface.h" #import "core/volume.h" //TODO: file io still needs some work... From 870ee9fb5be96b01929f2bb0ea69d259737bc729 Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 10:24:41 +0200 Subject: [PATCH 284/312] Integrate new CInterface into the engine-console --- Engine/source/app/mainLoop.cpp | 6 +++++ Engine/source/cinterface/c_simInterface.cpp | 5 ++-- .../cinterface/c_simobjectInterface.cpp | 2 -- Engine/source/console/codeInterpreter.cpp | 27 ++++++++++++++++--- Engine/source/console/console.cpp | 26 ++++++++++++++++++ Engine/source/module/moduleManager.cpp | 9 +++++++ 6 files changed, 67 insertions(+), 8 deletions(-) diff --git a/Engine/source/app/mainLoop.cpp b/Engine/source/app/mainLoop.cpp index 36998169f..ea2322d81 100644 --- a/Engine/source/app/mainLoop.cpp +++ b/Engine/source/app/mainLoop.cpp @@ -61,6 +61,7 @@ // For the TickMs define... fix this for T2D... #include "T3D/gameBase/processList.h" +#include "cinterface/cinterface.h" #ifdef TORQUE_ENABLE_VFS #include "platform/platformVFS.h" @@ -443,6 +444,11 @@ bool StandardMainLoop::handleCommandLine( S32 argc, const char **argv ) // directly because the resource system restricts // access to the "root" directory. + bool foundExternalMain = false; + CInterface::CallMain(&foundExternalMain); + if (foundExternalMain) + return true; + #ifdef TORQUE_ENABLE_VFS Zip::ZipArchive *vfs = openEmbeddedVFSArchive(); bool useVFS = vfs != NULL; diff --git a/Engine/source/cinterface/c_simInterface.cpp b/Engine/source/cinterface/c_simInterface.cpp index 26130a685..d3b0ea58f 100644 --- a/Engine/source/cinterface/c_simInterface.cpp +++ b/Engine/source/cinterface/c_simInterface.cpp @@ -42,12 +42,13 @@ namespace Sim return Sim::getDataBlockGroup()->findObject(StringTable->insert(pName)); } - DefineNewEngineFunction(WrapObject, SimObjectPtr*, (SimObject* pObject), , "") + // EngineAPI doesn't work with SimObjectPtr + TORQUE_API SimObjectPtr* fnWrapObject (SimObject* pObject) { return new SimObjectPtr(pObject); } - DefineNewEngineFunction(DeleteObjectPtr, void, (SimObjectPtr* pObjectPtr), , "") + TORQUE_API void fnDeleteObjectPtr(SimObjectPtr* pObjectPtr) { delete pObjectPtr; } diff --git a/Engine/source/cinterface/c_simobjectInterface.cpp b/Engine/source/cinterface/c_simobjectInterface.cpp index 757ba243b..4c018c0ab 100644 --- a/Engine/source/cinterface/c_simobjectInterface.cpp +++ b/Engine/source/cinterface/c_simobjectInterface.cpp @@ -20,8 +20,6 @@ // IN THE SOFTWARE. //----------------------------------------------------------------------------- -#include "c_simobjectInterface.h" - #include "console/engineAPI.h" #include "console/simObject.h" diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 46d58476e..294a14b2b 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -37,6 +37,7 @@ #include "core/strings/stringUnit.h" #include "console/console.h" #include "console/consoleInternal.h" +#include "cinterface/cinterface.h" //#define TORQUE_VALIDATE_STACK @@ -2023,7 +2024,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_resolve(U32 &ip) // Try to look it up. mNSEntry = Namespace::find(fnNamespace)->lookup(fnName); - if (!mNSEntry) + if (!CInterface::GetCInterface().isMethod(fnNamespace, fnName) && !mNSEntry) { ip += 5; Con::warnf(ConsoleLogEntry::General, @@ -2051,6 +2052,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) U32 *code = mCodeBlock->code; + StringTableEntry fnNamespace = CodeToSTE(mCodeBlock->code, ip + 2); StringTableEntry fnName = CodeToSTE(code, ip); //if this is called from inside a function, append the ip and codeptr @@ -2068,10 +2070,16 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) const char *componentReturnValue = ""; Namespace *ns = NULL; + bool cFunctionRes = false; + const char* cRetRes = NULL; + if (callType == FuncCallExprNode::FunctionCall) { if (!mNSEntry) mNSEntry = Namespace::global()->lookup(fnName); + + StringStackWrapper args(mCallArgc, mCallArgv); + cRetRes = CInterface::GetCInterface().CallFunction(fnNamespace, fnName, args.argv, args.argc, &cFunctionRes); } else if (callType == FuncCallExprNode::MethodCall) { @@ -2102,6 +2110,9 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) mNSEntry = ns->lookup(fnName); else mNSEntry = NULL; + + StringStackWrapper args(mCallArgc, mCallArgv); + cRetRes = CInterface::GetCInterface().CallMethod(gEvalState.thisObject, fnName, args.argv, args.argc, &cFunctionRes); } else // it's a ParentCall { @@ -2128,7 +2139,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) nsUsage = mNSEntry->mUsage; routingId = 0; } - if (!mNSEntry || mExec.noCalls) + if (!cFunctionRes && (!mNSEntry || mExec.noCalls)) { if (!mExec.noCalls && !(routingId == MethodOnComponent)) { @@ -2152,11 +2163,19 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) // ConsoleFunctionType is for any function defined by script. // Any 'callback' type is an engine function that is exposed to script. - if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType) + if (mNSEntry->mType == Namespace::Entry::ConsoleFunctionType + || cFunctionRes) { ConsoleValueRef ret; - if (mNSEntry->mFunctionOffset) + if (cFunctionRes) + { + StringStackConsoleWrapper retVal(1, &cRetRes); + ret = retVal.argv[0]; + } + else if (mNSEntry->mFunctionOffset) + { ret = mNSEntry->mCode->exec(mNSEntry->mFunctionOffset, fnName, mNSEntry->mNamespace, mCallArgc, mCallArgv, false, mNSEntry->mPackage); + } STR.popFrame(); // Functions are assumed to return strings, so look ahead to see if we can skip the conversion diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index 55880f30f..eab14bbf8 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -40,6 +40,7 @@ #include #include "platform/threads/mutex.h" #include "core/util/journal/journal.h" +#include "cinterface/cinterface.h" extern StringStack STR; extern ConsoleValueStack CSTK; @@ -1488,6 +1489,18 @@ ConsoleValueRef evaluatef(const char* string, ...) // Internal execute for global function which does not save the stack ConsoleValueRef _internalExecute(S32 argc, ConsoleValueRef argv[]) { + const char** argv_str = static_cast(malloc((argc - 1) * sizeof(char *))); + for (int i = 0; i < argc - 1; i++) + { + argv_str[i] = argv[i + 1]; + } + bool result; + const char* methodRes = CInterface::CallFunction(NULL, argv[0], argv_str, argc - 1, &result); + if (result) + { + return ConsoleValueRef::fromValue(CSTK.pushString(methodRes)); + } + Namespace::Entry *ent; StringTableEntry funcName = StringTable->insert(argv[0]); ent = Namespace::global()->lookup(funcName); @@ -1559,6 +1572,18 @@ ConsoleValueRef _internalExecute(SimObject *object, S32 argc, ConsoleValueRef ar } } + const char** argv_str = static_cast(malloc((argc - 2) * sizeof(char *))); + for (int i = 0; i < argc - 2; i++) + { + argv_str[i] = argv[i + 2]; + } + bool result; + const char* methodRes = CInterface::CallMethod(object, argv[0], argv_str, argc - 2, &result); + if (result) + { + return ConsoleValueRef::fromValue(CSTK.pushString(methodRes)); + } + if(object->getNamespace()) { U32 ident = object->getId(); @@ -1655,6 +1680,7 @@ inline ConsoleValueRef _executef(S32 checkArgc, S32 argc, ConsoleValueRef *argv) //------------------------------------------------------------------------------ bool isFunction(const char *fn) { + if (CInterface::isMethod(NULL, fn)) return true; const char *string = StringTable->lookup(fn); if(!string) return false; diff --git a/Engine/source/module/moduleManager.cpp b/Engine/source/module/moduleManager.cpp index ec45ad918..c5d3b42f6 100644 --- a/Engine/source/module/moduleManager.cpp +++ b/Engine/source/module/moduleManager.cpp @@ -455,6 +455,15 @@ bool ModuleManager::loadModuleGroup( const char* pModuleGroup ) moduleGroup, pLoadReadyModuleDefinition->getModuleId(), pLoadReadyModuleDefinition->getVersionId(), pLoadReadyModuleDefinition->getModuleScriptFilePath() ); } } + else + { + // Is the create method available? + if (pScopeSet->isMethod(pLoadReadyModuleDefinition->getCreateFunction())) + { + // Yes, so call the create method. + Con::executef(pScopeSet, pLoadReadyModuleDefinition->getCreateFunction()); + } + } // Raise notifications. raiseModulePostLoadNotifications( pLoadReadyModuleDefinition ); From 6ebb05749eab000b284fcd36d87e86248912b3ba Mon Sep 17 00:00:00 2001 From: Lukas Joergensen Date: Sat, 21 Apr 2018 10:26:20 +0200 Subject: [PATCH 285/312] Don't automatically register objects, allow for modifications to the intial fields before register. This is necessary in order to set the fields before initialization such as TorqueScript does --- Engine/source/console/simObject.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 2119ea6a9..1fb30a0ef 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -455,7 +455,6 @@ class SimObject: public ConsoleObject, public TamlCallbacks { T* object = new T; object->incRefCount(); - object->registerObject(); return object; } From 10988915651707306420f7b5b58456e3241debd3 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Fri, 27 Apr 2018 21:44:04 -0400 Subject: [PATCH 286/312] Updates PlatformCursorController to use full set of SDL cursors. Adds support for the SDL_SYSTEM_CURSOR_WAITARROW and SDL_SYSTEM_CURSOR_NO. --- Engine/source/windowManager/platformCursorController.h | 3 +++ Engine/source/windowManager/sdl/sdlCursorController.cpp | 5 +++-- Engine/source/windowManager/win32/win32CursorController.cpp | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Engine/source/windowManager/platformCursorController.h b/Engine/source/windowManager/platformCursorController.h index 686f4d390..4bd969a5c 100644 --- a/Engine/source/windowManager/platformCursorController.h +++ b/Engine/source/windowManager/platformCursorController.h @@ -76,6 +76,9 @@ public: curResizeNESW, curResizeNWSE, curHand, + curWaitArrow, + curNoNo, + numPlatformCursors }; public: diff --git a/Engine/source/windowManager/sdl/sdlCursorController.cpp b/Engine/source/windowManager/sdl/sdlCursorController.cpp index dca1f04be..601df4e19 100644 --- a/Engine/source/windowManager/sdl/sdlCursorController.cpp +++ b/Engine/source/windowManager/sdl/sdlCursorController.cpp @@ -41,7 +41,8 @@ static struct { U32 id; SDL_SystemCursor resourceID; SDL_Cursor *cursor;} sgCurs { PlatformCursorController::curResizeNESW, SDL_SYSTEM_CURSOR_SIZENESW, NULL }, { PlatformCursorController::curResizeNWSE, SDL_SYSTEM_CURSOR_SIZENWSE, NULL }, { PlatformCursorController::curHand, SDL_SYSTEM_CURSOR_HAND, NULL }, - { 0, SDL_SYSTEM_CURSOR_NO, NULL }, + { PlatformCursorController::curWaitArrow, SDL_SYSTEM_CURSOR_WAITARROW, NULL }, + { PlatformCursorController::curNoNo, SDL_SYSTEM_CURSOR_NO, NULL }, }; @@ -90,7 +91,7 @@ void PlatformCursorControllerSDL::setCursorShape(U32 cursorID) { SDL_Cursor* cursor = NULL; - for(S32 i = 0; sgCursorShapeMap[i].resourceID != SDL_SYSTEM_CURSOR_NO; ++i) + for(S32 i = 0; i < numPlatformCursors; ++i) { if(cursorID == sgCursorShapeMap[i].id) { diff --git a/Engine/source/windowManager/win32/win32CursorController.cpp b/Engine/source/windowManager/win32/win32CursorController.cpp index ba19b0979..25e024e65 100644 --- a/Engine/source/windowManager/win32/win32CursorController.cpp +++ b/Engine/source/windowManager/win32/win32CursorController.cpp @@ -43,7 +43,8 @@ static struct { U32 id; LPTSTR resourceID; } sgCursorShapeMap[]= { PlatformCursorController::curResizeNESW, IDC_SIZENESW }, { PlatformCursorController::curResizeNWSE, IDC_SIZENWSE }, { PlatformCursorController::curHand, IDC_HAND }, - { 0, 0 }, + { PlatformCursorController::curWaitArrow, IDC_WAIT }, + { PlatformCursorController::curNoNo, IDC_NO }, }; //static const EnumTable::Enums curManagerShapesEnums[] = @@ -129,7 +130,7 @@ void Win32CursorController::setCursorShape(U32 cursorID) { LPTSTR resourceID = NULL; - for(S32 i = 0;sgCursorShapeMap[i].resourceID != NULL;++i) + for(S32 i = 0; i < numPlatformCursors; ++i) { if(cursorID == sgCursorShapeMap[i].id) { From fea3724f4e2da2e446a8d2dd804656b1dc3a1d29 Mon Sep 17 00:00:00 2001 From: Ratfish Studios Date: Tue, 8 May 2018 00:30:15 -0500 Subject: [PATCH 287/312] Rearranges the right-mouse click popup menus for the world editor and gui editors to a) be organized more logically and b) be more flexible. This also fixes some insecure behavior relying on %this value eval'ing, which has also been modified to be better. Also fixes up some old calls for getting menubar menus by internal name, which is no longer supported, instead using the findMenu function call. --- Engine/source/gui/editor/popupMenu.cpp | 18 +- Engine/source/gui/editor/popupMenu.h | 3 + .../game/tools/base/menuBar/menuBuilder.ed.cs | 13 +- .../guiEditor/scripts/guiEditorTreeView.ed.cs | 58 ++-- .../shapeEditor/scripts/shapeEditor.ed.cs | 2 +- .../tools/worldEditor/scripts/EditorGui.ed.cs | 298 ++++++------------ .../game/tools/base/menuBar/menuBuilder.ed.cs | 13 +- .../tools/guiEditor/scripts/guiEditor.ed.cs | 40 +-- .../guiEditor/scripts/guiEditorTreeView.ed.cs | 58 ++-- .../shapeEditor/scripts/shapeEditor.ed.cs | 2 +- .../tools/worldEditor/scripts/EditorGui.ed.cs | 298 ++++++------------ 11 files changed, 305 insertions(+), 498 deletions(-) diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 0e5db18da..b02865bc7 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -199,7 +199,7 @@ bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, con void PopupMenu::removeItem(S32 itemPos) { - if (mMenuItems.size() < itemPos || itemPos < 0) + if (mMenuItems.empty() || mMenuItems.size() < itemPos || itemPos < 0) return; mMenuItems.erase(itemPos); @@ -208,7 +208,7 @@ void PopupMenu::removeItem(S32 itemPos) ////////////////////////////////////////////////////////////////////////// void PopupMenu::enableItem(S32 pos, bool enable) { - if (mMenuItems.size() < pos || pos < 0) + if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0) return; mMenuItems[pos].enabled = enable; @@ -216,7 +216,7 @@ void PopupMenu::enableItem(S32 pos, bool enable) void PopupMenu::checkItem(S32 pos, bool checked) { - if (mMenuItems.size() < pos || pos < 0) + if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0) return; if (checked && mMenuItems[pos].checkGroup != -1) @@ -243,7 +243,7 @@ void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) bool PopupMenu::isItemChecked(S32 pos) { - if (mMenuItems.size() < pos || pos < 0) + if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0) return false; return mMenuItems[pos].isChecked; @@ -254,6 +254,11 @@ U32 PopupMenu::getItemCount() return mMenuItems.size(); } +void PopupMenu::clearItems() +{ + mMenuItems.clear(); +} + ////////////////////////////////////////////////////////////////////////// bool PopupMenu::canHandleID(U32 id) { @@ -498,6 +503,11 @@ DefineConsoleMethod(PopupMenu, getItemCount, S32, (), , "()") return object->getItemCount(); } +DefineConsoleMethod(PopupMenu, clearItems, void, (), , "()") +{ + return object->clearItems(); +} + //----------------------------------------------------------------------------- DefineConsoleMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") { diff --git a/Engine/source/gui/editor/popupMenu.h b/Engine/source/gui/editor/popupMenu.h index 9a6dd0821..4ee7439ff 100644 --- a/Engine/source/gui/editor/popupMenu.h +++ b/Engine/source/gui/editor/popupMenu.h @@ -137,6 +137,9 @@ public: /// Returns the number of items in the menu. U32 getItemCount(); + ///Clears all items + void clearItems(); + //----------------------------------------------------------------------------- /// Displays this menu as a popup menu and blocks until the user has selected /// an item. diff --git a/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs b/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs index 11d66b2ed..183eef7eb 100644 --- a/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs +++ b/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs @@ -152,9 +152,20 @@ function MenuBuilder::onAdd(%this) } } +function MenuBuilder::reloadItems(%this) +{ + %this.clearItems(); + + for(%i = 0;%this.item[%i] !$= "";%i++) + { + %this.addItem(%i); + } +} + function MenuBuilder::onRemove(%this) { - %this.removeFromMenuBar(); + if(%this.isMethod("removeFromMenuBar")) + %this.removeFromMenuBar(); } ////////////////////////////////////////////////////////////////////////// diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs index 82a14bea0..5db0e049d 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs @@ -28,33 +28,6 @@ function GuiEditorTreeView::init(%this) { - if( !isObject( %this.contextMenu ) ) - %this.contextMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl( %this.object );"; - item[ 2 ] = "-"; - item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); GuiEditorTreeView.update();"; - item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !%this.object.isVisible() ); GuiEditorTreeView.update();"; - item[ 5 ] = "-"; - item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( %this.object );"; - item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, false );"; - item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, true );"; - - object = -1; - }; - - if( !isObject( %this.contextMenuMultiSel ) ) - %this.contextMenuMultiSel = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; - }; } //--------------------------------------------------------------------------------------------- @@ -113,12 +86,36 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) { if( %this.getSelectedItemsCount() > 1 ) { - %popup = %this.contextMenuMultiSel; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = -1; + }; + + %popup.item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; + + %popup.reloadItems(); %popup.showPopup( Canvas ); } else if( %obj ) { - %popup = %this.contextMenu; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = %obj; + }; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "-"; + %popup.item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked); GuiEditorTreeView.update();"; + %popup.item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !" @ %popup.object @ ".isVisible() ); GuiEditorTreeView.update();"; + %popup.item[ 5 ] = "-"; + %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %popup.object @ ");"; + %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", true );"; %popup.checkItem( 3, %obj.locked ); %popup.checkItem( 4, !%obj.isVisible() ); @@ -127,7 +124,8 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) %popup.enableItem( 7, %obj.getCount() > 0 ); %popup.enableItem( 8, %obj.getCount() > 0 ); - %popup.object = %obj; + %popup.reloadItems(); + %popup.showPopup( Canvas ); } } diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs index 9675ac7c9..b9551c983 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs @@ -2733,7 +2733,7 @@ function ShapeEdDetailTree::onRightMouseUp( %this, %itemId, %mouse ) superClass = "MenuBuilder"; isPopup = "1"; - item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( %this._objName, !%this._itemHidden );"; + item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem(" @ ShapeEdMeshPopup._objName @ ", !" @ ShapeEdMeshPopup @ "._itemHidden );"; item[ 1 ] = "-"; item[ 2 ] = "Hide all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", true );"; item[ 3 ] = "Show all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", false );"; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index 2d9e2ec53..50aac111b 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1571,224 +1571,111 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveLockAndHideEntries = true; //Set up the generic pop-up pre-emptively if we haven't already - if( !isObject( ETContextPopup ) ) + %popup = new PopupMenu() { - %popup = new PopupMenu( ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; - }; - } + superClass = "MenuBuilder"; + isPopup = "1"; + object = -1; + bookmark = -1; + }; - // Handle multi-selection. if( %this.getSelectedItemsCount() > 1 ) { - %popup = ETMultiSelectionContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETMultiSelectionContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; - item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - }; + %popup.item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; + %popup.item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; } - - // Open context menu if this is a CameraBookmark - else if( %obj.isMemberOfClass( "CameraBookmark" ) ) - { - %popup = ETCameraBookmarkContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarkContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );"; - - bookmark = -1; - }; - - ETCameraBookmarkContextPopup.bookmark = %obj; - } - - // Open context menu if this is set CameraBookmarks group. - else if( %obj.name $= "CameraBookmarks" ) - { - %popup = ETCameraBookmarksGroupContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarksGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; - }; - } - - else if(%obj.isMemberOfClass("Entity")) - { - %popup = EntityObjectPopup; - if(!isObject(EntityObjectPopup)) - { - %popup = new PopupMenu( EntityObjectPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; - item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; - - object = -1; - }; - } - - if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) - { - EntityObjectPopup.enableItem(13, true); - EntityObjectPopup.enableItem(14, false); - EntityObjectPopup.enableItem(15, false); - } - else - { - EntityObjectPopup.enableItem(13, false); - EntityObjectPopup.enableItem(14, true); - EntityObjectPopup.enableItem(15, true); - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Open context menu if this is a SimGroup - else if( !%obj.isMemberOfClass( "SceneObject" ) ) - { - %popup = ETSimGroupContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - - object = -1; - }; - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) - { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Open generic context menu. else { - %popup = ETContextPopup; - - %popup.object = %obj; - %haveObjectEntries = true; + if( %obj.isMemberOfClass( "CameraBookmark" ) ) + { + %popup.bookmark = %obj; + + %popup.item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( " @ %popup.bookmark.getInternalName() @ " );"; + } + else if( %obj.name $= "CameraBookmarks" ) + { + %popup.item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; + } + else + { + %popup.object = %obj; + %haveObjectEntries = true; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");"; + %popup.item[ 3 ] = "-"; + %popup.item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked ); EWorldEditor.syncGui();"; + %popup.item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( " @ %popup.object @ ", !" @ %popup.object @ ".hidden ); EWorldEditor.syncGui();"; + %popup.item[ 6 ] = "-"; + %popup.item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + if( %obj.isMemberOfClass( "ConvexShape" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + %popup.item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + %popup.item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + %popup.item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; + } + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + } + else if(%obj.getClassName() $= "SimGroup" || + %obj.isMemberOfClass( "Path" ) || + %obj.isMemberOfClass("Entity") ) + { + //If it's not any special-handle classes above, then it'll be group-based stuff here + %popup.item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( " @ %popup.object @ " );"; + %popup.item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( " @ %popup.object @ " );"; + + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( " @ %popup.object @ " );"; + %popup.item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", true );"; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + + //Special case for Entities, which is special-case AND does group stuff with chld objects + if(%obj.isMemberOfClass("Entity")) + { + %popup.item[ 12 ] = "-"; + %popup.item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( " @ %popup.object @ " );"; + %popup.item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( " @ %popup.object @ " );"; + %popup.item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( " @ %popup.object @ " );"; + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + %popup.enableItem(13, true); + %popup.enableItem(14, false); + %popup.enableItem(15, false); + } + else + { + %popup.enableItem(13, false); + %popup.enableItem(14, true); + %popup.enableItem(15, true); + } + } + } + } } if( %haveObjectEntries ) { %popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" ); %popup.enableItem( 1, %obj.getName() !$= "MissionGroup" ); + if( %haveLockAndHideEntries ) { %popup.checkItem( 4, %obj.locked ); @@ -1797,6 +1684,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %popup.enableItem( 7, %this.isItemSelected( %itemId ) ); } + %popup.reloadItems(); %popup.showPopup( Canvas ); } diff --git a/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs b/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs index 11d66b2ed..183eef7eb 100644 --- a/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs +++ b/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs @@ -152,9 +152,20 @@ function MenuBuilder::onAdd(%this) } } +function MenuBuilder::reloadItems(%this) +{ + %this.clearItems(); + + for(%i = 0;%this.item[%i] !$= "";%i++) + { + %this.addItem(%i); + } +} + function MenuBuilder::onRemove(%this) { - %this.removeFromMenuBar(); + if(%this.isMethod("removeFromMenuBar")) + %this.removeFromMenuBar(); } ////////////////////////////////////////////////////////////////////////// diff --git a/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs b/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs index 61dc8c5e7..e68c2e3db 100644 --- a/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs +++ b/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs @@ -223,7 +223,7 @@ function GuiEditor::switchToWorldEditor( %this ) function GuiEditor::enableMenuItems(%this, %val) { - %menu = GuiEditCanvas.menuBar->EditMenu.getID(); + %menu = GuiEditCanvas.menuBar.findMenu("Edit").getID(); %menu.enableItem( 3, %val ); // cut %menu.enableItem( 4, %val ); // copy @@ -239,8 +239,8 @@ function GuiEditor::enableMenuItems(%this, %val) %menu.enableItem( 18, %val ); // group %menu.enableItem( 19, %val ); // ungroup - GuiEditCanvas.menuBar->LayoutMenu.enableAllItems( %val ); - GuiEditCanvas.menuBar->MoveMenu.enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Layout").enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Move").enableAllItems( %val ); } //--------------------------------------------------------------------------------------------- @@ -294,7 +294,7 @@ function GuiEditor::updateUndoMenu(%this) %nextUndo = %uman.getNextUndoName(); %nextRedo = %uman.getNextRedoName(); - %editMenu = GuiEditCanvas.menuBar->editMenu; + %editMenu = GuiEditCanvas.menuBar.findMenu("Edit"); %editMenu.setItemName( 0, "Undo " @ %nextUndo ); %editMenu.setItemName( 1, "Redo " @ %nextRedo ); @@ -443,7 +443,7 @@ function GuiEditor::setPreviewResolution( %this, %width, %height ) function GuiEditor::toggleEdgeSnap( %this ) { %this.snapToEdges = !%this.snapToEdges; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); GuiEditorEdgeSnapping_btn.setStateOn( %this.snapToEdges ); } @@ -452,7 +452,7 @@ function GuiEditor::toggleEdgeSnap( %this ) function GuiEditor::toggleCenterSnap( %this ) { %this.snapToCenters = !%this.snapToCenters; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); GuiEditorCenterSnapping_btn.setStateOn( %this.snapToCenters ); } @@ -461,7 +461,7 @@ function GuiEditor::toggleCenterSnap( %this ) function GuiEditor::toggleFullBoxSelection( %this ) { %this.fullBoxSelection = !%this.fullBoxSelection; - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); } //--------------------------------------------------------------------------------------------- @@ -469,7 +469,7 @@ function GuiEditor::toggleFullBoxSelection( %this ) function GuiEditor::toggleDrawGuides( %this ) { %this.drawGuides= !%this.drawGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); } //--------------------------------------------------------------------------------------------- @@ -477,7 +477,7 @@ function GuiEditor::toggleDrawGuides( %this ) function GuiEditor::toggleGuideSnap( %this ) { %this.snapToGuides = !%this.snapToGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); } //--------------------------------------------------------------------------------------------- @@ -485,7 +485,7 @@ function GuiEditor::toggleGuideSnap( %this ) function GuiEditor::toggleControlSnap( %this ) { %this.snapToControls = !%this.snapToControls; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); } //--------------------------------------------------------------------------------------------- @@ -493,7 +493,7 @@ function GuiEditor::toggleControlSnap( %this ) function GuiEditor::toggleCanvasSnap( %this ) { %this.snapToCanvas = !%this.snapToCanvas; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); } //--------------------------------------------------------------------------------------------- @@ -506,7 +506,7 @@ function GuiEditor::toggleGridSnap( %this ) else %this.setSnapToGrid( %this.snap2GridSize ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); GuiEditorSnapCheckBox.setStateOn( %this.snap2Grid ); } @@ -993,14 +993,14 @@ function GuiEditorGui::onWake( %this ) // Set up initial menu toggle states. - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); // Sync toolbar buttons. diff --git a/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs b/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs index 82a14bea0..5db0e049d 100644 --- a/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs +++ b/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs @@ -28,33 +28,6 @@ function GuiEditorTreeView::init(%this) { - if( !isObject( %this.contextMenu ) ) - %this.contextMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl( %this.object );"; - item[ 2 ] = "-"; - item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); GuiEditorTreeView.update();"; - item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !%this.object.isVisible() ); GuiEditorTreeView.update();"; - item[ 5 ] = "-"; - item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( %this.object );"; - item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, false );"; - item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, true );"; - - object = -1; - }; - - if( !isObject( %this.contextMenuMultiSel ) ) - %this.contextMenuMultiSel = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; - }; } //--------------------------------------------------------------------------------------------- @@ -113,12 +86,36 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) { if( %this.getSelectedItemsCount() > 1 ) { - %popup = %this.contextMenuMultiSel; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = -1; + }; + + %popup.item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; + + %popup.reloadItems(); %popup.showPopup( Canvas ); } else if( %obj ) { - %popup = %this.contextMenu; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = %obj; + }; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "-"; + %popup.item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked); GuiEditorTreeView.update();"; + %popup.item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !" @ %popup.object @ ".isVisible() ); GuiEditorTreeView.update();"; + %popup.item[ 5 ] = "-"; + %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %popup.object @ ");"; + %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", true );"; %popup.checkItem( 3, %obj.locked ); %popup.checkItem( 4, !%obj.isVisible() ); @@ -127,7 +124,8 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) %popup.enableItem( 7, %obj.getCount() > 0 ); %popup.enableItem( 8, %obj.getCount() > 0 ); - %popup.object = %obj; + %popup.reloadItems(); + %popup.showPopup( Canvas ); } } diff --git a/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs b/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs index d79923776..a62605821 100644 --- a/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs +++ b/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs @@ -2719,7 +2719,7 @@ function ShapeEdDetailTree::onRightMouseUp( %this, %itemId, %mouse ) superClass = "MenuBuilder"; isPopup = "1"; - item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( %this._objName, !%this._itemHidden );"; + item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem(" @ ShapeEdMeshPopup._objName @ ", !" @ ShapeEdMeshPopup @ "._itemHidden );"; item[ 1 ] = "-"; item[ 2 ] = "Hide all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", true );"; item[ 3 ] = "Show all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", false );"; diff --git a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs index 2d9e2ec53..50aac111b 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1571,224 +1571,111 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveLockAndHideEntries = true; //Set up the generic pop-up pre-emptively if we haven't already - if( !isObject( ETContextPopup ) ) + %popup = new PopupMenu() { - %popup = new PopupMenu( ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; - }; - } + superClass = "MenuBuilder"; + isPopup = "1"; + object = -1; + bookmark = -1; + }; - // Handle multi-selection. if( %this.getSelectedItemsCount() > 1 ) { - %popup = ETMultiSelectionContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETMultiSelectionContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; - item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - }; + %popup.item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; + %popup.item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; } - - // Open context menu if this is a CameraBookmark - else if( %obj.isMemberOfClass( "CameraBookmark" ) ) - { - %popup = ETCameraBookmarkContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarkContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );"; - - bookmark = -1; - }; - - ETCameraBookmarkContextPopup.bookmark = %obj; - } - - // Open context menu if this is set CameraBookmarks group. - else if( %obj.name $= "CameraBookmarks" ) - { - %popup = ETCameraBookmarksGroupContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarksGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; - }; - } - - else if(%obj.isMemberOfClass("Entity")) - { - %popup = EntityObjectPopup; - if(!isObject(EntityObjectPopup)) - { - %popup = new PopupMenu( EntityObjectPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; - item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; - - object = -1; - }; - } - - if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) - { - EntityObjectPopup.enableItem(13, true); - EntityObjectPopup.enableItem(14, false); - EntityObjectPopup.enableItem(15, false); - } - else - { - EntityObjectPopup.enableItem(13, false); - EntityObjectPopup.enableItem(14, true); - EntityObjectPopup.enableItem(15, true); - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Open context menu if this is a SimGroup - else if( !%obj.isMemberOfClass( "SceneObject" ) ) - { - %popup = ETSimGroupContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - - object = -1; - }; - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) - { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Open generic context menu. else { - %popup = ETContextPopup; - - %popup.object = %obj; - %haveObjectEntries = true; + if( %obj.isMemberOfClass( "CameraBookmark" ) ) + { + %popup.bookmark = %obj; + + %popup.item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( " @ %popup.bookmark.getInternalName() @ " );"; + } + else if( %obj.name $= "CameraBookmarks" ) + { + %popup.item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; + } + else + { + %popup.object = %obj; + %haveObjectEntries = true; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");"; + %popup.item[ 3 ] = "-"; + %popup.item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked ); EWorldEditor.syncGui();"; + %popup.item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( " @ %popup.object @ ", !" @ %popup.object @ ".hidden ); EWorldEditor.syncGui();"; + %popup.item[ 6 ] = "-"; + %popup.item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + if( %obj.isMemberOfClass( "ConvexShape" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + %popup.item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + %popup.item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + %popup.item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; + } + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + } + else if(%obj.getClassName() $= "SimGroup" || + %obj.isMemberOfClass( "Path" ) || + %obj.isMemberOfClass("Entity") ) + { + //If it's not any special-handle classes above, then it'll be group-based stuff here + %popup.item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( " @ %popup.object @ " );"; + %popup.item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( " @ %popup.object @ " );"; + + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( " @ %popup.object @ " );"; + %popup.item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", true );"; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + + //Special case for Entities, which is special-case AND does group stuff with chld objects + if(%obj.isMemberOfClass("Entity")) + { + %popup.item[ 12 ] = "-"; + %popup.item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( " @ %popup.object @ " );"; + %popup.item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( " @ %popup.object @ " );"; + %popup.item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( " @ %popup.object @ " );"; + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + %popup.enableItem(13, true); + %popup.enableItem(14, false); + %popup.enableItem(15, false); + } + else + { + %popup.enableItem(13, false); + %popup.enableItem(14, true); + %popup.enableItem(15, true); + } + } + } + } } if( %haveObjectEntries ) { %popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" ); %popup.enableItem( 1, %obj.getName() !$= "MissionGroup" ); + if( %haveLockAndHideEntries ) { %popup.checkItem( 4, %obj.locked ); @@ -1797,6 +1684,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %popup.enableItem( 7, %this.isItemSelected( %itemId ) ); } + %popup.reloadItems(); %popup.showPopup( Canvas ); } From 925d8b27cf4938ed90a341f46fee90024787dbbc Mon Sep 17 00:00:00 2001 From: rextimmy Date: Wed, 9 May 2018 20:48:18 +1000 Subject: [PATCH 288/312] openal-soft updates --- Engine/lib/openal-soft/.gitignore | 10 +- Engine/lib/openal-soft/.travis.yml | 69 +- Engine/lib/openal-soft/Alc/ALc.c | 2383 ++++++++++------ Engine/lib/openal-soft/Alc/ALu.c | 2424 +++++++++------- Engine/lib/openal-soft/Alc/alcRing.c | 301 -- .../Alc/{alcConfig.c => alconfig.c} | 179 +- Engine/lib/openal-soft/Alc/alconfig.h | 17 + Engine/lib/openal-soft/Alc/alstring.h | 45 +- Engine/lib/openal-soft/Alc/ambdec.c | 33 +- Engine/lib/openal-soft/Alc/ambdec.h | 2 +- Engine/lib/openal-soft/Alc/backends/alsa.c | 178 +- Engine/lib/openal-soft/Alc/backends/base.c | 176 +- Engine/lib/openal-soft/Alc/backends/base.h | 25 +- .../lib/openal-soft/Alc/backends/coreaudio.c | 552 ++-- Engine/lib/openal-soft/Alc/backends/dsound.c | 336 +-- Engine/lib/openal-soft/Alc/backends/jack.c | 146 +- .../lib/openal-soft/Alc/backends/loopback.c | 7 +- Engine/lib/openal-soft/Alc/backends/null.c | 22 +- Engine/lib/openal-soft/Alc/backends/opensl.c | 1002 +++++-- Engine/lib/openal-soft/Alc/backends/oss.c | 329 ++- .../lib/openal-soft/Alc/backends/portaudio.c | 49 +- .../lib/openal-soft/Alc/backends/pulseaudio.c | 332 ++- Engine/lib/openal-soft/Alc/backends/qsa.c | 381 ++- Engine/lib/openal-soft/Alc/backends/sdl2.c | 287 ++ Engine/lib/openal-soft/Alc/backends/sndio.c | 216 +- Engine/lib/openal-soft/Alc/backends/solaris.c | 103 +- .../Alc/backends/{mmdevapi.c => wasapi.c} | 777 ++--- Engine/lib/openal-soft/Alc/backends/wave.c | 71 +- Engine/lib/openal-soft/Alc/backends/winmm.c | 139 +- Engine/lib/openal-soft/Alc/bformatdec.c | 544 ++-- Engine/lib/openal-soft/Alc/bformatdec.h | 60 +- Engine/lib/openal-soft/Alc/bs2b.c | 8 +- Engine/lib/openal-soft/Alc/bsinc.c | 981 ------- Engine/lib/openal-soft/Alc/compat.h | 18 +- Engine/lib/openal-soft/Alc/converter.c | 468 +++ Engine/lib/openal-soft/Alc/converter.h | 55 + Engine/lib/openal-soft/Alc/cpu_caps.h | 15 + Engine/lib/openal-soft/Alc/effects/chorus.c | 461 +-- .../lib/openal-soft/Alc/effects/compressor.c | 72 +- .../lib/openal-soft/Alc/effects/dedicated.c | 109 +- .../lib/openal-soft/Alc/effects/distortion.c | 203 +- Engine/lib/openal-soft/Alc/effects/echo.c | 198 +- .../lib/openal-soft/Alc/effects/equalizer.c | 247 +- Engine/lib/openal-soft/Alc/effects/flanger.c | 411 --- .../lib/openal-soft/Alc/effects/modulator.c | 180 +- Engine/lib/openal-soft/Alc/effects/null.c | 74 +- Engine/lib/openal-soft/Alc/effects/pshifter.c | 526 ++++ Engine/lib/openal-soft/Alc/effects/reverb.c | 2500 +++++++++-------- Engine/lib/openal-soft/Alc/filters/defs.h | 112 + Engine/lib/openal-soft/Alc/filters/filter.c | 129 + Engine/lib/openal-soft/Alc/filters/nfc.c | 426 +++ Engine/lib/openal-soft/Alc/filters/nfc.h | 49 + Engine/lib/openal-soft/Alc/filters/splitter.c | 109 + Engine/lib/openal-soft/Alc/filters/splitter.h | 40 + Engine/lib/openal-soft/Alc/fpu_modes.h | 34 + Engine/lib/openal-soft/Alc/helpers.c | 527 ++-- Engine/lib/openal-soft/Alc/hrtf.c | 1395 +++++---- Engine/lib/openal-soft/Alc/hrtf.h | 95 +- Engine/lib/openal-soft/Alc/hrtf_res.h | 5 - Engine/lib/openal-soft/Alc/hrtf_res.rc | 4 - Engine/lib/openal-soft/Alc/inprogext.h | 79 + Engine/lib/openal-soft/Alc/logging.h | 69 + Engine/lib/openal-soft/Alc/mastering.c | 232 ++ Engine/lib/openal-soft/Alc/mastering.h | 57 + Engine/lib/openal-soft/Alc/mixer.c | 702 ----- Engine/lib/openal-soft/Alc/mixer/defs.h | 119 + Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c | 123 + Engine/lib/openal-soft/Alc/mixer/mixer_c.c | 176 ++ Engine/lib/openal-soft/Alc/mixer/mixer_neon.c | 269 ++ .../openal-soft/Alc/{ => mixer}/mixer_sse.c | 164 +- .../openal-soft/Alc/{ => mixer}/mixer_sse2.c | 18 +- Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c | 0 .../lib/openal-soft/Alc/mixer/mixer_sse41.c | 88 + Engine/lib/openal-soft/Alc/mixer_c.c | 228 -- Engine/lib/openal-soft/Alc/mixer_defs.h | 110 - Engine/lib/openal-soft/Alc/mixer_inc.c | 149 - Engine/lib/openal-soft/Alc/mixer_neon.c | 173 -- Engine/lib/openal-soft/Alc/mixer_sse3.c | 164 -- Engine/lib/openal-soft/Alc/mixer_sse41.c | 227 -- Engine/lib/openal-soft/Alc/mixvoice.c | 761 +++++ Engine/lib/openal-soft/Alc/panning.c | 908 +++--- Engine/lib/openal-soft/Alc/polymorphism.h | 105 + Engine/lib/openal-soft/Alc/ringbuffer.c | 295 ++ Engine/lib/openal-soft/Alc/ringbuffer.h | 77 + Engine/lib/openal-soft/Alc/uhjfilter.c | 90 +- Engine/lib/openal-soft/Alc/uhjfilter.h | 11 +- Engine/lib/openal-soft/Alc/vector.h | 24 +- Engine/lib/openal-soft/CMakeLists.txt | 967 ++++--- Engine/lib/openal-soft/ChangeLog | 165 ++ .../OpenAL32/Include/alAuxEffectSlot.h | 114 +- .../openal-soft/OpenAL32/Include/alBuffer.h | 109 +- .../openal-soft/OpenAL32/Include/alEffect.h | 78 +- .../openal-soft/OpenAL32/Include/alError.h | 22 +- .../openal-soft/OpenAL32/Include/alFilter.h | 146 +- .../openal-soft/OpenAL32/Include/alListener.h | 49 +- .../lib/openal-soft/OpenAL32/Include/alMain.h | 909 +++--- .../openal-soft/OpenAL32/Include/alSource.h | 153 +- .../openal-soft/OpenAL32/Include/alThunk.h | 20 - Engine/lib/openal-soft/OpenAL32/Include/alu.h | 379 ++- .../lib/openal-soft/OpenAL32/Include/bs2b.h | 2 +- .../openal-soft/OpenAL32/Include/sample_cvt.h | 8 +- .../openal-soft/OpenAL32/alAuxEffectSlot.c | 517 ++-- Engine/lib/openal-soft/OpenAL32/alBuffer.c | 1334 ++++----- Engine/lib/openal-soft/OpenAL32/alEffect.c | 312 +- Engine/lib/openal-soft/OpenAL32/alError.c | 54 +- Engine/lib/openal-soft/OpenAL32/alExtension.c | 20 +- Engine/lib/openal-soft/OpenAL32/alFilter.c | 534 ++-- Engine/lib/openal-soft/OpenAL32/alListener.c | 253 +- Engine/lib/openal-soft/OpenAL32/alSource.c | 2322 ++++++++------- Engine/lib/openal-soft/OpenAL32/alState.c | 387 ++- Engine/lib/openal-soft/OpenAL32/alThunk.c | 105 - Engine/lib/openal-soft/OpenAL32/event.c | 140 + Engine/lib/openal-soft/OpenAL32/sample_cvt.c | 968 +------ Engine/lib/openal-soft/README | 55 - Engine/lib/openal-soft/README.md | 61 + Engine/lib/openal-soft/alsoftrc.sample | 110 +- Engine/lib/openal-soft/appveyor.yml | 9 +- .../cmake/CheckSharedFunctionExists.cmake | 4 +- Engine/lib/openal-soft/cmake/FindDSound.cmake | 30 +- Engine/lib/openal-soft/cmake/FindFFmpeg.cmake | 6 + Engine/lib/openal-soft/cmake/FindOSS.cmake | 14 +- Engine/lib/openal-soft/cmake/FindSDL2.cmake | 20 +- .../openal-soft/cmake/FindWindowsSDK.cmake | 626 +++++ .../openal-soft/{include => common}/align.h | 0 Engine/lib/openal-soft/common/almalloc.c | 48 + Engine/lib/openal-soft/common/almalloc.h | 30 + Engine/lib/openal-soft/common/atomic.h | 439 +++ .../openal-soft/{include => common}/bool.h | 0 Engine/lib/openal-soft/common/math_defs.h | 46 + Engine/lib/openal-soft/common/rwlock.c | 20 +- .../openal-soft/{include => common}/rwlock.h | 9 +- .../{include => common}/static_assert.h | 0 Engine/lib/openal-soft/common/threads.c | 245 +- .../openal-soft/{include => common}/threads.h | 29 +- Engine/lib/openal-soft/common/uintmap.c | 138 +- .../openal-soft/{include => common}/uintmap.h | 18 +- Engine/lib/openal-soft/common/win_main_utf8.h | 97 + Engine/lib/openal-soft/config.h.in | 44 +- Engine/lib/openal-soft/include/AL/alext.h | 73 + Engine/lib/openal-soft/include/almalloc.h | 18 - Engine/lib/openal-soft/include/atomic.h | 317 --- Engine/lib/openal-soft/include/math_defs.h | 19 - .../openal-soft/native-tools/CMakeLists.txt | 29 + Engine/lib/openal-soft/native-tools/bin2h.c | 100 + .../lib/openal-soft/native-tools/bsincgen.c | 367 +++ Engine/lib/openal-soft/openal.pc.in | 1 + Engine/lib/openal-soft/version.cmake | 11 + Engine/lib/openal-soft/version.h.in | 8 + Tools/CMake/torque3d.cmake | 8 + 149 files changed, 22293 insertions(+), 16887 deletions(-) delete mode 100644 Engine/lib/openal-soft/Alc/alcRing.c rename Engine/lib/openal-soft/Alc/{alcConfig.c => alconfig.c} (70%) create mode 100644 Engine/lib/openal-soft/Alc/alconfig.h create mode 100644 Engine/lib/openal-soft/Alc/backends/sdl2.c rename Engine/lib/openal-soft/Alc/backends/{mmdevapi.c => wasapi.c} (67%) delete mode 100644 Engine/lib/openal-soft/Alc/bsinc.c create mode 100644 Engine/lib/openal-soft/Alc/converter.c create mode 100644 Engine/lib/openal-soft/Alc/converter.h create mode 100644 Engine/lib/openal-soft/Alc/cpu_caps.h delete mode 100644 Engine/lib/openal-soft/Alc/effects/flanger.c create mode 100644 Engine/lib/openal-soft/Alc/effects/pshifter.c create mode 100644 Engine/lib/openal-soft/Alc/filters/defs.h create mode 100644 Engine/lib/openal-soft/Alc/filters/filter.c create mode 100644 Engine/lib/openal-soft/Alc/filters/nfc.c create mode 100644 Engine/lib/openal-soft/Alc/filters/nfc.h create mode 100644 Engine/lib/openal-soft/Alc/filters/splitter.c create mode 100644 Engine/lib/openal-soft/Alc/filters/splitter.h create mode 100644 Engine/lib/openal-soft/Alc/fpu_modes.h delete mode 100644 Engine/lib/openal-soft/Alc/hrtf_res.h delete mode 100644 Engine/lib/openal-soft/Alc/hrtf_res.rc create mode 100644 Engine/lib/openal-soft/Alc/inprogext.h create mode 100644 Engine/lib/openal-soft/Alc/logging.h create mode 100644 Engine/lib/openal-soft/Alc/mastering.c create mode 100644 Engine/lib/openal-soft/Alc/mastering.h delete mode 100644 Engine/lib/openal-soft/Alc/mixer.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/defs.h create mode 100644 Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_c.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_neon.c rename Engine/lib/openal-soft/Alc/{ => mixer}/mixer_sse.c (55%) rename Engine/lib/openal-soft/Alc/{ => mixer}/mixer_sse2.c (86%) create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_c.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_defs.h delete mode 100644 Engine/lib/openal-soft/Alc/mixer_inc.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_neon.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_sse3.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_sse41.c create mode 100644 Engine/lib/openal-soft/Alc/mixvoice.c create mode 100644 Engine/lib/openal-soft/Alc/polymorphism.h create mode 100644 Engine/lib/openal-soft/Alc/ringbuffer.c create mode 100644 Engine/lib/openal-soft/Alc/ringbuffer.h delete mode 100644 Engine/lib/openal-soft/OpenAL32/Include/alThunk.h delete mode 100644 Engine/lib/openal-soft/OpenAL32/alThunk.c create mode 100644 Engine/lib/openal-soft/OpenAL32/event.c delete mode 100644 Engine/lib/openal-soft/README create mode 100644 Engine/lib/openal-soft/README.md create mode 100644 Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake rename Engine/lib/openal-soft/{include => common}/align.h (100%) create mode 100644 Engine/lib/openal-soft/common/almalloc.h create mode 100644 Engine/lib/openal-soft/common/atomic.h rename Engine/lib/openal-soft/{include => common}/bool.h (100%) create mode 100644 Engine/lib/openal-soft/common/math_defs.h rename Engine/lib/openal-soft/{include => common}/rwlock.h (67%) rename Engine/lib/openal-soft/{include => common}/static_assert.h (100%) rename Engine/lib/openal-soft/{include => common}/threads.h (83%) rename Engine/lib/openal-soft/{include => common}/uintmap.h (60%) create mode 100644 Engine/lib/openal-soft/common/win_main_utf8.h delete mode 100644 Engine/lib/openal-soft/include/almalloc.h delete mode 100644 Engine/lib/openal-soft/include/atomic.h delete mode 100644 Engine/lib/openal-soft/include/math_defs.h create mode 100644 Engine/lib/openal-soft/native-tools/CMakeLists.txt create mode 100644 Engine/lib/openal-soft/native-tools/bin2h.c create mode 100644 Engine/lib/openal-soft/native-tools/bsincgen.c create mode 100644 Engine/lib/openal-soft/version.cmake create mode 100644 Engine/lib/openal-soft/version.h.in diff --git a/Engine/lib/openal-soft/.gitignore b/Engine/lib/openal-soft/.gitignore index 9aa081c61..de57ef223 100644 --- a/Engine/lib/openal-soft/.gitignore +++ b/Engine/lib/openal-soft/.gitignore @@ -1,7 +1,5 @@ -build -winbuild -win64build -include/SLES -include/sndio.h -include/sys +build*/ +winbuild/ +win64build/ openal-soft.kdev4 +.kdev4/ diff --git a/Engine/lib/openal-soft/.travis.yml b/Engine/lib/openal-soft/.travis.yml index dfae8e7a5..426eef40c 100644 --- a/Engine/lib/openal-soft/.travis.yml +++ b/Engine/lib/openal-soft/.travis.yml @@ -1,5 +1,66 @@ -os: - - linux - - osx language: c -script: cmake . && make -j2 +matrix: + include: + - os: linux + dist: trusty + - os: linux + dist: trusty + env: + - BUILD_ANDROID=true + - os: osx +sudo: required +install: + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && -z "${BUILD_ANDROID}" ]]; then + # Install pulseaudio, portaudio, ALSA, JACK dependencies for + # corresponding backends. + # Install Qt5 dependency for alsoft-config. + sudo apt-get install -qq \ + libpulse-dev \ + portaudio19-dev \ + libasound2-dev \ + libjack-dev \ + qtbase5-dev + fi + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && "${BUILD_ANDROID}" == "true" ]]; then + curl -o ~/android-ndk.zip https://dl.google.com/android/repository/android-ndk-r15-linux-x86_64.zip + unzip -q ~/android-ndk.zip -d ~ \ + 'android-ndk-r15/build/cmake/*' \ + 'android-ndk-r15/build/core/toolchains/arm-linux-androideabi-*/*' \ + 'android-ndk-r15/platforms/android-14/arch-arm/*' \ + 'android-ndk-r15/source.properties' \ + 'android-ndk-r15/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/*' \ + 'android-ndk-r15/sources/cxx-stl/gnu-libstdc++/4.9/include/*' \ + 'android-ndk-r15/sysroot/*' \ + 'android-ndk-r15/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/*' \ + 'android-ndk-r15/toolchains/llvm/prebuilt/linux-x86_64/*' + fi +script: + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && -z "${BUILD_ANDROID}" ]]; then + cmake \ + -DALSOFT_REQUIRE_ALSA=ON \ + -DALSOFT_REQUIRE_OSS=ON \ + -DALSOFT_REQUIRE_PORTAUDIO=ON \ + -DALSOFT_REQUIRE_PULSEAUDIO=ON \ + -DALSOFT_REQUIRE_JACK=ON \ + -DALSOFT_EMBED_HRTF_DATA=YES \ + . + fi + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && "${BUILD_ANDROID}" == "true" ]]; then + cmake \ + -DCMAKE_TOOLCHAIN_FILE=~/android-ndk-r15/build/cmake/android.toolchain.cmake \ + -DALSOFT_REQUIRE_OPENSL=ON \ + -DALSOFT_EMBED_HRTF_DATA=YES \ + . + fi + - > + if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + cmake \ + -DALSOFT_REQUIRE_COREAUDIO=ON \ + -DALSOFT_EMBED_HRTF_DATA=YES \ + . + fi + - make -j2 diff --git a/Engine/lib/openal-soft/Alc/ALc.c b/Engine/lib/openal-soft/Alc/ALc.c index 7e220205c..597cc890c 100644 --- a/Engine/lib/openal-soft/Alc/ALc.c +++ b/Engine/lib/openal-soft/Alc/ALc.c @@ -20,6 +20,8 @@ #include "config.h" +#include "version.h" + #include #include #include @@ -30,14 +32,20 @@ #include "alMain.h" #include "alSource.h" #include "alListener.h" -#include "alThunk.h" #include "alSource.h" #include "alBuffer.h" +#include "alFilter.h" +#include "alEffect.h" #include "alAuxEffectSlot.h" #include "alError.h" +#include "mastering.h" #include "bformatdec.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" +#include "fpu_modes.h" +#include "cpu_caps.h" #include "compat.h" #include "threads.h" #include "alstring.h" @@ -52,61 +60,58 @@ struct BackendInfo { const char *name; ALCbackendFactory* (*getFactory)(void); - ALCboolean (*Init)(BackendFuncs*); - void (*Deinit)(void); - void (*Probe)(enum DevProbe); - BackendFuncs Funcs; }; -#define EmptyFuncs { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } static struct BackendInfo BackendList[] = { #ifdef HAVE_JACK - { "jack", ALCjackBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "jack", ALCjackBackendFactory_getFactory }, #endif #ifdef HAVE_PULSEAUDIO - { "pulse", ALCpulseBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "pulse", ALCpulseBackendFactory_getFactory }, #endif #ifdef HAVE_ALSA - { "alsa", ALCalsaBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "alsa", ALCalsaBackendFactory_getFactory }, #endif #ifdef HAVE_COREAUDIO - { "core", NULL, alc_ca_init, alc_ca_deinit, alc_ca_probe, EmptyFuncs }, + { "core", ALCcoreAudioBackendFactory_getFactory }, #endif #ifdef HAVE_OSS - { "oss", ALCossBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "oss", ALCossBackendFactory_getFactory }, #endif #ifdef HAVE_SOLARIS - { "solaris", ALCsolarisBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "solaris", ALCsolarisBackendFactory_getFactory }, #endif #ifdef HAVE_SNDIO - { "sndio", NULL, alc_sndio_init, alc_sndio_deinit, alc_sndio_probe, EmptyFuncs }, + { "sndio", ALCsndioBackendFactory_getFactory }, #endif #ifdef HAVE_QSA - { "qsa", NULL, alc_qsa_init, alc_qsa_deinit, alc_qsa_probe, EmptyFuncs }, + { "qsa", ALCqsaBackendFactory_getFactory }, #endif -#ifdef HAVE_MMDEVAPI - { "mmdevapi", ALCmmdevBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, +#ifdef HAVE_WASAPI + { "wasapi", ALCwasapiBackendFactory_getFactory }, #endif #ifdef HAVE_DSOUND - { "dsound", ALCdsoundBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "dsound", ALCdsoundBackendFactory_getFactory }, #endif #ifdef HAVE_WINMM - { "winmm", ALCwinmmBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "winmm", ALCwinmmBackendFactory_getFactory }, #endif #ifdef HAVE_PORTAUDIO - { "port", ALCportBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "port", ALCportBackendFactory_getFactory }, #endif #ifdef HAVE_OPENSL - { "opensl", NULL, alc_opensl_init, alc_opensl_deinit, alc_opensl_probe, EmptyFuncs }, + { "opensl", ALCopenslBackendFactory_getFactory }, +#endif +#ifdef HAVE_SDL2 + { "sdl2", ALCsdl2BackendFactory_getFactory }, #endif - { "null", ALCnullBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "null", ALCnullBackendFactory_getFactory }, #ifdef HAVE_WAVE - { "wave", ALCwaveBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "wave", ALCwaveBackendFactory_getFactory }, #endif - - { NULL, NULL, NULL, NULL, NULL, EmptyFuncs } }; +static ALsizei BackendListSize = COUNTOF(BackendList); #undef EmptyFuncs static struct BackendInfo PlaybackBackend; @@ -116,18 +121,11 @@ static struct BackendInfo CaptureBackend; /************************************************ * Functions, enums, and errors ************************************************/ -typedef struct ALCfunction { +#define DECL(x) { #x, (ALCvoid*)(x) } +static const struct { const ALCchar *funcName; ALCvoid *address; -} ALCfunction; - -typedef struct ALCenums { - const ALCchar *enumName; - ALCenum value; -} ALCenums; - -#define DECL(x) { #x, (ALCvoid*)(x) } -static const ALCfunction alcFunctions[] = { +} alcFunctions[] = { DECL(alcCreateContext), DECL(alcMakeContextCurrent), DECL(alcProcessContext), @@ -288,16 +286,25 @@ static const ALCfunction alcFunctions[] = { DECL(alGetSource3i64SOFT), DECL(alGetSourcei64vSOFT), - DECL(alBufferSamplesSOFT), - DECL(alGetBufferSamplesSOFT), - DECL(alIsBufferFormatSupportedSOFT), + DECL(alGetStringiSOFT), - { NULL, NULL } + DECL(alBufferStorageSOFT), + DECL(alMapBufferSOFT), + DECL(alUnmapBufferSOFT), + DECL(alFlushMappedBufferSOFT), + + DECL(alEventControlSOFT), + DECL(alEventCallbackSOFT), + DECL(alGetPointerSOFT), + DECL(alGetPointervSOFT), }; #undef DECL #define DECL(x) { #x, (x) } -static const ALCenums enumeration[] = { +static const struct { + const ALCchar *enumName; + ALCenum value; +} alcEnumerations[] = { DECL(ALC_INVALID), DECL(ALC_FALSE), DECL(ALC_TRUE), @@ -334,6 +341,7 @@ static const ALCenums enumeration[] = { DECL(ALC_5POINT1_SOFT), DECL(ALC_6POINT1_SOFT), DECL(ALC_7POINT1_SOFT), + DECL(ALC_BFORMAT3D_SOFT), DECL(ALC_BYTE_SOFT), DECL(ALC_UNSIGNED_BYTE_SOFT), @@ -356,6 +364,16 @@ static const ALCenums enumeration[] = { DECL(ALC_HRTF_SPECIFIER_SOFT), DECL(ALC_HRTF_ID_SOFT), + DECL(ALC_AMBISONIC_LAYOUT_SOFT), + DECL(ALC_AMBISONIC_SCALING_SOFT), + DECL(ALC_AMBISONIC_ORDER_SOFT), + DECL(ALC_ACN_SOFT), + DECL(ALC_FUMA_SOFT), + DECL(ALC_N3D_SOFT), + DECL(ALC_SN3D_SOFT), + + DECL(ALC_OUTPUT_LIMITER_SOFT), + DECL(ALC_NO_ERROR), DECL(ALC_INVALID_DEVICE), DECL(ALC_INVALID_CONTEXT), @@ -465,64 +483,10 @@ static const ALCenums enumeration[] = { DECL(AL_FORMAT_BFORMAT3D_FLOAT32), DECL(AL_FORMAT_BFORMAT3D_MULAW), - DECL(AL_MONO8_SOFT), - DECL(AL_MONO16_SOFT), - DECL(AL_MONO32F_SOFT), - DECL(AL_STEREO8_SOFT), - DECL(AL_STEREO16_SOFT), - DECL(AL_STEREO32F_SOFT), - DECL(AL_QUAD8_SOFT), - DECL(AL_QUAD16_SOFT), - DECL(AL_QUAD32F_SOFT), - DECL(AL_REAR8_SOFT), - DECL(AL_REAR16_SOFT), - DECL(AL_REAR32F_SOFT), - DECL(AL_5POINT1_8_SOFT), - DECL(AL_5POINT1_16_SOFT), - DECL(AL_5POINT1_32F_SOFT), - DECL(AL_6POINT1_8_SOFT), - DECL(AL_6POINT1_16_SOFT), - DECL(AL_6POINT1_32F_SOFT), - DECL(AL_7POINT1_8_SOFT), - DECL(AL_7POINT1_16_SOFT), - DECL(AL_7POINT1_32F_SOFT), - DECL(AL_BFORMAT2D_8_SOFT), - DECL(AL_BFORMAT2D_16_SOFT), - DECL(AL_BFORMAT2D_32F_SOFT), - DECL(AL_BFORMAT3D_8_SOFT), - DECL(AL_BFORMAT3D_16_SOFT), - DECL(AL_BFORMAT3D_32F_SOFT), - - DECL(AL_MONO_SOFT), - DECL(AL_STEREO_SOFT), - DECL(AL_QUAD_SOFT), - DECL(AL_REAR_SOFT), - DECL(AL_5POINT1_SOFT), - DECL(AL_6POINT1_SOFT), - DECL(AL_7POINT1_SOFT), - DECL(AL_BFORMAT2D_SOFT), - DECL(AL_BFORMAT3D_SOFT), - - DECL(AL_BYTE_SOFT), - DECL(AL_UNSIGNED_BYTE_SOFT), - DECL(AL_SHORT_SOFT), - DECL(AL_UNSIGNED_SHORT_SOFT), - DECL(AL_INT_SOFT), - DECL(AL_UNSIGNED_INT_SOFT), - DECL(AL_FLOAT_SOFT), - DECL(AL_DOUBLE_SOFT), - DECL(AL_BYTE3_SOFT), - DECL(AL_UNSIGNED_BYTE3_SOFT), - DECL(AL_MULAW_SOFT), - DECL(AL_FREQUENCY), DECL(AL_BITS), DECL(AL_CHANNELS), DECL(AL_SIZE), - DECL(AL_INTERNAL_FORMAT_SOFT), - DECL(AL_BYTE_LENGTH_SOFT), - DECL(AL_SAMPLE_LENGTH_SOFT), - DECL(AL_SEC_LENGTH_SOFT), DECL(AL_UNPACK_BLOCK_ALIGNMENT_SOFT), DECL(AL_PACK_BLOCK_ALIGNMENT_SOFT), @@ -585,10 +549,10 @@ static const ALCenums enumeration[] = { DECL(AL_EFFECT_DISTORTION), DECL(AL_EFFECT_ECHO), DECL(AL_EFFECT_FLANGER), + DECL(AL_EFFECT_PITCH_SHIFTER), #if 0 DECL(AL_EFFECT_FREQUENCY_SHIFTER), DECL(AL_EFFECT_VOCAL_MORPHER), - DECL(AL_EFFECT_PITCH_SHIFTER), #endif DECL(AL_EFFECT_RING_MODULATOR), #if 0 @@ -599,6 +563,11 @@ static const ALCenums enumeration[] = { DECL(AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT), DECL(AL_EFFECT_DEDICATED_DIALOGUE), + DECL(AL_EFFECTSLOT_EFFECT), + DECL(AL_EFFECTSLOT_GAIN), + DECL(AL_EFFECTSLOT_AUXILIARY_SEND_AUTO), + DECL(AL_EFFECTSLOT_NULL), + DECL(AL_EAXREVERB_DENSITY), DECL(AL_EAXREVERB_DIFFUSION), DECL(AL_EAXREVERB_GAIN), @@ -667,6 +636,9 @@ static const ALCenums enumeration[] = { DECL(AL_RING_MODULATOR_HIGHPASS_CUTOFF), DECL(AL_RING_MODULATOR_WAVEFORM), + DECL(AL_PITCH_SHIFTER_COARSE_TUNE), + DECL(AL_PITCH_SHIFTER_FINE_TUNE), + DECL(AL_COMPRESSOR_ONOFF), DECL(AL_EQUALIZER_LOW_GAIN), @@ -682,7 +654,26 @@ static const ALCenums enumeration[] = { DECL(AL_DEDICATED_GAIN), - { NULL, (ALCenum)0 } + DECL(AL_NUM_RESAMPLERS_SOFT), + DECL(AL_DEFAULT_RESAMPLER_SOFT), + DECL(AL_SOURCE_RESAMPLER_SOFT), + DECL(AL_RESAMPLER_NAME_SOFT), + + DECL(AL_SOURCE_SPATIALIZE_SOFT), + DECL(AL_AUTO_SOFT), + + DECL(AL_MAP_READ_BIT_SOFT), + DECL(AL_MAP_WRITE_BIT_SOFT), + DECL(AL_MAP_PERSISTENT_BIT_SOFT), + DECL(AL_PRESERVE_DATA_BIT_SOFT), + + DECL(AL_EVENT_CALLBACK_FUNCTION_SOFT), + DECL(AL_EVENT_CALLBACK_USER_PARAM_SOFT), + DECL(AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT), + DECL(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT), + DECL(AL_EVENT_TYPE_ERROR_SOFT), + DECL(AL_EVENT_TYPE_PERFORMANCE_SOFT), + DECL(AL_EVENT_TYPE_DEPRECATED_SOFT), }; #undef DECL @@ -710,13 +701,34 @@ static ALCchar *alcCaptureDefaultDeviceSpecifier; /* Default context extensions */ static const ALchar alExtList[] = - "AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE " - "AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS " - "AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET " - "AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES " - "AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_deferred_updates " - "AL_SOFT_direct_channels AL_SOFT_gain_clamp_ex AL_SOFT_loop_points " - "AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length"; + "AL_EXT_ALAW " + "AL_EXT_BFORMAT " + "AL_EXT_DOUBLE " + "AL_EXT_EXPONENT_DISTANCE " + "AL_EXT_FLOAT32 " + "AL_EXT_IMA4 " + "AL_EXT_LINEAR_DISTANCE " + "AL_EXT_MCFORMATS " + "AL_EXT_MULAW " + "AL_EXT_MULAW_BFORMAT " + "AL_EXT_MULAW_MCFORMATS " + "AL_EXT_OFFSET " + "AL_EXT_source_distance_model " + "AL_EXT_SOURCE_RADIUS " + "AL_EXT_STEREO_ANGLES " + "AL_LOKI_quadriphonic " + "AL_SOFT_block_alignment " + "AL_SOFT_deferred_updates " + "AL_SOFT_direct_channels " + "AL_SOFTX_events " + "AL_SOFT_gain_clamp_ex " + "AL_SOFT_loop_points " + "AL_SOFTX_map_buffer " + "AL_SOFT_MSADPCM " + "AL_SOFT_source_latency " + "AL_SOFT_source_length " + "AL_SOFT_source_resampler " + "AL_SOFT_source_spatialize"; static ATOMIC(ALCenum) LastNullDeviceError = ATOMIC_INIT_STATIC(ALC_NO_ERROR); @@ -759,8 +771,8 @@ static const ALCchar alcNoDeviceExtList[] = static const ALCchar alcExtensionList[] = "ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE " "ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX " - "ALC_EXT_thread_local_context ALC_SOFTX_device_clock ALC_SOFT_HRTF " - "ALC_SOFT_loopback ALC_SOFT_pause_device"; + "ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF " + "ALC_SOFT_loopback ALC_SOFT_output_limiter ALC_SOFT_pause_device"; static const ALCint alcMajorVersion = 1; static const ALCint alcMinorVersion = 1; @@ -806,6 +818,7 @@ BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD reason, LPVOID lpReserved) break; case DLL_THREAD_DETACH: + althrd_thread_detach(); break; case DLL_PROCESS_DETACH: @@ -868,19 +881,21 @@ static void alc_init(void) if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) ZScale *= -1.0f; + str = getenv("__ALSOFT_REVERB_IGNORES_SOUND_SPEED"); + if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) + OverrideReverbSpeedOfSound = AL_TRUE; + ret = altss_create(&LocalContext, ReleaseThreadCtx); assert(ret == althrd_success); ret = almtx_init(&ListLock, almtx_recursive); assert(ret == althrd_success); - - ThunkInit(); } static void alc_initconfig(void) { const char *devs, *str; - ALuint capfilter; + int capfilter; float valf; int i, n; @@ -900,10 +915,15 @@ static void alc_initconfig(void) else ERR("Failed to open log file '%s'\n", str); } + TRACE("Initializing library v%s-%s %s\n", ALSOFT_VERSION, + ALSOFT_GIT_COMMIT_HASH, ALSOFT_GIT_BRANCH); { char buf[1024] = ""; - int len = snprintf(buf, sizeof(buf), "%s", BackendList[0].name); - for(i = 1;BackendList[i].name;i++) + int len = 0; + + if(BackendListSize > 0) + len += snprintf(buf, sizeof(buf), "%s", BackendList[0].name); + for(i = 1;i < BackendListSize;i++) len += snprintf(buf+len, sizeof(buf)-len, ", %s", BackendList[i].name); TRACE("Supported backends: %s\n", buf); } @@ -979,6 +999,7 @@ static void alc_initconfig(void) #endif ConfigValueInt(NULL, NULL, "rt-prio", &RTPrioLevel); + aluInit(); aluInitMixer(); str = getenv("ALSOFT_TRAP_ERROR"); @@ -1003,8 +1024,6 @@ static void alc_initconfig(void) if(ConfigValueFloat(NULL, "reverb", "boost", &valf)) ReverbBoost *= powf(10.0f, valf / 20.0f); - EmulateEAXReverb = GetConfigValueBool(NULL, "reverb", "emulate-eax", AL_FALSE); - if(((devs=getenv("ALSOFT_DRIVERS")) && devs[0]) || ConfigValueStr(NULL, NULL, "drivers", &devs)) { @@ -1033,26 +1052,32 @@ static void alc_initconfig(void) len = (next ? ((size_t)(next-devs)) : strlen(devs)); while(len > 0 && isspace(devs[len-1])) len--; - for(n = i;BackendList[n].name;n++) +#ifdef HAVE_WASAPI + /* HACK: For backwards compatibility, convert backend references of + * mmdevapi to wasapi. This should eventually be removed. + */ + if(len == 8 && strncmp(devs, "mmdevapi", len) == 0) + { + devs = "wasapi"; + len = 6; + } +#endif + for(n = i;n < BackendListSize;n++) { if(len == strlen(BackendList[n].name) && strncmp(BackendList[n].name, devs, len) == 0) { if(delitem) { - do { + for(;n+1 < BackendListSize;n++) BackendList[n] = BackendList[n+1]; - ++n; - } while(BackendList[n].name); + BackendListSize--; } else { struct BackendInfo Bkp = BackendList[n]; - while(n > i) - { + for(;n > i;n--) BackendList[n] = BackendList[n-1]; - --n; - } BackendList[n] = Bkp; i++; @@ -1063,59 +1088,36 @@ static void alc_initconfig(void) } while(next++); if(endlist) - { - BackendList[i].name = NULL; - BackendList[i].getFactory = NULL; - BackendList[i].Init = NULL; - BackendList[i].Deinit = NULL; - BackendList[i].Probe = NULL; - } + BackendListSize = i; } - for(i = 0;(BackendList[i].Init || BackendList[i].getFactory) && (!PlaybackBackend.name || !CaptureBackend.name);i++) + for(n = i = 0;i < BackendListSize && (!PlaybackBackend.name || !CaptureBackend.name);i++) { - if(BackendList[i].getFactory) + ALCbackendFactory *factory; + BackendList[n] = BackendList[i]; + + factory = BackendList[n].getFactory(); + if(!V0(factory,init)()) { - ALCbackendFactory *factory = BackendList[i].getFactory(); - if(!V0(factory,init)()) - { - WARN("Failed to initialize backend \"%s\"\n", BackendList[i].name); - continue; - } - - TRACE("Initialized backend \"%s\"\n", BackendList[i].name); - if(!PlaybackBackend.name && V(factory,querySupport)(ALCbackend_Playback)) - { - PlaybackBackend = BackendList[i]; - TRACE("Added \"%s\" for playback\n", PlaybackBackend.name); - } - if(!CaptureBackend.name && V(factory,querySupport)(ALCbackend_Capture)) - { - CaptureBackend = BackendList[i]; - TRACE("Added \"%s\" for capture\n", CaptureBackend.name); - } - + WARN("Failed to initialize backend \"%s\"\n", BackendList[n].name); continue; } - if(!BackendList[i].Init(&BackendList[i].Funcs)) + TRACE("Initialized backend \"%s\"\n", BackendList[n].name); + if(!PlaybackBackend.name && V(factory,querySupport)(ALCbackend_Playback)) { - WARN("Failed to initialize backend \"%s\"\n", BackendList[i].name); - continue; - } - - TRACE("Initialized backend \"%s\"\n", BackendList[i].name); - if(BackendList[i].Funcs.OpenPlayback && !PlaybackBackend.name) - { - PlaybackBackend = BackendList[i]; + PlaybackBackend = BackendList[n]; TRACE("Added \"%s\" for playback\n", PlaybackBackend.name); } - if(BackendList[i].Funcs.OpenCapture && !CaptureBackend.name) + if(!CaptureBackend.name && V(factory,querySupport)(ALCbackend_Capture)) { - CaptureBackend = BackendList[i]; + CaptureBackend = BackendList[n]; TRACE("Added \"%s\" for capture\n", CaptureBackend.name); } + n++; } + BackendListSize = n; + { ALCbackendFactory *factory = ALCloopbackFactory_getFactory(); V0(factory,init)(); @@ -1139,7 +1141,7 @@ static void alc_initconfig(void) continue; len = (next ? ((size_t)(next-str)) : strlen(str)); - for(n = 0;EffectList[n].name;n++) + for(n = 0;n < EFFECTLIST_SIZE;n++) { if(len == strlen(EffectList[n].name) && strncmp(EffectList[n].name, str, len) == 0) @@ -1148,8 +1150,6 @@ static void alc_initconfig(void) } while(next++); } - InitEffectFactoryMap(); - InitEffect(&DefaultEffect); str = getenv("ALSOFT_DEFAULT_REVERB"); if((str && str[0]) || ConfigValueStr(NULL, NULL, "default-reverb", &str)) @@ -1157,6 +1157,75 @@ static void alc_initconfig(void) } #define DO_INITCONFIG() alcall_once(&alc_config_once, alc_initconfig) +#ifdef __ANDROID__ +#include + +static JavaVM *gJavaVM; +static pthread_key_t gJVMThreadKey; + +static void CleanupJNIEnv(void* UNUSED(ptr)) +{ + JCALL0(gJavaVM,DetachCurrentThread)(); +} + +void *Android_GetJNIEnv(void) +{ + if(!gJavaVM) + { + WARN("gJavaVM is NULL!\n"); + return NULL; + } + + /* http://developer.android.com/guide/practices/jni.html + * + * All threads are Linux threads, scheduled by the kernel. They're usually + * started from managed code (using Thread.start), but they can also be + * created elsewhere and then attached to the JavaVM. For example, a thread + * started with pthread_create can be attached with the JNI + * AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a + * thread is attached, it has no JNIEnv, and cannot make JNI calls. + * Attaching a natively-created thread causes a java.lang.Thread object to + * be constructed and added to the "main" ThreadGroup, making it visible to + * the debugger. Calling AttachCurrentThread on an already-attached thread + * is a no-op. + */ + JNIEnv *env = pthread_getspecific(gJVMThreadKey); + if(!env) + { + int status = JCALL(gJavaVM,AttachCurrentThread)(&env, NULL); + if(status < 0) + { + ERR("Failed to attach current thread\n"); + return NULL; + } + pthread_setspecific(gJVMThreadKey, env); + } + return env; +} + +/* Automatically called by JNI. */ +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void* UNUSED(reserved)) +{ + void *env; + int err; + + gJavaVM = jvm; + if(JCALL(gJavaVM,GetEnv)(&env, JNI_VERSION_1_4) != JNI_OK) + { + ERR("Failed to get JNIEnv with JNI_VERSION_1_4\n"); + return JNI_ERR; + } + + /* Create gJVMThreadKey so we can keep track of the JNIEnv assigned to each + * thread. The JNIEnv *must* be detached before the thread is destroyed. + */ + if((err=pthread_key_create(&gJVMThreadKey, CleanupJNIEnv)) != 0) + ERR("pthread_key_create failed: %d\n", err); + pthread_setspecific(gJVMThreadKey, env); + return JNI_VERSION_1_4; +} +#endif + /************************************************ * Library deinitialization @@ -1173,16 +1242,15 @@ static void alc_cleanup(void) free(alcCaptureDefaultDeviceSpecifier); alcCaptureDefaultDeviceSpecifier = NULL; - if((dev=ATOMIC_EXCHANGE(ALCdevice*, &DeviceList, NULL)) != NULL) + if((dev=ATOMIC_EXCHANGE_PTR_SEQ(&DeviceList, NULL)) != NULL) { ALCuint num = 0; do { num++; - } while((dev=dev->next) != NULL); + dev = ATOMIC_LOAD(&dev->next, almemory_order_relaxed); + } while(dev != NULL); ERR("%u device%s not closed\n", num, (num>1)?"s":""); } - - DeinitEffectFactoryMap(); } static void alc_deinit_safe(void) @@ -1192,13 +1260,14 @@ static void alc_deinit_safe(void) FreeHrtfs(); FreeALConfig(); - ThunkExit(); almtx_destroy(&ListLock); altss_delete(LocalContext); if(LogFile != stderr) fclose(LogFile); LogFile = NULL; + + althrd_deinit(); } static void alc_deinit(void) @@ -1210,15 +1279,10 @@ static void alc_deinit(void) memset(&PlaybackBackend, 0, sizeof(PlaybackBackend)); memset(&CaptureBackend, 0, sizeof(CaptureBackend)); - for(i = 0;BackendList[i].Deinit || BackendList[i].getFactory;i++) + for(i = 0;i < BackendListSize;i++) { - if(!BackendList[i].getFactory) - BackendList[i].Deinit(); - else - { - ALCbackendFactory *factory = BackendList[i].getFactory(); - V0(factory,deinit)(); - } + ALCbackendFactory *factory = BackendList[i].getFactory(); + V0(factory,deinit)(); } { ALCbackendFactory *factory = ALCloopbackFactory_getFactory(); @@ -1237,11 +1301,9 @@ static void ProbeDevices(al_string *list, struct BackendInfo *backendinfo, enum DO_INITCONFIG(); LockLists(); - al_string_clear(list); + alstr_clear(list); - if(backendinfo->Probe) - backendinfo->Probe(type); - else if(backendinfo->getFactory) + if(backendinfo->getFactory) { ALCbackendFactory *factory = backendinfo->getFactory(); V(factory,probe)(type); @@ -1258,7 +1320,7 @@ static void AppendDevice(const ALCchar *name, al_string *devnames) { size_t len = strlen(name); if(len > 0) - al_string_append_range(devnames, name, name+len+1); + alstr_append_range(devnames, name, name+len+1); } void AppendAllDevicesList(const ALCchar *name) { AppendDevice(name, &alcAllDevicesList); } @@ -1294,15 +1356,13 @@ const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans) case DevFmtX51Rear: return "5.1 Surround (Rear)"; case DevFmtX61: return "6.1 Surround"; case DevFmtX71: return "7.1 Surround"; - case DevFmtAmbi1: return "Ambisonic (1st Order)"; - case DevFmtAmbi2: return "Ambisonic (2nd Order)"; - case DevFmtAmbi3: return "Ambisonic (3rd Order)"; + case DevFmtAmbi3D: return "Ambisonic 3D"; } return "(unknown channels)"; } -extern inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type); -ALuint BytesFromDevFmt(enum DevFmtType type) +extern inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder); +ALsizei BytesFromDevFmt(enum DevFmtType type) { switch(type) { @@ -1316,7 +1376,7 @@ ALuint BytesFromDevFmt(enum DevFmtType type) } return 0; } -ALuint ChannelsFromDevFmt(enum DevFmtChannels chans) +ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder) { switch(chans) { @@ -1327,9 +1387,9 @@ ALuint ChannelsFromDevFmt(enum DevFmtChannels chans) case DevFmtX51Rear: return 6; case DevFmtX61: return 7; case DevFmtX71: return 8; - case DevFmtAmbi1: return 4; - case DevFmtAmbi2: return 9; - case DevFmtAmbi3: return 16; + case DevFmtAmbi3D: return (ambiorder >= 3) ? 16 : + (ambiorder == 2) ? 9 : + (ambiorder == 1) ? 4 : 1; } return 0; } @@ -1407,37 +1467,46 @@ static ALCboolean IsValidALCChannels(ALCenum channels) case ALC_5POINT1_SOFT: case ALC_6POINT1_SOFT: case ALC_7POINT1_SOFT: + case ALC_BFORMAT3D_SOFT: return ALC_TRUE; } return ALC_FALSE; } +static ALCboolean IsValidAmbiLayout(ALCenum layout) +{ + switch(layout) + { + case ALC_ACN_SOFT: + case ALC_FUMA_SOFT: + return ALC_TRUE; + } + return ALC_FALSE; +} + +static ALCboolean IsValidAmbiScaling(ALCenum scaling) +{ + switch(scaling) + { + case ALC_N3D_SOFT: + case ALC_SN3D_SOFT: + case ALC_FUMA_SOFT: + return ALC_TRUE; + } + return ALC_FALSE; +} /************************************************ * Miscellaneous ALC helpers ************************************************/ -extern inline void LockContext(ALCcontext *context); -extern inline void UnlockContext(ALCcontext *context); - -void ALCdevice_Lock(ALCdevice *device) -{ - V0(device->Backend,lock)(); -} - -void ALCdevice_Unlock(ALCdevice *device) -{ - V0(device->Backend,unlock)(); -} - - /* SetDefaultWFXChannelOrder * * Sets the default channel order used by WaveFormatEx. */ void SetDefaultWFXChannelOrder(ALCdevice *device) { - ALuint i; + ALsizei i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) device->RealOut.ChannelName[i] = InvalidChannel; @@ -1492,40 +1561,32 @@ void SetDefaultWFXChannelOrder(ALCdevice *device) device->RealOut.ChannelName[6] = SideLeft; device->RealOut.ChannelName[7] = SideRight; break; - case DevFmtAmbi1: + case DevFmtAmbi3D: device->RealOut.ChannelName[0] = Aux0; - device->RealOut.ChannelName[1] = Aux1; - device->RealOut.ChannelName[2] = Aux2; - device->RealOut.ChannelName[3] = Aux3; - break; - case DevFmtAmbi2: - device->RealOut.ChannelName[0] = Aux0; - device->RealOut.ChannelName[1] = Aux1; - device->RealOut.ChannelName[2] = Aux2; - device->RealOut.ChannelName[3] = Aux3; - device->RealOut.ChannelName[4] = Aux4; - device->RealOut.ChannelName[5] = Aux5; - device->RealOut.ChannelName[6] = Aux6; - device->RealOut.ChannelName[7] = Aux7; - device->RealOut.ChannelName[8] = Aux8; - break; - case DevFmtAmbi3: - device->RealOut.ChannelName[0] = Aux0; - device->RealOut.ChannelName[1] = Aux1; - device->RealOut.ChannelName[2] = Aux2; - device->RealOut.ChannelName[3] = Aux3; - device->RealOut.ChannelName[4] = Aux4; - device->RealOut.ChannelName[5] = Aux5; - device->RealOut.ChannelName[6] = Aux6; - device->RealOut.ChannelName[7] = Aux7; - device->RealOut.ChannelName[8] = Aux8; - device->RealOut.ChannelName[9] = Aux9; - device->RealOut.ChannelName[10] = Aux10; - device->RealOut.ChannelName[11] = Aux11; - device->RealOut.ChannelName[12] = Aux12; - device->RealOut.ChannelName[13] = Aux13; - device->RealOut.ChannelName[14] = Aux14; - device->RealOut.ChannelName[15] = Aux15; + if(device->AmbiOrder > 0) + { + device->RealOut.ChannelName[1] = Aux1; + device->RealOut.ChannelName[2] = Aux2; + device->RealOut.ChannelName[3] = Aux3; + } + if(device->AmbiOrder > 1) + { + device->RealOut.ChannelName[4] = Aux4; + device->RealOut.ChannelName[5] = Aux5; + device->RealOut.ChannelName[6] = Aux6; + device->RealOut.ChannelName[7] = Aux7; + device->RealOut.ChannelName[8] = Aux8; + } + if(device->AmbiOrder > 2) + { + device->RealOut.ChannelName[9] = Aux9; + device->RealOut.ChannelName[10] = Aux10; + device->RealOut.ChannelName[11] = Aux11; + device->RealOut.ChannelName[12] = Aux12; + device->RealOut.ChannelName[13] = Aux13; + device->RealOut.ChannelName[14] = Aux14; + device->RealOut.ChannelName[15] = Aux15; + } break; } } @@ -1536,7 +1597,7 @@ void SetDefaultWFXChannelOrder(ALCdevice *device) */ void SetDefaultChannelOrder(ALCdevice *device) { - ALuint i; + ALsizei i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) device->RealOut.ChannelName[i] = InvalidChannel; @@ -1568,15 +1629,14 @@ void SetDefaultChannelOrder(ALCdevice *device) case DevFmtQuad: case DevFmtX51: case DevFmtX61: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: SetDefaultWFXChannelOrder(device); break; } } extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan); +extern inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan); /* ALCcontext_DeferUpdates @@ -1585,9 +1645,9 @@ extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS * does *NOT* stop mixing, but rather prevents certain property changes from * taking effect. */ -void ALCcontext_DeferUpdates(ALCcontext *context, ALenum type) +void ALCcontext_DeferUpdates(ALCcontext *context) { - ATOMIC_STORE(&context->DeferUpdates, type); + ATOMIC_STORE_SEQ(&context->DeferUpdates, AL_TRUE); } /* ALCcontext_ProcessUpdates @@ -1596,55 +1656,29 @@ void ALCcontext_DeferUpdates(ALCcontext *context, ALenum type) */ void ALCcontext_ProcessUpdates(ALCcontext *context) { - ALCdevice *device = context->Device; - - ReadLock(&context->PropLock); - if(ATOMIC_EXCHANGE(ALenum, &context->DeferUpdates, AL_FALSE)) + almtx_lock(&context->PropLock); + if(ATOMIC_EXCHANGE_SEQ(&context->DeferUpdates, AL_FALSE)) { - ALsizei pos; - uint updates; - /* Tell the mixer to stop applying updates, then wait for any active * updating to finish, before providing updates. */ - ATOMIC_STORE(&context->HoldUpdates, AL_TRUE); - while(((updates=ReadRef(&context->UpdateCount))&1) != 0) + ATOMIC_STORE_SEQ(&context->HoldUpdates, AL_TRUE); + while((ATOMIC_LOAD(&context->UpdateCount, almemory_order_acquire)&1) != 0) althrd_yield(); - UpdateListenerProps(context); + if(!ATOMIC_FLAG_TEST_AND_SET(&context->PropsClean, almemory_order_acq_rel)) + UpdateContextProps(context); + if(!ATOMIC_FLAG_TEST_AND_SET(&context->Listener->PropsClean, almemory_order_acq_rel)) + UpdateListenerProps(context); UpdateAllEffectSlotProps(context); - - LockUIntMapRead(&context->SourceMap); - V0(device->Backend,lock)(); - for(pos = 0;pos < context->SourceMap.size;pos++) - { - ALsource *Source = context->SourceMap.values[pos]; - ALenum new_state; - - if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) && - Source->OffsetType != AL_NONE) - { - WriteLock(&Source->queue_lock); - ApplyOffset(Source); - WriteUnlock(&Source->queue_lock); - } - - new_state = Source->new_state; - Source->new_state = AL_NONE; - if(new_state) - SetSourceState(Source, context, new_state); - } - V0(device->Backend,unlock)(); - UnlockUIntMapRead(&context->SourceMap); - UpdateAllSourceProps(context); /* Now with all updates declared, let the mixer continue applying them * so they all happen at once. */ - ATOMIC_STORE(&context->HoldUpdates, AL_FALSE); + ATOMIC_STORE_SEQ(&context->HoldUpdates, AL_FALSE); } - ReadUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); } @@ -1654,6 +1688,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) */ static void alcSetError(ALCdevice *device, ALCenum errorCode) { + WARN("Error generated on device %p, code 0x%04x\n", device, errorCode); if(TrapALCError) { #ifdef _WIN32 @@ -1666,22 +1701,31 @@ static void alcSetError(ALCdevice *device, ALCenum errorCode) } if(device) - ATOMIC_STORE(&device->LastError, errorCode); + ATOMIC_STORE_SEQ(&device->LastError, errorCode); else - ATOMIC_STORE(&LastNullDeviceError, errorCode); + ATOMIC_STORE_SEQ(&LastNullDeviceError, errorCode); } +struct Compressor *CreateDeviceLimiter(const ALCdevice *device) +{ + return CompressorInit(0.0f, 0.0f, AL_FALSE, AL_TRUE, 0.0f, 0.0f, 0.5f, 2.0f, + 0.0f, -3.0f, 3.0f, device->Frequency); +} + /* UpdateClockBase * * Updates the device's base clock time with however many samples have been * done. This is used so frequency changes on the device don't cause the time - * to jump forward or back. + * to jump forward or back. Must not be called while the device is running/ + * mixing. */ static inline void UpdateClockBase(ALCdevice *device) { + IncrementRef(&device->MixCount); device->ClockBase += device->SamplesDone * DEVICE_CLOCK_RES / device->Frequency; device->SamplesDone = 0; + IncrementRef(&device->MixCount); } /* UpdateDeviceParams @@ -1691,30 +1735,32 @@ static inline void UpdateClockBase(ALCdevice *device) */ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { - ALCcontext *context; - enum HrtfRequestMode hrtf_appreq = Hrtf_Default; enum HrtfRequestMode hrtf_userreq = Hrtf_Default; + enum HrtfRequestMode hrtf_appreq = Hrtf_Default; + ALCenum gainLimiter = device->Limiter ? ALC_TRUE : ALC_FALSE; + const ALsizei old_sends = device->NumAuxSends; + ALsizei new_sends = device->NumAuxSends; enum DevFmtChannels oldChans; enum DevFmtType oldType; - ALCuint oldFreq; - FPUCtl oldMode; + ALboolean update_failed; ALCsizei hrtf_id = -1; + ALCcontext *context; + ALCuint oldFreq; size_t size; + ALCsizei i; + int val; // Check for attributes if(device->Type == Loopback) { - enum { - GotFreq = 1<<0, - GotChans = 1<<1, - GotType = 1<<2, - GotAll = GotFreq|GotChans|GotType - }; - ALCuint freq, numMono, numStereo, numSends; - enum DevFmtChannels schans; - enum DevFmtType stype; - ALCuint attrIdx = 0; - ALCint gotFmt = 0; + ALCsizei numMono, numStereo, numSends; + ALCenum alayout = AL_NONE; + ALCenum ascale = AL_NONE; + ALCenum schans = AL_NONE; + ALCenum stype = AL_NONE; + ALCsizei attrIdx = 0; + ALCsizei aorder = 0; + ALCuint freq = 0; if(!attrList) { @@ -1724,88 +1770,113 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) numMono = device->NumMonoSources; numStereo = device->NumStereoSources; - numSends = device->NumAuxSends; - schans = device->FmtChans; - stype = device->FmtType; - freq = device->Frequency; + numSends = old_sends; #define TRACE_ATTR(a, v) TRACE("Loopback %s = %d\n", #a, v) while(attrList[attrIdx]) { - if(attrList[attrIdx] == ALC_FORMAT_CHANNELS_SOFT) + switch(attrList[attrIdx]) { - ALCint val = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_FORMAT_CHANNELS_SOFT, val); - if(!IsValidALCChannels(val) || !ChannelsFromDevFmt(val)) - return ALC_INVALID_VALUE; - schans = val; - gotFmt |= GotChans; - } + case ALC_FORMAT_CHANNELS_SOFT: + schans = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FORMAT_CHANNELS_SOFT, schans); + if(!IsValidALCChannels(schans)) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_FORMAT_TYPE_SOFT) - { - ALCint val = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_FORMAT_TYPE_SOFT, val); - if(!IsValidALCType(val) || !BytesFromDevFmt(val)) - return ALC_INVALID_VALUE; - stype = val; - gotFmt |= GotType; - } + case ALC_FORMAT_TYPE_SOFT: + stype = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FORMAT_TYPE_SOFT, stype); + if(!IsValidALCType(stype)) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_FREQUENCY) - { - freq = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_FREQUENCY, freq); - if(freq < MIN_OUTPUT_RATE) - return ALC_INVALID_VALUE; - gotFmt |= GotFreq; - } + case ALC_FREQUENCY: + freq = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FREQUENCY, freq); + if(freq < MIN_OUTPUT_RATE) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_STEREO_SOURCES) - { - numStereo = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); - if(numStereo > device->SourcesMax) - numStereo = device->SourcesMax; + case ALC_AMBISONIC_LAYOUT_SOFT: + alayout = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_AMBISONIC_LAYOUT_SOFT, alayout); + if(!IsValidAmbiLayout(alayout)) + return ALC_INVALID_VALUE; + break; - numMono = device->SourcesMax - numStereo; - } + case ALC_AMBISONIC_SCALING_SOFT: + ascale = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_AMBISONIC_SCALING_SOFT, ascale); + if(!IsValidAmbiScaling(ascale)) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS) - { - numSends = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); - } + case ALC_AMBISONIC_ORDER_SOFT: + aorder = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_AMBISONIC_ORDER_SOFT, aorder); + if(aorder < 1 || aorder > MAX_AMBI_ORDER) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_HRTF_SOFT) - { - TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); - if(attrList[attrIdx + 1] == ALC_FALSE) - hrtf_appreq = Hrtf_Disable; - else if(attrList[attrIdx + 1] == ALC_TRUE) - hrtf_appreq = Hrtf_Enable; - else - hrtf_appreq = Hrtf_Default; - } + case ALC_MONO_SOURCES: + numMono = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MONO_SOURCES, numMono); + numMono = maxi(numMono, 0); + break; - if(attrList[attrIdx] == ALC_HRTF_ID_SOFT) - { - hrtf_id = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + case ALC_STEREO_SOURCES: + numStereo = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); + numStereo = maxi(numStereo, 0); + break; + + case ALC_MAX_AUXILIARY_SENDS: + numSends = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); + numSends = clampi(numSends, 0, MAX_SENDS); + break; + + case ALC_HRTF_SOFT: + TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); + if(attrList[attrIdx + 1] == ALC_FALSE) + hrtf_appreq = Hrtf_Disable; + else if(attrList[attrIdx + 1] == ALC_TRUE) + hrtf_appreq = Hrtf_Enable; + else + hrtf_appreq = Hrtf_Default; + break; + + case ALC_HRTF_ID_SOFT: + hrtf_id = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + break; + + case ALC_OUTPUT_LIMITER_SOFT: + gainLimiter = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_OUTPUT_LIMITER_SOFT, gainLimiter); + break; + + default: + TRACE("Loopback 0x%04X = %d (0x%x)\n", attrList[attrIdx], + attrList[attrIdx + 1], attrList[attrIdx + 1]); + break; } attrIdx += 2; } #undef TRACE_ATTR - if(gotFmt != GotAll) + if(!schans || !stype || !freq) { WARN("Missing format for loopback device\n"); return ALC_INVALID_VALUE; } - - ConfigValueUInt(NULL, NULL, "sends", &numSends); - numSends = minu(MAX_SENDS, numSends); + if(schans == ALC_BFORMAT3D_SOFT && (!alayout || !ascale || !aorder)) + { + WARN("Missing ambisonic info for loopback device\n"); + return ALC_INVALID_VALUE; + } if((device->Flags&DEVICE_RUNNING)) V0(device->Backend,stop)(); @@ -1816,14 +1887,40 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->Frequency = freq; device->FmtChans = schans; device->FmtType = stype; + if(schans == ALC_BFORMAT3D_SOFT) + { + device->AmbiOrder = aorder; + device->AmbiLayout = alayout; + device->AmbiScale = ascale; + } + + if(numMono > INT_MAX-numStereo) + numMono = INT_MAX-numStereo; + numMono += numStereo; + if(ConfigValueInt(NULL, NULL, "sources", &numMono)) + { + if(numMono <= 0) + numMono = 256; + } + else + numMono = maxi(numMono, 256); + numStereo = mini(numStereo, numMono); + numMono -= numStereo; + device->SourcesMax = numMono + numStereo; + device->NumMonoSources = numMono; device->NumStereoSources = numStereo; - device->NumAuxSends = numSends; + + if(ConfigValueInt(NULL, NULL, "sends", &new_sends)) + new_sends = mini(numSends, clampi(new_sends, 0, MAX_SENDS)); + else + new_sends = numSends; } else if(attrList && attrList[0]) { - ALCuint freq, numMono, numStereo, numSends; - ALCuint attrIdx = 0; + ALCsizei numMono, numStereo, numSends; + ALCsizei attrIdx = 0; + ALCuint freq; /* If a context is already running on the device, stop playback so the * device attributes can be updated. */ @@ -1831,66 +1928,75 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) V0(device->Backend,stop)(); device->Flags &= ~DEVICE_RUNNING; + UpdateClockBase(device); + freq = device->Frequency; numMono = device->NumMonoSources; numStereo = device->NumStereoSources; - numSends = device->NumAuxSends; + numSends = old_sends; #define TRACE_ATTR(a, v) TRACE("%s = %d\n", #a, v) while(attrList[attrIdx]) { - if(attrList[attrIdx] == ALC_FREQUENCY) + switch(attrList[attrIdx]) { - freq = attrList[attrIdx + 1]; - device->Flags |= DEVICE_FREQUENCY_REQUEST; - TRACE_ATTR(ALC_FREQUENCY, freq); - } + case ALC_FREQUENCY: + freq = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FREQUENCY, freq); + device->Flags |= DEVICE_FREQUENCY_REQUEST; + break; - if(attrList[attrIdx] == ALC_STEREO_SOURCES) - { - numStereo = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); - if(numStereo > device->SourcesMax) - numStereo = device->SourcesMax; + case ALC_MONO_SOURCES: + numMono = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MONO_SOURCES, numMono); + numMono = maxi(numMono, 0); + break; - numMono = device->SourcesMax - numStereo; - } + case ALC_STEREO_SOURCES: + numStereo = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); + numStereo = maxi(numStereo, 0); + break; - if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS) - { - numSends = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); - } + case ALC_MAX_AUXILIARY_SENDS: + numSends = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); + numSends = clampi(numSends, 0, MAX_SENDS); + break; - if(attrList[attrIdx] == ALC_HRTF_SOFT) - { - TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); - if(attrList[attrIdx + 1] == ALC_FALSE) - hrtf_appreq = Hrtf_Disable; - else if(attrList[attrIdx + 1] == ALC_TRUE) - hrtf_appreq = Hrtf_Enable; - else - hrtf_appreq = Hrtf_Default; - } + case ALC_HRTF_SOFT: + TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); + if(attrList[attrIdx + 1] == ALC_FALSE) + hrtf_appreq = Hrtf_Disable; + else if(attrList[attrIdx + 1] == ALC_TRUE) + hrtf_appreq = Hrtf_Enable; + else + hrtf_appreq = Hrtf_Default; + break; - if(attrList[attrIdx] == ALC_HRTF_ID_SOFT) - { - hrtf_id = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + case ALC_HRTF_ID_SOFT: + hrtf_id = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + break; + + case ALC_OUTPUT_LIMITER_SOFT: + gainLimiter = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_OUTPUT_LIMITER_SOFT, gainLimiter); + break; + + default: + TRACE("0x%04X = %d (0x%x)\n", attrList[attrIdx], + attrList[attrIdx + 1], attrList[attrIdx + 1]); + break; } attrIdx += 2; } #undef TRACE_ATTR - ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "frequency", &freq); + ConfigValueUInt(alstr_get_cstr(device->DeviceName), NULL, "frequency", &freq); freq = maxu(freq, MIN_OUTPUT_RATE); - ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &numSends); - numSends = minu(MAX_SENDS, numSends); - - UpdateClockBase(device); - device->UpdateSize = (ALuint64)device->UpdateSize * freq / device->Frequency; /* SSE and Neon do best with the update size being a multiple of 4 */ @@ -1898,9 +2004,28 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->UpdateSize = (device->UpdateSize+3)&~3; device->Frequency = freq; + + if(numMono > INT_MAX-numStereo) + numMono = INT_MAX-numStereo; + numMono += numStereo; + if(ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "sources", &numMono)) + { + if(numMono <= 0) + numMono = 256; + } + else + numMono = maxi(numMono, 256); + numStereo = mini(numStereo, numMono); + numMono -= numStereo; + device->SourcesMax = numMono + numStereo; + device->NumMonoSources = numMono; device->NumStereoSources = numStereo; - device->NumAuxSends = numSends; + + if(ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "sends", &new_sends)) + new_sends = mini(numSends, clampi(new_sends, 0, MAX_SENDS)); + else + new_sends = numSends; } if((device->Flags&DEVICE_RUNNING)) @@ -1912,6 +2037,13 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) al_free(device->Bs2b); device->Bs2b = NULL; + al_free(device->ChannelDelay[0].Buffer); + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Length = 0; + device->ChannelDelay[i].Buffer = NULL; + } + al_free(device->Dry.Buffer); device->Dry.Buffer = NULL; device->Dry.NumChannels = 0; @@ -1922,14 +2054,16 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) UpdateClockBase(device); + device->DitherSeed = DITHER_RNG_SEED; + /************************************************************************* * Update device format request if HRTF is requested */ - device->Hrtf.Status = ALC_HRTF_DISABLED_SOFT; + device->HrtfStatus = ALC_HRTF_DISABLED_SOFT; if(device->Type != Loopback) { const char *hrtf; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "hrtf", &hrtf)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "hrtf", &hrtf)) { if(strcasecmp(hrtf, "true") == 0) hrtf_userreq = Hrtf_Enable; @@ -1941,58 +2075,37 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(hrtf_userreq == Hrtf_Enable || (hrtf_userreq != Hrtf_Disable && hrtf_appreq == Hrtf_Enable)) { - if(VECTOR_SIZE(device->Hrtf.List) == 0) + struct Hrtf *hrtf = NULL; + if(VECTOR_SIZE(device->HrtfList) == 0) { - VECTOR_DEINIT(device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); + VECTOR_DEINIT(device->HrtfList); + device->HrtfList = EnumerateHrtf(device->DeviceName); } - if(VECTOR_SIZE(device->Hrtf.List) > 0) + if(VECTOR_SIZE(device->HrtfList) > 0) + { + if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->HrtfList)) + hrtf = GetLoadedHrtf(VECTOR_ELEM(device->HrtfList, hrtf_id).hrtf); + else + hrtf = GetLoadedHrtf(VECTOR_ELEM(device->HrtfList, 0).hrtf); + } + + if(hrtf) { device->FmtChans = DevFmtStereo; - if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->Hrtf.List)) - device->Frequency = VECTOR_ELEM(device->Hrtf.List, hrtf_id).hrtf->sampleRate; - else - device->Frequency = VECTOR_ELEM(device->Hrtf.List, 0).hrtf->sampleRate; + device->Frequency = hrtf->sampleRate; device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_FREQUENCY_REQUEST; + if(device->HrtfHandle) + Hrtf_DecRef(device->HrtfHandle); + device->HrtfHandle = hrtf; } else { hrtf_userreq = Hrtf_Default; hrtf_appreq = Hrtf_Disable; - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; + device->HrtfStatus = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; } } } - else if(hrtf_appreq == Hrtf_Enable) - { - size_t i = VECTOR_SIZE(device->Hrtf.List); - /* Loopback device. We don't need to match to a specific HRTF entry - * here. If the requested ID matches, we'll pick that later, if not, - * we'll try to auto-select one anyway. Just make sure one exists - * that'll work. - */ - if(device->FmtChans == DevFmtStereo) - { - if(VECTOR_SIZE(device->Hrtf.List) == 0) - { - VECTOR_DEINIT(device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); - } - for(i = 0;i < VECTOR_SIZE(device->Hrtf.List);i++) - { - const struct Hrtf *hrtf = VECTOR_ELEM(device->Hrtf.List, i).hrtf; - if(hrtf->sampleRate == device->Frequency) - break; - } - } - if(i == VECTOR_SIZE(device->Hrtf.List)) - { - ERR("Requested format not HRTF compatible: %s, %uhz\n", - DevFmtChannelsString(device->FmtChans), device->Frequency); - hrtf_appreq = Hrtf_Disable; - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; - } - } oldFreq = device->Frequency; oldChans = device->FmtChans; @@ -2040,15 +2153,14 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ); aluInitRenderer(device, hrtf_id, hrtf_appreq, hrtf_userreq); + TRACE("Channel config, Dry: %d, FOA: %d, Real: %d\n", device->Dry.NumChannels, + device->FOAOut.NumChannels, device->RealOut.NumChannels); /* Allocate extra channels for any post-filter output. */ - size = device->Dry.NumChannels * sizeof(device->Dry.Buffer[0]); - if((device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2)) - size += (ChannelsFromDevFmt(device->FmtChans)+4) * sizeof(device->Dry.Buffer[0]); - else if(device->Hrtf.Handle || device->Uhj_Encoder || device->AmbiDecoder) - size += ChannelsFromDevFmt(device->FmtChans) * sizeof(device->Dry.Buffer[0]); - else if(device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3) - size += 4 * sizeof(device->Dry.Buffer[0]); + size = (device->Dry.NumChannels + device->FOAOut.NumChannels + + device->RealOut.NumChannels)*sizeof(device->Dry.Buffer[0]); + + TRACE("Allocating "SZFMT" channels, "SZFMT" bytes\n", size/sizeof(device->Dry.Buffer[0]), size); device->Dry.Buffer = al_calloc(16, size); if(!device->Dry.Buffer) { @@ -2056,100 +2168,214 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) return ALC_INVALID_DEVICE; } - if(device->Hrtf.Handle || device->Uhj_Encoder || device->AmbiDecoder) - { - device->RealOut.Buffer = device->Dry.Buffer + device->Dry.NumChannels; - device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans); - } + if(device->RealOut.NumChannels != 0) + device->RealOut.Buffer = device->Dry.Buffer + device->Dry.NumChannels + + device->FOAOut.NumChannels; else { device->RealOut.Buffer = device->Dry.Buffer; device->RealOut.NumChannels = device->Dry.NumChannels; } - if((device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2) || - (device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3)) - { - /* Higher-order rendering requires upsampling first-order content, so - * make sure to mix it separately. - */ - device->FOAOut.Buffer = device->RealOut.Buffer + device->RealOut.NumChannels; - device->FOAOut.NumChannels = 4; - } + if(device->FOAOut.NumChannels != 0) + device->FOAOut.Buffer = device->Dry.Buffer + device->Dry.NumChannels; else { device->FOAOut.Buffer = device->Dry.Buffer; device->FOAOut.NumChannels = device->Dry.NumChannels; } - SetMixerFPUMode(&oldMode); - if(device->DefaultSlot) + device->NumAuxSends = new_sends; + TRACE("Max sources: %d (%d + %d), effect slots: %d, sends: %d\n", + device->SourcesMax, device->NumMonoSources, device->NumStereoSources, + device->AuxiliaryEffectSlotMax, device->NumAuxSends); + + device->DitherDepth = 0.0f; + if(GetConfigValueBool(alstr_get_cstr(device->DeviceName), NULL, "dither", 1)) { - ALeffectslot *slot = device->DefaultSlot; - ALeffectState *state = slot->Effect.State; - - state->OutBuffer = device->Dry.Buffer; - state->OutChannels = device->Dry.NumChannels; - if(V(state,deviceUpdate)(device) == AL_FALSE) + ALint depth = 0; + ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "dither-depth", &depth); + if(depth <= 0) { - RestoreFPUMode(&oldMode); - return ALC_INVALID_DEVICE; + switch(device->FmtType) + { + case DevFmtByte: + case DevFmtUByte: + depth = 8; + break; + case DevFmtShort: + case DevFmtUShort: + depth = 16; + break; + case DevFmtInt: + case DevFmtUInt: + case DevFmtFloat: + break; + } } - UpdateEffectSlotProps(slot); + else if(depth > 24) + depth = 24; + device->DitherDepth = (depth > 0) ? powf(2.0f, (ALfloat)(depth-1)) : 0.0f; } + if(!(device->DitherDepth > 0.0f)) + TRACE("Dithering disabled\n"); + else + TRACE("Dithering enabled (%g-bit, %g)\n", log2f(device->DitherDepth)+1.0f, + device->DitherDepth); - context = ATOMIC_LOAD(&device->ContextList); + if(ConfigValueBool(alstr_get_cstr(device->DeviceName), NULL, "output-limiter", &val)) + gainLimiter = val ? ALC_TRUE : ALC_FALSE; + /* Valid values for gainLimiter are ALC_DONT_CARE_SOFT, ALC_TRUE, and + * ALC_FALSE. We default to on, so ALC_DONT_CARE_SOFT is the same as + * ALC_TRUE. + */ + if(gainLimiter != ALC_FALSE) + { + if(!device->Limiter || device->Frequency != GetCompressorSampleRate(device->Limiter)) + { + al_free(device->Limiter); + device->Limiter = CreateDeviceLimiter(device); + } + } + else + { + al_free(device->Limiter); + device->Limiter = NULL; + } + TRACE("Output limiter %s\n", device->Limiter ? "enabled" : "disabled"); + + aluSelectPostProcess(device); + + /* Need to delay returning failure until replacement Send arrays have been + * allocated with the appropriate size. + */ + update_failed = AL_FALSE; + START_MIXER_MODE(); + context = ATOMIC_LOAD_SEQ(&device->ContextList); while(context) { + SourceSubList *sublist, *subend; + struct ALvoiceProps *vprops; ALsizei pos; - ReadLock(&context->PropLock); - LockUIntMapRead(&context->EffectSlotMap); - for(pos = 0;pos < context->EffectSlotMap.size;pos++) + if(context->DefaultSlot) { - ALeffectslot *slot = context->EffectSlotMap.values[pos]; + ALeffectslot *slot = context->DefaultSlot; ALeffectState *state = slot->Effect.State; state->OutBuffer = device->Dry.Buffer; state->OutChannels = device->Dry.NumChannels; if(V(state,deviceUpdate)(device) == AL_FALSE) - { - UnlockUIntMapRead(&context->EffectSlotMap); - ReadUnlock(&context->PropLock); - RestoreFPUMode(&oldMode); - return ALC_INVALID_DEVICE; - } - - UpdateEffectSlotProps(slot); + update_failed = AL_TRUE; + else + UpdateEffectSlotProps(slot, context); } - UnlockUIntMapRead(&context->EffectSlotMap); - LockUIntMapRead(&context->SourceMap); - for(pos = 0;pos < context->SourceMap.size;pos++) + almtx_lock(&context->PropLock); + almtx_lock(&context->EffectSlotLock); + for(pos = 0;pos < (ALsizei)VECTOR_SIZE(context->EffectSlotList);pos++) { - ALsource *source = context->SourceMap.values[pos]; - ALuint s = device->NumAuxSends; - while(s < MAX_SENDS) + ALeffectslot *slot = VECTOR_ELEM(context->EffectSlotList, pos); + ALeffectState *state = slot->Effect.State; + + state->OutBuffer = device->Dry.Buffer; + state->OutChannels = device->Dry.NumChannels; + if(V(state,deviceUpdate)(device) == AL_FALSE) + update_failed = AL_TRUE; + else + UpdateEffectSlotProps(slot, context); + } + almtx_unlock(&context->EffectSlotLock); + + almtx_lock(&context->SourceLock); + sublist = VECTOR_BEGIN(context->SourceList); + subend = VECTOR_END(context->SourceList); + for(;sublist != subend;++sublist) + { + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) { - if(source->Send[s].Slot) - DecrementRef(&source->Send[s].Slot->ref); - source->Send[s].Slot = NULL; - source->Send[s].Gain = 1.0f; - source->Send[s].GainHF = 1.0f; - source->Send[s].HFReference = LOWPASSFREQREF; - source->Send[s].GainLF = 1.0f; - source->Send[s].LFReference = HIGHPASSFREQREF; - s++; + ALsizei idx = CTZ64(usemask); + ALsource *source = sublist->Sources + idx; + + usemask &= ~(U64(1) << idx); + + if(old_sends != device->NumAuxSends) + { + ALvoid *sends = al_calloc(16, device->NumAuxSends*sizeof(source->Send[0])); + ALsizei s; + + memcpy(sends, source->Send, + mini(device->NumAuxSends, old_sends)*sizeof(source->Send[0]) + ); + for(s = device->NumAuxSends;s < old_sends;s++) + { + if(source->Send[s].Slot) + DecrementRef(&source->Send[s].Slot->ref); + source->Send[s].Slot = NULL; + } + al_free(source->Send); + source->Send = sends; + for(s = old_sends;s < device->NumAuxSends;s++) + { + source->Send[s].Slot = NULL; + source->Send[s].Gain = 1.0f; + source->Send[s].GainHF = 1.0f; + source->Send[s].HFReference = LOWPASSFREQREF; + source->Send[s].GainLF = 1.0f; + source->Send[s].LFReference = HIGHPASSFREQREF; + } + } + + ATOMIC_FLAG_CLEAR(&source->PropsClean, almemory_order_release); } } - UnlockUIntMapRead(&context->SourceMap); + /* Clear any pre-existing voice property structs, in case the number of + * auxiliary sends is changing. Active sources will have updates + * respecified in UpdateAllSourceProps. + */ + vprops = ATOMIC_EXCHANGE_PTR(&context->FreeVoiceProps, NULL, almemory_order_acq_rel); + while(vprops) + { + struct ALvoiceProps *next = ATOMIC_LOAD(&vprops->next, almemory_order_relaxed); + al_free(vprops); + vprops = next; + } + + AllocateVoices(context, context->MaxVoices, old_sends); + for(pos = 0;pos < context->VoiceCount;pos++) + { + ALvoice *voice = context->Voices[pos]; + + al_free(ATOMIC_EXCHANGE_PTR(&voice->Update, NULL, almemory_order_acq_rel)); + + if(ATOMIC_LOAD(&voice->Source, almemory_order_acquire) == NULL) + continue; + + if(device->AvgSpeakerDist > 0.0f) + { + /* Reinitialize the NFC filters for new parameters. */ + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (device->AvgSpeakerDist * device->Frequency); + for(i = 0;i < voice->NumChannels;i++) + NfcFilterCreate(&voice->Direct.Params[i].NFCtrlFilter, 0.0f, w1); + } + } + almtx_unlock(&context->SourceLock); + + ATOMIC_FLAG_TEST_AND_SET(&context->PropsClean, almemory_order_release); + UpdateContextProps(context); + ATOMIC_FLAG_TEST_AND_SET(&context->Listener->PropsClean, almemory_order_release); + UpdateListenerProps(context); UpdateAllSourceProps(context); - ReadUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); - context = context->next; + context = ATOMIC_LOAD(&context->next, almemory_order_relaxed); } - RestoreFPUMode(&oldMode); + END_MIXER_MODE(); + if(update_failed) + return ALC_INVALID_DEVICE; if(!(device->Flags&DEVICE_PAUSED)) { @@ -2161,6 +2387,71 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) return ALC_NO_ERROR; } + +static void InitDevice(ALCdevice *device, enum DeviceType type) +{ + ALsizei i; + + InitRef(&device->ref, 1); + ATOMIC_INIT(&device->Connected, ALC_TRUE); + device->Type = type; + ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); + + device->Flags = 0; + device->Render_Mode = NormalRender; + device->AvgSpeakerDist = 0.0f; + + ATOMIC_INIT(&device->ContextList, NULL); + + device->ClockBase = 0; + device->SamplesDone = 0; + + device->SourcesMax = 0; + device->AuxiliaryEffectSlotMax = 0; + device->NumAuxSends = 0; + + device->Dry.Buffer = NULL; + device->Dry.NumChannels = 0; + device->FOAOut.Buffer = NULL; + device->FOAOut.NumChannels = 0; + device->RealOut.Buffer = NULL; + device->RealOut.NumChannels = 0; + + AL_STRING_INIT(device->DeviceName); + + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Gain = 1.0f; + device->ChannelDelay[i].Length = 0; + device->ChannelDelay[i].Buffer = NULL; + } + + AL_STRING_INIT(device->HrtfName); + VECTOR_INIT(device->HrtfList); + device->HrtfHandle = NULL; + device->Hrtf = NULL; + device->Bs2b = NULL; + device->Uhj_Encoder = NULL; + device->AmbiDecoder = NULL; + device->AmbiUp = NULL; + device->Stablizer = NULL; + device->Limiter = NULL; + + VECTOR_INIT(device->BufferList); + almtx_init(&device->BufferLock, almtx_plain); + + VECTOR_INIT(device->EffectList); + almtx_init(&device->EffectLock, almtx_plain); + + VECTOR_INIT(device->FilterList); + almtx_init(&device->FilterLock, almtx_plain); + + almtx_init(&device->BackendLock, almtx_plain); + device->Backend = NULL; + + ATOMIC_INIT(&device->next, NULL); +} + /* FreeDevice * * Frees the device structure, and destroys any objects the app failed to @@ -2168,46 +2459,44 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) */ static ALCvoid FreeDevice(ALCdevice *device) { + ALsizei i; + TRACE("%p\n", device); - V0(device->Backend,close)(); - DELETE_OBJ(device->Backend); + if(device->Backend) + DELETE_OBJ(device->Backend); device->Backend = NULL; almtx_destroy(&device->BackendLock); - if(device->DefaultSlot) - { - DeinitEffectSlot(device->DefaultSlot); - device->DefaultSlot = NULL; - } + ReleaseALBuffers(device); +#define FREE_BUFFERSUBLIST(x) al_free((x)->Buffers) + VECTOR_FOR_EACH(BufferSubList, device->BufferList, FREE_BUFFERSUBLIST); +#undef FREE_BUFFERSUBLIST + VECTOR_DEINIT(device->BufferList); + almtx_destroy(&device->BufferLock); - if(device->BufferMap.size > 0) - { - WARN("(%p) Deleting %d Buffer%s\n", device, device->BufferMap.size, - (device->BufferMap.size==1)?"":"s"); - ReleaseALBuffers(device); - } - ResetUIntMap(&device->BufferMap); + ReleaseALEffects(device); +#define FREE_EFFECTSUBLIST(x) al_free((x)->Effects) + VECTOR_FOR_EACH(EffectSubList, device->EffectList, FREE_EFFECTSUBLIST); +#undef FREE_EFFECTSUBLIST + VECTOR_DEINIT(device->EffectList); + almtx_destroy(&device->EffectLock); - if(device->EffectMap.size > 0) - { - WARN("(%p) Deleting %d Effect%s\n", device, device->EffectMap.size, - (device->EffectMap.size==1)?"":"s"); - ReleaseALEffects(device); - } - ResetUIntMap(&device->EffectMap); + ReleaseALFilters(device); +#define FREE_FILTERSUBLIST(x) al_free((x)->Filters) + VECTOR_FOR_EACH(FilterSubList, device->FilterList, FREE_FILTERSUBLIST); +#undef FREE_FILTERSUBLIST + VECTOR_DEINIT(device->FilterList); + almtx_destroy(&device->FilterLock); - if(device->FilterMap.size > 0) - { - WARN("(%p) Deleting %d Filter%s\n", device, device->FilterMap.size, - (device->FilterMap.size==1)?"":"s"); - ReleaseALFilters(device); - } - ResetUIntMap(&device->FilterMap); - - AL_STRING_DEINIT(device->Hrtf.Name); - FreeHrtfList(&device->Hrtf.List); + AL_STRING_DEINIT(device->HrtfName); + FreeHrtfList(&device->HrtfList); + if(device->HrtfHandle) + Hrtf_DecRef(device->HrtfHandle); + device->HrtfHandle = NULL; + al_free(device->Hrtf); + device->Hrtf = NULL; al_free(device->Bs2b); device->Bs2b = NULL; @@ -2215,11 +2504,22 @@ static ALCvoid FreeDevice(ALCdevice *device) al_free(device->Uhj_Encoder); device->Uhj_Encoder = NULL; - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; + bformatdec_free(&device->AmbiDecoder); + ambiup_free(&device->AmbiUp); - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; + al_free(device->Stablizer); + device->Stablizer = NULL; + + al_free(device->Limiter); + device->Limiter = NULL; + + al_free(device->ChannelDelay[0].Buffer); + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Gain = 1.0f; + device->ChannelDelay[i].Length = 0; + device->ChannelDelay[i].Buffer = NULL; + } AL_STRING_DEINIT(device->DeviceName); @@ -2259,7 +2559,7 @@ static ALCboolean VerifyDevice(ALCdevice **device) ALCdevice *tmpDevice; LockLists(); - tmpDevice = ATOMIC_LOAD(&DeviceList); + tmpDevice = ATOMIC_LOAD_SEQ(&DeviceList); while(tmpDevice) { if(tmpDevice == *device) @@ -2268,7 +2568,7 @@ static ALCboolean VerifyDevice(ALCdevice **device) UnlockLists(); return ALC_TRUE; } - tmpDevice = tmpDevice->next; + tmpDevice = ATOMIC_LOAD(&tmpDevice->next, almemory_order_relaxed); } UnlockLists(); @@ -2284,10 +2584,10 @@ static ALCboolean VerifyDevice(ALCdevice **device) static ALvoid InitContext(ALCcontext *Context) { ALlistener *listener = Context->Listener; + struct ALeffectslotArray *auxslots; //Initialise listener listener->Gain = 1.0f; - listener->MetersPerUnit = 1.0f; listener->Position[0] = 0.0f; listener->Position[1] = 0.0f; listener->Position[2] = 0.0f; @@ -2300,30 +2600,34 @@ static ALvoid InitContext(ALCcontext *Context) listener->Up[0] = 0.0f; listener->Up[1] = 1.0f; listener->Up[2] = 0.0f; - - aluMatrixfSet(&listener->Params.Matrix, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - ); - aluVectorSet(&listener->Params.Velocity, 0.0f, 0.0f, 0.0f, 0.0f); - listener->Params.Gain = 1.0f; - listener->Params.MetersPerUnit = 1.0f; - listener->Params.DopplerFactor = 1.0f; - listener->Params.SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; + ATOMIC_FLAG_TEST_AND_SET(&listener->PropsClean, almemory_order_relaxed); ATOMIC_INIT(&listener->Update, NULL); - ATOMIC_INIT(&listener->FreeList, NULL); //Validate Context InitRef(&Context->UpdateCount, 0); ATOMIC_INIT(&Context->HoldUpdates, AL_FALSE); Context->GainBoost = 1.0f; - RWLockInit(&Context->PropLock); + almtx_init(&Context->PropLock, almtx_plain); ATOMIC_INIT(&Context->LastError, AL_NO_ERROR); - InitUIntMap(&Context->SourceMap, Context->Device->SourcesMax); - InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax); + VECTOR_INIT(Context->SourceList); + Context->NumSources = 0; + almtx_init(&Context->SourceLock, almtx_plain); + VECTOR_INIT(Context->EffectSlotList); + almtx_init(&Context->EffectSlotLock, almtx_plain); + + if(Context->DefaultSlot) + { + auxslots = al_calloc(DEF_ALIGN, FAM_SIZE(struct ALeffectslotArray, slot, 1)); + auxslots->count = 1; + auxslots->slot[0] = Context->DefaultSlot; + } + else + { + auxslots = al_calloc(DEF_ALIGN, sizeof(struct ALeffectslotArray)); + auxslots->count = 0; + } + ATOMIC_INIT(&Context->ActiveAuxSlots, auxslots); //Set globals Context->DistanceModel = DefaultDistanceModel; @@ -2331,9 +2635,36 @@ static ALvoid InitContext(ALCcontext *Context) Context->DopplerFactor = 1.0f; Context->DopplerVelocity = 1.0f; Context->SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; + Context->MetersPerUnit = AL_DEFAULT_METERS_PER_UNIT; + ATOMIC_FLAG_TEST_AND_SET(&Context->PropsClean, almemory_order_relaxed); ATOMIC_INIT(&Context->DeferUpdates, AL_FALSE); + almtx_init(&Context->EventThrdLock, almtx_plain); + alsem_init(&Context->EventSem, 0); + Context->AsyncEvents = NULL; + ATOMIC_INIT(&Context->EnabledEvts, 0); + almtx_init(&Context->EventCbLock, almtx_plain); + Context->EventCb = NULL; + Context->EventParam = NULL; + + ATOMIC_INIT(&Context->Update, NULL); + ATOMIC_INIT(&Context->FreeContextProps, NULL); + ATOMIC_INIT(&Context->FreeListenerProps, NULL); + ATOMIC_INIT(&Context->FreeVoiceProps, NULL); + ATOMIC_INIT(&Context->FreeEffectslotProps, NULL); Context->ExtensionList = alExtList; + + + listener->Params.Matrix = IdentityMatrixf; + aluVectorSet(&listener->Params.Velocity, 0.0f, 0.0f, 0.0f, 0.0f); + listener->Params.Gain = listener->Gain; + listener->Params.MetersPerUnit = Context->MetersPerUnit; + listener->Params.DopplerFactor = Context->DopplerFactor; + listener->Params.SpeedOfSound = Context->SpeedOfSound * Context->DopplerVelocity; + listener->Params.ReverbSpeedOfSound = listener->Params.SpeedOfSound * + listener->Params.MetersPerUnit; + listener->Params.SourceDistanceModel = Context->SourceDistanceModel; + listener->Params.DistanceModel = Context->DistanceModel; } @@ -2345,27 +2676,82 @@ static ALvoid InitContext(ALCcontext *Context) static void FreeContext(ALCcontext *context) { ALlistener *listener = context->Listener; + struct ALeffectslotArray *auxslots; + struct ALeffectslotProps *eprops; struct ALlistenerProps *lprops; + struct ALcontextProps *cprops; + struct ALvoiceProps *vprops; size_t count; + ALsizei i; TRACE("%p\n", context); - if(context->SourceMap.size > 0) + if((cprops=ATOMIC_LOAD(&context->Update, almemory_order_acquire)) != NULL) { - WARN("(%p) Deleting %d Source%s\n", context, context->SourceMap.size, - (context->SourceMap.size==1)?"":"s"); - ReleaseALSources(context); + TRACE("Freed unapplied context update %p\n", cprops); + al_free(cprops); } - ResetUIntMap(&context->SourceMap); - if(context->EffectSlotMap.size > 0) + count = 0; + cprops = ATOMIC_LOAD(&context->FreeContextProps, almemory_order_acquire); + while(cprops) { - WARN("(%p) Deleting %d AuxiliaryEffectSlot%s\n", context, context->EffectSlotMap.size, - (context->EffectSlotMap.size==1)?"":"s"); - ReleaseALAuxiliaryEffectSlots(context); + struct ALcontextProps *next = ATOMIC_LOAD(&cprops->next, almemory_order_acquire); + al_free(cprops); + cprops = next; + ++count; } - ResetUIntMap(&context->EffectSlotMap); + TRACE("Freed "SZFMT" context property object%s\n", count, (count==1)?"":"s"); + if(context->DefaultSlot) + { + DeinitEffectSlot(context->DefaultSlot); + context->DefaultSlot = NULL; + } + + auxslots = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, NULL, almemory_order_relaxed); + al_free(auxslots); + + ReleaseALSources(context); +#define FREE_SOURCESUBLIST(x) al_free((x)->Sources) + VECTOR_FOR_EACH(SourceSubList, context->SourceList, FREE_SOURCESUBLIST); +#undef FREE_SOURCESUBLIST + VECTOR_DEINIT(context->SourceList); + context->NumSources = 0; + almtx_destroy(&context->SourceLock); + + count = 0; + eprops = ATOMIC_LOAD(&context->FreeEffectslotProps, almemory_order_relaxed); + while(eprops) + { + struct ALeffectslotProps *next = ATOMIC_LOAD(&eprops->next, almemory_order_relaxed); + if(eprops->State) ALeffectState_DecRef(eprops->State); + al_free(eprops); + eprops = next; + ++count; + } + TRACE("Freed "SZFMT" AuxiliaryEffectSlot property object%s\n", count, (count==1)?"":"s"); + + ReleaseALAuxiliaryEffectSlots(context); +#define FREE_EFFECTSLOTPTR(x) al_free(*(x)) + VECTOR_FOR_EACH(ALeffectslotPtr, context->EffectSlotList, FREE_EFFECTSLOTPTR); +#undef FREE_EFFECTSLOTPTR + VECTOR_DEINIT(context->EffectSlotList); + almtx_destroy(&context->EffectSlotLock); + + count = 0; + vprops = ATOMIC_LOAD(&context->FreeVoiceProps, almemory_order_relaxed); + while(vprops) + { + struct ALvoiceProps *next = ATOMIC_LOAD(&vprops->next, almemory_order_relaxed); + al_free(vprops); + vprops = next; + ++count; + } + TRACE("Freed "SZFMT" voice property object%s\n", count, (count==1)?"":"s"); + + for(i = 0;i < context->VoiceCount;i++) + DeinitVoice(context->Voices[i]); al_free(context->Voices); context->Voices = NULL; context->VoiceCount = 0; @@ -2377,16 +2763,34 @@ static void FreeContext(ALCcontext *context) al_free(lprops); } count = 0; - lprops = ATOMIC_LOAD(&listener->FreeList, almemory_order_consume); + lprops = ATOMIC_LOAD(&context->FreeListenerProps, almemory_order_acquire); while(lprops) { - struct ALlistenerProps *next = ATOMIC_LOAD(&lprops->next, almemory_order_consume); + struct ALlistenerProps *next = ATOMIC_LOAD(&lprops->next, almemory_order_acquire); al_free(lprops); lprops = next; ++count; } TRACE("Freed "SZFMT" listener property object%s\n", count, (count==1)?"":"s"); + if(ATOMIC_EXCHANGE(&context->EnabledEvts, 0, almemory_order_acq_rel)) + { + static const AsyncEvent kill_evt = { 0 }; + while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0) + althrd_yield(); + alsem_post(&context->EventSem); + althrd_join(context->EventThread, NULL); + } + + almtx_destroy(&context->EventCbLock); + almtx_destroy(&context->EventThrdLock); + alsem_destroy(&context->EventSem); + + ll_ringbuffer_free(context->AsyncEvents); + context->AsyncEvents = NULL; + + almtx_destroy(&context->PropLock); + ALCdevice_DecRef(context->Device); context->Device = NULL; @@ -2398,12 +2802,13 @@ static void FreeContext(ALCcontext *context) /* ReleaseContext * * Removes the context reference from the given device and removes it from - * being current on the running thread or globally. + * being current on the running thread or globally. Returns true if other + * contexts still exist on the device. */ -static void ReleaseContext(ALCcontext *context, ALCdevice *device) +static bool ReleaseContext(ALCcontext *context, ALCdevice *device) { - ALCcontext *nextctx; - ALCcontext *origctx; + ALCcontext *origctx, *newhead; + bool ret = true; if(altss_get(LocalContext) == context) { @@ -2413,26 +2818,32 @@ static void ReleaseContext(ALCcontext *context, ALCdevice *device) } origctx = context; - if(ATOMIC_COMPARE_EXCHANGE_STRONG(ALCcontext*, &GlobalContext, &origctx, NULL)) + if(ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&GlobalContext, &origctx, NULL)) ALCcontext_DecRef(context); - ALCdevice_Lock(device); + V0(device->Backend,lock)(); origctx = context; - nextctx = context->next; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALCcontext*, &device->ContextList, &origctx, nextctx)) + newhead = ATOMIC_LOAD(&context->next, almemory_order_relaxed); + if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&device->ContextList, &origctx, newhead)) { ALCcontext *list; do { + /* origctx is what the desired context failed to match. Try + * swapping out the next one in the list. + */ list = origctx; origctx = context; - } while(!COMPARE_EXCHANGE(&list->next, &origctx, nextctx)); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origctx, newhead)); } - ALCdevice_Unlock(device); + else + ret = !!newhead; + V0(device->Backend,unlock)(); ALCcontext_DecRef(context); + return ret; } -void ALCcontext_IncRef(ALCcontext *context) +static void ALCcontext_IncRef(ALCcontext *context) { uint ref = IncrementRef(&context->ref); TRACEREF("%p increasing refcount to %u\n", context, ref); @@ -2462,10 +2873,10 @@ static ALCboolean VerifyContext(ALCcontext **context) ALCdevice *dev; LockLists(); - dev = ATOMIC_LOAD(&DeviceList); + dev = ATOMIC_LOAD_SEQ(&DeviceList); while(dev) { - ALCcontext *ctx = ATOMIC_LOAD(&dev->ContextList); + ALCcontext *ctx = ATOMIC_LOAD(&dev->ContextList, almemory_order_acquire); while(ctx) { if(ctx == *context) @@ -2474,9 +2885,9 @@ static ALCboolean VerifyContext(ALCcontext **context) UnlockLists(); return ALC_TRUE; } - ctx = ctx->next; + ctx = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); } - dev = dev->next; + dev = ATOMIC_LOAD(&dev->next, almemory_order_relaxed); } UnlockLists(); @@ -2500,7 +2911,7 @@ ALCcontext *GetContextRef(void) else { LockLists(); - context = ATOMIC_LOAD(&GlobalContext); + context = ATOMIC_LOAD_SEQ(&GlobalContext); if(context) ALCcontext_IncRef(context); UnlockLists(); @@ -2510,6 +2921,91 @@ ALCcontext *GetContextRef(void) } +void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends) +{ + ALCdevice *device = context->Device; + ALsizei num_sends = device->NumAuxSends; + struct ALvoiceProps *props; + size_t sizeof_props; + size_t sizeof_voice; + ALvoice **voices; + ALvoice *voice; + ALsizei v = 0; + size_t size; + + if(num_voices == context->MaxVoices && num_sends == old_sends) + return; + + /* Allocate the voice pointers, voices, and the voices' stored source + * property set (including the dynamically-sized Send[] array) in one + * chunk. + */ + sizeof_voice = RoundUp(FAM_SIZE(ALvoice, Send, num_sends), 16); + sizeof_props = RoundUp(FAM_SIZE(struct ALvoiceProps, Send, num_sends), 16); + size = sizeof(ALvoice*) + sizeof_voice + sizeof_props; + + voices = al_calloc(16, RoundUp(size*num_voices, 16)); + /* The voice and property objects are stored interleaved since they're + * paired together. + */ + voice = (ALvoice*)((char*)voices + RoundUp(num_voices*sizeof(ALvoice*), 16)); + props = (struct ALvoiceProps*)((char*)voice + sizeof_voice); + + if(context->Voices) + { + const ALsizei v_count = mini(context->VoiceCount, num_voices); + const ALsizei s_count = mini(old_sends, num_sends); + + for(;v < v_count;v++) + { + ALvoice *old_voice = context->Voices[v]; + ALsizei i; + + /* Copy the old voice data and source property set to the new + * storage. + */ + *voice = *old_voice; + for(i = 0;i < s_count;i++) + voice->Send[i] = old_voice->Send[i]; + *props = *(old_voice->Props); + for(i = 0;i < s_count;i++) + props->Send[i] = old_voice->Props->Send[i]; + + /* Set this voice's property set pointer and voice reference. */ + voice->Props = props; + voices[v] = voice; + + /* Increment pointers to the next storage space. */ + voice = (ALvoice*)((char*)props + sizeof_props); + props = (struct ALvoiceProps*)((char*)voice + sizeof_voice); + } + /* Deinit any left over voices that weren't copied over to the new + * array. NOTE: If this does anything, v equals num_voices and + * num_voices is less than VoiceCount, so the following loop won't do + * anything. + */ + for(;v < context->VoiceCount;v++) + DeinitVoice(context->Voices[v]); + } + /* Finish setting the voices' property set pointers and references. */ + for(;v < num_voices;v++) + { + ATOMIC_INIT(&voice->Update, NULL); + + voice->Props = props; + voices[v] = voice; + + voice = (ALvoice*)((char*)props + sizeof_props); + props = (struct ALvoiceProps*)((char*)voice + sizeof_voice); + } + + al_free(context->Voices); + context->Voices = voices; + context->MaxVoices = num_voices; + context->VoiceCount = mini(context->VoiceCount, num_voices); +} + + /************************************************ * Standard ALC functions ************************************************/ @@ -2524,11 +3020,11 @@ ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device) if(VerifyDevice(&device)) { - errorCode = ATOMIC_EXCHANGE(ALCenum, &device->LastError, ALC_NO_ERROR); + errorCode = ATOMIC_EXCHANGE_SEQ(&device->LastError, ALC_NO_ERROR); ALCdevice_DecRef(device); } else - errorCode = ATOMIC_EXCHANGE(ALCenum, &LastNullDeviceError, ALC_NO_ERROR); + errorCode = ATOMIC_EXCHANGE_SEQ(&LastNullDeviceError, ALC_NO_ERROR); return errorCode; } @@ -2547,7 +3043,7 @@ ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *context) alcSetError(NULL, ALC_INVALID_CONTEXT); else { - ALCcontext_DeferUpdates(context, DeferAllowPlay); + ALCcontext_DeferUpdates(context); ALCcontext_DecRef(context); } } @@ -2612,26 +3108,26 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para case ALC_ALL_DEVICES_SPECIFIER: if(VerifyDevice(&Device)) { - value = al_string_get_cstr(Device->DeviceName); + value = alstr_get_cstr(Device->DeviceName); ALCdevice_DecRef(Device); } else { ProbeAllDevicesList(); - value = al_string_get_cstr(alcAllDevicesList); + value = alstr_get_cstr(alcAllDevicesList); } break; case ALC_CAPTURE_DEVICE_SPECIFIER: if(VerifyDevice(&Device)) { - value = al_string_get_cstr(Device->DeviceName); + value = alstr_get_cstr(Device->DeviceName); ALCdevice_DecRef(Device); } else { ProbeCaptureDeviceList(); - value = al_string_get_cstr(alcCaptureDeviceList); + value = alstr_get_cstr(alcCaptureDeviceList); } break; @@ -2641,13 +3137,13 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para break; case ALC_DEFAULT_ALL_DEVICES_SPECIFIER: - if(al_string_empty(alcAllDevicesList)) + if(alstr_empty(alcAllDevicesList)) ProbeAllDevicesList(); VerifyDevice(&Device); free(alcDefaultAllDevicesSpecifier); - alcDefaultAllDevicesSpecifier = strdup(al_string_get_cstr(alcAllDevicesList)); + alcDefaultAllDevicesSpecifier = strdup(alstr_get_cstr(alcAllDevicesList)); if(!alcDefaultAllDevicesSpecifier) alcSetError(Device, ALC_OUT_OF_MEMORY); @@ -2656,13 +3152,13 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para break; case ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER: - if(al_string_empty(alcCaptureDeviceList)) + if(alstr_empty(alcCaptureDeviceList)) ProbeCaptureDeviceList(); VerifyDevice(&Device); free(alcCaptureDefaultDeviceSpecifier); - alcCaptureDefaultDeviceSpecifier = strdup(al_string_get_cstr(alcCaptureDeviceList)); + alcCaptureDefaultDeviceSpecifier = strdup(alstr_get_cstr(alcCaptureDeviceList)); if(!alcCaptureDefaultDeviceSpecifier) alcSetError(Device, ALC_OUT_OF_MEMORY); @@ -2686,7 +3182,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para else { almtx_lock(&Device->BackendLock); - value = (Device->Hrtf.Handle ? al_string_get_cstr(Device->Hrtf.Name) : ""); + value = (Device->HrtfHandle ? alstr_get_cstr(Device->HrtfName) : ""); almtx_unlock(&Device->BackendLock); ALCdevice_DecRef(Device); } @@ -2703,6 +3199,15 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para } +static inline ALCsizei NumAttrsForDevice(ALCdevice *device) +{ + if(device->Type == Capture) return 9; + if(device->Type != Loopback) return 29; + if(device->FmtChans == DevFmtAmbi3D) + return 35; + return 29; +} + static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) { ALCsizei i; @@ -2734,6 +3239,10 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC case ALC_CAPTURE_SAMPLES: case ALC_FORMAT_CHANNELS_SOFT: case ALC_FORMAT_TYPE_SOFT: + case ALC_AMBISONIC_LAYOUT_SOFT: + case ALC_AMBISONIC_SCALING_SOFT: + case ALC_AMBISONIC_ORDER_SOFT: + case ALC_MAX_AMBISONIC_ORDER_SOFT: alcSetError(NULL, ALC_INVALID_DEVICE); return 0; @@ -2748,6 +3257,39 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC { switch(param) { + case ALC_ATTRIBUTES_SIZE: + values[0] = NumAttrsForDevice(device); + return 1; + + case ALC_ALL_ATTRIBUTES: + if(size < NumAttrsForDevice(device)) + { + alcSetError(device, ALC_INVALID_VALUE); + return 0; + } + + i = 0; + almtx_lock(&device->BackendLock); + values[i++] = ALC_MAJOR_VERSION; + values[i++] = alcMajorVersion; + values[i++] = ALC_MINOR_VERSION; + values[i++] = alcMinorVersion; + values[i++] = ALC_CAPTURE_SAMPLES; + values[i++] = V0(device->Backend,availableSamples)(); + values[i++] = ALC_CONNECTED; + values[i++] = ATOMIC_LOAD(&device->Connected, almemory_order_relaxed); + almtx_unlock(&device->BackendLock); + + values[i++] = 0; + return i; + + case ALC_MAJOR_VERSION: + values[0] = alcMajorVersion; + return 1; + case ALC_MINOR_VERSION: + values[0] = alcMinorVersion; + return 1; + case ALC_CAPTURE_SAMPLES: almtx_lock(&device->BackendLock); values[0] = V0(device->Backend,availableSamples)(); @@ -2755,7 +3297,7 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC return 1; case ALC_CONNECTED: - values[0] = device->Connected; + values[0] = ATOMIC_LOAD(&device->Connected, almemory_order_acquire); return 1; default: @@ -2768,28 +3310,12 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC /* render device */ switch(param) { - case ALC_MAJOR_VERSION: - values[0] = alcMajorVersion; - return 1; - - case ALC_MINOR_VERSION: - values[0] = alcMinorVersion; - return 1; - - case ALC_EFX_MAJOR_VERSION: - values[0] = alcEFXMajorVersion; - return 1; - - case ALC_EFX_MINOR_VERSION: - values[0] = alcEFXMinorVersion; - return 1; - case ALC_ATTRIBUTES_SIZE: - values[0] = 17; + values[0] = NumAttrsForDevice(device); return 1; case ALC_ALL_ATTRIBUTES: - if(size < 17) + if(size < NumAttrsForDevice(device)) { alcSetError(device, ALC_INVALID_VALUE); return 0; @@ -2797,9 +3323,17 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC i = 0; almtx_lock(&device->BackendLock); + values[i++] = ALC_MAJOR_VERSION; + values[i++] = alcMajorVersion; + values[i++] = ALC_MINOR_VERSION; + values[i++] = alcMinorVersion; + values[i++] = ALC_EFX_MAJOR_VERSION; + values[i++] = alcEFXMajorVersion; + values[i++] = ALC_EFX_MINOR_VERSION; + values[i++] = alcEFXMinorVersion; + values[i++] = ALC_FREQUENCY; values[i++] = device->Frequency; - if(device->Type != Loopback) { values[i++] = ALC_REFRESH; @@ -2810,6 +3344,18 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC } else { + if(device->FmtChans == DevFmtAmbi3D) + { + values[i++] = ALC_AMBISONIC_LAYOUT_SOFT; + values[i++] = device->AmbiLayout; + + values[i++] = ALC_AMBISONIC_SCALING_SOFT; + values[i++] = device->AmbiScale; + + values[i++] = ALC_AMBISONIC_ORDER_SOFT; + values[i++] = device->AmbiOrder; + } + values[i++] = ALC_FORMAT_CHANNELS_SOFT; values[i++] = device->FmtChans; @@ -2827,15 +3373,37 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC values[i++] = device->NumAuxSends; values[i++] = ALC_HRTF_SOFT; - values[i++] = (device->Hrtf.Handle ? ALC_TRUE : ALC_FALSE); + values[i++] = (device->HrtfHandle ? ALC_TRUE : ALC_FALSE); values[i++] = ALC_HRTF_STATUS_SOFT; - values[i++] = device->Hrtf.Status; + values[i++] = device->HrtfStatus; + + values[i++] = ALC_OUTPUT_LIMITER_SOFT; + values[i++] = device->Limiter ? ALC_TRUE : ALC_FALSE; + + values[i++] = ALC_MAX_AMBISONIC_ORDER_SOFT; + values[i++] = MAX_AMBI_ORDER; almtx_unlock(&device->BackendLock); values[i++] = 0; return i; + case ALC_MAJOR_VERSION: + values[0] = alcMajorVersion; + return 1; + + case ALC_MINOR_VERSION: + values[0] = alcMinorVersion; + return 1; + + case ALC_EFX_MAJOR_VERSION: + values[0] = alcEFXMajorVersion; + return 1; + + case ALC_EFX_MINOR_VERSION: + values[0] = alcEFXMinorVersion; + return 1; + case ALC_FREQUENCY: values[0] = device->Frequency; return 1; @@ -2878,6 +3446,33 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC values[0] = device->FmtType; return 1; + case ALC_AMBISONIC_LAYOUT_SOFT: + if(device->Type != Loopback || device->FmtChans != DevFmtAmbi3D) + { + alcSetError(device, ALC_INVALID_DEVICE); + return 0; + } + values[0] = device->AmbiLayout; + return 1; + + case ALC_AMBISONIC_SCALING_SOFT: + if(device->Type != Loopback || device->FmtChans != DevFmtAmbi3D) + { + alcSetError(device, ALC_INVALID_DEVICE); + return 0; + } + values[0] = device->AmbiScale; + return 1; + + case ALC_AMBISONIC_ORDER_SOFT: + if(device->Type != Loopback || device->FmtChans != DevFmtAmbi3D) + { + alcSetError(device, ALC_INVALID_DEVICE); + return 0; + } + values[0] = device->AmbiOrder; + return 1; + case ALC_MONO_SOURCES: values[0] = device->NumMonoSources; return 1; @@ -2891,25 +3486,33 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC return 1; case ALC_CONNECTED: - values[0] = device->Connected; + values[0] = ATOMIC_LOAD(&device->Connected, almemory_order_acquire); return 1; case ALC_HRTF_SOFT: - values[0] = (device->Hrtf.Handle ? ALC_TRUE : ALC_FALSE); + values[0] = (device->HrtfHandle ? ALC_TRUE : ALC_FALSE); return 1; case ALC_HRTF_STATUS_SOFT: - values[0] = device->Hrtf.Status; + values[0] = device->HrtfStatus; return 1; case ALC_NUM_HRTF_SPECIFIERS_SOFT: almtx_lock(&device->BackendLock); - FreeHrtfList(&device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); - values[0] = (ALCint)VECTOR_SIZE(device->Hrtf.List); + FreeHrtfList(&device->HrtfList); + device->HrtfList = EnumerateHrtf(device->DeviceName); + values[0] = (ALCint)VECTOR_SIZE(device->HrtfList); almtx_unlock(&device->BackendLock); return 1; + case ALC_OUTPUT_LIMITER_SOFT: + values[0] = device->Limiter ? ALC_TRUE : ALC_FALSE; + return 1; + + case ALC_MAX_AMBISONIC_ORDER_SOFT: + values[0] = MAX_AMBI_ORDER; + return 1; + default: alcSetError(device, ALC_INVALID_ENUM); return 0; @@ -2957,11 +3560,11 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, switch(pname) { case ALC_ATTRIBUTES_SIZE: - *values = 21; + *values = NumAttrsForDevice(device)+4; break; case ALC_ALL_ATTRIBUTES: - if(size < 21) + if(size < NumAttrsForDevice(device)+4) alcSetError(device, ALC_INVALID_VALUE); else { @@ -2980,6 +3583,18 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, } else { + if(device->FmtChans == DevFmtAmbi3D) + { + values[i++] = ALC_AMBISONIC_LAYOUT_SOFT; + values[i++] = device->AmbiLayout; + + values[i++] = ALC_AMBISONIC_SCALING_SOFT; + values[i++] = device->AmbiScale; + + values[i++] = ALC_AMBISONIC_ORDER_SOFT; + values[i++] = device->AmbiOrder; + } + values[i++] = ALC_FORMAT_CHANNELS_SOFT; values[i++] = device->FmtChans; @@ -2997,10 +3612,13 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, values[i++] = device->NumAuxSends; values[i++] = ALC_HRTF_SOFT; - values[i++] = (device->Hrtf.Handle ? ALC_TRUE : ALC_FALSE); + values[i++] = (device->HrtfHandle ? ALC_TRUE : ALC_FALSE); values[i++] = ALC_HRTF_STATUS_SOFT; - values[i++] = device->Hrtf.Status; + values[i++] = device->HrtfStatus; + + values[i++] = ALC_OUTPUT_LIMITER_SOFT; + values[i++] = device->Limiter ? ALC_TRUE : ALC_FALSE; clock = V0(device->Backend,getClockLatency)(); values[i++] = ALC_DEVICE_CLOCK_SOFT; @@ -3027,12 +3645,10 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, break; case ALC_DEVICE_LATENCY_SOFT: - { - almtx_lock(&device->BackendLock); - clock = V0(device->Backend,getClockLatency)(); - almtx_unlock(&device->BackendLock); - *values = clock.Latency; - } + almtx_lock(&device->BackendLock); + clock = V0(device->Backend,getClockLatency)(); + almtx_unlock(&device->BackendLock); + *values = clock.Latency; break; case ALC_DEVICE_CLOCK_LATENCY_SOFT: @@ -3040,7 +3656,6 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, alcSetError(device, ALC_INVALID_VALUE); else { - ClockLatency clock; almtx_lock(&device->BackendLock); clock = V0(device->Backend,getClockLatency)(); almtx_unlock(&device->BackendLock); @@ -3117,10 +3732,15 @@ ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar } else { - ALsizei i = 0; - while(alcFunctions[i].funcName && strcmp(alcFunctions[i].funcName, funcName) != 0) - i++; - ptr = alcFunctions[i].address; + size_t i = 0; + for(i = 0;i < COUNTOF(alcFunctions);i++) + { + if(strcmp(alcFunctions[i].funcName, funcName) == 0) + { + ptr = alcFunctions[i].address; + break; + } + } } return ptr; @@ -3143,10 +3763,15 @@ ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *e } else { - ALsizei i = 0; - while(enumeration[i].enumName && strcmp(enumeration[i].enumName, enumName) != 0) - i++; - val = enumeration[i].value; + size_t i = 0; + for(i = 0;i < COUNTOF(alcEnumerations);i++) + { + if(strcmp(alcEnumerations[i].enumName, enumName) == 0) + { + val = alcEnumerations[i].value; + break; + } + } } return val; @@ -3163,8 +3788,13 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin ALfloat valf; ALCenum err; + /* Explicitly hold the list lock while taking the BackendLock in case the + * device is asynchronously destropyed, to ensure this new context is + * properly cleaned up after being made. + */ LockLists(); - if(!VerifyDevice(&device) || device->Type == Capture || !device->Connected) + if(!VerifyDevice(&device) || device->Type == Capture || + !ATOMIC_LOAD(&device->Connected, almemory_order_relaxed)) { UnlockLists(); alcSetError(device, ALC_INVALID_DEVICE); @@ -3174,45 +3804,36 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin almtx_lock(&device->BackendLock); UnlockLists(); - ATOMIC_STORE(&device->LastError, ALC_NO_ERROR); + ATOMIC_STORE_SEQ(&device->LastError, ALC_NO_ERROR); - ALContext = al_calloc(16, sizeof(ALCcontext)+sizeof(ALlistener)); - if(ALContext) - { - InitRef(&ALContext->ref, 1); - ALContext->Listener = (ALlistener*)ALContext->_listener_mem; - - ATOMIC_INIT(&ALContext->ActiveAuxSlotList, NULL); - - ALContext->VoiceCount = 0; - ALContext->MaxVoices = 256; - ALContext->Voices = al_calloc(16, ALContext->MaxVoices * sizeof(ALContext->Voices[0])); - } - if(!ALContext || !ALContext->Voices) + if(device->Type == Playback && DefaultEffect.type != AL_EFFECT_NULL) + ALContext = al_calloc(16, sizeof(ALCcontext)+sizeof(ALlistener)+sizeof(ALeffectslot)); + else + ALContext = al_calloc(16, sizeof(ALCcontext)+sizeof(ALlistener)); + if(!ALContext) { almtx_unlock(&device->BackendLock); - if(ALContext) - { - al_free(ALContext->Voices); - ALContext->Voices = NULL; - - al_free(ALContext); - ALContext = NULL; - } - alcSetError(device, ALC_OUT_OF_MEMORY); ALCdevice_DecRef(device); return NULL; } + InitRef(&ALContext->ref, 1); + ALContext->Listener = (ALlistener*)ALContext->_listener_mem; + ALContext->DefaultSlot = NULL; + + ALContext->Voices = NULL; + ALContext->VoiceCount = 0; + ALContext->MaxVoices = 0; + ATOMIC_INIT(&ALContext->ActiveAuxSlots, NULL); + ALContext->Device = device; + ATOMIC_INIT(&ALContext->next, NULL); + if((err=UpdateDeviceParams(device, attrList)) != ALC_NO_ERROR) { almtx_unlock(&device->BackendLock); - al_free(ALContext->Voices); - ALContext->Voices = NULL; - al_free(ALContext); ALContext = NULL; @@ -3220,18 +3841,30 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin if(err == ALC_INVALID_DEVICE) { V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device update failure"); V0(device->Backend,unlock)(); } ALCdevice_DecRef(device); return NULL; } + AllocateVoices(ALContext, 256, device->NumAuxSends); - ALContext->Device = device; - ALCdevice_IncRef(device); + if(DefaultEffect.type != AL_EFFECT_NULL && device->Type == Playback) + { + ALContext->DefaultSlot = (ALeffectslot*)(ALContext->_listener_mem + sizeof(ALlistener)); + if(InitEffectSlot(ALContext->DefaultSlot) == AL_NO_ERROR) + aluInitEffectPanning(ALContext->DefaultSlot); + else + { + ALContext->DefaultSlot = NULL; + ERR("Failed to initialize the default effect slot\n"); + } + } + + ALCdevice_IncRef(ALContext->Device); InitContext(ALContext); - if(ConfigValueFloat(al_string_get_cstr(device->DeviceName), NULL, "volume-adjust", &valf)) + if(ConfigValueFloat(alstr_get_cstr(device->DeviceName), NULL, "volume-adjust", &valf)) { if(!isfinite(valf)) ERR("volume-adjust must be finite: %f\n", valf); @@ -3247,13 +3880,22 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin UpdateListenerProps(ALContext); { - ALCcontext *head = ATOMIC_LOAD(&device->ContextList); + ALCcontext *head = ATOMIC_LOAD_SEQ(&device->ContextList); do { - ALContext->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCcontext*, &device->ContextList, &head, ALContext)); + ATOMIC_STORE(&ALContext->next, head, almemory_order_relaxed); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&device->ContextList, &head, + ALContext) == 0); } almtx_unlock(&device->BackendLock); + if(ALContext->DefaultSlot) + { + if(InitializeEffect(ALContext, ALContext->DefaultSlot, &DefaultEffect) == AL_NO_ERROR) + UpdateEffectSlotProps(ALContext->DefaultSlot, ALContext); + else + ERR("Failed to initialize the default effect\n"); + } + ALCdevice_DecRef(device); TRACE("Created context %p\n", ALContext); @@ -3269,13 +3911,18 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context) ALCdevice *Device; LockLists(); - /* alcGetContextsDevice sets an error for invalid contexts */ - Device = alcGetContextsDevice(context); + if(!VerifyContext(&context)) + { + UnlockLists(); + alcSetError(NULL, ALC_INVALID_CONTEXT); + return; + } + + Device = context->Device; if(Device) { almtx_lock(&Device->BackendLock); - ReleaseContext(context, Device); - if(!ATOMIC_LOAD(&Device->ContextList)) + if(!ReleaseContext(context, Device)) { V0(Device->Backend,stop)(); Device->Flags &= ~DEVICE_RUNNING; @@ -3283,6 +3930,8 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context) almtx_unlock(&Device->BackendLock); } UnlockLists(); + + ALCcontext_DecRef(context); } @@ -3293,7 +3942,7 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context) ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void) { ALCcontext *Context = altss_get(LocalContext); - if(!Context) Context = ATOMIC_LOAD(&GlobalContext); + if(!Context) Context = ATOMIC_LOAD_SEQ(&GlobalContext); return Context; } @@ -3321,7 +3970,7 @@ ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context) return ALC_FALSE; } /* context's reference count is already incremented */ - context = ATOMIC_EXCHANGE(ALCcontext*, &GlobalContext, context); + context = ATOMIC_EXCHANGE_PTR_SEQ(&GlobalContext, context); if(context) ALCcontext_DecRef(context); if((context=altss_get(LocalContext)) != NULL) @@ -3382,6 +4031,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *Context) */ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) { + ALCbackendFactory *factory; const ALCchar *fmt; ALCdevice *device; ALCenum err; @@ -3406,7 +4056,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) )) deviceName = NULL; - device = al_calloc(16, sizeof(ALCdevice)+sizeof(ALeffectslot)); + device = al_calloc(16, sizeof(ALCdevice)); if(!device) { alcSetError(NULL, ALC_OUT_OF_MEMORY); @@ -3414,79 +4064,39 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) } //Validate device - InitRef(&device->ref, 1); - device->Connected = ALC_TRUE; - device->Type = Playback; - ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); - - device->Flags = 0; - device->Bs2b = NULL; - device->Uhj_Encoder = NULL; - VECTOR_INIT(device->Hrtf.List); - AL_STRING_INIT(device->Hrtf.Name); - device->Render_Mode = NormalRender; - AL_STRING_INIT(device->DeviceName); - device->Dry.Buffer = NULL; - device->Dry.NumChannels = 0; - device->FOAOut.Buffer = NULL; - device->FOAOut.NumChannels = 0; - device->RealOut.Buffer = NULL; - device->RealOut.NumChannels = 0; - - ATOMIC_INIT(&device->ContextList, NULL); - - device->ClockBase = 0; - device->SamplesDone = 0; - - device->SourcesMax = 256; - device->AuxiliaryEffectSlotMax = 4; - device->NumAuxSends = MAX_SENDS; - - InitUIntMap(&device->BufferMap, ~0); - InitUIntMap(&device->EffectMap, ~0); - InitUIntMap(&device->FilterMap, ~0); + InitDevice(device, Playback); //Set output format device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; device->Frequency = DEFAULT_OUTPUT_RATE; device->IsHeadphones = AL_FALSE; - device->AmbiFmt = AmbiFormat_Default; - device->NumUpdates = 4; + device->AmbiLayout = AmbiLayout_Default; + device->AmbiScale = AmbiNorm_Default; + device->NumUpdates = 3; device->UpdateSize = 1024; - if(!PlaybackBackend.getFactory) - device->Backend = create_backend_wrapper(device, &PlaybackBackend.Funcs, - ALCbackend_Playback); - else - { - ALCbackendFactory *factory = PlaybackBackend.getFactory(); - device->Backend = V(factory,createBackend)(device, ALCbackend_Playback); - } - if(!device->Backend) - { - al_free(device); - alcSetError(NULL, ALC_OUT_OF_MEMORY); - return NULL; - } - + device->SourcesMax = 256; + device->AuxiliaryEffectSlotMax = 64; + device->NumAuxSends = DEFAULT_SENDS; if(ConfigValueStr(deviceName, NULL, "channels", &fmt)) { static const struct { const char name[16]; enum DevFmtChannels chans; + ALsizei order; } chanlist[] = { - { "mono", DevFmtMono }, - { "stereo", DevFmtStereo }, - { "quad", DevFmtQuad }, - { "surround51", DevFmtX51 }, - { "surround61", DevFmtX61 }, - { "surround71", DevFmtX71 }, - { "surround51rear", DevFmtX51Rear }, - { "ambi1", DevFmtAmbi1 }, - { "ambi2", DevFmtAmbi2 }, - { "ambi3", DevFmtAmbi3 }, + { "mono", DevFmtMono, 0 }, + { "stereo", DevFmtStereo, 0 }, + { "quad", DevFmtQuad, 0 }, + { "surround51", DevFmtX51, 0 }, + { "surround61", DevFmtX61, 0 }, + { "surround71", DevFmtX71, 0 }, + { "surround51rear", DevFmtX51Rear, 0 }, + { "ambi1", DevFmtAmbi3D, 1 }, + { "ambi2", DevFmtAmbi3D, 2 }, + { "ambi3", DevFmtAmbi3D, 3 }, }; size_t i; @@ -3495,6 +4105,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(strcasecmp(chanlist[i].name, fmt) == 0) { device->FmtChans = chanlist[i].chans; + device->AmbiOrder = chanlist[i].order; device->Flags |= DEVICE_CHANNELS_REQUEST; break; } @@ -3551,64 +4162,65 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(device->SourcesMax == 0) device->SourcesMax = 256; ConfigValueUInt(deviceName, NULL, "slots", &device->AuxiliaryEffectSlotMax); - if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; + if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64; + else device->AuxiliaryEffectSlotMax = minu(device->AuxiliaryEffectSlotMax, INT_MAX); - ConfigValueUInt(deviceName, NULL, "sends", &device->NumAuxSends); - if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS; + if(ConfigValueInt(deviceName, NULL, "sends", &device->NumAuxSends)) + device->NumAuxSends = clampi( + DEFAULT_SENDS, 0, clampi(device->NumAuxSends, 0, MAX_SENDS) + ); device->NumStereoSources = 1; device->NumMonoSources = device->SourcesMax - device->NumStereoSources; + factory = PlaybackBackend.getFactory(); + device->Backend = V(factory,createBackend)(device, ALCbackend_Playback); + if(!device->Backend) + { + FreeDevice(device); + alcSetError(NULL, ALC_OUT_OF_MEMORY); + return NULL; + } + // Find a playback device to open if((err=V(device->Backend,open)(deviceName)) != ALC_NO_ERROR) { - DELETE_OBJ(device->Backend); - al_free(device); + FreeDevice(device); alcSetError(NULL, err); return NULL; } - almtx_init(&device->BackendLock, almtx_plain); - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "ambi-format", &fmt)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "ambi-format", &fmt)) { if(strcasecmp(fmt, "fuma") == 0) - device->AmbiFmt = AmbiFormat_FuMa; + { + device->AmbiLayout = AmbiLayout_FuMa; + device->AmbiScale = AmbiNorm_FuMa; + } else if(strcasecmp(fmt, "acn+sn3d") == 0) - device->AmbiFmt = AmbiFormat_ACN_SN3D; + { + device->AmbiLayout = AmbiLayout_ACN; + device->AmbiScale = AmbiNorm_SN3D; + } else if(strcasecmp(fmt, "acn+n3d") == 0) - device->AmbiFmt = AmbiFormat_ACN_N3D; + { + device->AmbiLayout = AmbiLayout_ACN; + device->AmbiScale = AmbiNorm_N3D; + } else ERR("Unsupported ambi-format: %s\n", fmt); } - if(DefaultEffect.type != AL_EFFECT_NULL) - { - device->DefaultSlot = (ALeffectslot*)device->_slot_mem; - if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR) - { - device->DefaultSlot = NULL; - ERR("Failed to initialize the default effect slot\n"); - } - else - { - aluInitEffectPanning(device->DefaultSlot); - if(InitializeEffect(device, device->DefaultSlot, &DefaultEffect) != AL_NO_ERROR) - { - DeinitEffectSlot(device->DefaultSlot); - device->DefaultSlot = NULL; - ERR("Failed to initialize the default effect\n"); - } - } - } + device->Limiter = CreateDeviceLimiter(device); { - ALCdevice *head = ATOMIC_LOAD(&DeviceList); + ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList); do { - device->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCdevice*, &DeviceList, &head, device)); + ATOMIC_STORE(&device->next, head, almemory_order_relaxed); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device)); } - TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName)); + TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName)); return device; } @@ -3618,38 +4230,40 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) */ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) { - ALCdevice *list, *origdev, *nextdev; + ALCdevice *iter, *origdev, *nextdev; ALCcontext *ctx; LockLists(); - list = ATOMIC_LOAD(&DeviceList); + iter = ATOMIC_LOAD_SEQ(&DeviceList); do { - if(list == device) + if(iter == device) break; - } while((list=list->next) != NULL); - if(!list || list->Type == Capture) + iter = ATOMIC_LOAD(&iter->next, almemory_order_relaxed); + } while(iter != NULL); + if(!iter || iter->Type == Capture) { - alcSetError(list, ALC_INVALID_DEVICE); + alcSetError(iter, ALC_INVALID_DEVICE); UnlockLists(); return ALC_FALSE; } almtx_lock(&device->BackendLock); origdev = device; - nextdev = device->next; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALCdevice*, &DeviceList, &origdev, nextdev)) + nextdev = ATOMIC_LOAD(&device->next, almemory_order_relaxed); + if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&DeviceList, &origdev, nextdev)) { + ALCdevice *list; do { list = origdev; origdev = device; - } while(!COMPARE_EXCHANGE(&list->next, &origdev, nextdev)); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origdev, nextdev)); } UnlockLists(); - ctx = ATOMIC_LOAD(&device->ContextList); + ctx = ATOMIC_LOAD_SEQ(&device->ContextList); while(ctx != NULL) { - ALCcontext *next = ctx->next; + ALCcontext *next = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); WARN("Releasing context %p\n", ctx); ReleaseContext(ctx, device); ctx = next; @@ -3670,6 +4284,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) ************************************************/ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei samples) { + ALCbackendFactory *factory; ALCdevice *device = NULL; ALCenum err; @@ -3698,100 +4313,84 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, } //Validate device - InitRef(&device->ref, 1); - device->Connected = ALC_TRUE; - device->Type = Capture; + InitDevice(device, Capture); - VECTOR_INIT(device->Hrtf.List); - AL_STRING_INIT(device->Hrtf.Name); - - AL_STRING_INIT(device->DeviceName); - device->Dry.Buffer = NULL; - device->Dry.NumChannels = 0; - device->FOAOut.Buffer = NULL; - device->FOAOut.NumChannels = 0; - device->RealOut.Buffer = NULL; - device->RealOut.NumChannels = 0; - - InitUIntMap(&device->BufferMap, ~0); - InitUIntMap(&device->EffectMap, ~0); - InitUIntMap(&device->FilterMap, ~0); - - if(!CaptureBackend.getFactory) - device->Backend = create_backend_wrapper(device, &CaptureBackend.Funcs, - ALCbackend_Capture); - else - { - ALCbackendFactory *factory = CaptureBackend.getFactory(); - device->Backend = V(factory,createBackend)(device, ALCbackend_Capture); - } - if(!device->Backend) - { - al_free(device); - alcSetError(NULL, ALC_OUT_OF_MEMORY); - return NULL; - } - - device->Flags |= DEVICE_FREQUENCY_REQUEST; device->Frequency = frequency; + device->Flags |= DEVICE_FREQUENCY_REQUEST; - device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_SAMPLE_TYPE_REQUEST; if(DecomposeDevFormat(format, &device->FmtChans, &device->FmtType) == AL_FALSE) { - al_free(device); + FreeDevice(device); alcSetError(NULL, ALC_INVALID_ENUM); return NULL; } + device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_SAMPLE_TYPE_REQUEST; device->IsHeadphones = AL_FALSE; - device->AmbiFmt = AmbiFormat_Default; + device->AmbiOrder = 0; + device->AmbiLayout = AmbiLayout_Default; + device->AmbiScale = AmbiNorm_Default; device->UpdateSize = samples; device->NumUpdates = 1; + factory = CaptureBackend.getFactory(); + device->Backend = V(factory,createBackend)(device, ALCbackend_Capture); + if(!device->Backend) + { + FreeDevice(device); + alcSetError(NULL, ALC_OUT_OF_MEMORY); + return NULL; + } + + TRACE("Capture format: %s, %s, %uhz, %u update size x%d\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, device->UpdateSize, device->NumUpdates + ); if((err=V(device->Backend,open)(deviceName)) != ALC_NO_ERROR) { - al_free(device); + FreeDevice(device); alcSetError(NULL, err); return NULL; } - almtx_init(&device->BackendLock, almtx_plain); { - ALCdevice *head = ATOMIC_LOAD(&DeviceList); + ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList); do { - device->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCdevice*, &DeviceList, &head, device)); + ATOMIC_STORE(&device->next, head, almemory_order_relaxed); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device)); } - TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName)); + TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName)); return device; } ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device) { - ALCdevice *list, *next, *nextdev; + ALCdevice *iter, *origdev, *nextdev; LockLists(); - list = ATOMIC_LOAD(&DeviceList); + iter = ATOMIC_LOAD_SEQ(&DeviceList); do { - if(list == device) + if(iter == device) break; - } while((list=list->next) != NULL); - if(!list || list->Type != Capture) + iter = ATOMIC_LOAD(&iter->next, almemory_order_relaxed); + } while(iter != NULL); + if(!iter || iter->Type != Capture) { - alcSetError(list, ALC_INVALID_DEVICE); + alcSetError(iter, ALC_INVALID_DEVICE); UnlockLists(); return ALC_FALSE; } - next = device; - nextdev = device->next; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALCdevice*, &DeviceList, &next, nextdev)) + origdev = device; + nextdev = ATOMIC_LOAD(&device->next, almemory_order_relaxed); + if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&DeviceList, &origdev, nextdev)) { + ALCdevice *list; do { - list = next; - next = device; - } while(!COMPARE_EXCHANGE(&list->next, &next, nextdev)); + list = origdev; + origdev = device; + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origdev, nextdev)); } UnlockLists(); @@ -3807,7 +4406,7 @@ ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) else { almtx_lock(&device->BackendLock); - if(!device->Connected) + if(!ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) alcSetError(device, ALC_INVALID_DEVICE); else if(!(device->Flags&DEVICE_RUNNING)) { @@ -3815,7 +4414,7 @@ ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) device->Flags |= DEVICE_RUNNING; else { - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device start failure"); alcSetError(device, ALC_INVALID_DEVICE); } } @@ -3891,47 +4490,11 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN } //Validate device - InitRef(&device->ref, 1); - device->Connected = ALC_TRUE; - device->Type = Loopback; - ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); - - device->Flags = 0; - VECTOR_INIT(device->Hrtf.List); - AL_STRING_INIT(device->Hrtf.Name); - device->Bs2b = NULL; - device->Uhj_Encoder = NULL; - device->Render_Mode = NormalRender; - AL_STRING_INIT(device->DeviceName); - device->Dry.Buffer = NULL; - device->Dry.NumChannels = 0; - device->FOAOut.Buffer = NULL; - device->FOAOut.NumChannels = 0; - device->RealOut.Buffer = NULL; - device->RealOut.NumChannels = 0; - - ATOMIC_INIT(&device->ContextList, NULL); - - device->ClockBase = 0; - device->SamplesDone = 0; + InitDevice(device, Loopback); device->SourcesMax = 256; - device->AuxiliaryEffectSlotMax = 4; - device->NumAuxSends = MAX_SENDS; - - InitUIntMap(&device->BufferMap, ~0); - InitUIntMap(&device->EffectMap, ~0); - InitUIntMap(&device->FilterMap, ~0); - - factory = ALCloopbackFactory_getFactory(); - device->Backend = V(factory,createBackend)(device, ALCbackend_Loopback); - if(!device->Backend) - { - al_free(device); - alcSetError(NULL, ALC_OUT_OF_MEMORY); - return NULL; - } - almtx_init(&device->BackendLock, almtx_plain); + device->AuxiliaryEffectSlotMax = 64; + device->NumAuxSends = DEFAULT_SENDS; //Set output format device->NumUpdates = 0; @@ -3941,28 +4504,43 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; device->IsHeadphones = AL_FALSE; - device->AmbiFmt = AmbiFormat_Default; + device->AmbiLayout = AmbiLayout_Default; + device->AmbiScale = AmbiNorm_Default; ConfigValueUInt(NULL, NULL, "sources", &device->SourcesMax); if(device->SourcesMax == 0) device->SourcesMax = 256; ConfigValueUInt(NULL, NULL, "slots", &device->AuxiliaryEffectSlotMax); - if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; + if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64; + else device->AuxiliaryEffectSlotMax = minu(device->AuxiliaryEffectSlotMax, INT_MAX); - ConfigValueUInt(NULL, NULL, "sends", &device->NumAuxSends); - if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS; + if(ConfigValueInt(NULL, NULL, "sends", &device->NumAuxSends)) + device->NumAuxSends = clampi( + DEFAULT_SENDS, 0, clampi(device->NumAuxSends, 0, MAX_SENDS) + ); device->NumStereoSources = 1; device->NumMonoSources = device->SourcesMax - device->NumStereoSources; + factory = ALCloopbackFactory_getFactory(); + device->Backend = V(factory,createBackend)(device, ALCbackend_Loopback); + if(!device->Backend) + { + al_free(device); + alcSetError(NULL, ALC_OUT_OF_MEMORY); + return NULL; + } + // Open the "backend" V(device->Backend,open)("Loopback"); + device->Limiter = CreateDeviceLimiter(device); + { - ALCdevice *head = ATOMIC_LOAD(&DeviceList); + ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList); do { - device->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCdevice*, &DeviceList, &head, device)); + ATOMIC_STORE(&device->next, head, almemory_order_relaxed); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device)); } TRACE("Created device %p\n", device); @@ -3983,9 +4561,7 @@ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device alcSetError(device, ALC_INVALID_VALUE); else { - if(IsValidALCType(type) && BytesFromDevFmt(type) > 0 && - IsValidALCChannels(channels) && ChannelsFromDevFmt(channels) > 0 && - freq >= MIN_OUTPUT_RATE) + if(IsValidALCType(type) && IsValidALCChannels(channels) && freq >= MIN_OUTPUT_RATE) ret = ALC_TRUE; } if(device) ALCdevice_DecRef(device); @@ -4005,7 +4581,11 @@ FORCE_ALIGN ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, AL else if(samples < 0 || (samples > 0 && buffer == NULL)) alcSetError(device, ALC_INVALID_VALUE); else + { + V0(device->Backend,lock)(); aluMixData(device, buffer, samples); + V0(device->Backend,unlock)(); + } if(device) ALCdevice_DecRef(device); } @@ -4048,16 +4628,16 @@ ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device) if((device->Flags&DEVICE_PAUSED)) { device->Flags &= ~DEVICE_PAUSED; - if(ATOMIC_LOAD(&device->ContextList) != NULL) + if(ATOMIC_LOAD_SEQ(&device->ContextList) != NULL) { if(V0(device->Backend,start)() != ALC_FALSE) device->Flags |= DEVICE_RUNNING; else { - alcSetError(device, ALC_INVALID_DEVICE); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device start failure"); V0(device->Backend,unlock)(); + alcSetError(device, ALC_INVALID_DEVICE); } } } @@ -4084,8 +4664,8 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetStringiSOFT(ALCdevice *device, ALCenum else switch(paramName) { case ALC_HRTF_SPECIFIER_SOFT: - if(index >= 0 && (size_t)index < VECTOR_SIZE(device->Hrtf.List)) - str = al_string_get_cstr(VECTOR_ELEM(device->Hrtf.List, index).name); + if(index >= 0 && (size_t)index < VECTOR_SIZE(device->HrtfList)) + str = alstr_get_cstr(VECTOR_ELEM(device->HrtfList, index).name); else alcSetError(device, ALC_INVALID_VALUE); break; @@ -4108,7 +4688,8 @@ ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCi ALCenum err; LockLists(); - if(!VerifyDevice(&device) || device->Type == Capture || !device->Connected) + if(!VerifyDevice(&device) || device->Type == Capture || + !ATOMIC_LOAD(&device->Connected, almemory_order_relaxed)) { UnlockLists(); alcSetError(device, ALC_INVALID_DEVICE); @@ -4127,7 +4708,7 @@ ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCi if(err == ALC_INVALID_DEVICE) { V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device start failure"); V0(device->Backend,unlock)(); } ALCdevice_DecRef(device); diff --git a/Engine/lib/openal-soft/Alc/ALu.c b/Engine/lib/openal-soft/Alc/ALu.c index cc01f3367..81914850c 100644 --- a/Engine/lib/openal-soft/Alc/ALu.c +++ b/Engine/lib/openal-soft/Alc/ALu.c @@ -34,27 +34,21 @@ #include "alu.h" #include "bs2b.h" #include "hrtf.h" +#include "mastering.h" #include "uhjfilter.h" #include "bformatdec.h" #include "static_assert.h" +#include "ringbuffer.h" +#include "filters/splitter.h" -#include "mixer_defs.h" +#include "mixer/defs.h" +#include "fpu_modes.h" +#include "cpu_caps.h" +#include "bsinc_inc.h" #include "backends/base.h" -struct ChanMap { - enum Channel channel; - ALfloat angle; - ALfloat elevation; -}; - -/* Cone scalar */ -ALfloat ConeScale = 1.0f; - -/* Localized Z scalar for mono sources */ -ALfloat ZScale = 1.0f; - extern inline ALfloat minf(ALfloat a, ALfloat b); extern inline ALfloat maxf(ALfloat a, ALfloat b); extern inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max); @@ -79,9 +73,12 @@ extern inline ALuint64 minu64(ALuint64 a, ALuint64 b); extern inline ALuint64 maxu64(ALuint64 a, ALuint64 b); extern inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max); +extern inline size_t minz(size_t a, size_t b); +extern inline size_t maxz(size_t a, size_t b); +extern inline size_t clampz(size_t val, size_t min, size_t max); + extern inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu); -extern inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALuint frac); -extern inline ALfloat resample_fir8(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat val5, ALfloat val6, ALfloat val7, ALuint frac); +extern inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu); extern inline void aluVectorSet(aluVector *restrict vector, ALfloat x, ALfloat y, ALfloat z, ALfloat w); @@ -93,6 +90,16 @@ extern inline void aluMatrixfSet(aluMatrixf *matrix, ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23, ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33); + +/* Cone scalar */ +ALfloat ConeScale = 1.0f; + +/* Localized Z scalar for mono sources */ +ALfloat ZScale = 1.0f; + +/* Force default speed of sound for distance-related reverb decay. */ +ALboolean OverrideReverbSpeedOfSound = AL_FALSE; + const aluMatrixf IdentityMatrixf = {{ { 1.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f }, @@ -101,21 +108,64 @@ const aluMatrixf IdentityMatrixf = {{ }}; +static void ClearArray(ALfloat f[MAX_OUTPUT_CHANNELS]) +{ + size_t i; + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + f[i] = 0.0f; +} + +struct ChanMap { + enum Channel channel; + ALfloat angle; + ALfloat elevation; +}; + +static HrtfDirectMixerFunc MixDirectHrtf = MixDirectHrtf_C; + + +void DeinitVoice(ALvoice *voice) +{ + al_free(ATOMIC_EXCHANGE_PTR_SEQ(&voice->Update, NULL)); +} + + static inline HrtfDirectMixerFunc SelectHrtfMixer(void) { -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return MixDirectHrtf_SSE; -#endif #ifdef HAVE_NEON if((CPUCapFlags&CPU_CAP_NEON)) return MixDirectHrtf_Neon; #endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixDirectHrtf_SSE; +#endif return MixDirectHrtf_C; } +/* Prior to VS2013, MSVC lacks the round() family of functions. */ +#if defined(_MSC_VER) && _MSC_VER < 1800 +static float roundf(float val) +{ + if(val < 0.0f) + return ceilf(val-0.5f); + return floorf(val+0.5f); +} +#endif + +/* This RNG method was created based on the math found in opusdec. It's quick, + * and starting with a seed value of 22222, is suitable for generating + * whitenoise. + */ +static inline ALuint dither_rng(ALuint *seed) +{ + *seed = (*seed * 96314165) + 907633515; + return *seed; +} + + static inline void aluCrossproduct(const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector) { outVector[0] = inVector1[1]*inVector2[2] - inVector1[2]*inVector2[1]; @@ -131,14 +181,16 @@ static inline ALfloat aluDotproduct(const aluVector *vec1, const aluVector *vec2 static ALfloat aluNormalize(ALfloat *vec) { ALfloat length = sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); - if(length > 0.0f) + if(length > FLT_EPSILON) { ALfloat inv_length = 1.0f/length; vec[0] *= inv_length; vec[1] *= inv_length; vec[2] *= inv_length; + return length; } - return length; + vec[0] = vec[1] = vec[2] = 0.0f; + return 0.0f; } static void aluMatrixfFloat3(ALfloat *vec, ALfloat w, const aluMatrixf *mtx) @@ -161,6 +213,135 @@ static aluVector aluMatrixfVector(const aluMatrixf *mtx, const aluVector *vec) } +void aluInit(void) +{ + MixDirectHrtf = SelectHrtfMixer(); +} + + +static void SendSourceStoppedEvent(ALCcontext *context, ALuint id) +{ + ALbitfieldSOFT enabledevt; + AsyncEvent evt; + size_t strpos; + ALuint scale; + + enabledevt = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_acquire); + if(!(enabledevt&EventType_SourceStateChange)) return; + + evt.EnumType = EventType_SourceStateChange; + evt.Type = AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT; + evt.ObjectId = id; + evt.Param = AL_STOPPED; + + /* Normally snprintf would be used, but this is called from the mixer and + * that function's not real-time safe, so we have to construct it manually. + */ + strcpy(evt.Message, "Source ID "); strpos = 10; + scale = 1000000000; + while(scale > 0 && scale > id) + scale /= 10; + while(scale > 0) + { + evt.Message[strpos++] = '0' + ((id/scale)%10); + scale /= 10; + } + strcpy(evt.Message+strpos, " state changed to AL_STOPPED"); + + if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&context->EventSem); +} + + +static void ProcessHrtf(ALCdevice *device, ALsizei SamplesToDo) +{ + DirectHrtfState *state; + int lidx, ridx; + ALsizei c; + + if(device->AmbiUp) + ambiup_process(device->AmbiUp, + device->Dry.Buffer, device->Dry.NumChannels, device->FOAOut.Buffer, + SamplesToDo + ); + + lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + state = device->Hrtf; + for(c = 0;c < device->Dry.NumChannels;c++) + { + MixDirectHrtf(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], + device->Dry.Buffer[c], state->Offset, state->IrSize, + state->Chan[c].Coeffs, state->Chan[c].Values, SamplesToDo + ); + } + state->Offset += SamplesToDo; +} + +static void ProcessAmbiDec(ALCdevice *device, ALsizei SamplesToDo) +{ + if(device->Dry.Buffer != device->FOAOut.Buffer) + bformatdec_upSample(device->AmbiDecoder, + device->Dry.Buffer, device->FOAOut.Buffer, device->FOAOut.NumChannels, + SamplesToDo + ); + bformatdec_process(device->AmbiDecoder, + device->RealOut.Buffer, device->RealOut.NumChannels, device->Dry.Buffer, + SamplesToDo + ); +} + +static void ProcessAmbiUp(ALCdevice *device, ALsizei SamplesToDo) +{ + ambiup_process(device->AmbiUp, + device->RealOut.Buffer, device->RealOut.NumChannels, device->FOAOut.Buffer, + SamplesToDo + ); +} + +static void ProcessUhj(ALCdevice *device, ALsizei SamplesToDo) +{ + int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + /* Encode to stereo-compatible 2-channel UHJ output. */ + EncodeUhj2(device->Uhj_Encoder, + device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], + device->Dry.Buffer, SamplesToDo + ); +} + +static void ProcessBs2b(ALCdevice *device, ALsizei SamplesToDo) +{ + int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + /* Apply binaural/crossfeed filter */ + bs2b_cross_feed(device->Bs2b, device->RealOut.Buffer[lidx], + device->RealOut.Buffer[ridx], SamplesToDo); +} + +void aluSelectPostProcess(ALCdevice *device) +{ + if(device->HrtfHandle) + device->PostProcess = ProcessHrtf; + else if(device->AmbiDecoder) + device->PostProcess = ProcessAmbiDec; + else if(device->AmbiUp) + device->PostProcess = ProcessAmbiUp; + else if(device->Uhj_Encoder) + device->PostProcess = ProcessUhj; + else if(device->Bs2b) + device->PostProcess = ProcessBs2b; + else + device->PostProcess = NULL; +} + + /* Prepares the interpolator for a given rate (determined by increment). A * result of AL_FALSE indicates that the filter output will completely cut * the input signal. @@ -169,91 +350,71 @@ static aluVector aluMatrixfVector(const aluMatrixf *mtx, const aluVector *vec) * modified for use with an interpolated increment for buttery-smooth pitch * changes. */ -static ALboolean BsincPrepare(const ALuint increment, BsincState *state) +void BsincPrepare(const ALuint increment, BsincState *state, const BSincTable *table) { - static const ALfloat scaleBase = 1.510578918e-01f, scaleRange = 1.177936623e+00f; - static const ALuint m[BSINC_SCALE_COUNT] = { 24, 24, 24, 24, 24, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 12 }; - static const ALuint to[4][BSINC_SCALE_COUNT] = - { - { 0, 24, 408, 792, 1176, 1560, 1944, 2328, 2648, 2968, 3288, 3544, 3800, 4056, 4248, 4440 }, - { 4632, 5016, 5400, 5784, 6168, 6552, 6936, 7320, 7640, 7960, 8280, 8536, 8792, 9048, 9240, 0 }, - { 0, 9432, 9816, 10200, 10584, 10968, 11352, 11736, 12056, 12376, 12696, 12952, 13208, 13464, 13656, 13848 }, - { 14040, 14424, 14808, 15192, 15576, 15960, 16344, 16728, 17048, 17368, 17688, 17944, 18200, 18456, 18648, 0 } - }; - static const ALuint tm[2][BSINC_SCALE_COUNT] = - { - { 0, 24, 24, 24, 24, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 12 }, - { 24, 24, 24, 24, 24, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 0 } - }; - ALfloat sf; - ALuint si, pi; - ALboolean uncut = AL_TRUE; + ALfloat sf = 0.0f; + ALsizei si = BSINC_SCALE_COUNT-1; if(increment > FRACTIONONE) { sf = (ALfloat)FRACTIONONE / increment; - if(sf < scaleBase) - { - /* Signal has been completely cut. The return result can be used - * to skip the filter (and output zeros) as an optimization. - */ - sf = 0.0f; - si = 0; - uncut = AL_FALSE; - } - else - { - sf = (BSINC_SCALE_COUNT - 1) * (sf - scaleBase) * scaleRange; - si = fastf2u(sf); - /* The interpolation factor is fit to this diagonally-symmetric - * curve to reduce the transition ripple caused by interpolating - * different scales of the sinc function. - */ - sf = 1.0f - cosf(asinf(sf - si)); - } - } - else - { - sf = 0.0f; - si = BSINC_SCALE_COUNT - 1; + sf = maxf(0.0f, (BSINC_SCALE_COUNT-1) * (sf-table->scaleBase) * table->scaleRange); + si = float2int(sf); + /* The interpolation factor is fit to this diagonally-symmetric curve + * to reduce the transition ripple caused by interpolating different + * scales of the sinc function. + */ + sf = 1.0f - cosf(asinf(sf - si)); } state->sf = sf; - state->m = m[si]; - state->l = -(ALint)((m[si] / 2) - 1); - /* The CPU cost of this table re-mapping could be traded for the memory - * cost of a complete table map (1024 elements large). - */ - for(pi = 0;pi < BSINC_PHASE_COUNT;pi++) - { - state->coeffs[pi].filter = &bsincTab[to[0][si] + tm[0][si]*pi]; - state->coeffs[pi].scDelta = &bsincTab[to[1][si] + tm[1][si]*pi]; - state->coeffs[pi].phDelta = &bsincTab[to[2][si] + tm[0][si]*pi]; - state->coeffs[pi].spDelta = &bsincTab[to[3][si] + tm[1][si]*pi]; - } - return uncut; + state->m = table->m[si]; + state->l = -((state->m/2) - 1); + state->filter = table->Tab + table->filterOffset[si]; } -static ALboolean CalcListenerParams(ALCcontext *Context) +static bool CalcContextParams(ALCcontext *Context) +{ + ALlistener *Listener = Context->Listener; + struct ALcontextProps *props; + + props = ATOMIC_EXCHANGE_PTR(&Context->Update, NULL, almemory_order_acq_rel); + if(!props) return false; + + Listener->Params.MetersPerUnit = props->MetersPerUnit; + + Listener->Params.DopplerFactor = props->DopplerFactor; + Listener->Params.SpeedOfSound = props->SpeedOfSound * props->DopplerVelocity; + if(!OverrideReverbSpeedOfSound) + Listener->Params.ReverbSpeedOfSound = Listener->Params.SpeedOfSound * + Listener->Params.MetersPerUnit; + + Listener->Params.SourceDistanceModel = props->SourceDistanceModel; + Listener->Params.DistanceModel = props->DistanceModel; + + ATOMIC_REPLACE_HEAD(struct ALcontextProps*, &Context->FreeContextProps, props); + return true; +} + +static bool CalcListenerParams(ALCcontext *Context) { ALlistener *Listener = Context->Listener; ALfloat N[3], V[3], U[3], P[3]; - struct ALlistenerProps *first; struct ALlistenerProps *props; aluVector vel; - props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &Listener->Update, NULL, almemory_order_acq_rel); - if(!props) return AL_FALSE; + props = ATOMIC_EXCHANGE_PTR(&Listener->Update, NULL, almemory_order_acq_rel); + if(!props) return false; /* AT then UP */ - N[0] = ATOMIC_LOAD(&props->Forward[0], almemory_order_relaxed); - N[1] = ATOMIC_LOAD(&props->Forward[1], almemory_order_relaxed); - N[2] = ATOMIC_LOAD(&props->Forward[2], almemory_order_relaxed); + N[0] = props->Forward[0]; + N[1] = props->Forward[1]; + N[2] = props->Forward[2]; aluNormalize(N); - V[0] = ATOMIC_LOAD(&props->Up[0], almemory_order_relaxed); - V[1] = ATOMIC_LOAD(&props->Up[1], almemory_order_relaxed); - V[2] = ATOMIC_LOAD(&props->Up[2], almemory_order_relaxed); + V[0] = props->Up[0]; + V[1] = props->Up[1]; + V[2] = props->Up[2]; aluNormalize(V); /* Build and normalize right-vector */ aluCrossproduct(N, V, U); @@ -266,661 +427,787 @@ static ALboolean CalcListenerParams(ALCcontext *Context) 0.0, 0.0, 0.0, 1.0 ); - P[0] = ATOMIC_LOAD(&props->Position[0], almemory_order_relaxed); - P[1] = ATOMIC_LOAD(&props->Position[1], almemory_order_relaxed); - P[2] = ATOMIC_LOAD(&props->Position[2], almemory_order_relaxed); + P[0] = props->Position[0]; + P[1] = props->Position[1]; + P[2] = props->Position[2]; aluMatrixfFloat3(P, 1.0, &Listener->Params.Matrix); aluMatrixfSetRow(&Listener->Params.Matrix, 3, -P[0], -P[1], -P[2], 1.0f); - aluVectorSet(&vel, ATOMIC_LOAD(&props->Velocity[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[2], almemory_order_relaxed), - 0.0f); + aluVectorSet(&vel, props->Velocity[0], props->Velocity[1], props->Velocity[2], 0.0f); Listener->Params.Velocity = aluMatrixfVector(&Listener->Params.Matrix, &vel); - Listener->Params.Gain = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed) * Context->GainBoost; - Listener->Params.MetersPerUnit = ATOMIC_LOAD(&props->MetersPerUnit, almemory_order_relaxed); + Listener->Params.Gain = props->Gain * Context->GainBoost; - Listener->Params.DopplerFactor = ATOMIC_LOAD(&props->DopplerFactor, almemory_order_relaxed); - Listener->Params.SpeedOfSound = ATOMIC_LOAD(&props->SpeedOfSound, almemory_order_relaxed) * - ATOMIC_LOAD(&props->DopplerVelocity, almemory_order_relaxed); - - Listener->Params.SourceDistanceModel = ATOMIC_LOAD(&props->SourceDistanceModel, almemory_order_relaxed); - Listener->Params.DistanceModel = ATOMIC_LOAD(&props->DistanceModel, almemory_order_relaxed); - - /* WARNING: A livelock is theoretically possible if another thread keeps - * changing the freelist head without giving this a chance to actually swap - * in the old container (practically impossible with this little code, - * but...). - */ - first = ATOMIC_LOAD(&Listener->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*, - &Listener->FreeList, &first, props) == 0); - - return AL_TRUE; + ATOMIC_REPLACE_HEAD(struct ALlistenerProps*, &Context->FreeListenerProps, props); + return true; } -static ALboolean CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device) +static bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) { - struct ALeffectslotProps *first; struct ALeffectslotProps *props; ALeffectState *state; - props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, NULL, almemory_order_acq_rel); - if(!props) return AL_FALSE; + props = ATOMIC_EXCHANGE_PTR(&slot->Update, NULL, almemory_order_acq_rel); + if(!props && !force) return false; - slot->Params.Gain = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed); - slot->Params.AuxSendAuto = ATOMIC_LOAD(&props->AuxSendAuto, almemory_order_relaxed); - slot->Params.EffectType = ATOMIC_LOAD(&props->Type, almemory_order_relaxed); - if(IsReverbEffect(slot->Params.EffectType)) + if(props) { - slot->Params.RoomRolloff = props->Props.Reverb.RoomRolloffFactor; - slot->Params.DecayTime = props->Props.Reverb.DecayTime; - slot->Params.AirAbsorptionGainHF = props->Props.Reverb.AirAbsorptionGainHF; + slot->Params.Gain = props->Gain; + slot->Params.AuxSendAuto = props->AuxSendAuto; + slot->Params.EffectType = props->Type; + slot->Params.EffectProps = props->Props; + if(IsReverbEffect(props->Type)) + { + slot->Params.RoomRolloff = props->Props.Reverb.RoomRolloffFactor; + slot->Params.DecayTime = props->Props.Reverb.DecayTime; + slot->Params.DecayLFRatio = props->Props.Reverb.DecayLFRatio; + slot->Params.DecayHFRatio = props->Props.Reverb.DecayHFRatio; + slot->Params.DecayHFLimit = props->Props.Reverb.DecayHFLimit; + slot->Params.AirAbsorptionGainHF = props->Props.Reverb.AirAbsorptionGainHF; + } + else + { + slot->Params.RoomRolloff = 0.0f; + slot->Params.DecayTime = 0.0f; + slot->Params.DecayLFRatio = 0.0f; + slot->Params.DecayHFRatio = 0.0f; + slot->Params.DecayHFLimit = AL_FALSE; + slot->Params.AirAbsorptionGainHF = 1.0f; + } + + /* Swap effect states. No need to play with the ref counts since they + * keep the same number of refs. + */ + state = props->State; + props->State = slot->Params.EffectState; + slot->Params.EffectState = state; + + ATOMIC_REPLACE_HEAD(struct ALeffectslotProps*, &context->FreeEffectslotProps, props); } else - { - slot->Params.RoomRolloff = 0.0f; - slot->Params.DecayTime = 0.0f; - slot->Params.AirAbsorptionGainHF = 1.0f; - } + state = slot->Params.EffectState; - /* Swap effect states. No need to play with the ref counts since they keep - * the same number of refs. - */ - state = ATOMIC_EXCHANGE(ALeffectState*, &props->State, slot->Params.EffectState, - almemory_order_relaxed); - slot->Params.EffectState = state; - - V(state,update)(device, slot, &props->Props); - - /* WARNING: A livelock is theoretically possible if another thread keeps - * changing the freelist head without giving this a chance to actually swap - * in the old container (practically impossible with this little code, - * but...). - */ - first = ATOMIC_LOAD(&slot->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*, - &slot->FreeList, &first, props) == 0); - - return AL_TRUE; + V(state,update)(context, slot, &slot->Params.EffectProps); + return true; } -static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) -{ - static const struct ChanMap MonoMap[1] = { - { FrontCenter, 0.0f, 0.0f } - }, RearMap[2] = { - { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, - { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) } - }, QuadMap[4] = { - { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f) }, - { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f) }, - { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f) } - }, X51Map[6] = { - { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, - { LFE, 0.0f, 0.0f }, - { SideLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f) }, - { SideRight, DEG2RAD( 110.0f), DEG2RAD(0.0f) } - }, X61Map[7] = { - { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, - { LFE, 0.0f, 0.0f }, - { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f) }, - { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f) }, - { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } - }, X71Map[8] = { - { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, - { LFE, 0.0f, 0.0f }, - { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, - { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) }, - { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f) }, - { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } - }; +static const struct ChanMap MonoMap[1] = { + { FrontCenter, 0.0f, 0.0f } +}, RearMap[2] = { + { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, + { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) } +}, QuadMap[4] = { + { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f) }, + { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f) }, + { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f) } +}, X51Map[6] = { + { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, + { LFE, 0.0f, 0.0f }, + { SideLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f) }, + { SideRight, DEG2RAD( 110.0f), DEG2RAD(0.0f) } +}, X61Map[7] = { + { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, + { LFE, 0.0f, 0.0f }, + { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f) }, + { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f) }, + { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } +}, X71Map[8] = { + { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, + { LFE, 0.0f, 0.0f }, + { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, + { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) }, + { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f) }, + { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } +}; - const ALCdevice *Device = ALContext->Device; - const ALlistener *Listener = ALContext->Listener; - ALfloat SourceVolume,ListenerGain,MinVolume,MaxVolume; - ALfloat DryGain, DryGainHF, DryGainLF; - ALfloat WetGain[MAX_SENDS]; - ALfloat WetGainHF[MAX_SENDS]; - ALfloat WetGainLF[MAX_SENDS]; - ALeffectslot *SendSlots[MAX_SENDS]; - ALuint NumSends, Frequency; - ALboolean Relative; - const struct ChanMap *chans = NULL; +static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev, + const ALfloat Distance, const ALfloat Spread, + const ALfloat DryGain, const ALfloat DryGainHF, + const ALfloat DryGainLF, const ALfloat *WetGain, + const ALfloat *WetGainLF, const ALfloat *WetGainHF, + ALeffectslot **SendSlots, const ALbuffer *Buffer, + const struct ALvoiceProps *props, const ALlistener *Listener, + const ALCdevice *Device) +{ struct ChanMap StereoMap[2] = { { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f) }, { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) } }; - ALuint num_channels = 0; - ALboolean DirectChannels; - ALboolean isbformat = AL_FALSE; - ALfloat Pitch; - ALuint i, j, c; + bool DirectChannels = props->DirectChannels; + const ALsizei NumSends = Device->NumAuxSends; + const ALuint Frequency = Device->Frequency; + const struct ChanMap *chans = NULL; + ALsizei num_channels = 0; + bool isbformat = false; + ALfloat downmix_gain = 1.0f; + ALsizei c, i; - /* Get device properties */ - NumSends = Device->NumAuxSends; - Frequency = Device->Frequency; - - /* Get listener properties */ - ListenerGain = Listener->Params.Gain; - - /* Get source properties */ - SourceVolume = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed); - MinVolume = ATOMIC_LOAD(&props->MinGain, almemory_order_relaxed); - MaxVolume = ATOMIC_LOAD(&props->MaxGain, almemory_order_relaxed); - Pitch = ATOMIC_LOAD(&props->Pitch, almemory_order_relaxed); - Relative = ATOMIC_LOAD(&props->HeadRelative, almemory_order_relaxed); - DirectChannels = ATOMIC_LOAD(&props->DirectChannels, almemory_order_relaxed); - - /* Convert counter-clockwise to clockwise. */ - StereoMap[0].angle = -ATOMIC_LOAD(&props->StereoPan[0], almemory_order_relaxed); - StereoMap[1].angle = -ATOMIC_LOAD(&props->StereoPan[1], almemory_order_relaxed); - - voice->DirectOut.Buffer = Device->Dry.Buffer; - voice->DirectOut.Channels = Device->Dry.NumChannels; - for(i = 0;i < NumSends;i++) - { - SendSlots[i] = ATOMIC_LOAD(&props->Send[i].Slot, almemory_order_relaxed); - if(!SendSlots[i] && i == 0) - SendSlots[i] = Device->DefaultSlot; - if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) - { - SendSlots[i] = NULL; - voice->SendOut[i].Buffer = NULL; - voice->SendOut[i].Channels = 0; - } - else - { - voice->SendOut[i].Buffer = SendSlots[i]->WetBuffer; - voice->SendOut[i].Channels = SendSlots[i]->NumChannels; - } - } - - /* Calculate the stepping value */ - Pitch *= (ALfloat)ALBuffer->Frequency / Frequency; - if(Pitch > (ALfloat)MAX_PITCH) - voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1); - BsincPrepare(voice->Step, &voice->SincState); - - /* Calculate gains */ - DryGain = clampf(SourceVolume, MinVolume, MaxVolume); - DryGain *= ATOMIC_LOAD(&props->Direct.Gain, almemory_order_relaxed) * ListenerGain; - DryGain = minf(DryGain, GAIN_MIX_MAX); - DryGainHF = ATOMIC_LOAD(&props->Direct.GainHF, almemory_order_relaxed); - DryGainLF = ATOMIC_LOAD(&props->Direct.GainLF, almemory_order_relaxed); - for(i = 0;i < NumSends;i++) - { - WetGain[i] = clampf(SourceVolume, MinVolume, MaxVolume); - WetGain[i] *= ATOMIC_LOAD(&props->Send[i].Gain, almemory_order_relaxed) * ListenerGain; - WetGain[i] = minf(WetGain[i], GAIN_MIX_MAX); - WetGainHF[i] = ATOMIC_LOAD(&props->Send[i].GainHF, almemory_order_relaxed); - WetGainLF[i] = ATOMIC_LOAD(&props->Send[i].GainLF, almemory_order_relaxed); - } - - switch(ALBuffer->FmtChannels) + switch(Buffer->FmtChannels) { case FmtMono: chans = MonoMap; num_channels = 1; + /* Mono buffers are never played direct. */ + DirectChannels = false; break; case FmtStereo: + /* Convert counter-clockwise to clockwise. */ + StereoMap[0].angle = -props->StereoPan[0]; + StereoMap[1].angle = -props->StereoPan[1]; + chans = StereoMap; num_channels = 2; + downmix_gain = 1.0f / 2.0f; break; case FmtRear: chans = RearMap; num_channels = 2; + downmix_gain = 1.0f / 2.0f; break; case FmtQuad: chans = QuadMap; num_channels = 4; + downmix_gain = 1.0f / 4.0f; break; case FmtX51: chans = X51Map; num_channels = 6; + /* NOTE: Excludes LFE. */ + downmix_gain = 1.0f / 5.0f; break; case FmtX61: chans = X61Map; num_channels = 7; + /* NOTE: Excludes LFE. */ + downmix_gain = 1.0f / 6.0f; break; case FmtX71: chans = X71Map; num_channels = 8; + /* NOTE: Excludes LFE. */ + downmix_gain = 1.0f / 7.0f; break; case FmtBFormat2D: num_channels = 3; - isbformat = AL_TRUE; - DirectChannels = AL_FALSE; + isbformat = true; + DirectChannels = false; break; case FmtBFormat3D: num_channels = 4; - isbformat = AL_TRUE; - DirectChannels = AL_FALSE; + isbformat = true; + DirectChannels = false; break; } + for(c = 0;c < num_channels;c++) + { + memset(&voice->Direct.Params[c].Hrtf.Target, 0, + sizeof(voice->Direct.Params[c].Hrtf.Target)); + ClearArray(voice->Direct.Params[c].Gains.Target); + } + for(i = 0;i < NumSends;i++) + { + for(c = 0;c < num_channels;c++) + ClearArray(voice->Send[i].Params[c].Gains.Target); + } + + voice->Flags &= ~(VOICE_HAS_HRTF | VOICE_HAS_NFC); if(isbformat) { - ALfloat N[3], V[3], U[3]; - aluMatrixf matrix; - ALfloat scale; + /* Special handling for B-Format sources. */ - /* AT then UP */ - N[0] = ATOMIC_LOAD(&props->Orientation[0][0], almemory_order_relaxed); - N[1] = ATOMIC_LOAD(&props->Orientation[0][1], almemory_order_relaxed); - N[2] = ATOMIC_LOAD(&props->Orientation[0][2], almemory_order_relaxed); - aluNormalize(N); - V[0] = ATOMIC_LOAD(&props->Orientation[1][0], almemory_order_relaxed); - V[1] = ATOMIC_LOAD(&props->Orientation[1][1], almemory_order_relaxed); - V[2] = ATOMIC_LOAD(&props->Orientation[1][2], almemory_order_relaxed); - aluNormalize(V); - if(!Relative) + if(Distance > FLT_EPSILON) { - const aluMatrixf *lmatrix = &Listener->Params.Matrix; - aluMatrixfFloat3(N, 0.0f, lmatrix); - aluMatrixfFloat3(V, 0.0f, lmatrix); - } - /* Build and normalize right-vector */ - aluCrossproduct(N, V, U); - aluNormalize(U); - - /* Build a rotate + conversion matrix (FuMa -> ACN+N3D). */ - scale = 1.732050808f; - aluMatrixfSet(&matrix, - 1.414213562f, 0.0f, 0.0f, 0.0f, - 0.0f, -N[0]*scale, N[1]*scale, -N[2]*scale, - 0.0f, U[0]*scale, -U[1]*scale, U[2]*scale, - 0.0f, -V[0]*scale, V[1]*scale, -V[2]*scale - ); - - voice->DirectOut.Buffer = Device->FOAOut.Buffer; - voice->DirectOut.Channels = Device->FOAOut.NumChannels; - for(c = 0;c < num_channels;c++) - ComputeFirstOrderGains(Device->FOAOut, matrix.m[c], DryGain, - voice->Chan[c].Direct.Gains.Target); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - for(c = 0;c < num_channels;c++) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - } - else - { - for(c = 0;c < num_channels;c++) - { - const ALeffectslot *Slot = SendSlots[i]; - ComputeFirstOrderGainsBF(Slot->ChanMap, Slot->NumChannels, matrix.m[c], - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } - } - } - - voice->IsHrtf = AL_FALSE; - } - else - { - ALfloat coeffs[MAX_AMBI_COEFFS]; - - if(DirectChannels) - { - /* Skip the virtual channels and write inputs to the real output. */ - voice->DirectOut.Buffer = Device->RealOut.Buffer; - voice->DirectOut.Channels = Device->RealOut.NumChannels; - for(c = 0;c < num_channels;c++) - { - int idx; - for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) - voice->Chan[c].Direct.Gains.Target[j] = 0.0f; - if((idx=GetChannelIdxByName(Device->RealOut, chans[c].channel)) != -1) - voice->Chan[c].Direct.Gains.Target[idx] = DryGain; - } - - /* Auxiliary sends still use normal panning since they mix to B-Format, which can't - * channel-match. */ - for(c = 0;c < num_channels;c++) - { - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } - } - } - - voice->IsHrtf = AL_FALSE; - } - else if(Device->Render_Mode == HrtfRender) - { - /* Full HRTF rendering. Skip the virtual channels and render each - * input channel to the real outputs. + /* Panning a B-Format sound toward some direction is easy. Just pan + * the first (W) channel as a normal mono sound and silence the + * others. */ - voice->DirectOut.Buffer = Device->RealOut.Buffer; - voice->DirectOut.Channels = Device->RealOut.NumChannels; - for(c = 0;c < num_channels;c++) + ALfloat coeffs[MAX_AMBI_COEFFS]; + + if(Device->AvgSpeakerDist > 0.0f) { - if(chans[c].channel == LFE) - { - /* Skip LFE */ - voice->Chan[c].Direct.Hrtf.Target.Delay[0] = 0; - voice->Chan[c].Direct.Hrtf.Target.Delay[1] = 0; - for(i = 0;i < HRIR_LENGTH;i++) - { - voice->Chan[c].Direct.Hrtf.Target.Coeffs[i][0] = 0.0f; - voice->Chan[c].Direct.Hrtf.Target.Coeffs[i][1] = 0.0f; - } + ALfloat mdist = Distance * Listener->Params.MetersPerUnit; + ALfloat w0 = SPEEDOFSOUNDMETRESPERSEC / + (mdist * (ALfloat)Device->Frequency); + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (Device->AvgSpeakerDist * (ALfloat)Device->Frequency); + /* Clamp w0 for really close distances, to prevent excessive + * bass. + */ + w0 = minf(w0, w1*4.0f); - for(i = 0;i < NumSends;i++) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } + /* Only need to adjust the first channel of a B-Format source. */ + NfcFilterAdjust(&voice->Direct.Params[0].NFCtrlFilter, w0); - continue; - } - - /* Get the static HRIR coefficients and delays for this channel. */ - GetHrtfCoeffs(Device->Hrtf.Handle, - chans[c].elevation, chans[c].angle, 0.0f, DryGain, - voice->Chan[c].Direct.Hrtf.Target.Coeffs, - voice->Chan[c].Direct.Hrtf.Target.Delay - ); - - /* Normal panning for auxiliary sends. */ - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } - } + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = Device->Dry.NumChannelsPerOrder[i]; + voice->Flags |= VOICE_HAS_NFC; } - voice->IsHrtf = AL_TRUE; + if(Device->Render_Mode == StereoPair) + CalcAnglePairwiseCoeffs(Azi, Elev, Spread, coeffs); + else + CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + + /* NOTE: W needs to be scaled by sqrt(2) due to FuMa normalization. */ + ComputeDryPanGains(&Device->Dry, coeffs, DryGain*1.414213562f, + voice->Direct.Params[0].Gains.Target); + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i]*1.414213562f, voice->Send[i].Params[0].Gains.Target + ); + } } else { - /* Non-HRTF rendering. Use normal panning to the output. */ + /* Local B-Format sources have their XYZ channels rotated according + * to the orientation. + */ + const ALfloat sqrt_2 = sqrtf(2.0f); + const ALfloat sqrt_3 = sqrtf(3.0f); + ALfloat N[3], V[3], U[3]; + aluMatrixf matrix; + + if(Device->AvgSpeakerDist > 0.0f) + { + /* NOTE: The NFCtrlFilters were created with a w0 of 0, which + * is what we want for FOA input. The first channel may have + * been previously re-adjusted if panned, so reset it. + */ + NfcFilterAdjust(&voice->Direct.Params[0].NFCtrlFilter, 0.0f); + + voice->Direct.ChannelsPerOrder[0] = 1; + voice->Direct.ChannelsPerOrder[1] = mini(voice->Direct.Channels-1, 3); + for(i = 2;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = 0; + voice->Flags |= VOICE_HAS_NFC; + } + + /* AT then UP */ + N[0] = props->Orientation[0][0]; + N[1] = props->Orientation[0][1]; + N[2] = props->Orientation[0][2]; + aluNormalize(N); + V[0] = props->Orientation[1][0]; + V[1] = props->Orientation[1][1]; + V[2] = props->Orientation[1][2]; + aluNormalize(V); + if(!props->HeadRelative) + { + const aluMatrixf *lmatrix = &Listener->Params.Matrix; + aluMatrixfFloat3(N, 0.0f, lmatrix); + aluMatrixfFloat3(V, 0.0f, lmatrix); + } + /* Build and normalize right-vector */ + aluCrossproduct(N, V, U); + aluNormalize(U); + + /* Build a rotate + conversion matrix (FuMa -> ACN+N3D). NOTE: This + * matrix is transposed, for the inputs to align on the rows and + * outputs on the columns. + */ + aluMatrixfSet(&matrix, + // ACN0 ACN1 ACN2 ACN3 + sqrt_2, 0.0f, 0.0f, 0.0f, // Ambi W + 0.0f, -N[0]*sqrt_3, N[1]*sqrt_3, -N[2]*sqrt_3, // Ambi X + 0.0f, U[0]*sqrt_3, -U[1]*sqrt_3, U[2]*sqrt_3, // Ambi Y + 0.0f, -V[0]*sqrt_3, V[1]*sqrt_3, -V[2]*sqrt_3 // Ambi Z + ); + + voice->Direct.Buffer = Device->FOAOut.Buffer; + voice->Direct.Channels = Device->FOAOut.NumChannels; + for(c = 0;c < num_channels;c++) + ComputeFirstOrderGains(&Device->FOAOut, matrix.m[c], DryGain, + voice->Direct.Params[c].Gains.Target); + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + { + for(c = 0;c < num_channels;c++) + ComputeFirstOrderGainsBF(Slot->ChanMap, Slot->NumChannels, + matrix.m[c], WetGain[i], voice->Send[i].Params[c].Gains.Target + ); + } + } + } + } + else if(DirectChannels) + { + /* Direct source channels always play local. Skip the virtual channels + * and write inputs to the matching real outputs. + */ + voice->Direct.Buffer = Device->RealOut.Buffer; + voice->Direct.Channels = Device->RealOut.NumChannels; + + for(c = 0;c < num_channels;c++) + { + int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); + if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; + } + + /* Auxiliary sends still use normal channel panning since they mix to + * B-Format, which can't channel-match. + */ + for(c = 0;c < num_channels;c++) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i], voice->Send[i].Params[c].Gains.Target + ); + } + } + } + else if(Device->Render_Mode == HrtfRender) + { + /* Full HRTF rendering. Skip the virtual channels and render to the + * real outputs. + */ + voice->Direct.Buffer = Device->RealOut.Buffer; + voice->Direct.Channels = Device->RealOut.NumChannels; + + if(Distance > FLT_EPSILON) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + + /* Get the HRIR coefficients and delays just once, for the given + * source direction. + */ + GetHrtfCoeffs(Device->HrtfHandle, Elev, Azi, Spread, + voice->Direct.Params[0].Hrtf.Target.Coeffs, + voice->Direct.Params[0].Hrtf.Target.Delay); + voice->Direct.Params[0].Hrtf.Target.Gain = DryGain * downmix_gain; + + /* Remaining channels use the same results as the first. */ + for(c = 1;c < num_channels;c++) + { + /* Skip LFE */ + if(chans[c].channel != LFE) + voice->Direct.Params[c].Hrtf.Target = voice->Direct.Params[0].Hrtf.Target; + } + + /* Calculate the directional coefficients once, which apply to all + * input channels of the source sends. + */ + CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + for(c = 0;c < num_channels;c++) + { + /* Skip LFE */ + if(chans[c].channel != LFE) + ComputePanningGainsBF(Slot->ChanMap, + Slot->NumChannels, coeffs, WetGain[i] * downmix_gain, + voice->Send[i].Params[c].Gains.Target + ); + } + } + } + else + { + /* Local sources on HRTF play with each channel panned to its + * relative location around the listener, providing "virtual + * speaker" responses. + */ + for(c = 0;c < num_channels;c++) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + + if(chans[c].channel == LFE) + { + /* Skip LFE */ + continue; + } + + /* Get the HRIR coefficients and delays for this channel + * position. + */ + GetHrtfCoeffs(Device->HrtfHandle, + chans[c].elevation, chans[c].angle, Spread, + voice->Direct.Params[c].Hrtf.Target.Coeffs, + voice->Direct.Params[c].Hrtf.Target.Delay + ); + voice->Direct.Params[c].Hrtf.Target.Gain = DryGain; + + /* Normal panning for auxiliary sends. */ + CalcAngleCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i], voice->Send[i].Params[c].Gains.Target + ); + } + } + } + + voice->Flags |= VOICE_HAS_HRTF; + } + else + { + /* Non-HRTF rendering. Use normal panning to the output. */ + + if(Distance > FLT_EPSILON) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + ALfloat w0 = 0.0f; + + /* Calculate NFC filter coefficient if needed. */ + if(Device->AvgSpeakerDist > 0.0f) + { + ALfloat mdist = Distance * Listener->Params.MetersPerUnit; + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (Device->AvgSpeakerDist * (ALfloat)Device->Frequency); + w0 = SPEEDOFSOUNDMETRESPERSEC / + (mdist * (ALfloat)Device->Frequency); + /* Clamp w0 for really close distances, to prevent excessive + * bass. + */ + w0 = minf(w0, w1*4.0f); + + /* Adjust NFC filters. */ + for(c = 0;c < num_channels;c++) + NfcFilterAdjust(&voice->Direct.Params[c].NFCtrlFilter, w0); + + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = Device->Dry.NumChannelsPerOrder[i]; + voice->Flags |= VOICE_HAS_NFC; + } + + /* Calculate the directional coefficients once, which apply to all + * input channels. + */ + if(Device->Render_Mode == StereoPair) + CalcAnglePairwiseCoeffs(Azi, Elev, Spread, coeffs); + else + CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + for(c = 0;c < num_channels;c++) { /* Special-case LFE */ if(chans[c].channel == LFE) { - for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) - voice->Chan[c].Direct.Gains.Target[j] = 0.0f; if(Device->Dry.Buffer == Device->RealOut.Buffer) { - int idx; - if((idx=GetChannelIdxByName(Device->RealOut, chans[c].channel)) != -1) - voice->Chan[c].Direct.Gains.Target[idx] = DryGain; + int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); + if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; } + continue; + } - for(i = 0;i < NumSends;i++) + ComputeDryPanGains(&Device->Dry, + coeffs, DryGain * downmix_gain, voice->Direct.Params[c].Gains.Target + ); + } + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + for(c = 0;c < num_channels;c++) { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; + /* Skip LFE */ + if(chans[c].channel != LFE) + ComputePanningGainsBF(Slot->ChanMap, + Slot->NumChannels, coeffs, WetGain[i] * downmix_gain, + voice->Send[i].Params[c].Gains.Target + ); + } + } + } + else + { + ALfloat w0 = 0.0f; + + if(Device->AvgSpeakerDist > 0.0f) + { + /* If the source distance is 0, set w0 to w1 to act as a pass- + * through. We still want to pass the signal through the + * filters so they keep an appropriate history, in case the + * source moves away from the listener. + */ + w0 = SPEEDOFSOUNDMETRESPERSEC / + (Device->AvgSpeakerDist * (ALfloat)Device->Frequency); + + for(c = 0;c < num_channels;c++) + NfcFilterAdjust(&voice->Direct.Params[c].NFCtrlFilter, w0); + + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = Device->Dry.NumChannelsPerOrder[i]; + voice->Flags |= VOICE_HAS_NFC; + } + + for(c = 0;c < num_channels;c++) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + + /* Special-case LFE */ + if(chans[c].channel == LFE) + { + if(Device->Dry.Buffer == Device->RealOut.Buffer) + { + int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); + if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; } continue; } if(Device->Render_Mode == StereoPair) - { - /* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */ - ALfloat x = sinf(chans[c].angle) * cosf(chans[c].elevation); - coeffs[0] = clampf(-x, -0.5f, 0.5f) + 0.5f; - voice->Chan[c].Direct.Gains.Target[0] = coeffs[0] * DryGain; - voice->Chan[c].Direct.Gains.Target[1] = (1.0f-coeffs[0]) * DryGain; - for(j = 2;j < MAX_OUTPUT_CHANNELS;j++) - voice->Chan[c].Direct.Gains.Target[j] = 0.0f; - - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - } + CalcAnglePairwiseCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); else - { - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, DryGain, - voice->Chan[c].Direct.Gains.Target); - } + CalcAngleCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); + ComputeDryPanGains(&Device->Dry, + coeffs, DryGain, voice->Direct.Params[c].Gains.Target + ); for(i = 0;i < NumSends;i++) { - if(!SendSlots[i]) - { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i], voice->Send[i].Params[c].Gains.Target + ); } } - - voice->IsHrtf = AL_FALSE; } } { - ALfloat hfscale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) / - Frequency; - DryGainHF = maxf(DryGainHF, 0.0001f); - DryGainLF = maxf(DryGainLF, 0.0001f); - for(c = 0;c < num_channels;c++) + ALfloat hfScale = props->Direct.HFReference / Frequency; + ALfloat lfScale = props->Direct.LFReference / Frequency; + ALfloat gainHF = maxf(DryGainHF, 0.001f); /* Limit -60dB */ + ALfloat gainLF = maxf(DryGainLF, 0.001f); + + voice->Direct.FilterType = AF_None; + if(gainHF != 1.0f) voice->Direct.FilterType |= AF_LowPass; + if(gainLF != 1.0f) voice->Direct.FilterType |= AF_HighPass; + BiquadFilter_setParams( + &voice->Direct.Params[0].LowPass, BiquadType_HighShelf, + gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f) + ); + BiquadFilter_setParams( + &voice->Direct.Params[0].HighPass, BiquadType_LowShelf, + gainLF, lfScale, calc_rcpQ_from_slope(gainLF, 1.0f) + ); + for(c = 1;c < num_channels;c++) { - voice->Chan[c].Direct.FilterType = AF_None; - if(DryGainHF != 1.0f) voice->Chan[c].Direct.FilterType |= AF_LowPass; - if(DryGainLF != 1.0f) voice->Chan[c].Direct.FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[c].Direct.LowPass, ALfilterType_HighShelf, - DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[c].Direct.HighPass, ALfilterType_LowShelf, - DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f) - ); + BiquadFilter_copyParams(&voice->Direct.Params[c].LowPass, + &voice->Direct.Params[0].LowPass); + BiquadFilter_copyParams(&voice->Direct.Params[c].HighPass, + &voice->Direct.Params[0].HighPass); } } for(i = 0;i < NumSends;i++) { - ALfloat hfscale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) / - Frequency; - WetGainHF[i] = maxf(WetGainHF[i], 0.0001f); - WetGainLF[i] = maxf(WetGainLF[i], 0.0001f); - for(c = 0;c < num_channels;c++) + ALfloat hfScale = props->Send[i].HFReference / Frequency; + ALfloat lfScale = props->Send[i].LFReference / Frequency; + ALfloat gainHF = maxf(WetGainHF[i], 0.001f); + ALfloat gainLF = maxf(WetGainLF[i], 0.001f); + + voice->Send[i].FilterType = AF_None; + if(gainHF != 1.0f) voice->Send[i].FilterType |= AF_LowPass; + if(gainLF != 1.0f) voice->Send[i].FilterType |= AF_HighPass; + BiquadFilter_setParams( + &voice->Send[i].Params[0].LowPass, BiquadType_HighShelf, + gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f) + ); + BiquadFilter_setParams( + &voice->Send[i].Params[0].HighPass, BiquadType_LowShelf, + gainLF, lfScale, calc_rcpQ_from_slope(gainLF, 1.0f) + ); + for(c = 1;c < num_channels;c++) { - voice->Chan[c].Send[i].FilterType = AF_None; - if(WetGainHF[i] != 1.0f) voice->Chan[c].Send[i].FilterType |= AF_LowPass; - if(WetGainLF[i] != 1.0f) voice->Chan[c].Send[i].FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[c].Send[i].LowPass, ALfilterType_HighShelf, - WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[c].Send[i].HighPass, ALfilterType_LowShelf, - WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f) - ); + BiquadFilter_copyParams(&voice->Send[i].Params[c].LowPass, + &voice->Send[i].Params[0].LowPass); + BiquadFilter_copyParams(&voice->Send[i].Params[c].HighPass, + &voice->Send[i].Params[0].HighPass); } } } -static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) +static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) { const ALCdevice *Device = ALContext->Device; const ALlistener *Listener = ALContext->Listener; - aluVector Position, Velocity, Direction, SourceToListener; - ALfloat InnerAngle,OuterAngle,Distance,ClampedDist; - ALfloat MinVolume,MaxVolume,MinDist,MaxDist,Rolloff; - ALfloat SourceVolume,ListenerGain; - ALfloat DopplerFactor, SpeedOfSound; - ALfloat AirAbsorptionFactor; - ALfloat RoomAirAbsorption[MAX_SENDS]; - ALeffectslot *SendSlots[MAX_SENDS]; - ALfloat Attenuation; - ALfloat RoomAttenuation[MAX_SENDS]; - ALfloat MetersPerUnit; - ALfloat RoomRolloffBase; - ALfloat RoomRolloff[MAX_SENDS]; - ALfloat DecayDistance[MAX_SENDS]; - ALfloat DryGain; - ALfloat DryGainHF; - ALfloat DryGainLF; - ALboolean DryGainHFAuto; + ALfloat DryGain, DryGainHF, DryGainLF; ALfloat WetGain[MAX_SENDS]; ALfloat WetGainHF[MAX_SENDS]; ALfloat WetGainLF[MAX_SENDS]; - ALboolean WetGainAuto; - ALboolean WetGainHFAuto; + ALeffectslot *SendSlots[MAX_SENDS]; ALfloat Pitch; - ALuint Frequency; - ALint NumSends; - ALint i; + ALsizei i; - DryGainHF = 1.0f; - DryGainLF = 1.0f; - for(i = 0;i < MAX_SENDS;i++) + voice->Direct.Buffer = Device->Dry.Buffer; + voice->Direct.Channels = Device->Dry.NumChannels; + for(i = 0;i < Device->NumAuxSends;i++) { - WetGainHF[i] = 1.0f; - WetGainLF[i] = 1.0f; + SendSlots[i] = props->Send[i].Slot; + if(!SendSlots[i] && i == 0) + SendSlots[i] = ALContext->DefaultSlot; + if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) + { + SendSlots[i] = NULL; + voice->Send[i].Buffer = NULL; + voice->Send[i].Channels = 0; + } + else + { + voice->Send[i].Buffer = SendSlots[i]->WetBuffer; + voice->Send[i].Channels = SendSlots[i]->NumChannels; + } } - /* Get context/device properties */ - DopplerFactor = Listener->Params.DopplerFactor; - SpeedOfSound = Listener->Params.SpeedOfSound; - NumSends = Device->NumAuxSends; - Frequency = Device->Frequency; + /* Calculate the stepping value */ + Pitch = (ALfloat)ALBuffer->Frequency/(ALfloat)Device->Frequency * props->Pitch; + if(Pitch > (ALfloat)MAX_PITCH) + voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch * FRACTIONONE), 1); + if(props->Resampler == BSinc24Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24); + else if(props->Resampler == BSinc12Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc12); + voice->Resampler = SelectResampler(props->Resampler); - /* Get listener properties */ - ListenerGain = Listener->Params.Gain; - MetersPerUnit = Listener->Params.MetersPerUnit; + /* Calculate gains */ + DryGain = clampf(props->Gain, props->MinGain, props->MaxGain); + DryGain *= props->Direct.Gain * Listener->Params.Gain; + DryGain = minf(DryGain, GAIN_MIX_MAX); + DryGainHF = props->Direct.GainHF; + DryGainLF = props->Direct.GainLF; + for(i = 0;i < Device->NumAuxSends;i++) + { + WetGain[i] = clampf(props->Gain, props->MinGain, props->MaxGain); + WetGain[i] *= props->Send[i].Gain * Listener->Params.Gain; + WetGain[i] = minf(WetGain[i], GAIN_MIX_MAX); + WetGainHF[i] = props->Send[i].GainHF; + WetGainLF[i] = props->Send[i].GainLF; + } - /* Get source properties */ - SourceVolume = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed); - MinVolume = ATOMIC_LOAD(&props->MinGain, almemory_order_relaxed); - MaxVolume = ATOMIC_LOAD(&props->MaxGain, almemory_order_relaxed); - Pitch = ATOMIC_LOAD(&props->Pitch, almemory_order_relaxed); - aluVectorSet(&Position, ATOMIC_LOAD(&props->Position[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Position[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Position[2], almemory_order_relaxed), - 1.0f); - aluVectorSet(&Direction, ATOMIC_LOAD(&props->Direction[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Direction[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Direction[2], almemory_order_relaxed), - 0.0f); - aluVectorSet(&Velocity, ATOMIC_LOAD(&props->Velocity[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[2], almemory_order_relaxed), - 0.0f); - MinDist = ATOMIC_LOAD(&props->RefDistance, almemory_order_relaxed); - MaxDist = ATOMIC_LOAD(&props->MaxDistance, almemory_order_relaxed); - Rolloff = ATOMIC_LOAD(&props->RollOffFactor, almemory_order_relaxed); - DopplerFactor *= ATOMIC_LOAD(&props->DopplerFactor, almemory_order_relaxed); - InnerAngle = ATOMIC_LOAD(&props->InnerAngle, almemory_order_relaxed); - OuterAngle = ATOMIC_LOAD(&props->OuterAngle, almemory_order_relaxed); - AirAbsorptionFactor = ATOMIC_LOAD(&props->AirAbsorptionFactor, almemory_order_relaxed); - DryGainHFAuto = ATOMIC_LOAD(&props->DryGainHFAuto, almemory_order_relaxed); - WetGainAuto = ATOMIC_LOAD(&props->WetGainAuto, almemory_order_relaxed); - WetGainHFAuto = ATOMIC_LOAD(&props->WetGainHFAuto, almemory_order_relaxed); - RoomRolloffBase = ATOMIC_LOAD(&props->RoomRolloffFactor, almemory_order_relaxed); + CalcPanningAndFilters(voice, 0.0f, 0.0f, 0.0f, 0.0f, DryGain, DryGainHF, DryGainLF, WetGain, + WetGainLF, WetGainHF, SendSlots, ALBuffer, props, Listener, Device); +} - voice->DirectOut.Buffer = Device->Dry.Buffer; - voice->DirectOut.Channels = Device->Dry.NumChannels; +static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) +{ + const ALCdevice *Device = ALContext->Device; + const ALlistener *Listener = ALContext->Listener; + const ALsizei NumSends = Device->NumAuxSends; + aluVector Position, Velocity, Direction, SourceToListener; + ALfloat Distance, ClampedDist, DopplerFactor; + ALeffectslot *SendSlots[MAX_SENDS]; + ALfloat RoomRolloff[MAX_SENDS]; + ALfloat DecayDistance[MAX_SENDS]; + ALfloat DecayLFDistance[MAX_SENDS]; + ALfloat DecayHFDistance[MAX_SENDS]; + ALfloat DryGain, DryGainHF, DryGainLF; + ALfloat WetGain[MAX_SENDS]; + ALfloat WetGainHF[MAX_SENDS]; + ALfloat WetGainLF[MAX_SENDS]; + bool directional; + ALfloat ev, az; + ALfloat spread; + ALfloat Pitch; + ALint i; + + /* Set mixing buffers and get send parameters. */ + voice->Direct.Buffer = Device->Dry.Buffer; + voice->Direct.Channels = Device->Dry.NumChannels; for(i = 0;i < NumSends;i++) { - SendSlots[i] = ATOMIC_LOAD(&props->Send[i].Slot, almemory_order_relaxed); - + SendSlots[i] = props->Send[i].Slot; if(!SendSlots[i] && i == 0) - SendSlots[i] = Device->DefaultSlot; + SendSlots[i] = ALContext->DefaultSlot; if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) { SendSlots[i] = NULL; RoomRolloff[i] = 0.0f; DecayDistance[i] = 0.0f; - RoomAirAbsorption[i] = 1.0f; + DecayLFDistance[i] = 0.0f; + DecayHFDistance[i] = 0.0f; } else if(SendSlots[i]->Params.AuxSendAuto) { - RoomRolloff[i] = SendSlots[i]->Params.RoomRolloff + RoomRolloffBase; + RoomRolloff[i] = SendSlots[i]->Params.RoomRolloff + props->RoomRolloffFactor; + /* Calculate the distances to where this effect's decay reaches + * -60dB. + */ DecayDistance[i] = SendSlots[i]->Params.DecayTime * - SPEEDOFSOUNDMETRESPERSEC; - RoomAirAbsorption[i] = SendSlots[i]->Params.AirAbsorptionGainHF; + Listener->Params.ReverbSpeedOfSound; + DecayLFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayLFRatio; + DecayHFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayHFRatio; + if(SendSlots[i]->Params.DecayHFLimit) + { + ALfloat airAbsorption = SendSlots[i]->Params.AirAbsorptionGainHF; + if(airAbsorption < 1.0f) + { + /* Calculate the distance to where this effect's air + * absorption reaches -60dB, and limit the effect's HF + * decay distance (so it doesn't take any longer to decay + * than the air would allow). + */ + ALfloat absorb_dist = log10f(REVERB_DECAY_GAIN) / log10f(airAbsorption); + DecayHFDistance[i] = minf(absorb_dist, DecayHFDistance[i]); + } + } } else { /* If the slot's auxiliary send auto is off, the data sent to the * effect slot is the same as the dry path, sans filter effects */ - RoomRolloff[i] = Rolloff; + RoomRolloff[i] = props->RolloffFactor; DecayDistance[i] = 0.0f; - RoomAirAbsorption[i] = AIRABSORBGAINHF; + DecayLFDistance[i] = 0.0f; + DecayHFDistance[i] = 0.0f; } if(!SendSlots[i]) { - voice->SendOut[i].Buffer = NULL; - voice->SendOut[i].Channels = 0; + voice->Send[i].Buffer = NULL; + voice->Send[i].Channels = 0; } else { - voice->SendOut[i].Buffer = SendSlots[i]->WetBuffer; - voice->SendOut[i].Channels = SendSlots[i]->NumChannels; + voice->Send[i].Buffer = SendSlots[i]->WetBuffer; + voice->Send[i].Channels = SendSlots[i]->NumChannels; } } /* Transform source to listener space (convert to head relative) */ - if(ATOMIC_LOAD(&props->HeadRelative, almemory_order_relaxed) == AL_FALSE) + aluVectorSet(&Position, props->Position[0], props->Position[1], props->Position[2], 1.0f); + aluVectorSet(&Direction, props->Direction[0], props->Direction[1], props->Direction[2], 0.0f); + aluVectorSet(&Velocity, props->Velocity[0], props->Velocity[1], props->Velocity[2], 0.0f); + if(props->HeadRelative == AL_FALSE) { const aluMatrixf *Matrix = &Listener->Params.Matrix; /* Transform source vectors */ @@ -937,573 +1224,569 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro Velocity.v[2] += lvelocity->v[2]; } - aluNormalize(Direction.v); + directional = aluNormalize(Direction.v) > 0.0f; SourceToListener.v[0] = -Position.v[0]; SourceToListener.v[1] = -Position.v[1]; SourceToListener.v[2] = -Position.v[2]; SourceToListener.v[3] = 0.0f; Distance = aluNormalize(SourceToListener.v); + /* Initial source gain */ + DryGain = props->Gain; + DryGainHF = 1.0f; + DryGainLF = 1.0f; + for(i = 0;i < NumSends;i++) + { + WetGain[i] = props->Gain; + WetGainHF[i] = 1.0f; + WetGainLF[i] = 1.0f; + } + /* Calculate distance attenuation */ ClampedDist = Distance; - Attenuation = 1.0f; - for(i = 0;i < NumSends;i++) - RoomAttenuation[i] = 1.0f; switch(Listener->Params.SourceDistanceModel ? - ATOMIC_LOAD(&props->DistanceModel, almemory_order_relaxed) : - Listener->Params.DistanceModel) + props->DistanceModel : Listener->Params.DistanceModel) { case InverseDistanceClamped: - ClampedDist = clampf(ClampedDist, MinDist, MaxDist); - if(MaxDist < MinDist) + ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); + if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ case InverseDistance: - if(MinDist > 0.0f) + if(!(props->RefDistance > 0.0f)) + ClampedDist = props->RefDistance; + else { - ALfloat dist = lerp(MinDist, ClampedDist, Rolloff); - if(dist > 0.0f) Attenuation = MinDist / dist; + ALfloat dist = lerp(props->RefDistance, ClampedDist, props->RolloffFactor); + if(dist > 0.0f) DryGain *= props->RefDistance / dist; for(i = 0;i < NumSends;i++) { - dist = lerp(MinDist, ClampedDist, RoomRolloff[i]); - if(dist > 0.0f) RoomAttenuation[i] = MinDist / dist; + dist = lerp(props->RefDistance, ClampedDist, RoomRolloff[i]); + if(dist > 0.0f) WetGain[i] *= props->RefDistance / dist; } } break; case LinearDistanceClamped: - ClampedDist = clampf(ClampedDist, MinDist, MaxDist); - if(MaxDist < MinDist) + ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); + if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ case LinearDistance: - if(MaxDist != MinDist) + if(!(props->MaxDistance != props->RefDistance)) + ClampedDist = props->RefDistance; + else { - Attenuation = 1.0f - (Rolloff*(ClampedDist-MinDist)/(MaxDist - MinDist)); - Attenuation = maxf(Attenuation, 0.0f); + ALfloat attn = props->RolloffFactor * (ClampedDist-props->RefDistance) / + (props->MaxDistance-props->RefDistance); + DryGain *= maxf(1.0f - attn, 0.0f); for(i = 0;i < NumSends;i++) { - RoomAttenuation[i] = 1.0f - (RoomRolloff[i]*(ClampedDist-MinDist)/(MaxDist - MinDist)); - RoomAttenuation[i] = maxf(RoomAttenuation[i], 0.0f); + attn = RoomRolloff[i] * (ClampedDist-props->RefDistance) / + (props->MaxDistance-props->RefDistance); + WetGain[i] *= maxf(1.0f - attn, 0.0f); } } break; case ExponentDistanceClamped: - ClampedDist = clampf(ClampedDist, MinDist, MaxDist); - if(MaxDist < MinDist) + ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); + if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ case ExponentDistance: - if(ClampedDist > 0.0f && MinDist > 0.0f) + if(!(ClampedDist > 0.0f && props->RefDistance > 0.0f)) + ClampedDist = props->RefDistance; + else { - Attenuation = powf(ClampedDist/MinDist, -Rolloff); + DryGain *= powf(ClampedDist/props->RefDistance, -props->RolloffFactor); for(i = 0;i < NumSends;i++) - RoomAttenuation[i] = powf(ClampedDist/MinDist, -RoomRolloff[i]); + WetGain[i] *= powf(ClampedDist/props->RefDistance, -RoomRolloff[i]); } break; case DisableDistance: - ClampedDist = MinDist; + ClampedDist = props->RefDistance; break; } - /* Source Gain + Attenuation */ - DryGain = SourceVolume * Attenuation; - for(i = 0;i < NumSends;i++) - WetGain[i] = SourceVolume * RoomAttenuation[i]; - - /* Distance-based air absorption */ - if(AirAbsorptionFactor > 0.0f && ClampedDist > MinDist) - { - ALfloat meters = (ClampedDist-MinDist) * MetersPerUnit; - DryGainHF *= powf(AIRABSORBGAINHF, AirAbsorptionFactor*meters); - for(i = 0;i < NumSends;i++) - WetGainHF[i] *= powf(RoomAirAbsorption[i], AirAbsorptionFactor*meters); - } - - if(WetGainAuto) - { - ALfloat ApparentDist = 1.0f/maxf(Attenuation, 0.00001f) - 1.0f; - - /* Apply a decay-time transformation to the wet path, based on the - * attenuation of the dry path. - * - * Using the apparent distance, based on the distance attenuation, the - * initial decay of the reverb effect is calculated and applied to the - * wet path. - */ - for(i = 0;i < NumSends;i++) - { - if(DecayDistance[i] > 0.0f) - WetGain[i] *= powf(0.001f/*-60dB*/, ApparentDist/DecayDistance[i]); - } - } - /* Calculate directional soundcones */ - if(InnerAngle < 360.0f) + if(directional && props->InnerAngle < 360.0f) { ALfloat ConeVolume; ALfloat ConeHF; ALfloat Angle; - ALfloat scale; - Angle = RAD2DEG(acosf(aluDotproduct(&Direction, &SourceToListener)) * ConeScale) * 2.0f; - if(Angle > InnerAngle) + Angle = acosf(aluDotproduct(&Direction, &SourceToListener)); + Angle = RAD2DEG(Angle * ConeScale * 2.0f); + if(!(Angle > props->InnerAngle)) { - if(Angle < OuterAngle) - { - scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle); - ConeVolume = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGain, almemory_order_relaxed), scale - ); - ConeHF = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGainHF, almemory_order_relaxed), scale - ); - } - else - { - ConeVolume = ATOMIC_LOAD(&props->OuterGain, almemory_order_relaxed); - ConeHF = ATOMIC_LOAD(&props->OuterGainHF, almemory_order_relaxed); - } - DryGain *= ConeVolume; - if(DryGainHFAuto) - DryGainHF *= ConeHF; + ConeVolume = 1.0f; + ConeHF = 1.0f; + } + else if(Angle < props->OuterAngle) + { + ALfloat scale = ( Angle-props->InnerAngle) / + (props->OuterAngle-props->InnerAngle); + ConeVolume = lerp(1.0f, props->OuterGain, scale); + ConeHF = lerp(1.0f, props->OuterGainHF, scale); + } + else + { + ConeVolume = props->OuterGain; + ConeHF = props->OuterGainHF; } - /* Wet path uses the total area of the cone emitter (the room will - * receive the same amount of sound regardless of its direction). - */ - scale = (asinf(maxf((OuterAngle-InnerAngle)/360.0f, 0.0f)) / F_PI) + - (InnerAngle/360.0f); - if(WetGainAuto) + DryGain *= ConeVolume; + if(props->DryGainHFAuto) + DryGainHF *= ConeHF; + if(props->WetGainAuto) { - ConeVolume = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGain, almemory_order_relaxed), scale - ); for(i = 0;i < NumSends;i++) WetGain[i] *= ConeVolume; } - if(WetGainHFAuto) + if(props->WetGainHFAuto) { - ConeHF = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGainHF, almemory_order_relaxed), scale - ); for(i = 0;i < NumSends;i++) WetGainHF[i] *= ConeHF; } } /* Apply gain and frequency filters */ - DryGain = clampf(DryGain, MinVolume, MaxVolume); - DryGain *= ATOMIC_LOAD(&props->Direct.Gain, almemory_order_relaxed) * ListenerGain; - DryGain = minf(DryGain, GAIN_MIX_MAX); - DryGainHF *= ATOMIC_LOAD(&props->Direct.GainHF, almemory_order_relaxed); - DryGainLF *= ATOMIC_LOAD(&props->Direct.GainLF, almemory_order_relaxed); + DryGain = clampf(DryGain, props->MinGain, props->MaxGain); + DryGain = minf(DryGain*props->Direct.Gain*Listener->Params.Gain, GAIN_MIX_MAX); + DryGainHF *= props->Direct.GainHF; + DryGainLF *= props->Direct.GainLF; for(i = 0;i < NumSends;i++) { - WetGain[i] = clampf(WetGain[i], MinVolume, MaxVolume); - WetGain[i] *= ATOMIC_LOAD(&props->Send[i].Gain, almemory_order_relaxed) * ListenerGain; - WetGain[i] = minf(WetGain[i], GAIN_MIX_MAX); - WetGainHF[i] *= ATOMIC_LOAD(&props->Send[i].GainHF, almemory_order_relaxed); - WetGainLF[i] *= ATOMIC_LOAD(&props->Send[i].GainLF, almemory_order_relaxed); + WetGain[i] = clampf(WetGain[i], props->MinGain, props->MaxGain); + WetGain[i] = minf(WetGain[i]*props->Send[i].Gain*Listener->Params.Gain, GAIN_MIX_MAX); + WetGainHF[i] *= props->Send[i].GainHF; + WetGainLF[i] *= props->Send[i].GainLF; } + /* Distance-based air absorption and initial send decay. */ + if(ClampedDist > props->RefDistance && props->RolloffFactor > 0.0f) + { + ALfloat meters_base = (ClampedDist-props->RefDistance) * props->RolloffFactor * + Listener->Params.MetersPerUnit; + if(props->AirAbsorptionFactor > 0.0f) + { + ALfloat hfattn = powf(AIRABSORBGAINHF, meters_base * props->AirAbsorptionFactor); + DryGainHF *= hfattn; + for(i = 0;i < NumSends;i++) + WetGainHF[i] *= hfattn; + } + + if(props->WetGainAuto) + { + /* Apply a decay-time transformation to the wet path, based on the + * source distance in meters. The initial decay of the reverb + * effect is calculated and applied to the wet path. + */ + for(i = 0;i < NumSends;i++) + { + ALfloat gain, gainhf, gainlf; + + if(!(DecayDistance[i] > 0.0f)) + continue; + + gain = powf(REVERB_DECAY_GAIN, meters_base/DecayDistance[i]); + WetGain[i] *= gain; + /* Yes, the wet path's air absorption is applied with + * WetGainAuto on, rather than WetGainHFAuto. + */ + if(gain > 0.0f) + { + gainhf = powf(REVERB_DECAY_GAIN, meters_base/DecayHFDistance[i]); + WetGainHF[i] *= minf(gainhf / gain, 1.0f); + gainlf = powf(REVERB_DECAY_GAIN, meters_base/DecayLFDistance[i]); + WetGainLF[i] *= minf(gainlf / gain, 1.0f); + } + } + } + } + + + /* Initial source pitch */ + Pitch = props->Pitch; + /* Calculate velocity-based doppler effect */ + DopplerFactor = props->DopplerFactor * Listener->Params.DopplerFactor; if(DopplerFactor > 0.0f) { const aluVector *lvelocity = &Listener->Params.Velocity; - ALfloat VSS, VLS; + const ALfloat SpeedOfSound = Listener->Params.SpeedOfSound; + ALfloat vss, vls; - if(SpeedOfSound < 1.0f) + vss = aluDotproduct(&Velocity, &SourceToListener) * DopplerFactor; + vls = aluDotproduct(lvelocity, &SourceToListener) * DopplerFactor; + + if(!(vls < SpeedOfSound)) { - DopplerFactor *= 1.0f/SpeedOfSound; - SpeedOfSound = 1.0f; + /* Listener moving away from the source at the speed of sound. + * Sound waves can't catch it. + */ + Pitch = 0.0f; } - - VSS = aluDotproduct(&Velocity, &SourceToListener) * DopplerFactor; - VLS = aluDotproduct(lvelocity, &SourceToListener) * DopplerFactor; - - Pitch *= clampf(SpeedOfSound-VLS, 1.0f, SpeedOfSound*2.0f - 1.0f) / - clampf(SpeedOfSound-VSS, 1.0f, SpeedOfSound*2.0f - 1.0f); - } - - /* Calculate fixed-point stepping value, based on the pitch, buffer - * frequency, and output frequency. - */ - Pitch *= (ALfloat)ALBuffer->Frequency / Frequency; - if(Pitch > (ALfloat)MAX_PITCH) - voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1); - BsincPrepare(voice->Step, &voice->SincState); - - if(Device->Render_Mode == HrtfRender) - { - /* Full HRTF rendering. Skip the virtual channels and render to the - * real outputs. - */ - ALfloat dir[3] = { 0.0f, 0.0f, -1.0f }; - ALfloat ev = 0.0f, az = 0.0f; - ALfloat radius = ATOMIC_LOAD(&props->Radius, almemory_order_relaxed); - ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat spread = 0.0f; - - voice->DirectOut.Buffer = Device->RealOut.Buffer; - voice->DirectOut.Channels = Device->RealOut.NumChannels; - - if(Distance > FLT_EPSILON) + else if(!(vss < SpeedOfSound)) { - dir[0] = -SourceToListener.v[0]; - dir[1] = -SourceToListener.v[1]; - dir[2] = -SourceToListener.v[2] * ZScale; - - /* Calculate elevation and azimuth only when the source is not at - * the listener. This prevents +0 and -0 Z from producing - * inconsistent panning. Also, clamp Y in case FP precision errors - * cause it to land outside of -1..+1. */ - ev = asinf(clampf(dir[1], -1.0f, 1.0f)); - az = atan2f(dir[0], -dir[2]); - } - if(radius > Distance) - spread = F_TAU - Distance/radius*F_PI; - else if(Distance > FLT_EPSILON) - spread = asinf(radius / Distance) * 2.0f; - - /* Get the HRIR coefficients and delays. */ - GetHrtfCoeffs(Device->Hrtf.Handle, ev, az, spread, DryGain, - voice->Chan[0].Direct.Hrtf.Target.Coeffs, - voice->Chan[0].Direct.Hrtf.Target.Delay); - - CalcDirectionCoeffs(dir, spread, coeffs); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[0].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[0].Send[i].Gains.Target); - } - } - - voice->IsHrtf = AL_TRUE; - } - else - { - /* Non-HRTF rendering. */ - ALfloat dir[3] = { 0.0f, 0.0f, -1.0f }; - ALfloat radius = ATOMIC_LOAD(&props->Radius, almemory_order_relaxed); - ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat spread = 0.0f; - - /* Get the localized direction, and compute panned gains. */ - if(Distance > FLT_EPSILON) - { - dir[0] = -SourceToListener.v[0]; - dir[1] = -SourceToListener.v[1]; - dir[2] = -SourceToListener.v[2] * ZScale; - } - if(radius > Distance) - spread = F_TAU - Distance/radius*F_PI; - else if(Distance > FLT_EPSILON) - spread = asinf(radius / Distance) * 2.0f; - - if(Device->Render_Mode == StereoPair) - { - /* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */ - ALfloat x = -dir[0] * (0.5f * (cosf(spread*0.5f) + 1.0f)); - x = clampf(x, -0.5f, 0.5f) + 0.5f; - voice->Chan[0].Direct.Gains.Target[0] = x * DryGain; - voice->Chan[0].Direct.Gains.Target[1] = (1.0f-x) * DryGain; - for(i = 2;i < MAX_OUTPUT_CHANNELS;i++) - voice->Chan[0].Direct.Gains.Target[i] = 0.0f; - - CalcDirectionCoeffs(dir, spread, coeffs); + /* Source moving toward the listener at the speed of sound. Sound + * waves bunch up to extreme frequencies. + */ + Pitch = HUGE_VALF; } else { - CalcDirectionCoeffs(dir, spread, coeffs); - ComputePanningGains(Device->Dry, coeffs, DryGain, - voice->Chan[0].Direct.Gains.Target); + /* Source and listener movement is nominal. Calculate the proper + * doppler shift. + */ + Pitch *= (SpeedOfSound-vls) / (SpeedOfSound-vss); } - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[0].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[0].Send[i].Gains.Target); - } - } - - voice->IsHrtf = AL_FALSE; } + /* Adjust pitch based on the buffer and output frequencies, and calculate + * fixed-point stepping value. + */ + Pitch *= (ALfloat)ALBuffer->Frequency/(ALfloat)Device->Frequency; + if(Pitch > (ALfloat)MAX_PITCH) + voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch * FRACTIONONE), 1); + if(props->Resampler == BSinc24Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24); + else if(props->Resampler == BSinc12Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc12); + voice->Resampler = SelectResampler(props->Resampler); + + if(Distance > 0.0f) { - ALfloat hfscale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) / - Frequency; - DryGainHF = maxf(DryGainHF, 0.0001f); - DryGainLF = maxf(DryGainLF, 0.0001f); - voice->Chan[0].Direct.FilterType = AF_None; - if(DryGainHF != 1.0f) voice->Chan[0].Direct.FilterType |= AF_LowPass; - if(DryGainLF != 1.0f) voice->Chan[0].Direct.FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[0].Direct.LowPass, ALfilterType_HighShelf, - DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[0].Direct.HighPass, ALfilterType_LowShelf, - DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f) - ); - } - for(i = 0;i < NumSends;i++) - { - ALfloat hfscale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) / - Frequency; - WetGainHF[i] = maxf(WetGainHF[i], 0.0001f); - WetGainLF[i] = maxf(WetGainLF[i], 0.0001f); - voice->Chan[0].Send[i].FilterType = AF_None; - if(WetGainHF[i] != 1.0f) voice->Chan[0].Send[i].FilterType |= AF_LowPass; - if(WetGainLF[i] != 1.0f) voice->Chan[0].Send[i].FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[0].Send[i].LowPass, ALfilterType_HighShelf, - WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[0].Send[i].HighPass, ALfilterType_LowShelf, - WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f) - ); + /* Clamp Y, in case rounding errors caused it to end up outside of + * -1...+1. + */ + ev = asinf(clampf(-SourceToListener.v[1], -1.0f, 1.0f)); + /* Double negation on Z cancels out; negate once for changing source- + * to-listener to listener-to-source, and again for right-handed coords + * with -Z in front. + */ + az = atan2f(-SourceToListener.v[0], SourceToListener.v[2]*ZScale); } + else + ev = az = 0.0f; + + if(props->Radius > Distance) + spread = F_TAU - Distance/props->Radius*F_PI; + else if(Distance > 0.0f) + spread = asinf(props->Radius / Distance) * 2.0f; + else + spread = 0.0f; + + CalcPanningAndFilters(voice, az, ev, Distance, spread, DryGain, DryGainHF, DryGainLF, WetGain, + WetGainLF, WetGainHF, SendSlots, ALBuffer, props, Listener, Device); } -static void CalcSourceParams(ALvoice *voice, ALCcontext *context, ALboolean force) +static void CalcSourceParams(ALvoice *voice, ALCcontext *context, bool force) { - ALsource *source = voice->Source; - const ALbufferlistitem *BufferListItem; - struct ALsourceProps *first; - struct ALsourceProps *props; + ALbufferlistitem *BufferListItem; + struct ALvoiceProps *props; - props = ATOMIC_EXCHANGE(struct ALsourceProps*, &source->Update, NULL, almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&voice->Update, NULL, almemory_order_acq_rel); if(!props && !force) return; if(props) { - voice->Props = *props; + memcpy(voice->Props, props, + FAM_SIZE(struct ALvoiceProps, Send, context->Device->NumAuxSends) + ); - /* WARNING: A livelock is theoretically possible if another thread - * keeps changing the freelist head without giving this a chance to - * actually swap in the old container (practically impossible with this - * little code, but...). - */ - first = ATOMIC_LOAD(&source->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*, - &source->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALvoiceProps*, &context->FreeVoiceProps, props); } + props = voice->Props; - BufferListItem = ATOMIC_LOAD(&source->queue, almemory_order_relaxed); + BufferListItem = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); while(BufferListItem != NULL) { - const ALbuffer *buffer; - if((buffer=BufferListItem->buffer) != NULL) + const ALbuffer *buffer = NULL; + ALsizei i = 0; + while(!buffer && i < BufferListItem->num_buffers) + buffer = BufferListItem->buffers[i]; + if(LIKELY(buffer)) { - if(buffer->FmtChannels == FmtMono) - CalcAttnSourceParams(voice, &voice->Props, buffer, context); + if(props->SpatializeMode == SpatializeOn || + (props->SpatializeMode == SpatializeAuto && buffer->FmtChannels == FmtMono)) + CalcAttnSourceParams(voice, props, buffer, context); else - CalcNonAttnSourceParams(voice, &voice->Props, buffer, context); + CalcNonAttnSourceParams(voice, props, buffer, context); break; } - BufferListItem = BufferListItem->next; + BufferListItem = ATOMIC_LOAD(&BufferListItem->next, almemory_order_acquire); } } -static void UpdateContextSources(ALCcontext *ctx, ALeffectslot *slot) +static void ProcessParamUpdates(ALCcontext *ctx, const struct ALeffectslotArray *slots) { - ALvoice *voice, *voice_end; + ALvoice **voice, **voice_end; ALsource *source; + ALsizei i; IncrementRef(&ctx->UpdateCount); - if(!ATOMIC_LOAD(&ctx->HoldUpdates)) + if(!ATOMIC_LOAD(&ctx->HoldUpdates, almemory_order_acquire)) { - ALboolean force = CalcListenerParams(ctx); - while(slot) - { - force |= CalcEffectSlotParams(slot, ctx->Device); - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); - } + bool cforce = CalcContextParams(ctx); + bool force = CalcListenerParams(ctx) | cforce; + for(i = 0;i < slots->count;i++) + force |= CalcEffectSlotParams(slots->slot[i], ctx, cforce); voice = ctx->Voices; voice_end = voice + ctx->VoiceCount; for(;voice != voice_end;++voice) { - if(!(source=voice->Source)) continue; - if(source->state != AL_PLAYING && source->state != AL_PAUSED) - voice->Source = NULL; - else - CalcSourceParams(voice, ctx, force); + source = ATOMIC_LOAD(&(*voice)->Source, almemory_order_acquire); + if(source) CalcSourceParams(*voice, ctx, force); } } IncrementRef(&ctx->UpdateCount); } -/* Specialized function to clamp to [-1, +1] with only one branch. This also - * converts NaN to 0. */ -static inline ALfloat aluClampf(ALfloat val) +static void ApplyStablizer(FrontStablizer *Stablizer, ALfloat (*restrict Buffer)[BUFFERSIZE], + int lidx, int ridx, int cidx, ALsizei SamplesToDo, + ALsizei NumChannels) { - if(fabsf(val) <= 1.0f) return val; - return (ALfloat)((0.0f < val) - (val < 0.0f)); -} + ALfloat (*restrict lsplit)[BUFFERSIZE] = ASSUME_ALIGNED(Stablizer->LSplit, 16); + ALfloat (*restrict rsplit)[BUFFERSIZE] = ASSUME_ALIGNED(Stablizer->RSplit, 16); + ALsizei i; -static inline ALfloat aluF2F(ALfloat val) -{ return val; } - -static inline ALint aluF2I(ALfloat val) -{ - /* Floats only have a 24-bit mantissa, so [-16777215, +16777215] is the max - * integer range normalized floats can be safely converted to. + /* Apply an all-pass to all channels, except the front-left and front- + * right, so they maintain the same relative phase. */ - return fastf2i(aluClampf(val)*16777215.0f)<<7; + for(i = 0;i < NumChannels;i++) + { + if(i == lidx || i == ridx) + continue; + splitterap_process(&Stablizer->APFilter[i], Buffer[i], SamplesToDo); + } + + bandsplit_process(&Stablizer->LFilter, lsplit[1], lsplit[0], Buffer[lidx], SamplesToDo); + bandsplit_process(&Stablizer->RFilter, rsplit[1], rsplit[0], Buffer[ridx], SamplesToDo); + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat lfsum, hfsum; + ALfloat m, s, c; + + lfsum = lsplit[0][i] + rsplit[0][i]; + hfsum = lsplit[1][i] + rsplit[1][i]; + s = lsplit[0][i] + lsplit[1][i] - rsplit[0][i] - rsplit[1][i]; + + /* This pans the separate low- and high-frequency sums between being on + * the center channel and the left/right channels. The low-frequency + * sum is 1/3rd toward center (2/3rds on left/right) and the high- + * frequency sum is 1/4th toward center (3/4ths on left/right). These + * values can be tweaked. + */ + m = lfsum*cosf(1.0f/3.0f * F_PI_2) + hfsum*cosf(1.0f/4.0f * F_PI_2); + c = lfsum*sinf(1.0f/3.0f * F_PI_2) + hfsum*sinf(1.0f/4.0f * F_PI_2); + + /* The generated center channel signal adds to the existing signal, + * while the modified left and right channels replace. + */ + Buffer[lidx][i] = (m + s) * 0.5f; + Buffer[ridx][i] = (m - s) * 0.5f; + Buffer[cidx][i] += c * 0.5f; + } } -static inline ALuint aluF2UI(ALfloat val) -{ return aluF2I(val)+2147483648u; } -static inline ALshort aluF2S(ALfloat val) -{ return fastf2i(aluClampf(val)*32767.0f); } -static inline ALushort aluF2US(ALfloat val) -{ return aluF2S(val)+32768; } +static void ApplyDistanceComp(ALfloat (*restrict Samples)[BUFFERSIZE], DistanceComp *distcomp, + ALfloat *restrict Values, ALsizei SamplesToDo, ALsizei numchans) +{ + ALsizei i, c; -static inline ALbyte aluF2B(ALfloat val) -{ return fastf2i(aluClampf(val)*127.0f); } -static inline ALubyte aluF2UB(ALfloat val) -{ return aluF2B(val)+128; } + Values = ASSUME_ALIGNED(Values, 16); + for(c = 0;c < numchans;c++) + { + ALfloat *restrict inout = ASSUME_ALIGNED(Samples[c], 16); + const ALfloat gain = distcomp[c].Gain; + const ALsizei base = distcomp[c].Length; + ALfloat *restrict distbuf = ASSUME_ALIGNED(distcomp[c].Buffer, 16); -#define DECL_TEMPLATE(T, func) \ -static void Write_##T(ALfloatBUFFERSIZE *InBuffer, ALvoid *OutBuffer, \ - ALuint SamplesToDo, ALuint numchans) \ + if(base == 0) + { + if(gain < 1.0f) + { + for(i = 0;i < SamplesToDo;i++) + inout[i] *= gain; + } + continue; + } + + if(SamplesToDo >= base) + { + for(i = 0;i < base;i++) + Values[i] = distbuf[i]; + for(;i < SamplesToDo;i++) + Values[i] = inout[i-base]; + memcpy(distbuf, &inout[SamplesToDo-base], base*sizeof(ALfloat)); + } + else + { + for(i = 0;i < SamplesToDo;i++) + Values[i] = distbuf[i]; + memmove(distbuf, distbuf+SamplesToDo, (base-SamplesToDo)*sizeof(ALfloat)); + memcpy(distbuf+base-SamplesToDo, inout, SamplesToDo*sizeof(ALfloat)); + } + for(i = 0;i < SamplesToDo;i++) + inout[i] = Values[i]*gain; + } +} + +static void ApplyDither(ALfloat (*restrict Samples)[BUFFERSIZE], ALuint *dither_seed, + const ALfloat quant_scale, const ALsizei SamplesToDo, + const ALsizei numchans) +{ + const ALfloat invscale = 1.0f / quant_scale; + ALuint seed = *dither_seed; + ALsizei c, i; + + /* Dithering. Step 1, generate whitenoise (uniform distribution of random + * values between -1 and +1). Step 2 is to add the noise to the samples, + * before rounding and after scaling up to the desired quantization depth. + */ + for(c = 0;c < numchans;c++) + { + ALfloat *restrict samples = Samples[c]; + for(i = 0;i < SamplesToDo;i++) + { + ALfloat val = samples[i] * quant_scale; + ALuint rng0 = dither_rng(&seed); + ALuint rng1 = dither_rng(&seed); + val += (ALfloat)(rng0*(1.0/UINT_MAX) - rng1*(1.0/UINT_MAX)); + samples[i] = fastf2i(val) * invscale; + } + } + *dither_seed = seed; +} + + +static inline ALfloat Conv_ALfloat(ALfloat val) +{ return val; } +static inline ALint Conv_ALint(ALfloat val) +{ + /* Floats have a 23-bit mantissa. A bit of the exponent helps out along + * with the sign bit, giving 25 bits. So [-16777216, +16777216] is the max + * integer range normalized floats can be converted to before losing + * precision. + */ + return fastf2i(clampf(val*16777216.0f, -16777216.0f, 16777215.0f))<<7; +} +static inline ALshort Conv_ALshort(ALfloat val) +{ return fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f)); } +static inline ALbyte Conv_ALbyte(ALfloat val) +{ return fastf2i(clampf(val*128.0f, -128.0f, 127.0f)); } + +/* Define unsigned output variations. */ +#define DECL_TEMPLATE(T, func, O) \ +static inline T Conv_##T(ALfloat val) { return func(val)+O; } + +DECL_TEMPLATE(ALubyte, Conv_ALbyte, 128) +DECL_TEMPLATE(ALushort, Conv_ALshort, 32768) +DECL_TEMPLATE(ALuint, Conv_ALint, 2147483648u) + +#undef DECL_TEMPLATE + +#define DECL_TEMPLATE(T, A) \ +static void Write##A(const ALfloat (*restrict InBuffer)[BUFFERSIZE], \ + ALvoid *OutBuffer, ALsizei Offset, ALsizei SamplesToDo, \ + ALsizei numchans) \ { \ - ALuint i, j; \ + ALsizei i, j; \ for(j = 0;j < numchans;j++) \ { \ - const ALfloat *in = InBuffer[j]; \ - T *restrict out = (T*)OutBuffer + j; \ + const ALfloat *restrict in = ASSUME_ALIGNED(InBuffer[j], 16); \ + T *restrict out = (T*)OutBuffer + Offset*numchans + j; \ + \ for(i = 0;i < SamplesToDo;i++) \ - out[i*numchans] = func(in[i]); \ + out[i*numchans] = Conv_##T(in[i]); \ } \ } -DECL_TEMPLATE(ALfloat, aluF2F) -DECL_TEMPLATE(ALuint, aluF2UI) -DECL_TEMPLATE(ALint, aluF2I) -DECL_TEMPLATE(ALushort, aluF2US) -DECL_TEMPLATE(ALshort, aluF2S) -DECL_TEMPLATE(ALubyte, aluF2UB) -DECL_TEMPLATE(ALbyte, aluF2B) +DECL_TEMPLATE(ALfloat, F32) +DECL_TEMPLATE(ALuint, UI32) +DECL_TEMPLATE(ALint, I32) +DECL_TEMPLATE(ALushort, UI16) +DECL_TEMPLATE(ALshort, I16) +DECL_TEMPLATE(ALubyte, UI8) +DECL_TEMPLATE(ALbyte, I8) #undef DECL_TEMPLATE -ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) +void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) { - ALuint SamplesToDo; - ALvoice *voice, *voice_end; - ALeffectslot *slot; - ALsource *source; + ALsizei SamplesToDo; + ALsizei SamplesDone; ALCcontext *ctx; - FPUCtl oldMode; - ALuint i, c; + ALsizei i, c; - SetMixerFPUMode(&oldMode); - - while(size > 0) + START_MIXER_MODE(); + for(SamplesDone = 0;SamplesDone < NumSamples;) { - SamplesToDo = minu(size, BUFFERSIZE); + SamplesToDo = mini(NumSamples-SamplesDone, BUFFERSIZE); for(c = 0;c < device->Dry.NumChannels;c++) memset(device->Dry.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); - if(device->Dry.Buffer != device->RealOut.Buffer) - for(c = 0;c < device->RealOut.NumChannels;c++) - memset(device->RealOut.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); if(device->Dry.Buffer != device->FOAOut.Buffer) for(c = 0;c < device->FOAOut.NumChannels;c++) memset(device->FOAOut.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); + if(device->Dry.Buffer != device->RealOut.Buffer) + for(c = 0;c < device->RealOut.NumChannels;c++) + memset(device->RealOut.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); IncrementRef(&device->MixCount); - V0(device->Backend,lock)(); - if((slot=device->DefaultSlot) != NULL) - { - CalcEffectSlotParams(device->DefaultSlot, device); - for(i = 0;i < slot->NumChannels;i++) - memset(slot->WetBuffer[i], 0, SamplesToDo*sizeof(ALfloat)); - } - - ctx = ATOMIC_LOAD(&device->ContextList); + ctx = ATOMIC_LOAD(&device->ContextList, almemory_order_acquire); while(ctx) { - ALeffectslot *slotroot; + const struct ALeffectslotArray *auxslots; - slotroot = ATOMIC_LOAD(&ctx->ActiveAuxSlotList); - UpdateContextSources(ctx, slotroot); + auxslots = ATOMIC_LOAD(&ctx->ActiveAuxSlots, almemory_order_acquire); + ProcessParamUpdates(ctx, auxslots); - slot = slotroot; - while(slot) + for(i = 0;i < auxslots->count;i++) { - for(i = 0;i < slot->NumChannels;i++) - memset(slot->WetBuffer[i], 0, SamplesToDo*sizeof(ALfloat)); - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); + ALeffectslot *slot = auxslots->slot[i]; + for(c = 0;c < slot->NumChannels;c++) + memset(slot->WetBuffer[c], 0, SamplesToDo*sizeof(ALfloat)); } /* source processing */ - voice = ctx->Voices; - voice_end = voice + ctx->VoiceCount; - for(;voice != voice_end;++voice) + for(i = 0;i < ctx->VoiceCount;i++) { - ALboolean IsVoiceInit = (voice->Step > 0); - source = voice->Source; - if(source && source->state == AL_PLAYING && IsVoiceInit) - MixSource(voice, source, device, SamplesToDo); + ALvoice *voice = ctx->Voices[i]; + ALsource *source = ATOMIC_LOAD(&voice->Source, almemory_order_acquire); + if(source && ATOMIC_LOAD(&voice->Playing, almemory_order_relaxed) && + voice->Step > 0) + { + if(!MixSource(voice, source->id, ctx, SamplesToDo)) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + SendSourceStoppedEvent(ctx, source->id); + } + } } /* effect slot processing */ - slot = slotroot; - while(slot) + for(i = 0;i < auxslots->count;i++) { + const ALeffectslot *slot = auxslots->slot[i]; ALeffectState *state = slot->Params.EffectState; - V(state,process)(SamplesToDo, SAFE_CONST(ALfloatBUFFERSIZE*,slot->WetBuffer), - state->OutBuffer, state->OutChannels); - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); + V(state,process)(SamplesToDo, slot->WetBuffer, state->OutBuffer, + state->OutChannels); } - ctx = ctx->next; - } - - if(device->DefaultSlot != NULL) - { - const ALeffectslot *slot = device->DefaultSlot; - ALeffectState *state = slot->Params.EffectState; - V(state,process)(SamplesToDo, slot->WetBuffer, state->OutBuffer, - state->OutChannels); + ctx = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); } /* Increment the clock time. Every second's worth of samples is @@ -1513,145 +1796,132 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) device->SamplesDone += SamplesToDo; device->ClockBase += (device->SamplesDone/device->Frequency) * DEVICE_CLOCK_RES; device->SamplesDone %= device->Frequency; - V0(device->Backend,unlock)(); IncrementRef(&device->MixCount); - if(device->Hrtf.Handle) + /* Apply post-process for finalizing the Dry mix to the RealOut + * (Ambisonic decode, UHJ encode, etc). + */ + if(LIKELY(device->PostProcess)) + device->PostProcess(device, SamplesToDo); + + if(device->Stablizer) { - int lidx = GetChannelIdxByName(device->RealOut, FrontLeft); - int ridx = GetChannelIdxByName(device->RealOut, FrontRight); - if(lidx != -1 && ridx != -1) - { - HrtfDirectMixerFunc HrtfMix = SelectHrtfMixer(); - ALuint irsize = device->Hrtf.IrSize; - for(c = 0;c < device->Dry.NumChannels;c++) - { - HrtfMix(device->RealOut.Buffer, lidx, ridx, - device->Dry.Buffer[c], device->Hrtf.Offset, irsize, - device->Hrtf.Coeffs[c], device->Hrtf.Values[c], - SamplesToDo - ); - } - device->Hrtf.Offset += SamplesToDo; - } - } - else if(device->AmbiDecoder) - { - if(device->Dry.Buffer != device->FOAOut.Buffer) - bformatdec_upSample(device->AmbiDecoder, - device->Dry.Buffer, SAFE_CONST(ALfloatBUFFERSIZE*,device->FOAOut.Buffer), - device->FOAOut.NumChannels, SamplesToDo - ); - bformatdec_process(device->AmbiDecoder, - device->RealOut.Buffer, device->RealOut.NumChannels, - SAFE_CONST(ALfloatBUFFERSIZE*,device->Dry.Buffer), SamplesToDo - ); - } - else if(device->AmbiUp) - { - ambiup_process(device->AmbiUp, - device->RealOut.Buffer, device->RealOut.NumChannels, - SAFE_CONST(ALfloatBUFFERSIZE*,device->FOAOut.Buffer), SamplesToDo - ); - } - else if(device->Uhj_Encoder) - { - int lidx = GetChannelIdxByName(device->RealOut, FrontLeft); - int ridx = GetChannelIdxByName(device->RealOut, FrontRight); - if(lidx != -1 && ridx != -1) - { - /* Encode to stereo-compatible 2-channel UHJ output. */ - EncodeUhj2(device->Uhj_Encoder, - device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], - device->Dry.Buffer, SamplesToDo - ); - } - } - else if(device->Bs2b) - { - int lidx = GetChannelIdxByName(device->RealOut, FrontLeft); - int ridx = GetChannelIdxByName(device->RealOut, FrontRight); - if(lidx != -1 && ridx != -1) - { - /* Apply binaural/crossfeed filter */ - bs2b_cross_feed(device->Bs2b, device->RealOut.Buffer[lidx], - device->RealOut.Buffer[ridx], SamplesToDo); - } + int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + int cidx = GetChannelIdxByName(&device->RealOut, FrontCenter); + assert(lidx >= 0 && ridx >= 0 && cidx >= 0); + + ApplyStablizer(device->Stablizer, device->RealOut.Buffer, lidx, ridx, cidx, + SamplesToDo, device->RealOut.NumChannels); } - if(buffer) - { - ALfloat (*OutBuffer)[BUFFERSIZE] = device->RealOut.Buffer; - ALuint OutChannels = device->RealOut.NumChannels; + ApplyDistanceComp(device->RealOut.Buffer, device->ChannelDelay, device->TempBuffer[0], + SamplesToDo, device->RealOut.NumChannels); + + if(device->Limiter) + ApplyCompression(device->Limiter, device->RealOut.NumChannels, SamplesToDo, + device->RealOut.Buffer); + + if(device->DitherDepth > 0.0f) + ApplyDither(device->RealOut.Buffer, &device->DitherSeed, device->DitherDepth, + SamplesToDo, device->RealOut.NumChannels); + + if(LIKELY(OutBuffer)) + { + ALfloat (*Buffer)[BUFFERSIZE] = device->RealOut.Buffer; + ALsizei Channels = device->RealOut.NumChannels; -#define WRITE(T, a, b, c, d) do { \ - Write_##T((a), (b), (c), (d)); \ - buffer = (T*)buffer + (c)*(d); \ -} while(0) switch(device->FmtType) { case DevFmtByte: - WRITE(ALbyte, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteI8(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtUByte: - WRITE(ALubyte, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteUI8(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtShort: - WRITE(ALshort, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteI16(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtUShort: - WRITE(ALushort, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteUI16(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtInt: - WRITE(ALint, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteI32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtUInt: - WRITE(ALuint, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteUI32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtFloat: - WRITE(ALfloat, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteF32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; } -#undef WRITE } - size -= SamplesToDo; + SamplesDone += SamplesToDo; } - - RestoreFPUMode(&oldMode); + END_MIXER_MODE(); } -ALvoid aluHandleDisconnect(ALCdevice *device) +void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) { - ALCcontext *Context; + ALCcontext *ctx; + AsyncEvent evt; + va_list args; + int msglen; - device->Connected = ALC_FALSE; + if(!ATOMIC_EXCHANGE(&device->Connected, AL_FALSE, almemory_order_acq_rel)) + return; - Context = ATOMIC_LOAD(&device->ContextList); - while(Context) + evt.EnumType = EventType_Disconnected; + evt.Type = AL_EVENT_TYPE_DISCONNECTED_SOFT; + evt.ObjectId = 0; + evt.Param = 0; + + va_start(args, msg); + msglen = vsnprintf(evt.Message, sizeof(evt.Message), msg, args); + va_end(args); + + if(msglen < 0 || (size_t)msglen >= sizeof(evt.Message)) { - ALvoice *voice, *voice_end; + evt.Message[sizeof(evt.Message)-1] = 0; + msglen = (int)strlen(evt.Message); + } + if(msglen > 0) + msg = evt.Message; + else + { + msg = ""; + msglen = (int)strlen(msg); + } - voice = Context->Voices; - voice_end = voice + Context->VoiceCount; - while(voice != voice_end) + ctx = ATOMIC_LOAD_SEQ(&device->ContextList); + while(ctx) + { + ALbitfieldSOFT enabledevt = ATOMIC_LOAD(&ctx->EnabledEvts, almemory_order_acquire); + ALsizei i; + + if((enabledevt&EventType_Disconnected) && + ll_ringbuffer_write(ctx->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&ctx->EventSem); + + for(i = 0;i < ctx->VoiceCount;i++) { - ALsource *source = voice->Source; - voice->Source = NULL; + ALvoice *voice = ctx->Voices[i]; + ALsource *source; - if(source && source->state == AL_PLAYING) + source = ATOMIC_EXCHANGE_PTR(&voice->Source, NULL, almemory_order_relaxed); + if(source && ATOMIC_LOAD(&voice->Playing, almemory_order_relaxed)) { - source->state = AL_STOPPED; - ATOMIC_STORE(&source->current_buffer, NULL); - ATOMIC_STORE(&source->position, 0); - ATOMIC_STORE(&source->position_fraction, 0); + /* If the source's voice was playing, it's now effectively + * stopped (the source state will be updated the next time it's + * checked). + */ + SendSourceStoppedEvent(ctx, source->id); } - - voice++; + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); } - Context->VoiceCount = 0; - Context = Context->next; + ctx = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); } } diff --git a/Engine/lib/openal-soft/Alc/alcRing.c b/Engine/lib/openal-soft/Alc/alcRing.c deleted file mode 100644 index 5994f1967..000000000 --- a/Engine/lib/openal-soft/Alc/alcRing.c +++ /dev/null @@ -1,301 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 1999-2007 by authors. - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include - -#include "alMain.h" -#include "threads.h" -#include "almalloc.h" -#include "compat.h" - - -/* NOTE: This lockless ringbuffer implementation is copied from JACK, extended - * to include an element size. Consequently, parameters and return values for a - * size or count is in 'elements', not bytes. Additionally, it only supports - * single-consumer/single-provider operation. */ -struct ll_ringbuffer { - volatile size_t write_ptr; - volatile size_t read_ptr; - size_t size; - size_t size_mask; - size_t elem_size; - int mlocked; - - alignas(16) char buf[]; -}; - -/* Create a new ringbuffer to hold at least `sz' elements of `elem_sz' bytes. - * The number of elements is rounded up to the next power of two. */ -ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz) -{ - ll_ringbuffer_t *rb; - ALuint power_of_two; - - power_of_two = NextPowerOf2(sz); - if(power_of_two < sz) - return NULL; - - rb = al_malloc(16, sizeof(*rb) + power_of_two*elem_sz); - if(!rb) return NULL; - - rb->size = power_of_two; - rb->size_mask = rb->size - 1; - rb->elem_size = elem_sz; - rb->write_ptr = 0; - rb->read_ptr = 0; - rb->mlocked = 0; - return rb; -} - -/* Free all data associated with the ringbuffer `rb'. */ -void ll_ringbuffer_free(ll_ringbuffer_t *rb) -{ - if(rb) - { -#ifdef USE_MLOCK - if(rb->mlocked) - munlock(rb, sizeof(*rb) + rb->size*rb->elem_size); -#endif /* USE_MLOCK */ - al_free(rb); - } -} - -/* Lock the data block of `rb' using the system call 'mlock'. */ -int ll_ringbuffer_mlock(ll_ringbuffer_t *rb) -{ -#ifdef USE_MLOCK - if(!rb->locked && mlock(rb, sizeof(*rb) + rb->size*rb->elem_size)) - return -1; -#endif /* USE_MLOCK */ - rb->mlocked = 1; - return 0; -} - -/* Reset the read and write pointers to zero. This is not thread safe. */ -void ll_ringbuffer_reset(ll_ringbuffer_t *rb) -{ - rb->read_ptr = 0; - rb->write_ptr = 0; - memset(rb->buf, 0, rb->size*rb->elem_size); -} - -/* Return the number of elements available for reading. This is the number of - * elements in front of the read pointer and behind the write pointer. */ -size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb) -{ - size_t w = rb->write_ptr; - size_t r = rb->read_ptr; - return (rb->size+w-r) & rb->size_mask; -} -/* Return the number of elements available for writing. This is the number of - * elements in front of the write pointer and behind the read pointer. */ -size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb) -{ - size_t w = rb->write_ptr; - size_t r = rb->read_ptr; - return (rb->size+r-w-1) & rb->size_mask; -} - -/* The copying data reader. Copy at most `cnt' elements from `rb' to `dest'. - * Returns the actual number of elements copied. */ -size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt) -{ - size_t free_cnt; - size_t cnt2; - size_t to_read; - size_t n1, n2; - - free_cnt = ll_ringbuffer_read_space(rb); - if(free_cnt == 0) return 0; - - to_read = (cnt > free_cnt) ? free_cnt : cnt; - cnt2 = rb->read_ptr + to_read; - if(cnt2 > rb->size) - { - n1 = rb->size - rb->read_ptr; - n2 = cnt2 & rb->size_mask; - } - else - { - n1 = to_read; - n2 = 0; - } - - memcpy(dest, &(rb->buf[rb->read_ptr*rb->elem_size]), n1*rb->elem_size); - rb->read_ptr = (rb->read_ptr + n1) & rb->size_mask; - if(n2) - { - memcpy(dest + n1*rb->elem_size, &(rb->buf[rb->read_ptr*rb->elem_size]), n2*rb->elem_size); - rb->read_ptr = (rb->read_ptr + n2) & rb->size_mask; - } - return to_read; -} - -/* The copying data reader w/o read pointer advance. Copy at most `cnt' - * elements from `rb' to `dest'. Returns the actual number of elements copied. - */ -size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt) -{ - size_t free_cnt; - size_t cnt2; - size_t to_read; - size_t n1, n2; - size_t tmp_read_ptr; - - tmp_read_ptr = rb->read_ptr; - free_cnt = ll_ringbuffer_read_space(rb); - if(free_cnt == 0) return 0; - - to_read = (cnt > free_cnt) ? free_cnt : cnt; - cnt2 = tmp_read_ptr + to_read; - if(cnt2 > rb->size) - { - n1 = rb->size - tmp_read_ptr; - n2 = cnt2 & rb->size_mask; - } - else - { - n1 = to_read; - n2 = 0; - } - - memcpy(dest, &(rb->buf[tmp_read_ptr*rb->elem_size]), n1*rb->elem_size); - tmp_read_ptr = (tmp_read_ptr + n1) & rb->size_mask; - if(n2) - memcpy(dest + n1*rb->elem_size, &(rb->buf[tmp_read_ptr*rb->elem_size]), n2*rb->elem_size); - return to_read; -} - -/* The copying data writer. Copy at most `cnt' elements to `rb' from `src'. - * Returns the actual number of elements copied. */ -size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt) -{ - size_t free_cnt; - size_t cnt2; - size_t to_write; - size_t n1, n2; - - free_cnt = ll_ringbuffer_write_space(rb); - if(free_cnt == 0) return 0; - - to_write = (cnt > free_cnt) ? free_cnt : cnt; - cnt2 = rb->write_ptr + to_write; - if(cnt2 > rb->size) - { - n1 = rb->size - rb->write_ptr; - n2 = cnt2 & rb->size_mask; - } - else - { - n1 = to_write; - n2 = 0; - } - - memcpy(&(rb->buf[rb->write_ptr*rb->elem_size]), src, n1*rb->elem_size); - rb->write_ptr = (rb->write_ptr + n1) & rb->size_mask; - if(n2) - { - memcpy(&(rb->buf[rb->write_ptr*rb->elem_size]), src + n1*rb->elem_size, n2*rb->elem_size); - rb->write_ptr = (rb->write_ptr + n2) & rb->size_mask; - } - return to_write; -} - -/* Advance the read pointer `cnt' places. */ -void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt) -{ - size_t tmp = (rb->read_ptr + cnt) & rb->size_mask; - rb->read_ptr = tmp; -} - -/* Advance the write pointer `cnt' places. */ -void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt) -{ - size_t tmp = (rb->write_ptr + cnt) & rb->size_mask; - rb->write_ptr = tmp; -} - -/* The non-copying data reader. `vec' is an array of two places. Set the values - * at `vec' to hold the current readable data at `rb'. If the readable data is - * in one segment the second segment has zero length. */ -void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t * vec) -{ - size_t free_cnt; - size_t cnt2; - size_t w, r; - - w = rb->write_ptr; - r = rb->read_ptr; - free_cnt = (rb->size+w-r) & rb->size_mask; - - cnt2 = r + free_cnt; - if(cnt2 > rb->size) - { - /* Two part vector: the rest of the buffer after the current write ptr, - * plus some from the start of the buffer. */ - vec[0].buf = (char*)&(rb->buf[r*rb->elem_size]); - vec[0].len = rb->size - r; - vec[1].buf = (char*)rb->buf; - vec[1].len = cnt2 & rb->size_mask; - } - else - { - /* Single part vector: just the rest of the buffer */ - vec[0].buf = (char*)&(rb->buf[r*rb->elem_size]); - vec[0].len = free_cnt; - vec[1].buf = NULL; - vec[1].len = 0; - } -} - -/* The non-copying data writer. `vec' is an array of two places. Set the values - * at `vec' to hold the current writeable data at `rb'. If the writeable data - * is in one segment the second segment has zero length. */ -void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t *vec) -{ - size_t free_cnt; - size_t cnt2; - size_t w, r; - - w = rb->write_ptr; - r = rb->read_ptr; - free_cnt = (rb->size+r-w-1) & rb->size_mask; - - cnt2 = w + free_cnt; - if(cnt2 > rb->size) - { - /* Two part vector: the rest of the buffer after the current write ptr, - * plus some from the start of the buffer. */ - vec[0].buf = (char*)&(rb->buf[w*rb->elem_size]); - vec[0].len = rb->size - w; - vec[1].buf = (char*)rb->buf; - vec[1].len = cnt2 & rb->size_mask; - } - else - { - vec[0].buf = (char*)&(rb->buf[w*rb->elem_size]); - vec[0].len = free_cnt; - vec[1].buf = NULL; - vec[1].len = 0; - } -} diff --git a/Engine/lib/openal-soft/Alc/alcConfig.c b/Engine/lib/openal-soft/Alc/alconfig.c similarity index 70% rename from Engine/lib/openal-soft/Alc/alcConfig.c rename to Engine/lib/openal-soft/Alc/alconfig.c index f83ffd941..5dbf59d2b 100644 --- a/Engine/lib/openal-soft/Alc/alcConfig.c +++ b/Engine/lib/openal-soft/Alc/alconfig.c @@ -38,6 +38,7 @@ #endif #include "alMain.h" +#include "alconfig.h" #include "compat.h" #include "bool.h" @@ -233,7 +234,61 @@ static void LoadConfigFromFile(FILE *f) curSection[0] = 0; else { - strncpy(curSection, section, sizeof(curSection)-1); + size_t len, p = 0; + do { + char *nextp = strchr(section, '%'); + if(!nextp) + { + strncpy(curSection+p, section, sizeof(curSection)-1-p); + break; + } + + len = nextp - section; + if(len > sizeof(curSection)-1-p) + len = sizeof(curSection)-1-p; + strncpy(curSection+p, section, len); + p += len; + section = nextp; + + if(((section[1] >= '0' && section[1] <= '9') || + (section[1] >= 'a' && section[1] <= 'f') || + (section[1] >= 'A' && section[1] <= 'F')) && + ((section[2] >= '0' && section[2] <= '9') || + (section[2] >= 'a' && section[2] <= 'f') || + (section[2] >= 'A' && section[2] <= 'F'))) + { + unsigned char b = 0; + if(section[1] >= '0' && section[1] <= '9') + b = (section[1]-'0') << 4; + else if(section[1] >= 'a' && section[1] <= 'f') + b = (section[1]-'a'+0xa) << 4; + else if(section[1] >= 'A' && section[1] <= 'F') + b = (section[1]-'A'+0x0a) << 4; + if(section[2] >= '0' && section[2] <= '9') + b |= (section[2]-'0'); + else if(section[2] >= 'a' && section[2] <= 'f') + b |= (section[2]-'a'+0xa); + else if(section[2] >= 'A' && section[2] <= 'F') + b |= (section[2]-'A'+0x0a); + if(p < sizeof(curSection)-1) + curSection[p++] = b; + section += 3; + } + else if(section[1] == '%') + { + if(p < sizeof(curSection)-1) + curSection[p++] = '%'; + section += 2; + } + else + { + if(p < sizeof(curSection)-1) + curSection[p++] = '%'; + section += 1; + } + if(p < sizeof(curSection)-1) + curSection[p] = 0; + } while(p < sizeof(curSection)-1 && *section != 0); curSection[sizeof(curSection)-1] = 0; } @@ -311,33 +366,33 @@ static void LoadConfigFromFile(FILE *f) #ifdef _WIN32 void ReadALConfig(void) { - WCHAR buffer[PATH_MAX]; + al_string ppath = AL_STRING_INIT_STATIC(); + WCHAR buffer[MAX_PATH]; const WCHAR *str; - al_string ppath; FILE *f; if(SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, FALSE) != FALSE) { al_string filepath = AL_STRING_INIT_STATIC(); - al_string_copy_wcstr(&filepath, buffer); - al_string_append_cstr(&filepath, "\\alsoft.ini"); + alstr_copy_wcstr(&filepath, buffer); + alstr_append_cstr(&filepath, "\\alsoft.ini"); - TRACE("Loading config %s...\n", al_string_get_cstr(filepath)); - f = al_fopen(al_string_get_cstr(filepath), "rt"); + TRACE("Loading config %s...\n", alstr_get_cstr(filepath)); + f = al_fopen(alstr_get_cstr(filepath), "rt"); if(f) { LoadConfigFromFile(f); fclose(f); } - al_string_deinit(&filepath); + alstr_reset(&filepath); } - ppath = GetProcPath(); - if(!al_string_empty(ppath)) + GetProcBinary(&ppath, NULL); + if(!alstr_empty(ppath)) { - al_string_append_cstr(&ppath, "\\alsoft.ini"); - TRACE("Loading config %s...\n", al_string_get_cstr(ppath)); - f = al_fopen(al_string_get_cstr(ppath), "r"); + alstr_append_cstr(&ppath, "\\alsoft.ini"); + TRACE("Loading config %s...\n", alstr_get_cstr(ppath)); + f = al_fopen(alstr_get_cstr(ppath), "r"); if(f) { LoadConfigFromFile(f); @@ -348,26 +403,26 @@ void ReadALConfig(void) if((str=_wgetenv(L"ALSOFT_CONF")) != NULL && *str) { al_string filepath = AL_STRING_INIT_STATIC(); - al_string_copy_wcstr(&filepath, str); + alstr_copy_wcstr(&filepath, str); - TRACE("Loading config %s...\n", al_string_get_cstr(filepath)); - f = al_fopen(al_string_get_cstr(filepath), "rt"); + TRACE("Loading config %s...\n", alstr_get_cstr(filepath)); + f = al_fopen(alstr_get_cstr(filepath), "rt"); if(f) { LoadConfigFromFile(f); fclose(f); } - al_string_deinit(&filepath); + alstr_reset(&filepath); } - al_string_deinit(&ppath); + alstr_reset(&ppath); } #else void ReadALConfig(void) { - char buffer[PATH_MAX]; + al_string confpaths = AL_STRING_INIT_STATIC(); + al_string fname = AL_STRING_INIT_STATIC(); const char *str; - al_string ppath; FILE *f; str = "/etc/openal/alsoft.conf"; @@ -382,45 +437,55 @@ void ReadALConfig(void) if(!(str=getenv("XDG_CONFIG_DIRS")) || str[0] == 0) str = "/etc/xdg"; - strncpy(buffer, str, sizeof(buffer)-1); - buffer[sizeof(buffer)-1] = 0; + alstr_copy_cstr(&confpaths, str); /* Go through the list in reverse, since "the order of base directories * denotes their importance; the first directory listed is the most * important". Ergo, we need to load the settings from the later dirs * first so that the settings in the earlier dirs override them. */ - while(1) + while(!alstr_empty(confpaths)) { - char *next = strrchr(buffer, ':'); - if(next) *(next++) = 0; - else next = buffer; - - if(next[0] != '/') - WARN("Ignoring XDG config dir: %s\n", next); + char *next = strrchr(alstr_get_cstr(confpaths), ':'); + if(next) + { + size_t len = next - alstr_get_cstr(confpaths); + alstr_copy_cstr(&fname, next+1); + VECTOR_RESIZE(confpaths, len, len+1); + VECTOR_ELEM(confpaths, len) = 0; + } else { - size_t len = strlen(next); - strncpy(next+len, "/alsoft.conf", buffer+sizeof(buffer)-next-len); - buffer[sizeof(buffer)-1] = 0; + alstr_reset(&fname); + fname = confpaths; + AL_STRING_INIT(confpaths); + } - TRACE("Loading config %s...\n", next); - f = al_fopen(next, "r"); + if(alstr_empty(fname) || VECTOR_FRONT(fname) != '/') + WARN("Ignoring XDG config dir: %s\n", alstr_get_cstr(fname)); + else + { + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/alsoft.conf"); + else alstr_append_cstr(&fname, "alsoft.conf"); + + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); fclose(f); } } - if(next == buffer) - break; + alstr_clear(&fname); } if((str=getenv("HOME")) != NULL && *str) { - snprintf(buffer, sizeof(buffer), "%s/.alsoftrc", str); + alstr_copy_cstr(&fname, str); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/.alsoftrc"); + else alstr_append_cstr(&fname, ".alsoftrc"); - TRACE("Loading config %s...\n", buffer); - f = al_fopen(buffer, "r"); + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); @@ -429,17 +494,25 @@ void ReadALConfig(void) } if((str=getenv("XDG_CONFIG_HOME")) != NULL && str[0] != 0) - snprintf(buffer, sizeof(buffer), "%s/%s", str, "alsoft.conf"); + { + alstr_copy_cstr(&fname, str); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/alsoft.conf"); + else alstr_append_cstr(&fname, "alsoft.conf"); + } else { - buffer[0] = 0; + alstr_clear(&fname); if((str=getenv("HOME")) != NULL && str[0] != 0) - snprintf(buffer, sizeof(buffer), "%s/.config/%s", str, "alsoft.conf"); + { + alstr_copy_cstr(&fname, str); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/.config/alsoft.conf"); + else alstr_append_cstr(&fname, ".config/alsoft.conf"); + } } - if(buffer[0] != 0) + if(!alstr_empty(fname)) { - TRACE("Loading config %s...\n", buffer); - f = al_fopen(buffer, "r"); + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); @@ -447,12 +520,15 @@ void ReadALConfig(void) } } - ppath = GetProcPath(); - if(!al_string_empty(ppath)) + alstr_clear(&fname); + GetProcBinary(&fname, NULL); + if(!alstr_empty(fname)) { - al_string_append_cstr(&ppath, "/alsoft.conf"); - TRACE("Loading config %s...\n", al_string_get_cstr(ppath)); - f = al_fopen(al_string_get_cstr(ppath), "r"); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/alsoft.conf"); + else alstr_append_cstr(&fname, "alsoft.conf"); + + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); @@ -471,7 +547,8 @@ void ReadALConfig(void) } } - al_string_deinit(&ppath); + alstr_reset(&fname); + alstr_reset(&confpaths); } #endif diff --git a/Engine/lib/openal-soft/Alc/alconfig.h b/Engine/lib/openal-soft/Alc/alconfig.h new file mode 100644 index 000000000..1e493e2ee --- /dev/null +++ b/Engine/lib/openal-soft/Alc/alconfig.h @@ -0,0 +1,17 @@ +#ifndef ALCONFIG_H +#define ALCONFIG_H + +void ReadALConfig(void); +void FreeALConfig(void); + +int ConfigValueExists(const char *devName, const char *blockName, const char *keyName); +const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def); +int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def); + +int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret); +int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret); +int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret); +int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret); +int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret); + +#endif /* ALCONFIG_H */ diff --git a/Engine/lib/openal-soft/Alc/alstring.h b/Engine/lib/openal-soft/Alc/alstring.h index 6167f5ce1..923a5ea2d 100644 --- a/Engine/lib/openal-soft/Alc/alstring.h +++ b/Engine/lib/openal-soft/Alc/alstring.h @@ -6,44 +6,53 @@ #include "vector.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef char al_string_char_type; TYPEDEF_VECTOR(al_string_char_type, al_string) TYPEDEF_VECTOR(al_string, vector_al_string) -inline void al_string_deinit(al_string *str) +inline void alstr_reset(al_string *str) { VECTOR_DEINIT(*str); } #define AL_STRING_INIT(_x) do { (_x) = (al_string)NULL; } while(0) #define AL_STRING_INIT_STATIC() ((al_string)NULL) -#define AL_STRING_DEINIT(_x) al_string_deinit(&(_x)) +#define AL_STRING_DEINIT(_x) alstr_reset(&(_x)) -inline size_t al_string_length(const_al_string str) +inline size_t alstr_length(const_al_string str) { return VECTOR_SIZE(str); } -inline ALboolean al_string_empty(const_al_string str) -{ return al_string_length(str) == 0; } +inline ALboolean alstr_empty(const_al_string str) +{ return alstr_length(str) == 0; } -inline const al_string_char_type *al_string_get_cstr(const_al_string str) +inline const al_string_char_type *alstr_get_cstr(const_al_string str) { return str ? &VECTOR_FRONT(str) : ""; } -void al_string_clear(al_string *str); +void alstr_clear(al_string *str); -int al_string_cmp(const_al_string str1, const_al_string str2); -int al_string_cmp_cstr(const_al_string str1, const al_string_char_type *str2); +int alstr_cmp(const_al_string str1, const_al_string str2); +int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2); -void al_string_copy(al_string *str, const_al_string from); -void al_string_copy_cstr(al_string *str, const al_string_char_type *from); -void al_string_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); +void alstr_copy(al_string *str, const_al_string from); +void alstr_copy_cstr(al_string *str, const al_string_char_type *from); +void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); -void al_string_append_char(al_string *str, const al_string_char_type c); -void al_string_append_cstr(al_string *str, const al_string_char_type *from); -void al_string_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); +void alstr_append_char(al_string *str, const al_string_char_type c); +void alstr_append_cstr(al_string *str, const al_string_char_type *from); +void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); #ifdef _WIN32 #include /* Windows-only methods to deal with WideChar strings. */ -void al_string_copy_wcstr(al_string *str, const wchar_t *from); -void al_string_append_wcstr(al_string *str, const wchar_t *from); -void al_string_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to); +void alstr_copy_wcstr(al_string *str, const wchar_t *from); +void alstr_append_wcstr(al_string *str, const wchar_t *from); +void alstr_copy_wrange(al_string *str, const wchar_t *from, const wchar_t *to); +void alstr_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to); +#endif + +#ifdef __cplusplus +} /* extern "C" */ #endif #endif /* ALSTRING_H */ diff --git a/Engine/lib/openal-soft/Alc/ambdec.c b/Engine/lib/openal-soft/Alc/ambdec.c index 255011d5e..da1143354 100644 --- a/Engine/lib/openal-soft/Alc/ambdec.c +++ b/Engine/lib/openal-soft/Alc/ambdec.c @@ -90,6 +90,15 @@ static char *my_strtok_r(char *str, const char *delim, char **saveptr) return str; } +static char *read_int(ALint *num, const char *line, int base) +{ + char *end; + *num = strtol(line, &end, base); + if(end && *end != '\0') + end = lstrip(end); + return end; +} + static char *read_uint(ALuint *num, const char *line, int base) { char *end; @@ -131,7 +140,7 @@ char *read_clipped_line(FILE *f, char **buffer, size_t *maxlen) static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t *maxlen, char **saveptr) { - ALuint cur = 0; + ALsizei cur = 0; while(cur < conf->NumSpeakers) { const char *cmd = my_strtok_r(NULL, " \t", saveptr); @@ -155,7 +164,7 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t const char *conn = my_strtok_r(NULL, " \t", saveptr); if(!name) WARN("Name not specified for speaker %u\n", cur+1); - else al_string_copy_cstr(&conf->Speakers[cur].Name, name); + else alstr_copy_cstr(&conf->Speakers[cur].Name, name); if(!dist) WARN("Distance not specified for speaker %u\n", cur+1); else read_float(&conf->Speakers[cur].Distance, dist); if(!az) WARN("Azimuth not specified for speaker %u\n", cur+1); @@ -163,7 +172,7 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t if(!elev) WARN("Elevation not specified for speaker %u\n", cur+1); else read_float(&conf->Speakers[cur].Elevation, elev); if(!conn) TRACE("Connection not specified for speaker %u\n", cur+1); - else al_string_copy_cstr(&conf->Speakers[cur].Connection, conn); + else alstr_copy_cstr(&conf->Speakers[cur].Connection, conn); cur++; } @@ -184,10 +193,10 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t return 1; } -static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS], ALuint maxrow, FILE *f, char **buffer, size_t *maxlen, char **saveptr) +static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS], ALsizei maxrow, FILE *f, char **buffer, size_t *maxlen, char **saveptr) { int gotgains = 0; - ALuint cur = 0; + ALsizei cur = 0; while(cur < maxrow) { const char *cmd = my_strtok_r(NULL, " \t", saveptr); @@ -269,7 +278,7 @@ static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS] void ambdec_init(AmbDecConf *conf) { - ALuint i; + ALsizei i; memset(conf, 0, sizeof(*conf)); AL_STRING_INIT(conf->Description); @@ -282,13 +291,13 @@ void ambdec_init(AmbDecConf *conf) void ambdec_deinit(AmbDecConf *conf) { - ALuint i; + ALsizei i; - al_string_deinit(&conf->Description); + alstr_reset(&conf->Description); for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) { - al_string_deinit(&conf->Speakers[i].Name); - al_string_deinit(&conf->Speakers[i].Connection); + alstr_reset(&conf->Speakers[i].Name); + alstr_reset(&conf->Speakers[i].Connection); } memset(conf, 0, sizeof(*conf)); } @@ -322,7 +331,7 @@ int ambdec_load(AmbDecConf *conf, const char *fname) if(strcmp(command, "description") == 0) { char *value = my_strtok_r(NULL, "", &saveptr); - al_string_copy_cstr(&conf->Description, lstrip(value)); + alstr_copy_cstr(&conf->Description, lstrip(value)); } else if(strcmp(command, "version") == 0) { @@ -370,7 +379,7 @@ int ambdec_load(AmbDecConf *conf, const char *fname) else if(strcmp(dec, "speakers") == 0) { line = my_strtok_r(NULL, "", &saveptr); - line = read_uint(&conf->NumSpeakers, line, 10); + line = read_int(&conf->NumSpeakers, line, 10); if(line && *line != '\0') { ERR("Extra junk after speakers: %s\n", line); diff --git a/Engine/lib/openal-soft/Alc/ambdec.h b/Engine/lib/openal-soft/Alc/ambdec.h index 8a3befc1a..0bb84072b 100644 --- a/Engine/lib/openal-soft/Alc/ambdec.h +++ b/Engine/lib/openal-soft/Alc/ambdec.h @@ -17,7 +17,7 @@ typedef struct AmbDecConf { ALuint ChanMask; ALuint FreqBands; /* Must be 1 or 2 */ - ALuint NumSpeakers; + ALsizei NumSpeakers; enum AmbDecScaleType CoeffScale; ALfloat XOverFreq; diff --git a/Engine/lib/openal-soft/Alc/backends/alsa.c b/Engine/lib/openal-soft/Alc/backends/alsa.c index 7a9045bb0..e0fdc070b 100644 --- a/Engine/lib/openal-soft/Alc/backends/alsa.c +++ b/Engine/lib/openal-soft/Alc/backends/alsa.c @@ -26,6 +26,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" @@ -199,15 +201,21 @@ static ALCboolean alsa_load(void) #ifdef HAVE_DYNLOAD if(!alsa_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + alsa_handle = LoadLib("libasound.so.2"); if(!alsa_handle) + { + WARN("Failed to load %s\n", "libasound.so.2"); return ALC_FALSE; + } error = ALC_FALSE; #define LOAD_FUNC(f) do { \ p##f = GetSymbol(alsa_handle, #f); \ if(p##f == NULL) { \ error = ALC_TRUE; \ + alstr_append_cstr(&missing_funcs, "\n" #f); \ } \ } while(0) ALSA_FUNCS(LOAD_FUNC); @@ -215,10 +223,11 @@ static ALCboolean alsa_load(void) if(error) { + WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs)); CloseLib(alsa_handle); alsa_handle = NULL; - return ALC_FALSE; } + alstr_reset(&missing_funcs); } #endif @@ -269,11 +278,45 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.name, alsaDevice); - al_string_copy_cstr(&entry.device_name, GetConfigValue(NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ? - "device" : "capture", "default")); + alstr_copy_cstr(&entry.name, alsaDevice); + alstr_copy_cstr(&entry.device_name, GetConfigValue( + NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ? "device" : "capture", "default" + )); VECTOR_PUSH_BACK(*DeviceList, entry); + if(stream == SND_PCM_STREAM_PLAYBACK) + { + const char *customdevs, *sep, *next; + next = GetConfigValue(NULL, "alsa", "custom-devices", ""); + while((customdevs=next) != NULL && customdevs[0]) + { + next = strchr(customdevs, ';'); + sep = strchr(customdevs, '='); + if(!sep) + { + al_string spec = AL_STRING_INIT_STATIC(); + if(next) + alstr_copy_range(&spec, customdevs, next++); + else + alstr_copy_cstr(&spec, customdevs); + ERR("Invalid ALSA device specification \"%s\"\n", alstr_get_cstr(spec)); + alstr_reset(&spec); + continue; + } + + AL_STRING_INIT(entry.name); + AL_STRING_INIT(entry.device_name); + alstr_copy_range(&entry.name, customdevs, sep++); + if(next) + alstr_copy_range(&entry.device_name, sep, next++); + else + alstr_copy_cstr(&entry.device_name, sep); + TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), + alstr_get_cstr(entry.device_name)); + VECTOR_PUSH_BACK(*DeviceList, entry); + } + } + card = -1; if((err=snd_card_next(&card)) < 0) ERR("Failed to find a card: %s\n", snd_strerror(err)); @@ -318,7 +361,8 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) snd_pcm_info_set_device(pcminfo, dev); snd_pcm_info_set_subdevice(pcminfo, 0); snd_pcm_info_set_stream(pcminfo, stream); - if((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) { + if((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) + { if(err != -ENOENT) ERR("control digital audio info (hw:%d): %s\n", card, snd_strerror(err)); continue; @@ -330,15 +374,15 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) ConfigValueStr(NULL, "alsa", name, &device_prefix); snprintf(name, sizeof(name), "%s, %s (CARD=%s,DEV=%d)", - cardname, devname, cardid, dev); + cardname, devname, cardid, dev); snprintf(device, sizeof(device), "%sCARD=%s,DEV=%d", - device_prefix, cardid, dev); + device_prefix, cardid, dev); TRACE("Got device \"%s\", \"%s\"\n", name, device); AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.name, name); - al_string_copy_cstr(&entry.device_name, device); + alstr_copy_cstr(&entry.name, name); + alstr_copy_cstr(&entry.device_name, device); VECTOR_PUSH_BACK(*DeviceList, entry); } snd_ctl_close(handle); @@ -394,7 +438,7 @@ typedef struct ALCplaybackAlsa { ALvoid *buffer; ALsizei size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCplaybackAlsa; @@ -402,9 +446,8 @@ static int ALCplaybackAlsa_mixerProc(void *ptr); static int ALCplaybackAlsa_mixerNoMMapProc(void *ptr); static void ALCplaybackAlsa_Construct(ALCplaybackAlsa *self, ALCdevice *device); -static DECLARE_FORWARD(ALCplaybackAlsa, ALCbackend, void, Destruct) +static void ALCplaybackAlsa_Destruct(ALCplaybackAlsa *self); static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name); -static void ALCplaybackAlsa_close(ALCplaybackAlsa *self); static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self); static ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self); static void ALCplaybackAlsa_stop(ALCplaybackAlsa *self); @@ -422,6 +465,19 @@ static void ALCplaybackAlsa_Construct(ALCplaybackAlsa *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCplaybackAlsa, ALCbackend, self); + + self->pcmHandle = NULL; + self->buffer = NULL; + + ATOMIC_INIT(&self->killNow, AL_TRUE); +} + +void ALCplaybackAlsa_Destruct(ALCplaybackAlsa *self) +{ + if(self->pcmHandle) + snd_pcm_close(self->pcmHandle); + self->pcmHandle = NULL; + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -441,14 +497,14 @@ static int ALCplaybackAlsa_mixerProc(void *ptr) update_size = device->UpdateSize; num_updates = device->NumUpdates; - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { int state = verify_state(self->pcmHandle); if(state < 0) { ERR("Invalid state detected: %s\n", snd_strerror(state)); ALCplaybackAlsa_lock(self); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Bad state: %s", snd_strerror(state)); ALCplaybackAlsa_unlock(self); break; } @@ -531,14 +587,14 @@ static int ALCplaybackAlsa_mixerNoMMapProc(void *ptr) update_size = device->UpdateSize; num_updates = device->NumUpdates; - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { int state = verify_state(self->pcmHandle); if(state < 0) { ERR("Invalid state detected: %s\n", snd_strerror(state)); ALCplaybackAlsa_lock(self); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Bad state: %s", snd_strerror(state)); ALCplaybackAlsa_unlock(self); break; } @@ -629,12 +685,12 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name) if(VECTOR_SIZE(PlaybackDevices) == 0) probe_devices(SND_PCM_STREAM_PLAYBACK, &PlaybackDevices); -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) return ALC_INVALID_VALUE; - driver = al_string_get_cstr(iter->device_name); + driver = alstr_get_cstr(iter->device_name); } else { @@ -653,16 +709,11 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name) /* Free alsa's global config tree. Otherwise valgrind reports a ton of leaks. */ snd_config_update_free_global(); - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCplaybackAlsa_close(ALCplaybackAlsa *self) -{ - snd_pcm_close(self->pcmHandle); -} - static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -704,7 +755,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) break; } - allowmmap = GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "mmap", 1); + allowmmap = GetConfigValueBool(alstr_get_cstr(device->DeviceName), "alsa", "mmap", 1); periods = device->NumUpdates; periodLen = (ALuint64)device->UpdateSize * 1000000 / device->Frequency; bufferLen = periodLen * periods; @@ -748,7 +799,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) } CHECK(snd_pcm_hw_params_set_format(self->pcmHandle, hp, format)); /* test and set channels (implicitly sets frame bits) */ - if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans)) < 0) + if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder)) < 0) { static const enum DevFmtChannels channellist[] = { DevFmtStereo, @@ -761,16 +812,17 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) for(k = 0;k < COUNTOF(channellist);k++) { - if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(channellist[k])) >= 0) + if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(channellist[k], 0)) >= 0) { device->FmtChans = channellist[k]; + device->AmbiOrder = 0; break; } } } - CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans))); + CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder))); /* set rate (implicitly constrains period/buffer parameters) */ - if(!GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0) || + if(!GetConfigValueBool(alstr_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0) || !(device->Flags&DEVICE_FREQUENCY_REQUEST)) { if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0) @@ -860,7 +912,7 @@ static ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self) } thread_func = ALCplaybackAlsa_mixerProc; } - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, thread_func, self) != althrd_success) { ERR("Could not create playback thread\n"); @@ -881,10 +933,8 @@ static void ALCplaybackAlsa_stop(ALCplaybackAlsa *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); al_free(self->buffer); @@ -928,9 +978,8 @@ typedef struct ALCcaptureAlsa { } ALCcaptureAlsa; static void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device); -static DECLARE_FORWARD(ALCcaptureAlsa, ALCbackend, void, Destruct) +static void ALCcaptureAlsa_Destruct(ALCcaptureAlsa *self); static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name); -static void ALCcaptureAlsa_close(ALCcaptureAlsa *self); static DECLARE_FORWARD(ALCcaptureAlsa, ALCbackend, ALCboolean, reset) static ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self); static void ALCcaptureAlsa_stop(ALCcaptureAlsa *self); @@ -948,6 +997,25 @@ static void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCcaptureAlsa, ALCbackend, self); + + self->pcmHandle = NULL; + self->buffer = NULL; + self->ring = NULL; +} + +void ALCcaptureAlsa_Destruct(ALCcaptureAlsa *self) +{ + if(self->pcmHandle) + snd_pcm_close(self->pcmHandle); + self->pcmHandle = NULL; + + al_free(self->buffer); + self->buffer = NULL; + + ll_ringbuffer_free(self->ring); + self->ring = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -970,12 +1038,12 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) if(VECTOR_SIZE(CaptureDevices) == 0) probe_devices(SND_PCM_STREAM_CAPTURE, &CaptureDevices); -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) return ALC_INVALID_VALUE; - driver = al_string_get_cstr(iter->device_name); + driver = alstr_get_cstr(iter->device_name); } else { @@ -1032,7 +1100,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) /* set format (implicitly sets sample bits) */ CHECK(snd_pcm_hw_params_set_format(self->pcmHandle, hp, format)); /* set channels (implicitly sets frame bits) */ - CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans))); + CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder))); /* set rate (implicitly constrains period/buffer parameters) */ CHECK(snd_pcm_hw_params_set_rate(self->pcmHandle, hp, device->Frequency, 0)); /* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */ @@ -1055,8 +1123,9 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) if(needring) { self->ring = ll_ringbuffer_create( - device->UpdateSize*device->NumUpdates + 1, - FrameSizeFromDevFmt(device->FmtChans, device->FmtType) + device->UpdateSize*device->NumUpdates, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + false ); if(!self->ring) { @@ -1065,7 +1134,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) } } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; @@ -1077,26 +1146,19 @@ error2: ll_ringbuffer_free(self->ring); self->ring = NULL; snd_pcm_close(self->pcmHandle); + self->pcmHandle = NULL; return ALC_INVALID_VALUE; } -static void ALCcaptureAlsa_close(ALCcaptureAlsa *self) -{ - snd_pcm_close(self->pcmHandle); - ll_ringbuffer_free(self->ring); - - al_free(self->buffer); - self->buffer = NULL; -} - static ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self) { int err = snd_pcm_start(self->pcmHandle); if(err < 0) { ERR("start failed: %s\n", snd_strerror(err)); - aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, "Capture state failure: %s", + snd_strerror(err)); return ALC_FALSE; } @@ -1147,7 +1209,7 @@ static ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buff } self->last_avail -= samples; - while(device->Connected && samples > 0) + while(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && samples > 0) { snd_pcm_sframes_t amt = 0; @@ -1190,7 +1252,7 @@ static ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buff if(amt < 0) { ERR("restore error: %s\n", snd_strerror(amt)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Capture recovery failure: %s", snd_strerror(amt)); break; } /* If the amount available is less than what's asked, we lost it @@ -1215,7 +1277,7 @@ static ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; snd_pcm_sframes_t avail = 0; - if(device->Connected && self->doCapture) + if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && self->doCapture) avail = snd_pcm_avail_update(self->pcmHandle); if(avail < 0) { @@ -1231,7 +1293,7 @@ static ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) if(avail < 0) { ERR("restore error: %s\n", snd_strerror(avail)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Capture recovery failure: %s", snd_strerror(avail)); } } @@ -1270,7 +1332,7 @@ static ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) if(amt < 0) { ERR("restore error: %s\n", snd_strerror(amt)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Capture recovery failure: %s", snd_strerror(amt)); break; } avail = amt; @@ -1307,9 +1369,9 @@ static ClockLatency ALCcaptureAlsa_getClockLatency(ALCcaptureAlsa *self) static inline void AppendAllDevicesList2(const DevMap *entry) -{ AppendAllDevicesList(al_string_get_cstr(entry->name)); } +{ AppendAllDevicesList(alstr_get_cstr(entry->name)); } static inline void AppendCaptureDeviceList2(const DevMap *entry) -{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); } +{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); } typedef struct ALCalsaBackendFactory { DERIVE_FROM_TYPE(ALCbackendFactory); diff --git a/Engine/lib/openal-soft/Alc/backends/base.c b/Engine/lib/openal-soft/Alc/backends/base.c index ff808f535..a451fee9b 100644 --- a/Engine/lib/openal-soft/Alc/backends/base.c +++ b/Engine/lib/openal-soft/Alc/backends/base.c @@ -4,11 +4,14 @@ #include #include "alMain.h" +#include "alu.h" #include "backends/base.h" extern inline ALuint64 GetDeviceClockTime(ALCdevice *device); +extern inline void ALCdevice_Lock(ALCdevice *device); +extern inline void ALCdevice_Unlock(ALCdevice *device); /* Base ALCbackend method implementations. */ void ALCbackend_Construct(ALCbackend *self, ALCdevice *device) @@ -41,13 +44,22 @@ ALCuint ALCbackend_availableSamples(ALCbackend* UNUSED(self)) ClockLatency ALCbackend_getClockLatency(ALCbackend *self) { ALCdevice *device = self->mDevice; + ALuint refcount; ClockLatency ret; - almtx_lock(&self->mMutex); - ret.ClockTime = GetDeviceClockTime(device); - // TODO: Perhaps should be NumUpdates-1 worth of UpdateSize? - ret.Latency = 0; - almtx_unlock(&self->mMutex); + do { + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) + althrd_yield(); + ret.ClockTime = GetDeviceClockTime(device); + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); + + /* NOTE: The device will generally have about all but one periods filled at + * any given time during playback. Without a more accurate measurement from + * the output, this is an okay approximation. + */ + ret.Latency = device->UpdateSize * DEVICE_CLOCK_RES / device->Frequency * + maxu(device->NumUpdates-1, 1); return ret; } @@ -69,157 +81,3 @@ void ALCbackend_unlock(ALCbackend *self) void ALCbackendFactory_deinit(ALCbackendFactory* UNUSED(self)) { } - - -/* Wrappers to use an old-style backend with the new interface. */ -typedef struct PlaybackWrapper { - DERIVE_FROM_TYPE(ALCbackend); - - const BackendFuncs *Funcs; -} PlaybackWrapper; - -static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device, const BackendFuncs *funcs); -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, Destruct) -static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name); -static void PlaybackWrapper_close(PlaybackWrapper *self); -static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self); -static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self); -static void PlaybackWrapper_stop(PlaybackWrapper *self); -static DECLARE_FORWARD2(PlaybackWrapper, ALCbackend, ALCenum, captureSamples, void*, ALCuint) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ALCuint, availableSamples) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ClockLatency, getClockLatency) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, lock) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(PlaybackWrapper) -DEFINE_ALCBACKEND_VTABLE(PlaybackWrapper); - -static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device, const BackendFuncs *funcs) -{ - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - SET_VTABLE2(PlaybackWrapper, ALCbackend, self); - - self->Funcs = funcs; -} - -static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->OpenPlayback(device, name); -} - -static void PlaybackWrapper_close(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->ClosePlayback(device); -} - -static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->ResetPlayback(device); -} - -static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->StartPlayback(device); -} - -static void PlaybackWrapper_stop(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->StopPlayback(device); -} - - -typedef struct CaptureWrapper { - DERIVE_FROM_TYPE(ALCbackend); - - const BackendFuncs *Funcs; -} CaptureWrapper; - -static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device, const BackendFuncs *funcs); -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, Destruct) -static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name); -static void CaptureWrapper_close(CaptureWrapper *self); -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ALCboolean, reset) -static ALCboolean CaptureWrapper_start(CaptureWrapper *self); -static void CaptureWrapper_stop(CaptureWrapper *self); -static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples); -static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self); -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ClockLatency, getClockLatency) -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, lock) -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(CaptureWrapper) -DEFINE_ALCBACKEND_VTABLE(CaptureWrapper); - -static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device, const BackendFuncs *funcs) -{ - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - SET_VTABLE2(CaptureWrapper, ALCbackend, self); - - self->Funcs = funcs; -} - -static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->OpenCapture(device, name); -} - -static void CaptureWrapper_close(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->CloseCapture(device); -} - -static ALCboolean CaptureWrapper_start(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->StartCapture(device); - return ALC_TRUE; -} - -static void CaptureWrapper_stop(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->StopCapture(device); -} - -static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->CaptureSamples(device, buffer, samples); -} - -static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->AvailableSamples(device); -} - - -ALCbackend *create_backend_wrapper(ALCdevice *device, const BackendFuncs *funcs, ALCbackend_Type type) -{ - if(type == ALCbackend_Playback) - { - PlaybackWrapper *backend; - - NEW_OBJ(backend, PlaybackWrapper)(device, funcs); - if(!backend) return NULL; - - return STATIC_CAST(ALCbackend, backend); - } - - if(type == ALCbackend_Capture) - { - CaptureWrapper *backend; - - NEW_OBJ(backend, CaptureWrapper)(device, funcs); - if(!backend) return NULL; - - return STATIC_CAST(ALCbackend, backend); - } - - return NULL; -} diff --git a/Engine/lib/openal-soft/Alc/backends/base.h b/Engine/lib/openal-soft/Alc/backends/base.h index 04795b368..ba92b4ac6 100644 --- a/Engine/lib/openal-soft/Alc/backends/base.h +++ b/Engine/lib/openal-soft/Alc/backends/base.h @@ -5,6 +5,10 @@ #include "threads.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct ClockLatency { ALint64 ClockTime; ALint64 Latency; @@ -43,7 +47,6 @@ struct ALCbackendVtable { void (*const Destruct)(ALCbackend*); ALCenum (*const open)(ALCbackend*, const ALCchar*); - void (*const close)(ALCbackend*); ALCboolean (*const reset)(ALCbackend*); ALCboolean (*const start)(ALCbackend*); @@ -63,7 +66,6 @@ struct ALCbackendVtable { #define DEFINE_ALCBACKEND_VTABLE(T) \ DECLARE_THUNK(T, ALCbackend, void, Destruct) \ DECLARE_THUNK1(T, ALCbackend, ALCenum, open, const ALCchar*) \ -DECLARE_THUNK(T, ALCbackend, void, close) \ DECLARE_THUNK(T, ALCbackend, ALCboolean, reset) \ DECLARE_THUNK(T, ALCbackend, ALCboolean, start) \ DECLARE_THUNK(T, ALCbackend, void, stop) \ @@ -79,7 +81,6 @@ static const struct ALCbackendVtable T##_ALCbackend_vtable = { \ T##_ALCbackend_Destruct, \ \ T##_ALCbackend_open, \ - T##_ALCbackend_close, \ T##_ALCbackend_reset, \ T##_ALCbackend_start, \ T##_ALCbackend_stop, \ @@ -137,17 +138,31 @@ static const struct ALCbackendFactoryVtable T##_ALCbackendFactory_vtable = { \ ALCbackendFactory *ALCpulseBackendFactory_getFactory(void); ALCbackendFactory *ALCalsaBackendFactory_getFactory(void); +ALCbackendFactory *ALCcoreAudioBackendFactory_getFactory(void); ALCbackendFactory *ALCossBackendFactory_getFactory(void); ALCbackendFactory *ALCjackBackendFactory_getFactory(void); ALCbackendFactory *ALCsolarisBackendFactory_getFactory(void); -ALCbackendFactory *ALCmmdevBackendFactory_getFactory(void); +ALCbackendFactory *ALCsndioBackendFactory_getFactory(void); +ALCbackendFactory *ALCqsaBackendFactory_getFactory(void); +ALCbackendFactory *ALCwasapiBackendFactory_getFactory(void); ALCbackendFactory *ALCdsoundBackendFactory_getFactory(void); ALCbackendFactory *ALCwinmmBackendFactory_getFactory(void); ALCbackendFactory *ALCportBackendFactory_getFactory(void); +ALCbackendFactory *ALCopenslBackendFactory_getFactory(void); ALCbackendFactory *ALCnullBackendFactory_getFactory(void); ALCbackendFactory *ALCwaveBackendFactory_getFactory(void); +ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void); ALCbackendFactory *ALCloopbackFactory_getFactory(void); -ALCbackend *create_backend_wrapper(ALCdevice *device, const BackendFuncs *funcs, ALCbackend_Type type); + +inline void ALCdevice_Lock(ALCdevice *device) +{ V0(device->Backend,lock)(); } + +inline void ALCdevice_Unlock(ALCdevice *device) +{ V0(device->Backend,unlock)(); } + +#ifdef __cplusplus +} /* extern "C" */ +#endif #endif /* AL_BACKENDS_BASE_H */ diff --git a/Engine/lib/openal-soft/Alc/backends/coreaudio.c b/Engine/lib/openal-soft/Alc/backends/coreaudio.c index 24aeabd42..a8787f7b0 100644 --- a/Engine/lib/openal-soft/Alc/backends/coreaudio.c +++ b/Engine/lib/openal-soft/Alc/backends/coreaudio.c @@ -23,128 +23,91 @@ #include #include #include -#include #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include #include #include #include +#include "backends/base.h" -typedef struct { - AudioUnit audioUnit; - - ALuint frameSize; - ALdouble sampleRateRatio; // Ratio of hardware sample rate / requested sample rate - AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD - - AudioConverterRef audioConverter; // Sample rate converter if needed - AudioBufferList *bufferList; // Buffer for data coming from the input device - ALCvoid *resampleBuffer; // Buffer for returned RingBuffer data when resampling - - ll_ringbuffer_t *ring; -} ca_data; static const ALCchar ca_device[] = "CoreAudio Default"; -static void destroy_buffer_list(AudioBufferList* list) +typedef struct ALCcoreAudioPlayback { + DERIVE_FROM_TYPE(ALCbackend); + + AudioUnit audioUnit; + + ALuint frameSize; + AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD +} ALCcoreAudioPlayback; + +static void ALCcoreAudioPlayback_Construct(ALCcoreAudioPlayback *self, ALCdevice *device); +static void ALCcoreAudioPlayback_Destruct(ALCcoreAudioPlayback *self); +static ALCenum ALCcoreAudioPlayback_open(ALCcoreAudioPlayback *self, const ALCchar *name); +static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self); +static ALCboolean ALCcoreAudioPlayback_start(ALCcoreAudioPlayback *self); +static void ALCcoreAudioPlayback_stop(ALCcoreAudioPlayback *self); +static DECLARE_FORWARD2(ALCcoreAudioPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCcoreAudioPlayback) + +DEFINE_ALCBACKEND_VTABLE(ALCcoreAudioPlayback); + + +static void ALCcoreAudioPlayback_Construct(ALCcoreAudioPlayback *self, ALCdevice *device) { - if(list) - { - UInt32 i; - for(i = 0;i < list->mNumberBuffers;i++) - free(list->mBuffers[i].mData); - free(list); - } + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCcoreAudioPlayback, ALCbackend, self); + + self->frameSize = 0; + memset(&self->format, 0, sizeof(self->format)); } -static AudioBufferList* allocate_buffer_list(UInt32 channelCount, UInt32 byteSize) +static void ALCcoreAudioPlayback_Destruct(ALCcoreAudioPlayback *self) { - AudioBufferList *list; + AudioUnitUninitialize(self->audioUnit); + AudioComponentInstanceDispose(self->audioUnit); - list = calloc(1, sizeof(AudioBufferList) + sizeof(AudioBuffer)); - if(list) - { - list->mNumberBuffers = 1; - - list->mBuffers[0].mNumberChannels = channelCount; - list->mBuffers[0].mDataByteSize = byteSize; - list->mBuffers[0].mData = malloc(byteSize); - if(list->mBuffers[0].mData == NULL) - { - free(list); - list = NULL; - } - } - return list; + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -static OSStatus ca_callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) -{ - ALCdevice *device = (ALCdevice*)inRefCon; - ca_data *data = (ca_data*)device->ExtraData; +static OSStatus ALCcoreAudioPlayback_MixerProc(void *inRefCon, + AudioUnitRenderActionFlags* UNUSED(ioActionFlags), const AudioTimeStamp* UNUSED(inTimeStamp), + UInt32 UNUSED(inBusNumber), UInt32 UNUSED(inNumberFrames), AudioBufferList *ioData) +{ + ALCcoreAudioPlayback *self = inRefCon; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + + ALCcoreAudioPlayback_lock(self); aluMixData(device, ioData->mBuffers[0].mData, - ioData->mBuffers[0].mDataByteSize / data->frameSize); + ioData->mBuffers[0].mDataByteSize / self->frameSize); + ALCcoreAudioPlayback_unlock(self); return noErr; } -static OSStatus ca_capture_conversion_callback(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPackets, - AudioBufferList *ioData, AudioStreamPacketDescription **outDataPacketDescription, void* inUserData) -{ - ALCdevice *device = (ALCdevice*)inUserData; - ca_data *data = (ca_data*)device->ExtraData; - - // Read from the ring buffer and store temporarily in a large buffer - ll_ringbuffer_read(data->ring, data->resampleBuffer, *ioNumberDataPackets); - - // Set the input data - ioData->mNumberBuffers = 1; - ioData->mBuffers[0].mNumberChannels = data->format.mChannelsPerFrame; - ioData->mBuffers[0].mData = data->resampleBuffer; - ioData->mBuffers[0].mDataByteSize = (*ioNumberDataPackets) * data->format.mBytesPerFrame; - - return noErr; -} - -static OSStatus ca_capture_callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, - UInt32 inNumberFrames, AudioBufferList *ioData) -{ - ALCdevice *device = (ALCdevice*)inRefCon; - ca_data *data = (ca_data*)device->ExtraData; - AudioUnitRenderActionFlags flags = 0; - OSStatus err; - - // fill the bufferList with data from the input device - err = AudioUnitRender(data->audioUnit, &flags, inTimeStamp, 1, inNumberFrames, data->bufferList); - if(err != noErr) - { - ERR("AudioUnitRender error: %d\n", err); - return err; - } - - ll_ringbuffer_write(data->ring, data->bufferList->mBuffers[0].mData, inNumberFrames); - - return noErr; -} - -static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName) + +static ALCenum ALCcoreAudioPlayback_open(ALCcoreAudioPlayback *self, const ALCchar *name) { + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; AudioComponentDescription desc; AudioComponent comp; - ca_data *data; OSStatus err; - if(!deviceName) - deviceName = ca_device; - else if(strcmp(deviceName, ca_device) != 0) + if(!name) + name = ca_device; + else if(strcmp(name, ca_device) != 0) return ALC_INVALID_VALUE; /* open the default output unit */ @@ -161,57 +124,41 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - data = calloc(1, sizeof(*data)); - - err = AudioComponentInstanceNew(comp, &data->audioUnit); + err = AudioComponentInstanceNew(comp, &self->audioUnit); if(err != noErr) { ERR("AudioComponentInstanceNew failed\n"); - free(data); return ALC_INVALID_VALUE; } /* init and start the default audio unit... */ - err = AudioUnitInitialize(data->audioUnit); + err = AudioUnitInitialize(self->audioUnit); if(err != noErr) { ERR("AudioUnitInitialize failed\n"); - AudioComponentInstanceDispose(data->audioUnit); - free(data); + AudioComponentInstanceDispose(self->audioUnit); return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ca_close_playback(ALCdevice *device) +static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self) { - ca_data *data = (ca_data*)device->ExtraData; - - AudioUnitUninitialize(data->audioUnit); - AudioComponentInstanceDispose(data->audioUnit); - - free(data); - device->ExtraData = NULL; -} - -static ALCboolean ca_reset_playback(ALCdevice *device) -{ - ca_data *data = (ca_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; AudioStreamBasicDescription streamFormat; AURenderCallbackStruct input; OSStatus err; UInt32 size; - err = AudioUnitUninitialize(data->audioUnit); + err = AudioUnitUninitialize(self->audioUnit); if(err != noErr) ERR("-- AudioUnitUninitialize failed.\n"); /* retrieve default output unit's properties (output side) */ size = sizeof(AudioStreamBasicDescription); - err = AudioUnitGetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &streamFormat, &size); + err = AudioUnitGetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &streamFormat, &size); if(err != noErr || size != sizeof(AudioStreamBasicDescription)) { ERR("AudioUnitGetProperty failed\n"); @@ -229,7 +176,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device) #endif /* set default output unit's input side to match output side */ - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, size); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, size); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -313,7 +260,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device) streamFormat.mFormatFlags |= kAudioFormatFlagsNativeEndian | kLinearPCMFormatFlagIsPacked; - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription)); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -321,11 +268,11 @@ static ALCboolean ca_reset_playback(ALCdevice *device) } /* setup callback */ - data->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); - input.inputProc = ca_callback; - input.inputProcRefCon = device; + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + input.inputProc = ALCcoreAudioPlayback_MixerProc; + input.inputProcRefCon = self; - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(AURenderCallbackStruct)); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(AURenderCallbackStruct)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -333,7 +280,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device) } /* init the default audio unit... */ - err = AudioUnitInitialize(data->audioUnit); + err = AudioUnitInitialize(self->audioUnit); if(err != noErr) { ERR("AudioUnitInitialize failed\n"); @@ -343,12 +290,9 @@ static ALCboolean ca_reset_playback(ALCdevice *device) return ALC_TRUE; } -static ALCboolean ca_start_playback(ALCdevice *device) +static ALCboolean ALCcoreAudioPlayback_start(ALCcoreAudioPlayback *self) { - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err; - - err = AudioOutputUnitStart(data->audioUnit); + OSStatus err = AudioOutputUnitStart(self->audioUnit); if(err != noErr) { ERR("AudioOutputUnitStart failed\n"); @@ -358,18 +302,150 @@ static ALCboolean ca_start_playback(ALCdevice *device) return ALC_TRUE; } -static void ca_stop_playback(ALCdevice *device) +static void ALCcoreAudioPlayback_stop(ALCcoreAudioPlayback *self) { - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err; - - err = AudioOutputUnitStop(data->audioUnit); + OSStatus err = AudioOutputUnitStop(self->audioUnit); if(err != noErr) ERR("AudioOutputUnitStop failed\n"); } -static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) + + + +typedef struct ALCcoreAudioCapture { + DERIVE_FROM_TYPE(ALCbackend); + + AudioUnit audioUnit; + + ALuint frameSize; + ALdouble sampleRateRatio; // Ratio of hardware sample rate / requested sample rate + AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD + + AudioConverterRef audioConverter; // Sample rate converter if needed + AudioBufferList *bufferList; // Buffer for data coming from the input device + ALCvoid *resampleBuffer; // Buffer for returned RingBuffer data when resampling + + ll_ringbuffer_t *ring; +} ALCcoreAudioCapture; + +static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *device); +static void ALCcoreAudioCapture_Destruct(ALCcoreAudioCapture *self); +static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar *name); +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, ALCboolean, reset) +static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self); +static void ALCcoreAudioCapture_stop(ALCcoreAudioCapture *self); +static ALCenum ALCcoreAudioCapture_captureSamples(ALCcoreAudioCapture *self, ALCvoid *buffer, ALCuint samples); +static ALCuint ALCcoreAudioCapture_availableSamples(ALCcoreAudioCapture *self); +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCcoreAudioCapture) + +DEFINE_ALCBACKEND_VTABLE(ALCcoreAudioCapture); + + +static AudioBufferList *allocate_buffer_list(UInt32 channelCount, UInt32 byteSize) { + AudioBufferList *list; + + list = calloc(1, FAM_SIZE(AudioBufferList, mBuffers, 1) + byteSize); + if(list) + { + list->mNumberBuffers = 1; + + list->mBuffers[0].mNumberChannels = channelCount; + list->mBuffers[0].mDataByteSize = byteSize; + list->mBuffers[0].mData = &list->mBuffers[1]; + } + return list; +} + +static void destroy_buffer_list(AudioBufferList *list) +{ + free(list); +} + + +static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCcoreAudioCapture, ALCbackend, self); + + self->audioUnit = 0; + self->audioConverter = NULL; + self->bufferList = NULL; + self->resampleBuffer = NULL; + self->ring = NULL; +} + +static void ALCcoreAudioCapture_Destruct(ALCcoreAudioCapture *self) +{ + ll_ringbuffer_free(self->ring); + self->ring = NULL; + + free(self->resampleBuffer); + self->resampleBuffer = NULL; + + destroy_buffer_list(self->bufferList); + self->bufferList = NULL; + + if(self->audioConverter) + AudioConverterDispose(self->audioConverter); + self->audioConverter = NULL; + + if(self->audioUnit) + AudioComponentInstanceDispose(self->audioUnit); + self->audioUnit = 0; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + + +static OSStatus ALCcoreAudioCapture_RecordProc(void *inRefCon, + AudioUnitRenderActionFlags* UNUSED(ioActionFlags), + const AudioTimeStamp *inTimeStamp, UInt32 UNUSED(inBusNumber), + UInt32 inNumberFrames, AudioBufferList* UNUSED(ioData)) +{ + ALCcoreAudioCapture *self = inRefCon; + AudioUnitRenderActionFlags flags = 0; + OSStatus err; + + // fill the bufferList with data from the input device + err = AudioUnitRender(self->audioUnit, &flags, inTimeStamp, 1, inNumberFrames, self->bufferList); + if(err != noErr) + { + ERR("AudioUnitRender error: %d\n", err); + return err; + } + + ll_ringbuffer_write(self->ring, self->bufferList->mBuffers[0].mData, inNumberFrames); + + return noErr; +} + +static OSStatus ALCcoreAudioCapture_ConvertCallback(AudioConverterRef UNUSED(inAudioConverter), + UInt32 *ioNumberDataPackets, AudioBufferList *ioData, + AudioStreamPacketDescription** UNUSED(outDataPacketDescription), + void *inUserData) +{ + ALCcoreAudioCapture *self = inUserData; + + // Read from the ring buffer and store temporarily in a large buffer + ll_ringbuffer_read(self->ring, self->resampleBuffer, *ioNumberDataPackets); + + // Set the input data + ioData->mNumberBuffers = 1; + ioData->mBuffers[0].mNumberChannels = self->format.mChannelsPerFrame; + ioData->mBuffers[0].mData = self->resampleBuffer; + ioData->mBuffers[0].mDataByteSize = (*ioNumberDataPackets) * self->format.mBytesPerFrame; + + return noErr; +} + + +static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; AudioStreamBasicDescription requestedFormat; // The application requested format AudioStreamBasicDescription hardwareFormat; // The hardware format AudioStreamBasicDescription outputFormat; // The AudioUnit output format @@ -381,12 +457,11 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) AudioObjectPropertyAddress propertyAddress; UInt32 enableIO; AudioComponent comp; - ca_data *data; OSStatus err; - if(!deviceName) - deviceName = ca_device; - else if(strcmp(deviceName, ca_device) != 0) + if(!name) + name = ca_device; + else if(strcmp(name, ca_device) != 0) return ALC_INVALID_VALUE; desc.componentType = kAudioUnitType_Output; @@ -403,11 +478,8 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - data = calloc(1, sizeof(*data)); - device->ExtraData = data; - // Open the component - err = AudioComponentInstanceNew(comp, &data->audioUnit); + err = AudioComponentInstanceNew(comp, &self->audioUnit); if(err != noErr) { ERR("AudioComponentInstanceNew failed\n"); @@ -416,7 +488,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) // Turn off AudioUnit output enableIO = 0; - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(ALuint)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(ALuint)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -425,7 +497,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) // Turn on AudioUnit input enableIO = 1; - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(ALuint)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(ALuint)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -453,7 +525,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Track the input device - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(AudioDeviceID)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(AudioDeviceID)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -461,10 +533,10 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // set capture callback - input.inputProc = ca_capture_callback; - input.inputProcRefCon = device; + input.inputProc = ALCcoreAudioCapture_RecordProc; + input.inputProcRefCon = self; - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &input, sizeof(AURenderCallbackStruct)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &input, sizeof(AURenderCallbackStruct)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -472,7 +544,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Initialize the device - err = AudioUnitInitialize(data->audioUnit); + err = AudioUnitInitialize(self->audioUnit); if(err != noErr) { ERR("AudioUnitInitialize failed\n"); @@ -481,7 +553,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) // Get the hardware format propertySize = sizeof(AudioStreamBasicDescription); - err = AudioUnitGetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &hardwareFormat, &propertySize); + err = AudioUnitGetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &hardwareFormat, &propertySize); if(err != noErr || propertySize != sizeof(AudioStreamBasicDescription)) { ERR("AudioUnitGetProperty failed\n"); @@ -528,9 +600,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) case DevFmtX51Rear: case DevFmtX61: case DevFmtX71: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: ERR("%s not supported\n", DevFmtChannelsString(device->FmtChans)); goto error; } @@ -543,8 +613,8 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) requestedFormat.mFramesPerPacket = 1; // save requested format description for later use - data->format = requestedFormat; - data->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->format = requestedFormat; + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); // Use intermediate format for sample rate conversion (outputFormat) // Set sample rate to the same as hardware for resampling later @@ -552,11 +622,11 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) outputFormat.mSampleRate = hardwareFormat.mSampleRate; // Determine sample rate ratio for resampling - data->sampleRateRatio = outputFormat.mSampleRate / device->Frequency; + self->sampleRateRatio = outputFormat.mSampleRate / device->Frequency; // The output format should be the requested format, but using the hardware sample rate // This is because the AudioUnit will automatically scale other properties, except for sample rate - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, (void *)&outputFormat, sizeof(outputFormat)); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, (void *)&outputFormat, sizeof(outputFormat)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -564,8 +634,8 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Set the AudioUnit output format frame count - outputFrameCount = device->UpdateSize * data->sampleRateRatio; - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Output, 0, &outputFrameCount, sizeof(outputFrameCount)); + outputFrameCount = device->UpdateSize * self->sampleRateRatio; + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Output, 0, &outputFrameCount, sizeof(outputFrameCount)); if(err != noErr) { ERR("AudioUnitSetProperty failed: %d\n", err); @@ -573,7 +643,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Set up sample converter - err = AudioConverterNew(&outputFormat, &requestedFormat, &data->audioConverter); + err = AudioConverterNew(&outputFormat, &requestedFormat, &self->audioConverter); if(err != noErr) { ERR("AudioConverterNew failed: %d\n", err); @@ -581,96 +651,83 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Create a buffer for use in the resample callback - data->resampleBuffer = malloc(device->UpdateSize * data->frameSize * data->sampleRateRatio); + self->resampleBuffer = malloc(device->UpdateSize * self->frameSize * self->sampleRateRatio); // Allocate buffer for the AudioUnit output - data->bufferList = allocate_buffer_list(outputFormat.mChannelsPerFrame, device->UpdateSize * data->frameSize * data->sampleRateRatio); - if(data->bufferList == NULL) + self->bufferList = allocate_buffer_list(outputFormat.mChannelsPerFrame, device->UpdateSize * self->frameSize * self->sampleRateRatio); + if(self->bufferList == NULL) goto error; - data->ring = ll_ringbuffer_create( - device->UpdateSize*data->sampleRateRatio*device->NumUpdates + 1, - data->frameSize + self->ring = ll_ringbuffer_create( + (size_t)ceil(device->UpdateSize*self->sampleRateRatio*device->NumUpdates), + self->frameSize, false ); - if(!data->ring) goto error; + if(!self->ring) goto error; - al_string_copy_cstr(&device->DeviceName, deviceName); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; error: - ll_ringbuffer_free(data->ring); - data->ring = NULL; - free(data->resampleBuffer); - destroy_buffer_list(data->bufferList); + ll_ringbuffer_free(self->ring); + self->ring = NULL; + free(self->resampleBuffer); + self->resampleBuffer = NULL; + destroy_buffer_list(self->bufferList); + self->bufferList = NULL; - if(data->audioConverter) - AudioConverterDispose(data->audioConverter); - if(data->audioUnit) - AudioComponentInstanceDispose(data->audioUnit); - - free(data); - device->ExtraData = NULL; + if(self->audioConverter) + AudioConverterDispose(self->audioConverter); + self->audioConverter = NULL; + if(self->audioUnit) + AudioComponentInstanceDispose(self->audioUnit); + self->audioUnit = 0; return ALC_INVALID_VALUE; } -static void ca_close_capture(ALCdevice *device) + +static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self) { - ca_data *data = (ca_data*)device->ExtraData; - - ll_ringbuffer_free(data->ring); - data->ring = NULL; - free(data->resampleBuffer); - destroy_buffer_list(data->bufferList); - - AudioConverterDispose(data->audioConverter); - AudioComponentInstanceDispose(data->audioUnit); - - free(data); - device->ExtraData = NULL; -} - -static void ca_start_capture(ALCdevice *device) -{ - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err = AudioOutputUnitStart(data->audioUnit); + OSStatus err = AudioOutputUnitStart(self->audioUnit); if(err != noErr) + { ERR("AudioOutputUnitStart failed\n"); + return ALC_FALSE; + } + return ALC_TRUE; } -static void ca_stop_capture(ALCdevice *device) +static void ALCcoreAudioCapture_stop(ALCcoreAudioCapture *self) { - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err = AudioOutputUnitStop(data->audioUnit); + OSStatus err = AudioOutputUnitStop(self->audioUnit); if(err != noErr) ERR("AudioOutputUnitStop failed\n"); } -static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) +static ALCenum ALCcoreAudioCapture_captureSamples(ALCcoreAudioCapture *self, ALCvoid *buffer, ALCuint samples) { - ca_data *data = (ca_data*)device->ExtraData; - AudioBufferList *list; + union { + ALbyte _[sizeof(AudioBufferList) + sizeof(AudioBuffer)]; + AudioBufferList list; + } audiobuf = { { 0 } }; UInt32 frameCount; OSStatus err; // If no samples are requested, just return - if(samples == 0) - return ALC_NO_ERROR; - - // Allocate a temporary AudioBufferList to use as the return resamples data - list = alloca(sizeof(AudioBufferList) + sizeof(AudioBuffer)); + if(samples == 0) return ALC_NO_ERROR; // Point the resampling buffer to the capture buffer - list->mNumberBuffers = 1; - list->mBuffers[0].mNumberChannels = data->format.mChannelsPerFrame; - list->mBuffers[0].mDataByteSize = samples * data->frameSize; - list->mBuffers[0].mData = buffer; + audiobuf.list.mNumberBuffers = 1; + audiobuf.list.mBuffers[0].mNumberChannels = self->format.mChannelsPerFrame; + audiobuf.list.mBuffers[0].mDataByteSize = samples * self->frameSize; + audiobuf.list.mBuffers[0].mData = buffer; // Resample into another AudioBufferList frameCount = samples; - err = AudioConverterFillComplexBuffer(data->audioConverter, ca_capture_conversion_callback, - device, &frameCount, list, NULL); + err = AudioConverterFillComplexBuffer(self->audioConverter, + ALCcoreAudioCapture_ConvertCallback, self, &frameCount, &audiobuf.list, NULL + ); if(err != noErr) { ERR("AudioConverterFillComplexBuffer error: %d\n", err); @@ -679,38 +736,47 @@ static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint sa return ALC_NO_ERROR; } -static ALCuint ca_available_samples(ALCdevice *device) +static ALCuint ALCcoreAudioCapture_availableSamples(ALCcoreAudioCapture *self) { - ca_data *data = device->ExtraData; - return ll_ringbuffer_read_space(data->ring) / data->sampleRateRatio; + return ll_ringbuffer_read_space(self->ring) / self->sampleRateRatio; } -static const BackendFuncs ca_funcs = { - ca_open_playback, - ca_close_playback, - ca_reset_playback, - ca_start_playback, - ca_stop_playback, - ca_open_capture, - ca_close_capture, - ca_start_capture, - ca_stop_capture, - ca_capture_samples, - ca_available_samples -}; +typedef struct ALCcoreAudioBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCcoreAudioBackendFactory; +#define ALCCOREAUDIOBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCcoreAudioBackendFactory, ALCbackendFactory) } } -ALCboolean alc_ca_init(BackendFuncs *func_list) +ALCbackendFactory *ALCcoreAudioBackendFactory_getFactory(void); + +static ALCboolean ALCcoreAudioBackendFactory_init(ALCcoreAudioBackendFactory *self); +static DECLARE_FORWARD(ALCcoreAudioBackendFactory, ALCbackendFactory, void, deinit) +static ALCboolean ALCcoreAudioBackendFactory_querySupport(ALCcoreAudioBackendFactory *self, ALCbackend_Type type); +static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory *self, enum DevProbe type); +static ALCbackend* ALCcoreAudioBackendFactory_createBackend(ALCcoreAudioBackendFactory *self, ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCcoreAudioBackendFactory); + + +ALCbackendFactory *ALCcoreAudioBackendFactory_getFactory(void) +{ + static ALCcoreAudioBackendFactory factory = ALCCOREAUDIOBACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} + + +static ALCboolean ALCcoreAudioBackendFactory_init(ALCcoreAudioBackendFactory* UNUSED(self)) { - *func_list = ca_funcs; return ALC_TRUE; } -void alc_ca_deinit(void) +static ALCboolean ALCcoreAudioBackendFactory_querySupport(ALCcoreAudioBackendFactory* UNUSED(self), ALCbackend_Type type) { + if(type == ALCbackend_Playback || ALCbackend_Capture) + return ALC_TRUE; + return ALC_FALSE; } -void alc_ca_probe(enum DevProbe type) +static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory* UNUSED(self), enum DevProbe type) { switch(type) { @@ -722,3 +788,23 @@ void alc_ca_probe(enum DevProbe type) break; } } + +static ALCbackend* ALCcoreAudioBackendFactory_createBackend(ALCcoreAudioBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCcoreAudioPlayback *backend; + NEW_OBJ(backend, ALCcoreAudioPlayback)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + if(type == ALCbackend_Capture) + { + ALCcoreAudioCapture *backend; + NEW_OBJ(backend, ALCcoreAudioCapture)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} diff --git a/Engine/lib/openal-soft/Alc/backends/dsound.c b/Engine/lib/openal-soft/Alc/backends/dsound.c index bb38d516b..6bab641c7 100644 --- a/Engine/lib/openal-soft/Alc/backends/dsound.c +++ b/Engine/lib/openal-soft/Alc/backends/dsound.c @@ -34,6 +34,7 @@ #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" #include "alstring.h" @@ -145,16 +146,16 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA { const DevMap *iter; - al_string_copy_cstr(&entry.name, DEVNAME_HEAD); - al_string_append_wcstr(&entry.name, desc); + alstr_copy_cstr(&entry.name, DEVNAME_HEAD); + alstr_append_wcstr(&entry.name, desc); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, *devices, MATCH_ENTRY); if(iter == VECTOR_END(*devices)) break; #undef MATCH_ENTRY @@ -165,7 +166,7 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA hr = StringFromCLSID(guid, &guidstr); if(SUCCEEDED(hr)) { - TRACE("Got device \"%s\", GUID \"%ls\"\n", al_string_get_cstr(entry.name), guidstr); + TRACE("Got device \"%s\", GUID \"%ls\"\n", alstr_get_cstr(entry.name), guidstr); CoTaskMemFree(guidstr); } @@ -184,16 +185,15 @@ typedef struct ALCdsoundPlayback { IDirectSoundNotify *Notifies; HANDLE NotifyEvent; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCdsoundPlayback; static int ALCdsoundPlayback_mixerProc(void *ptr); static void ALCdsoundPlayback_Construct(ALCdsoundPlayback *self, ALCdevice *device); -static DECLARE_FORWARD(ALCdsoundPlayback, ALCbackend, void, Destruct) +static void ALCdsoundPlayback_Destruct(ALCdsoundPlayback *self); static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *name); -static void ALCdsoundPlayback_close(ALCdsoundPlayback *self); static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self); static ALCboolean ALCdsoundPlayback_start(ALCdsoundPlayback *self); static void ALCdsoundPlayback_stop(ALCdsoundPlayback *self); @@ -211,6 +211,35 @@ static void ALCdsoundPlayback_Construct(ALCdsoundPlayback *self, ALCdevice *devi { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCdsoundPlayback, ALCbackend, self); + + self->DS = NULL; + self->PrimaryBuffer = NULL; + self->Buffer = NULL; + self->Notifies = NULL; + self->NotifyEvent = NULL; + ATOMIC_INIT(&self->killNow, AL_TRUE); +} + +static void ALCdsoundPlayback_Destruct(ALCdsoundPlayback *self) +{ + if(self->Notifies) + IDirectSoundNotify_Release(self->Notifies); + self->Notifies = NULL; + if(self->Buffer) + IDirectSoundBuffer_Release(self->Buffer); + self->Buffer = NULL; + if(self->PrimaryBuffer != NULL) + IDirectSoundBuffer_Release(self->PrimaryBuffer); + self->PrimaryBuffer = NULL; + + if(self->DS) + IDirectSound_Release(self->DS); + self->DS = NULL; + if(self->NotifyEvent) + CloseHandle(self->NotifyEvent); + self->NotifyEvent = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -239,16 +268,17 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) { ERR("Failed to get buffer caps: 0x%lx\n", err); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failure retrieving playback buffer info: 0x%lx", err); ALCdevice_Unlock(device); return 1; } - FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); FragSize = device->UpdateSize * FrameSize; IDirectSoundBuffer_GetCurrentPosition(self->Buffer, &LastCursor, NULL); - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { // Get current play cursor IDirectSoundBuffer_GetCurrentPosition(self->Buffer, &PlayCursor, NULL); @@ -263,7 +293,7 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) { ERR("Failed to play buffer: 0x%lx\n", err); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failure starting playback: 0x%lx", err); ALCdevice_Unlock(device); return 1; } @@ -299,8 +329,10 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) if(SUCCEEDED(err)) { // If we have an active context, mix data directly into output buffer otherwise fill with silence + ALCdevice_Lock(device); aluMixData(device, WritePtr1, WriteCnt1/FrameSize); aluMixData(device, WritePtr2, WriteCnt2/FrameSize); + ALCdevice_Unlock(device); // Unlock output buffer only when successfully locked IDirectSoundBuffer_Unlock(self->Buffer, WritePtr1, WriteCnt1, WritePtr2, WriteCnt2); @@ -309,7 +341,7 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) { ERR("Buffer lock error: %#lx\n", err); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to lock output buffer: 0x%lx", err); ALCdevice_Unlock(device); return 1; } @@ -341,14 +373,14 @@ static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *de if(!deviceName && VECTOR_SIZE(PlaybackDevices) > 0) { - deviceName = al_string_get_cstr(VECTOR_FRONT(PlaybackDevices).name); + deviceName = alstr_get_cstr(VECTOR_FRONT(PlaybackDevices).name); guid = &VECTOR_FRONT(PlaybackDevices).guid; } else { const DevMap *iter; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) @@ -379,29 +411,11 @@ static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *de return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, deviceName); + alstr_copy_cstr(&device->DeviceName, deviceName); return ALC_NO_ERROR; } -static void ALCdsoundPlayback_close(ALCdsoundPlayback *self) -{ - if(self->Notifies) - IDirectSoundNotify_Release(self->Notifies); - self->Notifies = NULL; - if(self->Buffer) - IDirectSoundBuffer_Release(self->Buffer); - self->Buffer = NULL; - if(self->PrimaryBuffer != NULL) - IDirectSoundBuffer_Release(self->PrimaryBuffer); - self->PrimaryBuffer = NULL; - - IDirectSound_Release(self->DS); - self->DS = NULL; - CloseHandle(self->NotifyEvent); - self->NotifyEvent = NULL; -} - static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -472,9 +486,7 @@ static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self) case DevFmtMono: OutputType.dwChannelMask = SPEAKER_FRONT_CENTER; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: device->FmtChans = DevFmtStereo; /*fall-through*/ case DevFmtStereo: @@ -527,7 +539,7 @@ static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self) retry_open: hr = S_OK; OutputType.Format.wFormatTag = WAVE_FORMAT_PCM; - OutputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans); + OutputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); OutputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; OutputType.Format.nBlockAlign = OutputType.Format.nChannels*OutputType.Format.wBitsPerSample/8; OutputType.Format.nSamplesPerSec = device->Frequency; @@ -626,7 +638,7 @@ retry_open: static ALCboolean ALCdsoundPlayback_start(ALCdsoundPlayback *self) { - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCdsoundPlayback_mixerProc, self) != althrd_success) return ALC_FALSE; @@ -637,10 +649,8 @@ static void ALCdsoundPlayback_stop(ALCdsoundPlayback *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); IDirectSoundBuffer_Stop(self->Buffer); @@ -660,9 +670,8 @@ typedef struct ALCdsoundCapture { } ALCdsoundCapture; static void ALCdsoundCapture_Construct(ALCdsoundCapture *self, ALCdevice *device); -static DECLARE_FORWARD(ALCdsoundCapture, ALCbackend, void, Destruct) +static void ALCdsoundCapture_Destruct(ALCdsoundCapture *self); static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *name); -static void ALCdsoundCapture_close(ALCdsoundCapture *self); static DECLARE_FORWARD(ALCdsoundCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCdsoundCapture_start(ALCdsoundCapture *self); static void ALCdsoundCapture_stop(ALCdsoundCapture *self); @@ -679,6 +688,29 @@ static void ALCdsoundCapture_Construct(ALCdsoundCapture *self, ALCdevice *device { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCdsoundCapture, ALCbackend, self); + + self->DSC = NULL; + self->DSCbuffer = NULL; + self->Ring = NULL; +} + +static void ALCdsoundCapture_Destruct(ALCdsoundCapture *self) +{ + ll_ringbuffer_free(self->Ring); + self->Ring = NULL; + + if(self->DSCbuffer != NULL) + { + IDirectSoundCaptureBuffer_Stop(self->DSCbuffer); + IDirectSoundCaptureBuffer_Release(self->DSCbuffer); + self->DSCbuffer = NULL; + } + + if(self->DSC) + IDirectSoundCapture_Release(self->DSC); + self->DSC = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -704,14 +736,14 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi if(!deviceName && VECTOR_SIZE(CaptureDevices) > 0) { - deviceName = al_string_get_cstr(VECTOR_FRONT(CaptureDevices).name); + deviceName = alstr_get_cstr(VECTOR_FRONT(CaptureDevices).name); guid = &VECTOR_FRONT(CaptureDevices).guid; } else { const DevMap *iter; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) @@ -734,102 +766,98 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi break; } + memset(&InputType, 0, sizeof(InputType)); + switch(device->FmtChans) + { + case DevFmtMono: + InputType.dwChannelMask = SPEAKER_FRONT_CENTER; + break; + case DevFmtStereo: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT; + break; + case DevFmtQuad: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_BACK_LEFT | + SPEAKER_BACK_RIGHT; + break; + case DevFmtX51: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_SIDE_LEFT | + SPEAKER_SIDE_RIGHT; + break; + case DevFmtX51Rear: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_BACK_LEFT | + SPEAKER_BACK_RIGHT; + break; + case DevFmtX61: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_BACK_CENTER | + SPEAKER_SIDE_LEFT | + SPEAKER_SIDE_RIGHT; + break; + case DevFmtX71: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_BACK_LEFT | + SPEAKER_BACK_RIGHT | + SPEAKER_SIDE_LEFT | + SPEAKER_SIDE_RIGHT; + break; + case DevFmtAmbi3D: + WARN("%s capture not supported\n", DevFmtChannelsString(device->FmtChans)); + return ALC_INVALID_ENUM; + } + + InputType.Format.wFormatTag = WAVE_FORMAT_PCM; + InputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + InputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + InputType.Format.nBlockAlign = InputType.Format.nChannels*InputType.Format.wBitsPerSample/8; + InputType.Format.nSamplesPerSec = device->Frequency; + InputType.Format.nAvgBytesPerSec = InputType.Format.nSamplesPerSec*InputType.Format.nBlockAlign; + InputType.Format.cbSize = 0; + InputType.Samples.wValidBitsPerSample = InputType.Format.wBitsPerSample; + if(device->FmtType == DevFmtFloat) + InputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + else + InputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + + if(InputType.Format.nChannels > 2 || device->FmtType == DevFmtFloat) + { + InputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + InputType.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); + } + + samples = device->UpdateSize * device->NumUpdates; + samples = maxu(samples, 100 * device->Frequency / 1000); + + memset(&DSCBDescription, 0, sizeof(DSCBUFFERDESC)); + DSCBDescription.dwSize = sizeof(DSCBUFFERDESC); + DSCBDescription.dwFlags = 0; + DSCBDescription.dwBufferBytes = samples * InputType.Format.nBlockAlign; + DSCBDescription.lpwfxFormat = &InputType.Format; + //DirectSoundCapture Init code hr = DirectSoundCaptureCreate(guid, &self->DSC, NULL); if(SUCCEEDED(hr)) - { - memset(&InputType, 0, sizeof(InputType)); - - switch(device->FmtChans) - { - case DevFmtMono: - InputType.dwChannelMask = SPEAKER_FRONT_CENTER; - break; - case DevFmtStereo: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT; - break; - case DevFmtQuad: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_BACK_LEFT | - SPEAKER_BACK_RIGHT; - break; - case DevFmtX51: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_SIDE_LEFT | - SPEAKER_SIDE_RIGHT; - break; - case DevFmtX51Rear: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_BACK_LEFT | - SPEAKER_BACK_RIGHT; - break; - case DevFmtX61: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_BACK_CENTER | - SPEAKER_SIDE_LEFT | - SPEAKER_SIDE_RIGHT; - break; - case DevFmtX71: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_BACK_LEFT | - SPEAKER_BACK_RIGHT | - SPEAKER_SIDE_LEFT | - SPEAKER_SIDE_RIGHT; - break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: - break; - } - - InputType.Format.wFormatTag = WAVE_FORMAT_PCM; - InputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans); - InputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; - InputType.Format.nBlockAlign = InputType.Format.nChannels*InputType.Format.wBitsPerSample/8; - InputType.Format.nSamplesPerSec = device->Frequency; - InputType.Format.nAvgBytesPerSec = InputType.Format.nSamplesPerSec*InputType.Format.nBlockAlign; - InputType.Format.cbSize = 0; - - if(InputType.Format.nChannels > 2 || device->FmtType == DevFmtFloat) - { - InputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; - InputType.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); - InputType.Samples.wValidBitsPerSample = InputType.Format.wBitsPerSample; - if(device->FmtType == DevFmtFloat) - InputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; - else - InputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; - } - - samples = device->UpdateSize * device->NumUpdates; - samples = maxu(samples, 100 * device->Frequency / 1000); - - memset(&DSCBDescription, 0, sizeof(DSCBUFFERDESC)); - DSCBDescription.dwSize = sizeof(DSCBUFFERDESC); - DSCBDescription.dwFlags = 0; - DSCBDescription.dwBufferBytes = samples * InputType.Format.nBlockAlign; - DSCBDescription.lpwfxFormat = &InputType.Format; - hr = IDirectSoundCapture_CreateCaptureBuffer(self->DSC, &DSCBDescription, &self->DSCbuffer, NULL); - } if(SUCCEEDED(hr)) { - self->Ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates + 1, - InputType.Format.nBlockAlign); + self->Ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, + InputType.Format.nBlockAlign, false); if(self->Ring == NULL) hr = DSERR_OUTOFMEMORY; } @@ -853,27 +881,11 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi self->BufferBytes = DSCBDescription.dwBufferBytes; SetDefaultWFXChannelOrder(device); - al_string_copy_cstr(&device->DeviceName, deviceName); + alstr_copy_cstr(&device->DeviceName, deviceName); return ALC_NO_ERROR; } -static void ALCdsoundCapture_close(ALCdsoundCapture *self) -{ - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; - - if(self->DSCbuffer != NULL) - { - IDirectSoundCaptureBuffer_Stop(self->DSCbuffer); - IDirectSoundCaptureBuffer_Release(self->DSCbuffer); - self->DSCbuffer = NULL; - } - - IDirectSoundCapture_Release(self->DSC); - self->DSC = NULL; -} - static ALCboolean ALCdsoundCapture_start(ALCdsoundCapture *self) { HRESULT hr; @@ -882,7 +894,8 @@ static ALCboolean ALCdsoundCapture_start(ALCdsoundCapture *self) if(FAILED(hr)) { ERR("start failed: 0x%08lx\n", hr); - aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, + "Failure starting capture: 0x%lx", hr); return ALC_FALSE; } @@ -897,7 +910,8 @@ static void ALCdsoundCapture_stop(ALCdsoundCapture *self) if(FAILED(hr)) { ERR("stop failed: 0x%08lx\n", hr); - aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, + "Failure stopping capture: 0x%lx", hr); } } @@ -916,10 +930,10 @@ static ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self) DWORD FrameSize; HRESULT hr; - if(!device->Connected) + if(!ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) goto done; - FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); BufferBytes = self->BufferBytes; LastCursor = self->Cursor; @@ -947,18 +961,18 @@ static ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self) if(FAILED(hr)) { ERR("update failed: 0x%08lx\n", hr); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failure retrieving capture data: 0x%lx", hr); } done: - return ll_ringbuffer_read_space(self->Ring); + return (ALCuint)ll_ringbuffer_read_space(self->Ring); } static inline void AppendAllDevicesList2(const DevMap *entry) -{ AppendAllDevicesList(al_string_get_cstr(entry->name)); } +{ AppendAllDevicesList(alstr_get_cstr(entry->name)); } static inline void AppendCaptureDeviceList2(const DevMap *entry) -{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); } +{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); } typedef struct ALCdsoundBackendFactory { DERIVE_FROM_TYPE(ALCbackendFactory); diff --git a/Engine/lib/openal-soft/Alc/backends/jack.c b/Engine/lib/openal-soft/Alc/backends/jack.c index 283df297a..67e3c1068 100644 --- a/Engine/lib/openal-soft/Alc/backends/jack.c +++ b/Engine/lib/openal-soft/Alc/backends/jack.c @@ -26,6 +26,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" @@ -63,6 +65,7 @@ static const ALCchar jackDevice[] = "JACK Default"; static void *jack_handle; #define MAKE_FUNC(f) static __typeof(f) * p##f JACK_FUNCS(MAKE_FUNC); +static __typeof(jack_error_callback) * pjack_error_callback; #undef MAKE_FUNC #define jack_client_open pjack_client_open @@ -84,6 +87,7 @@ JACK_FUNCS(MAKE_FUNC); #define jack_set_buffer_size_callback pjack_set_buffer_size_callback #define jack_set_buffer_size pjack_set_buffer_size #define jack_get_buffer_size pjack_get_buffer_size +#define jack_error_callback (*pjack_error_callback) #endif @@ -96,6 +100,8 @@ static ALCboolean jack_load(void) #ifdef HAVE_DYNLOAD if(!jack_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + #ifdef _WIN32 #define JACKLIB "libjack.dll" #else @@ -103,24 +109,33 @@ static ALCboolean jack_load(void) #endif jack_handle = LoadLib(JACKLIB); if(!jack_handle) + { + WARN("Failed to load %s\n", JACKLIB); return ALC_FALSE; + } error = ALC_FALSE; #define LOAD_FUNC(f) do { \ p##f = GetSymbol(jack_handle, #f); \ if(p##f == NULL) { \ error = ALC_TRUE; \ + alstr_append_cstr(&missing_funcs, "\n" #f); \ } \ } while(0) JACK_FUNCS(LOAD_FUNC); #undef LOAD_FUNC + /* Optional symbols. These don't exist in all versions of JACK. */ +#define LOAD_SYM(f) p##f = GetSymbol(jack_handle, #f) + LOAD_SYM(jack_error_callback); +#undef LOAD_SYM if(error) { + WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs)); CloseLib(jack_handle); jack_handle = NULL; - return ALC_FALSE; } + alstr_reset(&missing_funcs); } #endif @@ -135,9 +150,9 @@ typedef struct ALCjackPlayback { jack_port_t *Port[MAX_OUTPUT_CHANNELS]; ll_ringbuffer_t *Ring; - alcnd_t Cond; + alsem_t Sem; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCjackPlayback; @@ -149,15 +164,14 @@ static int ALCjackPlayback_mixerProc(void *arg); static void ALCjackPlayback_Construct(ALCjackPlayback *self, ALCdevice *device); static void ALCjackPlayback_Destruct(ALCjackPlayback *self); static ALCenum ALCjackPlayback_open(ALCjackPlayback *self, const ALCchar *name); -static void ALCjackPlayback_close(ALCjackPlayback *self); static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self); static ALCboolean ALCjackPlayback_start(ALCjackPlayback *self); static void ALCjackPlayback_stop(ALCjackPlayback *self); static DECLARE_FORWARD2(ALCjackPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint) static DECLARE_FORWARD(ALCjackPlayback, ALCbackend, ALCuint, availableSamples) static ClockLatency ALCjackPlayback_getClockLatency(ALCjackPlayback *self); -static void ALCjackPlayback_lock(ALCjackPlayback *self); -static void ALCjackPlayback_unlock(ALCjackPlayback *self); +static DECLARE_FORWARD(ALCjackPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCjackPlayback, ALCbackend, void, unlock) DECLARE_DEFAULT_ALLOCATORS(ALCjackPlayback) DEFINE_ALCBACKEND_VTABLE(ALCjackPlayback); @@ -170,14 +184,14 @@ static void ALCjackPlayback_Construct(ALCjackPlayback *self, ALCdevice *device) ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCjackPlayback, ALCbackend, self); - alcnd_init(&self->Cond); + alsem_init(&self->Sem, 0); self->Client = NULL; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) self->Port[i] = NULL; self->Ring = NULL; - self->killNow = 1; + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCjackPlayback_Destruct(ALCjackPlayback *self) @@ -196,7 +210,7 @@ static void ALCjackPlayback_Destruct(ALCjackPlayback *self) self->Client = NULL; } - alcnd_destroy(&self->Cond); + alsem_destroy(&self->Sem); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -211,19 +225,23 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg) ALCjackPlayback_lock(self); device->UpdateSize = numframes; device->NumUpdates = 2; - TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates); bufsize = device->UpdateSize; - if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) + if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize); - bufsize += device->UpdateSize; + device->NumUpdates = (bufsize+device->UpdateSize) / device->UpdateSize; + + TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates); ll_ringbuffer_free(self->Ring); - self->Ring = ll_ringbuffer_create(bufsize, FrameSizeFromDevFmt(device->FmtChans, device->FmtType)); + self->Ring = ll_ringbuffer_create(bufsize, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + true + ); if(!self->Ring) { ERR("Failed to reallocate ringbuffer\n"); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to reallocate %u-sample buffer", bufsize); } ALCjackPlayback_unlock(self); return 0; @@ -237,7 +255,7 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) ll_ringbuffer_data_t data[2]; jack_nframes_t total = 0; jack_nframes_t todo; - ALuint i, c, numchans; + ALsizei i, c, numchans; ll_ringbuffer_get_read_vector(self->Ring, data); @@ -248,8 +266,9 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) todo = minu(numframes, data[0].len); for(c = 0;c < numchans;c++) { - for(i = 0;i < todo;i++) - out[c][i] = ((ALfloat*)data[0].buf)[i*numchans + c]; + const ALfloat *restrict in = ((ALfloat*)data[0].buf) + c; + for(i = 0;(jack_nframes_t)i < todo;i++) + out[c][i] = in[i*numchans]; out[c] += todo; } total += todo; @@ -259,22 +278,23 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) { for(c = 0;c < numchans;c++) { - for(i = 0;i < todo;i++) - out[c][i] = ((ALfloat*)data[1].buf)[i*numchans + c]; + const ALfloat *restrict in = ((ALfloat*)data[1].buf) + c; + for(i = 0;(jack_nframes_t)i < todo;i++) + out[c][i] = in[i*numchans]; out[c] += todo; } total += todo; } ll_ringbuffer_read_advance(self->Ring, total); - alcnd_signal(&self->Cond); + alsem_post(&self->Sem); if(numframes > total) { todo = numframes-total; for(c = 0;c < numchans;c++) { - for(i = 0;i < todo;i++) + for(i = 0;(jack_nframes_t)i < todo;i++) out[c][i] = 0.0f; } } @@ -292,27 +312,16 @@ static int ALCjackPlayback_mixerProc(void *arg) althrd_setname(althrd_current(), MIXER_THREAD_NAME); ALCjackPlayback_lock(self); - while(!self->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { ALuint todo, len1, len2; - /* NOTE: Unfortunately, there is an unavoidable race condition here. - * It's possible for the process() method to run, updating the read - * pointer and signaling the condition variable, in between the mixer - * loop checking the write size and waiting for the condition variable. - * This will cause the mixer loop to wait until the *next* process() - * invocation, most likely writing silence for it. - * - * However, this should only happen if the mixer is running behind - * anyway (as ideally we'll be asleep in alcnd_wait by the time the - * process() method is invoked), so this behavior is not unwarranted. - * It's unfortunate since it'll be wasting time sleeping that could be - * used to catch up, but there's no way around it without blocking in - * the process() method. - */ if(ll_ringbuffer_write_space(self->Ring) < device->UpdateSize) { - alcnd_wait(&self->Cond, &STATIC_CAST(ALCbackend,self)->mMutex); + ALCjackPlayback_unlock(self); + alsem_wait(&self->Sem); + ALCjackPlayback_lock(self); continue; } @@ -362,29 +371,15 @@ static ALCenum ALCjackPlayback_open(ALCjackPlayback *self, const ALCchar *name) jack_set_process_callback(self->Client, ALCjackPlayback_process, self); jack_set_buffer_size_callback(self->Client, ALCjackPlayback_bufferSizeNotify, self); - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCjackPlayback_close(ALCjackPlayback *self) -{ - ALuint i; - - for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - { - if(self->Port[i]) - jack_port_unregister(self->Client, self->Port[i]); - self->Port[i] = NULL; - } - jack_client_close(self->Client); - self->Client = NULL; -} - static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - ALuint numchans, i; + ALsizei numchans, i; ALuint bufsize; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) @@ -395,23 +390,21 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) } /* Ignore the requested buffer metrics and just keep one JACK-sized buffer - * ready for when requested. Note that one period's worth of audio in the - * ring buffer will always be left unfilled because one element of the ring - * buffer will not be writeable, and we only write in period-sized chunks. + * ready for when requested. */ device->Frequency = jack_get_sample_rate(self->Client); device->UpdateSize = jack_get_buffer_size(self->Client); device->NumUpdates = 2; bufsize = device->UpdateSize; - if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) + if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize); - bufsize += device->UpdateSize; + device->NumUpdates = (bufsize+device->UpdateSize) / device->UpdateSize; /* Force 32-bit float output. */ device->FmtType = DevFmtFloat; - numchans = ChannelsFromDevFmt(device->FmtChans); + numchans = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); for(i = 0;i < numchans;i++) { char name[64]; @@ -440,7 +433,10 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) } ll_ringbuffer_free(self->Ring); - self->Ring = ll_ringbuffer_create(bufsize, FrameSizeFromDevFmt(device->FmtChans, device->FmtType)); + self->Ring = ll_ringbuffer_create(bufsize, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + true + ); if(!self->Ring) { ERR("Failed to allocate ringbuffer\n"); @@ -455,7 +451,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) static ALCboolean ALCjackPlayback_start(ALCjackPlayback *self) { const char **ports; - ALuint i; + ALsizei i; if(jack_activate(self->Client)) { @@ -482,7 +478,7 @@ static ALCboolean ALCjackPlayback_start(ALCjackPlayback *self) } jack_free(ports); - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCjackPlayback_mixerProc, self) != althrd_success) { jack_deactivate(self->Client); @@ -496,17 +492,10 @@ static void ALCjackPlayback_stop(ALCjackPlayback *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - self->killNow = 1; - /* Lock the backend to ensure we don't flag the mixer to die and signal the - * mixer to wake up in between it checking the flag and going to sleep and - * wait for a wakeup (potentially leading to it never waking back up to see - * the flag). */ - ALCjackPlayback_lock(self); - ALCjackPlayback_unlock(self); - alcnd_signal(&self->Cond); + alsem_post(&self->Sem); althrd_join(self->thread, &res); jack_deactivate(self->Client); @@ -528,17 +517,6 @@ static ClockLatency ALCjackPlayback_getClockLatency(ALCjackPlayback *self) } -static void ALCjackPlayback_lock(ALCjackPlayback *self) -{ - almtx_lock(&STATIC_CAST(ALCbackend,self)->mMutex); -} - -static void ALCjackPlayback_unlock(ALCjackPlayback *self) -{ - almtx_unlock(&STATIC_CAST(ALCbackend,self)->mMutex); -} - - static void jack_msg_handler(const char *message) { WARN("%s\n", message); @@ -551,6 +529,7 @@ typedef struct ALCjackBackendFactory { static ALCboolean ALCjackBackendFactory_init(ALCjackBackendFactory* UNUSED(self)) { + void (*old_error_cb)(const char*); jack_client_t *client; jack_status_t status; @@ -560,9 +539,10 @@ static ALCboolean ALCjackBackendFactory_init(ALCjackBackendFactory* UNUSED(self) if(!GetConfigValueBool(NULL, "jack", "spawn-server", 0)) ClientOptions |= JackNoStartServer; + old_error_cb = (&jack_error_callback ? jack_error_callback : NULL); jack_set_error_function(jack_msg_handler); client = jack_client_open("alsoft", ClientOptions, &status, NULL); - jack_set_error_function(NULL); + jack_set_error_function(old_error_cb); if(client == NULL) { WARN("jack_client_open() failed, 0x%02x\n", status); diff --git a/Engine/lib/openal-soft/Alc/backends/loopback.c b/Engine/lib/openal-soft/Alc/backends/loopback.c index 0164bc5a7..9186a92f6 100644 --- a/Engine/lib/openal-soft/Alc/backends/loopback.c +++ b/Engine/lib/openal-soft/Alc/backends/loopback.c @@ -35,7 +35,6 @@ typedef struct ALCloopback { static void ALCloopback_Construct(ALCloopback *self, ALCdevice *device); static DECLARE_FORWARD(ALCloopback, ALCbackend, void, Destruct) static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name); -static void ALCloopback_close(ALCloopback *self); static ALCboolean ALCloopback_reset(ALCloopback *self); static ALCboolean ALCloopback_start(ALCloopback *self); static void ALCloopback_stop(ALCloopback *self); @@ -59,14 +58,10 @@ static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCloopback_close(ALCloopback* UNUSED(self)) -{ -} - static ALCboolean ALCloopback_reset(ALCloopback *self) { SetDefaultWFXChannelOrder(STATIC_CAST(ALCbackend, self)->mDevice); diff --git a/Engine/lib/openal-soft/Alc/backends/null.c b/Engine/lib/openal-soft/Alc/backends/null.c index 5b153cd97..2c2db54ef 100644 --- a/Engine/lib/openal-soft/Alc/backends/null.c +++ b/Engine/lib/openal-soft/Alc/backends/null.c @@ -36,7 +36,7 @@ typedef struct ALCnullBackend { DERIVE_FROM_TYPE(ALCbackend); - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; } ALCnullBackend; @@ -45,7 +45,6 @@ static int ALCnullBackend_mixerProc(void *ptr); static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device); static DECLARE_FORWARD(ALCnullBackend, ALCbackend, void, Destruct) static ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name); -static void ALCnullBackend_close(ALCnullBackend *self); static ALCboolean ALCnullBackend_reset(ALCnullBackend *self); static ALCboolean ALCnullBackend_start(ALCnullBackend *self); static void ALCnullBackend_stop(ALCnullBackend *self); @@ -66,6 +65,8 @@ static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCnullBackend, ALCbackend, self); + + ATOMIC_INIT(&self->killNow, AL_TRUE); } @@ -87,7 +88,8 @@ static int ALCnullBackend_mixerProc(void *ptr) ERR("Failed to get starting time\n"); return 1; } - while(!self->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { if(altimespec_get(&now, AL_TIME_UTC) != AL_TIME_UTC) { @@ -109,7 +111,9 @@ static int ALCnullBackend_mixerProc(void *ptr) al_nssleep(restTime); else while(avail-done >= device->UpdateSize) { + ALCnullBackend_lock(self); aluMixData(device, NULL, device->UpdateSize); + ALCnullBackend_unlock(self); done += device->UpdateSize; } } @@ -128,15 +132,11 @@ static ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name) return ALC_INVALID_VALUE; device = STATIC_CAST(ALCbackend, self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCnullBackend_close(ALCnullBackend* UNUSED(self)) -{ -} - static ALCboolean ALCnullBackend_reset(ALCnullBackend *self) { SetDefaultWFXChannelOrder(STATIC_CAST(ALCbackend, self)->mDevice); @@ -145,7 +145,7 @@ static ALCboolean ALCnullBackend_reset(ALCnullBackend *self) static ALCboolean ALCnullBackend_start(ALCnullBackend *self) { - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCnullBackend_mixerProc, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; @@ -155,10 +155,8 @@ static void ALCnullBackend_stop(ALCnullBackend *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); } diff --git a/Engine/lib/openal-soft/Alc/backends/opensl.c b/Engine/lib/openal-soft/Alc/backends/opensl.c index 0796c49ab..a5ad3b098 100644 --- a/Engine/lib/openal-soft/Alc/backends/opensl.c +++ b/Engine/lib/openal-soft/Alc/backends/opensl.c @@ -22,38 +22,25 @@ #include "config.h" #include +#include #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" +#include "compat.h" + +#include "backends/base.h" #include #include +#include /* Helper macros */ #define VCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS #define VCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS -typedef struct { - /* engine interfaces */ - SLObjectItf engineObject; - SLEngineItf engine; - - /* output mix interfaces */ - SLObjectItf outputMix; - - /* buffer queue player interfaces */ - SLObjectItf bufferQueueObject; - - void *buffer; - ALuint bufferSize; - ALuint curBuffer; - - ALuint frameSize; -} osl_data; - - static const ALCchar opensl_device[] = "OpenSL"; @@ -79,14 +66,32 @@ static SLuint32 GetChannelMask(enum DevFmtChannels chans) SL_SPEAKER_FRONT_CENTER|SL_SPEAKER_LOW_FREQUENCY| SL_SPEAKER_BACK_LEFT|SL_SPEAKER_BACK_RIGHT| SL_SPEAKER_SIDE_LEFT|SL_SPEAKER_SIDE_RIGHT; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: break; } return 0; } +#ifdef SL_DATAFORMAT_PCM_EX +static SLuint32 GetTypeRepresentation(enum DevFmtType type) +{ + switch(type) + { + case DevFmtUByte: + case DevFmtUShort: + case DevFmtUInt: + return SL_PCM_REPRESENTATION_UNSIGNED_INT; + case DevFmtByte: + case DevFmtShort: + case DevFmtInt: + return SL_PCM_REPRESENTATION_SIGNED_INT; + case DevFmtFloat: + return SL_PCM_REPRESENTATION_FLOAT; + } + return 0; +} +#endif + static const char *res_str(SLresult result) { switch(result) @@ -126,168 +131,427 @@ static const char *res_str(SLresult result) ERR("%s: %s\n", (s), res_str((x))); \ } while(0) -/* this callback handler is called every time a buffer finishes playing */ -static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *context) + +typedef struct ALCopenslPlayback { + DERIVE_FROM_TYPE(ALCbackend); + + /* engine interfaces */ + SLObjectItf mEngineObj; + SLEngineItf mEngine; + + /* output mix interfaces */ + SLObjectItf mOutputMix; + + /* buffer queue player interfaces */ + SLObjectItf mBufferQueueObj; + + ll_ringbuffer_t *mRing; + alsem_t mSem; + + ALsizei mFrameSize; + + ATOMIC(ALenum) mKillNow; + althrd_t mThread; +} ALCopenslPlayback; + +static void ALCopenslPlayback_process(SLAndroidSimpleBufferQueueItf bq, void *context); +static int ALCopenslPlayback_mixerProc(void *arg); + +static void ALCopenslPlayback_Construct(ALCopenslPlayback *self, ALCdevice *device); +static void ALCopenslPlayback_Destruct(ALCopenslPlayback *self); +static ALCenum ALCopenslPlayback_open(ALCopenslPlayback *self, const ALCchar *name); +static ALCboolean ALCopenslPlayback_reset(ALCopenslPlayback *self); +static ALCboolean ALCopenslPlayback_start(ALCopenslPlayback *self); +static void ALCopenslPlayback_stop(ALCopenslPlayback *self); +static DECLARE_FORWARD2(ALCopenslPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCopenslPlayback, ALCbackend, ALCuint, availableSamples) +static ClockLatency ALCopenslPlayback_getClockLatency(ALCopenslPlayback *self); +static DECLARE_FORWARD(ALCopenslPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCopenslPlayback, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCopenslPlayback) + +DEFINE_ALCBACKEND_VTABLE(ALCopenslPlayback); + + +static void ALCopenslPlayback_Construct(ALCopenslPlayback *self, ALCdevice *device) { - ALCdevice *Device = context; - osl_data *data = Device->ExtraData; - ALvoid *buf; - SLresult result; + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCopenslPlayback, ALCbackend, self); - buf = (ALbyte*)data->buffer + data->curBuffer*data->bufferSize; - aluMixData(Device, buf, data->bufferSize/data->frameSize); + self->mEngineObj = NULL; + self->mEngine = NULL; + self->mOutputMix = NULL; + self->mBufferQueueObj = NULL; - result = VCALL(bq,Enqueue)(buf, data->bufferSize); - PRINTERR(result, "bq->Enqueue"); + self->mRing = NULL; + alsem_init(&self->mSem, 0); - data->curBuffer = (data->curBuffer+1) % Device->NumUpdates; + self->mFrameSize = 0; + + ATOMIC_INIT(&self->mKillNow, AL_FALSE); +} + +static void ALCopenslPlayback_Destruct(ALCopenslPlayback* self) +{ + if(self->mBufferQueueObj != NULL) + VCALL0(self->mBufferQueueObj,Destroy)(); + self->mBufferQueueObj = NULL; + + if(self->mOutputMix) + VCALL0(self->mOutputMix,Destroy)(); + self->mOutputMix = NULL; + + if(self->mEngineObj) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; + + alsem_destroy(&self->mSem); + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -static ALCenum opensl_open_playback(ALCdevice *Device, const ALCchar *deviceName) +/* this callback handler is called every time a buffer finishes playing */ +static void ALCopenslPlayback_process(SLAndroidSimpleBufferQueueItf UNUSED(bq), void *context) { - osl_data *data = NULL; + ALCopenslPlayback *self = context; + + /* A note on the ringbuffer usage: The buffer queue seems to hold on to the + * pointer passed to the Enqueue method, rather than copying the audio. + * Consequently, the ringbuffer contains the audio that is currently queued + * and waiting to play. This process() callback is called when a buffer is + * finished, so we simply move the read pointer up to indicate the space is + * available for writing again, and wake up the mixer thread to mix and + * queue more audio. + */ + ll_ringbuffer_read_advance(self->mRing, 1); + + alsem_post(&self->mSem); +} + + +static int ALCopenslPlayback_mixerProc(void *arg) +{ + ALCopenslPlayback *self = arg; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + SLAndroidSimpleBufferQueueItf bufferQueue; + ll_ringbuffer_data_t data[2]; + SLPlayItf player; SLresult result; - if(!deviceName) - deviceName = opensl_device; - else if(strcmp(deviceName, opensl_device) != 0) + SetRTPriority(); + althrd_setname(althrd_current(), MIXER_THREAD_NAME); + + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); + PRINTERR(result, "bufferQueue->GetInterface SL_IID_ANDROIDSIMPLEBUFFERQUEUE"); + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_PLAY, &player); + PRINTERR(result, "bufferQueue->GetInterface SL_IID_PLAY"); + } + if(SL_RESULT_SUCCESS != result) + { + ALCopenslPlayback_lock(self); + aluHandleDisconnect(device, "Failed to get playback buffer: 0x%08x", result); + ALCopenslPlayback_unlock(self); + return 1; + } + + ALCopenslPlayback_lock(self); + while(!ATOMIC_LOAD(&self->mKillNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) + { + size_t todo, len0, len1; + + if(ll_ringbuffer_write_space(self->mRing) == 0) + { + SLuint32 state = 0; + + result = VCALL(player,GetPlayState)(&state); + PRINTERR(result, "player->GetPlayState"); + if(SL_RESULT_SUCCESS == result && state != SL_PLAYSTATE_PLAYING) + { + result = VCALL(player,SetPlayState)(SL_PLAYSTATE_PLAYING); + PRINTERR(result, "player->SetPlayState"); + } + if(SL_RESULT_SUCCESS != result) + { + aluHandleDisconnect(device, "Failed to start platback: 0x%08x", result); + break; + } + + if(ll_ringbuffer_write_space(self->mRing) == 0) + { + ALCopenslPlayback_unlock(self); + alsem_wait(&self->mSem); + ALCopenslPlayback_lock(self); + continue; + } + } + + ll_ringbuffer_get_write_vector(self->mRing, data); + todo = data[0].len+data[1].len; + + len0 = minu(todo, data[0].len); + len1 = minu(todo-len0, data[1].len); + + aluMixData(device, data[0].buf, len0*device->UpdateSize); + for(size_t i = 0;i < len0;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[0].buf, device->UpdateSize*self->mFrameSize); + PRINTERR(result, "bufferQueue->Enqueue"); + if(SL_RESULT_SUCCESS == result) + ll_ringbuffer_write_advance(self->mRing, 1); + + data[0].buf += device->UpdateSize*self->mFrameSize; + } + + if(len1 > 0) + { + aluMixData(device, data[1].buf, len1*device->UpdateSize); + for(size_t i = 0;i < len1;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[1].buf, device->UpdateSize*self->mFrameSize); + PRINTERR(result, "bufferQueue->Enqueue"); + if(SL_RESULT_SUCCESS == result) + ll_ringbuffer_write_advance(self->mRing, 1); + + data[1].buf += device->UpdateSize*self->mFrameSize; + } + } + } + ALCopenslPlayback_unlock(self); + + return 0; +} + + +static ALCenum ALCopenslPlayback_open(ALCopenslPlayback *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + SLresult result; + + if(!name) + name = opensl_device; + else if(strcmp(name, opensl_device) != 0) return ALC_INVALID_VALUE; - data = calloc(1, sizeof(*data)); - if(!data) - return ALC_OUT_OF_MEMORY; - // create engine - result = slCreateEngine(&data->engineObject, 0, NULL, 0, NULL, NULL); + result = slCreateEngine(&self->mEngineObj, 0, NULL, 0, NULL, NULL); PRINTERR(result, "slCreateEngine"); if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->engineObject,Realize)(SL_BOOLEAN_FALSE); + result = VCALL(self->mEngineObj,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "engine->Realize"); } if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->engineObject,GetInterface)(SL_IID_ENGINE, &data->engine); + result = VCALL(self->mEngineObj,GetInterface)(SL_IID_ENGINE, &self->mEngine); PRINTERR(result, "engine->GetInterface"); } if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->engine,CreateOutputMix)(&data->outputMix, 0, NULL, NULL); + result = VCALL(self->mEngine,CreateOutputMix)(&self->mOutputMix, 0, NULL, NULL); PRINTERR(result, "engine->CreateOutputMix"); } if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->outputMix,Realize)(SL_BOOLEAN_FALSE); + result = VCALL(self->mOutputMix,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "outputMix->Realize"); } if(SL_RESULT_SUCCESS != result) { - if(data->outputMix != NULL) - VCALL0(data->outputMix,Destroy)(); - data->outputMix = NULL; + if(self->mOutputMix != NULL) + VCALL0(self->mOutputMix,Destroy)(); + self->mOutputMix = NULL; - if(data->engineObject != NULL) - VCALL0(data->engineObject,Destroy)(); - data->engineObject = NULL; - data->engine = NULL; + if(self->mEngineObj != NULL) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; - free(data); return ALC_INVALID_VALUE; } - al_string_copy_cstr(&Device->DeviceName, deviceName); - Device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } - -static void opensl_close_playback(ALCdevice *Device) +static ALCboolean ALCopenslPlayback_reset(ALCopenslPlayback *self) { - osl_data *data = Device->ExtraData; - - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; - - VCALL0(data->outputMix,Destroy)(); - data->outputMix = NULL; - - VCALL0(data->engineObject,Destroy)(); - data->engineObject = NULL; - data->engine = NULL; - - free(data); - Device->ExtraData = NULL; -} - -static ALCboolean opensl_reset_playback(ALCdevice *Device) -{ - osl_data *data = Device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; SLDataLocator_AndroidSimpleBufferQueue loc_bufq; SLDataLocator_OutputMix loc_outmix; - SLDataFormat_PCM format_pcm; SLDataSource audioSrc; SLDataSink audioSnk; - SLInterfaceID id; - SLboolean req; + ALuint sampleRate; + SLInterfaceID ids[2]; + SLboolean reqs[2]; SLresult result; + JNIEnv *env; + if(self->mBufferQueueObj != NULL) + VCALL0(self->mBufferQueueObj,Destroy)(); + self->mBufferQueueObj = NULL; - Device->UpdateSize = (ALuint64)Device->UpdateSize * 44100 / Device->Frequency; - Device->UpdateSize = Device->UpdateSize * Device->NumUpdates / 2; - Device->NumUpdates = 2; + sampleRate = device->Frequency; + if(!(device->Flags&DEVICE_FREQUENCY_REQUEST) && (env=Android_GetJNIEnv()) != NULL) + { + /* FIXME: Disabled until I figure out how to get the Context needed for + * the getSystemService call. + */ +#if 0 + /* Get necessary stuff for using java.lang.Integer, + * android.content.Context, and android.media.AudioManager. + */ + jclass int_cls = JCALL(env,FindClass)("java/lang/Integer"); + jmethodID int_parseint = JCALL(env,GetStaticMethodID)(int_cls, + "parseInt", "(Ljava/lang/String;)I" + ); + TRACE("Integer: %p, parseInt: %p\n", int_cls, int_parseint); - Device->Frequency = 44100; - Device->FmtChans = DevFmtStereo; - Device->FmtType = DevFmtShort; + jclass ctx_cls = JCALL(env,FindClass)("android/content/Context"); + jfieldID ctx_audsvc = JCALL(env,GetStaticFieldID)(ctx_cls, + "AUDIO_SERVICE", "Ljava/lang/String;" + ); + jmethodID ctx_getSysSvc = JCALL(env,GetMethodID)(ctx_cls, + "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;" + ); + TRACE("Context: %p, AUDIO_SERVICE: %p, getSystemService: %p\n", + ctx_cls, ctx_audsvc, ctx_getSysSvc); - SetDefaultWFXChannelOrder(Device); + jclass audmgr_cls = JCALL(env,FindClass)("android/media/AudioManager"); + jfieldID audmgr_prop_out_srate = JCALL(env,GetStaticFieldID)(audmgr_cls, + "PROPERTY_OUTPUT_SAMPLE_RATE", "Ljava/lang/String;" + ); + jmethodID audmgr_getproperty = JCALL(env,GetMethodID)(audmgr_cls, + "getProperty", "(Ljava/lang/String;)Ljava/lang/String;" + ); + TRACE("AudioManager: %p, PROPERTY_OUTPUT_SAMPLE_RATE: %p, getProperty: %p\n", + audmgr_cls, audmgr_prop_out_srate, audmgr_getproperty); + const char *strchars; + jstring strobj; + + /* Now make the calls. */ + //AudioManager audMgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE); + strobj = JCALL(env,GetStaticObjectField)(ctx_cls, ctx_audsvc); + jobject audMgr = JCALL(env,CallObjectMethod)(ctx_cls, ctx_getSysSvc, strobj); + strchars = JCALL(env,GetStringUTFChars)(strobj, NULL); + TRACE("Context.getSystemService(%s) = %p\n", strchars, audMgr); + JCALL(env,ReleaseStringUTFChars)(strobj, strchars); + + //String srateStr = audMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE); + strobj = JCALL(env,GetStaticObjectField)(audmgr_cls, audmgr_prop_out_srate); + jstring srateStr = JCALL(env,CallObjectMethod)(audMgr, audmgr_getproperty, strobj); + strchars = JCALL(env,GetStringUTFChars)(strobj, NULL); + TRACE("audMgr.getProperty(%s) = %p\n", strchars, srateStr); + JCALL(env,ReleaseStringUTFChars)(strobj, strchars); + + //int sampleRate = Integer.parseInt(srateStr); + sampleRate = JCALL(env,CallStaticIntMethod)(int_cls, int_parseint, srateStr); + + strchars = JCALL(env,GetStringUTFChars)(srateStr, NULL); + TRACE("Got system sample rate %uhz (%s)\n", sampleRate, strchars); + JCALL(env,ReleaseStringUTFChars)(srateStr, strchars); + + if(!sampleRate) sampleRate = device->Frequency; + else sampleRate = maxu(sampleRate, MIN_OUTPUT_RATE); +#endif + } + + if(sampleRate != device->Frequency) + { + device->NumUpdates = (device->NumUpdates*sampleRate + (device->Frequency>>1)) / + device->Frequency; + device->NumUpdates = maxu(device->NumUpdates, 2); + device->Frequency = sampleRate; + } + + device->FmtChans = DevFmtStereo; + device->FmtType = DevFmtShort; + + SetDefaultWFXChannelOrder(device); + self->mFrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - id = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; - req = SL_BOOLEAN_TRUE; loc_bufq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; - loc_bufq.numBuffers = Device->NumUpdates; + loc_bufq.numBuffers = device->NumUpdates; - format_pcm.formatType = SL_DATAFORMAT_PCM; - format_pcm.numChannels = ChannelsFromDevFmt(Device->FmtChans); - format_pcm.samplesPerSec = Device->Frequency * 1000; - format_pcm.bitsPerSample = BytesFromDevFmt(Device->FmtType) * 8; +#ifdef SL_DATAFORMAT_PCM_EX + SLDataFormat_PCM_EX format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM_EX; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.sampleRate = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; format_pcm.containerSize = format_pcm.bitsPerSample; - format_pcm.channelMask = GetChannelMask(Device->FmtChans); + format_pcm.channelMask = GetChannelMask(device->FmtChans); format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : SL_BYTEORDER_BIGENDIAN; + format_pcm.representation = GetTypeRepresentation(device->FmtType); +#else + SLDataFormat_PCM format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.samplesPerSec = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + format_pcm.containerSize = format_pcm.bitsPerSample; + format_pcm.channelMask = GetChannelMask(device->FmtChans); + format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : + SL_BYTEORDER_BIGENDIAN; +#endif audioSrc.pLocator = &loc_bufq; audioSrc.pFormat = &format_pcm; loc_outmix.locatorType = SL_DATALOCATOR_OUTPUTMIX; - loc_outmix.outputMix = data->outputMix; + loc_outmix.outputMix = self->mOutputMix; audioSnk.pLocator = &loc_outmix; audioSnk.pFormat = NULL; - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; + ids[0] = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; + reqs[0] = SL_BOOLEAN_TRUE; + ids[1] = SL_IID_ANDROIDCONFIGURATION; + reqs[1] = SL_BOOLEAN_FALSE; - result = VCALL(data->engine,CreateAudioPlayer)(&data->bufferQueueObject, &audioSrc, &audioSnk, 1, &id, &req); + result = VCALL(self->mEngine,CreateAudioPlayer)(&self->mBufferQueueObj, + &audioSrc, &audioSnk, COUNTOF(ids), ids, reqs + ); PRINTERR(result, "engine->CreateAudioPlayer"); if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->bufferQueueObject,Realize)(SL_BOOLEAN_FALSE); + /* Set the stream type to "media" (games, music, etc), if possible. */ + SLAndroidConfigurationItf config; + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDCONFIGURATION, &config); + PRINTERR(result, "bufferQueue->GetInterface SL_IID_ANDROIDCONFIGURATION"); + if(SL_RESULT_SUCCESS == result) + { + SLint32 streamType = SL_ANDROID_STREAM_MEDIA; + result = VCALL(config,SetConfiguration)(SL_ANDROID_KEY_STREAM_TYPE, + &streamType, sizeof(streamType) + ); + PRINTERR(result, "config->SetConfiguration"); + } + + /* Clear any error since this was optional. */ + result = SL_RESULT_SUCCESS; + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mBufferQueueObj,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "bufferQueue->Realize"); } if(SL_RESULT_SUCCESS != result) { - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; + if(self->mBufferQueueObj != NULL) + VCALL0(self->mBufferQueueObj,Destroy)(); + self->mBufferQueueObj = NULL; return ALC_FALSE; } @@ -295,64 +559,31 @@ static ALCboolean opensl_reset_playback(ALCdevice *Device) return ALC_TRUE; } -static ALCboolean opensl_start_playback(ALCdevice *Device) +static ALCboolean ALCopenslPlayback_start(ALCopenslPlayback *self) { - osl_data *data = Device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; SLAndroidSimpleBufferQueueItf bufferQueue; - SLPlayItf player; SLresult result; - ALuint i; - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_BUFFERQUEUE, &bufferQueue); + ll_ringbuffer_free(self->mRing); + self->mRing = ll_ringbuffer_create(device->NumUpdates, self->mFrameSize*device->UpdateSize, + true); + + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); PRINTERR(result, "bufferQueue->GetInterface"); - if(SL_RESULT_SUCCESS == result) - { - result = VCALL(bufferQueue,RegisterCallback)(opensl_callback, Device); - PRINTERR(result, "bufferQueue->RegisterCallback"); - } - if(SL_RESULT_SUCCESS == result) - { - data->frameSize = FrameSizeFromDevFmt(Device->FmtChans, Device->FmtType); - data->bufferSize = Device->UpdateSize * data->frameSize; - data->buffer = calloc(Device->NumUpdates, data->bufferSize); - if(!data->buffer) - { - result = SL_RESULT_MEMORY_FAILURE; - PRINTERR(result, "calloc"); - } - } - /* enqueue the first buffer to kick off the callbacks */ - for(i = 0;i < Device->NumUpdates;i++) - { - if(SL_RESULT_SUCCESS == result) - { - ALvoid *buf = (ALbyte*)data->buffer + i*data->bufferSize; - result = VCALL(bufferQueue,Enqueue)(buf, data->bufferSize); - PRINTERR(result, "bufferQueue->Enqueue"); - } - } - data->curBuffer = 0; - if(SL_RESULT_SUCCESS == result) - { - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_PLAY, &player); - PRINTERR(result, "bufferQueue->GetInterface"); - } - if(SL_RESULT_SUCCESS == result) - { - result = VCALL(player,SetPlayState)(SL_PLAYSTATE_PLAYING); - PRINTERR(result, "player->SetPlayState"); - } - if(SL_RESULT_SUCCESS != result) + return ALC_FALSE; + + result = VCALL(bufferQueue,RegisterCallback)(ALCopenslPlayback_process, self); + PRINTERR(result, "bufferQueue->RegisterCallback"); + if(SL_RESULT_SUCCESS != result) + return ALC_FALSE; + + ATOMIC_STORE_SEQ(&self->mKillNow, AL_FALSE); + if(althrd_create(&self->mThread, ALCopenslPlayback_mixerProc, self) != althrd_success) { - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; - - free(data->buffer); - data->buffer = NULL; - data->bufferSize = 0; - + ERR("Failed to start mixer thread\n"); return ALC_FALSE; } @@ -360,14 +591,20 @@ static ALCboolean opensl_start_playback(ALCdevice *Device) } -static void opensl_stop_playback(ALCdevice *Device) +static void ALCopenslPlayback_stop(ALCopenslPlayback *self) { - osl_data *data = Device->ExtraData; - SLPlayItf player; SLAndroidSimpleBufferQueueItf bufferQueue; + SLPlayItf player; SLresult result; + int res; - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_PLAY, &player); + if(ATOMIC_EXCHANGE_SEQ(&self->mKillNow, AL_TRUE)) + return; + + alsem_post(&self->mSem); + althrd_join(self->mThread, &res); + + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_PLAY, &player); PRINTERR(result, "bufferQueue->GetInterface"); if(SL_RESULT_SUCCESS == result) { @@ -375,7 +612,8 @@ static void opensl_stop_playback(ALCdevice *Device) PRINTERR(result, "player->SetPlayState"); } - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_BUFFERQUEUE, &bufferQueue); + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); PRINTERR(result, "bufferQueue->GetInterface"); if(SL_RESULT_SUCCESS == result) { @@ -383,6 +621,11 @@ static void opensl_stop_playback(ALCdevice *Device) PRINTERR(result, "bufferQueue->Clear"); } if(SL_RESULT_SUCCESS == result) + { + result = VCALL(bufferQueue,RegisterCallback)(NULL, NULL); + PRINTERR(result, "bufferQueue->RegisterCallback"); + } + if(SL_RESULT_SUCCESS == result) { SLAndroidSimpleBufferQueueState state; do { @@ -392,45 +635,440 @@ static void opensl_stop_playback(ALCdevice *Device) PRINTERR(result, "bufferQueue->GetState"); } - free(data->buffer); - data->buffer = NULL; - data->bufferSize = 0; + ll_ringbuffer_free(self->mRing); + self->mRing = NULL; +} + +static ClockLatency ALCopenslPlayback_getClockLatency(ALCopenslPlayback *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + ClockLatency ret; + + ALCopenslPlayback_lock(self); + ret.ClockTime = GetDeviceClockTime(device); + ret.Latency = ll_ringbuffer_read_space(self->mRing)*device->UpdateSize * + DEVICE_CLOCK_RES / device->Frequency; + ALCopenslPlayback_unlock(self); + + return ret; } -static const BackendFuncs opensl_funcs = { - opensl_open_playback, - opensl_close_playback, - opensl_reset_playback, - opensl_start_playback, - opensl_stop_playback, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; +typedef struct ALCopenslCapture { + DERIVE_FROM_TYPE(ALCbackend); + + /* engine interfaces */ + SLObjectItf mEngineObj; + SLEngineItf mEngine; + + /* recording interfaces */ + SLObjectItf mRecordObj; + + ll_ringbuffer_t *mRing; + ALCuint mSplOffset; + + ALsizei mFrameSize; +} ALCopenslCapture; + +static void ALCopenslCapture_process(SLAndroidSimpleBufferQueueItf bq, void *context); + +static void ALCopenslCapture_Construct(ALCopenslCapture *self, ALCdevice *device); +static void ALCopenslCapture_Destruct(ALCopenslCapture *self); +static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name); +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, ALCboolean, reset) +static ALCboolean ALCopenslCapture_start(ALCopenslCapture *self); +static void ALCopenslCapture_stop(ALCopenslCapture *self); +static ALCenum ALCopenslCapture_captureSamples(ALCopenslCapture *self, ALCvoid *buffer, ALCuint samples); +static ALCuint ALCopenslCapture_availableSamples(ALCopenslCapture *self); +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCopenslCapture) +DEFINE_ALCBACKEND_VTABLE(ALCopenslCapture); -ALCboolean alc_opensl_init(BackendFuncs *func_list) +static void ALCopenslCapture_process(SLAndroidSimpleBufferQueueItf UNUSED(bq), void *context) { - *func_list = opensl_funcs; + ALCopenslCapture *self = context; + /* A new chunk has been written into the ring buffer, advance it. */ + ll_ringbuffer_write_advance(self->mRing, 1); +} + + +static void ALCopenslCapture_Construct(ALCopenslCapture *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCopenslCapture, ALCbackend, self); + + self->mEngineObj = NULL; + self->mEngine = NULL; + + self->mRecordObj = NULL; + + self->mRing = NULL; + self->mSplOffset = 0; + + self->mFrameSize = 0; +} + +static void ALCopenslCapture_Destruct(ALCopenslCapture *self) +{ + ll_ringbuffer_free(self->mRing); + self->mRing = NULL; + + if(self->mRecordObj != NULL) + VCALL0(self->mRecordObj,Destroy)(); + self->mRecordObj = NULL; + + if(self->mEngineObj != NULL) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + +static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + SLDataLocator_AndroidSimpleBufferQueue loc_bq; + SLAndroidSimpleBufferQueueItf bufferQueue; + SLDataLocator_IODevice loc_dev; + SLDataSource audioSrc; + SLDataSink audioSnk; + SLresult result; + + if(!name) + name = opensl_device; + else if(strcmp(name, opensl_device) != 0) + return ALC_INVALID_VALUE; + + result = slCreateEngine(&self->mEngineObj, 0, NULL, 0, NULL, NULL); + PRINTERR(result, "slCreateEngine"); + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mEngineObj,Realize)(SL_BOOLEAN_FALSE); + PRINTERR(result, "engine->Realize"); + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mEngineObj,GetInterface)(SL_IID_ENGINE, &self->mEngine); + PRINTERR(result, "engine->GetInterface"); + } + if(SL_RESULT_SUCCESS == result) + { + /* Ensure the total length is at least 100ms */ + ALsizei length = maxi(device->NumUpdates * device->UpdateSize, + device->Frequency / 10); + /* Ensure the per-chunk length is at least 10ms, and no more than 50ms. */ + ALsizei update_len = clampi(device->NumUpdates*device->UpdateSize / 3, + device->Frequency / 100, + device->Frequency / 100 * 5); + + device->UpdateSize = update_len; + device->NumUpdates = (length+update_len-1) / update_len; + + self->mFrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + } + loc_dev.locatorType = SL_DATALOCATOR_IODEVICE; + loc_dev.deviceType = SL_IODEVICE_AUDIOINPUT; + loc_dev.deviceID = SL_DEFAULTDEVICEID_AUDIOINPUT; + loc_dev.device = NULL; + + audioSrc.pLocator = &loc_dev; + audioSrc.pFormat = NULL; + + loc_bq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; + loc_bq.numBuffers = device->NumUpdates; + +#ifdef SL_DATAFORMAT_PCM_EX + SLDataFormat_PCM_EX format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM_EX; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.sampleRate = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + format_pcm.containerSize = format_pcm.bitsPerSample; + format_pcm.channelMask = GetChannelMask(device->FmtChans); + format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : + SL_BYTEORDER_BIGENDIAN; + format_pcm.representation = GetTypeRepresentation(device->FmtType); +#else + SLDataFormat_PCM format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.samplesPerSec = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + format_pcm.containerSize = format_pcm.bitsPerSample; + format_pcm.channelMask = GetChannelMask(device->FmtChans); + format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : + SL_BYTEORDER_BIGENDIAN; +#endif + + audioSnk.pLocator = &loc_bq; + audioSnk.pFormat = &format_pcm; + + if(SL_RESULT_SUCCESS == result) + { + const SLInterfaceID ids[2] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }; + const SLboolean reqs[2] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_FALSE }; + + result = VCALL(self->mEngine,CreateAudioRecorder)(&self->mRecordObj, + &audioSrc, &audioSnk, COUNTOF(ids), ids, reqs + ); + PRINTERR(result, "engine->CreateAudioRecorder"); + } + if(SL_RESULT_SUCCESS == result) + { + /* Set the record preset to "generic", if possible. */ + SLAndroidConfigurationItf config; + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDCONFIGURATION, &config); + PRINTERR(result, "recordObj->GetInterface SL_IID_ANDROIDCONFIGURATION"); + if(SL_RESULT_SUCCESS == result) + { + SLuint32 preset = SL_ANDROID_RECORDING_PRESET_GENERIC; + result = VCALL(config,SetConfiguration)(SL_ANDROID_KEY_RECORDING_PRESET, + &preset, sizeof(preset) + ); + PRINTERR(result, "config->SetConfiguration"); + } + + /* Clear any error since this was optional. */ + result = SL_RESULT_SUCCESS; + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mRecordObj,Realize)(SL_BOOLEAN_FALSE); + PRINTERR(result, "recordObj->Realize"); + } + + if(SL_RESULT_SUCCESS == result) + { + self->mRing = ll_ringbuffer_create(device->NumUpdates, device->UpdateSize*self->mFrameSize, + false); + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); + PRINTERR(result, "recordObj->GetInterface"); + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(bufferQueue,RegisterCallback)(ALCopenslCapture_process, self); + PRINTERR(result, "bufferQueue->RegisterCallback"); + } + if(SL_RESULT_SUCCESS == result) + { + ALsizei chunk_size = device->UpdateSize * self->mFrameSize; + ll_ringbuffer_data_t data[2]; + size_t i; + + ll_ringbuffer_get_write_vector(self->mRing, data); + for(i = 0;i < data[0].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[0].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + for(i = 0;i < data[1].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[1].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + } + + if(SL_RESULT_SUCCESS != result) + { + if(self->mRecordObj != NULL) + VCALL0(self->mRecordObj,Destroy)(); + self->mRecordObj = NULL; + + if(self->mEngineObj != NULL) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; + + return ALC_INVALID_VALUE; + } + + alstr_copy_cstr(&device->DeviceName, name); + + return ALC_NO_ERROR; +} + +static ALCboolean ALCopenslCapture_start(ALCopenslCapture *self) +{ + SLRecordItf record; + SLresult result; + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_RECORD, &record); + PRINTERR(result, "recordObj->GetInterface"); + + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(record,SetRecordState)(SL_RECORDSTATE_RECORDING); + PRINTERR(result, "record->SetRecordState"); + } + + if(SL_RESULT_SUCCESS != result) + { + ALCopenslCapture_lock(self); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, + "Failed to start capture: 0x%08x", result); + ALCopenslCapture_unlock(self); + return ALC_FALSE; + } + return ALC_TRUE; } -void alc_opensl_deinit(void) +static void ALCopenslCapture_stop(ALCopenslCapture *self) +{ + SLRecordItf record; + SLresult result; + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_RECORD, &record); + PRINTERR(result, "recordObj->GetInterface"); + + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(record,SetRecordState)(SL_RECORDSTATE_PAUSED); + PRINTERR(result, "record->SetRecordState"); + } +} + +static ALCenum ALCopenslCapture_captureSamples(ALCopenslCapture *self, ALCvoid *buffer, ALCuint samples) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + ALsizei chunk_size = device->UpdateSize * self->mFrameSize; + SLAndroidSimpleBufferQueueItf bufferQueue; + ll_ringbuffer_data_t data[2]; + SLresult result; + size_t advance; + ALCuint i; + + /* Read the desired samples from the ring buffer then advance its read + * pointer. + */ + ll_ringbuffer_get_read_vector(self->mRing, data); + advance = 0; + for(i = 0;i < samples;) + { + ALCuint rem = minu(samples - i, device->UpdateSize - self->mSplOffset); + memcpy((ALCbyte*)buffer + i*self->mFrameSize, + data[0].buf + self->mSplOffset*self->mFrameSize, + rem * self->mFrameSize); + + self->mSplOffset += rem; + if(self->mSplOffset == device->UpdateSize) + { + /* Finished a chunk, reset the offset and advance the read pointer. */ + self->mSplOffset = 0; + advance++; + + data[0].len--; + if(!data[0].len) + data[0] = data[1]; + else + data[0].buf += chunk_size; + } + + i += rem; + } + ll_ringbuffer_read_advance(self->mRing, advance); + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); + PRINTERR(result, "recordObj->GetInterface"); + + /* Enqueue any newly-writable chunks in the ring buffer. */ + ll_ringbuffer_get_write_vector(self->mRing, data); + for(i = 0;i < data[0].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[0].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + for(i = 0;i < data[1].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[1].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + + if(SL_RESULT_SUCCESS != result) + { + ALCopenslCapture_lock(self); + aluHandleDisconnect(device, "Failed to update capture buffer: 0x%08x", result); + ALCopenslCapture_unlock(self); + return ALC_INVALID_DEVICE; + } + + return ALC_NO_ERROR; +} + +static ALCuint ALCopenslCapture_availableSamples(ALCopenslCapture *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + return ll_ringbuffer_read_space(self->mRing) * device->UpdateSize; +} + + +typedef struct ALCopenslBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCopenslBackendFactory; +#define ALCOPENSLBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCopenslBackendFactory, ALCbackendFactory) } } + +static ALCboolean ALCopenslBackendFactory_init(ALCopenslBackendFactory* UNUSED(self)) +{ + return ALC_TRUE; +} + +static void ALCopenslBackendFactory_deinit(ALCopenslBackendFactory* UNUSED(self)) { } -void alc_opensl_probe(enum DevProbe type) +static ALCboolean ALCopenslBackendFactory_querySupport(ALCopenslBackendFactory* UNUSED(self), ALCbackend_Type type) +{ + if(type == ALCbackend_Playback || type == ALCbackend_Capture) + return ALC_TRUE; + return ALC_FALSE; +} + +static void ALCopenslBackendFactory_probe(ALCopenslBackendFactory* UNUSED(self), enum DevProbe type) { switch(type) { case ALL_DEVICE_PROBE: AppendAllDevicesList(opensl_device); break; + case CAPTURE_DEVICE_PROBE: + AppendAllDevicesList(opensl_device); break; } } + +static ALCbackend* ALCopenslBackendFactory_createBackend(ALCopenslBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCopenslPlayback *backend; + NEW_OBJ(backend, ALCopenslPlayback)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + if(type == ALCbackend_Capture) + { + ALCopenslCapture *backend; + NEW_OBJ(backend, ALCopenslCapture)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} + +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCopenslBackendFactory); + + +ALCbackendFactory *ALCopenslBackendFactory_getFactory(void) +{ + static ALCopenslBackendFactory factory = ALCOPENSLBACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} diff --git a/Engine/lib/openal-soft/Alc/backends/oss.c b/Engine/lib/openal-soft/Alc/backends/oss.c index 432c75f21..c0c98c432 100644 --- a/Engine/lib/openal-soft/Alc/backends/oss.c +++ b/Engine/lib/openal-soft/Alc/backends/oss.c @@ -35,6 +35,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" @@ -88,7 +90,9 @@ static struct oss_device oss_capture = { #ifdef ALC_OSS_COMPAT -static void ALCossListPopulate(struct oss_device *UNUSED(playback), struct oss_device *UNUSED(capture)) +#define DSP_CAP_OUTPUT 0x00020000 +#define DSP_CAP_INPUT 0x00010000 +static void ALCossListPopulate(struct oss_device *UNUSED(devlist), int UNUSED(type_flag)) { } @@ -153,7 +157,7 @@ static void ALCossListAppend(struct oss_device *list, const char *handle, size_t TRACE("Got device \"%s\", \"%s\"\n", next->handle, next->path); } -static void ALCossListPopulate(struct oss_device *playback, struct oss_device *capture) +static void ALCossListPopulate(struct oss_device *devlist, int type_flag) { struct oss_sysinfo si; struct oss_audioinfo ai; @@ -161,12 +165,12 @@ static void ALCossListPopulate(struct oss_device *playback, struct oss_device *c if((fd=open("/dev/mixer", O_RDONLY)) < 0) { - ERR("Could not open /dev/mixer\n"); + TRACE("Could not open /dev/mixer: %s\n", strerror(errno)); return; } if(ioctl(fd, SNDCTL_SYSINFO, &si) == -1) { - ERR("SNDCTL_SYSINFO failed: %s\n", strerror(errno)); + TRACE("SNDCTL_SYSINFO failed: %s\n", strerror(errno)); goto done; } for(i = 0;i < si.numaudios;i++) @@ -193,10 +197,9 @@ static void ALCossListPopulate(struct oss_device *playback, struct oss_device *c len = strnlen(ai.name, sizeof(ai.name)); handle = ai.name; } - if((ai.caps&DSP_CAP_INPUT) && capture != NULL) - ALCossListAppend(capture, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode))); - if((ai.caps&DSP_CAP_OUTPUT) && playback != NULL) - ALCossListAppend(playback, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode))); + if((ai.caps&type_flag)) + ALCossListAppend(devlist, handle, len, ai.devnode, + strnlen(ai.devnode, sizeof(ai.devnode))); } done: @@ -242,16 +245,15 @@ typedef struct ALCplaybackOSS { ALubyte *mix_data; int data_size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCplaybackOSS; static int ALCplaybackOSS_mixerProc(void *ptr); static void ALCplaybackOSS_Construct(ALCplaybackOSS *self, ALCdevice *device); -static DECLARE_FORWARD(ALCplaybackOSS, ALCbackend, void, Destruct) +static void ALCplaybackOSS_Destruct(ALCplaybackOSS *self); static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name); -static void ALCplaybackOSS_close(ALCplaybackOSS *self); static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self); static ALCboolean ALCplaybackOSS_start(ALCplaybackOSS *self); static void ALCplaybackOSS_stop(ALCplaybackOSS *self); @@ -268,42 +270,66 @@ static int ALCplaybackOSS_mixerProc(void *ptr) { ALCplaybackOSS *self = (ALCplaybackOSS*)ptr; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - ALint frameSize; + struct timeval timeout; + ALubyte *write_ptr; + ALint frame_size; + ALint to_write; ssize_t wrote; + fd_set wfds; + int sret; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!self->killNow && device->Connected) + ALCplaybackOSS_lock(self); + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ALint len = self->data_size; - ALubyte *WritePtr = self->mix_data; + FD_ZERO(&wfds); + FD_SET(self->fd, &wfds); + timeout.tv_sec = 1; + timeout.tv_usec = 0; - aluMixData(device, WritePtr, len/frameSize); - while(len > 0 && !self->killNow) + ALCplaybackOSS_unlock(self); + sret = select(self->fd+1, NULL, &wfds, NULL, &timeout); + ALCplaybackOSS_lock(self); + if(sret < 0) { - wrote = write(self->fd, WritePtr, len); + if(errno == EINTR) + continue; + ERR("select failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed waiting for playback buffer: %s", strerror(errno)); + break; + } + else if(sret == 0) + { + WARN("select timeout\n"); + continue; + } + + write_ptr = self->mix_data; + to_write = self->data_size; + aluMixData(device, write_ptr, to_write/frame_size); + while(to_write > 0 && !ATOMIC_LOAD_SEQ(&self->killNow)) + { + wrote = write(self->fd, write_ptr, to_write); if(wrote < 0) { - if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) - { - ERR("write failed: %s\n", strerror(errno)); - ALCplaybackOSS_lock(self); - aluHandleDisconnect(device); - ALCplaybackOSS_unlock(self); - break; - } - - al_nssleep(1000000); - continue; + if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) + continue; + ERR("write failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed writing playback samples: %s", + strerror(errno)); + break; } - len -= wrote; - WritePtr += wrote; + to_write -= wrote; + write_ptr += wrote; } } + ALCplaybackOSS_unlock(self); return 0; } @@ -313,6 +339,18 @@ static void ALCplaybackOSS_Construct(ALCplaybackOSS *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCplaybackOSS, ALCbackend, self); + + self->fd = -1; + ATOMIC_INIT(&self->killNow, AL_FALSE); +} + +static void ALCplaybackOSS_Destruct(ALCplaybackOSS *self) +{ + if(self->fd != -1) + close(self->fd); + self->fd = -1; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name) @@ -320,22 +358,28 @@ static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name) struct oss_device *dev = &oss_playback; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - if(!name) + if(!name || strcmp(name, dev->handle) == 0) name = dev->handle; else { - while (dev != NULL) + if(!dev->next) + { + ALCossListPopulate(&oss_playback, DSP_CAP_OUTPUT); + dev = &oss_playback; + } + while(dev != NULL) { if (strcmp(dev->handle, name) == 0) break; dev = dev->next; } - if (dev == NULL) + if(dev == NULL) + { + WARN("Could not find \"%s\" in device list\n", name); return ALC_INVALID_VALUE; + } } - self->killNow = 0; - self->fd = open(dev->path, O_WRONLY); if(self->fd == -1) { @@ -343,17 +387,11 @@ static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name) return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCplaybackOSS_close(ALCplaybackOSS *self) -{ - close(self->fd); - self->fd = -1; -} - static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -387,18 +425,11 @@ static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) } periods = device->NumUpdates; - numChannels = ChannelsFromDevFmt(device->FmtChans); - frameSize = numChannels * BytesFromDevFmt(device->FmtType); - + numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); ossSpeed = device->Frequency; - log2FragmentSize = log2i(device->UpdateSize * frameSize); - - /* according to the OSS spec, 16 bytes are the minimum */ - if (log2FragmentSize < 4) - log2FragmentSize = 4; - /* Subtract one period since the temp mixing buffer counts as one. Still - * need at least two on the card, though. */ - if(periods > 2) periods--; + frameSize = numChannels * BytesFromDevFmt(device->FmtType); + /* According to the OSS spec, 16 bytes (log2(16)) is the minimum. */ + log2FragmentSize = maxi(log2i(device->UpdateSize*frameSize), 4); numFragmentsLogSize = (periods << 16) | log2FragmentSize; #define CHECKERR(func) if((func) < 0) { \ @@ -420,7 +451,7 @@ static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) } #undef CHECKERR - if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels) + if((int)ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder) != numChannels) { ERR("Failed to set %s, got %d channels instead\n", DevFmtChannelsString(device->FmtChans), numChannels); return ALC_FALSE; @@ -436,7 +467,7 @@ static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) device->Frequency = ossSpeed; device->UpdateSize = info.fragsize / frameSize; - device->NumUpdates = info.fragments + 1; + device->NumUpdates = info.fragments; SetDefaultChannelOrder(device); @@ -447,10 +478,12 @@ static ALCboolean ALCplaybackOSS_start(ALCplaybackOSS *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->data_size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->data_size = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); self->mix_data = calloc(1, self->data_size); - self->killNow = 0; + ATOMIC_STORE_SEQ(&self->killNow, AL_FALSE); if(althrd_create(&self->thread, ALCplaybackOSS_mixerProc, self) != althrd_success) { free(self->mix_data); @@ -465,10 +498,8 @@ static void ALCplaybackOSS_stop(ALCplaybackOSS *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE)) return; - - self->killNow = 1; althrd_join(self->thread, &res); if(ioctl(self->fd, SNDCTL_DSP_RESET) != 0) @@ -485,18 +516,16 @@ typedef struct ALCcaptureOSS { int fd; ll_ringbuffer_t *ring; - int doCapture; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCcaptureOSS; static int ALCcaptureOSS_recordProc(void *ptr); static void ALCcaptureOSS_Construct(ALCcaptureOSS *self, ALCdevice *device); -static DECLARE_FORWARD(ALCcaptureOSS, ALCbackend, void, Destruct) +static void ALCcaptureOSS_Destruct(ALCcaptureOSS *self); static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name); -static void ALCcaptureOSS_close(ALCcaptureOSS *self); static DECLARE_FORWARD(ALCcaptureOSS, ALCbackend, ALCboolean, reset) static ALCboolean ALCcaptureOSS_start(ALCcaptureOSS *self); static void ALCcaptureOSS_stop(ALCcaptureOSS *self); @@ -513,41 +542,55 @@ static int ALCcaptureOSS_recordProc(void *ptr) { ALCcaptureOSS *self = (ALCcaptureOSS*)ptr; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - int frameSize; + struct timeval timeout; + int frame_size; + fd_set rfds; ssize_t amt; + int sret; SetRTPriority(); althrd_setname(althrd_current(), RECORD_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!self->killNow) + while(!ATOMIC_LOAD_SEQ(&self->killNow)) { ll_ringbuffer_data_t vec[2]; - amt = 0; - if(self->doCapture) + FD_ZERO(&rfds); + FD_SET(self->fd, &rfds); + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + sret = select(self->fd+1, &rfds, NULL, NULL, &timeout); + if(sret < 0) { - ll_ringbuffer_get_write_vector(self->ring, vec); - if(vec[0].len > 0) - { - amt = read(self->fd, vec[0].buf, vec[0].len*frameSize); - if(amt < 0) - { - ERR("read failed: %s\n", strerror(errno)); - ALCcaptureOSS_lock(self); - aluHandleDisconnect(device); - ALCcaptureOSS_unlock(self); - break; - } - ll_ringbuffer_write_advance(self->ring, amt/frameSize); - } + if(errno == EINTR) + continue; + ERR("select failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed to check capture samples: %s", strerror(errno)); + break; } - if(amt == 0) + else if(sret == 0) { - al_nssleep(1000000); + WARN("select timeout\n"); continue; } + + ll_ringbuffer_get_write_vector(self->ring, vec); + if(vec[0].len > 0) + { + amt = read(self->fd, vec[0].buf, vec[0].len*frame_size); + if(amt < 0) + { + ERR("read failed: %s\n", strerror(errno)); + ALCcaptureOSS_lock(self); + aluHandleDisconnect(device, "Failed reading capture samples: %s", strerror(errno)); + ALCcaptureOSS_unlock(self); + break; + } + ll_ringbuffer_write_advance(self->ring, amt/frame_size); + } } return 0; @@ -558,6 +601,21 @@ static void ALCcaptureOSS_Construct(ALCcaptureOSS *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCcaptureOSS, ALCbackend, self); + + self->fd = -1; + self->ring = NULL; + ATOMIC_INIT(&self->killNow, AL_FALSE); +} + +static void ALCcaptureOSS_Destruct(ALCcaptureOSS *self) +{ + if(self->fd != -1) + close(self->fd); + self->fd = -1; + + ll_ringbuffer_free(self->ring); + self->ring = NULL; + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) @@ -574,18 +632,26 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) int ossSpeed; char *err; - if(!name) + if(!name || strcmp(name, dev->handle) == 0) name = dev->handle; else { - while (dev != NULL) + if(!dev->next) + { + ALCossListPopulate(&oss_capture, DSP_CAP_INPUT); + dev = &oss_capture; + } + while(dev != NULL) { if (strcmp(dev->handle, name) == 0) break; dev = dev->next; } - if (dev == NULL) + if(dev == NULL) + { + WARN("Could not find \"%s\" in device list\n", name); return ALC_INVALID_VALUE; + } } self->fd = open(dev->path, O_RDONLY); @@ -615,7 +681,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) } periods = 4; - numChannels = ChannelsFromDevFmt(device->FmtChans); + numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); frameSize = numChannels * BytesFromDevFmt(device->FmtType); ossSpeed = device->Frequency; log2FragmentSize = log2i(device->UpdateSize * device->NumUpdates * @@ -645,7 +711,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) } #undef CHECKERR - if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels) + if((int)ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder) != numChannels) { ERR("Failed to set %s, got %d channels instead\n", DevFmtChannelsString(device->FmtChans), numChannels); close(self->fd); @@ -663,7 +729,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) return ALC_INVALID_VALUE; } - self->ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates + 1, frameSize); + self->ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize, false); if(!self->ring) { ERR("Ring buffer create failed\n"); @@ -672,44 +738,30 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) return ALC_OUT_OF_MEMORY; } - self->killNow = 0; - if(althrd_create(&self->thread, ALCcaptureOSS_recordProc, self) != althrd_success) - { - ll_ringbuffer_free(self->ring); - self->ring = NULL; - close(self->fd); - self->fd = -1; - return ALC_OUT_OF_MEMORY; - } - - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCcaptureOSS_close(ALCcaptureOSS *self) -{ - int res; - - self->killNow = 1; - althrd_join(self->thread, &res); - - close(self->fd); - self->fd = -1; - - ll_ringbuffer_free(self->ring); - self->ring = NULL; -} - static ALCboolean ALCcaptureOSS_start(ALCcaptureOSS *self) { - self->doCapture = 1; + ATOMIC_STORE_SEQ(&self->killNow, AL_FALSE); + if(althrd_create(&self->thread, ALCcaptureOSS_recordProc, self) != althrd_success) + return ALC_FALSE; return ALC_TRUE; } static void ALCcaptureOSS_stop(ALCcaptureOSS *self) { - self->doCapture = 0; + int res; + + if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE)) + return; + + althrd_join(self->thread, &res); + + if(ioctl(self->fd, SNDCTL_DSP_RESET) != 0) + ERR("Error resetting device: %s\n", strerror(errno)); } static ALCenum ALCcaptureOSS_captureSamples(ALCcaptureOSS *self, ALCvoid *buffer, ALCuint samples) @@ -770,33 +822,38 @@ ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory* UNUSED(self), void ALCossBackendFactory_probe(ALCossBackendFactory* UNUSED(self), enum DevProbe type) { + struct oss_device *cur; switch(type) { case ALL_DEVICE_PROBE: - { - struct oss_device *cur = &oss_playback; - ALCossListFree(cur); - ALCossListPopulate(cur, NULL); - while (cur != NULL) + ALCossListFree(&oss_playback); + ALCossListPopulate(&oss_playback, DSP_CAP_OUTPUT); + cur = &oss_playback; + while(cur != NULL) { - AppendAllDevicesList(cur->handle); +#ifdef HAVE_STAT + struct stat buf; + if(stat(cur->path, &buf) == 0) +#endif + AppendAllDevicesList(cur->handle); cur = cur->next; } - } - break; + break; case CAPTURE_DEVICE_PROBE: - { - struct oss_device *cur = &oss_capture; - ALCossListFree(cur); - ALCossListPopulate(NULL, cur); - while (cur != NULL) + ALCossListFree(&oss_capture); + ALCossListPopulate(&oss_capture, DSP_CAP_INPUT); + cur = &oss_capture; + while(cur != NULL) { - AppendCaptureDeviceList(cur->handle); +#ifdef HAVE_STAT + struct stat buf; + if(stat(cur->path, &buf) == 0) +#endif + AppendCaptureDeviceList(cur->handle); cur = cur->next; } - } - break; + break; } } diff --git a/Engine/lib/openal-soft/Alc/backends/portaudio.c b/Engine/lib/openal-soft/Alc/backends/portaudio.c index 1dbca9416..9b0d34878 100644 --- a/Engine/lib/openal-soft/Alc/backends/portaudio.c +++ b/Engine/lib/openal-soft/Alc/backends/portaudio.c @@ -26,6 +26,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "compat.h" #include "backends/base.h" @@ -139,7 +141,6 @@ static int ALCportPlayback_WriteCallback(const void *inputBuffer, void *outputBu static void ALCportPlayback_Construct(ALCportPlayback *self, ALCdevice *device); static void ALCportPlayback_Destruct(ALCportPlayback *self); static ALCenum ALCportPlayback_open(ALCportPlayback *self, const ALCchar *name); -static void ALCportPlayback_close(ALCportPlayback *self); static ALCboolean ALCportPlayback_reset(ALCportPlayback *self); static ALCboolean ALCportPlayback_start(ALCportPlayback *self); static void ALCportPlayback_stop(ALCportPlayback *self); @@ -163,8 +164,9 @@ static void ALCportPlayback_Construct(ALCportPlayback *self, ALCdevice *device) static void ALCportPlayback_Destruct(ALCportPlayback *self) { - if(self->stream) - Pa_CloseStream(self->stream); + PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError; + if(err != paNoError) + ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); self->stream = NULL; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); @@ -177,7 +179,9 @@ static int ALCportPlayback_WriteCallback(const void *UNUSED(inputBuffer), void * { ALCportPlayback *self = userData; + ALCportPlayback_lock(self); aluMixData(STATIC_CAST(ALCbackend, self)->mDevice, outputBuffer, framesPerBuffer); + ALCportPlayback_unlock(self); return 0; } @@ -243,20 +247,12 @@ retry_open: return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCportPlayback_close(ALCportPlayback *self) -{ - PaError err = Pa_CloseStream(self->stream); - if(err != paNoError) - ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); - self->stream = NULL; -} - static ALCboolean ALCportPlayback_reset(ALCportPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -334,7 +330,6 @@ static int ALCportCapture_ReadCallback(const void *inputBuffer, void *outputBuff static void ALCportCapture_Construct(ALCportCapture *self, ALCdevice *device); static void ALCportCapture_Destruct(ALCportCapture *self); static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name); -static void ALCportCapture_close(ALCportCapture *self); static DECLARE_FORWARD(ALCportCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCportCapture_start(ALCportCapture *self); static void ALCportCapture_stop(ALCportCapture *self); @@ -354,16 +349,17 @@ static void ALCportCapture_Construct(ALCportCapture *self, ALCdevice *device) SET_VTABLE2(ALCportCapture, ALCbackend, self); self->stream = NULL; + self->ring = NULL; } static void ALCportCapture_Destruct(ALCportCapture *self) { - if(self->stream) - Pa_CloseStream(self->stream); + PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError; + if(err != paNoError) + ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); self->stream = NULL; - if(self->ring) - ll_ringbuffer_free(self->ring); + ll_ringbuffer_free(self->ring); self->ring = NULL; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); @@ -397,9 +393,9 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name) samples = device->UpdateSize * device->NumUpdates; samples = maxu(samples, 100 * device->Frequency / 1000); - frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - self->ring = ll_ringbuffer_create(samples, frame_size); + self->ring = ll_ringbuffer_create(samples, frame_size, false); if(self->ring == NULL) return ALC_INVALID_VALUE; self->params.device = -1; @@ -431,7 +427,7 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name) ERR("%s samples not supported\n", DevFmtTypeString(device->FmtType)); return ALC_INVALID_VALUE; } - self->params.channelCount = ChannelsFromDevFmt(device->FmtChans); + self->params.channelCount = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); err = Pa_OpenStream(&self->stream, &self->params, NULL, device->Frequency, paFramesPerBufferUnspecified, paNoFlag, @@ -443,22 +439,11 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name) return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCportCapture_close(ALCportCapture *self) -{ - PaError err = Pa_CloseStream(self->stream); - if(err != paNoError) - ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); - self->stream = NULL; - - ll_ringbuffer_free(self->ring); - self->ring = NULL; -} - static ALCboolean ALCportCapture_start(ALCportCapture *self) { diff --git a/Engine/lib/openal-soft/Alc/backends/pulseaudio.c b/Engine/lib/openal-soft/Alc/backends/pulseaudio.c index f46386e4f..74d1a1492 100644 --- a/Engine/lib/openal-soft/Alc/backends/pulseaudio.c +++ b/Engine/lib/openal-soft/Alc/backends/pulseaudio.c @@ -25,6 +25,7 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" #include "threads.h" #include "compat.h" @@ -182,6 +183,8 @@ static ALCboolean pulse_load(void) #ifdef HAVE_DYNLOAD if(!pa_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + #ifdef _WIN32 #define PALIB "libpulse-0.dll" #elif defined(__APPLE__) && defined(__MACH__) @@ -191,12 +194,16 @@ static ALCboolean pulse_load(void) #endif pa_handle = LoadLib(PALIB); if(!pa_handle) + { + WARN("Failed to load %s\n", PALIB); return ALC_FALSE; + } #define LOAD_FUNC(x) do { \ p##x = GetSymbol(pa_handle, #x); \ if(!(p##x)) { \ ret = ALC_FALSE; \ + alstr_append_cstr(&missing_funcs, "\n" #x); \ } \ } while(0) LOAD_FUNC(pa_context_unref); @@ -270,9 +277,11 @@ static ALCboolean pulse_load(void) if(ret == ALC_FALSE) { + WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs)); CloseLib(pa_handle); pa_handle = NULL; } + alstr_reset(&missing_funcs); } #endif /* HAVE_DYNLOAD */ return ret; @@ -325,18 +334,20 @@ static void wait_for_operation(pa_operation *op, pa_threaded_mainloop *loop) static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent) { const char *name = "OpenAL Soft"; - char path_name[PATH_MAX]; + al_string binname = AL_STRING_INIT_STATIC(); pa_context_state_t state; pa_context *context; int err; - if(pa_get_binary_name(path_name, sizeof(path_name))) - name = pa_path_get_filename(path_name); + GetProcBinary(NULL, &binname); + if(!alstr_empty(binname)) + name = alstr_get_cstr(binname); context = pa_context_new(pa_threaded_mainloop_get_api(loop), name); if(!context) { ERR("pa_context_new() failed\n"); + alstr_reset(&binname); return NULL; } @@ -363,9 +374,10 @@ static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent) if(!silent) ERR("Context did not connect: %s\n", pa_strerror(err)); pa_context_unref(context); - return NULL; + context = NULL; } + alstr_reset(&binname); return context; } @@ -460,7 +472,7 @@ typedef struct ALCpulsePlayback { pa_stream *stream; pa_context *context; - volatile ALboolean killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCpulsePlayback; @@ -483,7 +495,6 @@ static int ALCpulsePlayback_mixerProc(void *ptr); static void ALCpulsePlayback_Construct(ALCpulsePlayback *self, ALCdevice *device); static void ALCpulsePlayback_Destruct(ALCpulsePlayback *self); static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name); -static void ALCpulsePlayback_close(ALCpulsePlayback *self); static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self); static ALCboolean ALCpulsePlayback_start(ALCpulsePlayback *self); static void ALCpulsePlayback_stop(ALCpulsePlayback *self); @@ -502,11 +513,20 @@ static void ALCpulsePlayback_Construct(ALCpulsePlayback *self, ALCdevice *device ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCpulsePlayback, ALCbackend, self); + self->loop = NULL; AL_STRING_INIT(self->device_name); + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCpulsePlayback_Destruct(ALCpulsePlayback *self) { + if(self->loop) + { + pulse_close(self->loop, self->context, self->stream); + self->loop = NULL; + self->context = NULL; + self->stream = NULL; + } AL_STRING_DEINIT(self->device_name); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -525,7 +545,7 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p return; } -#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0) +#define MATCH_INFO_NAME(iter) (alstr_cmp_cstr((iter)->device_name, info->name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_INFO_NAME); if(iter != VECTOR_END(PlaybackDevices)) return; #undef MATCH_INFO_NAME @@ -533,27 +553,27 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.device_name, info->name); + alstr_copy_cstr(&entry.device_name, info->name); count = 0; while(1) { - al_string_copy_cstr(&entry.name, info->description); + alstr_copy_cstr(&entry.name, info->description); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_ENTRY); if(iter == VECTOR_END(PlaybackDevices)) break; #undef MATCH_ENTRY count++; } - TRACE("Got device \"%s\", \"%s\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.device_name)); + TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.device_name)); VECTOR_PUSH_BACK(PlaybackDevices, entry); } @@ -618,6 +638,11 @@ static void ALCpulsePlayback_bufferAttrCallback(pa_stream *stream, void *pdata) self->attr = *pa_stream_get_buffer_attr(stream); TRACE("minreq=%d, tlength=%d, prebuf=%d\n", self->attr.minreq, self->attr.tlength, self->attr.prebuf); + /* FIXME: Update the device's UpdateSize (and/or NumUpdates) using the new + * buffer attributes? Changing UpdateSize will change the ALC_REFRESH + * property, which probably shouldn't change between device resets. But + * leaving it alone means ALC_REFRESH will be off. + */ } static void ALCpulsePlayback_contextStateCallback(pa_context *context, void *pdata) @@ -626,7 +651,7 @@ static void ALCpulsePlayback_contextStateCallback(pa_context *context, void *pda if(pa_context_get_state(context) == PA_CONTEXT_FAILED) { ERR("Received context failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Playback state failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -637,7 +662,7 @@ static void ALCpulsePlayback_streamStateCallback(pa_stream *stream, void *pdata) if(pa_stream_get_state(stream) == PA_STREAM_FAILED) { ERR("Received stream failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Playback stream failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -729,7 +754,7 @@ static void ALCpulsePlayback_sinkNameCallback(pa_context *UNUSED(context), const return; } - al_string_copy_cstr(&device->DeviceName, info->description); + alstr_copy_cstr(&device->DeviceName, info->description); } @@ -737,9 +762,9 @@ static void ALCpulsePlayback_streamMovedCallback(pa_stream *stream, void *pdata) { ALCpulsePlayback *self = pdata; - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); - TRACE("Stream moved to %s\n", al_string_get_cstr(self->device_name)); + TRACE("Stream moved to %s\n", alstr_get_cstr(self->device_name)); } @@ -751,6 +776,13 @@ static pa_stream *ALCpulsePlayback_connectStream(const char *device_name, pa_stream_state_t state; pa_stream *stream; + if(!device_name) + { + device_name = getenv("ALSOFT_PULSE_DEFAULT"); + if(device_name && !device_name[0]) + device_name = NULL; + } + stream = pa_stream_new_with_proplist(context, "Playback Stream", spec, chanmap, prop_filter); if(!stream) { @@ -789,7 +821,6 @@ static int ALCpulsePlayback_mixerProc(void *ptr) ALCpulsePlayback *self = ptr; ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; ALuint buffer_size; - ALint update_size; size_t frame_size; ssize_t len; @@ -798,18 +829,35 @@ static int ALCpulsePlayback_mixerProc(void *ptr) pa_threaded_mainloop_lock(self->loop); frame_size = pa_frame_size(&self->spec); - update_size = device->UpdateSize * frame_size; - /* Sanitize buffer metrics, in case we actually have less than what we - * asked for. */ - buffer_size = minu(update_size*device->NumUpdates, self->attr.tlength); - update_size = minu(update_size, buffer_size/2); - do { - len = pa_stream_writable_size(self->stream) - self->attr.tlength + - buffer_size; - if(len < update_size) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) + { + void *buf; + int ret; + + len = pa_stream_writable_size(self->stream); + if(len < 0) { - if(pa_stream_is_corked(self->stream) == 1) + ERR("Failed to get writable size: %ld", (long)len); + aluHandleDisconnect(device, "Failed to get writable size: %ld", (long)len); + break; + } + + /* Make sure we're going to write at least 2 'periods' (minreqs), in + * case the server increased it since starting playback. Also round up + * the number of writable periods if it's not an integer count. + */ + buffer_size = maxu((self->attr.tlength + self->attr.minreq/2) / self->attr.minreq, 2) * + self->attr.minreq; + + /* NOTE: This assumes pa_stream_writable_size returns between 0 and + * tlength, else there will be more latency than intended. + */ + len = mini(len - (ssize_t)self->attr.tlength, 0) + buffer_size; + if(len < (int32_t)self->attr.minreq) + { + if(pa_stream_is_corked(self->stream)) { pa_operation *o; o = pa_stream_cork(self->stream, 0, NULL, NULL); @@ -818,26 +866,17 @@ static int ALCpulsePlayback_mixerProc(void *ptr) pa_threaded_mainloop_wait(self->loop); continue; } - len -= len%update_size; - while(len > 0) - { - size_t newlen = len; - void *buf; - pa_free_cb_t free_func = NULL; + len -= len%self->attr.minreq; + len -= len%frame_size; - if(pa_stream_begin_write(self->stream, &buf, &newlen) < 0) - { - buf = pa_xmalloc(newlen); - free_func = pa_xfree; - } + buf = pa_xmalloc(len); - aluMixData(device, buf, newlen/frame_size); + aluMixData(device, buf, len/frame_size); - pa_stream_write(self->stream, buf, newlen, free_func, 0, PA_SEEK_RELATIVE); - len -= newlen; - } - } while(!self->killNow && device->Connected); + ret = pa_stream_write(self->stream, buf, len, pa_xfree, 0, PA_SEEK_RELATIVE); + if(ret != PA_OK) ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret)); + } pa_threaded_mainloop_unlock(self->loop); return 0; @@ -858,12 +897,12 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name if(VECTOR_SIZE(PlaybackDevices) == 0) ALCpulsePlayback_probeDevices(); -#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0) +#define MATCH_NAME(iter) (alstr_cmp_cstr((iter)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) return ALC_INVALID_VALUE; - pulse_name = al_string_get_cstr(iter->device_name); + pulse_name = alstr_get_cstr(iter->device_name); dev_name = iter->name; } @@ -894,11 +933,11 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name } pa_stream_set_moved_callback(self->stream, ALCpulsePlayback_streamMovedCallback, self); - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); - if(al_string_empty(dev_name)) + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); + if(alstr_empty(dev_name)) { pa_operation *o = pa_context_get_sink_info_by_name( - self->context, al_string_get_cstr(self->device_name), + self->context, alstr_get_cstr(self->device_name), ALCpulsePlayback_sinkNameCallback, self ); wait_for_operation(o, self->loop); @@ -906,7 +945,7 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name else { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - al_string_copy(&device->DeviceName, dev_name); + alstr_copy(&device->DeviceName, dev_name); } pa_threaded_mainloop_unlock(self->loop); @@ -914,16 +953,6 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name return ALC_NO_ERROR; } -static void ALCpulsePlayback_close(ALCpulsePlayback *self) -{ - pulse_close(self->loop, self->context, self->stream); - self->loop = NULL; - self->context = NULL; - self->stream = NULL; - - al_string_clear(&self->device_name); -} - static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; @@ -931,7 +960,6 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) const char *mapname = NULL; pa_channel_map chanmap; pa_operation *o; - ALuint len; pa_threaded_mainloop_lock(self->loop); @@ -946,11 +974,11 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) self->stream = NULL; } - o = pa_context_get_sink_info_by_name(self->context, al_string_get_cstr(self->device_name), + o = pa_context_get_sink_info_by_name(self->context, alstr_get_cstr(self->device_name), ALCpulsePlayback_sinkInfoCallback, self); wait_for_operation(o, self->loop); - if(GetConfigValueBool(al_string_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) || + if(GetConfigValueBool(alstr_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) || !(device->Flags&DEVICE_FREQUENCY_REQUEST)) flags |= PA_STREAM_FIX_RATE; flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE; @@ -984,7 +1012,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) break; } self->spec.rate = device->Frequency; - self->spec.channels = ChannelsFromDevFmt(device->FmtChans); + self->spec.channels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); if(pa_sample_spec_valid(&self->spec) == 0) { @@ -998,9 +1026,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) case DevFmtMono: mapname = "mono"; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: device->FmtChans = DevFmtStereo; /*fall-through*/ case DevFmtStereo: @@ -1036,9 +1062,9 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) self->attr.tlength = self->attr.minreq * maxu(device->NumUpdates, 2); self->attr.maxlength = -1; - self->stream = ALCpulsePlayback_connectStream(al_string_get_cstr(self->device_name), - self->loop, self->context, flags, - &self->attr, &self->spec, &chanmap); + self->stream = ALCpulsePlayback_connectStream(alstr_get_cstr(self->device_name), + self->loop, self->context, flags, &self->attr, &self->spec, &chanmap + ); if(!self->stream) { pa_threaded_mainloop_unlock(self->loop); @@ -1072,11 +1098,10 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) pa_stream_set_buffer_attr_callback(self->stream, ALCpulsePlayback_bufferAttrCallback, self); ALCpulsePlayback_bufferAttrCallback(self->stream, self); - len = self->attr.minreq / pa_frame_size(&self->spec); - device->NumUpdates = (ALuint)clampd( - (ALdouble)device->NumUpdates/len*device->UpdateSize + 0.5, 2.0, 16.0 + device->NumUpdates = (ALuint)clampu64( + (self->attr.tlength + self->attr.minreq/2) / self->attr.minreq, 2, 16 ); - device->UpdateSize = len; + device->UpdateSize = self->attr.minreq / pa_frame_size(&self->spec); /* HACK: prebuf should be 0 as that's what we set it to. However on some * systems it comes back as non-0, so we have to make sure the device will @@ -1086,7 +1111,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) */ if(self->attr.prebuf != 0) { - len = self->attr.prebuf / pa_frame_size(&self->spec); + ALuint len = self->attr.prebuf / pa_frame_size(&self->spec); if(len <= device->UpdateSize*device->NumUpdates) ERR("Non-0 prebuf, %u samples (%u bytes), device has %u samples\n", len, self->attr.prebuf, device->UpdateSize*device->NumUpdates); @@ -1104,7 +1129,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) static ALCboolean ALCpulsePlayback_start(ALCpulsePlayback *self) { - self->killNow = AL_FALSE; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCpulsePlayback_mixerProc, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; @@ -1115,10 +1140,9 @@ static void ALCpulsePlayback_stop(ALCpulsePlayback *self) pa_operation *o; int res; - if(!self->stream || self->killNow) + if(!self->stream || ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - self->killNow = AL_TRUE; /* Signal the main loop in case PulseAudio isn't sending us audio requests * (e.g. if the device is suspended). We need to lock the mainloop in case * the mixer is between checking the killNow flag but before waiting for @@ -1140,13 +1164,16 @@ static void ALCpulsePlayback_stop(ALCpulsePlayback *self) static ClockLatency ALCpulsePlayback_getClockLatency(ALCpulsePlayback *self) { - pa_usec_t latency = 0; ClockLatency ret; + pa_usec_t latency; int neg, err; pa_threaded_mainloop_lock(self->loop); ret.ClockTime = GetDeviceClockTime(STATIC_CAST(ALCbackend,self)->mDevice); - if((err=pa_stream_get_latency(self->stream, &latency, &neg)) != 0) + err = pa_stream_get_latency(self->stream, &latency, &neg); + pa_threaded_mainloop_unlock(self->loop); + + if(UNLIKELY(err != 0)) { /* FIXME: if err = -PA_ERR_NODATA, it means we were called too soon * after starting the stream and no timing info has been received from @@ -1157,9 +1184,9 @@ static ClockLatency ALCpulsePlayback_getClockLatency(ALCpulsePlayback *self) latency = 0; neg = 0; } - if(neg) latency = 0; - ret.Latency = minu64(latency, U64(0xffffffffffffffff)/1000) * 1000; - pa_threaded_mainloop_unlock(self->loop); + else if(UNLIKELY(neg)) + latency = 0; + ret.Latency = (ALint64)minu64(latency, U64(0x7fffffffffffffff)/1000) * 1000; return ret; } @@ -1211,7 +1238,6 @@ static pa_stream *ALCpulseCapture_connectStream(const char *device_name, static void ALCpulseCapture_Construct(ALCpulseCapture *self, ALCdevice *device); static void ALCpulseCapture_Destruct(ALCpulseCapture *self); static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name); -static void ALCpulseCapture_close(ALCpulseCapture *self); static DECLARE_FORWARD(ALCpulseCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCpulseCapture_start(ALCpulseCapture *self); static void ALCpulseCapture_stop(ALCpulseCapture *self); @@ -1230,11 +1256,19 @@ static void ALCpulseCapture_Construct(ALCpulseCapture *self, ALCdevice *device) ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCpulseCapture, ALCbackend, self); + self->loop = NULL; AL_STRING_INIT(self->device_name); } static void ALCpulseCapture_Destruct(ALCpulseCapture *self) { + if(self->loop) + { + pulse_close(self->loop, self->context, self->stream); + self->loop = NULL; + self->context = NULL; + self->stream = NULL; + } AL_STRING_DEINIT(self->device_name); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -1253,7 +1287,7 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa return; } -#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0) +#define MATCH_INFO_NAME(iter) (alstr_cmp_cstr((iter)->device_name, info->name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_INFO_NAME); if(iter != VECTOR_END(CaptureDevices)) return; #undef MATCH_INFO_NAME @@ -1261,27 +1295,27 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.device_name, info->name); + alstr_copy_cstr(&entry.device_name, info->name); count = 0; while(1) { - al_string_copy_cstr(&entry.name, info->description); + alstr_copy_cstr(&entry.name, info->description); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_ENTRY); if(iter == VECTOR_END(CaptureDevices)) break; #undef MATCH_ENTRY count++; } - TRACE("Got device \"%s\", \"%s\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.device_name)); + TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.device_name)); VECTOR_PUSH_BACK(CaptureDevices, entry); } @@ -1346,7 +1380,7 @@ static void ALCpulseCapture_contextStateCallback(pa_context *context, void *pdat if(pa_context_get_state(context) == PA_CONTEXT_FAILED) { ERR("Received context failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Capture state failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -1357,7 +1391,7 @@ static void ALCpulseCapture_streamStateCallback(pa_stream *stream, void *pdata) if(pa_stream_get_state(stream) == PA_STREAM_FAILED) { ERR("Received stream failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Capture stream failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -1374,7 +1408,7 @@ static void ALCpulseCapture_sourceNameCallback(pa_context *UNUSED(context), cons return; } - al_string_copy_cstr(&device->DeviceName, info->description); + alstr_copy_cstr(&device->DeviceName, info->description); } @@ -1382,9 +1416,9 @@ static void ALCpulseCapture_streamMovedCallback(pa_stream *stream, void *pdata) { ALCpulseCapture *self = pdata; - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); - TRACE("Stream moved to %s\n", al_string_get_cstr(self->device_name)); + TRACE("Stream moved to %s\n", alstr_get_cstr(self->device_name)); } @@ -1434,6 +1468,7 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; const char *pulse_name = NULL; pa_stream_flags_t flags = 0; + const char *mapname = NULL; pa_channel_map chanmap; ALuint samples; @@ -1444,13 +1479,13 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) if(VECTOR_SIZE(CaptureDevices) == 0) ALCpulseCapture_probeDevices(); -#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0) +#define MATCH_NAME(iter) (alstr_cmp_cstr((iter)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) return ALC_INVALID_VALUE; - pulse_name = al_string_get_cstr(iter->device_name); - al_string_copy(&device->DeviceName, iter->name); + pulse_name = alstr_get_cstr(iter->device_name); + alstr_copy(&device->DeviceName, iter->name); } if(!pulse_open(&self->loop, &self->context, ALCpulseCapture_contextStateCallback, self)) @@ -1458,9 +1493,6 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) pa_threaded_mainloop_lock(self->loop); - self->spec.rate = device->Frequency; - self->spec.channels = ChannelsFromDevFmt(device->FmtChans); - switch(device->FmtType) { case DevFmtUByte: @@ -1483,6 +1515,44 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) goto fail; } + switch(device->FmtChans) + { + case DevFmtMono: + mapname = "mono"; + break; + case DevFmtStereo: + mapname = "front-left,front-right"; + break; + case DevFmtQuad: + mapname = "front-left,front-right,rear-left,rear-right"; + break; + case DevFmtX51: + mapname = "front-left,front-right,front-center,lfe,side-left,side-right"; + break; + case DevFmtX51Rear: + mapname = "front-left,front-right,front-center,lfe,rear-left,rear-right"; + break; + case DevFmtX61: + mapname = "front-left,front-right,front-center,lfe,rear-center,side-left,side-right"; + break; + case DevFmtX71: + mapname = "front-left,front-right,front-center,lfe,rear-left,rear-right,side-left,side-right"; + break; + case DevFmtAmbi3D: + ERR("%s capture samples not supported\n", DevFmtChannelsString(device->FmtChans)); + pa_threaded_mainloop_unlock(self->loop); + goto fail; + } + if(!pa_channel_map_parse(&chanmap, mapname)) + { + ERR("Failed to build channel map for %s\n", DevFmtChannelsString(device->FmtChans)); + pa_threaded_mainloop_unlock(self->loop); + return ALC_FALSE; + } + + self->spec.rate = device->Frequency; + self->spec.channels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + if(pa_sample_spec_valid(&self->spec) == 0) { ERR("Invalid sample format\n"); @@ -1512,9 +1582,9 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) flags |= PA_STREAM_DONT_MOVE; TRACE("Connecting to \"%s\"\n", pulse_name ? pulse_name : "(default)"); - self->stream = ALCpulseCapture_connectStream(pulse_name, self->loop, self->context, - flags, &self->attr, &self->spec, - &chanmap); + self->stream = ALCpulseCapture_connectStream(pulse_name, + self->loop, self->context, flags, &self->attr, &self->spec, &chanmap + ); if(!self->stream) { pa_threaded_mainloop_unlock(self->loop); @@ -1523,11 +1593,11 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) pa_stream_set_moved_callback(self->stream, ALCpulseCapture_streamMovedCallback, self); pa_stream_set_state_callback(self->stream, ALCpulseCapture_streamStateCallback, self); - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); - if(al_string_empty(device->DeviceName)) + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); + if(alstr_empty(device->DeviceName)) { pa_operation *o = pa_context_get_source_info_by_name( - self->context, al_string_get_cstr(self->device_name), + self->context, alstr_get_cstr(self->device_name), ALCpulseCapture_sourceNameCallback, self ); wait_for_operation(o, self->loop); @@ -1545,30 +1615,23 @@ fail: return ALC_INVALID_VALUE; } -static void ALCpulseCapture_close(ALCpulseCapture *self) -{ - pulse_close(self->loop, self->context, self->stream); - self->loop = NULL; - self->context = NULL; - self->stream = NULL; - - al_string_clear(&self->device_name); -} - static ALCboolean ALCpulseCapture_start(ALCpulseCapture *self) { pa_operation *o; + pa_threaded_mainloop_lock(self->loop); o = pa_stream_cork(self->stream, 0, stream_success_callback, self->loop); wait_for_operation(o, self->loop); - + pa_threaded_mainloop_unlock(self->loop); return ALC_TRUE; } static void ALCpulseCapture_stop(ALCpulseCapture *self) { pa_operation *o; + pa_threaded_mainloop_lock(self->loop); o = pa_stream_cork(self->stream, 1, stream_success_callback, self->loop); wait_for_operation(o, self->loop); + pa_threaded_mainloop_unlock(self->loop); } static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *buffer, ALCuint samples) @@ -1579,6 +1642,7 @@ static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *bu /* Capture is done in fragment-sized chunks, so we loop until we get all * that's available */ self->last_readable -= todo; + pa_threaded_mainloop_lock(self->loop); while(todo > 0) { size_t rem = todo; @@ -1590,14 +1654,15 @@ static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *bu state = pa_stream_get_state(self->stream); if(!PA_STREAM_IS_GOOD(state)) { - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Bad capture state: %u", state); break; } if(pa_stream_peek(self->stream, &self->cap_store, &self->cap_len) < 0) { ERR("pa_stream_peek() failed: %s\n", pa_strerror(pa_context_errno(self->context))); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed retrieving capture samples: %s", + pa_strerror(pa_context_errno(self->context))); break; } self->cap_remain = self->cap_len; @@ -1618,6 +1683,7 @@ static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *bu self->cap_len = 0; } } + pa_threaded_mainloop_unlock(self->loop); if(todo > 0) memset(buffer, ((device->FmtType==DevFmtUByte) ? 0x80 : 0), todo); @@ -1629,16 +1695,19 @@ static ALCuint ALCpulseCapture_availableSamples(ALCpulseCapture *self) ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; size_t readable = self->cap_remain; - if(device->Connected) + if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ssize_t got = pa_stream_readable_size(self->stream); + ssize_t got; + pa_threaded_mainloop_lock(self->loop); + got = pa_stream_readable_size(self->stream); if(got < 0) { ERR("pa_stream_readable_size() failed: %s\n", pa_strerror(got)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed getting readable size: %s", pa_strerror(got)); } else if((size_t)got > self->cap_len) readable += got - self->cap_len; + pa_threaded_mainloop_unlock(self->loop); } if(self->last_readable < readable) @@ -1649,21 +1718,24 @@ static ALCuint ALCpulseCapture_availableSamples(ALCpulseCapture *self) static ClockLatency ALCpulseCapture_getClockLatency(ALCpulseCapture *self) { - pa_usec_t latency = 0; ClockLatency ret; + pa_usec_t latency; int neg, err; pa_threaded_mainloop_lock(self->loop); ret.ClockTime = GetDeviceClockTime(STATIC_CAST(ALCbackend,self)->mDevice); - if((err=pa_stream_get_latency(self->stream, &latency, &neg)) != 0) + err = pa_stream_get_latency(self->stream, &latency, &neg); + pa_threaded_mainloop_unlock(self->loop); + + if(UNLIKELY(err != 0)) { ERR("Failed to get stream latency: 0x%x\n", err); latency = 0; neg = 0; } - if(neg) latency = 0; - ret.Latency = minu64(latency, U64(0xffffffffffffffff)/1000) * 1000; - pa_threaded_mainloop_unlock(self->loop); + else if(UNLIKELY(neg)) + latency = 0; + ret.Latency = (ALint64)minu64(latency, U64(0x7fffffffffffffff)/1000) * 1000; return ret; } @@ -1769,14 +1841,14 @@ static void ALCpulseBackendFactory_probe(ALCpulseBackendFactory* UNUSED(self), e { case ALL_DEVICE_PROBE: ALCpulsePlayback_probeDevices(); -#define APPEND_ALL_DEVICES_LIST(e) AppendAllDevicesList(al_string_get_cstr((e)->name)) +#define APPEND_ALL_DEVICES_LIST(e) AppendAllDevicesList(alstr_get_cstr((e)->name)) VECTOR_FOR_EACH(const DevMap, PlaybackDevices, APPEND_ALL_DEVICES_LIST); #undef APPEND_ALL_DEVICES_LIST break; case CAPTURE_DEVICE_PROBE: ALCpulseCapture_probeDevices(); -#define APPEND_CAPTURE_DEVICE_LIST(e) AppendCaptureDeviceList(al_string_get_cstr((e)->name)) +#define APPEND_CAPTURE_DEVICE_LIST(e) AppendCaptureDeviceList(alstr_get_cstr((e)->name)) VECTOR_FOR_EACH(const DevMap, CaptureDevices, APPEND_CAPTURE_DEVICE_LIST); #undef APPEND_CAPTURE_DEVICE_LIST break; diff --git a/Engine/lib/openal-soft/Alc/backends/qsa.c b/Engine/lib/openal-soft/Alc/backends/qsa.c index b7923517a..8f87779ba 100644 --- a/Engine/lib/openal-soft/Alc/backends/qsa.c +++ b/Engine/lib/openal-soft/Alc/backends/qsa.c @@ -33,6 +33,8 @@ #include "alu.h" #include "threads.h" +#include "backends/base.h" + typedef struct { snd_pcm_t* pcmHandle; @@ -44,7 +46,7 @@ typedef struct { ALvoid* buffer; ALsizei size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } qsa_data; @@ -157,17 +159,39 @@ static void deviceList(int type, vector_DevMap *devmap) } -FORCE_ALIGN static int qsa_proc_playback(void* ptr) +/* Wrappers to use an old-style backend with the new interface. */ +typedef struct PlaybackWrapper { + DERIVE_FROM_TYPE(ALCbackend); + qsa_data *ExtraData; +} PlaybackWrapper; + +static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device); +static void PlaybackWrapper_Destruct(PlaybackWrapper *self); +static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name); +static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self); +static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self); +static void PlaybackWrapper_stop(PlaybackWrapper *self); +static DECLARE_FORWARD2(PlaybackWrapper, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, lock) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(PlaybackWrapper) +DEFINE_ALCBACKEND_VTABLE(PlaybackWrapper); + + +FORCE_ALIGN static int qsa_proc_playback(void *ptr) { - ALCdevice* device=(ALCdevice*)ptr; - qsa_data* data=(qsa_data*)device->ExtraData; - char* write_ptr; - int avail; + PlaybackWrapper *self = ptr; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; snd_pcm_channel_status_t status; struct sched_param param; - fd_set wfds; - int selectret; struct timeval timeout; + char* write_ptr; + fd_set wfds; + ALint len; + int sret; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); @@ -177,72 +201,69 @@ FORCE_ALIGN static int qsa_proc_playback(void* ptr) param.sched_priority=param.sched_curpriority+1; SchedSet(0, 0, SCHED_NOCHANGE, ¶m); - ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + const ALint frame_size = FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); - while (!data->killNow) + V0(device->Backend,lock)(); + while(!ATOMIC_LOAD(&data->killNow, almemory_order_acquire)) { - ALint len=data->size; - write_ptr=data->buffer; + FD_ZERO(&wfds); + FD_SET(data->audio_fd, &wfds); + timeout.tv_sec=2; + timeout.tv_usec=0; - avail=len/frame_size; - aluMixData(device, write_ptr, avail); - - while (len>0 && !data->killNow) + /* Select also works like time slice to OS */ + V0(device->Backend,unlock)(); + sret = select(data->audio_fd+1, NULL, &wfds, NULL, &timeout); + V0(device->Backend,lock)(); + if(sret == -1) { - FD_ZERO(&wfds); - FD_SET(data->audio_fd, &wfds); - timeout.tv_sec=2; - timeout.tv_usec=0; + ERR("select error: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed waiting for playback buffer: %s", strerror(errno)); + break; + } + if(sret == 0) + { + ERR("select timeout\n"); + continue; + } - /* Select also works like time slice to OS */ - selectret=select(data->audio_fd+1, NULL, &wfds, NULL, &timeout); - switch (selectret) + len = data->size; + write_ptr = data->buffer; + aluMixData(device, write_ptr, len/frame_size); + while(len>0 && !ATOMIC_LOAD(&data->killNow, almemory_order_acquire)) + { + int wrote = snd_pcm_plugin_write(data->pcmHandle, write_ptr, len); + if(wrote <= 0) { - case -1: - aluHandleDisconnect(device); - return 1; - case 0: - break; - default: - if (FD_ISSET(data->audio_fd, &wfds)) - { - break; - } - break; - } - - int wrote=snd_pcm_plugin_write(data->pcmHandle, write_ptr, len); - - if (wrote<=0) - { - if ((errno==EAGAIN) || (errno==EWOULDBLOCK)) - { + if(errno==EAGAIN || errno==EWOULDBLOCK) continue; - } - memset(&status, 0, sizeof (status)); - status.channel=SND_PCM_CHANNEL_PLAYBACK; + memset(&status, 0, sizeof(status)); + status.channel = SND_PCM_CHANNEL_PLAYBACK; snd_pcm_plugin_status(data->pcmHandle, &status); /* we need to reinitialize the sound channel if we've underrun the buffer */ - if ((status.status==SND_PCM_STATUS_UNDERRUN) || - (status.status==SND_PCM_STATUS_READY)) + if(status.status == SND_PCM_STATUS_UNDERRUN || + status.status == SND_PCM_STATUS_READY) { - if ((snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_PLAYBACK))<0) + if(snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_PLAYBACK) < 0) { - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Playback recovery failed"); break; } } } else { - write_ptr+=wrote; - len-=wrote; + write_ptr += wrote; + len -= wrote; } } } + V0(device->Backend,unlock)(); return 0; } @@ -251,8 +272,9 @@ FORCE_ALIGN static int qsa_proc_playback(void* ptr) /* Playback */ /************/ -static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName) +static ALCenum qsa_open_playback(PlaybackWrapper *self, const ALCchar* deviceName) { + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; qsa_data *data; int card, dev; int status; @@ -260,6 +282,7 @@ static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName) data = (qsa_data*)calloc(1, sizeof(qsa_data)); if(data == NULL) return ALC_OUT_OF_MEMORY; + ATOMIC_INIT(&data->killNow, AL_TRUE); if(!deviceName) deviceName = qsaDevice; @@ -299,15 +322,15 @@ static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName) return ALC_INVALID_DEVICE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, deviceName); + self->ExtraData = data; return ALC_NO_ERROR; } -static void qsa_close_playback(ALCdevice* device) +static void qsa_close_playback(PlaybackWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; if (data->buffer!=NULL) { @@ -318,12 +341,13 @@ static void qsa_close_playback(ALCdevice* device) snd_pcm_close(data->pcmHandle); free(data); - device->ExtraData=NULL; + self->ExtraData = NULL; } -static ALCboolean qsa_reset_playback(ALCdevice* device) +static ALCboolean qsa_reset_playback(PlaybackWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; int32_t format=-1; switch(device->FmtType) @@ -364,14 +388,14 @@ static ALCboolean qsa_reset_playback(ALCdevice* device) data->cparams.start_mode=SND_PCM_START_FULL; data->cparams.stop_mode=SND_PCM_STOP_STOP; - data->cparams.buf.block.frag_size=device->UpdateSize* - ChannelsFromDevFmt(device->FmtChans)*BytesFromDevFmt(device->FmtType); + data->cparams.buf.block.frag_size=device->UpdateSize * + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); data->cparams.buf.block.frags_max=device->NumUpdates; data->cparams.buf.block.frags_min=device->NumUpdates; data->cparams.format.interleave=1; data->cparams.format.rate=device->Frequency; - data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans); + data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); data->cparams.format.format=format; if ((snd_pcm_plugin_params(data->pcmHandle, &data->cparams))<0) @@ -555,7 +579,7 @@ static ALCboolean qsa_reset_playback(ALCdevice* device) SetDefaultChannelOrder(device); device->UpdateSize=data->csetup.buf.block.frag_size/ - (ChannelsFromDevFmt(device->FmtChans)*BytesFromDevFmt(device->FmtType)); + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); device->NumUpdates=data->csetup.buf.block.frags; data->size=data->csetup.buf.block.frag_size; @@ -568,35 +592,93 @@ static ALCboolean qsa_reset_playback(ALCdevice* device) return ALC_TRUE; } -static ALCboolean qsa_start_playback(ALCdevice* device) +static ALCboolean qsa_start_playback(PlaybackWrapper *self) { - qsa_data *data = (qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; - data->killNow = 0; - if(althrd_create(&data->thread, qsa_proc_playback, device) != althrd_success) + ATOMIC_STORE(&data->killNow, AL_FALSE, almemory_order_release); + if(althrd_create(&data->thread, qsa_proc_playback, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; } -static void qsa_stop_playback(ALCdevice* device) +static void qsa_stop_playback(PlaybackWrapper *self) { - qsa_data *data = (qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; int res; - if(data->killNow) + if(ATOMIC_EXCHANGE(&data->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - data->killNow = 1; althrd_join(data->thread, &res); } + +static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(PlaybackWrapper, ALCbackend, self); + + self->ExtraData = NULL; +} + +static void PlaybackWrapper_Destruct(PlaybackWrapper *self) +{ + if(self->ExtraData) + qsa_close_playback(self); + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + +static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name) +{ + return qsa_open_playback(self, name); +} + +static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self) +{ + return qsa_reset_playback(self); +} + +static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self) +{ + return qsa_start_playback(self); +} + +static void PlaybackWrapper_stop(PlaybackWrapper *self) +{ + qsa_stop_playback(self); +} + + + /***********/ /* Capture */ /***********/ -static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) +typedef struct CaptureWrapper { + DERIVE_FROM_TYPE(ALCbackend); + qsa_data *ExtraData; +} CaptureWrapper; + +static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device); +static void CaptureWrapper_Destruct(CaptureWrapper *self); +static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name); +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ALCboolean, reset) +static ALCboolean CaptureWrapper_start(CaptureWrapper *self); +static void CaptureWrapper_stop(CaptureWrapper *self); +static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples); +static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self); +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, lock) +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(CaptureWrapper) +DEFINE_ALCBACKEND_VTABLE(CaptureWrapper); + + +static ALCenum qsa_open_capture(CaptureWrapper *self, const ALCchar *deviceName) { + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; qsa_data *data; int card, dev; int format=-1; @@ -646,8 +728,8 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) return ALC_INVALID_DEVICE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, deviceName); + self->ExtraData = data; switch (device->FmtType) { @@ -687,20 +769,19 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) data->cparams.stop_mode=SND_PCM_STOP_STOP; data->cparams.buf.block.frag_size=device->UpdateSize* - ChannelsFromDevFmt(device->FmtChans)*BytesFromDevFmt(device->FmtType); + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); data->cparams.buf.block.frags_max=device->NumUpdates; data->cparams.buf.block.frags_min=device->NumUpdates; data->cparams.format.interleave=1; data->cparams.format.rate=device->Frequency; - data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans); + data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); data->cparams.format.format=format; if(snd_pcm_plugin_params(data->pcmHandle, &data->cparams) < 0) { snd_pcm_close(data->pcmHandle); free(data); - device->ExtraData=NULL; return ALC_INVALID_VALUE; } @@ -708,20 +789,20 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) return ALC_NO_ERROR; } -static void qsa_close_capture(ALCdevice* device) +static void qsa_close_capture(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; if (data->pcmHandle!=NULL) snd_pcm_close(data->pcmHandle); free(data); - device->ExtraData=NULL; + self->ExtraData = NULL; } -static void qsa_start_capture(ALCdevice* device) +static void qsa_start_capture(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; int rstatus; if ((rstatus=snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_CAPTURE))<0) @@ -741,18 +822,18 @@ static void qsa_start_capture(ALCdevice* device) snd_pcm_capture_go(data->pcmHandle); } -static void qsa_stop_capture(ALCdevice* device) +static void qsa_stop_capture(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; - + qsa_data *data = self->ExtraData; snd_pcm_capture_flush(data->pcmHandle); } -static ALCuint qsa_available_samples(ALCdevice* device) +static ALCuint qsa_available_samples(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; snd_pcm_channel_status_t status; - ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + ALint frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); ALint free_size; int rstatus; @@ -765,7 +846,7 @@ static ALCuint qsa_available_samples(ALCdevice* device) if ((rstatus=snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_CAPTURE))<0) { ERR("capture prepare failed: %s\n", snd_strerror(rstatus)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed capture recovery: %s", snd_strerror(rstatus)); return 0; } @@ -779,16 +860,17 @@ static ALCuint qsa_available_samples(ALCdevice* device) return free_size/frame_size; } -static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) +static ALCenum qsa_capture_samples(CaptureWrapper *self, ALCvoid *buffer, ALCuint samples) { - qsa_data* data=(qsa_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; char* read_ptr; snd_pcm_channel_status_t status; fd_set rfds; int selectret; struct timeval timeout; int bytes_read; - ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); ALint len=samples*frame_size; int rstatus; @@ -807,7 +889,7 @@ static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint s switch (selectret) { case -1: - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to check capture samples"); return ALC_INVALID_DEVICE; case 0: break; @@ -838,7 +920,8 @@ static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint s if ((rstatus=snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_CAPTURE))<0) { ERR("capture prepare failed: %s\n", snd_strerror(rstatus)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed capture recovery: %s", + snd_strerror(rstatus)); return ALC_INVALID_DEVICE; } snd_pcm_capture_go(data->pcmHandle); @@ -854,27 +937,68 @@ static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint s return ALC_NO_ERROR; } -static const BackendFuncs qsa_funcs= { - qsa_open_playback, - qsa_close_playback, - qsa_reset_playback, - qsa_start_playback, - qsa_stop_playback, - qsa_open_capture, - qsa_close_capture, - qsa_start_capture, - qsa_stop_capture, - qsa_capture_samples, - qsa_available_samples -}; -ALCboolean alc_qsa_init(BackendFuncs* func_list) +static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device) { - *func_list = qsa_funcs; + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(CaptureWrapper, ALCbackend, self); + + self->ExtraData = NULL; +} + +static void CaptureWrapper_Destruct(CaptureWrapper *self) +{ + if(self->ExtraData) + qsa_close_capture(self); + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + +static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name) +{ + return qsa_open_capture(self, name); +} + +static ALCboolean CaptureWrapper_start(CaptureWrapper *self) +{ + qsa_start_capture(self); return ALC_TRUE; } -void alc_qsa_deinit(void) +static void CaptureWrapper_stop(CaptureWrapper *self) +{ + qsa_stop_capture(self); +} + +static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples) +{ + return qsa_capture_samples(self, buffer, samples); +} + +static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self) +{ + return qsa_available_samples(self); +} + + +typedef struct ALCqsaBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCqsaBackendFactory; +#define ALCQSABACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCqsaBackendFactory, ALCbackendFactory) } } + +static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self)); +static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self)); +static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type); +static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type); +static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCqsaBackendFactory); + +static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self)) +{ + return ALC_TRUE; +} + +static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self)) { #define FREE_NAME(iter) free((iter)->name) VECTOR_FOR_EACH(DevMap, DeviceNameMap, FREE_NAME); @@ -885,7 +1009,14 @@ void alc_qsa_deinit(void) #undef FREE_NAME } -void alc_qsa_probe(enum DevProbe type) +static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type) +{ + if(type == ALCbackend_Playback || type == ALCbackend_Capture) + return ALC_TRUE; + return ALC_FALSE; +} + +static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type) { switch (type) { @@ -914,3 +1045,29 @@ void alc_qsa_probe(enum DevProbe type) break; } } + +static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + PlaybackWrapper *backend; + NEW_OBJ(backend, PlaybackWrapper)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + if(type == ALCbackend_Capture) + { + CaptureWrapper *backend; + NEW_OBJ(backend, CaptureWrapper)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} + +ALCbackendFactory *ALCqsaBackendFactory_getFactory(void) +{ + static ALCqsaBackendFactory factory = ALCQSABACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} diff --git a/Engine/lib/openal-soft/Alc/backends/sdl2.c b/Engine/lib/openal-soft/Alc/backends/sdl2.c new file mode 100644 index 000000000..cf005024f --- /dev/null +++ b/Engine/lib/openal-soft/Alc/backends/sdl2.c @@ -0,0 +1,287 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 2018 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include + +#include "alMain.h" +#include "alu.h" +#include "threads.h" +#include "compat.h" + +#include "backends/base.h" + + +#ifdef _WIN32 +#define DEVNAME_PREFIX "OpenAL Soft on " +#else +#define DEVNAME_PREFIX "" +#endif + +typedef struct ALCsdl2Backend { + DERIVE_FROM_TYPE(ALCbackend); + + SDL_AudioDeviceID deviceID; + ALsizei frameSize; + + ALuint Frequency; + enum DevFmtChannels FmtChans; + enum DevFmtType FmtType; + ALuint UpdateSize; +} ALCsdl2Backend; + +static void ALCsdl2Backend_Construct(ALCsdl2Backend *self, ALCdevice *device); +static void ALCsdl2Backend_Destruct(ALCsdl2Backend *self); +static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name); +static ALCboolean ALCsdl2Backend_reset(ALCsdl2Backend *self); +static ALCboolean ALCsdl2Backend_start(ALCsdl2Backend *self); +static void ALCsdl2Backend_stop(ALCsdl2Backend *self); +static DECLARE_FORWARD2(ALCsdl2Backend, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCsdl2Backend, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(ALCsdl2Backend, ALCbackend, ClockLatency, getClockLatency) +static void ALCsdl2Backend_lock(ALCsdl2Backend *self); +static void ALCsdl2Backend_unlock(ALCsdl2Backend *self); +DECLARE_DEFAULT_ALLOCATORS(ALCsdl2Backend) + +DEFINE_ALCBACKEND_VTABLE(ALCsdl2Backend); + +static const ALCchar defaultDeviceName[] = DEVNAME_PREFIX "Default Device"; + +static void ALCsdl2Backend_Construct(ALCsdl2Backend *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCsdl2Backend, ALCbackend, self); + + self->deviceID = 0; + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + self->Frequency = device->Frequency; + self->FmtChans = device->FmtChans; + self->FmtType = device->FmtType; + self->UpdateSize = device->UpdateSize; +} + +static void ALCsdl2Backend_Destruct(ALCsdl2Backend *self) +{ + if(self->deviceID) + SDL_CloseAudioDevice(self->deviceID); + self->deviceID = 0; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + + +static void ALCsdl2Backend_audioCallback(void *ptr, Uint8 *stream, int len) +{ + ALCsdl2Backend *self = (ALCsdl2Backend*)ptr; + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + + assert((len % self->frameSize) == 0); + aluMixData(device, stream, len / self->frameSize); +} + +static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + SDL_AudioSpec want, have; + + SDL_zero(want); + SDL_zero(have); + + want.freq = device->Frequency; + switch(device->FmtType) + { + case DevFmtUByte: want.format = AUDIO_U8; break; + case DevFmtByte: want.format = AUDIO_S8; break; + case DevFmtUShort: want.format = AUDIO_U16SYS; break; + case DevFmtShort: want.format = AUDIO_S16SYS; break; + case DevFmtUInt: /* fall-through */ + case DevFmtInt: want.format = AUDIO_S32SYS; break; + case DevFmtFloat: want.format = AUDIO_F32; break; + } + want.channels = (device->FmtChans == DevFmtMono) ? 1 : 2; + want.samples = device->UpdateSize; + want.callback = ALCsdl2Backend_audioCallback; + want.userdata = self; + + /* Passing NULL to SDL_OpenAudioDevice opens a default, which isn't + * necessarily the first in the list. + */ + if(!name || strcmp(name, defaultDeviceName) == 0) + self->deviceID = SDL_OpenAudioDevice(NULL, SDL_FALSE, &want, &have, + SDL_AUDIO_ALLOW_ANY_CHANGE); + else + { + const size_t prefix_len = strlen(DEVNAME_PREFIX); + if(strncmp(name, DEVNAME_PREFIX, prefix_len) == 0) + self->deviceID = SDL_OpenAudioDevice(name+prefix_len, SDL_FALSE, &want, &have, + SDL_AUDIO_ALLOW_ANY_CHANGE); + else + self->deviceID = SDL_OpenAudioDevice(name, SDL_FALSE, &want, &have, + SDL_AUDIO_ALLOW_ANY_CHANGE); + } + if(self->deviceID == 0) + return ALC_INVALID_VALUE; + + device->Frequency = have.freq; + if(have.channels == 1) + device->FmtChans = DevFmtMono; + else if(have.channels == 2) + device->FmtChans = DevFmtStereo; + else + { + ERR("Got unhandled SDL channel count: %d\n", (int)have.channels); + return ALC_INVALID_VALUE; + } + switch(have.format) + { + case AUDIO_U8: device->FmtType = DevFmtUByte; break; + case AUDIO_S8: device->FmtType = DevFmtByte; break; + case AUDIO_U16SYS: device->FmtType = DevFmtUShort; break; + case AUDIO_S16SYS: device->FmtType = DevFmtShort; break; + case AUDIO_S32SYS: device->FmtType = DevFmtInt; break; + case AUDIO_F32SYS: device->FmtType = DevFmtFloat; break; + default: + ERR("Got unsupported SDL format: 0x%04x\n", have.format); + return ALC_INVALID_VALUE; + } + device->UpdateSize = have.samples; + device->NumUpdates = 2; /* SDL always (tries to) use two periods. */ + + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + self->Frequency = device->Frequency; + self->FmtChans = device->FmtChans; + self->FmtType = device->FmtType; + self->UpdateSize = device->UpdateSize; + + alstr_copy_cstr(&device->DeviceName, name ? name : defaultDeviceName); + + return ALC_NO_ERROR; +} + +static ALCboolean ALCsdl2Backend_reset(ALCsdl2Backend *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + device->Frequency = self->Frequency; + device->FmtChans = self->FmtChans; + device->FmtType = self->FmtType; + device->UpdateSize = self->UpdateSize; + device->NumUpdates = 2; + SetDefaultWFXChannelOrder(device); + return ALC_TRUE; +} + +static ALCboolean ALCsdl2Backend_start(ALCsdl2Backend *self) +{ + SDL_PauseAudioDevice(self->deviceID, 0); + return ALC_TRUE; +} + +static void ALCsdl2Backend_stop(ALCsdl2Backend *self) +{ + SDL_PauseAudioDevice(self->deviceID, 1); +} + +static void ALCsdl2Backend_lock(ALCsdl2Backend *self) +{ + SDL_LockAudioDevice(self->deviceID); +} + +static void ALCsdl2Backend_unlock(ALCsdl2Backend *self) +{ + SDL_UnlockAudioDevice(self->deviceID); +} + + +typedef struct ALCsdl2BackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCsdl2BackendFactory; +#define ALCsdl2BACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCsdl2BackendFactory, ALCbackendFactory) } } + +ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void); + +static ALCboolean ALCsdl2BackendFactory_init(ALCsdl2BackendFactory *self); +static void ALCsdl2BackendFactory_deinit(ALCsdl2BackendFactory *self); +static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory *self, ALCbackend_Type type); +static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory *self, enum DevProbe type); +static ALCbackend* ALCsdl2BackendFactory_createBackend(ALCsdl2BackendFactory *self, ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsdl2BackendFactory); + + +ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void) +{ + static ALCsdl2BackendFactory factory = ALCsdl2BACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} + + +static ALCboolean ALCsdl2BackendFactory_init(ALCsdl2BackendFactory* UNUSED(self)) +{ + if(SDL_InitSubSystem(SDL_INIT_AUDIO) == 0) + return AL_TRUE; + return ALC_FALSE; +} + +static void ALCsdl2BackendFactory_deinit(ALCsdl2BackendFactory* UNUSED(self)) +{ + SDL_QuitSubSystem(SDL_INIT_AUDIO); +} + +static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory* UNUSED(self), ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + return ALC_TRUE; + return ALC_FALSE; +} + +static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory* UNUSED(self), enum DevProbe type) +{ + int num_devices, i; + al_string name; + + if(type != ALL_DEVICE_PROBE) + return; + + AL_STRING_INIT(name); + num_devices = SDL_GetNumAudioDevices(SDL_FALSE); + + AppendAllDevicesList(defaultDeviceName); + for(i = 0;i < num_devices;++i) + { + alstr_copy_cstr(&name, DEVNAME_PREFIX); + alstr_append_cstr(&name, SDL_GetAudioDeviceName(i, SDL_FALSE)); + AppendAllDevicesList(alstr_get_cstr(name)); + } + alstr_reset(&name); +} + +static ALCbackend* ALCsdl2BackendFactory_createBackend(ALCsdl2BackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCsdl2Backend *backend; + NEW_OBJ(backend, ALCsdl2Backend)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} diff --git a/Engine/lib/openal-soft/Alc/backends/sndio.c b/Engine/lib/openal-soft/Alc/backends/sndio.c index 52bff13a5..5aea457b5 100644 --- a/Engine/lib/openal-soft/Alc/backends/sndio.c +++ b/Engine/lib/openal-soft/Alc/backends/sndio.c @@ -28,55 +28,98 @@ #include "alu.h" #include "threads.h" +#include "backends/base.h" + #include -static const ALCchar sndio_device[] = "SndIO Default"; -static ALCboolean sndio_load(void) -{ - return ALC_TRUE; -} +typedef struct ALCsndioBackend { + DERIVE_FROM_TYPE(ALCbackend); - -typedef struct { struct sio_hdl *sndHandle; ALvoid *mix_data; ALsizei data_size; - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; -} sndio_data; +} ALCsndioBackend; + +static int ALCsndioBackend_mixerProc(void *ptr); + +static void ALCsndioBackend_Construct(ALCsndioBackend *self, ALCdevice *device); +static void ALCsndioBackend_Destruct(ALCsndioBackend *self); +static ALCenum ALCsndioBackend_open(ALCsndioBackend *self, const ALCchar *name); +static ALCboolean ALCsndioBackend_reset(ALCsndioBackend *self); +static ALCboolean ALCsndioBackend_start(ALCsndioBackend *self); +static void ALCsndioBackend_stop(ALCsndioBackend *self); +static DECLARE_FORWARD2(ALCsndioBackend, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCsndioBackend) + +DEFINE_ALCBACKEND_VTABLE(ALCsndioBackend); -static int sndio_proc(void *ptr) +static const ALCchar sndio_device[] = "SndIO Default"; + + +static void ALCsndioBackend_Construct(ALCsndioBackend *self, ALCdevice *device) { - ALCdevice *device = ptr; - sndio_data *data = device->ExtraData; + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCsndioBackend, ALCbackend, self); + + self->sndHandle = NULL; + self->mix_data = NULL; + ATOMIC_INIT(&self->killNow, AL_TRUE); +} + +static void ALCsndioBackend_Destruct(ALCsndioBackend *self) +{ + if(self->sndHandle) + sio_close(self->sndHandle); + self->sndHandle = NULL; + + al_free(self->mix_data); + self->mix_data = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + + +static int ALCsndioBackend_mixerProc(void *ptr) +{ + ALCsndioBackend *self = (ALCsndioBackend*)ptr; + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; ALsizei frameSize; size_t wrote; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!data->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ALsizei len = data->data_size; - ALubyte *WritePtr = data->mix_data; + ALsizei len = self->data_size; + ALubyte *WritePtr = self->mix_data; + ALCsndioBackend_lock(self); aluMixData(device, WritePtr, len/frameSize); - while(len > 0 && !data->killNow) + ALCsndioBackend_unlock(self); + while(len > 0 && !ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { - wrote = sio_write(data->sndHandle, WritePtr, len); + wrote = sio_write(self->sndHandle, WritePtr, len); if(wrote == 0) { ERR("sio_write failed\n"); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to write playback samples"); ALCdevice_Unlock(device); break; } @@ -90,45 +133,30 @@ static int sndio_proc(void *ptr) } - -static ALCenum sndio_open_playback(ALCdevice *device, const ALCchar *deviceName) +static ALCenum ALCsndioBackend_open(ALCsndioBackend *self, const ALCchar *name) { - sndio_data *data; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - if(!deviceName) - deviceName = sndio_device; - else if(strcmp(deviceName, sndio_device) != 0) + if(!name) + name = sndio_device; + else if(strcmp(name, sndio_device) != 0) return ALC_INVALID_VALUE; - data = calloc(1, sizeof(*data)); - data->killNow = 0; - - data->sndHandle = sio_open(NULL, SIO_PLAY, 0); - if(data->sndHandle == NULL) + self->sndHandle = sio_open(NULL, SIO_PLAY, 0); + if(self->sndHandle == NULL) { - free(data); ERR("Could not open device\n"); return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void sndio_close_playback(ALCdevice *device) +static ALCboolean ALCsndioBackend_reset(ALCsndioBackend *self) { - sndio_data *data = device->ExtraData; - - sio_close(data->sndHandle); - free(data); - device->ExtraData = NULL; -} - -static ALCboolean sndio_reset_playback(ALCdevice *device) -{ - sndio_data *data = device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; struct sio_par par; sio_initpar(&par); @@ -170,7 +198,7 @@ static ALCboolean sndio_reset_playback(ALCdevice *device) par.appbufsz = device->UpdateSize * (device->NumUpdates-1); if(!par.appbufsz) par.appbufsz = device->UpdateSize; - if(!sio_setpar(data->sndHandle, &par) || !sio_getpar(data->sndHandle, &par)) + if(!sio_setpar(self->sndHandle, &par) || !sio_getpar(self->sndHandle, &par)) { ERR("Failed to set device parameters\n"); return ALC_FALSE; @@ -211,77 +239,84 @@ static ALCboolean sndio_reset_playback(ALCdevice *device) return ALC_TRUE; } -static ALCboolean sndio_start_playback(ALCdevice *device) +static ALCboolean ALCsndioBackend_start(ALCsndioBackend *self) { - sndio_data *data = device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - if(!sio_start(data->sndHandle)) + self->data_size = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); + al_free(self->mix_data); + self->mix_data = al_calloc(16, self->data_size); + + if(!sio_start(self->sndHandle)) { ERR("Error starting playback\n"); return ALC_FALSE; } - data->data_size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); - data->mix_data = calloc(1, data->data_size); - - data->killNow = 0; - if(althrd_create(&data->thread, sndio_proc, device) != althrd_success) + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); + if(althrd_create(&self->thread, ALCsndioBackend_mixerProc, self) != althrd_success) { - sio_stop(data->sndHandle); - free(data->mix_data); - data->mix_data = NULL; + sio_stop(self->sndHandle); return ALC_FALSE; } return ALC_TRUE; } -static void sndio_stop_playback(ALCdevice *device) +static void ALCsndioBackend_stop(ALCsndioBackend *self) { - sndio_data *data = device->ExtraData; int res; - if(data->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; + althrd_join(self->thread, &res); - data->killNow = 1; - althrd_join(data->thread, &res); - - if(!sio_stop(data->sndHandle)) + if(!sio_stop(self->sndHandle)) ERR("Error stopping device\n"); - free(data->mix_data); - data->mix_data = NULL; + al_free(self->mix_data); + self->mix_data = NULL; } -static const BackendFuncs sndio_funcs = { - sndio_open_playback, - sndio_close_playback, - sndio_reset_playback, - sndio_start_playback, - sndio_stop_playback, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; +typedef struct ALCsndioBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCsndioBackendFactory; +#define ALCSNDIOBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCsndioBackendFactory, ALCbackendFactory) } } -ALCboolean alc_sndio_init(BackendFuncs *func_list) +ALCbackendFactory *ALCsndioBackendFactory_getFactory(void); + +static ALCboolean ALCsndioBackendFactory_init(ALCsndioBackendFactory *self); +static DECLARE_FORWARD(ALCsndioBackendFactory, ALCbackendFactory, void, deinit) +static ALCboolean ALCsndioBackendFactory_querySupport(ALCsndioBackendFactory *self, ALCbackend_Type type); +static void ALCsndioBackendFactory_probe(ALCsndioBackendFactory *self, enum DevProbe type); +static ALCbackend* ALCsndioBackendFactory_createBackend(ALCsndioBackendFactory *self, ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsndioBackendFactory); + + +ALCbackendFactory *ALCsndioBackendFactory_getFactory(void) { - if(!sndio_load()) - return ALC_FALSE; - *func_list = sndio_funcs; + static ALCsndioBackendFactory factory = ALCSNDIOBACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} + + +static ALCboolean ALCsndioBackendFactory_init(ALCsndioBackendFactory* UNUSED(self)) +{ + /* No dynamic loading */ return ALC_TRUE; } -void alc_sndio_deinit(void) +static ALCboolean ALCsndioBackendFactory_querySupport(ALCsndioBackendFactory* UNUSED(self), ALCbackend_Type type) { + if(type == ALCbackend_Playback) + return ALC_TRUE; + return ALC_FALSE; } -void alc_sndio_probe(enum DevProbe type) +static void ALCsndioBackendFactory_probe(ALCsndioBackendFactory* UNUSED(self), enum DevProbe type) { switch(type) { @@ -292,3 +327,16 @@ void alc_sndio_probe(enum DevProbe type) break; } } + +static ALCbackend* ALCsndioBackendFactory_createBackend(ALCsndioBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCsndioBackend *backend; + NEW_OBJ(backend, ALCsndioBackend)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} diff --git a/Engine/lib/openal-soft/Alc/backends/solaris.c b/Engine/lib/openal-soft/Alc/backends/solaris.c index 01472e6a1..f1c4aeaa2 100644 --- a/Engine/lib/openal-soft/Alc/backends/solaris.c +++ b/Engine/lib/openal-soft/Alc/backends/solaris.c @@ -34,6 +34,7 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" #include "threads.h" #include "compat.h" @@ -50,7 +51,7 @@ typedef struct ALCsolarisBackend { ALubyte *mix_data; int data_size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCsolarisBackend; @@ -59,7 +60,6 @@ static int ALCsolarisBackend_mixerProc(void *ptr); static void ALCsolarisBackend_Construct(ALCsolarisBackend *self, ALCdevice *device); static void ALCsolarisBackend_Destruct(ALCsolarisBackend *self); static ALCenum ALCsolarisBackend_open(ALCsolarisBackend *self, const ALCchar *name); -static void ALCsolarisBackend_close(ALCsolarisBackend *self); static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self); static ALCboolean ALCsolarisBackend_start(ALCsolarisBackend *self); static void ALCsolarisBackend_stop(ALCsolarisBackend *self); @@ -84,6 +84,8 @@ static void ALCsolarisBackend_Construct(ALCsolarisBackend *self, ALCdevice *devi SET_VTABLE2(ALCsolarisBackend, ALCbackend, self); self->fd = -1; + self->mix_data = NULL; + ATOMIC_INIT(&self->killNow, AL_FALSE); } static void ALCsolarisBackend_Destruct(ALCsolarisBackend *self) @@ -103,43 +105,67 @@ static void ALCsolarisBackend_Destruct(ALCsolarisBackend *self) static int ALCsolarisBackend_mixerProc(void *ptr) { ALCsolarisBackend *self = ptr; - ALCdevice *Device = STATIC_CAST(ALCbackend,self)->mDevice; - ALint frameSize; - int wrote; + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + struct timeval timeout; + ALubyte *write_ptr; + ALint frame_size; + ALint to_write; + ssize_t wrote; + fd_set wfds; + int sret; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(Device->FmtChans, Device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!self->killNow && Device->Connected) + ALCsolarisBackend_lock(self); + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ALint len = self->data_size; - ALubyte *WritePtr = self->mix_data; + FD_ZERO(&wfds); + FD_SET(self->fd, &wfds); + timeout.tv_sec = 1; + timeout.tv_usec = 0; - aluMixData(Device, WritePtr, len/frameSize); - while(len > 0 && !self->killNow) + ALCsolarisBackend_unlock(self); + sret = select(self->fd+1, NULL, &wfds, NULL, &timeout); + ALCsolarisBackend_lock(self); + if(sret < 0) { - wrote = write(self->fd, WritePtr, len); + if(errno == EINTR) + continue; + ERR("select failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed to wait for playback buffer: %s", strerror(errno)); + break; + } + else if(sret == 0) + { + WARN("select timeout\n"); + continue; + } + + write_ptr = self->mix_data; + to_write = self->data_size; + aluMixData(device, write_ptr, to_write/frame_size); + while(to_write > 0 && !ATOMIC_LOAD_SEQ(&self->killNow)) + { + wrote = write(self->fd, write_ptr, to_write); if(wrote < 0) { - if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) - { - ERR("write failed: %s\n", strerror(errno)); - ALCsolarisBackend_lock(self); - aluHandleDisconnect(Device); - ALCsolarisBackend_unlock(self); - break; - } - - al_nssleep(1000000); - continue; + if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) + continue; + ERR("write failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed to write playback samples: %s", + strerror(errno)); + break; } - len -= wrote; - WritePtr += wrote; + to_write -= wrote; + write_ptr += wrote; } } + ALCsolarisBackend_unlock(self); return 0; } @@ -162,23 +188,17 @@ static ALCenum ALCsolarisBackend_open(ALCsolarisBackend *self, const ALCchar *na } device = STATIC_CAST(ALCbackend,self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCsolarisBackend_close(ALCsolarisBackend *self) -{ - close(self->fd); - self->fd = -1; -} - static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; audio_info_t info; - ALuint frameSize; - int numChannels; + ALsizei frameSize; + ALsizei numChannels; AUDIO_INITINFO(&info); @@ -186,7 +206,7 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) if(device->FmtChans != DevFmtMono) device->FmtChans = DevFmtStereo; - numChannels = ChannelsFromDevFmt(device->FmtChans); + numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); info.play.channels = numChannels; switch(device->FmtType) @@ -220,9 +240,9 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) return ALC_FALSE; } - if(ChannelsFromDevFmt(device->FmtChans) != info.play.channels) + if(ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder) != (ALsizei)info.play.channels) { - ERR("Could not set %d channels, got %d instead\n", ChannelsFromDevFmt(device->FmtChans), info.play.channels); + ERR("Failed to set %s, got %u channels instead\n", DevFmtChannelsString(device->FmtChans), info.play.channels); return ALC_FALSE; } @@ -242,7 +262,9 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) SetDefaultChannelOrder(device); free(self->mix_data); - self->data_size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->data_size = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); self->mix_data = calloc(1, self->data_size); return ALC_TRUE; @@ -250,7 +272,7 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) static ALCboolean ALCsolarisBackend_start(ALCsolarisBackend *self) { - self->killNow = 0; + ATOMIC_STORE_SEQ(&self->killNow, AL_FALSE); if(althrd_create(&self->thread, ALCsolarisBackend_mixerProc, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; @@ -260,10 +282,9 @@ static void ALCsolarisBackend_stop(ALCsolarisBackend *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE)) return; - self->killNow = 1; althrd_join(self->thread, &res); if(ioctl(self->fd, AUDIO_DRAIN) < 0) diff --git a/Engine/lib/openal-soft/Alc/backends/mmdevapi.c b/Engine/lib/openal-soft/Alc/backends/wasapi.c similarity index 67% rename from Engine/lib/openal-soft/Alc/backends/mmdevapi.c rename to Engine/lib/openal-soft/Alc/backends/wasapi.c index 3882b08f0..50471f6b6 100644 --- a/Engine/lib/openal-soft/Alc/backends/mmdevapi.c +++ b/Engine/lib/openal-soft/Alc/backends/wasapi.c @@ -41,9 +41,11 @@ #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" #include "alstring.h" +#include "converter.h" #include "backends/base.h" @@ -64,9 +66,18 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x #define X7DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT) #define X7DOT1_WIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_FRONT_LEFT_OF_CENTER|SPEAKER_FRONT_RIGHT_OF_CENTER) +#define REFTIME_PER_SEC ((REFERENCE_TIME)10000000) + #define DEVNAME_HEAD "OpenAL Soft on " +/* Scales the given value using 64-bit integer math, ceiling the result. */ +static inline ALuint64 ScaleCeil(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale) +{ + return (val*new_scale + old_scale-1) / old_scale; +} + + typedef struct { al_string name; al_string endpoint_guid; // obtained from PKEY_AudioEndpoint_GUID , set to "Unknown device GUID" if absent. @@ -108,6 +119,15 @@ typedef struct { #define WM_USER_Enumerate (WM_USER+5) #define WM_USER_Last (WM_USER+5) +static const char MessageStr[WM_USER_Last+1-WM_USER][20] = { + "Open Device", + "Reset Device", + "Start Device", + "Stop Device", + "Close Device", + "Enumerate Devices", +}; + static inline void ReturnMsgResponse(ThreadRequest *req, HRESULT res) { req->result = res; @@ -130,14 +150,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri PROPVARIANT pvguid; HRESULT hr; - al_string_copy_cstr(name, DEVNAME_HEAD); + alstr_copy_cstr(name, DEVNAME_HEAD); hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps); if(FAILED(hr)) { WARN("OpenPropertyStore failed: 0x%08lx\n", hr); - al_string_append_cstr(name, "Unknown Device Name"); - if(guid!=NULL)al_string_copy_cstr(guid, "Unknown Device GUID"); + alstr_append_cstr(name, "Unknown Device Name"); + if(guid!=NULL)alstr_copy_cstr(guid, "Unknown Device GUID"); return; } @@ -147,14 +167,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri if(FAILED(hr)) { WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr); - al_string_append_cstr(name, "Unknown Device Name"); + alstr_append_cstr(name, "Unknown Device Name"); } else if(pvname.vt == VT_LPWSTR) - al_string_append_wcstr(name, pvname.pwszVal); + alstr_append_wcstr(name, pvname.pwszVal); else { WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvname.vt); - al_string_append_cstr(name, "Unknown Device Name"); + alstr_append_cstr(name, "Unknown Device Name"); } PropVariantClear(&pvname); @@ -165,14 +185,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri if(FAILED(hr)) { WARN("GetValue AudioEndpoint_GUID failed: 0x%08lx\n", hr); - al_string_copy_cstr(guid, "Unknown Device GUID"); + alstr_copy_cstr(guid, "Unknown Device GUID"); } else if(pvguid.vt == VT_LPWSTR) - al_string_copy_wcstr(guid, pvguid.pwszVal); + alstr_copy_wcstr(guid, pvguid.pwszVal); else { WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvguid.vt); - al_string_copy_cstr(guid, "Unknown Device GUID"); + alstr_copy_cstr(guid, "Unknown Device GUID"); } PropVariantClear(&pvguid); @@ -211,7 +231,7 @@ static void get_device_formfactor(IMMDevice *device, EndpointFormFactor *formfac } -static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list) +static void add_device(IMMDevice *device, const WCHAR *devid, vector_DevMap *list) { int count = 0; al_string tmpname; @@ -228,30 +248,30 @@ static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list) { const DevMap *iter; - al_string_copy(&entry.name, tmpname); + alstr_copy(&entry.name, tmpname); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, *list, MATCH_ENTRY); if(iter == VECTOR_END(*list)) break; #undef MATCH_ENTRY count++; } - TRACE("Got device \"%s\", \"%s\", \"%ls\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.endpoint_guid), entry.devid); + TRACE("Got device \"%s\", \"%s\", \"%ls\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.endpoint_guid), entry.devid); VECTOR_PUSH_BACK(*list, entry); AL_STRING_DEINIT(tmpname); } -static LPWSTR get_device_id(IMMDevice *device) +static WCHAR *get_device_id(IMMDevice *device) { - LPWSTR devid; + WCHAR *devid; HRESULT hr; hr = IMMDevice_GetId(device, &devid); @@ -268,7 +288,7 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve { IMMDeviceCollection *coll; IMMDevice *defdev = NULL; - LPWSTR defdevid = NULL; + WCHAR *defdevid = NULL; HRESULT hr; UINT count; UINT i; @@ -300,7 +320,7 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve for(i = 0;i < count;++i) { IMMDevice *device; - LPWSTR devid; + WCHAR *devid; hr = IMMDeviceCollection_Item(coll, i, &device); if(FAILED(hr)) continue; @@ -324,51 +344,51 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve /* Proxy interface used by the message handler. */ -struct ALCmmdevProxyVtable; +struct ALCwasapiProxyVtable; -typedef struct ALCmmdevProxy { - const struct ALCmmdevProxyVtable *vtbl; -} ALCmmdevProxy; +typedef struct ALCwasapiProxy { + const struct ALCwasapiProxyVtable *vtbl; +} ALCwasapiProxy; -struct ALCmmdevProxyVtable { - HRESULT (*const openProxy)(ALCmmdevProxy*); - void (*const closeProxy)(ALCmmdevProxy*); +struct ALCwasapiProxyVtable { + HRESULT (*const openProxy)(ALCwasapiProxy*); + void (*const closeProxy)(ALCwasapiProxy*); - HRESULT (*const resetProxy)(ALCmmdevProxy*); - HRESULT (*const startProxy)(ALCmmdevProxy*); - void (*const stopProxy)(ALCmmdevProxy*); + HRESULT (*const resetProxy)(ALCwasapiProxy*); + HRESULT (*const startProxy)(ALCwasapiProxy*); + void (*const stopProxy)(ALCwasapiProxy*); }; -#define DEFINE_ALCMMDEVPROXY_VTABLE(T) \ -DECLARE_THUNK(T, ALCmmdevProxy, HRESULT, openProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, void, closeProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, HRESULT, resetProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, HRESULT, startProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, void, stopProxy) \ +#define DEFINE_ALCWASAPIPROXY_VTABLE(T) \ +DECLARE_THUNK(T, ALCwasapiProxy, HRESULT, openProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, void, closeProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, HRESULT, resetProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, HRESULT, startProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, void, stopProxy) \ \ -static const struct ALCmmdevProxyVtable T##_ALCmmdevProxy_vtable = { \ - T##_ALCmmdevProxy_openProxy, \ - T##_ALCmmdevProxy_closeProxy, \ - T##_ALCmmdevProxy_resetProxy, \ - T##_ALCmmdevProxy_startProxy, \ - T##_ALCmmdevProxy_stopProxy, \ +static const struct ALCwasapiProxyVtable T##_ALCwasapiProxy_vtable = { \ + T##_ALCwasapiProxy_openProxy, \ + T##_ALCwasapiProxy_closeProxy, \ + T##_ALCwasapiProxy_resetProxy, \ + T##_ALCwasapiProxy_startProxy, \ + T##_ALCwasapiProxy_stopProxy, \ } -static void ALCmmdevProxy_Construct(ALCmmdevProxy* UNUSED(self)) { } -static void ALCmmdevProxy_Destruct(ALCmmdevProxy* UNUSED(self)) { } +static void ALCwasapiProxy_Construct(ALCwasapiProxy* UNUSED(self)) { } +static void ALCwasapiProxy_Destruct(ALCwasapiProxy* UNUSED(self)) { } -static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) +static DWORD CALLBACK ALCwasapiProxy_messageHandler(void *ptr) { ThreadRequest *req = ptr; IMMDeviceEnumerator *Enumerator; ALuint deviceCount = 0; - ALCmmdevProxy *proxy; + ALCwasapiProxy *proxy; HRESULT hr, cohr; MSG msg; TRACE("Starting message thread\n"); - cohr = CoInitialize(NULL); + cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(cohr)) { WARN("Failed to initialize COM: 0x%08lx\n", cohr); @@ -402,16 +422,20 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) TRACE("Starting message loop\n"); while(GetMessage(&msg, NULL, WM_USER_First, WM_USER_Last)) { - TRACE("Got message %u (lparam=%p, wparam=%p)\n", msg.message, (void*)msg.lParam, (void*)msg.wParam); + TRACE("Got message \"%s\" (0x%04x, lparam=%p, wparam=%p)\n", + (msg.message >= WM_USER && msg.message <= WM_USER_Last) ? + MessageStr[msg.message-WM_USER] : "Unknown", + msg.message, (void*)msg.lParam, (void*)msg.wParam + ); switch(msg.message) { case WM_USER_OpenDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; hr = cohr = S_OK; if(++deviceCount == 1) - hr = cohr = CoInitialize(NULL); + hr = cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hr)) hr = V0(proxy,openProxy)(); if(FAILED(hr)) @@ -425,7 +449,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_ResetDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; hr = V0(proxy,resetProxy)(); ReturnMsgResponse(req, hr); @@ -433,7 +457,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_StartDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; hr = V0(proxy,startProxy)(); ReturnMsgResponse(req, hr); @@ -441,7 +465,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_StopDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; V0(proxy,stopProxy)(); ReturnMsgResponse(req, S_OK); @@ -449,7 +473,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_CloseDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; V0(proxy,closeProxy)(); if(--deviceCount == 0) @@ -463,7 +487,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) hr = cohr = S_OK; if(++deviceCount == 1) - hr = cohr = CoInitialize(NULL); + hr = cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hr)) hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, &ptr); if(SUCCEEDED(hr)) @@ -496,9 +520,9 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) } -typedef struct ALCmmdevPlayback { +typedef struct ALCwasapiPlayback { DERIVE_FROM_TYPE(ALCbackend); - DERIVE_FROM_TYPE(ALCmmdevProxy); + DERIVE_FROM_TYPE(ALCwasapiProxy); WCHAR *devid; @@ -509,43 +533,42 @@ typedef struct ALCmmdevPlayback { HANDLE MsgEvent; - volatile UINT32 Padding; + ATOMIC(UINT32) Padding; - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; -} ALCmmdevPlayback; +} ALCwasapiPlayback; -static int ALCmmdevPlayback_mixerProc(void *arg); +static int ALCwasapiPlayback_mixerProc(void *arg); -static void ALCmmdevPlayback_Construct(ALCmmdevPlayback *self, ALCdevice *device); -static void ALCmmdevPlayback_Destruct(ALCmmdevPlayback *self); -static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *name); -static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_close(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_closeProxy(ALCmmdevPlayback *self); -static ALCboolean ALCmmdevPlayback_reset(ALCmmdevPlayback *self); -static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self); -static ALCboolean ALCmmdevPlayback_start(ALCmmdevPlayback *self); -static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_stop(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_stopProxy(ALCmmdevPlayback *self); -static DECLARE_FORWARD2(ALCmmdevPlayback, ALCbackend, ALCenum, captureSamples, ALCvoid*, ALCuint) -static DECLARE_FORWARD(ALCmmdevPlayback, ALCbackend, ALCuint, availableSamples) -static ClockLatency ALCmmdevPlayback_getClockLatency(ALCmmdevPlayback *self); -static DECLARE_FORWARD(ALCmmdevPlayback, ALCbackend, void, lock) -static DECLARE_FORWARD(ALCmmdevPlayback, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(ALCmmdevPlayback) +static void ALCwasapiPlayback_Construct(ALCwasapiPlayback *self, ALCdevice *device); +static void ALCwasapiPlayback_Destruct(ALCwasapiPlayback *self); +static ALCenum ALCwasapiPlayback_open(ALCwasapiPlayback *self, const ALCchar *name); +static HRESULT ALCwasapiPlayback_openProxy(ALCwasapiPlayback *self); +static void ALCwasapiPlayback_closeProxy(ALCwasapiPlayback *self); +static ALCboolean ALCwasapiPlayback_reset(ALCwasapiPlayback *self); +static HRESULT ALCwasapiPlayback_resetProxy(ALCwasapiPlayback *self); +static ALCboolean ALCwasapiPlayback_start(ALCwasapiPlayback *self); +static HRESULT ALCwasapiPlayback_startProxy(ALCwasapiPlayback *self); +static void ALCwasapiPlayback_stop(ALCwasapiPlayback *self); +static void ALCwasapiPlayback_stopProxy(ALCwasapiPlayback *self); +static DECLARE_FORWARD2(ALCwasapiPlayback, ALCbackend, ALCenum, captureSamples, ALCvoid*, ALCuint) +static DECLARE_FORWARD(ALCwasapiPlayback, ALCbackend, ALCuint, availableSamples) +static ClockLatency ALCwasapiPlayback_getClockLatency(ALCwasapiPlayback *self); +static DECLARE_FORWARD(ALCwasapiPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCwasapiPlayback, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCwasapiPlayback) -DEFINE_ALCMMDEVPROXY_VTABLE(ALCmmdevPlayback); -DEFINE_ALCBACKEND_VTABLE(ALCmmdevPlayback); +DEFINE_ALCWASAPIPROXY_VTABLE(ALCwasapiPlayback); +DEFINE_ALCBACKEND_VTABLE(ALCwasapiPlayback); -static void ALCmmdevPlayback_Construct(ALCmmdevPlayback *self, ALCdevice *device) +static void ALCwasapiPlayback_Construct(ALCwasapiPlayback *self, ALCdevice *device) { - SET_VTABLE2(ALCmmdevPlayback, ALCbackend, self); - SET_VTABLE2(ALCmmdevPlayback, ALCmmdevProxy, self); + SET_VTABLE2(ALCwasapiPlayback, ALCbackend, self); + SET_VTABLE2(ALCwasapiPlayback, ALCwasapiProxy, self); ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - ALCmmdevProxy_Construct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Construct(STATIC_CAST(ALCwasapiProxy, self)); self->devid = NULL; @@ -556,13 +579,30 @@ static void ALCmmdevPlayback_Construct(ALCmmdevPlayback *self, ALCdevice *device self->MsgEvent = NULL; - self->Padding = 0; + ATOMIC_INIT(&self->Padding, 0); - self->killNow = 0; + ATOMIC_INIT(&self->killNow, 0); } -static void ALCmmdevPlayback_Destruct(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_Destruct(ALCwasapiPlayback *self) { + if(self->MsgEvent) + { + ThreadRequest req = { self->MsgEvent, 0 }; + if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) + (void)WaitForResponse(&req); + + CloseHandle(self->MsgEvent); + self->MsgEvent = NULL; + } + + if(self->NotifyEvent) + CloseHandle(self->NotifyEvent); + self->NotifyEvent = NULL; + + free(self->devid); + self->devid = NULL; + if(self->NotifyEvent != NULL) CloseHandle(self->NotifyEvent); self->NotifyEvent = NULL; @@ -573,26 +613,26 @@ static void ALCmmdevPlayback_Destruct(ALCmmdevPlayback *self) free(self->devid); self->devid = NULL; - ALCmmdevProxy_Destruct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Destruct(STATIC_CAST(ALCwasapiProxy, self)); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -FORCE_ALIGN static int ALCmmdevPlayback_mixerProc(void *arg) +FORCE_ALIGN static int ALCwasapiPlayback_mixerProc(void *arg) { - ALCmmdevPlayback *self = arg; + ALCwasapiPlayback *self = arg; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; UINT32 buffer_len, written; ALuint update_size, len; BYTE *buffer; HRESULT hr; - hr = CoInitialize(NULL); + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(hr)) { - ERR("CoInitialize(NULL) failed: 0x%08lx\n", hr); + ERR("CoInitializeEx(NULL, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "COM init failed: 0x%08lx", hr); V0(device->Backend,unlock)(); return 1; } @@ -602,18 +642,18 @@ FORCE_ALIGN static int ALCmmdevPlayback_mixerProc(void *arg) update_size = device->UpdateSize; buffer_len = update_size * device->NumUpdates; - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_relaxed)) { hr = IAudioClient_GetCurrentPadding(self->client, &written); if(FAILED(hr)) { ERR("Failed to get padding: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to retrieve buffer padding: 0x%08lx", hr); V0(device->Backend,unlock)(); break; } - self->Padding = written; + ATOMIC_STORE(&self->Padding, written, almemory_order_relaxed); len = buffer_len - written; if(len < update_size) @@ -629,22 +669,22 @@ FORCE_ALIGN static int ALCmmdevPlayback_mixerProc(void *arg) hr = IAudioRenderClient_GetBuffer(self->render, len, &buffer); if(SUCCEEDED(hr)) { - V0(device->Backend,lock)(); + ALCwasapiPlayback_lock(self); aluMixData(device, buffer, len); - self->Padding = written + len; - V0(device->Backend,unlock)(); + ATOMIC_STORE(&self->Padding, written + len, almemory_order_relaxed); + ALCwasapiPlayback_unlock(self); hr = IAudioRenderClient_ReleaseBuffer(self->render, len, 0); } if(FAILED(hr)) { ERR("Failed to buffer data: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to send playback samples: 0x%08lx", hr); V0(device->Backend,unlock)(); break; } } - self->Padding = 0; + ATOMIC_STORE(&self->Padding, 0, almemory_order_release); CoUninitialize(); return 0; @@ -690,7 +730,7 @@ static ALCboolean MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX * return ALC_TRUE; } -static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *deviceName) +static ALCenum ALCwasapiPlayback_open(ALCwasapiPlayback *self, const ALCchar *deviceName) { HRESULT hr = S_OK; @@ -716,8 +756,8 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi } hr = E_FAIL; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0 || \ - al_string_cmp_cstr((i)->endpoint_guid, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0 || \ + alstr_cmp_cstr((i)->endpoint_guid, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) @@ -739,7 +779,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; self->devid = strdupW(iter->devid); - al_string_copy(&device->DeviceName, iter->name); + alstr_copy(&device->DeviceName, iter->name); hr = S_OK; } } @@ -750,7 +790,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi ThreadRequest req = { self->MsgEvent, 0 }; hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); else ERR("Failed to post thread message: %lu\n", GetLastError()); @@ -775,7 +815,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi return ALC_NO_ERROR; } -static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self) +static HRESULT ALCwasapiPlayback_openProxy(ALCwasapiPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; void *ptr; @@ -797,7 +837,7 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self) if(SUCCEEDED(hr)) { self->client = ptr; - if(al_string_empty(device->DeviceName)) + if(alstr_empty(device->DeviceName)) get_device_name_and_guid(self->mmdev, &device->DeviceName, NULL); } @@ -812,24 +852,7 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self) } -static void ALCmmdevPlayback_close(ALCmmdevPlayback *self) -{ - ThreadRequest req = { self->MsgEvent, 0 }; - - if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) - (void)WaitForResponse(&req); - - CloseHandle(self->MsgEvent); - self->MsgEvent = NULL; - - CloseHandle(self->NotifyEvent); - self->NotifyEvent = NULL; - - free(self->devid); - self->devid = NULL; -} - -static void ALCmmdevPlayback_closeProxy(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_closeProxy(ALCwasapiPlayback *self) { if(self->client) IAudioClient_Release(self->client); @@ -841,18 +864,18 @@ static void ALCmmdevPlayback_closeProxy(ALCmmdevPlayback *self) } -static ALCboolean ALCmmdevPlayback_reset(ALCmmdevPlayback *self) +static ALCboolean ALCwasapiPlayback_reset(ALCwasapiPlayback *self) { ThreadRequest req = { self->MsgEvent, 0 }; HRESULT hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; } -static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) +static HRESULT ALCwasapiPlayback_resetProxy(ALCwasapiPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; EndpointFormFactor formfactor = UnknownFormFactor; @@ -890,8 +913,8 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) CoTaskMemFree(wfx); wfx = NULL; - buf_time = ((REFERENCE_TIME)device->UpdateSize*device->NumUpdates*10000000 + - device->Frequency-1) / device->Frequency; + buf_time = ScaleCeil(device->UpdateSize*device->NumUpdates, REFTIME_PER_SEC, + device->Frequency); if(!(device->Flags&DEVICE_FREQUENCY_REQUEST)) device->Frequency = OutputType.Format.nSamplesPerSec; @@ -921,9 +944,7 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) OutputType.Format.nChannels = 1; OutputType.dwChannelMask = MONO; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: device->FmtChans = DevFmtStereo; /*fall-through*/ case DevFmtStereo: @@ -1082,7 +1103,7 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) hr = IAudioClient_GetDevicePeriod(self->client, &min_per, NULL); if(SUCCEEDED(hr)) { - min_len = (UINT32)((min_per*device->Frequency + 10000000-1) / 10000000); + min_len = (UINT32)ScaleCeil(min_per, device->Frequency, REFTIME_PER_SEC); /* Find the nearest multiple of the period size to the update size */ if(min_len < device->UpdateSize) min_len *= (device->UpdateSize + min_len/2)/min_len; @@ -1114,18 +1135,18 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) } -static ALCboolean ALCmmdevPlayback_start(ALCmmdevPlayback *self) +static ALCboolean ALCwasapiPlayback_start(ALCwasapiPlayback *self) { ThreadRequest req = { self->MsgEvent, 0 }; HRESULT hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; } -static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self) +static HRESULT ALCwasapiPlayback_startProxy(ALCwasapiPlayback *self) { HRESULT hr; void *ptr; @@ -1140,8 +1161,8 @@ static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self) if(SUCCEEDED(hr)) { self->render = ptr; - self->killNow = 0; - if(althrd_create(&self->thread, ALCmmdevPlayback_mixerProc, self) != althrd_success) + ATOMIC_STORE(&self->killNow, 0, almemory_order_release); + if(althrd_create(&self->thread, ALCwasapiPlayback_mixerProc, self) != althrd_success) { if(self->render) IAudioRenderClient_Release(self->render); @@ -1156,21 +1177,21 @@ static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self) } -static void ALCmmdevPlayback_stop(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_stop(ALCwasapiPlayback *self) { ThreadRequest req = { self->MsgEvent, 0 }; - if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) (void)WaitForResponse(&req); } -static void ALCmmdevPlayback_stopProxy(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_stopProxy(ALCwasapiPlayback *self) { int res; if(!self->render) return; - self->killNow = 1; + ATOMIC_STORE_SEQ(&self->killNow, 1); althrd_join(self->thread, &res); IAudioRenderClient_Release(self->render); @@ -1179,23 +1200,24 @@ static void ALCmmdevPlayback_stopProxy(ALCmmdevPlayback *self) } -static ClockLatency ALCmmdevPlayback_getClockLatency(ALCmmdevPlayback *self) +static ClockLatency ALCwasapiPlayback_getClockLatency(ALCwasapiPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; ClockLatency ret; - ALCmmdevPlayback_lock(self); + ALCwasapiPlayback_lock(self); ret.ClockTime = GetDeviceClockTime(device); - ret.Latency = self->Padding * DEVICE_CLOCK_RES / device->Frequency; - ALCmmdevPlayback_unlock(self); + ret.Latency = ATOMIC_LOAD(&self->Padding, almemory_order_relaxed) * DEVICE_CLOCK_RES / + device->Frequency; + ALCwasapiPlayback_unlock(self); return ret; } -typedef struct ALCmmdevCapture { +typedef struct ALCwasapiCapture { DERIVE_FROM_TYPE(ALCbackend); - DERIVE_FROM_TYPE(ALCmmdevProxy); + DERIVE_FROM_TYPE(ALCwasapiProxy); WCHAR *devid; @@ -1206,43 +1228,44 @@ typedef struct ALCmmdevCapture { HANDLE MsgEvent; + ChannelConverter *ChannelConv; + SampleConverter *SampleConv; ll_ringbuffer_t *Ring; - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; -} ALCmmdevCapture; +} ALCwasapiCapture; -static int ALCmmdevCapture_recordProc(void *arg); +static int ALCwasapiCapture_recordProc(void *arg); -static void ALCmmdevCapture_Construct(ALCmmdevCapture *self, ALCdevice *device); -static void ALCmmdevCapture_Destruct(ALCmmdevCapture *self); -static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *name); -static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self); -static void ALCmmdevCapture_close(ALCmmdevCapture *self); -static void ALCmmdevCapture_closeProxy(ALCmmdevCapture *self); -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, ALCboolean, reset) -static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self); -static ALCboolean ALCmmdevCapture_start(ALCmmdevCapture *self); -static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self); -static void ALCmmdevCapture_stop(ALCmmdevCapture *self); -static void ALCmmdevCapture_stopProxy(ALCmmdevCapture *self); -static ALCenum ALCmmdevCapture_captureSamples(ALCmmdevCapture *self, ALCvoid *buffer, ALCuint samples); -static ALuint ALCmmdevCapture_availableSamples(ALCmmdevCapture *self); -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, ClockLatency, getClockLatency) -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, void, lock) -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(ALCmmdevCapture) +static void ALCwasapiCapture_Construct(ALCwasapiCapture *self, ALCdevice *device); +static void ALCwasapiCapture_Destruct(ALCwasapiCapture *self); +static ALCenum ALCwasapiCapture_open(ALCwasapiCapture *self, const ALCchar *name); +static HRESULT ALCwasapiCapture_openProxy(ALCwasapiCapture *self); +static void ALCwasapiCapture_closeProxy(ALCwasapiCapture *self); +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, ALCboolean, reset) +static HRESULT ALCwasapiCapture_resetProxy(ALCwasapiCapture *self); +static ALCboolean ALCwasapiCapture_start(ALCwasapiCapture *self); +static HRESULT ALCwasapiCapture_startProxy(ALCwasapiCapture *self); +static void ALCwasapiCapture_stop(ALCwasapiCapture *self); +static void ALCwasapiCapture_stopProxy(ALCwasapiCapture *self); +static ALCenum ALCwasapiCapture_captureSamples(ALCwasapiCapture *self, ALCvoid *buffer, ALCuint samples); +static ALuint ALCwasapiCapture_availableSamples(ALCwasapiCapture *self); +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCwasapiCapture) -DEFINE_ALCMMDEVPROXY_VTABLE(ALCmmdevCapture); -DEFINE_ALCBACKEND_VTABLE(ALCmmdevCapture); +DEFINE_ALCWASAPIPROXY_VTABLE(ALCwasapiCapture); +DEFINE_ALCBACKEND_VTABLE(ALCwasapiCapture); -static void ALCmmdevCapture_Construct(ALCmmdevCapture *self, ALCdevice *device) +static void ALCwasapiCapture_Construct(ALCwasapiCapture *self, ALCdevice *device) { - SET_VTABLE2(ALCmmdevCapture, ALCbackend, self); - SET_VTABLE2(ALCmmdevCapture, ALCmmdevProxy, self); + SET_VTABLE2(ALCwasapiCapture, ALCbackend, self); + SET_VTABLE2(ALCwasapiCapture, ALCwasapiProxy, self); ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - ALCmmdevProxy_Construct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Construct(STATIC_CAST(ALCwasapiProxy, self)); self->devid = NULL; @@ -1253,50 +1276,64 @@ static void ALCmmdevCapture_Construct(ALCmmdevCapture *self, ALCdevice *device) self->MsgEvent = NULL; + self->ChannelConv = NULL; + self->SampleConv = NULL; self->Ring = NULL; - self->killNow = 0; + ATOMIC_INIT(&self->killNow, 0); } -static void ALCmmdevCapture_Destruct(ALCmmdevCapture *self) +static void ALCwasapiCapture_Destruct(ALCwasapiCapture *self) { - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; + if(self->MsgEvent) + { + ThreadRequest req = { self->MsgEvent, 0 }; + if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) + (void)WaitForResponse(&req); + + CloseHandle(self->MsgEvent); + self->MsgEvent = NULL; + } if(self->NotifyEvent != NULL) CloseHandle(self->NotifyEvent); self->NotifyEvent = NULL; - if(self->MsgEvent != NULL) - CloseHandle(self->MsgEvent); - self->MsgEvent = NULL; + + ll_ringbuffer_free(self->Ring); + self->Ring = NULL; + + DestroySampleConverter(&self->SampleConv); + DestroyChannelConverter(&self->ChannelConv); free(self->devid); self->devid = NULL; - ALCmmdevProxy_Destruct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Destruct(STATIC_CAST(ALCwasapiProxy, self)); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -FORCE_ALIGN int ALCmmdevCapture_recordProc(void *arg) +FORCE_ALIGN int ALCwasapiCapture_recordProc(void *arg) { - ALCmmdevCapture *self = arg; + ALCwasapiCapture *self = arg; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + ALfloat *samples = NULL; + size_t samplesmax = 0; HRESULT hr; - hr = CoInitialize(NULL); + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(hr)) { - ERR("CoInitialize(NULL) failed: 0x%08lx\n", hr); + ERR("CoInitializeEx(NULL, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "COM init failed: 0x%08lx", hr); V0(device->Backend,unlock)(); return 1; } althrd_setname(althrd_current(), RECORD_THREAD_NAME); - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_relaxed)) { UINT32 avail; DWORD res; @@ -1304,39 +1341,81 @@ FORCE_ALIGN int ALCmmdevCapture_recordProc(void *arg) hr = IAudioCaptureClient_GetNextPacketSize(self->capture, &avail); if(FAILED(hr)) ERR("Failed to get next packet size: 0x%08lx\n", hr); - else while(avail > 0 && SUCCEEDED(hr)) + else if(avail > 0) { UINT32 numsamples; DWORD flags; - BYTE *data; + BYTE *rdata; hr = IAudioCaptureClient_GetBuffer(self->capture, - &data, &numsamples, &flags, NULL, NULL + &rdata, &numsamples, &flags, NULL, NULL ); if(FAILED(hr)) - { ERR("Failed to get capture buffer: 0x%08lx\n", hr); - break; - } - - ll_ringbuffer_write(self->Ring, (char*)data, numsamples); - - hr = IAudioCaptureClient_ReleaseBuffer(self->capture, numsamples); - if(FAILED(hr)) + else { - ERR("Failed to release capture buffer: 0x%08lx\n", hr); - break; - } + ll_ringbuffer_data_t data[2]; + size_t dstframes = 0; - hr = IAudioCaptureClient_GetNextPacketSize(self->capture, &avail); - if(FAILED(hr)) - ERR("Failed to get next packet size: 0x%08lx\n", hr); + if(self->ChannelConv) + { + if(samplesmax < numsamples) + { + size_t newmax = RoundUp(numsamples, 4096); + ALfloat *tmp = al_calloc(DEF_ALIGN, newmax*2*sizeof(ALfloat)); + al_free(samples); + samples = tmp; + samplesmax = newmax; + } + ChannelConverterInput(self->ChannelConv, rdata, samples, numsamples); + rdata = (BYTE*)samples; + } + + ll_ringbuffer_get_write_vector(self->Ring, data); + + if(self->SampleConv) + { + const ALvoid *srcdata = rdata; + ALsizei srcframes = numsamples; + + dstframes = SampleConverterInput(self->SampleConv, + &srcdata, &srcframes, data[0].buf, (ALsizei)minz(data[0].len, INT_MAX) + ); + if(srcframes > 0 && dstframes == data[0].len && data[1].len > 0) + { + /* If some source samples remain, all of the first dest + * block was filled, and there's space in the second + * dest block, do another run for the second block. + */ + dstframes += SampleConverterInput(self->SampleConv, + &srcdata, &srcframes, data[1].buf, (ALsizei)minz(data[1].len, INT_MAX) + ); + } + } + else + { + ALuint framesize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, + device->AmbiOrder); + size_t len1 = minz(data[0].len, numsamples); + size_t len2 = minz(data[1].len, numsamples-len1); + + memcpy(data[0].buf, rdata, len1*framesize); + if(len2 > 0) + memcpy(data[1].buf, rdata+len1*framesize, len2*framesize); + dstframes = len1 + len2; + } + + ll_ringbuffer_write_advance(self->Ring, dstframes); + + hr = IAudioCaptureClient_ReleaseBuffer(self->capture, numsamples); + if(FAILED(hr)) ERR("Failed to release capture buffer: 0x%08lx\n", hr); + } } if(FAILED(hr)) { V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to capture samples: 0x%08lx", hr); V0(device->Backend,unlock)(); break; } @@ -1346,12 +1425,16 @@ FORCE_ALIGN int ALCmmdevCapture_recordProc(void *arg) ERR("WaitForSingleObjectEx error: 0x%lx\n", res); } + al_free(samples); + samples = NULL; + samplesmax = 0; + CoUninitialize(); return 0; } -static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *deviceName) +static ALCenum ALCwasapiCapture_open(ALCwasapiCapture *self, const ALCchar *deviceName) { HRESULT hr = S_OK; @@ -1377,8 +1460,8 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device } hr = E_FAIL; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0 || \ - al_string_cmp_cstr((i)->endpoint_guid, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0 || \ + alstr_cmp_cstr((i)->endpoint_guid, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) @@ -1400,7 +1483,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; self->devid = strdupW(iter->devid); - al_string_copy(&device->DeviceName, iter->name); + alstr_copy(&device->DeviceName, iter->name); hr = S_OK; } } @@ -1411,7 +1494,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device ThreadRequest req = { self->MsgEvent, 0 }; hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); else ERR("Failed to post thread message: %lu\n", GetLastError()); @@ -1437,14 +1520,13 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device ThreadRequest req = { self->MsgEvent, 0 }; hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); else ERR("Failed to post thread message: %lu\n", GetLastError()); if(FAILED(hr)) { - ALCmmdevCapture_close(self); if(hr == E_OUTOFMEMORY) return ALC_OUT_OF_MEMORY; return ALC_INVALID_VALUE; @@ -1454,7 +1536,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device return ALC_NO_ERROR; } -static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self) +static HRESULT ALCwasapiCapture_openProxy(ALCwasapiCapture *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; void *ptr; @@ -1476,7 +1558,7 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self) if(SUCCEEDED(hr)) { self->client = ptr; - if(al_string_empty(device->DeviceName)) + if(alstr_empty(device->DeviceName)) get_device_name_and_guid(self->mmdev, &device->DeviceName, NULL); } @@ -1491,27 +1573,7 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self) } -static void ALCmmdevCapture_close(ALCmmdevCapture *self) -{ - ThreadRequest req = { self->MsgEvent, 0 }; - - if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) - (void)WaitForResponse(&req); - - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; - - CloseHandle(self->MsgEvent); - self->MsgEvent = NULL; - - CloseHandle(self->NotifyEvent); - self->NotifyEvent = NULL; - - free(self->devid); - self->devid = NULL; -} - -static void ALCmmdevCapture_closeProxy(ALCmmdevCapture *self) +static void ALCwasapiCapture_closeProxy(ALCwasapiCapture *self) { if(self->client) IAudioClient_Release(self->client); @@ -1523,11 +1585,12 @@ static void ALCmmdevCapture_closeProxy(ALCmmdevCapture *self) } -static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) +static HRESULT ALCwasapiCapture_resetProxy(ALCwasapiCapture *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; WAVEFORMATEXTENSIBLE OutputType; WAVEFORMATEX *wfx = NULL; + enum DevFmtType srcType; REFERENCE_TIME buf_time; UINT32 buffer_len; void *ptr = NULL; @@ -1545,8 +1608,12 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) } self->client = ptr; - buf_time = ((REFERENCE_TIME)device->UpdateSize*device->NumUpdates*10000000 + - device->Frequency-1) / device->Frequency; + buf_time = ScaleCeil(device->UpdateSize*device->NumUpdates, REFTIME_PER_SEC, + device->Frequency); + // Make sure buffer is at least 100ms in size + buf_time = maxu64(buf_time, REFTIME_PER_SEC/10); + device->UpdateSize = (ALuint)ScaleCeil(buf_time, device->Frequency, REFTIME_PER_SEC) / + device->NumUpdates; OutputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; switch(device->FmtChans) @@ -1580,40 +1647,33 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) OutputType.dwChannelMask = X7DOT1; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: return E_FAIL; } switch(device->FmtType) { + /* NOTE: Signedness doesn't matter, the converter will handle it. */ + case DevFmtByte: case DevFmtUByte: OutputType.Format.wBitsPerSample = 8; - OutputType.Samples.wValidBitsPerSample = 8; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; break; case DevFmtShort: + case DevFmtUShort: OutputType.Format.wBitsPerSample = 16; - OutputType.Samples.wValidBitsPerSample = 16; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; break; case DevFmtInt: + case DevFmtUInt: OutputType.Format.wBitsPerSample = 32; - OutputType.Samples.wValidBitsPerSample = 32; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; break; case DevFmtFloat: OutputType.Format.wBitsPerSample = 32; - OutputType.Samples.wValidBitsPerSample = 32; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; break; - - case DevFmtByte: - case DevFmtUShort: - case DevFmtUInt: - WARN("%s capture samples not supported\n", DevFmtTypeString(device->FmtType)); - return E_FAIL; } + OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample; OutputType.Format.nSamplesPerSec = device->Frequency; OutputType.Format.nBlockAlign = OutputType.Format.nChannels * @@ -1631,27 +1691,107 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) return hr; } - /* FIXME: We should do conversion/resampling if we didn't get a matching format. */ - if(wfx->nSamplesPerSec != OutputType.Format.nSamplesPerSec || - wfx->wBitsPerSample != OutputType.Format.wBitsPerSample || - wfx->nChannels != OutputType.Format.nChannels || - wfx->nBlockAlign != OutputType.Format.nBlockAlign) + DestroySampleConverter(&self->SampleConv); + DestroyChannelConverter(&self->ChannelConv); + + if(wfx != NULL) { - ERR("Failed to get matching format, wanted: %s %s %uhz, got: %d channel%s %d-bit %luhz\n", - DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), - device->Frequency, wfx->nChannels, (wfx->nChannels==1)?"":"s", wfx->wBitsPerSample, - wfx->nSamplesPerSec); + if(!(wfx->nChannels == OutputType.Format.nChannels || + (wfx->nChannels == 1 && OutputType.Format.nChannels == 2) || + (wfx->nChannels == 2 && OutputType.Format.nChannels == 1))) + { + ERR("Failed to get matching format, wanted: %s %s %uhz, got: %d channel%s %d-bit %luhz\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, wfx->nChannels, (wfx->nChannels==1)?"":"s", wfx->wBitsPerSample, + wfx->nSamplesPerSec); + CoTaskMemFree(wfx); + return E_FAIL; + } + + if(!MakeExtensible(&OutputType, wfx)) + { + CoTaskMemFree(wfx); + return E_FAIL; + } CoTaskMemFree(wfx); + wfx = NULL; + } + + if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)) + { + if(OutputType.Format.wBitsPerSample == 8) + srcType = DevFmtUByte; + else if(OutputType.Format.wBitsPerSample == 16) + srcType = DevFmtShort; + else if(OutputType.Format.wBitsPerSample == 32) + srcType = DevFmtInt; + else + { + ERR("Unhandled integer bit depth: %d\n", OutputType.Format.wBitsPerSample); + return E_FAIL; + } + } + else if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)) + { + if(OutputType.Format.wBitsPerSample == 32) + srcType = DevFmtFloat; + else + { + ERR("Unhandled float bit depth: %d\n", OutputType.Format.wBitsPerSample); + return E_FAIL; + } + } + else + { + ERR("Unhandled format sub-type\n"); return E_FAIL; } - if(!MakeExtensible(&OutputType, wfx)) + if(device->FmtChans == DevFmtMono && OutputType.Format.nChannels == 2) { - CoTaskMemFree(wfx); - return E_FAIL; + self->ChannelConv = CreateChannelConverter(srcType, DevFmtStereo, + device->FmtChans); + if(!self->ChannelConv) + { + ERR("Failed to create %s stereo-to-mono converter\n", DevFmtTypeString(srcType)); + return E_FAIL; + } + TRACE("Created %s stereo-to-mono converter\n", DevFmtTypeString(srcType)); + /* The channel converter always outputs float, so change the input type + * for the resampler/type-converter. + */ + srcType = DevFmtFloat; + } + else if(device->FmtChans == DevFmtStereo && OutputType.Format.nChannels == 1) + { + self->ChannelConv = CreateChannelConverter(srcType, DevFmtMono, + device->FmtChans); + if(!self->ChannelConv) + { + ERR("Failed to create %s mono-to-stereo converter\n", DevFmtTypeString(srcType)); + return E_FAIL; + } + TRACE("Created %s mono-to-stereo converter\n", DevFmtTypeString(srcType)); + srcType = DevFmtFloat; + } + + if(device->Frequency != OutputType.Format.nSamplesPerSec || device->FmtType != srcType) + { + self->SampleConv = CreateSampleConverter( + srcType, device->FmtType, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder), + OutputType.Format.nSamplesPerSec, device->Frequency + ); + if(!self->SampleConv) + { + ERR("Failed to create converter for %s format, dst: %s %uhz, src: %s %luhz\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, DevFmtTypeString(srcType), OutputType.Format.nSamplesPerSec); + return E_FAIL; + } + TRACE("Created converter for %s format, dst: %s %uhz, src: %s %luhz\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, DevFmtTypeString(srcType), OutputType.Format.nSamplesPerSec); } - CoTaskMemFree(wfx); - wfx = NULL; hr = IAudioClient_Initialize(self->client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, @@ -1670,9 +1810,12 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) return hr; } - buffer_len = maxu(device->UpdateSize*device->NumUpdates + 1, buffer_len); + buffer_len = maxu(device->UpdateSize*device->NumUpdates, buffer_len); ll_ringbuffer_free(self->Ring); - self->Ring = ll_ringbuffer_create(buffer_len, OutputType.Format.nBlockAlign); + self->Ring = ll_ringbuffer_create(buffer_len, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + false + ); if(!self->Ring) { ERR("Failed to allocate capture ring buffer\n"); @@ -1690,18 +1833,18 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) } -static ALCboolean ALCmmdevCapture_start(ALCmmdevCapture *self) +static ALCboolean ALCwasapiCapture_start(ALCwasapiCapture *self) { ThreadRequest req = { self->MsgEvent, 0 }; HRESULT hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; } -static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self) +static HRESULT ALCwasapiCapture_startProxy(ALCwasapiCapture *self) { HRESULT hr; void *ptr; @@ -1718,8 +1861,8 @@ static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self) if(SUCCEEDED(hr)) { self->capture = ptr; - self->killNow = 0; - if(althrd_create(&self->thread, ALCmmdevCapture_recordProc, self) != althrd_success) + ATOMIC_STORE(&self->killNow, 0, almemory_order_release); + if(althrd_create(&self->thread, ALCwasapiCapture_recordProc, self) != althrd_success) { ERR("Failed to start thread\n"); IAudioCaptureClient_Release(self->capture); @@ -1738,21 +1881,21 @@ static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self) } -static void ALCmmdevCapture_stop(ALCmmdevCapture *self) +static void ALCwasapiCapture_stop(ALCwasapiCapture *self) { ThreadRequest req = { self->MsgEvent, 0 }; - if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) (void)WaitForResponse(&req); } -static void ALCmmdevCapture_stopProxy(ALCmmdevCapture *self) +static void ALCwasapiCapture_stopProxy(ALCwasapiCapture *self) { int res; if(!self->capture) return; - self->killNow = 1; + ATOMIC_STORE_SEQ(&self->killNow, 1); althrd_join(self->thread, &res); IAudioCaptureClient_Release(self->capture); @@ -1762,14 +1905,14 @@ static void ALCmmdevCapture_stopProxy(ALCmmdevCapture *self) } -ALuint ALCmmdevCapture_availableSamples(ALCmmdevCapture *self) +ALuint ALCwasapiCapture_availableSamples(ALCwasapiCapture *self) { return (ALuint)ll_ringbuffer_read_space(self->Ring); } -ALCenum ALCmmdevCapture_captureSamples(ALCmmdevCapture *self, ALCvoid *buffer, ALCuint samples) +ALCenum ALCwasapiCapture_captureSamples(ALCwasapiCapture *self, ALCvoid *buffer, ALCuint samples) { - if(ALCmmdevCapture_availableSamples(self) < samples) + if(ALCwasapiCapture_availableSamples(self) < samples) return ALC_INVALID_VALUE; ll_ringbuffer_read(self->Ring, buffer, samples); return ALC_NO_ERROR; @@ -1777,27 +1920,31 @@ ALCenum ALCmmdevCapture_captureSamples(ALCmmdevCapture *self, ALCvoid *buffer, A static inline void AppendAllDevicesList2(const DevMap *entry) -{ AppendAllDevicesList(al_string_get_cstr(entry->name)); } +{ AppendAllDevicesList(alstr_get_cstr(entry->name)); } static inline void AppendCaptureDeviceList2(const DevMap *entry) -{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); } +{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); } -typedef struct ALCmmdevBackendFactory { +typedef struct ALCwasapiBackendFactory { DERIVE_FROM_TYPE(ALCbackendFactory); -} ALCmmdevBackendFactory; -#define ALCMMDEVBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCmmdevBackendFactory, ALCbackendFactory) } } +} ALCwasapiBackendFactory; +#define ALCWASAPIBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCwasapiBackendFactory, ALCbackendFactory) } } -static ALCboolean ALCmmdevBackendFactory_init(ALCmmdevBackendFactory *self); -static void ALCmmdevBackendFactory_deinit(ALCmmdevBackendFactory *self); -static ALCboolean ALCmmdevBackendFactory_querySupport(ALCmmdevBackendFactory *self, ALCbackend_Type type); -static void ALCmmdevBackendFactory_probe(ALCmmdevBackendFactory *self, enum DevProbe type); -static ALCbackend* ALCmmdevBackendFactory_createBackend(ALCmmdevBackendFactory *self, ALCdevice *device, ALCbackend_Type type); +static ALCboolean ALCwasapiBackendFactory_init(ALCwasapiBackendFactory *self); +static void ALCwasapiBackendFactory_deinit(ALCwasapiBackendFactory *self); +static ALCboolean ALCwasapiBackendFactory_querySupport(ALCwasapiBackendFactory *self, ALCbackend_Type type); +static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory *self, enum DevProbe type); +static ALCbackend* ALCwasapiBackendFactory_createBackend(ALCwasapiBackendFactory *self, ALCdevice *device, ALCbackend_Type type); -DEFINE_ALCBACKENDFACTORY_VTABLE(ALCmmdevBackendFactory); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCwasapiBackendFactory); -static BOOL MMDevApiLoad(void) +static ALCboolean ALCwasapiBackendFactory_init(ALCwasapiBackendFactory* UNUSED(self)) { static HRESULT InitResult; + + VECTOR_INIT(PlaybackDevices); + VECTOR_INIT(CaptureDevices); + if(!ThreadHdl) { ThreadRequest req; @@ -1808,26 +1955,17 @@ static BOOL MMDevApiLoad(void) ERR("Failed to create event: %lu\n", GetLastError()); else { - ThreadHdl = CreateThread(NULL, 0, ALCmmdevProxy_messageHandler, &req, 0, &ThreadID); + ThreadHdl = CreateThread(NULL, 0, ALCwasapiProxy_messageHandler, &req, 0, &ThreadID); if(ThreadHdl != NULL) InitResult = WaitForResponse(&req); CloseHandle(req.FinishedEvt); } } - return SUCCEEDED(InitResult); + + return SUCCEEDED(InitResult) ? ALC_TRUE : ALC_FALSE; } -static ALCboolean ALCmmdevBackendFactory_init(ALCmmdevBackendFactory* UNUSED(self)) -{ - VECTOR_INIT(PlaybackDevices); - VECTOR_INIT(CaptureDevices); - - if(!MMDevApiLoad()) - return ALC_FALSE; - return ALC_TRUE; -} - -static void ALCmmdevBackendFactory_deinit(ALCmmdevBackendFactory* UNUSED(self)) +static void ALCwasapiBackendFactory_deinit(ALCwasapiBackendFactory* UNUSED(self)) { clear_devlist(&PlaybackDevices); VECTOR_DEINIT(PlaybackDevices); @@ -1844,19 +1982,14 @@ static void ALCmmdevBackendFactory_deinit(ALCmmdevBackendFactory* UNUSED(self)) } } -static ALCboolean ALCmmdevBackendFactory_querySupport(ALCmmdevBackendFactory* UNUSED(self), ALCbackend_Type type) +static ALCboolean ALCwasapiBackendFactory_querySupport(ALCwasapiBackendFactory* UNUSED(self), ALCbackend_Type type) { - /* TODO: Disable capture with mmdevapi for now, since it doesn't do any - * rechanneling or resampling; if the device is configured for 48000hz - * stereo input, for example, and the app asks for 22050hz mono, - * initialization will fail. - */ - if(type == ALCbackend_Playback /*|| type == ALCbackend_Capture*/) + if(type == ALCbackend_Playback || type == ALCbackend_Capture) return ALC_TRUE; return ALC_FALSE; } -static void ALCmmdevBackendFactory_probe(ALCmmdevBackendFactory* UNUSED(self), enum DevProbe type) +static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory* UNUSED(self), enum DevProbe type) { ThreadRequest req = { NULL, 0 }; @@ -1883,19 +2016,19 @@ static void ALCmmdevBackendFactory_probe(ALCmmdevBackendFactory* UNUSED(self), e } } -static ALCbackend* ALCmmdevBackendFactory_createBackend(ALCmmdevBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +static ALCbackend* ALCwasapiBackendFactory_createBackend(ALCwasapiBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) { if(type == ALCbackend_Playback) { - ALCmmdevPlayback *backend; - NEW_OBJ(backend, ALCmmdevPlayback)(device); + ALCwasapiPlayback *backend; + NEW_OBJ(backend, ALCwasapiPlayback)(device); if(!backend) return NULL; return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { - ALCmmdevCapture *backend; - NEW_OBJ(backend, ALCmmdevCapture)(device); + ALCwasapiCapture *backend; + NEW_OBJ(backend, ALCwasapiCapture)(device); if(!backend) return NULL; return STATIC_CAST(ALCbackend, backend); } @@ -1904,8 +2037,8 @@ static ALCbackend* ALCmmdevBackendFactory_createBackend(ALCmmdevBackendFactory* } -ALCbackendFactory *ALCmmdevBackendFactory_getFactory(void) +ALCbackendFactory *ALCwasapiBackendFactory_getFactory(void) { - static ALCmmdevBackendFactory factory = ALCMMDEVBACKENDFACTORY_INITIALIZER; + static ALCwasapiBackendFactory factory = ALCWASAPIBACKENDFACTORY_INITIALIZER; return STATIC_CAST(ALCbackendFactory, &factory); } diff --git a/Engine/lib/openal-soft/Alc/backends/wave.c b/Engine/lib/openal-soft/Alc/backends/wave.c index 9bf5a7274..557c2bf26 100644 --- a/Engine/lib/openal-soft/Alc/backends/wave.c +++ b/Engine/lib/openal-soft/Alc/backends/wave.c @@ -27,6 +27,7 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" #include "threads.h" #include "compat.h" @@ -76,16 +77,15 @@ typedef struct ALCwaveBackend { ALvoid *mBuffer; ALuint mSize; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCwaveBackend; static int ALCwaveBackend_mixerProc(void *ptr); static void ALCwaveBackend_Construct(ALCwaveBackend *self, ALCdevice *device); -static DECLARE_FORWARD(ALCwaveBackend, ALCbackend, void, Destruct) +static void ALCwaveBackend_Destruct(ALCwaveBackend *self); static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name); -static void ALCwaveBackend_close(ALCwaveBackend *self); static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self); static ALCboolean ALCwaveBackend_start(ALCwaveBackend *self); static void ALCwaveBackend_stop(ALCwaveBackend *self); @@ -110,9 +110,17 @@ static void ALCwaveBackend_Construct(ALCwaveBackend *self, ALCdevice *device) self->mBuffer = NULL; self->mSize = 0; - self->killNow = 1; + ATOMIC_INIT(&self->killNow, AL_TRUE); } +static void ALCwaveBackend_Destruct(ALCwaveBackend *self) +{ + if(self->mFile) + fclose(self->mFile); + self->mFile = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} static int ALCwaveBackend_mixerProc(void *ptr) { @@ -127,7 +135,7 @@ static int ALCwaveBackend_mixerProc(void *ptr) althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); done = 0; if(altimespec_get(&start, AL_TIME_UTC) != AL_TIME_UTC) @@ -135,7 +143,8 @@ static int ALCwaveBackend_mixerProc(void *ptr) ERR("Failed to get starting time\n"); return 1; } - while(!self->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { if(altimespec_get(&now, AL_TIME_UTC) != AL_TIME_UTC) { @@ -157,7 +166,9 @@ static int ALCwaveBackend_mixerProc(void *ptr) al_nssleep(restTime); else while(avail-done >= device->UpdateSize) { + ALCwaveBackend_lock(self); aluMixData(device, self->mBuffer, device->UpdateSize); + ALCwaveBackend_unlock(self); done += device->UpdateSize; if(!IS_LITTLE_ENDIAN) @@ -194,7 +205,7 @@ static int ALCwaveBackend_mixerProc(void *ptr) { ERR("Error writing to file\n"); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to write playback samples"); ALCdevice_Unlock(device); break; } @@ -226,18 +237,11 @@ static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name) } device = STATIC_CAST(ALCbackend, self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCwaveBackend_close(ALCwaveBackend *self) -{ - if(self->mFile) - fclose(self->mFile); - self->mFile = NULL; -} - static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -249,7 +253,10 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) clearerr(self->mFile); if(GetConfigValueBool(NULL, "wave", "bformat", 0)) - device->FmtChans = DevFmtAmbi1; + { + device->FmtChans = DevFmtAmbi3D; + device->AmbiOrder = 1; + } switch(device->FmtType) { @@ -277,24 +284,23 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) case DevFmtX51Rear: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020; break; case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break; case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: /* .amb output requires FuMa */ - device->AmbiFmt = AmbiFormat_FuMa; + device->AmbiLayout = AmbiLayout_FuMa; + device->AmbiScale = AmbiNorm_FuMa; isbformat = 1; chanmask = 0; break; } bits = BytesFromDevFmt(device->FmtType) * 8; - channels = ChannelsFromDevFmt(device->FmtChans); + channels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); - fprintf(self->mFile, "RIFF"); + fputs("RIFF", self->mFile); fwrite32le(0xFFFFFFFF, self->mFile); // 'RIFF' header len; filled in at close - fprintf(self->mFile, "WAVE"); + fputs("WAVE", self->mFile); - fprintf(self->mFile, "fmt "); + fputs("fmt ", self->mFile); fwrite32le(40, self->mFile); // 'fmt ' header len; 40 bytes for EXTENSIBLE // 16-bit val, format type id (extensible: 0xFFFE) @@ -316,11 +322,12 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) // 32-bit val, channel mask fwrite32le(chanmask, self->mFile); // 16 byte GUID, sub-type format - val = fwrite(((bits==32) ? (isbformat ? SUBTYPE_BFORMAT_FLOAT : SUBTYPE_FLOAT) : - (isbformat ? SUBTYPE_BFORMAT_PCM : SUBTYPE_PCM)), 1, 16, self->mFile); + val = fwrite((device->FmtType == DevFmtFloat) ? + (isbformat ? SUBTYPE_BFORMAT_FLOAT : SUBTYPE_FLOAT) : + (isbformat ? SUBTYPE_BFORMAT_PCM : SUBTYPE_PCM), 1, 16, self->mFile); (void)val; - fprintf(self->mFile, "data"); + fputs("data", self->mFile); fwrite32le(0xFFFFFFFF, self->mFile); // 'data' header len; filled in at close if(ferror(self->mFile)) @@ -339,7 +346,9 @@ static ALCboolean ALCwaveBackend_start(ALCwaveBackend *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->mSize = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->mSize = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); self->mBuffer = malloc(self->mSize); if(!self->mBuffer) { @@ -347,7 +356,7 @@ static ALCboolean ALCwaveBackend_start(ALCwaveBackend *self) return ALC_FALSE; } - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCwaveBackend_mixerProc, self) != althrd_success) { free(self->mBuffer); @@ -365,10 +374,8 @@ static void ALCwaveBackend_stop(ALCwaveBackend *self) long size; int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); free(self->mBuffer); diff --git a/Engine/lib/openal-soft/Alc/backends/winmm.c b/Engine/lib/openal-soft/Alc/backends/winmm.c index 9d8f8e9d8..2f4c65dff 100644 --- a/Engine/lib/openal-soft/Alc/backends/winmm.c +++ b/Engine/lib/openal-soft/Alc/backends/winmm.c @@ -29,6 +29,7 @@ #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" #include "backends/base.h" @@ -45,7 +46,7 @@ static vector_al_string CaptureDevices; static void clear_devlist(vector_al_string *list) { - VECTOR_FOR_EACH(al_string, *list, al_string_deinit); + VECTOR_FOR_EACH(al_string, *list, alstr_reset); VECTOR_RESIZE(*list, 0, 0); } @@ -71,23 +72,23 @@ static void ProbePlaybackDevices(void) ALuint count = 0; while(1) { - al_string_copy_cstr(&dname, DEVNAME_HEAD); - al_string_append_wcstr(&dname, WaveCaps.szPname); + alstr_copy_cstr(&dname, DEVNAME_HEAD); + alstr_append_wcstr(&dname, WaveCaps.szPname); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&dname, str); + alstr_append_cstr(&dname, str); } count++; -#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(dname, *(i)) == 0) VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_ENTRY); if(iter == VECTOR_END(PlaybackDevices)) break; #undef MATCH_ENTRY } - TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i); + TRACE("Got device \"%s\", ID %u\n", alstr_get_cstr(dname), i); } VECTOR_PUSH_BACK(PlaybackDevices, dname); } @@ -114,23 +115,23 @@ static void ProbeCaptureDevices(void) ALuint count = 0; while(1) { - al_string_copy_cstr(&dname, DEVNAME_HEAD); - al_string_append_wcstr(&dname, WaveCaps.szPname); + alstr_copy_cstr(&dname, DEVNAME_HEAD); + alstr_append_wcstr(&dname, WaveCaps.szPname); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&dname, str); + alstr_append_cstr(&dname, str); } count++; -#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(dname, *(i)) == 0) VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_ENTRY); if(iter == VECTOR_END(CaptureDevices)) break; #undef MATCH_ENTRY } - TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i); + TRACE("Got device \"%s\", ID %u\n", alstr_get_cstr(dname), i); } VECTOR_PUSH_BACK(CaptureDevices, dname); } @@ -147,7 +148,7 @@ typedef struct ALCwinmmPlayback { WAVEFORMATEX Format; - volatile ALboolean killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCwinmmPlayback; @@ -158,7 +159,6 @@ static void CALLBACK ALCwinmmPlayback_waveOutProc(HWAVEOUT device, UINT msg, DWO static int ALCwinmmPlayback_mixerProc(void *arg); static ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *name); -static void ALCwinmmPlayback_close(ALCwinmmPlayback *self); static ALCboolean ALCwinmmPlayback_reset(ALCwinmmPlayback *self); static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self); static void ALCwinmmPlayback_stop(ALCwinmmPlayback *self); @@ -180,7 +180,7 @@ static void ALCwinmmPlayback_Construct(ALCwinmmPlayback *self, ALCdevice *device InitRef(&self->WaveBuffersCommitted, 0); self->OutHdl = NULL; - self->killNow = AL_TRUE; + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCwinmmPlayback_Destruct(ALCwinmmPlayback *self) @@ -224,7 +224,7 @@ FORCE_ALIGN static int ALCwinmmPlayback_mixerProc(void *arg) if(msg.message != WOM_DONE) continue; - if(self->killNow) + if(ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { if(ReadRef(&self->WaveBuffersCommitted) == 0) break; @@ -232,8 +232,10 @@ FORCE_ALIGN static int ALCwinmmPlayback_mixerProc(void *arg) } WaveHdr = ((WAVEHDR*)msg.lParam); + ALCwinmmPlayback_lock(self); aluMixData(device, WaveHdr->lpData, WaveHdr->dwBufferLength / self->Format.nBlockAlign); + ALCwinmmPlayback_unlock(self); // Send buffer back to play more data waveOutWrite(self->OutHdl, WaveHdr, sizeof(WAVEHDR)); @@ -255,8 +257,8 @@ static ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *devi ProbePlaybackDevices(); // Find the Device ID matching the deviceName if valid -#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && \ - (!deviceName || al_string_cmp_cstr(*(iter), deviceName) == 0)) +#define MATCH_DEVNAME(iter) (!alstr_empty(*(iter)) && \ + (!deviceName || alstr_cmp_cstr(*(iter), deviceName) == 0)) VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_DEVNAME); if(iter == VECTOR_END(PlaybackDevices)) return ALC_INVALID_VALUE; @@ -298,7 +300,7 @@ retry_open: goto failure; } - al_string_copy(&device->DeviceName, VECTOR_ELEM(PlaybackDevices, DeviceID)); + alstr_copy(&device->DeviceName, VECTOR_ELEM(PlaybackDevices, DeviceID)); return ALC_NO_ERROR; failure: @@ -309,9 +311,6 @@ failure: return ALC_INVALID_VALUE; } -static void ALCwinmmPlayback_close(ALCwinmmPlayback* UNUSED(self)) -{ } - static ALCboolean ALCwinmmPlayback_reset(ALCwinmmPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -372,7 +371,7 @@ static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self) ALint BufferSize; ALuint i; - self->killNow = AL_FALSE; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCwinmmPlayback_mixerProc, self) != althrd_success) return ALC_FALSE; @@ -380,7 +379,7 @@ static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self) // Create 4 Buffers BufferSize = device->UpdateSize*device->NumUpdates / 4; - BufferSize *= FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + BufferSize *= FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); BufferData = calloc(4, BufferSize); for(i = 0;i < 4;i++) @@ -403,11 +402,8 @@ static void ALCwinmmPlayback_stop(ALCwinmmPlayback *self) void *buffer = NULL; int i; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - // Set flag to stop processing headers - self->killNow = AL_TRUE; althrd_join(self->thread, &i); // Release the wave buffers @@ -434,7 +430,7 @@ typedef struct ALCwinmmCapture { WAVEFORMATEX Format; - volatile ALboolean killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCwinmmCapture; @@ -445,7 +441,6 @@ static void CALLBACK ALCwinmmCapture_waveInProc(HWAVEIN device, UINT msg, DWORD_ static int ALCwinmmCapture_captureProc(void *arg); static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name); -static void ALCwinmmCapture_close(ALCwinmmCapture *self); static DECLARE_FORWARD(ALCwinmmCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCwinmmCapture_start(ALCwinmmCapture *self); static void ALCwinmmCapture_stop(ALCwinmmCapture *self); @@ -467,11 +462,38 @@ static void ALCwinmmCapture_Construct(ALCwinmmCapture *self, ALCdevice *device) InitRef(&self->WaveBuffersCommitted, 0); self->InHdl = NULL; - self->killNow = AL_TRUE; + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCwinmmCapture_Destruct(ALCwinmmCapture *self) { + void *buffer = NULL; + int i; + + /* Tell the processing thread to quit and wait for it to do so. */ + if(!ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) + { + PostThreadMessage(self->thread, WM_QUIT, 0, 0); + + althrd_join(self->thread, &i); + + /* Make sure capture is stopped and all pending buffers are flushed. */ + waveInReset(self->InHdl); + + // Release the wave buffers + for(i = 0;i < 4;i++) + { + waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); + if(i == 0) buffer = self->WaveBuffer[i].lpData; + self->WaveBuffer[i].lpData = NULL; + } + free(buffer); + } + + ll_ringbuffer_free(self->Ring); + self->Ring = NULL; + + // Close the Wave device if(self->InHdl) waveInClose(self->InHdl); self->InHdl = 0; @@ -510,7 +532,7 @@ static int ALCwinmmCapture_captureProc(void *arg) continue; /* Don't wait for other buffers to finish before quitting. We're * closing so we don't need them. */ - if(self->killNow) + if(ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) break; WaveHdr = ((WAVEHDR*)msg.lParam); @@ -542,7 +564,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) ProbeCaptureDevices(); // Find the Device ID matching the deviceName if valid -#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && (!name || al_string_cmp_cstr(*iter, name) == 0)) +#define MATCH_DEVNAME(iter) (!alstr_empty(*(iter)) && (!name || alstr_cmp_cstr(*iter, name) == 0)) VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_DEVNAME); if(iter == VECTOR_END(CaptureDevices)) return ALC_INVALID_VALUE; @@ -561,9 +583,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) case DevFmtX51Rear: case DevFmtX61: case DevFmtX71: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: return ALC_INVALID_ENUM; } @@ -584,7 +604,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) memset(&self->Format, 0, sizeof(WAVEFORMATEX)); self->Format.wFormatTag = ((device->FmtType == DevFmtFloat) ? WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM); - self->Format.nChannels = ChannelsFromDevFmt(device->FmtChans); + self->Format.nChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); self->Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; self->Format.nBlockAlign = self->Format.wBitsPerSample * self->Format.nChannels / 8; @@ -606,7 +626,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) if(CapturedDataSize < (self->Format.nSamplesPerSec / 10)) CapturedDataSize = self->Format.nSamplesPerSec / 10; - self->Ring = ll_ringbuffer_create(CapturedDataSize+1, self->Format.nBlockAlign); + self->Ring = ll_ringbuffer_create(CapturedDataSize, self->Format.nBlockAlign, false); if(!self->Ring) goto failure; InitRef(&self->WaveBuffersCommitted, 0); @@ -632,11 +652,11 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) IncrementRef(&self->WaveBuffersCommitted); } - self->killNow = AL_FALSE; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCwinmmCapture_captureProc, self) != althrd_success) goto failure; - al_string_copy(&device->DeviceName, VECTOR_ELEM(CaptureDevices, DeviceID)); + alstr_copy(&device->DeviceName, VECTOR_ELEM(CaptureDevices, DeviceID)); return ALC_NO_ERROR; failure: @@ -657,37 +677,6 @@ failure: return ALC_INVALID_VALUE; } -static void ALCwinmmCapture_close(ALCwinmmCapture *self) -{ - void *buffer = NULL; - int i; - - /* Tell the processing thread to quit and wait for it to do so. */ - self->killNow = AL_TRUE; - PostThreadMessage(self->thread, WM_QUIT, 0, 0); - - althrd_join(self->thread, &i); - - /* Make sure capture is stopped and all pending buffers are flushed. */ - waveInReset(self->InHdl); - - // Release the wave buffers - for(i = 0;i < 4;i++) - { - waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); - if(i == 0) buffer = self->WaveBuffer[i].lpData; - self->WaveBuffer[i].lpData = NULL; - } - free(buffer); - - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; - - // Close the Wave device - waveInClose(self->InHdl); - self->InHdl = NULL; -} - static ALCboolean ALCwinmmCapture_start(ALCwinmmCapture *self) { waveInStart(self->InHdl); @@ -707,19 +696,19 @@ static ALCenum ALCwinmmCapture_captureSamples(ALCwinmmCapture *self, ALCvoid *bu static ALCuint ALCwinmmCapture_availableSamples(ALCwinmmCapture *self) { - return ll_ringbuffer_read_space(self->Ring); + return (ALCuint)ll_ringbuffer_read_space(self->Ring); } static inline void AppendAllDevicesList2(const al_string *name) { - if(!al_string_empty(*name)) - AppendAllDevicesList(al_string_get_cstr(*name)); + if(!alstr_empty(*name)) + AppendAllDevicesList(alstr_get_cstr(*name)); } static inline void AppendCaptureDeviceList2(const al_string *name) { - if(!al_string_empty(*name)) - AppendCaptureDeviceList(al_string_get_cstr(*name)); + if(!alstr_empty(*name)) + AppendCaptureDeviceList(alstr_get_cstr(*name)); } typedef struct ALCwinmmBackendFactory { diff --git a/Engine/lib/openal-soft/Alc/bformatdec.c b/Engine/lib/openal-soft/Alc/bformatdec.c index 2aab4ed8f..dcde7d70a 100644 --- a/Engine/lib/openal-soft/Alc/bformatdec.c +++ b/Engine/lib/openal-soft/Alc/bformatdec.c @@ -3,82 +3,22 @@ #include "bformatdec.h" #include "ambdec.h" -#include "mixer_defs.h" +#include "filters/splitter.h" #include "alu.h" +#include "bool.h" #include "threads.h" #include "almalloc.h" -void bandsplit_init(BandSplitter *splitter, ALfloat freq_mult) -{ - ALfloat w = freq_mult * F_TAU; - ALfloat cw = cosf(w); - if(cw > FLT_EPSILON) - splitter->coeff = (sinf(w) - 1.0f) / cw; - else - splitter->coeff = cw * -0.5f; - - splitter->lp_z1 = 0.0f; - splitter->lp_z2 = 0.0f; - splitter->hp_z1 = 0.0f; -} - -void bandsplit_clear(BandSplitter *splitter) -{ - splitter->lp_z1 = 0.0f; - splitter->lp_z2 = 0.0f; - splitter->hp_z1 = 0.0f; -} - -void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, - const ALfloat *input, ALuint count) -{ - ALfloat coeff, d, x; - ALfloat z1, z2; - ALuint i; - - coeff = splitter->coeff*0.5f + 0.5f; - z1 = splitter->lp_z1; - z2 = splitter->lp_z2; - for(i = 0;i < count;i++) - { - x = input[i]; - - d = (x - z1) * coeff; - x = z1 + d; - z1 = x + d; - - d = (x - z2) * coeff; - x = z2 + d; - z2 = x + d; - - lpout[i] = x; - } - splitter->lp_z1 = z1; - splitter->lp_z2 = z2; - - coeff = splitter->coeff; - z1 = splitter->hp_z1; - for(i = 0;i < count;i++) - { - x = input[i]; - - d = x - coeff*z1; - x = z1 + coeff*d; - z1 = d; - - hpout[i] = x - lpout[i]; - } - splitter->hp_z1 = z1; -} - - -static const ALfloat UnitScale[MAX_AMBI_COEFFS] = { +/* NOTE: These are scale factors as applied to Ambisonics content. Decoder + * coefficients should be divided by these values to get proper N3D scalings. + */ +const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; -static const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { +const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { 1.000000000f, /* ACN 0 (W), sqrt(1) */ 1.732050808f, /* ACN 1 (Y), sqrt(3) */ 1.732050808f, /* ACN 2 (Z), sqrt(3) */ @@ -96,7 +36,7 @@ static const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { 2.645751311f, /* ACN 14 (N), sqrt(7) */ 2.645751311f, /* ACN 15 (P), sqrt(7) */ }; -static const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { +const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { 1.414213562f, /* ACN 0 (W), sqrt(2) */ 1.732050808f, /* ACN 1 (Y), sqrt(3) */ 1.732050808f, /* ACN 2 (Z), sqrt(3) */ @@ -116,26 +56,9 @@ static const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { }; -enum FreqBand { - FB_HighFreq, - FB_LowFreq, - FB_Max -}; - -/* These points are in AL coordinates! */ -static const ALfloat Ambi2DPoints[4][3] = { - { -0.707106781f, 0.0f, -0.707106781f }, - { 0.707106781f, 0.0f, -0.707106781f }, - { -0.707106781f, 0.0f, 0.707106781f }, - { 0.707106781f, 0.0f, 0.707106781f }, -}; -static const ALfloat Ambi2DDecoder[4][FB_Max][MAX_AMBI_COEFFS] = { - { { 0.353553f, 0.204094f, 0.0f, 0.204094f }, { 0.25f, 0.204094f, 0.0f, 0.204094f } }, - { { 0.353553f, -0.204094f, 0.0f, 0.204094f }, { 0.25f, -0.204094f, 0.0f, 0.204094f } }, - { { 0.353553f, 0.204094f, 0.0f, -0.204094f }, { 0.25f, 0.204094f, 0.0f, -0.204094f } }, - { { 0.353553f, -0.204094f, 0.0f, -0.204094f }, { 0.25f, -0.204094f, 0.0f, -0.204094f } }, -}; -static ALfloat Ambi2DEncoder[4][MAX_AMBI_COEFFS]; +#define HF_BAND 0 +#define LF_BAND 1 +#define NUM_BANDS 2 /* These points are in AL coordinates! */ static const ALfloat Ambi3DPoints[8][3] = { @@ -148,57 +71,28 @@ static const ALfloat Ambi3DPoints[8][3] = { { -0.577350269f, -0.577350269f, 0.577350269f }, { 0.577350269f, -0.577350269f, 0.577350269f }, }; -static const ALfloat Ambi3DDecoder[8][FB_Max][MAX_AMBI_COEFFS] = { - { { 0.25f, 0.1443375672f, 0.1443375672f, 0.1443375672f }, { 0.125f, 0.125f, 0.125f, 0.125f } }, - { { 0.25f, -0.1443375672f, 0.1443375672f, 0.1443375672f }, { 0.125f, -0.125f, 0.125f, 0.125f } }, - { { 0.25f, 0.1443375672f, 0.1443375672f, -0.1443375672f }, { 0.125f, 0.125f, 0.125f, -0.125f } }, - { { 0.25f, -0.1443375672f, 0.1443375672f, -0.1443375672f }, { 0.125f, -0.125f, 0.125f, -0.125f } }, - { { 0.25f, 0.1443375672f, -0.1443375672f, 0.1443375672f }, { 0.125f, 0.125f, -0.125f, 0.125f } }, - { { 0.25f, -0.1443375672f, -0.1443375672f, 0.1443375672f }, { 0.125f, -0.125f, -0.125f, 0.125f } }, - { { 0.25f, 0.1443375672f, -0.1443375672f, -0.1443375672f }, { 0.125f, 0.125f, -0.125f, -0.125f } }, - { { 0.25f, -0.1443375672f, -0.1443375672f, -0.1443375672f }, { 0.125f, -0.125f, -0.125f, -0.125f } }, +static const ALfloat Ambi3DDecoder[8][MAX_AMBI_COEFFS] = { + { 0.125f, 0.125f, 0.125f, 0.125f }, + { 0.125f, -0.125f, 0.125f, 0.125f }, + { 0.125f, 0.125f, 0.125f, -0.125f }, + { 0.125f, -0.125f, 0.125f, -0.125f }, + { 0.125f, 0.125f, -0.125f, 0.125f }, + { 0.125f, -0.125f, -0.125f, 0.125f }, + { 0.125f, 0.125f, -0.125f, -0.125f }, + { 0.125f, -0.125f, -0.125f, -0.125f }, +}; +static const ALfloat Ambi3DDecoderHFScale[MAX_AMBI_COEFFS] = { + 2.0f, + 1.15470054f, 1.15470054f, 1.15470054f }; -static ALfloat Ambi3DEncoder[8][MAX_AMBI_COEFFS]; -static RowMixerFunc MixMatrixRow = MixRow_C; - - -static alonce_flag bformatdec_inited = AL_ONCE_FLAG_INIT; - -static void init_bformatdec(void) -{ - ALuint i, j; - - MixMatrixRow = SelectRowMixer(); - - for(i = 0;i < COUNTOF(Ambi3DPoints);i++) - CalcDirectionCoeffs(Ambi3DPoints[i], 0.0f, Ambi3DEncoder[i]); - - for(i = 0;i < COUNTOF(Ambi2DPoints);i++) - { - CalcDirectionCoeffs(Ambi2DPoints[i], 0.0f, Ambi2DEncoder[i]); - - /* Remove the skipped height-related coefficients for 2D rendering. */ - Ambi2DEncoder[i][2] = Ambi2DEncoder[i][3]; - Ambi2DEncoder[i][3] = Ambi2DEncoder[i][4]; - Ambi2DEncoder[i][4] = Ambi2DEncoder[i][8]; - Ambi2DEncoder[i][5] = Ambi2DEncoder[i][9]; - Ambi2DEncoder[i][6] = Ambi2DEncoder[i][15]; - for(j = 7;j < MAX_AMBI_COEFFS;j++) - Ambi2DEncoder[i][j] = 0.0f; - } -} - - -#define MAX_DELAY_LENGTH 128 - /* NOTE: BandSplitter filters are unused with single-band decoding */ typedef struct BFormatDec { - ALboolean Enabled[MAX_OUTPUT_CHANNELS]; + ALuint Enabled; /* Bitfield of enabled channels. */ union { - alignas(16) ALfloat Dual[MAX_OUTPUT_CHANNELS][FB_Max][MAX_AMBI_COEFFS]; + alignas(16) ALfloat Dual[MAX_OUTPUT_CHANNELS][NUM_BANDS][MAX_AMBI_COEFFS]; alignas(16) ALfloat Single[MAX_OUTPUT_CHANNELS][MAX_AMBI_COEFFS]; } Matrix; @@ -212,67 +106,42 @@ typedef struct BFormatDec { alignas(16) ALfloat ChannelMix[BUFFERSIZE]; struct { - alignas(16) ALfloat Buffer[MAX_DELAY_LENGTH]; - ALuint Length; /* Valid range is [0...MAX_DELAY_LENGTH). */ - } Delay[MAX_OUTPUT_CHANNELS]; + BandSplitter XOver; + ALfloat Gains[NUM_BANDS]; + } UpSampler[4]; - struct { - BandSplitter XOver[4]; - - ALfloat Gains[4][MAX_OUTPUT_CHANNELS][FB_Max]; - } UpSampler; - - ALuint NumChannels; + ALsizei NumChannels; ALboolean DualBand; - ALboolean Periphonic; } BFormatDec; BFormatDec *bformatdec_alloc() { - alcall_once(&bformatdec_inited, init_bformatdec); return al_calloc(16, sizeof(BFormatDec)); } -void bformatdec_free(BFormatDec *dec) +void bformatdec_free(BFormatDec **dec) { - if(dec) + if(dec && *dec) { - al_free(dec->Samples); - dec->Samples = NULL; - dec->SamplesHF = NULL; - dec->SamplesLF = NULL; + al_free((*dec)->Samples); + (*dec)->Samples = NULL; + (*dec)->SamplesHF = NULL; + (*dec)->SamplesLF = NULL; - memset(dec, 0, sizeof(*dec)); - al_free(dec); + al_free(*dec); + *dec = NULL; } } -int bformatdec_getOrder(const struct BFormatDec *dec) +void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALsizei chancount, ALuint srate, const ALsizei chanmap[MAX_OUTPUT_CHANNELS]) { - if(dec->Periphonic) - { - if(dec->NumChannels > 9) return 3; - if(dec->NumChannels > 4) return 2; - if(dec->NumChannels > 1) return 1; - } - else - { - if(dec->NumChannels > 5) return 3; - if(dec->NumChannels > 3) return 2; - if(dec->NumChannels > 1) return 1; - } - return 0; -} - -void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS], int flags) -{ - static const ALuint map2DTo3D[MAX_AMBI2D_COEFFS] = { + static const ALsizei map2DTo3D[MAX_AMBI2D_COEFFS] = { 0, 1, 3, 4, 8, 9, 15 }; - const ALfloat *coeff_scale = UnitScale; - ALfloat distgain[MAX_OUTPUT_CHANNELS]; - ALfloat maxdist, ratio; - ALuint i, j, k; + const ALfloat *coeff_scale = N3D2N3DScale; + bool periphonic; + ALfloat ratio; + ALsizei i; al_free(dec->Samples); dec->Samples = NULL; @@ -284,91 +153,48 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, dec->SamplesHF = dec->Samples; dec->SamplesLF = dec->SamplesHF + dec->NumChannels; - for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - dec->Enabled[i] = AL_FALSE; + dec->Enabled = 0; for(i = 0;i < conf->NumSpeakers;i++) - dec->Enabled[chanmap[i]] = AL_TRUE; + dec->Enabled |= 1 << chanmap[i]; if(conf->CoeffScale == ADS_SN3D) coeff_scale = SN3D2N3DScale; else if(conf->CoeffScale == ADS_FuMa) coeff_scale = FuMa2N3DScale; + memset(dec->UpSampler, 0, sizeof(dec->UpSampler)); ratio = 400.0f / (ALfloat)srate; for(i = 0;i < 4;i++) - bandsplit_init(&dec->UpSampler.XOver[i], ratio); - memset(dec->UpSampler.Gains, 0, sizeof(dec->UpSampler.Gains)); + bandsplit_init(&dec->UpSampler[i].XOver, ratio); if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) { - /* Combine the matrices that do the in->virt and virt->out conversions - * so we get a single in->out conversion. - */ - for(i = 0;i < 4;i++) - { - for(j = 0;j < dec->NumChannels;j++) - { - ALfloat *gains = dec->UpSampler.Gains[i][j]; - for(k = 0;k < COUNTOF(Ambi3DDecoder);k++) - { - gains[FB_HighFreq] += Ambi3DDecoder[k][FB_HighFreq][i]*Ambi3DEncoder[k][j]; - gains[FB_LowFreq] += Ambi3DDecoder[k][FB_LowFreq][i]*Ambi3DEncoder[k][j]; - } - } - } + periphonic = true; - dec->Periphonic = AL_TRUE; + dec->UpSampler[0].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? W_SCALE_3H3P : + (conf->ChanMask > 0xf) ? W_SCALE_2H2P : 1.0f; + dec->UpSampler[0].Gains[LF_BAND] = 1.0f; + for(i = 1;i < 4;i++) + { + dec->UpSampler[i].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? XYZ_SCALE_3H3P : + (conf->ChanMask > 0xf) ? XYZ_SCALE_2H2P : 1.0f; + dec->UpSampler[i].Gains[LF_BAND] = 1.0f; + } } else { - for(i = 0;i < 4;i++) + periphonic = false; + + dec->UpSampler[0].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? W_SCALE_3H0P : + (conf->ChanMask > 0xf) ? W_SCALE_2H0P : 1.0f; + dec->UpSampler[0].Gains[LF_BAND] = 1.0f; + for(i = 1;i < 3;i++) { - for(j = 0;j < dec->NumChannels;j++) - { - ALfloat *gains = dec->UpSampler.Gains[i][j]; - for(k = 0;k < COUNTOF(Ambi2DDecoder);k++) - { - gains[FB_HighFreq] += Ambi2DDecoder[k][FB_HighFreq][i]*Ambi2DEncoder[k][j]; - gains[FB_LowFreq] += Ambi2DDecoder[k][FB_LowFreq][i]*Ambi2DEncoder[k][j]; - } - } - } - - dec->Periphonic = AL_FALSE; - } - - maxdist = 0.0f; - for(i = 0;i < conf->NumSpeakers;i++) - { - maxdist = maxf(maxdist, conf->Speakers[i].Distance); - distgain[i] = 1.0f; - } - - memset(dec->Delay, 0, sizeof(dec->Delay)); - if((flags&BFDF_DistanceComp) && maxdist > 0.0f) - { - for(i = 0;i < conf->NumSpeakers;i++) - { - ALuint chan = chanmap[i]; - ALfloat delay; - - /* Distance compensation only delays in steps of the sample rate. - * This is a bit less accurate since the delay time falls to the - * nearest sample time, but it's far simpler as it doesn't have to - * deal with phase offsets. This means at 48khz, for instance, the - * distance delay will be in steps of about 7 millimeters. - */ - delay = floorf((maxdist-conf->Speakers[i].Distance) / SPEEDOFSOUNDMETRESPERSEC * - (ALfloat)srate + 0.5f); - if(delay >= (ALfloat)MAX_DELAY_LENGTH) - ERR("Delay for speaker \"%s\" exceeds buffer length (%f >= %u)\n", - al_string_get_cstr(conf->Speakers[i].Name), delay, MAX_DELAY_LENGTH); - - dec->Delay[chan].Length = (ALuint)clampf(delay, 0.0f, (ALfloat)(MAX_DELAY_LENGTH-1)); - distgain[i] = conf->Speakers[i].Distance / maxdist; - TRACE("Channel %u \"%s\" distance compensation: %u samples, %f gain\n", chan, - al_string_get_cstr(conf->Speakers[i].Name), dec->Delay[chan].Length, distgain[i] - ); + dec->UpSampler[i].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? XYZ_SCALE_3H0P : + (conf->ChanMask > 0xf) ? XYZ_SCALE_2H0P : 1.0f; + dec->UpSampler[i].Gains[LF_BAND] = 1.0f; } + dec->UpSampler[3].Gains[HF_BAND] = 0.0f; + dec->UpSampler[3].Gains[LF_BAND] = 0.0f; } memset(&dec->Matrix, 0, sizeof(dec->Matrix)); @@ -377,22 +203,22 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, dec->DualBand = AL_FALSE; for(i = 0;i < conf->NumSpeakers;i++) { - ALuint chan = chanmap[i]; + ALsizei chan = chanmap[i]; ALfloat gain; - ALuint j, k; + ALsizei j, k; - if(!dec->Periphonic) + if(!periphonic) { for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++) { - ALuint l = map2DTo3D[j]; + ALsizei l = map2DTo3D[j]; if(j == 0) gain = conf->HFOrderGain[0]; else if(j == 1) gain = conf->HFOrderGain[1]; else if(j == 3) gain = conf->HFOrderGain[2]; else if(j == 5) gain = conf->HFOrderGain[3]; if((conf->ChanMask&(1<Matrix.Single[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[l] * - gain * distgain[i]; + gain; } } else @@ -405,7 +231,7 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, else if(j == 9) gain = conf->HFOrderGain[3]; if((conf->ChanMask&(1<Matrix.Single[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[j] * - gain * distgain[i]; + gain; } } } @@ -421,35 +247,33 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ratio = powf(10.0f, conf->XOverRatio / 40.0f); for(i = 0;i < conf->NumSpeakers;i++) { - ALuint chan = chanmap[i]; + ALsizei chan = chanmap[i]; ALfloat gain; - ALuint j, k; + ALsizei j, k; - if(!dec->Periphonic) + if(!periphonic) { for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++) { - ALuint l = map2DTo3D[j]; + ALsizei l = map2DTo3D[j]; if(j == 0) gain = conf->HFOrderGain[0] * ratio; else if(j == 1) gain = conf->HFOrderGain[1] * ratio; else if(j == 3) gain = conf->HFOrderGain[2] * ratio; else if(j == 5) gain = conf->HFOrderGain[3] * ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_HighFreq][j] = conf->HFMatrix[i][k++] / - coeff_scale[l] * gain * - distgain[i]; + dec->Matrix.Dual[chan][HF_BAND][j] = conf->HFMatrix[i][k++] / + coeff_scale[l] * gain; } for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++) { - ALuint l = map2DTo3D[j]; + ALsizei l = map2DTo3D[j]; if(j == 0) gain = conf->LFOrderGain[0] / ratio; else if(j == 1) gain = conf->LFOrderGain[1] / ratio; else if(j == 3) gain = conf->LFOrderGain[2] / ratio; else if(j == 5) gain = conf->LFOrderGain[3] / ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_LowFreq][j] = conf->LFMatrix[i][k++] / - coeff_scale[l] * gain * - distgain[i]; + dec->Matrix.Dual[chan][LF_BAND][j] = conf->LFMatrix[i][k++] / + coeff_scale[l] * gain; } } else @@ -461,9 +285,8 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, else if(j == 4) gain = conf->HFOrderGain[2] * ratio; else if(j == 9) gain = conf->HFOrderGain[3] * ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_HighFreq][j] = conf->HFMatrix[i][k++] / - coeff_scale[j] * gain * - distgain[i]; + dec->Matrix.Dual[chan][HF_BAND][j] = conf->HFMatrix[i][k++] / + coeff_scale[j] * gain; } for(j = 0,k = 0;j < MAX_AMBI_COEFFS;j++) { @@ -472,9 +295,8 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, else if(j == 4) gain = conf->LFOrderGain[2] / ratio; else if(j == 9) gain = conf->LFOrderGain[3] / ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_LowFreq][j] = conf->LFMatrix[i][k++] / - coeff_scale[j] * gain * - distgain[i]; + dec->Matrix.Dual[chan][LF_BAND][j] = conf->LFMatrix[i][k++] / + coeff_scale[j] * gain; } } } @@ -482,10 +304,11 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, } -void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo) +void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo) { - ALuint chan, i; + ALsizei chan, i; + OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); if(dec->DualBand) { for(i = 0;i < dec->NumChannels;i++) @@ -494,42 +317,18 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU for(chan = 0;chan < OutChannels;chan++) { - if(!dec->Enabled[chan]) + if(!(dec->Enabled&(1<ChannelMix, 0, SamplesToDo*sizeof(ALfloat)); - MixMatrixRow(dec->ChannelMix, dec->Matrix.Dual[chan][FB_HighFreq], - SAFE_CONST(ALfloatBUFFERSIZE*,dec->SamplesHF), dec->NumChannels, 0, - SamplesToDo + MixRowSamples(dec->ChannelMix, dec->Matrix.Dual[chan][HF_BAND], + dec->SamplesHF, dec->NumChannels, 0, SamplesToDo ); - MixMatrixRow(dec->ChannelMix, dec->Matrix.Dual[chan][FB_LowFreq], - SAFE_CONST(ALfloatBUFFERSIZE*,dec->SamplesLF), dec->NumChannels, 0, - SamplesToDo + MixRowSamples(dec->ChannelMix, dec->Matrix.Dual[chan][LF_BAND], + dec->SamplesLF, dec->NumChannels, 0, SamplesToDo ); - if(dec->Delay[chan].Length > 0) - { - const ALuint base = dec->Delay[chan].Length; - if(SamplesToDo >= base) - { - for(i = 0;i < base;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - for(;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->ChannelMix[i-base]; - memcpy(dec->Delay[chan].Buffer, &dec->ChannelMix[SamplesToDo-base], - base*sizeof(ALfloat)); - } - else - { - for(i = 0;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - memmove(dec->Delay[chan].Buffer, dec->Delay[chan].Buffer+SamplesToDo, - base - SamplesToDo); - memcpy(dec->Delay[chan].Buffer+base-SamplesToDo, dec->ChannelMix, - SamplesToDo*sizeof(ALfloat)); - } - } - else for(i = 0;i < SamplesToDo;i++) + for(i = 0;i < SamplesToDo;i++) OutBuffer[chan][i] += dec->ChannelMix[i]; } } @@ -537,134 +336,157 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU { for(chan = 0;chan < OutChannels;chan++) { - if(!dec->Enabled[chan]) + if(!(dec->Enabled&(1<ChannelMix, 0, SamplesToDo*sizeof(ALfloat)); - MixMatrixRow(dec->ChannelMix, dec->Matrix.Single[chan], InSamples, - dec->NumChannels, 0, SamplesToDo); + MixRowSamples(dec->ChannelMix, dec->Matrix.Single[chan], InSamples, + dec->NumChannels, 0, SamplesToDo); - if(dec->Delay[chan].Length > 0) - { - const ALuint base = dec->Delay[chan].Length; - if(SamplesToDo >= base) - { - for(i = 0;i < base;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - for(;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->ChannelMix[i-base]; - memcpy(dec->Delay[chan].Buffer, &dec->ChannelMix[SamplesToDo-base], - base*sizeof(ALfloat)); - } - else - { - for(i = 0;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - memmove(dec->Delay[chan].Buffer, dec->Delay[chan].Buffer+SamplesToDo, - base - SamplesToDo); - memcpy(dec->Delay[chan].Buffer+base-SamplesToDo, dec->ChannelMix, - SamplesToDo*sizeof(ALfloat)); - } - } - else for(i = 0;i < SamplesToDo;i++) + for(i = 0;i < SamplesToDo;i++) OutBuffer[chan][i] += dec->ChannelMix[i]; } } } -void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint InChannels, ALuint SamplesToDo) +void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei InChannels, ALsizei SamplesToDo) { - ALuint i, j; + ALsizei i; - /* This up-sampler is very simplistic. It essentially decodes the first- - * order content to a square channel array (or cube if height is desired), - * then encodes those points onto the higher order soundfield. The decoder - * and encoder matrices have been combined to directly convert each input - * channel to the output, without the need for storing the virtual channel - * array. + /* This up-sampler leverages the differences observed in dual-band second- + * and third-order decoder matrices compared to first-order. For the same + * output channel configuration, the low-frequency matrix has identical + * coefficients in the shared input channels, while the high-frequency + * matrix has extra scalars applied to the W channel and X/Y/Z channels. + * Mixing the first-order content into the higher-order stream with the + * appropriate counter-scales applied to the HF response results in the + * subsequent higher-order decode generating the same response as a first- + * order decode. */ for(i = 0;i < InChannels;i++) { /* First, split the first-order components into low and high frequency * bands. */ - bandsplit_process(&dec->UpSampler.XOver[i], - dec->Samples[FB_HighFreq], dec->Samples[FB_LowFreq], + bandsplit_process(&dec->UpSampler[i].XOver, + dec->Samples[HF_BAND], dec->Samples[LF_BAND], InSamples[i], SamplesToDo ); /* Now write each band to the output. */ - for(j = 0;j < dec->NumChannels;j++) - MixMatrixRow(OutBuffer[j], dec->UpSampler.Gains[i][j], - SAFE_CONST(ALfloatBUFFERSIZE*,dec->Samples), FB_Max, 0, - SamplesToDo - ); + MixRowSamples(OutBuffer[i], dec->UpSampler[i].Gains, + dec->Samples, NUM_BANDS, 0, SamplesToDo + ); } } +#define INVALID_UPSAMPLE_INDEX INT_MAX + +static ALsizei GetACNIndex(const BFChannelConfig *chans, ALsizei numchans, ALsizei acn) +{ + ALsizei i; + for(i = 0;i < numchans;i++) + { + if(chans[i].Index == acn) + return i; + } + return INVALID_UPSAMPLE_INDEX; +} +#define GetChannelForACN(b, a) GetACNIndex((b).Ambi.Map, (b).NumChannels, (a)) + typedef struct AmbiUpsampler { - alignas(16) ALfloat Samples[FB_Max][BUFFERSIZE]; + alignas(16) ALfloat Samples[NUM_BANDS][BUFFERSIZE]; BandSplitter XOver[4]; - ALfloat Gains[4][MAX_OUTPUT_CHANNELS][FB_Max]; + ALfloat Gains[4][MAX_OUTPUT_CHANNELS][NUM_BANDS]; } AmbiUpsampler; AmbiUpsampler *ambiup_alloc() { - alcall_once(&bformatdec_inited, init_bformatdec); return al_calloc(16, sizeof(AmbiUpsampler)); } -void ambiup_free(struct AmbiUpsampler *ambiup) +void ambiup_free(struct AmbiUpsampler **ambiup) { - al_free(ambiup); + if(ambiup) + { + al_free(*ambiup); + *ambiup = NULL; + } } -void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device) +void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device, ALfloat w_scale, ALfloat xyz_scale) { - ALfloat gains[8][MAX_OUTPUT_CHANNELS]; ALfloat ratio; - ALuint i, j, k; + ALsizei i; ratio = 400.0f / (ALfloat)device->Frequency; for(i = 0;i < 4;i++) bandsplit_init(&ambiup->XOver[i], ratio); - for(i = 0;i < COUNTOF(Ambi3DEncoder);i++) - ComputePanningGains(device->Dry, Ambi3DEncoder[i], 1.0f, gains[i]); - memset(ambiup->Gains, 0, sizeof(ambiup->Gains)); - for(i = 0;i < 4;i++) + if(device->Dry.CoeffCount > 0) { - for(j = 0;j < device->Dry.NumChannels;j++) + ALfloat encgains[8][MAX_OUTPUT_CHANNELS]; + ALsizei j; + size_t k; + + for(k = 0;k < COUNTOF(Ambi3DPoints);k++) { - for(k = 0;k < COUNTOF(Ambi3DDecoder);k++) + ALfloat coeffs[MAX_AMBI_COEFFS] = { 0.0f }; + CalcDirectionCoeffs(Ambi3DPoints[k], 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, 1.0f, encgains[k]); + } + + /* Combine the matrices that do the in->virt and virt->out conversions + * so we get a single in->out conversion. NOTE: the Encoder matrix + * (encgains) and output are transposed, so the input channels line up + * with the rows and the output channels line up with the columns. + */ + for(i = 0;i < 4;i++) + { + for(j = 0;j < device->Dry.NumChannels;j++) { - ambiup->Gains[i][j][FB_HighFreq] += Ambi3DDecoder[k][FB_HighFreq][i]*gains[k][j]; - ambiup->Gains[i][j][FB_LowFreq] += Ambi3DDecoder[k][FB_LowFreq][i]*gains[k][j]; + ALfloat gain=0.0f; + for(k = 0;k < COUNTOF(Ambi3DDecoder);k++) + gain += Ambi3DDecoder[k][i] * encgains[k][j]; + ambiup->Gains[i][j][HF_BAND] = gain * Ambi3DDecoderHFScale[i]; + ambiup->Gains[i][j][LF_BAND] = gain; + } + } + } + else + { + for(i = 0;i < 4;i++) + { + ALsizei index = GetChannelForACN(device->Dry, i); + if(index != INVALID_UPSAMPLE_INDEX) + { + ALfloat scale = device->Dry.Ambi.Map[index].Scale; + ambiup->Gains[i][index][HF_BAND] = scale * ((i==0) ? w_scale : xyz_scale); + ambiup->Gains[i][index][LF_BAND] = scale; } } } } -void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo) +void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo) { - ALuint i, j; + ALsizei i, j; for(i = 0;i < 4;i++) { bandsplit_process(&ambiup->XOver[i], - ambiup->Samples[FB_HighFreq], ambiup->Samples[FB_LowFreq], + ambiup->Samples[HF_BAND], ambiup->Samples[LF_BAND], InSamples[i], SamplesToDo ); for(j = 0;j < OutChannels;j++) - MixMatrixRow(OutBuffer[j], ambiup->Gains[i][j], - SAFE_CONST(ALfloatBUFFERSIZE*,ambiup->Samples), FB_Max, 0, - SamplesToDo + MixRowSamples(OutBuffer[j], ambiup->Gains[i][j], + ambiup->Samples, NUM_BANDS, 0, SamplesToDo ); } } diff --git a/Engine/lib/openal-soft/Alc/bformatdec.h b/Engine/lib/openal-soft/Alc/bformatdec.h index e78d89a7b..2d7d1d624 100644 --- a/Engine/lib/openal-soft/Alc/bformatdec.h +++ b/Engine/lib/openal-soft/Alc/bformatdec.h @@ -3,47 +3,55 @@ #include "alMain.h" + +/* These are the necessary scales for first-order HF responses to play over + * higher-order 2D (non-periphonic) decoders. + */ +#define W_SCALE_2H0P 1.224744871f /* sqrt(1.5) */ +#define XYZ_SCALE_2H0P 1.0f +#define W_SCALE_3H0P 1.414213562f /* sqrt(2) */ +#define XYZ_SCALE_3H0P 1.082392196f + +/* These are the necessary scales for first-order HF responses to play over + * higher-order 3D (periphonic) decoders. + */ +#define W_SCALE_2H2P 1.341640787f /* sqrt(1.8) */ +#define XYZ_SCALE_2H2P 1.0f +#define W_SCALE_3H3P 1.695486018f +#define XYZ_SCALE_3H3P 1.136697713f + + +/* NOTE: These are scale factors as applied to Ambisonics content. Decoder + * coefficients should be divided by these values to get proper N3D scalings. + */ +const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS]; +const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS]; +const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS]; + + struct AmbDecConf; struct BFormatDec; struct AmbiUpsampler; -enum BFormatDecFlags { - BFDF_DistanceComp = 1<<0 -}; struct BFormatDec *bformatdec_alloc(); -void bformatdec_free(struct BFormatDec *dec); -int bformatdec_getOrder(const struct BFormatDec *dec); -void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS], int flags); +void bformatdec_free(struct BFormatDec **dec); +void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALsizei chancount, ALuint srate, const ALsizei chanmap[MAX_OUTPUT_CHANNELS]); /* Decodes the ambisonic input to the given output channels. */ -void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo); +void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo); /* Up-samples a first-order input to the decoder's configuration. */ -void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint InChannels, ALuint SamplesToDo); +void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei InChannels, ALsizei SamplesToDo); /* Stand-alone first-order upsampler. Kept here because it shares some stuff - * with bformatdec. + * with bformatdec. Assumes a periphonic (4-channel) input mix! */ struct AmbiUpsampler *ambiup_alloc(); -void ambiup_free(struct AmbiUpsampler *ambiup); -void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device); +void ambiup_free(struct AmbiUpsampler **ambiup); +void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device, ALfloat w_scale, ALfloat xyz_scale); -void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo); - - -/* Band splitter. Splits a signal into two phase-matching frequency bands. */ -typedef struct BandSplitter { - ALfloat coeff; - ALfloat lp_z1; - ALfloat lp_z2; - ALfloat hp_z1; -} BandSplitter; - -void bandsplit_init(BandSplitter *splitter, ALfloat freq_mult); -void bandsplit_clear(BandSplitter *splitter); -void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, - const ALfloat *input, ALuint count); +void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo); #endif /* BFORMATDEC_H */ diff --git a/Engine/lib/openal-soft/Alc/bs2b.c b/Engine/lib/openal-soft/Alc/bs2b.c index ddc2e2f24..e235e5475 100644 --- a/Engine/lib/openal-soft/Alc/bs2b.c +++ b/Engine/lib/openal-soft/Alc/bs2b.c @@ -129,16 +129,16 @@ void bs2b_clear(struct bs2b *bs2b) memset(&bs2b->last_sample, 0, sizeof(bs2b->last_sample)); } /* bs2b_clear */ -void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, unsigned int SamplesToDo) +void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, int SamplesToDo) { float lsamples[128][2]; float rsamples[128][2]; - unsigned int base; + int base; for(base = 0;base < SamplesToDo;) { - unsigned int todo = minu(128, SamplesToDo-base); - unsigned int i; + int todo = mini(128, SamplesToDo-base); + int i; /* Process left input */ lsamples[0][0] = bs2b->a0_lo*Left[0] + diff --git a/Engine/lib/openal-soft/Alc/bsinc.c b/Engine/lib/openal-soft/Alc/bsinc.c deleted file mode 100644 index f795120f7..000000000 --- a/Engine/lib/openal-soft/Alc/bsinc.c +++ /dev/null @@ -1,981 +0,0 @@ - -#include "config.h" - -#include "AL/al.h" -#include "align.h" - -/* Table of windowed sinc coefficients and deltas. This 11th order filter - * has a rejection of -60 dB, yielding a transition width of ~0.302 - * (normalized frequency). Order increases when downsampling to a limit of - * one octave, after which the quality of the filter (transition width) - * suffers to reduce the CPU cost. The bandlimiting will cut all sound after - * downsampling by ~2.73 octaves. - */ -alignas(16) const ALfloat bsincTab[18840] = -{ - /* 24, 0 */ +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, - - /* 24, 0 */ +1.501390780e-03f, +3.431804419e-03f, +6.512803185e-03f, +1.091425387e-02f, +1.664594540e-02f, +2.351091132e-02f, +3.109255671e-02f, +3.878419288e-02f, +4.586050701e-02f, +5.158058002e-02f, +5.530384985e-02f, +5.659614054e-02f, +5.530384985e-02f, +5.158058002e-02f, +4.586050701e-02f, +3.878419288e-02f, +3.109255671e-02f, +2.351091132e-02f, +1.664594540e-02f, +1.091425387e-02f, +6.512803185e-03f, +3.431804419e-03f, +1.501390780e-03f, +4.573885647e-04f, - /* 24, 1 */ +1.413186400e-03f, +3.279858311e-03f, +6.282638036e-03f, +1.059932179e-02f, +1.625135142e-02f, +2.305547031e-02f, +3.060840342e-02f, +3.831365198e-02f, +4.545054680e-02f, +5.127577001e-02f, +5.513916011e-02f, +5.659104154e-02f, +5.545895049e-02f, +5.187752167e-02f, +4.626513642e-02f, +3.925233583e-02f, +3.157717954e-02f, +2.396921539e-02f, +1.704503934e-02f, +1.123445076e-02f, +6.748179094e-03f, +3.588275667e-03f, +1.593065611e-03f, +5.022154476e-04f, - /* 24, 2 */ +1.328380648e-03f, +3.132379333e-03f, +6.057656813e-03f, +1.028967374e-02f, +1.586133102e-02f, +2.260301890e-02f, +3.012488684e-02f, +3.784089895e-02f, +4.503543229e-02f, +5.096323022e-02f, +5.496495842e-02f, +5.657574693e-02f, +5.560438923e-02f, +5.216645963e-02f, +4.666426010e-02f, +3.971789474e-02f, +3.206210284e-02f, +2.443025293e-02f, +1.744855617e-02f, +1.155988996e-02f, +6.988790100e-03f, +3.749328623e-03f, +1.688282347e-03f, +5.494305796e-04f, - /* 24, 3 */ +1.246901403e-03f, +2.989308098e-03f, +5.837830254e-03f, +9.985325752e-03f, +1.547595434e-02f, +2.215368059e-02f, +2.964217216e-02f, +3.736611920e-02f, +4.461534144e-02f, +5.064310236e-02f, +5.478132634e-02f, +5.655026396e-02f, +5.574009777e-02f, +5.244726189e-02f, +4.705770477e-02f, +4.018068337e-02f, +3.254715574e-02f, +2.489389144e-02f, +1.785641537e-02f, +1.189054572e-02f, +7.234657995e-03f, +3.915018340e-03f, +1.787112015e-03f, +5.991047395e-04f, - /* 24, 4 */ +1.168676301e-03f, +2.850583915e-03f, +5.623126723e-03f, +9.686290690e-03f, +1.509528803e-02f, +2.170757578e-02f, +2.916042250e-02f, +3.688949768e-02f, +4.419045351e-02f, +5.031553118e-02f, +5.458834968e-02f, +5.651460469e-02f, +5.586601230e-02f, +5.271979985e-02f, +4.744529894e-02f, +4.064051541e-02f, +3.303216567e-02f, +2.535999546e-02f, +1.826853297e-02f, +1.222638897e-02f, +7.485801959e-03f, +4.085398290e-03f, +1.889625146e-03f, +6.513091287e-04f, - /* 24, 5 */ +1.093632798e-03f, +2.716144855e-03f, +5.413512274e-03f, +9.392578266e-03f, +1.471939531e-02f, +2.126482169e-02f, +2.867979883e-02f, +3.641121873e-02f, +4.376094899e-02f, +4.998066438e-02f, +5.438611851e-02f, +5.646878599e-02f, +5.598207354e-02f, +5.298394839e-02f, +4.782687301e-02f, +4.109720465e-02f, +3.351695842e-02f, +2.582842673e-02f, +1.868482156e-02f, +1.256738733e-02f, +7.742238512e-03f, +4.260520294e-03f, +1.995891717e-03f, +7.061153220e-04f, - /* 24, 6 */ +1.021698233e-03f, +2.585927824e-03f, +5.208950715e-03f, +9.104195104e-03f, +1.434833590e-02f, +2.082553239e-02f, +2.820045990e-02f, +3.593146595e-02f, +4.332700946e-02f, +4.963865252e-02f, +5.417472708e-02f, +5.641282954e-02f, +5.608822683e-02f, +5.323958602e-02f, +4.820225940e-02f, +4.155056502e-02f, +3.400135826e-02f, +2.629904416e-02f, +1.910519032e-02f, +1.291350505e-02f, +8.003981455e-03f, +4.440434453e-03f, +2.105981077e-03f, +7.635952183e-04f, - /* 24, 7 */ +9.527998831e-04f, +2.459868628e-03f, +5.009403670e-03f, +8.821144768e-03f, +1.398216608e-02f, +2.038981869e-02f, +2.772256216e-02f, +3.545042216e-02f, +4.288881749e-02f, +4.928964888e-02f, +5.395427373e-02f, +5.634676181e-02f, +5.618442211e-02f, +5.348659488e-02f, +4.857129262e-02f, +4.200041076e-02f, +3.448518802e-02f, +2.677170395e-02f, +1.952954505e-02f, +1.326470299e-02f, +8.271041819e-03f, +4.625189083e-03f, +2.219961884e-03f, +8.238209888e-04f, - /* 24, 8 */ +8.868650246e-04f, +2.337902042e-03f, +4.814830642e-03f, +8.543427812e-03f, +1.362093865e-02f, +1.995778816e-02f, +2.724625964e-02f, +3.496826923e-02f, +4.244655653e-02f, +4.893380942e-02f, +5.372486088e-02f, +5.627061400e-02f, +5.627061400e-02f, +5.372486088e-02f, +4.893380942e-02f, +4.244655653e-02f, +3.496826923e-02f, +2.724625964e-02f, +1.995778816e-02f, +1.362093865e-02f, +8.543427812e-03f, +4.814830642e-03f, +2.337902042e-03f, +8.868650246e-04f, - /* 24, 9 */ +8.238209888e-04f, +2.219961884e-03f, +4.625189083e-03f, +8.271041819e-03f, +1.326470299e-02f, +1.952954505e-02f, +2.677170395e-02f, +3.448518802e-02f, +4.200041076e-02f, +4.857129262e-02f, +5.348659488e-02f, +5.618442211e-02f, +5.634676181e-02f, +5.395427373e-02f, +4.928964888e-02f, +4.288881749e-02f, +3.545042216e-02f, +2.772256216e-02f, +2.038981869e-02f, +1.398216608e-02f, +8.821144768e-03f, +5.009403670e-03f, +2.459868628e-03f, +9.527998831e-04f, - /* 24,10 */ +7.635952183e-04f, +2.105981077e-03f, +4.440434453e-03f, +8.003981455e-03f, +1.291350505e-02f, +1.910519032e-02f, +2.629904416e-02f, +3.400135826e-02f, +4.155056502e-02f, +4.820225940e-02f, +5.323958602e-02f, +5.608822683e-02f, +5.641282954e-02f, +5.417472708e-02f, +4.963865252e-02f, +4.332700946e-02f, +3.593146595e-02f, +2.820045990e-02f, +2.082553239e-02f, +1.434833590e-02f, +9.104195104e-03f, +5.208950715e-03f, +2.585927824e-03f, +1.021698233e-03f, - /* 24,11 */ +7.061153220e-04f, +1.995891717e-03f, +4.260520294e-03f, +7.742238512e-03f, +1.256738733e-02f, +1.868482156e-02f, +2.582842673e-02f, +3.351695842e-02f, +4.109720465e-02f, +4.782687301e-02f, +5.298394839e-02f, +5.598207354e-02f, +5.646878599e-02f, +5.438611851e-02f, +4.998066438e-02f, +4.376094899e-02f, +3.641121873e-02f, +2.867979883e-02f, +2.126482169e-02f, +1.471939531e-02f, +9.392578266e-03f, +5.413512274e-03f, +2.716144855e-03f, +1.093632798e-03f, - /* 24,12 */ +6.513091287e-04f, +1.889625146e-03f, +4.085398290e-03f, +7.485801959e-03f, +1.222638897e-02f, +1.826853297e-02f, +2.535999546e-02f, +3.303216567e-02f, +4.064051541e-02f, +4.744529894e-02f, +5.271979985e-02f, +5.586601230e-02f, +5.651460469e-02f, +5.458834968e-02f, +5.031553118e-02f, +4.419045351e-02f, +3.688949768e-02f, +2.916042250e-02f, +2.170757578e-02f, +1.509528803e-02f, +9.686290690e-03f, +5.623126723e-03f, +2.850583915e-03f, +1.168676301e-03f, - /* 24,13 */ +5.991047395e-04f, +1.787112015e-03f, +3.915018340e-03f, +7.234657995e-03f, +1.189054572e-02f, +1.785641537e-02f, +2.489389144e-02f, +3.254715574e-02f, +4.018068337e-02f, +4.705770477e-02f, +5.244726189e-02f, +5.574009777e-02f, +5.655026396e-02f, +5.478132634e-02f, +5.064310236e-02f, +4.461534144e-02f, +3.736611920e-02f, +2.964217216e-02f, +2.215368059e-02f, +1.547595434e-02f, +9.985325752e-03f, +5.837830254e-03f, +2.989308098e-03f, +1.246901403e-03f, - /* 24,14 */ +5.494305796e-04f, +1.688282347e-03f, +3.749328623e-03f, +6.988790100e-03f, +1.155988996e-02f, +1.744855617e-02f, +2.443025293e-02f, +3.206210284e-02f, +3.971789474e-02f, +4.666426010e-02f, +5.216645963e-02f, +5.560438923e-02f, +5.657574693e-02f, +5.496495842e-02f, +5.096323022e-02f, +4.503543229e-02f, +3.784089895e-02f, +3.012488684e-02f, +2.260301890e-02f, +1.586133102e-02f, +1.028967374e-02f, +6.057656813e-03f, +3.132379333e-03f, +1.328380648e-03f, - /* 24,15 */ +5.022154476e-04f, +1.593065611e-03f, +3.588275667e-03f, +6.748179094e-03f, +1.123445076e-02f, +1.704503934e-02f, +2.396921539e-02f, +3.157717954e-02f, +3.925233583e-02f, +4.626513642e-02f, +5.187752167e-02f, +5.545895049e-02f, +5.659104154e-02f, +5.513916011e-02f, +5.127577001e-02f, +4.545054680e-02f, +3.831365198e-02f, +3.060840342e-02f, +2.305547031e-02f, +1.625135142e-02f, +1.059932179e-02f, +6.282638036e-03f, +3.279858311e-03f, +1.413186400e-03f, - /* 24, 0 */ -1.127794091e-03f, -1.412146034e-03f, -3.831821143e-04f, +3.227045776e-03f, +1.066768284e-02f, +2.270769386e-02f, +3.918787347e-02f, +5.876378120e-02f, +7.897914846e-02f, +9.670702233e-02f, +1.088639494e-01f, +1.131922811e-01f, +1.088639494e-01f, +9.670702233e-02f, +7.897914846e-02f, +5.876378120e-02f, +3.918787347e-02f, +2.270769386e-02f, +1.066768284e-02f, +3.227045776e-03f, -3.831821143e-04f, -1.412146034e-03f, -1.127794091e-03f, -4.881068065e-04f, - /* 24, 1 */ -1.090580766e-03f, -1.420873386e-03f, -5.091873886e-04f, +2.900756187e-03f, +1.007202248e-02f, +2.181774373e-02f, +3.804709217e-02f, +5.749143322e-02f, +7.775467878e-02f, +9.573284944e-02f, +1.083163184e-01f, +1.131750947e-01f, +1.093805191e-01f, +9.765915788e-02f, +8.019389052e-02f, +6.003885715e-02f, +4.034112484e-02f, +2.361538773e-02f, +1.128161899e-02f, +3.568453927e-03f, -2.470940015e-04f, -1.398398357e-03f, -1.163769773e-03f, -5.264712252e-04f, - /* 24, 2 */ -1.052308046e-03f, -1.424863695e-03f, -6.254426725e-04f, +2.589304991e-03f, +9.494532203e-03f, +2.094570441e-02f, +3.691925193e-02f, +5.622252667e-02f, +7.652128881e-02f, +9.473734332e-02f, +1.077380418e-01f, +1.131235487e-01f, +1.098656350e-01f, +9.858856505e-02f, +8.139809812e-02f, +6.131593665e-02f, +4.150635732e-02f, +2.454063933e-02f, +1.191392194e-02f, +3.925253463e-03f, -1.005901154e-04f, -1.379341793e-03f, -1.198322390e-03f, -5.655319713e-04f, - /* 24, 3 */ -1.013146991e-03f, -1.424394748e-03f, -7.322803183e-04f, +2.292405169e-03f, +8.935092066e-03f, +2.009172411e-02f, +3.580480556e-02f, +5.495776346e-02f, +7.527978553e-02f, +9.372122042e-02f, +1.071295572e-01f, +1.130376830e-01f, +1.103189277e-01f, +9.949456662e-02f, +8.259096568e-02f, +6.259428489e-02f, +4.268306423e-02f, +2.548324354e-02f, +1.256466766e-02f, +4.297709369e-03f, +5.666214823e-05f, -1.354682733e-03f, -1.231259367e-03f, -6.052075404e-04f, - /* 24, 4 */ -9.732614753e-04f, -1.419738627e-03f, -8.300317840e-04f, +2.009763334e-03f, +8.393568260e-03f, +1.925593236e-02f, +3.470418745e-02f, +5.369783330e-02f, +7.403097485e-02f, +9.268520876e-02f, +1.064913245e-01f, +1.129175635e-01f, +1.107400515e-01f, +1.003764999e-01f, +8.377168968e-02f, +6.387315732e-02f, +4.387072153e-02f, +2.644297610e-02f, +1.323391671e-02f, +4.686078310e-03f, +2.249946366e-04f, -1.324122762e-03f, -1.262381011e-03f, -6.454100415e-04f, - /* 24, 5 */ -9.328082015e-04f, -1.411161525e-03f, -9.190272443e-04f, +1.741080225e-03f, +7.869813543e-03f, +1.843844016e-02f, +3.361781336e-02f, +5.244341325e-02f, +7.277566076e-02f, +9.163004717e-02f, +1.058238246e-01f, +1.127632829e-01f, +1.111286847e-01f, +1.012337173e-01f, +8.493946948e-02f, +6.515180031e-02f, +4.506878807e-02f, +2.741959349e-02f, +1.392171386e-02f, +5.090608136e-03f, +4.047380047e-04f, -1.287358924e-03f, -1.291480556e-03f, -6.860450823e-04f, - /* 24, 6 */ -8.919367204e-04f, -1.398923562e-03f, -9.995952120e-04f, +1.486051192e-03f, +7.363667669e-03f, +1.763934022e-02f, +3.254608027e-02f, +5.119516710e-02f, +7.151464464e-02f, +9.055648452e-02f, +1.051275597e-01f, +1.125749599e-01f, +1.114845301e-01f, +1.020655875e-01f, +8.609350809e-02f, +6.642945179e-02f, +4.627670593e-02f, +2.841283293e-02f, +1.462808772e-02f, +5.511537402e-03f, +5.962212734e-04f, -1.244083985e-03f, -1.318344226e-03f, -7.270116618e-04f, - /* 24, 7 */ -8.507894667e-04f, -1.383278624e-03f, -1.072062171e-03f, +1.244366682e-03f, +6.874957829e-03f, +1.685870710e-02f, +3.148936626e-02f, +4.995374490e-02f, +7.024872443e-02f, +8.946527894e-02f, +1.044030520e-01f, +1.123527394e-01f, +1.118073151e-01f, +1.028714955e-01f, +8.723301301e-02f, +6.770534195e-02f, +4.749390083e-02f, +2.942241233e-02f, +1.535305047e-02f, +5.949094883e-03f, +7.997713791e-04f, -1.193986722e-03f, -1.342751302e-03f, -7.682020711e-04f, - /* 24, 8 */ -8.095018024e-04f, -1.364474212e-03f, -1.136752219e-03f, +1.015712718e-03f, +6.403499096e-03f, +1.609659749e-02f, +3.044803032e-02f, +4.871978245e-02f, +6.897869391e-02f, +8.835719701e-02f, +1.036508436e-01f, +1.120967923e-01f, +1.120967923e-01f, +1.036508436e-01f, +8.835719701e-02f, +6.897869391e-02f, +4.871978245e-02f, +3.044803032e-02f, +1.609659749e-02f, +6.403499096e-03f, +1.015712718e-03f, -1.136752219e-03f, -1.364474212e-03f, -8.095018024e-04f, - /* 24, 9 */ -7.682020711e-04f, -1.342751302e-03f, -1.193986722e-03f, +7.997713791e-04f, +5.949094883e-03f, +1.535305047e-02f, +2.942241233e-02f, +4.749390083e-02f, +6.770534195e-02f, +8.723301301e-02f, +1.028714955e-01f, +1.118073151e-01f, +1.123527394e-01f, +1.044030520e-01f, +8.946527894e-02f, +7.024872443e-02f, +4.995374490e-02f, +3.148936626e-02f, +1.685870710e-02f, +6.874957829e-03f, +1.244366682e-03f, -1.072062171e-03f, -1.383278624e-03f, -8.507894667e-04f, - /* 24,10 */ -7.270116618e-04f, -1.318344226e-03f, -1.244083985e-03f, +5.962212734e-04f, +5.511537402e-03f, +1.462808772e-02f, +2.841283293e-02f, +4.627670593e-02f, +6.642945179e-02f, +8.609350809e-02f, +1.020655875e-01f, +1.114845301e-01f, +1.125749599e-01f, +1.051275597e-01f, +9.055648452e-02f, +7.151464464e-02f, +5.119516710e-02f, +3.254608027e-02f, +1.763934022e-02f, +7.363667669e-03f, +1.486051192e-03f, -9.995952120e-04f, -1.398923562e-03f, -8.919367204e-04f, - /* 24,11 */ -6.860450823e-04f, -1.291480556e-03f, -1.287358924e-03f, +4.047380047e-04f, +5.090608136e-03f, +1.392171386e-02f, +2.741959349e-02f, +4.506878807e-02f, +6.515180031e-02f, +8.493946948e-02f, +1.012337173e-01f, +1.111286847e-01f, +1.127632829e-01f, +1.058238246e-01f, +9.163004717e-02f, +7.277566076e-02f, +5.244341325e-02f, +3.361781336e-02f, +1.843844016e-02f, +7.869813543e-03f, +1.741080225e-03f, -9.190272443e-04f, -1.411161525e-03f, -9.328082015e-04f, - /* 24,12 */ -6.454100415e-04f, -1.262381011e-03f, -1.324122762e-03f, +2.249946366e-04f, +4.686078310e-03f, +1.323391671e-02f, +2.644297610e-02f, +4.387072153e-02f, +6.387315732e-02f, +8.377168968e-02f, +1.003764999e-01f, +1.107400515e-01f, +1.129175635e-01f, +1.064913245e-01f, +9.268520876e-02f, +7.403097485e-02f, +5.369783330e-02f, +3.470418745e-02f, +1.925593236e-02f, +8.393568260e-03f, +2.009763334e-03f, -8.300317840e-04f, -1.419738627e-03f, -9.732614753e-04f, - /* 24,13 */ -6.052075404e-04f, -1.231259367e-03f, -1.354682733e-03f, +5.666214823e-05f, +4.297709369e-03f, +1.256466766e-02f, +2.548324354e-02f, +4.268306423e-02f, +6.259428489e-02f, +8.259096568e-02f, +9.949456662e-02f, +1.103189277e-01f, +1.130376830e-01f, +1.071295572e-01f, +9.372122042e-02f, +7.527978553e-02f, +5.495776346e-02f, +3.580480556e-02f, +2.009172411e-02f, +8.935092066e-03f, +2.292405169e-03f, -7.322803183e-04f, -1.424394748e-03f, -1.013146991e-03f, - /* 24,14 */ -5.655319713e-04f, -1.198322390e-03f, -1.379341793e-03f, -1.005901154e-04f, +3.925253463e-03f, +1.191392194e-02f, +2.454063933e-02f, +4.150635732e-02f, +6.131593665e-02f, +8.139809812e-02f, +9.858856505e-02f, +1.098656350e-01f, +1.131235487e-01f, +1.077380418e-01f, +9.473734332e-02f, +7.652128881e-02f, +5.622252667e-02f, +3.691925193e-02f, +2.094570441e-02f, +9.494532203e-03f, +2.589304991e-03f, -6.254426725e-04f, -1.424863695e-03f, -1.052308046e-03f, - /* 24,15 */ -5.264712252e-04f, -1.163769773e-03f, -1.398398357e-03f, -2.470940015e-04f, +3.568453927e-03f, +1.128161899e-02f, +2.361538773e-02f, +4.034112484e-02f, +6.003885715e-02f, +8.019389052e-02f, +9.765915788e-02f, +1.093805191e-01f, +1.131750947e-01f, +1.083163184e-01f, +9.573284944e-02f, +7.775467878e-02f, +5.749143322e-02f, +3.804709217e-02f, +2.181774373e-02f, +1.007202248e-02f, +2.900756187e-03f, -5.091873886e-04f, -1.420873386e-03f, -1.090580766e-03f, - /* 24, 0 */ -6.542299160e-04f, -2.850723396e-03f, -6.490258587e-03f, -9.960104872e-03f, -9.809478345e-03f, -1.578994128e-03f, +1.829834548e-02f, +5.025161588e-02f, +9.015425381e-02f, +1.297327779e-01f, +1.589915292e-01f, +1.697884216e-01f, +1.589915292e-01f, +1.297327779e-01f, +9.015425381e-02f, +5.025161588e-02f, +1.829834548e-02f, -1.578994128e-03f, -9.809478345e-03f, -9.960104872e-03f, -6.490258587e-03f, -2.850723396e-03f, -6.542299160e-04f, +6.349952235e-05f, - /* 24, 1 */ -5.715660670e-04f, -2.664319167e-03f, -6.241370053e-03f, -9.805460951e-03f, -1.000906214e-02f, -2.409006146e-03f, +1.668518463e-02f, +4.795494216e-02f, +8.756853655e-02f, +1.274593023e-01f, +1.576392865e-01f, +1.697451719e-01f, +1.602699418e-01f, +1.319653222e-01f, +9.273931864e-02f, +5.258078166e-02f, +1.996024013e-02f, -7.024321916e-04f, -9.578061730e-03f, -1.010098516e-02f, -6.739131402e-03f, -3.043301383e-03f, -7.429059724e-04f, +4.968305000e-05f, - /* 24, 2 */ -4.947700224e-04f, -2.484234158e-03f, -5.993080931e-03f, -9.638098137e-03f, -1.017794029e-02f, -3.193110201e-03f, +1.512113085e-02f, +4.569233080e-02f, +8.498458400e-02f, +1.251473534e-01f, +1.562147818e-01f, +1.696154741e-01f, +1.614730379e-01f, +1.341545065e-01f, +9.532128436e-02f, +5.494080034e-02f, +2.167042077e-02f, +2.212715669e-04f, -9.313697641e-03f, -1.022703863e-02f, -6.987342300e-03f, -3.241882098e-03f, -8.377276082e-04f, +3.267464436e-05f, - /* 24, 3 */ -4.236872966e-04f, -2.310589033e-03f, -5.745975157e-03f, -9.459041324e-03f, -1.031725016e-02f, -3.931996122e-03f, +1.360648366e-02f, +4.346528177e-02f, +8.240478048e-02f, +1.227994149e-01f, +1.547196623e-01f, +1.693994819e-01f, +1.625994153e-01f, +1.362979353e-01f, +9.789767810e-02f, +5.732996534e-02f, +2.342836441e-02f, +1.192656872e-03f, -9.015286272e-03f, -1.033718507e-02f, -7.234214214e-03f, -3.446268223e-03f, -9.388162067e-04f, +1.226776811e-05f, - /* 24, 4 */ -3.581542611e-04f, -2.143480447e-03f, -5.500605429e-03f, -9.269294257e-03f, -1.042813706e-02f, -4.626399385e-03f, +1.214146970e-02f, +4.127522351e-02f, +7.983147433e-02f, +1.204179923e-01f, +1.531556516e-01f, +1.690974512e-01f, +1.636477581e-01f, +1.383932498e-01f, +1.004660042e-01f, +5.974650439e-02f, +2.523347234e-02f, +2.212209196e-03f, -8.681745020e-03f, -1.043032883e-02f, -7.479039479e-03f, -3.656235461e-03f, -1.046280200e-03f, -1.174474466e-05f, - /* 24, 5 */ -2.979990698e-04f, -1.982981877e-03f, -5.257493218e-03f, -9.069838305e-03f, -1.051175200e-02f, -5.277098842e-03f, +1.072624378e-02f, +3.912351177e-02f, +7.726697481e-02f, +1.180056089e-01f, +1.515245471e-01f, +1.687097397e-01f, +1.646168392e-01f, +1.404381320e-01f, +1.030237476e-01f, +6.218858132e-02f, +2.708506973e-02f, +3.280357753e-03f, -8.312010872e-03f, -1.050536039e-02f, -7.721080180e-03f, -3.871531888e-03f, -1.160214103e-03f, -3.957001380e-05f, - /* 24, 6 */ -2.430425717e-04f, -1.829144469e-03f, -5.017128860e-03f, -8.861631306e-03f, -1.056924947e-02f, -5.884914422e-03f, +9.360889972e-03f, +3.701142868e-02f, +7.471354913e-02f, +1.155648023e-01f, +1.498282170e-01f, +1.682368061e-01f, +1.655055219e-01f, +1.424303080e-01f, +1.055683777e-01f, +6.465429798e-02f, +2.898240538e-02f, +4.397473555e-03f, -7.905042791e-03f, -1.056115807e-02f, -7.959568583e-03f, -4.091877352e-03f, -1.280697546e-03f, -7.141440876e-05f, - /* 24, 7 */ -1.930992056e-04f, -1.681997919e-03f, -4.779971710e-03f, -8.645606504e-03f, -1.060178532e-02f, -6.450704795e-03f, +8.045422842e-03f, +3.494018190e-02f, +7.217341954e-02f, +1.130981205e-01f, +1.480685972e-01f, +1.676792097e-01f, +1.663127619e-01f, +1.443675516e-01f, +1.080973515e-01f, +6.714169632e-02f, +3.092465153e-02f, +5.563867546e-03f, -7.459824124e-03f, -1.059658974e-02f, -8.193707637e-03f, -4.316962918e-03f, -1.407794310e-03f, -1.074828157e-04f, - /* 24, 8 */ -1.479778772e-04f, -1.541551365e-03f, -4.546450360e-03f, -8.422671559e-03f, -1.061051465e-02f, -6.975365011e-03f, +6.779788805e-03f, +3.291090392e-02f, +6.964876056e-02f, +1.106081178e-01f, +1.462476880e-01f, +1.670376092e-01f, +1.670376092e-01f, +1.462476880e-01f, +1.106081178e-01f, +6.964876056e-02f, +3.291090392e-02f, +6.779788805e-03f, -6.975365011e-03f, -1.061051465e-02f, -8.422671559e-03f, -4.546450360e-03f, -1.541551365e-03f, -1.479778772e-04f, - /* 24, 9 */ -1.074828157e-04f, -1.407794310e-03f, -4.316962918e-03f, -8.193707637e-03f, -1.059658974e-02f, -7.459824124e-03f, +5.563867546e-03f, +3.092465153e-02f, +6.714169632e-02f, +1.080973515e-01f, +1.443675516e-01f, +1.663127619e-01f, +1.676792097e-01f, +1.480685972e-01f, +1.130981205e-01f, +7.217341954e-02f, +3.494018190e-02f, +8.045422842e-03f, -6.450704795e-03f, -1.060178532e-02f, -8.645606504e-03f, -4.779971710e-03f, -1.681997919e-03f, -1.930992056e-04f, - /* 24,10 */ -7.141440876e-05f, -1.280697546e-03f, -4.091877352e-03f, -7.959568583e-03f, -1.056115807e-02f, -7.905042791e-03f, +4.397473555e-03f, +2.898240538e-02f, +6.465429798e-02f, +1.055683777e-01f, +1.424303080e-01f, +1.655055219e-01f, +1.682368061e-01f, +1.498282170e-01f, +1.155648023e-01f, +7.471354913e-02f, +3.701142868e-02f, +9.360889972e-03f, -5.884914422e-03f, -1.056924947e-02f, -8.861631306e-03f, -5.017128860e-03f, -1.829144469e-03f, -2.430425717e-04f, - /* 24,11 */ -3.957001380e-05f, -1.160214103e-03f, -3.871531888e-03f, -7.721080180e-03f, -1.050536039e-02f, -8.312010872e-03f, +3.280357753e-03f, +2.708506973e-02f, +6.218858132e-02f, +1.030237476e-01f, +1.404381320e-01f, +1.646168392e-01f, +1.687097397e-01f, +1.515245471e-01f, +1.180056089e-01f, +7.726697481e-02f, +3.912351177e-02f, +1.072624378e-02f, -5.277098842e-03f, -1.051175200e-02f, -9.069838305e-03f, -5.257493218e-03f, -1.982981877e-03f, -2.979990698e-04f, - /* 24,12 */ -1.174474466e-05f, -1.046280200e-03f, -3.656235461e-03f, -7.479039479e-03f, -1.043032883e-02f, -8.681745020e-03f, +2.212209196e-03f, +2.523347234e-02f, +5.974650439e-02f, +1.004660042e-01f, +1.383932498e-01f, +1.636477581e-01f, +1.690974512e-01f, +1.531556516e-01f, +1.204179923e-01f, +7.983147433e-02f, +4.127522351e-02f, +1.214146970e-02f, -4.626399385e-03f, -1.042813706e-02f, -9.269294257e-03f, -5.500605429e-03f, -2.143480447e-03f, -3.581542611e-04f, - /* 24,13 */ +1.226776811e-05f, -9.388162067e-04f, -3.446268223e-03f, -7.234214214e-03f, -1.033718507e-02f, -9.015286272e-03f, +1.192656872e-03f, +2.342836441e-02f, +5.732996534e-02f, +9.789767810e-02f, +1.362979353e-01f, +1.625994153e-01f, +1.693994819e-01f, +1.547196623e-01f, +1.227994149e-01f, +8.240478048e-02f, +4.346528177e-02f, +1.360648366e-02f, -3.931996122e-03f, -1.031725016e-02f, -9.459041324e-03f, -5.745975157e-03f, -2.310589033e-03f, -4.236872966e-04f, - /* 24,14 */ +3.267464436e-05f, -8.377276082e-04f, -3.241882098e-03f, -6.987342300e-03f, -1.022703863e-02f, -9.313697641e-03f, +2.212715669e-04f, +2.167042077e-02f, +5.494080034e-02f, +9.532128436e-02f, +1.341545065e-01f, +1.614730379e-01f, +1.696154741e-01f, +1.562147818e-01f, +1.251473534e-01f, +8.498458400e-02f, +4.569233080e-02f, +1.512113085e-02f, -3.193110201e-03f, -1.017794029e-02f, -9.638098137e-03f, -5.993080931e-03f, -2.484234158e-03f, -4.947700224e-04f, - /* 24,15 */ +4.968305000e-05f, -7.429059724e-04f, -3.043301383e-03f, -6.739131402e-03f, -1.010098516e-02f, -9.578061730e-03f, -7.024321916e-04f, +1.996024013e-02f, +5.258078166e-02f, +9.273931864e-02f, +1.319653222e-01f, +1.602699418e-01f, +1.697451719e-01f, +1.576392865e-01f, +1.274593023e-01f, +8.756853655e-02f, +4.795494216e-02f, +1.668518463e-02f, -2.409006146e-03f, -1.000906214e-02f, -9.805460951e-03f, -6.241370053e-03f, -2.664319167e-03f, -5.715660670e-04f, - /* 24, 0 */ +1.619229527e-03f, +2.585184252e-03f, +7.650378125e-04f, -6.171975840e-03f, -1.695416291e-02f, -2.423274385e-02f, -1.612533623e-02f, +1.737483974e-02f, +7.628093610e-02f, +1.465254238e-01f, +2.041060488e-01f, +2.263845622e-01f, +2.041060488e-01f, +1.465254238e-01f, +7.628093610e-02f, +1.737483974e-02f, -1.612533623e-02f, -2.423274385e-02f, -1.695416291e-02f, -6.171975840e-03f, +7.650378125e-04f, +2.585184252e-03f, +1.619229527e-03f, +4.203426526e-04f, - /* 24, 1 */ +1.531668339e-03f, +2.575087939e-03f, +1.015030141e-03f, -5.584253498e-03f, -1.627529113e-02f, -2.409742304e-02f, -1.730694612e-02f, +1.446720847e-02f, +7.205349539e-02f, +1.422361210e-01f, +2.013530187e-01f, +2.262942875e-01f, +2.067165090e-01f, +1.507648574e-01f, +8.055624103e-02f, +2.038667606e-02f, -1.484111026e-02f, -2.430745079e-02f, -1.762106127e-02f, -6.776879595e-03f, +4.938567092e-04f, +2.584413048e-03f, +1.706479068e-03f, +4.743886054e-04f, - /* 24, 2 */ +1.444251783e-03f, +2.554897668e-03f, +1.244217996e-03f, -5.014646771e-03f, -1.558700841e-02f, -2.390468713e-02f, -1.838770218e-02f, +1.166535016e-02f, +6.787901036e-02f, +1.379034790e-01f, +1.984620386e-01f, +2.260236194e-01f, +2.091800031e-01f, +1.549479100e-01f, +8.487414623e-02f, +2.350091114e-02f, -1.345266938e-02f, -2.431836796e-02f, -1.827334019e-02f, -7.397926552e-03f, +2.011593926e-04f, +2.571998910e-03f, +1.792931314e-03f, +5.318997770e-04f, - /* 24, 3 */ +1.357406375e-03f, +2.525382259e-03f, +1.453038602e-03f, -4.463987325e-03f, -1.489178967e-02f, -2.365774922e-02f, -1.936952211e-02f, +8.970595311e-03f, +6.376239146e-02f, +1.335340325e-01f, +1.954379419e-01f, +2.255730254e-01f, +2.114923689e-01f, +1.590681020e-01f, +8.922922426e-02f, +2.671549986e-02f, -1.195858585e-02f, -2.426235104e-02f, -1.890827435e-02f, -8.033973302e-03f, -1.133208208e-04f, +2.547167581e-03f, +1.878071789e-03f, +5.928148062e-04f, - /* 24, 4 */ +1.271528621e-03f, +2.487303056e-03f, +1.641978155e-03f, -3.933006021e-03f, -1.419201875e-02f, -2.335982837e-02f, -2.025447087e-02f, +6.384038515e-03f, +5.970836021e-02f, +1.291343068e-01f, +1.922857641e-01f, +2.249432832e-01f, +2.136496877e-01f, +1.631190001e-01f, +9.361589375e-02f, +3.002815853e-02f, -1.035761042e-02f, -2.413629608e-02f, -1.952306378e-02f, -8.683770335e-03f, -4.497860188e-04f, +2.509149105e-03f, +1.961357874e-03f, +6.570484107e-04f, - /* 24, 5 */ +1.186984902e-03f, +2.441411339e-03f, +1.811567846e-03f, -3.422334900e-03f, -1.348998519e-02f, -2.301414142e-02f, -2.104475231e-02f, +3.906540614e-03f, +5.572144173e-02f, +1.247108046e-01f, +1.890107314e-01f, +2.241354793e-01f, +2.156482934e-01f, +1.670942309e-01f, +9.802842938e-02f, +3.343636564e-02f, -8.648679404e-03f, -2.393714847e-02f, -2.011483893e-02f, -9.345961431e-03f, -8.083699235e-04f, +2.457181100e-03f, +2.042219659e-03f, +7.244903794e-04f, - /* 24, 6 */ +1.104111497e-03f, +2.388445882e-03f, +1.962379900e-03f, -2.932509404e-03f, -1.278788140e-02f, -2.262389503e-02f, -2.174270056e-02f, +1.538731332e-03f, +5.180595798e-02f, +1.202699924e-01f, +1.856182490e-01f, +2.231510062e-01f, +2.174847808e-01f, +1.709874949e-01f, +1.024609723e-01f, +3.693736330e-02f, -6.830921421e-03f, -2.366191192e-02f, -2.068066597e-02f, -1.001908338e-02f, -1.189134206e-03f, +2.390512141e-03f, +2.120060933e-03f, +7.950046334e-04f, - /* 24, 7 */ +1.023214729e-03f, +2.329130668e-03f, +2.095023622e-03f, -2.463970822e-03f, -1.208780014e-02f, -2.219227795e-02f, -2.235077131e-02f, -7.189875350e-04f, +4.796602143e-02f, +1.158182872e-01f, +1.821138888e-01f, +2.219915591e-01f, +2.191560137e-01f, +1.747925803e-01f, +1.069075413e-01f, +4.052815924e-02f, -4.903663772e-03f, -2.330765754e-02f, -2.121755248e-02f, -1.070156599e-02f, -1.592064902e-03f, +2.308405249e-03f, +2.194260355e-03f, +8.684283615e-04f, - /* 24, 8 */ +9.445712380e-04f, +2.264172764e-03f, +2.210141486e-03f, -2.017068943e-03f, -1.139173248e-02f, -2.172245353e-02f, -2.287153293e-02f, -2.866438416e-03f, +4.420552946e-02f, +1.113620436e-01f, +1.785033768e-01f, +2.206591322e-01f, +2.206591322e-01f, +1.785033768e-01f, +1.113620436e-01f, +4.420552946e-02f, -2.866438416e-03f, -2.287153293e-02f, -2.172245353e-02f, -1.139173248e-02f, -2.017068943e-03f, +2.210141486e-03f, +2.264172764e-03f, +9.445712380e-04f, - /* 24, 9 */ +8.684283615e-04f, +2.194260355e-03f, +2.308405249e-03f, -1.592064902e-03f, -1.070156599e-02f, -2.121755248e-02f, -2.330765754e-02f, -4.903663772e-03f, +4.052815924e-02f, +1.069075413e-01f, +1.747925803e-01f, +2.191560137e-01f, +2.219915591e-01f, +1.821138888e-01f, +1.158182872e-01f, +4.796602143e-02f, -7.189875350e-04f, -2.235077131e-02f, -2.219227795e-02f, -1.208780014e-02f, -2.463970822e-03f, +2.095023622e-03f, +2.329130668e-03f, +1.023214729e-03f, - /* 24,10 */ +7.950046334e-04f, +2.120060933e-03f, +2.390512141e-03f, -1.189134206e-03f, -1.001908338e-02f, -2.068066597e-02f, -2.366191192e-02f, -6.830921421e-03f, +3.693736330e-02f, +1.024609723e-01f, +1.709874949e-01f, +2.174847808e-01f, +2.231510062e-01f, +1.856182490e-01f, +1.202699924e-01f, +5.180595798e-02f, +1.538731332e-03f, -2.174270056e-02f, -2.262389503e-02f, -1.278788140e-02f, -2.932509404e-03f, +1.962379900e-03f, +2.388445882e-03f, +1.104111497e-03f, - /* 24,11 */ +7.244903794e-04f, +2.042219659e-03f, +2.457181100e-03f, -8.083699235e-04f, -9.345961431e-03f, -2.011483893e-02f, -2.393714847e-02f, -8.648679404e-03f, +3.343636564e-02f, +9.802842938e-02f, +1.670942309e-01f, +2.156482934e-01f, +2.241354793e-01f, +1.890107314e-01f, +1.247108046e-01f, +5.572144173e-02f, +3.906540614e-03f, -2.104475231e-02f, -2.301414142e-02f, -1.348998519e-02f, -3.422334900e-03f, +1.811567846e-03f, +2.441411339e-03f, +1.186984902e-03f, - /* 24,12 */ +6.570484107e-04f, +1.961357874e-03f, +2.509149105e-03f, -4.497860188e-04f, -8.683770335e-03f, -1.952306378e-02f, -2.413629608e-02f, -1.035761042e-02f, +3.002815853e-02f, +9.361589375e-02f, +1.631190001e-01f, +2.136496877e-01f, +2.249432832e-01f, +1.922857641e-01f, +1.291343068e-01f, +5.970836021e-02f, +6.384038515e-03f, -2.025447087e-02f, -2.335982837e-02f, -1.419201875e-02f, -3.933006021e-03f, +1.641978155e-03f, +2.487303056e-03f, +1.271528621e-03f, - /* 24,13 */ +5.928148062e-04f, +1.878071789e-03f, +2.547167581e-03f, -1.133208208e-04f, -8.033973302e-03f, -1.890827435e-02f, -2.426235104e-02f, -1.195858585e-02f, +2.671549986e-02f, +8.922922426e-02f, +1.590681020e-01f, +2.114923689e-01f, +2.255730254e-01f, +1.954379419e-01f, +1.335340325e-01f, +6.376239146e-02f, +8.970595311e-03f, -1.936952211e-02f, -2.365774922e-02f, -1.489178967e-02f, -4.463987325e-03f, +1.453038602e-03f, +2.525382259e-03f, +1.357406375e-03f, - /* 24,14 */ +5.318997770e-04f, +1.792931314e-03f, +2.571998910e-03f, +2.011593926e-04f, -7.397926552e-03f, -1.827334019e-02f, -2.431836796e-02f, -1.345266938e-02f, +2.350091114e-02f, +8.487414623e-02f, +1.549479100e-01f, +2.091800031e-01f, +2.260236194e-01f, +1.984620386e-01f, +1.379034790e-01f, +6.787901036e-02f, +1.166535016e-02f, -1.838770218e-02f, -2.390468713e-02f, -1.558700841e-02f, -5.014646771e-03f, +1.244217996e-03f, +2.554897668e-03f, +1.444251783e-03f, - /* 24,15 */ +4.743886054e-04f, +1.706479068e-03f, +2.584413048e-03f, +4.938567092e-04f, -6.776879595e-03f, -1.762106127e-02f, -2.430745079e-02f, -1.484111026e-02f, +2.038667606e-02f, +8.055624103e-02f, +1.507648574e-01f, +2.067165090e-01f, +2.262942875e-01f, +2.013530187e-01f, +1.422361210e-01f, +7.205349539e-02f, +1.446720847e-02f, -1.730694612e-02f, -2.409742304e-02f, -1.627529113e-02f, -5.584253498e-03f, +1.015030141e-03f, +2.575087939e-03f, +1.531668339e-03f, - /* 24, 0 */ -5.620806651e-04f, +1.786951327e-03f, +6.445247430e-03f, +8.135220753e-03f, -1.055728075e-03f, -2.182587186e-02f, -3.862210468e-02f, -2.392616717e-02f, +4.121375257e-02f, +1.449837419e-01f, +2.427850309e-01f, +2.829807027e-01f, +2.427850309e-01f, +1.449837419e-01f, +4.121375257e-02f, -2.392616717e-02f, -3.862210468e-02f, -2.182587186e-02f, -1.055728075e-03f, +8.135220753e-03f, +6.445247430e-03f, +1.786951327e-03f, -5.620806651e-04f, -5.120724112e-04f, - /* 24, 1 */ -6.104492932e-04f, +1.548760636e-03f, +6.159105160e-03f, +8.277197332e-03f, -7.779733613e-05f, -2.039475337e-02f, -3.819819741e-02f, -2.624621678e-02f, +3.569722776e-02f, +1.380982730e-01f, +2.379020609e-01f, +2.828154582e-01f, +2.474326717e-01f, +1.518487179e-01f, +4.689321837e-02f, -2.139810919e-02f, -3.892035913e-02f, -2.324619800e-02f, -2.084809535e-03f, +7.948411519e-03f, +6.721048149e-03f, +2.036121529e-03f, -5.037148469e-04f, -5.469834647e-04f, - /* 24, 2 */ -6.493280747e-04f, +1.322056610e-03f, +5.864617557e-03f, +8.376206823e-03f, +8.476165560e-04f, -1.895882060e-02f, -3.765599422e-02f, -2.836041007e-02f, +3.035103267e-02f, +1.312062799e-01f, +2.327950895e-01f, +2.823201223e-01f, +2.518341522e-01f, +1.586790922e-01f, +5.272765217e-02f, -1.866041870e-02f, -3.908572584e-02f, -2.464952038e-02f, -3.163389088e-03f, +7.715013258e-03f, +6.984447000e-03f, +2.295668536e-03f, -4.348733531e-04f, -5.801620624e-04f, - /* 24, 3 */ -6.792484933e-04f, +1.107253309e-03f, +5.563710253e-03f, +8.434210700e-03f, +1.719427448e-03f, -1.752380524e-02f, -3.700294628e-02f, -3.027140813e-02f, +2.518195985e-02f, +1.243215533e-01f, +2.274759065e-01f, +2.814958870e-01f, +2.559791715e-01f, +1.654606562e-01f, +5.870851072e-02f, -1.571201688e-02f, -3.911111998e-02f, -2.602940857e-02f, -4.289522020e-03f, +7.433392157e-03f, +7.233326681e-03f, +2.564892035e-03f, -3.551113499e-04f, -6.111213026e-04f, - /* 24, 4 */ -7.007615573e-04f, +9.046745282e-04f, +5.258232435e-03f, +8.453253159e-03f, +2.536821717e-03f, -1.609518093e-02f, -3.624657153e-02f, -3.198236083e-02f, +2.019619593e-02f, +1.174576676e-01f, +2.219567270e-01f, +2.803447347e-01f, +2.598579915e-01f, +1.721791413e-01f, +6.482669661e-02f, -1.255238605e-02f, -3.898963496e-02f, -2.737922870e-02f, -5.460966964e-03f, +7.102050305e-03f, +7.465520628e-03f, +2.842992490e-03f, -2.640225027e-04f, -6.393525967e-04f, - /* 24, 5 */ -7.144333056e-04f, +7.145569834e-04f, +4.949951622e-03f, +8.435448103e-03f, +3.299249997e-03f, -1.467815287e-02f, -3.539442781e-02f, -3.349688539e-02f, +1.539931407e-02f, +1.106279448e-01f, +2.162501543e-01f, +2.788694321e-01f, +2.634614666e-01f, +1.788202595e-01f, +7.107257652e-02f, -9.181583996e-03f, -3.871457066e-02f, -2.869216031e-02f, -6.675182397e-03f, +6.719638981e-03f, +7.678821339e-03f, +3.129069982e-03f, -1.612438490e-04f, -6.643278432e-04f, - /* 24, 6 */ -7.208404573e-04f, +5.370537968e-04f, +4.640549073e-03f, +8.382966356e-03f, +4.006418111e-03f, -1.327764882e-02f, -3.445408633e-02f, -3.481904366e-02f, +1.079626845e-02f, +1.038454185e-01f, +2.103691410e-01f, +2.770735210e-01f, +2.667810728e-01f, +1.853697450e-01f, +7.743600141e-02f, -5.600256400e-03f, -3.827946167e-02f, -2.996121443e-02f, -7.929324241e-03f, +6.284971816e-03f, +7.870989279e-03f, +3.422123547e-03f, -4.646067064e-05f, -6.855018549e-04f, - /* 24, 7 */ -7.205662235e-04f, +3.722382714e-04f, +4.331615834e-03f, +8.298023138e-03f, +4.658277300e-03f, -1.189831143e-02f, -3.343310598e-02f, -3.595331849e-02f, +6.391391026e-03f, +9.712280024e-02f, +2.043269499e-01f, +2.749613076e-01f, +2.698089343e-01f, +1.918133956e-01f, +8.390632879e-02f, -1.809647645e-03f, -3.767810524e-02f, -3.117925279e-02f, -9.220244622e-03f, +5.797037759e-03f, +8.039762345e-03f, +3.721051017e-03f, +8.058866307e-05f, -7.023150347e-04f, - /* 24, 8 */ -7.141962964e-04f, +2.201079121e-04f, +4.024649403e-03f, +8.182865872e-03f, +5.255013788e-03f, -1.054449181e-02f, -3.233900821e-02f, -3.690458903e-02f, +2.188390323e-03f, +9.047244679e-02f, +1.981371140e-01f, +2.725378483e-01f, +2.725378483e-01f, +1.981371140e-01f, +9.047244679e-02f, +2.188390323e-03f, -3.690458903e-02f, -3.233900821e-02f, -1.054449181e-02f, +5.255013788e-03f, +8.182865872e-03f, +4.024649403e-03f, +2.201079121e-04f, -7.141962964e-04f, - /* 24, 9 */ -7.023150347e-04f, +8.058866307e-05f, +3.721051017e-03f, +8.039762345e-03f, +5.797037759e-03f, -9.220244622e-03f, -3.117925279e-02f, -3.767810524e-02f, -1.809647645e-03f, +8.390632879e-02f, +1.918133956e-01f, +2.698089343e-01f, +2.749613076e-01f, +2.043269499e-01f, +9.712280024e-02f, +6.391391026e-03f, -3.595331849e-02f, -3.343310598e-02f, -1.189831143e-02f, +4.658277300e-03f, +8.298023138e-03f, +4.331615834e-03f, +3.722382714e-04f, -7.205662235e-04f, - /* 24,10 */ -6.855018549e-04f, -4.646067064e-05f, +3.422123547e-03f, +7.870989279e-03f, +6.284971816e-03f, -7.929324241e-03f, -2.996121443e-02f, -3.827946167e-02f, -5.600256400e-03f, +7.743600141e-02f, +1.853697450e-01f, +2.667810728e-01f, +2.770735210e-01f, +2.103691410e-01f, +1.038454185e-01f, +1.079626845e-02f, -3.481904366e-02f, -3.445408633e-02f, -1.327764882e-02f, +4.006418111e-03f, +8.382966356e-03f, +4.640549073e-03f, +5.370537968e-04f, -7.208404573e-04f, - /* 24,11 */ -6.643278432e-04f, -1.612438490e-04f, +3.129069982e-03f, +7.678821339e-03f, +6.719638981e-03f, -6.675182397e-03f, -2.869216031e-02f, -3.871457066e-02f, -9.181583996e-03f, +7.107257652e-02f, +1.788202595e-01f, +2.634614666e-01f, +2.788694321e-01f, +2.162501543e-01f, +1.106279448e-01f, +1.539931407e-02f, -3.349688539e-02f, -3.539442781e-02f, -1.467815287e-02f, +3.299249997e-03f, +8.435448103e-03f, +4.949951622e-03f, +7.145569834e-04f, -7.144333056e-04f, - /* 24,12 */ -6.393525967e-04f, -2.640225027e-04f, +2.842992490e-03f, +7.465520628e-03f, +7.102050305e-03f, -5.460966964e-03f, -2.737922870e-02f, -3.898963496e-02f, -1.255238605e-02f, +6.482669661e-02f, +1.721791413e-01f, +2.598579915e-01f, +2.803447347e-01f, +2.219567270e-01f, +1.174576676e-01f, +2.019619593e-02f, -3.198236083e-02f, -3.624657153e-02f, -1.609518093e-02f, +2.536821717e-03f, +8.453253159e-03f, +5.258232435e-03f, +9.046745282e-04f, -7.007615573e-04f, - /* 24,13 */ -6.111213026e-04f, -3.551113499e-04f, +2.564892035e-03f, +7.233326681e-03f, +7.433392157e-03f, -4.289522020e-03f, -2.602940857e-02f, -3.911111998e-02f, -1.571201688e-02f, +5.870851072e-02f, +1.654606562e-01f, +2.559791715e-01f, +2.814958870e-01f, +2.274759065e-01f, +1.243215533e-01f, +2.518195985e-02f, -3.027140813e-02f, -3.700294628e-02f, -1.752380524e-02f, +1.719427448e-03f, +8.434210700e-03f, +5.563710253e-03f, +1.107253309e-03f, -6.792484933e-04f, - /* 24,14 */ -5.801620624e-04f, -4.348733531e-04f, +2.295668536e-03f, +6.984447000e-03f, +7.715013258e-03f, -3.163389088e-03f, -2.464952038e-02f, -3.908572584e-02f, -1.866041870e-02f, +5.272765217e-02f, +1.586790922e-01f, +2.518341522e-01f, +2.823201223e-01f, +2.327950895e-01f, +1.312062799e-01f, +3.035103267e-02f, -2.836041007e-02f, -3.765599422e-02f, -1.895882060e-02f, +8.476165560e-04f, +8.376206823e-03f, +5.864617557e-03f, +1.322056610e-03f, -6.493280747e-04f, - /* 24,15 */ -5.469834647e-04f, -5.037148469e-04f, +2.036121529e-03f, +6.721048149e-03f, +7.948411519e-03f, -2.084809535e-03f, -2.324619800e-02f, -3.892035913e-02f, -2.139810919e-02f, +4.689321837e-02f, +1.518487179e-01f, +2.474326717e-01f, +2.828154582e-01f, +2.379020609e-01f, +1.380982730e-01f, +3.569722776e-02f, -2.624621678e-02f, -3.819819741e-02f, -2.039475337e-02f, -7.779733613e-05f, +8.277197332e-03f, +6.159105160e-03f, +1.548760636e-03f, -6.104492932e-04f, - /* 24, 0 */ -1.197013499e-03f, -3.320493122e-03f, -1.144245270e-03f, +8.577337679e-03f, +1.627759141e-02f, +3.152522439e-03f, -3.255249254e-02f, -5.362651723e-02f, -5.304244056e-03f, +1.253006387e-01f, +2.738089134e-01f, +3.395768433e-01f, +2.738089134e-01f, +1.253006387e-01f, -5.304244056e-03f, -5.362651723e-02f, -3.255249254e-02f, +3.152522439e-03f, +1.627759141e-02f, +8.577337679e-03f, -1.144245270e-03f, -3.320493122e-03f, -1.197013499e-03f, +1.261205705e-04f, - /* 24, 1 */ -1.060573898e-03f, -3.246029352e-03f, -1.514205592e-03f, +7.849505167e-03f, +1.622707505e-02f, +4.797556391e-03f, -3.017446993e-02f, -5.385088872e-02f, -1.098434059e-02f, +1.155960124e-01f, +2.659858985e-01f, +3.393017042e-01f, +2.812897341e-01f, +1.350895441e-01f, +7.263382766e-04f, -5.311639759e-02f, -3.488122370e-02f, +1.404407443e-03f, +1.624118609e-02f, +9.301572693e-03f, -7.399572733e-04f, -3.377916464e-03f, -1.338504197e-03f, +9.901282259e-05f, - /* 24, 2 */ -9.298712414e-04f, -3.156277727e-03f, -1.849729696e-03f, +7.122444811e-03f, +1.609438844e-02f, +6.335978542e-03f, -2.776122262e-02f, -5.380213751e-02f, -1.630850202e-02f, +1.060004951e-01f, +2.578448120e-01f, +3.384771755e-01f, +2.884051592e-01f, +1.449371908e-01f, +7.100538384e-03f, -5.230860749e-02f, -3.714619841e-02f, -4.425295608e-04f, +1.611336946e-02f, +1.001762126e-02f, -3.016869975e-04f, -3.416553196e-03f, -1.484263468e-03f, +6.526428163e-05f, - /* 24, 3 */ -8.054954021e-04f, -3.052984548e-03f, -2.150934111e-03f, +6.400291527e-03f, +1.588450664e-02f, +7.764974256e-03f, -2.532636892e-02f, -5.349351937e-02f, -2.127269005e-02f, +9.653812261e-02f, +2.494105998e-01f, +3.371059190e-01f, +2.951330020e-01f, +1.548174220e-01f, +1.381006797e-02f, -5.119199897e-02f, -3.933260713e-02f, -2.383292518e-03f, +1.588995194e-02f, +1.072069264e-02f, +1.699725421e-04f, -3.434676821e-03f, -1.633412152e-03f, +2.453170435e-05f, - /* 24, 4 */ -6.879416803e-04f, -2.937877889e-03f, -2.418147761e-03f, +5.686932142e-03f, +1.560259046e-02f, +9.082429619e-03f, -2.288303213e-02f, -5.293884648e-02f, -2.587426360e-02f, +8.723205545e-02f, +2.407089312e-01f, +3.351923590e-01f, +3.014521813e-01f, +1.647035561e-01f, +2.084522321e-02f, -4.975626781e-02f, -4.142535273e-02f, -4.412143180e-03f, +1.556708209e-02f, +1.140581394e-02f, +6.741710759e-04f, -3.430594409e-03f, -1.784975276e-03f, -2.348660763e-05f, - /* 24, 5 */ -5.776128643e-04f, -2.812656385e-03f, -2.651898517e-03f, +4.985994150e-03f, +1.525394912e-02f, +1.028691298e-02f, -2.044379769e-02f, -5.215241275e-02f, -3.011195925e-02f, +7.810450253e-02f, +2.317660961e-01f, +3.327426635e-01f, +3.073428069e-01f, +1.745684830e-01f, +2.819489579e-02f, -4.799202051e-02f, -4.340911052e-02f, -6.522599631e-03f, +1.514128438e-02f, +1.206785167e-02f, +1.209792693e-03f, -3.402660968e-03f, -1.937883690e-03f, -7.904503123e-05f, - /* 24, 6 */ -4.748218959e-04f, -2.678978820e-03f, -2.852899102e-03f, +4.300836533e-03f, +1.484400357e-02f, +1.137765361e-02f, -1.802067434e-02f, -5.114891871e-02f, -3.398586582e-02f, +6.917664952e-02f, +2.226089010e-01f, +3.297647184e-01f, +3.127862620e-01f, +1.843847637e-01f, +3.584659036e-02f, -4.589083871e-02f, -4.526839113e-02f, -8.707438641e-03f, +1.460949637e-02f, +1.270153536e-02f, +1.775448814e-03f, -3.349294247e-03f, -2.090976552e-03f, -1.423449116e-04f, - /* 24, 7 */ -3.797950945e-04f, -2.538454547e-03f, -3.022032460e-03f, +3.634542645e-03f, +1.437825069e-02f, +1.235451773e-02f, -1.562505912e-02f, -4.994339647e-02f, -3.749739364e-02f, +6.046859273e-02f, +2.132645624e-01f, +3.262680950e-01f, +3.177652787e-01f, +1.941247325e-01f, +4.378644843e-02f, -4.344534054e-02f, -4.698760595e-02f, -1.095870195e-02f, +1.396910503e-02f, +1.330148306e-02f, +2.369472628e-03f, -3.268989872e-03f, -2.243004675e-03f, -2.135289700e-04f, - /* 24, 8 */ -2.926758839e-04f, -2.392634763e-03f, -3.160336722e-03f, +2.989915102e-03f, +1.386222860e-02f, +1.321798203e-02f, -1.326770657e-02f, -4.855113496e-02f, -4.064923848e-02f, +5.199927852e-02f, +2.037606007e-01f, +3.222640100e-01f, +3.222640100e-01f, +2.037606007e-01f, +5.199927852e-02f, -4.064923848e-02f, -4.855113496e-02f, -1.326770657e-02f, +1.321798203e-02f, +1.386222860e-02f, +2.989915102e-03f, -3.160336722e-03f, -2.392634763e-03f, -2.926758839e-04f, - /* 24, 9 */ -2.135289700e-04f, -2.243004675e-03f, -3.268989872e-03f, +2.369472628e-03f, +1.330148306e-02f, +1.396910503e-02f, -1.095870195e-02f, -4.698760595e-02f, -4.344534054e-02f, +4.378644843e-02f, +1.941247325e-01f, +3.177652787e-01f, +3.262680950e-01f, +2.132645624e-01f, +6.046859273e-02f, -3.749739364e-02f, -4.994339647e-02f, -1.562505912e-02f, +1.235451773e-02f, +1.437825069e-02f, +3.634542645e-03f, -3.022032460e-03f, -2.538454547e-03f, -3.797950945e-04f, - /* 24,10 */ -1.423449116e-04f, -2.090976552e-03f, -3.349294247e-03f, +1.775448814e-03f, +1.270153536e-02f, +1.460949637e-02f, -8.707438641e-03f, -4.526839113e-02f, -4.589083871e-02f, +3.584659036e-02f, +1.843847637e-01f, +3.127862620e-01f, +3.297647184e-01f, +2.226089010e-01f, +6.917664952e-02f, -3.398586582e-02f, -5.114891871e-02f, -1.802067434e-02f, +1.137765361e-02f, +1.484400357e-02f, +4.300836533e-03f, -2.852899102e-03f, -2.678978820e-03f, -4.748218959e-04f, - /* 24,11 */ -7.904503123e-05f, -1.937883690e-03f, -3.402660968e-03f, +1.209792693e-03f, +1.206785167e-02f, +1.514128438e-02f, -6.522599631e-03f, -4.340911052e-02f, -4.799202051e-02f, +2.819489579e-02f, +1.745684830e-01f, +3.073428069e-01f, +3.327426635e-01f, +2.317660961e-01f, +7.810450253e-02f, -3.011195925e-02f, -5.215241275e-02f, -2.044379769e-02f, +1.028691298e-02f, +1.525394912e-02f, +4.985994150e-03f, -2.651898517e-03f, -2.812656385e-03f, -5.776128643e-04f, - /* 24,12 */ -2.348660763e-05f, -1.784975276e-03f, -3.430594409e-03f, +6.741710759e-04f, +1.140581394e-02f, +1.556708209e-02f, -4.412143180e-03f, -4.142535273e-02f, -4.975626781e-02f, +2.084522321e-02f, +1.647035561e-01f, +3.014521813e-01f, +3.351923590e-01f, +2.407089312e-01f, +8.723205545e-02f, -2.587426360e-02f, -5.293884648e-02f, -2.288303213e-02f, +9.082429619e-03f, +1.560259046e-02f, +5.686932142e-03f, -2.418147761e-03f, -2.937877889e-03f, -6.879416803e-04f, - /* 24,13 */ +2.453170435e-05f, -1.633412152e-03f, -3.434676821e-03f, +1.699725421e-04f, +1.072069264e-02f, +1.588995194e-02f, -2.383292518e-03f, -3.933260713e-02f, -5.119199897e-02f, +1.381006797e-02f, +1.548174220e-01f, +2.951330020e-01f, +3.371059190e-01f, +2.494105998e-01f, +9.653812261e-02f, -2.127269005e-02f, -5.349351937e-02f, -2.532636892e-02f, +7.764974256e-03f, +1.588450664e-02f, +6.400291527e-03f, -2.150934111e-03f, -3.052984548e-03f, -8.054954021e-04f, - /* 24,14 */ +6.526428163e-05f, -1.484263468e-03f, -3.416553196e-03f, -3.016869975e-04f, +1.001762126e-02f, +1.611336946e-02f, -4.425295608e-04f, -3.714619841e-02f, -5.230860749e-02f, +7.100538384e-03f, +1.449371908e-01f, +2.884051592e-01f, +3.384771755e-01f, +2.578448120e-01f, +1.060004951e-01f, -1.630850202e-02f, -5.380213751e-02f, -2.776122262e-02f, +6.335978542e-03f, +1.609438844e-02f, +7.122444811e-03f, -1.849729696e-03f, -3.156277727e-03f, -9.298712414e-04f, - /* 24,15 */ +9.901282259e-05f, -1.338504197e-03f, -3.377916464e-03f, -7.399572733e-04f, +9.301572693e-03f, +1.624118609e-02f, +1.404407443e-03f, -3.488122370e-02f, -5.311639759e-02f, +7.263382766e-04f, +1.350895441e-01f, +2.812897341e-01f, +3.393017042e-01f, +2.659858985e-01f, +1.155960124e-01f, -1.098434059e-02f, -5.385088872e-02f, -3.017446993e-02f, +4.797556391e-03f, +1.622707505e-02f, +7.849505167e-03f, -1.514205592e-03f, -3.246029352e-03f, -1.060573898e-03f, - /* 20, 0 */ -4.161478318e-03f, -1.410215661e-03f, +1.216462436e-02f, +1.839753508e-02f, -1.019572218e-02f, -5.576407638e-02f, -3.857794503e-02f, +9.869941459e-02f, +2.903842315e-01f, +3.819037908e-01f, +2.903842315e-01f, +9.869941459e-02f, -3.857794503e-02f, -5.576407638e-02f, -1.019572218e-02f, +1.839753508e-02f, +1.216462436e-02f, -1.410215661e-03f, -4.161478318e-03f, -1.002136091e-03f, - /* 20, 1 */ -4.024812873e-03f, -1.935046598e-03f, +1.120868183e-02f, +1.884704309e-02f, -7.349314558e-03f, -5.377462232e-02f, -4.306909662e-02f, +8.713841011e-02f, +2.797272456e-01f, +3.815142140e-01f, +3.006231905e-01f, +1.105090175e-01f, -3.357053763e-02f, -5.750258783e-02f, -1.313424017e-02f, +1.779561475e-02f, +1.309754391e-02f, -8.338854378e-04f, -4.274968522e-03f, -1.184613130e-03f, - /* 20, 2 */ -3.867923854e-03f, -2.407896178e-03f, +1.023778220e-02f, +1.914947854e-02f, -4.608279480e-03f, -5.155911253e-02f, -4.704785126e-02f, +7.585987841e-02f, +2.686929243e-01f, +3.803470604e-01f, +3.104047352e-01f, +1.225315522e-01f, -2.804532708e-02f, -5.896552129e-02f, -1.615031726e-02f, +1.703673197e-02f, +1.399907244e-02f, -2.069933478e-04f, -4.362323551e-03f, -1.376799150e-03f, - /* 20, 3 */ -3.693729756e-03f, -2.828715617e-03f, +9.259646102e-03f, +1.931089692e-02f, -1.984565051e-03f, -4.914254142e-02f, -5.052030051e-02f, +6.489576800e-02f, +2.573230589e-01f, +3.784070525e-01f, +3.196909791e-01f, +1.347297046e-01f, -2.200314505e-02f, -6.012863981e-02f, -1.922814732e-02f, +1.611719780e-02f, +1.486058724e-02f, +4.690483654e-04f, -4.420601658e-03f, -1.577606548e-03f, - /* 20, 4 */ -3.505092707e-03f, -3.197865053e-03f, +8.281610454e-03f, +1.933799402e-02f, +5.112106557e-04f, -4.654987033e-02f, -5.349467921e-02f, +5.427598051e-02f, +2.456603330e-01f, +3.757020336e-01f, +3.284457292e-01f, +1.470646693e-01f, -1.544725782e-02f, -6.096825350e-02f, -2.235071271e-02f, +1.503425320e-02f, +1.567326271e-02f, +1.192336051e-03f, -4.446907145e-03f, -1.785766437e-03f, - /* 20, 5 */ -3.304797071e-03f, -3.516087186e-03f, +7.310594668e-03f, +1.923802927e-02f, +2.869766685e-03f, -4.380589142e-02f, -5.598126618e-02f, +4.402826232e-02f, +2.337481127e-01f, +3.722429273e-01f, +3.366346688e-01f, +1.594963158e-01f, -8.383409345e-03f, -6.146136934e-02f, -2.549983702e-02f, +1.378613431e-02f, +1.642812632e-02f, +1.960461229e-03f, -4.438419451e-03f, -1.999828319e-03f, - /* 20, 6 */ -3.095529963e-03f, -3.784479230e-03f, +6.353071566e-03f, +1.901874863e-02f, +5.083157654e-03f, -4.093509653e-02f, -5.799227582e-02f, +3.417810958e-02f, +2.216302330e-01f, +3.680436800e-01f, +3.442255330e-01f, +1.719833640e-01f, -8.198514564e-04f, -6.158584092e-02f, -2.865624686e-02f, +1.237213363e-02f, +1.711611824e-02f, +2.770500592e-03f, -4.392423280e-03f, -2.218161540e-03f, - /* 20, 7 */ -2.879863731e-03f, -4.004463491e-03f, +5.415043050e-03f, +1.868830751e-02f, +7.144763866e-03f, -3.796155187e-02f, -5.954174144e-02f, +2.474868675e-02f, +2.093507858e-01f, +3.631211887e-01f, +3.511882735e-01f, +1.844835679e-01f, +7.232639407e-03f, -6.132051750e-02f, -3.179964276e-02f, +1.079265669e-02f, +1.772815465e-02f, +3.619009684e-03f, -4.306339536e-03f, -2.438958613e-03f, - /* 20, 8 */ -2.660240473e-03f, -4.177756859e-03f, +4.502020476e-03f, +1.825519424e-02f, +9.049273418e-03f, -3.490877898e-02f, -6.064539119e-02f, +1.576075912e-02f, +1.969539074e-01f, +3.574952133e-01f, +3.574952133e-01f, +1.969539074e-01f, +1.576075912e-02f, -6.064539119e-02f, -3.490877898e-02f, +9.049273418e-03f, +1.825519424e-02f, +4.502020476e-03f, -4.177756859e-03f, -2.660240473e-03f, - /* 20, 9 */ -2.438958613e-03f, -4.306339536e-03f, +3.619009684e-03f, +1.772815465e-02f, +1.079265669e-02f, -3.179964276e-02f, -6.132051750e-02f, +7.232639407e-03f, +1.844835679e-01f, +3.511882735e-01f, +3.631211887e-01f, +2.093507858e-01f, +2.474868675e-02f, -5.954174144e-02f, -3.796155187e-02f, +7.144763866e-03f, +1.868830751e-02f, +5.415043050e-03f, -4.004463491e-03f, -2.879863731e-03f, - /* 20,10 */ -2.218161540e-03f, -4.392423280e-03f, +2.770500592e-03f, +1.711611824e-02f, +1.237213363e-02f, -2.865624686e-02f, -6.158584092e-02f, -8.198514564e-04f, +1.719833640e-01f, +3.442255330e-01f, +3.680436800e-01f, +2.216302330e-01f, +3.417810958e-02f, -5.799227582e-02f, -4.093509653e-02f, +5.083157654e-03f, +1.901874863e-02f, +6.353071566e-03f, -3.784479230e-03f, -3.095529963e-03f, - /* 20,11 */ -1.999828319e-03f, -4.438419451e-03f, +1.960461229e-03f, +1.642812632e-02f, +1.378613431e-02f, -2.549983702e-02f, -6.146136934e-02f, -8.383409345e-03f, +1.594963158e-01f, +3.366346688e-01f, +3.722429273e-01f, +2.337481127e-01f, +4.402826232e-02f, -5.598126618e-02f, -4.380589142e-02f, +2.869766685e-03f, +1.923802927e-02f, +7.310594668e-03f, -3.516087186e-03f, -3.304797071e-03f, - /* 20,12 */ -1.785766437e-03f, -4.446907145e-03f, +1.192336051e-03f, +1.567326271e-02f, +1.503425320e-02f, -2.235071271e-02f, -6.096825350e-02f, -1.544725782e-02f, +1.470646693e-01f, +3.284457292e-01f, +3.757020336e-01f, +2.456603330e-01f, +5.427598051e-02f, -5.349467921e-02f, -4.654987033e-02f, +5.112106557e-04f, +1.933799402e-02f, +8.281610454e-03f, -3.197865053e-03f, -3.505092707e-03f, - /* 20,13 */ -1.577606548e-03f, -4.420601658e-03f, +4.690483654e-04f, +1.486058724e-02f, +1.611719780e-02f, -1.922814732e-02f, -6.012863981e-02f, -2.200314505e-02f, +1.347297046e-01f, +3.196909791e-01f, +3.784070525e-01f, +2.573230589e-01f, +6.489576800e-02f, -5.052030051e-02f, -4.914254142e-02f, -1.984565051e-03f, +1.931089692e-02f, +9.259646102e-03f, -2.828715617e-03f, -3.693729756e-03f, - /* 20,14 */ -1.376799150e-03f, -4.362323551e-03f, -2.069933478e-04f, +1.399907244e-02f, +1.703673197e-02f, -1.615031726e-02f, -5.896552129e-02f, -2.804532708e-02f, +1.225315522e-01f, +3.104047352e-01f, +3.803470604e-01f, +2.686929243e-01f, +7.585987841e-02f, -4.704785126e-02f, -5.155911253e-02f, -4.608279480e-03f, +1.914947854e-02f, +1.023778220e-02f, -2.407896178e-03f, -3.867923854e-03f, - /* 20,15 */ -1.184613130e-03f, -4.274968522e-03f, -8.338854378e-04f, +1.309754391e-02f, +1.779561475e-02f, -1.313424017e-02f, -5.750258783e-02f, -3.357053763e-02f, +1.105090175e-01f, +3.006231905e-01f, +3.815142140e-01f, +2.797272456e-01f, +8.713841011e-02f, -4.306909662e-02f, -5.377462232e-02f, -7.349314558e-03f, +1.884704309e-02f, +1.120868183e-02f, -1.935046598e-03f, -4.024812873e-03f, - /* 20, 0 */ -1.329352252e-03f, -4.865562069e-03f, +1.662947600e-03f, +1.893743982e-02f, +1.052975469e-02f, -4.314924294e-02f, -6.168215525e-02f, +6.793829558e-02f, +3.007295231e-01f, +4.214013440e-01f, +3.007295231e-01f, +6.793829558e-02f, -6.168215525e-02f, -4.314924294e-02f, +1.052975469e-02f, +1.893743982e-02f, +1.662947600e-03f, -4.865562069e-03f, -1.329352252e-03f, +0.000000000e+00f, - /* 20, 1 */ -1.106503038e-03f, -4.784011640e-03f, +7.620481209e-04f, +1.810159639e-02f, +1.258770510e-02f, -3.946126222e-02f, -6.412166469e-02f, +5.516844650e-02f, +2.870012762e-01f, +4.208780002e-01f, +3.139874692e-01f, +8.118253044e-02f, -5.860314053e-02f, -4.671882663e-02f, +8.254179692e-03f, +1.967037055e-02f, +2.622520317e-03f, -4.905078775e-03f, -1.565095816e-03f, +0.000000000e+00f, - /* 20, 2 */ -8.979094201e-04f, -4.664743082e-03f, -7.633034189e-05f, +1.717630323e-02f, +1.442449893e-02f, -3.568911340e-02f, -6.594250862e-02f, +4.291292121e-02f, +2.728656387e-01f, +4.193105477e-01f, +3.267137817e-01f, +9.485763802e-02f, -5.486676259e-02f, -5.013477905e-02f, +5.766539049e-03f, +2.028700325e-02f, +3.636071544e-03f, -4.898357639e-03f, -1.812078842e-03f, +3.513221827e-04f, - /* 20, 3 */ -7.046452899e-04f, -4.512131585e-03f, -8.491713087e-04f, +1.617498084e-02f, +1.603855621e-02f, -3.186582692e-02f, -6.716828458e-02f, +3.120792005e-02f, +2.583867198e-01f, +4.167067067e-01f, +3.388490774e-01f, +1.089167196e-01f, -5.045835457e-02f, -5.336106841e-02f, +3.074480429e-03f, +2.077415592e-02f, +4.698051453e-03f, -4.841360048e-03f, -2.068349661e-03f, +3.288882594e-04f, - /* 20, 4 */ -5.275063595e-04f, -4.330562617e-03f, -1.554266965e-03f, +1.511089362e-02f, +1.743016199e-02f, -2.802305698e-02f, -6.782511100e-02f, +2.008577030e-02f, +2.436294448e-01f, +4.130792899e-01f, +3.503362849e-01f, +1.233097059e-01f, -4.536663323e-02f, -5.636108634e-02f, +1.877878266e-04f, +2.111898038e-02f, +5.802054958e-03f, -4.730268616e-03f, -2.331660076e-03f, +2.941732022e-04f, - /* 20, 5 */ -3.670219514e-04f, -4.124385552e-03f, -2.190189120e-03f, +1.399704337e-02f, +1.860136846e-02f, -2.419092016e-02f, -6.794137953e-02f, +9.574818877e-03f, +2.286591711e-01f, +4.084461208e-01f, +3.611209950e-01f, +1.379835966e-01f, -3.958387309e-02f, -5.909788086e-02f, -2.881585959e-03f, +2.130909659e-02f, +6.940829951e-03f, -4.561544087e-03f, -2.599469210e-03f, +2.461206998e-04f, - /* 20, 6 */ -2.234691091e-04f, -3.897870552e-03f, -2.756254356e-03f, +1.284607053e-02f, +1.955588746e-02f, -2.039785121e-02f, -6.754749865e-02f, -3.006469464e-04f, +2.135413047e-01f, +4.028299211e-01f, +3.711517965e-01f, +1.528827232e-01f, -3.310606021e-02f, -6.153439984e-02f, -6.119502817e-03f, +2.133272965e-02f, +8.106294302e-03f, -4.331982887e-03f, -2.868951124e-03f, +1.837671888e-04f, - /* 20, 7 */ -9.688872179e-05f, -3.655168976e-03f, -3.252484018e-03f, +1.167016373e-02f, +2.029897446e-02f, -1.667047641e-02f, -6.667563061e-02f, -9.520450398e-03f, +1.983409219e-01f, +3.962581664e-01f, +3.803805952e-01f, +1.679490334e-01f, -2.593302438e-02f, -6.363374348e-02f, -9.509639499e-03f, +2.117884859e-02f, +9.289561904e-03f, -4.038774728e-03f, -3.137006363e-03f, +1.062635081e-04f, - /* 20, 8 */ +1.289664191e-05f, -3.400277535e-03f, -3.679559671e-03f, +1.048097797e-02f, +2.083730557e-02f, -1.303350512e-02f, -6.535942396e-02f, -1.806854797e-02f, +1.831223958e-01f, +3.887629129e-01f, +3.887629129e-01f, +1.831223958e-01f, -1.806854797e-02f, -6.535942396e-02f, -1.303350512e-02f, +2.083730557e-02f, +1.048097797e-02f, -3.679559671e-03f, -3.400277535e-03f, +1.289664191e-05f, - /* 20, 9 */ +1.062635081e-04f, -3.137006363e-03f, -4.038774728e-03f, +9.289561904e-03f, +2.117884859e-02f, -9.509639499e-03f, -6.363374348e-02f, -2.593302438e-02f, +1.679490334e-01f, +3.803805952e-01f, +3.962581664e-01f, +1.983409219e-01f, -9.520450398e-03f, -6.667563061e-02f, -1.667047641e-02f, +2.029897446e-02f, +1.167016373e-02f, -3.252484018e-03f, -3.655168976e-03f, -9.688872179e-05f, - /* 20,10 */ +1.837671888e-04f, -2.868951124e-03f, -4.331982887e-03f, +8.106294302e-03f, +2.133272965e-02f, -6.119502817e-03f, -6.153439984e-02f, -3.310606021e-02f, +1.528827232e-01f, +3.711517965e-01f, +4.028299211e-01f, +2.135413047e-01f, -3.006469464e-04f, -6.754749865e-02f, -2.039785121e-02f, +1.955588746e-02f, +1.284607053e-02f, -2.756254356e-03f, -3.897870552e-03f, -2.234691091e-04f, - /* 20,11 */ +2.461206998e-04f, -2.599469210e-03f, -4.561544087e-03f, +6.940829951e-03f, +2.130909659e-02f, -2.881585959e-03f, -5.909788086e-02f, -3.958387309e-02f, +1.379835966e-01f, +3.611209950e-01f, +4.084461208e-01f, +2.286591711e-01f, +9.574818877e-03f, -6.794137953e-02f, -2.419092016e-02f, +1.860136846e-02f, +1.399704337e-02f, -2.190189120e-03f, -4.124385552e-03f, -3.670219514e-04f, - /* 20,12 */ +2.941732022e-04f, -2.331660076e-03f, -4.730268616e-03f, +5.802054958e-03f, +2.111898038e-02f, +1.877878266e-04f, -5.636108634e-02f, -4.536663323e-02f, +1.233097059e-01f, +3.503362849e-01f, +4.130792899e-01f, +2.436294448e-01f, +2.008577030e-02f, -6.782511100e-02f, -2.802305698e-02f, +1.743016199e-02f, +1.511089362e-02f, -1.554266965e-03f, -4.330562617e-03f, -5.275063595e-04f, - /* 20,13 */ +3.288882594e-04f, -2.068349661e-03f, -4.841360048e-03f, +4.698051453e-03f, +2.077415592e-02f, +3.074480429e-03f, -5.336106841e-02f, -5.045835457e-02f, +1.089167196e-01f, +3.388490774e-01f, +4.167067067e-01f, +2.583867198e-01f, +3.120792005e-02f, -6.716828458e-02f, -3.186582692e-02f, +1.603855621e-02f, +1.617498084e-02f, -8.491713087e-04f, -4.512131585e-03f, -7.046452899e-04f, - /* 20,14 */ +3.513221827e-04f, -1.812078842e-03f, -4.898357639e-03f, +3.636071544e-03f, +2.028700325e-02f, +5.766539049e-03f, -5.013477905e-02f, -5.486676259e-02f, +9.485763802e-02f, +3.267137817e-01f, +4.193105477e-01f, +2.728656387e-01f, +4.291292121e-02f, -6.594250862e-02f, -3.568911340e-02f, +1.442449893e-02f, +1.717630323e-02f, -7.633034189e-05f, -4.664743082e-03f, -8.979094201e-04f, - /* 20,15 */ +0.000000000e+00f, -1.565095816e-03f, -4.905078775e-03f, +2.622520317e-03f, +1.967037055e-02f, +8.254179692e-03f, -4.671882663e-02f, -5.860314053e-02f, +8.118253044e-02f, +3.139874692e-01f, +4.208780002e-01f, +2.870012762e-01f, +5.516844650e-02f, -6.412166469e-02f, -3.946126222e-02f, +1.258770510e-02f, +1.810159639e-02f, +7.620481209e-04f, -4.784011640e-03f, -1.106503038e-03f, - /* 20, 0 */ +3.735125865e-04f, -2.550984103e-03f, -4.871486096e-03f, +1.016287769e-02f, +2.252246682e-02f, -2.231523982e-02f, -7.431762424e-02f, +3.414137659e-02f, +3.062278786e-01f, +4.608988972e-01f, +3.062278786e-01f, +3.414137659e-02f, -7.431762424e-02f, -2.231523982e-02f, +2.252246682e-02f, +1.016287769e-02f, -4.871486096e-03f, -2.550984103e-03f, +3.735125865e-04f, +0.000000000e+00f, - /* 20, 1 */ +3.929324583e-04f, -2.236335973e-03f, -5.106050653e-03f, +8.748210493e-03f, +2.303691111e-02f, -1.786093260e-02f, -7.411924916e-02f, +2.086992015e-02f, +2.890848421e-01f, +4.602142272e-01f, +3.228796668e-01f, +4.817530421e-02f, -7.382833631e-02f, -2.685541297e-02f, +2.174514756e-02f, +1.158816420e-02f, -4.555417854e-03f, -2.871502680e-03f, +3.387491377e-04f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, -1.931175707e-03f, -5.263447672e-03f, +7.357928950e-03f, +2.330080531e-02f, -1.352771902e-02f, -7.327813327e-02f, +8.401230311e-03f, +2.715429904e-01f, +4.581642525e-01f, +3.389493512e-01f, +6.292517925e-02f, -7.260941515e-02f, -3.144322519e-02f, +2.069454672e-02f, +1.300917115e-02f, -4.154170312e-03f, -3.193828376e-03f, +2.870815261e-04f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, -1.638662038e-03f, -5.348575554e-03f, +6.004591146e-03f, +2.332816092e-02f, -9.347674729e-03f, -7.184169597e-02f, -3.230759097e-03f, +2.536956771e-01f, +4.547610488e-01f, +3.543483057e-01f, +7.833843581e-02f, -7.062228683e-02f, -3.603763775e-02f, +1.936240016e-02f, +1.440996064e-02f, -3.664825055e-03f, -3.513472060e-03f, +2.170808154e-04f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, -1.361489293e-03f, -5.366796329e-03f, +4.699488665e-03f, +2.313444000e-02f, -5.349604768e-03f, -6.985939290e-02f, -1.399855627e-02f, +2.356365195e-01f, +4.500246402e-01f, +3.689907742e-01f, +9.435670405e-02f, -6.783220328e-02f, -4.059502103e-02f, +1.774280068e-02f, +1.577366666e-02f, -3.085314600e-03f, -3.825546457e-03f, +1.274866066e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, -1.101888322e-03f, -5.323837897e-03f, +3.452605627e-03f, +2.273631696e-02f, -1.558959414e-03f, -6.738225311e-02f, -2.388113922e-02f, +2.174587480e-01f, +4.439828472e-01f, +3.827944964e-01f, +1.109160995e-01f, -6.420865295e-02f, -4.506940842e-02f, +1.583239979e-02f, +1.708262332e-02f, -2.414511840e-03f, -4.124801502e-03f, +1.724424543e-05f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, -8.616336525e-04f, -5.225698259e-03f, +2.272594520e-03f, +2.215144089e-02f, +2.002216238e-03f, -6.446241843e-02f, -3.286393171e-02f, +1.992545658e-01f, +4.366710759e-01f, +3.956813102e-01f, +1.279475618e-01f, -5.972574809e-02f, -4.941278189e-02f, +1.363059437e-02f, +1.831850983e-02f, -1.652313816e-03f, -4.405667401e-03f, -1.144582079e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, -6.420563626e-04f, -5.078552799e-03f, +1.166768183e-03f, +2.139820068e-02f, +5.315299677e-03f, -6.115268907e-02f, -4.093872873e-02f, +1.811145256e-01f, +4.281320500e-01f, +4.075777294e-01f, +1.453772407e-01f, -5.436258502e-02f, -5.357538755e-02f, +1.113969540e-02f, +1.946251142e-02f, -7.997184460e-04f, -4.662305323e-03f, -2.681538305e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, -4.440621234e-04f, -4.888665552e-03f, +1.411071672e-04f, +2.049549532e-02f, +8.365076494e-03f, -5.750607943e-02f, -4.810357305e-02f, +1.631269271e-01f, +4.184154881e-01f, +4.184154881e-01f, +1.631269271e-01f, -4.810357305e-02f, -5.750607943e-02f, +8.365076494e-03f, +2.049549532e-02f, +1.411071672e-04f, -4.888665552e-03f, -4.440621234e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, -2.681538305e-04f, -4.662305323e-03f, -7.997184460e-04f, +1.946251142e-02f, +1.113969540e-02f, -5.357538755e-02f, -5.436258502e-02f, +1.453772407e-01f, +4.075777294e-01f, +4.281320500e-01f, +1.811145256e-01f, -4.093872873e-02f, -6.115268907e-02f, +5.315299677e-03f, +2.139820068e-02f, +1.166768183e-03f, -5.078552799e-03f, -6.420563626e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, -1.144582079e-04f, -4.405667401e-03f, -1.652313816e-03f, +1.831850983e-02f, +1.363059437e-02f, -4.941278189e-02f, -5.972574809e-02f, +1.279475618e-01f, +3.956813102e-01f, +4.366710759e-01f, +1.992545658e-01f, -3.286393171e-02f, -6.446241843e-02f, +2.002216238e-03f, +2.215144089e-02f, +2.272594520e-03f, -5.225698259e-03f, -8.616336525e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, +1.724424543e-05f, -4.124801502e-03f, -2.414511840e-03f, +1.708262332e-02f, +1.583239979e-02f, -4.506940842e-02f, -6.420865295e-02f, +1.109160995e-01f, +3.827944964e-01f, +4.439828472e-01f, +2.174587480e-01f, -2.388113922e-02f, -6.738225311e-02f, -1.558959414e-03f, +2.273631696e-02f, +3.452605627e-03f, -5.323837897e-03f, -1.101888322e-03f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, +1.274866066e-04f, -3.825546457e-03f, -3.085314600e-03f, +1.577366666e-02f, +1.774280068e-02f, -4.059502103e-02f, -6.783220328e-02f, +9.435670405e-02f, +3.689907742e-01f, +4.500246402e-01f, +2.356365195e-01f, -1.399855627e-02f, -6.985939290e-02f, -5.349604768e-03f, +2.313444000e-02f, +4.699488665e-03f, -5.366796329e-03f, -1.361489293e-03f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, +2.170808154e-04f, -3.513472060e-03f, -3.664825055e-03f, +1.440996064e-02f, +1.936240016e-02f, -3.603763775e-02f, -7.062228683e-02f, +7.833843581e-02f, +3.543483057e-01f, +4.547610488e-01f, +2.536956771e-01f, -3.230759097e-03f, -7.184169597e-02f, -9.347674729e-03f, +2.332816092e-02f, +6.004591146e-03f, -5.348575554e-03f, -1.638662038e-03f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, +2.870815261e-04f, -3.193828376e-03f, -4.154170312e-03f, +1.300917115e-02f, +2.069454672e-02f, -3.144322519e-02f, -7.260941515e-02f, +6.292517925e-02f, +3.389493512e-01f, +4.581642525e-01f, +2.715429904e-01f, +8.401230311e-03f, -7.327813327e-02f, -1.352771902e-02f, +2.330080531e-02f, +7.357928950e-03f, -5.263447672e-03f, -1.931175707e-03f, +0.000000000e+00f, - /* 20,15 */ +0.000000000e+00f, +3.387491377e-04f, -2.871502680e-03f, -4.555417854e-03f, +1.158816420e-02f, +2.174514756e-02f, -2.685541297e-02f, -7.382833631e-02f, +4.817530421e-02f, +3.228796668e-01f, +4.602142272e-01f, +2.890848421e-01f, +2.086992015e-02f, -7.411924916e-02f, -1.786093260e-02f, +2.303691111e-02f, +8.748210493e-03f, -5.106050653e-03f, -2.236335973e-03f, +3.929324583e-04f, - /* 16, 0 */ -4.898743621e-03f, -8.679086087e-05f, +2.336043359e-02f, +2.135055302e-04f, -7.556698393e-02f, -3.418085064e-04f, +3.068350485e-01f, +5.003964504e-01f, +3.068350485e-01f, -3.418085064e-04f, -7.556698393e-02f, +2.135055302e-04f, +2.336043359e-02f, -8.679086087e-05f, -4.898743621e-03f, +1.466795211e-05f, - /* 16, 1 */ -4.577177643e-03f, -1.168030162e-03f, +2.231338881e-02f, +4.259286102e-03f, -7.256190983e-02f, -1.325523148e-02f, +2.859961851e-01f, +4.995203198e-01f, +3.272077887e-01f, +1.366916740e-02f, -7.794631959e-02f, -4.137969722e-03f, +2.421268789e-02f, +1.104119466e-03f, -5.186216174e-03f, -1.424716020e-04f, - /* 16, 2 */ -4.229744004e-03f, -2.135347302e-03f, +2.109817837e-02f, +7.975999347e-03f, -6.900371451e-02f, -2.503996167e-02f, +2.648211478e-01f, +4.968980143e-01f, +3.469854770e-01f, +2.873680235e-02f, -7.962890015e-02f, -8.766610174e-03f, +2.484400873e-02f, +2.398541233e-03f, -5.431090074e-03f, -3.278051009e-04f, - /* 16, 3 */ -3.864289504e-03f, -2.986316790e-03f, +1.974155805e-02f, +1.134537917e-02f, -6.496587406e-02f, -3.567459207e-02f, +2.434398342e-01f, +4.925477372e-01f, +3.660412816e-01f, +4.481051979e-02f, -8.054606315e-02f, -1.363873477e-02f, +2.522910176e-02f, +3.788344934e-03f, -5.624692566e-03f, -5.415628140e-04f, - /* 16, 4 */ -3.488195595e-03f, -3.720237037e-03f, +1.827008292e-02f, +1.435416313e-02f, -6.052200094e-02f, -4.514733704e-02f, +2.219810322e-01f, +4.864996469e-01f, +3.842515379e-01f, +6.183022559e-02f, -8.063225815e-02f, -1.871557408e-02f, +2.534390000e-02f, +5.263393235e-03f, -5.758306879e-03f, -7.834433658e-04f, - /* 16, 5 */ -3.108305495e-03f, -4.338012209e-03f, +1.670979794e-02f, +1.699394035e-02f, -5.574514781e-02f, -5.345583367e-02f, +2.005713869e-01f, +4.787955863e-01f, +4.014968013e-01f, +7.972656727e-02f, -7.982580067e-02f, -2.395339311e-02f, +2.516595041e-02f, +6.811528665e-03f, -5.823306183e-03f, -1.052565974e-03f, - /* 16, 6 */ -2.730865011e-03f, -4.842020290e-03f, +1.508595356e-02f, +1.926095418e-02f, -5.070714412e-02f, -6.060686010e-02f, +1.793344024e-01f, +4.694887096e-01f, +4.176628724e-01f, +9.842128660e-02f, -7.806961406e-02f, -2.930367505e-02f, +2.467480385e-02f, +8.418588685e-03f, -5.811296621e-03f, -1.347428958e-03f, - /* 16, 7 */ -2.361477017e-03f, -5.235970004e-03f, +1.342274837e-02f, +2.115586371e-02f, -4.547797122e-02f, -6.661597542e-02f, +1.583894867e-01f, +4.586430086e-01f, +4.326417845e-01f, +1.178276637e-01f, -7.531195111e-02f, -3.471336612e-02f, +2.385240383e-02f, +1.006844961e-02f, -5.714267850e-03f, -1.665875716e-03f, - /* 16, 8 */ -2.005069351e-03f, -5.524749278e-03f, +1.174310057e-02f, +2.268346885e-02f, -4.012518151e-02f, -7.150708699e-02f, +1.378510501e-01f, +4.463327434e-01f, +4.463327434e-01f, +1.378510501e-01f, -7.150708699e-02f, -4.012518151e-02f, +2.268346885e-02f, +1.174310057e-02f, -5.524749278e-03f, -2.005069351e-03f, - /* 16, 9 */ -1.665875716e-03f, -5.714267850e-03f, +1.006844961e-02f, +2.385240383e-02f, -3.471336612e-02f, -7.531195111e-02f, +1.178276637e-01f, +4.326417845e-01f, +4.586430086e-01f, +1.583894867e-01f, -6.661597542e-02f, -4.547797122e-02f, +2.115586371e-02f, +1.342274837e-02f, -5.235970004e-03f, -2.361477017e-03f, - /* 16,10 */ -1.347428958e-03f, -5.811296621e-03f, +8.418588685e-03f, +2.467480385e-02f, -2.930367505e-02f, -7.806961406e-02f, +9.842128660e-02f, +4.176628724e-01f, +4.694887096e-01f, +1.793344024e-01f, -6.060686010e-02f, -5.070714412e-02f, +1.926095418e-02f, +1.508595356e-02f, -4.842020290e-03f, -2.730865011e-03f, - /* 16,11 */ -1.052565974e-03f, -5.823306183e-03f, +6.811528665e-03f, +2.516595041e-02f, -2.395339311e-02f, -7.982580067e-02f, +7.972656727e-02f, +4.014968013e-01f, +4.787955863e-01f, +2.005713869e-01f, -5.345583367e-02f, -5.574514781e-02f, +1.699394035e-02f, +1.670979794e-02f, -4.338012209e-03f, -3.108305495e-03f, - /* 16,12 */ -7.834433658e-04f, -5.758306879e-03f, +5.263393235e-03f, +2.534390000e-02f, -1.871557408e-02f, -8.063225815e-02f, +6.183022559e-02f, +3.842515379e-01f, +4.864996469e-01f, +2.219810322e-01f, -4.514733704e-02f, -6.052200094e-02f, +1.435416313e-02f, +1.827008292e-02f, -3.720237037e-03f, -3.488195595e-03f, - /* 16,13 */ -5.415628140e-04f, -5.624692566e-03f, +3.788344934e-03f, +2.522910176e-02f, -1.363873477e-02f, -8.054606315e-02f, +4.481051979e-02f, +3.660412816e-01f, +4.925477372e-01f, +2.434398342e-01f, -3.567459207e-02f, -6.496587406e-02f, +1.134537917e-02f, +1.974155805e-02f, -2.986316790e-03f, -3.864289504e-03f, - /* 16,14 */ -3.278051009e-04f, -5.431090074e-03f, +2.398541233e-03f, +2.484400873e-02f, -8.766610174e-03f, -7.962890015e-02f, +2.873680235e-02f, +3.469854770e-01f, +4.968980143e-01f, +2.648211478e-01f, -2.503996167e-02f, -6.900371451e-02f, +7.975999347e-03f, +2.109817837e-02f, -2.135347302e-03f, -4.229744004e-03f, - /* 16,15 */ -1.424716020e-04f, -5.186216174e-03f, +1.104119466e-03f, +2.421268789e-02f, -4.137969722e-03f, -7.794631959e-02f, +1.366916740e-02f, +3.272077887e-01f, +4.995203198e-01f, +2.859961851e-01f, -1.325523148e-02f, -7.256190983e-02f, +4.259286102e-03f, +2.231338881e-02f, -1.168030162e-03f, -4.577177643e-03f, - /* 16, 0 */ -1.854349243e-03f, -5.842655877e-03f, +1.571555836e-02f, +1.847159410e-02f, -6.634453543e-02f, -3.320569278e-02f, +3.025932104e-01f, +5.398940036e-01f, +3.025932104e-01f, -3.320569278e-02f, -6.634453543e-02f, +1.847159410e-02f, +1.571555836e-02f, -5.842655877e-03f, -1.854349243e-03f, +0.000000000e+00f, - /* 16, 1 */ -1.480579358e-03f, -6.106700866e-03f, +1.376986381e-02f, +2.107103425e-02f, -6.084498265e-02f, -4.482173865e-02f, +2.778559558e-01f, +5.387937054e-01f, +3.269511876e-01f, -2.013603096e-02f, -7.140657205e-02f, +1.540395578e-02f, +1.762103499e-02f, -5.450677830e-03f, -2.253515747e-03f, +0.000000000e+00f, - /* 16, 2 */ -1.136163241e-03f, -6.251562574e-03f, +1.181432209e-02f, +2.320368920e-02f, -5.500558000e-02f, -5.497544958e-02f, +2.529151163e-01f, +5.355017071e-01f, +3.507537104e-01f, -5.635398845e-03f, -7.593183970e-02f, +1.187314151e-02f, +1.945395611e-02f, -4.923375547e-03f, -2.673102395e-03f, +0.000000000e+00f, - /* 16, 3 */ -8.240613879e-04f, -6.287094834e-03f, +9.877041313e-03f, +2.487696888e-02f, -4.892141083e-02f, -6.367164518e-02f, +2.279442418e-01f, +5.300446041e-01f, +3.738258052e-01f, +1.025938806e-02f, -7.982055919e-02f, +7.890985370e-03f, +2.118036474e-02f, -4.254967852e-03f, -3.107109230e-03f, +0.000000000e+00f, - /* 16, 4 */ -5.462770218e-04f, -6.224002243e-03f, +7.983624178e-03f, +2.610378910e-02f, -4.268405269e-02f, -7.092815895e-02f, +2.031131300e-01f, +5.224664143e-01f, +3.959953988e-01f, +2.749725254e-02f, -8.297353764e-02f, +3.476439880e-03f, +2.276508169e-02f, -3.441527233e-03f, -3.548528769e-03f, +4.634120047e-04f, - /* 16, 5 */ -3.039101756e-04f, -6.073592210e-03f, +6.156978545e-03f, +2.690203687e-02f, -3.638073666e-02f, -7.677518685e-02f, +1.785862812e-01f, +5.128281199e-01f, +4.170950072e-01f, +4.601292009e-02f, -8.529332152e-02f, -1.344195268e-03f, +2.417214928e-02f, -2.481210963e-03f, -3.989383394e-03f, +4.400286560e-04f, - /* 16, 6 */ -9.722433303e-05f, -5.847536081e-03f, +4.417180930e-03f, +2.729400173e-02f, -3.009359622e-02f, -8.125451993e-02f, +1.545214364e-01f, +5.012070337e-01f, +4.369633957e-01f, +6.572714234e-02f, -8.668537697e-02f, -6.537129252e-03f, +2.536531778e-02f, -1.374474827e-03f, -4.420785166e-03f, +3.921992729e-04f, - /* 16, 7 */ +7.427658644e-05f, -5.557642708e-03f, +2.781391675e-03f, +2.730578215e-02f, -2.389901141e-02f, -8.441867356e-02f, +1.310682124e-01f, +4.876959980e-01f, +4.554471907e-01f, +8.654708074e-02f, -8.705928349e-02f, -1.206102709e-02f, +2.630856978e-02f, -1.242645535e-04f, -4.833018707e-03f, +3.169896142e-04f, - /* 16, 8 */ +2.117631665e-04f, -5.215647395e-03f, +1.263819875e-03f, +2.696667686e-02f, -1.786705263e-02f, -8.632992647e-02f, +1.083668491e-01f, +4.724024249e-01f, +4.724024249e-01f, +1.083668491e-01f, -8.632992647e-02f, -1.786705263e-02f, +2.696667686e-02f, +1.263819875e-03f, -5.215647395e-03f, +2.117631665e-04f, - /* 16, 9 */ +3.169896142e-04f, -4.833018707e-03f, -1.242645535e-04f, +2.630856978e-02f, -1.206102709e-02f, -8.705928349e-02f, +8.654708074e-02f, +4.554471907e-01f, +4.876959980e-01f, +1.310682124e-01f, -8.441867356e-02f, -2.389901141e-02f, +2.730578215e-02f, +2.781391675e-03f, -5.557642708e-03f, +7.427658644e-05f, - /* 16,10 */ +3.921992729e-04f, -4.420785166e-03f, -1.374474827e-03f, +2.536531778e-02f, -6.537129252e-03f, -8.668537697e-02f, +6.572714234e-02f, +4.369633957e-01f, +5.012070337e-01f, +1.545214364e-01f, -8.125451993e-02f, -3.009359622e-02f, +2.729400173e-02f, +4.417180930e-03f, -5.847536081e-03f, -9.722433303e-05f, - /* 16,11 */ +4.400286560e-04f, -3.989383394e-03f, -2.481210963e-03f, +2.417214928e-02f, -1.344195268e-03f, -8.529332152e-02f, +4.601292009e-02f, +4.170950072e-01f, +5.128281199e-01f, +1.785862812e-01f, -7.677518685e-02f, -3.638073666e-02f, +2.690203687e-02f, +6.156978545e-03f, -6.073592210e-03f, -3.039101756e-04f, - /* 16,12 */ +4.634120047e-04f, -3.548528769e-03f, -3.441527233e-03f, +2.276508169e-02f, +3.476439880e-03f, -8.297353764e-02f, +2.749725254e-02f, +3.959953988e-01f, +5.224664143e-01f, +2.031131300e-01f, -7.092815895e-02f, -4.268405269e-02f, +2.610378910e-02f, +7.983624178e-03f, -6.224002243e-03f, -5.462770218e-04f, - /* 16,13 */ +0.000000000e+00f, -3.107109230e-03f, -4.254967852e-03f, +2.118036474e-02f, +7.890985370e-03f, -7.982055919e-02f, +1.025938806e-02f, +3.738258052e-01f, +5.300446041e-01f, +2.279442418e-01f, -6.367164518e-02f, -4.892141083e-02f, +2.487696888e-02f, +9.877041313e-03f, -6.287094834e-03f, -8.240613879e-04f, - /* 16,14 */ +0.000000000e+00f, -2.673102395e-03f, -4.923375547e-03f, +1.945395611e-02f, +1.187314151e-02f, -7.593183970e-02f, -5.635398845e-03f, +3.507537104e-01f, +5.355017071e-01f, +2.529151163e-01f, -5.497544958e-02f, -5.500558000e-02f, +2.320368920e-02f, +1.181432209e-02f, -6.251562574e-03f, -1.136163241e-03f, - /* 16,15 */ +0.000000000e+00f, -2.253515747e-03f, -5.450677830e-03f, +1.762103499e-02f, +1.540395578e-02f, -7.140657205e-02f, -2.013603096e-02f, +3.269511876e-01f, +5.387937054e-01f, +2.778559558e-01f, -4.482173865e-02f, -6.084498265e-02f, +2.107103425e-02f, +1.376986381e-02f, -6.106700866e-03f, -1.480579358e-03f, - /* 16, 0 */ +2.517634455e-04f, -5.956310854e-03f, +5.008864062e-03f, +2.864631470e-02f, -4.909056125e-02f, -6.235528720e-02f, +2.936293584e-01f, +5.793915568e-01f, +2.936293584e-01f, -6.235528720e-02f, -4.909056125e-02f, +2.864631470e-02f, +5.008864062e-03f, -5.956310854e-03f, +2.517634455e-04f, +0.000000000e+00f, - /* 16, 1 */ +3.647589216e-04f, -5.559366521e-03f, +3.110945653e-03f, +2.922667528e-02f, -4.185408685e-02f, -7.174125192e-02f, +2.648835910e-01f, +5.780318135e-01f, +3.221602930e-01f, -5.117389488e-02f, -5.619351824e-02f, +2.755457966e-02f, +7.032385926e-03f, -6.289189967e-03f, +9.939782505e-05f, +0.000000000e+00f, - /* 16, 2 */ +4.414886472e-04f, -5.113535158e-03f, +1.357910925e-03f, +2.932892142e-02f, -3.459618474e-02f, -7.936172697e-02f, +2.361522790e-01f, +5.739652427e-01f, +3.502436629e-01f, -3.818535953e-02f, -6.304412145e-02f, +2.592390265e-02f, +9.158035052e-03f, -6.542440674e-03f, -9.477253367e-05f, +0.000000000e+00f, - /* 16, 3 */ +4.855802427e-04f, -4.633347213e-03f, -2.351453324e-04f, +2.899108127e-02f, -2.742112952e-02f, -8.526380919e-02f, +2.076588264e-01f, +5.672296697e-01f, +3.776458156e-01f, -2.339704980e-02f, -6.951800781e-02f, +2.373330296e-02f, +1.135820669e-02f, -6.700410184e-03f, -3.323676319e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, -4.132457962e-03f, -1.657230762e-03f, +2.825501306e-02f, -2.042447313e-02f, -8.951050933e-02f, +1.796184274e-01f, +5.578876325e-01f, +4.041347532e-01f, -6.836060229e-03f, -7.548664793e-02f, +2.096923455e-02f, +1.360131724e-02f, -6.747680557e-03f, -6.140535745e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, -3.623457200e-03f, -2.901306411e-03f, +2.716546883e-02f, -1.369230379e-02f, -9.217934767e-02f, +1.522358833e-01f, +5.460256322e-01f, +4.294827240e-01f, +1.145038182e-02f, -8.081883229e-02f, +1.762637069e-02f, +1.585203938e-02f, -6.669417793e-03f, -9.394126333e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, -3.117716971e-03f, -3.964078879e-03f, +2.576917487e-02f, -7.300675124e-03f, -9.336081470e-02f, +1.257035893e-01f, +5.317530991e-01f, +4.534687988e-01f, +3.139475616e-02f, -8.538226676e-02f, +1.370830904e-02f, +1.807162423e-02f, -6.451740247e-03f, -1.306826648e-03f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, -2.625277441e-03f, -4.845741482e-03f, +2.411394259e-02f, -1.315205805e-03f, -9.315672206e-02f, +1.001997139e-01f, +5.152010878e-01f, +4.758813956e-01f, +5.290934542e-02f, -8.904525833e-02f, +9.228181275e-03f, +2.021831098e-02f, -6.082100328e-03f, -1.713377737e-03f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, -2.154770219e-03f, -5.549672684e-03f, +2.224782226e-02f, +4.209152176e-03f, -9.167847004e-02f, +7.588659143e-02f, +4.965207199e-01f, +4.965207199e-01f, +7.588659143e-02f, -9.167847004e-02f, +4.209152176e-03f, +2.224782226e-02f, -5.549672684e-03f, -2.154770219e-03f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, -1.713377737e-03f, -6.082100328e-03f, +2.021831098e-02f, +9.228181275e-03f, -8.904525833e-02f, +5.290934542e-02f, +4.758813956e-01f, +5.152010878e-01f, +1.001997139e-01f, -9.315672206e-02f, -1.315205805e-03f, +2.411394259e-02f, -4.845741482e-03f, -2.625277441e-03f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, -1.306826648e-03f, -6.451740247e-03f, +1.807162423e-02f, +1.370830904e-02f, -8.538226676e-02f, +3.139475616e-02f, +4.534687988e-01f, +5.317530991e-01f, +1.257035893e-01f, -9.336081470e-02f, -7.300675124e-03f, +2.576917487e-02f, -3.964078879e-03f, -3.117716971e-03f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, -9.394126333e-04f, -6.669417793e-03f, +1.585203938e-02f, +1.762637069e-02f, -8.081883229e-02f, +1.145038182e-02f, +4.294827240e-01f, +5.460256322e-01f, +1.522358833e-01f, -9.217934767e-02f, -1.369230379e-02f, +2.716546883e-02f, -2.901306411e-03f, -3.623457200e-03f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, -6.140535745e-04f, -6.747680557e-03f, +1.360131724e-02f, +2.096923455e-02f, -7.548664793e-02f, -6.836060229e-03f, +4.041347532e-01f, +5.578876325e-01f, +1.796184274e-01f, -8.951050933e-02f, -2.042447313e-02f, +2.825501306e-02f, -1.657230762e-03f, -4.132457962e-03f, +0.000000000e+00f, - /* 16,13 */ +0.000000000e+00f, -3.323676319e-04f, -6.700410184e-03f, +1.135820669e-02f, +2.373330296e-02f, -6.951800781e-02f, -2.339704980e-02f, +3.776458156e-01f, +5.672296697e-01f, +2.076588264e-01f, -8.526380919e-02f, -2.742112952e-02f, +2.899108127e-02f, -2.351453324e-04f, -4.633347213e-03f, +4.855802427e-04f, - /* 16,14 */ +0.000000000e+00f, -9.477253367e-05f, -6.542440674e-03f, +9.158035052e-03f, +2.592390265e-02f, -6.304412145e-02f, -3.818535953e-02f, +3.502436629e-01f, +5.739652427e-01f, +2.361522790e-01f, -7.936172697e-02f, -3.459618474e-02f, +2.932892142e-02f, +1.357910925e-03f, -5.113535158e-03f, +4.414886472e-04f, - /* 16,15 */ +0.000000000e+00f, +9.939782505e-05f, -6.289189967e-03f, +7.032385926e-03f, +2.755457966e-02f, -5.619351824e-02f, -5.117389488e-02f, +3.221602930e-01f, +5.780318135e-01f, +2.648835910e-01f, -7.174125192e-02f, -4.185408685e-02f, +2.922667528e-02f, +3.110945653e-03f, -5.559366521e-03f, +3.647589216e-04f, - /* 12, 0 */ -3.638165547e-03f, +2.979985982e-02f, -2.723323293e-02f, -8.605047059e-02f, +2.801520768e-01f, +6.188891100e-01f, +2.801520768e-01f, -8.605047059e-02f, -2.723323293e-02f, +2.979985982e-02f, -3.638165547e-03f, -3.041512814e-03f, - /* 12, 1 */ -4.749738186e-03f, +2.841159300e-02f, -1.933319589e-02f, -9.237133076e-02f, +2.473915856e-01f, +6.172320760e-01f, +3.129551421e-01f, -7.764805088e-02f, -3.538029377e-02f, +3.077779188e-02f, -2.305275216e-03f, -3.612081594e-03f, - /* 12, 2 */ -5.642312008e-03f, +2.667449885e-02f, -1.178831271e-02f, -9.669686191e-02f, +2.149632830e-01f, +6.122785731e-01f, +3.455026876e-01f, -6.709962705e-02f, -4.365285408e-02f, +3.128617370e-02f, -7.534120996e-04f, -4.192641091e-03f, - /* 12, 3 */ -6.322395719e-03f, +2.465107974e-02f, -4.692548813e-03f, -9.913294928e-02f, +1.831448749e-01f, +6.040811565e-01f, +3.774917553e-01f, -5.436442589e-02f, -5.191703591e-02f, +3.126943445e-02f, +1.010002855e-03f, -4.769140004e-03f, - /* 12, 4 */ -6.800166749e-03f, +2.240361196e-02f, +1.874795505e-03f, -9.980279721e-02f, +1.521989634e-01f, +5.927266195e-01f, +4.086182709e-01f, -3.942694703e-02f, -6.002791415e-02f, +3.067703358e-02f, +2.972136287e-03f, -5.325763732e-03f, - /* 12, 5 */ -7.088917510e-03f, +1.999301835e-02f, +7.849320649e-03f, -9.884443272e-02f, +1.223701278e-01f, +5.783348068e-01f, +4.385808709e-01f, -2.229824534e-02f, -6.783107929e-02f, +2.946485483e-02f, +5.114495497e-03f, -5.845139328e-03f, - /* 12, 6 */ -7.204483224e-03f, +1.747784955e-02f, +1.318150805e-02f, -9.640809295e-02f, +9.388232321e-02f, +5.610569814e-01f, +4.670847512e-01f, -3.016864363e-03f, -7.516444191e-02f, +2.759658236e-02f, +7.412783505e-03f, -6.308600966e-03f, - /* 12, 7 */ -7.164664930e-03f, +1.491338589e-02f, +1.783645872e-02f, -9.265354184e-02f, +6.693662660e-02f, +5.410737692e-01f, +4.938454794e-01f, +1.835060492e-02f, -8.186025948e-02f, +2.504503167e-02f, +9.836867291e-03f, -6.696514785e-03f, - /* 12, 8 */ -6.988660420e-03f, +1.235086875e-02f, +2.179340724e-02f, -8.774736114e-02f, +4.170935934e-02f, +5.185927134e-01f, +5.185927134e-01f, +4.170935934e-02f, -8.774736114e-02f, +2.179340724e-02f, +1.235086875e-02f, -6.988660420e-03f, - /* 12, 9 */ -6.696514785e-03f, +9.836867291e-03f, +2.504503167e-02f, -8.186025948e-02f, +1.835060492e-02f, +4.938454794e-01f, +5.410737692e-01f, +6.693662660e-02f, -9.265354184e-02f, +1.783645872e-02f, +1.491338589e-02f, -7.164664930e-03f, - /* 12,10 */ -6.308600966e-03f, +7.412783505e-03f, +2.759658236e-02f, -7.516444191e-02f, -3.016864363e-03f, +4.670847512e-01f, +5.610569814e-01f, +9.388232321e-02f, -9.640809295e-02f, +1.318150805e-02f, +1.747784955e-02f, -7.204483224e-03f, - /* 12,11 */ -5.845139328e-03f, +5.114495497e-03f, +2.946485483e-02f, -6.783107929e-02f, -2.229824534e-02f, +4.385808709e-01f, +5.783348068e-01f, +1.223701278e-01f, -9.884443272e-02f, +7.849320649e-03f, +1.999301835e-02f, -7.088917510e-03f, - /* 12,12 */ -5.325763732e-03f, +2.972136287e-03f, +3.067703358e-02f, -6.002791415e-02f, -3.942694703e-02f, +4.086182709e-01f, +5.927266195e-01f, +1.521989634e-01f, -9.980279721e-02f, +1.874795505e-03f, +2.240361196e-02f, -6.800166749e-03f, - /* 12,13 */ -4.769140004e-03f, +1.010002855e-03f, +3.126943445e-02f, -5.191703591e-02f, -5.436442589e-02f, +3.774917553e-01f, +6.040811565e-01f, +1.831448749e-01f, -9.913294928e-02f, -4.692548813e-03f, +2.465107974e-02f, -6.322395719e-03f, - /* 12,14 */ -4.192641091e-03f, -7.534120996e-04f, +3.128617370e-02f, -4.365285408e-02f, -6.709962705e-02f, +3.455026876e-01f, +6.122785731e-01f, +2.149632830e-01f, -9.669686191e-02f, -1.178831271e-02f, +2.667449885e-02f, -5.642312008e-03f, - /* 12,15 */ -3.612081594e-03f, -2.305275216e-03f, +3.077779188e-02f, -3.538029377e-02f, -7.764805088e-02f, +3.129551421e-01f, +6.172320760e-01f, +2.473915856e-01f, -9.237133076e-02f, -1.933319589e-02f, +2.841159300e-02f, -4.749738186e-03f, - /* 12, 0 */ -7.562702671e-03f, +2.362257603e-02f, -4.531854693e-03f, -1.030173373e-01f, +2.624467795e-01f, +6.583866631e-01f, +2.624467795e-01f, -1.030173373e-01f, -4.531854693e-03f, +2.362257603e-02f, -7.562702671e-03f, -3.516889901e-04f, - /* 12, 1 */ -7.668183010e-03f, +2.087771707e-02f, +2.839059860e-03f, -1.056218320e-01f, +2.257778124e-01f, +6.563919279e-01f, +2.995227467e-01f, -9.814415944e-02f, -1.254420342e-02f, +2.617709089e-02f, -7.250906804e-03f, -7.142430143e-04f, - /* 12, 2 */ -7.590423774e-03f, +1.801705410e-02f, +9.487879886e-03f, -1.061169074e-01f, +1.898705313e-01f, +6.504316937e-01f, +3.366347146e-01f, -9.086648783e-02f, -2.109702270e-02f, +2.846338313e-02f, -6.712315500e-03f, -1.140764971e-03f, - /* 12, 3 */ -7.354275530e-03f, +1.511050856e-02f, +1.535418598e-02f, -1.046816488e-01f, +1.550586973e-01f, +6.405775033e-01f, +3.734003416e-01f, -8.107535131e-02f, -3.006937567e-02f, +3.040170317e-02f, -5.929880498e-03f, -1.628307909e-03f, - /* 12, 4 */ -6.985575046e-03f, +1.222230420e-02f, +2.039736787e-02f, -1.015111601e-01f, +1.216509697e-01f, +6.269473635e-01f, +4.094311989e-01f, -6.869168809e-02f, -3.932109040e-02f, +3.191206547e-02f, -4.890814148e-03f, -2.171433859e-03f, - /* 12, 5 */ -6.510406524e-03f, +9.410098002e-03f, +2.459585213e-02f, -9.681266365e-02f, +8.992722338e-02f, +6.097039216e-01f, +4.443382217e-01f, -5.366903171e-02f, -4.869391429e-02f, +3.291602689e-02f, -3.587389454e-03f, -2.762058981e-03f, - /* 12, 6 */ -5.954426605e-03f, +6.724324555e-03f, +2.794602403e-02f, -9.080157573e-02f, +6.013541337e-02f, +5.890519583e-01f, +4.777372670e-01f, -3.599575069e-02f, -5.801308453e-02f, +3.333857894e-02f, -2.017687876e-03f, -3.389362400e-03f, - /* 12, 7 */ -5.342264546e-03f, +4.207752570e-03f, +3.046088231e-02f, -8.369763050e-02f, +3.248902822e-02f, +5.652352421e-01f, +5.092546840e-01f, -1.569678608e-02f, -6.708930595e-02f, +3.311011989e-02f, -1.862710466e-04f, -4.039767889e-03f, - /* 12, 8 */ -4.697006242e-03f, +1.895247343e-03f, +3.216846911e-02f, -7.572111885e-02f, +7.165160645e-03f, +5.385328020e-01f, +5.385328020e-01f, +7.165160645e-03f, -7.572111885e-02f, +3.216846911e-02f, +1.895247343e-03f, -4.697006242e-03f, - /* 12, 9 */ -4.039767889e-03f, -1.862710466e-04f, +3.311011989e-02f, -6.708930595e-02f, -1.569678608e-02f, +5.092546840e-01f, +5.652352421e-01f, +3.248902822e-02f, -8.369763050e-02f, +3.046088231e-02f, +4.207752570e-03f, -5.342264546e-03f, - /* 12,10 */ -3.389362400e-03f, -2.017687876e-03f, +3.333857894e-02f, -5.801308453e-02f, -3.599575069e-02f, +4.777372670e-01f, +5.890519583e-01f, +6.013541337e-02f, -9.080157573e-02f, +2.794602403e-02f, +6.724324555e-03f, -5.954426605e-03f, - /* 12,11 */ -2.762058981e-03f, -3.587389454e-03f, +3.291602689e-02f, -4.869391429e-02f, -5.366903171e-02f, +4.443382217e-01f, +6.097039216e-01f, +8.992722338e-02f, -9.681266365e-02f, +2.459585213e-02f, +9.410098002e-03f, -6.510406524e-03f, - /* 12,12 */ -2.171433859e-03f, -4.890814148e-03f, +3.191206547e-02f, -3.932109040e-02f, -6.869168809e-02f, +4.094311989e-01f, +6.269473635e-01f, +1.216509697e-01f, -1.015111601e-01f, +2.039736787e-02f, +1.222230420e-02f, -6.985575046e-03f, - /* 12,13 */ -1.628307909e-03f, -5.929880498e-03f, +3.040170317e-02f, -3.006937567e-02f, -8.107535131e-02f, +3.734003416e-01f, +6.405775033e-01f, +1.550586973e-01f, -1.046816488e-01f, +1.535418598e-02f, +1.511050856e-02f, -7.354275530e-03f, - /* 12,14 */ -1.140764971e-03f, -6.712315500e-03f, +2.846338313e-02f, -2.109702270e-02f, -9.086648783e-02f, +3.366347146e-01f, +6.504316937e-01f, +1.898705313e-01f, -1.061169074e-01f, +9.487879886e-03f, +1.801705410e-02f, -7.590423774e-03f, - /* 12,15 */ -7.142430143e-04f, -7.250906804e-03f, +2.617709089e-02f, -1.254420342e-02f, -9.814415944e-02f, +2.995227467e-01f, +6.563919279e-01f, +2.257778124e-01f, -1.056218320e-01f, +2.839059860e-03f, +2.087771707e-02f, -7.668183010e-03f, - /* 12, 0 */ -7.009786996e-03f, +1.344312953e-02f, +1.557210222e-02f, -1.125190619e-01f, +2.408695221e-01f, +6.978842163e-01f, +2.408695221e-01f, -1.125190619e-01f, +1.557210222e-02f, +1.344312953e-02f, -7.009786996e-03f, +6.003640016e-04f, - /* 12, 1 */ -6.398742119e-03f, +1.026913982e-02f, +2.132332546e-02f, -1.110115061e-01f, +2.005160832e-01f, +6.955088069e-01f, +2.821133540e-01f, -1.117099281e-01f, +8.845385329e-03f, +1.669708199e-02f, -7.518519523e-03f, +5.590854556e-04f, - /* 12, 2 */ -5.716737920e-03f, +7.240001966e-03f, +2.606967700e-02f, -1.074325911e-01f, +1.614746033e-01f, +6.884146462e-01f, +3.237982615e-01f, -1.083606220e-01f, +1.198165974e-03f, +1.995657080e-02f, -7.892366537e-03f, +4.637249154e-04f, - /* 12, 3 */ -4.993154633e-03f, +4.410399512e-03f, +2.980590100e-02f, -1.020439692e-01f, +1.241329667e-01f, +6.766973789e-01f, +3.654537522e-01f, -1.022748781e-01f, -7.287927063e-03f, +2.313861998e-02f, -8.098411048e-03f, +3.063703263e-04f, - /* 12, 4 */ -4.254780730e-03f, +1.824453005e-03f, +3.254896791e-02f, -9.511805181e-02f, +8.884019172e-02f, +6.605145641e-01f, +4.065952670e-01f, -9.328874484e-02f, -1.650412301e-02f, +2.615301189e-02f, -8.104377377e-03f, +8.035370630e-05f, - /* 12, 5 */ -3.525333045e-03f, -4.843426812e-04f, +3.433584064e-02f, -8.693252112e-02f, +5.590207404e-02f, +6.400829406e-01f, +4.467316931e-01f, -8.127529114e-02f, -2.631456917e-02f, +2.890390773e-02f, -7.879705669e-03f, -2.193022854e-04f, - /* 12, 6 */ -2.825116890e-03f, -2.492908449e-03f, +3.522097401e-02f, -7.776502604e-02f, +2.557772128e-02f, +6.156746770e-01f, +4.853731430e-01f, -6.614880956e-02f, -3.655698883e-02f, +3.129176395e-02f, -7.396691856e-03f, -5.954441701e-04f, - /* 12, 7 */ -2.170822930e-03f, -4.188126176e-03f, +3.527362061e-02f, -6.788815999e-02f, -1.922977207e-03f, +5.876126808e-01f, +5.220388545e-01f, -4.786841211e-02f, -4.704395826e-02f, +3.321551909e-02f, -6.631665064e-03f, -1.048370326e-03f, - /* 12, 8 */ -1.575453811e-03f, -5.566170902e-03f, +3.457501660e-02f, -5.756481055e-02f, -2.644092188e-02f, +5.562650609e-01f, +5.562650609e-01f, -2.644092188e-02f, -5.756481055e-02f, +3.457501660e-02f, -5.566170902e-03f, -1.575453811e-03f, - /* 12, 9 */ -1.048370326e-03f, -6.631665064e-03f, +3.321551909e-02f, -4.704395826e-02f, -4.786841211e-02f, +5.220388545e-01f, +5.876126808e-01f, -1.922977207e-03f, -6.788815999e-02f, +3.527362061e-02f, -4.188126176e-03f, -2.170822930e-03f, - /* 12,10 */ -5.954441701e-04f, -7.396691856e-03f, +3.129176395e-02f, -3.655698883e-02f, -6.614880956e-02f, +4.853731430e-01f, +6.156746770e-01f, +2.557772128e-02f, -7.776502604e-02f, +3.522097401e-02f, -2.492908449e-03f, -2.825116890e-03f, - /* 12,11 */ -2.193022854e-04f, -7.879705669e-03f, +2.890390773e-02f, -2.631456917e-02f, -8.127529114e-02f, +4.467316931e-01f, +6.400829406e-01f, +5.590207404e-02f, -8.693252112e-02f, +3.433584064e-02f, -4.843426812e-04f, -3.525333045e-03f, - /* 12,12 */ +8.035370630e-05f, -8.104377377e-03f, +2.615301189e-02f, -1.650412301e-02f, -9.328874484e-02f, +4.065952670e-01f, +6.605145641e-01f, +8.884019172e-02f, -9.511805181e-02f, +3.254896791e-02f, +1.824453005e-03f, -4.254780730e-03f, - /* 12,13 */ +3.063703263e-04f, -8.098411048e-03f, +2.313861998e-02f, -7.287927063e-03f, -1.022748781e-01f, +3.654537522e-01f, +6.766973789e-01f, +1.241329667e-01f, -1.020439692e-01f, +2.980590100e-02f, +4.410399512e-03f, -4.993154633e-03f, - /* 12,14 */ +4.637249154e-04f, -7.892366537e-03f, +1.995657080e-02f, +1.198165974e-03f, -1.083606220e-01f, +3.237982615e-01f, +6.884146462e-01f, +1.614746033e-01f, -1.074325911e-01f, +2.606967700e-02f, +7.240001966e-03f, -5.716737920e-03f, - /* 12,15 */ +5.590854556e-04f, -7.518519523e-03f, +1.669708199e-02f, +8.845385329e-03f, -1.117099281e-01f, +2.821133540e-01f, +6.955088069e-01f, +2.005160832e-01f, -1.110115061e-01f, +2.132332546e-02f, +1.026913982e-02f, -6.398742119e-03f, - - /* 24, 0 */ +1.501390780e-03f, +3.431804419e-03f, +6.512803185e-03f, +1.091425387e-02f, +1.664594540e-02f, +2.351091132e-02f, +3.109255671e-02f, +3.878419288e-02f, +4.586050701e-02f, +5.158058002e-02f, +5.530384985e-02f, +5.659614054e-02f, +5.530384985e-02f, +5.158058002e-02f, +4.586050701e-02f, +3.878419288e-02f, +3.109255671e-02f, +2.351091132e-02f, +1.664594540e-02f, +1.091425387e-02f, +6.512803185e-03f, +3.431804419e-03f, +1.501390780e-03f, +4.573885647e-04f, - /* 24, 1 */ +1.413186400e-03f, +3.279858311e-03f, +6.282638036e-03f, +1.059932179e-02f, +1.625135142e-02f, +2.305547031e-02f, +3.060840342e-02f, +3.831365198e-02f, +4.545054680e-02f, +5.127577001e-02f, +5.513916011e-02f, +5.659104154e-02f, +5.545895049e-02f, +5.187752167e-02f, +4.626513642e-02f, +3.925233583e-02f, +3.157717954e-02f, +2.396921539e-02f, +1.704503934e-02f, +1.123445076e-02f, +6.748179094e-03f, +3.588275667e-03f, +1.593065611e-03f, +5.022154476e-04f, - /* 24, 2 */ +1.328380648e-03f, +3.132379333e-03f, +6.057656813e-03f, +1.028967374e-02f, +1.586133102e-02f, +2.260301890e-02f, +3.012488684e-02f, +3.784089895e-02f, +4.503543229e-02f, +5.096323022e-02f, +5.496495842e-02f, +5.657574693e-02f, +5.560438923e-02f, +5.216645963e-02f, +4.666426010e-02f, +3.971789474e-02f, +3.206210284e-02f, +2.443025293e-02f, +1.744855617e-02f, +1.155988996e-02f, +6.988790100e-03f, +3.749328623e-03f, +1.688282347e-03f, +5.494305796e-04f, - /* 24, 3 */ +1.246901403e-03f, +2.989308098e-03f, +5.837830254e-03f, +9.985325752e-03f, +1.547595434e-02f, +2.215368059e-02f, +2.964217216e-02f, +3.736611920e-02f, +4.461534144e-02f, +5.064310236e-02f, +5.478132634e-02f, +5.655026396e-02f, +5.574009777e-02f, +5.244726189e-02f, +4.705770477e-02f, +4.018068337e-02f, +3.254715574e-02f, +2.489389144e-02f, +1.785641537e-02f, +1.189054572e-02f, +7.234657995e-03f, +3.915018340e-03f, +1.787112015e-03f, +5.991047395e-04f, - /* 24, 4 */ +1.168676301e-03f, +2.850583915e-03f, +5.623126723e-03f, +9.686290690e-03f, +1.509528803e-02f, +2.170757578e-02f, +2.916042250e-02f, +3.688949768e-02f, +4.419045351e-02f, +5.031553118e-02f, +5.458834968e-02f, +5.651460469e-02f, +5.586601230e-02f, +5.271979985e-02f, +4.744529894e-02f, +4.064051541e-02f, +3.303216567e-02f, +2.535999546e-02f, +1.826853297e-02f, +1.222638897e-02f, +7.485801959e-03f, +4.085398290e-03f, +1.889625146e-03f, +6.513091287e-04f, - /* 24, 5 */ +1.093632798e-03f, +2.716144855e-03f, +5.413512274e-03f, +9.392578266e-03f, +1.471939531e-02f, +2.126482169e-02f, +2.867979883e-02f, +3.641121873e-02f, +4.376094899e-02f, +4.998066438e-02f, +5.438611851e-02f, +5.646878599e-02f, +5.598207354e-02f, +5.298394839e-02f, +4.782687301e-02f, +4.109720465e-02f, +3.351695842e-02f, +2.582842673e-02f, +1.868482156e-02f, +1.256738733e-02f, +7.742238512e-03f, +4.260520294e-03f, +1.995891717e-03f, +7.061153220e-04f, - /* 24, 6 */ +1.021698233e-03f, +2.585927824e-03f, +5.208950715e-03f, +9.104195104e-03f, +1.434833590e-02f, +2.082553239e-02f, +2.820045990e-02f, +3.593146595e-02f, +4.332700946e-02f, +4.963865252e-02f, +5.417472708e-02f, +5.641282954e-02f, +5.608822683e-02f, +5.323958602e-02f, +4.820225940e-02f, +4.155056502e-02f, +3.400135826e-02f, +2.629904416e-02f, +1.910519032e-02f, +1.291350505e-02f, +8.003981455e-03f, +4.440434453e-03f, +2.105981077e-03f, +7.635952183e-04f, - /* 24, 7 */ +9.527998831e-04f, +2.459868628e-03f, +5.009403670e-03f, +8.821144768e-03f, +1.398216608e-02f, +2.038981869e-02f, +2.772256216e-02f, +3.545042216e-02f, +4.288881749e-02f, +4.928964888e-02f, +5.395427373e-02f, +5.634676181e-02f, +5.618442211e-02f, +5.348659488e-02f, +4.857129262e-02f, +4.200041076e-02f, +3.448518802e-02f, +2.677170395e-02f, +1.952954505e-02f, +1.326470299e-02f, +8.271041819e-03f, +4.625189083e-03f, +2.219961884e-03f, +8.238209888e-04f, - /* 24, 8 */ +8.868650246e-04f, +2.337902042e-03f, +4.814830642e-03f, +8.543427812e-03f, +1.362093865e-02f, +1.995778816e-02f, +2.724625964e-02f, +3.496826923e-02f, +4.244655653e-02f, +4.893380942e-02f, +5.372486088e-02f, +5.627061400e-02f, +5.627061400e-02f, +5.372486088e-02f, +4.893380942e-02f, +4.244655653e-02f, +3.496826923e-02f, +2.724625964e-02f, +1.995778816e-02f, +1.362093865e-02f, +8.543427812e-03f, +4.814830642e-03f, +2.337902042e-03f, +8.868650246e-04f, - /* 24, 9 */ +8.238209888e-04f, +2.219961884e-03f, +4.625189083e-03f, +8.271041819e-03f, +1.326470299e-02f, +1.952954505e-02f, +2.677170395e-02f, +3.448518802e-02f, +4.200041076e-02f, +4.857129262e-02f, +5.348659488e-02f, +5.618442211e-02f, +5.634676181e-02f, +5.395427373e-02f, +4.928964888e-02f, +4.288881749e-02f, +3.545042216e-02f, +2.772256216e-02f, +2.038981869e-02f, +1.398216608e-02f, +8.821144768e-03f, +5.009403670e-03f, +2.459868628e-03f, +9.527998831e-04f, - /* 24,10 */ +7.635952183e-04f, +2.105981077e-03f, +4.440434453e-03f, +8.003981455e-03f, +1.291350505e-02f, +1.910519032e-02f, +2.629904416e-02f, +3.400135826e-02f, +4.155056502e-02f, +4.820225940e-02f, +5.323958602e-02f, +5.608822683e-02f, +5.641282954e-02f, +5.417472708e-02f, +4.963865252e-02f, +4.332700946e-02f, +3.593146595e-02f, +2.820045990e-02f, +2.082553239e-02f, +1.434833590e-02f, +9.104195104e-03f, +5.208950715e-03f, +2.585927824e-03f, +1.021698233e-03f, - /* 24,11 */ +7.061153220e-04f, +1.995891717e-03f, +4.260520294e-03f, +7.742238512e-03f, +1.256738733e-02f, +1.868482156e-02f, +2.582842673e-02f, +3.351695842e-02f, +4.109720465e-02f, +4.782687301e-02f, +5.298394839e-02f, +5.598207354e-02f, +5.646878599e-02f, +5.438611851e-02f, +4.998066438e-02f, +4.376094899e-02f, +3.641121873e-02f, +2.867979883e-02f, +2.126482169e-02f, +1.471939531e-02f, +9.392578266e-03f, +5.413512274e-03f, +2.716144855e-03f, +1.093632798e-03f, - /* 24,12 */ +6.513091287e-04f, +1.889625146e-03f, +4.085398290e-03f, +7.485801959e-03f, +1.222638897e-02f, +1.826853297e-02f, +2.535999546e-02f, +3.303216567e-02f, +4.064051541e-02f, +4.744529894e-02f, +5.271979985e-02f, +5.586601230e-02f, +5.651460469e-02f, +5.458834968e-02f, +5.031553118e-02f, +4.419045351e-02f, +3.688949768e-02f, +2.916042250e-02f, +2.170757578e-02f, +1.509528803e-02f, +9.686290690e-03f, +5.623126723e-03f, +2.850583915e-03f, +1.168676301e-03f, - /* 24,13 */ +5.991047395e-04f, +1.787112015e-03f, +3.915018340e-03f, +7.234657995e-03f, +1.189054572e-02f, +1.785641537e-02f, +2.489389144e-02f, +3.254715574e-02f, +4.018068337e-02f, +4.705770477e-02f, +5.244726189e-02f, +5.574009777e-02f, +5.655026396e-02f, +5.478132634e-02f, +5.064310236e-02f, +4.461534144e-02f, +3.736611920e-02f, +2.964217216e-02f, +2.215368059e-02f, +1.547595434e-02f, +9.985325752e-03f, +5.837830254e-03f, +2.989308098e-03f, +1.246901403e-03f, - /* 24,14 */ +5.494305796e-04f, +1.688282347e-03f, +3.749328623e-03f, +6.988790100e-03f, +1.155988996e-02f, +1.744855617e-02f, +2.443025293e-02f, +3.206210284e-02f, +3.971789474e-02f, +4.666426010e-02f, +5.216645963e-02f, +5.560438923e-02f, +5.657574693e-02f, +5.496495842e-02f, +5.096323022e-02f, +4.503543229e-02f, +3.784089895e-02f, +3.012488684e-02f, +2.260301890e-02f, +1.586133102e-02f, +1.028967374e-02f, +6.057656813e-03f, +3.132379333e-03f, +1.328380648e-03f, - /* 24,15 */ +5.022154476e-04f, +1.593065611e-03f, +3.588275667e-03f, +6.748179094e-03f, +1.123445076e-02f, +1.704503934e-02f, +2.396921539e-02f, +3.157717954e-02f, +3.925233583e-02f, +4.626513642e-02f, +5.187752167e-02f, +5.545895049e-02f, +5.659104154e-02f, +5.513916011e-02f, +5.127577001e-02f, +4.545054680e-02f, +3.831365198e-02f, +3.060840342e-02f, +2.305547031e-02f, +1.625135142e-02f, +1.059932179e-02f, +6.282638036e-03f, +3.279858311e-03f, +1.413186400e-03f, - /* 24, 0 */ -2.629184871e-03f, -4.843950453e-03f, -6.895985300e-03f, -7.687208098e-03f, -5.978262553e-03f, -8.032174656e-04f, +8.095316761e-03f, +1.997958831e-02f, +3.311864145e-02f, +4.512644231e-02f, +5.356009950e-02f, +5.659614054e-02f, +5.356009950e-02f, +4.512644231e-02f, +3.311864145e-02f, +1.997958831e-02f, +8.095316761e-03f, -8.032174656e-04f, -5.978262553e-03f, -7.687208098e-03f, -6.895985300e-03f, -4.843950453e-03f, -2.629184871e-03f, -9.454953712e-04f, - /* 24, 1 */ -2.503767166e-03f, -4.700731697e-03f, -6.791825424e-03f, -7.698565601e-03f, -6.179328945e-03f, -1.237726578e-03f, +7.438688744e-03f, +1.917778123e-02f, +3.230413198e-02f, +4.445707943e-02f, +5.317715832e-02f, +5.658405316e-02f, +5.392156860e-02f, +4.578163621e-02f, +3.392875410e-02f, +2.078652132e-02f, +8.763945305e-03f, -3.538276542e-04f, -5.763420347e-03f, -7.665996832e-03f, -6.995273095e-03f, -4.986674025e-03f, -2.756835384e-03f, -1.028686673e-03f, - /* 24, 2 */ -2.380688695e-03f, -4.557243028e-03f, -6.683099486e-03f, -7.700368745e-03f, -6.366798820e-03f, -1.657314491e-03f, +6.794365087e-03f, +1.838162773e-02f, +3.148585651e-02f, +4.377411309e-02f, +5.277308334e-02f, +5.654780182e-02f, +5.426124576e-02f, +4.642210542e-02f, +3.473383802e-02f, +2.159804191e-02f, +9.444254477e-03f, +1.103863968e-04f, -5.534634231e-03f, -7.634636496e-03f, -7.089380216e-03f, -5.128670417e-03f, -2.886604737e-03f, -1.114962551e-03f, - /* 24, 3 */ -2.260048394e-03f, -4.413702845e-03f, -6.570110572e-03f, -7.692920583e-03f, -6.540862270e-03f, -2.061956485e-03f, +6.162633403e-03f, +1.759164425e-02f, +3.066444409e-02f, +4.307811806e-02f, +5.234823086e-02f, +5.648741902e-02f, +5.457882991e-02f, +4.704730472e-02f, +3.553326091e-02f, +2.241360152e-02f, +1.013590849e-02f, +5.893521078e-04f, -5.291747706e-03f, -7.592836347e-03f, -7.177995846e-03f, -5.269701073e-03f, -3.018371382e-03f, -1.204312280e-03f, - /* 24, 4 */ -2.141937776e-03f, -4.270322542e-03f, -6.453158507e-03f, -7.676527355e-03f, -6.701719772e-03f, -2.451643421e-03f, +5.543764951e-03f, +1.680833562e-02f, +2.984052134e-02f, +4.236967758e-02f, +5.190297478e-02f, +5.640295884e-02f, +5.487403917e-02f, +4.765670002e-02f, +3.632639074e-02f, +2.323264190e-02f, +1.083855586e-02f, +1.082980638e-03f, -5.034616251e-03f, -7.540310660e-03f, -7.260807322e-03f, -5.409521052e-03f, -3.152006158e-03f, -1.296719170e-03f, - /* 24, 5 */ -2.026441000e-03f, -4.127306381e-03f, -6.332539518e-03f, -7.651498041e-03f, -6.849581767e-03f, -2.826381528e-03f, +4.938014526e-03f, +1.603219452e-02f, +2.901471178e-02f, +4.164938279e-02f, +5.143770614e-02f, +5.629449693e-02f, +5.514661113e-02f, +4.824976895e-02f, +3.711259647e-02f, +2.405459566e-02f, +1.155182965e-02f, +1.591166761e-03f, -4.763107701e-03f, -7.476779193e-03f, -7.337500507e-03f, -5.547879217e-03f, -3.287372274e-03f, -1.392160404e-03f, - /* 24, 6 */ -1.913634953e-03f, -3.984851387e-03f, -6.208545927e-03f, -7.618143912e-03f, -6.984668233e-03f, -3.186192169e-03f, +4.345620369e-03f, +1.526370115e-02f, +2.818763519e-02f, +4.091783200e-02f, +5.095283267e-02f, +5.616213037e-02f, +5.539630322e-02f, +4.882600150e-02f, +3.789124869e-02f, +2.487888677e-02f, +1.227534767e-02f, +2.113788767e-03f, -4.477102606e-03f, -7.401967644e-03f, -7.407760182e-03f, -5.684518438e-03f, -3.424325302e-03f, -1.490606880e-03f, - /* 24, 7 */ -1.803589350e-03f, -3.843147252e-03f, -6.081465840e-03f, -7.576778087e-03f, -7.107208249e-03f, -3.531111592e-03f, +3.766804102e-03f, +1.450332275e-02f, +2.735990694e-02f, +4.017563005e-02f, +5.044877831e-02f, +5.600597761e-02f, +5.562289296e-02f, +4.938490059e-02f, +3.866172039e-02f, +2.570493119e-02f, +1.300871280e-02f, +2.650708377e-03f, -4.176494585e-03f, -7.315608112e-03f, -7.471270440e-03f, -5.819175805e-03f, -3.562713186e-03f, -1.592023060e-03f, - /* 24, 8 */ -1.696366827e-03f, -3.702376254e-03f, -5.951582861e-03f, -7.527715094e-03f, -7.217439556e-03f, -3.861190662e-03f, +3.201770681e-03f, +1.375151322e-02f, +2.653213738e-02f, +3.942338759e-02f, +4.992598268e-02f, +5.582617825e-02f, +5.582617825e-02f, +4.992598268e-02f, +3.942338759e-02f, +2.653213738e-02f, +1.375151322e-02f, +3.201770681e-03f, -3.861190662e-03f, -7.217439556e-03f, -7.527715094e-03f, -5.951582861e-03f, -3.702376254e-03f, -1.696366827e-03f, - /* 24, 9 */ -1.592023060e-03f, -3.562713186e-03f, -5.819175805e-03f, -7.471270440e-03f, -7.315608112e-03f, -4.176494585e-03f, +2.650708377e-03f, +1.300871280e-02f, +2.570493119e-02f, +3.866172039e-02f, +4.938490059e-02f, +5.562289296e-02f, +5.600597761e-02f, +5.044877831e-02f, +4.017563005e-02f, +2.735990694e-02f, +1.450332275e-02f, +3.766804102e-03f, -3.531111592e-03f, -7.107208249e-03f, -7.576778087e-03f, -6.081465840e-03f, -3.843147252e-03f, -1.803589350e-03f, - /* 24,10 */ -1.490606880e-03f, -3.424325302e-03f, -5.684518438e-03f, -7.407760182e-03f, -7.401967644e-03f, -4.477102606e-03f, +2.113788767e-03f, +1.227534767e-02f, +2.487888677e-02f, +3.789124869e-02f, +4.882600150e-02f, +5.539630322e-02f, +5.616213037e-02f, +5.095283267e-02f, +4.091783200e-02f, +2.818763519e-02f, +1.526370115e-02f, +4.345620369e-03f, -3.186192169e-03f, -6.984668233e-03f, -7.618143912e-03f, -6.208545927e-03f, -3.984851387e-03f, -1.913634953e-03f, - /* 24,11 */ -1.392160404e-03f, -3.287372274e-03f, -5.547879217e-03f, -7.337500507e-03f, -7.476779193e-03f, -4.763107701e-03f, +1.591166761e-03f, +1.155182965e-02f, +2.405459566e-02f, +3.711259647e-02f, +4.824976895e-02f, +5.514661113e-02f, +5.629449693e-02f, +5.143770614e-02f, +4.164938279e-02f, +2.901471178e-02f, +1.603219452e-02f, +4.938014526e-03f, -2.826381528e-03f, -6.849581767e-03f, -7.651498041e-03f, -6.332539518e-03f, -4.127306381e-03f, -2.026441000e-03f, - /* 24,12 */ -1.296719170e-03f, -3.152006158e-03f, -5.409521052e-03f, -7.260807322e-03f, -7.540310660e-03f, -5.034616251e-03f, +1.082980638e-03f, +1.083855586e-02f, +2.323264190e-02f, +3.632639074e-02f, +4.765670002e-02f, +5.487403917e-02f, +5.640295884e-02f, +5.190297478e-02f, +4.236967758e-02f, +2.984052134e-02f, +1.680833562e-02f, +5.543764951e-03f, -2.451643421e-03f, -6.701719772e-03f, -7.676527355e-03f, -6.453158507e-03f, -4.270322542e-03f, -2.141937776e-03f, - /* 24,13 */ -1.204312280e-03f, -3.018371382e-03f, -5.269701073e-03f, -7.177995846e-03f, -7.592836347e-03f, -5.291747706e-03f, +5.893521078e-04f, +1.013590849e-02f, +2.241360152e-02f, +3.553326091e-02f, +4.704730472e-02f, +5.457882991e-02f, +5.648741902e-02f, +5.234823086e-02f, +4.307811806e-02f, +3.066444409e-02f, +1.759164425e-02f, +6.162633403e-03f, -2.061956485e-03f, -6.540862270e-03f, -7.692920583e-03f, -6.570110572e-03f, -4.413702845e-03f, -2.260048394e-03f, - /* 24,14 */ -1.114962551e-03f, -2.886604737e-03f, -5.128670417e-03f, -7.089380216e-03f, -7.634636496e-03f, -5.534634231e-03f, +1.103863968e-04f, +9.444254477e-03f, +2.159804191e-02f, +3.473383802e-02f, +4.642210542e-02f, +5.426124576e-02f, +5.654780182e-02f, +5.277308334e-02f, +4.377411309e-02f, +3.148585651e-02f, +1.838162773e-02f, +6.794365087e-03f, -1.657314491e-03f, -6.366798820e-03f, -7.700368745e-03f, -6.683099486e-03f, -4.557243028e-03f, -2.380688695e-03f, - /* 24,15 */ -1.028686673e-03f, -2.756835384e-03f, -4.986674025e-03f, -6.995273095e-03f, -7.665996832e-03f, -5.763420347e-03f, -3.538276542e-04f, +8.763945305e-03f, +2.078652132e-02f, +3.392875410e-02f, +4.578163621e-02f, +5.392156860e-02f, +5.658405316e-02f, +5.317715832e-02f, +4.445707943e-02f, +3.230413198e-02f, +1.917778123e-02f, +7.438688744e-03f, -1.237726578e-03f, -6.179328945e-03f, -7.698565601e-03f, -6.791825424e-03f, -4.700731697e-03f, -2.503767166e-03f, - /* 24, 0 */ +4.735641749e-04f, -1.438577362e-03f, -6.107076473e-03f, -1.318715065e-02f, -2.047716119e-02f, -2.428668798e-02f, -2.088952800e-02f, -8.512165320e-03f, +1.117510535e-02f, +3.302575560e-02f, +5.012757987e-02f, +5.659614054e-02f, +5.012757987e-02f, +3.302575560e-02f, +1.117510535e-02f, -8.512165320e-03f, -2.088952800e-02f, -2.428668798e-02f, -2.047716119e-02f, -1.318715065e-02f, -6.107076473e-03f, -1.438577362e-03f, +4.735641749e-04f, +5.516063288e-04f, - /* 24, 1 */ +5.190146993e-04f, -1.243445781e-03f, -5.732182665e-03f, -1.270621714e-02f, -2.008108462e-02f, -2.422674988e-02f, -2.136190754e-02f, -9.536491055e-03f, +9.813857768e-03f, +3.172645287e-02f, +4.932296812e-02f, +5.657007725e-02f, +5.088942272e-02f, +3.430616434e-02f, +1.254542812e-02f, -7.458075491e-03f, -2.038088472e-02f, -2.431781992e-02f, -2.085968072e-02f, -1.366943909e-02f, -6.492037400e-03f, -1.644903025e-03f, +4.208638005e-04f, +5.761542752e-04f, - /* 24, 2 */ +5.575380238e-04f, -1.059370463e-03f, -5.367638258e-03f, -1.222740313e-02f, -1.967247249e-02f, -2.413881461e-02f, -2.179812108e-02f, -1.053019587e-02f, +8.463295193e-03f, +3.041001010e-02f, +4.847674006e-02f, +5.649192540e-02f, +5.160740292e-02f, +3.556594146e-02f, +1.392318625e-02f, -6.375136316e-03f, -1.983593655e-02f, -2.431936776e-02f, -2.122761958e-02f, -1.415229209e-02f, -6.886752185e-03f, -1.862540304e-03f, +3.605947820e-04f, +5.982066157e-04f, - /* 24, 3 */ +5.894596941e-04f, -8.861942853e-04f, -5.013694839e-03f, -1.175144649e-02f, -1.925234223e-02f, -2.402372023e-02f, -2.219832191e-02f, -1.149248169e-02f, +7.124994951e-03f, +2.907819451e-02f, +4.759010507e-02f, +5.636179897e-02f, +5.228048761e-02f, +3.680336864e-02f, +1.530671242e-02f, -5.264319552e-03f, -1.925469982e-02f, -2.429058667e-02f, -2.157995394e-02f, -1.463489443e-02f, -7.290876362e-03f, -2.091585491e-03f, +2.924431607e-04f, +6.174753085e-04f, - /* 24, 4 */ +6.151072142e-04f, -7.237418200e-04f, -4.670573645e-03f, -1.127905759e-02f, -1.882170532e-02f, -2.388233174e-02f, -2.256271775e-02f, -1.242260980e-02f, +5.800499486e-03f, +2.773278351e-02f, +4.666432713e-02f, +5.617988770e-02f, +5.290770668e-02f, +3.801674993e-02f, +1.669431448e-02f, -4.126652928e-03f, -1.863724919e-02f, -2.423076690e-02f, -2.191566174e-02f, -1.511640714e-02f, -7.704034115e-03f, -2.332112699e-03f, +2.161008111e-04f, +6.336652968e-04f, - /* 24, 5 */ +6.348091316e-04f, -5.718203517e-04f, -4.338465973e-03f, -1.081091853e-02f, -1.838156554e-02f, -2.371553901e-02f, -2.289156957e-02f, -1.331990148e-02f, +4.491314051e-03f, +2.637556170e-02f, +4.570072248e-02f, +5.594645674e-02f, +5.348815454e-02f, +3.920441468e-02f, +1.808427811e-02f, -2.963218986e-03f, -1.798371833e-02f, -2.413923574e-02f, -2.223372473e-02f, -1.559596853e-02f, -8.125818185e-03f, -2.584172964e-03f, +1.312664533e-04f, +6.464750685e-04f, - /* 24, 6 */ +6.488941487e-04f, -4.302209069e-04f, -4.017533648e-03f, -1.034768250e-02f, -1.793291714e-02f, -2.352425464e-02f, -2.318519030e-02f, -1.418373842e-02f, +3.198904487e-03f, +2.500831779e-02f, +4.470065727e-02f, +5.566184614e-02f, +5.402099181e-02f, +4.036472049e-02f, +1.947486957e-02f, -1.775153809e-03f, -1.729430055e-02f, -2.401535937e-02f, -2.253313051e-02f, -1.607269547e-02f, -8.555789856e-03f, -2.847793367e-03f, +3.764667972e-05f, +6.555972530e-04f, - /* 24, 7 */ +6.576902611e-04f, -2.987192943e-04f, -3.707909539e-03f, -9.889973186e-03f, -1.747674315e-02f, -2.330941189e-02f, -2.344394342e-02f, -1.501356300e-02f, +1.924695104e-03f, +2.363284155e-02f, +4.366554511e-02f, +5.532647026e-02f, +5.450544680e-02f, +4.149605616e-02f, +2.086433852e-02f, -5.636456344e-04f, -1.656924930e-02f, -2.385854478e-02f, -2.281287459e-02f, -1.654568462e-02f, -8.993479016e-03f, -3.122976195e-03f, -6.504300803e-05f, +6.607192554e-04f, - /* 24, 8 */ +6.615239252e-04f, -1.770771536e-04f, -3.409698141e-03f, -9.438384277e-03f, -1.701401374e-02f, -2.307196251e-02f, -2.366824152e-02f, -1.580887853e-02f, +6.700666468e-04f, +2.225092083e-02f, +4.259684448e-02f, +5.494081698e-02f, +5.494081698e-02f, +4.259684448e-02f, +2.225092083e-02f, +6.700666468e-04f, -1.580887853e-02f, -2.366824152e-02f, -2.307196251e-02f, -1.701401374e-02f, -9.438384277e-03f, -3.409698141e-03f, -1.770771536e-04f, +6.615239252e-04f, - /* 24, 9 */ +6.607192554e-04f, -6.504300803e-05f, -3.122976195e-03f, -8.993479016e-03f, -1.654568462e-02f, -2.281287459e-02f, -2.385854478e-02f, -1.656924930e-02f, -5.636456344e-04f, +2.086433852e-02f, +4.149605616e-02f, +5.450544680e-02f, +5.532647026e-02f, +4.366554511e-02f, +2.363284155e-02f, +1.924695104e-03f, -1.501356300e-02f, -2.344394342e-02f, -2.330941189e-02f, -1.747674315e-02f, -9.889973186e-03f, -3.707909539e-03f, -2.987192943e-04f, +6.576902611e-04f, - /* 24,10 */ +6.555972530e-04f, +3.764667972e-05f, -2.847793367e-03f, -8.555789856e-03f, -1.607269547e-02f, -2.253313051e-02f, -2.401535937e-02f, -1.729430055e-02f, -1.775153809e-03f, +1.947486957e-02f, +4.036472049e-02f, +5.402099181e-02f, +5.566184614e-02f, +4.470065727e-02f, +2.500831779e-02f, +3.198904487e-03f, -1.418373842e-02f, -2.318519030e-02f, -2.352425464e-02f, -1.793291714e-02f, -1.034768250e-02f, -4.017533648e-03f, -4.302209069e-04f, +6.488941487e-04f, - /* 24,11 */ +6.464750685e-04f, +1.312664533e-04f, -2.584172964e-03f, -8.125818185e-03f, -1.559596853e-02f, -2.223372473e-02f, -2.413923574e-02f, -1.798371833e-02f, -2.963218986e-03f, +1.808427811e-02f, +3.920441468e-02f, +5.348815454e-02f, +5.594645674e-02f, +4.570072248e-02f, +2.637556170e-02f, +4.491314051e-03f, -1.331990148e-02f, -2.289156957e-02f, -2.371553901e-02f, -1.838156554e-02f, -1.081091853e-02f, -4.338465973e-03f, -5.718203517e-04f, +6.348091316e-04f, - /* 24,12 */ +6.336652968e-04f, +2.161008111e-04f, -2.332112699e-03f, -7.704034115e-03f, -1.511640714e-02f, -2.191566174e-02f, -2.423076690e-02f, -1.863724919e-02f, -4.126652928e-03f, +1.669431448e-02f, +3.801674993e-02f, +5.290770668e-02f, +5.617988770e-02f, +4.666432713e-02f, +2.773278351e-02f, +5.800499486e-03f, -1.242260980e-02f, -2.256271775e-02f, -2.388233174e-02f, -1.882170532e-02f, -1.127905759e-02f, -4.670573645e-03f, -7.237418200e-04f, +6.151072142e-04f, - /* 24,13 */ +6.174753085e-04f, +2.924431607e-04f, -2.091585491e-03f, -7.290876362e-03f, -1.463489443e-02f, -2.157995394e-02f, -2.429058667e-02f, -1.925469982e-02f, -5.264319552e-03f, +1.530671242e-02f, +3.680336864e-02f, +5.228048761e-02f, +5.636179897e-02f, +4.759010507e-02f, +2.907819451e-02f, +7.124994951e-03f, -1.149248169e-02f, -2.219832191e-02f, -2.402372023e-02f, -1.925234223e-02f, -1.175144649e-02f, -5.013694839e-03f, -8.861942853e-04f, +5.894596941e-04f, - /* 24,14 */ +5.982066157e-04f, +3.605947820e-04f, -1.862540304e-03f, -6.886752185e-03f, -1.415229209e-02f, -2.122761958e-02f, -2.431936776e-02f, -1.983593655e-02f, -6.375136316e-03f, +1.392318625e-02f, +3.556594146e-02f, +5.160740292e-02f, +5.649192540e-02f, +4.847674006e-02f, +3.041001010e-02f, +8.463295193e-03f, -1.053019587e-02f, -2.179812108e-02f, -2.413881461e-02f, -1.967247249e-02f, -1.222740313e-02f, -5.367638258e-03f, -1.059370463e-03f, +5.575380238e-04f, - /* 24,15 */ +5.761542752e-04f, +4.208638005e-04f, -1.644903025e-03f, -6.492037400e-03f, -1.366943909e-02f, -2.085968072e-02f, -2.431781992e-02f, -2.038088472e-02f, -7.458075491e-03f, +1.254542812e-02f, +3.430616434e-02f, +5.088942272e-02f, +5.657007725e-02f, +4.932296812e-02f, +3.172645287e-02f, +9.813857768e-03f, -9.536491055e-03f, -2.136190754e-02f, -2.422674988e-02f, -2.008108462e-02f, -1.270621714e-02f, -5.732182665e-03f, -1.243445781e-03f, +5.190146993e-04f, - /* 24, 0 */ +2.273459443e-03f, +5.435907648e-03f, +7.255296399e-03f, +3.788129032e-03f, -7.144684562e-03f, -2.265374973e-02f, -3.442368170e-02f, -3.287677614e-02f, -1.387331771e-02f, +1.679264590e-02f, +4.511451955e-02f, +5.659614054e-02f, +4.511451955e-02f, +1.679264590e-02f, -1.387331771e-02f, -3.287677614e-02f, -3.442368170e-02f, -2.265374973e-02f, -7.144684562e-03f, +3.788129032e-03f, +7.255296399e-03f, +5.435907648e-03f, +2.273459443e-03f, +3.568431303e-04f, - /* 24, 1 */ +2.103234406e-03f, +5.239407106e-03f, +7.256400195e-03f, +4.221207454e-03f, -6.266228991e-03f, -2.168841690e-02f, -3.399213075e-02f, -3.348773370e-02f, -1.551504116e-02f, +1.477681868e-02f, +4.371373211e-02f, +5.654911556e-02f, +4.644656718e-02f, +1.879953521e-02f, -1.218307761e-02f, -3.219410560e-02f, -3.480135038e-02f, -2.360501860e-02f, -8.042999544e-03f, +3.324105568e-03f, +7.232988111e-03f, +5.627714430e-03f, +2.449385040e-03f, +4.247055554e-04f, - /* 24, 2 */ +1.939021806e-03f, +5.039131826e-03f, +7.237298926e-03f, +4.623451366e-03f, -5.409068119e-03f, -2.071157693e-02f, -3.350883303e-02f, -3.402698064e-02f, -1.710557364e-02f, +1.275612557e-02f, +4.224725679e-02f, +5.640814528e-02f, +4.770696520e-02f, +2.079340350e-02f, -1.044713814e-02f, -3.143988919e-02f, -3.512309015e-02f, -2.453963953e-02f, -8.959642554e-03f, +2.829112073e-03f, +7.188501693e-03f, +5.813881008e-03f, +2.630658922e-03f, +4.992251326e-04f, - /* 24, 3 */ +1.781093672e-03f, +4.835971292e-03f, +7.199013760e-03f, +4.995053998e-03f, -4.574539506e-03f, -1.972575310e-02f, -3.297600576e-02f, -3.449468646e-02f, -1.864238902e-02f, +1.073461753e-02f, +4.071827965e-02f, +5.617354343e-02f, +4.889295364e-02f, +2.277016679e-02f, -8.668453837e-03f, -3.061446547e-02f, -3.538695026e-02f, -2.545500791e-02f, -9.892988076e-03f, +2.303211764e-03f, +7.120893393e-03f, +5.993435804e-03f, +2.816887995e-03f, +5.805470381e-04f, - /* 24, 4 */ +1.629682882e-03f, +4.630783503e-03f, +7.142583584e-03f, +5.336288236e-03f, -3.763881685e-03f, -1.873342898e-02f, -3.239594057e-02f, -3.489118499e-02f, -2.012311412e-02f, +8.716314532e-03f, +3.913011251e-02f, +5.584583195e-02f, +5.000192959e-02f, +2.472575033e-02f, -6.850110412e-03f, -2.971834586e-02f, -3.559108276e-02f, -2.634850527e-02f, -1.084131876e-02f, +1.746558492e-03f, +7.029253460e-03f, +6.165384566e-03f, +3.007638074e-03f, +6.687931554e-04f, - /* 24, 5 */ +1.484983972e-03f, +4.424393216e-03f, +7.069061064e-03f, +5.647503405e-03f, -2.978233194e-03f, -1.773704257e-02f, -3.177099609e-02f, -3.521697115e-02f, -2.154553308e-02f, +6.705195776e-03f, +3.748618427e-02f, +5.542573963e-02f, +5.103145416e-02f, +2.665609886e-02f, -4.995318215e-03f, -2.875221569e-02f, -3.573374914e-02f, -2.721750622e-02f, -1.180282806e-02f, +1.159398961e-03f, +6.912710257e-03f, +6.328712988e-03f, +3.202433762e-03f, +7.640603932e-04f, - /* 24, 6 */ +1.347154069e-03f, +4.217590351e-03f, +6.979508760e-03f, +5.929121902e-03f, -2.218631929e-03f, -1.673898061e-02f, -3.110359053e-02f, -3.547269735e-02f, -2.290759116e-02f, +4.705190128e-03f, +3.579003198e-02f, +5.491420012e-02f, +5.197925890e-02f, +2.855718684e-02f, -3.107405323e-03f, -2.771693469e-02f, -3.581332680e-02f, -2.805938547e-02f, -1.277562317e-02f, +5.420746921e-04f, +6.770434377e-03f, +6.482389493e-03f, +3.400758480e-03f, +8.664190421e-04f, - /* 24, 7 */ +1.216313935e-03f, +4.011128586e-03f, +6.874995333e-03f, +6.181635683e-03f, -1.486014823e-03f, -1.574157316e-02f, -3.039619415e-02f, -3.565916944e-02f, -2.420739811e-02f, +2.720166717e-03f, +3.404529163e-02f, +5.431234943e-02f, +5.284325182e-02f, +3.042502866e-02f, -1.189810237e-03f, -2.661353708e-02f, -3.582831530e-02f, -2.887152508e-02f, -1.375772836e-02f, -1.049762569e-04f, +6.601642735e-03f, +6.625368167e-03f, +3.602054665e-03f, +9.759111772e-04f, - /* 24, 8 */ +1.092549115e-03f, +3.805724130e-03f, +6.756591845e-03f, +6.405602617e-03f, -7.812178358e-04f, -1.474708852e-02f, -2.965132174e-02f, -3.577734234e-02f, -2.544323110e-02f, +7.539257812e-04f, +3.225568873e-02f, +5.362152294e-02f, +5.362152294e-02f, +3.225568873e-02f, +7.539257812e-04f, -2.544323110e-02f, -3.577734234e-02f, -2.965132174e-02f, -1.474708852e-02f, -7.812178358e-04f, +6.405602617e-03f, +6.756591845e-03f, +3.805724130e-03f, +1.092549115e-03f, - /* 24, 9 */ +9.759111772e-04f, +3.602054665e-03f, +6.625368167e-03f, +6.601642735e-03f, -1.049762569e-04f, -1.375772836e-02f, -2.887152508e-02f, -3.582831530e-02f, -2.661353708e-02f, -1.189810237e-03f, +3.042502866e-02f, +5.284325182e-02f, +5.431234943e-02f, +3.404529163e-02f, +2.720166717e-03f, -2.420739811e-02f, -3.565916944e-02f, -3.039619415e-02f, -1.574157316e-02f, -1.486014823e-03f, +6.181635683e-03f, +6.874995333e-03f, +4.011128586e-03f, +1.216313935e-03f, - /* 24,10 */ +8.664190421e-04f, +3.400758480e-03f, +6.482389493e-03f, +6.770434377e-03f, +5.420746921e-04f, -1.277562317e-02f, -2.805938547e-02f, -3.581332680e-02f, -2.771693469e-02f, -3.107405323e-03f, +2.855718684e-02f, +5.197925890e-02f, +5.491420012e-02f, +3.579003198e-02f, +4.705190128e-03f, -2.290759116e-02f, -3.547269735e-02f, -3.110359053e-02f, -1.673898061e-02f, -2.218631929e-03f, +5.929121902e-03f, +6.979508760e-03f, +4.217590351e-03f, +1.347154069e-03f, - /* 24,11 */ +7.640603932e-04f, +3.202433762e-03f, +6.328712988e-03f, +6.912710257e-03f, +1.159398961e-03f, -1.180282806e-02f, -2.721750622e-02f, -3.573374914e-02f, -2.875221569e-02f, -4.995318215e-03f, +2.665609886e-02f, +5.103145416e-02f, +5.542573963e-02f, +3.748618427e-02f, +6.705195776e-03f, -2.154553308e-02f, -3.521697115e-02f, -3.177099609e-02f, -1.773704257e-02f, -2.978233194e-03f, +5.647503405e-03f, +7.069061064e-03f, +4.424393216e-03f, +1.484983972e-03f, - /* 24,12 */ +6.687931554e-04f, +3.007638074e-03f, +6.165384566e-03f, +7.029253460e-03f, +1.746558492e-03f, -1.084131876e-02f, -2.634850527e-02f, -3.559108276e-02f, -2.971834586e-02f, -6.850110412e-03f, +2.472575033e-02f, +5.000192959e-02f, +5.584583195e-02f, +3.913011251e-02f, +8.716314532e-03f, -2.012311412e-02f, -3.489118499e-02f, -3.239594057e-02f, -1.873342898e-02f, -3.763881685e-03f, +5.336288236e-03f, +7.142583584e-03f, +4.630783503e-03f, +1.629682882e-03f, - /* 24,13 */ +5.805470381e-04f, +2.816887995e-03f, +5.993435804e-03f, +7.120893393e-03f, +2.303211764e-03f, -9.892988076e-03f, -2.545500791e-02f, -3.538695026e-02f, -3.061446547e-02f, -8.668453837e-03f, +2.277016679e-02f, +4.889295364e-02f, +5.617354343e-02f, +4.071827965e-02f, +1.073461753e-02f, -1.864238902e-02f, -3.449468646e-02f, -3.297600576e-02f, -1.972575310e-02f, -4.574539506e-03f, +4.995053998e-03f, +7.199013760e-03f, +4.835971292e-03f, +1.781093672e-03f, - /* 24,14 */ +4.992251326e-04f, +2.630658922e-03f, +5.813881008e-03f, +7.188501693e-03f, +2.829112073e-03f, -8.959642554e-03f, -2.453963953e-02f, -3.512309015e-02f, -3.143988919e-02f, -1.044713814e-02f, +2.079340350e-02f, +4.770696520e-02f, +5.640814528e-02f, +4.224725679e-02f, +1.275612557e-02f, -1.710557364e-02f, -3.402698064e-02f, -3.350883303e-02f, -2.071157693e-02f, -5.409068119e-03f, +4.623451366e-03f, +7.237298926e-03f, +5.039131826e-03f, +1.939021806e-03f, - /* 24,15 */ +4.247055554e-04f, +2.449385040e-03f, +5.627714430e-03f, +7.232988111e-03f, +3.324105568e-03f, -8.042999544e-03f, -2.360501860e-02f, -3.480135038e-02f, -3.219410560e-02f, -1.218307761e-02f, +1.879953521e-02f, +4.644656718e-02f, +5.654911556e-02f, +4.371373211e-02f, +1.477681868e-02f, -1.551504116e-02f, -3.348773370e-02f, -3.399213075e-02f, -2.168841690e-02f, -6.266228991e-03f, +4.221207454e-03f, +7.256400195e-03f, +5.239407106e-03f, +2.103234406e-03f, - /* 24, 0 */ -2.181310192e-03f, -7.982329251e-04f, +5.680209618e-03f, +1.430719659e-02f, +1.589843483e-02f, +2.406871994e-03f, -2.249676846e-02f, -4.130100690e-02f, -3.506718353e-02f, -1.541681908e-03f, +3.867898214e-02f, +5.659614054e-02f, +3.867898214e-02f, -1.541681908e-03f, -3.506718353e-02f, -4.130100690e-02f, -2.249676846e-02f, +2.406871994e-03f, +1.589843483e-02f, +1.430719659e-02f, +5.680209618e-03f, -7.982329251e-04f, -2.181310192e-03f, -9.324150638e-04f, - /* 24, 1 */ -2.142117633e-03f, -1.026327303e-03f, +5.144075019e-03f, +1.386145083e-02f, +1.619749380e-02f, +3.702669669e-03f, -2.089125129e-02f, -4.071342524e-02f, -3.635626763e-02f, -4.137848013e-03f, +3.654904222e-02f, +5.652117066e-02f, +4.071616274e-02f, +1.083860427e-03f, -3.366302266e-02f, -4.178478525e-02f, -2.407924887e-02f, +1.061252794e-03f, +1.553625174e-02f, +1.472529111e-02f, +6.227191439e-03f, -5.482915187e-04f, -2.210193915e-03f, -1.021372070e-03f, - /* 24, 2 */ -2.093579858e-03f, -1.232841058e-03f, +4.620399561e-03f, +1.339085359e-02f, +1.643462496e-02f, +4.945866528e-03f, -1.926829204e-02f, -4.002576024e-02f, -3.752797769e-02f, -6.697199080e-03f, +3.433305089e-02f, +5.629650283e-02f, +4.265414906e-02f, +3.731182183e-03f, -3.214649405e-02f, -4.216132985e-02f, -2.563305646e-02f, -3.311524193e-04f, +1.510995111e-02f, +1.511293981e-02f, +6.783287607e-03f, -2.763303743e-04f, -2.227804667e-03f, -1.112061839e-03f, - /* 24, 3 */ -2.036654869e-03f, -1.418128950e-03f, +4.110671651e-03f, +1.289819803e-02f, +1.661121711e-02f, +6.133943976e-03f, -1.763342417e-02f, -3.924200344e-02f, -3.858043162e-02f, -9.212479159e-03f, +3.203796457e-02f, +5.592286159e-02f, +4.448680259e-02f, +6.392554173e-03f, -3.052071354e-02f, -4.242751674e-02f, -2.715253413e-02f, -1.767057534e-03f, +1.461875233e-02f, +1.546736546e-02f, +7.346647501e-03f, +1.772445414e-05f, -2.233183138e-03f, -1.203936109e-03f, - /* 24, 4 */ -1.972290178e-03f, -1.582628528e-03f, +3.616254280e-03f, +1.238625918e-02f, +1.672884047e-02f, +7.264647438e-03f, -1.599210066e-02f, -3.836639935e-02f, -3.951216427e-02f, -1.167663915e-02f, +2.967096294e-02f, +5.540145153e-02f, +4.620830373e-02f, +9.060141131e-03f, -2.878919714e-02f, -4.258054458e-02f, -2.863202454e-02f, -3.242932618e-03f, +1.406209682e-02f, +1.578582064e-02f, +7.915306646e-03f, +3.338433846e-04f, -2.225380377e-03f, -1.296401007e-03f, - /* 24, 5 */ -1.901418208e-03f, -1.726854356e-03f, +3.138383775e-03f, +1.185778300e-02f, +1.678923519e-02f, +8.335988548e-03f, -1.434967550e-02f, -3.740342600e-02f, -4.032212766e-02f, -1.408285985e-02f, +2.723942290e-02f, +5.473395280e-02f, +4.781317317e-02f, +1.172602857e-02f, -2.695585286e-02f, -4.261794963e-02f, -3.006589126e-02f, -4.755011838e-03f, +1.343965653e-02f, +1.606560041e-02f, +8.487191262e-03f, +6.718888821e-04f, -2.203463508e-03f, -1.388818223e-03f, - /* 24, 6 */ -1.824951954e-03f, -1.851392085e-03f, +2.678169173e-03f, +1.131547576e-02f, +1.679429951e-02f, +9.346246206e-03f, -1.271138577e-02f, -3.635777499e-02f, -4.100968953e-02f, -1.642457396e-02f, +2.475089197e-02f, +5.392251484e-02f, +4.929629202e-02f, +1.438225015e-02f, -2.502497093e-02f, -4.253761970e-02f, -3.144854025e-02f, -6.299302508e-03f, +1.275134172e-02f, +1.630405519e-02f, +9.060123484e-03f, +1.031611407e-03f, -2.166521604e-03f, -1.480506488e-03f, - /* 24, 7 */ -1.743780953e-03f, -1.956892396e-03f, +2.236592212e-03f, +1.076199396e-02f, +1.674607744e-02f, +1.029396653e-02f, -1.108233467e-02f, -3.523433096e-02f, -4.157463041e-02f, -1.869548696e-02f, +2.221306113e-02f, +5.296974848e-02f, +5.065292065e-02f, +1.702081530e-02f, -2.300121251e-02f, -4.233780689e-02f, -3.277444146e-02f, -7.871595256e-03f, +1.199730786e-02f, +1.649860375e-02f, +9.631827247e-03f, +1.412645767e-03f, -2.113671692e-03f, -1.570743396e-03f, - /* 24, 8 */ -1.658767534e-03f, -2.044064852e-03f, +1.814507917e-03f, +1.019993481e-02f, +1.664674627e-02f, +1.117796172e-02f, -9.467475281e-03f, -3.403815061e-02f, -4.201713914e-02f, -2.088959684e-02f, +1.963373727e-02f, +5.187871616e-02f, +5.187871616e-02f, +1.963373727e-02f, -2.088959684e-02f, -4.201713914e-02f, -3.403815061e-02f, -9.467475281e-03f, +1.117796172e-02f, +1.664674627e-02f, +1.019993481e-02f, +1.814507917e-03f, -2.044064852e-03f, -1.658767534e-03f, - /* 24, 9 */ -1.570743396e-03f, -2.113671692e-03f, +1.412645767e-03f, +9.631827247e-03f, +1.649860375e-02f, +1.199730786e-02f, -7.871595256e-03f, -3.277444146e-02f, -4.233780689e-02f, -2.300121251e-02f, +1.702081530e-02f, +5.065292065e-02f, +5.296974848e-02f, +2.221306113e-02f, -1.869548696e-02f, -4.157463041e-02f, -3.523433096e-02f, -1.108233467e-02f, +1.029396653e-02f, +1.674607744e-02f, +1.076199396e-02f, +2.236592212e-03f, -1.956892396e-03f, -1.743780953e-03f, - /* 24,10 */ -1.480506488e-03f, -2.166521604e-03f, +1.031611407e-03f, +9.060123484e-03f, +1.630405519e-02f, +1.275134172e-02f, -6.299302508e-03f, -3.144854025e-02f, -4.253761970e-02f, -2.502497093e-02f, +1.438225015e-02f, +4.929629202e-02f, +5.392251484e-02f, +2.475089197e-02f, -1.642457396e-02f, -4.100968953e-02f, -3.635777499e-02f, -1.271138577e-02f, +9.346246206e-03f, +1.679429951e-02f, +1.131547576e-02f, +2.678169173e-03f, -1.851392085e-03f, -1.824951954e-03f, - /* 24,11 */ -1.388818223e-03f, -2.203463508e-03f, +6.718888821e-04f, +8.487191262e-03f, +1.606560041e-02f, +1.343965653e-02f, -4.755011838e-03f, -3.006589126e-02f, -4.261794963e-02f, -2.695585286e-02f, +1.172602857e-02f, +4.781317317e-02f, +5.473395280e-02f, +2.723942290e-02f, -1.408285985e-02f, -4.032212766e-02f, -3.740342600e-02f, -1.434967550e-02f, +8.335988548e-03f, +1.678923519e-02f, +1.185778300e-02f, +3.138383775e-03f, -1.726854356e-03f, -1.901418208e-03f, - /* 24,12 */ -1.296401007e-03f, -2.225380377e-03f, +3.338433846e-04f, +7.915306646e-03f, +1.578582064e-02f, +1.406209682e-02f, -3.242932618e-03f, -2.863202454e-02f, -4.258054458e-02f, -2.878919714e-02f, +9.060141131e-03f, +4.620830373e-02f, +5.540145153e-02f, +2.967096294e-02f, -1.167663915e-02f, -3.951216427e-02f, -3.836639935e-02f, -1.599210066e-02f, +7.264647438e-03f, +1.672884047e-02f, +1.238625918e-02f, +3.616254280e-03f, -1.582628528e-03f, -1.972290178e-03f, - /* 24,13 */ -1.203936109e-03f, -2.233183138e-03f, +1.772445414e-05f, +7.346647501e-03f, +1.546736546e-02f, +1.461875233e-02f, -1.767057534e-03f, -2.715253413e-02f, -4.242751674e-02f, -3.052071354e-02f, +6.392554173e-03f, +4.448680259e-02f, +5.592286159e-02f, +3.203796457e-02f, -9.212479159e-03f, -3.858043162e-02f, -3.924200344e-02f, -1.763342417e-02f, +6.133943976e-03f, +1.661121711e-02f, +1.289819803e-02f, +4.110671651e-03f, -1.418128950e-03f, -2.036654869e-03f, - /* 24,14 */ -1.112061839e-03f, -2.227804667e-03f, -2.763303743e-04f, +6.783287607e-03f, +1.511293981e-02f, +1.510995111e-02f, -3.311524193e-04f, -2.563305646e-02f, -4.216132985e-02f, -3.214649405e-02f, +3.731182183e-03f, +4.265414906e-02f, +5.629650283e-02f, +3.433305089e-02f, -6.697199080e-03f, -3.752797769e-02f, -4.002576024e-02f, -1.926829204e-02f, +4.945866528e-03f, +1.643462496e-02f, +1.339085359e-02f, +4.620399561e-03f, -1.232841058e-03f, -2.093579858e-03f, - /* 24,15 */ -1.021372070e-03f, -2.210193915e-03f, -5.482915187e-04f, +6.227191439e-03f, +1.472529111e-02f, +1.553625174e-02f, +1.061252794e-03f, -2.407924887e-02f, -4.178478525e-02f, -3.366302266e-02f, +1.083860427e-03f, +4.071616274e-02f, +5.652117066e-02f, +3.654904222e-02f, -4.137848013e-03f, -3.635626763e-02f, -4.071342524e-02f, -2.089125129e-02f, +3.702669669e-03f, +1.619749380e-02f, +1.386145083e-02f, +5.144075019e-03f, -1.026327303e-03f, -2.142117633e-03f, - /* 24, 0 */ -6.349328336e-04f, -5.107444449e-03f, -7.589492700e-03f, +4.421169254e-04f, +1.733331948e-02f, +2.497839430e-02f, +6.069612140e-03f, -2.970035006e-02f, -4.651799663e-02f, -1.968310326e-02f, +3.102388246e-02f, +5.659614054e-02f, +3.102388246e-02f, -1.968310326e-02f, -4.651799663e-02f, -2.970035006e-02f, +6.069612140e-03f, +2.497839430e-02f, +1.733331948e-02f, +4.421169254e-04f, -7.589492700e-03f, -5.107444449e-03f, -6.349328336e-04f, +6.381929817e-04f, - /* 24, 1 */ -4.501246045e-04f, -4.794789988e-03f, -7.673310752e-03f, -4.276921651e-04f, +1.630487239e-02f, +2.519230977e-02f, +8.023727481e-03f, -2.760467194e-02f, -4.668156835e-02f, -2.250226055e-02f, +2.808383767e-02f, +5.648624601e-02f, +3.385706239e-02f, -1.675917373e-02f, -4.616688010e-02f, -3.171828840e-02f, +4.039135426e-03f, +2.465060544e-02f, +1.832599562e-02f, +1.353161175e-03f, -7.461005422e-03f, -5.414037993e-03f, -8.347893499e-04f, +6.459962873e-04f, - /* 24, 2 */ -2.805431667e-04f, -4.478334337e-03f, -7.714347254e-03f, -1.253762011e-03f, +1.524677189e-02f, +2.529479915e-02f, +9.894771606e-03f, -2.544172743e-02f, -4.665953469e-02f, -2.520578478e-02f, +2.504972253e-02f, +5.615705320e-02f, +3.657100703e-02f, -1.374190145e-02f, -4.562711379e-02f, -3.364818878e-02f, +1.939527429e-03f, +2.420699082e-02f, +1.927675855e-02f, +2.302607998e-03f, -7.286133997e-03f, -5.712221732e-03f, -1.049390115e-03f, +6.454263440e-04f, - /* 24, 3 */ -1.262469087e-04f, -4.160237857e-03f, -7.714644364e-03f, -2.033919173e-03f, +1.416507919e-02f, +2.528877950e-02f, +1.167657735e-02f, -2.322211124e-02f, -4.645464989e-02f, -2.778343069e-02f, +2.193469332e-02f, +5.561003206e-02f, +3.915383052e-02f, -1.064323425e-02f, -4.489844274e-02f, -3.547998209e-02f, -2.214871506e-04f, +2.364611605e-02f, +2.017947396e-02f, +3.287300483e-03f, -7.063354139e-03f, -5.999568857e-03f, -1.278300802e-03f, +6.356530069e-04f, - /* 24, 4 */ +1.281987696e-05f, -3.842552418e-03f, -7.676380196e-03f, -2.766321017e-03f, +1.306576874e-02f, +2.517761055e-02f, +1.336353941e-02f, -2.095648565e-02f, -4.607045954e-02f, -3.022561220e-02f, +1.875220414e-02f, +5.484762432e-02f, +4.159418981e-02f, -7.475585158e-03f, -4.398147340e-02f, -3.720388175e-02f, -2.435717775e-03f, +2.296708552e-02f, +2.102804905e-02f, +4.303763633e-03f, -6.791349552e-03f, -6.273586899e-03f, -1.520952773e-03f, +6.158659890e-04f, - /* 24, 5 */ +1.368204413e-04f, -3.527213369e-03f, -7.601850138e-03f, -3.449453954e-03f, +1.195469912e-02f, +2.496506585e-02f, +1.495063011e-02f, -1.865552736e-02f, -4.551127331e-02f, -3.252344226e-02f, +1.551594186e-02f, +5.387323140e-02f, +4.388134039e-02f, -4.251776447e-03f, -4.287768073e-02f, -3.881043651e-02f, -4.694539858e-03f, +2.216956067e-02f, +2.181646678e-02f, +5.348212687e-03f, -6.469028645e-03f, -6.531730950e-03f, -1.776639841e-03f, +5.852828120e-04f, - /* 24, 6 */ +2.460185614e-04f, -3.216032617e-03f, -7.493448175e-03f, -4.082129823e-03f, +1.083758546e-02f, +2.465530244e-02f, +1.643341199e-02f, -1.632987505e-02f, -4.478213426e-02f, -3.466876896e-02f, +1.223976005e-02f, +5.269119738e-02f, +4.600518917e-02f, -9.849812576e-04f, -4.158941105e-02f, -4.029058231e-02f, -6.988929457e-03f, +2.125377578e-02f, +2.253882061e-02f, +6.416563547e-03f, -6.095540465e-03f, -6.771417794e-03f, -2.044515881e-03f, +5.431569434e-04f, - /* 24, 7 */ +3.407711290e-04f, -2.910692818e-03f, -7.353648294e-03f, -4.663480492e-03f, +9.719973395e-03f, +2.425282916e-02f, +1.780804686e-02f, -1.399007798e-02f, -4.388878466e-02f, -3.665420751e-02f, +8.937612534e-03f, +5.130678745e-02f, +4.795634432e-02f, +2.311336934e-03f, -4.011988036e-02f, -4.163569289e-02f, -9.309500719e-03f, +2.022055084e-02f, +2.318934965e-02f, +7.504445299e-03f, -5.670289717e-03f, -6.990040888e-03f, -2.323593338e-03f, +4.887860648e-04f, - /* 24, 8 */ +4.215204125e-04f, -2.612742676e-03f, -7.184986124e-03f, -5.192950770e-03f, +8.607214812e-03f, +2.376247385e-02f, +1.907130164e-02f, -1.164654593e-02f, -4.283762880e-02f, -3.847316827e-02f, +5.623486691e-03f, +4.972616165e-02f, +4.972616165e-02f, +5.623486691e-03f, -3.847316827e-02f, -4.283762880e-02f, -1.164654593e-02f, +1.907130164e-02f, +2.376247385e-02f, +8.607214812e-03f, -5.192950770e-03f, -7.184986124e-03f, -2.612742676e-03f, +4.215204125e-04f, - /* 24, 9 */ +4.887860648e-04f, -2.323593338e-03f, -6.990040888e-03f, -5.670289717e-03f, +7.504445299e-03f, +2.318934965e-02f, +2.022055084e-02f, -9.309500719e-03f, -4.163569289e-02f, -4.011988036e-02f, +2.311336934e-03f, +4.795634432e-02f, +5.130678745e-02f, +8.937612534e-03f, -3.665420751e-02f, -4.388878466e-02f, -1.399007798e-02f, +1.780804686e-02f, +2.425282916e-02f, +9.719973395e-03f, -4.663480492e-03f, -7.353648294e-03f, -2.910692818e-03f, +3.407711290e-04f, - /* 24,10 */ +5.431569434e-04f, -2.044515881e-03f, -6.771417794e-03f, -6.095540465e-03f, +6.416563547e-03f, +2.253882061e-02f, +2.125377578e-02f, -6.988929457e-03f, -4.029058231e-02f, -4.158941105e-02f, -9.849812576e-04f, +4.600518917e-02f, +5.269119738e-02f, +1.223976005e-02f, -3.466876896e-02f, -4.478213426e-02f, -1.632987505e-02f, +1.643341199e-02f, +2.465530244e-02f, +1.083758546e-02f, -4.082129823e-03f, -7.493448175e-03f, -3.216032617e-03f, +2.460185614e-04f, - /* 24,11 */ +5.852828120e-04f, -1.776639841e-03f, -6.531730950e-03f, -6.469028645e-03f, +5.348212687e-03f, +2.181646678e-02f, +2.216956067e-02f, -4.694539858e-03f, -3.881043651e-02f, -4.287768073e-02f, -4.251776447e-03f, +4.388134039e-02f, +5.387323140e-02f, +1.551594186e-02f, -3.252344226e-02f, -4.551127331e-02f, -1.865552736e-02f, +1.495063011e-02f, +2.496506585e-02f, +1.195469912e-02f, -3.449453954e-03f, -7.601850138e-03f, -3.527213369e-03f, +1.368204413e-04f, - /* 24,12 */ +6.158659890e-04f, -1.520952773e-03f, -6.273586899e-03f, -6.791349552e-03f, +4.303763633e-03f, +2.102804905e-02f, +2.296708552e-02f, -2.435717775e-03f, -3.720388175e-02f, -4.398147340e-02f, -7.475585158e-03f, +4.159418981e-02f, +5.484762432e-02f, +1.875220414e-02f, -3.022561220e-02f, -4.607045954e-02f, -2.095648565e-02f, +1.336353941e-02f, +2.517761055e-02f, +1.306576874e-02f, -2.766321017e-03f, -7.676380196e-03f, -3.842552418e-03f, +1.281987696e-05f, - /* 24,13 */ +6.356530069e-04f, -1.278300802e-03f, -5.999568857e-03f, -7.063354139e-03f, +3.287300483e-03f, +2.017947396e-02f, +2.364611605e-02f, -2.214871506e-04f, -3.547998209e-02f, -4.489844274e-02f, -1.064323425e-02f, +3.915383052e-02f, +5.561003206e-02f, +2.193469332e-02f, -2.778343069e-02f, -4.645464989e-02f, -2.322211124e-02f, +1.167657735e-02f, +2.528877950e-02f, +1.416507919e-02f, -2.033919173e-03f, -7.714644364e-03f, -4.160237857e-03f, -1.262469087e-04f, - /* 24,14 */ +6.454263440e-04f, -1.049390115e-03f, -5.712221732e-03f, -7.286133997e-03f, +2.302607998e-03f, +1.927675855e-02f, +2.420699082e-02f, +1.939527429e-03f, -3.364818878e-02f, -4.562711379e-02f, -1.374190145e-02f, +3.657100703e-02f, +5.615705320e-02f, +2.504972253e-02f, -2.520578478e-02f, -4.665953469e-02f, -2.544172743e-02f, +9.894771606e-03f, +2.529479915e-02f, +1.524677189e-02f, -1.253762011e-03f, -7.714347254e-03f, -4.478334337e-03f, -2.805431667e-04f, - /* 24,15 */ +6.459962873e-04f, -8.347893499e-04f, -5.414037993e-03f, -7.461005422e-03f, +1.353161175e-03f, +1.832599562e-02f, +2.465060544e-02f, +4.039135426e-03f, -3.171828840e-02f, -4.616688010e-02f, -1.675917373e-02f, +3.385706239e-02f, +5.648624601e-02f, +2.808383767e-02f, -2.250226055e-02f, -4.668156835e-02f, -2.760467194e-02f, +8.023727481e-03f, +2.519230977e-02f, +1.630487239e-02f, -4.276921651e-04f, -7.673310752e-03f, -4.794789988e-03f, -4.501246045e-04f, - /* 24, 0 */ +1.197013499e-03f, +3.320493122e-03f, -3.017233048e-03f, -9.987553340e-03f, -4.112967049e-03f, +1.524501264e-02f, +2.235677036e-02f, -2.137559158e-03f, -3.327370097e-02f, -2.660122408e-02f, +1.657531807e-02f, +4.232694754e-02f, +1.657531807e-02f, -2.660122408e-02f, -3.327370097e-02f, -2.137559158e-03f, +2.235677036e-02f, +1.524501264e-02f, -4.112967049e-03f, -9.987553340e-03f, -3.017233048e-03f, +2.318357031e-03f, +1.197013499e-03f, -1.261205705e-04f, - /* 24, 1 */ +1.060573898e-03f, +3.246029352e-03f, -2.510607281e-03f, -9.784551764e-03f, -5.018393221e-03f, +1.404948670e-02f, +2.282515537e-02f, +7.626640355e-05f, -3.208475603e-02f, -2.845760231e-02f, +1.374134711e-02f, +4.221250979e-02f, +1.933345641e-02f, -2.458052660e-02f, -3.429687591e-02f, -4.386190237e-03f, +2.174698353e-02f, +1.639120730e-02f, -3.143642175e-03f, -1.013545813e-02f, -3.535011248e-03f, +2.193303334e-03f, +1.338504197e-03f, -9.901282259e-05f, - /* 24, 2 */ +9.298712414e-04f, +3.156277727e-03f, -2.018194158e-03f, -9.530340989e-03f, -5.856606243e-03f, +1.281349999e-02f, +2.315294314e-02f, +2.243024978e-03f, -3.073934924e-02f, -3.014061672e-02f, +1.084811230e-02f, +4.186988491e-02f, +2.199957595e-02f, -2.240563854e-02f, -3.514586546e-02f, -6.656913804e-03f, +2.099588115e-02f, +1.747926153e-02f, -2.114297018e-03f, -1.022461460e-02f, -4.060636553e-03f, +2.039754046e-03f, +1.484263468e-03f, -6.526428163e-05f, - /* 24, 3 */ +8.054954021e-04f, +3.052984548e-03f, -1.542795645e-03f, -9.229007144e-03f, -6.624860539e-03f, +1.154592266e-02f, +2.334180387e-02f, +4.350977952e-03f, -2.924761047e-02f, -3.164235460e-02f, +7.912459038e-03f, +4.130113344e-02f, +2.455797710e-02f, -2.008771737e-02f, -3.581321303e-02f, -8.936640836e-03f, +2.010445982e-02f, +1.850049032e-02f, -1.029364704e-03f, -1.025164428e-02f, -4.590574200e-03f, +1.857070273e-03f, +1.633412152e-03f, -2.453170435e-05f, - /* 24, 4 */ +6.879416803e-04f, +2.937877889e-03f, -1.086944946e-03f, -8.884797195e-03f, -7.320980005e-03f, +1.025556440e-02f, +2.339424278e-02f, +6.388976156e-03f, -2.762041561e-02f, -3.295607494e-02f, +4.951401864e-03f, +4.050967459e-02f, +2.699354793e-02f, -1.763888677e-02f, -3.629248103e-02f, -1.121198570e-02f, +1.907464002e-02f, +1.944639638e-02f, +1.061806254e-04f, -1.021347789e-02f, -5.121078221e-03f, +1.644827972e-03f, +1.784975276e-03f, +2.348660763e-05f, - /* 24, 5 */ +5.776128643e-04f, +2.812656385e-03f, -6.528985547e-04f, -8.502081335e-03f, -7.943354450e-03f, +8.951116293e-03f, +2.331356438e-02f, +8.346521334e-03f, -2.586930694e-02f, -3.407624020e-02f, +1.982016505e-03f, +3.950026382e-02f, +2.929186185e-02f, -1.507216716e-02f, -3.657830513e-02f, -1.346934883e-02f, +1.790927350e-02f, +2.030873394e-02f, +1.286841938e-03f, -1.010739044e-02f, -5.648212144e-03f, +1.402832649e-03f, +1.937883690e-03f, +7.904503123e-05f, - /* 24, 6 */ +4.748218959e-04f, +2.678978820e-03f, -2.426308611e-04f, -8.085315763e-03f, -8.490932000e-03f, +7.641095022e-03f, +2.310383199e-02f, +1.021382218e-02f, -2.400641001e-02f, -3.499853994e-02f, -9.786680537e-04f, +3.827896159e-02f, +3.143927100e-02f, -1.240139974e-02f, -3.666644182e-02f, -1.569500220e-02f, +1.661214427e-02f, +2.107957227e-02f, +2.506621864e-03f, -9.931034771e-03f, -6.167872094e-03f, +1.131132707e-03f, +2.090976552e-03f, +1.423449116e-04f, - /* 24, 7 */ +3.797950945e-04f, +2.538454547e-03f, +1.421687298e-04f, -7.639006136e-03f, -8.963207645e-03f, +6.333789781e-03f, +2.276982298e-02f, +1.198184460e-02f, -2.204434780e-02f, -3.571990598e-02f, -3.913776625e-03f, +3.685309369e-02f, +3.342299483e-02f, -9.641164594e-03f, -3.655380902e-02f, -1.787517696e-02f, +1.518796320e-02f, +2.175135864e-02f, +3.759049618e-03f, -9.682473374e-03f, -6.675812165e-03f, +8.300312585e-04f, +2.243004675e-03f, +2.135289700e-04f, - /* 24, 8 */ +2.926758839e-04f, +2.392634763e-03f, +5.000962484e-04f, -7.167671961e-03f, -9.360208124e-03f, +5.037212205e-03f, +2.231697999e-02f, +1.364235598e-02f, -1.999615271e-02f, -3.623851940e-02f, -6.806693291e-03f, +3.523120326e-02f, +3.523120326e-02f, -6.806693291e-03f, -3.623851940e-02f, -1.999615271e-02f, +1.364235598e-02f, +2.231697999e-02f, +5.037212205e-03f, -9.360208124e-03f, -7.167671961e-03f, +5.000962484e-04f, +2.392634763e-03f, +2.926758839e-04f, - /* 24, 9 */ +2.135289700e-04f, +2.243004675e-03f, +8.300312585e-04f, -6.675812165e-03f, -9.682473374e-03f, +3.759049618e-03f, +2.175135864e-02f, +1.518796320e-02f, -1.787517696e-02f, -3.655380902e-02f, -9.641164594e-03f, +3.342299483e-02f, +3.685309369e-02f, -3.913776625e-03f, -3.571990598e-02f, -2.204434780e-02f, +1.198184460e-02f, +2.276982298e-02f, +6.333789781e-03f, -8.963207645e-03f, -7.639006136e-03f, +1.421687298e-04f, +2.538454547e-03f, +3.797950945e-04f, - /* 24,10 */ +1.423449116e-04f, +2.090976552e-03f, +1.131132707e-03f, -6.167872094e-03f, -9.931034771e-03f, +2.506621864e-03f, +2.107957227e-02f, +1.661214427e-02f, -1.569500220e-02f, -3.666644182e-02f, -1.240139974e-02f, +3.143927100e-02f, +3.827896159e-02f, -9.786680537e-04f, -3.499853994e-02f, -2.400641001e-02f, +1.021382218e-02f, +2.310383199e-02f, +7.641095022e-03f, -8.490932000e-03f, -8.085315763e-03f, -2.426308611e-04f, +2.678978820e-03f, +4.748218959e-04f, - /* 24,11 */ +7.904503123e-05f, +1.937883690e-03f, +1.402832649e-03f, -5.648212144e-03f, -1.010739044e-02f, +1.286841938e-03f, +2.030873394e-02f, +1.790927350e-02f, -1.346934883e-02f, -3.657830513e-02f, -1.507216716e-02f, +2.929186185e-02f, +3.950026382e-02f, +1.982016505e-03f, -3.407624020e-02f, -2.586930694e-02f, +8.346521334e-03f, +2.331356438e-02f, +8.951116293e-03f, -7.943354450e-03f, -8.502081335e-03f, -6.528985547e-04f, +2.812656385e-03f, +5.776128643e-04f, - /* 24,12 */ +2.348660763e-05f, +1.784975276e-03f, +1.644827972e-03f, -5.121078221e-03f, -1.021347789e-02f, +1.061806254e-04f, +1.944639638e-02f, +1.907464002e-02f, -1.121198570e-02f, -3.629248103e-02f, -1.763888677e-02f, +2.699354793e-02f, +4.050967459e-02f, +4.951401864e-03f, -3.295607494e-02f, -2.762041561e-02f, +6.388976156e-03f, +2.339424278e-02f, +1.025556440e-02f, -7.320980005e-03f, -8.884797195e-03f, -1.086944946e-03f, +2.937877889e-03f, +6.879416803e-04f, - /* 24,13 */ -2.453170435e-05f, +1.633412152e-03f, +1.857070273e-03f, -4.590574200e-03f, -1.025164428e-02f, -1.029364704e-03f, +1.850049032e-02f, +2.010445982e-02f, -8.936640836e-03f, -3.581321303e-02f, -2.008771737e-02f, +2.455797710e-02f, +4.130113344e-02f, +7.912459038e-03f, -3.164235460e-02f, -2.924761047e-02f, +4.350977952e-03f, +2.334180387e-02f, +1.154592266e-02f, -6.624860539e-03f, -9.229007144e-03f, -1.542795645e-03f, +3.052984548e-03f, +8.054954021e-04f, - /* 24,14 */ -6.526428163e-05f, +1.484263468e-03f, +2.039754046e-03f, -4.060636553e-03f, -1.022461460e-02f, -2.114297018e-03f, +1.747926153e-02f, +2.099588115e-02f, -6.656913804e-03f, -3.514586546e-02f, -2.240563854e-02f, +2.199957595e-02f, +4.186988491e-02f, +1.084811230e-02f, -3.014061672e-02f, -3.073934924e-02f, +2.243024978e-03f, +2.315294314e-02f, +1.281349999e-02f, -5.856606243e-03f, -9.530340989e-03f, -2.018194158e-03f, +3.156277727e-03f, +9.298712414e-04f, - /* 24,15 */ -9.901282259e-05f, +1.338504197e-03f, +2.193303334e-03f, -3.535011248e-03f, -1.013545813e-02f, -3.143642175e-03f, +1.639120730e-02f, +2.174698353e-02f, -4.386190237e-03f, -3.429687591e-02f, -2.458052660e-02f, +1.933345641e-02f, +4.221250979e-02f, +1.374134711e-02f, -2.845760231e-02f, -3.208475603e-02f, +7.626640355e-05f, +2.282515537e-02f, +1.404948670e-02f, -5.018393221e-03f, -9.784551764e-03f, -2.510607281e-03f, +3.246029352e-03f, +1.060573898e-03f, - /* 20, 0 */ +2.832126065e-03f, -3.455346407e-03f, -1.050167676e-02f, +5.399047405e-04f, +2.072547687e-02f, +1.261483344e-02f, -2.310421022e-02f, -3.076111900e-02f, +1.034529168e-02f, +3.949755319e-02f, +1.034529168e-02f, -3.076111900e-02f, -2.310421022e-02f, +1.261483344e-02f, +2.072547687e-02f, +5.399047405e-04f, -1.050167676e-02f, -3.455346407e-03f, +2.832126065e-03f, +1.002136091e-03f, - /* 20, 1 */ +2.918309836e-03f, -2.848965042e-03f, -1.044663371e-02f, -7.454467031e-04f, +1.993701966e-02f, +1.431336010e-02f, -2.105256806e-02f, -3.196996361e-02f, +7.274030562e-03f, +3.936378623e-02f, +1.336427867e-02f, -2.932648708e-02f, -2.503260290e-02f, +1.078376120e-02f, +2.138841986e-02f, +1.874755806e-03f, -1.047502359e-02f, -4.071193337e-03f, +2.709872705e-03f, +1.184613130e-03f, - /* 20, 2 */ +2.970014434e-03f, -2.256846905e-03f, -1.031411254e-02f, -1.973175306e-03f, +1.903277841e-02f, +1.586999913e-02f, -1.889465735e-02f, -3.294695719e-02f, +4.172714360e-03f, +3.896348732e-02f, +1.630904655e-02f, -2.767391419e-02f, -2.682143551e-02f, +8.830742245e-03f, +2.191685631e-02f, +3.250271284e-03f, -1.036300090e-02f, -4.691364292e-03f, +2.550244709e-03f, +1.728121332e-03f, - /* 20, 3 */ +2.989084466e-03f, -1.683415968e-03f, -1.010881741e-02f, -3.135916081e-03f, +1.802312126e-02f, +1.727671449e-02f, -1.664798407e-02f, -3.368784795e-02f, +1.063660935e-03f, +3.829965427e-02f, +1.915809828e-02f, -2.581298498e-02f, -2.845520951e-02f, +6.767571398e-03f, +2.230262774e-02f, +4.656958119e-03f, -1.016253578e-02f, -5.310408414e-03f, +2.352251997e-03f, +1.906494808e-03f, - /* 20, 4 */ +2.977586348e-03f, -1.132697564e-03f, -9.835877420e-03f, -4.227100403e-03f, +1.691895133e-02f, +1.852681335e-02f, -1.433043179e-02f, -3.419021020e-02f, -2.030888217e-03f, +3.737725626e-02f, +2.189055571e-02f, -2.375496340e-02f, -2.991937541e-02f, +4.607167163e-03f, +2.253850054e-02f, +6.084727180e-03f, -9.871207756e-03f, -5.922604667e-03f, +2.115247068e-03f, +2.079939639e-03f, - /* 20, 5 */ +2.937775120e-03f, -6.082983663e-04f, -9.500783787e-03f, -5.240985904e-03f, +1.573160178e-02f, +1.961497125e-02f, -1.196011335e-02f, -3.445344345e-02f, -5.088941581e-03f, +3.620319350e-02f, +2.448632622e-02f, -2.151271924e-02f, -3.120046374e-02f, +2.363488482e-03f, +2.261825107e-02f, +7.522962281e-03f, -9.487296369e-03f, -6.522005316e-03f, +1.838950241e-03f, +2.245949018e-03f, - /* 20, 6 */ +2.872060854e-03f, -1.133913219e-04f, -9.109325922e-03f, -6.172678101e-03f, +1.447272980e-02f, +2.053724533e-02f, -9.555222824e-03f, -3.447875653e-02f, -8.088928223e-03f, +3.478624106e-02f, +2.692626358e-02f, -1.910064083e-02f, -3.228620876e-02f, +5.144107936e-05f, +2.253674404e-02f, +8.960596019e-03f, -9.009823935e-03f, -7.102483479e-03f, +1.523472156e-03f, +2.401928729e-03f, - /* 20, 7 */ +2.782975009e-03f, +3.492945151e-04f, -8.667527067e-03f, -7.018143782e-03f, +1.315421060e-02f, +2.129107545e-02f, -7.133889173e-03f, -3.426913715e-02f, -1.100986395e-02f, +3.313697764e-02f, +2.919232167e-02f, -1.653453452e-02f, -3.316566379e-02f, -2.313225982e-03f, +2.229000326e-02f, +1.038619190e-02f, -8.438592747e-03f, -7.657784411e-03f, +1.169333173e-03f, +2.545222121e-03f, - /* 20, 8 */ +2.673137115e-03f, +7.774793244e-04f, -8.181580147e-03f, -7.774216267e-03f, +1.178803215e-02f, +2.187527386e-02f, -4.714032773e-03f, -3.382930709e-02f, -1.383151166e-02f, +3.126769968e-02f, +3.126769968e-02f, -1.383151166e-02f, -3.382930709e-02f, -4.714032773e-03f, +2.187527386e-02f, +1.178803215e-02f, -7.774216267e-03f, -8.181580147e-03f, +7.774793244e-04f, +2.673137115e-03f, - /* 20, 9 */ +2.545222121e-03f, +1.169333173e-03f, -7.657784411e-03f, -8.438592747e-03f, +1.038619190e-02f, +2.229000326e-02f, -2.313225982e-03f, -3.316566379e-02f, -1.653453452e-02f, +2.919232167e-02f, +3.313697764e-02f, -1.100986395e-02f, -3.426913715e-02f, -7.133889173e-03f, +2.129107545e-02f, +1.315421060e-02f, -7.018143782e-03f, -8.667527067e-03f, +3.492945151e-04f, +2.782975009e-03f, - /* 20,10 */ +2.401928729e-03f, +1.523472156e-03f, -7.102483479e-03f, -9.009823935e-03f, +8.960596019e-03f, +2.253674404e-02f, +5.144107936e-05f, -3.228620876e-02f, -1.910064083e-02f, +2.692626358e-02f, +3.478624106e-02f, -8.088928223e-03f, -3.447875653e-02f, -9.555222824e-03f, +2.053724533e-02f, +1.447272980e-02f, -6.172678101e-03f, -9.109325922e-03f, -1.133913219e-04f, +2.872060854e-03f, - /* 20,11 */ +2.245949018e-03f, +1.838950241e-03f, -6.522005316e-03f, -9.487296369e-03f, +7.522962281e-03f, +2.261825107e-02f, +2.363488482e-03f, -3.120046374e-02f, -2.151271924e-02f, +2.448632622e-02f, +3.620319350e-02f, -5.088941581e-03f, -3.445344345e-02f, -1.196011335e-02f, +1.961497125e-02f, +1.573160178e-02f, -5.240985904e-03f, -9.500783787e-03f, -6.082983663e-04f, +2.937775120e-03f, - /* 20,12 */ +2.079939639e-03f, +2.115247068e-03f, -5.922604667e-03f, -9.871207756e-03f, +6.084727180e-03f, +2.253850054e-02f, +4.607167163e-03f, -2.991937541e-02f, -2.375496340e-02f, +2.189055571e-02f, +3.737725626e-02f, -2.030888217e-03f, -3.419021020e-02f, -1.433043179e-02f, +1.852681335e-02f, +1.691895133e-02f, -4.227100403e-03f, -9.835877420e-03f, -1.132697564e-03f, +2.977586348e-03f, - /* 20,13 */ +1.906494808e-03f, +2.352251997e-03f, -5.310408414e-03f, -1.016253578e-02f, +4.656958119e-03f, +2.230262774e-02f, +6.767571398e-03f, -2.845520951e-02f, -2.581298498e-02f, +1.915809828e-02f, +3.829965427e-02f, +1.063660935e-03f, -3.368784795e-02f, -1.664798407e-02f, +1.727671449e-02f, +1.802312126e-02f, -3.135916081e-03f, -1.010881741e-02f, -1.683415968e-03f, +2.989084466e-03f, - /* 20,14 */ +1.728121332e-03f, +2.550244709e-03f, -4.691364292e-03f, -1.036300090e-02f, +3.250271284e-03f, +2.191685631e-02f, +8.830742245e-03f, -2.682143551e-02f, -2.767391419e-02f, +1.630904655e-02f, +3.896348732e-02f, +4.172714360e-03f, -3.294695719e-02f, -1.889465735e-02f, +1.586999913e-02f, +1.903277841e-02f, -1.973175306e-03f, -1.031411254e-02f, -2.256846905e-03f, +2.970014434e-03f, - /* 20,15 */ +1.184613130e-03f, +2.709872705e-03f, -4.071193337e-03f, -1.047502359e-02f, +1.874755806e-03f, +2.138841986e-02f, +1.078376120e-02f, -2.503260290e-02f, -2.932648708e-02f, +1.336427867e-02f, +3.936378623e-02f, +7.274030562e-03f, -3.196996361e-02f, -2.105256806e-02f, +1.431336010e-02f, +1.993701966e-02f, -7.454467031e-04f, -1.044663371e-02f, -2.848965042e-03f, +2.918309836e-03f, - /* 20, 0 */ +1.702864838e-03f, +2.314577966e-03f, -6.534433696e-03f, -8.774562126e-03f, +1.199271213e-02f, +2.083400312e-02f, -1.263546899e-02f, -3.379691899e-02f, +5.498355442e-03f, +3.949755319e-02f, +5.498355442e-03f, -3.379691899e-02f, -1.263546899e-02f, +2.083400312e-02f, +1.199271213e-02f, -8.774562126e-03f, -6.534433696e-03f, +2.314577966e-03f, +1.702864838e-03f, +0.000000000e+00f, - /* 20, 1 */ +1.499435496e-03f, +2.547675666e-03f, -5.868098774e-03f, -9.353385898e-03f, +1.044920601e-02f, +2.160032962e-02f, -9.997584470e-03f, -3.429852636e-02f, +2.083565903e-03f, +3.933622696e-02f, +8.892197588e-03f, -3.300722623e-02f, -1.522519578e-02f, +1.986341365e-02f, +1.349096787e-02f, -8.082206357e-03f, -7.177938171e-03f, +2.033576095e-03f, +1.903844954e-03f, +0.000000000e+00f, - /* 20, 2 */ +8.979094201e-04f, +2.733567376e-03f, -5.187117330e-03f, -9.818374279e-03f, +8.876306372e-03f, +2.216139438e-02f, -7.335624654e-03f, -3.451169090e-02f, -1.322648265e-03f, +3.885370480e-02f, +1.223556951e-02f, -3.193245877e-02f, -1.774265256e-02f, +1.869155385e-02f, +1.492800767e-02f, -7.277832099e-03f, -7.790241855e-03f, +1.704529263e-03f, +2.099160368e-03f, -3.513221827e-04f, - /* 20, 3 */ +7.046452899e-04f, +2.873469547e-03f, -4.499404245e-03f, -1.017038969e-02f, +7.289604703e-03f, +2.251815219e-02f, -4.673411391e-03f, -3.443867914e-02f, -4.691042688e-03f, +3.805434209e-02f, +1.549922824e-02f, -3.057828381e-02f, -2.016393226e-02f, +1.732343066e-02f, +1.628791973e-02f, -6.364195274e-03f, -8.362876507e-03f, +1.327887989e-03f, +2.285430476e-03f, -3.288882594e-04f, - /* 20, 4 */ +5.275063595e-04f, +2.969073324e-03f, -3.812529364e-03f, -1.041140495e-02f, +5.704278009e-03f, +2.267345221e-02f, -2.034281900e-03f, -3.408432658e-02f, -7.992925296e-03f, +3.694535030e-02f, +1.865448932e-02f, -2.895300188e-02f, -2.246557005e-02f, +1.576606531e-02f, +1.755501285e-02f, -5.345313722e-03f, -8.887369558e-03f, +9.047221591e-04f, +2.459146683e-03f, -2.941732022e-04f, - /* 20, 5 */ +3.670219514e-04f, +3.022497230e-03f, -3.133648777e-03f, -1.054443774e-02f, +4.134948499e-03f, +2.263196075e-02f, +5.591264205e-04f, -3.345595810e-02f, -1.120042307e-02f, +3.553672638e-02f, +2.167350137e-02f, -2.706749712e-02f, -2.462477986e-02f, +1.402847243e-02f, +1.871398575e-02f, -4.226473266e-03f, -9.355341791e-03f, +4.367425848e-04f, +2.616713456e-03f, -2.461206998e-04f, - /* 20, 6 */ +2.234691091e-04f, +3.036236900e-03f, -2.469443903e-03f, -1.057347601e-02f, +2.595553432e-03f, +2.240006745e-02f, +3.085080219e-03f, -3.256328476e-02f, -1.428673893e-02f, +3.384115481e-02f, +2.452951370e-02f, -2.493516141e-02f, -2.661968788e-02f, +1.212161795e-02f, +1.975009719e-02f, -3.014219819e-03f, -9.758608118e-03f, -7.368451392e-05f, +2.754492916e-03f, -1.837671888e-04f, - /* 20, 7 */ +9.688872179e-05f, +3.013112613e-03f, -1.826068782e-03f, -1.050339555e-02f, +1.099226216e-03f, +2.198577609e-02f, +5.522941542e-03f, -3.141827834e-02f, -1.722639627e-02f, +3.187388359e-02f, +2.719713425e-02f, -2.257179274e-02f, -2.842956063e-02f, +1.005835593e-02f, +2.064933490e-02f, -1.716337171e-03f, -1.008928035e-02f, -6.235305950e-04f, +2.868852533e-03f, -1.062635081e-04f, - /* 20, 8 */ -1.289664191e-05f, +2.956215411e-03f, -1.209105881e-03f, -1.033987080e-02f, -3.418102460e-04f, +2.139858161e-02f, +7.853344535e-03f, -3.003502508e-02f, -1.999546871e-02f, +2.965257519e-02f, +2.965257519e-02f, -1.999546871e-02f, -3.003502508e-02f, +7.853344535e-03f, +2.139858161e-02f, -3.418102460e-04f, -1.033987080e-02f, -1.209105881e-03f, +2.956215411e-03f, -1.289664191e-05f, - /* 20, 9 */ -1.062635081e-04f, +2.868852533e-03f, -6.235305950e-04f, -1.008928035e-02f, -1.716337171e-03f, +2.064933490e-02f, +1.005835593e-02f, -2.842956063e-02f, -2.257179274e-02f, +2.719713425e-02f, +3.187388359e-02f, -1.722639627e-02f, -3.141827834e-02f, +5.522941542e-03f, +2.198577609e-02f, +1.099226216e-03f, -1.050339555e-02f, -1.826068782e-03f, +3.013112613e-03f, +9.688872179e-05f, - /* 20,10 */ -1.837671888e-04f, +2.754492916e-03f, -7.368451392e-05f, -9.758608118e-03f, -3.014219819e-03f, +1.975009719e-02f, +1.212161795e-02f, -2.661968788e-02f, -2.493516141e-02f, +2.452951370e-02f, +3.384115481e-02f, -1.428673893e-02f, -3.256328476e-02f, +3.085080219e-03f, +2.240006745e-02f, +2.595553432e-03f, -1.057347601e-02f, -2.469443903e-03f, +3.036236900e-03f, +2.234691091e-04f, - /* 20,11 */ -2.461206998e-04f, +2.616713456e-03f, +4.367425848e-04f, -9.355341791e-03f, -4.226473266e-03f, +1.871398575e-02f, +1.402847243e-02f, -2.462477986e-02f, -2.706749712e-02f, +2.167350137e-02f, +3.553672638e-02f, -1.120042307e-02f, -3.345595810e-02f, +5.591264205e-04f, +2.263196075e-02f, +4.134948499e-03f, -1.054443774e-02f, -3.133648777e-03f, +3.022497230e-03f, +3.670219514e-04f, - /* 20,12 */ -2.941732022e-04f, +2.459146683e-03f, +9.047221591e-04f, -8.887369558e-03f, -5.345313722e-03f, +1.755501285e-02f, +1.576606531e-02f, -2.246557005e-02f, -2.895300188e-02f, +1.865448932e-02f, +3.694535030e-02f, -7.992925296e-03f, -3.408432658e-02f, -2.034281900e-03f, +2.267345221e-02f, +5.704278009e-03f, -1.041140495e-02f, -3.812529364e-03f, +2.969073324e-03f, +5.275063595e-04f, - /* 20,13 */ -3.288882594e-04f, +2.285430476e-03f, +1.327887989e-03f, -8.362876507e-03f, -6.364195274e-03f, +1.628791973e-02f, +1.732343066e-02f, -2.016393226e-02f, -3.057828381e-02f, +1.549922824e-02f, +3.805434209e-02f, -4.691042688e-03f, -3.443867914e-02f, -4.673411391e-03f, +2.251815219e-02f, +7.289604703e-03f, -1.017038969e-02f, -4.499404245e-03f, +2.873469547e-03f, +7.046452899e-04f, - /* 20,14 */ -3.513221827e-04f, +2.099160368e-03f, +1.704529263e-03f, -7.790241855e-03f, -7.277832099e-03f, +1.492800767e-02f, +1.869155385e-02f, -1.774265256e-02f, -3.193245877e-02f, +1.223556951e-02f, +3.885370480e-02f, -1.322648265e-03f, -3.451169090e-02f, -7.335624654e-03f, +2.216139438e-02f, +8.876306372e-03f, -9.818374279e-03f, -5.187117330e-03f, +2.733567376e-03f, +8.979094201e-04f, - /* 20,15 */ +0.000000000e+00f, +1.903844954e-03f, +2.033576095e-03f, -7.177938171e-03f, -8.082206357e-03f, +1.349096787e-02f, +1.986341365e-02f, -1.522519578e-02f, -3.300722623e-02f, +8.892197588e-03f, +3.933622696e-02f, +2.083565903e-03f, -3.429852636e-02f, -9.997584470e-03f, +2.160032962e-02f, +1.044920601e-02f, -9.353385898e-03f, -5.868098774e-03f, +2.547675666e-03f, +1.499435496e-03f, - /* 20, 0 */ -3.735125865e-04f, +2.550984103e-03f, -2.725752467e-05f, -1.024966855e-02f, +8.379667777e-04f, +2.252874535e-02f, -1.249359695e-03f, -3.448318510e-02f, +6.071698875e-04f, +3.949755319e-02f, +6.071698875e-04f, -3.448318510e-02f, -1.249359695e-03f, +2.252874535e-02f, +8.379667777e-04f, -1.024966855e-02f, -2.725752467e-05f, +2.565652055e-03f, -3.735125865e-04f, +0.000000000e+00f, - /* 20, 1 */ -3.929324583e-04f, +2.236335973e-03f, +5.288730096e-04f, -9.916240655e-03f, -7.235223044e-04f, +2.212021870e-02f, +1.557339330e-03f, -3.412515163e-02f, -3.088657053e-03f, +3.930609269e-02f, +4.328121901e-03f, -3.450613681e-02f, -4.117983282e-03f, +2.271744325e-02f, +2.467540325e-03f, -1.048404473e-02f, -6.307983207e-04f, +2.729031078e-03f, -3.387491377e-04f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, +1.931175707e-03f, +1.033703668e-03f, -9.493276252e-03f, -2.202626937e-03f, +2.150371837e-02f, +4.274418757e-03f, -3.344119198e-02f, -6.721842627e-03f, +3.873376177e-02f, +8.036125742e-03f, -3.418837690e-02f, -7.019484999e-03f, +2.267661502e-02f, +4.149462009e-03f, -1.061062992e-02f, -1.276919763e-03f, +2.866023275e-03f, -2.870815261e-04f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, +1.638662038e-03f, +1.484286050e-03f, -8.990907936e-03f, -3.586602863e-03f, +2.069305390e-02f, +6.875821908e-03f, -3.244383298e-02f, -1.025584288e-02f, +3.778668841e-02f, +1.169297592e-02f, -3.352791602e-02f, -9.923776326e-03f, +2.239890298e-02f, +5.866701604e-03f, -1.062161571e-02f, -1.959867511e-03f, +2.971909246e-03f, -2.170808154e-04f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, +1.361489293e-03f, +1.878600735e-03f, -8.419725702e-03f, -4.864357078e-03f, +1.970376789e-02f, +9.337391966e-03f, -3.114878076e-02f, -1.365548733e-02f, +3.647500669e-02f, +1.526076366e-02f, -3.252647846e-02f, -1.280005487e-02f, +2.187944695e-02f, +7.601099328e-03f, -1.051027343e-02f, -2.672992279e-03f, +3.042103091e-03f, -1.274866066e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, +1.101888322e-03f, +2.215532402e-03f, -7.790617836e-03f, -6.026519023e-03f, +1.855289977e-02f, +1.163710530e-02f, -2.957469445e-02f, -1.688736106e-02f, +3.481273909e-02f, +1.870230489e-02f, -3.118953221e-02f, -1.561714772e-02f, +2.111601531e-02f, +9.333550613e-03f, -1.027109466e-02f, -3.408794343e-03f, +3.072235528e-03f, -1.724424543e-05f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, +8.616336525e-04f, +2.494833248e-03f, -7.114614810e-03f, -7.065487327e-03f, +1.725873795e-02f, +1.375527431e-02f, -2.774292839e-02f, -1.992016339e-02f, +3.281763375e-02f, +2.198156213e-02f, -2.952627516e-02f, -1.834386597e-02f, +2.010910684e-02f, +1.104420948e-02f, -9.899921148e-03f, -4.158982805e-03f, +3.058238443e-03f, +1.144582079e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, +6.420563626e-04f, +2.717075783e-03f, -6.402738187e-03f, -7.975452307e-03f, +1.584056403e-02f, +1.567471786e-02f, -2.567724669e-02f, -2.272503888e-02f, +3.051095862e-02f, +2.506405514e-02f, -2.754957697e-02f, -2.094936609e-02f, +1.886202143e-02f, +1.271270843e-02f, -9.394061811e-03f, -4.914549404e-03f, +2.996429606e-03f, +2.681538305e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, +4.440621234e-04f, +2.883596201e-03f, -5.665856445e-03f, -8.752394750e-03f, +1.431839236e-02f, +1.738089791e-02f, -2.340351394e-02f, -2.527587699e-02f, +2.791725525e-02f, +2.791725525e-02f, -2.527587699e-02f, -2.340351394e-02f, +1.738089791e-02f, +1.431839236e-02f, -8.752394750e-03f, -5.665856445e-03f, +2.883596201e-03f, +4.440621234e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, +2.681538305e-04f, +2.996429606e-03f, -4.914549404e-03f, -9.394061811e-03f, +1.271270843e-02f, +1.886202143e-02f, -2.094936609e-02f, -2.754957697e-02f, +2.506405514e-02f, +3.051095862e-02f, -2.272503888e-02f, -2.567724669e-02f, +1.567471786e-02f, +1.584056403e-02f, -7.975452307e-03f, -6.402738187e-03f, +2.717075783e-03f, +6.420563626e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, +1.144582079e-04f, +3.058238443e-03f, -4.158982805e-03f, -9.899921148e-03f, +1.104420948e-02f, +2.010910684e-02f, -1.834386597e-02f, -2.952627516e-02f, +2.198156213e-02f, +3.281763375e-02f, -1.992016339e-02f, -2.774292839e-02f, +1.375527431e-02f, +1.725873795e-02f, -7.065487327e-03f, -7.114614810e-03f, +2.494833248e-03f, +8.616336525e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, -1.724424543e-05f, +3.072235528e-03f, -3.408794343e-03f, -1.027109466e-02f, +9.333550613e-03f, +2.111601531e-02f, -1.561714772e-02f, -3.118953221e-02f, +1.870230489e-02f, +3.481273909e-02f, -1.688736106e-02f, -2.957469445e-02f, +1.163710530e-02f, +1.855289977e-02f, -6.026519023e-03f, -7.790617836e-03f, +2.215532402e-03f, +1.101888322e-03f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, -1.274866066e-04f, +3.042103091e-03f, -2.672992279e-03f, -1.051027343e-02f, +7.601099328e-03f, +2.187944695e-02f, -1.280005487e-02f, -3.252647846e-02f, +1.526076366e-02f, +3.647500669e-02f, -1.365548733e-02f, -3.114878076e-02f, +9.337391966e-03f, +1.970376789e-02f, -4.864357078e-03f, -8.419725702e-03f, +1.878600735e-03f, +1.361489293e-03f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, -2.170808154e-04f, +2.971909246e-03f, -1.959867511e-03f, -1.062161571e-02f, +5.866701604e-03f, +2.239890298e-02f, -9.923776326e-03f, -3.352791602e-02f, +1.169297592e-02f, +3.778668841e-02f, -1.025584288e-02f, -3.244383298e-02f, +6.875821908e-03f, +2.069305390e-02f, -3.586602863e-03f, -8.990907936e-03f, +1.484286050e-03f, +1.638662038e-03f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, -2.870815261e-04f, +2.866023275e-03f, -1.276919763e-03f, -1.061062992e-02f, +4.149462009e-03f, +2.267661502e-02f, -7.019484999e-03f, -3.418837690e-02f, +8.036125742e-03f, +3.873376177e-02f, -6.721842627e-03f, -3.344119198e-02f, +4.274418757e-03f, +2.150371837e-02f, -2.202626937e-03f, -9.493276252e-03f, +1.033703668e-03f, +1.931175707e-03f, +0.000000000e+00f, - /* 20,15 */ +0.000000000e+00f, -3.387491377e-04f, +2.729031078e-03f, -6.307983207e-04f, -1.048404473e-02f, +2.467540325e-03f, +2.271744325e-02f, -4.117983282e-03f, -3.450613681e-02f, +4.328121901e-03f, +3.930609269e-02f, -3.088657053e-03f, -3.412515163e-02f, +1.557339330e-03f, +2.212021870e-02f, -7.235223044e-04f, -9.916240655e-03f, +5.288730096e-04f, +2.236335973e-03f, -3.929324583e-04f, - /* 16, 0 */ +3.044394378e-03f, -5.755865016e-03f, -7.644875237e-03f, +1.825808857e-02f, +9.222448502e-03f, -3.286388427e-02f, -4.241838036e-03f, +3.949755319e-02f, -4.241838036e-03f, -3.286388427e-02f, +9.222448502e-03f, +1.825808857e-02f, -7.644875237e-03f, -5.755865016e-03f, +3.044394378e-03f, -1.466795211e-05f, - /* 16, 1 */ +3.096598285e-03f, -4.938670705e-03f, -8.543525001e-03f, +1.681174815e-02f, +1.171692718e-02f, -3.156650717e-02f, -8.140229219e-03f, +3.927338559e-02f, -2.566011090e-04f, -3.380519836e-02f, +6.539747546e-03f, +1.954192550e-02f, -6.591652894e-03f, -6.554797296e-03f, +2.932700428e-03f, +1.424716020e-04f, - /* 16, 2 */ +3.093580763e-03f, -4.116215273e-03f, -9.283856280e-03f, +1.522768985e-02f, +1.399813452e-02f, -2.993548791e-02f, -1.190603152e-02f, +3.860369285e-02f, +3.768233493e-03f, -3.437220120e-02f, +3.697060454e-03f, +2.063975168e-02f, -5.390052618e-03f, -7.321916780e-03f, +2.757987679e-03f, +3.278051009e-04f, - /* 16, 3 */ +3.040228116e-03f, -3.300778044e-03f, -9.864516741e-03f, +1.353158972e-02f, +1.604446323e-02f, -2.799705310e-02f, -1.549559239e-02f, +3.749686691e-02f, +7.784523662e-03f, -3.455113173e-02f, +7.255039591e-04f, +2.152972014e-02f, -4.048737024e-03f, -8.043312786e-03f, +2.517583336e-03f, +5.415628140e-04f, - /* 16, 4 */ +2.941918573e-03f, -2.503765206e-03f, -1.028645874e-02f, +1.174962597e-02f, +1.783794825e-02f, -2.578082191e-02f, -1.886790220e-02f, +3.596676747e-02f, +1.174386090e-02f, -3.433297304e-02f, -2.341279491e-03f, +2.219201396e-02f, -2.578818314e-03f, -8.704920467e-03f, +2.209778110e-03f, +1.246855370e-03f, - /* 16, 5 */ +2.804395319e-03f, -1.735580001e-03f, -1.055281940e-02f, +9.908096520e-03f, +1.936441115e-02f, -2.331935318e-02f, -2.198510572e-02f, +3.403253365e-02f, +1.559820593e-02f, -3.371364718e-02f, -5.467520855e-03f, +2.260919785e-02f, -9.938011251e-04f, -9.292739628e-03f, +1.833922789e-03f, +1.492594630e-03f, - /* 16, 6 */ +2.633640678e-03f, -1.005515791e-03f, -1.066877263e-02f, +8.033047542e-03f, +2.061354789e-02f, -2.064765983e-02f, -2.481296600e-02f, +3.171832409e-02f, +1.930052332e-02f, -3.269414425e-02f, -8.615762914e-03f, +2.276654580e-02f, +6.905139302e-04f, -9.793063512e-03f, +1.390511455e-03f, +1.739628231e-03f, - /* 16, 7 */ +2.435753603e-03f, -3.216727033e-04f, -1.064135670e-02f, +6.149918447e-03f, +2.157895980e-02f, -1.780269814e-02f, -2.732127429e-02f, +2.905298940e-02f, +2.280540611e-02f, -3.128058296e-02f, -1.174733238e-02f, +2.265233903e-02f, +2.456165958e-03f, -1.019271416e-02f, +8.812491435e-04f, +1.982865330e-03f, - /* 16, 8 */ +2.216832517e-03f, +3.091018830e-04f, -1.047928070e-02f, +4.283208005e-03f, +2.225812888e-02f, -1.482283947e-02f, -2.948420097e-02f, +2.606968157e-02f, +2.606968157e-02f, -2.948420097e-02f, -1.482283947e-02f, +2.225812888e-02f, +4.283208005e-03f, -1.047928070e-02f, +3.091018830e-04f, +2.216832517e-03f, - /* 16, 9 */ +1.982865330e-03f, +8.812491435e-04f, -1.019271416e-02f, +2.456165958e-03f, +2.265233903e-02f, -1.174733238e-02f, -3.128058296e-02f, +2.280540611e-02f, +2.905298940e-02f, -2.732127429e-02f, -1.780269814e-02f, +2.157895980e-02f, +6.149918447e-03f, -1.064135670e-02f, -3.216727033e-04f, +2.435753603e-03f, - /* 16,10 */ +1.739628231e-03f, +1.390511455e-03f, -9.793063512e-03f, +6.905139302e-04f, +2.276654580e-02f, -8.615762914e-03f, -3.269414425e-02f, +1.930052332e-02f, +3.171832409e-02f, -2.481296600e-02f, -2.064765983e-02f, +2.061354789e-02f, +8.033047542e-03f, -1.066877263e-02f, -1.005515791e-03f, +2.633640678e-03f, - /* 16,11 */ +1.492594630e-03f, +1.833922789e-03f, -9.292739628e-03f, -9.938011251e-04f, +2.260919785e-02f, -5.467520855e-03f, -3.371364718e-02f, +1.559820593e-02f, +3.403253365e-02f, -2.198510572e-02f, -2.331935318e-02f, +1.936441115e-02f, +9.908096520e-03f, -1.055281940e-02f, -1.735580001e-03f, +2.804395319e-03f, - /* 16,12 */ +1.246855370e-03f, +2.209778110e-03f, -8.704920467e-03f, -2.578818314e-03f, +2.219201396e-02f, -2.341279491e-03f, -3.433297304e-02f, +1.174386090e-02f, +3.596676747e-02f, -1.886790220e-02f, -2.578082191e-02f, +1.783794825e-02f, +1.174962597e-02f, -1.028645874e-02f, -2.503765206e-03f, +2.941918573e-03f, - /* 16,13 */ +5.415628140e-04f, +2.517583336e-03f, -8.043312786e-03f, -4.048737024e-03f, +2.152972014e-02f, +7.255039591e-04f, -3.455113173e-02f, +7.784523662e-03f, +3.749686691e-02f, -1.549559239e-02f, -2.799705310e-02f, +1.604446323e-02f, +1.353158972e-02f, -9.864516741e-03f, -3.300778044e-03f, +3.040228116e-03f, - /* 16,14 */ +3.278051009e-04f, +2.757987679e-03f, -7.321916780e-03f, -5.390052618e-03f, +2.063975168e-02f, +3.697060454e-03f, -3.437220120e-02f, +3.768233493e-03f, +3.860369285e-02f, -1.190603152e-02f, -2.993548791e-02f, +1.399813452e-02f, +1.522768985e-02f, -9.283856280e-03f, -4.116215273e-03f, +3.093580763e-03f, - /* 16,15 */ +1.424716020e-04f, +2.932700428e-03f, -6.554797296e-03f, -6.591652894e-03f, +1.954192550e-02f, +6.539747546e-03f, -3.380519836e-02f, -2.566011090e-04f, +3.927338559e-02f, -8.140229219e-03f, -3.156650717e-02f, +1.171692718e-02f, +1.681174815e-02f, -8.543525001e-03f, -4.938670705e-03f, +3.096598285e-03f, - /* 16, 0 */ +2.106112688e-03f, -1.136549770e-04f, -1.070669430e-02f, +1.017472059e-02f, +1.725397418e-02f, -2.914959442e-02f, -8.963852042e-03f, +3.949755319e-02f, -8.963852042e-03f, -2.914959442e-02f, +1.725397418e-02f, +1.017472059e-02f, -1.070669430e-02f, -1.136549770e-04f, +2.106112688e-03f, +0.000000000e+00f, - /* 16, 1 */ +1.845338280e-03f, +5.473343456e-04f, -1.065891816e-02f, +8.155641030e-03f, +1.899089579e-02f, -2.691951328e-02f, -1.297236480e-02f, +3.923810803e-02f, -4.790894575e-03f, -3.103786392e-02f, +1.521305380e-02f, +1.215062389e-02f, -1.058864907e-02f, -8.385121370e-04f, +2.352913572e-03f, +0.000000000e+00f, - /* 16, 2 */ +1.577651889e-03f, +1.138027416e-03f, -1.045641117e-02f, +6.125232216e-03f, +2.040939526e-02f, -2.438627738e-02f, -1.676283724e-02f, +3.846353557e-02f, -5.100475811e-04f, -3.254996068e-02f, +1.288771825e-02f, +1.405076114e-02f, -1.029592106e-02f, -1.619065127e-03f, +2.578329862e-03f, +0.000000000e+00f, - /* 16, 3 */ +1.309641631e-03f, +1.653747621e-03f, -1.011218665e-02f, +4.114112388e-03f, +2.150028131e-02f, -2.159216402e-02f, -2.028541539e-02f, +3.718506562e-02f, +3.820010384e-03f, -3.365643786e-02f, +1.030255138e-02f, +1.584231759e-02f, -9.822158049e-03f, -2.445442331e-03f, +2.774741598e-03f, +0.000000000e+00f, - /* 16, 4 */ +5.462770218e-04f, +2.091544281e-03f, -9.640854940e-03f, +2.151223968e-03f, +2.225957955e-02f, -1.858235038e-02f, -2.349470263e-02f, +3.542121816e-02f, +8.139354376e-03f, -3.433331277e-02f, +7.486889709e-03f, +1.749279467e-02f, -9.163764446e-03f, -3.306153325e-03f, +2.934475195e-03f, -4.634120047e-04f, - /* 16, 5 */ +3.039101756e-04f, +2.450135010e-03f, -9.058284956e-03f, +2.634319572e-04f, +2.268843286e-02f, -1.540416082e-02f, -2.635039795e-02f, +3.319751225e-02f, +1.238771678e-02f, -3.456253827e-02f, +4.474489227e-03f, +1.897056596e-02f, -8.320109905e-03f, -4.188206830e-03f, +3.049970761e-03f, -4.400286560e-04f, - /* 16, 6 */ +9.722433303e-05f, +2.729819110e-03f, -8.381259809e-03f, -1.524826854e-03f, +2.279292110e-02f, -1.210629477e-02f, -2.881784707e-02f, +3.054606534e-02f, +1.650540309e-02f, -3.433238619e-02f, +1.303110212e-03f, +2.024543829e-02f, -7.293693549e-03f, -5.077265419e-03f, +3.113958519e-03f, -3.921992729e-04f, - /* 16, 7 */ -7.427658644e-05f, +2.932365266e-03f, -7.627133157e-03f, -3.191839567e-03f, +2.258380561e-02f, -8.738048497e-03f, -3.086849848e-02f, +2.750508980e-02f, +2.043420490e-02f, -3.363773532e-02f, -1.985974837e-03f, +2.128920837e-02f, -6.090258802e-03f, -5.957835775e-03f, +3.119640969e-03f, -3.169896142e-04f, - /* 16, 8 */ -2.117631665e-04f, +3.060877176e-03f, -6.813492559e-03f, -4.718854594e-03f, +2.207620481e-02f, -5.348543574e-03f, -3.248025769e-02f, +2.411829496e-02f, +2.411829496e-02f, -3.248025769e-02f, -5.348543574e-03f, +2.207620481e-02f, -4.718854594e-03f, -6.813492559e-03f, +3.060877176e-03f, -2.117631665e-04f, - /* 16, 9 */ -3.169896142e-04f, +3.119640969e-03f, -5.957835775e-03f, -6.090258802e-03f, +2.128920837e-02f, -1.985974837e-03f, -3.363773532e-02f, +2.043420490e-02f, +2.750508980e-02f, -3.086849848e-02f, -8.738048497e-03f, +2.258380561e-02f, -3.191839567e-03f, -7.627133157e-03f, +2.932365266e-03f, -7.427658644e-05f, - /* 16,10 */ -3.921992729e-04f, +3.113958519e-03f, -5.077265419e-03f, -7.293693549e-03f, +2.024543829e-02f, +1.303110212e-03f, -3.433238619e-02f, +1.650540309e-02f, +3.054606534e-02f, -2.881784707e-02f, -1.210629477e-02f, +2.279292110e-02f, -1.524826854e-03f, -8.381259809e-03f, +2.729819110e-03f, +9.722433303e-05f, - /* 16,11 */ -4.400286560e-04f, +3.049970761e-03f, -4.188206830e-03f, -8.320109905e-03f, +1.897056596e-02f, +4.474489227e-03f, -3.456253827e-02f, +1.238771678e-02f, +3.319751225e-02f, -2.635039795e-02f, -1.540416082e-02f, +2.268843286e-02f, +2.634319572e-04f, -9.058284956e-03f, +2.450135010e-03f, +3.039101756e-04f, - /* 16,12 */ -4.634120047e-04f, +2.934475195e-03f, -3.306153325e-03f, -9.163764446e-03f, +1.749279467e-02f, +7.486889709e-03f, -3.433331277e-02f, +8.139354376e-03f, +3.542121816e-02f, -2.349470263e-02f, -1.858235038e-02f, +2.225957955e-02f, +2.151223968e-03f, -9.640854940e-03f, +2.091544281e-03f, +5.462770218e-04f, - /* 16,13 */ +0.000000000e+00f, +2.774741598e-03f, -2.445442331e-03f, -9.822158049e-03f, +1.584231759e-02f, +1.030255138e-02f, -3.365643786e-02f, +3.820010384e-03f, +3.718506562e-02f, -2.028541539e-02f, -2.159216402e-02f, +2.150028131e-02f, +4.114112388e-03f, -1.011218665e-02f, +1.653747621e-03f, +1.309641631e-03f, - /* 16,14 */ +0.000000000e+00f, +2.578329862e-03f, -1.619065127e-03f, -1.029592106e-02f, +1.405076114e-02f, +1.288771825e-02f, -3.254996068e-02f, -5.100475811e-04f, +3.846353557e-02f, -1.676283724e-02f, -2.438627738e-02f, +2.040939526e-02f, +6.125232216e-03f, -1.045641117e-02f, +1.138027416e-03f, +1.577651889e-03f, - /* 16,15 */ +0.000000000e+00f, +2.352913572e-03f, -8.385121370e-04f, -1.058864907e-02f, +1.215062389e-02f, +1.521305380e-02f, -3.103786392e-02f, -4.790894575e-03f, +3.923810803e-02f, -1.297236480e-02f, -2.691951328e-02f, +1.899089579e-02f, +8.155641030e-03f, -1.065891816e-02f, +5.473343456e-04f, +1.845338280e-03f, - /* 16, 0 */ -2.517634455e-04f, +5.956310854e-03f, -8.647029609e-03f, +1.153545125e-03f, +2.185732832e-02f, -2.369518339e-02f, -1.347728153e-02f, +3.949755319e-02f, -1.347728153e-02f, -2.369518339e-02f, +2.185732832e-02f, +1.153545125e-03f, -8.647029609e-03f, +2.914798040e-03f, -2.517634455e-04f, +0.000000000e+00f, - /* 16, 1 */ -3.647589216e-04f, +5.559366521e-03f, -7.860683839e-03f, -8.150822761e-04f, +2.252089097e-02f, -2.063007883e-02f, -1.749200540e-02f, +3.920026256e-02f, -9.205150933e-03f, -2.647415600e-02f, +2.081322447e-02f, +3.223212212e-03f, -9.337661142e-03f, +2.677108373e-03f, -9.939782505e-05f, +0.000000000e+00f, - /* 16, 2 */ -4.414886472e-04f, +5.113535158e-03f, -7.000222932e-03f, -2.654422569e-03f, +2.280787202e-02f, -1.733513495e-02f, -2.118899605e-02f, +3.831333038e-02f, -4.740975303e-03f, -2.891426752e-02f, +1.939126736e-02f, +5.362271050e-03f, -9.911447152e-03f, +2.349799583e-03f, +9.477253367e-05f, +0.000000000e+00f, - /* 16, 3 */ -4.855802427e-04f, +4.633347213e-03f, -6.087250386e-03f, -4.340001532e-03f, +2.272858071e-02f, -1.386914009e-02f, -2.451395150e-02f, +3.685148678e-02f, -1.540603716e-04f, -3.096737610e-02f, +1.760097190e-02f, +7.536131493e-03f, -1.034820384e-02f, +1.931270179e-03f, +3.323676319e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, +4.132457962e-03f, -5.142935987e-03f, -5.851401101e-03f, +2.229926864e-02f, -1.029228788e-02f, -2.741946400e-02f, +3.483898696e-02f, +4.483517704e-03f, -3.259088680e-02f, +1.545873378e-02f, +9.707799030e-03f, -1.062918096e-02f, +1.421916825e-03f, +6.140535745e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, +3.623457200e-03f, -4.187611099e-03f, -7.172450485e-03f, +2.154162444e-02f, -6.665085054e-03f, -2.986575546e-02f, +3.230917458e-02f, +9.098146940e-03f, -3.374862716e-02f, +1.298775300e-02f, +1.183848413e-02f, -1.073754388e-02f, +8.242784646e-04f, +9.394126333e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, +3.117716971e-03f, -3.240404345e-03f, -8.291325326e-03f, +2.048218318e-02f, -3.047278250e-03f, -3.182126614e-02f, +2.930388237e-02f, +1.361595241e-02f, -3.441162052e-02f, +1.021782484e-02f, +1.388827332e-02f, -1.065884073e-02f, +1.431392807e-04f, +1.306826648e-03f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, +2.625277441e-03f, -2.318923448e-03f, -9.200556695e-03f, +1.915166452e-02f, +5.031802154e-04f, -3.326308735e-02f, +2.587268140e-02f, +1.796408380e-02f, -3.455874049e-02f, +7.184998851e-03f, +1.581685040e-02f, -1.038144369e-02f, -6.144144569e-04f, +1.713377737e-03f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, +2.154770219e-03f, -1.438987736e-03f, -9.896953513e-03f, +1.758425506e-02f, +3.931108902e-03f, -3.417723209e-02f, +2.207199352e-02f, +2.207199352e-02f, -3.417723209e-02f, +3.931108902e-03f, +1.758425506e-02f, -9.896953513e-03f, -1.438987736e-03f, +2.154770219e-03f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, +1.713377737e-03f, -6.144144569e-04f, -1.038144369e-02f, +1.581685040e-02f, +7.184998851e-03f, -3.455874049e-02f, +1.796408380e-02f, +2.587268140e-02f, -3.326308735e-02f, +5.031802154e-04f, +1.915166452e-02f, -9.200556695e-03f, -2.318923448e-03f, +2.625277441e-03f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, +1.306826648e-03f, +1.431392807e-04f, -1.065884073e-02f, +1.388827332e-02f, +1.021782484e-02f, -3.441162052e-02f, +1.361595241e-02f, +2.930388237e-02f, -3.182126614e-02f, -3.047278250e-03f, +2.048218318e-02f, -8.291325326e-03f, -3.240404345e-03f, +3.117716971e-03f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, +9.394126333e-04f, +8.242784646e-04f, -1.073754388e-02f, +1.183848413e-02f, +1.298775300e-02f, -3.374862716e-02f, +9.098146940e-03f, +3.230917458e-02f, -2.986575546e-02f, -6.665085054e-03f, +2.154162444e-02f, -7.172450485e-03f, -4.187611099e-03f, +3.623457200e-03f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, +6.140535745e-04f, +1.421916825e-03f, -1.062918096e-02f, +9.707799030e-03f, +1.545873378e-02f, -3.259088680e-02f, +4.483517704e-03f, +3.483898696e-02f, -2.741946400e-02f, -1.029228788e-02f, +2.229926864e-02f, -5.851401101e-03f, -5.142935987e-03f, +4.132457962e-03f, +0.000000000e+00f, - /* 16,13 */ +0.000000000e+00f, +3.323676319e-04f, +1.931270179e-03f, -1.034820384e-02f, +7.536131493e-03f, +1.760097190e-02f, -3.096737610e-02f, -1.540603716e-04f, +3.685148678e-02f, -2.451395150e-02f, -1.386914009e-02f, +2.272858071e-02f, -4.340001532e-03f, -6.087250386e-03f, +4.633347213e-03f, -4.855802427e-04f, - /* 16,14 */ +0.000000000e+00f, +9.477253367e-05f, +2.349799583e-03f, -9.911447152e-03f, +5.362271050e-03f, +1.939126736e-02f, -2.891426752e-02f, -4.740975303e-03f, +3.831333038e-02f, -2.118899605e-02f, -1.733513495e-02f, +2.280787202e-02f, -2.654422569e-03f, -7.000222932e-03f, +5.113535158e-03f, -4.414886472e-04f, - /* 16,15 */ +0.000000000e+00f, -9.939782505e-05f, +2.677108373e-03f, -9.337661142e-03f, +3.223212212e-03f, +2.081322447e-02f, -2.647415600e-02f, -9.205150933e-03f, +3.920026256e-02f, -1.749200540e-02f, -2.063007883e-02f, +2.252089097e-02f, -8.150822761e-04f, -7.860683839e-03f, +5.559366521e-03f, -3.647589216e-04f, - /* 12, 0 */ -3.924537125e-03f, -6.177283790e-03f, +2.270137823e-02f, -1.696686670e-02f, -1.770529738e-02f, +3.949755319e-02f, -1.770529738e-02f, -1.696686670e-02f, +2.270137823e-02f, -6.177283790e-03f, -3.924537125e-03f, +2.689823824e-03f, - /* 12, 1 */ -2.918444824e-03f, -7.533875928e-03f, +2.217225575e-02f, -1.325050127e-02f, -2.161377319e-02f, +3.915985190e-02f, -1.343239533e-02f, -2.049610855e-02f, +2.283609035e-02f, -4.600700986e-03f, -4.945631587e-03f, +2.897838580e-03f, - /* 12, 2 */ -1.948111766e-03f, -8.657444743e-03f, +2.127619260e-02f, -9.420045488e-03f, -2.509275167e-02f, +3.815312062e-02f, -8.867972963e-03f, -2.376686078e-02f, +2.255583139e-02f, -2.822790564e-03f, -5.958903400e-03f, +3.051876120e-03f, - /* 12, 3 */ -1.031879811e-03f, -9.540571177e-03f, +2.004673480e-02f, -5.548699503e-03f, -2.808617760e-02f, +3.649634673e-02f, -4.091413649e-03f, -2.671092541e-02f, +2.184766025e-02f, -8.677312765e-04f, -6.939883353e-03f, +3.140832095e-03f, - /* 12, 4 */ -1.854082964e-04f, -1.018130776e-02f, +1.852257236e-02f, -1.708362919e-03f, -3.054799363e-02f, +3.422074403e-02f, +8.129280323e-04f, -2.926474106e-02f, +2.070682375e-02f, +1.235031889e-03f, -7.862950435e-03f, +3.154329873e-03f, - /* 12, 5 */ +5.785109863e-04f, -1.058292035e-02f, +1.674653148e-02f, +2.031769072e-03f, -3.244290444e-02f, +3.136911490e-02f, +5.757350815e-03f, -3.137078637e-02f, +1.913716500e-02f, +3.451172065e-03f, -8.701884951e-03f, +3.083080347e-03f, - /* 12, 6 */ +1.250056620e-03f, -1.075352499e-02f, +1.476451598e-02f, +5.606517218e-03f, -3.374690984e-02f, +2.799497691e-02f, +1.065251585e-02f, -3.297888633e-02f, +1.715135739e-02f, +5.741996578e-03f, -9.430471381e-03f, +2.919238566e-03f, - /* 12, 7 */ +1.822400383e-03f, -1.070563332e-02f, +1.262442359e-02f, +8.955911342e-03f, -3.444759838e-02f, +2.416147295e-02f, +1.540920462e-02f, -3.404739100e-02f, +1.477095353e-02f, +8.065088216e-03f, -1.002313834e-02f, +2.656746896e-03f, - /* 12, 8 */ +2.291654178e-03f, -1.045562141e-02f, +1.037506188e-02f, +1.202624229e-02f, -3.454419870e-02f, +1.994008861e-02f, +1.994008861e-02f, -3.454419870e-02f, +1.202624229e-02f, +1.037506188e-02f, -1.045562141e-02f, +2.291654178e-03f, - /* 12, 9 */ +2.656746896e-03f, -1.002313834e-02f, +8.065088216e-03f, +1.477095353e-02f, -3.404739100e-02f, +1.540920462e-02f, +2.416147295e-02f, -3.444759838e-02f, +8.955911342e-03f, +1.262442359e-02f, -1.070563332e-02f, +1.822400383e-03f, - /* 12,10 */ +2.919238566e-03f, -9.430471381e-03f, +5.741996578e-03f, +1.715135739e-02f, -3.297888633e-02f, +1.065251585e-02f, +2.799497691e-02f, -3.374690984e-02f, +5.606517218e-03f, +1.476451598e-02f, -1.075352499e-02f, +1.250056620e-03f, - /* 12,11 */ +3.083080347e-03f, -8.701884951e-03f, +3.451172065e-03f, +1.913716500e-02f, -3.137078637e-02f, +5.757350815e-03f, +3.136911490e-02f, -3.244290444e-02f, +2.031769072e-03f, +1.674653148e-02f, -1.058292035e-02f, +5.785109863e-04f, - /* 12,12 */ +3.154329873e-03f, -7.862950435e-03f, +1.235031889e-03f, +2.070682375e-02f, -2.926474106e-02f, +8.129280323e-04f, +3.422074403e-02f, -3.054799363e-02f, -1.708362919e-03f, +1.852257236e-02f, -1.018130776e-02f, -1.854082964e-04f, - /* 12,13 */ +3.140832095e-03f, -6.939883353e-03f, -8.677312765e-04f, +2.184766025e-02f, -2.671092541e-02f, -4.091413649e-03f, +3.649634673e-02f, -2.808617760e-02f, -5.548699503e-03f, +2.004673480e-02f, -9.540571177e-03f, -1.031879811e-03f, - /* 12,14 */ +3.051876120e-03f, -5.958903400e-03f, -2.822790564e-03f, +2.255583139e-02f, -2.376686078e-02f, -8.867972963e-03f, +3.815312062e-02f, -2.509275167e-02f, -9.420045488e-03f, +2.127619260e-02f, -8.657444743e-03f, -1.948111766e-03f, - /* 12,15 */ +2.897838580e-03f, -4.945631587e-03f, -4.600700986e-03f, +2.283609035e-02f, -2.049610855e-02f, -1.343239533e-02f, +3.915985190e-02f, -2.161377319e-02f, -1.325050127e-02f, +2.217225575e-02f, -7.533875928e-03f, -2.918444824e-03f, - /* 12, 0 */ +5.529156756e-04f, -1.017944650e-02f, +2.010395691e-02f, -9.501724583e-03f, -2.157725737e-02f, +3.949755319e-02f, -2.157725737e-02f, -9.501724583e-03f, +2.010395691e-02f, -1.017944650e-02f, +5.529156756e-04f, +9.520529918e-04f, - /* 12, 1 */ +1.269440891e-03f, -1.060857725e-02f, +1.848426560e-02f, -5.389674050e-03f, -2.526172923e-02f, +3.911687897e-02f, -1.740939271e-02f, -1.356576871e-02f, +2.138958875e-02f, -9.480008902e-03f, -2.676127190e-04f, +1.273328470e-03f, - /* 12, 2 */ +1.873685854e-03f, -1.077705214e-02f, +1.658179711e-02f, -1.315683663e-03f, -2.839592801e-02f, +3.798295250e-02f, -1.283645305e-02f, -1.749413418e-02f, +2.229518867e-02f, -8.506812328e-03f, -1.180051037e-03f, +1.604489886e-03f, - /* 12, 3 */ +2.361120897e-03f, -1.070010905e-02f, +1.445171501e-02f, +2.637679549e-03f, -3.092573063e-02f, +3.611987567e-02f, -7.946589383e-03f, -2.119952675e-02f, +2.278144860e-02f, -7.263083188e-03f, -2.168530550e-03f, +1.934678236e-03f, - /* 12, 4 */ +2.730794315e-03f, -1.039785120e-02f, +1.215160004e-02f, +6.393108320e-03f, -3.281077803e-02f, +3.356720057e-02f, -2.835931904e-03f, -2.459705675e-02f, +2.281696739e-02f, -5.759053577e-03f, -3.213563229e-03f, +2.251787566e-03f, - /* 12, 5 */ +2.985073479e-03f, -9.894440683e-03f, +9.739988515e-03f, +9.880142532e-03f, -3.402514934e-02f, +3.037901891e-02f, +2.393471366e-03f, -2.760625942e-02f, +2.237934513e-02f, -4.012119167e-03f, -4.292316215e-03f, +2.542756696e-03f, - /* 12, 6 */ +3.129309714e-03f, -9.217233004e-03f, +7.274949975e-03f, +1.303654969e-02f, -3.455769209e-02f, +2.662271867e-02f, +7.635875993e-03f, -3.015305887e-02f, +2.145609570e-02f, -2.046814992e-03f, -5.379003980e-03f, +2.793918230e-03f, - /* 12, 7 */ +3.171441616e-03f, -8.395878746e-03f, +4.812738303e-03f, +1.580947051e-02f, -3.441200543e-02f, +2.237743869e-02f, +1.278417054e-02f, -3.217162603e-02f, +2.004534769e-02f, +1.053992035e-04f, -6.445394017e-03f, +2.991397563e-03f, - /* 12, 8 */ +3.121552430e-03f, -7.461418245e-03f, +2.406547485e-03f, +1.815630830e-02f, -3.360608252e-02f, +1.773225889e-02f, +1.773225889e-02f, -3.360608252e-02f, +1.815630830e-02f, +2.406547485e-03f, -7.461418245e-03f, +3.121552430e-03f, - /* 12, 9 */ +2.991397563e-03f, -6.445394017e-03f, +1.053992035e-04f, +2.004534769e-02f, -3.217162603e-02f, +1.278417054e-02f, +2.237743869e-02f, -3.441200543e-02f, +1.580947051e-02f, +4.812738303e-03f, -8.395878746e-03f, +3.171441616e-03f, - /* 12,10 */ +2.793918230e-03f, -5.379003980e-03f, -2.046814992e-03f, +2.145609570e-02f, -3.015305887e-02f, +7.635875993e-03f, +2.662271867e-02f, -3.455769209e-02f, +1.303654969e-02f, +7.274949975e-03f, -9.217233004e-03f, +3.129309714e-03f, - /* 12,11 */ +2.542756696e-03f, -4.292316215e-03f, -4.012119167e-03f, +2.237934513e-02f, -2.760625942e-02f, +2.393471366e-03f, +3.037901891e-02f, -3.402514934e-02f, +9.880142532e-03f, +9.739988515e-03f, -9.894440683e-03f, +2.985073479e-03f, - /* 12,12 */ +2.251787566e-03f, -3.213563229e-03f, -5.759053577e-03f, +2.281696739e-02f, -2.459705675e-02f, -2.835931904e-03f, +3.356720057e-02f, -3.281077803e-02f, +6.393108320e-03f, +1.215160004e-02f, -1.039785120e-02f, +2.730794315e-03f, - /* 12,13 */ +1.934678236e-03f, -2.168530550e-03f, -7.263083188e-03f, +2.278144860e-02f, -2.119952675e-02f, -7.946589383e-03f, +3.611987567e-02f, -3.092573063e-02f, +2.637679549e-03f, +1.445171501e-02f, -1.070010905e-02f, +2.361120897e-03f, - /* 12,14 */ +1.604489886e-03f, -1.180051037e-03f, -8.506812328e-03f, +2.229518867e-02f, -1.749413418e-02f, -1.283645305e-02f, +3.798295250e-02f, -2.839592801e-02f, -1.315683663e-03f, +1.658179711e-02f, -1.077705214e-02f, +1.873685854e-03f, - /* 12,15 */ +1.273328470e-03f, -2.676127190e-04f, -9.480008902e-03f, +2.138958875e-02f, -1.356576871e-02f, -1.740939271e-02f, +3.911687897e-02f, -2.526172923e-02f, -5.389674050e-03f, +1.848426560e-02f, -1.060857725e-02f, +1.269440891e-03f, - - /* 24, 0 */ -8.820438069e-05f, -1.519461079e-04f, -2.301651496e-04f, -3.149320871e-04f, -3.945939739e-04f, -4.554410135e-04f, -4.841532882e-04f, -4.705408991e-04f, -4.099602091e-04f, -3.048100066e-04f, -1.646897470e-04f, -5.099007530e-06f, +1.551006323e-04f, +2.969416536e-04f, +4.046294158e-04f, +4.681429482e-04f, +4.846228261e-04f, +4.583040637e-04f, +3.990939388e-04f, +3.201968846e-04f, +2.353759082e-04f, +1.564712483e-04f, +9.167483068e-05f, +4.482688286e-05f, - /* 24, 1 */ -8.480575132e-05f, -1.474789784e-04f, -2.249812225e-04f, -3.096480504e-04f, -3.900204007e-04f, -4.524514078e-04f, -4.835165803e-04f, -4.727530367e-04f, -4.151145025e-04f, -3.125397891e-04f, -1.742016828e-04f, -1.529460870e-05f, +1.454387449e-04f, +2.889379628e-04f, +3.991236794e-04f, +4.655589110e-04f, +4.849233000e-04f, +4.610375470e-04f, +4.035168325e-04f, +3.254391996e-04f, +2.406110065e-04f, +1.610529558e-04f, +9.521673594e-05f, +4.721513201e-05f, - /* 24, 2 */ -8.147924507e-05f, -1.430712350e-04f, -2.198265592e-04f, -3.043479843e-04f, -3.853766873e-04f, -4.493383067e-04f, -4.827146831e-04f, -4.747797448e-04f, -4.200908527e-04f, -3.201278616e-04f, -1.836320864e-04f, -2.548296987e-05f, +1.357085413e-04f, +2.808022583e-04f, +3.934446700e-04f, +4.627886263e-04f, +4.850529052e-04f, +4.636385032e-04f, +4.078592000e-04f, +3.306557574e-04f, +2.458678944e-04f, +1.656897170e-04f, +9.882966748e-05f, +4.967415993e-05f, - /* 24, 3 */ -7.822510242e-05f, -1.387241832e-04f, -2.147035314e-04f, -2.990350629e-04f, -3.806663042e-04f, -4.461048161e-04f, -4.817496625e-04f, -4.766215175e-04f, -4.248879309e-04f, -3.275711800e-04f, -1.929766610e-04f, -3.565926997e-05f, +1.259145254e-04f, +2.725379532e-04f, +3.875941701e-04f, +4.598320457e-04f, +4.850099279e-04f, +4.661040260e-04f, +4.121175966e-04f, +3.358432542e-04f, +2.511439643e-04f, +1.703799499e-04f, +1.025131319e-04f, +5.220438912e-05f, - /* 24, 4 */ -7.504350274e-05f, -1.344390595e-04f, -2.096144489e-04f, -2.937124231e-04f, -3.758927218e-04f, -4.427540852e-04f, -4.806236671e-04f, -4.782789577e-04f, -4.295045226e-04f, -3.348667971e-04f, -2.022311686e-04f, -4.581869630e-05f, +1.160612449e-04f, +2.641485480e-04f, +3.815740737e-04f, +4.566892339e-04f, +4.847927474e-04f, +4.684312656e-04f, +4.162885910e-04f, +3.409983591e-04f, +2.564365532e-04f, +1.751220037e-04f, +1.062665706e-04f, +5.480619333e-05f, - /* 24, 5 */ -7.193456522e-05f, -1.302170312e-04f, -2.045615590e-04f, -2.883831622e-04f, -3.710594077e-04f, -4.392893036e-04f, -4.793389263e-04f, -4.797527765e-04f, -4.339395286e-04f, -3.420118645e-04f, -2.113914331e-04f, -5.595644787e-05f, +1.061532886e-04f, +2.556376279e-04f, +3.753863858e-04f, +4.533603695e-04f, +4.843998374e-04f, +4.706174312e-04f, +4.203687678e-04f, +3.461177167e-04f, +2.617429433e-04f, +1.799141593e-04f, +1.100893595e-04f, +5.747989630e-05f, - /* 24, 6 */ -6.889834987e-05f, -1.260591965e-04f, -1.995470454e-04f, -2.830503358e-04f, -3.661698243e-04f, -4.357136989e-04f, -4.778977479e-04f, -4.810437916e-04f, -4.381919648e-04f, -3.490036345e-04f, -2.204533432e-04f, -6.606773875e-05f, +9.619528314e-05f, +2.470088608e-04f, +3.690332209e-04f, +4.498457452e-04f, +4.838297683e-04f, +4.726597937e-04f, +4.243547301e-04f, +3.511979487e-04f, +2.670603639e-04f, +1.847546294e-04f, +1.139808078e-04f, +6.022577049e-05f, - /* 24, 7 */ -6.593485851e-05f, -1.219665852e-04f, -1.945730275e-04f, -2.777169567e-04f, -3.612274261e-04f, -4.320305335e-04f, -4.763025159e-04f, -4.821529264e-04f, -4.422609626e-04f, -3.558394612e-04f, -2.294128549e-04f, -7.614780136e-05f, +8.619188981e-05f, +2.382659945e-04f, +3.625168024e-04f, +4.461457687e-04f, +4.830812085e-04f, +4.745556880e-04f, +4.282431024e-04f, +3.562356572e-04f, +2.723859925e-04f, +1.896415594e-04f, +1.179401580e-04f, +6.304403582e-05f, - /* 24, 8 */ -6.304403582e-05f, -1.179401580e-04f, -1.896415594e-04f, -2.723859925e-04f, -3.562356572e-04f, -4.282431024e-04f, -4.745556880e-04f, -4.830812085e-04f, -4.461457687e-04f, -3.625168024e-04f, -2.382659945e-04f, -8.619188981e-05f, +7.614780136e-05f, +2.294128549e-04f, +3.558394612e-04f, +4.422609626e-04f, +4.821529264e-04f, +4.763025159e-04f, +4.320305335e-04f, +3.612274261e-04f, +2.777169567e-04f, +1.945730275e-04f, +1.219665852e-04f, +6.593485851e-05f, - /* 24, 9 */ -6.022577049e-05f, -1.139808078e-04f, -1.847546294e-04f, -2.670603639e-04f, -3.511979487e-04f, -4.243547301e-04f, -4.726597937e-04f, -4.838297683e-04f, -4.498457452e-04f, -3.690332209e-04f, -2.470088608e-04f, -9.619528314e-05f, +6.606773875e-05f, +2.204533432e-04f, +3.490036345e-04f, +4.381919648e-04f, +4.810437916e-04f, +4.778977479e-04f, +4.357136989e-04f, +3.661698243e-04f, +2.830503358e-04f, +1.995470454e-04f, +1.260591965e-04f, +6.889834987e-05f, - /* 24,10 */ -5.747989630e-05f, -1.100893595e-04f, -1.799141593e-04f, -2.617429433e-04f, -3.461177167e-04f, -4.203687678e-04f, -4.706174312e-04f, -4.843998374e-04f, -4.533603695e-04f, -3.753863858e-04f, -2.556376279e-04f, -1.061532886e-04f, +5.595644787e-05f, +2.113914331e-04f, +3.420118645e-04f, +4.339395286e-04f, +4.797527765e-04f, +4.793389263e-04f, +4.392893036e-04f, +3.710594077e-04f, +2.883831622e-04f, +2.045615590e-04f, +1.302170312e-04f, +7.193456522e-05f, - /* 24,11 */ -5.480619333e-05f, -1.062665706e-04f, -1.751220037e-04f, -2.564365532e-04f, -3.409983591e-04f, -4.162885910e-04f, -4.684312656e-04f, -4.847927474e-04f, -4.566892339e-04f, -3.815740737e-04f, -2.641485480e-04f, -1.160612449e-04f, +4.581869630e-05f, +2.022311686e-04f, +3.348667971e-04f, +4.295045226e-04f, +4.782789577e-04f, +4.806236671e-04f, +4.427540852e-04f, +3.758927218e-04f, +2.937124231e-04f, +2.096144489e-04f, +1.344390595e-04f, +7.504350274e-05f, - /* 24,12 */ -5.220438912e-05f, -1.025131319e-04f, -1.703799499e-04f, -2.511439643e-04f, -3.358432542e-04f, -4.121175966e-04f, -4.661040260e-04f, -4.850099279e-04f, -4.598320457e-04f, -3.875941701e-04f, -2.725379532e-04f, -1.259145254e-04f, +3.565926997e-05f, +1.929766610e-04f, +3.275711800e-04f, +4.248879309e-04f, +4.766215175e-04f, +4.817496625e-04f, +4.461048161e-04f, +3.806663042e-04f, +2.990350629e-04f, +2.147035314e-04f, +1.387241832e-04f, +7.822510242e-05f, - /* 24,13 */ -4.967415993e-05f, -9.882966748e-05f, -1.656897170e-04f, -2.458678944e-04f, -3.306557574e-04f, -4.078592000e-04f, -4.636385032e-04f, -4.850529052e-04f, -4.627886263e-04f, -3.934446700e-04f, -2.808022583e-04f, -1.357085413e-04f, +2.548296987e-05f, +1.836320864e-04f, +3.201278616e-04f, +4.200908527e-04f, +4.747797448e-04f, +4.827146831e-04f, +4.493383067e-04f, +3.853766873e-04f, +3.043479843e-04f, +2.198265592e-04f, +1.430712350e-04f, +8.147924507e-05f, - /* 24,14 */ -4.721513201e-05f, -9.521673594e-05f, -1.610529558e-04f, -2.406110065e-04f, -3.254391996e-04f, -4.035168325e-04f, -4.610375470e-04f, -4.849233000e-04f, -4.655589110e-04f, -3.991236794e-04f, -2.889379628e-04f, -1.454387449e-04f, +1.529460870e-05f, +1.742016828e-04f, +3.125397891e-04f, +4.151145025e-04f, +4.727530367e-04f, +4.835165803e-04f, +4.524514078e-04f, +3.900204007e-04f, +3.096480504e-04f, +2.249812225e-04f, +1.474789784e-04f, +8.480575132e-05f, - /* 24,15 */ -4.482688286e-05f, -9.167483068e-05f, -1.564712483e-04f, -2.353759082e-04f, -3.201968846e-04f, -3.990939388e-04f, -4.583040637e-04f, -4.846228261e-04f, -4.681429482e-04f, -4.046294158e-04f, -2.969416536e-04f, -1.551006323e-04f, +5.099007530e-06f, +1.646897470e-04f, +3.048100066e-04f, +4.099602091e-04f, +4.705408991e-04f, +4.841532882e-04f, +4.554410135e-04f, +3.945939739e-04f, +3.149320871e-04f, +2.301651496e-04f, +1.519461079e-04f, +8.820438069e-05f, - /* 24, 0 */ +3.721332452e-05f, -8.727351622e-06f, -1.260052743e-04f, -3.262895896e-04f, -5.956603662e-04f, -8.899501259e-04f, -1.140781305e-03f, -1.272347980e-03f, -1.224469676e-03f, -9.741728935e-04f, -5.476309302e-04f, -1.718639697e-05f, +5.165697336e-04f, +9.521355524e-04f, +1.214742061e-03f, +1.275075958e-03f, +1.153251370e-03f, +9.076938752e-04f, +6.139361451e-04f, +3.414081512e-04f, +1.360881127e-04f, +1.374767685e-05f, -3.597568203e-05f, -3.836441874e-05f, - /* 24, 1 */ +3.827272022e-05f, -3.990309212e-06f, -1.162552839e-04f, -3.114511951e-04f, -5.774902753e-04f, -8.720393210e-04f, -1.127840237e-03f, -1.268906542e-03f, -1.233389975e-03f, -9.955061195e-04f, -5.782766642e-04f, -5.154594549e-05f, +4.851159022e-04f, +9.294071718e-04f, +1.204207601e-03f, +1.277079499e-03f, +1.165232472e-03f, +9.252515980e-04f, +6.323029482e-04f, +3.567995352e-04f, +1.465038861e-04f, +1.905656402e-05f, -3.455261727e-05f, -3.906074609e-05f, - /* 24, 2 */ +3.916105537e-05f, +4.689475139e-07f, -1.068376458e-04f, -2.968998221e-04f, -5.594401371e-04f, -8.539803004e-04f, -1.114446367e-03f, -1.264763218e-03f, -1.241503276e-03f, -1.016122900e-03f, -6.084845647e-04f, -8.586577249e-05f, +4.532926958e-04f, +9.060015608e-04f, +1.192867560e-03f, +1.278348235e-03f, +1.176706916e-03f, +9.426042142e-04f, +6.507457252e-04f, +3.724559064e-04f, +1.572522637e-04f, +2.465906089e-05f, -3.293697730e-05f, -3.967556907e-05f, - /* 24, 3 */ +3.988551544e-05f, +4.656120273e-06f, -9.775146571e-05f, -2.826418349e-04f, -5.415238064e-04f, -8.357917522e-04f, -1.100618114e-03f, -1.259930153e-03f, -1.248810685e-03f, -1.036011659e-03f, -6.382327409e-04f, -1.201194461e-04f, +4.211237814e-04f, +8.819332498e-04f, +1.180724004e-03f, +1.278872430e-03f, +1.187657300e-03f, +9.597325558e-04f, +6.692490513e-04f, +3.883689407e-04f, +1.683324883e-04f, +3.055997058e-05f, -3.112164378e-05f, -4.020250110e-05f, - /* 24, 4 */ +4.045327387e-05f, +8.577101915e-06f, -8.899546026e-05f, -2.686831091e-04f, -5.237547173e-04f, -8.174921923e-04f, -1.086374092e-03f, -1.254420050e-03f, -1.255314082e-03f, -1.055161588e-03f, -6.674998060e-04f, -1.542806079e-04f, +3.886332072e-04f, +8.572174771e-04f, +1.167779798e-03f, +1.278642989e-03f, +1.198066533e-03f, +9.766173891e-04f, +6.877971412e-04f, +4.045298263e-04f, +1.797433681e-04f, +3.676383839e-05f, -2.909954521e-05f, -4.063504078e-05f, - /* 24, 5 */ +4.087148106e-05f, +1.223796294e-05f, -8.056796775e-05f, -2.550290329e-04f, -5.061458738e-04f, -7.990999447e-04f, -1.071733083e-03f, -1.248246148e-03f, -1.261016119e-03f, -1.073562648e-03f, -6.962648992e-04f, -1.883230024e-04f, +3.558453770e-04f, +8.318701747e-04f, +1.154038613e-03f, +1.277651484e-03f, +1.207917863e-03f, +9.932394374e-04f, +7.063738625e-04f, +4.209292660e-04f, +1.914832687e-04f, +4.327493877e-05f, -2.686366939e-05f, -4.096657950e-05f, - /* 24, 6 */ +4.114725367e-05f, +1.564493806e-05f, -7.246695886e-05f, -2.416845105e-04f, -4.887098400e-04f, -7.806331214e-04f, -1.056714015e-03f, -1.241422199e-03f, -1.265920211e-03f, -1.091205584e-03f, -7.245077077e-04f, -2.222205061e-04f, +3.227850234e-04f, +8.059079530e-04f, +1.139504920e-03f, +1.275890161e-03f, +1.217194897e-03f, +1.009579403e-03f, +7.249627509e-04f, +4.375574807e-04f, +2.035501057e-04f, +5.009726244e-05f, -2.440707607e-05f, -4.119040933e-05f, - /* 24, 7 */ +4.128766430e-05f, +1.880441272e-05f, -6.469004778e-05f, -2.286539641e-04f, -4.714587328e-04f, -7.621096041e-04f, -1.041335936e-03f, -1.233962452e-03f, -1.270030522e-03f, -1.108081926e-03f, -7.522084876e-04f, -2.559471563e-04f, +2.894771803e-04f, +7.793480846e-04f, +1.124183998e-03f, +1.273351959e-03f, +1.225881627e-03f, +1.025617992e-03f, +7.435470253e-04f, +4.544042133e-04f, +2.159413387e-04f, +5.723450367e-05f, -2.172290976e-05f, -4.129973134e-05f, - /* 24, 8 */ +4.129973134e-05f, +2.172290976e-05f, -5.723450367e-05f, -2.159413387e-04f, -4.544042133e-04f, -7.435470253e-04f, -1.025617992e-03f, -1.225881627e-03f, -1.273351959e-03f, -1.124183998e-03f, -7.793480846e-04f, -2.894771803e-04f, +2.559471563e-04f, +7.522084876e-04f, +1.108081926e-03f, +1.270030522e-03f, +1.233962452e-03f, +1.041335936e-03f, +7.621096041e-04f, +4.714587328e-04f, +2.286539641e-04f, +6.469004778e-05f, -1.880441272e-05f, -4.128766430e-05f, - /* 24, 9 */ +4.119040933e-05f, +2.440707607e-05f, -5.009726244e-05f, -2.035501057e-04f, -4.375574807e-04f, -7.249627509e-04f, -1.009579403e-03f, -1.217194897e-03f, -1.275890161e-03f, -1.139504920e-03f, -8.059079530e-04f, -3.227850234e-04f, +2.222205061e-04f, +7.245077077e-04f, +1.091205584e-03f, +1.265920211e-03f, +1.241422199e-03f, +1.056714015e-03f, +7.806331214e-04f, +4.887098400e-04f, +2.416845105e-04f, +7.246695886e-05f, -1.564493806e-05f, -4.114725367e-05f, - /* 24,10 */ +4.096657950e-05f, +2.686366939e-05f, -4.327493877e-05f, -1.914832687e-04f, -4.209292660e-04f, -7.063738625e-04f, -9.932394374e-04f, -1.207917863e-03f, -1.277651484e-03f, -1.154038613e-03f, -8.318701747e-04f, -3.558453770e-04f, +1.883230024e-04f, +6.962648992e-04f, +1.073562648e-03f, +1.261016119e-03f, +1.248246148e-03f, +1.071733083e-03f, +7.990999447e-04f, +5.061458738e-04f, +2.550290329e-04f, +8.056796775e-05f, -1.223796294e-05f, -4.087148106e-05f, - /* 24,11 */ +4.063504078e-05f, +2.909954521e-05f, -3.676383839e-05f, -1.797433681e-04f, -4.045298263e-04f, -6.877971412e-04f, -9.766173891e-04f, -1.198066533e-03f, -1.278642989e-03f, -1.167779798e-03f, -8.572174771e-04f, -3.886332072e-04f, +1.542806079e-04f, +6.674998060e-04f, +1.055161588e-03f, +1.255314082e-03f, +1.254420050e-03f, +1.086374092e-03f, +8.174921923e-04f, +5.237547173e-04f, +2.686831091e-04f, +8.899546026e-05f, -8.577101915e-06f, -4.045327387e-05f, - /* 24,12 */ +4.020250110e-05f, +3.112164378e-05f, -3.055997058e-05f, -1.683324883e-04f, -3.883689407e-04f, -6.692490513e-04f, -9.597325558e-04f, -1.187657300e-03f, -1.278872430e-03f, -1.180724004e-03f, -8.819332498e-04f, -4.211237814e-04f, +1.201194461e-04f, +6.382327409e-04f, +1.036011659e-03f, +1.248810685e-03f, +1.259930153e-03f, +1.100618114e-03f, +8.357917522e-04f, +5.415238064e-04f, +2.826418349e-04f, +9.775146571e-05f, -4.656120273e-06f, -3.988551544e-05f, - /* 24,13 */ +3.967556907e-05f, +3.293697730e-05f, -2.465906089e-05f, -1.572522637e-04f, -3.724559064e-04f, -6.507457252e-04f, -9.426042142e-04f, -1.176706916e-03f, -1.278348235e-03f, -1.192867560e-03f, -9.060015608e-04f, -4.532926958e-04f, +8.586577249e-05f, +6.084845647e-04f, +1.016122900e-03f, +1.241503276e-03f, +1.264763218e-03f, +1.114446367e-03f, +8.539803004e-04f, +5.594401371e-04f, +2.968998221e-04f, +1.068376458e-04f, -4.689475139e-07f, -3.916105537e-05f, - /* 24,14 */ +3.906074609e-05f, +3.455261727e-05f, -1.905656402e-05f, -1.465038861e-04f, -3.567995352e-04f, -6.323029482e-04f, -9.252515980e-04f, -1.165232472e-03f, -1.277079499e-03f, -1.204207601e-03f, -9.294071718e-04f, -4.851159022e-04f, +5.154594549e-05f, +5.782766642e-04f, +9.955061195e-04f, +1.233389975e-03f, +1.268906542e-03f, +1.127840237e-03f, +8.720393210e-04f, +5.774902753e-04f, +3.114511951e-04f, +1.162552839e-04f, +3.990309212e-06f, -3.827272022e-05f, - /* 24,15 */ +3.836441874e-05f, +3.597568203e-05f, -1.374767685e-05f, -1.360881127e-04f, -3.414081512e-04f, -6.139361451e-04f, -9.076938752e-04f, -1.153251370e-03f, -1.275075958e-03f, -1.214742061e-03f, -9.521355524e-04f, -5.165697336e-04f, +1.718639697e-05f, +5.476309302e-04f, +9.741728935e-04f, +1.224469676e-03f, +1.272347980e-03f, +1.140781305e-03f, +8.899501259e-04f, +5.956603662e-04f, +3.262895896e-04f, +1.260052743e-04f, +8.727351622e-06f, -3.721332452e-05f, - /* 24, 0 */ +8.266384897e-05f, +1.864042294e-04f, +2.488885336e-04f, +1.546439211e-04f, -1.995837972e-04f, -8.300120177e-04f, -1.613160849e-03f, -2.296673715e-03f, -2.585717258e-03f, -2.273475621e-03f, -1.352242686e-03f, -4.324968723e-05f, +1.278412578e-03f, +2.232544293e-03f, +2.585064833e-03f, +2.329165788e-03f, +1.661894649e-03f, +8.765619362e-04f, +2.314166150e-04f, -1.408802900e-04f, -2.488728147e-04f, -1.925779863e-04f, -8.867605644e-05f, -1.381647235e-05f, - /* 24, 1 */ +7.679604466e-05f, +1.800850086e-04f, +2.482891228e-04f, +1.673628145e-04f, -1.688781476e-04f, -7.841040553e-04f, -1.564053778e-03f, -2.262611362e-03f, -2.583952550e-03f, -2.311948888e-03f, -1.424504725e-03f, -1.296977982e-04f, +1.203096102e-03f, +2.189184288e-03f, +2.581965725e-03f, +2.360018674e-03f, +1.710180642e-03f, +9.237037585e-04f, +2.643640884e-04f, -1.260534627e-04f, -2.482108983e-04f, -1.985807152e-04f, -9.482163577e-05f, -1.700840565e-05f, - /* 24, 2 */ +7.108272573e-05f, +1.736451253e-04f, +2.471057735e-04f, +1.790568131e-04f, -1.393098721e-04f, -7.388859215e-04f, -1.514647192e-03f, -2.227049028e-03f, -2.579803518e-03f, -2.347938498e-03f, -1.495119547e-03f, -2.159922036e-04f, +1.126377386e-03f, +2.143428746e-03f, +2.576393731e-03f, +2.389164999e-03f, +1.757943642e-03f, +9.713853048e-04f, +2.984113695e-04f, -1.101464409e-04f, -2.468719141e-04f, -2.043861254e-04f, -1.010885985e-04f, -2.040687624e-05f, - /* 24, 3 */ +6.553303557e-05f, +1.671085856e-04f, +2.453697283e-04f, +1.897470664e-04f, -1.108869031e-04f, -6.944032625e-04f, -1.465013955e-03f, -2.190058265e-03f, -2.573306150e-03f, -2.381422658e-03f, -1.564010684e-03f, -3.020307159e-04f, +1.048342851e-03f, +2.095314540e-03f, +2.568326065e-03f, +2.416539054e-03f, +1.805107932e-03f, +1.019552324e-03f, +3.335412514e-04f, -9.314376077e-05f, -2.448252646e-04f, -2.099672379e-04f, -1.074639934e-04f, -2.401251277e-05f, - /* 24, 4 */ +6.015519126e-05f, +1.604985702e-04f, +2.431122111e-04f, +1.994559526e-04f, -8.361493575e-05f, -6.506994570e-04f, -1.415225919e-03f, -2.151711738e-03f, -2.564499518e-03f, -2.412383397e-03f, -1.631104459e-03f, -3.877115714e-04f, +9.690810727e-04f, +2.044882222e-03f, +2.557743429e-03f, +2.442076932e-03f, +1.851597394e-03f, +1.068148557e-03f, +3.697341485e-04f, -7.503156587e-05f, -2.420407013e-04f, -2.152964269e-04f, -1.139339030e-04f, -2.782526914e-05f, - /* 24, 5 */ +5.495649810e-05f, +1.538374078e-04f, +2.403643576e-04f, +2.082069988e-04f, -5.749746926e-05f, -6.078155802e-04f, -1.365353811e-03f, -2.112083086e-03f, -2.553425683e-03f, -2.440806561e-03f, -1.696330106e-03f, -4.729335981e-04f, +8.886826408e-04f, +1.992175989e-03f, +2.544630075e-03f, +2.465716661e-03f, +1.897335642e-03f, +1.117115802e-03f, +4.069680813e-04f, -5.579767803e-05f, -2.384884029e-04f, -2.203454641e-04f, -1.204834430e-04f, -3.184439496e-05f, - /* 24, 6 */ +4.994336610e-05f, +1.471465506e-04f, +2.371571498e-04f, +2.160248014e-04f, -3.253585139e-05f, -5.657903730e-04f, -1.315467130e-03f, -2.071246779e-03f, -2.540129593e-03f, -2.466681818e-03f, -1.759619871e-03f, -5.575963834e-04f, +8.072400133e-04f, +1.937243618e-03f, +2.528973864e-03f, +2.487398336e-03f, +1.942246152e-03f, +1.166393990e-03f, +4.452186667e-04f, -3.543166589e-05f, -2.341390536e-04f, -2.250855657e-04f, -1.270967638e-04f, -3.606840695e-05f, - /* 24, 7 */ +4.512132841e-05f, +1.404465535e-04f, +2.335213506e-04f, +2.229349451e-04f, -8.729326764e-06f, -5.246602166e-04f, -1.265634037e-03f, -2.029277978e-03f, -2.524658979e-03f, -2.490002646e-03f, -1.820909115e-03f, -6.416004392e-04f, +7.248473657e-04f, +1.880136408e-03f, +2.510766314e-03f, +2.507064240e-03f, +1.986252395e-03f, +1.215921259e-03f, +4.844591124e-04f, -1.392491133e-05f, -2.289639228e-04f, -2.294874421e-04f, -1.337570553e-04f, -4.049506149e-05f, - /* 24, 8 */ +4.049506149e-05f, +1.337570553e-04f, +2.294874421e-04f, +2.289639228e-04f, +1.392491133e-05f, -4.844591124e-04f, -1.215921259e-03f, -1.986252395e-03f, -2.507064240e-03f, -2.510766314e-03f, -1.880136408e-03f, -7.248473657e-04f, +6.416004392e-04f, +1.820909115e-03f, +2.490002646e-03f, +2.524658979e-03f, +2.029277978e-03f, +1.265634037e-03f, +5.246602166e-04f, +8.729326764e-06f, -2.229349451e-04f, -2.335213506e-04f, -1.404465535e-04f, -4.512132841e-05f, - /* 24, 9 */ +3.606840695e-05f, +1.270967638e-04f, +2.250855657e-04f, +2.341390536e-04f, +3.543166589e-05f, -4.452186667e-04f, -1.166393990e-03f, -1.942246152e-03f, -2.487398336e-03f, -2.528973864e-03f, -1.937243618e-03f, -8.072400133e-04f, +5.575963834e-04f, +1.759619871e-03f, +2.466681818e-03f, +2.540129593e-03f, +2.071246779e-03f, +1.315467130e-03f, +5.657903730e-04f, +3.253585139e-05f, -2.160248014e-04f, -2.371571498e-04f, -1.471465506e-04f, -4.994336610e-05f, - /* 24,10 */ +3.184439496e-05f, +1.204834430e-04f, +2.203454641e-04f, +2.384884029e-04f, +5.579767803e-05f, -4.069680813e-04f, -1.117115802e-03f, -1.897335642e-03f, -2.465716661e-03f, -2.544630075e-03f, -1.992175989e-03f, -8.886826408e-04f, +4.729335981e-04f, +1.696330106e-03f, +2.440806561e-03f, +2.553425683e-03f, +2.112083086e-03f, +1.365353811e-03f, +6.078155802e-04f, +5.749746926e-05f, -2.082069988e-04f, -2.403643576e-04f, -1.538374078e-04f, -5.495649810e-05f, - /* 24,11 */ +2.782526914e-05f, +1.139339030e-04f, +2.152964269e-04f, +2.420407013e-04f, +7.503156587e-05f, -3.697341485e-04f, -1.068148557e-03f, -1.851597394e-03f, -2.442076932e-03f, -2.557743429e-03f, -2.044882222e-03f, -9.690810727e-04f, +3.877115714e-04f, +1.631104459e-03f, +2.412383397e-03f, +2.564499518e-03f, +2.151711738e-03f, +1.415225919e-03f, +6.506994570e-04f, +8.361493575e-05f, -1.994559526e-04f, -2.431122111e-04f, -1.604985702e-04f, -6.015519126e-05f, - /* 24,12 */ +2.401251277e-05f, +1.074639934e-04f, +2.099672379e-04f, +2.448252646e-04f, +9.314376077e-05f, -3.335412514e-04f, -1.019552324e-03f, -1.805107932e-03f, -2.416539054e-03f, -2.568326065e-03f, -2.095314540e-03f, -1.048342851e-03f, +3.020307159e-04f, +1.564010684e-03f, +2.381422658e-03f, +2.573306150e-03f, +2.190058265e-03f, +1.465013955e-03f, +6.944032625e-04f, +1.108869031e-04f, -1.897470664e-04f, -2.453697283e-04f, -1.671085856e-04f, -6.553303557e-05f, - /* 24,13 */ +2.040687624e-05f, +1.010885985e-04f, +2.043861254e-04f, +2.468719141e-04f, +1.101464409e-04f, -2.984113695e-04f, -9.713853048e-04f, -1.757943642e-03f, -2.389164999e-03f, -2.576393731e-03f, -2.143428746e-03f, -1.126377386e-03f, +2.159922036e-04f, +1.495119547e-03f, +2.347938498e-03f, +2.579803518e-03f, +2.227049028e-03f, +1.514647192e-03f, +7.388859215e-04f, +1.393098721e-04f, -1.790568131e-04f, -2.471057735e-04f, -1.736451253e-04f, -7.108272573e-05f, - /* 24,14 */ +1.700840565e-05f, +9.482163577e-05f, +1.985807152e-04f, +2.482108983e-04f, +1.260534627e-04f, -2.643640884e-04f, -9.237037585e-04f, -1.710180642e-03f, -2.360018674e-03f, -2.581965725e-03f, -2.189184288e-03f, -1.203096102e-03f, +1.296977982e-04f, +1.424504725e-03f, +2.311948888e-03f, +2.583952550e-03f, +2.262611362e-03f, +1.564053778e-03f, +7.841040553e-04f, +1.688781476e-04f, -1.673628145e-04f, -2.482891228e-04f, -1.800850086e-04f, -7.679604466e-05f, - /* 24,15 */ +1.381647235e-05f, +8.867605644e-05f, +1.925779863e-04f, +2.488728147e-04f, +1.408802900e-04f, -2.314166150e-04f, -8.765619362e-04f, -1.661894649e-03f, -2.329165788e-03f, -2.585064833e-03f, -2.232544293e-03f, -1.278412578e-03f, +4.324968723e-05f, +1.352242686e-03f, +2.273475621e-03f, +2.585717258e-03f, +2.296673715e-03f, +1.613160849e-03f, +8.300120177e-04f, +1.995837972e-04f, -1.546439211e-04f, -2.488885336e-04f, -1.864042294e-04f, -8.266384897e-05f, - /* 24, 0 */ -8.756118778e-05f, -1.009631262e-05f, +2.499923290e-04f, +5.877223422e-04f, +6.788717735e-04f, +1.353208099e-04f, -1.181609893e-03f, -2.907631270e-03f, -4.227440709e-03f, -4.289302846e-03f, -2.753030129e-03f, -9.027467135e-05f, +2.610460208e-03f, +4.239433597e-03f, +4.275304929e-03f, +3.011836329e-03f, +1.284225967e-03f, -7.470693818e-05f, -6.668983668e-04f, -6.049037547e-04f, -2.711811033e-04f, -7.712041122e-07f, +8.724954076e-05f, +5.404595280e-05f, - /* 24, 1 */ -8.741655630e-05f, -2.019027119e-05f, +2.291878545e-04f, +5.696067266e-04f, +6.882827247e-04f, +1.927359117e-04f, -1.080756061e-03f, -2.801858302e-03f, -4.174485032e-03f, -4.332641998e-03f, -2.890980043e-03f, -2.706680808e-04f, +2.463494124e-03f, +4.183052585e-03f, +4.317905196e-03f, +3.114235078e-03f, +1.388440877e-03f, -1.091717027e-05f, -6.522789212e-04f, -6.210469572e-04f, -2.926973166e-04f, -1.241413728e-05f, +8.645224618e-05f, +5.751117153e-05f, - /* 24, 2 */ -8.684540791e-05f, -2.951540942e-05f, +2.088206066e-04f, +5.506594457e-04f, +6.952187414e-04f, +2.469379129e-04f, -9.818199274e-04f, -2.694754852e-03f, -4.116618896e-03f, -4.369446535e-03f, -3.024096686e-03f, -4.505940556e-04f, +2.312365817e-03f, +4.120192033e-03f, +4.355078033e-03f, +3.214588722e-03f, +1.494083528e-03f, +5.601692583e-05f, -6.349341530e-04f, -6.360467505e-04f, -3.144802134e-04f, -2.483132916e-05f, +8.514047439e-05f, +6.091502927e-05f, - /* 24, 3 */ -8.587775422e-05f, -3.807920270e-05f, +1.889395528e-04f, +5.309813040e-04f, +6.997709178e-04f, +2.979208532e-04f, -8.849487633e-04f, -2.586556795e-03f, -4.054031257e-03f, -4.399725659e-03f, -3.152177828e-03f, -6.297421881e-04f, +2.157318805e-03f, +4.050898074e-03f, +4.386669491e-03f, +3.312658663e-03f, +1.600975431e-03f, +1.260549593e-04f, -6.147894349e-04f, -6.497970322e-04f, -3.364651980e-04f, -3.801847602e-05f, +8.328608571e-05f, +6.423360450e-05f, - /* 24, 4 */ -8.454371894e-05f, -4.589171696e-05f, +1.695896910e-04f, +5.106711213e-04f, +7.020335552e-04f, +3.456869501e-04f, -7.902814402e-04f, -2.477497901e-03f, -3.986918477e-03f, -4.423502152e-03f, -3.275032702e-03f, -8.078038906e-04f, +1.998605647e-03f, +3.975230752e-03f, +4.412535626e-03f, +3.408207107e-03f, +1.708931018e-03f, +1.991476106e-04f, -5.917751493e-04f, -6.621910968e-04f, -3.585839047e-04f, -5.196800512e-05f, +8.086178430e-05f, +6.744196867e-05f, - /* 24, 5 */ -8.287340509e-05f, -5.296545744e-05f, +1.508120534e-04f, +4.898254962e-04f, +7.021037953e-04f, +3.902463858e-04f, -6.979482496e-04f, -2.367809282e-03f, -3.915483754e-03f, -4.440812209e-03f, -3.392482395e-03f, -9.844731162e-04f, +1.836487379e-03f, +3.893263974e-03f, +4.432542967e-03f, +3.500997660e-03f, +1.817757983e-03f, +2.752365501e-04f, -5.658270331e-04f, -6.731219472e-04f, -3.807642824e-04f, -6.666895953e-05f, +7.784127492e-05f, +7.051425394e-05f, - /* 24, 6 */ -8.089676755e-05f, -5.931521393e-05f, +1.326437227e-04f, +4.685385820e-04f, +7.000812546e-04f, +4.316170765e-04f, -6.080707472e-04f, -2.257718867e-03f, -3.839936544e-03f, -4.451705229e-03f, -3.504360214e-03f, -1.159447072e-03f, +1.671232927e-03f, +3.805085432e-03f, +4.446568950e-03f, +3.590795947e-03f, +1.927257648e-03f, +3.542543807e-04f, -5.368865161e-04f, -6.824826149e-04f, -4.029306956e-04f, -8.210689127e-05f, +7.419942176e-05f, +7.342372810e-05f, - /* 24, 7 */ -7.864349144e-05f, -6.495790319e-05f, +1.151178633e-04f, +4.469018792e-04f, +6.960676605e-04f, +4.698244236e-04f, -5.207616239e-04f, -2.147450881e-03f, -3.760491970e-03f, -4.456243581e-03f, -3.610512013e-03f, -1.332426925e-03f, +1.503118492e-03f, +3.710796487e-03f, +4.454502333e-03f, +3.677370219e-03f, +2.037225356e-03f, +4.361246060e-04f, -5.049010493e-04f, -6.901664903e-04f, -4.250040411e-04f, -9.826376366e-05f, +6.991240915e-05f, +7.614287656e-05f, - /* 24, 8 */ -7.614287656e-05f, -6.991240915e-05f, +9.826376366e-05f, +4.250040411e-04f, +6.901664903e-04f, +5.049010493e-04f, -4.361246060e-04f, -2.037225356e-03f, -3.677370219e-03f, -4.454502333e-03f, -3.710796487e-03f, -1.503118492e-03f, +1.332426925e-03f, +3.610512013e-03f, +4.456243581e-03f, +3.760491970e-03f, +2.147450881e-03f, +5.207616239e-04f, -4.698244236e-04f, -6.960676605e-04f, -4.469018792e-04f, -1.151178633e-04f, +6.495790319e-05f, +7.864349144e-05f, - /* 24, 9 */ -7.342372810e-05f, -7.419942176e-05f, +8.210689127e-05f, +4.029306956e-04f, +6.824826149e-04f, +5.368865161e-04f, -3.542543807e-04f, -1.927257648e-03f, -3.590795947e-03f, -4.446568950e-03f, -3.805085432e-03f, -1.671232927e-03f, +1.159447072e-03f, +3.504360214e-03f, +4.451705229e-03f, +3.839936544e-03f, +2.257718867e-03f, +6.080707472e-04f, -4.316170765e-04f, -7.000812546e-04f, -4.685385820e-04f, -1.326437227e-04f, +5.931521393e-05f, +8.089676755e-05f, - /* 24,10 */ -7.051425394e-05f, -7.784127492e-05f, +6.666895953e-05f, +3.807642824e-04f, +6.731219472e-04f, +5.658270331e-04f, -2.752365501e-04f, -1.817757983e-03f, -3.500997660e-03f, -4.432542967e-03f, -3.893263974e-03f, -1.836487379e-03f, +9.844731162e-04f, +3.392482395e-03f, +4.440812209e-03f, +3.915483754e-03f, +2.367809282e-03f, +6.979482496e-04f, -3.902463858e-04f, -7.021037953e-04f, -4.898254962e-04f, -1.508120534e-04f, +5.296545744e-05f, +8.287340509e-05f, - /* 24,11 */ -6.744196867e-05f, -8.086178430e-05f, +5.196800512e-05f, +3.585839047e-04f, +6.621910968e-04f, +5.917751493e-04f, -1.991476106e-04f, -1.708931018e-03f, -3.408207107e-03f, -4.412535626e-03f, -3.975230752e-03f, -1.998605647e-03f, +8.078038906e-04f, +3.275032702e-03f, +4.423502152e-03f, +3.986918477e-03f, +2.477497901e-03f, +7.902814402e-04f, -3.456869501e-04f, -7.020335552e-04f, -5.106711213e-04f, -1.695896910e-04f, +4.589171696e-05f, +8.454371894e-05f, - /* 24,12 */ -6.423360450e-05f, -8.328608571e-05f, +3.801847602e-05f, +3.364651980e-04f, +6.497970322e-04f, +6.147894349e-04f, -1.260549593e-04f, -1.600975431e-03f, -3.312658663e-03f, -4.386669491e-03f, -4.050898074e-03f, -2.157318805e-03f, +6.297421881e-04f, +3.152177828e-03f, +4.399725659e-03f, +4.054031257e-03f, +2.586556795e-03f, +8.849487633e-04f, -2.979208532e-04f, -6.997709178e-04f, -5.309813040e-04f, -1.889395528e-04f, +3.807920270e-05f, +8.587775422e-05f, - /* 24,13 */ -6.091502927e-05f, -8.514047439e-05f, +2.483132916e-05f, +3.144802134e-04f, +6.360467505e-04f, +6.349341530e-04f, -5.601692583e-05f, -1.494083528e-03f, -3.214588722e-03f, -4.355078033e-03f, -4.120192033e-03f, -2.312365817e-03f, +4.505940556e-04f, +3.024096686e-03f, +4.369446535e-03f, +4.116618896e-03f, +2.694754852e-03f, +9.818199274e-04f, -2.469379129e-04f, -6.952187414e-04f, -5.506594457e-04f, -2.088206066e-04f, +2.951540942e-05f, +8.684540791e-05f, - /* 24,14 */ -5.751117153e-05f, -8.645224618e-05f, +1.241413728e-05f, +2.926973166e-04f, +6.210469572e-04f, +6.522789212e-04f, +1.091717027e-05f, -1.388440877e-03f, -3.114235078e-03f, -4.317905196e-03f, -4.183052585e-03f, -2.463494124e-03f, +2.706680808e-04f, +2.890980043e-03f, +4.332641998e-03f, +4.174485032e-03f, +2.801858302e-03f, +1.080756061e-03f, -1.927359117e-04f, -6.882827247e-04f, -5.696067266e-04f, -2.291878545e-04f, +2.019027119e-05f, +8.741655630e-05f, - /* 24,15 */ -5.404595280e-05f, -8.724954076e-05f, +7.712041122e-07f, +2.711811033e-04f, +6.049037547e-04f, +6.668983668e-04f, +7.470693818e-05f, -1.284225967e-03f, -3.011836329e-03f, -4.275304929e-03f, -4.239433597e-03f, -2.610460208e-03f, +9.027467135e-05f, +2.753030129e-03f, +4.289302846e-03f, +4.227440709e-03f, +2.907631270e-03f, +1.181609893e-03f, -1.353208099e-04f, -6.788717735e-04f, -5.877223422e-04f, -2.499923290e-04f, +1.009631262e-05f, +8.756118778e-05f, - /* 24, 0 */ -4.836862817e-05f, -2.381906908e-04f, -2.861422699e-04f, +1.419765781e-04f, +9.779307384e-04f, +1.431118485e-03f, +4.239072727e-04f, -2.320049614e-03f, -5.516524807e-03f, -6.885468951e-03f, -4.882970050e-03f, -1.652445539e-04f, +4.647640808e-03f, +6.864975932e-03f, +5.679465803e-03f, +2.528057977e-03f, -2.982544427e-04f, -1.420326139e-03f, -1.029081461e-03f, -1.868092348e-04f, +2.758007186e-04f, +2.491702023e-04f, +5.836581816e-05f, -3.491105347e-05f, - /* 24, 1 */ -3.887878147e-05f, -2.267040256e-04f, -2.944876029e-04f, +9.900949096e-05f, +9.254138922e-04f, +1.435932770e-03f, +5.422031866e-04f, -2.114193296e-03f, -5.346195092e-03f, -6.891993065e-03f, -5.106971374e-03f, -4.953359135e-04f, +4.401480442e-03f, +6.830374341e-03f, +5.834433801e-03f, +2.737690485e-03f, -1.653667139e-04f, -1.403322383e-03f, -1.078579553e-03f, -2.333982604e-04f, +2.633988510e-04f, +2.595470071e-04f, +6.884149383e-05f, -3.317859772e-05f, - /* 24, 2 */ -2.992041863e-05f, -2.148033017e-04f, -3.009073041e-04f, +5.800387728e-05f, +8.718108917e-04f, +1.435015360e-03f, +6.530479478e-04f, -1.910998057e-03f, -5.169072824e-03f, -6.884726614e-03f, -5.319183002e-03f, -8.242352929e-04f, +4.145019341e-03f, +6.781564023e-03f, +5.980858542e-03f, +2.948401826e-03f, -2.539414214e-05f, -1.379888189e-03f, -1.126132932e-03f, -2.816211011e-04f, +2.488796810e-04f, +2.692234993e-04f, +7.976200316e-05f, -3.095924021e-05f, - /* 24, 3 */ -2.151306397e-05f, -2.025787804e-04f, -3.054778181e-04f, +1.904245883e-05f, +8.173942695e-04f, +1.428624316e-03f, +7.563747429e-04f, -1.710952703e-03f, -4.985763915e-03f, -6.863885651e-03f, -5.519179462e-03f, -1.151152247e-03f, +3.878819947e-03f, +6.718485032e-03f, +6.118185890e-03f, +3.159630822e-03f, +1.214850236e-04f, -1.349820125e-03f, -1.171444944e-03f, -3.313418525e-04f, +2.321939470e-04f, +2.781004545e-04f, +9.108884721e-05f, -2.823129406e-05f, - /* 24, 4 */ -1.367174826e-05f, -1.901175448e-04f, -3.082808136e-04f, -1.780505549e-05f, +7.624282793e-04f, +1.417028061e-03f, +8.521437270e-04f, -1.514524553e-03f, -4.796881865e-03f, -6.829722854e-03f, -5.706572744e-03f, -1.475302628e-03f, +3.603475092e-03f, +6.641118197e-03f, +6.245879909e-03f, +3.370802059e-03f, +2.750642929e-04f, -1.312931609e-03f, -1.214215433e-03f, -3.824113238e-04f, +2.133007109e-04f, +2.860774924e-04f, +1.027786538e-04f, -2.497524656e-05f, - /* 24, 5 */ -6.407151783e-06f, -1.775031866e-04f, -3.094025487e-04f, -5.248174754e-05f, +7.071681142e-04f, +1.400504044e-03f, +9.403414758e-04f, -1.322158275e-03f, -4.603045619e-03f, -6.782526316e-03f, -5.881013326e-03f, -1.795911068e-03f, +3.319606230e-03f, +6.549485546e-03f, +6.363424898e-03f, +3.581327596e-03f, +4.351089927e-04f, -1.269054120e-03f, -1.254141844e-03f, -4.346671648e-04f, +1.921679399e-04f, +2.930535649e-04f, +1.147831783e-04f, -2.117401174e-05f, - /* 24, 6 */ +2.742338831e-07f, -1.648155254e-04f, -3.089332390e-04f, -8.494321776e-05f, +6.518591895e-04f, +1.379337399e-03f, +1.020980349e-03f, -1.134274832e-03f, -4.404877423e-03f, -6.722618231e-03f, -6.042191052e-03f, -2.112213435e-03f, +3.027861551e-03f, +6.443650588e-03f, +6.470327373e-03f, +3.790608755e-03f, +6.013564365e-04f, -1.218038367e-03f, -1.290920380e-03f, -4.879340571e-04f, +1.687730668e-04f, +2.989274696e-04f, +1.270493337e-04f, -1.681317980e-05f, - /* 24, 7 */ +6.369927035e-06f, -1.521303593e-04f, -3.069664313e-04f, -1.151572658e-04f, +5.967364879e-04f, +1.353819611e-03f, +1.094097769e-03f, -9.512705360e-04f, -4.203000702e-03f, -6.650353458e-03f, -6.189835876e-03f, -2.423459243e-03f, +2.728914008e-03f, +6.323718452e-03f, +6.566118000e-03f, +3.998037969e-03f, +7.735162047e-04f, -1.159755419e-03f, -1.324247193e-03f, -5.420239710e-04f, +1.431035268e-04f, +3.035983857e-04f, +1.395192491e-04f, -1.188126168e-05f, - /* 24, 8 */ +1.188126168e-05f, -1.395192491e-04f, -3.035983857e-04f, -1.431035268e-04f, +5.420239710e-04f, +1.324247193e-03f, +1.159755419e-03f, -7.735162047e-04f, -3.998037969e-03f, -6.566118000e-03f, -6.323718452e-03f, -2.728914008e-03f, +2.423459243e-03f, +6.189835876e-03f, +6.650353458e-03f, +4.203000702e-03f, +9.512705360e-04f, -1.094097769e-03f, -1.353819611e-03f, -5.967364879e-04f, +1.151572658e-04f, +3.069664313e-04f, +1.521303593e-04f, -6.369927035e-06f, - /* 24, 9 */ +1.681317980e-05f, -1.270493337e-04f, -2.989274696e-04f, -1.687730668e-04f, +4.879340571e-04f, +1.290920380e-03f, +1.218038367e-03f, -6.013564365e-04f, -3.790608755e-03f, -6.470327373e-03f, -6.443650588e-03f, -3.027861551e-03f, +2.112213435e-03f, +6.042191052e-03f, +6.722618231e-03f, +4.404877423e-03f, +1.134274832e-03f, -1.020980349e-03f, -1.379337399e-03f, -6.518591895e-04f, +8.494321776e-05f, +3.089332390e-04f, +1.648155254e-04f, -2.742338831e-07f, - /* 24,10 */ +2.117401174e-05f, -1.147831783e-04f, -2.930535649e-04f, -1.921679399e-04f, +4.346671648e-04f, +1.254141844e-03f, +1.269054120e-03f, -4.351089927e-04f, -3.581327596e-03f, -6.363424898e-03f, -6.549485546e-03f, -3.319606230e-03f, +1.795911068e-03f, +5.881013326e-03f, +6.782526316e-03f, +4.603045619e-03f, +1.322158275e-03f, -9.403414758e-04f, -1.400504044e-03f, -7.071681142e-04f, +5.248174754e-05f, +3.094025487e-04f, +1.775031866e-04f, +6.407151783e-06f, - /* 24,11 */ +2.497524656e-05f, -1.027786538e-04f, -2.860774924e-04f, -2.133007109e-04f, +3.824113238e-04f, +1.214215433e-03f, +1.312931609e-03f, -2.750642929e-04f, -3.370802059e-03f, -6.245879909e-03f, -6.641118197e-03f, -3.603475092e-03f, +1.475302628e-03f, +5.706572744e-03f, +6.829722854e-03f, +4.796881865e-03f, +1.514524553e-03f, -8.521437270e-04f, -1.417028061e-03f, -7.624282793e-04f, +1.780505549e-05f, +3.082808136e-04f, +1.901175448e-04f, +1.367174826e-05f, - /* 24,12 */ +2.823129406e-05f, -9.108884721e-05f, -2.781004545e-04f, -2.321939470e-04f, +3.313418525e-04f, +1.171444944e-03f, +1.349820125e-03f, -1.214850236e-04f, -3.159630822e-03f, -6.118185890e-03f, -6.718485032e-03f, -3.878819947e-03f, +1.151152247e-03f, +5.519179462e-03f, +6.863885651e-03f, +4.985763915e-03f, +1.710952703e-03f, -7.563747429e-04f, -1.428624316e-03f, -8.173942695e-04f, -1.904245883e-05f, +3.054778181e-04f, +2.025787804e-04f, +2.151306397e-05f, - /* 24,13 */ +3.095924021e-05f, -7.976200316e-05f, -2.692234993e-04f, -2.488796810e-04f, +2.816211011e-04f, +1.126132932e-03f, +1.379888189e-03f, +2.539414214e-05f, -2.948401826e-03f, -5.980858542e-03f, -6.781564023e-03f, -4.145019341e-03f, +8.242352929e-04f, +5.319183002e-03f, +6.884726614e-03f, +5.169072824e-03f, +1.910998057e-03f, -6.530479478e-04f, -1.435015360e-03f, -8.718108917e-04f, -5.800387728e-05f, +3.009073041e-04f, +2.148033017e-04f, +2.992041863e-05f, - /* 24,14 */ +3.317859772e-05f, -6.884149383e-05f, -2.595470071e-04f, -2.633988510e-04f, +2.333982604e-04f, +1.078579553e-03f, +1.403322383e-03f, +1.653667139e-04f, -2.737690485e-03f, -5.834433801e-03f, -6.830374341e-03f, -4.401480442e-03f, +4.953359135e-04f, +5.106971374e-03f, +6.891993065e-03f, +5.346195092e-03f, +2.114193296e-03f, -5.422031866e-04f, -1.435932770e-03f, -9.254138922e-04f, -9.900949096e-05f, +2.944876029e-04f, +2.267040256e-04f, +3.887878147e-05f, - /* 24,15 */ +3.491105347e-05f, -5.836581816e-05f, -2.491702023e-04f, -2.758007186e-04f, +1.868092348e-04f, +1.029081461e-03f, +1.420326139e-03f, +2.982544427e-04f, -2.528057977e-03f, -5.679465803e-03f, -6.864975932e-03f, -4.647640808e-03f, +1.652445539e-04f, +4.882970050e-03f, +6.885468951e-03f, +5.516524807e-03f, +2.320049614e-03f, -4.239072727e-04f, -1.431118485e-03f, -9.779307384e-04f, -1.419765781e-04f, +2.861422699e-04f, +2.381906908e-04f, +4.836862817e-05f, - /* 24, 0 */ +1.364396009e-04f, +7.446376994e-05f, -3.699603221e-04f, -7.278325124e-04f, -5.051635567e-05f, +1.645033952e-03f, +2.378022613e-03f, -2.243714932e-04f, -5.680096534e-03f, -9.704626250e-03f, -7.823014841e-03f, -2.751390883e-04f, +7.480820734e-03f, +9.788905453e-03f, +6.030582333e-03f, +5.101196376e-04f, -2.328731157e-03f, -1.748114996e-03f, -3.640531891e-05f, +7.242350145e-04f, +4.042879967e-04f, -5.742334247e-05f, -1.414906982e-04f, -2.710774794e-05f, - /* 24, 1 */ +1.307026563e-04f, +8.975162518e-05f, -3.355241044e-04f, -7.270603554e-04f, -1.326866063e-04f, +1.538422151e-03f, +2.413247311e-03f, +4.875121157e-05f, -5.324161431e-03f, -9.595517291e-03f, -8.141086512e-03f, -8.245287223e-04f, +7.115425083e-03f, +9.847646625e-03f, +6.374200107e-03f, +8.077901021e-04f, -2.264974711e-03f, -1.846937004e-03f, -1.278166248e-04f, +7.160485626e-04f, +4.382702758e-04f, -3.863673145e-05f, -1.457592711e-04f, -3.374854096e-05f, - /* 24, 2 */ +1.243758393e-04f, +1.032931784e-04f, -3.012044148e-04f, -7.221532843e-04f, -2.098818030e-04f, +1.428995714e-03f, +2.434853697e-03f, +3.086181402e-04f, -4.964188024e-03f, -9.462372525e-03f, -8.434212217e-03f, -1.371256439e-03f, +6.727842835e-03f, +9.880231223e-03f, +6.709529590e-03f, +1.116608515e-03f, -2.186408722e-03f, -1.940762958e-03f, -2.234175210e-04f, +7.030713845e-04f, +4.716595396e-04f, -1.812362539e-05f, -1.491486840e-04f, -4.073257728e-05f, - /* 24, 3 */ +1.175537217e-04f, +1.151066589e-04f, -2.672136493e-04f, -7.133593846e-04f, -2.819161814e-04f, +1.317455363e-03f, +2.443336794e-03f, +5.546728855e-04f, -4.601573558e-03f, -9.306067159e-03f, -8.701668636e-03f, -1.913559980e-03f, +6.319179241e-03f, +9.886134123e-03f, +7.035155238e-03f, +1.435731166e-03f, -2.092745601e-03f, -2.028850662e-03f, -3.228698520e-04f, +6.851212972e-04f, +5.041985339e-04f, +4.082412249e-06f, -1.515631236e-04f, -4.801831197e-05f, - /* 24, 4 */ +1.103288160e-04f, +1.252215041e-04f, -2.337507561e-04f, -7.009379926e-04f, -3.486413414e-04f, +1.204483360e-03f, +2.439234434e-03f, +7.864337317e-04f, -4.237695644e-03f, -9.127552920e-03f, -8.942835031e-03f, -2.449695551e-03f, +5.890625670e-03f, +9.864926907e-03f, +7.349672574e-03f, +1.764247300e-03f, -1.983757790e-03f, -2.110456450e-03f, -4.257977068e-04f, +6.620377298e-04f, +5.356216172e-04f, +2.793344097e-05f, -1.529084143e-04f, -5.555842361e-05f, - /* 24, 5 */ +1.027909684e-04f, +1.336775649e-04f, -2.010005851e-04f, -6.851576168e-04f, -4.099455518e-04f, +1.090740633e-03f, +2.423123355e-03f, +1.003494037e-03f, -3.873906570e-03f, -8.927853008e-03f, -9.157195135e-03f, -2.977945083e-03f, +5.443455012e-03f, +9.816280735e-03f, +7.651694576e-03f, +2.101181791e-03f, -1.859280606e-03f, -2.184839011e-03f, -5.317880090e-04f, +6.336836952e-04f, +5.656561208e-04f, +5.336672075e-05f, -1.530928622e-04f, -6.329988035e-05f, - /* 24, 6 */ +9.502680145e-05f, +1.405242734e-04f, -1.691333585e-04f, -6.662938873e-04f, -4.657528710e-04f, +9.768641187e-04f, +2.395615219e-03f, +1.205522243e-03f, -3.511527821e-03f, -8.708056786e-03f, -9.344338564e-03f, -3.496623369e-03f, +4.979016698e-03f, +9.739968779e-03f, +7.939858067e-03f, +2.445498177e-03f, -1.719214825e-03f, -2.251263312e-03f, -6.403913399e-04f, +5.999476948e-04f, +5.940238143e-04f, +8.030437567e-05f, -1.520281231e-04f, -7.118405837e-05f, - /* 24, 7 */ +8.711921055e-05f, +1.458197836e-04f, -1.383042613e-04f, -6.446275435e-04f, -5.160220948e-04f, +8.634643034e-04f, +2.357352548e-03f, +1.392261511e-03f, -3.151844842e-03f, -8.469314215e-03f, -9.503961719e-03f, -4.004085039e-03f, +4.498731341e-03f, +9.635868210e-03f, +8.212830089e-03f, +2.796102059e-03f, -1.563529005e-03f, -2.309004616e-03f, -7.511229995e-04f, +5.607455425e-04f, +6.204424737e-04f, +1.086531499e-04f, -1.496300883e-04f, -7.914691395e-05f, - /* 24, 8 */ +7.914691395e-05f, +1.496300883e-04f, -1.086531499e-04f, -6.204424737e-04f, -5.607455425e-04f, +7.511229995e-04f, +2.309004616e-03f, +1.563529005e-03f, -2.796102059e-03f, -8.212830089e-03f, -9.635868210e-03f, -4.498731341e-03f, +4.004085039e-03f, +9.503961719e-03f, +8.469314215e-03f, +3.151844842e-03f, -1.392261511e-03f, -2.357352548e-03f, -8.634643034e-04f, +5.160220948e-04f, +6.446275435e-04f, +1.383042613e-04f, -1.458197836e-04f, -8.711921055e-05f, - /* 24, 9 */ +7.118405837e-05f, +1.520281231e-04f, -8.030437567e-05f, -5.940238143e-04f, -5.999476948e-04f, +6.403913399e-04f, +2.251263312e-03f, +1.719214825e-03f, -2.445498177e-03f, -7.939858067e-03f, -9.739968779e-03f, -4.979016698e-03f, +3.496623369e-03f, +9.344338564e-03f, +8.708056786e-03f, +3.511527821e-03f, -1.205522243e-03f, -2.395615219e-03f, -9.768641187e-04f, +4.657528710e-04f, +6.662938873e-04f, +1.691333585e-04f, -1.405242734e-04f, -9.502680145e-05f, - /* 24,10 */ +6.329988035e-05f, +1.530928622e-04f, -5.336672075e-05f, -5.656561208e-04f, -6.336836952e-04f, +5.317880090e-04f, +2.184839011e-03f, +1.859280606e-03f, -2.101181791e-03f, -7.651694576e-03f, -9.816280735e-03f, -5.443455012e-03f, +2.977945083e-03f, +9.157195135e-03f, +8.927853008e-03f, +3.873906570e-03f, -1.003494037e-03f, -2.423123355e-03f, -1.090740633e-03f, +4.099455518e-04f, +6.851576168e-04f, +2.010005851e-04f, -1.336775649e-04f, -1.027909684e-04f, - /* 24,11 */ +5.555842361e-05f, +1.529084143e-04f, -2.793344097e-05f, -5.356216172e-04f, -6.620377298e-04f, +4.257977068e-04f, +2.110456450e-03f, +1.983757790e-03f, -1.764247300e-03f, -7.349672574e-03f, -9.864926907e-03f, -5.890625670e-03f, +2.449695551e-03f, +8.942835031e-03f, +9.127552920e-03f, +4.237695644e-03f, -7.864337317e-04f, -2.439234434e-03f, -1.204483360e-03f, +3.486413414e-04f, +7.009379926e-04f, +2.337507561e-04f, -1.252215041e-04f, -1.103288160e-04f, - /* 24,12 */ +4.801831197e-05f, +1.515631236e-04f, -4.082412249e-06f, -5.041985339e-04f, -6.851212972e-04f, +3.228698520e-04f, +2.028850662e-03f, +2.092745601e-03f, -1.435731166e-03f, -7.035155238e-03f, -9.886134123e-03f, -6.319179241e-03f, +1.913559980e-03f, +8.701668636e-03f, +9.306067159e-03f, +4.601573558e-03f, -5.546728855e-04f, -2.443336794e-03f, -1.317455363e-03f, +2.819161814e-04f, +7.133593846e-04f, +2.672136493e-04f, -1.151066589e-04f, -1.175537217e-04f, - /* 24,13 */ +4.073257728e-05f, +1.491486840e-04f, +1.812362539e-05f, -4.716595396e-04f, -7.030713845e-04f, +2.234175210e-04f, +1.940762958e-03f, +2.186408722e-03f, -1.116608515e-03f, -6.709529590e-03f, -9.880231223e-03f, -6.727842835e-03f, +1.371256439e-03f, +8.434212217e-03f, +9.462372525e-03f, +4.964188024e-03f, -3.086181402e-04f, -2.434853697e-03f, -1.428995714e-03f, +2.098818030e-04f, +7.221532843e-04f, +3.012044148e-04f, -1.032931784e-04f, -1.243758393e-04f, - /* 24,14 */ +3.374854096e-05f, +1.457592711e-04f, +3.863673145e-05f, -4.382702758e-04f, -7.160485626e-04f, +1.278166248e-04f, +1.846937004e-03f, +2.264974711e-03f, -8.077901021e-04f, -6.374200107e-03f, -9.847646625e-03f, -7.115425083e-03f, +8.245287223e-04f, +8.141086512e-03f, +9.595517291e-03f, +5.324161431e-03f, -4.875121157e-05f, -2.413247311e-03f, -1.538422151e-03f, +1.326866063e-04f, +7.270603554e-04f, +3.355241044e-04f, -8.975162518e-05f, -1.307026563e-04f, - /* 24,15 */ +2.710774794e-05f, +1.414906982e-04f, +5.742334247e-05f, -4.042879967e-04f, -7.242350145e-04f, +3.640531891e-05f, +1.748114996e-03f, +2.328731157e-03f, -5.101196376e-04f, -6.030582333e-03f, -9.788905453e-03f, -7.480820734e-03f, +2.751390883e-04f, +7.823014841e-03f, +9.704626250e-03f, +5.680096534e-03f, +2.243714932e-04f, -2.378022613e-03f, -1.645033952e-03f, +5.051635567e-05f, +7.278325124e-04f, +3.699603221e-04f, -7.446376994e-05f, -1.364396009e-04f, - /* 20, 0 */ +1.366654441e-04f, -5.248309364e-04f, -9.559425272e-04f, +4.495080153e-04f, +2.846407623e-03f, +1.989454068e-03f, -4.491151594e-03f, -1.156100448e-02f, -1.065698581e-02f, -3.895768346e-04f, +1.023895907e-02f, +1.180960294e-02f, +5.007407400e-03f, -1.738511442e-03f, -2.938517986e-03f, -6.019203323e-04f, +9.329195550e-04f, +5.763302237e-04f, -1.134902041e-04f, -1.824770389e-04f, - /* 20, 1 */ +1.568890194e-04f, -4.728495798e-04f, -9.708996289e-04f, +3.024354413e-04f, +2.741035078e-03f, +2.215509786e-03f, -3.978754642e-03f, -1.127853170e-02f, -1.103432131e-02f, -1.167153605e-03f, +9.781544627e-03f, +1.202253469e-02f, +5.525210549e-03f, -1.462933465e-03f, -3.016077094e-03f, -7.588827792e-04f, +9.015285321e-04f, +6.268920900e-04f, -8.735502929e-05f, -1.921860197e-04f, - /* 20, 2 */ +1.741940978e-04f, -4.208194393e-04f, -9.781360984e-04f, +1.614183836e-04f, +2.623714429e-03f, +2.416571115e-03f, -3.472449249e-03f, -1.096411041e-02f, -1.136986548e-02f, -1.940007910e-03f, +9.286243980e-03f, +1.219815240e-02f, +6.042182027e-03f, -1.163118517e-03f, -3.077830056e-03f, -9.195341683e-04f, +8.615147935e-04f, +6.760417132e-04f, -5.827810709e-05f, -2.008073985e-04f, - /* 20, 3 */ +1.886370492e-04f, -3.691494362e-04f, -9.780356474e-04f, +2.709710175e-05f, +2.495775707e-03f, +2.592671089e-03f, -2.974378699e-03f, -1.061978749e-02f, -1.166272581e-02f, -2.705018824e-03f, +8.754750074e-03f, +1.233496472e-02f, +6.555887236e-03f, -8.396136973e-04f, -3.122565398e-03f, -1.082944596e-03f, +8.126754773e-04f, +7.232876858e-04f, -2.630548656e-05f, -2.081598890e-04f, - /* 20, 4 */ +2.002956356e-04f, -3.182221327e-04f, -9.710157868e-04f, -9.996474913e-05f, +2.358556029e-03f, +2.743978910e-03f, -2.486586970e-03f, -1.024771819e-02f, -1.191222039e-02f, -3.459106327e-03f, +8.188939591e-03f, +1.243164652e-02f, +7.063848473e-03f, -4.931158341e-04f, -3.149124311e-03f, -1.248118895e-03f, +7.548636055e-04f, +7.681251779e-04f, +8.487693398e-06f, -2.140618814e-04f, - /* 20, 5 */ +2.092671085e-04f, -2.683920446e-04f, -9.575231021e-04f, -2.192806382e-04f, +2.213390969e-03f, +2.870794883e-03f, -2.011009640e-03f, -9.850152742e-03f, -1.211787969e-02f, -4.199247312e-03f, +7.590864160e-03f, +1.248704815e-02f, +7.563557889e-03f, -1.244715801e-04f, -3.156409832e-03f, -1.414000676e-03f, +6.879919170e-04f, +8.100393630e-04f, +4.599617124e-05f, -2.183332212e-04f, - /* 20, 6 */ +2.156662323e-04f, -2.199842607e-04f, -9.380285157e-04f, -3.304411223e-04f, +2.061606212e-03f, +2.973544666e-03f, -1.549465619e-03f, -9.429422833e-03f, -1.227944713e-02f, -4.922491262e-03f, +6.962740532e-03f, +1.250020393e-02f, +8.052490864e-03f, +2.653234199e-04f, -3.143395899e-03f, -1.579476941e-03f, +6.120364145e-04f, +8.485090918e-04f, +8.608374363e-05f, -2.207970734e-04f, - /* 20, 7 */ +2.196232573e-04f, -1.732933680e-04f, -9.130225739e-04f, -4.331132727e-04f, +1.904509553e-03f, +3.052772891e-03f, -1.103649750e-03f, -8.987927630e-03f, -1.239687839e-02f, -5.625975475e-03f, +6.306939763e-03f, +1.247033951e-02f, +8.528119711e-03f, +6.751263085e-04f, -3.109136222e-03f, -1.743383273e-03f, +5.270395872e-04f, +8.830107920e-04f, +1.285826773e-04f, -2.212818602e-04f, - /* 20, 8 */ +2.212818602e-04f, -1.285826773e-04f, -8.830107920e-04f, -5.270395872e-04f, +1.743383273e-03f, +3.109136222e-03f, -6.751263085e-04f, -8.528119711e-03f, -1.247033951e-02f, -6.306939763e-03f, +5.625975475e-03f, +1.239687839e-02f, +8.987927630e-03f, +1.103649750e-03f, -3.052772891e-03f, -1.904509553e-03f, +4.331132727e-04f, +9.130225739e-04f, +1.732933680e-04f, -2.196232573e-04f, - /* 20, 9 */ +2.207970734e-04f, -8.608374363e-05f, -8.485090918e-04f, -6.120364145e-04f, +1.579476941e-03f, +3.143395899e-03f, -2.653234199e-04f, -8.052490864e-03f, -1.250020393e-02f, -6.962740532e-03f, +4.922491262e-03f, +1.227944713e-02f, +9.429422833e-03f, +1.549465619e-03f, -2.973544666e-03f, -2.061606212e-03f, +3.304411223e-04f, +9.380285157e-04f, +2.199842607e-04f, -2.156662323e-04f, - /* 20,10 */ +2.183332212e-04f, -4.599617124e-05f, -8.100393630e-04f, -6.879919170e-04f, +1.414000676e-03f, +3.156409832e-03f, +1.244715801e-04f, -7.563557889e-03f, -1.248704815e-02f, -7.590864160e-03f, +4.199247312e-03f, +1.211787969e-02f, +9.850152742e-03f, +2.011009640e-03f, -2.870794883e-03f, -2.213390969e-03f, +2.192806382e-04f, +9.575231021e-04f, +2.683920446e-04f, -2.092671085e-04f, - /* 20,11 */ +2.140618814e-04f, -8.487693398e-06f, -7.681251779e-04f, -7.548636055e-04f, +1.248118895e-03f, +3.149124311e-03f, +4.931158341e-04f, -7.063848473e-03f, -1.243164652e-02f, -8.188939591e-03f, +3.459106327e-03f, +1.191222039e-02f, +1.024771819e-02f, +2.486586970e-03f, -2.743978910e-03f, -2.358556029e-03f, +9.996474913e-05f, +9.710157868e-04f, +3.182221327e-04f, -2.002956356e-04f, - /* 20,12 */ +2.081598890e-04f, +2.630548656e-05f, -7.232876858e-04f, -8.126754773e-04f, +1.082944596e-03f, +3.122565398e-03f, +8.396136973e-04f, -6.555887236e-03f, -1.233496472e-02f, -8.754750074e-03f, +2.705018824e-03f, +1.166272581e-02f, +1.061978749e-02f, +2.974378699e-03f, -2.592671089e-03f, -2.495775707e-03f, -2.709710175e-05f, +9.780356474e-04f, +3.691494362e-04f, -1.886370492e-04f, - /* 20,13 */ +2.008073985e-04f, +5.827810709e-05f, -6.760417132e-04f, -8.615147935e-04f, +9.195341683e-04f, +3.077830056e-03f, +1.163118517e-03f, -6.042182027e-03f, -1.219815240e-02f, -9.286243980e-03f, +1.940007910e-03f, +1.136986548e-02f, +1.096411041e-02f, +3.472449249e-03f, -2.416571115e-03f, -2.623714429e-03f, -1.614183836e-04f, +9.781360984e-04f, +4.208194393e-04f, -1.741940978e-04f, - /* 20,14 */ +1.921860197e-04f, +8.735502929e-05f, -6.268920900e-04f, -9.015285321e-04f, +7.588827792e-04f, +3.016077094e-03f, +1.462933465e-03f, -5.525210549e-03f, -1.202253469e-02f, -9.781544627e-03f, +1.167153605e-03f, +1.103432131e-02f, +1.127853170e-02f, +3.978754642e-03f, -2.215509786e-03f, -2.741035078e-03f, -3.024354413e-04f, +9.708996289e-04f, +4.728495798e-04f, -1.568890194e-04f, - /* 20,15 */ +1.824770389e-04f, +1.134902041e-04f, -5.763302237e-04f, -9.329195550e-04f, +6.019203323e-04f, +2.938517986e-03f, +1.738511442e-03f, -5.007407400e-03f, -1.180960294e-02f, -1.023895907e-02f, +3.895768346e-04f, +1.065698581e-02f, +1.156100448e-02f, +4.491151594e-03f, -1.989454068e-03f, -2.846407623e-03f, -4.495080153e-04f, +9.559425272e-04f, +5.248309364e-04f, -1.366654441e-04f, - /* 20, 0 */ +2.228492143e-04f, +8.155042897e-05f, -9.008994790e-04f, -8.358434283e-04f, +2.057950411e-03f, +3.687980724e-03f, -2.439509438e-03f, -1.276984908e-02f, -1.372824692e-02f, -5.233437973e-04f, +1.325794606e-02f, +1.324423486e-02f, +3.079014715e-03f, -3.569583683e-03f, -2.275574997e-03f, +7.329307333e-04f, +9.595727172e-04f, -3.951670647e-05f, -2.357435643e-04f, +0.000000000e+00f, - /* 20, 1 */ +2.085936177e-04f, +1.192685572e-04f, -8.383784628e-04f, -9.252931617e-04f, +1.836793834e-03f, +3.772148819e-03f, -1.820843931e-03f, -1.225552529e-02f, -1.413563751e-02f, -1.567452511e-03f, +1.272631251e-02f, +1.367510758e-02f, +3.736377939e-03f, -3.415952420e-03f, -2.487640644e-03f, +6.166326985e-04f, +1.013551226e-03f, +6.721135679e-06f, -2.469830254e-04f, +3.513221827e-04f, - /* 20, 2 */ +1.932641301e-04f, +1.526114972e-04f, -7.728409668e-04f, -1.001322392e-03f, +1.614057279e-03f, +3.823286477e-03f, -1.225775962e-03f, -1.170500117e-02f, -1.447891891e-02f, -2.603840968e-03f, +1.213529571e-02f, +1.405908160e-02f, +4.408408028e-03f, -3.226289363e-03f, -2.692058620e-03f, +4.871526668e-04f, +1.061979909e-03f, +5.699759108e-05f, -2.562708188e-04f, -2.243392330e-05f, - /* 20, 3 */ +1.771389305e-04f, +1.815689683e-04f, -7.050956564e-04f, -1.064087220e-03f, +1.391605775e-03f, +3.842769943e-03f, -6.568264230e-04f, -1.112214974e-02f, -1.475727496e-02f, -3.627416831e-03f, +1.148720750e-02f, +1.439298630e-02f, +5.091721334e-03f, -3.000017933e-03f, -2.886692602e-03f, +3.448244648e-04f, +1.104003505e-03f, +1.110914327e-04f, -2.633104157e-04f, -3.471505729e-05f, - /* 20, 4 */ +1.604844080e-04f, +2.061770649e-04f, -6.359221544e-04f, -1.113850250e-03f, +1.171206475e-03f, +3.832136817e-03f, -1.162685315e-04f, -1.051095143e-02f, -1.497027375e-02f, -4.633169088e-03f, +1.078471010e-02f, +1.467389068e-02f, +5.782760145e-03f, -2.736794515e-03f, -3.069373786e-03f, +1.901162062e-04f, +1.138774993e-03f, +1.687245284e-04f, -2.678091338e-04f, -4.805250238e-05f, - /* 20, 5 */ +1.435528424e-04f, +2.265149998e-04f, -5.660652366e-04f, -1.150972836e-03f, +9.545189950e-04f, +3.793068954e-03f, +3.938808876e-04f, -9.875465824e-03f, -1.511786634e-02f, -5.616199746e-03f, +1.003080152e-02f, +1.489912656e-02f, +6.477812874e-03f, -2.436518983e-03f, -3.237916857e-03f, +2.363306300e-05f, +1.165464351e-03f, +2.295611999e-04f, -2.694819135e-04f, -6.235351094e-05f, - /* 20, 6 */ +1.265803873e-04f, +2.427015763e-04f, -4.962296614e-04f, -1.175906803e-03f, +7.430870045e-04f, +3.727374795e-03f, +8.718680321e-04f, -9.219803451e-03f, -1.520038286e-02f, -6.571754682e-03f, +9.228798617e-03f, +1.506631023e-02f, +7.173035830e-03f, -2.099343642e-03f, -3.390136682e-03f, -1.538810619e-04f, +1.183267602e-03f, +2.932081598e-04f, -2.680552395e-04f, -7.750368078e-05f, - /* 20, 7 */ +1.097853637e-04f, +2.548914413e-04f, -4.270756535e-04f, -1.189185758e-03f, +5.383311068e-04f, +3.636971298e-03f, +1.316206650e-03f, -8.548097577e-03f, -1.521852609e-02f, -7.495253444e-03f, +8.382317770e-03f, +1.517336238e-02f, +7.864476409e-03f, -1.725680482e-03f, -3.523865616e-03f, -3.415430197e-04f, +1.191416067e-03f, +3.592150564e-04f, -2.632711715e-04f, -9.336686615e-05f, - /* 20, 8 */ +9.336686615e-05f, +2.632711715e-04f, -3.592150564e-04f, -1.191416067e-03f, +3.415430197e-04f, +3.523865616e-03f, +1.725680482e-03f, -7.864476409e-03f, -1.517336238e-02f, -8.382317770e-03f, +7.495253444e-03f, +1.521852609e-02f, +8.548097577e-03f, -1.316206650e-03f, -3.636971298e-03f, -5.383311068e-04f, +1.189185758e-03f, +4.270756535e-04f, -2.548914413e-04f, -1.097853637e-04f, - /* 20, 9 */ +7.750368078e-05f, +2.680552395e-04f, -2.932081598e-04f, -1.183267602e-03f, +1.538810619e-04f, +3.390136682e-03f, +2.099343642e-03f, -7.173035830e-03f, -1.506631023e-02f, -9.228798617e-03f, +6.571754682e-03f, +1.520038286e-02f, +9.219803451e-03f, -8.718680321e-04f, -3.727374795e-03f, -7.430870045e-04f, +1.175906803e-03f, +4.962296614e-04f, -2.427015763e-04f, -1.265803873e-04f, - /* 20,10 */ +6.235351094e-05f, +2.694819135e-04f, -2.295611999e-04f, -1.165464351e-03f, -2.363306300e-05f, +3.237916857e-03f, +2.436518983e-03f, -6.477812874e-03f, -1.489912656e-02f, -1.003080152e-02f, +5.616199746e-03f, +1.511786634e-02f, +9.875465824e-03f, -3.938808876e-04f, -3.793068954e-03f, -9.545189950e-04f, +1.150972836e-03f, +5.660652366e-04f, -2.265149998e-04f, -1.435528424e-04f, - /* 20,11 */ +4.805250238e-05f, +2.678091338e-04f, -1.687245284e-04f, -1.138774993e-03f, -1.901162062e-04f, +3.069373786e-03f, +2.736794515e-03f, -5.782760145e-03f, -1.467389068e-02f, -1.078471010e-02f, +4.633169088e-03f, +1.497027375e-02f, +1.051095143e-02f, +1.162685315e-04f, -3.832136817e-03f, -1.171206475e-03f, +1.113850250e-03f, +6.359221544e-04f, -2.061770649e-04f, -1.604844080e-04f, - /* 20,12 */ +3.471505729e-05f, +2.633104157e-04f, -1.110914327e-04f, -1.104003505e-03f, -3.448244648e-04f, +2.886692602e-03f, +3.000017933e-03f, -5.091721334e-03f, -1.439298630e-02f, -1.148720750e-02f, +3.627416831e-03f, +1.475727496e-02f, +1.112214974e-02f, +6.568264230e-04f, -3.842769943e-03f, -1.391605775e-03f, +1.064087220e-03f, +7.050956564e-04f, -1.815689683e-04f, -1.771389305e-04f, - /* 20,13 */ +2.243392330e-05f, +2.562708188e-04f, -5.699759108e-05f, -1.061979909e-03f, -4.871526668e-04f, +2.692058620e-03f, +3.226289363e-03f, -4.408408028e-03f, -1.405908160e-02f, -1.213529571e-02f, +2.603840968e-03f, +1.447891891e-02f, +1.170500117e-02f, +1.225775962e-03f, -3.823286477e-03f, -1.614057279e-03f, +1.001322392e-03f, +7.728409668e-04f, -1.526114972e-04f, -1.932641301e-04f, - /* 20,14 */ -3.513221827e-04f, +2.469830254e-04f, -6.721135679e-06f, -1.013551226e-03f, -6.166326985e-04f, +2.487640644e-03f, +3.415952420e-03f, -3.736377939e-03f, -1.367510758e-02f, -1.272631251e-02f, +1.567452511e-03f, +1.413563751e-02f, +1.225552529e-02f, +1.820843931e-03f, -3.772148819e-03f, -1.836793834e-03f, +9.252931617e-04f, +8.383784628e-04f, -1.192685572e-04f, -2.085936177e-04f, - /* 20,15 */ +0.000000000e+00f, +2.357435643e-04f, +3.951670647e-05f, -9.595727172e-04f, -7.329307333e-04f, +2.275574997e-03f, +3.569583683e-03f, -3.079014715e-03f, -1.324423486e-02f, -1.325794606e-02f, +5.233437973e-04f, +1.372824692e-02f, +1.276984908e-02f, +2.439509438e-03f, -3.687980724e-03f, -2.057950411e-03f, +8.358434283e-04f, +9.008994790e-04f, -8.155042897e-05f, -2.228492143e-04f, - /* 20, 0 */ +1.941987182e-05f, +3.146481294e-04f, -2.345645569e-04f, -1.414667200e-03f, +5.144442975e-04f, +4.454307224e-03f, +1.983750799e-04f, -1.327145644e-02f, -1.714303646e-02f, -6.846700315e-04f, +1.665178821e-02f, +1.403392762e-02f, +4.892879248e-04f, -4.540173148e-03f, -7.773192529e-04f, +1.425286503e-03f, +3.160682424e-04f, -3.205185770e-04f, -3.476344875e-05f, +0.000000000e+00f, - /* 20, 1 */ -3.929324583e-04f, +3.051602666e-04f, -1.573970191e-04f, -1.390281543e-03f, +2.638941923e-04f, +4.333213577e-03f, +8.411158857e-04f, -1.246868983e-02f, -1.754185168e-02f, -2.049974665e-03f, +1.606968443e-02f, +1.474987505e-02f, +1.218921159e-03f, -4.587812221e-03f, -1.050600845e-03f, +1.421006956e-03f, +4.012475422e-04f, -3.223256966e-04f, -5.166761157e-05f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, +2.925136688e-04f, -8.512788201e-05f, -1.353337804e-03f, +2.735561011e-05f, +4.180044295e-03f, +1.436437300e-03f, -1.163198941e-02f, -1.784731333e-02f, -3.403203680e-03f, +1.539895444e-02f, +1.541325656e-02f, +1.987128326e-03f, -4.594412557e-03f, -1.332146559e-03f, +1.400789491e-03f, +4.893452569e-04f, -3.196436833e-04f, -7.000071077e-05f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, +2.771727451e-04f, -1.822077520e-05f, -1.305102482e-03f, -1.937209193e-04f, +3.998069961e-03f, +1.982303068e-03f, -1.076779718e-02f, -1.805915757e-02f, -4.736408619e-03f, +1.464246859e-02f, +1.601826823e-02f, +2.790083541e-03f, -4.557383277e-03f, -1.619599483e-03f, +1.363706016e-03f, +5.795104543e-04f, -3.120743969e-04f, -8.959420873e-05f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, +2.596009711e-04f, +4.295843246e-05f, -1.246883037e-03f, -3.981230344e-04f, +3.790645354e-03f, +2.477139789e-03f, -9.882582946e-03f, -1.817777152e-02f, -6.041793017e-03f, +1.380372215e-02f, +1.655939544e-02f, +3.623550339e-03f, -4.474387395e-03f, -1.910400883e-03f, +1.308956662e-03f, +6.708027600e-04f, -2.992550459e-04f, -1.102423612e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, +2.402546692e-04f, +9.813963752e-05f, -1.180011107e-03f, -5.848760724e-04f, +3.561175652e-03f, +2.919834686e-03f, -8.982792490e-03f, -1.820418220e-02f, -7.311771311e-03f, +1.288681385e-02f, +1.703146227e-02f, +4.482904855e-03f, -4.343373467e-03f, -2.201805423e-03f, +1.235886510e-03f, +7.621980241e-04f, -2.808658988e-04f, -1.317024534e-04f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, +2.195772899e-04f, +1.471454599e-04f, -1.105826337e-03f, -7.532402115e-04f, +3.313083439e-03f, +3.309729355e-03f, -8.074797022e-03f, -1.814004021e-02f, -8.539025902e-03f, +1.189641917e-02f, +1.742967891e-02f, +5.363163073e-03f, -4.162605659e-03f, -2.490898970e-03f, +1.144001586e-03f, +8.525953702e-04f, -2.566379213e-04f, -1.536956226e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, +1.979942392e-04f, +1.898872476e-04f, -1.025661016e-03f, -9.027053553e-04f, +3.049776817e-03f, +3.646609643e-03f, -7.164844319e-03f, -1.798759853e-02f, -9.716561844e-03f, +1.083775871e-02f, +1.774968640e-02f, +6.259011965e-03f, -3.930691879e-03f, -2.774618906e-03f, +1.032983905e-03f, +9.408256132e-04f, -2.263602294e-04f, -1.759082929e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, +1.759082929e-04f, +2.263602294e-04f, -9.408256132e-04f, -1.032983905e-03f, +2.774618906e-03f, +3.930691879e-03f, -6.259011965e-03f, -1.774968640e-02f, -1.083775871e-02f, +9.716561844e-03f, +1.798759853e-02f, +7.164844319e-03f, -3.646609643e-03f, -3.049776817e-03f, +9.027053553e-04f, +1.025661016e-03f, -1.898872476e-04f, -1.979942392e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, +1.536956226e-04f, +2.566379213e-04f, -8.525953702e-04f, -1.144001586e-03f, +2.490898970e-03f, +4.162605659e-03f, -5.363163073e-03f, -1.742967891e-02f, -1.189641917e-02f, +8.539025902e-03f, +1.814004021e-02f, +8.074797022e-03f, -3.309729355e-03f, -3.313083439e-03f, +7.532402115e-04f, +1.105826337e-03f, -1.471454599e-04f, -2.195772899e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, +1.317024534e-04f, +2.808658988e-04f, -7.621980241e-04f, -1.235886510e-03f, +2.201805423e-03f, +4.343373467e-03f, -4.482904855e-03f, -1.703146227e-02f, -1.288681385e-02f, +7.311771311e-03f, +1.820418220e-02f, +8.982792490e-03f, -2.919834686e-03f, -3.561175652e-03f, +5.848760724e-04f, +1.180011107e-03f, -9.813963752e-05f, -2.402546692e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, +1.102423612e-04f, +2.992550459e-04f, -6.708027600e-04f, -1.308956662e-03f, +1.910400883e-03f, +4.474387395e-03f, -3.623550339e-03f, -1.655939544e-02f, -1.380372215e-02f, +6.041793017e-03f, +1.817777152e-02f, +9.882582946e-03f, -2.477139789e-03f, -3.790645354e-03f, +3.981230344e-04f, +1.246883037e-03f, -4.295843246e-05f, -2.596009711e-04f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, +8.959420873e-05f, +3.120743969e-04f, -5.795104543e-04f, -1.363706016e-03f, +1.619599483e-03f, +4.557383277e-03f, -2.790083541e-03f, -1.601826823e-02f, -1.464246859e-02f, +4.736408619e-03f, +1.805915757e-02f, +1.076779718e-02f, -1.982303068e-03f, -3.998069961e-03f, +1.937209193e-04f, +1.305102482e-03f, +1.822077520e-05f, -2.771727451e-04f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, +7.000071077e-05f, +3.196436833e-04f, -4.893452569e-04f, -1.400789491e-03f, +1.332146559e-03f, +4.594412557e-03f, -1.987128326e-03f, -1.541325656e-02f, -1.539895444e-02f, +3.403203680e-03f, +1.784731333e-02f, +1.163198941e-02f, -1.436437300e-03f, -4.180044295e-03f, -2.735561011e-05f, +1.353337804e-03f, +8.512788201e-05f, -2.925136688e-04f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, +5.166761157e-05f, +3.223256966e-04f, -4.012475422e-04f, -1.421006956e-03f, +1.050600845e-03f, +4.587812221e-03f, -1.218921159e-03f, -1.474987505e-02f, -1.606968443e-02f, +2.049974665e-03f, +1.754185168e-02f, +1.246868983e-02f, -8.411158857e-04f, -4.333213577e-03f, -2.638941923e-04f, +1.390281543e-03f, +1.573970191e-04f, -3.051602666e-04f, +3.929324583e-04f, - /* 20,15 */ +0.000000000e+00f, +3.476344875e-05f, +3.205185770e-04f, -3.160682424e-04f, -1.425286503e-03f, +7.773192529e-04f, +4.540173148e-03f, -4.892879248e-04f, -1.403392762e-02f, -1.665178821e-02f, +6.846700315e-04f, +1.714303646e-02f, +1.327145644e-02f, -1.983750799e-04f, -4.454307224e-03f, -5.144442975e-04f, +1.414667200e-03f, +2.345645569e-04f, -3.146481294e-04f, -1.941987182e-05f, - /* 16, 0 */ +3.215659774e-04f, -1.081239301e-03f, -1.047044785e-03f, +4.045780572e-03f, +3.005074105e-03f, -1.291342297e-02f, -2.083886340e-02f, -8.761305366e-04f, +2.037274022e-02f, +1.401097590e-02f, -2.379335663e-03f, -4.351475252e-03f, +8.522542940e-04f, +1.190910327e-03f, -2.874725537e-04f, -1.571395541e-04f, - /* 16, 1 */ +3.474336395e-04f, -9.673171402e-04f, -1.215210440e-03f, +3.716713245e-03f, +3.558195313e-03f, -1.178473019e-02f, -2.117503726e-02f, -2.622305580e-03f, +1.977768827e-02f, +1.506763496e-02f, -1.682580557e-03f, -4.628640452e-03f, +6.313208395e-04f, +1.294421768e-03f, -2.448738999e-04f, -1.853334990e-04f, - /* 16, 2 */ +3.654544998e-04f, -8.509694882e-04f, -1.356620316e-03f, +3.369379821e-03f, +4.037840451e-03f, -1.063463040e-02f, -2.138131359e-02f, -4.350277043e-03f, +1.905580462e-02f, +1.607371744e-02f, -9.171630004e-04f, -4.872124601e-03f, +3.850930357e-04f, +1.389803701e-03f, -1.936024914e-04f, -2.137577131e-04f, - /* 16, 3 */ +3.760939096e-04f, -7.339202470e-04f, -1.471475134e-03f, +3.008783957e-03f, +4.443873126e-03f, -9.472744965e-03f, -2.145880202e-02f, -6.048090342e-03f, +1.821025632e-02f, +1.701970579e-02f, -8.619500088e-05f, -5.076839304e-03f, +1.147982409e-04f, +1.475048300e-03f, -1.336143134e-04f, -2.418805517e-04f, - /* 16, 4 */ +3.798900997e-04f, -6.177751723e-04f, -1.560284979e-03f, +2.639777229e-03f, +4.776853126e-03f, -8.308496634e-03f, -2.140964525e-02f, -7.704060609e-03f, +1.724526338e-02f, +1.789634168e-02f, +8.064574864e-04f, -5.237819035e-03f, -1.779495980e-04f, +1.548135431e-03f, -6.499930382e-05f, -2.691226085e-04f, - /* 16, 5 */ +3.774404835e-04f, -5.040080805e-04f, -1.623844377e-03f, +2.267013831e-03f, +5.038003695e-03f, -7.151026424e-03f, -2.123698452e-02f, -9.306876654e-03f, +1.616607109e-02f, +1.869471933e-02f, +1.756186609e-03f, -5.350281937e-03f, -4.911465534e-04f, +1.607060019e-03f, +1.200956190e-05f, -2.948629835e-04f, - /* 16, 6 */ +3.693879948e-04f, -3.939497146e-04f, -1.663205192e-03f, +1.894909522e-03f, +5.229172900e-03f, -6.009115326e-03f, -2.094491570e-02f, -1.084570103e-02f, +1.497891218e-02f, +1.940637710e-02f, +2.757662946e-03f, -5.409691072e-03f, -8.224000281e-04f, +1.649860923e-03f, +9.702877105e-05f, -3.184467584e-04f, - /* 16, 7 */ +3.564076658e-04f, -2.887792732e-04f, -1.679647798e-03f, +1.527605146e-03f, +5.352789702e-03f, -4.891111570e-03f, -2.053843663e-02f, -1.231026521e-02f, +1.369095882e-02f, +2.002338639e-02f, +3.804864118e-03f, -5.411815390e-03f, -1.168934972e-03f, +1.674650966e-03f, +1.895185724e-04f, -3.391936346e-04f, - /* 16, 8 */ +3.391936346e-04f, -1.895185724e-04f, -1.674650966e-03f, +1.168934972e-03f, +5.411815390e-03f, -3.804864118e-03f, -2.002338639e-02f, -1.369095882e-02f, +1.231026521e-02f, +2.053843663e-02f, +4.891111570e-03f, -5.352789702e-03f, -1.527605146e-03f, +1.679647798e-03f, +2.887792732e-04f, -3.564076658e-04f, - /* 16, 9 */ +3.184467584e-04f, -9.702877105e-05f, -1.649860923e-03f, +8.224000281e-04f, +5.409691072e-03f, -2.757662946e-03f, -1.940637710e-02f, -1.497891218e-02f, +1.084570103e-02f, +2.094491570e-02f, +6.009115326e-03f, -5.229172900e-03f, -1.894909522e-03f, +1.663205192e-03f, +3.939497146e-04f, -3.693879948e-04f, - /* 16,10 */ +2.948629835e-04f, -1.200956190e-05f, -1.607060019e-03f, +4.911465534e-04f, +5.350281937e-03f, -1.756186609e-03f, -1.869471933e-02f, -1.616607109e-02f, +9.306876654e-03f, +2.123698452e-02f, +7.151026424e-03f, -5.038003695e-03f, -2.267013831e-03f, +1.623844377e-03f, +5.040080805e-04f, -3.774404835e-04f, - /* 16,11 */ +2.691226085e-04f, +6.499930382e-05f, -1.548135431e-03f, +1.779495980e-04f, +5.237819035e-03f, -8.064574864e-04f, -1.789634168e-02f, -1.724526338e-02f, +7.704060609e-03f, +2.140964525e-02f, +8.308496634e-03f, -4.776853126e-03f, -2.639777229e-03f, +1.560284979e-03f, +6.177751723e-04f, -3.798900997e-04f, - /* 16,12 */ +2.418805517e-04f, +1.336143134e-04f, -1.475048300e-03f, -1.147982409e-04f, +5.076839304e-03f, +8.619500088e-05f, -1.701970579e-02f, -1.821025632e-02f, +6.048090342e-03f, +2.145880202e-02f, +9.472744965e-03f, -4.443873126e-03f, -3.008783957e-03f, +1.471475134e-03f, +7.339202470e-04f, -3.760939096e-04f, - /* 16,13 */ +2.137577131e-04f, +1.936024914e-04f, -1.389803701e-03f, -3.850930357e-04f, +4.872124601e-03f, +9.171630004e-04f, -1.607371744e-02f, -1.905580462e-02f, +4.350277043e-03f, +2.138131359e-02f, +1.063463040e-02f, -4.037840451e-03f, -3.369379821e-03f, +1.356620316e-03f, +8.509694882e-04f, -3.654544998e-04f, - /* 16,14 */ +1.853334990e-04f, +2.448738999e-04f, -1.294421768e-03f, -6.313208395e-04f, +4.628640452e-03f, +1.682580557e-03f, -1.506763496e-02f, -1.977768827e-02f, +2.622305580e-03f, +2.117503726e-02f, +1.178473019e-02f, -3.558195313e-03f, -3.716713245e-03f, +1.215210440e-03f, +9.673171402e-04f, -3.474336395e-04f, - /* 16,15 */ +1.571395541e-04f, +2.874725537e-04f, -1.190910327e-03f, -8.522542940e-04f, +4.351475252e-03f, +2.379335663e-03f, -1.401097590e-02f, -2.037274022e-02f, +8.761305366e-04f, +2.083886340e-02f, +1.291342297e-02f, -3.005074105e-03f, -4.045780572e-03f, +1.047044785e-03f, +1.081239301e-03f, -3.215659774e-04f, - /* 16, 0 */ +3.737698842e-04f, -2.640449894e-04f, -1.945694549e-03f, +2.599440145e-03f, +5.499552783e-03f, -1.161604587e-02f, -2.473725459e-02f, -1.100298137e-03f, +2.435797715e-02f, +1.306966182e-02f, -5.062036618e-03f, -3.067638325e-03f, +1.905476637e-03f, +3.919780470e-04f, -3.991665042e-04f, +0.000000000e+00f, - /* 16, 1 */ +3.444161169e-04f, -1.448617079e-04f, -1.955541719e-03f, +2.132654952e-03f, +5.839402648e-03f, -1.015371093e-02f, -2.494083956e-02f, -3.291998323e-03f, +2.380252288e-02f, +1.450063212e-02f, -4.525267650e-03f, -3.530814272e-03f, +1.832921116e-03f, +5.273022833e-04f, -4.195866486e-04f, +0.000000000e+00f, - /* 16, 2 */ +3.121018536e-04f, -3.553225965e-05f, -1.937280777e-03f, +1.673279684e-03f, +6.084169165e-03f, -8.696195593e-03f, -2.497087446e-02f, -5.457102987e-03f, +2.307209479e-02f, +1.589478690e-02f, -3.888719495e-03f, -3.982156136e-03f, +1.726408630e-03f, +6.684076945e-04f, -4.340068349e-04f, +0.000000000e+00f, - /* 16, 3 */ +2.777843660e-04f, +6.309259068e-05f, -1.893417136e-03f, +1.226820211e-03f, +6.237358144e-03f, -7.256513778e-03f, -2.483111182e-02f, -7.578189778e-03f, +2.216959356e-02f, +1.723786448e-02f, -3.152978451e-03f, -4.414545490e-03f, +1.584716951e-03f, +8.134406195e-04f, -4.414195390e-04f, +4.634120047e-04f, - /* 16, 4 */ +2.423668462e-04f, +1.504100330e-04f, -1.826645633e-03f, +7.982477790e-04f, +6.303316031e-03f, -5.847027899e-03f, -2.452684878e-02f, -9.638294429e-03f, +2.109960841e-02f, +1.851566754e-02f, -2.319783877e-03f, -4.820635148e-03f, +1.407067591e-03f, +9.603162700e-04f, -4.408546251e-04f, -2.338334874e-05f, - /* 16, 5 */ +2.066858426e-04f, +2.260561294e-04f, -1.739797615e-03f, +3.919648528e-04f, +6.287140435e-03f, -4.479333074e-03f, -2.406484480e-02f, -1.162108621e-02f, +1.986838848e-02f, +1.971422226e-02f, -1.392055451e-03f, -5.192933984e-03f, +1.193168502e-03f, +1.106736135e-03f, -4.314017719e-04f, -4.782938304e-05f, - /* 16, 6 */ +1.715009195e-04f, +2.898933732e-04f, -1.635789255e-03f, +1.178042715e-05f, +6.194584811e-03f, -3.164153635e-03f, -2.345322399e-02f, -1.351103572e-02f, +1.848379497e-02f, +2.081993840e-02f, -3.739065234e-04f, -5.523897843e-03f, +9.432519997e-04f, +1.250210274e-03f, -4.122335402e-04f, -7.520965874e-05f, - /* 16, 7 */ +1.374865801e-04f, +3.419953130e-04f, -1.517571800e-03f, -3.391052954e-04f, +6.031958779e-03f, -1.911252903e-03f, -2.270136331e-02f, -1.529357304e-02f, +1.695523429e-02f, +2.181976838e-02f, +7.293570292e-04f, -5.806025538e-03f, +6.581070752e-04f, +1.388084428e-03f, -3.826286881e-04f, -1.052264476e-04f, - /* 16, 8 */ +1.052264476e-04f, +3.826286881e-04f, -1.388084428e-03f, -6.581070752e-04f, +5.806025538e-03f, -7.293570292e-04f, -2.181976838e-02f, -1.695523429e-02f, +1.529357304e-02f, +2.270136331e-02f, +1.911252903e-03f, -6.031958779e-03f, +3.391052954e-04f, +1.517571800e-03f, -3.419953130e-04f, -1.374865801e-04f, - /* 16, 9 */ +7.520965874e-05f, +4.122335402e-04f, -1.250210274e-03f, -9.432519997e-04f, +5.523897843e-03f, +3.739065234e-04f, -2.081993840e-02f, -1.848379497e-02f, +1.351103572e-02f, +2.345322399e-02f, +3.164153635e-03f, -6.194584811e-03f, -1.178042715e-05f, +1.635789255e-03f, -2.898933732e-04f, -1.715009195e-04f, - /* 16,10 */ +4.782938304e-05f, +4.314017719e-04f, -1.106736135e-03f, -1.193168502e-03f, +5.192933984e-03f, +1.392055451e-03f, -1.971422226e-02f, -1.986838848e-02f, +1.162108621e-02f, +2.406484480e-02f, +4.479333074e-03f, -6.287140435e-03f, -3.919648528e-04f, +1.739797615e-03f, -2.260561294e-04f, -2.066858426e-04f, - /* 16,11 */ +2.338334874e-05f, +4.408546251e-04f, -9.603162700e-04f, -1.407067591e-03f, +4.820635148e-03f, +2.319783877e-03f, -1.851566754e-02f, -2.109960841e-02f, +9.638294429e-03f, +2.452684878e-02f, +5.847027899e-03f, -6.303316031e-03f, -7.982477790e-04f, +1.826645633e-03f, -1.504100330e-04f, -2.423668462e-04f, - /* 16,12 */ -4.634120047e-04f, +4.414195390e-04f, -8.134406195e-04f, -1.584716951e-03f, +4.414545490e-03f, +3.152978451e-03f, -1.723786448e-02f, -2.216959356e-02f, +7.578189778e-03f, +2.483111182e-02f, +7.256513778e-03f, -6.237358144e-03f, -1.226820211e-03f, +1.893417136e-03f, -6.309259068e-05f, -2.777843660e-04f, - /* 16,13 */ +0.000000000e+00f, +4.340068349e-04f, -6.684076945e-04f, -1.726408630e-03f, +3.982156136e-03f, +3.888719495e-03f, -1.589478690e-02f, -2.307209479e-02f, +5.457102987e-03f, +2.497087446e-02f, +8.696195593e-03f, -6.084169165e-03f, -1.673279684e-03f, +1.937280777e-03f, +3.553225965e-05f, -3.121018536e-04f, - /* 16,14 */ +0.000000000e+00f, +4.195866486e-04f, -5.273022833e-04f, -1.832921116e-03f, +3.530814272e-03f, +4.525267650e-03f, -1.450063212e-02f, -2.380252288e-02f, +3.291998323e-03f, +2.494083956e-02f, +1.015371093e-02f, -5.839402648e-03f, -2.132654952e-03f, +1.955541719e-03f, +1.448617079e-04f, -3.444161169e-04f, - /* 16,15 */ +0.000000000e+00f, +3.991665042e-04f, -3.919780470e-04f, -1.905476637e-03f, +3.067638325e-03f, +5.062036618e-03f, -1.306966182e-02f, -2.435797715e-02f, +1.100298137e-03f, +2.473725459e-02f, +1.161604587e-02f, -5.499552783e-03f, -2.599440145e-03f, +1.945694549e-03f, +2.640449894e-04f, -3.737698842e-04f, - /* 16, 0 */ +1.129954761e-04f, +3.969443331e-04f, -1.897918409e-03f, +5.803605804e-04f, +7.236474393e-03f, -9.385964725e-03f, -2.874576735e-02f, -1.359743295e-03f, +2.853093461e-02f, +1.118139232e-02f, -7.102956997e-03f, -1.091735034e-03f, +2.023521864e-03f, -3.328791130e-04f, -1.523656204e-04f, +0.000000000e+00f, - /* 16, 1 */ +7.672972562e-05f, +4.458313625e-04f, -1.753034729e-03f, +1.022461377e-04f, +7.257902118e-03f, -7.620475041e-03f, -2.873131200e-02f, -4.066570788e-03f, +2.808336987e-02f, +1.298853535e-02f, -6.850603202e-03f, -1.630677017e-03f, +2.125649126e-03f, -2.532507071e-04f, -1.941703587e-04f, +0.000000000e+00f, - /* 16, 2 */ +4.409159553e-05f, +4.801879450e-04f, -1.593056257e-03f, -3.378401438e-04f, +7.175055211e-03f, -5.902082228e-03f, -2.849345261e-02f, -6.735572940e-03f, +2.740215275e-02f, +1.478830973e-02f, -6.473886365e-03f, -2.190599691e-03f, +2.200171639e-03f, -1.579695096e-04f, -2.375950982e-04f, +0.000000000e+00f, - /* 16, 3 */ -4.855802427e-04f, +5.008892512e-04f, -1.422085430e-03f, -7.360682089e-04f, +6.996656391e-03f, -4.246700138e-03f, -2.804039906e-02f, -9.342037235e-03f, +2.648893755e-02f, +1.656098957e-02f, -5.968640123e-03f, -2.764068406e-03f, +2.243110553e-03f, -4.727037370e-05f, -2.816859426e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, +5.090007623e-04f, -1.244075649e-03f, -1.089544232e-03f, +6.732169339e-03f, -2.668838337e-03f, -2.738254409e-02f, -1.186200034e-02f, +2.534797081e-02f, +1.828644204e-02f, -5.332184360e-03f, -3.342863857e-03f, +2.250722132e-03f, +7.826276448e-05f, -3.253590588e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, +5.057402285e-04f, -1.062772468e-03f, -1.396293958e-03f, +6.391628670e-03f, -1.181467029e-03f, -2.653229393e-02f, -1.427253312e-02f, +2.398607480e-02f, +1.994437434e-02f, -4.563434465e-03f, -3.918061651e-03f, +2.219584858e-03f, +2.176775461e-04f, -3.674140144e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, +4.924395299e-04f, -8.816626027e-04f, -1.655232286e-03f, +5.985469320e-03f, +2.040926394e-04f, -2.550387540e-02f, -1.655201127e-02f, +2.241259678e-02f, +2.151458926e-02f, -3.662991573e-03f, -4.480127768e-03f, +2.146686747e-03f, +3.696399185e-04f, -4.065510896e-04f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, +4.705072223e-04f, -7.039312026e-04f, -1.866120323e-03f, +5.524357980e-03f, +1.478252020e-03f, -2.431312252e-02f, -1.868036788e-02f, +2.063932435e-02f, +2.297724601e-02f, -2.633211707e-03f, -5.019029099e-03f, +2.029511283e-03f, +5.324276437e-04f, -4.413924818e-04f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, +4.413924818e-04f, -5.324276437e-04f, -2.029511283e-03f, +5.019029099e-03f, +2.633211707e-03f, -2.297724601e-02f, -2.063932435e-02f, +1.868036788e-02f, +2.431312252e-02f, -1.478252020e-03f, -5.524357980e-03f, +1.866120323e-03f, +7.039312026e-04f, -4.705072223e-04f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, +4.065510896e-04f, -3.696399185e-04f, -2.146686747e-03f, +4.480127768e-03f, +3.662991573e-03f, -2.151458926e-02f, -2.241259678e-02f, +1.655201127e-02f, +2.550387540e-02f, -2.040926394e-04f, -5.985469320e-03f, +1.655232286e-03f, +8.816626027e-04f, -4.924395299e-04f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, +3.674140144e-04f, -2.176775461e-04f, -2.219584858e-03f, +3.918061651e-03f, +4.563434465e-03f, -1.994437434e-02f, -2.398607480e-02f, +1.427253312e-02f, +2.653229393e-02f, +1.181467029e-03f, -6.391628670e-03f, +1.396293958e-03f, +1.062772468e-03f, -5.057402285e-04f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, +3.253590588e-04f, -7.826276448e-05f, -2.250722132e-03f, +3.342863857e-03f, +5.332184360e-03f, -1.828644204e-02f, -2.534797081e-02f, +1.186200034e-02f, +2.738254409e-02f, +2.668838337e-03f, -6.732169339e-03f, +1.089544232e-03f, +1.244075649e-03f, -5.090007623e-04f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, +2.816859426e-04f, +4.727037370e-05f, -2.243110553e-03f, +2.764068406e-03f, +5.968640123e-03f, -1.656098957e-02f, -2.648893755e-02f, +9.342037235e-03f, +2.804039906e-02f, +4.246700138e-03f, -6.996656391e-03f, +7.360682089e-04f, +1.422085430e-03f, -5.008892512e-04f, +4.855802427e-04f, - /* 16,13 */ +0.000000000e+00f, +2.375950982e-04f, +1.579695096e-04f, -2.200171639e-03f, +2.190599691e-03f, +6.473886365e-03f, -1.478830973e-02f, -2.740215275e-02f, +6.735572940e-03f, +2.849345261e-02f, +5.902082228e-03f, -7.175055211e-03f, +3.378401438e-04f, +1.593056257e-03f, -4.801879450e-04f, -4.409159553e-05f, - /* 16,14 */ +0.000000000e+00f, +1.941703587e-04f, +2.532507071e-04f, -2.125649126e-03f, +1.630677017e-03f, +6.850603202e-03f, -1.298853535e-02f, -2.808336987e-02f, +4.066570788e-03f, +2.873131200e-02f, +7.620475041e-03f, -7.257902118e-03f, -1.022461377e-04f, +1.753034729e-03f, -4.458313625e-04f, -7.672972562e-05f, - /* 16,15 */ +0.000000000e+00f, +1.523656204e-04f, +3.328791130e-04f, -2.023521864e-03f, +1.091735034e-03f, +7.102956997e-03f, -1.118139232e-02f, -2.853093461e-02f, +1.359743295e-03f, +2.874576735e-02f, +9.385964725e-03f, -7.236474393e-03f, -5.803605804e-04f, +1.897918409e-03f, -3.969443331e-04f, -1.129954761e-04f, - /* 12, 0 */ -1.111572639e-03f, -1.388266820e-03f, +7.900037037e-03f, -6.320860170e-03f, -3.276049121e-02f, -1.657033928e-03f, +3.280306521e-02f, +8.402419704e-03f, -8.147060845e-03f, +9.779320530e-04f, +1.332890330e-03f, -5.705687800e-04f, - /* 12, 1 */ -8.925738220e-04f, -1.737094155e-03f, +7.544883174e-03f, -4.325531156e-03f, -3.242830266e-02f, -4.953502968e-03f, +3.254754550e-02f, +1.054842384e-02f, -8.272560314e-03f, +5.083818205e-04f, +1.551863117e-03f, -5.805594968e-04f, - /* 12, 2 */ -6.800837112e-04f, -2.023419107e-03f, +7.095763901e-03f, -2.436087367e-03f, -3.181840805e-02f, -8.197416535e-03f, +3.198906769e-02f, +1.273520115e-02f, -8.264181830e-03f, -1.673924732e-05f, +1.763414955e-03f, -5.764989135e-04f, - /* 12, 3 */ -4.777710304e-04f, -2.247467778e-03f, +6.567344318e-03f, -6.698479312e-04f, -3.094591156e-02f, -1.135453705e-02f, +3.112651563e-02f, +1.493747887e-02f, -8.110878239e-03f, -5.924008684e-04f, +1.962133432e-03f, -5.566237283e-04f, - /* 12, 4 */ -2.887507612e-04f, -2.410593616e-03f, +5.974525144e-03f, +9.583644900e-04f, -2.982883555e-02f, -1.439181272e-02f, +2.996260004e-02f, +1.712870168e-02f, -7.803165138e-03f, -1.212178752e-03f, +2.142359210e-03f, -5.193755958e-04f, - /* 12, 5 */ -1.155657138e-04f, -2.515168800e-03f, +5.332187403e-03f, +2.436339775e-03f, -2.848780461e-02f, -1.727782533e-02f, +2.850388027e-02f, +1.928138098e-02f, -7.333362623e-03f, -1.868272468e-03f, +2.298288008e-03f, -4.634616378e-04f, - /* 12, 6 */ +3.981829456e-05f, -2.564463655e-03f, +4.654950666e-03f, +3.754551105e-03f, -2.694569661e-02f, -1.998321224e-02f, +2.676072816e-02f, +2.136746929e-02f, -6.695817566e-03f, -2.551550686e-03f, +2.424083786e-03f, -3.879138191e-04f, - /* 12, 7 */ +1.760045094e-04f, -2.562517141e-03f, +3.956948521e-03f, +4.906180706e-03f, -2.522726725e-02f, -2.248105576e-02f, +2.474723407e-02f, +2.335875442e-02f, -5.887101657e-03f, -3.251624436e-03f, +2.514001460e-03f, -2.921456350e-04f, - /* 12, 8 */ +2.921456350e-04f, -2.514001460e-03f, +3.251624436e-03f, +5.887101657e-03f, -2.335875442e-02f, -2.474723407e-02f, +2.248105576e-02f, +2.522726725e-02f, -4.906180706e-03f, -3.956948521e-03f, +2.562517141e-03f, -1.760045094e-04f, - /* 12, 9 */ +3.879138191e-04f, -2.424083786e-03f, +2.551550686e-03f, +6.695817566e-03f, -2.136746929e-02f, -2.676072816e-02f, +1.998321224e-02f, +2.694569661e-02f, -3.754551105e-03f, -4.654950666e-03f, +2.564463655e-03f, -3.981829456e-05f, - /* 12,10 */ +4.634616378e-04f, -2.298288008e-03f, +1.868272468e-03f, +7.333362623e-03f, -1.928138098e-02f, -2.850388027e-02f, +1.727782533e-02f, +2.848780461e-02f, -2.436339775e-03f, -5.332187403e-03f, +2.515168800e-03f, +1.155657138e-04f, - /* 12,11 */ +5.193755958e-04f, -2.142359210e-03f, +1.212178752e-03f, +7.803165138e-03f, -1.712870168e-02f, -2.996260004e-02f, +1.439181272e-02f, +2.982883555e-02f, -9.583644900e-04f, -5.974525144e-03f, +2.410593616e-03f, +2.887507612e-04f, - /* 12,12 */ +5.566237283e-04f, -1.962133432e-03f, +5.924008684e-04f, +8.110878239e-03f, -1.493747887e-02f, -3.112651563e-02f, +1.135453705e-02f, +3.094591156e-02f, +6.698479312e-04f, -6.567344318e-03f, +2.247467778e-03f, +4.777710304e-04f, - /* 12,13 */ +5.764989135e-04f, -1.763414955e-03f, +1.673924732e-05f, +8.264181830e-03f, -1.273520115e-02f, -3.198906769e-02f, +8.197416535e-03f, +3.181840805e-02f, +2.436087367e-03f, -7.095763901e-03f, +2.023419107e-03f, +6.800837112e-04f, - /* 12,14 */ +5.805594968e-04f, -1.551863117e-03f, -5.083818205e-04f, +8.272560314e-03f, -1.054842384e-02f, -3.254754550e-02f, +4.953502968e-03f, +3.242830266e-02f, +4.325531156e-03f, -7.544883174e-03f, +1.737094155e-03f, +8.925738220e-04f, - /* 12,15 */ +5.705687800e-04f, -1.332890330e-03f, -9.779320530e-04f, +8.147060845e-03f, -8.402419704e-03f, -3.280306521e-02f, +1.657033928e-03f, +3.276049121e-02f, +6.320860170e-03f, -7.900037037e-03f, +1.388266820e-03f, +1.111572639e-03f, - /* 12, 0 */ -1.054803383e-04f, -2.744858958e-03f, +7.370914553e-03f, -2.604494739e-03f, -3.666896703e-02f, -1.994735221e-03f, +3.707596726e-02f, +4.873177855e-03f, -8.012348726e-03f, +2.554514858e-03f, +3.117958677e-04f, -3.625540242e-04f, - /* 12, 1 */ +7.775923585e-05f, -2.860662969e-03f, +6.648820026e-03f, -4.950753709e-04f, -3.590728113e-02f, -5.960234251e-03f, +3.711196787e-02f, +7.277671607e-03f, -8.552819277e-03f, +2.286292242e-03f, +5.385913036e-04f, -4.265219564e-04f, - /* 12, 2 */ +2.361482435e-04f, -2.906545541e-03f, +5.866306097e-03f, +1.435258618e-03f, -3.481183398e-02f, -9.854190425e-03f, +3.676562700e-02f, +9.791136525e-03f, -8.972352970e-03f, +1.938320040e-03f, +7.824350015e-04f, -4.875429386e-04f, - /* 12, 3 */ +3.687004846e-04f, -2.888204359e-03f, +5.043181884e-03f, +3.170488652e-03f, -3.340772759e-02f, -1.363013975e-02f, +3.603085731e-02f, +1.238366322e-02f, -9.251714734e-03f, +1.510362297e-03f, +1.039066351e-03f, -5.431259501e-04f, - /* 12, 4 */ +4.751685216e-04f, -2.812206203e-03f, +4.198484259e-03f, +4.698496481e-03f, -3.172374637e-02f, -1.724344185e-02f, +3.490702283e-02f, +1.502265637e-02f, -9.372823891e-03f, +1.003961424e-03f, +1.303424694e-03f, -5.906251216e-04f, - /* 12, 5 */ +5.559799195e-04f, -2.685773447e-03f, +3.350171906e-03f, +6.011087921e-03f, -2.979181001e-02f, -2.065196332e-02f, +3.339904530e-02f, +1.767328103e-02f, -9.319170237e-03f, +4.225520445e-04f, +1.569701578e-03f, -6.273034189e-04f, - /* 12, 6 */ +6.121620582e-04f, -2.516571985e-03f, +2.514858275e-03f, +7.103945228e-03f, -2.764638515e-02f, -2.381671619e-02f, +3.151741694e-02f, +2.029896461e-02f, -9.076221424e-03f, -2.284590483e-04f, +1.831416829e-03f, -6.504054889e-04f, - /* 12, 7 */ +6.452583046e-04f, -2.312505227e-03f, +1.707586806e-03f, +7.976511649e-03f, -2.532386758e-02f, -2.670244010e-02f, +2.927811806e-02f, +2.286194672e-02f, -8.631812899e-03f, -9.416507761e-04f, +2.081518390e-03f, -6.572383529e-04f, - /* 12, 8 */ +6.572383529e-04f, -2.081518390e-03f, +9.416507761e-04f, +8.631812899e-03f, -2.286194672e-02f, -2.927811806e-02f, +2.670244010e-02f, +2.532386758e-02f, -7.976511649e-03f, -1.707586806e-03f, +2.312505227e-03f, -6.452583046e-04f, - /* 12, 9 */ +6.504054889e-04f, -1.831416829e-03f, +2.284590483e-04f, +9.076221424e-03f, -2.029896461e-02f, -3.151741694e-02f, +2.381671619e-02f, +2.764638515e-02f, -7.103945228e-03f, -2.514858275e-03f, +2.516571985e-03f, -6.121620582e-04f, - /* 12,10 */ +6.273034189e-04f, -1.569701578e-03f, -4.225520445e-04f, +9.319170237e-03f, -1.767328103e-02f, -3.339904530e-02f, +2.065196332e-02f, +2.979181001e-02f, -6.011087921e-03f, -3.350171906e-03f, +2.685773447e-03f, -5.559799195e-04f, - /* 12,11 */ +5.906251216e-04f, -1.303424694e-03f, -1.003961424e-03f, +9.372823891e-03f, -1.502265637e-02f, -3.490702283e-02f, +1.724344185e-02f, +3.172374637e-02f, -4.698496481e-03f, -4.198484259e-03f, +2.812206203e-03f, -4.751685216e-04f, - /* 12,12 */ +5.431259501e-04f, -1.039066351e-03f, -1.510362297e-03f, +9.251714734e-03f, -1.238366322e-02f, -3.603085731e-02f, +1.363013975e-02f, +3.340772759e-02f, -3.170488652e-03f, -5.043181884e-03f, +2.888204359e-03f, -3.687004846e-04f, - /* 12,13 */ +4.875429386e-04f, -7.824350015e-04f, -1.938320040e-03f, +8.972352970e-03f, -9.791136525e-03f, -3.676562700e-02f, +9.854190425e-03f, +3.481183398e-02f, -1.435258618e-03f, -5.866306097e-03f, +2.906545541e-03f, -2.361482435e-04f, - /* 12,14 */ +4.265219564e-04f, -5.385913036e-04f, -2.286292242e-03f, +8.552819277e-03f, -7.277671607e-03f, -3.711196787e-02f, +5.960234251e-03f, +3.590728113e-02f, +4.950753709e-04f, -6.648820026e-03f, +2.860662969e-03f, -7.775923585e-05f, - /* 12,15 */ +3.625540242e-04f, -3.117958677e-04f, -2.554514858e-03f, +8.012348726e-03f, -4.873177855e-03f, -3.707596726e-02f, +1.994735221e-03f, +3.666896703e-02f, +2.604494739e-03f, -7.370914553e-03f, +2.744858958e-03f, +1.054803383e-04f, - /* 12, 0 */ +6.110448771e-04f, -3.173989705e-03f, +5.751223243e-03f, +1.507555794e-03f, -4.035343888e-02f, -2.375409442e-03f, +4.124383193e-02f, +8.091337269e-04f, -6.726716888e-03f, +3.253952459e-03f, -5.087325269e-04f, -4.127854608e-05f, - /* 12, 1 */ +6.820041984e-04f, -3.029137857e-03f, +4.746351538e-03f, +3.578915017e-03f, -3.904147991e-02f, -7.094160720e-03f, +4.168490752e-02f, +3.349306133e-03f, -7.647219355e-03f, +3.259488816e-03f, -3.738470149e-04f, -9.536054020e-05f, - /* 12, 2 */ +7.235832870e-04f, -2.829602454e-03f, +3.736224000e-03f, +5.388621830e-03f, -3.734163661e-02f, -1.171726725e-02f, +4.165549067e-02f, +6.085743956e-03f, -8.486093037e-03f, +3.182049180e-03f, -2.060445111e-04f, -1.573545891e-04f, - /* 12, 3 */ +7.383739029e-04f, -2.585946508e-03f, +2.743066911e-03f, +6.925917423e-03f, -3.529277498e-02f, -1.618281485e-02f, +4.114151479e-02f, +8.986133221e-03f, -9.216195947e-03f, +3.014391908e-03f, -5.966328360e-06f, -2.260166200e-04f, - /* 12, 4 */ +7.294476853e-04f, -2.308795686e-03f, +1.786872733e-03f, +8.185530694e-03f, -3.293811768e-02f, -2.043162352e-02f, +4.013642610e-02f, +1.201345370e-02f, -9.810446156e-03f, +2.750895834e-03f, +2.246717082e-04f, -2.996559917e-04f, - /* 12, 5 */ +7.002161546e-04f, -2.008565767e-03f, +8.851333656e-04f, +9.167495079e-03f, -3.032435275e-02f, -2.440826356e-02f, +3.864144993e-02f, +1.512648157e-02f, -1.024241966e-02f, +2.387856219e-03f, +4.830138128e-04f, -3.761418846e-04f, - /* 12, 6 */ +6.542939604e-04f, -1.695217727e-03f, +5.264660367e-05f, +9.876866054e-03f, -2.750069849e-02f, -2.806199617e-02f, +3.666571148e-02f, +1.828039745e-02f, -1.048696943e-02f, +1.923755148e-03f, +7.650267923e-04f, -4.529261561e-04f, - /* 12, 7 */ +5.953691186e-04f, -1.378044726e-03f, -6.986040124e-04f, +1.032334944e-02f, -2.451794467e-02f, -3.134761990e-02f, +3.422620641e-02f, +2.142749023e-02f, -1.052085229e-02f, +1.359497506e-03f, +1.065494162e-03f, -5.270834853e-04f, - /* 12, 8 */ +5.270834853e-04f, -1.065494162e-03f, -1.359497506e-03f, +1.052085229e-02f, -2.142749023e-02f, -3.422620641e-02f, +3.134761990e-02f, +2.451794467e-02f, -1.032334944e-02f, +6.986040124e-04f, +1.378044726e-03f, -5.953691186e-04f, - /* 12, 9 */ +4.529261561e-04f, -7.650267923e-04f, -1.923755148e-03f, +1.048696943e-02f, -1.828039745e-02f, -3.666571148e-02f, +2.806199617e-02f, +2.750069849e-02f, -9.876866054e-03f, -5.264660367e-05f, +1.695217727e-03f, -6.542939604e-04f, - /* 12,10 */ +3.761418846e-04f, -4.830138128e-04f, -2.387856219e-03f, +1.024241966e-02f, -1.512648157e-02f, -3.864144993e-02f, +2.440826356e-02f, +3.032435275e-02f, -9.167495079e-03f, -8.851333656e-04f, +2.008565767e-03f, -7.002161546e-04f, - /* 12,11 */ +2.996559917e-04f, -2.246717082e-04f, -2.750895834e-03f, +9.810446156e-03f, -1.201345370e-02f, -4.013642610e-02f, +2.043162352e-02f, +3.293811768e-02f, -8.185530694e-03f, -1.786872733e-03f, +2.308795686e-03f, -7.294476853e-04f, - /* 12,12 */ +2.260166200e-04f, +5.966328360e-06f, -3.014391908e-03f, +9.216195947e-03f, -8.986133221e-03f, -4.114151479e-02f, +1.618281485e-02f, +3.529277498e-02f, -6.925917423e-03f, -2.743066911e-03f, +2.585946508e-03f, -7.383739029e-04f, - /* 12,13 */ +1.573545891e-04f, +2.060445111e-04f, -3.182049180e-03f, +8.486093037e-03f, -6.085743956e-03f, -4.165549067e-02f, +1.171726725e-02f, +3.734163661e-02f, -5.388621830e-03f, -3.736224000e-03f, +2.829602454e-03f, -7.235832870e-04f, - /* 12,14 */ +9.536054020e-05f, +3.738470149e-04f, -3.259488816e-03f, +7.647219355e-03f, -3.349306133e-03f, -4.168490752e-02f, +7.094160720e-03f, +3.904147991e-02f, -3.578915017e-03f, -4.746351538e-03f, +3.029137857e-03f, -6.820041984e-04f, - /* 12,15 */ +4.127854608e-05f, +5.087325269e-04f, -3.253952459e-03f, +6.726716888e-03f, -8.091337269e-04f, -4.124383193e-02f, +2.375409442e-03f, +4.035343888e-02f, -1.507555794e-03f, -5.751223243e-03f, +3.173989705e-03f, -6.110448771e-04f, - - /* 24, 0 */ -8.820438069e-05f, -1.519461079e-04f, -2.301651496e-04f, -3.149320871e-04f, -3.945939739e-04f, -4.554410135e-04f, -4.841532882e-04f, -4.705408991e-04f, -4.099602091e-04f, -3.048100066e-04f, -1.646897470e-04f, -5.099007530e-06f, +1.551006323e-04f, +2.969416536e-04f, +4.046294158e-04f, +4.681429482e-04f, +4.846228261e-04f, +4.583040637e-04f, +3.990939388e-04f, +3.201968846e-04f, +2.353759082e-04f, +1.564712483e-04f, +9.167483068e-05f, +4.482688286e-05f, - /* 24, 1 */ -8.480575132e-05f, -1.474789784e-04f, -2.249812225e-04f, -3.096480504e-04f, -3.900204007e-04f, -4.524514078e-04f, -4.835165803e-04f, -4.727530367e-04f, -4.151145025e-04f, -3.125397891e-04f, -1.742016828e-04f, -1.529460870e-05f, +1.454387449e-04f, +2.889379628e-04f, +3.991236794e-04f, +4.655589110e-04f, +4.849233000e-04f, +4.610375470e-04f, +4.035168325e-04f, +3.254391996e-04f, +2.406110065e-04f, +1.610529558e-04f, +9.521673594e-05f, +4.721513201e-05f, - /* 24, 2 */ -8.147924507e-05f, -1.430712350e-04f, -2.198265592e-04f, -3.043479843e-04f, -3.853766873e-04f, -4.493383067e-04f, -4.827146831e-04f, -4.747797448e-04f, -4.200908527e-04f, -3.201278616e-04f, -1.836320864e-04f, -2.548296987e-05f, +1.357085413e-04f, +2.808022583e-04f, +3.934446700e-04f, +4.627886263e-04f, +4.850529052e-04f, +4.636385032e-04f, +4.078592000e-04f, +3.306557574e-04f, +2.458678944e-04f, +1.656897170e-04f, +9.882966748e-05f, +4.967415993e-05f, - /* 24, 3 */ -7.822510242e-05f, -1.387241832e-04f, -2.147035314e-04f, -2.990350629e-04f, -3.806663042e-04f, -4.461048161e-04f, -4.817496625e-04f, -4.766215175e-04f, -4.248879309e-04f, -3.275711800e-04f, -1.929766610e-04f, -3.565926997e-05f, +1.259145254e-04f, +2.725379532e-04f, +3.875941701e-04f, +4.598320457e-04f, +4.850099279e-04f, +4.661040260e-04f, +4.121175966e-04f, +3.358432542e-04f, +2.511439643e-04f, +1.703799499e-04f, +1.025131319e-04f, +5.220438912e-05f, - /* 24, 4 */ -7.504350274e-05f, -1.344390595e-04f, -2.096144489e-04f, -2.937124231e-04f, -3.758927218e-04f, -4.427540852e-04f, -4.806236671e-04f, -4.782789577e-04f, -4.295045226e-04f, -3.348667971e-04f, -2.022311686e-04f, -4.581869630e-05f, +1.160612449e-04f, +2.641485480e-04f, +3.815740737e-04f, +4.566892339e-04f, +4.847927474e-04f, +4.684312656e-04f, +4.162885910e-04f, +3.409983591e-04f, +2.564365532e-04f, +1.751220037e-04f, +1.062665706e-04f, +5.480619333e-05f, - /* 24, 5 */ -7.193456522e-05f, -1.302170312e-04f, -2.045615590e-04f, -2.883831622e-04f, -3.710594077e-04f, -4.392893036e-04f, -4.793389263e-04f, -4.797527765e-04f, -4.339395286e-04f, -3.420118645e-04f, -2.113914331e-04f, -5.595644787e-05f, +1.061532886e-04f, +2.556376279e-04f, +3.753863858e-04f, +4.533603695e-04f, +4.843998374e-04f, +4.706174312e-04f, +4.203687678e-04f, +3.461177167e-04f, +2.617429433e-04f, +1.799141593e-04f, +1.100893595e-04f, +5.747989630e-05f, - /* 24, 6 */ -6.889834987e-05f, -1.260591965e-04f, -1.995470454e-04f, -2.830503358e-04f, -3.661698243e-04f, -4.357136989e-04f, -4.778977479e-04f, -4.810437916e-04f, -4.381919648e-04f, -3.490036345e-04f, -2.204533432e-04f, -6.606773875e-05f, +9.619528314e-05f, +2.470088608e-04f, +3.690332209e-04f, +4.498457452e-04f, +4.838297683e-04f, +4.726597937e-04f, +4.243547301e-04f, +3.511979487e-04f, +2.670603639e-04f, +1.847546294e-04f, +1.139808078e-04f, +6.022577049e-05f, - /* 24, 7 */ -6.593485851e-05f, -1.219665852e-04f, -1.945730275e-04f, -2.777169567e-04f, -3.612274261e-04f, -4.320305335e-04f, -4.763025159e-04f, -4.821529264e-04f, -4.422609626e-04f, -3.558394612e-04f, -2.294128549e-04f, -7.614780136e-05f, +8.619188981e-05f, +2.382659945e-04f, +3.625168024e-04f, +4.461457687e-04f, +4.830812085e-04f, +4.745556880e-04f, +4.282431024e-04f, +3.562356572e-04f, +2.723859925e-04f, +1.896415594e-04f, +1.179401580e-04f, +6.304403582e-05f, - /* 24, 8 */ -6.304403582e-05f, -1.179401580e-04f, -1.896415594e-04f, -2.723859925e-04f, -3.562356572e-04f, -4.282431024e-04f, -4.745556880e-04f, -4.830812085e-04f, -4.461457687e-04f, -3.625168024e-04f, -2.382659945e-04f, -8.619188981e-05f, +7.614780136e-05f, +2.294128549e-04f, +3.558394612e-04f, +4.422609626e-04f, +4.821529264e-04f, +4.763025159e-04f, +4.320305335e-04f, +3.612274261e-04f, +2.777169567e-04f, +1.945730275e-04f, +1.219665852e-04f, +6.593485851e-05f, - /* 24, 9 */ -6.022577049e-05f, -1.139808078e-04f, -1.847546294e-04f, -2.670603639e-04f, -3.511979487e-04f, -4.243547301e-04f, -4.726597937e-04f, -4.838297683e-04f, -4.498457452e-04f, -3.690332209e-04f, -2.470088608e-04f, -9.619528314e-05f, +6.606773875e-05f, +2.204533432e-04f, +3.490036345e-04f, +4.381919648e-04f, +4.810437916e-04f, +4.778977479e-04f, +4.357136989e-04f, +3.661698243e-04f, +2.830503358e-04f, +1.995470454e-04f, +1.260591965e-04f, +6.889834987e-05f, - /* 24,10 */ -5.747989630e-05f, -1.100893595e-04f, -1.799141593e-04f, -2.617429433e-04f, -3.461177167e-04f, -4.203687678e-04f, -4.706174312e-04f, -4.843998374e-04f, -4.533603695e-04f, -3.753863858e-04f, -2.556376279e-04f, -1.061532886e-04f, +5.595644787e-05f, +2.113914331e-04f, +3.420118645e-04f, +4.339395286e-04f, +4.797527765e-04f, +4.793389263e-04f, +4.392893036e-04f, +3.710594077e-04f, +2.883831622e-04f, +2.045615590e-04f, +1.302170312e-04f, +7.193456522e-05f, - /* 24,11 */ -5.480619333e-05f, -1.062665706e-04f, -1.751220037e-04f, -2.564365532e-04f, -3.409983591e-04f, -4.162885910e-04f, -4.684312656e-04f, -4.847927474e-04f, -4.566892339e-04f, -3.815740737e-04f, -2.641485480e-04f, -1.160612449e-04f, +4.581869630e-05f, +2.022311686e-04f, +3.348667971e-04f, +4.295045226e-04f, +4.782789577e-04f, +4.806236671e-04f, +4.427540852e-04f, +3.758927218e-04f, +2.937124231e-04f, +2.096144489e-04f, +1.344390595e-04f, +7.504350274e-05f, - /* 24,12 */ -5.220438912e-05f, -1.025131319e-04f, -1.703799499e-04f, -2.511439643e-04f, -3.358432542e-04f, -4.121175966e-04f, -4.661040260e-04f, -4.850099279e-04f, -4.598320457e-04f, -3.875941701e-04f, -2.725379532e-04f, -1.259145254e-04f, +3.565926997e-05f, +1.929766610e-04f, +3.275711800e-04f, +4.248879309e-04f, +4.766215175e-04f, +4.817496625e-04f, +4.461048161e-04f, +3.806663042e-04f, +2.990350629e-04f, +2.147035314e-04f, +1.387241832e-04f, +7.822510242e-05f, - /* 24,13 */ -4.967415993e-05f, -9.882966748e-05f, -1.656897170e-04f, -2.458678944e-04f, -3.306557574e-04f, -4.078592000e-04f, -4.636385032e-04f, -4.850529052e-04f, -4.627886263e-04f, -3.934446700e-04f, -2.808022583e-04f, -1.357085413e-04f, +2.548296987e-05f, +1.836320864e-04f, +3.201278616e-04f, +4.200908527e-04f, +4.747797448e-04f, +4.827146831e-04f, +4.493383067e-04f, +3.853766873e-04f, +3.043479843e-04f, +2.198265592e-04f, +1.430712350e-04f, +8.147924507e-05f, - /* 24,14 */ -4.721513201e-05f, -9.521673594e-05f, -1.610529558e-04f, -2.406110065e-04f, -3.254391996e-04f, -4.035168325e-04f, -4.610375470e-04f, -4.849233000e-04f, -4.655589110e-04f, -3.991236794e-04f, -2.889379628e-04f, -1.454387449e-04f, +1.529460870e-05f, +1.742016828e-04f, +3.125397891e-04f, +4.151145025e-04f, +4.727530367e-04f, +4.835165803e-04f, +4.524514078e-04f, +3.900204007e-04f, +3.096480504e-04f, +2.249812225e-04f, +1.474789784e-04f, +8.480575132e-05f, - /* 24,15 */ -4.482688286e-05f, -9.167483068e-05f, -1.564712483e-04f, -2.353759082e-04f, -3.201968846e-04f, -3.990939388e-04f, -4.583040637e-04f, -4.846228261e-04f, -4.681429482e-04f, -4.046294158e-04f, -2.969416536e-04f, -1.551006323e-04f, +5.099007530e-06f, +1.646897470e-04f, +3.048100066e-04f, +4.099602091e-04f, +4.705408991e-04f, +4.841532882e-04f, +4.554410135e-04f, +3.945939739e-04f, +3.149320871e-04f, +2.301651496e-04f, +1.519461079e-04f, +8.820438069e-05f, - /* 24, 0 */ +1.254177052e-04f, +1.432187562e-04f, +1.041598752e-04f, -1.135750248e-05f, -2.010663923e-04f, -4.345091125e-04f, -6.566280172e-04f, -8.018070806e-04f, -8.145094672e-04f, -6.693628869e-04f, -3.829411831e-04f, -1.208738944e-05f, +3.614691013e-04f, +6.551938988e-04f, +8.101126455e-04f, +8.069330100e-04f, +6.686285441e-04f, +4.493898115e-04f, +2.148422063e-04f, +2.121126661e-05f, -9.928779545e-05f, -1.427235715e-04f, -1.276505127e-04f, -8.319130160e-05f, - /* 24, 1 */ +1.230784715e-04f, +1.434886692e-04f, +1.087259386e-04f, -1.803144714e-06f, -1.874698746e-04f, -4.195879132e-04f, -6.443236569e-04f, -7.961535056e-04f, -8.182754723e-04f, -6.829663304e-04f, -4.040749814e-04f, -3.625133679e-05f, +3.396771574e-04f, +6.404692089e-04f, +8.050839212e-04f, +8.115205881e-04f, +6.803091718e-04f, +4.642140510e-04f, +2.287861157e-04f, +3.136033560e-05f, -9.410712043e-05f, -1.419963918e-04f, -1.297693532e-04f, -8.627587811e-05f, - /* 24, 2 */ +1.206403004e-04f, +1.435401825e-04f, +1.129889134e-04f, +7.448162127e-06f, -1.740634498e-04f, -4.046419937e-04f, -6.317316839e-04f, -7.899834729e-04f, -8.214124236e-04f, -6.959950382e-04f, -4.248524782e-04f, -6.038280262e-05f, +3.175841545e-04f, +6.251993025e-04f, +7.994228899e-04f, +8.155596091e-04f, +6.916540113e-04f, +4.789657110e-04f, +2.428865252e-04f, +4.180014906e-05f, -8.861563067e-05f, -1.410306561e-04f, -1.317666448e-04f, -8.934972901e-05f, - /* 24, 3 */ +1.181106179e-04f, +1.433803035e-04f, +1.169520657e-04f, +1.639322797e-05f, -1.608575022e-04f, -3.896869361e-04f, -6.188684520e-04f, -7.833086355e-04f, -8.239227539e-04f, -7.084404793e-04f, -4.452560799e-04f, -8.446017611e-05f, +2.952092559e-04f, +6.093952965e-04f, +7.931298338e-04f, +8.190403838e-04f, +7.026473724e-04f, +4.936285297e-04f, +2.571314547e-04f, +5.252568657e-05f, -8.281147599e-05f, -1.398199793e-04f, -1.336347757e-04f, -9.240689021e-05f, - /* 24, 4 */ +1.154967766e-04f, +1.430161614e-04f, +1.206189886e-04f, +2.502931407e-05f, -1.478619956e-04f, -3.747381071e-04f, -6.057504254e-04f, -7.761410928e-04f, -8.258095592e-04f, -7.202947906e-04f, -4.652686374e-04f, -1.084619116e-04f, +2.725719623e-04f, +5.930689291e-04f, +7.862057246e-04f, +8.219537553e-04f, +7.132737861e-04f, +5.081861235e-04f, +2.715085502e-04f, +6.353146713e-05f, -7.669318508e-05f, -1.383581653e-04f, -1.353661159e-04f, -9.544123411e-05f, - /* 24, 5 */ +1.128060463e-04f, +1.424549941e-04f, +1.239935912e-04f, +3.335412922e-05f, -1.350864661e-04f, -3.598106411e-04f, -5.923941571e-04f, -7.684933716e-04f, -8.270765907e-04f, -7.315507834e-04f, -4.848734661e-04f, -1.323665545e-04f, +2.496920884e-04f, +5.762325468e-04f, +7.786522269e-04f, +8.242911148e-04f, +7.235180256e-04f, +5.226220062e-04f, +2.860050947e-04f, +7.481154929e-05f, -7.025967465e-05f, -1.366392205e-04f, -1.369530289e-04f, -9.844647580e-05f, - /* 24, 6 */ +1.100456035e-04f, +1.417041346e-04f, +1.270800866e-04f, +4.136582536e-05f, -1.225400157e-04f, -3.449194225e-04f, -5.788162671e-04f, -7.603784078e-04f, -8.277282458e-04f, -7.422019493e-04f, -5.040543645e-04f, -1.561527673e-04f, +2.265897402e-04f, +5.588990922e-04f, +7.704716994e-04f, +8.260444163e-04f, +7.333651287e-04f, +5.369196097e-04f, +3.006080208e-04f, +8.635953200e-05f, -6.351025813e-05f, -1.346573670e-04f, -1.383878839e-04f, -1.014161798e-04f, - /* 24, 7 */ +1.072225228e-04f, +1.407709979e-04f, +1.298829797e-04f, +4.906299265e-05f, -1.102313067e-04f, -3.300790706e-04f, -5.650334202e-04f, -7.518095256e-04f, -8.277695590e-04f, -7.522424649e-04f, -5.227956327e-04f, -1.797993550e-04f, +2.032852905e-04f, +5.410820901e-04f, +7.616671958e-04f, +8.272061905e-04f, +7.428004186e-04f, +5.510623045e-04f, +3.153039229e-04f, +9.816855611e-05f, -5.644465382e-05f, -1.324070557e-04f, -1.396630677e-04f, -1.043437672e-04f, - /* 24, 8 */ +1.043437672e-04f, +1.396630677e-04f, +1.324070557e-04f, +5.644465382e-05f, -9.816855611e-05f, -3.153039229e-04f, -5.510623045e-04f, -7.428004186e-04f, -8.272061905e-04f, -7.616671958e-04f, -5.410820901e-04f, -2.032852905e-04f, +1.797993550e-04f, +5.227956327e-04f, +7.522424649e-04f, +8.277695590e-04f, +7.518095256e-04f, +5.650334202e-04f, +3.300790706e-04f, +1.102313067e-04f, -4.906299265e-05f, -1.298829797e-04f, -1.407709979e-04f, -1.072225228e-04f, - /* 24, 9 */ +1.014161798e-04f, +1.383878839e-04f, +1.346573670e-04f, +6.351025813e-05f, -8.635953200e-05f, -3.006080208e-04f, -5.369196097e-04f, -7.333651287e-04f, -8.260444163e-04f, -7.704716994e-04f, -5.588990922e-04f, -2.265897402e-04f, +1.561527673e-04f, +5.040543645e-04f, +7.422019493e-04f, +8.277282458e-04f, +7.603784078e-04f, +5.788162671e-04f, +3.449194225e-04f, +1.225400157e-04f, -4.136582536e-05f, -1.270800866e-04f, -1.417041346e-04f, -1.100456035e-04f, - /* 24,10 */ +9.844647580e-05f, +1.369530289e-04f, +1.366392205e-04f, +7.025967465e-05f, -7.481154929e-05f, -2.860050947e-04f, -5.226220062e-04f, -7.235180256e-04f, -8.242911148e-04f, -7.786522269e-04f, -5.762325468e-04f, -2.496920884e-04f, +1.323665545e-04f, +4.848734661e-04f, +7.315507834e-04f, +8.270765907e-04f, +7.684933716e-04f, +5.923941571e-04f, +3.598106411e-04f, +1.350864661e-04f, -3.335412922e-05f, -1.239935912e-04f, -1.424549941e-04f, -1.128060463e-04f, - /* 24,11 */ +9.544123411e-05f, +1.353661159e-04f, +1.383581653e-04f, +7.669318508e-05f, -6.353146713e-05f, -2.715085502e-04f, -5.081861235e-04f, -7.132737861e-04f, -8.219537553e-04f, -7.862057246e-04f, -5.930689291e-04f, -2.725719623e-04f, +1.084619116e-04f, +4.652686374e-04f, +7.202947906e-04f, +8.258095592e-04f, +7.761410928e-04f, +6.057504254e-04f, +3.747381071e-04f, +1.478619956e-04f, -2.502931407e-05f, -1.206189886e-04f, -1.430161614e-04f, -1.154967766e-04f, - /* 24,12 */ +9.240689021e-05f, +1.336347757e-04f, +1.398199793e-04f, +8.281147599e-05f, -5.252568657e-05f, -2.571314547e-04f, -4.936285297e-04f, -7.026473724e-04f, -8.190403838e-04f, -7.931298338e-04f, -6.093952965e-04f, -2.952092559e-04f, +8.446017611e-05f, +4.452560799e-04f, +7.084404793e-04f, +8.239227539e-04f, +7.833086355e-04f, +6.188684520e-04f, +3.896869361e-04f, +1.608575022e-04f, -1.639322797e-05f, -1.169520657e-04f, -1.433803035e-04f, -1.181106179e-04f, - /* 24,13 */ +8.934972901e-05f, +1.317666448e-04f, +1.410306561e-04f, +8.861563067e-05f, -4.180014906e-05f, -2.428865252e-04f, -4.789657110e-04f, -6.916540113e-04f, -8.155596091e-04f, -7.994228899e-04f, -6.251993025e-04f, -3.175841545e-04f, +6.038280262e-05f, +4.248524782e-04f, +6.959950382e-04f, +8.214124236e-04f, +7.899834729e-04f, +6.317316839e-04f, +4.046419937e-04f, +1.740634498e-04f, -7.448162127e-06f, -1.129889134e-04f, -1.435401825e-04f, -1.206403004e-04f, - /* 24,14 */ +8.627587811e-05f, +1.297693532e-04f, +1.419963918e-04f, +9.410712043e-05f, -3.136033560e-05f, -2.287861157e-04f, -4.642140510e-04f, -6.803091718e-04f, -8.115205881e-04f, -8.050839212e-04f, -6.404692089e-04f, -3.396771574e-04f, +3.625133679e-05f, +4.040749814e-04f, +6.829663304e-04f, +8.182754723e-04f, +7.961535056e-04f, +6.443236569e-04f, +4.195879132e-04f, +1.874698746e-04f, +1.803144714e-06f, -1.087259386e-04f, -1.434886692e-04f, -1.230784715e-04f, - /* 24,15 */ +8.319130160e-05f, +1.276505127e-04f, +1.427235715e-04f, +9.928779545e-05f, -2.121126661e-05f, -2.148422063e-04f, -4.493898115e-04f, -6.686285441e-04f, -8.069330100e-04f, -8.101126455e-04f, -6.551938988e-04f, -3.614691013e-04f, +1.208738944e-05f, +3.829411831e-04f, +6.693628869e-04f, +8.145094672e-04f, +8.018070806e-04f, +6.566280172e-04f, +4.345091125e-04f, +2.010663923e-04f, +1.135750248e-05f, -1.041598752e-04f, -1.432187562e-04f, -1.254177052e-04f, - /* 24, 0 */ +4.545052445e-05f, +1.951315810e-04f, +3.748938080e-04f, +4.809335107e-04f, +3.960765690e-04f, +5.993810822e-05f, -4.723795438e-04f, -1.024325735e-03f, -1.361247582e-03f, -1.299302728e-03f, -8.046117557e-04f, -2.606329026e-05f, +7.618428442e-04f, +1.280408741e-03f, +1.370322771e-03f, +1.054089829e-03f, +5.086432784e-04f, -3.113193898e-05f, -3.825195300e-04f, -4.822884412e-04f, -3.849609275e-04f, -2.063256631e-04f, -5.270037440e-05f, +2.454794639e-05f, - /* 24, 1 */ +3.852332445e-05f, +1.840753178e-04f, +3.645444067e-04f, +4.788140096e-04f, +4.086121277e-04f, +8.793526572e-05f, -4.362135407e-04f, -9.937048198e-04f, -1.350562575e-03f, -1.316442769e-03f, -8.462280606e-04f, -7.815185270e-05f, +7.179801999e-04f, +1.259777116e-03f, +1.377758125e-03f, +1.082939175e-03f, +5.449481703e-04f, -1.547839432e-06f, -3.679388598e-04f, -4.828529979e-04f, -3.947147844e-04f, -2.176372792e-04f, -6.026901850e-05f, +2.205234045e-05f, - /* 24, 2 */ +3.192167036e-05f, +1.731761778e-04f, +3.539434193e-04f, +4.759566352e-04f, +4.201302650e-04f, +1.150943789e-04f, -4.002008253e-04f, -9.622858103e-04f, -1.338300241e-03f, -1.331815598e-03f, -8.866349827e-04f, -1.301264311e-04f, +6.730846905e-04f, +1.237427186e-03f, +1.383526171e-03f, +1.110816763e-03f, +5.812367254e-04f, +2.878109064e-05f, -3.523343557e-04f, -4.826023474e-04f, -4.041241778e-04f, -2.290451863e-04f, -6.815162122e-05f, +1.926869283e-05f, - /* 24, 3 */ +2.564752013e-05f, +1.624524653e-04f, +3.431211940e-04f, +4.723889014e-04f, +4.306369033e-04f, +1.413884897e-04f, -3.643958409e-04f, -9.301281119e-04f, -1.324495465e-03f, -1.345410999e-03f, -9.257779427e-04f, -1.819112698e-04f, +6.272190697e-04f, +1.213381290e-03f, +1.387602061e-03f, +1.137666624e-03f, +6.174506312e-04f, +5.981976836e-05f, -3.357077999e-04f, -4.815127015e-04f, -4.131577529e-04f, -2.405272085e-04f, -7.634234963e-05f, +1.618998833e-05f, - /* 24, 4 */ +1.970191739e-05f, +1.519214683e-04f, +3.321076713e-04f, +4.681390617e-04f, +4.401397816e-04f, +1.667927354e-04f, -3.288518263e-04f, -8.972916878e-04f, -1.309185436e-03f, -1.357221809e-03f, -9.636046528e-04f, -2.334309635e-04f, +5.804478655e-04f, +1.187664745e-03f, +1.389963631e-03f, +1.163433942e-03f, +6.535308606e-04f, +9.153116784e-05f, -3.180629927e-04f, -4.795613921e-04f, -4.217840695e-04f, -2.520602653e-04f, -8.483435780e-05f, +1.280977164e-05f, - /* 24, 5 */ +1.408501704e-05f, +1.415994448e-04f, +3.209323254e-04f, +4.632360317e-04f, +4.486484045e-04f, +1.912843645e-04f, -2.936207276e-04f, -8.638369381e-04f, -1.292409564e-03f, -1.367243913e-03f, -1.000065207e-03f, -2.846105957e-04f, +5.328372638e-04f, +1.160305814e-03f, +1.390591463e-03f, +1.188065177e-03f, +6.894177793e-04f, +1.238763650e-04f, -2.994057812e-04f, -4.767269440e-04f, -4.299716716e-04f, -2.636204028e-04f, -9.361977359e-05f, +9.122184539e-06f, - /* 24, 6 */ +8.796112429e-06f, +1.315016126e-04f, +3.096241086e-04f, +4.577093118e-04f, +4.561739887e-04f, +2.148427485e-04f, -2.587531149e-04f, -8.298245798e-04f, -1.274209383e-03f, -1.375476234e-03f, -1.035112163e-03f, -3.353758773e-04f, +4.844549899e-04f, +1.131335665e-03f, +1.389468944e-03f, +1.211508174e-03f, +7.250512548e-04f, +1.568145870e-04f, -2.797440842e-04f, -4.729891466e-04f, -4.376891593e-04f, -2.751828281e-04f, -1.026896878e-04f, +5.122002376e-06f, - /* 24, 7 */ +3.833664119e-06f, +1.216421408e-04f, +2.982113984e-04f, +4.515889092e-04f, +4.627294060e-04f, +2.374493875e-04f, -2.242981012e-04f, -7.953155261e-04f, -1.254628457e-03f, -1.381920720e-03f, -1.068700627e-03f, -3.856532828e-04f, +4.353701854e-04f, +1.100788324e-03f, +1.386582316e-03f, +1.233712281e-03f, +7.603707678e-04f, +1.903032668e-04f, -2.590879129e-04f, -4.683291247e-04f, -4.449052614e-04f, -2.867219458e-04f, -1.120341455e-04f, +8.046698450e-07f, - /* 24, 8 */ -8.046698450e-07f, +1.120341455e-04f, +2.867219458e-04f, +4.449052614e-04f, +4.683291247e-04f, +2.590879129e-04f, -1.903032668e-04f, -7.603707678e-04f, -1.233712281e-03f, -1.386582316e-03f, -1.100788324e-03f, -4.353701854e-04f, +3.856532828e-04f, +1.068700627e-03f, +1.381920720e-03f, +1.254628457e-03f, +7.953155261e-04f, +2.242981012e-04f, -2.374493875e-04f, -4.627294060e-04f, -4.515889092e-04f, -2.982113984e-04f, -1.216421408e-04f, -3.833664119e-06f, - /* 24, 9 */ -5.122002376e-06f, +1.026896878e-04f, +2.751828281e-04f, +4.376891593e-04f, +4.729891466e-04f, +2.797440842e-04f, -1.568145870e-04f, -7.250512548e-04f, -1.211508174e-03f, -1.389468944e-03f, -1.131335665e-03f, -4.844549899e-04f, +3.353758773e-04f, +1.035112163e-03f, +1.375476234e-03f, +1.274209383e-03f, +8.298245798e-04f, +2.587531149e-04f, -2.148427485e-04f, -4.561739887e-04f, -4.577093118e-04f, -3.096241086e-04f, -1.315016126e-04f, -8.796112429e-06f, - /* 24,10 */ -9.122184539e-06f, +9.361977359e-05f, +2.636204028e-04f, +4.299716716e-04f, +4.767269440e-04f, +2.994057812e-04f, -1.238763650e-04f, -6.894177793e-04f, -1.188065177e-03f, -1.390591463e-03f, -1.160305814e-03f, -5.328372638e-04f, +2.846105957e-04f, +1.000065207e-03f, +1.367243913e-03f, +1.292409564e-03f, +8.638369381e-04f, +2.936207276e-04f, -1.912843645e-04f, -4.486484045e-04f, -4.632360317e-04f, -3.209323254e-04f, -1.415994448e-04f, -1.408501704e-05f, - /* 24,11 */ -1.280977164e-05f, +8.483435780e-05f, +2.520602653e-04f, +4.217840695e-04f, +4.795613921e-04f, +3.180629927e-04f, -9.153116784e-05f, -6.535308606e-04f, -1.163433942e-03f, -1.389963631e-03f, -1.187664745e-03f, -5.804478655e-04f, +2.334309635e-04f, +9.636046528e-04f, +1.357221809e-03f, +1.309185436e-03f, +8.972916878e-04f, +3.288518263e-04f, -1.667927354e-04f, -4.401397816e-04f, -4.681390617e-04f, -3.321076713e-04f, -1.519214683e-04f, -1.970191739e-05f, - /* 24,12 */ -1.618998833e-05f, +7.634234963e-05f, +2.405272085e-04f, +4.131577529e-04f, +4.815127015e-04f, +3.357077999e-04f, -5.981976836e-05f, -6.174506312e-04f, -1.137666624e-03f, -1.387602061e-03f, -1.213381290e-03f, -6.272190697e-04f, +1.819112698e-04f, +9.257779427e-04f, +1.345410999e-03f, +1.324495465e-03f, +9.301281119e-04f, +3.643958409e-04f, -1.413884897e-04f, -4.306369033e-04f, -4.723889014e-04f, -3.431211940e-04f, -1.624524653e-04f, -2.564752013e-05f, - /* 24,13 */ -1.926869283e-05f, +6.815162122e-05f, +2.290451863e-04f, +4.041241778e-04f, +4.826023474e-04f, +3.523343557e-04f, -2.878109064e-05f, -5.812367254e-04f, -1.110816763e-03f, -1.383526171e-03f, -1.237427186e-03f, -6.730846905e-04f, +1.301264311e-04f, +8.866349827e-04f, +1.331815598e-03f, +1.338300241e-03f, +9.622858103e-04f, +4.002008253e-04f, -1.150943789e-04f, -4.201302650e-04f, -4.759566352e-04f, -3.539434193e-04f, -1.731761778e-04f, -3.192167036e-05f, - /* 24,14 */ -2.205234045e-05f, +6.026901850e-05f, +2.176372792e-04f, +3.947147844e-04f, +4.828529979e-04f, +3.679388598e-04f, +1.547839432e-06f, -5.449481703e-04f, -1.082939175e-03f, -1.377758125e-03f, -1.259777116e-03f, -7.179801999e-04f, +7.815185270e-05f, +8.462280606e-04f, +1.316442769e-03f, +1.350562575e-03f, +9.937048198e-04f, +4.362135407e-04f, -8.793526572e-05f, -4.086121277e-04f, -4.788140096e-04f, -3.645444067e-04f, -1.840753178e-04f, -3.852332445e-05f, - /* 24,15 */ -2.454794639e-05f, +5.270037440e-05f, +2.063256631e-04f, +3.849609275e-04f, +4.822884412e-04f, +3.825195300e-04f, +3.113193898e-05f, -5.086432784e-04f, -1.054089829e-03f, -1.370322771e-03f, -1.280408741e-03f, -7.618428442e-04f, +2.606329026e-05f, +8.046117557e-04f, +1.299302728e-03f, +1.361247582e-03f, +1.024325735e-03f, +4.723795438e-04f, -5.993810822e-05f, -3.960765690e-04f, -4.809335107e-04f, -3.748938080e-04f, -1.951315810e-04f, -4.545052445e-05f, - /* 24, 0 */ -1.702250368e-04f, -1.965005420e-04f, +1.103795304e-06f, +4.330784212e-04f, +8.784555707e-04f, +9.653328276e-04f, +4.315509563e-04f, -6.109575553e-04f, -1.641723450e-03f, -2.015827225e-03f, -1.400787443e-03f, -4.702498413e-05f, +1.332047630e-03f, +2.006889303e-03f, +1.690240096e-03f, +6.826705419e-04f, -3.776686811e-04f, -9.512688743e-04f, -8.983149818e-04f, -4.640234647e-04f, -2.230828855e-05f, +1.918067822e-04f, +1.759255972e-04f, +6.786242515e-05f, - /* 24, 1 */ -1.642126010e-04f, -2.002752798e-04f, -1.910126829e-05f, +4.022439121e-04f, +8.571608722e-04f, +9.768399670e-04f, +4.832977173e-04f, -5.392469404e-04f, -1.590532482e-03f, -2.020693110e-03f, -1.466475318e-03f, -1.409702826e-04f, +1.260398022e-03f, +1.993868298e-03f, +1.735939471e-03f, +7.542164043e-04f, -3.217397652e-04f, -9.346209288e-04f, -9.166430096e-04f, -4.949934945e-04f, -4.448641826e-05f, +1.861665779e-04f, +1.812738819e-04f, +7.451957718e-05f, - /* 24, 2 */ -1.579281336e-04f, -2.031605347e-04f, -3.828516688e-05f, +3.716026326e-04f, +8.345286135e-04f, +9.858238344e-04f, +5.328272649e-04f, -4.677058239e-04f, -1.536815378e-03f, -2.021508037e-03f, -1.528977139e-03f, -2.346018520e-04f, +1.185988431e-03f, +1.976763286e-03f, +1.778684302e-03f, +8.254237228e-04f, -2.638601140e-04f, -9.153683790e-04f, -9.333455225e-04f, -5.259003096e-04f, -6.760829922e-05f, +1.795547962e-04f, +1.862290729e-04f, +8.132190552e-05f, - /* 24, 3 */ -1.514107898e-04f, -2.051877883e-04f, -5.643017558e-05f, +3.412342375e-04f, +8.106578209e-04f, +9.923241157e-04f, +5.800651921e-04f, -3.964985305e-04f, -1.480725107e-03f, -2.018303000e-03f, -1.588167145e-03f, -3.277114722e-04f, +1.108975953e-03f, +1.955583535e-03f, +1.818343426e-03f, +8.961196099e-04f, -2.041325004e-04f, -8.934973649e-04f, -9.483306864e-04f, -5.566532714e-04f, -9.163993343e-05f, +1.719487619e-04f, +1.907500791e-04f, +8.824611727e-05f, - /* 24, 4 */ -1.446989102e-04f, -2.063902871e-04f, -7.352252002e-05f, +3.112151687e-04f, +7.856484910e-04f, +9.963864071e-04f, +6.249444785e-04f, -3.257861630e-04f, -1.422418959e-03f, -2.011118755e-03f, -1.643928243e-03f, -4.200923193e-04f, +1.029524574e-03f, +1.930348530e-03f, +1.854792197e-03f, +9.661301752e-04f, -1.426663759e-04f, -8.690009463e-04f, -9.615092978e-04f, -5.871595310e-04f, -1.165432034e-04f, +1.633284218e-04f, +1.947956873e-04f, +9.526723781e-05f, - /* 24, 5 */ -1.378299032e-04f, -2.068028652e-04f, -8.955230425e-05f, +2.816184974e-04f, +7.596012646e-04f, +9.980619660e-04f, +6.674055614e-04f, -2.557261963e-04f, -1.362058071e-03f, -2.000005648e-03f, -1.696152289e-03f, -5.115395181e-04f, +9.478047386e-04f, +1.901087985e-03f, +1.887912892e-03f, +1.035280999e-03f, -7.957765930e-05f, -8.418792522e-04f, -9.727951144e-04f, -6.173242692e-04f, -1.422758795e-04f, +1.536765045e-04f, +1.983247179e-04f, +1.023586489e-04f, - /* 24, 6 */ -1.308401336e-04f, -2.064617646e-04f, -1.045134271e-04f, +2.525137807e-04f, +7.326171060e-04f, +9.974074494e-04f, +7.073963828e-04f, -1.864720875e-04f, -1.299806951e-03f, -1.985023411e-03f, -1.744740344e-03f, -6.018506887e-04f, +8.639929140e-04f, +1.867841815e-03f, +1.917595086e-03f, +1.103397612e-03f, -1.498850339e-05f, -8.121396097e-04f, -9.821051828e-04f, -6.470509490e-04f, -1.687916421e-04f, +1.429786744e-04f, +2.012961856e-04f, +1.094921351e-04f, - /* 24, 7 */ -1.237648199e-04f, -2.054044567e-04f, -1.184034872e-04f, +2.239669341e-04f, +7.047969872e-04f, +9.944846402e-04f, +7.448724134e-04f, -1.181729029e-04f, -1.235832990e-03f, -1.966240936e-03f, -1.789602898e-03f, -6.908264855e-04f, +7.782711267e-04f, +1.830660078e-03f, +1.943736019e-03f, +1.170305979e-03f, +5.097296116e-05f, -7.797966533e-04f, -9.893601617e-04f, -6.762415789e-04f, -1.960401183e-04f, +1.312236785e-04f, +2.036694644e-04f, +1.166379381e-04f, - /* 24, 8 */ -1.166379381e-04f, -2.036694644e-04f, -1.312236785e-04f, +1.960401183e-04f, +6.762415789e-04f, +9.893601617e-04f, +7.797966533e-04f, -5.097296116e-05f, -1.170305979e-03f, -1.943736019e-03f, -1.830660078e-03f, -7.782711267e-04f, +6.908264855e-04f, +1.789602898e-03f, +1.966240936e-03f, +1.235832990e-03f, +1.181729029e-04f, -7.448724134e-04f, -9.944846402e-04f, -7.047969872e-04f, -2.239669341e-04f, +1.184034872e-04f, +2.054044567e-04f, +1.237648199e-04f, - /* 24, 9 */ -1.094921351e-04f, -2.012961856e-04f, -1.429786744e-04f, +1.687916421e-04f, +6.470509490e-04f, +9.821051828e-04f, +8.121396097e-04f, +1.498850339e-05f, -1.103397612e-03f, -1.917595086e-03f, -1.867841815e-03f, -8.639929140e-04f, +6.018506887e-04f, +1.744740344e-03f, +1.985023411e-03f, +1.299806951e-03f, +1.864720875e-04f, -7.073963828e-04f, -9.974074494e-04f, -7.326171060e-04f, -2.525137807e-04f, +1.045134271e-04f, +2.064617646e-04f, +1.308401336e-04f, - /* 24,10 */ -1.023586489e-04f, -1.983247179e-04f, -1.536765045e-04f, +1.422758795e-04f, +6.173242692e-04f, +9.727951144e-04f, +8.418792522e-04f, +7.957765930e-05f, -1.035280999e-03f, -1.887912892e-03f, -1.901087985e-03f, -9.478047386e-04f, +5.115395181e-04f, +1.696152289e-03f, +2.000005648e-03f, +1.362058071e-03f, +2.557261963e-04f, -6.674055614e-04f, -9.980619660e-04f, -7.596012646e-04f, -2.816184974e-04f, +8.955230425e-05f, +2.068028652e-04f, +1.378299032e-04f, - /* 24,11 */ -9.526723781e-05f, -1.947956873e-04f, -1.633284218e-04f, +1.165432034e-04f, +5.871595310e-04f, +9.615092978e-04f, +8.690009463e-04f, +1.426663759e-04f, -9.661301752e-04f, -1.854792197e-03f, -1.930348530e-03f, -1.029524574e-03f, +4.200923193e-04f, +1.643928243e-03f, +2.011118755e-03f, +1.422418959e-03f, +3.257861630e-04f, -6.249444785e-04f, -9.963864071e-04f, -7.856484910e-04f, -3.112151687e-04f, +7.352252002e-05f, +2.063902871e-04f, +1.446989102e-04f, - /* 24,12 */ -8.824611727e-05f, -1.907500791e-04f, -1.719487619e-04f, +9.163993343e-05f, +5.566532714e-04f, +9.483306864e-04f, +8.934973649e-04f, +2.041325004e-04f, -8.961196099e-04f, -1.818343426e-03f, -1.955583535e-03f, -1.108975953e-03f, +3.277114722e-04f, +1.588167145e-03f, +2.018303000e-03f, +1.480725107e-03f, +3.964985305e-04f, -5.800651921e-04f, -9.923241157e-04f, -8.106578209e-04f, -3.412342375e-04f, +5.643017558e-05f, +2.051877883e-04f, +1.514107898e-04f, - /* 24,13 */ -8.132190552e-05f, -1.862290729e-04f, -1.795547962e-04f, +6.760829922e-05f, +5.259003096e-04f, +9.333455225e-04f, +9.153683790e-04f, +2.638601140e-04f, -8.254237228e-04f, -1.778684302e-03f, -1.976763286e-03f, -1.185988431e-03f, +2.346018520e-04f, +1.528977139e-03f, +2.021508037e-03f, +1.536815378e-03f, +4.677058239e-04f, -5.328272649e-04f, -9.858238344e-04f, -8.345286135e-04f, -3.716026326e-04f, +3.828516688e-05f, +2.031605347e-04f, +1.579281336e-04f, - /* 24,14 */ -7.451957718e-05f, -1.812738819e-04f, -1.861665779e-04f, +4.448641826e-05f, +4.949934945e-04f, +9.166430096e-04f, +9.346209288e-04f, +3.217397652e-04f, -7.542164043e-04f, -1.735939471e-03f, -1.993868298e-03f, -1.260398022e-03f, +1.409702826e-04f, +1.466475318e-03f, +2.020693110e-03f, +1.590532482e-03f, +5.392469404e-04f, -4.832977173e-04f, -9.768399670e-04f, -8.571608722e-04f, -4.022439121e-04f, +1.910126829e-05f, +2.002752798e-04f, +1.642126010e-04f, - /* 24,15 */ -6.786242515e-05f, -1.759255972e-04f, -1.918067822e-04f, +2.230828855e-05f, +4.640234647e-04f, +8.983149818e-04f, +9.512688743e-04f, +3.776686811e-04f, -6.826705419e-04f, -1.690240096e-03f, -2.006889303e-03f, -1.332047630e-03f, +4.702498413e-05f, +1.400787443e-03f, +2.015827225e-03f, +1.641723450e-03f, +6.109575553e-04f, -4.315509563e-04f, -9.653328276e-04f, -8.784555707e-04f, -4.330784212e-04f, -1.103795304e-06f, +1.965005420e-04f, +1.702250368e-04f, - /* 24, 0 */ +3.919255962e-05f, -2.280943782e-04f, -5.361345988e-04f, -4.457457641e-04f, +2.990589649e-04f, +1.295797675e-03f, +1.605517166e-03f, +5.875816565e-04f, -1.289084098e-03f, -2.596166105e-03f, -2.129939921e-03f, -7.496988250e-05f, +2.037180601e-03f, +2.625542335e-03f, +1.404160874e-03f, -4.837783526e-04f, -1.582480410e-03f, -1.345619201e-03f, -3.621830939e-04f, +4.180945199e-04f, +5.469818219e-04f, +2.499414065e-04f, -2.888372260e-05f, -8.895700627e-05f, - /* 24, 1 */ +4.853777483e-05f, -2.065137544e-04f, -5.236754574e-04f, -4.705972357e-04f, +2.371311675e-04f, +1.243196859e-03f, +1.622959247e-03f, +6.876650067e-04f, -1.171710060e-03f, -2.559351067e-03f, -2.215991331e-03f, -2.246678327e-04f, +1.937986318e-03f, +2.647321756e-03f, +1.516528605e-03f, -3.765445934e-04f, -1.553807591e-03f, -1.392405213e-03f, -4.263006320e-04f, +3.876486968e-04f, +5.560961676e-04f, +2.719611444e-04f, -1.761075235e-05f, -9.068976925e-05f, - /* 24, 2 */ +5.692498928e-05f, -1.852878923e-04f, -5.097279107e-04f, -4.926555685e-04f, +1.765921503e-04f, +1.188077447e-03f, +1.634867875e-03f, +7.837567953e-04f, -1.052453928e-03f, -2.515280079e-03f, -2.295086316e-03f, -3.736412373e-04f, +1.832653524e-03f, +2.661371990e-03f, +1.625780509e-03f, -2.661868955e-04f, -1.519477670e-03f, -1.435905115e-03f, -4.911987788e-04f, +3.544256494e-04f, +5.633598944e-04f, +2.940548284e-04f, -5.378471232e-06f, -9.187426948e-05f, - /* 24, 3 */ +6.436469025e-05f, -1.644995777e-04f, -4.944173708e-04f, -5.119388451e-04f, +1.176233517e-04f, +1.130703462e-03f, +1.641323506e-03f, +8.756040923e-04f, -9.317326579e-04f, -2.464159993e-03f, -2.367001633e-03f, -5.214100591e-04f, +1.721501142e-03f, +2.667586958e-03f, +1.731516399e-03f, -1.530278412e-04f, -1.479490407e-03f, -1.475875084e-03f, -5.566555092e-04f, +3.184551797e-04f, +5.686591450e-04f, +3.161189305e-04f, +7.802761507e-06f, -9.246489856e-05f, - /* 24, 4 */ +7.087197068e-05f, -1.442258278e-04f, -4.778705046e-04f, -5.284761768e-04f, +6.039472401e-05f, +1.071341110e-03f, +1.642425167e-03f, +9.629733481e-04f, -8.099633882e-04f, -2.406220702e-03f, -2.431540042e-03f, -6.674987371e-04f, +1.604869446e-03f, +2.665887444e-03f, +1.833344283e-03f, -3.740504807e-05f, -1.433866725e-03f, -1.512079220e-03f, -6.224402836e-04f, +2.797797731e-04f, +5.718846156e-04f, +3.380454975e-04f, +2.191686946e-05f, -9.241721523e-05f, - /* 24, 5 */ +7.646625331e-05f, -1.245377292e-04f, -4.602146020e-04f, -5.423072437e-04f, +5.064318866e-06f, +1.010257658e-03f, +1.638289725e-03f, +1.045651008e-03f, -6.875618648e-04f, -2.341714107e-03f, -2.488530931e-03f, -8.114379517e-04f, +1.483118851e-03f, +2.656221571e-03f, +1.930881931e-03f, +8.032993590e-05f, -1.382648990e-03f, -1.544290670e-03f, -6.883148110e-04f, +2.384547825e-04f, +5.729322223e-04f, +3.597225244e-04f, +3.694190340e-05f, -9.168826568e-05f, - /* 24, 6 */ +8.117100143e-05f, -1.055003114e-04f, -4.415769617e-04f, -5.534817998e-04f, -4.822206513e-05f, +9.477203224e-04f, +1.629051096e-03f, +1.123444034e-03f, -5.649408783e-04f, -2.270913001e-03f, -2.537830838e-03f, -9.527663633e-04f, +1.356628624e-03f, +2.638565156e-03f, +2.023758423e-03f, +1.998128074e-04f, -1.325901212e-03f, -1.572292748e-03f, -7.540338642e-04f, +1.945485578e-04f, +5.717037624e-04f, +3.810343609e-04f, +5.284991195e-05f, -9.023690790e-05f, - /* 24, 7 */ +8.501341847e-05f, -8.717245610e-05f, -4.220842946e-04f, -5.620591450e-04f, -9.933117260e-05f, +8.839951872e-04f, +1.614859393e-03f, +1.196180345e-03f, -4.425087329e-04f, -2.194109877e-03f, -2.579323863e-03f, -1.091032318e-03f, +1.225795515e-03f, +2.612921966e-03f, +2.111615667e-03f, +3.206677492e-04f, -1.263709151e-03f, -1.595880025e-03f, -8.193461436e-04f, +1.481425192e-04f, +5.681075679e-04f, +4.018621494e-04f, +6.960683992e-05f, -8.802413824e-05f, - /* 24, 8 */ +8.802413824e-05f, -6.960683992e-05f, -4.018621494e-04f, -5.681075679e-04f, -1.481425192e-04f, +8.193461436e-04f, +1.595880025e-03f, +1.263709151e-03f, -3.206677492e-04f, -2.111615667e-03f, -2.612921966e-03f, -1.225795515e-03f, +1.091032318e-03f, +2.579323863e-03f, +2.194109877e-03f, +4.425087329e-04f, -1.196180345e-03f, -1.614859393e-03f, -8.839951872e-04f, +9.933117260e-05f, +5.620591450e-04f, +4.220842946e-04f, +8.717245610e-05f, -8.501341847e-05f, - /* 24, 9 */ +9.023690790e-05f, -5.284991195e-05f, -3.810343609e-04f, -5.717037624e-04f, -1.945485578e-04f, +7.540338642e-04f, +1.572292748e-03f, +1.325901212e-03f, -1.998128074e-04f, -2.023758423e-03f, -2.638565156e-03f, -1.356628624e-03f, +9.527663633e-04f, +2.537830838e-03f, +2.270913001e-03f, +5.649408783e-04f, -1.123444034e-03f, -1.629051096e-03f, -9.477203224e-04f, +4.822206513e-05f, +5.534817998e-04f, +4.415769617e-04f, +1.055003114e-04f, -8.117100143e-05f, - /* 24,10 */ +9.168826568e-05f, -3.694190340e-05f, -3.597225244e-04f, -5.729322223e-04f, -2.384547825e-04f, +6.883148110e-04f, +1.544290670e-03f, +1.382648990e-03f, -8.032993590e-05f, -1.930881931e-03f, -2.656221571e-03f, -1.483118851e-03f, +8.114379517e-04f, +2.488530931e-03f, +2.341714107e-03f, +6.875618648e-04f, -1.045651008e-03f, -1.638289725e-03f, -1.010257658e-03f, -5.064318866e-06f, +5.423072437e-04f, +4.602146020e-04f, +1.245377292e-04f, -7.646625331e-05f, - /* 24,11 */ +9.241721523e-05f, -2.191686946e-05f, -3.380454975e-04f, -5.718846156e-04f, -2.797797731e-04f, +6.224402836e-04f, +1.512079220e-03f, +1.433866725e-03f, +3.740504807e-05f, -1.833344283e-03f, -2.665887444e-03f, -1.604869446e-03f, +6.674987371e-04f, +2.431540042e-03f, +2.406220702e-03f, +8.099633882e-04f, -9.629733481e-04f, -1.642425167e-03f, -1.071341110e-03f, -6.039472401e-05f, +5.284761768e-04f, +4.778705046e-04f, +1.442258278e-04f, -7.087197068e-05f, - /* 24,12 */ +9.246489856e-05f, -7.802761507e-06f, -3.161189305e-04f, -5.686591450e-04f, -3.184551797e-04f, +5.566555092e-04f, +1.475875084e-03f, +1.479490407e-03f, +1.530278412e-04f, -1.731516399e-03f, -2.667586958e-03f, -1.721501142e-03f, +5.214100591e-04f, +2.367001633e-03f, +2.464159993e-03f, +9.317326579e-04f, -8.756040923e-04f, -1.641323506e-03f, -1.130703462e-03f, -1.176233517e-04f, +5.119388451e-04f, +4.944173708e-04f, +1.644995777e-04f, -6.436469025e-05f, - /* 24,13 */ +9.187426948e-05f, +5.378471232e-06f, -2.940548284e-04f, -5.633598944e-04f, -3.544256494e-04f, +4.911987788e-04f, +1.435905115e-03f, +1.519477670e-03f, +2.661868955e-04f, -1.625780509e-03f, -2.661371990e-03f, -1.832653524e-03f, +3.736412373e-04f, +2.295086316e-03f, +2.515280079e-03f, +1.052453928e-03f, -7.837567953e-04f, -1.634867875e-03f, -1.188077447e-03f, -1.765921503e-04f, +4.926555685e-04f, +5.097279107e-04f, +1.852878923e-04f, -5.692498928e-05f, - /* 24,14 */ +9.068976925e-05f, +1.761075235e-05f, -2.719611444e-04f, -5.560961676e-04f, -3.876486968e-04f, +4.263006320e-04f, +1.392405213e-03f, +1.553807591e-03f, +3.765445934e-04f, -1.516528605e-03f, -2.647321756e-03f, -1.937986318e-03f, +2.246678327e-04f, +2.215991331e-03f, +2.559351067e-03f, +1.171710060e-03f, -6.876650067e-04f, -1.622959247e-03f, -1.243196859e-03f, -2.371311675e-04f, +4.705972357e-04f, +5.236754574e-04f, +2.065137544e-04f, -4.853777483e-05f, - /* 24,15 */ +8.895700627e-05f, +2.888372260e-05f, -2.499414065e-04f, -5.469818219e-04f, -4.180945199e-04f, +3.621830939e-04f, +1.345619201e-03f, +1.582480410e-03f, +4.837783526e-04f, -1.404160874e-03f, -2.625542335e-03f, -2.037180601e-03f, +7.496988250e-05f, +2.129939921e-03f, +2.596166105e-03f, +1.289084098e-03f, -5.875816565e-04f, -1.605517166e-03f, -1.295797675e-03f, -2.990589649e-04f, +4.457457641e-04f, +5.361345988e-04f, +2.280943782e-04f, -3.919255962e-05f, - /* 24, 0 */ +1.848082291e-04f, +3.126544607e-04f, -8.381805218e-05f, -8.698090905e-04f, -1.028447094e-03f, +2.139154673e-04f, +1.954115341e-03f, +2.095678120e-03f, -1.635717275e-04f, -2.819157299e-03f, -2.940044791e-03f, -1.098945345e-04f, +2.833179926e-03f, +2.923929522e-03f, +3.511165299e-04f, -2.017938339e-03f, -2.030476715e-03f, -3.277888569e-04f, +9.926761418e-04f, +9.110442493e-04f, +1.284872781e-04f, -3.065935448e-04f, -1.998565163e-04f, +7.803305534e-06f, - /* 24, 1 */ +1.695814378e-04f, +3.164556508e-04f, -4.103650150e-05f, -8.260698464e-04f, -1.058100498e-03f, +1.024893805e-04f, +1.871044125e-03f, +2.162944507e-03f, +2.203366063e-05f, -2.703524226e-03f, -3.034115138e-03f, -3.291928088e-04f, +2.713944640e-03f, +3.017272284e-03f, +5.397663057e-04f, -1.929900383e-03f, -2.099607997e-03f, -4.436146208e-04f, +9.507629285e-04f, +9.494468230e-04f, +1.748714247e-04f, -2.981837386e-04f, -2.146007649e-04f, -5.699432396e-07f, - /* 24, 2 */ +1.542962580e-04f, +3.180964801e-04f, -2.971107404e-07f, -7.801571616e-04f, -1.081692695e-03f, -6.019646704e-06f, +1.781805749e-03f, +2.219616197e-03f, +2.048848004e-04f, -2.577645910e-03f, -3.115029215e-03f, -5.470211463e-04f, +2.582823494e-03f, +3.098667200e-03f, +7.286710477e-04f, -1.831793311e-03f, -2.161014579e-03f, -5.608747689e-04f, +9.027154107e-04f, +9.846924856e-04f, +2.227798586e-04f, -2.873471247e-04f, -2.289106872e-04f, -9.773337074e-06f, - /* 24, 3 */ +1.390667857e-04f, +3.176854393e-04f, +3.826416878e-05f, -7.324018434e-04f, -1.099310451e-03f, -1.111689527e-04f, +1.686962051e-03f, +2.265625589e-03f, +3.841903571e-04f, -2.442181508e-03f, -3.182489175e-03f, -7.624077328e-04f, +2.440359294e-03f, +3.167649091e-03f, +9.169693475e-04f, -1.723899657e-03f, -2.214230624e-03f, -6.790305367e-04f, +8.485750922e-04f, +1.016463150e-03f, +2.720045869e-04f, -2.740180422e-04f, -2.426519708e-04f, -1.978701792e-05f, - /* 24, 4 */ +1.240005643e-04f, +3.153390489e-04f, +7.453005747e-05f, -6.831329371e-04f, -1.111069621e-03f, -2.125447010e-04f, +1.587090707e-03f, +2.300958285e-03f, +5.591862212e-04f, -2.297830066e-03f, -3.236262287e-03f, -9.743929228e-04f, +2.287150577e-03f, +3.223808711e-03f, +1.103792665e-03f, -1.606554759e-03f, -2.258822083e-03f, -7.975248409e-04f, +7.884177261e-04f, +1.044449054e-03f, +3.223209063e-04f, -2.581440514e-04f, -2.556870681e-04f, -3.058317705e-05f, - /* 24, 5 */ +1.091981202e-04f, +3.111807515e-04f, +1.084019636e-04f, -6.326758693e-04f, -1.117113666e-03f, -3.097634105e-04f, +1.482781879e-03f, +2.325652312e-03f, +7.291390495e-04f, -2.145326692e-03f, -3.276181809e-03f, -1.182034015e-03f, +2.123848782e-03f, +3.266795190e-03f, +1.288269679e-03f, -1.480145805e-03f, -2.294389599e-03f, -9.157848908e-04f, +7.223538352e-04f, +1.068350860e-03f, +3.734881809e-04f, -2.396868442e-04f, -2.678760406e-04f, -4.212586861e-05f, - /* 24, 6 */ +9.475256757e-05f, +3.053397988e-04f, +1.397998805e-04f, -5.813506695e-04f, -1.117612060e-03f, -4.024732802e-04f, +1.374634870e-03f, +2.339797075e-03f, +8.933496022e-04f, -1.985438555e-03f, -3.302147511e-03f, -1.384409934e-03f, +1.951155148e-03f, +3.296318191e-03f, +1.469530695e-03f, -1.345110577e-03f, -2.320571262e-03f, -1.033224945e-03f, +6.505290403e-04f, +1.087881752e-03f, +4.252507475e-04f, -2.186230940e-04f, -2.790774568e-04f, -5.437087857e-05f, - /* 24, 7 */ +8.074928352e-05f, +2.979501429e-04f, +1.686621699e-04f, -5.294702777e-04f, -1.112758583e-03f, -4.903553074e-04f, +1.263254779e-03f, +2.343532047e-03f, +1.051155860e-03f, -1.818960757e-03f, -3.314125843e-03f, -1.580625796e-03f, +1.769817333e-03f, +3.312149758e-03f, +1.646712089e-03f, -1.201935910e-03f, -2.337045209e-03f, -1.149249197e-03f, +5.731241934e-04f, +1.102769514e-03f, +4.773389469e-04f, -1.949452358e-04f, -2.891493374e-04f, -6.726565227e-05f, - /* 24, 8 */ +6.726565227e-05f, +2.891493374e-04f, +1.949452358e-04f, -4.773389469e-04f, -1.102769514e-03f, -5.731241934e-04f, +1.149249197e-03f, +2.337045209e-03f, +1.201935910e-03f, -1.646712089e-03f, -3.312149758e-03f, -1.769817333e-03f, +1.580625796e-03f, +3.314125843e-03f, +1.818960757e-03f, -1.051155860e-03f, -2.343532047e-03f, -1.263254779e-03f, +4.903553074e-04f, +1.112758583e-03f, +5.294702777e-04f, -1.686621699e-04f, -2.979501429e-04f, -8.074928352e-05f, - /* 24, 9 */ +5.437087857e-05f, +2.790774568e-04f, +2.186230940e-04f, -4.252507475e-04f, -1.087881752e-03f, -6.505290403e-04f, +1.033224945e-03f, +2.320571262e-03f, +1.345110577e-03f, -1.469530695e-03f, -3.296318191e-03f, -1.951155148e-03f, +1.384409934e-03f, +3.302147511e-03f, +1.985438555e-03f, -8.933496022e-04f, -2.339797075e-03f, -1.374634870e-03f, +4.024732802e-04f, +1.117612060e-03f, +5.813506695e-04f, -1.397998805e-04f, -3.053397988e-04f, -9.475256757e-05f, - /* 24,10 */ +4.212586861e-05f, +2.678760406e-04f, +2.396868442e-04f, -3.734881809e-04f, -1.068350860e-03f, -7.223538352e-04f, +9.157848908e-04f, +2.294389599e-03f, +1.480145805e-03f, -1.288269679e-03f, -3.266795190e-03f, -2.123848782e-03f, +1.182034015e-03f, +3.276181809e-03f, +2.145326692e-03f, -7.291390495e-04f, -2.325652312e-03f, -1.482781879e-03f, +3.097634105e-04f, +1.117113666e-03f, +6.326758693e-04f, -1.084019636e-04f, -3.111807515e-04f, -1.091981202e-04f, - /* 24,11 */ +3.058317705e-05f, +2.556870681e-04f, +2.581440514e-04f, -3.223209063e-04f, -1.044449054e-03f, -7.884177261e-04f, +7.975248409e-04f, +2.258822083e-03f, +1.606554759e-03f, -1.103792665e-03f, -3.223808711e-03f, -2.287150577e-03f, +9.743929228e-04f, +3.236262287e-03f, +2.297830066e-03f, -5.591862212e-04f, -2.300958285e-03f, -1.587090707e-03f, +2.125447010e-04f, +1.111069621e-03f, +6.831329371e-04f, -7.453005747e-05f, -3.153390489e-04f, -1.240005643e-04f, - /* 24,12 */ +1.978701792e-05f, +2.426519708e-04f, +2.740180422e-04f, -2.720045869e-04f, -1.016463150e-03f, -8.485750922e-04f, +6.790305367e-04f, +2.214230624e-03f, +1.723899657e-03f, -9.169693475e-04f, -3.167649091e-03f, -2.440359294e-03f, +7.624077328e-04f, +3.182489175e-03f, +2.442181508e-03f, -3.841903571e-04f, -2.265625589e-03f, -1.686962051e-03f, +1.111689527e-04f, +1.099310451e-03f, +7.324018434e-04f, -3.826416878e-05f, -3.176854393e-04f, -1.390667857e-04f, - /* 24,13 */ +9.773337074e-06f, +2.289106872e-04f, +2.873471247e-04f, -2.227798586e-04f, -9.846924856e-04f, -9.027154107e-04f, +5.608747689e-04f, +2.161014579e-03f, +1.831793311e-03f, -7.286710477e-04f, -3.098667200e-03f, -2.582823494e-03f, +5.470211463e-04f, +3.115029215e-03f, +2.577645910e-03f, -2.048848004e-04f, -2.219616197e-03f, -1.781805749e-03f, +6.019646704e-06f, +1.081692695e-03f, +7.801571616e-04f, +2.971107404e-07f, -3.180964801e-04f, -1.542962580e-04f, - /* 24,14 */ +5.699432396e-07f, +2.146007649e-04f, +2.981837386e-04f, -1.748714247e-04f, -9.494468230e-04f, -9.507629285e-04f, +4.436146208e-04f, +2.099607997e-03f, +1.929900383e-03f, -5.397663057e-04f, -3.017272284e-03f, -2.713944640e-03f, +3.291928088e-04f, +3.034115138e-03f, +2.703524226e-03f, -2.203366063e-05f, -2.162944507e-03f, -1.871044125e-03f, -1.024893805e-04f, +1.058100498e-03f, +8.260698464e-04f, +4.103650150e-05f, -3.164556508e-04f, -1.695814378e-04f, - /* 24,15 */ -7.803305534e-06f, +1.998565163e-04f, +3.065935448e-04f, -1.284872781e-04f, -9.110442493e-04f, -9.926761418e-04f, +3.277888569e-04f, +2.030476715e-03f, +2.017938339e-03f, -3.511165299e-04f, -2.923929522e-03f, -2.833179926e-03f, +1.098945345e-04f, +2.940044791e-03f, +2.819157299e-03f, +1.635717275e-04f, -2.095678120e-03f, -1.954115341e-03f, -2.139154673e-04f, +1.028447094e-03f, +8.698090905e-04f, +8.381805218e-05f, -3.126544607e-04f, -1.848082291e-04f, - /* 24, 0 */ -1.364396009e-04f, -7.446376994e-05f, +5.066257662e-04f, +2.030015760e-04f, -9.054261715e-04f, -1.195525937e-03f, +4.683850093e-04f, +2.213825561e-03f, +1.188944940e-03f, -1.856378227e-03f, -2.833970964e-03f, -1.144377463e-04f, +2.758138339e-03f, +2.020697482e-03f, -1.023174933e-03f, -2.248631080e-03f, -6.097868283e-04f, +1.146194663e-03f, +9.693248739e-04f, -1.479047908e-04f, -5.177782008e-04f, -1.250536964e-04f, +1.414906982e-04f, +2.710774794e-05f, - /* 24, 1 */ -1.307026563e-04f, -8.975162518e-05f, +4.924131238e-04f, +2.542107757e-04f, -8.382130226e-04f, -1.235986710e-03f, +3.277877666e-04f, +2.166758574e-03f, +1.345406789e-03f, -1.683014413e-03f, -2.893234801e-03f, -3.426248829e-04f, +2.666119545e-03f, +2.174888063e-03f, -8.489895579e-04f, -2.270723567e-03f, -7.511023835e-04f, +1.088054225e-03f, +1.029345157e-03f, -8.915647260e-05f, -5.256253050e-04f, -1.535492882e-04f, +1.457592711e-04f, +3.374854096e-05f, - /* 24, 2 */ -1.243758393e-04f, -1.032931784e-04f, +4.753985127e-04f, +3.013338450e-04f, -7.682542954e-04f, -1.267577330e-03f, +1.888607322e-04f, +2.107952975e-03f, +1.491738775e-03f, -1.501737881e-03f, -2.935653267e-03f, -5.687514710e-04f, +2.558401145e-03f, +2.317921172e-03f, -6.673475630e-04f, -2.279727032e-03f, -8.914213340e-04f, +1.021228789e-03f, +1.084932315e-03f, -2.702967135e-05f, -5.299376467e-04f, -1.826837732e-04f, +1.491486840e-04f, +4.073257728e-05f, - /* 24, 3 */ -1.175537217e-04f, -1.151066589e-04f, +4.558506985e-04f, +3.442099484e-04f, -6.961194660e-04f, -1.290358261e-03f, +5.243891240e-05f, +2.037998203e-03f, +1.627194859e-03f, -1.313720334e-03f, -2.961057174e-03f, -7.914588446e-04f, +2.435570833e-03f, +2.448830599e-03f, -4.792680017e-04f, -2.275344863e-03f, -1.029819797e-03f, +9.459060659e-04f, +1.135545329e-03f, +3.816638860e-05f, -5.305040204e-04f, -2.122423012e-04f, +1.515631236e-04f, +4.801831197e-05f, - /* 24, 4 */ -1.103288160e-04f, -1.252215041e-04f, +4.340463917e-04f, +3.827158599e-04f, -6.223744454e-04f, -1.304448109e-03f, -8.067840470e-05f, +1.957545178e-03f, +1.751108674e-03f, -1.120165265e-03f, -2.969385358e-03f, -1.009410776e-03f, +2.298313921e-03f, +2.566719612e-03f, -2.858241016e-04f, -2.257363134e-03f, -1.165366520e-03f, +8.623375551e-04f, +1.180661312e-03f, +1.060874480e-04f, -5.271339238e-04f, -2.419953224e-04f, +1.529084143e-04f, +5.555842361e-05f, - /* 24, 5 */ -1.027909684e-04f, -1.336775649e-04f, +4.102676936e-04f, +4.167655723e-04f, -5.475775503e-04f, -1.310021272e-03f, -2.097323863e-04f, +1.867300846e-03f, +1.862896930e-03f, -9.222997333e-04f, -2.960684559e-03f, -1.221302229e-03f, +2.147409148e-03f, +2.670767418e-03f, -8.813668768e-05f, -2.225653372e-03f, -1.297129225e-03f, +7.708383352e-04f, +1.219779926e-03f, +1.763556677e-04f, -5.196599496e-04f, -2.716999419e-04f, +1.530928622e-04f, +6.329988035e-05f, - /* 24, 6 */ -9.502680145e-05f, -1.405242734e-04f, +3.847995909e-04f, +4.463096266e-04f, -4.722756447e-04f, -1.307305241e-03f, -3.340090076e-04f, +1.768022423e-03f, +1.962062202e-03f, -7.213660470e-04f, -2.935108571e-03f, -1.425867893e-03f, +1.983723834e-03f, +2.760235146e-03f, +1.126327965e-04f, -2.180174758e-03f, -1.424181074e-03f, +6.717863708e-04f, +1.252427754e-03f, +2.485613970e-04f, -5.079400707e-04f, -3.011014490e-04f, +1.520281231e-04f, +7.118405837e-05f, - /* 24, 7 */ -8.711921055e-05f, -1.458197836e-04f, +3.579275186e-04f, +4.713341756e-04f, -3.970004792e-04f, -1.296577576e-03f, -4.528429958e-04f, +1.660511380e-03f, +2.048195092e-03f, -5.186134147e-04f, -2.892916666e-03f, -1.621890436e-03f, +1.808208423e-03f, +2.834471303e-03f, +3.152896222e-04f, -2.120975750e-03f, -1.545607217e-03f, +5.656213428e-04f, +1.278162587e-03f, +3.222652495e-04f, -4.918597964e-04f, -3.299350101e-04f, +1.496300883e-04f, +7.914691395e-05f, - /* 24, 8 */ -7.914691395e-05f, -1.496300883e-04f, +3.299350101e-04f, +4.918597964e-04f, -3.222652495e-04f, -1.278162587e-03f, -5.656213428e-04f, +1.545607217e-03f, +2.120975750e-03f, -3.152896222e-04f, -2.834471303e-03f, -1.808208423e-03f, +1.621890436e-03f, +2.892916666e-03f, +5.186134147e-04f, -2.048195092e-03f, -1.660511380e-03f, +4.528429958e-04f, +1.296577576e-03f, +3.970004792e-04f, -4.713341756e-04f, -3.579275186e-04f, +1.458197836e-04f, +8.711921055e-05f, - /* 24, 9 */ -7.118405837e-05f, -1.520281231e-04f, +3.011014490e-04f, +5.079400707e-04f, -2.485613970e-04f, -1.252427754e-03f, -6.717863708e-04f, +1.424181074e-03f, +2.180174758e-03f, -1.126327965e-04f, -2.760235146e-03f, -1.983723834e-03f, +1.425867893e-03f, +2.935108571e-03f, +7.213660470e-04f, -1.962062202e-03f, -1.768022423e-03f, +3.340090076e-04f, +1.307305241e-03f, +4.722756447e-04f, -4.463096266e-04f, -3.847995909e-04f, +1.405242734e-04f, +9.502680145e-05f, - /* 24,10 */ -6.329988035e-05f, -1.530928622e-04f, +2.716999419e-04f, +5.196599496e-04f, -1.763556677e-04f, -1.219779926e-03f, -7.708383352e-04f, +1.297129225e-03f, +2.225653372e-03f, +8.813668768e-05f, -2.670767418e-03f, -2.147409148e-03f, +1.221302229e-03f, +2.960684559e-03f, +9.222997333e-04f, -1.862896930e-03f, -1.867300846e-03f, +2.097323863e-04f, +1.310021272e-03f, +5.475775503e-04f, -4.167655723e-04f, -4.102676936e-04f, +1.336775649e-04f, +1.027909684e-04f, - /* 24,11 */ -5.555842361e-05f, -1.529084143e-04f, +2.419953224e-04f, +5.271339238e-04f, -1.060874480e-04f, -1.180661312e-03f, -8.623375551e-04f, +1.165366520e-03f, +2.257363134e-03f, +2.858241016e-04f, -2.566719612e-03f, -2.298313921e-03f, +1.009410776e-03f, +2.969385358e-03f, +1.120165265e-03f, -1.751108674e-03f, -1.957545178e-03f, +8.067840470e-05f, +1.304448109e-03f, +6.223744454e-04f, -3.827158599e-04f, -4.340463917e-04f, +1.252215041e-04f, +1.103288160e-04f, - /* 24,12 */ -4.801831197e-05f, -1.515631236e-04f, +2.122423012e-04f, +5.305040204e-04f, -3.816638860e-05f, -1.135545329e-03f, -9.459060659e-04f, +1.029819797e-03f, +2.275344863e-03f, +4.792680017e-04f, -2.448830599e-03f, -2.435570833e-03f, +7.914588446e-04f, +2.961057174e-03f, +1.313720334e-03f, -1.627194859e-03f, -2.037998203e-03f, -5.243891240e-05f, +1.290358261e-03f, +6.961194660e-04f, -3.442099484e-04f, -4.558506985e-04f, +1.151066589e-04f, +1.175537217e-04f, - /* 24,13 */ -4.073257728e-05f, -1.491486840e-04f, +1.826837732e-04f, +5.299376467e-04f, +2.702967135e-05f, -1.084932315e-03f, -1.021228789e-03f, +8.914213340e-04f, +2.279727032e-03f, +6.673475630e-04f, -2.317921172e-03f, -2.558401145e-03f, +5.687514710e-04f, +2.935653267e-03f, +1.501737881e-03f, -1.491738775e-03f, -2.107952975e-03f, -1.888607322e-04f, +1.267577330e-03f, +7.682542954e-04f, -3.013338450e-04f, -4.753985127e-04f, +1.032931784e-04f, +1.243758393e-04f, - /* 24,14 */ -3.374854096e-05f, -1.457592711e-04f, +1.535492882e-04f, +5.256253050e-04f, +8.915647260e-05f, -1.029345157e-03f, -1.088054225e-03f, +7.511023835e-04f, +2.270723567e-03f, +8.489895579e-04f, -2.174888063e-03f, -2.666119545e-03f, +3.426248829e-04f, +2.893234801e-03f, +1.683014413e-03f, -1.345406789e-03f, -2.166758574e-03f, -3.277877666e-04f, +1.235986710e-03f, +8.382130226e-04f, -2.542107757e-04f, -4.924131238e-04f, +8.975162518e-05f, +1.307026563e-04f, - /* 24,15 */ -2.710774794e-05f, -1.414906982e-04f, +1.250536964e-04f, +5.177782008e-04f, +1.479047908e-04f, -9.693248739e-04f, -1.146194663e-03f, +6.097868283e-04f, +2.248631080e-03f, +1.023174933e-03f, -2.020697482e-03f, -2.758138339e-03f, +1.144377463e-04f, +2.833970964e-03f, +1.856378227e-03f, -1.188944940e-03f, -2.213825561e-03f, -4.683850093e-04f, +1.195525937e-03f, +9.054261715e-04f, -2.030015760e-04f, -5.066257662e-04f, +7.446376994e-05f, +1.364396009e-04f, - /* 20, 0 */ +8.618377023e-05f, +6.063813654e-04f, +5.504304823e-05f, -1.285351444e-03f, -7.884572117e-04f, +1.698526656e-03f, +2.051642156e-03f, -1.208844608e-03f, -3.071261118e-03f, -1.337669627e-04f, +3.018986987e-03f, +1.434631920e-03f, -1.928392685e-03f, -1.831072241e-03f, +6.629429882e-04f, +1.334851066e-03f, +2.665316224e-05f, -6.158469302e-04f, -1.222533602e-04f, +1.824770389e-04f, - /* 20, 1 */ +5.170459821e-05f, +5.921181369e-04f, +1.325211661e-04f, -1.227728603e-03f, -9.042412445e-04f, +1.556639033e-03f, +2.157910711e-03f, -9.769935819e-04f, -3.101316201e-03f, -4.002989059e-04f, +2.944767882e-03f, +1.652572896e-03f, -1.788832610e-03f, -1.953018956e-03f, +5.284364506e-04f, +1.375515478e-03f, +1.120226944e-04f, -6.201709543e-04f, -1.596279961e-04f, +5.435082024e-04f, - /* 20, 2 */ +1.907003227e-05f, +5.734309365e-04f, +2.052951315e-04f, -1.162740775e-03f, -1.009657150e-03f, +1.406715362e-03f, +2.246673287e-03f, -7.408907618e-04f, -3.109053425e-03f, -6.638330580e-04f, +2.849051730e-03f, +1.860929207e-03f, -1.633773999e-03f, -2.063170847e-03f, +3.857714352e-04f, +1.406686835e-03f, +2.004651158e-04f, -6.190441221e-04f, -1.979927117e-04f, +1.783734753e-04f, - /* 20, 3 */ -1.149811868e-05f, +5.507184044e-04f, +2.729399910e-04f, -1.091184321e-03f, -1.104169932e-03f, +1.250098855e-03f, +2.317552276e-03f, -5.023622502e-04f, -3.094549152e-03f, -9.223980063e-04f, +2.732457430e-03f, +2.058021578e-03f, -1.464165902e-03f, -2.160404235e-03f, +2.358727957e-04f, +1.427769061e-03f, +2.913280278e-04f, -6.121962531e-04f, -2.370049292e-04f, +1.734448317e-04f, - /* 20, 4 */ -3.981122763e-05f, +5.243991976e-04f, +3.350936324e-04f, -1.013885501e-03f, -1.187349554e-03f, +1.088157908e-03f, +2.370318438e-03f, -2.632332411e-04f, -3.058053364e-03f, -1.174062761e-03f, +2.595770512e-03f, +2.242244162e-03f, -1.281088328e-03f, -2.243678681e-03f, +7.975052491e-05f, +1.438235101e-03f, +3.839113875e-04f, -5.994006494e-04f, -2.762968272e-04f, +1.660093790e-04f, - /* 20, 5 */ -6.571426612e-05f, +4.949070444e-04f, +3.914578654e-04f, -9.316921975e-04f, -1.258871974e-03f, +9.222740706e-04f, +2.404890527e-03f, -2.531308203e-05f, -2.999986642e-03f, -1.416952434e-03f, +2.439937364e-03f, +2.412078410e-03f, -1.085745014e-03f, -2.312047403e-03f, -8.150702581e-05f, +1.437633739e-03f, +4.774724341e-04f, -5.804781630e-04f, -3.154780847e-04f, +1.559797103e-04f, - /* 20, 6 */ -8.908584503e-05f, +4.626858369e-04f, +4.417988543e-04f, -8.454656803e-04f, -1.318519207e-03f, +7.538301290e-04f, +2.421333651e-03f, +2.096193816e-04f, -2.920935727e-03f, -1.649263420e-03f, +2.266058084e-03f, +2.566106310e-03f, -8.794550343e-04f, -2.364667062e-03f, -2.467407834e-04f, +1.425595879e-03f, +5.712311871e-04f, -5.553009320e-04f, -3.541389831e-04f, +1.432933926e-04f, - /* 20, 7 */ -1.098378936e-04f, +4.281848093e-04f, +4.859469205e-04f, -7.560724855e-04f, -1.366178446e-03f, +5.841984075e-04f, +2.419856400e-03f, +4.398300532e-04f, -2.821647705e-03f, -1.869277969e-03f, +2.075378006e-03f, +2.703022864e-03f, -6.636433018e-04f, -2.400806791e-03f, -4.147293943e-04f, +1.401840253e-03f, +6.643764801e-04f, -5.237957356e-04f, -3.918538488e-04f, +1.279149940e-04f, - /* 20, 8 */ -1.279149940e-04f, +3.918538488e-04f, +5.237957356e-04f, -6.643764801e-04f, -1.401840253e-03f, +4.147293943e-04f, +2.400806791e-03f, +6.636433018e-04f, -2.703022864e-03f, -2.075378006e-03f, +1.869277969e-03f, +2.821647705e-03f, -4.398300532e-04f, -2.419856400e-03f, -5.841984075e-04f, +1.366178446e-03f, +7.560724855e-04f, -4.859469205e-04f, -4.281848093e-04f, +1.098378936e-04f, - /* 20, 9 */ -1.432933926e-04f, +3.541389831e-04f, +5.553009320e-04f, -5.712311871e-04f, -1.425595879e-03f, +2.467407834e-04f, +2.364667062e-03f, +8.794550343e-04f, -2.566106310e-03f, -2.266058084e-03f, +1.649263420e-03f, +2.920935727e-03f, -2.096193816e-04f, -2.421333651e-03f, -7.538301290e-04f, +1.318519207e-03f, +8.454656803e-04f, -4.417988543e-04f, -4.626858369e-04f, +8.908584503e-05f, - /* 20,10 */ -1.559797103e-04f, +3.154780847e-04f, +5.804781630e-04f, -4.774724341e-04f, -1.437633739e-03f, +8.150702581e-05f, +2.312047403e-03f, +1.085745014e-03f, -2.412078410e-03f, -2.439937364e-03f, +1.416952434e-03f, +2.999986642e-03f, +2.531308203e-05f, -2.404890527e-03f, -9.222740706e-04f, +1.258871974e-03f, +9.316921975e-04f, -3.914578654e-04f, -4.949070444e-04f, +6.571426612e-05f, - /* 20,11 */ -1.660093790e-04f, +2.762968272e-04f, +5.994006494e-04f, -3.839113875e-04f, -1.438235101e-03f, -7.975052491e-05f, +2.243678681e-03f, +1.281088328e-03f, -2.242244162e-03f, -2.595770512e-03f, +1.174062761e-03f, +3.058053364e-03f, +2.632332411e-04f, -2.370318438e-03f, -1.088157908e-03f, +1.187349554e-03f, +1.013885501e-03f, -3.350936324e-04f, -5.243991976e-04f, +3.981122763e-05f, - /* 20,12 */ -1.734448317e-04f, +2.370049292e-04f, +6.121962531e-04f, -2.913280278e-04f, -1.427769061e-03f, -2.358727957e-04f, +2.160404235e-03f, +1.464165902e-03f, -2.058021578e-03f, -2.732457430e-03f, +9.223980063e-04f, +3.094549152e-03f, +5.023622502e-04f, -2.317552276e-03f, -1.250098855e-03f, +1.104169932e-03f, +1.091184321e-03f, -2.729399910e-04f, -5.507184044e-04f, +1.149811868e-05f, - /* 20,13 */ -1.783734753e-04f, +1.979927117e-04f, +6.190441221e-04f, -2.004651158e-04f, -1.406686835e-03f, -3.857714352e-04f, +2.063170847e-03f, +1.633773999e-03f, -1.860929207e-03f, -2.849051730e-03f, +6.638330580e-04f, +3.109053425e-03f, +7.408907618e-04f, -2.246673287e-03f, -1.406715362e-03f, +1.009657150e-03f, +1.162740775e-03f, -2.052951315e-04f, -5.734309365e-04f, -1.907003227e-05f, - /* 20,14 */ -5.435082024e-04f, +1.596279961e-04f, +6.201709543e-04f, -1.120226944e-04f, -1.375515478e-03f, -5.284364506e-04f, +1.953018956e-03f, +1.788832610e-03f, -1.652572896e-03f, -2.944767882e-03f, +4.002989059e-04f, +3.101316201e-03f, +9.769935819e-04f, -2.157910711e-03f, -1.556639033e-03f, +9.042412445e-04f, +1.227728603e-03f, -1.325211661e-04f, -5.921181369e-04f, -5.170459821e-05f, - /* 20,15 */ -1.824770389e-04f, +1.222533602e-04f, +6.158469302e-04f, -2.665316224e-05f, -1.334851066e-03f, -6.629429882e-04f, +1.831072241e-03f, +1.928392685e-03f, -1.434631920e-03f, -3.018986987e-03f, +1.337669627e-04f, +3.071261118e-03f, +1.208844608e-03f, -2.051642156e-03f, -1.698526656e-03f, +7.884572117e-04f, +1.285351444e-03f, -5.504304823e-05f, -6.063813654e-04f, -8.618377023e-05f, - /* 20, 0 */ -2.034293425e-04f, +2.330977005e-04f, +6.663349221e-04f, -5.788237715e-04f, -1.543506114e-03f, +7.663264997e-04f, +2.637884518e-03f, -5.016073607e-04f, -3.414789539e-03f, -1.613262342e-04f, +3.393842146e-03f, +7.896927597e-04f, -2.589726790e-03f, -9.705894653e-04f, +1.498255744e-03f, +6.923557695e-04f, -6.435044748e-04f, -2.810018705e-04f, +2.009801156e-04f, +0.000000000e+00f, - /* 20, 1 */ -6.015260759e-04f, +1.858917095e-04f, +6.809814437e-04f, -4.649883812e-04f, -1.572899641e-03f, +5.610647582e-04f, +2.661959816e-03f, -2.131645492e-04f, -3.406214168e-03f, -4.825221542e-04f, +3.343371924e-03f, +1.074767465e-03f, -2.517456780e-03f, -1.171859801e-03f, +1.437039798e-03f, +8.043742580e-04f, -6.123036842e-04f, -3.290468323e-04f, +1.953154138e-04f, -3.513221827e-04f, - /* 20, 2 */ -1.932641301e-04f, +1.399021716e-04f, +6.877130848e-04f, -3.520154127e-04f, -1.586701669e-03f, +3.567578182e-04f, +2.662213263e-03f, +7.301175991e-05f, -3.368394423e-03f, -7.993627115e-04f, +3.263658730e-03f, +1.354174959e-03f, -2.421279702e-03f, -1.368123194e-03f, +1.359912061e-03f, +9.136368247e-04f, -5.726346524e-04f, -3.766412744e-04f, +1.862701081e-04f, +2.243392330e-05f, - /* 20, 3 */ -1.771389305e-04f, +9.560377684e-05f, +6.868748812e-04f, -2.410152618e-04f, -1.585326694e-03f, +1.553000173e-04f, +2.639129491e-03f, +3.543525656e-04f, -3.301882608e-03f, -1.108991788e-03f, +3.155261081e-03f, +1.625281932e-03f, -2.301637793e-03f, -1.557365345e-03f, +1.267093119e-03f, +1.018881552e-03f, -5.244930508e-04f, -4.231658296e-04f, +1.737162070e-04f, +3.471505729e-05f, - /* 20, 4 */ -1.604844080e-04f, +5.342390613e-05f, +6.788805869e-04f, -1.330327870e-04f, -1.569329509e-03f, -4.149146373e-05f, +2.593408320e-03f, +6.283684809e-04f, -3.207497769e-03f, -1.408623929e-03f, +3.019012048e-03f, +1.885504757e-03f, -2.159209806e-03f, -1.737592880e-03f, +1.158972903e-03f, +1.118840456e-03f, -4.679722330e-04f, -4.679795743e-04f, +1.575667726e-04f, +4.805250238e-05f, - /* 20, 5 */ -1.435528424e-04f, +1.373966937e-05f, +6.642048742e-04f, -2.903827106e-05f, -1.539395067e-03f, -2.318933016e-04f, +2.525953799e-03f, +8.926733333e-04f, -3.086315860e-03f, -1.695571566e-03f, +2.856012327e-03f, +2.132335710e-03f, -1.994908019e-03f, -1.906854484e-03f, +1.036111434e-03f, +1.212253447e-03f, -4.032663270e-04f, -5.104270987e-04f, +1.377794601e-04f, +6.235351094e-05f, - /* 20, 6 */ -1.265803873e-04f, -2.312428639e-05f, +6.433751213e-04f, +7.008046528e-05f, -1.496327216e-03f, -4.142913555e-04f, +2.437861323e-03f, +1.145006429e-03f, -2.939657349e-03f, -1.967271220e-03f, +2.667620552e-03f, +2.363368676e-03f, -1.809872756e-03f, -2.063262017e-03f, +8.992377119e-04f, +1.297882648e-03f, -3.306722314e-04f, -5.498460811e-04f, +1.143596169e-04f, +7.750368078e-05f, - /* 20, 7 */ -1.097853637e-04f, -5.689720211e-05f, +6.169629011e-04f, +1.635247423e-04f, -1.441036462e-03f, -5.871944806e-04f, +2.330402993e-03f, +1.383253258e-03f, -2.769072436e-03f, -2.221308400e-03f, +2.455440941e-03f, +2.576324026e-03f, -1.605464444e-03f, -2.205011397e-03f, +7.492467105e-04f, +1.374526925e-03f, -2.505904541e-04f, -5.855752858e-04f, +8.736287854e-05f, +9.336686615e-05f, - /* 20, 8 */ -9.336686615e-05f, -8.736287854e-05f, +5.855752858e-04f, +2.505904541e-04f, -1.374526925e-03f, -7.492467105e-04f, +2.205011397e-03f, +1.605464444e-03f, -2.576324026e-03f, -2.455440941e-03f, +2.221308400e-03f, +2.769072436e-03f, -1.383253258e-03f, -2.330402993e-03f, +5.871944806e-04f, +1.441036462e-03f, -1.635247423e-04f, -6.169629011e-04f, +5.689720211e-05f, +1.097853637e-04f, - /* 20, 9 */ -7.750368078e-05f, -1.143596169e-04f, +5.498460811e-04f, +3.306722314e-04f, -1.297882648e-03f, -8.992377119e-04f, +2.063262017e-03f, +1.809872756e-03f, -2.363368676e-03f, -2.667620552e-03f, +1.967271220e-03f, +2.939657349e-03f, -1.145006429e-03f, -2.437861323e-03f, +4.142913555e-04f, +1.496327216e-03f, -7.008046528e-05f, -6.433751213e-04f, +2.312428639e-05f, +1.265803873e-04f, - /* 20,10 */ -6.235351094e-05f, -1.377794601e-04f, +5.104270987e-04f, +4.032663270e-04f, -1.212253447e-03f, -1.036111434e-03f, +1.906854484e-03f, +1.994908019e-03f, -2.132335710e-03f, -2.856012327e-03f, +1.695571566e-03f, +3.086315860e-03f, -8.926733333e-04f, -2.525953799e-03f, +2.318933016e-04f, +1.539395067e-03f, +2.903827106e-05f, -6.642048742e-04f, -1.373966937e-05f, +1.435528424e-04f, - /* 20,11 */ -4.805250238e-05f, -1.575667726e-04f, +4.679795743e-04f, +4.679722330e-04f, -1.118840456e-03f, -1.158972903e-03f, +1.737592880e-03f, +2.159209806e-03f, -1.885504757e-03f, -3.019012048e-03f, +1.408623929e-03f, +3.207497769e-03f, -6.283684809e-04f, -2.593408320e-03f, +4.149146373e-05f, +1.569329509e-03f, +1.330327870e-04f, -6.788805869e-04f, -5.342390613e-05f, +1.604844080e-04f, - /* 20,12 */ -3.471505729e-05f, -1.737162070e-04f, +4.231658296e-04f, +5.244930508e-04f, -1.018881552e-03f, -1.267093119e-03f, +1.557365345e-03f, +2.301637793e-03f, -1.625281932e-03f, -3.155261081e-03f, +1.108991788e-03f, +3.301882608e-03f, -3.543525656e-04f, -2.639129491e-03f, -1.553000173e-04f, +1.585326694e-03f, +2.410152618e-04f, -6.868748812e-04f, -9.560377684e-05f, +1.771389305e-04f, - /* 20,13 */ -2.243392330e-05f, -1.862701081e-04f, +3.766412744e-04f, +5.726346524e-04f, -9.136368247e-04f, -1.359912061e-03f, +1.368123194e-03f, +2.421279702e-03f, -1.354174959e-03f, -3.263658730e-03f, +7.993627115e-04f, +3.368394423e-03f, -7.301175991e-05f, -2.662213263e-03f, -3.567578182e-04f, +1.586701669e-03f, +3.520154127e-04f, -6.877130848e-04f, -1.399021716e-04f, +1.932641301e-04f, - /* 20,14 */ +3.513221827e-04f, -1.953154138e-04f, +3.290468323e-04f, +6.123036842e-04f, -8.043742580e-04f, -1.437039798e-03f, +1.171859801e-03f, +2.517456780e-03f, -1.074767465e-03f, -3.343371924e-03f, +4.825221542e-04f, +3.406214168e-03f, +2.131645492e-04f, -2.661959816e-03f, -5.610647582e-04f, +1.572899641e-03f, +4.649883812e-04f, -6.809814437e-04f, -1.858917095e-04f, +6.015260759e-04f, - /* 20,15 */ +0.000000000e+00f, -2.009801156e-04f, +2.810018705e-04f, +6.435044748e-04f, -6.923557695e-04f, -1.498255744e-03f, +9.705894653e-04f, +2.589726790e-03f, -7.896927597e-04f, -3.393842146e-03f, +1.613262342e-04f, +3.414789539e-03f, +5.016073607e-04f, -2.637884518e-03f, -7.663264997e-04f, +1.543506114e-03f, +5.788237715e-04f, -6.663349221e-04f, -2.330977005e-04f, +2.034293425e-04f, - /* 20, 0 */ -1.941987182e-05f, -3.146481294e-04f, +5.561305343e-04f, +3.334278991e-04f, -1.561489082e-03f, -4.085266513e-04f, +2.806699025e-03f, +3.580334706e-04f, -3.695826941e-03f, -1.914605051e-04f, +3.720952014e-03f, -2.295171057e-05f, -2.868623587e-03f, +1.886978960e-04f, +1.629573547e-03f, -2.343761763e-04f, -6.035407960e-04f, +1.633790229e-04f, +3.476344875e-05f, +0.000000000e+00f, - /* 20, 1 */ +3.929324583e-04f, -3.051602666e-04f, +5.048306585e-04f, +4.229644027e-04f, -1.479104632e-03f, -6.165003319e-04f, +2.717079427e-03f, +6.839596419e-04f, -3.633185574e-03f, -5.723309145e-04f, +3.708003841e-03f, +3.177599071e-04f, -2.901501717e-03f, -4.082823094e-05f, +1.681921685e-03f, -1.265851889e-04f, -6.461214422e-04f, +1.369921977e-04f, +5.166761157e-05f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, -2.925136688e-04f, +4.505823818e-04f, +5.023683161e-04f, -1.383975926e-03f, -8.106644739e-04f, +2.601403151e-03f, +9.973590062e-04f, -3.534000256e-03f, -9.470733637e-04f, +3.656850180e-03f, +6.604608766e-04f, -2.904291326e-03f, -2.777120434e-04f, +1.717239595e-03f, -1.098579054e-05f, -6.829477483e-04f, +1.058859702e-04f, +7.000071077e-05f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, -2.771727451e-04f, +3.943146848e-04f, +5.711822345e-04f, -1.277754215e-03f, -9.892860040e-04f, +2.461570058e-03f, +1.295052213e-03f, -3.399644449e-03f, -1.311681723e-03f, +3.567787737e-03f, +1.001437562e-03f, -2.876278542e-03f, -5.194560271e-04f, +1.734397724e-03f, +1.113422841e-04f, -7.131247677e-04f, +7.019384523e-05f, +8.959420873e-05f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, -2.596009711e-04f, +3.369316672e-04f, +6.291078651e-04f, -1.162161945e-03f, -1.150868125e-03f, +2.299713337e-03f, +1.574086312e-03f, -3.231873732e-03f, -1.662267592e-03f, +3.441541225e-03f, +1.336946247e-03f, -2.817092852e-03f, -7.634316403e-04f, +1.732451285e-03f, +2.391787684e-04f, -7.358020638e-04f, +3.013243736e-05f, +1.102423612e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, -2.402546692e-04f, +2.793008459e-04f, +6.760030262e-04f, -1.038968304e-03f, -1.294161821e-03f, +2.118169008e-03f, +1.831766066e-03f, -3.032802328e-03f, -1.995105343e-03f, +3.279257242e-03f, +1.663257052e-03f, -2.726718246e-03f, -1.006908470e-03f, +1.710658870e-03f, +3.711735089e-04f, -7.501884622e-04f, -1.399708473e-05f, +1.317024534e-04f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, -2.195772899e-04f, +2.222425350e-04f, +7.118766228e-04f, -9.099649801e-04f, -1.418173917e-03f, +1.919443545e-03f, +2.065681697e-03f, -2.804875489e-03f, -2.306675131e-03f, +3.082493013e-03f, +1.976698190e-03f, -2.605500127e-03f, -1.247085413e-03f, +1.668498942e-03f, +5.058593370e-04f, -7.555665992e-04f, -6.180883712e-05f, +1.536956226e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, -1.979942392e-04f, +1.665204182e-04f, +7.368817426e-04f, -7.769424426e-04f, -1.522171671e-03f, +1.706180058e-03f, +2.273732749e-03f, -2.550838108e-03f, -2.593703365e-03f, +2.853200114e-03f, +2.273699984e-03f, -2.454147846e-03f, -1.481123511e-03f, +1.605683934e-03f, +6.416670612e-04f, -7.513070408e-04f, -1.128334053e-04f, +1.759082929e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, -1.759082929e-04f, +1.128334053e-04f, +7.513070408e-04f, -6.416670612e-04f, -1.605683934e-03f, +1.481123511e-03f, +2.454147846e-03f, -2.273699984e-03f, -2.853200114e-03f, +2.593703365e-03f, +2.550838108e-03f, -2.273732749e-03f, -1.706180058e-03f, +1.522171671e-03f, +7.769424426e-04f, -7.368817426e-04f, -1.665204182e-04f, +1.979942392e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, -1.536956226e-04f, +6.180883712e-05f, +7.555665992e-04f, -5.058593370e-04f, -1.668498942e-03f, +1.247085413e-03f, +2.605500127e-03f, -1.976698190e-03f, -3.082493013e-03f, +2.306675131e-03f, +2.804875489e-03f, -2.065681697e-03f, -1.919443545e-03f, +1.418173917e-03f, +9.099649801e-04f, -7.118766228e-04f, -2.222425350e-04f, +2.195772899e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, -1.317024534e-04f, +1.399708473e-05f, +7.501884622e-04f, -3.711735089e-04f, -1.710658870e-03f, +1.006908470e-03f, +2.726718246e-03f, -1.663257052e-03f, -3.279257242e-03f, +1.995105343e-03f, +3.032802328e-03f, -1.831766066e-03f, -2.118169008e-03f, +1.294161821e-03f, +1.038968304e-03f, -6.760030262e-04f, -2.793008459e-04f, +2.402546692e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, -1.102423612e-04f, -3.013243736e-05f, +7.358020638e-04f, -2.391787684e-04f, -1.732451285e-03f, +7.634316403e-04f, +2.817092852e-03f, -1.336946247e-03f, -3.441541225e-03f, +1.662267592e-03f, +3.231873732e-03f, -1.574086312e-03f, -2.299713337e-03f, +1.150868125e-03f, +1.162161945e-03f, -6.291078651e-04f, -3.369316672e-04f, +2.596009711e-04f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, -8.959420873e-05f, -7.019384523e-05f, +7.131247677e-04f, -1.113422841e-04f, -1.734397724e-03f, +5.194560271e-04f, +2.876278542e-03f, -1.001437562e-03f, -3.567787737e-03f, +1.311681723e-03f, +3.399644449e-03f, -1.295052213e-03f, -2.461570058e-03f, +9.892860040e-04f, +1.277754215e-03f, -5.711822345e-04f, -3.943146848e-04f, +2.771727451e-04f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, -7.000071077e-05f, -1.058859702e-04f, +6.829477483e-04f, +1.098579054e-05f, -1.717239595e-03f, +2.777120434e-04f, +2.904291326e-03f, -6.604608766e-04f, -3.656850180e-03f, +9.470733637e-04f, +3.534000256e-03f, -9.973590062e-04f, -2.601403151e-03f, +8.106644739e-04f, +1.383975926e-03f, -5.023683161e-04f, -4.505823818e-04f, +2.925136688e-04f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, -5.166761157e-05f, -1.369921977e-04f, +6.461214422e-04f, +1.265851889e-04f, -1.681921685e-03f, +4.082823094e-05f, +2.901501717e-03f, -3.177599071e-04f, -3.708003841e-03f, +5.723309145e-04f, +3.633185574e-03f, -6.839596419e-04f, -2.717079427e-03f, +6.165003319e-04f, +1.479104632e-03f, -4.229644027e-04f, -5.048306585e-04f, +3.051602666e-04f, -3.929324583e-04f, - /* 20,15 */ +0.000000000e+00f, -3.476344875e-05f, -1.633790229e-04f, +6.035407960e-04f, +2.343761763e-04f, -1.629573547e-03f, -1.886978960e-04f, +2.868623587e-03f, +2.295171057e-05f, -3.720952014e-03f, +1.914605051e-04f, +3.695826941e-03f, -3.580334706e-04f, -2.806699025e-03f, +4.085266513e-04f, +1.561489082e-03f, -3.334278991e-04f, -5.561305343e-04f, +3.146481294e-04f, +1.941987182e-05f, - /* 16, 0 */ +5.220390682e-05f, +8.171943113e-04f, -8.986497643e-04f, -1.446340428e-03f, +2.494478678e-03f, +1.297377101e-03f, -3.898391184e-03f, -2.241676001e-04f, +3.985236927e-03f, -9.413140896e-04f, -2.682700956e-03f, +1.283836927e-03f, +1.053222343e-03f, -7.989322796e-04f, -1.116939505e-04f, +1.571395541e-04f, - /* 16, 1 */ -3.017522584e-06f, +8.224554322e-04f, -7.403312787e-04f, -1.584058293e-03f, +2.281207335e-03f, +1.631019258e-03f, -3.765802305e-03f, -6.696927435e-04f, +4.024834602e-03f, -5.670028406e-04f, -2.842687093e-03f, +1.097826180e-03f, +1.201600277e-03f, -7.671194843e-04f, -1.747127487e-04f, +1.853334990e-04f, - /* 16, 2 */ -5.335264618e-05f, +8.154372286e-04f, -5.806604605e-04f, -1.696100138e-03f, +2.046328714e-03f, +1.938434809e-03f, -3.589560871e-03f, -1.106825943e-03f, +4.016290169e-03f, -1.789305351e-04f, -2.971556495e-03f, +8.899684644e-04f, +1.341315594e-03f, -7.213960065e-04f, -2.404043435e-04f, +2.137577131e-04f, - /* 16, 3 */ -9.830954357e-05f, +7.970128377e-04f, -4.219420013e-04f, -1.781963746e-03f, +1.793485018e-03f, +2.216231187e-03f, -3.372309802e-03f, -1.530099436e-03f, +3.959337237e-03f, +2.181586899e-04f, -3.066783450e-03f, +6.622938144e-04f, +1.469918710e-03f, -6.616076810e-04f, -3.078052257e-04f, +7.052925564e-04f, - /* 16, 4 */ -1.375232535e-04f, +7.681852053e-04f, -2.663606532e-04f, -1.841529450e-03f, +1.526462906e-03f, +2.461468734e-03f, -3.117203525e-03f, -1.934233820e-03f, +3.854345030e-03f, +6.193258599e-04f, -3.126241364e-03f, +4.171838871e-04f, +1.585017189e-03f, -5.878191605e-04f, -3.758553213e-04f, +2.457392598e-04f, - /* 16, 5 */ -1.707546409e-04f, +7.300642099e-04f, -1.159532388e-04f, -1.875048978e-03f, +1.249136740e-03f, +2.671693350e-03f, -2.827860277e-03f, -2.314209556e-03f, +3.702317390e-03f, +1.019502933e-03f, -3.148242059e-03f, +1.573479538e-04f, +1.684315055e-03f, -5.003238841e-04f, -4.434113338e-04f, +2.470336005e-04f, - /* 16, 6 */ -1.978870754e-04f, +6.838430878e-04f, +2.741593655e-05f, -1.883129095e-03f, +9.654119112e-04f, +2.844961691e-03f, -2.508308289e-03f, -2.665334690e-03f, +3.504882792e-03f, +1.413561295e-03f, -3.131569469e-03f, -1.142067707e-04f, +1.765652028e-03f, -3.996506493e-04f, -5.092623113e-04f, +2.432370997e-04f, - /* 16, 7 */ -2.189210857e-04f, +6.307745862e-04f, +1.620759979e-04f, -1.866710442e-03f, +6.791690772e-04f, +2.979858667e-03f, -2.162926680e-03f, -2.983307830e-03f, +3.264275462e-03f, +1.796381989e-03f, -3.075507089e-03f, -3.942101476e-04f, +1.827042047e-03f, -2.865665382e-04f, -5.721472605e-04f, +2.339671870e-04f, - /* 16, 8 */ -2.339671870e-04f, +5.721472605e-04f, +2.865665382e-04f, -1.827042047e-03f, +3.942101476e-04f, +3.075507089e-03f, -1.796381989e-03f, -3.264275462e-03f, +2.983307830e-03f, +2.162926680e-03f, -2.979858667e-03f, -6.791690772e-04f, +1.866710442e-03f, -1.620759979e-04f, -6.307745862e-04f, +2.189210857e-04f, - /* 16, 9 */ -2.432370997e-04f, +5.092623113e-04f, +3.996506493e-04f, -1.765652028e-03f, +1.142067707e-04f, +3.131569469e-03f, -1.413561295e-03f, -3.504882792e-03f, +2.665334690e-03f, +2.508308289e-03f, -2.844961691e-03f, -9.654119112e-04f, +1.883129095e-03f, -2.741593655e-05f, -6.838430878e-04f, +1.978870754e-04f, - /* 16,10 */ -2.470336005e-04f, +4.434113338e-04f, +5.003238841e-04f, -1.684315055e-03f, -1.573479538e-04f, +3.148242059e-03f, -1.019502933e-03f, -3.702317390e-03f, +2.314209556e-03f, +2.827860277e-03f, -2.671693350e-03f, -1.249136740e-03f, +1.875048978e-03f, +1.159532388e-04f, -7.300642099e-04f, +1.707546409e-04f, - /* 16,11 */ -2.457392598e-04f, +3.758553213e-04f, +5.878191605e-04f, -1.585017189e-03f, -4.171838871e-04f, +3.126241364e-03f, -6.193258599e-04f, -3.854345030e-03f, +1.934233820e-03f, +3.117203525e-03f, -2.461468734e-03f, -1.526462906e-03f, +1.841529450e-03f, +2.663606532e-04f, -7.681852053e-04f, +1.375232535e-04f, - /* 16,12 */ -7.052925564e-04f, +3.078052257e-04f, +6.616076810e-04f, -1.469918710e-03f, -6.622938144e-04f, +3.066783450e-03f, -2.181586899e-04f, -3.959337237e-03f, +1.530099436e-03f, +3.372309802e-03f, -2.216231187e-03f, -1.793485018e-03f, +1.781963746e-03f, +4.219420013e-04f, -7.970128377e-04f, +9.830954357e-05f, - /* 16,13 */ -2.137577131e-04f, +2.404043435e-04f, +7.213960065e-04f, -1.341315594e-03f, -8.899684644e-04f, +2.971556495e-03f, +1.789305351e-04f, -4.016290169e-03f, +1.106825943e-03f, +3.589560871e-03f, -1.938434809e-03f, -2.046328714e-03f, +1.696100138e-03f, +5.806604605e-04f, -8.154372286e-04f, +5.335264618e-05f, - /* 16,14 */ -1.853334990e-04f, +1.747127487e-04f, +7.671194843e-04f, -1.201600277e-03f, -1.097826180e-03f, +2.842687093e-03f, +5.670028406e-04f, -4.024834602e-03f, +6.696927435e-04f, +3.765802305e-03f, -1.631019258e-03f, -2.281207335e-03f, +1.584058293e-03f, +7.403312787e-04f, -8.224554322e-04f, +3.017522584e-06f, - /* 16,15 */ -1.571395541e-04f, +1.116939505e-04f, +7.989322796e-04f, -1.053222343e-03f, -1.283836927e-03f, +2.682700956e-03f, +9.413140896e-04f, -3.985236927e-03f, +2.241676001e-04f, +3.898391184e-03f, -1.297377101e-03f, -2.494478678e-03f, +1.446340428e-03f, +8.986497643e-04f, -8.171943113e-04f, -5.220390682e-05f, - /* 16, 0 */ -2.607744081e-04f, +6.609893225e-04f, +4.777614003e-05f, -2.019079564e-03f, +1.736921610e-03f, +2.230081148e-03f, -4.008512761e-03f, -2.594451583e-04f, +4.172957467e-03f, -1.888269495e-03f, -2.040920379e-03f, +1.975903291e-03f, +1.180452271e-04f, -7.248571600e-04f, +2.468008838e-04f, +0.000000000e+00f, - /* 16, 1 */ -2.676863913e-04f, +5.906930705e-04f, +2.025069901e-04f, -2.030408814e-03f, +1.418499470e-03f, +2.533235894e-03f, -3.790472440e-03f, -7.745724648e-04f, +4.280846994e-03f, -1.512096765e-03f, -2.325335551e-03f, +1.900137256e-03f, +2.927280105e-04f, -7.805529904e-04f, +2.254162899e-04f, +0.000000000e+00f, - /* 16, 2 */ -2.680102581e-04f, +5.157202047e-04f, +3.442245196e-04f, -2.011119828e-03f, +1.090886046e-03f, +2.794113365e-03f, -3.522578151e-03f, -1.278469954e-03f, +4.330057965e-03f, -1.106477171e-03f, -2.585166870e-03f, +1.791556445e-03f, +4.737630093e-04f, -8.263772041e-04f, +1.964117366e-04f, +0.000000000e+00f, - /* 16, 3 */ -7.633646088e-04f, +4.377966605e-04f, +4.713317060e-04f, -1.962888420e-03f, +7.592982470e-04f, +3.009813640e-03f, -3.209287239e-03f, -1.763847458e-03f, +4.319343992e-03f, -6.768749158e-04f, -2.815661672e-03f, +1.650477084e-03f, +6.583936022e-04f, -8.607109932e-04f, +1.597335965e-04f, -4.634120047e-04f, - /* 16, 4 */ -2.423668462e-04f, +3.585907293e-04f, +5.825699836e-04f, -1.887792011e-03f, +4.288533077e-04f, +3.178189562e-03f, -2.855695312e-03f, -2.223705909e-03f, +4.248362401e-03f, -2.292254995e-04f, -3.012400483e-03f, +1.477771292e-03f, +8.436545409e-04f, -8.820535056e-04f, +1.154955663e-04f, +2.338334874e-05f, - /* 16, 5 */ -2.066858426e-04f, +2.796840991e-04f, +6.770251471e-04f, -1.788258811e-03f, +1.044882353e-04f, +3.297866045e-03f, -2.467449129e-03f, -2.651446905e-03f, +4.117686315e-03f, +2.301520823e-04f, -3.171379014e-03f, +1.274872332e-03f, +1.026416356e-03f, -8.890585891e-04f, +6.398775754e-05f, +4.782938304e-05f, - /* 16, 6 */ -1.715009195e-04f, +2.025461567e-04f, +7.541266524e-04f, -1.667012713e-03f, -2.091154912e-04f, +3.368246274e-03f, -2.050651409e-03f, -3.040975547e-03f, +3.928801804e-03f, +6.946508648e-04f, -3.289085050e-03f, +1.043770075e-03f, +1.203434747e-03f, -8.805703554e-04f, +5.682450650e-06f, +7.520965874e-05f, - /* 16, 7 */ -1.374865801e-04f, +1.285119093e-04f, +8.136405975e-04f, -1.527015027e-03f, -5.076007987e-04f, +3.389504923e-03f, -1.611759203e-03f, -3.386794836e-03f, +3.684090065e-03f, +1.157477637e-03f, -3.362568736e-03f, +7.869964389e-04f, +1.371404208e-03f, -8.556567843e-04f, -5.876379361e-05f, +1.052264476e-04f, - /* 16, 8 */ -1.052264476e-04f, +5.876379361e-05f, +8.556567843e-04f, -1.371404208e-03f, -7.869964389e-04f, +3.362568736e-03f, -1.157477637e-03f, -3.684090065e-03f, +3.386794836e-03f, +1.611759203e-03f, -3.389504923e-03f, +5.076007987e-04f, +1.527015027e-03f, -8.136405975e-04f, -1.285119093e-04f, +1.374865801e-04f, - /* 16, 9 */ -7.520965874e-05f, -5.682450650e-06f, +8.805703554e-04f, -1.203434747e-03f, -1.043770075e-03f, +3.289085050e-03f, -6.946508648e-04f, -3.928801804e-03f, +3.040975547e-03f, +2.050651409e-03f, -3.368246274e-03f, +2.091154912e-04f, +1.667012713e-03f, -7.541266524e-04f, -2.025461567e-04f, +1.715009195e-04f, - /* 16,10 */ -4.782938304e-05f, -6.398775754e-05f, +8.890585891e-04f, -1.026416356e-03f, -1.274872332e-03f, +3.171379014e-03f, -2.301520823e-04f, -4.117686315e-03f, +2.651446905e-03f, +2.467449129e-03f, -3.297866045e-03f, -1.044882353e-04f, +1.788258811e-03f, -6.770251471e-04f, -2.796840991e-04f, +2.066858426e-04f, - /* 16,11 */ -2.338334874e-05f, -1.154955663e-04f, +8.820535056e-04f, -8.436545409e-04f, -1.477771292e-03f, +3.012400483e-03f, +2.292254995e-04f, -4.248362401e-03f, +2.223705909e-03f, +2.855695312e-03f, -3.178189562e-03f, -4.288533077e-04f, +1.887792011e-03f, -5.825699836e-04f, -3.585907293e-04f, +2.423668462e-04f, - /* 16,12 */ +4.634120047e-04f, -1.597335965e-04f, +8.607109932e-04f, -6.583936022e-04f, -1.650477084e-03f, +2.815661672e-03f, +6.768749158e-04f, -4.319343992e-03f, +1.763847458e-03f, +3.209287239e-03f, -3.009813640e-03f, -7.592982470e-04f, +1.962888420e-03f, -4.713317060e-04f, -4.377966605e-04f, +7.633646088e-04f, - /* 16,13 */ +0.000000000e+00f, -1.964117366e-04f, +8.263772041e-04f, -4.737630093e-04f, -1.791556445e-03f, +2.585166870e-03f, +1.106477171e-03f, -4.330057965e-03f, +1.278469954e-03f, +3.522578151e-03f, -2.794113365e-03f, -1.090886046e-03f, +2.011119828e-03f, -3.442245196e-04f, -5.157202047e-04f, +2.680102581e-04f, - /* 16,14 */ +0.000000000e+00f, -2.254162899e-04f, +7.805529904e-04f, -2.927280105e-04f, -1.900137256e-03f, +2.325335551e-03f, +1.512096765e-03f, -4.280846994e-03f, +7.745724648e-04f, +3.790472440e-03f, -2.533235894e-03f, -1.418499470e-03f, +2.030408814e-03f, -2.025069901e-04f, -5.906930705e-04f, +2.676863913e-04f, - /* 16,15 */ +0.000000000e+00f, -2.468008838e-04f, +7.248571600e-04f, -1.180452271e-04f, -1.975903291e-03f, +2.040920379e-03f, +1.888269495e-03f, -4.172957467e-03f, +2.594451583e-04f, +4.008512761e-03f, -2.230081148e-03f, -1.736921610e-03f, +2.019079564e-03f, -4.777614003e-05f, -6.609893225e-04f, +2.607744081e-04f, - /* 16, 0 */ -1.129954761e-04f, -3.969443331e-04f, +7.863457700e-04f, -1.968627401e-03f, +6.635626436e-04f, +3.065104554e-03f, -4.014723865e-03f, -2.972906332e-04f, +4.272130602e-03f, -2.778972616e-03f, -1.044103847e-03f, +2.069667087e-03f, -6.906315332e-04f, -2.376896670e-04f, +1.523656204e-04f, +0.000000000e+00f, - /* 16, 1 */ -7.672972562e-05f, -4.458313625e-04f, +8.604609066e-04f, -1.839340292e-03f, +2.869810557e-04f, +3.294943885e-03f, -3.696990655e-03f, -8.869321804e-04f, +4.464175630e-03f, -2.440111513e-03f, -1.421957113e-03f, +2.139058837e-03f, -5.737860098e-04f, -3.273087897e-04f, +1.941703587e-04f, +0.000000000e+00f, - /* 16, 2 */ -4.409159553e-05f, -4.801879450e-04f, +9.129725459e-04f, -1.685578963e-03f, -7.929130936e-05f, +3.465994861e-03f, -3.324955442e-03f, -1.461843594e-03f, +4.586914931e-03f, -2.053108579e-03f, -1.790295465e-03f, +2.173860444e-03f, -4.367566844e-04f, -4.185294039e-04f, +2.375950982e-04f, +0.000000000e+00f, - /* 16, 3 */ +4.855802427e-04f, -5.008892512e-04f, +9.443143993e-04f, -1.511399569e-03f, -4.293120730e-04f, +3.576852207e-03f, -2.905512498e-03f, -2.012499819e-03f, +4.637578076e-03f, -1.623510702e-03f, -2.142238116e-03f, +2.171667537e-03f, -2.809771210e-04f, -5.093533546e-04f, +2.816859426e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, -5.090007623e-04f, +9.553248878e-04f, -1.321049384e-03f, -7.576441950e-04f, +3.627202827e-03f, -2.446291464e-03f, -2.529812382e-03f, +4.614629236e-03f, -1.157740361e-03f, -2.470980778e-03f, +2.130685105e-03f, -1.083629217e-04f, -5.976383603e-04f, +3.253590588e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, -5.057402285e-04f, +9.472067544e-04f, -1.118874842e-03f, -1.059441268e-03f, +3.617806804e-03f, -1.955510679e-03f, -3.005292216e-03f, +4.517805471e-03f, -6.629933593e-04f, -2.769928158e-03f, +2.049789183e-03f, +7.870314989e-05f, -6.811391839e-04f, +3.674140144e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, -4.924395299e-04f, +9.214808972e-04f, -9.092313688e-04f, -1.330518654e-03f, +3.550458465e-03f, -1.441821213e-03f, -3.431200966e-03f, +4.348131386e-03f, -1.471199733e-04f, -3.032825993e-03f, +1.928577081e-03f, +2.773970394e-04f, -7.575537377e-04f, +4.065510896e-04f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, -4.705072223e-04f, +8.799357120e-04f, -6.963968181e-04f, -1.567409460e-03f, +3.427928686e-03f, -9.141447359e-04f, -3.800687882e-03f, +4.107909720e-03f, +3.815084058e-04f, -3.253889950e-03f, +1.767404663e-03f, +4.844901765e-04f, -8.245732787e-04f, +4.413924818e-04f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, -4.413924818e-04f, +8.245732787e-04f, -4.844901765e-04f, -1.767404663e-03f, +3.253889950e-03f, -3.815084058e-04f, -4.107909720e-03f, +3.800687882e-03f, +9.141447359e-04f, -3.427928686e-03f, +1.567409460e-03f, +6.963968181e-04f, -8.799357120e-04f, +4.705072223e-04f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, -4.065510896e-04f, +7.575537377e-04f, -2.773970394e-04f, -1.928577081e-03f, +3.032825993e-03f, +1.471199733e-04f, -4.348131386e-03f, +3.431200966e-03f, +1.441821213e-03f, -3.550458465e-03f, +1.330518654e-03f, +9.092313688e-04f, -9.214808972e-04f, +4.924395299e-04f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, -3.674140144e-04f, +6.811391839e-04f, -7.870314989e-05f, -2.049789183e-03f, +2.769928158e-03f, +6.629933593e-04f, -4.517805471e-03f, +3.005292216e-03f, +1.955510679e-03f, -3.617806804e-03f, +1.059441268e-03f, +1.118874842e-03f, -9.472067544e-04f, +5.057402285e-04f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, -3.253590588e-04f, +5.976383603e-04f, +1.083629217e-04f, -2.130685105e-03f, +2.470980778e-03f, +1.157740361e-03f, -4.614629236e-03f, +2.529812382e-03f, +2.446291464e-03f, -3.627202827e-03f, +7.576441950e-04f, +1.321049384e-03f, -9.553248878e-04f, +5.090007623e-04f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, -2.816859426e-04f, +5.093533546e-04f, +2.809771210e-04f, -2.171667537e-03f, +2.142238116e-03f, +1.623510702e-03f, -4.637578076e-03f, +2.012499819e-03f, +2.905512498e-03f, -3.576852207e-03f, +4.293120730e-04f, +1.511399569e-03f, -9.443143993e-04f, +5.008892512e-04f, -4.855802427e-04f, - /* 16,13 */ +0.000000000e+00f, -2.375950982e-04f, +4.185294039e-04f, +4.367566844e-04f, -2.173860444e-03f, +1.790295465e-03f, +2.053108579e-03f, -4.586914931e-03f, +1.461843594e-03f, +3.324955442e-03f, -3.465994861e-03f, +7.929130936e-05f, +1.685578963e-03f, -9.129725459e-04f, +4.801879450e-04f, +4.409159553e-05f, - /* 16,14 */ +0.000000000e+00f, -1.941703587e-04f, +3.273087897e-04f, +5.737860098e-04f, -2.139058837e-03f, +1.421957113e-03f, +2.440111513e-03f, -4.464175630e-03f, +8.869321804e-04f, +3.696990655e-03f, -3.294943885e-03f, -2.869810557e-04f, +1.839340292e-03f, -8.604609066e-04f, +4.458313625e-04f, +7.672972562e-05f, - /* 16,15 */ +0.000000000e+00f, -1.523656204e-04f, +2.376896670e-04f, +6.906315332e-04f, -2.069667087e-03f, +1.044103847e-03f, +2.778972616e-03f, -4.272130602e-03f, +2.972906332e-04f, +4.014723865e-03f, -3.065104554e-03f, -6.635626436e-04f, +1.968627401e-03f, -7.863457700e-04f, +3.969443331e-04f, +1.129954761e-04f, - /* 12, 0 */ +1.006092301e-03f, -1.356592138e-03f, -5.291224839e-04f, +3.716365432e-03f, -3.908475818e-03f, -3.377012930e-04f, +4.272902045e-03f, -3.529241849e-03f, +1.347121185e-04f, +1.576582805e-03f, -1.021094463e-03f, +2.080147558e-04f, - /* 12, 1 */ +9.703330579e-04f, -1.123568815e-03f, -8.960631472e-04f, +3.830455785e-03f, -3.478978472e-03f, -1.006731283e-03f, +4.564422369e-03f, -3.270752231e-03f, -2.802589631e-04f, +1.777910422e-03f, -1.013271813e-03f, +1.540375404e-04f, - /* 12, 2 */ +9.162319547e-04f, -8.831264337e-04f, -1.229457804e-03f, +3.871345986e-03f, -2.993425932e-03f, -1.656773890e-03f, +4.776559314e-03f, -2.944064628e-03f, -7.081711396e-04f, +1.955059288e-03f, -9.809799530e-04f, +8.895597490e-05f, - /* 12, 3 */ +8.464715149e-04f, -6.407365814e-04f, -1.524162434e-03f, +3.840336583e-03f, -2.461816027e-03f, -2.275602698e-03f, +4.904341682e-03f, -2.553815646e-03f, -1.140836495e-03f, +2.102763165e-03f, -9.230670815e-04f, +1.349777819e-05f, - /* 12, 4 */ +7.639192828e-04f, -4.016125871e-04f, -1.776040886e-03f, +3.740131991e-03f, -1.894910812e-03f, -2.851629129e-03f, +4.944422783e-03f, -2.106045312e-03f, -1.569658753e-03f, +2.216140176e-03f, -8.389345160e-04f, -7.124952580e-05f, - /* 12, 5 */ +6.715456333e-04f, -1.706046467e-04f, -1.982015497e-03f, +3.574748146e-03f, -1.304005398e-03f, -3.374137989e-03f, +4.895165032e-03f, -1.608099956e-03f, -1.985807614e-03f, +2.290824513e-03f, -7.285864297e-04f, -1.638417811e-04f, - /* 12, 6 */ +5.723437636e-04f, +4.789167018e-05f, -2.140092391e-03f, +3.349394124e-03f, -7.006885404e-04f, -3.833503957e-03f, +4.756688774e-03f, -1.068504673e-03f, -2.380403858e-03f, +2.323091638e-03f, -5.926669574e-04f, -2.624916697e-04f, - /* 12, 7 */ +4.692537952e-04f, +2.500119139e-04f, -2.249361715e-03f, +3.070330944e-03f, -9.660032268e-05f, -4.221384345e-03f, +4.530883988e-03f, -4.968076992e-04f, -2.744711242e-03f, +2.309973659e-03f, -4.324830696e-04f, -3.650927179e-04f, - /* 12, 8 */ +3.650927179e-04f, +4.324830696e-04f, -2.309973659e-03f, +2.744711242e-03f, +4.968076992e-04f, -4.530883988e-03f, +4.221384345e-03f, +9.660032268e-05f, -3.070330944e-03f, +2.249361715e-03f, -2.500119139e-04f, -4.692537952e-04f, - /* 12, 9 */ +2.624916697e-04f, +5.926669574e-04f, -2.323091638e-03f, +2.380403858e-03f, +1.068504673e-03f, -4.756688774e-03f, +3.833503957e-03f, +7.006885404e-04f, -3.349394124e-03f, +2.140092391e-03f, -4.789167018e-05f, -5.723437636e-04f, - /* 12,10 */ +1.638417811e-04f, +7.285864297e-04f, -2.290824513e-03f, +1.985807614e-03f, +1.608099956e-03f, -4.895165032e-03f, +3.374137989e-03f, +1.304005398e-03f, -3.574748146e-03f, +1.982015497e-03f, +1.706046467e-04f, -6.715456333e-04f, - /* 12,11 */ +7.124952580e-05f, +8.389345160e-04f, -2.216140176e-03f, +1.569658753e-03f, +2.106045312e-03f, -4.944422783e-03f, +2.851629129e-03f, +1.894910812e-03f, -3.740131991e-03f, +1.776040886e-03f, +4.016125871e-04f, -7.639192828e-04f, - /* 12,12 */ -1.349777819e-05f, +9.230670815e-04f, -2.102763165e-03f, +1.140836495e-03f, +2.553815646e-03f, -4.904341682e-03f, +2.275602698e-03f, +2.461816027e-03f, -3.840336583e-03f, +1.524162434e-03f, +6.407365814e-04f, -8.464715149e-04f, - /* 12,13 */ -8.895597490e-05f, +9.809799530e-04f, -1.955059288e-03f, +7.081711396e-04f, +2.944064628e-03f, -4.776559314e-03f, +1.656773890e-03f, +2.993425932e-03f, -3.871345986e-03f, +1.229457804e-03f, +8.831264337e-04f, -9.162319547e-04f, - /* 12,14 */ -1.540375404e-04f, +1.013271813e-03f, -1.777910422e-03f, +2.802589631e-04f, +3.270752231e-03f, -4.564422369e-03f, +1.006731283e-03f, +3.478978472e-03f, -3.830455785e-03f, +8.960631472e-04f, +1.123568815e-03f, -9.703330579e-04f, - /* 12,15 */ -2.080147558e-04f, +1.021094463e-03f, -1.576582805e-03f, -1.347121185e-04f, +3.529241849e-03f, -4.272902045e-03f, +3.377012930e-04f, +3.908475818e-03f, -3.716365432e-03f, +5.291224839e-04f, +1.356592138e-03f, -1.006092301e-03f, - /* 12, 0 */ +7.165252154e-04f, -4.291307465e-04f, -1.619691310e-03f, +4.112050532e-03f, -3.684471854e-03f, -3.806742210e-04f, +4.167864669e-03f, -4.064044128e-03f, +1.285631838e-03f, +6.994376016e-04f, -8.205283947e-04f, +3.212754781e-04f, - /* 12, 1 */ +6.042449626e-04f, -1.684748882e-04f, -1.902468489e-03f, +4.073990388e-03f, -3.134198780e-03f, -1.133926469e-03f, +4.572939653e-03f, -3.928365474e-03f, +9.055999228e-04f, +9.731965741e-04f, -9.124383184e-04f, +3.311614162e-04f, - /* 12, 2 */ +4.874350434e-04f, +7.694308689e-05f, -2.130082097e-03f, +3.953363211e-03f, -2.529802622e-03f, -1.863076830e-03f, +4.889863669e-03f, -3.705392569e-03f, +4.862599326e-04f, +1.243729140e-03f, -9.884795125e-04f, +3.301883495e-04f, - /* 12, 3 */ +3.696734183e-04f, +3.022578517e-04f, -2.300114973e-03f, +3.755428771e-03f, -1.885047396e-03f, -2.552675098e-03f, +5.110657479e-03f, -3.397530000e-03f, +3.551878686e-05f, +1.504029611e-03f, -1.045032679e-03f, +3.171093301e-04f, - /* 12, 4 */ +2.542791637e-04f, +5.034105172e-04f, -2.411611526e-03f, +3.487034212e-03f, -1.214371318e-03f, -3.188181667e-03f, +5.229403271e-03f, -3.009202669e-03f, -4.376222644e-04f, +1.746934410e-03f, -1.078752986e-03f, +2.909691299e-04f, - /* 12, 5 */ +1.442362351e-04f, +6.772076791e-04f, -2.465038541e-03f, +3.156407157e-03f, -5.325427440e-04f, -3.756300237e-03f, +5.242404627e-03f, -2.546799451e-03f, -9.232494237e-04f, +1.965304174e-03f, -1.086687765e-03f, +2.511615343e-04f, - /* 12, 6 */ +4.213190220e-05f, +8.213542577e-04f, -2.462211671e-03f, +2.772920825e-03f, +1.456866600e-04f, -4.245279979e-03f, +5.148294544e-03f, -2.018567160e-03f, -1.410748009e-03f, +2.152214196e-03f, -1.066390037e-03f, +1.974793328e-04f, - /* 12, 7 */ -4.988918599e-05f, +9.344605010e-04f, -2.406190818e-03f, +2.346837790e-03f, +8.059229054e-04f, -4.645179801e-03f, +4.948088353e-03f, -1.434456490e-03f, -1.889039390e-03f, +2.301148282e-03f, -1.016024228e-03f, +1.301548676e-04f, - /* 12, 8 */ -1.301548676e-04f, +1.016024228e-03f, -2.301148282e-03f, +1.889039390e-03f, +1.434456490e-03f, -4.948088353e-03f, +4.645179801e-03f, -8.059229054e-04f, -2.346837790e-03f, +2.406190818e-03f, -9.344605010e-04f, +4.988918599e-05f, - /* 12, 9 */ -1.974793328e-04f, +1.066390037e-03f, -2.152214196e-03f, +1.410748009e-03f, +2.018567160e-03f, -5.148294544e-03f, +4.245279979e-03f, -1.456866600e-04f, -2.772920825e-03f, +2.462211671e-03f, -8.213542577e-04f, -4.213190220e-05f, - /* 12,10 */ -2.511615343e-04f, +1.086687765e-03f, -1.965304174e-03f, +9.232494237e-04f, +2.546799451e-03f, -5.242404627e-03f, +3.756300237e-03f, +5.325427440e-04f, -3.156407157e-03f, +2.465038541e-03f, -6.772076791e-04f, -1.442362351e-04f, - /* 12,11 */ -2.909691299e-04f, +1.078752986e-03f, -1.746934410e-03f, +4.376222644e-04f, +3.009202669e-03f, -5.229403271e-03f, +3.188181667e-03f, +1.214371318e-03f, -3.487034212e-03f, +2.411611526e-03f, -5.034105172e-04f, -2.542791637e-04f, - /* 12,12 */ -3.171093301e-04f, +1.045032679e-03f, -1.504029611e-03f, -3.551878686e-05f, +3.397530000e-03f, -5.110657479e-03f, +2.552675098e-03f, +1.885047396e-03f, -3.755428771e-03f, +2.300114973e-03f, -3.022578517e-04f, -3.696734183e-04f, - /* 12,13 */ -3.301883495e-04f, +9.884795125e-04f, -1.243729140e-03f, -4.862599326e-04f, +3.705392569e-03f, -4.889863669e-03f, +1.863076830e-03f, +2.529802622e-03f, -3.953363211e-03f, +2.130082097e-03f, -7.694308689e-05f, -4.874350434e-04f, - /* 12,14 */ -3.311614162e-04f, +9.124383184e-04f, -9.731965741e-04f, -9.055999228e-04f, +3.928365474e-03f, -4.572939653e-03f, +1.133926469e-03f, +3.134198780e-03f, -4.073990388e-03f, +1.902468489e-03f, +1.684748882e-04f, -6.042449626e-04f, - /* 12,15 */ -3.212754781e-04f, +8.205283947e-04f, -6.994376016e-04f, -1.285631838e-03f, +4.064044128e-03f, -4.167864669e-03f, +3.806742210e-04f, +3.684471854e-03f, -4.112050532e-03f, +1.619691310e-03f, +4.291307465e-04f, -7.165252154e-04f -}; diff --git a/Engine/lib/openal-soft/Alc/compat.h b/Engine/lib/openal-soft/Alc/compat.h index 114fc655d..093184c81 100644 --- a/Engine/lib/openal-soft/Alc/compat.h +++ b/Engine/lib/openal-soft/Alc/compat.h @@ -3,6 +3,10 @@ #include "alstring.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -38,7 +42,7 @@ struct FileMapping { struct FileMapping MapFileToMem(const char *fname); void UnmapFileMem(const struct FileMapping *mapping); -al_string GetProcPath(void); +void GetProcBinary(al_string *path, al_string *fname); #ifdef HAVE_DYNLOAD void *LoadLib(const char *name); @@ -46,4 +50,16 @@ void CloseLib(void *handle); void *GetSymbol(void *handle, const char *name); #endif +#ifdef __ANDROID__ +#define JCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS +#define JCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS + +/** Returns a JNIEnv*. */ +void *Android_GetJNIEnv(void); +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* AL_COMPAT_H */ diff --git a/Engine/lib/openal-soft/Alc/converter.c b/Engine/lib/openal-soft/Alc/converter.c new file mode 100644 index 000000000..ef2eb9af2 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/converter.c @@ -0,0 +1,468 @@ + +#include "config.h" + +#include "converter.h" + +#include "fpu_modes.h" +#include "mixer/defs.h" + + +SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate) +{ + SampleConverter *converter; + ALsizei step; + + if(numchans <= 0 || srcRate <= 0 || dstRate <= 0) + return NULL; + + converter = al_calloc(16, FAM_SIZE(SampleConverter, Chan, numchans)); + converter->mSrcType = srcType; + converter->mDstType = dstType; + converter->mNumChannels = numchans; + converter->mSrcTypeSize = BytesFromDevFmt(srcType); + converter->mDstTypeSize = BytesFromDevFmt(dstType); + + converter->mSrcPrepCount = 0; + converter->mFracOffset = 0; + + /* Have to set the mixer FPU mode since that's what the resampler code expects. */ + START_MIXER_MODE(); + step = (ALsizei)mind(((ALdouble)srcRate/dstRate*FRACTIONONE) + 0.5, + MAX_PITCH * FRACTIONONE); + converter->mIncrement = maxi(step, 1); + if(converter->mIncrement == FRACTIONONE) + converter->mResample = Resample_copy_C; + else + { + /* TODO: Allow other resamplers. */ + BsincPrepare(converter->mIncrement, &converter->mState.bsinc, &bsinc12); + converter->mResample = SelectResampler(BSinc12Resampler); + } + END_MIXER_MODE(); + + return converter; +} + +void DestroySampleConverter(SampleConverter **converter) +{ + if(converter) + { + al_free(*converter); + *converter = NULL; + } +} + + +static inline ALfloat Sample_ALbyte(ALbyte val) +{ return val * (1.0f/128.0f); } +static inline ALfloat Sample_ALubyte(ALubyte val) +{ return Sample_ALbyte((ALint)val - 128); } + +static inline ALfloat Sample_ALshort(ALshort val) +{ return val * (1.0f/32768.0f); } +static inline ALfloat Sample_ALushort(ALushort val) +{ return Sample_ALshort((ALint)val - 32768); } + +static inline ALfloat Sample_ALint(ALint val) +{ return (val>>7) * (1.0f/16777216.0f); } +static inline ALfloat Sample_ALuint(ALuint val) +{ return Sample_ALint(val - INT_MAX - 1); } + +static inline ALfloat Sample_ALfloat(ALfloat val) +{ return val; } + +#define DECL_TEMPLATE(T) \ +static inline void Load_##T(ALfloat *restrict dst, const T *restrict src, \ + ALint srcstep, ALsizei samples) \ +{ \ + ALsizei i; \ + for(i = 0;i < samples;i++) \ + dst[i] = Sample_##T(src[i*srcstep]); \ +} + +DECL_TEMPLATE(ALbyte) +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALushort) +DECL_TEMPLATE(ALint) +DECL_TEMPLATE(ALuint) +DECL_TEMPLATE(ALfloat) + +#undef DECL_TEMPLATE + +static void LoadSamples(ALfloat *dst, const ALvoid *src, ALint srcstep, enum DevFmtType srctype, ALsizei samples) +{ + switch(srctype) + { + case DevFmtByte: + Load_ALbyte(dst, src, srcstep, samples); + break; + case DevFmtUByte: + Load_ALubyte(dst, src, srcstep, samples); + break; + case DevFmtShort: + Load_ALshort(dst, src, srcstep, samples); + break; + case DevFmtUShort: + Load_ALushort(dst, src, srcstep, samples); + break; + case DevFmtInt: + Load_ALint(dst, src, srcstep, samples); + break; + case DevFmtUInt: + Load_ALuint(dst, src, srcstep, samples); + break; + case DevFmtFloat: + Load_ALfloat(dst, src, srcstep, samples); + break; + } +} + + +static inline ALbyte ALbyte_Sample(ALfloat val) +{ return fastf2i(clampf(val*128.0f, -128.0f, 127.0f)); } +static inline ALubyte ALubyte_Sample(ALfloat val) +{ return ALbyte_Sample(val)+128; } + +static inline ALshort ALshort_Sample(ALfloat val) +{ return fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f)); } +static inline ALushort ALushort_Sample(ALfloat val) +{ return ALshort_Sample(val)+32768; } + +static inline ALint ALint_Sample(ALfloat val) +{ return fastf2i(clampf(val*16777216.0f, -16777216.0f, 16777215.0f)) << 7; } +static inline ALuint ALuint_Sample(ALfloat val) +{ return ALint_Sample(val)+INT_MAX+1; } + +static inline ALfloat ALfloat_Sample(ALfloat val) +{ return val; } + +#define DECL_TEMPLATE(T) \ +static inline void Store_##T(T *restrict dst, const ALfloat *restrict src, \ + ALint dststep, ALsizei samples) \ +{ \ + ALsizei i; \ + for(i = 0;i < samples;i++) \ + dst[i*dststep] = T##_Sample(src[i]); \ +} + +DECL_TEMPLATE(ALbyte) +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALushort) +DECL_TEMPLATE(ALint) +DECL_TEMPLATE(ALuint) +DECL_TEMPLATE(ALfloat) + +#undef DECL_TEMPLATE + +static void StoreSamples(ALvoid *dst, const ALfloat *src, ALint dststep, enum DevFmtType dsttype, ALsizei samples) +{ + switch(dsttype) + { + case DevFmtByte: + Store_ALbyte(dst, src, dststep, samples); + break; + case DevFmtUByte: + Store_ALubyte(dst, src, dststep, samples); + break; + case DevFmtShort: + Store_ALshort(dst, src, dststep, samples); + break; + case DevFmtUShort: + Store_ALushort(dst, src, dststep, samples); + break; + case DevFmtInt: + Store_ALint(dst, src, dststep, samples); + break; + case DevFmtUInt: + Store_ALuint(dst, src, dststep, samples); + break; + case DevFmtFloat: + Store_ALfloat(dst, src, dststep, samples); + break; + } +} + + +ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes) +{ + ALint prepcount = converter->mSrcPrepCount; + ALsizei increment = converter->mIncrement; + ALsizei DataPosFrac = converter->mFracOffset; + ALuint64 DataSize64; + + if(prepcount < 0) + { + /* Negative prepcount means we need to skip that many input samples. */ + if(-prepcount >= srcframes) + return 0; + srcframes += prepcount; + prepcount = 0; + } + + if(srcframes < 1) + { + /* No output samples if there's no input samples. */ + return 0; + } + + if(prepcount < MAX_RESAMPLE_PADDING*2 && + MAX_RESAMPLE_PADDING*2 - prepcount >= srcframes) + { + /* Not enough input samples to generate an output sample. */ + return 0; + } + + DataSize64 = prepcount; + DataSize64 += srcframes; + DataSize64 -= MAX_RESAMPLE_PADDING*2; + DataSize64 <<= FRACTIONBITS; + DataSize64 -= DataPosFrac; + + /* If we have a full prep, we can generate at least one sample. */ + return (ALsizei)clampu64((DataSize64 + increment-1)/increment, 1, BUFFERSIZE); +} + + +ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes) +{ + const ALsizei SrcFrameSize = converter->mNumChannels * converter->mSrcTypeSize; + const ALsizei DstFrameSize = converter->mNumChannels * converter->mDstTypeSize; + const ALsizei increment = converter->mIncrement; + ALsizei pos = 0; + + START_MIXER_MODE(); + while(pos < dstframes && *srcframes > 0) + { + ALfloat *restrict SrcData = ASSUME_ALIGNED(converter->mSrcSamples, 16); + ALfloat *restrict DstData = ASSUME_ALIGNED(converter->mDstSamples, 16); + ALint prepcount = converter->mSrcPrepCount; + ALsizei DataPosFrac = converter->mFracOffset; + ALuint64 DataSize64; + ALsizei DstSize; + ALint toread; + ALsizei chan; + + if(prepcount < 0) + { + /* Negative prepcount means we need to skip that many input samples. */ + if(-prepcount >= *srcframes) + { + converter->mSrcPrepCount = prepcount + *srcframes; + *srcframes = 0; + break; + } + *src = (const ALbyte*)*src + SrcFrameSize*-prepcount; + *srcframes += prepcount; + converter->mSrcPrepCount = 0; + continue; + } + toread = mini(*srcframes, BUFFERSIZE - MAX_RESAMPLE_PADDING*2); + + if(prepcount < MAX_RESAMPLE_PADDING*2 && + MAX_RESAMPLE_PADDING*2 - prepcount >= toread) + { + /* Not enough input samples to generate an output sample. Store + * what we're given for later. + */ + for(chan = 0;chan < converter->mNumChannels;chan++) + LoadSamples(&converter->Chan[chan].mPrevSamples[prepcount], + (const ALbyte*)*src + converter->mSrcTypeSize*chan, + converter->mNumChannels, converter->mSrcType, toread + ); + + converter->mSrcPrepCount = prepcount + toread; + *srcframes = 0; + break; + } + + DataSize64 = prepcount; + DataSize64 += toread; + DataSize64 -= MAX_RESAMPLE_PADDING*2; + DataSize64 <<= FRACTIONBITS; + DataSize64 -= DataPosFrac; + + /* If we have a full prep, we can generate at least one sample. */ + DstSize = (ALsizei)clampu64((DataSize64 + increment-1)/increment, 1, BUFFERSIZE); + DstSize = mini(DstSize, dstframes-pos); + + for(chan = 0;chan < converter->mNumChannels;chan++) + { + const ALbyte *SrcSamples = (const ALbyte*)*src + converter->mSrcTypeSize*chan; + ALbyte *DstSamples = (ALbyte*)dst + converter->mDstTypeSize*chan; + const ALfloat *ResampledData; + ALsizei SrcDataEnd; + + /* Load the previous samples into the source data first, then the + * new samples from the input buffer. + */ + memcpy(SrcData, converter->Chan[chan].mPrevSamples, + prepcount*sizeof(ALfloat)); + LoadSamples(SrcData + prepcount, SrcSamples, + converter->mNumChannels, converter->mSrcType, toread + ); + + /* Store as many prep samples for next time as possible, given the + * number of output samples being generated. + */ + SrcDataEnd = (DataPosFrac + increment*DstSize)>>FRACTIONBITS; + if(SrcDataEnd >= prepcount+toread) + memset(converter->Chan[chan].mPrevSamples, 0, + sizeof(converter->Chan[chan].mPrevSamples)); + else + { + size_t len = mini(MAX_RESAMPLE_PADDING*2, prepcount+toread-SrcDataEnd); + memcpy(converter->Chan[chan].mPrevSamples, &SrcData[SrcDataEnd], + len*sizeof(ALfloat)); + memset(converter->Chan[chan].mPrevSamples+len, 0, + sizeof(converter->Chan[chan].mPrevSamples) - len*sizeof(ALfloat)); + } + + /* Now resample, and store the result in the output buffer. */ + ResampledData = converter->mResample(&converter->mState, + SrcData+MAX_RESAMPLE_PADDING, DataPosFrac, increment, + DstData, DstSize + ); + + StoreSamples(DstSamples, ResampledData, converter->mNumChannels, + converter->mDstType, DstSize); + } + + /* Update the number of prep samples still available, as well as the + * fractional offset. + */ + DataPosFrac += increment*DstSize; + converter->mSrcPrepCount = mini(prepcount + toread - (DataPosFrac>>FRACTIONBITS), + MAX_RESAMPLE_PADDING*2); + converter->mFracOffset = DataPosFrac & FRACTIONMASK; + + /* Update the src and dst pointers in case there's still more to do. */ + *src = (const ALbyte*)*src + SrcFrameSize*(DataPosFrac>>FRACTIONBITS); + *srcframes -= mini(*srcframes, (DataPosFrac>>FRACTIONBITS)); + + dst = (ALbyte*)dst + DstFrameSize*DstSize; + pos += DstSize; + } + END_MIXER_MODE(); + + return pos; +} + + +ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans) +{ + ChannelConverter *converter; + + if(srcChans != dstChans && !((srcChans == DevFmtMono && dstChans == DevFmtStereo) || + (srcChans == DevFmtStereo && dstChans == DevFmtMono))) + return NULL; + + converter = al_calloc(DEF_ALIGN, sizeof(*converter)); + converter->mSrcType = srcType; + converter->mSrcChans = srcChans; + converter->mDstChans = dstChans; + + return converter; +} + +void DestroyChannelConverter(ChannelConverter **converter) +{ + if(converter) + { + al_free(*converter); + *converter = NULL; + } +} + + +#define DECL_TEMPLATE(T) \ +static void Mono2Stereo##T(ALfloat *restrict dst, const T *src, ALsizei frames)\ +{ \ + ALsizei i; \ + for(i = 0;i < frames;i++) \ + dst[i*2 + 1] = dst[i*2 + 0] = Sample_##T(src[i]) * 0.707106781187f; \ +} \ + \ +static void Stereo2Mono##T(ALfloat *restrict dst, const T *src, ALsizei frames)\ +{ \ + ALsizei i; \ + for(i = 0;i < frames;i++) \ + dst[i] = (Sample_##T(src[i*2 + 0])+Sample_##T(src[i*2 + 1])) * \ + 0.707106781187f; \ +} + +DECL_TEMPLATE(ALbyte) +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALushort) +DECL_TEMPLATE(ALint) +DECL_TEMPLATE(ALuint) +DECL_TEMPLATE(ALfloat) + +#undef DECL_TEMPLATE + +void ChannelConverterInput(ChannelConverter *converter, const ALvoid *src, ALfloat *dst, ALsizei frames) +{ + if(converter->mSrcChans == converter->mDstChans) + { + LoadSamples(dst, src, 1, converter->mSrcType, + frames*ChannelsFromDevFmt(converter->mSrcChans, 0)); + return; + } + + if(converter->mSrcChans == DevFmtStereo && converter->mDstChans == DevFmtMono) + { + switch(converter->mSrcType) + { + case DevFmtByte: + Stereo2MonoALbyte(dst, src, frames); + break; + case DevFmtUByte: + Stereo2MonoALubyte(dst, src, frames); + break; + case DevFmtShort: + Stereo2MonoALshort(dst, src, frames); + break; + case DevFmtUShort: + Stereo2MonoALushort(dst, src, frames); + break; + case DevFmtInt: + Stereo2MonoALint(dst, src, frames); + break; + case DevFmtUInt: + Stereo2MonoALuint(dst, src, frames); + break; + case DevFmtFloat: + Stereo2MonoALfloat(dst, src, frames); + break; + } + } + else /*if(converter->mSrcChans == DevFmtMono && converter->mDstChans == DevFmtStereo)*/ + { + switch(converter->mSrcType) + { + case DevFmtByte: + Mono2StereoALbyte(dst, src, frames); + break; + case DevFmtUByte: + Mono2StereoALubyte(dst, src, frames); + break; + case DevFmtShort: + Mono2StereoALshort(dst, src, frames); + break; + case DevFmtUShort: + Mono2StereoALushort(dst, src, frames); + break; + case DevFmtInt: + Mono2StereoALint(dst, src, frames); + break; + case DevFmtUInt: + Mono2StereoALuint(dst, src, frames); + break; + case DevFmtFloat: + Mono2StereoALfloat(dst, src, frames); + break; + } + } +} diff --git a/Engine/lib/openal-soft/Alc/converter.h b/Engine/lib/openal-soft/Alc/converter.h new file mode 100644 index 000000000..b58fd831d --- /dev/null +++ b/Engine/lib/openal-soft/Alc/converter.h @@ -0,0 +1,55 @@ +#ifndef CONVERTER_H +#define CONVERTER_H + +#include "alMain.h" +#include "alu.h" + +#ifdef __cpluspluc +extern "C" { +#endif + +typedef struct SampleConverter { + enum DevFmtType mSrcType; + enum DevFmtType mDstType; + ALsizei mNumChannels; + ALsizei mSrcTypeSize; + ALsizei mDstTypeSize; + + ALint mSrcPrepCount; + + ALsizei mFracOffset; + ALsizei mIncrement; + InterpState mState; + ResamplerFunc mResample; + + alignas(16) ALfloat mSrcSamples[BUFFERSIZE]; + alignas(16) ALfloat mDstSamples[BUFFERSIZE]; + + struct { + alignas(16) ALfloat mPrevSamples[MAX_RESAMPLE_PADDING*2]; + } Chan[]; +} SampleConverter; + +SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate); +void DestroySampleConverter(SampleConverter **converter); + +ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes); +ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes); + + +typedef struct ChannelConverter { + enum DevFmtType mSrcType; + enum DevFmtChannels mSrcChans; + enum DevFmtChannels mDstChans; +} ChannelConverter; + +ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans); +void DestroyChannelConverter(ChannelConverter **converter); + +void ChannelConverterInput(ChannelConverter *converter, const ALvoid *src, ALfloat *dst, ALsizei frames); + +#ifdef __cpluspluc +} +#endif + +#endif /* CONVERTER_H */ diff --git a/Engine/lib/openal-soft/Alc/cpu_caps.h b/Engine/lib/openal-soft/Alc/cpu_caps.h new file mode 100644 index 000000000..328d470e4 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/cpu_caps.h @@ -0,0 +1,15 @@ +#ifndef CPU_CAPS_H +#define CPU_CAPS_H + +extern int CPUCapFlags; +enum { + CPU_CAP_SSE = 1<<0, + CPU_CAP_SSE2 = 1<<1, + CPU_CAP_SSE3 = 1<<2, + CPU_CAP_SSE4_1 = 1<<3, + CPU_CAP_NEON = 1<<4, +}; + +void FillCPUCaps(int capfilter); + +#endif /* CPU_CAPS_H */ diff --git a/Engine/lib/openal-soft/Alc/effects/chorus.c b/Engine/lib/openal-soft/Alc/effects/chorus.c index 63d0ca018..ffb2b572e 100644 --- a/Engine/lib/openal-soft/Alc/effects/chorus.c +++ b/Engine/lib/openal-soft/Alc/effects/chorus.c @@ -24,32 +24,40 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" -enum ChorusWaveForm { - CWF_Triangle = AL_CHORUS_WAVEFORM_TRIANGLE, - CWF_Sinusoid = AL_CHORUS_WAVEFORM_SINUSOID +static_assert(AL_CHORUS_WAVEFORM_SINUSOID == AL_FLANGER_WAVEFORM_SINUSOID, "Chorus/Flanger waveform value mismatch"); +static_assert(AL_CHORUS_WAVEFORM_TRIANGLE == AL_FLANGER_WAVEFORM_TRIANGLE, "Chorus/Flanger waveform value mismatch"); + +enum WaveForm { + WF_Sinusoid, + WF_Triangle }; typedef struct ALchorusState { DERIVE_FROM_TYPE(ALeffectState); - ALfloat *SampleBuffer[2]; - ALuint BufferLength; - ALuint offset; - ALuint lfo_range; + ALfloat *SampleBuffer; + ALsizei BufferLength; + ALsizei offset; + + ALsizei lfo_offset; + ALsizei lfo_range; ALfloat lfo_scale; ALint lfo_disp; /* Gains for left and right sides */ - ALfloat Gain[2][MAX_OUTPUT_CHANNELS]; + struct { + ALfloat Current[MAX_OUTPUT_CHANNELS]; + ALfloat Target[MAX_OUTPUT_CHANNELS]; + } Gains[2]; /* effect parameters */ - enum ChorusWaveForm waveform; + enum WaveForm waveform; ALint delay; ALfloat depth; ALfloat feedback; @@ -57,8 +65,8 @@ typedef struct ALchorusState { static ALvoid ALchorusState_Destruct(ALchorusState *state); static ALboolean ALchorusState_deviceUpdate(ALchorusState *state, ALCdevice *Device); -static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALchorusState_update(ALchorusState *state, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props); +static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALchorusState) DEFINE_ALEFFECTSTATE_VTABLE(ALchorusState); @@ -70,54 +78,51 @@ static void ALchorusState_Construct(ALchorusState *state) SET_VTABLE2(ALchorusState, ALeffectState, state); state->BufferLength = 0; - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; + state->SampleBuffer = NULL; state->offset = 0; + state->lfo_offset = 0; state->lfo_range = 1; - state->waveform = CWF_Triangle; + state->waveform = WF_Triangle; } static ALvoid ALchorusState_Destruct(ALchorusState *state) { - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; + al_free(state->SampleBuffer); + state->SampleBuffer = NULL; ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } static ALboolean ALchorusState_deviceUpdate(ALchorusState *state, ALCdevice *Device) { - ALuint maxlen; - ALuint it; + const ALfloat max_delay = maxf(AL_CHORUS_MAX_DELAY, AL_FLANGER_MAX_DELAY); + ALsizei maxlen; - maxlen = fastf2u(AL_CHORUS_MAX_DELAY * 3.0f * Device->Frequency) + 1; - maxlen = NextPowerOf2(maxlen); + maxlen = NextPowerOf2(float2int(max_delay*2.0f*Device->Frequency) + 1u); + if(maxlen <= 0) return AL_FALSE; if(maxlen != state->BufferLength) { - void *temp = al_calloc(16, maxlen * sizeof(ALfloat) * 2); + void *temp = al_calloc(16, maxlen * sizeof(ALfloat)); if(!temp) return AL_FALSE; - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = temp; - state->SampleBuffer[1] = state->SampleBuffer[0] + maxlen; + al_free(state->SampleBuffer); + state->SampleBuffer = temp; state->BufferLength = maxlen; } - for(it = 0;it < state->BufferLength;it++) - { - state->SampleBuffer[0][it] = 0.0f; - state->SampleBuffer[1][it] = 0.0f; - } + memset(state->SampleBuffer, 0, state->BufferLength*sizeof(ALfloat)); + memset(state->Gains, 0, sizeof(state->Gains)); return AL_TRUE; } -static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALchorusState_update(ALchorusState *state, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props) { - ALfloat frequency = (ALfloat)Device->Frequency; + const ALsizei mindelay = MAX_RESAMPLE_PADDING << FRACTIONBITS; + const ALCdevice *device = Context->Device; + ALfloat frequency = (ALfloat)device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat rate; ALint phase; @@ -125,156 +130,166 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device switch(props->Chorus.Waveform) { case AL_CHORUS_WAVEFORM_TRIANGLE: - state->waveform = CWF_Triangle; + state->waveform = WF_Triangle; break; case AL_CHORUS_WAVEFORM_SINUSOID: - state->waveform = CWF_Sinusoid; + state->waveform = WF_Sinusoid; break; } - state->depth = props->Chorus.Depth; + + /* The LFO depth is scaled to be relative to the sample delay. Clamp the + * delay and depth to allow enough padding for resampling. + */ + state->delay = maxi(float2int(props->Chorus.Delay*frequency*FRACTIONONE + 0.5f), + mindelay); + state->depth = minf(props->Chorus.Depth * state->delay, + (ALfloat)(state->delay - mindelay)); + state->feedback = props->Chorus.Feedback; - state->delay = fastf2i(props->Chorus.Delay * frequency); /* Gains for left and right sides */ - CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[0]); - CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[1]); + CalcAngleCoeffs(-F_PI_2, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, Slot->Params.Gain, state->Gains[0].Target); + CalcAngleCoeffs( F_PI_2, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, Slot->Params.Gain, state->Gains[1].Target); phase = props->Chorus.Phase; rate = props->Chorus.Rate; if(!(rate > 0.0f)) { - state->lfo_scale = 0.0f; + state->lfo_offset = 0; state->lfo_range = 1; + state->lfo_scale = 0.0f; state->lfo_disp = 0; } else { - /* Calculate LFO coefficient */ - state->lfo_range = fastf2u(frequency/rate + 0.5f); + /* Calculate LFO coefficient (number of samples per cycle). Limit the + * max range to avoid overflow when calculating the displacement. + */ + ALsizei lfo_range = float2int(minf(frequency/rate + 0.5f, (ALfloat)(INT_MAX/360 - 180))); + + state->lfo_offset = float2int((ALfloat)state->lfo_offset/state->lfo_range* + lfo_range + 0.5f) % lfo_range; + state->lfo_range = lfo_range; switch(state->waveform) { - case CWF_Triangle: + case WF_Triangle: state->lfo_scale = 4.0f / state->lfo_range; break; - case CWF_Sinusoid: + case WF_Sinusoid: state->lfo_scale = F_TAU / state->lfo_range; break; } /* Calculate lfo phase displacement */ - state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); + if(phase < 0) phase = 360 + phase; + state->lfo_disp = (state->lfo_range*phase + 180) / 360; } } -static inline void Triangle(ALint *delay_left, ALint *delay_right, ALuint offset, const ALchorusState *state) +static void GetTriangleDelays(ALint *restrict delays, ALsizei offset, const ALsizei lfo_range, + const ALfloat lfo_scale, const ALfloat depth, const ALsizei delay, + const ALsizei todo) { - ALfloat lfo_value; - - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; + ALsizei i; + for(i = 0;i < todo;i++) + { + delays[i] = fastf2i((1.0f - fabsf(2.0f - lfo_scale*offset)) * depth) + delay; + offset = (offset+1)%lfo_range; + } } -static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALuint offset, const ALchorusState *state) +static void GetSinusoidDelays(ALint *restrict delays, ALsizei offset, const ALsizei lfo_range, + const ALfloat lfo_scale, const ALfloat depth, const ALsizei delay, + const ALsizei todo) { - ALfloat lfo_value; - - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; + ALsizei i; + for(i = 0;i < todo;i++) + { + delays[i] = fastf2i(sinf(lfo_scale*offset) * depth) + delay; + offset = (offset+1)%lfo_range; + } } -#define DECL_TEMPLATE(Func) \ -static void Process##Func(ALchorusState *state, const ALuint SamplesToDo, \ - const ALfloat *restrict SamplesIn, ALfloat (*restrict out)[2]) \ -{ \ - const ALuint bufmask = state->BufferLength-1; \ - ALfloat *restrict leftbuf = state->SampleBuffer[0]; \ - ALfloat *restrict rightbuf = state->SampleBuffer[1]; \ - ALuint offset = state->offset; \ - const ALfloat feedback = state->feedback; \ - ALuint it; \ - \ - for(it = 0;it < SamplesToDo;it++) \ - { \ - ALint delay_left, delay_right; \ - Func(&delay_left, &delay_right, offset, state); \ - \ - out[it][0] = leftbuf[(offset-delay_left)&bufmask]; \ - leftbuf[offset&bufmask] = (out[it][0]+SamplesIn[it]) * feedback; \ - \ - out[it][1] = rightbuf[(offset-delay_right)&bufmask]; \ - rightbuf[offset&bufmask] = (out[it][1]+SamplesIn[it]) * feedback; \ - \ - offset++; \ - } \ - state->offset = offset; \ -} -DECL_TEMPLATE(Triangle) -DECL_TEMPLATE(Sinusoid) - -#undef DECL_TEMPLATE - -static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - ALuint it, kt; - ALuint base; + const ALsizei bufmask = state->BufferLength-1; + const ALfloat feedback = state->feedback; + const ALsizei avgdelay = (state->delay + (FRACTIONONE>>1)) >> FRACTIONBITS; + ALfloat *restrict delaybuf = state->SampleBuffer; + ALsizei offset = state->offset; + ALsizei i, c; + ALsizei base; for(base = 0;base < SamplesToDo;) { - ALfloat temps[128][2]; - ALuint td = minu(128, SamplesToDo-base); + const ALsizei todo = mini(256, SamplesToDo-base); + ALint moddelays[2][256]; + alignas(16) ALfloat temps[2][256]; - switch(state->waveform) + if(state->waveform == WF_Sinusoid) { - case CWF_Triangle: - ProcessTriangle(state, td, SamplesIn[0]+base, temps); - break; - case CWF_Sinusoid: - ProcessSinusoid(state, td, SamplesIn[0]+base, temps); - break; + GetSinusoidDelays(moddelays[0], state->lfo_offset, state->lfo_range, state->lfo_scale, + state->depth, state->delay, todo); + GetSinusoidDelays(moddelays[1], (state->lfo_offset+state->lfo_disp)%state->lfo_range, + state->lfo_range, state->lfo_scale, state->depth, state->delay, + todo); + } + else /*if(state->waveform == WF_Triangle)*/ + { + GetTriangleDelays(moddelays[0], state->lfo_offset, state->lfo_range, state->lfo_scale, + state->depth, state->delay, todo); + GetTriangleDelays(moddelays[1], (state->lfo_offset+state->lfo_disp)%state->lfo_range, + state->lfo_range, state->lfo_scale, state->depth, state->delay, + todo); + } + state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range; + + for(i = 0;i < todo;i++) + { + ALint delay; + ALfloat mu; + + // Feed the buffer's input first (necessary for delays < 1). + delaybuf[offset&bufmask] = SamplesIn[0][base+i]; + + // Tap for the left output. + delay = offset - (moddelays[0][i]>>FRACTIONBITS); + mu = (moddelays[0][i]&FRACTIONMASK) * (1.0f/FRACTIONONE); + temps[0][i] = cubic(delaybuf[(delay+1) & bufmask], delaybuf[(delay ) & bufmask], + delaybuf[(delay-1) & bufmask], delaybuf[(delay-2) & bufmask], + mu); + + // Tap for the right output. + delay = offset - (moddelays[1][i]>>FRACTIONBITS); + mu = (moddelays[1][i]&FRACTIONMASK) * (1.0f/FRACTIONONE); + temps[1][i] = cubic(delaybuf[(delay+1) & bufmask], delaybuf[(delay ) & bufmask], + delaybuf[(delay-1) & bufmask], delaybuf[(delay-2) & bufmask], + mu); + + // Accumulate feedback from the average delay of the taps. + delaybuf[offset&bufmask] += delaybuf[(offset-avgdelay) & bufmask] * feedback; + offset++; } - for(kt = 0;kt < NumChannels;kt++) - { - ALfloat gain = state->Gain[0][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][0] * gain; - } + for(c = 0;c < 2;c++) + MixSamples(temps[c], NumChannels, SamplesOut, state->Gains[c].Current, + state->Gains[c].Target, SamplesToDo-base, base, todo); - gain = state->Gain[1][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][1] * gain; - } - } - - base += td; + base += todo; } + + state->offset = offset; } -typedef struct ALchorusStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALchorusStateFactory; +typedef struct ChorusStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} ChorusStateFactory; -static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *UNUSED(factory)) +static ALeffectState *ChorusStateFactory_create(ChorusStateFactory *UNUSED(factory)) { ALchorusState *state; @@ -284,14 +299,14 @@ static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *UNUSED(f return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALchorusStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(ChorusStateFactory); -ALeffectStateFactory *ALchorusStateFactory_getFactory(void) +EffectStateFactory *ChorusStateFactory_getFactory(void) { - static ALchorusStateFactory ChorusFactory = { { GET_VTABLE2(ALchorusStateFactory, ALeffectStateFactory) } }; + static ChorusStateFactory ChorusFactory = { { GET_VTABLE2(ChorusStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &ChorusFactory); + return STATIC_CAST(EffectStateFactory, &ChorusFactory); } @@ -302,24 +317,22 @@ void ALchorus_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi { case AL_CHORUS_WAVEFORM: if(!(val >= AL_CHORUS_MIN_WAVEFORM && val <= AL_CHORUS_MAX_WAVEFORM)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid chorus waveform"); props->Chorus.Waveform = val; break; case AL_CHORUS_PHASE: if(!(val >= AL_CHORUS_MIN_PHASE && val <= AL_CHORUS_MAX_PHASE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus phase out of range"); props->Chorus.Phase = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } void ALchorus_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALchorus_setParami(effect, context, param, vals[0]); -} +{ ALchorus_setParami(effect, context, param, vals[0]); } void ALchorus_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -327,36 +340,34 @@ void ALchorus_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf { case AL_CHORUS_RATE: if(!(val >= AL_CHORUS_MIN_RATE && val <= AL_CHORUS_MAX_RATE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus rate out of range"); props->Chorus.Rate = val; break; case AL_CHORUS_DEPTH: if(!(val >= AL_CHORUS_MIN_DEPTH && val <= AL_CHORUS_MAX_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus depth out of range"); props->Chorus.Depth = val; break; case AL_CHORUS_FEEDBACK: if(!(val >= AL_CHORUS_MIN_FEEDBACK && val <= AL_CHORUS_MAX_FEEDBACK)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus feedback out of range"); props->Chorus.Feedback = val; break; case AL_CHORUS_DELAY: if(!(val >= AL_CHORUS_MIN_DELAY && val <= AL_CHORUS_MAX_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus delay out of range"); props->Chorus.Delay = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } void ALchorus_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALchorus_setParamf(effect, context, param, vals[0]); -} +{ ALchorus_setParamf(effect, context, param, vals[0]); } void ALchorus_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -372,13 +383,11 @@ void ALchorus_getParami(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } void ALchorus_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALchorus_getParami(effect, context, param, vals); -} +{ ALchorus_getParami(effect, context, param, vals); } void ALchorus_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -401,12 +410,146 @@ void ALchorus_getParamf(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } void ALchorus_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALchorus_getParamf(effect, context, param, vals); -} +{ ALchorus_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALchorus); + + +/* Flanger is basically a chorus with a really short delay. They can both use + * the same processing functions, so piggyback flanger on the chorus functions. + */ +typedef struct FlangerStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} FlangerStateFactory; + +ALeffectState *FlangerStateFactory_create(FlangerStateFactory *UNUSED(factory)) +{ + ALchorusState *state; + + NEW_OBJ0(state, ALchorusState)(); + if(!state) return NULL; + + return STATIC_CAST(ALeffectState, state); +} + +DEFINE_EFFECTSTATEFACTORY_VTABLE(FlangerStateFactory); + +EffectStateFactory *FlangerStateFactory_getFactory(void) +{ + static FlangerStateFactory FlangerFactory = { { GET_VTABLE2(FlangerStateFactory, EffectStateFactory) } }; + + return STATIC_CAST(EffectStateFactory, &FlangerFactory); +} + + +void ALflanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ + ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_WAVEFORM: + if(!(val >= AL_FLANGER_MIN_WAVEFORM && val <= AL_FLANGER_MAX_WAVEFORM)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid flanger waveform"); + props->Chorus.Waveform = val; + break; + + case AL_FLANGER_PHASE: + if(!(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger phase out of range"); + props->Chorus.Phase = val; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); + } +} +void ALflanger_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ ALflanger_setParami(effect, context, param, vals[0]); } +void ALflanger_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ + ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_RATE: + if(!(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger rate out of range"); + props->Chorus.Rate = val; + break; + + case AL_FLANGER_DEPTH: + if(!(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger depth out of range"); + props->Chorus.Depth = val; + break; + + case AL_FLANGER_FEEDBACK: + if(!(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger feedback out of range"); + props->Chorus.Feedback = val; + break; + + case AL_FLANGER_DELAY: + if(!(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger delay out of range"); + props->Chorus.Delay = val; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); + } +} +void ALflanger_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALflanger_setParamf(effect, context, param, vals[0]); } + +void ALflanger_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ + const ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_WAVEFORM: + *val = props->Chorus.Waveform; + break; + + case AL_FLANGER_PHASE: + *val = props->Chorus.Phase; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); + } +} +void ALflanger_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ ALflanger_getParami(effect, context, param, vals); } +void ALflanger_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ + const ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_RATE: + *val = props->Chorus.Rate; + break; + + case AL_FLANGER_DEPTH: + *val = props->Chorus.Depth; + break; + + case AL_FLANGER_FEEDBACK: + *val = props->Chorus.Feedback; + break; + + case AL_FLANGER_DELAY: + *val = props->Chorus.Delay; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); + } +} +void ALflanger_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALflanger_getParamf(effect, context, param, vals); } + +DEFINE_ALEFFECT_VTABLE(ALflanger); diff --git a/Engine/lib/openal-soft/Alc/effects/compressor.c b/Engine/lib/openal-soft/Alc/effects/compressor.c index ab0a42167..4ec28f9aa 100644 --- a/Engine/lib/openal-soft/Alc/effects/compressor.c +++ b/Engine/lib/openal-soft/Alc/effects/compressor.c @@ -42,8 +42,8 @@ typedef struct ALcompressorState { static ALvoid ALcompressorState_Destruct(ALcompressorState *state); static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdevice *device); -static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props); -static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALcompressorState_process(ALcompressorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALcompressorState) DEFINE_ALEFFECTSTATE_VTABLE(ALcompressorState); @@ -76,8 +76,9 @@ static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdev return AL_TRUE; } -static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props) +static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALuint i; state->Enabled = props->Compressor.OnOff; @@ -85,19 +86,19 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels; for(i = 0;i < 4;i++) - ComputeFirstOrderGains(device->FOAOut, IdentityMatrixf.m[i], + ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i], slot->Params.Gain, state->Gain[i]); } -static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALcompressorState_process(ALcompressorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - ALuint i, j, k; - ALuint base; + ALsizei i, j, k; + ALsizei base; for(base = 0;base < SamplesToDo;) { ALfloat temps[64][4]; - ALuint td = minu(64, SamplesToDo-base); + ALsizei td = mini(64, SamplesToDo-base); /* Load samples into the temp buffer first. */ for(j = 0;j < 4;j++) @@ -178,11 +179,11 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples } -typedef struct ALcompressorStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALcompressorStateFactory; +typedef struct CompressorStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} CompressorStateFactory; -static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory *UNUSED(factory)) +static ALeffectState *CompressorStateFactory_create(CompressorStateFactory *UNUSED(factory)) { ALcompressorState *state; @@ -192,13 +193,13 @@ static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory * return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALcompressorStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(CompressorStateFactory); -ALeffectStateFactory *ALcompressorStateFactory_getFactory(void) +EffectStateFactory *CompressorStateFactory_getFactory(void) { - static ALcompressorStateFactory CompressorFactory = { { GET_VTABLE2(ALcompressorStateFactory, ALeffectStateFactory) } }; + static CompressorStateFactory CompressorFactory = { { GET_VTABLE2(CompressorStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &CompressorFactory); + return STATIC_CAST(EffectStateFactory, &CompressorFactory); } @@ -209,24 +210,21 @@ void ALcompressor_setParami(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_COMPRESSOR_ONOFF: if(!(val >= AL_COMPRESSOR_MIN_ONOFF && val <= AL_COMPRESSOR_MAX_ONOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Compressor state out of range"); props->Compressor.OnOff = val; break; - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid compressor integer property 0x%04x", + param); } } void ALcompressor_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALcompressor_setParami(effect, context, param, vals[0]); -} -void ALcompressor_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALfloat UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALcompressor_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALcompressor_setParamf(effect, context, param, vals[0]); -} +{ ALcompressor_setParami(effect, context, param, vals[0]); } +void ALcompressor_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } +void ALcompressor_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } void ALcompressor_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -236,19 +234,17 @@ void ALcompressor_getParami(const ALeffect *effect, ALCcontext *context, ALenum case AL_COMPRESSOR_ONOFF: *val = props->Compressor.OnOff; break; + default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid compressor integer property 0x%04x", + param); } } void ALcompressor_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALcompressor_getParami(effect, context, param, vals); -} -void ALcompressor_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALcompressor_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALcompressor_getParamf(effect, context, param, vals); -} +{ ALcompressor_getParami(effect, context, param, vals); } +void ALcompressor_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } +void ALcompressor_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(ALcompressor); diff --git a/Engine/lib/openal-soft/Alc/effects/dedicated.c b/Engine/lib/openal-soft/Alc/effects/dedicated.c index 818cbb6bb..62a3894fe 100644 --- a/Engine/lib/openal-soft/Alc/effects/dedicated.c +++ b/Engine/lib/openal-soft/Alc/effects/dedicated.c @@ -23,22 +23,23 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" typedef struct ALdedicatedState { DERIVE_FROM_TYPE(ALeffectState); - ALfloat gains[MAX_OUTPUT_CHANNELS]; + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; } ALdedicatedState; static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state); static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *state, ALCdevice *device); -static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALdedicatedState) DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState); @@ -46,13 +47,8 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState); static void ALdedicatedState_Construct(ALdedicatedState *state) { - ALsizei s; - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALdedicatedState, ALeffectState, state); - - for(s = 0;s < MAX_OUTPUT_CHANNELS;s++) - state->gains[s] = 0.0f; } static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state) @@ -60,74 +56,69 @@ static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *state, ALCdevice *UNUSED(device)) { + ALsizei i; + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + state->CurrentGains[i] = 0.0f; return AL_TRUE; } -static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALfloat Gain; - ALuint i; + ALsizei i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - state->gains[i] = 0.0f; + state->TargetGains[i] = 0.0f; - Gain = Slot->Params.Gain * props->Dedicated.Gain; - if(Slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) + Gain = slot->Params.Gain * props->Dedicated.Gain; + if(slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) { int idx; - if((idx=GetChannelIdxByName(device->RealOut, LFE)) != -1) + if((idx=GetChannelIdxByName(&device->RealOut, LFE)) != -1) { STATIC_CAST(ALeffectState,state)->OutBuffer = device->RealOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->RealOut.NumChannels; - state->gains[idx] = Gain; + state->TargetGains[idx] = Gain; } } - else if(Slot->Params.EffectType == AL_EFFECT_DEDICATED_DIALOGUE) + else if(slot->Params.EffectType == AL_EFFECT_DEDICATED_DIALOGUE) { int idx; /* Dialog goes to the front-center speaker if it exists, otherwise it * plays from the front-center location. */ - if((idx=GetChannelIdxByName(device->RealOut, FrontCenter)) != -1) + if((idx=GetChannelIdxByName(&device->RealOut, FrontCenter)) != -1) { STATIC_CAST(ALeffectState,state)->OutBuffer = device->RealOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->RealOut.NumChannels; - state->gains[idx] = Gain; + state->TargetGains[idx] = Gain; } else { ALfloat coeffs[MAX_AMBI_COEFFS]; - CalcXYZCoeffs(0.0f, 0.0f, -1.0f, 0.0f, coeffs); + CalcAngleCoeffs(0.0f, 0.0f, 0.0f, coeffs); STATIC_CAST(ALeffectState,state)->OutBuffer = device->Dry.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->Dry.NumChannels; - ComputePanningGains(device->Dry, coeffs, Gain, state->gains); + ComputeDryPanGains(&device->Dry, coeffs, Gain, state->TargetGains); } } } -static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - const ALfloat *gains = state->gains; - ALuint i, c; - - for(c = 0;c < NumChannels;c++) - { - if(!(fabsf(gains[c]) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(i = 0;i < SamplesToDo;i++) - SamplesOut[c][i] += SamplesIn[0][i] * gains[c]; - } + MixSamples(SamplesIn[0], NumChannels, SamplesOut, state->CurrentGains, + state->TargetGains, SamplesToDo, 0, SamplesToDo); } -typedef struct ALdedicatedStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALdedicatedStateFactory; +typedef struct DedicatedStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} DedicatedStateFactory; -ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(factory)) +ALeffectState *DedicatedStateFactory_create(DedicatedStateFactory *UNUSED(factory)) { ALdedicatedState *state; @@ -137,23 +128,21 @@ ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(fa return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALdedicatedStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(DedicatedStateFactory); -ALeffectStateFactory *ALdedicatedStateFactory_getFactory(void) +EffectStateFactory *DedicatedStateFactory_getFactory(void) { - static ALdedicatedStateFactory DedicatedFactory = { { GET_VTABLE2(ALdedicatedStateFactory, ALeffectStateFactory) } }; + static DedicatedStateFactory DedicatedFactory = { { GET_VTABLE2(DedicatedStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &DedicatedFactory); + return STATIC_CAST(EffectStateFactory, &DedicatedFactory); } -void ALdedicated_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdedicated_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALdedicated_setParami(effect, context, param, vals[0]); -} +void ALdedicated_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } +void ALdedicated_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } void ALdedicated_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -161,25 +150,21 @@ void ALdedicated_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_DEDICATED_GAIN: if(!(val >= 0.0f && isfinite(val))) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Dedicated gain out of range"); props->Dedicated.Gain = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } void ALdedicated_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALdedicated_setParamf(effect, context, param, vals[0]); -} +{ ALdedicated_setParamf(effect, context, param, vals[0]); } -void ALdedicated_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdedicated_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALdedicated_getParami(effect, context, param, vals); -} +void ALdedicated_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } +void ALdedicated_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } void ALdedicated_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -190,12 +175,10 @@ void ALdedicated_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } void ALdedicated_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALdedicated_getParamf(effect, context, param, vals); -} +{ ALdedicated_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALdedicated); diff --git a/Engine/lib/openal-soft/Alc/effects/distortion.c b/Engine/lib/openal-soft/Alc/effects/distortion.c index bc1e7d84f..f4e9969c0 100644 --- a/Engine/lib/openal-soft/Alc/effects/distortion.c +++ b/Engine/lib/openal-soft/Alc/effects/distortion.c @@ -24,10 +24,10 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" typedef struct ALdistortionState { @@ -37,16 +37,18 @@ typedef struct ALdistortionState { ALfloat Gain[MAX_OUTPUT_CHANNELS]; /* Effect parameters */ - ALfilterState lowpass; - ALfilterState bandpass; + BiquadFilter lowpass; + BiquadFilter bandpass; ALfloat attenuation; ALfloat edge_coeff; + + ALfloat Buffer[2][BUFFERSIZE]; } ALdistortionState; static ALvoid ALdistortionState_Destruct(ALdistortionState *state); static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *state, ALCdevice *device); -static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALdistortionState) DEFINE_ALEFFECTSTATE_VTABLE(ALdistortionState); @@ -56,9 +58,6 @@ static void ALdistortionState_Construct(ALdistortionState *state) { ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALdistortionState, ALeffectState, state); - - ALfilterState_clear(&state->lowpass); - ALfilterState_clear(&state->bandpass); } static ALvoid ALdistortionState_Destruct(ALdistortionState *state) @@ -66,125 +65,121 @@ static ALvoid ALdistortionState_Destruct(ALdistortionState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *state, ALCdevice *UNUSED(device)) { + BiquadFilter_clear(&state->lowpass); + BiquadFilter_clear(&state->bandpass); return AL_TRUE; } -static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { - ALfloat frequency = (ALfloat)Device->Frequency; + const ALCdevice *device = context->Device; + ALfloat frequency = (ALfloat)device->Frequency; + ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat bandwidth; ALfloat cutoff; ALfloat edge; - /* Store distorted signal attenuation settings */ - state->attenuation = props->Distortion.Gain; - - /* Store waveshaper edge settings */ + /* Store waveshaper edge settings. */ edge = sinf(props->Distortion.Edge * (F_PI_2)); edge = minf(edge, 0.99f); state->edge_coeff = 2.0f * edge / (1.0f-edge); - /* Lowpass filter */ cutoff = props->Distortion.LowpassCutoff; - /* Bandwidth value is constant in octaves */ + /* Bandwidth value is constant in octaves. */ bandwidth = (cutoff / 2.0f) / (cutoff * 0.67f); - ALfilterState_setParams(&state->lowpass, ALfilterType_LowPass, 1.0f, + /* Multiply sampling frequency by the amount of oversampling done during + * processing. + */ + BiquadFilter_setParams(&state->lowpass, BiquadType_LowPass, 1.0f, cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); - /* Bandpass filter */ cutoff = props->Distortion.EQCenter; - /* Convert bandwidth in Hz to octaves */ + /* Convert bandwidth in Hz to octaves. */ bandwidth = props->Distortion.EQBandwidth / (cutoff * 0.67f); - ALfilterState_setParams(&state->bandpass, ALfilterType_BandPass, 1.0f, + BiquadFilter_setParams(&state->bandpass, BiquadType_BandPass, 1.0f, cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); - ComputeAmbientGains(Device->Dry, Slot->Params.Gain, state->Gain); + CalcAngleCoeffs(0.0f, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain * props->Distortion.Gain, + state->Gain); } -static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { + ALfloat (*restrict buffer)[BUFFERSIZE] = state->Buffer; const ALfloat fc = state->edge_coeff; - ALuint base; - ALuint it; - ALuint ot; - ALuint kt; + ALsizei base; + ALsizei i, k; for(base = 0;base < SamplesToDo;) { - float buffer[2][64 * 4]; - ALuint td = minu(64, SamplesToDo-base); + /* Perform 4x oversampling to avoid aliasing. Oversampling greatly + * improves distortion quality and allows to implement lowpass and + * bandpass filters using high frequencies, at which classic IIR + * filters became unstable. + */ + ALsizei todo = mini(BUFFERSIZE, (SamplesToDo-base) * 4); - /* Perform 4x oversampling to avoid aliasing. */ - /* Oversampling greatly improves distortion */ - /* quality and allows to implement lowpass and */ - /* bandpass filters using high frequencies, at */ - /* which classic IIR filters became unstable. */ + /* Fill oversample buffer using zero stuffing. Multiply the sample by + * the amount of oversampling to maintain the signal's power. + */ + for(i = 0;i < todo;i++) + buffer[0][i] = !(i&3) ? SamplesIn[0][(i>>2)+base] * 4.0f : 0.0f; - /* Fill oversample buffer using zero stuffing */ - for(it = 0;it < td;it++) + /* First step, do lowpass filtering of original signal. Additionally + * perform buffer interpolation and lowpass cutoff for oversampling + * (which is fortunately first step of distortion). So combine three + * operations into the one. + */ + BiquadFilter_process(&state->lowpass, buffer[1], buffer[0], todo); + + /* Second step, do distortion using waveshaper function to emulate + * signal processing during tube overdriving. Three steps of + * waveshaping are intended to modify waveform without boost/clipping/ + * attenuation process. + */ + for(i = 0;i < todo;i++) { - buffer[0][it*4 + 0] = SamplesIn[0][it+base]; - buffer[0][it*4 + 1] = 0.0f; - buffer[0][it*4 + 2] = 0.0f; - buffer[0][it*4 + 3] = 0.0f; + ALfloat smp = buffer[1][i]; + + smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); + smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)) * -1.0f; + smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); + + buffer[0][i] = smp; } - /* First step, do lowpass filtering of original signal, */ - /* additionally perform buffer interpolation and lowpass */ - /* cutoff for oversampling (which is fortunately first */ - /* step of distortion). So combine three operations into */ - /* the one. */ - ALfilterState_process(&state->lowpass, buffer[1], buffer[0], td*4); + /* Third step, do bandpass filtering of distorted signal. */ + BiquadFilter_process(&state->bandpass, buffer[1], buffer[0], todo); - /* Second step, do distortion using waveshaper function */ - /* to emulate signal processing during tube overdriving. */ - /* Three steps of waveshaping are intended to modify */ - /* waveform without boost/clipping/attenuation process. */ - for(it = 0;it < td;it++) - { - for(ot = 0;ot < 4;ot++) - { - /* Restore signal power by multiplying sample by amount of oversampling */ - ALfloat smp = buffer[1][it*4 + ot] * 4.0f; - - smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); - smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)) * -1.0f; - smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); - - buffer[1][it*4 + ot] = smp; - } - } - - /* Third step, do bandpass filtering of distorted signal */ - ALfilterState_process(&state->bandpass, buffer[0], buffer[1], td*4); - - for(kt = 0;kt < NumChannels;kt++) + todo >>= 2; + for(k = 0;k < NumChannels;k++) { /* Fourth step, final, do attenuation and perform decimation, - * store only one sample out of 4. + * storing only one sample out of four. */ - ALfloat gain = state->Gain[kt] * state->attenuation; + ALfloat gain = state->Gain[k]; if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; - for(it = 0;it < td;it++) - SamplesOut[kt][base+it] += gain * buffer[0][it*4]; + for(i = 0;i < todo;i++) + SamplesOut[k][base+i] += gain * buffer[1][i*4]; } - base += td; + base += todo; } } -typedef struct ALdistortionStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALdistortionStateFactory; +typedef struct DistortionStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} DistortionStateFactory; -static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory *UNUSED(factory)) +static ALeffectState *DistortionStateFactory_create(DistortionStateFactory *UNUSED(factory)) { ALdistortionState *state; @@ -194,23 +189,21 @@ static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory * return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALdistortionStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(DistortionStateFactory); -ALeffectStateFactory *ALdistortionStateFactory_getFactory(void) +EffectStateFactory *DistortionStateFactory_getFactory(void) { - static ALdistortionStateFactory DistortionFactory = { { GET_VTABLE2(ALdistortionStateFactory, ALeffectStateFactory) } }; + static DistortionStateFactory DistortionFactory = { { GET_VTABLE2(DistortionStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &DistortionFactory); + return STATIC_CAST(EffectStateFactory, &DistortionFactory); } -void ALdistortion_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdistortion_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALdistortion_setParami(effect, context, param, vals[0]); -} +void ALdistortion_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } +void ALdistortion_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } void ALdistortion_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -218,49 +211,46 @@ void ALdistortion_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_DISTORTION_EDGE: if(!(val >= AL_DISTORTION_MIN_EDGE && val <= AL_DISTORTION_MAX_EDGE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion edge out of range"); props->Distortion.Edge = val; break; case AL_DISTORTION_GAIN: if(!(val >= AL_DISTORTION_MIN_GAIN && val <= AL_DISTORTION_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion gain out of range"); props->Distortion.Gain = val; break; case AL_DISTORTION_LOWPASS_CUTOFF: if(!(val >= AL_DISTORTION_MIN_LOWPASS_CUTOFF && val <= AL_DISTORTION_MAX_LOWPASS_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion low-pass cutoff out of range"); props->Distortion.LowpassCutoff = val; break; case AL_DISTORTION_EQCENTER: if(!(val >= AL_DISTORTION_MIN_EQCENTER && val <= AL_DISTORTION_MAX_EQCENTER)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion EQ center out of range"); props->Distortion.EQCenter = val; break; case AL_DISTORTION_EQBANDWIDTH: if(!(val >= AL_DISTORTION_MIN_EQBANDWIDTH && val <= AL_DISTORTION_MAX_EQBANDWIDTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion EQ bandwidth out of range"); props->Distortion.EQBandwidth = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", + param); } } void ALdistortion_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALdistortion_setParamf(effect, context, param, vals[0]); -} +{ ALdistortion_setParamf(effect, context, param, vals[0]); } -void ALdistortion_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdistortion_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALdistortion_getParami(effect, context, param, vals); -} +void ALdistortion_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } +void ALdistortion_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } void ALdistortion_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -287,12 +277,11 @@ void ALdistortion_getParamf(const ALeffect *effect, ALCcontext *context, ALenum break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", + param); } } void ALdistortion_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALdistortion_getParamf(effect, context, param, vals); -} +{ ALdistortion_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALdistortion); diff --git a/Engine/lib/openal-soft/Alc/effects/echo.c b/Engine/lib/openal-soft/Alc/effects/echo.c index 3ad1e9752..676b17e8e 100644 --- a/Engine/lib/openal-soft/Alc/effects/echo.c +++ b/Engine/lib/openal-soft/Alc/effects/echo.c @@ -28,32 +28,37 @@ #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" typedef struct ALechoState { DERIVE_FROM_TYPE(ALeffectState); ALfloat *SampleBuffer; - ALuint BufferLength; + ALsizei BufferLength; // The echo is two tap. The delay is the number of samples from before the // current offset struct { - ALuint delay; + ALsizei delay; } Tap[2]; - ALuint Offset; + ALsizei Offset; + /* The panning gains for the two taps */ - ALfloat Gain[2][MAX_OUTPUT_CHANNELS]; + struct { + ALfloat Current[MAX_OUTPUT_CHANNELS]; + ALfloat Target[MAX_OUTPUT_CHANNELS]; + } Gains[2]; ALfloat FeedGain; - ALfilterState Filter; + BiquadFilter Filter; } ALechoState; static ALvoid ALechoState_Destruct(ALechoState *state); static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device); -static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALechoState_update(ALechoState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALechoState_process(ALechoState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALechoState) DEFINE_ALEFFECTSTATE_VTABLE(ALechoState); @@ -71,7 +76,7 @@ static void ALechoState_Construct(ALechoState *state) state->Tap[1].delay = 0; state->Offset = 0; - ALfilterState_clear(&state->Filter); + BiquadFilter_clear(&state->Filter); } static ALvoid ALechoState_Destruct(ALechoState *state) @@ -83,13 +88,14 @@ static ALvoid ALechoState_Destruct(ALechoState *state) static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device) { - ALuint maxlen, i; + ALsizei maxlen; // Use the next power of 2 for the buffer length, so the tap offsets can be // wrapped using a mask instead of a modulo - maxlen = fastf2u(AL_ECHO_MAX_DELAY * Device->Frequency) + 1; - maxlen += fastf2u(AL_ECHO_MAX_LRDELAY * Device->Frequency) + 1; - maxlen = NextPowerOf2(maxlen); + maxlen = float2int(AL_ECHO_MAX_DELAY*Device->Frequency + 0.5f) + + float2int(AL_ECHO_MAX_LRDELAY*Device->Frequency + 0.5f); + maxlen = NextPowerOf2(maxlen); + if(maxlen <= 0) return AL_FALSE; if(maxlen != state->BufferLength) { @@ -100,20 +106,22 @@ static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device) state->SampleBuffer = temp; state->BufferLength = maxlen; } - for(i = 0;i < state->BufferLength;i++) - state->SampleBuffer[i] = 0.0f; + + memset(state->SampleBuffer, 0, state->BufferLength*sizeof(ALfloat)); + memset(state->Gains, 0, sizeof(state->Gains)); return AL_TRUE; } -static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALechoState_update(ALechoState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { - ALuint frequency = Device->Frequency; + const ALCdevice *device = context->Device; + ALuint frequency = device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat gain, lrpan, spread; + ALfloat gainhf, lrpan, spread; - state->Tap[0].delay = fastf2u(props->Echo.Delay * frequency) + 1; - state->Tap[1].delay = fastf2u(props->Echo.LRDelay * frequency); + state->Tap[0].delay = maxi(float2int(props->Echo.Delay*frequency + 0.5f), 1); + state->Tap[1].delay = float2int(props->Echo.LRDelay*frequency + 0.5f); state->Tap[1].delay += state->Tap[0].delay; spread = props->Echo.Spread; @@ -126,94 +134,78 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co state->FeedGain = props->Echo.Feedback; - gain = minf(1.0f - props->Echo.Damping, 0.01f); - ALfilterState_setParams(&state->Filter, ALfilterType_HighShelf, - gain, LOWPASSFREQREF/frequency, - calc_rcpQ_from_slope(gain, 0.75f)); - - gain = Slot->Params.Gain; + gainhf = maxf(1.0f - props->Echo.Damping, 0.0625f); /* Limit -24dB */ + BiquadFilter_setParams(&state->Filter, BiquadType_HighShelf, + gainhf, LOWPASSFREQREF/frequency, calc_rcpQ_from_slope(gainhf, 1.0f) + ); /* First tap panning */ - CalcXYZCoeffs(-lrpan, 0.0f, 0.0f, spread, coeffs); - ComputePanningGains(Device->Dry, coeffs, gain, state->Gain[0]); + CalcAngleCoeffs(-F_PI_2*lrpan, 0.0f, spread, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->Gains[0].Target); /* Second tap panning */ - CalcXYZCoeffs( lrpan, 0.0f, 0.0f, spread, coeffs); - ComputePanningGains(Device->Dry, coeffs, gain, state->Gain[1]); + CalcAngleCoeffs( F_PI_2*lrpan, 0.0f, spread, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->Gains[1].Target); } -static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALechoState_process(ALechoState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - const ALuint mask = state->BufferLength-1; - const ALuint tap1 = state->Tap[0].delay; - const ALuint tap2 = state->Tap[1].delay; - ALuint offset = state->Offset; - ALfloat x[2], y[2], in, out; - ALuint base; - ALuint i, k; + const ALsizei mask = state->BufferLength-1; + const ALsizei tap1 = state->Tap[0].delay; + const ALsizei tap2 = state->Tap[1].delay; + ALfloat *restrict delaybuf = state->SampleBuffer; + ALsizei offset = state->Offset; + ALfloat z1, z2, in, out; + ALsizei base; + ALsizei c, i; - x[0] = state->Filter.x[0]; - x[1] = state->Filter.x[1]; - y[0] = state->Filter.y[0]; - y[1] = state->Filter.y[1]; + z1 = state->Filter.z1; + z2 = state->Filter.z2; for(base = 0;base < SamplesToDo;) { - ALfloat temps[128][2]; - ALuint td = minu(128, SamplesToDo-base); + alignas(16) ALfloat temps[2][128]; + ALsizei td = mini(128, SamplesToDo-base); for(i = 0;i < td;i++) { + /* Feed the delay buffer's input first. */ + delaybuf[offset&mask] = SamplesIn[0][i+base]; + /* First tap */ - temps[i][0] = state->SampleBuffer[(offset-tap1) & mask]; + temps[0][i] = delaybuf[(offset-tap1) & mask]; /* Second tap */ - temps[i][1] = state->SampleBuffer[(offset-tap2) & mask]; + temps[1][i] = delaybuf[(offset-tap2) & mask]; - // Apply damping and feedback gain to the second tap, and mix in the - // new sample - in = temps[i][1] + SamplesIn[0][i+base]; - out = in*state->Filter.b0 + - x[0]*state->Filter.b1 + x[1]*state->Filter.b2 - - y[0]*state->Filter.a1 - y[1]*state->Filter.a2; - x[1] = x[0]; x[0] = in; - y[1] = y[0]; y[0] = out; + /* Apply damping to the second tap, then add it to the buffer with + * feedback attenuation. + */ + in = temps[1][i]; + out = in*state->Filter.b0 + z1; + z1 = in*state->Filter.b1 - out*state->Filter.a1 + z2; + z2 = in*state->Filter.b2 - out*state->Filter.a2; - state->SampleBuffer[offset&mask] = out * state->FeedGain; + delaybuf[offset&mask] += out * state->FeedGain; offset++; } - for(k = 0;k < NumChannels;k++) - { - ALfloat gain = state->Gain[0][k]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(i = 0;i < td;i++) - SamplesOut[k][i+base] += temps[i][0] * gain; - } - - gain = state->Gain[1][k]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(i = 0;i < td;i++) - SamplesOut[k][i+base] += temps[i][1] * gain; - } - } + for(c = 0;c < 2;c++) + MixSamples(temps[c], NumChannels, SamplesOut, state->Gains[c].Current, + state->Gains[c].Target, SamplesToDo-base, base, td); base += td; } - state->Filter.x[0] = x[0]; - state->Filter.x[1] = x[1]; - state->Filter.y[0] = y[0]; - state->Filter.y[1] = y[1]; + state->Filter.z1 = z1; + state->Filter.z2 = z2; state->Offset = offset; } -typedef struct ALechoStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALechoStateFactory; +typedef struct EchoStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} EchoStateFactory; -ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory)) +ALeffectState *EchoStateFactory_create(EchoStateFactory *UNUSED(factory)) { ALechoState *state; @@ -223,22 +215,20 @@ ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory)) return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALechoStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(EchoStateFactory); -ALeffectStateFactory *ALechoStateFactory_getFactory(void) +EffectStateFactory *EchoStateFactory_getFactory(void) { - static ALechoStateFactory EchoFactory = { { GET_VTABLE2(ALechoStateFactory, ALeffectStateFactory) } }; + static EchoStateFactory EchoFactory = { { GET_VTABLE2(EchoStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &EchoFactory); + return STATIC_CAST(EffectStateFactory, &EchoFactory); } -void ALecho_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALecho_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALecho_setParami(effect, context, param, vals[0]); -} +void ALecho_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } +void ALecho_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } void ALecho_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -246,49 +236,45 @@ void ALecho_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALflo { case AL_ECHO_DELAY: if(!(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo delay out of range"); props->Echo.Delay = val; break; case AL_ECHO_LRDELAY: if(!(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo LR delay out of range"); props->Echo.LRDelay = val; break; case AL_ECHO_DAMPING: if(!(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo damping out of range"); props->Echo.Damping = val; break; case AL_ECHO_FEEDBACK: if(!(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo feedback out of range"); props->Echo.Feedback = val; break; case AL_ECHO_SPREAD: if(!(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo spread out of range"); props->Echo.Spread = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } void ALecho_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALecho_setParamf(effect, context, param, vals[0]); -} +{ ALecho_setParamf(effect, context, param, vals[0]); } -void ALecho_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALecho_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALecho_getParami(effect, context, param, vals); -} +void ALecho_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } +void ALecho_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } void ALecho_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -315,12 +301,10 @@ void ALecho_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } void ALecho_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALecho_getParamf(effect, context, param, vals); -} +{ ALecho_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALecho); diff --git a/Engine/lib/openal-soft/Alc/effects/equalizer.c b/Engine/lib/openal-soft/Alc/effects/equalizer.c index 1a63b4181..8ff56fb5d 100644 --- a/Engine/lib/openal-soft/Alc/effects/equalizer.c +++ b/Engine/lib/openal-soft/Alc/effects/equalizer.c @@ -24,10 +24,10 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" /* The document "Effects Extension Guide.pdf" says that low and high * @@ -72,25 +72,25 @@ * http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt */ -/* The maximum number of sample frames per update. */ -#define MAX_UPDATE_SAMPLES 256 - typedef struct ALequalizerState { DERIVE_FROM_TYPE(ALeffectState); - /* Effect gains for each channel */ - ALfloat Gain[MAX_EFFECT_CHANNELS][MAX_OUTPUT_CHANNELS]; + struct { + /* Effect gains for each channel */ + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; - /* Effect parameters */ - ALfilterState filter[4][MAX_EFFECT_CHANNELS]; + /* Effect parameters */ + BiquadFilter filter[4]; + } Chans[MAX_EFFECT_CHANNELS]; - ALfloat SampleBuffer[4][MAX_EFFECT_CHANNELS][MAX_UPDATE_SAMPLES]; + ALfloat SampleBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE]; } ALequalizerState; static ALvoid ALequalizerState_Destruct(ALequalizerState *state); static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *state, ALCdevice *device); -static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props); -static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALequalizerState) DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState); @@ -98,18 +98,8 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState); static void ALequalizerState_Construct(ALequalizerState *state) { - int it, ft; - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALequalizerState, ALeffectState, state); - - /* Initialize sample history only on filter creation to avoid */ - /* sound clicks if filter settings were changed in runtime. */ - for(it = 0; it < 4; it++) - { - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_clear(&state->filter[it][ft]); - } } static ALvoid ALequalizerState_Destruct(ALequalizerState *state) @@ -117,131 +107,100 @@ static ALvoid ALequalizerState_Destruct(ALequalizerState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *state, ALCdevice *UNUSED(device)) { + ALsizei i, j; + + for(i = 0; i < MAX_EFFECT_CHANNELS;i++) + { + for(j = 0;j < 4;j++) + BiquadFilter_clear(&state->Chans[i].filter[j]); + for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) + state->Chans[i].CurrentGains[j] = 0.0f; + } return AL_TRUE; } -static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props) +static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALfloat frequency = (ALfloat)device->Frequency; - ALfloat gain, freq_mult; + ALfloat gain, f0norm; ALuint i; STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels; for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(device->FOAOut, IdentityMatrixf.m[i], - slot->Params.Gain, state->Gain[i]); + ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i], + slot->Params.Gain, state->Chans[i].TargetGains); /* Calculate coefficients for the each type of filter. Note that the shelf * filters' gain is for the reference frequency, which is the centerpoint * of the transition band. */ - gain = sqrtf(props->Equalizer.LowGain); - freq_mult = props->Equalizer.LowCutoff/frequency; - ALfilterState_setParams(&state->filter[0][0], ALfilterType_LowShelf, - gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f) + gain = maxf(sqrtf(props->Equalizer.LowGain), 0.0625f); /* Limit -24dB */ + f0norm = props->Equalizer.LowCutoff/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[0], BiquadType_LowShelf, + gain, f0norm, calc_rcpQ_from_slope(gain, 0.75f) ); + + gain = maxf(props->Equalizer.Mid1Gain, 0.0625f); + f0norm = props->Equalizer.Mid1Center/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[1], BiquadType_Peaking, + gain, f0norm, calc_rcpQ_from_bandwidth( + f0norm, props->Equalizer.Mid1Width + ) + ); + + gain = maxf(props->Equalizer.Mid2Gain, 0.0625f); + f0norm = props->Equalizer.Mid2Center/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[2], BiquadType_Peaking, + gain, f0norm, calc_rcpQ_from_bandwidth( + f0norm, props->Equalizer.Mid2Width + ) + ); + + gain = maxf(sqrtf(props->Equalizer.HighGain), 0.0625f); + f0norm = props->Equalizer.HighCutoff/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[3], BiquadType_HighShelf, + gain, f0norm, calc_rcpQ_from_slope(gain, 0.75f) + ); + /* Copy the filter coefficients for the other input channels. */ for(i = 1;i < MAX_EFFECT_CHANNELS;i++) { - state->filter[0][i].a1 = state->filter[0][0].a1; - state->filter[0][i].a2 = state->filter[0][0].a2; - state->filter[0][i].b0 = state->filter[0][0].b0; - state->filter[0][i].b1 = state->filter[0][0].b1; - state->filter[0][i].b2 = state->filter[0][0].b2; - } - - gain = props->Equalizer.Mid1Gain; - freq_mult = props->Equalizer.Mid1Center/frequency; - ALfilterState_setParams(&state->filter[1][0], ALfilterType_Peaking, - gain, freq_mult, calc_rcpQ_from_bandwidth( - freq_mult, props->Equalizer.Mid1Width - ) - ); - for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - state->filter[1][i].a1 = state->filter[1][0].a1; - state->filter[1][i].a2 = state->filter[1][0].a2; - state->filter[1][i].b0 = state->filter[1][0].b0; - state->filter[1][i].b1 = state->filter[1][0].b1; - state->filter[1][i].b2 = state->filter[1][0].b2; - } - - gain = props->Equalizer.Mid2Gain; - freq_mult = props->Equalizer.Mid2Center/frequency; - ALfilterState_setParams(&state->filter[2][0], ALfilterType_Peaking, - gain, freq_mult, calc_rcpQ_from_bandwidth( - freq_mult, props->Equalizer.Mid2Width - ) - ); - for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - state->filter[2][i].a1 = state->filter[2][0].a1; - state->filter[2][i].a2 = state->filter[2][0].a2; - state->filter[2][i].b0 = state->filter[2][0].b0; - state->filter[2][i].b1 = state->filter[2][0].b1; - state->filter[2][i].b2 = state->filter[2][0].b2; - } - - gain = sqrtf(props->Equalizer.HighGain); - freq_mult = props->Equalizer.HighCutoff/frequency; - ALfilterState_setParams(&state->filter[3][0], ALfilterType_HighShelf, - gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f) - ); - for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - state->filter[3][i].a1 = state->filter[3][0].a1; - state->filter[3][i].a2 = state->filter[3][0].a2; - state->filter[3][i].b0 = state->filter[3][0].b0; - state->filter[3][i].b1 = state->filter[3][0].b1; - state->filter[3][i].b2 = state->filter[3][0].b2; + BiquadFilter_copyParams(&state->Chans[i].filter[0], &state->Chans[0].filter[0]); + BiquadFilter_copyParams(&state->Chans[i].filter[1], &state->Chans[0].filter[1]); + BiquadFilter_copyParams(&state->Chans[i].filter[2], &state->Chans[0].filter[2]); + BiquadFilter_copyParams(&state->Chans[i].filter[3], &state->Chans[0].filter[3]); } } -static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - ALfloat (*Samples)[MAX_EFFECT_CHANNELS][MAX_UPDATE_SAMPLES] = state->SampleBuffer; - ALuint it, kt, ft; - ALuint base; + ALfloat (*restrict temps)[BUFFERSIZE] = state->SampleBuffer; + ALsizei c; - for(base = 0;base < SamplesToDo;) + for(c = 0;c < MAX_EFFECT_CHANNELS;c++) { - ALuint td = minu(MAX_UPDATE_SAMPLES, SamplesToDo-base); + BiquadFilter_process(&state->Chans[c].filter[0], temps[0], SamplesIn[c], SamplesToDo); + BiquadFilter_process(&state->Chans[c].filter[1], temps[1], temps[0], SamplesToDo); + BiquadFilter_process(&state->Chans[c].filter[2], temps[2], temps[1], SamplesToDo); + BiquadFilter_process(&state->Chans[c].filter[3], temps[3], temps[2], SamplesToDo); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[0][ft], Samples[0][ft], &SamplesIn[ft][base], td); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[1][ft], Samples[1][ft], Samples[0][ft], td); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[2][ft], Samples[2][ft], Samples[1][ft], td); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[3][ft], Samples[3][ft], Samples[2][ft], td); - - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - { - for(kt = 0;kt < NumChannels;kt++) - { - ALfloat gain = state->Gain[ft][kt]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(it = 0;it < td;it++) - SamplesOut[kt][base+it] += gain * Samples[3][ft][it]; - } - } - - base += td; + MixSamples(temps[3], NumChannels, SamplesOut, + state->Chans[c].CurrentGains, state->Chans[c].TargetGains, + SamplesToDo, 0, SamplesToDo + ); } } -typedef struct ALequalizerStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALequalizerStateFactory; +typedef struct EqualizerStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} EqualizerStateFactory; -ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(factory)) +ALeffectState *EqualizerStateFactory_create(EqualizerStateFactory *UNUSED(factory)) { ALequalizerState *state; @@ -251,22 +210,20 @@ ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(fa return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALequalizerStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(EqualizerStateFactory); -ALeffectStateFactory *ALequalizerStateFactory_getFactory(void) +EffectStateFactory *EqualizerStateFactory_getFactory(void) { - static ALequalizerStateFactory EqualizerFactory = { { GET_VTABLE2(ALequalizerStateFactory, ALeffectStateFactory) } }; + static EqualizerStateFactory EqualizerFactory = { { GET_VTABLE2(EqualizerStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &EqualizerFactory); + return STATIC_CAST(EffectStateFactory, &EqualizerFactory); } -void ALequalizer_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALequalizer_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALequalizer_setParami(effect, context, param, vals[0]); -} +void ALequalizer_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } +void ALequalizer_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } void ALequalizer_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -274,79 +231,75 @@ void ALequalizer_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EQUALIZER_LOW_GAIN: if(!(val >= AL_EQUALIZER_MIN_LOW_GAIN && val <= AL_EQUALIZER_MAX_LOW_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer low-band gain out of range"); props->Equalizer.LowGain = val; break; case AL_EQUALIZER_LOW_CUTOFF: if(!(val >= AL_EQUALIZER_MIN_LOW_CUTOFF && val <= AL_EQUALIZER_MAX_LOW_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer low-band cutoff out of range"); props->Equalizer.LowCutoff = val; break; case AL_EQUALIZER_MID1_GAIN: if(!(val >= AL_EQUALIZER_MIN_MID1_GAIN && val <= AL_EQUALIZER_MAX_MID1_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid1-band gain out of range"); props->Equalizer.Mid1Gain = val; break; case AL_EQUALIZER_MID1_CENTER: if(!(val >= AL_EQUALIZER_MIN_MID1_CENTER && val <= AL_EQUALIZER_MAX_MID1_CENTER)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid1-band center out of range"); props->Equalizer.Mid1Center = val; break; case AL_EQUALIZER_MID1_WIDTH: if(!(val >= AL_EQUALIZER_MIN_MID1_WIDTH && val <= AL_EQUALIZER_MAX_MID1_WIDTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid1-band width out of range"); props->Equalizer.Mid1Width = val; break; case AL_EQUALIZER_MID2_GAIN: if(!(val >= AL_EQUALIZER_MIN_MID2_GAIN && val <= AL_EQUALIZER_MAX_MID2_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid2-band gain out of range"); props->Equalizer.Mid2Gain = val; break; case AL_EQUALIZER_MID2_CENTER: if(!(val >= AL_EQUALIZER_MIN_MID2_CENTER && val <= AL_EQUALIZER_MAX_MID2_CENTER)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid2-band center out of range"); props->Equalizer.Mid2Center = val; break; case AL_EQUALIZER_MID2_WIDTH: if(!(val >= AL_EQUALIZER_MIN_MID2_WIDTH && val <= AL_EQUALIZER_MAX_MID2_WIDTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid2-band width out of range"); props->Equalizer.Mid2Width = val; break; case AL_EQUALIZER_HIGH_GAIN: if(!(val >= AL_EQUALIZER_MIN_HIGH_GAIN && val <= AL_EQUALIZER_MAX_HIGH_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer high-band gain out of range"); props->Equalizer.HighGain = val; break; case AL_EQUALIZER_HIGH_CUTOFF: if(!(val >= AL_EQUALIZER_MIN_HIGH_CUTOFF && val <= AL_EQUALIZER_MAX_HIGH_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer high-band cutoff out of range"); props->Equalizer.HighCutoff = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } void ALequalizer_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALequalizer_setParamf(effect, context, param, vals[0]); -} +{ ALequalizer_setParamf(effect, context, param, vals[0]); } -void ALequalizer_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALequalizer_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALequalizer_getParami(effect, context, param, vals); -} +void ALequalizer_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } +void ALequalizer_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } void ALequalizer_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -393,12 +346,10 @@ void ALequalizer_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } void ALequalizer_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALequalizer_getParamf(effect, context, param, vals); -} +{ ALequalizer_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALequalizer); diff --git a/Engine/lib/openal-soft/Alc/effects/flanger.c b/Engine/lib/openal-soft/Alc/effects/flanger.c deleted file mode 100644 index 1575212bc..000000000 --- a/Engine/lib/openal-soft/Alc/effects/flanger.c +++ /dev/null @@ -1,411 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 2013 by Mike Gorchak - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include - -#include "alMain.h" -#include "alFilter.h" -#include "alAuxEffectSlot.h" -#include "alError.h" -#include "alu.h" - - -enum FlangerWaveForm { - FWF_Triangle = AL_FLANGER_WAVEFORM_TRIANGLE, - FWF_Sinusoid = AL_FLANGER_WAVEFORM_SINUSOID -}; - -typedef struct ALflangerState { - DERIVE_FROM_TYPE(ALeffectState); - - ALfloat *SampleBuffer[2]; - ALuint BufferLength; - ALuint offset; - ALuint lfo_range; - ALfloat lfo_scale; - ALint lfo_disp; - - /* Gains for left and right sides */ - ALfloat Gain[2][MAX_OUTPUT_CHANNELS]; - - /* effect parameters */ - enum FlangerWaveForm waveform; - ALint delay; - ALfloat depth; - ALfloat feedback; -} ALflangerState; - -static ALvoid ALflangerState_Destruct(ALflangerState *state); -static ALboolean ALflangerState_deviceUpdate(ALflangerState *state, ALCdevice *Device); -static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); -DECLARE_DEFAULT_ALLOCATORS(ALflangerState) - -DEFINE_ALEFFECTSTATE_VTABLE(ALflangerState); - - -static void ALflangerState_Construct(ALflangerState *state) -{ - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); - SET_VTABLE2(ALflangerState, ALeffectState, state); - - state->BufferLength = 0; - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; - state->offset = 0; - state->lfo_range = 1; - state->waveform = FWF_Triangle; -} - -static ALvoid ALflangerState_Destruct(ALflangerState *state) -{ - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; - - ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); -} - -static ALboolean ALflangerState_deviceUpdate(ALflangerState *state, ALCdevice *Device) -{ - ALuint maxlen; - ALuint it; - - maxlen = fastf2u(AL_FLANGER_MAX_DELAY * 3.0f * Device->Frequency) + 1; - maxlen = NextPowerOf2(maxlen); - - if(maxlen != state->BufferLength) - { - void *temp = al_calloc(16, maxlen * sizeof(ALfloat) * 2); - if(!temp) return AL_FALSE; - - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = temp; - state->SampleBuffer[1] = state->SampleBuffer[0] + maxlen; - - state->BufferLength = maxlen; - } - - for(it = 0;it < state->BufferLength;it++) - { - state->SampleBuffer[0][it] = 0.0f; - state->SampleBuffer[1][it] = 0.0f; - } - - return AL_TRUE; -} - -static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) -{ - ALfloat frequency = (ALfloat)Device->Frequency; - ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat rate; - ALint phase; - - switch(props->Flanger.Waveform) - { - case AL_FLANGER_WAVEFORM_TRIANGLE: - state->waveform = FWF_Triangle; - break; - case AL_FLANGER_WAVEFORM_SINUSOID: - state->waveform = FWF_Sinusoid; - break; - } - state->depth = props->Flanger.Depth; - state->feedback = props->Flanger.Feedback; - state->delay = fastf2i(props->Flanger.Delay * frequency); - - /* Gains for left and right sides */ - CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[0]); - CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[1]); - - phase = props->Flanger.Phase; - rate = props->Flanger.Rate; - if(!(rate > 0.0f)) - { - state->lfo_scale = 0.0f; - state->lfo_range = 1; - state->lfo_disp = 0; - } - else - { - /* Calculate LFO coefficient */ - state->lfo_range = fastf2u(frequency/rate + 0.5f); - switch(state->waveform) - { - case FWF_Triangle: - state->lfo_scale = 4.0f / state->lfo_range; - break; - case FWF_Sinusoid: - state->lfo_scale = F_TAU / state->lfo_range; - break; - } - - /* Calculate lfo phase displacement */ - state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); - } -} - -static inline void Triangle(ALint *delay_left, ALint *delay_right, ALuint offset, const ALflangerState *state) -{ - ALfloat lfo_value; - - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; -} - -static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALuint offset, const ALflangerState *state) -{ - ALfloat lfo_value; - - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; -} - -#define DECL_TEMPLATE(Func) \ -static void Process##Func(ALflangerState *state, const ALuint SamplesToDo, \ - const ALfloat *restrict SamplesIn, ALfloat (*restrict out)[2]) \ -{ \ - const ALuint bufmask = state->BufferLength-1; \ - ALfloat *restrict leftbuf = state->SampleBuffer[0]; \ - ALfloat *restrict rightbuf = state->SampleBuffer[1]; \ - ALuint offset = state->offset; \ - const ALfloat feedback = state->feedback; \ - ALuint it; \ - \ - for(it = 0;it < SamplesToDo;it++) \ - { \ - ALint delay_left, delay_right; \ - Func(&delay_left, &delay_right, offset, state); \ - \ - out[it][0] = leftbuf[(offset-delay_left)&bufmask]; \ - leftbuf[offset&bufmask] = (out[it][0]+SamplesIn[it]) * feedback; \ - \ - out[it][1] = rightbuf[(offset-delay_right)&bufmask]; \ - rightbuf[offset&bufmask] = (out[it][1]+SamplesIn[it]) * feedback; \ - \ - offset++; \ - } \ - state->offset = offset; \ -} - -DECL_TEMPLATE(Triangle) -DECL_TEMPLATE(Sinusoid) - -#undef DECL_TEMPLATE - -static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) -{ - ALuint it, kt; - ALuint base; - - for(base = 0;base < SamplesToDo;) - { - ALfloat temps[128][2]; - ALuint td = minu(128, SamplesToDo-base); - - switch(state->waveform) - { - case FWF_Triangle: - ProcessTriangle(state, td, SamplesIn[0]+base, temps); - break; - case FWF_Sinusoid: - ProcessSinusoid(state, td, SamplesIn[0]+base, temps); - break; - } - - for(kt = 0;kt < NumChannels;kt++) - { - ALfloat gain = state->Gain[0][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][0] * gain; - } - - gain = state->Gain[1][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][1] * gain; - } - } - - base += td; - } -} - - -typedef struct ALflangerStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALflangerStateFactory; - -ALeffectState *ALflangerStateFactory_create(ALflangerStateFactory *UNUSED(factory)) -{ - ALflangerState *state; - - NEW_OBJ0(state, ALflangerState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALflangerStateFactory); - -ALeffectStateFactory *ALflangerStateFactory_getFactory(void) -{ - static ALflangerStateFactory FlangerFactory = { { GET_VTABLE2(ALflangerStateFactory, ALeffectStateFactory) } }; - - return STATIC_CAST(ALeffectStateFactory, &FlangerFactory); -} - - -void ALflanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ - ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_WAVEFORM: - if(!(val >= AL_FLANGER_MIN_WAVEFORM && val <= AL_FLANGER_MAX_WAVEFORM)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Waveform = val; - break; - - case AL_FLANGER_PHASE: - if(!(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Phase = val; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALflanger_setParami(effect, context, param, vals[0]); -} -void ALflanger_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ - ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_RATE: - if(!(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Rate = val; - break; - - case AL_FLANGER_DEPTH: - if(!(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Depth = val; - break; - - case AL_FLANGER_FEEDBACK: - if(!(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Feedback = val; - break; - - case AL_FLANGER_DELAY: - if(!(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Delay = val; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALflanger_setParamf(effect, context, param, vals[0]); -} - -void ALflanger_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ - const ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_WAVEFORM: - *val = props->Flanger.Waveform; - break; - - case AL_FLANGER_PHASE: - *val = props->Flanger.Phase; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALflanger_getParami(effect, context, param, vals); -} -void ALflanger_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ - const ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_RATE: - *val = props->Flanger.Rate; - break; - - case AL_FLANGER_DEPTH: - *val = props->Flanger.Depth; - break; - - case AL_FLANGER_FEEDBACK: - *val = props->Flanger.Feedback; - break; - - case AL_FLANGER_DELAY: - *val = props->Flanger.Delay; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALflanger_getParamf(effect, context, param, vals); -} - -DEFINE_ALEFFECT_VTABLE(ALflanger); diff --git a/Engine/lib/openal-soft/Alc/effects/modulator.c b/Engine/lib/openal-soft/Alc/effects/modulator.c index 247cdf61a..7f1a2cad0 100644 --- a/Engine/lib/openal-soft/Alc/effects/modulator.c +++ b/Engine/lib/openal-soft/Alc/effects/modulator.c @@ -24,29 +24,36 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" +#define MAX_UPDATE_SAMPLES 128 + typedef struct ALmodulatorState { DERIVE_FROM_TYPE(ALeffectState); - void (*Process)(ALfloat*, const ALfloat*, ALuint, const ALuint, ALuint); + void (*GetSamples)(ALfloat*, ALsizei, const ALsizei, ALsizei); - ALuint index; - ALuint step; + ALsizei index; + ALsizei step; - ALfloat Gain[MAX_EFFECT_CHANNELS][MAX_OUTPUT_CHANNELS]; + alignas(16) ALfloat ModSamples[MAX_UPDATE_SAMPLES]; - ALfilterState Filter[MAX_EFFECT_CHANNELS]; + struct { + BiquadFilter Filter; + + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; + } Chans[MAX_EFFECT_CHANNELS]; } ALmodulatorState; static ALvoid ALmodulatorState_Destruct(ALmodulatorState *state); static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *state, ALCdevice *device); -static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALmodulatorState) DEFINE_ALEFFECTSTATE_VTABLE(ALmodulatorState); @@ -56,31 +63,31 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALmodulatorState); #define WAVEFORM_FRACONE (1<> (WAVEFORM_FRACBITS - 1)) & 1); } #define DECL_TEMPLATE(func) \ -static void Modulate##func(ALfloat *restrict dst, const ALfloat *restrict src,\ - ALuint index, const ALuint step, ALuint todo) \ +static void Modulate##func(ALfloat *restrict dst, ALsizei index, \ + const ALsizei step, ALsizei todo) \ { \ - ALuint i; \ + ALsizei i; \ for(i = 0;i < todo;i++) \ { \ index += step; \ index &= WAVEFORM_FRACMASK; \ - dst[i] = src[i] * func(index); \ + dst[i] = func(index); \ } \ } @@ -93,16 +100,11 @@ DECL_TEMPLATE(Square) static void ALmodulatorState_Construct(ALmodulatorState *state) { - ALuint i; - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALmodulatorState, ALeffectState, state); state->index = 0; state->step = 1; - - for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ALfilterState_clear(&state->Filter[i]); } static ALvoid ALmodulatorState_Destruct(ALmodulatorState *state) @@ -110,91 +112,89 @@ static ALvoid ALmodulatorState_Destruct(ALmodulatorState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *state, ALCdevice *UNUSED(device)) { + ALsizei i, j; + for(i = 0;i < MAX_EFFECT_CHANNELS;i++) + { + BiquadFilter_clear(&state->Chans[i].Filter); + for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) + state->Chans[i].CurrentGains[j] = 0.0f; + } return AL_TRUE; } -static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALfloat cw, a; - ALuint i; + ALsizei i; if(props->Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) - state->Process = ModulateSin; + state->GetSamples = ModulateSin; else if(props->Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH) - state->Process = ModulateSaw; + state->GetSamples = ModulateSaw; else /*if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SQUARE)*/ - state->Process = ModulateSquare; + state->GetSamples = ModulateSquare; - state->step = fastf2u(props->Modulator.Frequency*WAVEFORM_FRACONE / - Device->Frequency); - if(state->step == 0) state->step = 1; + state->step = float2int(props->Modulator.Frequency*WAVEFORM_FRACONE/device->Frequency + 0.5f); + state->step = clampi(state->step, 1, WAVEFORM_FRACONE-1); /* Custom filter coeffs, which match the old version instead of a low-shelf. */ - cw = cosf(F_TAU * props->Modulator.HighPassCutoff / Device->Frequency); + cw = cosf(F_TAU * props->Modulator.HighPassCutoff / device->Frequency); a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f); - for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - { - state->Filter[i].a1 = -a; - state->Filter[i].a2 = 0.0f; - state->Filter[i].b0 = a; - state->Filter[i].b1 = -a; - state->Filter[i].b2 = 0.0f; - } + state->Chans[0].Filter.b0 = a; + state->Chans[0].Filter.b1 = -a; + state->Chans[0].Filter.b2 = 0.0f; + state->Chans[0].Filter.a1 = -a; + state->Chans[0].Filter.a2 = 0.0f; + for(i = 1;i < MAX_EFFECT_CHANNELS;i++) + BiquadFilter_copyParams(&state->Chans[i].Filter, &state->Chans[0].Filter); - STATIC_CAST(ALeffectState,state)->OutBuffer = Device->FOAOut.Buffer; - STATIC_CAST(ALeffectState,state)->OutChannels = Device->FOAOut.NumChannels; + STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer; + STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels; for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(Device->FOAOut, IdentityMatrixf.m[i], - Slot->Params.Gain, state->Gain[i]); + ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i], + slot->Params.Gain, state->Chans[i].TargetGains); } -static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - const ALuint step = state->step; - ALuint index = state->index; - ALuint base; + ALfloat *restrict modsamples = ASSUME_ALIGNED(state->ModSamples, 16); + const ALsizei step = state->step; + ALsizei base; for(base = 0;base < SamplesToDo;) { - ALfloat temps[2][128]; - ALuint td = minu(128, SamplesToDo-base); - ALuint i, j, k; + alignas(16) ALfloat temps[2][MAX_UPDATE_SAMPLES]; + ALsizei td = mini(MAX_UPDATE_SAMPLES, SamplesToDo-base); + ALsizei c, i; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) + state->GetSamples(modsamples, state->index, step, td); + state->index += (step*td) & WAVEFORM_FRACMASK; + state->index &= WAVEFORM_FRACMASK; + + for(c = 0;c < MAX_EFFECT_CHANNELS;c++) { - ALfilterState_process(&state->Filter[j], temps[0], &SamplesIn[j][base], td); - state->Process(temps[1], temps[0], index, step, td); + BiquadFilter_process(&state->Chans[c].Filter, temps[0], &SamplesIn[c][base], td); + for(i = 0;i < td;i++) + temps[1][i] = temps[0][i] * modsamples[i]; - for(k = 0;k < NumChannels;k++) - { - ALfloat gain = state->Gain[j][k]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(i = 0;i < td;i++) - SamplesOut[k][base+i] += gain * temps[1][i]; - } + MixSamples(temps[1], NumChannels, SamplesOut, state->Chans[c].CurrentGains, + state->Chans[c].TargetGains, SamplesToDo-base, base, td); } - for(i = 0;i < td;i++) - { - index += step; - index &= WAVEFORM_FRACMASK; - } base += td; } - state->index = index; } -typedef struct ALmodulatorStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALmodulatorStateFactory; +typedef struct ModulatorStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} ModulatorStateFactory; -static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *UNUSED(factory)) +static ALeffectState *ModulatorStateFactory_create(ModulatorStateFactory *UNUSED(factory)) { ALmodulatorState *state; @@ -204,13 +204,13 @@ static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *UN return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALmodulatorStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(ModulatorStateFactory); -ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void) +EffectStateFactory *ModulatorStateFactory_getFactory(void) { - static ALmodulatorStateFactory ModulatorFactory = { { GET_VTABLE2(ALmodulatorStateFactory, ALeffectStateFactory) } }; + static ModulatorStateFactory ModulatorFactory = { { GET_VTABLE2(ModulatorStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &ModulatorFactory); + return STATIC_CAST(EffectStateFactory, &ModulatorFactory); } @@ -221,24 +221,22 @@ void ALmodulator_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_RING_MODULATOR_FREQUENCY: if(!(val >= AL_RING_MODULATOR_MIN_FREQUENCY && val <= AL_RING_MODULATOR_MAX_FREQUENCY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Modulator frequency out of range"); props->Modulator.Frequency = val; break; case AL_RING_MODULATOR_HIGHPASS_CUTOFF: if(!(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Modulator high-pass cutoff out of range"); props->Modulator.HighPassCutoff = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } void ALmodulator_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALmodulator_setParamf(effect, context, param, vals[0]); -} +{ ALmodulator_setParamf(effect, context, param, vals[0]); } void ALmodulator_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { ALeffectProps *props = &effect->Props; @@ -251,18 +249,16 @@ void ALmodulator_setParami(ALeffect *effect, ALCcontext *context, ALenum param, case AL_RING_MODULATOR_WAVEFORM: if(!(val >= AL_RING_MODULATOR_MIN_WAVEFORM && val <= AL_RING_MODULATOR_MAX_WAVEFORM)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid modulator waveform"); props->Modulator.Waveform = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } void ALmodulator_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALmodulator_setParami(effect, context, param, vals[0]); -} +{ ALmodulator_setParami(effect, context, param, vals[0]); } void ALmodulator_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -280,13 +276,11 @@ void ALmodulator_getParami(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } void ALmodulator_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALmodulator_getParami(effect, context, param, vals); -} +{ ALmodulator_getParami(effect, context, param, vals); } void ALmodulator_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -300,12 +294,10 @@ void ALmodulator_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } void ALmodulator_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALmodulator_getParamf(effect, context, param, vals); -} +{ ALmodulator_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALmodulator); diff --git a/Engine/lib/openal-soft/Alc/effects/null.c b/Engine/lib/openal-soft/Alc/effects/null.c index bff00b567..e57359e39 100644 --- a/Engine/lib/openal-soft/Alc/effects/null.c +++ b/Engine/lib/openal-soft/Alc/effects/null.c @@ -16,8 +16,8 @@ typedef struct ALnullState { /* Forward-declare "virtual" functions to define the vtable with. */ static ALvoid ALnullState_Destruct(ALnullState *state); static ALboolean ALnullState_deviceUpdate(ALnullState *state, ALCdevice *device); -static ALvoid ALnullState_update(ALnullState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props); -static ALvoid ALnullState_process(ALnullState *state, ALuint samplesToDo, const ALfloatBUFFERSIZE*restrict samplesIn, ALfloatBUFFERSIZE*restrict samplesOut, ALuint NumChannels); +static ALvoid ALnullState_update(ALnullState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALnullState_process(ALnullState *state, ALsizei samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALsizei mumChannels); static void *ALnullState_New(size_t size); static void ALnullState_Delete(void *ptr); @@ -56,7 +56,7 @@ static ALboolean ALnullState_deviceUpdate(ALnullState* UNUSED(state), ALCdevice* /* This updates the effect state. This is called any time the effect is * (re)loaded into a slot. */ -static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UNUSED(device), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props)) +static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCcontext* UNUSED(context), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props)) { } @@ -64,7 +64,7 @@ static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UN * input to the output buffer. The result should be added to the output buffer, * not replace it. */ -static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samplesToDo), const ALfloatBUFFERSIZE*restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALuint UNUSED(NumChannels)) +static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALsizei UNUSED(samplesToDo), const ALfloatBUFFERSIZE*restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALsizei UNUSED(numChannels)) { } @@ -85,12 +85,12 @@ static void ALnullState_Delete(void *ptr) } -typedef struct ALnullStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALnullStateFactory; +typedef struct NullStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} NullStateFactory; /* Creates ALeffectState objects of the appropriate type. */ -ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory)) +ALeffectState *NullStateFactory_create(NullStateFactory *UNUSED(factory)) { ALnullState *state; @@ -100,79 +100,79 @@ ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory)) return STATIC_CAST(ALeffectState, state); } -/* Define the ALeffectStateFactory vtable for this type. */ -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnullStateFactory); +/* Define the EffectStateFactory vtable for this type. */ +DEFINE_EFFECTSTATEFACTORY_VTABLE(NullStateFactory); -ALeffectStateFactory *ALnullStateFactory_getFactory(void) +EffectStateFactory *NullStateFactory_getFactory(void) { - static ALnullStateFactory NullFactory = { { GET_VTABLE2(ALnullStateFactory, ALeffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &NullFactory); + static NullStateFactory NullFactory = { { GET_VTABLE2(NullStateFactory, EffectStateFactory) } }; + return STATIC_CAST(EffectStateFactory, &NullFactory); } -void ALnull_setParami(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void ALnull_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void ALnull_setParamiv(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals)) +void ALnull_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); } } -void ALnull_setParamf(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +void ALnull_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void ALnull_setParamfv(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals)) +void ALnull_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param); } } -void ALnull_getParami(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val)) +void ALnull_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void ALnull_getParamiv(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals)) +void ALnull_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); } } -void ALnull_getParamf(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) +void ALnull_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void ALnull_getParamfv(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals)) +void ALnull_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param); } } diff --git a/Engine/lib/openal-soft/Alc/effects/pshifter.c b/Engine/lib/openal-soft/Alc/effects/pshifter.c new file mode 100644 index 000000000..618573431 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/effects/pshifter.c @@ -0,0 +1,526 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 2018 by Raul Herraiz. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include + +#include "alMain.h" +#include "alAuxEffectSlot.h" +#include "alError.h" +#include "alu.h" +#include "filters/defs.h" + + +#define STFT_SIZE 1024 +#define STFT_HALF_SIZE (STFT_SIZE>>1) +#define OVERSAMP (1<<2) + +#define STFT_STEP (STFT_SIZE / OVERSAMP) +#define FIFO_LATENCY (STFT_STEP * (OVERSAMP-1)) + +typedef struct ALcomplex { + ALdouble Real; + ALdouble Imag; +} ALcomplex; + +typedef struct ALphasor { + ALdouble Amplitude; + ALdouble Phase; +} ALphasor; + +typedef struct ALFrequencyDomain { + ALdouble Amplitude; + ALdouble Frequency; +} ALfrequencyDomain; + +typedef struct ALpshifterState { + DERIVE_FROM_TYPE(ALeffectState); + + /* Effect parameters */ + ALsizei count; + ALsizei PitchShiftI; + ALfloat PitchShift; + ALfloat FreqPerBin; + + /*Effects buffers*/ + ALfloat InFIFO[STFT_SIZE]; + ALfloat OutFIFO[STFT_STEP]; + ALdouble LastPhase[STFT_HALF_SIZE+1]; + ALdouble SumPhase[STFT_HALF_SIZE+1]; + ALdouble OutputAccum[STFT_SIZE]; + + ALcomplex FFTbuffer[STFT_SIZE]; + + ALfrequencyDomain Analysis_buffer[STFT_HALF_SIZE+1]; + ALfrequencyDomain Syntesis_buffer[STFT_HALF_SIZE+1]; + + alignas(16) ALfloat BufferOut[BUFFERSIZE]; + + /* Effect gains for each output channel */ + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; +} ALpshifterState; + +static ALvoid ALpshifterState_Destruct(ALpshifterState *state); +static ALboolean ALpshifterState_deviceUpdate(ALpshifterState *state, ALCdevice *device); +static ALvoid ALpshifterState_update(ALpshifterState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALpshifterState_process(ALpshifterState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); +DECLARE_DEFAULT_ALLOCATORS(ALpshifterState) + +DEFINE_ALEFFECTSTATE_VTABLE(ALpshifterState); + + +/* Define a Hann window, used to filter the STFT input and output. */ +alignas(16) static ALdouble HannWindow[STFT_SIZE]; + +static void InitHannWindow(void) +{ + ALsizei i; + + /* Create lookup table of the Hann window for the desired size, i.e. STFT_SIZE */ + for(i = 0;i < STFT_SIZE>>1;i++) + { + ALdouble val = sin(M_PI * (ALdouble)i / (ALdouble)(STFT_SIZE-1)); + HannWindow[i] = HannWindow[STFT_SIZE-1-i] = val * val; + } +} +static alonce_flag HannInitOnce = AL_ONCE_FLAG_INIT; + + +/* Fast double-to-int conversion. Assumes the FPU is already in round-to-zero + * mode. */ +static inline ALint fastd2i(ALdouble d) +{ + /* NOTE: SSE2 is required for the efficient double-to-int opcodes on x86. + * Otherwise, we need to rely on x87's fistp opcode with it already in + * round-to-zero mode. x86-64 guarantees SSE2 support. + */ +#if (defined(__i386__) && !defined(__SSE2_MATH__)) || (defined(_M_IX86_FP) && (_M_IX86_FP < 2)) +#ifdef HAVE_LRINTF + return lrint(d); +#elif defined(_MSC_VER) && defined(_M_IX86) + ALint i; + __asm fld d + __asm fistp i + return i; +#else + return (ALint)d; +#endif +#else + return (ALint)d; +#endif +} + + +/* Converts ALcomplex to ALphasor */ +static inline ALphasor rect2polar(ALcomplex number) +{ + ALphasor polar; + + polar.Amplitude = sqrt(number.Real*number.Real + number.Imag*number.Imag); + polar.Phase = atan2(number.Imag, number.Real); + + return polar; +} + +/* Converts ALphasor to ALcomplex */ +static inline ALcomplex polar2rect(ALphasor number) +{ + ALcomplex cartesian; + + cartesian.Real = number.Amplitude * cos(number.Phase); + cartesian.Imag = number.Amplitude * sin(number.Phase); + + return cartesian; +} + +/* Addition of two complex numbers (ALcomplex format) */ +static inline ALcomplex complex_add(ALcomplex a, ALcomplex b) +{ + ALcomplex result; + + result.Real = a.Real + b.Real; + result.Imag = a.Imag + b.Imag; + + return result; +} + +/* Subtraction of two complex numbers (ALcomplex format) */ +static inline ALcomplex complex_sub(ALcomplex a, ALcomplex b) +{ + ALcomplex result; + + result.Real = a.Real - b.Real; + result.Imag = a.Imag - b.Imag; + + return result; +} + +/* Multiplication of two complex numbers (ALcomplex format) */ +static inline ALcomplex complex_mult(ALcomplex a, ALcomplex b) +{ + ALcomplex result; + + result.Real = a.Real*b.Real - a.Imag*b.Imag; + result.Imag = a.Imag*b.Real + a.Real*b.Imag; + + return result; +} + +/* Iterative implementation of 2-radix FFT (In-place algorithm). Sign = -1 is + * FFT and 1 is iFFT (inverse). Fills FFTBuffer[0...FFTSize-1] with the + * Discrete Fourier Transform (DFT) of the time domain data stored in + * FFTBuffer[0...FFTSize-1]. FFTBuffer is an array of complex numbers + * (ALcomplex), FFTSize MUST BE power of two. + */ +static inline ALvoid FFT(ALcomplex *FFTBuffer, ALsizei FFTSize, ALdouble Sign) +{ + ALsizei i, j, k, mask, step, step2; + ALcomplex temp, u, w; + ALdouble arg; + + /* Bit-reversal permutation applied to a sequence of FFTSize items */ + for(i = 1;i < FFTSize-1;i++) + { + for(mask = 0x1, j = 0;mask < FFTSize;mask <<= 1) + { + if((i&mask) != 0) + j++; + j <<= 1; + } + j >>= 1; + + if(i < j) + { + temp = FFTBuffer[i]; + FFTBuffer[i] = FFTBuffer[j]; + FFTBuffer[j] = temp; + } + } + + /* Iterative form of Danielson–Lanczos lemma */ + for(i = 1, step = 2;i < FFTSize;i<<=1, step<<=1) + { + step2 = step >> 1; + arg = M_PI / step2; + + w.Real = cos(arg); + w.Imag = sin(arg) * Sign; + + u.Real = 1.0; + u.Imag = 0.0; + + for(j = 0;j < step2;j++) + { + for(k = j;k < FFTSize;k+=step) + { + temp = complex_mult(FFTBuffer[k+step2], u); + FFTBuffer[k+step2] = complex_sub(FFTBuffer[k], temp); + FFTBuffer[k] = complex_add(FFTBuffer[k], temp); + } + + u = complex_mult(u, w); + } + } +} + + +static void ALpshifterState_Construct(ALpshifterState *state) +{ + ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); + SET_VTABLE2(ALpshifterState, ALeffectState, state); + + alcall_once(&HannInitOnce, InitHannWindow); +} + +static ALvoid ALpshifterState_Destruct(ALpshifterState *state) +{ + ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); +} + +static ALboolean ALpshifterState_deviceUpdate(ALpshifterState *state, ALCdevice *device) +{ + /* (Re-)initializing parameters and clear the buffers. */ + state->count = FIFO_LATENCY; + state->PitchShiftI = FRACTIONONE; + state->PitchShift = 1.0f; + state->FreqPerBin = device->Frequency / (ALfloat)STFT_SIZE; + + memset(state->InFIFO, 0, sizeof(state->InFIFO)); + memset(state->OutFIFO, 0, sizeof(state->OutFIFO)); + memset(state->FFTbuffer, 0, sizeof(state->FFTbuffer)); + memset(state->LastPhase, 0, sizeof(state->LastPhase)); + memset(state->SumPhase, 0, sizeof(state->SumPhase)); + memset(state->OutputAccum, 0, sizeof(state->OutputAccum)); + memset(state->Analysis_buffer, 0, sizeof(state->Analysis_buffer)); + memset(state->Syntesis_buffer, 0, sizeof(state->Syntesis_buffer)); + + memset(state->CurrentGains, 0, sizeof(state->CurrentGains)); + memset(state->TargetGains, 0, sizeof(state->TargetGains)); + + return AL_TRUE; +} + +static ALvoid ALpshifterState_update(ALpshifterState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) +{ + const ALCdevice *device = context->Device; + ALfloat coeffs[MAX_AMBI_COEFFS]; + float pitch; + + pitch = powf(2.0f, + (ALfloat)(props->Pshifter.CoarseTune*100 + props->Pshifter.FineTune) / 1200.0f + ); + state->PitchShiftI = (ALsizei)(pitch*FRACTIONONE + 0.5f); + state->PitchShift = state->PitchShiftI * (1.0f/FRACTIONONE); + + CalcAngleCoeffs(0.0f, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->TargetGains); +} + +static ALvoid ALpshifterState_process(ALpshifterState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) +{ + /* Pitch shifter engine based on the work of Stephan Bernsee. + * http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/ + */ + + static const ALdouble expected = M_PI*2.0 / OVERSAMP; + const ALdouble freq_per_bin = state->FreqPerBin; + ALfloat *restrict bufferOut = state->BufferOut; + ALsizei count = state->count; + ALsizei i, j, k; + + for(i = 0;i < SamplesToDo;) + { + do { + /* Fill FIFO buffer with samples data */ + state->InFIFO[count] = SamplesIn[0][i]; + bufferOut[i] = state->OutFIFO[count - FIFO_LATENCY]; + + count++; + } while(++i < SamplesToDo && count < STFT_SIZE); + + /* Check whether FIFO buffer is filled */ + if(count < STFT_SIZE) break; + count = FIFO_LATENCY; + + /* Real signal windowing and store in FFTbuffer */ + for(k = 0;k < STFT_SIZE;k++) + { + state->FFTbuffer[k].Real = state->InFIFO[k] * HannWindow[k]; + state->FFTbuffer[k].Imag = 0.0; + } + + /* ANALYSIS */ + /* Apply FFT to FFTbuffer data */ + FFT(state->FFTbuffer, STFT_SIZE, -1.0); + + /* Analyze the obtained data. Since the real FFT is symmetric, only + * STFT_HALF_SIZE+1 samples are needed. + */ + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + ALphasor component; + ALdouble tmp; + ALint qpd; + + /* Compute amplitude and phase */ + component = rect2polar(state->FFTbuffer[k]); + + /* Compute phase difference and subtract expected phase difference */ + tmp = (component.Phase - state->LastPhase[k]) - k*expected; + + /* Map delta phase into +/- Pi interval */ + qpd = fastd2i(tmp / M_PI); + tmp -= M_PI * (qpd + (qpd%2)); + + /* Get deviation from bin frequency from the +/- Pi interval */ + tmp /= expected; + + /* Compute the k-th partials' true frequency, twice the amplitude + * for maintain the gain (because half of bins are used) and store + * amplitude and true frequency in analysis buffer. + */ + state->Analysis_buffer[k].Amplitude = 2.0 * component.Amplitude; + state->Analysis_buffer[k].Frequency = (k + tmp) * freq_per_bin; + + /* Store actual phase[k] for the calculations in the next frame*/ + state->LastPhase[k] = component.Phase; + } + + /* PROCESSING */ + /* pitch shifting */ + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + state->Syntesis_buffer[k].Amplitude = 0.0; + state->Syntesis_buffer[k].Frequency = 0.0; + } + + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + j = (k*state->PitchShiftI) >> FRACTIONBITS; + if(j >= STFT_HALF_SIZE+1) break; + + state->Syntesis_buffer[j].Amplitude += state->Analysis_buffer[k].Amplitude; + state->Syntesis_buffer[j].Frequency = state->Analysis_buffer[k].Frequency * + state->PitchShift; + } + + /* SYNTHESIS */ + /* Synthesis the processing data */ + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + ALphasor component; + ALdouble tmp; + + /* Compute bin deviation from scaled freq */ + tmp = state->Syntesis_buffer[k].Frequency/freq_per_bin - k; + + /* Calculate actual delta phase and accumulate it to get bin phase */ + state->SumPhase[k] += (k + tmp) * expected; + + component.Amplitude = state->Syntesis_buffer[k].Amplitude; + component.Phase = state->SumPhase[k]; + + /* Compute phasor component to cartesian complex number and storage it into FFTbuffer*/ + state->FFTbuffer[k] = polar2rect(component); + } + /* zero negative frequencies for recontruct a real signal */ + for(k = STFT_HALF_SIZE+1;k < STFT_SIZE;k++) + { + state->FFTbuffer[k].Real = 0.0; + state->FFTbuffer[k].Imag = 0.0; + } + + /* Apply iFFT to buffer data */ + FFT(state->FFTbuffer, STFT_SIZE, 1.0); + + /* Windowing and add to output */ + for(k = 0;k < STFT_SIZE;k++) + state->OutputAccum[k] += HannWindow[k] * state->FFTbuffer[k].Real / + (0.5 * STFT_HALF_SIZE * OVERSAMP); + + /* Shift accumulator, input & output FIFO */ + for(k = 0;k < STFT_STEP;k++) state->OutFIFO[k] = (ALfloat)state->OutputAccum[k]; + for(j = 0;k < STFT_SIZE;k++,j++) state->OutputAccum[j] = state->OutputAccum[k]; + for(;j < STFT_SIZE;j++) state->OutputAccum[j] = 0.0; + for(k = 0;k < FIFO_LATENCY;k++) + state->InFIFO[k] = state->InFIFO[k+STFT_STEP]; + } + state->count = count; + + /* Now, mix the processed sound data to the output. */ + MixSamples(bufferOut, NumChannels, SamplesOut, state->CurrentGains, state->TargetGains, + maxi(SamplesToDo, 512), 0, SamplesToDo); +} + +typedef struct PshifterStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} PshifterStateFactory; + +static ALeffectState *PshifterStateFactory_create(PshifterStateFactory *UNUSED(factory)) +{ + ALpshifterState *state; + + NEW_OBJ0(state, ALpshifterState)(); + if(!state) return NULL; + + return STATIC_CAST(ALeffectState, state); +} + +DEFINE_EFFECTSTATEFACTORY_VTABLE(PshifterStateFactory); + +EffectStateFactory *PshifterStateFactory_getFactory(void) +{ + static PshifterStateFactory PshifterFactory = { { GET_VTABLE2(PshifterStateFactory, EffectStateFactory) } }; + + return STATIC_CAST(EffectStateFactory, &PshifterFactory); +} + + +void ALpshifter_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +{ + alSetError( context, AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param ); +} + +void ALpshifter_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +{ + alSetError( context, AL_INVALID_ENUM, "Invalid pitch shifter float-vector property 0x%04x", param ); +} + +void ALpshifter_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ + ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_PITCH_SHIFTER_COARSE_TUNE: + if(!(val >= AL_PITCH_SHIFTER_MIN_COARSE_TUNE && val <= AL_PITCH_SHIFTER_MAX_COARSE_TUNE)) + SETERR_RETURN(context, AL_INVALID_VALUE,,"Pitch shifter coarse tune out of range"); + props->Pshifter.CoarseTune = val; + break; + + case AL_PITCH_SHIFTER_FINE_TUNE: + if(!(val >= AL_PITCH_SHIFTER_MIN_FINE_TUNE && val <= AL_PITCH_SHIFTER_MAX_FINE_TUNE)) + SETERR_RETURN(context, AL_INVALID_VALUE,,"Pitch shifter fine tune out of range"); + props->Pshifter.FineTune = val; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x", param); + } +} +void ALpshifter_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ + ALpshifter_setParami(effect, context, param, vals[0]); +} + +void ALpshifter_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ + const ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_PITCH_SHIFTER_COARSE_TUNE: + *val = (ALint)props->Pshifter.CoarseTune; + break; + case AL_PITCH_SHIFTER_FINE_TUNE: + *val = (ALint)props->Pshifter.FineTune; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x", param); + } +} +void ALpshifter_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ + ALpshifter_getParami(effect, context, param, vals); +} + +void ALpshifter_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +{ + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param); +} + +void ALpshifter_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +{ + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float vector-property 0x%04x", param); +} + +DEFINE_ALEFFECT_VTABLE(ALpshifter); diff --git a/Engine/lib/openal-soft/Alc/effects/reverb.c b/Engine/lib/openal-soft/Alc/effects/reverb.c index f2d5b7189..12e78bdfc 100644 --- a/Engine/lib/openal-soft/Alc/effects/reverb.c +++ b/Engine/lib/openal-soft/Alc/effects/reverb.c @@ -1,6 +1,6 @@ /** - * Reverb for the OpenAL cross platform audio library - * Copyright (C) 2008-2009 by Christopher Fitzgerald. + * Ambisonic reverb engine for the OpenAL cross platform audio library + * Copyright (C) 2008-2017 by Chris Robinson and Christopher Fitzgerald. * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -27,258 +27,400 @@ #include "alMain.h" #include "alu.h" #include "alAuxEffectSlot.h" -#include "alEffect.h" -#include "alFilter.h" +#include "alListener.h" #include "alError.h" -#include "mixer_defs.h" +#include "filters/defs.h" +/* This is a user config option for modifying the overall output of the reverb + * effect. + */ +ALfloat ReverbBoost = 1.0f; /* This is the maximum number of samples processed for each inner loop * iteration. */ #define MAX_UPDATE_SAMPLES 256 +/* The number of samples used for cross-faded delay lines. This can be used + * to balance the compensation for abrupt line changes and attenuation due to + * minimally lengthed recursive lines. Try to keep this below the device + * update size. + */ +#define FADE_SAMPLES 128 -static MixerFunc MixSamples = Mix_C; -static RowMixerFunc MixRowSamples = MixRow_C; +/* The number of spatialized lines or channels to process. Four channels allows + * for a 3D A-Format response. NOTE: This can't be changed without taking care + * of the conversion matrices, and a few places where the length arrays are + * assumed to have 4 elements. + */ +#define NUM_LINES 4 -static alonce_flag mixfunc_inited = AL_ONCE_FLAG_INIT; -static void init_mixfunc(void) + +/* The B-Format to A-Format conversion matrix. The arrangement of rows is + * deliberately chosen to align the resulting lines to their spatial opposites + * (0:above front left <-> 3:above back right, 1:below front right <-> 2:below + * back left). It's not quite opposite, since the A-Format results in a + * tetrahedron, but it's close enough. Should the model be extended to 8-lines + * in the future, true opposites can be used. + */ +static const aluMatrixf B2A = {{ + { 0.288675134595f, 0.288675134595f, 0.288675134595f, 0.288675134595f }, + { 0.288675134595f, -0.288675134595f, -0.288675134595f, 0.288675134595f }, + { 0.288675134595f, 0.288675134595f, -0.288675134595f, -0.288675134595f }, + { 0.288675134595f, -0.288675134595f, 0.288675134595f, -0.288675134595f } +}}; + +/* Converts A-Format to B-Format. */ +static const aluMatrixf A2B = {{ + { 0.866025403785f, 0.866025403785f, 0.866025403785f, 0.866025403785f }, + { 0.866025403785f, -0.866025403785f, 0.866025403785f, -0.866025403785f }, + { 0.866025403785f, -0.866025403785f, -0.866025403785f, 0.866025403785f }, + { 0.866025403785f, 0.866025403785f, -0.866025403785f, -0.866025403785f } +}}; + +static const ALfloat FadeStep = 1.0f / FADE_SAMPLES; + +/* The all-pass and delay lines have a variable length dependent on the + * effect's density parameter, which helps alter the perceived environment + * size. The size-to-density conversion is a cubed scale: + * + * density = min(1.0, pow(size, 3.0) / DENSITY_SCALE); + * + * The line lengths scale linearly with room size, so the inverse density + * conversion is needed, taking the cube root of the re-scaled density to + * calculate the line length multiplier: + * + * length_mult = max(5.0, cbrtf(density*DENSITY_SCALE)); + * + * The density scale below will result in a max line multiplier of 50, for an + * effective size range of 5m to 50m. + */ +static const ALfloat DENSITY_SCALE = 125000.0f; + +/* All delay line lengths are specified in seconds. + * + * To approximate early reflections, we break them up into primary (those + * arriving from the same direction as the source) and secondary (those + * arriving from the opposite direction). + * + * The early taps decorrelate the 4-channel signal to approximate an average + * room response for the primary reflections after the initial early delay. + * + * Given an average room dimension (d_a) and the speed of sound (c) we can + * calculate the average reflection delay (r_a) regardless of listener and + * source positions as: + * + * r_a = d_a / c + * c = 343.3 + * + * This can extended to finding the average difference (r_d) between the + * maximum (r_1) and minimum (r_0) reflection delays: + * + * r_0 = 2 / 3 r_a + * = r_a - r_d / 2 + * = r_d + * r_1 = 4 / 3 r_a + * = r_a + r_d / 2 + * = 2 r_d + * r_d = 2 / 3 r_a + * = r_1 - r_0 + * + * As can be determined by integrating the 1D model with a source (s) and + * listener (l) positioned across the dimension of length (d_a): + * + * r_d = int_(l=0)^d_a (int_(s=0)^d_a |2 d_a - 2 (l + s)| ds) dl / c + * + * The initial taps (T_(i=0)^N) are then specified by taking a power series + * that ranges between r_0 and half of r_1 less r_0: + * + * R_i = 2^(i / (2 N - 1)) r_d + * = r_0 + (2^(i / (2 N - 1)) - 1) r_d + * = r_0 + T_i + * T_i = R_i - r_0 + * = (2^(i / (2 N - 1)) - 1) r_d + * + * Assuming an average of 1m, we get the following taps: + */ +static const ALfloat EARLY_TAP_LENGTHS[NUM_LINES] = { - MixSamples = SelectMixer(); - MixRowSamples = SelectRowMixer(); -} + 0.0000000e+0f, 2.0213520e-4f, 4.2531060e-4f, 6.7171600e-4f +}; - -typedef struct DelayLine +/* The early all-pass filter lengths are based on the early tap lengths: + * + * A_i = R_i / a + * + * Where a is the approximate maximum all-pass cycle limit (20). + */ +static const ALfloat EARLY_ALLPASS_LENGTHS[NUM_LINES] = { - // The delay lines use sample lengths that are powers of 2 to allow the - // use of bit-masking instead of a modulus for wrapping. - ALuint Mask; - ALfloat *Line; -} DelayLine; + 9.7096800e-5f, 1.0720356e-4f, 1.1836234e-4f, 1.3068260e-4f +}; + +/* The early delay lines are used to transform the primary reflections into + * the secondary reflections. The A-format is arranged in such a way that + * the channels/lines are spatially opposite: + * + * C_i is opposite C_(N-i-1) + * + * The delays of the two opposing reflections (R_i and O_i) from a source + * anywhere along a particular dimension always sum to twice its full delay: + * + * 2 r_a = R_i + O_i + * + * With that in mind we can determine the delay between the two reflections + * and thus specify our early line lengths (L_(i=0)^N) using: + * + * O_i = 2 r_a - R_(N-i-1) + * L_i = O_i - R_(N-i-1) + * = 2 (r_a - R_(N-i-1)) + * = 2 (r_a - T_(N-i-1) - r_0) + * = 2 r_a (1 - (2 / 3) 2^((N - i - 1) / (2 N - 1))) + * + * Using an average dimension of 1m, we get: + */ +static const ALfloat EARLY_LINE_LENGTHS[NUM_LINES] = +{ + 5.9850400e-4f, 1.0913150e-3f, 1.5376658e-3f, 1.9419362e-3f +}; + +/* The late all-pass filter lengths are based on the late line lengths: + * + * A_i = (5 / 3) L_i / r_1 + */ +static const ALfloat LATE_ALLPASS_LENGTHS[NUM_LINES] = +{ + 1.6182800e-4f, 2.0389060e-4f, 2.8159360e-4f, 3.2365600e-4f +}; + +/* The late lines are used to approximate the decaying cycle of recursive + * late reflections. + * + * Splitting the lines in half, we start with the shortest reflection paths + * (L_(i=0)^(N/2)): + * + * L_i = 2^(i / (N - 1)) r_d + * + * Then for the opposite (longest) reflection paths (L_(i=N/2)^N): + * + * L_i = 2 r_a - L_(i-N/2) + * = 2 r_a - 2^((i - N / 2) / (N - 1)) r_d + * + * For our 1m average room, we get: + */ +static const ALfloat LATE_LINE_LENGTHS[NUM_LINES] = +{ + 1.9419362e-3f, 2.4466860e-3f, 3.3791220e-3f, 3.8838720e-3f +}; + + +typedef struct DelayLineI { + /* The delay lines use interleaved samples, with the lengths being powers + * of 2 to allow the use of bit-masking instead of a modulus for wrapping. + */ + ALsizei Mask; + ALfloat (*Line)[NUM_LINES]; +} DelayLineI; + +typedef struct VecAllpass { + DelayLineI Delay; + ALsizei Offset[NUM_LINES][2]; +} VecAllpass; + +typedef struct T60Filter { + /* Two filters are used to adjust the signal. One to control the low + * frequencies, and one to control the high frequencies. The HF filter also + * adjusts the overall output gain, affecting the remaining mid-band. + */ + ALfloat HFCoeffs[3]; + ALfloat LFCoeffs[3]; + + /* The HF and LF filters each keep a delay component. */ + ALfloat HFState; + ALfloat LFState; +} T60Filter; + +typedef struct EarlyReflections { + /* A Gerzon vector all-pass filter is used to simulate initial diffusion. + * The spread from this filter also helps smooth out the reverb tail. + */ + VecAllpass VecAp; + + /* An echo line is used to complete the second half of the early + * reflections. + */ + DelayLineI Delay; + ALsizei Offset[NUM_LINES][2]; + ALfloat Coeff[NUM_LINES]; + + /* The gain for each output channel based on 3D panning. */ + ALfloat CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; + ALfloat PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; +} EarlyReflections; + +typedef struct LateReverb { + /* Attenuation to compensate for the modal density and decay rate of the + * late lines. + */ + ALfloat DensityGain; + + /* A recursive delay line is used fill in the reverb tail. */ + DelayLineI Delay; + ALsizei Offset[NUM_LINES][2]; + + /* T60 decay filters are used to simulate absorption. */ + T60Filter T60[NUM_LINES]; + + /* A Gerzon vector all-pass filter is used to simulate diffusion. */ + VecAllpass VecAp; + + /* The gain for each output channel based on 3D panning. */ + ALfloat CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; + ALfloat PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; +} LateReverb; typedef struct ALreverbState { DERIVE_FROM_TYPE(ALeffectState); - ALboolean IsEax; + /* All delay lines are allocated as a single buffer to reduce memory + * fragmentation and management code. + */ + ALfloat *SampleBuffer; + ALuint TotalSamples; - // All delay lines are allocated as a single buffer to reduce memory - // fragmentation and management code. - ALfloat *SampleBuffer; - ALuint TotalSamples; - - // Master effect filters + /* Master effect filters */ struct { - ALfilterState Lp; - ALfilterState Hp; // EAX only - } Filter[4]; - - struct { - // Modulator delay line. - DelayLine Delay[4]; - - // The vibrato time is tracked with an index over a modulus-wrapped - // range (in samples). - ALuint Index; - ALuint Range; - - // The depth of frequency change (also in samples) and its filter. - ALfloat Depth; - ALfloat Coeff; - ALfloat Filter; - } Mod; // EAX only + BiquadFilter Lp; + BiquadFilter Hp; + } Filter[NUM_LINES]; /* Core delay line (early reflections and late reverb tap from this). */ - DelayLine Delay; - /* The tap points for the initial delay. First set go to early - * reflections, second to late reverb. - */ - ALuint EarlyDelayTap[4]; - ALuint LateDelayTap[4]; + DelayLineI Delay; - struct { - // Early reflections are done with 4 delay lines. - ALfloat Coeff[4]; - DelayLine Delay[4]; - ALuint Offset[4]; + /* Tap points for early reflection delay. */ + ALsizei EarlyDelayTap[NUM_LINES][2]; + ALfloat EarlyDelayCoeff[NUM_LINES]; - // The gain for each output channel based on 3D panning. - ALfloat CurrentGain[4][MAX_OUTPUT_CHANNELS]; - ALfloat PanGain[4][MAX_OUTPUT_CHANNELS]; - } Early; + /* Tap points for late reverb feed and delay. */ + ALsizei LateFeedTap; + ALsizei LateDelayTap[NUM_LINES][2]; - struct { - // Output gain for late reverb. - ALfloat Gain; + /* The feed-back and feed-forward all-pass coefficient. */ + ALfloat ApFeedCoeff; - // Attenuation to compensate for the modal density and decay rate of - // the late lines. - ALfloat DensityGain; + /* Coefficients for the all-pass and line scattering matrices. */ + ALfloat MixX; + ALfloat MixY; - // The feed-back and feed-forward all-pass coefficient. - ALfloat ApFeedCoeff; + EarlyReflections Early; - // Mixing matrix coefficient. - ALfloat MixCoeff; + LateReverb Late; - // Late reverb has 4 parallel all-pass filters. - struct { - ALfloat Coeff; - DelayLine Delay; - ALuint Offset; - } Ap[4]; + /* Indicates the cross-fade point for delay line reads [0,FADE_SAMPLES]. */ + ALsizei FadeCount; - // In addition to 4 cyclical delay lines. - ALfloat Coeff[4]; - DelayLine Delay[4]; - ALuint Offset[4]; - - // The cyclical delay lines are 1-pole low-pass filtered. - struct { - ALfloat Sample; - ALfloat Coeff; - } Lp[4]; - - // The gain for each output channel based on 3D panning. - ALfloat CurrentGain[4][MAX_OUTPUT_CHANNELS]; - ALfloat PanGain[4][MAX_OUTPUT_CHANNELS]; - } Late; - - struct { - // Attenuation to compensate for the modal density and decay rate of - // the echo line. - ALfloat DensityGain; - - // Echo delay and all-pass lines. - struct { - DelayLine Feedback; - DelayLine Ap; - } Delay[4]; - - ALfloat Coeff; - ALfloat ApFeedCoeff; - ALfloat ApCoeff; - - ALuint Offset; - ALuint ApOffset; - - // The echo line is 1-pole low-pass filtered. - ALfloat LpCoeff; - ALfloat LpSample[4]; - - // Echo mixing coefficient. - ALfloat MixCoeff; - } Echo; // EAX only - - // The current read offset for all delay lines. - ALuint Offset; + /* The current write offset for all delay lines. */ + ALsizei Offset; /* Temporary storage used when processing. */ - alignas(16) ALfloat AFormatSamples[4][MAX_UPDATE_SAMPLES]; - alignas(16) ALfloat ReverbSamples[4][MAX_UPDATE_SAMPLES]; - alignas(16) ALfloat EarlySamples[4][MAX_UPDATE_SAMPLES]; + alignas(16) ALfloat AFormatSamples[NUM_LINES][MAX_UPDATE_SAMPLES]; + alignas(16) ALfloat ReverbSamples[NUM_LINES][MAX_UPDATE_SAMPLES]; + alignas(16) ALfloat EarlySamples[NUM_LINES][MAX_UPDATE_SAMPLES]; } ALreverbState; static ALvoid ALreverbState_Destruct(ALreverbState *State); static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Device); -static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props); +static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALreverbState) DEFINE_ALEFFECTSTATE_VTABLE(ALreverbState); - static void ALreverbState_Construct(ALreverbState *state) { - ALuint index, l; + ALsizei i, j; ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALreverbState, ALeffectState, state); - state->IsEax = AL_FALSE; - state->TotalSamples = 0; state->SampleBuffer = NULL; - for(index = 0;index < 4;index++) + for(i = 0;i < NUM_LINES;i++) { - ALfilterState_clear(&state->Filter[index].Lp); - ALfilterState_clear(&state->Filter[index].Hp); - - state->Mod.Delay[index].Mask = 0; - state->Mod.Delay[index].Line = NULL; + BiquadFilter_clear(&state->Filter[i].Lp); + BiquadFilter_clear(&state->Filter[i].Hp); } - state->Mod.Index = 0; - state->Mod.Range = 1; - state->Mod.Depth = 0.0f; - state->Mod.Coeff = 0.0f; - state->Mod.Filter = 0.0f; - state->Delay.Mask = 0; state->Delay.Line = NULL; - for(index = 0;index < 4;index++) - state->EarlyDelayTap[index] = 0; - for(index = 0;index < 4;index++) - state->LateDelayTap[index] = 0; - for(index = 0;index < 4;index++) + for(i = 0;i < NUM_LINES;i++) { - state->Early.Coeff[index] = 0.0f; - state->Early.Delay[index].Mask = 0; - state->Early.Delay[index].Line = NULL; - state->Early.Offset[index] = 0; + state->EarlyDelayTap[i][0] = 0; + state->EarlyDelayTap[i][1] = 0; + state->EarlyDelayCoeff[i] = 0.0f; + } + + state->LateFeedTap = 0; + + for(i = 0;i < NUM_LINES;i++) + { + state->LateDelayTap[i][0] = 0; + state->LateDelayTap[i][1] = 0; + } + + state->ApFeedCoeff = 0.0f; + state->MixX = 0.0f; + state->MixY = 0.0f; + + state->Early.VecAp.Delay.Mask = 0; + state->Early.VecAp.Delay.Line = NULL; + state->Early.Delay.Mask = 0; + state->Early.Delay.Line = NULL; + for(i = 0;i < NUM_LINES;i++) + { + state->Early.VecAp.Offset[i][0] = 0; + state->Early.VecAp.Offset[i][1] = 0; + state->Early.Offset[i][0] = 0; + state->Early.Offset[i][1] = 0; + state->Early.Coeff[i] = 0.0f; } - state->Late.Gain = 0.0f; state->Late.DensityGain = 0.0f; - state->Late.ApFeedCoeff = 0.0f; - state->Late.MixCoeff = 0.0f; - for(index = 0;index < 4;index++) + + state->Late.Delay.Mask = 0; + state->Late.Delay.Line = NULL; + state->Late.VecAp.Delay.Mask = 0; + state->Late.VecAp.Delay.Line = NULL; + for(i = 0;i < NUM_LINES;i++) { - state->Late.Ap[index].Coeff = 0.0f; - state->Late.Ap[index].Delay.Mask = 0; - state->Late.Ap[index].Delay.Line = NULL; - state->Late.Ap[index].Offset = 0; + state->Late.Offset[i][0] = 0; + state->Late.Offset[i][1] = 0; - state->Late.Coeff[index] = 0.0f; - state->Late.Delay[index].Mask = 0; - state->Late.Delay[index].Line = NULL; - state->Late.Offset[index] = 0; + state->Late.VecAp.Offset[i][0] = 0; + state->Late.VecAp.Offset[i][1] = 0; - state->Late.Lp[index].Sample = 0.0f; - state->Late.Lp[index].Coeff = 0.0f; + for(j = 0;j < 3;j++) + { + state->Late.T60[i].HFCoeffs[j] = 0.0f; + state->Late.T60[i].LFCoeffs[j] = 0.0f; + } + state->Late.T60[i].HFState = 0.0f; + state->Late.T60[i].LFState = 0.0f; } - for(l = 0;l < 4;l++) + for(i = 0;i < NUM_LINES;i++) { - for(index = 0;index < MAX_OUTPUT_CHANNELS;index++) + for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) { - state->Early.CurrentGain[l][index] = 0.0f; - state->Early.PanGain[l][index] = 0.0f; - state->Late.CurrentGain[l][index] = 0.0f; - state->Late.PanGain[l][index] = 0.0f; + state->Early.CurrentGain[i][j] = 0.0f; + state->Early.PanGain[i][j] = 0.0f; + state->Late.CurrentGain[i][j] = 0.0f; + state->Late.PanGain[i][j] = 0.0f; } } - state->Echo.DensityGain = 0.0f; - for(l = 0;l < 4;l++) - { - state->Echo.Delay[l].Feedback.Mask = 0; - state->Echo.Delay[l].Feedback.Line = NULL; - state->Echo.Delay[l].Ap.Mask = 0; - state->Echo.Delay[l].Ap.Line = NULL; - } - state->Echo.Coeff = 0.0f; - state->Echo.ApFeedCoeff = 0.0f; - state->Echo.ApCoeff = 0.0f; - state->Echo.Offset = 0; - state->Echo.ApOffset = 0; - state->Echo.LpCoeff = 0.0f; - for(l = 0;l < 4;l++) - state->Echo.LpSample[l] = 0.0f; - state->Echo.MixCoeff = 0.0f; - + state->FadeCount = 0; state->Offset = 0; } @@ -290,107 +432,45 @@ static ALvoid ALreverbState_Destruct(ALreverbState *State) ALeffectState_Destruct(STATIC_CAST(ALeffectState,State)); } -/* This is a user config option for modifying the overall output of the reverb - * effect. - */ -ALfloat ReverbBoost = 1.0f; - -/* Specifies whether to use a standard reverb effect in place of EAX reverb (no - * high-pass, modulation, or echo). - */ -ALboolean EmulateEAXReverb = AL_FALSE; - -/* This coefficient is used to define the maximum frequency range controlled - * by the modulation depth. The current value of 0.1 will allow it to swing - * from 0.9x to 1.1x. This value must be below 1. At 1 it will cause the - * sampler to stall on the downswing, and above 1 it will cause it to sample - * backwards. - */ -static const ALfloat MODULATION_DEPTH_COEFF = 0.1f; - -/* A filter is used to avoid the terrible distortion caused by changing - * modulation time and/or depth. To be consistent across different sample - * rates, the coefficient must be raised to a constant divided by the sample - * rate: coeff^(constant / rate). - */ -static const ALfloat MODULATION_FILTER_COEFF = 0.048f; -static const ALfloat MODULATION_FILTER_CONST = 100000.0f; - -// When diffusion is above 0, an all-pass filter is used to take the edge off -// the echo effect. It uses the following line length (in seconds). -static const ALfloat ECHO_ALLPASS_LENGTH = 0.0133f; - -/* Input into the early reflections and late reverb are decorrelated between - * four channels. Their timings are dependent on a fraction and multiplier. See - * the UpdateDelayLine() routine for the calculations involved. - */ -static const ALfloat DECO_FRACTION = 0.15f; -static const ALfloat DECO_MULTIPLIER = 2.0f; - -// All delay line lengths are specified in seconds. - -// The lengths of the early delay lines. -static const ALfloat EARLY_LINE_LENGTH[4] = -{ - 0.0015f, 0.0045f, 0.0135f, 0.0405f -}; - -// The lengths of the late cyclical delay lines. -static const ALfloat LATE_LINE_LENGTH[4] = -{ - 0.0211f, 0.0311f, 0.0461f, 0.0680f -}; - -// The lengths of the late all-pass delay lines. -static const ALfloat ALLPASS_LINE_LENGTH[4] = -{ - 0.0151f, 0.0167f, 0.0183f, 0.0200f, -}; - -// The late cyclical delay lines have a variable length dependent on the -// effect's density parameter (inverted for some reason) and this multiplier. -static const ALfloat LATE_LINE_MULTIPLIER = 4.0f; - - -#if defined(_WIN32) && !defined (_M_X64) && !defined(_M_ARM) -/* HACK: Workaround for a modff bug in 32-bit Windows, which attempts to write - * a 64-bit double to the 32-bit float parameter. - */ -static inline float hack_modff(float x, float *y) -{ - double di; - double df = modf((double)x, &di); - *y = (float)di; - return (float)df; -} -#define modff hack_modff -#endif - - /************************************** * Device Update * **************************************/ -// Given the allocated sample buffer, this function updates each delay line -// offset. -static inline ALvoid RealizeLineOffset(ALfloat *sampleBuffer, DelayLine *Delay) +static inline ALfloat CalcDelayLengthMult(ALfloat density) { - Delay->Line = &sampleBuffer[(ptrdiff_t)Delay->Line]; + return maxf(5.0f, cbrtf(density*DENSITY_SCALE)); } -// Calculate the length of a delay line and store its mask and offset. -static ALuint CalcLineLength(ALfloat length, ptrdiff_t offset, ALuint frequency, ALuint extra, DelayLine *Delay) +/* Given the allocated sample buffer, this function updates each delay line + * offset. + */ +static inline ALvoid RealizeLineOffset(ALfloat *sampleBuffer, DelayLineI *Delay) +{ + union { + ALfloat *f; + ALfloat (*f4)[NUM_LINES]; + } u; + u.f = &sampleBuffer[(ptrdiff_t)Delay->Line * NUM_LINES]; + Delay->Line = u.f4; +} + +/* Calculate the length of a delay line and store its mask and offset. */ +static ALuint CalcLineLength(const ALfloat length, const ptrdiff_t offset, const ALuint frequency, + const ALuint extra, DelayLineI *Delay) { ALuint samples; - // All line lengths are powers of 2, calculated from their lengths, with - // an additional sample in case of rounding errors. - samples = fastf2u(length*frequency) + extra; - samples = NextPowerOf2(samples + 1); - // All lines share a single sample buffer. + /* All line lengths are powers of 2, calculated from their lengths in + * seconds, rounded up. + */ + samples = float2int(ceilf(length*frequency)); + samples = NextPowerOf2(samples + extra); + + /* All lines share a single sample buffer. */ Delay->Mask = samples - 1; - Delay->Line = (ALfloat*)offset; - // Return the sample count for accumulation. + Delay->Line = (ALfloat(*)[NUM_LINES])offset; + + /* Return the sample count for accumulation. */ return samples; } @@ -398,73 +478,60 @@ static ALuint CalcLineLength(ALfloat length, ptrdiff_t offset, ALuint frequency, * for all lines given the sample rate (frequency). If an allocation failure * occurs, it returns AL_FALSE. */ -static ALboolean AllocLines(ALuint frequency, ALreverbState *State) +static ALboolean AllocLines(const ALuint frequency, ALreverbState *State) { - ALuint totalSamples, index; - ALfloat length; + ALuint totalSamples, i; + ALfloat multiplier, length; - // All delay line lengths are calculated to accomodate the full range of - // lengths given their respective paramters. + /* All delay line lengths are calculated to accomodate the full range of + * lengths given their respective paramters. + */ totalSamples = 0; - /* The modulator's line length is calculated from the maximum modulation - * time and depth coefficient, and halfed for the low-to-high frequency - * swing. An additional sample is added to keep it stable when there is no - * modulation. + /* Multiplier for the maximum density value, i.e. density=1, which is + * actually the least density... */ - length = (AL_EAXREVERB_MAX_MODULATION_TIME*MODULATION_DEPTH_COEFF/2.0f); - for(index = 0;index < 4;index++) - totalSamples += CalcLineLength(length, totalSamples, frequency, 1, - &State->Mod.Delay[index]); + multiplier = CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY); - /* The initial delay is the sum of the reflections and late reverb delays. - * The decorrelator length is calculated from the lowest reverb density (a - * parameter value of 1). This must include space for storing a loop - * update. + /* The main delay length includes the maximum early reflection delay, the + * largest early tap width, the maximum late reverb delay, and the + * largest late tap width. Finally, it must also be extended by the + * update size (MAX_UPDATE_SAMPLES) for block processing. */ - length = AL_EAXREVERB_MAX_REFLECTIONS_DELAY + - AL_EAXREVERB_MAX_LATE_REVERB_DELAY; - length += (DECO_FRACTION * DECO_MULTIPLIER * DECO_MULTIPLIER) * - LATE_LINE_LENGTH[0] * (1.0f + LATE_LINE_MULTIPLIER); - /* Multiply length by 4, since we're storing 4 interleaved channels in the - * main delay line. + length = AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS[NUM_LINES-1]*multiplier + + AL_EAXREVERB_MAX_LATE_REVERB_DELAY + + (LATE_LINE_LENGTHS[NUM_LINES-1] - LATE_LINE_LENGTHS[0])*0.25f*multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, MAX_UPDATE_SAMPLES, + &State->Delay); + + /* The early vector all-pass line. */ + length = EARLY_ALLPASS_LENGTHS[NUM_LINES-1] * multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Early.VecAp.Delay); + + /* The early reflection line. */ + length = EARLY_LINE_LENGTHS[NUM_LINES-1] * multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Early.Delay); + + /* The late vector all-pass line. */ + length = LATE_ALLPASS_LENGTHS[NUM_LINES-1] * multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Late.VecAp.Delay); + + /* The late delay lines are calculated from the larger of the maximum + * density line length or the maximum echo time. */ - totalSamples += CalcLineLength(length*4, totalSamples, frequency, - MAX_UPDATE_SAMPLES*4, &State->Delay); - - // The early reflection lines. - for(index = 0;index < 4;index++) - totalSamples += CalcLineLength(EARLY_LINE_LENGTH[index], totalSamples, - frequency, 0, &State->Early.Delay[index]); - - // The late delay lines are calculated from the lowest reverb density. - for(index = 0;index < 4;index++) - { - length = LATE_LINE_LENGTH[index] * (1.0f + LATE_LINE_MULTIPLIER); - totalSamples += CalcLineLength(length, totalSamples, frequency, 0, - &State->Late.Delay[index]); - } - - // The late all-pass lines. - for(index = 0;index < 4;index++) - totalSamples += CalcLineLength(ALLPASS_LINE_LENGTH[index], totalSamples, - frequency, 0, &State->Late.Ap[index].Delay); - - // The echo all-pass and delay lines. - for(index = 0;index < 4;index++) - { - totalSamples += CalcLineLength(ECHO_ALLPASS_LENGTH, totalSamples, - frequency, 0, &State->Echo.Delay[index].Ap); - totalSamples += CalcLineLength(AL_EAXREVERB_MAX_ECHO_TIME, totalSamples, - frequency, 0, &State->Echo.Delay[index].Feedback); - } + length = maxf(AL_EAXREVERB_MAX_ECHO_TIME, LATE_LINE_LENGTHS[NUM_LINES-1]*multiplier); + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Late.Delay); if(totalSamples != State->TotalSamples) { ALfloat *newBuffer; - TRACE("New reverb buffer length: %u samples\n", totalSamples); - newBuffer = al_calloc(16, sizeof(ALfloat) * totalSamples); + TRACE("New reverb buffer length: %ux4 samples\n", totalSamples); + newBuffer = al_calloc(16, sizeof(ALfloat[NUM_LINES]) * totalSamples); if(!newBuffer) return AL_FALSE; al_free(State->SampleBuffer); @@ -472,54 +539,35 @@ static ALboolean AllocLines(ALuint frequency, ALreverbState *State) State->TotalSamples = totalSamples; } - // Update all delays to reflect the new sample buffer. + /* Update all delays to reflect the new sample buffer. */ RealizeLineOffset(State->SampleBuffer, &State->Delay); - for(index = 0;index < 4;index++) - { - RealizeLineOffset(State->SampleBuffer, &State->Mod.Delay[index]); + RealizeLineOffset(State->SampleBuffer, &State->Early.VecAp.Delay); + RealizeLineOffset(State->SampleBuffer, &State->Early.Delay); + RealizeLineOffset(State->SampleBuffer, &State->Late.VecAp.Delay); + RealizeLineOffset(State->SampleBuffer, &State->Late.Delay); - RealizeLineOffset(State->SampleBuffer, &State->Early.Delay[index]); - - RealizeLineOffset(State->SampleBuffer, &State->Late.Ap[index].Delay); - RealizeLineOffset(State->SampleBuffer, &State->Late.Delay[index]); - - RealizeLineOffset(State->SampleBuffer, &State->Echo.Delay[index].Ap); - RealizeLineOffset(State->SampleBuffer, &State->Echo.Delay[index].Feedback); - } - - // Clear the sample buffer. - for(index = 0;index < State->TotalSamples;index++) - State->SampleBuffer[index] = 0.0f; + /* Clear the sample buffer. */ + for(i = 0;i < State->TotalSamples;i++) + State->SampleBuffer[i] = 0.0f; return AL_TRUE; } static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Device) { - ALuint frequency = Device->Frequency, index; + ALuint frequency = Device->Frequency; + ALfloat multiplier; - // Allocate the delay lines. + /* Allocate the delay lines. */ if(!AllocLines(frequency, State)) return AL_FALSE; - // Calculate the modulation filter coefficient. Notice that the exponent - // is calculated given the current sample rate. This ensures that the - // resulting filter response over time is consistent across all sample - // rates. - State->Mod.Coeff = powf(MODULATION_FILTER_COEFF, - MODULATION_FILTER_CONST / frequency); + multiplier = CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY); - // The early reflection and late all-pass filter line lengths are static, - // so their offsets only need to be calculated once. - for(index = 0;index < 4;index++) - { - State->Early.Offset[index] = fastf2u(EARLY_LINE_LENGTH[index] * frequency); - State->Late.Ap[index].Offset = fastf2u(ALLPASS_LINE_LENGTH[index] * frequency); - } - - // The echo all-pass filter line length is static, so its offset only - // needs to be calculated once. - State->Echo.ApOffset = fastf2u(ECHO_ALLPASS_LENGTH * frequency); + /* The late feed taps are set a fixed position past the latest delay tap. */ + State->LateFeedTap = float2int((AL_EAXREVERB_MAX_REFLECTIONS_DELAY + + EARLY_TAP_LENGTHS[NUM_LINES-1]*multiplier) * + frequency); return AL_TRUE; } @@ -528,23 +576,26 @@ static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Dev * Effect Update * **************************************/ -// Calculate a decay coefficient given the length of each cycle and the time -// until the decay reaches -60 dB. -static inline ALfloat CalcDecayCoeff(ALfloat length, ALfloat decayTime) +/* Calculate a decay coefficient given the length of each cycle and the time + * until the decay reaches -60 dB. + */ +static inline ALfloat CalcDecayCoeff(const ALfloat length, const ALfloat decayTime) { - return powf(0.001f/*-60 dB*/, length/decayTime); + return powf(REVERB_DECAY_GAIN, length/decayTime); } -// Calculate a decay length from a coefficient and the time until the decay -// reaches -60 dB. -static inline ALfloat CalcDecayLength(ALfloat coeff, ALfloat decayTime) +/* Calculate a decay length from a coefficient and the time until the decay + * reaches -60 dB. + */ +static inline ALfloat CalcDecayLength(const ALfloat coeff, const ALfloat decayTime) { - return log10f(coeff) * decayTime / log10f(0.001f)/*-60 dB*/; + return log10f(coeff) * decayTime / log10f(REVERB_DECAY_GAIN); } -// Calculate an attenuation to be applied to the input of any echo models to -// compensate for modal density and decay time. -static inline ALfloat CalcDensityGain(ALfloat a) +/* Calculate an attenuation to be applied to the input of any echo models to + * compensate for modal density and decay time. + */ +static inline ALfloat CalcDensityGain(const ALfloat a) { /* The energy of a signal can be obtained by finding the area under the * squared signal. This takes the form of Sum(x_n^2), where x is the @@ -554,32 +605,34 @@ static inline ALfloat CalcDensityGain(ALfloat a) * where a is the attenuation coefficient, and n is the sample. The area * under this decay curve can be calculated as: 1 / (1 - a). * - * Modifying the above equation to find the squared area under the curve + * Modifying the above equation to find the area under the squared curve * (for energy) yields: 1 / (1 - a^2). Input attenuation can then be * calculated by inverting the square root of this approximation, * yielding: 1 / sqrt(1 / (1 - a^2)), simplified to: sqrt(1 - a^2). */ - return sqrtf(1.0f - (a * a)); + return sqrtf(1.0f - a*a); } -// Calculate the mixing matrix coefficients given a diffusion factor. -static inline ALvoid CalcMatrixCoeffs(ALfloat diffusion, ALfloat *x, ALfloat *y) +/* Calculate the scattering matrix coefficients given a diffusion factor. */ +static inline ALvoid CalcMatrixCoeffs(const ALfloat diffusion, ALfloat *x, ALfloat *y) { ALfloat n, t; - // The matrix is of order 4, so n is sqrt (4 - 1). + /* The matrix is of order 4, so n is sqrt(4 - 1). */ n = sqrtf(3.0f); t = diffusion * atanf(n); - // Calculate the first mixing matrix coefficient. + /* Calculate the first mixing matrix coefficient. */ *x = cosf(t); - // Calculate the second mixing matrix coefficient. + /* Calculate the second mixing matrix coefficient. */ *y = sinf(t) / n; } -// Calculate the limited HF ratio for use with the late reverb low-pass -// filters. -static ALfloat CalcLimitedHfRatio(ALfloat hfRatio, ALfloat airAbsorptionGainHF, ALfloat decayTime) +/* Calculate the limited HF ratio for use with the late reverb low-pass + * filters. + */ +static ALfloat CalcLimitedHfRatio(const ALfloat hfRatio, const ALfloat airAbsorptionGainHF, + const ALfloat decayTime, const ALfloat SpeedOfSound) { ALfloat limitRatio; @@ -588,420 +641,591 @@ static ALfloat CalcLimitedHfRatio(ALfloat hfRatio, ALfloat airAbsorptionGainHF, * equation, solve for HF ratio. The delay length is cancelled out of * the equation, so it can be calculated once for all lines. */ - limitRatio = 1.0f / (CalcDecayLength(airAbsorptionGainHF, decayTime) * - SPEEDOFSOUNDMETRESPERSEC); - /* Using the limit calculated above, apply the upper bound to the HF - * ratio. Also need to limit the result to a minimum of 0.1, just like the - * HF ratio parameter. */ - return clampf(limitRatio, 0.1f, hfRatio); + limitRatio = 1.0f / (CalcDecayLength(airAbsorptionGainHF, decayTime) * SpeedOfSound); + + /* Using the limit calculated above, apply the upper bound to the HF ratio. + */ + return minf(limitRatio, hfRatio); } -// Calculate the coefficient for a HF (and eventually LF) decay damping -// filter. -static inline ALfloat CalcDampingCoeff(ALfloat hfRatio, ALfloat length, ALfloat decayTime, ALfloat decayCoeff, ALfloat cw) +/* Calculates the first-order high-pass coefficients following the I3DL2 + * reference model. This is the transfer function: + * + * 1 - z^-1 + * H(z) = p ------------ + * 1 - p z^-1 + * + * And this is the I3DL2 coefficient calculation given gain (g) and reference + * angular frequency (w): + * + * g + * p = ------------------------------------------------------ + * g cos(w) + sqrt((cos(w) - 1) (g^2 cos(w) + g^2 - 2)) + * + * The coefficient is applied to the partial differential filter equation as: + * + * c_0 = p + * c_1 = -p + * c_2 = p + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcHighpassCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) { - ALfloat coeff, g; + ALfloat g, g2, cw, p; - // Eventually this should boost the high frequencies when the ratio - // exceeds 1. - coeff = 0.0f; - if (hfRatio < 1.0f) + if(gain >= 1.0f) { - // Calculate the low-pass coefficient by dividing the HF decay - // coefficient by the full decay coefficient. - g = CalcDecayCoeff(length, decayTime * hfRatio) / decayCoeff; - - // Damping is done with a 1-pole filter, so g needs to be squared. - g *= g; - if(g < 0.9999f) /* 1-epsilon */ - { - /* Be careful with gains < 0.001, as that causes the coefficient - * head towards 1, which will flatten the signal. */ - g = maxf(g, 0.001f); - coeff = (1 - g*cw - sqrtf(2*g*(1-cw) - g*g*(1 - cw*cw))) / - (1 - g); - } - - // Very low decay times will produce minimal output, so apply an - // upper bound to the coefficient. - coeff = minf(coeff, 0.98f); + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; } - return coeff; + + g = maxf(0.001f, gain); + g2 = g * g; + cw = cosf(w); + p = g / (g*cw + sqrtf((cw - 1.0f) * (g2*cw + g2 - 2.0f))); + + coeffs[0] = p; + coeffs[1] = -p; + coeffs[2] = p; } -// Update the EAX modulation index, range, and depth. Keep in mind that this -// kind of vibrato is additive and not multiplicative as one may expect. The -// downswing will sound stronger than the upswing. -static ALvoid UpdateModulator(ALfloat modTime, ALfloat modDepth, ALuint frequency, ALreverbState *State) +/* Calculates the first-order low-pass coefficients following the I3DL2 + * reference model. This is the transfer function: + * + * (1 - a) z^0 + * H(z) = ---------------- + * 1 z^0 - a z^-1 + * + * And this is the I3DL2 coefficient calculation given gain (g) and reference + * angular frequency (w): + * + * 1 - g^2 cos(w) - sqrt(2 g^2 (1 - cos(w)) - g^4 (1 - cos(w)^2)) + * a = ---------------------------------------------------------------- + * 1 - g^2 + * + * The coefficient is applied to the partial differential filter equation as: + * + * c_0 = 1 - a + * c_1 = 0 + * c_2 = a + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcLowpassCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) { - ALuint range; + ALfloat g, g2, cw, a; - /* Modulation is calculated in two parts. - * - * The modulation time effects the sinus applied to the change in - * frequency. An index out of the current time range (both in samples) - * is incremented each sample. The range is bound to a reasonable - * minimum (1 sample) and when the timing changes, the index is rescaled - * to the new range (to keep the sinus consistent). - */ - range = maxu(fastf2u(modTime*frequency), 1); - State->Mod.Index = (ALuint)(State->Mod.Index * (ALuint64)range / - State->Mod.Range); - State->Mod.Range = range; + if(gain >= 1.0f) + { + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; + } - /* The modulation depth effects the amount of frequency change over the - * range of the sinus. It needs to be scaled by the modulation time so - * that a given depth produces a consistent change in frequency over all - * ranges of time. Since the depth is applied to a sinus value, it needs - * to be halfed once for the sinus range and again for the sinus swing - * in time (half of it is spent decreasing the frequency, half is spent - * increasing it). - */ - State->Mod.Depth = modDepth * MODULATION_DEPTH_COEFF * modTime / 2.0f / - 2.0f * frequency; + /* Be careful with gains < 0.001, as that causes the coefficient + * to head towards 1, which will flatten the signal. */ + g = maxf(0.001f, gain); + g2 = g * g; + cw = cosf(w); + a = (1.0f - g2*cw - sqrtf((2.0f*g2*(1.0f - cw)) - g2*g2*(1.0f - cw*cw))) / + (1.0f - g2); + + coeffs[0] = 1.0f - a; + coeffs[1] = 0.0f; + coeffs[2] = a; } -// Update the offsets for the main effect delay line. -static ALvoid UpdateDelayLine(ALfloat earlyDelay, ALfloat lateDelay, ALfloat density, ALuint frequency, ALreverbState *State) +/* Calculates the first-order low-shelf coefficients. The shelf filters are + * used in place of low/high-pass filters to preserve the mid-band. This is + * the transfer function: + * + * a_0 + a_1 z^-1 + * H(z) = ---------------- + * 1 + b_1 z^-1 + * + * And these are the coefficient calculations given cut gain (g) and a center + * angular frequency (w): + * + * sin(0.5 (pi - w) - 0.25 pi) + * p = ----------------------------- + * sin(0.5 (pi - w) + 0.25 pi) + * + * g + 1 g + 1 + * a = ------- + sqrt((-------)^2 - 1) + * g - 1 g - 1 + * + * 1 + g + (1 - g) a + * b_0 = ------------------- + * 2 + * + * 1 - g + (1 + g) a + * b_1 = ------------------- + * 2 + * + * The coefficients are applied to the partial differential filter equation + * as: + * + * b_0 + p b_1 + * c_0 = ------------- + * 1 + p a + * + * -(b_1 + p b_0) + * c_1 = ---------------- + * 1 + p a + * + * p + a + * c_2 = --------- + * 1 + p a + * + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcLowShelfCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) { - ALfloat length; + ALfloat g, rw, p, n; + ALfloat alpha, beta0, beta1; + + if(gain >= 1.0f) + { + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; + } + + g = maxf(0.001f, gain); + rw = F_PI - w; + p = sinf(0.5f*rw - 0.25f*F_PI) / sinf(0.5f*rw + 0.25f*F_PI); + n = (g + 1.0f) / (g - 1.0f); + alpha = n + sqrtf(n*n - 1.0f); + beta0 = (1.0f + g + (1.0f - g)*alpha) / 2.0f; + beta1 = (1.0f - g + (1.0f + g)*alpha) / 2.0f; + + coeffs[0] = (beta0 + p*beta1) / (1.0f + p*alpha); + coeffs[1] = -(beta1 + p*beta0) / (1.0f + p*alpha); + coeffs[2] = (p + alpha) / (1.0f + p*alpha); +} + +/* Calculates the first-order high-shelf coefficients. The shelf filters are + * used in place of low/high-pass filters to preserve the mid-band. This is + * the transfer function: + * + * a_0 + a_1 z^-1 + * H(z) = ---------------- + * 1 + b_1 z^-1 + * + * And these are the coefficient calculations given cut gain (g) and a center + * angular frequency (w): + * + * sin(0.5 w - 0.25 pi) + * p = ---------------------- + * sin(0.5 w + 0.25 pi) + * + * g + 1 g + 1 + * a = ------- + sqrt((-------)^2 - 1) + * g - 1 g - 1 + * + * 1 + g + (1 - g) a + * b_0 = ------------------- + * 2 + * + * 1 - g + (1 + g) a + * b_1 = ------------------- + * 2 + * + * The coefficients are applied to the partial differential filter equation + * as: + * + * b_0 + p b_1 + * c_0 = ------------- + * 1 + p a + * + * b_1 + p b_0 + * c_1 = ------------- + * 1 + p a + * + * -(p + a) + * c_2 = ---------- + * 1 + p a + * + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcHighShelfCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) +{ + ALfloat g, p, n; + ALfloat alpha, beta0, beta1; + + if(gain >= 1.0f) + { + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; + } + + g = maxf(0.001f, gain); + p = sinf(0.5f*w - 0.25f*F_PI) / sinf(0.5f*w + 0.25f*F_PI); + n = (g + 1.0f) / (g - 1.0f); + alpha = n + sqrtf(n*n - 1.0f); + beta0 = (1.0f + g + (1.0f - g)*alpha) / 2.0f; + beta1 = (1.0f - g + (1.0f + g)*alpha) / 2.0f; + + coeffs[0] = (beta0 + p*beta1) / (1.0f + p*alpha); + coeffs[1] = (beta1 + p*beta0) / (1.0f + p*alpha); + coeffs[2] = -(p + alpha) / (1.0f + p*alpha); +} + +/* Calculates the 3-band T60 damping coefficients for a particular delay line + * of specified length using a combination of two low/high-pass/shelf or + * pass-through filter sections (producing 3 coefficients each) given decay + * times for each band split at two (LF/HF) reference frequencies (w). + */ +static void CalcT60DampingCoeffs(const ALfloat length, const ALfloat lfDecayTime, + const ALfloat mfDecayTime, const ALfloat hfDecayTime, + const ALfloat lfW, const ALfloat hfW, ALfloat lfcoeffs[3], + ALfloat hfcoeffs[3]) +{ + ALfloat lfGain = CalcDecayCoeff(length, lfDecayTime); + ALfloat mfGain = CalcDecayCoeff(length, mfDecayTime); + ALfloat hfGain = CalcDecayCoeff(length, hfDecayTime); + + if(lfGain <= mfGain) + { + CalcHighpassCoeffs(lfGain / mfGain, lfW, lfcoeffs); + if(mfGain >= hfGain) + { + CalcLowpassCoeffs(hfGain / mfGain, hfW, hfcoeffs); + hfcoeffs[0] *= mfGain; hfcoeffs[1] *= mfGain; + } + else + { + CalcLowShelfCoeffs(mfGain / hfGain, hfW, hfcoeffs); + hfcoeffs[0] *= hfGain; hfcoeffs[1] *= hfGain; + } + } + else + { + CalcHighShelfCoeffs(mfGain / lfGain, lfW, lfcoeffs); + if(mfGain >= hfGain) + { + CalcLowpassCoeffs(hfGain / mfGain, hfW, hfcoeffs); + hfcoeffs[0] *= lfGain; hfcoeffs[1] *= lfGain; + } + else + { + ALfloat hg = mfGain / lfGain; + ALfloat lg = mfGain / hfGain; + ALfloat mg = maxf(lfGain, hfGain) / maxf(hg, lg); + + CalcLowShelfCoeffs(lg, hfW, hfcoeffs); + hfcoeffs[0] *= mg; hfcoeffs[1] *= mg; + } + } +} + +/* Update the offsets for the main effect delay line. */ +static ALvoid UpdateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, const ALfloat density, const ALfloat decayTime, const ALuint frequency, ALreverbState *State) +{ + ALfloat multiplier, length; ALuint i; - /* The early reflections and late reverb inputs are decorrelated to provide - * time-varying reflections, smooth out the reverb tail, and reduce harsh - * echoes. The first tap occurs immediately, while the remaining taps are - * delayed by multiples of a fraction of the smallest cyclical delay time. - * - * offset[index] = (FRACTION (MULTIPLIER^(index-1))) smallest_delay - * - * for index = 1...max_lines - */ - State->EarlyDelayTap[0] = fastf2u(earlyDelay * frequency); - for(i = 1;i < 4;i++) - { - length = (DECO_FRACTION * powf(DECO_MULTIPLIER, (ALfloat)i-1.0f)) * - EARLY_LINE_LENGTH[0]; - State->EarlyDelayTap[i] = fastf2u(length * frequency) + State->EarlyDelayTap[0]; - } + multiplier = CalcDelayLengthMult(density); - State->LateDelayTap[0] = fastf2u((earlyDelay + lateDelay) * frequency); - for(i = 1;i < 4;i++) + /* Early reflection taps are decorrelated by means of an average room + * reflection approximation described above the definition of the taps. + * This approximation is linear and so the above density multiplier can + * be applied to adjust the width of the taps. A single-band decay + * coefficient is applied to simulate initial attenuation and absorption. + * + * Late reverb taps are based on the late line lengths to allow a zero- + * delay path and offsets that would continue the propagation naturally + * into the late lines. + */ + for(i = 0;i < NUM_LINES;i++) { - length = (DECO_FRACTION * powf(DECO_MULTIPLIER, (ALfloat)i-1.0f)) * - LATE_LINE_LENGTH[0] * (1.0f + (density * LATE_LINE_MULTIPLIER)); - State->LateDelayTap[i] = fastf2u(length * frequency) + State->LateDelayTap[0]; + length = earlyDelay + EARLY_TAP_LENGTHS[i]*multiplier; + State->EarlyDelayTap[i][1] = float2int(length * frequency); + + length = EARLY_TAP_LENGTHS[i]*multiplier; + State->EarlyDelayCoeff[i] = CalcDecayCoeff(length, decayTime); + + length = lateDelay + (LATE_LINE_LENGTHS[i] - LATE_LINE_LENGTHS[0])*0.25f*multiplier; + State->LateDelayTap[i][1] = State->LateFeedTap + float2int(length * frequency); } } -// Update the early reflections mix and line coefficients. -static ALvoid UpdateEarlyLines(ALfloat lateDelay, ALreverbState *State) +/* Update the early reflection line lengths and gain coefficients. */ +static ALvoid UpdateEarlyLines(const ALfloat density, const ALfloat decayTime, const ALuint frequency, EarlyReflections *Early) { - ALuint index; + ALfloat multiplier, length; + ALsizei i; - // Calculate the gain (coefficient) for each early delay line using the - // late delay time. This expands the early reflections to the start of - // the late reverb. - for(index = 0;index < 4;index++) - State->Early.Coeff[index] = CalcDecayCoeff(EARLY_LINE_LENGTH[index], - lateDelay); + multiplier = CalcDelayLengthMult(density); + + for(i = 0;i < NUM_LINES;i++) + { + /* Calculate the length (in seconds) of each all-pass line. */ + length = EARLY_ALLPASS_LENGTHS[i] * multiplier; + + /* Calculate the delay offset for each all-pass line. */ + Early->VecAp.Offset[i][1] = float2int(length * frequency); + + /* Calculate the length (in seconds) of each delay line. */ + length = EARLY_LINE_LENGTHS[i] * multiplier; + + /* Calculate the delay offset for each delay line. */ + Early->Offset[i][1] = float2int(length * frequency); + + /* Calculate the gain (coefficient) for each line. */ + Early->Coeff[i] = CalcDecayCoeff(length, decayTime); + } } -// Update the late reverb mix, line lengths, and line coefficients. -static ALvoid UpdateLateLines(ALfloat xMix, ALfloat density, ALfloat decayTime, ALfloat diffusion, ALfloat echoDepth, ALfloat hfRatio, ALfloat cw, ALuint frequency, ALreverbState *State) +/* Update the late reverb line lengths and T60 coefficients. */ +static ALvoid UpdateLateLines(const ALfloat density, const ALfloat diffusion, const ALfloat lfDecayTime, const ALfloat mfDecayTime, const ALfloat hfDecayTime, const ALfloat lfW, const ALfloat hfW, const ALfloat echoTime, const ALfloat echoDepth, const ALuint frequency, LateReverb *Late) { - ALfloat length; - ALuint index; - - /* Calculate the late reverb gain. Since the output is tapped prior to the - * application of the next delay line coefficients, this gain needs to be - * attenuated by the 'x' mixing matrix coefficient as well. Also attenuate - * the late reverb when echo depth is high and diffusion is low, so the - * echo is slightly stronger than the decorrelated echos in the reverb - * tail. - */ - State->Late.Gain = xMix * (1.0f - (echoDepth*0.5f*(1.0f - diffusion))); + ALfloat multiplier, length, bandWeights[3]; + ALsizei i; /* To compensate for changes in modal density and decay time of the late * reverb signal, the input is attenuated based on the maximal energy of * the outgoing signal. This approximation is used to keep the apparent * energy of the signal equal for all ranges of density and decay time. * - * The average length of the cyclcical delay lines is used to calculate - * the attenuation coefficient. + * The average length of the delay lines is used to calculate the + * attenuation coefficient. */ - length = (LATE_LINE_LENGTH[0] + LATE_LINE_LENGTH[1] + - LATE_LINE_LENGTH[2] + LATE_LINE_LENGTH[3]) / 4.0f; - length *= 1.0f + (density * LATE_LINE_MULTIPLIER); - /* To account for each channel being a discrete input, also multiply by - * sqrt(num_channels). + multiplier = CalcDelayLengthMult(density); + length = (LATE_LINE_LENGTHS[0] + LATE_LINE_LENGTHS[1] + + LATE_LINE_LENGTHS[2] + LATE_LINE_LENGTHS[3]) / 4.0f * multiplier; + /* Include the echo transformation (see below). */ + length = lerp(length, echoTime, echoDepth); + length += (LATE_ALLPASS_LENGTHS[0] + LATE_ALLPASS_LENGTHS[1] + + LATE_ALLPASS_LENGTHS[2] + LATE_ALLPASS_LENGTHS[3]) / 4.0f * multiplier; + /* The density gain calculation uses an average decay time weighted by + * approximate bandwidth. This attempts to compensate for losses of + * energy that reduce decay time due to scattering into highly attenuated + * bands. */ - State->Late.DensityGain = 2.0f * CalcDensityGain( - CalcDecayCoeff(length, decayTime) + bandWeights[0] = lfW; + bandWeights[1] = hfW - lfW; + bandWeights[2] = F_TAU - hfW; + Late->DensityGain = CalcDensityGain( + CalcDecayCoeff(length, (bandWeights[0]*lfDecayTime + bandWeights[1]*mfDecayTime + + bandWeights[2]*hfDecayTime) / F_TAU) ); - // Calculate the all-pass feed-back and feed-forward coefficient. - State->Late.ApFeedCoeff = 0.5f * powf(diffusion, 2.0f); - - for(index = 0;index < 4;index++) + for(i = 0;i < NUM_LINES;i++) { - // Calculate the gain (coefficient) for each all-pass line. - State->Late.Ap[index].Coeff = CalcDecayCoeff( - ALLPASS_LINE_LENGTH[index], decayTime - ); + /* Calculate the length (in seconds) of each all-pass line. */ + length = LATE_ALLPASS_LENGTHS[i] * multiplier; - // Calculate the length (in seconds) of each cyclical delay line. - length = LATE_LINE_LENGTH[index] * - (1.0f + (density * LATE_LINE_MULTIPLIER)); + /* Calculate the delay offset for each all-pass line. */ + Late->VecAp.Offset[i][1] = float2int(length * frequency); - // Calculate the delay offset for each cyclical delay line. - State->Late.Offset[index] = fastf2u(length * frequency); + /* Calculate the length (in seconds) of each delay line. This also + * applies the echo transformation. As the EAX echo depth approaches + * 1, the line lengths approach a length equal to the echoTime. This + * helps to produce distinct echoes along the tail. + */ + length = lerp(LATE_LINE_LENGTHS[i] * multiplier, echoTime, echoDepth); - // Calculate the gain (coefficient) for each cyclical line. - State->Late.Coeff[index] = CalcDecayCoeff(length, decayTime); + /* Calculate the delay offset for each delay line. */ + Late->Offset[i][1] = float2int(length*frequency + 0.5f); - // Calculate the damping coefficient for each low-pass filter. - State->Late.Lp[index].Coeff = CalcDampingCoeff( - hfRatio, length, decayTime, State->Late.Coeff[index], cw - ); + /* Approximate the absorption that the vector all-pass would exhibit + * given the current diffusion so we don't have to process a full T60 + * filter for each of its four lines. + */ + length += lerp(LATE_ALLPASS_LENGTHS[i], + (LATE_ALLPASS_LENGTHS[0] + LATE_ALLPASS_LENGTHS[1] + + LATE_ALLPASS_LENGTHS[2] + LATE_ALLPASS_LENGTHS[3]) / 4.0f, + diffusion) * multiplier; - // Attenuate the cyclical line coefficients by the mixing coefficient - // (x). - State->Late.Coeff[index] *= xMix; + /* Calculate the T60 damping coefficients for each line. */ + CalcT60DampingCoeffs(length, lfDecayTime, mfDecayTime, hfDecayTime, + lfW, hfW, Late->T60[i].LFCoeffs, + Late->T60[i].HFCoeffs); } } -// Update the echo gain, line offset, line coefficients, and mixing -// coefficients. -static ALvoid UpdateEchoLine(ALfloat echoTime, ALfloat decayTime, ALfloat diffusion, ALfloat echoDepth, ALfloat hfRatio, ALfloat cw, ALuint frequency, ALreverbState *State) -{ - // Update the offset and coefficient for the echo delay line. - State->Echo.Offset = fastf2u(echoTime * frequency); - - // Calculate the decay coefficient for the echo line. - State->Echo.Coeff = CalcDecayCoeff(echoTime, decayTime); - - // Calculate the energy-based attenuation coefficient for the echo delay - // line. - State->Echo.DensityGain = CalcDensityGain(State->Echo.Coeff); - - // Calculate the echo all-pass feed coefficient. - State->Echo.ApFeedCoeff = 0.5f * powf(diffusion, 2.0f); - - // Calculate the echo all-pass attenuation coefficient. - State->Echo.ApCoeff = CalcDecayCoeff(ECHO_ALLPASS_LENGTH, decayTime); - - // Calculate the damping coefficient for each low-pass filter. - State->Echo.LpCoeff = CalcDampingCoeff(hfRatio, echoTime, decayTime, - State->Echo.Coeff, cw); - - /* Calculate the echo mixing coefficient. This is applied to the output mix - * only, not the feedback. - */ - State->Echo.MixCoeff = echoDepth; -} - -/* Creates a transform matrix given a reverb vector. This works by creating a - * Z-focus transform, then a rotate transform around X, then Y, to place the - * focal point in the direction of the vector, using the vector length as a - * focus strength. - * - * This isn't technically correct since the vector is supposed to define the - * aperture and not rotate the perceived soundfield, but in practice it's - * probably good enough. +/* Creates a transform matrix given a reverb vector. The vector pans the reverb + * reflections toward the given direction, using its magnitude (up to 1) as a + * focal strength. This function results in a B-Format transformation matrix + * that spatially focuses the signal in the desired direction. */ static aluMatrixf GetTransformFromVector(const ALfloat *vec) { - aluMatrixf zfocus, xrot, yrot; - aluMatrixf tmp1, tmp2; - ALfloat length; - ALfloat sa, a; + const ALfloat sqrt_3 = 1.732050808f; + aluMatrixf focus; + ALfloat norm[3]; + ALfloat mag; - length = sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); - - /* Define a Z-focus (X in Ambisonics) transform, given the panning vector - * length. + /* Normalize the panning vector according to the N3D scale, which has an + * extra sqrt(3) term on the directional components. Converting from OpenAL + * to B-Format also requires negating X (ACN 1) and Z (ACN 3). Note however + * that the reverb panning vectors use left-handed coordinates, unlike the + * rest of OpenAL which use right-handed. This is fixed by negating Z, + * which cancels out with the B-Format Z negation. */ - sa = sinf(minf(length, 1.0f) * (F_PI/4.0f)); - aluMatrixfSet(&zfocus, - 1.0f/(1.0f+sa), 0.0f, 0.0f, (sa/(1.0f+sa))/1.732050808f, - 0.0f, sqrtf((1.0f-sa)/(1.0f+sa)), 0.0f, 0.0f, - 0.0f, 0.0f, sqrtf((1.0f-sa)/(1.0f+sa)), 0.0f, - (sa/(1.0f+sa))*1.732050808f, 0.0f, 0.0f, 1.0f/(1.0f+sa) + mag = sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); + if(mag > 1.0f) + { + norm[0] = vec[0] / mag * -sqrt_3; + norm[1] = vec[1] / mag * sqrt_3; + norm[2] = vec[2] / mag * sqrt_3; + mag = 1.0f; + } + else + { + /* If the magnitude is less than or equal to 1, just apply the sqrt(3) + * term. There's no need to renormalize the magnitude since it would + * just be reapplied in the matrix. + */ + norm[0] = vec[0] * -sqrt_3; + norm[1] = vec[1] * sqrt_3; + norm[2] = vec[2] * sqrt_3; + } + + aluMatrixfSet(&focus, + 1.0f, 0.0f, 0.0f, 0.0f, + norm[0], 1.0f-mag, 0.0f, 0.0f, + norm[1], 0.0f, 1.0f-mag, 0.0f, + norm[2], 0.0f, 0.0f, 1.0f-mag ); - /* Define rotation around X (Y in Ambisonics) */ - a = atan2f(vec[1], sqrtf(vec[0]*vec[0] + vec[2]*vec[2])); - aluMatrixfSet(&xrot, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, cosf(a), sinf(a), - 0.0f, 0.0f, -sinf(a), cosf(a) - ); - - /* Define rotation around Y (Z in Ambisonics). NOTE: EFX's reverb vectors - * use a right-handled coordinate system, compared to the rest of OpenAL - * which uses left-handed. This is fixed by negating Z, however it would - * need to also be negated to get a proper Ambisonics angle, thus - * cancelling it out. - */ - a = atan2f(-vec[0], vec[2]); - aluMatrixfSet(&yrot, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, cosf(a), 0.0f, sinf(a), - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, -sinf(a), 0.0f, cosf(a) - ); - -#define MATRIX_MULT(_res, _m1, _m2) do { \ - int row, col; \ - for(col = 0;col < 4;col++) \ - { \ - for(row = 0;row < 4;row++) \ - _res.m[row][col] = _m1.m[row][0]*_m2.m[0][col] + _m1.m[row][1]*_m2.m[1][col] + \ - _m1.m[row][2]*_m2.m[2][col] + _m1.m[row][3]*_m2.m[3][col]; \ - } \ -} while(0) - /* Define a matrix that first focuses on Z, then rotates around X then Y to - * focus the output in the direction of the vector. - */ - MATRIX_MULT(tmp1, xrot, zfocus); - MATRIX_MULT(tmp2, yrot, tmp1); -#undef MATRIX_MULT - - return tmp2; + return focus; } -// Update the early and late 3D panning gains. -static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, ALfloat Gain, ALfloat EarlyGain, ALfloat LateGain, ALreverbState *State) +/* Update the early and late 3D panning gains. */ +static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, const ALfloat gain, const ALfloat earlyGain, const ALfloat lateGain, ALreverbState *State) { - /* Converts early reflections A-Format to B-Format (transposed). */ - static const aluMatrixf EarlyA2B = {{ - { 0.8660254038f, 0.8660254038f, 0.8660254038f, 0.8660254038f }, - { 0.8660254038f, 0.8660254038f, -0.8660254038f, -0.8660254038f }, - { 0.8660254038f, -0.8660254038f, 0.8660254038f, -0.8660254038f }, - { 0.8660254038f, -0.8660254038f, -0.8660254038f, 0.8660254038f } - }}; - /* Converts late reverb A-Format to B-Format (transposed). */ - static const aluMatrixf LateA2B = {{ - { 0.8660254038f, -0.8660254038f, 0.8660254038f, 0.8660254038f }, - { 0.8660254038f, -0.8660254038f, -0.8660254038f, -0.8660254038f }, - { 0.8660254038f, 0.8660254038f, 0.8660254038f, -0.8660254038f }, - { 0.8660254038f, 0.8660254038f, -0.8660254038f, 0.8660254038f } -/* { 0.8660254038f, 1.2247448714f, 0.0f, 0.8660254038f }, - { 0.8660254038f, 0.0f, -1.2247448714f, -0.8660254038f }, - { 0.8660254038f, 0.0f, 1.2247448714f, -0.8660254038f }, - { 0.8660254038f, -1.2247448714f, 0.0f, 0.8660254038f }*/ - }}; aluMatrixf transform, rot; - ALuint i; + ALsizei i; STATIC_CAST(ALeffectState,State)->OutBuffer = Device->FOAOut.Buffer; STATIC_CAST(ALeffectState,State)->OutChannels = Device->FOAOut.NumChannels; - /* Note: Both _m2 and _res are transposed. */ -#define MATRIX_MULT(_res, _m1, _m2) do { \ - int row, col; \ - for(col = 0;col < 4;col++) \ - { \ - for(row = 0;row < 4;row++) \ - _res.m[col][row] = _m1.m[row][0]*_m2.m[col][0] + _m1.m[row][1]*_m2.m[col][1] + \ - _m1.m[row][2]*_m2.m[col][2] + _m1.m[row][3]*_m2.m[col][3]; \ - } \ + /* Note: _res is transposed. */ +#define MATRIX_MULT(_res, _m1, _m2) do { \ + int row, col; \ + for(col = 0;col < 4;col++) \ + { \ + for(row = 0;row < 4;row++) \ + _res.m[col][row] = _m1.m[row][0]*_m2.m[0][col] + _m1.m[row][1]*_m2.m[1][col] + \ + _m1.m[row][2]*_m2.m[2][col] + _m1.m[row][3]*_m2.m[3][col]; \ + } \ } while(0) - /* Create a matrix that first converts A-Format to B-Format, then rotates - * the B-Format soundfield according to the panning vector. + /* Create a matrix that first converts A-Format to B-Format, then + * transforms the B-Format signal according to the panning vector. */ rot = GetTransformFromVector(ReflectionsPan); - MATRIX_MULT(transform, rot, EarlyA2B); + MATRIX_MULT(transform, rot, A2B); memset(&State->Early.PanGain, 0, sizeof(State->Early.PanGain)); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(Device->FOAOut, transform.m[i], Gain*EarlyGain, State->Early.PanGain[i]); + ComputeFirstOrderGains(&Device->FOAOut, transform.m[i], gain*earlyGain, + State->Early.PanGain[i]); rot = GetTransformFromVector(LateReverbPan); - MATRIX_MULT(transform, rot, LateA2B); + MATRIX_MULT(transform, rot, A2B); memset(&State->Late.PanGain, 0, sizeof(State->Late.PanGain)); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(Device->FOAOut, transform.m[i], Gain*LateGain, State->Late.PanGain[i]); + ComputeFirstOrderGains(&Device->FOAOut, transform.m[i], gain*lateGain, + State->Late.PanGain[i]); #undef MATRIX_MULT } -static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props) { + const ALCdevice *Device = Context->Device; + const ALlistener *Listener = Context->Listener; ALuint frequency = Device->Frequency; - ALfloat lfscale, hfscale, hfRatio; + ALfloat lf0norm, hf0norm, hfRatio; + ALfloat lfDecayTime, hfDecayTime; ALfloat gain, gainlf, gainhf; - ALfloat cw, x, y; - ALuint i; + ALsizei i; - if(Slot->Params.EffectType == AL_EFFECT_EAXREVERB && !EmulateEAXReverb) - State->IsEax = AL_TRUE; - else if(Slot->Params.EffectType == AL_EFFECT_REVERB || EmulateEAXReverb) - State->IsEax = AL_FALSE; - - // Calculate the master filters - hfscale = props->Reverb.HFReference / frequency; - gainhf = maxf(props->Reverb.GainHF, 0.0001f); - ALfilterState_setParams(&State->Filter[0].Lp, ALfilterType_HighShelf, - gainhf, hfscale, calc_rcpQ_from_slope(gainhf, 0.75f)); - lfscale = props->Reverb.LFReference / frequency; - gainlf = maxf(props->Reverb.GainLF, 0.0001f); - ALfilterState_setParams(&State->Filter[0].Hp, ALfilterType_LowShelf, - gainlf, lfscale, calc_rcpQ_from_slope(gainlf, 0.75f)); - for(i = 1;i < 4;i++) + /* Calculate the master filters */ + hf0norm = props->Reverb.HFReference / frequency; + /* Restrict the filter gains from going below -60dB to keep the filter from + * killing most of the signal. + */ + gainhf = maxf(props->Reverb.GainHF, 0.001f); + BiquadFilter_setParams(&State->Filter[0].Lp, BiquadType_HighShelf, gainhf, hf0norm, + calc_rcpQ_from_slope(gainhf, 1.0f)); + lf0norm = props->Reverb.LFReference / frequency; + gainlf = maxf(props->Reverb.GainLF, 0.001f); + BiquadFilter_setParams(&State->Filter[0].Hp, BiquadType_LowShelf, gainlf, lf0norm, + calc_rcpQ_from_slope(gainlf, 1.0f)); + for(i = 1;i < NUM_LINES;i++) { - State->Filter[i].Lp.a1 = State->Filter[0].Lp.a1; - State->Filter[i].Lp.a2 = State->Filter[0].Lp.a2; - State->Filter[i].Lp.b0 = State->Filter[0].Lp.b0; - State->Filter[i].Lp.b1 = State->Filter[0].Lp.b1; - State->Filter[i].Lp.b2 = State->Filter[0].Lp.b2; - - State->Filter[i].Hp.a1 = State->Filter[0].Hp.a1; - State->Filter[i].Hp.a2 = State->Filter[0].Hp.a2; - State->Filter[i].Hp.b0 = State->Filter[0].Hp.b0; - State->Filter[i].Hp.b1 = State->Filter[0].Hp.b1; - State->Filter[i].Hp.b2 = State->Filter[0].Hp.b2; + BiquadFilter_copyParams(&State->Filter[i].Lp, &State->Filter[0].Lp); + BiquadFilter_copyParams(&State->Filter[i].Hp, &State->Filter[0].Hp); } - // Update the modulator line. - UpdateModulator(props->Reverb.ModulationTime, props->Reverb.ModulationDepth, - frequency, State); - - // Update the main effect delay. + /* Update the main effect delay and associated taps. */ UpdateDelayLine(props->Reverb.ReflectionsDelay, props->Reverb.LateReverbDelay, - props->Reverb.Density, frequency, State); + props->Reverb.Density, props->Reverb.DecayTime, frequency, + State); - // Update the early lines. - UpdateEarlyLines(props->Reverb.LateReverbDelay, State); + /* Calculate the all-pass feed-back/forward coefficient. */ + State->ApFeedCoeff = sqrtf(0.5f) * powf(props->Reverb.Diffusion, 2.0f); - // Get the mixing matrix coefficients (x and y). - CalcMatrixCoeffs(props->Reverb.Diffusion, &x, &y); - // Then divide x into y to simplify the matrix calculation. - State->Late.MixCoeff = y / x; + /* Update the early lines. */ + UpdateEarlyLines(props->Reverb.Density, props->Reverb.DecayTime, + frequency, &State->Early); - // If the HF limit parameter is flagged, calculate an appropriate limit - // based on the air absorption parameter. + /* Get the mixing matrix coefficients. */ + CalcMatrixCoeffs(props->Reverb.Diffusion, &State->MixX, &State->MixY); + + /* If the HF limit parameter is flagged, calculate an appropriate limit + * based on the air absorption parameter. + */ hfRatio = props->Reverb.DecayHFRatio; if(props->Reverb.DecayHFLimit && props->Reverb.AirAbsorptionGainHF < 1.0f) hfRatio = CalcLimitedHfRatio(hfRatio, props->Reverb.AirAbsorptionGainHF, - props->Reverb.DecayTime); + props->Reverb.DecayTime, Listener->Params.ReverbSpeedOfSound + ); - cw = cosf(F_TAU * hfscale); - // Update the late lines. - UpdateLateLines(x, props->Reverb.Density, props->Reverb.DecayTime, - props->Reverb.Diffusion, props->Reverb.EchoDepth, - hfRatio, cw, frequency, State); + /* Calculate the LF/HF decay times. */ + lfDecayTime = clampf(props->Reverb.DecayTime * props->Reverb.DecayLFRatio, + AL_EAXREVERB_MIN_DECAY_TIME, AL_EAXREVERB_MAX_DECAY_TIME); + hfDecayTime = clampf(props->Reverb.DecayTime * hfRatio, + AL_EAXREVERB_MIN_DECAY_TIME, AL_EAXREVERB_MAX_DECAY_TIME); - // Update the echo line. - UpdateEchoLine(props->Reverb.EchoTime, props->Reverb.DecayTime, - props->Reverb.Diffusion, props->Reverb.EchoDepth, - hfRatio, cw, frequency, State); + /* Update the late lines. */ + UpdateLateLines(props->Reverb.Density, props->Reverb.Diffusion, + lfDecayTime, props->Reverb.DecayTime, hfDecayTime, + F_TAU * lf0norm, F_TAU * hf0norm, + props->Reverb.EchoTime, props->Reverb.EchoDepth, + frequency, &State->Late); + /* Update early and late 3D panning. */ gain = props->Reverb.Gain * Slot->Params.Gain * ReverbBoost; - // Update early and late 3D panning. Update3DPanning(Device, props->Reverb.ReflectionsPan, props->Reverb.LateReverbPan, gain, props->Reverb.ReflectionsGain, props->Reverb.LateReverbGain, State); + + /* Determine if delay-line cross-fading is required. */ + for(i = 0;i < NUM_LINES;i++) + { + if(State->EarlyDelayTap[i][1] != State->EarlyDelayTap[i][0] || + State->Early.VecAp.Offset[i][1] != State->Early.VecAp.Offset[i][0] || + State->Early.Offset[i][1] != State->Early.Offset[i][0] || + State->LateDelayTap[i][1] != State->LateDelayTap[i][0] || + State->Late.VecAp.Offset[i][1] != State->Late.VecAp.Offset[i][0] || + State->Late.Offset[i][1] != State->Late.Offset[i][0]) + { + State->FadeCount = 0; + break; + } + } } @@ -1009,415 +1233,373 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device * Effect Processing * **************************************/ -// Basic delay line input/output routines. -static inline ALfloat DelayLineOut(DelayLine *Delay, ALuint offset) +/* Basic delay line input/output routines. */ +static inline ALfloat DelayLineOut(const DelayLineI *Delay, const ALsizei offset, const ALsizei c) { - return Delay->Line[offset&Delay->Mask]; + return Delay->Line[offset&Delay->Mask][c]; } -static inline ALvoid DelayLineIn(DelayLine *Delay, ALuint offset, ALfloat in) -{ - Delay->Line[offset&Delay->Mask] = in; -} - -static inline ALfloat DelayLineInOut(DelayLine *Delay, ALuint offset, ALuint outoffset, ALfloat in) -{ - Delay->Line[offset&Delay->Mask] = in; - return Delay->Line[(offset-outoffset)&Delay->Mask]; -} - -static void CalcModulationDelays(ALreverbState *State, ALfloat *restrict delays, ALuint todo) -{ - ALfloat sinus, range; - ALuint index, i; - - index = State->Mod.Index; - range = State->Mod.Filter; - for(i = 0;i < todo;i++) - { - /* Calculate the sinus rythm (dependent on modulation time and the - * sampling rate). The center of the sinus is moved to reduce the - * delay of the effect when the time or depth are low. - */ - sinus = 1.0f - cosf(F_TAU * index / State->Mod.Range); - - /* Step the modulation index forward, keeping it bound to its range. */ - index = (index+1) % State->Mod.Range; - - /* The depth determines the range over which to read the input samples - * from, so it must be filtered to reduce the distortion caused by even - * small parameter changes. - */ - range = lerp(range, State->Mod.Depth, State->Mod.Coeff); - - /* Calculate the read offset with fraction. */ - delays[i] = range*sinus; - } - State->Mod.Index = index; - State->Mod.Filter = range; -} - -// Given some input samples, this function produces modulation for the late -// reverb. -static void EAXModulation(DelayLine *ModDelay, ALuint offset, const ALfloat *restrict delays, ALfloat*restrict dst, const ALfloat*restrict src, ALuint todo) -{ - ALfloat frac, fdelay; - ALfloat out0, out1; - ALuint delay, i; - - for(i = 0;i < todo;i++) - { - /* Separate the integer offset and fraction between it and the next - * sample. - */ - frac = modff(delays[i], &fdelay); - delay = fastf2u(fdelay); - - /* Add the incoming sample to the delay line, and get the two samples - * crossed by the offset delay. - */ - out0 = DelayLineInOut(ModDelay, offset, delay, src[i]); - out1 = DelayLineOut(ModDelay, offset - delay - 1); - offset++; - - /* The output is obtained by linearly interpolating the two samples - * that were acquired above. - */ - dst[i] = lerp(out0, out1, frac); - } -} - -/* Given some input samples from the main delay line, this function produces - * four-channel outputs for the early reflections. +/* Cross-faded delay line output routine. Instead of interpolating the + * offsets, this interpolates (cross-fades) the outputs at each offset. */ -static ALvoid EarlyReflection(ALreverbState *State, ALuint todo, ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) +static inline ALfloat FadedDelayLineOut(const DelayLineI *Delay, const ALsizei off0, + const ALsizei off1, const ALsizei c, const ALfloat mu) { - ALfloat d[4], v, f[4]; - ALuint i; + return Delay->Line[off0&Delay->Mask][c]*(1.0f-mu) + + Delay->Line[off1&Delay->Mask][c]*( mu); +} +#define UnfadedDelayLineOut(d, o0, o1, c, mu) DelayLineOut(d, o0, c) - for(i = 0;i < todo;i++) - { - ALuint offset = State->Offset+i; - - /* Obtain the first reflection samples from the main delay line. */ - f[0] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[0])*4 + 0); - f[1] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[1])*4 + 1); - f[2] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[2])*4 + 2); - f[3] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[3])*4 + 3); - - /* The following uses a lossless scattering junction from waveguide - * theory. It actually amounts to a householder mixing matrix, which - * will produce a maximally diffuse response, and means this can - * probably be considered a simple feed-back delay network (FDN). - * N - * --- - * \ - * v = 2/N / d_i - * --- - * i=1 - */ - v = (f[0] + f[1] + f[2] + f[3]) * 0.5f; - - /* Calculate the feed values for the early delay lines. */ - d[0] = v - f[0]; - d[1] = v - f[1]; - d[2] = v - f[2]; - d[3] = v - f[3]; - - /* Feed the early delay lines, and load the delayed results. */ - d[0] = DelayLineInOut(&State->Early.Delay[0], offset, State->Early.Offset[0], d[0]); - d[1] = DelayLineInOut(&State->Early.Delay[1], offset, State->Early.Offset[1], d[1]); - d[2] = DelayLineInOut(&State->Early.Delay[2], offset, State->Early.Offset[2], d[2]); - d[3] = DelayLineInOut(&State->Early.Delay[3], offset, State->Early.Offset[3], d[3]); - - /* Output the initial reflection taps and the results of the delayed - * and decayed junction for all four channels. - */ - out[0][i] = f[0] + d[0]*State->Early.Coeff[0]; - out[1][i] = f[1] + d[1]*State->Early.Coeff[1]; - out[2][i] = f[2] + d[2]*State->Early.Coeff[2]; - out[3][i] = f[3] + d[3]*State->Early.Coeff[3]; - } +static inline ALvoid DelayLineIn(DelayLineI *Delay, ALsizei offset, const ALsizei c, + const ALfloat *restrict in, ALsizei count) +{ + ALsizei i; + for(i = 0;i < count;i++) + Delay->Line[(offset++)&Delay->Mask][c] = *(in++); } -// Basic attenuated all-pass input/output routine. -static inline ALfloat AllpassInOut(DelayLine *Delay, ALuint outOffset, ALuint inOffset, ALfloat in, ALfloat feedCoeff, ALfloat coeff) +static inline ALvoid DelayLineIn4(DelayLineI *Delay, ALsizei offset, const ALfloat in[NUM_LINES]) { - ALfloat out, feed; - - out = DelayLineOut(Delay, outOffset); - feed = feedCoeff * in; - DelayLineIn(Delay, inOffset, (feedCoeff * (out - feed)) + in); - - // The time-based attenuation is only applied to the delay output to - // keep it from affecting the feed-back path (which is already controlled - // by the all-pass feed coefficient). - return (coeff * out) - feed; + ALsizei i; + offset &= Delay->Mask; + for(i = 0;i < NUM_LINES;i++) + Delay->Line[offset][i] = in[i]; } -// All-pass input/output routine for late reverb. -static inline ALfloat LateAllPassInOut(ALreverbState *State, ALuint offset, ALuint index, ALfloat in) +static inline ALvoid DelayLineIn4Rev(DelayLineI *Delay, ALsizei offset, const ALfloat in[NUM_LINES]) { - return AllpassInOut(&State->Late.Ap[index].Delay, - offset - State->Late.Ap[index].Offset, - offset, in, State->Late.ApFeedCoeff, - State->Late.Ap[index].Coeff); + ALsizei i; + offset &= Delay->Mask; + for(i = 0;i < NUM_LINES;i++) + Delay->Line[offset][i] = in[NUM_LINES-1-i]; } -// Low-pass filter input/output routine for late reverb. -static inline ALfloat LateLowPassInOut(ALreverbState *State, ALuint index, ALfloat in) +/* Applies a scattering matrix to the 4-line (vector) input. This is used + * for both the below vector all-pass model and to perform modal feed-back + * delay network (FDN) mixing. + * + * The matrix is derived from a skew-symmetric matrix to form a 4D rotation + * matrix with a single unitary rotational parameter: + * + * [ d, a, b, c ] 1 = a^2 + b^2 + c^2 + d^2 + * [ -a, d, c, -b ] + * [ -b, -c, d, a ] + * [ -c, b, -a, d ] + * + * The rotation is constructed from the effect's diffusion parameter, + * yielding: + * + * 1 = x^2 + 3 y^2 + * + * Where a, b, and c are the coefficient y with differing signs, and d is the + * coefficient x. The final matrix is thus: + * + * [ x, y, -y, y ] n = sqrt(matrix_order - 1) + * [ -y, x, y, y ] t = diffusion_parameter * atan(n) + * [ y, -y, x, y ] x = cos(t) + * [ -y, -y, -y, x ] y = sin(t) / n + * + * Any square orthogonal matrix with an order that is a power of two will + * work (where ^T is transpose, ^-1 is inverse): + * + * M^T = M^-1 + * + * Using that knowledge, finding an appropriate matrix can be accomplished + * naively by searching all combinations of: + * + * M = D + S - S^T + * + * Where D is a diagonal matrix (of x), and S is a triangular matrix (of y) + * whose combination of signs are being iterated. + */ +static inline void VectorPartialScatter(ALfloat *restrict out, const ALfloat *restrict in, + const ALfloat xCoeff, const ALfloat yCoeff) { - in = lerp(in, State->Late.Lp[index].Sample, State->Late.Lp[index].Coeff); - State->Late.Lp[index].Sample = in; - return in; + out[0] = xCoeff*in[0] + yCoeff*( in[1] + -in[2] + in[3]); + out[1] = xCoeff*in[1] + yCoeff*(-in[0] + in[2] + in[3]); + out[2] = xCoeff*in[2] + yCoeff*( in[0] + -in[1] + in[3]); + out[3] = xCoeff*in[3] + yCoeff*(-in[0] + -in[1] + -in[2] ); } -// Given four decorrelated input samples, this function produces four-channel -// output for the late reverb. -static ALvoid LateReverb(ALreverbState *State, ALuint todo, ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) +/* Same as above, but reverses the input. */ +static inline void VectorPartialScatterRev(ALfloat *restrict out, const ALfloat *restrict in, + const ALfloat xCoeff, const ALfloat yCoeff) { - ALfloat d[4], f[4]; - ALuint offset; - ALuint base, i; - - offset = State->Offset; - for(base = 0;base < todo;) - { - ALfloat tmp[MAX_UPDATE_SAMPLES/4][4]; - ALuint tmp_todo = minu(todo, MAX_UPDATE_SAMPLES/4); - - for(i = 0;i < tmp_todo;i++) - { - /* Obtain four decorrelated input samples. */ - f[0] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[0])*4 + 0) * State->Late.DensityGain; - f[1] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[1])*4 + 1) * State->Late.DensityGain; - f[2] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[2])*4 + 2) * State->Late.DensityGain; - f[3] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[3])*4 + 3) * State->Late.DensityGain; - - /* Add the decayed results of the cyclical delay lines, then pass - * the results through the low-pass filters. - */ - f[0] += DelayLineOut(&State->Late.Delay[0], offset-State->Late.Offset[0]) * State->Late.Coeff[0]; - f[1] += DelayLineOut(&State->Late.Delay[1], offset-State->Late.Offset[1]) * State->Late.Coeff[1]; - f[2] += DelayLineOut(&State->Late.Delay[2], offset-State->Late.Offset[2]) * State->Late.Coeff[2]; - f[3] += DelayLineOut(&State->Late.Delay[3], offset-State->Late.Offset[3]) * State->Late.Coeff[3]; - - /* This is where the feed-back cycles from line 0 to 3 to 1 to 2 - * and back to 0. - */ - d[0] = LateLowPassInOut(State, 2, f[2]); - d[1] = LateLowPassInOut(State, 3, f[3]); - d[2] = LateLowPassInOut(State, 1, f[1]); - d[3] = LateLowPassInOut(State, 0, f[0]); - - /* To help increase diffusion, run each line through an all-pass - * filter. When there is no diffusion, the shortest all-pass filter - * will feed the shortest delay line. - */ - d[0] = LateAllPassInOut(State, offset, 0, d[0]); - d[1] = LateAllPassInOut(State, offset, 1, d[1]); - d[2] = LateAllPassInOut(State, offset, 2, d[2]); - d[3] = LateAllPassInOut(State, offset, 3, d[3]); - - /* Late reverb is done with a modified feed-back delay network (FDN) - * topology. Four input lines are each fed through their own all-pass - * filter and then into the mixing matrix. The four outputs of the - * mixing matrix are then cycled back to the inputs. Each output feeds - * a different input to form a circlular feed cycle. - * - * The mixing matrix used is a 4D skew-symmetric rotation matrix - * derived using a single unitary rotational parameter: - * - * [ d, a, b, c ] 1 = a^2 + b^2 + c^2 + d^2 - * [ -a, d, c, -b ] - * [ -b, -c, d, a ] - * [ -c, b, -a, d ] - * - * The rotation is constructed from the effect's diffusion parameter, - * yielding: 1 = x^2 + 3 y^2; where a, b, and c are the coefficient y - * with differing signs, and d is the coefficient x. The matrix is - * thus: - * - * [ x, y, -y, y ] n = sqrt(matrix_order - 1) - * [ -y, x, y, y ] t = diffusion_parameter * atan(n) - * [ y, -y, x, y ] x = cos(t) - * [ -y, -y, -y, x ] y = sin(t) / n - * - * To reduce the number of multiplies, the x coefficient is applied - * with the cyclical delay line coefficients. Thus only the y - * coefficient is applied when mixing, and is modified to be: y / x. - */ - f[0] = d[0] + (State->Late.MixCoeff * ( d[1] + -d[2] + d[3])); - f[1] = d[1] + (State->Late.MixCoeff * (-d[0] + d[2] + d[3])); - f[2] = d[2] + (State->Late.MixCoeff * ( d[0] + -d[1] + d[3])); - f[3] = d[3] + (State->Late.MixCoeff * (-d[0] + -d[1] + -d[2] )); - - /* Re-feed the cyclical delay lines. */ - DelayLineIn(&State->Late.Delay[0], offset, f[0]); - DelayLineIn(&State->Late.Delay[1], offset, f[1]); - DelayLineIn(&State->Late.Delay[2], offset, f[2]); - DelayLineIn(&State->Late.Delay[3], offset, f[3]); - offset++; - - /* Output the results of the matrix for all four channels, - * attenuated by the late reverb gain (which is attenuated by the - * 'x' mix coefficient). - */ - tmp[i][0] = State->Late.Gain * f[0]; - tmp[i][1] = State->Late.Gain * f[1]; - tmp[i][2] = State->Late.Gain * f[2]; - tmp[i][3] = State->Late.Gain * f[3]; - } - - /* Deinterlace to output */ - for(i = 0;i < tmp_todo;i++) out[0][base+i] = tmp[i][0]; - for(i = 0;i < tmp_todo;i++) out[1][base+i] = tmp[i][1]; - for(i = 0;i < tmp_todo;i++) out[2][base+i] = tmp[i][2]; - for(i = 0;i < tmp_todo;i++) out[3][base+i] = tmp[i][3]; - - base += tmp_todo; - } + out[0] = xCoeff*in[3] + yCoeff*(in[0] + -in[1] + in[2] ); + out[1] = xCoeff*in[2] + yCoeff*(in[0] + in[1] + -in[3]); + out[2] = xCoeff*in[1] + yCoeff*(in[0] + -in[2] + in[3]); + out[3] = xCoeff*in[0] + yCoeff*( -in[1] + -in[2] + -in[3]); } -// Given an input sample, this function mixes echo into the four-channel late -// reverb. -static ALvoid EAXEcho(ALreverbState *State, ALuint todo, ALfloat (*restrict late)[MAX_UPDATE_SAMPLES]) +/* This applies a Gerzon multiple-in/multiple-out (MIMO) vector all-pass + * filter to the 4-line input. + * + * It works by vectorizing a regular all-pass filter and replacing the delay + * element with a scattering matrix (like the one above) and a diagonal + * matrix of delay elements. + * + * Two static specializations are used for transitional (cross-faded) delay + * line processing and non-transitional processing. + */ +#define DECL_TEMPLATE(T) \ +static void VectorAllpass_##T(ALfloat *restrict out, \ + const ALfloat *restrict in, \ + const ALsizei offset, const ALfloat feedCoeff, \ + const ALfloat xCoeff, const ALfloat yCoeff, \ + const ALfloat mu, VecAllpass *Vap) \ +{ \ + ALfloat f[NUM_LINES], fs[NUM_LINES]; \ + ALfloat input; \ + ALsizei i; \ + \ + (void)mu; /* Ignore for Unfaded. */ \ + \ + for(i = 0;i < NUM_LINES;i++) \ + { \ + input = in[i]; \ + out[i] = T##DelayLineOut(&Vap->Delay, offset-Vap->Offset[i][0], \ + offset-Vap->Offset[i][1], i, mu) - \ + feedCoeff*input; \ + f[i] = input + feedCoeff*out[i]; \ + } \ + VectorPartialScatter(fs, f, xCoeff, yCoeff); \ + \ + DelayLineIn4(&Vap->Delay, offset, fs); \ +} +DECL_TEMPLATE(Unfaded) +DECL_TEMPLATE(Faded) +#undef DECL_TEMPLATE + +/* This generates early reflections. + * + * This is done by obtaining the primary reflections (those arriving from the + * same direction as the source) from the main delay line. These are + * attenuated and all-pass filtered (based on the diffusion parameter). + * + * The early lines are then fed in reverse (according to the approximately + * opposite spatial location of the A-Format lines) to create the secondary + * reflections (those arriving from the opposite direction as the source). + * + * The early response is then completed by combining the primary reflections + * with the delayed and attenuated output from the early lines. + * + * Finally, the early response is reversed, scattered (based on diffusion), + * and fed into the late reverb section of the main delay line. + * + * Two static specializations are used for transitional (cross-faded) delay + * line processing and non-transitional processing. + */ +#define DECL_TEMPLATE(T) \ +static void EarlyReflection_##T(ALreverbState *State, const ALsizei todo, \ + ALfloat fade, \ + ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) \ +{ \ + ALsizei offset = State->Offset; \ + const ALfloat apFeedCoeff = State->ApFeedCoeff; \ + const ALfloat mixX = State->MixX; \ + const ALfloat mixY = State->MixY; \ + ALfloat f[NUM_LINES], fr[NUM_LINES]; \ + ALsizei i, j; \ + \ + for(i = 0;i < todo;i++) \ + { \ + for(j = 0;j < NUM_LINES;j++) \ + fr[j] = T##DelayLineOut(&State->Delay, \ + offset-State->EarlyDelayTap[j][0], \ + offset-State->EarlyDelayTap[j][1], j, fade \ + ) * State->EarlyDelayCoeff[j]; \ + \ + VectorAllpass_##T(f, fr, offset, apFeedCoeff, mixX, mixY, fade, \ + &State->Early.VecAp); \ + \ + DelayLineIn4Rev(&State->Early.Delay, offset, f); \ + \ + for(j = 0;j < NUM_LINES;j++) \ + f[j] += T##DelayLineOut(&State->Early.Delay, \ + offset-State->Early.Offset[j][0], \ + offset-State->Early.Offset[j][1], j, fade \ + ) * State->Early.Coeff[j]; \ + \ + for(j = 0;j < NUM_LINES;j++) \ + out[j][i] = f[j]; \ + \ + VectorPartialScatterRev(fr, f, mixX, mixY); \ + \ + DelayLineIn4(&State->Delay, offset-State->LateFeedTap, fr); \ + \ + offset++; \ + fade += FadeStep; \ + } \ +} +DECL_TEMPLATE(Unfaded) +DECL_TEMPLATE(Faded) +#undef DECL_TEMPLATE + +/* Applies a first order filter section. */ +static inline ALfloat FirstOrderFilter(const ALfloat in, const ALfloat *restrict coeffs, + ALfloat *restrict state) { - ALfloat feed; - ALuint offset; - ALuint c, i; - - for(c = 0;c < 4;c++) - { - offset = State->Offset; - for(i = 0;i < todo;i++) - { - // Get the latest attenuated echo sample for output. - feed = DelayLineOut(&State->Echo.Delay[c].Feedback, offset-State->Echo.Offset) * - State->Echo.Coeff; - - // Write the output. - late[c][i] += State->Echo.MixCoeff * feed; - - // Mix the energy-attenuated input with the output and pass it through - // the echo low-pass filter. - feed += DelayLineOut(&State->Delay, (offset-State->LateDelayTap[0])*4 + c) * - State->Echo.DensityGain; - feed = lerp(feed, State->Echo.LpSample[c], State->Echo.LpCoeff); - State->Echo.LpSample[c] = feed; - - // Then the echo all-pass filter. - feed = AllpassInOut(&State->Echo.Delay[c].Ap, offset-State->Echo.ApOffset, - offset, feed, State->Echo.ApFeedCoeff, - State->Echo.ApCoeff); - - // Feed the delay with the mixed and filtered sample. - DelayLineIn(&State->Echo.Delay[c].Feedback, offset, feed); - offset++; - } - } + ALfloat out = coeffs[0]*in + *state; + *state = coeffs[1]*in + coeffs[2]*out; + return out; } -// Perform the non-EAX reverb pass on a given input sample, resulting in -// four-channel output. -static ALvoid VerbPass(ALreverbState *State, ALuint todo, ALfloat (*restrict input)[MAX_UPDATE_SAMPLES], ALfloat (*restrict early)[MAX_UPDATE_SAMPLES], ALfloat (*restrict late)[MAX_UPDATE_SAMPLES]) +/* Applies the two T60 damping filter sections. */ +static inline void LateT60Filter(ALfloat *restrict out, const ALfloat *restrict in, + T60Filter *filter) { - ALuint i, c; - - for(c = 0;c < 4;c++) - { - /* Low-pass filter the incoming samples (use the early buffer as temp - * storage). - */ - ALfilterState_process(&State->Filter[c].Lp, &early[0][0], input[c], todo); - for(i = 0;i < todo;i++) - DelayLineIn(&State->Delay, (State->Offset+i)*4 + c, early[0][i]); - } - - // Calculate the early reflection from the first delay tap. - EarlyReflection(State, todo, early); - - // Calculate the late reverb from the decorrelator taps. - LateReverb(State, todo, late); - - // Step all delays forward one sample. - State->Offset += todo; + ALsizei i; + for(i = 0;i < NUM_LINES;i++) + out[i] = FirstOrderFilter( + FirstOrderFilter(in[i], filter[i].HFCoeffs, &filter[i].HFState), + filter[i].LFCoeffs, &filter[i].LFState + ); } -// Perform the EAX reverb pass on a given input sample, resulting in four- -// channel output. -static ALvoid EAXVerbPass(ALreverbState *State, ALuint todo, ALfloat (*restrict input)[MAX_UPDATE_SAMPLES], ALfloat (*restrict early)[MAX_UPDATE_SAMPLES], ALfloat (*restrict late)[MAX_UPDATE_SAMPLES]) -{ - ALuint i, c; - - /* Perform any modulation on the input (use the early and late buffers as - * temp storage). - */ - CalcModulationDelays(State, &late[0][0], todo); - for(c = 0;c < 4;c++) - { - EAXModulation(&State->Mod.Delay[c], State->Offset, &late[0][0], - &early[0][0], input[c], todo); - - /* Band-pass the incoming samples */ - ALfilterState_process(&State->Filter[c].Lp, &early[1][0], &early[0][0], todo); - ALfilterState_process(&State->Filter[c].Hp, &early[2][0], &early[1][0], todo); - - /* Feed the initial delay line. */ - for(i = 0;i < todo;i++) - DelayLineIn(&State->Delay, (State->Offset+i)*4 + c, early[2][i]); - } - - // Calculate the early reflection from the first delay tap. - EarlyReflection(State, todo, early); - - // Calculate the late reverb from the decorrelator taps. - LateReverb(State, todo, late); - - // Calculate and mix in any echo. - EAXEcho(State, todo, late); - - // Step all delays forward. - State->Offset += todo; +/* This generates the reverb tail using a modified feed-back delay network + * (FDN). + * + * Results from the early reflections are attenuated by the density gain and + * mixed with the output from the late delay lines. + * + * The late response is then completed by T60 and all-pass filtering the mix. + * + * Finally, the lines are reversed (so they feed their opposite directions) + * and scattered with the FDN matrix before re-feeding the delay lines. + * + * Two variations are made, one for for transitional (cross-faded) delay line + * processing and one for non-transitional processing. + */ +#define DECL_TEMPLATE(T) \ +static void LateReverb_##T(ALreverbState *State, const ALsizei todo, \ + ALfloat fade, \ + ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) \ +{ \ + const ALfloat apFeedCoeff = State->ApFeedCoeff; \ + const ALfloat mixX = State->MixX; \ + const ALfloat mixY = State->MixY; \ + ALsizei offset; \ + ALsizei i, j; \ + \ + offset = State->Offset; \ + for(i = 0;i < todo;i++) \ + { \ + ALfloat f[NUM_LINES], fr[NUM_LINES]; \ + \ + for(j = 0;j < NUM_LINES;j++) \ + f[j] = T##DelayLineOut(&State->Delay, \ + offset - State->LateDelayTap[j][0], \ + offset - State->LateDelayTap[j][1], j, fade \ + ) * State->Late.DensityGain; \ + \ + for(j = 0;j < NUM_LINES;j++) \ + f[j] += T##DelayLineOut(&State->Late.Delay, \ + offset - State->Late.Offset[j][0], \ + offset - State->Late.Offset[j][1], j, fade \ + ); \ + \ + LateT60Filter(fr, f, State->Late.T60); \ + VectorAllpass_##T(f, fr, offset, apFeedCoeff, mixX, mixY, fade, \ + &State->Late.VecAp); \ + \ + for(j = 0;j < NUM_LINES;j++) \ + out[j][i] = f[j]; \ + \ + VectorPartialScatterRev(fr, f, mixX, mixY); \ + \ + DelayLineIn4(&State->Late.Delay, offset, fr); \ + \ + offset++; \ + fade += FadeStep; \ + } \ } +DECL_TEMPLATE(Unfaded) +DECL_TEMPLATE(Faded) +#undef DECL_TEMPLATE - -static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - static const aluMatrixf B2A = {{ - { 0.288675134595f, 0.288675134595f, 0.288675134595f, 0.288675134595f }, - { 0.288675134595f, 0.288675134595f, -0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, 0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, -0.288675134595f, 0.288675134595f } - }}; ALfloat (*restrict afmt)[MAX_UPDATE_SAMPLES] = State->AFormatSamples; ALfloat (*restrict early)[MAX_UPDATE_SAMPLES] = State->EarlySamples; ALfloat (*restrict late)[MAX_UPDATE_SAMPLES] = State->ReverbSamples; - ALuint base, c; + ALsizei fadeCount = State->FadeCount; + ALfloat fade = (ALfloat)fadeCount / FADE_SAMPLES; + ALsizei base, c; /* Process reverb for these samples. */ for(base = 0;base < SamplesToDo;) { - ALuint todo = minu(SamplesToDo-base, MAX_UPDATE_SAMPLES); + ALsizei todo = mini(SamplesToDo-base, MAX_UPDATE_SAMPLES); + /* If cross-fading, don't do more samples than there are to fade. */ + if(FADE_SAMPLES-fadeCount > 0) + todo = mini(todo, FADE_SAMPLES-fadeCount); - /* Convert B-Foramt to A-Format for processing. */ - memset(afmt, 0, sizeof(*afmt)*4); - for(c = 0;c < 4;c++) + /* Convert B-Format to A-Format for processing. */ + memset(afmt, 0, sizeof(*afmt)*NUM_LINES); + for(c = 0;c < NUM_LINES;c++) MixRowSamples(afmt[c], B2A.m[c], SamplesIn, MAX_EFFECT_CHANNELS, base, todo ); - VerbPass(State, todo, afmt, early, late); + /* Process the samples for reverb. */ + for(c = 0;c < NUM_LINES;c++) + { + /* Band-pass the incoming samples. Use the early output lines for + * temp storage. + */ + BiquadFilter_process(&State->Filter[c].Lp, early[0], afmt[c], todo); + BiquadFilter_process(&State->Filter[c].Hp, early[1], early[0], todo); + + /* Feed the initial delay line. */ + DelayLineIn(&State->Delay, State->Offset, c, early[1], todo); + } + + if(UNLIKELY(fadeCount < FADE_SAMPLES)) + { + /* Generate early reflections. */ + EarlyReflection_Faded(State, todo, fade, early); + + /* Generate late reverb. */ + LateReverb_Faded(State, todo, fade, late); + fade = minf(1.0f, fade + todo*FadeStep); + } + else + { + /* Generate early reflections. */ + EarlyReflection_Unfaded(State, todo, fade, early); + + /* Generate late reverb. */ + LateReverb_Unfaded(State, todo, fade, late); + } + + /* Step all delays forward. */ + State->Offset += todo; + + if(UNLIKELY(fadeCount < FADE_SAMPLES) && (fadeCount += todo) >= FADE_SAMPLES) + { + /* Update the cross-fading delay line taps. */ + fadeCount = FADE_SAMPLES; + fade = 1.0f; + for(c = 0;c < NUM_LINES;c++) + { + State->EarlyDelayTap[c][0] = State->EarlyDelayTap[c][1]; + State->Early.VecAp.Offset[c][0] = State->Early.VecAp.Offset[c][1]; + State->Early.Offset[c][0] = State->Early.Offset[c][1]; + State->LateDelayTap[c][0] = State->LateDelayTap[c][1]; + State->Late.VecAp.Offset[c][0] = State->Late.VecAp.Offset[c][1]; + State->Late.Offset[c][0] = State->Late.Offset[c][1]; + } + } /* Mix the A-Format results to output, implicitly converting back to * B-Format. */ - for(c = 0;c < 4;c++) + for(c = 0;c < NUM_LINES;c++) MixSamples(early[c], NumChannels, SamplesOut, State->Early.CurrentGain[c], State->Early.PanGain[c], SamplesToDo-base, base, todo ); - for(c = 0;c < 4;c++) + for(c = 0;c < NUM_LINES;c++) MixSamples(late[c], NumChannels, SamplesOut, State->Late.CurrentGain[c], State->Late.PanGain[c], SamplesToDo-base, base, todo @@ -1425,81 +1607,31 @@ static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint Samples base += todo; } -} - -static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) -{ - static const aluMatrixf B2A = {{ - { 0.288675134595f, 0.288675134595f, 0.288675134595f, 0.288675134595f }, - { 0.288675134595f, 0.288675134595f, -0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, 0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, -0.288675134595f, 0.288675134595f } - }}; - ALfloat (*restrict afmt)[MAX_UPDATE_SAMPLES] = State->AFormatSamples; - ALfloat (*restrict early)[MAX_UPDATE_SAMPLES] = State->EarlySamples; - ALfloat (*restrict late)[MAX_UPDATE_SAMPLES] = State->ReverbSamples; - ALuint base, c; - - /* Process reverb for these samples. */ - for(base = 0;base < SamplesToDo;) - { - ALuint todo = minu(SamplesToDo-base, MAX_UPDATE_SAMPLES); - - memset(afmt, 0, 4*MAX_UPDATE_SAMPLES*sizeof(float)); - for(c = 0;c < 4;c++) - MixRowSamples(afmt[c], B2A.m[c], - SamplesIn, MAX_EFFECT_CHANNELS, base, todo - ); - - EAXVerbPass(State, todo, afmt, early, late); - - for(c = 0;c < 4;c++) - MixSamples(early[c], NumChannels, SamplesOut, - State->Early.CurrentGain[c], State->Early.PanGain[c], - SamplesToDo-base, base, todo - ); - for(c = 0;c < 4;c++) - MixSamples(late[c], NumChannels, SamplesOut, - State->Late.CurrentGain[c], State->Late.PanGain[c], - SamplesToDo-base, base, todo - ); - - base += todo; - } -} - -static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) -{ - if(State->IsEax) - ALreverbState_processEax(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels); - else - ALreverbState_processStandard(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels); + State->FadeCount = fadeCount; } -typedef struct ALreverbStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALreverbStateFactory; +typedef struct ReverbStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} ReverbStateFactory; -static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(factory)) +static ALeffectState *ReverbStateFactory_create(ReverbStateFactory* UNUSED(factory)) { ALreverbState *state; - alcall_once(&mixfunc_inited, init_mixfunc); - NEW_OBJ0(state, ALreverbState)(); if(!state) return NULL; return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALreverbStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(ReverbStateFactory); -ALeffectStateFactory *ALreverbStateFactory_getFactory(void) +EffectStateFactory *ReverbStateFactory_getFactory(void) { - static ALreverbStateFactory ReverbFactory = { { GET_VTABLE2(ALreverbStateFactory, ALeffectStateFactory) } }; + static ReverbStateFactory ReverbFactory = { { GET_VTABLE2(ReverbStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &ReverbFactory); + return STATIC_CAST(EffectStateFactory, &ReverbFactory); } @@ -1510,18 +1642,17 @@ void ALeaxreverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EAXREVERB_DECAY_HFLIMIT: if(!(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay hflimit out of range"); props->Reverb.DecayHFLimit = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x", + param); } } void ALeaxreverb_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALeaxreverb_setParami(effect, context, param, vals[0]); -} +{ ALeaxreverb_setParami(effect, context, param, vals[0]); } void ALeaxreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -1529,126 +1660,127 @@ void ALeaxreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EAXREVERB_DENSITY: if(!(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb density out of range"); props->Reverb.Density = val; break; case AL_EAXREVERB_DIFFUSION: if(!(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb diffusion out of range"); props->Reverb.Diffusion = val; break; case AL_EAXREVERB_GAIN: if(!(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb gain out of range"); props->Reverb.Gain = val; break; case AL_EAXREVERB_GAINHF: if(!(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb gainhf out of range"); props->Reverb.GainHF = val; break; case AL_EAXREVERB_GAINLF: if(!(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb gainlf out of range"); props->Reverb.GainLF = val; break; case AL_EAXREVERB_DECAY_TIME: if(!(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay time out of range"); props->Reverb.DecayTime = val; break; case AL_EAXREVERB_DECAY_HFRATIO: if(!(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay hfratio out of range"); props->Reverb.DecayHFRatio = val; break; case AL_EAXREVERB_DECAY_LFRATIO: if(!(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay lfratio out of range"); props->Reverb.DecayLFRatio = val; break; case AL_EAXREVERB_REFLECTIONS_GAIN: if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb reflections gain out of range"); props->Reverb.ReflectionsGain = val; break; case AL_EAXREVERB_REFLECTIONS_DELAY: if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb reflections delay out of range"); props->Reverb.ReflectionsDelay = val; break; case AL_EAXREVERB_LATE_REVERB_GAIN: if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb late reverb gain out of range"); props->Reverb.LateReverbGain = val; break; case AL_EAXREVERB_LATE_REVERB_DELAY: if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb late reverb delay out of range"); props->Reverb.LateReverbDelay = val; break; case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: if(!(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb air absorption gainhf out of range"); props->Reverb.AirAbsorptionGainHF = val; break; case AL_EAXREVERB_ECHO_TIME: if(!(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb echo time out of range"); props->Reverb.EchoTime = val; break; case AL_EAXREVERB_ECHO_DEPTH: if(!(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb echo depth out of range"); props->Reverb.EchoDepth = val; break; case AL_EAXREVERB_MODULATION_TIME: if(!(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb modulation time out of range"); props->Reverb.ModulationTime = val; break; case AL_EAXREVERB_MODULATION_DEPTH: if(!(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb modulation depth out of range"); props->Reverb.ModulationDepth = val; break; case AL_EAXREVERB_HFREFERENCE: if(!(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb hfreference out of range"); props->Reverb.HFReference = val; break; case AL_EAXREVERB_LFREFERENCE: if(!(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb lfreference out of range"); props->Reverb.LFReference = val; break; case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: if(!(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb room rolloff factor out of range"); props->Reverb.RoomRolloffFactor = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", + param); } } void ALeaxreverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) @@ -1658,14 +1790,14 @@ void ALeaxreverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EAXREVERB_REFLECTIONS_PAN: if(!(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb reflections pan out of range"); props->Reverb.ReflectionsPan[0] = vals[0]; props->Reverb.ReflectionsPan[1] = vals[1]; props->Reverb.ReflectionsPan[2] = vals[2]; break; case AL_EAXREVERB_LATE_REVERB_PAN: if(!(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb late reverb pan out of range"); props->Reverb.LateReverbPan[0] = vals[0]; props->Reverb.LateReverbPan[1] = vals[1]; props->Reverb.LateReverbPan[2] = vals[2]; @@ -1687,13 +1819,12 @@ void ALeaxreverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x", + param); } } void ALeaxreverb_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALeaxreverb_getParami(effect, context, param, vals); -} +{ ALeaxreverb_getParami(effect, context, param, vals); } void ALeaxreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -1780,7 +1911,8 @@ void ALeaxreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", + param); } } void ALeaxreverb_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) @@ -1814,18 +1946,16 @@ void ALreverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi { case AL_REVERB_DECAY_HFLIMIT: if(!(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb decay hflimit out of range"); props->Reverb.DecayHFLimit = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } void ALreverb_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALreverb_setParami(effect, context, param, vals[0]); -} +{ ALreverb_setParami(effect, context, param, vals[0]); } void ALreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -1833,84 +1963,82 @@ void ALreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf { case AL_REVERB_DENSITY: if(!(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb density out of range"); props->Reverb.Density = val; break; case AL_REVERB_DIFFUSION: if(!(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb diffusion out of range"); props->Reverb.Diffusion = val; break; case AL_REVERB_GAIN: if(!(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb gain out of range"); props->Reverb.Gain = val; break; case AL_REVERB_GAINHF: if(!(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb gainhf out of range"); props->Reverb.GainHF = val; break; case AL_REVERB_DECAY_TIME: if(!(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb decay time out of range"); props->Reverb.DecayTime = val; break; case AL_REVERB_DECAY_HFRATIO: if(!(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb decay hfratio out of range"); props->Reverb.DecayHFRatio = val; break; case AL_REVERB_REFLECTIONS_GAIN: if(!(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb reflections gain out of range"); props->Reverb.ReflectionsGain = val; break; case AL_REVERB_REFLECTIONS_DELAY: if(!(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb reflections delay out of range"); props->Reverb.ReflectionsDelay = val; break; case AL_REVERB_LATE_REVERB_GAIN: if(!(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb late reverb gain out of range"); props->Reverb.LateReverbGain = val; break; case AL_REVERB_LATE_REVERB_DELAY: if(!(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb late reverb delay out of range"); props->Reverb.LateReverbDelay = val; break; case AL_REVERB_AIR_ABSORPTION_GAINHF: if(!(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb air absorption gainhf out of range"); props->Reverb.AirAbsorptionGainHF = val; break; case AL_REVERB_ROOM_ROLLOFF_FACTOR: if(!(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb room rolloff factor out of range"); props->Reverb.RoomRolloffFactor = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } void ALreverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALreverb_setParamf(effect, context, param, vals[0]); -} +{ ALreverb_setParamf(effect, context, param, vals[0]); } void ALreverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -1922,13 +2050,11 @@ void ALreverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } void ALreverb_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALreverb_getParami(effect, context, param, vals); -} +{ ALreverb_getParami(effect, context, param, vals); } void ALreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -1983,12 +2109,10 @@ void ALreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } void ALreverb_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALreverb_getParamf(effect, context, param, vals); -} +{ ALreverb_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALreverb); diff --git a/Engine/lib/openal-soft/Alc/filters/defs.h b/Engine/lib/openal-soft/Alc/filters/defs.h new file mode 100644 index 000000000..133a85ebd --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/defs.h @@ -0,0 +1,112 @@ +#ifndef ALC_FILTER_H +#define ALC_FILTER_H + +#include "AL/al.h" +#include "math_defs.h" + +/* Filters implementation is based on the "Cookbook formulae for audio + * EQ biquad filter coefficients" by Robert Bristow-Johnson + * http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt + */ +/* Implementation note: For the shelf filters, the specified gain is for the + * reference frequency, which is the centerpoint of the transition band. This + * better matches EFX filter design. To set the gain for the shelf itself, use + * the square root of the desired linear gain (or halve the dB gain). + */ + +typedef enum BiquadType { + /** EFX-style low-pass filter, specifying a gain and reference frequency. */ + BiquadType_HighShelf, + /** EFX-style high-pass filter, specifying a gain and reference frequency. */ + BiquadType_LowShelf, + /** Peaking filter, specifying a gain and reference frequency. */ + BiquadType_Peaking, + + /** Low-pass cut-off filter, specifying a cut-off frequency. */ + BiquadType_LowPass, + /** High-pass cut-off filter, specifying a cut-off frequency. */ + BiquadType_HighPass, + /** Band-pass filter, specifying a center frequency. */ + BiquadType_BandPass, +} BiquadType; + +typedef struct BiquadFilter { + ALfloat z1, z2; /* Last two delayed components for direct form II. */ + ALfloat b0, b1, b2; /* Transfer function coefficients "b" (numerator) */ + ALfloat a1, a2; /* Transfer function coefficients "a" (denominator; a0 is + * pre-applied). */ +} BiquadFilter; +/* Currently only a C-based filter process method is implemented. */ +#define BiquadFilter_process BiquadFilter_processC + +/** + * Calculates the rcpQ (i.e. 1/Q) coefficient for shelving filters, using the + * reference gain and shelf slope parameter. + * \param gain 0 < gain + * \param slope 0 < slope <= 1 + */ +inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope) +{ + return sqrtf((gain + 1.0f/gain)*(1.0f/slope - 1.0f) + 2.0f); +} +/** + * Calculates the rcpQ (i.e. 1/Q) coefficient for filters, using the normalized + * reference frequency and bandwidth. + * \param f0norm 0 < f0norm < 0.5. + * \param bandwidth 0 < bandwidth + */ +inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth) +{ + ALfloat w0 = F_TAU * f0norm; + return 2.0f*sinhf(logf(2.0f)/2.0f*bandwidth*w0/sinf(w0)); +} + +inline void BiquadFilter_clear(BiquadFilter *filter) +{ + filter->z1 = 0.0f; + filter->z2 = 0.0f; +} + +/** + * Sets up the filter state for the specified filter type and its parameters. + * + * \param filter The filter object to prepare. + * \param type The type of filter for the object to apply. + * \param gain The gain for the reference frequency response. Only used by the + * Shelf and Peaking filter types. + * \param f0norm The normalized reference frequency (ref_freq / sample_rate). + * This is the center point for the Shelf, Peaking, and BandPass + * filter types, or the cutoff frequency for the LowPass and + * HighPass filter types. + * \param rcpQ The reciprocal of the Q coefficient for the filter's transition + * band. Can be generated from calc_rcpQ_from_slope or + * calc_rcpQ_from_bandwidth depending on the available data. + */ +void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ); + +inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilter *restrict src) +{ + dst->b0 = src->b0; + dst->b1 = src->b1; + dst->b2 = src->b2; + dst->a1 = src->a1; + dst->a2 = src->a2; +} + +void BiquadFilter_processC(BiquadFilter *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples); + +inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples) +{ + if(LIKELY(numsamples >= 2)) + { + filter->z1 = 0.0f; + filter->z2 = 0.0f; + } + else if(numsamples == 1) + { + filter->z1 = filter->z2; + filter->z2 = 0.0f; + } +} + +#endif /* ALC_FILTER_H */ diff --git a/Engine/lib/openal-soft/Alc/filters/filter.c b/Engine/lib/openal-soft/Alc/filters/filter.c new file mode 100644 index 000000000..2b370f89d --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/filter.c @@ -0,0 +1,129 @@ + +#include "config.h" + +#include "AL/alc.h" +#include "AL/al.h" + +#include "alMain.h" +#include "defs.h" + +extern inline void BiquadFilter_clear(BiquadFilter *filter); +extern inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilter *restrict src); +extern inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples); +extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope); +extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth); + + +void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ) +{ + ALfloat alpha, sqrtgain_alpha_2; + ALfloat w0, sin_w0, cos_w0; + ALfloat a[3] = { 1.0f, 0.0f, 0.0f }; + ALfloat b[3] = { 1.0f, 0.0f, 0.0f }; + + // Limit gain to -100dB + assert(gain > 0.00001f); + + w0 = F_TAU * f0norm; + sin_w0 = sinf(w0); + cos_w0 = cosf(w0); + alpha = sin_w0/2.0f * rcpQ; + + /* Calculate filter coefficients depending on filter type */ + switch(type) + { + case BiquadType_HighShelf: + sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; + b[0] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); + b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cos_w0 ); + b[2] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); + a[0] = (gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; + a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cos_w0 ); + a[2] = (gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; + break; + case BiquadType_LowShelf: + sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; + b[0] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); + b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cos_w0 ); + b[2] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); + a[0] = (gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; + a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cos_w0 ); + a[2] = (gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; + break; + case BiquadType_Peaking: + gain = sqrtf(gain); + b[0] = 1.0f + alpha * gain; + b[1] = -2.0f * cos_w0; + b[2] = 1.0f - alpha * gain; + a[0] = 1.0f + alpha / gain; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha / gain; + break; + + case BiquadType_LowPass: + b[0] = (1.0f - cos_w0) / 2.0f; + b[1] = 1.0f - cos_w0; + b[2] = (1.0f - cos_w0) / 2.0f; + a[0] = 1.0f + alpha; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha; + break; + case BiquadType_HighPass: + b[0] = (1.0f + cos_w0) / 2.0f; + b[1] = -(1.0f + cos_w0); + b[2] = (1.0f + cos_w0) / 2.0f; + a[0] = 1.0f + alpha; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha; + break; + case BiquadType_BandPass: + b[0] = alpha; + b[1] = 0; + b[2] = -alpha; + a[0] = 1.0f + alpha; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha; + break; + } + + filter->a1 = a[1] / a[0]; + filter->a2 = a[2] / a[0]; + filter->b0 = b[0] / a[0]; + filter->b1 = b[1] / a[0]; + filter->b2 = b[2] / a[0]; +} + + +void BiquadFilter_processC(BiquadFilter *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples) +{ + const ALfloat a1 = filter->a1; + const ALfloat a2 = filter->a2; + const ALfloat b0 = filter->b0; + const ALfloat b1 = filter->b1; + const ALfloat b2 = filter->b2; + ALfloat z1 = filter->z1; + ALfloat z2 = filter->z2; + ALsizei i; + + ASSUME(numsamples > 0); + + /* Processing loop is Transposed Direct Form II. This requires less storage + * compared to Direct Form I (only two delay components, instead of a four- + * sample history; the last two inputs and outputs), and works better for + * floating-point which favors summing similarly-sized values while being + * less bothered by overflow. + * + * See: http://www.earlevel.com/main/2003/02/28/biquads/ + */ + for(i = 0;i < numsamples;i++) + { + ALfloat input = src[i]; + ALfloat output = input*b0 + z1; + z1 = input*b1 - output*a1 + z2; + z2 = input*b2 - output*a2; + dst[i] = output; + } + + filter->z1 = z1; + filter->z2 = z2; +} diff --git a/Engine/lib/openal-soft/Alc/filters/nfc.c b/Engine/lib/openal-soft/Alc/filters/nfc.c new file mode 100644 index 000000000..8869d1d00 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/nfc.c @@ -0,0 +1,426 @@ + +#include "config.h" + +#include "nfc.h" +#include "alMain.h" + +#include + + +/* Near-field control filters are the basis for handling the near-field effect. + * The near-field effect is a bass-boost present in the directional components + * of a recorded signal, created as a result of the wavefront curvature (itself + * a function of sound distance). Proper reproduction dictates this be + * compensated for using a bass-cut given the playback speaker distance, to + * avoid excessive bass in the playback. + * + * For real-time rendered audio, emulating the near-field effect based on the + * sound source's distance, and subsequently compensating for it at output + * based on the speaker distances, can create a more realistic perception of + * sound distance beyond a simple 1/r attenuation. + * + * These filters do just that. Each one applies a low-shelf filter, created as + * the combination of a bass-boost for a given sound source distance (near- + * field emulation) along with a bass-cut for a given control/speaker distance + * (near-field compensation). + * + * Note that it is necessary to apply a cut along with the boost, since the + * boost alone is unstable in higher-order ambisonics as it causes an infinite + * DC gain (even first-order ambisonics requires there to be no DC offset for + * the boost to work). Consequently, ambisonics requires a control parameter to + * be used to avoid an unstable boost-only filter. NFC-HOA defines this control + * as a reference delay, calculated with: + * + * reference_delay = control_distance / speed_of_sound + * + * This means w0 (for input) or w1 (for output) should be set to: + * + * wN = 1 / (reference_delay * sample_rate) + * + * when dealing with NFC-HOA content. For FOA input content, which does not + * specify a reference_delay variable, w0 should be set to 0 to apply only + * near-field compensation for output. It's important that w1 be a finite, + * positive, non-0 value or else the bass-boost will become unstable again. + * Also, w0 should not be too large compared to w1, to avoid excessively loud + * low frequencies. + */ + +static const float B[4][3] = { + { 0.0f }, + { 1.0f }, + { 3.0f, 3.0f }, + { 3.6778f, 6.4595f, 2.3222f }, + /*{ 4.2076f, 11.4877f, 5.7924f, 9.1401f }*/ +}; + +static void NfcFilterCreate1(struct NfcFilter1 *nfc, const float w0, const float w1) +{ + float b_00, g_0; + float r; + + nfc->base_gain = 1.0f; + nfc->gain = 1.0f; + + /* Calculate bass-boost coefficients. */ + r = 0.5f * w0; + b_00 = B[1][0] * r; + g_0 = 1.0f + b_00; + + nfc->gain *= g_0; + nfc->b1 = 2.0f * b_00 / g_0; + + /* Calculate bass-cut coefficients. */ + r = 0.5f * w1; + b_00 = B[1][0] * r; + g_0 = 1.0f + b_00; + + nfc->base_gain /= g_0; + nfc->gain /= g_0; + nfc->a1 = 2.0f * b_00 / g_0; +} + +static void NfcFilterAdjust1(struct NfcFilter1 *nfc, const float w0) +{ + float b_00, g_0; + float r; + + r = 0.5f * w0; + b_00 = B[1][0] * r; + g_0 = 1.0f + b_00; + + nfc->gain = nfc->base_gain * g_0; + nfc->b1 = 2.0f * b_00 / g_0; +} + + +static void NfcFilterCreate2(struct NfcFilter2 *nfc, const float w0, const float w1) +{ + float b_10, b_11, g_1; + float r; + + nfc->base_gain = 1.0f; + nfc->gain = 1.0f; + + /* Calculate bass-boost coefficients. */ + r = 0.5f * w0; + b_10 = B[2][0] * r; + b_11 = B[2][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain *= g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; + + /* Calculate bass-cut coefficients. */ + r = 0.5f * w1; + b_10 = B[2][0] * r; + b_11 = B[2][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->base_gain /= g_1; + nfc->gain /= g_1; + nfc->a1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->a2 = 4.0f * b_11 / g_1; +} + +static void NfcFilterAdjust2(struct NfcFilter2 *nfc, const float w0) +{ + float b_10, b_11, g_1; + float r; + + r = 0.5f * w0; + b_10 = B[2][0] * r; + b_11 = B[2][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain = nfc->base_gain * g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; +} + + +static void NfcFilterCreate3(struct NfcFilter3 *nfc, const float w0, const float w1) +{ + float b_10, b_11, g_1; + float b_00, g_0; + float r; + + nfc->base_gain = 1.0f; + nfc->gain = 1.0f; + + /* Calculate bass-boost coefficients. */ + r = 0.5f * w0; + b_10 = B[3][0] * r; + b_11 = B[3][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain *= g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; + + b_00 = B[3][2] * r; + g_0 = 1.0f + b_00; + + nfc->gain *= g_0; + nfc->b3 = 2.0f * b_00 / g_0; + + /* Calculate bass-cut coefficients. */ + r = 0.5f * w1; + b_10 = B[3][0] * r; + b_11 = B[3][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->base_gain /= g_1; + nfc->gain /= g_1; + nfc->a1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->a2 = 4.0f * b_11 / g_1; + + b_00 = B[3][2] * r; + g_0 = 1.0f + b_00; + + nfc->base_gain /= g_0; + nfc->gain /= g_0; + nfc->a3 = 2.0f * b_00 / g_0; +} + +static void NfcFilterAdjust3(struct NfcFilter3 *nfc, const float w0) +{ + float b_10, b_11, g_1; + float b_00, g_0; + float r; + + r = 0.5f * w0; + b_10 = B[3][0] * r; + b_11 = B[3][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain = nfc->base_gain * g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; + + b_00 = B[3][2] * r; + g_0 = 1.0f + b_00; + + nfc->gain *= g_0; + nfc->b3 = 2.0f * b_00 / g_0; +} + + +void NfcFilterCreate(NfcFilter *nfc, const float w0, const float w1) +{ + memset(nfc, 0, sizeof(*nfc)); + NfcFilterCreate1(&nfc->first, w0, w1); + NfcFilterCreate2(&nfc->second, w0, w1); + NfcFilterCreate3(&nfc->third, w0, w1); +} + +void NfcFilterAdjust(NfcFilter *nfc, const float w0) +{ + NfcFilterAdjust1(&nfc->first, w0); + NfcFilterAdjust2(&nfc->second, w0); + NfcFilterAdjust3(&nfc->third, w0); +} + + +void NfcFilterProcess1(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count) +{ + const float gain = nfc->first.gain; + const float b1 = nfc->first.b1; + const float a1 = nfc->first.a1; + float z1 = nfc->first.z[0]; + int i; + + ASSUME(count > 0); + + for(i = 0;i < count;i++) + { + float y = src[i]*gain - a1*z1; + float out = y + b1*z1; + z1 += y; + + dst[i] = out; + } + nfc->first.z[0] = z1; +} + +void NfcFilterProcess2(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count) +{ + const float gain = nfc->second.gain; + const float b1 = nfc->second.b1; + const float b2 = nfc->second.b2; + const float a1 = nfc->second.a1; + const float a2 = nfc->second.a2; + float z1 = nfc->second.z[0]; + float z2 = nfc->second.z[1]; + int i; + + ASSUME(count > 0); + + for(i = 0;i < count;i++) + { + float y = src[i]*gain - a1*z1 - a2*z2; + float out = y + b1*z1 + b2*z2; + z2 += z1; + z1 += y; + + dst[i] = out; + } + nfc->second.z[0] = z1; + nfc->second.z[1] = z2; +} + +void NfcFilterProcess3(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count) +{ + const float gain = nfc->third.gain; + const float b1 = nfc->third.b1; + const float b2 = nfc->third.b2; + const float b3 = nfc->third.b3; + const float a1 = nfc->third.a1; + const float a2 = nfc->third.a2; + const float a3 = nfc->third.a3; + float z1 = nfc->third.z[0]; + float z2 = nfc->third.z[1]; + float z3 = nfc->third.z[2]; + int i; + + ASSUME(count > 0); + + for(i = 0;i < count;i++) + { + float y = src[i]*gain - a1*z1 - a2*z2; + float out = y + b1*z1 + b2*z2; + z2 += z1; + z1 += y; + + y = out - a3*z3; + out = y + b3*z3; + z3 += y; + + dst[i] = out; + } + nfc->third.z[0] = z1; + nfc->third.z[1] = z2; + nfc->third.z[2] = z3; +} + +#if 0 /* Original methods the above are derived from. */ +static void NfcFilterCreate(NfcFilter *nfc, const ALsizei order, const float src_dist, const float ctl_dist, const float rate) +{ + static const float B[4][5] = { + { }, + { 1.0f }, + { 3.0f, 3.0f }, + { 3.6778f, 6.4595f, 2.3222f }, + { 4.2076f, 11.4877f, 5.7924f, 9.1401f } + }; + float w0 = SPEEDOFSOUNDMETRESPERSEC / (src_dist * rate); + float w1 = SPEEDOFSOUNDMETRESPERSEC / (ctl_dist * rate); + ALsizei i; + float r; + + nfc->g = 1.0f; + nfc->coeffs[0] = 1.0f; + + /* NOTE: Slight adjustment from the literature to raise the center + * frequency a bit (0.5 -> 1.0). + */ + r = 1.0f * w0; + for(i = 0; i < (order-1);i += 2) + { + float b_10 = B[order][i ] * r; + float b_11 = B[order][i+1] * r * r; + float g_1 = 1.0f + b_10 + b_11; + + nfc->b[i] = b_10; + nfc->b[i + 1] = b_11; + nfc->coeffs[0] *= g_1; + nfc->coeffs[i+1] = ((2.0f * b_10) + (4.0f * b_11)) / g_1; + nfc->coeffs[i+2] = (4.0f * b_11) / g_1; + } + if(i < order) + { + float b_00 = B[order][i] * r; + float g_0 = 1.0f + b_00; + + nfc->b[i] = b_00; + nfc->coeffs[0] *= g_0; + nfc->coeffs[i+1] = (2.0f * b_00) / g_0; + } + + r = 1.0f * w1; + for(i = 0;i < (order-1);i += 2) + { + float b_10 = B[order][i ] * r; + float b_11 = B[order][i+1] * r * r; + float g_1 = 1.0f + b_10 + b_11; + + nfc->g /= g_1; + nfc->coeffs[0] /= g_1; + nfc->coeffs[order+i+1] = ((2.0f * b_10) + (4.0f * b_11)) / g_1; + nfc->coeffs[order+i+2] = (4.0f * b_11) / g_1; + } + if(i < order) + { + float b_00 = B[order][i] * r; + float g_0 = 1.0f + b_00; + + nfc->g /= g_0; + nfc->coeffs[0] /= g_0; + nfc->coeffs[order+i+1] = (2.0f * b_00) / g_0; + } + + for(i = 0; i < MAX_AMBI_ORDER; i++) + nfc->history[i] = 0.0f; +} + +static void NfcFilterAdjust(NfcFilter *nfc, const float distance) +{ + int i; + + nfc->coeffs[0] = nfc->g; + + for(i = 0;i < (nfc->order-1);i += 2) + { + float b_10 = nfc->b[i] / distance; + float b_11 = nfc->b[i+1] / (distance * distance); + float g_1 = 1.0f + b_10 + b_11; + + nfc->coeffs[0] *= g_1; + nfc->coeffs[i+1] = ((2.0f * b_10) + (4.0f * b_11)) / g_1; + nfc->coeffs[i+2] = (4.0f * b_11) / g_1; + } + if(i < nfc->order) + { + float b_00 = nfc->b[i] / distance; + float g_0 = 1.0f + b_00; + + nfc->coeffs[0] *= g_0; + nfc->coeffs[i+1] = (2.0f * b_00) / g_0; + } +} + +static float NfcFilterProcess(const float in, NfcFilter *nfc) +{ + int i; + float out = in * nfc->coeffs[0]; + + for(i = 0;i < (nfc->order-1);i += 2) + { + float y = out - (nfc->coeffs[nfc->order+i+1] * nfc->history[i]) - + (nfc->coeffs[nfc->order+i+2] * nfc->history[i+1]) + 1.0e-30f; + out = y + (nfc->coeffs[i+1]*nfc->history[i]) + (nfc->coeffs[i+2]*nfc->history[i+1]); + + nfc->history[i+1] += nfc->history[i]; + nfc->history[i] += y; + } + if(i < nfc->order) + { + float y = out - (nfc->coeffs[nfc->order+i+1] * nfc->history[i]) + 1.0e-30f; + + out = y + (nfc->coeffs[i+1] * nfc->history[i]); + nfc->history[i] += y; + } + + return out; +} +#endif diff --git a/Engine/lib/openal-soft/Alc/filters/nfc.h b/Engine/lib/openal-soft/Alc/filters/nfc.h new file mode 100644 index 000000000..12a5a18f3 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/nfc.h @@ -0,0 +1,49 @@ +#ifndef FILTER_NFC_H +#define FILTER_NFC_H + +struct NfcFilter1 { + float base_gain, gain; + float b1, a1; + float z[1]; +}; +struct NfcFilter2 { + float base_gain, gain; + float b1, b2, a1, a2; + float z[2]; +}; +struct NfcFilter3 { + float base_gain, gain; + float b1, b2, b3, a1, a2, a3; + float z[3]; +}; + +typedef struct NfcFilter { + struct NfcFilter1 first; + struct NfcFilter2 second; + struct NfcFilter3 third; +} NfcFilter; + + +/* NOTE: + * w0 = speed_of_sound / (source_distance * sample_rate); + * w1 = speed_of_sound / (control_distance * sample_rate); + * + * Generally speaking, the control distance should be approximately the average + * speaker distance, or based on the reference delay if outputing NFC-HOA. It + * must not be negative, 0, or infinite. The source distance should not be too + * small relative to the control distance. + */ + +void NfcFilterCreate(NfcFilter *nfc, const float w0, const float w1); +void NfcFilterAdjust(NfcFilter *nfc, const float w0); + +/* Near-field control filter for first-order ambisonic channels (1-3). */ +void NfcFilterProcess1(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); + +/* Near-field control filter for second-order ambisonic channels (4-8). */ +void NfcFilterProcess2(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); + +/* Near-field control filter for third-order ambisonic channels (9-15). */ +void NfcFilterProcess3(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); + +#endif /* FILTER_NFC_H */ diff --git a/Engine/lib/openal-soft/Alc/filters/splitter.c b/Engine/lib/openal-soft/Alc/filters/splitter.c new file mode 100644 index 000000000..e99f4b953 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/splitter.c @@ -0,0 +1,109 @@ + +#include "config.h" + +#include "splitter.h" + +#include "math_defs.h" + + +void bandsplit_init(BandSplitter *splitter, ALfloat f0norm) +{ + ALfloat w = f0norm * F_TAU; + ALfloat cw = cosf(w); + if(cw > FLT_EPSILON) + splitter->coeff = (sinf(w) - 1.0f) / cw; + else + splitter->coeff = cw * -0.5f; + + splitter->lp_z1 = 0.0f; + splitter->lp_z2 = 0.0f; + splitter->hp_z1 = 0.0f; +} + +void bandsplit_clear(BandSplitter *splitter) +{ + splitter->lp_z1 = 0.0f; + splitter->lp_z2 = 0.0f; + splitter->hp_z1 = 0.0f; +} + +void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, + const ALfloat *input, ALsizei count) +{ + ALfloat lp_coeff, hp_coeff, lp_y, hp_y, d; + ALfloat lp_z1, lp_z2, hp_z1; + ALsizei i; + + ASSUME(count > 0); + + hp_coeff = splitter->coeff; + lp_coeff = splitter->coeff*0.5f + 0.5f; + lp_z1 = splitter->lp_z1; + lp_z2 = splitter->lp_z2; + hp_z1 = splitter->hp_z1; + for(i = 0;i < count;i++) + { + ALfloat in = input[i]; + + /* Low-pass sample processing. */ + d = (in - lp_z1) * lp_coeff; + lp_y = lp_z1 + d; + lp_z1 = lp_y + d; + + d = (lp_y - lp_z2) * lp_coeff; + lp_y = lp_z2 + d; + lp_z2 = lp_y + d; + + lpout[i] = lp_y; + + /* All-pass sample processing. */ + hp_y = in*hp_coeff + hp_z1; + hp_z1 = in - hp_y*hp_coeff; + + /* High-pass generated from removing low-passed output. */ + hpout[i] = hp_y - lp_y; + } + splitter->lp_z1 = lp_z1; + splitter->lp_z2 = lp_z2; + splitter->hp_z1 = hp_z1; +} + + +void splitterap_init(SplitterAllpass *splitter, ALfloat f0norm) +{ + ALfloat w = f0norm * F_TAU; + ALfloat cw = cosf(w); + if(cw > FLT_EPSILON) + splitter->coeff = (sinf(w) - 1.0f) / cw; + else + splitter->coeff = cw * -0.5f; + + splitter->z1 = 0.0f; +} + +void splitterap_clear(SplitterAllpass *splitter) +{ + splitter->z1 = 0.0f; +} + +void splitterap_process(SplitterAllpass *splitter, ALfloat *restrict samples, ALsizei count) +{ + ALfloat coeff, in, out; + ALfloat z1; + ALsizei i; + + ASSUME(count > 0); + + coeff = splitter->coeff; + z1 = splitter->z1; + for(i = 0;i < count;i++) + { + in = samples[i]; + + out = in*coeff + z1; + z1 = in - out*coeff; + + samples[i] = out; + } + splitter->z1 = z1; +} diff --git a/Engine/lib/openal-soft/Alc/filters/splitter.h b/Engine/lib/openal-soft/Alc/filters/splitter.h new file mode 100644 index 000000000..a788bc3e9 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/splitter.h @@ -0,0 +1,40 @@ +#ifndef FILTER_SPLITTER_H +#define FILTER_SPLITTER_H + +#include "alMain.h" + + +/* Band splitter. Splits a signal into two phase-matching frequency bands. */ +typedef struct BandSplitter { + ALfloat coeff; + ALfloat lp_z1; + ALfloat lp_z2; + ALfloat hp_z1; +} BandSplitter; + +void bandsplit_init(BandSplitter *splitter, ALfloat f0norm); +void bandsplit_clear(BandSplitter *splitter); +void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, + const ALfloat *input, ALsizei count); + +/* The all-pass portion of the band splitter. Applies the same phase shift + * without splitting the signal. + */ +typedef struct SplitterAllpass { + ALfloat coeff; + ALfloat z1; +} SplitterAllpass; + +void splitterap_init(SplitterAllpass *splitter, ALfloat f0norm); +void splitterap_clear(SplitterAllpass *splitter); +void splitterap_process(SplitterAllpass *splitter, ALfloat *restrict samples, ALsizei count); + + +typedef struct FrontStablizer { + SplitterAllpass APFilter[MAX_OUTPUT_CHANNELS]; + BandSplitter LFilter, RFilter; + alignas(16) ALfloat LSplit[2][BUFFERSIZE]; + alignas(16) ALfloat RSplit[2][BUFFERSIZE]; +} FrontStablizer; + +#endif /* FILTER_SPLITTER_H */ diff --git a/Engine/lib/openal-soft/Alc/fpu_modes.h b/Engine/lib/openal-soft/Alc/fpu_modes.h new file mode 100644 index 000000000..eb3059679 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/fpu_modes.h @@ -0,0 +1,34 @@ +#ifndef FPU_MODES_H +#define FPU_MODES_H + +#ifdef HAVE_FENV_H +#include +#endif + + +typedef struct FPUCtl { +#if defined(__GNUC__) && defined(HAVE_SSE) + unsigned int sse_state; +#elif defined(HAVE___CONTROL87_2) + unsigned int state; + unsigned int sse_state; +#elif defined(HAVE__CONTROLFP) + unsigned int state; +#endif +} FPUCtl; +void SetMixerFPUMode(FPUCtl *ctl); +void RestoreFPUMode(const FPUCtl *ctl); + +#ifdef __GNUC__ +/* Use an alternate macro set with GCC to avoid accidental continue or break + * statements within the mixer mode. + */ +#define START_MIXER_MODE() __extension__({ FPUCtl _oldMode; SetMixerFPUMode(&_oldMode) +#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); }) +#else +#define START_MIXER_MODE() do { FPUCtl _oldMode; SetMixerFPUMode(&_oldMode) +#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); } while(0) +#endif +#define LEAVE_MIXER_MODE() RestoreFPUMode(&_oldMode) + +#endif /* FPU_MODES_H */ diff --git a/Engine/lib/openal-soft/Alc/helpers.c b/Engine/lib/openal-soft/Alc/helpers.c index 0a6982e90..7bcb3f4ab 100644 --- a/Engine/lib/openal-soft/Alc/helpers.c +++ b/Engine/lib/openal-soft/Alc/helpers.c @@ -39,6 +39,14 @@ #ifdef HAVE_DIRENT_H #include #endif +#ifdef HAVE_PROC_PIDPATH +#include +#endif + +#ifdef __FreeBSD__ +#include +#include +#endif #ifndef AL_NO_UID_DEFS #if defined(HAVE_GUIDDEF_H) || defined(HAVE_INITGUID_H) @@ -61,7 +69,7 @@ DEFINE_GUID(IID_IAudioClient, 0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1,0x78, 0xc DEFINE_GUID(IID_IAudioRenderClient, 0xf294acfc, 0x3146, 0x4483, 0xa7,0xbf, 0xad,0xdc,0xa7,0xc2,0x60,0xe2); DEFINE_GUID(IID_IAudioCaptureClient, 0xc8adbd64, 0xe71e, 0x48a0, 0xa4,0xde, 0x18,0x5c,0x39,0x5c,0xd3,0x17); -#ifdef HAVE_MMDEVAPI +#ifdef HAVE_WASAPI #include #include #include @@ -103,6 +111,8 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x #include "alMain.h" #include "alu.h" +#include "cpu_caps.h" +#include "fpu_modes.h" #include "atomic.h" #include "uintmap.h" #include "vector.h" @@ -112,71 +122,50 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x extern inline ALuint NextPowerOf2(ALuint value); +extern inline size_t RoundUp(size_t value, size_t r); extern inline ALint fastf2i(ALfloat f); -extern inline ALuint fastf2u(ALfloat f); +extern inline int float2int(float f); +#ifndef __GNUC__ +#if defined(HAVE_BITSCANFORWARD64_INTRINSIC) +extern inline int msvc64_ctz64(ALuint64 v); +#elif defined(HAVE_BITSCANFORWARD_INTRINSIC) +extern inline int msvc_ctz64(ALuint64 v); +#else +extern inline int fallback_popcnt64(ALuint64 v); +extern inline int fallback_ctz64(ALuint64 value); +#endif +#endif -ALuint CPUCapFlags = 0; +#if defined(HAVE_GCC_GET_CPUID) && (defined(__i386__) || defined(__x86_64__) || \ + defined(_M_IX86) || defined(_M_X64)) +typedef unsigned int reg_type; +static inline void get_cpuid(int f, reg_type *regs) +{ __get_cpuid(f, ®s[0], ®s[1], ®s[2], ®s[3]); } +#define CAN_GET_CPUID +#elif defined(HAVE_CPUID_INTRINSIC) && (defined(__i386__) || defined(__x86_64__) || \ + defined(_M_IX86) || defined(_M_X64)) +typedef int reg_type; +static inline void get_cpuid(int f, reg_type *regs) +{ (__cpuid)(regs, f); } +#define CAN_GET_CPUID +#endif +int CPUCapFlags = 0; -void FillCPUCaps(ALuint capfilter) +void FillCPUCaps(int capfilter) { - ALuint caps = 0; + int caps = 0; /* FIXME: We really should get this for all available CPUs in case different * CPUs have different caps (is that possible on one machine?). */ -#if defined(HAVE_GCC_GET_CPUID) && (defined(__i386__) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(_M_X64)) +#ifdef CAN_GET_CPUID union { - unsigned int regs[4]; - char str[sizeof(unsigned int[4])]; - } cpuinf[3]; + reg_type regs[4]; + char str[sizeof(reg_type[4])]; + } cpuinf[3] = {{ { 0, 0, 0, 0 } }}; - if(!__get_cpuid(0, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3])) - ERR("Failed to get CPUID\n"); - else - { - unsigned int maxfunc = cpuinf[0].regs[0]; - unsigned int maxextfunc = 0; - - if(__get_cpuid(0x80000000, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3])) - maxextfunc = cpuinf[0].regs[0]; - TRACE("Detected max CPUID function: 0x%x (ext. 0x%x)\n", maxfunc, maxextfunc); - - TRACE("Vendor ID: \"%.4s%.4s%.4s\"\n", cpuinf[0].str+4, cpuinf[0].str+12, cpuinf[0].str+8); - if(maxextfunc >= 0x80000004 && - __get_cpuid(0x80000002, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3]) && - __get_cpuid(0x80000003, &cpuinf[1].regs[0], &cpuinf[1].regs[1], &cpuinf[1].regs[2], &cpuinf[1].regs[3]) && - __get_cpuid(0x80000004, &cpuinf[2].regs[0], &cpuinf[2].regs[1], &cpuinf[2].regs[2], &cpuinf[2].regs[3])) - TRACE("Name: \"%.16s%.16s%.16s\"\n", cpuinf[0].str, cpuinf[1].str, cpuinf[2].str); - - if(maxfunc >= 1 && - __get_cpuid(1, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3])) - { - if((cpuinf[0].regs[3]&(1<<25))) - { - caps |= CPU_CAP_SSE; - if((cpuinf[0].regs[3]&(1<<26))) - { - caps |= CPU_CAP_SSE2; - if((cpuinf[0].regs[2]&(1<<0))) - { - caps |= CPU_CAP_SSE3; - if((cpuinf[0].regs[2]&(1<<19))) - caps |= CPU_CAP_SSE4_1; - } - } - } - } - } -#elif defined(HAVE_CPUID_INTRINSIC) && (defined(__i386__) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(_M_X64)) - union { - int regs[4]; - char str[sizeof(int[4])]; - } cpuinf[3]; - - (__cpuid)(cpuinf[0].regs, 0); + get_cpuid(0, cpuinf[0].regs); if(cpuinf[0].regs[0] == 0) ERR("Failed to get CPUID\n"); else @@ -184,7 +173,7 @@ void FillCPUCaps(ALuint capfilter) unsigned int maxfunc = cpuinf[0].regs[0]; unsigned int maxextfunc; - (__cpuid)(cpuinf[0].regs, 0x80000000); + get_cpuid(0x80000000, cpuinf[0].regs); maxextfunc = cpuinf[0].regs[0]; TRACE("Detected max CPUID function: 0x%x (ext. 0x%x)\n", maxfunc, maxextfunc); @@ -192,29 +181,23 @@ void FillCPUCaps(ALuint capfilter) TRACE("Vendor ID: \"%.4s%.4s%.4s\"\n", cpuinf[0].str+4, cpuinf[0].str+12, cpuinf[0].str+8); if(maxextfunc >= 0x80000004) { - (__cpuid)(cpuinf[0].regs, 0x80000002); - (__cpuid)(cpuinf[1].regs, 0x80000003); - (__cpuid)(cpuinf[2].regs, 0x80000004); + get_cpuid(0x80000002, cpuinf[0].regs); + get_cpuid(0x80000003, cpuinf[1].regs); + get_cpuid(0x80000004, cpuinf[2].regs); TRACE("Name: \"%.16s%.16s%.16s\"\n", cpuinf[0].str, cpuinf[1].str, cpuinf[2].str); } if(maxfunc >= 1) { - (__cpuid)(cpuinf[0].regs, 1); + get_cpuid(1, cpuinf[0].regs); if((cpuinf[0].regs[3]&(1<<25))) - { caps |= CPU_CAP_SSE; - if((cpuinf[0].regs[3]&(1<<26))) - { - caps |= CPU_CAP_SSE2; - if((cpuinf[0].regs[2]&(1<<0))) - { - caps |= CPU_CAP_SSE3; - if((cpuinf[0].regs[2]&(1<<19))) - caps |= CPU_CAP_SSE4_1; - } - } - } + if((caps&CPU_CAP_SSE) && (cpuinf[0].regs[3]&(1<<26))) + caps |= CPU_CAP_SSE2; + if((caps&CPU_CAP_SSE2) && (cpuinf[0].regs[2]&(1<<0))) + caps |= CPU_CAP_SSE3; + if((caps&CPU_CAP_SSE3) && (cpuinf[0].regs[2]&(1<<19))) + caps |= CPU_CAP_SSE4_1; } } #else @@ -242,11 +225,16 @@ void FillCPUCaps(ALuint capfilter) char buf[256]; while(fgets(buf, sizeof(buf), file) != NULL) { + size_t len; char *str; if(strncmp(buf, "Features\t:", 10) != 0) continue; + len = strlen(buf); + while(len > 0 && isspace(buf[len-1])) + buf[--len] = 0; + TRACE("Got features string:%s\n", buf+10); str = buf; @@ -272,7 +260,7 @@ void FillCPUCaps(ALuint capfilter) ((capfilter&CPU_CAP_SSE2) ? ((caps&CPU_CAP_SSE2) ? " +SSE2" : " -SSE2") : ""), ((capfilter&CPU_CAP_SSE3) ? ((caps&CPU_CAP_SSE3) ? " +SSE3" : " -SSE3") : ""), ((capfilter&CPU_CAP_SSE4_1) ? ((caps&CPU_CAP_SSE4_1) ? " +SSE4.1" : " -SSE4.1") : ""), - ((capfilter&CPU_CAP_NEON) ? ((caps&CPU_CAP_NEON) ? " +Neon" : " -Neon") : ""), + ((capfilter&CPU_CAP_NEON) ? ((caps&CPU_CAP_NEON) ? " +NEON" : " -NEON") : ""), ((!capfilter) ? " -none-" : "") ); CPUCapFlags = caps & capfilter; @@ -281,78 +269,51 @@ void FillCPUCaps(ALuint capfilter) void SetMixerFPUMode(FPUCtl *ctl) { -#ifdef HAVE_FENV_H - fegetenv(STATIC_CAST(fenv_t, ctl)); -#if defined(__GNUC__) && defined(HAVE_SSE) - /* FIXME: Some fegetenv implementations can get the SSE environment too? - * How to tell when it does? */ - if((CPUCapFlags&CPU_CAP_SSE)) - __asm__ __volatile__("stmxcsr %0" : "=m" (*&ctl->sse_state)); -#endif - -#ifdef FE_TOWARDZERO - fesetround(FE_TOWARDZERO); -#endif #if defined(__GNUC__) && defined(HAVE_SSE) if((CPUCapFlags&CPU_CAP_SSE)) { - int sseState = ctl->sse_state; - sseState |= 0x6000; /* set round-to-zero */ + __asm__ __volatile__("stmxcsr %0" : "=m" (*&ctl->sse_state)); + unsigned int sseState = ctl->sse_state; sseState |= 0x8000; /* set flush-to-zero */ if((CPUCapFlags&CPU_CAP_SSE2)) sseState |= 0x0040; /* set denormals-are-zero */ __asm__ __volatile__("ldmxcsr %0" : : "m" (*&sseState)); } -#endif #elif defined(HAVE___CONTROL87_2) - int mode; - __control87_2(0, 0, &ctl->state, NULL); - __control87_2(_RC_CHOP, _MCW_RC, &mode, NULL); -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - { - __control87_2(0, 0, NULL, &ctl->sse_state); - __control87_2(_RC_CHOP|_DN_FLUSH, _MCW_RC|_MCW_DN, NULL, &mode); - } -#endif + __control87_2(0, 0, &ctl->state, &ctl->sse_state); + _control87(_DN_FLUSH, _MCW_DN); #elif defined(HAVE__CONTROLFP) ctl->state = _controlfp(0, 0); - (void)_controlfp(_RC_CHOP, _MCW_RC); + _controlfp(_DN_FLUSH, _MCW_DN); #endif } void RestoreFPUMode(const FPUCtl *ctl) { -#ifdef HAVE_FENV_H - fesetenv(STATIC_CAST(fenv_t, ctl)); #if defined(__GNUC__) && defined(HAVE_SSE) if((CPUCapFlags&CPU_CAP_SSE)) __asm__ __volatile__("ldmxcsr %0" : : "m" (*&ctl->sse_state)); -#endif #elif defined(HAVE___CONTROL87_2) int mode; - __control87_2(ctl->state, _MCW_RC, &mode, NULL); -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - __control87_2(ctl->sse_state, _MCW_RC|_MCW_DN, NULL, &mode); -#endif + __control87_2(ctl->state, _MCW_DN, &mode, NULL); + __control87_2(ctl->sse_state, _MCW_DN, NULL, &mode); #elif defined(HAVE__CONTROLFP) - _controlfp(ctl->state, _MCW_RC); + _controlfp(ctl->state, _MCW_DN); #endif } static int StringSortCompare(const void *str1, const void *str2) { - return al_string_cmp(*(const_al_string*)str1, *(const_al_string*)str2); + return alstr_cmp(*(const_al_string*)str1, *(const_al_string*)str2); } #ifdef _WIN32 @@ -369,9 +330,8 @@ static WCHAR *strrchrW(WCHAR *str, WCHAR ch) return ret; } -al_string GetProcPath(void) +void GetProcBinary(al_string *path, al_string *fname) { - al_string ret = AL_STRING_INIT_STATIC(); WCHAR *pathname, *sep; DWORD pathlen; DWORD len; @@ -388,23 +348,34 @@ al_string GetProcPath(void) { free(pathname); ERR("Failed to get process name: error %lu\n", GetLastError()); - return ret; + return; } pathname[len] = 0; - if((sep = strrchrW(pathname, '\\'))) + if((sep=strrchrW(pathname, '\\')) != NULL) { - WCHAR *sep2 = strrchrW(pathname, '/'); - if(sep2) *sep2 = 0; - else *sep = 0; + WCHAR *sep2 = strrchrW(sep+1, '/'); + if(sep2) sep = sep2; + } + else + sep = strrchrW(pathname, '/'); + + if(sep) + { + if(path) alstr_copy_wrange(path, pathname, sep); + if(fname) alstr_copy_wcstr(fname, sep+1); + } + else + { + if(path) alstr_clear(path); + if(fname) alstr_copy_wcstr(fname, pathname); } - else if((sep = strrchrW(pathname, '/'))) - *sep = 0; - al_string_copy_wcstr(&ret, pathname); free(pathname); - TRACE("Got: %s\n", al_string_get_cstr(ret)); - return ret; + if(path && fname) + TRACE("Got: %s, %s\n", alstr_get_cstr(*path), alstr_get_cstr(*fname)); + else if(path) TRACE("Got path: %s\n", alstr_get_cstr(*path)); + else if(fname) TRACE("Got filename: %s\n", alstr_get_cstr(*fname)); } @@ -520,13 +491,13 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string WCHAR *wpath; HANDLE hdl; - al_string_copy_cstr(&pathstr, path); - al_string_append_cstr(&pathstr, "\\*"); - al_string_append_cstr(&pathstr, ext); + alstr_copy_cstr(&pathstr, path); + alstr_append_cstr(&pathstr, "\\*"); + alstr_append_cstr(&pathstr, ext); - TRACE("Searching %s\n", al_string_get_cstr(pathstr)); + TRACE("Searching %s\n", alstr_get_cstr(pathstr)); - wpath = FromUTF8(al_string_get_cstr(pathstr)); + wpath = FromUTF8(alstr_get_cstr(pathstr)); hdl = FindFirstFileW(wpath, &fdata); if(hdl != INVALID_HANDLE_VALUE) @@ -534,10 +505,10 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string size_t base = VECTOR_SIZE(*results); do { al_string str = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&str, path); - al_string_append_char(&str, '\\'); - al_string_append_wcstr(&str, fdata.cFileName); - TRACE("Got result %s\n", al_string_get_cstr(str)); + alstr_copy_cstr(&str, path); + alstr_append_char(&str, '\\'); + alstr_append_wcstr(&str, fdata.cFileName); + TRACE("Got result %s\n", alstr_get_cstr(str)); VECTOR_PUSH_BACK(*results, str); } while(FindNextFileW(hdl, &fdata)); FindClose(hdl); @@ -548,7 +519,7 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string } free(wpath); - al_string_deinit(&pathstr); + alstr_reset(&pathstr); } vector_al_string SearchDataFiles(const char *ext, const char *subdir) @@ -558,21 +529,21 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) vector_al_string results = VECTOR_INIT_STATIC(); size_t i; - while(ATOMIC_EXCHANGE(uint, &search_lock, 1) == 1) + while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1) althrd_yield(); /* If the path is absolute, use it directly. */ if(isalpha(subdir[0]) && subdir[1] == ':' && is_slash(subdir[2])) { al_string path = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&path, subdir); + alstr_copy_cstr(&path, subdir); #define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0) VECTOR_FOR_EACH(char, path, FIX_SLASH); #undef FIX_SLASH - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); - al_string_deinit(&path); + alstr_reset(&path); } else if(subdir[0] == '\\' && subdir[1] == '\\' && subdir[2] == '?' && subdir[3] == '\\') DirectorySearch(subdir, ext, &results); @@ -584,7 +555,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) /* Search the app-local directory. */ if((cwdbuf=_wgetenv(L"ALSOFT_LOCAL_PATH")) && *cwdbuf != '\0') { - al_string_copy_wcstr(&path, cwdbuf); + alstr_copy_wcstr(&path, cwdbuf); if(is_slash(VECTOR_BACK(path))) { VECTOR_POP_BACK(path); @@ -592,10 +563,10 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) } } else if(!(cwdbuf=_wgetcwd(NULL, 0))) - al_string_copy_cstr(&path, "."); + alstr_copy_cstr(&path, "."); else { - al_string_copy_wcstr(&path, cwdbuf); + alstr_copy_wcstr(&path, cwdbuf); if(is_slash(VECTOR_BACK(path))) { VECTOR_POP_BACK(path); @@ -606,30 +577,30 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) #define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0) VECTOR_FOR_EACH(char, path, FIX_SLASH); #undef FIX_SLASH - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); /* Search the local and global data dirs. */ for(i = 0;i < COUNTOF(ids);i++) { - WCHAR buffer[PATH_MAX]; + WCHAR buffer[MAX_PATH]; if(SHGetSpecialFolderPathW(NULL, buffer, ids[i], FALSE) != FALSE) { - al_string_copy_wcstr(&path, buffer); + alstr_copy_wcstr(&path, buffer); if(!is_slash(VECTOR_BACK(path))) - al_string_append_char(&path, '\\'); - al_string_append_cstr(&path, subdir); + alstr_append_char(&path, '\\'); + alstr_append_cstr(&path, subdir); #define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0) VECTOR_FOR_EACH(char, path, FIX_SLASH); #undef FIX_SLASH - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); } } - al_string_deinit(&path); + alstr_reset(&path); } - ATOMIC_STORE(&search_lock, 0); + ATOMIC_STORE_SEQ(&search_lock, 0); return results; } @@ -698,49 +669,103 @@ void UnmapFileMem(const struct FileMapping *mapping) #else -al_string GetProcPath(void) +void GetProcBinary(al_string *path, al_string *fname) { - al_string ret = AL_STRING_INIT_STATIC(); - const char *fname; - char *pathname, *sep; + char *pathname = NULL; size_t pathlen; - ssize_t len; - pathlen = 256; - pathname = malloc(pathlen); - - fname = "/proc/self/exe"; - len = readlink(fname, pathname, pathlen); - if(len == -1 && errno == ENOENT) - { - fname = "/proc/self/file"; - len = readlink(fname, pathname, pathlen); - } - - while(len > 0 && (size_t)len == pathlen) - { - free(pathname); - pathlen <<= 1; - pathname = malloc(pathlen); - len = readlink(fname, pathname, pathlen); - } - if(len <= 0) - { - free(pathname); - WARN("Failed to readlink %s: %s\n", fname, strerror(errno)); - return ret; - } - - pathname[len] = 0; - sep = strrchr(pathname, '/'); - if(sep) - al_string_copy_range(&ret, pathname, sep); +#ifdef __FreeBSD__ + int mib[4] = { CTL_KERN, KERN_PROC_ARGS, getpid() }; + if(sysctl(mib, 3, NULL, &pathlen, NULL, 0) == -1) + WARN("Failed to sysctl kern.procargs.%d: %s\n", mib[2], strerror(errno)); else - al_string_copy_cstr(&ret, pathname); + { + pathname = malloc(pathlen + 1); + sysctl(mib, 3, (void*)pathname, &pathlen, NULL, 0); + pathname[pathlen] = 0; + } +#endif +#ifdef HAVE_PROC_PIDPATH + if(!pathname) + { + const pid_t pid = getpid(); + char procpath[PROC_PIDPATHINFO_MAXSIZE]; + int ret; + + ret = proc_pidpath(pid, procpath, sizeof(procpath)); + if(ret < 1) + { + WARN("proc_pidpath(%d, ...) failed: %s\n", pid, strerror(errno)); + free(pathname); + pathname = NULL; + } + else + { + pathlen = strlen(procpath); + pathname = strdup(procpath); + } + } +#endif + if(!pathname) + { + const char *selfname; + ssize_t len; + + pathlen = 256; + pathname = malloc(pathlen); + + selfname = "/proc/self/exe"; + len = readlink(selfname, pathname, pathlen); + if(len == -1 && errno == ENOENT) + { + selfname = "/proc/self/file"; + len = readlink(selfname, pathname, pathlen); + } + if(len == -1 && errno == ENOENT) + { + selfname = "/proc/curproc/exe"; + len = readlink(selfname, pathname, pathlen); + } + if(len == -1 && errno == ENOENT) + { + selfname = "/proc/curproc/file"; + len = readlink(selfname, pathname, pathlen); + } + + while(len > 0 && (size_t)len == pathlen) + { + free(pathname); + pathlen <<= 1; + pathname = malloc(pathlen); + len = readlink(selfname, pathname, pathlen); + } + if(len <= 0) + { + free(pathname); + WARN("Failed to readlink %s: %s\n", selfname, strerror(errno)); + return; + } + + pathname[len] = 0; + } + + char *sep = strrchr(pathname, '/'); + if(sep) + { + if(path) alstr_copy_range(path, pathname, sep); + if(fname) alstr_copy_cstr(fname, sep+1); + } + else + { + if(path) alstr_clear(path); + if(fname) alstr_copy_cstr(fname, pathname); + } free(pathname); - TRACE("Got: %s\n", al_string_get_cstr(ret)); - return ret; + if(path && fname) + TRACE("Got: %s, %s\n", alstr_get_cstr(*path), alstr_get_cstr(*fname)); + else if(path) TRACE("Got path: %s\n", alstr_get_cstr(*path)); + else if(fname) TRACE("Got filename: %s\n", alstr_get_cstr(*fname)); } @@ -814,11 +839,11 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string continue; AL_STRING_INIT(str); - al_string_copy_cstr(&str, path); + alstr_copy_cstr(&str, path); if(VECTOR_BACK(str) != '/') - al_string_append_char(&str, '/'); - al_string_append_cstr(&str, dirent->d_name); - TRACE("Got result %s\n", al_string_get_cstr(str)); + alstr_append_char(&str, '/'); + alstr_append_cstr(&str, dirent->d_name); + TRACE("Got result %s\n", alstr_get_cstr(str)); VECTOR_PUSH_BACK(*results, str); } closedir(dir); @@ -834,7 +859,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) static RefCount search_lock; vector_al_string results = VECTOR_INIT_STATIC(); - while(ATOMIC_EXCHANGE(uint, &search_lock, 1) == 1) + while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1) althrd_yield(); if(subdir[0] == '/') @@ -843,36 +868,53 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) { al_string path = AL_STRING_INIT_STATIC(); const char *str, *next; - char cwdbuf[PATH_MAX]; /* Search the app-local directory. */ if((str=getenv("ALSOFT_LOCAL_PATH")) && *str != '\0') DirectorySearch(str, ext, &results); - else if(getcwd(cwdbuf, sizeof(cwdbuf))) - DirectorySearch(cwdbuf, ext, &results); else - DirectorySearch(".", ext, &results); + { + size_t cwdlen = 256; + char *cwdbuf = malloc(cwdlen); + while(!getcwd(cwdbuf, cwdlen)) + { + free(cwdbuf); + cwdbuf = NULL; + if(errno != ERANGE) + break; + cwdlen <<= 1; + cwdbuf = malloc(cwdlen); + } + if(!cwdbuf) + DirectorySearch(".", ext, &results); + else + { + DirectorySearch(cwdbuf, ext, &results); + free(cwdbuf); + cwdbuf = NULL; + } + } // Search local data dir if((str=getenv("XDG_DATA_HOME")) != NULL && str[0] != '\0') { - al_string_copy_cstr(&path, str); + alstr_copy_cstr(&path, str); if(VECTOR_BACK(path) != '/') - al_string_append_char(&path, '/'); - al_string_append_cstr(&path, subdir); - DirectorySearch(al_string_get_cstr(path), ext, &results); + alstr_append_char(&path, '/'); + alstr_append_cstr(&path, subdir); + DirectorySearch(alstr_get_cstr(path), ext, &results); } else if((str=getenv("HOME")) != NULL && str[0] != '\0') { - al_string_copy_cstr(&path, str); + alstr_copy_cstr(&path, str); if(VECTOR_BACK(path) == '/') { VECTOR_POP_BACK(path); *VECTOR_END(path) = 0; } - al_string_append_cstr(&path, "/.local/share/"); - al_string_append_cstr(&path, subdir); - DirectorySearch(al_string_get_cstr(path), ext, &results); + alstr_append_cstr(&path, "/.local/share/"); + alstr_append_cstr(&path, subdir); + DirectorySearch(alstr_get_cstr(path), ext, &results); } // Search global data dirs @@ -884,26 +926,26 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) { next = strchr(str, ':'); if(!next) - al_string_copy_cstr(&path, str); + alstr_copy_cstr(&path, str); else { - al_string_copy_range(&path, str, next); + alstr_copy_range(&path, str, next); ++next; } - if(!al_string_empty(path)) + if(!alstr_empty(path)) { if(VECTOR_BACK(path) != '/') - al_string_append_char(&path, '/'); - al_string_append_cstr(&path, subdir); + alstr_append_char(&path, '/'); + alstr_append_cstr(&path, subdir); - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); } } - al_string_deinit(&path); + alstr_reset(&path); } - ATOMIC_STORE(&search_lock, 0); + ATOMIC_STORE_SEQ(&search_lock, 0); return results; } @@ -977,14 +1019,14 @@ void SetRTPriority(void) } -extern inline void al_string_deinit(al_string *str); -extern inline size_t al_string_length(const_al_string str); -extern inline ALboolean al_string_empty(const_al_string str); -extern inline const al_string_char_type *al_string_get_cstr(const_al_string str); +extern inline void alstr_reset(al_string *str); +extern inline size_t alstr_length(const_al_string str); +extern inline ALboolean alstr_empty(const_al_string str); +extern inline const al_string_char_type *alstr_get_cstr(const_al_string str); -void al_string_clear(al_string *str) +void alstr_clear(al_string *str) { - if(!al_string_empty(*str)) + if(!alstr_empty(*str)) { /* Reserve one more character than the total size of the string. This * is to ensure we have space to add a null terminator in the string @@ -995,8 +1037,8 @@ void al_string_clear(al_string *str) } } -static inline int al_string_compare(const al_string_char_type *str1, size_t str1len, - const al_string_char_type *str2, size_t str2len) +static inline int alstr_compare(const al_string_char_type *str1, size_t str1len, + const al_string_char_type *str2, size_t str2len) { size_t complen = (str1len < str2len) ? str1len : str2len; int ret = memcmp(str1, str2, complen); @@ -1007,20 +1049,20 @@ static inline int al_string_compare(const al_string_char_type *str1, size_t str1 } return ret; } -int al_string_cmp(const_al_string str1, const_al_string str2) +int alstr_cmp(const_al_string str1, const_al_string str2) { - return al_string_compare(&VECTOR_FRONT(str1), al_string_length(str1), - &VECTOR_FRONT(str2), al_string_length(str2)); + return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1), + &VECTOR_FRONT(str2), alstr_length(str2)); } -int al_string_cmp_cstr(const_al_string str1, const al_string_char_type *str2) +int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2) { - return al_string_compare(&VECTOR_FRONT(str1), al_string_length(str1), - str2, strlen(str2)); + return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1), + str2, strlen(str2)); } -void al_string_copy(al_string *str, const_al_string from) +void alstr_copy(al_string *str, const_al_string from) { - size_t len = al_string_length(from); + size_t len = alstr_length(from); size_t i; VECTOR_RESIZE(*str, len, len+1); @@ -1029,7 +1071,7 @@ void al_string_copy(al_string *str, const_al_string from) VECTOR_ELEM(*str, i) = 0; } -void al_string_copy_cstr(al_string *str, const al_string_char_type *from) +void alstr_copy_cstr(al_string *str, const al_string_char_type *from) { size_t len = strlen(from); size_t i; @@ -1040,7 +1082,7 @@ void al_string_copy_cstr(al_string *str, const al_string_char_type *from) VECTOR_ELEM(*str, i) = 0; } -void al_string_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) +void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) { size_t len = to - from; size_t i; @@ -1051,20 +1093,20 @@ void al_string_copy_range(al_string *str, const al_string_char_type *from, const VECTOR_ELEM(*str, i) = 0; } -void al_string_append_char(al_string *str, const al_string_char_type c) +void alstr_append_char(al_string *str, const al_string_char_type c) { - size_t len = al_string_length(*str); + size_t len = alstr_length(*str); VECTOR_RESIZE(*str, len, len+2); VECTOR_PUSH_BACK(*str, c); VECTOR_ELEM(*str, len+1) = 0; } -void al_string_append_cstr(al_string *str, const al_string_char_type *from) +void alstr_append_cstr(al_string *str, const al_string_char_type *from) { size_t len = strlen(from); if(len != 0) { - size_t base = al_string_length(*str); + size_t base = alstr_length(*str); size_t i; VECTOR_RESIZE(*str, base+len, base+len+1); @@ -1074,12 +1116,12 @@ void al_string_append_cstr(al_string *str, const al_string_char_type *from) } } -void al_string_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) +void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) { size_t len = to - from; if(len != 0) { - size_t base = al_string_length(*str); + size_t base = alstr_length(*str); size_t i; VECTOR_RESIZE(*str, base+len, base+len+1); @@ -1090,7 +1132,7 @@ void al_string_append_range(al_string *str, const al_string_char_type *from, con } #ifdef _WIN32 -void al_string_copy_wcstr(al_string *str, const wchar_t *from) +void alstr_copy_wcstr(al_string *str, const wchar_t *from) { int len; if((len=WideCharToMultiByte(CP_UTF8, 0, from, -1, NULL, 0, NULL, NULL)) > 0) @@ -1101,24 +1143,35 @@ void al_string_copy_wcstr(al_string *str, const wchar_t *from) } } -void al_string_append_wcstr(al_string *str, const wchar_t *from) +void alstr_append_wcstr(al_string *str, const wchar_t *from) { int len; if((len=WideCharToMultiByte(CP_UTF8, 0, from, -1, NULL, 0, NULL, NULL)) > 0) { - size_t base = al_string_length(*str); + size_t base = alstr_length(*str); VECTOR_RESIZE(*str, base+len-1, base+len); WideCharToMultiByte(CP_UTF8, 0, from, -1, &VECTOR_ELEM(*str, base), len, NULL, NULL); VECTOR_ELEM(*str, base+len-1) = 0; } } -void al_string_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to) +void alstr_copy_wrange(al_string *str, const wchar_t *from, const wchar_t *to) { int len; if((len=WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), NULL, 0, NULL, NULL)) > 0) { - size_t base = al_string_length(*str); + VECTOR_RESIZE(*str, len, len+1); + WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), &VECTOR_FRONT(*str), len+1, NULL, NULL); + VECTOR_ELEM(*str, len) = 0; + } +} + +void alstr_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to) +{ + int len; + if((len=WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), NULL, 0, NULL, NULL)) > 0) + { + size_t base = alstr_length(*str); VECTOR_RESIZE(*str, base+len, base+len+1); WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), &VECTOR_ELEM(*str, base), len+1, NULL, NULL); VECTOR_ELEM(*str, base+len) = 0; diff --git a/Engine/lib/openal-soft/Alc/hrtf.c b/Engine/lib/openal-soft/Alc/hrtf.c index 02889736c..810530e5c 100644 --- a/Engine/lib/openal-soft/Alc/hrtf.c +++ b/Engine/lib/openal-soft/Alc/hrtf.c @@ -28,8 +28,9 @@ #include "alMain.h" #include "alSource.h" #include "alu.h" -#include "bformatdec.h" #include "hrtf.h" +#include "alconfig.h" +#include "filters/splitter.h" #include "compat.h" #include "almalloc.h" @@ -37,290 +38,447 @@ /* Current data set limits defined by the makehrtf utility. */ #define MIN_IR_SIZE (8) -#define MAX_IR_SIZE (128) +#define MAX_IR_SIZE (512) #define MOD_IR_SIZE (8) +#define MIN_FD_COUNT (1) +#define MAX_FD_COUNT (16) + +#define MIN_FD_DISTANCE (50) +#define MAX_FD_DISTANCE (2500) + #define MIN_EV_COUNT (5) #define MAX_EV_COUNT (128) #define MIN_AZ_COUNT (1) #define MAX_AZ_COUNT (128) +#define MAX_HRIR_DELAY (HRTF_HISTORY_LENGTH-1) + +struct HrtfEntry { + struct HrtfEntry *next; + struct Hrtf *handle; + char filename[]; +}; + static const ALchar magicMarker00[8] = "MinPHR00"; static const ALchar magicMarker01[8] = "MinPHR01"; +static const ALchar magicMarker02[8] = "MinPHR02"; /* First value for pass-through coefficients (remaining are 0), used for omni- * directional sounds. */ -static const ALfloat PassthruCoeff = 32767.0f * 0.707106781187f/*sqrt(0.5)*/; +static const ALfloat PassthruCoeff = 0.707106781187f/*sqrt(0.5)*/; -static struct Hrtf *LoadedHrtfs = NULL; +static ATOMIC_FLAG LoadedHrtfLock = ATOMIC_FLAG_INIT; +static struct HrtfEntry *LoadedHrtfs = NULL; /* Calculate the elevation index given the polar elevation in radians. This - * will return an index between 0 and (evcount - 1). Assumes the FPU is in - * round-to-zero mode. + * will return an index between 0 and (evcount - 1). */ -static ALuint CalcEvIndex(ALuint evcount, ALfloat ev) +static ALsizei CalcEvIndex(ALsizei evcount, ALfloat ev, ALfloat *mu) { - ev = (F_PI_2 + ev) * (evcount-1) / F_PI; - return minu(fastf2u(ev + 0.5f), evcount-1); + ALsizei idx; + ev = (F_PI_2+ev) * (evcount-1) / F_PI; + idx = float2int(ev); + + *mu = ev - idx; + return mini(idx, evcount-1); } /* Calculate the azimuth index given the polar azimuth in radians. This will - * return an index between 0 and (azcount - 1). Assumes the FPU is in round-to- - * zero mode. + * return an index between 0 and (azcount - 1). */ -static ALuint CalcAzIndex(ALuint azcount, ALfloat az) +static ALsizei CalcAzIndex(ALsizei azcount, ALfloat az, ALfloat *mu) { - az = (F_TAU + az) * azcount / F_TAU; - return fastf2u(az + 0.5f) % azcount; + ALsizei idx; + az = (F_TAU+az) * azcount / F_TAU; + + idx = float2int(az); + *mu = az - idx; + return idx % azcount; } /* Calculates static HRIR coefficients and delays for the given polar elevation - * and azimuth in radians. The coefficients are normalized and attenuated by - * the specified gain. + * and azimuth in radians. The coefficients are normalized. */ -void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays) +void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, + ALfloat (*restrict coeffs)[2], ALsizei *delays) { - ALuint evidx, azidx, lidx, ridx; - ALuint azcount, evoffset; + ALsizei evidx, azidx, idx[4]; + ALsizei evoffset; + ALfloat emu, amu[2]; + ALfloat blend[4]; ALfloat dirfact; - ALuint i; + ALsizei i, c; dirfact = 1.0f - (spread / F_TAU); - /* Claculate elevation index. */ - evidx = CalcEvIndex(Hrtf->evCount, elevation); - azcount = Hrtf->azCount[evidx]; + /* Claculate the lower elevation index. */ + evidx = CalcEvIndex(Hrtf->evCount, elevation, &emu); evoffset = Hrtf->evOffset[evidx]; - /* Calculate azimuth index. */ - azidx = CalcAzIndex(Hrtf->azCount[evidx], azimuth); + /* Calculate lower azimuth index. */ + azidx= CalcAzIndex(Hrtf->azCount[evidx], azimuth, &amu[0]); - /* Calculate the HRIR indices for left and right channels. */ - lidx = evoffset + azidx; - ridx = evoffset + ((azcount-azidx) % azcount); - - /* Calculate the HRIR delays. */ - delays[0] = fastf2u(Hrtf->delays[lidx]*dirfact + 0.5f) << HRTFDELAY_BITS; - delays[1] = fastf2u(Hrtf->delays[ridx]*dirfact + 0.5f) << HRTFDELAY_BITS; - - /* Calculate the sample offsets for the HRIR indices. */ - lidx *= Hrtf->irSize; - ridx *= Hrtf->irSize; - - /* Calculate the normalized and attenuated HRIR coefficients. Zero the - * coefficients if gain is too low. - */ - if(gain > 0.0001f) + /* Calculate the lower HRIR indices. */ + idx[0] = evoffset + azidx; + idx[1] = evoffset + ((azidx+1) % Hrtf->azCount[evidx]); + if(evidx < Hrtf->evCount-1) { - gain /= 32767.0f; + /* Increment elevation to the next (upper) index. */ + evidx++; + evoffset = Hrtf->evOffset[evidx]; - i = 0; - coeffs[i][0] = lerp(PassthruCoeff, Hrtf->coeffs[lidx+i], dirfact)*gain; - coeffs[i][1] = lerp(PassthruCoeff, Hrtf->coeffs[ridx+i], dirfact)*gain; - for(i = 1;i < Hrtf->irSize;i++) - { - coeffs[i][0] = Hrtf->coeffs[lidx+i]*gain * dirfact; - coeffs[i][1] = Hrtf->coeffs[ridx+i]*gain * dirfact; - } + /* Calculate upper azimuth index. */ + azidx = CalcAzIndex(Hrtf->azCount[evidx], azimuth, &amu[1]); + + /* Calculate the upper HRIR indices. */ + idx[2] = evoffset + azidx; + idx[3] = evoffset + ((azidx+1) % Hrtf->azCount[evidx]); } else { + /* If the lower elevation is the top index, the upper elevation is the + * same as the lower. + */ + amu[1] = amu[0]; + idx[2] = idx[0]; + idx[3] = idx[1]; + } + + /* Calculate bilinear blending weights, attenuated according to the + * directional panning factor. + */ + blend[0] = (1.0f-emu) * (1.0f-amu[0]) * dirfact; + blend[1] = (1.0f-emu) * ( amu[0]) * dirfact; + blend[2] = ( emu) * (1.0f-amu[1]) * dirfact; + blend[3] = ( emu) * ( amu[1]) * dirfact; + + /* Calculate the blended HRIR delays. */ + delays[0] = float2int( + Hrtf->delays[idx[0]][0]*blend[0] + Hrtf->delays[idx[1]][0]*blend[1] + + Hrtf->delays[idx[2]][0]*blend[2] + Hrtf->delays[idx[3]][0]*blend[3] + 0.5f + ); + delays[1] = float2int( + Hrtf->delays[idx[0]][1]*blend[0] + Hrtf->delays[idx[1]][1]*blend[1] + + Hrtf->delays[idx[2]][1]*blend[2] + Hrtf->delays[idx[3]][1]*blend[3] + 0.5f + ); + + /* Calculate the sample offsets for the HRIR indices. */ + idx[0] *= Hrtf->irSize; + idx[1] *= Hrtf->irSize; + idx[2] *= Hrtf->irSize; + idx[3] *= Hrtf->irSize; + + ASSUME(Hrtf->irSize >= MIN_IR_SIZE && (Hrtf->irSize%MOD_IR_SIZE) == 0); + coeffs = ASSUME_ALIGNED(coeffs, 16); + /* Calculate the blended HRIR coefficients. */ + coeffs[0][0] = PassthruCoeff * (1.0f-dirfact); + coeffs[0][1] = PassthruCoeff * (1.0f-dirfact); + for(i = 1;i < Hrtf->irSize;i++) + { + coeffs[i][0] = 0.0f; + coeffs[i][1] = 0.0f; + } + for(c = 0;c < 4;c++) + { + const ALfloat (*restrict srccoeffs)[2] = ASSUME_ALIGNED(Hrtf->coeffs+idx[c], 16); for(i = 0;i < Hrtf->irSize;i++) { - coeffs[i][0] = 0.0f; - coeffs[i][1] = 0.0f; + coeffs[i][0] += srccoeffs[i][0] * blend[c]; + coeffs[i][1] += srccoeffs[i][1] * blend[c]; } } } -ALuint BuildBFormatHrtf(const struct Hrtf *Hrtf, ALfloat (*coeffs)[HRIR_LENGTH][2], ALuint NumChannels) +void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei NumChannels, const struct AngularPoint *AmbiPoints, const ALfloat (*restrict AmbiMatrix)[MAX_AMBI_COEFFS], ALsizei AmbiCount, const ALfloat *restrict AmbiOrderHFGain) { - static const struct { - ALfloat elevation; - ALfloat azimuth; - } Ambi3DPoints[14] = { - { DEG2RAD( 90.0f), DEG2RAD( 0.0f) }, - { DEG2RAD( 35.0f), DEG2RAD( -45.0f) }, - { DEG2RAD( 35.0f), DEG2RAD( 45.0f) }, - { DEG2RAD( 35.0f), DEG2RAD( 135.0f) }, - { DEG2RAD( 35.0f), DEG2RAD(-135.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( 0.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( 90.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( 180.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( -90.0f) }, - { DEG2RAD(-35.0f), DEG2RAD( -45.0f) }, - { DEG2RAD(-35.0f), DEG2RAD( 45.0f) }, - { DEG2RAD(-35.0f), DEG2RAD( 135.0f) }, - { DEG2RAD(-35.0f), DEG2RAD(-135.0f) }, - { DEG2RAD(-90.0f), DEG2RAD( 0.0f) }, - }; - static const ALfloat Ambi3DMatrix[14][2][MAX_AMBI_COEFFS] = { - { { 0.078851598f, 0.000000000f, 0.070561967f, 0.000000000f }, { 0.0269973975f, 0.0000000000f, 0.0467610443f, 0.0000000000f } }, - { { 0.124051278f, 0.059847972f, 0.059847972f, 0.059847972f }, { 0.0269973975f, 0.0269973975f, 0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, 0.059847972f, 0.059847972f }, { 0.0269973975f, -0.0269973975f, 0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, 0.059847972f, -0.059847972f }, { 0.0269973975f, -0.0269973975f, 0.0269973975f, -0.0269973975f } }, - { { 0.124051278f, 0.059847972f, 0.059847972f, -0.059847972f }, { 0.0269973975f, 0.0269973975f, 0.0269973975f, -0.0269973975f } }, - { { 0.078851598f, 0.000000000f, 0.000000000f, 0.070561967f }, { 0.0269973975f, 0.0000000000f, 0.0000000000f, 0.0467610443f } }, - { { 0.078851598f, -0.070561967f, 0.000000000f, 0.000000000f }, { 0.0269973975f, -0.0467610443f, 0.0000000000f, 0.0000000000f } }, - { { 0.078851598f, 0.000000000f, 0.000000000f, -0.070561967f }, { 0.0269973975f, 0.0000000000f, 0.0000000000f, -0.0467610443f } }, - { { 0.078851598f, 0.070561967f, 0.000000000f, 0.000000000f }, { 0.0269973975f, 0.0467610443f, 0.0000000000f, 0.0000000000f } }, - { { 0.124051278f, 0.059847972f, -0.059847972f, 0.059847972f }, { 0.0269973975f, 0.0269973975f, -0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, -0.059847972f, 0.059847972f }, { 0.0269973975f, -0.0269973975f, -0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, -0.059847972f, -0.059847972f }, { 0.0269973975f, -0.0269973975f, -0.0269973975f, -0.0269973975f } }, - { { 0.124051278f, 0.059847972f, -0.059847972f, -0.059847972f }, { 0.0269973975f, 0.0269973975f, -0.0269973975f, -0.0269973975f } }, - { { 0.078851598f, 0.000000000f, -0.070561967f, 0.000000000f }, { 0.0269973975f, 0.0000000000f, -0.0467610443f, 0.0000000000f } }, - }; -/* Change this to 2 for dual-band HRTF processing. May require a higher quality +/* Set this to 2 for dual-band HRTF processing. May require a higher quality * band-splitter, or better calculation of the new IR length to deal with the * tail generated by the filter. */ #define NUM_BANDS 2 BandSplitter splitter; + ALdouble (*tmpres)[HRIR_LENGTH][2]; + ALsizei idx[HRTF_AMBI_MAX_CHANNELS]; + ALsizei min_delay = HRTF_HISTORY_LENGTH; ALfloat temps[3][HRIR_LENGTH]; - ALuint lidx[14], ridx[14]; - ALuint min_delay = HRTF_HISTORY_LENGTH; - ALuint max_length = 0; - ALuint i, j, c, b; + ALsizei max_length = 0; + ALsizei i, c, b; - assert(NumChannels == 4); - - for(c = 0;c < COUNTOF(Ambi3DPoints);c++) + for(c = 0;c < AmbiCount;c++) { ALuint evidx, azidx; ALuint evoffset; ALuint azcount; /* Calculate elevation index. */ - evidx = (ALuint)floorf((F_PI_2 + Ambi3DPoints[c].elevation) * - (Hrtf->evCount-1)/F_PI + 0.5f); - evidx = minu(evidx, Hrtf->evCount-1); + evidx = (ALsizei)((F_PI_2+AmbiPoints[c].Elev) * (Hrtf->evCount-1) / F_PI + 0.5f); + evidx = clampi(evidx, 0, Hrtf->evCount-1); azcount = Hrtf->azCount[evidx]; evoffset = Hrtf->evOffset[evidx]; /* Calculate azimuth index for this elevation. */ - azidx = (ALuint)floorf((F_TAU+Ambi3DPoints[c].azimuth) * - azcount/F_TAU + 0.5f) % azcount; + azidx = (ALsizei)((F_TAU+AmbiPoints[c].Azim) * azcount / F_TAU + 0.5f) % azcount; /* Calculate indices for left and right channels. */ - lidx[c] = evoffset + azidx; - ridx[c] = evoffset + ((azcount-azidx) % azcount); + idx[c] = evoffset + azidx; - min_delay = minu(min_delay, minu(Hrtf->delays[lidx[c]], Hrtf->delays[ridx[c]])); + min_delay = mini(min_delay, mini(Hrtf->delays[idx[c]][0], Hrtf->delays[idx[c]][1])); } + tmpres = al_calloc(16, NumChannels * sizeof(*tmpres)); + memset(temps, 0, sizeof(temps)); bandsplit_init(&splitter, 400.0f / (ALfloat)Hrtf->sampleRate); - for(c = 0;c < COUNTOF(Ambi3DMatrix);c++) + for(c = 0;c < AmbiCount;c++) { - const ALshort *fir; - ALuint delay; + const ALfloat (*fir)[2] = &Hrtf->coeffs[idx[c] * Hrtf->irSize]; + ALsizei ldelay = Hrtf->delays[idx[c]][0] - min_delay; + ALsizei rdelay = Hrtf->delays[idx[c]][1] - min_delay; - /* Convert the left FIR from shorts to float */ - fir = &Hrtf->coeffs[lidx[c] * Hrtf->irSize]; if(NUM_BANDS == 1) { - for(i = 0;i < Hrtf->irSize;i++) - temps[0][i] = fir[i] / 32767.0f; + max_length = maxi(max_length, + mini(maxi(ldelay, rdelay) + Hrtf->irSize, HRIR_LENGTH) + ); + + for(i = 0;i < NumChannels;++i) + { + ALdouble mult = (ALdouble)AmbiOrderHFGain[(ALsizei)sqrt(i)] * AmbiMatrix[c][i]; + ALsizei lidx = ldelay, ridx = rdelay; + ALsizei j = 0; + while(lidx < HRIR_LENGTH && ridx < HRIR_LENGTH && j < Hrtf->irSize) + { + tmpres[i][lidx++][0] += fir[j][0] * mult; + tmpres[i][ridx++][1] += fir[j][1] * mult; + j++; + } + } } else { + /* Increase the IR size by 2/3rds to account for the tail generated + * by the band-split filter. + */ + const ALsizei irsize = mini(Hrtf->irSize*5/3, HRIR_LENGTH); + + max_length = maxi(max_length, + mini(maxi(ldelay, rdelay) + irsize, HRIR_LENGTH) + ); + /* Band-split left HRIR into low and high frequency responses. */ bandsplit_clear(&splitter); for(i = 0;i < Hrtf->irSize;i++) - temps[2][i] = fir[i] / 32767.0f; + temps[2][i] = fir[i][0]; bandsplit_process(&splitter, temps[0], temps[1], temps[2], HRIR_LENGTH); - } - /* Add to the left output coefficients with the specified delay. */ - delay = Hrtf->delays[lidx[c]] - min_delay; - for(i = 0;i < NumChannels;++i) - { - for(b = 0;b < NUM_BANDS;b++) + /* Apply left ear response with delay. */ + for(i = 0;i < NumChannels;++i) { - ALuint k = 0; - for(j = delay;j < HRIR_LENGTH;++j) - coeffs[i][j][0] += temps[b][k++] * Ambi3DMatrix[c][b][i]; + ALfloat hfgain = AmbiOrderHFGain[(ALsizei)sqrt(i)]; + for(b = 0;b < NUM_BANDS;b++) + { + ALdouble mult = AmbiMatrix[c][i] * (ALdouble)((b==0) ? hfgain : 1.0); + ALsizei lidx = ldelay; + ALsizei j = 0; + while(lidx < HRIR_LENGTH) + tmpres[i][lidx++][0] += temps[b][j++] * mult; + } } - } - max_length = maxu(max_length, minu(delay + Hrtf->irSize, HRIR_LENGTH)); - /* Convert the right FIR from shorts to float */ - fir = &Hrtf->coeffs[ridx[c] * Hrtf->irSize]; - if(NUM_BANDS == 1) - { - for(i = 0;i < Hrtf->irSize;i++) - temps[0][i] = fir[i] / 32767.0f; - } - else - { /* Band-split right HRIR into low and high frequency responses. */ bandsplit_clear(&splitter); for(i = 0;i < Hrtf->irSize;i++) - temps[2][i] = fir[i] / 32767.0f; + temps[2][i] = fir[i][1]; bandsplit_process(&splitter, temps[0], temps[1], temps[2], HRIR_LENGTH); - } - /* Add to the right output coefficients with the specified delay. */ - delay = Hrtf->delays[ridx[c]] - min_delay; - for(i = 0;i < NumChannels;++i) - { - for(b = 0;b < NUM_BANDS;b++) + /* Apply right ear response with delay. */ + for(i = 0;i < NumChannels;++i) { - ALuint k = 0; - for(j = delay;j < HRIR_LENGTH;++j) - coeffs[i][j][1] += temps[b][k++] * Ambi3DMatrix[c][b][i]; + ALfloat hfgain = AmbiOrderHFGain[(ALsizei)sqrt(i)]; + for(b = 0;b < NUM_BANDS;b++) + { + ALdouble mult = AmbiMatrix[c][i] * (ALdouble)((b==0) ? hfgain : 1.0); + ALsizei ridx = rdelay; + ALsizei j = 0; + while(ridx < HRIR_LENGTH) + tmpres[i][ridx++][1] += temps[b][j++] * mult; + } } } - max_length = maxu(max_length, minu(delay + Hrtf->irSize, HRIR_LENGTH)); } - TRACE("Skipped min delay: %u, new combined length: %u\n", min_delay, max_length); -#undef NUM_BANDS + /* Round up to the next IR size multiple. */ + max_length += MOD_IR_SIZE-1; + max_length -= max_length%MOD_IR_SIZE; - return max_length; + for(i = 0;i < NumChannels;++i) + { + int idx; + for(idx = 0;idx < HRIR_LENGTH;idx++) + { + state->Chan[i].Coeffs[idx][0] = (ALfloat)tmpres[i][idx][0]; + state->Chan[i].Coeffs[idx][1] = (ALfloat)tmpres[i][idx][1]; + } + } + + al_free(tmpres); + tmpres = NULL; + + TRACE("Skipped delay: %d, new FIR length: %d\n", min_delay, max_length); + state->IrSize = max_length; +#undef NUM_BANDS } -static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_string filename) +static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, + ALfloat distance, ALsizei evCount, ALsizei irCount, const ALubyte *azCount, + const ALushort *evOffset, const ALfloat (*coeffs)[2], const ALubyte (*delays)[2], + const char *filename) +{ + struct Hrtf *Hrtf; + size_t total; + + total = sizeof(struct Hrtf); + total += sizeof(Hrtf->azCount[0])*evCount; + total = RoundUp(total, sizeof(ALushort)); /* Align for ushort fields */ + total += sizeof(Hrtf->evOffset[0])*evCount; + total = RoundUp(total, 16); /* Align for coefficients using SIMD */ + total += sizeof(Hrtf->coeffs[0])*irSize*irCount; + total += sizeof(Hrtf->delays[0])*irCount; + + Hrtf = al_calloc(16, total); + if(Hrtf == NULL) + ERR("Out of memory allocating storage for %s.\n", filename); + else + { + uintptr_t offset = sizeof(struct Hrtf); + char *base = (char*)Hrtf; + ALushort *_evOffset; + ALubyte *_azCount; + ALubyte (*_delays)[2]; + ALfloat (*_coeffs)[2]; + ALsizei i; + + InitRef(&Hrtf->ref, 0); + Hrtf->sampleRate = rate; + Hrtf->irSize = irSize; + Hrtf->distance = distance; + Hrtf->evCount = evCount; + + /* Set up pointers to storage following the main HRTF struct. */ + _azCount = (ALubyte*)(base + offset); + offset += sizeof(_azCount[0])*evCount; + + offset = RoundUp(offset, sizeof(ALushort)); /* Align for ushort fields */ + _evOffset = (ALushort*)(base + offset); + offset += sizeof(_evOffset[0])*evCount; + + offset = RoundUp(offset, 16); /* Align for coefficients using SIMD */ + _coeffs = (ALfloat(*)[2])(base + offset); + offset += sizeof(_coeffs[0])*irSize*irCount; + + _delays = (ALubyte(*)[2])(base + offset); + offset += sizeof(_delays[0])*irCount; + + assert(offset == total); + + /* Copy input data to storage. */ + for(i = 0;i < evCount;i++) _azCount[i] = azCount[i]; + for(i = 0;i < evCount;i++) _evOffset[i] = evOffset[i]; + for(i = 0;i < irSize*irCount;i++) + { + _coeffs[i][0] = coeffs[i][0]; + _coeffs[i][1] = coeffs[i][1]; + } + for(i = 0;i < irCount;i++) + { + _delays[i][0] = delays[i][0]; + _delays[i][1] = delays[i][1]; + } + + /* Finally, assign the storage pointers. */ + Hrtf->azCount = _azCount; + Hrtf->evOffset = _evOffset; + Hrtf->coeffs = _coeffs; + Hrtf->delays = _delays; + } + + return Hrtf; +} + +static ALubyte GetLE_ALubyte(const ALubyte **data, size_t *len) +{ + ALubyte ret = (*data)[0]; + *data += 1; *len -= 1; + return ret; +} + +static ALshort GetLE_ALshort(const ALubyte **data, size_t *len) +{ + ALshort ret = (*data)[0] | ((*data)[1]<<8); + *data += 2; *len -= 2; + return ret; +} + +static ALushort GetLE_ALushort(const ALubyte **data, size_t *len) +{ + ALushort ret = (*data)[0] | ((*data)[1]<<8); + *data += 2; *len -= 2; + return ret; +} + +static ALint GetLE_ALint24(const ALubyte **data, size_t *len) +{ + ALint ret = (*data)[0] | ((*data)[1]<<8) | ((*data)[2]<<16); + *data += 3; *len -= 3; + return (ret^0x800000) - 0x800000; +} + +static ALuint GetLE_ALuint(const ALubyte **data, size_t *len) +{ + ALuint ret = (*data)[0] | ((*data)[1]<<8) | ((*data)[2]<<16) | ((*data)[3]<<24); + *data += 4; *len -= 4; + return ret; +} + +static const ALubyte *Get_ALubytePtr(const ALubyte **data, size_t *len, size_t size) +{ + const ALubyte *ret = *data; + *data += size; *len -= size; + return ret; +} + +static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const char *filename) { - const ALubyte maxDelay = HRTF_HISTORY_LENGTH-1; struct Hrtf *Hrtf = NULL; ALboolean failed = AL_FALSE; - ALuint rate = 0, irCount = 0; + ALuint rate = 0; + ALushort irCount = 0; ALushort irSize = 0; ALubyte evCount = 0; ALubyte *azCount = NULL; ALushort *evOffset = NULL; - ALshort *coeffs = NULL; - const ALubyte *delays = NULL; - ALuint i, j; + ALfloat (*coeffs)[2] = NULL; + ALubyte (*delays)[2] = NULL; + ALsizei i, j; if(datalen < 9) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", - al_string_get_cstr(filename), 9, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", filename, 9, datalen); return NULL; } - rate = *(data++); - rate |= *(data++)<<8; - rate |= *(data++)<<16; - rate |= *(data++)<<24; - datalen -= 4; + rate = GetLE_ALuint(&data, &datalen); - irCount = *(data++); - irCount |= *(data++)<<8; - datalen -= 2; + irCount = GetLE_ALushort(&data, &datalen); - irSize = *(data++); - irSize |= *(data++)<<8; - datalen -= 2; + irSize = GetLE_ALushort(&data, &datalen); - evCount = *(data++); - datalen -= 1; + evCount = GetLE_ALubyte(&data, &datalen); if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE)) { @@ -337,10 +495,9 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(failed) return NULL; - if(datalen < evCount*2) + if(datalen < evCount*2u) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", - al_string_get_cstr(filename), evCount*2, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", filename, evCount*2, datalen); return NULL; } @@ -354,14 +511,10 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - evOffset[0] = *(data++); - evOffset[0] |= *(data++)<<8; - datalen -= 2; + evOffset[0] = GetLE_ALushort(&data, &datalen); for(i = 1;i < evCount;i++) { - evOffset[i] = *(data++); - evOffset[i] |= *(data++)<<8; - datalen -= 2; + evOffset[i] = GetLE_ALushort(&data, &datalen); if(evOffset[i] <= evOffset[i-1]) { ERR("Invalid evOffset: evOffset[%d]=%d (last=%d)\n", @@ -396,7 +549,8 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(!failed) { coeffs = malloc(sizeof(coeffs[0])*irSize*irCount); - if(coeffs == NULL) + delays = malloc(sizeof(delays[0])*irCount); + if(coeffs == NULL || delays == NULL) { ERR("Out of memory.\n"); failed = AL_TRUE; @@ -409,31 +563,25 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(datalen < reqsize) { ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT")\n", - al_string_get_cstr(filename), reqsize, datalen); + filename, reqsize, datalen); failed = AL_TRUE; } } if(!failed) { - for(i = 0;i < irCount*irSize;i+=irSize) - { - for(j = 0;j < irSize;j++) - { - coeffs[i+j] = *(data++); - coeffs[i+j] |= *(data++)<<8; - datalen -= 2; - } - } - - delays = data; - data += irCount; - datalen -= irCount; for(i = 0;i < irCount;i++) { - if(delays[i] > maxDelay) + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) { - ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i], maxDelay); + ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); failed = AL_TRUE; } } @@ -441,82 +589,59 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - size_t total = sizeof(struct Hrtf); - total += sizeof(azCount[0])*evCount; - total = (total+1)&~1; /* Align for (u)short fields */ - total += sizeof(evOffset[0])*evCount; - total += sizeof(coeffs[0])*irSize*irCount; - total += sizeof(delays[0])*irCount; - total += al_string_length(filename)+1; - - Hrtf = al_calloc(16, total); - if(Hrtf == NULL) + /* Mirror the left ear responses to the right ear. */ + for(i = 0;i < evCount;i++) { - ERR("Out of memory.\n"); - failed = AL_TRUE; + ALushort evoffset = evOffset[i]; + ALubyte azcount = azCount[i]; + for(j = 0;j < azcount;j++) + { + ALsizei lidx = evoffset + j; + ALsizei ridx = evoffset + ((azcount-j) % azcount); + ALsizei k; + + for(k = 0;k < irSize;k++) + coeffs[ridx*irSize + k][1] = coeffs[lidx*irSize + k][0]; + delays[ridx][1] = delays[lidx][0]; + } } - } - if(!failed) - { - char *base = (char*)Hrtf; - uintptr_t offset = sizeof(*Hrtf); - - Hrtf->sampleRate = rate; - Hrtf->irSize = irSize; - Hrtf->evCount = evCount; - Hrtf->azCount = ((ALubyte*)(base + offset)); offset += evCount*sizeof(Hrtf->azCount[0]); - offset = (offset+1)&~1; /* Align for (u)short fields */ - Hrtf->evOffset = ((ALushort*)(base + offset)); offset += evCount*sizeof(Hrtf->evOffset[0]); - Hrtf->coeffs = ((ALshort*)(base + offset)); offset += irSize*irCount*sizeof(Hrtf->coeffs[0]); - Hrtf->delays = ((ALubyte*)(base + offset)); offset += irCount*sizeof(Hrtf->delays[0]); - Hrtf->filename = ((char*)(base + offset)); - Hrtf->next = NULL; - - memcpy((void*)Hrtf->azCount, azCount, sizeof(azCount[0])*evCount); - memcpy((void*)Hrtf->evOffset, evOffset, sizeof(evOffset[0])*evCount); - memcpy((void*)Hrtf->coeffs, coeffs, sizeof(coeffs[0])*irSize*irCount); - memcpy((void*)Hrtf->delays, delays, sizeof(delays[0])*irCount); - memcpy((void*)Hrtf->filename, al_string_get_cstr(filename), al_string_length(filename)+1); + Hrtf = CreateHrtfStore(rate, irSize, 0.0f, evCount, irCount, azCount, + evOffset, coeffs, delays, filename); } free(azCount); free(evOffset); free(coeffs); + free(delays); return Hrtf; } -static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_string filename) +static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const char *filename) { - const ALubyte maxDelay = HRTF_HISTORY_LENGTH-1; struct Hrtf *Hrtf = NULL; ALboolean failed = AL_FALSE; - ALuint rate = 0, irCount = 0; - ALubyte irSize = 0, evCount = 0; + ALuint rate = 0; + ALushort irCount = 0; + ALushort irSize = 0; + ALubyte evCount = 0; const ALubyte *azCount = NULL; ALushort *evOffset = NULL; - ALshort *coeffs = NULL; - const ALubyte *delays = NULL; - ALuint i, j; + ALfloat (*coeffs)[2] = NULL; + ALubyte (*delays)[2] = NULL; + ALsizei i, j; if(datalen < 6) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", - al_string_get_cstr(filename), 6, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 6, datalen); return NULL; } - rate = *(data++); - rate |= *(data++)<<8; - rate |= *(data++)<<16; - rate |= *(data++)<<24; - datalen -= 4; + rate = GetLE_ALuint(&data, &datalen); - irSize = *(data++); - datalen -= 1; + irSize = GetLE_ALubyte(&data, &datalen); - evCount = *(data++); - datalen -= 1; + evCount = GetLE_ALubyte(&data, &datalen); if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE)) { @@ -535,14 +660,11 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(datalen < evCount) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", - al_string_get_cstr(filename), evCount, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, evCount, datalen); return NULL; } - azCount = data; - data += evCount; - datalen -= evCount; + azCount = Get_ALubytePtr(&data, &datalen, evCount); evOffset = malloc(sizeof(evOffset[0])*evCount); if(azCount == NULL || evOffset == NULL) @@ -575,7 +697,8 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str } coeffs = malloc(sizeof(coeffs[0])*irSize*irCount); - if(coeffs == NULL) + delays = malloc(sizeof(delays[0])*irCount); + if(coeffs == NULL || delays == NULL) { ERR("Out of memory.\n"); failed = AL_TRUE; @@ -588,33 +711,25 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(datalen < reqsize) { ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT"\n", - al_string_get_cstr(filename), reqsize, datalen); + filename, reqsize, datalen); failed = AL_TRUE; } } if(!failed) { - for(i = 0;i < irCount*irSize;i+=irSize) - { - for(j = 0;j < irSize;j++) - { - ALshort coeff; - coeff = *(data++); - coeff |= *(data++)<<8; - datalen -= 2; - coeffs[i+j] = coeff; - } - } - - delays = data; - data += irCount; - datalen -= irCount; for(i = 0;i < irCount;i++) { - if(delays[i] > maxDelay) + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) { - ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i], maxDelay); + ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); failed = AL_TRUE; } } @@ -622,16 +737,163 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - size_t total = sizeof(struct Hrtf); - total += sizeof(azCount[0])*evCount; - total = (total+1)&~1; /* Align for (u)short fields */ - total += sizeof(evOffset[0])*evCount; - total += sizeof(coeffs[0])*irSize*irCount; - total += sizeof(delays[0])*irCount; - total += al_string_length(filename)+1; + /* Mirror the left ear responses to the right ear. */ + for(i = 0;i < evCount;i++) + { + ALushort evoffset = evOffset[i]; + ALubyte azcount = azCount[i]; + for(j = 0;j < azcount;j++) + { + ALsizei lidx = evoffset + j; + ALsizei ridx = evoffset + ((azcount-j) % azcount); + ALsizei k; - Hrtf = al_calloc(16, total); - if(Hrtf == NULL) + for(k = 0;k < irSize;k++) + coeffs[ridx*irSize + k][1] = coeffs[lidx*irSize + k][0]; + delays[ridx][1] = delays[lidx][0]; + } + } + + Hrtf = CreateHrtfStore(rate, irSize, 0.0f, evCount, irCount, azCount, + evOffset, coeffs, delays, filename); + } + + free(evOffset); + free(coeffs); + free(delays); + return Hrtf; +} + +#define SAMPLETYPE_S16 0 +#define SAMPLETYPE_S24 1 + +#define CHANTYPE_LEFTONLY 0 +#define CHANTYPE_LEFTRIGHT 1 + +static struct Hrtf *LoadHrtf02(const ALubyte *data, size_t datalen, const char *filename) +{ + struct Hrtf *Hrtf = NULL; + ALboolean failed = AL_FALSE; + ALuint rate = 0; + ALubyte sampleType; + ALubyte channelType; + ALushort irCount = 0; + ALushort irSize = 0; + ALubyte fdCount = 0; + ALushort distance = 0; + ALubyte evCount = 0; + const ALubyte *azCount = NULL; + ALushort *evOffset = NULL; + ALfloat (*coeffs)[2] = NULL; + ALubyte (*delays)[2] = NULL; + ALsizei i, j; + + if(datalen < 8) + { + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 8, datalen); + return NULL; + } + + rate = GetLE_ALuint(&data, &datalen); + sampleType = GetLE_ALubyte(&data, &datalen); + channelType = GetLE_ALubyte(&data, &datalen); + + irSize = GetLE_ALubyte(&data, &datalen); + + fdCount = GetLE_ALubyte(&data, &datalen); + + if(sampleType > SAMPLETYPE_S24) + { + ERR("Unsupported sample type: %d\n", sampleType); + failed = AL_TRUE; + } + if(channelType > CHANTYPE_LEFTRIGHT) + { + ERR("Unsupported channel type: %d\n", channelType); + failed = AL_TRUE; + } + + if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE)) + { + ERR("Unsupported HRIR size: irSize=%d (%d to %d by %d)\n", + irSize, MIN_IR_SIZE, MAX_IR_SIZE, MOD_IR_SIZE); + failed = AL_TRUE; + } + if(fdCount != 1) + { + ERR("Multiple field-depths not supported: fdCount=%d (%d to %d)\n", + evCount, MIN_FD_COUNT, MAX_FD_COUNT); + failed = AL_TRUE; + } + if(failed) + return NULL; + + for(i = 0;i < fdCount;i++) + { + if(datalen < 3) + { + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 3, datalen); + return NULL; + } + + distance = GetLE_ALushort(&data, &datalen); + if(distance < MIN_FD_DISTANCE || distance > MAX_FD_DISTANCE) + { + ERR("Unsupported field distance: distance=%d (%dmm to %dmm)\n", + distance, MIN_FD_DISTANCE, MAX_FD_DISTANCE); + failed = AL_TRUE; + } + + evCount = GetLE_ALubyte(&data, &datalen); + if(evCount < MIN_EV_COUNT || evCount > MAX_EV_COUNT) + { + ERR("Unsupported elevation count: evCount=%d (%d to %d)\n", + evCount, MIN_EV_COUNT, MAX_EV_COUNT); + failed = AL_TRUE; + } + if(failed) + return NULL; + + if(datalen < evCount) + { + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, evCount, datalen); + return NULL; + } + + azCount = Get_ALubytePtr(&data, &datalen, evCount); + for(j = 0;j < evCount;j++) + { + if(azCount[j] < MIN_AZ_COUNT || azCount[j] > MAX_AZ_COUNT) + { + ERR("Unsupported azimuth count: azCount[%d]=%d (%d to %d)\n", + j, azCount[j], MIN_AZ_COUNT, MAX_AZ_COUNT); + failed = AL_TRUE; + } + } + } + if(failed) + return NULL; + + evOffset = malloc(sizeof(evOffset[0])*evCount); + if(azCount == NULL || evOffset == NULL) + { + ERR("Out of memory.\n"); + failed = AL_TRUE; + } + + if(!failed) + { + evOffset[0] = 0; + irCount = azCount[0]; + for(i = 1;i < evCount;i++) + { + evOffset[i] = evOffset[i-1] + azCount[i-1]; + irCount += azCount[i]; + } + + coeffs = malloc(sizeof(coeffs[0])*irSize*irCount); + delays = malloc(sizeof(delays[0])*irCount); + if(coeffs == NULL || delays == NULL) { ERR("Out of memory.\n"); failed = AL_TRUE; @@ -640,108 +902,164 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - char *base = (char*)Hrtf; - uintptr_t offset = sizeof(*Hrtf); + size_t reqsize = 2*irSize*irCount + irCount; + if(datalen < reqsize) + { + ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT"\n", + filename, reqsize, datalen); + failed = AL_TRUE; + } + } - Hrtf->sampleRate = rate; - Hrtf->irSize = irSize; - Hrtf->evCount = evCount; - Hrtf->azCount = ((ALubyte*)(base + offset)); offset += evCount*sizeof(Hrtf->azCount[0]); - offset = (offset+1)&~1; /* Align for (u)short fields */ - Hrtf->evOffset = ((ALushort*)(base + offset)); offset += evCount*sizeof(Hrtf->evOffset[0]); - Hrtf->coeffs = ((ALshort*)(base + offset)); offset += irSize*irCount*sizeof(Hrtf->coeffs[0]); - Hrtf->delays = ((ALubyte*)(base + offset)); offset += irCount*sizeof(Hrtf->delays[0]); - Hrtf->filename = ((char*)(base + offset)); - Hrtf->next = NULL; + if(!failed) + { + if(channelType == CHANTYPE_LEFTONLY) + { + if(sampleType == SAMPLETYPE_S16) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + else if(sampleType == SAMPLETYPE_S24) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALint24(&data, &datalen) / 8388608.0f; + } - memcpy((void*)Hrtf->azCount, azCount, sizeof(azCount[0])*evCount); - memcpy((void*)Hrtf->evOffset, evOffset, sizeof(evOffset[0])*evCount); - memcpy((void*)Hrtf->coeffs, coeffs, sizeof(coeffs[0])*irSize*irCount); - memcpy((void*)Hrtf->delays, delays, sizeof(delays[0])*irCount); - memcpy((void*)Hrtf->filename, al_string_get_cstr(filename), al_string_length(filename)+1); + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) + { + ERR("Invalid delays[%d][0]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); + failed = AL_TRUE; + } + } + } + else if(channelType == CHANTYPE_LEFTRIGHT) + { + if(sampleType == SAMPLETYPE_S16) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + { + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + coeffs[i*irSize + j][1] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + } + else if(sampleType == SAMPLETYPE_S24) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + { + coeffs[i*irSize + j][0] = GetLE_ALint24(&data, &datalen) / 8388608.0f; + coeffs[i*irSize + j][1] = GetLE_ALint24(&data, &datalen) / 8388608.0f; + } + } + + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) + { + ERR("Invalid delays[%d][0]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); + failed = AL_TRUE; + } + delays[i][1] = GetLE_ALubyte(&data, &datalen); + if(delays[i][1] > MAX_HRIR_DELAY) + { + ERR("Invalid delays[%d][1]: %d (%d)\n", i, delays[i][1], MAX_HRIR_DELAY); + failed = AL_TRUE; + } + } + } + } + + if(!failed) + { + if(channelType == CHANTYPE_LEFTONLY) + { + /* Mirror the left ear responses to the right ear. */ + for(i = 0;i < evCount;i++) + { + ALushort evoffset = evOffset[i]; + ALubyte azcount = azCount[i]; + for(j = 0;j < azcount;j++) + { + ALsizei lidx = evoffset + j; + ALsizei ridx = evoffset + ((azcount-j) % azcount); + ALsizei k; + + for(k = 0;k < irSize;k++) + coeffs[ridx*irSize + k][1] = coeffs[lidx*irSize + k][0]; + delays[ridx][1] = delays[lidx][0]; + } + } + } + + Hrtf = CreateHrtfStore(rate, irSize, + (ALfloat)distance / 1000.0f, evCount, irCount, azCount, evOffset, + coeffs, delays, filename + ); } free(evOffset); free(coeffs); + free(delays); return Hrtf; } -static void AddFileEntry(vector_HrtfEntry *list, al_string *filename) + +static void AddFileEntry(vector_EnumeratedHrtf *list, const_al_string filename) { - HrtfEntry entry = { AL_STRING_INIT_STATIC(), NULL }; - struct Hrtf *hrtf = NULL; - const HrtfEntry *iter; - struct FileMapping fmap; + EnumeratedHrtf entry = { AL_STRING_INIT_STATIC(), NULL }; + struct HrtfEntry *loaded_entry; + const EnumeratedHrtf *iter; const char *name; const char *ext; int i; -#define MATCH_FNAME(i) (al_string_cmp_cstr(*filename, (i)->hrtf->filename) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME); - if(iter != VECTOR_END(*list)) + /* Check if this file has already been loaded globally. */ + loaded_entry = LoadedHrtfs; + while(loaded_entry) { - TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename)); - goto done; - } + if(alstr_cmp_cstr(filename, loaded_entry->filename) == 0) + { + /* Check if this entry has already been added to the list. */ +#define MATCH_ENTRY(i) (loaded_entry == (i)->hrtf) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_ENTRY); + if(iter != VECTOR_END(*list)) + { + TRACE("Skipping duplicate file entry %s\n", alstr_get_cstr(filename)); + return; + } #undef MATCH_FNAME - entry.hrtf = LoadedHrtfs; - while(entry.hrtf) - { - if(al_string_cmp_cstr(*filename, entry.hrtf->filename) == 0) - { - TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(*filename)); - goto skip_load; + break; } - entry.hrtf = entry.hrtf->next; + loaded_entry = loaded_entry->next; } - TRACE("Loading %s...\n", al_string_get_cstr(*filename)); - fmap = MapFileToMem(al_string_get_cstr(*filename)); - if(fmap.ptr == NULL) + if(!loaded_entry) { - ERR("Could not open %s\n", al_string_get_cstr(*filename)); - goto done; - } + TRACE("Got new file \"%s\"\n", alstr_get_cstr(filename)); - if(fmap.len < sizeof(magicMarker01)) - ERR("%s data is too short ("SZFMT" bytes)\n", al_string_get_cstr(*filename), fmap.len); - else if(memcmp(fmap.ptr, magicMarker01, sizeof(magicMarker01)) == 0) - { - TRACE("Detected data set format v1\n"); - hrtf = LoadHrtf01((const ALubyte*)fmap.ptr+sizeof(magicMarker01), - fmap.len-sizeof(magicMarker01), *filename + loaded_entry = al_calloc(DEF_ALIGN, + FAM_SIZE(struct HrtfEntry, filename, alstr_length(filename)+1) ); - } - else if(memcmp(fmap.ptr, magicMarker00, sizeof(magicMarker00)) == 0) - { - TRACE("Detected data set format v0\n"); - hrtf = LoadHrtf00((const ALubyte*)fmap.ptr+sizeof(magicMarker00), - fmap.len-sizeof(magicMarker00), *filename - ); - } - else - ERR("Invalid header in %s: \"%.8s\"\n", al_string_get_cstr(*filename), (const char*)fmap.ptr); - UnmapFileMem(&fmap); - - if(!hrtf) - { - ERR("Failed to load %s\n", al_string_get_cstr(*filename)); - goto done; + loaded_entry->next = LoadedHrtfs; + loaded_entry->handle = NULL; + strcpy(loaded_entry->filename, alstr_get_cstr(filename)); + LoadedHrtfs = loaded_entry; } - hrtf->next = LoadedHrtfs; - LoadedHrtfs = hrtf; - TRACE("Loaded HRTF support for format: %s %uhz\n", - DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate); - entry.hrtf = hrtf; - -skip_load: /* TODO: Get a human-readable name from the HRTF data (possibly coming in a * format update). */ - name = strrchr(al_string_get_cstr(*filename), '/'); - if(!name) name = strrchr(al_string_get_cstr(*filename), '\\'); - if(!name) name = al_string_get_cstr(*filename); + name = strrchr(alstr_get_cstr(filename), '/'); + if(!name) name = strrchr(alstr_get_cstr(filename), '\\'); + if(!name) name = alstr_get_cstr(filename); else ++name; ext = strrchr(name, '.'); @@ -749,124 +1067,114 @@ skip_load: i = 0; do { if(!ext) - al_string_copy_cstr(&entry.name, name); + alstr_copy_cstr(&entry.name, name); else - al_string_copy_range(&entry.name, name, ext); + alstr_copy_range(&entry.name, name, ext); if(i != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", i+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } ++i; -#define MATCH_NAME(i) (al_string_cmp(entry.name, (i)->name) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_NAME); +#define MATCH_NAME(i) (alstr_cmp(entry.name, (i)->name) == 0) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_NAME); #undef MATCH_NAME } while(iter != VECTOR_END(*list)); + entry.hrtf = loaded_entry; - TRACE("Adding entry \"%s\" from file \"%s\"\n", al_string_get_cstr(entry.name), - al_string_get_cstr(*filename)); + TRACE("Adding entry \"%s\" from file \"%s\"\n", alstr_get_cstr(entry.name), + alstr_get_cstr(filename)); VECTOR_PUSH_BACK(*list, entry); - -done: - al_string_deinit(filename); } /* Unfortunate that we have to duplicate AddFileEntry to take a memory buffer * for input instead of opening the given filename. */ -static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t datalen, al_string *filename) +static void AddBuiltInEntry(vector_EnumeratedHrtf *list, const_al_string filename, ALuint residx) { - HrtfEntry entry = { AL_STRING_INIT_STATIC(), NULL }; + EnumeratedHrtf entry = { AL_STRING_INIT_STATIC(), NULL }; + struct HrtfEntry *loaded_entry; struct Hrtf *hrtf = NULL; - const HrtfEntry *iter; + const EnumeratedHrtf *iter; + const char *name; + const char *ext; int i; -#define MATCH_FNAME(i) (al_string_cmp_cstr(*filename, (i)->hrtf->filename) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME); - if(iter != VECTOR_END(*list)) + loaded_entry = LoadedHrtfs; + while(loaded_entry) { - TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename)); - goto done; - } + if(alstr_cmp_cstr(filename, loaded_entry->filename) == 0) + { +#define MATCH_ENTRY(i) (loaded_entry == (i)->hrtf) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_ENTRY); + if(iter != VECTOR_END(*list)) + { + TRACE("Skipping duplicate file entry %s\n", alstr_get_cstr(filename)); + return; + } #undef MATCH_FNAME - entry.hrtf = LoadedHrtfs; - while(entry.hrtf) - { - if(al_string_cmp_cstr(*filename, entry.hrtf->filename) == 0) - { - TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(*filename)); - goto skip_load; + break; } - entry.hrtf = entry.hrtf->next; + loaded_entry = loaded_entry->next; } - TRACE("Loading %s...\n", al_string_get_cstr(*filename)); - if(datalen < sizeof(magicMarker01)) + if(!loaded_entry) { - ERR("%s data is too short ("SZFMT" bytes)\n", al_string_get_cstr(*filename), datalen); - goto done; - } + size_t namelen = alstr_length(filename)+32; - if(memcmp(data, magicMarker01, sizeof(magicMarker01)) == 0) - { - TRACE("Detected data set format v1\n"); - hrtf = LoadHrtf01(data+sizeof(magicMarker01), - datalen-sizeof(magicMarker01), *filename + TRACE("Got new file \"%s\"\n", alstr_get_cstr(filename)); + + loaded_entry = al_calloc(DEF_ALIGN, + FAM_SIZE(struct HrtfEntry, filename, namelen) ); - } - else if(memcmp(data, magicMarker00, sizeof(magicMarker00)) == 0) - { - TRACE("Detected data set format v0\n"); - hrtf = LoadHrtf00(data+sizeof(magicMarker00), - datalen-sizeof(magicMarker00), *filename - ); - } - else - ERR("Invalid header in %s: \"%.8s\"\n", al_string_get_cstr(*filename), data); - - if(!hrtf) - { - ERR("Failed to load %s\n", al_string_get_cstr(*filename)); - goto done; + loaded_entry->next = LoadedHrtfs; + loaded_entry->handle = hrtf; + snprintf(loaded_entry->filename, namelen, "!%u_%s", + residx, alstr_get_cstr(filename)); + LoadedHrtfs = loaded_entry; } - hrtf->next = LoadedHrtfs; - LoadedHrtfs = hrtf; - TRACE("Loaded HRTF support for format: %s %uhz\n", - DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate); - entry.hrtf = hrtf; + /* TODO: Get a human-readable name from the HRTF data (possibly coming in a + * format update). */ + name = strrchr(alstr_get_cstr(filename), '/'); + if(!name) name = strrchr(alstr_get_cstr(filename), '\\'); + if(!name) name = alstr_get_cstr(filename); + else ++name; + + ext = strrchr(name, '.'); -skip_load: i = 0; do { - al_string_copy(&entry.name, *filename); + if(!ext) + alstr_copy_cstr(&entry.name, name); + else + alstr_copy_range(&entry.name, name, ext); if(i != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", i+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } ++i; -#define MATCH_NAME(i) (al_string_cmp(entry.name, (i)->name) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_NAME); +#define MATCH_NAME(i) (alstr_cmp(entry.name, (i)->name) == 0) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_NAME); #undef MATCH_NAME } while(iter != VECTOR_END(*list)); + entry.hrtf = loaded_entry; - TRACE("Adding built-in entry \"%s\"\n", al_string_get_cstr(entry.name)); + TRACE("Adding built-in entry \"%s\"\n", alstr_get_cstr(entry.name)); VECTOR_PUSH_BACK(*list, entry); - -done: - al_string_deinit(filename); } +#define IDR_DEFAULT_44100_MHR 1 +#define IDR_DEFAULT_48000_MHR 2 + #ifndef ALSOFT_EMBED_HRTF_DATA -#define IDR_DEFAULT_44100_MHR 0 -#define IDR_DEFAULT_48000_MHR 1 static const ALubyte *GetResource(int UNUSED(name), size_t *size) { @@ -875,72 +1183,37 @@ static const ALubyte *GetResource(int UNUSED(name), size_t *size) } #else -#include "hrtf_res.h" -#ifdef _WIN32 -static const ALubyte *GetResource(int name, size_t *size) -{ - HMODULE handle; - HGLOBAL res; - HRSRC rc; - - GetModuleHandleExW( - GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - (LPCWSTR)GetResource, &handle - ); - rc = FindResourceW(handle, MAKEINTRESOURCEW(name), MAKEINTRESOURCEW(MHRTYPE)); - res = LoadResource(handle, rc); - - *size = SizeofResource(handle, rc); - return LockResource(res); -} - -#else - -extern const ALubyte _binary_default_44100_mhr_start[] HIDDEN_DECL; -extern const ALubyte _binary_default_44100_mhr_end[] HIDDEN_DECL; -extern const ALubyte _binary_default_44100_mhr_size[] HIDDEN_DECL; - -extern const ALubyte _binary_default_48000_mhr_start[] HIDDEN_DECL; -extern const ALubyte _binary_default_48000_mhr_end[] HIDDEN_DECL; -extern const ALubyte _binary_default_48000_mhr_size[] HIDDEN_DECL; +#include "default-44100.mhr.h" +#include "default-48000.mhr.h" static const ALubyte *GetResource(int name, size_t *size) { if(name == IDR_DEFAULT_44100_MHR) { - /* Make sure all symbols are referenced, to ensure the compiler won't - * ignore the declarations and lose the visibility attribute used to - * hide them (would be nice if ld or objcopy could automatically mark - * them as hidden when generating them, but apparently they can't). - */ - const void *volatile ptr =_binary_default_44100_mhr_size; - (void)ptr; - *size = _binary_default_44100_mhr_end - _binary_default_44100_mhr_start; - return _binary_default_44100_mhr_start; + *size = sizeof(hrtf_default_44100); + return hrtf_default_44100; } if(name == IDR_DEFAULT_48000_MHR) { - const void *volatile ptr =_binary_default_48000_mhr_size; - (void)ptr; - *size = _binary_default_48000_mhr_end - _binary_default_48000_mhr_start; - return _binary_default_48000_mhr_start; + *size = sizeof(hrtf_default_48000); + return hrtf_default_48000; } *size = 0; return NULL; } #endif -#endif -vector_HrtfEntry EnumerateHrtf(const_al_string devname) +vector_EnumeratedHrtf EnumerateHrtf(const_al_string devname) { - vector_HrtfEntry list = VECTOR_INIT_STATIC(); + vector_EnumeratedHrtf list = VECTOR_INIT_STATIC(); const char *defaulthrtf = ""; const char *pathlist = ""; bool usedefaults = true; - if(ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf-paths", &pathlist)) + if(ConfigValueStr(alstr_get_cstr(devname), NULL, "hrtf-paths", &pathlist)) { + al_string pname = AL_STRING_INIT_STATIC(); while(pathlist && *pathlist) { const char *next, *end; @@ -963,65 +1236,69 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname) --end; if(end != pathlist) { - al_string pname = AL_STRING_INIT_STATIC(); vector_al_string flist; + size_t i; - al_string_append_range(&pname, pathlist, end); + alstr_copy_range(&pname, pathlist, end); - flist = SearchDataFiles(".mhr", al_string_get_cstr(pname)); - VECTOR_FOR_EACH_PARAMS(al_string, flist, AddFileEntry, &list); + flist = SearchDataFiles(".mhr", alstr_get_cstr(pname)); + for(i = 0;i < VECTOR_SIZE(flist);i++) + AddFileEntry(&list, VECTOR_ELEM(flist, i)); + VECTOR_FOR_EACH(al_string, flist, alstr_reset); VECTOR_DEINIT(flist); - - al_string_deinit(&pname); } pathlist = next; } + + alstr_reset(&pname); } - else if(ConfigValueExists(al_string_get_cstr(devname), NULL, "hrtf_tables")) + else if(ConfigValueExists(alstr_get_cstr(devname), NULL, "hrtf_tables")) ERR("The hrtf_tables option is deprecated, please use hrtf-paths instead.\n"); if(usedefaults) { + al_string ename = AL_STRING_INIT_STATIC(); vector_al_string flist; const ALubyte *rdata; - size_t rsize; + size_t rsize, i; flist = SearchDataFiles(".mhr", "openal/hrtf"); - VECTOR_FOR_EACH_PARAMS(al_string, flist, AddFileEntry, &list); + for(i = 0;i < VECTOR_SIZE(flist);i++) + AddFileEntry(&list, VECTOR_ELEM(flist, i)); + VECTOR_FOR_EACH(al_string, flist, alstr_reset); VECTOR_DEINIT(flist); rdata = GetResource(IDR_DEFAULT_44100_MHR, &rsize); if(rdata != NULL && rsize > 0) { - al_string ename = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&ename, "Built-In 44100hz"); - AddBuiltInEntry(&list, rdata, rsize, &ename); + alstr_copy_cstr(&ename, "Built-In 44100hz"); + AddBuiltInEntry(&list, ename, IDR_DEFAULT_44100_MHR); } rdata = GetResource(IDR_DEFAULT_48000_MHR, &rsize); if(rdata != NULL && rsize > 0) { - al_string ename = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&ename, "Built-In 48000hz"); - AddBuiltInEntry(&list, rdata, rsize, &ename); + alstr_copy_cstr(&ename, "Built-In 48000hz"); + AddBuiltInEntry(&list, ename, IDR_DEFAULT_48000_MHR); } + alstr_reset(&ename); } - if(VECTOR_SIZE(list) > 1 && ConfigValueStr(al_string_get_cstr(devname), NULL, "default-hrtf", &defaulthrtf)) + if(VECTOR_SIZE(list) > 1 && ConfigValueStr(alstr_get_cstr(devname), NULL, "default-hrtf", &defaulthrtf)) { - const HrtfEntry *iter; + const EnumeratedHrtf *iter; /* Find the preferred HRTF and move it to the front of the list. */ -#define FIND_ENTRY(i) (al_string_cmp_cstr((i)->name, defaulthrtf) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, list, FIND_ENTRY); +#define FIND_ENTRY(i) (alstr_cmp_cstr((i)->name, defaulthrtf) == 0) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, list, FIND_ENTRY); #undef FIND_ENTRY if(iter == VECTOR_END(list)) WARN("Failed to find default HRTF \"%s\"\n", defaulthrtf); else if(iter != VECTOR_BEGIN(list)) { - HrtfEntry entry = *iter; + EnumeratedHrtf entry = *iter; memmove(&VECTOR_ELEM(list,1), &VECTOR_ELEM(list,0), - (iter-VECTOR_BEGIN(list))*sizeof(HrtfEntry)); + (iter-VECTOR_BEGIN(list))*sizeof(EnumeratedHrtf)); VECTOR_ELEM(list,0) = entry; } } @@ -1029,25 +1306,155 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname) return list; } -void FreeHrtfList(vector_HrtfEntry *list) +void FreeHrtfList(vector_EnumeratedHrtf *list) { -#define CLEAR_ENTRY(i) do { \ - al_string_deinit(&(i)->name); \ -} while(0) - VECTOR_FOR_EACH(HrtfEntry, *list, CLEAR_ENTRY); +#define CLEAR_ENTRY(i) alstr_reset(&(i)->name) + VECTOR_FOR_EACH(EnumeratedHrtf, *list, CLEAR_ENTRY); VECTOR_DEINIT(*list); #undef CLEAR_ENTRY } +struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry) +{ + struct Hrtf *hrtf = NULL; + struct FileMapping fmap; + const ALubyte *rdata; + const char *name; + ALuint residx; + size_t rsize; + char ch; + + while(ATOMIC_FLAG_TEST_AND_SET(&LoadedHrtfLock, almemory_order_seq_cst)) + althrd_yield(); + + if(entry->handle) + { + hrtf = entry->handle; + Hrtf_IncRef(hrtf); + goto done; + } + + fmap.ptr = NULL; + fmap.len = 0; + if(sscanf(entry->filename, "!%u%c", &residx, &ch) == 2 && ch == '_') + { + name = strchr(entry->filename, ch)+1; + + TRACE("Loading %s...\n", name); + rdata = GetResource(residx, &rsize); + if(rdata == NULL || rsize == 0) + { + ERR("Could not get resource %u, %s\n", residx, name); + goto done; + } + } + else + { + name = entry->filename; + + TRACE("Loading %s...\n", entry->filename); + fmap = MapFileToMem(entry->filename); + if(fmap.ptr == NULL) + { + ERR("Could not open %s\n", entry->filename); + goto done; + } + + rdata = fmap.ptr; + rsize = fmap.len; + } + + if(rsize < sizeof(magicMarker02)) + ERR("%s data is too short ("SZFMT" bytes)\n", name, rsize); + else if(memcmp(rdata, magicMarker02, sizeof(magicMarker02)) == 0) + { + TRACE("Detected data set format v2\n"); + hrtf = LoadHrtf02(rdata+sizeof(magicMarker02), + rsize-sizeof(magicMarker02), name + ); + } + else if(memcmp(rdata, magicMarker01, sizeof(magicMarker01)) == 0) + { + TRACE("Detected data set format v1\n"); + hrtf = LoadHrtf01(rdata+sizeof(magicMarker01), + rsize-sizeof(magicMarker01), name + ); + } + else if(memcmp(rdata, magicMarker00, sizeof(magicMarker00)) == 0) + { + TRACE("Detected data set format v0\n"); + hrtf = LoadHrtf00(rdata+sizeof(magicMarker00), + rsize-sizeof(magicMarker00), name + ); + } + else + ERR("Invalid header in %s: \"%.8s\"\n", name, (const char*)rdata); + if(fmap.ptr) + UnmapFileMem(&fmap); + + if(!hrtf) + { + ERR("Failed to load %s\n", name); + goto done; + } + entry->handle = hrtf; + Hrtf_IncRef(hrtf); + + TRACE("Loaded HRTF support for format: %s %uhz\n", + DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate); + +done: + ATOMIC_FLAG_CLEAR(&LoadedHrtfLock, almemory_order_seq_cst); + return hrtf; +} + + +void Hrtf_IncRef(struct Hrtf *hrtf) +{ + uint ref = IncrementRef(&hrtf->ref); + TRACEREF("%p increasing refcount to %u\n", hrtf, ref); +} + +void Hrtf_DecRef(struct Hrtf *hrtf) +{ + struct HrtfEntry *Hrtf; + uint ref = DecrementRef(&hrtf->ref); + TRACEREF("%p decreasing refcount to %u\n", hrtf, ref); + if(ref == 0) + { + while(ATOMIC_FLAG_TEST_AND_SET(&LoadedHrtfLock, almemory_order_seq_cst)) + althrd_yield(); + + Hrtf = LoadedHrtfs; + while(Hrtf != NULL) + { + /* Need to double-check that it's still unused, as another device + * could've reacquired this HRTF after its reference went to 0 and + * before the lock was taken. + */ + if(hrtf == Hrtf->handle && ReadRef(&hrtf->ref) == 0) + { + al_free(Hrtf->handle); + Hrtf->handle = NULL; + TRACE("Unloaded unused HRTF %s\n", Hrtf->filename); + } + Hrtf = Hrtf->next; + } + + ATOMIC_FLAG_CLEAR(&LoadedHrtfLock, almemory_order_seq_cst); + } +} + void FreeHrtfs(void) { - struct Hrtf *Hrtf = LoadedHrtfs; + struct HrtfEntry *Hrtf = LoadedHrtfs; LoadedHrtfs = NULL; while(Hrtf != NULL) { - struct Hrtf *next = Hrtf->next; + struct HrtfEntry *next = Hrtf->next; + al_free(Hrtf->handle); al_free(Hrtf); Hrtf = next; } diff --git a/Engine/lib/openal-soft/Alc/hrtf.h b/Engine/lib/openal-soft/Alc/hrtf.h index ebba0d50c..cb6dfddc8 100644 --- a/Engine/lib/openal-soft/Alc/hrtf.h +++ b/Engine/lib/openal-soft/Alc/hrtf.h @@ -4,49 +4,86 @@ #include "AL/al.h" #include "AL/alc.h" +#include "alMain.h" #include "alstring.h" +#include "atomic.h" -struct Hrtf { - ALuint sampleRate; - ALuint irSize; - ALubyte evCount; +/* The maximum number of virtual speakers used to generate HRTF coefficients + * for decoding B-Format. + */ +#define HRTF_AMBI_MAX_CHANNELS 18 - const ALubyte *azCount; - const ALushort *evOffset; - const ALshort *coeffs; - const ALubyte *delays; - const char *filename; - struct Hrtf *next; -}; - -typedef struct HrtfEntry { - al_string name; - - const struct Hrtf *hrtf; -} HrtfEntry; -TYPEDEF_VECTOR(HrtfEntry, vector_HrtfEntry) +#define HRTF_HISTORY_BITS (6) +#define HRTF_HISTORY_LENGTH (1< + + +#ifdef __GNUC__ +#define DECL_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) +#else +#define DECL_FORMAT(x, y, z) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern FILE *LogFile; + +#if defined(__GNUC__) && !defined(_WIN32) +#define AL_PRINT(T, MSG, ...) fprintf(LogFile, "AL lib: %s %s: "MSG, T, __FUNCTION__ , ## __VA_ARGS__) +#else +void al_print(const char *type, const char *func, const char *fmt, ...) DECL_FORMAT(printf, 3,4); +#define AL_PRINT(T, ...) al_print((T), __FUNCTION__, __VA_ARGS__) +#endif + +#ifdef __ANDROID__ +#include +#define LOG_ANDROID(T, MSG, ...) __android_log_print(T, "openal", "AL lib: %s: "MSG, __FUNCTION__ , ## __VA_ARGS__) +#else +#define LOG_ANDROID(T, MSG, ...) ((void)0) +#endif + +enum LogLevel { + NoLog, + LogError, + LogWarning, + LogTrace, + LogRef +}; +extern enum LogLevel LogLevel; + +#define TRACEREF(...) do { \ + if(LogLevel >= LogRef) \ + AL_PRINT("(--)", __VA_ARGS__); \ +} while(0) + +#define TRACE(...) do { \ + if(LogLevel >= LogTrace) \ + AL_PRINT("(II)", __VA_ARGS__); \ + LOG_ANDROID(ANDROID_LOG_DEBUG, __VA_ARGS__); \ +} while(0) + +#define WARN(...) do { \ + if(LogLevel >= LogWarning) \ + AL_PRINT("(WW)", __VA_ARGS__); \ + LOG_ANDROID(ANDROID_LOG_WARN, __VA_ARGS__); \ +} while(0) + +#define ERR(...) do { \ + if(LogLevel >= LogError) \ + AL_PRINT("(EE)", __VA_ARGS__); \ + LOG_ANDROID(ANDROID_LOG_ERROR, __VA_ARGS__); \ +} while(0) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LOGGING_H */ diff --git a/Engine/lib/openal-soft/Alc/mastering.c b/Engine/lib/openal-soft/Alc/mastering.c new file mode 100644 index 000000000..1636c8d93 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mastering.c @@ -0,0 +1,232 @@ +#include "config.h" + +#include + +#include "mastering.h" +#include "alu.h" +#include "almalloc.h" + + +extern inline ALuint GetCompressorSampleRate(const Compressor *Comp); + +#define RMS_WINDOW_SIZE (1<<7) +#define RMS_WINDOW_MASK (RMS_WINDOW_SIZE-1) +#define RMS_VALUE_MAX (1<<24) + +static_assert(RMS_VALUE_MAX < (UINT_MAX / RMS_WINDOW_SIZE), "RMS_VALUE_MAX is too big"); + + +/* Multichannel compression is linked via one of two modes: + * + * Summed - Absolute sum of all channels. + * Maxed - Absolute maximum of any channel. + */ +static void SumChannels(Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]) +{ + ALsizei c, i; + + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = 0.0f; + + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] += OutBuffer[c][i]; + } + + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = fabsf(Comp->Envelope[i]); +} + +static void MaxChannels(Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]) +{ + ALsizei c, i; + + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = 0.0f; + + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = maxf(Comp->Envelope[i], fabsf(OutBuffer[c][i])); + } +} + +/* Envelope detection/sensing can be done via: + * + * RMS - Rectangular windowed root mean square of linking stage. + * Peak - Implicit output from linking stage. + */ +static void RmsDetection(Compressor *Comp, const ALsizei SamplesToDo) +{ + ALuint sum = Comp->RmsSum; + ALuint *window = Comp->RmsWindow; + ALsizei index = Comp->RmsIndex; + ALsizei i; + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat sig = Comp->Envelope[i]; + + sum -= window[index]; + window[index] = fastf2i(minf(sig * sig * 65536.0f, RMS_VALUE_MAX)); + sum += window[index]; + index = (index + 1) & RMS_WINDOW_MASK; + + Comp->Envelope[i] = sqrtf(sum / 65536.0f / RMS_WINDOW_SIZE); + } + + Comp->RmsSum = sum; + Comp->RmsIndex = index; +} + +/* This isn't a very sophisticated envelope follower, but it gets the job + * done. First, it operates at logarithmic scales to keep transitions + * appropriate for human hearing. Second, it can apply adaptive (automated) + * attack/release adjustments based on the signal. + */ +static void FollowEnvelope(Compressor *Comp, const ALsizei SamplesToDo) +{ + ALfloat attackMin = Comp->AttackMin; + ALfloat attackMax = Comp->AttackMax; + ALfloat releaseMin = Comp->ReleaseMin; + ALfloat releaseMax = Comp->ReleaseMax; + ALfloat last = Comp->EnvLast; + ALsizei i; + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat env = log10f(maxf(Comp->Envelope[i], 0.000001f)); + ALfloat slope = minf(1.0f, fabsf(env - last) / 4.5f); + + if(env > last) + last = minf(env, last + lerp(attackMin, attackMax, 1.0f - (slope * slope))); + else + last = maxf(env, last + lerp(releaseMin, releaseMax, 1.0f - (slope * slope))); + + Comp->Envelope[i] = last; + } + + Comp->EnvLast = last; +} + +/* The envelope is converted to control gain with an optional soft knee. */ +static void EnvelopeGain(Compressor *Comp, const ALsizei SamplesToDo, const ALfloat Slope) +{ + const ALfloat threshold = Comp->Threshold; + const ALfloat knee = Comp->Knee; + ALsizei i; + + if(!(knee > 0.0f)) + { + for(i = 0;i < SamplesToDo;i++) + { + ALfloat gain = Slope * (threshold - Comp->Envelope[i]); + Comp->Envelope[i] = powf(10.0f, minf(0.0f, gain)); + } + } + else + { + const ALfloat lower = threshold - (0.5f * knee); + const ALfloat upper = threshold + (0.5f * knee); + const ALfloat m = 0.5f * Slope / knee; + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat env = Comp->Envelope[i]; + ALfloat gain; + + if(env > lower && env < upper) + gain = m * (env - lower) * (lower - env); + else + gain = Slope * (threshold - env); + + Comp->Envelope[i] = powf(10.0f, minf(0.0f, gain)); + } + } +} + + +Compressor *CompressorInit(const ALfloat PreGainDb, const ALfloat PostGainDb, + const ALboolean SummedLink, const ALboolean RmsSensing, + const ALfloat AttackTimeMin, const ALfloat AttackTimeMax, + const ALfloat ReleaseTimeMin, const ALfloat ReleaseTimeMax, + const ALfloat Ratio, const ALfloat ThresholdDb, + const ALfloat KneeDb, const ALuint SampleRate) +{ + Compressor *Comp; + size_t size; + ALsizei i; + + size = sizeof(*Comp); + if(RmsSensing) + size += sizeof(Comp->RmsWindow[0]) * RMS_WINDOW_SIZE; + Comp = al_calloc(16, size); + + Comp->PreGain = powf(10.0f, PreGainDb / 20.0f); + Comp->PostGain = powf(10.0f, PostGainDb / 20.0f); + Comp->SummedLink = SummedLink; + Comp->AttackMin = 1.0f / maxf(0.000001f, AttackTimeMin * SampleRate * logf(10.0f)); + Comp->AttackMax = 1.0f / maxf(0.000001f, AttackTimeMax * SampleRate * logf(10.0f)); + Comp->ReleaseMin = -1.0f / maxf(0.000001f, ReleaseTimeMin * SampleRate * logf(10.0f)); + Comp->ReleaseMax = -1.0f / maxf(0.000001f, ReleaseTimeMax * SampleRate * logf(10.0f)); + Comp->Ratio = Ratio; + Comp->Threshold = ThresholdDb / 20.0f; + Comp->Knee = maxf(0.0f, KneeDb / 20.0f); + Comp->SampleRate = SampleRate; + + Comp->RmsSum = 0; + if(RmsSensing) + Comp->RmsWindow = (ALuint*)(Comp+1); + else + Comp->RmsWindow = NULL; + Comp->RmsIndex = 0; + + for(i = 0;i < BUFFERSIZE;i++) + Comp->Envelope[i] = 0.0f; + Comp->EnvLast = -6.0f; + + return Comp; +} + +void ApplyCompression(Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]) +{ + ALsizei c, i; + + if(Comp->PreGain != 1.0f) + { + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + OutBuffer[c][i] *= Comp->PreGain; + } + } + + if(Comp->SummedLink) + SumChannels(Comp, NumChans, SamplesToDo, OutBuffer); + else + MaxChannels(Comp, NumChans, SamplesToDo, OutBuffer); + + if(Comp->RmsWindow) + RmsDetection(Comp, SamplesToDo); + FollowEnvelope(Comp, SamplesToDo); + + if(Comp->Ratio > 0.0f) + EnvelopeGain(Comp, SamplesToDo, 1.0f - (1.0f / Comp->Ratio)); + else + EnvelopeGain(Comp, SamplesToDo, 1.0f); + + if(Comp->PostGain != 1.0f) + { + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] *= Comp->PostGain; + } + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + OutBuffer[c][i] *= Comp->Envelope[i]; + } +} diff --git a/Engine/lib/openal-soft/Alc/mastering.h b/Engine/lib/openal-soft/Alc/mastering.h new file mode 100644 index 000000000..0a7b49017 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mastering.h @@ -0,0 +1,57 @@ +#ifndef MASTERING_H +#define MASTERING_H + +#include "AL/al.h" + +/* For BUFFERSIZE. */ +#include "alMain.h" + +typedef struct Compressor { + ALfloat PreGain; + ALfloat PostGain; + ALboolean SummedLink; + ALfloat AttackMin; + ALfloat AttackMax; + ALfloat ReleaseMin; + ALfloat ReleaseMax; + ALfloat Ratio; + ALfloat Threshold; + ALfloat Knee; + ALuint SampleRate; + + ALuint RmsSum; + ALuint *RmsWindow; + ALsizei RmsIndex; + ALfloat Envelope[BUFFERSIZE]; + ALfloat EnvLast; +} Compressor; + +/* The compressor requires the following information for proper + * initialization: + * + * PreGainDb - Gain applied before detection (in dB). + * PostGainDb - Gain applied after compression (in dB). + * SummedLink - Whether to use summed (true) or maxed (false) linking. + * RmsSensing - Whether to use RMS (true) or Peak (false) sensing. + * AttackTimeMin - Minimum attack time (in seconds). + * AttackTimeMax - Maximum attack time. Automates when min != max. + * ReleaseTimeMin - Minimum release time (in seconds). + * ReleaseTimeMax - Maximum release time. Automates when min != max. + * Ratio - Compression ratio (x:1). Set to 0 for true limiter. + * ThresholdDb - Triggering threshold (in dB). + * KneeDb - Knee width (below threshold; in dB). + * SampleRate - Sample rate to process. + */ +Compressor *CompressorInit(const ALfloat PreGainDb, const ALfloat PostGainDb, + const ALboolean SummedLink, const ALboolean RmsSensing, const ALfloat AttackTimeMin, + const ALfloat AttackTimeMax, const ALfloat ReleaseTimeMin, const ALfloat ReleaseTimeMax, + const ALfloat Ratio, const ALfloat ThresholdDb, const ALfloat KneeDb, + const ALuint SampleRate); + +void ApplyCompression(struct Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]); + +inline ALuint GetCompressorSampleRate(const Compressor *Comp) +{ return Comp->SampleRate; } + +#endif /* MASTERING_H */ diff --git a/Engine/lib/openal-soft/Alc/mixer.c b/Engine/lib/openal-soft/Alc/mixer.c deleted file mode 100644 index b1f79d055..000000000 --- a/Engine/lib/openal-soft/Alc/mixer.c +++ /dev/null @@ -1,702 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 1999-2007 by authors. - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include "alMain.h" -#include "AL/al.h" -#include "AL/alc.h" -#include "alSource.h" -#include "alBuffer.h" -#include "alListener.h" -#include "alAuxEffectSlot.h" -#include "alu.h" - -#include "mixer_defs.h" - - -static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, - "MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!"); - -extern inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size); - -alignas(16) union ResamplerCoeffs ResampleCoeffs; - - -enum Resampler { - PointResampler, - LinearResampler, - FIR4Resampler, - FIR8Resampler, - BSincResampler, - - ResamplerDefault = LinearResampler -}; - -/* FIR8 requires 3 extra samples before the current position, and 4 after. */ -static_assert(MAX_PRE_SAMPLES >= 3, "MAX_PRE_SAMPLES must be at least 3!"); -static_assert(MAX_POST_SAMPLES >= 4, "MAX_POST_SAMPLES must be at least 4!"); - - -static MixerFunc MixSamples = Mix_C; -static HrtfMixerFunc MixHrtfSamples = MixHrtf_C; -static ResamplerFunc ResampleSamples = Resample_point32_C; - -MixerFunc SelectMixer(void) -{ -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return Mix_SSE; -#endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return Mix_Neon; -#endif - - return Mix_C; -} - -RowMixerFunc SelectRowMixer(void) -{ -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return MixRow_SSE; -#endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return MixRow_Neon; -#endif - return MixRow_C; -} - -static inline HrtfMixerFunc SelectHrtfMixer(void) -{ -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return MixHrtf_SSE; -#endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return MixHrtf_Neon; -#endif - - return MixHrtf_C; -} - -static inline ResamplerFunc SelectResampler(enum Resampler resampler) -{ - switch(resampler) - { - case PointResampler: - return Resample_point32_C; - case LinearResampler: -#ifdef HAVE_SSE4_1 - if((CPUCapFlags&CPU_CAP_SSE4_1)) - return Resample_lerp32_SSE41; -#endif -#ifdef HAVE_SSE2 - if((CPUCapFlags&CPU_CAP_SSE2)) - return Resample_lerp32_SSE2; -#endif - return Resample_lerp32_C; - case FIR4Resampler: -#ifdef HAVE_SSE4_1 - if((CPUCapFlags&CPU_CAP_SSE4_1)) - return Resample_fir4_32_SSE41; -#endif -#ifdef HAVE_SSE3 - if((CPUCapFlags&CPU_CAP_SSE3)) - return Resample_fir4_32_SSE3; -#endif - return Resample_fir4_32_C; - case FIR8Resampler: -#ifdef HAVE_SSE4_1 - if((CPUCapFlags&CPU_CAP_SSE4_1)) - return Resample_fir8_32_SSE41; -#endif -#ifdef HAVE_SSE3 - if((CPUCapFlags&CPU_CAP_SSE3)) - return Resample_fir8_32_SSE3; -#endif - return Resample_fir8_32_C; - case BSincResampler: -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return Resample_bsinc32_SSE; -#endif - return Resample_bsinc32_C; - } - - return Resample_point32_C; -} - - -/* The sinc resampler makes use of a Kaiser window to limit the needed sample - * points to 4 and 8, respectively. - */ - -#ifndef M_PI -#define M_PI (3.14159265358979323846) -#endif -static inline double Sinc(double x) -{ - if(x == 0.0) return 1.0; - return sin(x*M_PI) / (x*M_PI); -} - -/* The zero-order modified Bessel function of the first kind, used for the - * Kaiser window. - * - * I_0(x) = sum_{k=0}^inf (1 / k!)^2 (x / 2)^(2 k) - * = sum_{k=0}^inf ((x / 2)^k / k!)^2 - */ -static double BesselI_0(double x) -{ - double term, sum, x2, y, last_sum; - int k; - - /* Start at k=1 since k=0 is trivial. */ - term = 1.0; - sum = 1.0; - x2 = x / 2.0; - k = 1; - - /* Let the integration converge until the term of the sum is no longer - * significant. - */ - do { - y = x2 / k; - k ++; - last_sum = sum; - term *= y * y; - sum += term; - } while(sum != last_sum); - return sum; -} - -/* Calculate a Kaiser window from the given beta value and a normalized k - * [-1, 1]. - * - * w(k) = { I_0(B sqrt(1 - k^2)) / I_0(B), -1 <= k <= 1 - * { 0, elsewhere. - * - * Where k can be calculated as: - * - * k = i / l, where -l <= i <= l. - * - * or: - * - * k = 2 i / M - 1, where 0 <= i <= M. - */ -static inline double Kaiser(double b, double k) -{ - if(k <= -1.0 || k >= 1.0) return 0.0; - return BesselI_0(b * sqrt(1.0 - (k*k))) / BesselI_0(b); -} - -static inline double CalcKaiserBeta(double rejection) -{ - if(rejection > 50.0) - return 0.1102 * (rejection - 8.7); - if(rejection >= 21.0) - return (0.5842 * pow(rejection - 21.0, 0.4)) + - (0.07886 * (rejection - 21.0)); - return 0.0; -} - -static float SincKaiser(double r, double x) -{ - /* Limit rippling to -60dB. */ - return (float)(Kaiser(CalcKaiserBeta(60.0), x / r) * Sinc(x)); -} - - -void aluInitMixer(void) -{ - enum Resampler resampler = ResamplerDefault; - const char *str; - ALuint i; - - if(ConfigValueStr(NULL, NULL, "resampler", &str)) - { - if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0) - resampler = PointResampler; - else if(strcasecmp(str, "linear") == 0) - resampler = LinearResampler; - else if(strcasecmp(str, "sinc4") == 0) - resampler = FIR4Resampler; - else if(strcasecmp(str, "sinc8") == 0) - resampler = FIR8Resampler; - else if(strcasecmp(str, "bsinc") == 0) - resampler = BSincResampler; - else if(strcasecmp(str, "cubic") == 0) - { - WARN("Resampler option \"cubic\" is deprecated, using sinc4\n"); - resampler = FIR4Resampler; - } - else - { - char *end; - long n = strtol(str, &end, 0); - if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler)) - resampler = n; - else - WARN("Invalid resampler: %s\n", str); - } - } - - if(resampler == FIR8Resampler) - for(i = 0;i < FRACTIONONE;i++) - { - ALdouble mu = (ALdouble)i / FRACTIONONE; - ResampleCoeffs.FIR8[i][0] = SincKaiser(4.0, mu - -3.0); - ResampleCoeffs.FIR8[i][1] = SincKaiser(4.0, mu - -2.0); - ResampleCoeffs.FIR8[i][2] = SincKaiser(4.0, mu - -1.0); - ResampleCoeffs.FIR8[i][3] = SincKaiser(4.0, mu - 0.0); - ResampleCoeffs.FIR8[i][4] = SincKaiser(4.0, mu - 1.0); - ResampleCoeffs.FIR8[i][5] = SincKaiser(4.0, mu - 2.0); - ResampleCoeffs.FIR8[i][6] = SincKaiser(4.0, mu - 3.0); - ResampleCoeffs.FIR8[i][7] = SincKaiser(4.0, mu - 4.0); - } - else if(resampler == FIR4Resampler) - for(i = 0;i < FRACTIONONE;i++) - { - ALdouble mu = (ALdouble)i / FRACTIONONE; - ResampleCoeffs.FIR4[i][0] = SincKaiser(2.0, mu - -1.0); - ResampleCoeffs.FIR4[i][1] = SincKaiser(2.0, mu - 0.0); - ResampleCoeffs.FIR4[i][2] = SincKaiser(2.0, mu - 1.0); - ResampleCoeffs.FIR4[i][3] = SincKaiser(2.0, mu - 2.0); - } - - MixHrtfSamples = SelectHrtfMixer(); - MixSamples = SelectMixer(); - ResampleSamples = SelectResampler(resampler); -} - - -static inline ALfloat Sample_ALbyte(ALbyte val) -{ return val * (1.0f/127.0f); } - -static inline ALfloat Sample_ALshort(ALshort val) -{ return val * (1.0f/32767.0f); } - -static inline ALfloat Sample_ALfloat(ALfloat val) -{ return val; } - -#define DECL_TEMPLATE(T) \ -static inline void Load_##T(ALfloat *dst, const T *src, ALuint srcstep, ALuint samples)\ -{ \ - ALuint i; \ - for(i = 0;i < samples;i++) \ - dst[i] = Sample_##T(src[i*srcstep]); \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALfloat) - -#undef DECL_TEMPLATE - -static void LoadSamples(ALfloat *dst, const ALvoid *src, ALuint srcstep, enum FmtType srctype, ALuint samples) -{ - switch(srctype) - { - case FmtByte: - Load_ALbyte(dst, src, srcstep, samples); - break; - case FmtShort: - Load_ALshort(dst, src, srcstep, samples); - break; - case FmtFloat: - Load_ALfloat(dst, src, srcstep, samples); - break; - } -} - -static inline void SilenceSamples(ALfloat *dst, ALuint samples) -{ - ALuint i; - for(i = 0;i < samples;i++) - dst[i] = 0.0f; -} - - -static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter, - ALfloat *restrict dst, const ALfloat *restrict src, - ALuint numsamples, enum ActiveFilters type) -{ - ALuint i; - switch(type) - { - case AF_None: - ALfilterState_processPassthru(lpfilter, src, numsamples); - ALfilterState_processPassthru(hpfilter, src, numsamples); - break; - - case AF_LowPass: - ALfilterState_process(lpfilter, dst, src, numsamples); - ALfilterState_processPassthru(hpfilter, dst, numsamples); - return dst; - case AF_HighPass: - ALfilterState_processPassthru(lpfilter, src, numsamples); - ALfilterState_process(hpfilter, dst, src, numsamples); - return dst; - - case AF_BandPass: - for(i = 0;i < numsamples;) - { - ALfloat temp[256]; - ALuint todo = minu(256, numsamples-i); - - ALfilterState_process(lpfilter, temp, src+i, todo); - ALfilterState_process(hpfilter, dst+i, temp, todo); - i += todo; - } - return dst; - } - return src; -} - - -ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) -{ - ResamplerFunc Resample; - ALbufferlistitem *BufferListItem; - ALuint DataPosInt, DataPosFrac; - ALboolean Looping; - ALuint increment; - ALenum State; - ALuint OutPos; - ALuint NumChannels; - ALuint SampleSize; - ALint64 DataSize64; - ALuint Counter; - ALuint IrSize; - ALuint chan, send, j; - - /* Get source info */ - State = AL_PLAYING; /* Only called while playing. */ - BufferListItem = ATOMIC_LOAD(&Source->current_buffer); - DataPosInt = ATOMIC_LOAD(&Source->position, almemory_order_relaxed); - DataPosFrac = ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed); - Looping = ATOMIC_LOAD(&Source->looping, almemory_order_relaxed); - NumChannels = Source->NumChannels; - SampleSize = Source->SampleSize; - increment = voice->Step; - - IrSize = (Device->Hrtf.Handle ? Device->Hrtf.Handle->irSize : 0); - - Resample = ((increment == FRACTIONONE && DataPosFrac == 0) ? - Resample_copy32_C : ResampleSamples); - - Counter = voice->Moving ? SamplesToDo : 0; - OutPos = 0; - do { - ALuint SrcBufferSize, DstBufferSize; - - /* Figure out how many buffer samples will be needed */ - DataSize64 = SamplesToDo-OutPos; - DataSize64 *= increment; - DataSize64 += DataPosFrac+FRACTIONMASK; - DataSize64 >>= FRACTIONBITS; - DataSize64 += MAX_POST_SAMPLES+MAX_PRE_SAMPLES; - - SrcBufferSize = (ALuint)mini64(DataSize64, BUFFERSIZE); - - /* Figure out how many samples we can actually mix from this. */ - DataSize64 = SrcBufferSize; - DataSize64 -= MAX_POST_SAMPLES+MAX_PRE_SAMPLES; - DataSize64 <<= FRACTIONBITS; - DataSize64 -= DataPosFrac; - - DstBufferSize = (ALuint)((DataSize64+(increment-1)) / increment); - DstBufferSize = minu(DstBufferSize, (SamplesToDo-OutPos)); - - /* Some mixers like having a multiple of 4, so try to give that unless - * this is the last update. */ - if(OutPos+DstBufferSize < SamplesToDo) - DstBufferSize &= ~3; - - for(chan = 0;chan < NumChannels;chan++) - { - const ALfloat *ResampledData; - ALfloat *SrcData = Device->SourceData; - ALuint SrcDataSize; - - /* Load the previous samples into the source data first. */ - memcpy(SrcData, voice->PrevSamples[chan], MAX_PRE_SAMPLES*sizeof(ALfloat)); - SrcDataSize = MAX_PRE_SAMPLES; - - if(Source->SourceType == AL_STATIC) - { - const ALbuffer *ALBuffer = BufferListItem->buffer; - const ALubyte *Data = ALBuffer->data; - ALuint DataSize; - ALuint pos; - - /* Offset buffer data to current channel */ - Data += chan*SampleSize; - - /* If current pos is beyond the loop range, do not loop */ - if(Looping == AL_FALSE || DataPosInt >= (ALuint)ALBuffer->LoopEnd) - { - Looping = AL_FALSE; - - /* Load what's left to play from the source buffer, and - * clear the rest of the temp buffer */ - pos = DataPosInt; - DataSize = minu(SrcBufferSize - SrcDataSize, ALBuffer->SampleLen - pos); - - LoadSamples(&SrcData[SrcDataSize], &Data[pos * NumChannels*SampleSize], - NumChannels, ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - - SilenceSamples(&SrcData[SrcDataSize], SrcBufferSize - SrcDataSize); - SrcDataSize += SrcBufferSize - SrcDataSize; - } - else - { - ALuint LoopStart = ALBuffer->LoopStart; - ALuint LoopEnd = ALBuffer->LoopEnd; - - /* Load what's left of this loop iteration, then load - * repeats of the loop section */ - pos = DataPosInt; - DataSize = LoopEnd - pos; - DataSize = minu(SrcBufferSize - SrcDataSize, DataSize); - - LoadSamples(&SrcData[SrcDataSize], &Data[pos * NumChannels*SampleSize], - NumChannels, ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - - DataSize = LoopEnd-LoopStart; - while(SrcBufferSize > SrcDataSize) - { - DataSize = minu(SrcBufferSize - SrcDataSize, DataSize); - - LoadSamples(&SrcData[SrcDataSize], &Data[LoopStart * NumChannels*SampleSize], - NumChannels, ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - } - } - } - else - { - /* Crawl the buffer queue to fill in the temp buffer */ - ALbufferlistitem *tmpiter = BufferListItem; - ALuint pos = DataPosInt; - - while(tmpiter && SrcBufferSize > SrcDataSize) - { - const ALbuffer *ALBuffer; - if((ALBuffer=tmpiter->buffer) != NULL) - { - const ALubyte *Data = ALBuffer->data; - ALuint DataSize = ALBuffer->SampleLen; - - /* Skip the data already played */ - if(DataSize <= pos) - pos -= DataSize; - else - { - Data += (pos*NumChannels + chan)*SampleSize; - DataSize -= pos; - pos -= pos; - - DataSize = minu(SrcBufferSize - SrcDataSize, DataSize); - LoadSamples(&SrcData[SrcDataSize], Data, NumChannels, - ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - } - } - tmpiter = tmpiter->next; - if(!tmpiter && Looping) - tmpiter = ATOMIC_LOAD(&Source->queue); - else if(!tmpiter) - { - SilenceSamples(&SrcData[SrcDataSize], SrcBufferSize - SrcDataSize); - SrcDataSize += SrcBufferSize - SrcDataSize; - } - } - } - - /* Store the last source samples used for next time. */ - memcpy(voice->PrevSamples[chan], - &SrcData[(increment*DstBufferSize + DataPosFrac)>>FRACTIONBITS], - MAX_PRE_SAMPLES*sizeof(ALfloat) - ); - - /* Now resample, then filter and mix to the appropriate outputs. */ - ResampledData = Resample(&voice->SincState, - &SrcData[MAX_PRE_SAMPLES], DataPosFrac, increment, - Device->ResampledData, DstBufferSize - ); - { - DirectParams *parms = &voice->Chan[chan].Direct; - const ALfloat *samples; - - samples = DoFilters( - &parms->LowPass, &parms->HighPass, Device->FilteredData, - ResampledData, DstBufferSize, parms->FilterType - ); - if(!voice->IsHrtf) - { - if(!Counter) - memcpy(parms->Gains.Current, parms->Gains.Target, - sizeof(parms->Gains.Current)); - MixSamples(samples, voice->DirectOut.Channels, voice->DirectOut.Buffer, - parms->Gains.Current, parms->Gains.Target, Counter, OutPos, DstBufferSize - ); - } - else - { - MixHrtfParams hrtfparams; - int lidx, ridx; - - if(!Counter) - { - parms->Hrtf.Current = parms->Hrtf.Target; - for(j = 0;j < HRIR_LENGTH;j++) - { - hrtfparams.Steps.Coeffs[j][0] = 0.0f; - hrtfparams.Steps.Coeffs[j][1] = 0.0f; - } - hrtfparams.Steps.Delay[0] = 0; - hrtfparams.Steps.Delay[1] = 0; - } - else - { - ALfloat delta = 1.0f / (ALfloat)Counter; - ALfloat coeffdiff; - ALint delaydiff; - for(j = 0;j < IrSize;j++) - { - coeffdiff = parms->Hrtf.Target.Coeffs[j][0] - parms->Hrtf.Current.Coeffs[j][0]; - hrtfparams.Steps.Coeffs[j][0] = coeffdiff * delta; - coeffdiff = parms->Hrtf.Target.Coeffs[j][1] - parms->Hrtf.Current.Coeffs[j][1]; - hrtfparams.Steps.Coeffs[j][1] = coeffdiff * delta; - } - delaydiff = (ALint)(parms->Hrtf.Target.Delay[0] - parms->Hrtf.Current.Delay[0]); - hrtfparams.Steps.Delay[0] = fastf2i((ALfloat)delaydiff * delta); - delaydiff = (ALint)(parms->Hrtf.Target.Delay[1] - parms->Hrtf.Current.Delay[1]); - hrtfparams.Steps.Delay[1] = fastf2i((ALfloat)delaydiff * delta); - } - hrtfparams.Target = &parms->Hrtf.Target; - hrtfparams.Current = &parms->Hrtf.Current; - - lidx = GetChannelIdxByName(Device->RealOut, FrontLeft); - ridx = GetChannelIdxByName(Device->RealOut, FrontRight); - assert(lidx != -1 && ridx != -1); - - MixHrtfSamples(voice->DirectOut.Buffer, lidx, ridx, samples, Counter, - voice->Offset, OutPos, IrSize, &hrtfparams, - &parms->Hrtf.State, DstBufferSize); - } - } - - for(send = 0;send < Device->NumAuxSends;send++) - { - SendParams *parms = &voice->Chan[chan].Send[send]; - const ALfloat *samples; - - if(!voice->SendOut[send].Buffer) - continue; - - samples = DoFilters( - &parms->LowPass, &parms->HighPass, Device->FilteredData, - ResampledData, DstBufferSize, parms->FilterType - ); - - if(!Counter) - memcpy(parms->Gains.Current, parms->Gains.Target, - sizeof(parms->Gains.Current)); - MixSamples(samples, voice->SendOut[send].Channels, voice->SendOut[send].Buffer, - parms->Gains.Current, parms->Gains.Target, Counter, OutPos, DstBufferSize - ); - } - } - /* Update positions */ - DataPosFrac += increment*DstBufferSize; - DataPosInt += DataPosFrac>>FRACTIONBITS; - DataPosFrac &= FRACTIONMASK; - - OutPos += DstBufferSize; - voice->Offset += DstBufferSize; - Counter = maxu(DstBufferSize, Counter) - DstBufferSize; - - /* Handle looping sources */ - while(1) - { - const ALbuffer *ALBuffer; - ALuint DataSize = 0; - ALuint LoopStart = 0; - ALuint LoopEnd = 0; - - if((ALBuffer=BufferListItem->buffer) != NULL) - { - DataSize = ALBuffer->SampleLen; - LoopStart = ALBuffer->LoopStart; - LoopEnd = ALBuffer->LoopEnd; - if(LoopEnd > DataPosInt) - break; - } - - if(Looping && Source->SourceType == AL_STATIC) - { - assert(LoopEnd > LoopStart); - DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart; - break; - } - - if(DataSize > DataPosInt) - break; - - if(!(BufferListItem=BufferListItem->next)) - { - if(Looping) - BufferListItem = ATOMIC_LOAD(&Source->queue); - else - { - State = AL_STOPPED; - BufferListItem = NULL; - DataPosInt = 0; - DataPosFrac = 0; - break; - } - } - - DataPosInt -= DataSize; - } - } while(State == AL_PLAYING && OutPos < SamplesToDo); - - voice->Moving = AL_TRUE; - - /* Update source info */ - Source->state = State; - ATOMIC_STORE(&Source->current_buffer, BufferListItem, almemory_order_relaxed); - ATOMIC_STORE(&Source->position, DataPosInt, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, DataPosFrac); -} diff --git a/Engine/lib/openal-soft/Alc/mixer/defs.h b/Engine/lib/openal-soft/Alc/mixer/defs.h new file mode 100644 index 000000000..fe19cef4f --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/defs.h @@ -0,0 +1,119 @@ +#ifndef MIXER_DEFS_H +#define MIXER_DEFS_H + +#include "AL/alc.h" +#include "AL/al.h" +#include "alMain.h" +#include "alu.h" + +struct MixGains; + +struct MixHrtfParams; +struct HrtfState; + +/* C resamplers */ +const ALfloat *Resample_copy_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_point_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_lerp_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_cubic_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_bsinc_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); + + +/* C mixers */ +void MixHrtf_C(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, struct MixHrtfParams *hrtfparams, + struct HrtfState *hrtfstate, ALsizei BufferSize); +void MixHrtfBlend_C(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize); +void MixDirectHrtf_C(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize); +void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize); +void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, + const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, + ALsizei InPos, ALsizei BufferSize); + +/* SSE mixers */ +void MixHrtf_SSE(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, struct MixHrtfParams *hrtfparams, + struct HrtfState *hrtfstate, ALsizei BufferSize); +void MixHrtfBlend_SSE(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize); +void MixDirectHrtf_SSE(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize); +void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize); +void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, + const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, + ALsizei InPos, ALsizei BufferSize); + +/* SSE resamplers */ +inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size) +{ + ALsizei i; + + pos_arr[0] = 0; + frac_arr[0] = frac; + for(i = 1;i < size;i++) + { + ALint frac_tmp = frac_arr[i-1] + increment; + pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS); + frac_arr[i] = frac_tmp&FRACTIONMASK; + } +} + +const ALfloat *Resample_lerp_SSE2(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei numsamples); +const ALfloat *Resample_lerp_SSE41(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei numsamples); + +const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen); + +/* Neon mixers */ +void MixHrtf_Neon(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, struct MixHrtfParams *hrtfparams, + struct HrtfState *hrtfstate, ALsizei BufferSize); +void MixHrtfBlend_Neon(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize); +void MixDirectHrtf_Neon(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize); +void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize); +void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, + const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, + ALsizei InPos, ALsizei BufferSize); + +/* Neon resamplers */ +const ALfloat *Resample_lerp_Neon(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei numsamples); +const ALfloat *Resample_bsinc_Neon(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen); + +#endif /* MIXER_DEFS_H */ diff --git a/Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c b/Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c new file mode 100644 index 000000000..d6bd8042c --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c @@ -0,0 +1,123 @@ +#include "config.h" + +#include "alMain.h" +#include "alSource.h" + +#include "hrtf.h" +#include "align.h" +#include "alu.h" +#include "defs.h" + + +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei irSize, + const ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right); + + +void MixHrtf(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate, + ALsizei BufferSize) +{ + const ALfloat (*Coeffs)[2] = ASSUME_ALIGNED(hrtfparams->Coeffs, 16); + const ALsizei Delay[2] = { hrtfparams->Delay[0], hrtfparams->Delay[1] }; + ALfloat gainstep = hrtfparams->GainStep; + ALfloat gain = hrtfparams->Gain; + ALfloat left, right; + ALsizei i; + + ASSUME(IrSize >= 4); + ASSUME(BufferSize > 0); + + LeftOut += OutPos; + RightOut += OutPos; + for(i = 0;i < BufferSize;i++) + { + hrtfstate->History[Offset&HRTF_HISTORY_MASK] = *(data++); + left = hrtfstate->History[(Offset-Delay[0])&HRTF_HISTORY_MASK]*gain; + right = hrtfstate->History[(Offset-Delay[1])&HRTF_HISTORY_MASK]*gain; + + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][0] = 0.0f; + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][1] = 0.0f; + + ApplyCoeffs(Offset, hrtfstate->Values, IrSize, Coeffs, left, right); + *(LeftOut++) += hrtfstate->Values[Offset&HRIR_MASK][0]; + *(RightOut++) += hrtfstate->Values[Offset&HRIR_MASK][1]; + + gain += gainstep; + Offset++; + } + hrtfparams->Gain = gain; +} + +void MixHrtfBlend(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize) +{ + const ALfloat (*OldCoeffs)[2] = ASSUME_ALIGNED(oldparams->Coeffs, 16); + const ALsizei OldDelay[2] = { oldparams->Delay[0], oldparams->Delay[1] }; + ALfloat oldGain = oldparams->Gain; + ALfloat oldGainStep = -oldGain / (ALfloat)BufferSize; + const ALfloat (*NewCoeffs)[2] = ASSUME_ALIGNED(newparams->Coeffs, 16); + const ALsizei NewDelay[2] = { newparams->Delay[0], newparams->Delay[1] }; + ALfloat newGain = newparams->Gain; + ALfloat newGainStep = newparams->GainStep; + ALfloat left, right; + ALsizei i; + + ASSUME(IrSize >= 4); + ASSUME(BufferSize > 0); + + LeftOut += OutPos; + RightOut += OutPos; + for(i = 0;i < BufferSize;i++) + { + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][0] = 0.0f; + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][1] = 0.0f; + + hrtfstate->History[Offset&HRTF_HISTORY_MASK] = *(data++); + + left = hrtfstate->History[(Offset-OldDelay[0])&HRTF_HISTORY_MASK]*oldGain; + right = hrtfstate->History[(Offset-OldDelay[1])&HRTF_HISTORY_MASK]*oldGain; + ApplyCoeffs(Offset, hrtfstate->Values, IrSize, OldCoeffs, left, right); + + left = hrtfstate->History[(Offset-NewDelay[0])&HRTF_HISTORY_MASK]*newGain; + right = hrtfstate->History[(Offset-NewDelay[1])&HRTF_HISTORY_MASK]*newGain; + ApplyCoeffs(Offset, hrtfstate->Values, IrSize, NewCoeffs, left, right); + + *(LeftOut++) += hrtfstate->Values[Offset&HRIR_MASK][0]; + *(RightOut++) += hrtfstate->Values[Offset&HRIR_MASK][1]; + + oldGain += oldGainStep; + newGain += newGainStep; + Offset++; + } + newparams->Gain = newGain; +} + +void MixDirectHrtf(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize) +{ + ALfloat insample; + ALsizei i; + + ASSUME(IrSize >= 4); + ASSUME(BufferSize > 0); + + for(i = 0;i < BufferSize;i++) + { + Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; + Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; + Offset++; + + insample = *(data++); + ApplyCoeffs(Offset, Values, IrSize, Coeffs, insample, insample); + *(LeftOut++) += Values[Offset&HRIR_MASK][0]; + *(RightOut++) += Values[Offset&HRIR_MASK][1]; + } +} diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_c.c b/Engine/lib/openal-soft/Alc/mixer/mixer_c.c new file mode 100644 index 000000000..844852060 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_c.c @@ -0,0 +1,176 @@ +#include "config.h" + +#include + +#include "alMain.h" +#include "alu.h" +#include "alSource.h" +#include "alAuxEffectSlot.h" +#include "defs.h" + + +static inline ALfloat do_point(const ALfloat *restrict vals, ALsizei UNUSED(frac)) +{ return vals[0]; } +static inline ALfloat do_lerp(const ALfloat *restrict vals, ALsizei frac) +{ return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); } +static inline ALfloat do_cubic(const ALfloat *restrict vals, ALsizei frac) +{ return cubic(vals[0], vals[1], vals[2], vals[3], frac * (1.0f/FRACTIONONE)); } + +const ALfloat *Resample_copy_C(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei UNUSED(frac), ALint UNUSED(increment), + ALfloat *restrict dst, ALsizei numsamples) +{ +#if defined(HAVE_SSE) || defined(HAVE_NEON) + /* Avoid copying the source data if it's aligned like the destination. */ + if((((intptr_t)src)&15) == (((intptr_t)dst)&15)) + return src; +#endif + memcpy(dst, src, numsamples*sizeof(ALfloat)); + return dst; +} + +#define DECL_TEMPLATE(Tag, Sampler, O) \ +const ALfloat *Resample_##Tag##_C(const InterpState* UNUSED(state), \ + const ALfloat *restrict src, ALsizei frac, ALint increment, \ + ALfloat *restrict dst, ALsizei numsamples) \ +{ \ + ALsizei i; \ + \ + src -= O; \ + for(i = 0;i < numsamples;i++) \ + { \ + dst[i] = Sampler(src, frac); \ + \ + frac += increment; \ + src += frac>>FRACTIONBITS; \ + frac &= FRACTIONMASK; \ + } \ + return dst; \ +} + +DECL_TEMPLATE(point, do_point, 0) +DECL_TEMPLATE(lerp, do_lerp, 0) +DECL_TEMPLATE(cubic, do_cubic, 1) + +#undef DECL_TEMPLATE + +const ALfloat *Resample_bsinc_C(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen) +{ + const ALfloat *fil, *scd, *phd, *spd; + const ALfloat *const filter = state->bsinc.filter; + const ALfloat sf = state->bsinc.sf; + const ALsizei m = state->bsinc.m; + ALsizei j_f, pi, i; + ALfloat pf, r; + + ASSUME(m > 0); + + src += state->bsinc.l; + for(i = 0;i < dstlen;i++) + { + // Calculate the phase index and factor. +#define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) + pi = frac >> FRAC_PHASE_BITDIFF; + pf = (frac & ((1<>FRACTIONBITS; + frac &= FRACTIONMASK; + } + return dst; +} + + +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right) +{ + ALsizei c; + for(c = 0;c < IrSize;c++) + { + const ALsizei off = (Offset+c)&HRIR_MASK; + Values[off][0] += Coeffs[c][0] * left; + Values[off][1] += Coeffs[c][1] * right; + } +} + +#define MixHrtf MixHrtf_C +#define MixHrtfBlend MixHrtfBlend_C +#define MixDirectHrtf MixDirectHrtf_C +#include "hrtf_inc.c" + + +void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize) +{ + ALfloat gain, delta, step; + ALsizei c; + + ASSUME(OutChans > 0); + ASSUME(BufferSize > 0); + delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; + + for(c = 0;c < OutChans;c++) + { + ALsizei pos = 0; + gain = CurrentGains[c]; + step = (TargetGains[c] - gain) * delta; + if(fabsf(step) > FLT_EPSILON) + { + ALsizei minsize = mini(BufferSize, Counter); + for(;pos < minsize;pos++) + { + OutBuffer[c][OutPos+pos] += data[pos]*gain; + gain += step; + } + if(pos == Counter) + gain = TargetGains[c]; + CurrentGains[c] = gain; + } + + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + for(;pos < BufferSize;pos++) + OutBuffer[c][OutPos+pos] += data[pos]*gain; + } +} + +/* Basically the inverse of the above. Rather than one input going to multiple + * outputs (each with its own gain), it's multiple inputs (each with its own + * gain) going to one output. This applies one row (vs one column) of a matrix + * transform. And as the matrices are more or less static once set up, no + * stepping is necessary. + */ +void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, ALsizei BufferSize) +{ + ALsizei c, i; + + ASSUME(InChans > 0); + ASSUME(BufferSize > 0); + + for(c = 0;c < InChans;c++) + { + ALfloat gain = Gains[c]; + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + + for(i = 0;i < BufferSize;i++) + OutBuffer[i] += data[c][InPos+i] * gain; + } +} diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_neon.c b/Engine/lib/openal-soft/Alc/mixer/mixer_neon.c new file mode 100644 index 000000000..1a5e8ee77 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_neon.c @@ -0,0 +1,269 @@ +#include "config.h" + +#include + +#include "AL/al.h" +#include "AL/alc.h" +#include "alMain.h" +#include "alu.h" +#include "hrtf.h" +#include "defs.h" + + +const ALfloat *Resample_lerp_Neon(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) +{ + const int32x4_t increment4 = vdupq_n_s32(increment*4); + const float32x4_t fracOne4 = vdupq_n_f32(1.0f/FRACTIONONE); + const int32x4_t fracMask4 = vdupq_n_s32(FRACTIONMASK); + alignas(16) ALint pos_[4]; + alignas(16) ALsizei frac_[4]; + int32x4_t pos4; + int32x4_t frac4; + ALsizei i; + + ASSUME(numsamples > 0); + + InitiatePositionArrays(frac, increment, frac_, pos_, 4); + + frac4 = vld1q_s32(frac_); + pos4 = vld1q_s32(pos_); + + for(i = 0;numsamples-i > 3;i += 4) + { + const float32x4_t val1 = (float32x4_t){src[pos_[0]], src[pos_[1]], src[pos_[2]], src[pos_[3]]}; + const float32x4_t val2 = (float32x4_t){src[pos_[0]+1], src[pos_[1]+1], src[pos_[2]+1], src[pos_[3]+1]}; + + /* val1 + (val2-val1)*mu */ + const float32x4_t r0 = vsubq_f32(val2, val1); + const float32x4_t mu = vmulq_f32(vcvtq_f32_s32(frac4), fracOne4); + const float32x4_t out = vmlaq_f32(val1, mu, r0); + + vst1q_f32(&dst[i], out); + + frac4 = vaddq_s32(frac4, increment4); + pos4 = vaddq_s32(pos4, vshrq_n_s32(frac4, FRACTIONBITS)); + frac4 = vandq_s32(frac4, fracMask4); + + vst1q_s32(pos_, pos4); + } + + if(i < numsamples) + { + /* NOTE: These four elements represent the position *after* the last + * four samples, so the lowest element is the next position to + * resample. + */ + ALint pos = pos_[0]; + frac = vgetq_lane_s32(frac4, 0); + do { + dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE)); + + frac += increment; + pos += frac>>FRACTIONBITS; + frac &= FRACTIONMASK; + } while(++i < numsamples); + } + return dst; +} + +const ALfloat *Resample_bsinc_Neon(const InterpState *state, + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei dstlen) +{ + const ALfloat *const filter = state->bsinc.filter; + const float32x4_t sf4 = vdupq_n_f32(state->bsinc.sf); + const ALsizei m = state->bsinc.m; + const float32x4_t *fil, *scd, *phd, *spd; + ALsizei pi, i, j, offset; + float32x4_t r4; + ALfloat pf; + + ASSUME(m > 0); + ASSUME(dstlen > 0); + + src += state->bsinc.l; + for(i = 0;i < dstlen;i++) + { + // Calculate the phase index and factor. +#define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) + pi = frac >> FRAC_PHASE_BITDIFF; + pf = (frac & ((1<>FRACTIONBITS; + frac &= FRACTIONMASK; + } + return dst; +} + + +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right) +{ + ALsizei c; + float32x4_t leftright4; + { + float32x2_t leftright2 = vdup_n_f32(0.0); + leftright2 = vset_lane_f32(left, leftright2, 0); + leftright2 = vset_lane_f32(right, leftright2, 1); + leftright4 = vcombine_f32(leftright2, leftright2); + } + Values = ASSUME_ALIGNED(Values, 16); + Coeffs = ASSUME_ALIGNED(Coeffs, 16); + for(c = 0;c < IrSize;c += 2) + { + const ALsizei o0 = (Offset+c)&HRIR_MASK; + const ALsizei o1 = (o0+1)&HRIR_MASK; + float32x4_t vals = vcombine_f32(vld1_f32((float32_t*)&Values[o0][0]), + vld1_f32((float32_t*)&Values[o1][0])); + float32x4_t coefs = vld1q_f32((float32_t*)&Coeffs[c][0]); + + vals = vmlaq_f32(vals, coefs, leftright4); + + vst1_f32((float32_t*)&Values[o0][0], vget_low_f32(vals)); + vst1_f32((float32_t*)&Values[o1][0], vget_high_f32(vals)); + } +} + +#define MixHrtf MixHrtf_Neon +#define MixHrtfBlend MixHrtfBlend_Neon +#define MixDirectHrtf MixDirectHrtf_Neon +#include "hrtf_inc.c" + + +void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize) +{ + ALfloat gain, delta, step; + float32x4_t gain4; + ALsizei c; + + ASSUME(OutChans > 0); + ASSUME(BufferSize > 0); + data = ASSUME_ALIGNED(data, 16); + OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); + + delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; + + for(c = 0;c < OutChans;c++) + { + ALsizei pos = 0; + gain = CurrentGains[c]; + step = (TargetGains[c] - gain) * delta; + if(fabsf(step) > FLT_EPSILON) + { + ALsizei minsize = mini(BufferSize, Counter); + /* Mix with applying gain steps in aligned multiples of 4. */ + if(minsize-pos > 3) + { + float32x4_t step4; + gain4 = vsetq_lane_f32(gain, gain4, 0); + gain4 = vsetq_lane_f32(gain + step, gain4, 1); + gain4 = vsetq_lane_f32(gain + step + step, gain4, 2); + gain4 = vsetq_lane_f32(gain + step + step + step, gain4, 3); + step4 = vdupq_n_f32(step + step + step + step); + do { + const float32x4_t val4 = vld1q_f32(&data[pos]); + float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); + dry4 = vmlaq_f32(dry4, val4, gain4); + gain4 = vaddq_f32(gain4, step4); + vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); + pos += 4; + } while(minsize-pos > 3); + /* NOTE: gain4 now represents the next four gains after the + * last four mixed samples, so the lowest element represents + * the next gain to apply. + */ + gain = vgetq_lane_f32(gain4, 0); + } + /* Mix with applying left over gain steps that aren't aligned multiples of 4. */ + for(;pos < minsize;pos++) + { + OutBuffer[c][OutPos+pos] += data[pos]*gain; + gain += step; + } + if(pos == Counter) + gain = TargetGains[c]; + CurrentGains[c] = gain; + + /* Mix until pos is aligned with 4 or the mix is done. */ + minsize = mini(BufferSize, (pos+3)&~3); + for(;pos < minsize;pos++) + OutBuffer[c][OutPos+pos] += data[pos]*gain; + } + + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + gain4 = vdupq_n_f32(gain); + for(;BufferSize-pos > 3;pos += 4) + { + const float32x4_t val4 = vld1q_f32(&data[pos]); + float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); + dry4 = vmlaq_f32(dry4, val4, gain4); + vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); + } + for(;pos < BufferSize;pos++) + OutBuffer[c][OutPos+pos] += data[pos]*gain; + } +} + +void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, ALsizei BufferSize) +{ + float32x4_t gain4; + ALsizei c; + + ASSUME(InChans > 0); + ASSUME(BufferSize > 0); + data = ASSUME_ALIGNED(data, 16); + OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); + + for(c = 0;c < InChans;c++) + { + ALsizei pos = 0; + ALfloat gain = Gains[c]; + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + + gain4 = vdupq_n_f32(gain); + for(;BufferSize-pos > 3;pos += 4) + { + const float32x4_t val4 = vld1q_f32(&data[c][InPos+pos]); + float32x4_t dry4 = vld1q_f32(&OutBuffer[pos]); + dry4 = vmlaq_f32(dry4, val4, gain4); + vst1q_f32(&OutBuffer[pos], dry4); + } + for(;pos < BufferSize;pos++) + OutBuffer[pos] += data[c][InPos+pos]*gain; + } +} diff --git a/Engine/lib/openal-soft/Alc/mixer_sse.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse.c similarity index 55% rename from Engine/lib/openal-soft/Alc/mixer_sse.c rename to Engine/lib/openal-soft/Alc/mixer/mixer_sse.c index f5e21e23d..a178477f8 100644 --- a/Engine/lib/openal-soft/Alc/mixer_sse.c +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_sse.c @@ -9,22 +9,25 @@ #include "alSource.h" #include "alAuxEffectSlot.h" -#include "mixer_defs.h" +#include "defs.h" -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint dstlen) +const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen) { - const __m128 sf4 = _mm_set1_ps(state->sf); - const ALuint m = state->m; - const ALint l = state->l; - const ALfloat *fil, *scd, *phd, *spd; - ALuint pi, j_f, i; + const ALfloat *const filter = state->bsinc.filter; + const __m128 sf4 = _mm_set1_ps(state->bsinc.sf); + const ALsizei m = state->bsinc.m; + const __m128 *fil, *scd, *phd, *spd; + ALsizei pi, i, j, offset; ALfloat pf; - ALint j_s; __m128 r4; + ASSUME(m > 0); + ASSUME(dstlen > 0); + + src += state->bsinc.l; for(i = 0;i < dstlen;i++) { // Calculate the phase index and factor. @@ -33,32 +36,28 @@ const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *rest pf = (frac & ((1<coeffs[pi].filter; - scd = state->coeffs[pi].scDelta; - phd = state->coeffs[pi].phDelta; - spd = state->coeffs[pi].spDelta; + offset = m*pi*4; + fil = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; + scd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; + phd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; + spd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); // Apply the scale and phase interpolated filter. r4 = _mm_setzero_ps(); { const __m128 pf4 = _mm_set1_ps(pf); - for(j_f = 0,j_s = l;j_f < m;j_f+=4,j_s+=4) +#define MLA4(x, y, z) _mm_add_ps(x, _mm_mul_ps(y, z)) + for(j = 0;j < m;j+=4,fil++,scd++,phd++,spd++) { - const __m128 f4 = _mm_add_ps( - _mm_add_ps( - _mm_load_ps(&fil[j_f]), - _mm_mul_ps(sf4, _mm_load_ps(&scd[j_f])) - ), - _mm_mul_ps( - pf4, - _mm_add_ps( - _mm_load_ps(&phd[j_f]), - _mm_mul_ps(sf4, _mm_load_ps(&spd[j_f])) - ) - ) + /* f = ((fil + sf*scd) + pf*(phd + sf*spd)) */ + const __m128 f4 = MLA4( + MLA4(*fil, sf4, *scd), + pf4, MLA4(*phd, sf4, *spd) ); - r4 = _mm_add_ps(r4, _mm_mul_ps(f4, _mm_loadu_ps(&src[j_s]))); + /* r += f*src */ + r4 = MLA4(r4, f4, _mm_loadu_ps(&src[j])); } +#undef MLA4 } r4 = _mm_add_ps(r4, _mm_shuffle_ps(r4, r4, _MM_SHUFFLE(0, 1, 2, 3))); r4 = _mm_add_ps(r4, _mm_movehl_ps(r4, r4)); @@ -72,82 +71,22 @@ const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *rest } -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) -{ - const __m128 lrlr = _mm_setr_ps(left, right, left, right); - __m128 coeffs, deltas, imp0, imp1; - __m128 vals = _mm_setzero_ps(); - ALuint i; - - if((Offset&1)) - { - const ALuint o0 = Offset&HRIR_MASK; - const ALuint o1 = (Offset+IrSize-1)&HRIR_MASK; - - coeffs = _mm_load_ps(&Coeffs[0][0]); - deltas = _mm_load_ps(&CoeffStep[0][0]); - vals = _mm_loadl_pi(vals, (__m64*)&Values[o0][0]); - imp0 = _mm_mul_ps(lrlr, coeffs); - coeffs = _mm_add_ps(coeffs, deltas); - vals = _mm_add_ps(imp0, vals); - _mm_store_ps(&Coeffs[0][0], coeffs); - _mm_storel_pi((__m64*)&Values[o0][0], vals); - for(i = 1;i < IrSize-1;i += 2) - { - const ALuint o2 = (Offset+i)&HRIR_MASK; - - coeffs = _mm_load_ps(&Coeffs[i+1][0]); - deltas = _mm_load_ps(&CoeffStep[i+1][0]); - vals = _mm_load_ps(&Values[o2][0]); - imp1 = _mm_mul_ps(lrlr, coeffs); - coeffs = _mm_add_ps(coeffs, deltas); - imp0 = _mm_shuffle_ps(imp0, imp1, _MM_SHUFFLE(1, 0, 3, 2)); - vals = _mm_add_ps(imp0, vals); - _mm_store_ps(&Coeffs[i+1][0], coeffs); - _mm_store_ps(&Values[o2][0], vals); - imp0 = imp1; - } - vals = _mm_loadl_pi(vals, (__m64*)&Values[o1][0]); - imp0 = _mm_movehl_ps(imp0, imp0); - vals = _mm_add_ps(imp0, vals); - _mm_storel_pi((__m64*)&Values[o1][0], vals); - } - else - { - for(i = 0;i < IrSize;i += 2) - { - const ALuint o = (Offset + i)&HRIR_MASK; - - coeffs = _mm_load_ps(&Coeffs[i][0]); - deltas = _mm_load_ps(&CoeffStep[i][0]); - vals = _mm_load_ps(&Values[o][0]); - imp0 = _mm_mul_ps(lrlr, coeffs); - coeffs = _mm_add_ps(coeffs, deltas); - vals = _mm_add_ps(imp0, vals); - _mm_store_ps(&Coeffs[i][0], coeffs); - _mm_store_ps(&Values[o][0], vals); - } - } -} - -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat left, ALfloat right) { const __m128 lrlr = _mm_setr_ps(left, right, left, right); __m128 vals = _mm_setzero_ps(); __m128 coeffs; - ALuint i; + ALsizei i; + Values = ASSUME_ALIGNED(Values, 16); + Coeffs = ASSUME_ALIGNED(Coeffs, 16); if((Offset&1)) { - const ALuint o0 = Offset&HRIR_MASK; - const ALuint o1 = (Offset+IrSize-1)&HRIR_MASK; + const ALsizei o0 = Offset&HRIR_MASK; + const ALsizei o1 = (Offset+IrSize-1)&HRIR_MASK; __m128 imp0, imp1; coeffs = _mm_load_ps(&Coeffs[0][0]); @@ -157,7 +96,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], _mm_storel_pi((__m64*)&Values[o0][0], vals); for(i = 1;i < IrSize-1;i += 2) { - const ALuint o2 = (Offset+i)&HRIR_MASK; + const ALsizei o2 = (Offset+i)&HRIR_MASK; coeffs = _mm_load_ps(&Coeffs[i+1][0]); vals = _mm_load_ps(&Values[o2][0]); @@ -176,7 +115,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], { for(i = 0;i < IrSize;i += 2) { - const ALuint o = (Offset + i)&HRIR_MASK; + const ALsizei o = (Offset + i)&HRIR_MASK; coeffs = _mm_load_ps(&Coeffs[i][0]); vals = _mm_load_ps(&Values[o][0]); @@ -187,29 +126,31 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], } #define MixHrtf MixHrtf_SSE +#define MixHrtfBlend MixHrtfBlend_SSE #define MixDirectHrtf MixDirectHrtf_SSE -#include "mixer_inc.c" -#undef MixHrtf +#include "hrtf_inc.c" -void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize) +void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize) { ALfloat gain, delta, step; __m128 gain4; - ALuint c; + ALsizei c; + ASSUME(OutChans > 0); + ASSUME(BufferSize > 0); delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; for(c = 0;c < OutChans;c++) { - ALuint pos = 0; + ALsizei pos = 0; gain = CurrentGains[c]; step = (TargetGains[c] - gain) * delta; if(fabsf(step) > FLT_EPSILON) { - ALuint minsize = minu(BufferSize, Counter); + ALsizei minsize = mini(BufferSize, Counter); /* Mix with applying gain steps in aligned multiples of 4. */ if(minsize-pos > 3) { @@ -246,7 +187,7 @@ void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer) CurrentGains[c] = gain; /* Mix until pos is aligned with 4 or the mix is done. */ - minsize = minu(BufferSize, (pos+3)&~3); + minsize = mini(BufferSize, (pos+3)&~3); for(;pos < minsize;pos++) OutBuffer[c][OutPos+pos] += data[pos]*gain; } @@ -266,14 +207,17 @@ void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer) } } -void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, ALuint InPos, ALuint BufferSize) +void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, ALsizei BufferSize) { __m128 gain4; - ALuint c; + ALsizei c; + + ASSUME(InChans > 0); + ASSUME(BufferSize > 0); for(c = 0;c < InChans;c++) { - ALuint pos = 0; + ALsizei pos = 0; ALfloat gain = Gains[c]; if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; diff --git a/Engine/lib/openal-soft/Alc/mixer_sse2.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse2.c similarity index 86% rename from Engine/lib/openal-soft/Alc/mixer_sse2.c rename to Engine/lib/openal-soft/Alc/mixer/mixer_sse2.c index 22a18ef3d..4aeb6fc4c 100644 --- a/Engine/lib/openal-soft/Alc/mixer_sse2.c +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_sse2.c @@ -24,21 +24,23 @@ #include #include "alu.h" -#include "mixer_defs.h" +#include "defs.h" -const ALfloat *Resample_lerp32_SSE2(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) +const ALfloat *Resample_lerp_SSE2(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; + union { alignas(16) ALint i[4]; float f[4]; } pos_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; __m128i frac4, pos4; - ALuint pos; - ALuint i; + ALint pos; + ALsizei i; + + ASSUME(numsamples > 0); InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c new file mode 100644 index 000000000..e69de29bb diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c new file mode 100644 index 000000000..98a3ef74b --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c @@ -0,0 +1,88 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 2014 by Timothy Arceri . + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include +#include + +#include "alu.h" +#include "defs.h" + + +const ALfloat *Resample_lerp_SSE41(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) +{ + const __m128i increment4 = _mm_set1_epi32(increment*4); + const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); + const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); + union { alignas(16) ALint i[4]; float f[4]; } pos_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; + __m128i frac4, pos4; + ALint pos; + ALsizei i; + + ASSUME(numsamples > 0); + + InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); + + frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); + pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); + + for(i = 0;numsamples-i > 3;i += 4) + { + const __m128 val1 = _mm_setr_ps(src[pos_.i[0]], src[pos_.i[1]], src[pos_.i[2]], src[pos_.i[3]]); + const __m128 val2 = _mm_setr_ps(src[pos_.i[0]+1], src[pos_.i[1]+1], src[pos_.i[2]+1], src[pos_.i[3]+1]); + + /* val1 + (val2-val1)*mu */ + const __m128 r0 = _mm_sub_ps(val2, val1); + const __m128 mu = _mm_mul_ps(_mm_cvtepi32_ps(frac4), fracOne4); + const __m128 out = _mm_add_ps(val1, _mm_mul_ps(mu, r0)); + + _mm_store_ps(&dst[i], out); + + frac4 = _mm_add_epi32(frac4, increment4); + pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); + frac4 = _mm_and_si128(frac4, fracMask4); + + pos_.i[0] = _mm_extract_epi32(pos4, 0); + pos_.i[1] = _mm_extract_epi32(pos4, 1); + pos_.i[2] = _mm_extract_epi32(pos4, 2); + pos_.i[3] = _mm_extract_epi32(pos4, 3); + } + + /* NOTE: These four elements represent the position *after* the last four + * samples, so the lowest element is the next position to resample. + */ + pos = pos_.i[0]; + frac = _mm_cvtsi128_si32(frac4); + + for(;i < numsamples;i++) + { + dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE)); + + frac += increment; + pos += frac>>FRACTIONBITS; + frac &= FRACTIONMASK; + } + return dst; +} diff --git a/Engine/lib/openal-soft/Alc/mixer_c.c b/Engine/lib/openal-soft/Alc/mixer_c.c deleted file mode 100644 index 6ef818c78..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_c.c +++ /dev/null @@ -1,228 +0,0 @@ -#include "config.h" - -#include - -#include "alMain.h" -#include "alu.h" -#include "alSource.h" -#include "alAuxEffectSlot.h" - - -static inline ALfloat point32(const ALfloat *restrict vals, ALuint UNUSED(frac)) -{ return vals[0]; } -static inline ALfloat lerp32(const ALfloat *restrict vals, ALuint frac) -{ return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); } -static inline ALfloat fir4_32(const ALfloat *restrict vals, ALuint frac) -{ return resample_fir4(vals[-1], vals[0], vals[1], vals[2], frac); } -static inline ALfloat fir8_32(const ALfloat *restrict vals, ALuint frac) -{ return resample_fir8(vals[-3], vals[-2], vals[-1], vals[0], vals[1], vals[2], vals[3], vals[4], frac); } - - -const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), const ALfloat *restrict src, ALuint UNUSED(frac), - ALuint UNUSED(increment), ALfloat *restrict dst, ALuint numsamples) -{ -#if defined(HAVE_SSE) || defined(HAVE_NEON) - /* Avoid copying the source data if it's aligned like the destination. */ - if((((intptr_t)src)&15) == (((intptr_t)dst)&15)) - return src; -#endif - memcpy(dst, src, numsamples*sizeof(ALfloat)); - return dst; -} - -#define DECL_TEMPLATE(Sampler) \ -const ALfloat *Resample_##Sampler##_C(const BsincState* UNUSED(state), \ - const ALfloat *restrict src, ALuint frac, ALuint increment, \ - ALfloat *restrict dst, ALuint numsamples) \ -{ \ - ALuint i; \ - for(i = 0;i < numsamples;i++) \ - { \ - dst[i] = Sampler(src, frac); \ - \ - frac += increment; \ - src += frac>>FRACTIONBITS; \ - frac &= FRACTIONMASK; \ - } \ - return dst; \ -} - -DECL_TEMPLATE(point32) -DECL_TEMPLATE(lerp32) -DECL_TEMPLATE(fir4_32) -DECL_TEMPLATE(fir8_32) - -#undef DECL_TEMPLATE - -const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint dstlen) -{ - const ALfloat *fil, *scd, *phd, *spd; - const ALfloat sf = state->sf; - const ALuint m = state->m; - const ALint l = state->l; - ALuint j_f, pi, i; - ALfloat pf, r; - ALint j_s; - - for(i = 0;i < dstlen;i++) - { - // Calculate the phase index and factor. -#define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) - pi = frac >> FRAC_PHASE_BITDIFF; - pf = (frac & ((1<coeffs[pi].filter; - scd = state->coeffs[pi].scDelta; - phd = state->coeffs[pi].phDelta; - spd = state->coeffs[pi].spDelta; - - // Apply the scale and phase interpolated filter. - r = 0.0f; - for(j_f = 0,j_s = l;j_f < m;j_f++,j_s++) - r += (fil[j_f] + sf*scd[j_f] + pf*(phd[j_f] + sf*spd[j_f])) * - src[j_s]; - dst[i] = r; - - frac += increment; - src += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - - -void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALuint numsamples) -{ - ALuint i; - if(numsamples > 1) - { - dst[0] = filter->b0 * src[0] + - filter->b1 * filter->x[0] + - filter->b2 * filter->x[1] - - filter->a1 * filter->y[0] - - filter->a2 * filter->y[1]; - dst[1] = filter->b0 * src[1] + - filter->b1 * src[0] + - filter->b2 * filter->x[0] - - filter->a1 * dst[0] - - filter->a2 * filter->y[0]; - for(i = 2;i < numsamples;i++) - dst[i] = filter->b0 * src[i] + - filter->b1 * src[i-1] + - filter->b2 * src[i-2] - - filter->a1 * dst[i-1] - - filter->a2 * dst[i-2]; - filter->x[0] = src[i-1]; - filter->x[1] = src[i-2]; - filter->y[0] = dst[i-1]; - filter->y[1] = dst[i-2]; - } - else if(numsamples == 1) - { - dst[0] = filter->b0 * src[0] + - filter->b1 * filter->x[0] + - filter->b2 * filter->x[1] - - filter->a1 * filter->y[0] - - filter->a2 * filter->y[1]; - filter->x[1] = filter->x[0]; - filter->x[0] = src[0]; - filter->y[1] = filter->y[0]; - filter->y[0] = dst[0]; - } -} - - -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - for(c = 0;c < IrSize;c++) - { - const ALuint off = (Offset+c)&HRIR_MASK; - Values[off][0] += Coeffs[c][0] * left; - Values[off][1] += Coeffs[c][1] * right; - Coeffs[c][0] += CoeffStep[c][0]; - Coeffs[c][1] += CoeffStep[c][1]; - } -} - -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - for(c = 0;c < IrSize;c++) - { - const ALuint off = (Offset+c)&HRIR_MASK; - Values[off][0] += Coeffs[c][0] * left; - Values[off][1] += Coeffs[c][1] * right; - } -} - -#define MixHrtf MixHrtf_C -#define MixDirectHrtf MixDirectHrtf_C -#include "mixer_inc.c" -#undef MixHrtf - - -void Mix_C(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize) -{ - ALfloat gain, delta, step; - ALuint c; - - delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; - - for(c = 0;c < OutChans;c++) - { - ALuint pos = 0; - gain = CurrentGains[c]; - step = (TargetGains[c] - gain) * delta; - if(fabsf(step) > FLT_EPSILON) - { - ALuint minsize = minu(BufferSize, Counter); - for(;pos < minsize;pos++) - { - OutBuffer[c][OutPos+pos] += data[pos]*gain; - gain += step; - } - if(pos == Counter) - gain = TargetGains[c]; - CurrentGains[c] = gain; - } - - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - for(;pos < BufferSize;pos++) - OutBuffer[c][OutPos+pos] += data[pos]*gain; - } -} - -/* Basically the inverse of the above. Rather than one input going to multiple - * outputs (each with its own gain), it's multiple inputs (each with its own - * gain) going to one output. This applies one row (vs one column) of a matrix - * transform. And as the matrices are more or less static once set up, no - * stepping is necessary. - */ -void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, ALuint InPos, ALuint BufferSize) -{ - ALuint c, i; - - for(c = 0;c < InChans;c++) - { - ALfloat gain = Gains[c]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(i = 0;i < BufferSize;i++) - OutBuffer[i] += data[c][InPos+i] * gain; - } -} diff --git a/Engine/lib/openal-soft/Alc/mixer_defs.h b/Engine/lib/openal-soft/Alc/mixer_defs.h deleted file mode 100644 index 249160025..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_defs.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef MIXER_DEFS_H -#define MIXER_DEFS_H - -#include "AL/alc.h" -#include "AL/al.h" -#include "alMain.h" -#include "alu.h" - -struct MixGains; - -struct MixHrtfParams; -struct HrtfState; - -/* C resamplers */ -const ALfloat *Resample_copy32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_point32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_lerp32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_fir4_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_fir8_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); - - -/* C mixers */ -void MixHrtf_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALuint BufferSize); -void MixDirectHrtf_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize); -void Mix_C(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize); -void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, - const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, - ALuint InPos, ALuint BufferSize); - -/* SSE mixers */ -void MixHrtf_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALuint BufferSize); -void MixDirectHrtf_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize); -void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize); -void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, - const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, - ALuint InPos, ALuint BufferSize); - -/* SSE resamplers */ -inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size) -{ - ALuint i; - - pos_arr[0] = 0; - frac_arr[0] = frac; - for(i = 1;i < size;i++) - { - ALuint frac_tmp = frac_arr[i-1] + increment; - pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS); - frac_arr[i] = frac_tmp&FRACTIONMASK; - } -} - -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, ALuint frac, - ALuint increment, ALfloat *restrict dst, ALuint dstlen); - -const ALfloat *Resample_lerp32_SSE2(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); -const ALfloat *Resample_lerp32_SSE41(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); - -const ALfloat *Resample_fir4_32_SSE3(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); -const ALfloat *Resample_fir4_32_SSE41(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); - -const ALfloat *Resample_fir8_32_SSE3(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); -const ALfloat *Resample_fir8_32_SSE41(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); - -/* Neon mixers */ -void MixHrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALuint BufferSize); -void MixDirectHrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize); -void Mix_Neon(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize); -void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, - const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, - ALuint InPos, ALuint BufferSize); - -#endif /* MIXER_DEFS_H */ diff --git a/Engine/lib/openal-soft/Alc/mixer_inc.c b/Engine/lib/openal-soft/Alc/mixer_inc.c deleted file mode 100644 index 25dc2b588..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_inc.c +++ /dev/null @@ -1,149 +0,0 @@ -#include "config.h" - -#include "alMain.h" -#include "alSource.h" - -#include "hrtf.h" -#include "mixer_defs.h" -#include "align.h" -#include "alu.h" - - -#define MAX_UPDATE_SAMPLES 128 - - -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint irSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right); -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint irSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right); - - -void MixHrtf(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const MixHrtfParams *hrtfparams, HrtfState *hrtfstate, - ALuint BufferSize) -{ - ALfloat (*Coeffs)[2] = hrtfparams->Current->Coeffs; - ALuint Delay[2] = { hrtfparams->Current->Delay[0], hrtfparams->Current->Delay[1] }; - ALfloat out[MAX_UPDATE_SAMPLES][2]; - ALfloat left, right; - ALuint minsize; - ALuint pos, i; - - pos = 0; - if(Counter == 0) - goto skip_stepping; - - minsize = minu(BufferSize, Counter); - while(pos < minsize) - { - ALuint todo = minu(minsize-pos, MAX_UPDATE_SAMPLES); - - for(i = 0;i < todo;i++) - { - hrtfstate->History[Offset&HRTF_HISTORY_MASK] = data[pos++]; - left = lerp(hrtfstate->History[(Offset-(Delay[0]>>HRTFDELAY_BITS))&HRTF_HISTORY_MASK], - hrtfstate->History[(Offset-(Delay[0]>>HRTFDELAY_BITS)-1)&HRTF_HISTORY_MASK], - (Delay[0]&HRTFDELAY_MASK)*(1.0f/HRTFDELAY_FRACONE)); - right = lerp(hrtfstate->History[(Offset-(Delay[1]>>HRTFDELAY_BITS))&HRTF_HISTORY_MASK], - hrtfstate->History[(Offset-(Delay[1]>>HRTFDELAY_BITS)-1)&HRTF_HISTORY_MASK], - (Delay[1]&HRTFDELAY_MASK)*(1.0f/HRTFDELAY_FRACONE)); - - Delay[0] += hrtfparams->Steps.Delay[0]; - Delay[1] += hrtfparams->Steps.Delay[1]; - - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; - Offset++; - - ApplyCoeffsStep(Offset, hrtfstate->Values, IrSize, Coeffs, hrtfparams->Steps.Coeffs, left, right); - out[i][0] = hrtfstate->Values[Offset&HRIR_MASK][0]; - out[i][1] = hrtfstate->Values[Offset&HRIR_MASK][1]; - } - - for(i = 0;i < todo;i++) - OutBuffer[lidx][OutPos+i] += out[i][0]; - for(i = 0;i < todo;i++) - OutBuffer[ridx][OutPos+i] += out[i][1]; - OutPos += todo; - } - - if(pos == Counter) - { - *hrtfparams->Current = *hrtfparams->Target; - Delay[0] = hrtfparams->Target->Delay[0]; - Delay[1] = hrtfparams->Target->Delay[1]; - } - else - { - hrtfparams->Current->Delay[0] = Delay[0]; - hrtfparams->Current->Delay[1] = Delay[1]; - } - -skip_stepping: - Delay[0] >>= HRTFDELAY_BITS; - Delay[1] >>= HRTFDELAY_BITS; - while(pos < BufferSize) - { - ALuint todo = minu(BufferSize-pos, MAX_UPDATE_SAMPLES); - - for(i = 0;i < todo;i++) - { - hrtfstate->History[Offset&HRTF_HISTORY_MASK] = data[pos++]; - left = hrtfstate->History[(Offset-Delay[0])&HRTF_HISTORY_MASK]; - right = hrtfstate->History[(Offset-Delay[1])&HRTF_HISTORY_MASK]; - - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; - Offset++; - - ApplyCoeffs(Offset, hrtfstate->Values, IrSize, Coeffs, left, right); - out[i][0] = hrtfstate->Values[Offset&HRIR_MASK][0]; - out[i][1] = hrtfstate->Values[Offset&HRIR_MASK][1]; - } - - for(i = 0;i < todo;i++) - OutBuffer[lidx][OutPos+i] += out[i][0]; - for(i = 0;i < todo;i++) - OutBuffer[ridx][OutPos+i] += out[i][1]; - OutPos += todo; - } -} - -void MixDirectHrtf(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize) -{ - ALfloat out[MAX_UPDATE_SAMPLES][2]; - ALfloat insample; - ALuint pos, i; - - for(pos = 0;pos < BufferSize;) - { - ALuint todo = minu(BufferSize-pos, MAX_UPDATE_SAMPLES); - - for(i = 0;i < todo;i++) - { - Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; - Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; - Offset++; - - insample = *(data++); - ApplyCoeffs(Offset, Values, IrSize, Coeffs, insample, insample); - out[i][0] = Values[Offset&HRIR_MASK][0]; - out[i][1] = Values[Offset&HRIR_MASK][1]; - } - - for(i = 0;i < todo;i++) - OutBuffer[lidx][pos+i] += out[i][0]; - for(i = 0;i < todo;i++) - OutBuffer[ridx][pos+i] += out[i][1]; - pos += todo; - } -} diff --git a/Engine/lib/openal-soft/Alc/mixer_neon.c b/Engine/lib/openal-soft/Alc/mixer_neon.c deleted file mode 100644 index 6b506357b..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_neon.c +++ /dev/null @@ -1,173 +0,0 @@ -#include "config.h" - -#include - -#include "AL/al.h" -#include "AL/alc.h" -#include "alMain.h" -#include "alu.h" -#include "hrtf.h" - - -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - float32x4_t leftright4; - { - float32x2_t leftright2 = vdup_n_f32(0.0); - leftright2 = vset_lane_f32(left, leftright2, 0); - leftright2 = vset_lane_f32(right, leftright2, 1); - leftright4 = vcombine_f32(leftright2, leftright2); - } - for(c = 0;c < IrSize;c += 2) - { - const ALuint o0 = (Offset+c)&HRIR_MASK; - const ALuint o1 = (o0+1)&HRIR_MASK; - float32x4_t vals = vcombine_f32(vld1_f32((float32_t*)&Values[o0][0]), - vld1_f32((float32_t*)&Values[o1][0])); - float32x4_t coefs = vld1q_f32((float32_t*)&Coeffs[c][0]); - float32x4_t deltas = vld1q_f32(&CoeffStep[c][0]); - - vals = vmlaq_f32(vals, coefs, leftright4); - coefs = vaddq_f32(coefs, deltas); - - vst1_f32((float32_t*)&Values[o0][0], vget_low_f32(vals)); - vst1_f32((float32_t*)&Values[o1][0], vget_high_f32(vals)); - vst1q_f32(&Coeffs[c][0], coefs); - } -} - -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - float32x4_t leftright4; - { - float32x2_t leftright2 = vdup_n_f32(0.0); - leftright2 = vset_lane_f32(left, leftright2, 0); - leftright2 = vset_lane_f32(right, leftright2, 1); - leftright4 = vcombine_f32(leftright2, leftright2); - } - for(c = 0;c < IrSize;c += 2) - { - const ALuint o0 = (Offset+c)&HRIR_MASK; - const ALuint o1 = (o0+1)&HRIR_MASK; - float32x4_t vals = vcombine_f32(vld1_f32((float32_t*)&Values[o0][0]), - vld1_f32((float32_t*)&Values[o1][0])); - float32x4_t coefs = vld1q_f32((float32_t*)&Coeffs[c][0]); - - vals = vmlaq_f32(vals, coefs, leftright4); - - vst1_f32((float32_t*)&Values[o0][0], vget_low_f32(vals)); - vst1_f32((float32_t*)&Values[o1][0], vget_high_f32(vals)); - } -} - -#define MixHrtf MixHrtf_Neon -#define MixDirectHrtf MixDirectHrtf_Neon -#include "mixer_inc.c" -#undef MixHrtf - - -void Mix_Neon(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize) -{ - ALfloat gain, delta, step; - float32x4_t gain4; - ALuint c; - - delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; - - for(c = 0;c < OutChans;c++) - { - ALuint pos = 0; - gain = CurrentGains[c]; - step = (TargetGains[c] - gain) * delta; - if(fabsf(step) > FLT_EPSILON) - { - ALuint minsize = minu(BufferSize, Counter); - /* Mix with applying gain steps in aligned multiples of 4. */ - if(minsize-pos > 3) - { - float32x4_t step4; - gain4 = vsetq_lane_f32(gain, gain4, 0); - gain4 = vsetq_lane_f32(gain + step, gain4, 1); - gain4 = vsetq_lane_f32(gain + step + step, gain4, 2); - gain4 = vsetq_lane_f32(gain + step + step + step, gain4, 3); - step4 = vdupq_n_f32(step + step + step + step); - do { - const float32x4_t val4 = vld1q_f32(&data[pos]); - float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); - dry4 = vmlaq_f32(dry4, val4, gain4); - gain4 = vaddq_f32(gain4, step4); - vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); - pos += 4; - } while(minsize-pos > 3); - /* NOTE: gain4 now represents the next four gains after the - * last four mixed samples, so the lowest element represents - * the next gain to apply. - */ - gain = vgetq_lane_f32(gain4, 0); - } - /* Mix with applying left over gain steps that aren't aligned multiples of 4. */ - for(;pos < minsize;pos++) - { - OutBuffer[c][OutPos+pos] += data[pos]*gain; - gain += step; - } - if(pos == Counter) - gain = TargetGains[c]; - CurrentGains[c] = gain; - - /* Mix until pos is aligned with 4 or the mix is done. */ - minsize = minu(BufferSize, (pos+3)&~3); - for(;pos < minsize;pos++) - OutBuffer[c][OutPos+pos] += data[pos]*gain; - } - - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - gain4 = vdupq_n_f32(gain); - for(;BufferSize-pos > 3;pos += 4) - { - const float32x4_t val4 = vld1q_f32(&data[pos]); - float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); - dry4 = vmlaq_f32(dry4, val4, gain4); - vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); - } - for(;pos < BufferSize;pos++) - OutBuffer[c][OutPos+pos] += data[pos]*gain; - } -} - -void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, ALuint InPos, ALuint BufferSize) -{ - float32x4_t gain4; - ALuint c; - - for(c = 0;c < InChans;c++) - { - ALuint pos = 0; - ALfloat gain = Gains[c]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - gain4 = vdupq_n_f32(gain); - for(;BufferSize-pos > 3;pos += 4) - { - const float32x4_t val4 = vld1q_f32(&data[c][InPos+pos]); - float32x4_t dry4 = vld1q_f32(&OutBuffer[pos]); - dry4 = vmlaq_f32(dry4, val4, gain4); - vst1q_f32(&OutBuffer[pos], dry4); - } - for(;pos < BufferSize;pos++) - OutBuffer[pos] += data[c][InPos+pos]*gain; - } -} diff --git a/Engine/lib/openal-soft/Alc/mixer_sse3.c b/Engine/lib/openal-soft/Alc/mixer_sse3.c deleted file mode 100644 index 66005e534..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_sse3.c +++ /dev/null @@ -1,164 +0,0 @@ -/** - * OpenAL cross platform audio library, SSE3 mixer functions - * - * Copyright (C) 2014 by Timothy Arceri . - * Copyright (C) 2015 by Chris Robinson . - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include -#include - -#include "alu.h" -#include "mixer_defs.h" - - -const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - --src; - for(i = 0;numsamples-i > 3;i += 4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]]); - __m128 k0 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[0]]); - __m128 k1 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[1]]); - __m128 k2 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[2]]); - __m128 k3 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[3]]); - __m128 out; - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out = _mm_hadd_ps(k0, k2); - - _mm_store_ps(&dst[i], out); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - _mm_store_ps(pos_.f, _mm_castsi128_ps(pos4)); - _mm_store_ps(frac_.f, _mm_castsi128_ps(frac4)); - } - - /* NOTE: These four elements represent the position *after* the last four - * samples, so the lowest element is the next position to resample. - */ - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir4(src[pos], src[pos+1], src[pos+2], src[pos+3], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - -const ALfloat *Resample_fir8_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i, j; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - src -= 3; - for(i = 0;numsamples-i > 3;i += 4) - { - __m128 out[2]; - for(j = 0;j < 8;j+=4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]+j]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]+j]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]+j]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]+j]); - __m128 k0 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[0]][j]); - __m128 k1 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[1]][j]); - __m128 k2 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[2]][j]); - __m128 k3 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[3]][j]); - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out[j>>2] = _mm_hadd_ps(k0, k2); - } - - out[0] = _mm_add_ps(out[0], out[1]); - _mm_store_ps(&dst[i], out[0]); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - _mm_store_ps(pos_.f, _mm_castsi128_ps(pos4)); - _mm_store_ps(frac_.f, _mm_castsi128_ps(frac4)); - } - - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir8(src[pos ], src[pos+1], src[pos+2], src[pos+3], - src[pos+4], src[pos+5], src[pos+6], src[pos+7], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} diff --git a/Engine/lib/openal-soft/Alc/mixer_sse41.c b/Engine/lib/openal-soft/Alc/mixer_sse41.c deleted file mode 100644 index 7a4db6cf7..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_sse41.c +++ /dev/null @@ -1,227 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 2014 by Timothy Arceri . - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include -#include - -#include "alu.h" -#include "mixer_defs.h" - - -const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - for(i = 0;numsamples-i > 3;i += 4) - { - const __m128 val1 = _mm_setr_ps(src[pos_.i[0]], src[pos_.i[1]], src[pos_.i[2]], src[pos_.i[3]]); - const __m128 val2 = _mm_setr_ps(src[pos_.i[0]+1], src[pos_.i[1]+1], src[pos_.i[2]+1], src[pos_.i[3]+1]); - - /* val1 + (val2-val1)*mu */ - const __m128 r0 = _mm_sub_ps(val2, val1); - const __m128 mu = _mm_mul_ps(_mm_cvtepi32_ps(frac4), fracOne4); - const __m128 out = _mm_add_ps(val1, _mm_mul_ps(mu, r0)); - - _mm_store_ps(&dst[i], out); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - pos_.i[0] = _mm_extract_epi32(pos4, 0); - pos_.i[1] = _mm_extract_epi32(pos4, 1); - pos_.i[2] = _mm_extract_epi32(pos4, 2); - pos_.i[3] = _mm_extract_epi32(pos4, 3); - } - - /* NOTE: These four elements represent the position *after* the last four - * samples, so the lowest element is the next position to resample. - */ - pos = pos_.i[0]; - frac = _mm_cvtsi128_si32(frac4); - - for(;i < numsamples;i++) - { - dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE)); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - -const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - --src; - for(i = 0;numsamples-i > 3;i += 4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]]); - __m128 k0 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[0]]); - __m128 k1 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[1]]); - __m128 k2 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[2]]); - __m128 k3 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[3]]); - __m128 out; - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out = _mm_hadd_ps(k0, k2); - - _mm_store_ps(&dst[i], out); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - pos_.i[0] = _mm_extract_epi32(pos4, 0); - pos_.i[1] = _mm_extract_epi32(pos4, 1); - pos_.i[2] = _mm_extract_epi32(pos4, 2); - pos_.i[3] = _mm_extract_epi32(pos4, 3); - frac_.i[0] = _mm_extract_epi32(frac4, 0); - frac_.i[1] = _mm_extract_epi32(frac4, 1); - frac_.i[2] = _mm_extract_epi32(frac4, 2); - frac_.i[3] = _mm_extract_epi32(frac4, 3); - } - - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir4(src[pos], src[pos+1], src[pos+2], src[pos+3], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - -const ALfloat *Resample_fir8_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i, j; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - src -= 3; - for(i = 0;numsamples-i > 3;i += 4) - { - __m128 out[2]; - for(j = 0;j < 8;j+=4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]+j]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]+j]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]+j]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]+j]); - __m128 k0 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[0]][j]); - __m128 k1 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[1]][j]); - __m128 k2 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[2]][j]); - __m128 k3 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[3]][j]); - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out[j>>2] = _mm_hadd_ps(k0, k2); - } - - out[0] = _mm_add_ps(out[0], out[1]); - _mm_store_ps(&dst[i], out[0]); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - pos_.i[0] = _mm_extract_epi32(pos4, 0); - pos_.i[1] = _mm_extract_epi32(pos4, 1); - pos_.i[2] = _mm_extract_epi32(pos4, 2); - pos_.i[3] = _mm_extract_epi32(pos4, 3); - frac_.i[0] = _mm_extract_epi32(frac4, 0); - frac_.i[1] = _mm_extract_epi32(frac4, 1); - frac_.i[2] = _mm_extract_epi32(frac4, 2); - frac_.i[3] = _mm_extract_epi32(frac4, 3); - } - - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir8(src[pos ], src[pos+1], src[pos+2], src[pos+3], - src[pos+4], src[pos+5], src[pos+6], src[pos+7], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} diff --git a/Engine/lib/openal-soft/Alc/mixvoice.c b/Engine/lib/openal-soft/Alc/mixvoice.c new file mode 100644 index 000000000..2d935ce5e --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixvoice.c @@ -0,0 +1,761 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 1999-2007 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "alMain.h" +#include "AL/al.h" +#include "AL/alc.h" +#include "alSource.h" +#include "alBuffer.h" +#include "alListener.h" +#include "alAuxEffectSlot.h" +#include "sample_cvt.h" +#include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" + +#include "cpu_caps.h" +#include "mixer/defs.h" + + +static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, + "MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!"); + +extern inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size); + + +/* BSinc24 requires up to 23 extra samples before the current position, and 24 after. */ +static_assert(MAX_RESAMPLE_PADDING >= 24, "MAX_RESAMPLE_PADDING must be at least 24!"); + + +enum Resampler ResamplerDefault = LinearResampler; + +MixerFunc MixSamples = Mix_C; +RowMixerFunc MixRowSamples = MixRow_C; +static HrtfMixerFunc MixHrtfSamples = MixHrtf_C; +static HrtfMixerBlendFunc MixHrtfBlendSamples = MixHrtfBlend_C; + +static MixerFunc SelectMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Mix_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return Mix_SSE; +#endif + return Mix_C; +} + +static RowMixerFunc SelectRowMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return MixRow_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixRow_SSE; +#endif + return MixRow_C; +} + +static inline HrtfMixerFunc SelectHrtfMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return MixHrtf_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixHrtf_SSE; +#endif + return MixHrtf_C; +} + +static inline HrtfMixerBlendFunc SelectHrtfBlendMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return MixHrtfBlend_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixHrtfBlend_SSE; +#endif + return MixHrtfBlend_C; +} + +ResamplerFunc SelectResampler(enum Resampler resampler) +{ + switch(resampler) + { + case PointResampler: + return Resample_point_C; + case LinearResampler: +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Resample_lerp_Neon; +#endif +#ifdef HAVE_SSE4_1 + if((CPUCapFlags&CPU_CAP_SSE4_1)) + return Resample_lerp_SSE41; +#endif +#ifdef HAVE_SSE2 + if((CPUCapFlags&CPU_CAP_SSE2)) + return Resample_lerp_SSE2; +#endif + return Resample_lerp_C; + case FIR4Resampler: + return Resample_cubic_C; + case BSinc12Resampler: + case BSinc24Resampler: +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Resample_bsinc_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return Resample_bsinc_SSE; +#endif + return Resample_bsinc_C; + } + + return Resample_point_C; +} + + +void aluInitMixer(void) +{ + const char *str; + + if(ConfigValueStr(NULL, NULL, "resampler", &str)) + { + if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0) + ResamplerDefault = PointResampler; + else if(strcasecmp(str, "linear") == 0) + ResamplerDefault = LinearResampler; + else if(strcasecmp(str, "cubic") == 0) + ResamplerDefault = FIR4Resampler; + else if(strcasecmp(str, "bsinc12") == 0) + ResamplerDefault = BSinc12Resampler; + else if(strcasecmp(str, "bsinc24") == 0) + ResamplerDefault = BSinc24Resampler; + else if(strcasecmp(str, "bsinc") == 0) + { + WARN("Resampler option \"%s\" is deprecated, using bsinc12\n", str); + ResamplerDefault = BSinc12Resampler; + } + else if(strcasecmp(str, "sinc4") == 0 || strcasecmp(str, "sinc8") == 0) + { + WARN("Resampler option \"%s\" is deprecated, using cubic\n", str); + ResamplerDefault = FIR4Resampler; + } + else + { + char *end; + long n = strtol(str, &end, 0); + if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler)) + ResamplerDefault = n; + else + WARN("Invalid resampler: %s\n", str); + } + } + + MixHrtfBlendSamples = SelectHrtfBlendMixer(); + MixHrtfSamples = SelectHrtfMixer(); + MixSamples = SelectMixer(); + MixRowSamples = SelectRowMixer(); +} + + +static void SendAsyncEvent(ALCcontext *context, ALuint enumtype, ALenum type, + ALuint objid, ALuint param, const char *msg) +{ + AsyncEvent evt; + evt.EnumType = enumtype; + evt.Type = type; + evt.ObjectId = objid; + evt.Param = param; + strcpy(evt.Message, msg); + if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&context->EventSem); +} + + +static inline ALfloat Sample_ALubyte(ALubyte val) +{ return (val-128) * (1.0f/128.0f); } + +static inline ALfloat Sample_ALshort(ALshort val) +{ return val * (1.0f/32768.0f); } + +static inline ALfloat Sample_ALfloat(ALfloat val) +{ return val; } + +static inline ALfloat Sample_ALdouble(ALdouble val) +{ return (ALfloat)val; } + +typedef ALubyte ALmulaw; +static inline ALfloat Sample_ALmulaw(ALmulaw val) +{ return muLawDecompressionTable[val] * (1.0f/32768.0f); } + +typedef ALubyte ALalaw; +static inline ALfloat Sample_ALalaw(ALalaw val) +{ return aLawDecompressionTable[val] * (1.0f/32768.0f); } + +#define DECL_TEMPLATE(T) \ +static inline void Load_##T(ALfloat *restrict dst, const T *restrict src, \ + ALint srcstep, ALsizei samples) \ +{ \ + ALsizei i; \ + for(i = 0;i < samples;i++) \ + dst[i] += Sample_##T(src[i*srcstep]); \ +} + +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALfloat) +DECL_TEMPLATE(ALdouble) +DECL_TEMPLATE(ALmulaw) +DECL_TEMPLATE(ALalaw) + +#undef DECL_TEMPLATE + +static void LoadSamples(ALfloat *restrict dst, const ALvoid *restrict src, ALint srcstep, + enum FmtType srctype, ALsizei samples) +{ +#define HANDLE_FMT(ET, ST) case ET: Load_##ST(dst, src, srcstep, samples); break + switch(srctype) + { + HANDLE_FMT(FmtUByte, ALubyte); + HANDLE_FMT(FmtShort, ALshort); + HANDLE_FMT(FmtFloat, ALfloat); + HANDLE_FMT(FmtDouble, ALdouble); + HANDLE_FMT(FmtMulaw, ALmulaw); + HANDLE_FMT(FmtAlaw, ALalaw); + } +#undef HANDLE_FMT +} + + +static const ALfloat *DoFilters(BiquadFilter *lpfilter, BiquadFilter *hpfilter, + ALfloat *restrict dst, const ALfloat *restrict src, + ALsizei numsamples, enum ActiveFilters type) +{ + ALsizei i; + switch(type) + { + case AF_None: + BiquadFilter_passthru(lpfilter, numsamples); + BiquadFilter_passthru(hpfilter, numsamples); + break; + + case AF_LowPass: + BiquadFilter_process(lpfilter, dst, src, numsamples); + BiquadFilter_passthru(hpfilter, numsamples); + return dst; + case AF_HighPass: + BiquadFilter_passthru(lpfilter, numsamples); + BiquadFilter_process(hpfilter, dst, src, numsamples); + return dst; + + case AF_BandPass: + for(i = 0;i < numsamples;) + { + ALfloat temp[256]; + ALsizei todo = mini(256, numsamples-i); + + BiquadFilter_process(lpfilter, temp, src+i, todo); + BiquadFilter_process(hpfilter, dst+i, temp, todo); + i += todo; + } + return dst; + } + return src; +} + + +/* This function uses these device temp buffers. */ +#define SOURCE_DATA_BUF 0 +#define RESAMPLED_BUF 1 +#define FILTERED_BUF 2 +#define NFC_DATA_BUF 3 +ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsizei SamplesToDo) +{ + ALCdevice *Device = Context->Device; + ALbufferlistitem *BufferListItem; + ALbufferlistitem *BufferLoopItem; + ALsizei NumChannels, SampleSize; + ALbitfieldSOFT enabledevt; + ALsizei buffers_done = 0; + ResamplerFunc Resample; + ALsizei DataPosInt; + ALsizei DataPosFrac; + ALint64 DataSize64; + ALint increment; + ALsizei Counter; + ALsizei OutPos; + ALsizei IrSize; + bool isplaying; + bool firstpass; + bool isstatic; + ALsizei chan; + ALsizei send; + + /* Get source info */ + isplaying = true; /* Will only be called while playing. */ + isstatic = !!(voice->Flags&VOICE_IS_STATIC); + DataPosInt = ATOMIC_LOAD(&voice->position, almemory_order_acquire); + DataPosFrac = ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed); + BufferListItem = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + BufferLoopItem = ATOMIC_LOAD(&voice->loop_buffer, almemory_order_relaxed); + NumChannels = voice->NumChannels; + SampleSize = voice->SampleSize; + increment = voice->Step; + + IrSize = (Device->HrtfHandle ? Device->HrtfHandle->irSize : 0); + + Resample = ((increment == FRACTIONONE && DataPosFrac == 0) ? + Resample_copy_C : voice->Resampler); + + Counter = (voice->Flags&VOICE_IS_FADING) ? SamplesToDo : 0; + firstpass = true; + OutPos = 0; + + do { + ALsizei SrcBufferSize, DstBufferSize; + + /* Figure out how many buffer samples will be needed */ + DataSize64 = SamplesToDo-OutPos; + DataSize64 *= increment; + DataSize64 += DataPosFrac+FRACTIONMASK; + DataSize64 >>= FRACTIONBITS; + DataSize64 += MAX_RESAMPLE_PADDING*2; + SrcBufferSize = (ALsizei)mini64(DataSize64, BUFFERSIZE); + + /* Figure out how many samples we can actually mix from this. */ + DataSize64 = SrcBufferSize; + DataSize64 -= MAX_RESAMPLE_PADDING*2; + DataSize64 <<= FRACTIONBITS; + DataSize64 -= DataPosFrac; + DstBufferSize = (ALsizei)mini64((DataSize64+(increment-1)) / increment, + SamplesToDo - OutPos); + + /* Some mixers like having a multiple of 4, so try to give that unless + * this is the last update. */ + if(DstBufferSize < SamplesToDo-OutPos) + DstBufferSize &= ~3; + + /* It's impossible to have a buffer list item with no entries. */ + assert(BufferListItem->num_buffers > 0); + + for(chan = 0;chan < NumChannels;chan++) + { + const ALfloat *ResampledData; + ALfloat *SrcData = Device->TempBuffer[SOURCE_DATA_BUF]; + ALsizei FilledAmt; + + /* Load the previous samples into the source data first, and clear the rest. */ + memcpy(SrcData, voice->PrevSamples[chan], MAX_RESAMPLE_PADDING*sizeof(ALfloat)); + memset(SrcData+MAX_RESAMPLE_PADDING, 0, (BUFFERSIZE-MAX_RESAMPLE_PADDING)* + sizeof(ALfloat)); + FilledAmt = MAX_RESAMPLE_PADDING; + + if(isstatic) + { + /* TODO: For static sources, loop points are taken from the + * first buffer (should be adjusted by any buffer offset, to + * possibly be added later). + */ + const ALbuffer *Buffer0 = BufferListItem->buffers[0]; + const ALsizei LoopStart = Buffer0->LoopStart; + const ALsizei LoopEnd = Buffer0->LoopEnd; + const ALsizei LoopSize = LoopEnd - LoopStart; + + /* If current pos is beyond the loop range, do not loop */ + if(!BufferLoopItem || DataPosInt >= LoopEnd) + { + ALsizei SizeToDo = SrcBufferSize - FilledAmt; + ALsizei CompLen = 0; + ALsizei i; + + BufferLoopItem = NULL; + + for(i = 0;i < BufferListItem->num_buffers;i++) + { + const ALbuffer *buffer = BufferListItem->buffers[i]; + const ALubyte *Data = buffer->data; + ALsizei DataSize; + + if(DataPosInt >= buffer->SampleLen) + continue; + + /* Load what's left to play from the buffer */ + DataSize = mini(SizeToDo, buffer->SampleLen - DataPosInt); + CompLen = maxi(CompLen, DataSize); + + LoadSamples(&SrcData[FilledAmt], + &Data[(DataPosInt*NumChannels + chan)*SampleSize], + NumChannels, buffer->FmtType, DataSize + ); + } + FilledAmt += CompLen; + } + else + { + ALsizei SizeToDo = mini(SrcBufferSize - FilledAmt, LoopEnd - DataPosInt); + ALsizei CompLen = 0; + ALsizei i; + + for(i = 0;i < BufferListItem->num_buffers;i++) + { + const ALbuffer *buffer = BufferListItem->buffers[i]; + const ALubyte *Data = buffer->data; + ALsizei DataSize; + + if(DataPosInt >= buffer->SampleLen) + continue; + + /* Load what's left of this loop iteration */ + DataSize = mini(SizeToDo, buffer->SampleLen - DataPosInt); + CompLen = maxi(CompLen, DataSize); + + LoadSamples(&SrcData[FilledAmt], + &Data[(DataPosInt*NumChannels + chan)*SampleSize], + NumChannels, buffer->FmtType, DataSize + ); + } + FilledAmt += CompLen; + + while(SrcBufferSize > FilledAmt) + { + const ALsizei SizeToDo = mini(SrcBufferSize - FilledAmt, LoopSize); + + CompLen = 0; + for(i = 0;i < BufferListItem->num_buffers;i++) + { + const ALbuffer *buffer = BufferListItem->buffers[i]; + const ALubyte *Data = buffer->data; + ALsizei DataSize; + + if(LoopStart >= buffer->SampleLen) + continue; + + DataSize = mini(SizeToDo, buffer->SampleLen - LoopStart); + CompLen = maxi(CompLen, DataSize); + + LoadSamples(&SrcData[FilledAmt], + &Data[(LoopStart*NumChannels + chan)*SampleSize], + NumChannels, buffer->FmtType, DataSize + ); + } + FilledAmt += CompLen; + } + } + } + else + { + /* Crawl the buffer queue to fill in the temp buffer */ + ALbufferlistitem *tmpiter = BufferListItem; + ALsizei pos = DataPosInt; + + while(tmpiter && SrcBufferSize > FilledAmt) + { + ALsizei SizeToDo = SrcBufferSize - FilledAmt; + ALsizei i; + + for(i = 0;i < tmpiter->num_buffers;i++) + { + const ALbuffer *ALBuffer = tmpiter->buffers[i]; + ALsizei DataSize = ALBuffer ? ALBuffer->SampleLen : 0; + + if(DataSize > pos) + { + const ALubyte *Data = ALBuffer->data; + Data += (pos*NumChannels + chan)*SampleSize; + + DataSize = minu(SizeToDo, DataSize - pos); + LoadSamples(&SrcData[FilledAmt], Data, NumChannels, + ALBuffer->FmtType, DataSize); + } + } + if(pos > tmpiter->max_samples) + pos -= tmpiter->max_samples; + else + { + FilledAmt += tmpiter->max_samples - pos; + pos = 0; + } + if(SrcBufferSize > FilledAmt) + { + tmpiter = ATOMIC_LOAD(&tmpiter->next, almemory_order_acquire); + if(!tmpiter) tmpiter = BufferLoopItem; + } + } + } + + /* Store the last source samples used for next time. */ + memcpy(voice->PrevSamples[chan], + &SrcData[(increment*DstBufferSize + DataPosFrac)>>FRACTIONBITS], + MAX_RESAMPLE_PADDING*sizeof(ALfloat) + ); + + /* Now resample, then filter and mix to the appropriate outputs. */ + ResampledData = Resample(&voice->ResampleState, + &SrcData[MAX_RESAMPLE_PADDING], DataPosFrac, increment, + Device->TempBuffer[RESAMPLED_BUF], DstBufferSize + ); + { + DirectParams *parms = &voice->Direct.Params[chan]; + const ALfloat *samples; + + samples = DoFilters( + &parms->LowPass, &parms->HighPass, Device->TempBuffer[FILTERED_BUF], + ResampledData, DstBufferSize, voice->Direct.FilterType + ); + if(!(voice->Flags&VOICE_HAS_HRTF)) + { + if(!Counter) + memcpy(parms->Gains.Current, parms->Gains.Target, + sizeof(parms->Gains.Current)); + if(!(voice->Flags&VOICE_HAS_NFC)) + MixSamples(samples, voice->Direct.Channels, voice->Direct.Buffer, + parms->Gains.Current, parms->Gains.Target, Counter, OutPos, + DstBufferSize + ); + else + { + ALfloat *nfcsamples = Device->TempBuffer[NFC_DATA_BUF]; + ALsizei chanoffset = 0; + + MixSamples(samples, + voice->Direct.ChannelsPerOrder[0], voice->Direct.Buffer, + parms->Gains.Current, parms->Gains.Target, Counter, OutPos, + DstBufferSize + ); + chanoffset += voice->Direct.ChannelsPerOrder[0]; +#define APPLY_NFC_MIX(order) \ + if(voice->Direct.ChannelsPerOrder[order] > 0) \ + { \ + NfcFilterProcess##order(&parms->NFCtrlFilter, nfcsamples, samples, \ + DstBufferSize); \ + MixSamples(nfcsamples, voice->Direct.ChannelsPerOrder[order], \ + voice->Direct.Buffer+chanoffset, parms->Gains.Current+chanoffset, \ + parms->Gains.Target+chanoffset, Counter, OutPos, DstBufferSize \ + ); \ + chanoffset += voice->Direct.ChannelsPerOrder[order]; \ + } + APPLY_NFC_MIX(1) + APPLY_NFC_MIX(2) + APPLY_NFC_MIX(3) +#undef APPLY_NFC_MIX + } + } + else + { + MixHrtfParams hrtfparams; + ALsizei fademix = 0; + int lidx, ridx; + + lidx = GetChannelIdxByName(&Device->RealOut, FrontLeft); + ridx = GetChannelIdxByName(&Device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + if(!Counter) + { + /* No fading, just overwrite the old HRTF params. */ + parms->Hrtf.Old = parms->Hrtf.Target; + } + else if(!(parms->Hrtf.Old.Gain > GAIN_SILENCE_THRESHOLD)) + { + /* The old HRTF params are silent, so overwrite the old + * coefficients with the new, and reset the old gain to + * 0. The future mix will then fade from silence. + */ + parms->Hrtf.Old = parms->Hrtf.Target; + parms->Hrtf.Old.Gain = 0.0f; + } + else if(firstpass) + { + ALfloat gain; + + /* Fade between the coefficients over 128 samples. */ + fademix = mini(DstBufferSize, 128); + + /* The new coefficients need to fade in completely + * since they're replacing the old ones. To keep the + * gain fading consistent, interpolate between the old + * and new target gains given how much of the fade time + * this mix handles. + */ + gain = lerp(parms->Hrtf.Old.Gain, parms->Hrtf.Target.Gain, + minf(1.0f, (ALfloat)fademix/Counter)); + hrtfparams.Coeffs = parms->Hrtf.Target.Coeffs; + hrtfparams.Delay[0] = parms->Hrtf.Target.Delay[0]; + hrtfparams.Delay[1] = parms->Hrtf.Target.Delay[1]; + hrtfparams.Gain = 0.0f; + hrtfparams.GainStep = gain / (ALfloat)fademix; + + MixHrtfBlendSamples( + voice->Direct.Buffer[lidx], voice->Direct.Buffer[ridx], + samples, voice->Offset, OutPos, IrSize, &parms->Hrtf.Old, + &hrtfparams, &parms->Hrtf.State, fademix + ); + /* Update the old parameters with the result. */ + parms->Hrtf.Old = parms->Hrtf.Target; + if(fademix < Counter) + parms->Hrtf.Old.Gain = hrtfparams.Gain; + } + + if(fademix < DstBufferSize) + { + ALsizei todo = DstBufferSize - fademix; + ALfloat gain = parms->Hrtf.Target.Gain; + + /* Interpolate the target gain if the gain fading lasts + * longer than this mix. + */ + if(Counter > DstBufferSize) + gain = lerp(parms->Hrtf.Old.Gain, gain, + (ALfloat)todo/(Counter-fademix)); + + hrtfparams.Coeffs = parms->Hrtf.Target.Coeffs; + hrtfparams.Delay[0] = parms->Hrtf.Target.Delay[0]; + hrtfparams.Delay[1] = parms->Hrtf.Target.Delay[1]; + hrtfparams.Gain = parms->Hrtf.Old.Gain; + hrtfparams.GainStep = (gain - parms->Hrtf.Old.Gain) / (ALfloat)todo; + MixHrtfSamples( + voice->Direct.Buffer[lidx], voice->Direct.Buffer[ridx], + samples+fademix, voice->Offset+fademix, OutPos+fademix, IrSize, + &hrtfparams, &parms->Hrtf.State, todo + ); + /* Store the interpolated gain or the final target gain + * depending if the fade is done. + */ + if(DstBufferSize < Counter) + parms->Hrtf.Old.Gain = gain; + else + parms->Hrtf.Old.Gain = parms->Hrtf.Target.Gain; + } + } + } + + for(send = 0;send < Device->NumAuxSends;send++) + { + SendParams *parms = &voice->Send[send].Params[chan]; + const ALfloat *samples; + + if(!voice->Send[send].Buffer) + continue; + + samples = DoFilters( + &parms->LowPass, &parms->HighPass, Device->TempBuffer[FILTERED_BUF], + ResampledData, DstBufferSize, voice->Send[send].FilterType + ); + + if(!Counter) + memcpy(parms->Gains.Current, parms->Gains.Target, + sizeof(parms->Gains.Current)); + MixSamples(samples, voice->Send[send].Channels, voice->Send[send].Buffer, + parms->Gains.Current, parms->Gains.Target, Counter, OutPos, DstBufferSize + ); + } + } + /* Update positions */ + DataPosFrac += increment*DstBufferSize; + DataPosInt += DataPosFrac>>FRACTIONBITS; + DataPosFrac &= FRACTIONMASK; + + OutPos += DstBufferSize; + voice->Offset += DstBufferSize; + Counter = maxi(DstBufferSize, Counter) - DstBufferSize; + firstpass = false; + + if(isstatic) + { + if(BufferLoopItem) + { + /* Handle looping static source */ + const ALbuffer *Buffer = BufferListItem->buffers[0]; + ALsizei LoopStart = Buffer->LoopStart; + ALsizei LoopEnd = Buffer->LoopEnd; + if(DataPosInt >= LoopEnd) + { + assert(LoopEnd > LoopStart); + DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart; + } + } + else + { + /* Handle non-looping static source */ + if(DataPosInt >= BufferListItem->max_samples) + { + isplaying = false; + BufferListItem = NULL; + DataPosInt = 0; + DataPosFrac = 0; + break; + } + } + } + else while(1) + { + /* Handle streaming source */ + if(BufferListItem->max_samples > DataPosInt) + break; + + buffers_done += BufferListItem->num_buffers; + BufferListItem = ATOMIC_LOAD(&BufferListItem->next, almemory_order_acquire); + if(!BufferListItem && !(BufferListItem=BufferLoopItem)) + { + isplaying = false; + DataPosInt = 0; + DataPosFrac = 0; + break; + } + + DataPosInt -= BufferListItem->max_samples; + } + } while(isplaying && OutPos < SamplesToDo); + + voice->Flags |= VOICE_IS_FADING; + + /* Update source info */ + ATOMIC_STORE(&voice->position, DataPosInt, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, DataPosFrac, almemory_order_relaxed); + ATOMIC_STORE(&voice->current_buffer, BufferListItem, almemory_order_release); + + /* Send any events now, after the position/buffer info was updated. */ + enabledevt = ATOMIC_LOAD(&Context->EnabledEvts, almemory_order_acquire); + if(buffers_done > 0 && (enabledevt&EventType_BufferCompleted)) + SendAsyncEvent(Context, EventType_BufferCompleted, + AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, SourceID, buffers_done, "Buffer completed" + ); + + return isplaying; +} diff --git a/Engine/lib/openal-soft/Alc/panning.c b/Engine/lib/openal-soft/Alc/panning.c index 1162bbbcf..7f9e74e25 100644 --- a/Engine/lib/openal-soft/Alc/panning.c +++ b/Engine/lib/openal-soft/Alc/panning.c @@ -29,23 +29,21 @@ #include "alMain.h" #include "alAuxEffectSlot.h" #include "alu.h" +#include "alconfig.h" #include "bool.h" #include "ambdec.h" #include "bformatdec.h" +#include "filters/splitter.h" #include "uhjfilter.h" #include "bs2b.h" -extern inline void CalcXYZCoeffs(ALfloat x, ALfloat y, ALfloat z, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +extern inline void ComputeDryPanGains(const DryMixParams *dry, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +extern inline void ComputeFirstOrderGains(const BFMixParams *foa, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -#define ZERO_ORDER_SCALE 0.0f -#define FIRST_ORDER_SCALE 1.0f -#define SECOND_ORDER_SCALE (1.0f / 1.22474f) -#define THIRD_ORDER_SCALE (1.0f / 1.30657f) - - -static const ALuint FuMa2ACN[MAX_AMBI_COEFFS] = { +static const ALsizei FuMa2ACN[MAX_AMBI_COEFFS] = { 0, /* W */ 3, /* X */ 1, /* Y */ @@ -63,55 +61,11 @@ static const ALuint FuMa2ACN[MAX_AMBI_COEFFS] = { 15, /* P */ 9, /* Q */ }; -static const ALuint ACN2ACN[MAX_AMBI_COEFFS] = { +static const ALsizei ACN2ACN[MAX_AMBI_COEFFS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -/* NOTE: These are scale factors as applied to Ambisonics content. Decoder - * coefficients should be divided by these values to get proper N3D scalings. - */ -static const ALfloat UnitScale[MAX_AMBI_COEFFS] = { - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f -}; -static const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { - 1.000000000f, /* ACN 0 (W), sqrt(1) */ - 1.732050808f, /* ACN 1 (Y), sqrt(3) */ - 1.732050808f, /* ACN 2 (Z), sqrt(3) */ - 1.732050808f, /* ACN 3 (X), sqrt(3) */ - 2.236067978f, /* ACN 4 (V), sqrt(5) */ - 2.236067978f, /* ACN 5 (T), sqrt(5) */ - 2.236067978f, /* ACN 6 (R), sqrt(5) */ - 2.236067978f, /* ACN 7 (S), sqrt(5) */ - 2.236067978f, /* ACN 8 (U), sqrt(5) */ - 2.645751311f, /* ACN 9 (Q), sqrt(7) */ - 2.645751311f, /* ACN 10 (O), sqrt(7) */ - 2.645751311f, /* ACN 11 (M), sqrt(7) */ - 2.645751311f, /* ACN 12 (K), sqrt(7) */ - 2.645751311f, /* ACN 13 (L), sqrt(7) */ - 2.645751311f, /* ACN 14 (N), sqrt(7) */ - 2.645751311f, /* ACN 15 (P), sqrt(7) */ -}; -static const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { - 1.414213562f, /* ACN 0 (W), sqrt(2) */ - 1.732050808f, /* ACN 1 (Y), sqrt(3) */ - 1.732050808f, /* ACN 2 (Z), sqrt(3) */ - 1.732050808f, /* ACN 3 (X), sqrt(3) */ - 1.936491673f, /* ACN 4 (V), sqrt(15)/2 */ - 1.936491673f, /* ACN 5 (T), sqrt(15)/2 */ - 2.236067978f, /* ACN 6 (R), sqrt(5) */ - 1.936491673f, /* ACN 7 (S), sqrt(15)/2 */ - 1.936491673f, /* ACN 8 (U), sqrt(15)/2 */ - 2.091650066f, /* ACN 9 (Q), sqrt(35/8) */ - 1.972026594f, /* ACN 10 (O), sqrt(35)/3 */ - 2.231093404f, /* ACN 11 (M), sqrt(224/45) */ - 2.645751311f, /* ACN 12 (K), sqrt(7) */ - 2.231093404f, /* ACN 13 (L), sqrt(224/45) */ - 1.972026594f, /* ACN 14 (N), sqrt(35)/3 */ - 2.091650066f, /* ACN 15 (P), sqrt(35/8) */ -}; - void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) { @@ -158,8 +112,7 @@ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MA * ZH5 = -0.0625*sqrt(pi) * (-1+ca)*(ca+1)*(21*ca*ca*ca*ca - 14*ca*ca + 1); * * The gain of the source is compensated for size, so that the - * loundness doesn't depend on the spread. That is, the factors are - * scaled so that ZH0 remains 1 regardless of the spread. Thus: + * loundness doesn't depend on the spread. Thus: * * ZH0 = 1.0f; * ZH1 = 0.5f * (ca+1.0f); @@ -169,11 +122,13 @@ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MA * ZH5 = 0.0625f * (ca+1.0f)*(21.0f*ca*ca*ca*ca - 14.0f*ca*ca + 1.0f); */ ALfloat ca = cosf(spread * 0.5f); + /* Increase the source volume by up to +3dB for a full spread. */ + ALfloat scale = sqrtf(1.0f + spread/F_TAU); - ALfloat ZH0_norm = 1.0f; - ALfloat ZH1_norm = 0.5f * (ca+1.f); - ALfloat ZH2_norm = 0.5f * (ca+1.f)*ca; - ALfloat ZH3_norm = 0.125f * (ca+1.f)*(5.f*ca*ca-1.f); + ALfloat ZH0_norm = scale; + ALfloat ZH1_norm = 0.5f * (ca+1.f) * scale; + ALfloat ZH2_norm = 0.5f * (ca+1.f)*ca * scale; + ALfloat ZH3_norm = 0.125f * (ca+1.f)*(5.f*ca*ca-1.f) * scale; /* Zeroth-order */ coeffs[0] *= ZH0_norm; @@ -198,65 +153,33 @@ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MA } } -void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) +void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) { - ALfloat dir[3] = { - sinf(azimuth) * cosf(elevation), - sinf(elevation), - -cosf(azimuth) * cosf(elevation) - }; - CalcDirectionCoeffs(dir, spread, coeffs); + ALfloat sign = (azimuth < 0.0f) ? -1.0f : 1.0f; + if(!(fabsf(azimuth) > F_PI_2)) + azimuth = minf(fabsf(azimuth) * F_PI_2 / (F_PI/6.0f), F_PI_2) * sign; + CalcAngleCoeffs(azimuth, elevation, spread, coeffs); } -void ComputeAmbientGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i; - - for(i = 0;i < numchans;i++) - { - // The W coefficients are based on a mathematical average of the - // output. The square root of the base average provides for a more - // perceptual average volume, better suited to non-directional gains. - gains[i] = sqrtf(chancoeffs[i][0]) * ingain; - } - for(;i < MAX_OUTPUT_CHANNELS;i++) - gains[i] = 0.0f; -} - -void ComputeAmbientGainsBF(const BFChannelConfig *chanmap, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) -{ - ALfloat gain = 0.0f; - ALuint i; - - for(i = 0;i < numchans;i++) - { - if(chanmap[i].Index == 0) - gain += chanmap[i].Scale; - } - gains[0] = gain * 1.414213562f * ingain; - for(i = 1;i < MAX_OUTPUT_CHANNELS;i++) - gains[i] = 0.0f; -} - -void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALuint numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) -{ - ALuint i, j; + ALsizei i, j; for(i = 0;i < numchans;i++) { float gain = 0.0f; for(j = 0;j < numcoeffs;j++) gain += chancoeffs[i][j]*coeffs[j]; - gains[i] = gain * ingain; + gains[i] = clampf(gain, 0.0f, 1.0f) * ingain; } for(;i < MAX_OUTPUT_CHANNELS;i++) gains[i] = 0.0f; } -void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i; + ALsizei i; for(i = 0;i < numchans;i++) gains[i] = chanmap[i].Scale * coeffs[chanmap[i].Index] * ingain; @@ -264,24 +187,24 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, cons gains[i] = 0.0f; } -void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i, j; + ALsizei i, j; for(i = 0;i < numchans;i++) { float gain = 0.0f; for(j = 0;j < 4;j++) gain += chancoeffs[i][j] * mtx[j]; - gains[i] = gain * ingain; + gains[i] = clampf(gain, 0.0f, 1.0f) * ingain; } for(;i < MAX_OUTPUT_CHANNELS;i++) gains[i] = 0.0f; } -void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i; + ALsizei i; for(i = 0;i < numchans;i++) gains[i] = chanmap[i].Scale * mtx[chanmap[i].Index] * ingain; @@ -341,49 +264,38 @@ typedef struct ChannelMap { ChannelConfig Config; } ChannelMap; -static void SetChannelMap(const enum Channel *devchans, ChannelConfig *ambicoeffs, - const ChannelMap *chanmap, size_t count, ALuint *outcount, - ALboolean isfuma) +static void SetChannelMap(const enum Channel devchans[MAX_OUTPUT_CHANNELS], + ChannelConfig *ambicoeffs, const ChannelMap *chanmap, + ALsizei count, ALsizei *outcount) { - const ALuint *acnmap = isfuma ? FuMa2ACN : ACN2ACN; - const ALfloat *n3dscale = isfuma ? FuMa2N3DScale : UnitScale; - size_t j, k; - ALuint i; + ALsizei maxchans = 0; + ALsizei i, j; - for(i = 0;i < MAX_OUTPUT_CHANNELS && devchans[i] != InvalidChannel;i++) + for(i = 0;i < count;i++) { - if(devchans[i] == LFE) + ALint idx = GetChannelIndex(devchans, chanmap[i].ChanName); + if(idx < 0) { - for(j = 0;j < MAX_AMBI_COEFFS;j++) - ambicoeffs[i][j] = 0.0f; + ERR("Failed to find %s channel in device\n", + GetLabelFromChannel(chanmap[i].ChanName)); continue; } - for(j = 0;j < count;j++) - { - if(devchans[i] != chanmap[j].ChanName) - continue; - - for(k = 0;k < MAX_AMBI_COEFFS;++k) - { - ALuint acn = acnmap[k]; - ambicoeffs[i][acn] = chanmap[j].Config[k] / n3dscale[acn]; - } - break; - } - if(j == count) - ERR("Failed to match %s channel (%u) in channel map\n", GetLabelFromChannel(devchans[i]), i); + maxchans = maxi(maxchans, idx+1); + for(j = 0;j < MAX_AMBI_COEFFS;j++) + ambicoeffs[idx][j] = chanmap[i].Config[j]; } - *outcount = i; + *outcount = mini(maxchans, MAX_OUTPUT_CHANNELS); } -static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALuint speakermap[MAX_OUTPUT_CHANNELS]) +static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei speakermap[MAX_OUTPUT_CHANNELS]) { - ALuint i; + ALsizei i; for(i = 0;i < conf->NumSpeakers;i++) { - int c = -1; + enum Channel ch; + int chidx = -1; /* NOTE: AmbDec does not define any standard speaker names, however * for this to work we have to by able to find the output channel @@ -405,204 +317,268 @@ static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALuint spe * use the side channels when the device is configured for back, * and vice-versa. */ - if(al_string_cmp_cstr(conf->Speakers[i].Name, "LF") == 0) - c = GetChannelIdxByName(device->RealOut, FrontLeft); - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RF") == 0) - c = GetChannelIdxByName(device->RealOut, FrontRight); - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "CE") == 0) - c = GetChannelIdxByName(device->RealOut, FrontCenter); - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "LS") == 0) + if(alstr_cmp_cstr(conf->Speakers[i].Name, "LF") == 0) + ch = FrontLeft; + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RF") == 0) + ch = FrontRight; + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CE") == 0) + ch = FrontCenter; + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LS") == 0) { if(device->FmtChans == DevFmtX51Rear) - c = GetChannelIdxByName(device->RealOut, BackLeft); + ch = BackLeft; else - c = GetChannelIdxByName(device->RealOut, SideLeft); + ch = SideLeft; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RS") == 0) + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RS") == 0) { if(device->FmtChans == DevFmtX51Rear) - c = GetChannelIdxByName(device->RealOut, BackRight); + ch = BackRight; else - c = GetChannelIdxByName(device->RealOut, SideRight); + ch = SideRight; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "LB") == 0) + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LB") == 0) { if(device->FmtChans == DevFmtX51) - c = GetChannelIdxByName(device->RealOut, SideLeft); + ch = SideLeft; else - c = GetChannelIdxByName(device->RealOut, BackLeft); + ch = BackLeft; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RB") == 0) + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RB") == 0) { if(device->FmtChans == DevFmtX51) - c = GetChannelIdxByName(device->RealOut, SideRight); + ch = SideRight; else - c = GetChannelIdxByName(device->RealOut, BackRight); + ch = BackRight; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "CB") == 0) - c = GetChannelIdxByName(device->RealOut, BackCenter); + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CB") == 0) + ch = BackCenter; else { - const char *name = al_string_get_cstr(conf->Speakers[i].Name); + const char *name = alstr_get_cstr(conf->Speakers[i].Name); unsigned int n; - char ch; + char c; - if(sscanf(name, "AUX%u%c", &n, &ch) == 1 && n < 16) - c = GetChannelIdxByName(device->RealOut, Aux0+n); + if(sscanf(name, "AUX%u%c", &n, &c) == 1 && n < 16) + ch = Aux0+n; else { ERR("AmbDec speaker label \"%s\" not recognized\n", name); return false; } } - if(c == -1) + chidx = GetChannelIdxByName(&device->RealOut, ch); + if(chidx == -1) { ERR("Failed to lookup AmbDec speaker label %s\n", - al_string_get_cstr(conf->Speakers[i].Name)); + alstr_get_cstr(conf->Speakers[i].Name)); return false; } - speakermap[i] = c; + speakermap[i] = chidx; } return true; } -/* NOTE: These decoder coefficients are using FuMa channel ordering and - * normalization, since that's what was produced by the Ambisonic Decoder - * Toolbox. SetChannelMap will convert them to N3D. - */ static const ChannelMap MonoCfg[1] = { - { FrontCenter, { 1.414213562f } }, + { FrontCenter, { 1.0f } }, }, StereoCfg[2] = { - { FrontLeft, { 0.707106781f, 0.0f, 0.5f, 0.0f } }, - { FrontRight, { 0.707106781f, 0.0f, -0.5f, 0.0f } }, + { FrontLeft, { 5.00000000e-1f, 2.88675135e-1f, 0.0f, 5.52305643e-2f } }, + { FrontRight, { 5.00000000e-1f, -2.88675135e-1f, 0.0f, 5.52305643e-2f } }, }, QuadCfg[4] = { - { FrontLeft, { 0.353553f, 0.306186f, 0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.125000f } }, - { FrontRight, { 0.353553f, 0.306186f, -0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.125000f } }, - { BackLeft, { 0.353553f, -0.306186f, 0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.125000f } }, - { BackRight, { 0.353553f, -0.306186f, -0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.125000f } }, -}, X51SideCfg[5] = { - { FrontLeft, { 0.208954f, 0.199518f, 0.223424f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012543f, 0.144260f } }, - { FrontRight, { 0.208950f, 0.199514f, -0.223425f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012544f, -0.144258f } }, - { FrontCenter, { 0.109403f, 0.168250f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.100431f, -0.000001f } }, - { SideLeft, { 0.470934f, -0.346484f, 0.327504f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022188f, -0.041113f } }, - { SideRight, { 0.470936f, -0.346480f, -0.327507f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022186f, 0.041114f } }, -}, X51RearCfg[5] = { - { FrontLeft, { 0.208954f, 0.199518f, 0.223424f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012543f, 0.144260f } }, - { FrontRight, { 0.208950f, 0.199514f, -0.223425f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012544f, -0.144258f } }, - { FrontCenter, { 0.109403f, 0.168250f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.100431f, -0.000001f } }, - { BackLeft, { 0.470934f, -0.346484f, 0.327504f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022188f, -0.041113f } }, - { BackRight, { 0.470936f, -0.346480f, -0.327507f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022186f, 0.041114f } }, + { BackLeft, { 3.53553391e-1f, 2.04124145e-1f, 0.0f, -2.04124145e-1f } }, + { FrontLeft, { 3.53553391e-1f, 2.04124145e-1f, 0.0f, 2.04124145e-1f } }, + { FrontRight, { 3.53553391e-1f, -2.04124145e-1f, 0.0f, 2.04124145e-1f } }, + { BackRight, { 3.53553391e-1f, -2.04124145e-1f, 0.0f, -2.04124145e-1f } }, +}, X51SideCfg[4] = { + { SideLeft, { 3.33000782e-1f, 1.89084803e-1f, 0.0f, -2.00042375e-1f, -2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, + { FrontLeft, { 1.88542860e-1f, 1.27709292e-1f, 0.0f, 1.66295695e-1f, 7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { FrontRight, { 1.88542860e-1f, -1.27709292e-1f, 0.0f, 1.66295695e-1f, -7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { SideRight, { 3.33000782e-1f, -1.89084803e-1f, 0.0f, -2.00042375e-1f, 2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, +}, X51RearCfg[4] = { + { BackLeft, { 3.33000782e-1f, 1.89084803e-1f, 0.0f, -2.00042375e-1f, -2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, + { FrontLeft, { 1.88542860e-1f, 1.27709292e-1f, 0.0f, 1.66295695e-1f, 7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { FrontRight, { 1.88542860e-1f, -1.27709292e-1f, 0.0f, 1.66295695e-1f, -7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { BackRight, { 3.33000782e-1f, -1.89084803e-1f, 0.0f, -2.00042375e-1f, 2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, }, X61Cfg[6] = { - { FrontLeft, { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } }, - { FrontRight, { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f } }, - { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } }, - { BackCenter, { 0.353556f, -0.461940f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000000f } }, - { SideLeft, { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f } }, - { SideRight, { 0.289151f, -0.081301f, -0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f } }, -}, X71Cfg[7] = { - { FrontLeft, { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } }, - { FrontRight, { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f } }, - { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } }, - { BackLeft, { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065799f } }, - { BackRight, { 0.224752f, -0.295009f, -0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, 0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065799f } }, - { SideLeft, { 0.224739f, 0.000000f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065795f } }, - { SideRight, { 0.224739f, 0.000000f, -0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065795f } }, + { SideLeft, { 2.04460341e-1f, 2.17177926e-1f, 0.0f, -4.39996780e-2f, -2.60790269e-2f, 0.0f, 0.0f, 0.0f, -6.87239792e-2f } }, + { FrontLeft, { 1.58923161e-1f, 9.21772680e-2f, 0.0f, 1.59658796e-1f, 6.66278083e-2f, 0.0f, 0.0f, 0.0f, 3.84686854e-2f } }, + { FrontRight, { 1.58923161e-1f, -9.21772680e-2f, 0.0f, 1.59658796e-1f, -6.66278083e-2f, 0.0f, 0.0f, 0.0f, 3.84686854e-2f } }, + { SideRight, { 2.04460341e-1f, -2.17177926e-1f, 0.0f, -4.39996780e-2f, 2.60790269e-2f, 0.0f, 0.0f, 0.0f, -6.87239792e-2f } }, + { BackCenter, { 2.50001688e-1f, 0.00000000e+0f, 0.0f, -2.50000094e-1f, 0.00000000e+0f, 0.0f, 0.0f, 0.0f, 6.05133395e-2f } }, +}, X71Cfg[6] = { + { BackLeft, { 2.04124145e-1f, 1.08880247e-1f, 0.0f, -1.88586120e-1f, -1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, 3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { SideLeft, { 2.04124145e-1f, 2.17760495e-1f, 0.0f, 0.00000000e+0f, 0.00000000e+0f, 0.0f, 0.0f, 0.0f, -1.49071198e-1f, -3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { FrontLeft, { 2.04124145e-1f, 1.08880247e-1f, 0.0f, 1.88586120e-1f, 1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, 3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { FrontRight, { 2.04124145e-1f, -1.08880247e-1f, 0.0f, 1.88586120e-1f, -1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, -3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { SideRight, { 2.04124145e-1f, -2.17760495e-1f, 0.0f, 0.00000000e+0f, 0.00000000e+0f, 0.0f, 0.0f, 0.0f, -1.49071198e-1f, 3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { BackRight, { 2.04124145e-1f, -1.08880247e-1f, 0.0f, -1.88586120e-1f, 1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, -3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, }; +static void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALsizei order, + const ALsizei *restrict chans_per_order) +{ + const char *devname = alstr_get_cstr(device->DeviceName); + ALsizei i; + + if(GetConfigValueBool(devname, "decoder", "nfc", 1) && ctrl_dist > 0.0f) + { + /* NFC is only used when AvgSpeakerDist is greater than 0, and can only + * be used when rendering to an ambisonic buffer. + */ + device->AvgSpeakerDist = minf(ctrl_dist, 10.0f); + + for(i = 0;i < order+1;i++) + device->Dry.NumChannelsPerOrder[i] = chans_per_order[i]; + for(;i < MAX_AMBI_ORDER+1;i++) + device->Dry.NumChannelsPerOrder[i] = 0; + } +} + +static void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS]) +{ + const char *devname = alstr_get_cstr(device->DeviceName); + ALfloat maxdist = 0.0f; + size_t total = 0; + ALsizei i; + + for(i = 0;i < conf->NumSpeakers;i++) + maxdist = maxf(maxdist, conf->Speakers[i].Distance); + + if(GetConfigValueBool(devname, "decoder", "distance-comp", 1) && maxdist > 0.0f) + { + ALfloat srate = (ALfloat)device->Frequency; + for(i = 0;i < conf->NumSpeakers;i++) + { + ALsizei chan = speakermap[i]; + ALfloat delay; + + /* Distance compensation only delays in steps of the sample rate. + * This is a bit less accurate since the delay time falls to the + * nearest sample time, but it's far simpler as it doesn't have to + * deal with phase offsets. This means at 48khz, for instance, the + * distance delay will be in steps of about 7 millimeters. + */ + delay = floorf((maxdist-conf->Speakers[i].Distance) / SPEEDOFSOUNDMETRESPERSEC * + srate + 0.5f); + if(delay >= (ALfloat)MAX_DELAY_LENGTH) + ERR("Delay for speaker \"%s\" exceeds buffer length (%f >= %u)\n", + alstr_get_cstr(conf->Speakers[i].Name), delay, MAX_DELAY_LENGTH); + + device->ChannelDelay[chan].Length = (ALsizei)clampf( + delay, 0.0f, (ALfloat)(MAX_DELAY_LENGTH-1) + ); + device->ChannelDelay[chan].Gain = conf->Speakers[i].Distance / maxdist; + TRACE("Channel %u \"%s\" distance compensation: %d samples, %f gain\n", chan, + alstr_get_cstr(conf->Speakers[i].Name), device->ChannelDelay[chan].Length, + device->ChannelDelay[chan].Gain + ); + + /* Round up to the next 4th sample, so each channel buffer starts + * 16-byte aligned. + */ + total += RoundUp(device->ChannelDelay[chan].Length, 4); + } + } + + if(total > 0) + { + device->ChannelDelay[0].Buffer = al_calloc(16, total * sizeof(ALfloat)); + for(i = 1;i < MAX_OUTPUT_CHANNELS;i++) + { + size_t len = RoundUp(device->ChannelDelay[i-1].Length, 4); + device->ChannelDelay[i].Buffer = device->ChannelDelay[i-1].Buffer + len; + } + } +} + static void InitPanning(ALCdevice *device) { const ChannelMap *chanmap = NULL; - ALuint coeffcount = 0; - ALfloat ambiscale; - size_t count = 0; - ALuint i, j; + ALsizei coeffcount = 0; + ALsizei count = 0; + ALsizei i, j; - ambiscale = 1.0f; switch(device->FmtChans) { case DevFmtMono: count = COUNTOF(MonoCfg); chanmap = MonoCfg; - ambiscale = ZERO_ORDER_SCALE; coeffcount = 1; break; case DevFmtStereo: count = COUNTOF(StereoCfg); chanmap = StereoCfg; - ambiscale = FIRST_ORDER_SCALE; coeffcount = 4; break; case DevFmtQuad: count = COUNTOF(QuadCfg); chanmap = QuadCfg; - ambiscale = SECOND_ORDER_SCALE; - coeffcount = 9; + coeffcount = 4; break; case DevFmtX51: count = COUNTOF(X51SideCfg); chanmap = X51SideCfg; - ambiscale = SECOND_ORDER_SCALE; coeffcount = 9; break; case DevFmtX51Rear: count = COUNTOF(X51RearCfg); chanmap = X51RearCfg; - ambiscale = SECOND_ORDER_SCALE; coeffcount = 9; break; case DevFmtX61: count = COUNTOF(X61Cfg); chanmap = X61Cfg; - ambiscale = THIRD_ORDER_SCALE; - coeffcount = 16; + coeffcount = 9; break; case DevFmtX71: count = COUNTOF(X71Cfg); chanmap = X71Cfg; - ambiscale = THIRD_ORDER_SCALE; coeffcount = 16; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: break; } - if(device->FmtChans >= DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3) + if(device->FmtChans == DevFmtAmbi3D) { - const ALuint *acnmap = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2ACN : ACN2ACN; - const ALfloat *n3dscale = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2N3DScale : - (device->AmbiFmt == AmbiFormat_ACN_SN3D) ? SN3D2N3DScale : - /*(device->AmbiFmt == AmbiFormat_ACN_N3D) ?*/ UnitScale; + const char *devname = alstr_get_cstr(device->DeviceName); + const ALsizei *acnmap = (device->AmbiLayout == AmbiLayout_FuMa) ? FuMa2ACN : ACN2ACN; + const ALfloat *n3dscale = (device->AmbiScale == AmbiNorm_FuMa) ? FuMa2N3DScale : + (device->AmbiScale == AmbiNorm_SN3D) ? SN3D2N3DScale : + /*(device->AmbiScale == AmbiNorm_N3D) ?*/ N3D2N3DScale; + ALfloat nfc_delay = 0.0f; - count = (device->FmtChans == DevFmtAmbi3) ? 16 : - (device->FmtChans == DevFmtAmbi2) ? 9 : - (device->FmtChans == DevFmtAmbi1) ? 4 : 1; + count = (device->AmbiOrder == 3) ? 16 : + (device->AmbiOrder == 2) ? 9 : + (device->AmbiOrder == 1) ? 4 : 1; for(i = 0;i < count;i++) { - ALuint acn = acnmap[i]; + ALsizei acn = acnmap[i]; device->Dry.Ambi.Map[i].Scale = 1.0f/n3dscale[acn]; device->Dry.Ambi.Map[i].Index = acn; } device->Dry.CoeffCount = 0; device->Dry.NumChannels = count; - if(device->FmtChans == DevFmtAmbi1) + if(device->AmbiOrder < 2) { device->FOAOut.Ambi = device->Dry.Ambi; device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; } else { + ALfloat w_scale=1.0f, xyz_scale=1.0f; + /* FOA output is always ACN+N3D for higher-order ambisonic output. * The upsampler expects this and will convert it for output. */ @@ -613,46 +589,95 @@ static void InitPanning(ALCdevice *device) device->FOAOut.Ambi.Map[i].Index = i; } device->FOAOut.CoeffCount = 0; + device->FOAOut.NumChannels = 4; - ambiup_reset(device->AmbiUp, device); + if(device->AmbiOrder >= 3) + { + w_scale = W_SCALE_3H3P; + xyz_scale = XYZ_SCALE_3H3P; + } + else + { + w_scale = W_SCALE_2H2P; + xyz_scale = XYZ_SCALE_2H2P; + } + ambiup_reset(device->AmbiUp, device, w_scale, xyz_scale); + } + + if(ConfigValueFloat(devname, "decoder", "nfc-ref-delay", &nfc_delay) && nfc_delay > 0.0f) + { + static const ALsizei chans_per_order[MAX_AMBI_ORDER+1] = { + 1, 3, 5, 7 + }; + nfc_delay = clampf(nfc_delay, 0.001f, 1000.0f); + InitNearFieldCtrl(device, nfc_delay * SPEEDOFSOUNDMETRESPERSEC, + device->AmbiOrder, chans_per_order); } } else { + ALfloat w_scale, xyz_scale; + SetChannelMap(device->RealOut.ChannelName, device->Dry.Ambi.Coeffs, - chanmap, count, &device->Dry.NumChannels, AL_TRUE); + chanmap, count, &device->Dry.NumChannels); device->Dry.CoeffCount = coeffcount; + w_scale = (device->Dry.CoeffCount > 9) ? W_SCALE_3H0P : + (device->Dry.CoeffCount > 4) ? W_SCALE_2H0P : 1.0f; + xyz_scale = (device->Dry.CoeffCount > 9) ? XYZ_SCALE_3H0P : + (device->Dry.CoeffCount > 4) ? XYZ_SCALE_2H0P : 1.0f; + memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); for(i = 0;i < device->Dry.NumChannels;i++) { - device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0]; + device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0] * w_scale; for(j = 1;j < 4;j++) - device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * ambiscale; + device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * xyz_scale; } device->FOAOut.CoeffCount = 4; + device->FOAOut.NumChannels = 0; } + device->RealOut.NumChannels = 0; } -static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const ALuint speakermap[MAX_OUTPUT_CHANNELS]) +static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS]) { ChannelMap chanmap[MAX_OUTPUT_CHANNELS]; - const ALfloat *coeff_scale = UnitScale; - ALfloat ambiscale = 1.0f; - ALuint i, j; + const ALfloat *coeff_scale = N3D2N3DScale; + ALfloat w_scale = 1.0f; + ALfloat xyz_scale = 1.0f; + ALsizei i, j; if(conf->FreqBands != 1) ERR("Basic renderer uses the high-frequency matrix as single-band (xover_freq = %.0fhz)\n", conf->XOverFreq); - if(conf->ChanMask > 0x1ff) - ambiscale = THIRD_ORDER_SCALE; - else if(conf->ChanMask > 0xf) - ambiscale = SECOND_ORDER_SCALE; - else if(conf->ChanMask > 0x1) - ambiscale = FIRST_ORDER_SCALE; + if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) + { + if(conf->ChanMask > 0x1ff) + { + w_scale = W_SCALE_3H3P; + xyz_scale = XYZ_SCALE_3H3P; + } + else if(conf->ChanMask > 0xf) + { + w_scale = W_SCALE_2H2P; + xyz_scale = XYZ_SCALE_2H2P; + } + } else - ambiscale = 0.0f; + { + if(conf->ChanMask > 0x1ff) + { + w_scale = W_SCALE_3H0P; + xyz_scale = XYZ_SCALE_3H0P; + } + else if(conf->ChanMask > 0xf) + { + w_scale = W_SCALE_2H0P; + xyz_scale = XYZ_SCALE_2H0P; + } + } if(conf->CoeffScale == ADS_SN3D) coeff_scale = SN3D2N3DScale; @@ -661,9 +686,9 @@ static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const A for(i = 0;i < conf->NumSpeakers;i++) { - ALuint chan = speakermap[i]; + ALsizei chan = speakermap[i]; ALfloat gain; - ALuint k = 0; + ALsizei k = 0; for(j = 0;j < MAX_AMBI_COEFFS;j++) chanmap[i].Config[j] = 0.0f; @@ -681,30 +706,32 @@ static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const A } SetChannelMap(device->RealOut.ChannelName, device->Dry.Ambi.Coeffs, chanmap, - conf->NumSpeakers, &device->Dry.NumChannels, AL_FALSE); + conf->NumSpeakers, &device->Dry.NumChannels); device->Dry.CoeffCount = (conf->ChanMask > 0x1ff) ? 16 : (conf->ChanMask > 0xf) ? 9 : 4; memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); for(i = 0;i < device->Dry.NumChannels;i++) { - device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0]; + device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0] * w_scale; for(j = 1;j < 4;j++) - device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * ambiscale; + device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * xyz_scale; } device->FOAOut.CoeffCount = 4; + device->FOAOut.NumChannels = 0; + + device->RealOut.NumChannels = 0; + + InitDistanceComp(device, conf, speakermap); } -static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuint speakermap[MAX_OUTPUT_CHANNELS]) +static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS]) { - const char *devname; - int decflags = 0; - size_t count; - ALuint i; - - devname = al_string_get_cstr(device->DeviceName); - if(GetConfigValueBool(devname, "decoder", "distance-comp", 1)) - decflags |= BFDF_DistanceComp; + static const ALsizei chans_per_order2d[MAX_AMBI_ORDER+1] = { 1, 2, 2, 2 }; + static const ALsizei chans_per_order3d[MAX_AMBI_ORDER+1] = { 1, 3, 5, 7 }; + ALfloat avg_dist; + ALsizei count; + ALsizei i; if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) { @@ -736,15 +763,150 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuin (conf->ChanMask > 0xf) ? (conf->ChanMask > 0x1ff) ? "third" : "second" : "first", (conf->ChanMask&AMBI_PERIPHONIC_MASK) ? " periphonic" : "" ); - bformatdec_reset(device->AmbiDecoder, conf, count, device->Frequency, - speakermap, decflags); + bformatdec_reset(device->AmbiDecoder, conf, count, device->Frequency, speakermap); - if(bformatdec_getOrder(device->AmbiDecoder) < 2) + if(!(conf->ChanMask > 0xf)) { device->FOAOut.Ambi = device->Dry.Ambi; device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; } else + { + memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); + if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) + { + count = 4; + for(i = 0;i < count;i++) + { + device->FOAOut.Ambi.Map[i].Scale = 1.0f; + device->FOAOut.Ambi.Map[i].Index = i; + } + } + else + { + static const int map[3] = { 0, 1, 3 }; + count = 3; + for(i = 0;i < count;i++) + { + device->FOAOut.Ambi.Map[i].Scale = 1.0f; + device->FOAOut.Ambi.Map[i].Index = map[i]; + } + } + device->FOAOut.CoeffCount = 0; + device->FOAOut.NumChannels = count; + } + + device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + + avg_dist = 0.0f; + for(i = 0;i < conf->NumSpeakers;i++) + avg_dist += conf->Speakers[i].Distance; + avg_dist /= (ALfloat)conf->NumSpeakers; + InitNearFieldCtrl(device, avg_dist, + (conf->ChanMask > 0x1ff) ? 3 : (conf->ChanMask > 0xf) ? 2 : 1, + (conf->ChanMask&AMBI_PERIPHONIC_MASK) ? chans_per_order3d : chans_per_order2d + ); + + InitDistanceComp(device, conf, speakermap); +} + +static void InitHrtfPanning(ALCdevice *device) +{ + /* NOTE: azimuth goes clockwise. */ + static const struct AngularPoint AmbiPoints[] = { + { DEG2RAD( 90.0f), DEG2RAD( 0.0f) }, + { DEG2RAD( 35.0f), DEG2RAD( 45.0f) }, + { DEG2RAD( 35.0f), DEG2RAD( 135.0f) }, + { DEG2RAD( 35.0f), DEG2RAD(-135.0f) }, + { DEG2RAD( 35.0f), DEG2RAD( -45.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 0.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 45.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 90.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 135.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 180.0f) }, + { DEG2RAD( 0.0f), DEG2RAD(-135.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( -90.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( -45.0f) }, + { DEG2RAD(-35.0f), DEG2RAD( 45.0f) }, + { DEG2RAD(-35.0f), DEG2RAD( 135.0f) }, + { DEG2RAD(-35.0f), DEG2RAD(-135.0f) }, + { DEG2RAD(-35.0f), DEG2RAD( -45.0f) }, + { DEG2RAD(-90.0f), DEG2RAD( 0.0f) }, + }; + static const ALfloat AmbiMatrixFOA[][MAX_AMBI_COEFFS] = { + { 5.55555556e-02f, 0.00000000e+00f, 1.23717915e-01f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.66025404e-02f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f }, + { 5.55555556e-02f, -8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.66025404e-02f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f }, + { 5.55555556e-02f, 8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, 0.00000000e+00f, -1.23717915e-01f, 0.00000000e+00f }, + }, AmbiMatrixHOA[][MAX_AMBI_COEFFS] = { + { 5.55555556e-02f, 0.00000000e+00f, 1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.66025404e-02f, 0.00000000e+00f, 1.29099445e-01f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.66025404e-02f, 0.00000000e+00f, 1.29099445e-01f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 0.00000000e+00f, -1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, + }; + static const ALfloat AmbiOrderHFGainFOA[MAX_AMBI_ORDER+1] = { + 3.00000000e+00f, 1.73205081e+00f + }, AmbiOrderHFGainHOA[MAX_AMBI_ORDER+1] = { + 2.40192231e+00f, 1.86052102e+00f, 9.60768923e-01f + }; + static const ALsizei IndexMap[6] = { 0, 1, 2, 3, 4, 8 }; + static const ALsizei ChansPerOrder[MAX_AMBI_ORDER+1] = { 1, 3, 2, 0 }; + const ALfloat (*restrict AmbiMatrix)[MAX_AMBI_COEFFS] = AmbiMatrixFOA; + const ALfloat *restrict AmbiOrderHFGain = AmbiOrderHFGainFOA; + ALsizei count = 4; + ALsizei i; + + static_assert(COUNTOF(AmbiPoints) == COUNTOF(AmbiMatrixFOA), "FOA Ambisonic HRTF mismatch"); + static_assert(COUNTOF(AmbiPoints) == COUNTOF(AmbiMatrixHOA), "HOA Ambisonic HRTF mismatch"); + static_assert(COUNTOF(AmbiPoints) <= HRTF_AMBI_MAX_CHANNELS, "HRTF_AMBI_MAX_CHANNELS is too small"); + + if(device->AmbiUp) + { + AmbiMatrix = AmbiMatrixHOA; + AmbiOrderHFGain = AmbiOrderHFGainHOA; + count = COUNTOF(IndexMap); + } + + device->Hrtf = al_calloc(16, FAM_SIZE(DirectHrtfState, Chan, count)); + + for(i = 0;i < count;i++) + { + device->Dry.Ambi.Map[i].Scale = 1.0f; + device->Dry.Ambi.Map[i].Index = IndexMap[i]; + } + device->Dry.CoeffCount = 0; + device->Dry.NumChannels = count; + + if(device->AmbiUp) { memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); for(i = 0;i < 4;i++) @@ -753,42 +915,37 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuin device->FOAOut.Ambi.Map[i].Index = i; } device->FOAOut.CoeffCount = 0; + device->FOAOut.NumChannels = 4; + + ambiup_reset(device->AmbiUp, device, AmbiOrderHFGainFOA[0] / AmbiOrderHFGain[0], + AmbiOrderHFGainFOA[1] / AmbiOrderHFGain[1]); } -} - -static void InitHrtfPanning(ALCdevice *device) -{ - size_t count = 4; - ALuint i; - - for(i = 0;i < count;i++) + else { - device->Dry.Ambi.Map[i].Scale = 1.0f; - device->Dry.Ambi.Map[i].Index = i; + device->FOAOut.Ambi = device->Dry.Ambi; + device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; } - device->Dry.CoeffCount = 0; - device->Dry.NumChannels = count; - device->FOAOut.Ambi = device->Dry.Ambi; - device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); - memset(device->Hrtf.Coeffs, 0, sizeof(device->Hrtf.Coeffs)); - device->Hrtf.IrSize = BuildBFormatHrtf(device->Hrtf.Handle, - device->Hrtf.Coeffs, device->Dry.NumChannels + BuildBFormatHrtf(device->HrtfHandle, + device->Hrtf, device->Dry.NumChannels, AmbiPoints, AmbiMatrix, COUNTOF(AmbiPoints), + AmbiOrderHFGain ); - /* Round up to the nearest multiple of 8 */ - device->Hrtf.IrSize = (device->Hrtf.IrSize+7)&~7; + InitNearFieldCtrl(device, device->HrtfHandle->distance, device->AmbiUp ? 2 : 1, + ChansPerOrder); } static void InitUhjPanning(ALCdevice *device) { - size_t count = 3; - ALuint i; + ALsizei count = 3; + ALsizei i; for(i = 0;i < count;i++) { - ALuint acn = FuMa2ACN[i]; + ALsizei acn = FuMa2ACN[i]; device->Dry.Ambi.Map[i].Scale = 1.0f/FuMa2N3DScale[acn]; device->Dry.Ambi.Map[i].Index = acn; } @@ -797,48 +954,69 @@ static void InitUhjPanning(ALCdevice *device) device->FOAOut.Ambi = device->Dry.Ambi; device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; + + device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); } void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf_appreq, enum HrtfRequestMode hrtf_userreq) { + /* Hold the HRTF the device last used, in case it's used again. */ + struct Hrtf *old_hrtf = device->HrtfHandle; const char *mode; bool headphones; int bs2blevel; size_t i; - device->Hrtf.Handle = NULL; - al_string_clear(&device->Hrtf.Name); + al_free(device->Hrtf); + device->Hrtf = NULL; + device->HrtfHandle = NULL; + alstr_clear(&device->HrtfName); device->Render_Mode = NormalRender; memset(&device->Dry.Ambi, 0, sizeof(device->Dry.Ambi)); device->Dry.CoeffCount = 0; device->Dry.NumChannels = 0; + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + device->Dry.NumChannelsPerOrder[i] = 0; + + device->AvgSpeakerDist = 0.0f; + memset(device->ChannelDelay, 0, sizeof(device->ChannelDelay)); + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Gain = 1.0f; + device->ChannelDelay[i].Length = 0; + } + + al_free(device->Stablizer); + device->Stablizer = NULL; if(device->FmtChans != DevFmtStereo) { - ALuint speakermap[MAX_OUTPUT_CHANNELS]; + ALsizei speakermap[MAX_OUTPUT_CHANNELS]; const char *devname, *layout = NULL; AmbDecConf conf, *pconf = NULL; + if(old_hrtf) + Hrtf_DecRef(old_hrtf); + old_hrtf = NULL; if(hrtf_appreq == Hrtf_Enable) - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; + device->HrtfStatus = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; ambdec_init(&conf); - devname = al_string_get_cstr(device->DeviceName); + devname = alstr_get_cstr(device->DeviceName); switch(device->FmtChans) { case DevFmtQuad: layout = "quad"; break; - case DevFmtX51: layout = "surround51"; break; - case DevFmtX51Rear: layout = "surround51rear"; break; + case DevFmtX51: /* fall-through */ + case DevFmtX51Rear: layout = "surround51"; break; case DevFmtX61: layout = "surround61"; break; case DevFmtX71: layout = "surround71"; break; /* Mono, Stereo, and Ambisonics output don't use custom decoders. */ case DevFmtMono: case DevFmtStereo: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: break; } if(layout) @@ -863,25 +1041,20 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf if(pconf && GetConfigValueBool(devname, "decoder", "hq-mode", 0)) { - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; + ambiup_free(&device->AmbiUp); if(!device->AmbiDecoder) device->AmbiDecoder = bformatdec_alloc(); } else { - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; - if(device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3) + bformatdec_free(&device->AmbiDecoder); + if(device->FmtChans != DevFmtAmbi3D || device->AmbiOrder < 2) + ambiup_free(&device->AmbiUp); + else { if(!device->AmbiUp) device->AmbiUp = ambiup_alloc(); } - else - { - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; - } } if(!pconf) @@ -891,20 +1064,54 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf else InitCustomPanning(device, pconf, speakermap); + /* Enable the stablizer only for formats that have front-left, front- + * right, and front-center outputs. + */ + switch(device->FmtChans) + { + case DevFmtX51: + case DevFmtX51Rear: + case DevFmtX61: + case DevFmtX71: + if(GetConfigValueBool(devname, NULL, "front-stablizer", 0)) + { + /* Initialize band-splitting filters for the front-left and + * front-right channels, with a crossover at 5khz (could be + * higher). + */ + ALfloat scale = (ALfloat)(5000.0 / device->Frequency); + FrontStablizer *stablizer = al_calloc(16, sizeof(*stablizer)); + + bandsplit_init(&stablizer->LFilter, scale); + stablizer->RFilter = stablizer->LFilter; + + /* Initialize all-pass filters for all other channels. */ + splitterap_init(&stablizer->APFilter[0], scale); + for(i = 1;i < (size_t)device->RealOut.NumChannels;i++) + stablizer->APFilter[i] = stablizer->APFilter[0]; + + device->Stablizer = stablizer; + } + break; + case DevFmtMono: + case DevFmtStereo: + case DevFmtQuad: + case DevFmtAmbi3D: + break; + } + TRACE("Front stablizer %s\n", device->Stablizer ? "enabled" : "disabled"); + ambdec_deinit(&conf); return; } - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; + bformatdec_free(&device->AmbiDecoder); headphones = device->IsHeadphones; if(device->Type != Loopback) { const char *mode; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-mode", &mode)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "stereo-mode", &mode)) { if(strcasecmp(mode, "headphones") == 0) headphones = true; @@ -921,51 +1128,61 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf (hrtf_appreq == Hrtf_Enable); if(!usehrtf) goto no_hrtf; - device->Hrtf.Status = ALC_HRTF_ENABLED_SOFT; + device->HrtfStatus = ALC_HRTF_ENABLED_SOFT; if(headphones && hrtf_appreq != Hrtf_Disable) - device->Hrtf.Status = ALC_HRTF_HEADPHONES_DETECTED_SOFT; + device->HrtfStatus = ALC_HRTF_HEADPHONES_DETECTED_SOFT; } else { if(hrtf_userreq != Hrtf_Enable) { if(hrtf_appreq == Hrtf_Enable) - device->Hrtf.Status = ALC_HRTF_DENIED_SOFT; + device->HrtfStatus = ALC_HRTF_DENIED_SOFT; goto no_hrtf; } - device->Hrtf.Status = ALC_HRTF_REQUIRED_SOFT; + device->HrtfStatus = ALC_HRTF_REQUIRED_SOFT; } - if(VECTOR_SIZE(device->Hrtf.List) == 0) + if(VECTOR_SIZE(device->HrtfList) == 0) { - VECTOR_DEINIT(device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); + VECTOR_DEINIT(device->HrtfList); + device->HrtfList = EnumerateHrtf(device->DeviceName); } - if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->Hrtf.List)) + if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->HrtfList)) { - const HrtfEntry *entry = &VECTOR_ELEM(device->Hrtf.List, hrtf_id); - if(entry->hrtf->sampleRate == device->Frequency) + const EnumeratedHrtf *entry = &VECTOR_ELEM(device->HrtfList, hrtf_id); + struct Hrtf *hrtf = GetLoadedHrtf(entry->hrtf); + if(hrtf && hrtf->sampleRate == device->Frequency) { - device->Hrtf.Handle = entry->hrtf; - al_string_copy(&device->Hrtf.Name, entry->name); + device->HrtfHandle = hrtf; + alstr_copy(&device->HrtfName, entry->name); } + else if(hrtf) + Hrtf_DecRef(hrtf); } - for(i = 0;!device->Hrtf.Handle && i < VECTOR_SIZE(device->Hrtf.List);i++) + for(i = 0;!device->HrtfHandle && i < VECTOR_SIZE(device->HrtfList);i++) { - const HrtfEntry *entry = &VECTOR_ELEM(device->Hrtf.List, i); - if(entry->hrtf->sampleRate == device->Frequency) + const EnumeratedHrtf *entry = &VECTOR_ELEM(device->HrtfList, i); + struct Hrtf *hrtf = GetLoadedHrtf(entry->hrtf); + if(hrtf && hrtf->sampleRate == device->Frequency) { - device->Hrtf.Handle = entry->hrtf; - al_string_copy(&device->Hrtf.Name, entry->name); + device->HrtfHandle = hrtf; + alstr_copy(&device->HrtfName, entry->name); } + else if(hrtf) + Hrtf_DecRef(hrtf); } - if(device->Hrtf.Handle) + if(device->HrtfHandle) { + if(old_hrtf) + Hrtf_DecRef(old_hrtf); + old_hrtf = NULL; + device->Render_Mode = HrtfRender; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "hrtf-mode", &mode)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "hrtf-mode", &mode)) { if(strcasecmp(mode, "full") == 0) device->Render_Mode = HrtfRender; @@ -975,24 +1192,46 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf ERR("Unexpected hrtf-mode: %s\n", mode); } - TRACE("HRTF enabled, \"%s\"\n", al_string_get_cstr(device->Hrtf.Name)); + if(device->Render_Mode == HrtfRender) + { + /* Don't bother with HOA when using full HRTF rendering. Nothing + * needs it, and it eases the CPU/memory load. + */ + ambiup_free(&device->AmbiUp); + } + else + { + if(!device->AmbiUp) + device->AmbiUp = ambiup_alloc(); + } + + TRACE("%s HRTF rendering enabled, using \"%s\"\n", + ((device->Render_Mode == HrtfRender) ? "Full" : "Basic"), + alstr_get_cstr(device->HrtfName) + ); InitHrtfPanning(device); return; } - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; + device->HrtfStatus = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; no_hrtf: + if(old_hrtf) + Hrtf_DecRef(old_hrtf); + old_hrtf = NULL; TRACE("HRTF disabled\n"); + device->Render_Mode = StereoPair; + + ambiup_free(&device->AmbiUp); + bs2blevel = ((headphones && hrtf_appreq != Hrtf_Disable) || (hrtf_appreq == Hrtf_Enable)) ? 5 : 0; if(device->Type != Loopback) - ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel); + ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel); if(bs2blevel > 0 && bs2blevel <= 6) { device->Bs2b = al_calloc(16, sizeof(*device->Bs2b)); bs2b_set_params(device->Bs2b, bs2blevel, device->Frequency); - device->Render_Mode = StereoPair; TRACE("BS2B enabled\n"); InitPanning(device); return; @@ -1000,13 +1239,12 @@ no_hrtf: TRACE("BS2B disabled\n"); - device->Render_Mode = NormalRender; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-panning", &mode)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "stereo-encoding", &mode)) { - if(strcasecmp(mode, "paired") == 0) - device->Render_Mode = StereoPair; - else if(strcasecmp(mode, "uhj") != 0) - ERR("Unexpected stereo-panning: %s\n", mode); + if(strcasecmp(mode, "uhj") == 0) + device->Render_Mode = NormalRender; + else if(strcasecmp(mode, "panpot") != 0) + ERR("Unexpected stereo-encoding: %s\n", mode); } if(device->Render_Mode == NormalRender) { @@ -1023,7 +1261,7 @@ no_hrtf: void aluInitEffectPanning(ALeffectslot *slot) { - ALuint i; + ALsizei i; memset(slot->ChanMap, 0, sizeof(slot->ChanMap)); slot->NumChannels = 0; diff --git a/Engine/lib/openal-soft/Alc/polymorphism.h b/Engine/lib/openal-soft/Alc/polymorphism.h new file mode 100644 index 000000000..fa31fad25 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/polymorphism.h @@ -0,0 +1,105 @@ +#ifndef POLYMORPHISM_H +#define POLYMORPHISM_H + +/* Macros to declare inheriting types, and to (down-)cast and up-cast. */ +#define DERIVE_FROM_TYPE(t) t t##_parent +#define STATIC_CAST(to, obj) (&(obj)->to##_parent) +#ifdef __GNUC__ +#define STATIC_UPCAST(to, from, obj) __extension__({ \ + static_assert(__builtin_types_compatible_p(from, __typeof(*(obj))), \ + "Invalid upcast object from type"); \ + (to*)((char*)(obj) - offsetof(to, from##_parent)); \ +}) +#else +#define STATIC_UPCAST(to, from, obj) ((to*)((char*)(obj) - offsetof(to, from##_parent))) +#endif + +/* Defines method forwards, which call the given parent's (T2's) implementation. */ +#define DECLARE_FORWARD(T1, T2, rettype, func) \ +rettype T1##_##func(T1 *obj) \ +{ return T2##_##func(STATIC_CAST(T2, obj)); } + +#define DECLARE_FORWARD1(T1, T2, rettype, func, argtype1) \ +rettype T1##_##func(T1 *obj, argtype1 a) \ +{ return T2##_##func(STATIC_CAST(T2, obj), a); } + +#define DECLARE_FORWARD2(T1, T2, rettype, func, argtype1, argtype2) \ +rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b) \ +{ return T2##_##func(STATIC_CAST(T2, obj), a, b); } + +#define DECLARE_FORWARD3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ +rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b, argtype3 c) \ +{ return T2##_##func(STATIC_CAST(T2, obj), a, b, c); } + +/* Defines method thunks, functions that call to the child's method. */ +#define DECLARE_THUNK(T1, T2, rettype, func) \ +static rettype T1##_##T2##_##func(T2 *obj) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj)); } + +#define DECLARE_THUNK1(T1, T2, rettype, func, argtype1) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a); } + +#define DECLARE_THUNK2(T1, T2, rettype, func, argtype1, argtype2) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b); } + +#define DECLARE_THUNK3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c); } + +#define DECLARE_THUNK4(T1, T2, rettype, func, argtype1, argtype2, argtype3, argtype4) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c, argtype4 d) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c, d); } + +/* Defines the default functions used to (de)allocate a polymorphic object. */ +#define DECLARE_DEFAULT_ALLOCATORS(T) \ +static void* T##_New(size_t size) { return al_malloc(16, size); } \ +static void T##_Delete(void *ptr) { al_free(ptr); } + + +/* Helper to extract an argument list for virtual method calls. */ +#define EXTRACT_VCALL_ARGS(...) __VA_ARGS__)) + +/* Call a "virtual" method on an object, with arguments. */ +#define V(obj, func) ((obj)->vtbl->func((obj), EXTRACT_VCALL_ARGS +/* Call a "virtual" method on an object, with no arguments. */ +#define V0(obj, func) ((obj)->vtbl->func((obj) EXTRACT_VCALL_ARGS + + +/* Helper to extract an argument list for NEW_OBJ calls. */ +#define EXTRACT_NEW_ARGS(...) __VA_ARGS__); \ + } \ +} while(0) + +/* Allocate and construct an object, with arguments. */ +#define NEW_OBJ(_res, T) do { \ + _res = T##_New(sizeof(T)); \ + if(_res) \ + { \ + memset(_res, 0, sizeof(T)); \ + T##_Construct(_res, EXTRACT_NEW_ARGS +/* Allocate and construct an object, with no arguments. */ +#define NEW_OBJ0(_res, T) do { \ + _res = T##_New(sizeof(T)); \ + if(_res) \ + { \ + memset(_res, 0, sizeof(T)); \ + T##_Construct(_res EXTRACT_NEW_ARGS + +/* Destructs and deallocate an object. */ +#define DELETE_OBJ(obj) do { \ + if((obj) != NULL) \ + { \ + V0((obj),Destruct)(); \ + V0((obj),Delete)(); \ + } \ +} while(0) + + +/* Helper to get a type's vtable thunk for a child type. */ +#define GET_VTABLE2(T1, T2) (&(T1##_##T2##_vtable)) +/* Helper to set an object's vtable thunk for a child type. Used when constructing an object. */ +#define SET_VTABLE2(T1, T2, obj) (STATIC_CAST(T2, obj)->vtbl = GET_VTABLE2(T1, T2)) + +#endif /* POLYMORPHISM_H */ diff --git a/Engine/lib/openal-soft/Alc/ringbuffer.c b/Engine/lib/openal-soft/Alc/ringbuffer.c new file mode 100644 index 000000000..6c419cf8e --- /dev/null +++ b/Engine/lib/openal-soft/Alc/ringbuffer.c @@ -0,0 +1,295 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 1999-2007 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include +#include + +#include "ringbuffer.h" +#include "align.h" +#include "atomic.h" +#include "threads.h" +#include "almalloc.h" +#include "compat.h" + + +/* NOTE: This lockless ringbuffer implementation is copied from JACK, extended + * to include an element size. Consequently, parameters and return values for a + * size or count is in 'elements', not bytes. Additionally, it only supports + * single-consumer/single-provider operation. */ +struct ll_ringbuffer { + ATOMIC(size_t) write_ptr; + ATOMIC(size_t) read_ptr; + size_t size; + size_t size_mask; + size_t elem_size; + + alignas(16) char buf[]; +}; + +ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz, int limit_writes) +{ + ll_ringbuffer_t *rb; + size_t power_of_two = 0; + + if(sz > 0) + { + power_of_two = sz; + power_of_two |= power_of_two>>1; + power_of_two |= power_of_two>>2; + power_of_two |= power_of_two>>4; + power_of_two |= power_of_two>>8; + power_of_two |= power_of_two>>16; +#if SIZE_MAX > UINT_MAX + power_of_two |= power_of_two>>32; +#endif + } + power_of_two++; + if(power_of_two < sz) return NULL; + + rb = al_malloc(16, sizeof(*rb) + power_of_two*elem_sz); + if(!rb) return NULL; + + ATOMIC_INIT(&rb->write_ptr, 0); + ATOMIC_INIT(&rb->read_ptr, 0); + rb->size = limit_writes ? sz : power_of_two; + rb->size_mask = power_of_two - 1; + rb->elem_size = elem_sz; + return rb; +} + +void ll_ringbuffer_free(ll_ringbuffer_t *rb) +{ + al_free(rb); +} + +void ll_ringbuffer_reset(ll_ringbuffer_t *rb) +{ + ATOMIC_STORE(&rb->write_ptr, 0, almemory_order_release); + ATOMIC_STORE(&rb->read_ptr, 0, almemory_order_release); + memset(rb->buf, 0, (rb->size_mask+1)*rb->elem_size); +} + + +size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb) +{ + size_t w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + size_t r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + return (w-r) & rb->size_mask; +} + +size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb) +{ + size_t w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + size_t r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + w = (r-w-1) & rb->size_mask; + return (w > rb->size) ? rb->size : w; +} + + +size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt) +{ + size_t read_ptr; + size_t free_cnt; + size_t cnt2; + size_t to_read; + size_t n1, n2; + + free_cnt = ll_ringbuffer_read_space(rb); + if(free_cnt == 0) return 0; + + to_read = (cnt > free_cnt) ? free_cnt : cnt; + read_ptr = ATOMIC_LOAD(&rb->read_ptr, almemory_order_relaxed) & rb->size_mask; + + cnt2 = read_ptr + to_read; + if(cnt2 > rb->size_mask+1) + { + n1 = rb->size_mask+1 - read_ptr; + n2 = cnt2 & rb->size_mask; + } + else + { + n1 = to_read; + n2 = 0; + } + + memcpy(dest, &rb->buf[read_ptr*rb->elem_size], n1*rb->elem_size); + read_ptr += n1; + if(n2) + { + memcpy(dest + n1*rb->elem_size, &rb->buf[(read_ptr&rb->size_mask)*rb->elem_size], + n2*rb->elem_size); + read_ptr += n2; + } + ATOMIC_STORE(&rb->read_ptr, read_ptr, almemory_order_release); + return to_read; +} + +size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt) +{ + size_t free_cnt; + size_t cnt2; + size_t to_read; + size_t n1, n2; + size_t read_ptr; + + free_cnt = ll_ringbuffer_read_space(rb); + if(free_cnt == 0) return 0; + + to_read = (cnt > free_cnt) ? free_cnt : cnt; + read_ptr = ATOMIC_LOAD(&rb->read_ptr, almemory_order_relaxed) & rb->size_mask; + + cnt2 = read_ptr + to_read; + if(cnt2 > rb->size_mask+1) + { + n1 = rb->size_mask+1 - read_ptr; + n2 = cnt2 & rb->size_mask; + } + else + { + n1 = to_read; + n2 = 0; + } + + memcpy(dest, &rb->buf[read_ptr*rb->elem_size], n1*rb->elem_size); + if(n2) + { + read_ptr += n1; + memcpy(dest + n1*rb->elem_size, &rb->buf[(read_ptr&rb->size_mask)*rb->elem_size], + n2*rb->elem_size); + } + return to_read; +} + +size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt) +{ + size_t write_ptr; + size_t free_cnt; + size_t cnt2; + size_t to_write; + size_t n1, n2; + + free_cnt = ll_ringbuffer_write_space(rb); + if(free_cnt == 0) return 0; + + to_write = (cnt > free_cnt) ? free_cnt : cnt; + write_ptr = ATOMIC_LOAD(&rb->write_ptr, almemory_order_relaxed) & rb->size_mask; + + cnt2 = write_ptr + to_write; + if(cnt2 > rb->size_mask+1) + { + n1 = rb->size_mask+1 - write_ptr; + n2 = cnt2 & rb->size_mask; + } + else + { + n1 = to_write; + n2 = 0; + } + + memcpy(&rb->buf[write_ptr*rb->elem_size], src, n1*rb->elem_size); + write_ptr += n1; + if(n2) + { + memcpy(&rb->buf[(write_ptr&rb->size_mask)*rb->elem_size], src + n1*rb->elem_size, + n2*rb->elem_size); + write_ptr += n2; + } + ATOMIC_STORE(&rb->write_ptr, write_ptr, almemory_order_release); + return to_write; +} + + +void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt) +{ + ATOMIC_ADD(&rb->read_ptr, cnt, almemory_order_acq_rel); +} + +void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt) +{ + ATOMIC_ADD(&rb->write_ptr, cnt, almemory_order_acq_rel); +} + + +void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]) +{ + size_t free_cnt; + size_t cnt2; + size_t w, r; + + w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + w &= rb->size_mask; + r &= rb->size_mask; + free_cnt = (w-r) & rb->size_mask; + + cnt2 = r + free_cnt; + if(cnt2 > rb->size_mask+1) + { + /* Two part vector: the rest of the buffer after the current write ptr, + * plus some from the start of the buffer. */ + vec[0].buf = (char*)&rb->buf[r*rb->elem_size]; + vec[0].len = rb->size_mask+1 - r; + vec[1].buf = (char*)rb->buf; + vec[1].len = cnt2 & rb->size_mask; + } + else + { + /* Single part vector: just the rest of the buffer */ + vec[0].buf = (char*)&rb->buf[r*rb->elem_size]; + vec[0].len = free_cnt; + vec[1].buf = NULL; + vec[1].len = 0; + } +} + +void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]) +{ + size_t free_cnt; + size_t cnt2; + size_t w, r; + + w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + w &= rb->size_mask; + r &= rb->size_mask; + free_cnt = (r-w-1) & rb->size_mask; + if(free_cnt > rb->size) free_cnt = rb->size; + + cnt2 = w + free_cnt; + if(cnt2 > rb->size_mask+1) + { + /* Two part vector: the rest of the buffer after the current write ptr, + * plus some from the start of the buffer. */ + vec[0].buf = (char*)&rb->buf[w*rb->elem_size]; + vec[0].len = rb->size_mask+1 - w; + vec[1].buf = (char*)rb->buf; + vec[1].len = cnt2 & rb->size_mask; + } + else + { + vec[0].buf = (char*)&rb->buf[w*rb->elem_size]; + vec[0].len = free_cnt; + vec[1].buf = NULL; + vec[1].len = 0; + } +} diff --git a/Engine/lib/openal-soft/Alc/ringbuffer.h b/Engine/lib/openal-soft/Alc/ringbuffer.h new file mode 100644 index 000000000..0d05ec840 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/ringbuffer.h @@ -0,0 +1,77 @@ +#ifndef RINGBUFFER_H +#define RINGBUFFER_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ll_ringbuffer ll_ringbuffer_t; +typedef struct ll_ringbuffer_data { + char *buf; + size_t len; +} ll_ringbuffer_data_t; + + +/** + * Create a new ringbuffer to hold at least `sz' elements of `elem_sz' bytes. + * The number of elements is rounded up to the next power of two (even if it is + * already a power of two, to ensure the requested amount can be written). + */ +ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz, int limit_writes); +/** Free all data associated with the ringbuffer `rb'. */ +void ll_ringbuffer_free(ll_ringbuffer_t *rb); +/** Reset the read and write pointers to zero. This is not thread safe. */ +void ll_ringbuffer_reset(ll_ringbuffer_t *rb); + +/** + * The non-copying data reader. `vec' is an array of two places. Set the values + * at `vec' to hold the current readable data at `rb'. If the readable data is + * in one segment the second segment has zero length. + */ +void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]); +/** + * The non-copying data writer. `vec' is an array of two places. Set the values + * at `vec' to hold the current writeable data at `rb'. If the writeable data + * is in one segment the second segment has zero length. + */ +void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]); + +/** + * Return the number of elements available for reading. This is the number of + * elements in front of the read pointer and behind the write pointer. + */ +size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb); +/** + * The copying data reader. Copy at most `cnt' elements from `rb' to `dest'. + * Returns the actual number of elements copied. + */ +size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt); +/** + * The copying data reader w/o read pointer advance. Copy at most `cnt' + * elements from `rb' to `dest'. Returns the actual number of elements copied. + */ +size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt); +/** Advance the read pointer `cnt' places. */ +void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt); + +/** + * Return the number of elements available for writing. This is the number of + * elements in front of the write pointer and behind the read pointer. + */ +size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb); +/** + * The copying data writer. Copy at most `cnt' elements to `rb' from `src'. + * Returns the actual number of elements copied. + */ +size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt); +/** Advance the write pointer `cnt' places. */ +void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* RINGBUFFER_H */ diff --git a/Engine/lib/openal-soft/Alc/uhjfilter.c b/Engine/lib/openal-soft/Alc/uhjfilter.c index 0a702873c..42b0bc40f 100644 --- a/Engine/lib/openal-soft/Alc/uhjfilter.c +++ b/Engine/lib/openal-soft/Alc/uhjfilter.c @@ -9,36 +9,29 @@ #define MAX_UPDATE_SAMPLES 128 -static const ALfloat Filter1Coeff[4] = { - 0.6923878f, 0.9360654322959f, 0.9882295226860f, 0.9987488452737f +static const ALfloat Filter1CoeffSqr[4] = { + 0.479400865589f, 0.876218493539f, 0.976597589508f, 0.997499255936f }; -static const ALfloat Filter2Coeff[4] = { - 0.4021921162426f, 0.8561710882420f, 0.9722909545651f, 0.9952884791278f +static const ALfloat Filter2CoeffSqr[4] = { + 0.161758498368f, 0.733028932341f, 0.945349700329f, 0.990599156685f }; -static void allpass_process(AllPassState *state, ALfloat *restrict dst, const ALfloat *restrict src, const ALfloat aa, ALuint todo) +static void allpass_process(AllPassState *state, ALfloat *restrict dst, const ALfloat *restrict src, const ALfloat aa, ALsizei todo) { - ALuint i; + ALfloat z1 = state->z[0]; + ALfloat z2 = state->z[1]; + ALsizei i; - if(todo > 1) + for(i = 0;i < todo;i++) { - dst[0] = aa*(src[0] + state->y[1]) - state->x[1]; - dst[1] = aa*(src[1] + state->y[0]) - state->x[0]; - for(i = 2;i < todo;i++) - dst[i] = aa*(src[i] + dst[i-2]) - src[i-2]; - state->x[1] = src[i-2]; - state->x[0] = src[i-1]; - state->y[1] = dst[i-2]; - state->y[0] = dst[i-1]; - } - else if(todo == 1) - { - dst[0] = aa*(src[0] + state->y[1]) - state->x[1]; - state->x[1] = state->x[0]; - state->x[0] = src[0]; - state->y[1] = state->y[0]; - state->y[0] = dst[0]; + ALfloat input = src[i]; + ALfloat output = input*aa + z1; + z1 = z2; z2 = output*aa - input; + dst[i] = output; } + + state->z[0] = z1; + state->z[1] = z2; } @@ -62,47 +55,43 @@ static void allpass_process(AllPassState *state, ALfloat *restrict dst, const AL * know which is the intended result. */ -void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo) +void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo) { ALfloat D[MAX_UPDATE_SAMPLES], S[MAX_UPDATE_SAMPLES]; ALfloat temp[2][MAX_UPDATE_SAMPLES]; - ALuint base, i; + ALsizei base, i; + + ASSUME(SamplesToDo > 0); for(base = 0;base < SamplesToDo;) { - ALuint todo = minu(SamplesToDo - base, MAX_UPDATE_SAMPLES); + ALsizei todo = mini(SamplesToDo - base, MAX_UPDATE_SAMPLES); + ASSUME(todo > 0); /* D = 0.6554516*Y */ for(i = 0;i < todo;i++) temp[0][i] = 0.6554516f*InSamples[2][base+i]; - allpass_process(&enc->Filter1_Y[0], temp[1], temp[0], - Filter1Coeff[0]*Filter1Coeff[0], todo); - allpass_process(&enc->Filter1_Y[1], temp[0], temp[1], - Filter1Coeff[1]*Filter1Coeff[1], todo); - allpass_process(&enc->Filter1_Y[2], temp[1], temp[0], - Filter1Coeff[2]*Filter1Coeff[2], todo); + allpass_process(&enc->Filter1_Y[0], temp[1], temp[0], Filter1CoeffSqr[0], todo); + allpass_process(&enc->Filter1_Y[1], temp[0], temp[1], Filter1CoeffSqr[1], todo); + allpass_process(&enc->Filter1_Y[2], temp[1], temp[0], Filter1CoeffSqr[2], todo); + allpass_process(&enc->Filter1_Y[3], temp[0], temp[1], Filter1CoeffSqr[3], todo); /* NOTE: Filter1 requires a 1 sample delay for the final output, so * take the last processed sample from the previous run as the first * output sample. */ - D[0] = enc->Filter1_Y[3].y[0]; - allpass_process(&enc->Filter1_Y[3], temp[0], temp[1], - Filter1Coeff[3]*Filter1Coeff[3], todo); + D[0] = enc->LastY; for(i = 1;i < todo;i++) D[i] = temp[0][i-1]; + enc->LastY = temp[0][i-1]; /* D += j(-0.3420201*W + 0.5098604*X) */ for(i = 0;i < todo;i++) temp[0][i] = -0.3420201f*InSamples[0][base+i] + 0.5098604f*InSamples[1][base+i]; - allpass_process(&enc->Filter2_WX[0], temp[1], temp[0], - Filter2Coeff[0]*Filter2Coeff[0], todo); - allpass_process(&enc->Filter2_WX[1], temp[0], temp[1], - Filter2Coeff[1]*Filter2Coeff[1], todo); - allpass_process(&enc->Filter2_WX[2], temp[1], temp[0], - Filter2Coeff[2]*Filter2Coeff[2], todo); - allpass_process(&enc->Filter2_WX[3], temp[0], temp[1], - Filter2Coeff[3]*Filter2Coeff[3], todo); + allpass_process(&enc->Filter2_WX[0], temp[1], temp[0], Filter2CoeffSqr[0], todo); + allpass_process(&enc->Filter2_WX[1], temp[0], temp[1], Filter2CoeffSqr[1], todo); + allpass_process(&enc->Filter2_WX[2], temp[1], temp[0], Filter2CoeffSqr[2], todo); + allpass_process(&enc->Filter2_WX[3], temp[0], temp[1], Filter2CoeffSqr[3], todo); for(i = 0;i < todo;i++) D[i] += temp[0][i]; @@ -110,17 +99,14 @@ void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict R for(i = 0;i < todo;i++) temp[0][i] = 0.9396926f*InSamples[0][base+i] + 0.1855740f*InSamples[1][base+i]; - allpass_process(&enc->Filter1_WX[0], temp[1], temp[0], - Filter1Coeff[0]*Filter1Coeff[0], todo); - allpass_process(&enc->Filter1_WX[1], temp[0], temp[1], - Filter1Coeff[1]*Filter1Coeff[1], todo); - allpass_process(&enc->Filter1_WX[2], temp[1], temp[0], - Filter1Coeff[2]*Filter1Coeff[2], todo); - S[0] = enc->Filter1_WX[3].y[0]; - allpass_process(&enc->Filter1_WX[3], temp[0], temp[1], - Filter1Coeff[3]*Filter1Coeff[3], todo); + allpass_process(&enc->Filter1_WX[0], temp[1], temp[0], Filter1CoeffSqr[0], todo); + allpass_process(&enc->Filter1_WX[1], temp[0], temp[1], Filter1CoeffSqr[1], todo); + allpass_process(&enc->Filter1_WX[2], temp[1], temp[0], Filter1CoeffSqr[2], todo); + allpass_process(&enc->Filter1_WX[3], temp[0], temp[1], Filter1CoeffSqr[3], todo); + S[0] = enc->LastWX; for(i = 1;i < todo;i++) S[i] = temp[0][i-1]; + enc->LastWX = temp[0][i-1]; /* Left = (S + D)/2.0 */ for(i = 0;i < todo;i++) diff --git a/Engine/lib/openal-soft/Alc/uhjfilter.h b/Engine/lib/openal-soft/Alc/uhjfilter.h index 14572bc31..e773e0a72 100644 --- a/Engine/lib/openal-soft/Alc/uhjfilter.h +++ b/Engine/lib/openal-soft/Alc/uhjfilter.h @@ -6,8 +6,7 @@ #include "alMain.h" typedef struct AllPassState { - ALfloat x[2]; /* Last two input samples */ - ALfloat y[2]; /* Last two output samples */ + ALfloat z[2]; } AllPassState; /* Encoding 2-channel UHJ from B-Format is done as: @@ -36,13 +35,15 @@ typedef struct AllPassState { */ typedef struct Uhj2Encoder { - AllPassState Filter1_WX[4]; AllPassState Filter1_Y[4]; AllPassState Filter2_WX[4]; + AllPassState Filter1_WX[4]; + ALfloat LastY, LastWX; } Uhj2Encoder; /* Encodes a 2-channel UHJ (stereo-compatible) signal from a B-Format input - * signal. */ -void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo); + * signal. The input must use FuMa channel ordering and scaling. + */ +void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo); #endif /* UHJFILTER_H */ diff --git a/Engine/lib/openal-soft/Alc/vector.h b/Engine/lib/openal-soft/Alc/vector.h index 4bb92458f..ed9acfb02 100644 --- a/Engine/lib/openal-soft/Alc/vector.h +++ b/Engine/lib/openal-soft/Alc/vector.h @@ -37,13 +37,15 @@ typedef const _##N* const_##N; \ if(((_x) ? (_x)->Capacity : 0) < _cap) \ { \ + ptrdiff_t data_offset = (_x) ? (char*)((_x)->Data) - (char*)(_x) : \ + sizeof(*(_x)); \ size_t old_size = ((_x) ? (_x)->Size : 0); \ void *temp; \ \ - temp = al_calloc(16, sizeof(*(_x)) + sizeof((_x)->Data[0])*_cap); \ + temp = al_calloc(16, data_offset + sizeof((_x)->Data[0])*_cap); \ assert(temp != NULL); \ if((_x)) \ - memcpy(((ALubyte*)temp)+sizeof(*(_x)), (_x)->Data, \ + memcpy(((char*)temp)+data_offset, (_x)->Data, \ sizeof((_x)->Data[0])*old_size); \ \ al_free((_x)); \ @@ -78,13 +80,6 @@ typedef const _##N* const_##N; _f(_iter); \ } while(0) -#define VECTOR_FOR_EACH_PARAMS(_t, _x, _f, ...) do { \ - _t *_iter = VECTOR_BEGIN((_x)); \ - _t *_end = VECTOR_END((_x)); \ - for(;_iter != _end;++_iter) \ - _f(__VA_ARGS__, _iter); \ -} while(0) - #define VECTOR_FIND_IF(_i, _t, _x, _f) do { \ _t *_iter = VECTOR_BEGIN((_x)); \ _t *_end = VECTOR_END((_x)); \ @@ -96,15 +91,4 @@ typedef const _##N* const_##N; (_i) = _iter; \ } while(0) -#define VECTOR_FIND_IF_PARMS(_i, _t, _x, _f, ...) do { \ - _t *_iter = VECTOR_BEGIN((_x)); \ - _t *_end = VECTOR_END((_x)); \ - for(;_iter != _end;++_iter) \ - { \ - if(_f(__VA_ARGS__, _iter)) \ - break; \ - } \ - (_i) = _iter; \ -} while(0) - #endif /* AL_VECTOR_H */ diff --git a/Engine/lib/openal-soft/CMakeLists.txt b/Engine/lib/openal-soft/CMakeLists.txt index cf6d7ca6f..6a4f8ff4a 100644 --- a/Engine/lib/openal-soft/CMakeLists.txt +++ b/Engine/lib/openal-soft/CMakeLists.txt @@ -1,15 +1,21 @@ # CMake build file list for OpenAL -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) +CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2) PROJECT(OpenAL) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) CMAKE_POLICY(SET CMP0005 NEW) + IF(POLICY CMP0020) + CMAKE_POLICY(SET CMP0020 NEW) + ENDIF(POLICY CMP0020) IF(POLICY CMP0042) CMAKE_POLICY(SET CMP0042 NEW) ENDIF(POLICY CMP0042) + IF(POLICY CMP0054) + CMAKE_POLICY(SET CMP0054 NEW) + ENDIF(POLICY CMP0054) ENDIF(COMMAND CMAKE_POLICY) SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake") @@ -21,13 +27,13 @@ INCLUDE(CheckIncludeFile) INCLUDE(CheckIncludeFiles) INCLUDE(CheckSymbolExists) INCLUDE(CheckCCompilerFlag) +INCLUDE(CheckCXXCompilerFlag) INCLUDE(CheckCSourceCompiles) INCLUDE(CheckTypeSize) include(CheckStructHasMember) include(CheckFileOffsetBits) include(GNUInstallDirs) - SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) @@ -56,11 +62,16 @@ if(DEFINED LIB_SUFFIX) endif() -IF(NOT WIN32) - SET(LIBNAME openal) -ELSE() - SET(LIBNAME OpenAL32) - ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502") +SET(CPP_DEFS ) # C pre-process, not C++ +SET(INC_PATHS ) +SET(C_FLAGS ) +SET(LINKER_FLAGS ) +SET(EXTRA_LIBS ) + +IF(WIN32) + SET(CPP_DEFS ${CPP_DEFS} _WIN32 _WIN32_WINNT=0x0502) + + OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF) # This option is mainly for static linking OpenAL Soft into another project # that already defines the IDs. It is up to that project to ensure all @@ -82,8 +93,8 @@ ENDIF() # QNX's gcc do not uses /usr/include and /usr/lib pathes by default IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX") - ADD_DEFINITIONS("-I/usr/include") - SET(EXTRA_LIBS ${EXTRA_LIBS} -L/usr/lib) + SET(INC_PATHS ${INC_PATHS} /usr/include) + SET(LINKER_FLAGS ${LINKER_FLAGS} -L/usr/lib) ENDIF() IF(NOT LIBTYPE) @@ -91,7 +102,7 @@ IF(NOT LIBTYPE) ENDIF() SET(LIB_MAJOR_VERSION "1") -SET(LIB_MINOR_VERSION "17") +SET(LIB_MINOR_VERSION "18") SET(LIB_REVISION "2") SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}") @@ -113,17 +124,22 @@ ELSE() ENDIF() ENDIF() +CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD_CXX11) +IF(HAVE_STD_CXX11) + SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") +ENDIF() + if(NOT WIN32) # Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT) IF(NOT HAVE_POSIX_MEMALIGN_DEFAULT) SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600") CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX) IF(NOT HAVE_POSIX_MEMALIGN_POSIX) SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) ELSE() - ADD_DEFINITIONS(-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500) + SET(CPP_DEFS ${CPP_DEFS} _POSIX_C_SOURCE=200112L _XOPEN_SOURCE=600) ENDIF() ENDIF() UNSET(OLD_REQUIRED_FLAGS) @@ -132,10 +148,10 @@ ENDIF() # Set defines for large file support CHECK_FILE_OFFSET_BITS() IF(_FILE_OFFSET_BITS) - ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}) + SET(CPP_DEFS ${CPP_DEFS} "_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}") ENDIF() -ADD_DEFINITIONS(-D_LARGEFILE_SOURCE -D_LARGE_FILES) +SET(CPP_DEFS ${CPP_DEFS} _LARGEFILE_SOURCE _LARGE_FILES) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES") # MSVC may need workarounds for C99 restrict and inline @@ -145,7 +161,7 @@ IF(MSVC) CHECK_C_SOURCE_COMPILES("int *restrict foo; int main() {return 0;}" HAVE_RESTRICT) IF(NOT HAVE_RESTRICT) - ADD_DEFINITIONS("-Drestrict=") + SET(CPP_DEFS ${CPP_DEFS} "restrict=") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=") ENDIF() @@ -158,13 +174,15 @@ IF(MSVC) MESSAGE(FATAL_ERROR "No inline keyword found, please report!") ENDIF() - ADD_DEFINITIONS(-Dinline=__inline) + SET(CPP_DEFS ${CPP_DEFS} inline=__inline) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline") ENDIF() ENDIF() # Make sure we have C99-style inline semantics with GCC (4.3 or newer). IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS "-fno-gnu89-inline ${CMAKE_C_FLAGS}") + SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") # Force no inlining for the next test. SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline") @@ -183,7 +201,7 @@ ENDIF() CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC) IF(HAVE_STRUCT_TIMESPEC) # Define it here so we don't have to include config.h for it - ADD_DEFINITIONS("-DHAVE_STRUCT_TIMESPEC") + SET(CPP_DEFS ${CPP_DEFS} HAVE_STRUCT_TIMESPEC) ENDIF() # Some systems may need libatomic for C11 atomic functions to work @@ -203,15 +221,12 @@ ELSE() ENDIF() UNSET(OLD_REQUIRED_LIBRARIES) -# Check if we have C99 variable length arrays -CHECK_C_SOURCE_COMPILES( -"int main(int argc, char *argv[]) - { - volatile int tmp[argc]; - tmp[0] = argv[0][0]; - return tmp[0]; - }" -HAVE_C99_VLA) +# Include liblog for Android logging +CHECK_LIBRARY_EXISTS(log __android_log_print "" HAVE_LIBLOG) +IF(HAVE_LIBLOG) + SET(EXTRA_LIBS log ${EXTRA_LIBS}) + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} log) +ENDIF() # Check if we have C99 bool CHECK_C_SOURCE_COMPILES( @@ -244,23 +259,16 @@ HAVE_C11_ALIGNAS) # Check if we have C11 _Atomic CHECK_C_SOURCE_COMPILES( "#include - const int _Atomic foo = ATOMIC_VAR_INIT(~0); - int _Atomic bar = ATOMIC_VAR_INIT(0); + int _Atomic foo = ATOMIC_VAR_INIT(0); int main() { - atomic_fetch_add(&bar, 2); - return atomic_load(&foo); + atomic_fetch_add(&foo, 2); + return 0; }" HAVE_C11_ATOMIC) # Add definitions, compiler switches, etc. -INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_BINARY_DIR}") -IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") - IF(WIN32 AND ALSOFT_NO_UID_DEFS) - ADD_DEFINITIONS("-DAL_NO_UID_DEFS") - ENDIF() -ENDIF() +INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_SOURCE_DIR}/common" "${OpenAL_BINARY_DIR}") IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING @@ -273,11 +281,9 @@ IF(NOT CMAKE_DEBUG_POSTFIX) FORCE) ENDIF() -SET(EXTRA_CFLAGS "") IF(MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) - ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} /wd4098") + SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE) + SET(C_FLAGS ${C_FLAGS} /wd4098) IF(NOT DXSDK_DIR) STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}") @@ -299,25 +305,14 @@ IF(MSVC) ENDFOREACH(flag_var) ENDIF() ELSE() - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Winline -Wall") + SET(C_FLAGS ${C_FLAGS} -Winline -Wall) CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA) IF(HAVE_W_EXTRA) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wextra") + SET(C_FLAGS ${C_FLAGS} -Wextra) ENDIF() IF(ALSOFT_WERROR) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") - ENDIF() - - # Force enable -fPIC for CMake versions before 2.8.9 (later versions have - # the POSITION_INDEPENDENT_CODE target property). The static common library - # will be linked into the dynamic openal library, which requires all its - # code to be position-independent. - IF(CMAKE_VERSION VERSION_LESS "2.8.9" AND NOT WIN32) - CHECK_C_COMPILER_FLAG(-fPIC HAVE_FPIC_SWITCH) - IF(HAVE_FPIC_SWITCH) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC") - ENDIF() + SET(C_FLAGS ${C_FLAGS} -Werror) ENDIF() # We want RelWithDebInfo to actually include debug stuff (define _DEBUG @@ -328,6 +323,11 @@ ELSE() ENDIF() ENDFOREACH() + CHECK_C_COMPILER_FLAG(-fno-math-errno HAVE_FNO_MATH_ERRNO) + IF(HAVE_FNO_MATH_ERRNO) + SET(C_FLAGS ${C_FLAGS} -fno-math-errno) + ENDIF() + CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor)); int main() {return 0;}" HAVE_GCC_DESTRUCTOR) @@ -344,7 +344,7 @@ int main() HAVE_STATIC_LIBGCC_SWITCH ) if(HAVE_STATIC_LIBGCC_SWITCH) - set(EXTRA_LIBS ${EXTRA_LIBS} -static-libgcc) + SET(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc) endif() set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES}) unset(OLD_REQUIRED_LIBRARIES) @@ -352,7 +352,6 @@ int main() ENDIF() # Set visibility/export options if available -SET(HIDDEN_DECL "") IF(WIN32) SET(EXPORT_DECL "__declspec(dllexport)") IF(NOT MINGW) @@ -380,8 +379,7 @@ ELSE() IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY) CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH) IF(HAVE_VISIBILITY_HIDDEN_SWITCH) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") - SET(HIDDEN_DECL "__attribute__((visibility(\"hidden\")))") + SET(C_FLAGS ${C_FLAGS} -fvisibility=hidden) ENDIF() ENDIF() @@ -394,32 +392,44 @@ ELSE() SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}") ENDIF() +CHECK_C_SOURCE_COMPILES(" +int main() +{ + float *ptr; + ptr = __builtin_assume_aligned(ptr, 16); + return 0; +}" HAVE___BUILTIN_ASSUME_ALIGNED) +IF(HAVE___BUILTIN_ASSUME_ALIGNED) + SET(ASSUME_ALIGNED_DECL "__builtin_assume_aligned(x, y)") +ELSE() + SET(ASSUME_ALIGNED_DECL "x") +ENDIF() + SET(SSE_SWITCH "") SET(SSE2_SWITCH "") SET(SSE3_SWITCH "") SET(SSE4_1_SWITCH "") SET(FPU_NEON_SWITCH "") -IF(NOT MSVC) - CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH) - IF(HAVE_MSSE_SWITCH) - SET(SSE_SWITCH "-msse") - ENDIF() - CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) - IF(HAVE_MSSE2_SWITCH) - SET(SSE2_SWITCH "-msse2") - ENDIF() - CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) - IF(HAVE_MSSE3_SWITCH) - SET(SSE3_SWITCH "-msse3") - ENDIF() - CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) - IF(HAVE_MSSE4_1_SWITCH) - SET(SSE4_1_SWITCH "-msse4.1") - ENDIF() - CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) - IF(HAVE_MFPU_NEON_SWITCH) - SET(FPU_NEON_SWITCH "-mfpu=neon") - ENDIF() + +CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH) +IF(HAVE_MSSE_SWITCH) + SET(SSE_SWITCH "-msse") +ENDIF() +CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) +IF(HAVE_MSSE2_SWITCH) + SET(SSE2_SWITCH "-msse2") +ENDIF() +CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) +IF(HAVE_MSSE3_SWITCH) + SET(SSE3_SWITCH "-msse3") +ENDIF() +CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) +IF(HAVE_MSSE4_1_SWITCH) + SET(SSE4_1_SWITCH "-msse4.1") +ENDIF() +CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) +IF(HAVE_MFPU_NEON_SWITCH) + SET(FPU_NEON_SWITCH "-mfpu=neon") ENDIF() CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2))); @@ -442,9 +452,10 @@ IF(NOT HAVE_GUIDDEF_H) ENDIF() # Some systems need libm for some of the following math functions to work +SET(MATH_LIB ) CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM) IF(HAVE_LIBM) - SET(EXTRA_LIBS m ${EXTRA_LIBS}) + SET(MATH_LIB ${MATH_LIB} m) SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m) ENDIF() @@ -476,19 +487,31 @@ IF(HAVE_INTRIN_H) __cpuid(regs, 0); return regs[0]; }" HAVE_CPUID_INTRINSIC) + CHECK_C_SOURCE_COMPILES("#include + int main() + { + unsigned long idx = 0; + _BitScanForward64(&idx, 1); + return idx; + }" HAVE_BITSCANFORWARD64_INTRINSIC) + CHECK_C_SOURCE_COMPILES("#include + int main() + { + unsigned long idx = 0; + _BitScanForward(&idx, 1); + return idx; + }" HAVE_BITSCANFORWARD_INTRINSIC) ENDIF() +CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF) CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC) +CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH) CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF) CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF) -IF(NOT HAVE_C99_VLA) - CHECK_SYMBOL_EXISTS(alloca malloc.h HAVE_ALLOCA) - IF(NOT HAVE_ALLOCA) - MESSAGE(FATAL_ERROR "No alloca function found, please report!") - ENDIF() -ENDIF() +CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F) +CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF) IF(HAVE_FLOAT_H) CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP) @@ -504,7 +527,7 @@ IF(NOT HAVE_STRCASECMP) MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!") ENDIF() - ADD_DEFINITIONS(-Dstrcasecmp=_stricmp) + SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp) ENDIF() CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP) @@ -514,7 +537,7 @@ IF(NOT HAVE_STRNCASECMP) MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!") ENDIF() - ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp) + SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp) ENDIF() CHECK_SYMBOL_EXISTS(strnlen string.h HAVE_STRNLEN) @@ -525,7 +548,7 @@ IF(NOT HAVE_SNPRINTF) MESSAGE(FATAL_ERROR "No snprintf function found, please report!") ENDIF() - ADD_DEFINITIONS(-Dsnprintf=_snprintf) + SET(CPP_DEFS ${CPP_DEFS} snprintf=_snprintf) ENDIF() CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE) @@ -536,9 +559,9 @@ IF(NOT HAVE_ISFINITE) IF(NOT HAVE__FINITE) MESSAGE(FATAL_ERROR "No isfinite function found, please report!") ENDIF() - ADD_DEFINITIONS(-Disfinite=_finite) + SET(CPP_DEFS ${CPP_DEFS} isfinite=_finite) ELSE() - ADD_DEFINITIONS(-Disfinite=finite) + SET(CPP_DEFS ${CPP_DEFS} isfinite=finite) ENDIF() ENDIF() @@ -549,12 +572,17 @@ IF(NOT HAVE_ISNAN) MESSAGE(FATAL_ERROR "No isnan function found, please report!") ENDIF() - ADD_DEFINITIONS(-Disnan=_isnan) + SET(CPP_DEFS ${CPP_DEFS} isnan=_isnan) ENDIF() # Check if we have Windows headers -CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502) +SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) +SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502) +CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H) +SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS}) +UNSET(OLD_REQUIRED_DEFINITIONS) + IF(NOT HAVE_WINDOWS_H) CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY) IF(NOT HAVE_GETTIMEOFDAY) @@ -576,9 +604,9 @@ IF(NOT HAVE_WINDOWS_H) CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD) IF(HAVE_PTHREAD) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pthread") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread") - SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread) + SET(C_FLAGS ${C_FLAGS} -pthread) + SET(LINKER_FLAGS ${LINKER_FLAGS} -pthread) ENDIF() CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD) @@ -603,6 +631,16 @@ int main() }" PTHREAD_SETNAME_NP_ONE_PARAM ) + CHECK_C_SOURCE_COMPILES(" +#include +#include +int main() +{ + pthread_setname_np(pthread_self(), \"%s\", \"testname\"); + return 0; +}" + PTHREAD_SETNAME_NP_THREE_PARAMS + ) ENDIF() CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP) ELSE() @@ -619,6 +657,15 @@ int main() }" PTHREAD_SETNAME_NP_ONE_PARAM ) + CHECK_C_SOURCE_COMPILES(" +#include +int main() +{ + pthread_setname_np(pthread_self(), \"%s\", \"testname\"); + return 0; +}" + PTHREAD_SETNAME_NP_THREE_PARAMS + ) ENDIF() CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP) ENDIF() @@ -631,6 +678,8 @@ int main() ENDIF() ENDIF() +CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT) + # Check for a 64-bit type CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) IF(NOT HAVE_STDINT_H) @@ -650,48 +699,96 @@ IF(NOT HAVE_STDINT_H) ENDIF() -SET(COMMON_OBJS common/almalloc.c - common/atomic.c - common/rwlock.c - common/threads.c - common/uintmap.c +SET(COMMON_OBJS + common/align.h + common/almalloc.c + common/almalloc.h + common/atomic.c + common/atomic.h + common/bool.h + common/math_defs.h + common/rwlock.c + common/rwlock.h + common/static_assert.h + common/threads.c + common/threads.h + common/uintmap.c + common/uintmap.h ) -SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c - OpenAL32/alBuffer.c - OpenAL32/alEffect.c - OpenAL32/alError.c - OpenAL32/alExtension.c - OpenAL32/alFilter.c - OpenAL32/alListener.c - OpenAL32/alSource.c - OpenAL32/alState.c - OpenAL32/alThunk.c - OpenAL32/sample_cvt.c +SET(OPENAL_OBJS + OpenAL32/Include/bs2b.h + OpenAL32/Include/alMain.h + OpenAL32/Include/alu.h + + OpenAL32/Include/alAuxEffectSlot.h + OpenAL32/alAuxEffectSlot.c + OpenAL32/Include/alBuffer.h + OpenAL32/alBuffer.c + OpenAL32/Include/alEffect.h + OpenAL32/alEffect.c + OpenAL32/Include/alError.h + OpenAL32/alError.c + OpenAL32/alExtension.c + OpenAL32/Include/alFilter.h + OpenAL32/alFilter.c + OpenAL32/Include/alListener.h + OpenAL32/alListener.c + OpenAL32/Include/alSource.h + OpenAL32/alSource.c + OpenAL32/alState.c + OpenAL32/event.c + OpenAL32/Include/sample_cvt.h + OpenAL32/sample_cvt.c ) -SET(ALC_OBJS Alc/ALc.c - Alc/ALu.c - Alc/alcConfig.c - Alc/alcRing.c - Alc/bs2b.c - Alc/effects/chorus.c - Alc/effects/compressor.c - Alc/effects/dedicated.c - Alc/effects/distortion.c - Alc/effects/echo.c - Alc/effects/equalizer.c - Alc/effects/flanger.c - Alc/effects/modulator.c - Alc/effects/null.c - Alc/effects/reverb.c - Alc/helpers.c - Alc/bsinc.c - Alc/hrtf.c - Alc/uhjfilter.c - Alc/ambdec.c - Alc/bformatdec.c - Alc/panning.c - Alc/mixer.c - Alc/mixer_c.c +SET(ALC_OBJS + Alc/ALc.c + Alc/ALu.c + Alc/alconfig.c + Alc/alconfig.h + Alc/bs2b.c + Alc/converter.c + Alc/converter.h + Alc/inprogext.h + Alc/mastering.c + Alc/mastering.h + Alc/ringbuffer.c + Alc/ringbuffer.h + Alc/effects/chorus.c + Alc/effects/compressor.c + Alc/effects/dedicated.c + Alc/effects/distortion.c + Alc/effects/echo.c + Alc/effects/equalizer.c + Alc/effects/modulator.c + Alc/effects/null.c + Alc/effects/pshifter.c + Alc/effects/reverb.c + Alc/filters/defs.h + Alc/filters/filter.c + Alc/filters/nfc.c + Alc/filters/nfc.h + Alc/filters/splitter.c + Alc/filters/splitter.h + Alc/helpers.c + Alc/alstring.h + Alc/compat.h + Alc/cpu_caps.h + Alc/fpu_modes.h + Alc/logging.h + Alc/vector.h + Alc/hrtf.c + Alc/hrtf.h + Alc/uhjfilter.c + Alc/uhjfilter.h + Alc/ambdec.c + Alc/ambdec.h + Alc/bformatdec.c + Alc/bformatdec.h + Alc/panning.c + Alc/polymorphism.h + Alc/mixvoice.c + Alc/mixer/defs.h + Alc/mixer/mixer_c.c ) @@ -708,13 +805,14 @@ SET(HAVE_SOLARIS 0) SET(HAVE_SNDIO 0) SET(HAVE_QSA 0) SET(HAVE_DSOUND 0) -SET(HAVE_MMDEVAPI 0) +SET(HAVE_WASAPI 0) SET(HAVE_WINMM 0) SET(HAVE_PORTAUDIO 0) SET(HAVE_PULSEAUDIO 0) SET(HAVE_COREAUDIO 0) SET(HAVE_OPENSL 0) SET(HAVE_WAVE 0) +SET(HAVE_SDL2 0) # Check for SSE support OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF) @@ -724,9 +822,9 @@ IF(HAVE_XMMINTRIN_H) IF(ALSOFT_CPUEXT_SSE) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse.c) IF(SSE_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse.c PROPERTIES COMPILE_FLAGS "${SSE_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE") @@ -744,9 +842,9 @@ IF(HAVE_EMMINTRIN_H) IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE2 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse2.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse2.c) IF(SSE2_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse2.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse2.c PROPERTIES COMPILE_FLAGS "${SSE2_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE2") @@ -764,9 +862,9 @@ IF(HAVE_EMMINTRIN_H) IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE3 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse3.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse3.c) IF(SSE2_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse3.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse3.c PROPERTIES COMPILE_FLAGS "${SSE3_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE3") @@ -784,9 +882,9 @@ IF(HAVE_SMMINTRIN_H) IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE4_1 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse41.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse41.c) IF(SSE4_1_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse41.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse41.c PROPERTIES COMPILE_FLAGS "${SSE4_1_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE4.1") @@ -799,14 +897,14 @@ ENDIF() # Check for ARM Neon support OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF) -CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H) +CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH}) IF(HAVE_ARM_NEON_H) OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON) IF(ALSOFT_CPUEXT_NEON) SET(HAVE_NEON 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_neon.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_neon.c) IF(FPU_NEON_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_neon.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_neon.c PROPERTIES COMPILE_FLAGS "${FPU_NEON_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, Neon") @@ -830,10 +928,11 @@ ENDIF() SET(BACKENDS "") SET(ALC_OBJS ${ALC_OBJS} - Alc/backends/base.c - # Default backends, always available - Alc/backends/loopback.c - Alc/backends/null.c + Alc/backends/base.c + Alc/backends/base.h + # Default backends, always available + Alc/backends/loopback.c + Alc/backends/null.c ) # Check ALSA backend @@ -846,9 +945,7 @@ IF(ALSA_FOUND) SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c) ADD_BACKEND_LIBS(${ALSA_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA) @@ -864,9 +961,10 @@ IF(OSS_FOUND) SET(HAVE_OSS 1) SET(BACKENDS "${BACKENDS} OSS,") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${OSS_INCLUDE_DIRS}) + IF(OSS_LIBRARIES) + SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS}) ENDIF() + SET(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS) @@ -882,9 +980,7 @@ IF(AUDIOIO_FOUND) SET(HAVE_SOLARIS 1) SET(BACKENDS "${BACKENDS} Solaris,") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${AUDIOIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS) @@ -901,9 +997,7 @@ IF(SOUNDIO_FOUND) SET(BACKENDS "${BACKENDS} SndIO (linked),") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c) SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${SOUNDIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO) @@ -920,9 +1014,7 @@ IF(QSA_FOUND) SET(BACKENDS "${BACKENDS} QSA (linked),") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c) SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${QSA_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA) @@ -932,10 +1024,13 @@ ENDIF() # Check Windows-only backends OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF) OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF) -OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF) +OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF) IF(HAVE_WINDOWS_H) + SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) + SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502) + # Check MMSystem backend - CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502) + CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H) IF(HAVE_MMSYSTEM_H) CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM) IF(HAVE_LIBWINMM) @@ -958,22 +1053,23 @@ IF(HAVE_WINDOWS_H) SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) ADD_BACKEND_LIBS(${DSOUND_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${DSOUND_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) ENDIF() ENDIF() - # Check for MMDevApi backend + # Check for WASAPI backend CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) IF(HAVE_MMDEVICEAPI_H) - OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON) - IF(ALSOFT_BACKEND_MMDEVAPI) - SET(HAVE_MMDEVAPI 1) - SET(BACKENDS "${BACKENDS} MMDevApi,") - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c) + OPTION(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON) + IF(ALSOFT_BACKEND_WASAPI) + SET(HAVE_WASAPI 1) + SET(BACKENDS "${BACKENDS} WASAPI,") + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.c) ENDIF() ENDIF() + + SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS}) + UNSET(OLD_REQUIRED_DEFINITIONS) ENDIF() IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM) MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend") @@ -981,8 +1077,8 @@ ENDIF() IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND) MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend") ENDIF() -IF(ALSOFT_REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI) - MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend") +IF(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI) + MESSAGE(FATAL_ERROR "Failed to enabled required WASAPI backend") ENDIF() # Check PortAudio backend @@ -995,9 +1091,7 @@ IF(PORTAUDIO_FOUND) SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c) ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${PORTAUDIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO) @@ -1014,9 +1108,7 @@ IF(PULSEAUDIO_FOUND) SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c) ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${PULSEAUDIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO) @@ -1033,9 +1125,7 @@ IF(JACK_FOUND) SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c) ADD_BACKEND_LIBS(${JACK_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${JACK_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK) @@ -1094,6 +1184,24 @@ IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL) MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend") ENDIF() +# Check for SDL2 backend +OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF) +FIND_PACKAGE(SDL2) +IF(SDL2_FOUND) + # Off by default, since it adds a runtime dependency + OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF) + IF(ALSOFT_BACKEND_SDL2) + SET(HAVE_SDL2 1) + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.c) + SET(BACKENDS "${BACKENDS} SDL2,") + SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS}) + SET(INC_PATHS ${INC_PATHS} ${SDL2_INCLUDE_DIR}) + ENDIF() +ENDIF() +IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND) + MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend") +ENDIF() + # Optionally enable the Wave Writer backend OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON) IF(ALSOFT_BACKEND_WAVE) @@ -1105,50 +1213,91 @@ ENDIF() # This is always available SET(BACKENDS "${BACKENDS} Null") + +FIND_PACKAGE(Git) +IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git") + # Get the current working branch and its latest abbreviated commit hash + ADD_CUSTOM_TARGET(build_version + ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE} + -D LIB_VERSION=${LIB_VERSION} + -D SRC=${OpenAL_SOURCE_DIR}/version.h.in + -D DST=${OpenAL_BINARY_DIR}/version.h + -P ${OpenAL_SOURCE_DIR}/version.cmake + WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}" + VERBATIM + ) +ELSE() + SET(GIT_BRANCH "UNKNOWN") + SET(GIT_COMMIT_HASH "unknown") + CONFIGURE_FILE( + "${OpenAL_SOURCE_DIR}/version.h.in" + "${OpenAL_BINARY_DIR}/version.h") +ENDIF() + +SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/") +SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/") +FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}") + +SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h") +SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen") +ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}" + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}" + COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}" + COMMAND ${CMAKE_COMMAND} --build . --config "Release" + WORKING_DIRECTORY "${NATIVE_BIN_DIR}" + DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt" + IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c" + C "${NATIVE_SRC_DIR}bsincgen.c" + VERBATIM +) +ADD_CUSTOM_TARGET(native-tools + DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}" + VERBATIM +) + option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" OFF) if(ALSOFT_EMBED_HRTF_DATA) - if(WIN32) - set(ALC_OBJS ${ALC_OBJS} Alc/hrtf_res.rc) - else() - set(FILENAMES default-44100.mhr default-48000.mhr) - foreach(FILENAME ${FILENAMES}) - set(outfile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${FILENAME}${CMAKE_C_OUTPUT_EXTENSION}) - add_custom_command(OUTPUT ${outfile} - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/hrtf/${FILENAME}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/hrtf" - COMMAND "${CMAKE_LINKER}" -r -b binary -o "${outfile}" ${FILENAME} - COMMAND "${CMAKE_OBJCOPY}" --rename-section .data=.rodata,alloc,load,readonly,data,contents "${outfile}" "${outfile}" - COMMENT "Generating ${FILENAME}${CMAKE_C_OUTPUT_EXTENSION}" - VERBATIM - ) - set(ALC_OBJS ${ALC_OBJS} ${outfile}) - endforeach() - unset(outfile) - unset(FILENAMES) - endif() + MACRO(make_hrtf_header FILENAME VARNAME) + SET(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}") + SET(outfile "${OpenAL_BINARY_DIR}/${FILENAME}.h") + + ADD_CUSTOM_COMMAND(OUTPUT "${outfile}" + COMMAND "${BIN2H_COMMAND}" "${infile}" "${outfile}" ${VARNAME} + DEPENDS native-tools "${infile}" + VERBATIM + ) + SET(ALC_OBJS ${ALC_OBJS} "${outfile}") + ENDMACRO() + + make_hrtf_header(default-44100.mhr "hrtf_default_44100") + make_hrtf_header(default-48000.mhr "hrtf_default_48000") endif() +ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h" + COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h" + DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c" + VERBATIM +) +SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h") + IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL) add_subdirectory(utils/alsoft-config) ENDIF() IF(ALSOFT_EXAMPLES) - FIND_PACKAGE(SDL2) + IF(NOT SDL2_FOUND) + FIND_PACKAGE(SDL2) + ENDIF() IF(SDL2_FOUND) FIND_PACKAGE(SDL_sound) - IF(SDL_SOUND_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) - ENDIF() FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE) - IF(FFMPEG_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS}) - ENDIF() ENDIF() ENDIF() -IF(LIBTYPE STREQUAL "STATIC") - ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC) - SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS}) +IF(NOT WIN32) + SET(LIBNAME "openal") +ELSE() + SET(LIBNAME "OpenAL32") ENDIF() # Needed for openal.pc.in @@ -1158,6 +1307,20 @@ SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") SET(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") SET(PACKAGE_VERSION "${LIB_VERSION}") +SET(PKG_CONFIG_CFLAGS ) +SET(PKG_CONFIG_PRIVATE_LIBS ) +IF(LIBTYPE STREQUAL "STATIC") + SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC) + FOREACH(FLAG ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB}) + # If this is already a linker flag, or is a full path+file, add it + # as-is. Otherwise, it's a name intended to be dressed as -lname. + IF(FLAG MATCHES "^-.*" OR EXISTS "${FLAG}") + SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} ${FLAG}") + ELSE() + SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${FLAG}") + ENDIF() + ENDFOREACH() +ENDIF() # End configuration CONFIGURE_FILE( @@ -1168,89 +1331,113 @@ CONFIGURE_FILE( "${OpenAL_BINARY_DIR}/openal.pc" @ONLY) -# Build a common library with reusable helpers + +# Add a static library with common functions used by multiple targets ADD_LIBRARY(common STATIC ${COMMON_OBJS}) -SET_PROPERTY(TARGET common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) -IF(NOT LIBTYPE STREQUAL "STATIC") - SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE) -ENDIF() +TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS}) +TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS}) + + +UNSET(HAS_ROUTER) +SET(IMPL_TARGET OpenAL) +SET(COMMON_LIB ) +SET(SUBSYS_FLAG ) # Build main library IF(LIBTYPE STREQUAL "STATIC") - ADD_LIBRARY(${LIBNAME} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) + SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC) + IF(WIN32 AND ALSOFT_NO_UID_DEFS) + SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS) + ENDIF() + ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) ELSE() - ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS}) -ENDIF() -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES) -IF(WIN32 AND ALSOFT_NO_UID_DEFS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS) -ENDIF() -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") -IF(HAVE_ALSA) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_OSS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_SOLARIS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_SNDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_QSA) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_DSOUND) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_PORTAUDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_PULSEAUDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_JACK) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS}) -ENDIF() -SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION} - SOVERSION ${LIB_MAJOR_VERSION}) -IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "") + # Make sure to compile the common code with PIC, since it'll be linked into + # shared libs that needs it. + SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE) + SET(COMMON_LIB common) - IF(MINGW AND ALSOFT_BUILD_IMPORT_LIB) - FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable") - FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable") - IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE) - MESSAGE(STATUS "") - IF(NOT SED_EXECUTABLE) - MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation") - ENDIF() - IF(NOT DLLTOOL_EXECUTABLE) - MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation") - ENDIF() - ELSE() - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBNAME}.def") - ADD_CUSTOM_COMMAND(TARGET ${LIBNAME} POST_BUILD - COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" ${LIBNAME}.def - COMMAND "${DLLTOOL_EXECUTABLE}" -d ${LIBNAME}.def -l ${LIBNAME}.lib -D ${LIBNAME}.dll - COMMENT "Stripping ordinals from ${LIBNAME}.def and generating ${LIBNAME}.lib..." - VERBATIM - ) + IF(WIN32) + IF(MSVC) + SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS") + ELSEIF(CMAKE_COMPILER_IS_GNUCC) + SET(SUBSYS_FLAG ${SUBSYS_FLAG} "-mwindows") ENDIF() ENDIF() + + IF(WIN32 AND ALSOFT_BUILD_ROUTER) + ADD_LIBRARY(OpenAL SHARED router/router.c router/router.h router/alc.c router/al.c) + TARGET_COMPILE_DEFINITIONS(OpenAL + PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${LINKER_FLAGS} ${COMMON_LIB}) + SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "") + SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME}) + IF(TARGET build_version) + ADD_DEPENDENCIES(OpenAL build_version) + ENDIF() + SET(HAS_ROUTER 1) + + SET(LIBNAME "soft_oal") + SET(IMPL_TARGET soft_oal) + ENDIF() + + ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS}) + IF(WIN32) + SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "") + ENDIF() +ENDIF() +SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME} + VERSION ${LIB_VERSION} + SOVERSION ${LIB_MAJOR_VERSION} +) +TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET} + PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS}) +TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET} + PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS}) +TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS}) +TARGET_LINK_LIBRARIES(${IMPL_TARGET} + PRIVATE ${LINKER_FLAGS} ${COMMON_LIB} ${EXTRA_LIBS} ${MATH_LIB}) +IF(TARGET build_version) + ADD_DEPENDENCIES(${IMPL_TARGET} build_version) +ENDIF() + +IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC") + FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable") + FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable") + IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE) + MESSAGE(STATUS "") + IF(NOT SED_EXECUTABLE) + MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation") + ENDIF() + IF(NOT DLLTOOL_EXECUTABLE) + MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation") + ENDIF() + ELSE() + SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS + " -Wl,--output-def,OpenAL32.def") + ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD + COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def + COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll + COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..." + VERBATIM + ) + ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS}) - IF(ALSOFT_INSTALL) - # Add an install target here - INSTALL(TARGETS ${LIBNAME} + INSTALL(TARGETS OpenAL EXPORT OpenAL RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL ) + EXPORT(TARGETS OpenAL + NAMESPACE OpenAL:: + FILE OpenALConfig.cmake) + INSTALL(EXPORT OpenAL + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL + NAMESPACE OpenAL:: + FILE OpenALConfig.cmake) INSTALL(FILES include/AL/al.h include/AL/alc.h include/AL/alext.h @@ -1261,9 +1448,19 @@ IF(ALSOFT_INSTALL) ) INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + IF(TARGET soft_oal) + INSTALL(TARGETS soft_oal + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + ENDIF() ENDIF() +if(HAS_ROUTER) + message(STATUS "") + message(STATUS "Building DLL router") +endif() + MESSAGE(STATUS "") MESSAGE(STATUS "Building OpenAL with support for the following backends:") MESSAGE(STATUS " ${BACKENDS}") @@ -1309,6 +1506,7 @@ IF(ALSOFT_AMBDEC_PRESETS) INSTALL(FILES presets/3D7.1.ambdec presets/hexagon.ambdec presets/itu5.1.ambdec + presets/itu5.1-nocenter.ambdec presets/rectangle.ambdec presets/square.ambdec presets/presets.txt @@ -1320,23 +1518,22 @@ ENDIF() IF(ALSOFT_UTILS) ADD_EXECUTABLE(openal-info utils/openal-info.c) - SET_PROPERTY(TARGET openal-info APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - TARGET_LINK_LIBRARIES(openal-info ${LIBNAME}) + TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL) - ADD_EXECUTABLE(makehrtf utils/makehrtf.c) - SET_PROPERTY(TARGET makehrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - IF(HAVE_LIBM) - TARGET_LINK_LIBRARIES(makehrtf m) + SET(MAKEHRTF_SRCS utils/makehrtf.c) + IF(NOT HAVE_GETOPT) + SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h) ENDIF() - - ADD_EXECUTABLE(bsincgen utils/bsincgen.c) - SET_PROPERTY(TARGET bsincgen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS}) + TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS}) IF(HAVE_LIBM) - TARGET_LINK_LIBRARIES(bsincgen m) + TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m) ENDIF() IF(ALSOFT_INSTALL) - INSTALL(TARGETS openal-info makehrtf bsincgen + INSTALL(TARGETS openal-info makehrtf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -1351,12 +1548,12 @@ IF(ALSOFT_UTILS) ENDIF() IF(ALSOFT_TESTS) - ADD_LIBRARY(test-common STATIC examples/common/alhelpers.c) - SET_PROPERTY(TARGET test-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + SET(TEST_COMMON_OBJS examples/common/alhelpers.c) - ADD_EXECUTABLE(altonegen examples/altonegen.c) - TARGET_LINK_LIBRARIES(altonegen test-common ${LIBNAME}) - SET_PROPERTY(TARGET altonegen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS}) + TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB}) IF(ALSOFT_INSTALL) INSTALL(TARGETS altonegen @@ -1371,86 +1568,134 @@ IF(ALSOFT_TESTS) ENDIF() IF(ALSOFT_EXAMPLES) - IF(SDL2_FOUND AND SDL_SOUND_FOUND) - ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c - examples/common/sdl_sound.c) - SET_PROPERTY(TARGET ex-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET ex-common APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + ADD_EXECUTABLE(alrecord examples/alrecord.c) + TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL) - ADD_EXECUTABLE(alstream examples/alstream.c) - TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alstream APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + IF(ALSOFT_INSTALL) + INSTALL(TARGETS alrecord + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + ENDIF() - ADD_EXECUTABLE(alreverb examples/alreverb.c) - TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alreverb APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + MESSAGE(STATUS "Building example programs") - ADD_EXECUTABLE(allatency examples/allatency.c) - TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET allatency APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + IF(SDL2_FOUND) + IF(SDL_SOUND_FOUND) + # Add a static library with common functions used by multiple targets + ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c) + TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS}) - ADD_EXECUTABLE(alloopback examples/alloopback.c) - TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alloopback APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + ADD_EXECUTABLE(alplay examples/alplay.c) + TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alplay + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alplay + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) - ADD_EXECUTABLE(alhrtf examples/alhrtf.c) - TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alhrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alhrtf APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + ADD_EXECUTABLE(alstream examples/alstream.c) + TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alstream + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alstream + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) - IF(ALSOFT_INSTALL) - INSTALL(TARGETS alstream alreverb allatency alloopback alhrtf - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + ADD_EXECUTABLE(alreverb examples/alreverb.c) + TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alreverb + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alreverb + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) + + ADD_EXECUTABLE(almultireverb examples/almultireverb.c) + TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(almultireverb + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(almultireverb + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL ${MATH_LIB}) + + ADD_EXECUTABLE(allatency examples/allatency.c) + TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(allatency + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(allatency + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) + + ADD_EXECUTABLE(alloopback examples/alloopback.c) + TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alloopback + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alloopback + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL ${MATH_LIB}) + + ADD_EXECUTABLE(alhrtf examples/alhrtf.c) + TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alhrtf + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alhrtf + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL ${MATH_LIB}) + + IF(ALSOFT_INSTALL) + INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + ENDIF() + + MESSAGE(STATUS "Building SDL_sound example programs") ENDIF() SET(FFVER_OK FALSE) IF(FFMPEG_FOUND) SET(FFVER_OK TRUE) - IF(AVFORMAT_VERSION VERSION_LESS "55.33.100") - MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 55.33.100)") + IF(AVFORMAT_VERSION VERSION_LESS "57.56.101") + MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)") SET(FFVER_OK FALSE) ENDIF() - IF(AVCODEC_VERSION VERSION_LESS "55.52.102") - MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 55.52.102)") + IF(AVCODEC_VERSION VERSION_LESS "57.64.101") + MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)") SET(FFVER_OK FALSE) ENDIF() - IF(AVUTIL_VERSION VERSION_LESS "52.66.100") - MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 52.66.100)") + IF(AVUTIL_VERSION VERSION_LESS "55.34.101") + MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)") SET(FFVER_OK FALSE) ENDIF() - IF(SWSCALE_VERSION VERSION_LESS "2.5.102") - MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 2.5.102)") + IF(SWSCALE_VERSION VERSION_LESS "4.2.100") + MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)") SET(FFVER_OK FALSE) ENDIF() - IF(SWRESAMPLE_VERSION VERSION_LESS "0.18.100") - MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 0.18.100)") + IF(SWRESAMPLE_VERSION VERSION_LESS "2.3.100") + MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)") SET(FFVER_OK FALSE) ENDIF() ENDIF() - IF(FFVER_OK AND NOT MSVC) - ADD_EXECUTABLE(alffplay examples/alffplay.c) - TARGET_LINK_LIBRARIES(alffplay common ex-common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES}) - SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${FFMPEG_INCLUDE_DIRS}) + IF(FFVER_OK) + ADD_EXECUTABLE(alffplay examples/alffplay.cpp) + TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alffplay + PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}) + TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alffplay + PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} common OpenAL) IF(ALSOFT_INSTALL) INSTALL(TARGETS alffplay @@ -1459,9 +1704,7 @@ IF(ALSOFT_EXAMPLES) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ENDIF() - MESSAGE(STATUS "Building SDL and FFmpeg example programs") - ELSE() - MESSAGE(STATUS "Building SDL example programs") + MESSAGE(STATUS "Building SDL+FFmpeg example programs") ENDIF() MESSAGE(STATUS "") ENDIF() diff --git a/Engine/lib/openal-soft/ChangeLog b/Engine/lib/openal-soft/ChangeLog index 189872cf7..a7aec6388 100644 --- a/Engine/lib/openal-soft/ChangeLog +++ b/Engine/lib/openal-soft/ChangeLog @@ -1,3 +1,168 @@ +openal-soft-1.19.0: + + Implemented the ALC_SOFT_device_clock extension. + + Implemented the Pitch Shifter effect. + + Fixed compiling on FreeBSD systems that use freebsd-lib 9.1. + + Fixed compiling on NetBSD. + + Fixed the reverb effect's density scale and panning parameters. + + Fixed use of the WASAPI backend with certain games, which caused odd COM + initialization errors. + + Increased the number of virtual channels for decoding Ambisonics to HRTF + output. + + Replaced the 4-point Sinc resampler with a more efficient cubic resampler. + + Renamed the MMDevAPI backend to WASAPI. + + Added support fot 24-bit, dual-ear HRTF data sets. The built-in data set + has been updated to 24-bit. + + Added a 24- to 48-point band-limited Sinc resampler. + + Added an SDL2 playback backend. Disabled by default to avoid a dependency + on SDL2. + + Improved the performance and quality of the Chorus and Flanger effects. + + Improved the efficiency of the band-limited Sinc resampler. + + Improved the Sinc resampler's transition band to avoid over-attenuating + higher frequencies. + + Improved the performance of some filter operations. + + Improved the efficiency of object ID lookups. + + Improved the efficienty of internal voice/source synchronization. + + Improved AL call error logging with contextualized messages. + + Removed the reverb effect's modulation stage. Due to the lack of reference + for its intended behavior and strength. + +openal-soft-1.18.2: + + Fixed resetting the FPU rounding mode after certain function calls on + Windows. + + Fixed use of SSE intrinsics when building with Clang on Windows. + + Fixed a crash with the JACK backend when using JACK1. + + Fixed use of pthread_setnane_np on NetBSD. + + Fixed building on FreeBSD with an older freebsd-lib. + + OSS now links with libossaudio if found at build time (for NetBSD). + +openal-soft-1.18.1: + + Fixed an issue where resuming a source might not restart playing it. + + Fixed PulseAudio playback when the configured stream length is much less + than the requested length. + + Fixed MMDevAPI capture with sample rates not matching the backing device. + + Fixed int32 output for the Wave Writer. + + Fixed enumeration of OSS devices that are missing device files. + + Added correct retrieval of the executable's path on FreeBSD. + + Added a config option to specify the dithering depth. + + Added a 5.1 decoder preset that excludes front-center output. + +openal-soft-1.18.0: + + Implemented the AL_EXT_STEREO_ANGLES and AL_EXT_SOURCE_RADIUS extensions. + + Implemented the AL_SOFT_gain_clamp_ex, AL_SOFT_source_resampler, + AL_SOFT_source_spatialize, and ALC_SOFT_output_limiter extensions. + + Implemented 3D processing for some effects. Currently implemented for + Reverb, Compressor, Equalizer, and Ring Modulator. + + Implemented 2-channel UHJ output encoding. This needs to be enabled with a + config option to be used. + + Implemented dual-band processing for high-quality ambisonic decoding. + + Implemented distance-compensation for surround sound output. + + Implemented near-field emulation and compensation with ambisonic rendering. + Currently only applies when using the high-quality ambisonic decoder or + ambisonic output, with appropriate config options. + + Implemented an output limiter to reduce the amount of distortion from + clipping. + + Implemented dithering for 8-bit and 16-bit output. + + Implemented a config option to select a preferred HRTF. + + Implemented a run-time check for NEON extensions using /proc/cpuinfo. + + Implemented experimental capture support for the OpenSL backend. + + Fixed building on compilers with NEON support but don't default to having + NEON enabled. + + Fixed support for JACK on Windows. + + Fixed starting a source while alcSuspendContext is in effect. + + Fixed detection of headsets as headphones, with MMDevAPI. + + Added support for AmbDec config files, for custom ambisonic decoder + configurations. Version 3 files only. + + Added backend-specific options to alsoft-config. + + Added first-, second-, and third-order ambisonic output formats. Currently + only works with backends that don't rely on channel labels, like JACK, + ALSA, and OSS. + + Added a build option to embed the default HRTFs into the lib. + + Added AmbDec presets to enable high-quality ambisonic decoding. + + Added an AmbDec preset for 3D7.1 speaker setups. + + Added documentation regarding Ambisonics, 3D7.1, AmbDec config files, and + the provided ambdec presets. + + Added the ability for MMDevAPI to open devices given a Device ID or GUID + string. + + Added an option to the example apps to open a specific device. + + Increased the maximum auxiliary send limit to 16 (up from 4). Requires + requesting them with the ALC_MAX_AUXILIARY_SENDS context creation + attribute. + + Increased the default auxiliary effect slot count to 64 (up from 4). + + Reduced the default period count to 3 (down from 4). + + Slightly improved automatic naming for enumerated HRTFs. + + Improved B-Format decoding with HRTF output. + + Improved internal property handling for better batching behavior. + + Improved performance of certain filter uses. + + Removed support for the AL_SOFT_buffer_samples and AL_SOFT_buffer_sub_data + extensions. Due to conflicts with AL_EXT_SOURCE_RADIUS. + openal-soft-1.17.2: Implemented device enumeration for OSSv4. diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h b/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h index 70fcac5c3..bb9aef590 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h @@ -4,6 +4,7 @@ #include "alMain.h" #include "alEffect.h" +#include "atomic.h" #include "align.h" #ifdef __cplusplus @@ -18,7 +19,7 @@ typedef struct ALeffectState { const struct ALeffectStateVtable *vtbl; ALfloat (*OutBuffer)[BUFFERSIZE]; - ALuint OutChannels; + ALsizei OutChannels; } ALeffectState; void ALeffectState_Construct(ALeffectState *state); @@ -28,17 +29,22 @@ struct ALeffectStateVtable { void (*const Destruct)(ALeffectState *state); ALboolean (*const deviceUpdate)(ALeffectState *state, ALCdevice *device); - void (*const update)(ALeffectState *state, const ALCdevice *device, const struct ALeffectslot *slot, const union ALeffectProps *props); - void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALuint numChannels); + void (*const update)(ALeffectState *state, const ALCcontext *context, const struct ALeffectslot *slot, const union ALeffectProps *props); + void (*const process)(ALeffectState *state, ALsizei samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALsizei numChannels); void (*const Delete)(void *ptr); }; +/* Small hack to use a pointer-to-array types as a normal argument type. + * Shouldn't be used directly. + */ +typedef ALfloat ALfloatBUFFERSIZE[BUFFERSIZE]; + #define DEFINE_ALEFFECTSTATE_VTABLE(T) \ DECLARE_THUNK(T, ALeffectState, void, Destruct) \ DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \ -DECLARE_THUNK3(T, ALeffectState, void, update, const ALCdevice*, const ALeffectslot*, const ALeffectProps*) \ -DECLARE_THUNK4(T, ALeffectState, void, process, ALuint, const ALfloatBUFFERSIZE*restrict, ALfloatBUFFERSIZE*restrict, ALuint) \ +DECLARE_THUNK3(T, ALeffectState, void, update, const ALCcontext*, const ALeffectslot*, const ALeffectProps*) \ +DECLARE_THUNK4(T, ALeffectState, void, process, ALsizei, const ALfloatBUFFERSIZE*restrict, ALfloatBUFFERSIZE*restrict, ALsizei) \ static void T##_ALeffectState_Delete(void *ptr) \ { return T##_Delete(STATIC_UPCAST(T, ALeffectState, (ALeffectState*)ptr)); } \ \ @@ -53,43 +59,48 @@ static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \ } -struct ALeffectStateFactoryVtable; +struct EffectStateFactoryVtable; -typedef struct ALeffectStateFactory { - const struct ALeffectStateFactoryVtable *vtbl; -} ALeffectStateFactory; +typedef struct EffectStateFactory { + const struct EffectStateFactoryVtable *vtab; +} EffectStateFactory; -struct ALeffectStateFactoryVtable { - ALeffectState *(*const create)(ALeffectStateFactory *factory); +struct EffectStateFactoryVtable { + ALeffectState *(*const create)(EffectStateFactory *factory); }; +#define EffectStateFactory_create(x) ((x)->vtab->create((x))) -#define DEFINE_ALEFFECTSTATEFACTORY_VTABLE(T) \ -DECLARE_THUNK(T, ALeffectStateFactory, ALeffectState*, create) \ +#define DEFINE_EFFECTSTATEFACTORY_VTABLE(T) \ +DECLARE_THUNK(T, EffectStateFactory, ALeffectState*, create) \ \ -static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = { \ - T##_ALeffectStateFactory_create, \ +static const struct EffectStateFactoryVtable T##_EffectStateFactory_vtable = { \ + T##_EffectStateFactory_create, \ } #define MAX_EFFECT_CHANNELS (4) -struct ALeffectslotProps { - ATOMIC(ALfloat) Gain; - ATOMIC(ALboolean) AuxSendAuto; +struct ALeffectslotArray { + ALsizei count; + struct ALeffectslot *slot[]; +}; - ATOMIC(ALenum) Type; + +struct ALeffectslotProps { + ALfloat Gain; + ALboolean AuxSendAuto; + + ALenum Type; ALeffectProps Props; - ATOMIC(ALeffectState*) State; + ALeffectState *State; ATOMIC(struct ALeffectslotProps*) next; }; typedef struct ALeffectslot { - ALboolean NeedsUpdate; - ALfloat Gain; ALboolean AuxSendAuto; @@ -100,81 +111,70 @@ typedef struct ALeffectslot { ALeffectState *State; } Effect; + ATOMIC_FLAG PropsClean; + RefCount ref; ATOMIC(struct ALeffectslotProps*) Update; - ATOMIC(struct ALeffectslotProps*) FreeList; struct { ALfloat Gain; ALboolean AuxSendAuto; ALenum EffectType; + ALeffectProps EffectProps; ALeffectState *EffectState; ALfloat RoomRolloff; /* Added to the source's room rolloff, not multiplied. */ ALfloat DecayTime; + ALfloat DecayLFRatio; + ALfloat DecayHFRatio; + ALboolean DecayHFLimit; ALfloat AirAbsorptionGainHF; } Params; /* Self ID */ ALuint id; - ALuint NumChannels; + ALsizei NumChannels; BFChannelConfig ChanMap[MAX_EFFECT_CHANNELS]; /* Wet buffer configuration is ACN channel order with N3D scaling: * * Channel 0 is the unattenuated mono signal. - * * Channel 1 is OpenAL -X - * * Channel 2 is OpenAL Y - * * Channel 3 is OpenAL -Z + * * Channel 1 is OpenAL -X * sqrt(3) + * * Channel 2 is OpenAL Y * sqrt(3) + * * Channel 3 is OpenAL -Z * sqrt(3) * Consequently, effects that only want to work with mono input can use * channel 0 by itself. Effects that want multichannel can process the * ambisonics signal and make a B-Format pan (ComputeFirstOrderGains) for * first-order device output (FOAOut). */ alignas(16) ALfloat WetBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE]; - - ATOMIC(struct ALeffectslot*) next; } ALeffectslot; -inline void LockEffectSlotsRead(ALCcontext *context) -{ LockUIntMapRead(&context->EffectSlotMap); } -inline void UnlockEffectSlotsRead(ALCcontext *context) -{ UnlockUIntMapRead(&context->EffectSlotMap); } -inline void LockEffectSlotsWrite(ALCcontext *context) -{ LockUIntMapWrite(&context->EffectSlotMap); } -inline void UnlockEffectSlotsWrite(ALCcontext *context) -{ UnlockUIntMapWrite(&context->EffectSlotMap); } - -inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) -{ return (struct ALeffectslot*)LookupUIntMapKeyNoLock(&context->EffectSlotMap, id); } -inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id) -{ return (struct ALeffectslot*)RemoveUIntMapKeyNoLock(&context->EffectSlotMap, id); } - ALenum InitEffectSlot(ALeffectslot *slot); void DeinitEffectSlot(ALeffectslot *slot); -void UpdateEffectSlotProps(ALeffectslot *slot); +void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context); void UpdateAllEffectSlotProps(ALCcontext *context); ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context); -ALeffectStateFactory *ALnullStateFactory_getFactory(void); -ALeffectStateFactory *ALreverbStateFactory_getFactory(void); -ALeffectStateFactory *ALchorusStateFactory_getFactory(void); -ALeffectStateFactory *ALcompressorStateFactory_getFactory(void); -ALeffectStateFactory *ALdistortionStateFactory_getFactory(void); -ALeffectStateFactory *ALechoStateFactory_getFactory(void); -ALeffectStateFactory *ALequalizerStateFactory_getFactory(void); -ALeffectStateFactory *ALflangerStateFactory_getFactory(void); -ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void); +EffectStateFactory *NullStateFactory_getFactory(void); +EffectStateFactory *ReverbStateFactory_getFactory(void); +EffectStateFactory *ChorusStateFactory_getFactory(void); +EffectStateFactory *CompressorStateFactory_getFactory(void); +EffectStateFactory *DistortionStateFactory_getFactory(void); +EffectStateFactory *EchoStateFactory_getFactory(void); +EffectStateFactory *EqualizerStateFactory_getFactory(void); +EffectStateFactory *FlangerStateFactory_getFactory(void); +EffectStateFactory *ModulatorStateFactory_getFactory(void); +EffectStateFactory *PshifterStateFactory_getFactory(void); -ALeffectStateFactory *ALdedicatedStateFactory_getFactory(void); +EffectStateFactory *DedicatedStateFactory_getFactory(void); -ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *effect); +ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect); -void InitEffectFactoryMap(void); -void DeinitEffectFactoryMap(void); +void ALeffectState_DecRef(ALeffectState *state); #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h b/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h index e99af050a..fbe3e6e5e 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h @@ -1,7 +1,13 @@ #ifndef _AL_BUFFER_H_ #define _AL_BUFFER_H_ -#include "alMain.h" +#include "AL/alc.h" +#include "AL/al.h" +#include "AL/alext.h" + +#include "inprogext.h" +#include "atomic.h" +#include "rwlock.h" #ifdef __cplusplus extern "C" { @@ -9,36 +15,30 @@ extern "C" { /* User formats */ enum UserFmtType { - UserFmtByte = AL_BYTE_SOFT, - UserFmtUByte = AL_UNSIGNED_BYTE_SOFT, - UserFmtShort = AL_SHORT_SOFT, - UserFmtUShort = AL_UNSIGNED_SHORT_SOFT, - UserFmtInt = AL_INT_SOFT, - UserFmtUInt = AL_UNSIGNED_INT_SOFT, - UserFmtFloat = AL_FLOAT_SOFT, - UserFmtDouble = AL_DOUBLE_SOFT, - UserFmtByte3 = AL_BYTE3_SOFT, - UserFmtUByte3 = AL_UNSIGNED_BYTE3_SOFT, - UserFmtMulaw = AL_MULAW_SOFT, - UserFmtAlaw = 0x10000000, + UserFmtUByte, + UserFmtShort, + UserFmtFloat, + UserFmtDouble, + UserFmtMulaw, + UserFmtAlaw, UserFmtIMA4, UserFmtMSADPCM, }; enum UserFmtChannels { - UserFmtMono = AL_MONO_SOFT, - UserFmtStereo = AL_STEREO_SOFT, - UserFmtRear = AL_REAR_SOFT, - UserFmtQuad = AL_QUAD_SOFT, - UserFmtX51 = AL_5POINT1_SOFT, /* (WFX order) */ - UserFmtX61 = AL_6POINT1_SOFT, /* (WFX order) */ - UserFmtX71 = AL_7POINT1_SOFT, /* (WFX order) */ - UserFmtBFormat2D = AL_BFORMAT2D_SOFT, /* WXY */ - UserFmtBFormat3D = AL_BFORMAT3D_SOFT, /* WXYZ */ + UserFmtMono, + UserFmtStereo, + UserFmtRear, + UserFmtQuad, + UserFmtX51, /* (WFX order) */ + UserFmtX61, /* (WFX order) */ + UserFmtX71, /* (WFX order) */ + UserFmtBFormat2D, /* WXY */ + UserFmtBFormat3D, /* WXYZ */ }; -ALuint BytesFromUserFmt(enum UserFmtType type); -ALuint ChannelsFromUserFmt(enum UserFmtChannels chans); -inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type) +ALsizei BytesFromUserFmt(enum UserFmtType type); +ALsizei ChannelsFromUserFmt(enum UserFmtChannels chans); +inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type) { return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type); } @@ -46,9 +46,12 @@ inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType /* Storable formats */ enum FmtType { - FmtByte = UserFmtByte, - FmtShort = UserFmtShort, - FmtFloat = UserFmtFloat, + FmtUByte = UserFmtUByte, + FmtShort = UserFmtShort, + FmtFloat = UserFmtFloat, + FmtDouble = UserFmtDouble, + FmtMulaw = UserFmtMulaw, + FmtAlaw = UserFmtAlaw, }; enum FmtChannels { FmtMono = UserFmtMono, @@ -63,9 +66,9 @@ enum FmtChannels { }; #define MAX_INPUT_CHANNELS (8) -ALuint BytesFromFmt(enum FmtType type); -ALuint ChannelsFromFmt(enum FmtChannels chans); -inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) +ALsizei BytesFromFmt(enum FmtType type); +ALsizei ChannelsFromFmt(enum FmtChannels chans); +inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) { return ChannelsFromFmt(chans) * BytesFromFmt(type); } @@ -74,53 +77,35 @@ inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) typedef struct ALbuffer { ALvoid *data; - ALsizei Frequency; - ALenum Format; - ALsizei SampleLen; + ALsizei Frequency; + ALbitfieldSOFT Access; + ALsizei SampleLen; enum FmtChannels FmtChannels; enum FmtType FmtType; - ALuint BytesAlloc; + ALsizei BytesAlloc; - enum UserFmtChannels OriginalChannels; - enum UserFmtType OriginalType; - ALsizei OriginalSize; - ALsizei OriginalAlign; + enum UserFmtType OriginalType; + ALsizei OriginalSize; + ALsizei OriginalAlign; - ALsizei LoopStart; - ALsizei LoopEnd; + ALsizei LoopStart; + ALsizei LoopEnd; ATOMIC(ALsizei) UnpackAlign; ATOMIC(ALsizei) PackAlign; + ALbitfieldSOFT MappedAccess; + ALsizei MappedOffset; + ALsizei MappedSize; + /* Number of times buffer was attached to a source (deletion can only occur when 0) */ RefCount ref; - RWLock lock; - /* Self ID */ ALuint id; } ALbuffer; -ALbuffer *NewBuffer(ALCcontext *context); -void DeleteBuffer(ALCdevice *device, ALbuffer *buffer); - -ALenum LoadData(ALbuffer *buffer, ALuint freq, ALenum NewFormat, ALsizei frames, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data, ALsizei align, ALboolean storesrc); - -inline void LockBuffersRead(ALCdevice *device) -{ LockUIntMapRead(&device->BufferMap); } -inline void UnlockBuffersRead(ALCdevice *device) -{ UnlockUIntMapRead(&device->BufferMap); } -inline void LockBuffersWrite(ALCdevice *device) -{ LockUIntMapWrite(&device->BufferMap); } -inline void UnlockBuffersWrite(ALCdevice *device) -{ UnlockUIntMapWrite(&device->BufferMap); } - -inline struct ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) -{ return (struct ALbuffer*)LookupUIntMapKeyNoLock(&device->BufferMap, id); } -inline struct ALbuffer *RemoveBuffer(ALCdevice *device, ALuint id) -{ return (struct ALbuffer*)RemoveUIntMapKeyNoLock(&device->BufferMap, id); } - ALvoid ReleaseALBuffers(ALCdevice *device); #ifdef __cplusplus diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h b/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h index b97b01479..50b64ee1d 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h @@ -10,23 +10,32 @@ extern "C" { struct ALeffect; enum { - EAXREVERB = 0, - REVERB, - CHORUS, - COMPRESSOR, - DISTORTION, - ECHO, - EQUALIZER, - FLANGER, - MODULATOR, - DEDICATED, + EAXREVERB_EFFECT = 0, + REVERB_EFFECT, + CHORUS_EFFECT, + COMPRESSOR_EFFECT, + DISTORTION_EFFECT, + ECHO_EFFECT, + EQUALIZER_EFFECT, + FLANGER_EFFECT, + MODULATOR_EFFECT, + PSHIFTER_EFFECT, + DEDICATED_EFFECT, MAX_EFFECTS }; extern ALboolean DisabledEffects[MAX_EFFECTS]; extern ALfloat ReverbBoost; -extern ALboolean EmulateEAXReverb; + +struct EffectList { + const char name[16]; + int type; + ALenum val; +}; +#define EFFECTLIST_SIZE 12 +extern const struct EffectList EffectList[EFFECTLIST_SIZE]; + struct ALeffectVtable { void (*const setParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint val); @@ -58,6 +67,7 @@ extern const struct ALeffectVtable ALequalizer_vtable; extern const struct ALeffectVtable ALflanger_vtable; extern const struct ALeffectVtable ALmodulator_vtable; extern const struct ALeffectVtable ALnull_vtable; +extern const struct ALeffectVtable ALpshifter_vtable; extern const struct ALeffectVtable ALdedicated_vtable; @@ -98,7 +108,7 @@ typedef union ALeffectProps { ALfloat Depth; ALfloat Feedback; ALfloat Delay; - } Chorus; + } Chorus; /* Also Flanger */ struct { ALboolean OnOff; @@ -135,21 +145,17 @@ typedef union ALeffectProps { ALfloat HighGain; } Equalizer; - struct { - ALint Waveform; - ALint Phase; - ALfloat Rate; - ALfloat Depth; - ALfloat Feedback; - ALfloat Delay; - } Flanger; - struct { ALfloat Frequency; ALfloat HighPassCutoff; ALint Waveform; } Modulator; + struct { + ALint CoarseTune; + ALint FineTune; + } Pshifter; + struct { ALfloat Gain; } Dedicated; @@ -161,33 +167,27 @@ typedef struct ALeffect { ALeffectProps Props; - const struct ALeffectVtable *vtbl; + const struct ALeffectVtable *vtab; /* Self ID */ ALuint id; } ALeffect; - -inline void LockEffectsRead(ALCdevice *device) -{ LockUIntMapRead(&device->EffectMap); } -inline void UnlockEffectsRead(ALCdevice *device) -{ UnlockUIntMapRead(&device->EffectMap); } -inline void LockEffectsWrite(ALCdevice *device) -{ LockUIntMapWrite(&device->EffectMap); } -inline void UnlockEffectsWrite(ALCdevice *device) -{ UnlockUIntMapWrite(&device->EffectMap); } - -inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id) -{ return (struct ALeffect*)LookupUIntMapKeyNoLock(&device->EffectMap, id); } -inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id) -{ return (struct ALeffect*)RemoveUIntMapKeyNoLock(&device->EffectMap, id); } +#define ALeffect_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) +#define ALeffect_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) +#define ALeffect_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) +#define ALeffect_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v)) +#define ALeffect_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v)) +#define ALeffect_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v)) +#define ALeffect_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v)) +#define ALeffect_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v)) inline ALboolean IsReverbEffect(ALenum type) { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } -ALenum InitEffect(ALeffect *effect); -ALvoid ReleaseALEffects(ALCdevice *device); +void InitEffect(ALeffect *effect); +void ReleaseALEffects(ALCdevice *device); -ALvoid LoadReverbPreset(const char *name, ALeffect *effect); +void LoadReverbPreset(const char *name, ALeffect *effect); #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alError.h b/Engine/lib/openal-soft/OpenAL32/Include/alError.h index ab91d27b2..858f81de5 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alError.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alError.h @@ -2,6 +2,7 @@ #define _AL_ERROR_H_ #include "alMain.h" +#include "logging.h" #ifdef __cplusplus extern "C" { @@ -9,23 +10,18 @@ extern "C" { extern ALboolean TrapALError; -ALvoid alSetError(ALCcontext *Context, ALenum errorCode); +void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...) DECL_FORMAT(printf, 3, 4); -#define SET_ERROR_AND_RETURN(ctx, err) do { \ - alSetError((ctx), (err)); \ - return; \ -} while(0) - -#define SET_ERROR_AND_RETURN_VALUE(ctx, err, val) do { \ - alSetError((ctx), (err)); \ - return (val); \ -} while(0) - -#define SET_ERROR_AND_GOTO(ctx, err, lbl) do { \ - alSetError((ctx), (err)); \ +#define SETERR_GOTO(ctx, err, lbl, ...) do { \ + alSetError((ctx), (err), __VA_ARGS__); \ goto lbl; \ } while(0) +#define SETERR_RETURN(ctx, err, retval, ...) do { \ + alSetError((ctx), (err), __VA_ARGS__); \ + return retval; \ +} while(0) + #ifdef __cplusplus } #endif diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h b/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h index 1f7095bc6..2634d5e80 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h @@ -1,9 +1,8 @@ #ifndef _AL_FILTER_H_ #define _AL_FILTER_H_ -#include "alMain.h" - -#include "math_defs.h" +#include "AL/alc.h" +#include "AL/al.h" #ifdef __cplusplus extern "C" { @@ -13,90 +12,27 @@ extern "C" { #define HIGHPASSFREQREF (250.0f) -/* Filters implementation is based on the "Cookbook formulae for audio - * EQ biquad filter coefficients" by Robert Bristow-Johnson - * http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt - */ -/* Implementation note: For the shelf filters, the specified gain is for the - * reference frequency, which is the centerpoint of the transition band. This - * better matches EFX filter design. To set the gain for the shelf itself, use - * the square root of the desired linear gain (or halve the dB gain). - */ +struct ALfilter; -typedef enum ALfilterType { - /** EFX-style low-pass filter, specifying a gain and reference frequency. */ - ALfilterType_HighShelf, - /** EFX-style high-pass filter, specifying a gain and reference frequency. */ - ALfilterType_LowShelf, - /** Peaking filter, specifying a gain and reference frequency. */ - ALfilterType_Peaking, +typedef struct ALfilterVtable { + void (*const setParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val); + void (*const setParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals); + void (*const setParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val); + void (*const setParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals); - /** Low-pass cut-off filter, specifying a cut-off frequency. */ - ALfilterType_LowPass, - /** High-pass cut-off filter, specifying a cut-off frequency. */ - ALfilterType_HighPass, - /** Band-pass filter, specifying a center frequency. */ - ALfilterType_BandPass, -} ALfilterType; + void (*const getParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val); + void (*const getParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals); + void (*const getParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val); + void (*const getParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals); +} ALfilterVtable; -typedef struct ALfilterState { - ALfloat x[2]; /* History of two last input samples */ - ALfloat y[2]; /* History of two last output samples */ - ALfloat a1, a2; /* Transfer function coefficients "a" (a0 is pre-applied) */ - ALfloat b0, b1, b2; /* Transfer function coefficients "b" */ -} ALfilterState; -/* Currently only a C-based filter process method is implemented. */ -#define ALfilterState_process ALfilterState_processC - -/* Calculates the rcpQ (i.e. 1/Q) coefficient for shelving filters, using the - * reference gain and shelf slope parameter. - * 0 < gain - * 0 < slope <= 1 - */ -inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope) -{ - return sqrtf((gain + 1.0f/gain)*(1.0f/slope - 1.0f) + 2.0f); +#define DEFINE_ALFILTER_VTABLE(T) \ +const struct ALfilterVtable T##_vtable = { \ + T##_setParami, T##_setParamiv, \ + T##_setParamf, T##_setParamfv, \ + T##_getParami, T##_getParamiv, \ + T##_getParamf, T##_getParamfv, \ } -/* Calculates the rcpQ (i.e. 1/Q) coefficient for filters, using the frequency - * multiple (i.e. ref_freq / sampling_freq) and bandwidth. - * 0 < freq_mult < 0.5. - */ -inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth) -{ - ALfloat w0 = F_TAU * freq_mult; - return 2.0f*sinhf(logf(2.0f)/2.0f*bandwidth*w0/sinf(w0)); -} - -inline void ALfilterState_clear(ALfilterState *filter) -{ - filter->x[0] = 0.0f; - filter->x[1] = 0.0f; - filter->y[0] = 0.0f; - filter->y[1] = 0.0f; -} - -void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ); - -void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALuint numsamples); - -inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALuint numsamples) -{ - if(numsamples >= 2) - { - filter->x[1] = src[numsamples-2]; - filter->x[0] = src[numsamples-1]; - filter->y[1] = src[numsamples-2]; - filter->y[0] = src[numsamples-1]; - } - else if(numsamples == 1) - { - filter->x[1] = filter->x[0]; - filter->x[0] = src[0]; - filter->y[1] = filter->y[0]; - filter->y[0] = src[0]; - } -} - typedef struct ALfilter { // Filter type (AL_FILTER_NULL, ...) @@ -108,45 +44,21 @@ typedef struct ALfilter { ALfloat GainLF; ALfloat LFReference; - void (*SetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val); - void (*SetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals); - void (*SetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val); - void (*SetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals); - - void (*GetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val); - void (*GetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals); - void (*GetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val); - void (*GetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals); + const struct ALfilterVtable *vtab; /* Self ID */ ALuint id; } ALfilter; +#define ALfilter_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) +#define ALfilter_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) +#define ALfilter_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) +#define ALfilter_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v)) +#define ALfilter_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v)) +#define ALfilter_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v)) +#define ALfilter_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v)) +#define ALfilter_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v)) -#define ALfilter_SetParami(x, c, p, v) ((x)->SetParami((x),(c),(p),(v))) -#define ALfilter_SetParamiv(x, c, p, v) ((x)->SetParamiv((x),(c),(p),(v))) -#define ALfilter_SetParamf(x, c, p, v) ((x)->SetParamf((x),(c),(p),(v))) -#define ALfilter_SetParamfv(x, c, p, v) ((x)->SetParamfv((x),(c),(p),(v))) - -#define ALfilter_GetParami(x, c, p, v) ((x)->GetParami((x),(c),(p),(v))) -#define ALfilter_GetParamiv(x, c, p, v) ((x)->GetParamiv((x),(c),(p),(v))) -#define ALfilter_GetParamf(x, c, p, v) ((x)->GetParamf((x),(c),(p),(v))) -#define ALfilter_GetParamfv(x, c, p, v) ((x)->GetParamfv((x),(c),(p),(v))) - -inline void LockFiltersRead(ALCdevice *device) -{ LockUIntMapRead(&device->FilterMap); } -inline void UnlockFiltersRead(ALCdevice *device) -{ UnlockUIntMapRead(&device->FilterMap); } -inline void LockFiltersWrite(ALCdevice *device) -{ LockUIntMapWrite(&device->FilterMap); } -inline void UnlockFiltersWrite(ALCdevice *device) -{ UnlockUIntMapWrite(&device->FilterMap); } - -inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id) -{ return (struct ALfilter*)LookupUIntMapKeyNoLock(&device->FilterMap, id); } -inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id) -{ return (struct ALfilter*)RemoveUIntMapKeyNoLock(&device->FilterMap, id); } - -ALvoid ReleaseALFilters(ALCdevice *device); +void ReleaseALFilters(ALCdevice *device); #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alListener.h b/Engine/lib/openal-soft/OpenAL32/Include/alListener.h index b89a00e7a..0d80a8d72 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alListener.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alListener.h @@ -8,40 +8,40 @@ extern "C" { #endif -struct ALlistenerProps { - ATOMIC(ALfloat) Position[3]; - ATOMIC(ALfloat) Velocity[3]; - ATOMIC(ALfloat) Forward[3]; - ATOMIC(ALfloat) Up[3]; - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) MetersPerUnit; +struct ALcontextProps { + ALfloat DopplerFactor; + ALfloat DopplerVelocity; + ALfloat SpeedOfSound; + ALboolean SourceDistanceModel; + enum DistanceModel DistanceModel; + ALfloat MetersPerUnit; - ATOMIC(ALfloat) DopplerFactor; - ATOMIC(ALfloat) DopplerVelocity; - ATOMIC(ALfloat) SpeedOfSound; - ATOMIC(ALboolean) SourceDistanceModel; - ATOMIC(enum DistanceModel) DistanceModel; + ATOMIC(struct ALcontextProps*) next; +}; + +struct ALlistenerProps { + ALfloat Position[3]; + ALfloat Velocity[3]; + ALfloat Forward[3]; + ALfloat Up[3]; + ALfloat Gain; ATOMIC(struct ALlistenerProps*) next; }; typedef struct ALlistener { - volatile ALfloat Position[3]; - volatile ALfloat Velocity[3]; - volatile ALfloat Forward[3]; - volatile ALfloat Up[3]; - volatile ALfloat Gain; - volatile ALfloat MetersPerUnit; + alignas(16) ALfloat Position[3]; + ALfloat Velocity[3]; + ALfloat Forward[3]; + ALfloat Up[3]; + ALfloat Gain; + + ATOMIC_FLAG PropsClean; /* Pointer to the most recent property values that are awaiting an update. */ ATOMIC(struct ALlistenerProps*) Update; - /* A linked list of unused property containers, free to use for future - * updates. - */ - ATOMIC(struct ALlistenerProps*) FreeList; - struct { aluMatrixf Matrix; aluVector Velocity; @@ -50,7 +50,8 @@ typedef struct ALlistener { ALfloat MetersPerUnit; ALfloat DopplerFactor; - ALfloat SpeedOfSound; + ALfloat SpeedOfSound; /* in units per sec! */ + ALfloat ReverbSpeedOfSound; /* in meters per sec! */ ALboolean SourceDistanceModel; enum DistanceModel DistanceModel; diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alMain.h b/Engine/lib/openal-soft/OpenAL32/Include/alMain.h index 837e1082b..e29d9c270 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alMain.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alMain.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -11,15 +12,25 @@ #ifdef HAVE_STRINGS_H #include #endif - -#ifdef HAVE_FENV_H -#include +#ifdef HAVE_INTRIN_H +#include #endif #include "AL/al.h" #include "AL/alc.h" #include "AL/alext.h" +#include "inprogext.h" +#include "logging.h" +#include "polymorphism.h" +#include "static_assert.h" +#include "align.h" +#include "atomic.h" +#include "vector.h" +#include "alstring.h" +#include "almalloc.h" +#include "threads.h" + #if defined(_WIN64) #define SZFMT "%I64u" @@ -29,157 +40,38 @@ #define SZFMT "%zu" #endif - -#include "static_assert.h" -#include "align.h" -#include "atomic.h" -#include "uintmap.h" -#include "vector.h" -#include "alstring.h" -#include "almalloc.h" -#include "threads.h" - -#include "hrtf.h" - -#ifndef ALC_SOFT_device_clock -#define ALC_SOFT_device_clock 1 -typedef int64_t ALCint64SOFT; -typedef uint64_t ALCuint64SOFT; -#define ALC_DEVICE_CLOCK_SOFT 0x1600 -#define ALC_DEVICE_LATENCY_SOFT 0x1601 -#define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602 -typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); -#ifdef AL_ALEXT_PROTOTYPES -ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); +#ifdef __has_builtin +#define HAS_BUILTIN __has_builtin +#else +#define HAS_BUILTIN(x) (0) #endif -#endif - -#ifndef AL_SOFT_buffer_samples2 -#define AL_SOFT_buffer_samples2 1 -/* Channel configurations */ -#define AL_MONO_SOFT 0x1500 -#define AL_STEREO_SOFT 0x1501 -#define AL_REAR_SOFT 0x1502 -#define AL_QUAD_SOFT 0x1503 -#define AL_5POINT1_SOFT 0x1504 -#define AL_6POINT1_SOFT 0x1505 -#define AL_7POINT1_SOFT 0x1506 -#define AL_BFORMAT2D_SOFT 0x1507 -#define AL_BFORMAT3D_SOFT 0x1508 - -/* Sample types */ -#define AL_BYTE_SOFT 0x1400 -#define AL_UNSIGNED_BYTE_SOFT 0x1401 -#define AL_SHORT_SOFT 0x1402 -#define AL_UNSIGNED_SHORT_SOFT 0x1403 -#define AL_INT_SOFT 0x1404 -#define AL_UNSIGNED_INT_SOFT 0x1405 -#define AL_FLOAT_SOFT 0x1406 -#define AL_DOUBLE_SOFT 0x1407 -#define AL_BYTE3_SOFT 0x1408 -#define AL_UNSIGNED_BYTE3_SOFT 0x1409 -#define AL_MULAW_SOFT 0x140A - -/* Storage formats */ -#define AL_MONO8_SOFT 0x1100 -#define AL_MONO16_SOFT 0x1101 -#define AL_MONO32F_SOFT 0x10010 -#define AL_STEREO8_SOFT 0x1102 -#define AL_STEREO16_SOFT 0x1103 -#define AL_STEREO32F_SOFT 0x10011 -#define AL_QUAD8_SOFT 0x1204 -#define AL_QUAD16_SOFT 0x1205 -#define AL_QUAD32F_SOFT 0x1206 -#define AL_REAR8_SOFT 0x1207 -#define AL_REAR16_SOFT 0x1208 -#define AL_REAR32F_SOFT 0x1209 -#define AL_5POINT1_8_SOFT 0x120A -#define AL_5POINT1_16_SOFT 0x120B -#define AL_5POINT1_32F_SOFT 0x120C -#define AL_6POINT1_8_SOFT 0x120D -#define AL_6POINT1_16_SOFT 0x120E -#define AL_6POINT1_32F_SOFT 0x120F -#define AL_7POINT1_8_SOFT 0x1210 -#define AL_7POINT1_16_SOFT 0x1211 -#define AL_7POINT1_32F_SOFT 0x1212 -#define AL_BFORMAT2D_8_SOFT 0x20021 -#define AL_BFORMAT2D_16_SOFT 0x20022 -#define AL_BFORMAT2D_32F_SOFT 0x20023 -#define AL_BFORMAT3D_8_SOFT 0x20031 -#define AL_BFORMAT3D_16_SOFT 0x20032 -#define AL_BFORMAT3D_32F_SOFT 0x20033 - -/* Buffer attributes */ -#define AL_INTERNAL_FORMAT_SOFT 0x2008 -#define AL_BYTE_LENGTH_SOFT 0x2009 -#define AL_SAMPLE_LENGTH_SOFT 0x200A -#define AL_SEC_LENGTH_SOFT 0x200B - -#if 0 -typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*); -typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*); -typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum); -#ifdef AL_ALEXT_PROTOTYPES -AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data); -AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data); -AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format); -#endif -#endif -#endif - #ifdef __GNUC__ -/* Because of a long-standing deficiency in C, you're not allowed to implicitly - * cast a pointer-to-type-array to a pointer-to-const-type-array. For example, - * - * int (*ptr)[10]; - * const int (*cptr)[10] = ptr; - * - * is not allowed and most compilers will generate noisy warnings about - * incompatible types, even though it just makes the array elements const. - * Clang will allow it if you make the array type a typedef, like this: - * - * typedef int int10[10]; - * int10 *ptr; - * const int10 *cptr = ptr; - * - * however GCC does not and still issues the incompatible type warning. The - * "proper" way to fix it is to add an explicit cast for the constified type, - * but that removes the vast majority of otherwise useful type-checking you'd - * get, and runs the risk of improper casts if types are later changed. Leaving - * it non-const can also be an issue if you use it as a function parameter, and - * happen to have a const type as input (and also reduce the capabilities of - * the compiler to better optimize the function). - * - * So to work around the problem, we use a macro. The macro first assigns the - * incoming variable to the specified non-const type to ensure it's the correct - * type, then casts the variable as the desired constified type. Very ugly, but - * I'd rather not have hundreds of lines of warnings because I want to tell the - * compiler that some array(s) can't be changed by the code, or have lots of - * error-prone casts. +/* LIKELY optimizes the case where the condition is true. The condition is not + * required to be true, but it can result in more optimal code for the true + * path at the expense of a less optimal false path. */ -#define SAFE_CONST(T, var) __extension__({ \ - T _tmp = (var); \ - (const T)_tmp; \ -}) +#define LIKELY(x) __builtin_expect(!!(x), !0) +/* The opposite of LIKELY, optimizing the case where the condition is false. */ +#define UNLIKELY(x) __builtin_expect(!!(x), 0) +/* Unlike LIKELY, ASSUME requires the condition to be true or else it invokes + * undefined behavior. It's essentially an assert without actually checking the + * condition at run-time, allowing for stronger optimizations than LIKELY. + */ +#if HAS_BUILTIN(__builtin_assume) +#define ASSUME __builtin_assume #else -/* Non-GNU-compatible compilers have to use a straight cast with no extra - * checks, due to the lack of multi-statement expressions. - */ -#define SAFE_CONST(T, var) ((const T)(var)) +#define ASSUME(x) do { if(!(x)) __builtin_unreachable(); } while(0) #endif +#else -typedef ALint64SOFT ALint64; -typedef ALuint64SOFT ALuint64; - -#ifndef U64 -#if defined(_MSC_VER) -#define U64(x) ((ALuint64)(x##ui64)) -#elif SIZEOF_LONG == 8 -#define U64(x) ((ALuint64)(x##ul)) -#elif SIZEOF_LONG_LONG == 8 -#define U64(x) ((ALuint64)(x##ull)) +#define LIKELY(x) (!!(x)) +#define UNLIKELY(x) (!!(x)) +#ifdef _MSC_VER +#define ASSUME __assume +#else +#define ASSUME(x) ((void)0) #endif #endif @@ -199,36 +91,88 @@ typedef ALuint64SOFT ALuint64; #endif #endif +/* Calculates the size of a struct with N elements of a flexible array member. + * GCC and Clang allow offsetof(Type, fam[N]) for this, but MSVC seems to have + * trouble, so a bit more verbose workaround is needed. + */ +#define FAM_SIZE(T, M, N) (offsetof(T, M) + sizeof(((T*)NULL)->M[0])*(N)) + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ALint64SOFT ALint64; +typedef ALuint64SOFT ALuint64; + +#ifndef U64 +#if defined(_MSC_VER) +#define U64(x) ((ALuint64)(x##ui64)) +#elif SIZEOF_LONG == 8 +#define U64(x) ((ALuint64)(x##ul)) +#elif SIZEOF_LONG_LONG == 8 +#define U64(x) ((ALuint64)(x##ull)) +#endif +#endif + +/* Define a CTZ64 macro (count trailing zeros, for 64-bit integers). The result + * is *UNDEFINED* if the value is 0. + */ #ifdef __GNUC__ -#define DECL_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) + +#if SIZEOF_LONG == 8 +#define CTZ64(x) __builtin_ctzl(x) #else -#define DECL_FORMAT(x, y, z) +#define CTZ64(x) __builtin_ctzll(x) #endif -#if defined(__GNUC__) && defined(__i386__) -/* force_align_arg_pointer is required for proper function arguments aligning - * when SSE code is used. Some systems (Windows, QNX) do not guarantee our - * thread functions will be properly aligned on the stack, even though GCC may - * generate code with the assumption that it is. */ -#define FORCE_ALIGN __attribute__((force_align_arg_pointer)) -#else -#define FORCE_ALIGN -#endif +#elif defined(HAVE_BITSCANFORWARD64_INTRINSIC) -#ifdef HAVE_C99_VLA -#define DECL_VLA(T, _name, _size) T _name[(_size)] -#else -#define DECL_VLA(T, _name, _size) T *_name = alloca((_size) * sizeof(T)) -#endif +inline int msvc64_ctz64(ALuint64 v) +{ + unsigned long idx = 64; + _BitScanForward64(&idx, v); + return (int)idx; +} +#define CTZ64(x) msvc64_ctz64(x) -#ifndef PATH_MAX -#ifdef MAX_PATH -#define PATH_MAX MAX_PATH -#else -#define PATH_MAX 4096 -#endif -#endif +#elif defined(HAVE_BITSCANFORWARD_INTRINSIC) +inline int msvc_ctz64(ALuint64 v) +{ + unsigned long idx = 64; + if(!_BitScanForward(&idx, v&0xffffffff)) + { + if(_BitScanForward(&idx, v>>32)) + idx += 32; + } + return (int)idx; +} +#define CTZ64(x) msvc_ctz64(x) + +#else + +/* There be black magics here. The popcnt64 method is derived from + * https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + * while the ctz-utilizing-popcnt algorithm is shown here + * http://www.hackersdelight.org/hdcodetxt/ntz.c.txt + * as the ntz2 variant. These likely aren't the most efficient methods, but + * they're good enough if the GCC or MSVC intrinsics aren't available. + */ +inline int fallback_popcnt64(ALuint64 v) +{ + v = v - ((v >> 1) & U64(0x5555555555555555)); + v = (v & U64(0x3333333333333333)) + ((v >> 2) & U64(0x3333333333333333)); + v = (v + (v >> 4)) & U64(0x0f0f0f0f0f0f0f0f); + return (int)((v * U64(0x0101010101010101)) >> 56); +} + +inline int fallback_ctz64(ALuint64 value) +{ + return fallback_popcnt64(~value & (value - 1)); +} +#define CTZ64(x) fallback_ctz64(x) +#endif static const union { ALuint u; @@ -236,108 +180,24 @@ static const union { } EndianTest = { 1 }; #define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1) -#define COUNTOF(x) (sizeof((x))/sizeof((x)[0])) +#define COUNTOF(x) (sizeof(x) / sizeof(0[x])) -#define DERIVE_FROM_TYPE(t) t t##_parent -#define STATIC_CAST(to, obj) (&(obj)->to##_parent) -#ifdef __GNUC__ -#define STATIC_UPCAST(to, from, obj) __extension__({ \ - static_assert(__builtin_types_compatible_p(from, __typeof(*(obj))), \ - "Invalid upcast object from type"); \ - (to*)((char*)(obj) - offsetof(to, from##_parent)); \ -}) -#else -#define STATIC_UPCAST(to, from, obj) ((to*)((char*)(obj) - offsetof(to, from##_parent))) -#endif - -#define DECLARE_FORWARD(T1, T2, rettype, func) \ -rettype T1##_##func(T1 *obj) \ -{ return T2##_##func(STATIC_CAST(T2, obj)); } - -#define DECLARE_FORWARD1(T1, T2, rettype, func, argtype1) \ -rettype T1##_##func(T1 *obj, argtype1 a) \ -{ return T2##_##func(STATIC_CAST(T2, obj), a); } - -#define DECLARE_FORWARD2(T1, T2, rettype, func, argtype1, argtype2) \ -rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b) \ -{ return T2##_##func(STATIC_CAST(T2, obj), a, b); } - -#define DECLARE_FORWARD3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ -rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b, argtype3 c) \ -{ return T2##_##func(STATIC_CAST(T2, obj), a, b, c); } - - -#define GET_VTABLE1(T1) (&(T1##_vtable)) -#define GET_VTABLE2(T1, T2) (&(T1##_##T2##_vtable)) - -#define SET_VTABLE1(T1, obj) ((obj)->vtbl = GET_VTABLE1(T1)) -#define SET_VTABLE2(T1, T2, obj) (STATIC_CAST(T2, obj)->vtbl = GET_VTABLE2(T1, T2)) - -#define DECLARE_THUNK(T1, T2, rettype, func) \ -static rettype T1##_##T2##_##func(T2 *obj) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj)); } - -#define DECLARE_THUNK1(T1, T2, rettype, func, argtype1) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a); } - -#define DECLARE_THUNK2(T1, T2, rettype, func, argtype1, argtype2) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b); } - -#define DECLARE_THUNK3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c); } - -#define DECLARE_THUNK4(T1, T2, rettype, func, argtype1, argtype2, argtype3, argtype4) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c, argtype4 d) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c, d); } - -#define DECLARE_DEFAULT_ALLOCATORS(T) \ -static void* T##_New(size_t size) { return al_malloc(16, size); } \ -static void T##_Delete(void *ptr) { al_free(ptr); } - -/* Helper to extract an argument list for VCALL. Not used directly. */ -#define EXTRACT_VCALL_ARGS(...) __VA_ARGS__)) - -/* Call a "virtual" method on an object, with arguments. */ -#define V(obj, func) ((obj)->vtbl->func((obj), EXTRACT_VCALL_ARGS -/* Call a "virtual" method on an object, with no arguments. */ -#define V0(obj, func) ((obj)->vtbl->func((obj) EXTRACT_VCALL_ARGS - -#define DELETE_OBJ(obj) do { \ - if((obj) != NULL) \ - { \ - V0((obj),Destruct)(); \ - V0((obj),Delete)(); \ - } \ -} while(0) - - -#define EXTRACT_NEW_ARGS(...) __VA_ARGS__); \ - } \ -} while(0) - -#define NEW_OBJ(_res, T) do { \ - _res = T##_New(sizeof(T)); \ - if(_res) \ - { \ - memset(_res, 0, sizeof(T)); \ - T##_Construct(_res, EXTRACT_NEW_ARGS -#define NEW_OBJ0(_res, T) do { \ - _res = T##_New(sizeof(T)); \ - if(_res) \ - { \ - memset(_res, 0, sizeof(T)); \ - T##_Construct(_res EXTRACT_NEW_ARGS - - -#ifdef __cplusplus -extern "C" { -#endif - +struct ll_ringbuffer; struct Hrtf; +struct HrtfEntry; +struct DirectHrtfState; +struct FrontStablizer; +struct Compressor; +struct ALCbackend; +struct ALbuffer; +struct ALeffect; +struct ALfilter; +struct ALsource; +struct ALcontextProps; +struct ALlistenerProps; +struct ALvoiceProps; +struct ALeffectslotProps; #define DEFAULT_OUTPUT_RATE (44100) @@ -359,26 +219,61 @@ inline ALuint NextPowerOf2(ALuint value) return value+1; } -/* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero - * mode. */ +/** Round up a value to the next multiple. */ +inline size_t RoundUp(size_t value, size_t r) +{ + value += r-1; + return value - (value%r); +} + +/* Fast float-to-int conversion. No particular rounding mode is assumed; the + * IEEE-754 default is round-to-nearest with ties-to-even, though an app could + * change it on its own threads. On some systems, a truncating conversion may + * always be the fastest method. + */ inline ALint fastf2i(ALfloat f) { -#ifdef HAVE_LRINTF - return lrintf(f); -#elif defined(_MSC_VER) && defined(_M_IX86) +#if defined(HAVE_INTRIN_H) && ((defined(_M_IX86_FP) && (_M_IX86_FP > 0)) || defined(_M_X64)) + return _mm_cvt_ss2si(_mm_set1_ps(f)); + +#elif defined(_MSC_VER) && defined(_M_IX86_FP) + ALint i; __asm fld f __asm fistp i return i; + +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) + + ALint i; +#ifdef __SSE_MATH__ + __asm__("cvtss2si %1, %0" : "=r"(i) : "x"(f)); #else + __asm__("flds %1\n fistps %0" : "=m"(i) : "m"(f)); +#endif + return i; + + /* On GCC when compiling with -fno-math-errno, lrintf can be inlined to + * some simple instructions. Clang does not inline it, always generating a + * libc call, while MSVC's implementation is horribly slow, so always fall + * back to a normal integer conversion for them. + */ +#elif defined(HAVE_LRINTF) && !defined(_MSC_VER) && !defined(__clang__) + + return lrintf(f); + +#else + return (ALint)f; #endif } -/* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero - * mode. */ -inline ALuint fastf2u(ALfloat f) -{ return fastf2i(f); } +/* Converts float-to-int using standard behavior (truncation). */ +inline int float2int(float f) +{ + /* TODO: Make a more efficient method for x87. */ + return (ALint)f; +} enum DevProbe { @@ -386,36 +281,6 @@ enum DevProbe { CAPTURE_DEVICE_PROBE }; -typedef struct { - ALCenum (*OpenPlayback)(ALCdevice*, const ALCchar*); - void (*ClosePlayback)(ALCdevice*); - ALCboolean (*ResetPlayback)(ALCdevice*); - ALCboolean (*StartPlayback)(ALCdevice*); - void (*StopPlayback)(ALCdevice*); - - ALCenum (*OpenCapture)(ALCdevice*, const ALCchar*); - void (*CloseCapture)(ALCdevice*); - void (*StartCapture)(ALCdevice*); - void (*StopCapture)(ALCdevice*); - ALCenum (*CaptureSamples)(ALCdevice*, void*, ALCuint); - ALCuint (*AvailableSamples)(ALCdevice*); -} BackendFuncs; - -ALCboolean alc_sndio_init(BackendFuncs *func_list); -void alc_sndio_deinit(void); -void alc_sndio_probe(enum DevProbe type); -ALCboolean alc_ca_init(BackendFuncs *func_list); -void alc_ca_deinit(void); -void alc_ca_probe(enum DevProbe type); -ALCboolean alc_opensl_init(BackendFuncs *func_list); -void alc_opensl_deinit(void); -void alc_opensl_probe(enum DevProbe type); -ALCboolean alc_qsa_init(BackendFuncs *func_list); -void alc_qsa_deinit(void); -void alc_qsa_probe(enum DevProbe type); - -struct ALCbackend; - enum DistanceModel { InverseDistanceClamped = AL_INVERSE_DISTANCE_CLAMPED, @@ -489,41 +354,36 @@ enum DevFmtChannels { DevFmtX51 = ALC_5POINT1_SOFT, DevFmtX61 = ALC_6POINT1_SOFT, DevFmtX71 = ALC_7POINT1_SOFT, + DevFmtAmbi3D = ALC_BFORMAT3D_SOFT, /* Similar to 5.1, except using rear channels instead of sides */ DevFmtX51Rear = 0x80000000, - /* Ambisonic formats should be kept together */ - DevFmtAmbi1, - DevFmtAmbi2, - DevFmtAmbi3, - DevFmtChannelsDefault = DevFmtStereo }; #define MAX_OUTPUT_CHANNELS (16) -ALuint BytesFromDevFmt(enum DevFmtType type); -ALuint ChannelsFromDevFmt(enum DevFmtChannels chans); -inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type) +ALsizei BytesFromDevFmt(enum DevFmtType type); +ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder); +inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder) { - return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type); + return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); } -enum AmbiFormat { - AmbiFormat_FuMa, /* FuMa channel order and normalization */ - AmbiFormat_ACN_SN3D, /* ACN channel order and SN3D normalization */ - AmbiFormat_ACN_N3D, /* ACN channel order and N3D normalization */ +enum AmbiLayout { + AmbiLayout_FuMa = ALC_FUMA_SOFT, /* FuMa channel order */ + AmbiLayout_ACN = ALC_ACN_SOFT, /* ACN channel order */ - AmbiFormat_Default = AmbiFormat_ACN_SN3D + AmbiLayout_Default = AmbiLayout_ACN }; +enum AmbiNorm { + AmbiNorm_FuMa = ALC_FUMA_SOFT, /* FuMa normalization */ + AmbiNorm_SN3D = ALC_SN3D_SOFT, /* SN3D normalization */ + AmbiNorm_N3D = ALC_N3D_SOFT, /* N3D normalization */ -extern const struct EffectList { - const char *name; - int type; - const char *ename; - ALenum val; -} EffectList[]; + AmbiNorm_Default = AmbiNorm_SN3D +}; enum DeviceType { @@ -565,7 +425,7 @@ enum RenderMode { typedef ALfloat ChannelConfig[MAX_AMBI_COEFFS]; typedef struct BFChannelConfig { ALfloat Scale; - ALuint Index; + ALsizei Index; } BFChannelConfig; typedef union AmbiConfig { @@ -576,33 +436,96 @@ typedef union AmbiConfig { } AmbiConfig; -#define HRTF_HISTORY_BITS (6) -#define HRTF_HISTORY_LENGTH (1<Device); } - -inline void UnlockContext(ALCcontext *context) -{ ALCdevice_Unlock(context->Device); } - -enum { - DeferOff = AL_FALSE, - DeferAll, - DeferAllowPlay -}; - - -typedef struct { -#ifdef HAVE_FENV_H - DERIVE_FROM_TYPE(fenv_t); -#else - int state; -#endif -#ifdef HAVE_SSE - int sse_state; -#endif -} FPUCtl; -void SetMixerFPUMode(FPUCtl *ctl); -void RestoreFPUMode(const FPUCtl *ctl); - - -typedef struct ll_ringbuffer ll_ringbuffer_t; -typedef struct ll_ringbuffer_data { - char *buf; - size_t len; -} ll_ringbuffer_data_t; -ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz); -void ll_ringbuffer_free(ll_ringbuffer_t *rb); -void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t *vec); -void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t *vec); -size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt); -size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt); -void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt); -size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb); -int ll_ringbuffer_mlock(ll_ringbuffer_t *rb); -void ll_ringbuffer_reset(ll_ringbuffer_t *rb); -size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt); -void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt); -size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb); - -void ReadALConfig(void); -void FreeALConfig(void); -int ConfigValueExists(const char *devName, const char *blockName, const char *keyName); -const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def); -int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def); -int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret); -int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret); -int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret); -int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret); -int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret); +extern ALint RTPrioLevel; void SetRTPriority(void); void SetDefaultChannelOrder(ALCdevice *device); @@ -882,12 +778,6 @@ void SetDefaultWFXChannelOrder(ALCdevice *device); const ALCchar *DevFmtTypeString(enum DevFmtType type); const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans); -/** - * GetChannelIdxByName - * - * Returns the index for the given channel name (e.g. FrontCenter), or -1 if it - * doesn't exist. - */ inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan) { ALint i; @@ -898,68 +788,33 @@ inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum } return -1; } -#define GetChannelIdxByName(x, c) GetChannelIndex((x).ChannelName, (c)) - -extern FILE *LogFile; - -#if defined(__GNUC__) && !defined(_WIN32) && !defined(IN_IDE_PARSER) -#define AL_PRINT(T, MSG, ...) fprintf(LogFile, "AL lib: %s %s: "MSG, T, __FUNCTION__ , ## __VA_ARGS__) -#else -void al_print(const char *type, const char *func, const char *fmt, ...) DECL_FORMAT(printf, 3,4); -#define AL_PRINT(T, ...) al_print((T), __FUNCTION__, __VA_ARGS__) -#endif - -enum LogLevel { - NoLog, - LogError, - LogWarning, - LogTrace, - LogRef -}; -extern enum LogLevel LogLevel; - -#define TRACEREF(...) do { \ - if(LogLevel >= LogRef) \ - AL_PRINT("(--)", __VA_ARGS__); \ -} while(0) - -#define TRACE(...) do { \ - if(LogLevel >= LogTrace) \ - AL_PRINT("(II)", __VA_ARGS__); \ -} while(0) - -#define WARN(...) do { \ - if(LogLevel >= LogWarning) \ - AL_PRINT("(WW)", __VA_ARGS__); \ -} while(0) - -#define ERR(...) do { \ - if(LogLevel >= LogError) \ - AL_PRINT("(EE)", __VA_ARGS__); \ -} while(0) +/** + * GetChannelIdxByName + * + * Returns the index for the given channel name (e.g. FrontCenter), or -1 if it + * doesn't exist. + */ +inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan) +{ return GetChannelIndex(real->ChannelName, chan); } -extern ALint RTPrioLevel; +inline void LockBufferList(ALCdevice *device) { almtx_lock(&device->BufferLock); } +inline void UnlockBufferList(ALCdevice *device) { almtx_unlock(&device->BufferLock); } +inline void LockEffectList(ALCdevice *device) { almtx_lock(&device->EffectLock); } +inline void UnlockEffectList(ALCdevice *device) { almtx_unlock(&device->EffectLock); } -extern ALuint CPUCapFlags; -enum { - CPU_CAP_SSE = 1<<0, - CPU_CAP_SSE2 = 1<<1, - CPU_CAP_SSE3 = 1<<2, - CPU_CAP_SSE4_1 = 1<<3, - CPU_CAP_NEON = 1<<4, -}; +inline void LockFilterList(ALCdevice *device) { almtx_lock(&device->FilterLock); } +inline void UnlockFilterList(ALCdevice *device) { almtx_unlock(&device->FilterLock); } + +inline void LockEffectSlotList(ALCcontext *context) +{ almtx_lock(&context->EffectSlotLock); } +inline void UnlockEffectSlotList(ALCcontext *context) +{ almtx_unlock(&context->EffectSlotLock); } -void FillCPUCaps(ALuint capfilter); vector_al_string SearchDataFiles(const char *match, const char *subdir); -/* Small hack to use a pointer-to-array type as a normal argument type. - * Shouldn't be used directly. */ -typedef ALfloat ALfloatBUFFERSIZE[BUFFERSIZE]; - - #ifdef __cplusplus } #endif diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alSource.h b/Engine/lib/openal-soft/OpenAL32/Include/alSource.h index b288937a3..5f07c09d7 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alSource.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alSource.h @@ -1,11 +1,14 @@ #ifndef _AL_SOURCE_H_ #define _AL_SOURCE_H_ -#define MAX_SENDS 4 - +#include "bool.h" #include "alMain.h" #include "alu.h" #include "hrtf.h" +#include "atomic.h" + +#define MAX_SENDS 16 +#define DEFAULT_SENDS 2 #ifdef __cplusplus extern "C" { @@ -13,104 +16,16 @@ extern "C" { struct ALbuffer; struct ALsource; -struct ALsourceProps; typedef struct ALbufferlistitem { - struct ALbuffer *buffer; - struct ALbufferlistitem *volatile next; + ATOMIC(struct ALbufferlistitem*) next; + ALsizei max_samples; + ALsizei num_buffers; + struct ALbuffer *buffers[]; } ALbufferlistitem; -struct ALsourceProps { - ATOMIC(ALfloat) Pitch; - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) OuterGain; - ATOMIC(ALfloat) MinGain; - ATOMIC(ALfloat) MaxGain; - ATOMIC(ALfloat) InnerAngle; - ATOMIC(ALfloat) OuterAngle; - ATOMIC(ALfloat) RefDistance; - ATOMIC(ALfloat) MaxDistance; - ATOMIC(ALfloat) RollOffFactor; - ATOMIC(ALfloat) Position[3]; - ATOMIC(ALfloat) Velocity[3]; - ATOMIC(ALfloat) Direction[3]; - ATOMIC(ALfloat) Orientation[2][3]; - ATOMIC(ALboolean) HeadRelative; - ATOMIC(enum DistanceModel) DistanceModel; - ATOMIC(ALboolean) DirectChannels; - - ATOMIC(ALboolean) DryGainHFAuto; - ATOMIC(ALboolean) WetGainAuto; - ATOMIC(ALboolean) WetGainHFAuto; - ATOMIC(ALfloat) OuterGainHF; - - ATOMIC(ALfloat) AirAbsorptionFactor; - ATOMIC(ALfloat) RoomRolloffFactor; - ATOMIC(ALfloat) DopplerFactor; - - ATOMIC(ALfloat) StereoPan[2]; - - ATOMIC(ALfloat) Radius; - - /** Direct filter and auxiliary send info. */ - struct { - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) GainHF; - ATOMIC(ALfloat) HFReference; - ATOMIC(ALfloat) GainLF; - ATOMIC(ALfloat) LFReference; - } Direct; - struct { - ATOMIC(struct ALeffectslot*) Slot; - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) GainHF; - ATOMIC(ALfloat) HFReference; - ATOMIC(ALfloat) GainLF; - ATOMIC(ALfloat) LFReference; - } Send[MAX_SENDS]; - - ATOMIC(struct ALsourceProps*) next; -}; - - -typedef struct ALvoice { - struct ALsourceProps Props; - - struct ALsource *volatile Source; - - /** Current target parameters used for mixing. */ - ALint Step; - - /* If not 'moving', gain/coefficients are set directly without fading. */ - ALboolean Moving; - - ALboolean IsHrtf; - - ALuint Offset; /* Number of output samples mixed since starting. */ - - alignas(16) ALfloat PrevSamples[MAX_INPUT_CHANNELS][MAX_PRE_SAMPLES]; - - BsincState SincState; - - struct { - ALfloat (*Buffer)[BUFFERSIZE]; - ALuint Channels; - } DirectOut; - - struct { - ALfloat (*Buffer)[BUFFERSIZE]; - ALuint Channels; - } SendOut[MAX_SENDS]; - - struct { - DirectParams Direct; - SendParams Send[MAX_SENDS]; - } Chan[MAX_INPUT_CHANNELS]; -} ALvoice; - - typedef struct ALsource { /** Source properties. */ ALfloat Pitch; @@ -122,14 +37,17 @@ typedef struct ALsource { ALfloat OuterAngle; ALfloat RefDistance; ALfloat MaxDistance; - ALfloat RollOffFactor; + ALfloat RolloffFactor; ALfloat Position[3]; ALfloat Velocity[3]; ALfloat Direction[3]; ALfloat Orientation[2][3]; ALboolean HeadRelative; + ALboolean Looping; enum DistanceModel DistanceModel; + enum Resampler Resampler; ALboolean DirectChannels; + enum SpatializeMode Spatialize; ALboolean DryGainHFAuto; ALboolean WetGainAuto; @@ -162,7 +80,7 @@ typedef struct ALsource { ALfloat HFReference; ALfloat GainLF; ALfloat LFReference; - } Send[MAX_SENDS]; + } *Send; /** * Last user-specified offset, and the offset type (bytes, samples, or @@ -176,51 +94,22 @@ typedef struct ALsource { /** Source state (initial, playing, paused, or stopped) */ ALenum state; - ALenum new_state; - /** Source Buffer Queue info. */ - RWLock queue_lock; - ATOMIC(ALbufferlistitem*) queue; - ATOMIC(ALbufferlistitem*) current_buffer; + /** Source Buffer Queue head. */ + ALbufferlistitem *queue; - /** - * Source offset in samples, relative to the currently playing buffer, NOT - * the whole queue, and the fractional (fixed-point) offset to the next - * sample. + ATOMIC_FLAG PropsClean; + + /* Index into the context's Voices array. Lazily updated, only checked and + * reset when looking up the voice. */ - ATOMIC(ALuint) position; - ATOMIC(ALuint) position_fraction; - - ATOMIC(ALboolean) looping; - - /** Current buffer sample info. */ - ALuint NumChannels; - ALuint SampleSize; - - ATOMIC(struct ALsourceProps*) Update; - ATOMIC(struct ALsourceProps*) FreeList; + ALint VoiceIdx; /** Self ID */ ALuint id; } ALsource; -inline void LockSourcesRead(ALCcontext *context) -{ LockUIntMapRead(&context->SourceMap); } -inline void UnlockSourcesRead(ALCcontext *context) -{ UnlockUIntMapRead(&context->SourceMap); } -inline void LockSourcesWrite(ALCcontext *context) -{ LockUIntMapWrite(&context->SourceMap); } -inline void UnlockSourcesWrite(ALCcontext *context) -{ UnlockUIntMapWrite(&context->SourceMap); } - -inline struct ALsource *LookupSource(ALCcontext *context, ALuint id) -{ return (struct ALsource*)LookupUIntMapKeyNoLock(&context->SourceMap, id); } -inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id) -{ return (struct ALsource*)RemoveUIntMapKeyNoLock(&context->SourceMap, id); } - void UpdateAllSourceProps(ALCcontext *context); -ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state); -ALboolean ApplyOffset(ALsource *Source); ALvoid ReleaseALSources(ALCcontext *Context); diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alThunk.h b/Engine/lib/openal-soft/OpenAL32/Include/alThunk.h deleted file mode 100644 index adc77dec9..000000000 --- a/Engine/lib/openal-soft/OpenAL32/Include/alThunk.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ALTHUNK_H -#define ALTHUNK_H - -#include "alMain.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void ThunkInit(void); -void ThunkExit(void); -ALenum NewThunkEntry(ALuint *index); -void FreeThunkEntry(ALuint index); - -#ifdef __cplusplus -} -#endif - -#endif //ALTHUNK_H - diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alu.h b/Engine/lib/openal-soft/OpenAL32/Include/alu.h index ae8645fa7..b977613c0 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alu.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alu.h @@ -12,35 +12,56 @@ #include "alMain.h" #include "alBuffer.h" -#include "alFilter.h" -#include "alAuxEffectSlot.h" #include "hrtf.h" #include "align.h" #include "math_defs.h" +#include "filters/defs.h" +#include "filters/nfc.h" #define MAX_PITCH (255) -/* Maximum number of buffer samples before the current pos needed for resampling. */ -#define MAX_PRE_SAMPLES 12 - -/* Maximum number of buffer samples after the current pos needed for resampling. */ -#define MAX_POST_SAMPLES 12 +/* Maximum number of samples to pad on either end of a buffer for resampling. + * Note that both the beginning and end need padding! + */ +#define MAX_RESAMPLE_PADDING 24 #ifdef __cplusplus extern "C" { #endif +struct BSincTable; struct ALsource; -struct ALsourceProps; +struct ALbufferlistitem; struct ALvoice; struct ALeffectslot; -struct ALbuffer; -/* The number of distinct scale and phase intervals within the filter table. */ +#define DITHER_RNG_SEED 22222 + + +enum SpatializeMode { + SpatializeOff = AL_FALSE, + SpatializeOn = AL_TRUE, + SpatializeAuto = AL_AUTO_SOFT +}; + +enum Resampler { + PointResampler, + LinearResampler, + FIR4Resampler, + BSinc12Resampler, + BSinc24Resampler, + + ResamplerMax = BSinc24Resampler +}; +extern enum Resampler ResamplerDefault; + +/* The number of distinct scale and phase intervals within the bsinc filter + * table. + */ #define BSINC_SCALE_BITS 4 #define BSINC_SCALE_COUNT (1< b) ? b : a); } +inline size_t maxz(size_t a, size_t b) +{ return ((a > b) ? a : b); } +inline size_t clampz(size_t val, size_t min, size_t max) +{ return minz(max, maxz(min, val)); } inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) { return val1 + (val2-val1)*mu; } -inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALuint frac) +inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu) { - const ALfloat *k = ResampleCoeffs.FIR4[frac]; - return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3; -} -inline ALfloat resample_fir8(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat val5, ALfloat val6, ALfloat val7, ALuint frac) -{ - const ALfloat *k = ResampleCoeffs.FIR8[frac]; - return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3 + - k[4]*val4 + k[5]*val5 + k[6]*val6 + k[7]*val7; + ALfloat mu2 = mu*mu, mu3 = mu2*mu; + ALfloat a0 = -0.5f*mu3 + mu2 + -0.5f*mu; + ALfloat a1 = 1.5f*mu3 + -2.5f*mu2 + 1.0f; + ALfloat a2 = -1.5f*mu3 + 2.0f*mu2 + 0.5f*mu; + ALfloat a3 = 0.5f*mu3 + -0.5f*mu2; + return val1*a0 + val2*a1 + val3*a2 + val4*a3; } @@ -256,11 +413,11 @@ enum HrtfRequestMode { Hrtf_Disable = 2, }; +void aluInit(void); void aluInitMixer(void); -MixerFunc SelectMixer(void); -RowMixerFunc SelectRowMixer(void); +ResamplerFunc SelectResampler(enum Resampler resampler); /* aluInitRenderer * @@ -271,6 +428,8 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf void aluInitEffectPanning(struct ALeffectslot *slot); +void aluSelectPostProcess(ALCdevice *device); + /** * CalcDirectionCoeffs * @@ -280,18 +439,6 @@ void aluInitEffectPanning(struct ALeffectslot *slot); */ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); -/** - * CalcXYZCoeffs - * - * Same as CalcDirectionCoeffs except the direction is specified as separate x, - * y, and z parameters instead of an array. - */ -inline void CalcXYZCoeffs(ALfloat x, ALfloat y, ALfloat z, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) -{ - ALfloat dir[3] = { x, y, z }; - CalcDirectionCoeffs(dir, spread, coeffs); -} - /** * CalcAngleCoeffs * @@ -299,37 +446,46 @@ inline void CalcXYZCoeffs(ALfloat x, ALfloat y, ALfloat z, ALfloat spread, ALflo * azimuth and elevation parameters are in radians, going right and up * respectively. */ -void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) +{ + ALfloat dir[3] = { + sinf(azimuth) * cosf(elevation), + sinf(elevation), + -cosf(azimuth) * cosf(elevation) + }; + CalcDirectionCoeffs(dir, spread, coeffs); +} /** - * ComputeAmbientGains + * CalcAnglePairwiseCoeffs * - * Computes channel gains for ambient, omni-directional sounds. + * Calculates ambisonic coefficients based on azimuth and elevation. The + * azimuth and elevation parameters are in radians, going right and up + * respectively. This pairwise variant warps the result such that +30 azimuth + * is full right, and -30 azimuth is full left. */ -#define ComputeAmbientGains(b, g, o) do { \ - if((b).CoeffCount > 0) \ - ComputeAmbientGainsMC((b).Ambi.Coeffs, (b).NumChannels, g, o); \ - else \ - ComputeAmbientGainsBF((b).Ambi.Map, (b).NumChannels, g, o); \ -} while (0) -void ComputeAmbientGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -void ComputeAmbientGainsBF(const BFChannelConfig *chanmap, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); + +void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); /** - * ComputePanningGains + * ComputeDryPanGains * * Computes panning gains using the given channel decoder coefficients and the * pre-calculated direction or angle coefficients. */ -#define ComputePanningGains(b, c, g, o) do { \ - if((b).CoeffCount > 0) \ - ComputePanningGainsMC((b).Ambi.Coeffs, (b).NumChannels, (b).CoeffCount, c, g, o);\ - else \ - ComputePanningGainsBF((b).Ambi.Map, (b).NumChannels, c, g, o); \ -} while (0) -void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALuint numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +inline void ComputeDryPanGains(const DryMixParams *dry, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +{ + if(dry->CoeffCount > 0) + ComputePanningGainsMC(dry->Ambi.Coeffs, dry->NumChannels, dry->CoeffCount, + coeffs, ingain, gains); + else + ComputePanningGainsBF(dry->Ambi.Map, dry->NumChannels, coeffs, ingain, gains); +} +void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); /** * ComputeFirstOrderGains * @@ -337,24 +493,29 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, cons * a 1x4 'slice' of a transform matrix for the input channel, used to scale and * orient the sound samples. */ -#define ComputeFirstOrderGains(b, m, g, o) do { \ - if((b).CoeffCount > 0) \ - ComputeFirstOrderGainsMC((b).Ambi.Coeffs, (b).NumChannels, m, g, o); \ - else \ - ComputeFirstOrderGainsBF((b).Ambi.Map, (b).NumChannels, m, g, o); \ -} while (0) -void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +inline void ComputeFirstOrderGains(const BFMixParams *foa, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +{ + if(foa->CoeffCount > 0) + ComputeFirstOrderGainsMC(foa->Ambi.Coeffs, foa->NumChannels, mtx, ingain, gains); + else + ComputeFirstOrderGainsBF(foa->Ambi.Map, foa->NumChannels, mtx, ingain, gains); +} -ALvoid MixSource(struct ALvoice *voice, struct ALsource *source, ALCdevice *Device, ALuint SamplesToDo); +ALboolean MixSource(struct ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsizei SamplesToDo); -ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size); -/* Caller must lock the device. */ -ALvoid aluHandleDisconnect(ALCdevice *device); +void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples); +/* Caller must lock the device, and the mixer must not be running. */ +void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) DECL_FORMAT(printf, 2, 3); + +void UpdateContextProps(ALCcontext *context); + +extern MixerFunc MixSamples; +extern RowMixerFunc MixRowSamples; extern ALfloat ConeScale; extern ALfloat ZScale; +extern ALboolean OverrideReverbSpeedOfSound; #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h b/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h index bfe5c274c..e845d906d 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h @@ -85,7 +85,7 @@ int bs2b_get_srate(struct bs2b *bs2b); /* Clear buffer */ void bs2b_clear(struct bs2b *bs2b); -void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, unsigned int SamplesToDo); +void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, int SamplesToDo); #ifdef __cplusplus } /* extern "C" */ diff --git a/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h b/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h index 12bb1fa6c..c041760e6 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h @@ -4,6 +4,12 @@ #include "AL/al.h" #include "alBuffer.h" -void ConvertData(ALvoid *dst, enum UserFmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei numchans, ALsizei len, ALsizei align); +extern const ALshort muLawDecompressionTable[256]; +extern const ALshort aLawDecompressionTable[256]; + +void Convert_ALshort_ALima4(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align); +void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align); #endif /* SAMPLE_CVT_H */ diff --git a/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c b/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c index b860b2b0e..d04fc4a77 100644 --- a/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c +++ b/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c @@ -27,99 +27,140 @@ #include "AL/alc.h" #include "alMain.h" #include "alAuxEffectSlot.h" -#include "alThunk.h" #include "alError.h" #include "alListener.h" #include "alSource.h" +#include "fpu_modes.h" #include "almalloc.h" -extern inline void LockEffectSlotsRead(ALCcontext *context); -extern inline void UnlockEffectSlotsRead(ALCcontext *context); -extern inline void LockEffectSlotsWrite(ALCcontext *context); -extern inline void UnlockEffectSlotsWrite(ALCcontext *context); -extern inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id); -extern inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id); +extern inline void LockEffectSlotList(ALCcontext *context); +extern inline void UnlockEffectSlotList(ALCcontext *context); -static void RemoveEffectSlotList(ALCcontext *Context, ALeffectslot *slot); +static void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context); +static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context); -static UIntMap EffectStateFactoryMap; -static inline ALeffectStateFactory *getFactoryByType(ALenum type) +static const struct { + ALenum Type; + EffectStateFactory* (*GetFactory)(void); +} FactoryList[] = { + { AL_EFFECT_NULL, NullStateFactory_getFactory }, + { AL_EFFECT_EAXREVERB, ReverbStateFactory_getFactory }, + { AL_EFFECT_REVERB, ReverbStateFactory_getFactory }, + { AL_EFFECT_CHORUS, ChorusStateFactory_getFactory }, + { AL_EFFECT_COMPRESSOR, CompressorStateFactory_getFactory }, + { AL_EFFECT_DISTORTION, DistortionStateFactory_getFactory }, + { AL_EFFECT_ECHO, EchoStateFactory_getFactory }, + { AL_EFFECT_EQUALIZER, EqualizerStateFactory_getFactory }, + { AL_EFFECT_FLANGER, FlangerStateFactory_getFactory }, + { AL_EFFECT_RING_MODULATOR, ModulatorStateFactory_getFactory }, + { AL_EFFECT_PITCH_SHIFTER, PshifterStateFactory_getFactory}, + { AL_EFFECT_DEDICATED_DIALOGUE, DedicatedStateFactory_getFactory }, + { AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedStateFactory_getFactory } +}; + +static inline EffectStateFactory *getFactoryByType(ALenum type) { - ALeffectStateFactory* (*getFactory)(void) = LookupUIntMapKey(&EffectStateFactoryMap, type); - if(getFactory != NULL) - return getFactory(); + size_t i; + for(i = 0;i < COUNTOF(FactoryList);i++) + { + if(FactoryList[i].Type == type) + return FactoryList[i].GetFactory(); + } return NULL; } static void ALeffectState_IncRef(ALeffectState *state); -static void ALeffectState_DecRef(ALeffectState *state); + + +static inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) +{ + id--; + if(UNLIKELY(id >= VECTOR_SIZE(context->EffectSlotList))) + return NULL; + return VECTOR_ELEM(context->EffectSlotList, id); +} + +static inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) +{ + EffectSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->EffectList))) + return NULL; + sublist = &VECTOR_ELEM(device->EffectList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Effects + slidx; +} + #define DO_UPDATEPROPS() do { \ if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) \ - UpdateEffectSlotProps(slot); \ + UpdateEffectSlotProps(slot, context); \ else \ - slot->NeedsUpdate = AL_TRUE; \ + ATOMIC_FLAG_CLEAR(&slot->PropsClean, almemory_order_release); \ } while(0) AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { + ALCdevice *device; ALCcontext *context; - ALeffectslot *first, *last; ALsizei cur; - ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d effect slots", n); + if(n == 0) goto done; - first = last = NULL; + LockEffectSlotList(context); + device = context->Device; + if(device->AuxiliaryEffectSlotMax - VECTOR_SIZE(context->EffectSlotList) < (ALuint)n) + { + UnlockEffectSlotList(context); + SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, "Exceeding %u auxiliary effect slot limit", + device->AuxiliaryEffectSlotMax); + } for(cur = 0;cur < n;cur++) { - ALeffectslot *slot = al_calloc(16, sizeof(ALeffectslot)); - err = AL_OUT_OF_MEMORY; + ALeffectslotPtr *iter = VECTOR_BEGIN(context->EffectSlotList); + ALeffectslotPtr *end = VECTOR_END(context->EffectSlotList); + ALeffectslot *slot = NULL; + ALenum err = AL_OUT_OF_MEMORY; + + for(;iter != end;iter++) + { + if(!*iter) + break; + } + if(iter == end) + { + VECTOR_PUSH_BACK(context->EffectSlotList, NULL); + iter = &VECTOR_BACK(context->EffectSlotList); + } + slot = al_calloc(16, sizeof(ALeffectslot)); if(!slot || (err=InitEffectSlot(slot)) != AL_NO_ERROR) { al_free(slot); - alDeleteAuxiliaryEffectSlots(cur, effectslots); - SET_ERROR_AND_GOTO(context, err, done); - } - - err = NewThunkEntry(&slot->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&context->EffectSlotMap, slot->id, slot); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(slot->id); - ALeffectState_DecRef(slot->Effect.State); - if(slot->Params.EffectState) - ALeffectState_DecRef(slot->Params.EffectState); - al_free(slot); + UnlockEffectSlotList(context); alDeleteAuxiliaryEffectSlots(cur, effectslots); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, done, "Effect slot object allocation failed"); } - aluInitEffectPanning(slot); - if(!first) first = slot; - if(last) ATOMIC_STORE(&last->next, slot, almemory_order_relaxed); - last = slot; + slot->id = (iter - VECTOR_BEGIN(context->EffectSlotList)) + 1; + *iter = slot; effectslots[cur] = slot->id; } - if(last != NULL) - { - ALeffectslot *root = ATOMIC_LOAD(&context->ActiveAuxSlotList); - do { - ATOMIC_STORE(&last->next, root, almemory_order_relaxed); - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALeffectslot*, &context->ActiveAuxSlotList, - &root, first)); - } + AddActiveEffectSlots(effectslots, n, context); + UnlockEffectSlotList(context); done: ALCcontext_DecRef(context); @@ -134,25 +175,29 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint * context = GetContextRef(); if(!context) return; - LockEffectSlotsWrite(context); + LockEffectSlotList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d effect slots", n); + if(n == 0) goto done; + for(i = 0;i < n;i++) { if((slot=LookupEffectSlot(context, effectslots[i])) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", + effectslots[i]); if(ReadRef(&slot->ref) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Deleting in-use effect slot %u", + effectslots[i]); } // All effectslots are valid + RemoveActiveEffectSlots(effectslots, n, context); for(i = 0;i < n;i++) { - if((slot=RemoveEffectSlot(context, effectslots[i])) == NULL) + if((slot=LookupEffectSlot(context, effectslots[i])) == NULL) continue; - FreeThunkEntry(slot->id); + VECTOR_ELEM(context->EffectSlotList, effectslots[i]-1) = NULL; - RemoveEffectSlotList(context, slot); DeinitEffectSlot(slot); memset(slot, 0, sizeof(*slot)); @@ -160,7 +205,7 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint * } done: - UnlockEffectSlotsWrite(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -172,9 +217,9 @@ AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot) context = GetContextRef(); if(!context) return AL_FALSE; - LockEffectSlotsRead(context); + LockEffectSlotList(context); ret = (LookupEffectSlot(context, effectslot) ? AL_TRUE : AL_FALSE); - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); @@ -192,43 +237,45 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - LockEffectSlotsRead(context); + almtx_lock(&context->PropLock); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_EFFECT: device = context->Device; - LockEffectsRead(device); + LockEffectList(device); effect = (value ? LookupEffect(device, value) : NULL); if(!(value == 0 || effect != NULL)) { - UnlockEffectsRead(device); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + UnlockEffectList(device); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid effect ID %u", value); } - err = InitializeEffect(device, slot, effect); - UnlockEffectsRead(device); + err = InitializeEffect(context, slot, effect); + UnlockEffectList(device); if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, done, "Effect initialization failed"); break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(!(value == AL_TRUE || value == AL_FALSE)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, + "Effect slot auxiliary send auto out of range"); slot->AuxSendAuto = value; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid effect slot integer property 0x%04x", + param); } DO_UPDATEPROPS(); done: - UnlockEffectSlotsRead(context); - WriteUnlock(&context->PropLock); + UnlockEffectSlotList(context); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -247,17 +294,18 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -269,26 +317,27 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - LockEffectSlotsRead(context); + almtx_lock(&context->PropLock); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_GAIN: if(!(value >= 0.0f && value <= 1.0f)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Effect slot gain out of range"); slot->Gain = value; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid effect slot float property 0x%04x", + param); } DO_UPDATEPROPS(); done: - UnlockEffectSlotsRead(context); - WriteUnlock(&context->PropLock); + UnlockEffectSlotList(context); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -306,17 +355,18 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum para context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -328,9 +378,9 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: @@ -338,11 +388,11 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer property 0x%04x", param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -361,17 +411,18 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -383,9 +434,9 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_GAIN: @@ -393,11 +444,11 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float property 0x%04x", param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -415,76 +466,32 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } -static void RemoveEffectSlotList(ALCcontext *context, ALeffectslot *slot) -{ - ALCdevice *device = context->Device; - ALeffectslot *root, *next; - - root = slot; - next = ATOMIC_LOAD(&slot->next); - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALeffectslot*, &context->ActiveAuxSlotList, &root, next)) - { - ALeffectslot *cur; - do { - cur = root; - root = slot; - } while(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALeffectslot*, &cur->next, &root, next)); - } - /* Wait for any mix that may be using these effect slots to finish. */ - while((ReadRef(&device->MixCount)&1) != 0) - althrd_yield(); -} - - -void InitEffectFactoryMap(void) -{ - InitUIntMap(&EffectStateFactoryMap, ~0); - - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_NULL, ALnullStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_EAXREVERB, ALreverbStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_REVERB, ALreverbStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_CHORUS, ALchorusStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_COMPRESSOR, ALcompressorStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_DISTORTION, ALdistortionStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_ECHO, ALechoStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_EQUALIZER, ALequalizerStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_FLANGER, ALflangerStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_RING_MODULATOR, ALmodulatorStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_DEDICATED_DIALOGUE, ALdedicatedStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, ALdedicatedStateFactory_getFactory); -} - -void DeinitEffectFactoryMap(void) -{ - ResetUIntMap(&EffectStateFactoryMap); -} - - -ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *effect) +ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect) { + ALCdevice *Device = Context->Device; ALenum newtype = (effect ? effect->type : AL_EFFECT_NULL); struct ALeffectslotProps *props; ALeffectState *State; if(newtype != EffectSlot->Effect.Type) { - ALeffectStateFactory *factory; - FPUCtl oldMode; + EffectStateFactory *factory; factory = getFactoryByType(newtype); if(!factory) @@ -492,22 +499,22 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e ERR("Failed to find factory for effect type 0x%04x\n", newtype); return AL_INVALID_ENUM; } - State = V0(factory,create)(); + State = EffectStateFactory_create(factory); if(!State) return AL_OUT_OF_MEMORY; - SetMixerFPUMode(&oldMode); + START_MIXER_MODE(); almtx_lock(&Device->BackendLock); State->OutBuffer = Device->Dry.Buffer; State->OutChannels = Device->Dry.NumChannels; if(V(State,deviceUpdate)(Device) == AL_FALSE) { almtx_unlock(&Device->BackendLock); - RestoreFPUMode(&oldMode); + LEAVE_MIXER_MODE(); ALeffectState_DecRef(State); return AL_OUT_OF_MEMORY; } almtx_unlock(&Device->BackendLock); - RestoreFPUMode(&oldMode); + END_MIXER_MODE(); if(!effect) { @@ -527,11 +534,12 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e EffectSlot->Effect.Props = effect->Props; /* Remove state references from old effect slot property updates. */ - props = ATOMIC_LOAD(&EffectSlot->FreeList); + props = ATOMIC_LOAD_SEQ(&Context->FreeEffectslotProps); while(props) { - State = ATOMIC_EXCHANGE(ALeffectState*, &props->State, NULL, almemory_order_relaxed); - if(State) ALeffectState_DecRef(State); + if(props->State) + ALeffectState_DecRef(props->State); + props->State = NULL; props = ATOMIC_LOAD(&props->next, almemory_order_relaxed); } @@ -546,7 +554,7 @@ static void ALeffectState_IncRef(ALeffectState *state) TRACEREF("%p increasing refcount to %u\n", state, ref); } -static void ALeffectState_DecRef(ALeffectState *state) +void ALeffectState_DecRef(ALeffectState *state) { uint ref; ref = DecrementRef(&state->Ref); @@ -568,23 +576,110 @@ void ALeffectState_Destruct(ALeffectState *UNUSED(state)) } +static void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context) +{ + struct ALeffectslotArray *curarray = ATOMIC_LOAD(&context->ActiveAuxSlots, + almemory_order_acquire); + struct ALeffectslotArray *newarray = NULL; + ALsizei newcount = curarray->count + count; + ALCdevice *device = context->Device; + ALsizei i, j; + + /* Insert the new effect slots into the head of the array, followed by the + * existing ones. + */ + newarray = al_calloc(DEF_ALIGN, FAM_SIZE(struct ALeffectslotArray, slot, newcount)); + newarray->count = newcount; + for(i = 0;i < count;i++) + newarray->slot[i] = LookupEffectSlot(context, slotids[i]); + for(j = 0;i < newcount;) + newarray->slot[i++] = curarray->slot[j++]; + /* Remove any duplicates (first instance of each will be kept). */ + for(i = 1;i < newcount;i++) + { + for(j = i;j != 0;) + { + if(UNLIKELY(newarray->slot[i] == newarray->slot[--j])) + { + newcount--; + for(j = i;j < newcount;j++) + newarray->slot[j] = newarray->slot[j+1]; + i--; + break; + } + } + } + + /* Reallocate newarray if the new size ended up smaller from duplicate + * removal. + */ + if(UNLIKELY(newcount < newarray->count)) + { + struct ALeffectslotArray *tmpnewarray = al_calloc(DEF_ALIGN, + FAM_SIZE(struct ALeffectslotArray, slot, newcount)); + memcpy(tmpnewarray, newarray, FAM_SIZE(struct ALeffectslotArray, slot, newcount)); + al_free(newarray); + newarray = tmpnewarray; + newarray->count = newcount; + } + + curarray = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel); + while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) + althrd_yield(); + al_free(curarray); +} + +static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context) +{ + struct ALeffectslotArray *curarray = ATOMIC_LOAD(&context->ActiveAuxSlots, + almemory_order_acquire); + struct ALeffectslotArray *newarray = NULL; + ALCdevice *device = context->Device; + ALsizei i, j; + + /* Don't shrink the allocated array size since we don't know how many (if + * any) of the effect slots to remove are in the array. + */ + newarray = al_calloc(DEF_ALIGN, FAM_SIZE(struct ALeffectslotArray, slot, curarray->count)); + newarray->count = 0; + for(i = 0;i < curarray->count;i++) + { + /* Insert this slot into the new array only if it's not one to remove. */ + ALeffectslot *slot = curarray->slot[i]; + for(j = count;j != 0;) + { + if(slot->id == slotids[--j]) + goto skip_ins; + } + newarray->slot[newarray->count++] = slot; + skip_ins: ; + } + + /* TODO: Could reallocate newarray now that we know it's needed size. */ + + curarray = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel); + while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) + althrd_yield(); + al_free(curarray); +} + + ALenum InitEffectSlot(ALeffectslot *slot) { - ALeffectStateFactory *factory; + EffectStateFactory *factory; slot->Effect.Type = AL_EFFECT_NULL; factory = getFactoryByType(AL_EFFECT_NULL); - if(!(slot->Effect.State=V0(factory,create)())) - return AL_OUT_OF_MEMORY; + slot->Effect.State = EffectStateFactory_create(factory); + if(!slot->Effect.State) return AL_OUT_OF_MEMORY; - slot->NeedsUpdate = AL_FALSE; slot->Gain = 1.0; slot->AuxSendAuto = AL_TRUE; + ATOMIC_FLAG_TEST_AND_SET(&slot->PropsClean, almemory_order_relaxed); InitRef(&slot->ref, 0); ATOMIC_INIT(&slot->Update, NULL); - ATOMIC_INIT(&slot->FreeList, NULL); slot->Params.Gain = 1.0f; slot->Params.AuxSendAuto = AL_TRUE; @@ -592,52 +687,38 @@ ALenum InitEffectSlot(ALeffectslot *slot) slot->Params.EffectState = slot->Effect.State; slot->Params.RoomRolloff = 0.0f; slot->Params.DecayTime = 0.0f; + slot->Params.DecayLFRatio = 0.0f; + slot->Params.DecayHFRatio = 0.0f; + slot->Params.DecayHFLimit = AL_FALSE; slot->Params.AirAbsorptionGainHF = 1.0f; - ATOMIC_INIT(&slot->next, NULL); - return AL_NO_ERROR; } void DeinitEffectSlot(ALeffectslot *slot) { struct ALeffectslotProps *props; - ALeffectState *state; - size_t count = 0; - props = ATOMIC_LOAD(&slot->Update); + props = ATOMIC_LOAD_SEQ(&slot->Update); if(props) { - state = ATOMIC_LOAD(&props->State, almemory_order_relaxed); - if(state) ALeffectState_DecRef(state); + if(props->State) ALeffectState_DecRef(props->State); TRACE("Freed unapplied AuxiliaryEffectSlot update %p\n", props); al_free(props); } - props = ATOMIC_LOAD(&slot->FreeList, almemory_order_relaxed); - while(props) - { - struct ALeffectslotProps *next; - state = ATOMIC_LOAD(&props->State, almemory_order_relaxed); - next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - if(state) ALeffectState_DecRef(state); - al_free(props); - props = next; - ++count; - } - TRACE("Freed "SZFMT" AuxiliaryEffectSlot property object%s\n", count, (count==1)?"":"s"); ALeffectState_DecRef(slot->Effect.State); if(slot->Params.EffectState) ALeffectState_DecRef(slot->Params.EffectState); } -void UpdateEffectSlotProps(ALeffectslot *slot) +void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) { struct ALeffectslotProps *props; ALeffectState *oldstate; /* Get an unused property container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&slot->FreeList, almemory_order_relaxed); + props = ATOMIC_LOAD(&context->FreeEffectslotProps, almemory_order_relaxed); if(!props) props = al_calloc(16, sizeof(*props)); else @@ -645,37 +726,31 @@ void UpdateEffectSlotProps(ALeffectslot *slot) struct ALeffectslotProps *next; do { next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*, - &slot->FreeList, &props, next, almemory_order_seq_cst, - almemory_order_consume) == 0); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeEffectslotProps, &props, next, + almemory_order_seq_cst, almemory_order_acquire) == 0); } /* Copy in current property values. */ - ATOMIC_STORE(&props->Gain, slot->Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->AuxSendAuto, slot->AuxSendAuto, almemory_order_relaxed); + props->Gain = slot->Gain; + props->AuxSendAuto = slot->AuxSendAuto; - ATOMIC_STORE(&props->Type, slot->Effect.Type, almemory_order_relaxed); + props->Type = slot->Effect.Type; props->Props = slot->Effect.Props; /* Swap out any stale effect state object there may be in the container, to * delete it. */ ALeffectState_IncRef(slot->Effect.State); - oldstate = ATOMIC_EXCHANGE(ALeffectState*, &props->State, slot->Effect.State, - almemory_order_relaxed); + oldstate = props->State; + props->State = slot->Effect.State; /* Set the new container for updating internal parameters. */ - props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, props, - almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&slot->Update, props, almemory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the * freelist. */ - struct ALeffectslotProps *first = ATOMIC_LOAD(&slot->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*, - &slot->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALeffectslotProps*, &context->FreeEffectslotProps, props); } if(oldstate) @@ -684,32 +759,38 @@ void UpdateEffectSlotProps(ALeffectslot *slot) void UpdateAllEffectSlotProps(ALCcontext *context) { - ALeffectslot *slot; + struct ALeffectslotArray *auxslots; + ALsizei i; - LockEffectSlotsRead(context); - slot = ATOMIC_LOAD(&context->ActiveAuxSlotList); - while(slot) + LockEffectSlotList(context); + auxslots = ATOMIC_LOAD(&context->ActiveAuxSlots, almemory_order_acquire); + for(i = 0;i < auxslots->count;i++) { - if(slot->NeedsUpdate) - UpdateEffectSlotProps(slot); - slot->NeedsUpdate = AL_FALSE; - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); + ALeffectslot *slot = auxslots->slot[i]; + if(!ATOMIC_FLAG_TEST_AND_SET(&slot->PropsClean, almemory_order_acq_rel)) + UpdateEffectSlotProps(slot, context); } - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); } -ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) +ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *context) { - ALsizei pos; - for(pos = 0;pos < Context->EffectSlotMap.size;pos++) + ALeffectslotPtr *iter = VECTOR_BEGIN(context->EffectSlotList); + ALeffectslotPtr *end = VECTOR_END(context->EffectSlotList); + size_t leftover = 0; + + for(;iter != end;iter++) { - ALeffectslot *temp = Context->EffectSlotMap.values[pos]; - Context->EffectSlotMap.values[pos] = NULL; + ALeffectslot *slot = *iter; + if(!slot) continue; + *iter = NULL; - DeinitEffectSlot(temp); + DeinitEffectSlot(slot); - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALeffectslot)); - al_free(temp); + memset(slot, 0, sizeof(*slot)); + al_free(slot); + ++leftover; } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" AuxiliaryEffectSlot%s\n", context, leftover, (leftover==1)?"":"s"); } diff --git a/Engine/lib/openal-soft/OpenAL32/alBuffer.c b/Engine/lib/openal-soft/OpenAL32/alBuffer.c index 193cfeaa9..ed7124348 100644 --- a/Engine/lib/openal-soft/OpenAL32/alBuffer.c +++ b/Engine/lib/openal-soft/OpenAL32/alBuffer.c @@ -32,24 +32,41 @@ #include "alu.h" #include "alError.h" #include "alBuffer.h" -#include "alThunk.h" #include "sample_cvt.h" -extern inline void LockBuffersRead(ALCdevice *device); -extern inline void UnlockBuffersRead(ALCdevice *device); -extern inline void LockBuffersWrite(ALCdevice *device); -extern inline void UnlockBuffersWrite(ALCdevice *device); -extern inline struct ALbuffer *LookupBuffer(ALCdevice *device, ALuint id); -extern inline struct ALbuffer *RemoveBuffer(ALCdevice *device, ALuint id); -extern inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type); -extern inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); +extern inline void LockBufferList(ALCdevice *device); +extern inline void UnlockBufferList(ALCdevice *device); +extern inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type); +extern inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); -static ALboolean IsValidType(ALenum type); -static ALboolean IsValidChannels(ALenum channels); +static ALbuffer *AllocBuffer(ALCcontext *context); +static void FreeBuffer(ALCdevice *device, ALbuffer *buffer); +static const ALchar *NameFromUserFmtType(enum UserFmtType type); +static void LoadData(ALCcontext *context, ALbuffer *buffer, ALuint freq, ALsizei size, + enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, + const ALvoid *data, ALbitfieldSOFT access); static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, enum UserFmtType *type); -static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type); -static ALboolean SanitizeAlignment(enum UserFmtType type, ALsizei *align); +static ALsizei SanitizeAlignment(enum UserFmtType type, ALsizei align); + +static inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) +{ + BufferSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->BufferList))) + return NULL; + sublist = &VECTOR_ELEM(device->BufferList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Buffers + slidx; +} + + +#define INVALID_STORAGE_MASK ~(AL_MAP_READ_BIT_SOFT | AL_MAP_WRITE_BIT_SOFT | AL_PRESERVE_DATA_BIT_SOFT | AL_MAP_PERSISTENT_BIT_SOFT) +#define MAP_READ_WRITE_FLAGS (AL_MAP_READ_BIT_SOFT | AL_MAP_WRITE_BIT_SOFT) +#define INVALID_MAP_FLAGS ~(AL_MAP_READ_BIT_SOFT | AL_MAP_WRITE_BIT_SOFT | AL_MAP_PERSISTENT_BIT_SOFT) AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) @@ -61,11 +78,10 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d buffers", n); + else for(cur = 0;cur < n;cur++) { - ALbuffer *buffer = NewBuffer(context); + ALbuffer *buffer = AllocBuffer(context); if(!buffer) { alDeleteBuffers(cur, buffers); @@ -75,7 +91,6 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) buffers[cur] = buffer->id; } -done: ALCcontext_DecRef(context); } @@ -91,30 +106,38 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) device = context->Device; - LockBuffersWrite(device); - if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + LockBufferList(device); + if(UNLIKELY(n < 0)) + { + alSetError(context, AL_INVALID_VALUE, "Deleting %d buffers", n); + goto done; + } for(i = 0;i < n;i++) { if(!buffers[i]) continue; - /* Check for valid Buffer ID */ + /* Check for valid Buffer ID, and make sure it's not in use. */ if((ALBuf=LookupBuffer(device, buffers[i])) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + { + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffers[i]); + goto done; + } if(ReadRef(&ALBuf->ref) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + { + alSetError(context, AL_INVALID_OPERATION, "Deleting in-use buffer %u", buffers[i]); + goto done; + } } - for(i = 0;i < n;i++) { if((ALBuf=LookupBuffer(device, buffers[i])) != NULL) - DeleteBuffer(device, ALBuf); + FreeBuffer(device, ALBuf); } done: - UnlockBuffersWrite(device); + UnlockBufferList(device); ALCcontext_DecRef(context); } @@ -126,10 +149,10 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) context = GetContextRef(); if(!context) return AL_FALSE; - LockBuffersRead(context->Device); + LockBufferList(context->Device); ret = ((!buffer || LookupBuffer(context->Device, buffer)) ? AL_TRUE : AL_FALSE); - UnlockBuffersRead(context->Device); + UnlockBufferList(context->Device); ALCcontext_DecRef(context); @@ -138,399 +161,297 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq) +{ alBufferStorageSOFT(buffer, format, data, size, freq, 0); } + +AL_API void AL_APIENTRY alBufferStorageSOFT(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq, ALbitfieldSOFT flags) { enum UserFmtChannels srcchannels = UserFmtMono; - enum UserFmtType srctype = UserFmtByte; + enum UserFmtType srctype = UserFmtUByte; ALCdevice *device; ALCcontext *context; ALbuffer *albuf; - ALenum newformat = AL_NONE; - ALuint framesize; - ALsizei align; - ALenum err; context = GetContextRef(); if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(size >= 0 && freq > 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(size < 0)) + alSetError(context, AL_INVALID_VALUE, "Negative storage size %d", size); + else if(UNLIKELY(freq < 1)) + alSetError(context, AL_INVALID_VALUE, "Invalid sample rate %d", freq); + else if(UNLIKELY((flags&INVALID_STORAGE_MASK) != 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid storage flags 0x%x", + flags&INVALID_STORAGE_MASK); + else if(UNLIKELY((flags&AL_MAP_PERSISTENT_BIT_SOFT) && !(flags&MAP_READ_WRITE_FLAGS))) + alSetError(context, AL_INVALID_VALUE, + "Declaring persistently mapped storage without read or write access"); + else if(UNLIKELY(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE)) + alSetError(context, AL_INVALID_ENUM, "Invalid format 0x%04x", format); + else + LoadData(context, albuf, freq, size, srcchannels, srctype, data, flags); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(srctype, &align) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(srctype) + UnlockBufferList(device); + ALCcontext_DecRef(context); +} + +AL_API void* AL_APIENTRY alMapBufferSOFT(ALuint buffer, ALsizei offset, ALsizei length, ALbitfieldSOFT access) +{ + void *retval = NULL; + ALCdevice *device; + ALCcontext *context; + ALbuffer *albuf; + + context = GetContextRef(); + if(!context) return retval; + + device = context->Device; + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY((access&INVALID_MAP_FLAGS) != 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid map flags 0x%x", access&INVALID_MAP_FLAGS); + else if(UNLIKELY(!(access&MAP_READ_WRITE_FLAGS))) + alSetError(context, AL_INVALID_VALUE, "Mapping buffer %u without read or write access", + buffer); + else { - case UserFmtByte: - case UserFmtUByte: - case UserFmtShort: - case UserFmtUShort: - case UserFmtFloat: - framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align; - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - err = LoadData(albuf, freq, format, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtInt: - case UserFmtUInt: - case UserFmtByte3: - case UserFmtUByte3: - case UserFmtDouble: - framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align; - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO_FLOAT32; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO_FLOAT32; break; - case UserFmtRear: newformat = AL_FORMAT_REAR32; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD32; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN32; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN32; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN32; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_FLOAT32; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_FLOAT32; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtMulaw: - case UserFmtAlaw: - framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align; - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO16; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO16; break; - case UserFmtRear: newformat = AL_FORMAT_REAR16; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD16; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtIMA4: - framesize = (align-1)/2 + 4; - framesize *= ChannelsFromUserFmt(srcchannels); - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO16; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO16; break; - case UserFmtRear: newformat = AL_FORMAT_REAR16; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD16; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtMSADPCM: - framesize = (align-2)/2 + 7; - framesize *= ChannelsFromUserFmt(srcchannels); - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO16; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO16; break; - case UserFmtRear: newformat = AL_FORMAT_REAR16; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD16; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; + ALbitfieldSOFT unavailable = (albuf->Access^access) & access; + if(UNLIKELY(ReadRef(&albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT))) + alSetError(context, AL_INVALID_OPERATION, + "Mapping in-use buffer %u without persistent mapping", buffer); + else if(UNLIKELY(albuf->MappedAccess != 0)) + alSetError(context, AL_INVALID_OPERATION, "Mapping already-mapped buffer %u", buffer); + else if(UNLIKELY((unavailable&AL_MAP_READ_BIT_SOFT))) + alSetError(context, AL_INVALID_VALUE, + "Mapping buffer %u for reading without read access", buffer); + else if(UNLIKELY((unavailable&AL_MAP_WRITE_BIT_SOFT))) + alSetError(context, AL_INVALID_VALUE, + "Mapping buffer %u for writing without write access", buffer); + else if(UNLIKELY((unavailable&AL_MAP_PERSISTENT_BIT_SOFT))) + alSetError(context, AL_INVALID_VALUE, + "Mapping buffer %u persistently without persistent access", buffer); + else if(UNLIKELY(offset < 0 || offset >= albuf->OriginalSize || + length <= 0 || length > albuf->OriginalSize - offset)) + alSetError(context, AL_INVALID_VALUE, "Mapping invalid range %d+%d for buffer %u", + offset, length, buffer); + else + { + retval = (ALbyte*)albuf->data + offset; + albuf->MappedAccess = access; + albuf->MappedOffset = offset; + albuf->MappedSize = length; + } } + UnlockBufferList(device); + + ALCcontext_DecRef(context); + return retval; +} + +AL_API void AL_APIENTRY alUnmapBufferSOFT(ALuint buffer) +{ + ALCdevice *device; + ALCcontext *context; + ALbuffer *albuf; + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + LockBufferList(device); + if((albuf=LookupBuffer(device, buffer)) == NULL) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(albuf->MappedAccess == 0) + alSetError(context, AL_INVALID_OPERATION, "Unmapping unmapped buffer %u", buffer); + else + { + albuf->MappedAccess = 0; + albuf->MappedOffset = 0; + albuf->MappedSize = 0; + } + UnlockBufferList(device); + + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alFlushMappedBufferSOFT(ALuint buffer, ALsizei offset, ALsizei length) +{ + ALCdevice *device; + ALCcontext *context; + ALbuffer *albuf; + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!(albuf->MappedAccess&AL_MAP_WRITE_BIT_SOFT))) + alSetError(context, AL_INVALID_OPERATION, + "Flushing buffer %u while not mapped for writing", buffer); + else if(UNLIKELY(offset < albuf->MappedOffset || + offset >= albuf->MappedOffset+albuf->MappedSize || + length <= 0 || length > albuf->MappedOffset+albuf->MappedSize-offset)) + alSetError(context, AL_INVALID_VALUE, "Flushing invalid range %d+%d on buffer %u", + offset, length, buffer); + else + { + /* FIXME: Need to use some method of double-buffering for the mixer and + * app to hold separate memory, which can be safely transfered + * asynchronously. Currently we just say the app shouldn't write where + * OpenAL's reading, and hope for the best... + */ + ATOMIC_THREAD_FENCE(almemory_order_seq_cst); + } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, const ALvoid *data, ALsizei offset, ALsizei length) { enum UserFmtChannels srcchannels = UserFmtMono; - enum UserFmtType srctype = UserFmtByte; + enum UserFmtType srctype = UserFmtUByte; ALCdevice *device; ALCcontext *context; ALbuffer *albuf; - ALuint byte_align; - ALuint channels; - ALuint bytes; - ALsizei align; context = GetContextRef(); if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(length >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - - WriteLock(&albuf->lock); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(srctype, &align) == AL_FALSE) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(srcchannels != albuf->OriginalChannels || srctype != albuf->OriginalType) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(align != albuf->OriginalAlign) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - - if(albuf->OriginalType == UserFmtIMA4) - { - byte_align = (albuf->OriginalAlign-1)/2 + 4; - byte_align *= ChannelsFromUserFmt(albuf->OriginalChannels); - } - else if(albuf->OriginalType == UserFmtMSADPCM) - { - byte_align = (albuf->OriginalAlign-2)/2 + 7; - byte_align *= ChannelsFromUserFmt(albuf->OriginalChannels); - } + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE)) + alSetError(context, AL_INVALID_ENUM, "Invalid format 0x%04x", format); else { - byte_align = albuf->OriginalAlign; - byte_align *= FrameSizeFromUserFmt(albuf->OriginalChannels, - albuf->OriginalType); + ALsizei unpack_align, align; + ALsizei byte_align; + ALsizei frame_size; + ALsizei num_chans; + void *dst; + + unpack_align = ATOMIC_LOAD_SEQ(&albuf->UnpackAlign); + align = SanitizeAlignment(srctype, unpack_align); + if(UNLIKELY(align < 1)) + alSetError(context, AL_INVALID_VALUE, "Invalid unpack alignment %d", unpack_align); + else if(UNLIKELY((long)srcchannels != (long)albuf->FmtChannels || + srctype != albuf->OriginalType)) + alSetError(context, AL_INVALID_ENUM, "Unpacking data with mismatched format"); + else if(UNLIKELY(align != albuf->OriginalAlign)) + alSetError(context, AL_INVALID_VALUE, + "Unpacking data with alignment %u does not match original alignment %u", + align, albuf->OriginalAlign); + else if(UNLIKELY(albuf->MappedAccess != 0)) + alSetError(context, AL_INVALID_OPERATION, "Unpacking data into mapped buffer %u", + buffer); + else + { + num_chans = ChannelsFromFmt(albuf->FmtChannels); + frame_size = num_chans * BytesFromFmt(albuf->FmtType); + if(albuf->OriginalType == UserFmtIMA4) + byte_align = ((align-1)/2 + 4) * num_chans; + else if(albuf->OriginalType == UserFmtMSADPCM) + byte_align = ((align-2)/2 + 7) * num_chans; + else + byte_align = align * frame_size; + + if(UNLIKELY(offset < 0 || length < 0 || offset > albuf->OriginalSize || + length > albuf->OriginalSize-offset)) + alSetError(context, AL_INVALID_VALUE, "Invalid data sub-range %d+%d on buffer %u", + offset, length, buffer); + else if(UNLIKELY((offset%byte_align) != 0)) + alSetError(context, AL_INVALID_VALUE, + "Sub-range offset %d is not a multiple of frame size %d (%d unpack alignment)", + offset, byte_align, align); + else if(UNLIKELY((length%byte_align) != 0)) + alSetError(context, AL_INVALID_VALUE, + "Sub-range length %d is not a multiple of frame size %d (%d unpack alignment)", + length, byte_align, align); + else + { + /* offset -> byte offset, length -> sample count */ + offset = offset/byte_align * align * frame_size; + length = length/byte_align * align; + + dst = (ALbyte*)albuf->data + offset; + if(srctype == UserFmtIMA4 && albuf->FmtType == FmtShort) + Convert_ALshort_ALima4(dst, data, num_chans, length, align); + else if(srctype == UserFmtMSADPCM && albuf->FmtType == FmtShort) + Convert_ALshort_ALmsadpcm(dst, data, num_chans, length, align); + else + { + assert((long)srctype == (long)albuf->FmtType); + memcpy(dst, data, length*frame_size); + } + } + } } + UnlockBufferList(device); - if(offset > albuf->OriginalSize || length > albuf->OriginalSize-offset || - (offset%byte_align) != 0 || (length%byte_align) != 0) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - channels = ChannelsFromFmt(albuf->FmtChannels); - bytes = BytesFromFmt(albuf->FmtType); - /* offset -> byte offset, length -> sample count */ - offset = offset/byte_align * channels*bytes; - length = length/byte_align * albuf->OriginalAlign; - - ConvertData((char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - data, srctype, channels, length, align); - WriteUnlock(&albuf->lock); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, - ALuint samplerate, ALenum internalformat, ALsizei samples, - ALenum channels, ALenum type, const ALvoid *data) +AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint UNUSED(buffer), + ALuint UNUSED(samplerate), ALenum UNUSED(internalformat), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), const ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; - ALenum err; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && samplerate != 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE || IsValidChannels(channels) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_OPERATION, "alBufferSamplesSOFT not supported"); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(type, &align) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if((samples%align) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - err = LoadData(albuf, samplerate, internalformat, samples, - channels, type, data, align, AL_FALSE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, - ALsizei offset, ALsizei samples, - ALenum channels, ALenum type, const ALvoid *data) +AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint UNUSED(buffer), + ALsizei UNUSED(offset), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), const ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_OPERATION, "alBufferSubSamplesSOFT not supported"); - WriteLock(&albuf->lock); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(type, &align) == AL_FALSE) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(channels != (ALenum)albuf->FmtChannels) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(offset > albuf->SampleLen || samples > albuf->SampleLen-offset) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if((samples%align) != 0) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - /* offset -> byte offset */ - offset *= FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ConvertData((char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - data, type, ChannelsFromFmt(albuf->FmtChannels), samples, align); - WriteUnlock(&albuf->lock); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, - ALsizei offset, ALsizei samples, - ALenum channels, ALenum type, ALvoid *data) +AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint UNUSED(buffer), + ALsizei UNUSED(offset), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_OPERATION, "alGetBufferSamplesSOFT not supported"); - ReadLock(&albuf->lock); - align = ATOMIC_LOAD(&albuf->PackAlign); - if(SanitizeAlignment(type, &align) == AL_FALSE) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(channels != (ALenum)albuf->FmtChannels) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(offset > albuf->SampleLen || samples > albuf->SampleLen-offset) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if((samples%align) != 0) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - /* offset -> byte offset */ - offset *= FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ConvertData(data, type, (char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - ChannelsFromFmt(albuf->FmtChannels), samples, align); - ReadUnlock(&albuf->lock); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format) +AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum UNUSED(format)) { - enum FmtChannels dstchannels; - enum FmtType dsttype; ALCcontext *context; - ALboolean ret; context = GetContextRef(); if(!context) return AL_FALSE; - ret = DecomposeFormat(format, &dstchannels, &dsttype); + alSetError(context, AL_INVALID_OPERATION, "alIsBufferFormatSupportedSOFT not supported"); ALCcontext_DecRef(context); - - return ret; + return AL_FALSE; } @@ -543,18 +464,16 @@ AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat UNUSED(va if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -568,18 +487,16 @@ AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat UNUSED(v if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -593,20 +510,18 @@ AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *v if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -621,30 +536,30 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value) if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: - if(!(value >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - ATOMIC_STORE(&albuf->UnpackAlign, value); + if(UNLIKELY(value < 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid unpack block alignment %d", value); + else + ATOMIC_STORE_SEQ(&albuf->UnpackAlign, value); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: - if(!(value >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - ATOMIC_STORE(&albuf->PackAlign, value); + if(UNLIKELY(value < 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid pack block alignment %d", value); + else + ATOMIC_STORE_SEQ(&albuf->PackAlign, value); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -658,16 +573,16 @@ AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint UNUSED(val if(!context) return; device = context->Device; - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param); } + UnlockBufferList(device); -done: ALCcontext_DecRef(context); } @@ -693,39 +608,33 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_LOOP_POINTS_SOFT: - WriteLock(&albuf->lock); - if(ReadRef(&albuf->ref) != 0) + if(UNLIKELY(ReadRef(&albuf->ref) != 0)) + alSetError(context, AL_INVALID_OPERATION, "Modifying in-use buffer %u's loop points", + buffer); + else if(UNLIKELY(values[0] >= values[1] || values[0] < 0 || values[1] > albuf->SampleLen)) + alSetError(context, AL_INVALID_VALUE, "Invalid loop point range %d -> %d o buffer %u", + values[0], values[1], buffer); + else { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + albuf->LoopStart = values[0]; + albuf->LoopEnd = values[1]; } - if(values[0] >= values[1] || values[0] < 0 || - values[1] > albuf->SampleLen) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - albuf->LoopStart = values[0]; - albuf->LoopEnd = values[1]; - WriteUnlock(&albuf->lock); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x", + param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -740,29 +649,18 @@ AL_API ALvoid AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *val if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { - case AL_SEC_LENGTH_SOFT: - ReadLock(&albuf->lock); - if(albuf->SampleLen != 0) - *value = albuf->SampleLen / (ALfloat)albuf->Frequency; - else - *value = 0.0f; - ReadUnlock(&albuf->lock); - break; - default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -776,20 +674,18 @@ AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *valu if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value1 || !value2 || !value3)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -810,20 +706,18 @@ AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *valu if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -838,13 +732,12 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_FREQUENCY: *value = albuf->Frequency; @@ -859,38 +752,23 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value break; case AL_SIZE: - ReadLock(&albuf->lock); *value = albuf->SampleLen * FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ReadUnlock(&albuf->lock); - break; - - case AL_INTERNAL_FORMAT_SOFT: - *value = albuf->Format; - break; - - case AL_BYTE_LENGTH_SOFT: - *value = albuf->OriginalSize; - break; - - case AL_SAMPLE_LENGTH_SOFT: - *value = albuf->SampleLen; break; case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: - *value = ATOMIC_LOAD(&albuf->UnpackAlign); + *value = ATOMIC_LOAD_SEQ(&albuf->UnpackAlign); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: - *value = ATOMIC_LOAD(&albuf->PackAlign); + *value = ATOMIC_LOAD_SEQ(&albuf->PackAlign); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -904,20 +782,18 @@ AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1 if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value1 || !value2 || !value3)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -947,65 +823,146 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_LOOP_POINTS_SOFT: - ReadLock(&albuf->lock); values[0] = albuf->LoopStart; values[1] = albuf->LoopEnd; - ReadUnlock(&albuf->lock); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x", + param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } +static const ALchar *NameFromUserFmtType(enum UserFmtType type) +{ + switch(type) + { + case UserFmtUByte: return "Unsigned Byte"; + case UserFmtShort: return "Signed Short"; + case UserFmtFloat: return "Float32"; + case UserFmtDouble: return "Float64"; + case UserFmtMulaw: return "muLaw"; + case UserFmtAlaw: return "aLaw"; + case UserFmtIMA4: return "IMA4 ADPCM"; + case UserFmtMSADPCM: return "MSADPCM"; + } + return ""; +} + /* * LoadData * - * Loads the specified data into the buffer, using the specified formats. - * Currently, the new format must have the same channel configuration as the - * original format. + * Loads the specified data into the buffer, using the specified format. */ -ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei frames, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data, ALsizei align, ALboolean storesrc) +static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei size, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data, ALbitfieldSOFT access) { enum FmtChannels DstChannels = FmtMono; - enum FmtType DstType = FmtByte; - ALuint NewChannels, NewBytes; - ALuint64 newsize; + enum FmtType DstType = FmtUByte; + ALsizei NumChannels, FrameSize; + ALsizei SrcByteAlign; + ALsizei unpackalign; + ALsizei newsize; + ALsizei frames; + ALsizei align; - if(DecomposeFormat(NewFormat, &DstChannels, &DstType) == AL_FALSE) - return AL_INVALID_ENUM; - if((long)SrcChannels != (long)DstChannels) - return AL_INVALID_ENUM; + if(UNLIKELY(ReadRef(&ALBuf->ref) != 0 || ALBuf->MappedAccess != 0)) + SETERR_RETURN(context, AL_INVALID_OPERATION,, "Modifying storage for in-use buffer %u", + ALBuf->id); - NewChannels = ChannelsFromFmt(DstChannels); - NewBytes = BytesFromFmt(DstType); - - newsize = frames; - newsize *= NewBytes; - newsize *= NewChannels; - if(newsize > INT_MAX) - return AL_OUT_OF_MEMORY; - - WriteLock(&ALBuf->lock); - if(ReadRef(&ALBuf->ref) != 0) + /* Currently no channel configurations need to be converted. */ + switch(SrcChannels) { - WriteUnlock(&ALBuf->lock); - return AL_INVALID_OPERATION; + case UserFmtMono: DstChannels = FmtMono; break; + case UserFmtStereo: DstChannels = FmtStereo; break; + case UserFmtRear: DstChannels = FmtRear; break; + case UserFmtQuad: DstChannels = FmtQuad; break; + case UserFmtX51: DstChannels = FmtX51; break; + case UserFmtX61: DstChannels = FmtX61; break; + case UserFmtX71: DstChannels = FmtX71; break; + case UserFmtBFormat2D: DstChannels = FmtBFormat2D; break; + case UserFmtBFormat3D: DstChannels = FmtBFormat3D; break; } + if(UNLIKELY((long)SrcChannels != (long)DstChannels)) + SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid format"); + + /* IMA4 and MSADPCM convert to 16-bit short. */ + switch(SrcType) + { + case UserFmtUByte: DstType = FmtUByte; break; + case UserFmtShort: DstType = FmtShort; break; + case UserFmtFloat: DstType = FmtFloat; break; + case UserFmtDouble: DstType = FmtDouble; break; + case UserFmtAlaw: DstType = FmtAlaw; break; + case UserFmtMulaw: DstType = FmtMulaw; break; + case UserFmtIMA4: DstType = FmtShort; break; + case UserFmtMSADPCM: DstType = FmtShort; break; + } + + /* TODO: Currently we can only map samples when they're not converted. To + * allow it would need some kind of double-buffering to hold onto a copy of + * the original data. + */ + if((access&MAP_READ_WRITE_FLAGS)) + { + if(UNLIKELY((long)SrcType != (long)DstType)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "%s samples cannot be mapped", + NameFromUserFmtType(SrcType)); + } + + unpackalign = ATOMIC_LOAD_SEQ(&ALBuf->UnpackAlign); + if(UNLIKELY((align=SanitizeAlignment(SrcType, unpackalign)) < 1)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid unpack alignment %d for %s samples", + unpackalign, NameFromUserFmtType(SrcType)); + + if((access&AL_PRESERVE_DATA_BIT_SOFT)) + { + /* Can only preserve data with the same format and alignment. */ + if(UNLIKELY(ALBuf->FmtChannels != DstChannels || ALBuf->OriginalType != SrcType)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched format"); + if(UNLIKELY(ALBuf->OriginalAlign != align)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched alignment"); + } + + /* Convert the input/source size in bytes to sample frames using the unpack + * block alignment. + */ + if(SrcType == UserFmtIMA4) + SrcByteAlign = ((align-1)/2 + 4) * ChannelsFromUserFmt(SrcChannels); + else if(SrcType == UserFmtMSADPCM) + SrcByteAlign = ((align-2)/2 + 7) * ChannelsFromUserFmt(SrcChannels); + else + SrcByteAlign = align * FrameSizeFromUserFmt(SrcChannels, SrcType); + if(UNLIKELY((size%SrcByteAlign) != 0)) + SETERR_RETURN(context, AL_INVALID_VALUE,, + "Data size %d is not a multiple of frame size %d (%d unpack alignment)", + size, SrcByteAlign, align); + + if(UNLIKELY(size / SrcByteAlign > INT_MAX / align)) + SETERR_RETURN(context, AL_OUT_OF_MEMORY,, + "Buffer size overflow, %d blocks x %d samples per block", size/SrcByteAlign, align); + frames = size / SrcByteAlign * align; + + /* Convert the sample frames to the number of bytes needed for internal + * storage. + */ + NumChannels = ChannelsFromFmt(DstChannels); + FrameSize = NumChannels * BytesFromFmt(DstType); + if(UNLIKELY(frames > INT_MAX/FrameSize)) + SETERR_RETURN(context, AL_OUT_OF_MEMORY,, + "Buffer size overflow, %d frames x %d bytes per frame", frames, FrameSize); + newsize = frames*FrameSize; /* Round up to the next 16-byte multiple. This could reallocate only when * increasing or the new size is less than half the current, but then the @@ -1013,81 +970,67 @@ ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei frames, * usage, and reporting the real size could cause problems for apps that * use AL_SIZE to try to get the buffer's play length. */ - newsize = (newsize+15) & ~0xf; + if(LIKELY(newsize <= INT_MAX-15)) + newsize = (newsize+15) & ~0xf; if(newsize != ALBuf->BytesAlloc) { - void *temp = al_calloc(16, (size_t)newsize); - if(!temp && newsize) + void *temp = al_malloc(16, (size_t)newsize); + if(UNLIKELY(!temp && newsize)) + SETERR_RETURN(context, AL_OUT_OF_MEMORY,, "Failed to allocate %d bytes of storage", + newsize); + if((access&AL_PRESERVE_DATA_BIT_SOFT)) { - WriteUnlock(&ALBuf->lock); - return AL_OUT_OF_MEMORY; + ALsizei tocopy = mini(newsize, ALBuf->BytesAlloc); + if(tocopy > 0) memcpy(temp, ALBuf->data, tocopy); } al_free(ALBuf->data); ALBuf->data = temp; - ALBuf->BytesAlloc = (ALuint)newsize; + ALBuf->BytesAlloc = newsize; } - if(data != NULL) - ConvertData(ALBuf->data, (enum UserFmtType)DstType, data, SrcType, NewChannels, frames, align); - - if(storesrc) + if(SrcType == UserFmtIMA4) { - ALBuf->OriginalChannels = SrcChannels; - ALBuf->OriginalType = SrcType; - if(SrcType == UserFmtIMA4) - { - ALsizei byte_align = ((align-1)/2 + 4) * ChannelsFromUserFmt(SrcChannels); - ALBuf->OriginalSize = frames / align * byte_align; - ALBuf->OriginalAlign = align; - } - else if(SrcType == UserFmtMSADPCM) - { - ALsizei byte_align = ((align-2)/2 + 7) * ChannelsFromUserFmt(SrcChannels); - ALBuf->OriginalSize = frames / align * byte_align; - ALBuf->OriginalAlign = align; - } - else - { - ALBuf->OriginalSize = frames * FrameSizeFromUserFmt(SrcChannels, SrcType); - ALBuf->OriginalAlign = 1; - } + assert(DstType == FmtShort); + if(data != NULL && ALBuf->data != NULL) + Convert_ALshort_ALima4(ALBuf->data, data, NumChannels, frames, align); + ALBuf->OriginalAlign = align; + } + else if(SrcType == UserFmtMSADPCM) + { + assert(DstType == FmtShort); + if(data != NULL && ALBuf->data != NULL) + Convert_ALshort_ALmsadpcm(ALBuf->data, data, NumChannels, frames, align); + ALBuf->OriginalAlign = align; } else { - ALBuf->OriginalChannels = (enum UserFmtChannels)DstChannels; - ALBuf->OriginalType = (enum UserFmtType)DstType; - ALBuf->OriginalSize = frames * NewBytes * NewChannels; - ALBuf->OriginalAlign = 1; + assert((long)SrcType == (long)DstType); + if(data != NULL && ALBuf->data != NULL) + memcpy(ALBuf->data, data, frames*FrameSize); + ALBuf->OriginalAlign = 1; } + ALBuf->OriginalSize = size; + ALBuf->OriginalType = SrcType; ALBuf->Frequency = freq; ALBuf->FmtChannels = DstChannels; ALBuf->FmtType = DstType; - ALBuf->Format = NewFormat; + ALBuf->Access = access; ALBuf->SampleLen = frames; ALBuf->LoopStart = 0; ALBuf->LoopEnd = ALBuf->SampleLen; - - WriteUnlock(&ALBuf->lock); - return AL_NO_ERROR; } -ALuint BytesFromUserFmt(enum UserFmtType type) +ALsizei BytesFromUserFmt(enum UserFmtType type) { switch(type) { - case UserFmtByte: return sizeof(ALbyte); case UserFmtUByte: return sizeof(ALubyte); case UserFmtShort: return sizeof(ALshort); - case UserFmtUShort: return sizeof(ALushort); - case UserFmtInt: return sizeof(ALint); - case UserFmtUInt: return sizeof(ALuint); case UserFmtFloat: return sizeof(ALfloat); case UserFmtDouble: return sizeof(ALdouble); - case UserFmtByte3: return sizeof(ALbyte[3]); - case UserFmtUByte3: return sizeof(ALubyte[3]); case UserFmtMulaw: return sizeof(ALubyte); case UserFmtAlaw: return sizeof(ALubyte); case UserFmtIMA4: break; /* not handled here */ @@ -1095,7 +1038,7 @@ ALuint BytesFromUserFmt(enum UserFmtType type) } return 0; } -ALuint ChannelsFromUserFmt(enum UserFmtChannels chans) +ALsizei ChannelsFromUserFmt(enum UserFmtChannels chans) { switch(chans) { @@ -1190,17 +1133,20 @@ static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, return AL_FALSE; } -ALuint BytesFromFmt(enum FmtType type) +ALsizei BytesFromFmt(enum FmtType type) { switch(type) { - case FmtByte: return sizeof(ALbyte); + case FmtUByte: return sizeof(ALubyte); case FmtShort: return sizeof(ALshort); case FmtFloat: return sizeof(ALfloat); + case FmtDouble: return sizeof(ALdouble); + case FmtMulaw: return sizeof(ALubyte); + case FmtAlaw: return sizeof(ALubyte); } return 0; } -ALuint ChannelsFromFmt(enum FmtChannels chans) +ALsizei ChannelsFromFmt(enum FmtChannels chans) { switch(chans) { @@ -1216,73 +1162,13 @@ ALuint ChannelsFromFmt(enum FmtChannels chans) } return 0; } -static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type) + +static ALsizei SanitizeAlignment(enum UserFmtType type, ALsizei align) { - static const struct { - ALenum format; - enum FmtChannels channels; - enum FmtType type; - } list[] = { - { AL_MONO8_SOFT, FmtMono, FmtByte }, - { AL_MONO16_SOFT, FmtMono, FmtShort }, - { AL_MONO32F_SOFT, FmtMono, FmtFloat }, + if(align < 0) + return 0; - { AL_STEREO8_SOFT, FmtStereo, FmtByte }, - { AL_STEREO16_SOFT, FmtStereo, FmtShort }, - { AL_STEREO32F_SOFT, FmtStereo, FmtFloat }, - - { AL_REAR8_SOFT, FmtRear, FmtByte }, - { AL_REAR16_SOFT, FmtRear, FmtShort }, - { AL_REAR32F_SOFT, FmtRear, FmtFloat }, - - { AL_FORMAT_QUAD8_LOKI, FmtQuad, FmtByte }, - { AL_FORMAT_QUAD16_LOKI, FmtQuad, FmtShort }, - - { AL_QUAD8_SOFT, FmtQuad, FmtByte }, - { AL_QUAD16_SOFT, FmtQuad, FmtShort }, - { AL_QUAD32F_SOFT, FmtQuad, FmtFloat }, - - { AL_5POINT1_8_SOFT, FmtX51, FmtByte }, - { AL_5POINT1_16_SOFT, FmtX51, FmtShort }, - { AL_5POINT1_32F_SOFT, FmtX51, FmtFloat }, - - { AL_6POINT1_8_SOFT, FmtX61, FmtByte }, - { AL_6POINT1_16_SOFT, FmtX61, FmtShort }, - { AL_6POINT1_32F_SOFT, FmtX61, FmtFloat }, - - { AL_7POINT1_8_SOFT, FmtX71, FmtByte }, - { AL_7POINT1_16_SOFT, FmtX71, FmtShort }, - { AL_7POINT1_32F_SOFT, FmtX71, FmtFloat }, - - { AL_BFORMAT2D_8_SOFT, FmtBFormat2D, FmtByte }, - { AL_BFORMAT2D_16_SOFT, FmtBFormat2D, FmtShort }, - { AL_BFORMAT2D_32F_SOFT, FmtBFormat2D, FmtFloat }, - - { AL_BFORMAT3D_8_SOFT, FmtBFormat3D, FmtByte }, - { AL_BFORMAT3D_16_SOFT, FmtBFormat3D, FmtShort }, - { AL_BFORMAT3D_32F_SOFT, FmtBFormat3D, FmtFloat }, - }; - ALuint i; - - for(i = 0;i < COUNTOF(list);i++) - { - if(list[i].format == format) - { - *chans = list[i].channels; - *type = list[i].type; - return AL_TRUE; - } - } - - return AL_FALSE; -} - -static ALboolean SanitizeAlignment(enum UserFmtType type, ALsizei *align) -{ - if(*align < 0) - return AL_FALSE; - - if(*align == 0) + if(align == 0) { if(type == UserFmtIMA4) { @@ -1290,106 +1176,101 @@ static ALboolean SanitizeAlignment(enum UserFmtType type, ALsizei *align) * nVidia and Apple use 64+1 sample frames per block -> block_size=36 bytes per channel * Most PC sound software uses 2040+1 sample frames per block -> block_size=1024 bytes per channel */ - *align = 65; + return 65; } - else if(type == UserFmtMSADPCM) - *align = 64; - else - *align = 1; - return AL_TRUE; + if(type == UserFmtMSADPCM) + return 64; + return 1; } if(type == UserFmtIMA4) { /* IMA4 block alignment must be a multiple of 8, plus 1. */ - return ((*align)&7) == 1; + if((align&7) == 1) return align; + return 0; } if(type == UserFmtMSADPCM) { /* MSADPCM block alignment must be a multiple of 2. */ - /* FIXME: Too strict? Might only require align*channels to be a - * multiple of 2. */ - return ((*align)&1) == 0; + if((align&1) == 0) return align; + return 0; } - return AL_TRUE; + return align; } -static ALboolean IsValidType(ALenum type) -{ - switch(type) - { - case AL_BYTE_SOFT: - case AL_UNSIGNED_BYTE_SOFT: - case AL_SHORT_SOFT: - case AL_UNSIGNED_SHORT_SOFT: - case AL_INT_SOFT: - case AL_UNSIGNED_INT_SOFT: - case AL_FLOAT_SOFT: - case AL_DOUBLE_SOFT: - case AL_BYTE3_SOFT: - case AL_UNSIGNED_BYTE3_SOFT: - case AL_MULAW_SOFT: - return AL_TRUE; - } - return AL_FALSE; -} - -static ALboolean IsValidChannels(ALenum channels) -{ - switch(channels) - { - case AL_MONO_SOFT: - case AL_STEREO_SOFT: - case AL_REAR_SOFT: - case AL_QUAD_SOFT: - case AL_5POINT1_SOFT: - case AL_6POINT1_SOFT: - case AL_7POINT1_SOFT: - case AL_BFORMAT2D_SOFT: - case AL_BFORMAT3D_SOFT: - return AL_TRUE; - } - return AL_FALSE; -} - - -ALbuffer *NewBuffer(ALCcontext *context) +static ALbuffer *AllocBuffer(ALCcontext *context) { ALCdevice *device = context->Device; - ALbuffer *buffer; - ALenum err; + BufferSubList *sublist, *subend; + ALbuffer *buffer = NULL; + ALsizei lidx = 0; + ALsizei slidx; - buffer = al_calloc(16, sizeof(ALbuffer)); - if(!buffer) - SET_ERROR_AND_RETURN_VALUE(context, AL_OUT_OF_MEMORY, NULL); - RWLockInit(&buffer->lock); - - err = NewThunkEntry(&buffer->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->BufferMap, buffer->id, buffer); - if(err != AL_NO_ERROR) + almtx_lock(&device->BufferLock); + sublist = VECTOR_BEGIN(device->BufferList); + subend = VECTOR_END(device->BufferList); + for(;sublist != subend;++sublist) { - FreeThunkEntry(buffer->id); - memset(buffer, 0, sizeof(ALbuffer)); - al_free(buffer); - - SET_ERROR_AND_RETURN_VALUE(context, err, NULL); + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + buffer = sublist->Buffers + slidx; + break; + } + ++lidx; } + if(UNLIKELY(!buffer)) + { + const BufferSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(device->BufferList) >= 1<<25)) + { + almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many buffers allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(device->BufferList); + VECTOR_PUSH_BACK(device->BufferList, empty_sublist); + sublist = &VECTOR_BACK(device->BufferList); + sublist->FreeMask = ~U64(0); + sublist->Buffers = al_calloc(16, sizeof(ALbuffer)*64); + if(UNLIKELY(!sublist->Buffers)) + { + VECTOR_POP_BACK(device->BufferList); + almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate buffer batch"); + return NULL; + } + + slidx = 0; + buffer = sublist->Buffers + slidx; + } + + memset(buffer, 0, sizeof(*buffer)); + + /* Add 1 to avoid buffer ID 0. */ + buffer->id = ((lidx<<6) | slidx) + 1; + + sublist->FreeMask &= ~(U64(1)<BufferLock); return buffer; } -void DeleteBuffer(ALCdevice *device, ALbuffer *buffer) +static void FreeBuffer(ALCdevice *device, ALbuffer *buffer) { - RemoveBuffer(device, buffer->id); - FreeThunkEntry(buffer->id); + ALuint id = buffer->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; al_free(buffer->data); - memset(buffer, 0, sizeof(*buffer)); - al_free(buffer); + + VECTOR_ELEM(device->BufferList, lidx).FreeMask |= U64(1) << slidx; } @@ -1400,16 +1281,25 @@ void DeleteBuffer(ALCdevice *device, ALbuffer *buffer) */ ALvoid ReleaseALBuffers(ALCdevice *device) { - ALsizei i; - for(i = 0;i < device->BufferMap.size;i++) + BufferSubList *sublist = VECTOR_BEGIN(device->BufferList); + BufferSubList *subend = VECTOR_END(device->BufferList); + size_t leftover = 0; + for(;sublist != subend;++sublist) { - ALbuffer *temp = device->BufferMap.values[i]; - device->BufferMap.values[i] = NULL; + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALbuffer *buffer = sublist->Buffers + idx; - al_free(temp->data); + al_free(buffer->data); + memset(buffer, 0, sizeof(*buffer)); + ++leftover; - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALbuffer)); - al_free(temp); + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Buffer%s\n", device, leftover, (leftover==1)?"":"s"); } diff --git a/Engine/lib/openal-soft/OpenAL32/alEffect.c b/Engine/lib/openal-soft/OpenAL32/alEffect.c index 65a4dcb68..e7dc6aced 100644 --- a/Engine/lib/openal-soft/OpenAL32/alEffect.c +++ b/Engine/lib/openal-soft/OpenAL32/alEffect.c @@ -28,26 +28,51 @@ #include "AL/alc.h" #include "alMain.h" #include "alEffect.h" -#include "alThunk.h" #include "alError.h" -ALboolean DisabledEffects[MAX_EFFECTS]; - -extern inline void LockEffectsRead(ALCdevice *device); -extern inline void UnlockEffectsRead(ALCdevice *device); -extern inline void LockEffectsWrite(ALCdevice *device); -extern inline void UnlockEffectsWrite(ALCdevice *device); -extern inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id); -extern inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id); +extern inline void LockEffectList(ALCdevice *device); +extern inline void UnlockEffectList(ALCdevice *device); extern inline ALboolean IsReverbEffect(ALenum type); +const struct EffectList EffectList[EFFECTLIST_SIZE] = { + { "eaxreverb", EAXREVERB_EFFECT, AL_EFFECT_EAXREVERB }, + { "reverb", REVERB_EFFECT, AL_EFFECT_REVERB }, + { "chorus", CHORUS_EFFECT, AL_EFFECT_CHORUS }, + { "compressor", COMPRESSOR_EFFECT, AL_EFFECT_COMPRESSOR }, + { "distortion", DISTORTION_EFFECT, AL_EFFECT_DISTORTION }, + { "echo", ECHO_EFFECT, AL_EFFECT_ECHO }, + { "equalizer", EQUALIZER_EFFECT, AL_EFFECT_EQUALIZER }, + { "flanger", FLANGER_EFFECT, AL_EFFECT_FLANGER }, + { "modulator", MODULATOR_EFFECT, AL_EFFECT_RING_MODULATOR }, + { "pshifter", PSHIFTER_EFFECT, AL_EFFECT_PITCH_SHIFTER }, + { "dedicated", DEDICATED_EFFECT, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT }, + { "dedicated", DEDICATED_EFFECT, AL_EFFECT_DEDICATED_DIALOGUE }, +}; + +ALboolean DisabledEffects[MAX_EFFECTS]; + +static ALeffect *AllocEffect(ALCcontext *context); +static void FreeEffect(ALCdevice *device, ALeffect *effect); static void InitEffectParams(ALeffect *effect, ALenum type); +static inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) +{ + EffectSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->EffectList))) + return NULL; + sublist = &VECTOR_ELEM(device->EffectList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Effects + slidx; +} + AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) { - ALCdevice *device; ALCcontext *context; ALsizei cur; @@ -55,37 +80,18 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - device = context->Device; - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d effects", n); + else for(cur = 0;cur < n;cur++) { - ALeffect *effect = al_calloc(16, sizeof(ALeffect)); - ALenum err = AL_OUT_OF_MEMORY; - if(!effect || (err=InitEffect(effect)) != AL_NO_ERROR) + ALeffect *effect = AllocEffect(context); + if(!effect) { - al_free(effect); alDeleteEffects(cur, effects); - SET_ERROR_AND_GOTO(context, err, done); + break; } - - err = NewThunkEntry(&effect->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->EffectMap, effect->id, effect); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(effect->id); - memset(effect, 0, sizeof(ALeffect)); - al_free(effect); - - alDeleteEffects(cur, effects); - SET_ERROR_AND_GOTO(context, err, done); - } - effects[cur] = effect->id; } -done: ALCcontext_DecRef(context); } @@ -100,26 +106,22 @@ AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) if(!context) return; device = context->Device; - LockEffectsWrite(device); + LockEffectList(device); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d effects", n); for(i = 0;i < n;i++) { if(effects[i] && LookupEffect(device, effects[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect ID %u", effects[i]); } for(i = 0;i < n;i++) { - if((effect=RemoveEffect(device, effects[i])) == NULL) - continue; - FreeThunkEntry(effect->id); - - memset(effect, 0, sizeof(*effect)); - al_free(effect); + if((effect=LookupEffect(device, effects[i])) != NULL) + FreeEffect(device, effect); } done: - UnlockEffectsWrite(device); + UnlockEffectList(device); ALCcontext_DecRef(context); } @@ -131,10 +133,10 @@ AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect) Context = GetContextRef(); if(!Context) return AL_FALSE; - LockEffectsRead(Context->Device); + LockEffectList(Context->Device); result = ((!effect || LookupEffect(Context->Device, effect)) ? AL_TRUE : AL_FALSE); - UnlockEffectsRead(Context->Device); + UnlockEffectList(Context->Device); ALCcontext_DecRef(Context); @@ -151,16 +153,16 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { if(param == AL_EFFECT_TYPE) { ALboolean isOk = (value == AL_EFFECT_NULL); ALint i; - for(i = 0;!isOk && EffectList[i].val;i++) + for(i = 0;!isOk && i < EFFECTLIST_SIZE;i++) { if(value == EffectList[i].val && !DisabledEffects[EffectList[i].type]) @@ -170,15 +172,15 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) if(isOk) InitEffectParams(ALEffect, value); else - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "Effect type 0x%04x not supported", value); } else { /* Call the appropriate handler */ - V(ALEffect,setParami)(Context, param, value); + ALeffect_setParami(ALEffect, Context, param, value); } } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -200,15 +202,15 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *v if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,setParamiv)(Context, param, values); + ALeffect_setParamiv(ALEffect, Context, param, values); } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -223,15 +225,15 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value) if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,setParamf)(Context, param, value); + ALeffect_setParamf(ALEffect, Context, param, value); } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -246,15 +248,15 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,setParamfv)(Context, param, values); + ALeffect_setParamfv(ALEffect, Context, param, values); } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -269,9 +271,9 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { if(param == AL_EFFECT_TYPE) @@ -279,10 +281,10 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value else { /* Call the appropriate handler */ - V(ALEffect,getParami)(Context, param, value); + ALeffect_getParami(ALEffect, Context, param, value); } } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -304,15 +306,15 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *valu if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,getParamiv)(Context, param, values); + ALeffect_getParamiv(ALEffect, Context, param, values); } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -327,15 +329,15 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *val if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,getParamf)(Context, param, value); + ALeffect_getParamf(ALEffect, Context, param, value); } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -350,39 +352,120 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *va if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,getParamfv)(Context, param, values); + ALeffect_getParamfv(ALEffect, Context, param, values); } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } -ALenum InitEffect(ALeffect *effect) +void InitEffect(ALeffect *effect) { InitEffectParams(effect, AL_EFFECT_NULL); - return AL_NO_ERROR; } -ALvoid ReleaseALEffects(ALCdevice *device) +static ALeffect *AllocEffect(ALCcontext *context) { - ALsizei i; - for(i = 0;i < device->EffectMap.size;i++) - { - ALeffect *temp = device->EffectMap.values[i]; - device->EffectMap.values[i] = NULL; + ALCdevice *device = context->Device; + EffectSubList *sublist, *subend; + ALeffect *effect = NULL; + ALsizei lidx = 0; + ALsizei slidx; - // Release effect structure - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALeffect)); - al_free(temp); + almtx_lock(&device->EffectLock); + sublist = VECTOR_BEGIN(device->EffectList); + subend = VECTOR_END(device->EffectList); + for(;sublist != subend;++sublist) + { + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + effect = sublist->Effects + slidx; + break; + } + ++lidx; } + if(UNLIKELY(!effect)) + { + const EffectSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(device->EffectList) >= 1<<25)) + { + almtx_unlock(&device->EffectLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many effects allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(device->EffectList); + VECTOR_PUSH_BACK(device->EffectList, empty_sublist); + sublist = &VECTOR_BACK(device->EffectList); + sublist->FreeMask = ~U64(0); + sublist->Effects = al_calloc(16, sizeof(ALeffect)*64); + if(UNLIKELY(!sublist->Effects)) + { + VECTOR_POP_BACK(device->EffectList); + almtx_unlock(&device->EffectLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect batch"); + return NULL; + } + + slidx = 0; + effect = sublist->Effects + slidx; + } + + memset(effect, 0, sizeof(*effect)); + InitEffectParams(effect, AL_EFFECT_NULL); + + /* Add 1 to avoid effect ID 0. */ + effect->id = ((lidx<<6) | slidx) + 1; + + sublist->FreeMask &= ~(U64(1)<EffectLock); + + return effect; +} + +static void FreeEffect(ALCdevice *device, ALeffect *effect) +{ + ALuint id = effect->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; + + memset(effect, 0, sizeof(*effect)); + + VECTOR_ELEM(device->EffectList, lidx).FreeMask |= U64(1) << slidx; +} + +void ReleaseALEffects(ALCdevice *device) +{ + EffectSubList *sublist = VECTOR_BEGIN(device->EffectList); + EffectSubList *subend = VECTOR_END(device->EffectList); + size_t leftover = 0; + for(;sublist != subend;++sublist) + { + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALeffect *effect = sublist->Effects + idx; + + memset(effect, 0, sizeof(*effect)); + ++leftover; + + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; + } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Effect%s\n", device, leftover, (leftover==1)?"":"s"); } @@ -418,7 +501,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE; effect->Props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; effect->Props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT; - SET_VTABLE1(ALeaxreverb, effect); + effect->vtab = &ALeaxreverb_vtable; break; case AL_EFFECT_REVERB: effect->Props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY; @@ -448,7 +531,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Reverb.LFReference = 250.0f; effect->Props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; effect->Props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT; - SET_VTABLE1(ALreverb, effect); + effect->vtab = &ALreverb_vtable; break; case AL_EFFECT_CHORUS: effect->Props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM; @@ -457,11 +540,11 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH; effect->Props.Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK; effect->Props.Chorus.Delay = AL_CHORUS_DEFAULT_DELAY; - SET_VTABLE1(ALchorus, effect); + effect->vtab = &ALchorus_vtable; break; case AL_EFFECT_COMPRESSOR: effect->Props.Compressor.OnOff = AL_COMPRESSOR_DEFAULT_ONOFF; - SET_VTABLE1(ALcompressor, effect); + effect->vtab = &ALcompressor_vtable; break; case AL_EFFECT_DISTORTION: effect->Props.Distortion.Edge = AL_DISTORTION_DEFAULT_EDGE; @@ -469,7 +552,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Distortion.LowpassCutoff = AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF; effect->Props.Distortion.EQCenter = AL_DISTORTION_DEFAULT_EQCENTER; effect->Props.Distortion.EQBandwidth = AL_DISTORTION_DEFAULT_EQBANDWIDTH; - SET_VTABLE1(ALdistortion, effect); + effect->vtab = &ALdistortion_vtable; break; case AL_EFFECT_ECHO: effect->Props.Echo.Delay = AL_ECHO_DEFAULT_DELAY; @@ -477,7 +560,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Echo.Damping = AL_ECHO_DEFAULT_DAMPING; effect->Props.Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK; effect->Props.Echo.Spread = AL_ECHO_DEFAULT_SPREAD; - SET_VTABLE1(ALecho, effect); + effect->vtab = &ALecho_vtable; break; case AL_EFFECT_EQUALIZER: effect->Props.Equalizer.LowCutoff = AL_EQUALIZER_DEFAULT_LOW_CUTOFF; @@ -490,30 +573,35 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Equalizer.Mid2Width = AL_EQUALIZER_DEFAULT_MID2_WIDTH; effect->Props.Equalizer.HighCutoff = AL_EQUALIZER_DEFAULT_HIGH_CUTOFF; effect->Props.Equalizer.HighGain = AL_EQUALIZER_DEFAULT_HIGH_GAIN; - SET_VTABLE1(ALequalizer, effect); + effect->vtab = &ALequalizer_vtable; break; case AL_EFFECT_FLANGER: - effect->Props.Flanger.Waveform = AL_FLANGER_DEFAULT_WAVEFORM; - effect->Props.Flanger.Phase = AL_FLANGER_DEFAULT_PHASE; - effect->Props.Flanger.Rate = AL_FLANGER_DEFAULT_RATE; - effect->Props.Flanger.Depth = AL_FLANGER_DEFAULT_DEPTH; - effect->Props.Flanger.Feedback = AL_FLANGER_DEFAULT_FEEDBACK; - effect->Props.Flanger.Delay = AL_FLANGER_DEFAULT_DELAY; - SET_VTABLE1(ALflanger, effect); + effect->Props.Chorus.Waveform = AL_FLANGER_DEFAULT_WAVEFORM; + effect->Props.Chorus.Phase = AL_FLANGER_DEFAULT_PHASE; + effect->Props.Chorus.Rate = AL_FLANGER_DEFAULT_RATE; + effect->Props.Chorus.Depth = AL_FLANGER_DEFAULT_DEPTH; + effect->Props.Chorus.Feedback = AL_FLANGER_DEFAULT_FEEDBACK; + effect->Props.Chorus.Delay = AL_FLANGER_DEFAULT_DELAY; + effect->vtab = &ALflanger_vtable; break; case AL_EFFECT_RING_MODULATOR: effect->Props.Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY; effect->Props.Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF; effect->Props.Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM; - SET_VTABLE1(ALmodulator, effect); + effect->vtab = &ALmodulator_vtable; + break; + case AL_EFFECT_PITCH_SHIFTER: + effect->Props.Pshifter.CoarseTune = AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE; + effect->Props.Pshifter.FineTune = AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE; + effect->vtab = &ALpshifter_vtable; break; case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT: case AL_EFFECT_DEDICATED_DIALOGUE: effect->Props.Dedicated.Gain = 1.0f; - SET_VTABLE1(ALdedicated, effect); + effect->vtab = &ALdedicated_vtable; break; default: - SET_VTABLE1(ALnull, effect); + effect->vtab = &ALnull_vtable; break; } effect->type = type; @@ -656,7 +744,7 @@ static const struct { }; #undef DECL -ALvoid LoadReverbPreset(const char *name, ALeffect *effect) +void LoadReverbPreset(const char *name, ALeffect *effect) { size_t i; @@ -667,9 +755,9 @@ ALvoid LoadReverbPreset(const char *name, ALeffect *effect) return; } - if(!DisabledEffects[EAXREVERB]) + if(!DisabledEffects[EAXREVERB_EFFECT]) InitEffectParams(effect, AL_EFFECT_EAXREVERB); - else if(!DisabledEffects[REVERB]) + else if(!DisabledEffects[REVERB_EFFECT]) InitEffectParams(effect, AL_EFFECT_REVERB); else InitEffectParams(effect, AL_EFFECT_NULL); diff --git a/Engine/lib/openal-soft/OpenAL32/alError.c b/Engine/lib/openal-soft/OpenAL32/alError.c index b38d8dfed..b6208f770 100644 --- a/Engine/lib/openal-soft/OpenAL32/alError.c +++ b/Engine/lib/openal-soft/OpenAL32/alError.c @@ -21,6 +21,7 @@ #include "config.h" #include +#include #ifdef HAVE_WINDOWS_H #define WIN32_LEAN_AND_MEAN @@ -33,9 +34,32 @@ ALboolean TrapALError = AL_FALSE; -ALvoid alSetError(ALCcontext *Context, ALenum errorCode) +void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...) { ALenum curerr = AL_NO_ERROR; + char message[1024] = { 0 }; + va_list args; + int msglen; + + va_start(args, msg); + msglen = vsnprintf(message, sizeof(message), msg, args); + va_end(args); + + if(msglen < 0 || (size_t)msglen >= sizeof(message)) + { + message[sizeof(message)-1] = 0; + msglen = (int)strlen(message); + } + if(msglen > 0) + msg = message; + else + { + msg = ""; + msglen = (int)strlen(msg); + } + + WARN("Error generated on context %p, code 0x%04x, \"%s\"\n", + context, errorCode, message); if(TrapALError) { #ifdef _WIN32 @@ -46,17 +70,30 @@ ALvoid alSetError(ALCcontext *Context, ALenum errorCode) raise(SIGTRAP); #endif } - ATOMIC_COMPARE_EXCHANGE_STRONG(ALenum, &Context->LastError, &curerr, errorCode); + + ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&context->LastError, &curerr, errorCode); + if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Error)) + { + ALbitfieldSOFT enabledevts; + almtx_lock(&context->EventCbLock); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + if((enabledevts&EventType_Error) && context->EventCb) + (*context->EventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg, + context->EventParam); + almtx_unlock(&context->EventCbLock); + } } AL_API ALenum AL_APIENTRY alGetError(void) { - ALCcontext *Context; + ALCcontext *context; ALenum errorCode; - Context = GetContextRef(); - if(!Context) + context = GetContextRef(); + if(!context) { + const ALenum deferror = AL_INVALID_OPERATION; + WARN("Querying error state on null context (implicitly 0x%04x)\n", deferror); if(TrapALError) { #ifdef _WIN32 @@ -66,12 +103,11 @@ AL_API ALenum AL_APIENTRY alGetError(void) raise(SIGTRAP); #endif } - return AL_INVALID_OPERATION; + return deferror; } - errorCode = ATOMIC_EXCHANGE(ALenum, &Context->LastError, AL_NO_ERROR); - - ALCcontext_DecRef(Context); + errorCode = ATOMIC_EXCHANGE_SEQ(&context->LastError, AL_NO_ERROR); + ALCcontext_DecRef(context); return errorCode; } diff --git a/Engine/lib/openal-soft/OpenAL32/alExtension.c b/Engine/lib/openal-soft/OpenAL32/alExtension.c index 1a559d9cb..f6378c706 100644 --- a/Engine/lib/openal-soft/OpenAL32/alExtension.c +++ b/Engine/lib/openal-soft/OpenAL32/alExtension.c @@ -35,22 +35,6 @@ #include "AL/alc.h" -const struct EffectList EffectList[] = { - { "eaxreverb", EAXREVERB, "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB }, - { "reverb", REVERB, "AL_EFFECT_REVERB", AL_EFFECT_REVERB }, - { "chorus", CHORUS, "AL_EFFECT_CHORUS", AL_EFFECT_CHORUS }, - { "compressor", COMPRESSOR, "AL_EFFECT_COMPRESSOR", AL_EFFECT_COMPRESSOR }, - { "distortion", DISTORTION, "AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION }, - { "echo", ECHO, "AL_EFFECT_ECHO", AL_EFFECT_ECHO }, - { "equalizer", EQUALIZER, "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER }, - { "flanger", FLANGER, "AL_EFFECT_FLANGER", AL_EFFECT_FLANGER }, - { "modulator", MODULATOR, "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR }, - { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT", AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT }, - { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE }, - { NULL, 0, NULL, (ALenum)0 } -}; - - AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) { ALboolean ret = AL_FALSE; @@ -61,8 +45,8 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) context = GetContextRef(); if(!context) return AL_FALSE; - if(!(extName)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!extName) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer"); len = strlen(extName); ptr = context->ExtensionList; diff --git a/Engine/lib/openal-soft/OpenAL32/alFilter.c b/Engine/lib/openal-soft/OpenAL32/alFilter.c index c675d3448..7d8a886c5 100644 --- a/Engine/lib/openal-soft/OpenAL32/alFilter.c +++ b/Engine/lib/openal-soft/OpenAL32/alFilter.c @@ -25,65 +25,53 @@ #include "alMain.h" #include "alu.h" #include "alFilter.h" -#include "alThunk.h" #include "alError.h" -extern inline void LockFiltersRead(ALCdevice *device); -extern inline void UnlockFiltersRead(ALCdevice *device); -extern inline void LockFiltersWrite(ALCdevice *device); -extern inline void UnlockFiltersWrite(ALCdevice *device); -extern inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id); -extern inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id); -extern inline void ALfilterState_clear(ALfilterState *filter); -extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALuint numsamples); -extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope); -extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth); +extern inline void LockFilterList(ALCdevice *device); +extern inline void UnlockFilterList(ALCdevice *device); +static ALfilter *AllocFilter(ALCcontext *context); +static void FreeFilter(ALCdevice *device, ALfilter *filter); static void InitFilterParams(ALfilter *filter, ALenum type); +static inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) +{ + FilterSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->FilterList))) + return NULL; + sublist = &VECTOR_ELEM(device->FilterList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Filters + slidx; +} + AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) { - ALCdevice *device; ALCcontext *context; ALsizei cur = 0; - ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - device = context->Device; - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d filters", n); + else for(cur = 0;cur < n;cur++) { - ALfilter *filter = al_calloc(16, sizeof(ALfilter)); + ALfilter *filter = AllocFilter(context); if(!filter) { alDeleteFilters(cur, filters); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); - } - InitFilterParams(filter, AL_FILTER_NULL); - - err = NewThunkEntry(&filter->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->FilterMap, filter->id, filter); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(filter->id); - memset(filter, 0, sizeof(ALfilter)); - al_free(filter); - - alDeleteFilters(cur, filters); - SET_ERROR_AND_GOTO(context, err, done); + break; } filters[cur] = filter->id; } -done: ALCcontext_DecRef(context); } @@ -98,26 +86,22 @@ AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) if(!context) return; device = context->Device; - LockFiltersWrite(device); + LockFilterList(device); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d filters", n); for(i = 0;i < n;i++) { if(filters[i] && LookupFilter(device, filters[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid filter ID %u", filters[i]); } for(i = 0;i < n;i++) { - if((filter=RemoveFilter(device, filters[i])) == NULL) - continue; - FreeThunkEntry(filter->id); - - memset(filter, 0, sizeof(*filter)); - al_free(filter); + if((filter=LookupFilter(device, filters[i])) != NULL) + FreeFilter(device, filter); } done: - UnlockFiltersWrite(device); + UnlockFilterList(device); ALCcontext_DecRef(context); } @@ -129,10 +113,10 @@ AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter) Context = GetContextRef(); if(!Context) return AL_FALSE; - LockFiltersRead(Context->Device); + LockFilterList(Context->Device); result = ((!filter || LookupFilter(Context->Device, filter)) ? AL_TRUE : AL_FALSE); - UnlockFiltersRead(Context->Device); + UnlockFilterList(Context->Device); ALCcontext_DecRef(Context); @@ -149,9 +133,9 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value) if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { if(param == AL_FILTER_TYPE) @@ -160,15 +144,15 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value) value == AL_FILTER_HIGHPASS || value == AL_FILTER_BANDPASS) InitFilterParams(ALFilter, value); else - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "Invalid filter type 0x%04x", value); } else { /* Call the appropriate handler */ - ALfilter_SetParami(ALFilter, Context, param, value); + ALfilter_setParami(ALFilter, Context, param, value); } } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -190,15 +174,15 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *v if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_SetParamiv(ALFilter, Context, param, values); + ALfilter_setParamiv(ALFilter, Context, param, values); } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -213,15 +197,15 @@ AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat value) if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_SetParamf(ALFilter, Context, param, value); + ALfilter_setParamf(ALFilter, Context, param, value); } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -236,15 +220,15 @@ AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_SetParamfv(ALFilter, Context, param, values); + ALfilter_setParamfv(ALFilter, Context, param, values); } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -259,9 +243,9 @@ AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { if(param == AL_FILTER_TYPE) @@ -269,10 +253,10 @@ AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value else { /* Call the appropriate handler */ - ALfilter_GetParami(ALFilter, Context, param, value); + ALfilter_getParami(ALFilter, Context, param, value); } } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -294,15 +278,15 @@ AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *valu if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_GetParamiv(ALFilter, Context, param, values); + ALfilter_getParamiv(ALFilter, Context, param, values); } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -317,15 +301,15 @@ AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *val if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_GetParamf(ALFilter, Context, param, value); + ALfilter_getParamf(ALFilter, Context, param, value); } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -340,134 +324,52 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *va if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_GetParamfv(ALFilter, Context, param, values); + ALfilter_getParamfv(ALFilter, Context, param, values); } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } -void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ) -{ - ALfloat alpha, sqrtgain_alpha_2; - ALfloat w0, sin_w0, cos_w0; - ALfloat a[3] = { 1.0f, 0.0f, 0.0f }; - ALfloat b[3] = { 1.0f, 0.0f, 0.0f }; - - // Limit gain to -100dB - gain = maxf(gain, 0.00001f); - - w0 = F_TAU * freq_mult; - sin_w0 = sinf(w0); - cos_w0 = cosf(w0); - alpha = sin_w0/2.0f * rcpQ; - - /* Calculate filter coefficients depending on filter type */ - switch(type) - { - case ALfilterType_HighShelf: - sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; - b[0] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); - b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cos_w0 ); - b[2] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); - a[0] = (gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; - a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cos_w0 ); - a[2] = (gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; - break; - case ALfilterType_LowShelf: - sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; - b[0] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); - b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cos_w0 ); - b[2] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); - a[0] = (gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; - a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cos_w0 ); - a[2] = (gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; - break; - case ALfilterType_Peaking: - gain = sqrtf(gain); - b[0] = 1.0f + alpha * gain; - b[1] = -2.0f * cos_w0; - b[2] = 1.0f - alpha * gain; - a[0] = 1.0f + alpha / gain; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha / gain; - break; - - case ALfilterType_LowPass: - b[0] = (1.0f - cos_w0) / 2.0f; - b[1] = 1.0f - cos_w0; - b[2] = (1.0f - cos_w0) / 2.0f; - a[0] = 1.0f + alpha; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha; - break; - case ALfilterType_HighPass: - b[0] = (1.0f + cos_w0) / 2.0f; - b[1] = -(1.0f + cos_w0); - b[2] = (1.0f + cos_w0) / 2.0f; - a[0] = 1.0f + alpha; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha; - break; - case ALfilterType_BandPass: - b[0] = alpha; - b[1] = 0; - b[2] = -alpha; - a[0] = 1.0f + alpha; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha; - break; - } - - filter->a1 = a[1] / a[0]; - filter->a2 = a[2] / a[0]; - filter->b0 = b[0] / a[0]; - filter->b1 = b[1] / a[0]; - filter->b2 = b[2] / a[0]; -} - - -static void lp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_SetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) +static void ALlowpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); } +static void ALlowpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); } +static void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_LOWPASS_GAIN: if(!(val >= AL_LOWPASS_MIN_GAIN && val <= AL_LOWPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Low-pass gain %f out of range", val); filter->Gain = val; break; case AL_LOWPASS_GAINHF: if(!(val >= AL_LOWPASS_MIN_GAINHF && val <= AL_LOWPASS_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Low-pass gainhf %f out of range", val); filter->GainHF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param); } } -static void lp_SetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - lp_SetParamf(filter, context, param, vals[0]); -} +static void ALlowpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALlowpass_setParamf(filter, context, param, vals[0]); } -static void lp_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) +static void ALlowpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); } +static void ALlowpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); } +static void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) { @@ -480,49 +382,47 @@ static void lp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param); } } -static void lp_GetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) -{ - lp_GetParamf(filter, context, param, vals); -} +static void ALlowpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALlowpass_getParamf(filter, context, param, vals); } + +DEFINE_ALFILTER_VTABLE(ALlowpass); -static void hp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_SetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) +static void ALhighpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); } +static void ALhighpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); } +static void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_HIGHPASS_GAIN: if(!(val >= AL_HIGHPASS_MIN_GAIN && val <= AL_HIGHPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "High-pass gain out of range"); filter->Gain = val; break; case AL_HIGHPASS_GAINLF: if(!(val >= AL_HIGHPASS_MIN_GAINLF && val <= AL_HIGHPASS_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "High-pass gainlf out of range"); filter->GainLF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param); } } -static void hp_SetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - hp_SetParamf(filter, context, param, vals[0]); -} +static void ALhighpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALhighpass_setParamf(filter, context, param, vals[0]); } -static void hp_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) +static void ALhighpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); } +static void ALhighpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); } +static void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) { @@ -535,55 +435,53 @@ static void hp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param); } } -static void hp_GetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) -{ - hp_GetParamf(filter, context, param, vals); -} +static void ALhighpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALhighpass_getParamf(filter, context, param, vals); } + +DEFINE_ALFILTER_VTABLE(ALhighpass); -static void bp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_SetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) +static void ALbandpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); } +static void ALbandpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); } +static void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_BANDPASS_GAIN: if(!(val >= AL_BANDPASS_MIN_GAIN && val <= AL_BANDPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gain out of range"); filter->Gain = val; break; case AL_BANDPASS_GAINHF: if(!(val >= AL_BANDPASS_MIN_GAINHF && val <= AL_BANDPASS_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gainhf out of range"); filter->GainHF = val; break; case AL_BANDPASS_GAINLF: if(!(val >= AL_BANDPASS_MIN_GAINLF && val <= AL_BANDPASS_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gainlf out of range"); filter->GainLF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param); } } -static void bp_SetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - bp_SetParamf(filter, context, param, vals[0]); -} +static void ALbandpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALbandpass_setParamf(filter, context, param, vals[0]); } -static void bp_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) +static void ALbandpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); } +static void ALbandpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); } +static void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) { @@ -600,47 +498,131 @@ static void bp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param); } } -static void bp_GetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +static void ALbandpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALbandpass_getParamf(filter, context, param, vals); } + +DEFINE_ALFILTER_VTABLE(ALbandpass); + + +static void ALnullfilter_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_setParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_setParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } + +static void ALnullfilter_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_getParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_getParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } + +DEFINE_ALFILTER_VTABLE(ALnullfilter); + + +static ALfilter *AllocFilter(ALCcontext *context) { - bp_GetParamf(filter, context, param, vals); -} + ALCdevice *device = context->Device; + FilterSubList *sublist, *subend; + ALfilter *filter = NULL; + ALsizei lidx = 0; + ALsizei slidx; - -static void null_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_SetParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_SetParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALfloat *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } - -static void null_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_GetParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_GetParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } - - -ALvoid ReleaseALFilters(ALCdevice *device) -{ - ALsizei i; - for(i = 0;i < device->FilterMap.size;i++) + almtx_lock(&device->FilterLock); + sublist = VECTOR_BEGIN(device->FilterList); + subend = VECTOR_END(device->FilterList); + for(;sublist != subend;++sublist) { - ALfilter *temp = device->FilterMap.values[i]; - device->FilterMap.values[i] = NULL; - - // Release filter structure - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALfilter)); - al_free(temp); + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + filter = sublist->Filters + slidx; + break; + } + ++lidx; } + if(UNLIKELY(!filter)) + { + const FilterSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(device->FilterList) >= 1<<25)) + { + almtx_unlock(&device->FilterLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many filters allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(device->FilterList); + VECTOR_PUSH_BACK(device->FilterList, empty_sublist); + sublist = &VECTOR_BACK(device->FilterList); + sublist->FreeMask = ~U64(0); + sublist->Filters = al_calloc(16, sizeof(ALfilter)*64); + if(UNLIKELY(!sublist->Filters)) + { + VECTOR_POP_BACK(device->FilterList); + almtx_unlock(&device->FilterLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate filter batch"); + return NULL; + } + + slidx = 0; + filter = sublist->Filters + slidx; + } + + memset(filter, 0, sizeof(*filter)); + InitFilterParams(filter, AL_FILTER_NULL); + + /* Add 1 to avoid filter ID 0. */ + filter->id = ((lidx<<6) | slidx) + 1; + + sublist->FreeMask &= ~(U64(1)<FilterLock); + + return filter; +} + +static void FreeFilter(ALCdevice *device, ALfilter *filter) +{ + ALuint id = filter->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; + + memset(filter, 0, sizeof(*filter)); + + VECTOR_ELEM(device->FilterList, lidx).FreeMask |= U64(1) << slidx; +} + +void ReleaseALFilters(ALCdevice *device) +{ + FilterSubList *sublist = VECTOR_BEGIN(device->FilterList); + FilterSubList *subend = VECTOR_END(device->FilterList); + size_t leftover = 0; + for(;sublist != subend;++sublist) + { + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALfilter *filter = sublist->Filters + idx; + + memset(filter, 0, sizeof(*filter)); + ++leftover; + + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; + } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Filter%s\n", device, leftover, (leftover==1)?"":"s"); } @@ -653,15 +635,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = 1.0f; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = lp_SetParami; - filter->SetParamiv = lp_SetParamiv; - filter->SetParamf = lp_SetParamf; - filter->SetParamfv = lp_SetParamfv; - filter->GetParami = lp_GetParami; - filter->GetParamiv = lp_GetParamiv; - filter->GetParamf = lp_GetParamf; - filter->GetParamfv = lp_GetParamfv; + filter->vtab = &ALlowpass_vtable; } else if(type == AL_FILTER_HIGHPASS) { @@ -670,15 +644,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = AL_HIGHPASS_DEFAULT_GAINLF; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = hp_SetParami; - filter->SetParamiv = hp_SetParamiv; - filter->SetParamf = hp_SetParamf; - filter->SetParamfv = hp_SetParamfv; - filter->GetParami = hp_GetParami; - filter->GetParamiv = hp_GetParamiv; - filter->GetParamf = hp_GetParamf; - filter->GetParamfv = hp_GetParamfv; + filter->vtab = &ALhighpass_vtable; } else if(type == AL_FILTER_BANDPASS) { @@ -687,15 +653,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = AL_BANDPASS_DEFAULT_GAINLF; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = bp_SetParami; - filter->SetParamiv = bp_SetParamiv; - filter->SetParamf = bp_SetParamf; - filter->SetParamfv = bp_SetParamfv; - filter->GetParami = bp_GetParami; - filter->GetParamiv = bp_GetParamiv; - filter->GetParamf = bp_GetParamf; - filter->GetParamfv = bp_GetParamfv; + filter->vtab = &ALbandpass_vtable; } else { @@ -704,15 +662,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = 1.0f; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = null_SetParami; - filter->SetParamiv = null_SetParamiv; - filter->SetParamf = null_SetParamf; - filter->SetParamfv = null_SetParamfv; - filter->GetParami = null_GetParami; - filter->GetParamiv = null_GetParamiv; - filter->GetParamf = null_GetParamf; - filter->GetParamfv = null_GetParamfv; + filter->vtab = &ALnullfilter_vtable; } filter->type = type; } diff --git a/Engine/lib/openal-soft/OpenAL32/alListener.c b/Engine/lib/openal-soft/OpenAL32/alListener.c index 08ece19db..f1ac3ff4a 100644 --- a/Engine/lib/openal-soft/OpenAL32/alListener.c +++ b/Engine/lib/openal-soft/OpenAL32/alListener.c @@ -21,85 +21,101 @@ #include "config.h" #include "alMain.h" -#include "AL/alc.h" +#include "alu.h" #include "alError.h" #include "alListener.h" #include "alSource.h" +#define DO_UPDATEPROPS() do { \ + if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) \ + UpdateListenerProps(context); \ + else \ + ATOMIC_FLAG_CLEAR(&listener->PropsClean, almemory_order_release); \ +} while(0) + + AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value) { + ALlistener *listener; ALCcontext *context; context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + listener = context->Listener; + almtx_lock(&context->PropLock); switch(param) { case AL_GAIN: if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->Gain = value; + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener gain out of range"); + listener->Gain = value; + DO_UPDATEPROPS(); break; case AL_METERS_PER_UNIT: - if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->MetersPerUnit = value; + if(!(value >= AL_MIN_METERS_PER_UNIT && value <= AL_MAX_METERS_PER_UNIT)) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener meters per unit out of range"); + context->MetersPerUnit = value; + if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) + UpdateContextProps(context); + else + ATOMIC_FLAG_CLEAR(&context->PropsClean, almemory_order_release); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); done: - WriteUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) { + ALlistener *listener; ALCcontext *context; context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + listener = context->Listener; + almtx_lock(&context->PropLock); switch(param) { case AL_POSITION: if(!(isfinite(value1) && isfinite(value2) && isfinite(value3))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->Position[0] = value1; - context->Listener->Position[1] = value2; - context->Listener->Position[2] = value3; + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener position out of range"); + listener->Position[0] = value1; + listener->Position[1] = value2; + listener->Position[2] = value3; + DO_UPDATEPROPS(); break; case AL_VELOCITY: if(!(isfinite(value1) && isfinite(value2) && isfinite(value3))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->Velocity[0] = value1; - context->Listener->Velocity[1] = value2; - context->Listener->Velocity[2] = value3; + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener velocity out of range"); + listener->Velocity[0] = value1; + listener->Velocity[1] = value2; + listener->Velocity[2] = value3; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-float property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); done: - WriteUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) { + ALlistener *listener; ALCcontext *context; if(values) @@ -121,32 +137,31 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + listener = context->Listener; + almtx_lock(&context->PropLock); + if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer"); switch(param) { case AL_ORIENTATION: if(!(isfinite(values[0]) && isfinite(values[1]) && isfinite(values[2]) && isfinite(values[3]) && isfinite(values[4]) && isfinite(values[5]))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener orientation out of range"); /* AT then UP */ - context->Listener->Forward[0] = values[0]; - context->Listener->Forward[1] = values[1]; - context->Listener->Forward[2] = values[2]; - context->Listener->Up[0] = values[3]; - context->Listener->Up[1] = values[4]; - context->Listener->Up[2] = values[5]; + listener->Forward[0] = values[0]; + listener->Forward[1] = values[1]; + listener->Forward[2] = values[2]; + listener->Up[0] = values[3]; + listener->Up[1] = values[4]; + listener->Up[2] = values[5]; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float-vector property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); done: - WriteUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -158,17 +173,14 @@ AL_API ALvoid AL_APIENTRY alListeneri(ALenum param, ALint UNUSED(value)) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -188,17 +200,14 @@ AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, A context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-integer property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -232,19 +241,16 @@ AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer-vector property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -256,25 +262,24 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!value) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_GAIN: *value = context->Listener->Gain; break; case AL_METERS_PER_UNIT: - *value = context->Listener->MetersPerUnit; + *value = context->MetersPerUnit; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -286,10 +291,10 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!value1 || !value2 || !value3) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_POSITION: *value1 = context->Listener->Position[0]; @@ -304,11 +309,10 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-float property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -333,10 +337,10 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_ORIENTATION: // AT then UP @@ -349,11 +353,10 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float-vector property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -365,17 +368,16 @@ AL_API ALvoid AL_APIENTRY alGetListeneri(ALenum param, ALint *value) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!value) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -387,10 +389,10 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch (param) + almtx_lock(&context->PropLock); + if(!value1 || !value2 || !value3) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_POSITION: *value1 = (ALint)context->Listener->Position[0]; @@ -405,11 +407,10 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-integer property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -429,10 +430,10 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_ORIENTATION: // AT then UP @@ -445,11 +446,10 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer-vector property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -460,7 +460,7 @@ void UpdateListenerProps(ALCcontext *context) struct ALlistenerProps *props; /* Get an unused proprty container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&listener->FreeList, almemory_order_acquire); + props = ATOMIC_LOAD(&context->FreeListenerProps, almemory_order_acquire); if(!props) props = al_calloc(16, sizeof(*props)); else @@ -468,48 +468,35 @@ void UpdateListenerProps(ALCcontext *context) struct ALlistenerProps *next; do { next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*, - &listener->FreeList, &props, next, almemory_order_seq_cst, - almemory_order_consume) == 0); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeListenerProps, &props, next, + almemory_order_seq_cst, almemory_order_acquire) == 0); } /* Copy in current property values. */ - ATOMIC_STORE(&props->Position[0], listener->Position[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Position[1], listener->Position[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Position[2], listener->Position[2], almemory_order_relaxed); + props->Position[0] = listener->Position[0]; + props->Position[1] = listener->Position[1]; + props->Position[2] = listener->Position[2]; - ATOMIC_STORE(&props->Velocity[0], listener->Velocity[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Velocity[1], listener->Velocity[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Velocity[2], listener->Velocity[2], almemory_order_relaxed); + props->Velocity[0] = listener->Velocity[0]; + props->Velocity[1] = listener->Velocity[1]; + props->Velocity[2] = listener->Velocity[2]; - ATOMIC_STORE(&props->Forward[0], listener->Forward[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Forward[1], listener->Forward[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Forward[2], listener->Forward[2], almemory_order_relaxed); - ATOMIC_STORE(&props->Up[0], listener->Up[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Up[1], listener->Up[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Up[2], listener->Up[2], almemory_order_relaxed); + props->Forward[0] = listener->Forward[0]; + props->Forward[1] = listener->Forward[1]; + props->Forward[2] = listener->Forward[2]; + props->Up[0] = listener->Up[0]; + props->Up[1] = listener->Up[1]; + props->Up[2] = listener->Up[2]; - ATOMIC_STORE(&props->Gain, listener->Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->MetersPerUnit, listener->MetersPerUnit, almemory_order_relaxed); - - ATOMIC_STORE(&props->DopplerFactor, context->DopplerFactor, almemory_order_relaxed); - ATOMIC_STORE(&props->DopplerVelocity, context->DopplerVelocity, almemory_order_relaxed); - ATOMIC_STORE(&props->SpeedOfSound, context->SpeedOfSound, almemory_order_relaxed); - - ATOMIC_STORE(&props->SourceDistanceModel, context->SourceDistanceModel, almemory_order_relaxed); - ATOMIC_STORE(&props->DistanceModel, context->DistanceModel, almemory_order_relaxed); + props->Gain = listener->Gain; /* Set the new container for updating internal parameters. */ - props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &listener->Update, props, almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&listener->Update, props, almemory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the * freelist. */ - struct ALlistenerProps *first = ATOMIC_LOAD(&listener->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*, - &listener->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALlistenerProps*, &context->FreeListenerProps, props); } } diff --git a/Engine/lib/openal-soft/OpenAL32/alSource.c b/Engine/lib/openal-soft/OpenAL32/alSource.c index f20498f48..ed6bd8ee3 100644 --- a/Engine/lib/openal-soft/OpenAL32/alSource.c +++ b/Engine/lib/openal-soft/OpenAL32/alSource.c @@ -31,8 +31,9 @@ #include "alError.h" #include "alSource.h" #include "alBuffer.h" -#include "alThunk.h" +#include "alFilter.h" #include "alAuxEffectSlot.h" +#include "ringbuffer.h" #include "backends/base.h" @@ -40,20 +41,72 @@ #include "almalloc.h" -extern inline void LockSourcesRead(ALCcontext *context); -extern inline void UnlockSourcesRead(ALCcontext *context); -extern inline void LockSourcesWrite(ALCcontext *context); -extern inline void UnlockSourcesWrite(ALCcontext *context); -extern inline struct ALsource *LookupSource(ALCcontext *context, ALuint id); -extern inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id); +static ALsource *AllocSource(ALCcontext *context); +static void FreeSource(ALCcontext *context, ALsource *source); +static void InitSourceParams(ALsource *Source, ALsizei num_sends); +static void DeinitSource(ALsource *source, ALsizei num_sends); +static void UpdateSourceProps(ALsource *source, ALvoice *voice, ALsizei num_sends, ALCcontext *context); +static ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime); +static ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime); +static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context); +static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALsizei *frac); +static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice); + +static inline void LockSourceList(ALCcontext *context) +{ almtx_lock(&context->SourceLock); } +static inline void UnlockSourceList(ALCcontext *context) +{ almtx_unlock(&context->SourceLock); } + +static inline ALsource *LookupSource(ALCcontext *context, ALuint id) +{ + SourceSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(context->SourceList))) + return NULL; + sublist = &VECTOR_ELEM(context->SourceList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Sources + slidx; +} + +static inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) +{ + BufferSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->BufferList))) + return NULL; + sublist = &VECTOR_ELEM(device->BufferList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Buffers + slidx; +} + +static inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) +{ + FilterSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->FilterList))) + return NULL; + sublist = &VECTOR_ELEM(device->FilterList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Filters + slidx; +} + +static inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) +{ + id--; + if(UNLIKELY(id >= VECTOR_SIZE(context->EffectSlotList))) + return NULL; + return VECTOR_ELEM(context->EffectSlotList, id); +} -static void InitSourceParams(ALsource *Source); -static void DeinitSource(ALsource *source); -static void UpdateSourceProps(ALsource *source, ALuint num_sends); -static ALint64 GetSourceSampleOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime); -static ALdouble GetSourceSecOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime); -static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCdevice *device); -static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac); typedef enum SourceProp { srcPitch = AL_PITCH, @@ -99,10 +152,6 @@ typedef enum SourceProp { /* AL_EXT_source_distance_model */ srcDistanceModel = AL_DISTANCE_MODEL, - srcByteLengthSOFT = AL_BYTE_LENGTH_SOFT, - srcSampleLengthSOFT = AL_SAMPLE_LENGTH_SOFT, - srcSecLengthSOFT = AL_SEC_LENGTH_SOFT, - /* AL_SOFT_source_latency */ srcSampleOffsetLatencySOFT = AL_SAMPLE_OFFSET_LATENCY_SOFT, srcSecOffsetLatencySOFT = AL_SEC_OFFSET_LATENCY_SOFT, @@ -115,6 +164,16 @@ typedef enum SourceProp { /* AL_EXT_BFORMAT */ srcOrientation = AL_ORIENTATION, + + /* AL_SOFT_source_resampler */ + srcResampler = AL_SOURCE_RESAMPLER_SOFT, + + /* AL_SOFT_source_spatialize */ + srcSpatialize = AL_SOURCE_SPATIALIZE_SOFT, + + /* ALC_SOFT_device_clock */ + srcSampleOffsetClockSOFT = AL_SAMPLE_OFFSET_CLOCK_SOFT, + srcSecOffsetClockSOFT = AL_SEC_OFFSET_CLOCK_SOFT, } SourceProp; static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values); @@ -125,12 +184,76 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values); static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values); -static inline bool SourceShouldUpdate(const ALsource *source, const ALCcontext *context) +static inline ALvoice *GetSourceVoice(ALsource *source, ALCcontext *context) { - return (source->state == AL_PLAYING || source->state == AL_PAUSED) && - !ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire); + ALint idx = source->VoiceIdx; + if(idx >= 0 && idx < context->VoiceCount) + { + ALvoice *voice = context->Voices[idx]; + if(ATOMIC_LOAD(&voice->Source, almemory_order_acquire) == source) + return voice; + } + source->VoiceIdx = -1; + return NULL; } +/** + * Returns if the last known state for the source was playing or paused. Does + * not sync with the mixer voice. + */ +static inline bool IsPlayingOrPaused(ALsource *source) +{ return source->state == AL_PLAYING || source->state == AL_PAUSED; } + +/** + * Returns an updated source state using the matching voice's status (or lack + * thereof). + */ +static inline ALenum GetSourceState(ALsource *source, ALvoice *voice) +{ + if(!voice && source->state == AL_PLAYING) + source->state = AL_STOPPED; + return source->state; +} + +/** + * Returns if the source should specify an update, given the context's + * deferring state and the source's last known state. + */ +static inline bool SourceShouldUpdate(ALsource *source, ALCcontext *context) +{ + return !ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) && + IsPlayingOrPaused(source); +} + + +/** Can only be called while the mixer is locked! */ +static void SendStateChangeEvent(ALCcontext *context, ALuint id, ALenum state) +{ + ALbitfieldSOFT enabledevt; + AsyncEvent evt; + + enabledevt = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_acquire); + if(!(enabledevt&EventType_SourceStateChange)) return; + + evt.EnumType = EventType_SourceStateChange; + evt.Type = AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT; + evt.ObjectId = id; + evt.Param = state; + snprintf(evt.Message, sizeof(evt.Message), "Source ID %u state changed to %s", id, + (state==AL_INITIAL) ? "AL_INITIAL" : + (state==AL_PLAYING) ? "AL_PLAYING" : + (state==AL_PAUSED) ? "AL_PAUSED" : + (state==AL_STOPPED) ? "AL_STOPPED" : "" + ); + /* The mixer may have queued a state change that's not yet been processed, + * and we don't want state change messages to occur out of order, so send + * it through the async queue to ensure proper ordering. + */ + if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&context->EventSem); +} + + static ALint FloatValsByProp(ALenum prop) { if(prop != (ALenum)((SourceProp)prop)) @@ -165,10 +288,9 @@ static ALint FloatValsByProp(ALenum prop) case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_STEREO_ANGLES: @@ -183,6 +305,7 @@ static ALint FloatValsByProp(ALenum prop) return 6; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_BUFFER: @@ -190,6 +313,7 @@ static ALint FloatValsByProp(ALenum prop) case AL_AUXILIARY_SEND_FILTER: break; /* i/i64 only */ case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ } return 0; @@ -228,13 +352,13 @@ static ALint DoubleValsByProp(ALenum prop) case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: return 2; @@ -251,6 +375,7 @@ static ALint DoubleValsByProp(ALenum prop) case AL_AUXILIARY_SEND_FILTER: break; /* i/i64 only */ case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ } return 0; @@ -292,10 +417,9 @@ static ALint IntValsByProp(ALenum prop) case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: case AL_DIRECT_FILTER: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_POSITION: @@ -308,8 +432,10 @@ static ALint IntValsByProp(ALenum prop) return 6; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -352,13 +478,13 @@ static ALint Int64ValsByProp(ALenum prop) case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: case AL_DIRECT_FILTER: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: return 2; case AL_POSITION: @@ -371,6 +497,7 @@ static ALint Int64ValsByProp(ALenum prop) return 6; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -381,12 +508,19 @@ static ALint Int64ValsByProp(ALenum prop) #define CHECKVAL(x) do { \ if(!(x)) \ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); \ + { \ + alSetError(Context, AL_INVALID_VALUE, "Value out of range"); \ + return AL_FALSE; \ + } \ } while(0) #define DO_UPDATEPROPS() do { \ - if(SourceShouldUpdate(Source, Context)) \ - UpdateSourceProps(Source, device->NumAuxSends); \ + ALvoice *voice; \ + if(SourceShouldUpdate(Source, Context) && \ + (voice=GetSourceVoice(Source, Context)) != NULL) \ + UpdateSourceProps(Source, voice, device->NumAuxSends, Context); \ + else \ + ATOMIC_FLAG_CLEAR(&Source->PropsClean, almemory_order_release); \ } while(0) static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values) @@ -396,12 +530,11 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p switch(prop) { - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting read-only source property 0x%04x", prop); case AL_PITCH: CHECKVAL(*values >= 0.0f); @@ -441,7 +574,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_ROLLOFF_FACTOR: CHECKVAL(*values >= 0.0f); - Source->RollOffFactor = *values; + Source->RolloffFactor = *values; DO_UPDATEPROPS(); return AL_TRUE; @@ -509,19 +642,24 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p Source->OffsetType = prop; Source->Offset = *values; - if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) && - !ATOMIC_LOAD(&Context->DeferUpdates, almemory_order_acquire)) + if(IsPlayingOrPaused(Source)) { - LockContext(Context); - WriteLock(&Source->queue_lock); - if(ApplyOffset(Source) == AL_FALSE) + ALvoice *voice; + + ALCdevice_Lock(Context->Device); + /* Double-check that the source is still playing while we have + * the lock. + */ + voice = GetSourceVoice(Source, Context); + if(voice) { - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + if(ApplyOffset(Source, voice) == AL_FALSE) + { + ALCdevice_Unlock(Context->Device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid offset"); + } } - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); + ALCdevice_Unlock(Context->Device); } return AL_TRUE; @@ -591,6 +729,8 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: ival = (ALint)values[0]; return SetSourceiv(Source, Context, prop, &ival); @@ -603,11 +743,12 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_DIRECT_FILTER: case AL_AUXILIARY_SEND_FILTER: case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source float property 0x%04x", prop); } static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint *values) @@ -617,7 +758,6 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p ALfilter *filter = NULL; ALeffectslot *slot = NULL; ALbufferlistitem *oldlist; - ALbufferlistitem *newlist; ALfloat fvals[6]; switch(prop) @@ -626,11 +766,9 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SOURCE_TYPE: case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting read-only source property 0x%04x", prop); case AL_SOURCE_RELATIVE: CHECKVAL(*values == AL_FALSE || *values == AL_TRUE); @@ -642,63 +780,91 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_LOOPING: CHECKVAL(*values == AL_FALSE || *values == AL_TRUE); - WriteLock(&Source->queue_lock); - ATOMIC_STORE(&Source->looping, *values); - WriteUnlock(&Source->queue_lock); + Source->Looping = (ALboolean)*values; + if(IsPlayingOrPaused(Source)) + { + ALvoice *voice = GetSourceVoice(Source, Context); + if(voice) + { + if(Source->Looping) + ATOMIC_STORE(&voice->loop_buffer, Source->queue, almemory_order_release); + else + ATOMIC_STORE(&voice->loop_buffer, NULL, almemory_order_release); + + /* If the source is playing, wait for the current mix to finish + * to ensure it isn't currently looping back or reaching the + * end. + */ + while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) + althrd_yield(); + } + } return AL_TRUE; case AL_BUFFER: - LockBuffersRead(device); + LockBufferList(device); if(!(*values == 0 || (buffer=LookupBuffer(device, *values)) != NULL)) { - UnlockBuffersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + UnlockBufferList(device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid buffer ID %u", + *values); } - WriteLock(&Source->queue_lock); - if(!(Source->state == AL_STOPPED || Source->state == AL_INITIAL)) + if(buffer && buffer->MappedAccess != 0 && + !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT)) { - WriteUnlock(&Source->queue_lock); - UnlockBuffersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + UnlockBufferList(device); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting non-persistently mapped buffer %u", buffer->id); + } + else + { + ALenum state = GetSourceState(Source, GetSourceVoice(Source, Context)); + if(state == AL_PLAYING || state == AL_PAUSED) + { + UnlockBufferList(device); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting buffer on playing or paused source %u", Source->id); + } } + oldlist = Source->queue; if(buffer != NULL) { /* Add the selected buffer to a one-item queue */ - newlist = malloc(sizeof(ALbufferlistitem)); - newlist->buffer = buffer; - newlist->next = NULL; + ALbufferlistitem *newlist = al_calloc(DEF_ALIGN, + FAM_SIZE(ALbufferlistitem, buffers, 1)); + ATOMIC_INIT(&newlist->next, NULL); + newlist->max_samples = buffer->SampleLen; + newlist->num_buffers = 1; + newlist->buffers[0] = buffer; IncrementRef(&buffer->ref); /* Source is now Static */ Source->SourceType = AL_STATIC; - - ReadLock(&buffer->lock); - Source->NumChannels = ChannelsFromFmt(buffer->FmtChannels); - Source->SampleSize = BytesFromFmt(buffer->FmtType); - ReadUnlock(&buffer->lock); + Source->queue = newlist; } else { /* Source is now Undetermined */ Source->SourceType = AL_UNDETERMINED; - newlist = NULL; + Source->queue = NULL; } - oldlist = ATOMIC_EXCHANGE(ALbufferlistitem*, &Source->queue, newlist); - ATOMIC_STORE(&Source->current_buffer, newlist); - WriteUnlock(&Source->queue_lock); - UnlockBuffersRead(device); + UnlockBufferList(device); /* Delete all elements in the previous queue */ while(oldlist != NULL) { + ALsizei i; ALbufferlistitem *temp = oldlist; - oldlist = temp->next; + oldlist = ATOMIC_LOAD(&temp->next, almemory_order_relaxed); - if(temp->buffer) - DecrementRef(&temp->buffer->ref); - free(temp); + for(i = 0;i < temp->num_buffers;i++) + { + if(temp->buffers[i]) + DecrementRef(&temp->buffers[i]->ref); + } + al_free(temp); } return AL_TRUE; @@ -710,28 +876,32 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->OffsetType = prop; Source->Offset = *values; - if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) && - !ATOMIC_LOAD(&Context->DeferUpdates, almemory_order_acquire)) + if(IsPlayingOrPaused(Source)) { - LockContext(Context); - WriteLock(&Source->queue_lock); - if(ApplyOffset(Source) == AL_FALSE) + ALvoice *voice; + + ALCdevice_Lock(Context->Device); + voice = GetSourceVoice(Source, Context); + if(voice) { - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + if(ApplyOffset(Source, voice) == AL_FALSE) + { + ALCdevice_Unlock(Context->Device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, + "Invalid source offset"); + } } - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); + ALCdevice_Unlock(Context->Device); } return AL_TRUE; case AL_DIRECT_FILTER: - LockFiltersRead(device); + LockFilterList(device); if(!(*values == 0 || (filter=LookupFilter(device, *values)) != NULL)) { - UnlockFiltersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + UnlockFilterList(device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u", + *values); } if(!filter) @@ -750,7 +920,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Direct.GainLF = filter->GainLF; Source->Direct.LFReference = filter->LFReference; } - UnlockFiltersRead(device); + UnlockFilterList(device); DO_UPDATEPROPS(); return AL_TRUE; @@ -796,17 +966,41 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p DO_UPDATEPROPS(); return AL_TRUE; + case AL_SOURCE_RESAMPLER_SOFT: + CHECKVAL(*values >= 0 && *values <= ResamplerMax); + + Source->Resampler = *values; + DO_UPDATEPROPS(); + return AL_TRUE; + + case AL_SOURCE_SPATIALIZE_SOFT: + CHECKVAL(*values >= AL_FALSE && *values <= AL_AUTO_SOFT); + + Source->Spatialize = *values; + DO_UPDATEPROPS(); + return AL_TRUE; + case AL_AUXILIARY_SEND_FILTER: - LockEffectSlotsRead(Context); - LockFiltersRead(device); - if(!((ALuint)values[1] < device->NumAuxSends && - (values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL) && - (values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL))) + LockEffectSlotList(Context); + if(!(values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL)) { - UnlockFiltersRead(device); - UnlockEffectSlotsRead(Context); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + UnlockEffectSlotList(Context); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid effect ID %u", + values[0]); + } + if(!((ALuint)values[1] < (ALuint)device->NumAuxSends)) + { + UnlockEffectSlotList(Context); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid send %u", values[1]); + } + LockFilterList(device); + if(!(values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL)) + { + UnlockFilterList(device); + UnlockEffectSlotList(Context); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u", + values[2]); } if(!filter) @@ -826,21 +1020,24 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Send[values[1]].GainLF = filter->GainLF; Source->Send[values[1]].LFReference = filter->LFReference; } - UnlockFiltersRead(device); + UnlockFilterList(device); - if(slot != Source->Send[values[1]].Slot && - (Source->state == AL_PLAYING || Source->state == AL_PAUSED)) + if(slot != Source->Send[values[1]].Slot && IsPlayingOrPaused(Source)) { + ALvoice *voice; /* Add refcount on the new slot, and release the previous slot */ if(slot) IncrementRef(&slot->ref); if(Source->Send[values[1]].Slot) DecrementRef(&Source->Send[values[1]].Slot->ref); Source->Send[values[1]].Slot = slot; - /* We must force an update if the auxiliary slot changed on a - * playing source, in case the slot is about to be deleted. + /* We must force an update if the auxiliary slot changed on an + * active source, in case the slot is about to be deleted. */ - UpdateSourceProps(Source, device->NumAuxSends); + if((voice=GetSourceVoice(Source, Context)) != NULL) + UpdateSourceProps(Source, voice, device->NumAuxSends, Context); + else + ATOMIC_FLAG_CLEAR(&Source->PropsClean, almemory_order_release); } else { @@ -850,7 +1047,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Send[values[1]].Slot = slot; DO_UPDATEPROPS(); } - UnlockEffectSlotsRead(Context); + UnlockEffectSlotList(Context); return AL_TRUE; @@ -895,12 +1092,15 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SAMPLE_OFFSET_LATENCY_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x", + prop); } static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint64SOFT *values) @@ -915,12 +1115,10 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_BUFFERS_PROCESSED: case AL_SOURCE_STATE: case AL_SAMPLE_OFFSET_LATENCY_SOFT: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); - + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting read-only source property 0x%04x", prop); /* 1x int */ case AL_SOURCE_RELATIVE: @@ -933,6 +1131,8 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: case AL_DISTANCE_MODEL: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: CHECKVAL(*values <= INT_MAX && *values >= INT_MIN); ivals[0] = (ALint)*values; @@ -996,12 +1196,14 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp return SetSourcefv(Source, Context, (int)prop, fvals); case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x", + prop); } #undef CHECKVAL @@ -1010,7 +1212,6 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALdouble *values) { ALCdevice *device = Context->Device; - ALbufferlistitem *BufferList; ClockLatency clocktime; ALuint64 srcclock; ALint ivals[3]; @@ -1031,7 +1232,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p return AL_TRUE; case AL_ROLLOFF_FACTOR: - *values = Source->RollOffFactor; + *values = Source->RolloffFactor; return AL_TRUE; case AL_REFERENCE_DISTANCE: @@ -1061,7 +1262,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SEC_OFFSET: case AL_SAMPLE_OFFSET: case AL_BYTE_OFFSET: - *values = GetSourceOffset(Source, prop, device); + *values = GetSourceOffset(Source, prop, Context); return AL_TRUE; case AL_CONE_OUTER_GAINHF: @@ -1080,27 +1281,6 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p *values = Source->DopplerFactor; return AL_TRUE; - case AL_SEC_LENGTH_SOFT: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) - *values = 0; - else - { - ALint length = 0; - ALsizei freq = 1; - do { - ALbuffer *buffer = BufferList->buffer; - if(buffer && buffer->SampleLen > 0) - { - freq = buffer->Frequency; - length += buffer->SampleLen; - } - } while((BufferList=BufferList->next) != NULL); - *values = (ALdouble)length / (ALdouble)freq; - } - ReadUnlock(&Source->queue_lock); - return AL_TRUE; - case AL_SOURCE_RADIUS: *values = Source->Radius; return AL_TRUE; @@ -1114,8 +1294,10 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p /* Get the source offset with the clock time first. Then get the * clock time with the device latency. Order is important. */ - values[0] = GetSourceSecOffset(Source, device, &srcclock); + values[0] = GetSourceSecOffset(Source, Context, &srcclock); + almtx_lock(&device->BackendLock); clocktime = V0(device->Backend,getClockLatency)(); + almtx_unlock(&device->BackendLock); if(srcclock == (ALuint64)clocktime.ClockTime) values[1] = (ALdouble)clocktime.Latency / 1000000000.0; else @@ -1130,6 +1312,11 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p } return AL_TRUE; + case AL_SEC_OFFSET_CLOCK_SOFT: + values[0] = GetSourceSecOffset(Source, Context, &srcclock); + values[1] = srcclock / 1000000000.0; + return AL_TRUE; + case AL_POSITION: values[0] = Source->Position[0]; values[1] = Source->Position[1]; @@ -1168,9 +1355,9 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: case AL_DISTANCE_MODEL: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: if((err=GetSourceiv(Source, Context, (int)prop, ivals)) != AL_FALSE) *values = (ALdouble)ivals[0]; return err; @@ -1179,11 +1366,13 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_DIRECT_FILTER: case AL_AUXILIARY_SEND_FILTER: case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source double property 0x%04x", + prop); } static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values) @@ -1199,94 +1388,35 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p return AL_TRUE; case AL_LOOPING: - *values = ATOMIC_LOAD(&Source->looping); + *values = Source->Looping; return AL_TRUE; case AL_BUFFER: - ReadLock(&Source->queue_lock); - BufferList = (Source->SourceType == AL_STATIC) ? ATOMIC_LOAD(&Source->queue) : - ATOMIC_LOAD(&Source->current_buffer); - *values = (BufferList && BufferList->buffer) ? BufferList->buffer->id : 0; - ReadUnlock(&Source->queue_lock); + BufferList = (Source->SourceType == AL_STATIC) ? Source->queue : NULL; + *values = (BufferList && BufferList->num_buffers >= 1 && BufferList->buffers[0]) ? + BufferList->buffers[0]->id : 0; return AL_TRUE; case AL_SOURCE_STATE: - *values = Source->state; - return AL_TRUE; - - case AL_BYTE_LENGTH_SOFT: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) - *values = 0; - else - { - ALint length = 0; - do { - ALbuffer *buffer = BufferList->buffer; - if(buffer && buffer->SampleLen > 0) - { - ALuint byte_align, sample_align; - if(buffer->OriginalType == UserFmtIMA4) - { - ALsizei align = (buffer->OriginalAlign-1)/2 + 4; - byte_align = align * ChannelsFromFmt(buffer->FmtChannels); - sample_align = buffer->OriginalAlign; - } - else if(buffer->OriginalType == UserFmtMSADPCM) - { - ALsizei align = (buffer->OriginalAlign-2)/2 + 7; - byte_align = align * ChannelsFromFmt(buffer->FmtChannels); - sample_align = buffer->OriginalAlign; - } - else - { - ALsizei align = buffer->OriginalAlign; - byte_align = align * ChannelsFromFmt(buffer->FmtChannels); - sample_align = buffer->OriginalAlign; - } - - length += buffer->SampleLen / sample_align * byte_align; - } - } while((BufferList=BufferList->next) != NULL); - *values = length; - } - ReadUnlock(&Source->queue_lock); - return AL_TRUE; - - case AL_SAMPLE_LENGTH_SOFT: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) - *values = 0; - else - { - ALint length = 0; - do { - ALbuffer *buffer = BufferList->buffer; - if(buffer) length += buffer->SampleLen; - } while((BufferList=BufferList->next) != NULL); - *values = length; - } - ReadUnlock(&Source->queue_lock); + *values = GetSourceState(Source, GetSourceVoice(Source, Context)); return AL_TRUE; case AL_BUFFERS_QUEUED: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) + if(!(BufferList=Source->queue)) *values = 0; else { ALsizei count = 0; do { - ++count; - } while((BufferList=BufferList->next) != NULL); + count += BufferList->num_buffers; + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + } while(BufferList != NULL); *values = count; } - ReadUnlock(&Source->queue_lock); return AL_TRUE; case AL_BUFFERS_PROCESSED: - ReadLock(&Source->queue_lock); - if(ATOMIC_LOAD(&Source->looping) || Source->SourceType != AL_STREAMING) + if(Source->Looping || Source->SourceType != AL_STREAMING) { /* Buffers on a looping source are in a perpetual state of * PENDING, so don't report any as PROCESSED */ @@ -1294,17 +1424,24 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p } else { - const ALbufferlistitem *BufferList = ATOMIC_LOAD(&Source->queue); - const ALbufferlistitem *Current = ATOMIC_LOAD(&Source->current_buffer); + const ALbufferlistitem *BufferList = Source->queue; + const ALbufferlistitem *Current = NULL; ALsizei played = 0; + ALvoice *voice; + + if((voice=GetSourceVoice(Source, Context)) != NULL) + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + else if(Source->state == AL_INITIAL) + Current = BufferList; + while(BufferList && BufferList != Current) { - played++; - BufferList = BufferList->next; + played += BufferList->num_buffers; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); } *values = played; } - ReadUnlock(&Source->queue_lock); return AL_TRUE; case AL_SOURCE_TYPE: @@ -1331,6 +1468,14 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p *values = Source->DistanceModel; return AL_TRUE; + case AL_SOURCE_RESAMPLER_SOFT: + *values = Source->Resampler; + return AL_TRUE; + + case AL_SOURCE_SPATIALIZE_SOFT: + *values = Source->Spatialize; + return AL_TRUE; + /* 1x float/double */ case AL_CONE_INNER_ANGLE: case AL_CONE_OUTER_ANGLE: @@ -1349,7 +1494,6 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_AIR_ABSORPTION_FACTOR: case AL_ROOM_ROLLOFF_FACTOR: case AL_CONE_OUTER_GAINHF: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: if((err=GetSourcedv(Source, Context, prop, dvals)) != AL_FALSE) *values = (ALint)dvals[0]; @@ -1381,8 +1525,10 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p return err; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -1393,7 +1539,8 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x", + prop); } static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values) @@ -1411,8 +1558,10 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp /* Get the source offset with the clock time first. Then get the * clock time with the device latency. Order is important. */ - values[0] = GetSourceSampleOffset(Source, device, &srcclock); + values[0] = GetSourceSampleOffset(Source, Context, &srcclock); + almtx_lock(&device->BackendLock); clocktime = V0(device->Backend,getClockLatency)(); + almtx_unlock(&device->BackendLock); if(srcclock == (ALuint64)clocktime.ClockTime) values[1] = clocktime.Latency; else @@ -1426,6 +1575,11 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp } return AL_TRUE; + case AL_SAMPLE_OFFSET_CLOCK_SOFT: + values[0] = GetSourceSampleOffset(Source, Context, &srcclock); + values[1] = srcclock; + return AL_TRUE; + /* 1x float/double */ case AL_CONE_INNER_ANGLE: case AL_CONE_OUTER_ANGLE: @@ -1444,7 +1598,6 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_AIR_ABSORPTION_FACTOR: case AL_ROOM_ROLLOFF_FACTOR: case AL_CONE_OUTER_GAINHF: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: if((err=GetSourcedv(Source, Context, prop, dvals)) != AL_FALSE) *values = (ALint64)dvals[0]; @@ -1481,14 +1634,14 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_SOURCE_STATE: case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: case AL_SOURCE_TYPE: case AL_DIRECT_FILTER_GAINHF_AUTO: case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: case AL_DISTANCE_MODEL: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: if((err=GetSourceiv(Source, Context, prop, ivals)) != AL_FALSE) *values = ivals[0]; return err; @@ -1511,13 +1664,15 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp return err; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x", + prop); } @@ -1525,40 +1680,23 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) { ALCcontext *context; ALsizei cur = 0; - ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d sources", n); + else for(cur = 0;cur < n;cur++) { - ALsource *source = al_calloc(16, sizeof(ALsource)); + ALsource *source = AllocSource(context); if(!source) { alDeleteSources(cur, sources); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); + break; } - InitSourceParams(source); - - err = NewThunkEntry(&source->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&context->SourceMap, source->id, source); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(source->id); - memset(source, 0, sizeof(ALsource)); - al_free(source); - - alDeleteSources(cur, sources); - SET_ERROR_AND_GOTO(context, err, done); - } - sources[cur] = source->id; } -done: ALCcontext_DecRef(context); } @@ -1572,44 +1710,24 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) context = GetContextRef(); if(!context) return; - LockSourcesWrite(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d sources", n); /* Check that all Sources are valid */ for(i = 0;i < n;i++) { if(LookupSource(context, sources[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } for(i = 0;i < n;i++) { - ALvoice *voice, *voice_end; - - if((Source=RemoveSource(context, sources[i])) == NULL) - continue; - FreeThunkEntry(Source->id); - - LockContext(context); - voice = context->Voices; - voice_end = voice + context->VoiceCount; - while(voice != voice_end) - { - ALsource *old = Source; - if(COMPARE_EXCHANGE(&voice->Source, &old, NULL)) - break; - voice++; - } - UnlockContext(context); - - DeinitSource(Source); - - memset(Source, 0, sizeof(*Source)); - al_free(Source); + if((Source=LookupSource(context, sources[i])) != NULL) + FreeSource(context, Source); } done: - UnlockSourcesWrite(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -1622,9 +1740,9 @@ AL_API ALboolean AL_APIENTRY alIsSource(ALuint source) context = GetContextRef(); if(!context) return AL_FALSE; - LockSourcesRead(context); + LockSourceList(context); ret = (LookupSource(context, source) ? AL_TRUE : AL_FALSE); - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); @@ -1640,16 +1758,16 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(FloatValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float property 0x%04x", param); else SetSourcefv(Source, Context, param, &value); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1662,19 +1780,19 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1 Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(FloatValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param); else { ALfloat fvals[3] = { value1, value2, value3 }; SetSourcefv(Source, Context, param, fvals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1687,18 +1805,18 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(FloatValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param); else SetSourcefv(Source, Context, param, values); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1712,19 +1830,19 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(DoubleValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double property 0x%04x", param); else { ALfloat fval = (ALfloat)value; SetSourcefv(Source, Context, param, &fval); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1737,19 +1855,19 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(DoubleValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param); else { ALfloat fvals[3] = { (ALfloat)value1, (ALfloat)value2, (ALfloat)value3 }; SetSourcefv(Source, Context, param, fvals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1763,14 +1881,14 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!((count=DoubleValsByProp(param)) > 0 && count <= 6)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param); else { ALfloat fvals[6]; @@ -1780,8 +1898,8 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo fvals[i] = (ALfloat)values[i]; SetSourcefv(Source, Context, param, fvals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1795,16 +1913,16 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(IntValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer property 0x%04x", param); else SetSourceiv(Source, Context, param, &value); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1817,19 +1935,19 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(IntValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param); else { ALint ivals[3] = { value1, value2, value3 }; SetSourceiv(Source, Context, param, ivals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1842,18 +1960,18 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param); else SetSourceiv(Source, Context, param, values); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1867,16 +1985,16 @@ AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SO Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(Int64ValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param); else SetSourcei64v(Source, Context, param, &value); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1889,19 +2007,19 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(Int64ValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param); else { ALint64SOFT i64vals[3] = { value1, value2, value3 }; SetSourcei64v(Source, Context, param, i64vals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1914,18 +2032,18 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param); else SetSourcei64v(Source, Context, param, values); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1939,22 +2057,20 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *val Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(FloatValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float property 0x%04x", param); else { ALdouble dval; if(GetSourcedv(Source, Context, param, &dval)) *value = (ALfloat)dval; } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -1968,14 +2084,13 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(FloatValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param); else { ALdouble dvals[3]; @@ -1986,8 +2101,7 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va *value3 = (ALfloat)dvals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2002,14 +2116,13 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!((count=FloatValsByProp(param)) > 0 && count <= 6)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param); else { ALdouble dvals[6]; @@ -2020,8 +2133,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va values[i] = (ALfloat)dvals[i]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2035,18 +2147,16 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble * Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(DoubleValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double property 0x%04x", param); else GetSourcedv(Source, Context, param, value); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2059,14 +2169,13 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(DoubleValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param); else { ALdouble dvals[3]; @@ -2077,8 +2186,7 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value3 = dvals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2091,18 +2199,16 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(DoubleValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param); else GetSourcedv(Source, Context, param, values); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2116,18 +2222,16 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer property 0x%04x", param); else GetSourceiv(Source, Context, param, value); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2141,14 +2245,13 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1 Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param); else { ALint ivals[3]; @@ -2159,8 +2262,7 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1 *value3 = ivals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2174,18 +2276,16 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param); else GetSourceiv(Source, Context, param, values); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2199,18 +2299,16 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param); else GetSourcei64v(Source, Context, param, value); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2223,14 +2321,13 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param); else { ALint64 i64vals[3]; @@ -2241,8 +2338,7 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 *value3 = i64vals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2255,18 +2351,16 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64 Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param); else GetSourcei64v(Source, Context, param, values); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2279,63 +2373,183 @@ AL_API ALvoid AL_APIENTRY alSourcePlay(ALuint source) AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; - ALsizei i; + ALvoice *voice; + ALsizei i, j; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Playing %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); + } + + device = context->Device; + ALCdevice_Lock(device); + /* If the device is disconnected, go right to stopped. */ + if(!ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) + { + /* TODO: Send state change event? */ + for(i = 0;i < n;i++) + { + source = LookupSource(context, sources[i]); + source->OffsetType = AL_NONE; + source->Offset = 0.0; + source->state = AL_STOPPED; + } + ALCdevice_Unlock(device); + goto done; } - LockContext(context); while(n > context->MaxVoices-context->VoiceCount) { - ALvoice *temp = NULL; - ALsizei newcount; - - newcount = context->MaxVoices << 1; - if(newcount > 0) - temp = al_malloc(16, newcount * sizeof(context->Voices[0])); - if(!temp) + ALsizei newcount = context->MaxVoices << 1; + if(context->MaxVoices >= newcount) { - UnlockContext(context); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); + ALCdevice_Unlock(device); + SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, + "Overflow increasing voice count %d -> %d", context->MaxVoices, newcount); } - memcpy(temp, context->Voices, context->MaxVoices * sizeof(temp[0])); - memset(&temp[context->MaxVoices], 0, (newcount-context->MaxVoices) * sizeof(temp[0])); - - al_free(context->Voices); - context->Voices = temp; - context->MaxVoices = newcount; + AllocateVoices(context, newcount, device->NumAuxSends); } - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + for(i = 0;i < n;i++) { - for(i = 0;i < n;i++) + ALbufferlistitem *BufferList; + bool start_fading = false; + ALint vidx = -1; + + source = LookupSource(context, sources[i]); + /* Check that there is a queue containing at least one valid, non zero + * length buffer. + */ + BufferList = source->queue; + while(BufferList && BufferList->max_samples == 0) + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + + /* If there's nothing to play, go right to stopped. */ + if(UNLIKELY(!BufferList)) { - source = LookupSource(context, sources[i]); - source->new_state = AL_PLAYING; + /* NOTE: A source without any playable buffers should not have an + * ALvoice since it shouldn't be in a playing or paused state. So + * there's no need to look up its voice and clear the source. + */ + ALenum oldstate = GetSourceState(source, NULL); + source->OffsetType = AL_NONE; + source->Offset = 0.0; + if(oldstate != AL_STOPPED) + { + source->state = AL_STOPPED; + SendStateChangeEvent(context, source->id, AL_STOPPED); + } + continue; } - } - else - { - for(i = 0;i < n;i++) + + voice = GetSourceVoice(source, context); + switch(GetSourceState(source, voice)) { - source = LookupSource(context, sources[i]); - SetSourceState(source, context, AL_PLAYING); + case AL_PLAYING: + assert(voice != NULL); + /* A source that's already playing is restarted from the beginning. */ + ATOMIC_STORE(&voice->current_buffer, BufferList, almemory_order_relaxed); + ATOMIC_STORE(&voice->position, 0, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, 0, almemory_order_release); + continue; + + case AL_PAUSED: + assert(voice != NULL); + /* A source that's paused simply resumes. */ + ATOMIC_STORE(&voice->Playing, true, almemory_order_release); + source->state = AL_PLAYING; + SendStateChangeEvent(context, source->id, AL_PLAYING); + continue; + + default: + break; } + + /* Look for an unused voice to play this source with. */ + assert(voice == NULL); + for(j = 0;j < context->VoiceCount;j++) + { + if(ATOMIC_LOAD(&context->Voices[j]->Source, almemory_order_acquire) == NULL) + { + vidx = j; + break; + } + } + if(vidx == -1) + vidx = context->VoiceCount++; + voice = context->Voices[vidx]; + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + + ATOMIC_FLAG_TEST_AND_SET(&source->PropsClean, almemory_order_acquire); + UpdateSourceProps(source, voice, device->NumAuxSends, context); + + /* A source that's not playing or paused has any offset applied when it + * starts playing. + */ + if(source->Looping) + ATOMIC_STORE(&voice->loop_buffer, source->queue, almemory_order_relaxed); + else + ATOMIC_STORE(&voice->loop_buffer, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->current_buffer, BufferList, almemory_order_relaxed); + ATOMIC_STORE(&voice->position, 0, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, 0, almemory_order_relaxed); + if(ApplyOffset(source, voice) != AL_FALSE) + start_fading = ATOMIC_LOAD(&voice->position, almemory_order_relaxed) != 0 || + ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed) != 0 || + ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed) != BufferList; + + for(j = 0;j < BufferList->num_buffers;j++) + { + ALbuffer *buffer = BufferList->buffers[j]; + if(buffer) + { + voice->NumChannels = ChannelsFromFmt(buffer->FmtChannels); + voice->SampleSize = BytesFromFmt(buffer->FmtType); + break; + } + } + + /* Clear previous samples. */ + memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples)); + + /* Clear the stepping value so the mixer knows not to mix this until + * the update gets applied. + */ + voice->Step = 0; + + voice->Flags = start_fading ? VOICE_IS_FADING : 0; + if(source->SourceType == AL_STATIC) voice->Flags |= VOICE_IS_STATIC; + memset(voice->Direct.Params, 0, sizeof(voice->Direct.Params[0])*voice->NumChannels); + for(j = 0;j < device->NumAuxSends;j++) + memset(voice->Send[j].Params, 0, sizeof(voice->Send[j].Params[0])*voice->NumChannels); + if(device->AvgSpeakerDist > 0.0f) + { + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (device->AvgSpeakerDist * device->Frequency); + for(j = 0;j < voice->NumChannels;j++) + NfcFilterCreate(&voice->Direct.Params[j].NFCtrlFilter, 0.0f, w1); + } + + ATOMIC_STORE(&voice->Source, source, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, true, almemory_order_release); + source->state = AL_PLAYING; + source->VoiceIdx = vidx; + + SendStateChangeEvent(context, source->id, AL_PLAYING); } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2346,42 +2560,40 @@ AL_API ALvoid AL_APIENTRY alSourcePause(ALuint source) AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; + ALvoice *voice; ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Pausing %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } - LockContext(context); - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) + device = context->Device; + ALCdevice_Lock(device); + for(i = 0;i < n;i++) { - for(i = 0;i < n;i++) + source = LookupSource(context, sources[i]); + if((voice=GetSourceVoice(source, context)) != NULL) + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + if(GetSourceState(source, voice) == AL_PLAYING) { - source = LookupSource(context, sources[i]); - source->new_state = AL_PAUSED; + source->state = AL_PAUSED; + SendStateChangeEvent(context, source->id, AL_PAUSED); } } - else - { - for(i = 0;i < n;i++) - { - source = LookupSource(context, sources[i]); - SetSourceState(source, context, AL_PAUSED); - } - } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2392,32 +2604,48 @@ AL_API ALvoid AL_APIENTRY alSourceStop(ALuint source) AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; + ALvoice *voice; ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Stopping %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } - LockContext(context); + device = context->Device; + ALCdevice_Lock(device); for(i = 0;i < n;i++) { + ALenum oldstate; source = LookupSource(context, sources[i]); - source->new_state = AL_NONE; - SetSourceState(source, context, AL_STOPPED); + if((voice=GetSourceVoice(source, context)) != NULL) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + voice = NULL; + } + oldstate = GetSourceState(source, voice); + if(oldstate != AL_INITIAL && oldstate != AL_STOPPED) + { + source->state = AL_STOPPED; + SendStateChangeEvent(context, source->id, AL_STOPPED); + } + source->OffsetType = AL_NONE; + source->Offset = 0.0; } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2428,32 +2656,46 @@ AL_API ALvoid AL_APIENTRY alSourceRewind(ALuint source) AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; + ALvoice *voice; ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Rewinding %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } - LockContext(context); + device = context->Device; + ALCdevice_Lock(device); for(i = 0;i < n;i++) { source = LookupSource(context, sources[i]); - source->new_state = AL_NONE; - SetSourceState(source, context, AL_INITIAL); + if((voice=GetSourceVoice(source, context)) != NULL) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + voice = NULL; + } + if(GetSourceState(source, voice) != AL_INITIAL) + { + source->state = AL_INITIAL; + SendStateChangeEvent(context, source->id, AL_INITIAL); + } + source->OffsetType = AL_NONE; + source->Offset = 0.0; } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2476,126 +2718,111 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu device = context->Device; - LockSourcesRead(context); + LockSourceList(context); if(!(nb >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Queueing %d buffers", nb); if((source=LookupSource(context, src)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", src); - WriteLock(&source->queue_lock); if(source->SourceType == AL_STATIC) { - WriteUnlock(&source->queue_lock); /* Can't queue on a Static Source */ - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_OPERATION, done, "Queueing onto static source %u", src); } /* Check for a valid Buffer, for its frequency and format */ - BufferList = ATOMIC_LOAD(&source->queue); + BufferList = source->queue; while(BufferList) { - if(BufferList->buffer) + for(i = 0;i < BufferList->num_buffers;i++) { - BufferFmt = BufferList->buffer; - break; + if((BufferFmt=BufferList->buffers[i]) != NULL) + break; } - BufferList = BufferList->next; + if(BufferFmt) break; + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); } - LockBuffersRead(device); + LockBufferList(device); BufferListStart = NULL; BufferList = NULL; for(i = 0;i < nb;i++) { ALbuffer *buffer = NULL; if(buffers[i] && (buffer=LookupBuffer(device, buffers[i])) == NULL) - { - WriteUnlock(&source->queue_lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, buffer_error); - } + SETERR_GOTO(context, AL_INVALID_NAME, buffer_error, "Queueing invalid buffer ID %u", + buffers[i]); if(!BufferListStart) { - BufferListStart = malloc(sizeof(ALbufferlistitem)); + BufferListStart = al_calloc(DEF_ALIGN, + FAM_SIZE(ALbufferlistitem, buffers, 1)); BufferList = BufferListStart; } else { - BufferList->next = malloc(sizeof(ALbufferlistitem)); - BufferList = BufferList->next; + ALbufferlistitem *item = al_calloc(DEF_ALIGN, + FAM_SIZE(ALbufferlistitem, buffers, 1)); + ATOMIC_STORE(&BufferList->next, item, almemory_order_relaxed); + BufferList = item; } - BufferList->buffer = buffer; - BufferList->next = NULL; + ATOMIC_INIT(&BufferList->next, NULL); + BufferList->max_samples = buffer ? buffer->SampleLen : 0; + BufferList->num_buffers = 1; + BufferList->buffers[0] = buffer; if(!buffer) continue; - /* Hold a read lock on each buffer being queued while checking all - * provided buffers. This is done so other threads don't see an extra - * reference on some buffers if this operation ends up failing. */ - ReadLock(&buffer->lock); IncrementRef(&buffer->ref); - if(BufferFmt == NULL) - { - BufferFmt = buffer; + if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT)) + SETERR_GOTO(context, AL_INVALID_OPERATION, buffer_error, + "Queueing non-persistently mapped buffer %u", buffer->id); - source->NumChannels = ChannelsFromFmt(buffer->FmtChannels); - source->SampleSize = BytesFromFmt(buffer->FmtType); - } + if(BufferFmt == NULL) + BufferFmt = buffer; else if(BufferFmt->Frequency != buffer->Frequency || - BufferFmt->OriginalChannels != buffer->OriginalChannels || + BufferFmt->FmtChannels != buffer->FmtChannels || BufferFmt->OriginalType != buffer->OriginalType) { - WriteUnlock(&source->queue_lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, buffer_error); + alSetError(context, AL_INVALID_OPERATION, "Queueing buffer with mismatched format"); buffer_error: /* A buffer failed (invalid ID or format), so unlock and release * each buffer we had. */ while(BufferListStart) { - ALbufferlistitem *next = BufferListStart->next; - if((buffer=BufferListStart->buffer) != NULL) + ALbufferlistitem *next = ATOMIC_LOAD(&BufferListStart->next, + almemory_order_relaxed); + for(i = 0;i < BufferListStart->num_buffers;i++) { - DecrementRef(&buffer->ref); - ReadUnlock(&buffer->lock); + if((buffer=BufferListStart->buffers[i]) != NULL) + DecrementRef(&buffer->ref); } - free(BufferListStart); + al_free(BufferListStart); BufferListStart = next; } - UnlockBuffersRead(device); + UnlockBufferList(device); goto done; } } - /* All buffers good, unlock them now. */ - BufferList = BufferListStart; - while(BufferList != NULL) - { - ALbuffer *buffer = BufferList->buffer; - if(buffer) ReadUnlock(&buffer->lock); - BufferList = BufferList->next; - } - UnlockBuffersRead(device); + /* All buffers good. */ + UnlockBufferList(device); /* Source is now streaming */ source->SourceType = AL_STREAMING; - BufferList = NULL; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALbufferlistitem*, &source->queue, &BufferList, BufferListStart)) + if(!(BufferList=source->queue)) + source->queue = BufferListStart; + else { - /* Queue head is not NULL, append to the end of the queue */ - while(BufferList->next != NULL) - BufferList = BufferList->next; - BufferList->next = BufferListStart; + ALbufferlistitem *next; + while((next=ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed)) != NULL) + BufferList = next; + ATOMIC_STORE(&BufferList->next, BufferListStart, almemory_order_release); } - /* If the current buffer was at the end (NULL), put it at the start of the newly queued - * buffers. - */ - BufferList = NULL; - ATOMIC_COMPARE_EXCHANGE_STRONG(ALbufferlistitem*, &source->current_buffer, &BufferList, BufferListStart); - WriteUnlock(&source->queue_lock); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2603,98 +2830,102 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint { ALCcontext *context; ALsource *source; - ALbufferlistitem *OldHead; - ALbufferlistitem *OldTail; + ALbufferlistitem *BufferList; ALbufferlistitem *Current; - ALsizei i = 0; - - if(nb == 0) - return; + ALvoice *voice; + ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(nb >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing %d buffers", nb); if((source=LookupSource(context, src)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", src); - WriteLock(&source->queue_lock); - if(ATOMIC_LOAD(&source->looping) || source->SourceType != AL_STREAMING) - { - WriteUnlock(&source->queue_lock); - /* Trying to unqueue buffers on a looping or non-streaming source. */ - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } + /* Nothing to unqueue. */ + if(nb == 0) goto done; - /* Find the new buffer queue head */ - OldTail = ATOMIC_LOAD(&source->queue); - Current = ATOMIC_LOAD(&source->current_buffer); - if(OldTail != Current) - { - for(i = 1;i < nb;i++) - { - ALbufferlistitem *next = OldTail->next; - if(!next || next == Current) break; - OldTail = next; - } - } - if(i != nb) - { - WriteUnlock(&source->queue_lock); - /* Trying to unqueue pending buffers. */ - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } + if(source->Looping) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing from looping source %u", src); + if(source->SourceType != AL_STREAMING) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing from a non-streaming source %u", + src); - /* Swap it, and cut the new head from the old. */ - OldHead = ATOMIC_EXCHANGE(ALbufferlistitem*, &source->queue, OldTail->next); - if(OldTail->next) - { - ALCdevice *device = context->Device; - uint count; + /* Make sure enough buffers have been processed to unqueue. */ + BufferList = source->queue; + Current = NULL; + if((voice=GetSourceVoice(source, context)) != NULL) + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + else if(source->state == AL_INITIAL) + Current = BufferList; + if(BufferList == Current) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing pending buffers"); - /* Once the active mix (if any) is done, it's safe to cut the old tail - * from the new head. + i = BufferList->num_buffers; + while(i < nb) + { + /* If the next bufferlist to check is NULL or is the current one, it's + * trying to unqueue pending buffers. */ - if(((count=ReadRef(&device->MixCount))&1) != 0) - { - while(count == ReadRef(&device->MixCount)) - althrd_yield(); - } - OldTail->next = NULL; + ALbufferlistitem *next = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + if(!next || next == Current) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing pending buffers"); + BufferList = next; + + i += BufferList->num_buffers; } - WriteUnlock(&source->queue_lock); - while(OldHead != NULL) + while(nb > 0) { - ALbufferlistitem *next = OldHead->next; - ALbuffer *buffer = OldHead->buffer; - - if(!buffer) - *(buffers++) = 0; - else + ALbufferlistitem *head = source->queue; + ALbufferlistitem *next = ATOMIC_LOAD(&head->next, almemory_order_relaxed); + for(i = 0;i < head->num_buffers && nb > 0;i++,nb--) { - *(buffers++) = buffer->id; - DecrementRef(&buffer->ref); + ALbuffer *buffer = head->buffers[i]; + if(!buffer) + *(buffers++) = 0; + else + { + *(buffers++) = buffer->id; + DecrementRef(&buffer->ref); + } + } + if(i < head->num_buffers) + { + /* This head has some buffers left over, so move them to the front + * and update the sample and buffer count. + */ + ALsizei max_length = 0; + ALsizei j = 0; + while(i < head->num_buffers) + { + ALbuffer *buffer = head->buffers[i++]; + if(buffer) max_length = maxi(max_length, buffer->SampleLen); + head->buffers[j++] = buffer; + } + head->max_samples = max_length; + head->num_buffers = j; + break; } - free(OldHead); - OldHead = next; + /* Otherwise, free this item and set the source queue head to the next + * one. + */ + al_free(head); + source->queue = next; } done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } -static void InitSourceParams(ALsource *Source) +static void InitSourceParams(ALsource *Source, ALsizei num_sends) { - ALuint i; - - RWLockInit(&Source->queue_lock); + ALsizei i; Source->InnerAngle = 360.0f; Source->OuterAngle = 360.0f; @@ -2716,7 +2947,7 @@ static void InitSourceParams(ALsource *Source) Source->Orientation[1][2] = 0.0f; Source->RefDistance = 1.0f; Source->MaxDistance = FLT_MAX; - Source->RollOffFactor = 1.0f; + Source->RolloffFactor = 1.0f; Source->Gain = 1.0f; Source->MinGain = 0.0f; Source->MaxGain = 1.0f; @@ -2729,22 +2960,27 @@ static void InitSourceParams(ALsource *Source) Source->AirAbsorptionFactor = 0.0f; Source->RoomRolloffFactor = 0.0f; Source->DopplerFactor = 1.0f; + Source->HeadRelative = AL_FALSE; + Source->Looping = AL_FALSE; + Source->DistanceModel = DefaultDistanceModel; + Source->Resampler = ResamplerDefault; Source->DirectChannels = AL_FALSE; + Source->Spatialize = SpatializeAuto; Source->StereoPan[0] = DEG2RAD( 30.0f); Source->StereoPan[1] = DEG2RAD(-30.0f); Source->Radius = 0.0f; - Source->DistanceModel = DefaultDistanceModel; - Source->Direct.Gain = 1.0f; Source->Direct.GainHF = 1.0f; Source->Direct.HFReference = LOWPASSFREQREF; Source->Direct.GainLF = 1.0f; Source->Direct.LFReference = HIGHPASSFREQREF; - for(i = 0;i < MAX_SENDS;i++) + Source->Send = al_calloc(16, num_sends*sizeof(Source->Send[0])); + for(i = 0;i < num_sends;i++) { + Source->Send[i].Slot = NULL; Source->Send[i].Gain = 1.0f; Source->Send[i].GainHF = 1.0f; Source->Send[i].HFReference = LOWPASSFREQREF; @@ -2756,353 +2992,198 @@ static void InitSourceParams(ALsource *Source) Source->OffsetType = AL_NONE; Source->SourceType = AL_UNDETERMINED; Source->state = AL_INITIAL; - Source->new_state = AL_NONE; - ATOMIC_INIT(&Source->queue, NULL); - ATOMIC_INIT(&Source->current_buffer, NULL); + Source->queue = NULL; - ATOMIC_INIT(&Source->position, 0); - ATOMIC_INIT(&Source->position_fraction, 0); + /* No way to do an 'init' here, so just test+set with relaxed ordering and + * ignore the test. + */ + ATOMIC_FLAG_TEST_AND_SET(&Source->PropsClean, almemory_order_relaxed); - ATOMIC_INIT(&Source->looping, AL_FALSE); - - ATOMIC_INIT(&Source->Update, NULL); - ATOMIC_INIT(&Source->FreeList, NULL); + Source->VoiceIdx = -1; } -static void DeinitSource(ALsource *source) +static void DeinitSource(ALsource *source, ALsizei num_sends) { ALbufferlistitem *BufferList; - struct ALsourceProps *props; - size_t count = 0; - size_t i; + ALsizei i; - props = ATOMIC_LOAD(&source->Update); - if(props) al_free(props); - - props = ATOMIC_LOAD(&source->FreeList, almemory_order_relaxed); - while(props) - { - struct ALsourceProps *next; - next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - al_free(props); - props = next; - ++count; - } - /* This is excessively spammy if it traces every source destruction, so - * just warn if it was unexpectedly large. - */ - if(count > 3) - WARN("Freed "SZFMT" Source property objects\n", count); - - BufferList = ATOMIC_EXCHANGE(ALbufferlistitem*, &source->queue, NULL); + BufferList = source->queue; while(BufferList != NULL) { - ALbufferlistitem *next = BufferList->next; - if(BufferList->buffer != NULL) - DecrementRef(&BufferList->buffer->ref); - free(BufferList); + ALbufferlistitem *next = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + for(i = 0;i < BufferList->num_buffers;i++) + { + if(BufferList->buffers[i] != NULL) + DecrementRef(&BufferList->buffers[i]->ref); + } + al_free(BufferList); BufferList = next; } + source->queue = NULL; - for(i = 0;i < MAX_SENDS;++i) + if(source->Send) { - if(source->Send[i].Slot) - DecrementRef(&source->Send[i].Slot->ref); - source->Send[i].Slot = NULL; + for(i = 0;i < num_sends;i++) + { + if(source->Send[i].Slot) + DecrementRef(&source->Send[i].Slot->ref); + source->Send[i].Slot = NULL; + } + al_free(source->Send); + source->Send = NULL; } } -static void UpdateSourceProps(ALsource *source, ALuint num_sends) +static void UpdateSourceProps(ALsource *source, ALvoice *voice, ALsizei num_sends, ALCcontext *context) { - struct ALsourceProps *props; - size_t i; + struct ALvoiceProps *props; + ALsizei i; /* Get an unused property container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&source->FreeList, almemory_order_acquire); + props = ATOMIC_LOAD(&context->FreeVoiceProps, almemory_order_acquire); if(!props) - props = al_calloc(16, sizeof(*props)); + props = al_calloc(16, FAM_SIZE(struct ALvoiceProps, Send, num_sends)); else { - struct ALsourceProps *next; + struct ALvoiceProps *next; do { next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*, - &source->FreeList, &props, next, almemory_order_seq_cst, - almemory_order_consume) == 0); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeVoiceProps, &props, next, + almemory_order_acq_rel, almemory_order_acquire) == 0); } /* Copy in current property values. */ - ATOMIC_STORE(&props->Pitch, source->Pitch, almemory_order_relaxed); - ATOMIC_STORE(&props->Gain, source->Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->OuterGain, source->OuterGain, almemory_order_relaxed); - ATOMIC_STORE(&props->MinGain, source->MinGain, almemory_order_relaxed); - ATOMIC_STORE(&props->MaxGain, source->MaxGain, almemory_order_relaxed); - ATOMIC_STORE(&props->InnerAngle, source->InnerAngle, almemory_order_relaxed); - ATOMIC_STORE(&props->OuterAngle, source->OuterAngle, almemory_order_relaxed); - ATOMIC_STORE(&props->RefDistance, source->RefDistance, almemory_order_relaxed); - ATOMIC_STORE(&props->MaxDistance, source->MaxDistance, almemory_order_relaxed); - ATOMIC_STORE(&props->RollOffFactor, source->RollOffFactor, almemory_order_relaxed); + props->Pitch = source->Pitch; + props->Gain = source->Gain; + props->OuterGain = source->OuterGain; + props->MinGain = source->MinGain; + props->MaxGain = source->MaxGain; + props->InnerAngle = source->InnerAngle; + props->OuterAngle = source->OuterAngle; + props->RefDistance = source->RefDistance; + props->MaxDistance = source->MaxDistance; + props->RolloffFactor = source->RolloffFactor; for(i = 0;i < 3;i++) - ATOMIC_STORE(&props->Position[i], source->Position[i], almemory_order_relaxed); + props->Position[i] = source->Position[i]; for(i = 0;i < 3;i++) - ATOMIC_STORE(&props->Velocity[i], source->Velocity[i], almemory_order_relaxed); + props->Velocity[i] = source->Velocity[i]; for(i = 0;i < 3;i++) - ATOMIC_STORE(&props->Direction[i], source->Direction[i], almemory_order_relaxed); + props->Direction[i] = source->Direction[i]; for(i = 0;i < 2;i++) { - size_t j; + ALsizei j; for(j = 0;j < 3;j++) - ATOMIC_STORE(&props->Orientation[i][j], source->Orientation[i][j], - almemory_order_relaxed); + props->Orientation[i][j] = source->Orientation[i][j]; } - ATOMIC_STORE(&props->HeadRelative, source->HeadRelative, almemory_order_relaxed); - ATOMIC_STORE(&props->DistanceModel, source->DistanceModel, almemory_order_relaxed); - ATOMIC_STORE(&props->DirectChannels, source->DirectChannels, almemory_order_relaxed); + props->HeadRelative = source->HeadRelative; + props->DistanceModel = source->DistanceModel; + props->Resampler = source->Resampler; + props->DirectChannels = source->DirectChannels; + props->SpatializeMode = source->Spatialize; - ATOMIC_STORE(&props->DryGainHFAuto, source->DryGainHFAuto, almemory_order_relaxed); - ATOMIC_STORE(&props->WetGainAuto, source->WetGainAuto, almemory_order_relaxed); - ATOMIC_STORE(&props->WetGainHFAuto, source->WetGainHFAuto, almemory_order_relaxed); - ATOMIC_STORE(&props->OuterGainHF, source->OuterGainHF, almemory_order_relaxed); + props->DryGainHFAuto = source->DryGainHFAuto; + props->WetGainAuto = source->WetGainAuto; + props->WetGainHFAuto = source->WetGainHFAuto; + props->OuterGainHF = source->OuterGainHF; - ATOMIC_STORE(&props->AirAbsorptionFactor, source->AirAbsorptionFactor, almemory_order_relaxed); - ATOMIC_STORE(&props->RoomRolloffFactor, source->RoomRolloffFactor, almemory_order_relaxed); - ATOMIC_STORE(&props->DopplerFactor, source->DopplerFactor, almemory_order_relaxed); + props->AirAbsorptionFactor = source->AirAbsorptionFactor; + props->RoomRolloffFactor = source->RoomRolloffFactor; + props->DopplerFactor = source->DopplerFactor; - ATOMIC_STORE(&props->StereoPan[0], source->StereoPan[0], almemory_order_relaxed); - ATOMIC_STORE(&props->StereoPan[1], source->StereoPan[1], almemory_order_relaxed); + props->StereoPan[0] = source->StereoPan[0]; + props->StereoPan[1] = source->StereoPan[1]; - ATOMIC_STORE(&props->Radius, source->Radius, almemory_order_relaxed); + props->Radius = source->Radius; - ATOMIC_STORE(&props->Direct.Gain, source->Direct.Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.GainHF, source->Direct.GainHF, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.HFReference, source->Direct.HFReference, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.GainLF, source->Direct.GainLF, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.LFReference, source->Direct.LFReference, almemory_order_relaxed); + props->Direct.Gain = source->Direct.Gain; + props->Direct.GainHF = source->Direct.GainHF; + props->Direct.HFReference = source->Direct.HFReference; + props->Direct.GainLF = source->Direct.GainLF; + props->Direct.LFReference = source->Direct.LFReference; for(i = 0;i < num_sends;i++) { - ATOMIC_STORE(&props->Send[i].Slot, source->Send[i].Slot, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].Gain, source->Send[i].Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].GainHF, source->Send[i].GainHF, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].HFReference, source->Send[i].HFReference, - almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].GainLF, source->Send[i].GainLF, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].LFReference, source->Send[i].LFReference, - almemory_order_relaxed); + props->Send[i].Slot = source->Send[i].Slot; + props->Send[i].Gain = source->Send[i].Gain; + props->Send[i].GainHF = source->Send[i].GainHF; + props->Send[i].HFReference = source->Send[i].HFReference; + props->Send[i].GainLF = source->Send[i].GainLF; + props->Send[i].LFReference = source->Send[i].LFReference; } /* Set the new container for updating internal parameters. */ - props = ATOMIC_EXCHANGE(struct ALsourceProps*, &source->Update, props, almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&voice->Update, props, almemory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the * freelist. */ - struct ALsourceProps *first = ATOMIC_LOAD(&source->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*, - &source->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALvoiceProps*, &context->FreeVoiceProps, props); } } void UpdateAllSourceProps(ALCcontext *context) { - ALuint num_sends = context->Device->NumAuxSends; + ALsizei num_sends = context->Device->NumAuxSends; ALsizei pos; for(pos = 0;pos < context->VoiceCount;pos++) { - ALvoice *voice = &context->Voices[pos]; - ALsource *source = voice->Source; - if(source != NULL && (source->state == AL_PLAYING || - source->state == AL_PAUSED)) - UpdateSourceProps(source, num_sends); + ALvoice *voice = context->Voices[pos]; + ALsource *source = ATOMIC_LOAD(&voice->Source, almemory_order_acquire); + if(source && !ATOMIC_FLAG_TEST_AND_SET(&source->PropsClean, almemory_order_acq_rel)) + UpdateSourceProps(source, voice, num_sends, context); } } -/* SetSourceState - * - * Sets the source's new play state given its current state. - */ -ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) -{ - WriteLock(&Source->queue_lock); - if(state == AL_PLAYING) - { - ALCdevice *device = Context->Device; - ALbufferlistitem *BufferList; - ALboolean discontinuity; - ALvoice *voice = NULL; - ALsizei i; - - /* Check that there is a queue containing at least one valid, non zero - * length Buffer. */ - BufferList = ATOMIC_LOAD(&Source->queue); - while(BufferList) - { - ALbuffer *buffer; - if((buffer=BufferList->buffer) != NULL && buffer->SampleLen > 0) - break; - BufferList = BufferList->next; - } - - if(Source->state != AL_PAUSED) - { - Source->state = AL_PLAYING; - ATOMIC_STORE(&Source->current_buffer, BufferList, almemory_order_relaxed); - ATOMIC_STORE(&Source->position, 0, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, 0); - discontinuity = AL_TRUE; - } - else - { - Source->state = AL_PLAYING; - discontinuity = AL_FALSE; - } - - // Check if an Offset has been set - if(Source->OffsetType != AL_NONE) - { - ApplyOffset(Source); - /* discontinuity = AL_TRUE;??? */ - } - - /* If there's nothing to play, or device is disconnected, go right to - * stopped */ - if(!BufferList || !device->Connected) - goto do_stop; - - /* Make sure this source isn't already active, while looking for an - * unused active source slot to put it in. */ - for(i = 0;i < Context->VoiceCount;i++) - { - ALsource *old = Source; - if(COMPARE_EXCHANGE(&Context->Voices[i].Source, &old, NULL)) - { - if(voice == NULL) - { - voice = &Context->Voices[i]; - voice->Source = Source; - } - break; - } - old = NULL; - if(voice == NULL && COMPARE_EXCHANGE(&Context->Voices[i].Source, &old, Source)) - voice = &Context->Voices[i]; - } - if(voice == NULL) - { - voice = &Context->Voices[Context->VoiceCount++]; - voice->Source = Source; - } - - if(discontinuity) - { - /* Clear previous samples if playback is discontinuous. */ - memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples)); - - /* Clear the stepping value so the mixer knows not to mix this - * until the update gets applied. - */ - voice->Step = 0; - } - - voice->Moving = AL_FALSE; - for(i = 0;i < MAX_INPUT_CHANNELS;i++) - { - ALsizei j; - for(j = 0;j < HRTF_HISTORY_LENGTH;j++) - voice->Chan[i].Direct.Hrtf.State.History[j] = 0.0f; - for(j = 0;j < HRIR_LENGTH;j++) - { - voice->Chan[i].Direct.Hrtf.State.Values[j][0] = 0.0f; - voice->Chan[i].Direct.Hrtf.State.Values[j][1] = 0.0f; - } - } - - UpdateSourceProps(Source, device->NumAuxSends); - } - else if(state == AL_PAUSED) - { - if(Source->state == AL_PLAYING) - Source->state = AL_PAUSED; - } - else if(state == AL_STOPPED) - { - do_stop: - if(Source->state != AL_INITIAL) - { - Source->state = AL_STOPPED; - ATOMIC_STORE(&Source->current_buffer, NULL); - } - Source->OffsetType = AL_NONE; - Source->Offset = 0.0; - } - else if(state == AL_INITIAL) - { - if(Source->state != AL_INITIAL) - { - Source->state = AL_INITIAL; - ATOMIC_STORE(&Source->current_buffer, ATOMIC_LOAD(&Source->queue), - almemory_order_relaxed); - ATOMIC_STORE(&Source->position, 0, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, 0); - } - Source->OffsetType = AL_NONE; - Source->Offset = 0.0; - } - WriteUnlock(&Source->queue_lock); -} - /* GetSourceSampleOffset * * Gets the current read offset for the given Source, in 32.32 fixed-point * samples. The offset is relative to the start of the queue (not the start of * the current buffer). */ -static ALint64 GetSourceSampleOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime) +static ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime) { - const ALbufferlistitem *BufferList; + ALCdevice *device = context->Device; const ALbufferlistitem *Current; ALuint64 readPos; ALuint refcount; - - ReadLock(&Source->queue_lock); - if(Source->state != AL_PLAYING && Source->state != AL_PAUSED) - { - ReadUnlock(&Source->queue_lock); - do { - while(((refcount=ReadRef(&device->MixCount))&1)) - althrd_yield(); - *clocktime = GetDeviceClockTime(device); - } while(refcount != ReadRef(&device->MixCount)); - return 0; - } + ALvoice *voice; do { - while(((refcount=ReadRef(&device->MixCount))&1)) + Current = NULL; + readPos = 0; + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) althrd_yield(); *clocktime = GetDeviceClockTime(device); - BufferList = ATOMIC_LOAD(&Source->queue, almemory_order_relaxed); - Current = ATOMIC_LOAD(&Source->current_buffer, almemory_order_relaxed); + voice = GetSourceVoice(Source, context); + if(voice) + { + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); - readPos = (ALuint64)ATOMIC_LOAD(&Source->position, almemory_order_relaxed) << 32; - readPos |= (ALuint64)ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed) << - (32-FRACTIONBITS); - } while(refcount != ReadRef(&device->MixCount)); - while(BufferList && BufferList != Current) + readPos = (ALuint64)ATOMIC_LOAD(&voice->position, almemory_order_relaxed) << 32; + readPos |= (ALuint64)ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed) << + (32-FRACTIONBITS); + } + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); + + if(voice) { - if(BufferList->buffer) - readPos += (ALuint64)BufferList->buffer->SampleLen << 32; - BufferList = BufferList->next; + const ALbufferlistitem *BufferList = Source->queue; + while(BufferList && BufferList != Current) + { + readPos += (ALuint64)BufferList->max_samples << 32; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } + readPos = minu64(readPos, U64(0x7fffffffffffffff)); } - ReadUnlock(&Source->queue_lock); - return (ALint64)minu64(readPos, U64(0x7fffffffffffffff)); + return (ALint64)readPos; } /* GetSourceSecOffset @@ -3110,57 +3191,64 @@ static ALint64 GetSourceSampleOffset(ALsource *Source, ALCdevice *device, ALuint * Gets the current read offset for the given Source, in seconds. The offset is * relative to the start of the queue (not the start of the current buffer). */ -static ALdouble GetSourceSecOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime) +static ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime) { - const ALbufferlistitem *BufferList; + ALCdevice *device = context->Device; const ALbufferlistitem *Current; - const ALbuffer *Buffer = NULL; ALuint64 readPos; ALuint refcount; - - ReadLock(&Source->queue_lock); - if(Source->state != AL_PLAYING && Source->state != AL_PAUSED) - { - ReadUnlock(&Source->queue_lock); - do { - while(((refcount=ReadRef(&device->MixCount))&1)) - althrd_yield(); - *clocktime = GetDeviceClockTime(device); - } while(refcount != ReadRef(&device->MixCount)); - return 0.0; - } + ALdouble offset; + ALvoice *voice; do { - while(((refcount=ReadRef(&device->MixCount))&1)) + Current = NULL; + readPos = 0; + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) althrd_yield(); *clocktime = GetDeviceClockTime(device); - BufferList = ATOMIC_LOAD(&Source->queue, almemory_order_relaxed); - Current = ATOMIC_LOAD(&Source->current_buffer, almemory_order_relaxed); - - readPos = (ALuint64)ATOMIC_LOAD(&Source->position, almemory_order_relaxed)<position_fraction, almemory_order_relaxed); - } while(refcount != ReadRef(&device->MixCount)); - while(BufferList && BufferList != Current) - { - const ALbuffer *buffer = BufferList->buffer; - if(buffer != NULL) + voice = GetSourceVoice(Source, context); + if(voice) { - if(!Buffer) Buffer = buffer; - readPos += (ALuint64)buffer->SampleLen << FRACTIONBITS; + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + + readPos = (ALuint64)ATOMIC_LOAD(&voice->position, almemory_order_relaxed) << + FRACTIONBITS; + readPos |= ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed); } - BufferList = BufferList->next; - } + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); - while(BufferList && !Buffer) + offset = 0.0; + if(voice) { - Buffer = BufferList->buffer; - BufferList = BufferList->next; - } - assert(Buffer != NULL); + const ALbufferlistitem *BufferList = Source->queue; + const ALbuffer *BufferFmt = NULL; + while(BufferList && BufferList != Current) + { + ALsizei i = 0; + while(!BufferFmt && i < BufferList->num_buffers) + BufferFmt = BufferList->buffers[i++]; + readPos += (ALuint64)BufferList->max_samples << FRACTIONBITS; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } - ReadUnlock(&Source->queue_lock); - return (ALdouble)readPos / (ALdouble)FRACTIONONE / (ALdouble)Buffer->Frequency; + while(BufferList && !BufferFmt) + { + ALsizei i = 0; + while(!BufferFmt && i < BufferList->num_buffers) + BufferFmt = BufferList->buffers[i++]; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } + assert(BufferFmt != NULL); + + offset = (ALdouble)readPos / (ALdouble)FRACTIONONE / + (ALdouble)BufferFmt->Frequency; + } + + return offset; } /* GetSourceOffset @@ -3169,99 +3257,104 @@ static ALdouble GetSourceSecOffset(ALsource *Source, ALCdevice *device, ALuint64 * (Bytes, Samples or Seconds). The offset is relative to the start of the * queue (not the start of the current buffer). */ -static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCdevice *device) +static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context) { - const ALbufferlistitem *BufferList; + ALCdevice *device = context->Device; const ALbufferlistitem *Current; - const ALbuffer *Buffer = NULL; - ALboolean readFin = AL_FALSE; - ALuint readPos, readPosFrac; - ALuint totalBufferLen; - ALdouble offset = 0.0; - ALboolean looping; + ALuint readPos; + ALsizei readPosFrac; ALuint refcount; + ALdouble offset; + ALvoice *voice; - ReadLock(&Source->queue_lock); - if(Source->state != AL_PLAYING && Source->state != AL_PAUSED) - { - ReadUnlock(&Source->queue_lock); - return 0.0; - } - - totalBufferLen = 0; do { - while(((refcount=ReadRef(&device->MixCount))&1)) + Current = NULL; + readPos = readPosFrac = 0; + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) althrd_yield(); - BufferList = ATOMIC_LOAD(&Source->queue, almemory_order_relaxed); - Current = ATOMIC_LOAD(&Source->current_buffer, almemory_order_relaxed); - - readPos = ATOMIC_LOAD(&Source->position, almemory_order_relaxed); - readPosFrac = ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed); - - looping = ATOMIC_LOAD(&Source->looping, almemory_order_relaxed); - } while(refcount != ReadRef(&device->MixCount)); - - while(BufferList != NULL) - { - const ALbuffer *buffer; - readFin = readFin || (BufferList == Current); - if((buffer=BufferList->buffer) != NULL) + voice = GetSourceVoice(Source, context); + if(voice) { - if(!Buffer) Buffer = buffer; - totalBufferLen += buffer->SampleLen; - if(!readFin) readPos += buffer->SampleLen; + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + + readPos = ATOMIC_LOAD(&voice->position, almemory_order_relaxed); + readPosFrac = ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed); } - BufferList = BufferList->next; - } - assert(Buffer != NULL); + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); - if(looping) - readPos %= totalBufferLen; - else + offset = 0.0; + if(voice) { - /* Wrap back to 0 */ - if(readPos >= totalBufferLen) - readPos = readPosFrac = 0; + const ALbufferlistitem *BufferList = Source->queue; + const ALbuffer *BufferFmt = NULL; + ALboolean readFin = AL_FALSE; + ALuint totalBufferLen = 0; + + while(BufferList != NULL) + { + ALsizei i = 0; + while(!BufferFmt && i < BufferList->num_buffers) + BufferFmt = BufferList->buffers[i++]; + + readFin |= (BufferList == Current); + totalBufferLen += BufferList->max_samples; + if(!readFin) readPos += BufferList->max_samples; + + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } + assert(BufferFmt != NULL); + + if(Source->Looping) + readPos %= totalBufferLen; + else + { + /* Wrap back to 0 */ + if(readPos >= totalBufferLen) + readPos = readPosFrac = 0; + } + + offset = 0.0; + switch(name) + { + case AL_SEC_OFFSET: + offset = (readPos + (ALdouble)readPosFrac/FRACTIONONE) / BufferFmt->Frequency; + break; + + case AL_SAMPLE_OFFSET: + offset = readPos + (ALdouble)readPosFrac/FRACTIONONE; + break; + + case AL_BYTE_OFFSET: + if(BufferFmt->OriginalType == UserFmtIMA4) + { + ALsizei align = (BufferFmt->OriginalAlign-1)/2 + 4; + ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->FmtChannels); + ALuint FrameBlockSize = BufferFmt->OriginalAlign; + + /* Round down to nearest ADPCM block */ + offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); + } + else if(BufferFmt->OriginalType == UserFmtMSADPCM) + { + ALsizei align = (BufferFmt->OriginalAlign-2)/2 + 7; + ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->FmtChannels); + ALuint FrameBlockSize = BufferFmt->OriginalAlign; + + /* Round down to nearest ADPCM block */ + offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); + } + else + { + ALuint FrameSize = FrameSizeFromFmt(BufferFmt->FmtChannels, + BufferFmt->FmtType); + offset = (ALdouble)(readPos * FrameSize); + } + break; + } } - switch(name) - { - case AL_SEC_OFFSET: - offset = (readPos + (ALdouble)readPosFrac/FRACTIONONE)/Buffer->Frequency; - break; - - case AL_SAMPLE_OFFSET: - offset = readPos + (ALdouble)readPosFrac/FRACTIONONE; - break; - - case AL_BYTE_OFFSET: - if(Buffer->OriginalType == UserFmtIMA4) - { - ALsizei align = (Buffer->OriginalAlign-1)/2 + 4; - ALuint BlockSize = align * ChannelsFromFmt(Buffer->FmtChannels); - ALuint FrameBlockSize = Buffer->OriginalAlign; - - /* Round down to nearest ADPCM block */ - offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); - } - else if(Buffer->OriginalType == UserFmtMSADPCM) - { - ALsizei align = (Buffer->OriginalAlign-2)/2 + 7; - ALuint BlockSize = align * ChannelsFromFmt(Buffer->FmtChannels); - ALuint FrameBlockSize = Buffer->OriginalAlign; - - /* Round down to nearest ADPCM block */ - offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); - } - else - { - ALuint FrameSize = FrameSizeFromUserFmt(Buffer->OriginalChannels, Buffer->OriginalType); - offset = (ALdouble)(readPos * FrameSize); - } - break; - } - - ReadUnlock(&Source->queue_lock); return offset; } @@ -3271,37 +3364,32 @@ static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCdevice *device * Apply the stored playback offset to the Source. This function will update * the number of buffers "played" given the stored offset. */ -ALboolean ApplyOffset(ALsource *Source) +static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice) { ALbufferlistitem *BufferList; - const ALbuffer *Buffer; - ALuint bufferLen, totalBufferLen; - ALuint offset=0, frac=0; + ALuint totalBufferLen; + ALuint offset = 0; + ALsizei frac = 0; /* Get sample frame offset */ if(!GetSampleOffset(Source, &offset, &frac)) return AL_FALSE; totalBufferLen = 0; - BufferList = ATOMIC_LOAD(&Source->queue); + BufferList = Source->queue; while(BufferList && totalBufferLen <= offset) { - Buffer = BufferList->buffer; - bufferLen = Buffer ? Buffer->SampleLen : 0; - - if(bufferLen > offset-totalBufferLen) + if((ALuint)BufferList->max_samples > offset-totalBufferLen) { /* Offset is in this buffer */ - ATOMIC_STORE(&Source->current_buffer, BufferList, almemory_order_relaxed); - - ATOMIC_STORE(&Source->position, offset - totalBufferLen, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, frac); + ATOMIC_STORE(&voice->position, offset - totalBufferLen, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, frac, almemory_order_relaxed); + ATOMIC_STORE(&voice->current_buffer, BufferList, almemory_order_release); return AL_TRUE; } + totalBufferLen += BufferList->max_samples; - totalBufferLen += bufferLen; - - BufferList = BufferList->next; + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); } /* Offset is out of range of the queue */ @@ -3315,24 +3403,24 @@ ALboolean ApplyOffset(ALsource *Source) * or Second offset supplied by the application). This takes into account the * fact that the buffer format may have been modifed since. */ -static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac) +static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALsizei *frac) { - const ALbuffer *Buffer = NULL; + const ALbuffer *BufferFmt = NULL; const ALbufferlistitem *BufferList; ALdouble dbloff, dblfrac; /* Find the first valid Buffer in the Queue */ - BufferList = ATOMIC_LOAD(&Source->queue); + BufferList = Source->queue; while(BufferList) { - if(BufferList->buffer) - { - Buffer = BufferList->buffer; - break; - } - BufferList = BufferList->next; + ALsizei i; + for(i = 0;i < BufferList->num_buffers && !BufferFmt;i++) + BufferFmt = BufferList->buffers[i]; + if(BufferFmt) break; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); } - if(!Buffer) + if(!BufferFmt) { Source->OffsetType = AL_NONE; Source->Offset = 0.0; @@ -3344,33 +3432,33 @@ static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac) case AL_BYTE_OFFSET: /* Determine the ByteOffset (and ensure it is block aligned) */ *offset = (ALuint)Source->Offset; - if(Buffer->OriginalType == UserFmtIMA4) + if(BufferFmt->OriginalType == UserFmtIMA4) { - ALsizei align = (Buffer->OriginalAlign-1)/2 + 4; - *offset /= align * ChannelsFromUserFmt(Buffer->OriginalChannels); - *offset *= Buffer->OriginalAlign; + ALsizei align = (BufferFmt->OriginalAlign-1)/2 + 4; + *offset /= align * ChannelsFromFmt(BufferFmt->FmtChannels); + *offset *= BufferFmt->OriginalAlign; } - else if(Buffer->OriginalType == UserFmtMSADPCM) + else if(BufferFmt->OriginalType == UserFmtMSADPCM) { - ALsizei align = (Buffer->OriginalAlign-2)/2 + 7; - *offset /= align * ChannelsFromUserFmt(Buffer->OriginalChannels); - *offset *= Buffer->OriginalAlign; + ALsizei align = (BufferFmt->OriginalAlign-2)/2 + 7; + *offset /= align * ChannelsFromFmt(BufferFmt->FmtChannels); + *offset *= BufferFmt->OriginalAlign; } else - *offset /= FrameSizeFromUserFmt(Buffer->OriginalChannels, Buffer->OriginalType); + *offset /= FrameSizeFromFmt(BufferFmt->FmtChannels, BufferFmt->FmtType); *frac = 0; break; case AL_SAMPLE_OFFSET: dblfrac = modf(Source->Offset, &dbloff); *offset = (ALuint)mind(dbloff, UINT_MAX); - *frac = (ALuint)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); + *frac = (ALsizei)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); break; case AL_SEC_OFFSET: - dblfrac = modf(Source->Offset*Buffer->Frequency, &dbloff); + dblfrac = modf(Source->Offset*BufferFmt->Frequency, &dbloff); *offset = (ALuint)mind(dbloff, UINT_MAX); - *frac = (ALuint)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); + *frac = (ALsizei)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); break; } Source->OffsetType = AL_NONE; @@ -3380,22 +3468,124 @@ static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac) } +static ALsource *AllocSource(ALCcontext *context) +{ + ALCdevice *device = context->Device; + SourceSubList *sublist, *subend; + ALsource *source = NULL; + ALsizei lidx = 0; + ALsizei slidx; + + almtx_lock(&context->SourceLock); + if(context->NumSources >= device->SourcesMax) + { + almtx_unlock(&context->SourceLock); + alSetError(context, AL_OUT_OF_MEMORY, "Exceeding %u source limit", device->SourcesMax); + return NULL; + } + sublist = VECTOR_BEGIN(context->SourceList); + subend = VECTOR_END(context->SourceList); + for(;sublist != subend;++sublist) + { + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + source = sublist->Sources + slidx; + break; + } + ++lidx; + } + if(UNLIKELY(!source)) + { + const SourceSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(context->SourceList) >= 1<<25)) + { + almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many sources allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(context->SourceList); + VECTOR_PUSH_BACK(context->SourceList, empty_sublist); + sublist = &VECTOR_BACK(context->SourceList); + sublist->FreeMask = ~U64(0); + sublist->Sources = al_calloc(16, sizeof(ALsource)*64); + if(UNLIKELY(!sublist->Sources)) + { + VECTOR_POP_BACK(context->SourceList); + almtx_unlock(&context->SourceLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate source batch"); + return NULL; + } + + slidx = 0; + source = sublist->Sources + slidx; + } + + memset(source, 0, sizeof(*source)); + InitSourceParams(source, device->NumAuxSends); + + /* Add 1 to avoid source ID 0. */ + source->id = ((lidx<<6) | slidx) + 1; + + context->NumSources++; + sublist->FreeMask &= ~(U64(1)<SourceLock); + + return source; +} + +static void FreeSource(ALCcontext *context, ALsource *source) +{ + ALCdevice *device = context->Device; + ALuint id = source->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; + ALvoice *voice; + + ALCdevice_Lock(device); + if((voice=GetSourceVoice(source, context)) != NULL) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + } + ALCdevice_Unlock(device); + + DeinitSource(source, device->NumAuxSends); + memset(source, 0, sizeof(*source)); + + VECTOR_ELEM(context->SourceList, lidx).FreeMask |= U64(1) << slidx; + context->NumSources--; +} + /* ReleaseALSources * * Destroys all sources in the source map. */ -ALvoid ReleaseALSources(ALCcontext *Context) +ALvoid ReleaseALSources(ALCcontext *context) { - ALsizei pos; - for(pos = 0;pos < Context->SourceMap.size;pos++) + ALCdevice *device = context->Device; + SourceSubList *sublist = VECTOR_BEGIN(context->SourceList); + SourceSubList *subend = VECTOR_END(context->SourceList); + size_t leftover = 0; + for(;sublist != subend;++sublist) { - ALsource *temp = Context->SourceMap.values[pos]; - Context->SourceMap.values[pos] = NULL; + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALsource *source = sublist->Sources + idx; - DeinitSource(temp); + DeinitSource(source, device->NumAuxSends); + memset(source, 0, sizeof(*source)); + ++leftover; - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(*temp)); - al_free(temp); + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Source%s\n", device, leftover, (leftover==1)?"":"s"); } diff --git a/Engine/lib/openal-soft/OpenAL32/alState.c b/Engine/lib/openal-soft/OpenAL32/alState.c index 3d8e6c404..ce93e1438 100644 --- a/Engine/lib/openal-soft/OpenAL32/alState.c +++ b/Engine/lib/openal-soft/OpenAL32/alState.c @@ -20,6 +20,8 @@ #include "config.h" +#include "version.h" + #include #include "alMain.h" #include "AL/alc.h" @@ -45,6 +47,31 @@ static const ALchar alErrInvalidValue[] = "Invalid Value"; static const ALchar alErrInvalidOp[] = "Invalid Operation"; static const ALchar alErrOutOfMemory[] = "Out of Memory"; +/* Resampler strings */ +static const ALchar alPointResampler[] = "Nearest"; +static const ALchar alLinearResampler[] = "Linear"; +static const ALchar alCubicResampler[] = "Cubic"; +static const ALchar alBSinc12Resampler[] = "11th order Sinc"; +static const ALchar alBSinc24Resampler[] = "23rd order Sinc"; + +/* WARNING: Non-standard export! Not part of any extension, or exposed in the + * alcFunctions list. + */ +AL_API const ALchar* AL_APIENTRY alsoft_get_version(void) +{ + const char *spoof = getenv("ALSOFT_SPOOF_VERSION"); + if(spoof && spoof[0] != '\0') return spoof; + return ALSOFT_VERSION; +} + +#define DO_UPDATEPROPS() do { \ + if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) \ + UpdateContextProps(context); \ + else \ + ATOMIC_FLAG_CLEAR(&context->PropsClean, almemory_order_release); \ +} while(0) + + AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) { ALCcontext *context; @@ -52,21 +79,19 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: context->SourceDistanceModel = AL_TRUE; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid enable property 0x%04x", capability); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -77,21 +102,19 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: context->SourceDistanceModel = AL_FALSE; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid disable property 0x%04x", capability); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -103,6 +126,7 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) context = GetContextRef(); if(!context) return AL_FALSE; + almtx_lock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: @@ -110,12 +134,11 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid is enabled property 0x%04x", capability); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -127,6 +150,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) context = GetContextRef(); if(!context) return AL_FALSE; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -150,7 +174,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = AL_TRUE; break; @@ -159,13 +183,21 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) value = AL_TRUE; break; + case AL_NUM_RESAMPLERS_SOFT: + /* Always non-0. */ + value = AL_TRUE; + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = ResamplerDefault ? AL_TRUE : AL_FALSE; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid boolean property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -177,6 +209,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) context = GetContextRef(); if(!context) return 0.0; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -196,7 +229,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALdouble)AL_TRUE; break; @@ -204,13 +237,20 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) value = (ALdouble)GAIN_MIX_MAX/context->GainBoost; break; + case AL_NUM_RESAMPLERS_SOFT: + value = (ALdouble)(ResamplerMax + 1); + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = (ALdouble)ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid double property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -222,6 +262,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) context = GetContextRef(); if(!context) return 0.0f; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -241,7 +282,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALfloat)AL_TRUE; break; @@ -249,13 +290,20 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) value = GAIN_MIX_MAX/context->GainBoost; break; + case AL_NUM_RESAMPLERS_SOFT: + value = (ALfloat)(ResamplerMax + 1); + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = (ALfloat)ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid float property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -267,6 +315,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) context = GetContextRef(); if(!context) return 0; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -286,7 +335,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALint)AL_TRUE; break; @@ -294,13 +343,20 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) value = (ALint)(GAIN_MIX_MAX/context->GainBoost); break; + case AL_NUM_RESAMPLERS_SOFT: + value = ResamplerMax + 1; + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -312,6 +368,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) context = GetContextRef(); if(!context) return 0; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -331,7 +388,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALint64SOFT)AL_TRUE; break; @@ -339,13 +396,48 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) value = (ALint64SOFT)(GAIN_MIX_MAX/context->GainBoost); break; + case AL_NUM_RESAMPLERS_SOFT: + value = (ALint64SOFT)(ResamplerMax + 1); + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = (ALint64SOFT)ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer64 property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); + return value; +} +AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname) +{ + ALCcontext *context; + void *value = NULL; + + context = GetContextRef(); + if(!context) return NULL; + + almtx_lock(&context->PropLock); + switch(pname) + { + case AL_EVENT_CALLBACK_FUNCTION_SOFT: + value = context->EventCb; + break; + + case AL_EVENT_CALLBACK_USER_PARAM_SOFT: + value = context->EventParam; + break; + + default: + alSetError(context, AL_INVALID_VALUE, "Invalid pointer property 0x%04x", pname); + } + almtx_unlock(&context->PropLock); + + ALCcontext_DecRef(context); return value; } @@ -363,6 +455,8 @@ AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname, ALboolean *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetBoolean(pname); return; } @@ -371,15 +465,14 @@ AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname, ALboolean *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid boolean-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -397,6 +490,8 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname, ALdouble *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetDouble(pname); return; } @@ -405,15 +500,14 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname, ALdouble *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid double-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -431,6 +525,8 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname, ALfloat *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetFloat(pname); return; } @@ -439,15 +535,14 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname, ALfloat *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid float-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -465,6 +560,8 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetInteger(pname); return; } @@ -473,13 +570,14 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) context = GetContextRef(); if(!context) return; + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -497,6 +595,8 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetInteger64SOFT(pname); return; } @@ -505,13 +605,43 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) context = GetContextRef(); if(!context) return; + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer64-vector property 0x%04x", pname); + } + + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alGetPointervSOFT(ALenum pname, void **values) +{ + ALCcontext *context; + + if(values) + { + switch(pname) + { + case AL_EVENT_CALLBACK_FUNCTION_SOFT: + case AL_EVENT_CALLBACK_USER_PARAM_SOFT: + values[0] = alGetPointerSOFT(pname); + return; + } + } + + context = GetContextRef(); + if(!context) return; + + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + switch(pname) + { + default: + alSetError(context, AL_INVALID_VALUE, "Invalid pointer-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -566,12 +696,10 @@ AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid string property 0x%04x", pname); } -done: ALCcontext_DecRef(context); - return value; } @@ -583,15 +711,15 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value) if(!context) return; if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + alSetError(context, AL_INVALID_VALUE, "Doppler factor %f out of range", value); + else + { + almtx_lock(&context->PropLock); + context->DopplerFactor = value; + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); + } - WriteLock(&context->PropLock); - context->DopplerFactor = value; - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); - WriteUnlock(&context->PropLock); - -done: ALCcontext_DecRef(context); } @@ -602,16 +730,30 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) context = GetContextRef(); if(!context) return; + if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Deprecated)) + { + static const ALCchar msg[] = + "alDopplerVelocity is deprecated in AL1.1, use alSpeedOfSound"; + const ALsizei msglen = (ALsizei)strlen(msg); + ALbitfieldSOFT enabledevts; + almtx_lock(&context->EventCbLock); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + if((enabledevts&EventType_Deprecated) && context->EventCb) + (*context->EventCb)(AL_EVENT_TYPE_DEPRECATED_SOFT, 0, 0, msglen, msg, + context->EventParam); + almtx_unlock(&context->EventCbLock); + } + if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + alSetError(context, AL_INVALID_VALUE, "Doppler velocity %f out of range", value); + else + { + almtx_lock(&context->PropLock); + context->DopplerVelocity = value; + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); + } - WriteLock(&context->PropLock); - context->DopplerVelocity = value; - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); - WriteUnlock(&context->PropLock); - -done: ALCcontext_DecRef(context); } @@ -623,15 +765,15 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat value) if(!context) return; if(!(value > 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + alSetError(context, AL_INVALID_VALUE, "Speed of sound %f out of range", value); + else + { + almtx_lock(&context->PropLock); + context->SpeedOfSound = value; + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); + } - WriteLock(&context->PropLock); - context->SpeedOfSound = value; - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); - WriteUnlock(&context->PropLock); - -done: ALCcontext_DecRef(context); } @@ -646,18 +788,16 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value) value == AL_LINEAR_DISTANCE || value == AL_LINEAR_DISTANCE_CLAMPED || value == AL_EXPONENT_DISTANCE || value == AL_EXPONENT_DISTANCE_CLAMPED || value == AL_NONE)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - WriteLock(&context->PropLock); - context->DistanceModel = value; - if(!context->SourceDistanceModel) + alSetError(context, AL_INVALID_VALUE, "Distance model 0x%04x out of range", value); + else { - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_lock(&context->PropLock); + context->DistanceModel = value; + if(!context->SourceDistanceModel) + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); } - WriteUnlock(&context->PropLock); -done: ALCcontext_DecRef(context); } @@ -669,7 +809,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) context = GetContextRef(); if(!context) return; - ALCcontext_DeferUpdates(context, DeferAll); + ALCcontext_DeferUpdates(context); ALCcontext_DecRef(context); } @@ -685,3 +825,76 @@ AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void) ALCcontext_DecRef(context); } + + +AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index) +{ + const char *ResamplerNames[] = { + alPointResampler, alLinearResampler, + alCubicResampler, alBSinc12Resampler, + alBSinc24Resampler, + }; + const ALchar *value = NULL; + ALCcontext *context; + + static_assert(COUNTOF(ResamplerNames) == ResamplerMax+1, "Incorrect ResamplerNames list"); + + context = GetContextRef(); + if(!context) return NULL; + + switch(pname) + { + case AL_RESAMPLER_NAME_SOFT: + if(index < 0 || (size_t)index >= COUNTOF(ResamplerNames)) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Resampler name index %d out of range", + index); + value = ResamplerNames[index]; + break; + + default: + alSetError(context, AL_INVALID_VALUE, "Invalid string indexed property"); + } + +done: + ALCcontext_DecRef(context); + return value; +} + + +void UpdateContextProps(ALCcontext *context) +{ + struct ALcontextProps *props; + + /* Get an unused proprty container, or allocate a new one as needed. */ + props = ATOMIC_LOAD(&context->FreeContextProps, almemory_order_acquire); + if(!props) + props = al_calloc(16, sizeof(*props)); + else + { + struct ALcontextProps *next; + do { + next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeContextProps, &props, next, + almemory_order_seq_cst, almemory_order_acquire) == 0); + } + + /* Copy in current property values. */ + props->MetersPerUnit = context->MetersPerUnit; + + props->DopplerFactor = context->DopplerFactor; + props->DopplerVelocity = context->DopplerVelocity; + props->SpeedOfSound = context->SpeedOfSound; + + props->SourceDistanceModel = context->SourceDistanceModel; + props->DistanceModel = context->DistanceModel; + + /* Set the new container for updating internal parameters. */ + props = ATOMIC_EXCHANGE_PTR(&context->Update, props, almemory_order_acq_rel); + if(props) + { + /* If there was an unused update container, put it back in the + * freelist. + */ + ATOMIC_REPLACE_HEAD(struct ALcontextProps*, &context->FreeContextProps, props); + } +} diff --git a/Engine/lib/openal-soft/OpenAL32/alThunk.c b/Engine/lib/openal-soft/OpenAL32/alThunk.c deleted file mode 100644 index 72fc0dcbe..000000000 --- a/Engine/lib/openal-soft/OpenAL32/alThunk.c +++ /dev/null @@ -1,105 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 1999-2007 by authors. - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include - -#include "alMain.h" -#include "alThunk.h" - -#include "almalloc.h" - - -static ATOMIC(ALenum) *ThunkArray; -static ALuint ThunkArraySize; -static RWLock ThunkLock; - -void ThunkInit(void) -{ - RWLockInit(&ThunkLock); - ThunkArraySize = 1024; - ThunkArray = al_calloc(16, ThunkArraySize * sizeof(*ThunkArray)); -} - -void ThunkExit(void) -{ - al_free(ThunkArray); - ThunkArray = NULL; - ThunkArraySize = 0; -} - -ALenum NewThunkEntry(ALuint *index) -{ - void *NewList; - ALuint i; - - ReadLock(&ThunkLock); - for(i = 0;i < ThunkArraySize;i++) - { - if(ATOMIC_EXCHANGE(ALenum, &ThunkArray[i], AL_TRUE) == AL_FALSE) - { - ReadUnlock(&ThunkLock); - *index = i+1; - return AL_NO_ERROR; - } - } - ReadUnlock(&ThunkLock); - - WriteLock(&ThunkLock); - /* Double-check that there's still no free entries, in case another - * invocation just came through and increased the size of the array. - */ - for(;i < ThunkArraySize;i++) - { - if(ATOMIC_EXCHANGE(ALenum, &ThunkArray[i], AL_TRUE) == AL_FALSE) - { - WriteUnlock(&ThunkLock); - *index = i+1; - return AL_NO_ERROR; - } - } - - NewList = al_calloc(16, ThunkArraySize*2 * sizeof(*ThunkArray)); - if(!NewList) - { - WriteUnlock(&ThunkLock); - ERR("Realloc failed to increase to %u entries!\n", ThunkArraySize*2); - return AL_OUT_OF_MEMORY; - } - memcpy(NewList, ThunkArray, ThunkArraySize*sizeof(*ThunkArray)); - al_free(ThunkArray); - ThunkArray = NewList; - ThunkArraySize *= 2; - - ATOMIC_STORE(&ThunkArray[i], AL_TRUE); - WriteUnlock(&ThunkLock); - - *index = i+1; - return AL_NO_ERROR; -} - -void FreeThunkEntry(ALuint index) -{ - ReadLock(&ThunkLock); - if(index > 0 && index <= ThunkArraySize) - ATOMIC_STORE(&ThunkArray[index-1], AL_FALSE); - ReadUnlock(&ThunkLock); -} diff --git a/Engine/lib/openal-soft/OpenAL32/event.c b/Engine/lib/openal-soft/OpenAL32/event.c new file mode 100644 index 000000000..12636489b --- /dev/null +++ b/Engine/lib/openal-soft/OpenAL32/event.c @@ -0,0 +1,140 @@ + +#include "config.h" + +#include "AL/alc.h" +#include "AL/al.h" +#include "AL/alext.h" +#include "alMain.h" +#include "alError.h" +#include "ringbuffer.h" + + +static int EventThread(void *arg) +{ + ALCcontext *context = arg; + + /* Clear all pending posts on the semaphore. */ + while(alsem_trywait(&context->EventSem) == althrd_success) + { + } + + while(1) + { + ALbitfieldSOFT enabledevts; + AsyncEvent evt; + + if(ll_ringbuffer_read(context->AsyncEvents, (char*)&evt, 1) == 0) + { + alsem_wait(&context->EventSem); + continue; + } + if(!evt.EnumType) + break; + + almtx_lock(&context->EventCbLock); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_acquire); + if(context->EventCb && (enabledevts&evt.EnumType) == evt.EnumType) + context->EventCb(evt.Type, evt.ObjectId, evt.Param, (ALsizei)strlen(evt.Message), + evt.Message, context->EventParam); + almtx_unlock(&context->EventCbLock); + } + return 0; +} + +AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) +{ + ALCcontext *context; + ALbitfieldSOFT enabledevts; + ALbitfieldSOFT flags = 0; + bool isrunning; + ALsizei i; + + context = GetContextRef(); + if(!context) return; + + if(count < 0) SETERR_GOTO(context, AL_INVALID_VALUE, done, "Controlling %d events", count); + if(count == 0) goto done; + if(!types) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer"); + + for(i = 0;i < count;i++) + { + if(types[i] == AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT) + flags |= EventType_BufferCompleted; + else if(types[i] == AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT) + flags |= EventType_SourceStateChange; + else if(types[i] == AL_EVENT_TYPE_ERROR_SOFT) + flags |= EventType_Error; + else if(types[i] == AL_EVENT_TYPE_PERFORMANCE_SOFT) + flags |= EventType_Performance; + else if(types[i] == AL_EVENT_TYPE_DEPRECATED_SOFT) + flags |= EventType_Deprecated; + else if(types[i] == AL_EVENT_TYPE_DISCONNECTED_SOFT) + flags |= EventType_Disconnected; + else + SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid event type 0x%04x", types[i]); + } + + almtx_lock(&context->EventThrdLock); + if(enable) + { + if(!context->AsyncEvents) + context->AsyncEvents = ll_ringbuffer_create(63, sizeof(AsyncEvent), false); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + isrunning = !!enabledevts; + while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->EnabledEvts, &enabledevts, enabledevts|flags, + almemory_order_acq_rel, almemory_order_acquire) == 0) + { + /* enabledevts is (re-)filled with the current value on failure, so + * just try again. + */ + } + if(!isrunning && flags) + althrd_create(&context->EventThread, EventThread, context); + } + else + { + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + isrunning = !!enabledevts; + while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->EnabledEvts, &enabledevts, enabledevts&~flags, + almemory_order_acq_rel, almemory_order_acquire) == 0) + { + } + if(isrunning && !(enabledevts&~flags)) + { + static const AsyncEvent kill_evt = { 0 }; + while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0) + althrd_yield(); + alsem_post(&context->EventSem); + althrd_join(context->EventThread, NULL); + } + else + { + /* Wait to ensure the event handler sees the changed flags before + * returning. + */ + almtx_lock(&context->EventCbLock); + almtx_unlock(&context->EventCbLock); + } + } + almtx_unlock(&context->EventThrdLock); + +done: + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *userParam) +{ + ALCcontext *context; + + context = GetContextRef(); + if(!context) return; + + almtx_lock(&context->PropLock); + almtx_lock(&context->EventCbLock); + context->EventCb = callback; + context->EventParam = userParam; + almtx_unlock(&context->EventCbLock); + almtx_unlock(&context->PropLock); + + ALCcontext_DecRef(context); +} diff --git a/Engine/lib/openal-soft/OpenAL32/sample_cvt.c b/Engine/lib/openal-soft/OpenAL32/sample_cvt.c index aff3de834..4a85f74af 100644 --- a/Engine/lib/openal-soft/OpenAL32/sample_cvt.c +++ b/Engine/lib/openal-soft/OpenAL32/sample_cvt.c @@ -3,13 +3,6 @@ #include "sample_cvt.h" -#ifdef HAVE_ALLOCA_H -#include -#endif -#ifdef HAVE_MALLOC_H -#include -#endif - #include "AL/al.h" #include "alu.h" #include "alBuffer.h" @@ -61,7 +54,7 @@ static const int MSADPCMAdaptionCoeff[7][2] = { /* A quick'n'dirty lookup table to decode a muLaw-encoded byte sample into a * signed 16-bit sample */ -static const ALshort muLawDecompressionTable[256] = { +const ALshort muLawDecompressionTable[256] = { -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956, -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764, -15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412, @@ -96,32 +89,10 @@ static const ALshort muLawDecompressionTable[256] = { 56, 48, 40, 32, 24, 16, 8, 0 }; -/* Values used when encoding a muLaw sample */ -static const int muLawBias = 0x84; -static const int muLawClip = 32635; -static const char muLawCompressTable[256] = { - 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - /* A quick'n'dirty lookup table to decode an aLaw-encoded byte sample into a * signed 16-bit sample */ -static const ALshort aLawDecompressionTable[256] = { +const ALshort aLawDecompressionTable[256] = { -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, @@ -156,92 +127,13 @@ static const ALshort aLawDecompressionTable[256] = { 944, 912, 1008, 976, 816, 784, 880, 848 }; -/* Values used when encoding an aLaw sample */ -static const int aLawClip = 32635; -static const char aLawCompressTable[128] = { - 1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - -typedef ALubyte ALmulaw; -typedef ALubyte ALalaw; -typedef ALubyte ALima4; -typedef ALubyte ALmsadpcm; -typedef struct { - ALbyte b[3]; -} ALbyte3; -static_assert(sizeof(ALbyte3)==sizeof(ALbyte[3]), "ALbyte3 size is not 3"); -typedef struct { - ALubyte b[3]; -} ALubyte3; -static_assert(sizeof(ALubyte3)==sizeof(ALubyte[3]), "ALubyte3 size is not 3"); - -static inline ALshort DecodeMuLaw(ALmulaw val) -{ return muLawDecompressionTable[val]; } - -static ALmulaw EncodeMuLaw(ALshort val) +static void DecodeIMA4Block(ALshort *dst, const ALubyte *src, ALint numchans, ALsizei align) { - ALint mant, exp, sign; - - sign = (val>>8) & 0x80; - if(sign) - { - /* -32768 doesn't properly negate on a short; it results in itself. - * So clamp to -32767 */ - val = maxi(val, -32767); - val = -val; - } - - val = mini(val, muLawClip); - val += muLawBias; - - exp = muLawCompressTable[(val>>7) & 0xff]; - mant = (val >> (exp+3)) & 0x0f; - - return ~(sign | (exp<<4) | mant); -} - -static inline ALshort DecodeALaw(ALalaw val) -{ return aLawDecompressionTable[val]; } - -static ALalaw EncodeALaw(ALshort val) -{ - ALint mant, exp, sign; - - sign = ((~val) >> 8) & 0x80; - if(!sign) - { - val = maxi(val, -32767); - val = -val; - } - val = mini(val, aLawClip); - - if(val >= 256) - { - exp = aLawCompressTable[(val>>8) & 0x7f]; - mant = (val >> (exp+3)) & 0x0f; - } - else - { - exp = 0; - mant = val >> 4; - } - - return ((exp<<4) | mant) ^ (sign^0x55); -} - -static void DecodeIMA4Block(ALshort *dst, const ALima4 *src, ALint numchans, ALsizei align) -{ - ALint sample[MAX_INPUT_CHANNELS], index[MAX_INPUT_CHANNELS]; - ALuint code[MAX_INPUT_CHANNELS]; - ALsizei j,k,c; + ALint sample[MAX_INPUT_CHANNELS] = { 0 }; + ALint index[MAX_INPUT_CHANNELS] = { 0 }; + ALuint code[MAX_INPUT_CHANNELS] = { 0 }; + ALsizei c, i; for(c = 0;c < numchans;c++) { @@ -257,143 +149,77 @@ static void DecodeIMA4Block(ALshort *dst, const ALima4 *src, ALint numchans, ALs dst[c] = sample[c]; } - for(j = 1;j < align;j += 8) + for(i = 1;i < align;i++) { - for(c = 0;c < numchans;c++) - { - code[c] = *(src++); - code[c] |= *(src++) << 8; - code[c] |= *(src++) << 16; - code[c] |= *(src++) << 24; - } - - for(k = 0;k < 8;k++) + if((i&7) == 1) { for(c = 0;c < numchans;c++) { - int nibble = code[c]&0xf; - code[c] >>= 4; - - sample[c] += IMA4Codeword[nibble] * IMAStep_size[index[c]] / 8; - sample[c] = clampi(sample[c], -32768, 32767); - - index[c] += IMA4Index_adjust[nibble]; - index[c] = clampi(index[c], 0, 88); - - dst[(j+k)*numchans + c] = sample[c]; + code[c] = *(src++); + code[c] |= *(src++) << 8; + code[c] |= *(src++) << 16; + code[c] |= *(src++) << 24; } } + + for(c = 0;c < numchans;c++) + { + int nibble = code[c]&0xf; + code[c] >>= 4; + + sample[c] += IMA4Codeword[nibble] * IMAStep_size[index[c]] / 8; + sample[c] = clampi(sample[c], -32768, 32767); + + index[c] += IMA4Index_adjust[nibble]; + index[c] = clampi(index[c], 0, 88); + + *(dst++) = sample[c]; + } } } -static void EncodeIMA4Block(ALima4 *dst, const ALshort *src, ALint *sample, ALint *index, ALint numchans, ALsizei align) +static void DecodeMSADPCMBlock(ALshort *dst, const ALubyte *src, ALint numchans, ALsizei align) { - ALsizei j,k,c; + ALubyte blockpred[MAX_INPUT_CHANNELS] = { 0 }; + ALint delta[MAX_INPUT_CHANNELS] = { 0 }; + ALshort samples[MAX_INPUT_CHANNELS][2] = { { 0, 0 } }; + ALint c, i; for(c = 0;c < numchans;c++) { - int diff = src[c] - sample[c]; - int step = IMAStep_size[index[c]]; - int nibble; - - nibble = 0; - if(diff < 0) - { - nibble = 0x8; - diff = -diff; - } - - diff = mini(step*2, diff); - nibble |= (diff*8/step - 1) / 2; - - sample[c] += IMA4Codeword[nibble] * step / 8; - sample[c] = clampi(sample[c], -32768, 32767); - - index[c] += IMA4Index_adjust[nibble]; - index[c] = clampi(index[c], 0, 88); - - *(dst++) = sample[c] & 0xff; - *(dst++) = (sample[c]>>8) & 0xff; - *(dst++) = index[c] & 0xff; - *(dst++) = (index[c]>>8) & 0xff; + blockpred[c] = *(src++); + blockpred[c] = minu(blockpred[c], 6); } - - for(j = 1;j < align;j += 8) + for(c = 0;c < numchans;c++) { - for(c = 0;c < numchans;c++) - { - for(k = 0;k < 8;k++) - { - int diff = src[(j+k)*numchans + c] - sample[c]; - int step = IMAStep_size[index[c]]; - int nibble; - - nibble = 0; - if(diff < 0) - { - nibble = 0x8; - diff = -diff; - } - - diff = mini(step*2, diff); - nibble |= (diff*8/step - 1) / 2; - - sample[c] += IMA4Codeword[nibble] * step / 8; - sample[c] = clampi(sample[c], -32768, 32767); - - index[c] += IMA4Index_adjust[nibble]; - index[c] = clampi(index[c], 0, 88); - - if(!(k&1)) *dst = nibble; - else *(dst++) |= nibble<<4; - } - } + delta[c] = *(src++); + delta[c] |= *(src++) << 8; + delta[c] = (delta[c]^0x8000) - 32768; } -} - - -static void DecodeMSADPCMBlock(ALshort *dst, const ALmsadpcm *src, ALint numchans, ALsizei align) -{ - ALubyte blockpred[MAX_INPUT_CHANNELS]; - ALint delta[MAX_INPUT_CHANNELS]; - ALshort samples[MAX_INPUT_CHANNELS][2]; - ALint i, j; - - for(i = 0;i < numchans;i++) + for(c = 0;c < numchans;c++) { - blockpred[i] = *(src++); - blockpred[i] = minu(blockpred[i], 6); + samples[c][0] = *(src++); + samples[c][0] |= *(src++) << 8; + samples[c][0] = (samples[c][0]^0x8000) - 32768; } - for(i = 0;i < numchans;i++) + for(c = 0;c < numchans;c++) { - delta[i] = *(src++); - delta[i] |= *(src++) << 8; - delta[i] = (delta[i]^0x8000) - 0x8000; - } - for(i = 0;i < numchans;i++) - { - samples[i][0] = *(src++); - samples[i][0] |= *(src++) << 8; - samples[i][0] = (samples[i][0]^0x8000) - 0x8000; - } - for(i = 0;i < numchans;i++) - { - samples[i][1] = *(src++); - samples[i][1] |= *(src++) << 8; - samples[i][1] = (samples[i][1]^0x8000) - 0x8000; + samples[c][1] = *(src++); + samples[c][1] |= *(src++) << 8; + samples[c][1] = (samples[c][1]^0x8000) - 0x8000; } /* Second sample is written first. */ - for(i = 0;i < numchans;i++) - *(dst++) = samples[i][1]; - for(i = 0;i < numchans;i++) - *(dst++) = samples[i][0]; + for(c = 0;c < numchans;c++) + *(dst++) = samples[c][1]; + for(c = 0;c < numchans;c++) + *(dst++) = samples[c][0]; - for(j = 2;j < align;j++) + for(i = 2;i < align;i++) { - for(i = 0;i < numchans;i++) + for(c = 0;c < numchans;c++) { - const ALint num = (j*numchans) + i; + const ALint num = (i*numchans) + c; ALint nibble, pred; /* Read the nibble (first is in the upper bits). */ @@ -402,388 +228,28 @@ static void DecodeMSADPCMBlock(ALshort *dst, const ALmsadpcm *src, ALint numchan else nibble = (*(src++))&0x0f; - pred = (samples[i][0]*MSADPCMAdaptionCoeff[blockpred[i]][0] + - samples[i][1]*MSADPCMAdaptionCoeff[blockpred[i]][1]) / 256; - pred += ((nibble^0x08) - 0x08) * delta[i]; + pred = (samples[c][0]*MSADPCMAdaptionCoeff[blockpred[c]][0] + + samples[c][1]*MSADPCMAdaptionCoeff[blockpred[c]][1]) / 256; + pred += ((nibble^0x08) - 0x08) * delta[c]; pred = clampi(pred, -32768, 32767); - samples[i][1] = samples[i][0]; - samples[i][0] = pred; + samples[c][1] = samples[c][0]; + samples[c][0] = pred; - delta[i] = (MSADPCMAdaption[nibble] * delta[i]) / 256; - delta[i] = maxi(16, delta[i]); + delta[c] = (MSADPCMAdaption[nibble] * delta[c]) / 256; + delta[c] = maxi(16, delta[c]); *(dst++) = pred; } } } -/* NOTE: This encoder is pretty dumb/simplistic. Some kind of pre-processing - * that tries to find the optimal block predictors would be nice, at least. A - * multi-pass method that can generate better deltas would be good, too. */ -static void EncodeMSADPCMBlock(ALmsadpcm *dst, const ALshort *src, ALint *sample, ALint numchans, ALsizei align) -{ - ALubyte blockpred[MAX_INPUT_CHANNELS]; - ALint delta[MAX_INPUT_CHANNELS]; - ALshort samples[MAX_INPUT_CHANNELS][2]; - ALint i, j; - /* Block predictor */ - for(i = 0;i < numchans;i++) - { - /* FIXME: Calculate something better. */ - blockpred[i] = 0; - *(dst++) = blockpred[i]; - } - /* Initial delta */ - for(i = 0;i < numchans;i++) - { - delta[i] = 16; - *(dst++) = (delta[i] ) & 0xff; - *(dst++) = (delta[i]>>8) & 0xff; - } - /* Initial sample 1 */ - for(i = 0;i < numchans;i++) - { - samples[i][0] = src[1*numchans + i]; - *(dst++) = (samples[i][0] ) & 0xff; - *(dst++) = (samples[i][0]>>8) & 0xff; - } - /* Initial sample 2 */ - for(i = 0;i < numchans;i++) - { - samples[i][1] = src[i]; - *(dst++) = (samples[i][1] ) & 0xff; - *(dst++) = (samples[i][1]>>8) & 0xff; - } - - for(j = 2;j < align;j++) - { - for(i = 0;i < numchans;i++) - { - const ALint num = (j*numchans) + i; - ALint nibble = 0; - ALint bias; - - sample[i] = (samples[i][0]*MSADPCMAdaptionCoeff[blockpred[i]][0] + - samples[i][1]*MSADPCMAdaptionCoeff[blockpred[i]][1]) / 256; - - nibble = src[num] - sample[i]; - if(nibble >= 0) - bias = delta[i] / 2; - else - bias = -delta[i] / 2; - - nibble = (nibble + bias) / delta[i]; - nibble = clampi(nibble, -8, 7)&0x0f; - - sample[i] += ((nibble^0x08)-0x08) * delta[i]; - sample[i] = clampi(sample[i], -32768, 32767); - - samples[i][1] = samples[i][0]; - samples[i][0] = sample[i]; - - delta[i] = (MSADPCMAdaption[nibble] * delta[i]) / 256; - delta[i] = maxi(16, delta[i]); - - if(!(num&1)) - *dst = nibble << 4; - else - { - *dst |= nibble; - dst++; - } - } - } -} - - -static inline ALint DecodeByte3(ALbyte3 val) -{ - if(IS_LITTLE_ENDIAN) - return (val.b[2]<<16) | (((ALubyte)val.b[1])<<8) | ((ALubyte)val.b[0]); - return (val.b[0]<<16) | (((ALubyte)val.b[1])<<8) | ((ALubyte)val.b[2]); -} - -static inline ALbyte3 EncodeByte3(ALint val) -{ - if(IS_LITTLE_ENDIAN) - { - ALbyte3 ret = {{ val, val>>8, val>>16 }}; - return ret; - } - else - { - ALbyte3 ret = {{ val>>16, val>>8, val }}; - return ret; - } -} - -static inline ALint DecodeUByte3(ALubyte3 val) -{ - if(IS_LITTLE_ENDIAN) - return (val.b[2]<<16) | (val.b[1]<<8) | (val.b[0]); - return (val.b[0]<<16) | (val.b[1]<<8) | val.b[2]; -} - -static inline ALubyte3 EncodeUByte3(ALint val) -{ - if(IS_LITTLE_ENDIAN) - { - ALubyte3 ret = {{ val, val>>8, val>>16 }}; - return ret; - } - else - { - ALubyte3 ret = {{ val>>16, val>>8, val }}; - return ret; - } -} - - -/* Define same-type pass-through sample conversion functions (excludes ADPCM, - * which are block-based). */ -#define DECL_TEMPLATE(T) \ -static inline T Conv_##T##_##T(T val) { return val; } - -DECL_TEMPLATE(ALbyte); -DECL_TEMPLATE(ALubyte); -DECL_TEMPLATE(ALshort); -DECL_TEMPLATE(ALushort); -DECL_TEMPLATE(ALint); -DECL_TEMPLATE(ALuint); -DECL_TEMPLATE(ALbyte3); -DECL_TEMPLATE(ALubyte3); -DECL_TEMPLATE(ALalaw); -DECL_TEMPLATE(ALmulaw); - -/* Slightly special handling for floats and doubles (converts NaN to 0, and - * allows float<->double pass-through). - */ -static inline ALfloat Conv_ALfloat_ALfloat(ALfloat val) -{ return (val==val) ? val : 0.0f; } -static inline ALfloat Conv_ALfloat_ALdouble(ALdouble val) -{ return (val==val) ? (ALfloat)val : 0.0f; } -static inline ALdouble Conv_ALdouble_ALfloat(ALfloat val) -{ return (val==val) ? (ALdouble)val : 0.0; } -static inline ALdouble Conv_ALdouble_ALdouble(ALdouble val) -{ return (val==val) ? val : 0.0; } - -#undef DECL_TEMPLATE - -/* Define alternate-sign functions. */ -#define DECL_TEMPLATE(T1, T2, O) \ -static inline T1 Conv_##T1##_##T2(T2 val) { return (T1)val - O; } \ -static inline T2 Conv_##T2##_##T1(T1 val) { return (T2)val + O; } - -DECL_TEMPLATE(ALbyte, ALubyte, 128); -DECL_TEMPLATE(ALshort, ALushort, 32768); -DECL_TEMPLATE(ALint, ALuint, 2147483648u); - -#undef DECL_TEMPLATE - -/* Define int-type to int-type functions */ -#define DECL_TEMPLATE(T, ST, UT, SH) \ -static inline T Conv_##T##_##ST(ST val){ return val >> SH; } \ -static inline T Conv_##T##_##UT(UT val){ return Conv_##ST##_##UT(val) >> SH; }\ -static inline ST Conv_##ST##_##T(T val){ return val << SH; } \ -static inline UT Conv_##UT##_##T(T val){ return Conv_##UT##_##ST(val << SH); } - -#define DECL_TEMPLATE2(T1, T2, SH) \ -DECL_TEMPLATE(AL##T1, AL##T2, ALu##T2, SH) \ -DECL_TEMPLATE(ALu##T1, ALu##T2, AL##T2, SH) - -DECL_TEMPLATE2(byte, short, 8) -DECL_TEMPLATE2(short, int, 16) -DECL_TEMPLATE2(byte, int, 24) - -#undef DECL_TEMPLATE2 -#undef DECL_TEMPLATE - -/* Define int-type to fp functions */ -#define DECL_TEMPLATE(T, ST, UT, OP) \ -static inline T Conv_##T##_##ST(ST val) { return (T)val * OP; } \ -static inline T Conv_##T##_##UT(UT val) { return (T)Conv_##ST##_##UT(val) * OP; } - -#define DECL_TEMPLATE2(T1, T2, OP) \ -DECL_TEMPLATE(T1, AL##T2, ALu##T2, OP) - -DECL_TEMPLATE2(ALfloat, byte, (1.0f/127.0f)) -DECL_TEMPLATE2(ALdouble, byte, (1.0/127.0)) -DECL_TEMPLATE2(ALfloat, short, (1.0f/32767.0f)) -DECL_TEMPLATE2(ALdouble, short, (1.0/32767.0)) -DECL_TEMPLATE2(ALdouble, int, (1.0/2147483647.0)) - -/* Special handling for int32 to float32, since it would overflow. */ -static inline ALfloat Conv_ALfloat_ALint(ALint val) -{ return (ALfloat)(val>>7) * (1.0f/16777215.0f); } -static inline ALfloat Conv_ALfloat_ALuint(ALuint val) -{ return (ALfloat)(Conv_ALint_ALuint(val)>>7) * (1.0f/16777215.0f); } - -#undef DECL_TEMPLATE2 -#undef DECL_TEMPLATE - -/* Define fp to int-type functions */ -#define DECL_TEMPLATE(FT, T, smin, smax) \ -static inline AL##T Conv_AL##T##_##FT(FT val) \ -{ \ - if(val > 1.0f) return smax; \ - if(val < -1.0f) return smin; \ - return (AL##T)(val * (FT)smax); \ -} \ -static inline ALu##T Conv_ALu##T##_##FT(FT val) \ -{ return Conv_ALu##T##_AL##T(Conv_AL##T##_##FT(val)); } - -DECL_TEMPLATE(ALfloat, byte, -128, 127) -DECL_TEMPLATE(ALdouble, byte, -128, 127) -DECL_TEMPLATE(ALfloat, short, -32768, 32767) -DECL_TEMPLATE(ALdouble, short, -32768, 32767) -DECL_TEMPLATE(ALdouble, int, -2147483647-1, 2147483647) - -/* Special handling for float32 to int32, since it would overflow. */ -static inline ALint Conv_ALint_ALfloat(ALfloat val) -{ - if(val > 1.0f) return 2147483647; - if(val < -1.0f) return -2147483647-1; - return (ALint)(val * 16777215.0f) << 7; -} -static inline ALuint Conv_ALuint_ALfloat(ALfloat val) -{ return Conv_ALuint_ALint(Conv_ALint_ALfloat(val)); } - -#undef DECL_TEMPLATE - -/* Define byte3 and ubyte3 functions (goes through int and uint functions). */ -#define DECL_TEMPLATE(T) \ -static inline ALbyte3 Conv_ALbyte3_##T(T val) \ -{ return EncodeByte3(Conv_ALint_##T(val)>>8); } \ -static inline T Conv_##T##_ALbyte3(ALbyte3 val) \ -{ return Conv_##T##_ALint(DecodeByte3(val)<<8); } \ - \ -static inline ALubyte3 Conv_ALubyte3_##T(T val) \ -{ return EncodeUByte3(Conv_ALuint_##T(val)>>8); } \ -static inline T Conv_##T##_ALubyte3(ALubyte3 val) \ -{ return Conv_##T##_ALuint(DecodeUByte3(val)<<8); } - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) - -#undef DECL_TEMPLATE - -/* Define byte3 <-> ubyte3 functions. */ -static inline ALbyte3 Conv_ALbyte3_ALubyte3(ALubyte3 val) -{ return EncodeByte3(DecodeUByte3(val)-8388608); } -static inline ALubyte3 Conv_ALubyte3_ALbyte3(ALbyte3 val) -{ return EncodeUByte3(DecodeByte3(val)+8388608); } - -/* Define muLaw and aLaw functions (goes through short functions). */ -#define DECL_TEMPLATE(T) \ -static inline ALmulaw Conv_ALmulaw_##T(T val) \ -{ return EncodeMuLaw(Conv_ALshort_##T(val)); } \ -static inline T Conv_##T##_ALmulaw(ALmulaw val) \ -{ return Conv_##T##_ALshort(DecodeMuLaw(val)); } \ - \ -static inline ALalaw Conv_ALalaw_##T(T val) \ -{ return EncodeALaw(Conv_ALshort_##T(val)); } \ -static inline T Conv_##T##_ALalaw(ALalaw val) \ -{ return Conv_##T##_ALshort(DecodeALaw(val)); } - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - -/* Define muLaw <-> aLaw functions. */ -static inline ALalaw Conv_ALalaw_ALmulaw(ALmulaw val) -{ return EncodeALaw(DecodeMuLaw(val)); } -static inline ALmulaw Conv_ALmulaw_ALalaw(ALalaw val) -{ return EncodeMuLaw(DecodeALaw(val)); } - - -#define DECL_TEMPLATE(T1, T2) \ -static void Convert_##T1##_##T2(T1 *dst, const T2 *src, ALuint numchans, \ - ALuint len, ALsizei UNUSED(align)) \ -{ \ - ALuint i, j; \ - for(i = 0;i < len;i++) \ - { \ - for(j = 0;j < numchans;j++) \ - *(dst++) = Conv_##T1##_##T2(*(src++)); \ - } \ -} - -#define DECL_TEMPLATE2(T) \ -DECL_TEMPLATE(T, ALbyte) \ -DECL_TEMPLATE(T, ALubyte) \ -DECL_TEMPLATE(T, ALshort) \ -DECL_TEMPLATE(T, ALushort) \ -DECL_TEMPLATE(T, ALint) \ -DECL_TEMPLATE(T, ALuint) \ -DECL_TEMPLATE(T, ALfloat) \ -DECL_TEMPLATE(T, ALdouble) \ -DECL_TEMPLATE(T, ALmulaw) \ -DECL_TEMPLATE(T, ALalaw) \ -DECL_TEMPLATE(T, ALbyte3) \ -DECL_TEMPLATE(T, ALubyte3) - -DECL_TEMPLATE2(ALbyte) -DECL_TEMPLATE2(ALubyte) -DECL_TEMPLATE2(ALshort) -DECL_TEMPLATE2(ALushort) -DECL_TEMPLATE2(ALint) -DECL_TEMPLATE2(ALuint) -DECL_TEMPLATE2(ALfloat) -DECL_TEMPLATE2(ALdouble) -DECL_TEMPLATE2(ALmulaw) -DECL_TEMPLATE2(ALalaw) -DECL_TEMPLATE2(ALbyte3) -DECL_TEMPLATE2(ALubyte3) - -#undef DECL_TEMPLATE2 -#undef DECL_TEMPLATE - -#define DECL_TEMPLATE(T) \ -static void Convert_##T##_ALima4(T *dst, const ALima4 *src, ALuint numchans, \ - ALuint len, ALuint align) \ -{ \ - ALsizei byte_align = ((align-1)/2 + 4) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 0 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - DecodeIMA4Block(tmp, src, numchans, align); \ - src += byte_align; \ - \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - *(dst++) = Conv_##T##_ALshort(tmp[j*numchans + k]); \ - } \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALshort_ALima4(ALshort *dst, const ALima4 *src, ALuint numchans, - ALuint len, ALuint align) +void Convert_ALshort_ALima4(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align) { ALsizei byte_align = ((align-1)/2 + 4) * numchans; - ALuint i; + ALsizei i; assert(align > 0 && (len%align) == 0); for(i = 0;i < len;i += align) @@ -793,103 +259,12 @@ static void Convert_ALshort_ALima4(ALshort *dst, const ALima4 *src, ALuint numch dst += align*numchans; } } -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) -#undef DECL_TEMPLATE - -#define DECL_TEMPLATE(T) \ -static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \ - ALuint len, ALuint align) \ -{ \ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ - ALint index[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ - ALsizei byte_align = ((align-1)/2 + 4) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 0 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - tmp[j*numchans + k] = Conv_ALshort_##T(*(src++)); \ - } \ - EncodeIMA4Block(dst, tmp, sample, index, numchans, align); \ - dst += byte_align; \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALima4_ALshort(ALima4 *dst, const ALshort *src, - ALuint numchans, ALuint len, ALuint align) -{ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; - ALint index[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; - ALsizei byte_align = ((align-1)/2 + 4) * numchans; - ALuint i; - - assert(align > 0 && (len%align) == 0); - for(i = 0;i < len;i += align) - { - EncodeIMA4Block(dst, src, sample, index, numchans, align); - src += align*numchans; - dst += byte_align; - } -} -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - - -#define DECL_TEMPLATE(T) \ -static void Convert_##T##_ALmsadpcm(T *dst, const ALmsadpcm *src, \ - ALuint numchans, ALuint len, \ - ALuint align) \ -{ \ - ALsizei byte_align = ((align-2)/2 + 7) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 1 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - DecodeMSADPCMBlock(tmp, src, numchans, align); \ - src += byte_align; \ - \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - *(dst++) = Conv_##T##_ALshort(tmp[j*numchans + k]); \ - } \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALmsadpcm *src, - ALuint numchans, ALuint len, - ALuint align) +void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align) { ALsizei byte_align = ((align-2)/2 + 7) * numchans; - ALuint i; + ALsizei i; assert(align > 1 && (len%align) == 0); for(i = 0;i < len;i += align) @@ -899,214 +274,3 @@ static void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALmsadpcm *src, dst += align*numchans; } } -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - -#define DECL_TEMPLATE(T) \ -static void Convert_ALmsadpcm_##T(ALmsadpcm *dst, const T *src, \ - ALuint numchans, ALuint len, ALuint align) \ -{ \ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ - ALsizei byte_align = ((align-2)/2 + 7) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 1 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - tmp[j*numchans + k] = Conv_ALshort_##T(*(src++)); \ - } \ - EncodeMSADPCMBlock(dst, tmp, sample, numchans, align); \ - dst += byte_align; \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALmsadpcm_ALshort(ALmsadpcm *dst, const ALshort *src, - ALuint numchans, ALuint len, ALuint align) -{ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; - ALsizei byte_align = ((align-2)/2 + 7) * numchans; - ALuint i; - - assert(align > 1 && (len%align) == 0); - for(i = 0;i < len;i += align) - { - EncodeMSADPCMBlock(dst, src, sample, numchans, align); - src += align*numchans; - dst += byte_align; - } -} -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - -/* NOTE: We don't store compressed samples internally, so these conversions - * should never happen. */ -static void Convert_ALima4_ALima4(ALima4* UNUSED(dst), const ALima4* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected IMA4-to-IMA4 conversion!\n"); -} - -static void Convert_ALmsadpcm_ALmsadpcm(ALmsadpcm* UNUSED(dst), const ALmsadpcm* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected MSADPCM-to-MSADPCM conversion!\n"); -} - -static void Convert_ALmsadpcm_ALima4(ALmsadpcm* UNUSED(dst), const ALima4* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected IMA4-to-MSADPCM conversion!\n"); -} - -static void Convert_ALima4_ALmsadpcm(ALima4* UNUSED(dst), const ALmsadpcm* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected MSADPCM-to-IMA4 conversion!\n"); -} - - -#define DECL_TEMPLATE(T) \ -static void Convert_##T(T *dst, const ALvoid *src, enum UserFmtType srcType, \ - ALsizei numchans, ALsizei len, ALsizei align) \ -{ \ - switch(srcType) \ - { \ - case UserFmtByte: \ - Convert_##T##_ALbyte(dst, src, numchans, len, align); \ - break; \ - case UserFmtUByte: \ - Convert_##T##_ALubyte(dst, src, numchans, len, align); \ - break; \ - case UserFmtShort: \ - Convert_##T##_ALshort(dst, src, numchans, len, align); \ - break; \ - case UserFmtUShort: \ - Convert_##T##_ALushort(dst, src, numchans, len, align); \ - break; \ - case UserFmtInt: \ - Convert_##T##_ALint(dst, src, numchans, len, align); \ - break; \ - case UserFmtUInt: \ - Convert_##T##_ALuint(dst, src, numchans, len, align); \ - break; \ - case UserFmtFloat: \ - Convert_##T##_ALfloat(dst, src, numchans, len, align); \ - break; \ - case UserFmtDouble: \ - Convert_##T##_ALdouble(dst, src, numchans, len, align); \ - break; \ - case UserFmtMulaw: \ - Convert_##T##_ALmulaw(dst, src, numchans, len, align); \ - break; \ - case UserFmtAlaw: \ - Convert_##T##_ALalaw(dst, src, numchans, len, align); \ - break; \ - case UserFmtIMA4: \ - Convert_##T##_ALima4(dst, src, numchans, len, align); \ - break; \ - case UserFmtMSADPCM: \ - Convert_##T##_ALmsadpcm(dst, src, numchans, len, align); \ - break; \ - case UserFmtByte3: \ - Convert_##T##_ALbyte3(dst, src, numchans, len, align); \ - break; \ - case UserFmtUByte3: \ - Convert_##T##_ALubyte3(dst, src, numchans, len, align); \ - break; \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALima4) -DECL_TEMPLATE(ALmsadpcm) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - - -void ConvertData(ALvoid *dst, enum UserFmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei numchans, ALsizei len, ALsizei align) -{ - switch(dstType) - { - case UserFmtByte: - Convert_ALbyte(dst, src, srcType, numchans, len, align); - break; - case UserFmtUByte: - Convert_ALubyte(dst, src, srcType, numchans, len, align); - break; - case UserFmtShort: - Convert_ALshort(dst, src, srcType, numchans, len, align); - break; - case UserFmtUShort: - Convert_ALushort(dst, src, srcType, numchans, len, align); - break; - case UserFmtInt: - Convert_ALint(dst, src, srcType, numchans, len, align); - break; - case UserFmtUInt: - Convert_ALuint(dst, src, srcType, numchans, len, align); - break; - case UserFmtFloat: - Convert_ALfloat(dst, src, srcType, numchans, len, align); - break; - case UserFmtDouble: - Convert_ALdouble(dst, src, srcType, numchans, len, align); - break; - case UserFmtMulaw: - Convert_ALmulaw(dst, src, srcType, numchans, len, align); - break; - case UserFmtAlaw: - Convert_ALalaw(dst, src, srcType, numchans, len, align); - break; - case UserFmtIMA4: - Convert_ALima4(dst, src, srcType, numchans, len, align); - break; - case UserFmtMSADPCM: - Convert_ALmsadpcm(dst, src, srcType, numchans, len, align); - break; - case UserFmtByte3: - Convert_ALbyte3(dst, src, srcType, numchans, len, align); - break; - case UserFmtUByte3: - Convert_ALubyte3(dst, src, srcType, numchans, len, align); - break; - } -} diff --git a/Engine/lib/openal-soft/README b/Engine/lib/openal-soft/README deleted file mode 100644 index a0178ae5e..000000000 --- a/Engine/lib/openal-soft/README +++ /dev/null @@ -1,55 +0,0 @@ -Source Install -============== - -To install OpenAL Soft, use your favorite shell to go into the build/ -directory, and run: - -cmake .. - -Assuming configuration went well, you can then build it, typically using GNU -Make (KDevelop, MSVC, and others are possible depending on your system setup -and CMake configuration). - -Please Note: Double check that the appropriate backends were detected. Often, -complaints of no sound, crashing, and missing devices can be solved by making -sure the correct backends are being used. CMake's output will identify which -backends were enabled. - -For most systems, you will likely want to make sure ALSA, OSS, and PulseAudio -were detected (if your target system uses them). For Windows, make sure -DirectSound was detected. - - -Utilities -========= - -The source package comes with an informational utility, openal-info, and is -built by default. It prints out information provided by the ALC and AL sub- -systems, including discovered devices, version information, and extensions. - - -Configuration -============= - -OpenAL Soft can be configured on a per-user and per-system basis. This allows -users and sysadmins to control information provided to applications, as well -as application-agnostic behavior of the library. See alsoftrc.sample for -available settings. - - -Acknowledgements -================ - -Special thanks go to: - -Creative Labs for the original source code this is based off of. - -Christopher Fitzgerald for the current reverb effect implementation, and -helping with the low-pass and HRTF filters. - -Christian Borss for the 3D panning code previous versions used as a base. - -Ben Davis for the idea behind a previous version of the click-removal code. - -Richard Furse for helping with my understanding of Ambisonics that is used by -the various parts of the library. diff --git a/Engine/lib/openal-soft/README.md b/Engine/lib/openal-soft/README.md new file mode 100644 index 000000000..0c9d30276 --- /dev/null +++ b/Engine/lib/openal-soft/README.md @@ -0,0 +1,61 @@ +OpenAL soft +=========== + +`master` branch CI status : [![Build Status](https://travis-ci.org/kcat/openal-soft.svg?branch=master)](https://travis-ci.org/kcat/openal-soft) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/kcat/openal-soft?branch=master&svg=true)](https://ci.appveyor.com/api/projects/status/github/kcat/openal-soft?branch=master&svg=true) + +OpenAL Soft is an LGPL-licensed, cross-platform, software implementation of the OpenAL 3D audio API. It's forked from the open-sourced Windows version available originally from openal.org's SVN repository (now defunct). +OpenAL provides capabilities for playing audio in a virtual 3D environment. Distance attenuation, doppler shift, and directional sound emitters are among the features handled by the API. More advanced effects, including air absorption, occlusion, and environmental reverb, are available through the EFX extension. It also facilitates streaming audio, multi-channel buffers, and audio capture. + +More information is available on the [official website](http://openal-soft.org/) + +Source Install +------------- +To install OpenAL Soft, use your favorite shell to go into the build/ +directory, and run: + +```bash +cmake .. +``` + +Assuming configuration went well, you can then build it, typically using GNU +Make (KDevelop, MSVC, and others are possible depending on your system setup +and CMake configuration). + +Please Note: Double check that the appropriate backends were detected. Often, +complaints of no sound, crashing, and missing devices can be solved by making +sure the correct backends are being used. CMake's output will identify which +backends were enabled. + +For most systems, you will likely want to make sure ALSA, OSS, and PulseAudio +were detected (if your target system uses them). For Windows, make sure +DirectSound was detected. + + +Utilities +--------- +The source package comes with an informational utility, openal-info, and is +built by default. It prints out information provided by the ALC and AL sub- +systems, including discovered devices, version information, and extensions. + + +Configuration +------------- + +OpenAL Soft can be configured on a per-user and per-system basis. This allows +users and sysadmins to control information provided to applications, as well +as application-agnostic behavior of the library. See alsoftrc.sample for +available settings. + + +Acknowledgements +---------------- + +Special thanks go to: + + - Creative Labs for the original source code this is based off of. + - Christopher Fitzgerald for the current reverb effect implementation, and +helping with the low-pass and HRTF filters. + - Christian Borss for the 3D panning code previous versions used as a base. + - Ben Davis for the idea behind a previous version of the click-removal code. + - Richard Furse for helping with my understanding of Ambisonics that is used by +the various parts of the library. diff --git a/Engine/lib/openal-soft/alsoftrc.sample b/Engine/lib/openal-soft/alsoftrc.sample index d5913ff0e..2b7093a95 100644 --- a/Engine/lib/openal-soft/alsoftrc.sample +++ b/Engine/lib/openal-soft/alsoftrc.sample @@ -81,7 +81,7 @@ # which helps protect against skips when the CPU is under load, but increases # the delay between a sound getting mixed and being heard. Acceptable values # range between 2 and 16. -#periods = 4 +#periods = 3 ## stereo-mode: # Specifies if stereo output is treated as being headphones or speakers. With @@ -89,13 +89,14 @@ # Valid settings are auto, speakers, and headphones. #stereo-mode = auto -## stereo-panning: -# Specifies the panning method for non-HRTF stereo output. uhj (default) -# creates stereo-compatible two-channel UHJ output, which encodes some -# surround sound information, while paired uses standard pair-wise panning -# between -30 and +30 degrees. If crossfeed filters are used, uhj panning is -# disabled. -#stereo-panning = uhj +## stereo-encoding: +# Specifies the encoding method for non-HRTF stereo output. 'panpot' (default) +# uses standard amplitude panning (aka pair-wise, stereo pair, etc) between +# -30 and +30 degrees, while 'uhj' creates stereo-compatible two-channel UHJ +# output, which encodes some surround sound information into stereo output +# that can be decoded with a surround sound receiver. If crossfeed filters are +# used, UHJ is disabled. +#stereo-encoding = panpot ## ambi-format: # Specifies the channel order and normalization for the "ambi*" set of channel @@ -148,11 +149,11 @@ # Selects the resampler used when mixing sources. Valid values are: # point - nearest sample, no interpolation # linear - extrapolates samples using a linear slope between samples -# sinc4 - extrapolates samples using a 4-point Sinc filter -# sinc8 - extrapolates samples using an 8-point Sinc filter -# bsinc - extrapolates samples using a band-limited Sinc filter (varying -# between 12 and 24 points, with anti-aliasing) -# Specifying other values will result in using the default (linear). +# cubic - extrapolates samples using a Catmull-Rom spline +# bsinc12 - extrapolates samples using a band-limited Sinc filter (varying +# between 12 and 24 points, with anti-aliasing) +# bsinc24 - extrapolates samples using a band-limited Sinc filter (varying +# between 24 and 48 points, with anti-aliasing) #resampler = linear ## rt-prio: (global) @@ -174,13 +175,39 @@ # can use a non-negligible amount of CPU time if an effect is set on it even # if no sources are feeding it, so this may help when apps use more than the # system can handle. -#slots = 4 +#slots = 64 ## sends: -# Sets the number of auxiliary sends per source. When not specified (default), -# it allows the app to request how many it wants. The maximum value currently -# possible is 4. -#sends = +# Limits the number of auxiliary sends allowed per source. Setting this higher +# than the default has no effect. +#sends = 16 + +## front-stablizer: +# Applies filters to "stablize" front sound imaging. A psychoacoustic method +# is used to generate a front-center channel signal from the front-left and +# front-right channels, improving the front response by reducing the combing +# artifacts and phase errors. Consequently, it will only work with channel +# configurations that include front-left, front-right, and front-center. +#front-stablizer = false + +## output-limiter: +# Applies a gain limiter on the final mixed output. This reduces the volume +# when the output samples would otherwise clamp, avoiding excessive clipping +# noise. +#output-limiter = true + +## dither: +# Applies dithering on the final mix, for 8- and 16-bit output by default. +# This replaces the distortion created by nearest-value quantization with low- +# level whitenoise. +#dither = true + +## dither-depth: +# Quantization bit-depth for dithered output. A value of 0 (or less) will +# match the output sample depth. For int32, uint32, and float32 output, 0 will +# disable dithering because they're at or beyond the rendered precision. The +# maximum dither depth is 24. +#dither-depth = 0 ## volume-adjust: # A global volume adjustment for source output, expressed in decibels. The @@ -193,7 +220,7 @@ # Sets which effects to exclude, preventing apps from using them. This can # help for apps that try to use effects which are too CPU intensive for the # system to handle. Available effects are: eaxreverb,reverb,chorus,compressor, -# distortion,echo,equalizer,flanger,modulator,dedicated +# distortion,echo,equalizer,flanger,modulator,dedicated,pshifter #excludefx = ## default-reverb: (global) @@ -235,26 +262,39 @@ hq-mode = false # Enables compensation for the speakers' relative distances to the listener. # This applies the necessary delays and attenuation to make the speakers # behave as though they are all equidistant, which is important for proper -# playback of 3D sound rendering. Requires the high-quality ambisonic decoder, -# as well as the proper distances to be specified in the decoder configuration -# file. +# playback of 3D sound rendering. Requires the proper distances to be +# specified in the decoder configuration file. distance-comp = true +## nfc: +# Enables near-field control filters. This simulates and compensates for low- +# frequency effects caused by the curvature of nearby sound-waves, which +# creates a more realistic perception of sound distance. Note that the effect +# may be stronger or weaker than intended if the application doesn't use or +# specify an appropriate unit scale, or if incorrect speaker distances are set +# in the decoder configuration file. Requires hq-mode to be enabled. +nfc = true + +## nfc-ref-delay +# Specifies the reference delay value for ambisonic output. When channels is +# set to one of the ambi* formats, this option enables NFC-HOA output with the +# specified Reference Delay parameter. The specified value can then be shared +# with an appropriate NFC-HOA decoder to reproduce correct near-field effects. +# Keep in mind that despite being designed for higher-order ambisonics, this +# applies to first-order output all the same. When left unset, normal output +# is created with no near-field simulation. +nfc-ref-delay = + ## quad: -# Decoder configuration file for Quadrophonic channel output. See +# Decoder configuration file for Quadraphonic channel output. See # docs/ambdec.txt for a description of the file format. quad = ## surround51: -# Decoder configuration file for 5.1 Surround (Side) channel output. See -# docs/ambdec.txt for a description of the file format. +# Decoder configuration file for 5.1 Surround (Side and Rear) channel output. +# See docs/ambdec.txt for a description of the file format. surround51 = -## surround51rear: -# Decoder configuration file for 5.1 Surround (Rear) channel output. See -# docs/ambdec.txt for a description of the file format. -surround51rear = - ## surround61: # Decoder configuration file for 6.1 Surround channel output. See # docs/ambdec.txt for a description of the file format. @@ -279,12 +319,6 @@ surround71 = # value of 0 means no change. #boost = 0 -## emulate-eax: (global) -# Allows the standard reverb effect to be used in place of EAX reverb. EAX -# reverb processing is a bit more CPU intensive than standard, so this option -# allows a simpler effect to be used at the loss of some quality. -#emulate-eax = false - ## ## PulseAudio backend stuff ## @@ -410,9 +444,9 @@ surround71 = #buffer-size = 0 ## -## MMDevApi backend stuff +## WASAPI backend stuff ## -[mmdevapi] +[wasapi] ## ## DirectSound backend stuff diff --git a/Engine/lib/openal-soft/appveyor.yml b/Engine/lib/openal-soft/appveyor.yml index 4010f2ead..0e5b7ce40 100644 --- a/Engine/lib/openal-soft/appveyor.yml +++ b/Engine/lib/openal-soft/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.17.2.{build} +version: 1.18.2.{build} environment: matrix: @@ -7,8 +7,13 @@ environment: - GEN: "Visual Studio 14 2015 Win64" CFG: Release +install: + # Remove the VS Xamarin targets to reduce AppVeyor specific noise in build + # logs. See also http://help.appveyor.com/discussions/problems/4569 + - del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" + build_script: - cd build - - cmake .. -G"%GEN%" + - cmake -G"%GEN%" -DALSOFT_REQUIRE_WINMM=ON -DALSOFT_REQUIRE_DSOUND=ON -DALSOFT_REQUIRE_WASAPI=ON -DALSOFT_EMBED_HRTF_DATA=YES .. - cmake --build . --config %CFG% --clean-first diff --git a/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake b/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake index 7975f2334..c691fa9c9 100644 --- a/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake +++ b/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake @@ -34,7 +34,7 @@ # License text for the above reference.) MACRO(CHECK_SHARED_FUNCTION_EXISTS SYMBOL FILES LIBRARY LOCATION VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") + IF(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) IF(CMAKE_REQUIRED_LIBRARIES) @@ -88,5 +88,5 @@ MACRO(CHECK_SHARED_FUNCTION_EXISTS SYMBOL FILES LIBRARY LOCATION VARIABLE) "${OUTPUT}\nFile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") + ENDIF(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") ENDMACRO(CHECK_SHARED_FUNCTION_EXISTS) diff --git a/Engine/lib/openal-soft/cmake/FindDSound.cmake b/Engine/lib/openal-soft/cmake/FindDSound.cmake index 0ddf98aad..4078deb5e 100644 --- a/Engine/lib/openal-soft/cmake/FindDSound.cmake +++ b/Engine/lib/openal-soft/cmake/FindDSound.cmake @@ -8,24 +8,30 @@ # DSOUND_LIBRARY - the dsound library # -find_path(DSOUND_INCLUDE_DIR - NAMES dsound.h - PATHS "${DXSDK_DIR}" - PATH_SUFFIXES include - DOC "The DirectSound include directory" -) +if (WIN32) + include(FindWindowsSDK) + if (WINDOWSSDK_FOUND) + get_windowssdk_library_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_LIB_DIRS) + get_windowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIRS) + endif() +endif() +# DSOUND_INCLUDE_DIR +find_path(DSOUND_INCLUDE_DIR + NAMES "dsound.h" + PATHS "${DXSDK_DIR}" ${WINSDK_INCLUDE_DIRS} + PATH_SUFFIXES include + DOC "The DirectSound include directory") + +# DSOUND_LIBRARY find_library(DSOUND_LIBRARY NAMES dsound - PATHS "${DXSDK_DIR}" + PATHS "${DXSDK_DIR}" ${WINSDK_LIB_DIRS} PATH_SUFFIXES lib lib/x86 lib/x64 - DOC "The DirectSound library" -) + DOC "The DirectSound library") include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(DSound - REQUIRED_VARS DSOUND_LIBRARY DSOUND_INCLUDE_DIR -) +find_package_handle_standard_args(DSound REQUIRED_VARS DSOUND_LIBRARY DSOUND_INCLUDE_DIR) if(DSOUND_FOUND) set(DSOUND_LIBRARIES ${DSOUND_LIBRARY}) diff --git a/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake b/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake index 96cbb6ed0..c489c2c3c 100644 --- a/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake +++ b/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake @@ -142,6 +142,12 @@ foreach(_component ${FFmpeg_FIND_COMPONENTS}) endif() endforeach() +# Add libz if it exists (needed for static ffmpeg builds) +find_library(_FFmpeg_HAVE_LIBZ NAMES z) +if(_FFmpeg_HAVE_LIBZ) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${_FFmpeg_HAVE_LIBZ}) +endif() + # Build the include path and library list with duplicates removed. if(FFMPEG_INCLUDE_DIRS) list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) diff --git a/Engine/lib/openal-soft/cmake/FindOSS.cmake b/Engine/lib/openal-soft/cmake/FindOSS.cmake index 88ee66ad2..feffb4516 100644 --- a/Engine/lib/openal-soft/cmake/FindOSS.cmake +++ b/Engine/lib/openal-soft/cmake/FindOSS.cmake @@ -2,8 +2,10 @@ # # OSS_FOUND - True if OSS_INCLUDE_DIR is found # OSS_INCLUDE_DIRS - Set when OSS_INCLUDE_DIR is found +# OSS_LIBRARIES - Set when OSS_LIBRARY is found # # OSS_INCLUDE_DIR - where to find sys/soundcard.h, etc. +# OSS_LIBRARY - where to find libossaudio (optional). # find_path(OSS_INCLUDE_DIR @@ -11,11 +13,21 @@ find_path(OSS_INCLUDE_DIR DOC "The OSS include directory" ) +find_library(OSS_LIBRARY + NAMES ossaudio + DOC "Optional OSS library" +) + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(OSS REQUIRED_VARS OSS_INCLUDE_DIR) if(OSS_FOUND) set(OSS_INCLUDE_DIRS ${OSS_INCLUDE_DIR}) + if(OSS_LIBRARY) + set(OSS_LIBRARIES ${OSS_LIBRARY}) + else() + unset(OSS_LIBRARIES) + endif() endif() -mark_as_advanced(OSS_INCLUDE_DIR) +mark_as_advanced(OSS_INCLUDE_DIR OSS_LIBRARY) diff --git a/Engine/lib/openal-soft/cmake/FindSDL2.cmake b/Engine/lib/openal-soft/cmake/FindSDL2.cmake index 70e607a89..e808d0061 100644 --- a/Engine/lib/openal-soft/cmake/FindSDL2.cmake +++ b/Engine/lib/openal-soft/cmake/FindSDL2.cmake @@ -18,10 +18,10 @@ # module will automatically add the -framework Cocoa on your behalf. # # -# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration +# Additional Note: If you see an empty SDL2_CORE_LIBRARY in your configuration # and no SDL2_LIBRARY, it means CMake did not find your SDL2 library # (SDL2.dll, libsdl2.so, SDL2.framework, etc). -# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again. +# Set SDL2_CORE_LIBRARY to point to your SDL2 library, and configure again. # Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value # as appropriate. These values are used to generate the final SDL2_LIBRARY # variable, but when these values are unset, SDL2_LIBRARY does not get created. @@ -87,7 +87,7 @@ FIND_PATH(SDL2_INCLUDE_DIR SDL.h ) #MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}") -FIND_LIBRARY(SDL2_LIBRARY_TEMP +FIND_LIBRARY(SDL2_CORE_LIBRARY NAMES SDL2 HINTS $ENV{SDL2DIR} @@ -98,8 +98,7 @@ FIND_LIBRARY(SDL2_LIBRARY_TEMP /opt/csw /opt ) - -#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}") +#MESSAGE("SDL2_CORE_LIBRARY is ${SDL2_CORE_LIBRARY}") IF(NOT SDL2_BUILDING_LIBRARY) IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") @@ -137,7 +136,9 @@ IF(MINGW) ENDIF(MINGW) SET(SDL2_FOUND "NO") -IF(SDL2_LIBRARY_TEMP) +IF(SDL2_CORE_LIBRARY) + SET(SDL2_LIBRARY_TEMP ${SDL2_CORE_LIBRARY}) + # For SDL2main IF(NOT SDL2_BUILDING_LIBRARY) IF(SDL2MAIN_LIBRARY) @@ -172,15 +173,12 @@ IF(SDL2_LIBRARY_TEMP) ENDIF(WIN32) # Set the final string here so the GUI reflects the final state. - SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found") - # Set the temp variable to INTERNAL so it is not seen in the CMake GUI - SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") + SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP}) SET(SDL2_FOUND "YES") -ENDIF(SDL2_LIBRARY_TEMP) +ENDIF(SDL2_CORE_LIBRARY) INCLUDE(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) diff --git a/Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake b/Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake new file mode 100644 index 000000000..e136b8976 --- /dev/null +++ b/Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake @@ -0,0 +1,626 @@ +# - Find the Windows SDK aka Platform SDK +# +# Relevant Wikipedia article: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK +# +# Pass "COMPONENTS tools" to ignore Visual Studio version checks: in case +# you just want the tool binaries to run, rather than the libraries and headers +# for compiling. +# +# Variables: +# WINDOWSSDK_FOUND - if any version of the windows or platform SDK was found that is usable with the current version of visual studio +# WINDOWSSDK_LATEST_DIR +# WINDOWSSDK_LATEST_NAME +# WINDOWSSDK_FOUND_PREFERENCE - if we found an entry indicating a "preferred" SDK listed for this visual studio version +# WINDOWSSDK_PREFERRED_DIR +# WINDOWSSDK_PREFERRED_NAME +# +# WINDOWSSDK_DIRS - contains no duplicates, ordered most recent first. +# WINDOWSSDK_PREFERRED_FIRST_DIRS - contains no duplicates, ordered with preferred first, followed by the rest in descending recency +# +# Functions: +# windowssdk_name_lookup( ) - Find the name corresponding with the SDK directory you pass in, or +# NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work. +# +# windowssdk_build_lookup( ) - Find the build version number corresponding with the SDK directory you pass in, or +# NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work. +# +# get_windowssdk_from_component( ) - Given a library or include dir, +# find the Windows SDK root dir corresponding to it, or NOTFOUND if unrecognized. +# +# get_windowssdk_library_dirs( ) - Find the architecture-appropriate +# library directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_library_dirs_multiple( ...) - Find the architecture-appropriate +# library directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# +# get_windowssdk_include_dirs( ) - Find the +# include directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_include_dirs_multiple( ...) - Find the +# include directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2012. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(_preferred_sdk_dirs) # pre-output +set(_win_sdk_dirs) # pre-output +set(_win_sdk_versanddirs) # pre-output +set(_win_sdk_buildsanddirs) # pre-output +set(_winsdk_vistaonly) # search parameters +set(_winsdk_kits) # search parameters + + +set(_WINDOWSSDK_ANNOUNCE OFF) +if(NOT WINDOWSSDK_FOUND AND (NOT WindowsSDK_FIND_QUIETLY)) + set(_WINDOWSSDK_ANNOUNCE ON) +endif() +macro(_winsdk_announce) + if(_WINSDK_ANNOUNCE) + message(STATUS ${ARGN}) + endif() +endmacro() + +set(_winsdk_win10vers + 10.0.14393.0 # Redstone aka Win10 1607 "Anniversary Update" + 10.0.10586.0 # TH2 aka Win10 1511 + 10.0.10240.0 # Win10 RTM + 10.0.10150.0 # just ucrt + 10.0.10056.0 +) + +if(WindowsSDK_FIND_COMPONENTS MATCHES "tools") + set(_WINDOWSSDK_IGNOREMSVC ON) + _winsdk_announce("Checking for tools from Windows/Platform SDKs...") +else() + set(_WINDOWSSDK_IGNOREMSVC OFF) + _winsdk_announce("Checking for Windows/Platform SDKs...") +endif() + +# Appends to the three main pre-output lists used only if the path exists +# and is not already in the list. +function(_winsdk_conditional_append _vername _build _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + list(FIND _win_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - ${_vername}, Build ${_build} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_dirs "${_path}") + set(_win_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_versanddirs + "${_vername}" + "${_path}") + set(_win_sdk_versanddirs "${_win_sdk_versanddirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_buildsanddirs + "${_build}" + "${_path}") + set(_win_sdk_buildsanddirs "${_win_sdk_buildsanddirs}" CACHE INTERNAL "" FORCE) +endfunction() + +# Appends to the "preferred SDK" lists only if the path exists +function(_winsdk_conditional_append_preferred _info _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + + get_filename_component(_path "${_path}" ABSOLUTE) + + list(FIND _win_sdk_preferred_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - Found \"preferred\" SDK ${_info} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_preferred_sdk_dirs "${_path}") + set(_win_sdk_preferred_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + + # Just in case we somehow missed it: + _winsdk_conditional_append("${_info}" "" "${_path}") +endfunction() + +# Given a version like v7.0A, looks for an SDK in the registry under "Microsoft SDKs". +# If the given version might be in both HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows +# and HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots aka "Windows Kits", +# use this macro first, since these registry keys usually have more information. +# +# Pass a "default" build number as an extra argument in case we can't find it. +function(_winsdk_check_microsoft_sdks_registry _winsdkver) + set(SDKKEY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\${_winsdkver}") + get_filename_component(_sdkdir + "[${SDKKEY};InstallationFolder]" + ABSOLUTE) + + set(_sdkname "Windows SDK ${_winsdkver}") + + # Default build number passed as extra argument + set(_build ${ARGN}) + # See if the registry holds a Microsoft-mutilated, err, designated, product name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkproductname + "[${SDKKEY};ProductName]" + NAME) + if(NOT "${_sdkproductname}" MATCHES "registry") + # Got a product name + set(_sdkname "${_sdkname} (${_sdkproductname})") + endif() + + # try for a version to augment our name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkver + "[${SDKKEY};ProductVersion]" + NAME) + if(NOT "${_sdkver}" MATCHES "registry" AND NOT MATCHES) + # Got a version + if(NOT "${_sdkver}" MATCHES "\\.\\.") + # and it's not an invalid one with two dots in it: + # use to override the default build + set(_build ${_sdkver}) + if(NOT "${_sdkname}" MATCHES "${_sdkver}") + # Got a version that's not already in the name, let's use it to improve our name. + set(_sdkname "${_sdkname} (${_sdkver})") + endif() + endif() + endif() + _winsdk_conditional_append("${_sdkname}" "${_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes, the build number, and a key (technically a "value name") +# corresponding to a Windows SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Note that the key or "value name" tends to be something weird like KitsRoot81 - +# no easy way to predict, just have to observe them in the wild. +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_windows_kits_registry _winkit_name _winkit_build _winkit_key) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;${_winkit_key}]" + ABSOLUTE) + _winsdk_conditional_append("${_winkit_name}" "${_winkit_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes and the build number +# corresponding to a Windows 10 SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_win10_kits _winkit_build) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" + ABSOLUTE) + if(("${_sdkdir}" MATCHES "registry") OR (NOT EXISTS "${_sdkdir}")) + return() # not found + endif() + if(EXISTS "${_sdkdir}/Include/${_winkit_build}/um") + _winsdk_conditional_append("Windows Kits 10 (Build ${_winkit_build})" "${_winkit_build}" "${_sdkdir}") + endif() +endfunction() + +# Given a name for indentification purposes, the build number, and the associated package GUID, +# look in the registry under both HKLM and HKCU in \\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\ +# for that guid and the SDK it points to. +function(_winsdk_check_platformsdk_registry _platformsdkname _build _platformsdkguid) + foreach(_winsdk_hive HKEY_LOCAL_MACHINE HKEY_CURRENT_USER) + get_filename_component(_sdkdir + "[${_winsdk_hive}\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\${_platformsdkguid};Install Dir]" + ABSOLUTE) + _winsdk_conditional_append("${_platformsdkname} (${_build})" "${_build}" "${_sdkdir}") + endforeach() +endfunction() + +### +# Detect toolchain information: to know whether it's OK to use Vista+ only SDKs +### +set(_winsdk_vistaonly_ok OFF) +if(MSVC AND NOT _WINDOWSSDK_IGNOREMSVC) + # VC 10 and older has broad target support + if(MSVC_VERSION LESS 1700) + # VC 11 by default targets Vista and later only, so we can add a few more SDKs that (might?) only work on vista+ + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" MATCHES "_xp") + # This is the XP-compatible v110+ toolset + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v100" OR "${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v90") + # This is the VS2010/VS2008 toolset + else() + # OK, we're VC11 or newer and not using a backlevel or XP-compatible toolset. + # These versions have no XP (and possibly Vista pre-SP1) support + set(_winsdk_vistaonly_ok ON) + if(_WINDOWSSDK_ANNOUNCE AND NOT _WINDOWSSDK_VISTAONLY_PESTERED) + set(_WINDOWSSDK_VISTAONLY_PESTERED ON CACHE INTERNAL "" FORCE) + message(STATUS "FindWindowsSDK: Detected Visual Studio 2012 or newer, not using the _xp toolset variant: including SDK versions that drop XP support in search!") + endif() + endif() +endif() +if(_WINDOWSSDK_IGNOREMSVC) + set(_winsdk_vistaonly_ok ON) +endif() + +### +# MSVC version checks - keeps messy conditionals in one place +# (messy because of _WINDOWSSDK_IGNOREMSVC) +### +set(_winsdk_msvc_greater_1200 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1200))) + set(_winsdk_msvc_greater_1200 ON) +endif() +# Newer than VS .NET/VS Toolkit 2003 +set(_winsdk_msvc_greater_1310 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1310))) + set(_winsdk_msvc_greater_1310 ON) +endif() + +# VS2005/2008 +set(_winsdk_msvc_less_1600 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION LESS 1600))) + set(_winsdk_msvc_less_1600 ON) +endif() + +# VS2013+ +set(_winsdk_msvc_not_less_1800 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (NOT MSVC_VERSION LESS 1800))) + set(_winsdk_msvc_not_less_1800 ON) +endif() + +### +# START body of find module +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + ### + # Look for "preferred" SDKs + ### + + # Environment variable for SDK dir + if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL "")) + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") + endif() + + if(_winsdk_msvc_less_1600) + # Per-user current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") + + # System-wide current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") + endif() + + ### + # Begin the massive list of SDK searching! + ### + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # These require at least Visual Studio 2013 (VC12) + + _winsdk_check_microsoft_sdks_registry(v10.0A) + + # Windows Software Development Kit (SDK) for Windows 10 + # Several different versions living in the same directory - if nothing else we can assume RTM (10240) + _winsdk_check_microsoft_sdks_registry(v10.0 10.0.10240.0) + foreach(_win10build ${_winsdk_win10vers}) + _winsdk_check_win10_kits(${_win10build}) + endforeach() + endif() # vista-only and 2013+ + + # Included in Visual Studio 2013 + # Includes the v120_xp toolset + _winsdk_check_microsoft_sdks_registry(v8.1A 8.1.51636) + + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # Windows Software Development Kit (SDK) for Windows 8.1 + # http://msdn.microsoft.com/en-gb/windows/desktop/bg162891 + _winsdk_check_microsoft_sdks_registry(v8.1 8.1.25984.0) + _winsdk_check_windows_kits_registry("Windows Kits 8.1" 8.1.25984.0 KitsRoot81) + endif() # vista-only and 2013+ + + if(_winsdk_vistaonly_ok) + # Included in Visual Studio 2012 + _winsdk_check_microsoft_sdks_registry(v8.0A 8.0.50727) + + # Microsoft Windows SDK for Windows 8 and .NET Framework 4.5 + # This is the first version to also include the DirectX SDK + # http://msdn.microsoft.com/en-US/windows/desktop/hh852363.aspx + _winsdk_check_microsoft_sdks_registry(v8.0 6.2.9200.16384) + _winsdk_check_windows_kits_registry("Windows Kits 8.0" 6.2.9200.16384 KitsRoot) + endif() # vista-only + + # Included with VS 2012 Update 1 or later + # Introduces v110_xp toolset + _winsdk_check_microsoft_sdks_registry(v7.1A 7.1.51106) + if(_winsdk_vistaonly_ok) + # Microsoft Windows SDK for Windows 7 and .NET Framework 4 + # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b + _winsdk_check_microsoft_sdks_registry(v7.1 7.1.7600.0.30514) + endif() # vista-only + + # Included with VS 2010 + _winsdk_check_microsoft_sdks_registry(v7.0A 6.1.7600.16385) + + # Windows SDK for Windows 7 and .NET Framework 3.5 SP1 + # Works with VC9 + # http://www.microsoft.com/en-us/download/details.aspx?id=18950 + _winsdk_check_microsoft_sdks_registry(v7.0 6.1.7600.16385) + + # Two versions call themselves "v6.1": + # Older: + # Windows Vista Update & .NET 3.0 SDK + # http://www.microsoft.com/en-us/download/details.aspx?id=14477 + + # Newer: + # Windows Server 2008 & .NET 3.5 SDK + # may have broken VS9SP1? they recommend v7.0 instead, or a KB... + # http://www.microsoft.com/en-us/download/details.aspx?id=24826 + _winsdk_check_microsoft_sdks_registry(v6.1 6.1.6000.16384.10) + + # Included in VS 2008 + _winsdk_check_microsoft_sdks_registry(v6.0A 6.1.6723.1) + + # Microsoft Windows Software Development Kit for Windows Vista and .NET Framework 3.0 Runtime Components + # http://blogs.msdn.com/b/stanley/archive/2006/11/08/microsoft-windows-software-development-kit-for-windows-vista-and-net-framework-3-0-runtime-components.aspx + _winsdk_check_microsoft_sdks_registry(v6.0 6.0.6000.16384) +endif() + +# Let's not forget the Platform SDKs, which sometimes are useful! +if(_winsdk_msvc_greater_1200) + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 R2" "5.2.3790.2075.51" "D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1") + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 SP1" "5.2.3790.1830.15" "8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3") +endif() +### +# Finally, look for "preferred" SDKs +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + + + # Environment variable for SDK dir + if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL "")) + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") + endif() + + if(_winsdk_msvc_less_1600) + # Per-user current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") + + # System-wide current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") + endif() +endif() + + +function(windowssdk_name_lookup _dir _outvar) + list(FIND _win_sdk_versanddirs "${_dir}" _diridx) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_versanddirs ${_idx} _ret) + else() + set(_ret "NOTFOUND") + endif() + set(${_outvar} "${_ret}" PARENT_SCOPE) +endfunction() + +function(windowssdk_build_lookup _dir _outvar) + list(FIND _win_sdk_buildsanddirs "${_dir}" _diridx) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_buildsanddirs ${_idx} _ret) + else() + set(_ret "NOTFOUND") + endif() + set(${_outvar} "${_ret}" PARENT_SCOPE) +endfunction() + +# If we found something... +if(_win_sdk_dirs) + list(GET _win_sdk_dirs 0 WINDOWSSDK_LATEST_DIR) + windowssdk_name_lookup("${WINDOWSSDK_LATEST_DIR}" + WINDOWSSDK_LATEST_NAME) + set(WINDOWSSDK_DIRS ${_win_sdk_dirs}) + + # Fallback, in case no preference found. + set(WINDOWSSDK_PREFERRED_DIR "${WINDOWSSDK_LATEST_DIR}") + set(WINDOWSSDK_PREFERRED_NAME "${WINDOWSSDK_LATEST_NAME}") + set(WINDOWSSDK_PREFERRED_FIRST_DIRS ${WINDOWSSDK_DIRS}) + set(WINDOWSSDK_FOUND_PREFERENCE OFF) +endif() + +# If we found indications of a user preference... +if(_win_sdk_preferred_sdk_dirs) + list(GET _win_sdk_preferred_sdk_dirs 0 WINDOWSSDK_PREFERRED_DIR) + windowssdk_name_lookup("${WINDOWSSDK_PREFERRED_DIR}" + WINDOWSSDK_PREFERRED_NAME) + set(WINDOWSSDK_PREFERRED_FIRST_DIRS + ${_win_sdk_preferred_sdk_dirs} + ${_win_sdk_dirs}) + list(REMOVE_DUPLICATES WINDOWSSDK_PREFERRED_FIRST_DIRS) + set(WINDOWSSDK_FOUND_PREFERENCE ON) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WindowsSDK + "No compatible version of the Windows SDK or Platform SDK found." + WINDOWSSDK_DIRS) + +if(WINDOWSSDK_FOUND) + # Internal: Architecture-appropriate library directory names. + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # Only supported in Win10 SDK and up. + set(_winsdk_arch8 arm64) # what the WDK for Win8+ calls this architecture + else() + set(_winsdk_archbare /arm) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch arm) # what the architecture used to be called + set(_winsdk_arch8 arm) # what the WDK for Win8+ calls this architecture + endif() + else() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_winsdk_archbare /x64) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch amd64) # what the architecture used to be called + set(_winsdk_arch8 x64) # what the WDK for Win8+ calls this architecture + else() + set(_winsdk_archbare ) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch i386) # what the architecture used to be called + set(_winsdk_arch8 x86) # what the WDK for Win8+ calls this architecture + endif() + endif() + + function(get_windowssdk_from_component _component _var) + get_filename_component(_component "${_component}" ABSOLUTE) + file(TO_CMAKE_PATH "${_component}" _component) + foreach(_sdkdir ${WINDOWSSDK_DIRS}) + get_filename_component(_sdkdir "${_sdkdir}" ABSOLUTE) + string(LENGTH "${_sdkdir}" _sdklen) + file(RELATIVE_PATH _rel "${_sdkdir}" "${_component}") + # If we don't have any "parent directory" items... + if(NOT "${_rel}" MATCHES "[.][.]") + set(${_var} "${_sdkdir}" PARENT_SCOPE) + return() + endif() + endforeach() + # Fail. + set(${_var} "NOTFOUND" PARENT_SCOPE) + endfunction() + function(get_windowssdk_library_dirs _winsdk_dir _var) + set(_dirs) + set(_suffixes + "lib${_winsdk_archbare}" # SDKs like 7.1A + "lib/${_winsdk_arch}" # just because some SDKs have x86 dir and root dir + "lib/w2k/${_winsdk_arch}" # Win2k min requirement + "lib/wxp/${_winsdk_arch}" # WinXP min requirement + "lib/wnet/${_winsdk_arch}" # Win Server 2003 min requirement + "lib/wlh/${_winsdk_arch}" + "lib/wlh/um/${_winsdk_arch8}" # Win Vista ("Long Horn") min requirement + "lib/win7/${_winsdk_arch}" + "lib/win7/um/${_winsdk_arch8}" # Win 7 min requirement + ) + foreach(_ver + wlh # Win Vista ("Long Horn") min requirement + win7 # Win 7 min requirement + win8 # Win 8 min requirement + winv6.3 # Win 8.1 min requirement + ) + + list(APPEND _suffixes + "lib/${_ver}/${_winsdk_arch}" + "lib/${_ver}/um/${_winsdk_arch8}" + "lib/${_ver}/km/${_winsdk_arch8}" + ) + endforeach() + + # Look for WDF libraries in Win10+ SDK + foreach(_mode umdf kmdf) + file(GLOB _wdfdirs RELATIVE "${_winsdk_dir}" "${_winsdk_dir}/lib/wdf/${_mode}/${_winsdk_arch8}/*") + if(_wdfdirs) + list(APPEND _suffixes ${_wdfdirs}) + endif() + endforeach() + + # Look in each Win10+ SDK version for the components + foreach(_win10ver ${_winsdk_win10vers}) + foreach(_component um km ucrt mmos) + list(APPEND _suffixes "lib/${_win10ver}/${_component}/${_winsdk_arch8}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a library actually exists here. + file(GLOB _libs "${_winsdk_dir}/${_suffix}/*.lib") + if(_libs) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs _winsdk_dir _var) + set(_dirs) + + set(_subdirs shared um winrt km wdf mmos ucrt) + set(_suffixes Include) + + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_dir}") + endforeach() + + foreach(_ver ${_winsdk_win10vers}) + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_ver}/${_dir}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a header file actually exists here. + file(GLOB _headers "${_winsdk_dir}/${_suffix}/*.h") + if(_headers) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_library_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_library_dirs("${_sdkdir}" _current_sdk_libdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_libdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_include_dirs("${_sdkdir}" _current_sdk_incdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_incdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() +endif() diff --git a/Engine/lib/openal-soft/include/align.h b/Engine/lib/openal-soft/common/align.h similarity index 100% rename from Engine/lib/openal-soft/include/align.h rename to Engine/lib/openal-soft/common/align.h diff --git a/Engine/lib/openal-soft/common/almalloc.c b/Engine/lib/openal-soft/common/almalloc.c index 8c1c5794e..0d982ca19 100644 --- a/Engine/lib/openal-soft/common/almalloc.c +++ b/Engine/lib/openal-soft/common/almalloc.c @@ -10,8 +10,20 @@ #endif #ifdef HAVE_WINDOWS_H #include +#else +#include #endif + +#ifdef __GNUC__ +#define LIKELY(x) __builtin_expect(!!(x), !0) +#define UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define LIKELY(x) (!!(x)) +#define UNLIKELY(x) (!!(x)) +#endif + + void *al_malloc(size_t alignment, size_t size) { #if defined(HAVE_ALIGNED_ALLOC) @@ -60,3 +72,39 @@ void al_free(void *ptr) } #endif } + +size_t al_get_page_size(void) +{ + static size_t psize = 0; + if(UNLIKELY(!psize)) + { +#ifdef HAVE_SYSCONF +#if defined(_SC_PAGESIZE) + if(!psize) psize = sysconf(_SC_PAGESIZE); +#elif defined(_SC_PAGE_SIZE) + if(!psize) psize = sysconf(_SC_PAGE_SIZE); +#endif +#endif /* HAVE_SYSCONF */ +#ifdef _WIN32 + if(!psize) + { + SYSTEM_INFO sysinfo; + memset(&sysinfo, 0, sizeof(sysinfo)); + + GetSystemInfo(&sysinfo); + psize = sysinfo.dwPageSize; + } +#endif + if(!psize) psize = DEF_ALIGN; + } + return psize; +} + +int al_is_sane_alignment_allocator(void) +{ +#if defined(HAVE_ALIGNED_ALLOC) || defined(HAVE_POSIX_MEMALIGN) || defined(HAVE__ALIGNED_MALLOC) + return 1; +#else + return 0; +#endif +} diff --git a/Engine/lib/openal-soft/common/almalloc.h b/Engine/lib/openal-soft/common/almalloc.h new file mode 100644 index 000000000..a4297cf50 --- /dev/null +++ b/Engine/lib/openal-soft/common/almalloc.h @@ -0,0 +1,30 @@ +#ifndef AL_MALLOC_H +#define AL_MALLOC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Minimum alignment required by posix_memalign. */ +#define DEF_ALIGN sizeof(void*) + +void *al_malloc(size_t alignment, size_t size); +void *al_calloc(size_t alignment, size_t size); +void al_free(void *ptr); + +size_t al_get_page_size(void); + +/** + * Returns non-0 if the allocation function has direct alignment handling. + * Otherwise, the standard malloc is used with an over-allocation and pointer + * offset strategy. + */ +int al_is_sane_alignment_allocator(void); + +#ifdef __cplusplus +} +#endif + +#endif /* AL_MALLOC_H */ diff --git a/Engine/lib/openal-soft/common/atomic.h b/Engine/lib/openal-soft/common/atomic.h new file mode 100644 index 000000000..39daa1dc4 --- /dev/null +++ b/Engine/lib/openal-soft/common/atomic.h @@ -0,0 +1,439 @@ +#ifndef AL_ATOMIC_H +#define AL_ATOMIC_H + +#include "static_assert.h" +#include "bool.h" + +#ifdef __GNUC__ +/* This helps cast away the const-ness of a pointer without accidentally + * changing the pointer type. This is necessary due to Clang's inability to use + * atomic_load on a const _Atomic variable. + */ +#define CONST_CAST(T, V) __extension__({ \ + const T _tmp = (V); \ + (T)_tmp; \ +}) +#else +#define CONST_CAST(T, V) ((T)(V)) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Atomics using C11 */ +#ifdef HAVE_C11_ATOMIC + +#include + +#define almemory_order memory_order +#define almemory_order_relaxed memory_order_relaxed +#define almemory_order_consume memory_order_consume +#define almemory_order_acquire memory_order_acquire +#define almemory_order_release memory_order_release +#define almemory_order_acq_rel memory_order_acq_rel +#define almemory_order_seq_cst memory_order_seq_cst + +#define ATOMIC(T) T _Atomic +#define ATOMIC_FLAG atomic_flag + +#define ATOMIC_INIT atomic_init +#define ATOMIC_INIT_STATIC ATOMIC_VAR_INIT +/*#define ATOMIC_FLAG_INIT ATOMIC_FLAG_INIT*/ + +#define ATOMIC_LOAD atomic_load_explicit +#define ATOMIC_STORE atomic_store_explicit + +#define ATOMIC_ADD atomic_fetch_add_explicit +#define ATOMIC_SUB atomic_fetch_sub_explicit + +#define ATOMIC_EXCHANGE atomic_exchange_explicit +#define ATOMIC_COMPARE_EXCHANGE_STRONG atomic_compare_exchange_strong_explicit +#define ATOMIC_COMPARE_EXCHANGE_WEAK atomic_compare_exchange_weak_explicit + +#define ATOMIC_FLAG_TEST_AND_SET atomic_flag_test_and_set_explicit +#define ATOMIC_FLAG_CLEAR atomic_flag_clear_explicit + +#define ATOMIC_THREAD_FENCE atomic_thread_fence + +/* Atomics using GCC intrinsics */ +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__) + +enum almemory_order { + almemory_order_relaxed, + almemory_order_consume, + almemory_order_acquire, + almemory_order_release, + almemory_order_acq_rel, + almemory_order_seq_cst +}; + +#define ATOMIC(T) struct { T volatile value; } +#define ATOMIC_FLAG ATOMIC(int) + +#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) +#define ATOMIC_INIT_STATIC(_newval) {(_newval)} +#define ATOMIC_FLAG_INIT ATOMIC_INIT_STATIC(0) + +#define ATOMIC_LOAD(_val, _MO) __extension__({ \ + __typeof((_val)->value) _r = (_val)->value; \ + __asm__ __volatile__("" ::: "memory"); \ + _r; \ +}) +#define ATOMIC_STORE(_val, _newval, _MO) do { \ + __asm__ __volatile__("" ::: "memory"); \ + (_val)->value = (_newval); \ +} while(0) + +#define ATOMIC_ADD(_val, _incr, _MO) __sync_fetch_and_add(&(_val)->value, (_incr)) +#define ATOMIC_SUB(_val, _decr, _MO) __sync_fetch_and_sub(&(_val)->value, (_decr)) + +#define ATOMIC_EXCHANGE(_val, _newval, _MO) __extension__({ \ + __asm__ __volatile__("" ::: "memory"); \ + __sync_lock_test_and_set(&(_val)->value, (_newval)); \ +}) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, _MO1, _MO2) __extension__({ \ + __typeof(*(_oldval)) _o = *(_oldval); \ + *(_oldval) = __sync_val_compare_and_swap(&(_val)->value, _o, (_newval)); \ + *(_oldval) == _o; \ +}) + +#define ATOMIC_FLAG_TEST_AND_SET(_val, _MO) __extension__({ \ + __asm__ __volatile__("" ::: "memory"); \ + __sync_lock_test_and_set(&(_val)->value, 1); \ +}) +#define ATOMIC_FLAG_CLEAR(_val, _MO) __extension__({ \ + __sync_lock_release(&(_val)->value); \ + __asm__ __volatile__("" ::: "memory"); \ +}) + + +#define ATOMIC_THREAD_FENCE(order) do { \ + enum { must_be_constant = (order) }; \ + const int _o = must_be_constant; \ + if(_o > almemory_order_relaxed) \ + __asm__ __volatile__("" ::: "memory"); \ +} while(0) + +/* Atomics using x86/x86-64 GCC inline assembly */ +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + +#define WRAP_ADD(S, ret, dest, incr) __asm__ __volatile__( \ + "lock; xadd"S" %0,(%1)" \ + : "=r" (ret) \ + : "r" (dest), "0" (incr) \ + : "memory" \ +) +#define WRAP_SUB(S, ret, dest, decr) __asm__ __volatile__( \ + "lock; xadd"S" %0,(%1)" \ + : "=r" (ret) \ + : "r" (dest), "0" (-(decr)) \ + : "memory" \ +) + +#define WRAP_XCHG(S, ret, dest, newval) __asm__ __volatile__( \ + "lock; xchg"S" %0,(%1)" \ + : "=r" (ret) \ + : "r" (dest), "0" (newval) \ + : "memory" \ +) +#define WRAP_CMPXCHG(S, ret, dest, oldval, newval) __asm__ __volatile__( \ + "lock; cmpxchg"S" %2,(%1)" \ + : "=a" (ret) \ + : "r" (dest), "r" (newval), "0" (oldval) \ + : "memory" \ +) + + +enum almemory_order { + almemory_order_relaxed, + almemory_order_consume, + almemory_order_acquire, + almemory_order_release, + almemory_order_acq_rel, + almemory_order_seq_cst +}; + +#define ATOMIC(T) struct { T volatile value; } + +#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) +#define ATOMIC_INIT_STATIC(_newval) {(_newval)} + +#define ATOMIC_LOAD(_val, _MO) __extension__({ \ + __typeof((_val)->value) _r = (_val)->value; \ + __asm__ __volatile__("" ::: "memory"); \ + _r; \ +}) +#define ATOMIC_STORE(_val, _newval, _MO) do { \ + __asm__ __volatile__("" ::: "memory"); \ + (_val)->value = (_newval); \ +} while(0) + +#define ATOMIC_ADD(_val, _incr, _MO) __extension__({ \ + static_assert(sizeof((_val)->value)==4 || sizeof((_val)->value)==8, "Unsupported size!"); \ + __typeof((_val)->value) _r; \ + if(sizeof((_val)->value) == 4) WRAP_ADD("l", _r, &(_val)->value, _incr); \ + else if(sizeof((_val)->value) == 8) WRAP_ADD("q", _r, &(_val)->value, _incr); \ + _r; \ +}) +#define ATOMIC_SUB(_val, _decr, _MO) __extension__({ \ + static_assert(sizeof((_val)->value)==4 || sizeof((_val)->value)==8, "Unsupported size!"); \ + __typeof((_val)->value) _r; \ + if(sizeof((_val)->value) == 4) WRAP_SUB("l", _r, &(_val)->value, _decr); \ + else if(sizeof((_val)->value) == 8) WRAP_SUB("q", _r, &(_val)->value, _decr); \ + _r; \ +}) + +#define ATOMIC_EXCHANGE(_val, _newval, _MO) __extension__({ \ + __typeof((_val)->value) _r; \ + if(sizeof((_val)->value) == 4) WRAP_XCHG("l", _r, &(_val)->value, (_newval)); \ + else if(sizeof((_val)->value) == 8) WRAP_XCHG("q", _r, &(_val)->value, (_newval)); \ + _r; \ +}) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, _MO1, _MO2) __extension__({ \ + __typeof(*(_oldval)) _old = *(_oldval); \ + if(sizeof((_val)->value) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (_newval)); \ + else if(sizeof((_val)->value) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (_newval)); \ + *(_oldval) == _old; \ +}) + +#define ATOMIC_EXCHANGE_PTR(_val, _newval, _MO) __extension__({ \ + void *_r; \ + if(sizeof(void*) == 4) WRAP_XCHG("l", _r, &(_val)->value, (_newval)); \ + else if(sizeof(void*) == 8) WRAP_XCHG("q", _r, &(_val)->value, (_newval));\ + _r; \ +}) +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG(_val, _oldval, _newval, _MO1, _MO2) __extension__({ \ + void *_old = *(_oldval); \ + if(sizeof(void*) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (_newval)); \ + else if(sizeof(void*) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (_newval)); \ + *(_oldval) == _old; \ +}) + +#define ATOMIC_THREAD_FENCE(order) do { \ + enum { must_be_constant = (order) }; \ + const int _o = must_be_constant; \ + if(_o > almemory_order_relaxed) \ + __asm__ __volatile__("" ::: "memory"); \ +} while(0) + +/* Atomics using Windows methods */ +#elif defined(_WIN32) + +#define WIN32_LEAN_AND_MEAN +#include + +/* NOTE: This mess is *extremely* touchy. It lacks quite a bit of safety + * checking due to the lack of multi-statement expressions, typeof(), and C99 + * compound literals. It is incapable of properly exchanging floats, which get + * casted to LONG/int, and could cast away potential warnings. + * + * Unfortunately, it's the only semi-safe way that doesn't rely on C99 (because + * MSVC). + */ + +inline LONG AtomicAdd32(volatile LONG *dest, LONG incr) +{ + return InterlockedExchangeAdd(dest, incr); +} +inline LONGLONG AtomicAdd64(volatile LONGLONG *dest, LONGLONG incr) +{ + return InterlockedExchangeAdd64(dest, incr); +} +inline LONG AtomicSub32(volatile LONG *dest, LONG decr) +{ + return InterlockedExchangeAdd(dest, -decr); +} +inline LONGLONG AtomicSub64(volatile LONGLONG *dest, LONGLONG decr) +{ + return InterlockedExchangeAdd64(dest, -decr); +} + +inline LONG AtomicSwap32(volatile LONG *dest, LONG newval) +{ + return InterlockedExchange(dest, newval); +} +inline LONGLONG AtomicSwap64(volatile LONGLONG *dest, LONGLONG newval) +{ + return InterlockedExchange64(dest, newval); +} +inline void *AtomicSwapPtr(void *volatile *dest, void *newval) +{ + return InterlockedExchangePointer(dest, newval); +} + +inline bool CompareAndSwap32(volatile LONG *dest, LONG newval, LONG *oldval) +{ + LONG old = *oldval; + *oldval = InterlockedCompareExchange(dest, newval, *oldval); + return old == *oldval; +} +inline bool CompareAndSwap64(volatile LONGLONG *dest, LONGLONG newval, LONGLONG *oldval) +{ + LONGLONG old = *oldval; + *oldval = InterlockedCompareExchange64(dest, newval, *oldval); + return old == *oldval; +} +inline bool CompareAndSwapPtr(void *volatile *dest, void *newval, void **oldval) +{ + void *old = *oldval; + *oldval = InterlockedCompareExchangePointer(dest, newval, *oldval); + return old == *oldval; +} + +#define WRAP_ADDSUB(T, _func, _ptr, _amnt) _func((T volatile*)(_ptr), (_amnt)) +#define WRAP_XCHG(T, _func, _ptr, _newval) _func((T volatile*)(_ptr), (_newval)) +#define WRAP_CMPXCHG(T, _func, _ptr, _newval, _oldval) _func((T volatile*)(_ptr), (_newval), (T*)(_oldval)) + + +enum almemory_order { + almemory_order_relaxed, + almemory_order_consume, + almemory_order_acquire, + almemory_order_release, + almemory_order_acq_rel, + almemory_order_seq_cst +}; + +#define ATOMIC(T) struct { T volatile value; } + +#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) +#define ATOMIC_INIT_STATIC(_newval) {(_newval)} + +#define ATOMIC_LOAD(_val, _MO) ((_val)->value) +#define ATOMIC_STORE(_val, _newval, _MO) do { \ + (_val)->value = (_newval); \ +} while(0) + +int _al_invalid_atomic_size(); /* not defined */ +void *_al_invalid_atomic_ptr_size(); /* not defined */ + +#define ATOMIC_ADD(_val, _incr, _MO) \ + ((sizeof((_val)->value)==4) ? WRAP_ADDSUB(LONG, AtomicAdd32, &(_val)->value, (_incr)) : \ + (sizeof((_val)->value)==8) ? WRAP_ADDSUB(LONGLONG, AtomicAdd64, &(_val)->value, (_incr)) : \ + _al_invalid_atomic_size()) +#define ATOMIC_SUB(_val, _decr, _MO) \ + ((sizeof((_val)->value)==4) ? WRAP_ADDSUB(LONG, AtomicSub32, &(_val)->value, (_decr)) : \ + (sizeof((_val)->value)==8) ? WRAP_ADDSUB(LONGLONG, AtomicSub64, &(_val)->value, (_decr)) : \ + _al_invalid_atomic_size()) + +#define ATOMIC_EXCHANGE(_val, _newval, _MO) \ + ((sizeof((_val)->value)==4) ? WRAP_XCHG(LONG, AtomicSwap32, &(_val)->value, (_newval)) : \ + (sizeof((_val)->value)==8) ? WRAP_XCHG(LONGLONG, AtomicSwap64, &(_val)->value, (_newval)) : \ + (LONG)_al_invalid_atomic_size()) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, _MO1, _MO2) \ + ((sizeof((_val)->value)==4) ? WRAP_CMPXCHG(LONG, CompareAndSwap32, &(_val)->value, (_newval), (_oldval)) : \ + (sizeof((_val)->value)==8) ? WRAP_CMPXCHG(LONGLONG, CompareAndSwap64, &(_val)->value, (_newval), (_oldval)) : \ + (bool)_al_invalid_atomic_size()) + +#define ATOMIC_EXCHANGE_PTR(_val, _newval, _MO) \ + ((sizeof((_val)->value)==sizeof(void*)) ? AtomicSwapPtr((void*volatile*)&(_val)->value, (_newval)) : \ + _al_invalid_atomic_ptr_size()) +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG(_val, _oldval, _newval, _MO1, _MO2)\ + ((sizeof((_val)->value)==sizeof(void*)) ? CompareAndSwapPtr((void*volatile*)&(_val)->value, (_newval), (void**)(_oldval)) : \ + (bool)_al_invalid_atomic_size()) + +#define ATOMIC_THREAD_FENCE(order) do { \ + enum { must_be_constant = (order) }; \ + const int _o = must_be_constant; \ + if(_o > almemory_order_relaxed) \ + _ReadWriteBarrier(); \ +} while(0) + +#else + +#error "No atomic functions available on this platform!" + +#define ATOMIC(T) T + +#define ATOMIC_INIT(_val, _newval) ((void)0) +#define ATOMIC_INIT_STATIC(_newval) (0) + +#define ATOMIC_LOAD(...) (0) +#define ATOMIC_STORE(...) ((void)0) + +#define ATOMIC_ADD(...) (0) +#define ATOMIC_SUB(...) (0) + +#define ATOMIC_EXCHANGE(...) (0) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(...) (0) + +#define ATOMIC_THREAD_FENCE(...) ((void)0) +#endif + +/* If no PTR xchg variants are provided, the normal ones can handle it. */ +#ifndef ATOMIC_EXCHANGE_PTR +#define ATOMIC_EXCHANGE_PTR ATOMIC_EXCHANGE +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG ATOMIC_COMPARE_EXCHANGE_STRONG +#define ATOMIC_COMPARE_EXCHANGE_PTR_WEAK ATOMIC_COMPARE_EXCHANGE_WEAK +#endif + +/* If no weak cmpxchg is provided (not all systems will have one), substitute a + * strong cmpxchg. */ +#ifndef ATOMIC_COMPARE_EXCHANGE_WEAK +#define ATOMIC_COMPARE_EXCHANGE_WEAK ATOMIC_COMPARE_EXCHANGE_STRONG +#endif +#ifndef ATOMIC_COMPARE_EXCHANGE_PTR_WEAK +#define ATOMIC_COMPARE_EXCHANGE_PTR_WEAK ATOMIC_COMPARE_EXCHANGE_PTR_STRONG +#endif + +/* If no ATOMIC_FLAG is defined, simulate one with an atomic int using exchange + * and store ops. + */ +#ifndef ATOMIC_FLAG +#define ATOMIC_FLAG ATOMIC(int) +#define ATOMIC_FLAG_INIT ATOMIC_INIT_STATIC(0) +#define ATOMIC_FLAG_TEST_AND_SET(_val, _MO) ATOMIC_EXCHANGE(_val, 1, _MO) +#define ATOMIC_FLAG_CLEAR(_val, _MO) ATOMIC_STORE(_val, 0, _MO) +#endif + + +#define ATOMIC_LOAD_SEQ(_val) ATOMIC_LOAD(_val, almemory_order_seq_cst) +#define ATOMIC_STORE_SEQ(_val, _newval) ATOMIC_STORE(_val, _newval, almemory_order_seq_cst) + +#define ATOMIC_ADD_SEQ(_val, _incr) ATOMIC_ADD(_val, _incr, almemory_order_seq_cst) +#define ATOMIC_SUB_SEQ(_val, _decr) ATOMIC_SUB(_val, _decr, almemory_order_seq_cst) + +#define ATOMIC_EXCHANGE_SEQ(_val, _newval) ATOMIC_EXCHANGE(_val, _newval, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_WEAK(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) + +#define ATOMIC_EXCHANGE_PTR_SEQ(_val, _newval) ATOMIC_EXCHANGE_PTR(_val, _newval, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_PTR_STRONG(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) + + +typedef unsigned int uint; +typedef ATOMIC(uint) RefCount; + +inline void InitRef(RefCount *ptr, uint value) +{ ATOMIC_INIT(ptr, value); } +inline uint ReadRef(RefCount *ptr) +{ return ATOMIC_LOAD(ptr, almemory_order_acquire); } +inline uint IncrementRef(RefCount *ptr) +{ return ATOMIC_ADD(ptr, 1, almemory_order_acq_rel)+1; } +inline uint DecrementRef(RefCount *ptr) +{ return ATOMIC_SUB(ptr, 1, almemory_order_acq_rel)-1; } + + +/* WARNING: A livelock is theoretically possible if another thread keeps + * changing the head without giving this a chance to actually swap in the new + * one (practically impossible with this little code, but...). + */ +#define ATOMIC_REPLACE_HEAD(T, _head, _entry) do { \ + T _first = ATOMIC_LOAD(_head, almemory_order_acquire); \ + do { \ + ATOMIC_STORE(&(_entry)->next, _first, almemory_order_relaxed); \ + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(_head, &_first, _entry, \ + almemory_order_acq_rel, almemory_order_acquire) == 0); \ +} while(0) + +#ifdef __cplusplus +} +#endif + +#endif /* AL_ATOMIC_H */ diff --git a/Engine/lib/openal-soft/include/bool.h b/Engine/lib/openal-soft/common/bool.h similarity index 100% rename from Engine/lib/openal-soft/include/bool.h rename to Engine/lib/openal-soft/common/bool.h diff --git a/Engine/lib/openal-soft/common/math_defs.h b/Engine/lib/openal-soft/common/math_defs.h new file mode 100644 index 000000000..8ce93d0a9 --- /dev/null +++ b/Engine/lib/openal-soft/common/math_defs.h @@ -0,0 +1,46 @@ +#ifndef AL_MATH_DEFS_H +#define AL_MATH_DEFS_H + +#include +#ifdef HAVE_FLOAT_H +#include +#endif + +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + +#define F_PI (3.14159265358979323846f) +#define F_PI_2 (1.57079632679489661923f) +#define F_TAU (6.28318530717958647692f) + +#ifndef FLT_EPSILON +#define FLT_EPSILON (1.19209290e-07f) +#endif + +#ifndef HUGE_VALF +static const union msvc_inf_hack { + unsigned char b[4]; + float f; +} msvc_inf_union = {{ 0x00, 0x00, 0x80, 0x7F }}; +#define HUGE_VALF (msvc_inf_union.f) +#endif + +#ifndef HAVE_LOG2F +static inline float log2f(float f) +{ + return logf(f) / logf(2.0f); +} +#endif + +#ifndef HAVE_CBRTF +static inline float cbrtf(float f) +{ + return powf(f, 1.0f/3.0f); +} +#endif + +#define DEG2RAD(x) ((float)(x) * (F_PI/180.0f)) +#define RAD2DEG(x) ((float)(x) * (180.0f/F_PI)) + +#endif /* AL_MATH_DEFS_H */ diff --git a/Engine/lib/openal-soft/common/rwlock.c b/Engine/lib/openal-soft/common/rwlock.c index cfa3aee4e..67cf3acf0 100644 --- a/Engine/lib/openal-soft/common/rwlock.c +++ b/Engine/lib/openal-soft/common/rwlock.c @@ -11,26 +11,27 @@ /* A simple spinlock. Yield the thread while the given integer is set by * another. Could probably be improved... */ #define LOCK(l) do { \ - while(ATOMIC_EXCHANGE(int, &(l), true) == true) \ + while(ATOMIC_FLAG_TEST_AND_SET(&(l), almemory_order_acq_rel) == true) \ althrd_yield(); \ } while(0) -#define UNLOCK(l) ATOMIC_STORE(&(l), false) +#define UNLOCK(l) ATOMIC_FLAG_CLEAR(&(l), almemory_order_release) void RWLockInit(RWLock *lock) { InitRef(&lock->read_count, 0); InitRef(&lock->write_count, 0); - ATOMIC_INIT(&lock->read_lock, false); - ATOMIC_INIT(&lock->read_entry_lock, false); - ATOMIC_INIT(&lock->write_lock, false); + ATOMIC_FLAG_CLEAR(&lock->read_lock, almemory_order_relaxed); + ATOMIC_FLAG_CLEAR(&lock->read_entry_lock, almemory_order_relaxed); + ATOMIC_FLAG_CLEAR(&lock->write_lock, almemory_order_relaxed); } void ReadLock(RWLock *lock) { LOCK(lock->read_entry_lock); LOCK(lock->read_lock); - if(IncrementRef(&lock->read_count) == 1) + /* NOTE: ATOMIC_ADD returns the *old* value! */ + if(ATOMIC_ADD(&lock->read_count, 1, almemory_order_acq_rel) == 0) LOCK(lock->write_lock); UNLOCK(lock->read_lock); UNLOCK(lock->read_entry_lock); @@ -38,13 +39,14 @@ void ReadLock(RWLock *lock) void ReadUnlock(RWLock *lock) { - if(DecrementRef(&lock->read_count) == 0) + /* NOTE: ATOMIC_SUB returns the *old* value! */ + if(ATOMIC_SUB(&lock->read_count, 1, almemory_order_acq_rel) == 1) UNLOCK(lock->write_lock); } void WriteLock(RWLock *lock) { - if(IncrementRef(&lock->write_count) == 1) + if(ATOMIC_ADD(&lock->write_count, 1, almemory_order_acq_rel) == 0) LOCK(lock->read_lock); LOCK(lock->write_lock); } @@ -52,6 +54,6 @@ void WriteLock(RWLock *lock) void WriteUnlock(RWLock *lock) { UNLOCK(lock->write_lock); - if(DecrementRef(&lock->write_count) == 0) + if(ATOMIC_SUB(&lock->write_count, 1, almemory_order_acq_rel) == 1) UNLOCK(lock->read_lock); } diff --git a/Engine/lib/openal-soft/include/rwlock.h b/Engine/lib/openal-soft/common/rwlock.h similarity index 67% rename from Engine/lib/openal-soft/include/rwlock.h rename to Engine/lib/openal-soft/common/rwlock.h index 158a06708..8e36fa1a7 100644 --- a/Engine/lib/openal-soft/include/rwlock.h +++ b/Engine/lib/openal-soft/common/rwlock.h @@ -11,13 +11,12 @@ extern "C" { typedef struct { RefCount read_count; RefCount write_count; - ATOMIC(int) read_lock; - ATOMIC(int) read_entry_lock; - ATOMIC(int) write_lock; + ATOMIC_FLAG read_lock; + ATOMIC_FLAG read_entry_lock; + ATOMIC_FLAG write_lock; } RWLock; #define RWLOCK_STATIC_INITIALIZE { ATOMIC_INIT_STATIC(0), ATOMIC_INIT_STATIC(0), \ - ATOMIC_INIT_STATIC(false), ATOMIC_INIT_STATIC(false), \ - ATOMIC_INIT_STATIC(false) } + ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT } void RWLockInit(RWLock *lock); void ReadLock(RWLock *lock); diff --git a/Engine/lib/openal-soft/include/static_assert.h b/Engine/lib/openal-soft/common/static_assert.h similarity index 100% rename from Engine/lib/openal-soft/include/static_assert.h rename to Engine/lib/openal-soft/common/static_assert.h diff --git a/Engine/lib/openal-soft/common/threads.c b/Engine/lib/openal-soft/common/threads.c index 0a019d036..2655a2445 100644 --- a/Engine/lib/openal-soft/common/threads.c +++ b/Engine/lib/openal-soft/common/threads.c @@ -64,6 +64,22 @@ extern inline int altss_set(altss_t tss_id, void *val); #include +/* An associative map of uint:void* pairs. The key is the unique Thread ID and + * the value is the thread HANDLE. The thread ID is passed around as the + * althrd_t since there is only one ID per thread, whereas a thread may be + * referenced by multiple different HANDLEs. This map allows retrieving the + * original handle which is needed to join the thread and get its return value. + */ +static UIntMap ThrdIdHandle = UINTMAP_STATIC_INITIALIZE; + +/* An associative map of uint:void* pairs. The key is the TLS index (given by + * TlsAlloc), and the value is the altss_dtor_t callback. When a thread exits, + * we iterate over the TLS indices for their thread-local value and call the + * destructor function with it if they're both not NULL. + */ +static UIntMap TlsDestructors = UINTMAP_STATIC_INITIALIZE; + + void althrd_setname(althrd_t thr, const char *name) { #if defined(_MSC_VER) @@ -94,23 +110,6 @@ void althrd_setname(althrd_t thr, const char *name) } -static UIntMap ThrdIdHandle = UINTMAP_STATIC_INITIALIZE; - -static void NTAPI althrd_callback(void* UNUSED(handle), DWORD reason, void* UNUSED(reserved)) -{ - if(reason == DLL_PROCESS_DETACH) - ResetUIntMap(&ThrdIdHandle); -} -#ifdef _MSC_VER -#pragma section(".CRT$XLC",read) -__declspec(allocate(".CRT$XLC")) PIMAGE_TLS_CALLBACK althrd_callback_ = althrd_callback; -#elif defined(__GNUC__) -PIMAGE_TLS_CALLBACK althrd_callback_ __attribute__((section(".CRT$XLC"))) = althrd_callback; -#else -PIMAGE_TLS_CALLBACK althrd_callback_ = althrd_callback; -#endif - - typedef struct thread_cntr { althrd_start_t func; void *arg; @@ -208,12 +207,6 @@ void almtx_destroy(almtx_t *mtx) DeleteCriticalSection(mtx); } -int almtx_timedlock(almtx_t* UNUSED(mtx), const struct timespec* UNUSED(ts)) -{ - /* Windows CRITICAL_SECTIONs don't seem to have a timedlock method. */ - return althrd_error; -} - #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 int alcnd_init(alcnd_t *cond) { @@ -240,30 +233,6 @@ int alcnd_wait(alcnd_t *cond, almtx_t *mtx) return althrd_error; } -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point) -{ - struct timespec curtime; - DWORD sleeptime; - - if(altimespec_get(&curtime, AL_TIME_UTC) != AL_TIME_UTC) - return althrd_error; - - if(curtime.tv_sec > time_point->tv_sec || (curtime.tv_sec == time_point->tv_sec && - curtime.tv_nsec >= time_point->tv_nsec)) - { - if(SleepConditionVariableCS(cond, mtx, 0) != 0) - return althrd_success; - } - else - { - sleeptime = (time_point->tv_nsec - curtime.tv_nsec + 999999)/1000000; - sleeptime += (time_point->tv_sec - curtime.tv_sec)*1000; - if(SleepConditionVariableCS(cond, mtx, sleeptime) != 0) - return althrd_success; - } - return (GetLastError()==ERROR_TIMEOUT) ? althrd_timedout : althrd_error; -} - void alcnd_destroy(alcnd_t* UNUSED(cond)) { /* Nothing to delete? */ @@ -348,37 +317,6 @@ int alcnd_wait(alcnd_t *cond, almtx_t *mtx) return althrd_success; } -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point) -{ - _int_alcnd_t *icond = cond->Ptr; - struct timespec curtime; - DWORD sleeptime; - int res; - - if(altimespec_get(&curtime, AL_TIME_UTC) != AL_TIME_UTC) - return althrd_error; - - if(curtime.tv_sec > time_point->tv_sec || (curtime.tv_sec == time_point->tv_sec && - curtime.tv_nsec >= time_point->tv_nsec)) - sleeptime = 0; - else - { - sleeptime = (time_point->tv_nsec - curtime.tv_nsec + 999999)/1000000; - sleeptime += (time_point->tv_sec - curtime.tv_sec)*1000; - } - - IncrementRef(&icond->wait_count); - LeaveCriticalSection(mtx); - - res = WaitForMultipleObjects(2, icond->events, FALSE, sleeptime); - - if(DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST) - ResetEvent(icond->events[BROADCAST]); - EnterCriticalSection(mtx); - - return (res == WAIT_TIMEOUT) ? althrd_timedout : althrd_success; -} - void alcnd_destroy(alcnd_t *cond) { _int_alcnd_t *icond = cond->Ptr; @@ -389,46 +327,40 @@ void alcnd_destroy(alcnd_t *cond) #endif /* defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 */ -/* An associative map of uint:void* pairs. The key is the TLS index (given by - * TlsAlloc), and the value is the altss_dtor_t callback. When a thread exits, - * we iterate over the TLS indices for their thread-local value and call the - * destructor function with it if they're both not NULL. To avoid using - * DllMain, a PIMAGE_TLS_CALLBACK function pointer is placed in a ".CRT$XLx" - * section (where x is a character A to Z) which will be called by the CRT. - */ -static UIntMap TlsDestructors = UINTMAP_STATIC_INITIALIZE; - -static void NTAPI altss_callback(void* UNUSED(handle), DWORD reason, void* UNUSED(reserved)) +int alsem_init(alsem_t *sem, unsigned int initial) { - ALsizei i; - - if(reason == DLL_PROCESS_DETACH) - { - ResetUIntMap(&TlsDestructors); - return; - } - if(reason != DLL_THREAD_DETACH) - return; - - LockUIntMapRead(&TlsDestructors); - for(i = 0;i < TlsDestructors.size;i++) - { - void *ptr = altss_get(TlsDestructors.keys[i]); - altss_dtor_t callback = (altss_dtor_t)TlsDestructors.values[i]; - if(ptr && callback) - callback(ptr); - } - UnlockUIntMapRead(&TlsDestructors); + *sem = CreateSemaphore(NULL, initial, INT_MAX, NULL); + if(*sem != NULL) return althrd_success; + return althrd_error; } -#ifdef _MSC_VER -#pragma section(".CRT$XLB",read) -__declspec(allocate(".CRT$XLB")) PIMAGE_TLS_CALLBACK altss_callback_ = altss_callback; -#elif defined(__GNUC__) -PIMAGE_TLS_CALLBACK altss_callback_ __attribute__((section(".CRT$XLB"))) = altss_callback; -#else -#warning "No TLS callback support, thread-local contexts may leak references on poorly written applications." -PIMAGE_TLS_CALLBACK altss_callback_ = altss_callback; -#endif + +void alsem_destroy(alsem_t *sem) +{ + CloseHandle(*sem); +} + +int alsem_post(alsem_t *sem) +{ + DWORD ret = ReleaseSemaphore(*sem, 1, NULL); + if(ret) return althrd_success; + return althrd_error; +} + +int alsem_wait(alsem_t *sem) +{ + DWORD ret = WaitForSingleObject(*sem, INFINITE); + if(ret == WAIT_OBJECT_0) return althrd_success; + return althrd_error; +} + +int alsem_trywait(alsem_t *sem) +{ + DWORD ret = WaitForSingleObject(*sem, 0); + if(ret == WAIT_OBJECT_0) return althrd_success; + if(ret == WAIT_TIMEOUT) return althrd_busy; + return althrd_error; +} + int altss_create(altss_t *tss_id, altss_dtor_t callback) { @@ -480,6 +412,27 @@ void alcall_once(alonce_flag *once, void (*callback)(void)) InterlockedExchange(once, 2); } + +void althrd_deinit(void) +{ + ResetUIntMap(&ThrdIdHandle); + ResetUIntMap(&TlsDestructors); +} + +void althrd_thread_detach(void) +{ + ALsizei i; + + LockUIntMapRead(&TlsDestructors); + for(i = 0;i < TlsDestructors.size;i++) + { + void *ptr = altss_get(TlsDestructors.keys[i]); + altss_dtor_t callback = (altss_dtor_t)TlsDestructors.values[i]; + if(ptr && callback) callback(ptr); + } + UnlockUIntMapRead(&TlsDestructors); +} + #else #include @@ -493,6 +446,8 @@ void alcall_once(alonce_flag *once, void (*callback)(void)) extern inline int althrd_sleep(const struct timespec *ts, struct timespec *rem); extern inline void alcall_once(alonce_flag *once, void (*callback)(void)); +extern inline void althrd_deinit(void); +extern inline void althrd_thread_detach(void); void althrd_setname(althrd_t thr, const char *name) { @@ -500,6 +455,8 @@ void althrd_setname(althrd_t thr, const char *name) #if defined(PTHREAD_SETNAME_NP_ONE_PARAM) if(althrd_equal(thr, althrd_current())) pthread_setname_np(name); +#elif defined(PTHREAD_SETNAME_NP_THREE_PARAMS) + pthread_setname_np(thr, "%s", (void*)name); #else pthread_setname_np(thr, name); #endif @@ -602,15 +559,9 @@ int almtx_init(almtx_t *mtx, int type) int ret; if(!mtx) return althrd_error; -#ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK - if((type&~(almtx_recursive|almtx_timed)) != 0) - return althrd_error; -#else if((type&~almtx_recursive) != 0) return althrd_error; -#endif - type &= ~almtx_timed; if(type == almtx_plain) ret = pthread_mutex_init(mtx, NULL); else @@ -642,20 +593,6 @@ void almtx_destroy(almtx_t *mtx) pthread_mutex_destroy(mtx); } -int almtx_timedlock(almtx_t *mtx, const struct timespec *ts) -{ -#ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK - int ret = pthread_mutex_timedlock(mtx, ts); - switch(ret) - { - case 0: return althrd_success; - case ETIMEDOUT: return althrd_timedout; - case EBUSY: return althrd_busy; - } -#endif - return althrd_error; -} - int alcnd_init(alcnd_t *cond) { if(pthread_cond_init(cond, NULL) == 0) @@ -684,16 +621,44 @@ int alcnd_wait(alcnd_t *cond, almtx_t *mtx) return althrd_error; } -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point) +void alcnd_destroy(alcnd_t *cond) { - if(pthread_cond_timedwait(cond, mtx, time_point) == 0) + pthread_cond_destroy(cond); +} + + +int alsem_init(alsem_t *sem, unsigned int initial) +{ + if(sem_init(sem, 0, initial) == 0) return althrd_success; return althrd_error; } -void alcnd_destroy(alcnd_t *cond) +void alsem_destroy(alsem_t *sem) { - pthread_cond_destroy(cond); + sem_destroy(sem); +} + +int alsem_post(alsem_t *sem) +{ + if(sem_post(sem) == 0) + return althrd_success; + return althrd_error; +} + +int alsem_wait(alsem_t *sem) +{ + if(sem_wait(sem) == 0) return althrd_success; + if(errno == EINTR) return -2; + return althrd_error; +} + +int alsem_trywait(alsem_t *sem) +{ + if(sem_trywait(sem) == 0) return althrd_success; + if(errno == EWOULDBLOCK) return althrd_busy; + if(errno == EINTR) return -2; + return althrd_error; } diff --git a/Engine/lib/openal-soft/include/threads.h b/Engine/lib/openal-soft/common/threads.h similarity index 83% rename from Engine/lib/openal-soft/include/threads.h rename to Engine/lib/openal-soft/common/threads.h index c2848ee77..b0bebd8de 100644 --- a/Engine/lib/openal-soft/include/threads.h +++ b/Engine/lib/openal-soft/common/threads.h @@ -3,6 +3,16 @@ #include +#if defined(__GNUC__) && defined(__i386__) +/* force_align_arg_pointer is required for proper function arguments aligning + * when SSE code is used. Some systems (Windows, QNX) do not guarantee our + * thread functions will be properly aligned on the stack, even though GCC may + * generate code with the assumption that it is. */ +#define FORCE_ALIGN __attribute__((force_align_arg_pointer)) +#else +#define FORCE_ALIGN +#endif + #ifdef __cplusplus extern "C" { #endif @@ -18,7 +28,6 @@ enum { enum { almtx_plain = 0, almtx_recursive = 1, - almtx_timed = 2 }; typedef int (*althrd_start_t)(void*); @@ -47,6 +56,7 @@ typedef CONDITION_VARIABLE alcnd_t; #else typedef struct { void *Ptr; } alcnd_t; #endif +typedef HANDLE alsem_t; typedef DWORD altss_t; typedef LONG alonce_flag; @@ -55,6 +65,9 @@ typedef LONG alonce_flag; int althrd_sleep(const struct timespec *ts, struct timespec *rem); void alcall_once(alonce_flag *once, void (*callback)(void)); +void althrd_deinit(void); +void althrd_thread_detach(void); + inline althrd_t althrd_current(void) { @@ -117,11 +130,13 @@ inline int altss_set(altss_t tss_id, void *val) #include #include #include +#include typedef pthread_t althrd_t; typedef pthread_mutex_t almtx_t; typedef pthread_cond_t alcnd_t; +typedef sem_t alsem_t; typedef pthread_key_t altss_t; typedef pthread_once_t alonce_flag; @@ -204,6 +219,10 @@ inline void alcall_once(alonce_flag *once, void (*callback)(void)) pthread_once(once, callback); } + +inline void althrd_deinit(void) { } +inline void althrd_thread_detach(void) { } + #endif @@ -214,15 +233,19 @@ void althrd_setname(althrd_t thr, const char *name); int almtx_init(almtx_t *mtx, int type); void almtx_destroy(almtx_t *mtx); -int almtx_timedlock(almtx_t *mtx, const struct timespec *ts); int alcnd_init(alcnd_t *cond); int alcnd_signal(alcnd_t *cond); int alcnd_broadcast(alcnd_t *cond); int alcnd_wait(alcnd_t *cond, almtx_t *mtx); -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point); void alcnd_destroy(alcnd_t *cond); +int alsem_init(alsem_t *sem, unsigned int initial); +void alsem_destroy(alsem_t *sem); +int alsem_post(alsem_t *sem); +int alsem_wait(alsem_t *sem); +int alsem_trywait(alsem_t *sem); + int altss_create(altss_t *tss_id, altss_dtor_t callback); void altss_delete(altss_t tss_id); diff --git a/Engine/lib/openal-soft/common/uintmap.c b/Engine/lib/openal-soft/common/uintmap.c index d3b519236..18d52d64b 100644 --- a/Engine/lib/openal-soft/common/uintmap.c +++ b/Engine/lib/openal-soft/common/uintmap.c @@ -43,24 +43,23 @@ ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value) WriteLock(&map->lock); if(map->size > 0) { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; + ALsizei count = map->size; + do { + ALsizei step = count>>1; + ALsizei i = pos+step; + if(!(map->keys[i] < key)) + count = step; else - high = mid; - } - if(map->keys[low] < key) - low++; - pos = low; + { + pos = i+1; + count -= step+1; + } + } while(count > 0); } if(pos == map->size || map->keys[pos] != key) { - if(map->size == map->limit) + if(map->size >= map->limit) { WriteUnlock(&map->lock); return AL_OUT_OF_MEMORY; @@ -126,25 +125,28 @@ ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key) WriteLock(&map->lock); if(map->size > 0) { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; + ALsizei pos = 0; + ALsizei count = map->size; + do { + ALsizei step = count>>1; + ALsizei i = pos+step; + if(!(map->keys[i] < key)) + count = step; else - high = mid; - } - if(map->keys[low] == key) - { - ptr = map->values[low]; - if(low < map->size-1) { - memmove(&map->keys[low], &map->keys[low+1], - (map->size-1-low)*sizeof(map->keys[0])); - memmove(&map->values[low], &map->values[low+1], - (map->size-1-low)*sizeof(map->values[0])); + pos = i+1; + count -= step+1; + } + } while(count > 0); + if(pos < map->size && map->keys[pos] == key) + { + ptr = map->values[pos]; + if(pos < map->size-1) + { + memmove(&map->keys[pos], &map->keys[pos+1], + (map->size-1-pos)*sizeof(map->keys[0])); + memmove(&map->values[pos], &map->values[pos+1], + (map->size-1-pos)*sizeof(map->values[0])); } map->size--; } @@ -153,76 +155,28 @@ ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key) return ptr; } -ALvoid *RemoveUIntMapKeyNoLock(UIntMap *map, ALuint key) -{ - if(map->size > 0) - { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; - else - high = mid; - } - if(map->keys[low] == key) - { - ALvoid *ptr = map->values[low]; - if(low < map->size-1) - { - memmove(&map->keys[low], &map->keys[low+1], - (map->size-1-low)*sizeof(map->keys[0])); - memmove(&map->values[low], &map->values[low+1], - (map->size-1-low)*sizeof(map->values[0])); - } - map->size--; - return ptr; - } - } - return NULL; -} - ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key) { ALvoid *ptr = NULL; ReadLock(&map->lock); if(map->size > 0) { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; + ALsizei pos = 0; + ALsizei count = map->size; + do { + ALsizei step = count>>1; + ALsizei i = pos+step; + if(!(map->keys[i] < key)) + count = step; else - high = mid; - } - if(map->keys[low] == key) - ptr = map->values[low]; + { + pos = i+1; + count -= step+1; + } + } while(count > 0); + if(pos < map->size && map->keys[pos] == key) + ptr = map->values[pos]; } ReadUnlock(&map->lock); return ptr; } - -ALvoid *LookupUIntMapKeyNoLock(UIntMap *map, ALuint key) -{ - if(map->size > 0) - { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; - else - high = mid; - } - if(map->keys[low] == key) - return map->values[low]; - } - return NULL; -} diff --git a/Engine/lib/openal-soft/include/uintmap.h b/Engine/lib/openal-soft/common/uintmap.h similarity index 60% rename from Engine/lib/openal-soft/include/uintmap.h rename to Engine/lib/openal-soft/common/uintmap.h index acb2749af..32868653d 100644 --- a/Engine/lib/openal-soft/include/uintmap.h +++ b/Engine/lib/openal-soft/common/uintmap.h @@ -1,6 +1,8 @@ #ifndef AL_UINTMAP_H #define AL_UINTMAP_H +#include + #include "AL/al.h" #include "rwlock.h" @@ -19,24 +21,18 @@ typedef struct UIntMap { RWLock lock; } UIntMap; #define UINTMAP_STATIC_INITIALIZE_N(_n) { NULL, NULL, 0, 0, (_n), RWLOCK_STATIC_INITIALIZE } -#define UINTMAP_STATIC_INITIALIZE UINTMAP_STATIC_INITIALIZE_N(~0) +#define UINTMAP_STATIC_INITIALIZE UINTMAP_STATIC_INITIALIZE_N(INT_MAX) void InitUIntMap(UIntMap *map, ALsizei limit); void ResetUIntMap(UIntMap *map); ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key); -ALvoid *RemoveUIntMapKeyNoLock(UIntMap *map, ALuint key); ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); -ALvoid *LookupUIntMapKeyNoLock(UIntMap *map, ALuint key); -inline void LockUIntMapRead(UIntMap *map) -{ ReadLock(&map->lock); } -inline void UnlockUIntMapRead(UIntMap *map) -{ ReadUnlock(&map->lock); } -inline void LockUIntMapWrite(UIntMap *map) -{ WriteLock(&map->lock); } -inline void UnlockUIntMapWrite(UIntMap *map) -{ WriteUnlock(&map->lock); } +inline void LockUIntMapRead(UIntMap *map) { ReadLock(&map->lock); } +inline void UnlockUIntMapRead(UIntMap *map) { ReadUnlock(&map->lock); } +inline void LockUIntMapWrite(UIntMap *map) { WriteLock(&map->lock); } +inline void UnlockUIntMapWrite(UIntMap *map) { WriteUnlock(&map->lock); } #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/common/win_main_utf8.h b/Engine/lib/openal-soft/common/win_main_utf8.h new file mode 100644 index 000000000..faddc2579 --- /dev/null +++ b/Engine/lib/openal-soft/common/win_main_utf8.h @@ -0,0 +1,97 @@ +#ifndef WIN_MAIN_UTF8_H +#define WIN_MAIN_UTF8_H + +/* For Windows systems this provides a way to get UTF-8 encoded argv strings, + * and also overrides fopen to accept UTF-8 filenames. Working with wmain + * directly complicates cross-platform compatibility, while normal main() in + * Windows uses the current codepage (which has limited availability of + * characters). + * + * For MinGW, you must link with -municode + */ +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#include + +static FILE *my_fopen(const char *fname, const char *mode) +{ + WCHAR *wname=NULL, *wmode=NULL; + int namelen, modelen; + FILE *file = NULL; + errno_t err; + + namelen = MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0); + modelen = MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0); + + if(namelen <= 0 || modelen <= 0) + { + fprintf(stderr, "Failed to convert UTF-8 fname \"%s\", mode \"%s\"\n", fname, mode); + return NULL; + } + + wname = calloc(sizeof(WCHAR), namelen+modelen); + wmode = wname + namelen; + MultiByteToWideChar(CP_UTF8, 0, fname, -1, wname, namelen); + MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, modelen); + + err = _wfopen_s(&file, wname, wmode); + if(err) + { + errno = err; + file = NULL; + } + + free(wname); + + return file; +} +#define fopen my_fopen + + +static char **arglist; +static void cleanup_arglist(void) +{ + free(arglist); +} + +static void GetUnicodeArgs(int *argc, char ***argv) +{ + size_t total; + wchar_t **args; + int nargs, i; + + args = CommandLineToArgvW(GetCommandLineW(), &nargs); + if(!args) + { + fprintf(stderr, "Failed to get command line args: %ld\n", GetLastError()); + exit(EXIT_FAILURE); + } + + total = sizeof(**argv) * nargs; + for(i = 0;i < nargs;i++) + total += WideCharToMultiByte(CP_UTF8, 0, args[i], -1, NULL, 0, NULL, NULL); + + atexit(cleanup_arglist); + arglist = *argv = calloc(1, total); + (*argv)[0] = (char*)(*argv + nargs); + for(i = 0;i < nargs-1;i++) + { + int len = WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], 65535, NULL, NULL); + (*argv)[i+1] = (*argv)[i] + len; + } + WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], 65535, NULL, NULL); + *argc = nargs; + + LocalFree(args); +} +#define GET_UNICODE_ARGS(argc, argv) GetUnicodeArgs(argc, argv) + +#else + +/* Do nothing. */ +#define GET_UNICODE_ARGS(argc, argv) + +#endif + +#endif /* WIN_MAIN_UTF8_H */ diff --git a/Engine/lib/openal-soft/config.h.in b/Engine/lib/openal-soft/config.h.in index a06c2039a..1ff64fe47 100644 --- a/Engine/lib/openal-soft/config.h.in +++ b/Engine/lib/openal-soft/config.h.in @@ -2,18 +2,18 @@ #define AL_API ${EXPORT_DECL} #define ALC_API ${EXPORT_DECL} -/* Define to the library version */ -#define ALSOFT_VERSION "${LIB_VERSION}" - /* Define any available alignment declaration */ #define ALIGN(x) ${ALIGN_DECL} -/* Explicit hidden visibility attribute */ -#define HIDDEN_DECL ${HIDDEN_DECL} +/* Define a built-in call indicating an aligned data pointer */ +#define ASSUME_ALIGNED(x, y) ${ASSUME_ALIGNED_DECL} /* Define if HRTF data is embedded in the library */ #cmakedefine ALSOFT_EMBED_HRTF_DATA +/* Define if we have the sysconf function */ +#cmakedefine HAVE_SYSCONF + /* Define if we have the C11 aligned_alloc function */ #cmakedefine HAVE_ALIGNED_ALLOC @@ -23,6 +23,12 @@ /* Define if we have the _aligned_malloc function */ #cmakedefine HAVE__ALIGNED_MALLOC +/* Define if we have the proc_pidpath function */ +#cmakedefine HAVE_PROC_PIDPATH + +/* Define if we have the getopt function */ +#cmakedefine HAVE_GETOPT + /* Define if we have SSE CPU extensions */ #cmakedefine HAVE_SSE #cmakedefine HAVE_SSE2 @@ -47,8 +53,8 @@ /* Define if we have the QSA backend */ #cmakedefine HAVE_QSA -/* Define if we have the MMDevApi backend */ -#cmakedefine HAVE_MMDEVAPI +/* Define if we have the WASAPI backend */ +#cmakedefine HAVE_WASAPI /* Define if we have the DSound backend */ #cmakedefine HAVE_DSOUND @@ -74,6 +80,9 @@ /* Define if we have the Wave Writer backend */ #cmakedefine HAVE_WAVE +/* Define if we have the SDL2 backend */ +#cmakedefine HAVE_SDL2 + /* Define if we have the stat function */ #cmakedefine HAVE_STAT @@ -83,6 +92,12 @@ /* Define if we have the modff function */ #cmakedefine HAVE_MODFF +/* Define if we have the log2f function */ +#cmakedefine HAVE_LOG2F + +/* Define if we have the cbrtf function */ +#cmakedefine HAVE_CBRTF + /* Define if we have the strtof function */ #cmakedefine HAVE_STRTOF @@ -98,9 +113,6 @@ /* Define to the size of a long long int type */ #cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG} -/* Define if we have C99 variable-length array support */ -#cmakedefine HAVE_C99_VLA - /* Define if we have C99 _Bool support */ #cmakedefine HAVE_C99_BOOL @@ -137,9 +149,6 @@ /* Define if we have pthread_np.h */ #cmakedefine HAVE_PTHREAD_NP_H -/* Define if we have alloca.h */ -#cmakedefine HAVE_ALLOCA_H - /* Define if we have malloc.h */ #cmakedefine HAVE_MALLOC_H @@ -179,6 +188,12 @@ /* Define if we have the __cpuid() intrinsic */ #cmakedefine HAVE_CPUID_INTRINSIC +/* Define if we have the _BitScanForward64() intrinsic */ +#cmakedefine HAVE_BITSCANFORWARD64_INTRINSIC + +/* Define if we have the _BitScanForward() intrinsic */ +#cmakedefine HAVE_BITSCANFORWARD_INTRINSIC + /* Define if we have _controlfp() */ #cmakedefine HAVE__CONTROLFP @@ -194,6 +209,9 @@ /* Define if pthread_setname_np() only accepts one parameter */ #cmakedefine PTHREAD_SETNAME_NP_ONE_PARAM +/* Define if pthread_setname_np() accepts three parameters */ +#cmakedefine PTHREAD_SETNAME_NP_THREE_PARAMS + /* Define if we have pthread_set_name_np() */ #cmakedefine HAVE_PTHREAD_SET_NAME_NP diff --git a/Engine/lib/openal-soft/include/AL/alext.h b/Engine/lib/openal-soft/include/AL/alext.h index 0090c8041..cd7f2750d 100644 --- a/Engine/lib/openal-soft/include/AL/alext.h +++ b/Engine/lib/openal-soft/include/AL/alext.h @@ -97,6 +97,31 @@ extern "C" { #ifndef AL_EXT_MCFORMATS #define AL_EXT_MCFORMATS 1 +/* Provides support for surround sound buffer formats with 8, 16, and 32-bit + * samples. + * + * QUAD8: Unsigned 8-bit, Quadraphonic (Front Left, Front Right, Rear Left, + * Rear Right). + * QUAD16: Signed 16-bit, Quadraphonic. + * QUAD32: 32-bit float, Quadraphonic. + * REAR8: Unsigned 8-bit, Rear Stereo (Rear Left, Rear Right). + * REAR16: Signed 16-bit, Rear Stereo. + * REAR32: 32-bit float, Rear Stereo. + * 51CHN8: Unsigned 8-bit, 5.1 Surround (Front Left, Front Right, Front Center, + * LFE, Side Left, Side Right). Note that some audio systems may label + * 5.1's Side channels as Rear or Surround; they are equivalent for the + * purposes of this extension. + * 51CHN16: Signed 16-bit, 5.1 Surround. + * 51CHN32: 32-bit float, 5.1 Surround. + * 61CHN8: Unsigned 8-bit, 6.1 Surround (Front Left, Front Right, Front Center, + * LFE, Rear Center, Side Left, Side Right). + * 61CHN16: Signed 16-bit, 6.1 Surround. + * 61CHN32: 32-bit float, 6.1 Surround. + * 71CHN8: Unsigned 8-bit, 7.1 Surround (Front Left, Front Right, Front Center, + * LFE, Rear Left, Rear Right, Side Left, Side Right). + * 71CHN16: Signed 16-bit, 7.1 Surround. + * 71CHN32: 32-bit float, 7.1 Surround. + */ #define AL_FORMAT_QUAD8 0x1204 #define AL_FORMAT_QUAD16 0x1205 #define AL_FORMAT_QUAD32 0x1206 @@ -395,6 +420,16 @@ ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device); #ifndef AL_EXT_BFORMAT #define AL_EXT_BFORMAT 1 +/* Provides support for B-Format ambisonic buffers (first-order, FuMa scaling + * and layout). + * + * BFORMAT2D_8: Unsigned 8-bit, 3-channel non-periphonic (WXY). + * BFORMAT2D_16: Signed 16-bit, 3-channel non-periphonic (WXY). + * BFORMAT2D_FLOAT32: 32-bit float, 3-channel non-periphonic (WXY). + * BFORMAT3D_8: Unsigned 8-bit, 4-channel periphonic (WXYZ). + * BFORMAT3D_16: Signed 16-bit, 4-channel periphonic (WXYZ). + * BFORMAT3D_FLOAT32: 32-bit float, 4-channel periphonic (WXYZ). + */ #define AL_FORMAT_BFORMAT2D_8 0x20021 #define AL_FORMAT_BFORMAT2D_16 0x20022 #define AL_FORMAT_BFORMAT2D_FLOAT32 0x20023 @@ -436,6 +471,44 @@ ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCi #define AL_GAIN_LIMIT_SOFT 0x200E #endif +#ifndef AL_SOFT_source_resampler +#define AL_SOFT_source_resampler +#define AL_NUM_RESAMPLERS_SOFT 0x1210 +#define AL_DEFAULT_RESAMPLER_SOFT 0x1211 +#define AL_SOURCE_RESAMPLER_SOFT 0x1212 +#define AL_RESAMPLER_NAME_SOFT 0x1213 +typedef const ALchar* (AL_APIENTRY*LPALGETSTRINGISOFT)(ALenum pname, ALsizei index); +#ifdef AL_ALEXT_PROTOTYPES +AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index); +#endif +#endif + +#ifndef AL_SOFT_source_spatialize +#define AL_SOFT_source_spatialize +#define AL_SOURCE_SPATIALIZE_SOFT 0x1214 +#define AL_AUTO_SOFT 0x0002 +#endif + +#ifndef ALC_SOFT_output_limiter +#define ALC_SOFT_output_limiter +#define ALC_OUTPUT_LIMITER_SOFT 0x199A +#endif + +#ifndef ALC_SOFT_device_clock +#define ALC_SOFT_device_clock 1 +typedef int64_t ALCint64SOFT; +typedef uint64_t ALCuint64SOFT; +#define ALC_DEVICE_CLOCK_SOFT 0x1600 +#define ALC_DEVICE_LATENCY_SOFT 0x1601 +#define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602 +#define AL_SAMPLE_OFFSET_CLOCK_SOFT 0x1202 +#define AL_SEC_OFFSET_CLOCK_SOFT 0x1203 +typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); +#ifdef AL_ALEXT_PROTOTYPES +ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); +#endif +#endif + #ifdef __cplusplus } #endif diff --git a/Engine/lib/openal-soft/include/almalloc.h b/Engine/lib/openal-soft/include/almalloc.h deleted file mode 100644 index 355db7954..000000000 --- a/Engine/lib/openal-soft/include/almalloc.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef AL_MALLOC_H -#define AL_MALLOC_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void *al_malloc(size_t alignment, size_t size); -void *al_calloc(size_t alignment, size_t size); -void al_free(void *ptr); - -#ifdef __cplusplus -} -#endif - -#endif /* AL_MALLOC_H */ diff --git a/Engine/lib/openal-soft/include/atomic.h b/Engine/lib/openal-soft/include/atomic.h deleted file mode 100644 index 2a996625a..000000000 --- a/Engine/lib/openal-soft/include/atomic.h +++ /dev/null @@ -1,317 +0,0 @@ -#ifndef AL_ATOMIC_H -#define AL_ATOMIC_H - -#include "static_assert.h" -#include "bool.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Atomics using C11 */ -#ifdef HAVE_C11_ATOMIC - -#include - -#define almemory_order memory_order -#define almemory_order_relaxed memory_order_relaxed -#define almemory_order_consume memory_order_consume -#define almemory_order_acquire memory_order_acquire -#define almemory_order_release memory_order_release -#define almemory_order_acq_rel memory_order_acq_rel -#define almemory_order_seq_cst memory_order_seq_cst - -#define ATOMIC(T) T _Atomic - -#define ATOMIC_INIT(_val, _newval) atomic_init((_val), (_newval)) -#define ATOMIC_INIT_STATIC(_newval) ATOMIC_VAR_INIT(_newval) - -#define PARAM2(f, a, b, ...) (f((a), (b))) -#define PARAM3(f, a, b, c, ...) (f((a), (b), (c))) -#define PARAM5(f, a, b, c, d, e, ...) (f((a), (b), (c), (d), (e))) - -#define ATOMIC_LOAD(...) PARAM2(atomic_load_explicit, __VA_ARGS__, memory_order_seq_cst) -#define ATOMIC_STORE(...) PARAM3(atomic_store_explicit, __VA_ARGS__, memory_order_seq_cst) - -#define ATOMIC_ADD(T, ...) PARAM3(atomic_fetch_add_explicit, __VA_ARGS__, memory_order_seq_cst) -#define ATOMIC_SUB(T, ...) PARAM3(atomic_fetch_sub_explicit, __VA_ARGS__, memory_order_seq_cst) - -#define ATOMIC_EXCHANGE(T, ...) PARAM3(atomic_exchange_explicit, __VA_ARGS__, memory_order_seq_cst) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, ...) \ - PARAM5(atomic_compare_exchange_strong_explicit, __VA_ARGS__, memory_order_seq_cst, memory_order_seq_cst) -#define ATOMIC_COMPARE_EXCHANGE_WEAK(T, ...) \ - PARAM5(atomic_compare_exchange_weak_explicit, __VA_ARGS__, memory_order_seq_cst, memory_order_seq_cst) - -/* Atomics using GCC intrinsics */ -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__) - -enum almemory_order { - almemory_order_relaxed, - almemory_order_consume, - almemory_order_acquire, - almemory_order_release, - almemory_order_acq_rel, - almemory_order_seq_cst -}; - -#define ATOMIC(T) struct { T volatile value; } - -#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) -#define ATOMIC_INIT_STATIC(_newval) {(_newval)} - -#define ATOMIC_LOAD(_val, ...) __extension__({ \ - __typeof((_val)->value) _r = (_val)->value; \ - __asm__ __volatile__("" ::: "memory"); \ - _r; \ -}) -#define ATOMIC_STORE(_val, _newval, ...) do { \ - __asm__ __volatile__("" ::: "memory"); \ - (_val)->value = (_newval); \ -} while(0) - -#define ATOMIC_ADD(T, _val, _incr, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - __sync_fetch_and_add(&(_val)->value, (_incr)); \ -}) -#define ATOMIC_SUB(T, _val, _decr, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - __sync_fetch_and_sub(&(_val)->value, (_decr)); \ -}) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - __sync_lock_test_and_set(&(_val)->value, (_newval)); \ -}) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _o = *(_oldval); \ - *(_oldval) = __sync_val_compare_and_swap(&(_val)->value, _o, (_newval)); \ - *(_oldval) == _o; \ -}) - -/* Atomics using x86/x86-64 GCC inline assembly */ -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - -#define WRAP_ADD(ret, dest, incr) __asm__ __volatile__( \ - "lock; xaddl %0,(%1)" \ - : "=r" (ret) \ - : "r" (dest), "0" (incr) \ - : "memory" \ -) -#define WRAP_SUB(ret, dest, decr) __asm__ __volatile__( \ - "lock; xaddl %0,(%1)" \ - : "=r" (ret) \ - : "r" (dest), "0" (-(decr)) \ - : "memory" \ -) - -#define WRAP_XCHG(S, ret, dest, newval) __asm__ __volatile__( \ - "lock; xchg"S" %0,(%1)" \ - : "=r" (ret) \ - : "r" (dest), "0" (newval) \ - : "memory" \ -) -#define WRAP_CMPXCHG(S, ret, dest, oldval, newval) __asm__ __volatile__( \ - "lock; cmpxchg"S" %2,(%1)" \ - : "=a" (ret) \ - : "r" (dest), "r" (newval), "0" (oldval) \ - : "memory" \ -) - - -enum almemory_order { - almemory_order_relaxed, - almemory_order_consume, - almemory_order_acquire, - almemory_order_release, - almemory_order_acq_rel, - almemory_order_seq_cst -}; - -#define ATOMIC(T) struct { T volatile value; } - -#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) -#define ATOMIC_INIT_STATIC(_newval) {(_newval)} - -#define ATOMIC_LOAD(_val, ...) __extension__({ \ - __typeof((_val)->value) _r = (_val)->value; \ - __asm__ __volatile__("" ::: "memory"); \ - _r; \ -}) -#define ATOMIC_STORE(_val, _newval, ...) do { \ - __asm__ __volatile__("" ::: "memory"); \ - (_val)->value = (_newval); \ -} while(0) - -#define ATOMIC_ADD(T, _val, _incr, ...) __extension__({ \ - static_assert(sizeof(T)==4, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _r; \ - WRAP_ADD(_r, &(_val)->value, (T)(_incr)); \ - _r; \ -}) -#define ATOMIC_SUB(T, _val, _decr, ...) __extension__({ \ - static_assert(sizeof(T)==4, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _r; \ - WRAP_SUB(_r, &(_val)->value, (T)(_decr)); \ - _r; \ -}) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==4 || sizeof(T)==8, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _r; \ - if(sizeof(T) == 4) WRAP_XCHG("l", _r, &(_val)->value, (T)(_newval)); \ - else if(sizeof(T) == 8) WRAP_XCHG("q", _r, &(_val)->value, (T)(_newval)); \ - _r; \ -}) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==4 || sizeof(T)==8, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _old = *(_oldval); \ - if(sizeof(T) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (T)(_newval)); \ - else if(sizeof(T) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (T)(_newval)); \ - *(_oldval) == _old; \ -}) - -/* Atomics using Windows methods */ -#elif defined(_WIN32) - -#define WIN32_LEAN_AND_MEAN -#include - -/* NOTE: This mess is *extremely* noisy, at least on GCC. It works by wrapping - * Windows' 32-bit and 64-bit atomic methods, which are then casted to use the - * given type based on its size (e.g. int and float use 32-bit atomics). This - * is fine for the swap and compare-and-swap methods, although the add and - * subtract methods only work properly for integer types. - * - * Despite how noisy it is, it's unfortunately the only way that doesn't rely - * on C99 (damn MSVC). - */ - -inline LONG AtomicAdd32(volatile LONG *dest, LONG incr) -{ - return InterlockedExchangeAdd(dest, incr); -} -inline LONG AtomicSub32(volatile LONG *dest, LONG decr) -{ - return InterlockedExchangeAdd(dest, -decr); -} - -inline LONG AtomicSwap32(volatile LONG *dest, LONG newval) -{ - return InterlockedExchange(dest, newval); -} -inline LONGLONG AtomicSwap64(volatile LONGLONG *dest, LONGLONG newval) -{ - return InterlockedExchange64(dest, newval); -} - -inline bool CompareAndSwap32(volatile LONG *dest, LONG newval, LONG *oldval) -{ - LONG old = *oldval; - *oldval = InterlockedCompareExchange(dest, newval, *oldval); - return old == *oldval; -} -inline bool CompareAndSwap64(volatile LONGLONG *dest, LONGLONG newval, LONGLONG *oldval) -{ - LONGLONG old = *oldval; - *oldval = InterlockedCompareExchange64(dest, newval, *oldval); - return old == *oldval; -} - -#define WRAP_ADDSUB(T, _func, _ptr, _amnt) ((T(*)(T volatile*,T))_func)((_ptr), (_amnt)) -#define WRAP_XCHG(T, _func, _ptr, _newval) ((T(*)(T volatile*,T))_func)((_ptr), (_newval)) -#define WRAP_CMPXCHG(T, _func, _ptr, _newval, _oldval) ((bool(*)(T volatile*,T,T*))_func)((_ptr), (_newval), (_oldval)) - - -enum almemory_order { - almemory_order_relaxed, - almemory_order_consume, - almemory_order_acquire, - almemory_order_release, - almemory_order_acq_rel, - almemory_order_seq_cst -}; - -#define ATOMIC(T) struct { T volatile value; } - -#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) -#define ATOMIC_INIT_STATIC(_newval) {(_newval)} - -#define ATOMIC_LOAD(_val, ...) ((_val)->value) -#define ATOMIC_STORE(_val, _newval, ...) do { \ - (_val)->value = (_newval); \ -} while(0) - -int _al_invalid_atomic_size(); /* not defined */ - -#define ATOMIC_ADD(T, _val, _incr, ...) \ - ((sizeof(T)==4) ? WRAP_ADDSUB(T, AtomicAdd32, &(_val)->value, (_incr)) : \ - (T)_al_invalid_atomic_size()) -#define ATOMIC_SUB(T, _val, _decr, ...) \ - ((sizeof(T)==4) ? WRAP_ADDSUB(T, AtomicSub32, &(_val)->value, (_decr)) : \ - (T)_al_invalid_atomic_size()) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) \ - ((sizeof(T)==4) ? WRAP_XCHG(T, AtomicSwap32, &(_val)->value, (_newval)) : \ - (sizeof(T)==8) ? WRAP_XCHG(T, AtomicSwap64, &(_val)->value, (_newval)) : \ - (T)_al_invalid_atomic_size()) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) \ - ((sizeof(T)==4) ? WRAP_CMPXCHG(T, CompareAndSwap32, &(_val)->value, (_newval), (_oldval)) : \ - (sizeof(T)==8) ? WRAP_CMPXCHG(T, CompareAndSwap64, &(_val)->value, (_newval), (_oldval)) : \ - (bool)_al_invalid_atomic_size()) - -#else - -#error "No atomic functions available on this platform!" - -#define ATOMIC(T) T - -#define ATOMIC_INIT_STATIC(_newval) (0) - -#define ATOMIC_LOAD_UNSAFE(_val) (0) -#define ATOMIC_STORE_UNSAFE(_val, _newval) ((void)0) - -#define ATOMIC_LOAD(_val, ...) (0) -#define ATOMIC_STORE(_val, _newval, ...) ((void)0) - -#define ATOMIC_ADD(T, _val, _incr, ...) (0) -#define ATOMIC_SUB(T, _val, _decr, ...) (0) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) (0) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) (0) -#endif - -/* If no weak cmpxchg is provided (not all systems will have one), substitute a - * strong cmpxchg. */ -#ifndef ATOMIC_COMPARE_EXCHANGE_WEAK -#define ATOMIC_COMPARE_EXCHANGE_WEAK ATOMIC_COMPARE_EXCHANGE_STRONG -#endif - - -typedef unsigned int uint; -typedef ATOMIC(uint) RefCount; - -inline void InitRef(RefCount *ptr, uint value) -{ ATOMIC_INIT(ptr, value); } -inline uint ReadRef(RefCount *ptr) -{ return ATOMIC_LOAD(ptr); } -inline uint IncrementRef(RefCount *ptr) -{ return ATOMIC_ADD(uint, ptr, 1)+1; } -inline uint DecrementRef(RefCount *ptr) -{ return ATOMIC_SUB(uint, ptr, 1)-1; } - - -/* This is *NOT* atomic, but is a handy utility macro to compare-and-swap non- - * atomic variables. */ -#define COMPARE_EXCHANGE(_val, _oldval, _newval) ((*(_val) == *(_oldval)) ? ((*(_val)=(_newval)),true) : ((*(_oldval)=*(_val)),false)) - - -#ifdef __cplusplus -} -#endif - -#endif /* AL_ATOMIC_H */ diff --git a/Engine/lib/openal-soft/include/math_defs.h b/Engine/lib/openal-soft/include/math_defs.h deleted file mode 100644 index 149cf80ba..000000000 --- a/Engine/lib/openal-soft/include/math_defs.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef AL_MATH_DEFS_H -#define AL_MATH_DEFS_H - -#ifdef HAVE_FLOAT_H -#include -#endif - -#define F_PI (3.14159265358979323846f) -#define F_PI_2 (1.57079632679489661923f) -#define F_TAU (6.28318530717958647692f) - -#ifndef FLT_EPSILON -#define FLT_EPSILON (1.19209290e-07f) -#endif - -#define DEG2RAD(x) ((ALfloat)(x) * (F_PI/180.0f)) -#define RAD2DEG(x) ((ALfloat)(x) * (180.0f/F_PI)) - -#endif /* AL_MATH_DEFS_H */ diff --git a/Engine/lib/openal-soft/native-tools/CMakeLists.txt b/Engine/lib/openal-soft/native-tools/CMakeLists.txt new file mode 100644 index 000000000..5e816bba7 --- /dev/null +++ b/Engine/lib/openal-soft/native-tools/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.0.2) + +project(native-tools) + +include(CheckLibraryExists) + +set(CPP_DEFS ) +if(WIN32) + set(CPP_DEFS ${CPP_DEFS} _WIN32) +endif(WIN32) + +check_library_exists(m pow "" HAVE_LIBM) + +add_executable(bin2h bin2h.c) +# Enforce no dressing for executable names, so the main script can find it +set_target_properties(bin2h PROPERTIES OUTPUT_NAME bin2h) +# Avoid configuration-dependent subdirectories while building with Visual Studio +set_target_properties(bin2h PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}") +set_target_properties(bin2h PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}") +target_compile_definitions(bin2h PRIVATE ${CPP_DEFS}) + +add_executable(bsincgen bsincgen.c) +set_target_properties(bsincgen PROPERTIES OUTPUT_NAME bsincgen) +set_target_properties(bsincgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}") +set_target_properties(bsincgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}") +target_compile_definitions(bsincgen PRIVATE ${CPP_DEFS}) +if(HAVE_LIBM) + target_link_libraries(bsincgen m) +endif(HAVE_LIBM) diff --git a/Engine/lib/openal-soft/native-tools/bin2h.c b/Engine/lib/openal-soft/native-tools/bin2h.c new file mode 100644 index 000000000..92f2b8a51 --- /dev/null +++ b/Engine/lib/openal-soft/native-tools/bin2h.c @@ -0,0 +1,100 @@ + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + char* input_name; + FILE* input_file; + + char* output_name; + FILE* output_file; + + char* variable_name; + + if (4 != argc) + { + puts("Usage: bin2h [input] [output] [variable]"); + return EXIT_FAILURE; + } + + input_name = argv[1]; + output_name = argv[2]; + variable_name = argv[3]; + + input_file = fopen(input_name, "rb"); + + if (NULL == input_file) + { + printf("Could not open input file '%s': %s\n", input_name, strerror(errno)); + return EXIT_FAILURE; + } + + output_file = fopen(output_name, "w"); + + if (NULL == output_file) + { + printf("Could not open output file '%s': %s\n", output_name, strerror(errno)); + return EXIT_FAILURE; + } + + if (fprintf(output_file, "static const unsigned char %s[] = {", variable_name) < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + while (0 == feof(input_file)) + { + unsigned char buffer[4096]; + size_t i, count = fread(buffer, 1, sizeof(buffer), input_file); + + if (sizeof(buffer) != count) + { + if (0 == feof(input_file) || 0 != ferror(input_file)) + { + printf("Could not read from input file '%s': %s\n", input_name, strerror(ferror(input_file))); + return EXIT_FAILURE; + } + } + + for (i = 0; i < count; ++i) + { + if ((i & 15) == 0) + { + if (fprintf(output_file, "\n ") < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + } + + if (fprintf(output_file, "0x%2.2x, ", buffer[i]) < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + } + } + + if (fprintf(output_file, "\n};\n") < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + if (fclose(output_file) < 0) + { + printf("Could not close output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Engine/lib/openal-soft/native-tools/bsincgen.c b/Engine/lib/openal-soft/native-tools/bsincgen.c new file mode 100644 index 000000000..7edf37f14 --- /dev/null +++ b/Engine/lib/openal-soft/native-tools/bsincgen.c @@ -0,0 +1,367 @@ +/* + * Sinc interpolator coefficient and delta generator for the OpenAL Soft + * cross platform audio library. + * + * Copyright (C) 2015 by Christopher Fitzgerald. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Or visit: http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html + * + * -------------------------------------------------------------------------- + * + * This is a modified version of the bandlimited windowed sinc interpolator + * algorithm presented here: + * + * Smith, J.O. "Windowed Sinc Interpolation", in + * Physical Audio Signal Processing, + * https://ccrma.stanford.edu/~jos/pasp/Windowed_Sinc_Interpolation.html, + * online book, + * accessed October 2012. + */ + +#define _UNICODE +#include +#include +#include +#include + +#include "../common/win_main_utf8.h" + + +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + +#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)) +#define log2(x) (log(x) / log(2.0)) +#endif + +/* Same as in alu.h! */ +#define FRACTIONBITS (12) +#define FRACTIONONE (1<= b) ? a : b; } + +/* NOTE: This is the normalized (instead of just sin(x)/x) cardinal sine + * function. + * 2 f_t sinc(2 f_t x) + * f_t -- normalized transition frequency (0.5 is nyquist) + * x -- sample index (-N to N) + */ +static double Sinc(const double x) +{ + if(fabs(x) < 1e-15) + return 1.0; + return sin(M_PI * x) / (M_PI * x); +} + +static double BesselI_0(const double x) +{ + double term, sum, last_sum, x2, y; + int i; + + term = 1.0; + sum = 1.0; + x2 = x / 2.0; + i = 1; + + do { + y = x2 / i; + i++; + last_sum = sum; + term *= y * y; + sum += term; + } while(sum != last_sum); + + return sum; +} + +/* NOTE: k is assumed normalized (-1 to 1) + * beta is equivalent to 2 alpha + */ +static double Kaiser(const double b, const double k) +{ + if(!(k >= -1.0 && k <= 1.0)) + return 0.0; + return BesselI_0(b * sqrt(1.0 - k*k)) / BesselI_0(b); +} + +/* Calculates the (normalized frequency) transition width of the Kaiser window. + * Rejection is in dB. + */ +static double CalcKaiserWidth(const double rejection, const int order) +{ + double w_t = 2.0 * M_PI; + + if(rejection > 21.0) + return (rejection - 7.95) / (order * 2.285 * w_t); + /* This enforces a minimum rejection of just above 21.18dB */ + return 5.79 / (order * w_t); +} + +static double CalcKaiserBeta(const double rejection) +{ + if(rejection > 50.0) + return 0.1102 * (rejection - 8.7); + else if(rejection >= 21.0) + return (0.5842 * pow(rejection - 21.0, 0.4)) + + (0.07886 * (rejection - 21.0)); + return 0.0; +} + +/* Generates the coefficient, delta, and index tables required by the bsinc resampler */ +static void BsiGenerateTables(FILE *output, const char *tabname, const double rejection, const int order) +{ + static double filter[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT + 1][BSINC_POINTS_MAX]; + static double scDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT ][BSINC_POINTS_MAX]; + static double phDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT + 1][BSINC_POINTS_MAX]; + static double spDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT ][BSINC_POINTS_MAX]; + static int mt[BSINC_SCALE_COUNT]; + static double at[BSINC_SCALE_COUNT]; + const int num_points_min = order + 1; + double width, beta, scaleBase, scaleRange; + int si, pi, i; + + memset(filter, 0, sizeof(filter)); + memset(scDeltas, 0, sizeof(scDeltas)); + memset(phDeltas, 0, sizeof(phDeltas)); + memset(spDeltas, 0, sizeof(spDeltas)); + + /* Calculate windowing parameters. The width describes the transition + band, but it may vary due to the linear interpolation between scales + of the filter. + */ + width = CalcKaiserWidth(rejection, order); + beta = CalcKaiserBeta(rejection); + scaleBase = width / 2.0; + scaleRange = 1.0 - scaleBase; + + // Determine filter scaling. + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const double scale = scaleBase + (scaleRange * si / (BSINC_SCALE_COUNT - 1)); + const double a = MinDouble(floor(num_points_min / (2.0 * scale)), num_points_min); + const int m = 2 * (int)a; + + mt[si] = m; + at[si] = a; + } + + /* Calculate the Kaiser-windowed Sinc filter coefficients for each scale + and phase. + */ + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + const int l = (m / 2) - 1; + const double a = at[si]; + const double scale = scaleBase + (scaleRange * si / (BSINC_SCALE_COUNT - 1)); + const double cutoff = (0.5 * scale) - (scaleBase * MaxDouble(0.5, scale)); + + for(pi = 0; pi <= BSINC_PHASE_COUNT; pi++) + { + const double phase = l + ((double)pi / BSINC_PHASE_COUNT); + + for(i = 0; i < m; i++) + { + const double x = i - phase; + filter[si][pi][o + i] = Kaiser(beta, x / a) * 2.0 * cutoff * Sinc(2.0 * cutoff * x); + } + } + } + + /* Linear interpolation between scales is simplified by pre-calculating + the delta (b - a) in: x = a + f (b - a) + + Given a difference in points between scales, the destination points + will be 0, thus: x = a + f (-a) + */ + for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + for(i = 0; i < m; i++) + scDeltas[si][pi][o + i] = filter[si + 1][pi][o + i] - filter[si][pi][o + i]; + } + } + + // Linear interpolation between phases is also simplified. + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + for(i = 0; i < m; i++) + phDeltas[si][pi][o + i] = filter[si][pi + 1][o + i] - filter[si][pi][o + i]; + } + } + + /* This last simplification is done to complete the bilinear equation for + the combination of scale and phase. + */ + for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + for(i = 0; i < m; i++) + spDeltas[si][pi][o + i] = phDeltas[si + 1][pi][o + i] - phDeltas[si][pi][o + i]; + } + } + + // Make sure the number of points is a multiple of 4 (for SIMD). + for(si = 0; si < BSINC_SCALE_COUNT; si++) + mt[si] = (mt[si]+3) & ~3; + + fprintf(output, +"/* This %d%s order filter has a rejection of -%.0fdB, yielding a transition width\n" +" * of ~%.3f (normalized frequency). Order increases when downsampling to a\n" +" * limit of one octave, after which the quality of the filter (transition\n" +" * width) suffers to reduce the CPU cost. The bandlimiting will cut all sound\n" +" * after downsampling by ~%.2f octaves.\n" +" */\n" +"const BSincTable %s = {\n", + order, (((order%100)/10) == 1) ? "th" : + ((order%10) == 1) ? "st" : + ((order%10) == 2) ? "nd" : + ((order%10) == 3) ? "rd" : "th", + rejection, width, log2(1.0/scaleBase), tabname); + + /* The scaleBase is calculated from the Kaiser window transition width. + It represents the absolute limit to the filter before it fully cuts + the signal. The limit in octaves can be calculated by taking the + base-2 logarithm of its inverse: log_2(1 / scaleBase) + */ + fprintf(output, " /* scaleBase */ %.9ef, /* scaleRange */ %.9ef,\n", scaleBase, 1.0 / scaleRange); + + fprintf(output, " /* m */ {"); + fprintf(output, " %d", mt[0]); + for(si = 1; si < BSINC_SCALE_COUNT; si++) + fprintf(output, ", %d", mt[si]); + fprintf(output, " },\n"); + + fprintf(output, " /* filterOffset */ {"); + fprintf(output, " %d", 0); + i = mt[0]*4*BSINC_PHASE_COUNT; + for(si = 1; si < BSINC_SCALE_COUNT; si++) + { + fprintf(output, ", %d", i); + i += mt[si]*4*BSINC_PHASE_COUNT; + } + + fprintf(output, " },\n"); + + // Calculate the table size. + i = 0; + for(si = 0; si < BSINC_SCALE_COUNT; si++) + i += 4 * BSINC_PHASE_COUNT * mt[si]; + + fprintf(output, "\n /* Tab (%d entries) */ {\n", i); + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + fprintf(output, " /* %2d,%2d (%d) */", si, pi, m); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", filter[si][pi][o + i]); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", scDeltas[si][pi][o + i]); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", phDeltas[si][pi][o + i]); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", spDeltas[si][pi][o + i]); + fprintf(output, "\n"); + } + } + fprintf(output, " }\n};\n\n"); +} + + +int main(int argc, char *argv[]) +{ + FILE *output; + + GET_UNICODE_ARGS(&argc, &argv); + + if(argc > 2) + { + fprintf(stderr, "Usage: %s [output file]\n", argv[0]); + return 1; + } + + if(argc == 2) + { + output = fopen(argv[1], "wb"); + if(!output) + { + fprintf(stderr, "Failed to open %s for writing\n", argv[1]); + return 1; + } + } + else + output = stdout; + + fprintf(output, "/* Generated by bsincgen, do not edit! */\n\n" +"static_assert(BSINC_SCALE_COUNT == %d, \"Unexpected BSINC_SCALE_COUNT value!\");\n" +"static_assert(BSINC_PHASE_COUNT == %d, \"Unexpected BSINC_PHASE_COUNT value!\");\n" +"static_assert(FRACTIONONE == %d, \"Unexpected FRACTIONONE value!\");\n\n" +"typedef struct BSincTable {\n" +" const float scaleBase, scaleRange;\n" +" const int m[BSINC_SCALE_COUNT];\n" +" const int filterOffset[BSINC_SCALE_COUNT];\n" +" alignas(16) const float Tab[];\n" +"} BSincTable;\n\n", BSINC_SCALE_COUNT, BSINC_PHASE_COUNT, FRACTIONONE); + /* A 23rd order filter with a -60dB drop at nyquist. */ + BsiGenerateTables(output, "bsinc24", 60.0, 23); + /* An 11th order filter with a -40dB drop at nyquist. */ + BsiGenerateTables(output, "bsinc12", 40.0, 11); + + if(output != stdout) + fclose(output); + output = NULL; + + return 0; +} diff --git a/Engine/lib/openal-soft/openal.pc.in b/Engine/lib/openal-soft/openal.pc.in index 8bdd4f3b1..dfa6f5738 100644 --- a/Engine/lib/openal-soft/openal.pc.in +++ b/Engine/lib/openal-soft/openal.pc.in @@ -8,4 +8,5 @@ Description: OpenAL is a cross-platform 3D audio API Requires: @PKG_CONFIG_REQUIRES@ Version: @PACKAGE_VERSION@ Libs: -L${libdir} -l@LIBNAME@ @PKG_CONFIG_LIBS@ +Libs.private:@PKG_CONFIG_PRIVATE_LIBS@ Cflags: -I${includedir} -I${includedir}/AL @PKG_CONFIG_CFLAGS@ diff --git a/Engine/lib/openal-soft/version.cmake b/Engine/lib/openal-soft/version.cmake new file mode 100644 index 000000000..af7ff0a67 --- /dev/null +++ b/Engine/lib/openal-soft/version.cmake @@ -0,0 +1,11 @@ +EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE +) +EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} log -1 --format=%h + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE +) +CONFIGURE_FILE(${SRC} ${DST}) diff --git a/Engine/lib/openal-soft/version.h.in b/Engine/lib/openal-soft/version.h.in new file mode 100644 index 000000000..56f738a39 --- /dev/null +++ b/Engine/lib/openal-soft/version.h.in @@ -0,0 +1,8 @@ +/* Define to the library version */ +#define ALSOFT_VERSION "${LIB_VERSION}" + +/* Define the branch being built */ +#define ALSOFT_GIT_BRANCH "${GIT_BRANCH}" + +/* Define the hash of the head commit */ +#define ALSOFT_GIT_COMMIT_HASH "${GIT_COMMIT_HASH}" diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index d746913fb..07d56a9b9 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -118,6 +118,14 @@ if(TORQUE_SFX_OPENAL) mark_as_advanced(COREAUDIO_FRAMEWORK) mark_as_advanced(CMAKE_DEBUG_POSTFIX) mark_as_advanced(FORCE_STATIC_VCRT) + mark_as_advanced(ALSOFT_BACKEND_WASAPI) + mark_as_advanced(ALSOFT_BUILD_ROUTER) + mark_as_advanced(ALSOFT_REQUIRE_SDL2) + mark_as_advanced(ALSOFT_REQUIRE_WASAPI) + #the following is from openal-soft + mark_as_advanced(SDL2MAIN_LIBRARY) + mark_as_advanced(SDL2_CORE_LIBRARY) + mark_as_advanced(SDL2_INCLUDE_DIR) endif() mark_as_advanced(TORQUE_SFX_OPENAL) From 4a5d63dc9bc6f642e9f36448d01164e7ee6181b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Monta=C3=B1=C3=A9s=20Garc=C3=ADa?= Date: Wed, 9 May 2018 13:49:58 +0200 Subject: [PATCH 289/312] It's almost imposible to change direction of wind. Reseting mCurrentTarget will allow to rotate properly. --- Engine/source/forest/forestWindEmitter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/forest/forestWindEmitter.cpp b/Engine/source/forest/forestWindEmitter.cpp index 46b879214..5d710bfe6 100644 --- a/Engine/source/forest/forestWindEmitter.cpp +++ b/Engine/source/forest/forestWindEmitter.cpp @@ -179,6 +179,7 @@ void ForestWind::setStrengthAndDirection( F32 strength, const VectorF &direction { mStrength = strength; mDirection = direction; + mCurrentTarget.zero(); mIsDirty = true; } } From ec8f56b3b0c27088953d610edba6e41b3fc788e1 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 9 May 2018 23:09:05 +1000 Subject: [PATCH 290/312] sdl 2.0.8 update --- Engine/lib/sdl/Android.mk | 30 +- Engine/lib/sdl/BUGS.txt | 4 +- Engine/lib/sdl/CMakeLists.txt | 359 +- Engine/lib/sdl/COPYING.txt | 2 +- Engine/lib/sdl/INSTALL.txt | 6 +- Engine/lib/sdl/Makefile.in | 25 +- Engine/lib/sdl/Makefile.pandora | 4 +- Engine/lib/sdl/README-SDL.txt | 2 +- Engine/lib/sdl/README.txt | 2 +- Engine/lib/sdl/SDL2.spec | 2 +- Engine/lib/sdl/SDL2Config.cmake | 1 + Engine/lib/sdl/WhatsNew.txt | 131 + Engine/lib/sdl/Xcode/SDL/Info-Framework.plist | 28 - .../Xcode/SDL/SDL.xcodeproj/project.pbxproj | 3004 --- Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info | 15 - .../SDL/pkg-support/resources/License.txt | 19 - .../SDL/pkg-support/resources/ReadMe.txt | 32 - .../SDL/pkg-support/resources/SDL_DS_Store | Bin 15364 -> 0 bytes .../sdl/Xcode/SDL/pkg-support/sdl_logo.pdf | Bin 163800 -> 0 bytes .../SDLTest/SDLTest.xcodeproj/project.pbxproj | 4882 ----- .../sdl/Xcode/SDLTest/TestDropFile-Info.plist | 35 - Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile | 1558 -- Engine/lib/sdl/acinclude/libtool.m4 | 5 +- Engine/lib/sdl/autogen.sh | 4 +- Engine/lib/sdl/build-scripts/androidbuild.sh | 91 +- .../lib/sdl/build-scripts/androidbuildlibs.sh | 74 + .../lib/sdl/build-scripts/checker-buildbot.sh | 24 +- Engine/lib/sdl/build-scripts/config.guess | 514 +- Engine/lib/sdl/build-scripts/config.sub | 177 +- Engine/lib/sdl/build-scripts/config.sub.patch | 72 + .../sdl/build-scripts/emscripten-buildbot.sh | 8 +- Engine/lib/sdl/build-scripts/iosbuild.sh | 429 +- Engine/lib/sdl/build-scripts/ltmain.sh | 6 +- Engine/lib/sdl/build-scripts/nacl-buildbot.sh | 6 +- .../lib/sdl/build-scripts/update-copyright.sh | 5 +- .../build-scripts/windows-buildbot-zipper.bat | 13 +- Engine/lib/sdl/build-scripts/winrtbuild.ps1 | 20 +- Engine/lib/sdl/cmake/sdlchecks.cmake | 130 +- Engine/lib/sdl/cmake_uninstall.cmake.in | 8 +- Engine/lib/sdl/configure | 1191 +- Engine/lib/sdl/configure.in | 743 +- Engine/lib/sdl/debian/changelog | 24 + Engine/lib/sdl/debian/control | 2 +- Engine/lib/sdl/debian/copyright | 12 +- Engine/lib/sdl/debian/libsdl2-dev.install | 7 +- Engine/lib/sdl/include/SDL.h | 11 +- Engine/lib/sdl/include/SDL_assert.h | 20 +- Engine/lib/sdl/include/SDL_atomic.h | 25 +- Engine/lib/sdl/include/SDL_audio.h | 175 +- Engine/lib/sdl/include/SDL_bits.h | 25 +- Engine/lib/sdl/include/SDL_blendmode.h | 67 +- Engine/lib/sdl/include/SDL_clipboard.h | 8 +- Engine/lib/sdl/include/SDL_config.h | 12 +- Engine/lib/sdl/include/SDL_config.h.cmake | 135 +- Engine/lib/sdl/include/SDL_config.h.in | 132 +- Engine/lib/sdl/include/SDL_config_android.h | 55 +- Engine/lib/sdl/include/SDL_config_iphoneos.h | 61 +- Engine/lib/sdl/include/SDL_config_macosx.h | 76 +- Engine/lib/sdl/include/SDL_config_minimal.h | 9 +- Engine/lib/sdl/include/SDL_config_pandora.h | 37 +- Engine/lib/sdl/include/SDL_config_psp.h | 42 +- Engine/lib/sdl/include/SDL_config_windows.h | 87 +- Engine/lib/sdl/include/SDL_config_winrt.h | 88 +- Engine/lib/sdl/include/SDL_config_wiz.h | 82 +- Engine/lib/sdl/include/SDL_copying.h | 2 +- Engine/lib/sdl/include/SDL_cpuinfo.h | 42 +- Engine/lib/sdl/include/SDL_egl.h | 6 +- Engine/lib/sdl/include/SDL_endian.h | 29 +- Engine/lib/sdl/include/SDL_error.h | 8 +- Engine/lib/sdl/include/SDL_events.h | 62 +- Engine/lib/sdl/include/SDL_filesystem.h | 8 +- Engine/lib/sdl/include/SDL_gamecontroller.h | 65 +- Engine/lib/sdl/include/SDL_gesture.h | 8 +- Engine/lib/sdl/include/SDL_haptic.h | 44 +- Engine/lib/sdl/include/SDL_hints.h | 267 +- Engine/lib/sdl/include/SDL_joystick.h | 131 +- Engine/lib/sdl/include/SDL_keyboard.h | 8 +- Engine/lib/sdl/include/SDL_keycode.h | 18 +- Engine/lib/sdl/include/SDL_loadso.h | 8 +- Engine/lib/sdl/include/SDL_log.h | 10 +- Engine/lib/sdl/include/SDL_main.h | 19 +- Engine/lib/sdl/include/SDL_messagebox.h | 8 +- Engine/lib/sdl/include/SDL_mouse.h | 10 +- Engine/lib/sdl/include/SDL_mutex.h | 8 +- Engine/lib/sdl/include/SDL_name.h | 8 +- Engine/lib/sdl/include/SDL_opengl.h | 15 +- Engine/lib/sdl/include/SDL_opengles.h | 2 +- Engine/lib/sdl/include/SDL_opengles2.h | 2 +- Engine/lib/sdl/include/SDL_pixels.h | 12 +- Engine/lib/sdl/include/SDL_platform.h | 43 +- Engine/lib/sdl/include/SDL_power.h | 8 +- Engine/lib/sdl/include/SDL_quit.h | 8 +- Engine/lib/sdl/include/SDL_rect.h | 8 +- Engine/lib/sdl/include/SDL_render.h | 38 +- Engine/lib/sdl/include/SDL_revision.h | 4 +- Engine/lib/sdl/include/SDL_rwops.h | 43 +- Engine/lib/sdl/include/SDL_scancode.h | 22 +- Engine/lib/sdl/include/SDL_shape.h | 17 +- Engine/lib/sdl/include/SDL_stdinc.h | 94 +- Engine/lib/sdl/include/SDL_surface.h | 45 +- Engine/lib/sdl/include/SDL_system.h | 49 +- Engine/lib/sdl/include/SDL_syswm.h | 31 +- Engine/lib/sdl/include/SDL_test.h | 25 +- Engine/lib/sdl/include/SDL_test_assert.h | 14 +- Engine/lib/sdl/include/SDL_test_common.h | 8 +- Engine/lib/sdl/include/SDL_test_compare.h | 8 +- Engine/lib/sdl/include/SDL_test_crc32.h | 10 +- Engine/lib/sdl/include/SDL_test_font.h | 17 +- Engine/lib/sdl/include/SDL_test_fuzzer.h | 36 +- Engine/lib/sdl/include/SDL_test_harness.h | 19 +- Engine/lib/sdl/include/SDL_test_images.h | 30 +- Engine/lib/sdl/include/SDL_test_log.h | 8 +- Engine/lib/sdl/include/SDL_test_md5.h | 8 +- Engine/lib/sdl/include/SDL_test_memory.h | 63 + Engine/lib/sdl/include/SDL_test_random.h | 8 +- Engine/lib/sdl/include/SDL_thread.h | 51 +- Engine/lib/sdl/include/SDL_timer.h | 8 +- Engine/lib/sdl/include/SDL_touch.h | 8 +- Engine/lib/sdl/include/SDL_types.h | 2 +- Engine/lib/sdl/include/SDL_version.h | 10 +- Engine/lib/sdl/include/SDL_video.h | 63 +- Engine/lib/sdl/include/SDL_vulkan.h | 273 + Engine/lib/sdl/include/begin_code.h | 25 +- Engine/lib/sdl/include/close_code.h | 4 +- Engine/lib/sdl/src/SDL.c | 15 +- Engine/lib/sdl/src/SDL_assert.c | 85 +- Engine/lib/sdl/src/SDL_assert_c.h | 2 +- Engine/lib/sdl/src/SDL_dataqueue.c | 339 + Engine/lib/sdl/src/SDL_dataqueue.h | 55 + Engine/lib/sdl/src/SDL_error.c | 165 +- Engine/lib/sdl/src/SDL_error_c.h | 9 +- Engine/lib/sdl/src/SDL_hints.c | 4 +- Engine/lib/sdl/src/SDL_internal.h | 22 +- Engine/lib/sdl/src/SDL_log.c | 28 +- Engine/lib/sdl/src/atomic/SDL_atomic.c | 101 +- Engine/lib/sdl/src/atomic/SDL_spinlock.c | 19 +- Engine/lib/sdl/src/audio/SDL_audio.c | 651 +- Engine/lib/sdl/src/audio/SDL_audio_c.h | 65 +- Engine/lib/sdl/src/audio/SDL_audiocvt.c | 2308 ++- Engine/lib/sdl/src/audio/SDL_audiodev.c | 7 +- Engine/lib/sdl/src/audio/SDL_audiodev_c.h | 2 +- Engine/lib/sdl/src/audio/SDL_audiotypecvt.c | 16418 +--------------- Engine/lib/sdl/src/audio/SDL_mixer.c | 2 +- Engine/lib/sdl/src/audio/SDL_sysaudio.h | 86 +- Engine/lib/sdl/src/audio/SDL_wave.c | 72 +- Engine/lib/sdl/src/audio/SDL_wave.h | 12 +- .../lib/sdl/src/audio/alsa/SDL_alsa_audio.c | 143 +- .../lib/sdl/src/audio/alsa/SDL_alsa_audio.h | 11 +- .../sdl/src/audio/android/SDL_androidaudio.c | 6 +- .../sdl/src/audio/android/SDL_androidaudio.h | 11 +- Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c | 2 +- Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h | 11 +- .../sdl/src/audio/coreaudio/SDL_coreaudio.h | 11 +- .../sdl/src/audio/coreaudio/SDL_coreaudio.m | 108 +- .../src/audio/directsound/SDL_directsound.c | 7 +- .../src/audio/directsound/SDL_directsound.h | 8 +- Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c | 14 +- Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h | 8 +- Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c | 2 +- Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h | 8 +- .../lib/sdl/src/audio/dummy/SDL_dummyaudio.c | 2 +- .../lib/sdl/src/audio/dummy/SDL_dummyaudio.h | 8 +- .../audio/emscripten/SDL_emscriptenaudio.c | 212 +- .../audio/emscripten/SDL_emscriptenaudio.h | 16 +- Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c | 2 +- Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h | 9 +- .../sdl/src/audio/fusionsound/SDL_fsaudio.c | 2 +- .../sdl/src/audio/fusionsound/SDL_fsaudio.h | 9 +- .../lib/sdl/src/audio/haiku/SDL_haikuaudio.cc | 48 +- .../lib/sdl/src/audio/haiku/SDL_haikuaudio.h | 8 +- Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c | 429 + Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h | 42 + Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c | 58 +- Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h | 10 +- Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c | 4 +- Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h | 8 +- .../SDL_netbsdaudio.c} | 66 +- .../SDL_netbsdaudio.h} | 13 +- Engine/lib/sdl/src/audio/paudio/SDL_paudio.c | 43 +- Engine/lib/sdl/src/audio/paudio/SDL_paudio.h | 11 +- Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c | 3 +- Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h | 12 +- .../sdl/src/audio/pulseaudio/SDL_pulseaudio.c | 28 +- .../sdl/src/audio/pulseaudio/SDL_pulseaudio.h | 8 +- Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c | 159 +- Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h | 2 +- Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl | 761 - .../lib/sdl/src/audio/sndio/SDL_sndioaudio.c | 75 +- .../lib/sdl/src/audio/sndio/SDL_sndioaudio.h | 12 +- Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c | 18 +- Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h | 8 +- Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c | 779 + Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h | 85 + .../sdl/src/audio/wasapi/SDL_wasapi_win32.c | 417 + .../sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp | 276 + Engine/lib/sdl/src/audio/winmm/SDL_winmm.c | 36 +- Engine/lib/sdl/src/audio/winmm/SDL_winmm.h | 8 +- .../lib/sdl/src/audio/xaudio2/SDL_xaudio2.c | 503 - .../lib/sdl/src/audio/xaudio2/SDL_xaudio2.h | 386 - .../xaudio2/SDL_xaudio2_winrthelpers.cpp | 90 - .../audio/xaudio2/SDL_xaudio2_winrthelpers.h | 70 - Engine/lib/sdl/src/core/android/SDL_android.c | 925 +- Engine/lib/sdl/src/core/android/SDL_android.h | 24 +- .../lib/sdl/src/core/android/keyinfotable.h | 175 + Engine/lib/sdl/src/core/linux/SDL_dbus.c | 252 +- Engine/lib/sdl/src/core/linux/SDL_dbus.h | 23 +- Engine/lib/sdl/src/core/linux/SDL_evdev.c | 311 +- Engine/lib/sdl/src/core/linux/SDL_evdev.h | 8 +- Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c | 677 + Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h | 29 + .../linux/SDL_evdev_kbd_default_accents.h | 284 + .../core/linux/SDL_evdev_kbd_default_keymap.h | 4763 +++++ Engine/lib/sdl/src/core/linux/SDL_fcitx.c | 260 +- Engine/lib/sdl/src/core/linux/SDL_fcitx.h | 10 +- Engine/lib/sdl/src/core/linux/SDL_ibus.c | 164 +- Engine/lib/sdl/src/core/linux/SDL_ibus.h | 10 +- Engine/lib/sdl/src/core/linux/SDL_ime.c | 20 +- Engine/lib/sdl/src/core/linux/SDL_ime.h | 18 +- Engine/lib/sdl/src/core/linux/SDL_udev.c | 44 +- Engine/lib/sdl/src/core/linux/SDL_udev.h | 10 +- Engine/lib/sdl/src/core/unix/SDL_poll.c | 87 + Engine/lib/sdl/src/core/unix/SDL_poll.h | 34 + Engine/lib/sdl/src/core/windows/SDL_directx.h | 8 +- Engine/lib/sdl/src/core/windows/SDL_windows.c | 31 +- Engine/lib/sdl/src/core/windows/SDL_windows.h | 12 +- Engine/lib/sdl/src/core/windows/SDL_xinput.c | 2 +- Engine/lib/sdl/src/core/windows/SDL_xinput.h | 13 +- .../src/core/winrt/SDL_winrtapp_common.cpp | 31 +- .../sdl/src/core/winrt/SDL_winrtapp_common.h | 8 +- .../src/core/winrt/SDL_winrtapp_direct3d.cpp | 8 +- .../src/core/winrt/SDL_winrtapp_direct3d.h | 2 +- .../sdl/src/core/winrt/SDL_winrtapp_xaml.cpp | 2 +- .../sdl/src/core/winrt/SDL_winrtapp_xaml.h | 8 +- Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c | 348 +- Engine/lib/sdl/src/dynapi/SDL_dynapi.c | 68 +- Engine/lib/sdl/src/dynapi/SDL_dynapi.h | 6 +- .../lib/sdl/src/dynapi/SDL_dynapi_overrides.h | 71 +- Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h | 81 +- Engine/lib/sdl/src/dynapi/gendynapi.pl | 2 +- .../lib/sdl/src/events/SDL_clipboardevents.c | 2 +- .../sdl/src/events/SDL_clipboardevents_c.h | 8 +- Engine/lib/sdl/src/events/SDL_dropevents.c | 2 +- Engine/lib/sdl/src/events/SDL_dropevents_c.h | 8 +- Engine/lib/sdl/src/events/SDL_events.c | 422 +- Engine/lib/sdl/src/events/SDL_events_c.h | 6 +- Engine/lib/sdl/src/events/SDL_gesture.c | 40 +- Engine/lib/sdl/src/events/SDL_gesture_c.h | 11 +- Engine/lib/sdl/src/events/SDL_keyboard.c | 39 +- Engine/lib/sdl/src/events/SDL_keyboard_c.h | 8 +- Engine/lib/sdl/src/events/SDL_mouse.c | 149 +- Engine/lib/sdl/src/events/SDL_mouse_c.h | 18 +- Engine/lib/sdl/src/events/SDL_quit.c | 6 +- Engine/lib/sdl/src/events/SDL_sysevents.h | 2 +- Engine/lib/sdl/src/events/SDL_touch.c | 18 +- Engine/lib/sdl/src/events/SDL_touch_c.h | 8 +- Engine/lib/sdl/src/events/SDL_windowevents.c | 10 +- .../lib/sdl/src/events/SDL_windowevents_c.h | 8 +- Engine/lib/sdl/src/events/blank_cursor.h | 2 +- Engine/lib/sdl/src/events/default_cursor.h | 2 +- Engine/lib/sdl/src/events/scancodes_darwin.h | 2 +- Engine/lib/sdl/src/events/scancodes_linux.h | 6 +- Engine/lib/sdl/src/events/scancodes_windows.h | 2 +- Engine/lib/sdl/src/events/scancodes_xfree86.h | 4 +- Engine/lib/sdl/src/file/SDL_rwops.c | 130 +- .../src/file/cocoa/SDL_rwopsbundlesupport.h | 2 +- .../src/file/cocoa/SDL_rwopsbundlesupport.m | 2 +- .../filesystem/android/SDL_sysfilesystem.c | 4 +- .../src/filesystem/cocoa/SDL_sysfilesystem.m | 17 +- .../src/filesystem/dummy/SDL_sysfilesystem.c | 2 +- .../filesystem/emscripten/SDL_sysfilesystem.c | 16 +- .../src/filesystem/haiku/SDL_sysfilesystem.cc | 33 +- .../src/filesystem/nacl/SDL_sysfilesystem.c | 3 +- .../src/filesystem/unix/SDL_sysfilesystem.c | 29 +- .../filesystem/windows/SDL_sysfilesystem.c | 16 +- .../filesystem/winrt/SDL_sysfilesystem.cpp | 20 +- Engine/lib/sdl/src/haptic/SDL_haptic.c | 5 +- Engine/lib/sdl/src/haptic/SDL_haptic_c.h | 2 +- Engine/lib/sdl/src/haptic/SDL_syshaptic.h | 10 +- .../sdl/src/haptic/android/SDL_syshaptic.c | 357 + .../sdl/src/haptic/android/SDL_syshaptic_c.h | 12 + .../lib/sdl/src/haptic/darwin/SDL_syshaptic.c | 4 +- .../sdl/src/haptic/darwin/SDL_syshaptic_c.h | 2 +- .../lib/sdl/src/haptic/dummy/SDL_syshaptic.c | 2 +- .../lib/sdl/src/haptic/linux/SDL_syshaptic.c | 8 +- .../sdl/src/haptic/windows/SDL_dinputhaptic.c | 42 +- .../src/haptic/windows/SDL_dinputhaptic_c.h | 2 +- .../src/haptic/windows/SDL_windowshaptic.c | 4 +- .../src/haptic/windows/SDL_windowshaptic_c.h | 8 +- .../sdl/src/haptic/windows/SDL_xinputhaptic.c | 7 +- .../src/haptic/windows/SDL_xinputhaptic_c.h | 2 +- .../lib/sdl/src/joystick/SDL_gamecontroller.c | 1199 +- .../sdl/src/joystick/SDL_gamecontrollerdb.h | 176 +- Engine/lib/sdl/src/joystick/SDL_joystick.c | 497 +- Engine/lib/sdl/src/joystick/SDL_joystick_c.h | 12 +- Engine/lib/sdl/src/joystick/SDL_sysjoystick.h | 33 +- .../src/joystick/android/SDL_sysjoystick.c | 212 +- .../src/joystick/android/SDL_sysjoystick_c.h | 13 +- .../sdl/src/joystick/bsd/SDL_sysjoystick.c | 24 +- .../sdl/src/joystick/darwin/SDL_sysjoystick.c | 191 +- .../src/joystick/darwin/SDL_sysjoystick_c.h | 5 +- .../sdl/src/joystick/dummy/SDL_sysjoystick.c | 8 +- .../src/joystick/emscripten/SDL_sysjoystick.c | 17 +- .../joystick/emscripten/SDL_sysjoystick_c.h | 2 +- .../src/joystick/haiku/SDL_haikujoystick.cc | 30 +- .../src/joystick/iphoneos/SDL_sysjoystick.m | 100 +- .../src/joystick/iphoneos/SDL_sysjoystick_c.h | 6 +- .../sdl/src/joystick/linux/SDL_sysjoystick.c | 310 +- .../src/joystick/linux/SDL_sysjoystick_c.h | 7 +- .../sdl/src/joystick/psp/SDL_sysjoystick.c | 6 +- .../lib/sdl/src/joystick/sort_controllers.py | 1 + .../src/joystick/steam/SDL_steamcontroller.c | 52 + .../src/joystick/steam/SDL_steamcontroller.h | 33 + .../src/joystick/windows/SDL_dinputjoystick.c | 92 +- .../joystick/windows/SDL_dinputjoystick_c.h | 2 +- .../sdl/src/joystick/windows/SDL_mmjoystick.c | 58 +- .../joystick/windows/SDL_windowsjoystick.c | 82 +- .../joystick/windows/SDL_windowsjoystick_c.h | 3 +- .../src/joystick/windows/SDL_xinputjoystick.c | 141 +- .../joystick/windows/SDL_xinputjoystick_c.h | 2 +- Engine/lib/sdl/src/libm/e_atan2.c | 22 +- Engine/lib/sdl/src/libm/e_fmod.c | 144 + Engine/lib/sdl/src/libm/e_log.c | 171 +- Engine/lib/sdl/src/libm/e_log10.c | 106 + Engine/lib/sdl/src/libm/e_pow.c | 593 +- Engine/lib/sdl/src/libm/e_rem_pio2.c | 270 +- Engine/lib/sdl/src/libm/e_sqrt.c | 209 +- Engine/lib/sdl/src/libm/k_cos.c | 76 +- Engine/lib/sdl/src/libm/k_rem_pio2.c | 340 +- Engine/lib/sdl/src/libm/k_sin.c | 60 +- Engine/lib/sdl/src/libm/k_tan.c | 2 +- Engine/lib/sdl/src/libm/math_libm.h | 4 +- Engine/lib/sdl/src/libm/math_private.h | 5 + Engine/lib/sdl/src/libm/s_atan.c | 1 - Engine/lib/sdl/src/libm/s_copysign.c | 25 +- Engine/lib/sdl/src/libm/s_cos.c | 52 +- Engine/lib/sdl/src/libm/s_fabs.c | 26 +- Engine/lib/sdl/src/libm/s_floor.c | 113 +- Engine/lib/sdl/src/libm/s_scalbn.c | 102 +- Engine/lib/sdl/src/libm/s_sin.c | 52 +- .../lib/sdl/src/loadso/dlopen/SDL_sysloadso.c | 2 +- .../lib/sdl/src/loadso/dummy/SDL_sysloadso.c | 2 +- .../lib/sdl/src/loadso/haiku/SDL_sysloadso.c | 71 - .../sdl/src/loadso/windows/SDL_sysloadso.c | 2 +- .../sdl/src/main/android/SDL_android_main.c | 80 +- Engine/lib/sdl/src/main/haiku/SDL_BApp.h | 13 +- Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc | 25 +- Engine/lib/sdl/src/main/haiku/SDL_BeApp.h | 4 +- Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c | 2 +- .../sdl/src/main/windows/SDL_windows_main.c | 4 +- Engine/lib/sdl/src/main/windows/version.rc | 10 +- .../src/main/winrt/SDL_winrt_main_NonXAML.cpp | 7 +- Engine/lib/sdl/src/power/SDL_power.c | 16 +- Engine/lib/sdl/src/power/SDL_syspower.h | 47 + .../lib/sdl/src/power/android/SDL_syspower.c | 3 +- .../sdl/src/power/emscripten/SDL_syspower.c | 2 +- Engine/lib/sdl/src/power/haiku/SDL_syspower.c | 4 +- Engine/lib/sdl/src/power/linux/SDL_syspower.c | 129 +- .../lib/sdl/src/power/macosx/SDL_syspower.c | 2 +- Engine/lib/sdl/src/power/psp/SDL_syspower.c | 2 +- Engine/lib/sdl/src/power/uikit/SDL_syspower.h | 2 +- Engine/lib/sdl/src/power/uikit/SDL_syspower.m | 2 +- .../lib/sdl/src/power/windows/SDL_syspower.c | 2 +- .../lib/sdl/src/power/winrt/SDL_syspower.cpp | 2 +- Engine/lib/sdl/src/render/SDL_d3dmath.c | 100 +- Engine/lib/sdl/src/render/SDL_d3dmath.h | 4 +- Engine/lib/sdl/src/render/SDL_render.c | 397 +- Engine/lib/sdl/src/render/SDL_sysrender.h | 41 +- Engine/lib/sdl/src/render/SDL_yuv_mmx.c | 431 - Engine/lib/sdl/src/render/SDL_yuv_sw.c | 1235 +- Engine/lib/sdl/src/render/SDL_yuv_sw_c.h | 17 +- .../sdl/src/render/direct3d/SDL_render_d3d.c | 565 +- .../sdl/src/render/direct3d/SDL_shaders_d3d.c | 274 + .../sdl/src/render/direct3d/SDL_shaders_d3d.h | 34 + .../src/render/direct3d11/SDL_render_d3d11.c | 1070 +- .../render/direct3d11/SDL_render_winrt.cpp | 2 +- .../src/render/direct3d11/SDL_render_winrt.h | 2 +- .../src/render/direct3d11/SDL_shaders_d3d11.c | 1957 ++ .../src/render/direct3d11/SDL_shaders_d3d11.h | 43 + .../sdl/src/render/metal/SDL_render_metal.m | 1429 ++ .../src/render/metal/SDL_shaders_metal.metal | 109 + .../src/render/metal/SDL_shaders_metal_ios.h | 1899 ++ .../src/render/metal/SDL_shaders_metal_osx.h | 1903 ++ .../src/render/metal/build-metal-shaders.sh | 18 + Engine/lib/sdl/src/render/mmx.h | 642 - .../lib/sdl/src/render/opengl/SDL_glfuncs.h | 5 +- .../lib/sdl/src/render/opengl/SDL_render_gl.c | 199 +- .../sdl/src/render/opengl/SDL_shaders_gl.c | 375 +- .../sdl/src/render/opengl/SDL_shaders_gl.h | 16 +- .../sdl/src/render/opengles/SDL_glesfuncs.h | 4 +- .../sdl/src/render/opengles/SDL_render_gles.c | 136 +- .../sdl/src/render/opengles2/SDL_gles2funcs.h | 7 +- .../src/render/opengles2/SDL_render_gles2.c | 315 +- .../src/render/opengles2/SDL_shaders_gles2.c | 853 +- .../src/render/opengles2/SDL_shaders_gles2.h | 27 +- .../lib/sdl/src/render/psp/SDL_render_psp.c | 6 +- .../src/render/software/SDL_blendfillrect.c | 4 +- .../src/render/software/SDL_blendfillrect.h | 2 +- .../sdl/src/render/software/SDL_blendline.c | 4 +- .../sdl/src/render/software/SDL_blendline.h | 2 +- .../sdl/src/render/software/SDL_blendpoint.c | 10 +- .../sdl/src/render/software/SDL_blendpoint.h | 2 +- Engine/lib/sdl/src/render/software/SDL_draw.h | 10 +- .../sdl/src/render/software/SDL_drawline.c | 2 +- .../sdl/src/render/software/SDL_drawline.h | 2 +- .../sdl/src/render/software/SDL_drawpoint.c | 2 +- .../sdl/src/render/software/SDL_drawpoint.h | 2 +- .../sdl/src/render/software/SDL_render_sw.c | 234 +- .../sdl/src/render/software/SDL_render_sw_c.h | 2 +- .../lib/sdl/src/render/software/SDL_rotate.c | 203 +- .../lib/sdl/src/render/software/SDL_rotate.h | 2 +- Engine/lib/sdl/src/stdlib/SDL_getenv.c | 17 +- Engine/lib/sdl/src/stdlib/SDL_iconv.c | 5 +- Engine/lib/sdl/src/stdlib/SDL_malloc.c | 172 +- Engine/lib/sdl/src/stdlib/SDL_qsort.c | 12 +- Engine/lib/sdl/src/stdlib/SDL_stdlib.c | 194 +- Engine/lib/sdl/src/stdlib/SDL_string.c | 143 +- Engine/lib/sdl/src/test/SDL_test_assert.c | 4 +- Engine/lib/sdl/src/test/SDL_test_common.c | 412 +- Engine/lib/sdl/src/test/SDL_test_compare.c | 4 +- Engine/lib/sdl/src/test/SDL_test_crc32.c | 5 +- Engine/lib/sdl/src/test/SDL_test_font.c | 54 +- Engine/lib/sdl/src/test/SDL_test_fuzzer.c | 55 +- Engine/lib/sdl/src/test/SDL_test_harness.c | 56 +- Engine/lib/sdl/src/test/SDL_test_imageBlit.c | 10 +- .../sdl/src/test/SDL_test_imageBlitBlend.c | 14 +- Engine/lib/sdl/src/test/SDL_test_imageFace.c | 5 +- .../sdl/src/test/SDL_test_imagePrimitives.c | 6 +- .../src/test/SDL_test_imagePrimitivesBlend.c | 6 +- Engine/lib/sdl/src/test/SDL_test_log.c | 23 +- Engine/lib/sdl/src/test/SDL_test_md5.c | 4 +- Engine/lib/sdl/src/test/SDL_test_memory.c | 274 + Engine/lib/sdl/src/test/SDL_test_random.c | 6 +- Engine/lib/sdl/src/thread/SDL_systhread.h | 10 +- Engine/lib/sdl/src/thread/SDL_thread.c | 6 +- Engine/lib/sdl/src/thread/SDL_thread_c.h | 12 +- .../lib/sdl/src/thread/generic/SDL_syscond.c | 2 +- .../lib/sdl/src/thread/generic/SDL_sysmutex.c | 2 +- .../sdl/src/thread/generic/SDL_sysmutex_c.h | 2 +- .../lib/sdl/src/thread/generic/SDL_syssem.c | 2 +- .../sdl/src/thread/generic/SDL_systhread.c | 2 +- .../sdl/src/thread/generic/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/generic/SDL_systls.c | 4 +- Engine/lib/sdl/src/thread/psp/SDL_syscond.c | 2 +- Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c | 2 +- .../lib/sdl/src/thread/psp/SDL_sysmutex_c.h | 2 +- Engine/lib/sdl/src/thread/psp/SDL_syssem.c | 4 +- Engine/lib/sdl/src/thread/psp/SDL_systhread.c | 2 +- .../lib/sdl/src/thread/psp/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/pthread/SDL_syscond.c | 6 +- .../lib/sdl/src/thread/pthread/SDL_sysmutex.c | 11 +- .../sdl/src/thread/pthread/SDL_sysmutex_c.h | 8 +- .../lib/sdl/src/thread/pthread/SDL_syssem.c | 10 +- .../sdl/src/thread/pthread/SDL_systhread.c | 8 +- .../sdl/src/thread/pthread/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/pthread/SDL_systls.c | 5 +- .../lib/sdl/src/thread/stdcpp/SDL_syscond.cpp | 2 +- .../sdl/src/thread/stdcpp/SDL_sysmutex.cpp | 2 +- .../sdl/src/thread/stdcpp/SDL_sysmutex_c.h | 2 +- .../sdl/src/thread/stdcpp/SDL_systhread.cpp | 4 +- .../sdl/src/thread/stdcpp/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/windows/SDL_sysmutex.c | 2 +- .../lib/sdl/src/thread/windows/SDL_syssem.c | 6 +- .../sdl/src/thread/windows/SDL_systhread.c | 57 +- .../sdl/src/thread/windows/SDL_systhread_c.h | 8 +- .../lib/sdl/src/thread/windows/SDL_systls.c | 4 +- Engine/lib/sdl/src/timer/SDL_timer.c | 5 +- Engine/lib/sdl/src/timer/SDL_timer_c.h | 2 +- Engine/lib/sdl/src/timer/dummy/SDL_systimer.c | 2 +- Engine/lib/sdl/src/timer/haiku/SDL_systimer.c | 4 +- Engine/lib/sdl/src/timer/psp/SDL_systimer.c | 2 +- Engine/lib/sdl/src/timer/unix/SDL_systimer.c | 3 +- .../lib/sdl/src/timer/windows/SDL_systimer.c | 4 +- Engine/lib/sdl/src/video/SDL_RLEaccel.c | 16 +- Engine/lib/sdl/src/video/SDL_RLEaccel_c.h | 10 +- Engine/lib/sdl/src/video/SDL_blit.c | 14 +- Engine/lib/sdl/src/video/SDL_blit.h | 49 +- Engine/lib/sdl/src/video/SDL_blit_0.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_1.c | 16 +- Engine/lib/sdl/src/video/SDL_blit_A.c | 6 +- Engine/lib/sdl/src/video/SDL_blit_N.c | 36 +- Engine/lib/sdl/src/video/SDL_blit_auto.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_auto.h | 2 +- Engine/lib/sdl/src/video/SDL_blit_copy.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_copy.h | 2 +- Engine/lib/sdl/src/video/SDL_blit_slow.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_slow.h | 2 +- Engine/lib/sdl/src/video/SDL_bmp.c | 5 +- Engine/lib/sdl/src/video/SDL_clipboard.c | 2 +- Engine/lib/sdl/src/video/SDL_egl.c | 331 +- Engine/lib/sdl/src/video/SDL_egl_c.h | 35 +- Engine/lib/sdl/src/video/SDL_fillrect.c | 14 +- Engine/lib/sdl/src/video/SDL_pixels.c | 52 +- Engine/lib/sdl/src/video/SDL_pixels_c.h | 3 +- Engine/lib/sdl/src/video/SDL_rect.c | 10 +- Engine/lib/sdl/src/video/SDL_rect_c.h | 2 +- Engine/lib/sdl/src/video/SDL_shape.c | 30 +- .../lib/sdl/src/video/SDL_shape_internals.h | 6 +- Engine/lib/sdl/src/video/SDL_stretch.c | 10 +- Engine/lib/sdl/src/video/SDL_surface.c | 173 +- Engine/lib/sdl/src/video/SDL_sysvideo.h | 95 +- Engine/lib/sdl/src/video/SDL_video.c | 497 +- .../lib/sdl/src/video/SDL_vulkan_internal.h | 91 + Engine/lib/sdl/src/video/SDL_vulkan_utils.c | 172 + Engine/lib/sdl/src/video/SDL_yuv.c | 1834 ++ Engine/lib/sdl/src/video/SDL_yuv_c.h | 30 + .../src/video/android/SDL_androidclipboard.c | 4 +- .../src/video/android/SDL_androidclipboard.h | 8 +- .../sdl/src/video/android/SDL_androidevents.c | 18 +- .../sdl/src/video/android/SDL_androidevents.h | 2 +- .../lib/sdl/src/video/android/SDL_androidgl.c | 9 +- .../lib/sdl/src/video/android/SDL_androidgl.h | 34 + .../src/video/android/SDL_androidkeyboard.c | 8 +- .../src/video/android/SDL_androidkeyboard.h | 2 +- .../src/video/android/SDL_androidmessagebox.c | 6 +- .../src/video/android/SDL_androidmessagebox.h | 2 +- .../sdl/src/video/android/SDL_androidmouse.c | 57 +- .../sdl/src/video/android/SDL_androidmouse.h | 8 +- .../sdl/src/video/android/SDL_androidtouch.c | 11 +- .../sdl/src/video/android/SDL_androidtouch.h | 2 +- .../sdl/src/video/android/SDL_androidvideo.c | 53 +- .../sdl/src/video/android/SDL_androidvideo.h | 8 +- .../sdl/src/video/android/SDL_androidvulkan.c | 175 + .../sdl/src/video/android/SDL_androidvulkan.h | 52 + .../sdl/src/video/android/SDL_androidwindow.c | 31 +- .../sdl/src/video/android/SDL_androidwindow.h | 9 +- .../sdl/src/video/cocoa/SDL_cocoaclipboard.h | 8 +- .../sdl/src/video/cocoa/SDL_cocoaclipboard.m | 2 +- .../lib/sdl/src/video/cocoa/SDL_cocoaevents.h | 8 +- .../lib/sdl/src/video/cocoa/SDL_cocoaevents.m | 81 +- .../sdl/src/video/cocoa/SDL_cocoakeyboard.h | 8 +- .../sdl/src/video/cocoa/SDL_cocoakeyboard.m | 31 +- .../sdl/src/video/cocoa/SDL_cocoamessagebox.h | 2 +- .../sdl/src/video/cocoa/SDL_cocoamessagebox.m | 23 +- .../sdl/src/video/cocoa/SDL_cocoametalview.h | 63 + .../sdl/src/video/cocoa/SDL_cocoametalview.m | 135 + .../lib/sdl/src/video/cocoa/SDL_cocoamodes.h | 8 +- .../lib/sdl/src/video/cocoa/SDL_cocoamodes.m | 44 +- .../lib/sdl/src/video/cocoa/SDL_cocoamouse.h | 8 +- .../lib/sdl/src/video/cocoa/SDL_cocoamouse.m | 23 +- .../sdl/src/video/cocoa/SDL_cocoamousetap.h | 9 +- .../sdl/src/video/cocoa/SDL_cocoamousetap.m | 48 +- .../lib/sdl/src/video/cocoa/SDL_cocoaopengl.h | 10 +- .../lib/sdl/src/video/cocoa/SDL_cocoaopengl.m | 27 +- .../sdl/src/video/cocoa/SDL_cocoaopengles.h | 49 + .../sdl/src/video/cocoa/SDL_cocoaopengles.m | 132 + .../lib/sdl/src/video/cocoa/SDL_cocoashape.h | 10 +- .../lib/sdl/src/video/cocoa/SDL_cocoashape.m | 4 +- .../lib/sdl/src/video/cocoa/SDL_cocoavideo.h | 61 +- .../lib/sdl/src/video/cocoa/SDL_cocoavideo.m | 25 +- .../lib/sdl/src/video/cocoa/SDL_cocoavulkan.h | 55 + .../lib/sdl/src/video/cocoa/SDL_cocoavulkan.m | 231 + .../lib/sdl/src/video/cocoa/SDL_cocoawindow.h | 15 +- .../lib/sdl/src/video/cocoa/SDL_cocoawindow.m | 171 +- .../sdl/src/video/directfb/SDL_DirectFB_WM.c | 2 +- .../sdl/src/video/directfb/SDL_DirectFB_WM.h | 8 +- .../sdl/src/video/directfb/SDL_DirectFB_dyn.c | 2 +- .../sdl/src/video/directfb/SDL_DirectFB_dyn.h | 10 +- .../src/video/directfb/SDL_DirectFB_events.c | 5 +- .../src/video/directfb/SDL_DirectFB_events.h | 10 +- .../src/video/directfb/SDL_DirectFB_modes.c | 2 +- .../src/video/directfb/SDL_DirectFB_modes.h | 8 +- .../src/video/directfb/SDL_DirectFB_mouse.c | 11 +- .../src/video/directfb/SDL_DirectFB_mouse.h | 8 +- .../src/video/directfb/SDL_DirectFB_opengl.c | 33 +- .../src/video/directfb/SDL_DirectFB_opengl.h | 10 +- .../src/video/directfb/SDL_DirectFB_render.c | 23 +- .../src/video/directfb/SDL_DirectFB_render.h | 2 +- .../src/video/directfb/SDL_DirectFB_shape.c | 13 +- .../src/video/directfb/SDL_DirectFB_shape.h | 9 +- .../src/video/directfb/SDL_DirectFB_video.c | 17 +- .../src/video/directfb/SDL_DirectFB_video.h | 8 +- .../src/video/directfb/SDL_DirectFB_window.c | 24 +- .../src/video/directfb/SDL_DirectFB_window.h | 8 +- .../lib/sdl/src/video/dummy/SDL_nullevents.c | 2 +- .../sdl/src/video/dummy/SDL_nullevents_c.h | 2 +- .../sdl/src/video/dummy/SDL_nullframebuffer.c | 2 +- .../src/video/dummy/SDL_nullframebuffer_c.h | 2 +- .../lib/sdl/src/video/dummy/SDL_nullvideo.c | 3 +- .../lib/sdl/src/video/dummy/SDL_nullvideo.h | 8 +- .../video/emscripten/SDL_emscriptenevents.c | 106 +- .../video/emscripten/SDL_emscriptenevents.h | 11 +- .../emscripten/SDL_emscriptenframebuffer.c | 2 +- .../emscripten/SDL_emscriptenframebuffer.h | 8 +- .../video/emscripten/SDL_emscriptenmouse.c | 116 +- .../video/emscripten/SDL_emscriptenmouse.h | 11 +- .../video/emscripten/SDL_emscriptenopengles.c | 12 +- .../video/emscripten/SDL_emscriptenopengles.h | 10 +- .../video/emscripten/SDL_emscriptenvideo.c | 15 +- .../video/emscripten/SDL_emscriptenvideo.h | 12 +- Engine/lib/sdl/src/video/haiku/SDL_BWin.h | 23 +- .../lib/sdl/src/video/haiku/SDL_bclipboard.cc | 14 +- .../lib/sdl/src/video/haiku/SDL_bclipboard.h | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bevents.cc | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bevents.h | 4 +- .../sdl/src/video/haiku/SDL_bframebuffer.cc | 17 +- .../sdl/src/video/haiku/SDL_bframebuffer.h | 4 +- .../lib/sdl/src/video/haiku/SDL_bkeyboard.cc | 6 +- .../lib/sdl/src/video/haiku/SDL_bkeyboard.h | 6 +- Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc | 8 +- Engine/lib/sdl/src/video/haiku/SDL_bmodes.h | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc | 197 +- Engine/lib/sdl/src/video/haiku/SDL_bopengl.h | 10 +- Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc | 11 +- Engine/lib/sdl/src/video/haiku/SDL_bvideo.h | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc | 18 +- Engine/lib/sdl/src/video/haiku/SDL_bwindow.h | 3 +- Engine/lib/sdl/src/video/khronos/EGL/egl.h | 303 + Engine/lib/sdl/src/video/khronos/EGL/eglext.h | 1241 ++ .../sdl/src/video/khronos/EGL/eglplatform.h | 132 + Engine/lib/sdl/src/video/khronos/GLES2/gl2.h | 675 + .../lib/sdl/src/video/khronos/GLES2/gl2ext.h | 3505 ++++ .../sdl/src/video/khronos/GLES2/gl2platform.h | 38 + .../sdl/src/video/khronos/KHR/khrplatform.h | 284 + .../src/video/khronos/vulkan/vk_platform.h | 120 + .../lib/sdl/src/video/khronos/vulkan/vulkan.h | 6458 ++++++ .../lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c | 171 + .../lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h | 53 + .../sdl/src/video/kmsdrm/SDL_kmsdrmevents.c | 42 + .../sdl/src/video/kmsdrm/SDL_kmsdrmevents.h | 31 + .../sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c | 501 + .../sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h | 45 + .../sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c | 189 + .../sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h | 48 + .../lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h | 99 + .../sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c | 664 + .../sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h | 124 + Engine/lib/sdl/src/video/mir/SDL_mirdyn.c | 2 +- Engine/lib/sdl/src/video/mir/SDL_mirdyn.h | 8 +- Engine/lib/sdl/src/video/mir/SDL_mirevents.c | 40 +- Engine/lib/sdl/src/video/mir/SDL_mirevents.h | 10 +- .../sdl/src/video/mir/SDL_mirframebuffer.c | 6 +- .../sdl/src/video/mir/SDL_mirframebuffer.h | 8 +- Engine/lib/sdl/src/video/mir/SDL_mirmouse.c | 48 +- Engine/lib/sdl/src/video/mir/SDL_mirmouse.h | 8 +- Engine/lib/sdl/src/video/mir/SDL_miropengl.c | 26 +- Engine/lib/sdl/src/video/mir/SDL_miropengl.h | 19 +- Engine/lib/sdl/src/video/mir/SDL_mirsym.h | 63 +- Engine/lib/sdl/src/video/mir/SDL_mirvideo.c | 35 +- Engine/lib/sdl/src/video/mir/SDL_mirvideo.h | 9 +- Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c | 176 + Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h | 52 + Engine/lib/sdl/src/video/mir/SDL_mirwindow.c | 216 +- Engine/lib/sdl/src/video/mir/SDL_mirwindow.h | 10 +- .../lib/sdl/src/video/nacl/SDL_naclevents.c | 46 +- .../lib/sdl/src/video/nacl/SDL_naclevents_c.h | 8 +- Engine/lib/sdl/src/video/nacl/SDL_naclglue.c | 2 +- .../lib/sdl/src/video/nacl/SDL_naclopengles.c | 11 +- .../lib/sdl/src/video/nacl/SDL_naclopengles.h | 10 +- Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c | 6 +- Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h | 8 +- .../lib/sdl/src/video/nacl/SDL_naclwindow.c | 2 +- .../lib/sdl/src/video/nacl/SDL_naclwindow.h | 8 +- .../lib/sdl/src/video/pandora/SDL_pandora.c | 20 +- .../lib/sdl/src/video/pandora/SDL_pandora.h | 4 +- .../src/video/pandora/SDL_pandora_events.c | 2 +- .../src/video/pandora/SDL_pandora_events.h | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspevents.c | 6 +- .../lib/sdl/src/video/psp/SDL_pspevents_c.h | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspgl.c | 13 +- Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h | 12 +- Engine/lib/sdl/src/video/psp/SDL_pspmouse.c | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspvideo.c | 12 +- Engine/lib/sdl/src/video/psp/SDL_pspvideo.h | 10 +- Engine/lib/sdl/src/video/qnx/gl.c | 285 + Engine/lib/sdl/src/video/qnx/keyboard.c | 133 + Engine/lib/sdl/src/video/qnx/sdl_qnx.h | 48 + Engine/lib/sdl/src/video/qnx/video.c | 364 + .../sdl/src/video/raspberry/SDL_rpievents.c | 2 +- .../sdl/src/video/raspberry/SDL_rpievents_c.h | 8 +- .../sdl/src/video/raspberry/SDL_rpimouse.c | 67 +- .../sdl/src/video/raspberry/SDL_rpimouse.h | 8 +- .../sdl/src/video/raspberry/SDL_rpiopengles.c | 35 +- .../sdl/src/video/raspberry/SDL_rpiopengles.h | 11 +- .../sdl/src/video/raspberry/SDL_rpivideo.c | 78 +- .../sdl/src/video/raspberry/SDL_rpivideo.h | 12 +- Engine/lib/sdl/src/video/sdlgenblit.pl | 2 +- .../src/video/uikit/SDL_uikitappdelegate.h | 8 +- .../src/video/uikit/SDL_uikitappdelegate.m | 68 +- .../sdl/src/video/uikit/SDL_uikitclipboard.h | 8 +- .../sdl/src/video/uikit/SDL_uikitclipboard.m | 2 +- .../lib/sdl/src/video/uikit/SDL_uikitevents.h | 8 +- .../lib/sdl/src/video/uikit/SDL_uikitevents.m | 2 +- .../sdl/src/video/uikit/SDL_uikitmessagebox.h | 4 +- .../sdl/src/video/uikit/SDL_uikitmessagebox.m | 16 +- .../sdl/src/video/uikit/SDL_uikitmetalview.h | 58 + .../sdl/src/video/uikit/SDL_uikitmetalview.m | 124 + .../lib/sdl/src/video/uikit/SDL_uikitmodes.h | 8 +- .../lib/sdl/src/video/uikit/SDL_uikitmodes.m | 43 +- .../sdl/src/video/uikit/SDL_uikitopengles.h | 12 +- .../sdl/src/video/uikit/SDL_uikitopengles.m | 7 +- .../sdl/src/video/uikit/SDL_uikitopenglview.h | 2 +- .../sdl/src/video/uikit/SDL_uikitopenglview.m | 2 +- .../lib/sdl/src/video/uikit/SDL_uikitvideo.h | 10 +- .../lib/sdl/src/video/uikit/SDL_uikitvideo.m | 53 +- .../lib/sdl/src/video/uikit/SDL_uikitview.h | 2 +- .../lib/sdl/src/video/uikit/SDL_uikitview.m | 93 +- .../src/video/uikit/SDL_uikitviewcontroller.h | 6 +- .../src/video/uikit/SDL_uikitviewcontroller.m | 115 +- .../lib/sdl/src/video/uikit/SDL_uikitvulkan.h | 54 + .../lib/sdl/src/video/uikit/SDL_uikitvulkan.m | 222 + .../lib/sdl/src/video/uikit/SDL_uikitwindow.h | 8 +- .../lib/sdl/src/video/uikit/SDL_uikitwindow.m | 12 +- Engine/lib/sdl/src/video/uikit/keyinfotable.h | 2 +- .../src/video/vivante/SDL_vivanteopengles.c | 4 +- .../src/video/vivante/SDL_vivanteopengles.h | 10 +- .../src/video/vivante/SDL_vivanteplatform.c | 12 +- .../src/video/vivante/SDL_vivanteplatform.h | 10 +- .../sdl/src/video/vivante/SDL_vivantevideo.c | 18 +- .../sdl/src/video/vivante/SDL_vivantevideo.h | 8 +- .../src/video/wayland/SDL_waylandclipboard.c | 123 + .../src/video/wayland/SDL_waylandclipboard.h | 32 + .../video/wayland/SDL_waylanddatamanager.c | 468 + .../video/wayland/SDL_waylanddatamanager.h | 103 + .../sdl/src/video/wayland/SDL_waylanddyn.c | 2 +- .../sdl/src/video/wayland/SDL_waylanddyn.h | 12 +- .../sdl/src/video/wayland/SDL_waylandevents.c | 523 +- .../src/video/wayland/SDL_waylandevents_c.h | 13 +- .../sdl/src/video/wayland/SDL_waylandmouse.c | 24 +- .../sdl/src/video/wayland/SDL_waylandmouse.h | 2 +- .../src/video/wayland/SDL_waylandopengles.c | 12 +- .../src/video/wayland/SDL_waylandopengles.h | 13 +- .../sdl/src/video/wayland/SDL_waylandsym.h | 6 +- .../sdl/src/video/wayland/SDL_waylandtouch.c | 2 +- .../sdl/src/video/wayland/SDL_waylandtouch.h | 8 +- .../sdl/src/video/wayland/SDL_waylandvideo.c | 67 +- .../sdl/src/video/wayland/SDL_waylandvideo.h | 15 +- .../sdl/src/video/wayland/SDL_waylandvulkan.c | 176 + .../sdl/src/video/wayland/SDL_waylandvulkan.h | 52 + .../sdl/src/video/wayland/SDL_waylandwindow.c | 308 +- .../sdl/src/video/wayland/SDL_waylandwindow.h | 22 +- Engine/lib/sdl/src/video/windows/SDL_msctf.h | 8 +- Engine/lib/sdl/src/video/windows/SDL_vkeys.h | 2 +- .../src/video/windows/SDL_windowsclipboard.c | 2 +- .../src/video/windows/SDL_windowsclipboard.h | 8 +- .../sdl/src/video/windows/SDL_windowsevents.c | 427 +- .../sdl/src/video/windows/SDL_windowsevents.h | 8 +- .../video/windows/SDL_windowsframebuffer.c | 2 +- .../video/windows/SDL_windowsframebuffer.h | 2 +- .../src/video/windows/SDL_windowskeyboard.c | 49 +- .../src/video/windows/SDL_windowskeyboard.h | 8 +- .../src/video/windows/SDL_windowsmessagebox.c | 30 +- .../src/video/windows/SDL_windowsmessagebox.h | 2 +- .../sdl/src/video/windows/SDL_windowsmodes.c | 335 +- .../sdl/src/video/windows/SDL_windowsmodes.h | 14 +- .../sdl/src/video/windows/SDL_windowsmouse.c | 9 +- .../sdl/src/video/windows/SDL_windowsmouse.h | 8 +- .../sdl/src/video/windows/SDL_windowsopengl.c | 115 +- .../sdl/src/video/windows/SDL_windowsopengl.h | 25 +- .../src/video/windows/SDL_windowsopengles.c | 17 +- .../src/video/windows/SDL_windowsopengles.h | 14 +- .../sdl/src/video/windows/SDL_windowsshape.c | 4 +- .../sdl/src/video/windows/SDL_windowsshape.h | 8 +- .../sdl/src/video/windows/SDL_windowsvideo.c | 26 +- .../sdl/src/video/windows/SDL_windowsvideo.h | 8 +- .../sdl/src/video/windows/SDL_windowsvulkan.c | 176 + .../sdl/src/video/windows/SDL_windowsvulkan.h | 52 + .../sdl/src/video/windows/SDL_windowswindow.c | 311 +- .../sdl/src/video/windows/SDL_windowswindow.h | 11 +- Engine/lib/sdl/src/video/windows/wmmsg.h | 2 +- .../sdl/src/video/winrt/SDL_winrtevents.cpp | 4 +- .../sdl/src/video/winrt/SDL_winrtevents_c.h | 4 +- .../sdl/src/video/winrt/SDL_winrtgamebar.cpp | 2 +- .../src/video/winrt/SDL_winrtgamebar_cpp.h | 8 +- .../sdl/src/video/winrt/SDL_winrtkeyboard.cpp | 4 +- .../src/video/winrt/SDL_winrtmessagebox.cpp | 2 +- .../sdl/src/video/winrt/SDL_winrtmessagebox.h | 2 +- .../sdl/src/video/winrt/SDL_winrtmouse.cpp | 2 +- .../sdl/src/video/winrt/SDL_winrtmouse_c.h | 8 +- .../sdl/src/video/winrt/SDL_winrtopengles.cpp | 19 +- .../sdl/src/video/winrt/SDL_winrtopengles.h | 10 +- .../src/video/winrt/SDL_winrtpointerinput.cpp | 11 +- .../sdl/src/video/winrt/SDL_winrtvideo.cpp | 10 +- .../sdl/src/video/winrt/SDL_winrtvideo_cpp.h | 2 +- .../lib/sdl/src/video/x11/SDL_x11clipboard.c | 22 +- .../lib/sdl/src/video/x11/SDL_x11clipboard.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11dyn.c | 2 +- Engine/lib/sdl/src/video/x11/SDL_x11dyn.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11events.c | 220 +- Engine/lib/sdl/src/video/x11/SDL_x11events.h | 8 +- .../sdl/src/video/x11/SDL_x11framebuffer.c | 4 +- .../sdl/src/video/x11/SDL_x11framebuffer.h | 2 +- .../lib/sdl/src/video/x11/SDL_x11keyboard.c | 89 +- .../lib/sdl/src/video/x11/SDL_x11keyboard.h | 8 +- .../lib/sdl/src/video/x11/SDL_x11messagebox.c | 36 +- .../lib/sdl/src/video/x11/SDL_x11messagebox.h | 2 +- Engine/lib/sdl/src/video/x11/SDL_x11modes.c | 54 +- Engine/lib/sdl/src/video/x11/SDL_x11modes.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11mouse.c | 22 +- Engine/lib/sdl/src/video/x11/SDL_x11mouse.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11opengl.c | 184 +- Engine/lib/sdl/src/video/x11/SDL_x11opengl.h | 23 +- .../lib/sdl/src/video/x11/SDL_x11opengles.c | 4 +- .../lib/sdl/src/video/x11/SDL_x11opengles.h | 13 +- Engine/lib/sdl/src/video/x11/SDL_x11shape.c | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11shape.h | 9 +- Engine/lib/sdl/src/video/x11/SDL_x11sym.h | 5 +- Engine/lib/sdl/src/video/x11/SDL_x11touch.c | 9 +- Engine/lib/sdl/src/video/x11/SDL_x11touch.h | 9 +- Engine/lib/sdl/src/video/x11/SDL_x11video.c | 91 +- Engine/lib/sdl/src/video/x11/SDL_x11video.h | 22 +- Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c | 243 + Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h | 48 + Engine/lib/sdl/src/video/x11/SDL_x11window.c | 70 +- Engine/lib/sdl/src/video/x11/SDL_x11window.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c | 49 +- Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h | 8 +- Engine/lib/sdl/src/video/x11/edid-parse.c | 92 +- Engine/lib/sdl/src/video/x11/edid.h | 4 +- Engine/lib/sdl/src/video/yuv2rgb/LICENSE | 27 + Engine/lib/sdl/src/video/yuv2rgb/README.md | 63 + Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c | 687 + Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.h | 381 + .../sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h | 498 + .../sdl/src/video/yuv2rgb/yuv_rgb_std_func.h | 220 + Engine/lib/sdl/test/CMakeLists.txt | 122 + Engine/lib/sdl/test/Makefile.in | 51 +- Engine/lib/sdl/test/axis.bmp | Bin 3746 -> 10138 bytes Engine/lib/sdl/test/checkkeys.c | 16 +- Engine/lib/sdl/test/controllermap.c | 774 +- Engine/lib/sdl/test/loopwave.c | 90 +- Engine/lib/sdl/test/loopwavequeue.c | 5 +- Engine/lib/sdl/test/nacl/common.js | 7 +- Engine/lib/sdl/test/testatomic.c | 17 +- Engine/lib/sdl/test/testaudiocapture.c | 2 +- Engine/lib/sdl/test/testaudiohotplug.c | 2 +- Engine/lib/sdl/test/testaudioinfo.c | 2 +- Engine/lib/sdl/test/testautomation.c | 2 +- Engine/lib/sdl/test/testautomation_audio.c | 2 +- .../lib/sdl/test/testautomation_clipboard.c | 2 +- Engine/lib/sdl/test/testautomation_events.c | 2 +- Engine/lib/sdl/test/testautomation_keyboard.c | 2 +- Engine/lib/sdl/test/testautomation_mouse.c | 16 +- Engine/lib/sdl/test/testautomation_platform.c | 36 +- Engine/lib/sdl/test/testautomation_rwops.c | 54 +- Engine/lib/sdl/test/testautomation_sdltest.c | 72 +- Engine/lib/sdl/test/testautomation_stdlib.c | 24 +- Engine/lib/sdl/test/testautomation_timer.c | 2 +- Engine/lib/sdl/test/testbounds.c | 2 +- Engine/lib/sdl/test/testcustomcursor.c | 2 +- Engine/lib/sdl/test/testdisplayinfo.c | 2 +- Engine/lib/sdl/test/testdraw2.c | 2 +- Engine/lib/sdl/test/testdrawchessboard.c | 22 +- Engine/lib/sdl/test/testdropfile.c | 2 +- Engine/lib/sdl/test/testerror.c | 3 +- Engine/lib/sdl/test/testfile.c | 2 +- Engine/lib/sdl/test/testfilesystem.c | 11 +- Engine/lib/sdl/test/testgamecontroller.c | 44 +- Engine/lib/sdl/test/testgesture.c | 3 +- Engine/lib/sdl/test/testgl2.c | 4 +- Engine/lib/sdl/test/testgles.c | 2 +- Engine/lib/sdl/test/testgles2.c | 7 +- Engine/lib/sdl/test/testhittesting.c | 2 +- Engine/lib/sdl/test/testhotplug.c | 2 +- Engine/lib/sdl/test/testiconv.c | 2 +- Engine/lib/sdl/test/testime.c | 62 +- Engine/lib/sdl/test/testintersections.c | 2 +- Engine/lib/sdl/test/testjoystick.c | 41 +- Engine/lib/sdl/test/testkeys.c | 2 +- Engine/lib/sdl/test/testloadso.c | 2 +- Engine/lib/sdl/test/testlock.c | 2 +- Engine/lib/sdl/test/testmessage.c | 8 +- Engine/lib/sdl/test/testmultiaudio.c | 2 +- Engine/lib/sdl/test/testnative.c | 2 +- Engine/lib/sdl/test/testnative.h | 2 +- Engine/lib/sdl/test/testnativew32.c | 2 +- Engine/lib/sdl/test/testnativex11.c | 2 +- Engine/lib/sdl/test/testoverlay2.c | 293 +- Engine/lib/sdl/test/testplatform.c | 239 +- Engine/lib/sdl/test/testpower.c | 2 +- Engine/lib/sdl/test/testqsort.c | 2 +- Engine/lib/sdl/test/testrelative.c | 2 +- Engine/lib/sdl/test/testrendercopyex.c | 2 +- Engine/lib/sdl/test/testrendertarget.c | 2 +- Engine/lib/sdl/test/testresample.c | 16 +- Engine/lib/sdl/test/testrumble.c | 9 +- Engine/lib/sdl/test/testscale.c | 2 +- Engine/lib/sdl/test/testsem.c | 2 +- Engine/lib/sdl/test/testshader.c | 2 +- Engine/lib/sdl/test/testshape.c | 17 +- Engine/lib/sdl/test/testsprite2.c | 12 +- Engine/lib/sdl/test/testspriteminimal.c | 2 +- Engine/lib/sdl/test/teststreaming.c | 2 +- Engine/lib/sdl/test/testthread.c | 2 +- Engine/lib/sdl/test/testtimer.c | 2 +- Engine/lib/sdl/test/testver.c | 2 +- Engine/lib/sdl/test/testviewport.c | 2 +- Engine/lib/sdl/test/testvulkan.c | 1201 ++ Engine/lib/sdl/test/testwm2.c | 2 +- Engine/lib/sdl/test/testyuv.bmp | Bin 0 -> 739398 bytes Engine/lib/sdl/test/testyuv.c | 455 + Engine/lib/sdl/test/testyuv_cvt.c | 300 + Engine/lib/sdl/test/testyuv_cvt.h | 16 + Engine/lib/sdl/test/torturethread.c | 2 +- 894 files changed, 66879 insertions(+), 43299 deletions(-) create mode 100644 Engine/lib/sdl/SDL2Config.cmake delete mode 100644 Engine/lib/sdl/Xcode/SDL/Info-Framework.plist delete mode 100755 Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj delete mode 100755 Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info delete mode 100644 Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt delete mode 100755 Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt delete mode 100644 Engine/lib/sdl/Xcode/SDL/pkg-support/resources/SDL_DS_Store delete mode 100644 Engine/lib/sdl/Xcode/SDL/pkg-support/sdl_logo.pdf delete mode 100755 Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj delete mode 100644 Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist delete mode 100644 Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile create mode 100755 Engine/lib/sdl/build-scripts/androidbuildlibs.sh create mode 100644 Engine/lib/sdl/build-scripts/config.sub.patch create mode 100644 Engine/lib/sdl/include/SDL_test_memory.h create mode 100644 Engine/lib/sdl/include/SDL_vulkan.h create mode 100644 Engine/lib/sdl/src/SDL_dataqueue.c create mode 100644 Engine/lib/sdl/src/SDL_dataqueue.h create mode 100644 Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c create mode 100644 Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h rename Engine/lib/sdl/src/audio/{bsd/SDL_bsdaudio.c => netbsd/SDL_netbsdaudio.c} (88%) rename Engine/lib/sdl/src/audio/{bsd/SDL_bsdaudio.h => netbsd/SDL_netbsdaudio.h} (81%) delete mode 100755 Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h create mode 100644 Engine/lib/sdl/src/core/android/keyinfotable.h create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h create mode 100644 Engine/lib/sdl/src/core/unix/SDL_poll.c create mode 100644 Engine/lib/sdl/src/core/unix/SDL_poll.h create mode 100644 Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c create mode 100644 Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h create mode 100644 Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c create mode 100644 Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h create mode 100644 Engine/lib/sdl/src/libm/e_fmod.c create mode 100644 Engine/lib/sdl/src/libm/e_log10.c delete mode 100644 Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c create mode 100644 Engine/lib/sdl/src/power/SDL_syspower.h delete mode 100644 Engine/lib/sdl/src/render/SDL_yuv_mmx.c create mode 100644 Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c create mode 100644 Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h create mode 100644 Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c create mode 100644 Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h create mode 100644 Engine/lib/sdl/src/render/metal/SDL_render_metal.m create mode 100644 Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal create mode 100644 Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h create mode 100644 Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h create mode 100755 Engine/lib/sdl/src/render/metal/build-metal-shaders.sh delete mode 100644 Engine/lib/sdl/src/render/mmx.h create mode 100644 Engine/lib/sdl/src/test/SDL_test_memory.c create mode 100644 Engine/lib/sdl/src/video/SDL_vulkan_internal.h create mode 100644 Engine/lib/sdl/src/video/SDL_vulkan_utils.c create mode 100644 Engine/lib/sdl/src/video/SDL_yuv.c create mode 100644 Engine/lib/sdl/src/video/SDL_yuv_c.h create mode 100644 Engine/lib/sdl/src/video/android/SDL_androidgl.h create mode 100644 Engine/lib/sdl/src/video/android/SDL_androidvulkan.c create mode 100644 Engine/lib/sdl/src/video/android/SDL_androidvulkan.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m create mode 100644 Engine/lib/sdl/src/video/khronos/EGL/egl.h create mode 100644 Engine/lib/sdl/src/video/khronos/EGL/eglext.h create mode 100644 Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h create mode 100644 Engine/lib/sdl/src/video/khronos/GLES2/gl2.h create mode 100644 Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h create mode 100644 Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h create mode 100644 Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h create mode 100644 Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h create mode 100644 Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h create mode 100644 Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c create mode 100644 Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h create mode 100644 Engine/lib/sdl/src/video/qnx/gl.c create mode 100644 Engine/lib/sdl/src/video/qnx/keyboard.c create mode 100644 Engine/lib/sdl/src/video/qnx/sdl_qnx.h create mode 100644 Engine/lib/sdl/src/video/qnx/video.c create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h create mode 100644 Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c create mode 100644 Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h create mode 100644 Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c create mode 100644 Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/LICENSE create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/README.md create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.h create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h create mode 100644 Engine/lib/sdl/test/CMakeLists.txt create mode 100644 Engine/lib/sdl/test/testvulkan.c create mode 100644 Engine/lib/sdl/test/testyuv.bmp create mode 100644 Engine/lib/sdl/test/testyuv.c create mode 100644 Engine/lib/sdl/test/testyuv_cvt.c create mode 100644 Engine/lib/sdl/test/testyuv_cvt.h diff --git a/Engine/lib/sdl/Android.mk b/Engine/lib/sdl/Android.mk index 13d765f57..d56b5c00c 100755 --- a/Engine/lib/sdl/Android.mk +++ b/Engine/lib/sdl/Android.mk @@ -20,7 +20,7 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/audio/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \ - $(LOCAL_PATH)/src/atomic/SDL_atomic.c \ + $(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \ $(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \ $(wildcard $(LOCAL_PATH)/src/core/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \ @@ -28,9 +28,10 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/events/*.c) \ $(wildcard $(LOCAL_PATH)/src/file/*.c) \ $(wildcard $(LOCAL_PATH)/src/haptic/*.c) \ - $(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \ + $(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \ + $(LOCAL_PATH)/src/joystick/steam/SDL_steamcontroller.c \ $(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/android/*.c) \ @@ -44,11 +45,14 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/android/*.c) \ + $(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \ $(wildcard $(LOCAL_PATH)/src/test/*.c)) LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid +cmd-strip := + include $(BUILD_SHARED_LIBRARY) ########################### @@ -61,9 +65,25 @@ LOCAL_MODULE := SDL2_static LOCAL_MODULE_FILENAME := libSDL2 -LOCAL_SRC_FILES += $(subst $(LOCAL_PATH)/,,$(LOCAL_PATH)/src/main/android/SDL_android_main.c) - LOCAL_LDLIBS := -LOCAL_EXPORT_LDLIBS := -Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit -ldl -lGLESv1_CM -lGLESv2 -llog -landroid +LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid include $(BUILD_STATIC_LIBRARY) + +########################### +# +# SDL main static library +# +########################### + +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/include + +LOCAL_MODULE := SDL2_main + +LOCAL_MODULE_FILENAME := libSDL2main + +include $(BUILD_STATIC_LIBRARY) + + diff --git a/Engine/lib/sdl/BUGS.txt b/Engine/lib/sdl/BUGS.txt index 6a4cbb7ad..a8e6b952e 100644 --- a/Engine/lib/sdl/BUGS.txt +++ b/Engine/lib/sdl/BUGS.txt @@ -7,9 +7,9 @@ You may report bugs there, and search to see if a given issue has already been reported, discussed, and maybe even fixed. -You may also find help on the SDL mailing list. Subscription information: +You may also find help at the SDL forums/mailing list: - http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org + https://discourse.libsdl.org/ Bug reports are welcome here, but we really appreciate if you use Bugzilla, as bugs discussed on the mailing list may be forgotten or missed. diff --git a/Engine/lib/sdl/CMakeLists.txt b/Engine/lib/sdl/CMakeLists.txt index ef82e73a0..8f1e828d1 100644 --- a/Engine/lib/sdl/CMakeLists.txt +++ b/Engine/lib/sdl/CMakeLists.txt @@ -2,7 +2,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there") endif() -cmake_minimum_required(VERSION 2.8.5) +cmake_minimum_required(VERSION 2.8.11) project(SDL2 C) # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property @@ -20,6 +20,7 @@ include(CheckLibraryExists) include(CheckIncludeFiles) include(CheckIncludeFile) include(CheckSymbolExists) +include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CheckTypeSize) @@ -41,11 +42,17 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 0) -set(SDL_MICRO_VERSION 5) -set(SDL_INTERFACE_AGE 1) -set(SDL_BINARY_AGE 5) +set(SDL_MICRO_VERSION 8) +set(SDL_INTERFACE_AGE 0) +set(SDL_BINARY_AGE 8) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") +# Set defaults preventing destination file conflicts +set(SDL_CMAKE_DEBUG_POSTFIX "d" + CACHE STRING "Name suffix for debug builds") + +mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX) + # Calculate a libtool-like version number math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}") math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") @@ -137,7 +144,9 @@ endif() # Default option knobs if(APPLE OR ARCH_64) - set(OPT_DEF_SSEMATH ON) + if(NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm") + set(OPT_DEF_SSEMATH ON) + endif() endif() if(UNIX OR MINGW OR MSYS) set(OPT_DEF_LIBC ON) @@ -157,6 +166,10 @@ else() set(OPT_DEF_ASM FALSE) endif() +if(USE_GCC OR USE_CLANG) + set(OPT_DEF_GCC_ATOMICS ON) +endif() + # Default flags, if not set otherwise if("$ENV{CFLAGS}" STREQUAL "") if(CMAKE_BUILD_TYPE STREQUAL "") @@ -220,6 +233,11 @@ endif() add_definitions(-DUSING_GENERATED_CONFIG_H) # General includes include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include) +if(USE_GCC OR USE_CLANG) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter ${SDL2_SOURCE_DIR}/src/video/khronos") +else() + include_directories(${SDL2_SOURCE_DIR}/src/video/khronos) +endif() # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so # you only need to have a platform override them if they are disabling. @@ -255,20 +273,19 @@ endforeach() option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") #set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) set_option(LIBC "Use the system C library" ${OPT_DEF_LIBC}) -set_option(GCC_ATOMICS "Use gcc builtin atomics" ${USE_GCC}) +set_option(GCC_ATOMICS "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS}) set_option(ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM}) set_option(SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH}) set_option(MMX "Use MMX assembly routines" ${OPT_DEF_ASM}) set_option(3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM}) set_option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM}) set_option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH}) +set_option(SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH}) set_option(ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM}) set_option(DISKAUDIO "Support the disk writer audio driver" ON) set_option(DUMMYAUDIO "Support the dummy audio driver" ON) set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF) dep_option(DIRECTFB_SHARED "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF) -set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) -dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) set_option(VIDEO_DUMMY "Use dummy video driver" ON) set_option(VIDEO_OPENGL "Include OpenGL support" ON) set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON) @@ -278,6 +295,8 @@ set_option(SDL_DLOPEN "Use dlopen for shared object loading" ${SDL_DLOP set_option(OSS "Support the OSS audio API" ${UNIX_SYS}) set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS}) dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF) +set_option(JACK "Support the JACK audio API" ${UNIX_SYS}) +dep_option(JACK_SHARED "Dynamically load JACK audio support" ON "JACK" OFF) set_option(ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS}) dep_option(ESD_SHARED "Dynamically load ESD audio support" ON "ESD" OFF) set_option(PULSEAUDIO "Use PulseAudio" ${UNIX_SYS}) @@ -287,6 +306,10 @@ dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" O set_option(NAS "Support the NAS audio API" ${UNIX_SYS}) set_option(NAS_SHARED "Dynamically load NAS audio API" ${UNIX_SYS}) set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS}) +set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) +dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) +set_option(LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS}) +dep_option(LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "LIBSAMPLERATE" OFF) set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF) set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS}) @@ -307,6 +330,9 @@ set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE}) set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS}) set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS}) set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) +dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF) +set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS}) +dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF) # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here # The options below are for compatibility to configure's default behaviour. @@ -314,6 +340,7 @@ set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared versi set(SDL_STATIC ON CACHE BOOL "Build a static version of the library") dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) +set_option(SDL_TEST "Build the test directory" OFF) # General source files file(GLOB SOURCE_FILES @@ -330,7 +357,8 @@ file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/stdlib/*.c ${SDL2_SOURCE_DIR}/src/thread/*.c ${SDL2_SOURCE_DIR}/src/timer/*.c - ${SDL2_SOURCE_DIR}/src/video/*.c) + ${SDL2_SOURCE_DIR}/src/video/*.c + ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) if(ASSERTIONS STREQUAL "auto") @@ -414,11 +442,15 @@ if(USE_GCC OR USE_CLANG) list(APPEND EXTRA_CFLAGS "-Wshadow") endif() - set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") - check_c_compiler_flag("" HAVE_NO_UNDEFINED) - set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) - if(HAVE_NO_UNDEFINED) - list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") + if(APPLE) + list(APPEND EXTRA_LDFLAGS "-Wl,-undefined,error") + else() + set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") + check_c_compiler_flag("" HAVE_NO_UNDEFINED) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + if(HAVE_NO_UNDEFINED) + list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") + endif() endif() endif() @@ -514,15 +546,43 @@ if(ASSEMBLY) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) endif() - if(SSEMATH) - if(SSE OR SSE2) + if(SSE3) + set(CMAKE_REQUIRED_FLAGS "-msse3") + check_c_source_compiles(" + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE3__ + #error Assembler CPP flag not enabled + #endif + int main(int argc, char **argv) { }" HAVE_SSE3) + if(HAVE_SSE3) + list(APPEND EXTRA_CFLAGS "-msse3") + endif() + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + endif() + + if(NOT SSEMATH) + if(SSE OR SSE2 OR SSE3) if(USE_GCC) - list(APPEND EXTRA_CFLAGS "-mfpmath=387") + check_c_compiler_flag(-mfpmath=387 HAVE_FP_387) + if(HAVE_FP_387) + list(APPEND EXTRA_CFLAGS "-mfpmath=387") + endif() endif() set(HAVE_SSEMATH TRUE) endif() endif() + check_include_file("immintrin.h" HAVE_IMMINTRIN_H) + if(ALTIVEC) set(CMAKE_REQUIRED_FLAGS "-maltivec") check_c_source_compiles(" @@ -555,12 +615,13 @@ if(ASSEMBLY) endif() set(HAVE_SSE TRUE) set(HAVE_SSE2 TRUE) + set(HAVE_SSE3 TRUE) set(SDL_ASSEMBLY_ROUTINES 1) endif() # TODO: #else() # if(USE_GCC OR USE_CLANG) -# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx") +# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-sse3" "-mno-mmx") # endif() endif() @@ -569,7 +630,7 @@ endif() if(LIBC) if(WINDOWS AND NOT MINGW) set(HAVE_LIBC TRUE) - foreach(_HEADER stdio.h string.h ctype.h math.h) + foreach(_HEADER stdio.h string.h wchar.h ctype.h math.h limits.h) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REPLACE "." "_" _HAVE_H ${_UPPER}) set(${_HAVE_H} 1) @@ -577,10 +638,13 @@ if(LIBC) set(HAVE_SIGNAL_H 1) foreach(_FN malloc calloc realloc free qsort abs memset memcpy memmove memcmp + wcslen wcscmp strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp - _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos - cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf) + _stricmp _strnicmp sscanf + acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf + copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf + log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) string(TOUPPER ${_FN} _UPPER) set(HAVE_${_UPPER} 1) endforeach() @@ -594,8 +658,8 @@ if(LIBC) set(HAVE_LIBC TRUE) check_include_file(sys/types.h HAVE_SYS_TYPES_H) foreach(_HEADER - stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h - strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) + stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h + strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REPLACE "." "_" _HAVE_H ${_UPPER}) check_include_file("${_HEADER}" ${_HAVE_H}) @@ -611,11 +675,11 @@ if(LIBC) foreach(_FN strtod malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat - strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa + _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp - vsscanf vsnprintf fseeko fseeko64 sigaction setjmp - nanosleep sysconf sysctlbyname + vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp + nanosleep sysconf sysctlbyname getauxval poll ) string(TOUPPER ${_FN} _UPPER) set(_HAVEVAR "HAVE_${_UPPER}") @@ -725,8 +789,19 @@ endif() if(ANDROID) file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES}) + + # SDL_spinlock.c Needs to be compiled in ARM mode. + # There seems to be no better way currently to set the ARM mode. + # see: https://issuetracker.google.com/issues/62264618 + # Another option would be to set ARM mode to all compiled files + check_c_compiler_flag(-marm HAVE_ARM_MODE) + if(HAVE_ARM_MODE) + set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) + endif() + file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MAIN_SOURCES}) + set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${ANDROID_MAIN_SOURCES}) + if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_ANDROID 1) file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c) @@ -739,33 +814,78 @@ if(ANDROID) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() + if(SDL_HAPTIC) + set(SDL_HAPTIC_ANDROID 1) + file(GLOB ANDROID_HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/android/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_HAPTIC_SOURCES}) + set(HAVE_SDL_HAPTIC TRUE) + endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_ANDROID 1) - file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c) + file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() + if(SDL_LOADSO) + set(SDL_LOADSO_DLOPEN 1) + file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) + set(HAVE_SDL_LOADSO TRUE) + endif() if(SDL_POWER) set(SDL_POWER_ANDROID 1) file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() + if(SDL_TIMERS) + set(SDL_TIMER_UNIX 1) + file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + set(HAVE_SDL_TIMERS TRUE) + endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_ANDROID 1) file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) + # Core stuff + find_library(ANDROID_DL_LIBRARY dl) + find_library(ANDROID_LOG_LIBRARY log) + find_library(ANDROID_LIBRARY_LIBRARY android) + list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_LOG_LIBRARY} ${ANDROID_LIBRARY_LIBRARY}) + add_definitions(-DGL_GLEXT_PROTOTYPES) + #enable gles if(VIDEO_OPENGLES) set(SDL_VIDEO_OPENGL_EGL 1) set(HAVE_VIDEO_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_RENDER_OGL_ES2 1) + + find_library(OpenGLES1_LIBRARY GLESv1_CM) + find_library(OpenGLES2_LIBRARY GLESv2) + list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY}) + endif() + + CHECK_C_SOURCE_COMPILES(" + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + int main() + { + return 0; + } + " VULKAN_PASSED_ANDROID_CHECKS) + if(NOT VULKAN_PASSED_ANDROID_CHECKS) + set(VIDEO_VULKAN OFF) + message(STATUS "Vulkan doesn't work on this configuration") endif() endif() - list(APPEND EXTRA_LDFLAGS "-Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit") + + CheckPTHREAD() + endif() # Platform-specific options and settings @@ -821,17 +941,17 @@ if(EMSCRIPTEN) set(SDL_VIDEO_RENDER_OGL_ES2 1) endif() endif() -elseif(UNIX AND NOT APPLE) +elseif(UNIX AND NOT APPLE AND NOT ANDROID) if(SDL_AUDIO) if(SYSV5 OR SOLARIS OR HPUX) set(SDL_AUDIO_DRIVER_SUNAUDIO 1) file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${SUN_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) - elseif(NETBSD OR OPENBSD) - set(SDL_AUDIO_DRIVER_BSD 1) - file(GLOB BSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/bsd/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${BSD_AUDIO_SOURCES}) + elseif(NETBSD) + set(SDL_AUDIO_DRIVER_NETBSD 1) + file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(AIX) set(SDL_AUDIO_DRIVER_PAUDIO 1) @@ -841,12 +961,14 @@ elseif(UNIX AND NOT APPLE) endif() CheckOSS() CheckALSA() + CheckJACK() CheckPulseAudio() CheckESD() CheckARTS() CheckNAS() CheckSNDIO() CheckFusionSound() + CheckLibSampleRate() endif() if(SDL_VIDEO) @@ -859,6 +981,12 @@ elseif(UNIX AND NOT APPLE) CheckOpenGLESX11() CheckWayland() CheckVivante() + CheckKMSDRM() + endif() + + if(UNIX) + file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_UNIX_SOURCES}) endif() if(LINUX) @@ -880,8 +1008,8 @@ elseif(UNIX AND NOT APPLE) ioctl(0, KDGKBENT, &kbe); }" HAVE_INPUT_KD) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) + file(GLOB CORE_LINUX_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_LINUX_SOURCES}) if(HAVE_INPUT_EVENTS) set(SDL_INPUT_LINUXEV 1) @@ -917,7 +1045,6 @@ elseif(UNIX AND NOT APPLE) endif() check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H) - endif() if(INPUT_TSLIB) @@ -934,7 +1061,7 @@ elseif(UNIX AND NOT APPLE) CheckUSBHID() # seems to be BSD specific - limit the test to BSD only? if(LINUX AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -1013,9 +1140,9 @@ elseif(WINDOWS) if(MSVC) # Prevent codegen that would use the VC runtime libraries. - add_definitions(/GS-) + set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-") if(NOT ARCH_64) - add_definitions(/arch:SSE) + set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") endif() endif() @@ -1037,6 +1164,16 @@ elseif(WINDOWS) #include #include int main(int argc, char **argv) { }" HAVE_XINPUT_H) + check_c_source_compiles(" + #include + #include + XINPUT_GAMEPAD_EX x1; + int main(int argc, char **argv) { }" HAVE_XINPUT_GAMEPAD_EX) + check_c_source_compiles(" + #include + #include + XINPUT_STATE_EX s1; + int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX) else() check_include_file(xinput.h HAVE_XINPUT_H) endif() @@ -1046,9 +1183,10 @@ elseif(WINDOWS) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) - check_include_file(xaudio2.h HAVE_XAUDIO2_H) + check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H) + check_include_file(audioclient.h HAVE_AUDIOCLIENT_H) check_include_file(dxgi.h HAVE_DXGI_H) - if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H) + if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) set(HAVE_DIRECTX TRUE) if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks @@ -1071,10 +1209,10 @@ elseif(WINDOWS) set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) endif() - if(HAVE_XAUDIO2_H) - set(SDL_AUDIO_DRIVER_XAUDIO2 1) - file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES}) + if(HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) + set(SDL_AUDIO_DRIVER_WASAPI 1) + file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES}) endif() endif() @@ -1166,6 +1304,11 @@ elseif(WINDOWS) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) list(APPEND EXTRA_LIBS dinput8) + if(CMAKE_COMPILER_IS_MINGW) + list(APPEND EXTRA_LIBS dxerr8) + elseif (NOT USE_WINSDK_DIRECTX) + list(APPEND EXTRA_LIBS dxerr) + endif() endif() if(HAVE_XINPUT_H) set(SDL_JOYSTICK_XINPUT 1) @@ -1202,15 +1345,25 @@ elseif(WINDOWS) list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows") endif() elseif(APPLE) - # TODO: rework this for proper MacOS X, iOS and Darwin support + # TODO: rework this all for proper MacOS X, iOS and Darwin support + + # We always need these libs on macOS at the moment. + # !!! FIXME: we need Carbon for some very old API calls in + # !!! FIXME: src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out + # !!! FIXME: how to dump those. + if(NOT IOS) + set(SDL_FRAMEWORK_COCOA 1) + set(SDL_FRAMEWORK_CARBON 1) + endif() # Requires the darwin file implementation if(SDL_FILE) file(GLOB EXTRA_SOURCES ${SDL2_SOURCE_DIR}/src/file/cocoa/*.m) set(SOURCE_FILES ${EXTRA_SOURCES} ${SOURCE_FILES}) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C) set(HAVE_SDL_FILE TRUE) - set(SDL_FRAMEWORK_COCOA 1) + # !!! FIXME: why is COREVIDEO inside this if() block? set(SDL_FRAMEWORK_COREVIDEO 1) else() message_error("SDL_FILE must be enabled to build on MacOS X") @@ -1219,6 +1372,8 @@ elseif(APPLE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. + set_source_files_properties(${AUDIO_SOURCES} PROPERTIES LANGUAGE C) set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) @@ -1228,7 +1383,7 @@ elseif(APPLE) if(SDL_JOYSTICK) set(SDL_JOYSTICK_IOKIT 1) if (IOS) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) else() file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) endif() @@ -1241,7 +1396,7 @@ elseif(APPLE) if(SDL_HAPTIC) set(SDL_HAPTIC_IOKIT 1) if (IOS) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) else() file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) @@ -1264,7 +1419,6 @@ elseif(APPLE) endif() set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) - set(SDL_FRAMEWORK_CARBON 1) set(SDL_FRAMEWORK_IOKIT 1) endif() @@ -1278,6 +1432,7 @@ elseif(APPLE) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_COCOA 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. set_source_files_properties(${FILESYSTEM_SOURCES} PROPERTIES LANGUAGE C) set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) @@ -1327,6 +1482,13 @@ elseif(APPLE) set(SDL_VIDEO_RENDER_OGL 1) set(HAVE_VIDEO_OPENGL TRUE) endif() + + if(VIDEO_OPENGLES) + set(SDL_VIDEO_OPENGL_EGL 1) + set(SDL_VIDEO_OPENGL_ES2 1) + set(SDL_VIDEO_RENDER_OGL_ES2 1) + set(HAVE_VIDEO_OPENGLES TRUE) + endif() endif() endif() @@ -1363,6 +1525,10 @@ elseif(HAIKU) CheckPTHREAD() endif() +if(VIDEO_VULKAN) + set(SDL_VIDEO_VULKAN 1) +endif() + # Dummies # configure.in does it differently: # if not have X @@ -1529,11 +1695,17 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") # Always build SDLmain add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) +target_include_directories(SDL2main PUBLIC $) set(_INSTALL_LIBS "SDL2main") +if (NOT ANDROID) + set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) +endif() if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) - if(UNIX) + if(APPLE) + set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1) + elseif(UNIX AND NOT ANDROID) set_target_properties(SDL2 PROPERTIES VERSION ${LT_VERSION} SOVERSION ${LT_REVISION} @@ -1544,7 +1716,7 @@ if(SDL_SHARED) SOVERSION ${LT_REVISION} OUTPUT_NAME "SDL2") endif() - if(MSVC) + if(MSVC AND NOT LIBC) # Don't try to link with the default set of libraries. set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") @@ -1552,14 +1724,24 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2 PUBLIC $) + if (NOT ANDROID) + set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) + endif() endif() if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + if (NOT SDL_SHARED OR NOT WIN32) + set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + # Note: Apparently, OUTPUT_NAME must really be unique; even when + # CMAKE_IMPORT_LIBRARY_SUFFIX or the like are given. Otherwise + # the static build may race with the import lib and one will get + # clobbered, when the suffix is realized via subsequent rename. + endif() set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) - if(MSVC) + if(MSVC AND NOT LIBC) set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") @@ -1568,14 +1750,55 @@ if(SDL_STATIC) # libraries - do we need to consider this? set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2-static PUBLIC $) + if (NOT ANDROID) + set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) + endif() +endif() + +##### Tests ##### + +if(SDL_TEST) + file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) + add_library(SDL2_test STATIC ${TEST_SOURCES}) + + add_subdirectory(test) endif() ##### Installation targets ##### -install(TARGETS ${_INSTALL_LIBS} +install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}" RUNTIME DESTINATION bin) +##### Export files ##### +if (APPLE) + set(PKG_PREFIX "SDL2.framework/Resources") +elseif (WINDOWS) + set(PKG_PREFIX "cmake") +else () + set(PKG_PREFIX "lib/cmake/SDL2") +endif () + +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" + VERSION ${SDL_VERSION} + COMPATIBILITY AnyNewerVersion +) + +install(EXPORT SDL2Targets + FILE SDL2Targets.cmake + NAMESPACE SDL2:: + DESTINATION ${PKG_PREFIX} +) +install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake + ${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake + DESTINATION ${PKG_PREFIX} + COMPONENT Devel +) + file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) foreach(_FNAME ${BIN_INCLUDE_FILES}) @@ -1592,10 +1815,12 @@ if(NOT (WINDOWS OR CYGWIN)) else() set(SOEXT "so") endif() - install(CODE " - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}") + if(NOT ANDROID) + install(CODE " + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")") + install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}") + endif() endif() if(FREEBSD) # FreeBSD uses ${PREFIX}/libdata/pkgconfig @@ -1611,10 +1836,12 @@ endif() ##### Uninstall target ##### -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) -add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() diff --git a/Engine/lib/sdl/COPYING.txt b/Engine/lib/sdl/COPYING.txt index dd9574e06..694e58a09 100644 --- a/Engine/lib/sdl/COPYING.txt +++ b/Engine/lib/sdl/COPYING.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2016 Sam Lantinga +Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/INSTALL.txt b/Engine/lib/sdl/INSTALL.txt index 66e5706f7..9ee4ef538 100644 --- a/Engine/lib/sdl/INSTALL.txt +++ b/Engine/lib/sdl/INSTALL.txt @@ -5,7 +5,7 @@ To compile and install SDL: * Read VisualC.html Windows with gcc, either native or cross-compiling: - * Read the FAQ at http://wiki.libsdl.org/moin.fcg/FAQWindows + * Read the FAQ at https://wiki.libsdl.org/moin.fcg/FAQWindows * Run './configure; make; make install' Mac OS X with Xcode: @@ -27,14 +27,14 @@ To compile and install SDL: * Read docs/README-cmake.md 2. Look at the example programs in ./test, and check out the online - documentation at http://wiki.libsdl.org/ + documentation at https://wiki.libsdl.org/ 3. Join the SDL developer mailing list by sending E-mail to sdl-request@libsdl.org and put "subscribe" in the subject of the message. Or alternatively you can use the web interface: - http://www.libsdl.org/mailing-list.php + https://www.libsdl.org/mailing-list.php That's it! Sam Lantinga diff --git a/Engine/lib/sdl/Makefile.in b/Engine/lib/sdl/Makefile.in index a7cbddf26..fe566523d 100644 --- a/Engine/lib/sdl/Makefile.in +++ b/Engine/lib/sdl/Makefile.in @@ -36,15 +36,15 @@ GEN_HEADERS = @GEN_HEADERS@ GEN_OBJECTS = @GEN_OBJECTS@ VERSION_OBJECTS = @VERSION_OBJECTS@ -SDLMAIN_TARGET = libSDL2main.a +SDLMAIN_TARGET = libSDL2main.la SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ -SDLTEST_TARGET = libSDL2_test.a +SDLTEST_TARGET = libSDL2_test.la SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ -SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS +SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS GEN_DIST = SDL2.spec ifneq ($V,1) @@ -112,6 +112,7 @@ HDRS = \ SDL_types.h \ SDL_version.h \ SDL_video.h \ + SDL_vulkan.h \ begin_code.h \ close_code.h @@ -121,14 +122,12 @@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ -LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) $(srcdir)/configure: $(srcdir)/configure.in - @echo "Warning, configure.in is out of date" - #(cd $(srcdir) && sh autogen.sh && sh configure) - @sleep 3 + @echo "Warning, configure is out of date, please re-run autogen.sh" Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -147,12 +146,10 @@ $(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS) - $(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS) - $(RUN_CMD_RANLIB)$(RANLIB) $@ + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLMAIN_OBJECTS) -rpath $(libdir) $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS) - $(RUN_CMD_AR)$(AR) cru $@ $(SDLTEST_OBJECTS) - $(RUN_CMD_RANLIB)$(RANLIB) $@ + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLTEST_OBJECTS) -rpath $(libdir) install: all install-bin install-hdrs install-lib install-data install-bin: @@ -173,10 +170,8 @@ install-hdrs: update-revision install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir) $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET) - $(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) - $(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) - $(INSTALL) -m 644 $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) - $(RANLIB) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) install-data: $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4 diff --git a/Engine/lib/sdl/Makefile.pandora b/Engine/lib/sdl/Makefile.pandora index 8b78f2734..56f171b4e 100644 --- a/Engine/lib/sdl/Makefile.pandora +++ b/Engine/lib/sdl/Makefile.pandora @@ -8,7 +8,7 @@ STRIP = arm-none-linux-gnueabi-strip CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \ -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \ - -I./include -I$(PNDSDK)/usr/include -DSDL_REVISION=0 + -I./include -I$(PNDSDK)/usr/include TARGET = libSDL.a @@ -25,7 +25,7 @@ SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \ OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') -CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h && touch include/SDL_revision.h) +CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h) all: $(TARGET) diff --git a/Engine/lib/sdl/README-SDL.txt b/Engine/lib/sdl/README-SDL.txt index 8eaf051f7..8d92955a9 100644 --- a/Engine/lib/sdl/README-SDL.txt +++ b/Engine/lib/sdl/README-SDL.txt @@ -6,7 +6,7 @@ designed to make it easy to write multi-media software, such as games and emulators. The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ +https://www.libsdl.org/ This library is distributed under the terms of the zlib license: http://www.zlib.net/zlib_license.html diff --git a/Engine/lib/sdl/README.txt b/Engine/lib/sdl/README.txt index f76a633ba..431ba0e74 100644 --- a/Engine/lib/sdl/README.txt +++ b/Engine/lib/sdl/README.txt @@ -6,7 +6,7 @@ Version 2.0 --- -http://www.libsdl.org/ +https://www.libsdl.org/ Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics diff --git a/Engine/lib/sdl/SDL2.spec b/Engine/lib/sdl/SDL2.spec index 5dfda5802..26454b74a 100644 --- a/Engine/lib/sdl/SDL2.spec +++ b/Engine/lib/sdl/SDL2.spec @@ -1,6 +1,6 @@ Summary: Simple DirectMedia Layer Name: SDL2 -Version: 2.0.5 +Version: 2.0.8 Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz URL: http://www.libsdl.org/ diff --git a/Engine/lib/sdl/SDL2Config.cmake b/Engine/lib/sdl/SDL2Config.cmake new file mode 100644 index 000000000..4a5f64602 --- /dev/null +++ b/Engine/lib/sdl/SDL2Config.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") diff --git a/Engine/lib/sdl/WhatsNew.txt b/Engine/lib/sdl/WhatsNew.txt index 1979ac2b3..48fe2510a 100644 --- a/Engine/lib/sdl/WhatsNew.txt +++ b/Engine/lib/sdl/WhatsNew.txt @@ -1,6 +1,137 @@ This is a list of major changes in SDL's version history. +--------------------------------------------------------------------------- +2.0.8: +--------------------------------------------------------------------------- + +General: +* Added SDL_fmod() and SDL_log10() +* Each of the SDL math functions now has the corresponding float version +* Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709 + +Windows: +* Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation +* Added resampling support on WASAPI on Windows 7 and above + +Windows UWP: +* Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on + +Mac OS X: +* Added support for the Vulkan SDK for Mac: + https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/ +* Added support for OpenGL ES using ANGLE when it's available + +Mac OS X / iOS / tvOS: +* Added a Metal 2D render implementation +* Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation + +iOS: +* Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications. + +iOS / Android: +* Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default) + +Android: +* SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant +* SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1) +* Added SDL_IsAndroidTV() to tell whether the application is running on Android TV + +Android / tvOS: +* Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events. + +Linux: +* Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1" +* Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default) + + +--------------------------------------------------------------------------- +2.0.7: +--------------------------------------------------------------------------- + +General: +* Added audio stream conversion functions: + SDL_NewAudioStream + SDL_AudioStreamPut + SDL_AudioStreamGet + SDL_AudioStreamAvailable + SDL_AudioStreamFlush + SDL_AudioStreamClear + SDL_FreeAudioStream +* Added functions to query and set the SDL memory allocation functions: + SDL_GetMemoryFunctions() + SDL_SetMemoryFunctions() + SDL_GetNumAllocations() +* Added locking functions for multi-threaded access to the joystick and game controller APIs: + SDL_LockJoysticks() + SDL_UnlockJoysticks() +* The following functions are now thread-safe: + SDL_SetEventFilter() + SDL_GetEventFilter() + SDL_AddEventWatch() + SDL_DelEventWatch() + + +General: +--------------------------------------------------------------------------- +2.0.6: +--------------------------------------------------------------------------- + +General: +* Added cross-platform Vulkan graphics support in SDL_vulkan.h + SDL_Vulkan_LoadLibrary() + SDL_Vulkan_GetVkGetInstanceProcAddr() + SDL_Vulkan_GetInstanceExtensions() + SDL_Vulkan_CreateSurface() + SDL_Vulkan_GetDrawableSize() + SDL_Vulkan_UnloadLibrary() + This is all the platform-specific code you need to bring up Vulkan on all SDL platforms. You can look at an example in test/testvulkan.c +* Added SDL_ComposeCustomBlendMode() to create custom blend modes for 2D rendering +* Added SDL_HasNEON() which returns whether the CPU has NEON instruction support +* Added support for many game controllers, including the Nintendo Switch Pro Controller +* Added support for inverted axes and separate axis directions in game controller mappings +* Added functions to return information about a joystick before it's opened: + SDL_JoystickGetDeviceVendor() + SDL_JoystickGetDeviceProduct() + SDL_JoystickGetDeviceProductVersion() + SDL_JoystickGetDeviceType() + SDL_JoystickGetDeviceInstanceID() +* Added functions to return information about an open joystick: + SDL_JoystickGetVendor() + SDL_JoystickGetProduct() + SDL_JoystickGetProductVersion() + SDL_JoystickGetType() + SDL_JoystickGetAxisInitialState() +* Added functions to return information about an open game controller: + SDL_GameControllerGetVendor() + SDL_GameControllerGetProduct() + SDL_GameControllerGetProductVersion() +* Added SDL_GameControllerNumMappings() and SDL_GameControllerMappingForIndex() to be able to enumerate the built-in game controller mappings +* Added SDL_LoadFile() and SDL_LoadFile_RW() to load a file into memory +* Added SDL_DuplicateSurface() to make a copy of a surface +* Added an experimental JACK audio driver +* Implemented non-power-of-two audio resampling, optionally using libsamplerate to perform the resampling +* Added the hint SDL_HINT_AUDIO_RESAMPLING_MODE to control the quality of resampling +* Added the hint SDL_HINT_RENDER_LOGICAL_SIZE_MODE to control the scaling policy for SDL_RenderSetLogicalSize(): + "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen (the default) + "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen +* Added the hints SDL_HINT_MOUSE_NORMAL_SPEED_SCALE and SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE to scale the mouse speed when being read from raw mouse input +* Added the hint SDL_HINT_TOUCH_MOUSE_EVENTS to control whether SDL will synthesize mouse events from touch events + +Windows: +* The new default audio driver on Windows is WASAPI and supports hot-plugging devices and changing the default audio device +* The old XAudio2 audio driver is deprecated and will be removed in the next release +* Added hints SDL_HINT_WINDOWS_INTRESOURCE_ICON and SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL to specify a custom icon resource ID for SDL windows +* The hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING is now on by default for compatibility with .NET languages and various Windows debuggers +* Updated the GUID format for game controller mappings, older mappings will be automatically converted on load +* Implemented the SDL_WINDOW_ALWAYS_ON_TOP flag on Windows + +Linux: +* Added an experimental KMS/DRM video driver for embedded development + +iOS: +* Added a hint SDL_HINT_AUDIO_CATEGORY to control the audio category, determining whether the phone mute switch affects the audio + --------------------------------------------------------------------------- 2.0.5: --------------------------------------------------------------------------- diff --git a/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist b/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist deleted file mode 100644 index da4183466..000000000 --- a/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleGetInfoString - http://www.libsdl.org - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Simple DirectMedia Layer - CFBundlePackageType - FMWK - CFBundleShortVersionString - 2.0.5 - CFBundleSignature - SDLX - CFBundleVersion - 2.0.5 - - diff --git a/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj deleted file mode 100755 index 1f16953cf..000000000 --- a/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ /dev/null @@ -1,3004 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; - 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; - 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; - 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; - 04043BBB12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */; }; - 04043BBC12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */; }; - 041B2CA512FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; - 041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; - 041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; - 041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; - 0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; }; - 0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; - 043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; }; - 043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; - 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; - 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; - 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; - 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; - 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; - 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; - 0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; }; - 0442EC1912FE1BBA004C9285 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; }; - 0442EC1C12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */; }; - 0442EC1D12FE1BCB004C9285 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */; }; - 0442EC1E12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */; }; - 0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */; }; - 0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */; }; - 0442EC5B12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */; }; - 0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */; }; - 0442EC5D12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */; }; - 0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5E12FE1C75004C9285 /* SDL_hints.c */; }; - 0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5E12FE1C75004C9285 /* SDL_hints.c */; }; - 04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; }; - 04BAC0C91300C2160055DE28 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; }; - 04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; - 04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; - 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - 04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; - 04BD002612E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; - 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; - 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; - 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; - 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; - 04BD002D12E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; - 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; - 04BD003512E6671800899322 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDC312E6671700899322 /* SDL_wave.c */; }; - 04BD003612E6671800899322 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; - 04BD004112E6671800899322 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */; }; - 04BD004212E6671800899322 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; - 04BD004312E6671800899322 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD712E6671700899322 /* default_cursor.h */; }; - 04BD004412E6671800899322 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD812E6671700899322 /* scancodes_darwin.h */; }; - 04BD004512E6671800899322 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD912E6671700899322 /* scancodes_linux.h */; }; - 04BD004712E6671800899322 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */; }; - 04BD004812E6671800899322 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */; }; - 04BD004912E6671800899322 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */; }; - 04BD004A12E6671800899322 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDE12E6671700899322 /* SDL_events.c */; }; - 04BD004B12E6671800899322 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDF12E6671700899322 /* SDL_events_c.h */; }; - 04BD004C12E6671800899322 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE012E6671700899322 /* SDL_gesture.c */; }; - 04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE112E6671700899322 /* SDL_gesture_c.h */; }; - 04BD004E12E6671800899322 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE212E6671700899322 /* SDL_keyboard.c */; }; - 04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */; }; - 04BD005012E6671800899322 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE412E6671700899322 /* SDL_mouse.c */; }; - 04BD005112E6671800899322 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE512E6671700899322 /* SDL_mouse_c.h */; }; - 04BD005212E6671800899322 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE612E6671700899322 /* SDL_quit.c */; }; - 04BD005312E6671800899322 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE712E6671700899322 /* SDL_sysevents.h */; }; - 04BD005412E6671800899322 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE812E6671700899322 /* SDL_touch.c */; }; - 04BD005512E6671800899322 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE912E6671700899322 /* SDL_touch_c.h */; }; - 04BD005612E6671800899322 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEA12E6671700899322 /* SDL_windowevents.c */; }; - 04BD005712E6671800899322 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */; }; - 04BD005812E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */; }; - 04BD005912E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */; }; - 04BD005A12E6671800899322 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF012E6671700899322 /* SDL_rwops.c */; }; - 04BD005B12E6671800899322 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF312E6671700899322 /* SDL_syshaptic.c */; }; - 04BD005F12E6671800899322 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDFA12E6671700899322 /* SDL_haptic.c */; }; - 04BD006012E6671800899322 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */; }; - 04BD006112E6671800899322 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */; }; - 04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */; }; - 04BD006712E6671800899322 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */; }; - 04BD007012E6671800899322 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE1612E6671700899322 /* SDL_joystick.c */; }; - 04BD007112E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; - 04BD007212E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; - 04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; - 04BD009412E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; - 04BD009612E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; - 04BD009B12E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; - 04BD009C12E6671800899322 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5612E6671700899322 /* SDL_assert.c */; }; - 04BD009E12E6671800899322 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5812E6671700899322 /* SDL_error_c.h */; }; - 04BD009F12E6671800899322 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5912E6671700899322 /* SDL_error.c */; }; - 04BD00A212E6671800899322 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5C12E6671700899322 /* SDL.c */; }; - 04BD00A312E6671800899322 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5E12E6671700899322 /* SDL_getenv.c */; }; - 04BD00A412E6671800899322 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5F12E6671700899322 /* SDL_iconv.c */; }; - 04BD00A512E6671800899322 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6012E6671700899322 /* SDL_malloc.c */; }; - 04BD00A612E6671800899322 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6112E6671700899322 /* SDL_qsort.c */; }; - 04BD00A712E6671800899322 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6212E6671700899322 /* SDL_stdlib.c */; }; - 04BD00A812E6671800899322 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6312E6671700899322 /* SDL_string.c */; }; - 04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7E12E6671800899322 /* SDL_syscond.c */; }; - 04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */; }; - 04BD00BF12E6671800899322 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */; }; - 04BD00C012E6671800899322 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8112E6671800899322 /* SDL_syssem.c */; }; - 04BD00C112E6671800899322 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8212E6671800899322 /* SDL_systhread.c */; }; - 04BD00C212E6671800899322 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8312E6671800899322 /* SDL_systhread_c.h */; }; - 04BD00C912E6671800899322 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8B12E6671800899322 /* SDL_systhread.h */; }; - 04BD00CA12E6671800899322 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8C12E6671800899322 /* SDL_thread.c */; }; - 04BD00CB12E6671800899322 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8D12E6671800899322 /* SDL_thread_c.h */; }; - 04BD00D712E6671800899322 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE9F12E6671800899322 /* SDL_timer.c */; }; - 04BD00D812E6671800899322 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEA012E6671800899322 /* SDL_timer_c.h */; }; - 04BD00D912E6671800899322 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEA212E6671800899322 /* SDL_systimer.c */; }; - 04BD00F312E6671800899322 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */; }; - 04BD00F412E6671800899322 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */; }; - 04BD00F512E6671800899322 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */; }; - 04BD00F612E6671800899322 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */; }; - 04BD00F712E6671800899322 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */; }; - 04BD00F812E6671800899322 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */; }; - 04BD00F912E6671800899322 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */; }; - 04BD00FA12E6671800899322 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */; }; - 04BD00FB12E6671800899322 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */; }; - 04BD00FC12E6671800899322 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */; }; - 04BD00FD12E6671800899322 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */; }; - 04BD00FE12E6671800899322 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */; }; - 04BD00FF12E6671800899322 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECE12E6671800899322 /* SDL_cocoashape.h */; }; - 04BD010012E6671800899322 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECF12E6671800899322 /* SDL_cocoashape.m */; }; - 04BD010112E6671800899322 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED012E6671800899322 /* SDL_cocoavideo.h */; }; - 04BD010212E6671800899322 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED112E6671800899322 /* SDL_cocoavideo.m */; }; - 04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED212E6671800899322 /* SDL_cocoawindow.h */; }; - 04BD010412E6671800899322 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED312E6671800899322 /* SDL_cocoawindow.m */; }; - 04BD011712E6671800899322 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEE812E6671800899322 /* SDL_nullevents.c */; }; - 04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; - 04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; - 04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; - 04BD017512E6671800899322 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4E12E6671800899322 /* SDL_blit.c */; }; - 04BD017612E6671800899322 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4F12E6671800899322 /* SDL_blit.h */; }; - 04BD017712E6671800899322 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5012E6671800899322 /* SDL_blit_0.c */; }; - 04BD017812E6671800899322 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5112E6671800899322 /* SDL_blit_1.c */; }; - 04BD017912E6671800899322 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5212E6671800899322 /* SDL_blit_A.c */; }; - 04BD017A12E6671800899322 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5312E6671800899322 /* SDL_blit_auto.c */; }; - 04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5412E6671800899322 /* SDL_blit_auto.h */; }; - 04BD017C12E6671800899322 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5512E6671800899322 /* SDL_blit_copy.c */; }; - 04BD017D12E6671800899322 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5612E6671800899322 /* SDL_blit_copy.h */; }; - 04BD017E12E6671800899322 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5712E6671800899322 /* SDL_blit_N.c */; }; - 04BD017F12E6671800899322 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5812E6671800899322 /* SDL_blit_slow.c */; }; - 04BD018012E6671800899322 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5912E6671800899322 /* SDL_blit_slow.h */; }; - 04BD018112E6671800899322 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; }; - 04BD018212E6671800899322 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; }; - 04BD018712E6671800899322 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; }; - 04BD018C12E6671800899322 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; }; - 04BD018D12E6671800899322 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; }; - 04BD018E12E6671800899322 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; }; - 04BD019612E6671800899322 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */; }; - 04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */; }; - 04BD019812E6671800899322 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7112E6671800899322 /* SDL_shape.c */; }; - 04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7212E6671800899322 /* SDL_shape_internals.h */; }; - 04BD019A12E6671800899322 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7312E6671800899322 /* SDL_stretch.c */; }; - 04BD019B12E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; - 04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; - 04BD019D12E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; - 04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; - 04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; - 04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; - 04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */; }; - 04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */; }; - 04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; }; - 04BD01E112E6671800899322 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; }; - 04BD01E212E6671800899322 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; }; - 04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; }; - 04BD01E612E6671800899322 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; }; - 04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; }; - 04BD01E812E6671800899322 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC512E6671800899322 /* SDL_x11modes.h */; }; - 04BD01E912E6671800899322 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC612E6671800899322 /* SDL_x11mouse.c */; }; - 04BD01EA12E6671800899322 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC712E6671800899322 /* SDL_x11mouse.h */; }; - 04BD01EB12E6671800899322 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC812E6671800899322 /* SDL_x11opengl.c */; }; - 04BD01EC12E6671800899322 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC912E6671800899322 /* SDL_x11opengl.h */; }; - 04BD01ED12E6671800899322 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */; }; - 04BD01EE12E6671800899322 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */; }; - 04BD01F112E6671800899322 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCE12E6671800899322 /* SDL_x11shape.c */; }; - 04BD01F212E6671800899322 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCF12E6671800899322 /* SDL_x11shape.h */; }; - 04BD01F312E6671800899322 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD012E6671800899322 /* SDL_x11sym.h */; }; - 04BD01F412E6671800899322 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD112E6671800899322 /* SDL_x11touch.c */; }; - 04BD01F512E6671800899322 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD212E6671800899322 /* SDL_x11touch.h */; }; - 04BD01F612E6671800899322 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; }; - 04BD01F712E6671800899322 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; }; - 04BD01F812E6671800899322 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; }; - 04BD01F912E6671800899322 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; }; - 04BD021712E6671800899322 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7412E6671700899322 /* SDL_atomic.c */; }; - 04BD021812E6671800899322 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; - 04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; - 04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; - 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - 04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; - 04BD024212E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; - 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; - 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; - 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; - 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; - 04BD024912E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; - 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; - 04BD025112E6671800899322 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDC312E6671700899322 /* SDL_wave.c */; }; - 04BD025212E6671800899322 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; - 04BD025C12E6671800899322 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */; }; - 04BD025D12E6671800899322 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; - 04BD025E12E6671800899322 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD712E6671700899322 /* default_cursor.h */; }; - 04BD025F12E6671800899322 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD812E6671700899322 /* scancodes_darwin.h */; }; - 04BD026012E6671800899322 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD912E6671700899322 /* scancodes_linux.h */; }; - 04BD026212E6671800899322 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */; }; - 04BD026312E6671800899322 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */; }; - 04BD026412E6671800899322 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */; }; - 04BD026512E6671800899322 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDE12E6671700899322 /* SDL_events.c */; }; - 04BD026612E6671800899322 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDF12E6671700899322 /* SDL_events_c.h */; }; - 04BD026712E6671800899322 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE012E6671700899322 /* SDL_gesture.c */; }; - 04BD026812E6671800899322 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE112E6671700899322 /* SDL_gesture_c.h */; }; - 04BD026912E6671800899322 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE212E6671700899322 /* SDL_keyboard.c */; }; - 04BD026A12E6671800899322 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */; }; - 04BD026B12E6671800899322 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE412E6671700899322 /* SDL_mouse.c */; }; - 04BD026C12E6671800899322 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE512E6671700899322 /* SDL_mouse_c.h */; }; - 04BD026D12E6671800899322 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE612E6671700899322 /* SDL_quit.c */; }; - 04BD026E12E6671800899322 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE712E6671700899322 /* SDL_sysevents.h */; }; - 04BD026F12E6671800899322 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE812E6671700899322 /* SDL_touch.c */; }; - 04BD027012E6671800899322 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE912E6671700899322 /* SDL_touch_c.h */; }; - 04BD027112E6671800899322 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEA12E6671700899322 /* SDL_windowevents.c */; }; - 04BD027212E6671800899322 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */; }; - 04BD027312E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */; }; - 04BD027412E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */; }; - 04BD027512E6671800899322 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF012E6671700899322 /* SDL_rwops.c */; }; - 04BD027612E6671800899322 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF312E6671700899322 /* SDL_syshaptic.c */; }; - 04BD027A12E6671800899322 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDFA12E6671700899322 /* SDL_haptic.c */; }; - 04BD027B12E6671800899322 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */; }; - 04BD027C12E6671800899322 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */; }; - 04BD028112E6671800899322 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */; }; - 04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */; }; - 04BD028B12E6671800899322 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE1612E6671700899322 /* SDL_joystick.c */; }; - 04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; - 04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; - 04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; - 04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; - 04BD02B012E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; - 04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; - 04BD02B612E6671800899322 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5612E6671700899322 /* SDL_assert.c */; }; - 04BD02B812E6671800899322 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5812E6671700899322 /* SDL_error_c.h */; }; - 04BD02B912E6671800899322 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5912E6671700899322 /* SDL_error.c */; }; - 04BD02BC12E6671800899322 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5C12E6671700899322 /* SDL.c */; }; - 04BD02BD12E6671800899322 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5E12E6671700899322 /* SDL_getenv.c */; }; - 04BD02BE12E6671800899322 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5F12E6671700899322 /* SDL_iconv.c */; }; - 04BD02BF12E6671800899322 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6012E6671700899322 /* SDL_malloc.c */; }; - 04BD02C012E6671800899322 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6112E6671700899322 /* SDL_qsort.c */; }; - 04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6212E6671700899322 /* SDL_stdlib.c */; }; - 04BD02C212E6671800899322 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6312E6671700899322 /* SDL_string.c */; }; - 04BD02D712E6671800899322 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7E12E6671800899322 /* SDL_syscond.c */; }; - 04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */; }; - 04BD02D912E6671800899322 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */; }; - 04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8112E6671800899322 /* SDL_syssem.c */; }; - 04BD02DB12E6671800899322 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8212E6671800899322 /* SDL_systhread.c */; }; - 04BD02DC12E6671800899322 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8312E6671800899322 /* SDL_systhread_c.h */; }; - 04BD02E312E6671800899322 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8B12E6671800899322 /* SDL_systhread.h */; }; - 04BD02E412E6671800899322 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8C12E6671800899322 /* SDL_thread.c */; }; - 04BD02E512E6671800899322 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8D12E6671800899322 /* SDL_thread_c.h */; }; - 04BD02F112E6671800899322 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE9F12E6671800899322 /* SDL_timer.c */; }; - 04BD02F212E6671800899322 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEA012E6671800899322 /* SDL_timer_c.h */; }; - 04BD02F312E6671800899322 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEA212E6671800899322 /* SDL_systimer.c */; }; - 04BD030D12E6671800899322 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */; }; - 04BD030E12E6671800899322 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */; }; - 04BD030F12E6671800899322 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */; }; - 04BD031012E6671800899322 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */; }; - 04BD031112E6671800899322 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */; }; - 04BD031212E6671800899322 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */; }; - 04BD031312E6671800899322 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */; }; - 04BD031412E6671800899322 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */; }; - 04BD031512E6671800899322 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */; }; - 04BD031612E6671800899322 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */; }; - 04BD031712E6671800899322 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */; }; - 04BD031812E6671800899322 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */; }; - 04BD031912E6671800899322 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECE12E6671800899322 /* SDL_cocoashape.h */; }; - 04BD031A12E6671800899322 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECF12E6671800899322 /* SDL_cocoashape.m */; }; - 04BD031B12E6671800899322 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED012E6671800899322 /* SDL_cocoavideo.h */; }; - 04BD031C12E6671800899322 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED112E6671800899322 /* SDL_cocoavideo.m */; }; - 04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED212E6671800899322 /* SDL_cocoawindow.h */; }; - 04BD031E12E6671800899322 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED312E6671800899322 /* SDL_cocoawindow.m */; }; - 04BD033112E6671800899322 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEE812E6671800899322 /* SDL_nullevents.c */; }; - 04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; - 04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; - 04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; - 04BD038F12E6671800899322 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4E12E6671800899322 /* SDL_blit.c */; }; - 04BD039012E6671800899322 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4F12E6671800899322 /* SDL_blit.h */; }; - 04BD039112E6671800899322 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5012E6671800899322 /* SDL_blit_0.c */; }; - 04BD039212E6671800899322 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5112E6671800899322 /* SDL_blit_1.c */; }; - 04BD039312E6671800899322 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5212E6671800899322 /* SDL_blit_A.c */; }; - 04BD039412E6671800899322 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5312E6671800899322 /* SDL_blit_auto.c */; }; - 04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5412E6671800899322 /* SDL_blit_auto.h */; }; - 04BD039612E6671800899322 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5512E6671800899322 /* SDL_blit_copy.c */; }; - 04BD039712E6671800899322 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5612E6671800899322 /* SDL_blit_copy.h */; }; - 04BD039812E6671800899322 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5712E6671800899322 /* SDL_blit_N.c */; }; - 04BD039912E6671800899322 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5812E6671800899322 /* SDL_blit_slow.c */; }; - 04BD039A12E6671800899322 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5912E6671800899322 /* SDL_blit_slow.h */; }; - 04BD039B12E6671800899322 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; }; - 04BD039C12E6671800899322 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; }; - 04BD03A112E6671800899322 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; }; - 04BD03A612E6671800899322 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; }; - 04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; }; - 04BD03A812E6671800899322 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; }; - 04BD03B012E6671800899322 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */; }; - 04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */; }; - 04BD03B212E6671800899322 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7112E6671800899322 /* SDL_shape.c */; }; - 04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7212E6671800899322 /* SDL_shape_internals.h */; }; - 04BD03B412E6671800899322 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7312E6671800899322 /* SDL_stretch.c */; }; - 04BD03B512E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; - 04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; - 04BD03B712E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; - 04BD03F312E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; - 04BD03F412E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; - 04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; - 04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */; }; - 04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */; }; - 04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; }; - 04BD03F912E6671800899322 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; }; - 04BD03FA12E6671800899322 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; }; - 04BD03FD12E6671800899322 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; }; - 04BD03FE12E6671800899322 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; }; - 04BD03FF12E6671800899322 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; }; - 04BD040012E6671800899322 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC512E6671800899322 /* SDL_x11modes.h */; }; - 04BD040112E6671800899322 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC612E6671800899322 /* SDL_x11mouse.c */; }; - 04BD040212E6671800899322 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC712E6671800899322 /* SDL_x11mouse.h */; }; - 04BD040312E6671800899322 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC812E6671800899322 /* SDL_x11opengl.c */; }; - 04BD040412E6671800899322 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC912E6671800899322 /* SDL_x11opengl.h */; }; - 04BD040512E6671800899322 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */; }; - 04BD040612E6671800899322 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */; }; - 04BD040912E6671800899322 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCE12E6671800899322 /* SDL_x11shape.c */; }; - 04BD040A12E6671800899322 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCF12E6671800899322 /* SDL_x11shape.h */; }; - 04BD040B12E6671800899322 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD012E6671800899322 /* SDL_x11sym.h */; }; - 04BD040C12E6671800899322 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD112E6671800899322 /* SDL_x11touch.c */; }; - 04BD040D12E6671800899322 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD212E6671800899322 /* SDL_x11touch.h */; }; - 04BD040E12E6671800899322 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; }; - 04BD040F12E6671800899322 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; }; - 04BD041012E6671800899322 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; }; - 04BD041112E6671800899322 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; }; - 04BDFFFB12E6671800899322 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7412E6671700899322 /* SDL_atomic.c */; }; - 04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; - 04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; }; - 04F7803A12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; }; - 04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; }; - 04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; }; - 04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; }; - 04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; }; - 04F7804B12FB74A200FC43C0 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */; }; - 04F7804C12FB74A200FC43C0 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804012FB74A200FC43C0 /* SDL_blendline.h */; }; - 04F7804D12FB74A200FC43C0 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */; }; - 04F7804E12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */; }; - 04F7804F12FB74A200FC43C0 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804312FB74A200FC43C0 /* SDL_draw.h */; }; - 04F7805012FB74A200FC43C0 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804412FB74A200FC43C0 /* SDL_drawline.c */; }; - 04F7805112FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; - 04F7805212FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; - 04F7805312FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; - 04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; }; - 04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; }; - 04F7805712FB74A200FC43C0 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */; }; - 04F7805812FB74A200FC43C0 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804012FB74A200FC43C0 /* SDL_blendline.h */; }; - 04F7805912FB74A200FC43C0 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */; }; - 04F7805A12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */; }; - 04F7805B12FB74A200FC43C0 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804312FB74A200FC43C0 /* SDL_draw.h */; }; - 04F7805C12FB74A200FC43C0 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804412FB74A200FC43C0 /* SDL_drawline.c */; }; - 04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; - 04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; - 04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; - 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; - 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; - 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; - 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; - 566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */; }; - 566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; - 567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; - 567E2F2117C44C35005F1892 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 56A670091856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; }; - 56A6700A1856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; }; - 56A6700B1856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; }; - 56A67021185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; }; - 56A67022185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; }; - 56A67023185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; }; - 56A67024185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; }; - 56A67025185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; }; - 56A67026185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; }; - 56A67027185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; }; - 56A67028185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; }; - 56A67029185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; }; - 56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; - 56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; - 56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; - 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; - 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; - 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; - 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; - A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; - A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; - A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; - AA0F8491178D5ECC00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8490178D5ECC00823F9D /* SDL_systls.c */; }; - AA0F8492178D5ECC00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8490178D5ECC00823F9D /* SDL_systls.c */; }; - AA0F8493178D5ECC00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8490178D5ECC00823F9D /* SDL_systls.c */; }; - AA41F88014B8F1F500993C4F /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; - AA628ACA159367B7005138DD /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AC8159367B7005138DD /* SDL_rotate.c */; }; - AA628ACB159367B7005138DD /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AC8159367B7005138DD /* SDL_rotate.c */; }; - AA628ACC159367B7005138DD /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AC9159367B7005138DD /* SDL_rotate.h */; }; - AA628ACD159367B7005138DD /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AC9159367B7005138DD /* SDL_rotate.h */; }; - AA628AD1159367F2005138DD /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; - AA628AD2159367F2005138DD /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; - AA628AD3159367F2005138DD /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AD0159367F2005138DD /* SDL_x11xinput2.h */; }; - AA628AD4159367F2005138DD /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AD0159367F2005138DD /* SDL_x11xinput2.h */; }; - AA7557FA1595D4D800BBD41B /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C71595D4D800BBD41B /* begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FB1595D4D800BBD41B /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C71595D4D800BBD41B /* begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FC1595D4D800BBD41B /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C81595D4D800BBD41B /* close_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FD1595D4D800BBD41B /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C81595D4D800BBD41B /* close_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FE1595D4D800BBD41B /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C91595D4D800BBD41B /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FF1595D4D800BBD41B /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C91595D4D800BBD41B /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558001595D4D800BBD41B /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CA1595D4D800BBD41B /* SDL_atomic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558011595D4D800BBD41B /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CA1595D4D800BBD41B /* SDL_atomic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558031595D4D800BBD41B /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558051595D4D800BBD41B /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558071595D4D800BBD41B /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558081595D4D800BBD41B /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558091595D4D800BBD41B /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580B1595D4D800BBD41B /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580C1595D4D800BBD41B /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580D1595D4D800BBD41B /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580E1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580F1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558101595D4D800BBD41B /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558111595D4D800BBD41B /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558121595D4D800BBD41B /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D31595D4D800BBD41B /* SDL_error.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558131595D4D800BBD41B /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D31595D4D800BBD41B /* SDL_error.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558141595D4D800BBD41B /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D41595D4D800BBD41B /* SDL_events.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558151595D4D800BBD41B /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D41595D4D800BBD41B /* SDL_events.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558161595D4D800BBD41B /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558171595D4D800BBD41B /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558181595D4D800BBD41B /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558191595D4D800BBD41B /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581A1595D4D800BBD41B /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D71595D4D800BBD41B /* SDL_hints.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581B1595D4D800BBD41B /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D71595D4D800BBD41B /* SDL_hints.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D91595D4D800BBD41B /* SDL_joystick.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581F1595D4D800BBD41B /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D91595D4D800BBD41B /* SDL_joystick.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558211595D4D800BBD41B /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558231595D4D800BBD41B /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558251595D4D800BBD41B /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558261595D4D800BBD41B /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DD1595D4D800BBD41B /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558271595D4D800BBD41B /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DD1595D4D800BBD41B /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558281595D4D800BBD41B /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DE1595D4D800BBD41B /* SDL_main.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558291595D4D800BBD41B /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DE1595D4D800BBD41B /* SDL_main.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582A1595D4D800BBD41B /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DF1595D4D800BBD41B /* SDL_mouse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582B1595D4D800BBD41B /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DF1595D4D800BBD41B /* SDL_mouse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582C1595D4D800BBD41B /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E01595D4D800BBD41B /* SDL_mutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582D1595D4D800BBD41B /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E01595D4D800BBD41B /* SDL_mutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582E1595D4D800BBD41B /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E11595D4D800BBD41B /* SDL_name.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582F1595D4D800BBD41B /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E11595D4D800BBD41B /* SDL_name.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558301595D4D800BBD41B /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E21595D4D800BBD41B /* SDL_opengl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558311595D4D800BBD41B /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E21595D4D800BBD41B /* SDL_opengl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558321595D4D800BBD41B /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E31595D4D800BBD41B /* SDL_opengles.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558331595D4D800BBD41B /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E31595D4D800BBD41B /* SDL_opengles.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558341595D4D800BBD41B /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E41595D4D800BBD41B /* SDL_opengles2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558351595D4D800BBD41B /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E41595D4D800BBD41B /* SDL_opengles2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558361595D4D800BBD41B /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E51595D4D800BBD41B /* SDL_pixels.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558371595D4D800BBD41B /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E51595D4D800BBD41B /* SDL_pixels.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558381595D4D800BBD41B /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E61595D4D800BBD41B /* SDL_platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558391595D4D800BBD41B /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E61595D4D800BBD41B /* SDL_platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583A1595D4D800BBD41B /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E71595D4D800BBD41B /* SDL_power.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583B1595D4D800BBD41B /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E71595D4D800BBD41B /* SDL_power.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583C1595D4D800BBD41B /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583D1595D4D800BBD41B /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583E1595D4D800BBD41B /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E91595D4D800BBD41B /* SDL_rect.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583F1595D4D800BBD41B /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E91595D4D800BBD41B /* SDL_rect.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558401595D4D800BBD41B /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EA1595D4D800BBD41B /* SDL_render.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558411595D4D800BBD41B /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EA1595D4D800BBD41B /* SDL_render.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558421595D4D800BBD41B /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EB1595D4D800BBD41B /* SDL_revision.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558431595D4D800BBD41B /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EB1595D4D800BBD41B /* SDL_revision.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558441595D4D800BBD41B /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EC1595D4D800BBD41B /* SDL_rwops.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558451595D4D800BBD41B /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EC1595D4D800BBD41B /* SDL_rwops.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558461595D4D800BBD41B /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557ED1595D4D800BBD41B /* SDL_scancode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558471595D4D800BBD41B /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557ED1595D4D800BBD41B /* SDL_scancode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558481595D4D800BBD41B /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EE1595D4D800BBD41B /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558491595D4D800BBD41B /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EE1595D4D800BBD41B /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584A1595D4D800BBD41B /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584B1595D4D800BBD41B /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584C1595D4D800BBD41B /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F01595D4D800BBD41B /* SDL_surface.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584D1595D4D800BBD41B /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F01595D4D800BBD41B /* SDL_surface.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584E1595D4D800BBD41B /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F11595D4D800BBD41B /* SDL_system.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584F1595D4D800BBD41B /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F11595D4D800BBD41B /* SDL_system.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558501595D4D800BBD41B /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F21595D4D800BBD41B /* SDL_syswm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558511595D4D800BBD41B /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F21595D4D800BBD41B /* SDL_syswm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558521595D4D800BBD41B /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F31595D4D800BBD41B /* SDL_thread.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558531595D4D800BBD41B /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F31595D4D800BBD41B /* SDL_thread.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558541595D4D800BBD41B /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F41595D4D800BBD41B /* SDL_timer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558551595D4D800BBD41B /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F41595D4D800BBD41B /* SDL_timer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558561595D4D800BBD41B /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F51595D4D800BBD41B /* SDL_touch.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558571595D4D800BBD41B /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F51595D4D800BBD41B /* SDL_touch.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558581595D4D800BBD41B /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F61595D4D800BBD41B /* SDL_types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558591595D4D800BBD41B /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F61595D4D800BBD41B /* SDL_types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585A1595D4D800BBD41B /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F71595D4D800BBD41B /* SDL_version.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585B1595D4D800BBD41B /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F71595D4D800BBD41B /* SDL_version.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585C1595D4D800BBD41B /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F81595D4D800BBD41B /* SDL_video.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585D1595D4D800BBD41B /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F81595D4D800BBD41B /* SDL_video.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585E1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585F1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA9E4093163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; - AA9E4094163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; - AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AABCC38D164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */; }; - AABCC38E164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */; }; - AABCC38F164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - AABCC390164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - AAC070F9195606770073DCDF /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F4195606770073DCDF /* SDL_opengl_glext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FA195606770073DCDF /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F4195606770073DCDF /* SDL_opengl_glext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FB195606770073DCDF /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F4195606770073DCDF /* SDL_opengl_glext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FC195606770073DCDF /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FF195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07100195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07102195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07103195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07104195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07105195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07106195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07107195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AADA5B8816CCAB3000107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BBFC088D164C6647003E6A99 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; - D55A1B81179F262300625D7C /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */; }; - D55A1B82179F262300625D7C /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */; }; - D55A1B83179F263500625D7C /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */; }; - D55A1B84179F263600625D7C /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */; }; - D55A1B85179F278E00625D7C /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */; }; - D55A1B86179F278F00625D7C /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */; }; - DB0F489317C400E6008798C5 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB0F489417C400ED008798C5 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB0F490817CA5292008798C5 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; - DB0F490A17CA5293008798C5 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; - DB0F490B17CA57ED008798C5 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB0F490C17CA57ED008798C5 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313F7417554B71006C0E22 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; - DB313F7517554B71006C0E22 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; - DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; - DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; - DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; - DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; - DB313F7D17554B71006C0E22 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD712E6671700899322 /* default_cursor.h */; }; - DB313F7E17554B71006C0E22 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD812E6671700899322 /* scancodes_darwin.h */; }; - DB313F7F17554B71006C0E22 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD912E6671700899322 /* scancodes_linux.h */; }; - DB313F8017554B71006C0E22 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */; }; - DB313F8117554B71006C0E22 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */; }; - DB313F8217554B71006C0E22 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDF12E6671700899322 /* SDL_events_c.h */; }; - DB313F8317554B71006C0E22 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE112E6671700899322 /* SDL_gesture_c.h */; }; - DB313F8417554B71006C0E22 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */; }; - DB313F8517554B71006C0E22 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE512E6671700899322 /* SDL_mouse_c.h */; }; - DB313F8617554B71006C0E22 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE712E6671700899322 /* SDL_sysevents.h */; }; - DB313F8717554B71006C0E22 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE912E6671700899322 /* SDL_touch_c.h */; }; - DB313F8817554B71006C0E22 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */; }; - DB313F8917554B71006C0E22 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */; }; - DB313F8A17554B71006C0E22 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */; }; - DB313F8B17554B71006C0E22 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */; }; - DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */; }; - DB313F8D17554B71006C0E22 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; - DB313F8E17554B71006C0E22 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; - DB313F8F17554B71006C0E22 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; - DB313F9017554B71006C0E22 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5812E6671700899322 /* SDL_error_c.h */; }; - DB313F9217554B71006C0E22 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */; }; - DB313F9317554B71006C0E22 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8312E6671800899322 /* SDL_systhread_c.h */; }; - DB313F9417554B71006C0E22 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8B12E6671800899322 /* SDL_systhread.h */; }; - DB313F9517554B71006C0E22 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8D12E6671800899322 /* SDL_thread_c.h */; }; - DB313F9617554B71006C0E22 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEA012E6671800899322 /* SDL_timer_c.h */; }; - DB313F9717554B71006C0E22 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */; }; - DB313F9817554B71006C0E22 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */; }; - DB313F9917554B71006C0E22 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */; }; - DB313F9A17554B71006C0E22 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */; }; - DB313F9B17554B71006C0E22 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */; }; - DB313F9C17554B71006C0E22 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */; }; - DB313F9D17554B71006C0E22 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECE12E6671800899322 /* SDL_cocoashape.h */; }; - DB313F9E17554B71006C0E22 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED012E6671800899322 /* SDL_cocoavideo.h */; }; - DB313F9F17554B71006C0E22 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED212E6671800899322 /* SDL_cocoawindow.h */; }; - DB313FA017554B71006C0E22 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; - DB313FA117554B71006C0E22 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; - DB313FA217554B71006C0E22 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4F12E6671800899322 /* SDL_blit.h */; }; - DB313FA317554B71006C0E22 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5412E6671800899322 /* SDL_blit_auto.h */; }; - DB313FA417554B71006C0E22 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5612E6671800899322 /* SDL_blit_copy.h */; }; - DB313FA517554B71006C0E22 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5912E6671800899322 /* SDL_blit_slow.h */; }; - DB313FA617554B71006C0E22 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; }; - DB313FA717554B71006C0E22 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */; }; - DB313FA817554B71006C0E22 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7212E6671800899322 /* SDL_shape_internals.h */; }; - DB313FA917554B71006C0E22 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; - DB313FAA17554B71006C0E22 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; - DB313FAB17554B71006C0E22 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */; }; - DB313FAC17554B71006C0E22 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; }; - DB313FAD17554B71006C0E22 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; }; - DB313FAE17554B71006C0E22 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; }; - DB313FAF17554B71006C0E22 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC512E6671800899322 /* SDL_x11modes.h */; }; - DB313FB017554B71006C0E22 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC712E6671800899322 /* SDL_x11mouse.h */; }; - DB313FB117554B71006C0E22 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC912E6671800899322 /* SDL_x11opengl.h */; }; - DB313FB217554B71006C0E22 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */; }; - DB313FB317554B71006C0E22 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCF12E6671800899322 /* SDL_x11shape.h */; }; - DB313FB417554B71006C0E22 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD012E6671800899322 /* SDL_x11sym.h */; }; - DB313FB517554B71006C0E22 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD212E6671800899322 /* SDL_x11touch.h */; }; - DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; }; - DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; }; - DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; - DB313FB917554B71006C0E22 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; - DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; }; - DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; }; - DB313FBD17554B71006C0E22 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804012FB74A200FC43C0 /* SDL_blendline.h */; }; - DB313FBE17554B71006C0E22 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */; }; - DB313FBF17554B71006C0E22 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804312FB74A200FC43C0 /* SDL_draw.h */; }; - DB313FC017554B71006C0E22 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; - DB313FC117554B71006C0E22 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; - DB313FC217554B71006C0E22 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */; }; - DB313FC317554B71006C0E22 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */; }; - DB313FC417554B71006C0E22 /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */; }; - DB313FC517554B71006C0E22 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; - DB313FC617554B71006C0E22 /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AC9159367B7005138DD /* SDL_rotate.h */; }; - DB313FC717554B71006C0E22 /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AD0159367F2005138DD /* SDL_x11xinput2.h */; }; - DB313FC817554B71006C0E22 /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C71595D4D800BBD41B /* begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FC917554B71006C0E22 /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C81595D4D800BBD41B /* close_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCA17554B71006C0E22 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C91595D4D800BBD41B /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCB17554B71006C0E22 /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CA1595D4D800BBD41B /* SDL_atomic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCC17554B71006C0E22 /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCF17554B71006C0E22 /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD017554B71006C0E22 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD217554B71006C0E22 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD317554B71006C0E22 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD417554B71006C0E22 /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D31595D4D800BBD41B /* SDL_error.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD517554B71006C0E22 /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D41595D4D800BBD41B /* SDL_events.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD617554B71006C0E22 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD717554B71006C0E22 /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD817554B71006C0E22 /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D71595D4D800BBD41B /* SDL_hints.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD917554B71006C0E22 /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D91595D4D800BBD41B /* SDL_joystick.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDC17554B71006C0E22 /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDD17554B71006C0E22 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DD1595D4D800BBD41B /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDE17554B71006C0E22 /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DE1595D4D800BBD41B /* SDL_main.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDF17554B71006C0E22 /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DF1595D4D800BBD41B /* SDL_mouse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE017554B71006C0E22 /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E01595D4D800BBD41B /* SDL_mutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE117554B71006C0E22 /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E11595D4D800BBD41B /* SDL_name.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE217554B71006C0E22 /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E21595D4D800BBD41B /* SDL_opengl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE317554B71006C0E22 /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E31595D4D800BBD41B /* SDL_opengles.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE417554B71006C0E22 /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E41595D4D800BBD41B /* SDL_opengles2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE517554B71006C0E22 /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E51595D4D800BBD41B /* SDL_pixels.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE617554B71006C0E22 /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E61595D4D800BBD41B /* SDL_platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE717554B71006C0E22 /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E71595D4D800BBD41B /* SDL_power.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE817554B71006C0E22 /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE917554B71006C0E22 /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E91595D4D800BBD41B /* SDL_rect.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEA17554B71006C0E22 /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EA1595D4D800BBD41B /* SDL_render.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEB17554B71006C0E22 /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EB1595D4D800BBD41B /* SDL_revision.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEC17554B71006C0E22 /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EC1595D4D800BBD41B /* SDL_rwops.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FED17554B71006C0E22 /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557ED1595D4D800BBD41B /* SDL_scancode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEE17554B71006C0E22 /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EE1595D4D800BBD41B /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEF17554B71006C0E22 /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF017554B71006C0E22 /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F01595D4D800BBD41B /* SDL_surface.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF117554B71006C0E22 /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F11595D4D800BBD41B /* SDL_system.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF217554B71006C0E22 /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F21595D4D800BBD41B /* SDL_syswm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF317554B71006C0E22 /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F31595D4D800BBD41B /* SDL_thread.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF417554B71006C0E22 /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F41595D4D800BBD41B /* SDL_timer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF517554B71006C0E22 /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F51595D4D800BBD41B /* SDL_touch.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF617554B71006C0E22 /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F61595D4D800BBD41B /* SDL_types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF717554B71006C0E22 /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F71595D4D800BBD41B /* SDL_version.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF817554B71006C0E22 /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F81595D4D800BBD41B /* SDL_video.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF917554B71006C0E22 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FFA17554B71006C0E22 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */; }; - DB313FFB17554B71006C0E22 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FFC17554B71006C0E22 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FFE17554B71006C0E22 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7412E6671700899322 /* SDL_atomic.c */; }; - DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; - DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; - DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - DB31400317554B71006C0E22 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; - DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; - DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; - DB31400617554B71006C0E22 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; - DB31400717554B71006C0E22 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; - DB31400817554B71006C0E22 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDC312E6671700899322 /* SDL_wave.c */; }; - DB31400917554B71006C0E22 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */; }; - DB31400A17554B71006C0E22 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */; }; - DB31400B17554B71006C0E22 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDE12E6671700899322 /* SDL_events.c */; }; - DB31400C17554B71006C0E22 /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; - DB31400D17554B71006C0E22 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE012E6671700899322 /* SDL_gesture.c */; }; - DB31400E17554B71006C0E22 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE212E6671700899322 /* SDL_keyboard.c */; }; - DB31400F17554B71006C0E22 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE412E6671700899322 /* SDL_mouse.c */; }; - DB31401017554B71006C0E22 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE612E6671700899322 /* SDL_quit.c */; }; - DB31401117554B71006C0E22 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE812E6671700899322 /* SDL_touch.c */; }; - DB31401217554B71006C0E22 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEA12E6671700899322 /* SDL_windowevents.c */; }; - DB31401317554B71006C0E22 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */; }; - DB31401417554B71006C0E22 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF012E6671700899322 /* SDL_rwops.c */; }; - DB31401517554B71006C0E22 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF312E6671700899322 /* SDL_syshaptic.c */; }; - DB31401617554B71006C0E22 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDFA12E6671700899322 /* SDL_haptic.c */; }; - DB31401717554B71006C0E22 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */; }; - DB31401817554B71006C0E22 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; - DB31401917554B71006C0E22 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE1612E6671700899322 /* SDL_joystick.c */; }; - DB31401A17554B71006C0E22 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; - DB31401B17554B71006C0E22 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; - DB31401C17554B71006C0E22 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; - DB31401D17554B71006C0E22 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5612E6671700899322 /* SDL_assert.c */; }; - DB31401E17554B71006C0E22 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5912E6671700899322 /* SDL_error.c */; }; - DB31402017554B71006C0E22 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5C12E6671700899322 /* SDL.c */; }; - DB31402117554B71006C0E22 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5E12E6671700899322 /* SDL_getenv.c */; }; - DB31402217554B71006C0E22 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5F12E6671700899322 /* SDL_iconv.c */; }; - DB31402317554B71006C0E22 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6012E6671700899322 /* SDL_malloc.c */; }; - DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6112E6671700899322 /* SDL_qsort.c */; }; - DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6212E6671700899322 /* SDL_stdlib.c */; }; - DB31402617554B71006C0E22 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6312E6671700899322 /* SDL_string.c */; }; - DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7E12E6671800899322 /* SDL_syscond.c */; }; - DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */; }; - DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8112E6671800899322 /* SDL_syssem.c */; }; - DB31402A17554B71006C0E22 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8212E6671800899322 /* SDL_systhread.c */; }; - DB31402B17554B71006C0E22 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8C12E6671800899322 /* SDL_thread.c */; }; - DB31402C17554B71006C0E22 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE9F12E6671800899322 /* SDL_timer.c */; }; - DB31402D17554B71006C0E22 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEA212E6671800899322 /* SDL_systimer.c */; }; - DB31402E17554B71006C0E22 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */; }; - DB31402F17554B71006C0E22 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */; }; - DB31403017554B71006C0E22 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */; }; - DB31403117554B71006C0E22 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */; }; - DB31403217554B71006C0E22 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */; }; - DB31403317554B71006C0E22 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */; }; - DB31403417554B71006C0E22 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECF12E6671800899322 /* SDL_cocoashape.m */; }; - DB31403517554B71006C0E22 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED112E6671800899322 /* SDL_cocoavideo.m */; }; - DB31403617554B71006C0E22 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED312E6671800899322 /* SDL_cocoawindow.m */; }; - DB31403717554B71006C0E22 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEE812E6671800899322 /* SDL_nullevents.c */; }; - DB31403817554B71006C0E22 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; - DB31403917554B71006C0E22 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4E12E6671800899322 /* SDL_blit.c */; }; - DB31403A17554B71006C0E22 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5012E6671800899322 /* SDL_blit_0.c */; }; - DB31403B17554B71006C0E22 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5112E6671800899322 /* SDL_blit_1.c */; }; - DB31403C17554B71006C0E22 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5212E6671800899322 /* SDL_blit_A.c */; }; - DB31403D17554B71006C0E22 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5312E6671800899322 /* SDL_blit_auto.c */; }; - DB31403E17554B71006C0E22 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5512E6671800899322 /* SDL_blit_copy.c */; }; - DB31403F17554B71006C0E22 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5712E6671800899322 /* SDL_blit_N.c */; }; - DB31404017554B71006C0E22 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5812E6671800899322 /* SDL_blit_slow.c */; }; - DB31404117554B71006C0E22 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; }; - DB31404217554B71006C0E22 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; }; - DB31404317554B71006C0E22 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; }; - DB31404417554B71006C0E22 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; }; - DB31404517554B71006C0E22 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; }; - DB31404617554B71006C0E22 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */; }; - DB31404717554B71006C0E22 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7112E6671800899322 /* SDL_shape.c */; }; - DB31404817554B71006C0E22 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7312E6671800899322 /* SDL_stretch.c */; }; - DB31404917554B71006C0E22 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; - DB31404A17554B71006C0E22 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; - DB31404B17554B71006C0E22 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; - DB31404C17554B71006C0E22 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; - DB31404D17554B71006C0E22 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */; }; - DB31404E17554B71006C0E22 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; }; - DB31404F17554B71006C0E22 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; }; - DB31405017554B71006C0E22 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; }; - DB31405117554B71006C0E22 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC612E6671800899322 /* SDL_x11mouse.c */; }; - DB31405217554B71006C0E22 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC812E6671800899322 /* SDL_x11opengl.c */; }; - DB31405317554B71006C0E22 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */; }; - DB31405417554B71006C0E22 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCE12E6671800899322 /* SDL_x11shape.c */; }; - DB31405517554B71006C0E22 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD112E6671800899322 /* SDL_x11touch.c */; }; - DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; }; - DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; }; - DB31405817554B71006C0E22 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; - DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; - DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; - DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; }; - DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; }; - DB31405D17554B71006C0E22 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */; }; - DB31405E17554B71006C0E22 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */; }; - DB31405F17554B71006C0E22 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804412FB74A200FC43C0 /* SDL_drawline.c */; }; - DB31406017554B71006C0E22 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; - DB31406117554B71006C0E22 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; }; - DB31406217554B71006C0E22 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */; }; - DB31406317554B71006C0E22 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */; }; - DB31406417554B71006C0E22 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5E12FE1C75004C9285 /* SDL_hints.c */; }; - DB31406517554B71006C0E22 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; }; - DB31406617554B71006C0E22 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; }; - DB31406717554B71006C0E22 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AC8159367B7005138DD /* SDL_rotate.c */; }; - DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; - DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; - DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; - DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; - DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; - FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; - FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; - FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; - FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - BECDF6C50761BA81005FE872 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BECDF5FE0761BA81005FE872; - remoteInfo = "Framework (Upgraded)"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; - 00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; - 00CFA89C106B4BA100758660 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 00D0D08310675DD9004B05EF /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_glfuncs.h; sourceTree = ""; }; - 041B2C9E12FA0D680087D585 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render.c; sourceTree = ""; }; - 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = ""; }; - 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gl.c; sourceTree = ""; }; - 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gl.h; sourceTree = ""; }; - 04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = ""; }; - 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; }; - 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; }; - 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; }; - 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gl.c; sourceTree = ""; }; - 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_render_sw_c.h; sourceTree = ""; }; - 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_sw.c; sourceTree = ""; }; - 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11framebuffer.c; sourceTree = ""; }; - 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11framebuffer.h; sourceTree = ""; }; - 0442EC5E12FE1C75004C9285 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hints.c; path = ../../src/SDL_hints.c; sourceTree = SOURCE_ROOT; }; - 04BAC0C71300C2160055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = ../../src/SDL_log.c; sourceTree = SOURCE_ROOT; }; - 04BDFD7412E6671700899322 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = ""; }; - 04BDFD7512E6671700899322 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = ""; }; - 04BDFD8812E6671700899322 /* SDL_diskaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_diskaudio.c; sourceTree = ""; }; - 04BDFD8912E6671700899322 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_diskaudio.h; sourceTree = ""; }; - 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummyaudio.c; sourceTree = ""; }; - 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummyaudio.h; sourceTree = ""; }; - 04BDFDA112E6671700899322 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = ""; }; - 04BDFDB412E6671700899322 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audio.c; sourceTree = ""; }; - 04BDFDB512E6671700899322 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_c.h; sourceTree = ""; }; - 04BDFDB612E6671700899322 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiocvt.c; sourceTree = ""; }; - 04BDFDB712E6671700899322 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiodev.c; sourceTree = ""; }; - 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiodev_c.h; sourceTree = ""; }; - 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiotypecvt.c; sourceTree = ""; }; - 04BDFDBB12E6671700899322 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mixer.c; sourceTree = ""; }; - 04BDFDC212E6671700899322 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysaudio.h; sourceTree = ""; }; - 04BDFDC312E6671700899322 /* SDL_wave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_wave.c; sourceTree = ""; }; - 04BDFDC412E6671700899322 /* SDL_wave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_wave.h; sourceTree = ""; }; - 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_cpuinfo.c; sourceTree = ""; }; - 04BDFDD612E6671700899322 /* blank_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blank_cursor.h; sourceTree = ""; }; - 04BDFDD712E6671700899322 /* default_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_cursor.h; sourceTree = ""; }; - 04BDFDD812E6671700899322 /* scancodes_darwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_darwin.h; sourceTree = ""; }; - 04BDFDD912E6671700899322 /* scancodes_linux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_linux.h; sourceTree = ""; }; - 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_xfree86.h; sourceTree = ""; }; - 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = ""; }; - 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = ""; }; - 04BDFDDE12E6671700899322 /* SDL_events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_events.c; sourceTree = ""; }; - 04BDFDDF12E6671700899322 /* SDL_events_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_events_c.h; sourceTree = ""; }; - 04BDFDE012E6671700899322 /* SDL_gesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gesture.c; sourceTree = ""; }; - 04BDFDE112E6671700899322 /* SDL_gesture_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gesture_c.h; sourceTree = ""; }; - 04BDFDE212E6671700899322 /* SDL_keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_keyboard.c; sourceTree = ""; }; - 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keyboard_c.h; sourceTree = ""; }; - 04BDFDE412E6671700899322 /* SDL_mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mouse.c; sourceTree = ""; }; - 04BDFDE512E6671700899322 /* SDL_mouse_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_mouse_c.h; sourceTree = ""; }; - 04BDFDE612E6671700899322 /* SDL_quit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_quit.c; sourceTree = ""; }; - 04BDFDE712E6671700899322 /* SDL_sysevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysevents.h; sourceTree = ""; }; - 04BDFDE812E6671700899322 /* SDL_touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_touch.c; sourceTree = ""; }; - 04BDFDE912E6671700899322 /* SDL_touch_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_touch_c.h; sourceTree = ""; }; - 04BDFDEA12E6671700899322 /* SDL_windowevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_windowevents.c; sourceTree = ""; }; - 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_windowevents_c.h; sourceTree = ""; }; - 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rwopsbundlesupport.h; sourceTree = ""; }; - 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_rwopsbundlesupport.m; sourceTree = ""; }; - 04BDFDF012E6671700899322 /* SDL_rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rwops.c; sourceTree = ""; }; - 04BDFDF312E6671700899322 /* SDL_syshaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syshaptic.c; sourceTree = ""; }; - 04BDFDFA12E6671700899322 /* SDL_haptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_haptic.c; sourceTree = ""; }; - 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_haptic_c.h; sourceTree = ""; }; - 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic.h; sourceTree = ""; }; - 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysjoystick.c; sourceTree = ""; }; - 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick_c.h; sourceTree = ""; }; - 04BDFE1612E6671700899322 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_joystick.c; sourceTree = ""; }; - 04BDFE1712E6671700899322 /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick_c.h; sourceTree = ""; }; - 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick.h; sourceTree = ""; }; - 04BDFE3312E6671700899322 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = ""; }; - 04BDFE4B12E6671700899322 /* SDL_syspower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syspower.c; sourceTree = ""; }; - 04BDFE4E12E6671700899322 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = ""; }; - 04BDFE5512E6671700899322 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = ../../src/SDL_assert_c.h; sourceTree = SOURCE_ROOT; }; - 04BDFE5612E6671700899322 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5812E6671700899322 /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error_c.h; path = ../../src/SDL_error_c.h; sourceTree = SOURCE_ROOT; }; - 04BDFE5912E6671700899322 /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_error.c; path = ../../src/SDL_error.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5C12E6671700899322 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5E12E6671700899322 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_getenv.c; sourceTree = ""; }; - 04BDFE5F12E6671700899322 /* SDL_iconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_iconv.c; sourceTree = ""; }; - 04BDFE6012E6671700899322 /* SDL_malloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_malloc.c; sourceTree = ""; }; - 04BDFE6112E6671700899322 /* SDL_qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_qsort.c; sourceTree = ""; }; - 04BDFE6212E6671700899322 /* SDL_stdlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_stdlib.c; sourceTree = ""; }; - 04BDFE6312E6671700899322 /* SDL_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_string.c; sourceTree = ""; }; - 04BDFE7E12E6671800899322 /* SDL_syscond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syscond.c; sourceTree = ""; }; - 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysmutex.c; sourceTree = ""; }; - 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysmutex_c.h; sourceTree = ""; }; - 04BDFE8112E6671800899322 /* SDL_syssem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syssem.c; sourceTree = ""; }; - 04BDFE8212E6671800899322 /* SDL_systhread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systhread.c; sourceTree = ""; }; - 04BDFE8312E6671800899322 /* SDL_systhread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_systhread_c.h; sourceTree = ""; }; - 04BDFE8B12E6671800899322 /* SDL_systhread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_systhread.h; sourceTree = ""; }; - 04BDFE8C12E6671800899322 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_thread.c; sourceTree = ""; }; - 04BDFE8D12E6671800899322 /* SDL_thread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_thread_c.h; sourceTree = ""; }; - 04BDFE9F12E6671800899322 /* SDL_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_timer.c; sourceTree = ""; }; - 04BDFEA012E6671800899322 /* SDL_timer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_timer_c.h; sourceTree = ""; }; - 04BDFEA212E6671800899322 /* SDL_systimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systimer.c; sourceTree = ""; }; - 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaclipboard.h; sourceTree = ""; }; - 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaclipboard.m; sourceTree = ""; }; - 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaevents.h; sourceTree = ""; }; - 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaevents.m; sourceTree = ""; }; - 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoakeyboard.h; sourceTree = ""; }; - 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoakeyboard.m; sourceTree = ""; }; - 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamodes.h; sourceTree = ""; }; - 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamodes.m; sourceTree = ""; }; - 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamouse.h; sourceTree = ""; }; - 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamouse.m; sourceTree = ""; }; - 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaopengl.h; sourceTree = ""; }; - 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaopengl.m; sourceTree = ""; }; - 04BDFECE12E6671800899322 /* SDL_cocoashape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoashape.h; sourceTree = ""; }; - 04BDFECF12E6671800899322 /* SDL_cocoashape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoashape.m; sourceTree = ""; }; - 04BDFED012E6671800899322 /* SDL_cocoavideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoavideo.h; sourceTree = ""; }; - 04BDFED112E6671800899322 /* SDL_cocoavideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoavideo.m; sourceTree = ""; }; - 04BDFED212E6671800899322 /* SDL_cocoawindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoawindow.h; sourceTree = ""; }; - 04BDFED312E6671800899322 /* SDL_cocoawindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoawindow.m; sourceTree = ""; }; - 04BDFEE812E6671800899322 /* SDL_nullevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullevents.c; sourceTree = ""; }; - 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = ""; }; - 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = ""; }; - 04BDFEED12E6671800899322 /* SDL_nullvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullvideo.h; sourceTree = ""; }; - 04BDFF4E12E6671800899322 /* SDL_blit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit.c; sourceTree = ""; }; - 04BDFF4F12E6671800899322 /* SDL_blit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit.h; sourceTree = ""; }; - 04BDFF5012E6671800899322 /* SDL_blit_0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_0.c; sourceTree = ""; }; - 04BDFF5112E6671800899322 /* SDL_blit_1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_1.c; sourceTree = ""; }; - 04BDFF5212E6671800899322 /* SDL_blit_A.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_A.c; sourceTree = ""; }; - 04BDFF5312E6671800899322 /* SDL_blit_auto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_auto.c; sourceTree = ""; }; - 04BDFF5412E6671800899322 /* SDL_blit_auto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit_auto.h; sourceTree = ""; }; - 04BDFF5512E6671800899322 /* SDL_blit_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_copy.c; sourceTree = ""; }; - 04BDFF5612E6671800899322 /* SDL_blit_copy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit_copy.h; sourceTree = ""; }; - 04BDFF5712E6671800899322 /* SDL_blit_N.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_N.c; sourceTree = ""; }; - 04BDFF5812E6671800899322 /* SDL_blit_slow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_slow.c; sourceTree = ""; }; - 04BDFF5912E6671800899322 /* SDL_blit_slow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit_slow.h; sourceTree = ""; }; - 04BDFF5A12E6671800899322 /* SDL_bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_bmp.c; sourceTree = ""; }; - 04BDFF5B12E6671800899322 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = ""; }; - 04BDFF6012E6671800899322 /* SDL_fillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_fillrect.c; sourceTree = ""; }; - 04BDFF6512E6671800899322 /* SDL_pixels.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_pixels.c; sourceTree = ""; }; - 04BDFF6612E6671800899322 /* SDL_pixels_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_pixels_c.h; sourceTree = ""; }; - 04BDFF6712E6671800899322 /* SDL_rect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rect.c; sourceTree = ""; }; - 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_RLEaccel.c; sourceTree = ""; }; - 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_RLEaccel_c.h; sourceTree = ""; }; - 04BDFF7112E6671800899322 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = ""; }; - 04BDFF7212E6671800899322 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape_internals.h; sourceTree = ""; }; - 04BDFF7312E6671800899322 /* SDL_stretch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_stretch.c; sourceTree = ""; }; - 04BDFF7412E6671800899322 /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = ""; }; - 04BDFF7512E6671800899322 /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = ""; }; - 04BDFF7612E6671800899322 /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = ""; }; - 04BDFFB812E6671800899322 /* imKStoUCS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imKStoUCS.c; sourceTree = ""; }; - 04BDFFB912E6671800899322 /* imKStoUCS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imKStoUCS.h; sourceTree = ""; }; - 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = ""; }; - 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11clipboard.h; sourceTree = ""; }; - 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11dyn.c; sourceTree = ""; }; - 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11dyn.h; sourceTree = ""; }; - 04BDFFBE12E6671800899322 /* SDL_x11events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11events.c; sourceTree = ""; }; - 04BDFFBF12E6671800899322 /* SDL_x11events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11events.h; sourceTree = ""; }; - 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11keyboard.c; sourceTree = ""; }; - 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11keyboard.h; sourceTree = ""; }; - 04BDFFC412E6671800899322 /* SDL_x11modes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11modes.c; sourceTree = ""; }; - 04BDFFC512E6671800899322 /* SDL_x11modes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11modes.h; sourceTree = ""; }; - 04BDFFC612E6671800899322 /* SDL_x11mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11mouse.c; sourceTree = ""; }; - 04BDFFC712E6671800899322 /* SDL_x11mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11mouse.h; sourceTree = ""; }; - 04BDFFC812E6671800899322 /* SDL_x11opengl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11opengl.c; sourceTree = ""; }; - 04BDFFC912E6671800899322 /* SDL_x11opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11opengl.h; sourceTree = ""; }; - 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11opengles.c; sourceTree = ""; }; - 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11opengles.h; sourceTree = ""; }; - 04BDFFCE12E6671800899322 /* SDL_x11shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11shape.c; sourceTree = ""; }; - 04BDFFCF12E6671800899322 /* SDL_x11shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11shape.h; sourceTree = ""; }; - 04BDFFD012E6671800899322 /* SDL_x11sym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11sym.h; sourceTree = ""; }; - 04BDFFD112E6671800899322 /* SDL_x11touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11touch.c; sourceTree = ""; }; - 04BDFFD212E6671800899322 /* SDL_x11touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11touch.h; sourceTree = ""; }; - 04BDFFD312E6671800899322 /* SDL_x11video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11video.c; sourceTree = ""; }; - 04BDFFD412E6671800899322 /* SDL_x11video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11video.h; sourceTree = ""; }; - 04BDFFD512E6671800899322 /* SDL_x11window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11window.c; sourceTree = ""; }; - 04BDFFD612E6671800899322 /* SDL_x11window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11window.h; sourceTree = ""; }; - 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullframebuffer_c.h; sourceTree = ""; }; - 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullframebuffer.c; sourceTree = ""; }; - 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; }; - 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendfillrect.h; sourceTree = ""; }; - 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = ""; }; - 04F7804012FB74A200FC43C0 /* SDL_blendline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendline.h; sourceTree = ""; }; - 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendpoint.c; sourceTree = ""; }; - 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendpoint.h; sourceTree = ""; }; - 04F7804312FB74A200FC43C0 /* SDL_draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_draw.h; sourceTree = ""; }; - 04F7804412FB74A200FC43C0 /* SDL_drawline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawline.c; sourceTree = ""; }; - 04F7804512FB74A200FC43C0 /* SDL_drawline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_drawline.h; sourceTree = ""; }; - 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawpoint.c; sourceTree = ""; }; - 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_drawpoint.h; sourceTree = ""; }; - 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dropevents_c.h; sourceTree = ""; }; - 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dropevents.c; sourceTree = ""; }; - 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = ../../src/filesystem/cocoa/SDL_sysfilesystem.m; sourceTree = ""; }; - 567E2F2017C44C35005F1892 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = ""; }; - 56A670081856545C0007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_internal.h; path = ../../src/SDL_internal.h; sourceTree = ""; }; - 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = ../../src/dynapi/SDL_dynapi_procs.h; sourceTree = ""; }; - 56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = ""; }; - 56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = ""; }; - 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = ""; }; - A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; - A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; - A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; - AA0F8490178D5ECC00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = ""; }; - AA628AC8159367B7005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = ""; }; - AA628AC9159367B7005138DD /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rotate.h; sourceTree = ""; }; - AA628ACF159367F2005138DD /* SDL_x11xinput2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11xinput2.c; sourceTree = ""; }; - AA628AD0159367F2005138DD /* SDL_x11xinput2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11xinput2.h; sourceTree = ""; }; - AA7557C71595D4D800BBD41B /* begin_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = begin_code.h; sourceTree = ""; }; - AA7557C81595D4D800BBD41B /* close_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = close_code.h; sourceTree = ""; }; - AA7557C91595D4D800BBD41B /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_assert.h; sourceTree = ""; }; - AA7557CA1595D4D800BBD41B /* SDL_atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_atomic.h; sourceTree = ""; }; - AA7557CB1595D4D800BBD41B /* SDL_audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio.h; sourceTree = ""; }; - AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendmode.h; sourceTree = ""; }; - AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboard.h; sourceTree = ""; }; - AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_macosx.h; sourceTree = ""; }; - AA7557CF1595D4D800BBD41B /* SDL_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config.h; sourceTree = ""; }; - AA7557D01595D4D800BBD41B /* SDL_copying.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_copying.h; sourceTree = ""; }; - AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cpuinfo.h; sourceTree = ""; }; - AA7557D21595D4D800BBD41B /* SDL_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_endian.h; sourceTree = ""; }; - AA7557D31595D4D800BBD41B /* SDL_error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_error.h; sourceTree = ""; }; - AA7557D41595D4D800BBD41B /* SDL_events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_events.h; sourceTree = ""; }; - AA7557D51595D4D800BBD41B /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gesture.h; sourceTree = ""; }; - AA7557D61595D4D800BBD41B /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_haptic.h; sourceTree = ""; }; - AA7557D71595D4D800BBD41B /* SDL_hints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hints.h; sourceTree = ""; }; - AA7557D91595D4D800BBD41B /* SDL_joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick.h; sourceTree = ""; }; - AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keyboard.h; sourceTree = ""; }; - AA7557DB1595D4D800BBD41B /* SDL_keycode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keycode.h; sourceTree = ""; }; - AA7557DC1595D4D800BBD41B /* SDL_loadso.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_loadso.h; sourceTree = ""; }; - AA7557DD1595D4D800BBD41B /* SDL_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_log.h; sourceTree = ""; }; - AA7557DE1595D4D800BBD41B /* SDL_main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_main.h; sourceTree = ""; }; - AA7557DF1595D4D800BBD41B /* SDL_mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_mouse.h; sourceTree = ""; }; - AA7557E01595D4D800BBD41B /* SDL_mutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_mutex.h; sourceTree = ""; }; - AA7557E11595D4D800BBD41B /* SDL_name.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_name.h; sourceTree = ""; }; - AA7557E21595D4D800BBD41B /* SDL_opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengl.h; sourceTree = ""; }; - AA7557E31595D4D800BBD41B /* SDL_opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles.h; sourceTree = ""; }; - AA7557E41595D4D800BBD41B /* SDL_opengles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2.h; sourceTree = ""; }; - AA7557E51595D4D800BBD41B /* SDL_pixels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_pixels.h; sourceTree = ""; }; - AA7557E61595D4D800BBD41B /* SDL_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_platform.h; sourceTree = ""; }; - AA7557E71595D4D800BBD41B /* SDL_power.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_power.h; sourceTree = ""; }; - AA7557E81595D4D800BBD41B /* SDL_quit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_quit.h; sourceTree = ""; }; - AA7557E91595D4D800BBD41B /* SDL_rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect.h; sourceTree = ""; }; - AA7557EA1595D4D800BBD41B /* SDL_render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_render.h; sourceTree = ""; }; - AA7557EB1595D4D800BBD41B /* SDL_revision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_revision.h; sourceTree = ""; }; - AA7557EC1595D4D800BBD41B /* SDL_rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rwops.h; sourceTree = ""; }; - AA7557ED1595D4D800BBD41B /* SDL_scancode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_scancode.h; sourceTree = ""; }; - AA7557EE1595D4D800BBD41B /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape.h; sourceTree = ""; }; - AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_stdinc.h; sourceTree = ""; }; - AA7557F01595D4D800BBD41B /* SDL_surface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_surface.h; sourceTree = ""; }; - AA7557F11595D4D800BBD41B /* SDL_system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_system.h; sourceTree = ""; }; - AA7557F21595D4D800BBD41B /* SDL_syswm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syswm.h; sourceTree = ""; }; - AA7557F31595D4D800BBD41B /* SDL_thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_thread.h; sourceTree = ""; }; - AA7557F41595D4D800BBD41B /* SDL_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_timer.h; sourceTree = ""; }; - AA7557F51595D4D800BBD41B /* SDL_touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_touch.h; sourceTree = ""; }; - AA7557F61595D4D800BBD41B /* SDL_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_types.h; sourceTree = ""; }; - AA7557F71595D4D800BBD41B /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_version.h; sourceTree = ""; }; - AA7557F81595D4D800BBD41B /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_video.h; sourceTree = ""; }; - AA7557F91595D4D800BBD41B /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL.h; sourceTree = ""; }; - AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11messagebox.c; sourceTree = ""; }; - AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_messagebox.h; sourceTree = ""; }; - AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamessagebox.h; sourceTree = ""; }; - AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamessagebox.m; sourceTree = ""; }; - AAC070F4195606770073DCDF /* SDL_opengl_glext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengl_glext.h; sourceTree = ""; }; - AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_gl2.h; sourceTree = ""; }; - AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_gl2ext.h; sourceTree = ""; }; - AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_gl2platform.h; sourceTree = ""; }; - AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_khrplatform.h; sourceTree = ""; }; - AADA5B8616CCAB3000107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = ""; }; - BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamecontroller.c; sourceTree = ""; }; - BECDF66B0761BA81005FE872 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = ""; }; - BECDF66C0761BA81005FE872 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6B30761BA81005FE872 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6BE0761BA81005FE872 /* Standard DMG */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Standard DMG"; sourceTree = BUILT_PRODUCTS_DIR; }; - D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamousetap.h; sourceTree = ""; }; - D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamousetap.m; sourceTree = ""; }; - DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - DB89958518A1A5C50092407C /* SDL_syshaptic_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic_c.h; sourceTree = ""; }; - F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; - F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; - F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; - FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; - FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coreaudio.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - BECDF6680761BA81005FE872 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */, - A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */, - FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */, - 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */, - 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */, - 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */, - 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BECDF6B10761BA81005FE872 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, - FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */, - 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */, - 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */, - 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */, - DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */, - 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB31406B17554B71006C0E22 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, - FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */, - DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */, - DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */, - 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */, - DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */, - DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */, - 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0153844A006D81B07F000001 /* Public Headers */ = { - isa = PBXGroup; - children = ( - AA7557C71595D4D800BBD41B /* begin_code.h */, - AA7557C81595D4D800BBD41B /* close_code.h */, - AA7557F91595D4D800BBD41B /* SDL.h */, - AA7557C91595D4D800BBD41B /* SDL_assert.h */, - AA7557CA1595D4D800BBD41B /* SDL_atomic.h */, - AA7557CB1595D4D800BBD41B /* SDL_audio.h */, - AADA5B8616CCAB3000107CF7 /* SDL_bits.h */, - AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */, - AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */, - AA7557CF1595D4D800BBD41B /* SDL_config.h */, - AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */, - AA7557D01595D4D800BBD41B /* SDL_copying.h */, - AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */, - AA7557D21595D4D800BBD41B /* SDL_endian.h */, - AA7557D31595D4D800BBD41B /* SDL_error.h */, - AA7557D41595D4D800BBD41B /* SDL_events.h */, - 567E2F2017C44C35005F1892 /* SDL_filesystem.h */, - A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */, - AA7557D51595D4D800BBD41B /* SDL_gesture.h */, - AA7557D61595D4D800BBD41B /* SDL_haptic.h */, - AA7557D71595D4D800BBD41B /* SDL_hints.h */, - AA7557D91595D4D800BBD41B /* SDL_joystick.h */, - AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */, - AA7557DB1595D4D800BBD41B /* SDL_keycode.h */, - AA7557DC1595D4D800BBD41B /* SDL_loadso.h */, - AA7557DD1595D4D800BBD41B /* SDL_log.h */, - AA7557DE1595D4D800BBD41B /* SDL_main.h */, - AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */, - AA7557DF1595D4D800BBD41B /* SDL_mouse.h */, - AA7557E01595D4D800BBD41B /* SDL_mutex.h */, - AA7557E11595D4D800BBD41B /* SDL_name.h */, - AA7557E21595D4D800BBD41B /* SDL_opengl.h */, - AAC070F4195606770073DCDF /* SDL_opengl_glext.h */, - AA7557E31595D4D800BBD41B /* SDL_opengles.h */, - AA7557E41595D4D800BBD41B /* SDL_opengles2.h */, - AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */, - AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */, - AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */, - AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */, - AA7557E51595D4D800BBD41B /* SDL_pixels.h */, - AA7557E61595D4D800BBD41B /* SDL_platform.h */, - AA7557E71595D4D800BBD41B /* SDL_power.h */, - AA7557E81595D4D800BBD41B /* SDL_quit.h */, - AA7557E91595D4D800BBD41B /* SDL_rect.h */, - AA7557EA1595D4D800BBD41B /* SDL_render.h */, - AA7557EB1595D4D800BBD41B /* SDL_revision.h */, - AA7557EC1595D4D800BBD41B /* SDL_rwops.h */, - AA7557ED1595D4D800BBD41B /* SDL_scancode.h */, - AA7557EE1595D4D800BBD41B /* SDL_shape.h */, - AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */, - AA7557F01595D4D800BBD41B /* SDL_surface.h */, - AA7557F11595D4D800BBD41B /* SDL_system.h */, - AA7557F21595D4D800BBD41B /* SDL_syswm.h */, - AA7557F31595D4D800BBD41B /* SDL_thread.h */, - AA7557F41595D4D800BBD41B /* SDL_timer.h */, - AA7557F51595D4D800BBD41B /* SDL_touch.h */, - AA7557F61595D4D800BBD41B /* SDL_types.h */, - AA7557F71595D4D800BBD41B /* SDL_version.h */, - AA7557F81595D4D800BBD41B /* SDL_video.h */, - ); - name = "Public Headers"; - path = ../../include; - sourceTree = ""; - }; - 034768DDFF38A45A11DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - 089C1665FE841158C02AAC07 /* Resources */, - BECDF66C0761BA81005FE872 /* SDL2.framework */, - BECDF6B30761BA81005FE872 /* libSDL2.a */, - BECDF6BE0761BA81005FE872 /* Standard DMG */, - DB31407717554B71006C0E22 /* libSDL2.dylib */, - ); - name = Products; - sourceTree = ""; - }; - 041B2C9712FA0D680087D585 /* render */ = { - isa = PBXGroup; - children = ( - 041B2C9A12FA0D680087D585 /* opengl */, - 041B2CA012FA0D680087D585 /* software */, - 04409B8D12FA97ED00FB9AA8 /* mmx.h */, - 041B2C9E12FA0D680087D585 /* SDL_render.c */, - 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */, - 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */, - 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */, - 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */, - ); - name = render; - path = ../../src/render; - sourceTree = SOURCE_ROOT; - }; - 041B2C9A12FA0D680087D585 /* opengl */ = { - isa = PBXGroup; - children = ( - 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */, - 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */, - 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */, - 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */, - ); - path = opengl; - sourceTree = ""; - }; - 041B2CA012FA0D680087D585 /* software */ = { - isa = PBXGroup; - children = ( - 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */, - 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */, - 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */, - 04F7804012FB74A200FC43C0 /* SDL_blendline.h */, - 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */, - 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */, - 04F7804312FB74A200FC43C0 /* SDL_draw.h */, - 04F7804412FB74A200FC43C0 /* SDL_drawline.c */, - 04F7804512FB74A200FC43C0 /* SDL_drawline.h */, - 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */, - 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */, - 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */, - 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */, - AA628AC8159367B7005138DD /* SDL_rotate.c */, - AA628AC9159367B7005138DD /* SDL_rotate.h */, - ); - path = software; - sourceTree = ""; - }; - 04BDFD7312E6671700899322 /* atomic */ = { - isa = PBXGroup; - children = ( - 04BDFD7412E6671700899322 /* SDL_atomic.c */, - 04BDFD7512E6671700899322 /* SDL_spinlock.c */, - ); - name = atomic; - path = ../../src/atomic; - sourceTree = SOURCE_ROOT; - }; - 04BDFD7612E6671700899322 /* audio */ = { - isa = PBXGroup; - children = ( - 04BDFD8712E6671700899322 /* disk */, - 04BDFD9312E6671700899322 /* dummy */, - 04BDFD9F12E6671700899322 /* coreaudio */, - 04BDFDB412E6671700899322 /* SDL_audio.c */, - 04BDFDB512E6671700899322 /* SDL_audio_c.h */, - 04BDFDB612E6671700899322 /* SDL_audiocvt.c */, - 04BDFDB712E6671700899322 /* SDL_audiodev.c */, - 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */, - 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */, - 04BDFDBB12E6671700899322 /* SDL_mixer.c */, - 04BDFDC212E6671700899322 /* SDL_sysaudio.h */, - 04BDFDC312E6671700899322 /* SDL_wave.c */, - 04BDFDC412E6671700899322 /* SDL_wave.h */, - ); - name = audio; - path = ../../src/audio; - sourceTree = SOURCE_ROOT; - }; - 04BDFD8712E6671700899322 /* disk */ = { - isa = PBXGroup; - children = ( - 04BDFD8812E6671700899322 /* SDL_diskaudio.c */, - 04BDFD8912E6671700899322 /* SDL_diskaudio.h */, - ); - path = disk; - sourceTree = ""; - }; - 04BDFD9312E6671700899322 /* dummy */ = { - isa = PBXGroup; - children = ( - 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */, - 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */, - ); - path = dummy; - sourceTree = ""; - }; - 04BDFD9F12E6671700899322 /* coreaudio */ = { - isa = PBXGroup; - children = ( - 04BDFDA112E6671700899322 /* SDL_coreaudio.h */, - FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */, - ); - path = coreaudio; - sourceTree = ""; - }; - 04BDFDD312E6671700899322 /* cpuinfo */ = { - isa = PBXGroup; - children = ( - 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */, - ); - name = cpuinfo; - path = ../../src/cpuinfo; - sourceTree = SOURCE_ROOT; - }; - 04BDFDD512E6671700899322 /* events */ = { - isa = PBXGroup; - children = ( - 04BDFDD612E6671700899322 /* blank_cursor.h */, - 04BDFDD712E6671700899322 /* default_cursor.h */, - 04BDFDD812E6671700899322 /* scancodes_darwin.h */, - 04BDFDD912E6671700899322 /* scancodes_linux.h */, - 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */, - 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */, - 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */, - 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */, - 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */, - 04BDFDDE12E6671700899322 /* SDL_events.c */, - 04BDFDDF12E6671700899322 /* SDL_events_c.h */, - 04BDFDE012E6671700899322 /* SDL_gesture.c */, - 04BDFDE112E6671700899322 /* SDL_gesture_c.h */, - 04BDFDE212E6671700899322 /* SDL_keyboard.c */, - 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */, - 04BDFDE412E6671700899322 /* SDL_mouse.c */, - 04BDFDE512E6671700899322 /* SDL_mouse_c.h */, - 04BDFDE612E6671700899322 /* SDL_quit.c */, - 04BDFDE712E6671700899322 /* SDL_sysevents.h */, - 04BDFDE812E6671700899322 /* SDL_touch.c */, - 04BDFDE912E6671700899322 /* SDL_touch_c.h */, - 04BDFDEA12E6671700899322 /* SDL_windowevents.c */, - 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */, - ); - name = events; - path = ../../src/events; - sourceTree = SOURCE_ROOT; - }; - 04BDFDEC12E6671700899322 /* file */ = { - isa = PBXGroup; - children = ( - 04BDFDED12E6671700899322 /* cocoa */, - 04BDFDF012E6671700899322 /* SDL_rwops.c */, - ); - name = file; - path = ../../src/file; - sourceTree = SOURCE_ROOT; - }; - 04BDFDED12E6671700899322 /* cocoa */ = { - isa = PBXGroup; - children = ( - 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */, - 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */, - ); - path = cocoa; - sourceTree = ""; - }; - 04BDFDF112E6671700899322 /* haptic */ = { - isa = PBXGroup; - children = ( - 04BDFDF212E6671700899322 /* darwin */, - 04BDFDFA12E6671700899322 /* SDL_haptic.c */, - 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */, - 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */, - ); - name = haptic; - path = ../../src/haptic; - sourceTree = SOURCE_ROOT; - }; - 04BDFDF212E6671700899322 /* darwin */ = { - isa = PBXGroup; - children = ( - 04BDFDF312E6671700899322 /* SDL_syshaptic.c */, - DB89958518A1A5C50092407C /* SDL_syshaptic_c.h */, - ); - path = darwin; - sourceTree = ""; - }; - 04BDFDFF12E6671700899322 /* joystick */ = { - isa = PBXGroup; - children = ( - 04BDFE0612E6671700899322 /* darwin */, - 04BDFE1612E6671700899322 /* SDL_joystick.c */, - 04BDFE1712E6671700899322 /* SDL_joystick_c.h */, - BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */, - 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */, - ); - name = joystick; - path = ../../src/joystick; - sourceTree = SOURCE_ROOT; - }; - 04BDFE0612E6671700899322 /* darwin */ = { - isa = PBXGroup; - children = ( - 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */, - 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */, - ); - path = darwin; - sourceTree = ""; - }; - 04BDFE2F12E6671700899322 /* loadso */ = { - isa = PBXGroup; - children = ( - 04BDFE3212E6671700899322 /* dlopen */, - ); - name = loadso; - path = ../../src/loadso; - sourceTree = SOURCE_ROOT; - }; - 04BDFE3212E6671700899322 /* dlopen */ = { - isa = PBXGroup; - children = ( - 04BDFE3312E6671700899322 /* SDL_sysloadso.c */, - ); - path = dlopen; - sourceTree = ""; - }; - 04BDFE4512E6671700899322 /* power */ = { - isa = PBXGroup; - children = ( - 04BDFE4A12E6671700899322 /* macosx */, - 04BDFE4E12E6671700899322 /* SDL_power.c */, - ); - name = power; - path = ../../src/power; - sourceTree = SOURCE_ROOT; - }; - 04BDFE4A12E6671700899322 /* macosx */ = { - isa = PBXGroup; - children = ( - 04BDFE4B12E6671700899322 /* SDL_syspower.c */, - ); - path = macosx; - sourceTree = ""; - }; - 04BDFE5D12E6671700899322 /* stdlib */ = { - isa = PBXGroup; - children = ( - 04BDFE5E12E6671700899322 /* SDL_getenv.c */, - 04BDFE5F12E6671700899322 /* SDL_iconv.c */, - 04BDFE6012E6671700899322 /* SDL_malloc.c */, - 04BDFE6112E6671700899322 /* SDL_qsort.c */, - 04BDFE6212E6671700899322 /* SDL_stdlib.c */, - 04BDFE6312E6671700899322 /* SDL_string.c */, - ); - name = stdlib; - path = ../../src/stdlib; - sourceTree = SOURCE_ROOT; - }; - 04BDFE6412E6671800899322 /* thread */ = { - isa = PBXGroup; - children = ( - 04BDFE7D12E6671800899322 /* pthread */, - 04BDFE8B12E6671800899322 /* SDL_systhread.h */, - 04BDFE8C12E6671800899322 /* SDL_thread.c */, - 04BDFE8D12E6671800899322 /* SDL_thread_c.h */, - ); - name = thread; - path = ../../src/thread; - sourceTree = SOURCE_ROOT; - }; - 04BDFE7D12E6671800899322 /* pthread */ = { - isa = PBXGroup; - children = ( - 04BDFE7E12E6671800899322 /* SDL_syscond.c */, - 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */, - 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */, - 04BDFE8112E6671800899322 /* SDL_syssem.c */, - 04BDFE8212E6671800899322 /* SDL_systhread.c */, - 04BDFE8312E6671800899322 /* SDL_systhread_c.h */, - AA0F8490178D5ECC00823F9D /* SDL_systls.c */, - ); - path = pthread; - sourceTree = ""; - }; - 04BDFE9512E6671800899322 /* timer */ = { - isa = PBXGroup; - children = ( - 04BDFEA112E6671800899322 /* unix */, - 04BDFE9F12E6671800899322 /* SDL_timer.c */, - 04BDFEA012E6671800899322 /* SDL_timer_c.h */, - ); - name = timer; - path = ../../src/timer; - sourceTree = SOURCE_ROOT; - }; - 04BDFEA112E6671800899322 /* unix */ = { - isa = PBXGroup; - children = ( - 04BDFEA212E6671800899322 /* SDL_systimer.c */, - ); - path = unix; - sourceTree = ""; - }; - 04BDFEA712E6671800899322 /* video */ = { - isa = PBXGroup; - children = ( - 04BDFEC112E6671800899322 /* cocoa */, - 04BDFEE712E6671800899322 /* dummy */, - 04BDFFB712E6671800899322 /* x11 */, - 04BDFF4E12E6671800899322 /* SDL_blit.c */, - 04BDFF4F12E6671800899322 /* SDL_blit.h */, - 04BDFF5012E6671800899322 /* SDL_blit_0.c */, - 04BDFF5112E6671800899322 /* SDL_blit_1.c */, - 04BDFF5212E6671800899322 /* SDL_blit_A.c */, - 04BDFF5312E6671800899322 /* SDL_blit_auto.c */, - 04BDFF5412E6671800899322 /* SDL_blit_auto.h */, - 04BDFF5512E6671800899322 /* SDL_blit_copy.c */, - 04BDFF5612E6671800899322 /* SDL_blit_copy.h */, - 04BDFF5712E6671800899322 /* SDL_blit_N.c */, - 04BDFF5812E6671800899322 /* SDL_blit_slow.c */, - 04BDFF5912E6671800899322 /* SDL_blit_slow.h */, - 04BDFF5A12E6671800899322 /* SDL_bmp.c */, - 04BDFF5B12E6671800899322 /* SDL_clipboard.c */, - 04BDFF6012E6671800899322 /* SDL_fillrect.c */, - 04BDFF6512E6671800899322 /* SDL_pixels.c */, - 04BDFF6612E6671800899322 /* SDL_pixels_c.h */, - 04BDFF6712E6671800899322 /* SDL_rect.c */, - 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */, - 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */, - 04BDFF7112E6671800899322 /* SDL_shape.c */, - 04BDFF7212E6671800899322 /* SDL_shape_internals.h */, - 04BDFF7312E6671800899322 /* SDL_stretch.c */, - 04BDFF7412E6671800899322 /* SDL_surface.c */, - 04BDFF7512E6671800899322 /* SDL_sysvideo.h */, - 04BDFF7612E6671800899322 /* SDL_video.c */, - ); - name = video; - path = ../../src/video; - sourceTree = SOURCE_ROOT; - }; - 04BDFEC112E6671800899322 /* cocoa */ = { - isa = PBXGroup; - children = ( - 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */, - 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */, - 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */, - 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */, - 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */, - 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */, - AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */, - AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */, - 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */, - 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */, - 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */, - 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */, - D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */, - D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */, - 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */, - 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */, - 04BDFECE12E6671800899322 /* SDL_cocoashape.h */, - 04BDFECF12E6671800899322 /* SDL_cocoashape.m */, - 04BDFED012E6671800899322 /* SDL_cocoavideo.h */, - 04BDFED112E6671800899322 /* SDL_cocoavideo.m */, - 04BDFED212E6671800899322 /* SDL_cocoawindow.h */, - 04BDFED312E6671800899322 /* SDL_cocoawindow.m */, - ); - path = cocoa; - sourceTree = ""; - }; - 04BDFEE712E6671800899322 /* dummy */ = { - isa = PBXGroup; - children = ( - 04BDFEE812E6671800899322 /* SDL_nullevents.c */, - 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */, - 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */, - 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */, - 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */, - 04BDFEED12E6671800899322 /* SDL_nullvideo.h */, - ); - path = dummy; - sourceTree = ""; - }; - 04BDFFB712E6671800899322 /* x11 */ = { - isa = PBXGroup; - children = ( - 04BDFFB812E6671800899322 /* imKStoUCS.c */, - 04BDFFB912E6671800899322 /* imKStoUCS.h */, - 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */, - 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */, - 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */, - 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */, - 04BDFFBE12E6671800899322 /* SDL_x11events.c */, - 04BDFFBF12E6671800899322 /* SDL_x11events.h */, - 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */, - 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */, - 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */, - 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */, - AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */, - 04BDFFC412E6671800899322 /* SDL_x11modes.c */, - 04BDFFC512E6671800899322 /* SDL_x11modes.h */, - 04BDFFC612E6671800899322 /* SDL_x11mouse.c */, - 04BDFFC712E6671800899322 /* SDL_x11mouse.h */, - 04BDFFC812E6671800899322 /* SDL_x11opengl.c */, - 04BDFFC912E6671800899322 /* SDL_x11opengl.h */, - 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */, - 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */, - 04BDFFCE12E6671800899322 /* SDL_x11shape.c */, - 04BDFFCF12E6671800899322 /* SDL_x11shape.h */, - 04BDFFD012E6671800899322 /* SDL_x11sym.h */, - 04BDFFD112E6671800899322 /* SDL_x11touch.c */, - 04BDFFD212E6671800899322 /* SDL_x11touch.h */, - 04BDFFD312E6671800899322 /* SDL_x11video.c */, - 04BDFFD412E6671800899322 /* SDL_x11video.h */, - 04BDFFD512E6671800899322 /* SDL_x11window.c */, - 04BDFFD612E6671800899322 /* SDL_x11window.h */, - AA628ACF159367F2005138DD /* SDL_x11xinput2.c */, - AA628AD0159367F2005138DD /* SDL_x11xinput2.h */, - ); - path = x11; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* SDLFramework */ = { - isa = PBXGroup; - children = ( - F5A2EF3900C6A39A01000001 /* BUGS.txt */, - F59C70FC00D5CB5801000001 /* pkg-support */, - 0153844A006D81B07F000001 /* Public Headers */, - 08FB77ACFE841707C02AAC07 /* Library Source */, - 034768DDFF38A45A11DB9C8B /* Products */, - BECDF66B0761BA81005FE872 /* Info-Framework.plist */, - BEC562FE0761C0E800A33029 /* Linked Frameworks */, - ); - comments = "To build Universal Binaries, we have experimented with a variety of different options.\nThe complication is that we must retain compatibility with at least 10.2. \nThe Universal Binary defaults only work for > 10.3.9\n\nSo far, we have found:\ngcc 4.0.0 with Xcode 2.1 always links against libgcc_s. gcc 4.0.1 from Xcode 2.2 fixes this problem.\n\nBut gcc 4.0 will not work with < 10.3.9 because we continue to get an undefined symbol to _fprintf$LDBL128.\nSo we must use gcc 3.3 on PPC to accomplish 10.2 support. (But 4.0 is required for i386.)\n\nSetting the deployment target to 10.4 will disable prebinding, so for PPC, we set it less than 10.4 to preserve prebinding for legacy support.\n\nSetting the PPC SDKROOT to /Developers/SDKs/MacOSX10.2.8.sdk will link to 63.0.0 libSystem.B.dylib. Leaving it at current or 10.4u links to 88.1.2. However, as long as we are using gcc 3.3, it doesn't seem to matter as testing has demonstrated both will run. We have decided not to invoke the 10.2.8 SDK because it is not a default installed component with Xcode which will probably cause most people problems. However, rather than deleting the SDKROOT_ppc entry entirely, we have mapped it to 10.4u in case we decide we need to change this setting.\n\nTo use Altivec or SSE, we needed architecture specific flags:\nOTHER_CFLAGS_ppc\nOTHER_CFLAGS_i386\nOTHER_CFLAGS=$(OTHER_CFLAGS_($CURRENT_ARCH))\n\nThe general OTHER_CFLAGS needed to be manually mapped to architecture specific options because Xcode didn't do this automatically for us.\n\n\n"; - indentWidth = 4; - name = SDLFramework; - sourceTree = ""; - tabWidth = 4; - usesTabs = 0; - }; - 089C1665FE841158C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - ); - name = Resources; - sourceTree = ""; - }; - 08FB77ACFE841707C02AAC07 /* Library Source */ = { - isa = PBXGroup; - children = ( - 04BDFD7312E6671700899322 /* atomic */, - 04BDFD7612E6671700899322 /* audio */, - 04BDFDD312E6671700899322 /* cpuinfo */, - 56A6701C1856549B0007D20F /* dynapi */, - 04BDFDD512E6671700899322 /* events */, - 567E2F1F17C44BBB005F1892 /* filesystem */, - 04BDFDEC12E6671700899322 /* file */, - 04BDFDF112E6671700899322 /* haptic */, - 04BDFDFF12E6671700899322 /* joystick */, - 04BDFE2F12E6671700899322 /* loadso */, - 04BDFE4512E6671700899322 /* power */, - 041B2C9712FA0D680087D585 /* render */, - 04BDFE5D12E6671700899322 /* stdlib */, - 04BDFE6412E6671800899322 /* thread */, - 04BDFE9512E6671800899322 /* timer */, - 04BDFEA712E6671800899322 /* video */, - 56A670081856545C0007D20F /* SDL_internal.h */, - 04BDFE5512E6671700899322 /* SDL_assert_c.h */, - 04BDFE5612E6671700899322 /* SDL_assert.c */, - 04BDFE5812E6671700899322 /* SDL_error_c.h */, - 04BDFE5912E6671700899322 /* SDL_error.c */, - 0442EC5E12FE1C75004C9285 /* SDL_hints.c */, - 04BAC0C71300C2160055DE28 /* SDL_log.c */, - 04BDFE5C12E6671700899322 /* SDL.c */, - ); - name = "Library Source"; - sourceTree = ""; - }; - 567E2F1F17C44BBB005F1892 /* filesystem */ = { - isa = PBXGroup; - children = ( - 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */, - ); - name = filesystem; - sourceTree = ""; - }; - 56A6701C1856549B0007D20F /* dynapi */ = { - isa = PBXGroup; - children = ( - 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */, - 56A6701E185654B40007D20F /* SDL_dynapi.c */, - 56A6701F185654B40007D20F /* SDL_dynapi.h */, - 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */, - ); - name = dynapi; - sourceTree = ""; - }; - BEC562FE0761C0E800A33029 /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - A7381E931D8B69C300B177DD /* AudioToolbox.framework */, - A7381E951D8B69D600B177DD /* CoreAudio.framework */, - FA73671C19A540EF004122E4 /* CoreVideo.framework */, - 00D0D08310675DD9004B05EF /* CoreFoundation.framework */, - 007317C10858E15000B2BC32 /* Carbon.framework */, - 0073179D0858DECD00B2BC32 /* Cocoa.framework */, - 0073179F0858DECD00B2BC32 /* IOKit.framework */, - 00CFA89C106B4BA100758660 /* ForceFeedback.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - F59C70FC00D5CB5801000001 /* pkg-support */ = { - isa = PBXGroup; - children = ( - F59C710100D5CB5801000001 /* resources */, - F59C710600D5CB5801000001 /* SDL.info */, - ); - path = "pkg-support"; - sourceTree = SOURCE_ROOT; - }; - F59C710100D5CB5801000001 /* resources */ = { - isa = PBXGroup; - children = ( - 00794D3F09D0C461003FC8A1 /* License.txt */, - F59C710300D5CB5801000001 /* ReadMe.txt */, - ); - path = resources; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - BECDF5FF0761BA81005FE872 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - AA7557FA1595D4D800BBD41B /* begin_code.h in Headers */, - AA7557FC1595D4D800BBD41B /* close_code.h in Headers */, - AA75585E1595D4D800BBD41B /* SDL.h in Headers */, - AA7557FE1595D4D800BBD41B /* SDL_assert.h in Headers */, - AA7558001595D4D800BBD41B /* SDL_atomic.h in Headers */, - AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */, - AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */, - AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */, - AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */, - AA7558081595D4D800BBD41B /* SDL_config_macosx.h in Headers */, - AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */, - 56A670091856545C0007D20F /* SDL_internal.h in Headers */, - AA75580C1595D4D800BBD41B /* SDL_copying.h in Headers */, - AA75580E1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */, - AA7558101595D4D800BBD41B /* SDL_endian.h in Headers */, - AA7558121595D4D800BBD41B /* SDL_error.h in Headers */, - AA7558141595D4D800BBD41B /* SDL_events.h in Headers */, - 567E2F2117C44C35005F1892 /* SDL_filesystem.h in Headers */, - A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */, - AA7558161595D4D800BBD41B /* SDL_gesture.h in Headers */, - AA7558181595D4D800BBD41B /* SDL_haptic.h in Headers */, - AA75581A1595D4D800BBD41B /* SDL_hints.h in Headers */, - AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */, - AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */, - AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */, - AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */, - AA7558261595D4D800BBD41B /* SDL_log.h in Headers */, - AA7558281595D4D800BBD41B /* SDL_main.h in Headers */, - AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */, - AA75582A1595D4D800BBD41B /* SDL_mouse.h in Headers */, - AA75582C1595D4D800BBD41B /* SDL_mutex.h in Headers */, - AA75582E1595D4D800BBD41B /* SDL_name.h in Headers */, - AA7558301595D4D800BBD41B /* SDL_opengl.h in Headers */, - AAC070F9195606770073DCDF /* SDL_opengl_glext.h in Headers */, - AA7558321595D4D800BBD41B /* SDL_opengles.h in Headers */, - AA7558341595D4D800BBD41B /* SDL_opengles2.h in Headers */, - AAC070FC195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - AAC070FF195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, - AAC07102195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, - AAC07105195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */, - AA7558361595D4D800BBD41B /* SDL_pixels.h in Headers */, - AA7558381595D4D800BBD41B /* SDL_platform.h in Headers */, - AA75583A1595D4D800BBD41B /* SDL_power.h in Headers */, - AA75583C1595D4D800BBD41B /* SDL_quit.h in Headers */, - AA75583E1595D4D800BBD41B /* SDL_rect.h in Headers */, - AA7558401595D4D800BBD41B /* SDL_render.h in Headers */, - AA7558421595D4D800BBD41B /* SDL_revision.h in Headers */, - AA7558441595D4D800BBD41B /* SDL_rwops.h in Headers */, - AA7558461595D4D800BBD41B /* SDL_scancode.h in Headers */, - AA7558481595D4D800BBD41B /* SDL_shape.h in Headers */, - AA75584A1595D4D800BBD41B /* SDL_stdinc.h in Headers */, - AA75584C1595D4D800BBD41B /* SDL_surface.h in Headers */, - AA75584E1595D4D800BBD41B /* SDL_system.h in Headers */, - AA7558501595D4D800BBD41B /* SDL_syswm.h in Headers */, - AA7558521595D4D800BBD41B /* SDL_thread.h in Headers */, - AA7558541595D4D800BBD41B /* SDL_timer.h in Headers */, - AA7558561595D4D800BBD41B /* SDL_touch.h in Headers */, - AA7558581595D4D800BBD41B /* SDL_types.h in Headers */, - AA75585A1595D4D800BBD41B /* SDL_version.h in Headers */, - AA75585C1595D4D800BBD41B /* SDL_video.h in Headers */, - 04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */, - 04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */, - 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */, - 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */, - 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */, - 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */, - 04BD003612E6671800899322 /* SDL_wave.h in Headers */, - 04BD004212E6671800899322 /* blank_cursor.h in Headers */, - 04BD004312E6671800899322 /* default_cursor.h in Headers */, - 04BD004412E6671800899322 /* scancodes_darwin.h in Headers */, - 04BD004512E6671800899322 /* scancodes_linux.h in Headers */, - 04BD004712E6671800899322 /* scancodes_xfree86.h in Headers */, - 04BD004912E6671800899322 /* SDL_clipboardevents_c.h in Headers */, - 56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, - 04BD004B12E6671800899322 /* SDL_events_c.h in Headers */, - 04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */, - 04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */, - 04BD005112E6671800899322 /* SDL_mouse_c.h in Headers */, - 04BD005312E6671800899322 /* SDL_sysevents.h in Headers */, - 04BD005512E6671800899322 /* SDL_touch_c.h in Headers */, - 04BD005712E6671800899322 /* SDL_windowevents_c.h in Headers */, - 04BD005812E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */, - 04BD006012E6671800899322 /* SDL_haptic_c.h in Headers */, - 04BD006112E6671800899322 /* SDL_syshaptic.h in Headers */, - 04BD006712E6671800899322 /* SDL_sysjoystick_c.h in Headers */, - 04BD007112E6671800899322 /* SDL_joystick_c.h in Headers */, - 04BD007212E6671800899322 /* SDL_sysjoystick.h in Headers */, - 04BD009B12E6671800899322 /* SDL_assert_c.h in Headers */, - 04BD009E12E6671800899322 /* SDL_error_c.h in Headers */, - 04BD00BF12E6671800899322 /* SDL_sysmutex_c.h in Headers */, - 04BD00C212E6671800899322 /* SDL_systhread_c.h in Headers */, - 04BD00C912E6671800899322 /* SDL_systhread.h in Headers */, - 04BD00CB12E6671800899322 /* SDL_thread_c.h in Headers */, - 04BD00D812E6671800899322 /* SDL_timer_c.h in Headers */, - 04BD00F312E6671800899322 /* SDL_cocoaclipboard.h in Headers */, - 04BD00F512E6671800899322 /* SDL_cocoaevents.h in Headers */, - 04BD00F712E6671800899322 /* SDL_cocoakeyboard.h in Headers */, - 04BD00F912E6671800899322 /* SDL_cocoamodes.h in Headers */, - 04BD00FB12E6671800899322 /* SDL_cocoamouse.h in Headers */, - 04BD00FD12E6671800899322 /* SDL_cocoaopengl.h in Headers */, - 04BD00FF12E6671800899322 /* SDL_cocoashape.h in Headers */, - 04BD010112E6671800899322 /* SDL_cocoavideo.h in Headers */, - 04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */, - 04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */, - 04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */, - 04BD017612E6671800899322 /* SDL_blit.h in Headers */, - 04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */, - 04BD017D12E6671800899322 /* SDL_blit_copy.h in Headers */, - 04BD018012E6671800899322 /* SDL_blit_slow.h in Headers */, - 04BD018D12E6671800899322 /* SDL_pixels_c.h in Headers */, - 04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */, - 04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */, - 04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */, - 04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */, - 04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */, - 04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */, - 04BD01E212E6671800899322 /* SDL_x11events.h in Headers */, - 04BD01E612E6671800899322 /* SDL_x11keyboard.h in Headers */, - 04BD01E812E6671800899322 /* SDL_x11modes.h in Headers */, - 04BD01EA12E6671800899322 /* SDL_x11mouse.h in Headers */, - 04BD01EC12E6671800899322 /* SDL_x11opengl.h in Headers */, - 04BD01EE12E6671800899322 /* SDL_x11opengles.h in Headers */, - 04BD01F212E6671800899322 /* SDL_x11shape.h in Headers */, - 04BD01F312E6671800899322 /* SDL_x11sym.h in Headers */, - 56A67021185654B40007D20F /* SDL_dynapi_procs.h in Headers */, - 04BD01F512E6671800899322 /* SDL_x11touch.h in Headers */, - 04BD01F712E6671800899322 /* SDL_x11video.h in Headers */, - 04BD01F912E6671800899322 /* SDL_x11window.h in Headers */, - 041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */, - 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */, - 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */, - 04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */, - 04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */, - 04F7804C12FB74A200FC43C0 /* SDL_blendline.h in Headers */, - 04F7804E12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */, - 56A67027185654B40007D20F /* SDL_dynapi.h in Headers */, - 04F7804F12FB74A200FC43C0 /* SDL_draw.h in Headers */, - 04F7805112FB74A200FC43C0 /* SDL_drawline.h in Headers */, - 04F7805312FB74A200FC43C0 /* SDL_drawpoint.h in Headers */, - 0442EC1C12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */, - 0442EC5B12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */, - 04043BBB12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */, - 0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */, - 566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */, - AA628ACC159367B7005138DD /* SDL_rotate.h in Headers */, - AA628AD3159367F2005138DD /* SDL_x11xinput2.h in Headers */, - AABCC38D164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */, - D55A1B81179F262300625D7C /* SDL_cocoamousetap.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BECDF66E0761BA81005FE872 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F490B17CA57ED008798C5 /* SDL_filesystem.h in Headers */, - AA7557FB1595D4D800BBD41B /* begin_code.h in Headers */, - AA7557FD1595D4D800BBD41B /* close_code.h in Headers */, - AA75585F1595D4D800BBD41B /* SDL.h in Headers */, - AA7557FF1595D4D800BBD41B /* SDL_assert.h in Headers */, - AA7558011595D4D800BBD41B /* SDL_atomic.h in Headers */, - AA7558031595D4D800BBD41B /* SDL_audio.h in Headers */, - AADA5B8816CCAB3000107CF7 /* SDL_bits.h in Headers */, - AA7558051595D4D800BBD41B /* SDL_blendmode.h in Headers */, - AA7558071595D4D800BBD41B /* SDL_clipboard.h in Headers */, - AA75580B1595D4D800BBD41B /* SDL_config.h in Headers */, - AA7558091595D4D800BBD41B /* SDL_config_macosx.h in Headers */, - AA75580D1595D4D800BBD41B /* SDL_copying.h in Headers */, - AA75580F1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */, - AA7558111595D4D800BBD41B /* SDL_endian.h in Headers */, - AA7558131595D4D800BBD41B /* SDL_error.h in Headers */, - AA7558151595D4D800BBD41B /* SDL_events.h in Headers */, - A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */, - AA7558171595D4D800BBD41B /* SDL_gesture.h in Headers */, - AA7558191595D4D800BBD41B /* SDL_haptic.h in Headers */, - AA75581B1595D4D800BBD41B /* SDL_hints.h in Headers */, - AA75581F1595D4D800BBD41B /* SDL_joystick.h in Headers */, - AA7558211595D4D800BBD41B /* SDL_keyboard.h in Headers */, - AA7558231595D4D800BBD41B /* SDL_keycode.h in Headers */, - AA7558251595D4D800BBD41B /* SDL_loadso.h in Headers */, - AA7558271595D4D800BBD41B /* SDL_log.h in Headers */, - AA7558291595D4D800BBD41B /* SDL_main.h in Headers */, - AAC07106195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */, - DB0F489417C400ED008798C5 /* SDL_messagebox.h in Headers */, - AA75582B1595D4D800BBD41B /* SDL_mouse.h in Headers */, - AA75582D1595D4D800BBD41B /* SDL_mutex.h in Headers */, - AA75582F1595D4D800BBD41B /* SDL_name.h in Headers */, - AA7558311595D4D800BBD41B /* SDL_opengl.h in Headers */, - AA7558331595D4D800BBD41B /* SDL_opengles.h in Headers */, - 56A67028185654B40007D20F /* SDL_dynapi.h in Headers */, - AA7558351595D4D800BBD41B /* SDL_opengles2.h in Headers */, - AA7558371595D4D800BBD41B /* SDL_pixels.h in Headers */, - AA7558391595D4D800BBD41B /* SDL_platform.h in Headers */, - AA75583B1595D4D800BBD41B /* SDL_power.h in Headers */, - AA75583D1595D4D800BBD41B /* SDL_quit.h in Headers */, - AA75583F1595D4D800BBD41B /* SDL_rect.h in Headers */, - AA7558411595D4D800BBD41B /* SDL_render.h in Headers */, - AA7558431595D4D800BBD41B /* SDL_revision.h in Headers */, - AA7558451595D4D800BBD41B /* SDL_rwops.h in Headers */, - AA7558471595D4D800BBD41B /* SDL_scancode.h in Headers */, - AA7558491595D4D800BBD41B /* SDL_shape.h in Headers */, - 56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, - AA75584B1595D4D800BBD41B /* SDL_stdinc.h in Headers */, - AA75584D1595D4D800BBD41B /* SDL_surface.h in Headers */, - AA75584F1595D4D800BBD41B /* SDL_system.h in Headers */, - AA7558511595D4D800BBD41B /* SDL_syswm.h in Headers */, - AAC070FA195606770073DCDF /* SDL_opengl_glext.h in Headers */, - AA7558531595D4D800BBD41B /* SDL_thread.h in Headers */, - AA7558551595D4D800BBD41B /* SDL_timer.h in Headers */, - AA7558571595D4D800BBD41B /* SDL_touch.h in Headers */, - AA7558591595D4D800BBD41B /* SDL_types.h in Headers */, - AA75585B1595D4D800BBD41B /* SDL_version.h in Headers */, - AA75585D1595D4D800BBD41B /* SDL_video.h in Headers */, - 04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */, - 56A6700A1856545C0007D20F /* SDL_internal.h in Headers */, - 04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */, - 04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */, - 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */, - 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */, - AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */, - 04BD025212E6671800899322 /* SDL_wave.h in Headers */, - 04BD025D12E6671800899322 /* blank_cursor.h in Headers */, - 04BD025E12E6671800899322 /* default_cursor.h in Headers */, - 04BD025F12E6671800899322 /* scancodes_darwin.h in Headers */, - 04BD026012E6671800899322 /* scancodes_linux.h in Headers */, - 04BD026212E6671800899322 /* scancodes_xfree86.h in Headers */, - 04BD026412E6671800899322 /* SDL_clipboardevents_c.h in Headers */, - 04BD026612E6671800899322 /* SDL_events_c.h in Headers */, - 56A67022185654B40007D20F /* SDL_dynapi_procs.h in Headers */, - 04BD026812E6671800899322 /* SDL_gesture_c.h in Headers */, - 04BD026A12E6671800899322 /* SDL_keyboard_c.h in Headers */, - 04BD026C12E6671800899322 /* SDL_mouse_c.h in Headers */, - 04BD026E12E6671800899322 /* SDL_sysevents.h in Headers */, - 04BD027012E6671800899322 /* SDL_touch_c.h in Headers */, - 04BD027212E6671800899322 /* SDL_windowevents_c.h in Headers */, - 04BD027312E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */, - 04BD027B12E6671800899322 /* SDL_haptic_c.h in Headers */, - 04BD027C12E6671800899322 /* SDL_syshaptic.h in Headers */, - 04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */, - 04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */, - 04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */, - 04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */, - 04BD02B812E6671800899322 /* SDL_error_c.h in Headers */, - 04BD02D912E6671800899322 /* SDL_sysmutex_c.h in Headers */, - 04BD02DC12E6671800899322 /* SDL_systhread_c.h in Headers */, - 04BD02E312E6671800899322 /* SDL_systhread.h in Headers */, - 04BD02E512E6671800899322 /* SDL_thread_c.h in Headers */, - 04BD02F212E6671800899322 /* SDL_timer_c.h in Headers */, - 04BD030D12E6671800899322 /* SDL_cocoaclipboard.h in Headers */, - 04BD030F12E6671800899322 /* SDL_cocoaevents.h in Headers */, - 04BD031112E6671800899322 /* SDL_cocoakeyboard.h in Headers */, - 04BD031312E6671800899322 /* SDL_cocoamodes.h in Headers */, - 04BD031512E6671800899322 /* SDL_cocoamouse.h in Headers */, - 04BD031712E6671800899322 /* SDL_cocoaopengl.h in Headers */, - 04BD031912E6671800899322 /* SDL_cocoashape.h in Headers */, - AAC07103195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, - 04BD031B12E6671800899322 /* SDL_cocoavideo.h in Headers */, - 04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */, - 04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */, - 04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */, - 04BD039012E6671800899322 /* SDL_blit.h in Headers */, - 04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */, - 04BD039712E6671800899322 /* SDL_blit_copy.h in Headers */, - 04BD039A12E6671800899322 /* SDL_blit_slow.h in Headers */, - 04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */, - 04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */, - 04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */, - 04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */, - 04BD03F412E6671800899322 /* imKStoUCS.h in Headers */, - 04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */, - 04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */, - 04BD03FA12E6671800899322 /* SDL_x11events.h in Headers */, - 04BD03FE12E6671800899322 /* SDL_x11keyboard.h in Headers */, - 04BD040012E6671800899322 /* SDL_x11modes.h in Headers */, - 04BD040212E6671800899322 /* SDL_x11mouse.h in Headers */, - 04BD040412E6671800899322 /* SDL_x11opengl.h in Headers */, - 04BD040612E6671800899322 /* SDL_x11opengles.h in Headers */, - 04BD040A12E6671800899322 /* SDL_x11shape.h in Headers */, - 04BD040B12E6671800899322 /* SDL_x11sym.h in Headers */, - 04BD040D12E6671800899322 /* SDL_x11touch.h in Headers */, - 04BD040F12E6671800899322 /* SDL_x11video.h in Headers */, - AAC07100195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, - 04BD041112E6671800899322 /* SDL_x11window.h in Headers */, - 041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */, - 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */, - 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */, - 04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */, - 04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */, - 04F7805812FB74A200FC43C0 /* SDL_blendline.h in Headers */, - 04F7805A12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */, - 04F7805B12FB74A200FC43C0 /* SDL_draw.h in Headers */, - 04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */, - 04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */, - 0442EC1E12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */, - 0442EC5D12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */, - 04043BBC12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */, - 043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */, - AA628ACD159367B7005138DD /* SDL_rotate.h in Headers */, - AA628AD4159367F2005138DD /* SDL_x11xinput2.h in Headers */, - AABCC38E164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */, - D55A1B85179F278E00625D7C /* SDL_cocoamousetap.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB313F7317554B71006C0E22 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F490C17CA57ED008798C5 /* SDL_filesystem.h in Headers */, - DB313FC817554B71006C0E22 /* begin_code.h in Headers */, - DB313FC917554B71006C0E22 /* close_code.h in Headers */, - DB313FF917554B71006C0E22 /* SDL.h in Headers */, - DB313FCA17554B71006C0E22 /* SDL_assert.h in Headers */, - DB313FCB17554B71006C0E22 /* SDL_atomic.h in Headers */, - DB313FCC17554B71006C0E22 /* SDL_audio.h in Headers */, - DB313FFC17554B71006C0E22 /* SDL_bits.h in Headers */, - DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */, - DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */, - DB313FD017554B71006C0E22 /* SDL_config.h in Headers */, - DB313FCF17554B71006C0E22 /* SDL_config_macosx.h in Headers */, - DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */, - DB313FD217554B71006C0E22 /* SDL_cpuinfo.h in Headers */, - DB313FD317554B71006C0E22 /* SDL_endian.h in Headers */, - DB313FD417554B71006C0E22 /* SDL_error.h in Headers */, - DB313FD517554B71006C0E22 /* SDL_events.h in Headers */, - DB313FFB17554B71006C0E22 /* SDL_gamecontroller.h in Headers */, - DB313FD617554B71006C0E22 /* SDL_gesture.h in Headers */, - DB313FD717554B71006C0E22 /* SDL_haptic.h in Headers */, - DB313FD817554B71006C0E22 /* SDL_hints.h in Headers */, - DB313FD917554B71006C0E22 /* SDL_joystick.h in Headers */, - DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */, - DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */, - DB313FDC17554B71006C0E22 /* SDL_loadso.h in Headers */, - DB313FDD17554B71006C0E22 /* SDL_log.h in Headers */, - DB313FDE17554B71006C0E22 /* SDL_main.h in Headers */, - AAC07107195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */, - DB0F489317C400E6008798C5 /* SDL_messagebox.h in Headers */, - DB313FDF17554B71006C0E22 /* SDL_mouse.h in Headers */, - DB313FE017554B71006C0E22 /* SDL_mutex.h in Headers */, - DB313FE117554B71006C0E22 /* SDL_name.h in Headers */, - DB313FE217554B71006C0E22 /* SDL_opengl.h in Headers */, - DB313FE317554B71006C0E22 /* SDL_opengles.h in Headers */, - 56A67029185654B40007D20F /* SDL_dynapi.h in Headers */, - DB313FE417554B71006C0E22 /* SDL_opengles2.h in Headers */, - DB313FE517554B71006C0E22 /* SDL_pixels.h in Headers */, - DB313FE617554B71006C0E22 /* SDL_platform.h in Headers */, - DB313FE717554B71006C0E22 /* SDL_power.h in Headers */, - DB313FE817554B71006C0E22 /* SDL_quit.h in Headers */, - DB313FE917554B71006C0E22 /* SDL_rect.h in Headers */, - DB313FEA17554B71006C0E22 /* SDL_render.h in Headers */, - DB313FEB17554B71006C0E22 /* SDL_revision.h in Headers */, - DB313FEC17554B71006C0E22 /* SDL_rwops.h in Headers */, - DB313FED17554B71006C0E22 /* SDL_scancode.h in Headers */, - DB313FEE17554B71006C0E22 /* SDL_shape.h in Headers */, - 56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, - DB313FEF17554B71006C0E22 /* SDL_stdinc.h in Headers */, - DB313FF017554B71006C0E22 /* SDL_surface.h in Headers */, - DB313FF117554B71006C0E22 /* SDL_system.h in Headers */, - DB313FF217554B71006C0E22 /* SDL_syswm.h in Headers */, - AAC070FB195606770073DCDF /* SDL_opengl_glext.h in Headers */, - DB313FF317554B71006C0E22 /* SDL_thread.h in Headers */, - DB313FF417554B71006C0E22 /* SDL_timer.h in Headers */, - DB313FF517554B71006C0E22 /* SDL_touch.h in Headers */, - DB313FF617554B71006C0E22 /* SDL_types.h in Headers */, - DB313FF717554B71006C0E22 /* SDL_version.h in Headers */, - DB313FF817554B71006C0E22 /* SDL_video.h in Headers */, - DB313F7417554B71006C0E22 /* SDL_diskaudio.h in Headers */, - 56A6700B1856545C0007D20F /* SDL_internal.h in Headers */, - DB313F7517554B71006C0E22 /* SDL_dummyaudio.h in Headers */, - DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */, - DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */, - DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */, - AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */, - DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */, - DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */, - DB313F7D17554B71006C0E22 /* default_cursor.h in Headers */, - DB313F7E17554B71006C0E22 /* scancodes_darwin.h in Headers */, - DB313F7F17554B71006C0E22 /* scancodes_linux.h in Headers */, - DB313F8017554B71006C0E22 /* scancodes_xfree86.h in Headers */, - DB313F8117554B71006C0E22 /* SDL_clipboardevents_c.h in Headers */, - DB313F8217554B71006C0E22 /* SDL_events_c.h in Headers */, - 56A67023185654B40007D20F /* SDL_dynapi_procs.h in Headers */, - DB313F8317554B71006C0E22 /* SDL_gesture_c.h in Headers */, - DB313F8417554B71006C0E22 /* SDL_keyboard_c.h in Headers */, - DB313F8517554B71006C0E22 /* SDL_mouse_c.h in Headers */, - DB313F8617554B71006C0E22 /* SDL_sysevents.h in Headers */, - DB313F8717554B71006C0E22 /* SDL_touch_c.h in Headers */, - DB313F8817554B71006C0E22 /* SDL_windowevents_c.h in Headers */, - DB313F8917554B71006C0E22 /* SDL_rwopsbundlesupport.h in Headers */, - DB313F8A17554B71006C0E22 /* SDL_haptic_c.h in Headers */, - DB313F8B17554B71006C0E22 /* SDL_syshaptic.h in Headers */, - DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */, - DB313F8D17554B71006C0E22 /* SDL_joystick_c.h in Headers */, - DB313F8E17554B71006C0E22 /* SDL_sysjoystick.h in Headers */, - DB313F8F17554B71006C0E22 /* SDL_assert_c.h in Headers */, - DB313F9017554B71006C0E22 /* SDL_error_c.h in Headers */, - DB313F9217554B71006C0E22 /* SDL_sysmutex_c.h in Headers */, - DB313F9317554B71006C0E22 /* SDL_systhread_c.h in Headers */, - DB313F9417554B71006C0E22 /* SDL_systhread.h in Headers */, - DB313F9517554B71006C0E22 /* SDL_thread_c.h in Headers */, - DB313F9617554B71006C0E22 /* SDL_timer_c.h in Headers */, - DB313F9717554B71006C0E22 /* SDL_cocoaclipboard.h in Headers */, - DB313F9817554B71006C0E22 /* SDL_cocoaevents.h in Headers */, - DB313F9917554B71006C0E22 /* SDL_cocoakeyboard.h in Headers */, - DB313F9A17554B71006C0E22 /* SDL_cocoamodes.h in Headers */, - DB313F9B17554B71006C0E22 /* SDL_cocoamouse.h in Headers */, - DB313F9C17554B71006C0E22 /* SDL_cocoaopengl.h in Headers */, - DB313F9D17554B71006C0E22 /* SDL_cocoashape.h in Headers */, - AAC07104195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, - DB313F9E17554B71006C0E22 /* SDL_cocoavideo.h in Headers */, - DB313F9F17554B71006C0E22 /* SDL_cocoawindow.h in Headers */, - DB313FA017554B71006C0E22 /* SDL_nullevents_c.h in Headers */, - DB313FA117554B71006C0E22 /* SDL_nullvideo.h in Headers */, - DB313FA217554B71006C0E22 /* SDL_blit.h in Headers */, - DB313FA317554B71006C0E22 /* SDL_blit_auto.h in Headers */, - DB313FA417554B71006C0E22 /* SDL_blit_copy.h in Headers */, - DB313FA517554B71006C0E22 /* SDL_blit_slow.h in Headers */, - DB313FA617554B71006C0E22 /* SDL_pixels_c.h in Headers */, - DB313FA717554B71006C0E22 /* SDL_RLEaccel_c.h in Headers */, - DB313FA817554B71006C0E22 /* SDL_shape_internals.h in Headers */, - DB313FA917554B71006C0E22 /* SDL_sysvideo.h in Headers */, - DB313FAA17554B71006C0E22 /* imKStoUCS.h in Headers */, - DB313FAB17554B71006C0E22 /* SDL_x11clipboard.h in Headers */, - DB313FAC17554B71006C0E22 /* SDL_x11dyn.h in Headers */, - DB313FAD17554B71006C0E22 /* SDL_x11events.h in Headers */, - DB313FAE17554B71006C0E22 /* SDL_x11keyboard.h in Headers */, - DB313FAF17554B71006C0E22 /* SDL_x11modes.h in Headers */, - DB313FB017554B71006C0E22 /* SDL_x11mouse.h in Headers */, - DB313FB117554B71006C0E22 /* SDL_x11opengl.h in Headers */, - DB313FB217554B71006C0E22 /* SDL_x11opengles.h in Headers */, - DB313FB317554B71006C0E22 /* SDL_x11shape.h in Headers */, - DB313FB417554B71006C0E22 /* SDL_x11sym.h in Headers */, - DB313FB517554B71006C0E22 /* SDL_x11touch.h in Headers */, - DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */, - AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, - DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */, - DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */, - DB313FB917554B71006C0E22 /* mmx.h in Headers */, - DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */, - DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */, - DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */, - DB313FBD17554B71006C0E22 /* SDL_blendline.h in Headers */, - DB313FBE17554B71006C0E22 /* SDL_blendpoint.h in Headers */, - DB313FBF17554B71006C0E22 /* SDL_draw.h in Headers */, - DB313FC017554B71006C0E22 /* SDL_drawline.h in Headers */, - DB313FC117554B71006C0E22 /* SDL_drawpoint.h in Headers */, - DB313FC217554B71006C0E22 /* SDL_render_sw_c.h in Headers */, - DB313FC317554B71006C0E22 /* SDL_x11framebuffer.h in Headers */, - DB313FC417554B71006C0E22 /* SDL_glfuncs.h in Headers */, - DB313FC517554B71006C0E22 /* SDL_shaders_gl.h in Headers */, - DB313FC617554B71006C0E22 /* SDL_rotate.h in Headers */, - DB313FC717554B71006C0E22 /* SDL_x11xinput2.h in Headers */, - DB313FFA17554B71006C0E22 /* SDL_cocoamessagebox.h in Headers */, - D55A1B86179F278F00625D7C /* SDL_cocoamousetap.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - BECDF5FE0761BA81005FE872 /* Framework */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0073177A0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Framework" */; - buildPhases = ( - BECDF5FF0761BA81005FE872 /* Headers */, - BECDF62A0761BA81005FE872 /* Resources */, - BECDF62C0761BA81005FE872 /* Sources */, - BECDF6680761BA81005FE872 /* Frameworks */, - ); - buildRules = ( - ); - comments = "We recommend installing to /Library/Frameworks\nAn alternative is $(HOME)/Library/Frameworks for per-user if permissions are an issue.\n\nAdd the framework to the Groups & Files panel (under Linked Frameworks is a good place) and enable the check box for the targets that need to link to it. You can also manually add \"-framework SDL\" to your linker flags if you don't like the check box system.\n\nAdd /Library/Frameworks/SDL.framework/Headers to your header search path\nAdd /Library/Frameworks to your library search path\n(Adjust the two above if installed in $(HOME)/Library/Frameworks. You can also list both paths if you want robustness.)\n\nWe used to use an exports file. It was becoming a maintenance issue we kept neglecting, so we have removed it. If you need it back, set the \"Exported Symbols File\" option to:\n../../src/main/macosx/exports/SDL.x\n(You may need to regenerate the exports list. There is a Makefile in that directory that you can run from the command line to rebuild it.)\nLong term, we want to utilize gcc 4.0's new visibility feature (analogous to declspec on Windows). Other platforms would benefit from this change too. The downside is that we still use gcc 3.3 for the PowerPC build here so only our x86 builds will cull the symbols if we go down this route (and don't use the exports file).\n\n"; - dependencies = ( - ); - name = Framework; - productInstallPath = "@executable_path/../Frameworks"; - productName = SDL; - productReference = BECDF66C0761BA81005FE872 /* SDL2.framework */; - productType = "com.apple.product-type.framework"; - }; - BECDF66D0761BA81005FE872 /* Static Library */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0073177E0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Static Library" */; - buildPhases = ( - BECDF66E0761BA81005FE872 /* Headers */, - BECDF6790761BA81005FE872 /* Sources */, - BECDF6B10761BA81005FE872 /* Frameworks */, - BECDF6B20761BA81005FE872 /* Rez */, - ); - buildRules = ( - ); - comments = "This produces libsdl.a, which is the static build of SDL. You will have to link to the Cocoa and OpenGL frameworks in your application."; - dependencies = ( - ); - name = "Static Library"; - productInstallPath = /usr/local/lib; - productName = "Static Library"; - productReference = BECDF6B30761BA81005FE872 /* libSDL2.a */; - productType = "com.apple.product-type.library.static"; - }; - BECDF6BB0761BA81005FE872 /* Standard DMG */ = { - isa = PBXNativeTarget; - buildConfigurationList = 007317860858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Standard DMG" */; - buildPhases = ( - BECDF6BD0761BA81005FE872 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - BECDF6C60761BA81005FE872 /* PBXTargetDependency */, - ); - name = "Standard DMG"; - productInstallPath = /usr/local/bin; - productName = "Standard Package"; - productReference = BECDF6BE0761BA81005FE872 /* Standard DMG */; - productType = "com.apple.product-type.tool"; - }; - DB313F7217554B71006C0E22 /* Shared Library */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB31407417554B71006C0E22 /* Build configuration list for PBXNativeTarget "Shared Library" */; - buildPhases = ( - DB313F7317554B71006C0E22 /* Headers */, - DB313FFD17554B71006C0E22 /* Sources */, - DB31406B17554B71006C0E22 /* Frameworks */, - DB31407317554B71006C0E22 /* Rez */, - ); - buildRules = ( - ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; - dependencies = ( - ); - name = "Shared Library"; - productInstallPath = /usr/local/lib; - productName = "Shared Library"; - productReference = DB31407717554B71006C0E22 /* libSDL2.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - TargetAttributes = { - BECDF5FE0761BA81005FE872 = { - DevelopmentTeam = EH385AYQ6F; - }; - BECDF6BB0761BA81005FE872 = { - DevelopmentTeam = EH385AYQ6F; - }; - }; - }; - buildConfigurationList = 0073178E0858DB0500B2BC32 /* Build configuration list for PBXProject "SDL" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* SDLFramework */; - productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - BECDF5FE0761BA81005FE872 /* Framework */, - BECDF66D0761BA81005FE872 /* Static Library */, - DB313F7217554B71006C0E22 /* Shared Library */, - BECDF6BB0761BA81005FE872 /* Standard DMG */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - BECDF62A0761BA81005FE872 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - BECDF6B20761BA81005FE872 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB31407317554B71006C0E22 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - BECDF6BD0761BA81005FE872 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 12; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\nxcrun CpMac -r $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - BECDF62C0761BA81005FE872 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 04BDFFFB12E6671800899322 /* SDL_atomic.c in Sources */, - 04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */, - 04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */, - 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD002612E6671800899322 /* SDL_audio.c in Sources */, - 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */, - 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */, - 04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */, - 04BD002D12E6671800899322 /* SDL_mixer.c in Sources */, - 04BD003512E6671800899322 /* SDL_wave.c in Sources */, - 04BD004112E6671800899322 /* SDL_cpuinfo.c in Sources */, - 04BD004812E6671800899322 /* SDL_clipboardevents.c in Sources */, - 04BD004A12E6671800899322 /* SDL_events.c in Sources */, - 04BD004C12E6671800899322 /* SDL_gesture.c in Sources */, - 04BD004E12E6671800899322 /* SDL_keyboard.c in Sources */, - 04BD005012E6671800899322 /* SDL_mouse.c in Sources */, - 04BD005212E6671800899322 /* SDL_quit.c in Sources */, - 04BD005412E6671800899322 /* SDL_touch.c in Sources */, - 04BD005612E6671800899322 /* SDL_windowevents.c in Sources */, - 04BD005912E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */, - 04BD005A12E6671800899322 /* SDL_rwops.c in Sources */, - 04BD005B12E6671800899322 /* SDL_syshaptic.c in Sources */, - 04BD005F12E6671800899322 /* SDL_haptic.c in Sources */, - 04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */, - 04BD007012E6671800899322 /* SDL_joystick.c in Sources */, - 04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */, - 04BD009412E6671800899322 /* SDL_syspower.c in Sources */, - 04BD009612E6671800899322 /* SDL_power.c in Sources */, - 04BD009C12E6671800899322 /* SDL_assert.c in Sources */, - 04BD009F12E6671800899322 /* SDL_error.c in Sources */, - 04BD00A212E6671800899322 /* SDL.c in Sources */, - 04BD00A312E6671800899322 /* SDL_getenv.c in Sources */, - 04BD00A412E6671800899322 /* SDL_iconv.c in Sources */, - 04BD00A512E6671800899322 /* SDL_malloc.c in Sources */, - 04BD00A612E6671800899322 /* SDL_qsort.c in Sources */, - 04BD00A712E6671800899322 /* SDL_stdlib.c in Sources */, - 04BD00A812E6671800899322 /* SDL_string.c in Sources */, - 04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */, - 04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */, - FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */, - 04BD00C012E6671800899322 /* SDL_syssem.c in Sources */, - 04BD00C112E6671800899322 /* SDL_systhread.c in Sources */, - 04BD00CA12E6671800899322 /* SDL_thread.c in Sources */, - 04BD00D712E6671800899322 /* SDL_timer.c in Sources */, - 04BD00D912E6671800899322 /* SDL_systimer.c in Sources */, - 04BD00F412E6671800899322 /* SDL_cocoaclipboard.m in Sources */, - 04BD00F612E6671800899322 /* SDL_cocoaevents.m in Sources */, - 04BD00F812E6671800899322 /* SDL_cocoakeyboard.m in Sources */, - 04BD00FA12E6671800899322 /* SDL_cocoamodes.m in Sources */, - 04BD00FC12E6671800899322 /* SDL_cocoamouse.m in Sources */, - 04BD00FE12E6671800899322 /* SDL_cocoaopengl.m in Sources */, - 04BD010012E6671800899322 /* SDL_cocoashape.m in Sources */, - 04BD010212E6671800899322 /* SDL_cocoavideo.m in Sources */, - 04BD010412E6671800899322 /* SDL_cocoawindow.m in Sources */, - 04BD011712E6671800899322 /* SDL_nullevents.c in Sources */, - 04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */, - 04BD017512E6671800899322 /* SDL_blit.c in Sources */, - 04BD017712E6671800899322 /* SDL_blit_0.c in Sources */, - 04BD017812E6671800899322 /* SDL_blit_1.c in Sources */, - 04BD017912E6671800899322 /* SDL_blit_A.c in Sources */, - 04BD017A12E6671800899322 /* SDL_blit_auto.c in Sources */, - 04BD017C12E6671800899322 /* SDL_blit_copy.c in Sources */, - 04BD017E12E6671800899322 /* SDL_blit_N.c in Sources */, - 04BD017F12E6671800899322 /* SDL_blit_slow.c in Sources */, - 04BD018112E6671800899322 /* SDL_bmp.c in Sources */, - 04BD018212E6671800899322 /* SDL_clipboard.c in Sources */, - 04BD018712E6671800899322 /* SDL_fillrect.c in Sources */, - 04BD018C12E6671800899322 /* SDL_pixels.c in Sources */, - 04BD018E12E6671800899322 /* SDL_rect.c in Sources */, - 04BD019612E6671800899322 /* SDL_RLEaccel.c in Sources */, - 04BD019812E6671800899322 /* SDL_shape.c in Sources */, - 04BD019A12E6671800899322 /* SDL_stretch.c in Sources */, - 04BD019B12E6671800899322 /* SDL_surface.c in Sources */, - 04BD019D12E6671800899322 /* SDL_video.c in Sources */, - 04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */, - 04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */, - 04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */, - 04BD01E112E6671800899322 /* SDL_x11events.c in Sources */, - 04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */, - 04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */, - 04BD01E912E6671800899322 /* SDL_x11mouse.c in Sources */, - 04BD01EB12E6671800899322 /* SDL_x11opengl.c in Sources */, - 04BD01ED12E6671800899322 /* SDL_x11opengles.c in Sources */, - 04BD01F112E6671800899322 /* SDL_x11shape.c in Sources */, - 04BD01F412E6671800899322 /* SDL_x11touch.c in Sources */, - 04BD01F612E6671800899322 /* SDL_x11video.c in Sources */, - 04BD01F812E6671800899322 /* SDL_x11window.c in Sources */, - 041B2CA512FA0D680087D585 /* SDL_render.c in Sources */, - 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */, - 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */, - 04F7803A12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */, - 04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */, - 04F7804B12FB74A200FC43C0 /* SDL_blendline.c in Sources */, - 04F7804D12FB74A200FC43C0 /* SDL_blendpoint.c in Sources */, - 04F7805012FB74A200FC43C0 /* SDL_drawline.c in Sources */, - 04F7805212FB74A200FC43C0 /* SDL_drawpoint.c in Sources */, - 0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */, - 0442EC1D12FE1BCB004C9285 /* SDL_render_sw.c in Sources */, - 0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */, - 0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */, - 56A67024185654B40007D20F /* SDL_dynapi.c in Sources */, - 04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */, - 0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */, - 566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */, - AA628ACA159367B7005138DD /* SDL_rotate.c in Sources */, - AA628AD1159367F2005138DD /* SDL_x11xinput2.c in Sources */, - AA9E4093163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */, - AABCC38F164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */, - AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */, - AA0F8491178D5ECC00823F9D /* SDL_systls.c in Sources */, - D55A1B82179F262300625D7C /* SDL_cocoamousetap.m in Sources */, - 567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BECDF6790761BA81005FE872 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 04BD021712E6671800899322 /* SDL_atomic.c in Sources */, - 04BD021812E6671800899322 /* SDL_spinlock.c in Sources */, - 04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */, - 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD024212E6671800899322 /* SDL_audio.c in Sources */, - 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */, - 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */, - 04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */, - 04BD024912E6671800899322 /* SDL_mixer.c in Sources */, - 04BD025112E6671800899322 /* SDL_wave.c in Sources */, - 04BD025C12E6671800899322 /* SDL_cpuinfo.c in Sources */, - 04BD026312E6671800899322 /* SDL_clipboardevents.c in Sources */, - 04BD026512E6671800899322 /* SDL_events.c in Sources */, - AA41F88014B8F1F500993C4F /* SDL_dropevents.c in Sources */, - 04BD026712E6671800899322 /* SDL_gesture.c in Sources */, - 04BD026912E6671800899322 /* SDL_keyboard.c in Sources */, - 04BD026B12E6671800899322 /* SDL_mouse.c in Sources */, - 04BD026D12E6671800899322 /* SDL_quit.c in Sources */, - 04BD026F12E6671800899322 /* SDL_touch.c in Sources */, - 04BD027112E6671800899322 /* SDL_windowevents.c in Sources */, - 04BD027412E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */, - 04BD027512E6671800899322 /* SDL_rwops.c in Sources */, - 04BD027612E6671800899322 /* SDL_syshaptic.c in Sources */, - 04BD027A12E6671800899322 /* SDL_haptic.c in Sources */, - 04BD028112E6671800899322 /* SDL_sysjoystick.c in Sources */, - BBFC088D164C6647003E6A99 /* SDL_gamecontroller.c in Sources */, - 04BD028B12E6671800899322 /* SDL_joystick.c in Sources */, - 04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */, - 04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */, - 04BD02B012E6671800899322 /* SDL_power.c in Sources */, - 04BD02B612E6671800899322 /* SDL_assert.c in Sources */, - 04BD02B912E6671800899322 /* SDL_error.c in Sources */, - 04BD02BC12E6671800899322 /* SDL.c in Sources */, - 04BD02BD12E6671800899322 /* SDL_getenv.c in Sources */, - 04BD02BE12E6671800899322 /* SDL_iconv.c in Sources */, - 04BD02BF12E6671800899322 /* SDL_malloc.c in Sources */, - 04BD02C012E6671800899322 /* SDL_qsort.c in Sources */, - 04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */, - 04BD02C212E6671800899322 /* SDL_string.c in Sources */, - 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, - 04BD02D712E6671800899322 /* SDL_syscond.c in Sources */, - 04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */, - 04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */, - 04BD02DB12E6671800899322 /* SDL_systhread.c in Sources */, - 04BD02E412E6671800899322 /* SDL_thread.c in Sources */, - 04BD02F112E6671800899322 /* SDL_timer.c in Sources */, - 04BD02F312E6671800899322 /* SDL_systimer.c in Sources */, - 04BD030E12E6671800899322 /* SDL_cocoaclipboard.m in Sources */, - 04BD031012E6671800899322 /* SDL_cocoaevents.m in Sources */, - 04BD031212E6671800899322 /* SDL_cocoakeyboard.m in Sources */, - 04BD031412E6671800899322 /* SDL_cocoamodes.m in Sources */, - 04BD031612E6671800899322 /* SDL_cocoamouse.m in Sources */, - 04BD031812E6671800899322 /* SDL_cocoaopengl.m in Sources */, - 04BD031A12E6671800899322 /* SDL_cocoashape.m in Sources */, - 04BD031C12E6671800899322 /* SDL_cocoavideo.m in Sources */, - 04BD031E12E6671800899322 /* SDL_cocoawindow.m in Sources */, - 04BD033112E6671800899322 /* SDL_nullevents.c in Sources */, - 04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */, - 04BD038F12E6671800899322 /* SDL_blit.c in Sources */, - 04BD039112E6671800899322 /* SDL_blit_0.c in Sources */, - 04BD039212E6671800899322 /* SDL_blit_1.c in Sources */, - 04BD039312E6671800899322 /* SDL_blit_A.c in Sources */, - 04BD039412E6671800899322 /* SDL_blit_auto.c in Sources */, - 04BD039612E6671800899322 /* SDL_blit_copy.c in Sources */, - 04BD039812E6671800899322 /* SDL_blit_N.c in Sources */, - 04BD039912E6671800899322 /* SDL_blit_slow.c in Sources */, - 04BD039B12E6671800899322 /* SDL_bmp.c in Sources */, - 04BD039C12E6671800899322 /* SDL_clipboard.c in Sources */, - 04BD03A112E6671800899322 /* SDL_fillrect.c in Sources */, - 04BD03A612E6671800899322 /* SDL_pixels.c in Sources */, - 04BD03A812E6671800899322 /* SDL_rect.c in Sources */, - 04BD03B012E6671800899322 /* SDL_RLEaccel.c in Sources */, - 04BD03B212E6671800899322 /* SDL_shape.c in Sources */, - 04BD03B412E6671800899322 /* SDL_stretch.c in Sources */, - 04BD03B512E6671800899322 /* SDL_surface.c in Sources */, - 04BD03B712E6671800899322 /* SDL_video.c in Sources */, - 04BD03F312E6671800899322 /* imKStoUCS.c in Sources */, - 04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */, - 04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */, - 04BD03F912E6671800899322 /* SDL_x11events.c in Sources */, - 04BD03FD12E6671800899322 /* SDL_x11keyboard.c in Sources */, - 04BD03FF12E6671800899322 /* SDL_x11modes.c in Sources */, - 04BD040112E6671800899322 /* SDL_x11mouse.c in Sources */, - 04BD040312E6671800899322 /* SDL_x11opengl.c in Sources */, - 04BD040512E6671800899322 /* SDL_x11opengles.c in Sources */, - 04BD040912E6671800899322 /* SDL_x11shape.c in Sources */, - 04BD040C12E6671800899322 /* SDL_x11touch.c in Sources */, - 04BD040E12E6671800899322 /* SDL_x11video.c in Sources */, - 04BD041012E6671800899322 /* SDL_x11window.c in Sources */, - 041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */, - 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */, - 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */, - 04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */, - 04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */, - 04F7805712FB74A200FC43C0 /* SDL_blendline.c in Sources */, - 04F7805912FB74A200FC43C0 /* SDL_blendpoint.c in Sources */, - 04F7805C12FB74A200FC43C0 /* SDL_drawline.c in Sources */, - 04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */, - 0442EC1912FE1BBA004C9285 /* SDL_render_gl.c in Sources */, - 0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */, - 56A67025185654B40007D20F /* SDL_dynapi.c in Sources */, - 0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */, - 0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */, - 04BAC0C91300C2160055DE28 /* SDL_log.c in Sources */, - 043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */, - AA628ACB159367B7005138DD /* SDL_rotate.c in Sources */, - AA628AD2159367F2005138DD /* SDL_x11xinput2.c in Sources */, - AA9E4094163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */, - AABCC390164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */, - AA0F8492178D5ECC00823F9D /* SDL_systls.c in Sources */, - D55A1B84179F263600625D7C /* SDL_cocoamousetap.m in Sources */, - DB0F490817CA5292008798C5 /* SDL_sysfilesystem.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB313FFD17554B71006C0E22 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB313FFE17554B71006C0E22 /* SDL_atomic.c in Sources */, - DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */, - DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */, - DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */, - DB31400317554B71006C0E22 /* SDL_audio.c in Sources */, - DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */, - DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */, - DB31400617554B71006C0E22 /* SDL_audiotypecvt.c in Sources */, - DB31400717554B71006C0E22 /* SDL_mixer.c in Sources */, - DB31400817554B71006C0E22 /* SDL_wave.c in Sources */, - DB31400917554B71006C0E22 /* SDL_cpuinfo.c in Sources */, - DB31400A17554B71006C0E22 /* SDL_clipboardevents.c in Sources */, - DB31400B17554B71006C0E22 /* SDL_events.c in Sources */, - DB31400C17554B71006C0E22 /* SDL_dropevents.c in Sources */, - DB31400D17554B71006C0E22 /* SDL_gesture.c in Sources */, - DB31400E17554B71006C0E22 /* SDL_keyboard.c in Sources */, - DB31400F17554B71006C0E22 /* SDL_mouse.c in Sources */, - DB31401017554B71006C0E22 /* SDL_quit.c in Sources */, - DB31401117554B71006C0E22 /* SDL_touch.c in Sources */, - DB31401217554B71006C0E22 /* SDL_windowevents.c in Sources */, - DB31401317554B71006C0E22 /* SDL_rwopsbundlesupport.m in Sources */, - DB31401417554B71006C0E22 /* SDL_rwops.c in Sources */, - DB31401517554B71006C0E22 /* SDL_syshaptic.c in Sources */, - DB31401617554B71006C0E22 /* SDL_haptic.c in Sources */, - DB31401717554B71006C0E22 /* SDL_sysjoystick.c in Sources */, - DB31401817554B71006C0E22 /* SDL_gamecontroller.c in Sources */, - DB31401917554B71006C0E22 /* SDL_joystick.c in Sources */, - DB31401A17554B71006C0E22 /* SDL_sysloadso.c in Sources */, - DB31401B17554B71006C0E22 /* SDL_syspower.c in Sources */, - DB31401C17554B71006C0E22 /* SDL_power.c in Sources */, - DB31401D17554B71006C0E22 /* SDL_assert.c in Sources */, - DB31401E17554B71006C0E22 /* SDL_error.c in Sources */, - DB31402017554B71006C0E22 /* SDL.c in Sources */, - DB31402117554B71006C0E22 /* SDL_getenv.c in Sources */, - DB31402217554B71006C0E22 /* SDL_iconv.c in Sources */, - DB31402317554B71006C0E22 /* SDL_malloc.c in Sources */, - DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */, - DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */, - DB31402617554B71006C0E22 /* SDL_string.c in Sources */, - 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, - DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */, - DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */, - DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */, - DB31402A17554B71006C0E22 /* SDL_systhread.c in Sources */, - DB31402B17554B71006C0E22 /* SDL_thread.c in Sources */, - DB31402C17554B71006C0E22 /* SDL_timer.c in Sources */, - DB31402D17554B71006C0E22 /* SDL_systimer.c in Sources */, - DB31402E17554B71006C0E22 /* SDL_cocoaclipboard.m in Sources */, - DB31402F17554B71006C0E22 /* SDL_cocoaevents.m in Sources */, - DB31403017554B71006C0E22 /* SDL_cocoakeyboard.m in Sources */, - DB31403117554B71006C0E22 /* SDL_cocoamodes.m in Sources */, - DB31403217554B71006C0E22 /* SDL_cocoamouse.m in Sources */, - DB31403317554B71006C0E22 /* SDL_cocoaopengl.m in Sources */, - DB31403417554B71006C0E22 /* SDL_cocoashape.m in Sources */, - DB31403517554B71006C0E22 /* SDL_cocoavideo.m in Sources */, - DB31403617554B71006C0E22 /* SDL_cocoawindow.m in Sources */, - DB31403717554B71006C0E22 /* SDL_nullevents.c in Sources */, - DB31403817554B71006C0E22 /* SDL_nullvideo.c in Sources */, - DB31403917554B71006C0E22 /* SDL_blit.c in Sources */, - DB31403A17554B71006C0E22 /* SDL_blit_0.c in Sources */, - DB31403B17554B71006C0E22 /* SDL_blit_1.c in Sources */, - DB31403C17554B71006C0E22 /* SDL_blit_A.c in Sources */, - DB31403D17554B71006C0E22 /* SDL_blit_auto.c in Sources */, - DB31403E17554B71006C0E22 /* SDL_blit_copy.c in Sources */, - DB31403F17554B71006C0E22 /* SDL_blit_N.c in Sources */, - DB31404017554B71006C0E22 /* SDL_blit_slow.c in Sources */, - DB31404117554B71006C0E22 /* SDL_bmp.c in Sources */, - DB31404217554B71006C0E22 /* SDL_clipboard.c in Sources */, - DB31404317554B71006C0E22 /* SDL_fillrect.c in Sources */, - DB31404417554B71006C0E22 /* SDL_pixels.c in Sources */, - DB31404517554B71006C0E22 /* SDL_rect.c in Sources */, - DB31404617554B71006C0E22 /* SDL_RLEaccel.c in Sources */, - DB31404717554B71006C0E22 /* SDL_shape.c in Sources */, - DB31404817554B71006C0E22 /* SDL_stretch.c in Sources */, - DB31404917554B71006C0E22 /* SDL_surface.c in Sources */, - DB31404A17554B71006C0E22 /* SDL_video.c in Sources */, - DB31404B17554B71006C0E22 /* imKStoUCS.c in Sources */, - DB31404C17554B71006C0E22 /* SDL_x11clipboard.c in Sources */, - DB31404D17554B71006C0E22 /* SDL_x11dyn.c in Sources */, - DB31404E17554B71006C0E22 /* SDL_x11events.c in Sources */, - DB31404F17554B71006C0E22 /* SDL_x11keyboard.c in Sources */, - DB31405017554B71006C0E22 /* SDL_x11modes.c in Sources */, - DB31405117554B71006C0E22 /* SDL_x11mouse.c in Sources */, - DB31405217554B71006C0E22 /* SDL_x11opengl.c in Sources */, - DB31405317554B71006C0E22 /* SDL_x11opengles.c in Sources */, - DB31405417554B71006C0E22 /* SDL_x11shape.c in Sources */, - DB31405517554B71006C0E22 /* SDL_x11touch.c in Sources */, - DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */, - DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */, - DB31405817554B71006C0E22 /* SDL_render.c in Sources */, - DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */, - DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */, - DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */, - DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */, - DB31405D17554B71006C0E22 /* SDL_blendline.c in Sources */, - DB31405E17554B71006C0E22 /* SDL_blendpoint.c in Sources */, - DB31405F17554B71006C0E22 /* SDL_drawline.c in Sources */, - DB31406017554B71006C0E22 /* SDL_drawpoint.c in Sources */, - DB31406117554B71006C0E22 /* SDL_render_gl.c in Sources */, - DB31406217554B71006C0E22 /* SDL_render_sw.c in Sources */, - 56A67026185654B40007D20F /* SDL_dynapi.c in Sources */, - DB31406317554B71006C0E22 /* SDL_x11framebuffer.c in Sources */, - DB31406417554B71006C0E22 /* SDL_hints.c in Sources */, - DB31406517554B71006C0E22 /* SDL_log.c in Sources */, - DB31406617554B71006C0E22 /* SDL_shaders_gl.c in Sources */, - DB31406717554B71006C0E22 /* SDL_rotate.c in Sources */, - DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */, - DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */, - DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */, - AA0F8493178D5ECC00823F9D /* SDL_systls.c in Sources */, - D55A1B83179F263500625D7C /* SDL_cocoamousetap.m in Sources */, - DB0F490A17CA5293008798C5 /* SDL_sysfilesystem.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - BECDF6C60761BA81005FE872 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BECDF5FE0761BA81005FE872 /* Framework */; - targetProxy = BECDF6C50761BA81005FE872 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 00CFA621106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DEPLOYMENT_POSTPROCESSING = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_ALTIVEC_EXTENSIONS = YES; - GCC_AUTO_VECTORIZATION = YES; - GCC_ENABLE_SSE3_EXTENSIONS = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx; - STRIP_STYLE = "non-global"; - }; - name = Release; - }; - 00CFA622106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CLANG_LINK_OBJC_RUNTIME = NO; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.1.0; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INFOPLIST_FILE = "Info-Framework.plist"; - INSTALL_PATH = "@rpath"; - OTHER_LDFLAGS = "-liconv"; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; - PROVISIONING_PROFILE = ""; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; - 00CFA623106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 00CFA625106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Standard DMG"; - PROVISIONING_PROFILE = ""; - }; - name = Release; - }; - 00CFA627106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_ALTIVEC_EXTENSIONS = YES; - GCC_AUTO_VECTORIZATION = YES; - GCC_ENABLE_SSE3_EXTENSIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.6; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - STRIP_INSTALLED_PRODUCT = NO; - }; - name = Debug; - }; - 00CFA628106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CLANG_LINK_OBJC_RUNTIME = NO; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.1.0; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INFOPLIST_FILE = "Info-Framework.plist"; - INSTALL_PATH = "@rpath"; - OTHER_LDFLAGS = "-liconv"; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; - PROVISIONING_PROFILE = ""; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - 00CFA629106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 00CFA62B106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Standard DMG"; - PROVISIONING_PROFILE = ""; - }; - name = Debug; - }; - DB31407517554B71006C0E22 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INSTALL_PATH = "@rpath"; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - DB31407617554B71006C0E22 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INSTALL_PATH = "@rpath"; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0073177A0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Framework" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA628106A568900758660 /* Debug */, - 00CFA622106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0073177E0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Static Library" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA629106A568900758660 /* Debug */, - 00CFA623106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 007317860858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Standard DMG" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA62B106A568900758660 /* Debug */, - 00CFA625106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0073178E0858DB0500B2BC32 /* Build configuration list for PBXProject "SDL" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA627106A568900758660 /* Debug */, - 00CFA621106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB31407417554B71006C0E22 /* Build configuration list for PBXNativeTarget "Shared Library" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB31407517554B71006C0E22 /* Debug */, - DB31407617554B71006C0E22 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info b/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info deleted file mode 100755 index f08facd23..000000000 --- a/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info +++ /dev/null @@ -1,15 +0,0 @@ -Title SDL 2.0.0 -Version 1 -Description SDL Library for Mac OS X (http://www.libsdl.org) -DefaultLocation /Library/Frameworks -Diskname (null) -DeleteWarning -NeedsAuthorization NO -DisableStop NO -UseUserMask NO -Application NO -Relocatable YES -Required NO -InstallOnly NO -RequiresReboot NO -InstallFat NO diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt b/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt deleted file mode 100644 index 3c7724df1..000000000 --- a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt +++ /dev/null @@ -1,19 +0,0 @@ - -Simple DirectMedia Layer -Copyright (C) 1997-2016 Sam Lantinga - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt b/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt deleted file mode 100755 index 40ac3a14c..000000000 --- a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt +++ /dev/null @@ -1,32 +0,0 @@ -The Simple DirectMedia Layer (SDL for short) is a cross-platform -library designed to make it easy to write multi-media software, -such as games and emulators. - -The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ - -This library is distributed under the terms of the zlib license: -http://zlib.net/zlib_license.html - - -This packages contains the SDL framework for OS X. -Conforming with Apple guidelines, this framework -contains both the SDL runtime component and development header files. - - -To Install: -Copy the SDL2.framework to /Library/Frameworks - -You may alternatively install it in /Library/Frameworks -if your access privileges are not high enough. - - -Additional References: - - - Screencast tutorials for getting started with OpenSceneGraph/Mac OS X are - available at: - http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips - Though these are OpenSceneGraph centric, the same exact concepts apply to - SDL, thus the videos are recommended for everybody getting started with - developing on Mac OS X. (You can skim over the PlugIns stuff since SDL - doesn't have any PlugIns to worry about.) diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/SDL_DS_Store b/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/SDL_DS_Store deleted file mode 100644 index 5658d15e4f13fbfd8a786e55c8b7a04cd1229cf8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15364 zcmeHMU2Ggz6+Yvvo3-QE>p!qcT1L1nsqn66cf8|Wr&8AA9}+3SQS8=^>f+AsjGb-9 zJKNoHoHjKWgv0|8O(mWx6tybv%|qW1k{@`0hKD>y)5NIL5`9TM>EJ?W?Ns&76 z5LW=m1gZr=Pq6~2OIea~JCb+<(jr&L$W@b93@vg;y)NxaQf@~wawkn*J~Y{~CT}R3 zXdUr&VNO~plIp1tPzW4FAiBF}%A3u4+24PEH;i9uZO0Prj~q{ex|SEKH8To ze186FusL6Ky|UAILFl0qZZvJDA>Lea!mD^A^o1bsp)X78#i|=#T}chyyjd{J5q;dW zwnp@umXRCL&4RhL#cid&n;iU7=9zN~&TCuW_~v%hXHD*VI(cXe-$q%ZOto@d4j}P% z^aF%p{3g{C522&;MA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#5D@Bqx`D^jZ|M)h9Qop|c z`D_3C*x~0f;2Hk>+}9ZT9X;#-I?P``-_gUEpT{T~+=%qUa|Z@oG4aC~gMf=DejIyU z|MbT(65L(!^B4o}llsGRD2AYaVGRF~mji?1;N1j&_$(Nse)ueklho_ptM8u!V+Ru4 z?eyc=k86tJ6!PQTUSo$JcmZQSt?6s*$GM^Sf%$PwLEAUzhW#TiFTTL-Vz2*vzi;5z zKaQaUb)bJ(129G-KaCyG!*^q#?G;?nHT?oEVzaAf4#W=z5FEHa>wSC3`(iOLLvWFZ z#Qm>-BWXNOQ#60|#=lzQU!C!QliwQS{{uXc<4l2LfAxv~4Xz*qQO>ly#T}(^1PJ^; K{S$ATfB8RpYXpJ- diff --git a/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj deleted file mode 100755 index 144d24ca5..000000000 --- a/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ /dev/null @@ -1,4882 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXAggregateTarget section */ - BEC566920761D90300A33029 /* All */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 001B599808BDB826006539E9 /* Build configuration list for PBXAggregateTarget "All" */; - buildPhases = ( - ); - dependencies = ( - DB0F490517CA5249008798C5 /* PBXTargetDependency */, - DB0F490717CA5249008798C5 /* PBXTargetDependency */, - DB166E9816A1D7CF00A1396C /* PBXTargetDependency */, - DB166E9616A1D7CD00A1396C /* PBXTargetDependency */, - DB166E6C16A1D72000A1396C /* PBXTargetDependency */, - DB166E5616A1D6B800A1396C /* PBXTargetDependency */, - DB166E3B16A1D65A00A1396C /* PBXTargetDependency */, - DB166E2016A1D5D000A1396C /* PBXTargetDependency */, - DB166E0916A1D5A400A1396C /* PBXTargetDependency */, - DB166DF216A1D53700A1396C /* PBXTargetDependency */, - DB166DD916A1D38900A1396C /* PBXTargetDependency */, - 001799481074403E00F5D044 /* PBXTargetDependency */, - 0017994C1074403E00F5D044 /* PBXTargetDependency */, - 001799501074403E00F5D044 /* PBXTargetDependency */, - 001799521074403E00F5D044 /* PBXTargetDependency */, - 0017995A1074403E00F5D044 /* PBXTargetDependency */, - 0017995E1074403E00F5D044 /* PBXTargetDependency */, - 001799601074403E00F5D044 /* PBXTargetDependency */, - 001799661074403E00F5D044 /* PBXTargetDependency */, - 001799681074403E00F5D044 /* PBXTargetDependency */, - 0017996A1074403E00F5D044 /* PBXTargetDependency */, - 0017996C1074403E00F5D044 /* PBXTargetDependency */, - 0017996E1074403E00F5D044 /* PBXTargetDependency */, - 001799701074403E00F5D044 /* PBXTargetDependency */, - 001799721074403E00F5D044 /* PBXTargetDependency */, - 001799741074403E00F5D044 /* PBXTargetDependency */, - 001799761074403E00F5D044 /* PBXTargetDependency */, - 001799781074403E00F5D044 /* PBXTargetDependency */, - 0017997C1074403E00F5D044 /* PBXTargetDependency */, - 001799801074403E00F5D044 /* PBXTargetDependency */, - 001799841074403E00F5D044 /* PBXTargetDependency */, - 001799881074403E00F5D044 /* PBXTargetDependency */, - 0017998A1074403E00F5D044 /* PBXTargetDependency */, - 0017998C1074403E00F5D044 /* PBXTargetDependency */, - 0017998E1074403E00F5D044 /* PBXTargetDependency */, - 001799921074403E00F5D044 /* PBXTargetDependency */, - 001799941074403E00F5D044 /* PBXTargetDependency */, - 001799961074403E00F5D044 /* PBXTargetDependency */, - 0017999E1074403E00F5D044 /* PBXTargetDependency */, - 001799A21074403E00F5D044 /* PBXTargetDependency */, - DB166D7016A1CEAF00A1396C /* PBXTargetDependency */, - DB166D6E16A1CEAA00A1396C /* PBXTargetDependency */, - DB166DC316A1D32C00A1396C /* PBXTargetDependency */, - ); - name = All; - productName = "Build All"; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 001794D01073667700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D11073667B00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D41073668800F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D51073668D00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D61073669200F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D71073669700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D91073669E00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DB107366A700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DC107366AC00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DE107366B900F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DF107366BD00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794E0107366C100F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794E5107366D900F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017957C10741F7900F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017957D10741F7900F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017957E10741F7900F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017957F10741F7900F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017958010741F7900F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017958110741F7900F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017958310741F7900F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017958410741F7900F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017958510741F7900F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001795901074216E00F5D044 /* testatomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017958F1074216E00F5D044 /* testatomic.c */; }; - 0017959D107421BF00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017959E107421BF00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017959F107421BF00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001795A0107421BF00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001795A1107421BF00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001795A2107421BF00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001795A4107421BF00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001795A5107421BF00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001795A6107421BF00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001795B11074222D00F5D044 /* testaudioinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 001795B01074222D00F5D044 /* testaudioinfo.c */; }; - 0017971110742F3200F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017971210742F3200F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017971310742F3200F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017971410742F3200F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017971510742F3200F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017971610742F3200F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017971810742F3200F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017971910742F3200F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017971A10742F3200F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017972810742FB900F5D044 /* testgl2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017972710742FB900F5D044 /* testgl2.c */; }; - 00179738107430D600F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 00179739107430D600F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017973A107430D600F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017973B107430D600F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017973C107430D600F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017973D107430D600F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017973F107430D600F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 00179740107430D600F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 00179741107430D600F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017974F1074315700F5D044 /* testhaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017974E1074315700F5D044 /* testhaptic.c */; }; - 0017975E107431B300F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017975F107431B300F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 00179760107431B300F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 00179761107431B300F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 00179762107431B300F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 00179763107431B300F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 00179765107431B300F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 00179766107431B300F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 00179767107431B300F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001797721074320D00F5D044 /* testdraw2.c in Sources */ = {isa = PBXBuildFile; fileRef = 001797711074320D00F5D044 /* testdraw2.c */; }; - 0017977E107432AE00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017977F107432AE00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 00179780107432AE00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 00179781107432AE00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 00179782107432AE00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 00179783107432AE00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 00179785107432AE00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 00179786107432AE00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 00179787107432AE00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 00179792107432FA00F5D044 /* testime.c in Sources */ = {isa = PBXBuildFile; fileRef = 00179791107432FA00F5D044 /* testime.c */; }; - 0017979E1074334C00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017979F1074334C00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001797A01074334C00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001797A11074334C00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001797A21074334C00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001797A31074334C00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001797A51074334C00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001797A61074334C00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001797A71074334C00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001797B41074339C00F5D044 /* testintersections.c in Sources */ = {isa = PBXBuildFile; fileRef = 001797B31074339C00F5D044 /* testintersections.c */; }; - 001797C0107433C600F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001797C1107433C600F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001797C2107433C600F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001797C3107433C600F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001797C4107433C600F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001797C5107433C600F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001797C7107433C600F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001797C8107433C600F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001797C9107433C600F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001797D41074343E00F5D044 /* testloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 001797D31074343E00F5D044 /* testloadso.c */; }; - 001798021074355200F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798031074355200F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798041074355200F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798051074355200F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798061074355200F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798071074355200F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001798091074355200F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017980A1074355200F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017980B1074355200F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798161074359B00F5D044 /* testmultiaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 001798151074359B00F5D044 /* testmultiaudio.c */; }; - 0017987F1074392D00F5D044 /* testnative.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017985A107436ED00F5D044 /* testnative.c */; }; - 001798801074392D00F5D044 /* testnativecocoa.m in Sources */ = {isa = PBXBuildFile; fileRef = 0017985C107436ED00F5D044 /* testnativecocoa.m */; }; - 001798811074392D00F5D044 /* testnativex11.c in Sources */ = {isa = PBXBuildFile; fileRef = 00179872107438D000F5D044 /* testnativex11.c */; }; - 001798841074392D00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798851074392D00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798861074392D00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798871074392D00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798881074392D00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798891074392D00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017988B1074392D00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017988C1074392D00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017988D1074392D00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798A5107439DF00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798A6107439DF00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798A7107439DF00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798A8107439DF00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798A9107439DF00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798AA107439DF00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001798AC107439DF00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001798AD107439DF00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001798AE107439DF00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798BA10743A4900F5D044 /* testpower.c in Sources */ = {isa = PBXBuildFile; fileRef = 001798B910743A4900F5D044 /* testpower.c */; }; - 001798E210743BEC00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798E310743BEC00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798E410743BEC00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798E510743BEC00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798E610743BEC00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798E710743BEC00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001798E910743BEC00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001798EA10743BEC00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001798EB10743BEC00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798FA10743E9200F5D044 /* testresample.c in Sources */ = {isa = PBXBuildFile; fileRef = 001798F910743E9200F5D044 /* testresample.c */; }; - 0017990610743F1000F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017990710743F1000F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017990810743F1000F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017990910743F1000F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017990A10743F1000F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017990B10743F1000F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017990D10743F1000F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017990E10743F1000F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017990F10743F1000F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017991A10743F5300F5D044 /* testsprite2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017991910743F5300F5D044 /* testsprite2.c */; }; - 0017992810743FB700F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017992910743FB700F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017992A10743FB700F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017992B10743FB700F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017992C10743FB700F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017992D10743FB700F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017992F10743FB700F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017993010743FB700F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017993110743FB700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017993C10743FEF00F5D044 /* testwm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017993B10743FEF00F5D044 /* testwm2.c */; }; - 002A863010730405007319AE /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 002A864110730546007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A864210730546007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A864310730546007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A864D10730546007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A864E10730546007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A864F10730546007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A865310730547007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A865410730547007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A865510730547007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A866210730547007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A866310730547007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A866410730547007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A866B10730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A866C10730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A866D10730548007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A866E10730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A866F10730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867010730548007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A867410730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A867510730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867610730548007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A867710730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A867810730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867910730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A867A10730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A867B10730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867C10730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868010730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A868110730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A868210730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868610730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A868710730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A868810730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868910730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A868A10730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A868B1073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868F1073054A007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A86901073054A007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A86911073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A86951073054A007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A86961073054A007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A86971073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A86981073054A007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A86991073054A007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A869A1073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A86A310730593007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86A410730593007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86AB10730594007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86AC10730594007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86AF10730594007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86B010730594007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86B910730594007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86BA10730594007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86BF10730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C010730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C110730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C210730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C510730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C610730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C710730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C810730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C910730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86CA10730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86CD10730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86CE10730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86D110730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86D210730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86D310730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86D410730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86D710730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86D810730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86DB10730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86DC10730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86DD10730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86DE10730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A871610730623007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A871A10730623007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A871C10730623007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872110730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872410730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872510730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872710730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872810730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872910730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872B10730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872D10730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872E10730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873010730625007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873210730625007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873310730625007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873B10730675007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A873F10730675007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874110730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874610730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874910730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874A10730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874C10730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874D10730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874E10730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875010730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875210730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875310730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875510730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875710730678007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875810730678007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875E10730745007319AE /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 002F33AA09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33AF09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B009CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B209CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B509CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B609CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B709CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B809CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33BC09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33BF09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33C109CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F340B09CA1BFF00EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F341809CA1C5B00EBEB88 /* testfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F341709CA1C5B00EBEB88 /* testfile.c */; }; - 002F342A09CA1F0300EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F343709CA1F6F00EBEB88 /* testiconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F343609CA1F6F00EBEB88 /* testiconv.c */; }; - 002F344609CA1FB300EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F345409CA202000EBEB88 /* testoverlay2.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F345209CA201C00EBEB88 /* testoverlay2.c */; }; - 002F346309CA204F00EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F347009CA20A600EBEB88 /* testplatform.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F346F09CA20A600EBEB88 /* testplatform.c */; }; - 00794E6609D20865003FC8A1 /* sample.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6209D20839003FC8A1 /* sample.wav */; }; - 00794EF009D23739003FC8A1 /* utf8.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6309D20839003FC8A1 /* utf8.txt */; }; - 00794EF709D237DE003FC8A1 /* moose.dat in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5E09D20839003FC8A1 /* moose.dat */; }; - 453774A5120915E3002F0F45 /* testshape.c in Sources */ = {isa = PBXBuildFile; fileRef = 453774A4120915E3002F0F45 /* testshape.c */; }; - BBFC08C0164C6862003E6A99 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - BBFC08C1164C6862003E6A99 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - BBFC08C2164C6862003E6A99 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - BBFC08C3164C6862003E6A99 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - BBFC08C4164C6862003E6A99 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - BBFC08C5164C6862003E6A99 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - BBFC08C7164C6862003E6A99 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - BBFC08C8164C6862003E6A99 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - BBFC08C9164C6862003E6A99 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - BBFC08D0164C6876003E6A99 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088E164C6820003E6A99 /* testgamecontroller.c */; }; - BEC566B10761D90300A33029 /* checkkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D10FFB30A2C7F000001 /* checkkeys.c */; }; - BEC566CB0761D90300A33029 /* loopwave.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4872006D84C97F000001 /* loopwave.c */; }; - BEC567010761D90300A33029 /* testerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4878006D85357F000001 /* testerror.c */; }; - BEC567290761D90400A33029 /* testthread.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D58FFB311A97F000001 /* testthread.c */; }; - BEC567360761D90400A33029 /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D62FFB312AA7F000001 /* testjoystick.c */; }; - BEC567430761D90400A33029 /* testkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D6CFFB313437F000001 /* testkeys.c */; }; - BEC567500761D90400A33029 /* testlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D75FFB313BB7F000001 /* testlock.c */; }; - BEC567780761D90500A33029 /* testsem.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E487E006D86A17F000001 /* testsem.c */; }; - BEC567930761D90500A33029 /* testtimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4880006D86A17F000001 /* testtimer.c */; }; - BEC567AD0761D90500A33029 /* testver.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4882006D86A17F000001 /* testver.c */; }; - BEC567F00761D90600A33029 /* torturethread.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4887006D86A17F000001 /* torturethread.c */; }; - DB0F48DD17CA51E5008798C5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB0F48DE17CA51E5008798C5 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB0F48DF17CA51E5008798C5 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB0F48E017CA51E5008798C5 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB0F48E117CA51E5008798C5 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB0F48E217CA51E5008798C5 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB0F48E417CA51E5008798C5 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB0F48E517CA51E5008798C5 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB0F48E617CA51E5008798C5 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB0F48EE17CA51F8008798C5 /* testdrawchessboard.c in Sources */ = {isa = PBXBuildFile; fileRef = DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */; }; - DB0F48F317CA5212008798C5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB0F48F417CA5212008798C5 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB0F48F517CA5212008798C5 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB0F48F617CA5212008798C5 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB0F48F717CA5212008798C5 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB0F48F817CA5212008798C5 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB0F48FA17CA5212008798C5 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB0F48FB17CA5212008798C5 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB0F48FC17CA5212008798C5 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB0F490317CA5225008798C5 /* testfilesystem.c in Sources */ = {isa = PBXBuildFile; fileRef = DB0F48D817CA51D2008798C5 /* testfilesystem.c */; }; - DB166D7116A1CFB200A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166D7216A1CFB200A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166D7316A1CFB200A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166D7416A1CFB200A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166D7516A1CFB200A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166D7616A1CFB200A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166D7716A1CFB200A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166D7816A1CFB200A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166D7A16A1CFD500A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166D9316A1D1A500A1396C /* SDL_test_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8416A1D1A500A1396C /* SDL_test_assert.c */; }; - DB166D9416A1D1A500A1396C /* SDL_test_common.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8516A1D1A500A1396C /* SDL_test_common.c */; }; - DB166D9516A1D1A500A1396C /* SDL_test_compare.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8616A1D1A500A1396C /* SDL_test_compare.c */; }; - DB166D9616A1D1A500A1396C /* SDL_test_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */; }; - DB166D9716A1D1A500A1396C /* SDL_test_font.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8816A1D1A500A1396C /* SDL_test_font.c */; }; - DB166D9816A1D1A500A1396C /* SDL_test_fuzzer.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */; }; - DB166D9916A1D1A500A1396C /* SDL_test_harness.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */; }; - DB166D9A16A1D1A500A1396C /* SDL_test_imageBlit.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */; }; - DB166D9B16A1D1A500A1396C /* SDL_test_imageBlitBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */; }; - DB166D9C16A1D1A500A1396C /* SDL_test_imageFace.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */; }; - DB166D9D16A1D1A500A1396C /* SDL_test_imagePrimitives.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */; }; - DB166D9E16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */; }; - DB166D9F16A1D1A500A1396C /* SDL_test_log.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9016A1D1A500A1396C /* SDL_test_log.c */; }; - DB166DA016A1D1A500A1396C /* SDL_test_md5.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9116A1D1A500A1396C /* SDL_test_md5.c */; }; - DB166DA116A1D1A500A1396C /* SDL_test_random.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9216A1D1A500A1396C /* SDL_test_random.c */; }; - DB166DA216A1D1E900A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DA316A1D1FA00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DA416A1D21700A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DA716A1D24D00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DAA16A1D27700A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DAB16A1D27C00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DAC16A1D29000A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DB116A1D2F600A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DB216A1D2F600A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DB316A1D2F600A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DB416A1D2F600A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DB516A1D2F600A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DB616A1D2F600A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DB816A1D2F600A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DB916A1D2F600A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166DBA16A1D2F600A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166DC116A1D31E00A1396C /* testgesture.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CBB16A1C74100A1396C /* testgesture.c */; }; - DB166DC816A1D36A00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DC916A1D36A00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DCA16A1D36A00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DCB16A1D36A00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DCC16A1D36A00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DCD16A1D36A00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DCF16A1D36A00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DD016A1D36A00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166DD116A1D36A00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166DD716A1D37800A1396C /* testmessage.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CBD16A1C74100A1396C /* testmessage.c */; }; - DB166DDB16A1D42F00A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166DE016A1D50C00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DE116A1D50C00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DE216A1D50C00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DE316A1D50C00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DE416A1D50C00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DE516A1D50C00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DE716A1D50C00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DE816A1D50C00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166DE916A1D50C00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166DEA16A1D50C00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DF016A1D52500A1396C /* testrelative.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CBF16A1C74100A1396C /* testrelative.c */; }; - DB166DF716A1D57C00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DF816A1D57C00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DF916A1D57C00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DFA16A1D57C00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DFB16A1D57C00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DFC16A1D57C00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DFE16A1D57C00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DFF16A1D57C00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E0016A1D57C00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E0116A1D57C00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166E0716A1D59400A1396C /* testrendercopyex.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC016A1C74100A1396C /* testrendercopyex.c */; }; - DB166E0E16A1D5AD00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E0F16A1D5AD00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E1016A1D5AD00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E1116A1D5AD00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E1216A1D5AD00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E1316A1D5AD00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E1516A1D5AD00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E1616A1D5AD00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E1716A1D5AD00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E1816A1D5AD00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166E1E16A1D5C300A1396C /* testrendertarget.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC116A1C74100A1396C /* testrendertarget.c */; }; - DB166E2216A1D5EC00A1396C /* sample.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6109D20839003FC8A1 /* sample.bmp */; }; - DB166E2316A1D60B00A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166E2516A1D61900A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166E2616A1D61900A1396C /* sample.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6109D20839003FC8A1 /* sample.bmp */; }; - DB166E2B16A1D64D00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E2C16A1D64D00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E2D16A1D64D00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E2E16A1D64D00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E2F16A1D64D00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E3016A1D64D00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E3216A1D64D00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E3316A1D64D00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E3416A1D64D00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E3C16A1D66500A1396C /* testrumble.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC216A1C74100A1396C /* testrumble.c */; }; - DB166E4116A1D69000A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E4216A1D69000A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E4316A1D69000A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E4416A1D69000A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E4516A1D69000A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E4616A1D69000A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E4816A1D69000A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E4916A1D69000A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E4A16A1D69000A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E4B16A1D69000A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166E4D16A1D69000A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166E4E16A1D69000A1396C /* sample.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6109D20839003FC8A1 /* sample.bmp */; }; - DB166E5416A1D6A300A1396C /* testscale.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC316A1C74100A1396C /* testscale.c */; }; - DB166E5B16A1D6F300A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E5C16A1D6F300A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E5D16A1D6F300A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E5E16A1D6F300A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E5F16A1D6F300A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E6016A1D6F300A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E6216A1D6F300A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E6316A1D6F300A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E6416A1D6F300A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E6A16A1D70C00A1396C /* testshader.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC416A1C74100A1396C /* testshader.c */; }; - DB166E7116A1D78400A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E7216A1D78400A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E7316A1D78400A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E7416A1D78400A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E7516A1D78400A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E7616A1D78400A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E7816A1D78400A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E7916A1D78400A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E7A16A1D78400A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E8416A1D78C00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E8516A1D78C00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E8616A1D78C00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E8716A1D78C00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E8816A1D78C00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E8916A1D78C00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E8B16A1D78C00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E8C16A1D78C00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E8D16A1D78C00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E9316A1D7BC00A1396C /* testspriteminimal.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC516A1C74100A1396C /* testspriteminimal.c */; }; - DB166E9416A1D7C700A1396C /* teststreaming.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC616A1C74100A1396C /* teststreaming.c */; }; - DB166E9A16A1D7F700A1396C /* moose.dat in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5E09D20839003FC8A1 /* moose.dat */; }; - DB166E9C16A1D80900A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166ED016A1D88100A1396C /* shapes in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB166ECF16A1D87000A1396C /* shapes */; }; - DB445EEA18184B7000B306B0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB445EEB18184B7000B306B0 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB445EEC18184B7000B306B0 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB445EED18184B7000B306B0 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB445EEE18184B7000B306B0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB445EEF18184B7000B306B0 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB445EF118184B7000B306B0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB445EF218184B7000B306B0 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB445EF318184B7000B306B0 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB445EF418184B7000B306B0 /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB445EFB18184BB600B306B0 /* testdropfile.c in Sources */ = {isa = PBXBuildFile; fileRef = DB445EFA18184BB600B306B0 /* testdropfile.c */; }; - DB89957118A19ABA0092407C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB89957218A19ABA0092407C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB89957318A19ABA0092407C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB89957418A19ABA0092407C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB89957518A19ABA0092407C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB89957618A19ABA0092407C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB89957818A19ABA0092407C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB89957918A19ABA0092407C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB89957A18A19ABA0092407C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB89958418A19B130092407C /* testhotplug.c in Sources */ = {isa = PBXBuildFile; fileRef = DB89958318A19B130092407C /* testhotplug.c */; }; - DBEC54DD1A1A81C3005B1EAB /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - DBEC54DE1A1A81C3005B1EAB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DBEC54DF1A1A81C3005B1EAB /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DBEC54E01A1A81C3005B1EAB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DBEC54E11A1A81C3005B1EAB /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DBEC54E21A1A81C3005B1EAB /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DBEC54E31A1A81C3005B1EAB /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DBEC54E41A1A81C3005B1EAB /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DBEC54E51A1A81C3005B1EAB /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DBEC54E61A1A81C3005B1EAB /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DBEC54EB1A1A8205005B1EAB /* controllermap.c in Sources */ = {isa = PBXBuildFile; fileRef = DBEC54D11A1A811D005B1EAB /* controllermap.c */; }; - DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D61A1A8145005B1EAB /* axis.bmp */; }; - DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D71A1A8145005B1EAB /* button.bmp */; }; - DBEC54EF1A1A828F005B1EAB /* controllermap.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* controllermap.bmp */; }; - FA73672319A54A90004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672819A54AB6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672919A54AB9004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672A19A54AC0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672B19A54AC2004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672C19A54AC5004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672D19A54AC7004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672E19A54ACA004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672F19A54ACC004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673019A54AD0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673119A54AD3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673219A54AD5004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673319A54AD8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673419A54ADB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673519A54ADE004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673619A54AE1004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673719A54AE3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673819A54AE6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673919A54AE8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673A19A54AEB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673B19A54AED004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673C19A54AF0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673D19A54AF3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673E19A54AF6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673F19A54AF8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674019A54AFB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674119A54AFE004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674219A54B01004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674319A54B04004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674419A54B06004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674519A54B09004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674619A54B0B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674719A54B0F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674819A54B13004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674919A54B16004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674A19A54B19004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674B19A54B1B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674C19A54B1F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674D19A54B22004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674E19A54B25004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674F19A54B28004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675019A54B2B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675119A54B2F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675219A54B32004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675319A54B35004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 001799471074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC566AB0761D90300A33029; - remoteInfo = checkkeys; - }; - 0017994B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC566C50761D90300A33029; - remoteInfo = loopwave; - }; - 0017994F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017957410741F7900F5D044; - remoteInfo = testatomic; - }; - 001799511074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179595107421BF00F5D044; - remoteInfo = testaudioinfo; - }; - 001799591074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179756107431B300F5D044; - remoteInfo = testdraw2; - }; - 0017995D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC566FB0761D90300A33029; - remoteInfo = testerror; - }; - 0017995F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F340109CA1BFF00EBEB88; - remoteInfo = testfile; - }; - 001799651074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017970910742F3200F5D044; - remoteInfo = testgl2; - }; - 001799671074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179730107430D600F5D044; - remoteInfo = testhaptic; - }; - 001799691074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567230761D90400A33029; - remoteInfo = testthread; - }; - 0017996B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F342009CA1F0300EBEB88; - remoteInfo = testiconv; - }; - 0017996D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179776107432AE00F5D044; - remoteInfo = testime; - }; - 0017996F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001797961074334C00F5D044; - remoteInfo = testintersections; - }; - 001799711074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567300761D90400A33029; - remoteInfo = testjoystick; - }; - 001799731074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC5673D0761D90400A33029; - remoteInfo = testkeys; - }; - 001799751074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001797B8107433C600F5D044; - remoteInfo = testloadso; - }; - 001799771074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC5674A0761D90400A33029; - remoteInfo = testlock; - }; - 0017997B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001797FA1074355200F5D044; - remoteInfo = testmultiaudio; - }; - 0017997F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001798781074392D00F5D044; - remoteInfo = testnativex11; - }; - 001799831074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F343C09CA1FB300EBEB88; - remoteInfo = testoverlay2; - }; - 001799871074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F345909CA204F00EBEB88; - remoteInfo = testplatform; - }; - 001799891074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017989D107439DF00F5D044; - remoteInfo = testpower; - }; - 0017998B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001798DA10743BEC00F5D044; - remoteInfo = testresample; - }; - 0017998D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567720761D90500A33029; - remoteInfo = testsem; - }; - 001799911074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001798FE10743F1000F5D044; - remoteInfo = testsprite2; - }; - 001799931074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC5678D0761D90500A33029; - remoteInfo = testtimer; - }; - 001799951074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567A70761D90500A33029; - remoteInfo = testversion; - }; - 0017999D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017992010743FB700F5D044; - remoteInfo = testwm2; - }; - 001799A11074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567EA0761D90600A33029; - remoteInfo = torturethread; - }; - 003FA642093FFD41000C53B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = BECDF66C0761BA81005FE872; - remoteInfo = Framework; - }; - 003FA644093FFD41000C53B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = BECDF6B30761BA81005FE872; - remoteInfo = "Static Library"; - }; - 003FA648093FFD41000C53B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = BECDF6BE0761BA81005FE872; - remoteInfo = "Standard DMG"; - }; - DB0F490417CA5249008798C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB0F48D917CA51E5008798C5; - remoteInfo = testdrawchessboard; - }; - DB0F490617CA5249008798C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB0F48EF17CA5212008798C5; - remoteInfo = testfilesystem; - }; - DB166D6D16A1CEAA00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BBFC08B7164C6862003E6A99; - remoteInfo = testgamecontroller; - }; - DB166D6F16A1CEAF00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4537749112091504002F0F45; - remoteInfo = testshape; - }; - DB166DC216A1D32C00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DAD16A1D2F600A1396C; - remoteInfo = testgesture; - }; - DB166DD816A1D38900A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DC416A1D36A00A1396C; - remoteInfo = testmessage; - }; - DB166DF116A1D53700A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DDC16A1D50C00A1396C; - remoteInfo = testrelative; - }; - DB166E0816A1D5A400A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DF316A1D57C00A1396C; - remoteInfo = testrendercopyex; - }; - DB166E1F16A1D5D000A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E0A16A1D5AD00A1396C; - remoteInfo = testrendertarget; - }; - DB166E3A16A1D65A00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E2716A1D64D00A1396C; - remoteInfo = testrumble; - }; - DB166E5516A1D6B800A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E3D16A1D69000A1396C; - remoteInfo = testscale; - }; - DB166E6B16A1D72000A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E5716A1D6F300A1396C; - remoteInfo = testshader; - }; - DB166E9516A1D7CD00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E6D16A1D78400A1396C; - remoteInfo = testspriteminimal; - }; - DB166E9716A1D7CF00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E8016A1D78C00A1396C; - remoteInfo = teststreaming; - }; - DB1D40D617B3F30D00D74CFC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = DB31407717554B71006C0E22; - remoteInfo = "Shared Library"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 00794E6409D2084F003FC8A1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - 00794E6609D20865003FC8A1 /* sample.wav in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00794EEC09D2371F003FC8A1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - 00794EF009D23739003FC8A1 /* utf8.txt in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00794EF409D237C7003FC8A1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - 00794EF709D237DE003FC8A1 /* moose.dat in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48E717CA51E5008798C5 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48FD17CA5212008798C5 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DDA16A1D40F00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166DDB16A1D42F00A1396C /* icon.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2116A1D5DF00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E2316A1D60B00A1396C /* icon.bmp in CopyFiles */, - DB166E2216A1D5EC00A1396C /* sample.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2416A1D61000A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E2516A1D61900A1396C /* icon.bmp in CopyFiles */, - DB166E2616A1D61900A1396C /* sample.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E4C16A1D69000A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E4D16A1D69000A1396C /* icon.bmp in CopyFiles */, - DB166E4E16A1D69000A1396C /* sample.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E9916A1D7EE00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E9A16A1D7F700A1396C /* moose.dat in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E9B16A1D7FC00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E9C16A1D80900A1396C /* icon.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166ECE16A1D85400A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166ED016A1D88100A1396C /* shapes in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DBEC54EC1A1A827C005B1EAB /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */, - DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */, - DBEC54EF1A1A828F005B1EAB /* controllermap.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0017958C10741F7900F5D044 /* testatomic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testatomic; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017958F1074216E00F5D044 /* testatomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testatomic.c; path = ../../test/testatomic.c; sourceTree = SOURCE_ROOT; }; - 001795AD107421BF00F5D044 /* testaudioinfo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testaudioinfo; sourceTree = BUILT_PRODUCTS_DIR; }; - 001795B01074222D00F5D044 /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testaudioinfo.c; path = ../../test/testaudioinfo.c; sourceTree = SOURCE_ROOT; }; - 0017972110742F3200F5D044 /* testgl2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgl2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017972710742FB900F5D044 /* testgl2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgl2.c; path = ../../test/testgl2.c; sourceTree = SOURCE_ROOT; }; - 00179748107430D600F5D044 /* testhaptic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhaptic; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017974E1074315700F5D044 /* testhaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testhaptic.c; path = ../../test/testhaptic.c; sourceTree = SOURCE_ROOT; }; - 0017976E107431B300F5D044 /* testdraw2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testdraw2; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797711074320D00F5D044 /* testdraw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testdraw2.c; path = ../../test/testdraw2.c; sourceTree = SOURCE_ROOT; }; - 0017978E107432AE00F5D044 /* testime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testime; sourceTree = BUILT_PRODUCTS_DIR; }; - 00179791107432FA00F5D044 /* testime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testime.c; path = ../../test/testime.c; sourceTree = SOURCE_ROOT; }; - 001797AE1074334C00F5D044 /* testintersections */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testintersections; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797B31074339C00F5D044 /* testintersections.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testintersections.c; path = ../../test/testintersections.c; sourceTree = SOURCE_ROOT; }; - 001797D0107433C600F5D044 /* testloadso */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testloadso; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797D31074343E00F5D044 /* testloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testloadso.c; path = ../../test/testloadso.c; sourceTree = SOURCE_ROOT; }; - 001798121074355200F5D044 /* testmultiaudio */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testmultiaudio; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798151074359B00F5D044 /* testmultiaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testmultiaudio.c; path = ../../test/testmultiaudio.c; sourceTree = SOURCE_ROOT; }; - 0017985A107436ED00F5D044 /* testnative.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testnative.c; path = ../../test/testnative.c; sourceTree = SOURCE_ROOT; }; - 0017985B107436ED00F5D044 /* testnative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testnative.h; path = ../../test/testnative.h; sourceTree = SOURCE_ROOT; }; - 0017985C107436ED00F5D044 /* testnativecocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = testnativecocoa.m; path = ../../test/testnativecocoa.m; sourceTree = SOURCE_ROOT; }; - 00179872107438D000F5D044 /* testnativex11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testnativex11.c; path = ../../test/testnativex11.c; sourceTree = SOURCE_ROOT; }; - 001798941074392D00F5D044 /* testnative */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testnative; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798B5107439DF00F5D044 /* testpower */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testpower; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798B910743A4900F5D044 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; }; - 001798F210743BEC00F5D044 /* testresample */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testresample; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798F910743E9200F5D044 /* testresample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testresample.c; path = ../../test/testresample.c; sourceTree = SOURCE_ROOT; }; - 0017991610743F1000F5D044 /* testsprite2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testsprite2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017991910743F5300F5D044 /* testsprite2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testsprite2.c; path = ../../test/testsprite2.c; sourceTree = SOURCE_ROOT; }; - 0017993810743FB700F5D044 /* testwm2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testwm2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017993B10743FEF00F5D044 /* testwm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testwm2.c; path = ../../test/testwm2.c; sourceTree = SOURCE_ROOT; }; - 002A863B10730545007319AE /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; - 002A863C10730545007319AE /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 002A863D10730545007319AE /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 002A869F10730593007319AE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = ""; }; - 002A86A010730593007319AE /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 002A871410730623007319AE /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; - 002A873910730675007319AE /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; - 002F33A709CA188600EBEB88 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 002F341209CA1BFF00EBEB88 /* testfile */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testfile; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F341709CA1C5B00EBEB88 /* testfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testfile.c; path = ../../test/testfile.c; sourceTree = SOURCE_ROOT; }; - 002F343109CA1F0300EBEB88 /* testiconv */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testiconv; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F343609CA1F6F00EBEB88 /* testiconv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testiconv.c; path = ../../test/testiconv.c; sourceTree = SOURCE_ROOT; }; - 002F344D09CA1FB300EBEB88 /* testoverlay2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testoverlay2; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F345209CA201C00EBEB88 /* testoverlay2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testoverlay2.c; path = ../../test/testoverlay2.c; sourceTree = SOURCE_ROOT; }; - 002F346A09CA204F00EBEB88 /* testplatform */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testplatform; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F346F09CA20A600EBEB88 /* testplatform.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testplatform.c; path = ../../test/testplatform.c; sourceTree = SOURCE_ROOT; }; - 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; }; - 00794E5D09D20839003FC8A1 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = icon.bmp; path = ../../test/icon.bmp; sourceTree = SOURCE_ROOT; }; - 00794E5E09D20839003FC8A1 /* moose.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = moose.dat; path = ../../test/moose.dat; sourceTree = SOURCE_ROOT; }; - 00794E5F09D20839003FC8A1 /* picture.xbm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = picture.xbm; path = ../../test/picture.xbm; sourceTree = SOURCE_ROOT; }; - 00794E6109D20839003FC8A1 /* sample.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = sample.bmp; path = ../../test/sample.bmp; sourceTree = SOURCE_ROOT; }; - 00794E6209D20839003FC8A1 /* sample.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = sample.wav; path = ../../test/sample.wav; sourceTree = SOURCE_ROOT; }; - 00794E6309D20839003FC8A1 /* utf8.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = utf8.txt; path = ../../test/utf8.txt; sourceTree = SOURCE_ROOT; }; - 083E4872006D84C97F000001 /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = loopwave.c; path = ../../test/loopwave.c; sourceTree = SOURCE_ROOT; }; - 083E4878006D85357F000001 /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testerror.c; path = ../../test/testerror.c; sourceTree = SOURCE_ROOT; }; - 083E487E006D86A17F000001 /* testsem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testsem.c; path = ../../test/testsem.c; sourceTree = SOURCE_ROOT; }; - 083E4880006D86A17F000001 /* testtimer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testtimer.c; path = ../../test/testtimer.c; sourceTree = SOURCE_ROOT; }; - 083E4882006D86A17F000001 /* testver.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testver.c; path = ../../test/testver.c; sourceTree = SOURCE_ROOT; }; - 083E4887006D86A17F000001 /* torturethread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = torturethread.c; path = ../../test/torturethread.c; sourceTree = SOURCE_ROOT; }; - 092D6D10FFB30A2C7F000001 /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = checkkeys.c; path = ../../test/checkkeys.c; sourceTree = SOURCE_ROOT; }; - 092D6D58FFB311A97F000001 /* testthread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testthread.c; path = ../../test/testthread.c; sourceTree = SOURCE_ROOT; }; - 092D6D62FFB312AA7F000001 /* testjoystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testjoystick.c; path = ../../test/testjoystick.c; sourceTree = SOURCE_ROOT; }; - 092D6D6CFFB313437F000001 /* testkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testkeys.c; path = ../../test/testkeys.c; sourceTree = SOURCE_ROOT; }; - 092D6D75FFB313BB7F000001 /* testlock.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testlock.c; path = ../../test/testlock.c; sourceTree = SOURCE_ROOT; }; - 4537749212091504002F0F45 /* testshape */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testshape; sourceTree = BUILT_PRODUCTS_DIR; }; - 453774A4120915E3002F0F45 /* testshape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testshape.c; path = ../../test/testshape.c; sourceTree = SOURCE_ROOT; }; - BBFC088E164C6820003E6A99 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgamecontroller.c; path = ../../test/testgamecontroller.c; sourceTree = ""; }; - BBFC08CD164C6862003E6A99 /* testgamecontroller */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgamecontroller; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC566B60761D90300A33029 /* checkkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = checkkeys; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC566D10761D90300A33029 /* loopwave */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = loopwave; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567060761D90400A33029 /* testerror */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testerror; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5672E0761D90400A33029 /* testthread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testthread; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5673B0761D90400A33029 /* testjoystick */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testjoystick; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567480761D90400A33029 /* testkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testkeys; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567550761D90400A33029 /* testlock */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testlock; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5677D0761D90500A33029 /* testsem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testsem; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567980761D90500A33029 /* testtimer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testtimer; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567B20761D90500A33029 /* testversion */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testversion; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567F50761D90600A33029 /* torturethread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = torturethread; sourceTree = BUILT_PRODUCTS_DIR; }; - DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testdrawchessboard.c; path = ../../test/testdrawchessboard.c; sourceTree = ""; }; - DB0F48D817CA51D2008798C5 /* testfilesystem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testfilesystem.c; path = ../../test/testfilesystem.c; sourceTree = ""; }; - DB0F48EC17CA51E5008798C5 /* testdrawchessboard */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testdrawchessboard; sourceTree = BUILT_PRODUCTS_DIR; }; - DB0F490117CA5212008798C5 /* testfilesystem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testfilesystem; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166CBB16A1C74100A1396C /* testgesture.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testgesture.c; path = ../../test/testgesture.c; sourceTree = ""; }; - DB166CBC16A1C74100A1396C /* testgles.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testgles.c; path = ../../test/testgles.c; sourceTree = ""; }; - DB166CBD16A1C74100A1396C /* testmessage.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testmessage.c; path = ../../test/testmessage.c; sourceTree = ""; }; - DB166CBF16A1C74100A1396C /* testrelative.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrelative.c; path = ../../test/testrelative.c; sourceTree = ""; }; - DB166CC016A1C74100A1396C /* testrendercopyex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrendercopyex.c; path = ../../test/testrendercopyex.c; sourceTree = ""; }; - DB166CC116A1C74100A1396C /* testrendertarget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrendertarget.c; path = ../../test/testrendertarget.c; sourceTree = ""; }; - DB166CC216A1C74100A1396C /* testrumble.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrumble.c; path = ../../test/testrumble.c; sourceTree = ""; }; - DB166CC316A1C74100A1396C /* testscale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = ""; }; - DB166CC416A1C74100A1396C /* testshader.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testshader.c; path = ../../test/testshader.c; sourceTree = ""; }; - DB166CC516A1C74100A1396C /* testspriteminimal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testspriteminimal.c; path = ../../test/testspriteminimal.c; sourceTree = ""; }; - DB166CC616A1C74100A1396C /* teststreaming.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = teststreaming.c; path = ../../test/teststreaming.c; sourceTree = ""; }; - DB166D7F16A1D12400A1396C /* libSDL_test.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL_test.a; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166D8416A1D1A500A1396C /* SDL_test_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_assert.c; path = ../../src/test/SDL_test_assert.c; sourceTree = ""; }; - DB166D8516A1D1A500A1396C /* SDL_test_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_common.c; path = ../../src/test/SDL_test_common.c; sourceTree = ""; }; - DB166D8616A1D1A500A1396C /* SDL_test_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_compare.c; path = ../../src/test/SDL_test_compare.c; sourceTree = ""; }; - DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_crc32.c; path = ../../src/test/SDL_test_crc32.c; sourceTree = ""; }; - DB166D8816A1D1A500A1396C /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_font.c; path = ../../src/test/SDL_test_font.c; sourceTree = ""; }; - DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_fuzzer.c; path = ../../src/test/SDL_test_fuzzer.c; sourceTree = ""; }; - DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_harness.c; path = ../../src/test/SDL_test_harness.c; sourceTree = ""; }; - DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlit.c; path = ../../src/test/SDL_test_imageBlit.c; sourceTree = ""; }; - DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlitBlend.c; path = ../../src/test/SDL_test_imageBlitBlend.c; sourceTree = ""; }; - DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageFace.c; path = ../../src/test/SDL_test_imageFace.c; sourceTree = ""; }; - DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitives.c; path = ../../src/test/SDL_test_imagePrimitives.c; sourceTree = ""; }; - DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitivesBlend.c; path = ../../src/test/SDL_test_imagePrimitivesBlend.c; sourceTree = ""; }; - DB166D9016A1D1A500A1396C /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_log.c; path = ../../src/test/SDL_test_log.c; sourceTree = ""; }; - DB166D9116A1D1A500A1396C /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_md5.c; path = ../../src/test/SDL_test_md5.c; sourceTree = ""; }; - DB166D9216A1D1A500A1396C /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_random.c; path = ../../src/test/SDL_test_random.c; sourceTree = ""; }; - DB166DBF16A1D2F600A1396C /* testgesture */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgesture; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166DD516A1D36A00A1396C /* testmessage */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testmessage; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166DEE16A1D50C00A1396C /* testrelative */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrelative; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E0516A1D57C00A1396C /* testrendercopyex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrendercopyex; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E1C16A1D5AD00A1396C /* testrendertarget */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrendertarget; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E3816A1D64D00A1396C /* testrumble */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrumble; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E5216A1D69000A1396C /* testscale */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testscale; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E6816A1D6F300A1396C /* testshader */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testshader; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E7E16A1D78400A1396C /* testspriteminimal */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testspriteminimal; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E9116A1D78C00A1396C /* teststreaming */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = teststreaming; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166ECF16A1D87000A1396C /* shapes */ = {isa = PBXFileReference; lastKnownFileType = folder; name = shapes; path = ../../test/shapes; sourceTree = ""; }; - DB445EF818184B7000B306B0 /* testdropfile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testdropfile.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB445EFA18184BB600B306B0 /* testdropfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testdropfile.c; path = ../../test/testdropfile.c; sourceTree = ""; }; - DB89957E18A19ABA0092407C /* testhotplug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhotplug; sourceTree = BUILT_PRODUCTS_DIR; }; - DB89958318A19B130092407C /* testhotplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testhotplug.c; path = ../../test/testhotplug.c; sourceTree = ""; }; - DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "TestDropFile-Info.plist"; sourceTree = ""; }; - DBEC54D11A1A811D005B1EAB /* controllermap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = controllermap.c; path = ../../test/controllermap.c; sourceTree = ""; }; - DBEC54D61A1A8145005B1EAB /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = axis.bmp; path = ../../test/axis.bmp; sourceTree = ""; }; - DBEC54D71A1A8145005B1EAB /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = button.bmp; path = ../../test/button.bmp; sourceTree = ""; }; - DBEC54D81A1A8145005B1EAB /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = controllermap.bmp; path = ../../test/controllermap.bmp; sourceTree = ""; }; - DBEC54EA1A1A81C3005B1EAB /* controllermap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = controllermap; sourceTree = BUILT_PRODUCTS_DIR; }; - FA73672219A54A90004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 0017957A10741F7900F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672919A54AB9004122E4 /* CoreVideo.framework in Frameworks */, - 0017957C10741F7900F5D044 /* Cocoa.framework in Frameworks */, - 0017957D10741F7900F5D044 /* CoreAudio.framework in Frameworks */, - 0017957E10741F7900F5D044 /* ForceFeedback.framework in Frameworks */, - 0017957F10741F7900F5D044 /* IOKit.framework in Frameworks */, - 0017958010741F7900F5D044 /* AudioToolbox.framework in Frameworks */, - 0017958110741F7900F5D044 /* CoreFoundation.framework in Frameworks */, - 0017958310741F7900F5D044 /* AudioUnit.framework in Frameworks */, - 0017958410741F7900F5D044 /* Carbon.framework in Frameworks */, - 0017958510741F7900F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017959B107421BF00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672A19A54AC0004122E4 /* CoreVideo.framework in Frameworks */, - 0017959D107421BF00F5D044 /* Cocoa.framework in Frameworks */, - 0017959E107421BF00F5D044 /* CoreAudio.framework in Frameworks */, - 0017959F107421BF00F5D044 /* ForceFeedback.framework in Frameworks */, - 001795A0107421BF00F5D044 /* IOKit.framework in Frameworks */, - 001795A1107421BF00F5D044 /* AudioToolbox.framework in Frameworks */, - 001795A2107421BF00F5D044 /* CoreFoundation.framework in Frameworks */, - 001795A4107421BF00F5D044 /* AudioUnit.framework in Frameworks */, - 001795A5107421BF00F5D044 /* Carbon.framework in Frameworks */, - 001795A6107421BF00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017970F10742F3200F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673319A54AD8004122E4 /* CoreVideo.framework in Frameworks */, - 0017971110742F3200F5D044 /* Cocoa.framework in Frameworks */, - 0017971210742F3200F5D044 /* CoreAudio.framework in Frameworks */, - 0017971310742F3200F5D044 /* ForceFeedback.framework in Frameworks */, - 0017971410742F3200F5D044 /* IOKit.framework in Frameworks */, - 0017971510742F3200F5D044 /* AudioToolbox.framework in Frameworks */, - 0017971610742F3200F5D044 /* CoreFoundation.framework in Frameworks */, - 0017971810742F3200F5D044 /* AudioUnit.framework in Frameworks */, - 0017971910742F3200F5D044 /* Carbon.framework in Frameworks */, - 0017971A10742F3200F5D044 /* libSDL2.a in Frameworks */, - DB166DA316A1D1FA00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00179736107430D600F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673419A54ADB004122E4 /* CoreVideo.framework in Frameworks */, - 00179738107430D600F5D044 /* Cocoa.framework in Frameworks */, - 00179739107430D600F5D044 /* CoreAudio.framework in Frameworks */, - 0017973A107430D600F5D044 /* ForceFeedback.framework in Frameworks */, - 0017973B107430D600F5D044 /* IOKit.framework in Frameworks */, - 0017973C107430D600F5D044 /* AudioToolbox.framework in Frameworks */, - 0017973D107430D600F5D044 /* CoreFoundation.framework in Frameworks */, - 0017973F107430D600F5D044 /* AudioUnit.framework in Frameworks */, - 00179740107430D600F5D044 /* Carbon.framework in Frameworks */, - 00179741107430D600F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017975C107431B300F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672B19A54AC2004122E4 /* CoreVideo.framework in Frameworks */, - 0017975E107431B300F5D044 /* Cocoa.framework in Frameworks */, - 0017975F107431B300F5D044 /* CoreAudio.framework in Frameworks */, - 00179760107431B300F5D044 /* ForceFeedback.framework in Frameworks */, - 00179761107431B300F5D044 /* IOKit.framework in Frameworks */, - 00179762107431B300F5D044 /* AudioToolbox.framework in Frameworks */, - 00179763107431B300F5D044 /* CoreFoundation.framework in Frameworks */, - 00179765107431B300F5D044 /* AudioUnit.framework in Frameworks */, - 00179766107431B300F5D044 /* Carbon.framework in Frameworks */, - 00179767107431B300F5D044 /* libSDL2.a in Frameworks */, - DB166DA216A1D1E900A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017977C107432AE00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673719A54AE3004122E4 /* CoreVideo.framework in Frameworks */, - 0017977E107432AE00F5D044 /* Cocoa.framework in Frameworks */, - 0017977F107432AE00F5D044 /* CoreAudio.framework in Frameworks */, - 00179780107432AE00F5D044 /* ForceFeedback.framework in Frameworks */, - 00179781107432AE00F5D044 /* IOKit.framework in Frameworks */, - 00179782107432AE00F5D044 /* AudioToolbox.framework in Frameworks */, - 00179783107432AE00F5D044 /* CoreFoundation.framework in Frameworks */, - 00179785107432AE00F5D044 /* AudioUnit.framework in Frameworks */, - 00179786107432AE00F5D044 /* Carbon.framework in Frameworks */, - 00179787107432AE00F5D044 /* libSDL2.a in Frameworks */, - DB166DA716A1D24D00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017979C1074334C00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673819A54AE6004122E4 /* CoreVideo.framework in Frameworks */, - 0017979E1074334C00F5D044 /* Cocoa.framework in Frameworks */, - 0017979F1074334C00F5D044 /* CoreAudio.framework in Frameworks */, - 001797A01074334C00F5D044 /* ForceFeedback.framework in Frameworks */, - 001797A11074334C00F5D044 /* IOKit.framework in Frameworks */, - 001797A21074334C00F5D044 /* AudioToolbox.framework in Frameworks */, - 001797A31074334C00F5D044 /* CoreFoundation.framework in Frameworks */, - 001797A51074334C00F5D044 /* AudioUnit.framework in Frameworks */, - 001797A61074334C00F5D044 /* Carbon.framework in Frameworks */, - 001797A71074334C00F5D044 /* libSDL2.a in Frameworks */, - DB166DAA16A1D27700A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001797BE107433C600F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673B19A54AED004122E4 /* CoreVideo.framework in Frameworks */, - 001797C0107433C600F5D044 /* Cocoa.framework in Frameworks */, - 001797C1107433C600F5D044 /* CoreAudio.framework in Frameworks */, - 001797C2107433C600F5D044 /* ForceFeedback.framework in Frameworks */, - 001797C3107433C600F5D044 /* IOKit.framework in Frameworks */, - 001797C4107433C600F5D044 /* AudioToolbox.framework in Frameworks */, - 001797C5107433C600F5D044 /* CoreFoundation.framework in Frameworks */, - 001797C7107433C600F5D044 /* AudioUnit.framework in Frameworks */, - 001797C8107433C600F5D044 /* Carbon.framework in Frameworks */, - 001797C9107433C600F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798001074355200F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673E19A54AF6004122E4 /* CoreVideo.framework in Frameworks */, - 001798021074355200F5D044 /* Cocoa.framework in Frameworks */, - 001798031074355200F5D044 /* CoreAudio.framework in Frameworks */, - 001798041074355200F5D044 /* ForceFeedback.framework in Frameworks */, - 001798051074355200F5D044 /* IOKit.framework in Frameworks */, - 001798061074355200F5D044 /* AudioToolbox.framework in Frameworks */, - 001798071074355200F5D044 /* CoreFoundation.framework in Frameworks */, - 001798091074355200F5D044 /* AudioUnit.framework in Frameworks */, - 0017980A1074355200F5D044 /* Carbon.framework in Frameworks */, - 0017980B1074355200F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798821074392D00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673F19A54AF8004122E4 /* CoreVideo.framework in Frameworks */, - 001798841074392D00F5D044 /* Cocoa.framework in Frameworks */, - 001798851074392D00F5D044 /* CoreAudio.framework in Frameworks */, - 001798861074392D00F5D044 /* ForceFeedback.framework in Frameworks */, - 001798871074392D00F5D044 /* IOKit.framework in Frameworks */, - 001798881074392D00F5D044 /* AudioToolbox.framework in Frameworks */, - 001798891074392D00F5D044 /* CoreFoundation.framework in Frameworks */, - 0017988B1074392D00F5D044 /* AudioUnit.framework in Frameworks */, - 0017988C1074392D00F5D044 /* Carbon.framework in Frameworks */, - 0017988D1074392D00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798A3107439DF00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674219A54B01004122E4 /* CoreVideo.framework in Frameworks */, - 001798A5107439DF00F5D044 /* Cocoa.framework in Frameworks */, - 001798A6107439DF00F5D044 /* CoreAudio.framework in Frameworks */, - 001798A7107439DF00F5D044 /* ForceFeedback.framework in Frameworks */, - 001798A8107439DF00F5D044 /* IOKit.framework in Frameworks */, - 001798A9107439DF00F5D044 /* AudioToolbox.framework in Frameworks */, - 001798AA107439DF00F5D044 /* CoreFoundation.framework in Frameworks */, - 001798AC107439DF00F5D044 /* AudioUnit.framework in Frameworks */, - 001798AD107439DF00F5D044 /* Carbon.framework in Frameworks */, - 001798AE107439DF00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798E010743BEC00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674619A54B0B004122E4 /* CoreVideo.framework in Frameworks */, - 001798E210743BEC00F5D044 /* Cocoa.framework in Frameworks */, - 001798E310743BEC00F5D044 /* CoreAudio.framework in Frameworks */, - 001798E410743BEC00F5D044 /* ForceFeedback.framework in Frameworks */, - 001798E510743BEC00F5D044 /* IOKit.framework in Frameworks */, - 001798E610743BEC00F5D044 /* AudioToolbox.framework in Frameworks */, - 001798E710743BEC00F5D044 /* CoreFoundation.framework in Frameworks */, - 001798E910743BEC00F5D044 /* AudioUnit.framework in Frameworks */, - 001798EA10743BEC00F5D044 /* Carbon.framework in Frameworks */, - 001798EB10743BEC00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017990410743F1000F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674C19A54B1F004122E4 /* CoreVideo.framework in Frameworks */, - 0017990610743F1000F5D044 /* Cocoa.framework in Frameworks */, - 0017990710743F1000F5D044 /* CoreAudio.framework in Frameworks */, - 0017990810743F1000F5D044 /* ForceFeedback.framework in Frameworks */, - 0017990910743F1000F5D044 /* IOKit.framework in Frameworks */, - 0017990A10743F1000F5D044 /* AudioToolbox.framework in Frameworks */, - 0017990B10743F1000F5D044 /* CoreFoundation.framework in Frameworks */, - 0017990D10743F1000F5D044 /* AudioUnit.framework in Frameworks */, - 0017990E10743F1000F5D044 /* Carbon.framework in Frameworks */, - 0017990F10743F1000F5D044 /* libSDL2.a in Frameworks */, - DB166DAB16A1D27C00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017992610743FB700F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675219A54B32004122E4 /* CoreVideo.framework in Frameworks */, - 0017992810743FB700F5D044 /* Cocoa.framework in Frameworks */, - 0017992910743FB700F5D044 /* CoreAudio.framework in Frameworks */, - 0017992A10743FB700F5D044 /* ForceFeedback.framework in Frameworks */, - 0017992B10743FB700F5D044 /* IOKit.framework in Frameworks */, - 0017992C10743FB700F5D044 /* AudioToolbox.framework in Frameworks */, - 0017992D10743FB700F5D044 /* CoreFoundation.framework in Frameworks */, - 0017992F10743FB700F5D044 /* AudioUnit.framework in Frameworks */, - 0017993010743FB700F5D044 /* Carbon.framework in Frameworks */, - 0017993110743FB700F5D044 /* libSDL2.a in Frameworks */, - DB166DAC16A1D29000A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F340809CA1BFF00EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672F19A54ACC004122E4 /* CoreVideo.framework in Frameworks */, - 002F340B09CA1BFF00EBEB88 /* Cocoa.framework in Frameworks */, - 002A866B10730548007319AE /* CoreAudio.framework in Frameworks */, - 002A866C10730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A866D10730548007319AE /* IOKit.framework in Frameworks */, - 002A86BF10730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C010730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872410730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874910730676007319AE /* Carbon.framework in Frameworks */, - 001794D11073667B00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F342709CA1F0300EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673619A54AE1004122E4 /* CoreVideo.framework in Frameworks */, - 002F342A09CA1F0300EBEB88 /* Cocoa.framework in Frameworks */, - 002A866210730547007319AE /* CoreAudio.framework in Frameworks */, - 002A866310730547007319AE /* ForceFeedback.framework in Frameworks */, - 002A866410730547007319AE /* IOKit.framework in Frameworks */, - 002A86B910730594007319AE /* AudioToolbox.framework in Frameworks */, - 002A86BA10730594007319AE /* CoreFoundation.framework in Frameworks */, - 002A872110730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874610730676007319AE /* Carbon.framework in Frameworks */, - 001794D41073668800F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F344309CA1FB300EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674019A54AFB004122E4 /* CoreVideo.framework in Frameworks */, - 002F344609CA1FB300EBEB88 /* Cocoa.framework in Frameworks */, - 002A868010730549007319AE /* CoreAudio.framework in Frameworks */, - 002A868110730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A868210730549007319AE /* IOKit.framework in Frameworks */, - 002A86CD10730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86CE10730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A872B10730624007319AE /* AudioUnit.framework in Frameworks */, - 002A875010730677007319AE /* Carbon.framework in Frameworks */, - 001794D91073669E00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F346009CA204F00EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674119A54AFE004122E4 /* CoreVideo.framework in Frameworks */, - 002F346309CA204F00EBEB88 /* Cocoa.framework in Frameworks */, - 002A868610730549007319AE /* CoreAudio.framework in Frameworks */, - 002A868710730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A868810730549007319AE /* IOKit.framework in Frameworks */, - 002A86D110730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86D210730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A872D10730624007319AE /* AudioUnit.framework in Frameworks */, - 002A875210730677007319AE /* Carbon.framework in Frameworks */, - 001794DB107366A700F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4537749012091504002F0F45 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674B19A54B1B004122E4 /* CoreVideo.framework in Frameworks */, - DB166D7116A1CFB200A1396C /* AudioToolbox.framework in Frameworks */, - DB166D7216A1CFB200A1396C /* AudioUnit.framework in Frameworks */, - DB166D7316A1CFB200A1396C /* Carbon.framework in Frameworks */, - DB166D7416A1CFB200A1396C /* Cocoa.framework in Frameworks */, - DB166D7516A1CFB200A1396C /* CoreAudio.framework in Frameworks */, - DB166D7616A1CFB200A1396C /* CoreFoundation.framework in Frameworks */, - DB166D7716A1CFB200A1396C /* ForceFeedback.framework in Frameworks */, - DB166D7816A1CFB200A1396C /* IOKit.framework in Frameworks */, - DB166D7A16A1CFD500A1396C /* libSDL2.a in Frameworks */, - DB166DA416A1D21700A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BBFC08BE164C6862003E6A99 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673119A54AD3004122E4 /* CoreVideo.framework in Frameworks */, - BBFC08C0164C6862003E6A99 /* Cocoa.framework in Frameworks */, - BBFC08C1164C6862003E6A99 /* CoreAudio.framework in Frameworks */, - BBFC08C2164C6862003E6A99 /* ForceFeedback.framework in Frameworks */, - BBFC08C3164C6862003E6A99 /* IOKit.framework in Frameworks */, - BBFC08C4164C6862003E6A99 /* AudioToolbox.framework in Frameworks */, - BBFC08C5164C6862003E6A99 /* CoreFoundation.framework in Frameworks */, - BBFC08C7164C6862003E6A99 /* AudioUnit.framework in Frameworks */, - BBFC08C8164C6862003E6A99 /* Carbon.framework in Frameworks */, - BBFC08C9164C6862003E6A99 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566B20761D90300A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672319A54A90004122E4 /* CoreVideo.framework in Frameworks */, - 002F33C109CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A863010730405007319AE /* libSDL2.a in Frameworks */, - 002A864D10730546007319AE /* CoreAudio.framework in Frameworks */, - 002A864E10730546007319AE /* ForceFeedback.framework in Frameworks */, - 002A864F10730546007319AE /* IOKit.framework in Frameworks */, - 002A86AB10730594007319AE /* AudioToolbox.framework in Frameworks */, - 002A86AC10730594007319AE /* CoreFoundation.framework in Frameworks */, - 002A871A10730623007319AE /* AudioUnit.framework in Frameworks */, - 002A873F10730675007319AE /* Carbon.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566CC0761D90300A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672819A54AB6004122E4 /* CoreVideo.framework in Frameworks */, - 002F33BF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A865310730547007319AE /* CoreAudio.framework in Frameworks */, - 002A865410730547007319AE /* ForceFeedback.framework in Frameworks */, - 002A865510730547007319AE /* IOKit.framework in Frameworks */, - 002A86AF10730594007319AE /* AudioToolbox.framework in Frameworks */, - 002A86B010730594007319AE /* CoreFoundation.framework in Frameworks */, - 002A871C10730623007319AE /* AudioUnit.framework in Frameworks */, - 002A874110730676007319AE /* Carbon.framework in Frameworks */, - 002A875E10730745007319AE /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567020761D90300A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672E19A54ACA004122E4 /* CoreVideo.framework in Frameworks */, - 002F33BC09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A866E10730548007319AE /* CoreAudio.framework in Frameworks */, - 002A866F10730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A867010730548007319AE /* IOKit.framework in Frameworks */, - 002A86C110730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C210730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872510730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874A10730676007319AE /* Carbon.framework in Frameworks */, - 001794D01073667700F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC5672A0761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674F19A54B28004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B809CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A868F1073054A007319AE /* CoreAudio.framework in Frameworks */, - 002A86901073054A007319AE /* ForceFeedback.framework in Frameworks */, - 002A86911073054A007319AE /* IOKit.framework in Frameworks */, - 002A86D710730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86D810730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A873010730625007319AE /* AudioUnit.framework in Frameworks */, - 002A875510730677007319AE /* Carbon.framework in Frameworks */, - 001794DE107366B900F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567370761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673919A54AE8004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B709CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A867410730548007319AE /* CoreAudio.framework in Frameworks */, - 002A867510730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A867610730548007319AE /* IOKit.framework in Frameworks */, - 002A86C510730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C610730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872710730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874C10730676007319AE /* Carbon.framework in Frameworks */, - 001794D51073668D00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567440761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673A19A54AEB004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B509CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A867710730548007319AE /* CoreAudio.framework in Frameworks */, - 002A867810730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A867910730549007319AE /* IOKit.framework in Frameworks */, - 002A86C710730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C810730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872810730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874D10730677007319AE /* Carbon.framework in Frameworks */, - 001794D61073669200F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567510761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673C19A54AF0004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B609CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A867A10730549007319AE /* CoreAudio.framework in Frameworks */, - 002A867B10730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A867C10730549007319AE /* IOKit.framework in Frameworks */, - 002A86C910730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86CA10730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872910730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874E10730677007319AE /* Carbon.framework in Frameworks */, - 001794D71073669700F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567790761D90500A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674919A54B16004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B209CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A868910730549007319AE /* CoreAudio.framework in Frameworks */, - 002A868A10730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A868B1073054A007319AE /* IOKit.framework in Frameworks */, - 002A86D310730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86D410730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A872E10730624007319AE /* AudioUnit.framework in Frameworks */, - 002A875310730677007319AE /* Carbon.framework in Frameworks */, - 001794DC107366AC00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567940761D90500A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675019A54B2B004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B009CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A86981073054A007319AE /* CoreAudio.framework in Frameworks */, - 002A86991073054A007319AE /* ForceFeedback.framework in Frameworks */, - 002A869A1073054A007319AE /* IOKit.framework in Frameworks */, - 002A86DD10730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86DE10730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A873310730625007319AE /* AudioUnit.framework in Frameworks */, - 002A875810730678007319AE /* Carbon.framework in Frameworks */, - 001794DF107366BD00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567AE0761D90500A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675119A54B2F004122E4 /* CoreVideo.framework in Frameworks */, - 002F33AF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A86951073054A007319AE /* CoreAudio.framework in Frameworks */, - 002A86961073054A007319AE /* ForceFeedback.framework in Frameworks */, - 002A86971073054A007319AE /* IOKit.framework in Frameworks */, - 002A86DB10730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86DC10730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A873210730625007319AE /* AudioUnit.framework in Frameworks */, - 002A875710730678007319AE /* Carbon.framework in Frameworks */, - 001794E0107366C100F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567F10761D90600A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675319A54B35004122E4 /* CoreVideo.framework in Frameworks */, - 002F33AA09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A864110730546007319AE /* CoreAudio.framework in Frameworks */, - 002A864210730546007319AE /* ForceFeedback.framework in Frameworks */, - 002A864310730546007319AE /* IOKit.framework in Frameworks */, - 002A86A310730593007319AE /* AudioToolbox.framework in Frameworks */, - 002A86A410730593007319AE /* CoreFoundation.framework in Frameworks */, - 002A871610730623007319AE /* AudioUnit.framework in Frameworks */, - 002A873B10730675007319AE /* Carbon.framework in Frameworks */, - 001794E5107366D900F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48DC17CA51E5008798C5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672C19A54AC5004122E4 /* CoreVideo.framework in Frameworks */, - DB0F48DD17CA51E5008798C5 /* Cocoa.framework in Frameworks */, - DB0F48DE17CA51E5008798C5 /* CoreAudio.framework in Frameworks */, - DB0F48DF17CA51E5008798C5 /* ForceFeedback.framework in Frameworks */, - DB0F48E017CA51E5008798C5 /* IOKit.framework in Frameworks */, - DB0F48E117CA51E5008798C5 /* AudioToolbox.framework in Frameworks */, - DB0F48E217CA51E5008798C5 /* CoreFoundation.framework in Frameworks */, - DB0F48E417CA51E5008798C5 /* AudioUnit.framework in Frameworks */, - DB0F48E517CA51E5008798C5 /* Carbon.framework in Frameworks */, - DB0F48E617CA51E5008798C5 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48F217CA5212008798C5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673019A54AD0004122E4 /* CoreVideo.framework in Frameworks */, - DB0F48F317CA5212008798C5 /* Cocoa.framework in Frameworks */, - DB0F48F417CA5212008798C5 /* CoreAudio.framework in Frameworks */, - DB0F48F517CA5212008798C5 /* ForceFeedback.framework in Frameworks */, - DB0F48F617CA5212008798C5 /* IOKit.framework in Frameworks */, - DB0F48F717CA5212008798C5 /* AudioToolbox.framework in Frameworks */, - DB0F48F817CA5212008798C5 /* CoreFoundation.framework in Frameworks */, - DB0F48FA17CA5212008798C5 /* AudioUnit.framework in Frameworks */, - DB0F48FB17CA5212008798C5 /* Carbon.framework in Frameworks */, - DB0F48FC17CA5212008798C5 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166D7C16A1D12400A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DB016A1D2F600A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673219A54AD5004122E4 /* CoreVideo.framework in Frameworks */, - DB166DB116A1D2F600A1396C /* Cocoa.framework in Frameworks */, - DB166DB216A1D2F600A1396C /* CoreAudio.framework in Frameworks */, - DB166DB316A1D2F600A1396C /* ForceFeedback.framework in Frameworks */, - DB166DB416A1D2F600A1396C /* IOKit.framework in Frameworks */, - DB166DB516A1D2F600A1396C /* AudioToolbox.framework in Frameworks */, - DB166DB616A1D2F600A1396C /* CoreFoundation.framework in Frameworks */, - DB166DB816A1D2F600A1396C /* AudioUnit.framework in Frameworks */, - DB166DB916A1D2F600A1396C /* Carbon.framework in Frameworks */, - DB166DBA16A1D2F600A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DC716A1D36A00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673D19A54AF3004122E4 /* CoreVideo.framework in Frameworks */, - DB166DC816A1D36A00A1396C /* Cocoa.framework in Frameworks */, - DB166DC916A1D36A00A1396C /* CoreAudio.framework in Frameworks */, - DB166DCA16A1D36A00A1396C /* ForceFeedback.framework in Frameworks */, - DB166DCB16A1D36A00A1396C /* IOKit.framework in Frameworks */, - DB166DCC16A1D36A00A1396C /* AudioToolbox.framework in Frameworks */, - DB166DCD16A1D36A00A1396C /* CoreFoundation.framework in Frameworks */, - DB166DCF16A1D36A00A1396C /* AudioUnit.framework in Frameworks */, - DB166DD016A1D36A00A1396C /* Carbon.framework in Frameworks */, - DB166DD116A1D36A00A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DDF16A1D50C00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674319A54B04004122E4 /* CoreVideo.framework in Frameworks */, - DB166DE016A1D50C00A1396C /* Cocoa.framework in Frameworks */, - DB166DE116A1D50C00A1396C /* CoreAudio.framework in Frameworks */, - DB166DE216A1D50C00A1396C /* ForceFeedback.framework in Frameworks */, - DB166DE316A1D50C00A1396C /* IOKit.framework in Frameworks */, - DB166DE416A1D50C00A1396C /* AudioToolbox.framework in Frameworks */, - DB166DE516A1D50C00A1396C /* CoreFoundation.framework in Frameworks */, - DB166DE716A1D50C00A1396C /* AudioUnit.framework in Frameworks */, - DB166DE816A1D50C00A1396C /* Carbon.framework in Frameworks */, - DB166DE916A1D50C00A1396C /* libSDL2.a in Frameworks */, - DB166DEA16A1D50C00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DF616A1D57C00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674419A54B06004122E4 /* CoreVideo.framework in Frameworks */, - DB166DF716A1D57C00A1396C /* Cocoa.framework in Frameworks */, - DB166DF816A1D57C00A1396C /* CoreAudio.framework in Frameworks */, - DB166DF916A1D57C00A1396C /* ForceFeedback.framework in Frameworks */, - DB166DFA16A1D57C00A1396C /* IOKit.framework in Frameworks */, - DB166DFB16A1D57C00A1396C /* AudioToolbox.framework in Frameworks */, - DB166DFC16A1D57C00A1396C /* CoreFoundation.framework in Frameworks */, - DB166DFE16A1D57C00A1396C /* AudioUnit.framework in Frameworks */, - DB166DFF16A1D57C00A1396C /* Carbon.framework in Frameworks */, - DB166E0016A1D57C00A1396C /* libSDL2.a in Frameworks */, - DB166E0116A1D57C00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E0D16A1D5AD00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674519A54B09004122E4 /* CoreVideo.framework in Frameworks */, - DB166E0E16A1D5AD00A1396C /* Cocoa.framework in Frameworks */, - DB166E0F16A1D5AD00A1396C /* CoreAudio.framework in Frameworks */, - DB166E1016A1D5AD00A1396C /* ForceFeedback.framework in Frameworks */, - DB166E1116A1D5AD00A1396C /* IOKit.framework in Frameworks */, - DB166E1216A1D5AD00A1396C /* AudioToolbox.framework in Frameworks */, - DB166E1316A1D5AD00A1396C /* CoreFoundation.framework in Frameworks */, - DB166E1516A1D5AD00A1396C /* AudioUnit.framework in Frameworks */, - DB166E1616A1D5AD00A1396C /* Carbon.framework in Frameworks */, - DB166E1716A1D5AD00A1396C /* libSDL2.a in Frameworks */, - DB166E1816A1D5AD00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2A16A1D64D00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674719A54B0F004122E4 /* CoreVideo.framework in Frameworks */, - DB166E2B16A1D64D00A1396C /* Cocoa.framework in Frameworks */, - DB166E2C16A1D64D00A1396C /* CoreAudio.framework in Frameworks */, - DB166E2D16A1D64D00A1396C /* ForceFeedback.framework in Frameworks */, - DB166E2E16A1D64D00A1396C /* IOKit.framework in Frameworks */, - DB166E2F16A1D64D00A1396C /* AudioToolbox.framework in Frameworks */, - DB166E3016A1D64D00A1396C /* CoreFoundation.framework in Frameworks */, - DB166E3216A1D64D00A1396C /* AudioUnit.framework in Frameworks */, - DB166E3316A1D64D00A1396C /* Carbon.framework in Frameworks */, - DB166E3416A1D64D00A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E4016A1D69000A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674819A54B13004122E4 /* CoreVideo.framework in Frameworks */, - DB166E4116A1D69000A1396C /* Cocoa.framework in Frameworks */, - DB166E4216A1D69000A1396C /* CoreAudio.framework in Frameworks */, - DB166E4316A1D69000A1396C /* ForceFeedback.framework in Frameworks */, - DB166E4416A1D69000A1396C /* IOKit.framework in Frameworks */, - DB166E4516A1D69000A1396C /* AudioToolbox.framework in Frameworks */, - DB166E4616A1D69000A1396C /* CoreFoundation.framework in Frameworks */, - DB166E4816A1D69000A1396C /* AudioUnit.framework in Frameworks */, - DB166E4916A1D69000A1396C /* Carbon.framework in Frameworks */, - DB166E4A16A1D69000A1396C /* libSDL2.a in Frameworks */, - DB166E4B16A1D69000A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E5A16A1D6F300A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674A19A54B19004122E4 /* CoreVideo.framework in Frameworks */, - DB166E5B16A1D6F300A1396C /* Cocoa.framework in Frameworks */, - DB166E5C16A1D6F300A1396C /* CoreAudio.framework in Frameworks */, - DB166E5D16A1D6F300A1396C /* ForceFeedback.framework in Frameworks */, - DB166E5E16A1D6F300A1396C /* IOKit.framework in Frameworks */, - DB166E5F16A1D6F300A1396C /* AudioToolbox.framework in Frameworks */, - DB166E6016A1D6F300A1396C /* CoreFoundation.framework in Frameworks */, - DB166E6216A1D6F300A1396C /* AudioUnit.framework in Frameworks */, - DB166E6316A1D6F300A1396C /* Carbon.framework in Frameworks */, - DB166E6416A1D6F300A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E7016A1D78400A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674D19A54B22004122E4 /* CoreVideo.framework in Frameworks */, - DB166E7116A1D78400A1396C /* Cocoa.framework in Frameworks */, - DB166E7216A1D78400A1396C /* CoreAudio.framework in Frameworks */, - DB166E7316A1D78400A1396C /* ForceFeedback.framework in Frameworks */, - DB166E7416A1D78400A1396C /* IOKit.framework in Frameworks */, - DB166E7516A1D78400A1396C /* AudioToolbox.framework in Frameworks */, - DB166E7616A1D78400A1396C /* CoreFoundation.framework in Frameworks */, - DB166E7816A1D78400A1396C /* AudioUnit.framework in Frameworks */, - DB166E7916A1D78400A1396C /* Carbon.framework in Frameworks */, - DB166E7A16A1D78400A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E8316A1D78C00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674E19A54B25004122E4 /* CoreVideo.framework in Frameworks */, - DB166E8416A1D78C00A1396C /* Cocoa.framework in Frameworks */, - DB166E8516A1D78C00A1396C /* CoreAudio.framework in Frameworks */, - DB166E8616A1D78C00A1396C /* ForceFeedback.framework in Frameworks */, - DB166E8716A1D78C00A1396C /* IOKit.framework in Frameworks */, - DB166E8816A1D78C00A1396C /* AudioToolbox.framework in Frameworks */, - DB166E8916A1D78C00A1396C /* CoreFoundation.framework in Frameworks */, - DB166E8B16A1D78C00A1396C /* AudioUnit.framework in Frameworks */, - DB166E8C16A1D78C00A1396C /* Carbon.framework in Frameworks */, - DB166E8D16A1D78C00A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB445EE918184B7000B306B0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672D19A54AC7004122E4 /* CoreVideo.framework in Frameworks */, - DB445EEA18184B7000B306B0 /* Cocoa.framework in Frameworks */, - DB445EEB18184B7000B306B0 /* CoreAudio.framework in Frameworks */, - DB445EEC18184B7000B306B0 /* ForceFeedback.framework in Frameworks */, - DB445EED18184B7000B306B0 /* IOKit.framework in Frameworks */, - DB445EEE18184B7000B306B0 /* AudioToolbox.framework in Frameworks */, - DB445EEF18184B7000B306B0 /* CoreFoundation.framework in Frameworks */, - DB445EF118184B7000B306B0 /* AudioUnit.framework in Frameworks */, - DB445EF218184B7000B306B0 /* Carbon.framework in Frameworks */, - DB445EF318184B7000B306B0 /* libSDL2.a in Frameworks */, - DB445EF418184B7000B306B0 /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB89957018A19ABA0092407C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673519A54ADE004122E4 /* CoreVideo.framework in Frameworks */, - DB89957118A19ABA0092407C /* Cocoa.framework in Frameworks */, - DB89957218A19ABA0092407C /* CoreAudio.framework in Frameworks */, - DB89957318A19ABA0092407C /* ForceFeedback.framework in Frameworks */, - DB89957418A19ABA0092407C /* IOKit.framework in Frameworks */, - DB89957518A19ABA0092407C /* AudioToolbox.framework in Frameworks */, - DB89957618A19ABA0092407C /* CoreFoundation.framework in Frameworks */, - DB89957818A19ABA0092407C /* AudioUnit.framework in Frameworks */, - DB89957918A19ABA0092407C /* Carbon.framework in Frameworks */, - DB89957A18A19ABA0092407C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DBEC54DC1A1A81C3005B1EAB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DBEC54DD1A1A81C3005B1EAB /* CoreVideo.framework in Frameworks */, - DBEC54DE1A1A81C3005B1EAB /* Cocoa.framework in Frameworks */, - DBEC54DF1A1A81C3005B1EAB /* libSDL2.a in Frameworks */, - DBEC54E01A1A81C3005B1EAB /* CoreAudio.framework in Frameworks */, - DBEC54E11A1A81C3005B1EAB /* ForceFeedback.framework in Frameworks */, - DBEC54E21A1A81C3005B1EAB /* IOKit.framework in Frameworks */, - DBEC54E31A1A81C3005B1EAB /* AudioToolbox.framework in Frameworks */, - DBEC54E41A1A81C3005B1EAB /* CoreFoundation.framework in Frameworks */, - DBEC54E51A1A81C3005B1EAB /* AudioUnit.framework in Frameworks */, - DBEC54E61A1A81C3005B1EAB /* Carbon.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 002F33A209CA183B00EBEB88 /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - FA73672219A54A90004122E4 /* CoreVideo.framework */, - 002A869F10730593007319AE /* AudioToolbox.framework */, - 002A871410730623007319AE /* AudioUnit.framework */, - 002A873910730675007319AE /* Carbon.framework */, - 002F33A709CA188600EBEB88 /* Cocoa.framework */, - 002A863B10730545007319AE /* CoreAudio.framework */, - 002A86A010730593007319AE /* CoreFoundation.framework */, - 002A863C10730545007319AE /* ForceFeedback.framework */, - 002A863D10730545007319AE /* IOKit.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 003FA63B093FFD41000C53B3 /* Products */ = { - isa = PBXGroup; - children = ( - 003FA643093FFD41000C53B3 /* SDL2.framework */, - 003FA645093FFD41000C53B3 /* libSDL2.a */, - DB1D40D717B3F30D00D74CFC /* libSDL2.dylib */, - 003FA649093FFD41000C53B3 /* Standard DMG */, - ); - name = Products; - sourceTree = ""; - }; - 00794E4609D207B4003FC8A1 /* Resources */ = { - isa = PBXGroup; - children = ( - DBEC54D61A1A8145005B1EAB /* axis.bmp */, - DBEC54D71A1A8145005B1EAB /* button.bmp */, - DBEC54D81A1A8145005B1EAB /* controllermap.bmp */, - 00794E5D09D20839003FC8A1 /* icon.bmp */, - 00794E5E09D20839003FC8A1 /* moose.dat */, - 00794E5F09D20839003FC8A1 /* picture.xbm */, - 00794E6109D20839003FC8A1 /* sample.bmp */, - 00794E6209D20839003FC8A1 /* sample.wav */, - DB166ECF16A1D87000A1396C /* shapes */, - DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */, - 00794E6309D20839003FC8A1 /* utf8.txt */, - ); - name = Resources; - sourceTree = ""; - }; - 08FB7794FE84155DC02AAC07 /* SDLTest */ = { - isa = PBXGroup; - children = ( - 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */, - 08FB7795FE84155DC02AAC07 /* Source */, - DB166D8316A1D17E00A1396C /* SDL_Test */, - 002F33A209CA183B00EBEB88 /* Linked Frameworks */, - 00794E4609D207B4003FC8A1 /* Resources */, - 1AB674ADFE9D54B511CA2CBB /* Products */, - ); - comments = "I made these tests link against our \"default\" framework which includes X11 stuff. If you didn't install the X11 headers with Xcode, you might have problems building the SDL.framework (which is a dependency). You can swap the dependencies around to get around this, or you can modify the default SDL.framework target to not include X11 stuff. (Go into its target build options and remove all the Preprocessor macros.)\n\n\n\nWe are sort of in a half-way state at the moment. Going \"all-the-way\" means we copy the SDL.framework inside the app bundle so we can run the test without the step of the user \"installing\" the framework. But there is an oversight/bug in Xcode that doesn't correctly find the location of the framework when in an embedded/nested Xcode project. We could probably try to hack this with a shell script that checks multiple directories for existence, but this is messier and more work than I prefer, so I rather just wait for Apple to fix this. In the meantime...\n\nThe \"All\" target will build the SDL framework from the Xcode project. The other targets do not have this dependency set (for flexibility reasons in case we make changes). If you have not built the framework, you will probably be unable to link. You will either need to build the framework, or you need to add \"-framework SDL\" to the link options and make sure you have the SDL.framework installed somewhere where it can be seen (like /Library/Frameworks...I think we already set this one up.) \n\nTo run though, you should have a copy of the SDL.framework in /Library/Frameworks or ~/Library/Frameworks.\n\n\n\n\ntestgl and testdyngl need -DHAVE_OPENGL\ntestgl needs to link against OpenGL.framework\n\n"; - name = SDLTest; - sourceTree = ""; - }; - 08FB7795FE84155DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 092D6D10FFB30A2C7F000001 /* checkkeys.c */, - DBEC54D11A1A811D005B1EAB /* controllermap.c */, - 083E4872006D84C97F000001 /* loopwave.c */, - 0017958F1074216E00F5D044 /* testatomic.c */, - 001795B01074222D00F5D044 /* testaudioinfo.c */, - 001797711074320D00F5D044 /* testdraw2.c */, - DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */, - DB445EFA18184BB600B306B0 /* testdropfile.c */, - 083E4878006D85357F000001 /* testerror.c */, - 002F341709CA1C5B00EBEB88 /* testfile.c */, - DB0F48D817CA51D2008798C5 /* testfilesystem.c */, - BBFC088E164C6820003E6A99 /* testgamecontroller.c */, - DB166CBB16A1C74100A1396C /* testgesture.c */, - 0017972710742FB900F5D044 /* testgl2.c */, - DB166CBC16A1C74100A1396C /* testgles.c */, - 0017974E1074315700F5D044 /* testhaptic.c */, - DB89958318A19B130092407C /* testhotplug.c */, - 002F343609CA1F6F00EBEB88 /* testiconv.c */, - 00179791107432FA00F5D044 /* testime.c */, - 001797B31074339C00F5D044 /* testintersections.c */, - 092D6D62FFB312AA7F000001 /* testjoystick.c */, - 092D6D6CFFB313437F000001 /* testkeys.c */, - 001797D31074343E00F5D044 /* testloadso.c */, - 092D6D75FFB313BB7F000001 /* testlock.c */, - DB166CBD16A1C74100A1396C /* testmessage.c */, - 001798151074359B00F5D044 /* testmultiaudio.c */, - 0017985A107436ED00F5D044 /* testnative.c */, - 0017985B107436ED00F5D044 /* testnative.h */, - 0017985C107436ED00F5D044 /* testnativecocoa.m */, - 00179872107438D000F5D044 /* testnativex11.c */, - 002F345209CA201C00EBEB88 /* testoverlay2.c */, - 002F346F09CA20A600EBEB88 /* testplatform.c */, - 001798B910743A4900F5D044 /* testpower.c */, - DB166CBF16A1C74100A1396C /* testrelative.c */, - DB166CC016A1C74100A1396C /* testrendercopyex.c */, - DB166CC116A1C74100A1396C /* testrendertarget.c */, - 001798F910743E9200F5D044 /* testresample.c */, - DB166CC216A1C74100A1396C /* testrumble.c */, - DB166CC316A1C74100A1396C /* testscale.c */, - 083E487E006D86A17F000001 /* testsem.c */, - DB166CC416A1C74100A1396C /* testshader.c */, - 453774A4120915E3002F0F45 /* testshape.c */, - 0017991910743F5300F5D044 /* testsprite2.c */, - DB166CC516A1C74100A1396C /* testspriteminimal.c */, - DB166CC616A1C74100A1396C /* teststreaming.c */, - 092D6D58FFB311A97F000001 /* testthread.c */, - 083E4880006D86A17F000001 /* testtimer.c */, - 083E4882006D86A17F000001 /* testver.c */, - 0017993B10743FEF00F5D044 /* testwm2.c */, - 083E4887006D86A17F000001 /* torturethread.c */, - ); - name = Source; - sourceTree = ""; - }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - BEC566B60761D90300A33029 /* checkkeys */, - BEC566D10761D90300A33029 /* loopwave */, - BEC567060761D90400A33029 /* testerror */, - BEC5672E0761D90400A33029 /* testthread */, - BEC5673B0761D90400A33029 /* testjoystick */, - BEC567480761D90400A33029 /* testkeys */, - BEC567550761D90400A33029 /* testlock */, - BEC5677D0761D90500A33029 /* testsem */, - BEC567980761D90500A33029 /* testtimer */, - BEC567B20761D90500A33029 /* testversion */, - BEC567F50761D90600A33029 /* torturethread */, - 002F341209CA1BFF00EBEB88 /* testfile */, - 002F343109CA1F0300EBEB88 /* testiconv */, - 002F344D09CA1FB300EBEB88 /* testoverlay2 */, - 002F346A09CA204F00EBEB88 /* testplatform */, - 0017958C10741F7900F5D044 /* testatomic */, - 001795AD107421BF00F5D044 /* testaudioinfo */, - 0017972110742F3200F5D044 /* testgl2 */, - 00179748107430D600F5D044 /* testhaptic */, - 0017976E107431B300F5D044 /* testdraw2 */, - 0017978E107432AE00F5D044 /* testime */, - 001797AE1074334C00F5D044 /* testintersections */, - 001797D0107433C600F5D044 /* testloadso */, - 001798121074355200F5D044 /* testmultiaudio */, - 001798941074392D00F5D044 /* testnative */, - 001798B5107439DF00F5D044 /* testpower */, - 001798F210743BEC00F5D044 /* testresample */, - 0017991610743F1000F5D044 /* testsprite2 */, - 0017993810743FB700F5D044 /* testwm2 */, - 4537749212091504002F0F45 /* testshape */, - BBFC08CD164C6862003E6A99 /* testgamecontroller */, - DB166D7F16A1D12400A1396C /* libSDL_test.a */, - DB166DBF16A1D2F600A1396C /* testgesture */, - DB166DD516A1D36A00A1396C /* testmessage */, - DB166DEE16A1D50C00A1396C /* testrelative */, - DB166E0516A1D57C00A1396C /* testrendercopyex */, - DB166E1C16A1D5AD00A1396C /* testrendertarget */, - DB166E3816A1D64D00A1396C /* testrumble */, - DB166E5216A1D69000A1396C /* testscale */, - DB166E6816A1D6F300A1396C /* testshader */, - DB166E7E16A1D78400A1396C /* testspriteminimal */, - DB166E9116A1D78C00A1396C /* teststreaming */, - DB0F48EC17CA51E5008798C5 /* testdrawchessboard */, - DB0F490117CA5212008798C5 /* testfilesystem */, - DB89957E18A19ABA0092407C /* testhotplug */, - DB445EF818184B7000B306B0 /* testdropfile.app */, - DBEC54EA1A1A81C3005B1EAB /* controllermap */, - ); - name = Products; - sourceTree = ""; - }; - DB166D8316A1D17E00A1396C /* SDL_Test */ = { - isa = PBXGroup; - children = ( - DB166D8416A1D1A500A1396C /* SDL_test_assert.c */, - DB166D8516A1D1A500A1396C /* SDL_test_common.c */, - DB166D8616A1D1A500A1396C /* SDL_test_compare.c */, - DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */, - DB166D8816A1D1A500A1396C /* SDL_test_font.c */, - DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */, - DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */, - DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */, - DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */, - DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */, - DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */, - DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */, - DB166D9016A1D1A500A1396C /* SDL_test_log.c */, - DB166D9116A1D1A500A1396C /* SDL_test_md5.c */, - DB166D9216A1D1A500A1396C /* SDL_test_random.c */, - ); - name = SDL_Test; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - DB166D7D16A1D12400A1396C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 0017957410741F7900F5D044 /* testatomic */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017958610741F7900F5D044 /* Build configuration list for PBXNativeTarget "testatomic" */; - buildPhases = ( - 0017957910741F7900F5D044 /* Sources */, - 0017957A10741F7900F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testatomic; - productName = testalpha; - productReference = 0017958C10741F7900F5D044 /* testatomic */; - productType = "com.apple.product-type.tool"; - }; - 00179595107421BF00F5D044 /* testaudioinfo */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001795A7107421BF00F5D044 /* Build configuration list for PBXNativeTarget "testaudioinfo" */; - buildPhases = ( - 0017959A107421BF00F5D044 /* Sources */, - 0017959B107421BF00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testaudioinfo; - productName = testalpha; - productReference = 001795AD107421BF00F5D044 /* testaudioinfo */; - productType = "com.apple.product-type.tool"; - }; - 0017970910742F3200F5D044 /* testgl2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017971B10742F3200F5D044 /* Build configuration list for PBXNativeTarget "testgl2" */; - buildPhases = ( - 0017970E10742F3200F5D044 /* Sources */, - 0017970F10742F3200F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testgl2; - productName = testalpha; - productReference = 0017972110742F3200F5D044 /* testgl2 */; - productType = "com.apple.product-type.tool"; - }; - 00179730107430D600F5D044 /* testhaptic */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00179742107430D600F5D044 /* Build configuration list for PBXNativeTarget "testhaptic" */; - buildPhases = ( - 00179735107430D600F5D044 /* Sources */, - 00179736107430D600F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testhaptic; - productName = testalpha; - productReference = 00179748107430D600F5D044 /* testhaptic */; - productType = "com.apple.product-type.tool"; - }; - 00179756107431B300F5D044 /* testdraw2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00179768107431B300F5D044 /* Build configuration list for PBXNativeTarget "testdraw2" */; - buildPhases = ( - 0017975B107431B300F5D044 /* Sources */, - 0017975C107431B300F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testdraw2; - productName = testalpha; - productReference = 0017976E107431B300F5D044 /* testdraw2 */; - productType = "com.apple.product-type.tool"; - }; - 00179776107432AE00F5D044 /* testime */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00179788107432AE00F5D044 /* Build configuration list for PBXNativeTarget "testime" */; - buildPhases = ( - 0017977B107432AE00F5D044 /* Sources */, - 0017977C107432AE00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testime; - productName = testalpha; - productReference = 0017978E107432AE00F5D044 /* testime */; - productType = "com.apple.product-type.tool"; - }; - 001797961074334C00F5D044 /* testintersections */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001797A81074334C00F5D044 /* Build configuration list for PBXNativeTarget "testintersections" */; - buildPhases = ( - 0017979B1074334C00F5D044 /* Sources */, - 0017979C1074334C00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testintersections; - productName = testalpha; - productReference = 001797AE1074334C00F5D044 /* testintersections */; - productType = "com.apple.product-type.tool"; - }; - 001797B8107433C600F5D044 /* testloadso */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001797CA107433C600F5D044 /* Build configuration list for PBXNativeTarget "testloadso" */; - buildPhases = ( - 001797BD107433C600F5D044 /* Sources */, - 001797BE107433C600F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testloadso; - productName = testalpha; - productReference = 001797D0107433C600F5D044 /* testloadso */; - productType = "com.apple.product-type.tool"; - }; - 001797FA1074355200F5D044 /* testmultiaudio */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017980C1074355200F5D044 /* Build configuration list for PBXNativeTarget "testmultiaudio" */; - buildPhases = ( - 001797FF1074355200F5D044 /* Sources */, - 001798001074355200F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testmultiaudio; - productName = testalpha; - productReference = 001798121074355200F5D044 /* testmultiaudio */; - productType = "com.apple.product-type.tool"; - }; - 001798781074392D00F5D044 /* testnative */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017988E1074392D00F5D044 /* Build configuration list for PBXNativeTarget "testnative" */; - buildPhases = ( - 0017987E1074392D00F5D044 /* Sources */, - 001798821074392D00F5D044 /* Frameworks */, - DB166DDA16A1D40F00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testnative; - productName = testalpha; - productReference = 001798941074392D00F5D044 /* testnative */; - productType = "com.apple.product-type.tool"; - }; - 0017989D107439DF00F5D044 /* testpower */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001798AF107439DF00F5D044 /* Build configuration list for PBXNativeTarget "testpower" */; - buildPhases = ( - 001798A2107439DF00F5D044 /* Sources */, - 001798A3107439DF00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testpower; - productName = testalpha; - productReference = 001798B5107439DF00F5D044 /* testpower */; - productType = "com.apple.product-type.tool"; - }; - 001798DA10743BEC00F5D044 /* testresample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001798EC10743BEC00F5D044 /* Build configuration list for PBXNativeTarget "testresample" */; - buildPhases = ( - 001798DF10743BEC00F5D044 /* Sources */, - 001798E010743BEC00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testresample; - productName = testalpha; - productReference = 001798F210743BEC00F5D044 /* testresample */; - productType = "com.apple.product-type.tool"; - }; - 001798FE10743F1000F5D044 /* testsprite2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017991010743F1000F5D044 /* Build configuration list for PBXNativeTarget "testsprite2" */; - buildPhases = ( - 0017990310743F1000F5D044 /* Sources */, - 0017990410743F1000F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testsprite2; - productName = testalpha; - productReference = 0017991610743F1000F5D044 /* testsprite2 */; - productType = "com.apple.product-type.tool"; - }; - 0017992010743FB700F5D044 /* testwm2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017993210743FB700F5D044 /* Build configuration list for PBXNativeTarget "testwm2" */; - buildPhases = ( - 0017992510743FB700F5D044 /* Sources */, - 0017992610743FB700F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testwm2; - productName = testalpha; - productReference = 0017993810743FB700F5D044 /* testwm2 */; - productType = "com.apple.product-type.tool"; - }; - 002F340109CA1BFF00EBEB88 /* testfile */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F340E09CA1BFF00EBEB88 /* Build configuration list for PBXNativeTarget "testfile" */; - buildPhases = ( - 002F340709CA1BFF00EBEB88 /* Sources */, - 002F340809CA1BFF00EBEB88 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testfile; - productName = testalpha; - productReference = 002F341209CA1BFF00EBEB88 /* testfile */; - productType = "com.apple.product-type.tool"; - }; - 002F342009CA1F0300EBEB88 /* testiconv */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F342D09CA1F0300EBEB88 /* Build configuration list for PBXNativeTarget "testiconv" */; - buildPhases = ( - 002F342609CA1F0300EBEB88 /* Sources */, - 002F342709CA1F0300EBEB88 /* Frameworks */, - 00794EEC09D2371F003FC8A1 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testiconv; - productName = testalpha; - productReference = 002F343109CA1F0300EBEB88 /* testiconv */; - productType = "com.apple.product-type.tool"; - }; - 002F343C09CA1FB300EBEB88 /* testoverlay2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F344909CA1FB300EBEB88 /* Build configuration list for PBXNativeTarget "testoverlay2" */; - buildPhases = ( - 002F344209CA1FB300EBEB88 /* Sources */, - 002F344309CA1FB300EBEB88 /* Frameworks */, - 00794EF409D237C7003FC8A1 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testoverlay2; - productName = testalpha; - productReference = 002F344D09CA1FB300EBEB88 /* testoverlay2 */; - productType = "com.apple.product-type.tool"; - }; - 002F345909CA204F00EBEB88 /* testplatform */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F346609CA204F00EBEB88 /* Build configuration list for PBXNativeTarget "testplatform" */; - buildPhases = ( - 002F345F09CA204F00EBEB88 /* Sources */, - 002F346009CA204F00EBEB88 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testplatform; - productName = testalpha; - productReference = 002F346A09CA204F00EBEB88 /* testplatform */; - productType = "com.apple.product-type.tool"; - }; - 4537749112091504002F0F45 /* testshape */ = { - isa = PBXNativeTarget; - buildConfigurationList = 4537749A1209150C002F0F45 /* Build configuration list for PBXNativeTarget "testshape" */; - buildPhases = ( - 4537748F12091504002F0F45 /* Sources */, - 4537749012091504002F0F45 /* Frameworks */, - DB166ECE16A1D85400A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testshape; - productName = testshape; - productReference = 4537749212091504002F0F45 /* testshape */; - productType = "com.apple.product-type.tool"; - }; - BBFC08B7164C6862003E6A99 /* testgamecontroller */ = { - isa = PBXNativeTarget; - buildConfigurationList = BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamecontroller" */; - buildPhases = ( - BBFC08BC164C6862003E6A99 /* Sources */, - BBFC08BE164C6862003E6A99 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testgamecontroller; - productName = testjoystick; - productReference = BBFC08CD164C6862003E6A99 /* testgamecontroller */; - productType = "com.apple.product-type.tool"; - }; - BEC566AB0761D90300A33029 /* checkkeys */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B593808BDB826006539E9 /* Build configuration list for PBXNativeTarget "checkkeys" */; - buildPhases = ( - BEC566B00761D90300A33029 /* Sources */, - BEC566B20761D90300A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = checkkeys; - productName = checkkeys; - productReference = BEC566B60761D90300A33029 /* checkkeys */; - productType = "com.apple.product-type.tool"; - }; - BEC566C50761D90300A33029 /* loopwave */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B594008BDB826006539E9 /* Build configuration list for PBXNativeTarget "loopwave" */; - buildPhases = ( - BEC566CA0761D90300A33029 /* Sources */, - BEC566CC0761D90300A33029 /* Frameworks */, - 00794E6409D2084F003FC8A1 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = loopwave; - productName = loopwave; - productReference = BEC566D10761D90300A33029 /* loopwave */; - productType = "com.apple.product-type.tool"; - }; - BEC566FB0761D90300A33029 /* testerror */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B595008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testerror" */; - buildPhases = ( - BEC567000761D90300A33029 /* Sources */, - BEC567020761D90300A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testerror; - productName = testerror; - productReference = BEC567060761D90400A33029 /* testerror */; - productType = "com.apple.product-type.tool"; - }; - BEC567230761D90400A33029 /* testthread */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B595C08BDB826006539E9 /* Build configuration list for PBXNativeTarget "testthread" */; - buildPhases = ( - BEC567280761D90400A33029 /* Sources */, - BEC5672A0761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testthread; - productName = testthread; - productReference = BEC5672E0761D90400A33029 /* testthread */; - productType = "com.apple.product-type.tool"; - }; - BEC567300761D90400A33029 /* testjoystick */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B596008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testjoystick" */; - buildPhases = ( - BEC567350761D90400A33029 /* Sources */, - BEC567370761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testjoystick; - productName = testjoystick; - productReference = BEC5673B0761D90400A33029 /* testjoystick */; - productType = "com.apple.product-type.tool"; - }; - BEC5673D0761D90400A33029 /* testkeys */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B596408BDB826006539E9 /* Build configuration list for PBXNativeTarget "testkeys" */; - buildPhases = ( - BEC567420761D90400A33029 /* Sources */, - BEC567440761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testkeys; - productName = testkeys; - productReference = BEC567480761D90400A33029 /* testkeys */; - productType = "com.apple.product-type.tool"; - }; - BEC5674A0761D90400A33029 /* testlock */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B596808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testlock" */; - buildPhases = ( - BEC5674F0761D90400A33029 /* Sources */, - BEC567510761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testlock; - productName = testlock; - productReference = BEC567550761D90400A33029 /* testlock */; - productType = "com.apple.product-type.tool"; - }; - BEC567720761D90500A33029 /* testsem */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B597008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testsem" */; - buildPhases = ( - BEC567770761D90500A33029 /* Sources */, - BEC567790761D90500A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testsem; - productName = testsem; - productReference = BEC5677D0761D90500A33029 /* testsem */; - productType = "com.apple.product-type.tool"; - }; - BEC5678D0761D90500A33029 /* testtimer */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B597808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testtimer" */; - buildPhases = ( - BEC567920761D90500A33029 /* Sources */, - BEC567940761D90500A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testtimer; - productName = testtimer; - productReference = BEC567980761D90500A33029 /* testtimer */; - productType = "com.apple.product-type.tool"; - }; - BEC567A70761D90500A33029 /* testversion */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B598008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testversion" */; - buildPhases = ( - BEC567AC0761D90500A33029 /* Sources */, - BEC567AE0761D90500A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testversion; - productName = testversion; - productReference = BEC567B20761D90500A33029 /* testversion */; - productType = "com.apple.product-type.tool"; - }; - BEC567EA0761D90600A33029 /* torturethread */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B599408BDB826006539E9 /* Build configuration list for PBXNativeTarget "torturethread" */; - buildPhases = ( - BEC567EF0761D90600A33029 /* Sources */, - BEC567F10761D90600A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = torturethread; - productName = torturethread; - productReference = BEC567F50761D90600A33029 /* torturethread */; - productType = "com.apple.product-type.tool"; - }; - DB0F48D917CA51E5008798C5 /* testdrawchessboard */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB0F48E917CA51E5008798C5 /* Build configuration list for PBXNativeTarget "testdrawchessboard" */; - buildPhases = ( - DB0F48DA17CA51E5008798C5 /* Sources */, - DB0F48DC17CA51E5008798C5 /* Frameworks */, - DB0F48E717CA51E5008798C5 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testdrawchessboard; - productName = testalpha; - productReference = DB0F48EC17CA51E5008798C5 /* testdrawchessboard */; - productType = "com.apple.product-type.tool"; - }; - DB0F48EF17CA5212008798C5 /* testfilesystem */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB0F48FE17CA5212008798C5 /* Build configuration list for PBXNativeTarget "testfilesystem" */; - buildPhases = ( - DB0F48F017CA5212008798C5 /* Sources */, - DB0F48F217CA5212008798C5 /* Frameworks */, - DB0F48FD17CA5212008798C5 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testfilesystem; - productName = testalpha; - productReference = DB0F490117CA5212008798C5 /* testfilesystem */; - productType = "com.apple.product-type.tool"; - }; - DB166D7E16A1D12400A1396C /* SDL_test */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166D8016A1D12400A1396C /* Build configuration list for PBXNativeTarget "SDL_test" */; - buildPhases = ( - DB166D7B16A1D12400A1396C /* Sources */, - DB166D7C16A1D12400A1396C /* Frameworks */, - DB166D7D16A1D12400A1396C /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SDL_test; - productName = SDL_test; - productReference = DB166D7F16A1D12400A1396C /* libSDL_test.a */; - productType = "com.apple.product-type.library.static"; - }; - DB166DAD16A1D2F600A1396C /* testgesture */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166DBC16A1D2F600A1396C /* Build configuration list for PBXNativeTarget "testgesture" */; - buildPhases = ( - DB166DAE16A1D2F600A1396C /* Sources */, - DB166DB016A1D2F600A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testgesture; - productName = testalpha; - productReference = DB166DBF16A1D2F600A1396C /* testgesture */; - productType = "com.apple.product-type.tool"; - }; - DB166DC416A1D36A00A1396C /* testmessage */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166DD216A1D36A00A1396C /* Build configuration list for PBXNativeTarget "testmessage" */; - buildPhases = ( - DB166DC516A1D36A00A1396C /* Sources */, - DB166DC716A1D36A00A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testmessage; - productName = testalpha; - productReference = DB166DD516A1D36A00A1396C /* testmessage */; - productType = "com.apple.product-type.tool"; - }; - DB166DDC16A1D50C00A1396C /* testrelative */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166DEB16A1D50C00A1396C /* Build configuration list for PBXNativeTarget "testrelative" */; - buildPhases = ( - DB166DDD16A1D50C00A1396C /* Sources */, - DB166DDF16A1D50C00A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrelative; - productName = testalpha; - productReference = DB166DEE16A1D50C00A1396C /* testrelative */; - productType = "com.apple.product-type.tool"; - }; - DB166DF316A1D57C00A1396C /* testrendercopyex */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E0216A1D57C00A1396C /* Build configuration list for PBXNativeTarget "testrendercopyex" */; - buildPhases = ( - DB166DF416A1D57C00A1396C /* Sources */, - DB166DF616A1D57C00A1396C /* Frameworks */, - DB166E2116A1D5DF00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrendercopyex; - productName = testalpha; - productReference = DB166E0516A1D57C00A1396C /* testrendercopyex */; - productType = "com.apple.product-type.tool"; - }; - DB166E0A16A1D5AD00A1396C /* testrendertarget */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E1916A1D5AD00A1396C /* Build configuration list for PBXNativeTarget "testrendertarget" */; - buildPhases = ( - DB166E0B16A1D5AD00A1396C /* Sources */, - DB166E0D16A1D5AD00A1396C /* Frameworks */, - DB166E2416A1D61000A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrendertarget; - productName = testalpha; - productReference = DB166E1C16A1D5AD00A1396C /* testrendertarget */; - productType = "com.apple.product-type.tool"; - }; - DB166E2716A1D64D00A1396C /* testrumble */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E3516A1D64D00A1396C /* Build configuration list for PBXNativeTarget "testrumble" */; - buildPhases = ( - DB166E2816A1D64D00A1396C /* Sources */, - DB166E2A16A1D64D00A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrumble; - productName = testalpha; - productReference = DB166E3816A1D64D00A1396C /* testrumble */; - productType = "com.apple.product-type.tool"; - }; - DB166E3D16A1D69000A1396C /* testscale */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E4F16A1D69000A1396C /* Build configuration list for PBXNativeTarget "testscale" */; - buildPhases = ( - DB166E3E16A1D69000A1396C /* Sources */, - DB166E4016A1D69000A1396C /* Frameworks */, - DB166E4C16A1D69000A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testscale; - productName = testalpha; - productReference = DB166E5216A1D69000A1396C /* testscale */; - productType = "com.apple.product-type.tool"; - }; - DB166E5716A1D6F300A1396C /* testshader */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E6516A1D6F300A1396C /* Build configuration list for PBXNativeTarget "testshader" */; - buildPhases = ( - DB166E5816A1D6F300A1396C /* Sources */, - DB166E5A16A1D6F300A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testshader; - productName = testsem; - productReference = DB166E6816A1D6F300A1396C /* testshader */; - productType = "com.apple.product-type.tool"; - }; - DB166E6D16A1D78400A1396C /* testspriteminimal */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E7B16A1D78400A1396C /* Build configuration list for PBXNativeTarget "testspriteminimal" */; - buildPhases = ( - DB166E6E16A1D78400A1396C /* Sources */, - DB166E7016A1D78400A1396C /* Frameworks */, - DB166E9B16A1D7FC00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testspriteminimal; - productName = testspriteminimal; - productReference = DB166E7E16A1D78400A1396C /* testspriteminimal */; - productType = "com.apple.product-type.tool"; - }; - DB166E8016A1D78C00A1396C /* teststreaming */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E8E16A1D78C00A1396C /* Build configuration list for PBXNativeTarget "teststreaming" */; - buildPhases = ( - DB166E8116A1D78C00A1396C /* Sources */, - DB166E8316A1D78C00A1396C /* Frameworks */, - DB166E9916A1D7EE00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = teststreaming; - productName = teststreaming; - productReference = DB166E9116A1D78C00A1396C /* teststreaming */; - productType = "com.apple.product-type.tool"; - }; - DB445EE618184B7000B306B0 /* testdropfile */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB445EF518184B7000B306B0 /* Build configuration list for PBXNativeTarget "testdropfile" */; - buildPhases = ( - DB445EE718184B7000B306B0 /* Sources */, - DB445EE918184B7000B306B0 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testdropfile; - productName = testdropfile; - productReference = DB445EF818184B7000B306B0 /* testdropfile.app */; - productType = "com.apple.product-type.application"; - }; - DB89956D18A19ABA0092407C /* testhotplug */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB89957B18A19ABA0092407C /* Build configuration list for PBXNativeTarget "testhotplug" */; - buildPhases = ( - DB89956E18A19ABA0092407C /* Sources */, - DB89957018A19ABA0092407C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testhotplug; - productName = testalpha; - productReference = DB89957E18A19ABA0092407C /* testhotplug */; - productType = "com.apple.product-type.tool"; - }; - DBEC54D91A1A81C3005B1EAB /* controllermap */ = { - isa = PBXNativeTarget; - buildConfigurationList = DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "controllermap" */; - buildPhases = ( - DBEC54DA1A1A81C3005B1EAB /* Sources */, - DBEC54DC1A1A81C3005B1EAB /* Frameworks */, - DBEC54EC1A1A827C005B1EAB /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = controllermap; - productName = checkkeys; - productReference = DBEC54EA1A1A81C3005B1EAB /* controllermap */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - }; - buildConfigurationList = 001B5A0C08BDB826006539E9 /* Build configuration list for PBXProject "SDLTest" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - ); - mainGroup = 08FB7794FE84155DC02AAC07 /* SDLTest */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 003FA63B093FFD41000C53B3 /* Products */; - ProjectRef = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - BEC566920761D90300A33029 /* All */, - DB166D7E16A1D12400A1396C /* SDL_test */, - BEC566AB0761D90300A33029 /* checkkeys */, - DBEC54D91A1A81C3005B1EAB /* controllermap */, - BEC566C50761D90300A33029 /* loopwave */, - 0017957410741F7900F5D044 /* testatomic */, - 00179595107421BF00F5D044 /* testaudioinfo */, - 00179756107431B300F5D044 /* testdraw2 */, - DB0F48D917CA51E5008798C5 /* testdrawchessboard */, - DB445EE618184B7000B306B0 /* testdropfile */, - BEC566FB0761D90300A33029 /* testerror */, - 002F340109CA1BFF00EBEB88 /* testfile */, - DB0F48EF17CA5212008798C5 /* testfilesystem */, - BBFC08B7164C6862003E6A99 /* testgamecontroller */, - DB166DAD16A1D2F600A1396C /* testgesture */, - 0017970910742F3200F5D044 /* testgl2 */, - 00179730107430D600F5D044 /* testhaptic */, - DB89956D18A19ABA0092407C /* testhotplug */, - 002F342009CA1F0300EBEB88 /* testiconv */, - 00179776107432AE00F5D044 /* testime */, - 001797961074334C00F5D044 /* testintersections */, - BEC567300761D90400A33029 /* testjoystick */, - BEC5673D0761D90400A33029 /* testkeys */, - 001797B8107433C600F5D044 /* testloadso */, - BEC5674A0761D90400A33029 /* testlock */, - DB166DC416A1D36A00A1396C /* testmessage */, - 001797FA1074355200F5D044 /* testmultiaudio */, - 001798781074392D00F5D044 /* testnative */, - 002F343C09CA1FB300EBEB88 /* testoverlay2 */, - 002F345909CA204F00EBEB88 /* testplatform */, - 0017989D107439DF00F5D044 /* testpower */, - DB166DDC16A1D50C00A1396C /* testrelative */, - DB166DF316A1D57C00A1396C /* testrendercopyex */, - DB166E0A16A1D5AD00A1396C /* testrendertarget */, - 001798DA10743BEC00F5D044 /* testresample */, - DB166E2716A1D64D00A1396C /* testrumble */, - DB166E3D16A1D69000A1396C /* testscale */, - BEC567720761D90500A33029 /* testsem */, - DB166E5716A1D6F300A1396C /* testshader */, - 4537749112091504002F0F45 /* testshape */, - 001798FE10743F1000F5D044 /* testsprite2 */, - DB166E6D16A1D78400A1396C /* testspriteminimal */, - DB166E8016A1D78C00A1396C /* teststreaming */, - BEC567230761D90400A33029 /* testthread */, - BEC5678D0761D90500A33029 /* testtimer */, - BEC567A70761D90500A33029 /* testversion */, - 0017992010743FB700F5D044 /* testwm2 */, - BEC567EA0761D90600A33029 /* torturethread */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 003FA643093FFD41000C53B3 /* SDL2.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SDL2.framework; - remoteRef = 003FA642093FFD41000C53B3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 003FA645093FFD41000C53B3 /* libSDL2.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libSDL2.a; - remoteRef = 003FA644093FFD41000C53B3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 003FA649093FFD41000C53B3 /* Standard DMG */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = "Standard DMG"; - remoteRef = 003FA648093FFD41000C53B3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - DB1D40D717B3F30D00D74CFC /* libSDL2.dylib */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; - remoteRef = DB1D40D617B3F30D00D74CFC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXSourcesBuildPhase section */ - 0017957910741F7900F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001795901074216E00F5D044 /* testatomic.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017959A107421BF00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001795B11074222D00F5D044 /* testaudioinfo.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017970E10742F3200F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017972810742FB900F5D044 /* testgl2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00179735107430D600F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017974F1074315700F5D044 /* testhaptic.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017975B107431B300F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001797721074320D00F5D044 /* testdraw2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017977B107432AE00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00179792107432FA00F5D044 /* testime.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017979B1074334C00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001797B41074339C00F5D044 /* testintersections.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001797BD107433C600F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001797D41074343E00F5D044 /* testloadso.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001797FF1074355200F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001798161074359B00F5D044 /* testmultiaudio.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017987E1074392D00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017987F1074392D00F5D044 /* testnative.c in Sources */, - 001798801074392D00F5D044 /* testnativecocoa.m in Sources */, - 001798811074392D00F5D044 /* testnativex11.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798A2107439DF00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001798BA10743A4900F5D044 /* testpower.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798DF10743BEC00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001798FA10743E9200F5D044 /* testresample.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017990310743F1000F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017991A10743F5300F5D044 /* testsprite2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017992510743FB700F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017993C10743FEF00F5D044 /* testwm2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F340709CA1BFF00EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F341809CA1C5B00EBEB88 /* testfile.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F342609CA1F0300EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F343709CA1F6F00EBEB88 /* testiconv.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F344209CA1FB300EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F345409CA202000EBEB88 /* testoverlay2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F345F09CA204F00EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F347009CA20A600EBEB88 /* testplatform.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4537748F12091504002F0F45 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 453774A5120915E3002F0F45 /* testshape.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BBFC08BC164C6862003E6A99 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BBFC08D0164C6876003E6A99 /* testgamecontroller.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566B00761D90300A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC566B10761D90300A33029 /* checkkeys.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566CA0761D90300A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC566CB0761D90300A33029 /* loopwave.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567000761D90300A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567010761D90300A33029 /* testerror.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567280761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567290761D90400A33029 /* testthread.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567350761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567360761D90400A33029 /* testjoystick.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567420761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567430761D90400A33029 /* testkeys.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC5674F0761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567500761D90400A33029 /* testlock.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567770761D90500A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567780761D90500A33029 /* testsem.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567920761D90500A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567930761D90500A33029 /* testtimer.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567AC0761D90500A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567AD0761D90500A33029 /* testver.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567EF0761D90600A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567F00761D90600A33029 /* torturethread.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48DA17CA51E5008798C5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F48EE17CA51F8008798C5 /* testdrawchessboard.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48F017CA5212008798C5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F490317CA5225008798C5 /* testfilesystem.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166D7B16A1D12400A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166D9316A1D1A500A1396C /* SDL_test_assert.c in Sources */, - DB166D9416A1D1A500A1396C /* SDL_test_common.c in Sources */, - DB166D9516A1D1A500A1396C /* SDL_test_compare.c in Sources */, - DB166D9616A1D1A500A1396C /* SDL_test_crc32.c in Sources */, - DB166D9716A1D1A500A1396C /* SDL_test_font.c in Sources */, - DB166D9816A1D1A500A1396C /* SDL_test_fuzzer.c in Sources */, - DB166D9916A1D1A500A1396C /* SDL_test_harness.c in Sources */, - DB166D9A16A1D1A500A1396C /* SDL_test_imageBlit.c in Sources */, - DB166D9B16A1D1A500A1396C /* SDL_test_imageBlitBlend.c in Sources */, - DB166D9C16A1D1A500A1396C /* SDL_test_imageFace.c in Sources */, - DB166D9D16A1D1A500A1396C /* SDL_test_imagePrimitives.c in Sources */, - DB166D9E16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c in Sources */, - DB166D9F16A1D1A500A1396C /* SDL_test_log.c in Sources */, - DB166DA016A1D1A500A1396C /* SDL_test_md5.c in Sources */, - DB166DA116A1D1A500A1396C /* SDL_test_random.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DAE16A1D2F600A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166DC116A1D31E00A1396C /* testgesture.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DC516A1D36A00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166DD716A1D37800A1396C /* testmessage.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DDD16A1D50C00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166DF016A1D52500A1396C /* testrelative.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DF416A1D57C00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E0716A1D59400A1396C /* testrendercopyex.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E0B16A1D5AD00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E1E16A1D5C300A1396C /* testrendertarget.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2816A1D64D00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E3C16A1D66500A1396C /* testrumble.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E3E16A1D69000A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E5416A1D6A300A1396C /* testscale.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E5816A1D6F300A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E6A16A1D70C00A1396C /* testshader.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E6E16A1D78400A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E9316A1D7BC00A1396C /* testspriteminimal.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E8116A1D78C00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E9416A1D7C700A1396C /* teststreaming.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB445EE718184B7000B306B0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB445EFB18184BB600B306B0 /* testdropfile.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB89956E18A19ABA0092407C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB89958418A19B130092407C /* testhotplug.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DBEC54DA1A1A81C3005B1EAB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DBEC54EB1A1A8205005B1EAB /* controllermap.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 001799481074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC566AB0761D90300A33029 /* checkkeys */; - targetProxy = 001799471074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017994C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC566C50761D90300A33029 /* loopwave */; - targetProxy = 0017994B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799501074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017957410741F7900F5D044 /* testatomic */; - targetProxy = 0017994F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799521074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179595107421BF00F5D044 /* testaudioinfo */; - targetProxy = 001799511074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017995A1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179756107431B300F5D044 /* testdraw2 */; - targetProxy = 001799591074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017995E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC566FB0761D90300A33029 /* testerror */; - targetProxy = 0017995D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799601074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F340109CA1BFF00EBEB88 /* testfile */; - targetProxy = 0017995F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799661074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017970910742F3200F5D044 /* testgl2 */; - targetProxy = 001799651074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799681074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179730107430D600F5D044 /* testhaptic */; - targetProxy = 001799671074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017996A1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567230761D90400A33029 /* testthread */; - targetProxy = 001799691074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017996C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F342009CA1F0300EBEB88 /* testiconv */; - targetProxy = 0017996B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017996E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179776107432AE00F5D044 /* testime */; - targetProxy = 0017996D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799701074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001797961074334C00F5D044 /* testintersections */; - targetProxy = 0017996F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799721074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567300761D90400A33029 /* testjoystick */; - targetProxy = 001799711074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799741074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC5673D0761D90400A33029 /* testkeys */; - targetProxy = 001799731074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799761074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001797B8107433C600F5D044 /* testloadso */; - targetProxy = 001799751074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799781074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC5674A0761D90400A33029 /* testlock */; - targetProxy = 001799771074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017997C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001797FA1074355200F5D044 /* testmultiaudio */; - targetProxy = 0017997B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799801074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001798781074392D00F5D044 /* testnative */; - targetProxy = 0017997F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799841074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F343C09CA1FB300EBEB88 /* testoverlay2 */; - targetProxy = 001799831074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799881074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F345909CA204F00EBEB88 /* testplatform */; - targetProxy = 001799871074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017998A1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017989D107439DF00F5D044 /* testpower */; - targetProxy = 001799891074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017998C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001798DA10743BEC00F5D044 /* testresample */; - targetProxy = 0017998B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017998E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567720761D90500A33029 /* testsem */; - targetProxy = 0017998D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799921074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001798FE10743F1000F5D044 /* testsprite2 */; - targetProxy = 001799911074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799941074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC5678D0761D90500A33029 /* testtimer */; - targetProxy = 001799931074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799961074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567A70761D90500A33029 /* testversion */; - targetProxy = 001799951074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017999E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017992010743FB700F5D044 /* testwm2 */; - targetProxy = 0017999D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799A21074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567EA0761D90600A33029 /* torturethread */; - targetProxy = 001799A11074403E00F5D044 /* PBXContainerItemProxy */; - }; - DB0F490517CA5249008798C5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB0F48D917CA51E5008798C5 /* testdrawchessboard */; - targetProxy = DB0F490417CA5249008798C5 /* PBXContainerItemProxy */; - }; - DB0F490717CA5249008798C5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB0F48EF17CA5212008798C5 /* testfilesystem */; - targetProxy = DB0F490617CA5249008798C5 /* PBXContainerItemProxy */; - }; - DB166D6E16A1CEAA00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BBFC08B7164C6862003E6A99 /* testgamecontroller */; - targetProxy = DB166D6D16A1CEAA00A1396C /* PBXContainerItemProxy */; - }; - DB166D7016A1CEAF00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4537749112091504002F0F45 /* testshape */; - targetProxy = DB166D6F16A1CEAF00A1396C /* PBXContainerItemProxy */; - }; - DB166DC316A1D32C00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DAD16A1D2F600A1396C /* testgesture */; - targetProxy = DB166DC216A1D32C00A1396C /* PBXContainerItemProxy */; - }; - DB166DD916A1D38900A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DC416A1D36A00A1396C /* testmessage */; - targetProxy = DB166DD816A1D38900A1396C /* PBXContainerItemProxy */; - }; - DB166DF216A1D53700A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DDC16A1D50C00A1396C /* testrelative */; - targetProxy = DB166DF116A1D53700A1396C /* PBXContainerItemProxy */; - }; - DB166E0916A1D5A400A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DF316A1D57C00A1396C /* testrendercopyex */; - targetProxy = DB166E0816A1D5A400A1396C /* PBXContainerItemProxy */; - }; - DB166E2016A1D5D000A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E0A16A1D5AD00A1396C /* testrendertarget */; - targetProxy = DB166E1F16A1D5D000A1396C /* PBXContainerItemProxy */; - }; - DB166E3B16A1D65A00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E2716A1D64D00A1396C /* testrumble */; - targetProxy = DB166E3A16A1D65A00A1396C /* PBXContainerItemProxy */; - }; - DB166E5616A1D6B800A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E3D16A1D69000A1396C /* testscale */; - targetProxy = DB166E5516A1D6B800A1396C /* PBXContainerItemProxy */; - }; - DB166E6C16A1D72000A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E5716A1D6F300A1396C /* testshader */; - targetProxy = DB166E6B16A1D72000A1396C /* PBXContainerItemProxy */; - }; - DB166E9616A1D7CD00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E6D16A1D78400A1396C /* testspriteminimal */; - targetProxy = DB166E9516A1D7CD00A1396C /* PBXContainerItemProxy */; - }; - DB166E9816A1D7CF00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E8016A1D78C00A1396C /* teststreaming */; - targetProxy = DB166E9716A1D7CF00A1396C /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 0017958910741F7900F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testatomic; - }; - name = Debug; - }; - 0017958A10741F7900F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testatomic; - }; - name = Release; - }; - 001795AA107421BF00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testaudioinfo; - }; - name = Debug; - }; - 001795AB107421BF00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testaudioinfo; - }; - name = Release; - }; - 0017971E10742F3200F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PREPROCESSOR_DEFINITIONS = HAVE_OPENGL; - PRODUCT_NAME = testgl2; - }; - name = Debug; - }; - 0017971F10742F3200F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PREPROCESSOR_DEFINITIONS = HAVE_OPENGL; - PRODUCT_NAME = testgl2; - }; - name = Release; - }; - 00179745107430D600F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhaptic; - }; - name = Debug; - }; - 00179746107430D600F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhaptic; - }; - name = Release; - }; - 0017976B107431B300F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdraw2; - }; - name = Debug; - }; - 0017976C107431B300F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdraw2; - }; - name = Release; - }; - 0017978B107432AE00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testime; - }; - name = Debug; - }; - 0017978C107432AE00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testime; - }; - name = Release; - }; - 001797AB1074334C00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testintersections; - }; - name = Debug; - }; - 001797AC1074334C00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testintersections; - }; - name = Release; - }; - 001797CD107433C600F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testloadso; - }; - name = Debug; - }; - 001797CE107433C600F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testloadso; - }; - name = Release; - }; - 0017980F1074355200F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmultiaudio; - }; - name = Debug; - }; - 001798101074355200F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmultiaudio; - }; - name = Release; - }; - 001798911074392D00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_LDFLAGS = "-lX11"; - PRODUCT_NAME = testnative; - }; - name = Debug; - }; - 001798921074392D00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_LDFLAGS = "-lX11"; - PRODUCT_NAME = testnative; - }; - name = Release; - }; - 001798B2107439DF00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testpower; - }; - name = Debug; - }; - 001798B3107439DF00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testpower; - }; - name = Release; - }; - 001798EF10743BEC00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testresample; - }; - name = Debug; - }; - 001798F010743BEC00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testresample; - }; - name = Release; - }; - 0017991310743F1000F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsprite2; - }; - name = Debug; - }; - 0017991410743F1000F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsprite2; - }; - name = Release; - }; - 0017993510743FB700F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testwm2; - }; - name = Debug; - }; - 0017993610743FB700F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testwm2; - }; - name = Release; - }; - 002A85B21073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", - "$(HOME)/Library/Frameworks", - /Library/Frameworks, - ); - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.6; - }; - name = Debug; - }; - 002A85B31073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Build All"; - }; - name = Debug; - }; - 002A85B41073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = checkkeys; - }; - name = Debug; - }; - 002A85B61073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = loopwave; - }; - name = Debug; - }; - 002A85BC1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testerror; - }; - name = Debug; - }; - 002A85BD1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfile; - }; - name = Debug; - }; - 002A85C01073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testiconv; - }; - name = Debug; - }; - 002A85C11073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testjoystick; - }; - name = Debug; - }; - 002A85C21073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testkeys; - }; - name = Debug; - }; - 002A85C31073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testlock; - }; - name = Debug; - }; - 002A85C51073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testoverlay2; - }; - name = Debug; - }; - 002A85C71073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testplatform; - }; - name = Debug; - }; - 002A85C81073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsem; - }; - name = Debug; - }; - 002A85CA1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testthread; - }; - name = Debug; - }; - 002A85CB1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testtimer; - }; - name = Debug; - }; - 002A85CC1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testversion; - }; - name = Debug; - }; - 002A85D11073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = torturethread; - }; - name = Debug; - }; - 002A85D41073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", - "$(HOME)/Library/Frameworks", - /Library/Frameworks, - ); - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.6; - }; - name = Release; - }; - 002A85D51073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Build All"; - }; - name = Release; - }; - 002A85D61073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = checkkeys; - }; - name = Release; - }; - 002A85D81073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = loopwave; - }; - name = Release; - }; - 002A85DE1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testerror; - }; - name = Release; - }; - 002A85DF1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfile; - }; - name = Release; - }; - 002A85E21073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testiconv; - }; - name = Release; - }; - 002A85E31073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testjoystick; - }; - name = Release; - }; - 002A85E41073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testkeys; - }; - name = Release; - }; - 002A85E51073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testlock; - }; - name = Release; - }; - 002A85E71073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testoverlay2; - }; - name = Release; - }; - 002A85E91073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testplatform; - }; - name = Release; - }; - 002A85EA1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsem; - }; - name = Release; - }; - 002A85EC1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testthread; - }; - name = Release; - }; - 002A85ED1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testtimer; - }; - name = Release; - }; - 002A85EE1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testversion; - }; - name = Release; - }; - 002A85F31073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = torturethread; - }; - name = Release; - }; - 4537749712091509002F0F45 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshape; - }; - name = Debug; - }; - 4537749812091509002F0F45 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshape; - }; - name = Release; - }; - BBFC08CB164C6862003E6A99 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgamecontroller; - }; - name = Debug; - }; - BBFC08CC164C6862003E6A99 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgamecontroller; - }; - name = Release; - }; - DB0F48EA17CA51E5008798C5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdrawchessboard; - }; - name = Debug; - }; - DB0F48EB17CA51E5008798C5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdrawchessboard; - }; - name = Release; - }; - DB0F48FF17CA5212008798C5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfilesystem; - }; - name = Debug; - }; - DB0F490017CA5212008798C5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfilesystem; - }; - name = Release; - }; - DB166D8116A1D12400A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - DB166D8216A1D12400A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - DB166DBD16A1D2F600A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgesture; - }; - name = Debug; - }; - DB166DBE16A1D2F600A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgesture; - }; - name = Release; - }; - DB166DD316A1D36A00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmessage; - }; - name = Debug; - }; - DB166DD416A1D36A00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmessage; - }; - name = Release; - }; - DB166DEC16A1D50C00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrelative; - }; - name = Debug; - }; - DB166DED16A1D50C00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrelative; - }; - name = Release; - }; - DB166E0316A1D57C00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendercopyex; - }; - name = Debug; - }; - DB166E0416A1D57C00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendercopyex; - }; - name = Release; - }; - DB166E1A16A1D5AD00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendertarget; - }; - name = Debug; - }; - DB166E1B16A1D5AD00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendertarget; - }; - name = Release; - }; - DB166E3616A1D64D00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrumble; - }; - name = Debug; - }; - DB166E3716A1D64D00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrumble; - }; - name = Release; - }; - DB166E5016A1D69000A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testscale; - }; - name = Debug; - }; - DB166E5116A1D69000A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testscale; - }; - name = Release; - }; - DB166E6616A1D6F300A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshader; - }; - name = Debug; - }; - DB166E6716A1D6F300A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshader; - }; - name = Release; - }; - DB166E7C16A1D78400A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testspriteminimal; - }; - name = Debug; - }; - DB166E7D16A1D78400A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testspriteminimal; - }; - name = Release; - }; - DB166E8F16A1D78C00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = teststreaming; - }; - name = Debug; - }; - DB166E9016A1D78C00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = teststreaming; - }; - name = Release; - }; - DB445EF618184B7000B306B0 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = "TestDropFile-Info.plist"; - PRODUCT_NAME = testdropfile; - }; - name = Debug; - }; - DB445EF718184B7000B306B0 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = "TestDropFile-Info.plist"; - PRODUCT_NAME = testdropfile; - }; - name = Release; - }; - DB89957C18A19ABA0092407C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhotplug; - }; - name = Debug; - }; - DB89957D18A19ABA0092407C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhotplug; - }; - name = Release; - }; - DBEC54E81A1A81C3005B1EAB /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = controllermap; - }; - name = Debug; - }; - DBEC54E91A1A81C3005B1EAB /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = controllermap; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0017958610741F7900F5D044 /* Build configuration list for PBXNativeTarget "testatomic" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017958910741F7900F5D044 /* Debug */, - 0017958A10741F7900F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001795A7107421BF00F5D044 /* Build configuration list for PBXNativeTarget "testaudioinfo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001795AA107421BF00F5D044 /* Debug */, - 001795AB107421BF00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017971B10742F3200F5D044 /* Build configuration list for PBXNativeTarget "testgl2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017971E10742F3200F5D044 /* Debug */, - 0017971F10742F3200F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 00179742107430D600F5D044 /* Build configuration list for PBXNativeTarget "testhaptic" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00179745107430D600F5D044 /* Debug */, - 00179746107430D600F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 00179768107431B300F5D044 /* Build configuration list for PBXNativeTarget "testdraw2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017976B107431B300F5D044 /* Debug */, - 0017976C107431B300F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 00179788107432AE00F5D044 /* Build configuration list for PBXNativeTarget "testime" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017978B107432AE00F5D044 /* Debug */, - 0017978C107432AE00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001797A81074334C00F5D044 /* Build configuration list for PBXNativeTarget "testintersections" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001797AB1074334C00F5D044 /* Debug */, - 001797AC1074334C00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001797CA107433C600F5D044 /* Build configuration list for PBXNativeTarget "testloadso" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001797CD107433C600F5D044 /* Debug */, - 001797CE107433C600F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017980C1074355200F5D044 /* Build configuration list for PBXNativeTarget "testmultiaudio" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017980F1074355200F5D044 /* Debug */, - 001798101074355200F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017988E1074392D00F5D044 /* Build configuration list for PBXNativeTarget "testnative" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001798911074392D00F5D044 /* Debug */, - 001798921074392D00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001798AF107439DF00F5D044 /* Build configuration list for PBXNativeTarget "testpower" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001798B2107439DF00F5D044 /* Debug */, - 001798B3107439DF00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001798EC10743BEC00F5D044 /* Build configuration list for PBXNativeTarget "testresample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001798EF10743BEC00F5D044 /* Debug */, - 001798F010743BEC00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017991010743F1000F5D044 /* Build configuration list for PBXNativeTarget "testsprite2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017991310743F1000F5D044 /* Debug */, - 0017991410743F1000F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017993210743FB700F5D044 /* Build configuration list for PBXNativeTarget "testwm2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017993510743FB700F5D044 /* Debug */, - 0017993610743FB700F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B593808BDB826006539E9 /* Build configuration list for PBXNativeTarget "checkkeys" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B41073008E007319AE /* Debug */, - 002A85D61073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B594008BDB826006539E9 /* Build configuration list for PBXNativeTarget "loopwave" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B61073008E007319AE /* Debug */, - 002A85D81073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B595008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testerror" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85BC1073008E007319AE /* Debug */, - 002A85DE1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B595C08BDB826006539E9 /* Build configuration list for PBXNativeTarget "testthread" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85CA1073008E007319AE /* Debug */, - 002A85EC1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B596008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testjoystick" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C11073008E007319AE /* Debug */, - 002A85E31073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B596408BDB826006539E9 /* Build configuration list for PBXNativeTarget "testkeys" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C21073008E007319AE /* Debug */, - 002A85E41073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B596808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testlock" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C31073008E007319AE /* Debug */, - 002A85E51073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B597008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testsem" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C81073008E007319AE /* Debug */, - 002A85EA1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B597808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testtimer" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85CB1073008E007319AE /* Debug */, - 002A85ED1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B598008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testversion" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85CC1073008E007319AE /* Debug */, - 002A85EE1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B599408BDB826006539E9 /* Build configuration list for PBXNativeTarget "torturethread" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85D11073008E007319AE /* Debug */, - 002A85F31073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B599808BDB826006539E9 /* Build configuration list for PBXAggregateTarget "All" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B31073008E007319AE /* Debug */, - 002A85D51073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B5A0C08BDB826006539E9 /* Build configuration list for PBXProject "SDLTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B21073008E007319AE /* Debug */, - 002A85D41073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F340E09CA1BFF00EBEB88 /* Build configuration list for PBXNativeTarget "testfile" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85BD1073008E007319AE /* Debug */, - 002A85DF1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F342D09CA1F0300EBEB88 /* Build configuration list for PBXNativeTarget "testiconv" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C01073008E007319AE /* Debug */, - 002A85E21073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F344909CA1FB300EBEB88 /* Build configuration list for PBXNativeTarget "testoverlay2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C51073008E007319AE /* Debug */, - 002A85E71073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F346609CA204F00EBEB88 /* Build configuration list for PBXNativeTarget "testplatform" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C71073008E007319AE /* Debug */, - 002A85E91073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 4537749A1209150C002F0F45 /* Build configuration list for PBXNativeTarget "testshape" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4537749712091509002F0F45 /* Debug */, - 4537749812091509002F0F45 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamecontroller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BBFC08CB164C6862003E6A99 /* Debug */, - BBFC08CC164C6862003E6A99 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB0F48E917CA51E5008798C5 /* Build configuration list for PBXNativeTarget "testdrawchessboard" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB0F48EA17CA51E5008798C5 /* Debug */, - DB0F48EB17CA51E5008798C5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB0F48FE17CA5212008798C5 /* Build configuration list for PBXNativeTarget "testfilesystem" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB0F48FF17CA5212008798C5 /* Debug */, - DB0F490017CA5212008798C5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166D8016A1D12400A1396C /* Build configuration list for PBXNativeTarget "SDL_test" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166D8116A1D12400A1396C /* Debug */, - DB166D8216A1D12400A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166DBC16A1D2F600A1396C /* Build configuration list for PBXNativeTarget "testgesture" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166DBD16A1D2F600A1396C /* Debug */, - DB166DBE16A1D2F600A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166DD216A1D36A00A1396C /* Build configuration list for PBXNativeTarget "testmessage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166DD316A1D36A00A1396C /* Debug */, - DB166DD416A1D36A00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166DEB16A1D50C00A1396C /* Build configuration list for PBXNativeTarget "testrelative" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166DEC16A1D50C00A1396C /* Debug */, - DB166DED16A1D50C00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E0216A1D57C00A1396C /* Build configuration list for PBXNativeTarget "testrendercopyex" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E0316A1D57C00A1396C /* Debug */, - DB166E0416A1D57C00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E1916A1D5AD00A1396C /* Build configuration list for PBXNativeTarget "testrendertarget" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E1A16A1D5AD00A1396C /* Debug */, - DB166E1B16A1D5AD00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E3516A1D64D00A1396C /* Build configuration list for PBXNativeTarget "testrumble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E3616A1D64D00A1396C /* Debug */, - DB166E3716A1D64D00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E4F16A1D69000A1396C /* Build configuration list for PBXNativeTarget "testscale" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E5016A1D69000A1396C /* Debug */, - DB166E5116A1D69000A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E6516A1D6F300A1396C /* Build configuration list for PBXNativeTarget "testshader" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E6616A1D6F300A1396C /* Debug */, - DB166E6716A1D6F300A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E7B16A1D78400A1396C /* Build configuration list for PBXNativeTarget "testspriteminimal" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E7C16A1D78400A1396C /* Debug */, - DB166E7D16A1D78400A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E8E16A1D78C00A1396C /* Build configuration list for PBXNativeTarget "teststreaming" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E8F16A1D78C00A1396C /* Debug */, - DB166E9016A1D78C00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB445EF518184B7000B306B0 /* Build configuration list for PBXNativeTarget "testdropfile" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB445EF618184B7000B306B0 /* Debug */, - DB445EF718184B7000B306B0 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB89957B18A19ABA0092407C /* Build configuration list for PBXNativeTarget "testhotplug" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB89957C18A19ABA0092407C /* Debug */, - DB89957D18A19ABA0092407C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "controllermap" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DBEC54E81A1A81C3005B1EAB /* Debug */, - DBEC54E91A1A81C3005B1EAB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist b/Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist deleted file mode 100644 index 03e46b33b..000000000 --- a/Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist +++ /dev/null @@ -1,35 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDocumentTypes - - - CFBundleTypeRole - Viewer - LSHandlerRank - Alternate - LSItemContentTypes - - public.data - - - - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - org.libsdl.test-dropfile - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - LSMinimumSystemVersion - 10.6 - - diff --git a/Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile b/Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile deleted file mode 100644 index 961ac98ef..000000000 --- a/Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile +++ /dev/null @@ -1,1558 +0,0 @@ -# Doxyfile 1.6.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = SDL - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 1.3.0 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. Note that for custom extensions you also need to set -# FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = YES - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = NO - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ../../include - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.vhd \ - *.vhdl - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = YES - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs for SDL" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.libsdl.sdl - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = SDL.chm - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = "C:/Program Files/HTML Help Workshop/hhc.exe" - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# When the SEARCHENGINE tag is enable doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) -# there is already a search function so this one should typically -# be disabled. - -SEARCHENGINE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = NO - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = DECLSPEC \ - SDLCALL - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = NO - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = /Applications/Graphviz.app/Contents/MacOS - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 67 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 2 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/Engine/lib/sdl/acinclude/libtool.m4 b/Engine/lib/sdl/acinclude/libtool.m4 index 0eb07c8af..b8ba0324f 100644 --- a/Engine/lib/sdl/acinclude/libtool.m4 +++ b/Engine/lib/sdl/acinclude/libtool.m4 @@ -1347,7 +1347,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) diff --git a/Engine/lib/sdl/autogen.sh b/Engine/lib/sdl/autogen.sh index 3e958e195..9edfb8a7d 100755 --- a/Engine/lib/sdl/autogen.sh +++ b/Engine/lib/sdl/autogen.sh @@ -5,7 +5,7 @@ echo "This may take a while ..." srcdir=`dirname $0` test -z "$srcdir" && srcdir=. -pushd $srcdir +cd "$srcdir" # Regenerate configuration files cat acinclude/* >aclocal.m4 @@ -19,7 +19,5 @@ if test x$found = xfalse; then fi (cd test; sh autogen.sh) -popd - # Run configure for this platform echo "Now you are ready to run ./configure" diff --git a/Engine/lib/sdl/build-scripts/androidbuild.sh b/Engine/lib/sdl/build-scripts/androidbuild.sh index fb48e2e5b..814578182 100755 --- a/Engine/lib/sdl/build-scripts/androidbuild.sh +++ b/Engine/lib/sdl/build-scripts/androidbuild.sh @@ -25,46 +25,21 @@ if [ -z "$1" ] || [ -z "$SOURCES" ]; then echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list" echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c" echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... " - echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..." exit 1 fi - - SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )" -NDKBUILD=`which ndk-build` -if [ -z "$NDKBUILD" ];then - echo "Could not find the ndk-build utility, install Android's NDK and add it to the path" +if [ -z "$ANDROID_HOME" ];then + echo "Please set the ANDROID_HOME directory to the path of the Android SDK" exit 1 fi -ANDROID=`which android` -if [ -z "$ANDROID" ];then - echo "Could not find the android utility, install Android's SDK and add it to the path" +if [ ! -d "$ANDROID_HOME/ndk-bundle" -a -z "$ANDROID_NDK_HOME" ]; then + echo "Please set the ANDROID_NDK_HOME directory to the path of the Android NDK" exit 1 fi -ANT=`which ant` - -if [ -z "$ANT" ];then - echo "Could not find the ant utility, install Android's SDK and add it to the path" - exit 1 -fi - -NCPUS="1" -case "$OSTYPE" in - darwin*) - NCPU=`sysctl -n hw.ncpu` - ;; - linux*) - if [ -n `which nproc` ]; then - NCPUS=`nproc` - fi - ;; - *);; -esac - APP="$1" APPARR=(${APP//./ }) BUILDPATH="$SDLPATH/build/$APP" @@ -77,27 +52,28 @@ mkdir -p $BUILDPATH cp -r $SDLPATH/android-project/* $BUILDPATH # Copy SDL sources -mkdir -p $BUILDPATH/jni/SDL +mkdir -p $BUILDPATH/app/jni/SDL if [ -z "$COPYSOURCE" ]; then - ln -s $SDLPATH/src $BUILDPATH/jni/SDL - ln -s $SDLPATH/include $BUILDPATH/jni/SDL + ln -s $SDLPATH/src $BUILDPATH/app/jni/SDL + ln -s $SDLPATH/include $BUILDPATH/app/jni/SDL else - cp -r $SDLPATH/src $BUILDPATH/jni/SDL - cp -r $SDLPATH/include $BUILDPATH/jni/SDL + cp -r $SDLPATH/src $BUILDPATH/app/jni/SDL + cp -r $SDLPATH/include $BUILDPATH/app/jni/SDL fi -cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL -sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk -sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml +cp -r $SDLPATH/Android.mk $BUILDPATH/app/jni/SDL +sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/app/jni/src/Android.mk +sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/build.gradle +sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/src/main/AndroidManifest.xml # Copy user sources for src in "${SOURCES[@]}" do - cp $src $BUILDPATH/jni/src + cp $src $BUILDPATH/app/jni/src done # Create an inherited Activity -cd $BUILDPATH/src +cd $BUILDPATH/app/src/main/java for folder in "${APPARR[@]}" do mkdir -p $folder @@ -105,31 +81,20 @@ do done ACTIVITY="${folder}Activity" -sed -i -e "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml -sed -i -e "s|SDLActivity|$APP|g" $BUILDPATH/build.xml +sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml # Fill in a default Activity -echo "package $APP;" > "$ACTIVITY.java" -echo "import org.libsdl.app.SDLActivity;" >> "$ACTIVITY.java" -echo "public class $ACTIVITY extends SDLActivity {}" >> "$ACTIVITY.java" +cat >"$ACTIVITY.java" <<__EOF__ +package $APP; + +import org.libsdl.app.SDLActivity; + +public class $ACTIVITY extends SDLActivity +{ +} +__EOF__ # Update project and build -cd $BUILDPATH -$ANDROID update project --path $BUILDPATH -$NDKBUILD -j $NCPUS $NDKARGS -$ANT debug - -cd $CURDIR - -APK="$BUILDPATH/bin/$APP-debug.apk" - -if [ -f "$APK" ]; then - echo "Your APK is ready at $APK" - echo "To install to your device: " - echo "cd $BUILDPATH" - echo "ant debug install" - exit 0 -fi - -echo "There was an error building the APK" -exit 1 \ No newline at end of file +echo "To build and install to a device for testing, run the following:" +echo "cd $BUILDPATH" +echo "./gradlew installDebug" diff --git a/Engine/lib/sdl/build-scripts/androidbuildlibs.sh b/Engine/lib/sdl/build-scripts/androidbuildlibs.sh new file mode 100755 index 000000000..934becc68 --- /dev/null +++ b/Engine/lib/sdl/build-scripts/androidbuildlibs.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Build the Android libraries without needing a project +# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.) +# +# Usage: androidbuildlibs.sh [arg for ndk-build ...]" +# +# Useful NDK arguments: +# +# NDK_DEBUG=1 - build debug version +# NDK_LIBS_OUT= - specify alternate destination for installable +# modules. +# +# Note that SDLmain is not an installable module (.so) so libSDLmain.a +# can be found in $obj/local/ along with the unstripped libSDL.so. +# + + +# Android.mk is in srcdir +srcdir=`dirname $0`/.. +srcdir=`cd $srcdir && pwd` +cd $srcdir + + +# +# Create the build directories +# + +build=build +buildandroid=$build/android +obj= +lib= +ndk_args= + +# Allow an external caller to specify locations. +for arg in $* +do + if [ "${arg:0:8}" == "NDK_OUT=" ]; then + obj=${arg#NDK_OUT=} + elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then + lib=${arg#NDK_LIBS_OUT=} + else + ndk_args="$ndk_args $arg" + fi +done + +if [ -z $obj ]; then + obj=$buildandroid/obj +fi +if [ -z $lib ]; then + lib=$buildandroid/lib +fi + +for dir in $build $buildandroid $obj $lib; do + if test -d $dir; then + : + else + mkdir $dir || exit 1 + fi +done + + +# APP_* variables set in the environment here will not be seen by the +# ndk-build makefile segments that use them, e.g., default-application.mk. +# For consistency, pass all values on the command line. +ndk-build \ + NDK_PROJECT_PATH=null \ + NDK_OUT=$obj \ + NDK_LIBS_OUT=$lib \ + APP_BUILD_SCRIPT=Android.mk \ + APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ + APP_PLATFORM=android-14 \ + APP_MODULES="SDL2 SDL2_main" \ + $ndk_args diff --git a/Engine/lib/sdl/build-scripts/checker-buildbot.sh b/Engine/lib/sdl/build-scripts/checker-buildbot.sh index eb014311a..cc16a50a2 100755 --- a/Engine/lib/sdl/build-scripts/checker-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/checker-buildbot.sh @@ -11,7 +11,7 @@ FINALDIR="$1" -CHECKERDIR="/usr/local/checker-276" +CHECKERDIR="/usr/local/checker-279" if [ ! -d "$CHECKERDIR" ]; then echo "$CHECKERDIR not found. Trying /usr/share/clang ..." 1>&2 CHECKERDIR="/usr/share/clang/scan-build" @@ -46,6 +46,10 @@ fi echo "\$MAKE is '$MAKE'" +# Unset $MAKE so submakes don't use it. +MAKECOMMAND="$MAKE" +unset MAKE + set -x set -e @@ -60,17 +64,23 @@ fi mkdir checker-buildbot cd checker-buildbot +# We turn off deprecated declarations, because we don't care about these warnings during static analysis. +# The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found" + # You might want to do this for CMake-backed builds instead... -PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled .. +PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" .. # ...or run configure without the scan-build wrapper... -#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure --enable-assertions=enabled - -# ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X). -#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure --enable-assertions=enabled +#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled rm -rf analysis -PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE +PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis $MAKECOMMAND + +if [ `ls -A analysis |wc -l` == 0 ] ; then + mkdir analysis/zarro + echo 'Zarro boogsStatic analysis: no issues to report.' >analysis/zarro/index.html +fi + mv analysis/* ../analysis rmdir analysis # Make sure this is empty. cd .. diff --git a/Engine/lib/sdl/build-scripts/config.guess b/Engine/lib/sdl/build-scripts/config.guess index 68c1be32a..a74484427 100644 --- a/Engine/lib/sdl/build-scripts/config.guess +++ b/Engine/lib/sdl/build-scripts/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2012-08-14' +timestamp='2017-08-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ timestamp='2012-08-14' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -153,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -182,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -192,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -208,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -220,6 +256,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; + *:Redox:*:*) + echo ${UNAME_MACHINE}-unknown-redox + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -236,42 +278,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -306,7 +348,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -344,16 +386,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -378,7 +420,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -564,8 +606,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -602,13 +645,13 @@ EOF sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -647,11 +690,11 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -664,12 +707,12 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -774,14 +817,14 @@ EOF echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -797,10 +840,11 @@ EOF UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -811,7 +855,7 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -859,21 +903,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -886,64 +930,60 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else - case `sed -n '/^Hardware/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - BCM2708) MANUFACTURER=raspberry;; - BCM2709) MANUFACTURER=raspberry;; - *) MANUFACTURER=unknown;; - esac if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -962,54 +1002,69 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1085,7 +1140,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1234,6 +1289,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1242,24 +1300,43 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1268,15 +1345,18 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) + NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-?:NONSTOP_KERNEL:*:*) + NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; @@ -1290,7 +1370,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1332,7 +1412,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1343,171 +1423,25 @@ EOF x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/Engine/lib/sdl/build-scripts/config.sub b/Engine/lib/sdl/build-scripts/config.sub index 53273f2bb..dcf41330c 100644 --- a/Engine/lib/sdl/build-scripts/config.sub +++ b/Engine/lib/sdl/build-scripts/config.sub @@ -1,24 +1,18 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2012-08-18' +timestamp='2017-04-02' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . @@ -26,11 +20,12 @@ timestamp='2012-08-18' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -38,7 +33,7 @@ timestamp='2012-08-18' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -58,8 +53,7 @@ timestamp='2012-08-18' me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -73,9 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -124,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -156,7 +148,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -259,21 +251,25 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia64 \ + | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -287,26 +283,30 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -314,6 +314,8 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,7 +330,10 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -383,26 +388,29 @@ case $basic_machine in | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -416,28 +424,34 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -445,6 +459,8 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -521,6 +537,9 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -641,6 +660,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -782,6 +809,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -801,7 +831,7 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; mingw64) @@ -809,7 +839,7 @@ case $basic_machine in os=-mingw64 ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -837,6 +867,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -845,7 +879,7 @@ case $basic_machine in basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i386-pc + basic_machine=i686-pc os=-msys ;; mvs) @@ -933,6 +967,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -1017,7 +1054,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1027,7 +1064,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1040,7 +1077,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1224,6 +1265,9 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + wasm32) + basic_machine=wasm32-unknown + ;; w65*) basic_machine=w65-wdc os=-none @@ -1367,29 +1411,30 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1437,6 +1482,9 @@ case $os in -os400*) os=-os400 ;; + -cegcc*) + os=-cegcc + ;; -wince*) os=-wince ;; @@ -1519,9 +1567,6 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1534,6 +1579,8 @@ case $os in -pnacl*) os=-pnacl ;; + -ios) + ;; -emscripten*) ;; -none) @@ -1576,6 +1623,9 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; hexagon-*) os=-elf ;; @@ -1628,6 +1678,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; diff --git a/Engine/lib/sdl/build-scripts/config.sub.patch b/Engine/lib/sdl/build-scripts/config.sub.patch new file mode 100644 index 000000000..8c09e0046 --- /dev/null +++ b/Engine/lib/sdl/build-scripts/config.sub.patch @@ -0,0 +1,72 @@ +--- config.sub.orig 2017-09-09 08:01:02.139023205 -0700 ++++ config.sub 2017-09-09 07:59:35.798264474 -0700 +@@ -364,6 +364,19 @@ + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; ++ nacl64*) ++ basic_machine=x86_64-pc ++ os=-nacl ++ ;; ++ nacl*) ++ basic_machine=i686-pc ++ os=-nacl ++ ;; ++ pnacl*) ++ # le32-unknown-pnacl comes from http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi ++ basic_machine=le32-unknown ++ os=-pnacl ++ ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 +@@ -877,6 +890,10 @@ + basic_machine=le32-unknown + os=-nacl + ;; ++ pnacl) ++ basic_machine=le32-unknown ++ os=-pnacl ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 +@@ -1429,6 +1446,12 @@ + ;; + esac + ;; ++ -nacl*) ++ os=-nacl ++ ;; ++ -pnacl*) ++ os=-pnacl ++ ;; + -nto-qnx*) + ;; + -nto*) +@@ -1459,6 +1482,9 @@ + -os400*) + os=-os400 + ;; ++ -cegcc*) ++ os=-cegcc ++ ;; + -wince*) + os=-wince + ;; +@@ -1548,9 +1574,15 @@ + os=-dicos + ;; + -nacl*) ++ os=-nacl ++ ;; ++ -pnacl*) ++ os=-pnacl + ;; + -ios) + ;; ++ -emscripten*) ++ ;; + -none) + ;; + *) diff --git a/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh b/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh index 42eebb697..65b43e83e 100755 --- a/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh @@ -1,9 +1,13 @@ #!/bin/bash -SDKDIR="/emsdk_portable" +if [ -z "$SDKDIR" ]; then + SDKDIR="/emsdk_portable" +fi + ENVSCRIPT="$SDKDIR/emsdk_env.sh" if [ ! -f "$ENVSCRIPT" ]; then echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2 + echo "ERROR: Set the \$SDKDIR environment variable to override this." 1>&2 exit 1 fi @@ -51,7 +55,7 @@ mkdir buildbot pushd buildbot echo "Configuring..." -emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? +emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? echo "Building..." emmake $MAKE || exit $? diff --git a/Engine/lib/sdl/build-scripts/iosbuild.sh b/Engine/lib/sdl/build-scripts/iosbuild.sh index eeb571624..bb0e6319c 100755 --- a/Engine/lib/sdl/build-scripts/iosbuild.sh +++ b/Engine/lib/sdl/build-scripts/iosbuild.sh @@ -1,7 +1,6 @@ #!/bin/sh # # Build a fat binary for iOS -# Based on fatbuild.sh and code from the Ignifuga Game Engine # Number of CPUs (for make -j) NCPU=`sysctl -n hw.ncpu` @@ -9,269 +8,181 @@ if test x$NJOB = x; then NJOB=$NCPU fi -# SDK path -XCODE_PATH=`xcode-select --print-path` -if [ -z "$XCODE_PATH" ]; then - echo "Could not find XCode location (use xcode-select -switch to set the correct path)" - exit 1 -fi - -prepare_environment() { - ARCH=$1 - - if test x$SDK_VERSION = x; then - export SDK_VERSION=`xcodebuild -showsdks | grep iphoneos | sed "s|.*iphoneos||"` - if [ -z "$XCODE_PATH" ]; then - echo "Could not find a valid iOS SDK" - exit 1 - fi - fi - - case $ARCH in - armv6) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk" - ;; - armv7) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk" - ;; - i386) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneSimulator$SDK_VERSION.sdk" - ;; - *) - echo "Unknown Architecture $ARCH" - exit 1 - ;; - esac - - if [ ! -d "$SDK_PATH" ]; then - echo "Could not find iOS SDK at $SDK_PATH" - exit 1 - fi - - if test x$MIN_OS_VERSION = x; then - export MIN_OS_VERSION="3.0" - fi - - # Environment flags - CFLAGS="-g -O2 -pipe -no-cpp-precomp -isysroot $SDK_PATH \ - -miphoneos-version-min=$MIN_OS_VERSION -I$SDK_PATH/usr/include/" - LDFLAGS="-L$SDK_PATH/usr/lib/ -isysroot $SDK_PATH \ - -miphoneos-version-min=$MIN_OS_VERSION -static-libgcc" - export CXXFLAGS="$CFLAGS" - export CXXCPP="$DEV_PATH/usr/bin/llvm-cpp-4.2" - export CPP="$CXXCPP" - export CXX="$DEV_PATH/usr/bin/llvm-g++-4.2" - export CC="$DEV_PATH/usr/bin/llvm-gcc-4.2" - export LD="$DEV_PATH/usr/bin/ld" - export AR="$DEV_PATH/usr/bin/ar" - export AS="$DEV_PATH/usr/bin/ls" - export NM="$DEV_PATH/usr/bin/nm" - export RANLIB="$DEV_PATH/usr/bin/ranlib" - export STRIP="$DEV_PATH/usr/bin/strip" - - # We dynamically load X11, so using the system X11 headers is fine. - CONFIG_FLAGS="--disable-shared --enable-static" - - case $ARCH in - armv6) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv6-apple-darwin" - export CFLAGS="$CFLAGS -arch armv6" - export LDFLAGS="$LDFLAGS -arch armv6" - ;; - armv7) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv7-apple-darwin" - export CFLAGS="$CFLAGS -arch armv7" - export LDFLAGS="$LDFLAGS -arch armv7" - ;; - i386) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=i386-apple-darwin" - export CFLAGS="$CFLAGS -arch i386" - export LDFLAGS="$LDFLAGS -arch i386" - ;; - *) - echo "Unknown Architecture $ARCH" - exit 1 - ;; - esac -} - -prepare_environment "armv6" -echo "Building with iOS SDK v$SDK_VERSION for iOS >= $MIN_OS_VERSION" - -# -# Find the configure script -# -srcdir=`dirname $0`/.. -srcdir=`cd $srcdir && pwd` -auxdir=$srcdir/build-scripts -cd $srcdir - -# -# Figure out which phase to build: -# all, -# configure, configure-armv6, configure-armv7, configure-i386 -# make, make-armv6, make-armv7, make-i386, merge -# clean -if test x"$1" = x; then - phase=all +SRC_DIR=$(cd `dirname $0`/..; pwd) +if [ "$PWD" = "$SRC_DIR" ]; then + PREFIX=$SRC_DIR/ios-build + mkdir $PREFIX else - phase="$1" -fi -case $phase in - all) - configure_armv6="yes" - configure_armv7="yes" - configure_i386="yes" - make_armv6="yes" - make_armv7="yes" - make_i386="yes" - merge="yes" - ;; - configure) - configure_armv6="yes" - configure_armv7="yes" - configure_i386="yes" - ;; - configure-armv6) - configure_armv6="yes" - ;; - configure-armv7) - configure_armv7="yes" - ;; - configure-i386) - configure_i386="yes" - ;; - make) - make_armv6="yes" - make_armv7="yes" - make_i386="yes" - merge="yes" - ;; - make-armv6) - make_armv6="yes" - ;; - make-armv7) - make_armv7="yes" - ;; - make-i386) - make_i386="yes" - ;; - merge) - merge="yes" - ;; - clean) - clean_armv6="yes" - clean_armv7="yes" - clean_i386="yes" - ;; - clean-armv6) - clean_armv6="yes" - ;; - clean-armv7) - clean_armv7="yes" - ;; - clean-i386) - clean_i386="yes" - ;; - *) - echo "Usage: $0 [all|configure[-armv6|-armv7|-i386]|make[-armv6|-armv7|-i386]|merge|clean[-armv6|-armv7|-i386]]" - exit 1 - ;; -esac - -# -# Create the build directories -# -for dir in build build/armv6 build/armv7 build/i386; do - if test -d $dir; then - : - else - mkdir $dir || exit 1 - fi -done - -# -# Build the armv6 binary -# -prepare_environment "armv6" -if test x$configure_armv6 = xyes; then - (cd build/armv6 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/armv6/include - cp include/SDL_config_iphoneos.h build/armv6/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv6/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv6/Makefile || exit 2 -fi -if test x$make_armv6 = xyes; then - (cd build/armv6 && make -j$NJOB) || exit 3 -fi -# -# Build the armv7 binary -# -prepare_environment "armv7" -if test x$configure_armv7 = xyes; then - (cd build/armv7 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/armv7/include - cp include/SDL_config_iphoneos.h build/armv7/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv7/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv7/Makefile || exit 2 -fi -if test x$make_armv7 = xyes; then - (cd build/armv7 && make -j$NJOB) || exit 3 -fi -# -# Build the i386 binary -# -prepare_environment "i386" -if test x$configure_i386 = xyes; then - (cd build/i386 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/i386/include - cp include/SDL_config_iphoneos.h build/i386/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/i386/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/i386/Makefile || exit 2 -fi -if test x$make_i386 = xyes; then - (cd build/i386 && make -j$NJOB) || exit 3 + PREFIX=$PWD fi -# -# Combine into fat binary -# -if test x$merge = xyes; then - output=ios/lib - sh $auxdir/mkinstalldirs build/$output - cd build - target=`find . -mindepth 4 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'` - (lipo -create -o $output/libSDL2.a armv6/build/.libs/libSDL2.a armv7/build/.libs/libSDL2.a i386/build/.libs/libSDL2.a && - lipo -create -o $output/libSDL2main.a armv6/build/libSDL2main.a armv7/build/libSDL2main.a i386/build/libSDL2main.a && - cp -r armv6/include ios - echo "Build complete!" && - echo "Files can be found under the build/ios directory.") || exit 4 - cd .. +BUILD_I386_IOSSIM=YES +BUILD_X86_64_IOSSIM=YES + +BUILD_IOS_ARMV7=YES +BUILD_IOS_ARMV7S=YES +BUILD_IOS_ARM64=YES + +# 13.4.0 - Mavericks +# 14.0.0 - Yosemite +# 15.0.0 - El Capitan +DARWIN=darwin15.0.0 + +XCODEDIR=`xcode-select --print-path` +IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version` +MIN_SDK_VERSION=6.0 + +IPHONEOS_PLATFORM=`xcrun --sdk iphoneos --show-sdk-platform-path` +IPHONEOS_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` + +IPHONESIMULATOR_PLATFORM=`xcrun --sdk iphonesimulator --show-sdk-platform-path` +IPHONESIMULATOR_SYSROOT=`xcrun --sdk iphonesimulator --show-sdk-path` + +# Uncomment if you want to see more information about each invocation +# of clang as the builds proceed. +# CLANG_VERBOSE="--verbose" + +CC=clang +CXX=clang + +SILENCED_WARNINGS="-Wno-unused-local-typedef -Wno-unused-function" + +CFLAGS="${CLANG_VERBOSE} ${SILENCED_WARNINGS} -DNDEBUG -g -O0 -pipe -fPIC -fobjc-arc" + +echo "PREFIX ..................... ${PREFIX}" +echo "BUILD_MACOSX_X86_64 ........ ${BUILD_MACOSX_X86_64}" +echo "BUILD_I386_IOSSIM .......... ${BUILD_I386_IOSSIM}" +echo "BUILD_X86_64_IOSSIM ........ ${BUILD_X86_64_IOSSIM}" +echo "BUILD_IOS_ARMV7 ............ ${BUILD_IOS_ARMV7}" +echo "BUILD_IOS_ARMV7S ........... ${BUILD_IOS_ARMV7S}" +echo "BUILD_IOS_ARM64 ............ ${BUILD_IOS_ARM64}" +echo "DARWIN ..................... ${DARWIN}" +echo "XCODEDIR ................... ${XCODEDIR}" +echo "IOS_SDK_VERSION ............ ${IOS_SDK_VERSION}" +echo "MIN_SDK_VERSION ............ ${MIN_SDK_VERSION}" +echo "IPHONEOS_PLATFORM .......... ${IPHONEOS_PLATFORM}" +echo "IPHONEOS_SYSROOT ........... ${IPHONEOS_SYSROOT}" +echo "IPHONESIMULATOR_PLATFORM ... ${IPHONESIMULATOR_PLATFORM}" +echo "IPHONESIMULATOR_SYSROOT .... ${IPHONESIMULATOR_SYSROOT}" +echo "CC ......................... ${CC}" +echo "CFLAGS ..................... ${CFLAGS}" +echo "CXX ........................ ${CXX}" +echo "CXXFLAGS ................... ${CXXFLAGS}" +echo "LDFLAGS .................... ${LDFLAGS}" + +################################################################### +# This section contains the build commands for each of the +# architectures that will be included in the universal binaries. +################################################################### + +echo "$(tput setaf 2)" +echo "###########################" +echo "# i386 for iPhone Simulator" +echo "###########################" +echo "$(tput sgr0)" + +if [ "${BUILD_I386_IOSSIM}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=i386-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/i386-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch i386 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j10 || exit 3 + make install + ) || exit $? fi -# -# Clean up -# -do_clean() -{ - echo $* - $* || exit 6 -} -if test x$clean_armv6 = xyes; then - do_clean rm -r build/armv6 +echo "$(tput setaf 2)" +echo "#############################" +echo "# x86_64 for iPhone Simulator" +echo "#############################" +echo "$(tput sgr0)" + +if [ "${BUILD_X86_64_IOSSIM}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=x86_64-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/x86_64-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch x86_64 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? fi -if test x$clean_armv7 = xyes; then - do_clean rm -r build/armv7 + +echo "$(tput setaf 2)" +echo "##################" +echo "# armv7 for iPhone" +echo "##################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARMV7}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=armv7-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? fi -if test x$clean_i386 = xyes; then - do_clean rm -r build/i386 + +echo "$(tput setaf 2)" +echo "###################" +echo "# armv7s for iPhone" +echo "###################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARMV7S}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=armv7s-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7s-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7s -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? fi + +echo "$(tput setaf 2)" +echo "##################" +echo "# arm64 for iPhone" +echo "##################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARM64}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=arm-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/arm64-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch arm64 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? +fi + +echo "$(tput setaf 2)" +echo "###################################################################" +echo "# Create Universal Libraries and Finalize the packaging" +echo "###################################################################" +echo "$(tput sgr0)" + +( + cd ${PREFIX}/platform + mkdir -p universal + lipo x86_64-sim/lib/libSDL2.a i386-sim/lib/libSDL2.a arm64-ios/lib/libSDL2.a armv7s-ios/lib/libSDL2.a armv7-ios/lib/libSDL2.a -create -output universal/libSDL2.a +) + +( + cd ${PREFIX} + mkdir -p lib + cp -r platform/universal/* lib + #rm -rf platform + lipo -info lib/libSDL2.a +) + +echo Done! diff --git a/Engine/lib/sdl/build-scripts/ltmain.sh b/Engine/lib/sdl/build-scripts/ltmain.sh index 63ae69dc6..6635343b2 100755 --- a/Engine/lib/sdl/build-scripts/ltmain.sh +++ b/Engine/lib/sdl/build-scripts/ltmain.sh @@ -189,7 +189,7 @@ func_basename () # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. -# value retuned in "$func_basename_result" +# value returned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. @@ -3276,7 +3276,7 @@ extern \"C\" { /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime +/* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) @@ -4394,7 +4394,7 @@ EOF { /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX namespace, but it is not one of the ones we know about and - have already dealt with, above (inluding dump-script), then + have already dealt with, above (including dump-script), then report an error. Otherwise, targets might begin to believe they are allowed to use options in the LTWRAPPER_OPTION_PREFIX namespace. The first time any user complains about this, we'll diff --git a/Engine/lib/sdl/build-scripts/nacl-buildbot.sh b/Engine/lib/sdl/build-scripts/nacl-buildbot.sh index a72333bb7..73aae9eaf 100755 --- a/Engine/lib/sdl/build-scripts/nacl-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/nacl-buildbot.sh @@ -3,7 +3,11 @@ # This is the script buildbot.libsdl.org uses to cross-compile SDL2 from # amd64 Linux to NaCl. -export NACL_SDK_ROOT="/nacl_sdk/pepper_35" +# PLEASE NOTE that we have reports that SDL built with pepper_49 (current +# stable release as of November 10th, 2016) is broken. Please retest +# when something newer becomes stable and then decide if this was SDL's +# bug or NaCl's bug. --ryan. +export NACL_SDK_ROOT="/nacl_sdk/pepper_47" TARBALL="$1" if [ -z $1 ]; then diff --git a/Engine/lib/sdl/build-scripts/update-copyright.sh b/Engine/lib/sdl/build-scripts/update-copyright.sh index 34864bc91..5955b09fa 100755 --- a/Engine/lib/sdl/build-scripts/update-copyright.sh +++ b/Engine/lib/sdl/build-scripts/update-copyright.sh @@ -2,8 +2,7 @@ find . -type f -exec grep -Il "Copyright" {} \; \ | grep -v \.hg \ -| while read i; \ +| while read file; \ do \ - LC_ALL=C sed -ie "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$i"; \ - rm "${i}e"; \ + LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ done diff --git a/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat b/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat index 7548cdd83..65adfeb1b 100644 --- a/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat +++ b/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat @@ -3,11 +3,16 @@ rem just a helper batch file for collecting up files and zipping them. rem usage: windows-buildbot-zipper.bat rem must be run from root of SDL source tree. -IF EXIST VisualC\Win32\Release GOTO okaydir +IF EXIST VisualC\Win32\Release GOTO okaywin32dir echo Please run from root of source tree after doing a Release build. GOTO done -:okaydir +:okaywin32dir +IF EXIST VisualC\x64\Release GOTO okaydirs +echo Please run from root of source tree after doing a Release build. +GOTO done + +:okaydirs erase /q /f /s zipper IF EXIST zipper GOTO zippermade mkdir zipper @@ -18,10 +23,14 @@ cd SDL mkdir include mkdir lib mkdir lib\win32 +mkdir lib\win64 copy ..\..\include\*.h include\ copy ..\..\VisualC\Win32\Release\SDL2.dll lib\win32\ copy ..\..\VisualC\Win32\Release\SDL2.lib lib\win32\ copy ..\..\VisualC\Win32\Release\SDL2main.lib lib\win32\ +copy ..\..\VisualC\x64\Release\SDL2.dll lib\win64\ +copy ..\..\VisualC\x64\Release\SDL2.lib lib\win64\ +copy ..\..\VisualC\x64\Release\SDL2main.lib lib\win64\ cd .. zip -9r ..\%1 SDL cd .. diff --git a/Engine/lib/sdl/build-scripts/winrtbuild.ps1 b/Engine/lib/sdl/build-scripts/winrtbuild.ps1 index 1bfa4da81..7ce050e48 100644 --- a/Engine/lib/sdl/build-scripts/winrtbuild.ps1 +++ b/Engine/lib/sdl/build-scripts/winrtbuild.ps1 @@ -39,7 +39,7 @@ # # Base version of SDL, used for packaging purposes -$SDLVersion = "2.0.4" +$SDLVersion = "2.0.7" # Gets the .bat file that sets up an MSBuild environment, given one of # Visual Studio's, "PlatformToolset"s. @@ -211,18 +211,26 @@ function Build-SDL-WinRT-Variant $DidAnyDLLBuildFail = $false $DidAnyNugetBuildFail = $false +# Ryan disabled WP8.0, because it doesn't appear to have mmdeviceapi.h that SDL_wasapi needs. +# My assumption is that no one will miss this, but send patches otherwise! --ryan. # Build for Windows Phone 8.0, via VC++ 2012: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true } # Build for Windows Phone 8.1, via VC++ 2013: if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyDLLBuildFail = $true } if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyDLLBuildFail = $true } # Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true } +# +# Win 8.0 auto-building was disabled on 2017-Feb-25, by David Ludwig . +# Steam's OS-usage surveys indicate that Windows 8.0 use is pretty much nil, plus +# Microsoft hasn't supported Windows 8.0 development for a few years now. +# The commented-out lines below may still work on some systems, though. +# +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true } # Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013: if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyDLLBuildFail = $true } diff --git a/Engine/lib/sdl/cmake/sdlchecks.cmake b/Engine/lib/sdl/cmake/sdlchecks.cmake index b10078192..b822c7a56 100644 --- a/Engine/lib/sdl/cmake/sdlchecks.cmake +++ b/Engine/lib/sdl/cmake/sdlchecks.cmake @@ -158,6 +158,36 @@ macro(CheckPulseAudio) endif() endmacro() +# Requires: +# - PkgCheckModules +# Optional: +# - JACK_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckJACK) + if(JACK) + pkg_check_modules(PKG_JACK jack) + if(PKG_JACK_FOUND) + set(HAVE_JACK TRUE) + file(GLOB JACK_SOURCES ${SDL2_SOURCE_DIR}/src/audio/jack/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES}) + set(SDL_AUDIO_DRIVER_JACK 1) + list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) + if(JACK_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") + else() + FindLibraryAndSONAME("jack") + set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") + set(HAVE_JACK_SHARED TRUE) + endif() + else() + list(APPEND EXTRA_LDFLAGS ${PKG_JACK_LDFLAGS}) + endif() + set(HAVE_SDL_AUDIO TRUE) + endif() + endif() +endmacro() + # Requires: # - PkgCheckModules # Optional: @@ -315,6 +345,31 @@ macro(CheckFusionSound) endif() endmacro() +# Requires: +# - LIBSAMPLERATE +# Optional: +# - LIBSAMPLERATE_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckLibSampleRate) + if(LIBSAMPLERATE) + check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H) + if(HAVE_LIBSAMPLERATE_H) + set(HAVE_LIBSAMPLERATE TRUE) + if(LIBSAMPLERATE_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") + else() + FindLibraryAndSONAME("samplerate") + set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") + set(HAVE_LIBSAMPLERATE_SHARED TRUE) + endif() + else() + list(APPEND EXTRA_LDFLAGS -lsamplerate) + endif() + endif() + endif() +endmacro() + # Requires: # - n/a # Optional: @@ -508,7 +563,7 @@ endmacro() macro(CheckMir) if(VIDEO_MIR) find_library(MIR_LIB mirclient mircommon egl) - pkg_check_modules(MIR_TOOLKIT mirclient mircommon) + pkg_check_modules(MIR_TOOLKIT mirclient>=0.26 mircommon) pkg_check_modules(EGL egl) pkg_check_modules(XKB xkbcommon) @@ -520,7 +575,7 @@ macro(CheckMir) set(SOURCE_FILES ${SOURCE_FILES} ${MIR_SOURCES}) set(SDL_VIDEO_DRIVER_MIR 1) - list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS}) + list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CFLAGS} ${XKB_CFLAGS}) if(MIR_SHARED) if(NOT HAVE_DLOPEN) @@ -557,7 +612,7 @@ macro(WaylandProtocolGen _SCANNER _XML _PROTL) ARGS code "${_XML}" "${_WAYLAND_PROT_C_CODE}" ) - set(SOURCE_FILES ${SOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c") + set(SOURCE_FILES ${SOURCE_FILES} "${_WAYLAND_PROT_C_CODE}") endmacro() # Requires: @@ -632,7 +687,7 @@ macro(CheckWayland) WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_CORE_PROTOCOL_DIR}/wayland.xml" "wayland") - foreach(_PROTL relative-pointer-unstable-v1 pointer-constraints-unstable-v1) + foreach(_PROTL relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6) string(REGEX REPLACE "\\-unstable\\-.*$" "" PROTSUBDIR ${_PROTL}) WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_PROTOCOLS_DIR}/unstable/${PROTSUBDIR}/${_PROTL}.xml" "${_PROTL}") endforeach() @@ -803,7 +858,10 @@ endmacro() # PTHREAD_LIBS macro(CheckPTHREAD) if(PTHREADS) - if(LINUX) + if(ANDROID) + # the android libc provides built-in support for pthreads, so no + # additional linking or compile flags are necessary + elseif(LINUX) set(PTHREAD_CFLAGS "-D_REENTRANT") set(PTHREAD_LDFLAGS "-pthread") elseif(BSDI) @@ -878,7 +936,7 @@ macro(CheckPTHREAD) #include int main(int argc, char **argv) { pthread_mutexattr_t attr; - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); return 0; }" HAVE_RECURSIVE_MUTEXES_NP) if(HAVE_RECURSIVE_MUTEXES_NP) @@ -907,7 +965,6 @@ macro(CheckPTHREAD) int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H) check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP) check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP) - set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c @@ -924,6 +981,7 @@ macro(CheckPTHREAD) endif() set(HAVE_SDL_THREADS TRUE) endif() + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") endif() endmacro() @@ -1071,15 +1129,19 @@ endmacro() # - n/a macro(CheckRPI) if(VIDEO_RPI) - set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) - set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" ) - set(VIDEO_RPI_LIBS bcm_host ) + pkg_check_modules(VIDEO_RPI bcm_host brcmegl) + if (NOT VIDEO_RPI_FOUND) + set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) + set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" ) + set(VIDEO_RPI_LIBRARIES bcm_host ) + set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib") + endif() listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I") listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L") set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") - set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}") + set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}") check_c_source_compiles(" #include int main(int argc, char **argv) {}" HAVE_VIDEO_RPI) @@ -1091,8 +1153,52 @@ macro(CheckRPI) set(SDL_VIDEO_DRIVER_RPI 1) file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES}) - list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS}) + list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") + list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS}) endif(SDL_VIDEO AND HAVE_VIDEO_RPI) endif(VIDEO_RPI) endmacro(CheckRPI) + +# Requires: +# - EGL +# - PkgCheckModules +# Optional: +# - KMSDRM_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckKMSDRM) + if(VIDEO_KMSDRM) + pkg_check_modules(KMSDRM libdrm gbm egl) + if(KMSDRM_FOUND) + link_directories( + ${KMSDRM_LIBRARY_DIRS} + ) + include_directories( + ${KMSDRM_INCLUDE_DIRS} + ) + set(HAVE_VIDEO_KMSDRM TRUE) + set(HAVE_SDL_VIDEO TRUE) + + file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES}) + + list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS}) + + set(SDL_VIDEO_DRIVER_KMSDRM 1) + + if(KMSDRM_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading") + else() + FindLibraryAndSONAME(drm) + FindLibraryAndSONAME(gbm) + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") + set(HAVE_KMSDRM_SHARED TRUE) + endif() + else() + set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS}) + endif() + endif() + endif() +endmacro() diff --git a/Engine/lib/sdl/cmake_uninstall.cmake.in b/Engine/lib/sdl/cmake_uninstall.cmake.in index e3a5a4be9..1761561b3 100644 --- a/Engine/lib/sdl/cmake_uninstall.cmake.in +++ b/Engine/lib/sdl/cmake_uninstall.cmake.in @@ -1,8 +1,8 @@ -if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") -file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") foreach (file ${files}) message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") diff --git a/Engine/lib/sdl/configure b/Engine/lib/sdl/configure index 5070f6e6a..1c7f87eb0 100755 --- a/Engine/lib/sdl/configure +++ b/Engine/lib/sdl/configure @@ -658,10 +658,10 @@ X_PRE_LIBS X_CFLAGS XMKMF ARTSCONFIG -PKG_CONFIG ESD_LIBS ESD_CFLAGS ESD_CONFIG +PKG_CONFIG ALSA_LIBS ALSA_CFLAGS POW_LIB @@ -798,6 +798,7 @@ enable_mmx enable_3dnow enable_sse enable_sse2 +enable_sse3 enable_altivec enable_oss enable_alsa @@ -805,6 +806,8 @@ with_alsa_prefix with_alsa_inc_prefix enable_alsatest enable_alsa_shared +enable_jack +enable_jack_shared enable_esd with_esd_prefix with_esd_exec_prefix @@ -818,13 +821,18 @@ enable_nas enable_nas_shared enable_sndio enable_sndio_shared +enable_fusionsound +enable_fusionsound_shared enable_diskaudio enable_dummyaudio +enable_libsamplerate +enable_libsamplerate_shared enable_video_wayland enable_video_wayland_qt_touch enable_wayland_shared enable_video_mir enable_mir_shared +enable_video_rpi enable_video_x11 with_x enable_x11_shared @@ -838,15 +846,17 @@ enable_video_x11_xshape enable_video_x11_vm enable_video_vivante enable_video_cocoa +enable_render_metal enable_video_directfb enable_directfb_shared -enable_fusionsound -enable_fusionsound_shared +enable_video_kmsdrm +enable_kmsdrm_shared enable_video_dummy enable_video_opengl enable_video_opengles enable_video_opengles1 enable_video_opengles2 +enable_video_vulkan enable_libudev enable_dbus enable_ime @@ -1521,16 +1531,19 @@ Optional Features: --enable-cpuinfo Enable the cpuinfo subsystem [[default=yes]] --enable-assembly Enable assembly routines [[default=yes]] --enable-ssemath Allow GCC to use SSE floating point math - [[default=no]] + [[default=maybe]] --enable-mmx use MMX assembly routines [[default=yes]] --enable-3dnow use 3DNow! assembly routines [[default=yes]] --enable-sse use SSE assembly routines [[default=yes]] - --enable-sse2 use SSE2 assembly routines [[default=no]] + --enable-sse2 use SSE2 assembly routines [[default=maybe]] + --enable-sse3 use SSE3 assembly routines [[default=maybe]] --enable-altivec use Altivec assembly routines [[default=yes]] --enable-oss support the OSS audio API [[default=maybe]] --enable-alsa support the ALSA audio API [[default=yes]] --disable-alsatest Do not try to compile and run a test Alsa program --enable-alsa-shared dynamically load ALSA audio support [[default=yes]] + --enable-jack use JACK audio [[default=yes]] + --enable-jack-shared dynamically load JACK audio support [[default=yes]] --enable-esd support the Enlightened Sound Daemon [[default=yes]] --disable-esdtest Do not try to compile and run a test ESD program --enable-esd-shared dynamically load ESD audio support [[default=yes]] @@ -1544,8 +1557,16 @@ Optional Features: --enable-nas-shared dynamically load NAS audio support [[default=yes]] --enable-sndio support the sndio audio API [[default=yes]] --enable-sndio-shared dynamically load sndio audio support [[default=yes]] + --enable-fusionsound use FusionSound audio driver [[default=no]] + --enable-fusionsound-shared + dynamically load fusionsound audio support + [[default=yes]] --enable-diskaudio support the disk writer audio driver [[default=yes]] --enable-dummyaudio support the dummy audio driver [[default=yes]] + --enable-libsamplerate use libsamplerate for audio rate conversion + [[default=yes]] + --enable-libsamplerate-shared + dynamically load libsamplerate [[default=yes]] --enable-video-wayland use Wayland video driver [[default=yes]] --enable-video-wayland-qt-touch QtWayland server support for Wayland video driver @@ -1553,6 +1574,7 @@ Optional Features: --enable-wayland-shared dynamically load Wayland support [[default=maybe]] --enable-video-mir use Mir video driver [[default=yes]] --enable-mir-shared dynamically load Mir support [[default=maybe]] + --enable-video-rpi use Raspberry Pi video driver [[default=yes]] --enable-video-x11 use X11 video driver [[default=yes]] --enable-x11-shared dynamically load X11 support [[default=maybe]] --enable-video-x11-xcursor @@ -1573,13 +1595,12 @@ Optional Features: --enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]] --enable-video-vivante use Vivante EGL video driver [[default=yes]] --enable-video-cocoa use Cocoa video driver [[default=yes]] + --enable-render-metal enable the Metal render driver [[default=yes]] --enable-video-directfb use DirectFB video driver [[default=no]] --enable-directfb-shared dynamically load directfb support [[default=yes]] - --enable-fusionsound use FusionSound audio driver [[default=no]] - --enable-fusionsound-shared - dynamically load fusionsound audio support - [[default=yes]] + --enable-video-kmsdrm use KMSDRM video driver [[default=no]] + --enable-kmsdrm-shared dynamically load kmsdrm support [[default=yes]] --enable-video-dummy use dummy video driver [[default=yes]] --enable-video-opengl include OpenGL support [[default=yes]] --enable-video-opengles include OpenGL ES support [[default=yes]] @@ -1587,6 +1608,7 @@ Optional Features: include OpenGL ES 1.1 support [[default=yes]] --enable-video-opengles2 include OpenGL ES 2.0 support [[default=yes]] + --enable-video-vulkan include Vulkan support [[default=yes]] --enable-libudev enable libudev support [[default=yes]] --enable-dbus enable D-Bus support [[default=yes]] --enable-ime enable IME support [[default=yes]] @@ -2690,9 +2712,9 @@ orig_CFLAGS="$CFLAGS" # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=5 -SDL_INTERFACE_AGE=1 -SDL_BINARY_AGE=5 +SDL_MICRO_VERSION=8 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=8 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -5977,7 +5999,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -15656,7 +15681,7 @@ case "$host" in ;; esac -INCLUDE="-I$srcdir/include" +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos" if test x$srcdir != x.; then INCLUDE="-Iinclude $INCLUDE" elif test -d .hg; then @@ -16148,7 +16173,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi - for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h + for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -16612,7 +16637,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname + for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -16665,7 +16690,7 @@ if test "x$ac_cv_lib_m_pow" = xyes; then : LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" fi - for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf + for ac_func in acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -16733,10 +16758,24 @@ done ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include " if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then : - $as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h + +$as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h fi + + for ac_header in libunwind.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" +if test "x$ac_cv_header_libunwind_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUNWIND_H 1 +_ACEOF + +fi + +done + fi @@ -16837,6 +16876,7 @@ SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/thread/*.c" SOURCES="$SOURCES $srcdir/src/timer/*.c" SOURCES="$SOURCES $srcdir/src/video/*.c" +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" # Check whether --enable-atomic was given. @@ -17072,7 +17112,7 @@ else fi if test x$enable_ssemath = xno; then - if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then + if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387" fi fi @@ -17299,6 +17339,77 @@ $as_echo "$have_gcc_sse2" >&6; } fi fi + # Check whether --enable-sse3 was given. +if test "${enable_sse3+set}" = set; then : + enableval=$enable_sse3; +else + enable_sse3=$default_ssemath +fi + + if test x$enable_sse3 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse3=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse3 option" >&5 +$as_echo_n "checking for GCC -msse3 option... " >&6; } + sse3_CFLAGS="-msse3" + CFLAGS="$save_CFLAGS $sse3_CFLAGS" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_gcc_sse3=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse3" >&5 +$as_echo "$have_gcc_sse3" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse3" + fi + fi + + ac_fn_c_check_header_mongrel "$LINENO" "immintrin.h" "ac_cv_header_immintrin_h" "$ac_includes_default" +if test "x$ac_cv_header_immintrin_h" = xyes; then : + have_immintrin_h_hdr=yes +else + have_immintrin_h_hdr=no +fi + + + if test x$have_immintrin_h_hdr = xyes; then + +$as_echo "#define HAVE_IMMINTRIN_H 1" >>confdefs.h + + fi + # Check whether --enable-altivec was given. if test "${enable_altivec+set}" = set; then : enableval=$enable_altivec; @@ -17801,6 +17912,119 @@ _ACEOF fi } +CheckJACK() +{ + # Check whether --enable-jack was given. +if test "${enable_jack+set}" = set; then : + enableval=$enable_jack; +else + enable_jack=yes +fi + + if test x$enable_audio = xyes -a x$enable_jack = xyes; then + audio_jack=no + + JACK_REQUIRED_VERSION=0.125 + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JACK $JACK_REQUIRED_VERSION support" >&5 +$as_echo_n "checking for JACK $JACK_REQUIRED_VERSION support... " >&6; } + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then + JACK_CFLAGS=`$PKG_CONFIG --cflags jack` + JACK_LIBS=`$PKG_CONFIG --libs jack` + audio_jack=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $audio_jack" >&5 +$as_echo "$audio_jack" >&6; } + + if test x$audio_jack = xyes; then + # Check whether --enable-jack-shared was given. +if test "${enable_jack_shared+set}" = set; then : + enableval=$enable_jack_shared; +else + enable_jack_shared=yes +fi + + jack_lib=`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` + + +$as_echo "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_jack_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_jack_shared = xyes && test x$jack_lib != x; then + echo "-- dynamic libjack -> $jack_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_JACK_DYNAMIC "$jack_lib" +_ACEOF + + SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" + + case "$host" in + # On Solaris, jack must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" + SUMMARY_audio="${SUMMARY_audio} jack" + fi + have_audio=yes + fi + fi +} + CheckESD() { # Check whether --enable-esd was given. @@ -18544,6 +18768,116 @@ $as_echo "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h fi } +CheckFusionSound() +{ + # Check whether --enable-fusionsound was given. +if test "${enable_fusionsound+set}" = set; then : + enableval=$enable_fusionsound; +else + enable_fusionsound=no +fi + + if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then + fusionsound=no + + FUSIONSOUND_REQUIRED_VERSION=1.1.1 + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5 +$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; } + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then + FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` + FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` + fusionsound=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5 +$as_echo "$fusionsound" >&6; } + + if test x$fusionsound = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" + + # Check whether --enable-fusionsound-shared was given. +if test "${enable_fusionsound_shared+set}" = set; then : + enableval=$enable_fusionsound_shared; +else + enable_fusionsound_shared=yes +fi + + fusionsound_shared=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 +$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } + if test x$have_loadso != xyes && \ + test x$enable_fusionsound_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_fusionsound_shared = xyes; then + +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" +_ACEOF + + fusionsound_shared=yes + SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" + SUMMARY_audio="${SUMMARY_audio} fusionsound" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 +$as_echo "$fusionsound_shared" >&6; } + + have_audio=yes + fi + fi +} + CheckDiskAudio() { # Check whether --enable-diskaudio was given. @@ -18580,6 +18914,59 @@ $as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h fi } +CheckLibSampleRate() +{ + # Check whether --enable-libsamplerate was given. +if test "${enable_libsamplerate+set}" = set; then : + enableval=$enable_libsamplerate; +else + enable_libsamplerate=yes +fi + + if test x$enable_libsamplerate = xyes; then + ac_fn_c_check_header_mongrel "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default" +if test "x$ac_cv_header_samplerate_h" = xyes; then : + have_samplerate_h_hdr=yes +else + have_samplerate_h_hdr=no +fi + + + if test x$have_samplerate_h_hdr = xyes; then + +$as_echo "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h + + + # Check whether --enable-libsamplerate-shared was given. +if test "${enable_libsamplerate_shared+set}" = set; then : + enableval=$enable_libsamplerate_shared; +else + enable_libsamplerate_shared=yes +fi + + + samplerate_lib=`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` + + if test x$have_loadso != xyes && \ + test x$enable_libsamplerate_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then + echo "-- dynamic libsamplerate -> $samplerate_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_LIBSAMPLERATE_DYNAMIC "$samplerate_lib" +_ACEOF + + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" + fi + fi + fi +} + CheckVisibilityHidden() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 @@ -18833,7 +19220,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h fi - WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1" + WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6" SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" @@ -18978,7 +19365,7 @@ int main () { - MirTouchAction actions = mir_touch_actions + MirWindowAttrib attrib = mir_window_attrib_state ; return 0; @@ -19073,9 +19460,11 @@ main () _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h - $as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h + + +$as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h $as_echo "#define HAVE_POW 1" >>confdefs.h @@ -19103,10 +19492,121 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext } -CheckX11() +CheckRPI() +{ + # Check whether --enable-video-rpi was given. +if test "${enable_video_rpi+set}" = set; then : + enableval=$enable_video_rpi; +else + enable_video_rpi=yes +fi + + if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then + RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` + RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` + elif test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + + # Add the Raspberry Pi compiler flags and libraries + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi" >&5 +$as_echo_n "checking for Raspberry Pi... " >&6; } + have_video_rpi=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + +int +main () { + bcm_host_init(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + have_video_rpi=yes + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5 +$as_echo "$have_video_rpi" >&6; } + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + if test x$have_video_rpi = xyes; then + CFLAGS="$CFLAGS $RPI_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" + +$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} rpi" + fi + fi +} + +CheckX11() +{ # Check whether --enable-video-x11 was given. if test "${enable_video_x11+set}" = set; then : enableval=$enable_video_x11; @@ -19942,7 +20442,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_const_param_XextAddDisplay=yes - $as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h + +$as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h fi @@ -19976,7 +20477,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_XGenericEvent=yes - $as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h + +$as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h fi @@ -20762,6 +21264,63 @@ $as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h fi } +CheckMETAL() +{ + # Check whether --enable-render-metal was given. +if test "${enable_render_metal+set}" = set; then : + enableval=$enable_render_metal; +else + enable_render_metal=yes +fi + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -x objective-c" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5 +$as_echo_n "checking for Metal framework... " >&6; } + have_metal=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #import + #import + #import + + #if !TARGET_CPU_X86_64 + #error Metal doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_metal=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_metal" >&5 +$as_echo "$have_metal" >&6; } + if test x$have_metal = xyes; then + +$as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/render/metal/*.m" + SUMMARY_video="${SUMMARY_video} metal" + else + enable_render_metal=no + fi + fi +} + + CheckDirectFB() { # Check whether --enable-video-directfb was given. @@ -20916,16 +21475,13 @@ fi $as_echo "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h - -$as_echo "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for directfb dynamic loading support" >&5 $as_echo_n "checking for directfb dynamic loading support... " >&6; } directfb_shared=no - directfb_lib=`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"` + directfb_lib=`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"` # | sed 's/.*\/\(.*\)/\1/; q'`] { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"directfb $directfb_lib\"" >&5 $as_echo "$as_me: WARNING: \"directfb $directfb_lib\"" >&2;} @@ -20956,19 +21512,23 @@ $as_echo "$directfb_shared" >&6; } fi } -CheckFusionSound() +CheckKMSDRM() { - # Check whether --enable-fusionsound was given. -if test "${enable_fusionsound+set}" = set; then : - enableval=$enable_fusionsound; + # Check whether --enable-video-kmsdrm was given. +if test "${enable_video_kmsdrm+set}" = set; then : + enableval=$enable_video_kmsdrm; else - enable_fusionsound=no + enable_video_kmsdrm=no fi - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no - FUSIONSOUND_REQUIRED_VERSION=1.1.1 + if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then + video_kmsdrm=no + libdrm_avail=no + libgbm_avail=no + + LIBDRM_REQUIRED_VERSION=2.4.46 + LIBGBM_REQUIRED_VERSION=9.0.0 # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 @@ -21011,57 +21571,86 @@ $as_echo "no" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5 -$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; } if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5 -$as_echo "$fusionsound" >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then + if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then + LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` + LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` + LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` + libdrm_avail=yes + fi + if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then + LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` + LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` + LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` + libgbm_avail=yes + fi + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi - if test x$fusionsound = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support" >&5 +$as_echo_n "checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libdrm_avail" >&5 +$as_echo "$libdrm_avail" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support" >&5 +$as_echo_n "checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgbm_avail" >&5 +$as_echo "$libgbm_avail" >&6; } -$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - # Check whether --enable-fusionsound-shared was given. -if test "${enable_fusionsound_shared+set}" = set; then : - enableval=$enable_fusionsound_shared; + if test x$video_kmsdrm = xyes; then + # Check whether --enable-kmsdrm-shared was given. +if test "${enable_kmsdrm_shared+set}" = set; then : + enableval=$enable_kmsdrm_shared; else - enable_fusionsound_shared=yes + enable_kmsdrm_shared=yes fi - fusionsound_shared=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 -$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then + + +$as_echo "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 +$as_echo_n "checking for kmsdrm dynamic loading support... " >&6; } + kmsdrm_shared=no + drm_lib=`find_lib "libdrm.so.*" "$DRM_LIBS"` + gbm_lib=`find_lib "libgbm.so.*" "$DRM_LIBS"` + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "$drm_lib" _ACEOF - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 -$as_echo "$fusionsound_shared" >&6; } - have_audio=yes +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "$gbm_lib" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_KMSDRM_SHARED "TRUE" +_ACEOF + + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 +$as_echo "$kmsdrm_shared" >&6; } + have_video=yes + fi + fi fi fi } @@ -21085,6 +21674,32 @@ $as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h fi } +CheckQNXVideo() +{ + if test x$enable_video = xyes; then + +$as_echo "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" + have_video=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" + SUMMARY_video="${SUMMARY_video} qnx" + fi +} + +CheckQNXAudio() +{ + if test x$enable_audio = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" + have_audio=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + SUMMARY_audio="${SUMMARY_audio} qsa" + fi +} + # Check whether --enable-video-opengl was given. if test "${enable_video_opengl+set}" = set; then : enableval=$enable_video_opengl; @@ -21475,6 +22090,97 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h fi } +# Check whether --enable-video-vulkan was given. +if test "${enable_video_vulkan+set}" = set; then : + enableval=$enable_video_vulkan; +else + enable_video_vulkan=yes +fi + + +CheckVulkan() +{ + if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then + case "$host" in + *-*-android*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + +else + + enable_video_vulkan=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + *-*-darwin*) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -x objective-c" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #include + + #if !TARGET_CPU_X86_64 + #error Vulkan doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + +else + + enable_video_vulkan=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + ;; + *) + ;; + esac + if test x$enable_video_vulkan = xno; then + # For reasons I am totally unable to see, I get an undefined macro error if + # I put this in the AC_TRY_COMPILE. + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5 +$as_echo "$as_me: WARNING: Vulkan does not work on this configuration." >&2;} + fi + fi + if test x$enable_video_vulkan = xyes; then + +$as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} vulkan" + fi +} + CheckInputEvents() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 @@ -21575,6 +22281,16 @@ fi $as_echo "#define HAVE_LIBUDEV_H 1" >>confdefs.h + + udev_lib=`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` + if test x$udev_lib != x; then + echo "-- dynamic udev -> $udev_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_UDEV_DYNAMIC "$udev_lib" +_ACEOF + + fi fi fi } @@ -21914,7 +22630,7 @@ else fi case "$host" in - *-*-androideabi*) + *-*-android*) pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" pthread_lib="" ;; @@ -21974,6 +22690,10 @@ fi pthread_cflags="-D_REENTRANT" pthread_lib="" ;; + *-*-nto*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; *) pthread_cflags="-D_REENTRANT" pthread_lib="-lpthread" @@ -22147,7 +22867,8 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_sem_timedwait=yes - $as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h + +$as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h fi @@ -22391,18 +23112,64 @@ if test "x$ac_cv_header_dxgi_h" = xyes; then : fi - ac_fn_c_check_header_mongrel "$LINENO" "xaudio2.h" "ac_cv_header_xaudio2_h" "$ac_includes_default" -if test "x$ac_cv_header_xaudio2_h" = xyes; then : - have_xaudio2=yes -fi - - ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" if test "x$ac_cv_header_xinput_h" = xyes; then : have_xinput=yes fi + ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default" +if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then : + have_wasapi=yes +fi + + + ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default" +if test "x$ac_cv_header_audioclient_h" = xyes; then : + +else + have_wasapi=no +fi + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +XINPUT_GAMEPAD_EX x1; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_xinput_gamepadex=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +XINPUT_STATE_EX s1; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_xinput_stateex=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x$have_ddraw = xyes; then @@ -22428,6 +23195,16 @@ $as_echo "#define HAVE_DXGI_H 1" >>confdefs.h $as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h + fi + if test x$have_xinput_gamepadex = xyes; then + +$as_echo "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h + + fi + if test x$have_xinput_stateex = xyes; then + +$as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h + fi SUMMARY_video="${SUMMARY_video} directx" @@ -23052,25 +23829,9 @@ fi CheckWarnAll case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) case "$host" in - *-raspberry-linux*) - # Raspberry Pi - ARCH=linux - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - # FIXME: confdefs? Not AC_DEFINE? - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} rpi" - fi - ;; - *-*-androideabi*) + *-*-android*) # Android ARCH=android ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" @@ -23078,6 +23839,7 @@ case "$host" in SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" @@ -23095,21 +23857,6 @@ case "$host" in *-*-bsdi*) ARCH=bsdi ;; *-*-freebsd*) ARCH=freebsd ;; *-*-dragonfly*) ARCH=freebsd ;; - *-raspberry-netbsd*) - # Raspberry Pi - ARCH=netbsd - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} raspberry" - fi - ;; *-*-netbsd*) ARCH=netbsd ;; *-*-openbsd*) ARCH=openbsd ;; *-*-sysv5*) ARCH=sysv5 ;; @@ -23117,6 +23864,9 @@ case "$host" in *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; + *-*-nto*) ARCH=nto + CheckQNXVideo + ;; esac CheckVisibilityHidden CheckDeclarationAfterStatement @@ -23127,15 +23877,21 @@ case "$host" in CheckOSS CheckALSA CheckPulseAudio + CheckJACK CheckARTSC CheckESD CheckNAS CheckSNDIO + CheckFusionSound + CheckLibSampleRate + # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! + CheckRPI CheckX11 CheckDirectFB - CheckFusionSound + CheckKMSDRM CheckOpenGLX11 CheckOpenGLESX11 + CheckVulkan CheckMir CheckWayland CheckLibUDev @@ -23156,6 +23912,7 @@ case "$host" in CheckLinuxVersion CheckRPATH CheckVivanteVideo + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in @@ -23164,13 +23921,15 @@ case "$host" in $as_echo "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + SUMMARY_audio="${SUMMARY_audio} sun" have_audio=yes ;; netbsd) # Don't use this on OpenBSD, it's busted. -$as_echo "#define SDL_AUDIO_DRIVER_BSD 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" + SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" + SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; aix) @@ -23178,6 +23937,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_BSD 1" >>confdefs.h $as_echo "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + SUMMARY_audio="${SUMMARY_audio} paudio" have_audio=yes ;; android) @@ -23188,6 +23948,9 @@ $as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} android" have_audio=yes ;; + nto) + CheckQNXAudio + ;; esac fi # Set up files for the joystick library @@ -23198,6 +23961,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; android) @@ -23205,23 +23969,31 @@ $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; esac fi # Set up files for the haptic library if test x$enable_haptic = xyes; then - if test x$use_input_events = xyes; then - case $ARCH in - linux) + case $ARCH in + linux) + if test x$use_input_events = xyes; then $as_echo "#define SDL_HAPTIC_LINUX 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" - have_haptic=yes - ;; - esac - fi + SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" + have_haptic=yes + fi + ;; + android) + +$as_echo "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" + have_haptic=yes + ;; + esac fi # Set up files for the power library if test x$enable_power = xyes; then @@ -23275,8 +24047,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h fi # Set up files for evdev input if test x$use_input_events = xyes; then - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" ;; *-*-cygwin* | *-*-mingw32*) ARCH=win32 @@ -23289,12 +24063,14 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h ac_default_prefix=$BUILD_PREFIX fi fi + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckWINDOWS CheckWINDOWSGL CheckWINDOWSGLES + CheckVulkan CheckDIRECTX # Set up the core platform files @@ -23337,11 +24113,11 @@ $as_echo "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi - if test x$have_xaudio2 = xyes; then + if test x$have_wasapi = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_XAUDIO2 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c" + SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" fi have_audio=yes fi @@ -23490,6 +24266,7 @@ fi CheckDummyVideo CheckDiskAudio CheckDummyAudio + CheckDLOPEN CheckHaikuVideo CheckHaikuGL CheckPTHREAD @@ -23500,6 +24277,7 @@ fi $as_echo "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" + SUMMARY_audio="${SUMMARY_audio} haiku" have_audio=yes fi # Set up files for the joystick library @@ -23518,14 +24296,6 @@ $as_echo "#define SDL_TIMER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - -$as_echo "#define SDL_LOADSO_HAIKU 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c" - have_loadso=yes - fi # Set up files for the system power library if test x$enable_power = xyes; then @@ -23545,10 +24315,33 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but + # other spins, like x86-64, use a more standard "libstdc++.so.*" + as_ac_File=`$as_echo "ac_cv_file_"/boot/system/lib/libstdc++.r4.so"" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/boot/system/lib/libstdc++.r4.so\"" >&5 +$as_echo_n "checking for \"/boot/system/lib/libstdc++.r4.so\"... " >&6; } +if eval \${$as_ac_File+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r ""/boot/system/lib/libstdc++.r4.so""; then + eval "$as_ac_File=yes" +else + eval "$as_ac_File=no" +fi +fi +eval ac_res=\$$as_ac_File + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_File"\" = x"yes"; then : + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4" +else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++" +fi + ;; - arm*-apple-darwin*) - # iOS - We are not writing anything to confdefs.h because you have to replace - # SDL_config.h for SDL_config_iphoneos.h anyway + arm*-apple-darwin*|*-ios-*) ARCH=ios CheckVisibilityHidden @@ -23557,19 +24350,26 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h CheckDiskAudio CheckDummyAudio CheckDLOPEN - CheckCOCOA + CheckMETAL + CheckVulkan CheckPTHREAD - # Set up files for the audio library if test x$enable_audio = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi # Set up files for the joystick library if test x$enable_joystick = xyes; then + +$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes fi # Set up files for the haptic library @@ -23580,6 +24380,9 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h #fi # Set up files for the power library if test x$enable_power = xyes; then + +$as_echo "#define SDL_POWER_UIKIT 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes fi @@ -23588,28 +24391,55 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + +$as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi # Set up files for the timer library if test x$enable_timers = xyes; then + +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi - # Set up additional files for the file library - if test x$enable_file = xyes; then - SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" - fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. + +$as_echo "#define SDL_VIDEO_DRIVER_UIKIT 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal" + fi ;; *-*-darwin* ) # This could be either full "Mac OS X", or plain "Darwin" which is @@ -23628,9 +24458,11 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h CheckDummyAudio CheckDLOPEN CheckCOCOA + CheckMETAL CheckX11 CheckMacGL CheckOpenGLX11 + CheckVulkan CheckPTHREAD # Set up files for the audio library @@ -23688,13 +24520,18 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h if test x$enable_file = xyes; then SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The Mac OS X platform requires special setup. - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" + fi ;; *-nacl|*-pnacl) ARCH=nacl @@ -23706,7 +24543,8 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then - $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h + +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -23916,16 +24754,16 @@ VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.rc,\ SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES` SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES` -SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES` SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES` -SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.o,g'` +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` # Set runtime shared library paths as needed @@ -24045,30 +24883,35 @@ if test x$have_x = xyes; then SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n" fi SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n" -if test x$enable_libudev = xyes; then - SUMMARY="${SUMMARY}Using libudev : YES\n" +if test x$have_samplerate_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libsamplerate : YES\n" else - SUMMARY="${SUMMARY}Using libudev : NO\n" + SUMMARY="${SUMMARY}Using libsamplerate : NO\n" +fi +if test x$have_libudev_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libudev : YES\n" +else + SUMMARY="${SUMMARY}Using libudev : NO\n" fi if test x$have_dbus_dbus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using dbus : YES\n" + SUMMARY="${SUMMARY}Using dbus : YES\n" else - SUMMARY="${SUMMARY}Using dbus : NO\n" + SUMMARY="${SUMMARY}Using dbus : NO\n" fi if test x$enable_ime = xyes; then - SUMMARY="${SUMMARY}Using ime : YES\n" + SUMMARY="${SUMMARY}Using ime : YES\n" else - SUMMARY="${SUMMARY}Using ime : NO\n" + SUMMARY="${SUMMARY}Using ime : NO\n" fi if test x$have_ibus_ibus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using ibus : YES\n" + SUMMARY="${SUMMARY}Using ibus : YES\n" else - SUMMARY="${SUMMARY}Using ibus : NO\n" + SUMMARY="${SUMMARY}Using ibus : NO\n" fi if test x$have_fcitx_frontend_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using fcitx : YES\n" + SUMMARY="${SUMMARY}Using fcitx : YES\n" else - SUMMARY="${SUMMARY}Using fcitx : NO\n" + SUMMARY="${SUMMARY}Using fcitx : NO\n" fi ac_config_commands="$ac_config_commands summary" diff --git a/Engine/lib/sdl/configure.in b/Engine/lib/sdl/configure.in index f38f02e34..1c7e79338 100644 --- a/Engine/lib/sdl/configure.in +++ b/Engine/lib/sdl/configure.in @@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=5 -SDL_INTERFACE_AGE=1 -SDL_BINARY_AGE=5 +SDL_MICRO_VERSION=8 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=8 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION AC_SUBST(SDL_MAJOR_VERSION) @@ -68,7 +68,7 @@ case "$host" in esac dnl Set up the compiler and linker flags -INCLUDE="-I$srcdir/include" +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos" if test x$srcdir != x.; then INCLUDE="-Iinclude $INCLUDE" elif test -d .hg; then @@ -234,7 +234,7 @@ if test x$enable_libc = xyes; then dnl Check for C library headers AC_HEADER_STDC - AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T @@ -268,15 +268,18 @@ if test x$enable_libc = xyes; then AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) - AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf) + AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) AC_CHECK_FUNCS(iconv) - AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include ]) + AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) + + dnl Check for additional non-standard headers + AC_CHECK_HEADERS(libunwind.h) fi dnl AC_CHECK_SIZEOF(void*) @@ -340,6 +343,7 @@ SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/thread/*.c" SOURCES="$SOURCES $srcdir/src/timer/*.c" SOURCES="$SOURCES $srcdir/src/video/*.c" +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" dnl Enable/disable various subsystems of the SDL library @@ -479,10 +483,10 @@ if test x$enable_assembly = xyes; then ;; esac AC_ARG_ENABLE(ssemath, -AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]), +AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]), , enable_ssemath=$default_ssemath) if test x$enable_ssemath = xno; then - if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then + if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387" fi fi @@ -593,7 +597,7 @@ AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), fi AC_ARG_ENABLE(sse2, -AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]), +AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]), , enable_sse2=$default_ssemath) if test x$enable_sse2 = xyes; then save_CFLAGS="$CFLAGS" @@ -629,6 +633,50 @@ AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]), fi fi + AC_ARG_ENABLE(sse3, +AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]), + , enable_sse3=$default_ssemath) + if test x$enable_sse3 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse3=no + AC_MSG_CHECKING(for GCC -msse3 option) + sse3_CFLAGS="-msse3" + CFLAGS="$save_CFLAGS $sse3_CFLAGS" + + AC_TRY_COMPILE([ + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + ],[ + ],[ + have_gcc_sse3=yes + ]) + AC_MSG_RESULT($have_gcc_sse3) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse3" + fi + fi + + AC_CHECK_HEADER(immintrin.h, + have_immintrin_h_hdr=yes, + have_immintrin_h_hdr=no) + if test x$have_immintrin_h_hdr = xyes; then + AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ]) + fi + AC_ARG_ENABLE(altivec, AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]), , enable_altivec=yes) @@ -802,6 +850,63 @@ AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[de fi } +dnl Find JACK Audio +CheckJACK() +{ + AC_ARG_ENABLE(jack, +AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]), + , enable_jack=yes) + if test x$enable_audio = xyes -a x$enable_jack = xyes; then + audio_jack=no + + JACK_REQUIRED_VERSION=0.125 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then + JACK_CFLAGS=`$PKG_CONFIG --cflags jack` + JACK_LIBS=`$PKG_CONFIG --libs jack` + audio_jack=yes + fi + fi + AC_MSG_RESULT($audio_jack) + + if test x$audio_jack = xyes; then + AC_ARG_ENABLE(jack-shared, +AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]), + , enable_jack_shared=yes) + jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_jack_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_jack_shared = xyes && test x$jack_lib != x; then + echo "-- dynamic libjack -> $jack_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" + + case "$host" in + # On Solaris, jack must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" + SUMMARY_audio="${SUMMARY_audio} jack" + fi + have_audio=yes + fi + fi +} + dnl Find the ESD includes and libraries CheckESD() { @@ -1049,6 +1154,58 @@ AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[ fi } +dnl Find FusionSound +CheckFusionSound() +{ + AC_ARG_ENABLE(fusionsound, +AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), + , enable_fusionsound=no) + if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then + fusionsound=no + + FUSIONSOUND_REQUIRED_VERSION=1.1.1 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then + FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` + FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` + fusionsound=yes + fi + fi + AC_MSG_RESULT($fusionsound) + + if test x$fusionsound = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" + + AC_ARG_ENABLE(fusionsound-shared, +AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), + , enable_fusionsound_shared=yes) + fusionsound_shared=no + AC_MSG_CHECKING(for FusionSound dynamic loading support) + if test x$have_loadso != xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) + fusionsound_shared=yes + SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" + SUMMARY_audio="${SUMMARY_audio} fusionsound" + fi + AC_MSG_RESULT($fusionsound_shared) + + have_audio=yes + fi + fi +} + dnl rcg07142001 See if the user wants the disk writer audio driver... CheckDiskAudio() { @@ -1075,6 +1232,40 @@ AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default= fi } +dnl See if libsamplerate is available +CheckLibSampleRate() +{ + AC_ARG_ENABLE(libsamplerate, +AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]), + , enable_libsamplerate=yes) + if test x$enable_libsamplerate = xyes; then + AC_CHECK_HEADER(samplerate.h, + have_samplerate_h_hdr=yes, + have_samplerate_h_hdr=no) + if test x$have_samplerate_h_hdr = xyes; then + AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ]) + + AC_ARG_ENABLE(libsamplerate-shared, +AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]), + , enable_libsamplerate_shared=yes) + + samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + + if test x$have_loadso != xyes && \ + test x$enable_libsamplerate_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then + echo "-- dynamic libsamplerate -> $samplerate_lib" + AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ]) + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" + fi + fi + fi +} + dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility CheckVisibilityHidden() @@ -1218,7 +1409,7 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ]) fi - WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1" + WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6" SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" @@ -1277,8 +1468,8 @@ dnl Check for Mir CheckMir() { AC_ARG_ENABLE(video-mir, -AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), - ,enable_video_mir=yes) +AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=no]]]), + ,enable_video_mir=no) if test x$enable_video = xyes -a x$enable_video_mir = xyes; then AC_PATH_PROG(PKG_CONFIG, pkg-config, no) @@ -1291,11 +1482,11 @@ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), save_CFLAGS="$CFLAGS" CFLAGS="$save_CFLAGS $MIR_CFLAGS" - dnl This will disable Mir if >= v0.25 is not available + dnl This will disable Mir if >= v0.26 is not available AC_TRY_COMPILE([ #include ],[ - MirTouchAction actions = mir_touch_actions + MirWindowAttrib attrib = mir_window_attrib_state ],[ video_mir=yes ]) @@ -1356,8 +1547,8 @@ CheckNativeClient() #endif ],[ ],[ - AC_DEFINE(SDL_VIDEO_DRIVER_NACL) - AC_DEFINE(SDL_AUDIO_DRIVER_NACL) + AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ]) + AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ]) AC_DEFINE(HAVE_POW, 1, [ ]) AC_DEFINE(HAVE_OPENGLES2, 1, [ ]) AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) @@ -1374,11 +1565,60 @@ CheckNativeClient() } +CheckRPI() +{ + AC_ARG_ENABLE(video-rpi, +AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]), + , enable_video_rpi=yes) + if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then + RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` + RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` + elif test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + + # Add the Raspberry Pi compiler flags and libraries + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + + AC_MSG_CHECKING(for Raspberry Pi) + have_video_rpi=no + AC_TRY_LINK([ + #include + ],[ + bcm_host_init(); + ],[ + have_video_rpi=yes + ],[ + ]) + AC_MSG_RESULT($have_video_rpi) + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + if test x$have_video_rpi = xyes; then + CFLAGS="$CFLAGS $RPI_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" + AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) + SUMMARY_video="${SUMMARY_video} rpi" + fi + fi +} + dnl Find the X11 include and library directories CheckX11() { - - AC_ARG_ENABLE(video-x11, AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), , enable_video_x11=yes) @@ -1496,7 +1736,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma ],[ ],[ have_const_param_XextAddDisplay=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ]) ]) AC_MSG_RESULT($have_const_param_XextAddDisplay) @@ -1514,7 +1754,7 @@ XGetEventData(display, cookie); XFreeEventData(display, cookie); ],[ have_XGenericEvent=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ]) ]) AC_MSG_RESULT($have_XGenericEvent) @@ -1628,7 +1868,7 @@ int event_type = XI_TouchBegin; XITouchClassInfo *t; ],[ have_xinput2_multitouch=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, []) SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" ]) AC_MSG_RESULT($have_xinput2_multitouch) @@ -1803,7 +2043,7 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]) , enable_video_cocoa=yes) if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" - dnl work around that we don't have Objective-C support in autoconf + dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_MSG_CHECKING(for Cocoa framework) have_cocoa=no @@ -1824,6 +2064,42 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]) fi } +CheckMETAL() +{ + AC_ARG_ENABLE(render-metal, +AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]), + , enable_render_metal=yes) + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_MSG_CHECKING(for Metal framework) + have_metal=no + AC_TRY_COMPILE([ + #import + #import + #import + + #if !TARGET_CPU_X86_64 + #error Metal doesn't work on this configuration + #endif + ],[ + ],[ + have_metal=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($have_metal) + if test x$have_metal = xyes; then + AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/render/metal/*.m" + SUMMARY_video="${SUMMARY_video} metal" + else + enable_render_metal=no + fi + fi +} + + dnl Find DirectFB CheckDirectFB() { @@ -1874,13 +2150,12 @@ AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[ , enable_directfb_shared=yes) AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ]) - AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ]) SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" AC_MSG_CHECKING(for directfb dynamic loading support) directfb_shared=no - directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`] + directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`] # | sed 's/.*\/\(.*\)/\1/; q'`] AC_MSG_WARN("directfb $directfb_lib") if test x$have_loadso != xyes && \ @@ -1904,54 +2179,77 @@ AC_MSG_WARN("directfb $directfb_lib") fi } -dnl Find FusionSound -CheckFusionSound() +dnl Find KMSDRM +CheckKMSDRM() { - AC_ARG_ENABLE(fusionsound, -AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), - , enable_fusionsound=no) - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no + AC_ARG_ENABLE(video-kmsdrm, +AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]), + , enable_video_kmsdrm=no) - FUSIONSOUND_REQUIRED_VERSION=1.1.1 + if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then + video_kmsdrm=no + libdrm_avail=no + libgbm_avail=no + + LIBDRM_REQUIRED_VERSION=2.4.46 + LIBGBM_REQUIRED_VERSION=9.0.0 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi - fi - AC_MSG_RESULT($fusionsound) + if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then + if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then + LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` + LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` + LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` + libdrm_avail=yes + fi + if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then + LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` + LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` + LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` + libgbm_avail=yes + fi + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi + + AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libdrm_avail) + AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libgbm_avail) - if test x$fusionsound = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - AC_ARG_ENABLE(fusionsound-shared, -AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), - , enable_fusionsound_shared=yes) - fusionsound_shared=no - AC_MSG_CHECKING(for FusionSound dynamic loading support) - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) + if test x$video_kmsdrm = xyes; then + AC_ARG_ENABLE(kmsdrm-shared, +AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]), + , enable_kmsdrm_shared=yes) + + AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + + AC_MSG_CHECKING(for kmsdrm dynamic loading support) + kmsdrm_shared=no + drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`] + gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`] + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ]) + AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ]) + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + AC_MSG_RESULT($kmsdrm_shared) + have_video=yes + fi fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - AC_MSG_RESULT($fusionsound_shared) - - have_audio=yes fi fi } @@ -1970,6 +2268,30 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]) fi } +dnl Set up the QNX video driver if enabled +CheckQNXVideo() +{ + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" + have_video=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" + SUMMARY_video="${SUMMARY_video} qnx" + fi +} + +dnl Set up the QNX audio driver if enabled +CheckQNXAudio() +{ + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" + have_audio=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + SUMMARY_audio="${SUMMARY_audio} qsa" + fi +} + dnl Check to see if OpenGL support is desired AC_ARG_ENABLE(video-opengl, AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]), @@ -2174,6 +2496,61 @@ CheckEmscriptenGLES() fi } +dnl Check to see if Vulkan support is desired +AC_ARG_ENABLE(video-vulkan, +AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]), + , enable_video_vulkan=yes) + +dnl Find Vulkan Header +CheckVulkan() +{ + if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then + case "$host" in + *-*-android*) + AC_TRY_COMPILE([ + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + ;; + *-*-darwin*) + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_TRY_COMPILE([ + #include + #include + #include + + #if !TARGET_CPU_X86_64 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + CFLAGS="$save_CFLAGS" + ;; + *) + ;; + esac + if test x$enable_video_vulkan = xno; then + # For reasons I am totally unable to see, I get an undefined macro error if + # I put this in the AC_TRY_COMPILE. + AC_MSG_WARN([Vulkan does not work on this configuration.]) + fi + fi + if test x$enable_video_vulkan = xyes; then + AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ]) + SUMMARY_video="${SUMMARY_video} vulkan" + fi +} + dnl See if we can use the new unified event interface in Linux 2.4 CheckInputEvents() { @@ -2231,6 +2608,12 @@ AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]), have_libudev_h_hdr=no) if test x$have_libudev_h_hdr = xyes; then AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ]) + + udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + if test x$udev_lib != x; then + echo "-- dynamic udev -> $udev_lib" + AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ]) + fi fi fi } @@ -2379,7 +2762,7 @@ AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[def AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), , enable_pthread_sem=yes) case "$host" in - *-*-androideabi*) + *-*-android*) pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" pthread_lib="" ;; @@ -2439,6 +2822,10 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) pthread_cflags="-D_REENTRANT" pthread_lib="" ;; + *-*-nto*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; *) pthread_cflags="-D_REENTRANT" pthread_lib="-lpthread" @@ -2528,7 +2915,7 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) sem_timedwait(NULL, NULL); ],[ have_sem_timedwait=yes - AC_DEFINE(HAVE_SEM_TIMEDWAIT) + AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ]) ]) AC_MSG_RESULT($have_sem_timedwait) fi @@ -2637,8 +3024,19 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul AC_CHECK_HEADER(dsound.h, have_dsound=yes) AC_CHECK_HEADER(dinput.h, have_dinput=yes) AC_CHECK_HEADER(dxgi.h, have_dxgi=yes) - AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes) AC_CHECK_HEADER(xinput.h, have_xinput=yes) + AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes) + AC_CHECK_HEADER(audioclient.h,,have_wasapi=no) + AC_TRY_COMPILE([ +#include +#include +XINPUT_GAMEPAD_EX x1; + ],[],[have_xinput_gamepadex=yes]) + AC_TRY_COMPILE([ +#include +#include +XINPUT_STATE_EX s1; + ],[],[have_xinput_stateex=yes]) if test x$have_ddraw = xyes; then AC_DEFINE(HAVE_DDRAW_H, 1, [ ]) @@ -2655,6 +3053,12 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul if test x$have_xinput = xyes; then AC_DEFINE(HAVE_XINPUT_H, 1, [ ]) fi + if test x$have_xinput_gamepadex = xyes; then + AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ]) + fi + if test x$have_xinput_stateex = xyes; then + AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ]) + fi SUMMARY_video="${SUMMARY_video} directx" SUMMARY_audio="${SUMMARY_audio} directx" @@ -2883,25 +3287,9 @@ CheckWarnAll dnl Set up the configuration based on the host platform! case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) case "$host" in - *-raspberry-linux*) - # Raspberry Pi - ARCH=linux - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - # FIXME: confdefs? Not AC_DEFINE? - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} rpi" - fi - ;; - *-*-androideabi*) + *-*-android*) # Android ARCH=android ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" @@ -2909,6 +3297,7 @@ case "$host" in SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" @@ -2926,21 +3315,6 @@ case "$host" in *-*-bsdi*) ARCH=bsdi ;; *-*-freebsd*) ARCH=freebsd ;; *-*-dragonfly*) ARCH=freebsd ;; - *-raspberry-netbsd*) - # Raspberry Pi - ARCH=netbsd - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} raspberry" - fi - ;; *-*-netbsd*) ARCH=netbsd ;; *-*-openbsd*) ARCH=openbsd ;; *-*-sysv5*) ARCH=sysv5 ;; @@ -2948,6 +3322,9 @@ case "$host" in *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; + *-*-nto*) ARCH=nto + CheckQNXVideo + ;; esac CheckVisibilityHidden CheckDeclarationAfterStatement @@ -2958,15 +3335,21 @@ case "$host" in CheckOSS CheckALSA CheckPulseAudio + CheckJACK CheckARTSC CheckESD CheckNAS CheckSNDIO + CheckFusionSound + CheckLibSampleRate + # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! + CheckRPI CheckX11 CheckDirectFB - CheckFusionSound + CheckKMSDRM CheckOpenGLX11 CheckOpenGLESX11 + CheckVulkan CheckMir CheckWayland CheckLibUDev @@ -2987,22 +3370,26 @@ case "$host" in CheckLinuxVersion CheckRPATH CheckVivanteVideo + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in sysv5|solaris|hpux) AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + SUMMARY_audio="${SUMMARY_audio} sun" have_audio=yes ;; netbsd) # Don't use this on OpenBSD, it's busted. - AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" + AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" + SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; aix) AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + SUMMARY_audio="${SUMMARY_audio} paudio" have_audio=yes ;; android) @@ -3011,6 +3398,9 @@ case "$host" in SUMMARY_audio="${SUMMARY_audio} android" have_audio=yes ;; + nto) + CheckQNXAudio + ;; esac fi # Set up files for the joystick library @@ -3019,26 +3409,33 @@ case "$host" in linux) AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; android) AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; esac fi # Set up files for the haptic library if test x$enable_haptic = xyes; then - if test x$use_input_events = xyes; then - case $ARCH in - linux) - AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" - have_haptic=yes - ;; - esac - fi + case $ARCH in + linux) + if test x$use_input_events = xyes; then + AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" + have_haptic=yes + fi + ;; + android) + AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" + have_haptic=yes + ;; + esac fi # Set up files for the power library if test x$enable_power = xyes; then @@ -3082,8 +3479,10 @@ case "$host" in fi # Set up files for evdev input if test x$use_input_events = xyes; then - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" ;; *-*-cygwin* | *-*-mingw32*) ARCH=win32 @@ -3096,12 +3495,14 @@ case "$host" in ac_default_prefix=$BUILD_PREFIX fi fi + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckWINDOWS CheckWINDOWSGL CheckWINDOWSGLES + CheckVulkan CheckDIRECTX # Set up the core platform files @@ -3130,9 +3531,9 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi - if test x$have_xaudio2 = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c" + if test x$have_wasapi = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" fi have_audio=yes fi @@ -3144,7 +3545,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau fi if test x$have_dinput = xyes; then AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ]) - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8" fi else AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) @@ -3229,6 +3630,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDummyVideo CheckDiskAudio CheckDummyAudio + CheckDLOPEN CheckHaikuVideo CheckHaikuGL CheckPTHREAD @@ -3237,6 +3639,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" + SUMMARY_audio="${SUMMARY_audio} haiku" have_audio=yes fi # Set up files for the joystick library @@ -3251,12 +3654,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c" - have_loadso=yes - fi # Set up files for the system power library if test x$enable_power = xyes; then AC_DEFINE(SDL_POWER_HAIKU, 1, [ ]) @@ -3272,10 +3669,11 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but + # other spins, like x86-64, use a more standard "libstdc++.so.*" + AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++") ;; - arm*-apple-darwin*) - # iOS - We are not writing anything to confdefs.h because you have to replace - # SDL_config.h for SDL_config_iphoneos.h anyway + arm*-apple-darwin*|*-ios-*) ARCH=ios CheckVisibilityHidden @@ -3284,19 +3682,22 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDiskAudio CheckDummyAudio CheckDLOPEN - CheckCOCOA + CheckMETAL + CheckVulkan CheckPTHREAD - # Set up files for the audio library if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi # Set up files for the joystick library if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes fi # Set up files for the haptic library @@ -3307,6 +3708,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau #fi # Set up files for the power library if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_UIKIT, 1, [ ]) SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes fi @@ -3315,28 +3717,41 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi # Set up files for the timer library if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi - # Set up additional files for the file library - if test x$enable_file = xyes; then - SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" - fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. + AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal" + fi ;; *-*-darwin* ) # This could be either full "Mac OS X", or plain "Darwin" which is @@ -3355,9 +3770,11 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDummyAudio CheckDLOPEN CheckCOCOA + CheckMETAL CheckX11 CheckMacGL CheckOpenGLX11 + CheckVulkan CheckPTHREAD # Set up files for the audio library @@ -3403,13 +3820,18 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau if test x$enable_file = xyes; then SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The Mac OS X platform requires special setup. - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" + fi ;; *-nacl|*-pnacl) ARCH=nacl @@ -3421,7 +3843,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # Set up files for the timer library if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_UNIX) + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi @@ -3604,16 +4026,16 @@ VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\. SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES` SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES` -SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES` SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES` -SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'` +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` # Set runtime shared library paths as needed @@ -3718,30 +4140,35 @@ if test x$have_x = xyes; then SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n" fi SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n" -if test x$enable_libudev = xyes; then - SUMMARY="${SUMMARY}Using libudev : YES\n" +if test x$have_samplerate_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libsamplerate : YES\n" else - SUMMARY="${SUMMARY}Using libudev : NO\n" + SUMMARY="${SUMMARY}Using libsamplerate : NO\n" +fi +if test x$have_libudev_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libudev : YES\n" +else + SUMMARY="${SUMMARY}Using libudev : NO\n" fi if test x$have_dbus_dbus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using dbus : YES\n" + SUMMARY="${SUMMARY}Using dbus : YES\n" else - SUMMARY="${SUMMARY}Using dbus : NO\n" + SUMMARY="${SUMMARY}Using dbus : NO\n" fi if test x$enable_ime = xyes; then - SUMMARY="${SUMMARY}Using ime : YES\n" + SUMMARY="${SUMMARY}Using ime : YES\n" else - SUMMARY="${SUMMARY}Using ime : NO\n" + SUMMARY="${SUMMARY}Using ime : NO\n" fi if test x$have_ibus_ibus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using ibus : YES\n" + SUMMARY="${SUMMARY}Using ibus : YES\n" else - SUMMARY="${SUMMARY}Using ibus : NO\n" + SUMMARY="${SUMMARY}Using ibus : NO\n" fi if test x$have_fcitx_frontend_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using fcitx : YES\n" + SUMMARY="${SUMMARY}Using fcitx : YES\n" else - SUMMARY="${SUMMARY}Using fcitx : NO\n" + SUMMARY="${SUMMARY}Using fcitx : NO\n" fi AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"]) diff --git a/Engine/lib/sdl/debian/changelog b/Engine/lib/sdl/debian/changelog index 6a88d2473..54f43972d 100644 --- a/Engine/lib/sdl/debian/changelog +++ b/Engine/lib/sdl/debian/changelog @@ -1,3 +1,27 @@ +libsdl2 (2.0.8) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.8 + + -- Sam Lantinga Sat, 4 Nov 2017 21:21:53 -0800 + +libsdl2 (2.0.7) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.7 + + -- Sam Lantinga Thu, 12 Oct 2017 08:01:16 -0800 + +libsdl2 (2.0.6) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.6 + + -- Sam Lantinga Sat, 9 Sep 2017 07:29:36 -0800 + +libsdl2 (2.0.5) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.5 + + -- Sam Lantinga Mon, 28 Nov 2016 07:32:52 -0800 + libsdl2 (2.0.4) UNRELEASED; urgency=low * Updated SDL to version 2.0.4 diff --git a/Engine/lib/sdl/debian/control b/Engine/lib/sdl/debian/control index e61995df4..a3411335a 100644 --- a/Engine/lib/sdl/debian/control +++ b/Engine/lib/sdl/debian/control @@ -11,6 +11,7 @@ Standards-Version: 3.9.3 Build-Depends: debhelper (>= 9), dh-autoreconf, dpkg-dev (>= 1.16.1~), + fcitx-libs-dev [linux-any], libasound2-dev [linux-any], libgl1-mesa-dev, libpulse-dev, @@ -26,7 +27,6 @@ Build-Depends: debhelper (>= 9), libxinerama-dev, libxrandr-dev, libxss-dev, - libxt-dev, libxxf86vm-dev Homepage: http://www.libsdl.org/ diff --git a/Engine/lib/sdl/debian/copyright b/Engine/lib/sdl/debian/copyright index 99c3d4496..4ccbf0fbd 100644 --- a/Engine/lib/sdl/debian/copyright +++ b/Engine/lib/sdl/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: Sam Lantinga Source: http://www.libsdl.org/ Files: * -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga License: zlib/libpng Files: src/libm/* @@ -12,7 +12,7 @@ Copyright: 1993 by Sun Microsystems, Inc. All rights reserved. License: SunPro Files: src/main/windows/SDL_windows_main.c -Copyright: 2016 Sam Lantinga +Copyright: 2018 Sam Lantinga License: PublicDomain_Sam_Lantinga Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 @@ -32,7 +32,7 @@ Copyright: 1995 Erik Corry License: BrownUn_UnCalifornia_ErikCorry Files: src/test/SDL_test_md5.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 1990 RSA Data Security, Inc. License: zlib/libpng and RSA_Data_Security @@ -46,12 +46,12 @@ Copyright: 1994-2003 The XFree86 Project, Inc. License: MIT/X11 Files: test/testhaptic.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 2008 Edgar Simo Serra License: BSD_3_clause Files: test/testrumble.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 2011 Edgar Simo Serra License: BSD_3_clause @@ -169,7 +169,7 @@ License: BSD_3_clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Comment: - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga . This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/debian/libsdl2-dev.install b/Engine/lib/sdl/debian/libsdl2-dev.install index af2c5b19d..a1f02d8cd 100644 --- a/Engine/lib/sdl/debian/libsdl2-dev.install +++ b/Engine/lib/sdl/debian/libsdl2-dev.install @@ -1,9 +1,8 @@ usr/bin/sdl2-config usr/include/SDL2 -usr/lib/*/libSDL2*.so -usr/lib/*/libSDL2.a -usr/lib/*/libSDL2main.a -usr/lib/*/libSDL2_test.a +usr/lib/*/*.a +usr/lib/*/*.la +usr/lib/*/*.so usr/lib/*/pkgconfig/sdl2.pc usr/lib/*/cmake/SDL2/sdl2-config.cmake usr/share/aclocal/sdl2.m4 diff --git a/Engine/lib/sdl/include/SDL.h b/Engine/lib/sdl/include/SDL.h index 1a3fa285c..d48d9d4a0 100644 --- a/Engine/lib/sdl/include/SDL.h +++ b/Engine/lib/sdl/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ */ -#ifndef _SDL_H -#define _SDL_H +#ifndef SDL_h_ +#define SDL_h_ #include "SDL_main.h" #include "SDL_stdinc.h" @@ -40,10 +40,10 @@ #include "SDL_error.h" #include "SDL_events.h" #include "SDL_filesystem.h" -#include "SDL_joystick.h" #include "SDL_gamecontroller.h" #include "SDL_haptic.h" #include "SDL_hints.h" +#include "SDL_joystick.h" #include "SDL_loadso.h" #include "SDL_log.h" #include "SDL_messagebox.h" @@ -51,6 +51,7 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" #include "SDL_timer.h" @@ -127,6 +128,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void); #endif #include "close_code.h" -#endif /* _SDL_H */ +#endif /* SDL_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_assert.h b/Engine/lib/sdl/include/SDL_assert.h index 402981f96..b38f928ae 100644 --- a/Engine/lib/sdl/include/SDL_assert.h +++ b/Engine/lib/sdl/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_assert_h -#define _SDL_assert_h +#ifndef SDL_assert_h_ +#define SDL_assert_h_ #include "SDL_config.h" @@ -51,9 +51,11 @@ assert can have unique static variables associated with it. /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() -#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) +#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) -#elif defined(HAVE_SIGNAL_H) +#elif defined(__386__) && defined(__WATCOMC__) + #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } +#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) #include #define SDL_TriggerBreakpoint() raise(SIGTRAP) #else @@ -63,7 +65,7 @@ assert can have unique static variables associated with it. #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ # define SDL_FUNCTION __func__ -#elif ((__GNUC__ >= 2) || defined(_MSC_VER)) +#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) # define SDL_FUNCTION __FUNCTION__ #else # define SDL_FUNCTION "???" @@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( * * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * - * \return SDL_AssertState value of how to handle the assertion failure. + * Return SDL_AssertState value of how to handle the assertion failure. * * \param handler Callback function, called when an assertion fails. * \param userdata A pointer passed to the callback as-is. @@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse * * const SDL_AssertData *item = SDL_GetAssertionReport(); * while (item) { - * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", + * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", * item->condition, item->function, item->filename, * item->linenum, item->trigger_count, * item->always_ignore ? "yes" : "no"); @@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); #endif #include "close_code.h" -#endif /* _SDL_assert_h */ +#endif /* SDL_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_atomic.h b/Engine/lib/sdl/include/SDL_atomic.h index 56aa81df9..b2287748c 100644 --- a/Engine/lib/sdl/include/SDL_atomic.h +++ b/Engine/lib/sdl/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,8 +56,8 @@ * All of the atomic operations that modify memory are full memory barriers. */ -#ifndef _SDL_atomic_h_ -#define _SDL_atomic_h_ +#ifndef SDL_atomic_h_ +#define SDL_atomic_h_ #include "SDL_stdinc.h" #include "SDL_platform.h" @@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); * The compiler barrier prevents the compiler from reordering * reads and writes to globally visible variables across the call. */ -#if defined(_MSC_VER) && (_MSC_VER > 1200) +#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) #define SDL_CompilerBarrier() _ReadWriteBarrier() #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") +#elif defined(__WATCOMC__) +extern _inline void SDL_CompilerBarrier (void); +#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; #else #define SDL_CompilerBarrier() \ { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } @@ -149,18 +152,24 @@ void _ReadWriteBarrier(void); * For more information on these semantics, take a look at the blog post: * http://preshing.com/20120913/acquire-and-release-semantics */ +extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); +extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); + #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ -extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(); -extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); +#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() +#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() #else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") @@ -263,6 +272,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); #include "close_code.h" -#endif /* _SDL_atomic_h_ */ +#endif /* SDL_atomic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_audio.h b/Engine/lib/sdl/include/SDL_audio.h index d51f0d1ce..d6ea68954 100644 --- a/Engine/lib/sdl/include/SDL_audio.h +++ b/Engine/lib/sdl/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Access to the raw audio mixing buffer for the SDL library. */ -#ifndef _SDL_audio_h -#define _SDL_audio_h +#ifndef SDL_audio_h_ +#define SDL_audio_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -164,6 +164,15 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, /** * The calculated values in this structure are calculated by SDL_OpenAudio(). + * + * For multi-channel audio, the default SDL channel mapping is: + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR FC BL BR (quad + center) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) */ typedef struct SDL_AudioSpec { @@ -171,7 +180,7 @@ typedef struct SDL_AudioSpec SDL_AudioFormat format; /**< Audio data format */ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ Uint8 silence; /**< Audio buffer silence value (calculated) */ - Uint16 samples; /**< Audio buffer size in samples (power of 2) */ + Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ Uint16 padding; /**< Necessary for some compile environments */ Uint32 size; /**< Audio buffer size in bytes (calculated) */ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ @@ -184,7 +193,23 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format); /** - * A structure to hold a set of audio conversion filters and buffers. + * \brief Upper limit of filters in SDL_AudioCVT + * + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, + * one of which is the terminating NULL pointer. + */ +#define SDL_AUDIOCVT_MAX_FILTERS 9 + +/** + * \struct SDL_AudioCVT + * \brief A structure to hold a set of audio conversion filters and buffers. + * + * Note that various parts of the conversion pipeline can take advantage + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require + * you to pass it aligned data, but can possibly run much faster if you + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its + * (len) field to something that's a multiple of 16, if possible. */ #ifdef __GNUC__ /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't @@ -208,7 +233,7 @@ typedef struct SDL_AudioCVT int len_cvt; /**< Length of converted audio buffer */ int len_mult; /**< buffer must be len*len_mult big */ double len_ratio; /**< Given len, final size is len*len_ratio */ - SDL_AudioFilter filters[10]; /**< Filter list */ + SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ int filter_index; /**< Current audio conversion function */ } SDL_AUDIOCVT_PACKED SDL_AudioCVT; @@ -434,10 +459,10 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); * This function takes a source format and rate and a destination format * and rate, and initializes the \c cvt structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format - * to the other. + * to the other. An unsupported format causes an error and -1 will be returned. * - * \return -1 if the format conversion is not supported, 0 if there's - * no conversion needed, or 1 if the audio filter is set up. + * \return 0 if no conversion is needed, 1 if the audio filter is set up, + * or -1 on error. */ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_format, @@ -456,9 +481,137 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, * The data conversion may expand the size of the audio data, so the buffer * \c cvt->buf should be allocated after the \c cvt structure is initialized by * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. + * + * \return 0 on success or -1 if \c cvt->buf is NULL. */ extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); +/* SDL_AudioStream is a new audio conversion interface. + The benefits vs SDL_AudioCVT: + - it can handle resampling data in chunks without generating + artifacts, when it doesn't have the complete buffer available. + - it can handle incoming data in any variable size. + - You push data as you have it, and pull it when you need it + */ +/* this is opaque to the outside world. */ +struct _SDL_AudioStream; +typedef struct _SDL_AudioStream SDL_AudioStream; + +/** + * Create a new audio stream + * + * \param src_format The format of the source audio + * \param src_channels The number of channels of the source audio + * \param src_rate The sampling rate of the source audio + * \param dst_format The format of the desired audio output + * \param dst_channels The number of channels of the desired audio output + * \param dst_rate The sampling rate of the desired audio output + * \return 0 on success, or -1 on error. + * + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate); + +/** + * Add data to be converted/resampled to the stream + * + * \param stream The stream the audio data is being added to + * \param buf A pointer to the audio data to add + * \param len The number of bytes to write to the stream + * \return 0 on success, or -1 on error. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); + +/** + * Get converted/resampled data from the stream + * + * \param stream The stream the audio is being requested from + * \param buf A buffer to fill with audio data + * \param len The maximum number of bytes to fill + * \return The number of bytes read from the stream, or -1 on error + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); + +/** + * Get the number of converted/resampled bytes available. The stream may be + * buffering data behind the scenes until it has enough to resample + * correctly, so this number might be lower than what you expect, or even + * be zero. Add more data or flush the stream if you need the data now. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); + +/** + * Tell the stream that you're done sending data, and anything being buffered + * should be converted/resampled and made available immediately. + * + * It is legal to add more data to a stream after flushing, but there will + * be audio gaps in the output. Generally this is intended to signal the + * end of input, so the complete output becomes available. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); + +/** + * Clear any pending data in the stream without converting it + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); + +/** + * Free an audio stream + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + */ +extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); + #define SDL_MIX_MAXVOLUME 128 /** * This takes two audio buffers of the playing audio format and mixes @@ -514,7 +667,7 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * \param dev The device ID to which we will queue audio. * \param data The data to queue to the device for later playback. * \param len The number of bytes (not samples!) to which (data) points. - * \return zero on success, -1 on error. + * \return 0 on success, or -1 on error. * * \sa SDL_GetQueuedAudioSize * \sa SDL_ClearQueuedAudio @@ -667,6 +820,6 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); #endif #include "close_code.h" -#endif /* _SDL_audio_h */ +#endif /* SDL_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_bits.h b/Engine/lib/sdl/include/SDL_bits.h index 528da2eac..eb8322f0d 100644 --- a/Engine/lib/sdl/include/SDL_bits.h +++ b/Engine/lib/sdl/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for fiddling with bits and bitmasks. */ -#ifndef _SDL_bits_h -#define _SDL_bits_h +#ifndef SDL_bits_h_ +#define SDL_bits_h_ #include "SDL_stdinc.h" @@ -47,10 +47,20 @@ extern "C" { * * \return Index of the most significant bit, or -1 if the value is 0. */ +#if defined(__WATCOMC__) && defined(__386__) +extern _inline int _SDL_clz_watcom (Uint32); +#pragma aux _SDL_clz_watcom = \ + "bsr eax, eax" \ + "xor eax, 31" \ + parm [eax] nomemory \ + value [eax] \ + modify exact [eax] nomemory; +#endif + SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) { -#if defined(__GNUC__) && __GNUC__ >= 4 +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) /* Count Leading Zeroes builtin in GCC. * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html */ @@ -58,6 +68,11 @@ SDL_MostSignificantBitIndex32(Uint32 x) return -1; } return 31 - __builtin_clz(x); +#elif defined(__WATCOMC__) && defined(__386__) + if (x == 0) { + return -1; + } + return 31 - _SDL_clz_watcom(x); #else /* Based off of Bit Twiddling Hacks by Sean Eron Anderson * , released in the public domain. @@ -92,6 +107,6 @@ SDL_MostSignificantBitIndex32(Uint32 x) #endif #include "close_code.h" -#endif /* _SDL_bits_h */ +#endif /* SDL_bits_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_blendmode.h b/Engine/lib/sdl/include/SDL_blendmode.h index 56d8ad66e..36a5ea76f 100644 --- a/Engine/lib/sdl/include/SDL_blendmode.h +++ b/Engine/lib/sdl/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file declaring the SDL_BlendMode enumeration */ -#ifndef _SDL_blendmode_h -#define _SDL_blendmode_h +#ifndef SDL_blendmode_h_ +#define SDL_blendmode_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -47,17 +47,74 @@ typedef enum SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA */ - SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate + SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate dstRGB = srcRGB * dstRGB dstA = dstA */ + SDL_BLENDMODE_INVALID = 0x7FFFFFFF + + /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ + } SDL_BlendMode; +/** + * \brief The blend operation used when combining source and destination pixel components + */ +typedef enum +{ + SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ + +} SDL_BlendOperation; + +/** + * \brief The normalized factor used to multiply pixel components + */ +typedef enum +{ + SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ + SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ + SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ + SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ + SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ + SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ + +} SDL_BlendFactor; + +/** + * \brief Create a custom blend mode, which may or may not be supported by a given renderer + * + * \param srcColorFactor + * \param dstColorFactor + * \param colorOperation + * \param srcAlphaFactor + * \param dstAlphaFactor + * \param alphaOperation + * + * The result of the blend mode operation will be: + * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor + * and + * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor + */ +extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, + SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, + SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_blendmode_h */ +#endif /* SDL_blendmode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_clipboard.h b/Engine/lib/sdl/include/SDL_clipboard.h index a5556f21c..f28751ebb 100644 --- a/Engine/lib/sdl/include/SDL_clipboard.h +++ b/Engine/lib/sdl/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL clipboard handling */ -#ifndef _SDL_clipboard_h -#define _SDL_clipboard_h +#ifndef SDL_clipboard_h_ +#define SDL_clipboard_h_ #include "SDL_stdinc.h" @@ -66,6 +66,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); #endif #include "close_code.h" -#endif /* _SDL_clipboard_h */ +#endif /* SDL_clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_config.h b/Engine/lib/sdl/include/SDL_config.h index 4270c78bf..7e0340cdf 100644 --- a/Engine/lib/sdl/include/SDL_config.h +++ b/Engine/lib/sdl/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -29,9 +29,7 @@ */ /* Add any platform that doesn't build using the configure system. */ -#ifdef USING_PREMAKE_CONFIG_H -#include "SDL_config_premake.h" -#elif defined(__WIN32__) +#if defined(__WIN32__) #include "SDL_config_windows.h" #elif defined(__WINRT__) #include "SDL_config_winrt.h" @@ -52,4 +50,4 @@ #error Wrong SDL_config.h, check your include path? #endif -#endif /* _SDL_config_h */ +#endif /* SDL_config_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config.h.cmake b/Engine/lib/sdl/include/SDL_config.h.cmake index 98c62a994..a8d230c46 100644 --- a/Engine/lib/sdl/include/SDL_config.h.cmake +++ b/Engine/lib/sdl/include/SDL_config.h.cmake @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ /** * \file SDL_config.h.in @@ -47,42 +47,32 @@ #cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@ #cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@ -#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ -#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ -#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ -#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ -#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ -#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@ -#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ -#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ - /* Comment this if you want to build without any C library requirements */ #cmakedefine HAVE_LIBC 1 #if HAVE_LIBC /* Useful headers */ -#cmakedefine HAVE_ALLOCA_H 1 -#cmakedefine HAVE_SYS_TYPES_H 1 -#cmakedefine HAVE_STDIO_H 1 #cmakedefine STDC_HEADERS 1 -#cmakedefine HAVE_STDLIB_H 1 -#cmakedefine HAVE_STDARG_H 1 -#cmakedefine HAVE_MALLOC_H 1 -#cmakedefine HAVE_MEMORY_H 1 -#cmakedefine HAVE_STRING_H 1 -#cmakedefine HAVE_STRINGS_H 1 -#cmakedefine HAVE_INTTYPES_H 1 -#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_CTYPE_H 1 -#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_FLOAT_H 1 #cmakedefine HAVE_ICONV_H 1 +#cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_LIMITS_H 1 +#cmakedefine HAVE_MALLOC_H 1 +#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_MEMORY_H 1 #cmakedefine HAVE_SIGNAL_H 1 -#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_STDIO_H 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_STRINGS_H 1 +#cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_WCHAR_H 1 #cmakedefine HAVE_PTHREAD_NP_H 1 -#cmakedefine HAVE_LIBUDEV_H 1 -#cmakedefine HAVE_DBUS_DBUS_H 1 -#cmakedefine HAVE_IBUS_IBUS_H 1 -#cmakedefine HAVE_FCITX_FRONTEND_H 1 +#cmakedefine HAVE_LIBUNWIND_H 1 /* C library functions */ #cmakedefine HAVE_MALLOC 1 @@ -103,10 +93,13 @@ #cmakedefine HAVE_MEMCPY 1 #cmakedefine HAVE_MEMMOVE 1 #cmakedefine HAVE_MEMCMP 1 +#cmakedefine HAVE_WCSLEN 1 +#cmakedefine HAVE_WCSLCPY 1 +#cmakedefine HAVE_WCSLCAT 1 +#cmakedefine HAVE_WCSCMP 1 #cmakedefine HAVE_STRLEN 1 #cmakedefine HAVE_STRLCPY 1 #cmakedefine HAVE_STRLCAT 1 -#cmakedefine HAVE_STRDUP 1 #cmakedefine HAVE__STRREV 1 #cmakedefine HAVE__STRUPR 1 #cmakedefine HAVE__STRLWR 1 @@ -137,25 +130,41 @@ #cmakedefine HAVE_VSSCANF 1 #cmakedefine HAVE_VSNPRINTF 1 #cmakedefine HAVE_M_PI 1 -#cmakedefine HAVE_ATAN 1 -#cmakedefine HAVE_ATAN2 1 #cmakedefine HAVE_ACOS 1 +#cmakedefine HAVE_ACOSF 1 #cmakedefine HAVE_ASIN 1 +#cmakedefine HAVE_ASINF 1 +#cmakedefine HAVE_ATAN 1 +#cmakedefine HAVE_ATANF 1 +#cmakedefine HAVE_ATAN2 1 +#cmakedefine HAVE_ATAN2F 1 #cmakedefine HAVE_CEIL 1 +#cmakedefine HAVE_CEILF 1 #cmakedefine HAVE_COPYSIGN 1 +#cmakedefine HAVE_COPYSIGNF 1 #cmakedefine HAVE_COS 1 #cmakedefine HAVE_COSF 1 #cmakedefine HAVE_FABS 1 +#cmakedefine HAVE_FABSF 1 #cmakedefine HAVE_FLOOR 1 +#cmakedefine HAVE_FLOORF 1 +#cmakedefine HAVE_FMOD 1 +#cmakedefine HAVE_FMODF 1 #cmakedefine HAVE_LOG 1 +#cmakedefine HAVE_LOGF 1 +#cmakedefine HAVE_LOG10 1 +#cmakedefine HAVE_LOG10F 1 #cmakedefine HAVE_POW 1 +#cmakedefine HAVE_POWF 1 #cmakedefine HAVE_SCALBN 1 +#cmakedefine HAVE_SCALBNF 1 #cmakedefine HAVE_SIN 1 #cmakedefine HAVE_SINF 1 #cmakedefine HAVE_SQRT 1 #cmakedefine HAVE_SQRTF 1 #cmakedefine HAVE_TAN 1 #cmakedefine HAVE_TANF 1 +#cmakedefine HAVE_FOPEN64 1 #cmakedefine HAVE_FSEEKO 1 #cmakedefine HAVE_FSEEKO64 1 #cmakedefine HAVE_SIGACTION 1 @@ -171,14 +180,36 @@ #cmakedefine HAVE_PTHREAD_SETNAME_NP 1 #cmakedefine HAVE_PTHREAD_SET_NAME_NP 1 #cmakedefine HAVE_SEM_TIMEDWAIT 1 +#cmakedefine HAVE_GETAUXVAL 1 +#cmakedefine HAVE_POLL 1 + #elif __WIN32__ #cmakedefine HAVE_STDARG_H 1 #cmakedefine HAVE_STDDEF_H 1 +#cmakedefine HAVE_FLOAT_H 1 #else /* We may need some replacement for stdarg.h here */ #include #endif /* HAVE_LIBC */ +#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_DBUS_DBUS_H 1 +#cmakedefine HAVE_FCITX_FRONTEND_H 1 +#cmakedefine HAVE_IBUS_IBUS_H 1 +#cmakedefine HAVE_IMMINTRIN_H 1 +#cmakedefine HAVE_LIBSAMPLERATE_H 1 +#cmakedefine HAVE_LIBUDEV_H 1 + +#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ +#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ +#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ +#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ +#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ +#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ +#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ +#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ +#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ + /* SDL internal assertion support */ #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ @@ -199,35 +230,37 @@ #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ /* Enable various audio drivers */ -#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ #cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ -#cmakedefine SDL_AUDIO_DRIVER_BSD @SDL_AUDIO_DRIVER_BSD@ #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ -#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ -#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@ #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ +#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ #cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ +#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ +#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ /* Enable various input drivers */ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ @@ -250,9 +283,9 @@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@ #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@ +#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@ /* Enable various shared object loading systems */ -#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@ #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ #cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ @@ -284,6 +317,10 @@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@ + #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@ @@ -322,6 +359,7 @@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ #cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ +#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@ /* Enable OpenGL support */ #cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@ @@ -335,6 +373,9 @@ #cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@ #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@ +/* Enable Vulkan support */ +#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@ + /* Enable system power support */ #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@ #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ @@ -357,6 +398,8 @@ #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ +/* Enable dynamic libsamplerate support */ +#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@ /* Platform specific definitions */ #if !defined(__WIN32__) @@ -418,4 +461,4 @@ typedef unsigned int uintptr_t; # endif /* !_STDINT_H_ && !HAVE_STDINT_H */ #endif /* __WIN32__ */ -#endif /* _SDL_config_h */ +#endif /* SDL_config_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config.h.in b/Engine/lib/sdl/include/SDL_config.h.in index d610cd6ba..422f47f78 100644 --- a/Engine/lib/sdl/include/SDL_config.h.in +++ b/Engine/lib/sdl/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ /** * \file SDL_config.h.in @@ -50,39 +50,32 @@ #undef HAVE_GCC_ATOMICS #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET -#undef HAVE_DDRAW_H -#undef HAVE_DINPUT_H -#undef HAVE_DSOUND_H -#undef HAVE_DXGI_H -#undef HAVE_XINPUT_H - /* Comment this if you want to build without any C library requirements */ #undef HAVE_LIBC #if HAVE_LIBC /* Useful headers */ -#undef HAVE_ALLOCA_H -#undef HAVE_SYS_TYPES_H -#undef HAVE_STDIO_H #undef STDC_HEADERS -#undef HAVE_STDLIB_H -#undef HAVE_STDARG_H -#undef HAVE_MALLOC_H -#undef HAVE_MEMORY_H -#undef HAVE_STRING_H -#undef HAVE_STRINGS_H -#undef HAVE_INTTYPES_H -#undef HAVE_STDINT_H +#undef HAVE_ALLOCA_H #undef HAVE_CTYPE_H -#undef HAVE_MATH_H +#undef HAVE_FLOAT_H #undef HAVE_ICONV_H +#undef HAVE_INTTYPES_H +#undef HAVE_LIMITS_H +#undef HAVE_MALLOC_H +#undef HAVE_MATH_H +#undef HAVE_MEMORY_H #undef HAVE_SIGNAL_H -#undef HAVE_ALTIVEC_H +#undef HAVE_STDARG_H +#undef HAVE_STDINT_H +#undef HAVE_STDIO_H +#undef HAVE_STDLIB_H +#undef HAVE_STRINGS_H +#undef HAVE_STRING_H +#undef HAVE_SYS_TYPES_H +#undef HAVE_WCHAR_H #undef HAVE_PTHREAD_NP_H -#undef HAVE_LIBUDEV_H -#undef HAVE_DBUS_DBUS_H -#undef HAVE_IBUS_IBUS_H -#undef HAVE_FCITX_FRONTEND_H +#undef HAVE_LIBUNWIND_H /* C library functions */ #undef HAVE_MALLOC @@ -103,10 +96,13 @@ #undef HAVE_MEMCPY #undef HAVE_MEMMOVE #undef HAVE_MEMCMP +#undef HAVE_WCSLEN +#undef HAVE_WCSLCPY +#undef HAVE_WCSLCAT +#undef HAVE_WCSCMP #undef HAVE_STRLEN #undef HAVE_STRLCPY #undef HAVE_STRLCAT -#undef HAVE_STRDUP #undef HAVE__STRREV #undef HAVE__STRUPR #undef HAVE__STRLWR @@ -139,25 +135,41 @@ #undef HAVE_SNPRINTF #undef HAVE_VSNPRINTF #undef HAVE_M_PI -#undef HAVE_ATAN -#undef HAVE_ATAN2 #undef HAVE_ACOS +#undef HAVE_ACOSF #undef HAVE_ASIN +#undef HAVE_ASINF +#undef HAVE_ATAN +#undef HAVE_ATANF +#undef HAVE_ATAN2 +#undef HAVE_ATAN2F #undef HAVE_CEIL +#undef HAVE_CEILF #undef HAVE_COPYSIGN +#undef HAVE_COPYSIGNF #undef HAVE_COS #undef HAVE_COSF #undef HAVE_FABS +#undef HAVE_FABSF #undef HAVE_FLOOR +#undef HAVE_FLOORF +#undef HAVE_FMOD +#undef HAVE_FMODF #undef HAVE_LOG +#undef HAVE_LOGF +#undef HAVE_LOG10 +#undef HAVE_LOG10F #undef HAVE_POW +#undef HAVE_POWF #undef HAVE_SCALBN +#undef HAVE_SCALBNF #undef HAVE_SIN #undef HAVE_SINF #undef HAVE_SQRT #undef HAVE_SQRTF #undef HAVE_TAN #undef HAVE_TANF +#undef HAVE_FOPEN64 #undef HAVE_FSEEKO #undef HAVE_FSEEKO64 #undef HAVE_SIGACTION @@ -173,6 +185,8 @@ #undef HAVE_PTHREAD_SETNAME_NP #undef HAVE_PTHREAD_SET_NAME_NP #undef HAVE_SEM_TIMEDWAIT +#undef HAVE_GETAUXVAL +#undef HAVE_POLL #else #define HAVE_STDARG_H 1 @@ -180,6 +194,22 @@ #define HAVE_STDINT_H 1 #endif /* HAVE_LIBC */ +#undef HAVE_ALTIVEC_H +#undef HAVE_DBUS_DBUS_H +#undef HAVE_FCITX_FRONTEND_H +#undef HAVE_IBUS_IBUS_H +#undef HAVE_IMMINTRIN_H +#undef HAVE_LIBSAMPLERATE_H +#undef HAVE_LIBUDEV_H + +#undef HAVE_DDRAW_H +#undef HAVE_DINPUT_H +#undef HAVE_DSOUND_H +#undef HAVE_DXGI_H +#undef HAVE_XINPUT_H +#undef HAVE_XINPUT_GAMEPAD_EX +#undef HAVE_XINPUT_STATE_EX + /* SDL internal assertion support */ #undef SDL_DEFAULT_ASSERT_LEVEL @@ -202,34 +232,36 @@ /* Enable various audio drivers */ #undef SDL_AUDIO_DRIVER_ALSA #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#undef SDL_AUDIO_DRIVER_ANDROID #undef SDL_AUDIO_DRIVER_ARTS #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC -#undef SDL_AUDIO_DRIVER_PULSEAUDIO -#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_HAIKU -#undef SDL_AUDIO_DRIVER_BSD #undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_DISK -#undef SDL_AUDIO_DRIVER_DUMMY -#undef SDL_AUDIO_DRIVER_ANDROID -#undef SDL_AUDIO_DRIVER_XAUDIO2 #undef SDL_AUDIO_DRIVER_DSOUND +#undef SDL_AUDIO_DRIVER_DUMMY +#undef SDL_AUDIO_DRIVER_EMSCRIPTEN #undef SDL_AUDIO_DRIVER_ESD #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#undef SDL_AUDIO_DRIVER_FUSIONSOUND +#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC +#undef SDL_AUDIO_DRIVER_HAIKU +#undef SDL_AUDIO_DRIVER_JACK +#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC #undef SDL_AUDIO_DRIVER_NACL #undef SDL_AUDIO_DRIVER_NAS #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC -#undef SDL_AUDIO_DRIVER_SNDIO -#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC +#undef SDL_AUDIO_DRIVER_NETBSD #undef SDL_AUDIO_DRIVER_OSS #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H #undef SDL_AUDIO_DRIVER_PAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC #undef SDL_AUDIO_DRIVER_QSA +#undef SDL_AUDIO_DRIVER_SNDIO +#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC #undef SDL_AUDIO_DRIVER_SUNAUDIO +#undef SDL_AUDIO_DRIVER_WASAPI #undef SDL_AUDIO_DRIVER_WINMM -#undef SDL_AUDIO_DRIVER_FUSIONSOUND -#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC -#undef SDL_AUDIO_DRIVER_EMSCRIPTEN /* Enable various input drivers */ #undef SDL_INPUT_LINUXEV @@ -247,13 +279,13 @@ #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H #undef SDL_JOYSTICK_EMSCRIPTEN #undef SDL_HAPTIC_DUMMY +#undef SDL_HAPTIC_ANDROID #undef SDL_HAPTIC_LINUX #undef SDL_HAPTIC_IOKIT #undef SDL_HAPTIC_DINPUT #undef SDL_HAPTIC_XINPUT /* Enable various shared object loading systems */ -#undef SDL_LOADSO_HAIKU #undef SDL_LOADSO_DLOPEN #undef SDL_LOADSO_DUMMY #undef SDL_LOADSO_LDG @@ -289,6 +321,9 @@ #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON #undef SDL_VIDEO_DRIVER_X11 #undef SDL_VIDEO_DRIVER_RPI +#undef SDL_VIDEO_DRIVER_KMSDRM +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM #undef SDL_VIDEO_DRIVER_ANDROID #undef SDL_VIDEO_DRIVER_EMSCRIPTEN #undef SDL_VIDEO_DRIVER_X11_DYNAMIC @@ -314,6 +349,7 @@ #undef SDL_VIDEO_DRIVER_NACL #undef SDL_VIDEO_DRIVER_VIVANTE #undef SDL_VIDEO_DRIVER_VIVANTE_VDK +#undef SDL_VIDEO_DRIVER_QNX #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_D3D11 @@ -321,6 +357,7 @@ #undef SDL_VIDEO_RENDER_OGL_ES #undef SDL_VIDEO_RENDER_OGL_ES2 #undef SDL_VIDEO_RENDER_DIRECTFB +#undef SDL_VIDEO_RENDER_METAL /* Enable OpenGL support */ #undef SDL_VIDEO_OPENGL @@ -334,6 +371,9 @@ #undef SDL_VIDEO_OPENGL_OSMESA #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC +/* Enable Vulkan support */ +#undef SDL_VIDEO_VULKAN + /* Enable system power support */ #undef SDL_POWER_LINUX #undef SDL_POWER_WINDOWS @@ -360,4 +400,10 @@ /* Enable ime support */ #undef SDL_USE_IME -#endif /* _SDL_config_h */ +/* Enable dynamic udev support */ +#undef SDL_UDEV_DYNAMIC + +/* Enable dynamic libsamplerate support */ +#undef SDL_LIBSAMPLERATE_DYNAMIC + +#endif /* SDL_config_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_android.h b/Engine/lib/sdl/include/SDL_config_android.h index 996cf76c9..4c4da37ec 100644 --- a/Engine/lib/sdl/include/SDL_config_android.h +++ b/Engine/lib/sdl/include/SDL_config_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_android_h -#define _SDL_config_android_h +#ifndef SDL_config_android_h_ +#define SDL_config_android_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -34,16 +35,17 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -66,7 +68,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -83,20 +84,34 @@ #define HAVE_STRNCASECMP 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -107,7 +122,7 @@ #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 -#define HAVE_CLOCK_GETTIME 1 +#define HAVE_CLOCK_GETTIME 1 #define SIZEOF_VOIDP 4 @@ -117,7 +132,7 @@ /* Enable various input drivers */ #define SDL_JOYSTICK_ANDROID 1 -#define SDL_HAPTIC_DUMMY 1 +#define SDL_HAPTIC_ANDROID 1 /* Enable various shared object loading systems */ #define SDL_LOADSO_DLOPEN 1 @@ -139,10 +154,18 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES2 1 +/* Enable Vulkan support */ +/* Android does not support Vulkan in native code using the "armeabi" ABI. */ +#if defined(__ARM_ARCH) && __ARM_ARCH < 7 +#define SDL_VIDEO_VULKAN 0 +#else +#define SDL_VIDEO_VULKAN 1 +#endif + /* Enable system power support */ #define SDL_POWER_ANDROID 1 /* Enable the filesystem driver */ #define SDL_FILESYSTEM_ANDROID 1 -#endif /* _SDL_config_android_h */ +#endif /* SDL_config_android_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_iphoneos.h b/Engine/lib/sdl/include/SDL_config_iphoneos.h index 470985f80..7b0a6ca2d 100644 --- a/Engine/lib/sdl/include/SDL_config_iphoneos.h +++ b/Engine/lib/sdl/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_iphoneos_h -#define _SDL_config_iphoneos_h +#ifndef SDL_config_iphoneos_h_ +#define SDL_config_iphoneos_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -32,16 +33,19 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 +/* The libunwind functions are only available on x86 */ +/* #undef HAVE_LIBUNWIND_H */ /* C library functions */ #define HAVE_MALLOC 1 @@ -64,7 +68,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -82,19 +85,34 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -132,12 +150,27 @@ #define SDL_VIDEO_DRIVER_UIKIT 1 #define SDL_VIDEO_DRIVER_DUMMY 1 -/* enable OpenGL ES */ +/* Enable OpenGL ES */ #define SDL_VIDEO_OPENGL_ES2 1 #define SDL_VIDEO_OPENGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES2 1 +/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */ +#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000)) +#define SDL_PLATFORM_SUPPORTS_METAL 1 +#else +#define SDL_PLATFORM_SUPPORTS_METAL 0 +#endif + +#if SDL_PLATFORM_SUPPORTS_METAL +#define SDL_VIDEO_RENDER_METAL 1 +#endif + +#if SDL_PLATFORM_SUPPORTS_METAL +#define SDL_VIDEO_VULKAN 1 +#endif + /* Enable system power support */ #define SDL_POWER_UIKIT 1 @@ -155,4 +188,4 @@ /* enable filesystem support */ #define SDL_FILESYSTEM_COCOA 1 -#endif /* _SDL_config_iphoneos_h */ +#endif /* SDL_config_iphoneos_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_macosx.h b/Engine/lib/sdl/include/SDL_config_macosx.h index 5c8b7e033..29f583e10 100644 --- a/Engine/lib/sdl/include/SDL_config_macosx.h +++ b/Engine/lib/sdl/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_macosx_h -#define _SDL_config_macosx_h +#ifndef SDL_config_macosx_h_ +#define SDL_config_macosx_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -36,16 +37,19 @@ #endif /* Useful headers */ -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_LIBUNWIND_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -67,7 +71,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -84,15 +87,35 @@ #define HAVE_STRNCASECMP 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -104,10 +127,6 @@ #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 #define HAVE_SYSCTLBYNAME 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_COREAUDIO 1 @@ -162,10 +181,29 @@ #define SDL_VIDEO_RENDER_OGL 1 #endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif + +#ifndef SDL_VIDEO_RENDER_METAL +/* Metal only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_RENDER_METAL 1 +#else +#define SDL_VIDEO_RENDER_METAL 0 +#endif +#endif + /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL #define SDL_VIDEO_OPENGL 1 #endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif #ifndef SDL_VIDEO_OPENGL_CGL #define SDL_VIDEO_OPENGL_CGL 1 #endif @@ -173,6 +211,14 @@ #define SDL_VIDEO_OPENGL_GLX 1 #endif +/* Enable Vulkan support */ +/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + /* Enable system power support */ #define SDL_POWER_MACOSX 1 @@ -185,4 +231,4 @@ #define SDL_ALTIVEC_BLITTERS 1 #endif -#endif /* _SDL_config_macosx_h */ +#endif /* SDL_config_macosx_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_minimal.h b/Engine/lib/sdl/include/SDL_config_minimal.h index 3c9d09afc..5b03d8b69 100644 --- a/Engine/lib/sdl/include/SDL_config_minimal.h +++ b/Engine/lib/sdl/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_minimal_h -#define _SDL_config_minimal_h +#ifndef SDL_config_minimal_h_ +#define SDL_config_minimal_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -78,4 +79,4 @@ typedef unsigned long uintptr_t; /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ #define SDL_FILESYSTEM_DUMMY 1 -#endif /* _SDL_config_minimal_h */ +#endif /* SDL_config_minimal_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_pandora.h b/Engine/lib/sdl/include/SDL_config_pandora.h index 7b51e571f..be5a85c19 100644 --- a/Engine/lib/sdl/include/SDL_config_pandora.h +++ b/Engine/lib/sdl/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_pandora_h_ +#define SDL_config_pandora_h_ +#define SDL_config_h_ /* This is a set of defines to configure the SDL features */ @@ -35,22 +36,24 @@ #define SDL_BYTEORDER 1234 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_ICONV_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MATH_H 1 +#define HAVE_MEMORY_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 + #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 @@ -67,7 +70,6 @@ #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_STRLEN 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -91,6 +93,7 @@ #define HAVE_FABS 1 #define HAVE_FLOOR 1 #define HAVE_LOG 1 +#define HAVE_LOG10 1 #define HAVE_SCALBN 1 #define HAVE_SIN 1 #define HAVE_SINF 1 @@ -124,4 +127,4 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_OPENGL_ES 1 -#endif /* _SDL_config_h */ +#endif /* SDL_config_pandora_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_psp.h b/Engine/lib/sdl/include/SDL_config_psp.h index a6e49609a..61c334978 100644 --- a/Engine/lib/sdl/include/SDL_config_psp.h +++ b/Engine/lib/sdl/include/SDL_config_psp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_psp_h -#define _SDL_config_psp_h +#ifndef SDL_config_psp_h_ +#define SDL_config_psp_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -32,16 +33,17 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -64,7 +66,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -82,19 +83,34 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -140,4 +156,4 @@ #define SDL_LOADSO_DISABLED 1 -#endif /* _SDL_config_psp_h */ +#endif /* SDL_config_psp_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_windows.h b/Engine/lib/sdl/include/SDL_config_windows.h index 890986cc4..52a9ece16 100644 --- a/Engine/lib/sdl/include/SDL_config_windows.h +++ b/Engine/lib/sdl/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -85,12 +86,14 @@ typedef unsigned int uintptr_t; /* This is disabled by default to avoid C runtime dependencies and manifest requirements */ #ifdef HAVE_LIBC /* Useful headers */ -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -106,13 +109,15 @@ typedef unsigned int uintptr_t; #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 #define HAVE_STRTOD 1 @@ -122,28 +127,48 @@ typedef unsigned int uintptr_t; #define HAVE_STRNCMP 1 #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 #define HAVE_STRTOLL 1 #define HAVE_VSSCANF 1 -#define HAVE_COPYSIGN 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#endif +/* This function is available with at least the VC++ 2008 C runtime library */ +#if _MSC_VER >= 1400 +#define HAVE__FSEEKI64 1 +#endif #endif #if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) #define HAVE_M_PI 1 @@ -154,8 +179,8 @@ typedef unsigned int uintptr_t; #endif /* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_XAUDIO2 1 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 @@ -183,7 +208,7 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_RENDER_D3D 1 #endif #ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 +#define SDL_VIDEO_RENDER_D3D11 0 #endif /* Enable OpenGL support */ @@ -206,6 +231,8 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_OPENGL_EGL 1 #endif +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 /* Enable system power support */ #define SDL_POWER_WINDOWS 1 @@ -218,4 +245,4 @@ typedef unsigned int uintptr_t; #define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_windows_h */ +#endif /* SDL_config_windows_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_winrt.h b/Engine/lib/sdl/include/SDL_config_winrt.h index e392f773e..aac0e6014 100644 --- a/Engine/lib/sdl/include/SDL_config_winrt.h +++ b/Engine/lib/sdl/include/SDL_config_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_winrt_h -#define _SDL_config_winrt_h +#ifndef SDL_config_winrt_h_ +#define SDL_config_winrt_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -43,7 +44,7 @@ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) -#define HAVE_STDINT_H 1 +#define HAVE_STDINT_H 1 #elif defined(_MSC_VER) typedef signed __int8 int8_t; typedef unsigned __int8 uint8_t; @@ -97,13 +98,14 @@ typedef unsigned int uintptr_t; #define HAVE_XINPUT_H 1 #endif #define HAVE_LIBC 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -120,13 +122,13 @@ typedef unsigned int uintptr_t; #define HAVE_STRLEN 1 #define HAVE__STRREV 1 #define HAVE__STRUPR 1 -//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead +//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 //#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead -//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead -//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead +//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead +//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 //#define HAVE_STRTOLL 1 @@ -138,44 +140,58 @@ typedef unsigned int uintptr_t; #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 #define HAVE_VSNPRINTF 1 -//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead +//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead #define HAVE_M_PI 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE__COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -//#define HAVE_SCALBN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE__SCALB 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #define HAVE__FSEEKI64 1 /* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_XAUDIO2 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_WASAPI 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #define SDL_JOYSTICK_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 #else #define SDL_JOYSTICK_XINPUT 1 #define SDL_HAPTIC_XINPUT 1 #endif /* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 +#define SDL_LOADSO_WINDOWS 1 /* Enable various threading systems */ #if (NTDDI_VERSION >= NTDDI_WINBLUE) @@ -186,10 +202,10 @@ typedef unsigned int uintptr_t; #endif /* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 +#define SDL_TIMER_WINDOWS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_WINRT 1 +#define SDL_VIDEO_DRIVER_WINRT 1 #define SDL_VIDEO_DRIVER_DUMMY 1 /* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ @@ -208,7 +224,7 @@ typedef unsigned int uintptr_t; /* Enable assembly routines (Win64 doesn't have inline asm) */ #ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 +#define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_winrt_h */ +#endif /* SDL_config_winrt_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_wiz.h b/Engine/lib/sdl/include/SDL_config_wiz.h index e090a1a90..fe86d5ec3 100644 --- a/Engine/lib/sdl/include/SDL_config_wiz.h +++ b/Engine/lib/sdl/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_wiz_h_ +#define SDL_config_wiz_h_ +#define SDL_config_h_ /* This is a set of defines to configure the SDL features */ @@ -29,22 +30,24 @@ #define SDL_BYTEORDER 1234 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_ICONV_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MATH_H 1 +#define HAVE_MEMORY_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 + #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 @@ -61,7 +64,6 @@ #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_STRLEN 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -78,20 +80,40 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEIL 1 +#define HAVE_CEILF 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_SCALBNF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #define HAVE_SIGACTION 1 #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 @@ -117,4 +139,4 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_OPENGL_ES 1 -#endif /* _SDL_config_h */ +#endif /* SDL_config_wiz_h_ */ diff --git a/Engine/lib/sdl/include/SDL_copying.h b/Engine/lib/sdl/include/SDL_copying.h index 212da0ee0..15616ace5 100644 --- a/Engine/lib/sdl/include/SDL_copying.h +++ b/Engine/lib/sdl/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_cpuinfo.h b/Engine/lib/sdl/include/SDL_cpuinfo.h index d0ba47bf7..081270530 100644 --- a/Engine/lib/sdl/include/SDL_cpuinfo.h +++ b/Engine/lib/sdl/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,14 +25,20 @@ * CPU feature detection for SDL. */ -#ifndef _SDL_cpuinfo_h -#define _SDL_cpuinfo_h +#ifndef SDL_cpuinfo_h_ +#define SDL_cpuinfo_h_ #include "SDL_stdinc.h" /* Need to do this here because intrin.h has C++ code in it */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) +#ifdef __clang__ +/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */ +#undef __MMX__ +#undef __SSE__ +#undef __SSE2__ +#else #include #ifndef _WIN64 #define __MMX__ @@ -40,28 +46,37 @@ #endif #define __SSE__ #define __SSE2__ +#endif /* __clang__ */ #elif defined(__MINGW64_VERSION_MAJOR) #include #else #ifdef __ALTIVEC__ -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include #undef pixel +#undef bool #endif #endif -#ifdef __MMX__ -#include -#endif -#ifdef __3dNOW__ +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#ifdef __SSE__ +#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include #endif -#ifdef __SSE2__ +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include #endif +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) +#include #endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -144,6 +159,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +/** + * This function returns true if the CPU has NEON (ARM SIMD) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); + /** * This function returns the amount of RAM configured in the system, in MB. */ @@ -156,6 +176,6 @@ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); #endif #include "close_code.h" -#endif /* _SDL_cpuinfo_h */ +#endif /* SDL_cpuinfo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_egl.h b/Engine/lib/sdl/include/SDL_egl.h index bea2a6c0e..d65ed437c 100644 --- a/Engine/lib/sdl/include/SDL_egl.h +++ b/Engine/lib/sdl/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * This is a simple file to encapsulate the EGL API headers. */ -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__ANDROID__) #include #include @@ -132,7 +132,7 @@ *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C diff --git a/Engine/lib/sdl/include/SDL_endian.h b/Engine/lib/sdl/include/SDL_endian.h index 9100b103d..ed0bf5ba8 100644 --- a/Engine/lib/sdl/include/SDL_endian.h +++ b/Engine/lib/sdl/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for reading and writing endian-specific values */ -#ifndef _SDL_endian_h -#define _SDL_endian_h +#ifndef SDL_endian_h_ +#define SDL_endian_h_ #include "SDL_stdinc.h" @@ -96,6 +96,12 @@ SDL_Swap16(Uint16 x) __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint16 SDL_Swap16(Uint16); +#pragma aux SDL_Swap16 = \ + "xchg al, ah" \ + parm [ax] \ + modify [ax]; #else SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) @@ -136,6 +142,21 @@ SDL_Swap32(Uint32 x) __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint32 SDL_Swap32(Uint32); +#ifndef __SW_3 /* 486+ */ +#pragma aux SDL_Swap32 = \ + "bswap eax" \ + parm [eax] \ + modify [eax]; +#else /* 386-only */ +#pragma aux SDL_Swap32 = \ + "xchg al, ah" \ + "ror eax, 16" \ + "xchg al, ah" \ + parm [eax] \ + modify [eax]; +#endif #else SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) @@ -234,6 +255,6 @@ SDL_SwapFloat(float x) #endif #include "close_code.h" -#endif /* _SDL_endian_h */ +#endif /* SDL_endian_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_error.h b/Engine/lib/sdl/include/SDL_error.h index 2f3b4b500..c0e46298e 100644 --- a/Engine/lib/sdl/include/SDL_error.h +++ b/Engine/lib/sdl/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Simple error message routines for SDL. */ -#ifndef _SDL_error_h -#define _SDL_error_h +#ifndef SDL_error_h_ +#define SDL_error_h_ #include "SDL_stdinc.h" @@ -71,6 +71,6 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); #endif #include "close_code.h" -#endif /* _SDL_error_h */ +#endif /* SDL_error_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_events.h b/Engine/lib/sdl/include/SDL_events.h index edb89ef49..3d39e6a73 100644 --- a/Engine/lib/sdl/include/SDL_events.h +++ b/Engine/lib/sdl/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL event handling. */ -#ifndef _SDL_events_h -#define _SDL_events_h +#ifndef SDL_events_h_ +#define SDL_events_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -165,7 +165,7 @@ typedef enum typedef struct SDL_CommonEvent { Uint32 type; - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_CommonEvent; /** @@ -174,7 +174,7 @@ typedef struct SDL_CommonEvent typedef struct SDL_WindowEvent { Uint32 type; /**< ::SDL_WINDOWEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window */ Uint8 event; /**< ::SDL_WindowEventID */ Uint8 padding1; @@ -190,7 +190,7 @@ typedef struct SDL_WindowEvent typedef struct SDL_KeyboardEvent { Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 repeat; /**< Non-zero if this is a key repeat */ @@ -206,7 +206,7 @@ typedef struct SDL_KeyboardEvent typedef struct SDL_TextEditingEvent { Uint32 type; /**< ::SDL_TEXTEDITING */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ Sint32 start; /**< The start cursor of selected editing text */ @@ -221,7 +221,7 @@ typedef struct SDL_TextEditingEvent typedef struct SDL_TextInputEvent { Uint32 type; /**< ::SDL_TEXTINPUT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; @@ -232,7 +232,7 @@ typedef struct SDL_TextInputEvent typedef struct SDL_MouseMotionEvent { Uint32 type; /**< ::SDL_MOUSEMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 state; /**< The current button state */ @@ -248,7 +248,7 @@ typedef struct SDL_MouseMotionEvent typedef struct SDL_MouseButtonEvent { Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ @@ -265,7 +265,7 @@ typedef struct SDL_MouseButtonEvent typedef struct SDL_MouseWheelEvent { Uint32 type; /**< ::SDL_MOUSEWHEEL */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ @@ -279,7 +279,7 @@ typedef struct SDL_MouseWheelEvent typedef struct SDL_JoyAxisEvent { Uint32 type; /**< ::SDL_JOYAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The joystick axis index */ Uint8 padding1; @@ -295,7 +295,7 @@ typedef struct SDL_JoyAxisEvent typedef struct SDL_JoyBallEvent { Uint32 type; /**< ::SDL_JOYBALLMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 ball; /**< The joystick trackball index */ Uint8 padding1; @@ -311,7 +311,7 @@ typedef struct SDL_JoyBallEvent typedef struct SDL_JoyHatEvent { Uint32 type; /**< ::SDL_JOYHATMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 hat; /**< The joystick hat index */ Uint8 value; /**< The hat position value. @@ -331,7 +331,7 @@ typedef struct SDL_JoyHatEvent typedef struct SDL_JoyButtonEvent { Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The joystick button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -345,7 +345,7 @@ typedef struct SDL_JoyButtonEvent typedef struct SDL_JoyDeviceEvent { Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; @@ -356,7 +356,7 @@ typedef struct SDL_JoyDeviceEvent typedef struct SDL_ControllerAxisEvent { Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ Uint8 padding1; @@ -373,7 +373,7 @@ typedef struct SDL_ControllerAxisEvent typedef struct SDL_ControllerButtonEvent { Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -388,7 +388,7 @@ typedef struct SDL_ControllerButtonEvent typedef struct SDL_ControllerDeviceEvent { Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; @@ -398,7 +398,7 @@ typedef struct SDL_ControllerDeviceEvent typedef struct SDL_AudioDeviceEvent { Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ Uint8 padding1; @@ -413,7 +413,7 @@ typedef struct SDL_AudioDeviceEvent typedef struct SDL_TouchFingerEvent { Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_FingerID fingerId; float x; /**< Normalized in the range 0...1 */ @@ -430,8 +430,8 @@ typedef struct SDL_TouchFingerEvent typedef struct SDL_MultiGestureEvent { Uint32 type; /**< ::SDL_MULTIGESTURE */ - Uint32 timestamp; - SDL_TouchID touchId; /**< The touch device index */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_TouchID touchId; /**< The touch device id */ float dTheta; float dDist; float x; @@ -447,7 +447,7 @@ typedef struct SDL_MultiGestureEvent typedef struct SDL_DollarGestureEvent { Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_GestureID gestureId; Uint32 numFingers; @@ -465,7 +465,7 @@ typedef struct SDL_DollarGestureEvent typedef struct SDL_DropEvent { Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ Uint32 windowID; /**< The window that was dropped on, if any */ } SDL_DropEvent; @@ -477,7 +477,7 @@ typedef struct SDL_DropEvent typedef struct SDL_QuitEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_QuitEvent; /** @@ -486,7 +486,7 @@ typedef struct SDL_QuitEvent typedef struct SDL_OSEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_OSEvent; /** @@ -495,7 +495,7 @@ typedef struct SDL_OSEvent typedef struct SDL_UserEvent { Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window if any */ Sint32 code; /**< User defined event code */ void *data1; /**< User defined data pointer */ @@ -515,7 +515,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg; typedef struct SDL_SysWMEvent { Uint32 type; /**< ::SDL_SYSWMEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ } SDL_SysWMEvent; @@ -724,7 +724,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, /** * This function allows you to set the state of processing certain events. * - If \c state is set to ::SDL_IGNORE, that event will be automatically - * dropped from the event queue and will not event be filtered. + * dropped from the event queue and will not be filtered. * - If \c state is set to ::SDL_ENABLE, that event will be processed * normally. * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the @@ -749,6 +749,6 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); #endif #include "close_code.h" -#endif /* _SDL_events_h */ +#endif /* SDL_events_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_filesystem.h b/Engine/lib/sdl/include/SDL_filesystem.h index 02999ed27..fa6a1fa6e 100644 --- a/Engine/lib/sdl/include/SDL_filesystem.h +++ b/Engine/lib/sdl/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * \brief Include file for filesystem SDL API functions */ -#ifndef _SDL_filesystem_h -#define _SDL_filesystem_h +#ifndef SDL_filesystem_h_ +#define SDL_filesystem_h_ #include "SDL_stdinc.h" @@ -131,6 +131,6 @@ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); #endif #include "close_code.h" -#endif /* _SDL_filesystem_h */ +#endif /* SDL_filesystem_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_gamecontroller.h b/Engine/lib/sdl/include/SDL_gamecontroller.h index e67fd9fd0..2e024be65 100644 --- a/Engine/lib/sdl/include/SDL_gamecontroller.h +++ b/Engine/lib/sdl/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL game controller event handling */ -#ifndef _SDL_gamecontroller_h -#define _SDL_gamecontroller_h +#ifndef SDL_gamecontroller_h_ +#define SDL_gamecontroller_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -51,7 +51,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The gamecontroller structure used to identify an SDL game controller */ +/** + * The gamecontroller structure used to identify an SDL game controller + */ struct _SDL_GameController; typedef struct _SDL_GameController SDL_GameController; @@ -87,8 +89,8 @@ typedef struct SDL_GameControllerButtonBind * To count the number of game controllers in the system for the following: * int nJoysticks = SDL_NumJoysticks(); * int nGameControllers = 0; - * for ( int i = 0; i < nJoysticks; i++ ) { - * if ( SDL_IsGameController(i) ) { + * for (int i = 0; i < nJoysticks; i++) { + * if (SDL_IsGameController(i)) { * nGameControllers++; * } * } @@ -105,7 +107,7 @@ typedef struct SDL_GameControllerButtonBind * Buttons can be used as a controller axis and vice versa. * * This string shows an example of a valid mapping for a controller - * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", * */ @@ -117,7 +119,7 @@ typedef struct SDL_GameControllerButtonBind * * \return number of mappings added, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); /** * Load a set of mappings from a file, filtered by the current SDL_GetPlatform() @@ -131,28 +133,41 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, * * \return 1 if mapping is added, 0 if updated, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); + +/** + * Get the number of mappings installed + * + * \return the number of mappings + */ +extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); + +/** + * Get the mapping at a particular index. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range. + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); /** * Get a mapping string for a GUID * * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); /** * Get a mapping string for an open GameController * * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller); /** * Is the joystick on this index supported by the game controller interface? */ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); - /** * Get the implementation dependent name of a game controller. * This can be called before any controllers are opened. @@ -181,6 +196,24 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); +/** + * Get the USB vendor ID of an opened controller, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller); + +/** + * Get the USB product ID of an opened controller, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller); + +/** + * Get the product version of an opened controller, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller); + /** * Returns SDL_TRUE if the controller has been opened and currently connected, * or SDL_FALSE if it has not. @@ -214,6 +247,12 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); /** * The list of axes available from a controller + * + * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX, + * and are centered within ~8000 of zero, though advanced UI will allow users to set + * or autodetect the dead zone, which varies between controllers. + * + * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. */ typedef enum { @@ -318,6 +357,6 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon #endif #include "close_code.h" -#endif /* _SDL_gamecontroller_h */ +#endif /* SDL_gamecontroller_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_gesture.h b/Engine/lib/sdl/include/SDL_gesture.h index 3c29ca7ac..b223d80d4 100644 --- a/Engine/lib/sdl/include/SDL_gesture.h +++ b/Engine/lib/sdl/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL gesture event handling. */ -#ifndef _SDL_gesture_h -#define _SDL_gesture_h +#ifndef SDL_gesture_h_ +#define SDL_gesture_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -82,6 +82,6 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo #endif #include "close_code.h" -#endif /* _SDL_gesture_h */ +#endif /* SDL_gesture_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_haptic.h b/Engine/lib/sdl/include/SDL_haptic.h index 9421c8f17..e3a2bca5f 100644 --- a/Engine/lib/sdl/include/SDL_haptic.h +++ b/Engine/lib/sdl/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,12 +22,12 @@ /** * \file SDL_haptic.h * - * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) + * \brief The SDL haptic subsystem allows you to control haptic (force feedback) * devices. * * The basic usage is as follows: - * - Initialize the Subsystem (::SDL_INIT_HAPTIC). - * - Open a Haptic Device. + * - Initialize the subsystem (::SDL_INIT_HAPTIC). + * - Open a haptic device. * - SDL_HapticOpen() to open from index. * - SDL_HapticOpenFromJoystick() to open from an existing joystick. * - Create an effect (::SDL_HapticEffect). @@ -104,8 +104,8 @@ * \endcode */ -#ifndef _SDL_haptic_h -#define _SDL_haptic_h +#ifndef SDL_haptic_h_ +#define SDL_haptic_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -282,7 +282,7 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Device can be queried for effect status. * - * Device can be queried for effect status. + * Device supports querying effect status. * * \sa SDL_HapticGetEffectStatus */ @@ -291,6 +291,8 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Device can be paused. * + * Devices supports being paused. + * * \sa SDL_HapticPause * \sa SDL_HapticUnpause */ @@ -444,7 +446,7 @@ typedef struct SDL_HapticDirection /** * \brief A structure containing a template for a Constant effect. * - * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. + * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect. * * A constant effect applies a constant force in the specified direction * to the joystick. @@ -676,6 +678,8 @@ typedef struct SDL_HapticLeftRight /** * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. * + * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect. + * * A custom force feedback effect is much like a periodic effect, where the * application can define its exact shape. You will have to allocate the * data yourself. Data should consist of channels * samples Uint16 samples. @@ -804,7 +808,7 @@ typedef union SDL_HapticEffect extern DECLSPEC int SDLCALL SDL_NumHaptics(void); /** - * \brief Get the implementation dependent name of a Haptic device. + * \brief Get the implementation dependent name of a haptic device. * * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. @@ -817,9 +821,9 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void); extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); /** - * \brief Opens a Haptic device for usage. + * \brief Opens a haptic device for use. * - * The index passed as an argument refers to the N'th Haptic device on this + * The index passed as an argument refers to the N'th haptic device on this * system. * * When opening a haptic device, its gain will be set to maximum and @@ -885,15 +889,15 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); * \brief Checks to see if a joystick has haptic features. * * \param joystick Joystick to test for haptic capabilities. - * \return 1 if the joystick is haptic, 0 if it isn't - * or -1 if an error ocurred. + * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't + * or -1 if an error occurred. * * \sa SDL_HapticOpenFromJoystick */ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); /** - * \brief Opens a Haptic device for usage from a Joystick device. + * \brief Opens a haptic device for use from a joystick device. * * You must still close the haptic device separately. It will not be closed * with the joystick. @@ -913,7 +917,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * joystick); /** - * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). + * \brief Closes a haptic device previously opened with SDL_HapticOpen(). * * \param haptic Haptic device to close. */ @@ -957,7 +961,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); * Example: * \code * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { - * printf("We have constant haptic effect!"); + * printf("We have constant haptic effect!\n"); * } * \endcode * @@ -996,7 +1000,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, * * \param haptic Haptic device to create the effect on. * \param effect Properties of the effect to create. - * \return The id of the effect on success or -1 on error. + * \return The identifier of the effect on success or -1 on error. * * \sa SDL_HapticUpdateEffect * \sa SDL_HapticRunEffect @@ -1008,13 +1012,13 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, /** * \brief Updates the properties of an effect. * - * Can be used dynamically, although behaviour when dynamically changing + * Can be used dynamically, although behavior when dynamically changing * direction may be strange. Specifically the effect may reupload itself * and start playing from the start. You cannot change the type either when * running SDL_HapticUpdateEffect(). * * \param haptic Haptic device that has the effect. - * \param effect Effect to update. + * \param effect Identifier of the effect to update. * \param data New effect properties to use. * \return 0 on success or -1 on error. * @@ -1218,6 +1222,6 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); #endif #include "close_code.h" -#endif /* _SDL_haptic_h */ +#endif /* SDL_haptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_hints.h b/Engine/lib/sdl/include/SDL_hints.h index dd1546431..3834640f2 100644 --- a/Engine/lib/sdl/include/SDL_hints.h +++ b/Engine/lib/sdl/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,8 +36,8 @@ * to how they would like the library to work. */ -#ifndef _SDL_hints_h -#define _SDL_hints_h +#ifndef SDL_hints_h_ +#define SDL_hints_h_ #include "SDL_stdinc.h" @@ -76,6 +76,7 @@ extern "C" { * "opengl" * "opengles2" * "opengles" + * "metal" * "software" * * The default varies by platform, but it's the first one in the list that @@ -118,6 +119,17 @@ extern "C" { */ #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" +/** + * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. + * + * This variable can be set to the following values: + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen + * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen + * + * By default letterbox is used + */ +#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE" + /** * \brief A variable controlling the scaling quality * @@ -199,6 +211,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -210,6 +234,12 @@ extern "C" { */ #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" +/** + * \brief A variable to specify custom icon resource id from RC file on Windows platform + */ +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" + /** * \brief A variable controlling whether the windows message loop is processed by SDL * @@ -232,6 +262,16 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode + */ +#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" + +/** + * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode + */ +#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" + /** * \brief A variable controlling whether relative mouse mode is implemented using mouse warping * @@ -254,6 +294,17 @@ extern "C" { */ #define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" +/** + * \brief A variable controlling whether touch events should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Touch events will not generate mouse events + * "1" - Touch events will generate mouse events + * + * By default SDL will generate mouse events for touch events + */ +#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" + /** * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. * @@ -317,16 +368,35 @@ extern "C" { #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" /** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. * * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + +/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device. + * + * This variable can be set to the following values: + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices @@ -337,7 +407,6 @@ extern "C" { */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" - /** * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. * @@ -347,9 +416,8 @@ extern "C" { */ #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" - /** - * \brief A variable that lets you manually hint extra gamecontroller db entries + * \brief A variable that lets you manually hint extra gamecontroller db entries. * * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h * @@ -358,6 +426,31 @@ extern "C" { */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" +/** + * \brief A variable containing a list of devices to skip when scanning for game controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" + +/** + * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" /** * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. @@ -372,7 +465,6 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" - /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. * This is a debugging aid for developers and not expected to be used by end users. The default is "1" @@ -383,7 +475,6 @@ extern "C" { */ #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" - /** * \brief A variable that controls the timer resolution, in milliseconds. * @@ -401,6 +492,33 @@ extern "C" { #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" +/** + * \brief A variable describing the content orientation on QtWayland-based platforms. + * + * On QtWayland platforms, windows are rotated client-side to allow for custom + * transitions. In order to correctly position overlays (e.g. volume bar) and + * gestures (e.g. events view, close/minimize gestures), the system needs to + * know in which orientation the application is currently drawing its contents. + * + * This does not cause the window to be rotated or resized, the application + * needs to take care of drawing the content in the right orientation (the + * framebuffer is always in portrait mode). + * + * This variable can be one of the following values: + * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + */ +#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" + +/** + * \brief Flags to set on QtWayland windows to integrate with the native window manager. + * + * On QtWayland platforms, this hint controls the flags to set on the windows. + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. + * + * This variable is a space-separated list of the following values (empty = no flags): + * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" + */ +#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS" /** * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size @@ -634,6 +752,18 @@ extern "C" { */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -667,7 +797,7 @@ extern "C" { * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" /** * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. @@ -689,13 +819,18 @@ extern "C" { #define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" /** - * \brief Tell SDL not to name threads on Windows. + * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception. + * The 0x406D1388 Exception is a trick used to inform Visual Studio of a + * thread's name, but it tends to cause problems with other debuggers, + * and the .NET runtime. Note that SDL 2.0.6 and later will still use + * the (safer) SetThreadDescription API, introduced in the Windows 10 + * Creators Update, if available. * * The variable can be set to the following values: * "0" - SDL will raise the 0x406D1388 Exception to name threads. - * This is the default behavior of SDL <= 2.0.4. (default) - * "1" - SDL will not raise this exception, and threads will be unnamed. - * For .NET languages this is required when running under a debugger. + * This is the default behavior of SDL <= 2.0.4. + * "1" - SDL will not raise this exception, and threads will be unnamed. (default) + * This is necessary with .NET languages or debuggers that aren't Visual Studio. */ #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" @@ -707,6 +842,94 @@ extern "C" { */ #define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + +/** + * \brief A variable controlling what driver to use for OpenGL ES contexts. + * + * On some platforms, currently Windows and X11, OpenGL drivers may support + * creating contexts with an OpenGL ES profile. By default SDL uses these + * profiles, when available, otherwise it attempts to load an OpenGL ES + * library, e.g. that provided by the ANGLE project. This variable controls + * whether SDL follows this default behaviour or will always load an + * OpenGL ES library. + * + * Circumstances where this is useful include + * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, + * or emulator, e.g. those from ARM, Imagination or Qualcomm. + * - Resolving OpenGL ES function addresses at link time by linking with + * the OpenGL ES library instead of querying them at run time with + * SDL_GL_GetProcAddress(). + * + * Caution: for an application to work with the default behaviour across + * different OpenGL drivers it must query the OpenGL ES function + * addresses at run time using SDL_GL_GetProcAddress(). + * + * This variable is ignored on most platforms because OpenGL ES is native + * or not supported. + * + * This variable can be set to the following values: + * "0" - Use ES profile of OpenGL, if available. (Default when not set.) + * "1" - Load OpenGL ES library using the default library names. + * + */ +#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" + +/** + * \brief A variable controlling speed/quality tradeoff of audio resampling. + * + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) + * to handle audio resampling. There are different resampling modes available + * that produce different levels of quality, using more CPU. + * + * If this hint isn't specified to a valid setting, or libsamplerate isn't + * available, SDL will use the default, internal resampling algorithm. + * + * Note that this is currently only applicable to resampling audio that is + * being written to a device for playback or audio being read from a device + * for capture. SDL_AudioCVT always uses the default resampler (although this + * might change for SDL 2.1). + * + * This hint is currently only checked at audio subsystem initialization. + * + * This variable can be set to the following values: + * + * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) + * "1" or "fast" - Use fast, slightly higher quality resampling, if available + * "2" or "medium" - Use medium quality resampling, if available + * "3" or "best" - Use high quality resampling, if available + */ +#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE" + +/** + * \brief A variable controlling the audio category on iOS and Mac OS X + * + * This variable can be set to the following values: + * + * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) + * "playback" - Use the AVAudioSessionCategoryPlayback category + * + * For more information, see Apple's documentation: + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html + */ +#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" + /** * \brief An enumeration of hint priorities */ @@ -753,6 +976,11 @@ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); */ extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); +/** + * \brief type definition of the hint callback function. + */ +typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); + /** * \brief Add a function to watch a particular hint * @@ -760,7 +988,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool d * \param callback The function to call when the hint value changes * \param userdata A pointer to pass to the callback function */ -typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); @@ -790,6 +1017,6 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void); #endif #include "close_code.h" -#endif /* _SDL_hints_h */ +#endif /* SDL_hints_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_joystick.h b/Engine/lib/sdl/include/SDL_joystick.h index f5dbc9487..f67772d71 100644 --- a/Engine/lib/sdl/include/SDL_joystick.h +++ b/Engine/lib/sdl/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,8 +36,8 @@ * */ -#ifndef _SDL_joystick_h -#define _SDL_joystick_h +#ifndef SDL_joystick_h_ +#define SDL_joystick_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -60,7 +60,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The joystick structure used to identify an SDL joystick */ +/** + * The joystick structure used to identify an SDL joystick + */ struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; @@ -69,8 +71,29 @@ typedef struct { Uint8 data[16]; } SDL_JoystickGUID; +/** + * This is a unique ID for a joystick for the time it is connected to the system, + * and is never reused for the lifetime of the application. If the joystick is + * disconnected and reconnected, it will get a new ID. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ typedef Sint32 SDL_JoystickID; +typedef enum +{ + SDL_JOYSTICK_TYPE_UNKNOWN, + SDL_JOYSTICK_TYPE_GAMECONTROLLER, + SDL_JOYSTICK_TYPE_WHEEL, + SDL_JOYSTICK_TYPE_ARCADE_STICK, + SDL_JOYSTICK_TYPE_FLIGHT_STICK, + SDL_JOYSTICK_TYPE_DANCE_PAD, + SDL_JOYSTICK_TYPE_GUITAR, + SDL_JOYSTICK_TYPE_DRUM_KIT, + SDL_JOYSTICK_TYPE_ARCADE_PAD, + SDL_JOYSTICK_TYPE_THROTTLE +} SDL_JoystickType; + typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, @@ -83,6 +106,20 @@ typedef enum } SDL_JoystickPowerLevel; /* Function prototypes */ + +/** + * Locking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + */ +extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); +extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); + /** * Count the number of joysticks attached to the system right now */ @@ -95,6 +132,46 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); +/** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); + +/** + * Get the USB vendor ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); + +/** + * Get the USB product ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); + +/** + * Get the product version of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); + +/** + * Get the type of a joystick, if available. + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index); + +/** + * Get the instance ID of a joystick. + * This can be called before any joysticks are opened. + * If the index is out of range, this function will return -1. + */ +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index); + /** * Open a joystick for use. * The index passed as an argument refers to the N'th joystick on the system. @@ -117,16 +194,34 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); -/** - * Return the GUID for the joystick at this index - */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); - /** * Return the GUID for this opened joystick */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); +/** + * Get the USB vendor ID of an opened joystick, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick); + +/** + * Get the USB product ID of an opened joystick, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick); + +/** + * Get the product version of an opened joystick, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick); + +/** + * Get the type of an opened joystick. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick); + /** * Return a string representation for this guid. pszGUID must point to at least 33 bytes * (32 for the string plus a NULL terminator). @@ -134,7 +229,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joys extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); /** - * convert a string into a joystick formatted guid + * Convert a string into a joystick guid */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); @@ -190,6 +285,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); +#define SDL_JOYSTICK_AXIS_MAX 32767 +#define SDL_JOYSTICK_AXIS_MIN -32768 /** * Get the current state of an axis control on a joystick. * @@ -200,6 +297,18 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis); +/** + * Get the initial state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + * + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, + int axis, Sint16 *state); + /** * \name Hat positions */ @@ -268,6 +377,6 @@ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL #endif #include "close_code.h" -#endif /* _SDL_joystick_h */ +#endif /* SDL_joystick_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_keyboard.h b/Engine/lib/sdl/include/SDL_keyboard.h index f80b6d2de..874823171 100644 --- a/Engine/lib/sdl/include/SDL_keyboard.h +++ b/Engine/lib/sdl/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL keyboard event handling */ -#ifndef _SDL_keyboard_h -#define _SDL_keyboard_h +#ifndef SDL_keyboard_h_ +#define SDL_keyboard_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -212,6 +212,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); #endif #include "close_code.h" -#endif /* _SDL_keyboard_h */ +#endif /* SDL_keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_keycode.h b/Engine/lib/sdl/include/SDL_keycode.h index 7be963571..d7d5b1dbc 100644 --- a/Engine/lib/sdl/include/SDL_keycode.h +++ b/Engine/lib/sdl/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines constants which identify keyboard keys and modifiers. */ -#ifndef _SDL_keycode_h -#define _SDL_keycode_h +#ifndef SDL_keycode_h_ +#define SDL_keycode_h_ #include "SDL_stdinc.h" #include "SDL_scancode.h" @@ -38,6 +38,9 @@ * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or * an SDLK_* constant for those keys that do not generate characters. + * + * A special exception is the number keys at the top of the keyboard which + * always map to SDLK_0...SDLK_9, regardless of layout. */ typedef Sint32 SDL_Keycode; @@ -308,7 +311,12 @@ enum SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), - SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) + SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP), + SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1), + SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), + + SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) }; /** @@ -336,6 +344,6 @@ typedef enum #define KMOD_ALT (KMOD_LALT|KMOD_RALT) #define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) -#endif /* _SDL_keycode_h */ +#endif /* SDL_keycode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_loadso.h b/Engine/lib/sdl/include/SDL_loadso.h index 3d540bd7d..da56fb452 100644 --- a/Engine/lib/sdl/include/SDL_loadso.h +++ b/Engine/lib/sdl/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,8 +38,8 @@ * the results you expect. :) */ -#ifndef _SDL_loadso_h -#define _SDL_loadso_h +#ifndef SDL_loadso_h_ +#define SDL_loadso_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -76,6 +76,6 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); #endif #include "close_code.h" -#endif /* _SDL_loadso_h */ +#endif /* SDL_loadso_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_log.h b/Engine/lib/sdl/include/SDL_log.h index 09be1104d..e12b65886 100644 --- a/Engine/lib/sdl/include/SDL_log.h +++ b/Engine/lib/sdl/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,8 +34,8 @@ * Others: standard error output (stderr) */ -#ifndef _SDL_log_h -#define _SDL_log_h +#ifndef SDL_log_h_ +#define SDL_log_h_ #include "SDL_stdinc.h" @@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, /** * \brief The prototype for the log output function */ -typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); /** * \brief Get the current log output function. @@ -206,6 +206,6 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call #endif #include "close_code.h" -#endif /* _SDL_log_h */ +#endif /* SDL_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_main.h b/Engine/lib/sdl/include/SDL_main.h index 67afea5e7..98558217f 100644 --- a/Engine/lib/sdl/include/SDL_main.h +++ b/Engine/lib/sdl/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_main_h -#define _SDL_main_h +#ifndef SDL_main_h_ +#define SDL_main_h_ #include "SDL_stdinc.h" @@ -63,10 +63,13 @@ /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. - See README-android.md for more details on extending that class. + See docs/README-android.md for more details on extending that class. */ #define SDL_MAIN_NEEDED +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + #elif defined(__NACL__) /* On NACL we use ppapi_simple to set up the application helper code, then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before @@ -85,6 +88,10 @@ #define C_LINKAGE #endif /* __cplusplus */ +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + /** * \file SDL_main.h * @@ -107,7 +114,7 @@ /** * The prototype for the application's main() function */ -extern C_LINKAGE int SDL_main(int argc, char *argv[]); +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); #include "begin_code.h" @@ -156,6 +163,6 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), v #endif #include "close_code.h" -#endif /* _SDL_main_h */ +#endif /* SDL_main_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_messagebox.h b/Engine/lib/sdl/include/SDL_messagebox.h index ec370dbbe..b7be59d88 100644 --- a/Engine/lib/sdl/include/SDL_messagebox.h +++ b/Engine/lib/sdl/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_messagebox_h -#define _SDL_messagebox_h +#ifndef SDL_messagebox_h_ +#define SDL_messagebox_h_ #include "SDL_stdinc.h" #include "SDL_video.h" /* For SDL_Window */ @@ -139,6 +139,6 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t #endif #include "close_code.h" -#endif /* _SDL_messagebox_h */ +#endif /* SDL_messagebox_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_mouse.h b/Engine/lib/sdl/include/SDL_mouse.h index 46f046d0c..d3c9f6156 100644 --- a/Engine/lib/sdl/include/SDL_mouse.h +++ b/Engine/lib/sdl/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL mouse event handling. */ -#ifndef _SDL_mouse_h -#define _SDL_mouse_h +#ifndef SDL_mouse_h_ +#define SDL_mouse_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -38,7 +38,7 @@ extern "C" { #endif -typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ +typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ /** * \brief Cursor types for SDL_CreateSystemCursor(). @@ -297,6 +297,6 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); #endif #include "close_code.h" -#endif /* _SDL_mouse_h */ +#endif /* SDL_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_mutex.h b/Engine/lib/sdl/include/SDL_mutex.h index b7e39734e..ba4247ced 100644 --- a/Engine/lib/sdl/include/SDL_mutex.h +++ b/Engine/lib/sdl/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_mutex_h -#define _SDL_mutex_h +#ifndef SDL_mutex_h_ +#define SDL_mutex_h_ /** * \file SDL_mutex.h @@ -246,6 +246,6 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, #endif #include "close_code.h" -#endif /* _SDL_mutex_h */ +#endif /* SDL_mutex_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_name.h b/Engine/lib/sdl/include/SDL_name.h index 06cd4a5e2..ecd863f4c 100644 --- a/Engine/lib/sdl/include/SDL_name.h +++ b/Engine/lib/sdl/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDLname_h_ -#define _SDLname_h_ +#ifndef SDLname_h_ +#define SDLname_h_ #if defined(__STDC__) || defined(__cplusplus) #define NeedFunctionPrototypes 1 @@ -28,6 +28,6 @@ #define SDL_NAME(X) SDL_##X -#endif /* _SDLname_h_ */ +#endif /* SDLname_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_opengl.h b/Engine/lib/sdl/include/SDL_opengl.h index 780919bc4..253d9c93a 100644 --- a/Engine/lib/sdl/include/SDL_opengl.h +++ b/Engine/lib/sdl/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,8 +32,8 @@ * version included in SDL_opengl.h. */ -#ifndef _SDL_opengl_h -#define _SDL_opengl_h +#ifndef SDL_opengl_h_ +#define SDL_opengl_h_ #include "SDL_config.h" @@ -97,6 +97,13 @@ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall +#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ +# define GLAPI extern +# define GLAPIENTRY _System +# define APIENTRY _System +# if defined(__GNUC__) && !defined(_System) +# define _System +# endif #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY @@ -2171,6 +2178,6 @@ typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum t #endif /* !__IPHONEOS__ */ -#endif /* _SDL_opengl_h */ +#endif /* SDL_opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_opengles.h b/Engine/lib/sdl/include/SDL_opengles.h index 15abee796..18dd984b3 100644 --- a/Engine/lib/sdl/include/SDL_opengles.h +++ b/Engine/lib/sdl/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_opengles2.h b/Engine/lib/sdl/include/SDL_opengles2.h index c961f0f7d..6ccecf216 100644 --- a/Engine/lib/sdl/include/SDL_opengles2.h +++ b/Engine/lib/sdl/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_pixels.h b/Engine/lib/sdl/include/SDL_pixels.h index cf6a33f08..0b4364b18 100644 --- a/Engine/lib/sdl/include/SDL_pixels.h +++ b/Engine/lib/sdl/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header for the enumerated pixel format definitions. */ -#ifndef _SDL_pixels_h -#define _SDL_pixels_h +#ifndef SDL_pixels_h_ +#define SDL_pixels_h_ #include "SDL_stdinc.h" #include "SDL_endian.h" @@ -287,7 +287,9 @@ enum SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ - SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1') + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') }; typedef struct SDL_Color @@ -463,6 +465,6 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); #endif #include "close_code.h" -#endif /* _SDL_pixels_h */ +#endif /* SDL_pixels_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_platform.h b/Engine/lib/sdl/include/SDL_platform.h index 03cf17061..7dea4ce94 100644 --- a/Engine/lib/sdl/include/SDL_platform.h +++ b/Engine/lib/sdl/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Try to get a standard set of platform defines. */ -#ifndef _SDL_platform_h -#define _SDL_platform_h +#ifndef SDL_platform_h_ +#define SDL_platform_h_ #if defined(_AIX) #undef __AIX__ @@ -97,7 +97,7 @@ #undef __OPENBSD__ #define __OPENBSD__ 1 #endif -#if defined(__OS2__) +#if defined(__OS2__) || defined(__EMX__) #undef __OS2__ #define __OS2__ 1 #endif @@ -120,21 +120,34 @@ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) /* Try to find out if we're compiling for WinRT or non-WinRT */ -/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ +#if defined(_MSC_VER) && defined(__has_include) +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +#if HAVE_WINAPIFAMILY_H #include -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -#undef __WINDOWS__ -#define __WINDOWS__ 1 -/* See if we're compiling for WinRT: */ -#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) +#else +#define WINAPI_FAMILY_WINRT 0 +#endif /* HAVE_WINAPIFAMILY_H */ + +#if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 -#endif #else #undef __WINDOWS__ -#define __WINDOWS__ 1 -#endif /* _MSC_VER < 1700 */ +#define __WINDOWS__ 1 +#endif #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ #if defined(__WINDOWS__) @@ -180,6 +193,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); #endif #include "close_code.h" -#endif /* _SDL_platform_h */ +#endif /* SDL_platform_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_power.h b/Engine/lib/sdl/include/SDL_power.h index 24c050114..a4fe8a935 100644 --- a/Engine/lib/sdl/include/SDL_power.h +++ b/Engine/lib/sdl/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_power_h -#define _SDL_power_h +#ifndef SDL_power_h_ +#define SDL_power_h_ /** * \file SDL_power.h @@ -70,6 +70,6 @@ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); #endif #include "close_code.h" -#endif /* _SDL_power_h */ +#endif /* SDL_power_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_quit.h b/Engine/lib/sdl/include/SDL_quit.h index cc06f28d8..fea56a8d8 100644 --- a/Engine/lib/sdl/include/SDL_quit.h +++ b/Engine/lib/sdl/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL quit event handling. */ -#ifndef _SDL_quit_h -#define _SDL_quit_h +#ifndef SDL_quit_h_ +#define SDL_quit_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -55,4 +55,4 @@ #define SDL_QuitRequested() \ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) -#endif /* _SDL_quit_h */ +#endif /* SDL_quit_h_ */ diff --git a/Engine/lib/sdl/include/SDL_rect.h b/Engine/lib/sdl/include/SDL_rect.h index bbcb9a3b8..543bb6186 100644 --- a/Engine/lib/sdl/include/SDL_rect.h +++ b/Engine/lib/sdl/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL_rect definition and management functions. */ -#ifndef _SDL_rect_h -#define _SDL_rect_h +#ifndef SDL_rect_h_ +#define SDL_rect_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -143,6 +143,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * #endif #include "close_code.h" -#endif /* _SDL_rect_h */ +#endif /* SDL_rect_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_render.h b/Engine/lib/sdl/include/SDL_render.h index 60c87b66a..d33619297 100644 --- a/Engine/lib/sdl/include/SDL_render.h +++ b/Engine/lib/sdl/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,8 +45,8 @@ * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 */ -#ifndef _SDL_render_h -#define _SDL_render_h +#ifndef SDL_render_h_ +#define SDL_render_h_ #include "SDL_stdinc.h" #include "SDL_rect.h" @@ -233,6 +233,8 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, * active, the format was unsupported, or the width or height were out * of range. * + * \note The contents of the texture are not defined at creation. + * * \sa SDL_QueryTexture() * \sa SDL_UpdateTexture() * \sa SDL_DestroyTexture() @@ -370,9 +372,12 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. - * \param pixels The raw pixel data. + * \param pixels The raw pixel data in the format of the texture. * \param pitch The number of bytes in a row of pixel data, including padding between lines. * + * The pixel data must be in the format of the texture. The pixel format can be + * queried with SDL_QueryTexture. + * * \return 0 on success, or -1 if the texture is not valid. * * \note This is a fairly slow function. @@ -816,7 +821,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. - * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect + * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * @@ -893,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -900,6 +926,6 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); #endif #include "close_code.h" -#endif /* _SDL_render_h */ +#endif /* SDL_render_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_revision.h b/Engine/lib/sdl/include/SDL_revision.h index 341dc5cce..dbe9b97d5 100644 --- a/Engine/lib/sdl/include/SDL_revision.h +++ b/Engine/lib/sdl/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-10556:007dfe83abf8" -#define SDL_REVISION_NUMBER 10556 +#define SDL_REVISION "hg-11914:f1084c419f33" +#define SDL_REVISION_NUMBER 11914 diff --git a/Engine/lib/sdl/include/SDL_rwops.h b/Engine/lib/sdl/include/SDL_rwops.h index 1ad3ac406..0960699d4 100644 --- a/Engine/lib/sdl/include/SDL_rwops.h +++ b/Engine/lib/sdl/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ * data streams. It can easily be extended to files, memory, etc. */ -#ifndef _SDL_rwops_h -#define _SDL_rwops_h +#ifndef SDL_rwops_h_ +#define SDL_rwops_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -39,12 +39,12 @@ extern "C" { #endif /* RWops Types */ -#define SDL_RWOPS_UNKNOWN 0U /* Unknown stream type */ -#define SDL_RWOPS_WINFILE 1U /* Win32 file */ -#define SDL_RWOPS_STDFILE 2U /* Stdio file */ -#define SDL_RWOPS_JNIFILE 3U /* Android asset */ -#define SDL_RWOPS_MEMORY 4U /* Memory stream */ -#define SDL_RWOPS_MEMORY_RO 5U /* Read-Only memory stream */ +#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */ +#define SDL_RWOPS_WINFILE 1U /**< Win32 file */ +#define SDL_RWOPS_STDFILE 2U /**< Stdio file */ +#define SDL_RWOPS_JNIFILE 3U /**< Android asset */ +#define SDL_RWOPS_MEMORY 4U /**< Memory stream */ +#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ /** * This is the read/write operation structure -- very basic. @@ -190,6 +190,29 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); /* @} *//* Read/write macros */ +/** + * Load all the data from an SDL data stream. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + */ +extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, + int freesrc); + +/** + * Load an entire file. + * + * Convenience macro. + */ +#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1) + /** * \name Read endian functions * @@ -226,6 +249,6 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); #endif #include "close_code.h" -#endif /* _SDL_rwops_h */ +#endif /* SDL_rwops_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_scancode.h b/Engine/lib/sdl/include/SDL_scancode.h index 0af1dd59f..63871aa3b 100644 --- a/Engine/lib/sdl/include/SDL_scancode.h +++ b/Engine/lib/sdl/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines keyboard scancodes. */ -#ifndef _SDL_scancode_h -#define _SDL_scancode_h +#ifndef SDL_scancode_h_ +#define SDL_scancode_h_ #include "SDL_stdinc.h" @@ -38,7 +38,7 @@ * SDL_Event structure. * * The values in this enumeration are based on the USB usage page standard: - * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf + * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf */ typedef enum { @@ -390,12 +390,24 @@ typedef enum /* @} *//* Walther keys */ + /** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ + + SDL_SCANCODE_AUDIOREWIND = 285, + SDL_SCANCODE_AUDIOFASTFORWARD = 286, + + /* @} *//* Usage page 0x0C (additional media keys) */ + /* Add any other keys here. */ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ } SDL_Scancode; -#endif /* _SDL_scancode_h */ +#endif /* SDL_scancode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_shape.h b/Engine/lib/sdl/include/SDL_shape.h index db10a8f01..40a6baaae 100644 --- a/Engine/lib/sdl/include/SDL_shape.h +++ b/Engine/lib/sdl/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_shape_h -#define _SDL_shape_h +#ifndef SDL_shape_h_ +#define SDL_shape_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -71,6 +71,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un * \param window The window to query for being shaped. * * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. + * * \sa SDL_CreateShapedWindow */ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); @@ -91,7 +92,7 @@ typedef enum { /** \brief A union containing parameters for shaped windows. */ typedef union { - /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ + /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */ Uint8 binarizationCutoff; SDL_Color colorKey; } SDL_WindowShapeParams; @@ -111,8 +112,8 @@ typedef struct SDL_WindowShapeMode { * \param shape A surface encoding the desired shape for the window. * \param shape_mode The parameters to set for the shaped window. * - * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW - * if the SDL_Window* given does not reference a valid shaped window. + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW + * if the SDL_Window given does not reference a valid shaped window. * * \sa SDL_WindowShapeMode * \sa SDL_GetShapedWindowMode. @@ -127,7 +128,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s * * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if - * the SDL_Window* given is a shapeable window currently lacking a shape. + * the SDL_Window given is a shapeable window currently lacking a shape. * * \sa SDL_WindowShapeMode * \sa SDL_SetWindowShape @@ -140,4 +141,4 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo #endif #include "close_code.h" -#endif /* _SDL_shape_h */ +#endif /* SDL_shape_h_ */ diff --git a/Engine/lib/sdl/include/SDL_stdinc.h b/Engine/lib/sdl/include/SDL_stdinc.h index fdf96415f..111a0645e 100644 --- a/Engine/lib/sdl/include/SDL_stdinc.h +++ b/Engine/lib/sdl/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This is a general header that includes C language support. */ -#ifndef _SDL_stdinc_h -#define _SDL_stdinc_h +#ifndef SDL_stdinc_h_ +#define SDL_stdinc_h_ #include "SDL_config.h" @@ -62,6 +62,9 @@ #ifdef HAVE_STRINGS_H # include #endif +#ifdef HAVE_WCHAR_H +# include +#endif #if defined(HAVE_INTTYPES_H) # include #elif defined(HAVE_STDINT_H) @@ -127,44 +130,67 @@ */ /* @{ */ +#ifdef __CC_ARM +/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */ +#define SDL_FALSE 0 +#define SDL_TRUE 1 +typedef int SDL_bool; +#else typedef enum { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool; +#endif /** * \brief A signed 8-bit integer type. */ +#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ +#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ typedef int8_t Sint8; /** * \brief An unsigned 8-bit integer type. */ +#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ +#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ typedef uint8_t Uint8; /** * \brief A signed 16-bit integer type. */ +#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ +#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ typedef int16_t Sint16; /** * \brief An unsigned 16-bit integer type. */ +#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ +#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ typedef uint16_t Uint16; /** * \brief A signed 32-bit integer type. */ +#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ +#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ typedef int32_t Sint32; /** * \brief An unsigned 32-bit integer type. */ +#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ +#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ typedef uint32_t Uint32; /** * \brief A signed 64-bit integer type. */ +#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ +#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ typedef int64_t Sint64; /** * \brief An unsigned 64-bit integer type. */ +#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ +#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ typedef uint64_t Uint64; /* @} *//* Basic data types */ @@ -262,7 +288,7 @@ typedef uint64_t Uint64; #endif /* SDL_DISABLE_ANALYZE_MACROS */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ - typedef int SDL_dummy_ ## name[(x) * 2 - 1] + typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); @@ -337,6 +363,37 @@ extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); +typedef void *(SDLCALL *SDL_malloc_func)(size_t size); +typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); +typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); +typedef void (SDLCALL *SDL_free_func)(void *mem); + +/** + * \brief Get the current set of SDL memory functions + */ +extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func); + +/** + * \brief Replace SDL's memory allocation functions with a custom set + * + * \note If you are replacing SDL's memory functions, you should call + * SDL_GetNumAllocations() and be very careful if it returns non-zero. + * That means that your free function will be called with memory + * allocated by the previous memory allocation functions. + */ +extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func); + +/** + * \brief Get the number of outstanding (unfreed) allocations + */ +extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); + extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); @@ -379,10 +436,10 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) return; switch (dwords % 4) { - case 0: do { *_p++ = _val; - case 3: *_p++ = _val; - case 2: *_p++ = _val; - case 1: *_p++ = _val; + case 0: do { *_p++ = _val; /* fallthrough */ + case 3: *_p++ = _val; /* fallthrough */ + case 2: *_p++ = _val; /* fallthrough */ + case 1: *_p++ = _val; /* fallthrough */ } while ( --_n ); } #endif @@ -397,6 +454,7 @@ extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t le extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); @@ -409,6 +467,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); @@ -437,23 +496,38 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size #ifndef HAVE_M_PI #ifndef M_PI -#define M_PI 3.14159265358979323846264338327950288 /* pi */ +#define M_PI 3.14159265358979323846264338327950288 /**< pi */ #endif #endif extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); @@ -526,6 +600,6 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B #endif #include "close_code.h" -#endif /* _SDL_stdinc_h */ +#endif /* SDL_stdinc_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_surface.h b/Engine/lib/sdl/include/SDL_surface.h index e4a06a204..45e5366fe 100644 --- a/Engine/lib/sdl/include/SDL_surface.h +++ b/Engine/lib/sdl/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for ::SDL_Surface definition and management functions. */ -#ifndef _SDL_surface_h -#define _SDL_surface_h +#ifndef SDL_surface_h_ +#define SDL_surface_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -94,8 +94,19 @@ typedef struct SDL_Surface /** * \brief The type of function used for surface blitting functions. */ -typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, - struct SDL_Surface * dst, SDL_Rect * dstrect); +typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, + struct SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; /** * Allocate and free an RGB surface. @@ -118,8 +129,11 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); + +/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat (Uint32 flags, int width, int height, int depth, Uint32 format); + extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, @@ -356,6 +370,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect); +/* + * Creates a new surface identical to the existing surface + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface); + /** * Creates a new surface of the specified format, and then copies and maps * the given surface to it so the blit of the converted surface will be as @@ -501,6 +520,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -508,6 +541,6 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled #endif #include "close_code.h" -#endif /* _SDL_surface_h */ +#endif /* SDL_surface_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_system.h b/Engine/lib/sdl/include/SDL_system.h index 5da9adb45..7b776fdf1 100644 --- a/Engine/lib/sdl/include/SDL_system.h +++ b/Engine/lib/sdl/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for platform specific SDL API functions */ -#ifndef _SDL_system_h -#define _SDL_system_h +#ifndef SDL_system_h_ +#define SDL_system_h_ #include "SDL_stdinc.h" #include "SDL_keyboard.h" @@ -96,7 +96,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); This returns JNIEnv*, but the prototype is void* so we don't need jni.h */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); /** \brief Get the SDL Activity object for the application @@ -106,7 +106,12 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); It is the caller's responsibility to properly release it (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); + +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); /** See the official Android developer guide for more information: @@ -121,7 +126,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); This path is unique to your application and cannot be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); /** \brief Get the current state of external storage, a bitmask of these values: @@ -130,7 +135,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); If external storage is currently unavailable, this will return 0. */ -extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); +extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); /** \brief Get the path used for external storage for this application. @@ -138,7 +143,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); This path is unique to your application, but is public and can be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); #endif /* __ANDROID__ */ @@ -169,6 +174,25 @@ typedef enum } SDL_WinRT_Path; +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + /** * \brief Retrieves a WinRT defined path on the local file system * @@ -203,6 +227,13 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + #endif /* __WINRT__ */ /* Ends C function definitions when using C++ */ @@ -211,6 +242,6 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT #endif #include "close_code.h" -#endif /* _SDL_system_h */ +#endif /* SDL_system_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_syswm.h b/Engine/lib/sdl/include/SDL_syswm.h index 71ba5f1f3..8aa4a39ec 100644 --- a/Engine/lib/sdl/include/SDL_syswm.h +++ b/Engine/lib/sdl/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL custom system window manager hooks. */ -#ifndef _SDL_syswm_h -#define _SDL_syswm_h +#ifndef SDL_syswm_h_ +#define SDL_syswm_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -125,7 +125,8 @@ typedef enum SDL_SYSWM_MIR, SDL_SYSWM_WINRT, SDL_SYSWM_ANDROID, - SDL_SYSWM_VIVANTE + SDL_SYSWM_VIVANTE, + SDL_SYSWM_OS2 } SDL_SYSWM_TYPE; /** @@ -201,6 +202,7 @@ struct SDL_SysWMinfo { HWND window; /**< The window handle */ HDC hdc; /**< The window device context */ + HINSTANCE hinstance; /**< The instance handle */ } win; #endif #if defined(SDL_VIDEO_DRIVER_WINRT) @@ -228,9 +230,9 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - NSWindow __unsafe_unretained *window; /* The Cocoa window */ + NSWindow __unsafe_unretained *window; /**< The Cocoa window */ #else - NSWindow *window; /* The Cocoa window */ + NSWindow *window; /**< The Cocoa window */ #endif } cocoa; #endif @@ -238,13 +240,13 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - UIWindow __unsafe_unretained *window; /* The UIKit window */ + UIWindow __unsafe_unretained *window; /**< The UIKit window */ #else - UIWindow *window; /* The UIKit window */ + UIWindow *window; /**< The UIKit window */ #endif - GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ - GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ - GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ + GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ + GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ + GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ } uikit; #endif #if defined(SDL_VIDEO_DRIVER_WAYLAND) @@ -279,8 +281,9 @@ struct SDL_SysWMinfo } vivante; #endif - /* Can't have an empty union */ - int dummy; + /* Make sure this union is always 64 bytes (8 64-bit pointers). */ + /* Be careful not to overflow this if you add a new target! */ + Uint8 dummy[64]; } info; }; @@ -316,6 +319,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, #endif #include "close_code.h" -#endif /* _SDL_syswm_h */ +#endif /* SDL_syswm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test.h b/Engine/lib/sdl/include/SDL_test.h index 217847bfc..6cc373bf8 100644 --- a/Engine/lib/sdl/include/SDL_test.h +++ b/Engine/lib/sdl/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,21 +27,22 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_h -#define _SDL_test_h +#ifndef SDL_test_h_ +#define SDL_test_h_ #include "SDL.h" -#include "SDL_test_common.h" -#include "SDL_test_font.h" -#include "SDL_test_random.h" -#include "SDL_test_fuzzer.h" -#include "SDL_test_crc32.h" -#include "SDL_test_md5.h" -#include "SDL_test_log.h" #include "SDL_test_assert.h" +#include "SDL_test_common.h" +#include "SDL_test_compare.h" +#include "SDL_test_crc32.h" +#include "SDL_test_font.h" +#include "SDL_test_fuzzer.h" #include "SDL_test_harness.h" #include "SDL_test_images.h" -#include "SDL_test_compare.h" +#include "SDL_test_log.h" +#include "SDL_test_md5.h" +#include "SDL_test_memory.h" +#include "SDL_test_random.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -63,6 +64,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_h */ +#endif /* SDL_test_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_assert.h b/Engine/lib/sdl/include/SDL_test_assert.h index 29277e122..1788d7a20 100644 --- a/Engine/lib/sdl/include/SDL_test_assert.h +++ b/Engine/lib/sdl/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_assert_h -#define _SDL_test_assert_h +#ifndef SDL_test_assert_h_ +#define SDL_test_assert_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -80,12 +80,12 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, /** * \brief Resets the assert summary counters to zero. */ -void SDLTest_ResetAssertSummary(); +void SDLTest_ResetAssertSummary(void); /** * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. */ -void SDLTest_LogAssertSummary(); +void SDLTest_LogAssertSummary(void); /** @@ -93,13 +93,13 @@ void SDLTest_LogAssertSummary(); * * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT */ -int SDLTest_AssertSummaryToTestResult(); +int SDLTest_AssertSummaryToTestResult(void); #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_assert_h */ +#endif /* SDL_test_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_common.h b/Engine/lib/sdl/include/SDL_test_common.h index 0ebf31cb6..be2e6b2aa 100644 --- a/Engine/lib/sdl/include/SDL_test_common.h +++ b/Engine/lib/sdl/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,8 +29,8 @@ /* Ported from original test\common.h file. */ -#ifndef _SDL_test_common_h -#define _SDL_test_common_h +#ifndef SDL_test_common_h_ +#define SDL_test_common_h_ #include "SDL.h" @@ -183,6 +183,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state); #endif #include "close_code.h" -#endif /* _SDL_test_common_h */ +#endif /* SDL_test_common_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_compare.h b/Engine/lib/sdl/include/SDL_test_compare.h index 772cf9fbd..c22e447d8 100644 --- a/Engine/lib/sdl/include/SDL_test_compare.h +++ b/Engine/lib/sdl/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_compare_h -#define _SDL_test_compare_h +#ifndef SDL_test_compare_h_ +#define SDL_test_compare_h_ #include "SDL.h" @@ -64,6 +64,6 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, #endif #include "close_code.h" -#endif /* _SDL_test_compare_h */ +#endif /* SDL_test_compare_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_crc32.h b/Engine/lib/sdl/include/SDL_test_crc32.h index 572a3d955..3d235d074 100644 --- a/Engine/lib/sdl/include/SDL_test_crc32.h +++ b/Engine/lib/sdl/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_crc32_h -#define _SDL_test_crc32_h +#ifndef SDL_test_crc32_h_ +#define SDL_test_crc32_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -93,7 +93,7 @@ extern "C" { * \returns 0 for OK, -1 on error * */ -int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); +int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /* Same routine broken down into three steps */ int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); @@ -119,6 +119,6 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); #endif #include "close_code.h" -#endif /* _SDL_test_crc32_h */ +#endif /* SDL_test_crc32_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_font.h b/Engine/lib/sdl/include/SDL_test_font.h index 3378ea85b..59cbdcad6 100644 --- a/Engine/lib/sdl/include/SDL_test_font.h +++ b/Engine/lib/sdl/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,8 +27,8 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_font_h -#define _SDL_test_font_h +#ifndef SDL_test_font_h_ +#define SDL_test_font_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -50,7 +50,7 @@ extern "C" { * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); +int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); /** * \brief Draw a string in the currently set font. @@ -62,15 +62,20 @@ int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s ); +int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); +/** + * \brief Cleanup textures used by font drawing functions. + */ +void SDLTest_CleanupTextDrawing(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_font_h */ +#endif /* SDL_test_font_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_fuzzer.h b/Engine/lib/sdl/include/SDL_test_fuzzer.h index 9603652b2..8fcb9ebbf 100644 --- a/Engine/lib/sdl/include/SDL_test_fuzzer.h +++ b/Engine/lib/sdl/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_fuzzer_h -#define _SDL_test_fuzzer_h +#ifndef SDL_test_fuzzer_h_ +#define SDL_test_fuzzer_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -68,14 +68,14 @@ void SDLTest_FuzzerInit(Uint64 execKey); * * \returns Generated integer */ -Uint8 SDLTest_RandomUint8(); +Uint8 SDLTest_RandomUint8(void); /** * Returns a random Sint8 * * \returns Generated signed integer */ -Sint8 SDLTest_RandomSint8(); +Sint8 SDLTest_RandomSint8(void); /** @@ -83,14 +83,14 @@ Sint8 SDLTest_RandomSint8(); * * \returns Generated integer */ -Uint16 SDLTest_RandomUint16(); +Uint16 SDLTest_RandomUint16(void); /** * Returns a random Sint16 * * \returns Generated signed integer */ -Sint16 SDLTest_RandomSint16(); +Sint16 SDLTest_RandomSint16(void); /** @@ -98,7 +98,7 @@ Sint16 SDLTest_RandomSint16(); * * \returns Generated integer */ -Sint32 SDLTest_RandomSint32(); +Sint32 SDLTest_RandomSint32(void); /** @@ -106,14 +106,14 @@ Sint32 SDLTest_RandomSint32(); * * \returns Generated integer */ -Uint32 SDLTest_RandomUint32(); +Uint32 SDLTest_RandomUint32(void); /** * Returns random Uint64. * * \returns Generated integer */ -Uint64 SDLTest_RandomUint64(); +Uint64 SDLTest_RandomUint64(void); /** @@ -121,29 +121,29 @@ Uint64 SDLTest_RandomUint64(); * * \returns Generated signed integer */ -Sint64 SDLTest_RandomSint64(); +Sint64 SDLTest_RandomSint64(void); /** * \returns random float in range [0.0 - 1.0[ */ -float SDLTest_RandomUnitFloat(); +float SDLTest_RandomUnitFloat(void); /** * \returns random double in range [0.0 - 1.0[ */ -double SDLTest_RandomUnitDouble(); +double SDLTest_RandomUnitDouble(void); /** * \returns random float. * */ -float SDLTest_RandomFloat(); +float SDLTest_RandomFloat(void); /** * \returns random double. * */ -double SDLTest_RandomDouble(); +double SDLTest_RandomDouble(void); /** * Returns a random boundary value for Uint8 within the given boundaries. @@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); * * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. */ -char * SDLTest_RandomAsciiString(); +char * SDLTest_RandomAsciiString(void); /** @@ -371,7 +371,7 @@ char * SDLTest_RandomAsciiStringOfSize(int size); /** * Returns the invocation count for the fuzzer since last ...FuzzerInit. */ -int SDLTest_GetFuzzerInvocationCount(); +int SDLTest_GetFuzzerInvocationCount(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -379,6 +379,6 @@ int SDLTest_GetFuzzerInvocationCount(); #endif #include "close_code.h" -#endif /* _SDL_test_fuzzer_h */ +#endif /* SDL_test_fuzzer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_harness.h b/Engine/lib/sdl/include/SDL_test_harness.h index 74c0950cd..8641e0a7e 100644 --- a/Engine/lib/sdl/include/SDL_test_harness.h +++ b/Engine/lib/sdl/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ Based on original GSOC code by Markus Kauppila */ -#ifndef _SDL_test_harness_h -#define _SDL_test_harness_h +#ifndef SDL_test_h_arness_h +#define SDL_test_h_arness_h #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -98,6 +98,17 @@ typedef struct SDLTest_TestSuiteReference { } SDLTest_TestSuiteReference; +/** + * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). + * + * Note: The returned string needs to be deallocated by the caller. + * + * \param length The length of the seed string to generate + * + * \returns The generated seed string + */ +char *SDLTest_GenerateRunSeed(const int length); + /** * \brief Execute a test suite using the given run seed and execution key. * @@ -118,6 +129,6 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user #endif #include "close_code.h" -#endif /* _SDL_test_harness_h */ +#endif /* SDL_test_h_arness_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_images.h b/Engine/lib/sdl/include/SDL_test_images.h index 8c64b4feb..9c4dd5b82 100644 --- a/Engine/lib/sdl/include/SDL_test_images.h +++ b/Engine/lib/sdl/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_images_h -#define _SDL_test_images_h +#ifndef SDL_test_images_h_ +#define SDL_test_images_h_ #include "SDL.h" @@ -55,17 +55,17 @@ typedef struct SDLTest_SurfaceImage_s { } SDLTest_SurfaceImage_t; /* Test images */ -SDL_Surface *SDLTest_ImageBlit(); -SDL_Surface *SDLTest_ImageBlitColor(); -SDL_Surface *SDLTest_ImageBlitAlpha(); -SDL_Surface *SDLTest_ImageBlitBlendAdd(); -SDL_Surface *SDLTest_ImageBlitBlend(); -SDL_Surface *SDLTest_ImageBlitBlendMod(); -SDL_Surface *SDLTest_ImageBlitBlendNone(); -SDL_Surface *SDLTest_ImageBlitBlendAll(); -SDL_Surface *SDLTest_ImageFace(); -SDL_Surface *SDLTest_ImagePrimitives(); -SDL_Surface *SDLTest_ImagePrimitivesBlend(); +SDL_Surface *SDLTest_ImageBlit(void); +SDL_Surface *SDLTest_ImageBlitColor(void); +SDL_Surface *SDLTest_ImageBlitAlpha(void); +SDL_Surface *SDLTest_ImageBlitBlendAdd(void); +SDL_Surface *SDLTest_ImageBlitBlend(void); +SDL_Surface *SDLTest_ImageBlitBlendMod(void); +SDL_Surface *SDLTest_ImageBlitBlendNone(void); +SDL_Surface *SDLTest_ImageBlitBlendAll(void); +SDL_Surface *SDLTest_ImageFace(void); +SDL_Surface *SDLTest_ImagePrimitives(void); +SDL_Surface *SDLTest_ImagePrimitivesBlend(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -73,6 +73,6 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend(); #endif #include "close_code.h" -#endif /* _SDL_test_images_h */ +#endif /* SDL_test_images_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_log.h b/Engine/lib/sdl/include/SDL_test_log.h index 73a5c016f..ebd44fb50 100644 --- a/Engine/lib/sdl/include/SDL_test_log.h +++ b/Engine/lib/sdl/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_log_h -#define _SDL_test_log_h +#ifndef SDL_test_log_h_ +#define SDL_test_log_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -62,6 +62,6 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_ #endif #include "close_code.h" -#endif /* _SDL_test_log_h */ +#endif /* SDL_test_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_md5.h b/Engine/lib/sdl/include/SDL_test_md5.h index f2d9a7d7e..0e4105768 100644 --- a/Engine/lib/sdl/include/SDL_test_md5.h +++ b/Engine/lib/sdl/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,8 +53,8 @@ *********************************************************************** */ -#ifndef _SDL_test_md5_h -#define _SDL_test_md5_h +#ifndef SDL_test_md5_h_ +#define SDL_test_md5_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -124,6 +124,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_md5_h */ +#endif /* SDL_test_md5_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_memory.h b/Engine/lib/sdl/include/SDL_test_memory.h new file mode 100644 index 000000000..4827ae6f2 --- /dev/null +++ b/Engine/lib/sdl/include/SDL_test_memory.h @@ -0,0 +1,63 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_memory.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef SDL_test_memory_h_ +#define SDL_test_memory_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * \brief Start tracking SDL memory allocations + * + * \note This should be called before any other SDL functions for complete tracking coverage + */ +int SDLTest_TrackAllocations(); + +/** + * \brief Print a log of any outstanding allocations + * + * \note This can be called after SDL_Quit() + */ +void SDLTest_LogAllocations(); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_memory_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_random.h b/Engine/lib/sdl/include/SDL_test_random.h index 91c36526c..0eb414ff2 100644 --- a/Engine/lib/sdl/include/SDL_test_random.h +++ b/Engine/lib/sdl/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,8 +37,8 @@ */ -#ifndef _SDL_test_random_h -#define _SDL_test_random_h +#ifndef SDL_test_random_h_ +#define SDL_test_random_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -110,6 +110,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_random_h */ +#endif /* SDL_test_random_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_thread.h b/Engine/lib/sdl/include/SDL_thread.h index 377e6c73d..82a43fc03 100644 --- a/Engine/lib/sdl/include/SDL_thread.h +++ b/Engine/lib/sdl/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_thread_h -#define _SDL_thread_h +#ifndef SDL_thread_h_ +#define SDL_thread_h_ /** * \file SDL_thread.h @@ -74,15 +74,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL.DLL will + * API. There is a problem with this, that only the RTL of the SDL2.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL.DLL which uses this API, - * then the RTL of SDL.DLL will be used to create the new thread, and if it's + * start a new thread. This way, if it's the SDL2.DLL which uses this API, + * then the RTL of SDL2.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: @@ -90,14 +90,11 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD -#include /* This has _beginthread() and _endthread() defined! */ +#include /* _beginthreadex() and _endthreadex() */ -typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, - unsigned (__stdcall * - func) (void - *), - void *arg, unsigned, - unsigned *threadID); +typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) + (void *, unsigned, unsigned (__stdcall *func)(void *), + void * /*arg*/, unsigned, unsigned * /* threadID */); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); /** @@ -118,6 +115,30 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #endif +#elif defined(__OS2__) +/* + * just like the windows case above: We compile SDL2 + * into a dll with Watcom's runtime statically linked. + */ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD +#ifndef __EMX__ +#include +#else +#include +#endif +typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); +typedef void (*pfnSDL_CurrentEndThread)(void); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); +#if defined(SDL_CreateThread) && SDL_DYNAMIC_API +#undef SDL_CreateThread +#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#else +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#endif + #else /** @@ -273,7 +294,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); * \sa SDL_TLSCreate() * \sa SDL_TLSGet() */ -extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*)); +extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*)); /* Ends C function definitions when using C++ */ @@ -282,6 +303,6 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*d #endif #include "close_code.h" -#endif /* _SDL_thread_h */ +#endif /* SDL_thread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_timer.h b/Engine/lib/sdl/include/SDL_timer.h index e0d3785ee..5600618ff 100644 --- a/Engine/lib/sdl/include/SDL_timer.h +++ b/Engine/lib/sdl/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_timer_h -#define _SDL_timer_h +#ifndef SDL_timer_h_ +#define SDL_timer_h_ /** * \file SDL_timer.h @@ -110,6 +110,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); #endif #include "close_code.h" -#endif /* _SDL_timer_h */ +#endif /* SDL_timer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_touch.h b/Engine/lib/sdl/include/SDL_touch.h index 2643e3679..f4075e79a 100644 --- a/Engine/lib/sdl/include/SDL_touch.h +++ b/Engine/lib/sdl/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL touch event handling. */ -#ifndef _SDL_touch_h -#define _SDL_touch_h +#ifndef SDL_touch_h_ +#define SDL_touch_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -81,6 +81,6 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int #endif #include "close_code.h" -#endif /* _SDL_touch_h */ +#endif /* SDL_touch_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_types.h b/Engine/lib/sdl/include/SDL_types.h index 5118af219..4ac248c8c 100644 --- a/Engine/lib/sdl/include/SDL_types.h +++ b/Engine/lib/sdl/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_version.h b/Engine/lib/sdl/include/SDL_version.h index 1700efdd1..584b48c7a 100644 --- a/Engine/lib/sdl/include/SDL_version.h +++ b/Engine/lib/sdl/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This header defines the current SDL version. */ -#ifndef _SDL_version_h -#define _SDL_version_h +#ifndef SDL_version_h_ +#define SDL_version_h_ #include "SDL_stdinc.h" @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 5 +#define SDL_PATCHLEVEL 8 /** * \brief Macro to determine SDL version program was compiled against. @@ -157,6 +157,6 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); #endif #include "close_code.h" -#endif /* _SDL_version_h */ +#endif /* SDL_version_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_video.h b/Engine/lib/sdl/include/SDL_video.h index 73c33eb32..83f49faae 100644 --- a/Engine/lib/sdl/include/SDL_video.h +++ b/Engine/lib/sdl/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL video functions. */ -#ifndef _SDL_video_h -#define _SDL_video_h +#ifndef SDL_video_h_ +#define SDL_video_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -110,13 +110,16 @@ typedef enum SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ - SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */ + SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ - SDL_WINDOW_POPUP_MENU = 0x00080000 /**< window should be treated as a popup menu */ + SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ + SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */ } SDL_WindowFlags; /** @@ -200,14 +203,16 @@ typedef enum SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, - SDL_GL_CONTEXT_RELEASE_BEHAVIOR + SDL_GL_CONTEXT_RELEASE_BEHAVIOR, + SDL_GL_CONTEXT_RESET_NOTIFICATION, + SDL_GL_CONTEXT_NO_ERROR } SDL_GLattr; typedef enum { SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, - SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ + SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ } SDL_GLprofile; typedef enum @@ -224,6 +229,11 @@ typedef enum SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001 } SDL_GLcontextReleaseFlag; +typedef enum +{ + SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000, + SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001 +} SDL_GLContextResetNotification; /* Function prototypes */ @@ -448,17 +458,32 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, - * ::SDL_WINDOW_ALLOW_HIGHDPI. + * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN. * * \return The created window, or NULL if window creation failed. * * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size * in pixels may differ from its size in screen coordinates on platforms with * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query - * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize() - * or SDL_GetRendererOutputSize() to query the drawable size in pixels. + * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), + * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the + * drawable size in pixels. + * + * If the window is created with any of the SDL_WINDOW_OPENGL or + * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function + * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). + * + * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, + * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. + * + * \note On non-Apple devices, SDL requires you to either not link to the + * Vulkan loader or link to a dynamic library version. This limitation + * may be removed in a future version of SDL. * * \sa SDL_DestroyWindow() + * \sa SDL_GL_LoadLibrary() + * \sa SDL_Vulkan_LoadLibrary() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, @@ -581,8 +606,8 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * \param w The width of the window, in screen coordinates. Must be >0. * \param h The height of the window, in screen coordinates. Must be >0. * - * \note You can't change the size of a fullscreen window, it automatically - * matches the size of the display mode. + * \note Fullscreen windows automatically match the size of the display mode, + * and you should use SDL_SetWindowDisplayMode() to change their size. * * The window size in screen coordinates may differ from the size in pixels, if * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with @@ -590,6 +615,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_GetWindowSize() + * \sa SDL_SetWindowDisplayMode() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h); @@ -870,7 +896,7 @@ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); * \param window The window which will be made transparent or opaque * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be * clamped internally between 0.0f and 1.0f. - * + * * \return 0 on success, or -1 if setting the opacity isn't supported. * * \sa SDL_GetWindowOpacity() @@ -897,7 +923,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * ou * * \param modal_window The window that should be modal * \param parent_window The parent window - * + * * \return 0 on success, or -1 otherwise. */ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); @@ -910,7 +936,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL * obscured by other windows. * * \param window The window that should get the input focus - * + * * \return 0 on success, or -1 otherwise. * \sa SDL_RaiseWindow() */ @@ -1110,11 +1136,16 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); /** * \brief Set an OpenGL window attribute before window creation. + * + * \return 0 on success, or -1 if the attribute could not be set. */ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /** * \brief Get the actual value for an attribute from the current context. + * + * \return 0 on success, or -1 if the attribute could not be retrieved. + * The integer at \c value will be modified in either case. */ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); @@ -1213,6 +1244,6 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); #endif #include "close_code.h" -#endif /* _SDL_video_h */ +#endif /* SDL_video_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_vulkan.h b/Engine/lib/sdl/include/SDL_vulkan.h new file mode 100644 index 000000000..f04c21adb --- /dev/null +++ b/Engine/lib/sdl/include/SDL_vulkan.h @@ -0,0 +1,273 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017, Mark Callow + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_vulkan.h + * + * Header file for functions to creating Vulkan surfaces on SDL windows. + */ + +#ifndef SDL_vulkan_h_ +#define SDL_vulkan_h_ + +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid including vulkan.h, don't define VkInstance if it's already included */ +#ifdef VULKAN_H_ +#define NO_SDL_VULKAN_TYPEDEFS +#endif +#ifndef NO_SDL_VULKAN_TYPEDEFS +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + +#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#endif /* !NO_SDL_VULKAN_TYPEDEFS */ + +typedef VkInstance SDL_vulkanInstance; +typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ + +/** + * \name Vulkan support functions + * + * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API + * is compatable with Tizen's implementation of Vulkan in SDL. + */ +/* @{ */ + +/** + * \brief Dynamically load a Vulkan loader library. + * + * \param [in] path The platform dependent Vulkan loader library name, or + * \c NULL. + * + * \return \c 0 on success, or \c -1 if the library couldn't be loaded. + * + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before + * creating any Vulkan windows. If no Vulkan loader library is loaded, the + * default library will be loaded upon creation of the first Vulkan window. + * + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using + * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee + * \c path points to the same vulkan loader library the application + * linked to. + * + * \note On Apple devices, if \a path is NULL, SDL will attempt to find + * the vkGetInstanceProcAddr address within all the mach-o images of + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. + * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. + * + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. + * + * \note This function will fail if there are no working Vulkan drivers + * installed. + * + * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() + * \sa SDL_Vulkan_UnloadLibrary() + */ +extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); + +/** + * \brief Get the address of the \c vkGetInstanceProcAddr function. + * + * \note This should be called after either calling SDL_Vulkan_LoadLibrary + * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag. + */ +extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); + +/** + * \brief Unload the Vulkan loader library previously loaded by + * \c SDL_Vulkan_LoadLibrary(). + * + * \sa SDL_Vulkan_LoadLibrary() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); + +/** + * \brief Get the names of the Vulkan instance extensions needed to create + * a surface with \c SDL_Vulkan_CreateSurface(). + * + * \param [in] window Window for which the required Vulkan instance + * extensions should be retrieved + * \param [in,out] count pointer to an \c unsigned related to the number of + * required Vulkan instance extensions + * \param [out] names \c NULL or a pointer to an array to be filled with the + * required Vulkan instance extensions + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * If \a pNames is \c NULL, then the number of required Vulkan instance + * extensions is returned in pCount. Otherwise, \a pCount must point to a + * variable set to the number of elements in the \a pNames array, and on + * return the variable is overwritten with the number of names actually + * written to \a pNames. If \a pCount is less than the number of required + * extensions, at most \a pCount structures will be written. If \a pCount + * is smaller than the number of required extensions, \c SDL_FALSE will be + * returned instead of \c SDL_TRUE, to indicate that not all the required + * extensions were returned. + * + * \note The returned list of extensions will contain \c VK_KHR_surface + * and zero or more platform specific extensions + * + * \note The extension names queried here must be enabled when calling + * VkCreateInstance, otherwise surface creation will fail. + * + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag. + * + * \code + * unsigned int count; + * // get count of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL)) + * handle_error(); + * + * static const char *const additionalExtensions[] = + * { + * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension + * }; + * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]); + * size_t extensionCount = count + additionalExtensionsCount; + * const char **names = malloc(sizeof(const char *) * extensionCount); + * if(!names) + * handle_error(); + * + * // get names of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names)) + * handle_error(); + * + * // copy additional extensions after required extensions + * for(size_t i = 0; i < additionalExtensionsCount; i++) + * names[i + count] = additionalExtensions[i]; + * + * VkInstanceCreateInfo instanceCreateInfo = {}; + * instanceCreateInfo.enabledExtensionCount = extensionCount; + * instanceCreateInfo.ppEnabledExtensionNames = names; + * // fill in rest of instanceCreateInfo + * + * VkInstance instance; + * // create the Vulkan instance + * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance); + * free(names); + * \endcode + * + * \sa SDL_Vulkan_CreateSurface() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions( + SDL_Window *window, + unsigned int *pCount, + const char **pNames); + +/** + * \brief Create a Vulkan rendering surface for a window. + * + * \param [in] window SDL_Window to which to attach the rendering surface. + * \param [in] instance handle to the Vulkan instance to use. + * \param [out] surface pointer to a VkSurfaceKHR handle to receive the + * handle of the newly created surface. + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * \code + * VkInstance instance; + * SDL_Window *window; + * + * // create instance and window + * + * // create the Vulkan surface + * VkSurfaceKHR surface; + * if(!SDL_Vulkan_CreateSurface(window, instance, &surface)) + * handle_error(); + * \endcode + * + * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag. + * + * \note \a instance should have been created with the extensions returned + * by \c SDL_Vulkan_CreateSurface() enabled. + * + * \sa SDL_Vulkan_GetInstanceExtensions() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR* surface); + +/** + * \brief Get the size of a window's underlying drawable in pixels (for use + * with setting viewport, scissor & etc). + * + * \param window SDL_Window from which the drawable size should be queried + * \param w Pointer to variable for storing the width in pixels, + * may be NULL + * \param h Pointer to variable for storing the height in pixels, + * may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * + * \sa SDL_GetWindowSize() + * \sa SDL_CreateWindow() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, + int *w, int *h); + +/* @} *//* Vulkan support functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_vulkan_h_ */ diff --git a/Engine/lib/sdl/include/begin_code.h b/Engine/lib/sdl/include/begin_code.h index 04e78c64d..6c2106246 100644 --- a/Engine/lib/sdl/include/begin_code.h +++ b/Engine/lib/sdl/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,6 +61,12 @@ # else # define DECLSPEC __declspec(dllexport) # endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) @@ -74,6 +80,11 @@ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif #else #define SDLCALL #endif @@ -111,7 +122,7 @@ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ - defined(__DECC) + defined(__DECC) || defined(__CC_ARM) #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline @@ -134,6 +145,16 @@ #endif #endif /* SDL_FORCE_INLINE not defined */ +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL diff --git a/Engine/lib/sdl/include/close_code.h b/Engine/lib/sdl/include/close_code.h index d908b00eb..b3b70a4c8 100644 --- a/Engine/lib/sdl/include/close_code.h +++ b/Engine/lib/sdl/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ -#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif diff --git a/Engine/lib/sdl/src/SDL.c b/Engine/lib/sdl/src/SDL.c index 9eef00cd3..0e552791f 100644 --- a/Engine/lib/sdl/src/SDL.c +++ b/Engine/lib/sdl/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,10 +36,7 @@ /* Initialization/Cleanup routines */ #if !SDL_TIMERS_DISABLED -extern int SDL_TimerInit(void); -extern void SDL_TimerQuit(void); -extern void SDL_TicksInit(void); -extern void SDL_TicksQuit(void); +# include "timer/SDL_timer_c.h" #endif #if SDL_VIDEO_DRIVER_WINDOWS extern int SDL_HelperWindowCreate(void); @@ -81,7 +78,7 @@ SDL_PrivateShouldInitSubsystem(Uint32 subsystem) { int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - return (SDL_SubsystemRefCount[subsystem_index] == 0); + return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE; } /* Private helper to check if a system needs to be quit. */ @@ -95,7 +92,7 @@ SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { /* If we're in SDL_Quit, we shut down every subsystem, even if refcount * isn't zero. */ - return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit; + return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; } void @@ -456,7 +453,7 @@ SDL_GetPlatform() #if defined(__WIN32__) -#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) +#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB) /* Need to include DllMain() on Watcom C for some reason.. */ BOOL APIENTRY @@ -472,7 +469,7 @@ _DllMainCRTStartup(HANDLE hModule, } return TRUE; } -#endif /* building DLL with Watcom C */ +#endif /* Building DLL */ #endif /* __WIN32__ */ diff --git a/Engine/lib/sdl/src/SDL_assert.c b/Engine/lib/sdl/src/SDL_assert.c index a21f70b68..76f5d604d 100644 --- a/Engine/lib/sdl/src/SDL_assert.c +++ b/Engine/lib/sdl/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,7 +44,12 @@ #endif #endif -static SDL_assert_state +#if defined(__EMSCRIPTEN__) +#include +#endif + + +static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); /* @@ -53,7 +58,10 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); */ static SDL_assert_data *triggered_assertions = NULL; +#ifndef SDL_THREADS_DISABLED static SDL_mutex *assertion_mutex = NULL; +#endif + static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion; static void *assertion_userdata = NULL; @@ -111,23 +119,29 @@ static void SDL_GenerateAssertionReport(void) } } -static void SDL_ExitProcess(int exitcode) + +static SDL_NORETURN void SDL_ExitProcess(int exitcode) { #ifdef __WIN32__ ExitProcess(exitcode); +#elif defined(__EMSCRIPTEN__) + emscripten_cancel_main_loop(); /* this should "kill" the app. */ + emscripten_force_exit(exitcode); /* this should "kill" the app. */ + exit(exitcode); #else _exit(exitcode); #endif } -static void SDL_AbortAssertion(void) + +static SDL_NORETURN void SDL_AbortAssertion(void) { SDL_Quit(); SDL_ExitProcess(42); } -static SDL_assert_state +static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { #ifdef __WIN32__ @@ -216,9 +230,45 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) state = (SDL_assert_state)selected; } } -#ifdef HAVE_STDIO_H + else { +#if defined(__EMSCRIPTEN__) + /* This is nasty, but we can't block on a custom UI. */ + for ( ; ; ) { + SDL_bool okay = SDL_TRUE; + char *buf = (char *) EM_ASM_INT({ + var str = + Pointer_stringify($0) + '\n\n' + + 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :'; + var reply = window.prompt(str, "i"); + if (reply === null) { + reply = "i"; + } + return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL); + }, message); + + if (SDL_strcmp(buf, "a") == 0) { + state = SDL_ASSERTION_ABORT; + /* (currently) no break functionality on Emscripten + } else if (SDL_strcmp(buf, "b") == 0) { + state = SDL_ASSERTION_BREAK; */ + } else if (SDL_strcmp(buf, "r") == 0) { + state = SDL_ASSERTION_RETRY; + } else if (SDL_strcmp(buf, "i") == 0) { + state = SDL_ASSERTION_IGNORE; + } else if (SDL_strcmp(buf, "A") == 0) { + state = SDL_ASSERTION_ALWAYS_IGNORE; + } else { + okay = SDL_FALSE; + } + free(buf); + + if (okay) { + break; + } + } +#elif defined(HAVE_STDIO_H) /* this is a little hacky. */ for ( ; ; ) { char buf[32]; @@ -228,25 +278,25 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) break; } - if (SDL_strcmp(buf, "a") == 0) { + if (SDL_strncmp(buf, "a", 1) == 0) { state = SDL_ASSERTION_ABORT; break; - } else if (SDL_strcmp(buf, "b") == 0) { + } else if (SDL_strncmp(buf, "b", 1) == 0) { state = SDL_ASSERTION_BREAK; break; - } else if (SDL_strcmp(buf, "r") == 0) { + } else if (SDL_strncmp(buf, "r", 1) == 0) { state = SDL_ASSERTION_RETRY; break; - } else if (SDL_strcmp(buf, "i") == 0) { + } else if (SDL_strncmp(buf, "i", 1) == 0) { state = SDL_ASSERTION_IGNORE; break; - } else if (SDL_strcmp(buf, "A") == 0) { + } else if (SDL_strncmp(buf, "A", 1) == 0) { state = SDL_ASSERTION_ALWAYS_IGNORE; break; } } - } #endif /* HAVE_STDIO_H */ + } /* Re-enter fullscreen mode */ if (window) { @@ -263,10 +313,11 @@ SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, int line) { - static int assertion_running = 0; - static SDL_SpinLock spinlock = 0; SDL_assert_state state = SDL_ASSERTION_IGNORE; + static int assertion_running = 0; +#ifndef SDL_THREADS_DISABLED + static SDL_SpinLock spinlock = 0; SDL_AtomicLock(&spinlock); if (assertion_mutex == NULL) { /* never called SDL_Init()? */ assertion_mutex = SDL_CreateMutex(); @@ -280,6 +331,7 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, if (SDL_LockMutex(assertion_mutex) < 0) { return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ } +#endif /* doing this because Visual C is upset over assigning in the macro. */ if (data->trigger_count == 0) { @@ -323,7 +375,10 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, } assertion_running--; + +#ifndef SDL_THREADS_DISABLED SDL_UnlockMutex(assertion_mutex); +#endif return state; } @@ -332,10 +387,12 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, void SDL_AssertionsQuit(void) { SDL_GenerateAssertionReport(); +#ifndef SDL_THREADS_DISABLED if (assertion_mutex != NULL) { SDL_DestroyMutex(assertion_mutex); assertion_mutex = NULL; } +#endif } void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata) diff --git a/Engine/lib/sdl/src/SDL_assert_c.h b/Engine/lib/sdl/src/SDL_assert_c.h index bc3b631e0..aa690a308 100644 --- a/Engine/lib/sdl/src/SDL_assert_c.h +++ b/Engine/lib/sdl/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/SDL_dataqueue.c b/Engine/lib/sdl/src/SDL_dataqueue.c new file mode 100644 index 000000000..97916f43f --- /dev/null +++ b/Engine/lib/sdl/src/SDL_dataqueue.c @@ -0,0 +1,339 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "./SDL_internal.h" +#include "SDL.h" +#include "./SDL_dataqueue.h" +#include "SDL_assert.h" + +typedef struct SDL_DataQueuePacket +{ + size_t datalen; /* bytes currently in use in this packet. */ + size_t startpos; /* bytes currently consumed in this packet. */ + struct SDL_DataQueuePacket *next; /* next item in linked list. */ + Uint8 data[SDL_VARIABLE_LENGTH_ARRAY]; /* packet data */ +} SDL_DataQueuePacket; + +struct SDL_DataQueue +{ + SDL_DataQueuePacket *head; /* device fed from here. */ + SDL_DataQueuePacket *tail; /* queue fills to here. */ + SDL_DataQueuePacket *pool; /* these are unused packets. */ + size_t packet_size; /* size of new packets */ + size_t queued_bytes; /* number of bytes of data in the queue. */ +}; + +static void +SDL_FreeDataQueueList(SDL_DataQueuePacket *packet) +{ + while (packet) { + SDL_DataQueuePacket *next = packet->next; + SDL_free(packet); + packet = next; + } +} + + +/* this all expects that you managed thread safety elsewhere. */ + +SDL_DataQueue * +SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack) +{ + SDL_DataQueue *queue = (SDL_DataQueue *) SDL_malloc(sizeof (SDL_DataQueue)); + + if (!queue) { + SDL_OutOfMemory(); + return NULL; + } else { + const size_t packetlen = _packetlen ? _packetlen : 1024; + const size_t wantpackets = (initialslack + (packetlen - 1)) / packetlen; + size_t i; + + SDL_zerop(queue); + queue->packet_size = packetlen; + + for (i = 0; i < wantpackets; i++) { + SDL_DataQueuePacket *packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + packetlen); + if (packet) { /* don't care if this fails, we'll deal later. */ + packet->datalen = 0; + packet->startpos = 0; + packet->next = queue->pool; + queue->pool = packet; + } + } + } + + return queue; +} + +void +SDL_FreeDataQueue(SDL_DataQueue *queue) +{ + if (queue) { + SDL_FreeDataQueueList(queue->head); + SDL_FreeDataQueueList(queue->pool); + SDL_free(queue); + } +} + +void +SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack) +{ + const size_t packet_size = queue ? queue->packet_size : 1; + const size_t slackpackets = (slack + (packet_size-1)) / packet_size; + SDL_DataQueuePacket *packet; + SDL_DataQueuePacket *prev = NULL; + size_t i; + + if (!queue) { + return; + } + + packet = queue->head; + + /* merge the available pool and the current queue into one list. */ + if (packet) { + queue->tail->next = queue->pool; + } else { + packet = queue->pool; + } + + /* Remove the queued packets from the device. */ + queue->tail = NULL; + queue->head = NULL; + queue->queued_bytes = 0; + queue->pool = packet; + + /* Optionally keep some slack in the pool to reduce malloc pressure. */ + for (i = 0; packet && (i < slackpackets); i++) { + prev = packet; + packet = packet->next; + } + + if (prev) { + prev->next = NULL; + } else { + queue->pool = NULL; + } + + SDL_FreeDataQueueList(packet); /* free extra packets */ +} + +static SDL_DataQueuePacket * +AllocateDataQueuePacket(SDL_DataQueue *queue) +{ + SDL_DataQueuePacket *packet; + + SDL_assert(queue != NULL); + + packet = queue->pool; + if (packet != NULL) { + /* we have one available in the pool. */ + queue->pool = packet->next; + } else { + /* Have to allocate a new one! */ + packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + queue->packet_size); + if (packet == NULL) { + return NULL; + } + } + + packet->datalen = 0; + packet->startpos = 0; + packet->next = NULL; + + SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); + if (queue->tail == NULL) { + queue->head = packet; + } else { + queue->tail->next = packet; + } + queue->tail = packet; + return packet; +} + + +int +SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len) +{ + size_t len = _len; + const Uint8 *data = (const Uint8 *) _data; + const size_t packet_size = queue ? queue->packet_size : 0; + SDL_DataQueuePacket *orighead; + SDL_DataQueuePacket *origtail; + size_t origlen; + size_t datalen; + + if (!queue) { + return SDL_InvalidParamError("queue"); + } + + orighead = queue->head; + origtail = queue->tail; + origlen = origtail ? origtail->datalen : 0; + + while (len > 0) { + SDL_DataQueuePacket *packet = queue->tail; + SDL_assert(!packet || (packet->datalen <= packet_size)); + if (!packet || (packet->datalen >= packet_size)) { + /* tail packet missing or completely full; we need a new packet. */ + packet = AllocateDataQueuePacket(queue); + if (!packet) { + /* uhoh, reset so we've queued nothing new, free what we can. */ + if (!origtail) { + packet = queue->head; /* whole queue. */ + } else { + packet = origtail->next; /* what we added to existing queue. */ + origtail->next = NULL; + origtail->datalen = origlen; + } + queue->head = orighead; + queue->tail = origtail; + queue->pool = NULL; + + SDL_FreeDataQueueList(packet); /* give back what we can. */ + return SDL_OutOfMemory(); + } + } + + datalen = SDL_min(len, packet_size - packet->datalen); + SDL_memcpy(packet->data + packet->datalen, data, datalen); + data += datalen; + len -= datalen; + packet->datalen += datalen; + queue->queued_bytes += datalen; + } + + return 0; +} + +size_t +SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) +{ + size_t len = _len; + Uint8 *buf = (Uint8 *) _buf; + Uint8 *ptr = buf; + SDL_DataQueuePacket *packet; + + if (!queue) { + return 0; + } + + for (packet = queue->head; len && packet; packet = packet->next) { + const size_t avail = packet->datalen - packet->startpos; + const size_t cpy = SDL_min(len, avail); + SDL_assert(queue->queued_bytes >= avail); + + SDL_memcpy(ptr, packet->data + packet->startpos, cpy); + ptr += cpy; + len -= cpy; + } + + return (size_t) (ptr - buf); +} + +size_t +SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) +{ + size_t len = _len; + Uint8 *buf = (Uint8 *) _buf; + Uint8 *ptr = buf; + SDL_DataQueuePacket *packet; + + if (!queue) { + return 0; + } + + while ((len > 0) && ((packet = queue->head) != NULL)) { + const size_t avail = packet->datalen - packet->startpos; + const size_t cpy = SDL_min(len, avail); + SDL_assert(queue->queued_bytes >= avail); + + SDL_memcpy(ptr, packet->data + packet->startpos, cpy); + packet->startpos += cpy; + ptr += cpy; + queue->queued_bytes -= cpy; + len -= cpy; + + if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */ + queue->head = packet->next; + SDL_assert((packet->next != NULL) || (packet == queue->tail)); + packet->next = queue->pool; + queue->pool = packet; + } + } + + SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); + + if (queue->head == NULL) { + queue->tail = NULL; /* in case we drained the queue entirely. */ + } + + return (size_t) (ptr - buf); +} + +size_t +SDL_CountDataQueue(SDL_DataQueue *queue) +{ + return queue ? queue->queued_bytes : 0; +} + +void * +SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len) +{ + SDL_DataQueuePacket *packet; + + if (!queue) { + SDL_InvalidParamError("queue"); + return NULL; + } else if (len == 0) { + SDL_InvalidParamError("len"); + return NULL; + } else if (len > queue->packet_size) { + SDL_SetError("len is larger than packet size"); + return NULL; + } + + packet = queue->head; + if (packet) { + const size_t avail = queue->packet_size - packet->datalen; + if (len <= avail) { /* we can use the space at end of this packet. */ + void *retval = packet->data + packet->datalen; + packet->datalen += len; + queue->queued_bytes += len; + return retval; + } + } + + /* Need a fresh packet. */ + packet = AllocateDataQueuePacket(queue); + if (!packet) { + SDL_OutOfMemory(); + return NULL; + } + + packet->datalen = len; + queue->queued_bytes += len; + return packet->data; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/SDL_dataqueue.h b/Engine/lib/sdl/src/SDL_dataqueue.h new file mode 100644 index 000000000..d44f58db1 --- /dev/null +++ b/Engine/lib/sdl/src/SDL_dataqueue.h @@ -0,0 +1,55 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_dataqueue_h_ +#define SDL_dataqueue_h_ + +/* this is not (currently) a public API. But maybe it should be! */ + +struct SDL_DataQueue; +typedef struct SDL_DataQueue SDL_DataQueue; + +SDL_DataQueue *SDL_NewDataQueue(const size_t packetlen, const size_t initialslack); +void SDL_FreeDataQueue(SDL_DataQueue *queue); +void SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack); +int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *data, const size_t len); +size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *buf, const size_t len); +size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *buf, const size_t len); +size_t SDL_CountDataQueue(SDL_DataQueue *queue); + +/* this sets a section of the data queue aside (possibly allocating memory for it) + as if it's been written to, but returns a pointer to that space. You may write + to this space until a read would consume it. Writes (and other calls to this + function) will safely append their data after this reserved space and can + be in flight at the same time. There is no thread safety. + If there isn't an existing block of memory that can contain the reserved + space, one will be allocated for it. You can not (currently) allocate + a space larger than the packetlen requested in SDL_NewDataQueue. + Returned buffer is uninitialized. + This lets you avoid an extra copy in some cases, but it's safer to use + SDL_WriteToDataQueue() unless you know what you're doing. + Returns pointer to buffer of at least (len) bytes, NULL on error. +*/ +void *SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len); + +#endif /* SDL_dataqueue_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/SDL_error.c b/Engine/lib/sdl/src/SDL_error.c index 804a1eb38..14761c544 100644 --- a/Engine/lib/sdl/src/SDL_error.c +++ b/Engine/lib/sdl/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,6 +49,8 @@ SDL_LookupString(const char *key) /* Public functions */ +static char *SDL_GetErrorMsg(char *errstr, int maxlen); + int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { @@ -74,6 +76,16 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) case 0: /* Malformed format string.. */ --fmt; break; + case 'l': + switch (*fmt++) { + case 0: /* Malformed format string.. */ + --fmt; + break; + case 'i': case 'd': case 'u': + error->args[error->argc++].value_l = va_arg(ap, long); + break; + } + break; case 'c': case 'i': case 'd': @@ -110,16 +122,83 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) } va_end(ap); - /* If we are in debug mode, print out an error message */ - SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); - + if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) { + /* If we are in debug mode, print out an error message + * Avoid stomping on the static buffer in GetError, just + * in case this is called while processing a ShowMessageBox to + * show an error already in that static buffer. + */ + char errmsg[SDL_ERRBUFIZE]; + SDL_GetErrorMsg(errmsg, sizeof(errmsg)); + SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg); + } return -1; } -#ifdef __GNUC__ -#pragma GCC diagnostic push +/* Available for backwards compatibility */ +const char * +SDL_GetError(void) +{ + static char errmsg[SDL_ERRBUFIZE]; + + return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE); +} + +void +SDL_ClearError(void) +{ + SDL_error *error; + + error = SDL_GetErrBuf(); + error->error = 0; +} + +/* Very common errors go here */ +int +SDL_Error(SDL_errorcode code) +{ + switch (code) { + case SDL_ENOMEM: + return SDL_SetError("Out of memory"); + case SDL_EFREAD: + return SDL_SetError("Error reading from datastream"); + case SDL_EFWRITE: + return SDL_SetError("Error writing to datastream"); + case SDL_EFSEEK: + return SDL_SetError("Error seeking in datastream"); + case SDL_UNSUPPORTED: + return SDL_SetError("That operation is not supported"); + default: + return SDL_SetError("Unknown SDL error"); + } +} + +#ifdef TEST_ERROR +int +main(int argc, char *argv[]) +{ + char buffer[BUFSIZ + 1]; + + SDL_SetError("Hi there!"); + printf("Error 1: %s\n", SDL_GetError()); + SDL_ClearError(); + SDL_memset(buffer, '1', BUFSIZ); + buffer[BUFSIZ] = 0; + SDL_SetError("This is the error: %s (%f)", buffer, 1.0); + printf("Error 2: %s\n", SDL_GetError()); + exit(0); +} +#endif + + +/* keep this at the end of the file so it works with GCC builds that don't + support "#pragma GCC diagnostic push" ... we'll just leave the warning + disabled after this. */ +/* this pragma arrived in GCC 4.2 and causes a warning on older GCCs! Sigh. */ +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 2)))) #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif + /* This function has a bit more overhead than most error functions so that it supports internationalization and thread-safe errors. */ @@ -150,6 +229,22 @@ SDL_GetErrorMsg(char *errstr, int maxlen) && spot < (tmp + SDL_arraysize(tmp) - 2)) { *spot++ = *fmt++; } + if (*fmt == 'l') { + *spot++ = *fmt++; + *spot++ = *fmt++; + *spot++ = '\0'; + switch (spot[-2]) { + case 'i': case 'd': case 'u': + len = SDL_snprintf(msg, maxlen, tmp, + error->args[argi++].value_l); + if (len > 0) { + msg += len; + maxlen -= len; + } + break; + } + continue; + } *spot++ = *fmt++; *spot++ = '\0'; switch (spot[-2]) { @@ -220,63 +315,5 @@ SDL_GetErrorMsg(char *errstr, int maxlen) } return (errstr); } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - -/* Available for backwards compatibility */ -const char * -SDL_GetError(void) -{ - static char errmsg[SDL_ERRBUFIZE]; - - return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE); -} - -void -SDL_ClearError(void) -{ - SDL_error *error; - - error = SDL_GetErrBuf(); - error->error = 0; -} - -/* Very common errors go here */ -int -SDL_Error(SDL_errorcode code) -{ - switch (code) { - case SDL_ENOMEM: - return SDL_SetError("Out of memory"); - case SDL_EFREAD: - return SDL_SetError("Error reading from datastream"); - case SDL_EFWRITE: - return SDL_SetError("Error writing to datastream"); - case SDL_EFSEEK: - return SDL_SetError("Error seeking in datastream"); - case SDL_UNSUPPORTED: - return SDL_SetError("That operation is not supported"); - default: - return SDL_SetError("Unknown SDL error"); - } -} - -#ifdef TEST_ERROR -int -main(int argc, char *argv[]) -{ - char buffer[BUFSIZ + 1]; - - SDL_SetError("Hi there!"); - printf("Error 1: %s\n", SDL_GetError()); - SDL_ClearError(); - SDL_memset(buffer, '1', BUFSIZ); - buffer[BUFSIZ] = 0; - SDL_SetError("This is the error: %s (%f)", buffer, 1.0); - printf("Error 2: %s\n", SDL_GetError()); - exit(0); -} -#endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/SDL_error_c.h b/Engine/lib/sdl/src/SDL_error_c.h index 76ccf2b94..6bb9caaf8 100644 --- a/Engine/lib/sdl/src/SDL_error_c.h +++ b/Engine/lib/sdl/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ error messages */ -#ifndef _SDL_error_c_h -#define _SDL_error_c_h +#ifndef SDL_error_c_h_ +#define SDL_error_c_h_ #define ERR_MAX_STRLEN 128 #define ERR_MAX_ARGS 5 @@ -51,6 +51,7 @@ typedef struct SDL_error unsigned char value_c; #endif int value_i; + long value_l; double value_f; char buf[ERR_MAX_STRLEN]; } args[ERR_MAX_ARGS]; @@ -59,6 +60,6 @@ typedef struct SDL_error /* Defined in SDL_thread.c */ extern SDL_error *SDL_GetErrBuf(void); -#endif /* _SDL_error_c_h */ +#endif /* SDL_error_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/SDL_hints.c b/Engine/lib/sdl/src/SDL_hints.c index 390d94f9f..09689aa14 100644 --- a/Engine/lib/sdl/src/SDL_hints.c +++ b/Engine/lib/sdl/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -122,7 +122,7 @@ SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value) { const char *hint = SDL_GetHint(name); - if (!hint) { + if (!hint || !*hint) { return default_value; } if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { diff --git a/Engine/lib/sdl/src/SDL_internal.h b/Engine/lib/sdl/src/SDL_internal.h index 7e928501a..e0ba2a82c 100644 --- a/Engine/lib/sdl/src/SDL_internal.h +++ b/Engine/lib/sdl/src/SDL_internal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,22 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_internal_h -#define _SDL_internal_h +#ifndef SDL_internal_h_ +#define SDL_internal_h_ + +/* Many of SDL's features require _GNU_SOURCE on various platforms */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +/* This is for a variable-length array at the end of a struct: + struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; }; + Use this because GCC 2 needs different magic than other compilers. */ +#if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus) +#define SDL_VARIABLE_LENGTH_ARRAY 1 +#else +#define SDL_VARIABLE_LENGTH_ARRAY +#endif #include "dynapi/SDL_dynapi.h" @@ -33,6 +47,6 @@ #include "SDL_config.h" -#endif +#endif /* SDL_internal_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/SDL_log.c b/Engine/lib/sdl/src/SDL_log.c index 760cb13de..b1bf27d7a 100644 --- a/Engine/lib/sdl/src/SDL_log.c +++ b/Engine/lib/sdl/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,9 +50,7 @@ typedef struct SDL_LogLevel } SDL_LogLevel; /* The default log output function */ -static void SDL_LogOutput(void *userdata, - int category, SDL_LogPriority priority, - const char *message); +static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message); static SDL_LogLevel *SDL_loglevels; static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY; @@ -304,15 +302,15 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list SDL_stack_free(message); } -#if defined(__WIN32__) -/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */ +#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) +/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */ static int consoleAttached = 0; /* Handle to stderr output of console. */ static HANDLE stderrHandle = NULL; #endif -static void +static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message) { @@ -328,6 +326,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, BOOL attachResult; DWORD attachError; unsigned long charsWritten; + DWORD consoleMode; /* Maybe attach console and get stderr handle */ if (consoleAttached == 0) { @@ -335,7 +334,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, if (!attachResult) { attachError = GetLastError(); if (attachError == ERROR_INVALID_HANDLE) { - OutputDebugString(TEXT("Parent process has no console\r\n")); + /* This is expected when running from Visual Studio */ + /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/ consoleAttached = -1; } else if (attachError == ERROR_GEN_FAILURE) { OutputDebugString(TEXT("Could not attach to console of parent process\r\n")); @@ -351,9 +351,14 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, /* Newly attached */ consoleAttached = 1; } - + if (consoleAttached == 1) { stderrHandle = GetStdHandle(STD_ERROR_HANDLE); + + if (GetConsoleMode(stderrHandle, &consoleMode) == 0) { + /* WriteConsole fails if the output is redirected to a file. Must use WriteFile instead. */ + consoleAttached = 2; + } } } #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ @@ -375,6 +380,11 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, OutputDebugString(TEXT("Insufficient heap memory to write message\r\n")); } } + + } else if (consoleAttached == 2) { + if (!WriteFile(stderrHandle, output, lstrlenA(output), &charsWritten, NULL)) { + OutputDebugString(TEXT("Error calling WriteFile\r\n")); + } } #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ diff --git a/Engine/lib/sdl/src/atomic/SDL_atomic.c b/Engine/lib/sdl/src/atomic/SDL_atomic.c index db86d6eda..df4920139 100644 --- a/Engine/lib/sdl/src/atomic/SDL_atomic.c +++ b/Engine/lib/sdl/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,48 @@ #include #endif +/* The __atomic_load_n() intrinsic showed up in different times for different compilers. */ +#if defined(HAVE_GCC_ATOMICS) +# if defined(__clang__) +# if __has_builtin(__atomic_load_n) + /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have. + It might be in a later NDK or we might need an extra library? --ryan. */ +# if !defined(__ANDROID__) +# define HAVE_ATOMIC_LOAD_N 1 +# endif +# endif +# elif defined(__GNUC__) +# if (__GNUC__ >= 5) +# define HAVE_ATOMIC_LOAD_N 1 +# endif +# endif +#endif + +#if defined(__WATCOMC__) && defined(__386__) +#define HAVE_WATCOM_ATOMICS +extern _inline int _SDL_xchg_watcom(volatile int *a, int v); +#pragma aux _SDL_xchg_watcom = \ + "xchg [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; + +extern _inline unsigned char _SDL_cmpxchg_watcom(volatile int *a, int newval, int oldval); +#pragma aux _SDL_cmpxchg_watcom = \ + "lock cmpxchg [edx], ecx" \ + "setz al" \ + parm [edx] [ecx] [eax] \ + value [al] \ + modify exact [eax]; + +extern _inline int _SDL_xadd_watcom(volatile int *a, int v); +#pragma aux _SDL_xadd_watcom = \ + "lock xadd [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; +#endif /* __WATCOMC__ && __386__ */ + /* If any of the operations are not provided then we must emulate some of them. That means we need a nice implementation of spin locks @@ -58,7 +100,7 @@ Contributed by Bob Pendleton, bob@pendleton.com */ -#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) +#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS) #define EMULATE_CAS 1 #endif @@ -88,10 +130,12 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) { #ifdef HAVE_MSC_ATOMICS return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval); -#elif defined(__MACOSX__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); +#elif defined(HAVE_WATCOM_ATOMICS) + return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval); #elif defined(HAVE_GCC_ATOMICS) return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval); +#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); #elif defined(__SOLARIS__) && defined(_LP64) return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval); #elif defined(__SOLARIS__) && !defined(_LP64) @@ -119,12 +163,14 @@ SDL_AtomicCASPtr(void **a, void *oldval, void *newval) return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval); #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval); -#elif defined(__MACOSX__) && defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a); -#elif defined(__MACOSX__) && !defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); +#elif defined(HAVE_WATCOM_ATOMICS) + return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval); #elif defined(HAVE_GCC_ATOMICS) return __sync_bool_compare_and_swap(a, oldval, newval); +#elif defined(__MACOSX__) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a); +#elif defined(__MACOSX__) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); #elif defined(__SOLARIS__) return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval); #elif EMULATE_CAS @@ -148,6 +194,8 @@ SDL_AtomicSet(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS return _InterlockedExchange((long*)&a->value, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xchg_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(&a->value, v); #elif defined(__SOLARIS__) && defined(_LP64) @@ -170,6 +218,8 @@ SDL_AtomicSetPtr(void **a, void *v) return (void *) _InterlockedExchange((long *)a, (long) v); #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) return _InterlockedExchangePointer(a, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return (void *) _SDL_xchg_watcom((int *)a, (long)v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(a, v); #elif defined(__SOLARIS__) @@ -188,6 +238,8 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS return _InterlockedExchangeAdd((long*)&a->value, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xadd_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_fetch_and_add(&a->value, v); #elif defined(__SOLARIS__) @@ -211,36 +263,41 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v) int SDL_AtomicGet(SDL_atomic_t *a) { +#ifdef HAVE_ATOMIC_LOAD_N + return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); +#else int value; do { value = a->value; } while (!SDL_AtomicCAS(a, value, value)); return value; +#endif } void * SDL_AtomicGetPtr(void **a) { +#ifdef HAVE_ATOMIC_LOAD_N + return __atomic_load_n(a, __ATOMIC_SEQ_CST); +#else void *value; do { value = *a; } while (!SDL_AtomicCASPtr(a, value, value)); return value; +#endif } -#ifdef __thumb__ -#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) -__asm__( -" .align 2\n" -" .globl _SDL_MemoryBarrierRelease\n" -" .globl _SDL_MemoryBarrierAcquire\n" -"_SDL_MemoryBarrierRelease:\n" -"_SDL_MemoryBarrierAcquire:\n" -" mov r0, #0\n" -" mcr p15, 0, r0, c7, c10, 5\n" -" bx lr\n" -); -#endif -#endif +void +SDL_MemoryBarrierReleaseFunction(void) +{ + SDL_MemoryBarrierRelease(); +} + +void +SDL_MemoryBarrierAcquireFunction(void) +{ + SDL_MemoryBarrierAcquire(); +} /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/atomic/SDL_spinlock.c b/Engine/lib/sdl/src/atomic/SDL_spinlock.c index f582afb4e..1ebc71887 100644 --- a/Engine/lib/sdl/src/atomic/SDL_spinlock.c +++ b/Engine/lib/sdl/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,16 @@ #include #endif +#if defined(__WATCOMC__) && defined(__386__) +SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock)); +extern _inline int _SDL_xchg_watcom(volatile int *a, int v); +#pragma aux _SDL_xchg_watcom = \ + "xchg [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; +#endif /* __WATCOMC__ && __386__ */ + /* This function is where all the magic happens... */ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) @@ -58,6 +68,9 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long)); return (InterlockedExchange((long*)lock, 1) == 0); +#elif defined(__WATCOMC__) && defined(__386__) + return _SDL_xchg_watcom(lock, 1) == 0; + #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET return (__sync_lock_test_and_set(lock, 1) == 0); @@ -119,6 +132,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock) _ReadWriteBarrier(); *lock = 0; +#elif defined(__WATCOMC__) && defined(__386__) + SDL_CompilerBarrier (); + *lock = 0; + #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET __sync_lock_release(lock); diff --git a/Engine/lib/sdl/src/audio/SDL_audio.c b/Engine/lib/sdl/src/audio/SDL_audio.c index 460852d7f..dcaebea6d 100644 --- a/Engine/lib/sdl/src/audio/SDL_audio.c +++ b/Engine/lib/sdl/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,36 +33,6 @@ static SDL_AudioDriver current_audio; static SDL_AudioDevice *open_devices[16]; -/* - * Not all of these will be compiled and linked in, but it's convenient - * to have a complete list here and saves yet-another block of #ifdefs... - * Please see bootstrap[], below, for the actual #ifdef mess. - */ -extern AudioBootStrap PULSEAUDIO_bootstrap; -extern AudioBootStrap ALSA_bootstrap; -extern AudioBootStrap SNDIO_bootstrap; -extern AudioBootStrap BSD_AUDIO_bootstrap; -extern AudioBootStrap DSP_bootstrap; -extern AudioBootStrap QSAAUDIO_bootstrap; -extern AudioBootStrap SUNAUDIO_bootstrap; -extern AudioBootStrap ARTS_bootstrap; -extern AudioBootStrap ESD_bootstrap; -extern AudioBootStrap NACLAUDIO_bootstrap; -extern AudioBootStrap NAS_bootstrap; -extern AudioBootStrap XAUDIO2_bootstrap; -extern AudioBootStrap DSOUND_bootstrap; -extern AudioBootStrap WINMM_bootstrap; -extern AudioBootStrap PAUDIO_bootstrap; -extern AudioBootStrap HAIKUAUDIO_bootstrap; -extern AudioBootStrap COREAUDIO_bootstrap; -extern AudioBootStrap DISKAUDIO_bootstrap; -extern AudioBootStrap DUMMYAUDIO_bootstrap; -extern AudioBootStrap FUSIONSOUND_bootstrap; -extern AudioBootStrap ANDROIDAUDIO_bootstrap; -extern AudioBootStrap PSPAUDIO_bootstrap; -extern AudioBootStrap SNDIO_bootstrap; -extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; - /* Available audio drivers */ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_PULSEAUDIO @@ -74,8 +44,8 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_SNDIO &SNDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_BSD - &BSD_AUDIO_bootstrap, +#if SDL_AUDIO_DRIVER_NETBSD + &NETBSDAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, @@ -98,8 +68,8 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_NAS &NAS_bootstrap, #endif -#if SDL_AUDIO_DRIVER_XAUDIO2 - &XAUDIO2_bootstrap, +#if SDL_AUDIO_DRIVER_WASAPI + &WASAPI_bootstrap, #endif #if SDL_AUDIO_DRIVER_DSOUND &DSOUND_bootstrap, @@ -116,12 +86,6 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_COREAUDIO &COREAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DISK - &DISKAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_DUMMY - &DUMMYAUDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_FUSIONSOUND &FUSIONSOUND_bootstrap, #endif @@ -133,10 +97,102 @@ static const AudioBootStrap *const bootstrap[] = { #endif #if SDL_AUDIO_DRIVER_EMSCRIPTEN &EMSCRIPTENAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_JACK + &JACK_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DISK + &DISKAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DUMMY + &DUMMYAUDIO_bootstrap, #endif NULL }; + +#ifdef HAVE_LIBSAMPLERATE_H +#ifdef SDL_LIBSAMPLERATE_DYNAMIC +static void *SRC_lib = NULL; +#endif +SDL_bool SRC_available = SDL_FALSE; +int SRC_converter = 0; +SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error) = NULL; +int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data) = NULL; +int (*SRC_src_reset)(SRC_STATE *state) = NULL; +SRC_STATE* (*SRC_src_delete)(SRC_STATE *state) = NULL; +const char* (*SRC_src_strerror)(int error) = NULL; + +static SDL_bool +LoadLibSampleRate(void) +{ + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_RESAMPLING_MODE); + + SRC_available = SDL_FALSE; + SRC_converter = 0; + + if (!hint || *hint == '0' || SDL_strcasecmp(hint, "default") == 0) { + return SDL_FALSE; /* don't load anything. */ + } else if (*hint == '1' || SDL_strcasecmp(hint, "fast") == 0) { + SRC_converter = SRC_SINC_FASTEST; + } else if (*hint == '2' || SDL_strcasecmp(hint, "medium") == 0) { + SRC_converter = SRC_SINC_MEDIUM_QUALITY; + } else if (*hint == '3' || SDL_strcasecmp(hint, "best") == 0) { + SRC_converter = SRC_SINC_BEST_QUALITY; + } else { + return SDL_FALSE; /* treat it like "default", don't load anything. */ + } + +#ifdef SDL_LIBSAMPLERATE_DYNAMIC + SDL_assert(SRC_lib == NULL); + SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC); + if (!SRC_lib) { + SDL_ClearError(); + return SDL_FALSE; + } + + SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new"); + SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process"); + SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset"); + SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete"); + SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror"); + + if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) { + SDL_UnloadObject(SRC_lib); + SRC_lib = NULL; + return SDL_FALSE; + } +#else + SRC_src_new = src_new; + SRC_src_process = src_process; + SRC_src_reset = src_reset; + SRC_src_delete = src_delete; + SRC_src_strerror = src_strerror; +#endif + + SRC_available = SDL_TRUE; + return SDL_TRUE; +} + +static void +UnloadLibSampleRate(void) +{ +#ifdef SDL_LIBSAMPLERATE_DYNAMIC + if (SRC_lib != NULL) { + SDL_UnloadObject(SRC_lib); + } + SRC_lib = NULL; +#endif + + SRC_available = SDL_FALSE; + SRC_src_new = NULL; + SRC_src_process = NULL; + SRC_src_reset = NULL; + SRC_src_delete = NULL; + SRC_src_strerror = NULL; +} +#endif + static SDL_AudioDevice * get_audio_device(SDL_AudioDeviceID id) { @@ -169,6 +225,16 @@ SDL_AudioThreadInit_Default(_THIS) { /* no-op. */ } +static void +SDL_AudioThreadDeinit_Default(_THIS) +{ /* no-op. */ +} + +static void +SDL_AudioBeginLoopIteration_Default(_THIS) +{ /* no-op. */ +} + static void SDL_AudioWaitDevice_Default(_THIS) { /* no-op. */ @@ -288,6 +354,8 @@ finish_audio_entry_points_init(void) FILL_STUB(DetectDevices); FILL_STUB(OpenDevice); FILL_STUB(ThreadInit); + FILL_STUB(ThreadDeinit); + FILL_STUB(BeginLoopIteration); FILL_STUB(WaitDevice); FILL_STUB(PlayDevice); FILL_STUB(GetPendingBytes); @@ -448,136 +516,23 @@ SDL_RemoveAudioDevice(const int iscapture, void *handle) /* buffer queueing support... */ -/* this expects that you managed thread safety elsewhere. */ -static void -free_audio_queue(SDL_AudioBufferQueue *packet) -{ - while (packet) { - SDL_AudioBufferQueue *next = packet->next; - SDL_free(packet); - packet = next; - } -} - -/* NOTE: This assumes you'll hold the mixer lock before calling! */ -static int -queue_audio_to_device(SDL_AudioDevice *device, const Uint8 *data, Uint32 len) -{ - SDL_AudioBufferQueue *orighead; - SDL_AudioBufferQueue *origtail; - Uint32 origlen; - Uint32 datalen; - - orighead = device->buffer_queue_head; - origtail = device->buffer_queue_tail; - origlen = origtail ? origtail->datalen : 0; - - while (len > 0) { - SDL_AudioBufferQueue *packet = device->buffer_queue_tail; - SDL_assert(!packet || (packet->datalen <= SDL_AUDIOBUFFERQUEUE_PACKETLEN)); - if (!packet || (packet->datalen >= SDL_AUDIOBUFFERQUEUE_PACKETLEN)) { - /* tail packet missing or completely full; we need a new packet. */ - packet = device->buffer_queue_pool; - if (packet != NULL) { - /* we have one available in the pool. */ - device->buffer_queue_pool = packet->next; - } else { - /* Have to allocate a new one! */ - packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue)); - if (packet == NULL) { - /* uhoh, reset so we've queued nothing new, free what we can. */ - if (!origtail) { - packet = device->buffer_queue_head; /* whole queue. */ - } else { - packet = origtail->next; /* what we added to existing queue. */ - origtail->next = NULL; - origtail->datalen = origlen; - } - device->buffer_queue_head = orighead; - device->buffer_queue_tail = origtail; - device->buffer_queue_pool = NULL; - - free_audio_queue(packet); /* give back what we can. */ - - return SDL_OutOfMemory(); - } - } - packet->datalen = 0; - packet->startpos = 0; - packet->next = NULL; - - SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0)); - if (device->buffer_queue_tail == NULL) { - device->buffer_queue_head = packet; - } else { - device->buffer_queue_tail->next = packet; - } - device->buffer_queue_tail = packet; - } - - datalen = SDL_min(len, SDL_AUDIOBUFFERQUEUE_PACKETLEN - packet->datalen); - SDL_memcpy(packet->data + packet->datalen, data, datalen); - data += datalen; - len -= datalen; - packet->datalen += datalen; - device->queued_bytes += datalen; - } - - return 0; -} - -/* NOTE: This assumes you'll hold the mixer lock before calling! */ -static Uint32 -dequeue_audio_from_device(SDL_AudioDevice *device, Uint8 *stream, Uint32 len) -{ - SDL_AudioBufferQueue *packet; - Uint8 *ptr = stream; - - while ((len > 0) && ((packet = device->buffer_queue_head) != NULL)) { - const Uint32 avail = packet->datalen - packet->startpos; - const Uint32 cpy = SDL_min(len, avail); - SDL_assert(device->queued_bytes >= avail); - - SDL_memcpy(ptr, packet->data + packet->startpos, cpy); - packet->startpos += cpy; - ptr += cpy; - device->queued_bytes -= cpy; - len -= cpy; - - if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */ - device->buffer_queue_head = packet->next; - SDL_assert((packet->next != NULL) || (packet == device->buffer_queue_tail)); - packet->next = device->buffer_queue_pool; - device->buffer_queue_pool = packet; - } - } - - SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0)); - - if (device->buffer_queue_head == NULL) { - device->buffer_queue_tail = NULL; /* in case we drained the queue entirely. */ - } - - return (Uint32) (ptr - stream); -} - static void SDLCALL SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int len) { /* this function always holds the mixer lock before being called. */ SDL_AudioDevice *device = (SDL_AudioDevice *) userdata; - Uint32 written; + size_t dequeued; SDL_assert(device != NULL); /* this shouldn't ever happen, right?! */ SDL_assert(!device->iscapture); /* this shouldn't ever happen, right?! */ SDL_assert(len >= 0); /* this shouldn't ever happen, right?! */ - written = dequeue_audio_from_device(device, stream, (Uint32) len); - stream += written; - len -= (int) written; + dequeued = SDL_ReadFromDataQueue(device->buffer_queue, stream, len); + stream += dequeued; + len -= (int) dequeued; if (len > 0) { /* fill any remaining space in the stream with silence. */ - SDL_assert(device->buffer_queue_head == NULL); + SDL_assert(SDL_CountDataQueue(device->buffer_queue) == 0); SDL_memset(stream, device->spec.silence, len); } } @@ -595,7 +550,7 @@ SDL_BufferQueueFillCallback(void *userdata, Uint8 *stream, int len) /* note that if this needs to allocate more space and run out of memory, we have no choice but to quietly drop the data and hope it works out later, but you probably have bigger problems in this case anyhow. */ - queue_audio_to_device(device, stream, (Uint32) len); + SDL_WriteToDataQueue(device->buffer_queue, stream, len); } int @@ -608,13 +563,13 @@ SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len) return -1; /* get_audio_device() will have set the error state */ } else if (device->iscapture) { return SDL_SetError("This is a capture device, queueing not allowed"); - } else if (device->spec.callback != SDL_BufferQueueDrainCallback) { + } else if (device->callbackspec.callback != SDL_BufferQueueDrainCallback) { return SDL_SetError("Audio device has a callback, queueing not allowed"); } if (len > 0) { current_audio.impl.LockDevice(device); - rc = queue_audio_to_device(device, data, len); + rc = SDL_WriteToDataQueue(device->buffer_queue, data, len); current_audio.impl.UnlockDevice(device); } @@ -630,12 +585,12 @@ SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len) if ( (len == 0) || /* nothing to do? */ (!device) || /* called with bogus device id */ (!device->iscapture) || /* playback devices can't dequeue */ - (device->spec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */ + (device->callbackspec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */ return 0; /* just report zero bytes dequeued. */ } current_audio.impl.LockDevice(device); - rc = dequeue_audio_from_device(device, data, len); + rc = (Uint32) SDL_ReadFromDataQueue(device->buffer_queue, data, len); current_audio.impl.UnlockDevice(device); return rc; } @@ -651,13 +606,13 @@ SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid) } /* Nothing to do unless we're set up for queueing. */ - if (device->spec.callback == SDL_BufferQueueDrainCallback) { + if (device->callbackspec.callback == SDL_BufferQueueDrainCallback) { current_audio.impl.LockDevice(device); - retval = device->queued_bytes + current_audio.impl.GetPendingBytes(device); + retval = ((Uint32) SDL_CountDataQueue(device->buffer_queue)) + current_audio.impl.GetPendingBytes(device); current_audio.impl.UnlockDevice(device); - } else if (device->spec.callback == SDL_BufferQueueFillCallback) { + } else if (device->callbackspec.callback == SDL_BufferQueueFillCallback) { current_audio.impl.LockDevice(device); - retval = device->queued_bytes; + retval = (Uint32) SDL_CountDataQueue(device->buffer_queue); current_audio.impl.UnlockDevice(device); } @@ -668,7 +623,6 @@ void SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) { SDL_AudioDevice *device = get_audio_device(devid); - SDL_AudioBufferQueue *packet; if (!device) { return; /* nothing to do. */ @@ -677,35 +631,10 @@ SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) /* Blank out the device and release the mutex. Free it afterwards. */ current_audio.impl.LockDevice(device); - /* merge the available pool and the current queue into one list. */ - packet = device->buffer_queue_head; - if (packet) { - device->buffer_queue_tail->next = device->buffer_queue_pool; - } else { - packet = device->buffer_queue_pool; - } - - /* Remove the queued packets from the device. */ - device->buffer_queue_tail = NULL; - device->buffer_queue_head = NULL; - device->queued_bytes = 0; - device->buffer_queue_pool = packet; - /* Keep up to two packets in the pool to reduce future malloc pressure. */ - if (packet) { - if (!packet->next) { - packet = NULL; /* one packet (the only one) for the pool. */ - } else { - SDL_AudioBufferQueue *next = packet->next->next; - packet->next->next = NULL; /* two packets for the pool. */ - packet = next; /* rest will be freed. */ - } - } + SDL_ClearDataQueue(device->buffer_queue, SDL_AUDIOBUFFERQUEUE_PACKETLEN * 2); current_audio.impl.UnlockDevice(device); - - /* free any extra packets we didn't keep in the pool. */ - free_audio_queue(packet); } @@ -714,12 +643,10 @@ static int SDLCALL SDL_RunAudio(void *devicep) { SDL_AudioDevice *device = (SDL_AudioDevice *) devicep; - const int silence = (int) device->spec.silence; - const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); - const int stream_len = (device->convert.needed) ? device->convert.len : device->spec.size; - Uint8 *stream; - void *udata = device->spec.userdata; - void (SDLCALL *callback) (void *, Uint8 *, int) = device->spec.callback; + void *udata = device->callbackspec.userdata; + SDL_AudioCallback callback = device->callbackspec.callback; + int data_len = 0; + Uint8 *data; SDL_assert(!device->iscapture); @@ -732,51 +659,64 @@ SDL_RunAudio(void *devicep) /* Loop, filling the audio buffers */ while (!SDL_AtomicGet(&device->shutdown)) { + current_audio.impl.BeginLoopIteration(device); + data_len = device->callbackspec.size; + /* Fill the current buffer with sound */ - if (device->convert.needed) { - stream = device->convert.buf; - } else if (SDL_AtomicGet(&device->enabled)) { - stream = current_audio.impl.GetDeviceBuf(device); + if (!device->stream && SDL_AtomicGet(&device->enabled)) { + SDL_assert(data_len == device->spec.size); + data = current_audio.impl.GetDeviceBuf(device); } else { /* if the device isn't enabled, we still write to the - fake_stream, so the app's callback will fire with + work_buffer, so the app's callback will fire with a regular frequency, in case they depend on that for timing or progress. They can use hotplug - now to know if the device failed. */ - stream = NULL; + now to know if the device failed. + Streaming playback uses work_buffer, too. */ + data = NULL; } - if (stream == NULL) { - stream = device->fake_stream; + if (data == NULL) { + data = device->work_buffer; } /* !!! FIXME: this should be LockDevice. */ - if ( SDL_AtomicGet(&device->enabled) ) { - SDL_LockMutex(device->mixer_lock); - if (SDL_AtomicGet(&device->paused)) { - SDL_memset(stream, silence, stream_len); - } else { - (*callback) (udata, stream, stream_len); - } - SDL_UnlockMutex(device->mixer_lock); - } - - /* Convert the audio if necessary */ - if (device->convert.needed && SDL_AtomicGet(&device->enabled)) { - SDL_ConvertAudio(&device->convert); - stream = current_audio.impl.GetDeviceBuf(device); - if (stream == NULL) { - stream = device->fake_stream; - } else { - SDL_memcpy(stream, device->convert.buf, - device->convert.len_cvt); - } - } - - /* Ready current buffer for play and change current buffer */ - if (stream == device->fake_stream) { - SDL_Delay(delay); + SDL_LockMutex(device->mixer_lock); + if (SDL_AtomicGet(&device->paused)) { + SDL_memset(data, device->spec.silence, data_len); } else { + callback(udata, data, data_len); + } + SDL_UnlockMutex(device->mixer_lock); + + if (device->stream) { + /* Stream available audio to device, converting/resampling. */ + /* if this fails...oh well. We'll play silence here. */ + SDL_AudioStreamPut(device->stream, data, data_len); + + while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->spec.size)) { + int got; + data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL; + got = SDL_AudioStreamGet(device->stream, data ? data : device->work_buffer, device->spec.size); + SDL_assert((got < 0) || (got == device->spec.size)); + + if (data == NULL) { /* device is having issues... */ + const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); + SDL_Delay(delay); /* wait for as long as this buffer would have played. Maybe device recovers later? */ + } else { + if (got != device->spec.size) { + SDL_memset(data, device->spec.silence, device->spec.size); + } + current_audio.impl.PlayDevice(device); + current_audio.impl.WaitDevice(device); + } + } + } else if (data == device->work_buffer) { + /* nothing to do; pause like we queued a buffer to play. */ + const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); + SDL_Delay(delay); + } else { /* writing directly to the device. */ + /* queue this buffer and wait for it to finish playing. */ current_audio.impl.PlayDevice(device); current_audio.impl.WaitDevice(device); } @@ -787,9 +727,12 @@ SDL_RunAudio(void *devicep) /* Wait for the audio to drain. */ SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2); + current_audio.impl.ThreadDeinit(device); + return 0; } +/* !!! FIXME: this needs to deal with device spec changes. */ /* The general capture thread function */ static int SDLCALL SDL_CaptureAudio(void *devicep) @@ -797,10 +740,10 @@ SDL_CaptureAudio(void *devicep) SDL_AudioDevice *device = (SDL_AudioDevice *) devicep; const int silence = (int) device->spec.silence; const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); - const int stream_len = (device->convert.needed) ? device->convert.len : device->spec.size; - Uint8 *stream; - void *udata = device->spec.userdata; - void (SDLCALL *callback) (void *, Uint8 *, int) = device->spec.callback; + const int data_len = device->spec.size; + Uint8 *data; + void *udata = device->callbackspec.userdata; + SDL_AudioCallback callback = device->callbackspec.callback; SDL_assert(device->iscapture); @@ -816,34 +759,43 @@ SDL_CaptureAudio(void *devicep) int still_need; Uint8 *ptr; - if (!SDL_AtomicGet(&device->enabled) || SDL_AtomicGet(&device->paused)) { + current_audio.impl.BeginLoopIteration(device); + + if (SDL_AtomicGet(&device->paused)) { SDL_Delay(delay); /* just so we don't cook the CPU. */ + if (device->stream) { + SDL_AudioStreamClear(device->stream); + } current_audio.impl.FlushCapture(device); /* dump anything pending. */ continue; } /* Fill the current buffer with sound */ - still_need = stream_len; - if (device->convert.needed) { - ptr = stream = device->convert.buf; - } else { - /* just use the "fake" stream to hold data read from the device. */ - ptr = stream = device->fake_stream; - } + still_need = data_len; + + /* Use the work_buffer to hold data read from the device. */ + data = device->work_buffer; + SDL_assert(data != NULL); + + ptr = data; /* We still read from the device when "paused" to keep the state sane, and block when there isn't data so this thread isn't eating CPU. But we don't process it further or call the app's callback. */ - while (still_need > 0) { - const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need); - SDL_assert(rc <= still_need); /* device should not overflow buffer. :) */ - if (rc > 0) { - still_need -= rc; - ptr += rc; - } else { /* uhoh, device failed for some reason! */ - SDL_OpenedAudioDeviceDisconnected(device); - break; + if (!SDL_AtomicGet(&device->enabled)) { + SDL_Delay(delay); /* try to keep callback firing at normal pace. */ + } else { + while (still_need > 0) { + const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need); + SDL_assert(rc <= still_need); /* device should not overflow buffer. :) */ + if (rc > 0) { + still_need -= rc; + ptr += rc; + } else { /* uhoh, device failed for some reason! */ + SDL_OpenedAudioDeviceDisconnected(device); + break; + } } } @@ -852,22 +804,38 @@ SDL_CaptureAudio(void *devicep) SDL_memset(ptr, silence, still_need); } - if (device->convert.needed) { - SDL_ConvertAudio(&device->convert); - } + if (device->stream) { + /* if this fails...oh well. */ + SDL_AudioStreamPut(device->stream, data, data_len); - /* !!! FIXME: this should be LockDevice. */ - SDL_LockMutex(device->mixer_lock); - if (SDL_AtomicGet(&device->paused)) { - current_audio.impl.FlushCapture(device); /* one snuck in! */ - } else { - (*callback)(udata, stream, stream_len); + while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->callbackspec.size)) { + const int got = SDL_AudioStreamGet(device->stream, device->work_buffer, device->callbackspec.size); + SDL_assert((got < 0) || (got == device->callbackspec.size)); + if (got != device->callbackspec.size) { + SDL_memset(device->work_buffer, device->spec.silence, device->callbackspec.size); + } + + /* !!! FIXME: this should be LockDevice. */ + SDL_LockMutex(device->mixer_lock); + if (!SDL_AtomicGet(&device->paused)) { + callback(udata, device->work_buffer, device->callbackspec.size); + } + SDL_UnlockMutex(device->mixer_lock); + } + } else { /* feeding user callback directly without streaming. */ + /* !!! FIXME: this should be LockDevice. */ + SDL_LockMutex(device->mixer_lock); + if (!SDL_AtomicGet(&device->paused)) { + callback(udata, data, device->callbackspec.size); + } + SDL_UnlockMutex(device->mixer_lock); } - SDL_UnlockMutex(device->mixer_lock); } current_audio.impl.FlushCapture(device); + current_audio.impl.ThreadDeinit(device); + return 0; } @@ -968,6 +936,10 @@ SDL_AudioInit(const char *driver_name) /* Make sure we have a list of devices available at startup. */ current_audio.impl.DetectDevices(); +#ifdef HAVE_LIBSAMPLERATE_H + LoadLibSampleRate(); +#endif + return 0; } @@ -1098,16 +1070,15 @@ close_audio_device(SDL_AudioDevice * device) if (device->mixer_lock != NULL) { SDL_DestroyMutex(device->mixer_lock); } - SDL_free(device->fake_stream); - if (device->convert.needed) { - SDL_free(device->convert.buf); - } + + SDL_free(device->work_buffer); + SDL_FreeAudioStream(device->stream); + if (device->hidden != NULL) { current_audio.impl.CloseDevice(device); } - free_audio_queue(device->buffer_queue_head); - free_audio_queue(device->buffer_queue_pool); + SDL_FreeDataQueue(device->buffer_queue); SDL_free(device); } @@ -1180,11 +1151,11 @@ open_audio_device(const char *devname, int iscapture, const SDL_AudioSpec * desired, SDL_AudioSpec * obtained, int allowed_changes, int min_id) { - const SDL_bool is_internal_thread = (desired->callback != NULL); + const SDL_bool is_internal_thread = (desired->callback == NULL); SDL_AudioDeviceID id = 0; SDL_AudioSpec _obtained; SDL_AudioDevice *device; - SDL_bool build_cvt; + SDL_bool build_stream; void *handle = NULL; int i = 0; @@ -1319,84 +1290,87 @@ open_audio_device(const char *devname, int iscapture, SDL_assert(device->hidden != NULL); /* See if we need to do any conversion */ - build_cvt = SDL_FALSE; + build_stream = SDL_FALSE; if (obtained->freq != device->spec.freq) { if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) { obtained->freq = device->spec.freq; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } if (obtained->format != device->spec.format) { if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) { obtained->format = device->spec.format; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } if (obtained->channels != device->spec.channels) { if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) { obtained->channels = device->spec.channels; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } - /* If the audio driver changes the buffer size, accept it. - This needs to be done after the format is modified above, - otherwise it might not have the correct buffer size. + /* !!! FIXME in 2.1: add SDL_AUDIO_ALLOW_SAMPLES_CHANGE flag? + As of 2.0.6, we will build a stream to buffer the difference between + what the app wants to feed and the device wants to eat, so everyone + gets their way. In prior releases, SDL would force the callback to + feed at the rate the device requested, adjusted for resampling. */ if (device->spec.samples != obtained->samples) { - obtained->samples = device->spec.samples; - SDL_CalculateAudioSpec(obtained); + build_stream = SDL_TRUE; } - if (build_cvt) { - /* Build an audio conversion block */ - if (SDL_BuildAudioCVT(&device->convert, - obtained->format, obtained->channels, - obtained->freq, - device->spec.format, device->spec.channels, - device->spec.freq) < 0) { + SDL_CalculateAudioSpec(obtained); /* recalc after possible changes. */ + + device->callbackspec = *obtained; + + if (build_stream) { + if (iscapture) { + device->stream = SDL_NewAudioStream(device->spec.format, + device->spec.channels, device->spec.freq, + obtained->format, obtained->channels, obtained->freq); + } else { + device->stream = SDL_NewAudioStream(obtained->format, obtained->channels, + obtained->freq, device->spec.format, + device->spec.channels, device->spec.freq); + } + + if (!device->stream) { close_audio_device(device); return 0; } - if (device->convert.needed) { - device->convert.len = (int) (((double) device->spec.size) / - device->convert.len_ratio); - - device->convert.buf = - (Uint8 *) SDL_malloc(device->convert.len * - device->convert.len_mult); - if (device->convert.buf == NULL) { - close_audio_device(device); - SDL_OutOfMemory(); - return 0; - } - } } if (device->spec.callback == NULL) { /* use buffer queueing? */ /* pool a few packets to start. Enough for two callbacks. */ - const int packetlen = SDL_AUDIOBUFFERQUEUE_PACKETLEN; - const int wantbytes = ((device->convert.needed) ? device->convert.len : device->spec.size) * 2; - const int wantpackets = (wantbytes / packetlen) + ((wantbytes % packetlen) ? packetlen : 0); - for (i = 0; i < wantpackets; i++) { - SDL_AudioBufferQueue *packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue)); - if (packet) { /* don't care if this fails, we'll deal later. */ - packet->datalen = 0; - packet->startpos = 0; - packet->next = device->buffer_queue_pool; - device->buffer_queue_pool = packet; - } + device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2); + if (!device->buffer_queue) { + close_audio_device(device); + SDL_SetError("Couldn't create audio buffer queue"); + return 0; } - - device->spec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback; - device->spec.userdata = device; + device->callbackspec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback; + device->callbackspec.userdata = device; } - /* add it to our list of open devices. */ - open_devices[id] = device; + /* Allocate a scratch audio buffer */ + device->work_buffer_len = build_stream ? device->callbackspec.size : 0; + if (device->spec.size > device->work_buffer_len) { + device->work_buffer_len = device->spec.size; + } + SDL_assert(device->work_buffer_len > 0); + + device->work_buffer = (Uint8 *) SDL_malloc(device->work_buffer_len); + if (device->work_buffer == NULL) { + close_audio_device(device); + SDL_OutOfMemory(); + return 0; + } + + open_devices[id] = device; /* add it to our list of open devices. */ /* Start the audio thread if necessary */ if (!current_audio.impl.ProvidesOwnCallbackThread) { @@ -1406,21 +1380,7 @@ open_audio_device(const char *devname, int iscapture, const size_t stacksize = is_internal_thread ? 64 * 1024 : 0; char threadname[64]; - /* Allocate a fake audio buffer; only used by our internal threads. */ - Uint32 stream_len = (device->convert.needed) ? device->convert.len_cvt : 0; - if (device->spec.size > stream_len) { - stream_len = device->spec.size; - } - SDL_assert(stream_len > 0); - - device->fake_stream = (Uint8 *) SDL_malloc(stream_len); - if (device->fake_stream == NULL) { - close_audio_device(device); - SDL_OutOfMemory(); - return 0; - } - - SDL_snprintf(threadname, sizeof (threadname), "SDLAudioDev%d", (int) device->id); + SDL_snprintf(threadname, sizeof (threadname), "SDLAudio%c%d", (iscapture) ? 'C' : 'P', (int) device->id); device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device); if (device->thread == NULL) { @@ -1456,7 +1416,14 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) id = open_audio_device(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE, 1); } else { - id = open_audio_device(NULL, 0, desired, NULL, 0, 1); + SDL_AudioSpec _obtained; + SDL_zero(_obtained); + id = open_audio_device(NULL, 0, desired, &_obtained, 0, 1); + /* On successful open, copy calculated values into 'desired'. */ + if (id > 0) { + desired->size = _obtained.size; + desired->silence = _obtained.silence; + } } SDL_assert((id == 0) || (id == 1)); @@ -1579,6 +1546,12 @@ SDL_AudioQuit(void) SDL_zero(current_audio); SDL_zero(open_devices); + +#ifdef HAVE_LIBSAMPLERATE_H + UnloadLibSampleRate(); +#endif + + SDL_FreeResampleFilter(); } #define NUM_FORMATS 10 @@ -1655,13 +1628,7 @@ SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume) /* Mix the user-level audio format */ SDL_AudioDevice *device = get_audio_device(1); if (device != NULL) { - SDL_AudioFormat format; - if (device->convert.needed) { - format = device->convert.src_format; - } else { - format = device->spec.format; - } - SDL_MixAudioFormat(dst, src, format, len, volume); + SDL_MixAudioFormat(dst, src, device->callbackspec.format, len, volume); } } diff --git a/Engine/lib/sdl/src/audio/SDL_audio_c.h b/Engine/lib/sdl/src/audio/SDL_audio_c.h index 7cde3a662..d47ebb130 100644 --- a/Engine/lib/sdl/src/audio/SDL_audio_c.h +++ b/Engine/lib/sdl/src/audio/SDL_audio_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,35 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_audio_c_h_ +#define SDL_audio_c_h_ + #include "../SDL_internal.h" +#ifndef DEBUG_CONVERT +#define DEBUG_CONVERT 0 +#endif + +#if DEBUG_CONVERT +#define LOG_DEBUG_CONVERT(from, to) fprintf(stderr, "Converting %s to %s.\n", from, to); +#else +#define LOG_DEBUG_CONVERT(from, to) +#endif + /* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */ +#ifdef HAVE_LIBSAMPLERATE_H +#include "samplerate.h" +extern SDL_bool SRC_available; +extern int SRC_converter; +extern SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error); +extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data); +extern int (*SRC_src_reset)(SRC_STATE *state); +extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state); +extern const char* (*SRC_src_strerror)(int error); +#endif + /* Functions to get a list of "close" audio formats */ extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format); extern SDL_AudioFormat SDL_NextAudioFormat(void); @@ -29,24 +54,26 @@ extern SDL_AudioFormat SDL_NextAudioFormat(void); /* Function to calculate the size and silence for a SDL_AudioSpec */ extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec); -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat src_fmt; - SDL_AudioFormat dst_fmt; - SDL_AudioFilter filter; -} SDL_AudioTypeFilters; -extern const SDL_AudioTypeFilters sdl_audio_type_filters[]; +/* Choose the audio filter functions below */ +extern void SDL_ChooseAudioConverters(void); -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat fmt; - int channels; - int upsample; - int multiple; - SDL_AudioFilter filter; -} SDL_AudioRateFilters; -extern const SDL_AudioRateFilters sdl_audio_rate_filters[]; +/* These pointers get set during SDL_ChooseAudioConverters() to various SIMD implementations. */ +extern SDL_AudioFilter SDL_Convert_S8_to_F32; +extern SDL_AudioFilter SDL_Convert_U8_to_F32; +extern SDL_AudioFilter SDL_Convert_S16_to_F32; +extern SDL_AudioFilter SDL_Convert_U16_to_F32; +extern SDL_AudioFilter SDL_Convert_S32_to_F32; +extern SDL_AudioFilter SDL_Convert_F32_to_S8; +extern SDL_AudioFilter SDL_Convert_F32_to_U8; +extern SDL_AudioFilter SDL_Convert_F32_to_S16; +extern SDL_AudioFilter SDL_Convert_F32_to_U16; +extern SDL_AudioFilter SDL_Convert_F32_to_S32; + +/* You need to call SDL_PrepareResampleFilter() before using the internal resampler. + SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */ +extern int SDL_PrepareResampleFilter(void); +extern void SDL_FreeResampleFilter(void); + +#endif /* SDL_audio_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/SDL_audiocvt.c b/Engine/lib/sdl/src/audio/SDL_audiocvt.c index 3b47c4cbc..7fde2b93c 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiocvt.c +++ b/Engine/lib/sdl/src/audio/SDL_audiocvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,165 +22,73 @@ /* Functions for audio drivers to perform runtime conversion of audio format */ +/* FIXME: Channel weights when converting from more channels to fewer may need to be adjusted, see https://msdn.microsoft.com/en-us/library/windows/desktop/ff819070(v=vs.85).aspx +*/ + +#include "SDL.h" #include "SDL_audio.h" #include "SDL_audio_c.h" +#include "SDL_loadso.h" #include "SDL_assert.h" +#include "../SDL_dataqueue.h" +#include "SDL_cpuinfo.h" -/* #define DEBUG_CONVERT */ +#define DEBUG_AUDIOSTREAM 0 -/* Effectively mix right and left channels into a single channel */ -static void SDLCALL -SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - Sint32 sample; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to mono\n"); +#ifdef __SSE3__ +#define HAVE_SSE3_INTRINSICS 1 #endif - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst; - src = cvt->buf; - dst = cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Uint8) (sample / 2); - src += 2; - dst += 1; - } +#if HAVE_SSE3_INTRINSICS +/* Convert from stereo to mono. Average left and right. */ +static void SDLCALL +SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i = cvt->len_cvt / 8; + + LOG_DEBUG_CONVERT("stereo", "mono (using SSE3)"); + SDL_assert(format == AUDIO_F32SYS); + + /* We can only do this if dst is aligned to 16 bytes; since src is the + same pointer and it moves by 2, it can't be forcibly aligned. */ + if ((((size_t) dst) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby2 = _mm_set1_ps(0.5f); + while (i >= 4) { /* 4 * float32 */ + _mm_store_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_load_ps(src), _mm_load_ps(src+4)), divby2)); + i -= 4; src += 8; dst += 4; } - break; + } - case AUDIO_S8: - { - Sint8 *src, *dst; + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (src[0] + src[1]) * 0.5f; + dst++; i--; src += 2; + } - src = (Sint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Sint8) (sample / 2); - src += 2; - dst += 1; - } - } - break; + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} +#endif - case AUDIO_U16: - { - Uint8 *src, *dst; +/* Convert from stereo to mono. Average left and right. */ +static void SDLCALL +SDL_ConvertStereoToMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[0] << 8) | src[1]) + - (Uint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[1] << 8) | src[0]) + - (Uint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; + LOG_DEBUG_CONVERT("stereo", "mono"); + SDL_assert(format == AUDIO_F32SYS); - case AUDIO_S16: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[0] << 8) | src[1]) + - (Sint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[1] << 8) | src[0]) + - (Sint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) cvt->buf; - Uint32 *dst = (Uint32 *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapBE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapBE32(src[1]))); - *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added / 2))); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapLE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapLE32(src[1]))); - *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added / 2))); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) cvt->buf; - float *dst = (float *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatBE(src[0]); - const float src2 = SDL_SwapFloatBE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatBE(halved); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatLE(src[0]); - const float src2 = SDL_SwapFloatLE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatLE(halved); - } - } - } - break; + for (i = cvt->len_cvt / 8; i; --i, src += 2) { + *(dst++) = (src[0] + src[1]) * 0.5f; } cvt->len_cvt /= 2; @@ -190,43 +98,24 @@ SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Discard top 4 channels */ +/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */ static void SDLCALL -SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert51ToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) { + float *dst = (float *) cvt->buf; + const float *src = dst; int i; -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting down from 6 channels to stereo\n"); -#endif + LOG_DEBUG_CONVERT("5.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); -#define strip_chans_6_to_2(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - src += 6; \ - dst += 2; \ - } \ + /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 2) { + const float front_center_distributed = src[2] * 0.5f; + dst[0] = (src[0] + front_center_distributed + src[4]) / 2.5f; /* left */ + dst[1] = (src[1] + front_center_distributed + src[5]) / 2.5f; /* right */ } - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_2(Uint8); - break; - case 16: - strip_chans_6_to_2(Uint16); - break; - case 32: - strip_chans_6_to_2(Uint32); - break; - } - -#undef strip_chans_6_to_2 - cvt->len_cvt /= 3; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -234,44 +123,79 @@ SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Discard top 2 channels of 6 */ +/* Convert from quad to stereo. Average left and right. */ static void SDLCALL -SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertQuadToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) { + float *dst = (float *) cvt->buf; + const float *src = dst; int i; -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting 6 down to quad\n"); -#endif + LOG_DEBUG_CONVERT("quad", "stereo"); + SDL_assert(format == AUDIO_F32SYS); -#define strip_chans_6_to_4(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - dst[2] = src[2]; \ - dst[3] = src[3]; \ - src += 6; \ - dst += 4; \ - } \ + for (i = cvt->len_cvt / (sizeof (float) * 4); i; --i, src += 4, dst += 2) { + dst[0] = (src[0] + src[2]) * 0.5f; /* left */ + dst[1] = (src[1] + src[3]) * 0.5f; /* right */ } - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_4(Uint8); - break; - case 16: - strip_chans_6_to_4(Uint16); - break; - case 32: - strip_chans_6_to_4(Uint32); - break; + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from 7.1 to 5.1. Distribute sides across front and back. */ +static void SDLCALL +SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 6) { + const float surround_left_distributed = src[6] * 0.5f; + const float surround_right_distributed = src[7] * 0.5f; + dst[0] = (src[0] + surround_left_distributed) / 1.5f; /* FL */ + dst[1] = (src[1] + surround_right_distributed) / 1.5f; /* FR */ + dst[2] = src[2] / 1.5f; /* CC */ + dst[3] = src[3] / 1.5f; /* LFE */ + dst[4] = (src[4] + surround_left_distributed) / 1.5f; /* BL */ + dst[5] = (src[5] + surround_right_distributed) / 1.5f; /* BR */ } -#undef strip_chans_6_to_4 + cvt->len_cvt /= 8; + cvt->len_cvt *= 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from 5.1 to quad. Distribute center across front, discard LFE. */ +static void SDLCALL +SDL_Convert51ToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + /* SDL's 4.0 layout: FL+FR+BL+BR */ + /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 4) { + const float front_center_distributed = src[2] * 0.5f; + dst[0] = (src[0] + front_center_distributed) / 1.5f; /* FL */ + dst[1] = (src[1] + front_center_distributed) / 1.5f; /* FR */ + dst[2] = src[4] / 1.5f; /* BL */ + dst[3] = src[5] / 1.5f; /* BR */ + } cvt->len_cvt /= 6; cvt->len_cvt *= 4; @@ -280,42 +204,24 @@ SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format) } } -/* Duplicate a mono channel to both stereo channels */ + +/* Upmix mono to stereo (by duplication) */ static void SDLCALL -SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertMonoToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) { + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); int i; -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to stereo\n"); -#endif + LOG_DEBUG_CONVERT("mono", "stereo"); + SDL_assert(format == AUDIO_F32SYS); -#define dup_chans_1_to_2(type) \ - { \ - const type *src = (const type *) (cvt->buf + cvt->len_cvt); \ - type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \ - for (i = cvt->len_cvt / sizeof(type); i; --i) { \ - src -= 1; \ - dst -= 2; \ - dst[0] = dst[1] = *src; \ - } \ + for (i = cvt->len_cvt / sizeof (float); i; --i) { + src--; + dst -= 2; + dst[0] = dst[1] = *src; } - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - dup_chans_1_to_2(Uint8); - break; - case 16: - dup_chans_1_to_2(Uint16); - break; - case 32: - dup_chans_1_to_2(Uint32); - break; - } - -#undef dup_chans_1_to_2 - cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -323,258 +229,33 @@ SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Duplicate a stereo channel to a pseudo-5.1 stream */ +/* Upmix stereo to a pseudo-5.1 stream */ static void SDLCALL -SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertStereoTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; + float lf, rf, ce; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to surround\n"); -#endif - - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 3); - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 3; - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - Sint32 lf, rf, ce; - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = SDL_SwapBE32((Uint32) lf); - dst[1] = SDL_SwapBE32((Uint32) rf); - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapBE32((Uint32) ce); - dst[5] = SDL_SwapBE32((Uint32) ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapLE32((Uint32) ce); - dst[5] = SDL_SwapLE32((Uint32) ce); - } - } - } - break; - - case AUDIO_F32: - { - float lf, rf, ce; - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatBE(ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatLE(ce); - } - } - } - break; + LOG_DEBUG_CONVERT("stereo", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { + dst -= 6; + src -= 2; + lf = src[0]; + rf = src[1]; + ce = (lf + rf) * 0.5f; + /* !!! FIXME: FL and FR may clip */ + dst[0] = lf + (lf - ce); /* FL */ + dst[1] = rf + (rf - ce); /* FR */ + dst[2] = ce; /* FC */ + dst[3] = 0; /* LFE (only meant for special LFE effects) */ + dst[4] = lf; /* BL */ + dst[5] = rf; /* BR */ } + cvt->len_cvt *= 3; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -582,227 +263,66 @@ SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Duplicate a stereo channel to a pseudo-4.0 stream */ +/* Upmix quad to a pseudo-5.1 stream */ static void SDLCALL -SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; + float lf, rf, lb, rb, ce; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 3 / 2); -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to quad\n"); -#endif + LOG_DEBUG_CONVERT("quad", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + SDL_assert(cvt->len_cvt % (sizeof(float) * 4) == 0); - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 2); - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 2; - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 2); - Sint32 lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); - float lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - } - } - } - break; + for (i = cvt->len_cvt / (sizeof(float) * 4); i; --i) { + dst -= 6; + src -= 4; + lf = src[0]; + rf = src[1]; + lb = src[2]; + rb = src[3]; + ce = (lf + rf) * 0.5f; + /* !!! FIXME: FL and FR may clip */ + dst[0] = lf + (lf - ce); /* FL */ + dst[1] = rf + (rf - ce); /* FR */ + dst[2] = ce; /* FC */ + dst[3] = 0; /* LFE (only meant for special LFE effects) */ + dst[4] = lb; /* BL */ + dst[5] = rb; /* BR */ } + + cvt->len_cvt = cvt->len_cvt * 3 / 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Upmix stereo to a pseudo-4.0 stream (by duplication) */ +static void SDLCALL +SDL_ConvertStereoToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); + float lf, rf; + int i; + + LOG_DEBUG_CONVERT("stereo", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { + dst -= 4; + src -= 2; + lf = src[0]; + rf = src[1]; + dst[0] = lf; /* FL */ + dst[1] = rf; /* FR */ + dst[2] = lf; /* BL */ + dst[3] = rf; /* BR */ + } + cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -810,6 +330,212 @@ SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format) } +/* Upmix 5.1 to 7.1 */ +static void SDLCALL +SDL_Convert51To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float lf, rf, lb, rb, ls, rs; + int i; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 4 / 3); + + LOG_DEBUG_CONVERT("5.1", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + SDL_assert(cvt->len_cvt % (sizeof(float) * 6) == 0); + + for (i = cvt->len_cvt / (sizeof(float) * 6); i; --i) { + dst -= 8; + src -= 6; + lf = src[0]; + rf = src[1]; + lb = src[4]; + rb = src[5]; + ls = (lf + lb) * 0.5f; + rs = (rf + rb) * 0.5f; + /* !!! FIXME: these four may clip */ + lf += lf - ls; + rf += rf - ls; + lb += lb - ls; + rb += rb - ls; + dst[3] = src[3]; /* LFE */ + dst[2] = src[2]; /* FC */ + dst[7] = rs; /* SR */ + dst[6] = ls; /* SL */ + dst[5] = rb; /* BR */ + dst[4] = lb; /* BL */ + dst[1] = rf; /* FR */ + dst[0] = lf; /* FL */ + } + + cvt->len_cvt = cvt->len_cvt * 4 / 3; + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +/* SDL's resampler uses a "bandlimited interpolation" algorithm: + https://ccrma.stanford.edu/~jos/resample/ */ + +#define RESAMPLER_ZERO_CROSSINGS 5 +#define RESAMPLER_BITS_PER_SAMPLE 16 +#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1)) +#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1) + +/* This is a "modified" bessel function, so you can't use POSIX j0() */ +static double +bessel(const double x) +{ + const double xdiv2 = x / 2.0; + double i0 = 1.0f; + double f = 1.0f; + int i = 1; + + while (SDL_TRUE) { + const double diff = SDL_pow(xdiv2, i * 2) / SDL_pow(f, 2); + if (diff < 1.0e-21f) { + break; + } + i0 += diff; + i++; + f *= (double) i; + } + + return i0; +} + +/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */ +static void +kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta) +{ + const int lenm1 = tablelen - 1; + const int lenm1div2 = lenm1 / 2; + int i; + + table[0] = 1.0f; + for (i = 1; i < tablelen; i++) { + const double kaiser = bessel(beta * SDL_sqrt(1.0 - SDL_pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel(beta); + table[tablelen - i] = (float) kaiser; + } + + for (i = 1; i < tablelen; i++) { + const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI); + table[i] *= SDL_sinf(x) / x; + diffs[i - 1] = table[i] - table[i - 1]; + } + diffs[lenm1] = 0.0f; +} + + +static SDL_SpinLock ResampleFilterSpinlock = 0; +static float *ResamplerFilter = NULL; +static float *ResamplerFilterDifference = NULL; + +int +SDL_PrepareResampleFilter(void) +{ + SDL_AtomicLock(&ResampleFilterSpinlock); + if (!ResamplerFilter) { + /* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */ + const double dB = 80.0; + const double beta = 0.1102 * (dB - 8.7); + const size_t alloclen = RESAMPLER_FILTER_SIZE * sizeof (float); + + ResamplerFilter = (float *) SDL_malloc(alloclen); + if (!ResamplerFilter) { + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + + ResamplerFilterDifference = (float *) SDL_malloc(alloclen); + if (!ResamplerFilterDifference) { + SDL_free(ResamplerFilter); + ResamplerFilter = NULL; + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta); + } + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return 0; +} + +void +SDL_FreeResampleFilter(void) +{ + SDL_free(ResamplerFilter); + SDL_free(ResamplerFilterDifference); + ResamplerFilter = NULL; + ResamplerFilterDifference = NULL; +} + +static int +ResamplerPadding(const int inrate, const int outrate) +{ + if (inrate == outrate) { + return 0; + } else if (inrate > outrate) { + return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); + } + return RESAMPLER_SAMPLES_PER_ZERO_CROSSING; +} + +/* lpadding and rpadding are expected to be buffers of (ResamplePadding(inrate, outrate) * chans * sizeof (float)) bytes. */ +static int +SDL_ResampleAudio(const int chans, const int inrate, const int outrate, + const float *lpadding, const float *rpadding, + const float *inbuf, const int inbuflen, + float *outbuf, const int outbuflen) +{ + const double finrate = (double) inrate; + const double outtimeincr = 1.0 / ((float) outrate); + const double ratio = ((float) outrate) / ((float) inrate); + const int paddinglen = ResamplerPadding(inrate, outrate); + const int framelen = chans * (int)sizeof (float); + const int inframes = inbuflen / framelen; + const int wantedoutframes = (int) ((inbuflen / framelen) * ratio); /* outbuflen isn't total to write, it's total available. */ + const int maxoutframes = outbuflen / framelen; + const int outframes = SDL_min(wantedoutframes, maxoutframes); + float *dst = outbuf; + double outtime = 0.0; + int i, j, chan; + + for (i = 0; i < outframes; i++) { + const int srcindex = (int) (outtime * inrate); + const double intime = ((double) srcindex) / finrate; + const double innexttime = ((double) (srcindex + 1)) / finrate; + const double interpolation1 = 1.0 - ((innexttime - outtime) / (innexttime - intime)); + const int filterindex1 = (int) (interpolation1 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); + const double interpolation2 = 1.0 - interpolation1; + const int filterindex2 = (int) (interpolation2 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); + + for (chan = 0; chan < chans; chan++) { + float outsample = 0.0f; + + /* do this twice to calculate the sample, once for the "left wing" and then same for the right. */ + /* !!! FIXME: do both wings in one loop */ + for (j = 0; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { + const int srcframe = srcindex - j; + /* !!! FIXME: we can bubble this conditional out of here by doing a pre loop. */ + const float insample = (srcframe < 0) ? lpadding[((paddinglen + srcframe) * chans) + chan] : inbuf[(srcframe * chans) + chan]; + outsample += (float)(insample * (ResamplerFilter[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation1 * ResamplerFilterDifference[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); + } + + for (j = 0; (filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { + const int srcframe = srcindex + 1 + j; + /* !!! FIXME: we can bubble this conditional out of here by doing a post loop. */ + const float insample = (srcframe >= inframes) ? rpadding[((srcframe - inframes) * chans) + chan] : inbuf[(srcframe * chans) + chan]; + outsample += (float)(insample * (ResamplerFilter[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation2 * ResamplerFilterDifference[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); + } + *(dst++) = outsample; + } + + outtime += outtimeincr; + } + + return outframes * chans * sizeof (float); +} + int SDL_ConvertAudio(SDL_AudioCVT * cvt) { @@ -818,68 +544,106 @@ SDL_ConvertAudio(SDL_AudioCVT * cvt) /* Make sure there's data to convert */ if (cvt->buf == NULL) { - SDL_SetError("No buffer allocated for conversion"); - return (-1); + return SDL_SetError("No buffer allocated for conversion"); } + /* Return okay if no conversion is necessary */ cvt->len_cvt = cvt->len; if (cvt->filters[0] == NULL) { - return (0); + return 0; } /* Set up the conversion and go! */ cvt->filter_index = 0; cvt->filters[0] (cvt, cvt->src_format); - return (0); + return 0; } - -static SDL_AudioFilter -SDL_HandTunedTypeCVT(SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) +static void SDLCALL +SDL_Convert_Byteswap(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ +#if DEBUG_CONVERT + printf("Converting byte order\n"); +#endif - return NULL; /* no specialized converter code available. */ + switch (SDL_AUDIO_BITSIZE(format)) { + #define CASESWAP(b) \ + case b: { \ + Uint##b *ptr = (Uint##b *) cvt->buf; \ + int i; \ + for (i = cvt->len_cvt / sizeof (*ptr); i; --i, ++ptr) { \ + *ptr = SDL_Swap##b(*ptr); \ + } \ + break; \ + } + + CASESWAP(16); + CASESWAP(32); + CASESWAP(64); + + #undef CASESWAP + + default: SDL_assert(!"unhandled byteswap datatype!"); break; + } + + if (cvt->filters[++cvt->filter_index]) { + /* flip endian flag for data. */ + if (format & SDL_AUDIO_MASK_ENDIAN) { + format &= ~SDL_AUDIO_MASK_ENDIAN; + } else { + format |= SDL_AUDIO_MASK_ENDIAN; + } + cvt->filters[cvt->filter_index](cvt, format); + } } - -/* - * Find a converter between two data types. We try to select a hand-tuned - * asm/vectorized/optimized function first, and then fallback to an - * autogenerated function that is customized to convert between two - * specific data types. - */ static int -SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt, - SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) +SDL_AddAudioCVTFilter(SDL_AudioCVT *cvt, const SDL_AudioFilter filter) { - if (src_fmt != dst_fmt) { + if (cvt->filter_index >= SDL_AUDIOCVT_MAX_FILTERS) { + return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS); + } + if (filter == NULL) { + return SDL_SetError("Audio filter pointer is NULL"); + } + cvt->filters[cvt->filter_index++] = filter; + cvt->filters[cvt->filter_index] = NULL; /* Moving terminator */ + return 0; +} + +static int +SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) +{ + int retval = 0; /* 0 == no conversion necessary. */ + + if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + retval = 1; /* added a converter. */ + } + + if (!SDL_AUDIO_ISFLOAT(src_fmt)) { const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt); - const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt); - SDL_AudioFilter filter = SDL_HandTunedTypeCVT(src_fmt, dst_fmt); + const Uint16 dst_bitsize = 32; + SDL_AudioFilter filter = NULL; - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - for (i = 0; sdl_audio_type_filters[i].filter != NULL; i++) { - const SDL_AudioTypeFilters *filt = &sdl_audio_type_filters[i]; - if ((filt->src_fmt == src_fmt) && (filt->dst_fmt == dst_fmt)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these formats"); - return -1; - } + switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) { + case AUDIO_S8: filter = SDL_Convert_S8_to_F32; break; + case AUDIO_U8: filter = SDL_Convert_U8_to_F32; break; + case AUDIO_S16: filter = SDL_Convert_S16_to_F32; break; + case AUDIO_U16: filter = SDL_Convert_U16_to_F32; break; + case AUDIO_S32: filter = SDL_Convert_S32_to_F32; break; + default: SDL_assert(!"Unexpected audio format!"); break; } - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; + if (!filter) { + return SDL_SetError("No conversion from source format to float available"); + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } if (src_bitsize < dst_bitsize) { const int mult = (dst_bitsize / src_bitsize); cvt->len_mult *= mult; @@ -888,110 +652,220 @@ SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt, cvt->len_ratio /= (src_bitsize / dst_bitsize); } - return 1; /* added a converter. */ + retval = 1; /* added a converter. */ } - return 0; /* no conversion necessary. */ -} - - -static SDL_AudioFilter -SDL_HandTunedResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) -{ - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ - - return NULL; /* no specialized converter code available. */ -} - -static int -SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate) -{ - int retval = 0; - - /* If we only built with the arbitrary resamplers, ignore multiples. */ -#if !LESS_RESAMPLERS - int lo, hi; - int div; - - SDL_assert(src_rate != 0); - SDL_assert(dst_rate != 0); - SDL_assert(src_rate != dst_rate); - - if (src_rate < dst_rate) { - lo = src_rate; - hi = dst_rate; - } else { - lo = dst_rate; - hi = src_rate; - } - - /* zero means "not a supported multiple" ... we only do 2x and 4x. */ - if ((hi % lo) != 0) - return 0; /* not a multiple. */ - - div = hi / lo; - retval = ((div == 2) || (div == 4)) ? div : 0; -#endif - return retval; } static int -SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) +SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) { - if (src_rate != dst_rate) { - SDL_AudioFilter filter = SDL_HandTunedResampleCVT(cvt, dst_channels, - src_rate, dst_rate); + int retval = 0; /* 0 == no conversion necessary. */ - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - const int upsample = (src_rate < dst_rate) ? 1 : 0; - const int multiple = - SDL_FindFrequencyMultiple(src_rate, dst_rate); - - for (i = 0; sdl_audio_rate_filters[i].filter != NULL; i++) { - const SDL_AudioRateFilters *filt = &sdl_audio_rate_filters[i]; - if ((filt->fmt == cvt->dst_format) && - (filt->channels == dst_channels) && - (filt->upsample == upsample) && - (filt->multiple == multiple)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these rates"); - return -1; - } + if (!SDL_AUDIO_ISFLOAT(dst_fmt)) { + const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt); + const Uint16 src_bitsize = 32; + SDL_AudioFilter filter = NULL; + switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) { + case AUDIO_S8: filter = SDL_Convert_F32_to_S8; break; + case AUDIO_U8: filter = SDL_Convert_F32_to_U8; break; + case AUDIO_S16: filter = SDL_Convert_F32_to_S16; break; + case AUDIO_U16: filter = SDL_Convert_F32_to_U16; break; + case AUDIO_S32: filter = SDL_Convert_F32_to_S32; break; + default: SDL_assert(!"Unexpected audio format!"); break; } - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; - if (src_rate < dst_rate) { - const double mult = ((double) dst_rate) / ((double) src_rate); - cvt->len_mult *= (int) SDL_ceil(mult); + if (!filter) { + return SDL_SetError("No conversion from float to destination format available"); + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + if (src_bitsize < dst_bitsize) { + const int mult = (dst_bitsize / src_bitsize); + cvt->len_mult *= mult; cvt->len_ratio *= mult; - } else { - cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate); + } else if (src_bitsize > dst_bitsize) { + cvt->len_ratio /= (src_bitsize / dst_bitsize); } - - return 1; /* added a converter. */ + retval = 1; /* added a converter. */ } - return 0; /* no conversion necessary. */ + if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + retval = 1; /* added a converter. */ + } + + return retval; +} + +static void +SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format) +{ + /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator). + !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates, + !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */ + const int inrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1]; + const int outrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS]; + const float *src = (const float *) cvt->buf; + const int srclen = cvt->len_cvt; + /*float *dst = (float *) cvt->buf; + const int dstlen = (cvt->len * cvt->len_mult);*/ + /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + float *dst = (float *) (cvt->buf + srclen); + const int dstlen = (cvt->len * cvt->len_mult) - srclen; + const int paddingsamples = (ResamplerPadding(inrate, outrate) * chans); + float *padding; + + SDL_assert(format == AUDIO_F32SYS); + + /* we keep no streaming state here, so pad with silence on both ends. */ + padding = (float *) SDL_calloc(paddingsamples, sizeof (float)); + if (!padding) { + SDL_OutOfMemory(); + return; + } + + cvt->len_cvt = SDL_ResampleAudio(chans, inrate, outrate, padding, padding, src, srclen, dst, dstlen); + + SDL_free(padding); + + SDL_memmove(cvt->buf, dst, cvt->len_cvt); /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* !!! FIXME: We only have this macro salsa because SDL_AudioCVT doesn't + !!! FIXME: store channel info, so we have to have function entry + !!! FIXME: points for each supported channel count and multiple + !!! FIXME: vs arbitrary. When we rev the ABI, clean this up. */ +#define RESAMPLER_FUNCS(chans) \ + static void SDLCALL \ + SDL_ResampleCVT_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \ + SDL_ResampleCVT(cvt, chans, format); \ + } +RESAMPLER_FUNCS(1) +RESAMPLER_FUNCS(2) +RESAMPLER_FUNCS(4) +RESAMPLER_FUNCS(6) +RESAMPLER_FUNCS(8) +#undef RESAMPLER_FUNCS + +static SDL_AudioFilter +ChooseCVTResampler(const int dst_channels) +{ + switch (dst_channels) { + case 1: return SDL_ResampleCVT_c1; + case 2: return SDL_ResampleCVT_c2; + case 4: return SDL_ResampleCVT_c4; + case 6: return SDL_ResampleCVT_c6; + case 8: return SDL_ResampleCVT_c8; + default: break; + } + + return NULL; +} + +static int +SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, const int dst_channels, + const int src_rate, const int dst_rate) +{ + SDL_AudioFilter filter; + + if (src_rate == dst_rate) { + return 0; /* no conversion necessary. */ + } + + filter = ChooseCVTResampler(dst_channels); + if (filter == NULL) { + return SDL_SetError("No conversion available for these rates"); + } + + if (SDL_PrepareResampleFilter() < 0) { + return -1; + } + + /* Update (cvt) with filter details... */ + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + + /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator). + !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates, + !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */ + if (cvt->filter_index >= (SDL_AUDIOCVT_MAX_FILTERS-2)) { + return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS-2); + } + cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1] = (SDL_AudioFilter) (size_t) src_rate; + cvt->filters[SDL_AUDIOCVT_MAX_FILTERS] = (SDL_AudioFilter) (size_t) dst_rate; + + if (src_rate < dst_rate) { + const double mult = ((double) dst_rate) / ((double) src_rate); + cvt->len_mult *= (int) SDL_ceil(mult); + cvt->len_ratio *= mult; + } else { + cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate); + } + + /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + /* the buffer is big enough to hold the destination now, but + we need it large enough to hold a separate scratch buffer. */ + cvt->len_mult *= 2; + + return 1; /* added a converter. */ +} + +static SDL_bool +SDL_SupportedAudioFormat(const SDL_AudioFormat fmt) +{ + switch (fmt) { + case AUDIO_U8: + case AUDIO_S8: + case AUDIO_U16LSB: + case AUDIO_S16LSB: + case AUDIO_U16MSB: + case AUDIO_S16MSB: + case AUDIO_S32LSB: + case AUDIO_S32MSB: + case AUDIO_F32LSB: + case AUDIO_F32MSB: + return SDL_TRUE; /* supported. */ + + default: + break; + } + + return SDL_FALSE; /* unsupported. */ +} + +static SDL_bool +SDL_SupportedChannelCount(const int channels) +{ + switch (channels) { + case 1: /* mono */ + case 2: /* stereo */ + case 4: /* quad */ + case 6: /* 5.1 */ + case 8: /* 7.1 */ + return SDL_TRUE; /* supported. */ + + default: + break; + } + + return SDL_FALSE; /* unsupported. */ } /* Creates a set of audio filters to convert from one format to another. - Returns -1 if the format conversion is not supported, 0 if there's - no conversion needed, or 1 if the audio filter is set up. + Returns 0 if no conversion is needed, 1 if the audio filter is set up, + or -1 if an error like invalid parameter, unsupported format, etc. occurred. */ int @@ -999,123 +873,801 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate, SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate) { - /* - * !!! FIXME: reorder filters based on which grow/shrink the buffer. - * !!! FIXME: ideally, we should do everything that shrinks the buffer - * !!! FIXME: first, so we don't have to process as many bytes in a given - * !!! FIXME: filter and abuse the CPU cache less. This might not be as - * !!! FIXME: good in practice as it sounds in theory, though. - */ - /* Sanity check target pointer */ if (cvt == NULL) { return SDL_InvalidParamError("cvt"); } - /* there are no unsigned types over 16 bits, so catch this up front. */ - if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) { + /* Make sure we zero out the audio conversion before error checking */ + SDL_zerop(cvt); + + if (!SDL_SupportedAudioFormat(src_fmt)) { return SDL_SetError("Invalid source format"); - } - if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) { + } else if (!SDL_SupportedAudioFormat(dst_fmt)) { return SDL_SetError("Invalid destination format"); + } else if (!SDL_SupportedChannelCount(src_channels)) { + return SDL_SetError("Invalid source channels"); + } else if (!SDL_SupportedChannelCount(dst_channels)) { + return SDL_SetError("Invalid destination channels"); + } else if (src_rate == 0) { + return SDL_SetError("Source rate is zero"); + } else if (dst_rate == 0) { + return SDL_SetError("Destination rate is zero"); } - /* prevent possible divisions by zero, etc. */ - if ((src_channels == 0) || (dst_channels == 0)) { - return SDL_SetError("Source or destination channels is zero"); - } - if ((src_rate == 0) || (dst_rate == 0)) { - return SDL_SetError("Source or destination rate is zero"); - } -#ifdef DEBUG_CONVERT +#if DEBUG_CONVERT printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate); #endif /* Start off with no conversion necessary */ - SDL_zerop(cvt); cvt->src_format = src_fmt; cvt->dst_format = dst_fmt; cvt->needed = 0; cvt->filter_index = 0; - cvt->filters[0] = NULL; + SDL_zero(cvt->filters); cvt->len_mult = 1; cvt->len_ratio = 1.0; cvt->rate_incr = ((double) dst_rate) / ((double) src_rate); + /* Make sure we've chosen audio conversion functions (MMX, scalar, etc.) */ + SDL_ChooseAudioConverters(); + + /* Type conversion goes like this now: + - byteswap to CPU native format first if necessary. + - convert to native Float32 if necessary. + - resample and change channel count if necessary. + - convert back to native format. + - byteswap back to foreign format if necessary. + + The expectation is we can process data faster in float32 + (possibly with SIMD), and making several passes over the same + buffer is likely to be CPU cache-friendly, avoiding the + biggest performance hit in modern times. Previously we had + (script-generated) custom converters for every data type and + it was a bloat on SDL compile times and final library size. */ + + /* see if we can skip float conversion entirely. */ + if (src_rate == dst_rate && src_channels == dst_channels) { + if (src_fmt == dst_fmt) { + return 0; + } + + /* just a byteswap needed? */ + if ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + cvt->needed = 1; + return 1; + } + } + /* Convert data types, if necessary. Updates (cvt). */ - if (SDL_BuildAudioTypeCVT(cvt, src_fmt, dst_fmt) == -1) { + if (SDL_BuildAudioTypeCVTToFloat(cvt, src_fmt) < 0) { return -1; /* shouldn't happen, but just in case... */ } /* Channel conversion */ - if (src_channels != dst_channels) { + if (src_channels < dst_channels) { + /* Upmixing */ + /* Mono -> Stereo [-> ...] */ if ((src_channels == 1) && (dst_channels > 1)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertMonoToStereo) < 0) { + return -1; + } cvt->len_mult *= 2; src_channels = 2; cvt->len_ratio *= 2; } - if ((src_channels == 2) && (dst_channels == 6)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround; + /* [Mono ->] Stereo -> 5.1 [-> 7.1] */ + if ((src_channels == 2) && (dst_channels >= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoTo51) < 0) { + return -1; + } src_channels = 6; cvt->len_mult *= 3; cvt->len_ratio *= 3; } + /* Quad -> 5.1 [-> 7.1] */ + if ((src_channels == 4) && (dst_channels >= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadTo51) < 0) { + return -1; + } + src_channels = 6; + cvt->len_mult = (cvt->len_mult * 3 + 1) / 2; + cvt->len_ratio *= 1.5; + } + /* [[Mono ->] Stereo ->] 5.1 -> 7.1 */ + if ((src_channels == 6) && (dst_channels == 8)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51To71) < 0) { + return -1; + } + src_channels = 8; + cvt->len_mult = (cvt->len_mult * 4 + 2) / 3; + /* Should be numerically exact with every valid input to this + function */ + cvt->len_ratio = cvt->len_ratio * 4 / 3; + } + /* [Mono ->] Stereo -> Quad */ if ((src_channels == 2) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround_4; + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoToQuad) < 0) { + return -1; + } src_channels = 4; cvt->len_mult *= 2; cvt->len_ratio *= 2; } - while ((src_channels * 2) <= dst_channels) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; - cvt->len_mult *= 2; - src_channels *= 2; - cvt->len_ratio *= 2; + } else if (src_channels > dst_channels) { + /* Downmixing */ + /* 7.1 -> 5.1 [-> Stereo [-> Mono]] */ + /* 7.1 -> 5.1 [-> Quad] */ + if ((src_channels == 8) && (dst_channels <= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert71To51) < 0) { + return -1; + } + src_channels = 6; + cvt->len_ratio *= 0.75; } + /* [7.1 ->] 5.1 -> Stereo [-> Mono] */ if ((src_channels == 6) && (dst_channels <= 2)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip; + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToStereo) < 0) { + return -1; + } src_channels = 2; cvt->len_ratio /= 3; } + /* 5.1 -> Quad */ if ((src_channels == 6) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip_2; + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToQuad) < 0) { + return -1; + } src_channels = 4; + cvt->len_ratio = cvt->len_ratio * 2 / 3; + } + /* Quad -> Stereo [-> Mono] */ + if ((src_channels == 4) && (dst_channels <= 2)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadToStereo) < 0) { + return -1; + } + src_channels = 2; cvt->len_ratio /= 2; } - /* This assumes that 4 channel audio is in the format: - Left {front/back} + Right {front/back} - so converting to L/R stereo works properly. - */ - while (((src_channels % 2) == 0) && - ((src_channels / 2) >= dst_channels)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertMono; - src_channels /= 2; + /* [... ->] Stereo -> Mono */ + if ((src_channels == 2) && (dst_channels == 1)) { + SDL_AudioFilter filter = NULL; + + #if HAVE_SSE3_INTRINSICS + if (SDL_HasSSE3()) { + filter = SDL_ConvertStereoToMono_SSE3; + } + #endif + + if (!filter) { + filter = SDL_ConvertStereoToMono; + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + + src_channels = 1; cvt->len_ratio /= 2; } - if (src_channels != dst_channels) { - /* Uh oh.. */ ; - } } + if (src_channels != dst_channels) { + /* All combinations of supported channel counts should have been + handled by now, but let's be defensive */ + return SDL_SetError("Invalid channel combination"); + } + /* Do rate conversion, if necessary. Updates (cvt). */ - if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) == - -1) { + if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) < 0) { return -1; /* shouldn't happen, but just in case... */ } - /* Set up the filter information */ - if (cvt->filter_index != 0) { - cvt->needed = 1; - cvt->src_format = src_fmt; - cvt->dst_format = dst_fmt; - cvt->len = 0; - cvt->buf = NULL; - cvt->filters[cvt->filter_index] = NULL; + /* Move to final data type. */ + if (SDL_BuildAudioTypeCVTFromFloat(cvt, dst_fmt) < 0) { + return -1; /* shouldn't happen, but just in case... */ } + + cvt->needed = (cvt->filter_index != 0); return (cvt->needed); } +typedef int (*SDL_ResampleAudioStreamFunc)(SDL_AudioStream *stream, const void *inbuf, const int inbuflen, void *outbuf, const int outbuflen); +typedef void (*SDL_ResetAudioStreamResamplerFunc)(SDL_AudioStream *stream); +typedef void (*SDL_CleanupAudioStreamResamplerFunc)(SDL_AudioStream *stream); + +struct _SDL_AudioStream +{ + SDL_AudioCVT cvt_before_resampling; + SDL_AudioCVT cvt_after_resampling; + SDL_DataQueue *queue; + SDL_bool first_run; + Uint8 *staging_buffer; + int staging_buffer_size; + int staging_buffer_filled; + Uint8 *work_buffer_base; /* maybe unaligned pointer from SDL_realloc(). */ + int work_buffer_len; + int src_sample_frame_size; + SDL_AudioFormat src_format; + Uint8 src_channels; + int src_rate; + int dst_sample_frame_size; + SDL_AudioFormat dst_format; + Uint8 dst_channels; + int dst_rate; + double rate_incr; + Uint8 pre_resample_channels; + int packetlen; + int resampler_padding_samples; + float *resampler_padding; + void *resampler_state; + SDL_ResampleAudioStreamFunc resampler_func; + SDL_ResetAudioStreamResamplerFunc reset_resampler_func; + SDL_CleanupAudioStreamResamplerFunc cleanup_resampler_func; +}; + +static Uint8 * +EnsureStreamBufferSize(SDL_AudioStream *stream, const int newlen) +{ + Uint8 *ptr; + size_t offset; + + if (stream->work_buffer_len >= newlen) { + ptr = stream->work_buffer_base; + } else { + ptr = (Uint8 *) SDL_realloc(stream->work_buffer_base, newlen + 32); + if (!ptr) { + SDL_OutOfMemory(); + return NULL; + } + /* Make sure we're aligned to 16 bytes for SIMD code. */ + stream->work_buffer_base = ptr; + stream->work_buffer_len = newlen; + } + + offset = ((size_t) ptr) & 15; + return offset ? ptr + (16 - offset) : ptr; +} + +#ifdef HAVE_LIBSAMPLERATE_H +static int +SDL_ResampleAudioStream_SRC(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen) +{ + const float *inbuf = (const float *) _inbuf; + float *outbuf = (float *) _outbuf; + const int framelen = sizeof(float) * stream->pre_resample_channels; + SRC_STATE *state = (SRC_STATE *)stream->resampler_state; + SRC_DATA data; + int result; + + SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */ + + data.data_in = (float *)inbuf; /* Older versions of libsamplerate had a non-const pointer, but didn't write to it */ + data.input_frames = inbuflen / framelen; + data.input_frames_used = 0; + + data.data_out = outbuf; + data.output_frames = outbuflen / framelen; + + data.end_of_input = 0; + data.src_ratio = stream->rate_incr; + + result = SRC_src_process(state, &data); + if (result != 0) { + SDL_SetError("src_process() failed: %s", SRC_src_strerror(result)); + return 0; + } + + /* If this fails, we need to store them off somewhere */ + SDL_assert(data.input_frames_used == data.input_frames); + + return data.output_frames_gen * (sizeof(float) * stream->pre_resample_channels); +} + +static void +SDL_ResetAudioStreamResampler_SRC(SDL_AudioStream *stream) +{ + SRC_src_reset((SRC_STATE *)stream->resampler_state); +} + +static void +SDL_CleanupAudioStreamResampler_SRC(SDL_AudioStream *stream) +{ + SRC_STATE *state = (SRC_STATE *)stream->resampler_state; + if (state) { + SRC_src_delete(state); + } + + stream->resampler_state = NULL; + stream->resampler_func = NULL; + stream->reset_resampler_func = NULL; + stream->cleanup_resampler_func = NULL; +} + +static SDL_bool +SetupLibSampleRateResampling(SDL_AudioStream *stream) +{ + int result = 0; + SRC_STATE *state = NULL; + + if (SRC_available) { + state = SRC_src_new(SRC_converter, stream->pre_resample_channels, &result); + if (!state) { + SDL_SetError("src_new() failed: %s", SRC_src_strerror(result)); + } + } + + if (!state) { + SDL_CleanupAudioStreamResampler_SRC(stream); + return SDL_FALSE; + } + + stream->resampler_state = state; + stream->resampler_func = SDL_ResampleAudioStream_SRC; + stream->reset_resampler_func = SDL_ResetAudioStreamResampler_SRC; + stream->cleanup_resampler_func = SDL_CleanupAudioStreamResampler_SRC; + + return SDL_TRUE; +} +#endif /* HAVE_LIBSAMPLERATE_H */ + + +static int +SDL_ResampleAudioStream(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen) +{ + const Uint8 *inbufend = ((const Uint8 *) _inbuf) + inbuflen; + const float *inbuf = (const float *) _inbuf; + float *outbuf = (float *) _outbuf; + const int chans = (int) stream->pre_resample_channels; + const int inrate = stream->src_rate; + const int outrate = stream->dst_rate; + const int paddingsamples = stream->resampler_padding_samples; + const int paddingbytes = paddingsamples * sizeof (float); + float *lpadding = (float *) stream->resampler_state; + const float *rpadding = (const float *) inbufend; /* we set this up so there are valid padding samples at the end of the input buffer. */ + const int cpy = SDL_min(inbuflen, paddingbytes); + int retval; + + SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */ + + retval = SDL_ResampleAudio(chans, inrate, outrate, lpadding, rpadding, inbuf, inbuflen, outbuf, outbuflen); + + /* update our left padding with end of current input, for next run. */ + SDL_memcpy((lpadding + paddingsamples) - (cpy / sizeof (float)), inbufend - cpy, cpy); + return retval; +} + +static void +SDL_ResetAudioStreamResampler(SDL_AudioStream *stream) +{ + /* set all the padding to silence. */ + const int len = stream->resampler_padding_samples; + SDL_memset(stream->resampler_state, '\0', len * sizeof (float)); +} + +static void +SDL_CleanupAudioStreamResampler(SDL_AudioStream *stream) +{ + SDL_free(stream->resampler_state); +} + +SDL_AudioStream * +SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate) +{ + const int packetlen = 4096; /* !!! FIXME: good enough for now. */ + Uint8 pre_resample_channels; + SDL_AudioStream *retval; + + retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream)); + if (!retval) { + return NULL; + } + + /* If increasing channels, do it after resampling, since we'd just + do more work to resample duplicate channels. If we're decreasing, do + it first so we resample the interpolated data instead of interpolating + the resampled data (!!! FIXME: decide if that works in practice, though!). */ + pre_resample_channels = SDL_min(src_channels, dst_channels); + + retval->first_run = SDL_TRUE; + retval->src_sample_frame_size = (SDL_AUDIO_BITSIZE(src_format) / 8) * src_channels; + retval->src_format = src_format; + retval->src_channels = src_channels; + retval->src_rate = src_rate; + retval->dst_sample_frame_size = (SDL_AUDIO_BITSIZE(dst_format) / 8) * dst_channels; + retval->dst_format = dst_format; + retval->dst_channels = dst_channels; + retval->dst_rate = dst_rate; + retval->pre_resample_channels = pre_resample_channels; + retval->packetlen = packetlen; + retval->rate_incr = ((double) dst_rate) / ((double) src_rate); + retval->resampler_padding_samples = ResamplerPadding(retval->src_rate, retval->dst_rate) * pre_resample_channels; + retval->resampler_padding = (float *) SDL_calloc(retval->resampler_padding_samples, sizeof (float)); + + if (retval->resampler_padding == NULL) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + + retval->staging_buffer_size = ((retval->resampler_padding_samples / retval->pre_resample_channels) * retval->src_sample_frame_size); + if (retval->staging_buffer_size > 0) { + retval->staging_buffer = (Uint8 *) SDL_malloc(retval->staging_buffer_size); + if (retval->staging_buffer == NULL) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + } + + /* Not resampling? It's an easy conversion (and maybe not even that!) */ + if (src_rate == dst_rate) { + retval->cvt_before_resampling.needed = SDL_FALSE; + if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, src_format, src_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + } else { + /* Don't resample at first. Just get us to Float32 format. */ + /* !!! FIXME: convert to int32 on devices without hardware float. */ + if (SDL_BuildAudioCVT(&retval->cvt_before_resampling, src_format, src_channels, src_rate, AUDIO_F32SYS, pre_resample_channels, src_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + +#ifdef HAVE_LIBSAMPLERATE_H + SetupLibSampleRateResampling(retval); +#endif + + if (!retval->resampler_func) { + retval->resampler_state = SDL_calloc(retval->resampler_padding_samples, sizeof (float)); + if (!retval->resampler_state) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + + if (SDL_PrepareResampleFilter() < 0) { + SDL_free(retval->resampler_state); + retval->resampler_state = NULL; + SDL_FreeAudioStream(retval); + return NULL; + } + + retval->resampler_func = SDL_ResampleAudioStream; + retval->reset_resampler_func = SDL_ResetAudioStreamResampler; + retval->cleanup_resampler_func = SDL_CleanupAudioStreamResampler; + } + + /* Convert us to the final format after resampling. */ + if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, AUDIO_F32SYS, pre_resample_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + } + + retval->queue = SDL_NewDataQueue(packetlen, packetlen * 2); + if (!retval->queue) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_NewDataQueue should have called SDL_SetError. */ + } + + return retval; +} + +static int +SDL_AudioStreamPutInternal(SDL_AudioStream *stream, const void *buf, int len, int *maxputbytes) +{ + int buflen = len; + int workbuflen; + Uint8 *workbuf; + Uint8 *resamplebuf = NULL; + int resamplebuflen = 0; + int neededpaddingbytes; + int paddingbytes; + + /* !!! FIXME: several converters can take advantage of SIMD, but only + !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize() + !!! FIXME: guarantees the buffer will align, but the + !!! FIXME: converters will iterate over the data backwards if + !!! FIXME: the output grows, and this means we won't align if buflen + !!! FIXME: isn't a multiple of 16. In these cases, we should chop off + !!! FIXME: a few samples at the end and convert them separately. */ + + /* no padding prepended on first run. */ + neededpaddingbytes = stream->resampler_padding_samples * sizeof (float); + paddingbytes = stream->first_run ? 0 : neededpaddingbytes; + stream->first_run = SDL_FALSE; + + /* Make sure the work buffer can hold all the data we need at once... */ + workbuflen = buflen; + if (stream->cvt_before_resampling.needed) { + workbuflen *= stream->cvt_before_resampling.len_mult; + } + + if (stream->dst_rate != stream->src_rate) { + /* resamples can't happen in place, so make space for second buf. */ + const int framesize = stream->pre_resample_channels * sizeof (float); + const int frames = workbuflen / framesize; + resamplebuflen = ((int) SDL_ceil(frames * stream->rate_incr)) * framesize; + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: will resample %d bytes to %d (ratio=%.6f)\n", workbuflen, resamplebuflen, stream->rate_incr); + #endif + workbuflen += resamplebuflen; + } + + if (stream->cvt_after_resampling.needed) { + /* !!! FIXME: buffer might be big enough already? */ + workbuflen *= stream->cvt_after_resampling.len_mult; + } + + workbuflen += neededpaddingbytes; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: Putting %d bytes of preconverted audio, need %d byte work buffer\n", buflen, workbuflen); + #endif + + workbuf = EnsureStreamBufferSize(stream, workbuflen); + if (!workbuf) { + return -1; /* probably out of memory. */ + } + + resamplebuf = workbuf; /* default if not resampling. */ + + SDL_memcpy(workbuf + paddingbytes, buf, buflen); + + if (stream->cvt_before_resampling.needed) { + stream->cvt_before_resampling.buf = workbuf + paddingbytes; + stream->cvt_before_resampling.len = buflen; + if (SDL_ConvertAudio(&stream->cvt_before_resampling) == -1) { + return -1; /* uhoh! */ + } + buflen = stream->cvt_before_resampling.len_cvt; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After initial conversion we have %d bytes\n", buflen); + #endif + } + + if (stream->dst_rate != stream->src_rate) { + /* save off some samples at the end; they are used for padding now so + the resampler is coherent and then used at the start of the next + put operation. Prepend last put operation's padding, too. */ + + /* prepend prior put's padding. :P */ + if (paddingbytes) { + SDL_memcpy(workbuf, stream->resampler_padding, paddingbytes); + buflen += paddingbytes; + } + + /* save off the data at the end for the next run. */ + SDL_memcpy(stream->resampler_padding, workbuf + (buflen - neededpaddingbytes), neededpaddingbytes); + + resamplebuf = workbuf + buflen; /* skip to second piece of workbuf. */ + SDL_assert(buflen >= neededpaddingbytes); + if (buflen > neededpaddingbytes) { + buflen = stream->resampler_func(stream, workbuf, buflen - neededpaddingbytes, resamplebuf, resamplebuflen); + } else { + buflen = 0; + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After resampling we have %d bytes\n", buflen); + #endif + } + + if (stream->cvt_after_resampling.needed && (buflen > 0)) { + stream->cvt_after_resampling.buf = resamplebuf; + stream->cvt_after_resampling.len = buflen; + if (SDL_ConvertAudio(&stream->cvt_after_resampling) == -1) { + return -1; /* uhoh! */ + } + buflen = stream->cvt_after_resampling.len_cvt; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After final conversion we have %d bytes\n", buflen); + #endif + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: Final output is %d bytes\n", buflen); + #endif + + if (maxputbytes) { + const int maxbytes = *maxputbytes; + if (buflen > maxbytes) + buflen = maxbytes; + *maxputbytes -= buflen; + } + + /* resamplebuf holds the final output, even if we didn't resample. */ + return buflen ? SDL_WriteToDataQueue(stream->queue, resamplebuf, buflen) : 0; +} + +int +SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) +{ + /* !!! FIXME: several converters can take advantage of SIMD, but only + !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize() + !!! FIXME: guarantees the buffer will align, but the + !!! FIXME: converters will iterate over the data backwards if + !!! FIXME: the output grows, and this means we won't align if buflen + !!! FIXME: isn't a multiple of 16. In these cases, we should chop off + !!! FIXME: a few samples at the end and convert them separately. */ + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen); + #endif + + if (!stream) { + return SDL_InvalidParamError("stream"); + } else if (!buf) { + return SDL_InvalidParamError("buf"); + } else if (len == 0) { + return 0; /* nothing to do. */ + } else if ((len % stream->src_sample_frame_size) != 0) { + return SDL_SetError("Can't add partial sample frames"); + } + + if (!stream->cvt_before_resampling.needed && + (stream->dst_rate == stream->src_rate) && + !stream->cvt_after_resampling.needed) { + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: no conversion needed at all, queueing %d bytes.\n", len); + #endif + return SDL_WriteToDataQueue(stream->queue, buf, len); + } + + while (len > 0) { + int amount; + + /* If we don't have a staging buffer or we're given enough data that + we don't need to store it for later, skip the staging process. + */ + if (!stream->staging_buffer_filled && len >= stream->staging_buffer_size) { + return SDL_AudioStreamPutInternal(stream, buf, len, NULL); + } + + /* If there's not enough data to fill the staging buffer, just save it */ + if ((stream->staging_buffer_filled + len) < stream->staging_buffer_size) { + SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, len); + stream->staging_buffer_filled += len; + return 0; + } + + /* Fill the staging buffer, process it, and continue */ + amount = (stream->staging_buffer_size - stream->staging_buffer_filled); + SDL_assert(amount > 0); + SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, amount); + stream->staging_buffer_filled = 0; + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, NULL) < 0) { + return -1; + } + buf = (void *)((Uint8 *)buf + amount); + len -= amount; + } + return 0; +} + +int SDL_AudioStreamFlush(SDL_AudioStream *stream) +{ + if (!stream) { + return SDL_InvalidParamError("stream"); + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: flushing! staging_buffer_filled=%d bytes\n", stream->staging_buffer_filled); + #endif + + /* shouldn't use a staging buffer if we're not resampling. */ + SDL_assert((stream->dst_rate != stream->src_rate) || (stream->staging_buffer_filled == 0)); + + if (stream->staging_buffer_filled > 0) { + /* push the staging buffer + silence. We need to flush out not just + the staging buffer, but the piece that the stream was saving off + for right-side resampler padding. */ + const SDL_bool first_run = stream->first_run; + const int filled = stream->staging_buffer_filled; + int actual_input_frames = filled / stream->src_sample_frame_size; + if (!first_run) + actual_input_frames += stream->resampler_padding_samples / stream->pre_resample_channels; + + if (actual_input_frames > 0) { /* don't bother if nothing to flush. */ + /* This is how many bytes we're expecting without silence appended. */ + int flush_remaining = ((int) SDL_ceil(actual_input_frames * stream->rate_incr)) * stream->dst_sample_frame_size; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: flushing with padding to get max %d bytes!\n", flush_remaining); + #endif + + SDL_memset(stream->staging_buffer + filled, '\0', stream->staging_buffer_size - filled); + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) { + return -1; + } + + /* we have flushed out (or initially filled) the pending right-side + resampler padding, but we need to push more silence to guarantee + the staging buffer is fully flushed out, too. */ + SDL_memset(stream->staging_buffer, '\0', filled); + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) { + return -1; + } + } + } + + stream->staging_buffer_filled = 0; + stream->first_run = SDL_TRUE; + + return 0; +} + +/* get converted/resampled data from the stream */ +int +SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) +{ + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: want to get %d converted bytes\n", len); + #endif + + if (!stream) { + return SDL_InvalidParamError("stream"); + } else if (!buf) { + return SDL_InvalidParamError("buf"); + } else if (len <= 0) { + return 0; /* nothing to do. */ + } else if ((len % stream->dst_sample_frame_size) != 0) { + return SDL_SetError("Can't request partial sample frames"); + } + + return (int) SDL_ReadFromDataQueue(stream->queue, buf, len); +} + +/* number of converted/resampled bytes available */ +int +SDL_AudioStreamAvailable(SDL_AudioStream *stream) +{ + return stream ? (int) SDL_CountDataQueue(stream->queue) : 0; +} + +void +SDL_AudioStreamClear(SDL_AudioStream *stream) +{ + if (!stream) { + SDL_InvalidParamError("stream"); + } else { + SDL_ClearDataQueue(stream->queue, stream->packetlen * 2); + if (stream->reset_resampler_func) { + stream->reset_resampler_func(stream); + } + stream->first_run = SDL_TRUE; + stream->staging_buffer_filled = 0; + } +} + +/* dispose of a stream */ +void +SDL_FreeAudioStream(SDL_AudioStream *stream) +{ + if (stream) { + if (stream->cleanup_resampler_func) { + stream->cleanup_resampler_func(stream); + } + SDL_FreeDataQueue(stream->queue); + SDL_free(stream->staging_buffer); + SDL_free(stream->work_buffer_base); + SDL_free(stream->resampler_padding); + SDL_free(stream); + } +} /* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/audio/SDL_audiodev.c b/Engine/lib/sdl/src/audio/SDL_audiodev.c index 5c392cfb7..d0b94a055 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiodev.c +++ b/Engine/lib/sdl/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ /* Get the name of the audio device we use for output */ -#if SDL_AUDIO_DRIVER_BSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO +#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO #include #include @@ -103,9 +103,10 @@ SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int classic, int (* if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) { int instance = 0; - while (instance++ <= 64) { + while (instance <= 64) { SDL_snprintf(audiopath, SDL_arraysize(audiopath), "%s%d", audiodev, instance); + instance++; test_device(iscapture, audiopath, flags, test); } } diff --git a/Engine/lib/sdl/src/audio/SDL_audiodev_c.h b/Engine/lib/sdl/src/audio/SDL_audiodev_c.h index fa60bcdb1..15928d10a 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiodev_c.h +++ b/Engine/lib/sdl/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c b/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c index be3b7430a..2fbd916e5 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c +++ b/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c @@ -1,7 +1,6 @@ -/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,15993 +22,808 @@ #include "../SDL_internal.h" #include "SDL_audio.h" #include "SDL_audio_c.h" +#include "SDL_cpuinfo.h" +#include "SDL_assert.h" -#ifndef DEBUG_CONVERT -#define DEBUG_CONVERT 0 +/* !!! FIXME: write NEON code. */ +#define HAVE_NEON_INTRINSICS 0 + +#ifdef __SSE2__ +#define HAVE_SSE2_INTRINSICS 1 #endif - -/* If you can guarantee your data and need space, you can eliminate code... */ - -/* Just build the arbitrary resamplers if you're saving code space. */ -#ifndef LESS_RESAMPLERS -#define LESS_RESAMPLERS 0 +#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ +#elif __MACOSX__ && HAVE_SSE2_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */ +#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ +#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */ #endif -/* Don't build any resamplers if you're REALLY saving code space. */ -#ifndef NO_RESAMPLERS -#define NO_RESAMPLERS 0 +/* Set to zero if platform is guaranteed to use a SIMD codepath here. */ +#ifndef NEED_SCALAR_CONVERTER_FALLBACKS +#define NEED_SCALAR_CONVERTER_FALLBACKS 1 #endif -/* Don't build any type converters if you're saving code space. */ -#ifndef NO_CONVERTERS -#define NO_CONVERTERS 0 -#endif +/* Function pointers set to a CPU-specific implementation. */ +SDL_AudioFilter SDL_Convert_S8_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_U8_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_S16_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_U16_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_S32_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S8 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_U8 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S16 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_U16 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL; -/* *INDENT-OFF* */ +#define DIVBY128 0.0078125f +#define DIVBY32768 0.000030517578125f +#define DIVBY2147483648 0.00000000046566128730773926 -#define DIVBY127 0.0078740157480315f -#define DIVBY32767 3.05185094759972e-05f -#define DIVBY2147483647 4.6566128752458e-10f - -#if !NO_CONVERTERS +#if NEED_SCALAR_CONVERTER_FALLBACKS static void SDLCALL -SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; int i; - const Uint8 *src; - Sint8 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32"); - src = (const Uint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Sint8 val = ((*src) ^ 0x80); - *dst = ((Sint8) val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); + for (i = cvt->len_cvt; i; --i, --src, --dst) { + *dst = ((float) *src) * DIVBY128; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; int i; - const Uint8 *src; - Sint32 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); + for (i = cvt->len_cvt; i; --i, --src, --dst) { + *dst = (((float) *src) * DIVBY128) - 1.0f; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; int i; - const Uint8 *src; - float *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n"); + LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) { + *dst = ((float) *src) * DIVBY32768; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint32 *src = (const Sint32 *) cvt->buf; + float *dst = (float *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) { + *dst = (float) (((double) *src) * DIVBY2147483648); + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint8 *dst = (Sint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 127; + } else if (sample < -1.0f) { + *dst = -127; + } else { + *dst = (Sint8)(sample * 127.0f); + } + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint8 *dst = (Uint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 255; + } else if (sample < -1.0f) { + *dst = 0; + } else { + *dst = (Uint8)((sample + 1.0f) * 127.0f); + } + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint16 *dst = (Sint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 32767; + } else if (sample < -1.0f) { + *dst = -32767; + } else { + *dst = (Sint16)(sample * 32767.0f); + } + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint16 *dst = (Uint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 65534; + } else if (sample < -1.0f) { + *dst = 0; + } else { + *dst = (Uint16)((sample + 1.0f) * 32767.0f); + } + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint32 *dst = (Sint32 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 2147483647; + } else if (sample < -1.0f) { + *dst = -2147483647; + } else { + *dst = (Sint32)((double)sample * 2147483647.0); + } + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS); + } +} #endif - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatLE(val); + +#if HAVE_SSE2_INTRINSICS +static void SDLCALL +SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY128; + } + + src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128i *mmsrc = (const __m128i *) src; + const __m128i zero = _mm_setzero_si128(); + const __m128 divby128 = _mm_set1_ps(DIVBY128); + while (i >= 16) { /* 16 * 8-bit */ + const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 sint8 into an XMM register. */ + /* treat as int16, shift left to clear every other sint16, then back right with sign-extend. Now sint16. */ + const __m128i shorts1 = _mm_srai_epi16(_mm_slli_epi16(bytes, 8), 8); + /* right-shift-sign-extend gets us sint16 with the other set of values. */ + const __m128i shorts2 = _mm_srai_epi16(bytes, 8); + /* unpack against zero to make these int32, shift to make them sign-extend, convert to float, multiply. Whew! */ + const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts1, zero), 16), 16)), divby128); + const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts2, zero), 16), 16)), divby128); + const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts1, zero), 16), 16)), divby128); + const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts2, zero), 16), 16)), divby128); + /* Interleave back into correct order, store. */ + _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); + _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2)); + _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4)); + _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4)); + i -= 16; mmsrc--; dst -= 16; + } + + src = (const Sint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY128; + i--; src--; dst--; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; int i; - const Uint8 *src; - float *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatBE(val); + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + } + + src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128i *mmsrc = (const __m128i *) src; + const __m128i zero = _mm_setzero_si128(); + const __m128 divby128 = _mm_set1_ps(DIVBY128); + const __m128 minus1 = _mm_set1_ps(-1.0f); + while (i >= 16) { /* 16 * 8-bit */ + const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 uint8 into an XMM register. */ + /* treat as int16, shift left to clear every other sint16, then back right with zero-extend. Now uint16. */ + const __m128i shorts1 = _mm_srli_epi16(_mm_slli_epi16(bytes, 8), 8); + /* right-shift-zero-extend gets us uint16 with the other set of values. */ + const __m128i shorts2 = _mm_srli_epi16(bytes, 8); + /* unpack against zero to make these int32, convert to float, multiply, add. Whew! */ + /* Note that AVX2 can do floating point multiply+add in one instruction, fwiw. SSE2 cannot. */ + const __m128 floats1 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts1, zero)), divby128), minus1); + const __m128 floats2 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts2, zero)), divby128), minus1); + const __m128 floats3 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts1, zero)), divby128), minus1); + const __m128 floats4 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts2, zero)), divby128), minus1); + /* Interleave back into correct order, store. */ + _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); + _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2)); + _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4)); + _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4)); + i -= 16; mmsrc--; dst -= 16; + } + + src = (const Uint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + i--; src--; dst--; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; int i; - const Uint8 *src; - Uint8 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)"); - src = (const Uint8 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Uint8 val = ((((Sint8) *src)) ^ 0x80); - *dst = val; + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY32768; } - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); + src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby32768 = _mm_set1_ps(DIVBY32768); + while (i >= 8) { /* 8 * 16-bit */ + const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */ + /* treat as int32, shift left to clear every other sint16, then back right with sign-extend. Now sint32. */ + const __m128i a = _mm_srai_epi32(_mm_slli_epi32(ints, 16), 16); + /* right-shift-sign-extend gets us sint32 with the other set of values. */ + const __m128i b = _mm_srai_epi32(ints, 16); + /* Interleave these back into the right order, convert to float, multiply, store. */ + _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768)); + _mm_store_ps(dst+4, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768)); + i -= 8; src -= 8; dst -= 8; + } } -} -static void SDLCALL -SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; + src += 7; dst += 7; /* adjust for any scalar finishing. */ -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapLE16(val); + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY32768; + i--; src--; dst--; } cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; int i; - const Uint8 *src; - Sint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32 (using SSE2)"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + } + + src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby32768 = _mm_set1_ps(DIVBY32768); + const __m128 minus1 = _mm_set1_ps(1.0f); + while (i >= 8) { /* 8 * 16-bit */ + const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */ + /* treat as int32, shift left to clear every other sint16, then back right with zero-extend. Now sint32. */ + const __m128i a = _mm_srli_epi32(_mm_slli_epi32(ints, 16), 16); + /* right-shift-sign-extend gets us sint32 with the other set of values. */ + const __m128i b = _mm_srli_epi32(ints, 16); + /* Interleave these back into the right order, convert to float, multiply, store. */ + _mm_store_ps(dst, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768), minus1)); + _mm_store_ps(dst+4, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768), minus1)); + i -= 8; src -= 8; dst -= 8; + } + } + + src += 7; dst += 7; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + i--; src--; dst--; } cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } -static void SDLCALL -SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } +#if defined(__GNUC__) && (__GNUC__ < 4) +/* these were added as of gcc-4.0: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19418 */ +static inline __m128 _mm_castsi128_ps(__m128i __A) { + return (__m128) __A; } - -static void SDLCALL -SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } +static inline __m128i _mm_castps_si128(__m128 __A) { + return (__m128i) __A; } - -static void SDLCALL -SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n"); #endif - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - static void SDLCALL -SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint32 *src = (const Sint32 *) cvt->buf; + float *dst = (float *) cvt->buf; int i; - const Uint8 *src; - Sint32 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (Sint32); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (float) (((double) *src) * DIVBY2147483648); } - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); -static void SDLCALL -SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatLE(val); + { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128d divby2147483648 = _mm_set1_pd(DIVBY2147483648); + const __m128i *mmsrc = (const __m128i *) src; + while (i >= 4) { /* 4 * sint32 */ + const __m128i ints = _mm_load_si128(mmsrc); + /* bitshift the whole register over, so _mm_cvtepi32_pd can read the top ints in the bottom of the vector. */ + const __m128d doubles1 = _mm_mul_pd(_mm_cvtepi32_pd(_mm_srli_si128(ints, 8)), divby2147483648); + const __m128d doubles2 = _mm_mul_pd(_mm_cvtepi32_pd(ints), divby2147483648); + /* convert to float32, bitshift/or to get these into a vector to store. */ + _mm_store_ps(dst, _mm_castsi128_ps(_mm_or_si128(_mm_slli_si128(_mm_castps_si128(_mm_cvtpd_ps(doubles1)), 8), _mm_castps_si128(_mm_cvtpd_ps(doubles2))))); + i -= 4; mmsrc++; dst += 4; + } + src = (const Sint32 *) mmsrc; } - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (float) (((double) *src) * DIVBY2147483648); + i--; src++; dst++; } if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Sint8 *dst = (Sint8 *) cvt->buf; int i; - const Uint16 *src; - Uint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)"); - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapLE16(*src); - *dst = SDL_SwapBE16(val); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Sint8) (*src * 127.0f); } - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 mulby127 = _mm_set1_ps(127.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 16) { /* 16 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+8), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+12), mulby127)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packs_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ + i -= 16; src += 16; mmdst++; + } + dst = (Sint8 *) mmdst; } - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapLE16(*src)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapBE16(*src); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapBE16(*src)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Sint8) (*src * 127.0f); + i--; src++; dst++; } cvt->len_cvt /= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); + cvt->filters[cvt->filter_index](cvt, AUDIO_S8); } } static void SDLCALL -SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Uint8 *dst = (Uint8 *) cvt->buf; int i; - const Uint32 *src; - Sint8 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)"); - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24)); - *dst = ((Sint8) val); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Uint8) ((*src + 1.0f) * 127.0f); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 add1 = _mm_set1_ps(1.0f); + const __m128 mulby127 = _mm_set1_ps(127.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 16) { /* 16 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src), add1), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+4), add1), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+8), add1), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+12), add1), mulby127)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packus_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ + i -= 16; src += 16; mmdst++; + } + dst = (Uint8 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Uint8) ((*src + 1.0f) * 127.0f); + i--; src++; dst++; } cvt->len_cvt /= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); + cvt->filters[cvt->filter_index](cvt, AUDIO_U8); } } static void SDLCALL -SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Sint16 *dst = (Sint16 *) cvt->buf; int i; - const Uint32 *src; - Uint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)"); - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Sint16) (*src * 32767.0f); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 mulby32767 = _mm_set1_ps(32767.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 8) { /* 8 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packs_epi32(ints1, ints2)); /* pack to sint16, store out. */ + i -= 8; src += 8; mmdst++; + } + dst = (Sint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Sint16) (*src * 32767.0f); + i--; src++; dst++; } cvt->len_cvt /= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS); } } static void SDLCALL -SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Uint16 *dst = (Uint16 *) cvt->buf; int i; - const Uint32 *src; - Sint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16 (using SSE2)"); - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Uint16) ((*src + 1.0f) * 32767.0f); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + /* This calculates differently than the scalar path because SSE2 can't + pack int32 data down to unsigned int16. _mm_packs_epi32 does signed + saturation, so that would corrupt our data. _mm_packus_epi32 exists, + but not before SSE 4.1. So we convert from float to sint16, packing + that down with legit signed saturation, and then xor the top bit + against 1. This results in the correct unsigned 16-bit value, even + though it looks like dark magic. */ + const __m128 mulby32767 = _mm_set1_ps(32767.0f); + const __m128i topbit = _mm_set1_epi16(-32768); + __m128i *mmdst = (__m128i *) dst; + while (i >= 8) { /* 8 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_xor_si128(_mm_packs_epi32(ints1, ints2), topbit)); /* pack to sint16, xor top bit, store out. */ + i -= 8; src += 8; mmdst++; + } + dst = (Uint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Uint16) ((*src + 1.0f) * 32767.0f); + i--; src++; dst++; } cvt->len_cvt /= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS); } } static void SDLCALL -SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapLE32(*src)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapBE32(*src)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatLE(*src); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatBE(*src); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -#endif /* !NO_CONVERTERS */ - - -const SDL_AudioTypeFilters sdl_audio_type_filters[] = -{ -#if !NO_CONVERTERS - { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 }, - { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB }, - { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB }, - { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB }, - { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB }, - { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB }, - { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB }, - { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB }, - { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB }, - { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 }, - { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB }, - { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB }, - { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB }, - { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB }, - { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB }, - { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB }, - { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB }, - { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB }, - { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 }, - { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 }, - { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB }, - { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB }, - { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB }, - { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB }, - { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB }, - { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB }, - { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB }, - { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 }, - { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 }, - { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB }, - { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB }, - { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB }, - { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB }, - { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB }, - { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB }, - { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB }, - { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 }, - { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 }, - { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB }, - { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB }, - { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB }, - { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB }, - { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB }, - { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB }, - { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB }, - { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 }, - { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 }, - { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB }, - { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB }, - { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB }, - { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB }, - { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB }, - { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB }, - { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB }, - { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 }, - { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 }, - { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB }, - { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB }, - { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB }, - { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB }, - { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB }, - { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB }, - { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB }, - { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 }, - { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 }, - { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB }, - { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB }, - { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB }, - { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB }, - { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB }, - { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB }, - { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB }, - { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 }, - { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 }, - { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB }, - { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB }, - { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB }, - { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB }, - { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB }, - { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB }, - { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB }, - { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 }, - { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 }, - { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB }, - { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB }, - { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB }, - { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB }, - { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB }, - { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB }, - { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB }, -#endif /* !NO_CONVERTERS */ - { 0, 0, NULL } -}; - - -#if !NO_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = sample0; - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst++; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = sample1; - dst[0] = sample0; - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst += 2; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst += 4; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst += 6; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample7 = src[7]; - Uint8 sample6 = src[6]; - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample7 = sample7; - Uint8 last_sample6 = sample6; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = sample7; - dst[6] = sample6; - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 sample6 = src[6]; - Uint8 sample7 = src[7]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - Uint8 last_sample6 = sample6; - Uint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst[6] = sample6; - dst[7] = sample7; - dst += 8; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint8) sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst++; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst += 2; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst += 4; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst += 6; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample7 = sample7; - Sint8 last_sample6 = sample6; - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint8) sample7); - dst[6] = ((Sint8) sample6); - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - Sint8 last_sample6 = sample6; - Sint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst[6] = ((Sint8) sample6); - dst[7] = ((Sint8) sample7); - dst += 8; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapLE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapLE16(sample7); - dst[6] = SDL_SwapLE16(sample6); - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst[6] = SDL_SwapLE16(sample6); - dst[7] = SDL_SwapLE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapBE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapBE16(sample7); - dst[6] = SDL_SwapBE16(sample6); - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst[6] = SDL_SwapBE16(sample6); - dst[7] = SDL_SwapBE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; + const float *src = (const float *) cvt->buf; Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Sint32) (((double) *src) * 2147483647.0); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); + + { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128d mulby2147483647 = _mm_set1_pd(2147483647.0); + __m128i *mmdst = (__m128i *) dst; + while (i >= 4) { /* 4 * float32 */ + const __m128 floats = _mm_load_ps(src); + /* bitshift the whole register over, so _mm_cvtps_pd can read the top floats in the bottom of the vector. */ + const __m128d doubles1 = _mm_mul_pd(_mm_cvtps_pd(_mm_castsi128_ps(_mm_srli_si128(_mm_castps_si128(floats), 8))), mulby2147483647); + const __m128d doubles2 = _mm_mul_pd(_mm_cvtps_pd(floats), mulby2147483647); + _mm_store_si128(mmdst, _mm_or_si128(_mm_slli_si128(_mm_cvtpd_epi32(doubles1), 8), _mm_cvtpd_epi32(doubles2))); + i -= 4; src += 4; mmdst++; } + dst = (Sint32 *) mmdst; } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatLE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatLE(src[7]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatLE(sample7); - dst[6] = SDL_SwapFloatLE(sample6); - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample7 = SDL_SwapFloatLE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst[6] = SDL_SwapFloatLE(sample6); - dst[7] = SDL_SwapFloatLE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatBE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatBE(src[7]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatBE(sample7); - dst[6] = SDL_SwapFloatBE(sample6); - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample7 = SDL_SwapFloatBE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst[6] = SDL_SwapFloatBE(sample6); - dst[7] = SDL_SwapFloatBE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -#if !LESS_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[1] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 2; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[3] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[7] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[11] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 12; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[23] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 24; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[15] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[31] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 32; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[1] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 2; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[3] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[3] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[7] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[7] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[15] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[11] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 12; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[23] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 24; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[15] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[31] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 32; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} -static void SDLCALL -SDL_Downsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Sint32) (((double) *src) * 2147483647.0); + i--; src++; dst++; } - cvt->len_cvt = dstsize; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); + cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS); } } - -static void SDLCALL -SDL_Downsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n"); #endif - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} -static void SDLCALL -SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) +void SDL_ChooseAudioConverters(void) { -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif + static SDL_bool converters_chosen = SDL_FALSE; - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; + if (converters_chosen) { + return; } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } +#define SET_CONVERTER_FUNCS(fntype) \ + SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \ + SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \ + SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \ + SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \ + SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \ + SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \ + SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \ + SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \ + SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \ + SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ + converters_chosen = SDL_TRUE - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); +#if HAVE_SSE2_INTRINSICS + if (SDL_HasSSE2()) { + SET_CONVERTER_FUNCS(SSE2); + return; } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n"); #endif - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n"); +#if NEED_SCALAR_CONVERTER_FALLBACKS + SET_CONVERTER_FUNCS(Scalar); #endif - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } +#undef SET_CONVERTER_FUNCS - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } + SDL_assert(converters_chosen == SDL_TRUE); } -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - - -const SDL_AudioRateFilters sdl_audio_rate_filters[] = -{ -#if !NO_RESAMPLERS - { AUDIO_U8, 1, 0, 0, SDL_Downsample_U8_1c }, - { AUDIO_U8, 1, 1, 0, SDL_Upsample_U8_1c }, - { AUDIO_U8, 2, 0, 0, SDL_Downsample_U8_2c }, - { AUDIO_U8, 2, 1, 0, SDL_Upsample_U8_2c }, - { AUDIO_U8, 4, 0, 0, SDL_Downsample_U8_4c }, - { AUDIO_U8, 4, 1, 0, SDL_Upsample_U8_4c }, - { AUDIO_U8, 6, 0, 0, SDL_Downsample_U8_6c }, - { AUDIO_U8, 6, 1, 0, SDL_Upsample_U8_6c }, - { AUDIO_U8, 8, 0, 0, SDL_Downsample_U8_8c }, - { AUDIO_U8, 8, 1, 0, SDL_Upsample_U8_8c }, - { AUDIO_S8, 1, 0, 0, SDL_Downsample_S8_1c }, - { AUDIO_S8, 1, 1, 0, SDL_Upsample_S8_1c }, - { AUDIO_S8, 2, 0, 0, SDL_Downsample_S8_2c }, - { AUDIO_S8, 2, 1, 0, SDL_Upsample_S8_2c }, - { AUDIO_S8, 4, 0, 0, SDL_Downsample_S8_4c }, - { AUDIO_S8, 4, 1, 0, SDL_Upsample_S8_4c }, - { AUDIO_S8, 6, 0, 0, SDL_Downsample_S8_6c }, - { AUDIO_S8, 6, 1, 0, SDL_Upsample_S8_6c }, - { AUDIO_S8, 8, 0, 0, SDL_Downsample_S8_8c }, - { AUDIO_S8, 8, 1, 0, SDL_Upsample_S8_8c }, - { AUDIO_U16LSB, 1, 0, 0, SDL_Downsample_U16LSB_1c }, - { AUDIO_U16LSB, 1, 1, 0, SDL_Upsample_U16LSB_1c }, - { AUDIO_U16LSB, 2, 0, 0, SDL_Downsample_U16LSB_2c }, - { AUDIO_U16LSB, 2, 1, 0, SDL_Upsample_U16LSB_2c }, - { AUDIO_U16LSB, 4, 0, 0, SDL_Downsample_U16LSB_4c }, - { AUDIO_U16LSB, 4, 1, 0, SDL_Upsample_U16LSB_4c }, - { AUDIO_U16LSB, 6, 0, 0, SDL_Downsample_U16LSB_6c }, - { AUDIO_U16LSB, 6, 1, 0, SDL_Upsample_U16LSB_6c }, - { AUDIO_U16LSB, 8, 0, 0, SDL_Downsample_U16LSB_8c }, - { AUDIO_U16LSB, 8, 1, 0, SDL_Upsample_U16LSB_8c }, - { AUDIO_S16LSB, 1, 0, 0, SDL_Downsample_S16LSB_1c }, - { AUDIO_S16LSB, 1, 1, 0, SDL_Upsample_S16LSB_1c }, - { AUDIO_S16LSB, 2, 0, 0, SDL_Downsample_S16LSB_2c }, - { AUDIO_S16LSB, 2, 1, 0, SDL_Upsample_S16LSB_2c }, - { AUDIO_S16LSB, 4, 0, 0, SDL_Downsample_S16LSB_4c }, - { AUDIO_S16LSB, 4, 1, 0, SDL_Upsample_S16LSB_4c }, - { AUDIO_S16LSB, 6, 0, 0, SDL_Downsample_S16LSB_6c }, - { AUDIO_S16LSB, 6, 1, 0, SDL_Upsample_S16LSB_6c }, - { AUDIO_S16LSB, 8, 0, 0, SDL_Downsample_S16LSB_8c }, - { AUDIO_S16LSB, 8, 1, 0, SDL_Upsample_S16LSB_8c }, - { AUDIO_U16MSB, 1, 0, 0, SDL_Downsample_U16MSB_1c }, - { AUDIO_U16MSB, 1, 1, 0, SDL_Upsample_U16MSB_1c }, - { AUDIO_U16MSB, 2, 0, 0, SDL_Downsample_U16MSB_2c }, - { AUDIO_U16MSB, 2, 1, 0, SDL_Upsample_U16MSB_2c }, - { AUDIO_U16MSB, 4, 0, 0, SDL_Downsample_U16MSB_4c }, - { AUDIO_U16MSB, 4, 1, 0, SDL_Upsample_U16MSB_4c }, - { AUDIO_U16MSB, 6, 0, 0, SDL_Downsample_U16MSB_6c }, - { AUDIO_U16MSB, 6, 1, 0, SDL_Upsample_U16MSB_6c }, - { AUDIO_U16MSB, 8, 0, 0, SDL_Downsample_U16MSB_8c }, - { AUDIO_U16MSB, 8, 1, 0, SDL_Upsample_U16MSB_8c }, - { AUDIO_S16MSB, 1, 0, 0, SDL_Downsample_S16MSB_1c }, - { AUDIO_S16MSB, 1, 1, 0, SDL_Upsample_S16MSB_1c }, - { AUDIO_S16MSB, 2, 0, 0, SDL_Downsample_S16MSB_2c }, - { AUDIO_S16MSB, 2, 1, 0, SDL_Upsample_S16MSB_2c }, - { AUDIO_S16MSB, 4, 0, 0, SDL_Downsample_S16MSB_4c }, - { AUDIO_S16MSB, 4, 1, 0, SDL_Upsample_S16MSB_4c }, - { AUDIO_S16MSB, 6, 0, 0, SDL_Downsample_S16MSB_6c }, - { AUDIO_S16MSB, 6, 1, 0, SDL_Upsample_S16MSB_6c }, - { AUDIO_S16MSB, 8, 0, 0, SDL_Downsample_S16MSB_8c }, - { AUDIO_S16MSB, 8, 1, 0, SDL_Upsample_S16MSB_8c }, - { AUDIO_S32LSB, 1, 0, 0, SDL_Downsample_S32LSB_1c }, - { AUDIO_S32LSB, 1, 1, 0, SDL_Upsample_S32LSB_1c }, - { AUDIO_S32LSB, 2, 0, 0, SDL_Downsample_S32LSB_2c }, - { AUDIO_S32LSB, 2, 1, 0, SDL_Upsample_S32LSB_2c }, - { AUDIO_S32LSB, 4, 0, 0, SDL_Downsample_S32LSB_4c }, - { AUDIO_S32LSB, 4, 1, 0, SDL_Upsample_S32LSB_4c }, - { AUDIO_S32LSB, 6, 0, 0, SDL_Downsample_S32LSB_6c }, - { AUDIO_S32LSB, 6, 1, 0, SDL_Upsample_S32LSB_6c }, - { AUDIO_S32LSB, 8, 0, 0, SDL_Downsample_S32LSB_8c }, - { AUDIO_S32LSB, 8, 1, 0, SDL_Upsample_S32LSB_8c }, - { AUDIO_S32MSB, 1, 0, 0, SDL_Downsample_S32MSB_1c }, - { AUDIO_S32MSB, 1, 1, 0, SDL_Upsample_S32MSB_1c }, - { AUDIO_S32MSB, 2, 0, 0, SDL_Downsample_S32MSB_2c }, - { AUDIO_S32MSB, 2, 1, 0, SDL_Upsample_S32MSB_2c }, - { AUDIO_S32MSB, 4, 0, 0, SDL_Downsample_S32MSB_4c }, - { AUDIO_S32MSB, 4, 1, 0, SDL_Upsample_S32MSB_4c }, - { AUDIO_S32MSB, 6, 0, 0, SDL_Downsample_S32MSB_6c }, - { AUDIO_S32MSB, 6, 1, 0, SDL_Upsample_S32MSB_6c }, - { AUDIO_S32MSB, 8, 0, 0, SDL_Downsample_S32MSB_8c }, - { AUDIO_S32MSB, 8, 1, 0, SDL_Upsample_S32MSB_8c }, - { AUDIO_F32LSB, 1, 0, 0, SDL_Downsample_F32LSB_1c }, - { AUDIO_F32LSB, 1, 1, 0, SDL_Upsample_F32LSB_1c }, - { AUDIO_F32LSB, 2, 0, 0, SDL_Downsample_F32LSB_2c }, - { AUDIO_F32LSB, 2, 1, 0, SDL_Upsample_F32LSB_2c }, - { AUDIO_F32LSB, 4, 0, 0, SDL_Downsample_F32LSB_4c }, - { AUDIO_F32LSB, 4, 1, 0, SDL_Upsample_F32LSB_4c }, - { AUDIO_F32LSB, 6, 0, 0, SDL_Downsample_F32LSB_6c }, - { AUDIO_F32LSB, 6, 1, 0, SDL_Upsample_F32LSB_6c }, - { AUDIO_F32LSB, 8, 0, 0, SDL_Downsample_F32LSB_8c }, - { AUDIO_F32LSB, 8, 1, 0, SDL_Upsample_F32LSB_8c }, - { AUDIO_F32MSB, 1, 0, 0, SDL_Downsample_F32MSB_1c }, - { AUDIO_F32MSB, 1, 1, 0, SDL_Upsample_F32MSB_1c }, - { AUDIO_F32MSB, 2, 0, 0, SDL_Downsample_F32MSB_2c }, - { AUDIO_F32MSB, 2, 1, 0, SDL_Upsample_F32MSB_2c }, - { AUDIO_F32MSB, 4, 0, 0, SDL_Downsample_F32MSB_4c }, - { AUDIO_F32MSB, 4, 1, 0, SDL_Upsample_F32MSB_4c }, - { AUDIO_F32MSB, 6, 0, 0, SDL_Downsample_F32MSB_6c }, - { AUDIO_F32MSB, 6, 1, 0, SDL_Upsample_F32MSB_6c }, - { AUDIO_F32MSB, 8, 0, 0, SDL_Downsample_F32MSB_8c }, - { AUDIO_F32MSB, 8, 1, 0, SDL_Upsample_F32MSB_8c }, -#if !LESS_RESAMPLERS - { AUDIO_U8, 1, 0, 2, SDL_Downsample_U8_1c_x2 }, - { AUDIO_U8, 1, 1, 2, SDL_Upsample_U8_1c_x2 }, - { AUDIO_U8, 1, 0, 4, SDL_Downsample_U8_1c_x4 }, - { AUDIO_U8, 1, 1, 4, SDL_Upsample_U8_1c_x4 }, - { AUDIO_U8, 2, 0, 2, SDL_Downsample_U8_2c_x2 }, - { AUDIO_U8, 2, 1, 2, SDL_Upsample_U8_2c_x2 }, - { AUDIO_U8, 2, 0, 4, SDL_Downsample_U8_2c_x4 }, - { AUDIO_U8, 2, 1, 4, SDL_Upsample_U8_2c_x4 }, - { AUDIO_U8, 4, 0, 2, SDL_Downsample_U8_4c_x2 }, - { AUDIO_U8, 4, 1, 2, SDL_Upsample_U8_4c_x2 }, - { AUDIO_U8, 4, 0, 4, SDL_Downsample_U8_4c_x4 }, - { AUDIO_U8, 4, 1, 4, SDL_Upsample_U8_4c_x4 }, - { AUDIO_U8, 6, 0, 2, SDL_Downsample_U8_6c_x2 }, - { AUDIO_U8, 6, 1, 2, SDL_Upsample_U8_6c_x2 }, - { AUDIO_U8, 6, 0, 4, SDL_Downsample_U8_6c_x4 }, - { AUDIO_U8, 6, 1, 4, SDL_Upsample_U8_6c_x4 }, - { AUDIO_U8, 8, 0, 2, SDL_Downsample_U8_8c_x2 }, - { AUDIO_U8, 8, 1, 2, SDL_Upsample_U8_8c_x2 }, - { AUDIO_U8, 8, 0, 4, SDL_Downsample_U8_8c_x4 }, - { AUDIO_U8, 8, 1, 4, SDL_Upsample_U8_8c_x4 }, - { AUDIO_S8, 1, 0, 2, SDL_Downsample_S8_1c_x2 }, - { AUDIO_S8, 1, 1, 2, SDL_Upsample_S8_1c_x2 }, - { AUDIO_S8, 1, 0, 4, SDL_Downsample_S8_1c_x4 }, - { AUDIO_S8, 1, 1, 4, SDL_Upsample_S8_1c_x4 }, - { AUDIO_S8, 2, 0, 2, SDL_Downsample_S8_2c_x2 }, - { AUDIO_S8, 2, 1, 2, SDL_Upsample_S8_2c_x2 }, - { AUDIO_S8, 2, 0, 4, SDL_Downsample_S8_2c_x4 }, - { AUDIO_S8, 2, 1, 4, SDL_Upsample_S8_2c_x4 }, - { AUDIO_S8, 4, 0, 2, SDL_Downsample_S8_4c_x2 }, - { AUDIO_S8, 4, 1, 2, SDL_Upsample_S8_4c_x2 }, - { AUDIO_S8, 4, 0, 4, SDL_Downsample_S8_4c_x4 }, - { AUDIO_S8, 4, 1, 4, SDL_Upsample_S8_4c_x4 }, - { AUDIO_S8, 6, 0, 2, SDL_Downsample_S8_6c_x2 }, - { AUDIO_S8, 6, 1, 2, SDL_Upsample_S8_6c_x2 }, - { AUDIO_S8, 6, 0, 4, SDL_Downsample_S8_6c_x4 }, - { AUDIO_S8, 6, 1, 4, SDL_Upsample_S8_6c_x4 }, - { AUDIO_S8, 8, 0, 2, SDL_Downsample_S8_8c_x2 }, - { AUDIO_S8, 8, 1, 2, SDL_Upsample_S8_8c_x2 }, - { AUDIO_S8, 8, 0, 4, SDL_Downsample_S8_8c_x4 }, - { AUDIO_S8, 8, 1, 4, SDL_Upsample_S8_8c_x4 }, - { AUDIO_U16LSB, 1, 0, 2, SDL_Downsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 1, 2, SDL_Upsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 0, 4, SDL_Downsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 1, 1, 4, SDL_Upsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 2, 0, 2, SDL_Downsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 1, 2, SDL_Upsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 0, 4, SDL_Downsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 2, 1, 4, SDL_Upsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 4, 0, 2, SDL_Downsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 1, 2, SDL_Upsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 0, 4, SDL_Downsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 4, 1, 4, SDL_Upsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 6, 0, 2, SDL_Downsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 1, 2, SDL_Upsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 0, 4, SDL_Downsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 6, 1, 4, SDL_Upsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 8, 0, 2, SDL_Downsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 1, 2, SDL_Upsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 0, 4, SDL_Downsample_U16LSB_8c_x4 }, - { AUDIO_U16LSB, 8, 1, 4, SDL_Upsample_U16LSB_8c_x4 }, - { AUDIO_S16LSB, 1, 0, 2, SDL_Downsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 1, 2, SDL_Upsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 0, 4, SDL_Downsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 1, 1, 4, SDL_Upsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 2, 0, 2, SDL_Downsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 1, 2, SDL_Upsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 0, 4, SDL_Downsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 2, 1, 4, SDL_Upsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 4, 0, 2, SDL_Downsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 1, 2, SDL_Upsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 0, 4, SDL_Downsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 4, 1, 4, SDL_Upsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 6, 0, 2, SDL_Downsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 1, 2, SDL_Upsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 0, 4, SDL_Downsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 6, 1, 4, SDL_Upsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 8, 0, 2, SDL_Downsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 1, 2, SDL_Upsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 0, 4, SDL_Downsample_S16LSB_8c_x4 }, - { AUDIO_S16LSB, 8, 1, 4, SDL_Upsample_S16LSB_8c_x4 }, - { AUDIO_U16MSB, 1, 0, 2, SDL_Downsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 1, 2, SDL_Upsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 0, 4, SDL_Downsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 1, 1, 4, SDL_Upsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 2, 0, 2, SDL_Downsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 1, 2, SDL_Upsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 0, 4, SDL_Downsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 2, 1, 4, SDL_Upsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 4, 0, 2, SDL_Downsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 1, 2, SDL_Upsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 0, 4, SDL_Downsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 4, 1, 4, SDL_Upsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 6, 0, 2, SDL_Downsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 1, 2, SDL_Upsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 0, 4, SDL_Downsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 6, 1, 4, SDL_Upsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 8, 0, 2, SDL_Downsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 1, 2, SDL_Upsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 0, 4, SDL_Downsample_U16MSB_8c_x4 }, - { AUDIO_U16MSB, 8, 1, 4, SDL_Upsample_U16MSB_8c_x4 }, - { AUDIO_S16MSB, 1, 0, 2, SDL_Downsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 1, 2, SDL_Upsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 0, 4, SDL_Downsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 1, 1, 4, SDL_Upsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 2, 0, 2, SDL_Downsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 1, 2, SDL_Upsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 0, 4, SDL_Downsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 2, 1, 4, SDL_Upsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 4, 0, 2, SDL_Downsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 1, 2, SDL_Upsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 0, 4, SDL_Downsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 4, 1, 4, SDL_Upsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 6, 0, 2, SDL_Downsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 1, 2, SDL_Upsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 0, 4, SDL_Downsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 6, 1, 4, SDL_Upsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 8, 0, 2, SDL_Downsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 1, 2, SDL_Upsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 0, 4, SDL_Downsample_S16MSB_8c_x4 }, - { AUDIO_S16MSB, 8, 1, 4, SDL_Upsample_S16MSB_8c_x4 }, - { AUDIO_S32LSB, 1, 0, 2, SDL_Downsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 1, 2, SDL_Upsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 0, 4, SDL_Downsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 1, 1, 4, SDL_Upsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 2, 0, 2, SDL_Downsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 1, 2, SDL_Upsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 0, 4, SDL_Downsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 2, 1, 4, SDL_Upsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 4, 0, 2, SDL_Downsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 1, 2, SDL_Upsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 0, 4, SDL_Downsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 4, 1, 4, SDL_Upsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 6, 0, 2, SDL_Downsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 1, 2, SDL_Upsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 0, 4, SDL_Downsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 6, 1, 4, SDL_Upsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 8, 0, 2, SDL_Downsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 1, 2, SDL_Upsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 0, 4, SDL_Downsample_S32LSB_8c_x4 }, - { AUDIO_S32LSB, 8, 1, 4, SDL_Upsample_S32LSB_8c_x4 }, - { AUDIO_S32MSB, 1, 0, 2, SDL_Downsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 1, 2, SDL_Upsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 0, 4, SDL_Downsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 1, 1, 4, SDL_Upsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 2, 0, 2, SDL_Downsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 1, 2, SDL_Upsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 0, 4, SDL_Downsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 2, 1, 4, SDL_Upsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 4, 0, 2, SDL_Downsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 1, 2, SDL_Upsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 0, 4, SDL_Downsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 4, 1, 4, SDL_Upsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 6, 0, 2, SDL_Downsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 1, 2, SDL_Upsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 0, 4, SDL_Downsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 6, 1, 4, SDL_Upsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 8, 0, 2, SDL_Downsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 1, 2, SDL_Upsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 0, 4, SDL_Downsample_S32MSB_8c_x4 }, - { AUDIO_S32MSB, 8, 1, 4, SDL_Upsample_S32MSB_8c_x4 }, - { AUDIO_F32LSB, 1, 0, 2, SDL_Downsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 1, 2, SDL_Upsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 0, 4, SDL_Downsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 1, 1, 4, SDL_Upsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 2, 0, 2, SDL_Downsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 1, 2, SDL_Upsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 0, 4, SDL_Downsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 2, 1, 4, SDL_Upsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 4, 0, 2, SDL_Downsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 1, 2, SDL_Upsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 0, 4, SDL_Downsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 4, 1, 4, SDL_Upsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 6, 0, 2, SDL_Downsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 1, 2, SDL_Upsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 0, 4, SDL_Downsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 6, 1, 4, SDL_Upsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 8, 0, 2, SDL_Downsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 1, 2, SDL_Upsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 0, 4, SDL_Downsample_F32LSB_8c_x4 }, - { AUDIO_F32LSB, 8, 1, 4, SDL_Upsample_F32LSB_8c_x4 }, - { AUDIO_F32MSB, 1, 0, 2, SDL_Downsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 1, 2, SDL_Upsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 0, 4, SDL_Downsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 1, 1, 4, SDL_Upsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 2, 0, 2, SDL_Downsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 1, 2, SDL_Upsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 0, 4, SDL_Downsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 2, 1, 4, SDL_Upsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 4, 0, 2, SDL_Downsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 1, 2, SDL_Upsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 0, 4, SDL_Downsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 4, 1, 4, SDL_Upsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 6, 0, 2, SDL_Downsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 1, 2, SDL_Upsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 0, 4, SDL_Downsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 6, 1, 4, SDL_Upsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 8, 0, 2, SDL_Downsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 1, 2, SDL_Upsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 0, 4, SDL_Downsample_F32MSB_8c_x4 }, - { AUDIO_F32MSB, 8, 1, 4, SDL_Upsample_F32MSB_8c_x4 }, -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - { 0, 0, 0, 0, NULL } -}; - -/* 390 converters generated. */ - -/* *INDENT-ON* */ - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/SDL_mixer.c b/Engine/lib/sdl/src/audio/SDL_mixer.c index e0219392d..d416a94c2 100644 --- a/Engine/lib/sdl/src/audio/SDL_mixer.c +++ b/Engine/lib/sdl/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/SDL_sysaudio.h b/Engine/lib/sdl/src/audio/SDL_sysaudio.h index 943169bf7..f0e1f3dad 100644 --- a/Engine/lib/sdl/src/audio/SDL_sysaudio.h +++ b/Engine/lib/sdl/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,13 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysaudio_h -#define _SDL_sysaudio_h +#ifndef SDL_sysaudio_h_ +#define SDL_sysaudio_h_ #include "SDL_mutex.h" #include "SDL_thread.h" +#include "../SDL_dataqueue.h" +#include "./SDL_audio_c.h" /* !!! FIXME: These are wordy and unlocalized... */ #define DEFAULT_OUTPUT_DEVNAME "System audio output device" @@ -49,7 +51,6 @@ extern void SDL_RemoveAudioDevice(const int iscapture, void *handle); as appropriate so SDL's list of devices is accurate. */ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); - /* This is the size of a packet when using SDL_QueueAudio(). We allocate these as necessary and pool them, under the assumption that we'll eventually end up with a handful that keep recycling, meeting whatever @@ -61,20 +62,13 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); The system preallocates enough packets for 2 callbacks' worth of data. */ #define SDL_AUDIOBUFFERQUEUE_PACKETLEN (8 * 1024) -/* Used by apps that queue audio instead of using the callback. */ -typedef struct SDL_AudioBufferQueue -{ - Uint8 data[SDL_AUDIOBUFFERQUEUE_PACKETLEN]; /* packet data. */ - Uint32 datalen; /* bytes currently in use in this packet. */ - Uint32 startpos; /* bytes currently consumed in this packet. */ - struct SDL_AudioBufferQueue *next; /* next item in linked list. */ -} SDL_AudioBufferQueue; - typedef struct SDL_AudioDriverImpl { void (*DetectDevices) (void); int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture); void (*ThreadInit) (_THIS); /* Called by audio thread at start */ + void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */ + void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */ void (*WaitDevice) (_THIS); void (*PlayDevice) (_THIS); int (*GetPendingBytes) (_THIS); @@ -105,11 +99,7 @@ typedef struct SDL_AudioDeviceItem { void *handle; struct SDL_AudioDeviceItem *next; - #if (defined(__GNUC__) && (__GNUC__ <= 2)) - char name[1]; /* actually variable length. */ - #else - char name[]; - #endif + char name[SDL_VARIABLE_LENGTH_ARRAY]; } SDL_AudioDeviceItem; @@ -136,15 +126,6 @@ typedef struct SDL_AudioDriver } SDL_AudioDriver; -/* Streamer */ -typedef struct -{ - Uint8 *buffer; - int max_len; /* the maximum length in bytes */ - int read_pos, write_pos; /* the position of the write and read heads in bytes */ -} SDL_AudioStreamer; - - /* Define the SDL audio driver structure */ struct SDL_AudioDevice { @@ -152,15 +133,14 @@ struct SDL_AudioDevice /* Data common to all devices */ SDL_AudioDeviceID id; - /* The current audio specification (shared with audio thread) */ + /* The device's current audio specification */ SDL_AudioSpec spec; - /* An audio conversion block for audio format emulation */ - SDL_AudioCVT convert; + /* The callback's expected audio specification (converted vs device's spec). */ + SDL_AudioSpec callbackspec; - /* The streamer, if sample rate conversion necessitates it */ - int use_streamer; - SDL_AudioStreamer streamer; + /* Stream that converts and resamples. NULL if not needed. */ + SDL_AudioStream *stream; /* Current state flags */ SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */ @@ -168,8 +148,11 @@ struct SDL_AudioDevice SDL_atomic_t paused; SDL_bool iscapture; - /* Fake audio buffer for when the audio hardware is busy */ - Uint8 *fake_stream; + /* Scratch buffer used in the bridge between SDL and the user callback. */ + Uint8 *work_buffer; + + /* Size, in bytes, of work_buffer. */ + Uint32 work_buffer_len; /* A mutex for locking the mixing buffers */ SDL_mutex *mixer_lock; @@ -179,10 +162,7 @@ struct SDL_AudioDevice SDL_threadID threadid; /* Queued buffers (if app not using callback). */ - SDL_AudioBufferQueue *buffer_queue_head; /* device fed from here. */ - SDL_AudioBufferQueue *buffer_queue_tail; /* queue fills to here. */ - SDL_AudioBufferQueue *buffer_queue_pool; /* these are unused packets. */ - Uint32 queued_bytes; /* number of bytes of audio data in the queue. */ + SDL_DataQueue *buffer_queue; /* * * */ /* Data private to this driver */ @@ -200,6 +180,32 @@ typedef struct AudioBootStrap int demand_only; /* 1==request explicitly, or it won't be available. */ } AudioBootStrap; -#endif /* _SDL_sysaudio_h */ +/* Not all of these are available in a given build. Use #ifdefs, etc. */ +extern AudioBootStrap PULSEAUDIO_bootstrap; +extern AudioBootStrap ALSA_bootstrap; +extern AudioBootStrap JACK_bootstrap; +extern AudioBootStrap SNDIO_bootstrap; +extern AudioBootStrap NETBSDAUDIO_bootstrap; +extern AudioBootStrap DSP_bootstrap; +extern AudioBootStrap QSAAUDIO_bootstrap; +extern AudioBootStrap SUNAUDIO_bootstrap; +extern AudioBootStrap ARTS_bootstrap; +extern AudioBootStrap ESD_bootstrap; +extern AudioBootStrap NACLAUDIO_bootstrap; +extern AudioBootStrap NAS_bootstrap; +extern AudioBootStrap WASAPI_bootstrap; +extern AudioBootStrap DSOUND_bootstrap; +extern AudioBootStrap WINMM_bootstrap; +extern AudioBootStrap PAUDIO_bootstrap; +extern AudioBootStrap HAIKUAUDIO_bootstrap; +extern AudioBootStrap COREAUDIO_bootstrap; +extern AudioBootStrap DISKAUDIO_bootstrap; +extern AudioBootStrap DUMMYAUDIO_bootstrap; +extern AudioBootStrap FUSIONSOUND_bootstrap; +extern AudioBootStrap ANDROIDAUDIO_bootstrap; +extern AudioBootStrap PSPAUDIO_bootstrap; +extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; + +#endif /* SDL_sysaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/SDL_wave.c b/Engine/lib/sdl/src/audio/SDL_wave.c index d173b4a92..2c76a8ce9 100644 --- a/Engine/lib/sdl/src/audio/SDL_wave.c +++ b/Engine/lib/sdl/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -403,6 +403,47 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) return (0); } + +static int +ConvertSint24ToSint32(Uint8 ** audio_buf, Uint32 * audio_len) +{ + const double DIVBY8388608 = 0.00000011920928955078125; + const Uint32 original_len = *audio_len; + const Uint32 samples = original_len / 3; + const Uint32 expanded_len = samples * sizeof (Uint32); + Uint8 *ptr = (Uint8 *) SDL_realloc(*audio_buf, expanded_len); + const Uint8 *src; + Uint32 *dst; + Uint32 i; + + if (!ptr) { + return SDL_OutOfMemory(); + } + + *audio_buf = ptr; + *audio_len = expanded_len; + + /* work from end to start, since we're expanding in-place. */ + src = (ptr + original_len) - 3; + dst = ((Uint32 *) (ptr + expanded_len)) - 1; + for (i = 0; i < samples; i++) { + /* There's probably a faster way to do all this. */ + const Sint32 converted = ((Sint32) ( (((Uint32) src[2]) << 24) | + (((Uint32) src[1]) << 16) | + (((Uint32) src[0]) << 8) )) >> 8; + const double scaled = (((double) converted) * DIVBY8388608); + src -= 3; + *(dst--) = (Sint32) (scaled * 2147483647.0); + } + + return 0; +} + + +/* GUIDs that are used by WAVE_FORMAT_EXTENSIBLE */ +static const Uint8 extensible_pcm_guid[16] = { 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; +static const Uint8 extensible_ieee_guid[16] = { 3, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; + SDL_AudioSpec * SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len) @@ -421,6 +462,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, /* FMT chunk */ WaveFMT *format = NULL; + WaveExtensibleFMT *ext = NULL; SDL_zero(chunk); @@ -494,6 +536,24 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, } IMA_ADPCM_encoded = 1; break; + case EXTENSIBLE_CODE: + /* note that this ignores channel masks, smaller valid bit counts + inside a larger container, and most subtypes. This is just enough + to get things that didn't really _need_ WAVE_FORMAT_EXTENSIBLE + to be useful working when they use this format flag. */ + ext = (WaveExtensibleFMT *) format; + if (SDL_SwapLE16(ext->size) < 22) { + SDL_SetError("bogus extended .wav header"); + was_error = 1; + goto done; + } + if (SDL_memcmp(ext->subformat, extensible_pcm_guid, 16) == 0) { + break; /* cool. */ + } else if (SDL_memcmp(ext->subformat, extensible_ieee_guid, 16) == 0) { + IEEE_float_encoded = 1; + break; + } + break; case MP3_CODE: SDL_SetError("MPEG Layer 3 data not supported"); was_error = 1; @@ -528,6 +588,9 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, case 16: spec->format = AUDIO_S16; break; + case 24: /* convert this. */ + spec->format = AUDIO_S32; + break; case 32: spec->format = AUDIO_S32; break; @@ -575,6 +638,13 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, } } + if (SDL_SwapLE16(format->bitspersample) == 24) { + if (ConvertSint24ToSint32(audio_buf, audio_len) < 0) { + was_error = 1; + goto done; + } + } + /* Don't return a buffer that isn't a multiple of samplesize */ samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels; *audio_len &= ~(samplesize - 1); diff --git a/Engine/lib/sdl/src/audio/SDL_wave.h b/Engine/lib/sdl/src/audio/SDL_wave.h index f2f93986e..5c60f7538 100644 --- a/Engine/lib/sdl/src/audio/SDL_wave.h +++ b/Engine/lib/sdl/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,7 @@ #define IEEE_FLOAT_CODE 0x0003 #define IMA_ADPCM_CODE 0x0011 #define MP3_CODE 0x0055 +#define EXTENSIBLE_CODE 0xFFFE #define WAVE_MONO 1 #define WAVE_STEREO 2 @@ -64,4 +65,13 @@ typedef struct Chunk Uint8 *data; } Chunk; +typedef struct WaveExtensibleFMT +{ + WaveFMT format; + Uint16 size; + Uint16 validbits; + Uint32 channelmask; + Uint8 subformat[16]; /* a GUID. */ +} WaveExtensibleFMT; + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c index 574d51bd5..2dba1ff46 100644 --- a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c +++ b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,6 @@ #include #include /* For kill() */ -#include #include #include "SDL_assert.h" @@ -91,6 +90,10 @@ static int (*ALSA_snd_pcm_reset)(snd_pcm_t *); static int (*ALSA_snd_device_name_hint) (int, const char *, void ***); static char* (*ALSA_snd_device_name_get_hint) (const void *, const char *); static int (*ALSA_snd_device_name_free_hint) (void **); +#ifdef SND_CHMAP_API_VERSION +static snd_pcm_chmap_t* (*ALSA_snd_pcm_get_chmap) (snd_pcm_t *); +static int (*ALSA_snd_pcm_chmap_print) (const snd_pcm_chmap_t *map, size_t maxlen, char *buf); +#endif #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC #define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof @@ -155,6 +158,10 @@ load_alsa_syms(void) SDL_ALSA_SYM(snd_device_name_hint); SDL_ALSA_SYM(snd_device_name_get_hint); SDL_ALSA_SYM(snd_device_name_free_hint); +#ifdef SND_CHMAP_API_VERSION + SDL_ALSA_SYM(snd_pcm_get_chmap); + SDL_ALSA_SYM(snd_pcm_chmap_print); +#endif return 0; } @@ -255,25 +262,25 @@ ALSA_WaitDevice(_THIS) tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \ } -static SDL_INLINE void +static void swizzle_alsa_channels_6_64bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint64, buffer, bufferlen); } -static SDL_INLINE void +static void swizzle_alsa_channels_6_32bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint32, buffer, bufferlen); } -static SDL_INLINE void +static void swizzle_alsa_channels_6_16bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint16, buffer, bufferlen); } -static SDL_INLINE void +static void swizzle_alsa_channels_6_8bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint8, buffer, bufferlen); @@ -286,7 +293,7 @@ swizzle_alsa_channels_6_8bit(void *buffer, Uint32 bufferlen) * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle * channels from Windows/Mac order to the format alsalib will want. */ -static SDL_INLINE void +static void swizzle_alsa_channels(_THIS, void *buffer, Uint32 bufferlen) { if (this->spec.channels == 6) { @@ -302,6 +309,15 @@ swizzle_alsa_channels(_THIS, void *buffer, Uint32 bufferlen) /* !!! FIXME: update this for 7.1 if needed, later. */ } +#ifdef SND_CHMAP_API_VERSION +/* Some devices have the right channel map, no swizzling necessary */ +static void +no_swizzle(_THIS, void *buffer, Uint32 bufferlen) +{ + return; +} +#endif /* SND_CHMAP_API_VERSION */ + static void ALSA_PlayDevice(_THIS) @@ -311,23 +327,10 @@ ALSA_PlayDevice(_THIS) this->spec.channels; snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples); - swizzle_alsa_channels(this, this->hidden->mixbuf, frames_left); + this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left); while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { - int status; - - /* This wait is a work-around for a hang when USB devices are - unplugged. Normally it should not result in any waiting, - but in the case of a USB unplug, it serves as a way to - join the playback thread after the timeout occurs */ - status = ALSA_snd_pcm_wait(this->hidden->pcm_handle, 1000); - if (status == 0) { - /*fprintf(stderr, "ALSA timeout waiting for available buffer space\n");*/ - SDL_OpenedAudioDeviceDisconnected(this); - return; - } - - status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, + int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, sample_buf, frames_left); if (status < 0) { @@ -347,6 +350,13 @@ ALSA_PlayDevice(_THIS) } continue; } + else if (status == 0) { + /* No frames were written (no available space in pcm device). + Allow other threads to catch up. */ + Uint32 delay = (frames_left / 2 * 1000) / this->spec.freq; + SDL_Delay(delay); + } + sample_buf += status * frame_size; frames_left -= status; } @@ -366,23 +376,22 @@ ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen) this->spec.channels; const int total_frames = buflen / frame_size; snd_pcm_uframes_t frames_left = total_frames; + snd_pcm_uframes_t wait_time = frame_size / 2; SDL_assert((buflen % frame_size) == 0); while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { - /* !!! FIXME: This works, but needs more testing before going live */ - /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */ - int status = ALSA_snd_pcm_readi(this->hidden->pcm_handle, + int status; + + status = ALSA_snd_pcm_readi(this->hidden->pcm_handle, sample_buf, frames_left); - if (status < 0) { + if (status == -EAGAIN) { + ALSA_snd_pcm_wait(this->hidden->pcm_handle, wait_time); + status = 0; + } + else if (status < 0) { /*printf("ALSA: capture error %d\n", status);*/ - if (status == -EAGAIN) { - /* Apparently snd_pcm_recover() doesn't handle this case - - does it assume snd_pcm_wait() above? */ - SDL_Delay(1); - continue; - } status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0); if (status < 0) { /* Hmm, not much we can do - abort */ @@ -398,7 +407,7 @@ ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen) frames_left -= status; } - swizzle_alsa_channels(this, buffer, total_frames - frames_left); + this->hidden->swizzle_func(this, buffer, total_frames - frames_left); return (total_frames - frames_left) * frame_size; } @@ -548,6 +557,10 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_AudioFormat test_format = 0; unsigned int rate = 0; unsigned int channels = 0; +#ifdef SND_CHMAP_API_VERSION + snd_pcm_chmap_t *chmap; + char chmap_str[64]; +#endif /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -640,6 +653,22 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } this->spec.format = test_format; + /* Validate number of channels and determine if swizzling is necessary + * Assume original swizzling, until proven otherwise. + */ + this->hidden->swizzle_func = swizzle_alsa_channels; +#ifdef SND_CHMAP_API_VERSION + chmap = ALSA_snd_pcm_get_chmap(pcm_handle); + if (chmap) { + ALSA_snd_pcm_chmap_print(chmap, sizeof(chmap_str), chmap_str); + if (SDL_strcmp("FL FR FC LFE RL RR", chmap_str) == 0 || + SDL_strcmp("FL FR FC LFE SL SR", chmap_str) == 0) { + this->hidden->swizzle_func = no_swizzle; + } + free(chmap); + } +#endif /* SND_CHMAP_API_VERSION */ + /* Set the number of channels */ status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams, this->spec.channels); @@ -708,8 +737,9 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); } - /* Switch to blocking mode for playback */ - ALSA_snd_pcm_nonblock(pcm_handle, 0); + if (!iscapture) { + ALSA_snd_pcm_nonblock(pcm_handle, 0); + } /* We're ready to rock and roll. :-) */ return 0; @@ -726,18 +756,28 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSeen) { ALSA_Device *dev = SDL_malloc(sizeof (ALSA_Device)); - char *desc = ALSA_snd_device_name_get_hint(hint, "DESC"); + char *desc; char *handle = NULL; char *ptr; - if (!desc) { - SDL_free(dev); - return; - } else if (!dev) { - free(desc); + if (!dev) { return; } + /* Not all alsa devices are enumerable via snd_device_name_get_hint + (i.e. bluetooth devices). Therefore if hint is passed in to this + function as NULL, assume name contains desc. + Make sure not to free the storage associated with desc in this case */ + if (hint) { + desc = ALSA_snd_device_name_get_hint(hint, "DESC"); + if (!desc) { + SDL_free(dev); + return; + } + } else { + desc = (char *) name; + } + SDL_assert(name != NULL); /* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output". @@ -751,14 +791,16 @@ add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSee handle = SDL_strdup(name); if (!handle) { - free(desc); + if (hint) { + free(desc); + } SDL_free(dev); return; } SDL_AddAudioDevice(iscapture, desc, handle); - free(desc); - + if (hint) + free(desc); dev->name = handle; dev->iscapture = iscapture; dev->next = *pSeen; @@ -778,12 +820,15 @@ ALSA_HotplugThread(void *arg) ALSA_Device *dev; Uint32 ticks; + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW); + while (!SDL_AtomicGet(&ALSA_hotplug_shutdown)) { void **hints = NULL; + ALSA_Device *unseen; + ALSA_Device *seen; + ALSA_Device *prev; + if (ALSA_snd_device_name_hint(-1, "pcm", &hints) != -1) { - ALSA_Device *unseen = devices; - ALSA_Device *seen = NULL; - ALSA_Device *prev; int i, j; const char *match = NULL; int bestmatch = 0xFFFF; @@ -793,6 +838,8 @@ ALSA_HotplugThread(void *arg) "hw:", "sysdefault:", "default:", NULL }; + unseen = devices; + seen = NULL; /* Apparently there are several different ways that ALSA lists actual hardware. It could be prefixed with "hw:" or "default:" or "sysdefault:" and maybe others. Go through the list and see @@ -887,7 +934,7 @@ ALSA_HotplugThread(void *arg) /* report anything still in unseen as removed. */ for (dev = unseen; dev; dev = next) { - /*printf("ALSA: removing %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/ + /*printf("ALSA: removing usb %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/ next = dev->next; SDL_RemoveAudioDevice(dev->iscapture, dev->name); SDL_free(dev->name); diff --git a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h index 3080aea23..f62050017 100644 --- a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h +++ b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_ALSA_audio_h -#define _SDL_ALSA_audio_h +#ifndef SDL_ALSA_audio_h_ +#define SDL_ALSA_audio_h_ #include @@ -38,8 +38,11 @@ struct SDL_PrivateAudioData /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; + + /* swizzle function */ + void (*swizzle_func)(_THIS, void *buffer, Uint32 bufferlen); }; -#endif /* _SDL_ALSA_audio_h */ +#endif /* SDL_ALSA_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c index 96f6d631a..7a2542461 100644 --- a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c +++ b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -215,6 +215,10 @@ void ANDROIDAUDIO_ResumeDevices(void) } } +#else + +void ANDROIDAUDIO_ResumeDevices(void) {} +void ANDROIDAUDIO_PauseDevices(void) {} #endif /* SDL_AUDIO_DRIVER_ANDROID */ diff --git a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h index 133615302..c732ac687 100644 --- a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h +++ b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidaudio_h -#define _SDL_androidaudio_h +#ifndef SDL_androidaudio_h_ +#define SDL_androidaudio_h_ #include "../SDL_sysaudio.h" @@ -34,6 +34,9 @@ struct SDL_PrivateAudioData int resume; }; -#endif /* _SDL_androidaudio_h */ +void ANDROIDAUDIO_ResumeDevices(void); +void ANDROIDAUDIO_PauseDevices(void); + +#endif /* SDL_androidaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c index 6054e36b6..4e3ebf2ce 100644 --- a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c +++ b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h index 6b9bf3037..774365486 100644 --- a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h +++ b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_artscaudio_h -#define _SDL_artscaudio_h +#ifndef SDL_artsaudio_h_ +#define SDL_artsaudio_h_ #include @@ -42,11 +42,12 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_artscaudio_h */ +#endif /* SDL_artsaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h index b7e5b8e21..7ce8b8dfa 100644 --- a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h +++ b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_coreaudio_h -#define _SDL_coreaudio_h +#ifndef SDL_coreaudio_h_ +#define SDL_coreaudio_h_ #include "../SDL_sysaudio.h" @@ -47,7 +47,7 @@ struct SDL_PrivateAudioData { SDL_Thread *thread; AudioQueueRef audioQueue; - AudioQueueBufferRef audioBuffer[2]; + AudioQueueBufferRef *audioBuffer; void *buffer; UInt32 bufferOffset; UInt32 bufferSize; @@ -63,5 +63,6 @@ struct SDL_PrivateAudioData #endif }; -#endif /* _SDL_coreaudio_h */ +#endif /* SDL_coreaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m index 85129050f..92f5f12a0 100644 --- a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m +++ b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ /* !!! FIXME: clean out some of the macro salsa in here. */ #include "SDL_audio.h" +#include "SDL_hints.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_coreaudio.h" @@ -285,9 +286,9 @@ static void interruption_begin(_THIS) static void interruption_end(_THIS) { if (this != NULL && this->hidden != NULL && this->hidden->audioQueue != NULL - && this->hidden->interrupted) { + && this->hidden->interrupted + && AudioQueueStart(this->hidden->audioQueue, NULL) == AVAudioSessionErrorCodeNone) { this->hidden->interrupted = SDL_FALSE; - AudioQueueStart(this->hidden->audioQueue, NULL); } } @@ -325,7 +326,8 @@ static BOOL update_audio_session(_THIS, SDL_bool open) @autoreleasepool { AVAudioSession *session = [AVAudioSession sharedInstance]; NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - NSString *category; + /* Set category to ambient by default so that other music continues playing. */ + NSString *category = AVAudioSessionCategoryAmbient; NSError *err = nil; if (open_playback_devices && open_capture_devices) { @@ -333,10 +335,17 @@ static BOOL update_audio_session(_THIS, SDL_bool open) } else if (open_capture_devices) { category = AVAudioSessionCategoryRecord; } else { - /* Set category to ambient so that other music continues playing. - You can change this at runtime in your own code if you need different - behavior. If this is common, we can add an SDL hint for this. */ - category = AVAudioSessionCategoryAmbient; + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY); + if (hint) { + if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) { + category = AVAudioSessionCategoryAmbient; + } else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) { + category = AVAudioSessionCategorySoloAmbient; + } else if (SDL_strcasecmp(hint, "AVAudioSessionCategoryPlayback") == 0 || + SDL_strcasecmp(hint, "playback") == 0) { + category = AVAudioSessionCategoryPlayback; + } + } } if (![session setCategory:category error:&err]) { @@ -400,8 +409,12 @@ static void outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; + if (SDL_AtomicGet(&this->hidden->shutdown)) { + return; /* don't do anything. */ + } + if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { - /* Supply silence if audio is enabled and not paused */ + /* Supply silence if audio is not enabled or paused */ SDL_memset(inBuffer->mAudioData, this->spec.silence, inBuffer->mAudioDataBytesCapacity); } else { UInt32 remaining = inBuffer->mAudioDataBytesCapacity; @@ -412,7 +425,7 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe if (this->hidden->bufferOffset >= this->hidden->bufferSize) { /* Generate the data */ SDL_LockMutex(this->mixer_lock); - (*this->spec.callback)(this->spec.userdata, + (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; @@ -430,9 +443,7 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe } } - if (!SDL_AtomicGet(&this->hidden->shutdown)) { - AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); - } + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; } @@ -443,7 +454,13 @@ inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer const AudioStreamPacketDescription *inPacketDescs ) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; - if (SDL_AtomicGet(&this->enabled) && !SDL_AtomicGet(&this->paused)) { /* ignore unless we're active. */ + + if (SDL_AtomicGet(&this->shutdown)) { + return; /* don't do anything. */ + } + + /* ignore unless we're active. */ + if (!SDL_AtomicGet(&this->paused) && SDL_AtomicGet(&this->enabled) && !SDL_AtomicGet(&this->paused)) { const Uint8 *ptr = (const Uint8 *) inBuffer->mAudioData; UInt32 remaining = inBuffer->mAudioDataByteSize; while (remaining > 0) { @@ -459,16 +476,14 @@ inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer if (this->hidden->bufferOffset >= this->hidden->bufferSize) { SDL_LockMutex(this->mixer_lock); - (*this->spec.callback)(this->spec.userdata, this->hidden->buffer, this->hidden->bufferSize); + (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; } } } - if (!SDL_AtomicGet(&this->hidden->shutdown)) { - AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); - } + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); } @@ -514,7 +529,6 @@ static void COREAUDIO_CloseDevice(_THIS) { const SDL_bool iscapture = this->iscapture; - int i; /* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */ /* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */ @@ -527,24 +541,24 @@ COREAUDIO_CloseDevice(_THIS) update_audio_session(this, SDL_FALSE); #endif + /* if callback fires again, feed silence; don't call into the app. */ + SDL_AtomicSet(&this->paused, 1); + + if (this->hidden->audioQueue) { + AudioQueueDispose(this->hidden->audioQueue, 1); + } + if (this->hidden->thread) { SDL_AtomicSet(&this->hidden->shutdown, 1); SDL_WaitThread(this->hidden->thread, NULL); } - if (this->hidden->audioQueue) { - for (i = 0; i < SDL_arraysize(this->hidden->audioBuffer); i++) { - if (this->hidden->audioBuffer[i]) { - AudioQueueFreeBuffer(this->hidden->audioQueue, this->hidden->audioBuffer[i]); - } - } - AudioQueueDispose(this->hidden->audioQueue, 1); - } - if (this->hidden->ready_semaphore) { SDL_DestroySemaphore(this->hidden->ready_semaphore); } + /* AudioQueueDispose() frees the actual buffer objects. */ + SDL_free(this->hidden->audioBuffer); SDL_free(this->hidden->thread_error); SDL_free(this->hidden->buffer); SDL_free(this->hidden); @@ -663,7 +677,31 @@ prepare_audioqueue(_THIS) return 0; } - for (i = 0; i < SDL_arraysize(this->hidden->audioBuffer); i++) { + /* Make sure we can feed the device a minimum amount of time */ + double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; +#if defined(__IPHONEOS__) + if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { + /* Older iOS hardware, use 40 ms as a minimum time */ + MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0; + } +#endif + const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0; + int numAudioBuffers = 2; + if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { /* use more buffers if we have a VERY small sample set. */ + numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); + } + + this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * numAudioBuffers); + if (this->hidden->audioBuffer == NULL) { + SDL_OutOfMemory(); + return 0; + } + +#if DEBUG_COREAUDIO + printf("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers); +#endif + + for (i = 0; i < numAudioBuffers; i++) { result = AudioQueueAllocateBuffer(this->hidden->audioQueue, this->spec.size, &this->hidden->audioBuffer[i]); CHECK_RESULT("AudioQueueAllocateBuffer"); SDL_memset(this->hidden->audioBuffer[i]->mAudioData, this->spec.silence, this->hidden->audioBuffer[i]->mAudioDataBytesCapacity); @@ -696,10 +734,7 @@ audioqueue_thread(void *arg) CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); } - if (this->iscapture) { /* just stop immediately for capture devices. */ - AudioQueueStop(this->hidden->audioQueue, 1); - } else { /* Drain off any pending playback. */ - AudioQueueStop(this->hidden->audioQueue, 0); + if (!this->iscapture) { /* Drain off any pending playback. */ const CFTimeInterval secs = (((this->spec.size / (SDL_AUDIO_BITSIZE(this->spec.format) / 8)) / this->spec.channels) / ((CFTimeInterval) this->spec.freq)) * 2.0; CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0); } @@ -734,6 +769,13 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (!update_audio_session(this, SDL_TRUE)) { return -1; } + + /* Stop CoreAudio from doing expensive audio rate conversion */ + @autoreleasepool { + AVAudioSession* session = [AVAudioSession sharedInstance]; + [session setPreferredSampleRate:this->spec.freq error:nil]; + this->spec.freq = (int)session.sampleRate; + } #endif /* Setup a AudioStreamBasicDescription with the requested format */ diff --git a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c index 5d261c92e..09b83aedf 100644 --- a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c +++ b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -434,7 +434,6 @@ CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt) LPDIRECTSOUNDCAPTURE capture = this->hidden->capture; LPDIRECTSOUNDCAPTUREBUFFER *capturebuf = &this->hidden->capturebuf; DSCBUFFERDESC format; -// DWORD junk, cursor; HRESULT result; SDL_zero(format); @@ -523,8 +522,8 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) bufsize = numchunks * this->spec.size; if ((bufsize < DSBSIZE_MIN) || (bufsize > DSBSIZE_MAX)) { SDL_SetError("Sound buffer size must be between %d and %d", - (DSBSIZE_MIN < numchunks) ? 1 : DSBSIZE_MIN / numchunks, - DSBSIZE_MAX / numchunks); + (int) ((DSBSIZE_MIN < numchunks) ? 1 : DSBSIZE_MIN / numchunks), + (int) (DSBSIZE_MAX / numchunks)); } else { int rc; WAVEFORMATEX wfmt; diff --git a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h index d646c303f..acb7b6ac1 100644 --- a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h +++ b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_directsound_h -#define _SDL_directsound_h +#ifndef SDL_directsound_h_ +#define SDL_directsound_h_ #include "../../core/windows/SDL_directx.h" @@ -42,6 +42,6 @@ struct SDL_PrivateAudioData Uint8 *locked_buf; }; -#endif /* _SDL_directsound_h */ +#endif /* SDL_directsound_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c index ee5368844..2250375da 100644 --- a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c +++ b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "SDL_diskaudio.h" +#include "SDL_log.h" /* !!! FIXME: these should be SDL hints, not environment variables. */ /* environment variables and defaults. */ @@ -160,12 +161,11 @@ DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); } -#if HAVE_STDIO_H - fprintf(stderr, - "WARNING: You are using the SDL disk i/o audio driver!\n" - " %s file [%s].\n", iscapture ? "Reading from" : "Writing to", - fname); -#endif + SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, + "You are using the SDL disk i/o audio driver!\n"); + SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, + " %s file [%s].\n", iscapture ? "Reading from" : "Writing to", + fname); /* We're ready to rock and roll. :-) */ return 0; diff --git a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h index ad152a9ce..7e73ebe53 100644 --- a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h +++ b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_diskaudio_h -#define _SDL_diskaudio_h +#ifndef SDL_diskaudio_h_ +#define SDL_diskaudio_h_ #include "SDL_rwops.h" #include "../SDL_sysaudio.h" @@ -37,5 +37,5 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; }; -#endif /* _SDL_diskaudio_h */ +#endif /* SDL_diskaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c index a5a31b3aa..77653bede 100644 --- a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c +++ b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h index 0e4acfcab..6bd86d71d 100644 --- a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h +++ b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_dspaudio_h -#define _SDL_dspaudio_h +#ifndef SDL_dspaudio_h_ +#define SDL_dspaudio_h_ #include "../SDL_sysaudio.h" @@ -39,5 +39,5 @@ struct SDL_PrivateAudioData }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_dspaudio_h */ +#endif /* SDL_dspaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c index b39f8e327..f91dea388 100644 --- a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c +++ b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h index b1f88b1cb..18241ee54 100644 --- a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h +++ b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_dummyaudio_h -#define _SDL_dummyaudio_h +#ifndef SDL_dummyaudio_h_ +#define SDL_dummyaudio_h_ #include "../SDL_sysaudio.h" @@ -37,5 +37,5 @@ struct SDL_PrivateAudioData Uint32 initial_calls; }; -#endif /* _SDL_dummyaudio_h */ +#endif /* SDL_dummyaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c index 839d445ee..e519f0834 100644 --- a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,175 +26,121 @@ #include "SDL_log.h" #include "../SDL_audio_c.h" #include "SDL_emscriptenaudio.h" +#include "SDL_assert.h" #include -static int -copyData(_THIS) +static void +FeedAudioDevice(_THIS, const void *buf, const int buflen) { - int byte_len; + const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; + EM_ASM_ARGS({ + var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; + for (var c = 0; c < numChannels; ++c) { + var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); + if (channelData.length != $1) { + throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; + } - if (this->hidden->write_off + this->convert.len_cvt > this->hidden->mixlen) { - if (this->hidden->write_off > this->hidden->read_off) { - SDL_memmove(this->hidden->mixbuf, - this->hidden->mixbuf + this->hidden->read_off, - this->hidden->mixlen - this->hidden->read_off); - this->hidden->write_off = this->hidden->write_off - this->hidden->read_off; - } else { - this->hidden->write_off = 0; + for (var j = 0; j < $1; ++j) { + channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; /* !!! FIXME: why are these shifts here? */ + } } - this->hidden->read_off = 0; - } - - SDL_memcpy(this->hidden->mixbuf + this->hidden->write_off, - this->convert.buf, - this->convert.len_cvt); - this->hidden->write_off += this->convert.len_cvt; - byte_len = this->hidden->write_off - this->hidden->read_off; - - return byte_len; + }, buf, buflen / framelen); } static void HandleAudioProcess(_THIS) { - Uint8 *buf = NULL; - int byte_len = 0; - int bytes = SDL_AUDIO_BITSIZE(this->spec.format) / 8; + SDL_AudioCallback callback = this->callbackspec.callback; + const int stream_len = this->callbackspec.size; /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { + if (this->stream) { + SDL_AudioStreamClear(this->stream); + } return; } - if (this->convert.needed) { - const int bytes_in = SDL_AUDIO_BITSIZE(this->convert.src_format) / 8; - - if (this->hidden->conv_in_len != 0) { - this->convert.len = this->hidden->conv_in_len * bytes_in * this->spec.channels; - } - - (*this->spec.callback) (this->spec.userdata, - this->convert.buf, - this->convert.len); - SDL_ConvertAudio(&this->convert); - buf = this->convert.buf; - byte_len = this->convert.len_cvt; - - /* size mismatch*/ - if (byte_len != this->spec.size) { - if (!this->hidden->mixbuf) { - this->hidden->mixlen = this->spec.size > byte_len ? this->spec.size * 2 : byte_len * 2; - this->hidden->mixbuf = SDL_malloc(this->hidden->mixlen); + if (this->stream == NULL) { /* no conversion necessary. */ + SDL_assert(this->spec.size == stream_len); + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + } else { /* streaming/converting */ + int got; + while (SDL_AudioStreamAvailable(this->stream) < ((int) this->spec.size)) { + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + if (SDL_AudioStreamPut(this->stream, this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(this->stream); + SDL_AtomicSet(&this->enabled, 0); + break; } - - /* copy existing data */ - byte_len = copyData(this); - - /* read more data*/ - while (byte_len < this->spec.size) { - (*this->spec.callback) (this->spec.userdata, - this->convert.buf, - this->convert.len); - SDL_ConvertAudio(&this->convert); - byte_len = copyData(this); - } - - byte_len = this->spec.size; - buf = this->hidden->mixbuf + this->hidden->read_off; - this->hidden->read_off += byte_len; } - } else { - if (!this->hidden->mixbuf) { - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = SDL_malloc(this->hidden->mixlen); + got = SDL_AudioStreamGet(this->stream, this->work_buffer, this->spec.size); + SDL_assert((got < 0) || (got == this->spec.size)); + if (got != this->spec.size) { + SDL_memset(this->work_buffer, this->spec.silence, this->spec.size); } - (*this->spec.callback) (this->spec.userdata, - this->hidden->mixbuf, - this->hidden->mixlen); - buf = this->hidden->mixbuf; - byte_len = this->hidden->mixlen; } - if (buf) { - EM_ASM_ARGS({ - var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; - for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); - if (channelData.length != $1) { - throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; - } - - for (var j = 0; j < $1; ++j) { - channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; - } - } - }, buf, byte_len / bytes / this->spec.channels); - } + FeedAudioDevice(this, this->work_buffer, this->spec.size); } static void HandleCaptureProcess(_THIS) { - Uint8 *buf; - int buflen; + SDL_AudioCallback callback = this->callbackspec.callback; + const int stream_len = this->callbackspec.size; /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { + SDL_AudioStreamClear(this->stream); return; } - if (this->convert.needed) { - buf = this->convert.buf; - buflen = this->convert.len_cvt; - } else { - if (!this->hidden->mixbuf) { - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size); - if (!this->hidden->mixbuf) { - return; /* oh well. */ - } - } - buf = this->hidden->mixbuf; - buflen = this->spec.size; - } - EM_ASM_ARGS({ var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; - if (numChannels == 1) { /* fastpath this a little for the common (mono) case. */ - var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(0); + for (var c = 0; c < numChannels; ++c) { + var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); if (channelData.length != $1) { throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } - for (var j = 0; j < $1; ++j) { - setValue($0 + (j * 4), channelData[j], 'float'); - } - } else { - for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); - if (channelData.length != $1) { - throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; - } + if (numChannels == 1) { /* fastpath this a little for the common (mono) case. */ + for (var j = 0; j < $1; ++j) { + setValue($0 + (j * 4), channelData[j], 'float'); + } + } else { for (var j = 0; j < $1; ++j) { setValue($0 + (((j * numChannels) + c) * 4), channelData[j], 'float'); } } } - }, buf, (this->spec.size / sizeof (float)) / this->spec.channels); + }, this->work_buffer, (this->spec.size / sizeof (float)) / this->spec.channels); /* okay, we've got an interleaved float32 array in C now. */ - if (this->convert.needed) { - SDL_ConvertAudio(&this->convert); + if (this->stream == NULL) { /* no conversion necessary. */ + SDL_assert(this->spec.size == stream_len); + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + } else { /* streaming/converting */ + if (SDL_AudioStreamPut(this->stream, this->work_buffer, this->spec.size) == -1) { + SDL_AtomicSet(&this->enabled, 0); + } + + while (SDL_AudioStreamAvailable(this->stream) >= stream_len) { + const int got = SDL_AudioStreamGet(this->stream, this->work_buffer, stream_len); + SDL_assert((got < 0) || (got == stream_len)); + if (got != stream_len) { + SDL_memset(this->work_buffer, this->callbackspec.silence, stream_len); + } + callback(this->callbackspec.userdata, this->work_buffer, stream_len); /* Send it to the app. */ + } } - - /* Send it to the app. */ - (*this->spec.callback) (this->spec.userdata, buf, buflen); } - static void EMSCRIPTENAUDIO_CloseDevice(_THIS) { @@ -236,8 +182,9 @@ EMSCRIPTENAUDIO_CloseDevice(_THIS) } }, this->iscapture); - SDL_free(this->hidden->mixbuf); +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ SDL_free(this->hidden); +#endif } static int @@ -245,8 +192,6 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu { SDL_bool valid_format = SDL_FALSE; SDL_AudioFormat test_format; - int i; - float f; int result; /* based on parts of library_sdl.js */ @@ -293,29 +238,17 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu } /* Initialize all variables that we clean on shutdown */ +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); +#endif /* limit to native freq */ - const int sampleRate = EM_ASM_INT_V({ - return SDL2.audioContext.sampleRate; - }); - - if(this->spec.freq != sampleRate) { - for (i = this->spec.samples; i > 0; i--) { - f = (float)i / (float)sampleRate * (float)this->spec.freq; - if (SDL_floor(f) == f) { - this->hidden->conv_in_len = SDL_floor(f); - break; - } - } - - this->spec.freq = sampleRate; - } + this->spec.freq = EM_ASM_INT_V({ return SDL2.audioContext.sampleRate; }); SDL_CalculateAudioSpec(&this->spec); @@ -395,6 +328,9 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu static int EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) { + int available; + int capture_available; + /* Set the function pointers */ impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice; impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice; @@ -406,7 +342,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) impl->ProvidesOwnCallbackThread = 1; /* check availability */ - const int available = EM_ASM_INT_V({ + available = EM_ASM_INT_V({ if (typeof(AudioContext) !== 'undefined') { return 1; } else if (typeof(webkitAudioContext) !== 'undefined') { @@ -419,7 +355,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) SDL_SetError("No audio context available"); } - const int capture_available = available && EM_ASM_INT_V({ + capture_available = available && EM_ASM_INT_V({ if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { return 1; } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { diff --git a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h index cd5377d86..3c95668df 100644 --- a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h +++ b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenaudio_h -#define _SDL_emscriptenaudio_h +#ifndef SDL_emscriptenaudio_h_ +#define SDL_emscriptenaudio_h_ #include "../SDL_sysaudio.h" @@ -30,13 +30,9 @@ struct SDL_PrivateAudioData { - Uint8 *mixbuf; - Uint32 mixlen; - - Uint32 conv_in_len; - - Uint32 write_off, read_off; + int unused; }; -#endif /* _SDL_emscriptenaudio_h */ +#endif /* SDL_emscriptenaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c index 3eb719791..802ea7804 100644 --- a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c +++ b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h index d362b16ce..9b5c25a70 100644 --- a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h +++ b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_esdaudio_h -#define _SDL_esdaudio_h +#ifndef SDL_esdaudio_h_ +#define SDL_esdaudio_h_ #include "../SDL_sysaudio.h" @@ -46,5 +46,6 @@ struct SDL_PrivateAudioData }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_esdaudio_h */ +#endif /* SDL_esdaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c index daa0f9dd6..36fa5c545 100644 --- a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c +++ b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h index 5cf8a2009..27e45ced2 100644 --- a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h +++ b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_fsaudio_h -#define _SDL_fsaudio_h +#ifndef SDL_fsaudio_h_ +#define SDL_fsaudio_h_ #include @@ -45,5 +45,6 @@ struct SDL_PrivateAudioData }; -#endif /* _SDL_fsaudio_h */ +#endif /* SDL_fsaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc index 25b1fa217..52946a5b7 100644 --- a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc +++ b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ extern "C" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_haikuaudio.h" +#include "SDL_assert.h" } @@ -47,26 +48,39 @@ FillSound(void *device, void *stream, size_t len, const media_raw_audio_format & format) { SDL_AudioDevice *audio = (SDL_AudioDevice *) device; + SDL_AudioCallback callback = audio->callbackspec.callback; - /* Only do soemthing if audio is enabled */ - if (!SDL_AtomicGet(&audio->enabled)) { + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) { + if (audio->stream) { + SDL_AudioStreamClear(audio->stream); + } + SDL_memset(stream, audio->spec.silence, len); return; } - if (!SDL_AtomicGet(&audio->paused)) { - if (audio->convert.needed) { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) audio->convert.buf, - audio->convert.len); - SDL_UnlockMutex(audio->mixer_lock); - SDL_ConvertAudio(&audio->convert); - SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt); - } else { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) stream, len); - SDL_UnlockMutex(audio->mixer_lock); + SDL_assert(audio->spec.size == len); + + if (audio->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(audio->mixer_lock); + callback(audio->callbackspec.userdata, (Uint8 *) stream, len); + SDL_UnlockMutex(audio->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = audio->callbackspec.size; + const int ilen = (int) len; + while (SDL_AudioStreamAvailable(audio->stream) < ilen) { + callback(audio->callbackspec.userdata, audio->work_buffer, stream_len); + if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(audio->stream); + SDL_AtomicSet(&audio->enabled, 0); + break; + } + } + + const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); + SDL_assert((got < 0) || (got == ilen)); + if (got != ilen) { + SDL_memset(stream, audio->spec.silence, len); } } } diff --git a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h index 23e5a7655..f63ccdb1a 100644 --- a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h +++ b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_beaudio_h -#define _SDL_beaudio_h +#ifndef SDL_haikuaudio_h_ +#define SDL_haikuaudio_h_ #include "../SDL_sysaudio.h" @@ -33,6 +33,6 @@ struct SDL_PrivateAudioData BSoundPlayer *audio_obj; }; -#endif /* _SDL_beaudio_h */ +#endif /* SDL_haikuaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c new file mode 100644 index 000000000..a252da70e --- /dev/null +++ b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c @@ -0,0 +1,429 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_JACK + +#include "SDL_assert.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_jackaudio.h" +#include "SDL_loadso.h" +#include "../../thread/SDL_systhread.h" + + +static jack_client_t * (*JACK_jack_client_open) (const char *, jack_options_t, jack_status_t *, ...); +static int (*JACK_jack_client_close) (jack_client_t *); +static void (*JACK_jack_on_shutdown) (jack_client_t *, JackShutdownCallback, void *); +static int (*JACK_jack_activate) (jack_client_t *); +static int (*JACK_jack_deactivate) (jack_client_t *); +static void * (*JACK_jack_port_get_buffer) (jack_port_t *, jack_nframes_t); +static int (*JACK_jack_port_unregister) (jack_client_t *, jack_port_t *); +static void (*JACK_jack_free) (void *); +static const char ** (*JACK_jack_get_ports) (jack_client_t *, const char *, const char *, unsigned long); +static jack_nframes_t (*JACK_jack_get_sample_rate) (jack_client_t *); +static jack_nframes_t (*JACK_jack_get_buffer_size) (jack_client_t *); +static jack_port_t * (*JACK_jack_port_register) (jack_client_t *, const char *, const char *, unsigned long, unsigned long); +static const char * (*JACK_jack_port_name) (const jack_port_t *); +static int (*JACK_jack_connect) (jack_client_t *, const char *, const char *); +static int (*JACK_jack_set_process_callback) (jack_client_t *, JackProcessCallback, void *); + +static int load_jack_syms(void); + + +#ifdef SDL_AUDIO_DRIVER_JACK_DYNAMIC + +static const char *jack_library = SDL_AUDIO_DRIVER_JACK_DYNAMIC; +static void *jack_handle = NULL; + +/* !!! FIXME: this is copy/pasted in several places now */ +static int +load_jack_sym(const char *fn, void **addr) +{ + *addr = SDL_LoadFunction(jack_handle, fn); + if (*addr == NULL) { + /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ + return 0; + } + + return 1; +} + +/* cast funcs to char* first, to please GCC's strict aliasing rules. */ +#define SDL_JACK_SYM(x) \ + if (!load_jack_sym(#x, (void **) (char *) &JACK_##x)) return -1 + +static void +UnloadJackLibrary(void) +{ + if (jack_handle != NULL) { + SDL_UnloadObject(jack_handle); + jack_handle = NULL; + } +} + +static int +LoadJackLibrary(void) +{ + int retval = 0; + if (jack_handle == NULL) { + jack_handle = SDL_LoadObject(jack_library); + if (jack_handle == NULL) { + retval = -1; + /* Don't call SDL_SetError(): SDL_LoadObject already did. */ + } else { + retval = load_jack_syms(); + if (retval < 0) { + UnloadJackLibrary(); + } + } + } + return retval; +} + +#else + +#define SDL_JACK_SYM(x) JACK_##x = x + +static void +UnloadJackLibrary(void) +{ +} + +static int +LoadJackLibrary(void) +{ + load_jack_syms(); + return 0; +} + +#endif /* SDL_AUDIO_DRIVER_JACK_DYNAMIC */ + + +static int +load_jack_syms(void) +{ + SDL_JACK_SYM(jack_client_open); + SDL_JACK_SYM(jack_client_close); + SDL_JACK_SYM(jack_on_shutdown); + SDL_JACK_SYM(jack_activate); + SDL_JACK_SYM(jack_deactivate); + SDL_JACK_SYM(jack_port_get_buffer); + SDL_JACK_SYM(jack_port_unregister); + SDL_JACK_SYM(jack_free); + SDL_JACK_SYM(jack_get_ports); + SDL_JACK_SYM(jack_get_sample_rate); + SDL_JACK_SYM(jack_get_buffer_size); + SDL_JACK_SYM(jack_port_register); + SDL_JACK_SYM(jack_port_name); + SDL_JACK_SYM(jack_connect); + SDL_JACK_SYM(jack_set_process_callback); + return 0; +} + + +static void +jackShutdownCallback(void *arg) /* JACK went away; device is lost. */ +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + SDL_OpenedAudioDeviceDisconnected(this); + SDL_SemPost(this->hidden->iosem); /* unblock the SDL thread. */ +} + +// !!! FIXME: implement and register these! +//typedef int(* JackSampleRateCallback)(jack_nframes_t nframes, void *arg) +//typedef int(* JackBufferSizeCallback)(jack_nframes_t nframes, void *arg) + +static int +jackProcessPlaybackCallback(jack_nframes_t nframes, void *arg) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + jack_port_t **ports = this->hidden->sdlports; + const int total_channels = this->spec.channels; + const int total_frames = this->spec.samples; + int channelsi; + + if (!SDL_AtomicGet(&this->enabled)) { + /* silence the buffer to avoid repeats and corruption. */ + SDL_memset(this->hidden->iobuffer, '\0', this->spec.size); + } + + for (channelsi = 0; channelsi < total_channels; channelsi++) { + float *dst = (float *) JACK_jack_port_get_buffer(ports[channelsi], nframes); + if (dst) { + const float *src = ((float *) this->hidden->iobuffer) + channelsi; + int framesi; + for (framesi = 0; framesi < total_frames; framesi++) { + *(dst++) = *src; + src += total_channels; + } + } + } + + SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; refill the buffer. */ + return 0; /* success */ +} + + +/* This function waits until it is possible to write a full sound buffer */ +static void +JACK_WaitDevice(_THIS) +{ + if (SDL_AtomicGet(&this->enabled)) { + if (SDL_SemWait(this->hidden->iosem) == -1) { + SDL_OpenedAudioDeviceDisconnected(this); + } + } +} + +static Uint8 * +JACK_GetDeviceBuf(_THIS) +{ + return (Uint8 *) this->hidden->iobuffer; +} + + +static int +jackProcessCaptureCallback(jack_nframes_t nframes, void *arg) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + if (SDL_AtomicGet(&this->enabled)) { + jack_port_t **ports = this->hidden->sdlports; + const int total_channels = this->spec.channels; + const int total_frames = this->spec.samples; + int channelsi; + + for (channelsi = 0; channelsi < total_channels; channelsi++) { + const float *src = (const float *) JACK_jack_port_get_buffer(ports[channelsi], nframes); + if (src) { + float *dst = ((float *) this->hidden->iobuffer) + channelsi; + int framesi; + for (framesi = 0; framesi < total_frames; framesi++) { + *dst = *(src++); + dst += total_channels; + } + } + } + } + + SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; new buffer is ready! */ + return 0; /* success */ +} + +static int +JACK_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + SDL_assert(buflen == this->spec.size); /* we always fill a full buffer. */ + + /* Wait for JACK to fill the iobuffer */ + if (SDL_SemWait(this->hidden->iosem) == -1) { + return -1; + } + + SDL_memcpy(buffer, this->hidden->iobuffer, buflen); + return buflen; +} + +static void +JACK_FlushCapture(_THIS) +{ + SDL_SemWait(this->hidden->iosem); +} + + +static void +JACK_CloseDevice(_THIS) +{ + if (this->hidden->client) { + JACK_jack_deactivate(this->hidden->client); + + if (this->hidden->sdlports) { + const int channels = this->spec.channels; + int i; + for (i = 0; i < channels; i++) { + JACK_jack_port_unregister(this->hidden->client, this->hidden->sdlports[i]); + } + SDL_free(this->hidden->sdlports); + } + + JACK_jack_client_close(this->hidden->client); + } + + if (this->hidden->iosem) { + SDL_DestroySemaphore(this->hidden->iosem); + } + + if (this->hidden->devports) { + JACK_jack_free(this->hidden->devports); + } + + SDL_free(this->hidden->iobuffer); +} + +static int +JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + /* Note that JACK uses "output" for capture devices (they output audio + data to us) and "input" for playback (we input audio data to them). + Likewise, SDL's playback port will be "output" (we write data out) + and capture will be "input" (we read data in). */ + const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput; + const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput; + const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback; + const char *sdlportstr = iscapture ? "input" : "output"; + const char **devports = NULL; + jack_client_t *client = NULL; + jack_status_t status; + int channels = 0; + int i; + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof (*this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + + /* !!! FIXME: we _still_ need an API to specify an app name */ + client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); + this->hidden->client = client; + if (client == NULL) { + return SDL_SetError("Can't open JACK client"); + } + + devports = JACK_jack_get_ports(client, NULL, NULL, JackPortIsPhysical | sysportflags); + this->hidden->devports = devports; + if (!devports || !devports[0]) { + return SDL_SetError("No physical JACK ports available"); + } + + while (devports[++channels]) { + /* spin to count devports */ + } + + /* !!! FIXME: docs say about buffer size: "This size may change, clients that depend on it must register a bufsize_callback so they will be notified if it does." */ + + /* Jack pretty much demands what it wants. */ + this->spec.format = AUDIO_F32SYS; + this->spec.freq = JACK_jack_get_sample_rate(client); + this->spec.channels = channels; + this->spec.samples = JACK_jack_get_buffer_size(client); + + SDL_CalculateAudioSpec(&this->spec); + + this->hidden->iosem = SDL_CreateSemaphore(0); + if (!this->hidden->iosem) { + return -1; /* error was set by SDL_CreateSemaphore */ + } + + this->hidden->iobuffer = (float *) SDL_calloc(1, this->spec.size); + if (!this->hidden->iobuffer) { + return SDL_OutOfMemory(); + } + + /* Build SDL's ports, which we will connect to the device ports. */ + this->hidden->sdlports = (jack_port_t **) SDL_calloc(channels, sizeof (jack_port_t *)); + if (this->hidden->sdlports == NULL) { + return SDL_OutOfMemory(); + } + + for (i = 0; i < channels; i++) { + char portname[32]; + SDL_snprintf(portname, sizeof (portname), "sdl_jack_%s_%d", sdlportstr, i); + this->hidden->sdlports[i] = JACK_jack_port_register(client, portname, JACK_DEFAULT_AUDIO_TYPE, sdlportflags, 0); + if (this->hidden->sdlports[i] == NULL) { + return SDL_SetError("jack_port_register failed"); + } + } + + if (JACK_jack_set_process_callback(client, callback, this) != 0) { + return SDL_SetError("JACK: Couldn't set process callback"); + } + + JACK_jack_on_shutdown(client, jackShutdownCallback, this); + + if (JACK_jack_activate(client) != 0) { + return SDL_SetError("Failed to activate JACK client"); + } + + /* once activated, we can connect all the ports. */ + for (i = 0; i < channels; i++) { + const char *sdlport = JACK_jack_port_name(this->hidden->sdlports[i]); + const char *srcport = iscapture ? devports[i] : sdlport; + const char *dstport = iscapture ? sdlport : devports[i]; + if (JACK_jack_connect(client, srcport, dstport) != 0) { + return SDL_SetError("Couldn't connect JACK ports: %s => %s", srcport, dstport); + } + } + + /* don't need these anymore. */ + this->hidden->devports = NULL; + JACK_jack_free(devports); + + /* We're ready to rock and roll. :-) */ + return 0; +} + +static void +JACK_Deinitialize(void) +{ + UnloadJackLibrary(); +} + +static int +JACK_Init(SDL_AudioDriverImpl * impl) +{ + if (LoadJackLibrary() < 0) { + return 0; + } else { + /* Make sure a JACK server is running and available. */ + jack_status_t status; + jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); + if (client == NULL) { + UnloadJackLibrary(); + return 0; + } + JACK_jack_client_close(client); + } + + /* Set the function pointers */ + impl->OpenDevice = JACK_OpenDevice; + impl->WaitDevice = JACK_WaitDevice; + impl->GetDeviceBuf = JACK_GetDeviceBuf; + impl->CloseDevice = JACK_CloseDevice; + impl->Deinitialize = JACK_Deinitialize; + impl->CaptureFromDevice = JACK_CaptureFromDevice; + impl->FlushCapture = JACK_FlushCapture; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->HasCaptureSupport = SDL_TRUE; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap JACK_bootstrap = { + "jack", "JACK Audio Connection Kit", JACK_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_JACK */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h new file mode 100644 index 000000000..aab199ac2 --- /dev/null +++ b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h @@ -0,0 +1,42 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_jackaudio_h_ +#define SDL_jackaudio_h_ + +#include + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData +{ + jack_client_t *client; + SDL_sem *iosem; + float *iobuffer; + const char **devports; + jack_port_t **sdlports; +}; + +#endif /* SDL_jackaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c index 33cbe1c83..3e3afc02d 100644 --- a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c +++ b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,29 +45,46 @@ static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data); /* FIXME: Make use of latency if needed */ -static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data) { +static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) { + const int len = (int) buffer_size; SDL_AudioDevice* _this = (SDL_AudioDevice*) data; + SDL_AudioCallback callback = _this->callbackspec.callback; SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */ - if (SDL_AtomicGet(&_this->enabled) && !SDL_AtomicGet(&_this->paused)) { - if (_this->convert.needed) { - SDL_LockMutex(_this->mixer_lock); - (*_this->spec.callback) (_this->spec.userdata, - (Uint8 *) _this->convert.buf, - _this->convert.len); - SDL_UnlockMutex(_this->mixer_lock); - SDL_ConvertAudio(&_this->convert); - SDL_memcpy(samples, _this->convert.buf, _this->convert.len_cvt); - } else { - SDL_LockMutex(_this->mixer_lock); - (*_this->spec.callback) (_this->spec.userdata, (Uint8 *) samples, buffer_size); - SDL_UnlockMutex(_this->mixer_lock); + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&_this->enabled) || SDL_AtomicGet(&_this->paused)) { + if (_this->stream) { + SDL_AudioStreamClear(_this->stream); } - } else { - SDL_memset(samples, _this->spec.silence, buffer_size); + SDL_memset(stream, _this->spec.silence, len); + return; } - + + SDL_assert(_this->spec.size == len); + + if (_this->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(_this->mixer_lock); + callback(_this->callbackspec.userdata, stream, len); + SDL_UnlockMutex(_this->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = _this->callbackspec.size; + while (SDL_AudioStreamAvailable(_this->stream) < len) { + callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); + if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(_this->stream); + SDL_AtomicSet(&_this->enabled, 0); + break; + } + } + + const int got = SDL_AudioStreamGet(_this->stream, stream, len); + SDL_assert((got < 0) || (got == len)); + if (got != len) { + SDL_memset(stream, _this->spec.silence, len); + } + } + SDL_UnlockMutex(private->mutex); } @@ -89,8 +106,7 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { private = (SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *private)); if (private == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } private->mutex = SDL_CreateMutex(); @@ -114,7 +130,7 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { /* Start audio playback while we are still on the main thread. */ ppb_audio->StartPlayback(private->audio); - return 1; + return 0; } static int diff --git a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h index 90ff5448e..5ec842bac 100644 --- a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h +++ b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_naclaudio_h -#define _SDL_naclaudio_h +#ifndef SDL_naclaudio_h_ +#define SDL_naclaudio_h_ #include "SDL_audio.h" #include "../SDL_sysaudio.h" @@ -38,4 +38,6 @@ typedef struct SDL_PrivateAudioData { PP_Resource audio; } SDL_PrivateAudioData; -#endif /* _SDL_naclaudio_h */ +#endif /* SDL_naclaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c index fe15cd696..5a02a3ba6 100644 --- a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c +++ b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -116,7 +116,7 @@ LoadNASLibrary(void) char *err = (char *) alloca(len); SDL_strlcpy(err, origerr, len); retval = -1; - SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s\n", + SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s", nas_library, err); } else { retval = load_nas_syms(); diff --git a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h index 2f46b0b60..b1a51d1a6 100644 --- a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h +++ b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_nasaudio_h -#define _SDL_nasaudio_h +#ifndef SDL_nasaudio_h_ +#define SDL_nasaudio_h_ #ifdef __sgi #include @@ -51,6 +51,6 @@ struct SDL_PrivateAudioData struct timeval last_tv; int buf_free; }; -#endif /* _SDL_nasaudio_h */ +#endif /* SDL_nasaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.c b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.c similarity index 88% rename from Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.c rename to Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.c index 6a970b9c7..0dc0b25eb 100644 --- a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.c +++ b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,10 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_BSD +#if SDL_AUDIO_DRIVER_NETBSD /* - * Driver for native OpenBSD/NetBSD audio(4). + * Driver for native NetBSD audio(4). * vedge@vedge.com.ar. */ @@ -38,9 +38,10 @@ #include "SDL_timer.h" #include "SDL_audio.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" -#include "SDL_bsdaudio.h" +#include "SDL_netbsdaudio.h" /* Use timer for synchronization */ /* #define USE_TIMER_SYNC */ @@ -50,14 +51,14 @@ static void -BSDAUDIO_DetectDevices(void) +NETBSDAUDIO_DetectDevices(void) { SDL_EnumUnixAudioDevices(0, NULL); } static void -BSDAUDIO_Status(_THIS) +NETBSDAUDIO_Status(_THIS) { #ifdef DEBUG_AUDIO /* *INDENT-OFF* */ @@ -121,7 +122,7 @@ BSDAUDIO_Status(_THIS) /* This function waits until it is possible to write a full sound buffer */ static void -BSDAUDIO_WaitDevice(_THIS) +NETBSDAUDIO_WaitDevice(_THIS) { #ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */ /* See if we need to use timed audio synchronization */ @@ -134,18 +135,11 @@ BSDAUDIO_WaitDevice(_THIS) SDL_Delay(ticks); } } else { - /* Use select() for audio synchronization */ - fd_set fdset; - struct timeval timeout; - - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - timeout.tv_sec = 10; - timeout.tv_usec = 0; + /* Use SDL_IOReady() for audio synchronization */ #ifdef DEBUG_AUDIO fprintf(stderr, "Waiting for audio to get ready\n"); #endif - if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout) + if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, 10 * 1000) <= 0) { const char *message = "Audio timeout - buggy audio driver? (disabled)"; @@ -169,7 +163,7 @@ BSDAUDIO_WaitDevice(_THIS) } static void -BSDAUDIO_PlayDevice(_THIS) +NETBSDAUDIO_PlayDevice(_THIS) { int written, p = 0; @@ -208,19 +202,19 @@ BSDAUDIO_PlayDevice(_THIS) } static Uint8 * -BSDAUDIO_GetDeviceBuf(_THIS) +NETBSDAUDIO_GetDeviceBuf(_THIS) { return (this->hidden->mixbuf); } static int -BSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) +NETBSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) { Uint8 *buffer = (Uint8 *) _buffer; int br, p = 0; - /* Write the audio data, checking for EAGAIN on broken audio drivers */ + /* Capture the audio data, checking for EAGAIN on broken audio drivers */ do { br = read(this->hidden->audio_fd, buffer + p, buflen - p); if (br > 0) @@ -243,7 +237,7 @@ BSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) } static void -BSDAUDIO_FlushCapture(_THIS) +NETBSDAUDIO_FlushCapture(_THIS) { audio_info_t info; size_t remain; @@ -265,7 +259,7 @@ BSDAUDIO_FlushCapture(_THIS) } static void -BSDAUDIO_CloseDevice(_THIS) +NETBSDAUDIO_CloseDevice(_THIS) { if (this->hidden->audio_fd >= 0) { close(this->hidden->audio_fd); @@ -275,7 +269,7 @@ BSDAUDIO_CloseDevice(_THIS) } static int -BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { const int flags = iscapture ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT; SDL_AudioFormat format = 0; @@ -383,24 +377,24 @@ BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); } - BSDAUDIO_Status(this); + NETBSDAUDIO_Status(this); /* We're ready to rock and roll. :-) */ return 0; } static int -BSDAUDIO_Init(SDL_AudioDriverImpl * impl) +NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ - impl->DetectDevices = BSDAUDIO_DetectDevices; - impl->OpenDevice = BSDAUDIO_OpenDevice; - impl->PlayDevice = BSDAUDIO_PlayDevice; - impl->WaitDevice = BSDAUDIO_WaitDevice; - impl->GetDeviceBuf = BSDAUDIO_GetDeviceBuf; - impl->CloseDevice = BSDAUDIO_CloseDevice; - impl->CaptureFromDevice = BSDAUDIO_CaptureFromDevice; - impl->FlushCapture = BSDAUDIO_FlushCapture; + impl->DetectDevices = NETBSDAUDIO_DetectDevices; + impl->OpenDevice = NETBSDAUDIO_OpenDevice; + impl->PlayDevice = NETBSDAUDIO_PlayDevice; + impl->WaitDevice = NETBSDAUDIO_WaitDevice; + impl->GetDeviceBuf = NETBSDAUDIO_GetDeviceBuf; + impl->CloseDevice = NETBSDAUDIO_CloseDevice; + impl->CaptureFromDevice = NETBSDAUDIO_CaptureFromDevice; + impl->FlushCapture = NETBSDAUDIO_FlushCapture; impl->HasCaptureSupport = SDL_TRUE; impl->AllowsArbitraryDeviceNames = 1; @@ -409,10 +403,10 @@ BSDAUDIO_Init(SDL_AudioDriverImpl * impl) } -AudioBootStrap BSD_AUDIO_bootstrap = { - "bsd", "BSD audio", BSDAUDIO_Init, 0 +AudioBootStrap NETBSDAUDIO_bootstrap = { + "netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0 }; -#endif /* SDL_AUDIO_DRIVER_BSD */ +#endif /* SDL_AUDIO_DRIVER_NETBSD */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.h b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.h similarity index 81% rename from Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.h rename to Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.h index 7fe141b14..1c46068ab 100644 --- a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.h +++ b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_bsdaudio_h -#define _SDL_bsdaudio_h +#ifndef SDL_netbsdaudio_h_ +#define SDL_netbsdaudio_h_ #include "../SDL_sysaudio.h" @@ -32,20 +32,17 @@ struct SDL_PrivateAudioData /* The file descriptor for the audio device */ int audio_fd; - /* The parent process id, to detect when application quits */ - pid_t parent; - /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_bsdaudio_h */ +#endif /* SDL_netbsdaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c index 57202245f..1e8c124bb 100644 --- a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c +++ b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,9 +36,10 @@ #include "SDL_audio.h" #include "SDL_stdinc.h" #include "../SDL_audio_c.h" +#include "../../core/unix/SDL_poll.h" #include "SDL_paudio.h" -#define DEBUG_AUDIO 0 +/* #define DEBUG_AUDIO */ /* A conflict within AIX 4.3.3 headers and probably others as well. * I guess nobody ever uses audio... Shame over AIX header files. */ @@ -137,44 +138,31 @@ PAUDIO_WaitDevice(_THIS) SDL_Delay(ticks); } } else { + int timeoutMS; audio_buffer paud_bufinfo; - /* Use select() for audio synchronization */ - struct timeval timeout; - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - if (ioctl(this->hidden->audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) { #ifdef DEBUG_AUDIO fprintf(stderr, "Couldn't get audio buffer information\n"); #endif - timeout.tv_sec = 10; - timeout.tv_usec = 0; + timeoutMS = 10 * 1000; } else { - long ms_in_buf = paud_bufinfo.write_buf_time; - timeout.tv_sec = ms_in_buf / 1000; - ms_in_buf = ms_in_buf - timeout.tv_sec * 1000; - timeout.tv_usec = ms_in_buf * 1000; + timeoutMS = paud_bufinfo.write_buf_time; #ifdef DEBUG_AUDIO - fprintf(stderr, - "Waiting for write_buf_time=%ld,%ld\n", - timeout.tv_sec, timeout.tv_usec); + fprintf(stderr, "Waiting for write_buf_time=%d ms\n", timeoutMS); #endif } #ifdef DEBUG_AUDIO fprintf(stderr, "Waiting for audio to get ready\n"); #endif - if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout) - <= 0) { - const char *message = - "Audio timeout - buggy audio driver? (disabled)"; + if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, timeoutMS) <= 0) { /* * In general we should never print to the screen, * but in this case we have no other way of letting * the user know what happened. */ - fprintf(stderr, "SDL: %s - %s\n", strerror(errno), message); + fprintf(stderr, "SDL: %s - Audio timeout - buggy audio driver? (disabled)\n", strerror(errno)); SDL_OpenedAudioDeviceDisconnected(this); /* Don't try to close - may hang */ this->hidden->audio_fd = -1; @@ -245,7 +233,6 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_AudioFormat test_format; audio_init paud_init; audio_buffer paud_bufinfo; - audio_status paud_status; audio_control paud_control; audio_change paud_change; int fd = -1; @@ -487,7 +474,7 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("Can't start audio play"); } - /* Check to see if we need to use select() workaround */ + /* Check to see if we need to use SDL_IOReady() workaround */ if (workaround != NULL) { this->hidden->frame_ticks = (float) (this->spec.samples * 1000) / this->spec.freq; @@ -510,11 +497,11 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl) close(fd); /* Set the function pointers */ - impl->OpenDevice = DSP_OpenDevice; - impl->PlayDevice = DSP_PlayDevice; - impl->PlayDevice = DSP_WaitDevice; - impl->GetDeviceBuf = DSP_GetDeviceBuf; - impl->CloseDevice = DSP_CloseDevice; + impl->OpenDevice = PAUDIO_OpenDevice; + impl->PlayDevice = PAUDIO_PlayDevice; + impl->PlayDevice = PAUDIO_WaitDevice; + impl->GetDeviceBuf = PAUDIO_GetDeviceBuf; + impl->CloseDevice = PAUDIO_CloseDevice; impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ return 1; /* this audio target is available. */ diff --git a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h index ebc8bb5b1..c295ae453 100644 --- a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h +++ b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_paudaudio_h -#define _SDL_paudaudio_h +#ifndef SDL_paudio_h_ +#define SDL_paudio_h_ #include "../SDL_sysaudio.h" @@ -37,11 +37,12 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_paudaudio_h */ +#endif /* SDL_paudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c index bd3456d3f..3e7b8e12f 100644 --- a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c +++ b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -80,6 +80,7 @@ PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->spec.channels == 1) { format = PSP_AUDIO_FORMAT_MONO; } else { + this->spec.channels = 2; format = PSP_AUDIO_FORMAT_STEREO; } this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format); diff --git a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h index 6b266bd0c..3f0cdc1ea 100644 --- a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h +++ b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspaudio_h -#define _SDL_pspaudio_h +#ifndef SDL_pspaudio_h_ +#define SDL_pspaudio_h_ #include "../SDL_sysaudio.h" @@ -40,6 +40,6 @@ struct SDL_PrivateAudioData { int next_buffer; }; -#endif /* _SDL_pspaudio_h */ -/* vim: ts=4 sw=4 - */ +#endif /* SDL_pspaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c index 9ced49d21..1e9858063 100644 --- a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,7 +37,6 @@ #endif #include #include -#include #include #include "SDL_timer.h" @@ -250,12 +249,6 @@ getAppName(void) return "SDL Application"; /* oh well. */ } -static void -stream_operation_complete_no_op(pa_stream *s, int success, void *userdata) -{ - /* no-op for pa_stream_drain(), etc, to use for callback. */ -} - static void WaitForPulseOperation(pa_mainloop *mainloop, pa_operation *o) { @@ -427,6 +420,8 @@ static void PULSEAUDIO_FlushCapture(_THIS) { struct SDL_PrivateAudioData *h = this->hidden; + const void *data = NULL; + size_t nbytes = 0; if (h->capturebuf != NULL) { PULSEAUDIO_pa_stream_drop(h->stream); @@ -434,7 +429,22 @@ PULSEAUDIO_FlushCapture(_THIS) h->capturelen = 0; } - WaitForPulseOperation(h->mainloop, PULSEAUDIO_pa_stream_flush(h->stream, stream_operation_complete_no_op, NULL)); + while (SDL_TRUE) { + if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || + PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || + PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { + SDL_OpenedAudioDeviceDisconnected(this); + return; /* uhoh, pulse failed! */ + } + + if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) { + break; /* no data available, so we're done. */ + } + + /* a new fragment is available! Just dump it. */ + PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes); + PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */ + } } static void diff --git a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h index e12000f2a..61da70be4 100644 --- a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_pulseaudio_h -#define _SDL_pulseaudio_h +#ifndef SDL_pulseaudio_h_ +#define SDL_pulseaudio_h_ #include @@ -47,6 +47,6 @@ struct SDL_PrivateAudioData int capturelen; }; -#endif /* _SDL_pulseaudio_h */ +#endif /* SDL_pulseaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c index 149cad90a..957ac2d4e 100644 --- a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c +++ b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,6 +45,7 @@ #include "SDL_timer.h" #include "SDL_audio.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "SDL_qsa_audio.h" @@ -56,24 +57,6 @@ #define DEFAULT_CPARAMS_FRAGS_MIN 1 #define DEFAULT_CPARAMS_FRAGS_MAX 1 -#define QSA_NO_WORKAROUNDS 0x00000000 -#define QSA_MMAP_WORKAROUND 0x00000001 - -struct BuggyCards -{ - char *cardname; - unsigned long bugtype; -}; - -#define QSA_WA_CARDS 3 -#define QSA_MAX_CARD_NAME_LENGTH 33 - -struct BuggyCards buggycards[QSA_WA_CARDS] = { - {"Sound Blaster Live!", QSA_MMAP_WORKAROUND}, - {"Vortex 8820", QSA_MMAP_WORKAROUND}, - {"Vortex 8830", QSA_MMAP_WORKAROUND}, -}; - /* List of found devices */ #define QSA_MAX_DEVICES 32 #define QSA_MAX_NAME_LENGTH 81+16 /* Hardcoded in QSA, can't be changed */ @@ -97,40 +80,16 @@ QSA_SetError(const char *fn, int status) return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status)); } -/* card names check to apply the workarounds */ -static int -QSA_CheckBuggyCards(_THIS, unsigned long checkfor) -{ - char scardname[QSA_MAX_CARD_NAME_LENGTH]; - int it; - - if (snd_card_get_name - (this->hidden->cardno, scardname, QSA_MAX_CARD_NAME_LENGTH - 1) < 0) { - return 0; - } - - for (it = 0; it < QSA_WA_CARDS; it++) { - if (SDL_strcmp(buggycards[it].cardname, scardname) == 0) { - if (buggycards[it].bugtype == checkfor) { - return 1; - } - } - } - - return 0; -} - /* !!! FIXME: does this need to be here? Does the SDL version not work? */ static void QSA_ThreadInit(_THIS) { - struct sched_param param; - int status; - /* Increase default 10 priority to 25 to avoid jerky sound */ - status = SchedGet(0, 0, ¶m); - param.sched_priority = param.sched_curpriority + 15; - status = SchedSet(0, 0, SCHED_NOCHANGE, ¶m); + struct sched_param param; + if (SchedGet(0, 0, ¶m) != -1) { + param.sched_priority = param.sched_curpriority + 15; + SchedSet(0, 0, SCHED_NOCHANGE, ¶m); + } } /* PCM channel parameters initialize function */ @@ -155,67 +114,25 @@ QSA_InitAudioParams(snd_pcm_channel_params_t * cpars) static void QSA_WaitDevice(_THIS) { - fd_set wfds; - fd_set rfds; - int selectret; - struct timeval timeout; + int result; - if (!this->hidden->iscapture) { - FD_ZERO(&wfds); - FD_SET(this->hidden->audio_fd, &wfds); - } else { - FD_ZERO(&rfds); - FD_SET(this->hidden->audio_fd, &rfds); - } - - do { - /* Setup timeout for playing one fragment equal to 2 seconds */ - /* If timeout occured than something wrong with hardware or driver */ - /* For example, Vortex 8820 audio driver stucks on second DAC because */ - /* it doesn't exist ! */ - timeout.tv_sec = 2; - timeout.tv_usec = 0; + /* Setup timeout for playing one fragment equal to 2 seconds */ + /* If timeout occured than something wrong with hardware or driver */ + /* For example, Vortex 8820 audio driver stucks on second DAC because */ + /* it doesn't exist ! */ + result = SDL_IOReady(this->hidden->audio_fd, !this->hidden->iscapture, 2 * 1000); + switch (result) { + case -1: + SDL_SetError("QSA: SDL_IOReady() failed: %s", strerror(errno)); + break; + case 0: + SDL_SetError("QSA: timeout on buffer waiting occured"); + this->hidden->timeout_on_wait = 1; + break; + default: this->hidden->timeout_on_wait = 0; - - if (!this->hidden->iscapture) { - selectret = - select(this->hidden->audio_fd + 1, NULL, &wfds, NULL, - &timeout); - } else { - selectret = - select(this->hidden->audio_fd + 1, &rfds, NULL, NULL, - &timeout); - } - - switch (selectret) { - case -1: - { - SDL_SetError("QSA: select() failed: %s", strerror(errno)); - return; - } - break; - case 0: - { - SDL_SetError("QSA: timeout on buffer waiting occured"); - this->hidden->timeout_on_wait = 1; - return; - } - break; - default: - { - if (!this->hidden->iscapture) { - if (FD_ISSET(this->hidden->audio_fd, &wfds)) { - return; - } - } else { - if (FD_ISSET(this->hidden->audio_fd, &rfds)) { - return; - } - } - } - break; - } - } while (1); + break; + } } static void @@ -357,7 +274,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_zerop(this->hidden); /* Initialize channel transfer parameters to default */ QSA_InitAudioParams(&cparams); @@ -371,13 +287,13 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->cardno = device->cardno; status = snd_pcm_open(&this->hidden->audio_handle, device->cardno, device->deviceno, - iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE); + iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK); } else { /* Open system default audio device */ status = snd_pcm_open_preferred(&this->hidden->audio_handle, &this->hidden->cardno, &this->hidden->deviceno, - iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE); + iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK); } /* Check if requested device is opened */ @@ -386,16 +302,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return QSA_SetError("snd_pcm_open", status); } - if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) { - /* Disable QSA MMAP plugin for buggy audio drivers */ - status = - snd_pcm_plugin_set_disable(this->hidden->audio_handle, - PLUGIN_DISABLE_MMAP); - if (status < 0) { - return QSA_SetError("snd_pcm_plugin_set_disable", status); - } - } - /* Try for a closest match on audio format */ format = 0; /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */ @@ -494,7 +400,7 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Setup the transfer parameters according to cparams */ status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams); if (status < 0) { - return QSA_SetError("snd_pcm_channel_params", status); + return QSA_SetError("snd_pcm_plugin_params", status); } /* Make sure channel is setup right one last time */ @@ -722,9 +628,6 @@ QSA_Deinitialize(void) static int QSA_Init(SDL_AudioDriverImpl * impl) { - snd_pcm_t *handle = NULL; - int32_t status = 0; - /* Clear devices array */ SDL_zero(qsa_playback_device); SDL_zero(qsa_capture_device); @@ -745,20 +648,12 @@ QSA_Init(SDL_AudioDriverImpl * impl) impl->LockDevice = NULL; impl->UnlockDevice = NULL; - impl->OnlyHasDefaultOutputDevice = 0; impl->ProvidesOwnCallbackThread = 0; impl->SkipMixerLock = 0; impl->HasCaptureSupport = 1; impl->OnlyHasDefaultOutputDevice = 0; impl->OnlyHasDefaultCaptureDevice = 0; - /* Check if io-audio manager is running or not */ - status = snd_cards(); - if (status == 0) { - /* if no, return immediately */ - return 1; - } - return 1; /* this audio target is available. */ } diff --git a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h index 19a2215aa..a6300c1a9 100644 --- a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h +++ b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl b/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl deleted file mode 100755 index c53f1c355..000000000 --- a/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl +++ /dev/null @@ -1,761 +0,0 @@ -#!/usr/bin/perl -w - -use warnings; -use strict; - -my @audiotypes = qw( - U8 - S8 - U16LSB - S16LSB - U16MSB - S16MSB - S32LSB - S32MSB - F32LSB - F32MSB -); - -my @channels = ( 1, 2, 4, 6, 8 ); -my %funcs; -my $custom_converters = 0; - - -sub getTypeConvertHashId { - my ($from, $to) = @_; - return "TYPECONVERTER $from/$to"; -} - - -sub getResamplerHashId { - my ($from, $channels, $upsample, $multiple) = @_; - return "RESAMPLER $from/$channels/$upsample/$multiple"; -} - - -sub outputHeader { - print < - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../SDL_internal.h" -#include "SDL_audio.h" -#include "SDL_audio_c.h" - -#ifndef DEBUG_CONVERT -#define DEBUG_CONVERT 0 -#endif - - -/* If you can guarantee your data and need space, you can eliminate code... */ - -/* Just build the arbitrary resamplers if you're saving code space. */ -#ifndef LESS_RESAMPLERS -#define LESS_RESAMPLERS 0 -#endif - -/* Don't build any resamplers if you're REALLY saving code space. */ -#ifndef NO_RESAMPLERS -#define NO_RESAMPLERS 0 -#endif - -/* Don't build any type converters if you're saving code space. */ -#ifndef NO_CONVERTERS -#define NO_CONVERTERS 0 -#endif - - -/* *INDENT-OFF* */ - -EOF - - my @vals = ( 127, 32767, 2147483647 ); - foreach (@vals) { - my $val = $_; - my $fval = 1.0 / $val; - print("#define DIVBY${val} ${fval}f\n"); - } - - print("\n"); -} - -sub outputFooter { - print < 8) { - $code = "SDL_Swap${BEorLE}${size}($val)"; - } else { - $code = $val; - } - - if (($signed) and (!$float)) { - $code = "((Sint${size}) $code)"; - } - } - - return "${code}"; -} - - -sub maxIntVal { - my $size = shift; - if ($size == 8) { - return 0x7F; - } elsif ($size == 16) { - return 0x7FFF; - } elsif ($size == 32) { - return 0x7FFFFFFF; - } - - die("bug in script.\n"); -} - -sub getFloatToIntMult { - my $size = shift; - my $val = maxIntVal($size) . '.0'; - $val .= 'f' if ($size < 32); - return $val; -} - -sub getIntToFloatDivBy { - my $size = shift; - return 'DIVBY' . maxIntVal($size); -} - -sub getSignFlipVal { - my $size = shift; - if ($size == 8) { - return '0x80'; - } elsif ($size == 16) { - return '0x8000'; - } elsif ($size == 32) { - return '0x80000000'; - } - - die("bug in script.\n"); -} - -sub buildCvtFunc { - my ($from, $to) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - my ($tsigned, $tfloat, $tsize, $tendian, $tctype) = splittype($to); - my $diffs = 0; - $diffs++ if ($fsize != $tsize); - $diffs++ if ($fsigned != $tsigned); - $diffs++ if ($ffloat != $tfloat); - $diffs++ if ($fendian ne $tendian); - - return if ($diffs == 0); - - my $hashid = getTypeConvertHashId($from, $to); - if (1) { # !!! FIXME: if ($diffs > 1) { - my $sym = "SDL_Convert_${from}_to_${to}"; - $funcs{$hashid} = $sym; - $custom_converters++; - - # Always unsigned for ints, for possible byteswaps. - my $srctype = (($ffloat) ? 'float' : "Uint${fsize}"); - - print <buf + cvt->len_cvt)) - 1; - dst = (($tctype *) (cvt->buf + cvt->len_cvt * $mult)) - 1; - for (i = cvt->len_cvt / sizeof ($srctype); i; --i, --src, --dst) { -EOF - } else { - print <buf; - dst = ($tctype *) cvt->buf; - for (i = cvt->len_cvt / sizeof ($srctype); i; --i, ++src, ++dst) { -EOF - } - - # Have to convert to/from float/int. - # !!! FIXME: cast through double for int32<->float? - my $code = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, '*src'); - if ($ffloat != $tfloat) { - if ($ffloat) { - my $mult = getFloatToIntMult($tsize); - if (!$tsigned) { # bump from -1.0f/1.0f to 0.0f/2.0f - $code = "($code + 1.0f)"; - } - $code = "(($tctype) ($code * $mult))"; - } else { - # $divby will be the reciprocal, to avoid pipeline stalls - # from floating point division...so multiply it. - my $divby = getIntToFloatDivBy($fsize); - $code = "(((float) $code) * $divby)"; - if (!$fsigned) { # bump from 0.0f/2.0f to -1.0f/1.0f. - $code = "($code - 1.0f)"; - } - } - } else { - # All integer conversions here. - if ($fsigned != $tsigned) { - my $signflipval = getSignFlipVal($fsize); - $code = "(($code) ^ $signflipval)"; - } - - my $shiftval = abs($fsize - $tsize); - if ($fsize < $tsize) { - $code = "((($tctype) $code) << $shiftval)"; - } elsif ($fsize > $tsize) { - $code = "(($tctype) ($code >> $shiftval))"; - } - } - - my $swap = getSwapFunc($tsize, $tsigned, $tfloat, $tendian, 'val'); - - print < $tsize) { - my $divby = $fsize / $tsize; - print(" cvt->len_cvt /= $divby;\n"); - } elsif ($fsize < $tsize) { - my $mult = $tsize / $fsize; - print(" cvt->len_cvt *= $mult;\n"); - } - - print <filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_$to); - } -} - -EOF - - } else { - if ($fsigned != $tsigned) { - $funcs{$hashid} = 'SDL_ConvertSigned'; - } elsif ($ffloat != $tfloat) { - $funcs{$hashid} = 'SDL_ConvertFloat'; - } elsif ($fsize != $tsize) { - $funcs{$hashid} = 'SDL_ConvertSize'; - } elsif ($fendian ne $tendian) { - $funcs{$hashid} = 'SDL_ConvertEndian'; - } else { - die("error in script.\n"); - } - } -} - - -sub buildTypeConverters { - print "#if !NO_CONVERTERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@audiotypes) { - my $to = $_; - buildCvtFunc($from, $to); - } - } - print "#endif /* !NO_CONVERTERS */\n\n\n"; - - print "const SDL_AudioTypeFilters sdl_audio_type_filters[] =\n{\n"; - print "#if !NO_CONVERTERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@audiotypes) { - my $to = $_; - if ($from ne $to) { - my $hashid = getTypeConvertHashId($from, $to); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, AUDIO_$to, $sym },\n"); - } - } - } - print "#endif /* !NO_CONVERTERS */\n"; - - print(" { 0, 0, NULL }\n"); - print "};\n\n\n"; -} - -sub getBiggerCtype { - my ($isfloat, $size) = @_; - - if ($isfloat) { - if ($size == 32) { - return 'double'; - } - die("bug in script.\n"); - } - - if ($size == 8) { - return 'Sint16'; - } elsif ($size == 16) { - return 'Sint32' - } elsif ($size == 32) { - return 'Sint64' - } - - die("bug in script.\n"); -} - - -# These handle arbitrary resamples...44100Hz to 48000Hz, for example. -# Man, this code is skanky. -sub buildArbitraryResampleFunc { - # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc(). - my ($from, $channels, $upsample) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - - my $bigger = getBiggerCtype($ffloat, $fsize); - my $interp = ($ffloat) ? '* 0.5' : '>> 1'; - - my $resample = ($upsample) ? 'Upsample' : 'Downsample'; - my $hashid = getResamplerHashId($from, $channels, $upsample, 0); - my $sym = "SDL_${resample}_${from}_${channels}c"; - $funcs{$hashid} = $sym; - $custom_converters++; - - my $fudge = $fsize * $channels * 2; # !!! FIXME - my $eps_adjust = ($upsample) ? 'dstsize' : 'srcsize'; - my $incr = ''; - my $incr2 = ''; - my $block_align = $channels * $fsize/8; - - - # !!! FIXME: DEBUG_CONVERT should report frequencies. - print <rate_incr); -#endif - - const int srcsize = cvt->len_cvt - $fudge; - const int dstsize = (int) (((double)(cvt->len_cvt/${block_align})) * cvt->rate_incr) * ${block_align}; - register int eps = 0; -EOF - - my $endcomparison = '!='; - - # Upsampling (growing the buffer) needs to work backwards, since we - # overwrite the buffer as we go. - if ($upsample) { - $endcomparison = '>='; # dst > target - print <buf + dstsize)) - $channels; - const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf); -EOF - } else { - $endcomparison = '<'; # dst < target - print <buf; - const $fctype *src = ($fctype *) cvt->buf; - const $fctype *target = (const $fctype *) (cvt->buf + dstsize); -EOF - } - - for (my $i = 0; $i < $channels; $i++) { - my $idx = ($upsample) ? (($channels - $i) - 1) : $i; - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]"); - print <= dstsize) { - $incr2; -EOF - } else { # downsample. - $incr = ($channels == 1) ? 'src++' : "src += $channels"; - print <= srcsize) { -EOF - for (my $i = 0; $i < $channels; $i++) { - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "sample${i}"); - print <len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -EOF - -} - -# These handle clean resamples...doubling and quadrupling the sample rate, etc. -sub buildMultipleResampleFunc { - # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc(). - my ($from, $channels, $upsample, $multiple) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - - my $bigger = getBiggerCtype($ffloat, $fsize); - my $interp = ($ffloat) ? '* 0.5' : '>> 1'; - my $interp2 = ($ffloat) ? '* 0.25' : '>> 2'; - my $mult3 = ($ffloat) ? '3.0' : '3'; - my $lencvtop = ($upsample) ? '*' : '/'; - - my $resample = ($upsample) ? 'Upsample' : 'Downsample'; - my $hashid = getResamplerHashId($from, $channels, $upsample, $multiple); - my $sym = "SDL_${resample}_${from}_${channels}c_x${multiple}"; - $funcs{$hashid} = $sym; - $custom_converters++; - - # !!! FIXME: DEBUG_CONVERT should report frequencies. - print <len_cvt $lencvtop $multiple; -EOF - - my $endcomparison = '!='; - - # Upsampling (growing the buffer) needs to work backwards, since we - # overwrite the buffer as we go. - if ($upsample) { - $endcomparison = '>='; # dst > target - print <buf + dstsize)) - $channels * $multiple; - const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf); -EOF - } else { - $endcomparison = '<'; # dst < target - print <buf; - const $fctype *src = ($fctype *) cvt->buf; - const $fctype *target = (const $fctype *) (cvt->buf + dstsize); -EOF - } - - for (my $i = 0; $i < $channels; $i++) { - my $idx = ($upsample) ? (($channels - $i) - 1) : $i; - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]"); - print <= 0; $i--) { - my $dsti = $i + $channels; - print <= 0; $i--) { - my $dsti = $i; - print <= 0; $i--) { - my $dsti = $i + ($channels * 3); - print <= 0; $i--) { - my $dsti = $i + ($channels * 2); - print <= 0; $i--) { - my $dsti = $i + ($channels * 1); - print <= 0; $i--) { - my $dsti = $i + ($channels * 0); - print <len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -EOF - -} - -sub buildResamplers { - print "#if !NO_RESAMPLERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - buildArbitraryResampleFunc($from, $channel, 1); - buildArbitraryResampleFunc($from, $channel, 0); - } - } - - print "\n#if !LESS_RESAMPLERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $multiple = 2; $multiple <= 4; $multiple += 2) { - buildMultipleResampleFunc($from, $channel, 1, $multiple); - buildMultipleResampleFunc($from, $channel, 0, $multiple); - } - } - } - - print "#endif /* !LESS_RESAMPLERS */\n"; - print "#endif /* !NO_RESAMPLERS */\n\n\n"; - - print "const SDL_AudioRateFilters sdl_audio_rate_filters[] =\n{\n"; - print "#if !NO_RESAMPLERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $upsample = 0; $upsample <= 1; $upsample++) { - my $hashid = getResamplerHashId($from, $channel, $upsample, 0); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, $channel, $upsample, 0, $sym },\n"); - } - } - } - - print "#if !LESS_RESAMPLERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $multiple = 2; $multiple <= 4; $multiple += 2) { - for (my $upsample = 0; $upsample <= 1; $upsample++) { - my $hashid = getResamplerHashId($from, $channel, $upsample, $multiple); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, $channel, $upsample, $multiple, $sym },\n"); - } - } - } - } - - print "#endif /* !LESS_RESAMPLERS */\n"; - print "#endif /* !NO_RESAMPLERS */\n"; - print(" { 0, 0, 0, 0, NULL }\n"); - print "};\n\n"; -} - - -# mainline ... - -outputHeader(); -buildTypeConverters(); -buildResamplers(); -outputFooter(); - -exit 0; - -# end of sdlgenaudiocvt.pl ... - diff --git a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c index fb7d78ff1..4a4917184 100644 --- a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c +++ b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include #endif +#include #include #include "SDL_audio.h" @@ -43,6 +44,14 @@ #include "SDL_loadso.h" #endif +#ifndef INFTIM +#define INFTIM -1 +#endif + +#ifndef SIO_DEVANY +#define SIO_DEVANY "default" +#endif + static struct sio_hdl * (*SNDIO_sio_open)(const char *, unsigned int, int); static void (*SNDIO_sio_close)(struct sio_hdl *); static int (*SNDIO_sio_setpar)(struct sio_hdl *, struct sio_par *); @@ -51,6 +60,10 @@ static int (*SNDIO_sio_start)(struct sio_hdl *); static int (*SNDIO_sio_stop)(struct sio_hdl *); static size_t (*SNDIO_sio_read)(struct sio_hdl *, void *, size_t); static size_t (*SNDIO_sio_write)(struct sio_hdl *, const void *, size_t); +static int (*SNDIO_sio_nfds)(struct sio_hdl *); +static int (*SNDIO_sio_pollfd)(struct sio_hdl *, struct pollfd *, int); +static int (*SNDIO_sio_revents)(struct sio_hdl *, struct pollfd *); +static int (*SNDIO_sio_eof)(struct sio_hdl *); static void (*SNDIO_sio_initpar)(struct sio_par *); #ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @@ -87,6 +100,10 @@ load_sndio_syms(void) SDL_SNDIO_SYM(sio_stop); SDL_SNDIO_SYM(sio_read); SDL_SNDIO_SYM(sio_write); + SDL_SNDIO_SYM(sio_nfds); + SDL_SNDIO_SYM(sio_pollfd); + SDL_SNDIO_SYM(sio_revents); + SDL_SNDIO_SYM(sio_eof); SDL_SNDIO_SYM(sio_initpar); return 0; } @@ -164,6 +181,41 @@ SNDIO_PlayDevice(_THIS) #endif } +static int +SNDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + size_t r; + int revents; + int nfds; + + /* Emulate a blocking read */ + r = SNDIO_sio_read(this->hidden->dev, buffer, buflen); + while (r == 0 && !SNDIO_sio_eof(this->hidden->dev)) { + if ((nfds = SNDIO_sio_pollfd(this->hidden->dev, this->hidden->pfd, POLLIN)) <= 0 + || poll(this->hidden->pfd, nfds, INFTIM) < 0) { + return -1; + } + revents = SNDIO_sio_revents(this->hidden->dev, this->hidden->pfd); + if (revents & POLLIN) { + r = SNDIO_sio_read(this->hidden->dev, buffer, buflen); + } + if (revents & POLLHUP) { + break; + } + } + return (int) r; +} + +static void +SNDIO_FlushCapture(_THIS) +{ + char buf[512]; + + while (SNDIO_sio_read(this->hidden->dev, buf, sizeof(buf)) != 0) { + /* do nothing */; + } +} + static Uint8 * SNDIO_GetDeviceBuf(_THIS) { @@ -173,6 +225,9 @@ SNDIO_GetDeviceBuf(_THIS) static void SNDIO_CloseDevice(_THIS) { + if ( this->hidden->pfd != NULL ) { + SDL_free(this->hidden->pfd); + } if ( this->hidden->dev != NULL ) { SNDIO_sio_stop(this->hidden->dev); SNDIO_sio_close(this->hidden->dev); @@ -197,11 +252,19 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->mixlen = this->spec.size; - /* !!! FIXME: SIO_DEVANY can be a specific device... */ - if ((this->hidden->dev = SNDIO_sio_open(SIO_DEVANY, SIO_PLAY, 0)) == NULL) { + /* Capture devices must be non-blocking for SNDIO_FlushCapture */ + if ((this->hidden->dev = + SNDIO_sio_open(devname != NULL ? devname : SIO_DEVANY, + iscapture ? SIO_REC : SIO_PLAY, iscapture)) == NULL) { return SDL_SetError("sio_open() failed"); } + /* Allocate the pollfd array for capture devices */ + if (iscapture && (this->hidden->pfd = + SDL_malloc(sizeof(struct pollfd) * SNDIO_sio_nfds(this->hidden->dev))) == NULL) { + return SDL_OutOfMemory(); + } + SNDIO_sio_initpar(&par); par.rate = this->spec.freq; @@ -300,8 +363,12 @@ SNDIO_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = SNDIO_PlayDevice; impl->GetDeviceBuf = SNDIO_GetDeviceBuf; impl->CloseDevice = SNDIO_CloseDevice; + impl->CaptureFromDevice = SNDIO_CaptureFromDevice; + impl->FlushCapture = SNDIO_FlushCapture; impl->Deinitialize = SNDIO_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: sndio can handle multiple devices. */ + + impl->AllowsArbitraryDeviceNames = 1; + impl->HasCaptureSupport = SDL_TRUE; return 1; /* this audio target is available. */ } diff --git a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h index 1e748ac93..144bbc22b 100644 --- a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h +++ b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,10 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_sndioaudio_h -#define _SDL_sndioaudio_h +#ifndef SDL_sndioaudio_h_ +#define SDL_sndioaudio_h_ +#include #include #include "../SDL_sysaudio.h" @@ -38,8 +39,11 @@ struct SDL_PrivateAudioData /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; + + /* Polling structures for non-blocking sndio devices */ + struct pollfd *pfd; }; -#endif /* _SDL_sndioaudio_h */ +#endif /* SDL_sndioaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c index b994c12c3..ddf94b3a3 100644 --- a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c +++ b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,6 +40,7 @@ #include "SDL_timer.h" #include "SDL_audio.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" #include "SDL_sunaudio.h" @@ -97,11 +98,7 @@ SUNAUDIO_WaitDevice(_THIS) } } #else - fd_set fdset; - - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, NULL); + SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, -1); #endif } @@ -193,6 +190,10 @@ SUNAUDIO_CloseDevice(_THIS) static int SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { +#ifdef AUDIO_SETINFO + int enc; +#endif + int desired_freq = 0; const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); SDL_AudioFormat format = 0; audio_info_t info; @@ -220,10 +221,7 @@ SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); } -#ifdef AUDIO_SETINFO - int enc; -#endif - int desired_freq = this->spec.freq; + desired_freq = this->spec.freq; /* Determine the audio parameters from the AudioSpec */ switch (SDL_AUDIO_BITSIZE(this->spec.format)) { diff --git a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h index ecced0f51..2b7d57bde 100644 --- a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h +++ b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_sunaudio_h -#define _SDL_sunaudio_h +#ifndef SDL_sunaudio_h_ +#define SDL_sunaudio_h_ #include "../SDL_sysaudio.h" @@ -42,6 +42,6 @@ struct SDL_PrivateAudioData int frequency; /* The audio frequency in KHz */ }; -#endif /* _SDL_sunaudio_h */ +#endif /* SDL_sunaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c new file mode 100644 index 000000000..b7c8dda5d --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c @@ -0,0 +1,779 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_WASAPI + +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +/* This constant isn't available on MinGW-w64 */ +#ifndef AUDCLNT_STREAMFLAGS_RATEADJUST +#define AUDCLNT_STREAMFLAGS_RATEADJUST 0x00100000 +#endif + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +SDL_atomic_t WASAPI_DefaultPlaybackGeneration; +SDL_atomic_t WASAPI_DefaultCaptureGeneration; + +/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */ +typedef struct DevIdList +{ + WCHAR *str; + struct DevIdList *next; +} DevIdList; + +static DevIdList *deviceid_list = NULL; + +/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ +static const IID SDL_IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483,{ 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2 } }; +static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0,{ 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; + +static SDL_bool +WStrEqual(const WCHAR *a, const WCHAR *b) +{ + while (*a) { + if (*a != *b) { + return SDL_FALSE; + } + a++; + b++; + } + return *b == 0; +} + +static size_t +WStrLen(const WCHAR *wstr) +{ + size_t retval = 0; + if (wstr) { + while (*(wstr++)) { + retval++; + } + } + return retval; +} + +static WCHAR * +WStrDupe(const WCHAR *wstr) +{ + const size_t len = (WStrLen(wstr) + 1) * sizeof (WCHAR); + WCHAR *retval = (WCHAR *) SDL_malloc(len); + if (retval) { + SDL_memcpy(retval, wstr, len); + } + return retval; +} + + +void +WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid) +{ + DevIdList *i; + DevIdList *next; + DevIdList *prev = NULL; + for (i = deviceid_list; i; i = next) { + next = i->next; + if (WStrEqual(i->str, devid)) { + if (prev) { + prev->next = next; + } else { + deviceid_list = next; + } + SDL_RemoveAudioDevice(iscapture, i->str); + SDL_free(i->str); + SDL_free(i); + } + prev = i; + } +} + +void +WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid) +{ + DevIdList *devidlist; + + /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). + In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for + phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be + available and switch automatically. (!!! FIXME...?) */ + + /* see if we already have this one. */ + for (devidlist = deviceid_list; devidlist; devidlist = devidlist->next) { + if (WStrEqual(devidlist->str, devid)) { + return; /* we already have this. */ + } + } + + devidlist = (DevIdList *) SDL_malloc(sizeof (*devidlist)); + if (!devidlist) { + return; /* oh well. */ + } + + devid = WStrDupe(devid); + if (!devid) { + SDL_free(devidlist); + return; /* oh well. */ + } + + devidlist->str = (WCHAR *) devid; + devidlist->next = deviceid_list; + deviceid_list = devidlist; + + SDL_AddAudioDevice(iscapture, devname, (void *) devid); +} + +static void +WASAPI_DetectDevices(void) +{ + WASAPI_EnumerateEndpoints(); +} + +static int +WASAPI_GetPendingBytes(_THIS) +{ + UINT32 frames = 0; + + /* it's okay to fail here; we'll deal with failures in the audio thread. */ + /* FIXME: need a lock around checking this->hidden->client */ + if (this->hidden->client != NULL) { /* definitely activated? */ + if (FAILED(IAudioClient_GetCurrentPadding(this->hidden->client, &frames))) { + return 0; /* oh well. */ + } + } + return ((int) frames) * this->hidden->framesize; +} + +static SDL_INLINE SDL_bool +WasapiFailed(_THIS, const HRESULT err) +{ + if (err == S_OK) { + return SDL_FALSE; + } + + if (err == AUDCLNT_E_DEVICE_INVALIDATED) { + this->hidden->device_lost = SDL_TRUE; + } else if (SDL_AtomicGet(&this->enabled)) { + IAudioClient_Stop(this->hidden->client); + SDL_OpenedAudioDeviceDisconnected(this); + SDL_assert(!SDL_AtomicGet(&this->enabled)); + } + + return SDL_TRUE; +} + +static int +UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec) +{ + /* Since WASAPI requires us to handle all audio conversion, and our + device format might have changed, we might have to add/remove/change + the audio stream that the higher level uses to convert data, so + SDL keeps firing the callback as if nothing happened here. */ + + if ( (this->callbackspec.channels == this->spec.channels) && + (this->callbackspec.format == this->spec.format) && + (this->callbackspec.freq == this->spec.freq) && + (this->callbackspec.samples == this->spec.samples) ) { + /* no need to buffer/convert in an AudioStream! */ + SDL_FreeAudioStream(this->stream); + this->stream = NULL; + } else if ( (oldspec->channels == this->spec.channels) && + (oldspec->format == this->spec.format) && + (oldspec->freq == this->spec.freq) ) { + /* The existing audio stream is okay to keep using. */ + } else { + /* replace the audiostream for new format */ + SDL_FreeAudioStream(this->stream); + if (this->iscapture) { + this->stream = SDL_NewAudioStream(this->spec.format, + this->spec.channels, this->spec.freq, + this->callbackspec.format, + this->callbackspec.channels, + this->callbackspec.freq); + } else { + this->stream = SDL_NewAudioStream(this->callbackspec.format, + this->callbackspec.channels, + this->callbackspec.freq, this->spec.format, + this->spec.channels, this->spec.freq); + } + + if (!this->stream) { + return -1; + } + } + + /* make sure our scratch buffer can cover the new device spec. */ + if (this->spec.size > this->work_buffer_len) { + Uint8 *ptr = (Uint8 *) SDL_realloc(this->work_buffer, this->spec.size); + if (ptr == NULL) { + return SDL_OutOfMemory(); + } + this->work_buffer = ptr; + this->work_buffer_len = this->spec.size; + } + + return 0; +} + + +static void ReleaseWasapiDevice(_THIS); + +static SDL_bool +RecoverWasapiDevice(_THIS) +{ + ReleaseWasapiDevice(this); /* dump the lost device's handles. */ + + if (this->hidden->default_device_generation) { + this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + } + + /* this can fail for lots of reasons, but the most likely is we had a + non-default device that was disconnected, so we can't recover. Default + devices try to reinitialize whatever the new default is, so it's more + likely to carry on here, but this handles a non-default device that + simply had its format changed in the Windows Control Panel. */ + if (WASAPI_ActivateDevice(this, SDL_TRUE) == -1) { + SDL_OpenedAudioDeviceDisconnected(this); + return SDL_FALSE; + } + + this->hidden->device_lost = SDL_FALSE; + + return SDL_TRUE; /* okay, carry on with new device details! */ +} + +static SDL_bool +RecoverWasapiIfLost(_THIS) +{ + const int generation = this->hidden->default_device_generation; + SDL_bool lost = this->hidden->device_lost; + + if (!SDL_AtomicGet(&this->enabled)) { + return SDL_FALSE; /* already failed. */ + } + + if (!this->hidden->client) { + return SDL_TRUE; /* still waiting for activation. */ + } + + if (!lost && (generation > 0)) { /* is a default device? */ + const int newgen = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + if (generation != newgen) { /* the desired default device was changed, jump over to it. */ + lost = SDL_TRUE; + } + } + + return lost ? RecoverWasapiDevice(this) : SDL_TRUE; +} + +static Uint8 * +WASAPI_GetDeviceBuf(_THIS) +{ + /* get an endpoint buffer from WASAPI. */ + BYTE *buffer = NULL; + + while (RecoverWasapiIfLost(this) && this->hidden->render) { + if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) { + return (Uint8 *) buffer; + } + SDL_assert(buffer == NULL); + } + + return (Uint8 *) buffer; +} + +static void +WASAPI_PlayDevice(_THIS) +{ + if (this->hidden->render != NULL) { /* definitely activated? */ + /* WasapiFailed() will mark the device for reacquisition or removal elsewhere. */ + WasapiFailed(this, IAudioRenderClient_ReleaseBuffer(this->hidden->render, this->spec.samples, 0)); + } +} + +static void +WASAPI_WaitDevice(_THIS) +{ + while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) { + /*SDL_Log("WAITDEVICE");*/ + if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) { + const UINT32 maxpadding = this->spec.samples; + UINT32 padding = 0; + if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) { + /*SDL_Log("WASAPI EVENT! padding=%u maxpadding=%u", (unsigned int)padding, (unsigned int)maxpadding);*/ + if (padding <= maxpadding) { + break; + } + } + } else { + /*SDL_Log("WASAPI FAILED EVENT!");*/ + IAudioClient_Stop(this->hidden->client); + SDL_OpenedAudioDeviceDisconnected(this); + } + } +} + +static int +WASAPI_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + SDL_AudioStream *stream = this->hidden->capturestream; + const int avail = SDL_AudioStreamAvailable(stream); + if (avail > 0) { + const int cpy = SDL_min(buflen, avail); + SDL_AudioStreamGet(stream, buffer, cpy); + return cpy; + } + + while (RecoverWasapiIfLost(this)) { + HRESULT ret; + BYTE *ptr = NULL; + UINT32 frames = 0; + DWORD flags = 0; + + /* uhoh, client isn't activated yet, just return silence. */ + if (!this->hidden->capture) { + /* Delay so we run at about the speed that audio would be arriving. */ + SDL_Delay(((this->spec.samples * 1000) / this->spec.freq)); + SDL_memset(buffer, this->spec.silence, buflen); + return buflen; + } + + ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL); + if (ret != AUDCLNT_S_BUFFER_EMPTY) { + WasapiFailed(this, ret); /* mark device lost/failed if necessary. */ + } + + if ((ret == AUDCLNT_S_BUFFER_EMPTY) || !frames) { + WASAPI_WaitDevice(this); + } else if (ret == S_OK) { + const int total = ((int) frames) * this->hidden->framesize; + const int cpy = SDL_min(buflen, total); + const int leftover = total - cpy; + const SDL_bool silent = (flags & AUDCLNT_BUFFERFLAGS_SILENT) ? SDL_TRUE : SDL_FALSE; + + if (silent) { + SDL_memset(buffer, this->spec.silence, cpy); + } else { + SDL_memcpy(buffer, ptr, cpy); + } + + if (leftover > 0) { + ptr += cpy; + if (silent) { + SDL_memset(ptr, this->spec.silence, leftover); /* I guess this is safe? */ + } + + if (SDL_AudioStreamPut(stream, ptr, leftover) == -1) { + return -1; /* uhoh, out of memory, etc. Kill device. :( */ + } + } + + ret = IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames); + WasapiFailed(this, ret); /* mark device lost/failed if necessary. */ + + return cpy; + } + } + + return -1; /* unrecoverable error. */ +} + +static void +WASAPI_FlushCapture(_THIS) +{ + BYTE *ptr = NULL; + UINT32 frames = 0; + DWORD flags = 0; + + if (!this->hidden->capture) { + return; /* not activated yet? */ + } + + /* just read until we stop getting packets, throwing them away. */ + while (SDL_TRUE) { + const HRESULT ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL); + if (ret == AUDCLNT_S_BUFFER_EMPTY) { + break; /* no more buffered data; we're done. */ + } else if (WasapiFailed(this, ret)) { + break; /* failed for some other reason, abort. */ + } else if (WasapiFailed(this, IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames))) { + break; /* something broke. */ + } + } + SDL_AudioStreamClear(this->hidden->capturestream); +} + +static void +ReleaseWasapiDevice(_THIS) +{ + if (this->hidden->client) { + IAudioClient_Stop(this->hidden->client); + IAudioClient_SetEventHandle(this->hidden->client, NULL); + IAudioClient_Release(this->hidden->client); + this->hidden->client = NULL; + } + + if (this->hidden->render) { + IAudioRenderClient_Release(this->hidden->render); + this->hidden->render = NULL; + } + + if (this->hidden->capture) { + IAudioCaptureClient_Release(this->hidden->capture); + this->hidden->capture = NULL; + } + + if (this->hidden->waveformat) { + CoTaskMemFree(this->hidden->waveformat); + this->hidden->waveformat = NULL; + } + + if (this->hidden->capturestream) { + SDL_FreeAudioStream(this->hidden->capturestream); + this->hidden->capturestream = NULL; + } + + if (this->hidden->activation_handler) { + WASAPI_PlatformDeleteActivationHandler(this->hidden->activation_handler); + this->hidden->activation_handler = NULL; + } + + if (this->hidden->event) { + CloseHandle(this->hidden->event); + this->hidden->event = NULL; + } +} + +static void +WASAPI_CloseDevice(_THIS) +{ + WASAPI_UnrefDevice(this); +} + +void +WASAPI_RefDevice(_THIS) +{ + SDL_AtomicIncRef(&this->hidden->refcount); +} + +void +WASAPI_UnrefDevice(_THIS) +{ + if (!SDL_AtomicDecRef(&this->hidden->refcount)) { + return; + } + + /* actual closing happens here. */ + + /* don't touch this->hidden->task in here; it has to be reverted from + our callback thread. We do that in WASAPI_ThreadDeinit(). + (likewise for this->hidden->coinitialized). */ + ReleaseWasapiDevice(this); + SDL_free(this->hidden->devid); + SDL_free(this->hidden); +} + +/* This is called once a device is activated, possibly asynchronously. */ +int +WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) +{ + /* !!! FIXME: we could request an exclusive mode stream, which is lower latency; + !!! it will write into the kernel's audio buffer directly instead of + !!! shared memory that a user-mode mixer then writes to the kernel with + !!! everything else. Doing this means any other sound using this device will + !!! stop playing, including the user's MP3 player and system notification + !!! sounds. You'd probably need to release the device when the app isn't in + !!! the foreground, to be a good citizen of the system. It's doable, but it's + !!! more work and causes some annoyances, and I don't know what the latency + !!! wins actually look like. Maybe add a hint to force exclusive mode at + !!! some point. To be sure, defaulting to shared mode is the right thing to + !!! do in any case. */ + const SDL_AudioSpec oldspec = this->spec; + const AUDCLNT_SHAREMODE sharemode = AUDCLNT_SHAREMODE_SHARED; + UINT32 bufsize = 0; /* this is in sample frames, not samples, not bytes. */ + REFERENCE_TIME duration = 0; + IAudioClient *client = this->hidden->client; + IAudioRenderClient *render = NULL; + IAudioCaptureClient *capture = NULL; + WAVEFORMATEX *waveformat = NULL; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + SDL_AudioFormat wasapi_format = 0; + SDL_bool valid_format = SDL_FALSE; + HRESULT ret = S_OK; + DWORD streamflags = 0; + + SDL_assert(client != NULL); + +#ifdef __WINRT__ /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */ + this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); +#else + this->hidden->event = CreateEventW(NULL, 0, 0, NULL); +#endif + + if (this->hidden->event == NULL) { + return WIN_SetError("WASAPI can't create an event handle"); + } + + ret = IAudioClient_GetMixFormat(client, &waveformat); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret); + } + + SDL_assert(waveformat != NULL); + this->hidden->waveformat = waveformat; + + this->spec.channels = (Uint8) waveformat->nChannels; + + /* Make sure we have a valid format that we can convert to whatever WASAPI wants. */ + if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_F32SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { + wasapi_format = AUDIO_S16SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_S32SYS; + } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { + const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *) waveformat; + if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_F32SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { + wasapi_format = AUDIO_S16SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_S32SYS; + } + } + + while ((!valid_format) && (test_format)) { + if (test_format == wasapi_format) { + this->spec.format = test_format; + valid_format = SDL_TRUE; + break; + } + test_format = SDL_NextAudioFormat(); + } + + if (!valid_format) { + return SDL_SetError("WASAPI: Unsupported audio format"); + } + + ret = IAudioClient_GetDevicePeriod(client, NULL, &duration); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret); + } + + /* favor WASAPI's resampler over our own, in Win7+. */ + if (this->spec.freq != waveformat->nSamplesPerSec) { + /* RATEADJUST only works with output devices in share mode, and is available in Win7 and later.*/ + if (WIN_IsWindows7OrGreater() && !this->iscapture && (sharemode == AUDCLNT_SHAREMODE_SHARED)) { + streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST; + waveformat->nSamplesPerSec = this->spec.freq; + waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8); + } + else { + this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in. */ + } + } + + streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK; + ret = IAudioClient_Initialize(client, sharemode, streamflags, duration, sharemode == AUDCLNT_SHAREMODE_SHARED ? 0 : duration, waveformat, NULL); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't initialize audio client", ret); + } + + ret = IAudioClient_SetEventHandle(client, this->hidden->event); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't set event handle", ret); + } + + ret = IAudioClient_GetBufferSize(client, &bufsize); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine buffer size", ret); + } + + this->spec.samples = (Uint16) bufsize; + if (!this->iscapture) { + this->spec.samples /= 2; /* fill half of the DMA buffer on each run. */ + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + this->hidden->framesize = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; + + if (this->iscapture) { + this->hidden->capturestream = SDL_NewAudioStream(this->spec.format, this->spec.channels, this->spec.freq, this->spec.format, this->spec.channels, this->spec.freq); + if (!this->hidden->capturestream) { + return -1; /* already set SDL_Error */ + } + + ret = IAudioClient_GetService(client, &SDL_IID_IAudioCaptureClient, (void**) &capture); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret); + } + + SDL_assert(capture != NULL); + this->hidden->capture = capture; + ret = IAudioClient_Start(client); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't start capture", ret); + } + + WASAPI_FlushCapture(this); /* MSDN says you should flush capture endpoint right after startup. */ + } else { + ret = IAudioClient_GetService(client, &SDL_IID_IAudioRenderClient, (void**) &render); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret); + } + + SDL_assert(render != NULL); + this->hidden->render = render; + ret = IAudioClient_Start(client); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't start playback", ret); + } + } + + if (updatestream) { + if (UpdateAudioStream(this, &oldspec) == -1) { + return -1; + } + } + + return 0; /* good to go. */ +} + + +static int +WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + LPCWSTR devid = (LPCWSTR) handle; + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); + + WASAPI_RefDevice(this); /* so CloseDevice() will unref to zero. */ + + if (!devid) { /* is default device? */ + this->hidden->default_device_generation = SDL_AtomicGet(iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + } else { + this->hidden->devid = WStrDupe(devid); + if (!this->hidden->devid) { + return SDL_OutOfMemory(); + } + } + + if (WASAPI_ActivateDevice(this, SDL_FALSE) == -1) { + return -1; /* already set error. */ + } + + /* Ready, but waiting for async device activation. + Until activation is successful, we will report silence from capture + devices and ignore data on playback devices. + Also, since we don't know the _actual_ device format until after + activation, we let the app have whatever it asks for. We set up + an SDL_AudioStream to convert, if necessary, once the activation + completes. */ + + return 0; +} + +static void +WASAPI_ThreadInit(_THIS) +{ + WASAPI_PlatformThreadInit(this); +} + +static void +WASAPI_ThreadDeinit(_THIS) +{ + WASAPI_PlatformThreadDeinit(this); +} + +static void +WASAPI_Deinitialize(void) +{ + DevIdList *devidlist; + DevIdList *next; + + WASAPI_PlatformDeinit(); + + for (devidlist = deviceid_list; devidlist; devidlist = next) { + next = devidlist->next; + SDL_free(devidlist->str); + SDL_free(devidlist); + } + deviceid_list = NULL; +} + +static int +WASAPI_Init(SDL_AudioDriverImpl * impl) +{ + SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1); + SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1); + + if (WASAPI_PlatformInit() == -1) { + return 0; + } + + /* Set the function pointers */ + impl->DetectDevices = WASAPI_DetectDevices; + impl->ThreadInit = WASAPI_ThreadInit; + impl->ThreadDeinit = WASAPI_ThreadDeinit; + impl->BeginLoopIteration = WASAPI_BeginLoopIteration; + impl->OpenDevice = WASAPI_OpenDevice; + impl->PlayDevice = WASAPI_PlayDevice; + impl->WaitDevice = WASAPI_WaitDevice; + impl->GetPendingBytes = WASAPI_GetPendingBytes; + impl->GetDeviceBuf = WASAPI_GetDeviceBuf; + impl->CaptureFromDevice = WASAPI_CaptureFromDevice; + impl->FlushCapture = WASAPI_FlushCapture; + impl->CloseDevice = WASAPI_CloseDevice; + impl->Deinitialize = WASAPI_Deinitialize; + impl->HasCaptureSupport = 1; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap WASAPI_bootstrap = { + "wasapi", "WASAPI", WASAPI_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_WASAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h new file mode 100644 index 000000000..142c0e586 --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h @@ -0,0 +1,85 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_wasapi_h_ +#define SDL_wasapi_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#ifdef __cplusplus +#define _THIS SDL_AudioDevice *_this +#else +#define _THIS SDL_AudioDevice *this +#endif + +struct SDL_PrivateAudioData +{ + SDL_atomic_t refcount; + WCHAR *devid; + WAVEFORMATEX *waveformat; + IAudioClient *client; + IAudioRenderClient *render; + IAudioCaptureClient *capture; + SDL_AudioStream *capturestream; + HANDLE event; + HANDLE task; + SDL_bool coinitialized; + int framesize; + int default_device_generation; + SDL_bool device_lost; + void *activation_handler; + SDL_atomic_t just_activated; +}; + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +extern SDL_atomic_t WASAPI_DefaultPlaybackGeneration; +extern SDL_atomic_t WASAPI_DefaultCaptureGeneration; + +/* win32 and winrt implementations call into these. */ +int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream); +void WASAPI_RefDevice(_THIS); +void WASAPI_UnrefDevice(_THIS); +void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid); +void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid); + +/* These are functions that are implemented differently for Windows vs WinRT. */ +int WASAPI_PlatformInit(void); +void WASAPI_PlatformDeinit(void); +void WASAPI_EnumerateEndpoints(void); +int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery); +void WASAPI_PlatformThreadInit(_THIS); +void WASAPI_PlatformThreadDeinit(_THIS); +void WASAPI_PlatformDeleteActivationHandler(void *handler); +void WASAPI_BeginLoopIteration(_THIS); + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_wasapi_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c new file mode 100644 index 000000000..8b55582c3 --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c @@ -0,0 +1,417 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +/* This is code that Windows uses to talk to WASAPI-related system APIs. + This is for non-WinRT desktop apps. The C++/CX implementation of these + functions, exclusive to WinRT, are in SDL_wasapi_winrt.cpp. + The code in SDL_wasapi.c is used by both standard Windows and WinRT builds + to deal with audio and calls into these functions. */ + +#if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) + +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +static const ERole SDL_WASAPI_role = eConsole; /* !!! FIXME: should this be eMultimedia? Should be a hint? */ + +/* This is global to the WASAPI target, to handle hotplug and default device lookup. */ +static IMMDeviceEnumerator *enumerator = NULL; + +/* PropVariantInit() is an inline function/macro in PropIdl.h that calls the C runtime's memset() directly. Use ours instead, to avoid dependency. */ +#ifdef PropVariantInit +#undef PropVariantInit +#endif +#define PropVariantInit(p) SDL_zerop(p) + +/* handle to Avrt.dll--Vista and later!--for flagging the callback thread as "Pro Audio" (low latency). */ +static HMODULE libavrt = NULL; +typedef HANDLE(WINAPI *pfnAvSetMmThreadCharacteristicsW)(LPWSTR, LPDWORD); +typedef BOOL(WINAPI *pfnAvRevertMmThreadCharacteristics)(HANDLE); +static pfnAvSetMmThreadCharacteristicsW pAvSetMmThreadCharacteristicsW = NULL; +static pfnAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL; + +/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ +static const CLSID SDL_CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,{ 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e } }; +static const IID SDL_IID_IMMDeviceEnumerator = { 0xa95664d2, 0x9614, 0x4f35,{ 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6 } }; +static const IID SDL_IID_IMMNotificationClient = { 0x7991eec9, 0x7e89, 0x4d85,{ 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0 } }; +static const IID SDL_IID_IMMEndpoint = { 0x1be09788, 0x6894, 0x4089,{ 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5 } }; +static const IID SDL_IID_IAudioClient = { 0x1cb9ad4c, 0xdbfa, 0x4c32,{ 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2 } }; +static const PROPERTYKEY SDL_PKEY_Device_FriendlyName = { { 0xa45c254e, 0xdf1c, 0x4efd,{ 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, } }, 14 }; + + +static char * +GetWasapiDeviceName(IMMDevice *device) +{ + /* PKEY_Device_FriendlyName gives you "Speakers (SoundBlaster Pro)" which drives me nuts. I'd rather it be + "SoundBlaster Pro (Speakers)" but I guess that's developers vs users. Windows uses the FriendlyName in + its own UIs, like Volume Control, etc. */ + char *utf8dev = NULL; + IPropertyStore *props = NULL; + if (SUCCEEDED(IMMDevice_OpenPropertyStore(device, STGM_READ, &props))) { + PROPVARIANT var; + PropVariantInit(&var); + if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_Device_FriendlyName, &var))) { + utf8dev = WIN_StringToUTF8(var.pwszVal); + } + PropVariantClear(&var); + IPropertyStore_Release(props); + } + return utf8dev; +} + + +/* We need a COM subclass of IMMNotificationClient for hotplug support, which is + easy in C++, but we have to tapdance more to make work in C. + Thanks to this page for coaching on how to make this work: + https://www.codeproject.com/Articles/13601/COM-in-plain-C */ + +typedef struct SDLMMNotificationClient +{ + const IMMNotificationClientVtbl *lpVtbl; + SDL_atomic_t refcount; +} SDLMMNotificationClient; + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_QueryInterface(IMMNotificationClient *this, REFIID iid, void **ppv) +{ + if ((WIN_IsEqualIID(iid, &IID_IUnknown)) || (WIN_IsEqualIID(iid, &SDL_IID_IMMNotificationClient))) + { + *ppv = this; + this->lpVtbl->AddRef(this); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_AddRef(IMMNotificationClient *ithis) +{ + SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; + return (ULONG) (SDL_AtomicIncRef(&this->refcount) + 1); +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_Release(IMMNotificationClient *ithis) +{ + /* this is a static object; we don't ever free it. */ + SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; + const ULONG retval = SDL_AtomicDecRef(&this->refcount); + if (retval == 0) { + SDL_AtomicSet(&this->refcount, 0); /* uhh... */ + return 0; + } + return retval - 1; +} + +/* These are the entry points called when WASAPI device endpoints change. */ +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDefaultDeviceChanged(IMMNotificationClient *ithis, EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) +{ + if (role != SDL_WASAPI_role) { + return S_OK; /* ignore it. */ + } + + /* Increment the "generation," so opened devices will pick this up in their threads. */ + switch (flow) { + case eRender: + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); + break; + + case eCapture: + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); + break; + + case eAll: + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); + break; + + default: + SDL_assert(!"uhoh, unexpected OnDefaultDeviceChange flow!"); + break; + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceAdded(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* we ignore this; devices added here then progress to ACTIVE, if appropriate, in + OnDeviceStateChange, making that a better place to deal with device adds. More + importantly: the first time you plug in a USB audio device, this callback will + fire, but when you unplug it, it isn't removed (it's state changes to NOTPRESENT). + Plugging it back in won't fire this callback again. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceRemoved(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* See notes in OnDeviceAdded handler about why we ignore this. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId, DWORD dwNewState) +{ + IMMDevice *device = NULL; + + if (SUCCEEDED(IMMDeviceEnumerator_GetDevice(enumerator, pwstrDeviceId, &device))) { + IMMEndpoint *endpoint = NULL; + if (SUCCEEDED(IMMDevice_QueryInterface(device, &SDL_IID_IMMEndpoint, (void **) &endpoint))) { + EDataFlow flow; + if (SUCCEEDED(IMMEndpoint_GetDataFlow(endpoint, &flow))) { + const SDL_bool iscapture = (flow == eCapture); + if (dwNewState == DEVICE_STATE_ACTIVE) { + char *utf8dev = GetWasapiDeviceName(device); + if (utf8dev) { + WASAPI_AddDevice(iscapture, utf8dev, pwstrDeviceId); + SDL_free(utf8dev); + } + } else { + WASAPI_RemoveDevice(iscapture, pwstrDeviceId); + } + } + IMMEndpoint_Release(endpoint); + } + IMMDevice_Release(device); + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnPropertyValueChanged(IMMNotificationClient *this, LPCWSTR pwstrDeviceId, const PROPERTYKEY key) +{ + return S_OK; /* we don't care about these. */ +} + +static const IMMNotificationClientVtbl notification_client_vtbl = { + SDLMMNotificationClient_QueryInterface, + SDLMMNotificationClient_AddRef, + SDLMMNotificationClient_Release, + SDLMMNotificationClient_OnDeviceStateChanged, + SDLMMNotificationClient_OnDeviceAdded, + SDLMMNotificationClient_OnDeviceRemoved, + SDLMMNotificationClient_OnDefaultDeviceChanged, + SDLMMNotificationClient_OnPropertyValueChanged +}; + +static SDLMMNotificationClient notification_client = { ¬ification_client_vtbl, { 1 } }; + + +int +WASAPI_PlatformInit(void) +{ + HRESULT ret; + + /* just skip the discussion with COM here. */ + if (!WIN_IsWindowsVistaOrGreater()) { + return SDL_SetError("WASAPI support requires Windows Vista or later"); + } + + if (FAILED(WIN_CoInitialize())) { + return SDL_SetError("WASAPI: CoInitialize() failed"); + } + + ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID) &enumerator); + if (FAILED(ret)) { + WIN_CoUninitialize(); + return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret); + } + + libavrt = LoadLibraryW(L"avrt.dll"); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */ + if (libavrt) { + pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW"); + pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics"); + } + + return 0; +} + +void +WASAPI_PlatformDeinit(void) +{ + if (enumerator) { + IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); + IMMDeviceEnumerator_Release(enumerator); + enumerator = NULL; + } + + if (libavrt) { + FreeLibrary(libavrt); + libavrt = NULL; + } + + pAvSetMmThreadCharacteristicsW = NULL; + pAvRevertMmThreadCharacteristics = NULL; + + WIN_CoUninitialize(); +} + +void +WASAPI_PlatformThreadInit(_THIS) +{ + /* this thread uses COM. */ + if (SUCCEEDED(WIN_CoInitialize())) { /* can't report errors, hope it worked! */ + this->hidden->coinitialized = SDL_TRUE; + } + + /* Set this thread to very high "Pro Audio" priority. */ + if (pAvSetMmThreadCharacteristicsW) { + DWORD idx = 0; + this->hidden->task = pAvSetMmThreadCharacteristicsW(TEXT("Pro Audio"), &idx); + } +} + +void +WASAPI_PlatformThreadDeinit(_THIS) +{ + /* Set this thread back to normal priority. */ + if (this->hidden->task && pAvRevertMmThreadCharacteristics) { + pAvRevertMmThreadCharacteristics(this->hidden->task); + this->hidden->task = NULL; + } + + if (this->hidden->coinitialized) { + WIN_CoUninitialize(); + this->hidden->coinitialized = SDL_FALSE; + } +} + +int +WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) +{ + LPCWSTR devid = this->hidden->devid; + IMMDevice *device = NULL; + HRESULT ret; + + if (devid == NULL) { + const EDataFlow dataflow = this->iscapture ? eCapture : eRender; + ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_WASAPI_role, &device); + } else { + ret = IMMDeviceEnumerator_GetDevice(enumerator, devid, &device); + } + + if (FAILED(ret)) { + SDL_assert(device == NULL); + this->hidden->client = NULL; + return WIN_SetErrorFromHRESULT("WASAPI can't find requested audio endpoint", ret); + } + + /* this is not async in standard win32, yay! */ + ret = IMMDevice_Activate(device, &SDL_IID_IAudioClient, CLSCTX_ALL, NULL, (void **) &this->hidden->client); + IMMDevice_Release(device); + + if (FAILED(ret)) { + SDL_assert(this->hidden->client == NULL); + return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret); + } + + SDL_assert(this->hidden->client != NULL); + if (WASAPI_PrepDevice(this, isrecovery) == -1) { /* not async, fire it right away. */ + return -1; + } + + return 0; /* good to go. */ +} + + +static void +WASAPI_EnumerateEndpointsForFlow(const SDL_bool iscapture) +{ + IMMDeviceCollection *collection = NULL; + UINT i, total; + + /* Note that WASAPI separates "adapter devices" from "audio endpoint devices" + ...one adapter device ("SoundBlaster Pro") might have multiple endpoint devices ("Speakers", "Line-Out"). */ + + if (FAILED(IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, iscapture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &collection))) { + return; + } + + if (FAILED(IMMDeviceCollection_GetCount(collection, &total))) { + IMMDeviceCollection_Release(collection); + return; + } + + for (i = 0; i < total; i++) { + IMMDevice *device = NULL; + if (SUCCEEDED(IMMDeviceCollection_Item(collection, i, &device))) { + LPWSTR devid = NULL; + if (SUCCEEDED(IMMDevice_GetId(device, &devid))) { + char *devname = GetWasapiDeviceName(device); + if (devname) { + WASAPI_AddDevice(iscapture, devname, devid); + SDL_free(devname); + } + CoTaskMemFree(devid); + } + IMMDevice_Release(device); + } + } + + IMMDeviceCollection_Release(collection); +} + +void +WASAPI_EnumerateEndpoints(void) +{ + WASAPI_EnumerateEndpointsForFlow(SDL_FALSE); /* playback */ + WASAPI_EnumerateEndpointsForFlow(SDL_TRUE); /* capture */ + + /* if this fails, we just won't get hotplug events. Carry on anyhow. */ + IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); +} + +void +WASAPI_PlatformDeleteActivationHandler(void *handler) +{ + /* not asynchronous. */ + SDL_assert(!"This function should have only been called on WinRT."); +} + +void +WASAPI_BeginLoopIteration(_THIS) +{ + /* no-op. */ +} + +#endif /* SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp new file mode 100644 index 000000000..309ec6a78 --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp @@ -0,0 +1,276 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +// This is C++/CX code that the WinRT port uses to talk to WASAPI-related +// system APIs. The C implementation of these functions, for non-WinRT apps, +// is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard +// Windows and WinRT builds to deal with audio and calls into these functions. + +#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) + +#include +#include +#include +#include +#include + +extern "C" { +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" +} + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +using namespace Windows::Devices::Enumeration; +using namespace Windows::Media::Devices; +using namespace Windows::Foundation; +using namespace Microsoft::WRL; + +class SDL_WasapiDeviceEventHandler +{ +public: + SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture); + ~SDL_WasapiDeviceEventHandler(); + void OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ args); + void OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ args); + void OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args); + void OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args); + void OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args); + +private: + const SDL_bool iscapture; + DeviceWatcher^ watcher; + Windows::Foundation::EventRegistrationToken added_handler; + Windows::Foundation::EventRegistrationToken removed_handler; + Windows::Foundation::EventRegistrationToken updated_handler; + Windows::Foundation::EventRegistrationToken default_changed_handler; +}; + +SDL_WasapiDeviceEventHandler::SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture) + : iscapture(_iscapture) + , watcher(DeviceInformation::CreateWatcher(_iscapture ? DeviceClass::AudioCapture : DeviceClass::AudioRender)) +{ + if (!watcher) + return; // uhoh. + + // !!! FIXME: this doesn't need a lambda here, I think, if I make SDL_WasapiDeviceEventHandler a proper C++/CX class. --ryan. + added_handler = watcher->Added += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformation^ args) { OnDeviceAdded(sender, args); } ); + removed_handler = watcher->Removed += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceRemoved(sender, args); } ); + updated_handler = watcher->Updated += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceUpdated(sender, args); } ); + if (iscapture) { + default_changed_handler = MediaDevice::DefaultAudioCaptureDeviceChanged += ref new TypedEventHandler([this](Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) { OnDefaultCaptureDeviceChanged(sender, args); } ); + } else { + default_changed_handler = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler([this](Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) { OnDefaultRenderDeviceChanged(sender, args); } ); + } + watcher->Start(); +} + +SDL_WasapiDeviceEventHandler::~SDL_WasapiDeviceEventHandler() +{ + if (watcher) { + watcher->Added -= added_handler; + watcher->Removed -= removed_handler; + watcher->Updated -= updated_handler; + watcher->Stop(); + watcher = nullptr; + } + + if (iscapture) { + MediaDevice::DefaultAudioCaptureDeviceChanged -= default_changed_handler; + } else { + MediaDevice::DefaultAudioRenderDeviceChanged -= default_changed_handler; + } +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ info) +{ + SDL_assert(sender == this->watcher); + char *utf8dev = WIN_StringToUTF8(info->Name->Data()); + if (utf8dev) { + WASAPI_AddDevice(this->iscapture, utf8dev, info->Id->Data()); + SDL_free(utf8dev); + } +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ info) +{ + SDL_assert(sender == this->watcher); + WASAPI_RemoveDevice(this->iscapture, info->Id->Data()); +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args) +{ + SDL_assert(sender == this->watcher); +} + +void +SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) +{ + SDL_assert(this->iscapture); + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); +} + +void +SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) +{ + SDL_assert(!this->iscapture); + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); +} + + +static SDL_WasapiDeviceEventHandler *playback_device_event_handler; +static SDL_WasapiDeviceEventHandler *capture_device_event_handler; + +int WASAPI_PlatformInit(void) +{ + return 0; +} + +void WASAPI_PlatformDeinit(void) +{ + delete playback_device_event_handler; + playback_device_event_handler = nullptr; + delete capture_device_event_handler; + capture_device_event_handler = nullptr; +} + +void WASAPI_EnumerateEndpoints(void) +{ + // DeviceWatchers will fire an Added event for each existing device at + // startup, so we don't need to enumerate them separately before + // listening for updates. + playback_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_FALSE); + capture_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_TRUE); +} + +struct SDL_WasapiActivationHandler : public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler > +{ + SDL_WasapiActivationHandler() : device(nullptr) {} + STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation); + SDL_AudioDevice *device; +}; + +HRESULT +SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async) +{ + HRESULT result = S_OK; + IUnknown *iunknown = nullptr; + const HRESULT ret = async->GetActivateResult(&result, &iunknown); + + if (SUCCEEDED(ret) && SUCCEEDED(result)) { + iunknown->QueryInterface(IID_PPV_ARGS(&device->hidden->client)); + if (device->hidden->client) { + // Just set a flag, since we're probably in a different thread. We'll pick it up and init everything on our own thread to prevent races. + SDL_AtomicSet(&device->hidden->just_activated, 1); + } + } + + WASAPI_UnrefDevice(device); + + return S_OK; +} + +void +WASAPI_PlatformDeleteActivationHandler(void *handler) +{ + ((SDL_WasapiActivationHandler *) handler)->Release(); +} + +int +WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) +{ + LPCWSTR devid = _this->hidden->devid; + Platform::String^ defdevid; + + if (devid == nullptr) { + defdevid = _this->iscapture ? MediaDevice::GetDefaultAudioCaptureId(AudioDeviceRole::Default) : MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Default); + if (defdevid) { + devid = defdevid->Data(); + } + } + + SDL_AtomicSet(&_this->hidden->just_activated, 0); + + ComPtr handler = Make(); + if (handler == nullptr) { + return SDL_SetError("Failed to allocate WASAPI activation handler"); + } + + handler.Get()->AddRef(); // we hold a reference after ComPtr destructs on return, causing a Release, and Release ourselves in WASAPI_PlatformDeleteActivationHandler(), etc. + handler.Get()->device = _this; + _this->hidden->activation_handler = handler.Get(); + + WASAPI_RefDevice(_this); /* completion handler will unref it. */ + IActivateAudioInterfaceAsyncOperation *async = nullptr; + const HRESULT ret = ActivateAudioInterfaceAsync(devid, __uuidof(IAudioClient), nullptr, handler.Get(), &async); + + if (async != nullptr) { + async->Release(); + } + + if (FAILED(ret)) { + handler.Get()->Release(); + WASAPI_UnrefDevice(_this); + return WIN_SetErrorFromHRESULT("WASAPI can't activate requested audio endpoint", ret); + } + + return 0; +} + +void +WASAPI_BeginLoopIteration(_THIS) +{ + if (SDL_AtomicCAS(&_this->hidden->just_activated, 1, 0)) { + if (WASAPI_PrepDevice(_this, SDL_TRUE) == -1) { + SDL_OpenedAudioDeviceDisconnected(_this); + } + } +} + +void +WASAPI_PlatformThreadInit(_THIS) +{ + // !!! FIXME: set this thread to "Pro Audio" priority. +} + +void +WASAPI_PlatformThreadDeinit(_THIS) +{ + // !!! FIXME: set this thread to "Pro Audio" priority. +} + +#endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c index 34f543ddb..8e5c17ba1 100644 --- a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c +++ b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,40 @@ #include "../SDL_audio_c.h" #include "SDL_winmm.h" +/* MinGW32 mmsystem.h doesn't include these structures */ +#if defined(__MINGW32__) && defined(_MMSYSTEM_H) + +typedef struct tagWAVEINCAPS2W +{ + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + GUID ManufacturerGuid; + GUID ProductGuid; + GUID NameGuid; +} WAVEINCAPS2W,*PWAVEINCAPS2W,*NPWAVEINCAPS2W,*LPWAVEINCAPS2W; + +typedef struct tagWAVEOUTCAPS2W +{ + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + DWORD dwSupport; + GUID ManufacturerGuid; + GUID ProductGuid; + GUID NameGuid; +} WAVEOUTCAPS2W,*PWAVEOUTCAPS2W,*NPWAVEOUTCAPS2W,*LPWAVEOUTCAPS2W; + +#endif /* defined(__MINGW32__) && defined(_MMSYSTEM_H) */ + #ifndef WAVE_FORMAT_IEEE_FLOAT #define WAVE_FORMAT_IEEE_FLOAT 0x0003 #endif diff --git a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h index 401db398b..9342bb9f1 100644 --- a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h +++ b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_winmm_h -#define _SDL_winmm_h +#ifndef SDL_winmm_h_ +#define SDL_winmm_h_ #include "../SDL_sysaudio.h" @@ -40,6 +40,6 @@ struct SDL_PrivateAudioData int next_buffer; }; -#endif /* _SDL_winmm_h */ +#endif /* SDL_winmm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c deleted file mode 100644 index a18e5d24e..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c +++ /dev/null @@ -1,503 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* WinRT NOTICE: - - A few changes to SDL's XAudio2 backend were warranted by API - changes to Windows. Many, but not all of these are documented by Microsoft - at: - http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx - - 1. Windows' thread synchronization function, CreateSemaphore, was removed - from WinRT. SDL's semaphore API was substituted instead. - 2. The method calls, IXAudio2::GetDeviceCount and IXAudio2::GetDeviceDetails - were removed from the XAudio2 API. Microsoft is telling developers to - use APIs in Windows::Foundation instead. - For SDL, the missing methods were reimplemented using the APIs Microsoft - said to use. - 3. CoInitialize and CoUninitialize are not available in WinRT. - These calls were removed, as COM will have been initialized earlier, - at least by the call to the WinRT app's main function - (aka 'int main(Platform::Array^)). (DLudwig: - This was my understanding of how WinRT: the 'main' function uses - a tag of [MTAThread], which should initialize COM. My understanding - of COM is somewhat limited, and I may be incorrect here.) - 4. IXAudio2::CreateMasteringVoice changed its integer-based 'DeviceIndex' - argument to a string-based one, 'szDeviceId'. In WinRT, the - string-based argument will be used. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_XAUDIO2 - -#include "../../core/windows/SDL_windows.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "../SDL_sysaudio.h" -#include "SDL_assert.h" - -#ifdef __GNUC__ -/* The configure script already did any necessary checking */ -# define SDL_XAUDIO2_HAS_SDK 1 -#elif defined(__WINRT__) -/* WinRT always has access to the XAudio 2 SDK (albeit with a header file - that doesn't compile as C code). -*/ -# define SDL_XAUDIO2_HAS_SDK -#include "SDL_xaudio2.h" /* ... compiles as C code, in contrast to XAudio2 headers - in the Windows SDK, v.10.0.10240.0 (Win 10's initial SDK) - */ -#else -/* XAudio2 exists in the last DirectX SDK as well as the latest Windows SDK. - To enable XAudio2 support, you will need to add the location of your DirectX SDK headers to - the SDL projects additional include directories and then set SDL_XAUDIO2_HAS_SDK=1 as a - preprocessor define - */ -#if 0 /* See comment above */ -#include -#if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) -# pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.") -#else -# define SDL_XAUDIO2_HAS_SDK 1 -#endif -#endif -#endif /* 0 */ - -#ifdef SDL_XAUDIO2_HAS_SDK - -/* Check to see if we're compiling for XAudio 2.8, or higher. */ -#ifdef WINVER -#if WINVER >= 0x0602 /* Windows 8 SDK or higher? */ -#define SDL_XAUDIO2_WIN8 1 -#endif -#endif - -#if !defined(_SDL_XAUDIO2_H) -#define INITGUID 1 -#include -#endif - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -#ifdef __WINRT__ -#include "SDL_xaudio2_winrthelpers.h" -#endif - -/* Fixes bug 1210 where some versions of gcc need named parameters */ -#ifdef __GNUC__ -#ifdef THIS -#undef THIS -#endif -#define THIS INTERFACE *p -#ifdef THIS_ -#undef THIS_ -#endif -#define THIS_ INTERFACE *p, -#endif - -struct SDL_PrivateAudioData -{ - IXAudio2 *ixa2; - IXAudio2SourceVoice *source; - IXAudio2MasteringVoice *mastering; - SDL_sem * semaphore; - Uint8 *mixbuf; - int mixlen; - Uint8 *nextbuf; -}; - - -static void -XAUDIO2_DetectDevices(void) -{ - IXAudio2 *ixa2 = NULL; - UINT32 devcount = 0; - UINT32 i = 0; - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - SDL_SetError("XAudio2: XAudio2Create() failed at detection."); - return; - } else if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) { - SDL_SetError("XAudio2: IXAudio2::GetDeviceCount() failed."); - IXAudio2_Release(ixa2); - return; - } - - for (i = 0; i < devcount; i++) { - XAUDIO2_DEVICE_DETAILS details; - if (IXAudio2_GetDeviceDetails(ixa2, i, &details) == S_OK) { - char *str = WIN_StringToUTF8(details.DisplayName); - if (str != NULL) { - SDL_AddAudioDevice(SDL_FALSE, str, (void *) ((size_t) i+1)); - SDL_free(str); /* SDL_AddAudioDevice made a copy of the string. */ - } - } - } - - IXAudio2_Release(ixa2); -} - -static void STDMETHODCALLTYPE -VoiceCBOnBufferEnd(THIS_ void *data) -{ - /* Just signal the SDL audio thread and get out of XAudio2's way. */ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_SemPost(this->hidden->semaphore); -} - -static void STDMETHODCALLTYPE -VoiceCBOnVoiceError(THIS_ void *data, HRESULT Error) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_OpenedAudioDeviceDisconnected(this); -} - -/* no-op callbacks... */ -static void STDMETHODCALLTYPE VoiceCBOnStreamEnd(THIS) {} -static void STDMETHODCALLTYPE VoiceCBOnVoiceProcessPassStart(THIS_ UINT32 b) {} -static void STDMETHODCALLTYPE VoiceCBOnVoiceProcessPassEnd(THIS) {} -static void STDMETHODCALLTYPE VoiceCBOnBufferStart(THIS_ void *data) {} -static void STDMETHODCALLTYPE VoiceCBOnLoopEnd(THIS_ void *data) {} - - -static Uint8 * -XAUDIO2_GetDeviceBuf(_THIS) -{ - return this->hidden->nextbuf; -} - -static void -XAUDIO2_PlayDevice(_THIS) -{ - XAUDIO2_BUFFER buffer; - Uint8 *mixbuf = this->hidden->mixbuf; - Uint8 *nextbuf = this->hidden->nextbuf; - const int mixlen = this->hidden->mixlen; - IXAudio2SourceVoice *source = this->hidden->source; - HRESULT result = S_OK; - - if (!SDL_AtomicGet(&this->enabled)) { /* shutting down? */ - return; - } - - /* Submit the next filled buffer */ - SDL_zero(buffer); - buffer.AudioBytes = mixlen; - buffer.pAudioData = nextbuf; - buffer.pContext = this; - - if (nextbuf == mixbuf) { - nextbuf += mixlen; - } else { - nextbuf = mixbuf; - } - this->hidden->nextbuf = nextbuf; - - result = IXAudio2SourceVoice_SubmitSourceBuffer(source, &buffer, NULL); - if (result == XAUDIO2_E_DEVICE_INVALIDATED) { - /* !!! FIXME: possibly disconnected or temporary lost. Recover? */ - } - - if (result != S_OK) { /* uhoh, panic! */ - IXAudio2SourceVoice_FlushSourceBuffers(source); - SDL_OpenedAudioDeviceDisconnected(this); - } -} - -static void -XAUDIO2_WaitDevice(_THIS) -{ - if (SDL_AtomicGet(&this->enabled)) { - SDL_SemWait(this->hidden->semaphore); - } -} - -static void -XAUDIO2_PrepareToClose(_THIS) -{ - IXAudio2SourceVoice *source = this->hidden->source; - if (source) { - IXAudio2SourceVoice_Discontinuity(source); - } -} - -static void -XAUDIO2_CloseDevice(_THIS) -{ - IXAudio2 *ixa2 = this->hidden->ixa2; - IXAudio2SourceVoice *source = this->hidden->source; - IXAudio2MasteringVoice *mastering = this->hidden->mastering; - - if (source != NULL) { - IXAudio2SourceVoice_Stop(source, 0, XAUDIO2_COMMIT_NOW); - IXAudio2SourceVoice_FlushSourceBuffers(source); - IXAudio2SourceVoice_DestroyVoice(source); - } - if (ixa2 != NULL) { - IXAudio2_StopEngine(ixa2); - } - if (mastering != NULL) { - IXAudio2MasteringVoice_DestroyVoice(mastering); - } - if (ixa2 != NULL) { - IXAudio2_Release(ixa2); - } - if (this->hidden->semaphore != NULL) { - SDL_DestroySemaphore(this->hidden->semaphore); - } - - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -static int -XAUDIO2_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - HRESULT result = S_OK; - WAVEFORMATEX waveformat; - int valid_format = 0; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - IXAudio2 *ixa2 = NULL; - IXAudio2SourceVoice *source = NULL; -#if defined(SDL_XAUDIO2_WIN8) - LPCWSTR devId = NULL; -#else - UINT32 devId = 0; /* 0 == system default device. */ -#endif - - static IXAudio2VoiceCallbackVtbl callbacks_vtable = { - VoiceCBOnVoiceProcessPassStart, - VoiceCBOnVoiceProcessPassEnd, - VoiceCBOnStreamEnd, - VoiceCBOnBufferStart, - VoiceCBOnBufferEnd, - VoiceCBOnLoopEnd, - VoiceCBOnVoiceError - }; - - static IXAudio2VoiceCallback callbacks = { &callbacks_vtable }; - -#if defined(SDL_XAUDIO2_WIN8) - /* !!! FIXME: hook up hotplugging. */ -#else - if (handle != NULL) { /* specific device requested? */ - /* -1 because we increment the original value to avoid NULL. */ - const size_t val = ((size_t) handle) - 1; - devId = (UINT32) val; - } -#endif - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - return SDL_SetError("XAudio2: XAudio2Create() failed at open."); - } - - /* - XAUDIO2_DEBUG_CONFIGURATION debugConfig; - debugConfig.TraceMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS | XAUDIO2_LOG_DETAIL | XAUDIO2_LOG_FUNC_CALLS | XAUDIO2_LOG_TIMING | XAUDIO2_LOG_LOCKS | XAUDIO2_LOG_MEMORY | XAUDIO2_LOG_STREAMING; - debugConfig.BreakMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS; - debugConfig.LogThreadID = TRUE; - debugConfig.LogFileline = TRUE; - debugConfig.LogFunctionName = TRUE; - debugConfig.LogTiming = TRUE; - ixa2->SetDebugConfiguration(&debugConfig); - */ - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - IXAudio2_Release(ixa2); - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - this->hidden->ixa2 = ixa2; - this->hidden->semaphore = SDL_CreateSemaphore(1); - if (this->hidden->semaphore == NULL) { - return SDL_SetError("XAudio2: CreateSemaphore() failed!"); - } - - while ((!valid_format) && (test_format)) { - switch (test_format) { - case AUDIO_U8: - case AUDIO_S16: - case AUDIO_S32: - case AUDIO_F32: - this->spec.format = test_format; - valid_format = 1; - break; - } - test_format = SDL_NextAudioFormat(); - } - - if (!valid_format) { - return SDL_SetError("XAudio2: Unsupported audio format"); - } - - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&this->spec); - - /* We feed a Source, it feeds the Mastering, which feeds the device. */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(2 * this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - this->hidden->nextbuf = this->hidden->mixbuf; - SDL_memset(this->hidden->mixbuf, this->spec.silence, 2 * this->hidden->mixlen); - - /* We use XAUDIO2_DEFAULT_CHANNELS instead of this->spec.channels. On - Xbox360, this means 5.1 output, but on Windows, it means "figure out - what the system has." It might be preferable to let XAudio2 blast - stereo output to appropriate surround sound configurations - instead of clamping to 2 channels, even though we'll configure the - Source Voice for whatever number of channels you supply. */ -#if SDL_XAUDIO2_WIN8 - result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering, - XAUDIO2_DEFAULT_CHANNELS, - this->spec.freq, 0, devId, NULL, AudioCategory_GameEffects); -#else - result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering, - XAUDIO2_DEFAULT_CHANNELS, - this->spec.freq, 0, devId, NULL); -#endif - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't create mastering voice"); - } - - SDL_zero(waveformat); - if (SDL_AUDIO_ISFLOAT(this->spec.format)) { - waveformat.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; - } else { - waveformat.wFormatTag = WAVE_FORMAT_PCM; - } - waveformat.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); - waveformat.nChannels = this->spec.channels; - waveformat.nSamplesPerSec = this->spec.freq; - waveformat.nBlockAlign = - waveformat.nChannels * (waveformat.wBitsPerSample / 8); - waveformat.nAvgBytesPerSec = - waveformat.nSamplesPerSec * waveformat.nBlockAlign; - waveformat.cbSize = sizeof(waveformat); - -#ifdef __WINRT__ - // DLudwig: for now, make XAudio2 do sample rate conversion, just to - // get the loopwave test to work. - // - // TODO, WinRT: consider removing WinRT-specific source-voice creation code from SDL_xaudio2.c - result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat, - 0, - 1.0f, &callbacks, NULL, NULL); -#else - result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat, - XAUDIO2_VOICE_NOSRC | - XAUDIO2_VOICE_NOPITCH, - 1.0f, &callbacks, NULL, NULL); - -#endif - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't create source voice"); - } - this->hidden->source = source; - - /* Start everything playing! */ - result = IXAudio2_StartEngine(ixa2); - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't start engine"); - } - - result = IXAudio2SourceVoice_Start(source, 0, XAUDIO2_COMMIT_NOW); - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't start source voice"); - } - - return 0; /* good to go. */ -} - -static void -XAUDIO2_Deinitialize(void) -{ -#if defined(__WIN32__) - WIN_CoUninitialize(); -#endif -} - -#endif /* SDL_XAUDIO2_HAS_SDK */ - - -static int -XAUDIO2_Init(SDL_AudioDriverImpl * impl) -{ -#ifndef SDL_XAUDIO2_HAS_SDK - SDL_SetError("XAudio2: SDL was built without XAudio2 support (old DirectX SDK)."); - return 0; /* no XAudio2 support, ever. Update your SDK! */ -#else - /* XAudio2Create() is a macro that uses COM; we don't load the .dll */ - IXAudio2 *ixa2 = NULL; -#if defined(__WIN32__) - // TODO, WinRT: Investigate using CoInitializeEx here - if (FAILED(WIN_CoInitialize())) { - SDL_SetError("XAudio2: CoInitialize() failed"); - return 0; - } -#endif - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { -#if defined(__WIN32__) - WIN_CoUninitialize(); -#endif - SDL_SetError("XAudio2: XAudio2Create() failed at initialization"); - return 0; /* not available. */ - } - IXAudio2_Release(ixa2); - - /* Set the function pointers */ - impl->DetectDevices = XAUDIO2_DetectDevices; - impl->OpenDevice = XAUDIO2_OpenDevice; - impl->PlayDevice = XAUDIO2_PlayDevice; - impl->WaitDevice = XAUDIO2_WaitDevice; - impl->PrepareToClose = XAUDIO2_PrepareToClose; - impl->GetDeviceBuf = XAUDIO2_GetDeviceBuf; - impl->CloseDevice = XAUDIO2_CloseDevice; - impl->Deinitialize = XAUDIO2_Deinitialize; - - /* !!! FIXME: We can apparently use a C++ interface on Windows 8 - * !!! FIXME: (Windows::Devices::Enumeration::DeviceInformation) for device - * !!! FIXME: detection, but it's not implemented here yet. - * !!! FIXME: see http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx - * !!! FIXME: for now, force the default device. - */ -#if defined(SDL_XAUDIO2_WIN8) || defined(__WINRT__) - impl->OnlyHasDefaultOutputDevice = 1; -#endif - - return 1; /* this audio target is available. */ -#endif -} - -AudioBootStrap XAUDIO2_bootstrap = { - "xaudio2", "XAudio2", XAUDIO2_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_XAUDIO2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h deleted file mode 100644 index 864eba451..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h +++ /dev/null @@ -1,386 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_XAUDIO2_H -#define _SDL_XAUDIO2_H - -#include -#include -#include - -/* XAudio2 packs its structure members together as tightly as possible. - This pragma is needed to ensure compatibility with XAudio2 on 64-bit - platforms. -*/ -#pragma pack(push, 1) - -typedef interface IXAudio2 IXAudio2; -typedef interface IXAudio2SourceVoice IXAudio2SourceVoice; -typedef interface IXAudio2MasteringVoice IXAudio2MasteringVoice; -typedef interface IXAudio2EngineCallback IXAudio2EngineCallback; -typedef interface IXAudio2VoiceCallback IXAudio2VoiceCallback; -typedef interface IXAudio2Voice IXAudio2Voice; -typedef interface IXAudio2SubmixVoice IXAudio2SubmixVoice; - -typedef enum _AUDIO_STREAM_CATEGORY { - AudioCategory_Other = 0, - AudioCategory_ForegroundOnlyMedia, - AudioCategory_BackgroundCapableMedia, - AudioCategory_Communications, - AudioCategory_Alerts, - AudioCategory_SoundEffects, - AudioCategory_GameEffects, - AudioCategory_GameMedia, - AudioCategory_GameChat, - AudioCategory_Movie, - AudioCategory_Media -} AUDIO_STREAM_CATEGORY; - -typedef struct XAUDIO2_BUFFER { - UINT32 Flags; - UINT32 AudioBytes; - const BYTE *pAudioData; - UINT32 PlayBegin; - UINT32 PlayLength; - UINT32 LoopBegin; - UINT32 LoopLength; - UINT32 LoopCount; - void *pContext; -} XAUDIO2_BUFFER; - -typedef struct XAUDIO2_BUFFER_WMA { - const UINT32 *pDecodedPacketCumulativeBytes; - UINT32 PacketCount; -} XAUDIO2_BUFFER_WMA; - -typedef struct XAUDIO2_SEND_DESCRIPTOR { - UINT32 Flags; - IXAudio2Voice *pOutputVoice; -} XAUDIO2_SEND_DESCRIPTOR; - -typedef struct XAUDIO2_VOICE_SENDS { - UINT32 SendCount; - XAUDIO2_SEND_DESCRIPTOR *pSends; -} XAUDIO2_VOICE_SENDS; - -typedef struct XAUDIO2_EFFECT_DESCRIPTOR { - IUnknown *pEffect; - BOOL InitialState; - UINT32 OutputChannels; -} XAUDIO2_EFFECT_DESCRIPTOR; - -typedef struct XAUDIO2_EFFECT_CHAIN { - UINT32 EffectCount; - XAUDIO2_EFFECT_DESCRIPTOR *pEffectDescriptors; -} XAUDIO2_EFFECT_CHAIN; - -typedef struct XAUDIO2_PERFORMANCE_DATA { - UINT64 AudioCyclesSinceLastQuery; - UINT64 TotalCyclesSinceLastQuery; - UINT32 MinimumCyclesPerQuantum; - UINT32 MaximumCyclesPerQuantum; - UINT32 MemoryUsageInBytes; - UINT32 CurrentLatencyInSamples; - UINT32 GlitchesSinceEngineStarted; - UINT32 ActiveSourceVoiceCount; - UINT32 TotalSourceVoiceCount; - UINT32 ActiveSubmixVoiceCount; - UINT32 ActiveResamplerCount; - UINT32 ActiveMatrixMixCount; - UINT32 ActiveXmaSourceVoices; - UINT32 ActiveXmaStreams; -} XAUDIO2_PERFORMANCE_DATA; - -typedef struct XAUDIO2_DEBUG_CONFIGURATION { - UINT32 TraceMask; - UINT32 BreakMask; - BOOL LogThreadID; - BOOL LogFileline; - BOOL LogFunctionName; - BOOL LogTiming; -} XAUDIO2_DEBUG_CONFIGURATION; - -typedef struct XAUDIO2_VOICE_DETAILS { - UINT32 CreationFlags; - UINT32 ActiveFlags; - UINT32 InputChannels; - UINT32 InputSampleRate; -} XAUDIO2_VOICE_DETAILS; - -typedef enum XAUDIO2_FILTER_TYPE { - LowPassFilter = 0, - BandPassFilter = 1, - HighPassFilter = 2, - NotchFilter = 3, - LowPassOnePoleFilter = 4, - HighPassOnePoleFilter = 5 -} XAUDIO2_FILTER_TYPE; - -typedef struct XAUDIO2_FILTER_PARAMETERS { - XAUDIO2_FILTER_TYPE Type; - float Frequency; - float OneOverQ; -} XAUDIO2_FILTER_PARAMETERS; - -typedef struct XAUDIO2_VOICE_STATE { - void *pCurrentBufferContext; - UINT32 BuffersQueued; - UINT64 SamplesPlayed; -} XAUDIO2_VOICE_STATE; - - -typedef UINT32 XAUDIO2_PROCESSOR; -#define Processor1 0x00000001 -#define XAUDIO2_DEFAULT_PROCESSOR Processor1 - -#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 -#define XAUDIO2_COMMIT_NOW 0 -#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100 -#define XAUDIO2_DEFAULT_CHANNELS 0 - -extern HRESULT __stdcall XAudio2Create( - _Out_ IXAudio2 **ppXAudio2, - _In_ UINT32 Flags, - _In_ XAUDIO2_PROCESSOR XAudio2Processor - ); - -#undef INTERFACE -#define INTERFACE IXAudio2 -typedef interface IXAudio2 { - const struct IXAudio2Vtbl FAR* lpVtbl; -} IXAudio2; -typedef const struct IXAudio2Vtbl IXAudio2Vtbl; -const struct IXAudio2Vtbl -{ - /* IUnknown */ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /* IXAudio2 */ - STDMETHOD_(HRESULT, RegisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; - STDMETHOD_(VOID, UnregisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; - STDMETHOD_(HRESULT, CreateSourceVoice)(THIS, IXAudio2SourceVoice **ppSourceVoice, - const WAVEFORMATEX *pSourceFormat, - UINT32 Flags, - float MaxFrequencyRatio, - IXAudio2VoiceCallback *pCallback, - const XAUDIO2_VOICE_SENDS *pSendList, - const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, CreateSubmixVoice)(THIS, IXAudio2SubmixVoice **ppSubmixVoice, - UINT32 InputChannels, - UINT32 InputSampleRate, - UINT32 Flags, - UINT32 ProcessingStage, - const XAUDIO2_VOICE_SENDS *pSendList, - const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, CreateMasteringVoice)(THIS, IXAudio2MasteringVoice **ppMasteringVoice, - UINT32 InputChannels, - UINT32 InputSampleRate, - UINT32 Flags, - LPCWSTR szDeviceId, - const XAUDIO2_EFFECT_CHAIN *pEffectChain, - AUDIO_STREAM_CATEGORY StreamCategory) PURE; - STDMETHOD_(HRESULT, StartEngine)(THIS) PURE; - STDMETHOD_(VOID, StopEngine)(THIS) PURE; - STDMETHOD_(HRESULT, CommitChanges)(THIS, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, GetPerformanceData)(THIS, XAUDIO2_PERFORMANCE_DATA *pPerfData) PURE; - STDMETHOD_(HRESULT, SetDebugConfiguration)(THIS, XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration, - VOID *pReserved) PURE; -}; - -#define IXAudio2_Release(A) ((A)->lpVtbl->Release(A)) -#define IXAudio2_CreateSourceVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateSourceVoice(A,B,C,D,E,F,G,H)) -#define IXAudio2_CreateMasteringVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateMasteringVoice(A,B,C,D,E,F,G,H)) -#define IXAudio2_StartEngine(A) ((A)->lpVtbl->StartEngine(A)) -#define IXAudio2_StopEngine(A) ((A)->lpVtbl->StopEngine(A)) - - -#undef INTERFACE -#define INTERFACE IXAudio2SourceVoice -typedef interface IXAudio2SourceVoice { - const struct IXAudio2SourceVoiceVtbl FAR* lpVtbl; -} IXAudio2SourceVoice; -typedef const struct IXAudio2SourceVoiceVtbl IXAudio2SourceVoiceVtbl; -const struct IXAudio2SourceVoiceVtbl -{ - /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger - * says otherwise, and that IXAudio2Voice doesn't inherit from any other - * interface! - */ - - /* IXAudio2Voice */ - STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; - STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; - STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; - STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, - const void *pParameters, - UINT32 ParametersByteSize, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, - void *pParameters, - UINT32 ParametersByteSize) PURE; - STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; - STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, - const float *pVolumes, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, - float *pVolumes) PURE; - STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - const float *pLevelMatrix, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - float *pLevelMatrix) PURE; - STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; - - /* IXAudio2SourceVoice */ - STDMETHOD_(HRESULT, Start)(THIS, UINT32 Flags, - UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, Stop)(THIS, UINT32 Flags, - UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, SubmitSourceBuffer)(THIS, const XAUDIO2_BUFFER *pBuffer, - const XAUDIO2_BUFFER_WMA *pBufferWMA) PURE; - STDMETHOD_(HRESULT, FlushSourceBuffers)(THIS) PURE; - STDMETHOD_(HRESULT, Discontinuity)(THIS) PURE; - STDMETHOD_(HRESULT, ExitLoop)(THIS, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetState)(THIS, XAUDIO2_VOICE_STATE *pVoiceState, - UINT32 Flags) PURE; - STDMETHOD_(HRESULT, SetFrequencyRatio)(THIS, float Ratio, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFrequencyRatio)(THIS, float *pRatio) PURE; - STDMETHOD_(HRESULT, SetSourceSampleRate)(THIS, UINT32 NewSourceSampleRate) PURE; -}; - -#define IXAudio2SourceVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) -#define IXAudio2SourceVoice_Start(A,B,C) ((A)->lpVtbl->Start(A,B,C)) -#define IXAudio2SourceVoice_Stop(A,B,C) ((A)->lpVtbl->Stop(A,B,C)) -#define IXAudio2SourceVoice_SubmitSourceBuffer(A,B,C) ((A)->lpVtbl->SubmitSourceBuffer(A,B,C)) -#define IXAudio2SourceVoice_FlushSourceBuffers(A) ((A)->lpVtbl->FlushSourceBuffers(A)) -#define IXAudio2SourceVoice_Discontinuity(A) ((A)->lpVtbl->Discontinuity(A)) -#define IXAudio2SourceVoice_GetState(A,B,C) ((A)->lpVtbl->GetState(A,B,C)) - - -#undef INTERFACE -#define INTERFACE IXAudio2MasteringVoice -typedef interface IXAudio2MasteringVoice { - const struct IXAudio2MasteringVoiceVtbl FAR* lpVtbl; -} IXAudio2MasteringVoice; -typedef const struct IXAudio2MasteringVoiceVtbl IXAudio2MasteringVoiceVtbl; -const struct IXAudio2MasteringVoiceVtbl -{ - /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger - * says otherwise, and that IXAudio2Voice doesn't inherit from any other - * interface! - */ - - /* IXAudio2Voice */ - STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; - STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; - STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; - STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, - const void *pParameters, - UINT32 ParametersByteSize, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, - void *pParameters, - UINT32 ParametersByteSize) PURE; - STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; - STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, - const float *pVolumes, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, - float *pVolumes) PURE; - STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - const float *pLevelMatrix, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - float *pLevelMatrix) PURE; - STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; - - /* IXAudio2SourceVoice */ - STDMETHOD_(VOID, GetChannelMask)(THIS, DWORD *pChannelMask) PURE; -}; - -#define IXAudio2MasteringVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) - - -#undef INTERFACE -#define INTERFACE IXAudio2VoiceCallback -typedef interface IXAudio2VoiceCallback { - const struct IXAudio2VoiceCallbackVtbl FAR* lpVtbl; -} IXAudio2VoiceCallback; -typedef const struct IXAudio2VoiceCallbackVtbl IXAudio2VoiceCallbackVtbl; -const struct IXAudio2VoiceCallbackVtbl -{ - /* MSDN says that IXAudio2VoiceCallback inherits from IXAudio2, but SDL's - * own code says otherwise, and that IXAudio2VoiceCallback doesn't inherit - * from any other interface! - */ - - /* IXAudio2VoiceCallback */ - STDMETHOD_(VOID, OnVoiceProcessingPassStart)(THIS, UINT32 BytesRequired) PURE; - STDMETHOD_(VOID, OnVoiceProcessingPassEnd)(THIS) PURE; - STDMETHOD_(VOID, OnStreamEnd)(THIS) PURE; - STDMETHOD_(VOID, OnBufferStart)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnBufferEnd)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnLoopEnd)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnVoiceError)(THIS, void *pBufferContext, HRESULT Error) PURE; -}; - -#pragma pack(pop) /* Undo pragma push */ - -#endif /* _SDL_XAUDIO2_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp deleted file mode 100644 index b2d67c7fb..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#include -#include "SDL_xaudio2_winrthelpers.h" - -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP -using Windows::Devices::Enumeration::DeviceClass; -using Windows::Devices::Enumeration::DeviceInformation; -using Windows::Devices::Enumeration::DeviceInformationCollection; -#endif - -extern "C" HRESULT __cdecl IXAudio2_GetDeviceCount(IXAudio2 * ixa2, UINT32 * devcount) -{ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - // There doesn't seem to be any audio device enumeration on Windows Phone. - // In lieu of this, just treat things as if there is one and only one - // audio device. - *devcount = 1; - return S_OK; -#else - // TODO, WinRT: make xaudio2 device enumeration only happen once, and in the background - auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); - while (operation->Status != Windows::Foundation::AsyncStatus::Completed) - { - } - - DeviceInformationCollection^ devices = operation->GetResults(); - *devcount = devices->Size; - return S_OK; -#endif -} - -extern "C" HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details) -{ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - // Windows Phone doesn't seem to have the same device enumeration APIs that - // Windows 8/RT has, or it doesn't have them at all. In lieu of this, - // just treat things as if there is one, and only one, default device. - if (index != 0) - { - return XAUDIO2_E_INVALID_CALL; - } - - if (details) - { - wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), L"default", _TRUNCATE); - wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), L"default", _TRUNCATE); - } - return S_OK; -#else - auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); - while (operation->Status != Windows::Foundation::AsyncStatus::Completed) - { - } - - DeviceInformationCollection^ devices = operation->GetResults(); - if (index >= devices->Size) - { - return XAUDIO2_E_INVALID_CALL; - } - - DeviceInformation^ d = devices->GetAt(index); - if (details) - { - wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), d->Id->Data(), _TRUNCATE); - wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), d->Name->Data(), _TRUNCATE); - } - return S_OK; -#endif -} diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h deleted file mode 100644 index aa6486f91..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -// -// Re-implementation of methods removed from XAudio2 (in WinRT): -// - -typedef struct XAUDIO2_DEVICE_DETAILS -{ - WCHAR DeviceID[256]; - WCHAR DisplayName[256]; - /* Other fields exist in the pre-Windows 8 version of this struct, however - they weren't used by SDL, so they weren't added. - */ -} XAUDIO2_DEVICE_DETAILS; - - -#ifdef __cplusplus -extern "C" { -#endif - -HRESULT IXAudio2_GetDeviceCount(IXAudio2 * unused, UINT32 * devcount); -HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details); - -#ifdef __cplusplus -} -#endif - - -// -// C-style macros to call XAudio2's methods in C++: -// -#ifdef __cplusplus -/* -#define IXAudio2_CreateMasteringVoice(A, B, C, D, E, F, G) (A)->CreateMasteringVoice((B), (C), (D), (E), (F), (G)) -#define IXAudio2_CreateSourceVoice(A, B, C, D, E, F, G, H) (A)->CreateSourceVoice((B), (C), (D), (E), (F), (G), (H)) -#define IXAudio2_QueryInterface(A, B, C) (A)->QueryInterface((B), (C)) -#define IXAudio2_Release(A) (A)->Release() -#define IXAudio2_StartEngine(A) (A)->StartEngine() -#define IXAudio2_StopEngine(A) (A)->StopEngine() - -#define IXAudio2MasteringVoice_DestroyVoice(A) (A)->DestroyVoice() - -#define IXAudio2SourceVoice_DestroyVoice(A) (A)->DestroyVoice() -#define IXAudio2SourceVoice_Discontinuity(A) (A)->Discontinuity() -#define IXAudio2SourceVoice_FlushSourceBuffers(A) (A)->FlushSourceBuffers() -#define IXAudio2SourceVoice_GetState(A, B) (A)->GetState((B)) -#define IXAudio2SourceVoice_Start(A, B, C) (A)->Start((B), (C)) -#define IXAudio2SourceVoice_Stop(A, B, C) (A)->Stop((B), (C)) -#define IXAudio2SourceVoice_SubmitSourceBuffer(A, B, C) (A)->SubmitSourceBuffer((B), (C)) -*/ -#endif // ifdef __cplusplus diff --git a/Engine/lib/sdl/src/core/android/SDL_android.c b/Engine/lib/sdl/src/core/android/SDL_android.c index b93b16255..c40c6764f 100644 --- a/Engine/lib/sdl/src/core/android/SDL_android.c +++ b/Engine/lib/sdl/src/core/android/SDL_android.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,12 +23,14 @@ #include "SDL_assert.h" #include "SDL_hints.h" #include "SDL_log.h" +#include "SDL_main.h" #ifdef __ANDROID__ #include "SDL_system.h" #include "SDL_android.h" -#include + +#include "keyinfotable.h" #include "../../events/SDL_events_c.h" #include "../../video/android/SDL_androidkeyboard.h" @@ -37,17 +39,153 @@ #include "../../video/android/SDL_androidvideo.h" #include "../../video/android/SDL_androidwindow.h" #include "../../joystick/android/SDL_sysjoystick_c.h" +#include "../../haptic/android/SDL_syshaptic_c.h" #include #include #include #include -#define LOG_TAG "SDL_android" +#include +/* #define LOG_TAG "SDL_android" */ /* #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) */ /* #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) */ #define LOGI(...) do {} while (0) #define LOGE(...) do {} while (0) + +#define SDL_JAVA_PREFIX org_libsdl_app +#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) +#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function +#define SDL_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLActivity, function) +#define SDL_JAVA_AUDIO_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLAudioManager, function) +#define SDL_JAVA_CONTROLLER_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLControllerManager, function) +#define SDL_JAVA_INTERFACE_INPUT_CONNECTION(function) CONCAT1(SDL_JAVA_PREFIX, SDLInputConnection, function) + + +/* Java class SDLActivity */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( + JNIEnv* mEnv, jclass cls); + +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( + JNIEnv* env, jclass cls, + jstring library, jstring function, jobject array); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( + JNIEnv* env, jclass jcls, + jstring filename); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( + JNIEnv* env, jclass jcls, + jint width, jint height, jint format, jfloat rate); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( + JNIEnv* env, jclass jcls, + jint touch_device_id_in, jint pointer_finger_id_in, + jint action, jfloat x, jfloat y, jfloat p); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( + JNIEnv* env, jclass jcls, + jint button, jint action, jfloat x, jfloat y); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( + JNIEnv* env, jclass jcls, + jfloat x, jfloat y, jfloat z); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( + JNIEnv* env, jclass cls); + +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( + JNIEnv* env, jclass cls, + jstring name, jstring value); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeEnvironmentVariablesSet)( + JNIEnv* env, jclass cls); + +/* Java class SDLInputConnection */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + +/* Java class SDLAudioManager */ +JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)( + JNIEnv *env, jclass jcls); + +/* Java class SDLControllerManager */ +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)( + JNIEnv *env, jclass jcls); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( + JNIEnv* env, jclass jcls, + jint device_id, jint axis, jfloat value); + +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( + JNIEnv* env, jclass jcls, + jint device_id, jint hat_id, jint x, jint y); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jstring device_desc, jint is_accelerometer, + jint nbuttons, jint naxes, jint nhats, jint nballs); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( + JNIEnv* env, jclass jcls, + jint device_id); + + + /* Uncomment this to log messages entering and exiting methods in this file */ /* #define DEBUG_JNI */ @@ -57,7 +195,6 @@ static void Android_JNI_ThreadDestroyed(void*); This file links the Java side of Android with libsdl *******************************************************************************/ #include -#include /******************************************************************************* @@ -71,6 +208,26 @@ static jclass mActivityClass; /* method signatures */ static jmethodID midGetNativeSurface; +static jmethodID midSetActivityTitle; +static jmethodID midSetWindowStyle; +static jmethodID midSetOrientation; +static jmethodID midGetContext; +static jmethodID midIsAndroidTV; +static jmethodID midInputGetInputDeviceIds; +static jmethodID midSendMessage; +static jmethodID midShowTextInput; +static jmethodID midIsScreenKeyboardShown; +static jmethodID midClipboardSetText; +static jmethodID midClipboardGetText; +static jmethodID midClipboardHasText; +static jmethodID midOpenAPKExpansionInputStream; +static jmethodID midGetManifestEnvironmentVariables; +static jmethodID midGetDisplayDPI; + +/* audio manager */ +static jclass mAudioManagerClass; + +/* method signatures */ static jmethodID midAudioOpen; static jmethodID midAudioWriteShortBuffer; static jmethodID midAudioWriteByteBuffer; @@ -79,12 +236,24 @@ static jmethodID midCaptureOpen; static jmethodID midCaptureReadShortBuffer; static jmethodID midCaptureReadByteBuffer; static jmethodID midCaptureClose; + +/* controller manager */ +static jclass mControllerManagerClass; + +/* method signatures */ static jmethodID midPollInputDevices; +static jmethodID midPollHapticDevices; +static jmethodID midHapticRun; + +/* static fields */ +static jfieldID fidSeparateMouseAndTouch; /* Accelerometer data storage */ static float fLastAccelerometer[3]; static SDL_bool bHasNewData; +static SDL_bool bHasEnvironmentVariables = SDL_FALSE; + /******************************************************************************* Functions called by JNI *******************************************************************************/ @@ -111,10 +280,20 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) return JNI_VERSION_1_4; } -/* Called before SDL_main() to initialize JNI bindings */ -JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) +void checkJNIReady() { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init()"); + if (!mActivityClass || !mAudioManagerClass || !mControllerManagerClass) { + // We aren't fully initialized, let's just return. + return; + } + + SDL_SetMainReady(); +} + +/* Activity initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()"); Android_JNI_SetupThread(); @@ -122,38 +301,196 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) midGetNativeSurface = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getNativeSurface","()Landroid/view/Surface;"); - midAudioOpen = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioOpen", "(IZZI)I"); - midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioWriteShortBuffer", "([S)V"); - midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioWriteByteBuffer", "([B)V"); - midAudioClose = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioClose", "()V"); - midCaptureOpen = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureOpen", "(IZZI)I"); - midCaptureReadShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureReadShortBuffer", "([SZ)I"); - midCaptureReadByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureReadByteBuffer", "([BZ)I"); - midCaptureClose = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureClose", "()V"); - midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "pollInputDevices", "()V"); + midSetActivityTitle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setActivityTitle","(Ljava/lang/String;)Z"); + midSetWindowStyle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setWindowStyle","(Z)V"); + midSetOrientation = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setOrientation","(IIZLjava/lang/String;)V"); + midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "getContext","()Landroid/content/Context;"); + midIsAndroidTV = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isAndroidTV","()Z"); + midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "inputGetInputDeviceIds", "(I)[I"); + midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "sendMessage", "(II)Z"); + midShowTextInput = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "showTextInput", "(IIII)Z"); + midIsScreenKeyboardShown = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isScreenKeyboardShown","()Z"); + midClipboardSetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardSetText", "(Ljava/lang/String;)V"); + midClipboardGetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardGetText", "()Ljava/lang/String;"); + midClipboardHasText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardHasText", "()Z"); + midOpenAPKExpansionInputStream = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); - bHasNewData = SDL_FALSE; + midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "getManifestEnvironmentVariables", "()Z"); + + midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); + midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); if (!midGetNativeSurface || - !midAudioOpen || !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioClose || - !midCaptureOpen || !midCaptureReadShortBuffer || !midCaptureReadByteBuffer || !midCaptureClose || - !midPollInputDevices) { - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly"); + !midSetActivityTitle || !midSetWindowStyle || !midSetOrientation || !midGetContext || !midIsAndroidTV || !midInputGetInputDeviceIds || + !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown || + !midClipboardSetText || !midClipboardGetText || !midClipboardHasText || + !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables|| !midGetDisplayDPI) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?"); } - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!"); + + fidSeparateMouseAndTouch = (*mEnv)->GetStaticFieldID(mEnv, mActivityClass, "mSeparateMouseAndTouch", "Z"); + + if (!fidSeparateMouseAndTouch) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java static fields, do you have the latest version of SDLActivity.java?"); + } + + checkJNIReady(); +} + +/* Audio initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "AUDIO nativeSetupJNI()"); + + Android_JNI_SetupThread(); + + mAudioManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); + + midAudioOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioOpen", "(IZZI)I"); + midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioWriteShortBuffer", "([S)V"); + midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioWriteByteBuffer", "([B)V"); + midAudioClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioClose", "()V"); + midCaptureOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureOpen", "(IZZI)I"); + midCaptureReadShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureReadShortBuffer", "([SZ)I"); + midCaptureReadByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureReadByteBuffer", "([BZ)I"); + midCaptureClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureClose", "()V"); + + if (!midAudioOpen || !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioClose || + !midCaptureOpen || !midCaptureReadShortBuffer || !midCaptureReadByteBuffer || !midCaptureClose) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?"); + } + + checkJNIReady(); +} + +/* Controller initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "CONTROLLER nativeSetupJNI()"); + + Android_JNI_SetupThread(); + + mControllerManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); + + midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "pollInputDevices", "()V"); + midPollHapticDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "pollHapticDevices", "()V"); + midHapticRun = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "hapticRun", "(II)V"); + + if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?"); + } + + checkJNIReady(); +} + +/* SDL main function prototype */ +typedef int (*SDL_main_func)(int argc, char *argv[]); + +/* Start up the SDL app */ +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, jstring library, jstring function, jobject array) +{ + int status = -1; + const char *library_file; + void *library_handle; + + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeRunMain()"); + + library_file = (*env)->GetStringUTFChars(env, library, NULL); + library_handle = dlopen(library_file, RTLD_GLOBAL); + if (library_handle) { + const char *function_name; + SDL_main_func SDL_main; + + function_name = (*env)->GetStringUTFChars(env, function, NULL); + SDL_main = (SDL_main_func)dlsym(library_handle, function_name); + if (SDL_main) { + int i; + int argc; + int len; + char **argv; + + /* Prepare the arguments. */ + len = (*env)->GetArrayLength(env, array); + argv = SDL_stack_alloc(char*, 1 + len + 1); + argc = 0; + /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. + https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start + */ + argv[argc++] = SDL_strdup("app_process"); + for (i = 0; i < len; ++i) { + const char* utf; + char* arg = NULL; + jstring string = (*env)->GetObjectArrayElement(env, array, i); + if (string) { + utf = (*env)->GetStringUTFChars(env, string, 0); + if (utf) { + arg = SDL_strdup(utf); + (*env)->ReleaseStringUTFChars(env, string, utf); + } + (*env)->DeleteLocalRef(env, string); + } + if (!arg) { + arg = SDL_strdup(""); + } + argv[argc++] = arg; + } + argv[argc] = NULL; + + + /* Run the application. */ + status = SDL_main(argc, argv); + + /* Release the arguments. */ + for (i = 0; i < argc; ++i) { + SDL_free(argv[i]); + } + SDL_stack_free(argv); + + } else { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't find function %s in library %s", function_name, library_file); + } + (*env)->ReleaseStringUTFChars(env, function, function_name); + + dlclose(library_handle); + + } else { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't load library %s", library_file); + } + (*env)->ReleaseStringUTFChars(env, library, library_file); + + /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ + /* exit(status); */ + + return status; } /* Drop file */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeDropFile( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( JNIEnv* env, jclass jcls, jstring filename) { @@ -164,7 +501,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeDropFile( } /* Resize */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEnv* env, jclass jcls, jint width, jint height, jint format, jfloat rate) { @@ -172,7 +509,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( } /* Paddown */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( JNIEnv* env, jclass jcls, jint device_id, jint keycode) { @@ -180,15 +517,15 @@ JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( } /* Padup */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp( - JNIEnv* env, jclass jcls, - jint device_id, jint keycode) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode) { return Android_OnPadUp(device_id, keycode); } /* Joy */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( JNIEnv* env, jclass jcls, jint device_id, jint axis, jfloat value) { @@ -196,7 +533,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( } /* POV Hat */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( JNIEnv* env, jclass jcls, jint device_id, jint hat_id, jint x, jint y) { @@ -204,30 +541,52 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick( - JNIEnv* env, jclass jcls, - jint device_id, jstring device_name, jint is_accelerometer, - jint nbuttons, jint naxes, jint nhats, jint nballs) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jstring device_desc, jint is_accelerometer, + jint nbuttons, jint naxes, jint nhats, jint nballs) { int retval; const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); + const char *desc = (*env)->GetStringUTFChars(env, device_desc, NULL); - retval = Android_AddJoystick(device_id, name, (SDL_bool) is_accelerometer, nbuttons, naxes, nhats, nballs); + retval = Android_AddJoystick(device_id, name, desc, (SDL_bool) is_accelerometer, nbuttons, naxes, nhats, nballs); (*env)->ReleaseStringUTFChars(env, device_name, name); - + (*env)->ReleaseStringUTFChars(env, device_desc, desc); + return retval; } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick( - JNIEnv* env, jclass jcls, jint device_id) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id) { return Android_RemoveJoystick(device_id); } +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( + JNIEnv* env, jclass jcls, jint device_id, jstring device_name) +{ + int retval; + const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); + + retval = Android_AddHaptic(device_id, name); + + (*env)->ReleaseStringUTFChars(env, device_name, name); + + return retval; +} + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( + JNIEnv* env, jclass jcls, jint device_id) +{ + return Android_RemoveHaptic(device_id); +} + /* Surface Created */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv* env, jclass jcls) { SDL_WindowData *data; SDL_VideoDevice *_this; @@ -235,10 +594,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JN if (Android_Window == NULL || Android_Window->driverdata == NULL ) { return; } - + _this = SDL_GetVideoDevice(); data = (SDL_WindowData *) Android_Window->driverdata; - + /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ if (data->egl_surface == EGL_NO_SURFACE) { if(data->native_window) { @@ -247,13 +606,13 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JN data->native_window = Android_JNI_GetNativeWindow(); data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); } - + /* GL Context handling is done in the event loop because this function is run from the Java thread */ - + } /* Surface Destroyed */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv* env, jclass jcls) { /* We have to clear the current context and destroy the egl surface here * Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume @@ -261,40 +620,42 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed( */ SDL_WindowData *data; SDL_VideoDevice *_this; - + if (Android_Window == NULL || Android_Window->driverdata == NULL ) { return; } - + _this = SDL_GetVideoDevice(); data = (SDL_WindowData *) Android_Window->driverdata; - + if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_MakeCurrent(_this, NULL, NULL); SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } - + /* GL Context handling is done in the event loop because this function is run from the Java thread */ } /* Keydown */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyDown( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyDown(keycode); } /* Keyup */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyUp( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyUp(keycode); } /* Keyboard Focus Lost */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( JNIEnv* env, jclass jcls) { /* Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget */ @@ -303,7 +664,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost /* Touch */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( JNIEnv* env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p) @@ -312,7 +673,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( } /* Mouse */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeMouse( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( JNIEnv* env, jclass jcls, jint button, jint action, jfloat x, jfloat y) { @@ -320,7 +681,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeMouse( } /* Accelerometer */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( JNIEnv* env, jclass jcls, jfloat x, jfloat y, jfloat z) { @@ -330,15 +691,22 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( bHasNewData = SDL_TRUE; } +/* Clipboard */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( + JNIEnv* env, jclass jcls) +{ + SDL_SendClipboardUpdate(); +} + /* Low memory */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeLowMemory( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( JNIEnv* env, jclass cls) { SDL_SendAppEvent(SDL_APP_LOWMEMORY); } /* Quit */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( JNIEnv* env, jclass cls) { /* Discard previous events. The user should have handled state storage @@ -354,24 +722,25 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( } /* Pause */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativePause( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); + if (Android_Window) { SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); - - /* *After* sending the relevant events, signal the pause semaphore + + /* *After* sending the relevant events, signal the pause semaphore * so the event loop knows to pause and (optionally) block itself */ if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem); } } /* Resume */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); @@ -389,7 +758,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( } } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -400,7 +769,37 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposingText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( + JNIEnv* env, jclass cls, + jchar chUnicode) +{ + SDL_Scancode code = SDL_SCANCODE_UNKNOWN; + uint16_t mod = 0; + + // We do not care about bigger than 127. + if (chUnicode < 127) { + AndroidKeyInfo info = unicharToAndroidKeyInfoTable[chUnicode]; + code = info.code; + mod = info.mod; + } + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift down */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); + } + + /* send a keydown and keyup even for the character */ + SDL_SendKeyboardKey(SDL_PRESSED, code); + SDL_SendKeyboardKey(SDL_RELEASED, code); + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift back up */ + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); + } +} + + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -411,7 +810,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposing (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT jstring JNICALL Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* env, jclass cls, jstring name) { +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name) +{ const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); const char *hint = SDL_GetHint(utfname); @@ -421,6 +823,20 @@ JNIEXPORT jstring JNICALL Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* return result; } +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( + JNIEnv* env, jclass cls, + jstring name, jstring value) +{ + const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); + const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL); + + SDL_setenv(utfname, utfvalue, 1); + + (*env)->ReleaseStringUTFChars(env, name, utfname); + (*env)->ReleaseStringUTFChars(env, value, utfvalue); + +} + /******************************************************************************* Functions called by SDL into Java *******************************************************************************/ @@ -481,20 +897,32 @@ ANativeWindow* Android_JNI_GetNativeWindow(void) s = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetNativeSurface); anw = ANativeWindow_fromSurface(env, s); (*env)->DeleteLocalRef(env, s); - + return anw; } void Android_JNI_SetActivityTitle(const char *title) { - jmethodID mid; JNIEnv *mEnv = Android_JNI_GetEnv(); - mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,"setActivityTitle","(Ljava/lang/String;)Z"); - if (mid) { - jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title)); - (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, mid, jtitle); - (*mEnv)->DeleteLocalRef(mEnv, jtitle); - } + + jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title)); + (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetActivityTitle, jtitle); + (*mEnv)->DeleteLocalRef(mEnv, jtitle); +} + +void Android_JNI_SetWindowStyle(SDL_bool fullscreen) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0); +} + +void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + + jstring jhint = (jstring)((*mEnv)->NewStringUTF(mEnv, (hint ? hint : ""))); + (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint); + (*mEnv)->DeleteLocalRef(mEnv, jhint); } SDL_bool Android_JNI_GetAccelerometerValues(float values[3]) @@ -592,7 +1020,7 @@ int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int if (iscapture) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for capture"); captureBuffer16Bit = is16Bit; - if ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { + if ((*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { /* Error during audio initialization */ __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioRecord initialization!"); return 0; @@ -600,7 +1028,7 @@ int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int } else { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for output"); audioBuffer16Bit = is16Bit; - if ((*env)->CallStaticIntMethod(env, mActivityClass, midAudioOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { + if ((*env)->CallStaticIntMethod(env, mAudioManagerClass, midAudioOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { /* Error during audio initialization */ __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioTrack initialization!"); return 0; @@ -657,6 +1085,38 @@ int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int return audioBufferFrames; } +int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi) +{ + JNIEnv *env = Android_JNI_GetEnv(); + + jobject jDisplayObj = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetDisplayDPI); + jclass jDisplayClass = (*env)->GetObjectClass(env, jDisplayObj); + + jfieldID fidXdpi = (*env)->GetFieldID(env, jDisplayClass, "xdpi", "F"); + jfieldID fidYdpi = (*env)->GetFieldID(env, jDisplayClass, "ydpi", "F"); + jfieldID fidDdpi = (*env)->GetFieldID(env, jDisplayClass, "densityDpi", "I"); + + float nativeXdpi = (*env)->GetFloatField(env, jDisplayObj, fidXdpi); + float nativeYdpi = (*env)->GetFloatField(env, jDisplayObj, fidYdpi); + int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi); + + + (*env)->DeleteLocalRef(env, jDisplayObj); + (*env)->DeleteLocalRef(env, jDisplayClass); + + if (ddpi) { + *ddpi = (float)nativeDdpi; + } + if (xdpi) { + *xdpi = nativeXdpi; + } + if (ydpi) { + *ydpi = nativeYdpi; + } + + return 0; +} + void * Android_JNI_GetAudioBuffer(void) { return audioBufferPinned; @@ -668,10 +1128,10 @@ void Android_JNI_WriteAudioBuffer(void) if (audioBuffer16Bit) { (*mAudioEnv)->ReleaseShortArrayElements(mAudioEnv, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mActivityClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); + (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); } else { (*mAudioEnv)->ReleaseByteArrayElements(mAudioEnv, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mActivityClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); + (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); } /* JNI_COMMIT means the changes are committed to the VM but the buffer remains pinned */ @@ -685,7 +1145,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) if (captureBuffer16Bit) { SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == (buflen / 2)); - br = (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_TRUE); + br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_TRUE); if (br > 0) { jshort *ptr = (*env)->GetShortArrayElements(env, (jshortArray)captureBuffer, &isCopy); br *= 2; @@ -694,7 +1154,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) } } else { SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == buflen); - br = (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_TRUE); + br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_TRUE); if (br > 0) { jbyte *ptr = (*env)->GetByteArrayElements(env, (jbyteArray)captureBuffer, &isCopy); SDL_memcpy(buffer, ptr, br); @@ -708,7 +1168,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) void Android_JNI_FlushCapturedAudio(void) { JNIEnv *env = Android_JNI_GetEnv(); - #if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */ +#if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */ if (captureBuffer16Bit) { const jint len = (*env)->GetArrayLength(env, (jshortArray)captureBuffer); while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } @@ -716,13 +1176,13 @@ void Android_JNI_FlushCapturedAudio(void) const jint len = (*env)->GetArrayLength(env, (jbyteArray)captureBuffer); while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } } - #else +#else if (captureBuffer16Bit) { - (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE); + (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE); } else { - (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE); + (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE); } - #endif +#endif } void Android_JNI_CloseAudioDevice(const int iscapture) @@ -730,13 +1190,13 @@ void Android_JNI_CloseAudioDevice(const int iscapture) JNIEnv *env = Android_JNI_GetEnv(); if (iscapture) { - (*env)->CallStaticVoidMethod(env, mActivityClass, midCaptureClose); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midCaptureClose); if (captureBuffer) { (*env)->DeleteGlobalRef(env, captureBuffer); captureBuffer = NULL; } } else { - (*env)->CallStaticVoidMethod(env, mActivityClass, midAudioClose); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioClose); if (audioBuffer) { (*env)->DeleteGlobalRef(env, audioBuffer); audioBuffer = NULL; @@ -818,10 +1278,7 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) ctx->hidden.androidio.position = 0; /* context = SDLActivity.getContext(); */ - mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, mid); - + context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midGetContext); /* assetManager = context.getAssets(); */ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), @@ -873,13 +1330,7 @@ fallback: inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { /* Try fallback to APK expansion files */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), - "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); - if (!mid) { - SDL_SetError("No openAPKExpansionInputStream() in Java class"); - goto failure; /* Java class is missing the required method */ - } - inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString); + inputStream = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString); /* Exception is checked first because it always needs to be cleared. * If no exception occurred then the last SDL error message is kept. @@ -897,7 +1348,7 @@ fallback: * android/apis/content/ReadAsset.java imply that Android's * AssetInputStream.available() /will/ always return the total file size */ - + /* size = inputStream.available(); */ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "available", "()I"); @@ -945,7 +1396,7 @@ failure: } } - + LocalReferenceHolder_Cleanup(&refs); return result; } @@ -959,7 +1410,7 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, jstring fileNameJString; if (!LocalReferenceHolder_Init(&refs, mEnv)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return -1; } @@ -1013,7 +1464,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, mEnv = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, mEnv)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return 0; } @@ -1026,7 +1477,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, int result = (*mEnv)->CallIntMethod(mEnv, readableByteChannel, readMethod, byteBuffer); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return 0; } @@ -1038,7 +1489,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, bytesRead += result; ctx->hidden.androidio.position += result; } - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return bytesRead / size; } } @@ -1195,120 +1646,41 @@ int Android_JNI_FileClose(SDL_RWops* ctx) return Internal_Android_JNI_FileClose(ctx, SDL_TRUE); } -/* returns a new global reference which needs to be released later */ -static jobject Android_JNI_GetSystemServiceObject(const char* name) -{ - struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); - JNIEnv* env = Android_JNI_GetEnv(); - jobject retval = NULL; - jstring service; - jmethodID mid; - jobject context; - jobject manager; - - if (!LocalReferenceHolder_Init(&refs, env)) { - LocalReferenceHolder_Cleanup(&refs); - return NULL; - } - - service = (*env)->NewStringUTF(env, name); - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); - - mid = (*env)->GetMethodID(env, mActivityClass, "getSystemServiceFromUiThread", "(Ljava/lang/String;)Ljava/lang/Object;"); - manager = (*env)->CallObjectMethod(env, context, mid, service); - - (*env)->DeleteLocalRef(env, service); - - retval = manager ? (*env)->NewGlobalRef(env, manager) : NULL; - LocalReferenceHolder_Cleanup(&refs); - return retval; -} - -#define SETUP_CLIPBOARD(error) \ - struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); \ - JNIEnv* env = Android_JNI_GetEnv(); \ - jobject clipboard; \ - if (!LocalReferenceHolder_Init(&refs, env)) { \ - LocalReferenceHolder_Cleanup(&refs); \ - return error; \ - } \ - clipboard = Android_JNI_GetSystemServiceObject("clipboard"); \ - if (!clipboard) { \ - LocalReferenceHolder_Cleanup(&refs); \ - return error; \ - } - -#define CLEANUP_CLIPBOARD() \ - LocalReferenceHolder_Cleanup(&refs); - int Android_JNI_SetClipboardText(const char* text) { - /* Watch out for C89 scoping rules because of the macro */ - SETUP_CLIPBOARD(-1) - - /* Nest the following in a scope to avoid C89 declaration rules triggered by the macro */ - { - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "setText", "(Ljava/lang/CharSequence;)V"); - jstring string = (*env)->NewStringUTF(env, text); - (*env)->CallVoidMethod(env, clipboard, mid, string); - (*env)->DeleteGlobalRef(env, clipboard); - (*env)->DeleteLocalRef(env, string); - } - CLEANUP_CLIPBOARD(); - + JNIEnv* env = Android_JNI_GetEnv(); + jstring string = (*env)->NewStringUTF(env, text); + (*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string); + (*env)->DeleteLocalRef(env, string); return 0; } char* Android_JNI_GetClipboardText(void) { - /* Watch out for C89 scoping rules because of the macro */ - SETUP_CLIPBOARD(SDL_strdup("")) - - /* Nest the following in a scope to avoid C89 declaration rules triggered by the macro */ - { - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "getText", "()Ljava/lang/CharSequence;"); - jobject sequence = (*env)->CallObjectMethod(env, clipboard, mid); - (*env)->DeleteGlobalRef(env, clipboard); - if (sequence) { - jstring string; - const char* utf; - mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, sequence), "toString", "()Ljava/lang/String;"); - string = (jstring)((*env)->CallObjectMethod(env, sequence, mid)); - utf = (*env)->GetStringUTFChars(env, string, 0); - if (utf) { - char* text = SDL_strdup(utf); - (*env)->ReleaseStringUTFChars(env, string, utf); - - CLEANUP_CLIPBOARD(); - - return text; - } + JNIEnv* env = Android_JNI_GetEnv(); + char* text = NULL; + jstring string; + + string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText); + if (string) { + const char* utf = (*env)->GetStringUTFChars(env, string, 0); + if (utf) { + text = SDL_strdup(utf); + (*env)->ReleaseStringUTFChars(env, string, utf); } + (*env)->DeleteLocalRef(env, string); } - CLEANUP_CLIPBOARD(); - - return SDL_strdup(""); + + return (text == NULL) ? SDL_strdup("") : text; } SDL_bool Android_JNI_HasClipboardText(void) { - jmethodID mid; - jboolean has; - /* Watch out for C89 scoping rules because of the macro */ - SETUP_CLIPBOARD(SDL_FALSE) - - mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "hasText", "()Z"); - has = (*env)->CallBooleanMethod(env, clipboard, mid); - (*env)->DeleteGlobalRef(env, clipboard); - - CLEANUP_CLIPBOARD(); - - return has ? SDL_TRUE : SDL_FALSE; + JNIEnv* env = Android_JNI_GetEnv(); + jboolean retval = (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText); + return (retval == JNI_TRUE) ? SDL_TRUE : SDL_FALSE; } - /* returns 0 on success or -1 on error (others undefined then) * returns truthy or falsy value in plugged, charged and battery * returns the value in seconds and percent or -1 if not available @@ -1333,8 +1705,8 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco } - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + /* context = SDLActivity.getContext(); */ + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); @@ -1405,7 +1777,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco if (percent) { int level; int scale; - + /* Watch out for C89 scoping rules because of the macro */ { GET_INT_EXTRA(level_temp, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ @@ -1416,7 +1788,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco GET_INT_EXTRA(scale_temp, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ scale = scale_temp; } - + if ((level == -1) || (scale == -1)) { LocalReferenceHolder_Cleanup(&refs); return -1; @@ -1434,8 +1806,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco int Android_JNI_GetTouchDeviceIds(int **ids) { JNIEnv *env = Android_JNI_GetEnv(); jint sources = 4098; /* == InputDevice.SOURCE_TOUCHSCREEN */ - jmethodID mid = (*env)->GetStaticMethodID(env, mActivityClass, "inputGetInputDeviceIds", "(I)[I"); - jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, mid, sources); + jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, midInputGetInputDeviceIds, sources); int number = 0; *ids = NULL; if (array) { @@ -1456,12 +1827,32 @@ int Android_JNI_GetTouchDeviceIds(int **ids) { return number; } +/* sets the mSeparateMouseAndTouch field */ +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->SetStaticBooleanField(env, mActivityClass, fidSeparateMouseAndTouch, new_value ? JNI_TRUE : JNI_FALSE); +} + void Android_JNI_PollInputDevices(void) { JNIEnv *env = Android_JNI_GetEnv(); - (*env)->CallStaticVoidMethod(env, mActivityClass, midPollInputDevices); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollInputDevices); } +void Android_JNI_PollHapticDevices(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollHapticDevices); +} + +void Android_JNI_HapticRun(int device_id, int length) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, length); +} + + /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 @@ -1469,16 +1860,8 @@ void Android_JNI_PollInputDevices(void) int Android_JNI_SendMessage(int command, int param) { JNIEnv *env = Android_JNI_GetEnv(); - jmethodID mid; jboolean success; - if (!env) { - return -1; - } - mid = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); - if (!mid) { - return -1; - } - success = (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, command, param); + success = (*env)->CallStaticBooleanMethod(env, mActivityClass, midSendMessage, command, param); return success ? 0 : -1; } @@ -1490,16 +1873,7 @@ void Android_JNI_SuspendScreenSaver(SDL_bool suspend) void Android_JNI_ShowTextInput(SDL_Rect *inputRect) { JNIEnv *env = Android_JNI_GetEnv(); - jmethodID mid; - if (!env) { - return; - } - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); - if (!mid) { - return; - } - (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, + (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput, inputRect->x, inputRect->y, inputRect->w, @@ -1513,6 +1887,15 @@ void Android_JNI_HideTextInput(void) Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0); } +SDL_bool Android_JNI_IsScreenKeyboardShown() +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + jboolean is_shown = 0; + is_shown = (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midIsScreenKeyboardShown); + return is_shown; +} + + int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { JNIEnv *env; @@ -1567,11 +1950,8 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu (*env)->DeleteLocalRef(env, clazz); - /* call function */ - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext","()Landroid/content/Context;"); - - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + /* context = SDLActivity.getContext(); */ + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); clazz = (*env)->GetObjectClass(env, context); @@ -1608,31 +1988,31 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu ////////////////////////////////////////////////////////////////////////////// */ -void *SDL_AndroidGetJNIEnv() +void *SDL_AndroidGetJNIEnv(void) { return Android_JNI_GetEnv(); } - - -void *SDL_AndroidGetActivity() +void *SDL_AndroidGetActivity(void) { /* See SDL_system.h for caveats on using this function. */ - jmethodID mid; - JNIEnv *env = Android_JNI_GetEnv(); if (!env) { return NULL; } /* return SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - return (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); } -const char * SDL_AndroidGetInternalStoragePath() +SDL_bool SDL_IsAndroidTV(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV); +} + +const char * SDL_AndroidGetInternalStoragePath(void) { static char *s_AndroidInternalFilesPath = NULL; @@ -1651,9 +2031,12 @@ const char * SDL_AndroidGetInternalStoragePath() } /* context = SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); + if (!context) { + SDL_SetError("Couldn't get Android context!"); + LocalReferenceHolder_Cleanup(&refs); + return NULL; + } /* fileObj = context.getFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), @@ -1665,10 +2048,14 @@ const char * SDL_AndroidGetInternalStoragePath() return NULL; } - /* path = fileObject.getAbsolutePath(); */ + /* path = fileObject.getCanonicalPath(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), - "getAbsolutePath", "()Ljava/lang/String;"); + "getCanonicalPath", "()Ljava/lang/String;"); pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); + if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { + LocalReferenceHolder_Cleanup(&refs); + return NULL; + } path = (*env)->GetStringUTFChars(env, pathString, NULL); s_AndroidInternalFilesPath = SDL_strdup(path); @@ -1679,7 +2066,7 @@ const char * SDL_AndroidGetInternalStoragePath() return s_AndroidInternalFilesPath; } -int SDL_AndroidGetExternalStorageState() +int SDL_AndroidGetExternalStorageState(void) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; @@ -1718,7 +2105,7 @@ int SDL_AndroidGetExternalStorageState() return stateFlags; } -const char * SDL_AndroidGetExternalStoragePath() +const char * SDL_AndroidGetExternalStoragePath(void) { static char *s_AndroidExternalFilesPath = NULL; @@ -1737,9 +2124,7 @@ const char * SDL_AndroidGetExternalStoragePath() } /* context = SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); /* fileObj = context.getExternalFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), @@ -1765,12 +2150,22 @@ const char * SDL_AndroidGetExternalStoragePath() return s_AndroidExternalFilesPath; } -jclass Android_JNI_GetActivityClass(void) +void Android_JNI_GetManifestEnvironmentVariables(void) { - return mActivityClass; + if (!mActivityClass || !midGetManifestEnvironmentVariables) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Request to get environment variables before JNI is ready"); + return; + } + + if (!bHasEnvironmentVariables) { + JNIEnv *env = Android_JNI_GetEnv(); + SDL_bool ret = (*env)->CallStaticBooleanMethod(env, mActivityClass, midGetManifestEnvironmentVariables); + if (ret) { + bHasEnvironmentVariables = SDL_TRUE; + } + } } #endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/Engine/lib/sdl/src/core/android/SDL_android.h b/Engine/lib/sdl/src/core/android/SDL_android.h index cb7ff0736..c800dc651 100644 --- a/Engine/lib/sdl/src/core/android/SDL_android.h +++ b/Engine/lib/sdl/src/core/android/SDL_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,11 +34,17 @@ extern "C" { /* Interface from the SDL library into the Android Java activity */ extern void Android_JNI_SetActivityTitle(const char *title); +extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen); +extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint); + extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect); extern void Android_JNI_HideTextInput(void); +extern SDL_bool Android_JNI_IsScreenKeyboardShown(void); extern ANativeWindow* Android_JNI_GetNativeWindow(void); +extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi); + /* Audio support */ extern int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames); extern void* Android_JNI_GetAudioBuffer(void); @@ -56,6 +62,9 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t ma size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num); int Android_JNI_FileClose(SDL_RWops* ctx); +/* Environment support */ +void Android_JNI_GetManifestEnvironmentVariables(void); + /* Clipboard support */ int Android_JNI_SetClipboardText(const char* text); char* Android_JNI_GetClipboardText(void); @@ -67,21 +76,32 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco /* Joystick support */ void Android_JNI_PollInputDevices(void); +/* Haptic support */ +void Android_JNI_PollHapticDevices(void); +void Android_JNI_HapticRun(int device_id, int length); + /* Video */ void Android_JNI_SuspendScreenSaver(SDL_bool suspend); /* Touch support */ int Android_JNI_GetTouchDeviceIds(int **ids); +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value); /* Threads */ #include JNIEnv *Android_JNI_GetEnv(void); int Android_JNI_SetupThread(void); -jclass Android_JNI_GetActivityClass(void); /* Generic messages */ int Android_JNI_SendMessage(int command, int param); +/* Init */ +JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls); + +/* MessageBox */ +#include "SDL_messagebox.h" +int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/Engine/lib/sdl/src/core/android/keyinfotable.h b/Engine/lib/sdl/src/core/android/keyinfotable.h new file mode 100644 index 000000000..4437121e8 --- /dev/null +++ b/Engine/lib/sdl/src/core/android/keyinfotable.h @@ -0,0 +1,175 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _ANDROID_KeyInfo +#define _ANDROID_KeyInfo + +#include "SDL_scancode.h" +#include "SDL_keycode.h" + +/* + This file is used by the keyboard code in SDL_uikitview.m to convert between characters + passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods. + For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower + case a. +*/ + +typedef struct +{ + SDL_Scancode code; + uint16_t mod; +} AndroidKeyInfo; + +/* So far only ASCII characters here */ +static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = { +/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 13 */ { SDL_SCANCODE_RETURN, 0 }, +/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 32 */ { SDL_SCANCODE_SPACE, 0 }, +/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */ +/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */ +/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */ +/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */ +/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */ +/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */ +/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */ +/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */ +/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */ +/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */ +/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */ +/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */ +/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ +/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ +/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ +/* 48 */ { SDL_SCANCODE_0, 0 }, +/* 49 */ { SDL_SCANCODE_1, 0 }, +/* 50 */ { SDL_SCANCODE_2, 0 }, +/* 51 */ { SDL_SCANCODE_3, 0 }, +/* 52 */ { SDL_SCANCODE_4, 0 }, +/* 53 */ { SDL_SCANCODE_5, 0 }, +/* 54 */ { SDL_SCANCODE_6, 0 }, +/* 55 */ { SDL_SCANCODE_7, 0 }, +/* 56 */ { SDL_SCANCODE_8, 0 }, +/* 57 */ { SDL_SCANCODE_9, 0 }, +/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */ +/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 }, +/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */ +/* 61 */ { SDL_SCANCODE_EQUALS, 0 }, +/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */ +/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */ +/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */ +/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */ +/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT }, +/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT }, +/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT }, +/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT }, +/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT }, +/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT }, +/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT }, +/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT }, +/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT }, +/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT }, +/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT }, +/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT }, +/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT }, +/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT }, +/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT }, +/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT }, +/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT }, +/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT }, +/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT }, +/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT }, +/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT }, +/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT }, +/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT }, +/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT }, +/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT }, +/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 }, +/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 }, +/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 }, +/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ +/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ +/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ +/* 97 */ { SDL_SCANCODE_A, 0 }, +/* 98 */ { SDL_SCANCODE_B, 0 }, +/* 99 */ { SDL_SCANCODE_C, 0 }, +/* 100 */{ SDL_SCANCODE_D, 0 }, +/* 101 */{ SDL_SCANCODE_E, 0 }, +/* 102 */{ SDL_SCANCODE_F, 0 }, +/* 103 */{ SDL_SCANCODE_G, 0 }, +/* 104 */{ SDL_SCANCODE_H, 0 }, +/* 105 */{ SDL_SCANCODE_I, 0 }, +/* 106 */{ SDL_SCANCODE_J, 0 }, +/* 107 */{ SDL_SCANCODE_K, 0 }, +/* 108 */{ SDL_SCANCODE_L, 0 }, +/* 109 */{ SDL_SCANCODE_M, 0 }, +/* 110 */{ SDL_SCANCODE_N, 0 }, +/* 111 */{ SDL_SCANCODE_O, 0 }, +/* 112 */{ SDL_SCANCODE_P, 0 }, +/* 113 */{ SDL_SCANCODE_Q, 0 }, +/* 114 */{ SDL_SCANCODE_R, 0 }, +/* 115 */{ SDL_SCANCODE_S, 0 }, +/* 116 */{ SDL_SCANCODE_T, 0 }, +/* 117 */{ SDL_SCANCODE_U, 0 }, +/* 118 */{ SDL_SCANCODE_V, 0 }, +/* 119 */{ SDL_SCANCODE_W, 0 }, +/* 120 */{ SDL_SCANCODE_X, 0 }, +/* 121 */{ SDL_SCANCODE_Y, 0 }, +/* 122 */{ SDL_SCANCODE_Z, 0 }, +/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */ +/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */ +/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */ +/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */ +/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT } +}; + +#endif /* _ANDROID_KeyInfo */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_dbus.c b/Engine/lib/sdl/src/core/linux/SDL_dbus.c index ab73ca17c..ff4f0fe67 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_dbus.c +++ b/Engine/lib/sdl/src/core/linux/SDL_dbus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,7 +56,9 @@ LoadDBUSSyms(void) SDL_DBUS_SYM(message_is_signal); SDL_DBUS_SYM(message_new_method_call); SDL_DBUS_SYM(message_append_args); + SDL_DBUS_SYM(message_append_args_valist); SDL_DBUS_SYM(message_get_args); + SDL_DBUS_SYM(message_get_args_valist); SDL_DBUS_SYM(message_iter_init); SDL_DBUS_SYM(message_iter_next); SDL_DBUS_SYM(message_iter_get_basic); @@ -68,6 +70,7 @@ LoadDBUSSyms(void) SDL_DBUS_SYM(error_free); SDL_DBUS_SYM(get_local_machine_id); SDL_DBUS_SYM(free); + SDL_DBUS_SYM(free_string_array); SDL_DBUS_SYM(shutdown); #undef SDL_DBUS_SYM @@ -112,14 +115,15 @@ SDL_DBus_Init(void) DBusError err; dbus.error_init(&err); dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); + if (!dbus.error_is_set(&err)) { + dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); + } if (dbus.error_is_set(&err)) { dbus.error_free(&err); - if (dbus.session_conn) { - dbus.connection_unref(dbus.session_conn); - dbus.session_conn = NULL; - } + SDL_DBus_Quit(); return; /* oh well */ } + dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); } } @@ -127,12 +131,23 @@ SDL_DBus_Init(void) void SDL_DBus_Quit(void) { + if (dbus.system_conn) { + dbus.connection_close(dbus.system_conn); + dbus.connection_unref(dbus.system_conn); + } if (dbus.session_conn) { dbus.connection_close(dbus.session_conn); dbus.connection_unref(dbus.session_conn); - dbus.shutdown(); - SDL_memset(&dbus, 0, sizeof(dbus)); } +/* Don't do this - bug 3950 + dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it. +*/ +#if 0 + if (dbus.shutdown) { + dbus.shutdown(); + } +#endif + SDL_zero(dbus); UnloadDBUSLibrary(); } @@ -150,90 +165,171 @@ SDL_DBus_GetContext(void) } } -void -SDL_DBus_ScreensaverTickle(void) +static SDL_bool +SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) { - DBusConnection *conn = dbus.session_conn; - if (conn != NULL) { - DBusMessage *msg = dbus.message_new_method_call("org.gnome.ScreenSaver", - "/org/gnome/ScreenSaver", - "org.gnome.ScreenSaver", - "SimulateUserActivity"); - if (msg != NULL) { - if (dbus.connection_send(conn, msg, NULL)) { - dbus.connection_flush(conn); + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); + if (msg) { + int firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { + DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); + if (reply) { + firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_get_args_valist(reply, NULL, firstarg, ap)) { + retval = SDL_TRUE; + } + dbus.message_unref(reply); + } } dbus.message_unref(msg); } } + + return retval; +} + +SDL_bool +SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallMethodInternal(conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallMethodInternal(dbus.session_conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +static SDL_bool +SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) +{ + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); + if (msg) { + int firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { + if (dbus.connection_send(conn, msg, NULL)) { + dbus.connection_flush(conn); + retval = SDL_TRUE; + } + } + + dbus.message_unref(msg); + } + } + + return retval; +} + +SDL_bool +SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallVoidMethodInternal(conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallVoidMethodInternal(dbus.session_conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) +{ + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, "org.freedesktop.DBus.Properties", "Get"); + if (msg) { + if (dbus.message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID)) { + DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); + if (reply) { + DBusMessageIter iter, sub; + dbus.message_iter_init(reply, &iter); + if (dbus.message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) { + dbus.message_iter_recurse(&iter, &sub); + if (dbus.message_iter_get_arg_type(&sub) == expectedtype) { + dbus.message_iter_get_basic(&sub, result); + retval = SDL_TRUE; + } + } + dbus.message_unref(reply); + } + } + dbus.message_unref(msg); + } + } + + return retval; +} + +SDL_bool +SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) +{ + return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result); +} + + +void +SDL_DBus_ScreensaverTickle(void) +{ + SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); } SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) { - DBusConnection *conn = dbus.session_conn; - - if (conn == NULL) - return SDL_FALSE; - - if (inhibit && - screensaver_cookie != 0) - return SDL_TRUE; - if (!inhibit && - screensaver_cookie == 0) - return SDL_TRUE; - - if (inhibit) { - const char *app = "My SDL application"; - const char *reason = "Playing a game"; - - DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.ScreenSaver", - "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver", - "Inhibit"); - if (msg != NULL) { - dbus.message_append_args (msg, - DBUS_TYPE_STRING, &app, - DBUS_TYPE_STRING, &reason, - DBUS_TYPE_INVALID); - } - - if (msg != NULL) { - DBusMessage *reply; - - reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); - if (reply) { - if (!dbus.message_get_args(reply, NULL, - DBUS_TYPE_UINT32, &screensaver_cookie, - DBUS_TYPE_INVALID)) - screensaver_cookie = 0; - dbus.message_unref(reply); - } - - dbus.message_unref(msg); - } - - if (screensaver_cookie == 0) { - return SDL_FALSE; - } + if ( (inhibit && (screensaver_cookie != 0)) || (!inhibit && (screensaver_cookie == 0)) ) { return SDL_TRUE; } else { - DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.ScreenSaver", - "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver", - "UnInhibit"); - dbus.message_append_args (msg, - DBUS_TYPE_UINT32, &screensaver_cookie, - DBUS_TYPE_INVALID); - if (msg != NULL) { - if (dbus.connection_send(conn, msg, NULL)) { - dbus.connection_flush(conn); - } - dbus.message_unref(msg); - } + const char *node = "org.freedesktop.ScreenSaver"; + const char *path = "/org/freedesktop/ScreenSaver"; + const char *interface = "org.freedesktop.ScreenSaver"; - screensaver_cookie = 0; - return SDL_TRUE; + if (inhibit) { + const char *app = "My SDL application"; + const char *reason = "Playing a game"; + if (!SDL_DBus_CallMethod(node, path, interface, "Inhibit", + DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID, + DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { + return SDL_FALSE; + } + return (screensaver_cookie != 0) ? SDL_TRUE : SDL_FALSE; + } else { + if (!SDL_DBus_CallVoidMethod(node, path, interface, "UnInhibit", DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { + return SDL_FALSE; + } + screensaver_cookie = 0; + } } + + return SDL_TRUE; } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_dbus.h b/Engine/lib/sdl/src/core/linux/SDL_dbus.h index c064381a0..062543d46 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_dbus.h +++ b/Engine/lib/sdl/src/core/linux/SDL_dbus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_dbus_h -#define _SDL_dbus_h +#ifndef SDL_dbus_h_ +#define SDL_dbus_h_ #ifdef HAVE_DBUS_DBUS_H #define SDL_USE_LIBDBUS 1 @@ -32,6 +32,7 @@ typedef struct SDL_DBusContext { DBusConnection *session_conn; + DBusConnection *system_conn; DBusConnection *(*bus_get_private)(DBusBusType, DBusError *); dbus_bool_t (*bus_register)(DBusConnection *, DBusError *); @@ -53,7 +54,9 @@ typedef struct SDL_DBusContext { dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *); dbus_bool_t (*message_append_args)(DBusMessage *, int, ...); + dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list); dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...); + dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list); dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *); dbus_bool_t (*message_iter_next)(DBusMessageIter *); void (*message_iter_get_basic)(DBusMessageIter *, void *); @@ -65,6 +68,7 @@ typedef struct SDL_DBusContext { void (*error_free)(DBusError *); char *(*get_local_machine_id)(void); void (*free)(void *); + void (*free_string_array)(char **); void (*shutdown)(void); } SDL_DBusContext; @@ -72,11 +76,22 @@ typedef struct SDL_DBusContext { extern void SDL_DBus_Init(void); extern void SDL_DBus_Quit(void); extern SDL_DBusContext * SDL_DBus_GetContext(void); + +/* These use the built-in Session connection. */ +extern SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); + +/* These use whatever connection you like. */ +extern SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); + extern void SDL_DBus_ScreensaverTickle(void); extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit); #endif /* HAVE_DBUS_DBUS_H */ -#endif /* _SDL_dbus_h */ +#endif /* SDL_dbus_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev.c b/Engine/lib/sdl/src/core/linux/SDL_evdev.c index 4761f3e46..a50692617 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_evdev.c +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,51 +30,51 @@ */ #include "SDL_evdev.h" +#include "SDL_evdev_kbd.h" #include #include #include #include -#include /* For the definition of PATH_MAX */ #include -#ifdef SDL_INPUT_LINUXKD -#include -#include -#include -#include /* for TIOCL_GETSHIFTSTATE */ -#endif #include "SDL.h" #include "SDL_assert.h" #include "SDL_endian.h" -#include "../../core/linux/SDL_udev.h" #include "SDL_scancode.h" #include "../../events/SDL_events_c.h" #include "../../events/scancodes_linux.h" /* adds linux_scancode_table */ +#include "../../core/linux/SDL_udev.h" -/* This isn't defined in older Linux kernel headers */ +/* These are not defined in older Linux kernel headers */ #ifndef SYN_DROPPED #define SYN_DROPPED 3 #endif +#ifndef ABS_MT_SLOT +#define ABS_MT_SLOT 0x2f +#define ABS_MT_POSITION_X 0x35 +#define ABS_MT_POSITION_Y 0x36 +#define ABS_MT_TRACKING_ID 0x39 +#endif typedef struct SDL_evdevlist_item { char *path; int fd; - + /* TODO: use this for every device, not just touchscreen */ int out_of_sync; - + /* TODO: expand on this to have data for every possible class (mouse, keyboard, touchpad, etc.). Also there's probably some things in here we can pull out to the SDL_evdevlist_item i.e. name */ int is_touchscreen; struct { char* name; - + int min_x, max_x, range_x; int min_y, max_y, range_y; - + int max_slots; int current_slot; struct { @@ -88,18 +88,17 @@ typedef struct SDL_evdevlist_item int x, y; } * slots; } * touchscreen_data; - + struct SDL_evdevlist_item *next; } SDL_evdevlist_item; typedef struct SDL_EVDEV_PrivateData { + int ref_count; + int num_devices; SDL_evdevlist_item *first; SDL_evdevlist_item *last; - int num_devices; - int ref_count; - int console_fd; - int kb_mode; + SDL_EVDEV_keyboard_state *kbd; } SDL_EVDEV_PrivateData; #define _THIS SDL_EVDEV_PrivateData *_this @@ -111,7 +110,7 @@ static int SDL_EVDEV_device_removed(const char *dev_path); #if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, +static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ @@ -126,93 +125,6 @@ static Uint8 EVDEV_MouseButtons[] = { SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */ }; -static const char* EVDEV_consoles[] = { - /* "/proc/self/fd/0", - "/dev/tty", - "/dev/tty0", */ /* the tty ioctl's prohibit these */ - "/dev/tty1", - "/dev/tty2", - "/dev/tty3", - "/dev/tty4", - "/dev/tty5", - "/dev/tty6", - "/dev/tty7", /* usually X is spawned in tty7 */ - "/dev/vc/0", - "/dev/console" -}; - -static int SDL_EVDEV_is_console(int fd) { - int type; - - return isatty(fd) && ioctl(fd, KDGKBTYPE, &type) == 0 && - (type == KB_101 || type == KB_84); -} - -/* Prevent keystrokes from reaching the tty */ -static int SDL_EVDEV_mute_keyboard(int tty_fd, int* old_kb_mode) -{ - if (!SDL_EVDEV_is_console(tty_fd)) { - return SDL_SetError("Tried to mute an invalid tty"); - } - - if (ioctl(tty_fd, KDGKBMODE, old_kb_mode) < 0) { - return SDL_SetError("Failed to get keyboard mode during muting"); - } - - /* FIXME: atm this absolutely ruins the vt, and KDSKBMUTE isn't implemented - in the kernel */ - /* - if (ioctl(tty_fd, KDSKBMODE, K_OFF) < 0) { - return SDL_SetError("Failed to set keyboard mode during muting"); - } - */ - - return 0; -} - -/* Restore the keyboard mode for given tty */ -static void SDL_EVDEV_unmute_keyboard(int tty_fd, int kb_mode) -{ - /* read above */ - /* - if (ioctl(tty_fd, KDSKBMODE, kb_mode) < 0) { - SDL_Log("Failed to unmute keyboard"); - } - */ -} - -static int SDL_EVDEV_get_active_tty() -{ - int i, fd, ret, tty = 0; - char tiocl; - struct vt_stat vt_state; - char path[PATH_MAX + 1]; - - for(i = 0; i < SDL_arraysize(EVDEV_consoles); i++) { - fd = open(EVDEV_consoles[i], O_RDONLY); - - if (fd < 0 && !SDL_EVDEV_is_console(fd)) - break; - - tiocl = TIOCL_GETFGCONSOLE; - if ((ret = ioctl(fd, TIOCLINUX, &tiocl)) >= 0) - tty = ret + 1; - else if (ioctl(fd, VT_GETSTATE, &vt_state) == 0) - tty = vt_state.v_active; - - close(fd); - - if (tty) { - sprintf(path, "/dev/tty%u", tty); - fd = open(path, O_RDONLY); - if (fd >= 0 && SDL_EVDEV_is_console(fd)) - return fd; - } - } - - return SDL_SetError("Failed to determine active tty"); -} - int SDL_EVDEV_Init(void) { @@ -236,24 +148,18 @@ SDL_EVDEV_Init(void) _this = NULL; return -1; } - + /* Force a scan to build the initial device list */ SDL_UDEV_Scan(); #else /* TODO: Scan the devices manually, like a caveman */ #endif /* SDL_USE_LIBUDEV */ - - /* We need a physical terminal (not PTS) to be able to translate key - code to symbols via the kernel tables */ - _this->console_fd = SDL_EVDEV_get_active_tty(); - - /* Mute the keyboard so keystrokes only generate evdev events and do not - leak through to the console */ - SDL_EVDEV_mute_keyboard(_this->console_fd, &_this->kb_mode); + + _this->kbd = SDL_EVDEV_kbd_init(); } - + _this->ref_count += 1; - + return 0; } @@ -263,42 +169,39 @@ SDL_EVDEV_Quit(void) if (_this == NULL) { return; } - + _this->ref_count -= 1; - + if (_this->ref_count < 1) { #if SDL_USE_LIBUDEV SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ - - if (_this->console_fd >= 0) { - SDL_EVDEV_unmute_keyboard(_this->console_fd, _this->kb_mode); - close(_this->console_fd); - } - + + SDL_EVDEV_kbd_quit(_this->kbd); + /* Remove existing devices */ while(_this->first != NULL) { SDL_EVDEV_device_removed(_this->first->path); } - + SDL_assert(_this->first == NULL); SDL_assert(_this->last == NULL); SDL_assert(_this->num_devices == 0); - + SDL_free(_this); _this = NULL; } } #if SDL_USE_LIBUDEV -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, +static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char* dev_path) { if (dev_path == NULL) { return; } - + switch(udev_event) { case SDL_UDEV_DEVICEADDED: if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | @@ -316,82 +219,6 @@ void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, } #endif /* SDL_USE_LIBUDEV */ -#ifdef SDL_INPUT_LINUXKD -/* this logic is pulled from kbd_keycode() in drivers/tty/vt/keyboard.c in the - Linux kernel source */ -static void SDL_EVDEV_do_text_input(unsigned short keycode) { - char shift_state; - int locks_state; - struct kbentry kbe; - unsigned char type; - char text[2] = { 0 }; - - if (_this->console_fd < 0) - return; - - shift_state = TIOCL_GETSHIFTSTATE; - if (ioctl(_this->console_fd, TIOCLINUX, &shift_state) < 0) { - /* TODO: error */ - return; - } - - kbe.kb_table = shift_state; - kbe.kb_index = keycode; - - if (ioctl(_this->console_fd, KDGKBENT, &kbe) < 0) { - /* TODO: error */ - return; - } - - type = KTYP(kbe.kb_value); - - if (type < 0xf0) { - /* - * FIXME: keysyms with a type below 0xf0 represent a unicode character - * which requires special handling due to dead characters, diacritics, - * etc. For perfect input a proper way to deal with such characters - * should be implemented. - * - * For reference, the only place I was able to find out about this - * special 0xf0 value was in an unused? couple of patches listed below. - * - * http://ftp.tc.edu.tw/pub/docs/Unicode/utf8/linux-2.3.12-keyboard.diff - * http://ftp.tc.edu.tw/pub/docs/Unicode/utf8/linux-2.3.12-console.diff - */ - - return; - } - - type -= 0xf0; - - /* if type is KT_LETTER then it can be affected by Caps Lock */ - if (type == KT_LETTER) { - type = KT_LATIN; - - if (ioctl(_this->console_fd, KDGKBLED, &locks_state) < 0) { - /* TODO: error */ - return; - } - - if (locks_state & K_CAPSLOCK) { - kbe.kb_table = shift_state ^ (1 << KG_SHIFT); - - if (ioctl(_this->console_fd, KDGKBENT, &kbe) < 0) { - /* TODO: error */ - return; - } - } - } - - /* TODO: convert values >= 0x80 from ISO-8859-1? to UTF-8 */ - if (type != KT_LATIN || KVAL(kbe.kb_value) >= 0x80) - return; - - *text = KVAL(kbe.kb_value); - SDL_SendKeyboardText(text); -} -#endif /* SDL_INPUT_LINUXKD */ - void SDL_EVDEV_Poll(void) { @@ -423,7 +250,7 @@ SDL_EVDEV_Poll(void) events[i].type == EV_SYN && events[i].code != SYN_REPORT) { break; } - + switch (events[i].type) { case EV_KEY: if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { @@ -443,11 +270,9 @@ SDL_EVDEV_Poll(void) SDL_SendKeyboardKey(SDL_RELEASED, scan_code); } else if (events[i].value == 1 || events[i].value == 2 /* key repeated */) { SDL_SendKeyboardKey(SDL_PRESSED, scan_code); -#ifdef SDL_INPUT_LINUXKD - SDL_EVDEV_do_text_input(events[i].code); -#endif /* SDL_INPUT_LINUXKD */ } } + SDL_EVDEV_kbd_keycode(_this->kbd, events[i].code, events[i].value); break; case EV_ABS: switch(events[i].code) { @@ -519,13 +344,13 @@ SDL_EVDEV_Poll(void) case SYN_REPORT: if (!item->is_touchscreen) /* FIXME: temp hack */ break; - + for(j = 0; j < item->touchscreen_data->max_slots; j++) { norm_x = (float)(item->touchscreen_data->slots[j].x - item->touchscreen_data->min_x) / (float)item->touchscreen_data->range_x; norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) / (float)item->touchscreen_data->range_y; - + switch(item->touchscreen_data->slots[j].delta) { case EVDEV_TOUCH_SLOTDELTA_DOWN: SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, 1.0f); @@ -544,7 +369,7 @@ SDL_EVDEV_Poll(void) break; } } - + if (item->out_of_sync) item->out_of_sync = 0; break; @@ -573,8 +398,8 @@ SDL_EVDEV_translate_keycode(int keycode) if (scancode == SDL_SCANCODE_UNKNOWN) { SDL_Log("The key you just pressed is not recognized by SDL. To help " - "get this fixed, please report this to the SDL mailing list " - " EVDEV KeyCode %d\n", keycode); + "get this fixed, please report this to the SDL forums/mailing list " + " EVDEV KeyCode %d", keycode); } return scancode; @@ -587,26 +412,26 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) int ret, i; char name[64]; struct input_absinfo abs_info; - + if (!item->is_touchscreen) return 0; - + item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data)); if (item->touchscreen_data == NULL) return SDL_OutOfMemory(); - + ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); if (ret < 0) { SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen name"); } - + item->touchscreen_data->name = SDL_strdup(name); if (item->touchscreen_data->name == NULL) { SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_X), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); @@ -616,7 +441,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) item->touchscreen_data->min_x = abs_info.minimum; item->touchscreen_data->max_x = abs_info.maximum; item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum; - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_Y), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); @@ -626,7 +451,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) item->touchscreen_data->min_y = abs_info.minimum; item->touchscreen_data->max_y = abs_info.maximum; item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum; - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); @@ -634,7 +459,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->max_slots = abs_info.maximum + 1; - + item->touchscreen_data->slots = SDL_calloc( item->touchscreen_data->max_slots, sizeof(*item->touchscreen_data->slots)); @@ -643,11 +468,11 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } - + for(i = 0; i < item->touchscreen_data->max_slots; i++) { item->touchscreen_data->slots[i].tracking_id = -1; } - + ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */ item->touchscreen_data->name); if (ret < 0) { @@ -656,7 +481,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) SDL_free(item->touchscreen_data); return ret; } - + return 0; } #endif /* SDL_USE_LIBUDEV */ @@ -665,7 +490,7 @@ static void SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item* item) { if (!item->is_touchscreen) return; - + SDL_DelTouch(item->fd); SDL_free(item->touchscreen_data->slots); SDL_free(item->touchscreen_data->name); @@ -689,21 +514,21 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) __u32* mt_req_code; __s32* mt_req_values; size_t mt_req_size; - + /* TODO: sync devices other than touchscreen */ if (!item->is_touchscreen) return; - + mt_req_size = sizeof(*mt_req_code) + sizeof(*mt_req_values) * item->touchscreen_data->max_slots; - + mt_req_code = SDL_calloc(1, mt_req_size); if (mt_req_code == NULL) { return; } - + mt_req_values = (__s32*)mt_req_code + 1; - + *mt_req_code = ABS_MT_TRACKING_ID; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { @@ -730,7 +555,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_UP; } } - + *mt_req_code = ABS_MT_POSITION_X; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { @@ -748,7 +573,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) } } } - + *mt_req_code = ABS_MT_POSITION_Y; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { @@ -766,14 +591,14 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) } } } - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(mt_req_code); return; } item->touchscreen_data->current_slot = abs_info.value; - + SDL_free(mt_req_code); #endif /* EVIOCGMTSLOTS */ @@ -792,7 +617,7 @@ SDL_EVDEV_device_added(const char *dev_path, int udev_class) return -1; /* already have this one */ } } - + item = (SDL_evdevlist_item *) SDL_calloc(1, sizeof (SDL_evdevlist_item)); if (item == NULL) { return SDL_OutOfMemory(); @@ -803,33 +628,33 @@ SDL_EVDEV_device_added(const char *dev_path, int udev_class) SDL_free(item); return SDL_SetError("Unable to open %s", dev_path); } - + item->path = SDL_strdup(dev_path); if (item->path == NULL) { close(item->fd); SDL_free(item); return SDL_OutOfMemory(); } - + if (udev_class & SDL_UDEV_DEVICE_TOUCHSCREEN) { item->is_touchscreen = 1; - + if ((ret = SDL_EVDEV_init_touchscreen(item)) < 0) { close(item->fd); SDL_free(item); return ret; } } - + if (_this->last == NULL) { _this->first = _this->last = item; } else { _this->last->next = item; _this->last = item; } - + SDL_EVDEV_sync_device(item); - + return _this->num_devices++; } #endif /* SDL_USE_LIBUDEV */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev.h b/Engine/lib/sdl/src/core/linux/SDL_evdev.h index 85b193864..8d6d683e6 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_evdev.h +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_evdev_h -#define _SDL_evdev_h +#ifndef SDL_evdev_h_ +#define SDL_evdev_h_ #ifdef SDL_INPUT_LINUXEV @@ -34,6 +34,6 @@ extern void SDL_EVDEV_Poll(void); #endif /* SDL_INPUT_LINUXEV */ -#endif /* _SDL_evdev_h */ +#endif /* SDL_evdev_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c new file mode 100644 index 000000000..250e6440b --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c @@ -0,0 +1,677 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_evdev_kbd.h" + +#ifdef SDL_INPUT_LINUXKD + +/* This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source */ + +#include +#include +#include +#include +#include +#include +#include /* for TIOCL_GETSHIFTSTATE */ + +#include "../../events/SDL_events_c.h" +#include "SDL_evdev_kbd_default_accents.h" +#include "SDL_evdev_kbd_default_keymap.h" + +/* These are not defined in older Linux kernel headers */ +#ifndef K_UNICODE +#define K_UNICODE 0x03 +#endif +#ifndef K_OFF +#define K_OFF 0x04 +#endif + +/* + * Handler Tables. + */ + +#define K_HANDLERS\ + k_self, k_fn, k_spec, k_pad,\ + k_dead, k_cons, k_cur, k_shift,\ + k_meta, k_ascii, k_lock, k_lowercase,\ + k_slock, k_dead2, k_brl, k_ignore + +typedef void (k_handler_fn)(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag); +static k_handler_fn K_HANDLERS; +static k_handler_fn *k_handler[16] = { K_HANDLERS }; + +typedef void (fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd); +static void fn_enter(SDL_EVDEV_keyboard_state *kbd); +static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd); +static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd); +static void fn_num(SDL_EVDEV_keyboard_state *kbd); +static void fn_compose(SDL_EVDEV_keyboard_state *kbd); + +static fn_handler_fn *fn_handler[] = +{ + NULL, fn_enter, NULL, NULL, + NULL, NULL, NULL, fn_caps_toggle, + fn_num, NULL, NULL, NULL, + NULL, fn_caps_on, fn_compose, NULL, + NULL, NULL, NULL, fn_num +}; + + +/* + * Keyboard State + */ + +struct SDL_EVDEV_keyboard_state +{ + int console_fd; + int old_kbd_mode; + unsigned short **key_maps; + unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ + SDL_bool dead_key_next; + int npadch; /* -1 or number assembled on pad */ + struct kbdiacrs *accents; + unsigned int diacr; + SDL_bool rep; /* flag telling character repeat */ + unsigned char lockstate; + unsigned char slockstate; + unsigned char ledflagstate; + char shift_state; + char text[128]; + unsigned int text_len; +}; + +#ifdef DUMP_ACCENTS +static void SDL_EVDEV_dump_accents(SDL_EVDEV_keyboard_state *kbd) +{ + unsigned int i; + + printf("static struct kbdiacrs default_accents = {\n"); + printf(" %d,\n", kbd->accents->kb_cnt); + printf(" {\n"); + for (i = 0; i < kbd->accents->kb_cnt; ++i) { + struct kbdiacr *diacr = &kbd->accents->kbdiacr[i]; + printf(" { 0x%.2x, 0x%.2x, 0x%.2x },\n", + diacr->diacr, diacr->base, diacr->result); + } + while (i < 256) { + printf(" { 0x00, 0x00, 0x00 },\n"); + ++i; + } + printf(" }\n"); + printf("};\n"); +} +#endif /* DUMP_ACCENTS */ + +#ifdef DUMP_KEYMAP +static void SDL_EVDEV_dump_keymap(SDL_EVDEV_keyboard_state *kbd) +{ + int i, j; + + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + printf("static unsigned short default_key_map_%d[NR_KEYS] = {", i); + for (j = 0; j < NR_KEYS; ++j) { + if ((j%8) == 0) { + printf("\n "); + } + printf("0x%.4x, ", kbd->key_maps[i][j]); + } + printf("\n};\n"); + } + } + printf("\n"); + printf("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {\n"); + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + printf(" default_key_map_%d,\n", i); + } else { + printf(" NULL,\n"); + } + } + printf("};\n"); +} +#endif /* DUMP_KEYMAP */ + +static int SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd) +{ + int i, j; + + kbd->key_maps = (unsigned short **)SDL_calloc(MAX_NR_KEYMAPS, sizeof(unsigned short *)); + if (!kbd->key_maps) { + return -1; + } + + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + struct kbentry kbe; + + kbe.kb_table = i; + kbe.kb_index = 0; + if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { + return -1; + } + + if (kbe.kb_value == K_NOSUCHMAP) { + continue; + } + + kbd->key_maps[i] = (unsigned short *)SDL_malloc(NR_KEYS * sizeof(unsigned short)); + if (!kbd->key_maps[i]) { + return -1; + } + + for (j = 0; j < NR_KEYS; ++j) { + kbe.kb_table = i; + kbe.kb_index = j; + if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { + return -1; + } + kbd->key_maps[i][j] = (kbe.kb_value ^ 0xf000); + } + } + return 0; +} + +SDL_EVDEV_keyboard_state * +SDL_EVDEV_kbd_init(void) +{ + SDL_EVDEV_keyboard_state *kbd; + int i; + char flag_state; + char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0}; + + kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); + if (!kbd) { + return NULL; + } + + kbd->npadch = -1; + + /* This might fail if we're not connected to a tty (e.g. on the Steam Link) */ + kbd->console_fd = open("/dev/tty", O_RDONLY); + + if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) { + kbd->shift_state = *shift_state; + } + + if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) { + kbd->ledflagstate = flag_state; + } + + kbd->accents = &default_accents; + if (ioctl(kbd->console_fd, KDGKBDIACR, kbd->accents) < 0) { + /* No worries, we'll use the default accent table */ + } + + kbd->key_maps = default_key_maps; + if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) { + /* Set the keyboard in UNICODE mode and load the keymaps */ + ioctl(kbd->console_fd, KDSKBMODE, K_UNICODE); + + if (SDL_EVDEV_kbd_load_keymaps(kbd) < 0) { + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + SDL_free(kbd->key_maps[i]); + } + } + SDL_free(kbd->key_maps); + + kbd->key_maps = default_key_maps; + } + + /* Mute the keyboard so keystrokes only generate evdev events + * and do not leak through to the console + */ + ioctl(kbd->console_fd, KDSKBMODE, K_OFF); + } + +#ifdef DUMP_ACCENTS + SDL_EVDEV_dump_accents(kbd); +#endif +#ifdef DUMP_KEYMAP + SDL_EVDEV_dump_keymap(kbd); +#endif + return kbd; +} + +void +SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) +{ + if (!kbd) { + return; + } + + if (kbd->console_fd >= 0) { + /* Restore the original keyboard mode */ + ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); + + close(kbd->console_fd); + kbd->console_fd = -1; + } + + if (kbd->key_maps && kbd->key_maps != default_key_maps) { + int i; + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + SDL_free(kbd->key_maps[i]); + } + } + SDL_free(kbd->key_maps); + } + + SDL_free(kbd); +} + +/* + * Helper Functions. + */ +static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c) +{ + /* c is already part of a UTF-8 sequence and safe to add as a character */ + if (kbd->text_len < (sizeof(kbd->text)-1)) { + kbd->text[kbd->text_len++] = (char)c; + } +} + +static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c) +{ + if (c < 0x80) + /* 0******* */ + put_queue(kbd, c); + else if (c < 0x800) { + /* 110***** 10****** */ + put_queue(kbd, 0xc0 | (c >> 6)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } else if (c < 0x10000) { + if (c >= 0xD800 && c < 0xE000) + return; + if (c == 0xFFFF) + return; + /* 1110**** 10****** 10****** */ + put_queue(kbd, 0xe0 | (c >> 12)); + put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } else if (c < 0x110000) { + /* 11110*** 10****** 10****** 10****** */ + put_queue(kbd, 0xf0 | (c >> 18)); + put_queue(kbd, 0x80 | ((c >> 12) & 0x3f)); + put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } +} + +/* + * We have a combining character DIACR here, followed by the character CH. + * If the combination occurs in the table, return the corresponding value. + * Otherwise, if CH is a space or equals DIACR, return DIACR. + * Otherwise, conclude that DIACR was not combining after all, + * queue it and return CH. + */ +static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch) +{ + unsigned int d = kbd->diacr; + unsigned int i; + + kbd->diacr = 0; + + for (i = 0; i < kbd->accents->kb_cnt; i++) { + if (kbd->accents->kbdiacr[i].diacr == d && + kbd->accents->kbdiacr[i].base == ch) { + return kbd->accents->kbdiacr[i].result; + } + } + + if (ch == ' ' || ch == d) + return d; + + put_utf8(kbd, d); + + return ch; +} + +static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + return ((kbd->ledflagstate >> flag) & 1); +} + +static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate |= 1 << flag; +} + +static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate &= ~(1 << flag); +} + +static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->lockstate ^= 1 << flag; +} + +static void chg_vc_kbd_slock(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->slockstate ^= 1 << flag; +} + +static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate ^= 1 << flag; +} + +/* + * Special function handlers + */ + +static void fn_enter(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->diacr) { + put_utf8(kbd, kbd->diacr); + kbd->diacr = 0; + } +} + +static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->rep) + return; + + chg_vc_kbd_led(kbd, K_CAPSLOCK); +} + +static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->rep) + return; + + set_vc_kbd_led(kbd, K_CAPSLOCK); +} + +static void fn_num(SDL_EVDEV_keyboard_state *kbd) +{ + if (!kbd->rep) + chg_vc_kbd_led(kbd, K_NUMLOCK); +} + +static void fn_compose(SDL_EVDEV_keyboard_state *kbd) +{ + kbd->dead_key_next = SDL_TRUE; +} + +/* + * Special key handlers + */ + +static void k_ignore(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_spec(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag) + return; + if (value >= SDL_arraysize(fn_handler)) + return; + if (fn_handler[value]) + fn_handler[value](kbd); +} + +static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag) + return; /* no action, if this is a key release */ + + if (kbd->diacr) + value = handle_diacr(kbd, value); + + if (kbd->dead_key_next) { + kbd->dead_key_next = SDL_FALSE; + kbd->diacr = value; + return; + } + put_utf8(kbd, value); +} + +static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag) +{ + if (up_flag) + return; + + kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value); +} + +static void k_dead(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; + + k_deadunicode(kbd, ret_diacr[value], up_flag); +} + +static void k_dead2(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + k_deadunicode(kbd, value, up_flag); +} + +static void k_cons(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_fn(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_cur(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_pad(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + static const char pad_chars[] = "0123456789+-*/\015,.?()#"; + + if (up_flag) + return; /* no action, if this is a key release */ + + if (!vc_kbd_led(kbd, K_NUMLOCK)) { + /* unprintable action */ + return; + } + + put_queue(kbd, pad_chars[value]); +} + +static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + int old_state = kbd->shift_state; + + if (kbd->rep) + return; + /* + * Mimic typewriter: + * a CapsShift key acts like Shift but undoes CapsLock + */ + if (value == KVAL(K_CAPSSHIFT)) { + value = KVAL(K_SHIFT); + if (!up_flag) + clr_vc_kbd_led(kbd, K_CAPSLOCK); + } + + if (up_flag) { + /* + * handle the case that two shift or control + * keys are depressed simultaneously + */ + if (kbd->shift_down[value]) + kbd->shift_down[value]--; + } else + kbd->shift_down[value]++; + + if (kbd->shift_down[value]) + kbd->shift_state |= (1 << value); + else + kbd->shift_state &= ~(1 << value); + + /* kludge */ + if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) { + put_utf8(kbd, kbd->npadch); + kbd->npadch = -1; + } +} + +static void k_meta(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_ascii(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + int base; + + if (up_flag) + return; + + if (value < 10) { + /* decimal input of code, while Alt depressed */ + base = 10; + } else { + /* hexadecimal input of code, while AltGr depressed */ + value -= 10; + base = 16; + } + + if (kbd->npadch == -1) + kbd->npadch = value; + else + kbd->npadch = kbd->npadch * base + value; +} + +static void k_lock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag || kbd->rep) + return; + + chg_vc_kbd_lock(kbd, value); +} + +static void k_slock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + k_shift(kbd, value, up_flag); + if (up_flag || kbd->rep) + return; + + chg_vc_kbd_slock(kbd, value); + /* try to make Alt, oops, AltGr and such work */ + if (!kbd->key_maps[kbd->lockstate ^ kbd->slockstate]) { + kbd->slockstate = 0; + chg_vc_kbd_slock(kbd, value); + } +} + +static void k_brl(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +void +SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int down) +{ + unsigned char shift_final; + unsigned char type; + unsigned short *key_map; + unsigned short keysym; + + if (!kbd) { + return; + } + + kbd->rep = (down == 2); + + shift_final = (kbd->shift_state | kbd->slockstate) ^ kbd->lockstate; + key_map = kbd->key_maps[shift_final]; + if (!key_map) { + kbd->slockstate = 0; + return; + } + + if (keycode < NR_KEYS) { + keysym = key_map[keycode]; + } else { + return; + } + + type = KTYP(keysym); + + if (type < 0xf0) { + if (down) { + put_utf8(kbd, keysym); + } + } else { + type -= 0xf0; + + /* if type is KT_LETTER then it can be affected by Caps Lock */ + if (type == KT_LETTER) { + type = KT_LATIN; + + if (vc_kbd_led(kbd, K_CAPSLOCK)) { + key_map = kbd->key_maps[shift_final ^ (1 << KG_SHIFT)]; + if (key_map) { + keysym = key_map[keycode]; + } + } + } + + (*k_handler[type])(kbd, keysym & 0xff, !down); + + if (type != KT_SLOCK) { + kbd->slockstate = 0; + } + } + + if (kbd->text_len > 0) { + kbd->text[kbd->text_len] = '\0'; + SDL_SendKeyboardText(kbd->text); + kbd->text_len = 0; + } +} + +#else /* !SDL_INPUT_LINUXKD */ + +SDL_EVDEV_keyboard_state * +SDL_EVDEV_kbd_init(void) +{ + return NULL; +} + +void +SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down) +{ +} + +void +SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) +{ +} + +#endif /* SDL_INPUT_LINUXKD */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h new file mode 100644 index 000000000..831ba3ade --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +struct SDL_EVDEV_keyboard_state; +typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state; + +extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void); +extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down); +extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h new file mode 100644 index 000000000..2fb52544c --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h @@ -0,0 +1,284 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +static struct kbdiacrs default_accents = { + 68, + { + { 0x60, 0x41, 0xc0 }, + { 0x60, 0x61, 0xe0 }, + { 0x27, 0x41, 0xc1 }, + { 0x27, 0x61, 0xe1 }, + { 0x5e, 0x41, 0xc2 }, + { 0x5e, 0x61, 0xe2 }, + { 0x7e, 0x41, 0xc3 }, + { 0x7e, 0x61, 0xe3 }, + { 0x22, 0x41, 0xc4 }, + { 0x22, 0x61, 0xe4 }, + { 0x4f, 0x41, 0xc5 }, + { 0x6f, 0x61, 0xe5 }, + { 0x30, 0x41, 0xc5 }, + { 0x30, 0x61, 0xe5 }, + { 0x41, 0x41, 0xc5 }, + { 0x61, 0x61, 0xe5 }, + { 0x41, 0x45, 0xc6 }, + { 0x61, 0x65, 0xe6 }, + { 0x2c, 0x43, 0xc7 }, + { 0x2c, 0x63, 0xe7 }, + { 0x60, 0x45, 0xc8 }, + { 0x60, 0x65, 0xe8 }, + { 0x27, 0x45, 0xc9 }, + { 0x27, 0x65, 0xe9 }, + { 0x5e, 0x45, 0xca }, + { 0x5e, 0x65, 0xea }, + { 0x22, 0x45, 0xcb }, + { 0x22, 0x65, 0xeb }, + { 0x60, 0x49, 0xcc }, + { 0x60, 0x69, 0xec }, + { 0x27, 0x49, 0xcd }, + { 0x27, 0x69, 0xed }, + { 0x5e, 0x49, 0xce }, + { 0x5e, 0x69, 0xee }, + { 0x22, 0x49, 0xcf }, + { 0x22, 0x69, 0xef }, + { 0x2d, 0x44, 0xd0 }, + { 0x2d, 0x64, 0xf0 }, + { 0x7e, 0x4e, 0xd1 }, + { 0x7e, 0x6e, 0xf1 }, + { 0x60, 0x4f, 0xd2 }, + { 0x60, 0x6f, 0xf2 }, + { 0x27, 0x4f, 0xd3 }, + { 0x27, 0x6f, 0xf3 }, + { 0x5e, 0x4f, 0xd4 }, + { 0x5e, 0x6f, 0xf4 }, + { 0x7e, 0x4f, 0xd5 }, + { 0x7e, 0x6f, 0xf5 }, + { 0x22, 0x4f, 0xd6 }, + { 0x22, 0x6f, 0xf6 }, + { 0x2f, 0x4f, 0xd8 }, + { 0x2f, 0x6f, 0xf8 }, + { 0x60, 0x55, 0xd9 }, + { 0x60, 0x75, 0xf9 }, + { 0x27, 0x55, 0xda }, + { 0x27, 0x75, 0xfa }, + { 0x5e, 0x55, 0xdb }, + { 0x5e, 0x75, 0xfb }, + { 0x22, 0x55, 0xdc }, + { 0x22, 0x75, 0xfc }, + { 0x27, 0x59, 0xdd }, + { 0x27, 0x79, 0xfd }, + { 0x54, 0x48, 0xde }, + { 0x74, 0x68, 0xfe }, + { 0x73, 0x73, 0xdf }, + { 0x22, 0x79, 0xff }, + { 0x73, 0x7a, 0xdf }, + { 0x69, 0x6a, 0xff }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + } +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h new file mode 100644 index 000000000..0ed305020 --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h @@ -0,0 +1,4763 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +static unsigned short default_key_map_0[NR_KEYS] = { + 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_1[NR_KEYS] = { + 0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_2[NR_KEYS] = { + 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_3[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +#ifdef INCLUDE_EXTENDED_KEYMAP +static unsigned short default_key_map_4[NR_KEYS] = { + 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_5[NR_KEYS] = { + 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_6[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_7[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_8[NR_KEYS] = { + 0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_9[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_10[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_11[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_12[NR_KEYS] = { + 0xf200, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_13[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_14[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_15[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_16[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_17[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_18[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_19[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_20[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_21[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_22[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_23[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_24[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_25[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_26[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_27[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_28[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_29[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_30[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_31[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_32[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_33[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_34[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_35[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_36[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_37[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_38[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_39[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_40[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_41[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_42[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_43[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_44[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_45[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_46[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_47[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_48[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_49[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_50[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_51[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_52[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_53[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_54[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_55[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_56[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_57[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_58[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_59[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_60[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_61[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_62[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_63[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_64[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_65[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_66[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_67[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_68[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_69[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_70[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_71[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_72[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_73[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_74[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_75[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_76[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_77[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_78[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_79[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_80[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_81[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_82[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_83[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_84[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_85[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_86[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_87[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_88[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_89[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_90[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_91[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_92[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_93[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_94[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_95[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_96[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_97[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_98[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_99[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_100[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_101[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_102[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_103[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_104[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_105[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_106[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_107[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_108[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_109[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_110[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_111[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_112[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_113[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_114[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_115[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_116[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_117[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_118[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_119[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_120[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_121[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_122[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_123[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_124[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_125[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_126[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_127[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +#endif /* INCLUDE_EXTENDED_KEYMAP */ + +static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = { + default_key_map_0, + default_key_map_1, + default_key_map_2, + default_key_map_3, +#ifdef INCLUDE_EXTENDED_KEYMAP + default_key_map_4, + default_key_map_5, + default_key_map_6, + default_key_map_7, + default_key_map_8, + default_key_map_9, + default_key_map_10, + default_key_map_11, + default_key_map_12, + default_key_map_13, + default_key_map_14, + default_key_map_15, + default_key_map_16, + default_key_map_17, + default_key_map_18, + default_key_map_19, + default_key_map_20, + default_key_map_21, + default_key_map_22, + default_key_map_23, + default_key_map_24, + default_key_map_25, + default_key_map_26, + default_key_map_27, + default_key_map_28, + default_key_map_29, + default_key_map_30, + default_key_map_31, + default_key_map_32, + default_key_map_33, + default_key_map_34, + default_key_map_35, + default_key_map_36, + default_key_map_37, + default_key_map_38, + default_key_map_39, + default_key_map_40, + default_key_map_41, + default_key_map_42, + default_key_map_43, + default_key_map_44, + default_key_map_45, + default_key_map_46, + default_key_map_47, + default_key_map_48, + default_key_map_49, + default_key_map_50, + default_key_map_51, + default_key_map_52, + default_key_map_53, + default_key_map_54, + default_key_map_55, + default_key_map_56, + default_key_map_57, + default_key_map_58, + default_key_map_59, + default_key_map_60, + default_key_map_61, + default_key_map_62, + default_key_map_63, + default_key_map_64, + default_key_map_65, + default_key_map_66, + default_key_map_67, + default_key_map_68, + default_key_map_69, + default_key_map_70, + default_key_map_71, + default_key_map_72, + default_key_map_73, + default_key_map_74, + default_key_map_75, + default_key_map_76, + default_key_map_77, + default_key_map_78, + default_key_map_79, + default_key_map_80, + default_key_map_81, + default_key_map_82, + default_key_map_83, + default_key_map_84, + default_key_map_85, + default_key_map_86, + default_key_map_87, + default_key_map_88, + default_key_map_89, + default_key_map_90, + default_key_map_91, + default_key_map_92, + default_key_map_93, + default_key_map_94, + default_key_map_95, + default_key_map_96, + default_key_map_97, + default_key_map_98, + default_key_map_99, + default_key_map_100, + default_key_map_101, + default_key_map_102, + default_key_map_103, + default_key_map_104, + default_key_map_105, + default_key_map_106, + default_key_map_107, + default_key_map_108, + default_key_map_109, + default_key_map_110, + default_key_map_111, + default_key_map_112, + default_key_map_113, + default_key_map_114, + default_key_map_115, + default_key_map_116, + default_key_map_117, + default_key_map_118, + default_key_map_119, + default_key_map_120, + default_key_map_121, + default_key_map_122, + default_key_map_123, + default_key_map_124, + default_key_map_125, + default_key_map_126, + default_key_map_127, +#else /* !INCLUDE_EXTENDED_KEYMAP */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +#endif /* INCLUDE_EXTENDED_KEYMAP */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_fcitx.c b/Engine/lib/sdl/src/core/linux/SDL_fcitx.c index 83d19e690..41954e92d 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_fcitx.c +++ b/Engine/lib/sdl/src/core/linux/SDL_fcitx.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,71 +118,6 @@ GetAppName() return SDL_strdup("SDL_App"); } -/* - * Copied from fcitx source - */ -#define CONT(i) ISUTF8_CB(in[i]) -#define VAL(i, s) ((in[i]&0x3f) << s) - -static char * -_fcitx_utf8_get_char(const char *i, uint32_t *chr) -{ - const unsigned char* in = (const unsigned char *)i; - if (!(in[0] & 0x80)) { - *(chr) = *(in); - return (char *)in + 1; - } - - /* 2-byte, 0x80-0x7ff */ - if ((in[0] & 0xe0) == 0xc0 && CONT(1)) { - *chr = ((in[0] & 0x1f) << 6) | VAL(1, 0); - return (char *)in + 2; - } - - /* 3-byte, 0x800-0xffff */ - if ((in[0] & 0xf0) == 0xe0 && CONT(1) && CONT(2)) { - *chr = ((in[0] & 0xf) << 12) | VAL(1, 6) | VAL(2, 0); - return (char *)in + 3; - } - - /* 4-byte, 0x10000-0x1FFFFF */ - if ((in[0] & 0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3)) { - *chr = ((in[0] & 0x7) << 18) | VAL(1, 12) | VAL(2, 6) | VAL(3, 0); - return (char *)in + 4; - } - - /* 5-byte, 0x200000-0x3FFFFFF */ - if ((in[0] & 0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4)) { - *chr = ((in[0] & 0x3) << 24) | VAL(1, 18) | VAL(2, 12) | VAL(3, 6) | VAL(4, 0); - return (char *)in + 5; - } - - /* 6-byte, 0x400000-0x7FFFFFF */ - if ((in[0] & 0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5)) { - *chr = ((in[0] & 0x1) << 30) | VAL(1, 24) | VAL(2, 18) | VAL(3, 12) | VAL(4, 6) | VAL(5, 0); - return (char *)in + 6; - } - - *chr = *in; - - return (char *)in + 1; -} - -static size_t -_fcitx_utf8_strlen(const char *s) -{ - unsigned int l = 0; - - while (*s) { - uint32_t chr; - - s = _fcitx_utf8_get_char(s, &chr); - l++; - } - - return l; -} - static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -214,8 +149,8 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) size_t cursor = 0; while (i < text_bytes) { - size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); - size_t chars = _fcitx_utf8_strlen(buf); + const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); SDL_SendEditingText(buf, cursor, chars); @@ -231,116 +166,50 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static DBusMessage* -FcitxClientICNewMethod(FcitxClient *client, - const char *method) +static void +FcitxClientICCallMethod(FcitxClient *client, const char *method) { - SDL_DBusContext *dbus = client->dbus; - return dbus->message_new_method_call( - client->servicename, - client->icname, - FCITX_IC_DBUS_INTERFACE, - method); + SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID); } -static void -FcitxClientICCallMethod(FcitxClient *client, - const char *method) -{ - SDL_DBusContext *dbus = client->dbus; - DBusMessage *msg = FcitxClientICNewMethod(client, method); - - if (msg == NULL) - return ; - - if (dbus->connection_send(dbus->session_conn, msg, NULL)) { - dbus->connection_flush(dbus->session_conn); - } - - dbus->message_unref(msg); -} - -static void +static void SDLCALL Fcitx_SetCapabilities(void *data, const char *name, const char *old_val, const char *internal_editing) { FcitxClient *client = (FcitxClient *)data; - SDL_DBusContext *dbus = client->dbus; Uint32 caps = CAPACITY_NONE; - DBusMessage *msg = FcitxClientICNewMethod(client, "SetCapacity"); - if (msg == NULL) - return ; - if (!(internal_editing && *internal_editing == '1')) { caps |= CAPACITY_PREEDIT; } - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &caps, - DBUS_TYPE_INVALID); - if (dbus->connection_send(dbus->session_conn, msg, NULL)) { - dbus->connection_flush(dbus->session_conn); - } - - dbus->message_unref(msg); + SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, "SetCapacity", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); } -static void +static SDL_bool FcitxClientCreateIC(FcitxClient *client) { - char *appname = NULL; - pid_t pid = 0; - int id = 0; - SDL_bool enable; - Uint32 arg1, arg2, arg3, arg4; + char *appname = GetAppName(); + pid_t pid = getpid(); + int id = -1; + Uint32 enable, arg1, arg2, arg3, arg4; - SDL_DBusContext *dbus = client->dbus; - DBusMessage *reply = NULL; - DBusMessage *msg = dbus->message_new_method_call( - client->servicename, - FCITX_IM_DBUS_PATH, - FCITX_IM_DBUS_INTERFACE, - "CreateICv3" - ); + if (!SDL_DBus_CallMethod(client->servicename, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateICv3", + DBUS_TYPE_STRING, &appname, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID, + DBUS_TYPE_INT32, &id, DBUS_TYPE_BOOLEAN, &enable, DBUS_TYPE_UINT32, &arg1, DBUS_TYPE_UINT32, &arg2, DBUS_TYPE_UINT32, &arg3, DBUS_TYPE_UINT32, &arg4, DBUS_TYPE_INVALID)) { + id = -1; /* just in case. */ + } - if (msg == NULL) - return ; + SDL_free(appname); - appname = GetAppName(); - pid = getpid(); - dbus->message_append_args(msg, - DBUS_TYPE_STRING, &appname, - DBUS_TYPE_INT32, &pid, - DBUS_TYPE_INVALID); + if (id >= 0) { + SDL_DBusContext *dbus = client->dbus; - do { - reply = dbus->connection_send_with_reply_and_block( - dbus->session_conn, - msg, - DBUS_TIMEOUT, - NULL); - - if (!reply) - break; - if (!dbus->message_get_args(reply, NULL, - DBUS_TYPE_INT32, &id, - DBUS_TYPE_BOOLEAN, &enable, - DBUS_TYPE_UINT32, &arg1, - DBUS_TYPE_UINT32, &arg2, - DBUS_TYPE_UINT32, &arg3, - DBUS_TYPE_UINT32, &arg4, - DBUS_TYPE_INVALID)) - break; - - if (id < 0) - break; client->id = id; - SDL_snprintf(client->icname, IC_NAME_MAX, - FCITX_IC_DBUS_PATH, client->id); + SDL_snprintf(client->icname, IC_NAME_MAX, FCITX_IC_DBUS_PATH, client->id); dbus->bus_add_match(dbus->session_conn, "type='signal', interface='org.fcitx.Fcitx.InputContext'", @@ -350,14 +219,11 @@ FcitxClientCreateIC(FcitxClient *client) NULL); dbus->connection_flush(dbus->session_conn); - SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &Fcitx_SetCapabilities, client); + SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, Fcitx_SetCapabilities, client); + return SDL_TRUE; } - while (0); - if (reply) - dbus->message_unref(reply); - dbus->message_unref(msg); - SDL_free(appname); + return SDL_FALSE; } static Uint32 @@ -391,9 +257,7 @@ SDL_Fcitx_Init() "%s-%d", FCITX_DBUS_SERVICE, GetDisplayNumber()); - FcitxClientCreateIC(&fcitx_client); - - return SDL_TRUE; + return FcitxClientCreateIC(&fcitx_client); } void @@ -422,47 +286,21 @@ SDL_Fcitx_Reset(void) SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { - DBusMessage *msg = NULL; - DBusMessage *reply = NULL; - SDL_DBusContext *dbus = fcitx_client.dbus; - - Uint32 state = 0; - SDL_bool handled = SDL_FALSE; + Uint32 state = Fcitx_ModState(); + Uint32 handled = SDL_FALSE; int type = FCITX_PRESS_KEY; Uint32 event_time = 0; - msg = FcitxClientICNewMethod(&fcitx_client, "ProcessKeyEvent"); - if (msg == NULL) - return SDL_FALSE; - - state = Fcitx_ModState(); - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &keysym, - DBUS_TYPE_UINT32, &keycode, - DBUS_TYPE_UINT32, &state, - DBUS_TYPE_INT32, &type, - DBUS_TYPE_UINT32, &event_time, - DBUS_TYPE_INVALID); - - reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, - msg, - -1, - NULL); - - if (reply) { - dbus->message_get_args(reply, - NULL, - DBUS_TYPE_INT32, &handled, - DBUS_TYPE_INVALID); - - dbus->message_unref(reply); + if (SDL_DBus_CallMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent", + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INT32, &type, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, + DBUS_TYPE_INT32, &handled, DBUS_TYPE_INVALID)) { + if (handled) { + SDL_Fcitx_UpdateTextRect(NULL); + return SDL_TRUE; + } } - if (handled) { - SDL_Fcitx_UpdateTextRect(NULL); - } - - return handled; + return SDL_FALSE; } void @@ -473,10 +311,6 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) int x = 0, y = 0; SDL_Rect *cursor = &fcitx_client.cursor_rect; - SDL_DBusContext *dbus = fcitx_client.dbus; - DBusMessage *msg = NULL; - DBusConnection *conn; - if (rect) { SDL_memcpy(cursor, rect, sizeof(SDL_Rect)); } @@ -506,7 +340,7 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) #endif if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) { - // move to bottom left + /* move to bottom left */ int w = 0, h = 0; SDL_GetWindowSize(focused_win, &w, &h); cursor->x = 0; @@ -516,26 +350,12 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) x += cursor->x; y += cursor->y; - msg = FcitxClientICNewMethod(&fcitx_client, "SetCursorRect"); - if (msg == NULL) - return ; - - dbus->message_append_args(msg, - DBUS_TYPE_INT32, &x, - DBUS_TYPE_INT32, &y, - DBUS_TYPE_INT32, &cursor->w, - DBUS_TYPE_INT32, &cursor->h, - DBUS_TYPE_INVALID); - - conn = dbus->session_conn; - if (dbus->connection_send(conn, msg, NULL)) - dbus->connection_flush(conn); - - dbus->message_unref(msg); + SDL_DBus_CallVoidMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "SetCursorRect", + DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID); } void -SDL_Fcitx_PumpEvents() +SDL_Fcitx_PumpEvents(void) { SDL_DBusContext *dbus = fcitx_client.dbus; DBusConnection *conn = dbus->session_conn; diff --git a/Engine/lib/sdl/src/core/linux/SDL_fcitx.h b/Engine/lib/sdl/src/core/linux/SDL_fcitx.h index 64020475c..9407cd93d 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_fcitx.h +++ b/Engine/lib/sdl/src/core/linux/SDL_fcitx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_fcitx_h -#define _SDL_fcitx_h +#ifndef SDL_fcitx_h_ +#define SDL_fcitx_h_ #include "../../SDL_internal.h" @@ -33,8 +33,8 @@ extern void SDL_Fcitx_SetFocus(SDL_bool focused); extern void SDL_Fcitx_Reset(void); extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); -extern void SDL_Fcitx_PumpEvents(); +extern void SDL_Fcitx_PumpEvents(void); -#endif /* _SDL_fcitx_h */ +#endif /* SDL_fcitx_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ibus.c b/Engine/lib/sdl/src/core/linux/SDL_ibus.c index 3d63b8b30..a9c319716 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ibus.c +++ b/Engine/lib/sdl/src/core/linux/SDL_ibus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ static char *input_ctx_path = NULL; static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 }; static DBusConnection *ibus_conn = NULL; static char *ibus_addr_file = NULL; -int inotify_fd = -1, inotify_wd = -1; +static int inotify_fd = -1, inotify_wd = -1; static Uint32 IBus_ModState(void) @@ -107,21 +107,6 @@ IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext return text; } -static size_t -IBus_utf8_strlen(const char *str) -{ - size_t utf8_len = 0; - const char *p; - - for (p = str; *p; ++p) { - if (!((*p & 0x80) && !(*p & 0x40))) { - ++utf8_len; - } - } - - return utf8_len; -} - static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -135,7 +120,7 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) text = IBus_GetVariantText(conn, &iter, dbus); if (text && *text) { - char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; while (i < text_bytes) { @@ -162,8 +147,8 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) size_t cursor = 0; do { - size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); - size_t chars = IBus_utf8_strlen(buf); + const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); SDL_SendEditingText(buf, cursor, chars); @@ -302,35 +287,20 @@ IBus_GetDBusAddressFilename(void) static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus); -static void +static void SDLCALL IBus_SetCapabilities(void *data, const char *name, const char *old_val, const char *internal_editing) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { + Uint32 caps = IBUS_CAP_FOCUS; + if (!(internal_editing && *internal_editing == '1')) { + caps |= IBUS_CAP_PREEDIT_TEXT; + } - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "SetCapabilities"); - if (msg) { - Uint32 caps = IBUS_CAP_FOCUS; - if (!(internal_editing && *internal_editing == '1')) { - caps |= IBUS_CAP_PREEDIT_TEXT; - } - - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &caps, - DBUS_TYPE_INVALID); - } - - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities", + DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); } } @@ -338,9 +308,9 @@ IBus_SetCapabilities(void *data, const char *name, const char *old_val, static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) { + const char *client_name = "SDL2_Application"; const char *path = NULL; SDL_bool result = SDL_FALSE; - DBusMessage *msg; DBusObjectPathVTable ibus_vtable; SDL_zero(ibus_vtable); @@ -361,39 +331,17 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) dbus->connection_flush(ibus_conn); - msg = dbus->message_new_method_call(IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext"); - if (msg) { - const char *client_name = "SDL2_Application"; - dbus->message_append_args(msg, - DBUS_TYPE_STRING, &client_name, - DBUS_TYPE_INVALID); - } - - if (msg) { - DBusMessage *reply; - - reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 1000, NULL); - if (reply) { - if (dbus->message_get_args(reply, NULL, - DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID)) { - if (input_ctx_path) { - SDL_free(input_ctx_path); - } - input_ctx_path = SDL_strdup(path); - result = SDL_TRUE; - } - dbus->message_unref(reply); - } - dbus->message_unref(msg); - } - - if (result) { - SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL); + if (SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext", + DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, + DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) { + SDL_free(input_ctx_path); + input_ctx_path = SDL_strdup(path); + SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL); dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL); dbus->connection_flush(ibus_conn); + result = SDL_TRUE; } SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL); @@ -521,7 +469,7 @@ SDL_IBus_Quit(void) inotify_wd = -1; } - SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL); + SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect)); } @@ -532,16 +480,7 @@ IBus_SimpleMessage(const char *method) SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - method); - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, method, DBUS_TYPE_INVALID); } } @@ -561,43 +500,21 @@ SDL_IBus_Reset(void) SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { - SDL_bool result = SDL_FALSE; + Uint32 result = 0; SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "ProcessKeyEvent"); - if (msg) { - Uint32 mods = IBus_ModState(); - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &keysym, - DBUS_TYPE_UINT32, &keycode, - DBUS_TYPE_UINT32, &mods, - DBUS_TYPE_INVALID); + Uint32 mods = IBus_ModState(); + if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent", + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, + DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { + result = 0; } - - if (msg) { - DBusMessage *reply; - - reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 300, NULL); - if (reply) { - if (!dbus->message_get_args(reply, NULL, - DBUS_TYPE_BOOLEAN, &result, - DBUS_TYPE_INVALID)) { - result = SDL_FALSE; - } - dbus->message_unref(reply); - } - dbus->message_unref(msg); - } - } SDL_IBus_UpdateTextRect(NULL); - return result; + return result ? SDL_TRUE : SDL_FALSE; } void @@ -643,25 +560,8 @@ SDL_IBus_UpdateTextRect(SDL_Rect *rect) dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "SetCursorLocation"); - if (msg) { - dbus->message_append_args(msg, - DBUS_TYPE_INT32, &x, - DBUS_TYPE_INT32, &y, - DBUS_TYPE_INT32, &ibus_cursor_rect.w, - DBUS_TYPE_INT32, &ibus_cursor_rect.h, - DBUS_TYPE_INVALID); - } - - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCursorLocation", + DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID); } } @@ -680,3 +580,5 @@ SDL_IBus_PumpEvents(void) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ibus.h b/Engine/lib/sdl/src/core/linux/SDL_ibus.h index 5ee7a8e40..d533ff72c 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ibus.h +++ b/Engine/lib/sdl/src/core/linux/SDL_ibus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_ibus_h -#define _SDL_ibus_h +#ifndef SDL_ibus_h_ +#define SDL_ibus_h_ #ifdef HAVE_IBUS_IBUS_H #define SDL_USE_IBUS 1 @@ -49,10 +49,10 @@ extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect); /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / SDL_SendEditingText for each event it finds */ -extern void SDL_IBus_PumpEvents(); +extern void SDL_IBus_PumpEvents(void); #endif /* HAVE_IBUS_IBUS_H */ -#endif /* _SDL_ibus_h */ +#endif /* SDL_ibus_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ime.c b/Engine/lib/sdl/src/core/linux/SDL_ime.c index 049bd6e02..29b0182f3 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ime.c +++ b/Engine/lib/sdl/src/core/linux/SDL_ime.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -87,8 +87,20 @@ SDL_IME_Init(void) { InitIME(); - if (SDL_IME_Init_Real) - return SDL_IME_Init_Real(); + if (SDL_IME_Init_Real) { + if (SDL_IME_Init_Real()) { + return SDL_TRUE; + } + + /* uhoh, the IME implementation's init failed! Disable IME support. */ + SDL_IME_Init_Real = NULL; + SDL_IME_Quit_Real = NULL; + SDL_IME_SetFocus_Real = NULL; + SDL_IME_Reset_Real = NULL; + SDL_IME_ProcessKeyEvent_Real = NULL; + SDL_IME_UpdateTextRect_Real = NULL; + SDL_IME_PumpEvents_Real = NULL; + } return SDL_FALSE; } @@ -136,3 +148,5 @@ SDL_IME_PumpEvents() if (SDL_IME_PumpEvents_Real) SDL_IME_PumpEvents_Real(); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ime.h b/Engine/lib/sdl/src/core/linux/SDL_ime.h index 22b31de39..e39839c62 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ime.h +++ b/Engine/lib/sdl/src/core/linux/SDL_ime.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,20 +19,22 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_ime_h -#define _SDL_ime_h +#ifndef SDL_ime_h_ +#define SDL_ime_h_ #include "../../SDL_internal.h" #include "SDL_stdinc.h" #include "SDL_rect.h" -extern SDL_bool SDL_IME_Init(); -extern void SDL_IME_Quit(); +extern SDL_bool SDL_IME_Init(void); +extern void SDL_IME_Quit(void); extern void SDL_IME_SetFocus(SDL_bool focused); -extern void SDL_IME_Reset(); +extern void SDL_IME_Reset(void); extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); -extern void SDL_IME_PumpEvents(); +extern void SDL_IME_PumpEvents(void); -#endif /* _SDL_ime_h */ +#endif /* SDL_ime_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_udev.c b/Engine/lib/sdl/src/core/linux/SDL_udev.c index ae78ddd68..dfbeb790a 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_udev.c +++ b/Engine/lib/sdl/src/core/linux/SDL_udev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,9 +31,12 @@ #include -#include "SDL.h" +#include "SDL_assert.h" +#include "SDL_loadso.h" +#include "SDL_timer.h" +#include "../unix/SDL_poll.h" -static const char* SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; +static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; #define _THIS SDL_UDEV_PrivateData *_this static _THIS = NULL; @@ -98,14 +101,7 @@ SDL_UDEV_hotplug_update_available(void) { if (_this->udev_mon != NULL) { const int fd = _this->udev_monitor_get_fd(_this->udev_mon); - fd_set fds; - struct timeval tv; - - FD_ZERO(&fds); - FD_SET(fd, &fds); - tv.tv_sec = 0; - tv.tv_usec = 0; - if ((select(fd+1, &fds, NULL, NULL, &tv) > 0) && (FD_ISSET(fd, &fds))) { + if (SDL_IOReady(fd, SDL_FALSE, 0)) { return SDL_TRUE; } } @@ -209,7 +205,7 @@ SDL_UDEV_Scan(void) enumerate = _this->udev_enumerate_new(_this->udev); if (enumerate == NULL) { SDL_UDEV_Quit(); - SDL_SetError("udev_monitor_new_from_netlink() failed"); + SDL_SetError("udev_enumerate_new() failed"); return; } @@ -252,8 +248,25 @@ SDL_UDEV_LoadLibrary(void) if (_this == NULL) { return SDL_SetError("UDEV not initialized"); } - - + + /* See if there is a udev library already loaded */ + if (SDL_UDEV_load_syms() == 0) { + return 0; + } + +#ifdef SDL_UDEV_DYNAMIC + /* Check for the build environment's libudev first */ + if (_this->udev_handle == NULL) { + _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC); + if (_this->udev_handle != NULL) { + retval = SDL_UDEV_load_syms(); + if (retval < 0) { + SDL_UDEV_UnloadLibrary(); + } + } + } +#endif + if (_this->udev_handle == NULL) { for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) { _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]); @@ -280,7 +293,6 @@ SDL_UDEV_LoadLibrary(void) #define BITS_PER_LONG (sizeof(unsigned long) * 8) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) #define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) @@ -537,3 +549,5 @@ SDL_UDEV_DelCallback(SDL_UDEV_Callback cb) #endif /* SDL_USE_LIBUDEV */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_udev.h b/Engine/lib/sdl/src/core/linux/SDL_udev.h index 9ffbb3252..edf51870b 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_udev.h +++ b/Engine/lib/sdl/src/core/linux/SDL_udev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_udev_h -#define _SDL_udev_h +#ifndef SDL_udev_h_ +#define SDL_udev_h_ #if HAVE_LIBUDEV_H @@ -116,4 +116,6 @@ extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb); #endif /* HAVE_LIBUDEV_H */ -#endif /* _SDL_udev_h */ +#endif /* SDL_udev_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/unix/SDL_poll.c b/Engine/lib/sdl/src/core/unix/SDL_poll.c new file mode 100644 index 000000000..5ac6d0b60 --- /dev/null +++ b/Engine/lib/sdl/src/core/unix/SDL_poll.c @@ -0,0 +1,87 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#include "SDL_assert.h" +#include "SDL_poll.h" + +#ifdef HAVE_POLL +#include +#else +#include +#include +#include +#endif +#include + + +int +SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS) +{ + int result; + + /* Note: We don't bother to account for elapsed time if we get EINTR */ + do + { +#ifdef HAVE_POLL + struct pollfd info; + + info.fd = fd; + if (forWrite) { + info.events = POLLOUT; + } else { + info.events = POLLIN | POLLPRI; + } + result = poll(&info, 1, timeoutMS); +#else + fd_set rfdset, *rfdp = NULL; + fd_set wfdset, *wfdp = NULL; + struct timeval tv, *tvp = NULL; + + /* If this assert triggers we'll corrupt memory here */ + SDL_assert(fd >= 0 && fd < FD_SETSIZE); + + if (forWrite) { + FD_ZERO(&wfdset); + FD_SET(fd, &wfdset); + wfdp = &wfdset; + } else { + FD_ZERO(&rfdset); + FD_SET(fd, &rfdset); + rfdp = &rfdset; + } + + if (timeoutMS >= 0) { + tv.tv_sec = timeoutMS / 1000; + tv.tv_usec = (timeoutMS % 1000) * 1000; + tvp = &tv; + } + + result = select(fd + 1, rfdp, wfdp, NULL, tvp); +#endif /* HAVE_POLL */ + + } while ( result < 0 && errno == EINTR ); + + return result; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/unix/SDL_poll.h b/Engine/lib/sdl/src/core/unix/SDL_poll.h new file mode 100644 index 000000000..bf20e23d9 --- /dev/null +++ b/Engine/lib/sdl/src/core/unix/SDL_poll.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_poll_h_ +#define SDL_poll_h_ + +#include "SDL_stdinc.h" + + +extern int SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS); + +#endif /* SDL_poll_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_directx.h b/Engine/lib/sdl/src/core/windows/SDL_directx.h index 0533f61ed..7fe826fab 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_directx.h +++ b/Engine/lib/sdl/src/core/windows/SDL_directx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_directx_h -#define _SDL_directx_h +#ifndef SDL_directx_h_ +#define SDL_directx_h_ /* Include all of the DirectX 8.0 headers and adds any necessary tweaks */ @@ -106,6 +106,6 @@ typedef struct { int unused; } DIDEVICEINSTANCE; #endif -#endif /* _SDL_directx_h */ +#endif /* SDL_directx_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_windows.c b/Engine/lib/sdl/src/core/windows/SDL_windows.c index 6433fe26f..66240435f 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_windows.c +++ b/Engine/lib/sdl/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ #endif -/* Sets an error message based on GetLastError() */ +/* Sets an error message based on an HRESULT */ int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr) { @@ -115,7 +115,7 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP } #endif -BOOL WIN_IsWindowsVistaOrGreater() +BOOL WIN_IsWindowsVistaOrGreater(void) { #ifdef __WINRT__ return TRUE; @@ -124,6 +124,15 @@ BOOL WIN_IsWindowsVistaOrGreater() #endif } +BOOL WIN_IsWindows7OrGreater(void) +{ +#ifdef __WINRT__ + return TRUE; +#else + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); +#endif +} + /* WAVExxxCAPS gives you 31 bytes for the device name, and just truncates if it's longer. However, since WinXP, you can use the WAVExxxCAPS2 structure, which @@ -142,6 +151,8 @@ Registry, and a unhelpful "Microphone(Yeti Stereo Microph" in winmm. Sigh. (Also, DirectSound shouldn't be limited to 32 chars, but its device enum has the same problem.) + +WASAPI doesn't need this. This is just for DirectSound/WinMM. */ char * WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) @@ -158,7 +169,7 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) DWORD len = 0; char *retval = NULL; - if (SDL_memcmp(guid, &nullguid, sizeof (*guid)) == 0) { + if (WIN_IsEqualGUID(guid, &nullguid)) { return WIN_StringToUTF8(name); /* No GUID, go with what we've got. */ } @@ -202,6 +213,18 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) #endif /* if __WINRT__ / else */ } +BOOL +WIN_IsEqualGUID(const GUID * a, const GUID * b) +{ + return (SDL_memcmp(a, b, sizeof (*a)) == 0); +} + +BOOL +WIN_IsEqualIID(REFIID a, REFIID b) +{ + return (SDL_memcmp(a, b, sizeof (*a)) == 0); +} + #endif /* __WIN32__ || __WINRT__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_windows.h b/Engine/lib/sdl/src/core/windows/SDL_windows.h index 0f67e4be5..4a3336ad8 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_windows.h +++ b/Engine/lib/sdl/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,7 @@ #endif #include +#include /* for REFIID with broken mingw.org headers */ /* Routines to convert from UTF8 to native Windows text */ #if UNICODE @@ -57,11 +58,18 @@ extern HRESULT WIN_CoInitialize(void); extern void WIN_CoUninitialize(void); /* Returns SDL_TRUE if we're running on Windows Vista and newer */ -extern BOOL WIN_IsWindowsVistaOrGreater(); +extern BOOL WIN_IsWindowsVistaOrGreater(void); + +/* Returns SDL_TRUE if we're running on Windows 7 and newer */ +extern BOOL WIN_IsWindows7OrGreater(void); /* You need to SDL_free() the result of this call. */ extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid); +/* Checks to see if two GUID are the same. */ +extern BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b); +extern BOOL WIN_IsEqualIID(REFIID a, REFIID b); + #endif /* _INCLUDED_WINDOWS_H */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_xinput.c b/Engine/lib/sdl/src/core/windows/SDL_xinput.c index 355cd8343..75bf60003 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_xinput.c +++ b/Engine/lib/sdl/src/core/windows/SDL_xinput.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/core/windows/SDL_xinput.h b/Engine/lib/sdl/src/core/windows/SDL_xinput.h index 67f8fdc1f..6106c2b05 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_xinput.h +++ b/Engine/lib/sdl/src/core/windows/SDL_xinput.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_xinput_h -#define _SDL_xinput_h +#ifndef SDL_xinput_h_ +#define SDL_xinput_h_ #ifdef HAVE_XINPUT_H @@ -100,6 +100,8 @@ #endif /* typedef's for XInput structs we use */ + +#ifndef HAVE_XINPUT_GAMEPAD_EX typedef struct { WORD wButtons; @@ -111,12 +113,15 @@ typedef struct SHORT sThumbRY; DWORD dwPaddingReserved; } XINPUT_GAMEPAD_EX; +#endif +#ifndef HAVE_XINPUT_STATE_EX typedef struct { DWORD dwPacketNumber; XINPUT_GAMEPAD_EX Gamepad; } XINPUT_STATE_EX; +#endif typedef struct { @@ -167,6 +172,6 @@ extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ #endif /* HAVE_XINPUT_H */ -#endif /* _SDL_xinput_h */ +#endif /* SDL_xinput_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp index 265aa942e..887b47eaa 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,8 @@ #include "SDL_winrtapp_direct3d.h" #include "SDL_winrtapp_xaml.h" +#include + int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL; extern "C" DECLSPEC int @@ -32,6 +34,33 @@ SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel) if (xamlBackgroundPanel) { return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel); } else { + if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) { + return 1; + } return SDL_WinRTInitNonXAMLApp(mainFunction); } } + + +extern "C" DECLSPEC SDL_WinRT_DeviceFamily +SDL_WinRTGetDeviceFamily() +{ +#if NTDDI_VERSION >= NTDDI_WIN10 /* !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. */ + Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily; + + if (deviceFamily->Equals("Windows.Desktop")) + { + return SDL_WINRT_DEVICEFAMILY_DESKTOP; + } + else if (deviceFamily->Equals("Windows.Mobile")) + { + return SDL_WINRT_DEVICEFAMILY_MOBILE; + } + else if (deviceFamily->Equals("Windows.Xbox")) + { + return SDL_WINRT_DEVICEFAMILY_XBOX; + } +#endif + + return SDL_WINRT_DEVICEFAMILY_UNKNOWN; +} \ No newline at end of file diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h index e87a0b6b6..d68704c06 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtapp_common_h -#define _SDL_winrtapp_common_h +#ifndef SDL_winrtapp_common_h_ +#define SDL_winrtapp_common_h_ /* A pointer to the app's C-style main() function (which is a different function than the WinRT app's actual entry point). */ extern int (*WINRT_SDLAppEntryPoint)(int, char **); -#endif // ifndef _SDL_winrtapp_common_h +#endif // SDL_winrtapp_common_h_ diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp index e4ffadaad..6fa0bea79 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,6 @@ using namespace Windows::Phone::UI::Input; /* SDL includes */ extern "C" { -#include "../../SDL_internal.h" #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_hints.h" @@ -122,7 +121,8 @@ int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **)) return 0; } -static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) { SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0); @@ -827,7 +827,7 @@ static void WINRT_OnBackButtonPressed(BackButtonEventArgs ^ args) } } -#if NTDDI_VERSION == NTDDI_WIN10 +#if NTDDI_VERSION >= NTDDI_WIN10 void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args) { diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h index 4b48115f0..7f5259268 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp index 201e3b6c2..9789d036f 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h index a08b67c40..85b430587 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtapp_xaml_h -#define _SDL_winrtapp_xaml_h +#ifndef SDL_winrtapp_xaml_h_ +#define SDL_winrtapp_xaml_h_ #include "SDL_stdinc.h" @@ -30,4 +30,4 @@ extern SDL_bool WINRT_XAMLWasEnabled; extern int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable); #endif // ifdef __cplusplus -#endif // ifndef _SDL_winrtapp_xaml_h +#endif // SDL_winrtapp_xaml_h_ diff --git a/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c b/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c index c4c55be39..4e2c0f101 100644 --- a/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c +++ b/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,13 @@ #if defined(__WIN32__) #include "../core/windows/SDL_windows.h" #endif +#if defined(__OS2__) +#define INCL_DOS +#include +#ifndef QSV_NUMPROCESSORS +#define QSV_NUMPROCESSORS 26 +#endif +#endif /* CPU feature detection for SDL */ @@ -50,6 +57,25 @@ #include #endif +#if defined(__QNXNTO__) +#include +#endif + +#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) +/*#include */ +#ifndef AT_HWCAP +#define AT_HWCAP 16 +#endif +#ifndef HWCAP_NEON +#define HWCAP_NEON (1 << 12) +#endif +#if defined HAVE_GETAUXVAL +#include +#else +#include +#endif +#endif + #define CPU_HAS_RDTSC 0x00000001 #define CPU_HAS_ALTIVEC 0x00000002 #define CPU_HAS_MMX 0x00000004 @@ -61,6 +87,7 @@ #define CPU_HAS_SSE42 0x00000200 #define CPU_HAS_AVX 0x00000400 #define CPU_HAS_AVX2 0x00000800 +#define CPU_HAS_NEON 0x00001000 #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ /* This is the brute force way of detecting instruction sets... @@ -78,6 +105,7 @@ static int CPU_haveCPUID(void) { int has_CPUID = 0; + /* *INDENT-OFF* */ #ifndef SDL_CPUINFO_DISABLED #if defined(__GNUC__) && defined(i386) @@ -212,62 +240,50 @@ done: } #else #define cpuid(func, a, b, c, d) \ - a = b = c = d = 0 + do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0) #endif -static int -CPU_getCPUIDFeatures(void) +static int CPU_CPUIDFeatures[4]; +static int CPU_CPUIDMaxFunction = 0; +static SDL_bool CPU_OSSavesYMM = SDL_FALSE; + +static void +CPU_calcCPUIDFeatures(void) { - int features = 0; - int a, b, c, d; + static SDL_bool checked = SDL_FALSE; + if (!checked) { + checked = SDL_TRUE; + if (CPU_haveCPUID()) { + int a, b, c, d; + cpuid(0, a, b, c, d); + CPU_CPUIDMaxFunction = a; + if (CPU_CPUIDMaxFunction >= 1) { + cpuid(1, a, b, c, d); + CPU_CPUIDFeatures[0] = a; + CPU_CPUIDFeatures[1] = b; + CPU_CPUIDFeatures[2] = c; + CPU_CPUIDFeatures[3] = d; - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - features = d; - } - return features; -} - -static SDL_bool -CPU_OSSavesYMM(void) -{ - int a, b, c, d; - - /* Check to make sure we can call xgetbv */ - cpuid(0, a, b, c, d); - if (a < 1) { - return SDL_FALSE; - } - cpuid(1, a, b, c, d); - if (!(c & 0x08000000)) { - return SDL_FALSE; - } - - /* Call xgetbv to see if YMM register state is saved */ - a = 0; + /* Check to make sure we can call xgetbv */ + if (c & 0x08000000) { + /* Call xgetbv to see if YMM register state is saved */ #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__)) - asm(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx"); + __asm__(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx"); #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */ - a = (int)_xgetbv(0); + a = (int)_xgetbv(0); #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) - __asm - { - xor ecx, ecx - _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 - mov a, eax - } + __asm + { + xor ecx, ecx + _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 + mov a, eax + } #endif - return ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE; -} - -static int -CPU_haveRDTSC(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x00000010); + CPU_OSSavesYMM = ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE; + } + } + } } - return 0; } static int @@ -299,21 +315,61 @@ CPU_haveAltiVec(void) return altivec; } +#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) static int -CPU_haveMMX(void) +readProcAuxvForNeon(void) { - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x00800000); + int neon = 0; + int kv[2]; + const int fd = open("/proc/self/auxv", O_RDONLY); + if (fd != -1) { + while (read(fd, kv, sizeof (kv)) == sizeof (kv)) { + if (kv[0] == AT_HWCAP) { + neon = ((kv[1] & HWCAP_NEON) == HWCAP_NEON); + break; + } + } + close(fd); } + return neon; +} +#endif + + +static int +CPU_haveNEON(void) +{ +/* The way you detect NEON is a privileged instruction on ARM, so you have + query the OS kernel in a platform-specific way. :/ */ +#if defined(SDL_CPUINFO_DISABLED) || !defined(__ARM_ARCH) + return 0; /* disabled or not an ARM CPU at all. */ +#elif __ARM_ARCH >= 8 + return 1; /* ARMv8 always has non-optional NEON support. */ +#elif defined(__APPLE__) && (__ARM_ARCH >= 7) + /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ + return 1; /* all Apple ARMv7 chips and later have NEON. */ +#elif defined(__APPLE__) + return 0; /* assume anything else from Apple doesn't have NEON. */ +#elif defined(__QNXNTO__) + return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON; +#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL) + return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON); +#elif (defined(__LINUX__) || defined(__ANDROID__)) + return readProcAuxvForNeon(); /* Android offers a static library for this, but it just parses /proc/self/auxv */ +#elif (defined(__WINDOWS__) || defined(__WINRT__)) && defined(_M_ARM) + /* All WinRT ARM devices are required to support NEON, but just in case. */ + return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; +#else +#warning SDL_HasNEON is not implemented for this ARM platform. Write me. return 0; +#endif } static int CPU_have3DNow(void) { - if (CPU_haveCPUID()) { + if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */ int a, b, c, d; - cpuid(0x80000000, a, b, c, d); if (a >= 0x80000001) { cpuid(0x80000001, a, b, c, d); @@ -323,95 +379,23 @@ CPU_have3DNow(void) return 0; } -static int -CPU_haveSSE(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x02000000); - } - return 0; -} - -static int -CPU_haveSSE2(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x04000000); - } - return 0; -} - -static int -CPU_haveSSE3(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00000001); - } - } - return 0; -} - -static int -CPU_haveSSE41(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00080000); - } - } - return 0; -} - -static int -CPU_haveSSE42(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00100000); - } - } - return 0; -} - -static int -CPU_haveAVX(void) -{ - if (CPU_haveCPUID() && CPU_OSSavesYMM()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x10000000); - } - } - return 0; -} +#define CPU_haveRDTSC() (CPU_CPUIDFeatures[3] & 0x00000010) +#define CPU_haveMMX() (CPU_CPUIDFeatures[3] & 0x00800000) +#define CPU_haveSSE() (CPU_CPUIDFeatures[3] & 0x02000000) +#define CPU_haveSSE2() (CPU_CPUIDFeatures[3] & 0x04000000) +#define CPU_haveSSE3() (CPU_CPUIDFeatures[2] & 0x00000001) +#define CPU_haveSSE41() (CPU_CPUIDFeatures[2] & 0x00080000) +#define CPU_haveSSE42() (CPU_CPUIDFeatures[2] & 0x00100000) +#define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000)) static int CPU_haveAVX2(void) { - if (CPU_haveCPUID() && CPU_OSSavesYMM()) { + if (CPU_OSSavesYMM && (CPU_CPUIDMaxFunction >= 7)) { int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 7) { - cpuid(7, a, b, c, d); - return (b & 0x00000020); - } + (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */ + cpuid(7, a, b, c, d); + return (b & 0x00000020); } return 0; } @@ -441,6 +425,12 @@ SDL_GetCPUCount(void) SDL_CPUCount = info.dwNumberOfProcessors; } #endif +#ifdef __OS2__ + if (SDL_CPUCount <= 0) { + DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, + &SDL_CPUCount, sizeof(SDL_CPUCount) ); + } +#endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { @@ -459,7 +449,8 @@ SDL_GetCPUType(void) if (!SDL_CPUType[0]) { int i = 0; - if (CPU_haveCPUID()) { + CPU_calcCPUIDFeatures(); + if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ int a, b, c, d; cpuid(0x00000000, a, b, c, d); (void) a; @@ -496,7 +487,8 @@ SDL_GetCPUName(void) int i = 0; int a, b, c, d; - if (CPU_haveCPUID()) { + CPU_calcCPUIDFeatures(); + if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ cpuid(0x80000000, a, b, c, d); if (a >= 0x80000004) { cpuid(0x80000002, a, b, c, d); @@ -584,6 +576,7 @@ static Uint32 SDL_GetCPUFeatures(void) { if (SDL_CPUFeatures == 0xFFFFFFFF) { + CPU_calcCPUIDFeatures(); SDL_CPUFeatures = 0; if (CPU_haveRDTSC()) { SDL_CPUFeatures |= CPU_HAS_RDTSC; @@ -618,107 +611,84 @@ SDL_GetCPUFeatures(void) if (CPU_haveAVX2()) { SDL_CPUFeatures |= CPU_HAS_AVX2; } + if (CPU_haveNEON()) { + SDL_CPUFeatures |= CPU_HAS_NEON; + } } return SDL_CPUFeatures; } -SDL_bool -SDL_HasRDTSC(void) +#define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE) + +SDL_bool SDL_HasRDTSC(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_RDTSC) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_RDTSC); } SDL_bool SDL_HasAltiVec(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_ALTIVEC) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC); } SDL_bool SDL_HasMMX(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_MMX) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX); } SDL_bool SDL_Has3DNow(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_3DNOW) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_3DNOW); } SDL_bool SDL_HasSSE(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE); } SDL_bool SDL_HasSSE2(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE2) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2); } SDL_bool SDL_HasSSE3(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE3) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3); } SDL_bool SDL_HasSSE41(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE41) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41); } SDL_bool SDL_HasSSE42(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE42) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42); } SDL_bool SDL_HasAVX(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_AVX) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX); } SDL_bool SDL_HasAVX2(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_AVX2) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2); +} + +SDL_bool +SDL_HasNEON(void) +{ + return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); } static int SDL_SystemRAM = 0; @@ -762,6 +732,13 @@ SDL_GetSystemRAM(void) } } #endif +#ifdef __OS2__ + if (SDL_SystemRAM <= 0) { + Uint32 sysram = 0; + DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4); + SDL_SystemRAM = (int) (sysram / 0x100000U); + } +#endif #endif } return SDL_SystemRAM; @@ -790,6 +767,7 @@ main() printf("SSE4.2: %d\n", SDL_HasSSE42()); printf("AVX: %d\n", SDL_HasAVX()); printf("AVX2: %d\n", SDL_HasAVX2()); + printf("NEON: %d\n", SDL_HasNEON()); printf("RAM: %d MB\n", SDL_GetSystemRAM()); return 0; } diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi.c b/Engine/lib/sdl/src/dynapi/SDL_dynapi.c index c26baf379..b898826b2 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi.c +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,11 +24,17 @@ #if SDL_DYNAMIC_API +#if defined(__OS2__) +#define INCL_DOS +#define INCL_DOSERRORS +#include +#endif + #include "SDL.h" -/* !!! FIXME: Shouldn't these be included in SDL.h? */ -#include "SDL_shape.h" +/* These headers have system specific definitions, so aren't included above */ #include "SDL_syswm.h" +#include "SDL_vulkan.h" /* This is the version of the dynamic API. This doesn't match the SDL version and should not change until there's been a major revamp in API/ABI. @@ -56,38 +62,38 @@ static void SDL_InitDynamicAPI(void); #if DISABLE_JUMP_MAGIC /* Can't use the macro for varargs nonsense. This is atrocious. */ #define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \ - _static void SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \ va_end(ap); \ } #define SDL_DYNAPI_VARARGS(_static, name, initcall) \ - _static int SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ char buf[512]; /* !!! FIXME: dynamic allocation */ \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \ va_end(ap); \ return jump_table.SDL_SetError("%s", buf); \ } \ - _static int SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsscanf(buf, fmt, ap); \ va_end(ap); \ return retval; \ } \ - _static int SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsnprintf(buf, maxlen, fmt, ap); \ va_end(ap); \ return retval; \ } \ - _static void SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \ va_end(ap); \ } \ - _static void SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, priority, fmt, ap); \ va_end(ap); \ @@ -105,9 +111,9 @@ static void SDL_InitDynamicAPI(void); /* The DEFAULT funcs will init jump table and then call real function. */ /* The REAL funcs are the actual functions, name-mangled to not clash. */ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - typedef rc (*SDL_DYNAPIFN_##fn) params; \ - static rc fn##_DEFAULT params; \ - extern rc fn##_REAL params; + typedef rc (SDLCALL *SDL_DYNAPIFN_##fn) params; \ + static rc SDLCALL fn##_DEFAULT params; \ + extern rc SDLCALL fn##_REAL params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -119,7 +125,7 @@ typedef struct { } SDL_DYNAPI_jump_table; /* Predeclare the default functions for initializing the jump table. */ -#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc fn##_DEFAULT params; +#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc SDLCALL fn##_DEFAULT params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -133,7 +139,7 @@ static SDL_DYNAPI_jump_table jump_table = { /* Default functions init the function table then call right thing. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - static rc fn##_DEFAULT params { \ + static rc SDLCALL fn##_DEFAULT params { \ SDL_InitDynamicAPI(); \ ret jump_table.fn args; \ } @@ -150,7 +156,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI()) /* Public API functions to jump into the jump table. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - rc fn params { ret jump_table.fn args; } + rc SDLCALL fn params { ret jump_table.fn args; } #define SDL_DYNAPI_PROC_NO_VARARGS 1 #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -216,21 +222,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) return retval; } -#elif defined(__HAIKU__) -#include -static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) -{ - image_id lib = load_add_on(fname); - void *retval = NULL; - if (lib >= 0) { - if (get_image_symbol(lib, sym, B_SYMBOL_TYPE_TEXT, &retval) != B_NO_ERROR) { - unload_add_on(lib); - retval = NULL; - } - } - return retval; -} -#elif defined(unix) || defined(__unix__) || defined(__APPLE__) +#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__QNX__) #include static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { @@ -244,6 +236,21 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) } return retval; } + +#elif defined(__OS2__) +static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) +{ + HMODULE hmodule; + PFN retval = NULL; + char error[256]; + if (DosLoadModule(&error, sizeof(error), fname, &hmodule) == NO_ERROR) { + if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) { + DosFreeModule(hmodule); + } + } + return (void *) retval; +} + #else #error Please define your platform. #endif @@ -316,4 +323,3 @@ SDL_InitDynamicAPI(void) #endif /* SDL_DYNAMIC_API */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi.h b/Engine/lib/sdl/src/dynapi/SDL_dynapi.h index 5e78338f2..73316f1f8 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi.h +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_dynapi_h -#define _SDL_dynapi_h +#ifndef SDL_dynapi_h_ +#define SDL_dynapi_h_ /* IMPORTANT: This is the master switch to disabling the dynamic API. We made it so you diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h b/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h index 9541611ce..1ec2eaffd 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,12 +27,6 @@ #error You should not be here. #endif -/* so annoying. */ -#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)) -#define SDL_MemoryBarrierRelease SDL_MemoryBarrierRelease_REAL -#define SDL_MemoryBarrierAcquire SDL_MemoryBarrierAcquire_REAL -#endif - #define SDL_SetError SDL_SetError_REAL #define SDL_Log SDL_Log_REAL #define SDL_LogVerbose SDL_LogVerbose_REAL @@ -612,3 +606,66 @@ #define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL #define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL #define SDL_GetHintBoolean SDL_GetHintBoolean_REAL +#define SDL_JoystickGetDeviceVendor SDL_JoystickGetDeviceVendor_REAL +#define SDL_JoystickGetDeviceProduct SDL_JoystickGetDeviceProduct_REAL +#define SDL_JoystickGetDeviceProductVersion SDL_JoystickGetDeviceProductVersion_REAL +#define SDL_JoystickGetVendor SDL_JoystickGetVendor_REAL +#define SDL_JoystickGetProduct SDL_JoystickGetProduct_REAL +#define SDL_JoystickGetProductVersion SDL_JoystickGetProductVersion_REAL +#define SDL_GameControllerGetVendor SDL_GameControllerGetVendor_REAL +#define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_REAL +#define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_REAL +#define SDL_HasNEON SDL_HasNEON_REAL +#define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_REAL +#define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_REAL +#define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_REAL +#define SDL_JoystickGetDeviceType SDL_JoystickGetDeviceType_REAL +#define SDL_JoystickGetType SDL_JoystickGetType_REAL +#define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL +#define SDL_MemoryBarrierAcquireFunction SDL_MemoryBarrierAcquireFunction_REAL +#define SDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID_REAL +#define SDL_utf8strlen SDL_utf8strlen_REAL +#define SDL_LoadFile_RW SDL_LoadFile_RW_REAL +#define SDL_wcscmp SDL_wcscmp_REAL +#define SDL_ComposeCustomBlendMode SDL_ComposeCustomBlendMode_REAL +#define SDL_DuplicateSurface SDL_DuplicateSurface_REAL +#define SDL_Vulkan_LoadLibrary SDL_Vulkan_LoadLibrary_REAL +#define SDL_Vulkan_GetVkGetInstanceProcAddr SDL_Vulkan_GetVkGetInstanceProcAddr_REAL +#define SDL_Vulkan_UnloadLibrary SDL_Vulkan_UnloadLibrary_REAL +#define SDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions_REAL +#define SDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface_REAL +#define SDL_Vulkan_GetDrawableSize SDL_Vulkan_GetDrawableSize_REAL +#define SDL_LockJoysticks SDL_LockJoysticks_REAL +#define SDL_UnlockJoysticks SDL_UnlockJoysticks_REAL +#define SDL_GetMemoryFunctions SDL_GetMemoryFunctions_REAL +#define SDL_SetMemoryFunctions SDL_SetMemoryFunctions_REAL +#define SDL_GetNumAllocations SDL_GetNumAllocations_REAL +#define SDL_NewAudioStream SDL_NewAudioStream_REAL +#define SDL_AudioStreamPut SDL_AudioStreamPut_REAL +#define SDL_AudioStreamGet SDL_AudioStreamGet_REAL +#define SDL_AudioStreamClear SDL_AudioStreamClear_REAL +#define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_REAL +#define SDL_FreeAudioStream SDL_FreeAudioStream_REAL +#define SDL_AudioStreamFlush SDL_AudioStreamFlush_REAL +#define SDL_acosf SDL_acosf_REAL +#define SDL_asinf SDL_asinf_REAL +#define SDL_atanf SDL_atanf_REAL +#define SDL_atan2f SDL_atan2f_REAL +#define SDL_ceilf SDL_ceilf_REAL +#define SDL_copysignf SDL_copysignf_REAL +#define SDL_fabsf SDL_fabsf_REAL +#define SDL_floorf SDL_floorf_REAL +#define SDL_logf SDL_logf_REAL +#define SDL_powf SDL_powf_REAL +#define SDL_scalbnf SDL_scalbnf_REAL +#define SDL_fmod SDL_fmod_REAL +#define SDL_fmodf SDL_fmodf_REAL +#define SDL_SetYUVConversionMode SDL_SetYUVConversionMode_REAL +#define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL +#define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL +#define SDL_RenderGetMetalLayer SDL_RenderGetMetalLayer_REAL +#define SDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder_REAL +#define SDL_IsAndroidTV SDL_IsAndroidTV_REAL +#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_REAL +#define SDL_log10 SDL_log10_REAL +#define SDL_log10f SDL_log10f_REAL diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h b/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h index a08835b26..b715d33ce 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,6 +50,8 @@ SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF #if defined(__WIN32__) && !defined(HAVE_LIBC) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) +#elif defined(__OS2__) +SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return) #endif @@ -60,12 +62,6 @@ SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(FILE *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return) #endif -/* so annoying. */ -#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)) -SDL_DYNAPI_PROC(void,SDL_MemoryBarrierRelease,(void),(),) -SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquire,(void),(),) -#endif - #ifdef __WIN32__ SDL_DYNAPI_PROC(int,SDL_RegisterApp,(char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),) @@ -73,12 +69,12 @@ SDL_DYNAPI_PROC(int,SDL_Direct3D9GetAdapterIndex,(int a),(a),return) SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a),return) #endif -#if defined(__IPHONEOS__) && __IPHONEOS__ +#ifdef __IPHONEOS__ SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),) #endif -#if defined(__ANDROID__) && __ANDROID__ +#ifdef __ANDROID__ SDL_DYNAPI_PROC(void*,SDL_AndroidGetJNIEnv,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_AndroidGetActivity,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_AndroidGetInternalStoragePath,(void),(),return) @@ -644,3 +640,70 @@ SDL_DYNAPI_PROC(void,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceVendor,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProduct,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProductVersion,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetVendor,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProduct,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProductVersion,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetVendor,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProduct,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProductVersion,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasNEON,(void),(),return) +SDL_DYNAPI_PROC(int,SDL_GameControllerNumMappings,(void),(),return) +SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForIndex,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetDeviceType,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetType,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),) +SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),) +SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return) +SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) +SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) +SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window *a, unsigned int *b, const char **c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) +SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),) +SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),) +SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) +SDL_DYNAPI_PROC(int,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_GetNumAllocations,(void),(),return) +SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_NewAudioStream,(const SDL_AudioFormat a, const Uint8 b, const int c, const SDL_AudioFormat d, const Uint8 e, const int f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(int,SDL_AudioStreamPut,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_AudioStreamGet,(SDL_AudioStream *a, void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_AudioStreamClear,(SDL_AudioStream *a),(a),) +SDL_DYNAPI_PROC(int,SDL_AudioStreamAvailable,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_FreeAudioStream,(SDL_AudioStream *a),(a),) +SDL_DYNAPI_PROC(int,SDL_AudioStreamFlush,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(float,SDL_acosf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_asinf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_atanf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_atan2f,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_ceilf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_copysignf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_fabsf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_floorf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_logf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_powf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return) +SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),) +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return) +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return) +SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalLayer,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalCommandEncoder,(SDL_Renderer *a),(a),return) +#ifdef __WINRT__ +SDL_DYNAPI_PROC(SDL_WinRT_DeviceFamily,SDL_WinRTGetDeviceFamily,(void),(),return) +#endif +#ifdef __ANDROID__ +SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return) +#endif +SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return) +SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return) diff --git a/Engine/lib/sdl/src/dynapi/gendynapi.pl b/Engine/lib/sdl/src/dynapi/gendynapi.pl index 5c3d79608..721241be6 100755 --- a/Engine/lib/sdl/src/dynapi/gendynapi.pl +++ b/Engine/lib/sdl/src/dynapi/gendynapi.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # Simple DirectMedia Layer -# Copyright (C) 1997-2016 Sam Lantinga +# Copyright (C) 1997-2018 Sam Lantinga # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_clipboardevents.c b/Engine/lib/sdl/src/events/SDL_clipboardevents.c index 9b2209bdf..5c45853b7 100644 --- a/Engine/lib/sdl/src/events/SDL_clipboardevents.c +++ b/Engine/lib/sdl/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h b/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h index 98e6a38bd..24c450bab 100644 --- a/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h +++ b/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_clipboardevents_c_h -#define _SDL_clipboardevents_c_h +#ifndef SDL_clipboardevents_c_h_ +#define SDL_clipboardevents_c_h_ extern int SDL_SendClipboardUpdate(void); -#endif /* _SDL_clipboardevents_c_h */ +#endif /* SDL_clipboardevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_dropevents.c b/Engine/lib/sdl/src/events/SDL_dropevents.c index 49b07d9a6..39c512008 100644 --- a/Engine/lib/sdl/src/events/SDL_dropevents.c +++ b/Engine/lib/sdl/src/events/SDL_dropevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_dropevents_c.h b/Engine/lib/sdl/src/events/SDL_dropevents_c.h index a7adb8560..79f37cc16 100644 --- a/Engine/lib/sdl/src/events/SDL_dropevents_c.h +++ b/Engine/lib/sdl/src/events/SDL_dropevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_dropevents_c_h -#define _SDL_dropevents_c_h +#ifndef SDL_dropevents_c_h_ +#define SDL_dropevents_c_h_ extern int SDL_SendDropFile(SDL_Window *window, const char *file); extern int SDL_SendDropText(SDL_Window *window, const char *text); extern int SDL_SendDropComplete(SDL_Window *window); -#endif /* _SDL_dropevents_c_h */ +#endif /* SDL_dropevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_events.c b/Engine/lib/sdl/src/events/SDL_events.c index 2f5b0af29..f2e5b6278 100644 --- a/Engine/lib/sdl/src/events/SDL_events.c +++ b/Engine/lib/sdl/src/events/SDL_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,6 @@ #include "SDL.h" #include "SDL_events.h" -#include "SDL_syswm.h" #include "SDL_thread.h" #include "SDL_events_c.h" #include "../timer/SDL_timer_c.h" @@ -32,21 +31,25 @@ #include "../joystick/SDL_joystick_c.h" #endif #include "../video/SDL_sysvideo.h" +#include "SDL_syswm.h" + +/*#define SDL_DEBUG_EVENTS 1*/ /* An arbitrary limit so we don't have unbounded growth */ #define SDL_MAX_QUEUED_EVENTS 65535 -/* Public data -- the event filter */ -SDL_EventFilter SDL_EventOK = NULL; -void *SDL_EventOKParam; - typedef struct SDL_EventWatcher { SDL_EventFilter callback; void *userdata; - struct SDL_EventWatcher *next; + SDL_bool removed; } SDL_EventWatcher; +static SDL_mutex *SDL_event_watchers_lock; +static SDL_EventWatcher SDL_EventOK; static SDL_EventWatcher *SDL_event_watchers = NULL; +static int SDL_event_watchers_count = 0; +static SDL_bool SDL_event_watchers_dispatching = SDL_FALSE; +static SDL_bool SDL_event_watchers_removed = SDL_FALSE; typedef struct { Uint32 bits[8]; @@ -84,6 +87,230 @@ static struct } SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; +#ifdef SDL_DEBUG_EVENTS + +/* this is to make printf() calls cleaner. */ +#define uint unsigned int + +static void +SDL_DebugPrintEvent(const SDL_Event *event) +{ + /* !!! FIXME: This code is kinda ugly, sorry. */ + printf("SDL EVENT: "); + + if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) { + printf("SDL_USEREVENT"); + if (event->type > SDL_USEREVENT) { + printf("+%u", ((uint) event->type) - SDL_USEREVENT); + } + printf(" (timestamp=%u windowid=%u code=%d data1=%p data2=%p)", + (uint) event->user.timestamp, (uint) event->user.windowID, + (int) event->user.code, event->user.data1, event->user.data2); + return; + } + + switch (event->type) { + #define SDL_EVENT_CASE(x) case x: printf("%s", #x); + SDL_EVENT_CASE(SDL_FIRSTEVENT) printf("(THIS IS PROBABLY A BUG!)"); break; + SDL_EVENT_CASE(SDL_QUIT) printf("(timestamp=%u)", (uint) event->quit.timestamp); break; + SDL_EVENT_CASE(SDL_APP_TERMINATING) break; + SDL_EVENT_CASE(SDL_APP_LOWMEMORY) break; + SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND) break; + SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break; + SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break; + SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break; + SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break; + SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break; + SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break; + SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break; + #undef SDL_EVENT_CASE + + #define SDL_EVENT_CASE(x) case x: printf("%s ", #x); + + SDL_EVENT_CASE(SDL_WINDOWEVENT) + printf("(timestamp=%u windowid=%u event=", (uint) event->window.timestamp, (uint) event->window.windowID); + switch(event->window.event) { + case SDL_WINDOWEVENT_NONE: printf("none(THIS IS PROBABLY A BUG!)"); break; + #define SDL_WINDOWEVENT_CASE(x) case x: printf("%s", #x); break + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST); + #undef SDL_WINDOWEVENT_CASE + default: printf("UNKNOWN(bug? fixme?)"); break; + } + printf(" data1=%d data2=%d)", (int) event->window.data1, (int) event->window.data2); + break; + + SDL_EVENT_CASE(SDL_SYSWMEVENT) + printf("(timestamp=%u)", (uint) event->syswm.timestamp); + /* !!! FIXME: we don't delve further at the moment. */ + break; + + #define PRINT_KEY_EVENT(event) \ + printf("(timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \ + (uint) event->key.timestamp, (uint) event->key.windowID, \ + event->key.state == SDL_PRESSED ? "pressed" : "released", \ + event->key.repeat ? "true" : "false", \ + (uint) event->key.keysym.scancode, \ + (uint) event->key.keysym.sym, \ + (uint) event->key.keysym.mod) + SDL_EVENT_CASE(SDL_KEYDOWN) PRINT_KEY_EVENT(event); break; + SDL_EVENT_CASE(SDL_KEYUP) PRINT_KEY_EVENT(event); break; + #undef PRINT_KEY_EVENT + + SDL_EVENT_CASE(SDL_TEXTEDITING) + printf("(timestamp=%u windowid=%u text='%s' start=%d length=%d)", + (uint) event->edit.timestamp, (uint) event->edit.windowID, + event->edit.text, (int) event->edit.start, (int) event->edit.length); + break; + + SDL_EVENT_CASE(SDL_TEXTINPUT) + printf("(timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text); + break; + + + SDL_EVENT_CASE(SDL_MOUSEMOTION) + printf("(timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)", + (uint) event->motion.timestamp, (uint) event->motion.windowID, + (uint) event->motion.which, (uint) event->motion.state, + (int) event->motion.x, (int) event->motion.y, + (int) event->motion.xrel, (int) event->motion.yrel); + break; + + #define PRINT_MBUTTON_EVENT(event) \ + printf("(timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \ + (uint) event->button.timestamp, (uint) event->button.windowID, \ + (uint) event->button.which, (uint) event->button.button, \ + event->button.state == SDL_PRESSED ? "pressed" : "released", \ + (uint) event->button.clicks, (int) event->button.x, (int) event->button.y) + SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN) PRINT_MBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_MOUSEBUTTONUP) PRINT_MBUTTON_EVENT(event); break; + #undef PRINT_MBUTTON_EVENT + + + SDL_EVENT_CASE(SDL_MOUSEWHEEL) + printf("(timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)", + (uint) event->wheel.timestamp, (uint) event->wheel.windowID, + (uint) event->wheel.which, (int) event->wheel.x, (int) event->wheel.y, + event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped"); + break; + + SDL_EVENT_CASE(SDL_JOYAXISMOTION) + printf("(timestamp=%u which=%d axis=%u value=%d)", + (uint) event->jaxis.timestamp, (int) event->jaxis.which, + (uint) event->jaxis.axis, (int) event->jaxis.value); + break; + + SDL_EVENT_CASE(SDL_JOYBALLMOTION) + printf("(timestamp=%u which=%d ball=%u xrel=%d yrel=%d)", + (uint) event->jball.timestamp, (int) event->jball.which, + (uint) event->jball.ball, (int) event->jball.xrel, (int) event->jball.yrel); + break; + + SDL_EVENT_CASE(SDL_JOYHATMOTION) + printf("(timestamp=%u which=%d hat=%u value=%u)", + (uint) event->jhat.timestamp, (int) event->jhat.which, + (uint) event->jhat.hat, (uint) event->jhat.value); + break; + + #define PRINT_JBUTTON_EVENT(event) \ + printf("(timestamp=%u which=%d button=%u state=%s)", \ + (uint) event->jbutton.timestamp, (int) event->jbutton.which, \ + (uint) event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released") + SDL_EVENT_CASE(SDL_JOYBUTTONDOWN) PRINT_JBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_JOYBUTTONUP) PRINT_JBUTTON_EVENT(event); break; + #undef PRINT_JBUTTON_EVENT + + #define PRINT_JOYDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which) + SDL_EVENT_CASE(SDL_JOYDEVICEADDED) PRINT_JOYDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED) PRINT_JOYDEV_EVENT(event); break; + #undef PRINT_JOYDEV_EVENT + + SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION) + printf("(timestamp=%u which=%d axis=%u value=%d)", + (uint) event->caxis.timestamp, (int) event->caxis.which, + (uint) event->caxis.axis, (int) event->caxis.value); + break; + + #define PRINT_CBUTTON_EVENT(event) \ + printf("(timestamp=%u which=%d button=%u state=%s)", \ + (uint) event->cbutton.timestamp, (int) event->cbutton.which, \ + (uint) event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released") + SDL_EVENT_CASE(SDL_CONTROLLERBUTTONDOWN) PRINT_CBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP) PRINT_CBUTTON_EVENT(event); break; + #undef PRINT_CBUTTON_EVENT + + #define PRINT_CONTROLLERDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which) + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED) PRINT_CONTROLLERDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break; + #undef PRINT_CONTROLLERDEV_EVENT + + #define PRINT_FINGER_EVENT(event) \ + printf("(timestamp=%u touchid=%lld fingerid=%lld x=%f y=%f dx=%f dy=%f pressure=%f)", \ + (uint) event->tfinger.timestamp, (long long) event->tfinger.touchId, \ + (long long) event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ + event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure) + SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; + SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; + SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; + #undef PRINT_FINGER_EVENT + + #define PRINT_DOLLAR_EVENT(event) \ + printf("(timestamp=%u touchid=%lld gestureid=%lld numfingers=%u error=%f x=%f y=%f)", \ + (uint) event->dgesture.timestamp, (long long) event->dgesture.touchId, \ + (long long) event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ + event->dgesture.error, event->dgesture.x, event->dgesture.y); + SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; + SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; + #undef PRINT_DOLLAR_EVENT + + SDL_EVENT_CASE(SDL_MULTIGESTURE) + printf("(timestamp=%u touchid=%lld dtheta=%f ddist=%f x=%f y=%f numfingers=%u)", + (uint) event->mgesture.timestamp, (long long) event->mgesture.touchId, + event->mgesture.dTheta, event->mgesture.dDist, + event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers); + break; + + #define PRINT_DROP_EVENT(event) printf("(file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID) + SDL_EVENT_CASE(SDL_DROPFILE) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPTEXT) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPBEGIN) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break; + #undef PRINT_DROP_EVENT + + #define PRINT_AUDIODEV_EVENT(event) printf("(timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false"); + SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break; + #undef PRINT_AUDIODEV_EVENT + + #undef SDL_EVENT_CASE + + default: + printf("UNKNOWN SDL EVENT #%u! (Bug? FIXME?)", (uint) event->type); + break; + } + + printf("\n"); +} +#undef uint +#endif + + + /* Public functions */ void @@ -141,12 +368,16 @@ SDL_StopEventLoop(void) SDL_disabled_events[i] = NULL; } - while (SDL_event_watchers) { - SDL_EventWatcher *tmp = SDL_event_watchers; - SDL_event_watchers = tmp->next; - SDL_free(tmp); + if (SDL_event_watchers_lock) { + SDL_DestroyMutex(SDL_event_watchers_lock); + SDL_event_watchers_lock = NULL; } - SDL_EventOK = NULL; + if (SDL_event_watchers) { + SDL_free(SDL_event_watchers); + SDL_event_watchers = NULL; + SDL_event_watchers_count = 0; + } + SDL_zero(SDL_EventOK); if (SDL_EventQ.lock) { SDL_UnlockMutex(SDL_EventQ.lock); @@ -169,9 +400,16 @@ SDL_StartEventLoop(void) #if !SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); + if (SDL_EventQ.lock == NULL) { + return -1; + } } - if (SDL_EventQ.lock == NULL) { - return -1; + + if (!SDL_event_watchers_lock) { + SDL_event_watchers_lock = SDL_CreateMutex(); + if (SDL_event_watchers_lock == NULL) { + return -1; + } } #endif /* !SDL_THREADS_DISABLED */ @@ -209,6 +447,10 @@ SDL_AddEvent(SDL_Event * event) SDL_EventQ.free = entry->next; } + #ifdef SDL_DEBUG_EVENTS + SDL_DebugPrintEvent(event); + #endif + entry->event = *event; if (event->type == SDL_SYSWMEVENT) { entry->msg = *event->syswm.msg; @@ -376,7 +618,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType) #endif /* Lock the event queue */ - if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) { + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { SDL_EventEntry *entry, *next; Uint32 type; for (entry = SDL_EventQ.head; entry; entry = next) { @@ -386,7 +628,9 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType) SDL_CutEvent(entry); } } - SDL_UnlockMutex(SDL_EventQ.lock); + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } } } @@ -458,16 +702,46 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) int SDL_PushEvent(SDL_Event * event) { - SDL_EventWatcher *curr; - event->common.timestamp = SDL_GetTicks(); - if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) { - return 0; - } + if (SDL_EventOK.callback || SDL_event_watchers_count > 0) { + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) { + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + return 0; + } - for (curr = SDL_event_watchers; curr; curr = curr->next) { - curr->callback(curr->userdata, event); + if (SDL_event_watchers_count > 0) { + /* Make sure we only dispatch the current watcher list */ + int i, event_watchers_count = SDL_event_watchers_count; + + SDL_event_watchers_dispatching = SDL_TRUE; + for (i = 0; i < event_watchers_count; ++i) { + if (!SDL_event_watchers[i].removed) { + SDL_event_watchers[i].callback(SDL_event_watchers[i].userdata, event); + } + } + SDL_event_watchers_dispatching = SDL_FALSE; + + if (SDL_event_watchers_removed) { + for (i = SDL_event_watchers_count; i--; ) { + if (SDL_event_watchers[i].removed) { + --SDL_event_watchers_count; + if (i < SDL_event_watchers_count) { + SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); + } + } + } + SDL_event_watchers_removed = SDL_FALSE; + } + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } } if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0, 0) <= 0) { @@ -482,69 +756,89 @@ SDL_PushEvent(SDL_Event * event) void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata) { - /* Set filter and discard pending events */ - SDL_EventOK = NULL; - SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); - SDL_EventOKParam = userdata; - SDL_EventOK = filter; + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + /* Set filter and discard pending events */ + SDL_EventOK.callback = filter; + SDL_EventOK.userdata = userdata; + SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } } SDL_bool SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata) { + SDL_EventWatcher event_ok; + + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + event_ok = SDL_EventOK; + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } else { + SDL_zero(event_ok); + } + if (filter) { - *filter = SDL_EventOK; + *filter = event_ok.callback; } if (userdata) { - *userdata = SDL_EventOKParam; + *userdata = event_ok.userdata; } - return SDL_EventOK ? SDL_TRUE : SDL_FALSE; + return event_ok.callback ? SDL_TRUE : SDL_FALSE; } -/* FIXME: This is not thread-safe yet */ void SDL_AddEventWatch(SDL_EventFilter filter, void *userdata) { - SDL_EventWatcher *watcher, *tail; + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + SDL_EventWatcher *event_watchers; - watcher = (SDL_EventWatcher *)SDL_malloc(sizeof(*watcher)); - if (!watcher) { - /* Uh oh... */ - return; - } + event_watchers = SDL_realloc(SDL_event_watchers, (SDL_event_watchers_count + 1) * sizeof(*event_watchers)); + if (event_watchers) { + SDL_EventWatcher *watcher; - /* create the watcher */ - watcher->callback = filter; - watcher->userdata = userdata; - watcher->next = NULL; - - /* add the watcher to the end of the list */ - if (SDL_event_watchers) { - for (tail = SDL_event_watchers; tail->next; tail = tail->next) { - continue; + SDL_event_watchers = event_watchers; + watcher = &SDL_event_watchers[SDL_event_watchers_count]; + watcher->callback = filter; + watcher->userdata = userdata; + watcher->removed = SDL_FALSE; + ++SDL_event_watchers_count; + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); } - tail->next = watcher; - } else { - SDL_event_watchers = watcher; } } -/* FIXME: This is not thread-safe yet */ void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) { - SDL_EventWatcher *prev = NULL; - SDL_EventWatcher *curr; + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + int i; - for (curr = SDL_event_watchers; curr; prev = curr, curr = curr->next) { - if (curr->callback == filter && curr->userdata == userdata) { - if (prev) { - prev->next = curr->next; - } else { - SDL_event_watchers = curr->next; + for (i = 0; i < SDL_event_watchers_count; ++i) { + if (SDL_event_watchers[i].callback == filter && SDL_event_watchers[i].userdata == userdata) { + if (SDL_event_watchers_dispatching) { + SDL_event_watchers[i].removed = SDL_TRUE; + SDL_event_watchers_removed = SDL_TRUE; + } else { + --SDL_event_watchers_count; + if (i < SDL_event_watchers_count) { + SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); + } + } + break; } - SDL_free(curr); - break; + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); } } } @@ -552,7 +846,7 @@ SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) void SDL_FilterEvents(SDL_EventFilter filter, void *userdata) { - if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) { + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { SDL_EventEntry *entry, *next; for (entry = SDL_EventQ.head; entry; entry = next) { next = entry->next; @@ -560,7 +854,9 @@ SDL_FilterEvents(SDL_EventFilter filter, void *userdata) SDL_CutEvent(entry); } } - SDL_UnlockMutex(SDL_EventQ.lock); + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } } } diff --git a/Engine/lib/sdl/src/events/SDL_events_c.h b/Engine/lib/sdl/src/events/SDL_events_c.h index 2e3319047..b1bd277e7 100644 --- a/Engine/lib/sdl/src/events/SDL_events_c.h +++ b/Engine/lib/sdl/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,8 +46,4 @@ extern void SDL_QuitQuit(void); extern void SDL_SendPendingQuit(void); -/* The event filter function */ -extern SDL_EventFilter SDL_EventOK; -extern void *SDL_EventOKParam; - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_gesture.c b/Engine/lib/sdl/src/events/SDL_gesture.c index 43914202c..c3b73e022 100644 --- a/Engine/lib/sdl/src/events/SDL_gesture.c +++ b/Engine/lib/sdl/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,9 +71,9 @@ typedef struct { SDL_bool recording; } SDL_GestureTouch; -SDL_GestureTouch *SDL_gestureTouch; -int SDL_numGestureTouches = 0; -SDL_bool recordAll; +static SDL_GestureTouch *SDL_gestureTouch; +static int SDL_numGestureTouches = 0; +static SDL_bool recordAll; #if 0 static void PrintPath(SDL_FloatPoint *path) @@ -101,6 +101,12 @@ int SDL_RecordGesture(SDL_TouchID touchId) return (touchId < 0); } +void SDL_GestureQuit() +{ + SDL_free(SDL_gestureTouch); + SDL_gestureTouch = NULL; +} + static unsigned long SDL_HashDollar(SDL_FloatPoint* points) { unsigned long hash = 5381; @@ -374,7 +380,7 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) dist += d; } if (numPoints < DOLLARNPOINTS-1) { - SDL_SetError("ERROR: NumPoints = %i\n",numPoints); + SDL_SetError("ERROR: NumPoints = %i", numPoints); return 0; } /* copy the last point */ @@ -457,6 +463,28 @@ int SDL_GestureAddTouch(SDL_TouchID touchId) return 0; } +int SDL_GestureDelTouch(SDL_TouchID touchId) +{ + int i; + for (i = 0; i < SDL_numGestureTouches; i++) { + if (SDL_gestureTouch[i].id == touchId) { + break; + } + } + + if (i == SDL_numGestureTouches) { + /* not found */ + return -1; + } + + SDL_free(SDL_gestureTouch[i].dollarTemplate); + SDL_zero(SDL_gestureTouch[i]); + + SDL_numGestureTouches--; + SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i])); + return 0; +} + static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) { int i; @@ -468,7 +496,7 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) return NULL; } -int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) +static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) { SDL_Event event; event.mgesture.type = SDL_MULTIGESTURE; diff --git a/Engine/lib/sdl/src/events/SDL_gesture_c.h b/Engine/lib/sdl/src/events/SDL_gesture_c.h index 3ff542cbb..b8e4427f0 100644 --- a/Engine/lib/sdl/src/events/SDL_gesture_c.h +++ b/Engine/lib/sdl/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,15 +20,16 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_gesture_c_h -#define _SDL_gesture_c_h +#ifndef SDL_gesture_c_h_ +#define SDL_gesture_c_h_ extern int SDL_GestureAddTouch(SDL_TouchID touchId); +extern int SDL_GestureDelTouch(SDL_TouchID touchId); extern void SDL_GestureProcessEvent(SDL_Event* event); -extern int SDL_RecordGesture(SDL_TouchID touchId); +extern void SDL_GestureQuit(void); -#endif /* _SDL_gesture_c_h */ +#endif /* SDL_gesture_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_keyboard.c b/Engine/lib/sdl/src/events/SDL_keyboard.c index 15726545c..e1295764e 100644 --- a/Engine/lib/sdl/src/events/SDL_keyboard.c +++ b/Engine/lib/sdl/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -273,6 +273,10 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { SDLK_KBDILLUMUP, SDLK_EJECT, SDLK_SLEEP, + SDLK_APP1, + SDLK_APP2, + SDLK_AUDIOREWIND, + SDLK_AUDIOFASTFORWARD, }; static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { @@ -505,6 +509,10 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { "KBDIllumUp", "Eject", "Sleep", + "App1", + "App2", + "AudioRewind", + "AudioFastForward", }; /* Taken from SDL_iconv() */ @@ -569,7 +577,7 @@ SDL_ResetKeyboard(void) #ifdef DEBUG_KEYBOARD printf("Resetting keyboard\n"); #endif - for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) { + for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keystate[scancode] == SDL_PRESSED) { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } @@ -586,12 +594,22 @@ void SDL_SetKeymap(int start, SDL_Keycode * keys, int length) { SDL_Keyboard *keyboard = &SDL_keyboard; + SDL_Scancode scancode; if (start < 0 || start + length > SDL_NUM_SCANCODES) { return; } SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length); + + /* The number key scancodes always map to the number key keycodes. + * On AZERTY layouts these technically are symbols, but users (and games) + * always think of them and view them in UI as number keys. + */ + keyboard->keymap[SDL_SCANCODE_0] = SDLK_0; + for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) { + keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1); + } } void @@ -664,7 +682,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) int posted; SDL_Keymod modifier; SDL_Keycode keycode; - Uint16 modstate; Uint32 type; Uint8 repeat; @@ -737,7 +754,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) break; } if (SDL_KEYDOWN == type) { - modstate = keyboard->modstate; switch (keycode) { case SDLK_NUMLOCKCLEAR: keyboard->modstate ^= KMOD_NUM; @@ -751,7 +767,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) } } else { keyboard->modstate &= ~modifier; - modstate = keyboard->modstate; } /* Post the event, if desired */ @@ -763,7 +778,7 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) event.key.repeat = repeat; event.key.keysym.scancode = scancode; event.key.keysym.sym = keycode; - event.key.keysym.mod = modstate; + event.key.keysym.mod = keyboard->modstate; event.key.windowID = keyboard->focus ? keyboard->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } @@ -834,7 +849,7 @@ SDL_GetModState(void) { SDL_Keyboard *keyboard = &SDL_keyboard; - return keyboard->modstate; + return (SDL_Keymod) keyboard->modstate; } void @@ -863,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode) { SDL_Keyboard *keyboard = &SDL_keyboard; - if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return 0; } @@ -890,7 +905,7 @@ const char * SDL_GetScancodeName(SDL_Scancode scancode) { const char *name; - if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return ""; } @@ -968,8 +983,10 @@ SDL_GetKeyFromName(const char *name) { SDL_Keycode key; - /* Check input */ - if (name == NULL) return SDLK_UNKNOWN; + /* Check input */ + if (name == NULL) { + return SDLK_UNKNOWN; + } /* If it's a single UTF-8 character, then that's the keycode itself */ key = *(const unsigned char *)name; diff --git a/Engine/lib/sdl/src/events/SDL_keyboard_c.h b/Engine/lib/sdl/src/events/SDL_keyboard_c.h index b4d1c0739..7f12a382a 100644 --- a/Engine/lib/sdl/src/events/SDL_keyboard_c.h +++ b/Engine/lib/sdl/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_keyboard_c_h -#define _SDL_keyboard_c_h +#ifndef SDL_keyboard_c_h_ +#define SDL_keyboard_c_h_ #include "SDL_keycode.h" #include "SDL_events.h" @@ -65,6 +65,6 @@ extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst); /* Toggle on or off pieces of the keyboard mod state. */ extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle); -#endif /* _SDL_keyboard_c_h */ +#endif /* SDL_keyboard_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_mouse.c b/Engine/lib/sdl/src/events/SDL_mouse.c index 4236a9901..4f4e62f87 100644 --- a/Engine/lib/sdl/src/events/SDL_mouse.c +++ b/Engine/lib/sdl/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,6 @@ #include "SDL_timer.h" #include "SDL_events.h" #include "SDL_events_c.h" -#include "default_cursor.h" #include "../video/SDL_sysvideo.h" /* #define DEBUG_MOUSE */ @@ -40,12 +39,59 @@ static int SDL_double_click_radius = 1; static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); +static void SDLCALL +SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->normal_speed_scale = (float)SDL_atof(hint); + } else { + mouse->normal_speed_scale = 1.0f; + } +} + +static void SDLCALL +SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->relative_speed_scale = (float)SDL_atof(hint); + } else { + mouse->relative_speed_scale = 1.0f; + } +} + +static void SDLCALL +SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) { + mouse->touch_mouse_events = SDL_FALSE; + } else { + mouse->touch_mouse_events = SDL_TRUE; + } +} + /* Public functions */ int SDL_MouseInit(void) { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_zerop(mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + SDL_MouseNormalSpeedScaleChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + SDL_MouseRelativeSpeedScaleChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, + SDL_TouchMouseEventsChanged, mouse); + mouse->cursor_shown = SDL_TRUE; return (0); @@ -82,6 +128,7 @@ SDL_GetMouseFocus(void) return mouse->focus; } +#if 0 void SDL_ResetMouse(void) { @@ -98,6 +145,7 @@ SDL_ResetMouse(void) } SDL_assert(mouse->buttonstate == 0); } +#endif void SDL_SetMouseFocus(SDL_Window * window) @@ -126,6 +174,7 @@ SDL_SetMouseFocus(SDL_Window * window) } mouse->focus = window; + mouse->has_position = SDL_FALSE; if (mouse->focus) { SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0); @@ -176,10 +225,10 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate) if (window != mouse->focus) { #ifdef DEBUG_MOUSE - printf("Mouse entered window, synthesizing focus gain & move event\n"); + printf("Mouse entered window, synthesizing focus gain & move event\n"); #endif - SDL_SetMouseFocus(window); - SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); + SDL_SetMouseFocus(window); + SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); } return SDL_TRUE; } @@ -197,6 +246,21 @@ SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int return SDL_PrivateSendMouseMotion(window, mouseID, relative, x, y); } +static int +GetScaledMouseDelta(float scale, int value, float *accum) +{ + if (scale != 1.0f) { + *accum += scale * value; + if (*accum >= 0.0f) { + value = (int)SDL_floor(*accum); + } else { + value = (int)SDL_ceil(*accum); + } + *accum -= value; + } + return value; +} + static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y) { @@ -205,7 +269,11 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ int xrel; int yrel; - if (mouse->relative_mode_warp) { + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { + return 0; + } + + if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { int center_x = 0, center_y = 0; SDL_GetWindowSize(window, ¢er_x, ¢er_y); center_x /= 2; @@ -219,6 +287,13 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ } if (relative) { + if (mouse->relative_mode) { + x = GetScaledMouseDelta(mouse->relative_speed_scale, x, &mouse->scale_accum_x); + y = GetScaledMouseDelta(mouse->relative_speed_scale, y, &mouse->scale_accum_y); + } else { + x = GetScaledMouseDelta(mouse->normal_speed_scale, x, &mouse->scale_accum_x); + y = GetScaledMouseDelta(mouse->normal_speed_scale, y, &mouse->scale_accum_y); + } xrel = x; yrel = y; x = (mouse->last_x + xrel); @@ -236,6 +311,19 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ return 0; } + /* Ignore relative motion when first positioning the mouse */ + if (!mouse->has_position) { + xrel = 0; + yrel = 0; + mouse->has_position = SDL_TRUE; + } + + /* Ignore relative motion positioning the first touch */ + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->buttonstate) { + xrel = 0; + yrel = 0; + } + /* Update internal mouse coordinates */ if (!mouse->relative_mode) { mouse->x = x; @@ -250,7 +338,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) { int x_max = 0, y_max = 0; - // !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? + /* !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? */ SDL_GetWindowSize(mouse->focus, &x_max, &y_max); --x_max; --y_max; @@ -330,6 +418,10 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state Uint32 type; Uint32 buttonstate = mouse->buttonstate; + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { + return 0; + } + /* Figure out which event to perform */ switch (state) { case SDL_PRESSED: @@ -417,10 +509,11 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 } int -SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction) +SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; + int integral_x, integral_y; if (window) { SDL_SetMouseFocus(window); @@ -430,6 +523,26 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M return 0; } + mouse->accumulated_wheel_x += x; + if (mouse->accumulated_wheel_x > 0) { + integral_x = (int)SDL_floor(mouse->accumulated_wheel_x); + } else if (mouse->accumulated_wheel_x < 0) { + integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x); + } else { + integral_x = 0; + } + mouse->accumulated_wheel_x -= integral_x; + + mouse->accumulated_wheel_y += y; + if (mouse->accumulated_wheel_y > 0) { + integral_y = (int)SDL_floor(mouse->accumulated_wheel_y); + } else if (mouse->accumulated_wheel_y < 0) { + integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y); + } else { + integral_y = 0; + } + mouse->accumulated_wheel_y -= integral_y; + /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) { @@ -437,8 +550,12 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M event.type = SDL_MOUSEWHEEL; event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; event.wheel.which = mouseID; - event.wheel.x = x; - event.wheel.y = y; +#if 0 /* Uncomment this when it goes in for SDL 2.1 */ + event.wheel.preciseX = x; + event.wheel.preciseY = y; +#endif + event.wheel.x = integral_x; + event.wheel.y = integral_y; event.wheel.direction = (Uint32)direction; posted = (SDL_PushEvent(&event) > 0); } @@ -463,16 +580,23 @@ SDL_MouseQuit(void) SDL_FreeCursor(cursor); cursor = next; } + mouse->cursors = NULL; if (mouse->def_cursor && mouse->FreeCursor) { mouse->FreeCursor(mouse->def_cursor); + mouse->def_cursor = NULL; } if (mouse->clickstate) { SDL_free(mouse->clickstate); + mouse->clickstate = NULL; } - SDL_zerop(mouse); + SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + SDL_MouseNormalSpeedScaleChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + SDL_MouseRelativeSpeedScaleChanged, mouse); } Uint32 @@ -522,7 +646,6 @@ SDL_GetGlobalMouseState(int *x, int *y) *x = *y = 0; if (!mouse->GetGlobalMouseState) { - SDL_assert(0 && "This should really be implemented for every target."); return 0; } @@ -601,6 +724,8 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) } } mouse->relative_mode = enabled; + mouse->scale_accum_x = 0.0f; + mouse->scale_accum_y = 0.0f; if (mouse->focus) { SDL_UpdateWindowGrab(mouse->focus); diff --git a/Engine/lib/sdl/src/events/SDL_mouse_c.h b/Engine/lib/sdl/src/events/SDL_mouse_c.h index 06dc88701..28089e0c4 100644 --- a/Engine/lib/sdl/src/events/SDL_mouse_c.h +++ b/Engine/lib/sdl/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_mouse_c_h -#define _SDL_mouse_c_h +#ifndef SDL_mouse_c_h_ +#define SDL_mouse_c_h_ #include "SDL_mouse.h" @@ -80,9 +80,17 @@ typedef struct int xdelta; int ydelta; int last_x, last_y; /* the last reported x and y coordinates */ + float accumulated_wheel_x; + float accumulated_wheel_y; Uint32 buttonstate; + SDL_bool has_position; SDL_bool relative_mode; SDL_bool relative_mode_warp; + float normal_speed_scale; + float relative_speed_scale; + float scale_accum_x; + float scale_accum_y; + SDL_bool touch_mouse_events; /* Data for double-click tracking */ int num_clickstates; @@ -123,11 +131,11 @@ extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 s extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks); /* Send a mouse wheel event */ -extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction); +extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); -#endif /* _SDL_mouse_c_h */ +#endif /* SDL_mouse_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_quit.c b/Engine/lib/sdl/src/events/SDL_quit.c index 3cb6b3d4f..2b24efe3c 100644 --- a/Engine/lib/sdl/src/events/SDL_quit.c +++ b/Engine/lib/sdl/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,7 +55,7 @@ SDL_QuitInit_Internal(void) struct sigaction action; sigaction(SIGINT, NULL, &action); #ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { + if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { #else if ( action.sa_handler == SIG_DFL ) { #endif @@ -65,7 +65,7 @@ SDL_QuitInit_Internal(void) sigaction(SIGTERM, NULL, &action); #ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { + if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { #else if ( action.sa_handler == SIG_DFL ) { #endif diff --git a/Engine/lib/sdl/src/events/SDL_sysevents.h b/Engine/lib/sdl/src/events/SDL_sysevents.h index c4ce08764..3d9ab922d 100644 --- a/Engine/lib/sdl/src/events/SDL_sysevents.h +++ b/Engine/lib/sdl/src/events/SDL_sysevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_touch.c b/Engine/lib/sdl/src/events/SDL_touch.c index c73827c96..003741644 100644 --- a/Engine/lib/sdl/src/events/SDL_touch.c +++ b/Engine/lib/sdl/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_events_c.h" +#include "../video/SDL_sysvideo.h" static int SDL_num_touch = 0; @@ -48,7 +49,7 @@ SDL_TouchID SDL_GetTouchDevice(int index) { if (index < 0 || index >= SDL_num_touch) { - SDL_SetError("Unknown touch device"); + SDL_SetError("Unknown touch device index %d", index); return 0; } return SDL_touchDevices[index]->id; @@ -74,7 +75,12 @@ SDL_GetTouch(SDL_TouchID id) { int index = SDL_GetTouchIndex(id); if (index < 0 || index >= SDL_num_touch) { - SDL_SetError("Unknown touch device"); + if (SDL_GetVideoDevice()->ResetTouch != NULL) { + SDL_SetError("Unknown touch id %d, resetting", (int) id); + (SDL_GetVideoDevice()->ResetTouch)(SDL_GetVideoDevice()); + } else { + SDL_SetError("Unknown touch device id %d, cannot reset", (int) id); + } return NULL; } return SDL_touchDevices[index]; @@ -92,7 +98,7 @@ SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid) return -1; } -SDL_Finger * +static SDL_Finger * SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id) { int index = SDL_GetFingerIndex(touch, id); @@ -346,6 +352,9 @@ SDL_DelTouch(SDL_TouchID id) SDL_num_touch--; SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch]; + + /* Delete this touch device for gestures */ + SDL_GestureDelTouch(id); } void @@ -360,6 +369,7 @@ SDL_TouchQuit(void) SDL_free(SDL_touchDevices); SDL_touchDevices = NULL; + SDL_GestureQuit(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_touch_c.h b/Engine/lib/sdl/src/events/SDL_touch_c.h index d025df6e8..2a4431026 100644 --- a/Engine/lib/sdl/src/events/SDL_touch_c.h +++ b/Engine/lib/sdl/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../SDL_internal.h" #include "../../include/SDL_touch.h" -#ifndef _SDL_touch_c_h -#define _SDL_touch_c_h +#ifndef SDL_touch_c_h_ +#define SDL_touch_c_h_ typedef struct SDL_Touch { @@ -56,6 +56,6 @@ extern void SDL_DelTouch(SDL_TouchID id); /* Shutdown the touch subsystem */ extern void SDL_TouchQuit(void); -#endif /* _SDL_touch_c_h */ +#endif /* SDL_touch_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_windowevents.c b/Engine/lib/sdl/src/events/SDL_windowevents.c index b45015bd0..610fad5ce 100644 --- a/Engine/lib/sdl/src/events/SDL_windowevents.c +++ b/Engine/lib/sdl/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ #include "../video/SDL_sysvideo.h" -static int +static int SDLCALL RemovePendingResizedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; @@ -42,7 +42,7 @@ RemovePendingResizedEvents(void * userdata, SDL_Event *event) return 1; } -static int +static int SDLCALL RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; @@ -56,7 +56,7 @@ RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event) return 1; } -static int +static int SDLCALL RemovePendingMoveEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; @@ -70,7 +70,7 @@ RemovePendingMoveEvents(void * userdata, SDL_Event *event) return 1; } -static int +static int SDLCALL RemovePendingExposedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; diff --git a/Engine/lib/sdl/src/events/SDL_windowevents_c.h b/Engine/lib/sdl/src/events/SDL_windowevents_c.h index 2a6a4c051..a529a1131 100644 --- a/Engine/lib/sdl/src/events/SDL_windowevents_c.h +++ b/Engine/lib/sdl/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_windowevents_c_h -#define _SDL_windowevents_c_h +#ifndef SDL_windowevents_c_h_ +#define SDL_windowevents_c_h_ extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, int data2); -#endif /* _SDL_windowevents_c_h */ +#endif /* SDL_windowevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/blank_cursor.h b/Engine/lib/sdl/src/events/blank_cursor.h index 5e15852cb..bc1bffa85 100644 --- a/Engine/lib/sdl/src/events/blank_cursor.h +++ b/Engine/lib/sdl/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/default_cursor.h b/Engine/lib/sdl/src/events/default_cursor.h index 297dd2dc1..27e82ff73 100644 --- a/Engine/lib/sdl/src/events/default_cursor.h +++ b/Engine/lib/sdl/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/scancodes_darwin.h b/Engine/lib/sdl/src/events/scancodes_darwin.h index 269225309..7848d86f4 100644 --- a/Engine/lib/sdl/src/events/scancodes_darwin.h +++ b/Engine/lib/sdl/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/scancodes_linux.h b/Engine/lib/sdl/src/events/scancodes_linux.h index e197ee3fe..3fec4b597 100644 --- a/Engine/lib/sdl/src/events/scancodes_linux.h +++ b/Engine/lib/sdl/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -194,7 +194,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */ /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */ /* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */ - /* 168 */ SDL_SCANCODE_UNKNOWN, /* KEY_REWIND */ + /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */ /* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */ @@ -230,7 +230,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */ /* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */ /* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */ - /* 208 */ SDL_SCANCODE_UNKNOWN, /* KEY_FASTFORWARD */ + /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */ /* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */ /* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */ /* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */ diff --git a/Engine/lib/sdl/src/events/scancodes_windows.h b/Engine/lib/sdl/src/events/scancodes_windows.h index b23a261ea..f8eed1b9c 100644 --- a/Engine/lib/sdl/src/events/scancodes_windows.h +++ b/Engine/lib/sdl/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/scancodes_xfree86.h b/Engine/lib/sdl/src/events/scancodes_xfree86.h index 804196ca4..7d1f844b0 100644 --- a/Engine/lib/sdl/src/events/scancodes_xfree86.h +++ b/Engine/lib/sdl/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -345,7 +345,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = { /* 165 */ SDL_SCANCODE_AUDIOPREV, /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */ - /* 168 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRewind */ + /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* 171 */ SDL_SCANCODE_F13, /* XF86Tools */ diff --git a/Engine/lib/sdl/src/file/SDL_rwops.c b/Engine/lib/sdl/src/file/SDL_rwops.c index 38beb6285..cf5d3aa0b 100644 --- a/Engine/lib/sdl/src/file/SDL_rwops.c +++ b/Engine/lib/sdl/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,14 +18,27 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +/* We won't get fseeko64 on QNX if _LARGEFILE64_SOURCE is defined, but the + configure script knows the C runtime has it and enables it. */ +#ifndef __QNXNTO__ /* Need this so Linux systems define fseek64o, ftell64o and off64_t */ #define _LARGEFILE64_SOURCE +#endif + #include "../SDL_internal.h" #if defined(__WIN32__) #include "../core/windows/SDL_windows.h" #endif +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_LIMITS_H +#include +#endif /* This file provides a general interface for SDL to read and write data sources. It can easily be extended to files, memory, etc. @@ -292,6 +305,42 @@ windows_file_close(SDL_RWops * context) #ifdef HAVE_STDIO_H +#ifdef HAVE_FOPEN64 +#define fopen fopen64 +#endif +#ifdef HAVE_FSEEKO64 +#define fseek_off_t off64_t +#define fseek fseeko64 +#define ftell ftello64 +#elif defined(HAVE_FSEEKO) +#if defined(OFF_MIN) && defined(OFF_MAX) +#define FSEEK_OFF_MIN OFF_MIN +#define FSEEK_OFF_MAX OFF_MAX +#elif defined(HAVE_LIMITS_H) +/* POSIX doesn't specify the minimum and maximum macros for off_t so + * we have to improvise and dance around implementation-defined + * behavior. This may fail if the off_t type has padding bits or + * is not a two's-complement representation. The compilers will detect + * and eliminate the dead code if off_t has 64 bits. + */ +#define FSEEK_OFF_MAX (((((off_t)1 << (sizeof(off_t) * CHAR_BIT - 2)) - 1) << 1) + 1) +#define FSEEK_OFF_MIN (-(FSEEK_OFF_MAX) - 1) +#endif +#define fseek_off_t off_t +#define fseek fseeko +#define ftell ftello +#elif defined(HAVE__FSEEKI64) +#define fseek_off_t __int64 +#define fseek _fseeki64 +#define ftell _ftelli64 +#else +#ifdef HAVE_LIMITS_H +#define FSEEK_OFF_MIN LONG_MIN +#define FSEEK_OFF_MAX LONG_MAX +#endif +#define fseek_off_t long +#endif + /* Functions to read/write stdio file pointers */ static Sint64 SDLCALL @@ -312,23 +361,19 @@ stdio_size(SDL_RWops * context) static Sint64 SDLCALL stdio_seek(SDL_RWops * context, Sint64 offset, int whence) { -#ifdef HAVE_FSEEKO64 - if (fseeko64(context->hidden.stdio.fp, (off64_t)offset, whence) == 0) { - return ftello64(context->hidden.stdio.fp); - } -#elif defined(HAVE_FSEEKO) - if (fseeko(context->hidden.stdio.fp, (off_t)offset, whence) == 0) { - return ftello(context->hidden.stdio.fp); - } -#elif defined(HAVE__FSEEKI64) - if (_fseeki64(context->hidden.stdio.fp, offset, whence) == 0) { - return _ftelli64(context->hidden.stdio.fp); - } -#else - if (fseek(context->hidden.stdio.fp, offset, whence) == 0) { - return ftell(context->hidden.stdio.fp); +#if defined(FSEEK_OFF_MIN) && defined(FSEEK_OFF_MAX) + if (offset < (Sint64)(FSEEK_OFF_MIN) || offset > (Sint64)(FSEEK_OFF_MAX)) { + return SDL_SetError("Seek offset out of range"); } #endif + + if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, whence) == 0) { + Sint64 pos = ftell(context->hidden.stdio.fp); + if (pos < 0) { + return SDL_SetError("Couldn't get stream offset"); + } + return pos; + } return SDL_Error(SDL_EFSEEK); } @@ -653,6 +698,59 @@ SDL_FreeRW(SDL_RWops * area) SDL_free(area); } +/* Load all the data from an SDL data stream */ +void * +SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc) +{ + const int FILE_CHUNK_SIZE = 1024; + Sint64 size; + size_t size_read, size_total; + void *data = NULL, *newdata; + + if (!src) { + SDL_InvalidParamError("src"); + return NULL; + } + + size = SDL_RWsize(src); + if (size < 0) { + size = FILE_CHUNK_SIZE; + } + data = SDL_malloc((size_t)(size + 1)); + + size_total = 0; + for (;;) { + if ((((Sint64)size_total) + FILE_CHUNK_SIZE) > size) { + size = (size_total + FILE_CHUNK_SIZE); + newdata = SDL_realloc(data, (size_t)(size + 1)); + if (!newdata) { + SDL_free(data); + data = NULL; + SDL_OutOfMemory(); + goto done; + } + data = newdata; + } + + size_read = SDL_RWread(src, (char *)data+size_total, 1, (size_t)(size-size_total)); + if (size_read == 0) { + break; + } + size_total += size_read; + } + + if (datasize) { + *datasize = size_total; + } + ((char *)data)[size_total] = '\0'; + +done: + if (freesrc && src) { + SDL_RWclose(src); + } + return data; +} + /* Functions for dynamically reading and writing endian-specific values */ Uint8 diff --git a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h index 2c63f1dab..64edc0d0e 100644 --- a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h +++ b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m index 3385d3aa5..8f1bf54d7 100644 --- a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c index 3bdf9966d..7f3f92d7d 100644 --- a/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,6 @@ /* System dependent filesystem routines */ #include -#include #include "SDL_error.h" #include "SDL_filesystem.h" @@ -37,6 +36,7 @@ char * SDL_GetBasePath(void) { /* The current working directory is / on Android */ + SDL_Unsupported(); return NULL; } diff --git a/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m b/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m index 6dee58052..6153a2086 100644 --- a/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,8 +71,15 @@ char * SDL_GetPrefPath(const char *org, const char *app) { @autoreleasepool { - char *retval = NULL; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + char *retval = NULL; NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); if ([array count] > 0) { /* we only want the first item in the list. */ @@ -85,7 +92,11 @@ SDL_GetPrefPath(const char *org, const char *app) SDL_OutOfMemory(); } else { char *ptr; - SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); + } else { + SDL_snprintf(retval, len, "%s/%s/", base, app); + } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { *ptr = '\0'; diff --git a/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c index 2570f4c75..f4628a10e 100644 --- a/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c index ca49df1b9..4ba57c1a9 100644 --- a/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,6 +46,14 @@ SDL_GetPrefPath(const char *org, const char *app) char *retval; size_t len = 0; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *) SDL_malloc(len); if (!retval) { @@ -53,7 +61,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_snprintf(retval, len, "%s%s/%s/", append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s/%s/", append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s/", append, app); + } if (mkdir(retval, 0700) != 0 && errno != EEXIST) { SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno)); diff --git a/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc b/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc index 03489168e..b56bc4bbe 100644 --- a/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,10 +25,10 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ -#include -#include -#include -#include +#include +#include +#include +#include #include "SDL_error.h" #include "SDL_stdinc.h" @@ -75,13 +75,30 @@ SDL_GetPrefPath(const char *org, const char *app) { // !!! FIXME: is there a better way to do this? const char *home = SDL_getenv("HOME"); - const char *append = "config/settings/"; - const size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; + const char *append = "/config/settings/"; + size_t len = SDL_strlen(home); + + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + + if (!len || (home[len - 1] == '/')) { + ++append; // home empty or ends with separator, skip the one from append + } + len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; char *retval = (char *) SDL_malloc(len); if (!retval) { SDL_OutOfMemory(); } else { - SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s%s/", home, append, app); + } create_directory(retval, 0700); // Haiku api: creates missing dirs } diff --git a/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c index ac8fef1e3..f22ca75a6 100644 --- a/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,3 +40,4 @@ SDL_GetPrefPath(const char *org, const char *app) #endif /* SDL_FILESYSTEM_NACL */ +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c index bd2e84cd1..d6af39f5b 100644 --- a/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,7 @@ #include #include #include +#include #if defined(__FREEBSD__) || defined(__OPENBSD__) #include @@ -40,7 +41,10 @@ #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" +#include "SDL_rwops.h" +/* QNX's /proc/self/exefile is a text file and not a symlink. */ +#if !defined(__QNXNTO__) static char * readSymLink(const char *path) { @@ -72,7 +76,7 @@ readSymLink(const char *path) SDL_free(retval); return NULL; } - +#endif char * SDL_GetBasePath(void) @@ -122,13 +126,17 @@ SDL_GetBasePath(void) /* is a Linux-style /proc filesystem available? */ if (!retval && (access("/proc", F_OK) == 0)) { + /* !!! FIXME: after 2.0.6 ships, let's delete this code and just + use the /proc/%llu version. There's no reason to have + two copies of this plus all the #ifdefs. --ryan. */ #if defined(__FREEBSD__) retval = readSymLink("/proc/curproc/file"); #elif defined(__NETBSD__) retval = readSymLink("/proc/curproc/exe"); +#elif defined(__QNXNTO__) + retval = SDL_LoadFile("/proc/self/exefile", NULL); #else retval = readSymLink("/proc/self/exe"); /* linux. */ -#endif if (retval == NULL) { /* older kernels don't have /proc/self ... try PID version... */ char path[64]; @@ -139,6 +147,7 @@ SDL_GetBasePath(void) retval = readSymLink(path); } } +#endif } /* If we had access to argv[0] here, we could check it for a path, @@ -180,6 +189,14 @@ SDL_GetPrefPath(const char *org, const char *app) char *ptr = NULL; size_t len = 0; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + if (!envr) { /* You end up with "$HOME/.local/share/Game Name 2" */ envr = SDL_getenv("HOME"); @@ -204,7 +221,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s%s/", envr, append, app); + } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { diff --git a/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c index fd942d75f..52197891a 100644 --- a/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,6 +118,14 @@ SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path))) { WIN_SetError("Couldn't locate our prefpath"); return NULL; @@ -145,8 +153,10 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - lstrcatW(path, L"\\"); - lstrcatW(path, worg); + if (*worg) { + lstrcatW(path, L"\\"); + lstrcatW(path, worg); + } SDL_free(worg); api_result = CreateDirectoryW(path, NULL); diff --git a/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp b/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp index b4caf9037..71818dd26 100644 --- a/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -152,6 +152,14 @@ SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + srcPath = SDL_WinRTGetFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER); if ( ! srcPath) { SDL_SetError("Unable to find a source path"); @@ -186,9 +194,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_wcslcat(path, L"\\", new_wpath_len + 1); - SDL_wcslcat(path, worg, new_wpath_len + 1); - SDL_free(worg); + if (*worg) { + SDL_wcslcat(path, L"\\", new_wpath_len + 1); + SDL_wcslcat(path, worg, new_wpath_len + 1); + SDL_free(worg); + } api_result = CreateDirectoryW(path, NULL); if (api_result == FALSE) { @@ -219,3 +229,5 @@ SDL_GetPrefPath(const char *org, const char *app) } #endif /* __WINRT__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/SDL_haptic.c b/Engine/lib/sdl/src/haptic/SDL_haptic.c index ddce908d6..4988c30ba 100644 --- a/Engine/lib/sdl/src/haptic/SDL_haptic.c +++ b/Engine/lib/sdl/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,9 +25,9 @@ #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ #include "SDL_assert.h" +/* Global for SDL_windowshaptic.c */ SDL_Haptic *SDL_haptics = NULL; - /* * Initializes the Haptic devices. */ @@ -313,6 +313,7 @@ SDL_HapticOpenFromJoystick(SDL_Joystick * joystick) SDL_memset(haptic, 0, sizeof(SDL_Haptic)); haptic->rumble_id = -1; if (SDL_SYS_HapticOpenFromJoystick(haptic, joystick) < 0) { + SDL_SetError("Haptic: SDL_SYS_HapticOpenFromJoystick failed."); SDL_free(haptic); return NULL; } diff --git a/Engine/lib/sdl/src/haptic/SDL_haptic_c.h b/Engine/lib/sdl/src/haptic/SDL_haptic_c.h index 5b9372b5c..26d900d44 100644 --- a/Engine/lib/sdl/src/haptic/SDL_haptic_c.h +++ b/Engine/lib/sdl/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/SDL_syshaptic.h b/Engine/lib/sdl/src/haptic/SDL_syshaptic.h index 372cefacf..4f4cd9fef 100644 --- a/Engine/lib/sdl/src/haptic/SDL_syshaptic.h +++ b/Engine/lib/sdl/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../SDL_internal.h" -#ifndef _SDL_syshaptic_h -#define _SDL_syshaptic_h +#ifndef SDL_syshaptic_h_ +#define SDL_syshaptic_h_ #include "SDL_haptic.h" @@ -62,7 +62,7 @@ struct _SDL_Haptic extern int SDL_SYS_HapticInit(void); /* Function to return the number of haptic devices plugged in right now */ -extern int SDL_SYS_NumHaptics(); +extern int SDL_SYS_NumHaptics(void); /* * Gets the device dependent name of the haptic device @@ -203,6 +203,6 @@ extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic); */ extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic); -#endif /* _SDL_syshaptic_h */ +#endif /* SDL_syshaptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c new file mode 100644 index 000000000..1fb235249 --- /dev/null +++ b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c @@ -0,0 +1,357 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_HAPTIC_ANDROID + +#include "SDL_assert.h" +#include "SDL_timer.h" +#include "SDL_syshaptic_c.h" +#include "../SDL_syshaptic.h" +#include "SDL_haptic.h" +#include "../../core/android/SDL_android.h" +#include "SDL_joystick.h" +#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */ +#include "../../joystick/android/SDL_sysjoystick_c.h" /* For joystick hwdata */ + + +typedef struct SDL_hapticlist_item +{ + int device_id; + char *name; + SDL_Haptic *haptic; + struct SDL_hapticlist_item *next; +} SDL_hapticlist_item; + +static SDL_hapticlist_item *SDL_hapticlist = NULL; +static SDL_hapticlist_item *SDL_hapticlist_tail = NULL; +static int numhaptics = 0; + + +int +SDL_SYS_HapticInit(void) +{ + /* Support for device connect/disconnect is API >= 16 only, + * so we poll every three seconds + * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html + */ + static Uint32 timeout = 0; + if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + timeout = SDL_GetTicks() + 3000; + Android_JNI_PollHapticDevices(); + } + return (numhaptics); +} + +int +SDL_SYS_NumHaptics(void) +{ + return (numhaptics); +} + +static SDL_hapticlist_item * +HapticByOrder(int index) +{ + SDL_hapticlist_item *item = SDL_hapticlist; + if ((index < 0) || (index >= numhaptics)) { + return NULL; + } + while (index > 0) { + SDL_assert(item != NULL); + --index; + item = item->next; + } + return item; +} + +static SDL_hapticlist_item * +HapticByDevId (int device_id) +{ + SDL_hapticlist_item *item; + for (item = SDL_hapticlist; item != NULL; item = item->next) { + if (device_id == item->device_id) { + /*SDL_Log("=+=+=+=+=+= HapticByDevId id [%d]", device_id);*/ + return item; + } + } + return NULL; +} + +const char * +SDL_SYS_HapticName(int index) +{ + SDL_hapticlist_item *item = HapticByOrder(index); + if (item == NULL ) { + SDL_SetError("No such device"); + return NULL; + } + return item->name; +} + + +static SDL_hapticlist_item * +OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item *item) +{ + if (item == NULL ) { + SDL_SetError("No such device"); + return NULL; + } + if (item->haptic != NULL) { + SDL_SetError("Haptic already opened"); + return NULL; + } + + haptic->hwdata = (struct haptic_hwdata *)item; + item->haptic = haptic; + + haptic->supported = SDL_HAPTIC_LEFTRIGHT; + haptic->neffects = 1; + haptic->nplaying = haptic->neffects; + haptic->effects = (struct haptic_effect *)SDL_malloc (sizeof (struct haptic_effect) * haptic->neffects); + if (haptic->effects == NULL) { + SDL_OutOfMemory(); + return NULL; + } + SDL_memset(haptic->effects, 0, sizeof (struct haptic_effect) * haptic->neffects); + return item; +} + +static SDL_hapticlist_item * +OpenHapticByOrder(SDL_Haptic *haptic, int index) +{ + return OpenHaptic (haptic, HapticByOrder(index)); +} + +static SDL_hapticlist_item * +OpenHapticByDevId(SDL_Haptic *haptic, int device_id) +{ + return OpenHaptic (haptic, HapticByDevId(device_id)); +} + +int +SDL_SYS_HapticOpen(SDL_Haptic *haptic) +{ + return (OpenHapticByOrder(haptic, haptic->index) == NULL ? -1 : 0); +} + + +int +SDL_SYS_HapticMouse(void) +{ + return 0; +} + + +int +SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick) +{ + SDL_hapticlist_item *item; + item = HapticByDevId(((joystick_hwdata *)joystick->hwdata)->device_id); + return (item != NULL) ? 1 : 0; +} + + +int +SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick) +{ + return (OpenHapticByDevId(haptic, ((joystick_hwdata *)joystick->hwdata)->device_id) == NULL ? -1 : 0); +} + + +int +SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) +{ + return (((SDL_hapticlist_item *)haptic->hwdata)->device_id == ((joystick_hwdata *)joystick->hwdata)->device_id ? 1 : 0); +} + + +void +SDL_SYS_HapticClose(SDL_Haptic * haptic) +{ + ((SDL_hapticlist_item *)haptic->hwdata)->haptic = NULL; + haptic->hwdata = NULL; + return; +} + + +void +SDL_SYS_HapticQuit(void) +{ + SDL_hapticlist_item *item = NULL; + SDL_hapticlist_item *next = NULL; + + for (item = SDL_hapticlist; item; item = next) { + next = item->next; + SDL_free(item); + } + + SDL_hapticlist = SDL_hapticlist_tail = NULL; + numhaptics = 0; + return; +} + + +int +SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, + struct haptic_effect *effect, SDL_HapticEffect * base) +{ + return 0; +} + + +int +SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic, + struct haptic_effect *effect, + SDL_HapticEffect * data) +{ + return 0; +} + + +int +SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, + Uint32 iterations) +{ + Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, effect->effect.leftright.length); + return 0; +} + + +int +SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect) +{ + return 0; +} + + +void +SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect) +{ + return; +} + + +int +SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, + struct haptic_effect *effect) +{ + return 0; +} + + +int +SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain) +{ + return 0; +} + + +int +SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) +{ + return 0; +} + +int +SDL_SYS_HapticPause(SDL_Haptic * haptic) +{ + return 0; +} + +int +SDL_SYS_HapticUnpause(SDL_Haptic * haptic) +{ + return 0; +} + +int +SDL_SYS_HapticStopAll(SDL_Haptic * haptic) +{ + return 0; +} + + + +int +Android_AddHaptic(int device_id, const char *name) +{ + SDL_hapticlist_item *item; + item = (SDL_hapticlist_item *) SDL_calloc(1, sizeof (SDL_hapticlist_item)); + if (item == NULL) { + return -1; + } + + item->device_id = device_id; + item->name = SDL_strdup (name); + if (item->name == NULL) { + SDL_free (item); + return -1; + } + + if (SDL_hapticlist_tail == NULL) { + SDL_hapticlist = SDL_hapticlist_tail = item; + } else { + SDL_hapticlist_tail->next = item; + SDL_hapticlist_tail = item; + } + + ++numhaptics; + return numhaptics; +} + +int +Android_RemoveHaptic(int device_id) +{ + SDL_hapticlist_item *item; + SDL_hapticlist_item *prev = NULL; + + for (item = SDL_hapticlist; item != NULL; item = item->next) { + /* found it, remove it. */ + if (device_id == item->device_id) { + const int retval = item->haptic ? item->haptic->index : -1; + + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_hapticlist == item); + SDL_hapticlist = item->next; + } + if (item == SDL_hapticlist_tail) { + SDL_hapticlist_tail = prev; + } + + /* Need to decrement the haptic count */ + --numhaptics; + /* !!! TODO: Send a haptic remove event? */ + + SDL_free(item->name); + SDL_free(item); + return retval; + } + prev = item; + } + return -1; +} + + +#endif /* SDL_HAPTIC_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h new file mode 100644 index 000000000..08634d223 --- /dev/null +++ b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h @@ -0,0 +1,12 @@ +#include "SDL_config.h" + +#ifdef SDL_HAPTIC_ANDROID + + +extern int Android_AddHaptic(int device_id, const char *name); +extern int Android_RemoveHaptic(int device_id); + + +#endif /* SDL_HAPTIC_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c index d662012c3..67cb9f52f 100644 --- a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c +++ b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -189,7 +189,7 @@ SDL_SYS_HapticInit(void) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } diff --git a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h index 2b72aab3d..073db53b3 100644 --- a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h +++ b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c index 727e7ecac..283fe6711 100644 --- a/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c +++ b/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c index 7bd966449..9c11a2f0e 100644 --- a/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c +++ b/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,7 +49,7 @@ static int MaybeAddDevice(const char *path); #if SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); -void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); +static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ /* @@ -187,7 +187,7 @@ SDL_SYS_HapticInit(void) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } @@ -211,7 +211,7 @@ HapticByDevIndex(int device_index) } #if SDL_USE_LIBUDEV -void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) +static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { return; diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c index c81432c26..897d1282e 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c +++ b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,15 +58,6 @@ DI_SetError(const char *str, HRESULT err) return SDL_SetError("Haptic error %s", str); } -/* - * Checks to see if two GUID are the same. - */ -static int -DI_GUIDIsSame(const GUID * a, const GUID * b) -{ - return (SDL_memcmp(a, b, sizeof (GUID)) == 0); -} - /* * Callback to find the haptic devices. */ @@ -219,17 +210,17 @@ DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) if ((dev->dwType & DIDFT_AXIS) && (dev->dwFlags & DIDOI_FFACTUATOR)) { const GUID *guid = &dev->guidType; DWORD offset = 0; - if (DI_GUIDIsSame(guid, &GUID_XAxis)) { + if (WIN_IsEqualGUID(guid, &GUID_XAxis)) { offset = DIJOFS_X; - } else if (DI_GUIDIsSame(guid, &GUID_YAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_YAxis)) { offset = DIJOFS_Y; - } else if (DI_GUIDIsSame(guid, &GUID_ZAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_ZAxis)) { offset = DIJOFS_Z; - } else if (DI_GUIDIsSame(guid, &GUID_RxAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RxAxis)) { offset = DIJOFS_RX; - } else if (DI_GUIDIsSame(guid, &GUID_RyAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RyAxis)) { offset = DIJOFS_RY; - } else if (DI_GUIDIsSame(guid, &GUID_RzAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RzAxis)) { offset = DIJOFS_RZ; } else { return DIENUM_CONTINUE; /* can't use this, go on. */ @@ -251,7 +242,7 @@ DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) * Callback to get all supported effects. */ #define EFFECT_TEST(e,s) \ -if (DI_GUIDIsSame(&pei->guid, &(e))) \ +if (WIN_IsEqualGUID(&pei->guid, &(e))) \ haptic->supported |= (s) static BOOL CALLBACK DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv) @@ -481,7 +472,7 @@ SDL_DINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) return 0; } - return DI_GUIDIsSame(&hap_instance.guidInstance, &joy_instance.guidInstance); + return WIN_IsEqualGUID(&hap_instance.guidInstance, &joy_instance.guidInstance); } int @@ -500,7 +491,7 @@ SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */ for (item = SDL_hapticlist; item != NULL; item = item->next) { - if (!item->bXInputHaptic && DI_GUIDIsSame(&item->instance.guidInstance, &joy_instance.guidInstance)) { + if (!item->bXInputHaptic && WIN_IsEqualGUID(&item->instance.guidInstance, &joy_instance.guidInstance)) { haptic->index = index; return SDL_DINPUT_HapticOpenFromDevice(haptic, joystick->hwdata->InputDevice, SDL_TRUE); } @@ -1016,6 +1007,19 @@ SDL_DINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, /* Create the actual effect. */ ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags); + if (ret == DIERR_NOTEXCLUSIVEACQUIRED) { + IDirectInputDevice8_Unacquire(haptic->hwdata->device); + ret = IDirectInputDevice8_SetCooperativeLevel(haptic->hwdata->device, SDL_HelperWindow, DISCL_EXCLUSIVE | DISCL_BACKGROUND); + if (SUCCEEDED(ret)) { + ret = DIERR_NOTACQUIRED; + } + } + if (ret == DIERR_INPUTLOST || ret == DIERR_NOTACQUIRED) { + ret = IDirectInputDevice8_Acquire(haptic->hwdata->device); + if (SUCCEEDED(ret)) { + ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags); + } + } if (FAILED(ret)) { DI_SetError("Unable to update effect", ret); goto err_update; diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h index 3dc0f1303..81c0ad142 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c index c6bcba1f3..3d7361de2 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c +++ b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -98,7 +98,7 @@ SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h index f34426442..256ffbf35 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h +++ b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowshaptic_c_h -#define _SDL_windowshaptic_c_h +#ifndef SDL_windowshaptic_c_h_ +#define SDL_windowshaptic_c_h_ #include "SDL_thread.h" #include "../SDL_syshaptic.h" @@ -82,7 +82,7 @@ extern SDL_hapticlist_item *SDL_hapticlist; extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item); extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item); -#endif /* _SDL_windowshaptic_c_h */ +#endif /* SDL_windowshaptic_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c index afbab456a..53e7ad3e9 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c +++ b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -278,8 +278,9 @@ SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, { XINPUT_VIBRATION *vib = &effect->hweffect->vibration; SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT); - vib->wLeftMotorSpeed = data->leftright.large_magnitude; - vib->wRightMotorSpeed = data->leftright.small_magnitude; + /* SDL_HapticEffect has max magnitude of 32767, XInput expects 65535 max, so multiply */ + vib->wLeftMotorSpeed = data->leftright.large_magnitude * 2; + vib->wRightMotorSpeed = data->leftright.small_magnitude * 2; SDL_LockMutex(haptic->hwdata->mutex); if (haptic->hwdata->stopTicks) { /* running right now? Update it. */ XINPUTSETSTATE(haptic->hwdata->userid, vib); diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h index f9a0c85b2..eed029ed1 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c b/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c index 1d3a4c203..b0f833a33 100644 --- a/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c +++ b/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,70 +24,78 @@ #include "SDL_events.h" #include "SDL_assert.h" -#include "SDL_sysjoystick.h" #include "SDL_hints.h" +#include "SDL_sysjoystick.h" +#include "SDL_joystick_c.h" #include "SDL_gamecontrollerdb.h" #if !SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif -#define ABS(_x) ((_x) < 0 ? -(_x) : (_x)) + +#if defined(__ANDROID__) +#include "SDL_system.h" +#endif + #define SDL_CONTROLLER_PLATFORM_FIELD "platform:" /* a list of currently opened game controllers */ static SDL_GameController *SDL_gamecontrollers = NULL; -/* keep track of the hat and mask value that transforms this hat movement into a button/axis press */ -struct _SDL_HatMapping +typedef struct { - int hat; - Uint8 mask; -}; + SDL_GameControllerBindType inputType; + union + { + int button; -/* We need 36 entries for Android (as of SDL v2.0.4) */ -#define k_nMaxReverseEntries 48 + struct { + int axis; + int axis_min; + int axis_max; + } axis; -/** - * We are encoding the "HAT" as 0xhm. where h == hat ID and m == mask - * MAX 4 hats supported - */ -#define k_nMaxHatEntries 0x3f + 1 + struct { + int hat; + int hat_mask; + } hat; -/* our in memory mapping db between joystick objects and controller mappings */ -struct _SDL_ControllerMapping -{ - SDL_JoystickGUID guid; - const char *name; + } input; - /* mapping of axis/button id to controller version */ - int axes[SDL_CONTROLLER_AXIS_MAX]; - int buttonasaxis[SDL_CONTROLLER_AXIS_MAX]; + SDL_GameControllerBindType outputType; + union + { + SDL_GameControllerButton button; - int buttons[SDL_CONTROLLER_BUTTON_MAX]; - int axesasbutton[SDL_CONTROLLER_BUTTON_MAX]; - struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX]; + struct { + SDL_GameControllerAxis axis; + int axis_min; + int axis_max; + } axis; - /* reverse mapping, joystick indices to buttons */ - SDL_GameControllerAxis raxes[k_nMaxReverseEntries]; - SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries]; - - SDL_GameControllerButton rbuttons[k_nMaxReverseEntries]; - SDL_GameControllerButton raxesasbutton[k_nMaxReverseEntries]; - SDL_GameControllerButton rhatasbutton[k_nMaxHatEntries]; - -}; + } output; +} SDL_ExtendedGameControllerBind; /* our hard coded list of mapping support */ +typedef enum +{ + SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT, + SDL_CONTROLLER_MAPPING_PRIORITY_API, + SDL_CONTROLLER_MAPPING_PRIORITY_USER, +} SDL_ControllerMappingPriority; + typedef struct _ControllerMapping_t { SDL_JoystickGUID guid; char *name; char *mapping; + SDL_ControllerMappingPriority priority; struct _ControllerMapping_t *next; } ControllerMapping_t; +static SDL_JoystickGUID s_zeroGUID; static ControllerMapping_t *s_pSupportedControllers = NULL; static ControllerMapping_t *s_pXInputMapping = NULL; static ControllerMapping_t *s_pEmscriptenMapping = NULL; @@ -97,14 +105,88 @@ struct _SDL_GameController { SDL_Joystick *joystick; /* underlying joystick device */ int ref_count; - Uint8 hatState[4]; /* the current hat state for this controller */ - struct _SDL_ControllerMapping mapping; /* the mapping object for this controller */ + + SDL_JoystickGUID guid; + const char *name; + int num_bindings; + SDL_ExtendedGameControllerBind *bindings; + SDL_ExtendedGameControllerBind **last_match_axis; + Uint8 *last_hat_mask; + struct _SDL_GameController *next; /* pointer to next game controller we have allocated */ }; -int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value); -int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state); +typedef struct +{ + int num_entries; + int max_entries; + Uint32 *entries; +} SDL_vidpid_list; + +static SDL_vidpid_list SDL_allowed_controllers; +static SDL_vidpid_list SDL_ignored_controllers; + +static void +SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list) +{ + Uint32 entry; + char *spot; + char *file = NULL; + + list->num_entries = 0; + + if (hint && *hint == '@') { + spot = file = (char *)SDL_LoadFile(hint+1, NULL); + } else { + spot = (char *)hint; + } + + if (!spot) { + return; + } + + while ((spot = SDL_strstr(spot, "0x")) != NULL) { + entry = (Uint16)SDL_strtol(spot, &spot, 0); + entry <<= 16; + spot = SDL_strstr(spot, "0x"); + if (!spot) { + break; + } + entry |= (Uint16)SDL_strtol(spot, &spot, 0); + + if (list->num_entries == list->max_entries) { + int max_entries = list->max_entries + 16; + Uint32 *entries = (Uint32 *)SDL_realloc(list->entries, max_entries*sizeof(*list->entries)); + if (entries == NULL) { + /* Out of memory, go with what we have already */ + break; + } + list->entries = entries; + list->max_entries = max_entries; + } + list->entries[list->num_entries++] = entry; + } + + if (file) { + SDL_free(file); + } +} + +static void SDLCALL +SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers); +} + +static void SDLCALL +SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers); +} + +static int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value); +static int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state); /* * If there is an existing add event in the queue, it needs to be modified @@ -135,40 +217,136 @@ static void UpdateEventsForDeviceRemoval() SDL_stack_free(events); } +static SDL_bool HasSameOutput(SDL_ExtendedGameControllerBind *a, SDL_ExtendedGameControllerBind *b) +{ + if (a->outputType != b->outputType) { + return SDL_FALSE; + } + + if (a->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + return (a->output.axis.axis == b->output.axis.axis); + } else { + return (a->output.button == b->output.button); + } +} + +static void ResetOutput(SDL_GameController *gamecontroller, SDL_ExtendedGameControllerBind *bind) +{ + if (bind->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_PrivateGameControllerAxis(gamecontroller, bind->output.axis.axis, 0); + } else { + SDL_PrivateGameControllerButton(gamecontroller, bind->output.button, SDL_RELEASED); + } +} + +static void HandleJoystickAxis(SDL_GameController *gamecontroller, int axis, int value) +{ + int i; + SDL_ExtendedGameControllerBind *last_match = gamecontroller->last_match_axis[axis]; + SDL_ExtendedGameControllerBind *match = NULL; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS && + axis == binding->input.axis.axis) { + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + if (value >= binding->input.axis.axis_min && + value <= binding->input.axis.axis_max) { + match = binding; + break; + } + } else { + if (value >= binding->input.axis.axis_max && + value <= binding->input.axis.axis_min) { + match = binding; + break; + } + } + } + } + + if (last_match && (!match || !HasSameOutput(last_match, match))) { + /* Clear the last input that this axis generated */ + ResetOutput(gamecontroller, last_match); + } + + if (match) { + if (match->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + if (match->input.axis.axis_min != match->output.axis.axis_min || match->input.axis.axis_max != match->output.axis.axis_max) { + float normalized_value = (float)(value - match->input.axis.axis_min) / (match->input.axis.axis_max - match->input.axis.axis_min); + value = match->output.axis.axis_min + (int)(normalized_value * (match->output.axis.axis_max - match->output.axis.axis_min)); + } + SDL_PrivateGameControllerAxis(gamecontroller, match->output.axis.axis, (Sint16)value); + } else { + Uint8 state; + int threshold = match->input.axis.axis_min + (match->input.axis.axis_max - match->input.axis.axis_min) / 2; + if (match->input.axis.axis_max < match->input.axis.axis_min) { + state = (value <= threshold) ? SDL_PRESSED : SDL_RELEASED; + } else { + state = (value >= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + SDL_PrivateGameControllerButton(gamecontroller, match->output.button, state); + } + } + gamecontroller->last_match_axis[axis] = match; +} + +static void HandleJoystickButton(SDL_GameController *gamecontroller, int button, Uint8 state) +{ + int i; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON && + button == binding->input.button) { + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + int value = state ? binding->output.axis.axis_max : binding->output.axis.axis_min; + SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)value); + } else { + SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, state); + } + break; + } + } +} + +static void HandleJoystickHat(SDL_GameController *gamecontroller, int hat, Uint8 value) +{ + int i; + Uint8 last_mask = gamecontroller->last_hat_mask[hat]; + Uint8 changed_mask = (last_mask ^ value); + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT && hat == binding->input.hat.hat) { + if ((changed_mask & binding->input.hat.hat_mask) != 0) { + if (value & binding->input.hat.hat_mask) { + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)binding->output.axis.axis_max); + } else { + SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, SDL_PRESSED); + } + } else { + ResetOutput(gamecontroller, binding); + } + } + } + } + gamecontroller->last_hat_mask[hat] = value; +} + /* * Event filter to fire controller events from joystick ones */ -int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) +static int SDLCALL SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) { switch(event->type) { case SDL_JOYAXISMOTION: { - SDL_GameController *controllerlist; - - if (event->jaxis.axis >= k_nMaxReverseEntries) - { - SDL_SetError("SDL_GameControllerEventWatcher: Axis index %d too large, ignoring motion", (int)event->jaxis.axis); - break; - } - - controllerlist = SDL_gamecontrollers; + SDL_GameController *controllerlist = SDL_gamecontrollers; while (controllerlist) { if (controllerlist->joystick->instance_id == event->jaxis.which) { - if (controllerlist->mapping.raxes[event->jaxis.axis] >= 0) /* simple axis to axis, send it through */ { - SDL_GameControllerAxis axis = controllerlist->mapping.raxes[event->jaxis.axis]; - Sint16 value = event->jaxis.value; - switch (axis) { - case SDL_CONTROLLER_AXIS_TRIGGERLEFT: - case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: - value = value / 2 + 16384; - break; - default: - break; - } - SDL_PrivateGameControllerAxis(controllerlist, axis, value); - } else if (controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0) { /* simulate an axis as a button */ - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.raxesasbutton[event->jaxis.axis], ABS(event->jaxis.value) > 32768/2 ? SDL_PRESSED : SDL_RELEASED); - } + HandleJoystickAxis(controllerlist, event->jaxis.axis, event->jaxis.value); break; } controllerlist = controllerlist->next; @@ -178,22 +356,10 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: { - SDL_GameController *controllerlist; - - if (event->jbutton.button >= k_nMaxReverseEntries) - { - SDL_SetError("SDL_GameControllerEventWatcher: Button index %d too large, ignoring update", (int)event->jbutton.button); - break; - } - - controllerlist = SDL_gamecontrollers; + SDL_GameController *controllerlist = SDL_gamecontrollers; while (controllerlist) { if (controllerlist->joystick->instance_id == event->jbutton.which) { - if (controllerlist->mapping.rbuttons[event->jbutton.button] >= 0) { /* simple button as button */ - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rbuttons[event->jbutton.button], event->jbutton.state); - } else if (controllerlist->mapping.rbuttonasaxis[event->jbutton.button] >= 0) { /* an button pretending to be an axis */ - SDL_PrivateGameControllerAxis(controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32767 : 0); - } + HandleJoystickButton(controllerlist, event->jbutton.button, event->jbutton.state); break; } controllerlist = controllerlist->next; @@ -202,43 +368,10 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) break; case SDL_JOYHATMOTION: { - SDL_GameController *controllerlist; - - if (event->jhat.hat >= 4) break; - - controllerlist = SDL_gamecontrollers; + SDL_GameController *controllerlist = SDL_gamecontrollers; while (controllerlist) { if (controllerlist->joystick->instance_id == event->jhat.which) { - Uint8 bSame = controllerlist->hatState[event->jhat.hat] & event->jhat.value; - /* Get list of removed bits (button release) */ - Uint8 bChanged = controllerlist->hatState[event->jhat.hat] ^ bSame; - /* the hat idx in the high nibble */ - int bHighHat = event->jhat.hat << 4; - - if (bChanged & SDL_HAT_DOWN) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_RELEASED); - if (bChanged & SDL_HAT_UP) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_RELEASED); - if (bChanged & SDL_HAT_LEFT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_RELEASED); - if (bChanged & SDL_HAT_RIGHT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_RELEASED); - - /* Get list of added bits (button press) */ - bChanged = event->jhat.value ^ bSame; - - if (bChanged & SDL_HAT_DOWN) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_PRESSED); - if (bChanged & SDL_HAT_UP) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_PRESSED); - if (bChanged & SDL_HAT_LEFT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_PRESSED); - if (bChanged & SDL_HAT_RIGHT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_PRESSED); - - /* update our state cache */ - controllerlist->hatState[event->jhat.hat] = event->jhat.value; - + HandleJoystickHat(controllerlist, event->jhat.hat, event->jhat.value); break; } controllerlist = controllerlist->next; @@ -283,7 +416,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) /* * Helper function to scan the mappings database for a controller with the specified GUID */ -ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid) +static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid) { ControllerMapping_t *pSupportedController = s_pSupportedControllers; while (pSupportedController) { @@ -311,12 +444,18 @@ static const char* map_StringForControllerAxis[] = { SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString) { int entry; - if (!pchString || !pchString[0]) + + if (pchString && (*pchString == '+' || *pchString == '-')) { + ++pchString; + } + + if (!pchString || !pchString[0]) { return SDL_CONTROLLER_AXIS_INVALID; + } for (entry = 0; map_StringForControllerAxis[entry]; ++entry) { if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry])) - return entry; + return (SDL_GameControllerAxis) entry; } return SDL_CONTROLLER_AXIS_INVALID; } @@ -362,7 +501,7 @@ SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchSt for (entry = 0; map_StringForControllerButton[entry]; ++entry) { if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0) - return entry; + return (SDL_GameControllerButton) entry; } return SDL_CONTROLLER_BUTTON_INVALID; } @@ -381,63 +520,95 @@ const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis) /* * given a controller button name and a joystick name update our mapping structure with it */ -void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping) +static void SDL_PrivateGameControllerParseElement(SDL_GameController *gamecontroller, const char *szGameButton, const char *szJoystickButton) { - int iSDLButton = 0; + SDL_ExtendedGameControllerBind bind; SDL_GameControllerButton button; SDL_GameControllerAxis axis; - button = SDL_GameControllerGetButtonFromString(szGameButton); + SDL_bool invert_input = SDL_FALSE; + char half_axis_input = 0; + char half_axis_output = 0; + + if (*szGameButton == '+' || *szGameButton == '-') { + half_axis_output = *szGameButton++; + } + axis = SDL_GameControllerGetAxisFromString(szGameButton); - iSDLButton = SDL_atoi(&szJoystickButton[1]); - - if (szJoystickButton[0] == 'a') { - if (iSDLButton >= k_nMaxReverseEntries) { - SDL_SetError("Axis index too large: %d", iSDLButton); - return; - } - if (axis != SDL_CONTROLLER_AXIS_INVALID) { - pMapping->axes[ axis ] = iSDLButton; - pMapping->raxes[ iSDLButton ] = axis; - } else if (button != SDL_CONTROLLER_BUTTON_INVALID) { - pMapping->axesasbutton[ button ] = iSDLButton; - pMapping->raxesasbutton[ iSDLButton ] = button; + button = SDL_GameControllerGetButtonFromString(szGameButton); + if (axis != SDL_CONTROLLER_AXIS_INVALID) { + bind.outputType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.output.axis.axis = axis; + if (axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; } else { - SDL_assert(!"How did we get here?"); + if (half_axis_output == '+') { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } else if (half_axis_output == '-') { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MIN; + } else { + bind.output.axis.axis_min = SDL_JOYSTICK_AXIS_MIN; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } } + } else if (button != SDL_CONTROLLER_BUTTON_INVALID) { + bind.outputType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.output.button = button; + } else { + SDL_SetError("Unexpected controller element %s", szGameButton); + return; + } - } else if (szJoystickButton[0] == 'b') { - if (iSDLButton >= k_nMaxReverseEntries) { - SDL_SetError("Button index too large: %d", iSDLButton); - return; - } - if (button != SDL_CONTROLLER_BUTTON_INVALID) { - pMapping->buttons[ button ] = iSDLButton; - pMapping->rbuttons[ iSDLButton ] = button; - } else if (axis != SDL_CONTROLLER_AXIS_INVALID) { - pMapping->buttonasaxis[ axis ] = iSDLButton; - pMapping->rbuttonasaxis[ iSDLButton ] = axis; + if (*szJoystickButton == '+' || *szJoystickButton == '-') { + half_axis_input = *szJoystickButton++; + } + if (szJoystickButton[SDL_strlen(szJoystickButton) - 1] == '~') { + invert_input = SDL_TRUE; + } + + if (szJoystickButton[0] == 'a' && SDL_isdigit(szJoystickButton[1])) { + bind.inputType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]); + if (half_axis_input == '+') { + bind.input.axis.axis_min = 0; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } else if (half_axis_input == '-') { + bind.input.axis.axis_min = 0; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MIN; } else { - SDL_assert(!"How did we get here?"); + bind.input.axis.axis_min = SDL_JOYSTICK_AXIS_MIN; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; } - } else if (szJoystickButton[0] == 'h') { + if (invert_input) { + int tmp = bind.input.axis.axis_min; + bind.input.axis.axis_min = bind.input.axis.axis_max; + bind.input.axis.axis_max = tmp; + } + } else if (szJoystickButton[0] == 'b' && SDL_isdigit(szJoystickButton[1])) { + bind.inputType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.input.button = SDL_atoi(&szJoystickButton[1]); + } else if (szJoystickButton[0] == 'h' && SDL_isdigit(szJoystickButton[1]) && + szJoystickButton[2] == '.' && SDL_isdigit(szJoystickButton[3])) { int hat = SDL_atoi(&szJoystickButton[1]); int mask = SDL_atoi(&szJoystickButton[3]); - if (hat >= 4) { - SDL_SetError("Hat index too large: %d", iSDLButton); - } - - if (button != SDL_CONTROLLER_BUTTON_INVALID) { - int ridx; - pMapping->hatasbutton[ button ].hat = hat; - pMapping->hatasbutton[ button ].mask = mask; - ridx = (hat << 4) | mask; - pMapping->rhatasbutton[ ridx ] = button; - } else if (axis != SDL_CONTROLLER_AXIS_INVALID) { - SDL_assert(!"Support hat as axis"); - } else { - SDL_assert(!"How did we get here?"); - } + bind.inputType = SDL_CONTROLLER_BINDTYPE_HAT; + bind.input.hat.hat = hat; + bind.input.hat.hat_mask = mask; + } else { + SDL_SetError("Unexpected joystick element: %s", szJoystickButton); + return; } + + ++gamecontroller->num_bindings; + gamecontroller->bindings = (SDL_ExtendedGameControllerBind *)SDL_realloc(gamecontroller->bindings, gamecontroller->num_bindings * sizeof(*gamecontroller->bindings)); + if (!gamecontroller->bindings) { + gamecontroller->num_bindings = 0; + SDL_OutOfMemory(); + return; + } + gamecontroller->bindings[gamecontroller->num_bindings - 1] = bind; } @@ -445,7 +616,7 @@ void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char * * given a controller mapping string update our mapping object */ static void -SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMapping *pMapping, const char *pchString) +SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecontroller, const char *pchString) { char szGameButton[20]; char szJoystickButton[20]; @@ -453,8 +624,8 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi int i = 0; const char *pchPos = pchString; - SDL_memset(szGameButton, 0x0, sizeof(szGameButton)); - SDL_memset(szJoystickButton, 0x0, sizeof(szJoystickButton)); + SDL_zero(szGameButton); + SDL_zero(szJoystickButton); while (pchPos && *pchPos) { if (*pchPos == ':') { @@ -465,9 +636,9 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi } else if (*pchPos == ',') { i = 0; bGameButton = SDL_TRUE; - SDL_PrivateGameControllerParseButton(szGameButton, szJoystickButton, pMapping); - SDL_memset(szGameButton, 0x0, sizeof(szGameButton)); - SDL_memset(szJoystickButton, 0x0, sizeof(szJoystickButton)); + SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); + SDL_zero(szGameButton); + SDL_zero(szJoystickButton); } else if (bGameButton) { if (i >= sizeof(szGameButton)) { @@ -487,50 +658,44 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi pchPos++; } - SDL_PrivateGameControllerParseButton(szGameButton, szJoystickButton, pMapping); + SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); } /* * Make a new button mapping struct */ -void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping) +static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping) { - int j; + int i; - pMapping->guid = guid; - pMapping->name = pchName; + gamecontroller->guid = guid; + gamecontroller->name = pchName; + gamecontroller->num_bindings = 0; + SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes * sizeof(*gamecontroller->last_match_axis)); - /* set all the button mappings to non defaults */ - for (j = 0; j < SDL_CONTROLLER_AXIS_MAX; j++) { - pMapping->axes[j] = -1; - pMapping->buttonasaxis[j] = -1; + SDL_PrivateGameControllerParseControllerConfigString(gamecontroller, pchMapping); + + /* Set the zero point for triggers */ + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS && + binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && + (binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) { + if (binding->input.axis.axis < gamecontroller->joystick->naxes) { + gamecontroller->joystick->axes[binding->input.axis.axis].value = + gamecontroller->joystick->axes[binding->input.axis.axis].zero = (Sint16)binding->input.axis.axis_min; + } + } } - for (j = 0; j < SDL_CONTROLLER_BUTTON_MAX; j++) { - pMapping->buttons[j] = -1; - pMapping->axesasbutton[j] = -1; - pMapping->hatasbutton[j].hat = -1; - } - - for (j = 0; j < k_nMaxReverseEntries; j++) { - pMapping->raxes[j] = SDL_CONTROLLER_AXIS_INVALID; - pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID; - pMapping->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID; - pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; - } - - for (j = 0; j < k_nMaxHatEntries; j++) { - pMapping->rhatasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; - } - - SDL_PrivateGameControllerParseControllerConfigString(pMapping, pchMapping); } /* * grab the guid string from a mapping string */ -char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) +static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) { const char *pFirstComma = SDL_strchr(pMapping, ','); if (pFirstComma) { @@ -540,7 +705,26 @@ char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) return NULL; } SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping); - pchGUID[ pFirstComma - pMapping ] = 0; + pchGUID[pFirstComma - pMapping] = '\0'; + + /* Convert old style GUIDs to the new style in 2.0.5 */ +#if __WIN32__ + if (SDL_strlen(pchGUID) == 32 && + SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) { + SDL_memcpy(&pchGUID[20], "000000000000", 12); + SDL_memcpy(&pchGUID[16], &pchGUID[4], 4); + SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); + SDL_memcpy(&pchGUID[0], "03000000", 8); + } +#elif __MACOSX__ + if (SDL_strlen(pchGUID) == 32 && + SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && + SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { + SDL_memcpy(&pchGUID[20], "000000000000", 12); + SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); + SDL_memcpy(&pchGUID[0], "03000000", 8); + } +#endif return pchGUID; } return NULL; @@ -550,7 +734,7 @@ char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) /* * grab the name string from a mapping string */ -char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) +static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) { const char *pFirstComma, *pSecondComma; char *pchName; @@ -569,7 +753,7 @@ char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) return NULL; } SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma); - pchName[ pSecondComma - pFirstComma - 1 ] = 0; + pchName[pSecondComma - pFirstComma - 1] = 0; return pchName; } @@ -577,7 +761,7 @@ char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) /* * grab the button mapping string from a mapping string */ -char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) +static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) { const char *pFirstComma, *pSecondComma; @@ -595,18 +779,18 @@ char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) /* * Helper function to refresh a mapping */ -void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) +static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) { SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; while (gamecontrollerlist) { - if (!SDL_memcmp(&gamecontrollerlist->mapping.guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) { + if (!SDL_memcmp(&gamecontrollerlist->guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) { SDL_Event event; event.type = SDL_CONTROLLERDEVICEREMAPPED; event.cdevice.which = gamecontrollerlist->joystick->instance_id; SDL_PushEvent(&event); /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */ - SDL_PrivateLoadButtonMapping(&gamecontrollerlist->mapping, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping); + SDL_PrivateLoadButtonMapping(gamecontrollerlist, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping); } gamecontrollerlist = gamecontrollerlist->next; @@ -617,7 +801,7 @@ void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMap * Helper function to add a mapping for a guid */ static ControllerMapping_t * -SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing) +SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_ControllerMappingPriority priority) { char *pchName; char *pchMapping; @@ -638,13 +822,20 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); if (pControllerMapping) { - /* Update existing mapping */ - SDL_free(pControllerMapping->name); - pControllerMapping->name = pchName; - SDL_free(pControllerMapping->mapping); - pControllerMapping->mapping = pchMapping; - /* refresh open controllers */ - SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + /* Only overwrite the mapping if the priority is the same or higher. */ + if (pControllerMapping->priority <= priority) { + /* Update existing mapping */ + SDL_free(pControllerMapping->name); + pControllerMapping->name = pchName; + SDL_free(pControllerMapping->mapping); + pControllerMapping->mapping = pchMapping; + pControllerMapping->priority = priority; + /* refresh open controllers */ + SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + } else { + SDL_free(pchName); + SDL_free(pchMapping); + } *existing = SDL_TRUE; } else { pControllerMapping = SDL_malloc(sizeof(*pControllerMapping)); @@ -657,8 +848,22 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, pControllerMapping->guid = jGUID; pControllerMapping->name = pchName; pControllerMapping->mapping = pchMapping; - pControllerMapping->next = s_pSupportedControllers; - s_pSupportedControllers = pControllerMapping; + pControllerMapping->next = NULL; + pControllerMapping->priority = priority; + + if (s_pSupportedControllers) { + /* Add the mapping to the end of the list */ + ControllerMapping_t *pCurrMapping, *pPrevMapping; + + for ( pPrevMapping = s_pSupportedControllers, pCurrMapping = pPrevMapping->next; + pCurrMapping; + pPrevMapping = pCurrMapping, pCurrMapping = pCurrMapping->next ) { + continue; + } + pPrevMapping->next = pControllerMapping; + } else { + s_pSupportedControllers = pControllerMapping; + } *existing = SDL_FALSE; } return pControllerMapping; @@ -667,45 +872,70 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, /* * Helper function to determine pre-calculated offset to certain joystick mappings */ -ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) +static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid) { - SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index); ControllerMapping_t *mapping; - mapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); + mapping = SDL_PrivateGetControllerMappingForGUID(&guid); +#if defined(SDL_JOYSTICK_EMSCRIPTEN) + if (!mapping && s_pEmscriptenMapping) { + mapping = s_pEmscriptenMapping; + } +#else + (void) s_pEmscriptenMapping; /* pacify ARMCC */ +#endif +#ifdef __LINUX__ + if (!mapping && name) { + if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { + /* The Linux driver xpad.c maps the wireless dpad to buttons */ + SDL_bool existing; + mapping = SDL_PrivateAddMappingForGUID(guid, +"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); + } + } +#endif /* __LINUX__ */ + + if (!mapping && name) { + if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box") || SDL_strstr(name, "XBOX")) { + mapping = s_pXInputMapping; + } + } + return mapping; +} + +static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) +{ + const char *name; + SDL_JoystickGUID guid; + ControllerMapping_t *mapping; + + SDL_LockJoysticks(); + + if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { + SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); + SDL_UnlockJoysticks(); + return (NULL); + } + + name = SDL_JoystickNameForIndex(device_index); + guid = SDL_JoystickGetDeviceGUID(device_index); + mapping = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid); #if SDL_JOYSTICK_XINPUT if (!mapping && SDL_SYS_IsXInputGamepad_DeviceIndex(device_index)) { mapping = s_pXInputMapping; } #endif -#if defined(SDL_JOYSTICK_EMSCRIPTEN) - if (!mapping && s_pEmscriptenMapping) { - mapping = s_pEmscriptenMapping; - } -#endif -#ifdef __LINUX__ - if (!mapping) { - const char *name = SDL_JoystickNameForIndex(device_index); - if (name) { - if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { - /* The Linux driver xpad.c maps the wireless dpad to buttons */ - SDL_bool existing; - mapping = SDL_PrivateAddMappingForGUID(jGUID, -"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - &existing); - } - } - } -#endif /* __LINUX__ */ - - if (!mapping) { - const char *name = SDL_JoystickNameForIndex(device_index); - if (name) { - if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box")) { - mapping = s_pXInputMapping; - } - } +#if defined(__ANDROID__) + if (!mapping && SDL_SYS_IsDPAD_DeviceIndex(device_index)) { + SDL_bool existing; + char mapping_string[1024]; + SDL_snprintf(mapping_string, sizeof(mapping_string), "none,%s,a:b0,b:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,", name); + mapping = SDL_PrivateAddMappingForGUID(guid, mapping_string, + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } +#endif /* __ANDROID__ */ + SDL_UnlockJoysticks(); return mapping; } @@ -781,10 +1011,10 @@ SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw) } /* - * Add or update an entry into the Mappings Database + * Add or update an entry into the Mappings Database with a priority */ -int -SDL_GameControllerAddMapping(const char *mappingString) +static int +SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMappingPriority priority) { char *pchGUID; SDL_JoystickGUID jGUID; @@ -810,7 +1040,7 @@ SDL_GameControllerAddMapping(const char *mappingString) jGUID = SDL_JoystickGetGUIDFromString(pchGUID); SDL_free(pchGUID); - pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing); + pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority); if (!pControllerMapping) { return -1; } @@ -828,6 +1058,66 @@ SDL_GameControllerAddMapping(const char *mappingString) } } +/* + * Add or update an entry into the Mappings Database + */ +int +SDL_GameControllerAddMapping(const char *mappingString) +{ + return SDL_PrivateGameControllerAddMapping(mappingString, SDL_CONTROLLER_MAPPING_PRIORITY_API); +} + +/* + * Get the number of mappings installed + */ +int +SDL_GameControllerNumMappings(void) +{ + int num_mappings = 0; + ControllerMapping_t *mapping; + + for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) { + if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) { + continue; + } + ++num_mappings; + } + return num_mappings; +} + +/* + * Get the mapping at a particular index. + */ +char * +SDL_GameControllerMappingForIndex(int mapping_index) +{ + ControllerMapping_t *mapping; + + for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) { + if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) { + continue; + } + if (mapping_index == 0) { + char *pMappingString; + char pchGUID[33]; + size_t needed; + + SDL_JoystickGetGUIDString(mapping->guid, pchGUID, sizeof(pchGUID)); + /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ + needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; + pMappingString = SDL_malloc(needed); + if (!pMappingString) { + SDL_OutOfMemory(); + return NULL; + } + SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); + return pMappingString; + } + --mapping_index; + } + return NULL; +} + /* * Get the mapping string for this GUID */ @@ -862,7 +1152,7 @@ SDL_GameControllerMapping(SDL_GameController * gamecontroller) return NULL; } - return SDL_GameControllerMappingForGUID(gamecontroller->mapping.guid); + return SDL_GameControllerMappingForGUID(gamecontroller->guid); } static void @@ -882,7 +1172,7 @@ SDL_GameControllerLoadHints() if (pchNewLine) *pchNewLine = '\0'; - SDL_GameControllerAddMapping(pUserMappings); + SDL_PrivateGameControllerAddMapping(pUserMappings, SDL_CONTROLLER_MAPPING_PRIORITY_USER); if (pchNewLine) { pUserMappings = pchNewLine + 1; @@ -894,25 +1184,60 @@ SDL_GameControllerLoadHints() } } +/* + * Fill the given buffer with the expected controller mapping filepath. + * Usually this will just be CONTROLLER_MAPPING_FILE, but for Android, + * we want to get the internal storage path. + */ +static SDL_bool SDL_GetControllerMappingFilePath(char *path, size_t size) +{ +#ifdef CONTROLLER_MAPPING_FILE +#define STRING(X) SDL_STRINGIFY_ARG(X) + return SDL_strlcpy(path, STRING(CONTROLLER_MAPPING_FILE), size) < size; +#elif defined(__ANDROID__) + return SDL_snprintf(path, size, "%s/controller_map.txt", SDL_AndroidGetInternalStoragePath()) < size; +#else + return SDL_FALSE; +#endif +} + /* * Initialize the game controller system, mostly load our DB of controller config mappings */ int -SDL_GameControllerInit(void) +SDL_GameControllerInitMappings(void) { + char szControllerMapPath[1024]; int i = 0; const char *pMappingString = NULL; pMappingString = s_ControllerMappings[i]; while (pMappingString) { - SDL_GameControllerAddMapping(pMappingString); + SDL_PrivateGameControllerAddMapping(pMappingString, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); i++; pMappingString = s_ControllerMappings[i]; } + if (SDL_GetControllerMappingFilePath(szControllerMapPath, sizeof(szControllerMapPath))) { + SDL_GameControllerAddMappingsFromFile(szControllerMapPath); + } + /* load in any user supplied config */ SDL_GameControllerLoadHints(); + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + SDL_GameControllerIgnoreDevicesChanged, NULL); + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + SDL_GameControllerIgnoreDevicesExceptChanged, NULL); + + return (0); +} + +int +SDL_GameControllerInit(void) +{ + int i; + /* watch for joy events and fire controller ones if needed */ SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL); @@ -936,7 +1261,7 @@ SDL_GameControllerInit(void) const char * SDL_GameControllerNameForIndex(int device_index) { - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); if (pSupportedController) { return pSupportedController->name; } @@ -944,20 +1269,83 @@ SDL_GameControllerNameForIndex(int device_index) } +/* + * Return 1 if the joystick with this name and GUID is a supported controller + */ +SDL_bool +SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid) +{ + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid); + if (pSupportedController) { + return SDL_TRUE; + } + return SDL_FALSE; +} + /* * Return 1 if the joystick at this device index is a supported controller */ SDL_bool SDL_IsGameController(int device_index) { - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); if (pSupportedController) { return SDL_TRUE; } - return SDL_FALSE; } +/* + * Return 1 if the game controller should be ignored by SDL + */ +SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) +{ + int i; + Uint16 vendor; + Uint16 product; + Uint32 vidpid; + + if (SDL_allowed_controllers.num_entries == 0 && + SDL_ignored_controllers.num_entries == 0) { + return SDL_FALSE; + } + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); + vidpid = MAKE_VIDPID(vendor, product); + + if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) { + /* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */ + SDL_bool bSteamVirtualGamepad = SDL_FALSE; +#if defined(__LINUX__) + bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF); +#elif defined(__MACOSX__) + bSteamVirtualGamepad = (SDL_strncmp(name, "GamePad-", 8) == 0); +#elif defined(__WIN32__) + /* We can't tell on Windows, but Steam will block others in input hooks */ + bSteamVirtualGamepad = SDL_TRUE; +#endif + if (bSteamVirtualGamepad) { + return SDL_FALSE; + } + } + + if (SDL_allowed_controllers.num_entries > 0) { + for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) { + if (vidpid == SDL_allowed_controllers.entries[i]) { + return SDL_FALSE; + } + } + return SDL_TRUE; + } else { + for (i = 0; i < SDL_ignored_controllers.num_entries; ++i) { + if (vidpid == SDL_ignored_controllers.entries[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; + } +} + /* * Open a controller for use - the index passed as an argument refers to * the N'th controller on the system. This index is the value which will @@ -972,8 +1360,11 @@ SDL_GameControllerOpen(int device_index) SDL_GameController *gamecontrollerlist; ControllerMapping_t *pSupportedController = NULL; + SDL_LockJoysticks(); + if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); + SDL_UnlockJoysticks(); return (NULL); } @@ -983,6 +1374,7 @@ SDL_GameControllerOpen(int device_index) if (SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == gamecontrollerlist->joystick->instance_id) { gamecontroller = gamecontrollerlist; ++gamecontroller->ref_count; + SDL_UnlockJoysticks(); return (gamecontroller); } gamecontrollerlist = gamecontrollerlist->next; @@ -992,46 +1384,56 @@ SDL_GameControllerOpen(int device_index) pSupportedController = SDL_PrivateGetControllerMapping(device_index); if (!pSupportedController) { SDL_SetError("Couldn't find mapping for device (%d)", device_index); - return (NULL); - } - - /* Create and initialize the joystick */ - gamecontroller = (SDL_GameController *) SDL_malloc((sizeof *gamecontroller)); - if (gamecontroller == NULL) { - SDL_OutOfMemory(); + SDL_UnlockJoysticks(); + return NULL; + } + + /* Create and initialize the controller */ + gamecontroller = (SDL_GameController *) SDL_calloc(1, sizeof(*gamecontroller)); + if (gamecontroller == NULL) { + SDL_OutOfMemory(); + SDL_UnlockJoysticks(); return NULL; } - SDL_memset(gamecontroller, 0, (sizeof *gamecontroller)); gamecontroller->joystick = SDL_JoystickOpen(device_index); if (!gamecontroller->joystick) { SDL_free(gamecontroller); + SDL_UnlockJoysticks(); return NULL; } - SDL_PrivateLoadButtonMapping(&gamecontroller->mapping, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping); - - /* The triggers are mapped from -32768 to 32767, where -32768 is the 'unpressed' value */ - { - int leftTriggerMapping = gamecontroller->mapping.axes[SDL_CONTROLLER_AXIS_TRIGGERLEFT]; - int rightTriggerMapping = gamecontroller->mapping.axes[SDL_CONTROLLER_AXIS_TRIGGERRIGHT]; - if (leftTriggerMapping >= 0) { - gamecontroller->joystick->axes[leftTriggerMapping] = - gamecontroller->joystick->axes_zero[leftTriggerMapping] = (Sint16)-32768; + if (gamecontroller->joystick->naxes) { + gamecontroller->last_match_axis = (SDL_ExtendedGameControllerBind **)SDL_calloc(gamecontroller->joystick->naxes, sizeof(*gamecontroller->last_match_axis)); + if (!gamecontroller->last_match_axis) { + SDL_OutOfMemory(); + SDL_JoystickClose(gamecontroller->joystick); + SDL_free(gamecontroller); + SDL_UnlockJoysticks(); + return NULL; } - if (rightTriggerMapping >= 0) { - gamecontroller->joystick->axes[rightTriggerMapping] = - gamecontroller->joystick->axes_zero[rightTriggerMapping] = (Sint16)-32768; + } + if (gamecontroller->joystick->nhats) { + gamecontroller->last_hat_mask = (Uint8 *)SDL_calloc(gamecontroller->joystick->nhats, sizeof(*gamecontroller->last_hat_mask)); + if (!gamecontroller->last_hat_mask) { + SDL_OutOfMemory(); + SDL_JoystickClose(gamecontroller->joystick); + SDL_free(gamecontroller->last_match_axis); + SDL_free(gamecontroller); + SDL_UnlockJoysticks(); + return NULL; } } - /* Add joystick to list */ + SDL_PrivateLoadButtonMapping(gamecontroller, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping); + + /* Add the controller to list */ ++gamecontroller->ref_count; - /* Link the joystick in the list */ + /* Link the controller in the list */ gamecontroller->next = SDL_gamecontrollers; SDL_gamecontrollers = gamecontroller; - SDL_SYS_JoystickUpdate(gamecontroller->joystick); + SDL_UnlockJoysticks(); return (gamecontroller); } @@ -1046,69 +1448,133 @@ SDL_GameControllerUpdate(void) SDL_JoystickUpdate(); } - /* * Get the current state of an axis control on a controller */ Sint16 SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) { + int i; + if (!gamecontroller) return 0; - if (gamecontroller->mapping.axes[axis] >= 0) { - Sint16 value = (SDL_JoystickGetAxis(gamecontroller->joystick, gamecontroller->mapping.axes[axis])); - switch (axis) { - case SDL_CONTROLLER_AXIS_TRIGGERLEFT: - case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: - /* Shift it to be 0 - 32767 */ - value = value / 2 + 16384; - default: - break; + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) { + int value = 0; + SDL_bool valid_input_range; + SDL_bool valid_output_range; + + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis); + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max); + } else { + valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min); + } + if (valid_input_range) { + if (binding->input.axis.axis_min != binding->output.axis.axis_min || binding->input.axis.axis_max != binding->output.axis.axis_max) { + float normalized_value = (float)(value - binding->input.axis.axis_min) / (binding->input.axis.axis_max - binding->input.axis.axis_min); + value = binding->output.axis.axis_min + (int)(normalized_value * (binding->output.axis.axis_max - binding->output.axis.axis_min)); + } + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + value = SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button); + if (value == SDL_PRESSED) { + value = binding->output.axis.axis_max; + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat); + if (hat_mask & binding->input.hat.hat_mask) { + value = binding->output.axis.axis_max; + } + } + + if (binding->output.axis.axis_min < binding->output.axis.axis_max) { + valid_output_range = (value >= binding->output.axis.axis_min && value <= binding->output.axis.axis_max); + } else { + valid_output_range = (value >= binding->output.axis.axis_max && value <= binding->output.axis.axis_min); + } + /* If the value is zero, there might be another binding that makes it non-zero */ + if (value != 0 && valid_output_range) { + return (Sint16)value; + } } - return value; - } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0) { - Uint8 value; - value = SDL_JoystickGetButton(gamecontroller->joystick, gamecontroller->mapping.buttonasaxis[axis]); - if (value > 0) - return 32767; - return 0; } return 0; } - /* * Get the current state of a button on a controller */ Uint8 SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) { + int i; + if (!gamecontroller) return 0; - if (gamecontroller->mapping.buttons[button] >= 0) { - return (SDL_JoystickGetButton(gamecontroller->joystick, gamecontroller->mapping.buttons[button])); - } else if (gamecontroller->mapping.axesasbutton[button] >= 0) { - Sint16 value; - value = SDL_JoystickGetAxis(gamecontroller->joystick, gamecontroller->mapping.axesasbutton[button]); - if (ABS(value) > 32768/2) - return 1; - return 0; - } else if (gamecontroller->mapping.hatasbutton[button].hat >= 0) { - Uint8 value; - value = SDL_JoystickGetHat(gamecontroller->joystick, gamecontroller->mapping.hatasbutton[button].hat); + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) { + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_bool valid_input_range; - if (value & gamecontroller->mapping.hatasbutton[button].mask) - return 1; - return 0; + int value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis); + int threshold = binding->input.axis.axis_min + (binding->input.axis.axis_max - binding->input.axis.axis_min) / 2; + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max); + if (valid_input_range) { + return (value >= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + } else { + valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min); + if (valid_input_range) { + return (value <= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + return SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button); + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat); + return (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED; + } + } } + return SDL_RELEASED; +} - return 0; +const char * +SDL_GameControllerName(SDL_GameController * gamecontroller) +{ + if (!gamecontroller) + return NULL; + + return gamecontroller->name; +} + +Uint16 +SDL_GameControllerGetVendor(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetVendor(SDL_GameControllerGetJoystick(gamecontroller)); +} + +Uint16 +SDL_GameControllerGetProduct(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetProduct(SDL_GameControllerGetJoystick(gamecontroller)); +} + +Uint16 +SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller)); } /* - * Return if the joystick in question is currently attached to the system, + * Return if the controller in question is currently attached to the system, * \return 0 if not plugged in, 1 if still present. */ SDL_bool @@ -1120,17 +1586,6 @@ SDL_GameControllerGetAttached(SDL_GameController * gamecontroller) return SDL_JoystickGetAttached(gamecontroller->joystick); } - -const char * -SDL_GameControllerName(SDL_GameController * gamecontroller) -{ - if (!gamecontroller) - return NULL; - - return (gamecontroller->mapping.name); -} - - /* * Get the joystick for this controller */ @@ -1149,64 +1604,81 @@ SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller) SDL_GameController * SDL_GameControllerFromInstanceID(SDL_JoystickID joyid) { - SDL_GameController *gamecontroller = SDL_gamecontrollers; + SDL_GameController *gamecontroller; + + SDL_LockJoysticks(); + gamecontroller = SDL_gamecontrollers; while (gamecontroller) { if (gamecontroller->joystick->instance_id == joyid) { + SDL_UnlockJoysticks(); return gamecontroller; } gamecontroller = gamecontroller->next; } - + SDL_UnlockJoysticks(); return NULL; } -/** +/* * Get the SDL joystick layer binding for this controller axis mapping */ SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) { + int i; SDL_GameControllerButtonBind bind; - SDL_memset(&bind, 0x0, sizeof(bind)); + SDL_zero(bind); if (!gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID) return bind; - if (gamecontroller->mapping.axes[axis] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.value.button = gamecontroller->mapping.axes[axis]; - } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.value.button = gamecontroller->mapping.buttonasaxis[axis]; + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) { + bind.bindType = binding->inputType; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + /* FIXME: There might be multiple axes bound now that we have axis ranges... */ + bind.value.axis = binding->input.axis.axis; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + bind.value.button = binding->input.button; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + bind.value.hat.hat = binding->input.hat.hat; + bind.value.hat.hat_mask = binding->input.hat.hat_mask; + } + break; + } } - return bind; } -/** +/* * Get the SDL joystick layer binding for this controller button mapping */ SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) { + int i; SDL_GameControllerButtonBind bind; - SDL_memset(&bind, 0x0, sizeof(bind)); + SDL_zero(bind); if (!gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID) return bind; - if (gamecontroller->mapping.buttons[button] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.value.button = gamecontroller->mapping.buttons[button]; - } else if (gamecontroller->mapping.axesasbutton[button] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.value.axis = gamecontroller->mapping.axesasbutton[button]; - } else if (gamecontroller->mapping.hatasbutton[button].hat >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_HAT; - bind.value.hat.hat = gamecontroller->mapping.hatasbutton[button].hat; - bind.value.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask; + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) { + bind.bindType = binding->inputType; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + bind.value.axis = binding->input.axis.axis; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + bind.value.button = binding->input.button; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + bind.value.hat.hat = binding->input.hat.hat; + bind.value.hat.hat_mask = binding->input.hat.hat_mask; + } + break; + } } - return bind; } @@ -1219,8 +1691,11 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller) if (!gamecontroller) return; + SDL_LockJoysticks(); + /* First decrement ref count */ if (--gamecontroller->ref_count > 0) { + SDL_UnlockJoysticks(); return; } @@ -1236,14 +1711,18 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller) } else { SDL_gamecontrollers = gamecontroller->next; } - break; } gamecontrollerlistprev = gamecontrollerlist; gamecontrollerlist = gamecontrollerlist->next; } + SDL_free(gamecontroller->bindings); + SDL_free(gamecontroller->last_match_axis); + SDL_free(gamecontroller->last_hat_mask); SDL_free(gamecontroller); + + SDL_UnlockJoysticks(); } @@ -1253,11 +1732,18 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller) void SDL_GameControllerQuit(void) { - ControllerMapping_t *pControllerMap; + SDL_LockJoysticks(); while (SDL_gamecontrollers) { SDL_gamecontrollers->ref_count = 1; SDL_GameControllerClose(SDL_gamecontrollers); } + SDL_UnlockJoysticks(); +} + +void +SDL_GameControllerQuitMappings(void) +{ + ControllerMapping_t *pControllerMap; while (s_pSupportedControllers) { pControllerMap = s_pSupportedControllers; @@ -1269,12 +1755,25 @@ SDL_GameControllerQuit(void) SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL); + SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + SDL_GameControllerIgnoreDevicesChanged, NULL); + SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + SDL_GameControllerIgnoreDevicesExceptChanged, NULL); + + if (SDL_allowed_controllers.entries) { + SDL_free(SDL_allowed_controllers.entries); + SDL_zero(SDL_allowed_controllers); + } + if (SDL_ignored_controllers.entries) { + SDL_free(SDL_ignored_controllers.entries); + SDL_zero(SDL_ignored_controllers); + } } /* * Event filter to transform joystick events into appropriate game controller ones */ -int +static int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value) { int posted; @@ -1298,7 +1797,7 @@ SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameContr /* * Event filter to transform joystick events into appropriate game controller ones */ -int +static int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state) { int posted; diff --git a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h index 1e623cbb8..fdc0b592b 100644 --- a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h +++ b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,77 +35,193 @@ static const char *s_ControllerMappings [] = "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", #endif #if SDL_JOYSTICK_DINPUT - "10280900000000000000504944564944,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", - "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", - "ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,", - "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", - "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,", - "4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,", + "030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,", + "03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", + "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "03000000250900000500000000000000,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,", + "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,", + "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,", + "03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif #if defined(__MACOSX__) - "10280000000000000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", - "830500000000000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", - "6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ - "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", - "351200000000000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", - "11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", - "11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", - "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,", + "030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ + "03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "030000005e0400008e02000001000000,Steam Virtual GamePad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,", + "03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,", + "03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,", + "03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,", + "030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif #if defined(__LINUX__) + "03000000022000000090000011010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", "05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,", "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", - "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "050000003620000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", + "03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,", + "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", + "030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,", + "030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", + "03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,", + "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,", + "03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000005e040000d102000001010000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif #if defined(__ANDROID__) + "34323662653333636330306631326233,ASUS Gamepad,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,", + "64633436313965656664373634323364,Microsoft X-Box 360 pad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,", "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "61363931656135336130663561616264,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "37336435666338653565313731303834,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "35643031303033326130316330353564,PS4 Controller,a:b1,b:b17,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "34356136633366613530316338376136,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,x:b17,y:b2,", #endif #if defined(SDL_JOYSTICK_MFI) "4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", "4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,", + "4d466947616d65706164030000000000,Remote,a:b0,b:b2,leftx:a0,lefty:a1,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", #endif #if defined(SDL_JOYSTICK_EMSCRIPTEN) "emscripten,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", diff --git a/Engine/lib/sdl/src/joystick/SDL_joystick.c b/Engine/lib/sdl/src/joystick/SDL_joystick.c index c426a39e5..b93c03d37 100644 --- a/Engine/lib/sdl/src/joystick/SDL_joystick.c +++ b/Engine/lib/sdl/src/joystick/SDL_joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,12 +31,32 @@ #if !SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif +#include "../video/SDL_sysvideo.h" + static SDL_bool SDL_joystick_allows_background_events = SDL_FALSE; static SDL_Joystick *SDL_joysticks = NULL; -static SDL_Joystick *SDL_updating_joystick = NULL; +static SDL_bool SDL_updating_joystick = SDL_FALSE; +static SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */ -static void +void +SDL_LockJoysticks(void) +{ + if (SDL_joystick_lock) { + SDL_LockMutex(SDL_joystick_lock); + } +} + +void +SDL_UnlockJoysticks(void) +{ + if (SDL_joystick_lock) { + SDL_UnlockMutex(SDL_joystick_lock); + } +} + + +static void SDLCALL SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { if (hint && *hint == '1') { @@ -51,6 +71,13 @@ SDL_JoystickInit(void) { int status; + SDL_GameControllerInitMappings(); + + /* Create the joystick list lock */ + if (!SDL_joystick_lock) { + SDL_joystick_lock = SDL_CreateMutex(); + } + /* See if we should allow joystick events while in the background */ SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_JoystickAllowBackgroundEventsChanged, NULL); @@ -83,13 +110,45 @@ SDL_NumJoysticks(void) const char * SDL_JoystickNameForIndex(int device_index) { - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { + if (device_index < 0 || device_index >= SDL_NumJoysticks()) { SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); return (NULL); } return (SDL_SYS_JoystickNameForDeviceIndex(device_index)); } +/* + * Return true if this joystick is known to have all axes centered at zero + * This isn't generally needed unless the joystick never generates an initial axis value near zero, + * e.g. it's emulating axes with digital buttons + */ +static SDL_bool +SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick) +{ + static Uint32 zero_centered_joysticks[] = { + MAKE_VIDPID(0x0e8f, 0x3013), /* HuiJia SNES USB adapter */ + MAKE_VIDPID(0x05a0, 0x3232), /* 8Bitdo Zero Gamepad */ + }; + + int i; + Uint32 id = MAKE_VIDPID(SDL_JoystickGetVendor(joystick), + SDL_JoystickGetProduct(joystick)); + +/*printf("JOYSTICK '%s' VID/PID 0x%.4x/0x%.4x AXES: %d\n", joystick->name, vendor, product, joystick->naxes);*/ + + if (joystick->naxes == 2) { + /* Assume D-pad or thumbstick style axes are centered at 0 */ + return SDL_TRUE; + } + + for (i = 0; i < SDL_arraysize(zero_centered_joysticks); ++i) { + if (id == zero_centered_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + /* * Open a joystick for use - the index passed as an argument refers to * the N'th joystick on the system. This index is the value which will @@ -109,29 +168,33 @@ SDL_JoystickOpen(int device_index) return (NULL); } + SDL_LockJoysticks(); + joysticklist = SDL_joysticks; /* If the joystick is already open, return it - * it is important that we have a single joystick * for each instance id - */ + * it is important that we have a single joystick * for each instance id + */ while (joysticklist) { - if (SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == joysticklist->instance_id) { + if (SDL_JoystickGetDeviceInstanceID(device_index) == joysticklist->instance_id) { joystick = joysticklist; ++joystick->ref_count; + SDL_UnlockJoysticks(); return (joystick); } joysticklist = joysticklist->next; } /* Create and initialize the joystick */ - joystick = (SDL_Joystick *) SDL_malloc((sizeof *joystick)); + joystick = (SDL_Joystick *) SDL_calloc(sizeof(*joystick), 1); if (joystick == NULL) { SDL_OutOfMemory(); + SDL_UnlockJoysticks(); return NULL; } - SDL_memset(joystick, 0, (sizeof *joystick)); if (SDL_SYS_JoystickOpen(joystick, device_index) < 0) { SDL_free(joystick); + SDL_UnlockJoysticks(); return NULL; } @@ -142,20 +205,16 @@ SDL_JoystickOpen(int device_index) joystick->name = NULL; if (joystick->naxes > 0) { - joystick->axes = (Sint16 *) SDL_malloc(joystick->naxes * sizeof(Sint16)); - joystick->axes_zero = (Sint16 *) SDL_malloc(joystick->naxes * sizeof(Sint16)); + joystick->axes = (SDL_JoystickAxisInfo *) SDL_calloc(joystick->naxes, sizeof(SDL_JoystickAxisInfo)); } if (joystick->nhats > 0) { - joystick->hats = (Uint8 *) SDL_malloc - (joystick->nhats * sizeof(Uint8)); + joystick->hats = (Uint8 *) SDL_calloc(joystick->nhats, sizeof(Uint8)); } if (joystick->nballs > 0) { - joystick->balls = (struct balldelta *) SDL_malloc - (joystick->nballs * sizeof(*joystick->balls)); + joystick->balls = (struct balldelta *) SDL_calloc(joystick->nballs, sizeof(*joystick->balls)); } if (joystick->nbuttons > 0) { - joystick->buttons = (Uint8 *) SDL_malloc - (joystick->nbuttons * sizeof(Uint8)); + joystick->buttons = (Uint8 *) SDL_calloc(joystick->nbuttons, sizeof(Uint8)); } if (((joystick->naxes > 0) && !joystick->axes) || ((joystick->nhats > 0) && !joystick->hats) @@ -163,30 +222,30 @@ SDL_JoystickOpen(int device_index) || ((joystick->nbuttons > 0) && !joystick->buttons)) { SDL_OutOfMemory(); SDL_JoystickClose(joystick); + SDL_UnlockJoysticks(); return NULL; } - if (joystick->axes) { - SDL_memset(joystick->axes, 0, joystick->naxes * sizeof(Sint16)); - SDL_memset(joystick->axes_zero, 0, joystick->naxes * sizeof(Sint16)); - } - if (joystick->hats) { - SDL_memset(joystick->hats, 0, joystick->nhats * sizeof(Uint8)); - } - if (joystick->balls) { - SDL_memset(joystick->balls, 0, - joystick->nballs * sizeof(*joystick->balls)); - } - if (joystick->buttons) { - SDL_memset(joystick->buttons, 0, joystick->nbuttons * sizeof(Uint8)); - } joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + /* If this joystick is known to have all zero centered axes, skip the auto-centering code */ + if (SDL_JoystickAxesCenteredAtZero(joystick)) { + int i; + + for (i = 0; i < joystick->naxes; ++i) { + joystick->axes[i].has_initial_value = SDL_TRUE; + } + } + + joystick->is_game_controller = SDL_IsGameController(device_index); + /* Add joystick to list */ ++joystick->ref_count; /* Link the joystick in the list */ joystick->next = SDL_joysticks; SDL_joysticks = joystick; + SDL_UnlockJoysticks(); + SDL_SYS_JoystickUpdate(joystick); return (joystick); @@ -271,7 +330,7 @@ SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis) return (0); } if (axis < joystick->naxes) { - state = joystick->axes[axis]; + state = joystick->axes[axis].value; } else { SDL_SetError("Joystick only has %d axes", joystick->naxes); state = 0; @@ -279,6 +338,25 @@ SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis) return (state); } +/* + * Get the initial state of an axis control on a joystick + */ +SDL_bool +SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, int axis, Sint16 *state) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return SDL_FALSE; + } + if (axis >= joystick->naxes) { + SDL_SetError("Joystick only has %d axes", joystick->naxes); + return SDL_FALSE; + } + if (state) { + *state = joystick->axes[axis].initial_value; + } + return joystick->axes[axis].has_initial_value; +} + /* * Get the current state of a hat on a joystick */ @@ -380,14 +458,16 @@ SDL_JoystickInstanceID(SDL_Joystick * joystick) SDL_Joystick * SDL_JoystickFromInstanceID(SDL_JoystickID joyid) { - SDL_Joystick *joystick = SDL_joysticks; - while (joystick) { + SDL_Joystick *joystick; + + SDL_LockJoysticks(); + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->instance_id == joyid) { + SDL_UnlockJoysticks(); return joystick; } - joystick = joystick->next; } - + SDL_UnlockJoysticks(); return NULL; } @@ -417,12 +497,16 @@ SDL_JoystickClose(SDL_Joystick * joystick) return; } + SDL_LockJoysticks(); + /* First decrement ref count */ if (--joystick->ref_count > 0) { + SDL_UnlockJoysticks(); return; } - if (joystick == SDL_updating_joystick) { + if (SDL_updating_joystick) { + SDL_UnlockJoysticks(); return; } @@ -453,6 +537,8 @@ SDL_JoystickClose(SDL_Joystick * joystick) SDL_free(joystick->balls); SDL_free(joystick->buttons); SDL_free(joystick); + + SDL_UnlockJoysticks(); } void @@ -461,6 +547,8 @@ SDL_JoystickQuit(void) /* Make sure we're not getting called in the middle of updating joysticks */ SDL_assert(!SDL_updating_joystick); + SDL_LockJoysticks(); + /* Stop the event polling */ while (SDL_joysticks) { SDL_joysticks->ref_count = 1; @@ -470,9 +558,21 @@ SDL_JoystickQuit(void) /* Quit the joystick setup */ SDL_SYS_JoystickQuit(); + SDL_UnlockJoysticks(); + #if !SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif + + SDL_DelHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + SDL_JoystickAllowBackgroundEventsChanged, NULL); + + if (SDL_joystick_lock) { + SDL_DestroyMutex(SDL_joystick_lock); + SDL_joystick_lock = NULL; + } + + SDL_GameControllerQuitMappings(); } @@ -483,16 +583,10 @@ SDL_PrivateJoystickShouldIgnoreEvent() return SDL_FALSE; } - if (SDL_WasInit(SDL_INIT_VIDEO)) { - if (SDL_GetKeyboardFocus() == NULL) { - /* Video is initialized and we don't have focus, ignore the event. */ - return SDL_TRUE; - } else { - return SDL_FALSE; - } + if (SDL_HasWindows() && SDL_GetKeyboardFocus() == NULL) { + /* We have windows but we don't have focus, ignore the event. */ + return SDL_TRUE; } - - /* Video subsystem wasn't initialized, always allow the event */ return SDL_FALSE; } @@ -507,10 +601,7 @@ void SDL_PrivateJoystickAdded(int device_index) if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.jdevice.which = device_index; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } + SDL_PushEvent(&event); } #endif /* !SDL_EVENTS_DISABLED */ } @@ -553,10 +644,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance) if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.jdevice.which = device_instance; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } + SDL_PushEvent(&event); } UpdateEventsForDeviceRemoval(); @@ -572,22 +660,38 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value) if (axis >= joystick->naxes) { return 0; } - if (value == joystick->axes[axis]) { + if (!joystick->axes[axis].has_initial_value) { + joystick->axes[axis].initial_value = value; + joystick->axes[axis].value = value; + joystick->axes[axis].zero = value; + joystick->axes[axis].has_initial_value = SDL_TRUE; + } + if (value == joystick->axes[axis].value) { return 0; } + if (!joystick->axes[axis].sent_initial_value) { + /* Make sure we don't send motion until there's real activity on this axis */ + const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */ + if (SDL_abs(value - joystick->axes[axis].value) <= MAX_ALLOWED_JITTER) { + return 0; + } + joystick->axes[axis].sent_initial_value = SDL_TRUE; + joystick->axes[axis].value = value; /* Just so we pass the check above */ + SDL_PrivateJoystickAxis(joystick, axis, joystick->axes[axis].initial_value); + } /* We ignore events if we don't have keyboard focus, except for centering * events. */ if (SDL_PrivateJoystickShouldIgnoreEvent()) { - if ((value > joystick->axes_zero[axis] && value >= joystick->axes[axis]) || - (value < joystick->axes_zero[axis] && value <= joystick->axes[axis])) { + if ((value > joystick->axes[axis].zero && value >= joystick->axes[axis].value) || + (value < joystick->axes[axis].zero && value <= joystick->axes[axis].value)) { return 0; } } /* Update internal joystick state */ - joystick->axes[axis] = value; + joystick->axes[axis].value = value; /* Post the event, if desired */ posted = 0; @@ -737,24 +841,30 @@ SDL_JoystickUpdate(void) { SDL_Joystick *joystick; - joystick = SDL_joysticks; - while (joystick) { - SDL_Joystick *joysticknext; - /* save off the next pointer, the Update call may cause a joystick removed event - * and cause our joystick pointer to be freed - */ - joysticknext = joystick->next; + SDL_LockJoysticks(); - SDL_updating_joystick = joystick; + if (SDL_updating_joystick) { + /* The joysticks are already being updated */ + SDL_UnlockJoysticks(); + return; + } + SDL_updating_joystick = SDL_TRUE; + + /* Make sure the list is unlocked while dispatching events to prevent application deadlocks */ + SDL_UnlockJoysticks(); + + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { SDL_SYS_JoystickUpdate(joystick); if (joystick->force_recentering) { int i; - /* Tell the app that everything is centered/unpressed... */ + /* Tell the app that everything is centered/unpressed... */ for (i = 0; i < joystick->naxes; i++) { - SDL_PrivateJoystickAxis(joystick, i, joystick->axes_zero[i]); + if (joystick->axes[i].has_initial_value) { + SDL_PrivateJoystickAxis(joystick, i, joystick->axes[i].zero); + } } for (i = 0; i < joystick->nbuttons; i++) { @@ -767,21 +877,25 @@ SDL_JoystickUpdate(void) joystick->force_recentering = SDL_FALSE; } + } - SDL_updating_joystick = NULL; + SDL_LockJoysticks(); - /* If the joystick was closed while updating, free it here */ + SDL_updating_joystick = SDL_FALSE; + + /* If any joysticks were closed while updating, free them here */ + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->ref_count <= 0) { SDL_JoystickClose(joystick); } - - joystick = joysticknext; } /* this needs to happen AFTER walking the joystick list above, so that any dangling hardware data from removed devices can be free'd */ SDL_SYS_JoystickDetect(); + + SDL_UnlockJoysticks(); } int @@ -816,10 +930,154 @@ SDL_JoystickEventState(int state) #endif /* SDL_EVENTS_DISABLED */ } +void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version) +{ + Uint16 *guid16 = (Uint16 *)guid.data; + + /* If the GUID fits the form of BUS 0000 VENDOR 0000 PRODUCT 0000, return the data */ + if (/* guid16[0] is device bus type */ + guid16[1] == 0x0000 && + /* guid16[2] is vendor ID */ + guid16[3] == 0x0000 && + /* guid16[4] is product ID */ + guid16[5] == 0x0000 + /* guid16[6] is product version */ + ) { + if (vendor) { + *vendor = guid16[2]; + } + if (product) { + *product = guid16[4]; + } + if (version) { + *version = guid16[6]; + } + } else { + if (vendor) { + *vendor = 0; + } + if (product) { + *product = 0; + } + if (version) { + *version = 0; + } + } +} + +static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid) +{ + static Uint32 wheel_joysticks[] = { + MAKE_VIDPID(0x046d, 0xc294), /* Logitech generic wheel */ + MAKE_VIDPID(0x046d, 0xc295), /* Logitech Momo Force */ + MAKE_VIDPID(0x046d, 0xc298), /* Logitech Driving Force Pro */ + MAKE_VIDPID(0x046d, 0xc299), /* Logitech G25 */ + MAKE_VIDPID(0x046d, 0xc29a), /* Logitech Driving Force GT */ + MAKE_VIDPID(0x046d, 0xc29b), /* Logitech G27 */ + MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */ + MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */ + MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */ + MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */ + MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */ + }; + int i; + + for (i = 0; i < SDL_arraysize(wheel_joysticks); ++i) { + if (vidpid == wheel_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid) +{ + static Uint32 flightstick_joysticks[] = { + MAKE_VIDPID(0x044f, 0x0402), /* HOTAS Warthog Joystick */ + MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */ + }; + int i; + + for (i = 0; i < SDL_arraysize(flightstick_joysticks); ++i) { + if (vidpid == flightstick_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_IsJoystickProductThrottle(Uint32 vidpid) +{ + static Uint32 throttle_joysticks[] = { + MAKE_VIDPID(0x044f, 0x0404), /* HOTAS Warthog Throttle */ + MAKE_VIDPID(0x0738, 0xa221), /* Saitek Pro Flight X-56 Rhino Throttle */ + }; + int i; + + for (i = 0; i < SDL_arraysize(throttle_joysticks); ++i) { + if (vidpid == throttle_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid) +{ + Uint16 vendor; + Uint16 product; + Uint32 vidpid; + + if (guid.data[14] == 'x') { + /* XInput GUID, get the type based on the XInput device subtype */ + switch (guid.data[15]) { + case 0x01: /* XINPUT_DEVSUBTYPE_GAMEPAD */ + return SDL_JOYSTICK_TYPE_GAMECONTROLLER; + case 0x02: /* XINPUT_DEVSUBTYPE_WHEEL */ + return SDL_JOYSTICK_TYPE_WHEEL; + case 0x03: /* XINPUT_DEVSUBTYPE_ARCADE_STICK */ + return SDL_JOYSTICK_TYPE_ARCADE_STICK; + case 0x04: /* XINPUT_DEVSUBTYPE_FLIGHT_STICK */ + return SDL_JOYSTICK_TYPE_FLIGHT_STICK; + case 0x05: /* XINPUT_DEVSUBTYPE_DANCE_PAD */ + return SDL_JOYSTICK_TYPE_DANCE_PAD; + case 0x06: /* XINPUT_DEVSUBTYPE_GUITAR */ + case 0x07: /* XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE */ + case 0x0B: /* XINPUT_DEVSUBTYPE_GUITAR_BASS */ + return SDL_JOYSTICK_TYPE_GUITAR; + case 0x08: /* XINPUT_DEVSUBTYPE_DRUM_KIT */ + return SDL_JOYSTICK_TYPE_DRUM_KIT; + case 0x13: /* XINPUT_DEVSUBTYPE_ARCADE_PAD */ + return SDL_JOYSTICK_TYPE_ARCADE_PAD; + default: + return SDL_JOYSTICK_TYPE_UNKNOWN; + } + } + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); + vidpid = MAKE_VIDPID(vendor, product); + + if (SDL_IsJoystickProductWheel(vidpid)) { + return SDL_JOYSTICK_TYPE_WHEEL; + } + + if (SDL_IsJoystickProductFlightStick(vidpid)) { + return SDL_JOYSTICK_TYPE_FLIGHT_STICK; + } + + if (SDL_IsJoystickProductThrottle(vidpid)) { + return SDL_JOYSTICK_TYPE_THROTTLE; + } + + return SDL_JOYSTICK_TYPE_UNKNOWN; +} + /* return the guid for this index */ SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) { - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { + if (device_index < 0 || device_index >= SDL_NumJoysticks()) { SDL_JoystickGUID emptyGUID; SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); SDL_zero(emptyGUID); @@ -828,7 +1086,56 @@ SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) return SDL_SYS_JoystickGetDeviceGUID(device_index); } -/* return the guid for this opened device */ +Uint16 SDL_JoystickGetDeviceVendor(int device_index) +{ + Uint16 vendor; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL); + return vendor; +} + +Uint16 SDL_JoystickGetDeviceProduct(int device_index) +{ + Uint16 product; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL); + return product; +} + +Uint16 SDL_JoystickGetDeviceProductVersion(int device_index) +{ + Uint16 version; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version); + return version; +} + +SDL_JoystickType SDL_JoystickGetDeviceType(int device_index) +{ + SDL_JoystickType type; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + type = SDL_GetJoystickGUIDType(guid); + if (type == SDL_JOYSTICK_TYPE_UNKNOWN) { + if (SDL_IsGameController(device_index)) { + type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + } + } + return type; +} + +SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index) +{ + if (device_index < 0 || device_index >= SDL_NumJoysticks()) { + SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); + return -1; + } + return SDL_SYS_GetInstanceIdOfDeviceIndex(device_index); +} + SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick) { if (!SDL_PrivateJoystickValid(joystick)) { @@ -839,6 +1146,47 @@ SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick) return SDL_SYS_JoystickGetGUID(joystick); } +Uint16 SDL_JoystickGetVendor(SDL_Joystick * joystick) +{ + Uint16 vendor; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL); + return vendor; +} + +Uint16 SDL_JoystickGetProduct(SDL_Joystick * joystick) +{ + Uint16 product; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL); + return product; +} + +Uint16 SDL_JoystickGetProductVersion(SDL_Joystick * joystick) +{ + Uint16 version; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version); + return version; +} + +SDL_JoystickType SDL_JoystickGetType(SDL_Joystick * joystick) +{ + SDL_JoystickType type; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + type = SDL_GetJoystickGUIDType(guid); + if (type == SDL_JOYSTICK_TYPE_UNKNOWN) { + if (joystick && joystick->is_game_controller) { + type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + } + } + return type; +} + /* convert the guid to a printable string */ void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID) { @@ -925,5 +1273,4 @@ SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick) return joystick->epowerlevel; } - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/SDL_joystick_c.h b/Engine/lib/sdl/src/joystick/SDL_joystick_c.h index cb9c92544..0a8fdb455 100644 --- a/Engine/lib/sdl/src/joystick/SDL_joystick_c.h +++ b/Engine/lib/sdl/src/joystick/SDL_joystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,9 +28,19 @@ extern int SDL_JoystickInit(void); extern void SDL_JoystickQuit(void); /* Initialization and shutdown functions */ +extern int SDL_GameControllerInitMappings(void); +extern void SDL_GameControllerQuitMappings(void); extern int SDL_GameControllerInit(void); extern void SDL_GameControllerQuit(void); +/* Function to extract information from an SDL joystick GUID */ +extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version); + +/* Function to return whether a joystick name and GUID is a game controller */ +extern SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid); + +/* Function to return whether a game controller should be ignored */ +extern SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid); /* Internal event queueing functions */ extern void SDL_PrivateJoystickAdded(int device_index); diff --git a/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h b/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h index f4cad05ec..7de5d83d2 100644 --- a/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h +++ b/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysjoystick_h -#define _SDL_sysjoystick_h +#ifndef SDL_sysjoystick_h_ +#define SDL_sysjoystick_h_ /* This is the system specific header for the SDL joystick API */ @@ -29,14 +29,22 @@ #include "SDL_joystick_c.h" /* The SDL joystick structure */ +typedef struct _SDL_JoystickAxisInfo +{ + Sint16 initial_value; /* Initial axis state */ + Sint16 value; /* Current axis state */ + Sint16 zero; /* Zero point on the axis (-32768 for triggers) */ + SDL_bool has_initial_value; /* Whether we've seen a value on the axis yet */ + SDL_bool sent_initial_value; /* Whether we've sent the initial axis value */ +} SDL_JoystickAxisInfo; + struct _SDL_Joystick { SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */ char *name; /* Joystick name - system dependent */ int naxes; /* Number of axis controls on the joystick */ - Sint16 *axes; /* Current axis states */ - Sint16 *axes_zero; /* Zero point on the axis (-32768 for triggers) */ + SDL_JoystickAxisInfo *axes; int nhats; /* Number of hats on the joystick */ Uint8 *hats; /* Current hat states */ @@ -54,11 +62,15 @@ struct _SDL_Joystick int ref_count; /* Reference count for multiple opens */ + SDL_bool is_game_controller; SDL_bool force_recentering; /* SDL_TRUE if this device needs to have its state reset to 0 */ SDL_JoystickPowerLevel epowerlevel; /* power level of this joystick, SDL_JOYSTICK_POWER_UNKNOWN if not supported */ struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */ }; +/* Macro to combine a USB vendor ID and product ID into a single Uint32 value */ +#define MAKE_VIDPID(VID, PID) (((Uint32)(VID))<<16|(PID)) + /* Function to scan the system for joysticks. * Joystick 0 should be the system default joystick. * This function should return the number of available joysticks, or -1 @@ -67,10 +79,10 @@ struct _SDL_Joystick extern int SDL_SYS_JoystickInit(void); /* Function to return the number of joystick devices plugged in right now */ -extern int SDL_SYS_NumJoysticks(); +extern int SDL_SYS_NumJoysticks(void); /* Function to cause any queued joystick insertions to be processed */ -extern void SDL_SYS_JoystickDetect(); +extern void SDL_SYS_JoystickDetect(void); /* Function to get the device-dependent name of a joystick */ extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index); @@ -114,6 +126,11 @@ extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick); extern SDL_bool SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index); #endif -#endif /* _SDL_sysjoystick_h */ +#if defined(__ANDROID__) +/* Function returns SDL_TRUE if this device is a DPAD (maybe a TV remote) */ +extern SDL_bool SDL_SYS_IsDPAD_DeviceIndex(int device_index); +#endif + +#endif /* SDL_sysjoystick_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c index a09e9a12c..ce5a5df0b 100644 --- a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,9 @@ #include "SDL_log.h" #include "SDL_sysjoystick_c.h" #include "../SDL_joystick_c.h" +#include "../../events/SDL_keyboard_c.h" #include "../../core/android/SDL_android.h" +#include "../steam/SDL_steamcontroller.h" #include "android/keycodes.h" @@ -77,10 +79,9 @@ static int instance_counter = 0; static int keycode_to_SDL(int keycode) { - /* FIXME: If this function gets too unwiedly in the future, replace with a lookup table */ + /* FIXME: If this function gets too unwieldy in the future, replace with a lookup table */ int button = 0; - switch(keycode) - { + switch (keycode) { /* Some gamepad buttons (API 9) */ case AKEYCODE_BUTTON_A: button = SDL_CONTROLLER_BUTTON_A; @@ -109,6 +110,7 @@ keycode_to_SDL(int keycode) case AKEYCODE_BUTTON_START: button = SDL_CONTROLLER_BUTTON_START; break; + case AKEYCODE_BACK: case AKEYCODE_BUTTON_SELECT: button = SDL_CONTROLLER_BUTTON_BACK; break; @@ -142,7 +144,9 @@ keycode_to_SDL(int keycode) button = SDL_CONTROLLER_BUTTON_DPAD_RIGHT; break; case AKEYCODE_DPAD_CENTER: - button = SDL_CONTROLLER_BUTTON_MAX+4; /* Not supported by GameController */ + /* This is handled better by applications as the A button */ + /*button = SDL_CONTROLLER_BUTTON_MAX+4;*/ /* Not supported by GameController */ + button = SDL_CONTROLLER_BUTTON_A; break; /* More gamepad buttons (API 12), these get mapped to 20...35*/ @@ -167,7 +171,7 @@ keycode_to_SDL(int keycode) default: return -1; - break; + /* break; -Wunreachable-code-break */ } /* This is here in case future generations, probably with six fingers per hand, @@ -175,7 +179,30 @@ keycode_to_SDL(int keycode) */ SDL_assert(button < ANDROID_MAX_NBUTTONS); return button; - +} + +static SDL_Scancode +button_to_scancode(int button) +{ + switch (button) { + case SDL_CONTROLLER_BUTTON_A: + return SDL_SCANCODE_RETURN; + case SDL_CONTROLLER_BUTTON_B: + return SDL_SCANCODE_ESCAPE; + case SDL_CONTROLLER_BUTTON_BACK: + return SDL_SCANCODE_ESCAPE; + case SDL_CONTROLLER_BUTTON_DPAD_UP: + return SDL_SCANCODE_UP; + case SDL_CONTROLLER_BUTTON_DPAD_DOWN: + return SDL_SCANCODE_DOWN; + case SDL_CONTROLLER_BUTTON_DPAD_LEFT: + return SDL_SCANCODE_LEFT; + case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: + return SDL_SCANCODE_RIGHT; + } + + /* Unsupported button */ + return SDL_SCANCODE_UNKNOWN; } int @@ -187,6 +214,8 @@ Android_OnPadDown(int device_id, int keycode) item = JoystickByDeviceId(device_id); if (item && item->joystick) { SDL_PrivateJoystickButton(item->joystick, button , SDL_PRESSED); + } else { + SDL_SendKeyboardKey(SDL_PRESSED, button_to_scancode(button)); } return 0; } @@ -203,6 +232,8 @@ Android_OnPadUp(int device_id, int keycode) item = JoystickByDeviceId(device_id); if (item && item->joystick) { SDL_PrivateJoystickButton(item->joystick, button, SDL_RELEASED); + } else { + SDL_SendKeyboardKey(SDL_RELEASED, button_to_scancode(button)); } return 0; } @@ -216,7 +247,7 @@ Android_OnJoy(int device_id, int axis, float value) /* Android gives joy info normalized as [-1.0, 1.0] or [0.0, 1.0] */ SDL_joylist_item *item = JoystickByDeviceId(device_id); if (item && item->joystick) { - SDL_PrivateJoystickAxis(item->joystick, axis, (Sint16) (32767.*value) ); + SDL_PrivateJoystickAxis(item->joystick, axis, (Sint16) (32767.*value)); } return 0; @@ -234,7 +265,7 @@ Android_OnHat(int device_id, int hat_id, int x, int y) if (x >= -1 && x <=1 && y >= -1 && y <= 1) { SDL_joylist_item *item = JoystickByDeviceId(device_id); if (item && item->joystick) { - SDL_PrivateJoystickHat(item->joystick, hat_id, position_map[y+1][x+1] ); + SDL_PrivateJoystickHat(item->joystick, hat_id, position_map[y+1][x+1]); } return 0; } @@ -244,18 +275,25 @@ Android_OnHat(int device_id, int hat_id, int x, int y) int -Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs) +Android_AddJoystick(int device_id, const char *name, const char *desc, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs) { SDL_JoystickGUID guid; SDL_joylist_item *item; + + if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { + /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ + if (naxes < 2 && nhats < 1) { + return -1; + } + } - if(JoystickByDeviceId(device_id) != NULL || name == NULL) { + if (JoystickByDeviceId(device_id) != NULL || name == NULL) { return -1; } /* the GUID is just the first 16 chars of the name for now */ - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); + SDL_zero(guid); + SDL_memcpy(&guid, desc, SDL_min(sizeof(guid), SDL_strlen(desc))); item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item)); if (item == NULL) { @@ -266,7 +304,7 @@ Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, item->guid = guid; item->device_id = device_id; item->name = SDL_strdup(name); - if ( item->name == NULL ) { + if (item->name == NULL) { SDL_free(item); return -1; } @@ -349,6 +387,79 @@ Android_RemoveJoystick(int device_id) } +static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) +{ + SDL_joylist_item *item; + + item = (SDL_joylist_item *)SDL_calloc(1, sizeof (SDL_joylist_item)); + if (item == NULL) { + return SDL_FALSE; + } + + *device_instance = item->device_instance = instance_counter++; + item->device_id = -1; + item->name = SDL_strdup(name); + item->guid = guid; + SDL_GetSteamControllerInputs(&item->nbuttons, + &item->naxes, + &item->nhats); + item->m_bSteamController = SDL_TRUE; + + if (SDL_joylist_tail == NULL) { + SDL_joylist = SDL_joylist_tail = item; + } else { + SDL_joylist_tail->next = item; + SDL_joylist_tail = item; + } + + /* Need to increment the joystick count before we post the event */ + ++numjoysticks; + + SDL_PrivateJoystickAdded(numjoysticks - 1); + + return SDL_TRUE; +} + +static void SteamControllerDisconnectedCallback(int device_instance) +{ + SDL_joylist_item *item = SDL_joylist; + SDL_joylist_item *prev = NULL; + + while (item != NULL) { + if (item->device_instance == device_instance) { + break; + } + prev = item; + item = item->next; + } + + if (item == NULL) { + return; + } + + if (item->joystick) { + item->joystick->hwdata = NULL; + } + + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_joylist == item); + SDL_joylist = item->next; + } + if (item == SDL_joylist_tail) { + SDL_joylist_tail = prev; + } + + /* Need to decrement the joystick count before we post the event */ + --numjoysticks; + + SDL_PrivateJoystickRemoved(item->device_instance); + + SDL_free(item->name); + SDL_free(item); +} + int SDL_SYS_JoystickInit(void) { @@ -356,29 +467,36 @@ SDL_SYS_JoystickInit(void) if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ - Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, SDL_TRUE, 0, 3, 0, 0); + Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, ANDROID_ACCELEROMETER_NAME, SDL_TRUE, 0, 3, 0, 0); } + SDL_InitSteamControllers(SteamControllerConnectedCallback, + SteamControllerDisconnectedCallback); + return (numjoysticks); } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { /* Support for device connect/disconnect is API >= 16 only, * so we poll every three seconds * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html */ static Uint32 timeout = 0; - if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + if (!timeout || SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { timeout = SDL_GetTicks() + 3000; Android_JNI_PollInputDevices(); } + + SDL_UpdateSteamControllers(); } static SDL_joylist_item * @@ -447,7 +565,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_joylist_item *item = JoystickByDevIndex(device_index); - if (item == NULL ) { + if (item == NULL) { return SDL_SetError("No such device"); } @@ -475,30 +593,34 @@ SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { - int i; - Sint16 value; - float values[3]; - SDL_joylist_item *item = SDL_joylist; + SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata; - while (item) { - if (item->is_accelerometer) { - if (item->joystick) { - if (Android_JNI_GetAccelerometerValues(values)) { - for ( i = 0; i < 3; i++ ) { - if (values[i] > 1.0f) { - values[i] = 1.0f; - } else if (values[i] < -1.0f) { - values[i] = -1.0f; - } + if (item == NULL) { + return; + } + + if (item->m_bSteamController) { + SDL_UpdateSteamController(joystick); + return; + } - value = (Sint16)(values[i] * 32767.0f); - SDL_PrivateJoystickAxis(item->joystick, i, value); - } + if (item->is_accelerometer) { + int i; + Sint16 value; + float values[3]; + + if (Android_JNI_GetAccelerometerValues(values)) { + for (i = 0; i < 3; i++) { + if (values[i] > 1.0f) { + values[i] = 1.0f; + } else if (values[i] < -1.0f) { + values[i] = -1.0f; } + + value = (Sint16)(values[i] * 32767.0f); + SDL_PrivateJoystickAxis(item->joystick, i, value); } - break; } - item = item->next; } } @@ -516,6 +638,10 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) void SDL_SYS_JoystickQuit(void) { +/* We don't have any way to scan for joysticks at init, so don't wipe the list + * of joysticks here in case this is a reinit. + */ +#if 0 SDL_joylist_item *item = NULL; SDL_joylist_item *next = NULL; @@ -529,9 +655,12 @@ SDL_SYS_JoystickQuit(void) numjoysticks = 0; instance_counter = 0; +#endif /* 0 */ + + SDL_QuitSteamControllers(); } -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) +SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index) { return JoystickByDevIndex(device_index)->guid; } @@ -548,6 +677,11 @@ SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) return guid; } +SDL_bool SDL_SYS_IsDPAD_DeviceIndex(int device_index) +{ + return JoystickByDevIndex(device_index)->naxes == 0; +} + #endif /* SDL_JOYSTICK_ANDROID */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h index 51803db35..c2cbc4e6a 100644 --- a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,13 +22,17 @@ #include "../../SDL_internal.h" #ifdef SDL_JOYSTICK_ANDROID + +#ifndef SDL_sysjoystick_c_h_ +#define SDL_sysjoystick_c_h_ + #include "../SDL_sysjoystick.h" extern int Android_OnPadDown(int device_id, int keycode); extern int Android_OnPadUp(int device_id, int keycode); extern int Android_OnJoy(int device_id, int axisnum, float value); extern int Android_OnHat(int device_id, int hat_id, int x, int y); -extern int Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs); +extern int Android_AddJoystick(int device_id, const char *name, const char *desc, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs); extern int Android_RemoveJoystick(int device_id); /* A linked list of available joysticks */ @@ -42,11 +46,16 @@ typedef struct SDL_joylist_item SDL_Joystick *joystick; int nbuttons, naxes, nhats, nballs; + /* Steam Controller support */ + SDL_bool m_bSteamController; + struct SDL_joylist_item *next; } SDL_joylist_item; typedef SDL_joylist_item joystick_hwdata; +#endif /* SDL_sysjoystick_c_h_ */ + #endif /* SDL_JOYSTICK_ANDROID */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c index ddc899f6e..940854504 100644 --- a/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -204,12 +204,14 @@ SDL_SYS_JoystickInit(void) return (SDL_SYS_numjoysticks); } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return SDL_SYS_numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { } @@ -520,12 +522,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) v *= 32768 / ((ymax - ymin + 1) / 2); SDL_PrivateJoystickAxis(joy, 1, v); } - if (gameport.b1 != joy->buttons[0]) { - SDL_PrivateJoystickButton(joy, 0, gameport.b1); - } - if (gameport.b2 != joy->buttons[1]) { - SDL_PrivateJoystickButton(joy, 1, gameport.b2); - } + SDL_PrivateJoystickButton(joy, 0, gameport.b1); + SDL_PrivateJoystickButton(joy, 1, gameport.b2); } return; } @@ -561,9 +559,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) v *= 32768 / ((hitem.logical_maximum - hitem.logical_minimum + 1) / 2); - if (v != joy->axes[naxe]) { - SDL_PrivateJoystickAxis(joy, naxe, v); - } + SDL_PrivateJoystickAxis(joy, naxe, v); } else if (usage == HUG_HAT_SWITCH) { v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); SDL_PrivateJoystickHat(joy, 0, @@ -574,9 +570,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) } case HUP_BUTTON: v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); - if (joy->buttons[nbutton] != v) { - SDL_PrivateJoystickButton(joy, nbutton, v); - } + SDL_PrivateJoystickButton(joy, nbutton, v); nbutton++; break; default: diff --git a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c index da10fbac5..abfb1c62b 100644 --- a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -105,10 +105,11 @@ FreeDevice(recDevice *removeDevice) return pDeviceNext; } -static SInt32 -GetHIDElementState(recDevice *pDevice, recElement *pElement) +static SDL_bool +GetHIDElementState(recDevice *pDevice, recElement *pElement, SInt32 *pValue) { SInt32 value = 0; + int returnValue = SDL_FALSE; if (pDevice && pElement) { IOHIDValueRef valueRef; @@ -122,25 +123,34 @@ GetHIDElementState(recDevice *pDevice, recElement *pElement) if (value > pElement->maxReport) { pElement->maxReport = value; } + *pValue = value; + + returnValue = SDL_TRUE; } } - - return value; + return returnValue; } -static SInt32 -GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max) +static SDL_bool +GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max, SInt32 *pValue) { const float deviceScale = max - min; const float readScale = pElement->maxReport - pElement->minReport; - const SInt32 value = GetHIDElementState(pDevice, pElement); - if (readScale == 0) { - return value; /* no scaling at all */ - } - return ((value - pElement->minReport) * deviceScale / readScale) + min; + int returnValue = SDL_FALSE; + if (GetHIDElementState(pDevice, pElement, pValue)) + { + if (readScale == 0) { + returnValue = SDL_TRUE; /* no scaling at all */ + } + else + { + *pValue = ((*pValue - pElement->minReport) * deviceScale / readScale) + min; + returnValue = SDL_TRUE; + } + } + return returnValue; } - static void JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *sender) { @@ -248,6 +258,8 @@ AddHIDElement(const void *value, void *parameter) switch (usage) { case kHIDUsage_Sim_Rudder: case kHIDUsage_Sim_Throttle: + case kHIDUsage_Sim_Accelerator: + case kHIDUsage_Sim_Brake: if (!ElementAlreadyAdded(cookie, pDevice->firstAxis)) { element = (recElement *) SDL_calloc(1, sizeof (recElement)); if (element) { @@ -321,9 +333,14 @@ AddHIDElement(const void *value, void *parameter) static SDL_bool GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) { - Uint32 *guid32 = NULL; + const Uint16 BUS_USB = 0x03; + const Uint16 BUS_BLUETOOTH = 0x05; + Sint32 vendor = 0; + Sint32 product = 0; + Sint32 version = 0; CFTypeRef refCF = NULL; CFArrayRef array = NULL; + Uint16 *guid16 = (Uint16 *)pDevice->guid.data; /* get usage page and usage */ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsagePageKey)); @@ -359,22 +376,32 @@ GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVendorIDKey)); if (refCF) { - CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->guid.data[0]); + CFNumberGetValue(refCF, kCFNumberSInt32Type, &vendor); } refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductIDKey)); if (refCF) { - CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->guid.data[8]); + CFNumberGetValue(refCF, kCFNumberSInt32Type, &product); } - /* Check to make sure we have a vendor and product ID - If we don't, use the same algorithm as the Linux code for Bluetooth devices */ - guid32 = (Uint32*)pDevice->guid.data; - if (!guid32[0] && !guid32[1]) { - /* If we don't have a vendor and product ID this is probably a Bluetooth device */ - const Uint16 BUS_BLUETOOTH = 0x05; - Uint16 *guid16 = (Uint16 *)guid32; - *guid16++ = BUS_BLUETOOTH; + refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVersionNumberKey)); + if (refCF) { + CFNumberGetValue(refCF, kCFNumberSInt32Type, &version); + } + + SDL_memset(pDevice->guid.data, 0, sizeof(pDevice->guid.data)); + + if (vendor && product) { + *guid16++ = SDL_SwapLE16(BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)version); + *guid16++ = 0; + } else { + *guid16++ = SDL_SwapLE16(BUS_BLUETOOTH); *guid16++ = 0; SDL_strlcpy((char*)guid16, pDevice->product, sizeof(pDevice->guid.data) - 4); } @@ -428,6 +455,12 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic return; /* not a device we care about, probably. */ } + if (SDL_IsGameControllerNameAndGUID(device->product, device->guid) && + SDL_ShouldIgnoreGameController(device->product, device->guid)) { + SDL_free(device); + return; + } + /* Get notified when this device is disconnected. */ IOHIDDeviceRegisterRemovalCallback(ioHIDDeviceObject, JoystickDeviceWasRemovedCallback, device); IOHIDDeviceScheduleWithRunLoop(ioHIDDeviceObject, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE); @@ -565,7 +598,7 @@ SDL_SYS_JoystickInit(void) /* Function to return the number of joystick devices plugged in right now */ int -SDL_SYS_NumJoysticks() +SDL_SYS_NumJoysticks(void) { recDevice *device = gpDeviceList; int nJoySticks = 0; @@ -583,7 +616,7 @@ SDL_SYS_NumJoysticks() /* Function to cause any queued joystick insertions to be processed */ void -SDL_SYS_JoystickDetect() +SDL_SYS_JoystickDetect(void) { recDevice *device = gpDeviceList; while (device) { @@ -594,8 +627,8 @@ SDL_SYS_JoystickDetect() } } - // run this after the checks above so we don't set device->removed and delete the device before - // SDL_SYS_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device + /* run this after the checks above so we don't set device->removed and delete the device before + SDL_SYS_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */ while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */ } @@ -675,11 +708,14 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) element = device->firstAxis; i = 0; + + int goodRead = SDL_FALSE; while (element) { - value = GetHIDScaledCalibratedState(device, element, -32768, 32767); - if (value != joystick->axes[i]) { + goodRead = GetHIDScaledCalibratedState(device, element, -32768, 32767, &value); + if (goodRead) { SDL_PrivateJoystickAxis(joystick, i, value); } + element = element->pNext; ++i; } @@ -687,67 +723,70 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) element = device->firstButton; i = 0; while (element) { - value = GetHIDElementState(device, element); - if (value > 1) { /* handle pressure-sensitive buttons */ - value = 1; - } - if (value != joystick->buttons[i]) { + goodRead = GetHIDElementState(device, element, &value); + if (goodRead) { + if (value > 1) { /* handle pressure-sensitive buttons */ + value = 1; + } SDL_PrivateJoystickButton(joystick, i, value); } + element = element->pNext; ++i; } element = device->firstHat; i = 0; + while (element) { Uint8 pos = 0; range = (element->max - element->min + 1); - value = GetHIDElementState(device, element) - element->min; - if (range == 4) { /* 4 position hatswitch - scale up value */ - value *= 2; - } else if (range != 8) { /* Neither a 4 nor 8 positions - fall back to default position (centered) */ - value = -1; - } - switch (value) { - case 0: - pos = SDL_HAT_UP; - break; - case 1: - pos = SDL_HAT_RIGHTUP; - break; - case 2: - pos = SDL_HAT_RIGHT; - break; - case 3: - pos = SDL_HAT_RIGHTDOWN; - break; - case 4: - pos = SDL_HAT_DOWN; - break; - case 5: - pos = SDL_HAT_LEFTDOWN; - break; - case 6: - pos = SDL_HAT_LEFT; - break; - case 7: - pos = SDL_HAT_LEFTUP; - break; - default: - /* Every other value is mapped to center. We do that because some - * joysticks use 8 and some 15 for this value, and apparently - * there are even more variants out there - so we try to be generous. - */ - pos = SDL_HAT_CENTERED; - break; - } + goodRead = GetHIDElementState(device, element, &value); + if (goodRead) { + value -= element->min; + if (range == 4) { /* 4 position hatswitch - scale up value */ + value *= 2; + } else if (range != 8) { /* Neither a 4 nor 8 positions - fall back to default position (centered) */ + value = -1; + } + switch (value) { + case 0: + pos = SDL_HAT_UP; + break; + case 1: + pos = SDL_HAT_RIGHTUP; + break; + case 2: + pos = SDL_HAT_RIGHT; + break; + case 3: + pos = SDL_HAT_RIGHTDOWN; + break; + case 4: + pos = SDL_HAT_DOWN; + break; + case 5: + pos = SDL_HAT_LEFTDOWN; + break; + case 6: + pos = SDL_HAT_LEFT; + break; + case 7: + pos = SDL_HAT_LEFTUP; + break; + default: + /* Every other value is mapped to center. We do that because some + * joysticks use 8 and some 15 for this value, and apparently + * there are even more variants out there - so we try to be generous. + */ + pos = SDL_HAT_CENTERED; + break; + } - if (pos != joystick->hats[i]) { SDL_PrivateJoystickHat(joystick, i, pos); } - + element = element->pNext; ++i; } diff --git a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h index 1c317eca7..cde6a5c21 100644 --- a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,5 +68,6 @@ struct joystick_hwdata }; typedef struct joystick_hwdata recDevice; - #endif /* SDL_JOYSTICK_IOKIT_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c index 10fda10da..3dd96a001 100644 --- a/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,12 +37,14 @@ SDL_SYS_JoystickInit(void) return 0; } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return 0; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { } diff --git a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c index 6b203667a..b5bcaad6c 100644 --- a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,6 @@ #include "SDL_events.h" #include "SDL_joystick.h" -#include "SDL_hints.h" #include "SDL_assert.h" #include "SDL_timer.h" #include "SDL_log.h" @@ -42,7 +41,7 @@ static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; static int instance_counter = 0; -EM_BOOL +static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData) { int i; @@ -111,7 +110,7 @@ Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepa return 1; } -EM_BOOL +static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData) { SDL_joylist_item *item = SDL_joylist; @@ -146,7 +145,7 @@ Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gam /* Need to decrement the joystick count before we post the event */ --numjoysticks; - SDL_PrivateJoystickRemoved(item->device_instance); + SDL_PrivateJoystickRemoved(item->device_instance); #ifdef DEBUG_JOYSTICK SDL_Log("Removed joystick with id %d", item->device_instance); @@ -240,12 +239,14 @@ JoystickByIndex(int index) return item; } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { } @@ -329,7 +330,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) for(i = 0; i < item->naxes; i++) { if(item->axis[i] != gamepadState.axis[i]) { - // do we need to do conversion? + /* do we need to do conversion? */ SDL_PrivateJoystickAxis(item->joystick, i, (Sint16) (32767.*gamepadState.axis[i])); } diff --git a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h index 41f613e11..0c2be1db4 100644 --- a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc b/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc index a680189c7..9ab2c72fd 100644 --- a/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc +++ b/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ /* This is the Haiku implementation of the SDL joystick API */ -#include -#include +#include +#include extern "C" { @@ -84,12 +84,12 @@ extern "C" return (SDL_SYS_numjoysticks); } - int SDL_SYS_NumJoysticks() + int SDL_SYS_NumJoysticks(void) { return SDL_SYS_numjoysticks; } - void SDL_SYS_JoystickDetect() + void SDL_SYS_JoystickDetect(void) { } @@ -176,10 +176,9 @@ extern "C" SDL_HAT_LEFT, SDL_HAT_LEFTUP }; - const int JITTER = (32768 / 10); /* 10% jitter threshold (ok?) */ BJoystick *stick; - int i, change; + int i; int16 *axes; uint8 *hats; uint32 buttons; @@ -197,24 +196,17 @@ extern "C" /* Generate axis motion events */ for (i = 0; i < joystick->naxes; ++i) { - change = ((int32) axes[i] - joystick->axes[i]); - if ((change > JITTER) || (change < -JITTER)) { - SDL_PrivateJoystickAxis(joystick, i, axes[i]); - } + SDL_PrivateJoystickAxis(joystick, i, axes[i]); } /* Generate hat change events */ for (i = 0; i < joystick->nhats; ++i) { - if (hats[i] != joystick->hats[i]) { - SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]); - } + SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]); } /* Generate button events */ for (i = 0; i < joystick->nbuttons; ++i) { - if ((buttons & 0x01) != joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01)); - } + SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01)); buttons >>= 1; } } @@ -236,12 +228,12 @@ extern "C" { int i; - for (i = 0; SDL_joyport[i]; ++i) { + for (i = 0; i < SDL_SYS_numjoysticks; ++i) { SDL_free(SDL_joyport[i]); } SDL_joyport[0] = NULL; - for (i = 0; SDL_joyname[i]; ++i) { + for (i = 0; i < SDL_SYS_numjoysticks; ++i) { SDL_free(SDL_joyname[i]); } SDL_joyname[0] = NULL; diff --git a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m index eb7e00032..d6014980c 100644 --- a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,12 +26,15 @@ /* needed for SDL_IPHONE_MAX_GFORCE macro */ #include "SDL_config_iphoneos.h" +#include "SDL_assert.h" #include "SDL_events.h" #include "SDL_joystick.h" #include "SDL_hints.h" #include "SDL_stdinc.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +#include "../steam/SDL_steamcontroller.h" + #if !SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" @@ -57,6 +60,7 @@ static SDL_JoystickDeviceItem *deviceList = NULL; static int numjoysticks = 0; static SDL_JoystickID instancecounter = 0; +int SDL_AppleTVRemoteOpenedAsJoystick = 0; static SDL_JoystickDeviceItem * GetDeviceForIndex(int device_index) @@ -113,6 +117,7 @@ SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *contr #if TARGET_OS_TV else if (controller.microGamepad) { device->guid.data[10] = 3; + device->remote = SDL_TRUE; } #endif /* TARGET_OS_TV */ @@ -147,6 +152,15 @@ SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer) { SDL_JoystickDeviceItem *device = deviceList; +#if TARGET_OS_TV + if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { + /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ + if (controller && !controller.extendedGamepad && !controller.gamepad && controller.microGamepad) { + return; + } + } +#endif + while (device != NULL) { if (device->controller == controller) { return; @@ -154,13 +168,11 @@ SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer) device = device->next; } - device = (SDL_JoystickDeviceItem *) SDL_malloc(sizeof(SDL_JoystickDeviceItem)); + device = (SDL_JoystickDeviceItem *) SDL_calloc(1, sizeof(SDL_JoystickDeviceItem)); if (device == NULL) { return; } - SDL_zerop(device); - device->accelerometer = accelerometer; device->instance_id = instancecounter++; @@ -242,7 +254,7 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device) --numjoysticks; - SDL_PrivateJoystickRemoved(device->instance_id); + SDL_PrivateJoystickRemoved(device->instance_id); SDL_free(device->name); SDL_free(device); @@ -251,7 +263,7 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device) } #if TARGET_OS_TV -static void +static void SDLCALL SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue) { BOOL allowRotation = newValue != NULL && *newValue != '0'; @@ -266,6 +278,50 @@ SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char * } #endif /* TARGET_OS_TV */ +static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) +{ + SDL_JoystickDeviceItem *device = (SDL_JoystickDeviceItem *)SDL_calloc(1, sizeof(SDL_JoystickDeviceItem)); + if (device == NULL) { + return SDL_FALSE; + } + + *device_instance = device->instance_id = instancecounter++; + device->name = SDL_strdup(name); + device->guid = guid; + SDL_GetSteamControllerInputs(&device->nbuttons, + &device->naxes, + &device->nhats); + device->m_bSteamController = SDL_TRUE; + + if (deviceList == NULL) { + deviceList = device; + } else { + SDL_JoystickDeviceItem *lastdevice = deviceList; + while (lastdevice->next != NULL) { + lastdevice = lastdevice->next; + } + lastdevice->next = device; + } + + ++numjoysticks; + + SDL_PrivateJoystickAdded(numjoysticks - 1); + + return SDL_TRUE; +} + +static void SteamControllerDisconnectedCallback(int device_instance) +{ + SDL_JoystickDeviceItem *item; + + for (item = deviceList; item; item = item->next) { + if (item->instance_id == device_instance) { + SDL_SYS_RemoveJoystickDevice(item); + break; + } + } +} + /* Function to scan the system for joysticks. * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. @@ -276,6 +332,9 @@ SDL_SYS_JoystickInit(void) @autoreleasepool { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + SDL_InitSteamControllers(SteamControllerConnectedCallback, + SteamControllerDisconnectedCallback); + #if !TARGET_OS_TV if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ @@ -326,13 +385,16 @@ SDL_SYS_JoystickInit(void) return numjoysticks; } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { + SDL_UpdateSteamControllers(); } /* Function to get the device-dependent name of a joystick */ @@ -395,6 +457,9 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) #endif /* SDL_JOYSTICK_MFI */ } } + if (device->remote) { + ++SDL_AppleTVRemoteOpenedAsJoystick; + } return 0; } @@ -514,7 +579,7 @@ SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick) * initializes its values to 0. We only want to make sure the * player index is up to date if the user actually moves an axis. */ if ((i != 2 && i != 5) || axes[i] != -32768) { - updateplayerindex |= (joystick->axes[i] != axes[i]); + updateplayerindex |= (joystick->axes[i].value != axes[i]); } SDL_PrivateJoystickAxis(joystick, i, axes[i]); } @@ -551,13 +616,10 @@ SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick) }; for (i = 0; i < SDL_arraysize(axes); i++) { - updateplayerindex |= (joystick->axes[i] != axes[i]); + updateplayerindex |= (joystick->axes[i].value != axes[i]); SDL_PrivateJoystickAxis(joystick, i, axes[i]); } - /* Apparently the dpad values are not accurate enough to be useful. */ - /* hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad); */ - Uint8 buttons[] = { gamepad.buttonA.isPressed, gamepad.buttonX.isPressed, @@ -567,8 +629,6 @@ SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick) updateplayerindex |= (joystick->buttons[i] != buttons[i]); SDL_PrivateJoystickButton(joystick, i, buttons[i]); } - - /* TODO: Figure out what to do with reportsAbsoluteDpadValues */ } #endif /* TARGET_OS_TV */ @@ -626,6 +686,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) if (device == NULL) { return; } + + if (device->m_bSteamController) { + SDL_UpdateSteamController(joystick); + return; + } if (device->accelerometer) { SDL_SYS_AccelerometerUpdate(joystick); @@ -659,6 +724,9 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) #endif } } + if (device->remote) { + --SDL_AppleTVRemoteOpenedAsJoystick; + } } /* Function to perform any system-specific joystick related cleanup */ @@ -694,6 +762,8 @@ SDL_SYS_JoystickQuit(void) #endif /* !TARGET_OS_TV */ } + SDL_QuitSteamControllers(); + numjoysticks = 0; } diff --git a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h index be0ddf068..7be5b04a5 100644 --- a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,7 @@ typedef struct joystick_hwdata { SDL_bool accelerometer; + SDL_bool remote; GCController __unsafe_unretained *controller; int num_pause_presses; @@ -44,6 +45,9 @@ typedef struct joystick_hwdata int nbuttons; int nhats; + /* Steam Controller support */ + SDL_bool m_bSteamController; + struct joystick_hwdata *next; } joystick_hwdata; diff --git a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c index bd52b1808..457c4b85b 100644 --- a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,8 +38,10 @@ #include "SDL_assert.h" #include "SDL_joystick.h" #include "SDL_endian.h" +#include "../../events/SDL_events_c.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +#include "../steam/SDL_steamcontroller.h" #include "SDL_sysjoystick_c.h" /* This isn't defined in older Linux kernel headers */ @@ -52,7 +54,7 @@ static int MaybeAddDevice(const char *path); #if SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); +static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ @@ -66,6 +68,9 @@ typedef struct SDL_joylist_item dev_t devnum; struct joystick_hwdata *hwdata; struct SDL_joylist_item *next; + + /* Steam Controller support */ + SDL_bool m_bSteamController; } SDL_joylist_item; static SDL_joylist_item *SDL_joylist = NULL; @@ -73,6 +78,7 @@ static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; static int instance_counter = 0; + #define test_bit(nr, addr) \ (((1UL << ((nr) % (sizeof(long) * 8))) & ((addr)[(nr) / (sizeof(long) * 8)])) != 0) #define NBITS(x) ((((x)-1)/(sizeof(long) * 8))+1) @@ -80,8 +86,102 @@ static int instance_counter = 0; static int IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *guid) { + /* This list is taken from: + https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py + */ + static Uint32 joystick_blacklist[] = { + /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */ + /* Microsoft Wireless Desktop - Comfort Edition */ + MAKE_VIDPID(0x045e, 0x009d), + + /* Microsoft Microsoft® Digital Media Pro Keyboard */ + /* Microsoft Corp. Digital Media Pro Keyboard */ + MAKE_VIDPID(0x045e, 0x00b0), + + /* Microsoft Microsoft® Digital Media Keyboard */ + /* Microsoft Corp. Digital Media Keyboard 1.0A */ + MAKE_VIDPID(0x045e, 0x00b4), + + /* Microsoft Microsoft® Digital Media Keyboard 3000 */ + MAKE_VIDPID(0x045e, 0x0730), + + /* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */ + /* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */ + /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */ + /* Microsoft Wireless Mobile Mouse 1000 */ + /* Microsoft Wireless Desktop 3000 */ + MAKE_VIDPID(0x045e, 0x0745), + + /* Microsoft® SideWinder(TM) 2.4GHz Transceiver */ + MAKE_VIDPID(0x045e, 0x0748), + + /* Microsoft Corp. Wired Keyboard 600 */ + MAKE_VIDPID(0x045e, 0x0750), + + /* Microsoft Corp. Sidewinder X4 keyboard */ + MAKE_VIDPID(0x045e, 0x0768), + + /* Microsoft Corp. Arc Touch Mouse Transceiver */ + MAKE_VIDPID(0x045e, 0x0773), + + /* Microsoft® 2.4GHz Transceiver v9.0 */ + /* Microsoft® Nano Transceiver v2.1 */ + /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */ + MAKE_VIDPID(0x045e, 0x07a5), + + /* Microsoft® Nano Transceiver v1.0 */ + /* Microsoft Wireless Keyboard 800 */ + MAKE_VIDPID(0x045e, 0x07b2), + + /* Microsoft® Nano Transceiver v2.0 */ + MAKE_VIDPID(0x045e, 0x0800), + + /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */ + MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */ + MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */ + MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */ + MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */ + MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */ + MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */ + MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */ + MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */ + MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire 4 6x8 */ + MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun 4x5 */ + MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */ + MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */ + MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */ + + MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */ + MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */ + MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */ + MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */ + MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */ + MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */ + MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */ + MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */ + MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */ + MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */ + MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */ + MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */ + MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */ + + MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */ + + MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */ + + MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */ + + MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */ + MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */ + }; struct input_id inpid; - Uint16 *guid16 = (Uint16 *) ((char *) &guid->data); + int i; + Uint32 id; + Uint16 *guid16 = (Uint16 *)guid->data; #if !SDL_USE_LIBUDEV /* When udev is enabled we only get joystick devices here, so there's no need to test them */ @@ -109,33 +209,45 @@ IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *gui return 0; } + /* Check the joystick blacklist */ + id = MAKE_VIDPID(inpid.vendor, inpid.product); + for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) { + if (id == joystick_blacklist[i]) { + return 0; + } + } + #ifdef DEBUG_JOYSTICK - printf("Joystick: %s, bustype = %d, vendor = 0x%x, product = 0x%x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version); + printf("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version); #endif SDL_memset(guid->data, 0, sizeof(guid->data)); /* We only need 16 bits for each of these; space them out to fill 128. */ /* Byteswap so devices get same GUID on little/big endian platforms. */ - *(guid16++) = SDL_SwapLE16(inpid.bustype); - *(guid16++) = 0; + *guid16++ = SDL_SwapLE16(inpid.bustype); + *guid16++ = 0; - if (inpid.vendor && inpid.product && inpid.version) { - *(guid16++) = SDL_SwapLE16(inpid.vendor); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.product); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.version); - *(guid16++) = 0; + if (inpid.vendor && inpid.product) { + *guid16++ = SDL_SwapLE16(inpid.vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(inpid.product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(inpid.version); + *guid16++ = 0; } else { SDL_strlcpy((char*)guid16, namebuf, sizeof(guid->data) - 4); } + if (SDL_IsGameControllerNameAndGUID(namebuf, *guid) && + SDL_ShouldIgnoreGameController(namebuf, *guid)) { + return 0; + } return 1; } #if SDL_USE_LIBUDEV -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) +static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL) { return; @@ -282,6 +394,7 @@ MaybeRemoveDevice(const char *path) } #endif +#if ! SDL_USE_LIBUDEV static int JoystickInitWithoutUdev(void) { @@ -298,7 +411,7 @@ JoystickInitWithoutUdev(void) return numjoysticks; } - +#endif #if SDL_USE_LIBUDEV static int @@ -321,6 +434,77 @@ JoystickInitWithUdev(void) } #endif +static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) +{ + SDL_joylist_item *item; + + item = (SDL_joylist_item *) SDL_calloc(1, sizeof (SDL_joylist_item)); + if (item == NULL) { + return SDL_FALSE; + } + + item->path = SDL_strdup(""); + item->name = SDL_strdup(name); + item->guid = guid; + item->m_bSteamController = SDL_TRUE; + + if ((item->path == NULL) || (item->name == NULL)) { + SDL_free(item->path); + SDL_free(item->name); + SDL_free(item); + return SDL_FALSE; + } + + *device_instance = item->device_instance = instance_counter++; + if (SDL_joylist_tail == NULL) { + SDL_joylist = SDL_joylist_tail = item; + } else { + SDL_joylist_tail->next = item; + SDL_joylist_tail = item; + } + + /* Need to increment the joystick count before we post the event */ + ++numjoysticks; + + SDL_PrivateJoystickAdded(numjoysticks - 1); + + return SDL_TRUE; +} + +static void SteamControllerDisconnectedCallback(int device_instance) +{ + SDL_joylist_item *item; + SDL_joylist_item *prev = NULL; + + for (item = SDL_joylist; item != NULL; item = item->next) { + /* found it, remove it. */ + if (item->device_instance == device_instance) { + if (item->hwdata) { + item->hwdata->item = NULL; + } + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_joylist == item); + SDL_joylist = item->next; + } + if (item == SDL_joylist_tail) { + SDL_joylist_tail = prev; + } + + /* Need to decrement the joystick count before we post the event */ + --numjoysticks; + + SDL_PrivateJoystickRemoved(item->device_instance); + + SDL_free(item->name); + SDL_free(item); + return; + } + prev = item; + } +} + int SDL_SYS_JoystickInit(void) { @@ -340,24 +524,30 @@ SDL_SYS_JoystickInit(void) SDL_free(envcopy); } + SDL_InitSteamControllers(SteamControllerConnectedCallback, + SteamControllerDisconnectedCallback); + #if SDL_USE_LIBUDEV return JoystickInitWithUdev(); -#endif - +#else return JoystickInitWithoutUdev(); +#endif } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { #if SDL_USE_LIBUDEV SDL_UDEV_Poll(); #endif - + + SDL_UpdateSteamControllers(); } static SDL_joylist_item * @@ -446,16 +636,16 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) #ifdef DEBUG_INPUT_EVENTS printf("Joystick has button: 0x%x\n", i); #endif - joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons; + joystick->hwdata->key_map[i] = joystick->nbuttons; ++joystick->nbuttons; } } - for (i = BTN_MISC; i < BTN_JOYSTICK; ++i) { + for (i = 0; i < BTN_JOYSTICK; ++i) { if (test_bit(i, keybit)) { #ifdef DEBUG_INPUT_EVENTS printf("Joystick has button: 0x%x\n", i); #endif - joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons; + joystick->hwdata->key_map[i] = joystick->nbuttons; ++joystick->nbuttons; } } @@ -541,47 +731,53 @@ int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_joylist_item *item = JoystickByDevIndex(device_index); - char *fname = NULL; - int fd = -1; if (item == NULL) { return SDL_SetError("No such device"); } - fname = item->path; - fd = open(fname, O_RDONLY, 0); - if (fd < 0) { - return SDL_SetError("Unable to open %s", fname); - } - joystick->instance_id = item->device_instance; joystick->hwdata = (struct joystick_hwdata *) - SDL_malloc(sizeof(*joystick->hwdata)); + SDL_calloc(1, sizeof(*joystick->hwdata)); if (joystick->hwdata == NULL) { - close(fd); return SDL_OutOfMemory(); } - SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); joystick->hwdata->item = item; joystick->hwdata->guid = item->guid; - joystick->hwdata->fd = fd; - joystick->hwdata->fname = SDL_strdup(item->path); - if (joystick->hwdata->fname == NULL) { - SDL_free(joystick->hwdata); - joystick->hwdata = NULL; - close(fd); - return SDL_OutOfMemory(); + joystick->hwdata->m_bSteamController = item->m_bSteamController; + + if (item->m_bSteamController) { + joystick->hwdata->fd = -1; + SDL_GetSteamControllerInputs(&joystick->nbuttons, + &joystick->naxes, + &joystick->nhats); + } else { + int fd = open(item->path, O_RDONLY, 0); + if (fd < 0) { + SDL_free(joystick->hwdata); + joystick->hwdata = NULL; + return SDL_SetError("Unable to open %s", item->path); + } + + joystick->hwdata->fd = fd; + joystick->hwdata->fname = SDL_strdup(item->path); + if (joystick->hwdata->fname == NULL) { + SDL_free(joystick->hwdata); + joystick->hwdata = NULL; + close(fd); + return SDL_OutOfMemory(); + } + + /* Set the joystick to non-blocking read mode */ + fcntl(fd, F_SETFL, O_NONBLOCK); + + /* Get the number of buttons and axes on the joystick */ + ConfigJoystick(joystick, fd); } SDL_assert(item->hwdata == NULL); item->hwdata = joystick->hwdata; - /* Set the joystick to non-blocking read mode */ - fcntl(fd, F_SETFL, O_NONBLOCK); - - /* Get the number of buttons and axes on the joystick */ - ConfigJoystick(joystick, fd); - /* mark joystick as fresh and ready */ joystick->hwdata->fresh = 1; @@ -712,12 +908,9 @@ HandleInputEvents(SDL_Joystick * joystick) code = events[i].code; switch (events[i].type) { case EV_KEY: - if (code >= BTN_MISC) { - code -= BTN_MISC; - SDL_PrivateJoystickButton(joystick, - joystick->hwdata->key_map[code], - events[i].value); - } + SDL_PrivateJoystickButton(joystick, + joystick->hwdata->key_map[code], + events[i].value); break; case EV_ABS: switch (code) { @@ -775,6 +968,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { int i; + if (joystick->hwdata->m_bSteamController) { + SDL_UpdateSteamController(joystick); + return; + } + HandleInputEvents(joystick); /* Deliver ball motion updates */ @@ -796,7 +994,9 @@ void SDL_SYS_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata) { - close(joystick->hwdata->fd); + if (joystick->hwdata->fd >= 0) { + close(joystick->hwdata->fd); + } if (joystick->hwdata->item) { joystick->hwdata->item->hwdata = NULL; } @@ -830,6 +1030,8 @@ SDL_SYS_JoystickQuit(void) SDL_UDEV_DelCallback(joystick_udev_callback); SDL_UDEV_Quit(); #endif + + SDL_QuitSteamControllers(); } SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) diff --git a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h index ee7717839..d06b387ee 100644 --- a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ struct joystick_hwdata } *balls; /* Support for the Linux 2.4 unified input interface */ - Uint8 key_map[KEY_MAX - BTN_MISC]; + Uint8 key_map[KEY_MAX]; Uint8 abs_map[ABS_MAX]; struct axis_correct { @@ -52,6 +52,9 @@ struct joystick_hwdata } abs_correct[ABS_MAX]; int fresh; + + /* Steam Controller support */ + SDL_bool m_bSteamController; }; /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c index 352960edf..228cbb209 100644 --- a/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -132,12 +132,12 @@ int SDL_SYS_JoystickInit(void) return 1; } -int SDL_SYS_NumJoysticks() +int SDL_SYS_NumJoysticks(void) { return 1; } -void SDL_SYS_JoystickDetect() +void SDL_SYS_JoystickDetect(void) { } diff --git a/Engine/lib/sdl/src/joystick/sort_controllers.py b/Engine/lib/sdl/src/joystick/sort_controllers.py index af95d6513..47213c220 100755 --- a/Engine/lib/sdl/src/joystick/sort_controllers.py +++ b/Engine/lib/sdl/src/joystick/sort_controllers.py @@ -29,6 +29,7 @@ def write_controllers(): global controller_guids for entry in sorted(controllers, key=lambda entry: entry[2]): line = "".join(entry) + "\n" + line = line.replace("\t", " ") if not line.endswith(",\n") and not line.endswith("*/\n"): print("Warning: '%s' is missing a comma at the end of the line" % (line)) if (entry[1] in controller_guids): diff --git a/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c new file mode 100644 index 000000000..1edaa94ab --- /dev/null +++ b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" +#include "SDL_steamcontroller.h" + + +void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback, + SteamControllerDisconnectedCallback_t disconnectedCallback) +{ +} + +void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats) +{ + *nbuttons = 0; + *naxes = 0; + *nhats = 0; +} + +void SDL_UpdateSteamControllers(void) +{ +} + +void SDL_UpdateSteamController(SDL_Joystick *joystick) +{ +} + +void SDL_QuitSteamControllers(void) +{ +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h new file mode 100644 index 000000000..ce37b4de5 --- /dev/null +++ b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h @@ -0,0 +1,33 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +typedef SDL_bool (*SteamControllerConnectedCallback_t)(const char *name, SDL_JoystickGUID guid, int *device_instance); +typedef void (*SteamControllerDisconnectedCallback_t)(int device_instance); + +void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback, + SteamControllerDisconnectedCallback_t disconnectedCallback); +void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats); +void SDL_UpdateSteamControllers(void); +void SDL_UpdateSteamController(SDL_Joystick *joystick); +void SDL_QuitSteamControllers(void); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c index 7166075b1..cff868b28 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,9 +33,7 @@ #endif #define INPUT_QSIZE 32 /* Buffer up to 32 input messages */ -#define AXIS_MIN -32768 /* minimum value for axis coordinate */ -#define AXIS_MAX 32767 /* maximum value for axis coordinate */ -#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */ +#define JOY_AXIS_THRESHOLD (((SDL_JOYSTICK_AXIS_MAX)-(SDL_JOYSTICK_AXIS_MIN))/100) /* 1% motion */ /* external variables referenced. */ extern HWND SDL_HelperWindow; @@ -350,21 +348,70 @@ SDL_DINPUT_JoystickInit(void) static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) { + const Uint16 BUS_USB = 0x03; + const Uint16 BUS_BLUETOOTH = 0x05; JoyStick_DeviceData *pNewJoystick; JoyStick_DeviceData *pPrevJoystick = NULL; const DWORD devtype = (pdidInstance->dwDevType & 0xFF); + Uint16 *guid16; + WCHAR hidPath[MAX_PATH]; if (devtype == DI8DEVTYPE_SUPPLEMENTAL) { - return DIENUM_CONTINUE; /* Ignore touchpads, etc. */ + /* Add any supplemental devices that should be ignored here */ +#define MAKE_TABLE_ENTRY(VID, PID) ((((DWORD)PID)<<16)|VID) + static DWORD ignored_devices[] = { + MAKE_TABLE_ENTRY(0, 0) + }; +#undef MAKE_TABLE_ENTRY + unsigned int i; + + for (i = 0; i < SDL_arraysize(ignored_devices); ++i) { + if (pdidInstance->guidProduct.Data1 == ignored_devices[i]) { + return DIENUM_CONTINUE; + } + } } if (SDL_IsXInputDevice(&pdidInstance->guidProduct)) { return DIENUM_CONTINUE; /* ignore XInput devices here, keep going. */ } + { + HRESULT result; + LPDIRECTINPUTDEVICE8 device; + LPDIRECTINPUTDEVICE8 InputDevice; + DIPROPGUIDANDPATH dipdw2; + + result = IDirectInput8_CreateDevice(dinput, &(pdidInstance->guidInstance), &device, NULL); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + + /* Now get the IDirectInputDevice8 interface, instead. */ + result = IDirectInputDevice8_QueryInterface(device, &IID_IDirectInputDevice8, (LPVOID *)&InputDevice); + /* We are done with this object. Use the stored one from now on. */ + IDirectInputDevice8_Release(device); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + dipdw2.diph.dwSize = sizeof(dipdw2); + dipdw2.diph.dwHeaderSize = sizeof(dipdw2.diph); + dipdw2.diph.dwObj = 0; // device property + dipdw2.diph.dwHow = DIPH_DEVICE; + + result = IDirectInputDevice8_GetProperty(InputDevice, DIPROP_GUIDANDPATH, &dipdw2.diph); + IDirectInputDevice8_Release(InputDevice); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + + /* Get device path, compare that instead of GUID, additionally update GUIDs of joysticks with matching paths, in case they're not open yet. */ + SDL_wcslcpy(hidPath, dipdw2.wszPath, SDL_arraysize(hidPath)); + } + pNewJoystick = *(JoyStick_DeviceData **)pContext; while (pNewJoystick) { - if (!SDL_memcmp(&pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance))) { + if (SDL_wcscmp(pNewJoystick->hidPath, hidPath) == 0) { /* if we are replacing the front of the list then update it */ if (pNewJoystick == *(JoyStick_DeviceData **)pContext) { *(JoyStick_DeviceData **)pContext = pNewJoystick->pNext; @@ -372,6 +419,9 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) pPrevJoystick->pNext = pNewJoystick->pNext; } + // Update with new guid/etc, if it has changed + pNewJoystick->dxdevice = *pdidInstance; + pNewJoystick->pNext = SYS_Joystick; SYS_Joystick = pNewJoystick; @@ -388,6 +438,7 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) } SDL_zerop(pNewJoystick); + SDL_wcslcpy(pNewJoystick->hidPath, hidPath, SDL_arraysize(pNewJoystick->hidPath)); pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName); if (!pNewJoystick->joystickname) { SDL_free(pNewJoystick); @@ -397,7 +448,30 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance, sizeof(DIDEVICEINSTANCE)); - SDL_memcpy(&pNewJoystick->guid, &pdidInstance->guidProduct, sizeof(pNewJoystick->guid)); + SDL_memset(pNewJoystick->guid.data, 0, sizeof(pNewJoystick->guid.data)); + + guid16 = (Uint16 *)pNewJoystick->guid.data; + if (SDL_memcmp(&pdidInstance->guidProduct.Data4[2], "PIDVID", 6) == 0) { + *guid16++ = SDL_SwapLE16(BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)LOWORD(pdidInstance->guidProduct.Data1)); /* vendor */ + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)HIWORD(pdidInstance->guidProduct.Data1)); /* product */ + *guid16++ = 0; + *guid16++ = 0; /* version */ + *guid16++ = 0; + } else { + *guid16++ = SDL_SwapLE16(BUS_BLUETOOTH); + *guid16++ = 0; + SDL_strlcpy((char*)guid16, pNewJoystick->joystickname, sizeof(pNewJoystick->guid.data) - 4); + } + + if (SDL_IsGameControllerNameAndGUID(pNewJoystick->joystickname, pNewJoystick->guid) && + SDL_ShouldIgnoreGameController(pNewJoystick->joystickname, pNewJoystick->guid)) { + SDL_free(pNewJoystick); + return DIENUM_CONTINUE; + } + SDL_SYS_AddJoystickDevice(pNewJoystick); return DIENUM_CONTINUE; /* get next device, please */ @@ -461,8 +535,8 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) diprg.diph.dwHeaderSize = sizeof(diprg.diph); diprg.diph.dwObj = dev->dwType; diprg.diph.dwHow = DIPH_BYID; - diprg.lMin = AXIS_MIN; - diprg.lMax = AXIS_MAX; + diprg.lMin = SDL_JOYSTICK_AXIS_MIN; + diprg.lMax = SDL_JOYSTICK_AXIS_MAX; result = IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h index 7e4ff3e19..5cc18903b 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c index 374618181..9fa86656f 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,10 +41,6 @@ #define MAX_JOYSTICKS 16 #define MAX_AXES 6 /* each joystick can have up to 6 axes */ #define MAX_BUTTONS 32 /* and 32 buttons */ -#define AXIS_MIN -32768 /* minimum value for axis coordinate */ -#define AXIS_MAX 32767 /* maximum value for axis coordinate */ -/* limit axis to 256 possible positions to filter out noise */ -#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/256) #define JOY_BUTTON_FLAG(n) (1<hwdata->id = SYS_JoystickID[index]; for (i = 0; i < MAX_AXES; ++i) { if ((i < 2) || (SYS_Joystick[index].wCaps & caps_flags[i - 2])) { - joystick->hwdata->transaxis[i].offset = AXIS_MIN - axis_min[i]; + joystick->hwdata->transaxis[i].offset = SDL_JOYSTICK_AXIS_MIN - axis_min[i]; joystick->hwdata->transaxis[i].scale = - (float) (AXIS_MAX - AXIS_MIN) / (axis_max[i] - axis_min[i]); + (float) (SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) / (axis_max[i] - axis_min[i]); } else { joystick->hwdata->transaxis[i].offset = 0; joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */ @@ -315,7 +323,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) }; DWORD pos[MAX_AXES]; struct _transaxis *transaxis; - int value, change; + int value; JOYINFOEX joyinfo; joyinfo.dwSize = sizeof(joyinfo); @@ -340,14 +348,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) transaxis = joystick->hwdata->transaxis; for (i = 0; i < joystick->naxes; i++) { if (joyinfo.dwFlags & flags[i]) { - value = - (int) (((float) pos[i] + - transaxis[i].offset) * transaxis[i].scale); - change = (value - joystick->axes[i]); - if ((change < -JOY_AXIS_THRESHOLD) - || (change > JOY_AXIS_THRESHOLD)) { - SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value); - } + value = (int) (((float) pos[i] + transaxis[i].offset) * transaxis[i].scale); + SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value); } } @@ -355,15 +357,9 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) if (joyinfo.dwFlags & JOY_RETURNBUTTONS) { for (i = 0; i < joystick->nbuttons; ++i) { if (joyinfo.dwButtons & JOY_BUTTON_FLAG(i)) { - if (!joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, (Uint8) i, - SDL_PRESSED); - } + SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_PRESSED); } else { - if (joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, (Uint8) i, - SDL_RELEASED); - } + SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_RELEASED); } } } @@ -373,9 +369,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) Uint8 pos; pos = TranslatePOV(joyinfo.dwPOV); - if (pos != joystick->hats[0]) { - SDL_PrivateJoystickHat(joystick, 0, pos); - } + SDL_PrivateJoystickHat(joystick, 0, pos); } } diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c index e528afa7f..45cbea688 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,8 +37,6 @@ #include "SDL_events.h" #include "SDL_timer.h" #include "SDL_mutex.h" -#include "SDL_events.h" -#include "SDL_hints.h" #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../../thread/SDL_systhread.h" @@ -91,9 +89,10 @@ SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return 0; } -static void -SDL_CheckDeviceNotification(SDL_DeviceNotificationData *data) +static SDL_bool +SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex) { + return SDL_FALSE; } #else /* !__WINRT__ */ @@ -106,6 +105,8 @@ typedef struct HDEVNOTIFY hNotify; } SDL_DeviceNotificationData; +#define IDT_SDL_DEVICE_CHANGE_TIMER_1 1200 +#define IDT_SDL_DEVICE_CHANGE_TIMER_2 1201 /* windowproc for our joystick detect thread message only window, to detect any USB device addition/removal */ static LRESULT CALLBACK @@ -115,17 +116,19 @@ SDL_PrivateJoystickDetectProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case WM_DEVICECHANGE: switch (wParam) { case DBT_DEVICEARRIVAL: - if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { - s_bWindowsDeviceChanged = SDL_TRUE; - } - break; case DBT_DEVICEREMOVECOMPLETE: if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { - s_bWindowsDeviceChanged = SDL_TRUE; + /* notify 300ms and 2 seconds later to ensure all APIs have updated status */ + SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_1, 300, NULL); + SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_2, 2000, NULL); } break; } return 0; + case WM_TIMER: + KillTimer(hwnd, wParam); + s_bWindowsDeviceChanged = SDL_TRUE; + return 0; } return DefWindowProc (hwnd, message, wParam, lParam); @@ -189,21 +192,26 @@ SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return 0; } -static void -SDL_CheckDeviceNotification(SDL_DeviceNotificationData *data) +static SDL_bool +SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex) { MSG msg; + int lastret = 1; if (!data->messageWindow) { - return; + return SDL_FALSE; /* device notifications require a window */ } - while (PeekMessage(&msg, data->messageWindow, 0, 0, PM_NOREMOVE)) { - if (GetMessage(&msg, data->messageWindow, 0, 0) != 0) { + SDL_UnlockMutex(mutex); + while (lastret > 0 && s_bWindowsDeviceChanged == SDL_FALSE) { + lastret = GetMessage(&msg, NULL, 0, 0); /* WM_QUIT causes return value of 0 */ + if (lastret > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } } + SDL_LockMutex(mutex); + return (lastret != -1) ? SDL_TRUE : SDL_FALSE; } #endif /* __WINRT__ */ @@ -227,31 +235,30 @@ SDL_JoystickThread(void *_data) while (s_bJoystickThreadQuit == SDL_FALSE) { SDL_bool bXInputChanged = SDL_FALSE; - SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 300); - - SDL_CheckDeviceNotification(¬ification_data); - + if (SDL_WaitForDeviceNotification(¬ification_data, s_mutexJoyStickEnum) == SDL_FALSE) { #if SDL_JOYSTICK_XINPUT - if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { - /* scan for any change in XInput devices */ - Uint8 userId; - for (userId = 0; userId < XUSER_MAX_COUNT; userId++) { - XINPUT_CAPABILITIES capabilities; - const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities); - const SDL_bool available = (result == ERROR_SUCCESS); - if (bOpenedXInputDevices[userId] != available) { - bXInputChanged = SDL_TRUE; - bOpenedXInputDevices[userId] = available; + /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */ + SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000); + if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { + /* scan for any change in XInput devices */ + Uint8 userId; + for (userId = 0; userId < XUSER_MAX_COUNT; userId++) { + XINPUT_CAPABILITIES capabilities; + const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities); + const SDL_bool available = (result == ERROR_SUCCESS); + if (bOpenedXInputDevices[userId] != available) { + bXInputChanged = SDL_TRUE; + bOpenedXInputDevices[userId] = available; + } } } - } +#else + /* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */ + break; #endif /* SDL_JOYSTICK_XINPUT */ + } if (s_bWindowsDeviceChanged || bXInputChanged) { - SDL_UnlockMutex(s_mutexJoyStickEnum); /* let main thread go while we SDL_Delay(). */ - SDL_Delay(300); /* wait for direct input to find out about this device */ - SDL_LockMutex(s_mutexJoyStickEnum); - s_bDeviceRemoved = SDL_TRUE; s_bDeviceAdded = SDL_TRUE; s_bWindowsDeviceChanged = SDL_FALSE; @@ -307,7 +314,7 @@ SDL_SYS_JoystickInit(void) /* return the number of joysticks that are connected right now */ int -SDL_SYS_NumJoysticks() +SDL_SYS_NumJoysticks(void) { int nJoysticks = 0; JoyStick_DeviceData *device = SYS_Joystick; @@ -321,7 +328,7 @@ SDL_SYS_NumJoysticks() /* detect any new joysticks being inserted into the system */ void -SDL_SYS_JoystickDetect() +SDL_SYS_JoystickDetect(void) { JoyStick_DeviceData *pCurList = NULL; @@ -498,6 +505,9 @@ SDL_SYS_JoystickQuit(void) s_bJoystickThreadQuit = SDL_TRUE; SDL_CondBroadcast(s_condJoystickThread); /* signal the joystick thread to quit */ SDL_UnlockMutex(s_mutexJoyStickEnum); +#ifndef __WINRT__ + PostThreadMessage(SDL_GetThreadID(s_threadJoystick), WM_QUIT, 0, 0); +#endif SDL_WaitThread(s_threadJoystick, NULL); /* wait for it to bugger off */ SDL_DestroyMutex(s_mutexJoyStickEnum); diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h index d3c5fcaab..01b8b3ab1 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,7 @@ typedef struct JoyStick_DeviceData BYTE SubType; Uint8 XInputUserId; DIDEVICEINSTANCE dxdevice; + WCHAR hidPath[MAX_PATH]; struct JoyStick_DeviceData *pNext; } JoyStick_DeviceData; diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c index d581d45b9..823e7674f 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,16 +33,23 @@ * Internal stuff. */ static SDL_bool s_bXInputEnabled = SDL_TRUE; +static char *s_arrXInputDevicePath[XUSER_MAX_COUNT]; static SDL_bool SDL_XInputUseOldJoystickMapping() { +#ifdef __WINRT__ + /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + /* FIXME: Why are Win8/10 different here? -flibit */ + return (NTDDI_VERSION < NTDDI_WIN10); +#else static int s_XInputUseOldJoystickMapping = -1; if (s_XInputUseOldJoystickMapping < 0) { s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE); } return (s_XInputUseOldJoystickMapping > 0); +#endif } SDL_bool SDL_XINPUT_Enabled(void) @@ -104,8 +111,80 @@ GetXInputName(const Uint8 userid, BYTE SubType) return SDL_strdup(name); } +/* We can't really tell what device is being used for XInput, but we can guess + and we'll be correct for the case where only one device is connected. + */ static void -AddXInputDevice(const Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) +GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) +{ +#ifndef __WINRT__ /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + + PRAWINPUTDEVICELIST devices = NULL; + UINT i, j, device_count = 0; + + if ((GetRawInputDeviceList(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) || (!device_count)) { + return; /* oh well. */ + } + + devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count); + if (devices == NULL) { + return; + } + + if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) { + SDL_free(devices); + return; /* oh well. */ + } + + for (i = 0; i < device_count; i++) { + RID_DEVICE_INFO rdi; + char devName[128]; + UINT rdiSize = sizeof(rdi); + UINT nameSize = SDL_arraysize(devName); + + rdi.cbSize = sizeof(rdi); + if ((devices[i].dwType == RIM_TYPEHID) && + (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) && + (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) && + (SDL_strstr(devName, "IG_") != NULL)) { + SDL_bool found = SDL_FALSE; + for (j = 0; j < SDL_arraysize(s_arrXInputDevicePath); ++j) { + if (j == userid) { + continue; + } + if (!s_arrXInputDevicePath[j]) { + continue; + } + if (SDL_strcmp(devName, s_arrXInputDevicePath[j]) == 0) { + found = SDL_TRUE; + break; + } + } + if (found) { + /* We already have this device in our XInput device list */ + continue; + } + + /* We don't actually know if this is the right device for this + * userid, but we'll record it so we'll at least be consistent + * when the raw device list changes. + */ + *pVID = (Uint16)rdi.hid.dwVendorId; + *pPID = (Uint16)rdi.hid.dwProductId; + *pVersion = (Uint16)rdi.hid.dwVersionNumber; + if (s_arrXInputDevicePath[userid]) { + SDL_free(s_arrXInputDevicePath[userid]); + } + s_arrXInputDevicePath[userid] = SDL_strdup(devName); + break; + } + } + SDL_free(devices); +#endif /* ifndef __WINRT__ */ +} + +static void +AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) { JoyStick_DeviceData *pPrevJoystick = NULL; JoyStick_DeviceData *pNewJoystick = *pContext; @@ -150,16 +229,35 @@ AddXInputDevice(const Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext if (SDL_XInputUseOldJoystickMapping()) { SDL_zero(pNewJoystick->guid); } else { - pNewJoystick->guid.data[0] = 'x'; - pNewJoystick->guid.data[1] = 'i'; - pNewJoystick->guid.data[2] = 'n'; - pNewJoystick->guid.data[3] = 'p'; - pNewJoystick->guid.data[4] = 'u'; - pNewJoystick->guid.data[5] = 't'; - pNewJoystick->guid.data[6] = SubType; + const Uint16 BUS_USB = 0x03; + Uint16 vendor = 0; + Uint16 product = 0; + Uint16 version = 0; + Uint16 *guid16 = (Uint16 *)pNewJoystick->guid.data; + + GuessXInputDevice(userid, &vendor, &product, &version); + + *guid16++ = SDL_SwapLE16(BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(version); + *guid16++ = 0; + + /* Note that this is an XInput device and what subtype it is */ + pNewJoystick->guid.data[14] = 'x'; + pNewJoystick->guid.data[15] = SubType; } pNewJoystick->SubType = SubType; pNewJoystick->XInputUserId = userid; + + if (SDL_ShouldIgnoreGameController(pNewJoystick->joystickname, pNewJoystick->guid)) { + SDL_free(pNewJoystick); + return; + } + SDL_SYS_AddJoystickDevice(pNewJoystick); } @@ -220,14 +318,12 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde static void UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { - if ( pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN ) - { + if (pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN) { SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN; if (pBatteryInformation->BatteryType == BATTERY_TYPE_WIRED) { ePowerLevel = SDL_JOYSTICK_POWER_WIRED; } else { - switch ( pBatteryInformation->BatteryLevel ) - { + switch (pBatteryInformation->BatteryLevel) { case BATTERY_LEVEL_EMPTY: ePowerLevel = SDL_JOYSTICK_POWER_EMPTY; break; @@ -244,7 +340,7 @@ UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_I } } - SDL_PrivateJoystickBatteryLevel( joystick, ePowerLevel ); + SDL_PrivateJoystickBatteryLevel(joystick, ePowerLevel); } } @@ -272,7 +368,7 @@ UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputS SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED); } - UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation ); + UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); } static void @@ -313,7 +409,7 @@ UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState } SDL_PrivateJoystickHat(joystick, 0, hat); - UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation ); + UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); } void @@ -328,15 +424,20 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) result = XINPUTGETSTATE(joystick->hwdata->userid, &XInputState); if (result == ERROR_DEVICE_NOT_CONNECTED) { + Uint8 userid = joystick->hwdata->userid; + joystick->hwdata->send_remove_event = SDL_TRUE; joystick->hwdata->removed = SDL_TRUE; + if (s_arrXInputDevicePath[userid]) { + SDL_free(s_arrXInputDevicePath[userid]); + s_arrXInputDevicePath[userid] = NULL; + } return; } - SDL_zero( XBatteryInformation ); - if ( XINPUTGETBATTERYINFORMATION ) - { - result = XINPUTGETBATTERYINFORMATION( joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation ); + SDL_zero(XBatteryInformation); + if (XINPUTGETBATTERYINFORMATION) { + result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation); } /* only fire events if the data changed from last time */ diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h index b3ba8c02e..63616ee30 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/libm/e_atan2.c b/Engine/lib/sdl/src/libm/e_atan2.c index f7b91a3e1..32b972570 100644 --- a/Engine/lib/sdl/src/libm/e_atan2.c +++ b/Engine/lib/sdl/src/libm/e_atan2.c @@ -81,8 +81,8 @@ double attribute_hidden __ieee754_atan2(double y, double x) switch(m) { case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return 3.0*pi_o_4+tiny;/* atan(+INF,-INF) */ - case 3: return -3.0*pi_o_4-tiny;/* atan(-INF,-INF) */ + case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ } } else { switch(m) { @@ -114,3 +114,21 @@ double attribute_hidden __ieee754_atan2(double y, double x) return (z-pi_lo)-pi;/* atan(-,-) */ } } + +/* + * wrapper atan2(y,x) + */ +#ifndef _IEEE_LIBM +double atan2(double y, double x) +{ + double z = __ieee754_atan2(y, x); + if (_LIB_VERSION == _IEEE_ || isnan(x) || isnan(y)) + return z; + if (x == 0.0 && y == 0.0) + return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */ + return z; +} +#else +strong_alias(__ieee754_atan2, atan2) +#endif +libm_hidden_def(atan2) diff --git a/Engine/lib/sdl/src/libm/e_fmod.c b/Engine/lib/sdl/src/libm/e_fmod.c new file mode 100644 index 000000000..fd8bacb2b --- /dev/null +++ b/Engine/lib/sdl/src/libm/e_fmod.c @@ -0,0 +1,144 @@ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +/* + * __ieee754_fmod(x,y) + * Return x mod y in exact arithmetic + * Method: shift and subtract + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double one = 1.0, Zero[] = {0.0, -0.0,}; + +double attribute_hidden __ieee754_fmod(double x, double y) +{ + int32_t n,hx,hy,hz,ix,iy,sx,i; + u_int32_t lx,ly,lz; + + EXTRACT_WORDS(hx,lx,x); + EXTRACT_WORDS(hy,ly,y); + sx = hx&0x80000000; /* sign of x */ + hx ^=sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ + + /* purge off exception values */ + if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ + ((hy|((ly|-(int32_t)ly)>>31))>0x7ff00000)) /* or y is NaN */ + return (x*y)/(x*y); + if(hx<=hy) { + if((hx>31]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if(hx<0x00100000) { /* subnormal x */ + if(hx==0) { + for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; + } else { + for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; + } + } else ix = (hx>>20)-1023; + + /* determine iy = ilogb(y) */ + if(hy<0x00100000) { /* subnormal y */ + if(hy==0) { + for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; + } else { + for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; + } + } else iy = (hy>>20)-1023; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if(ix >= -1022) + hx = 0x00100000|(0x000fffff&hx); + else { /* subnormal x, shift x to normal */ + n = -1022-ix; + if(n<=31) { + hx = (hx<>(32-n)); + lx <<= n; + } else { + hx = lx<<(n-32); + lx = 0; + } + } + if(iy >= -1022) + hy = 0x00100000|(0x000fffff&hy); + else { /* subnormal y, shift y to normal */ + n = -1022-iy; + if(n<=31) { + hy = (hy<>(32-n)); + ly <<= n; + } else { + hy = ly<<(n-32); + ly = 0; + } + } + + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy;lz=lx-ly; if(lx>31); lx = lx+lx;} + else { + if((hz|lz)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; + hx = hz+hz+(lz>>31); lx = lz+lz; + } + } + hz=hx-hy;lz=lx-ly; if(lx=0) {hx=hz;lx=lz;} + + /* convert back to floating value and restore the sign */ + if((hx|lx)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; + while(hx<0x00100000) { /* normalize x */ + hx = hx+hx+(lx>>31); lx = lx+lx; + iy -= 1; + } + if(iy>= -1022) { /* normalize output */ + hx = ((hx-0x00100000)|((iy+1023)<<20)); + INSERT_WORDS(x,hx|sx,lx); + } else { /* subnormal output */ + n = -1022 - iy; + if(n<=20) { + lx = (lx>>n)|((u_int32_t)hx<<(32-n)); + hx >>= n; + } else if (n<=31) { + lx = (hx<<(32-n))|(lx>>n); hx = sx; + } else { + lx = hx>>(n-32); hx = sx; + } + INSERT_WORDS(x,hx|sx,lx); + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} + +/* + * wrapper fmod(x,y) + */ +#ifndef _IEEE_LIBM +double fmod(double x, double y) +{ + double z = __ieee754_fmod(x, y); + if (_LIB_VERSION == _IEEE_ || isnan(y) || isnan(x)) + return z; + if (y == 0.0) + return __kernel_standard(x, y, 27); /* fmod(x,0) */ + return z; +} +#else +strong_alias(__ieee754_fmod, fmod) +#endif +libm_hidden_def(fmod) diff --git a/Engine/lib/sdl/src/libm/e_log.c b/Engine/lib/sdl/src/libm/e_log.c index da64138cd..208df815c 100644 --- a/Engine/lib/sdl/src/libm/e_log.c +++ b/Engine/lib/sdl/src/libm/e_log.c @@ -1,4 +1,3 @@ -/* @(#)e_log.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,9 +9,9 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_log.c,v 1.8 1995/05/10 20:45:49 jtc Exp $"; +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4723: potential divide by zero. */ +#pragma warning ( disable : 4723 ) #endif /* __ieee754_log(x) @@ -69,99 +68,85 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ - ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ - two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ - Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ - Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ - Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ - Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ - Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ - Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ - Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ +ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ +ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ +two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ +Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ +Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ +Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ +Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ +Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ +Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ +Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ -#ifdef __STDC__ -static const double zero = 0.0; -#else -static double zero = 0.0; -#endif +static const double zero = 0.0; -#ifdef __STDC__ -double attribute_hidden -__ieee754_log(double x) -#else -double attribute_hidden -__ieee754_log(x) - double x; -#endif +double attribute_hidden __ieee754_log(double x) { - double hfsq, f, s, z, R, w, t1, t2, dk; - int32_t k, hx, i, j; - u_int32_t lx; + double hfsq,f,s,z,R,w,t1,t2,dk; + int32_t k,hx,i,j; + u_int32_t lx; - EXTRACT_WORDS(hx, lx, x); + EXTRACT_WORDS(hx,lx,x); - k = 0; - if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx & 0x7fffffff) | lx) == 0) - return -two54 / zero; /* log(+-0)=-inf */ - if (hx < 0) - return (x - x) / zero; /* log(-#) = NaN */ - k -= 54; - x *= two54; /* subnormal number, scale up x */ - GET_HIGH_WORD(hx, x); - } - if (hx >= 0x7ff00000) - return x + x; - k += (hx >> 20) - 1023; - hx &= 0x000fffff; - i = (hx + 0x95f64) & 0x100000; - SET_HIGH_WORD(x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */ - k += (i >> 20); - f = x - 1.0; - if ((0x000fffff & (2 + hx)) < 3) { /* |f| < 2**-20 */ - if (f == zero) { - if (k == 0) - return zero; - else { - dk = (double) k; - return dk * ln2_hi + dk * ln2_lo; - } - } - R = f * f * (0.5 - 0.33333333333333333 * f); - if (k == 0) - return f - R; - else { - dk = (double) k; - return dk * ln2_hi - ((R - dk * ln2_lo) - f); - } - } - s = f / (2.0 + f); - dk = (double) k; - z = s * s; - i = hx - 0x6147a; - w = z * z; - j = 0x6b851 - hx; - t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); - t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); - i |= j; - R = t2 + t1; - if (i > 0) { - hfsq = 0.5 * f * f; - if (k == 0) - return f - (hfsq - s * (hfsq + R)); - else - return dk * ln2_hi - ((hfsq - (s * (hfsq + R) + dk * ln2_lo)) - - f); - } else { - if (k == 0) - return f - s * (f - R); - else - return dk * ln2_hi - ((s * (f - R) - dk * ln2_lo) - f); - } + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + hx &= 0x000fffff; + i = (hx+0x95f64)&0x100000; + SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ + k += (i>>20); + f = x-1.0; + if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ + if(f==zero) {if(k==0) return zero; else {dk=(double)k; + return dk*ln2_hi+dk*ln2_lo;} + } + R = f*f*(0.5-0.33333333333333333*f); + if(k==0) return f-R; else {dk=(double)k; + return dk*ln2_hi-((R-dk*ln2_lo)-f);} + } + s = f/(2.0+f); + dk = (double)k; + z = s*s; + i = hx-0x6147a; + w = z*z; + j = 0x6b851-hx; + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + i |= j; + R = t2+t1; + if(i>0) { + hfsq=0.5*f*f; + if(k==0) return f-(hfsq-s*(hfsq+R)); else + return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); + } else { + if(k==0) return f-s*(f-R); else + return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); + } } + +/* + * wrapper log(x) + */ +#ifndef _IEEE_LIBM +double log(double x) +{ + double z = __ieee754_log(x); + if (_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0) + return z; + if (x == 0.0) + return __kernel_standard(x, x, 16); /* log(0) */ + return __kernel_standard(x, x, 17); /* log(x<0) */ +} +#else +strong_alias(__ieee754_log, log) +#endif +libm_hidden_def(log) diff --git a/Engine/lib/sdl/src/libm/e_log10.c b/Engine/lib/sdl/src/libm/e_log10.c new file mode 100644 index 000000000..a30ba54e6 --- /dev/null +++ b/Engine/lib/sdl/src/libm/e_log10.c @@ -0,0 +1,106 @@ +/* + * ==================================================== + * 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. + * ==================================================== + */ + +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4723: potential divide by zero. */ +#pragma warning ( disable : 4723 ) +#endif + +/* __ieee754_log10(x) + * Return the base 10 logarithm of x + * + * Method : + * Let log10_2hi = leading 40 bits of log10(2) and + * log10_2lo = log10(2) - log10_2hi, + * ivln10 = 1/log(10) rounded. + * Then + * n = ilogb(x), + * if(n<0) n = n+1; + * x = scalbn(x,-n); + * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) + * + * Note 1: + * To guarantee log10(10**n)=n, where 10**n is normal, the rounding + * mode must set to Round-to-Nearest. + * Note 2: + * [1/log(10)] rounded to 53 bits has error .198 ulps; + * log10 is monotonic at all binary break points. + * + * Special cases: + * log10(x) is NaN with signal if x < 0; + * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; + * log10(NaN) is that NaN with no signal; + * log10(10**N) = N for N=0,1,...,22. + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */ +log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */ +log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */ + +static const double zero = 0.0; + +double attribute_hidden __ieee754_log10(double x) +{ + double y,z; + int32_t i,k,hx; + u_int32_t lx; + + EXTRACT_WORDS(hx,lx,x); + + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + i = ((u_int32_t)k&0x80000000)>>31; + hx = (hx&0x000fffff)|((0x3ff-i)<<20); + y = (double)(k+i); + SET_HIGH_WORD(x,hx); + z = y*log10_2lo + ivln10*__ieee754_log(x); + return z+y*log10_2hi; +} + +/* + * wrapper log10(X) + */ +#ifndef _IEEE_LIBM +double log10(double x) +{ + double z = __ieee754_log10(x); + if (_LIB_VERSION == _IEEE_ || isnan(x)) + return z; + if (x <= 0.0) { + if(x == 0.0) + return __kernel_standard(x, x, 18); /* log10(0) */ + return __kernel_standard(x, x, 19); /* log10(x<0) */ + } + return z; +} +#else +strong_alias(__ieee754_log10, log10) +#endif +libm_hidden_def(log10) diff --git a/Engine/lib/sdl/src/libm/e_pow.c b/Engine/lib/sdl/src/libm/e_pow.c index 686da2e55..cfd1dbfbe 100644 --- a/Engine/lib/sdl/src/libm/e_pow.c +++ b/Engine/lib/sdl/src/libm/e_pow.c @@ -1,4 +1,3 @@ -/* @(#)e_pow.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,10 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; -#endif - /* __ieee754_pow(x,y) return x**y * * n @@ -26,25 +21,26 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; * 3. Return x**y = 2**n*exp(y'*log2) * * Special cases: - * 1. (anything) ** 0 is 1 - * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN - * 4. NAN ** (anything except 0) is NAN - * 5. +-(|x| > 1) ** +INF is +INF - * 6. +-(|x| > 1) ** -INF is +0 - * 7. +-(|x| < 1) ** +INF is +0 - * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN - * 10. +0 ** (+anything except 0, NAN) is +0 - * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 - * 12. +0 ** (-anything except 0, NAN) is +INF - * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF - * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) - * 15. +INF ** (+anything except 0,NAN) is +INF - * 16. +INF ** (-anything except 0,NAN) is +0 - * 17. -INF ** (anything) = -0 ** (-anything) - * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) - * 19. (-anything except 0 and inf) ** (non-integer) is NAN + * 1. +-1 ** anything is 1.0 + * 2. +-1 ** +-INF is 1.0 + * 3. (anything) ** 0 is 1 + * 4. (anything) ** 1 is itself + * 5. (anything) ** NAN is NAN + * 6. NAN ** (anything except 0) is NAN + * 7. +-(|x| > 1) ** +INF is +INF + * 8. +-(|x| > 1) ** -INF is +0 + * 9. +-(|x| < 1) ** +INF is +0 + * 10 +-(|x| < 1) ** -INF is +INF + * 11. +0 ** (+anything except 0, NAN) is +0 + * 12. -0 ** (+anything except 0, NAN, odd integer) is +0 + * 13. +0 ** (-anything except 0, NAN) is +INF + * 14. -0 ** (-anything except 0, NAN, odd integer) is +INF + * 15. -0 ** (odd integer) = -( +0 ** (odd integer) ) + * 16. +INF ** (+anything except 0,NAN) is +INF + * 17. +INF ** (-anything except 0,NAN) is +0 + * 18. -INF ** (anything) = -0 ** (-anything) + * 19. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + * 20. (-anything except 0 and inf) ** (non-integer) is NAN * * Accuracy: * pow(x,y) returns x**y nearly rounded. In particular @@ -62,281 +58,286 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(scalbn) - libm_hidden_proto(fabs) -#ifdef __STDC__ - static const double -#else - static double +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4756: overflow in constant arithmetic */ +#pragma warning ( disable : 4756 ) #endif - bp[] = { 1.0, 1.5, }, dp_h[] = { - 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ - dp_l[] = { - 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +static const double +bp[] = {1.0, 1.5,}, +dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ +dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +zero = 0.0, +one = 1.0, +two = 2.0, +two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ +huge = 1.0e300, +tiny = 1.0e-300, + /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ +L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ +L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ +L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ +L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ +L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ +L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ +P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ +P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ +P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ +P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ +P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ +lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ +lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ +lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ +ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ +cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ +cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ +cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/ +ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ +ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ +ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ - zero = 0.0, one = 1.0, two = 2.0, two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ - huge_val = 1.0e300, tiny = 1.0e-300, - /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ - L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ - L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ - L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ - L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ - L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ - L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ - P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ - P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ - P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ - P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ - P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ - lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ - lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ - lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ - ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ - cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ - cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ - cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h */ - ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ - ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2 */ - ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail */ +double attribute_hidden __ieee754_pow(double x, double y) +{ + double z,ax,z_h,z_l,p_h,p_l; + double y1,t1,t2,r,s,t,u,v,w; + int32_t i,j,k,yisint,n; + int32_t hx,hy,ix,iy; + u_int32_t lx,ly; -#ifdef __STDC__ - double attribute_hidden __ieee754_pow(double x, double y) + EXTRACT_WORDS(hx,lx,x); + /* x==1: 1**y = 1 (even if y is NaN) */ + if (hx==0x3ff00000 && lx==0) { + return x; + } + ix = hx&0x7fffffff; + + EXTRACT_WORDS(hy,ly,y); + iy = hy&0x7fffffff; + + /* y==zero: x**0 = 1 */ + if((iy|ly)==0) return one; + + /* +-NaN return x+y */ + if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + return x+y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if(hx<0) { + if(iy>=0x43400000) yisint = 2; /* even integer y */ + else if(iy>=0x3ff00000) { + k = (iy>>20)-0x3ff; /* exponent */ + if(k>20) { + j = ly>>(52-k); + if((j<<(52-k))==ly) yisint = 2-(j&1); + } else if(ly==0) { + j = iy>>(20-k); + if((j<<(20-k))==iy) yisint = 2-(j&1); + } + } + } + + /* special value of y */ + if(ly==0) { + if (iy==0x7ff00000) { /* y is +-inf */ + if (((ix-0x3ff00000)|lx)==0) + return one; /* +-1**+-inf is 1 (yes, weird rule) */ + if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ + return (hy>=0) ? y : zero; + /* (|x|<1)**-,+inf = inf,0 */ + return (hy<0) ? -y : zero; + } + if(iy==0x3ff00000) { /* y is +-1 */ + if(hy<0) return one/x; else return x; + } + if(hy==0x40000000) return x*x; /* y is 2 */ + if(hy==0x3fe00000) { /* y is 0.5 */ + if(hx>=0) /* x >= +0 */ + return __ieee754_sqrt(x); + } + } + + ax = fabs(x); + /* special value of x */ + if(lx==0) { + if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ + z = ax; /*x is +-0,+-inf,+-1*/ + if(hy<0) z = one/z; /* z = (1/|x|) */ + if(hx<0) { + if(((ix-0x3ff00000)|yisint)==0) { + z = (z-z)/(z-z); /* (-1)**non-int is NaN */ + } else if(yisint==1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + } + + /* (x<0)**(non-int) is NaN */ + if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); + + /* |y| is huge */ + if(iy>0x41e00000) { /* if |y| > 2**31 */ + if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ + if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + } + /* over/underflow if x is not close to one */ + if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x-1; /* t has 20 trailing zeros */ + w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); + u = ivln2_h*t; /* ivln2_h has 21 sig. bits */ + v = t*ivln2_l-w*ivln2; + t1 = u+v; + SET_LOW_WORD(t1,0); + t2 = v-(t1-u); + } else { + double s2,s_h,s_l,t_h,t_l; + n = 0; + /* take care subnormal number */ + if(ix<0x00100000) + {ax *= two53; n -= 53; GET_HIGH_WORD(ix,ax); } + n += ((ix)>>20)-0x3ff; + j = ix&0x000fffff; + /* determine interval */ + ix = j|0x3ff00000; /* normalize ix */ + if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18)); + t_l = ax - (t_h-bp[k]); + s_l = v*((u-s_h*t_h)-s_h*t_l); + /* compute log(ax) */ + s2 = s*s; + r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); + r += s_l*(s_h+s); + s2 = s_h*s_h; + t_h = 3.0+s2+r; + SET_LOW_WORD(t_h,0); + t_l = r-((t_h-3.0)-s2); + /* u+v = s*(1+...) */ + u = s_h*t_h; + v = s_l*t_h+t_l*s; + /* 2/(3log2)*(s+...) */ + p_h = u+v; + SET_LOW_WORD(p_h,0); + p_l = v-(p_h-u); + z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = cp_l*p_h+p_l*cp+dp_l[k]; + /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (double)n; + t1 = (((z_h+z_l)+dp_h[k])+t); + SET_LOW_WORD(t1,0); + t2 = z_l-(((t1-t)-dp_h[k])-z_h); + } + + s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ + if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) + s = -one;/* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + y1 = y; + SET_LOW_WORD(y1,0); + p_l = (y-y1)*t1+y*t2; + p_h = y1*t1; + z = p_l+p_h; + EXTRACT_WORDS(j,i,z); + if (j>=0x40900000) { /* z >= 1024 */ + if(((j-0x40900000)|i)!=0) /* if z > 1024 */ + return s*huge*huge; /* overflow */ + else { + if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ + } + } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ + if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ + return s*tiny*tiny; /* underflow */ + else { + if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ + } + } + /* + * compute 2**(p_h+p_l) + */ + i = j&0x7fffffff; + k = (i>>20)-0x3ff; + n = 0; + if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j+(0x00100000>>(k+1)); + k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ + t = zero; + SET_HIGH_WORD(t,n&~(0x000fffff>>k)); + n = ((n&0x000fffff)|0x00100000)>>(20-k); + if(j<0) n = -n; + p_h -= t; + } + t = p_l+p_h; + SET_LOW_WORD(t,0); + u = t*lg2_h; + v = (p_l-(t-p_h))*lg2+t*lg2_l; + z = u+v; + w = v-(z-u); + t = z*z; + t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); + r = (z*t1)/(t1-two)-(w+z*w); + z = one-(r-z); + GET_HIGH_WORD(j,z); + j += (n<<20); + if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ + else SET_HIGH_WORD(z,j); + return s*z; +} + +/* + * wrapper pow(x,y) return x**y + */ +#ifndef _IEEE_LIBM +double pow(double x, double y) +{ + double z = __ieee754_pow(x, y); + if (_LIB_VERSION == _IEEE_|| isnan(y)) + return z; + if (isnan(x)) { + if (y == 0.0) + return __kernel_standard(x, y, 42); /* pow(NaN,0.0) */ + return z; + } + if (x == 0.0) { + if (y == 0.0) + return __kernel_standard(x, y, 20); /* pow(0.0,0.0) */ + if (isfinite(y) && y < 0.0) + return __kernel_standard(x,y,23); /* pow(0.0,negative) */ + return z; + } + if (!isfinite(z)) { + if (isfinite(x) && isfinite(y)) { + if (isnan(z)) + return __kernel_standard(x, y, 24); /* pow neg**non-int */ + return __kernel_standard(x, y, 21); /* pow overflow */ + } + } + if (z == 0.0 && isfinite(x) && isfinite(y)) + return __kernel_standard(x, y, 22); /* pow underflow */ + return z; +} #else - double attribute_hidden __ieee754_pow(x, y) - double x, y; +strong_alias(__ieee754_pow, pow) #endif - { - double z, ax, z_h, z_l, p_h, p_l; - double y1, t1, t2, r, s, t, u, v, w; - int32_t i, j, k, yisint, n; - int32_t hx, hy, ix, iy; - u_int32_t lx, ly; - - EXTRACT_WORDS(hx, lx, x); - EXTRACT_WORDS(hy, ly, y); - ix = hx & 0x7fffffff; - iy = hy & 0x7fffffff; - - /* y==zero: x**0 = 1 */ - if ((iy | ly) == 0) - return one; - - /* +-NaN return x+y */ - if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) || - iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0))) - return x + y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if (hx < 0) { - if (iy >= 0x43400000) - yisint = 2; /* even integer y */ - else if (iy >= 0x3ff00000) { - k = (iy >> 20) - 0x3ff; /* exponent */ - if (k > 20) { - j = ly >> (52 - k); - if ((j << (52 - k)) == ly) - yisint = 2 - (j & 1); - } else if (ly == 0) { - j = iy >> (20 - k); - if ((j << (20 - k)) == iy) - yisint = 2 - (j & 1); - } - } - } - - /* special value of y */ - if (ly == 0) { - if (iy == 0x7ff00000) { /* y is +-inf */ - if (((ix - 0x3ff00000) | lx) == 0) - return y - y; /* inf**+-1 is NaN */ - else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ - return (hy >= 0) ? y : zero; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy < 0) ? -y : zero; - } - if (iy == 0x3ff00000) { /* y is +-1 */ - if (hy < 0) - return one / x; - else - return x; - } - if (hy == 0x40000000) - return x * x; /* y is 2 */ - if (hy == 0x3fe00000) { /* y is 0.5 */ - if (hx >= 0) /* x >= +0 */ - return __ieee754_sqrt(x); - } - } - - ax = fabs(x); - /* special value of x */ - if (lx == 0) { - if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000) { - z = ax; /* x is +-0,+-inf,+-1 */ - if (hy < 0) - z = one / z; /* z = (1/|x|) */ - if (hx < 0) { - if (((ix - 0x3ff00000) | yisint) == 0) { - z = (z - z) / (z - z); /* (-1)**non-int is NaN */ - } else if (yisint == 1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - /* (x<0)**(non-int) is NaN */ - if (((((u_int32_t) hx >> 31) - 1) | yisint) == 0) - return (x - x) / (x - x); - - /* |y| is huge */ - if (iy > 0x41e00000) { /* if |y| > 2**31 */ - if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */ - if (ix <= 0x3fefffff) - return (hy < 0) ? huge_val * huge_val : tiny * tiny; - if (ix >= 0x3ff00000) - return (hy > 0) ? huge_val * huge_val : tiny * tiny; - } - /* over/underflow if x is not close to one */ - if (ix < 0x3fefffff) - return (hy < 0) ? huge_val * huge_val : tiny * tiny; - if (ix > 0x3ff00000) - return (hy > 0) ? huge_val * huge_val : tiny * tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = x - 1; /* t has 20 trailing zeros */ - w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); - u = ivln2_h * t; /* ivln2_h has 21 sig. bits */ - v = t * ivln2_l - w * ivln2; - t1 = u + v; - SET_LOW_WORD(t1, 0); - t2 = v - (t1 - u); - } else { - double s2, s_h, s_l, t_h, t_l; - n = 0; - /* take care subnormal number */ - if (ix < 0x00100000) { - ax *= two53; - n -= 53; - GET_HIGH_WORD(ix, ax); - } - n += ((ix) >> 20) - 0x3ff; - j = ix & 0x000fffff; - /* determine interval */ - ix = j | 0x3ff00000; /* normalize ix */ - if (j <= 0x3988E) - k = 0; /* |x|> 1) | 0x20000000) + 0x00080000 + (k << 18)); - t_l = ax - (t_h - bp[k]); - s_l = v * ((u - s_h * t_h) - s_h * t_l); - /* compute log(ax) */ - s2 = s * s; - r = s2 * s2 * (L1 + - s2 * (L2 + - s2 * (L3 + - s2 * (L4 + s2 * (L5 + s2 * L6))))); - r += s_l * (s_h + s); - s2 = s_h * s_h; - t_h = 3.0 + s2 + r; - SET_LOW_WORD(t_h, 0); - t_l = r - ((t_h - 3.0) - s2); - /* u+v = s*(1+...) */ - u = s_h * t_h; - v = s_l * t_h + t_l * s; - /* 2/(3log2)*(s+...) */ - p_h = u + v; - SET_LOW_WORD(p_h, 0); - p_l = v - (p_h - u); - z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l * p_h + p_l * cp + dp_l[k]; - /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double) n; - t1 = (((z_h + z_l) + dp_h[k]) + t); - SET_LOW_WORD(t1, 0); - t2 = z_l - (((t1 - t) - dp_h[k]) - z_h); - } - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0) - s = -one; /* (-ve)**(odd int) */ - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - SET_LOW_WORD(y1, 0); - p_l = (y - y1) * t1 + y * t2; - p_h = y1 * t1; - z = p_l + p_h; - EXTRACT_WORDS(j, i, z); - if (j >= 0x40900000) { /* z >= 1024 */ - if (((j - 0x40900000) | i) != 0) /* if z > 1024 */ - return s * huge_val * huge_val; /* overflow */ - else { - if (p_l + ovt > z - p_h) - return s * huge_val * huge_val; /* overflow */ - } - } else if ((j & 0x7fffffff) >= 0x4090cc00) { /* z <= -1075 */ - if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */ - return s * tiny * tiny; /* underflow */ - else { - if (p_l <= z - p_h) - return s * tiny * tiny; /* underflow */ - } - } - /* - * compute 2**(p_h+p_l) - */ - i = j & 0x7fffffff; - k = (i >> 20) - 0x3ff; - n = 0; - if (i > 0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j + (0x00100000 >> (k + 1)); - k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */ - t = zero; - SET_HIGH_WORD(t, n & ~(0x000fffff >> k)); - n = ((n & 0x000fffff) | 0x00100000) >> (20 - k); - if (j < 0) - n = -n; - p_h -= t; - } - t = p_l + p_h; - SET_LOW_WORD(t, 0); - u = t * lg2_h; - v = (p_l - (t - p_h)) * lg2 + t * lg2_l; - z = u + v; - w = v - (z - u); - t = z * z; - t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); - r = (z * t1) / (t1 - two) - (w + z * w); - z = one - (r - z); - GET_HIGH_WORD(j, z); - j += (n << 20); - if ((j >> 20) <= 0) - z = scalbn(z, n); /* subnormal output */ - else - SET_HIGH_WORD(z, j); - return s * z; - } +libm_hidden_def(pow) diff --git a/Engine/lib/sdl/src/libm/e_rem_pio2.c b/Engine/lib/sdl/src/libm/e_rem_pio2.c index a8ffe3142..df7c2b823 100644 --- a/Engine/lib/sdl/src/libm/e_rem_pio2.c +++ b/Engine/lib/sdl/src/libm/e_rem_pio2.c @@ -1,4 +1,3 @@ -/* @(#)e_rem_pio2.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_rem_pio2.c,v 1.8 1995/05/10 20:46:02 jtc Exp $"; -#endif - /* __ieee754_rem_pio2(x,y) * * return the remainder of x rem pi/2 in y[0]+y[1] @@ -24,40 +18,30 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(fabs) - /* * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi */ -#ifdef __STDC__ - static const int32_t two_over_pi[] = { -#else - static int32_t two_over_pi[] = { -#endif - 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, - 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, - 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, - 0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, - 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, - 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, - 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, - 0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, - 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, - 0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, - 0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, - }; +static const int32_t two_over_pi[] = { +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +}; -#ifdef __STDC__ static const int32_t npio2_hw[] = { -#else -static int32_t npio2_hw[] = { -#endif - 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, - 0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, - 0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, - 0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, - 0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, - 0x404858EB, 0x404921FB, +0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, +0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, +0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, +0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, +0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, +0x404858EB, 0x404921FB, }; /* @@ -70,132 +54,108 @@ static int32_t npio2_hw[] = { * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) */ -#ifdef __STDC__ static const double -#else -static double -#endif - zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ - half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ - invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ - pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ - pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ - pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ - pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ - pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ - pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ +zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ +pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ +pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ +pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ +pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ +pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ +pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ -#ifdef __STDC__ -int32_t attribute_hidden -__ieee754_rem_pio2(double x, double *y) -#else -int32_t attribute_hidden -__ieee754_rem_pio2(x, y) - double x, y[]; -#endif +int32_t attribute_hidden __ieee754_rem_pio2(double x, double *y) { - double z = 0.0, w, t, r, fn; - double tx[3]; - int32_t e0, i, j, nx, n, ix, hx; - u_int32_t low; + double z=0.0,w,t,r,fn; + double tx[3]; + int32_t e0,i,j,nx,n,ix,hx; + u_int32_t low; - GET_HIGH_WORD(hx, x); /* high word of x */ - ix = hx & 0x7fffffff; - if (ix <= 0x3fe921fb) { /* |x| ~<= pi/4 , no need for reduction */ - y[0] = x; - y[1] = 0; - return 0; - } - if (ix < 0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ - if (hx > 0) { - z = x - pio2_1; - if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z - pio2_1t; - y[1] = (z - y[0]) - pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z - y[0]) - pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z + pio2_1t; - y[1] = (z - y[0]) + pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z - y[0]) + pio2_2t; - } - return -1; - } - } - if (ix <= 0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ - t = fabs(x); - n = (int32_t) (t * invpio2 + half); - fn = (double) n; - r = t - fn * pio2_1; - w = fn * pio2_1t; /* 1st round good to 85 bit */ - if (n < 32 && ix != npio2_hw[n - 1]) { - y[0] = r - w; /* quick check no cancellation */ - } else { - u_int32_t high; - j = ix >> 20; - y[0] = r - w; - GET_HIGH_WORD(high, y[0]); - i = j - ((high >> 20) & 0x7ff); - if (i > 16) { /* 2nd iteration needed, good to 118 */ - t = r; - w = fn * pio2_2; - r = t - w; - w = fn * pio2_2t - ((t - r) - w); - y[0] = r - w; - GET_HIGH_WORD(high, y[0]); - i = j - ((high >> 20) & 0x7ff); - if (i > 49) { /* 3rd iteration need, 151 bits acc */ - t = r; /* will cover all possible cases */ - w = fn * pio2_3; - r = t - w; - w = fn * pio2_3t - ((t - r) - w); - y[0] = r - w; - } - } - } - y[1] = (r - y[0]) - w; - if (hx < 0) { - y[0] = -y[0]; - y[1] = -y[1]; - return -n; - } else - return n; - } + GET_HIGH_WORD(hx,x); /* high word of x */ + ix = hx&0x7fffffff; + if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z - pio2_1t; + y[1] = (z-y[0])-pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z-y[0])-pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z + pio2_1t; + y[1] = (z-y[0])+pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z-y[0])+pio2_2t; + } + return -1; + } + } + if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ + t = fabs(x); + n = (int32_t) (t*invpio2+half); + fn = (double)n; + r = t-fn*pio2_1; + w = fn*pio2_1t; /* 1st round good to 85 bit */ + if(n<32&&ix!=npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + u_int32_t high; + j = ix>>20; + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>16) { /* 2nd iteration needed, good to 118 */ + t = r; + w = fn*pio2_2; + r = t-w; + w = fn*pio2_2t-((t-r)-w); + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>49) { /* 3rd iteration need, 151 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*pio2_3; + r = t-w; + w = fn*pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } /* * all other (large) arguments */ - if (ix >= 0x7ff00000) { /* x is inf or NaN */ - y[0] = y[1] = x - x; - return 0; - } + if(ix>=0x7ff00000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } /* set z = scalbn(|x|,ilogb(x)-23) */ - GET_LOW_WORD(low, x); - SET_LOW_WORD(z, low); - e0 = (ix >> 20) - 1046; /* e0 = ilogb(z)-23; */ - SET_HIGH_WORD(z, ix - ((int32_t) (e0 << 20))); - for (i = 0; i < 2; i++) { - tx[i] = (double) ((int32_t) (z)); - z = (z - tx[i]) * two24; - } - tx[2] = z; - nx = 3; - while (tx[nx - 1] == zero) - nx--; /* skip zero term */ - n = __kernel_rem_pio2(tx, y, e0, nx, 2, two_over_pi); - if (hx < 0) { - y[0] = -y[0]; - y[1] = -y[1]; - return -n; - } - return n; + GET_LOW_WORD(low,x); + SET_LOW_WORD(z,low); + e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */ + SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20))); + for(i=0;i<2;i++) { + tx[i] = (double)((int32_t)(z)); + z = (z-tx[i])*two24; + } + tx[2] = z; + nx = 3; + while(tx[nx-1]==zero) nx--; /* skip zero term */ + n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + return n; } diff --git a/Engine/lib/sdl/src/libm/e_sqrt.c b/Engine/lib/sdl/src/libm/e_sqrt.c index b8b8bec6f..39c83e1f3 100644 --- a/Engine/lib/sdl/src/libm/e_sqrt.c +++ b/Engine/lib/sdl/src/libm/e_sqrt.c @@ -1,4 +1,3 @@ -/* @(#)e_sqrt.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_sqrt.c,v 1.8 1995/05/10 20:46:17 jtc Exp $"; -#endif - /* __ieee754_sqrt(x) * Return correctly rounded sqrt. * ------------------------------------------ @@ -88,124 +82,123 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double one = 1.0, tiny = 1.0e-300; -#else -static double one = 1.0, tiny = 1.0e-300; -#endif -#ifdef __STDC__ -double attribute_hidden -__ieee754_sqrt(double x) -#else -double attribute_hidden -__ieee754_sqrt(x) - double x; -#endif +double attribute_hidden __ieee754_sqrt(double x) { - double z; - int32_t sign = (int) 0x80000000; - int32_t ix0, s0, q, m, t, i; - u_int32_t r, t1, s1, ix1, q1; + double z; + int32_t sign = (int)0x80000000; + int32_t ix0,s0,q,m,t,i; + u_int32_t r,t1,s1,ix1,q1; - EXTRACT_WORDS(ix0, ix1, x); + EXTRACT_WORDS(ix0,ix1,x); /* take care of Inf and NaN */ - if ((ix0 & 0x7ff00000) == 0x7ff00000) { - return x * x + x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf - sqrt(-inf)=sNaN */ - } + if((ix0&0x7ff00000)==0x7ff00000) { + return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf + sqrt(-inf)=sNaN */ + } /* take care of zero */ - if (ix0 <= 0) { - if (((ix0 & (~sign)) | ix1) == 0) - return x; /* sqrt(+-0) = +-0 */ - else if (ix0 < 0) - return (x - x) / (x - x); /* sqrt(-ve) = sNaN */ - } + if(ix0<=0) { + if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ + else if(ix0<0) + return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ + } /* normalize x */ - m = (ix0 >> 20); - if (m == 0) { /* subnormal x */ - while (ix0 == 0) { - m -= 21; - ix0 |= (ix1 >> 11); - ix1 <<= 21; - } - for (i = 0; (ix0 & 0x00100000) == 0; i++) - ix0 <<= 1; - m -= i - 1; - ix0 |= (ix1 >> (32 - i)); - ix1 <<= i; - } - m -= 1023; /* unbias exponent */ - ix0 = (ix0 & 0x000fffff) | 0x00100000; - if (m & 1) { /* odd m, double x to make it even */ - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - } - m >>= 1; /* m = [m/2] */ + m = (ix0>>20); + if(m==0) { /* subnormal x */ + while(ix0==0) { + m -= 21; + ix0 |= (ix1>>11); ix1 <<= 21; + } + for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; + m -= i-1; + ix0 |= (ix1>>(32-i)); + ix1 <<= i; + } + m -= 1023; /* unbias exponent */ + ix0 = (ix0&0x000fffff)|0x00100000; + if(m&1){ /* odd m, double x to make it even */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + } + m >>= 1; /* m = [m/2] */ /* generate sqrt(x) bit by bit */ - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ - r = 0x00200000; /* r = moving bit from right to left */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ + r = 0x00200000; /* r = moving bit from right to left */ - while (r != 0) { - t = s0 + r; - if (t <= ix0) { - s0 = t + r; - ix0 -= t; - q += r; - } - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - r >>= 1; - } + while(r!=0) { + t = s0+r; + if(t<=ix0) { + s0 = t+r; + ix0 -= t; + q += r; + } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + r>>=1; + } - r = sign; - while (r != 0) { - t1 = s1 + r; - t = s0; - if ((t < ix0) || ((t == ix0) && (t1 <= ix1))) { - s1 = t1 + r; - if (((t1 & sign) == sign) && (s1 & sign) == 0) - s0 += 1; - ix0 -= t; - if (ix1 < t1) - ix0 -= 1; - ix1 -= t1; - q1 += r; - } - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - r >>= 1; - } + r = sign; + while(r!=0) { + t1 = s1+r; + t = s0; + if((t>31); + ix1 += ix1; + r>>=1; + } /* use floating add to find out rounding direction */ - if ((ix0 | ix1) != 0) { - z = one - tiny; /* trigger inexact flag */ - if (z >= one) { - z = one + tiny; - if (q1 == (u_int32_t) 0xffffffff) { - q1 = 0; - q += 1; - } else if (z > one) { - if (q1 == (u_int32_t) 0xfffffffe) - q += 1; - q1 += 2; - } else - q1 += (q1 & 1); - } - } - ix0 = (q >> 1) + 0x3fe00000; - ix1 = q1 >> 1; - if ((q & 1) == 1) - ix1 |= sign; - ix0 += (m << 20); - INSERT_WORDS(z, ix0, ix1); - return z; + if((ix0|ix1)!=0) { + z = one-tiny; /* trigger inexact flag */ + if (z>=one) { + z = one+tiny; + if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;} + else if (z>one) { + if (q1==(u_int32_t)0xfffffffe) q+=1; + q1+=2; + } else + q1 += (q1&1); + } + } + ix0 = (q>>1)+0x3fe00000; + ix1 = q1>>1; + if ((q&1)==1) ix1 |= sign; + ix0 += (m <<20); + INSERT_WORDS(z,ix0,ix1); + return z; } +/* + * wrapper sqrt(x) + */ +#ifndef _IEEE_LIBM +double sqrt(double x) +{ + double z = __ieee754_sqrt(x); + if (_LIB_VERSION == _IEEE_ || isnan(x)) + return z; + if (x < 0.0) + return __kernel_standard(x, x, 26); /* sqrt(negative) */ + return z; +} +#else +strong_alias(__ieee754_sqrt, sqrt) +#endif +libm_hidden_def(sqrt) + + /* Other methods (use floating-point arithmetic) ------------- diff --git a/Engine/lib/sdl/src/libm/k_cos.c b/Engine/lib/sdl/src/libm/k_cos.c index 64c50e3fb..e1326fa64 100644 --- a/Engine/lib/sdl/src/libm/k_cos.c +++ b/Engine/lib/sdl/src/libm/k_cos.c @@ -1,4 +1,3 @@ -/* @(#)k_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_cos.c,v 1.8 1995/05/10 20:46:22 jtc Exp $"; -#endif - /* * __kernel_cos( x, y ) * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 @@ -53,48 +47,36 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ - C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ - C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ - C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ - C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ - C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ - C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ +C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ +C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ +C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ +C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ +C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ -#ifdef __STDC__ -double attribute_hidden -__kernel_cos(double x, double y) -#else -double attribute_hidden -__kernel_cos(x, y) - double x, y; -#endif +double attribute_hidden __kernel_cos(double x, double y) { - double a, hz, z, r, qx; - int32_t ix; - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; /* ix = |x|'s high word */ - if (ix < 0x3e400000) { /* if x < 2**27 */ - if (((int) x) == 0) - return one; /* generate inexact */ - } - z = x * x; - r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6))))); - if (ix < 0x3FD33333) /* if |x| < 0.3 */ - return one - (0.5 * z - (z * r - x * y)); - else { - if (ix > 0x3fe90000) { /* x > 0.78125 */ - qx = 0.28125; - } else { - INSERT_WORDS(qx, ix - 0x00200000, 0); /* x/4 */ - } - hz = 0.5 * z - qx; - a = one - qx; - return a - (hz - (z * r - x * y)); - } + double a,hz,z,r,qx; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* ix = |x|'s high word*/ + if(ix<0x3e400000) { /* if x < 2**27 */ + if(((int)x)==0) return one; /* generate inexact */ + } + z = x*x; + r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); + if(ix < 0x3FD33333) /* if |x| < 0.3 */ + return one - (0.5*z - (z*r - x*y)); + else { + if(ix > 0x3fe90000) { /* x > 0.78125 */ + qx = 0.28125; + } else { + INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */ + } + hz = 0.5*z-qx; + a = one-qx; + return a - (hz - (z*r-x*y)); + } } diff --git a/Engine/lib/sdl/src/libm/k_rem_pio2.c b/Engine/lib/sdl/src/libm/k_rem_pio2.c index 23c2b61dd..7b04275c6 100644 --- a/Engine/lib/sdl/src/libm/k_rem_pio2.c +++ b/Engine/lib/sdl/src/libm/k_rem_pio2.c @@ -1,4 +1,3 @@ -/* @(#)k_rem_pio2.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_rem_pio2.c,v 1.7 1995/05/10 20:46:25 jtc Exp $"; -#endif - /* * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) * double x[],y[]; int e0,nx,prec; int ipio2[]; @@ -134,230 +128,172 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#include "SDL_assert.h" +static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ -libm_hidden_proto(scalbn) - libm_hidden_proto(floor) -#ifdef __STDC__ - static const int init_jk[] = { 2, 3, 4, 6 }; /* initial value for jk */ -#else - static int init_jk[] = { 2, 3, 4, 6 }; -#endif - -#ifdef __STDC__ static const double PIo2[] = { -#else -static double PIo2[] = { -#endif - 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ - 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ - 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ - 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ - 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ - 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ - 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ - 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ + 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ + 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ + 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ + 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ + 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ + 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ + 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ + 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ }; -#ifdef __STDC__ static const double -#else -static double -#endif - zero = 0.0, one = 1.0, two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ - twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ +zero = 0.0, +one = 1.0, +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ -#ifdef __STDC__ -int attribute_hidden -__kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, - const int32_t * ipio2) -#else -int attribute_hidden -__kernel_rem_pio2(x, y, e0, nx, prec, ipio2) - double x[], y[]; - int e0, nx, prec; - int32_t ipio2[]; -#endif +int attribute_hidden __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2) { - int32_t jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih; - double z, fw, f[20], fq[20], q[20]; + int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + double z,fw,f[20],fq[20],q[20]; - /* initialize jk */ - SDL_assert((prec >= 0) && (prec < SDL_arraysize(init_jk))); - jk = init_jk[prec]; - SDL_assert((jk >= 2) && (jk <= 6)); - jp = jk; + /* initialize jk*/ + jk = init_jk[prec]; + jp = jk; /* determine jx,jv,q0, note that 3>q0 */ - SDL_assert(nx > 0); - jx = nx - 1; - jv = (e0 - 3) / 24; - if (jv < 0) - jv = 0; - q0 = e0 - 24 * (jv + 1); + jx = nx-1; + jv = (e0-3)/24; if(jv<0) jv=0; + q0 = e0-24*(jv+1); /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv - jx; - m = jx + jk; - for (i = 0; i <= m; i++, j++) - f[i] = (j < 0) ? zero : (double) ipio2[j]; + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; /* compute q[0],q[1],...q[jk] */ - for (i = 0; i <= jk; i++) { - for (j = 0, fw = 0.0; j <= jx; j++) - fw += x[j] * f[jx + i - j]; - q[i] = fw; - } + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } - jz = jk; - recompute: + jz = jk; +recompute: /* distill q[] into iq[] reversingly */ - for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--) { - fw = (double) ((int32_t) (twon24 * z)); - iq[i] = (int32_t) (z - two24 * fw); - z = q[j - 1] + fw; - } + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (double)((int32_t)(twon24* z)); + iq[i] = (int32_t)(z-two24*fw); + z = q[j-1]+fw; + } /* compute n */ - z = scalbn(z, q0); /* actual value of z */ - z -= 8.0 * floor(z * 0.125); /* trim off integer >= 8 */ - n = (int32_t) z; - z -= (double) n; - ih = 0; - if (q0 > 0) { /* need iq[jz-1] to determine n */ - i = (iq[jz - 1] >> (24 - q0)); - n += i; - iq[jz - 1] -= i << (24 - q0); - ih = iq[jz - 1] >> (23 - q0); - } else if (q0 == 0) - ih = iq[jz - 1] >> 23; - else if (z >= 0.5) - ih = 2; + z = scalbn(z,q0); /* actual value of z */ + z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */ + n = (int32_t) z; + z -= (double)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(24-q0)); n += i; + iq[jz-1] -= i<<(24-q0); + ih = iq[jz-1]>>(23-q0); + } + else if(q0==0) ih = iq[jz-1]>>23; + else if(z>=0.5) ih=2; - if (ih > 0) { /* q > 0.5 */ - n += 1; - carry = 0; - for (i = 0; i < jz; i++) { /* compute 1-q */ - j = iq[i]; - if (carry == 0) { - if (j != 0) { - carry = 1; - iq[i] = 0x1000000 - j; - } - } else - iq[i] = 0xffffff - j; - } - if (q0 > 0) { /* rare case: chance is 1 in 12 */ - switch (q0) { - case 1: - iq[jz - 1] &= 0x7fffff; - break; - case 2: - iq[jz - 1] &= 0x3fffff; - break; - } - } - if (ih == 2) { - z = one - z; - if (carry != 0) - z -= scalbn(one, q0); - } - } + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7fffff; break; + case 2: + iq[jz-1] &= 0x3fffff; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= scalbn(one,q0); + } + } /* check if recomputation is needed */ - if (z == zero) { - j = 0; - for (i = jz - 1; i >= jk; i--) - j |= iq[i]; - if (j == 0) { /* need recomputation */ - for (k = 1; iq[jk - k] == 0; k++); /* k = no. of terms needed */ + if(z==zero) { + j = 0; + for (i=jz-1;i>=jk;i--) j |= iq[i]; + if(j==0) { /* need recomputation */ + for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ - for (i = jz + 1; i <= jz + k; i++) { /* add q[jz+1] to q[jz+k] */ - f[jx + i] = (double) ipio2[jv + i]; - for (j = 0, fw = 0.0; j <= jx; j++) - fw += x[j] * f[jx + i - j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } + for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ + f[jx+i] = (double) ipio2[jv+i]; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } /* chop off zero terms */ - if (z == 0.0) { - jz -= 1; - q0 -= 24; - while (iq[jz] == 0) { - jz--; - q0 -= 24; - } - } else { /* break z into 24-bit if necessary */ - z = scalbn(z, -q0); - if (z >= two24) { - fw = (double) ((int32_t) (twon24 * z)); - iq[jz] = (int32_t) (z - two24 * fw); - jz += 1; - q0 += 24; - iq[jz] = (int32_t) fw; - } else - iq[jz] = (int32_t) z; - } + if(z==0.0) { + jz -= 1; q0 -= 24; + while(iq[jz]==0) { jz--; q0-=24;} + } else { /* break z into 24-bit if necessary */ + z = scalbn(z,-q0); + if(z>=two24) { + fw = (double)((int32_t)(twon24*z)); + iq[jz] = (int32_t)(z-two24*fw); + jz += 1; q0 += 24; + iq[jz] = (int32_t) fw; + } else iq[jz] = (int32_t) z ; + } /* convert integer "bit" chunk to floating-point value */ - fw = scalbn(one, q0); - for (i = jz; i >= 0; i--) { - q[i] = fw * (double) iq[i]; - fw *= twon24; - } + fw = scalbn(one,q0); + for(i=jz;i>=0;i--) { + q[i] = fw*(double)iq[i]; fw*=twon24; + } /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for (i = jz; i >= 0; i--) { - for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++) - fw += PIo2[k] * q[i + k]; - fq[jz - i] = fw; - } + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } /* compress fq[] into y[] */ - switch (prec) { - case 0: - fw = 0.0; - for (i = jz; i >= 0; i--) - fw += fq[i]; - y[0] = (ih == 0) ? fw : -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i = jz; i >= 0; i--) - fw += fq[i]; - y[0] = (ih == 0) ? fw : -fw; - fw = fq[0] - fw; - for (i = 1; i <= jz; i++) - fw += fq[i]; - y[1] = (ih == 0) ? fw : -fw; - break; - case 3: /* painful */ - for (i = jz; i > 0; i--) { - fw = fq[i - 1] + fq[i]; - fq[i] += fq[i - 1] - fw; - fq[i - 1] = fw; - } - for (i = jz; i > 1; i--) { - fw = fq[i - 1] + fq[i]; - fq[i] += fq[i - 1] - fw; - fq[i - 1] = fw; - } - for (fw = 0.0, i = jz; i >= 2; i--) - fw += fq[i]; - if (ih == 0) { - y[0] = fq[0]; - y[1] = fq[1]; - y[2] = fw; - } else { - y[0] = -fq[0]; - y[1] = -fq[1]; - y[2] = -fw; - } - } - return n & 7; + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } + } + return n&7; } diff --git a/Engine/lib/sdl/src/libm/k_sin.c b/Engine/lib/sdl/src/libm/k_sin.c index 60881575a..3520d6b4c 100644 --- a/Engine/lib/sdl/src/libm/k_sin.c +++ b/Engine/lib/sdl/src/libm/k_sin.c @@ -1,4 +1,3 @@ -/* @(#)k_sin.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_sin.c,v 1.8 1995/05/10 20:46:31 jtc Exp $"; -#endif - /* __kernel_sin( x, y, iy) * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. @@ -46,42 +40,26 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ - S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ - S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ - S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ - S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ - S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ +S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ +S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ +S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ +S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ +S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ -#ifdef __STDC__ -double attribute_hidden -__kernel_sin(double x, double y, int iy) -#else -double attribute_hidden -__kernel_sin(x, y, iy) - double x, y; - int iy; /* iy=0 if y is zero */ -#endif +double attribute_hidden __kernel_sin(double x, double y, int iy) { - double z, r, v; - int32_t ix; - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; /* high word of x */ - if (ix < 0x3e400000) { /* |x| < 2**-27 */ - if ((int) x == 0) - return x; - } /* generate inexact */ - z = x * x; - v = z * x; - r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6))); - if (iy == 0) - return x + v * (S1 + z * r); - else - return x - ((z * (half * y - v * r) - y) - v * S1); + double z,r,v; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* high word of x */ + if(ix<0x3e400000) /* |x| < 2**-27 */ + {if((int)x==0) return x;} /* generate inexact */ + z = x*x; + v = z*x; + r = S2+z*(S3+z*(S4+z*(S5+z*S6))); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); } diff --git a/Engine/lib/sdl/src/libm/k_tan.c b/Engine/lib/sdl/src/libm/k_tan.c index 27e6639b0..47b4e3dcd 100644 --- a/Engine/lib/sdl/src/libm/k_tan.c +++ b/Engine/lib/sdl/src/libm/k_tan.c @@ -66,7 +66,7 @@ T[] = { 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */ }; -double __kernel_tan(double x, double y, int iy) +double attribute_hidden __kernel_tan(double x, double y, int iy) { double z,r,v,w,s; int32_t ix,hx; diff --git a/Engine/lib/sdl/src/libm/math_libm.h b/Engine/lib/sdl/src/libm/math_libm.h index 3fe1727a3..eb7bdd597 100644 --- a/Engine/lib/sdl/src/libm/math_libm.h +++ b/Engine/lib/sdl/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,9 @@ double SDL_uclibc_copysign(double x, double y); double SDL_uclibc_cos(double x); double SDL_uclibc_fabs(double x); double SDL_uclibc_floor(double x); +double SDL_uclibc_fmod(double x, double y); double SDL_uclibc_log(double x); +double SDL_uclibc_log10(double x); double SDL_uclibc_pow(double x, double y); double SDL_uclibc_scalbn(double x, int n); double SDL_uclibc_sin(double x); diff --git a/Engine/lib/sdl/src/libm/math_private.h b/Engine/lib/sdl/src/libm/math_private.h index 74c8b3d45..1c0c8a4e9 100644 --- a/Engine/lib/sdl/src/libm/math_private.h +++ b/Engine/lib/sdl/src/libm/math_private.h @@ -21,9 +21,11 @@ #include "SDL_endian.h" /* #include */ +#define _IEEE_LIBM #define attribute_hidden #define libm_hidden_proto(x) #define libm_hidden_def(x) +#define strong_alias(x, y) #ifndef __HAIKU__ /* already defined in a system header. */ typedef unsigned int u_int32_t; @@ -35,8 +37,11 @@ typedef unsigned int u_int32_t; #define cos SDL_uclibc_cos #define fabs SDL_uclibc_fabs #define floor SDL_uclibc_floor +#define __ieee754_fmod SDL_uclibc_fmod #define __ieee754_log SDL_uclibc_log +#define __ieee754_log10 SDL_uclibc_log10 #define __ieee754_pow SDL_uclibc_pow +#define scalbln SDL_uclibc_scalbln #define scalbn SDL_uclibc_scalbn #define sin SDL_uclibc_sin #define __ieee754_sqrt SDL_uclibc_sqrt diff --git a/Engine/lib/sdl/src/libm/s_atan.c b/Engine/lib/sdl/src/libm/s_atan.c index 970ea4dbf..f664f0eb3 100644 --- a/Engine/lib/sdl/src/libm/s_atan.c +++ b/Engine/lib/sdl/src/libm/s_atan.c @@ -112,4 +112,3 @@ double atan(double x) } } libm_hidden_def(atan) - diff --git a/Engine/lib/sdl/src/libm/s_copysign.c b/Engine/lib/sdl/src/libm/s_copysign.c index afd43e9a7..a2f275bf7 100644 --- a/Engine/lib/sdl/src/libm/s_copysign.c +++ b/Engine/lib/sdl/src/libm/s_copysign.c @@ -1,4 +1,3 @@ -/* @(#)s_copysign.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $"; -#endif - /* * copysign(double x, double y) * copysign(x,y) returns a value with the magnitude of x and @@ -24,19 +18,12 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(copysign) -#ifdef __STDC__ - double copysign(double x, double y) -#else - double copysign(x, y) - double x, y; -#endif +double copysign(double x, double y) { - u_int32_t hx, hy; - GET_HIGH_WORD(hx, x); - GET_HIGH_WORD(hy, y); - SET_HIGH_WORD(x, (hx & 0x7fffffff) | (hy & 0x80000000)); - return x; + u_int32_t hx,hy; + GET_HIGH_WORD(hx,x); + GET_HIGH_WORD(hy,y); + SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000)); + return x; } - libm_hidden_def(copysign) diff --git a/Engine/lib/sdl/src/libm/s_cos.c b/Engine/lib/sdl/src/libm/s_cos.c index 66b156c9f..554026053 100644 --- a/Engine/lib/sdl/src/libm/s_cos.c +++ b/Engine/lib/sdl/src/libm/s_cos.c @@ -1,4 +1,3 @@ -/* @(#)s_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_cos.c,v 1.7 1995/05/10 20:47:02 jtc Exp $"; -#endif - /* cos(x) * Return cosine function of x. * @@ -49,43 +43,31 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(cos) -#ifdef __STDC__ - double cos(double x) -#else - double cos(x) - double x; -#endif +double cos(double x) { - double y[2], z = 0.0; - int32_t n, ix; + double y[2],z=0.0; + int32_t n, ix; /* High word of x. */ - GET_HIGH_WORD(ix, x); + GET_HIGH_WORD(ix,x); /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3fe921fb) - return __kernel_cos(x, z); + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_cos(x,z); /* cos(Inf or NaN) is NaN */ - else if (ix >= 0x7ff00000) - return x - x; + else if (ix>=0x7ff00000) return x-x; /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x, y); - switch (n & 3) { - case 0: - return __kernel_cos(y[0], y[1]); - case 1: - return -__kernel_sin(y[0], y[1], 1); - case 2: - return -__kernel_cos(y[0], y[1]); - default: - return __kernel_sin(y[0], y[1], 1); - } - } + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_cos(y[0],y[1]); + case 1: return -__kernel_sin(y[0],y[1],1); + case 2: return -__kernel_cos(y[0],y[1]); + default: + return __kernel_sin(y[0],y[1],1); + } + } } - libm_hidden_def(cos) diff --git a/Engine/lib/sdl/src/libm/s_fabs.c b/Engine/lib/sdl/src/libm/s_fabs.c index 5cf0c3977..9ee943c40 100644 --- a/Engine/lib/sdl/src/libm/s_fabs.c +++ b/Engine/lib/sdl/src/libm/s_fabs.c @@ -1,4 +1,3 @@ -/* @(#)s_fabs.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,30 +9,21 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; -#endif - /* * fabs(x) returns the absolute value of x. */ +/*#include */ +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(fabs) -#ifdef __STDC__ - double fabs(double x) -#else - double fabs(x) - double x; -#endif +double fabs(double x) { - u_int32_t high; - GET_HIGH_WORD(high, x); - SET_HIGH_WORD(x, high & 0x7fffffff); - return x; + u_int32_t high; + GET_HIGH_WORD(high,x); + SET_HIGH_WORD(x,high&0x7fffffff); + return x; } - libm_hidden_def(fabs) diff --git a/Engine/lib/sdl/src/libm/s_floor.c b/Engine/lib/sdl/src/libm/s_floor.c index b553d3038..3f9a5cead 100644 --- a/Engine/lib/sdl/src/libm/s_floor.c +++ b/Engine/lib/sdl/src/libm/s_floor.c @@ -1,4 +1,3 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_floor.c,v 1.8 1995/05/10 20:47:20 jtc Exp $"; -#endif - /* * floor(x) * Return x rounded toward -inf to integral value @@ -24,73 +18,54 @@ static const char rcsid[] = * Inexact flag raised if x not equal to floor(x). */ +/*#include */ +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ -static const double huge_val = 1.0e300; -#else -static double huge_val = 1.0e300; -#endif +static const double huge = 1.0e300; -libm_hidden_proto(floor) -#ifdef __STDC__ - double floor(double x) -#else - double floor(x) - double x; -#endif +double floor(double x) { - int32_t i0, i1, j0; - u_int32_t i, j; - EXTRACT_WORDS(i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - if (j0 < 20) { - if (j0 < 0) { /* raise inexact if x != 0 */ - if (huge_val + x > 0.0) { /* return 0*sign(x) if |x|<1 */ - if (i0 >= 0) { - i0 = i1 = 0; - } else if (((i0 & 0x7fffffff) | i1) != 0) { - i0 = 0xbff00000; - i1 = 0; - } - } - } else { - i = (0x000fffff) >> j0; - if (((i0 & i) | i1) == 0) - return x; /* x is integral */ - if (huge_val + x > 0.0) { /* raise inexact flag */ - if (i0 < 0) - i0 += (0x00100000) >> j0; - i0 &= (~i); - i1 = 0; - } - } - } else if (j0 > 51) { - if (j0 == 0x400) - return x + x; /* inf or NaN */ - else - return x; /* x is integral */ - } else { - i = ((u_int32_t) (0xffffffff)) >> (j0 - 20); - if ((i1 & i) == 0) - return x; /* x is integral */ - if (huge_val + x > 0.0) { /* raise inexact flag */ - if (i0 < 0) { - if (j0 == 20) - i0 += 1; - else { - j = i1 + (1 << (52 - j0)); - if (j < (u_int32_t) i1) - i0 += 1; /* got a carry */ - i1 = j; - } - } - i1 &= (~i); - } - } - INSERT_WORDS(x, i0, i1); - return x; + int32_t i0,i1,j0; + u_int32_t i,j; + EXTRACT_WORDS(i0,i1,x); + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffff)|i1)!=0) + { i0=0xbff00000;i1=0;} + } + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) { + if(j0==20) i0+=1; + else { + j = i1+(1<<(52-j0)); + if(j<(u_int32_t)i1) i0 +=1 ; /* got a carry */ + i1=j; + } + } + i1 &= (~i); + } + } + INSERT_WORDS(x,i0,i1); + return x; } - libm_hidden_def(floor) diff --git a/Engine/lib/sdl/src/libm/s_scalbn.c b/Engine/lib/sdl/src/libm/s_scalbn.c index f824e926d..6bb719223 100644 --- a/Engine/lib/sdl/src/libm/s_scalbn.c +++ b/Engine/lib/sdl/src/libm/s_scalbn.c @@ -1,4 +1,3 @@ -/* @(#)s_scalbn.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,70 +9,61 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $"; -#endif - /* - * scalbn (double x, int n) - * scalbn(x,n) returns x* 2**n computed by exponent + * scalbln(double x, long n) + * scalbln(x,n) returns x * 2**n computed by exponent * manipulation rather than by actually performing an * exponentiation or a multiplication. */ #include "math_libm.h" #include "math_private.h" +#include -libm_hidden_proto(copysign) -#ifdef __STDC__ - static const double -#else - static double -#endif - two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ - twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ - huge_val = 1.0e+300, tiny = 1.0e-300; +static const double +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ +huge = 1.0e+300, +tiny = 1.0e-300; -libm_hidden_proto(scalbn) -#ifdef __STDC__ - double scalbn(double x, int n) -#else - double scalbn(x, n) - double x; - int n; -#endif +double scalbln(double x, long n) { - int32_t k, hx, lx; - EXTRACT_WORDS(hx, lx, x); - k = (hx & 0x7ff00000) >> 20; /* extract exponent */ - if (k == 0) { /* 0 or subnormal x */ - if ((lx | (hx & 0x7fffffff)) == 0) - return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx, x); - k = ((hx & 0x7ff00000) >> 20) - 54; - if (n < -50000) - return tiny * x; /* underflow */ - } - if (k == 0x7ff) - return x + x; /* NaN or Inf */ - k = k + n; - if (k > 0x7fe) - return huge_val * copysign(huge_val, x); /* overflow */ - if (k > 0) { /* normal result */ - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x; - } - if (k <= -54) { - if (n > 50000) /* in case integer overflow in n+k */ - return huge_val * copysign(huge_val, x); /* overflow */ - else - return tiny * copysign(tiny, x); /* underflow */ - } - k += 54; /* subnormal result */ - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x * twom54; -} + int32_t k, hx, lx; + EXTRACT_WORDS(hx, lx, x); + k = (hx & 0x7ff00000) >> 20; /* extract exponent */ + if (k == 0) { /* 0 or subnormal x */ + if ((lx | (hx & 0x7fffffff)) == 0) + return x; /* +-0 */ + x *= two54; + GET_HIGH_WORD(hx, x); + k = ((hx & 0x7ff00000) >> 20) - 54; + } + if (k == 0x7ff) + return x + x; /* NaN or Inf */ + k = k + n; + if (k > 0x7fe) + return huge * copysign(huge, x); /* overflow */ + if (n < -50000) + return tiny * copysign(tiny, x); /* underflow */ + if (k > 0) { /* normal result */ + SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); + return x; + } + if (k <= -54) { + if (n > 50000) /* in case integer overflow in n+k */ + return huge * copysign(huge, x); /* overflow */ + return tiny * copysign(tiny, x); /* underflow */ + } + k += 54; /* subnormal result */ + SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); + return x * twom54; +} +libm_hidden_def(scalbln) + + +double scalbn(double x, int n) +{ + return scalbln(x, n); +} libm_hidden_def(scalbn) diff --git a/Engine/lib/sdl/src/libm/s_sin.c b/Engine/lib/sdl/src/libm/s_sin.c index 771176619..b3cd7a0e3 100644 --- a/Engine/lib/sdl/src/libm/s_sin.c +++ b/Engine/lib/sdl/src/libm/s_sin.c @@ -1,4 +1,3 @@ -/* @(#)s_sin.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; -#endif - /* sin(x) * Return sine function of x. * @@ -49,43 +43,31 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(sin) -#ifdef __STDC__ - double sin(double x) -#else - double sin(x) - double x; -#endif +double sin(double x) { - double y[2], z = 0.0; - int32_t n, ix; + double y[2],z=0.0; + int32_t n, ix; /* High word of x. */ - GET_HIGH_WORD(ix, x); + GET_HIGH_WORD(ix,x); /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3fe921fb) - return __kernel_sin(x, z, 0); + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0); /* sin(Inf or NaN) is NaN */ - else if (ix >= 0x7ff00000) - return x - x; + else if (ix>=0x7ff00000) return x-x; /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x, y); - switch (n & 3) { - case 0: - return __kernel_sin(y[0], y[1], 1); - case 1: - return __kernel_cos(y[0], y[1]); - case 2: - return -__kernel_sin(y[0], y[1], 1); - default: - return -__kernel_cos(y[0], y[1]); - } - } + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_sin(y[0],y[1],1); + case 1: return __kernel_cos(y[0],y[1]); + case 2: return -__kernel_sin(y[0],y[1],1); + default: + return -__kernel_cos(y[0],y[1]); + } + } } - libm_hidden_def(sin) diff --git a/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c index 7b30b7735..18b4b8436 100644 --- a/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c +++ b/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c index 4f132f9f5..291c08b81 100644 --- a/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c +++ b/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c deleted file mode 100644 index 1336d9e18..000000000 --- a/Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_LOADSO_HAIKU - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* System dependent library loading routines */ - -#include -#include - -#include "SDL_loadso.h" - -void * -SDL_LoadObject(const char *sofile) -{ - void *handle = NULL; - image_id library_id = load_add_on(sofile); - if (library_id < 0) { - SDL_SetError(strerror((int) library_id)); - } else { - handle = (void *) (library_id); - } - return (handle); -} - -void * -SDL_LoadFunction(void *handle, const char *name) -{ - void *sym = NULL; - image_id library_id = (image_id) handle; - status_t rc = - get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym); - if (rc != B_NO_ERROR) { - SDL_SetError(strerror(rc)); - } - return (sym); -} - -void -SDL_UnloadObject(void *handle) -{ - image_id library_id; - if (handle != NULL) { - library_id = (image_id) handle; - unload_add_on(library_id); - } -} - -#endif /* SDL_LOADSO_HAIKU */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c index bdb2b9874..351570f92 100644 --- a/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c +++ b/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/main/android/SDL_android_main.c b/Engine/lib/sdl/src/main/android/SDL_android_main.c index 671d9328e..054738a9a 100644 --- a/Engine/lib/sdl/src/main/android/SDL_android_main.c +++ b/Engine/lib/sdl/src/main/android/SDL_android_main.c @@ -1,83 +1,7 @@ /* SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14 + + As of SDL 2.0.6 this file is no longer necessary. */ -#include "../../SDL_internal.h" - -#ifdef __ANDROID__ - -/* Include the SDL main definition header */ -#include "SDL_main.h" - -/******************************************************************************* - Functions called by JNI -*******************************************************************************/ -#include - -/* Called before SDL_main() to initialize JNI bindings in SDL library */ -extern void SDL_Android_Init(JNIEnv* env, jclass cls); - -/* This prototype is needed to prevent a warning about the missing prototype for global function below */ -JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array); - -/* Start up the SDL app */ -JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array) -{ - int i; - int argc; - int status; - int len; - char** argv; - - /* This interface could expand with ABI negotiation, callbacks, etc. */ - SDL_Android_Init(env, cls); - - SDL_SetMainReady(); - - /* Prepare the arguments. */ - - len = (*env)->GetArrayLength(env, array); - argv = SDL_stack_alloc(char*, 1 + len + 1); - argc = 0; - /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. - https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start - */ - argv[argc++] = SDL_strdup("app_process"); - for (i = 0; i < len; ++i) { - const char* utf; - char* arg = NULL; - jstring string = (*env)->GetObjectArrayElement(env, array, i); - if (string) { - utf = (*env)->GetStringUTFChars(env, string, 0); - if (utf) { - arg = SDL_strdup(utf); - (*env)->ReleaseStringUTFChars(env, string, utf); - } - (*env)->DeleteLocalRef(env, string); - } - if (!arg) { - arg = SDL_strdup(""); - } - argv[argc++] = arg; - } - argv[argc] = NULL; - - - /* Run the application. */ - - status = SDL_main(argc, argv); - - /* Release the arguments. */ - - for (i = 0; i < argc; ++i) { - SDL_free(argv[i]); - } - SDL_stack_free(argv); - /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ - /* exit(status); */ - - return status; -} - -#endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h index 9672d462c..ba3f9271c 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h +++ b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,9 @@ #define SDL_BAPP_H #include +#if SDL_VIDEO_OPENGL #include +#endif #include "../../video/haiku/SDL_bkeyboard.h" @@ -37,7 +39,6 @@ extern "C" { /* Local includes */ #include "../../events/SDL_events_c.h" -#include "../../video/haiku/SDL_bkeyboard.h" #include "../../video/haiku/SDL_bframebuffer.h" #ifdef __cplusplus @@ -81,7 +82,9 @@ class SDL_BApp : public BApplication { public: SDL_BApp(const char* signature) : BApplication(signature) { +#if SDL_VIDEO_OPENGL _current_context = NULL; +#endif } @@ -189,6 +192,7 @@ public: return _window_map[winID]; } +#if SDL_VIDEO_OPENGL void SetCurrentContext(BGLView *newContext) { if(_current_context) _current_context->UnlockGL(); @@ -196,6 +200,8 @@ public: if (_current_context) _current_context->LockGL(); } +#endif + private: /* Event management */ void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) { @@ -385,8 +391,9 @@ private: /* Members */ std::vector _window_map; /* Keeps track of SDL_Windows by index-id */ - display_mode *_saved_mode; +#if SDL_VIDEO_OPENGL BGLView *_current_context; +#endif }; #endif diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc index 4c5df0954..f4ee17951 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc +++ b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,10 @@ /* Handle the BeApp specific portions of the application */ #include +#include #include #include +#include #include #include "SDL_BApp.h" /* SDL_BApp class definition */ @@ -43,7 +45,7 @@ extern "C" { #include "../../thread/SDL_systhread.h" /* Flag to tell whether or not the Be application is active or not */ -int SDL_BeAppActive = 0; +static int SDL_BeAppActive = 0; static SDL_Thread *SDL_AppThread = NULL; static int @@ -51,7 +53,24 @@ StartBeApp(void *unused) { BApplication *App; - App = new SDL_BApp("application/x-SDL-executable"); + // default application signature + const char *signature = "application/x-SDL-executable"; + // dig resources for correct signature + image_info info; + int32 cookie = 0; + if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + BFile f(info.name, O_RDONLY); + if (f.InitCheck() == B_OK) { + BAppFileInfo app_info(&f); + if (app_info.InitCheck() == B_OK) { + char sig[B_MIME_TYPE_LENGTH]; + if (app_info.GetSignature(sig) == B_OK) + signature = strndup(sig, B_MIME_TYPE_LENGTH); + } + } + } + + App = new SDL_BApp(signature); App->Run(); delete App; diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h index 6700a3be9..83a2beb34 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h +++ b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,8 +31,6 @@ extern int SDL_InitBeApp(void); /* Quit the Be Application, if there's nothing left to do */ extern void SDL_QuitBeApp(void); -/* Flag to tell whether the app is active or not */ -extern int SDL_BeAppActive; /* vi: set ts=4 sw=4 expandtab: */ #ifdef __cplusplus diff --git a/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c b/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c index 4c01d0fba..af66bdb7d 100644 --- a/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c +++ b/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/main/windows/SDL_windows_main.c b/Engine/lib/sdl/src/main/windows/SDL_windows_main.c index b502ed50e..5e643a44b 100644 --- a/Engine/lib/sdl/src/main/windows/SDL_windows_main.c +++ b/Engine/lib/sdl/src/main/windows/SDL_windows_main.c @@ -51,7 +51,7 @@ ParseCommandLine(char *cmdline, char **argv) argc = last_argc = 0; for (bufp = cmdline; *bufp;) { /* Skip leading whitespace */ - while (SDL_isspace(*bufp)) { + while (*bufp == ' ' || *bufp == '\t') { ++bufp; } /* Skip over argument */ @@ -77,7 +77,7 @@ ParseCommandLine(char *cmdline, char **argv) ++argc; } /* Skip over word */ - while (*bufp && !SDL_isspace(*bufp)) { + while (*bufp && (*bufp != ' ' && *bufp != '\t')) { ++bufp; } } diff --git a/Engine/lib/sdl/src/main/windows/version.rc b/Engine/lib/sdl/src/main/windows/version.rc index e10443b06..6d16ad57d 100644 --- a/Engine/lib/sdl/src/main/windows/version.rc +++ b/Engine/lib/sdl/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,5,0 - PRODUCTVERSION 2,0,5,0 + FILEVERSION 2,0,8,0 + PRODUCTVERSION 2,0,8,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 5, 0\0" + VALUE "FileVersion", "2, 0, 8, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright © 2016 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright © 2018 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 0, 5, 0\0" + VALUE "ProductVersion", "2, 0, 8, 0\0" END END BLOCK "VarFileInfo" diff --git a/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp b/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp index ce5e82473..19d22504c 100644 --- a/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp +++ b/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp @@ -50,10 +50,5 @@ int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { - if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) { - return 1; - } - - SDL_WinRTRunApp(SDL_main, NULL); - return 0; + return SDL_WinRTRunApp(SDL_main, NULL); } diff --git a/Engine/lib/sdl/src/power/SDL_power.c b/Engine/lib/sdl/src/power/SDL_power.c index 016013b97..e09e27ba2 100644 --- a/Engine/lib/sdl/src/power/SDL_power.c +++ b/Engine/lib/sdl/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ */ #include "../SDL_internal.h" #include "SDL_power.h" +#include "SDL_syspower.h" /* * Returns SDL_TRUE if we have a definitive answer. @@ -29,18 +30,6 @@ typedef SDL_bool (*SDL_GetPowerInfo_Impl) (SDL_PowerState * state, int *seconds, int *percent); -SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); - #ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_HARDWIRED /* This is for things that _never_ have a battery */ @@ -59,6 +48,7 @@ SDL_GetPowerInfo_Hardwired(SDL_PowerState * state, int *seconds, int *percent) static SDL_GetPowerInfo_Impl implementations[] = { #ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */ + SDL_GetPowerInfo_Linux_org_freedesktop_upower, SDL_GetPowerInfo_Linux_sys_class_power_supply, SDL_GetPowerInfo_Linux_proc_acpi, SDL_GetPowerInfo_Linux_proc_apm, diff --git a/Engine/lib/sdl/src/power/SDL_syspower.h b/Engine/lib/sdl/src/power/SDL_syspower.h new file mode 100644 index 000000000..a9bf70cfc --- /dev/null +++ b/Engine/lib/sdl/src/power/SDL_syspower.h @@ -0,0 +1,47 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* These are functions that need to be implemented by a port of SDL */ + +#ifndef SDL_syspower_h_ +#define SDL_syspower_h_ + +#include "SDL_power.h" + +/* Not all of these are available in a given build. Use #ifdefs, etc. */ +SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *); + +#endif /* SDL_syspower_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/power/android/SDL_syspower.c b/Engine/lib/sdl/src/power/android/SDL_syspower.c index 5a4b0fc14..f0f492de3 100644 --- a/Engine/lib/sdl/src/power/android/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/android/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #if SDL_POWER_ANDROID #include "SDL_power.h" +#include "../SDL_syspower.h" #include "../../core/android/SDL_android.h" diff --git a/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c b/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c index 307f79742..9b921685b 100644 --- a/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/haiku/SDL_syspower.c b/Engine/lib/sdl/src/power/haiku/SDL_syspower.c index cfda8c962..47961bb2a 100644 --- a/Engine/lib/sdl/src/power/haiku/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/haiku/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,9 @@ */ #include "../../SDL_internal.h" +/* uses BeOS euc.jp apm driver. */ /* !!! FIXME: does this thing even work on Haiku? */ + #ifndef SDL_POWER_DISABLED #if SDL_POWER_HAIKU diff --git a/Engine/lib/sdl/src/power/linux/SDL_syspower.c b/Engine/lib/sdl/src/power/linux/SDL_syspower.c index 793e26669..105d5fe7f 100644 --- a/Engine/lib/sdl/src/power/linux/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,9 @@ #include #include "SDL_power.h" +#include "../SDL_syspower.h" + +#include "../../core/linux/SDL_dbus.h" static const char *proc_apm_path = "/proc/apm"; static const char *proc_acpi_battery_path = "/proc/acpi/battery"; @@ -425,8 +428,6 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState * state, return SDL_TRUE; } -/* !!! FIXME: implement d-bus queries to org.freedesktop.UPower. */ - SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent) { @@ -459,6 +460,16 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second continue; /* we don't care about UPS and such. */ } + /* if the scope is "device," it might be something like a PS4 + controller reporting its own battery, and not something that powers + the system. Most system batteries don't list a scope at all; we + assume it's a system battery if not specified. */ + if (read_power_file(base, name, "scope", str, sizeof (str))) { + if (SDL_strcmp(str, "device\n") == 0) { + continue; /* skip external devices with their own batteries. */ + } + } + /* some drivers don't offer this, so if it's not explicitly reported assume it's present. */ if (read_power_file(base, name, "present", str, sizeof (str)) && (SDL_strcmp(str, "0\n") == 0)) { st = SDL_POWERSTATE_NO_BATTERY; @@ -513,6 +524,118 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second return SDL_TRUE; /* don't look any further. */ } + +/* d-bus queries to org.freedesktop.UPower. */ +#if SDL_USE_LIBDBUS +#define UPOWER_DBUS_NODE "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DEVICE_DBUS_INTERFACE "org.freedesktop.UPower.Device" + +static void +check_upower_device(DBusConnection *conn, const char *path, SDL_PowerState *state, int *seconds, int *percent) +{ + SDL_bool choose = SDL_FALSE; + SDL_PowerState st; + int secs; + int pct; + Uint32 ui32 = 0; + Sint64 si64 = 0; + double d = 0.0; + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Type", DBUS_TYPE_UINT32, &ui32)) { + return; /* Don't know _what_ we're looking at. Give up on it. */ + } else if (ui32 != 2) { /* 2==Battery*/ + return; /* we don't care about UPS and such. */ + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "PowerSupply", DBUS_TYPE_BOOLEAN, &ui32)) { + return; + } else if (!ui32) { + return; /* we don't care about random devices with batteries, like wireless controllers, etc */ + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) { + return; + } else if (!ui32) { + st = SDL_POWERSTATE_NO_BATTERY; + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } else if (ui32 == 1) { /* 1 == charging */ + st = SDL_POWERSTATE_CHARGING; + } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ + st = SDL_POWERSTATE_ON_BATTERY; + } else if (ui32 == 4) { /* 4 == full */ + st = SDL_POWERSTATE_CHARGED; + } else { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Percentage", DBUS_TYPE_DOUBLE, &d)) { + pct = -1; /* some old/cheap batteries don't set this property. */ + } else { + pct = (int) d; + pct = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */ + } + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "TimeToEmpty", DBUS_TYPE_INT64, &si64)) { + secs = -1; + } else { + secs = (int) si64; + secs = (secs <= 0) ? -1 : secs; /* 0 == unknown */ + } + + /* + * We pick the battery that claims to have the most minutes left. + * (failing a report of minutes, we'll take the highest percent.) + */ + if ((secs < 0) && (*seconds < 0)) { + if ((pct < 0) && (*percent < 0)) { + choose = SDL_TRUE; /* at least we know there's a battery. */ + } else if (pct > *percent) { + choose = SDL_TRUE; + } + } else if (secs > *seconds) { + choose = SDL_TRUE; + } + + if (choose) { + *seconds = secs; + *percent = pct; + *state = st; + } +} +#endif + +SDL_bool +SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent) +{ + SDL_bool retval = SDL_FALSE; + + #if SDL_USE_LIBDBUS + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + char **paths = NULL; + int i, numpaths = 0; + + if (!SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices", + DBUS_TYPE_INVALID, + DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) { + return SDL_FALSE; /* try a different approach than UPower. */ + } + + retval = SDL_TRUE; /* Clearly we can use this interface. */ + *state = SDL_POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */ + *seconds = -1; + *percent = -1; + + for (i = 0; i < numpaths; i++) { + check_upower_device(dbus->system_conn, paths[i], state, seconds, percent); + } + + if (dbus) { + dbus->free_string_array(paths); + } + #endif /* SDL_USE_LIBDBUS */ + + return retval; +} + #endif /* SDL_POWER_LINUX */ #endif /* SDL_POWER_DISABLED */ diff --git a/Engine/lib/sdl/src/power/macosx/SDL_syspower.c b/Engine/lib/sdl/src/power/macosx/SDL_syspower.c index f865d59ef..f28b6c8b5 100644 --- a/Engine/lib/sdl/src/power/macosx/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/psp/SDL_syspower.c b/Engine/lib/sdl/src/power/psp/SDL_syspower.c index 76c21b947..74585b2a6 100644 --- a/Engine/lib/sdl/src/power/psp/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/psp/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/uikit/SDL_syspower.h b/Engine/lib/sdl/src/power/uikit/SDL_syspower.h index 4cfa5c974..4a42fd235 100644 --- a/Engine/lib/sdl/src/power/uikit/SDL_syspower.h +++ b/Engine/lib/sdl/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/uikit/SDL_syspower.m b/Engine/lib/sdl/src/power/uikit/SDL_syspower.m index 7186b219c..cb8a25282 100644 --- a/Engine/lib/sdl/src/power/uikit/SDL_syspower.m +++ b/Engine/lib/sdl/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/windows/SDL_syspower.c b/Engine/lib/sdl/src/power/windows/SDL_syspower.c index ff3784ccf..be6c9d3c0 100644 --- a/Engine/lib/sdl/src/power/windows/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp b/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp index 94e5a2853..9f2c2ad63 100644 --- a/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp +++ b/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/SDL_d3dmath.c b/Engine/lib/sdl/src/render/SDL_d3dmath.c index 83d67bfa7..47eafb2f8 100644 --- a/Engine/lib/sdl/src/render/SDL_d3dmath.c +++ b/Engine/lib/sdl/src/render/SDL_d3dmath.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,32 +31,32 @@ Float4X4 MatrixIdentity() { Float4X4 m; SDL_zero(m); - m._11 = 1.0f; - m._22 = 1.0f; - m._33 = 1.0f; - m._44 = 1.0f; + m.v._11 = 1.0f; + m.v._22 = 1.0f; + m.v._33 = 1.0f; + m.v._44 = 1.0f; return m; } Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2) { Float4X4 m; - m._11 = M1._11 * M2._11 + M1._12 * M2._21 + M1._13 * M2._31 + M1._14 * M2._41; - m._12 = M1._11 * M2._12 + M1._12 * M2._22 + M1._13 * M2._32 + M1._14 * M2._42; - m._13 = M1._11 * M2._13 + M1._12 * M2._23 + M1._13 * M2._33 + M1._14 * M2._43; - m._14 = M1._11 * M2._14 + M1._12 * M2._24 + M1._13 * M2._34 + M1._14 * M2._44; - m._21 = M1._21 * M2._11 + M1._22 * M2._21 + M1._23 * M2._31 + M1._24 * M2._41; - m._22 = M1._21 * M2._12 + M1._22 * M2._22 + M1._23 * M2._32 + M1._24 * M2._42; - m._23 = M1._21 * M2._13 + M1._22 * M2._23 + M1._23 * M2._33 + M1._24 * M2._43; - m._24 = M1._21 * M2._14 + M1._22 * M2._24 + M1._23 * M2._34 + M1._24 * M2._44; - m._31 = M1._31 * M2._11 + M1._32 * M2._21 + M1._33 * M2._31 + M1._34 * M2._41; - m._32 = M1._31 * M2._12 + M1._32 * M2._22 + M1._33 * M2._32 + M1._34 * M2._42; - m._33 = M1._31 * M2._13 + M1._32 * M2._23 + M1._33 * M2._33 + M1._34 * M2._43; - m._34 = M1._31 * M2._14 + M1._32 * M2._24 + M1._33 * M2._34 + M1._34 * M2._44; - m._41 = M1._41 * M2._11 + M1._42 * M2._21 + M1._43 * M2._31 + M1._44 * M2._41; - m._42 = M1._41 * M2._12 + M1._42 * M2._22 + M1._43 * M2._32 + M1._44 * M2._42; - m._43 = M1._41 * M2._13 + M1._42 * M2._23 + M1._43 * M2._33 + M1._44 * M2._43; - m._44 = M1._41 * M2._14 + M1._42 * M2._24 + M1._43 * M2._34 + M1._44 * M2._44; + m.v._11 = M1.v._11 * M2.v._11 + M1.v._12 * M2.v._21 + M1.v._13 * M2.v._31 + M1.v._14 * M2.v._41; + m.v._12 = M1.v._11 * M2.v._12 + M1.v._12 * M2.v._22 + M1.v._13 * M2.v._32 + M1.v._14 * M2.v._42; + m.v._13 = M1.v._11 * M2.v._13 + M1.v._12 * M2.v._23 + M1.v._13 * M2.v._33 + M1.v._14 * M2.v._43; + m.v._14 = M1.v._11 * M2.v._14 + M1.v._12 * M2.v._24 + M1.v._13 * M2.v._34 + M1.v._14 * M2.v._44; + m.v._21 = M1.v._21 * M2.v._11 + M1.v._22 * M2.v._21 + M1.v._23 * M2.v._31 + M1.v._24 * M2.v._41; + m.v._22 = M1.v._21 * M2.v._12 + M1.v._22 * M2.v._22 + M1.v._23 * M2.v._32 + M1.v._24 * M2.v._42; + m.v._23 = M1.v._21 * M2.v._13 + M1.v._22 * M2.v._23 + M1.v._23 * M2.v._33 + M1.v._24 * M2.v._43; + m.v._24 = M1.v._21 * M2.v._14 + M1.v._22 * M2.v._24 + M1.v._23 * M2.v._34 + M1.v._24 * M2.v._44; + m.v._31 = M1.v._31 * M2.v._11 + M1.v._32 * M2.v._21 + M1.v._33 * M2.v._31 + M1.v._34 * M2.v._41; + m.v._32 = M1.v._31 * M2.v._12 + M1.v._32 * M2.v._22 + M1.v._33 * M2.v._32 + M1.v._34 * M2.v._42; + m.v._33 = M1.v._31 * M2.v._13 + M1.v._32 * M2.v._23 + M1.v._33 * M2.v._33 + M1.v._34 * M2.v._43; + m.v._34 = M1.v._31 * M2.v._14 + M1.v._32 * M2.v._24 + M1.v._33 * M2.v._34 + M1.v._34 * M2.v._44; + m.v._41 = M1.v._41 * M2.v._11 + M1.v._42 * M2.v._21 + M1.v._43 * M2.v._31 + M1.v._44 * M2.v._41; + m.v._42 = M1.v._41 * M2.v._12 + M1.v._42 * M2.v._22 + M1.v._43 * M2.v._32 + M1.v._44 * M2.v._42; + m.v._43 = M1.v._41 * M2.v._13 + M1.v._42 * M2.v._23 + M1.v._43 * M2.v._33 + M1.v._44 * M2.v._43; + m.v._44 = M1.v._41 * M2.v._14 + M1.v._42 * M2.v._24 + M1.v._43 * M2.v._34 + M1.v._44 * M2.v._44; return m; } @@ -64,10 +64,10 @@ Float4X4 MatrixScaling(float x, float y, float z) { Float4X4 m; SDL_zero(m); - m._11 = x; - m._22 = y; - m._33 = z; - m._44 = 1.0f; + m.v._11 = x; + m.v._22 = y; + m.v._33 = z; + m.v._44 = 1.0f; return m; } @@ -75,13 +75,13 @@ Float4X4 MatrixTranslation(float x, float y, float z) { Float4X4 m; SDL_zero(m); - m._11 = 1.0f; - m._22 = 1.0f; - m._33 = 1.0f; - m._44 = 1.0f; - m._41 = x; - m._42 = y; - m._43 = z; + m.v._11 = 1.0f; + m.v._22 = 1.0f; + m.v._33 = 1.0f; + m.v._44 = 1.0f; + m.v._41 = x; + m.v._42 = y; + m.v._43 = z; return m; } @@ -91,12 +91,12 @@ Float4X4 MatrixRotationX(float r) float cosR = SDL_cosf(r); Float4X4 m; SDL_zero(m); - m._11 = 1.0f; - m._22 = cosR; - m._23 = sinR; - m._32 = -sinR; - m._33 = cosR; - m._44 = 1.0f; + m.v._11 = 1.0f; + m.v._22 = cosR; + m.v._23 = sinR; + m.v._32 = -sinR; + m.v._33 = cosR; + m.v._44 = 1.0f; return m; } @@ -106,12 +106,12 @@ Float4X4 MatrixRotationY(float r) float cosR = SDL_cosf(r); Float4X4 m; SDL_zero(m); - m._11 = cosR; - m._13 = -sinR; - m._22 = 1.0f; - m._31 = sinR; - m._33 = cosR; - m._44 = 1.0f; + m.v._11 = cosR; + m.v._13 = -sinR; + m.v._22 = 1.0f; + m.v._31 = sinR; + m.v._33 = cosR; + m.v._44 = 1.0f; return m; } @@ -121,12 +121,12 @@ Float4X4 MatrixRotationZ(float r) float cosR = SDL_cosf(r); Float4X4 m; SDL_zero(m); - m._11 = cosR; - m._12 = sinR; - m._21 = -sinR; - m._22 = cosR; - m._33 = 1.0f; - m._44 = 1.0f; + m.v._11 = cosR; + m.v._12 = sinR; + m.v._21 = -sinR; + m.v._22 = cosR; + m.v._33 = 1.0f; + m.v._44 = 1.0f; return m; } diff --git a/Engine/lib/sdl/src/render/SDL_d3dmath.h b/Engine/lib/sdl/src/render/SDL_d3dmath.h index 87c44c7a3..8555a170b 100644 --- a/Engine/lib/sdl/src/render/SDL_d3dmath.h +++ b/Engine/lib/sdl/src/render/SDL_d3dmath.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ typedef struct float _21, _22, _23, _24; float _31, _32, _33, _34; float _41, _42, _43, _44; - }; + } v; float m[4][4]; }; } Float4X4; diff --git a/Engine/lib/sdl/src/render/SDL_render.c b/Engine/lib/sdl/src/render/SDL_render.c index 94750810d..8cd3a7bc1 100644 --- a/Engine/lib/sdl/src/render/SDL_render.c +++ b/Engine/lib/sdl/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,17 +33,44 @@ #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData" #define CHECK_RENDERER_MAGIC(renderer, retval) \ + SDL_assert(renderer && renderer->magic == &renderer_magic); \ if (!renderer || renderer->magic != &renderer_magic) { \ SDL_SetError("Invalid renderer"); \ return retval; \ } #define CHECK_TEXTURE_MAGIC(texture, retval) \ + SDL_assert(texture && texture->magic == &texture_magic); \ if (!texture || texture->magic != &texture_magic) { \ SDL_SetError("Invalid texture"); \ return retval; \ } +/* Predefined blend modes */ +#define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, \ + srcAlphaFactor, dstAlphaFactor, alphaOperation) \ + (SDL_BlendMode)(((Uint32)colorOperation << 0) | \ + ((Uint32)srcColorFactor << 4) | \ + ((Uint32)dstColorFactor << 8) | \ + ((Uint32)alphaOperation << 16) | \ + ((Uint32)srcAlphaFactor << 20) | \ + ((Uint32)dstAlphaFactor << 24)) + +#define SDL_BLENDMODE_NONE_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_BLEND_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_ADD_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_MOD_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_SRC_COLOR, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) #if !SDL_RENDER_DISABLED static const SDL_RenderDriver *render_drivers[] = { @@ -65,6 +92,9 @@ static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_DIRECTFB &DirectFB_RenderDriver, #endif +#if SDL_VIDEO_RENDER_METAL + &METAL_RenderDriver, +#endif #if SDL_VIDEO_RENDER_PSP &PSP_RenderDriver, #endif @@ -102,7 +132,7 @@ SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) #endif } -static int +static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) { SDL_Renderer *renderer = (SDL_Renderer *)userdata; @@ -168,31 +198,59 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) } else if (event->type == SDL_MOUSEMOTION) { SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID); if (renderer->logical_w && window == renderer->window) { - event->motion.x -= renderer->viewport.x; - event->motion.y -= renderer->viewport.y; - event->motion.x = (int)(event->motion.x / renderer->scale.x); - event->motion.y = (int)(event->motion.y / renderer->scale.y); + event->motion.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x); + event->motion.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y); + event->motion.x = (int)(event->motion.x / (renderer->scale.x * renderer->dpi_scale.x)); + event->motion.y = (int)(event->motion.y / (renderer->scale.y * renderer->dpi_scale.y)); if (event->motion.xrel > 0) { - event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / renderer->scale.x)); + event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x))); } else if (event->motion.xrel < 0) { - event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / renderer->scale.x)); + event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x))); } if (event->motion.yrel > 0) { - event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / renderer->scale.y)); + event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y))); } else if (event->motion.yrel < 0) { - event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / renderer->scale.y)); + event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y))); } } } else if (event->type == SDL_MOUSEBUTTONDOWN || event->type == SDL_MOUSEBUTTONUP) { SDL_Window *window = SDL_GetWindowFromID(event->button.windowID); if (renderer->logical_w && window == renderer->window) { - event->button.x -= renderer->viewport.x; - event->button.y -= renderer->viewport.y; - event->button.x = (int)(event->button.x / renderer->scale.x); - event->button.y = (int)(event->button.y / renderer->scale.y); + event->button.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x); + event->button.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y); + event->button.x = (int)(event->button.x / (renderer->scale.x * renderer->dpi_scale.x)); + event->button.y = (int)(event->button.y / (renderer->scale.y * renderer->dpi_scale.y)); + } + } else if (event->type == SDL_FINGERDOWN || + event->type == SDL_FINGERUP || + event->type == SDL_FINGERMOTION) { + if (renderer->logical_w) { + int w = 1; + int h = 1; + SDL_GetRendererOutputSize(renderer, &w, &h); + + event->tfinger.x *= (w - 1); + event->tfinger.y *= (h - 1); + + event->tfinger.x -= (renderer->viewport.x * renderer->dpi_scale.x); + event->tfinger.y -= (renderer->viewport.y * renderer->dpi_scale.y); + event->tfinger.x = (event->tfinger.x / (renderer->scale.x * renderer->dpi_scale.x)); + event->tfinger.y = (event->tfinger.y / (renderer->scale.y * renderer->dpi_scale.y)); + + if (renderer->logical_w > 1) { + event->tfinger.x = event->tfinger.x / (renderer->logical_w - 1); + } else { + event->tfinger.x = 0.5f; + } + if (renderer->logical_h > 1) { + event->tfinger.y = event->tfinger.y / (renderer->logical_h - 1); + } else { + event->tfinger.y = 0.5f; + } } } + return 0; } @@ -289,6 +347,18 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) renderer->window = window; renderer->scale.x = 1.0f; renderer->scale.y = 1.0f; + renderer->dpi_scale.x = 1.0f; + renderer->dpi_scale.y = 1.0f; + + if (window && renderer->GetOutputSize) { + int window_w, window_h; + int output_w, output_h; + if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) { + SDL_GetWindowSize(renderer->window, &window_w, &window_h); + renderer->dpi_scale.x = (float)window_w / output_w; + renderer->dpi_scale.y = (float)window_h / output_h; + } + } if (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN|SDL_WINDOW_MINIMIZED)) { renderer->hidden = SDL_TRUE; @@ -367,6 +437,23 @@ SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h) } } +static SDL_bool +IsSupportedBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + switch (blendMode) + { + /* These are required to be supported by all renderers */ + case SDL_BLENDMODE_NONE: + case SDL_BLENDMODE_BLEND: + case SDL_BLENDMODE_ADD: + case SDL_BLENDMODE_MOD: + return SDL_TRUE; + + default: + return renderer->SupportsBlendMode && renderer->SupportsBlendMode(renderer, blendMode); + } +} + static SDL_bool IsSupportedFormat(SDL_Renderer * renderer, Uint32 format) { @@ -694,6 +781,9 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode) CHECK_TEXTURE_MAGIC(texture, -1); renderer = texture->renderer; + if (!IsSupportedBlendMode(renderer, blendMode)) { + return SDL_Unsupported(); + } texture->blendMode = blendMode; if (texture->native) { return SDL_SetTextureBlendMode(texture->native, blendMode); @@ -734,8 +824,8 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect, if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -745,18 +835,18 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, + rect->w, rect->h, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, - rect->w, rect->h, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -767,10 +857,14 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect, { SDL_Texture *native = texture->native; + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -781,19 +875,19 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_ConvertPixels(rect->w, rect->h, + texture->format, pixels, pitch, + native->format, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_ConvertPixels(rect->w, rect->h, - texture->format, pixels, pitch, - native->format, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -853,10 +947,14 @@ SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect, full_rect.h = texture->h; rect = &full_rect; + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -866,18 +964,18 @@ SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, + rect->w, rect->h, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, - rect->w, rect->h, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -924,6 +1022,10 @@ int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect, rect = &full_rect; } + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->yuv) { return SDL_UpdateTextureYUVPlanar(texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); } else { @@ -1144,6 +1246,9 @@ UpdateLogicalSize(SDL_Renderer *renderer) float real_aspect; float scale; SDL_Rect viewport; + /* 0 is for letterbox, 1 is for overscan */ + int scale_policy = 0; + const char *hint; if (!renderer->logical_w || !renderer->logical_h) { return 0; @@ -1152,6 +1257,20 @@ UpdateLogicalSize(SDL_Renderer *renderer) return -1; } + hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE); + if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) { + SDL_bool overscan_supported = SDL_TRUE; + /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers + which the overscan implementation relies on. + */ + if (SDL_strcasecmp(SDL_GetCurrentVideoDriver(), "direct3d") == 0) { + overscan_supported = SDL_FALSE; + } + if (overscan_supported) { + scale_policy = 1; + } + } + want_aspect = (float)renderer->logical_w / renderer->logical_h; real_aspect = (float)w / h; @@ -1175,21 +1294,47 @@ UpdateLogicalSize(SDL_Renderer *renderer) scale = (float)w / renderer->logical_w; SDL_RenderSetViewport(renderer, NULL); } else if (want_aspect > real_aspect) { - /* We want a wider aspect ratio than is available - letterbox it */ - scale = (float)w / renderer->logical_w; - viewport.x = 0; - viewport.w = w; - viewport.h = (int)SDL_ceil(renderer->logical_h * scale); - viewport.y = (h - viewport.h) / 2; - SDL_RenderSetViewport(renderer, &viewport); + if (scale_policy == 1) { + /* We want a wider aspect ratio than is available - + zoom so logical height matches the real height + and the width will grow off the screen + */ + scale = (float)h / renderer->logical_h; + viewport.y = 0; + viewport.h = h; + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } else { + /* We want a wider aspect ratio than is available - letterbox it */ + scale = (float)w / renderer->logical_w; + viewport.x = 0; + viewport.w = w; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } } else { - /* We want a narrower aspect ratio than is available - use side-bars */ - scale = (float)h / renderer->logical_h; - viewport.y = 0; - viewport.h = h; - viewport.w = (int)SDL_ceil(renderer->logical_w * scale); - viewport.x = (w - viewport.w) / 2; - SDL_RenderSetViewport(renderer, &viewport); + if (scale_policy == 1) { + /* We want a narrower aspect ratio than is available - + zoom so logical width matches the real width + and the height will grow off the screen + */ + scale = (float)w / renderer->logical_w; + viewport.x = 0; + viewport.w = w; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } else { + /* We want a narrower aspect ratio than is available - use side-bars */ + scale = (float)h / renderer->logical_h; + viewport.y = 0; + viewport.h = h; + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } } /* Set the new scale */ @@ -1382,6 +1527,9 @@ SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { CHECK_RENDERER_MAGIC(renderer, -1); + if (!IsSupportedBlendMode(renderer, blendMode)) { + return SDL_Unsupported(); + } renderer->blendMode = blendMode; return 0; } @@ -1926,7 +2074,9 @@ SDL_DestroyRenderer(SDL_Renderer * renderer) /* Free existing textures for this renderer */ while (renderer->textures) { + SDL_Texture *tex = renderer->textures; (void) tex; SDL_DestroyTexture(renderer->textures); + SDL_assert(tex != renderer->textures); /* satisfy static analysis. */ } if (renderer->window) { @@ -1970,4 +2120,115 @@ int SDL_GL_UnbindTexture(SDL_Texture *texture) return SDL_Unsupported(); } +void * +SDL_RenderGetMetalLayer(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, NULL); + + if (renderer->GetMetalLayer) { + return renderer->GetMetalLayer(renderer); + } + return NULL; +} + +void * +SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, NULL); + + if (renderer->GetMetalCommandEncoder) { + return renderer->GetMetalCommandEncoder(renderer); + } + return NULL; +} + +static SDL_BlendMode +SDL_GetShortBlendMode(SDL_BlendMode blendMode) +{ + if (blendMode == SDL_BLENDMODE_NONE_FULL) { + return SDL_BLENDMODE_NONE; + } + if (blendMode == SDL_BLENDMODE_BLEND_FULL) { + return SDL_BLENDMODE_BLEND; + } + if (blendMode == SDL_BLENDMODE_ADD_FULL) { + return SDL_BLENDMODE_ADD; + } + if (blendMode == SDL_BLENDMODE_MOD_FULL) { + return SDL_BLENDMODE_MOD; + } + return blendMode; +} + +static SDL_BlendMode +SDL_GetLongBlendMode(SDL_BlendMode blendMode) +{ + if (blendMode == SDL_BLENDMODE_NONE) { + return SDL_BLENDMODE_NONE_FULL; + } + if (blendMode == SDL_BLENDMODE_BLEND) { + return SDL_BLENDMODE_BLEND_FULL; + } + if (blendMode == SDL_BLENDMODE_ADD) { + return SDL_BLENDMODE_ADD_FULL; + } + if (blendMode == SDL_BLENDMODE_MOD) { + return SDL_BLENDMODE_MOD_FULL; + } + return blendMode; +} + +SDL_BlendMode +SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation) +{ + SDL_BlendMode blendMode = SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, + srcAlphaFactor, dstAlphaFactor, alphaOperation); + return SDL_GetShortBlendMode(blendMode); +} + +SDL_BlendFactor +SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 4) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 8) & 0xF); +} + +SDL_BlendOperation +SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendOperation)(((Uint32)blendMode >> 0) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 20) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 24) & 0xF); +} + +SDL_BlendOperation +SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendOperation)(((Uint32)blendMode >> 16) & 0xF); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/SDL_sysrender.h b/Engine/lib/sdl/src/render/SDL_sysrender.h index 378fc4d97..f0f54c883 100644 --- a/Engine/lib/sdl/src/render/SDL_sysrender.h +++ b/Engine/lib/sdl/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysrender_h -#define _SDL_sysrender_h +#ifndef SDL_sysrender_h_ +#define SDL_sysrender_h_ #include "SDL_render.h" #include "SDL_events.h" @@ -79,6 +79,7 @@ struct SDL_Renderer void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event); int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h); + SDL_bool (*SupportsBlendMode)(SDL_Renderer * renderer, SDL_BlendMode blendMode); int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture); int (*SetTextureColorMod) (SDL_Renderer * renderer, SDL_Texture * texture); @@ -122,6 +123,9 @@ struct SDL_Renderer int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh); int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture); + void *(*GetMetalLayer) (SDL_Renderer * renderer); + void *(*GetMetalCommandEncoder) (SDL_Renderer * renderer); + /* The current renderer info */ SDL_RendererInfo info; @@ -154,6 +158,9 @@ struct SDL_Renderer SDL_FPoint scale; SDL_FPoint scale_backup; + /* The pixel to point coordinate scale */ + SDL_FPoint dpi_scale; + /* The list of textures */ SDL_Texture *textures; SDL_Texture *target; @@ -173,33 +180,25 @@ struct SDL_RenderDriver SDL_RendererInfo info; }; -#if !SDL_RENDER_DISABLED - -#if SDL_VIDEO_RENDER_D3D +/* Not all of these are available in a given build. Use #ifdefs, etc. */ extern SDL_RenderDriver D3D_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_D3D11 extern SDL_RenderDriver D3D11_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL extern SDL_RenderDriver GL_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL_ES2 extern SDL_RenderDriver GLES2_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL_ES extern SDL_RenderDriver GLES_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_DIRECTFB extern SDL_RenderDriver DirectFB_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_PSP +extern SDL_RenderDriver METAL_RenderDriver; extern SDL_RenderDriver PSP_RenderDriver; -#endif extern SDL_RenderDriver SW_RenderDriver; -#endif /* !SDL_RENDER_DISABLED */ +/* Blend mode functions */ +extern SDL_BlendFactor SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode); +extern SDL_BlendOperation SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode); +extern SDL_BlendOperation SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode); -#endif /* _SDL_sysrender_h */ +#endif /* SDL_sysrender_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/SDL_yuv_mmx.c b/Engine/lib/sdl/src/render/SDL_yuv_mmx.c deleted file mode 100644 index 0de776a36..000000000 --- a/Engine/lib/sdl/src/render/SDL_yuv_mmx.c +++ /dev/null @@ -1,431 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - -#include "SDL_stdinc.h" - -#include "mmx.h" - -/* *INDENT-OFF* */ - -static mmx_t MMX_0080w = { .ud = {0x00800080, 0x00800080} }; -static mmx_t MMX_00FFw = { .ud = {0x00ff00ff, 0x00ff00ff} }; -static mmx_t MMX_FF00w = { .ud = {0xff00ff00, 0xff00ff00} }; - -static mmx_t MMX_Ycoeff = { .uw = {0x004a, 0x004a, 0x004a, 0x004a} }; - -static mmx_t MMX_UbluRGB = { .uw = {0x0072, 0x0072, 0x0072, 0x0072} }; -static mmx_t MMX_VredRGB = { .uw = {0x0059, 0x0059, 0x0059, 0x0059} }; -static mmx_t MMX_UgrnRGB = { .uw = {0xffea, 0xffea, 0xffea, 0xffea} }; -static mmx_t MMX_VgrnRGB = { .uw = {0xffd2, 0xffd2, 0xffd2, 0xffd2} }; - -static mmx_t MMX_Ublu5x5 = { .uw = {0x0081, 0x0081, 0x0081, 0x0081} }; -static mmx_t MMX_Vred5x5 = { .uw = {0x0066, 0x0066, 0x0066, 0x0066} }; -static mmx_t MMX_Ugrn565 = { .uw = {0xffe8, 0xffe8, 0xffe8, 0xffe8} }; -static mmx_t MMX_Vgrn565 = { .uw = {0xffcd, 0xffcd, 0xffcd, 0xffcd} }; - -static mmx_t MMX_red565 = { .uw = {0xf800, 0xf800, 0xf800, 0xf800} }; -static mmx_t MMX_grn565 = { .uw = {0x07e0, 0x07e0, 0x07e0, 0x07e0} }; - -/** - This MMX assembler is my first assembler/MMX program ever. - Thus it maybe buggy. - Send patches to: - mvogt@rhrk.uni-kl.de - - After it worked fine I have "obfuscated" the code a bit to have - more parallism in the MMX units. This means I moved - initilisation around and delayed other instruction. - Performance measurement did not show that this brought any advantage - but in theory it _should_ be faster this way. - - The overall performanve gain to the C based dither was 30%-40%. - The MMX routine calculates 256bit=8RGB values in each cycle - (4 for row1 & 4 for row2) - - The red/green/blue.. coefficents are taken from the mpeg_play - player. They look nice, but I dont know if you can have - better values, to avoid integer rounding errors. - - - IMPORTANT: - ========== - - It is a requirement that the cr/cb/lum are 8 byte aligned and - the out are 16byte aligned or you will/may get segfaults - -*/ - -void ColorRGBDitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod ) -{ - Uint32 *row1; - Uint32 *row2; - - unsigned char* y = lum +cols*rows; /* Pointer to the end */ - int x = 0; - row1 = (Uint32 *)out; /* 32 bit target */ - row2 = (Uint32 *)out+cols+mod; /* start of second row */ - mod = (mod+cols+mod)*4; /* increment for row1 in byte */ - - __asm__ __volatile__ ( - /* tap dance to workaround the inability to use %%ebx at will... */ - /* move one thing to the stack... */ - "pushl $0\n" /* save a slot on the stack. */ - "pushl %%ebx\n" /* save %%ebx. */ - "movl %0, %%ebx\n" /* put the thing in ebx. */ - "movl %%ebx,4(%%esp)\n" /* put the thing in the stack slot. */ - "popl %%ebx\n" /* get back %%ebx (the PIC register). */ - - ".align 8\n" - "1:\n" - - /* create Cr (result in mm1) */ - "pushl %%ebx\n" - "movl 4(%%esp),%%ebx\n" - "movd (%%ebx),%%mm1\n" /* 0 0 0 0 v3 v2 v1 v0 */ - "popl %%ebx\n" - "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */ - "movd (%2), %%mm2\n" /* 0 0 0 0 l3 l2 l1 l0 */ - "punpcklbw %%mm7,%%mm1\n" /* 0 v3 0 v2 00 v1 00 v0 */ - "punpckldq %%mm1,%%mm1\n" /* 00 v1 00 v0 00 v1 00 v0 */ - "psubw %9,%%mm1\n" /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */ - - /* create Cr_g (result in mm0) */ - "movq %%mm1,%%mm0\n" /* r1 r1 r0 r0 r1 r1 r0 r0 */ - "pmullw %10,%%mm0\n" /* red*-46dec=0.7136*64 */ - "pmullw %11,%%mm1\n" /* red*89dec=1.4013*64 */ - "psraw $6, %%mm0\n" /* red=red/64 */ - "psraw $6, %%mm1\n" /* red=red/64 */ - - /* create L1 L2 (result in mm2,mm4) */ - /* L2=lum+cols */ - "movq (%2,%4),%%mm3\n" /* 0 0 0 0 L3 L2 L1 L0 */ - "punpckldq %%mm3,%%mm2\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */ - "movq %%mm2,%%mm4\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */ - "pand %12,%%mm2\n" /* L3 0 L1 0 l3 0 l1 0 */ - "pand %13,%%mm4\n" /* 0 L2 0 L0 0 l2 0 l0 */ - "psrlw $8,%%mm2\n" /* 0 L3 0 L1 0 l3 0 l1 */ - - /* create R (result in mm6) */ - "movq %%mm2,%%mm5\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm6\n" /* 0 L2 0 L0 0 l2 0 l0 */ - "paddsw %%mm1, %%mm5\n" /* lum1+red:x R3 x R1 x r3 x r1 */ - "paddsw %%mm1, %%mm6\n" /* lum1+red:x R2 x R0 x r2 x r0 */ - "packuswb %%mm5,%%mm5\n" /* R3 R1 r3 r1 R3 R1 r3 r1 */ - "packuswb %%mm6,%%mm6\n" /* R2 R0 r2 r0 R2 R0 r2 r0 */ - "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */ - "punpcklbw %%mm5,%%mm6\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */ - - /* create Cb (result in mm1) */ - "movd (%1), %%mm1\n" /* 0 0 0 0 u3 u2 u1 u0 */ - "punpcklbw %%mm7,%%mm1\n" /* 0 u3 0 u2 00 u1 00 u0 */ - "punpckldq %%mm1,%%mm1\n" /* 00 u1 00 u0 00 u1 00 u0 */ - "psubw %9,%%mm1\n" /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */ - - /* create Cb_g (result in mm5) */ - "movq %%mm1,%%mm5\n" /* u1 u1 u0 u0 u1 u1 u0 u0 */ - "pmullw %14,%%mm5\n" /* blue*-109dec=1.7129*64 */ - "pmullw %15,%%mm1\n" /* blue*114dec=1.78125*64 */ - "psraw $6, %%mm5\n" /* blue=red/64 */ - "psraw $6, %%mm1\n" /* blue=blue/64 */ - - /* create G (result in mm7) */ - "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm7\n" /* 0 L2 0 L0 0 l2 0 l1 */ - "paddsw %%mm5, %%mm3\n" /* lum1+Cb_g:x G3t x G1t x g3t x g1t */ - "paddsw %%mm5, %%mm7\n" /* lum1+Cb_g:x G2t x G0t x g2t x g0t */ - "paddsw %%mm0, %%mm3\n" /* lum1+Cr_g:x G3 x G1 x g3 x g1 */ - "paddsw %%mm0, %%mm7\n" /* lum1+blue:x G2 x G0 x g2 x g0 */ - "packuswb %%mm3,%%mm3\n" /* G3 G1 g3 g1 G3 G1 g3 g1 */ - "packuswb %%mm7,%%mm7\n" /* G2 G0 g2 g0 G2 G0 g2 g0 */ - "punpcklbw %%mm3,%%mm7\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */ - - /* create B (result in mm5) */ - "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm5\n" /* 0 L2 0 L0 0 l2 0 l1 */ - "paddsw %%mm1, %%mm3\n" /* lum1+blue:x B3 x B1 x b3 x b1 */ - "paddsw %%mm1, %%mm5\n" /* lum1+blue:x B2 x B0 x b2 x b0 */ - "packuswb %%mm3,%%mm3\n" /* B3 B1 b3 b1 B3 B1 b3 b1 */ - "packuswb %%mm5,%%mm5\n" /* B2 B0 b2 b0 B2 B0 b2 b0 */ - "punpcklbw %%mm3,%%mm5\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */ - - /* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "pxor %%mm4,%%mm4\n" /* 0 0 0 0 0 0 0 0 */ - "movq %%mm6,%%mm1\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */ - "movq %%mm5,%%mm3\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */ - - /* process lower lum */ - "punpcklbw %%mm4,%%mm1\n" /* 0 r3 0 r2 0 r1 0 r0 */ - "punpcklbw %%mm4,%%mm3\n" /* 0 b3 0 b2 0 b1 0 b0 */ - "movq %%mm1,%%mm2\n" /* 0 r3 0 r2 0 r1 0 r0 */ - "movq %%mm3,%%mm0\n" /* 0 b3 0 b2 0 b1 0 b0 */ - "punpcklwd %%mm1,%%mm3\n" /* 0 r1 0 b1 0 r0 0 b0 */ - "punpckhwd %%mm2,%%mm0\n" /* 0 r3 0 b3 0 r2 0 b2 */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "movq %%mm7,%%mm1\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */ - "punpcklbw %%mm1,%%mm2\n" /* g3 0 g2 0 g1 0 g0 0 */ - "punpcklwd %%mm4,%%mm2\n" /* 0 0 g1 0 0 0 g0 0 */ - "por %%mm3, %%mm2\n" /* 0 r1 g1 b1 0 r0 g0 b0 */ - "movq %%mm2,(%3)\n" /* wrote out ! row1 */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "punpcklbw %%mm1,%%mm4\n" /* g3 0 g2 0 g1 0 g0 0 */ - "punpckhwd %%mm2,%%mm4\n" /* 0 0 g3 0 0 0 g2 0 */ - "por %%mm0, %%mm4\n" /* 0 r3 g3 b3 0 r2 g2 b2 */ - "movq %%mm4,8(%3)\n" /* wrote out ! row1 */ - - /* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */ - /* this can be done "destructive" */ - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "punpckhbw %%mm2,%%mm6\n" /* 0 R3 0 R2 0 R1 0 R0 */ - "punpckhbw %%mm1,%%mm5\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */ - "movq %%mm5,%%mm1\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */ - "punpcklwd %%mm6,%%mm1\n" /* 0 R1 G1 B1 0 R0 G0 B0 */ - "movq %%mm1,(%5)\n" /* wrote out ! row2 */ - "punpckhwd %%mm6,%%mm5\n" /* 0 R3 G3 B3 0 R2 G2 B2 */ - "movq %%mm5,8(%5)\n" /* wrote out ! row2 */ - - "addl $4,%2\n" /* lum+4 */ - "leal 16(%3),%3\n" /* row1+16 */ - "leal 16(%5),%5\n" /* row2+16 */ - "addl $2,(%%esp)\n" /* cr+2 */ - "addl $2,%1\n" /* cb+2 */ - - "addl $4,%6\n" /* x+4 */ - "cmpl %4,%6\n" - - "jl 1b\n" - "addl %4,%2\n" /* lum += cols */ - "addl %8,%3\n" /* row1+= mod */ - "addl %8,%5\n" /* row2+= mod */ - "movl $0,%6\n" /* x=0 */ - "cmpl %7,%2\n" - "jl 1b\n" - - "addl $4,%%esp\n" /* get rid of the stack slot we reserved. */ - "emms\n" /* reset MMX registers. */ - : - : "m" (cr), "r"(cb),"r"(lum), - "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), - "m"(MMX_0080w),"m"(MMX_VgrnRGB),"m"(MMX_VredRGB), - "m"(MMX_FF00w),"m"(MMX_00FFw),"m"(MMX_UgrnRGB), - "m"(MMX_UbluRGB) - ); -} - -void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod ) -{ - Uint16 *row1; - Uint16 *row2; - - unsigned char* y = lum +cols*rows; /* Pointer to the end */ - int x = 0; - row1 = (Uint16 *)out; /* 16 bit target */ - row2 = (Uint16 *)out+cols+mod; /* start of second row */ - mod = (mod+cols+mod)*2; /* increment for row1 in byte */ - - __asm__ __volatile__( - /* tap dance to workaround the inability to use %%ebx at will... */ - /* move one thing to the stack... */ - "pushl $0\n" /* save a slot on the stack. */ - "pushl %%ebx\n" /* save %%ebx. */ - "movl %0, %%ebx\n" /* put the thing in ebx. */ - "movl %%ebx, 4(%%esp)\n" /* put the thing in the stack slot. */ - "popl %%ebx\n" /* get back %%ebx (the PIC register). */ - - ".align 8\n" - "1:\n" - - "movd (%1), %%mm0\n" /* 4 Cb 0 0 0 0 u3 u2 u1 u0 */ - "pxor %%mm7, %%mm7\n" - "pushl %%ebx\n" - "movl 4(%%esp), %%ebx\n" - "movd (%%ebx), %%mm1\n" /* 4 Cr 0 0 0 0 v3 v2 v1 v0 */ - "popl %%ebx\n" - - "punpcklbw %%mm7, %%mm0\n" /* 4 W cb 0 u3 0 u2 0 u1 0 u0 */ - "punpcklbw %%mm7, %%mm1\n" /* 4 W cr 0 v3 0 v2 0 v1 0 v0 */ - "psubw %9, %%mm0\n" - "psubw %9, %%mm1\n" - "movq %%mm0, %%mm2\n" /* Cb 0 u3 0 u2 0 u1 0 u0 */ - "movq %%mm1, %%mm3\n" /* Cr */ - "pmullw %10, %%mm2\n" /* Cb2green 0 R3 0 R2 0 R1 0 R0 */ - "movq (%2), %%mm6\n" /* L1 l7 L6 L5 L4 L3 L2 L1 L0 */ - "pmullw %11, %%mm0\n" /* Cb2blue */ - "pand %12, %%mm6\n" /* L1 00 L6 00 L4 00 L2 00 L0 */ - "pmullw %13, %%mm3\n" /* Cr2green */ - "movq (%2), %%mm7\n" /* L2 */ - "pmullw %14, %%mm1\n" /* Cr2red */ - "psrlw $8, %%mm7\n" /* L2 00 L7 00 L5 00 L3 00 L1 */ - "pmullw %15, %%mm6\n" /* lum1 */ - "paddw %%mm3, %%mm2\n" /* Cb2green + Cr2green == green */ - "pmullw %15, %%mm7\n" /* lum2 */ - - "movq %%mm6, %%mm4\n" /* lum1 */ - "paddw %%mm0, %%mm6\n" /* lum1 +blue 00 B6 00 B4 00 B2 00 B0 */ - "movq %%mm4, %%mm5\n" /* lum1 */ - "paddw %%mm1, %%mm4\n" /* lum1 +red 00 R6 00 R4 00 R2 00 R0 */ - "paddw %%mm2, %%mm5\n" /* lum1 +green 00 G6 00 G4 00 G2 00 G0 */ - "psraw $6, %%mm4\n" /* R1 0 .. 64 */ - "movq %%mm7, %%mm3\n" /* lum2 00 L7 00 L5 00 L3 00 L1 */ - "psraw $6, %%mm5\n" /* G1 - .. + */ - "paddw %%mm0, %%mm7\n" /* Lum2 +blue 00 B7 00 B5 00 B3 00 B1 */ - "psraw $6, %%mm6\n" /* B1 0 .. 64 */ - "packuswb %%mm4, %%mm4\n" /* R1 R1 */ - "packuswb %%mm5, %%mm5\n" /* G1 G1 */ - "packuswb %%mm6, %%mm6\n" /* B1 B1 */ - "punpcklbw %%mm4, %%mm4\n" - "punpcklbw %%mm5, %%mm5\n" - - "pand %16, %%mm4\n" - "psllw $3, %%mm5\n" /* GREEN 1 */ - "punpcklbw %%mm6, %%mm6\n" - "pand %17, %%mm5\n" - "pand %16, %%mm6\n" - "por %%mm5, %%mm4\n" /* */ - "psrlw $11, %%mm6\n" /* BLUE 1 */ - "movq %%mm3, %%mm5\n" /* lum2 */ - "paddw %%mm1, %%mm3\n" /* lum2 +red 00 R7 00 R5 00 R3 00 R1 */ - "paddw %%mm2, %%mm5\n" /* lum2 +green 00 G7 00 G5 00 G3 00 G1 */ - "psraw $6, %%mm3\n" /* R2 */ - "por %%mm6, %%mm4\n" /* MM4 */ - "psraw $6, %%mm5\n" /* G2 */ - "movq (%2, %4), %%mm6\n" /* L3 load lum2 */ - "psraw $6, %%mm7\n" - "packuswb %%mm3, %%mm3\n" - "packuswb %%mm5, %%mm5\n" - "packuswb %%mm7, %%mm7\n" - "pand %12, %%mm6\n" /* L3 */ - "punpcklbw %%mm3, %%mm3\n" - "punpcklbw %%mm5, %%mm5\n" - "pmullw %15, %%mm6\n" /* lum3 */ - "punpcklbw %%mm7, %%mm7\n" - "psllw $3, %%mm5\n" /* GREEN 2 */ - "pand %16, %%mm7\n" - "pand %16, %%mm3\n" - "psrlw $11, %%mm7\n" /* BLUE 2 */ - "pand %17, %%mm5\n" - "por %%mm7, %%mm3\n" - "movq (%2,%4), %%mm7\n" /* L4 load lum2 */ - "por %%mm5, %%mm3\n" - "psrlw $8, %%mm7\n" /* L4 */ - "movq %%mm4, %%mm5\n" - "punpcklwd %%mm3, %%mm4\n" - "pmullw %15, %%mm7\n" /* lum4 */ - "punpckhwd %%mm3, %%mm5\n" - - "movq %%mm4, (%3)\n" /* write row1 */ - "movq %%mm5, 8(%3)\n" /* write row1 */ - - "movq %%mm6, %%mm4\n" /* Lum3 */ - "paddw %%mm0, %%mm6\n" /* Lum3 +blue */ - - "movq %%mm4, %%mm5\n" /* Lum3 */ - "paddw %%mm1, %%mm4\n" /* Lum3 +red */ - "paddw %%mm2, %%mm5\n" /* Lum3 +green */ - "psraw $6, %%mm4\n" - "movq %%mm7, %%mm3\n" /* Lum4 */ - "psraw $6, %%mm5\n" - "paddw %%mm0, %%mm7\n" /* Lum4 +blue */ - "psraw $6, %%mm6\n" /* Lum3 +blue */ - "movq %%mm3, %%mm0\n" /* Lum4 */ - "packuswb %%mm4, %%mm4\n" - "paddw %%mm1, %%mm3\n" /* Lum4 +red */ - "packuswb %%mm5, %%mm5\n" - "paddw %%mm2, %%mm0\n" /* Lum4 +green */ - "packuswb %%mm6, %%mm6\n" - "punpcklbw %%mm4, %%mm4\n" - "punpcklbw %%mm5, %%mm5\n" - "punpcklbw %%mm6, %%mm6\n" - "psllw $3, %%mm5\n" /* GREEN 3 */ - "pand %16, %%mm4\n" - "psraw $6, %%mm3\n" /* psr 6 */ - "psraw $6, %%mm0\n" - "pand %16, %%mm6\n" /* BLUE */ - "pand %17, %%mm5\n" - "psrlw $11, %%mm6\n" /* BLUE 3 */ - "por %%mm5, %%mm4\n" - "psraw $6, %%mm7\n" - "por %%mm6, %%mm4\n" - "packuswb %%mm3, %%mm3\n" - "packuswb %%mm0, %%mm0\n" - "packuswb %%mm7, %%mm7\n" - "punpcklbw %%mm3, %%mm3\n" - "punpcklbw %%mm0, %%mm0\n" - "punpcklbw %%mm7, %%mm7\n" - "pand %16, %%mm3\n" - "pand %16, %%mm7\n" /* BLUE */ - "psllw $3, %%mm0\n" /* GREEN 4 */ - "psrlw $11, %%mm7\n" - "pand %17, %%mm0\n" - "por %%mm7, %%mm3\n" - "por %%mm0, %%mm3\n" - - "movq %%mm4, %%mm5\n" - - "punpcklwd %%mm3, %%mm4\n" - "punpckhwd %%mm3, %%mm5\n" - - "movq %%mm4, (%5)\n" - "movq %%mm5, 8(%5)\n" - - "addl $8, %6\n" - "addl $8, %2\n" - "addl $4, (%%esp)\n" - "addl $4, %1\n" - "cmpl %4, %6\n" - "leal 16(%3), %3\n" - "leal 16(%5),%5\n" /* row2+16 */ - - "jl 1b\n" - "addl %4, %2\n" /* lum += cols */ - "addl %8, %3\n" /* row1+= mod */ - "addl %8, %5\n" /* row2+= mod */ - "movl $0, %6\n" /* x=0 */ - "cmpl %7, %2\n" - "jl 1b\n" - "addl $4, %%esp\n" /* get rid of the stack slot we reserved. */ - "emms\n" - : - : "m" (cr), "r"(cb),"r"(lum), - "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), - "m"(MMX_0080w),"m"(MMX_Ugrn565),"m"(MMX_Ublu5x5), - "m"(MMX_00FFw),"m"(MMX_Vgrn565),"m"(MMX_Vred5x5), - "m"(MMX_Ycoeff),"m"(MMX_red565),"m"(MMX_grn565) - ); -} - -/* *INDENT-ON* */ - -#endif /* GCC3 i386 inline assembly */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/SDL_yuv_sw.c b/Engine/lib/sdl/src/render/SDL_yuv_sw.c index 7fc6b8865..c227cdc67 100644 --- a/Engine/lib/sdl/src/render/SDL_yuv_sw.c +++ b/Engine/lib/sdl/src/render/SDL_yuv_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,1011 +22,15 @@ /* This is the software implementation of the YUV texture support */ -/* This code was derived from code carrying the following copyright notices: - - * Copyright (c) 1995 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - * Copyright (c) 1995 Erik Corry - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF - * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" - * BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, - * UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - * Portions of this software Copyright (c) 1995 Brown University. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement - * is hereby granted, provided that the above copyright notice and the - * following two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" - * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, - * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - #include "SDL_assert.h" -#include "SDL_video.h" -#include "SDL_cpuinfo.h" + #include "SDL_yuv_sw_c.h" -/* The colorspace conversion functions */ - -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES -extern void Color565DitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); -extern void ColorRGBDitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); -#endif - -static void -Color16DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned short *row1; - unsigned short *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = (unsigned short *) out; - row2 = row1 + cols + mod; - lum2 = lum + cols; - - mod += cols + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum++; - *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - - /* Now, do second row. */ - - L = *lum2++; - *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum2++; - *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color24DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row1; - unsigned char *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = out; - row2 = row1 + cols * 3 + mod * 3; - lum2 = lum + cols; - - mod += cols + mod; - mod *= 3; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row1++ = (value) & 0xFF; - *row1++ = (value >> 8) & 0xFF; - *row1++ = (value >> 16) & 0xFF; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row1++ = (value) & 0xFF; - *row1++ = (value >> 8) & 0xFF; - *row1++ = (value >> 16) & 0xFF; - - - /* Now, do second row. */ - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row2++ = (value) & 0xFF; - *row2++ = (value >> 8) & 0xFF; - *row2++ = (value >> 16) & 0xFF; - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row2++ = (value) & 0xFF; - *row2++ = (value >> 8) & 0xFF; - *row2++ = (value >> 16) & 0xFF; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color32DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1; - unsigned int *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = (unsigned int *) out; - row2 = row1 + cols + mod; - lum2 = lum + cols; - - mod += cols + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - *row1++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum++; - *row1++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - - /* Now, do second row. */ - - L = *lum2++; - *row2++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum2++; - *row2++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -/* - * In this function I make use of a nasty trick. The tables have the lower - * 16 bits replicated in the upper 16. This means I can write ints and get - * the horisontal doubling for free (almost). - */ -static void -Color16DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1 = (unsigned int *) out; - const int next_row = cols + (mod / 2); - unsigned int *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = (next_row * 3) + (mod / 2); - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row1++; - - L = *lum++; - row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row1++; - - - /* Now, do second row. */ - - L = *lum2++; - row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row2++; - - L = *lum2++; - row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row2++; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color24DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row1 = out; - const int next_row = (cols * 2 + mod) * 3; - unsigned char *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = next_row * 3 + mod * 3; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = - row1[next_row + 3 + 0] = (value) & 0xFF; - row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = - row1[next_row + 3 + 1] = (value >> 8) & 0xFF; - row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = - row1[next_row + 3 + 2] = (value >> 16) & 0xFF; - row1 += 2 * 3; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = - row1[next_row + 3 + 0] = (value) & 0xFF; - row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = - row1[next_row + 3 + 1] = (value >> 8) & 0xFF; - row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = - row1[next_row + 3 + 2] = (value >> 16) & 0xFF; - row1 += 2 * 3; - - - /* Now, do second row. */ - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = - row2[next_row + 3 + 0] = (value) & 0xFF; - row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = - row2[next_row + 3 + 1] = (value >> 8) & 0xFF; - row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = - row2[next_row + 3 + 2] = (value >> 16) & 0xFF; - row2 += 2 * 3; - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = - row2[next_row + 3 + 0] = (value) & 0xFF; - row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = - row2[next_row + 3 + 1] = (value >> 8) & 0xFF; - row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = - row2[next_row + 3 + 2] = (value >> 16) & 0xFF; - row2 += 2 * 3; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color32DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1 = (unsigned int *) out; - const int next_row = cols * 2 + mod; - unsigned int *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = (next_row * 3) + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1 += 2; - - L = *lum++; - row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1 += 2; - - - /* Now, do second row. */ - - L = *lum2++; - row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2 += 2; - - L = *lum2++; - row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2 += 2; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color16DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned short *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned short *) out; - - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum; - lum += 2; - *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - } - - row += mod; - } -} - -static void -Color24DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned char *) out; - mod *= 3; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row++ = (value) & 0xFF; - *row++ = (value >> 8) & 0xFF; - *row++ = (value >> 16) & 0xFF; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row++ = (value) & 0xFF; - *row++ = (value >> 8) & 0xFF; - *row++ = (value >> 16) & 0xFF; - - } - row += mod; - } -} - -static void -Color32DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned int *) out; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - *row++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum; - lum += 2; - *row++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - - } - row += mod; - } -} - -/* - * In this function I make use of a nasty trick. The tables have the lower - * 16 bits replicated in the upper 16. This means I can write ints and get - * the horisontal doubling for free (almost). - */ -static void -Color16DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row = (unsigned int *) out; - const int next_row = cols + (mod / 2); - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row++; - - L = *lum; - lum += 2; - row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row++; - - } - row += next_row; - } -} - -static void -Color24DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row = out; - const int next_row = (cols * 2 + mod) * 3; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row[0 + 0] = row[3 + 0] = row[next_row + 0] = - row[next_row + 3 + 0] = (value) & 0xFF; - row[0 + 1] = row[3 + 1] = row[next_row + 1] = - row[next_row + 3 + 1] = (value >> 8) & 0xFF; - row[0 + 2] = row[3 + 2] = row[next_row + 2] = - row[next_row + 3 + 2] = (value >> 16) & 0xFF; - row += 2 * 3; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row[0 + 0] = row[3 + 0] = row[next_row + 0] = - row[next_row + 3 + 0] = (value) & 0xFF; - row[0 + 1] = row[3 + 1] = row[next_row + 1] = - row[next_row + 3 + 1] = (value >> 8) & 0xFF; - row[0 + 2] = row[3 + 2] = row[next_row + 2] = - row[next_row + 3 + 2] = (value >> 16) & 0xFF; - row += 2 * 3; - - } - row += next_row; - } -} - -static void -Color32DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row = (unsigned int *) out; - const int next_row = cols * 2 + mod; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - mod += mod; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - row[0] = row[1] = row[next_row] = row[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row += 2; - - L = *lum; - lum += 2; - row[0] = row[1] = row[next_row] = row[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row += 2; - - - } - - row += next_row; - } -} - -/* - * How many 1 bits are there in the Uint32. - * Low performance, do not call often. - */ -static int -number_of_bits_set(Uint32 a) -{ - if (!a) - return 0; - if (a & 1) - return 1 + number_of_bits_set(a >> 1); - return (number_of_bits_set(a >> 1)); -} - -/* - * How many 0 bits are there at least significant end of Uint32. - * Low performance, do not call often. - */ -static int -free_bits_at_bottom(Uint32 a) -{ - /* assume char is 8 bits */ - if (!a) - return sizeof(Uint32) * 8; - if (((Sint32) a) & 1l) - return 0; - return 1 + free_bits_at_bottom(a >> 1); -} - -static int -SDL_SW_SetupYUVDisplay(SDL_SW_YUVTexture * swdata, Uint32 target_format) -{ - Uint32 *r_2_pix_alloc; - Uint32 *g_2_pix_alloc; - Uint32 *b_2_pix_alloc; - int i; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; - - if (!SDL_PixelFormatEnumToMasks - (target_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask) || bpp < 15) { - return SDL_SetError("Unsupported YUV destination format"); - } - - swdata->target_format = target_format; - r_2_pix_alloc = &swdata->rgb_2_pix[0 * 768]; - g_2_pix_alloc = &swdata->rgb_2_pix[1 * 768]; - b_2_pix_alloc = &swdata->rgb_2_pix[2 * 768]; - - /* - * Set up entries 0-255 in rgb-to-pixel value tables. - */ - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Rmask)); - r_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Rmask); - r_2_pix_alloc[i + 256] |= Amask; - g_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Gmask)); - g_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Gmask); - g_2_pix_alloc[i + 256] |= Amask; - b_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Bmask)); - b_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Bmask); - b_2_pix_alloc[i + 256] |= Amask; - } - - /* - * If we have 16-bit output depth, then we double the value - * in the top word. This means that we can write out both - * pixels in the pixel doubling mode with one op. It is - * harmless in the normal case as storing a 32-bit value - * through a short pointer will lose the top bits anyway. - */ - if (SDL_BYTESPERPIXEL(target_format) == 2) { - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 16; - g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 16; - b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 16; - } - } - - /* - * Spread out the values we have to the rest of the array so that - * we do not need to check for overflow. - */ - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i] = r_2_pix_alloc[256]; - r_2_pix_alloc[i + 512] = r_2_pix_alloc[511]; - g_2_pix_alloc[i] = g_2_pix_alloc[256]; - g_2_pix_alloc[i + 512] = g_2_pix_alloc[511]; - b_2_pix_alloc[i] = b_2_pix_alloc[256]; - b_2_pix_alloc[i + 512] = b_2_pix_alloc[511]; - } - - /* You have chosen wisely... */ - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - if (SDL_BYTESPERPIXEL(target_format) == 2) { -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - /* inline assembly functions */ - if (SDL_HasMMX() && (Rmask == 0xF800) && - (Gmask == 0x07E0) && (Bmask == 0x001F) - && (swdata->w & 15) == 0) { -/* printf("Using MMX 16-bit 565 dither\n"); */ - swdata->Display1X = Color565DitherYV12MMX1X; - } else { -/* printf("Using C 16-bit dither\n"); */ - swdata->Display1X = Color16DitherYV12Mod1X; - } -#else - swdata->Display1X = Color16DitherYV12Mod1X; -#endif - swdata->Display2X = Color16DitherYV12Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 3) { - swdata->Display1X = Color24DitherYV12Mod1X; - swdata->Display2X = Color24DitherYV12Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 4) { -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - /* inline assembly functions */ - if (SDL_HasMMX() && (Rmask == 0x00FF0000) && - (Gmask == 0x0000FF00) && - (Bmask == 0x000000FF) && (swdata->w & 15) == 0) { -/* printf("Using MMX 32-bit dither\n"); */ - swdata->Display1X = ColorRGBDitherYV12MMX1X; - } else { -/* printf("Using C 32-bit dither\n"); */ - swdata->Display1X = Color32DitherYV12Mod1X; - } -#else - swdata->Display1X = Color32DitherYV12Mod1X; -#endif - swdata->Display2X = Color32DitherYV12Mod2X; - } - break; - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - if (SDL_BYTESPERPIXEL(target_format) == 2) { - swdata->Display1X = Color16DitherYUY2Mod1X; - swdata->Display2X = Color16DitherYUY2Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 3) { - swdata->Display1X = Color24DitherYUY2Mod1X; - swdata->Display2X = Color24DitherYUY2Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 4) { - swdata->Display1X = Color32DitherYUY2Mod1X; - swdata->Display2X = Color32DitherYUY2Mod2X; - } - break; - default: - /* We should never get here (caught above) */ - break; - } - - SDL_FreeSurface(swdata->display); - swdata->display = NULL; - return 0; -} - SDL_SW_YUVTexture * SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) { SDL_SW_YUVTexture *swdata; - int *Cr_r_tab; - int *Cr_g_tab; - int *Cb_g_tab; - int *Cb_b_tab; - int i; - int CR, CB; switch (format) { case SDL_PIXELFORMAT_YV12: @@ -1034,6 +38,8 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) case SDL_PIXELFORMAT_YUY2: case SDL_PIXELFORMAT_UYVY: case SDL_PIXELFORMAT_YVYU: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: break; default: SDL_SetError("Unsupported YUV format"); @@ -1050,48 +56,67 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) swdata->target_format = SDL_PIXELFORMAT_UNKNOWN; swdata->w = w; swdata->h = h; - swdata->pixels = (Uint8 *) SDL_malloc(w * h * 2); - swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int)); - swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32)); - if (!swdata->pixels || !swdata->colortab || !swdata->rgb_2_pix) { - SDL_SW_DestroyYUVTexture(swdata); - SDL_OutOfMemory(); - return NULL; + { + const int sz_plane = w * h; + const int sz_plane_chroma = ((w + 1) / 2) * ((h + 1) / 2); + const int sz_plane_packed = ((w + 1) / 2) * h; + int dst_size = 0; + switch(format) + { + case SDL_PIXELFORMAT_YV12: /**< Planar mode: Y + V + U (3 planes) */ + case SDL_PIXELFORMAT_IYUV: /**< Planar mode: Y + U + V (3 planes) */ + dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma; + break; + + case SDL_PIXELFORMAT_YUY2: /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ + case SDL_PIXELFORMAT_UYVY: /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ + case SDL_PIXELFORMAT_YVYU: /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ + dst_size = 4 * sz_plane_packed; + break; + + case SDL_PIXELFORMAT_NV12: /**< Planar mode: Y + U/V interleaved (2 planes) */ + case SDL_PIXELFORMAT_NV21: /**< Planar mode: Y + V/U interleaved (2 planes) */ + dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma; + break; + + default: + SDL_assert(0 && "We should never get here (caught above)"); + break; + } + swdata->pixels = (Uint8 *) SDL_malloc(dst_size); + if (!swdata->pixels) { + SDL_SW_DestroyYUVTexture(swdata); + SDL_OutOfMemory(); + return NULL; + } } - /* Generate the tables for the display surface */ - Cr_r_tab = &swdata->colortab[0 * 256]; - Cr_g_tab = &swdata->colortab[1 * 256]; - Cb_g_tab = &swdata->colortab[2 * 256]; - Cb_b_tab = &swdata->colortab[3 * 256]; - for (i = 0; i < 256; i++) { - /* Gamma correction (luminescence table) and chroma correction - would be done here. See the Berkeley mpeg_play sources. - */ - CB = CR = (i - 128); - Cr_r_tab[i] = (int) ((0.419 / 0.299) * CR); - Cr_g_tab[i] = (int) (-(0.299 / 0.419) * CR); - Cb_g_tab[i] = (int) (-(0.114 / 0.331) * CB); - Cb_b_tab[i] = (int) ((0.587 / 0.331) * CB); - } - - /* Find the pitch and offset values for the overlay */ + /* Find the pitch and offset values for the texture */ switch (format) { case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: swdata->pitches[0] = w; - swdata->pitches[1] = swdata->pitches[0] / 2; - swdata->pitches[2] = swdata->pitches[0] / 2; + swdata->pitches[1] = (swdata->pitches[0] + 1) / 2; + swdata->pitches[2] = (swdata->pitches[0] + 1) / 2; swdata->planes[0] = swdata->pixels; swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; - swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * h / 2; + swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * ((h + 1) / 2); break; case SDL_PIXELFORMAT_YUY2: case SDL_PIXELFORMAT_UYVY: case SDL_PIXELFORMAT_YVYU: - swdata->pitches[0] = w * 2; + swdata->pitches[0] = ((w + 1) / 2) * 4; swdata->planes[0] = swdata->pixels; break; + + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + swdata->pitches[0] = w; + swdata->pitches[1] = 2 * ((swdata->pitches[0] + 1) / 2); + swdata->planes[0] = swdata->pixels; + swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; + break; + default: SDL_assert(0 && "We should never get here (caught above)"); break; @@ -1120,7 +145,7 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, if (rect->x == 0 && rect->y == 0 && rect->w == swdata->w && rect->h == swdata->h) { SDL_memcpy(swdata->pixels, pixels, - (swdata->h * swdata->w) + (swdata->h * swdata->w) / 2); + (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2)); } else { Uint8 *src, *dst; int row; @@ -1135,28 +160,28 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, src += pitch; dst += swdata->w; } - + /* Copy the next plane */ src = (Uint8 *) pixels + rect->h * pitch; dst = swdata->pixels + swdata->h * swdata->w; - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + dst += rect->y/2 * ((swdata->w + 1) / 2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); - src += pitch/2; - dst += swdata->w/2; + src += (pitch + 1)/2; + dst += (swdata->w + 1)/2; } /* Copy the next plane */ - src = (Uint8 *) pixels + rect->h * pitch + (rect->h * pitch) / 4; + src = (Uint8 *) pixels + rect->h * pitch + ((rect->h + 1) / 2) * ((pitch + 1) / 2); dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + ((swdata->h + 1)/2) * ((swdata->w+1) / 2); + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); - src += pitch/2; - dst += swdata->w/2; + src += (pitch + 1)/2; + dst += (swdata->w + 1)/2; } } break; @@ -1172,7 +197,7 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, dst = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2; - length = rect->w * 2; + length = 4 * ((rect->w + 1) / 2); for (row = 0; row < rect->h; ++row) { SDL_memcpy(dst, src, length); src += pitch; @@ -1180,6 +205,40 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, } } break; + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + { + if (rect->x == 0 && rect->y == 0 && rect->w == swdata->w && rect->h == swdata->h) { + SDL_memcpy(swdata->pixels, pixels, + (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2)); + } else { + + Uint8 *src, *dst; + int row; + size_t length; + + /* Copy the Y plane */ + src = (Uint8 *) pixels; + dst = swdata->pixels + rect->y * swdata->w + rect->x; + length = rect->w; + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += swdata->w; + } + + /* Copy the next plane */ + src = (Uint8 *) pixels + rect->h * pitch; + dst = swdata->pixels + swdata->h * swdata->w; + dst += 2 * ((rect->y + 1)/2) * ((swdata->w + 1) / 2) + 2 * (rect->x/2); + length = 2 * ((rect->w + 1) / 2); + for (row = 0; row < (rect->h + 1)/2; ++row) { + SDL_memcpy(dst, src, length); + src += 2 * ((pitch + 1)/2); + dst += 2 * ((swdata->w + 1)/2); + } + } + } } return 0; } @@ -1211,14 +270,14 @@ SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, dst = swdata->pixels + swdata->h * swdata->w; } else { dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; + ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2); } - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); src += Upitch; - dst += swdata->w/2; + dst += (swdata->w + 1)/2; } /* Copy the V plane */ @@ -1227,14 +286,14 @@ SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, dst = swdata->pixels + swdata->h * swdata->w; } else { dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; + ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2); } - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); src += Vpitch; - dst += swdata->w/2; + dst += (swdata->w + 1)/2; } return 0; } @@ -1246,11 +305,13 @@ SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, switch (swdata->format) { case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: if (rect && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w || rect->h != swdata->h)) { return SDL_SetError - ("YV12 and IYUV textures only support full surface locks"); + ("YV12, IYUV, NV12, NV21 textures only support full surface locks"); } break; } @@ -1274,27 +335,16 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, Uint32 target_format, int w, int h, void *pixels, int pitch) { - const int targetbpp = SDL_BYTESPERPIXEL(target_format); int stretch; - int scale_2x; - Uint8 *lum, *Cr, *Cb; - int mod; - - if (targetbpp == 0) { - return SDL_SetError("Invalid target pixel format"); - } /* Make sure we're set up to display in the desired format */ - if (target_format != swdata->target_format) { - if (SDL_SW_SetupYUVDisplay(swdata, target_format) < 0) { - return -1; - } + if (target_format != swdata->target_format && swdata->display) { + SDL_FreeSurface(swdata->display); + swdata->display = NULL; } stretch = 0; - scale_2x = 0; - if (srcrect->x || srcrect->y || srcrect->w < swdata->w - || srcrect->h < swdata->h) { + if (srcrect->x || srcrect->y || srcrect->w < swdata->w || srcrect->h < swdata->h) { /* The source rectangle has been clipped. Using a scratch surface is easier than adding clipped source support to all the blitters, plus that would @@ -1302,11 +352,7 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, */ stretch = 1; } else if ((srcrect->w != w) || (srcrect->h != h)) { - if ((w == 2 * srcrect->w) && (h == 2 * srcrect->h)) { - scale_2x = 1; - } else { - stretch = 1; - } + stretch = 1; } if (stretch) { int bpp; @@ -1342,45 +388,10 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, pixels = swdata->stretch->pixels; pitch = swdata->stretch->pitch; } - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - lum = swdata->planes[0]; - Cr = swdata->planes[1]; - Cb = swdata->planes[2]; - break; - case SDL_PIXELFORMAT_IYUV: - lum = swdata->planes[0]; - Cr = swdata->planes[2]; - Cb = swdata->planes[1]; - break; - case SDL_PIXELFORMAT_YUY2: - lum = swdata->planes[0]; - Cr = lum + 3; - Cb = lum + 1; - break; - case SDL_PIXELFORMAT_UYVY: - lum = swdata->planes[0] + 1; - Cr = lum + 1; - Cb = lum - 1; - break; - case SDL_PIXELFORMAT_YVYU: - lum = swdata->planes[0]; - Cr = lum + 1; - Cb = lum + 3; - break; - default: - return SDL_SetError("Unsupported YUV format in copy"); - } - mod = (pitch / targetbpp); - - if (scale_2x) { - mod -= (swdata->w * 2); - swdata->Display2X(swdata->colortab, swdata->rgb_2_pix, - lum, Cr, Cb, pixels, swdata->h, swdata->w, mod); - } else { - mod -= swdata->w; - swdata->Display1X(swdata->colortab, swdata->rgb_2_pix, - lum, Cr, Cb, pixels, swdata->h, swdata->w, mod); + if (SDL_ConvertPixels(swdata->w, swdata->h, swdata->format, + swdata->planes[0], swdata->pitches[0], + target_format, pixels, pitch) < 0) { + return -1; } if (stretch) { SDL_Rect rect = *srcrect; @@ -1394,8 +405,6 @@ SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata) { if (swdata) { SDL_free(swdata->pixels); - SDL_free(swdata->colortab); - SDL_free(swdata->rgb_2_pix); SDL_FreeSurface(swdata->stretch); SDL_FreeSurface(swdata->display); SDL_free(swdata); diff --git a/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h b/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h index 2752096f4..0dfb5db7f 100644 --- a/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h +++ b/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,16 +30,6 @@ struct SDL_SW_YUVTexture Uint32 target_format; int w, h; Uint8 *pixels; - int *colortab; - Uint32 *rgb_2_pix; - void (*Display1X) (int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); - void (*Display2X) (int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); /* These are just so we don't have to allocate them separately */ Uint16 pitches[3]; @@ -69,4 +59,9 @@ int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, int pitch); void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata); +/* FIXME: This breaks on various versions of GCC and should be rewritten using intrinsics */ +#if 0 /* (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES && !defined(__clang__) */ +#define USE_MMX_ASSEMBLY 1 +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c b/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c index 151dbbf04..d3be57132 100644 --- a/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c +++ b/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,85 +39,7 @@ #include #endif - -#ifdef ASSEMBLE_SHADER -#pragma comment(lib, "d3dx9.lib") - -/************************************************************************** - * ID3DXBuffer: - * ------------ - * The buffer object is used by D3DX to return arbitrary size data. - * - * GetBufferPointer - - * Returns a pointer to the beginning of the buffer. - * - * GetBufferSize - - * Returns the size of the buffer, in bytes. - **************************************************************************/ - -typedef interface ID3DXBuffer ID3DXBuffer; -typedef interface ID3DXBuffer *LPD3DXBUFFER; - -/* {8BA5FB08-5195-40e2-AC58-0D989C3A0102} */ -DEFINE_GUID(IID_ID3DXBuffer, -0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); - -#undef INTERFACE -#define INTERFACE ID3DXBuffer - -typedef interface ID3DXBuffer { - const struct ID3DXBufferVtbl FAR* lpVtbl; -} ID3DXBuffer; -typedef const struct ID3DXBufferVtbl ID3DXBufferVtbl; -const struct ID3DXBufferVtbl -{ - /* IUnknown */ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /* ID3DXBuffer */ - STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; - STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; -}; - -HRESULT WINAPI - D3DXAssembleShader( - LPCSTR pSrcData, - UINT SrcDataLen, - CONST LPVOID* pDefines, - LPVOID pInclude, - DWORD Flags, - LPD3DXBUFFER* ppShader, - LPD3DXBUFFER* ppErrorMsgs); - -static void PrintShaderData(LPDWORD shader_data, DWORD shader_size) -{ - OutputDebugStringA("const DWORD shader_data[] = {\n\t"); - { - SDL_bool newline = SDL_FALSE; - unsigned i; - for (i = 0; i < shader_size / sizeof(DWORD); ++i) { - char dword[11]; - if (i > 0) { - if ((i%6) == 0) { - newline = SDL_TRUE; - } - if (newline) { - OutputDebugStringA(",\n "); - newline = SDL_FALSE; - } else { - OutputDebugStringA(", "); - } - } - SDL_snprintf(dword, sizeof(dword), "0x%8.8x", shader_data[i]); - OutputDebugStringA(dword); - } - OutputDebugStringA("\n};\n"); - } -} - -#endif /* ASSEMBLE_SHADER */ +#include "SDL_shaders_d3d.h" /* Direct3D renderer implementation */ @@ -125,6 +47,7 @@ static void PrintShaderData(LPDWORD shader_data, DWORD shader_size) static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags); static void D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); +static SDL_bool D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, @@ -187,7 +110,7 @@ typedef struct IDirect3DSurface9 *defaultRenderTarget; IDirect3DSurface9 *currentRenderTarget; void* d3dxDLL; - LPDIRECT3DPIXELSHADER9 ps_yuv; + LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS]; } D3D_RenderData; typedef struct @@ -196,6 +119,7 @@ typedef struct int w, h; DWORD usage; Uint32 format; + D3DFORMAT d3dfmt; IDirect3DTexture9 *texture; IDirect3DTexture9 *staging; } D3D_TextureRep; @@ -312,6 +236,8 @@ PixelFormatToD3DFMT(Uint32 format) return D3DFMT_A8R8G8B8; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: return D3DFMT_L8; default: return D3DFMT_UNKNOWN; @@ -542,6 +468,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D_WindowEvent; + renderer->SupportsBlendMode = D3D_SupportsBlendMode; renderer->CreateTexture = D3D_CreateTexture; renderer->UpdateTexture = D3D_UpdateTexture; renderer->UpdateTextureYUV = D3D_UpdateTextureYUV; @@ -659,136 +586,19 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) /* Set up parameters for rendering */ D3D_InitRenderState(data); - if (caps.MaxSimultaneousTextures >= 3) - { -#ifdef ASSEMBLE_SHADER - /* This shader was created by running the following HLSL through the fxc compiler - and then tuning the generated assembly. - - fxc /T fx_4_0 /O3 /Gfa /Fc yuv.fxc yuv.fx - - --- yuv.fx --- - Texture2D g_txY; - Texture2D g_txU; - Texture2D g_txV; - - SamplerState samLinear - { - Filter = ANISOTROPIC; - AddressU = Clamp; - AddressV = Clamp; - MaxAnisotropy = 1; - }; - - struct VS_OUTPUT - { - float2 TextureUV : TEXCOORD0; - }; - - struct PS_OUTPUT - { - float4 RGBAColor : SV_Target; - }; - - PS_OUTPUT YUV420( VS_OUTPUT In ) - { - const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; - const float3 Rcoeff = {1.164, 0.000, 1.596}; - const float3 Gcoeff = {1.164, -0.391, -0.813}; - const float3 Bcoeff = {1.164, 2.018, 0.000}; - - PS_OUTPUT Output; - float2 TextureUV = In.TextureUV; - - float3 yuv; - yuv.x = g_txY.Sample( samLinear, TextureUV ).r; - yuv.y = g_txU.Sample( samLinear, TextureUV ).r; - yuv.z = g_txV.Sample( samLinear, TextureUV ).r; - - yuv += offset; - Output.RGBAColor.r = dot(yuv, Rcoeff); - Output.RGBAColor.g = dot(yuv, Gcoeff); - Output.RGBAColor.b = dot(yuv, Bcoeff); - Output.RGBAColor.a = 1.0f; - - return Output; - } - - technique10 RenderYUV420 - { - pass P0 - { - SetPixelShader( CompileShader( ps_4_0_level_9_0, YUV420() ) ); - } - } - */ - const char *shader_text = - "ps_2_0\n" - "def c0, -0.0627451017, -0.501960814, -0.501960814, 1\n" - "def c1, 1.16400003, 0, 1.59599996, 0\n" - "def c2, 1.16400003, -0.391000003, -0.813000023, 0\n" - "def c3, 1.16400003, 2.01799989, 0, 0\n" - "dcl t0.xy\n" - "dcl v0.xyzw\n" - "dcl_2d s0\n" - "dcl_2d s1\n" - "dcl_2d s2\n" - "texld r0, t0, s0\n" - "texld r1, t0, s1\n" - "texld r2, t0, s2\n" - "mov r0.y, r1.x\n" - "mov r0.z, r2.x\n" - "add r0.xyz, r0, c0\n" - "dp3 r1.x, r0, c1\n" - "dp3 r1.y, r0, c2\n" - "dp2add r1.z, r0, c3, c3.z\n" /* Logically this is "dp3 r1.z, r0, c3" but the optimizer did its magic */ - "mov r1.w, c0.w\n" - "mul r0, r1, v0\n" /* Not in the HLSL, multiply by vertex color */ - "mov oC0, r0\n" - ; - LPD3DXBUFFER pCode; - LPD3DXBUFFER pErrorMsgs; - LPDWORD shader_data = NULL; - DWORD shader_size = 0; - result = D3DXAssembleShader(shader_text, SDL_strlen(shader_text), NULL, NULL, 0, &pCode, &pErrorMsgs); - if (!FAILED(result)) { - shader_data = (DWORD*)pCode->lpVtbl->GetBufferPointer(pCode); - shader_size = pCode->lpVtbl->GetBufferSize(pCode); - PrintShaderData(shader_data, shader_size); - } else { - const char *error = (const char *)pErrorMsgs->lpVtbl->GetBufferPointer(pErrorMsgs); - SDL_SetError("Couldn't assemble shader: %s", error); - } -#else - const DWORD shader_data[] = { - 0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, - 0x3f800000, 0x05000051, 0xa00f0001, 0x3f94fdf4, 0x00000000, 0x3fcc49ba, - 0x00000000, 0x05000051, 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, - 0x00000000, 0x05000051, 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, - 0x00000000, 0x0200001f, 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, - 0x900f0000, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, - 0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, - 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, - 0x03000042, 0x800f0002, 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, - 0x80000001, 0x02000001, 0x80040000, 0x80000002, 0x03000002, 0x80070000, - 0x80e40000, 0xa0e40000, 0x03000008, 0x80010001, 0x80e40000, 0xa0e40001, - 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, - 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, - 0x03000005, 0x800f0000, 0x80e40001, 0x90e40000, 0x02000001, 0x800f0800, - 0x80e40000, 0x0000ffff - }; -#endif - if (shader_data != NULL) { - result = IDirect3DDevice9_CreatePixelShader(data->device, shader_data, &data->ps_yuv); - if (!FAILED(result)) { - renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; - renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; - } else { + if (caps.MaxSimultaneousTextures >= 3) { + int i; + for (i = 0; i < SDL_arraysize(data->shaders); ++i) { + result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]); + if (FAILED(result)) { D3D_SetError("CreatePixelShader()", result); } } + if (data->shaders[SHADER_YUV_JPEG] && data->shaders[SHADER_YUV_BT601] && data->shaders[SHADER_YUV_BT709]) { + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; + } } - return renderer; } @@ -802,6 +612,58 @@ D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } +static D3DBLEND GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return D3DBLEND_ZERO; + case SDL_BLENDFACTOR_ONE: + return D3DBLEND_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return D3DBLEND_SRCCOLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return D3DBLEND_INVSRCCOLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return D3DBLEND_SRCALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return D3DBLEND_INVSRCALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return D3DBLEND_DESTCOLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return D3DBLEND_INVDESTCOLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return D3DBLEND_DESTALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return D3DBLEND_INVDESTALPHA; + default: + return (D3DBLEND)0; + } +} + +static SDL_bool +D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor)) { + return SDL_FALSE; + } + if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->enableSeparateAlphaBlend) { + return SDL_FALSE; + } + if (colorOperation != SDL_BLENDOPERATION_ADD || alphaOperation != SDL_BLENDOPERATION_ADD) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static D3DTEXTUREFILTERTYPE GetScaleQuality(void) { @@ -815,7 +677,7 @@ GetScaleQuality(void) } static int -D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, int w, int h) +D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, D3DFORMAT d3dfmt, int w, int h) { HRESULT result; @@ -824,6 +686,7 @@ D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD us texture->h = h; texture->usage = usage; texture->format = format; + texture->d3dfmt = d3dfmt; result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage, PixelFormatToD3DFMT(format), @@ -842,8 +705,7 @@ D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture) if (texture->staging == NULL) { result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0, - PixelFormatToD3DFMT(texture->format), - D3DPOOL_SYSTEMMEM, &texture->staging, NULL); + texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL); if (FAILED(result)) { return D3D_SetError("CreateTexture(D3DPOOL_SYSTEMMEM)", result); } @@ -879,7 +741,7 @@ D3D_BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD samp } static int -D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int w, int h) +D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture) { if (texture->texture) { IDirect3DTexture9_Release(texture->texture); @@ -893,7 +755,7 @@ D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 } static int -D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch) +D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, int x, int y, int w, int h, const void *pixels, int pitch) { RECT d3drect; D3DLOCKED_RECT locked; @@ -917,8 +779,8 @@ D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 f } src = (const Uint8 *)pixels; - dst = locked.pBits; - length = w * SDL_BYTESPERPIXEL(format); + dst = (Uint8 *)locked.pBits; + length = w * SDL_BYTESPERPIXEL(texture->format); if (length == pitch && length == locked.Pitch) { SDL_memcpy(dst, src, length*h); } else { @@ -977,7 +839,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) usage = 0; } - if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, texture->w, texture->h) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) { return -1; } @@ -985,11 +847,11 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture->format == SDL_PIXELFORMAT_IYUV) { texturedata->yuv = SDL_TRUE; - if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) { return -1; } - if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) { return -1; } } @@ -1006,16 +868,16 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) return 0; } - if (D3D_RecreateTextureRep(data->device, &texturedata->texture, texture->format, texture->w, texture->h) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) { return -1; } if (texturedata->yuv) { - if (D3D_RecreateTextureRep(data->device, &texturedata->utexture, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) { return -1; } - if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture) < 0) { return -1; } } @@ -1034,7 +896,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { return -1; } @@ -1042,13 +904,13 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); - if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) { + if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) { return -1; } /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); - if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) { + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2)); + if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, rect->x / 2, (rect->y + 1) / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) { return -1; } } @@ -1070,13 +932,13 @@ D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch) < 0) { return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch) < 0) { return -1; } return 0; @@ -1215,7 +1077,9 @@ D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture) static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { - D3D_ActivateRenderer(renderer); + if (D3D_ActivateRenderer(renderer) < 0) { + return -1; + } return D3D_SetRenderTargetInternal(renderer, texture); } @@ -1353,55 +1217,22 @@ D3D_RenderClear(SDL_Renderer * renderer) } static void -D3D_SetBlendMode(D3D_RenderData * data, int blendMode) +D3D_SetBlendMode(D3D_RenderData * data, SDL_BlendMode blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - FALSE); - break; - case SDL_BLENDMODE_BLEND: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); + if (blendMode == SDL_BLENDMODE_NONE) { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, FALSE); + } else { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, TRUE); IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_SRCALPHA); + GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_INVSRCALPHA); + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode))); if (data->enableSeparateAlphaBlend) { IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ONE); + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_INVSRCALPHA); + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); } - break; - case SDL_BLENDMODE_ADD: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_SRCALPHA); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_ONE); - if (data->enableSeparateAlphaBlend) { - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ZERO); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_ONE); - } - break; - case SDL_BLENDMODE_MOD: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_ZERO); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_SRCCOLOR); - if (data->enableSeparateAlphaBlend) { - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ZERO); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_ONE); - } - break; } } @@ -1583,17 +1414,68 @@ D3D_UpdateTextureScaleMode(D3D_RenderData *data, D3D_TextureData *texturedata, u texturedata->scaleMode); IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_MAGFILTER, texturedata->scaleMode); + IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSU, + D3DTADDRESS_CLAMP); + IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSV, + D3DTADDRESS_CLAMP); data->scaleMode[index] = texturedata->scaleMode; } } +static int +D3D_RenderSetupTextureState(SDL_Renderer * renderer, SDL_Texture * texture, LPDIRECT3DPIXELSHADER9 *shader) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + D3D_TextureData *texturedata; + + *shader = NULL; + + texturedata = (D3D_TextureData *)texture->driverdata; + if (!texturedata) { + SDL_SetError("Texture is not currently available"); + return -1; + } + + D3D_UpdateTextureScaleMode(data, texturedata, 0); + + if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + return -1; + } + + if (texturedata->yuv) { + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + *shader = data->shaders[SHADER_YUV_JPEG]; + break; + case SDL_YUV_CONVERSION_BT601: + *shader = data->shaders[SHADER_YUV_BT601]; + break; + case SDL_YUV_CONVERSION_BT709: + *shader = data->shaders[SHADER_YUV_BT709]; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D_UpdateTextureScaleMode(data, texturedata, 1); + D3D_UpdateTextureScaleMode(data, texturedata, 2); + + if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { + return -1; + } + if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { + return -1; + } + } + return 0; +} + static int D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - D3D_TextureData *texturedata; - LPDIRECT3DPIXELSHADER9 shader = NULL; + LPDIRECT3DPIXELSHADER9 shader; float minx, miny, maxx, maxy; float minu, maxu, minv, maxv; DWORD color; @@ -1604,12 +1486,6 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - texturedata = (D3D_TextureData *)texture->driverdata; - if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; - } - minx = dstrect->x - 0.5f; miny = dstrect->y - 0.5f; maxx = dstrect->x + dstrect->w - 0.5f; @@ -1652,45 +1528,25 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, D3D_SetBlendMode(data, texture->blendMode); - D3D_UpdateTextureScaleMode(data, texturedata, 0); - - if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) { return -1; } - - if (texturedata->yuv) { - shader = data->ps_yuv; - - D3D_UpdateTextureScaleMode(data, texturedata, 1); - D3D_UpdateTextureScaleMode(data, texturedata, 2); - - if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { - return -1; - } - if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { - return -1; - } - } - + if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { return D3D_SetError("SetShader()", result); } } - result = - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, - vertices, sizeof(*vertices)); + result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, + vertices, sizeof(*vertices)); if (FAILED(result)) { - return D3D_SetError("DrawPrimitiveUP()", result); + D3D_SetError("DrawPrimitiveUP()", result); } if (shader) { - result = IDirect3DDevice9_SetPixelShader(data->device, NULL); - if (FAILED(result)) { - return D3D_SetError("SetShader()", result); - } + IDirect3DDevice9_SetPixelShader(data->device, NULL); } - return 0; + return FAILED(result) ? -1 : 0; } @@ -1700,7 +1556,6 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - D3D_TextureData *texturedata; LPDIRECT3DPIXELSHADER9 shader = NULL; float minx, miny, maxx, maxy; float minu, maxu, minv, maxv; @@ -1714,38 +1569,30 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - texturedata = (D3D_TextureData *)texture->driverdata; - if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; - } - centerx = center->x; centery = center->y; - if (flip & SDL_FLIP_HORIZONTAL) { - minx = dstrect->w - centerx - 0.5f; - maxx = -centerx - 0.5f; - } - else { - minx = -centerx - 0.5f; - maxx = dstrect->w - centerx - 0.5f; - } - - if (flip & SDL_FLIP_VERTICAL) { - miny = dstrect->h - centery - 0.5f; - maxy = -centery - 0.5f; - } - else { - miny = -centery - 0.5f; - maxy = dstrect->h - centery - 0.5f; - } + minx = -centerx; + maxx = dstrect->w - centerx; + miny = -centery; + maxy = dstrect->h - centery; minu = (float) srcrect->x / texture->w; maxu = (float) (srcrect->x + srcrect->w) / texture->w; minv = (float) srcrect->y / texture->h; maxv = (float) (srcrect->y + srcrect->h) / texture->h; + if (flip & SDL_FLIP_HORIZONTAL) { + float tmp = maxu; + maxu = minu; + minu = tmp; + } + if (flip & SDL_FLIP_VERTICAL) { + float tmp = maxv; + maxv = minv; + minv = tmp; + } + color = D3DCOLOR_ARGB(texture->a, texture->r, texture->g, texture->b); vertices[0].x = minx; @@ -1778,55 +1625,37 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, D3D_SetBlendMode(data, texture->blendMode); - /* Rotate and translate */ - modelMatrix = MatrixMultiply( - MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)), - MatrixTranslation(dstrect->x + center->x, dstrect->y + center->y, 0) -); - IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); - - D3D_UpdateTextureScaleMode(data, texturedata, 0); - - if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) { return -1; } - if (texturedata->yuv) { - shader = data->ps_yuv; - - D3D_UpdateTextureScaleMode(data, texturedata, 1); - D3D_UpdateTextureScaleMode(data, texturedata, 2); - - if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { - return -1; - } - if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { - return -1; - } - } - + /* Rotate and translate */ + modelMatrix = MatrixMultiply( + MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)), + MatrixTranslation(dstrect->x + center->x - 0.5f, dstrect->y + center->y - 0.5f, 0)); + IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); + if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { - return D3D_SetError("SetShader()", result); + D3D_SetError("SetShader()", result); + goto done; } } - result = - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, - vertices, sizeof(*vertices)); + result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, + vertices, sizeof(*vertices)); if (FAILED(result)) { - return D3D_SetError("DrawPrimitiveUP()", result); + D3D_SetError("DrawPrimitiveUP()", result); } +done: if (shader) { - result = IDirect3DDevice9_SetPixelShader(data->device, NULL); - if (FAILED(result)) { - return D3D_SetError("SetShader()", result); - } + IDirect3DDevice9_SetPixelShader(data->device, NULL); } modelMatrix = MatrixIdentity(); IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); - return 0; + + return FAILED(result) ? -1 : 0; } static int @@ -1936,6 +1765,8 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; if (data) { + int i; + /* Release the render target */ if (data->defaultRenderTarget) { IDirect3DSurface9_Release(data->defaultRenderTarget); @@ -1945,11 +1776,15 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } - if (data->ps_yuv) { - IDirect3DPixelShader9_Release(data->ps_yuv); + for (i = 0; i < SDL_arraysize(data->shaders); ++i) { + if (data->shaders[i]) { + IDirect3DPixelShader9_Release(data->shaders[i]); + data->shaders[i] = NULL; + } } if (data->device) { IDirect3DDevice9_Release(data->device); + data->device = NULL; } if (data->d3d) { IDirect3D9_Release(data->d3d); diff --git a/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c new file mode 100644 index 000000000..b95fddca8 --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c @@ -0,0 +1,274 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_render.h" +#include "SDL_system.h" + +#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED + +#include "../../core/windows/SDL_windows.h" + +#include + +#include "SDL_shaders_d3d.h" + +/* The shaders here were compiled with: + + fxc /T ps_2_0 /Fo"" "" + + Shader object code was converted to a list of DWORDs via the following + *nix style command (available separately from Windows + MSVC): + + hexdump -v -e '6/4 "0x%08.8x, " "\n"' +*/ + +/* --- D3D9_PixelShader_YUV_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_JPEG[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x00000000, 0x3fb374bc, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + +/* --- D3D9_PixelShader_YUV_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_BT601[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x00000000, 0x3fcc49ba, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + +/* --- D3D9_PixelShader_YUV_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_BT709[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x00000000, 0x3fe57732, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + + +static const DWORD *D3D9_shaders[] = { + D3D9_PixelShader_YUV_JPEG, + D3D9_PixelShader_YUV_BT601, + D3D9_PixelShader_YUV_BT709, +}; + +HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader) +{ + return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader); +} + +#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h new file mode 100644 index 000000000..854958277 --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* D3D9 shader implementation */ + +typedef enum { + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + NUM_SHADERS +} D3D9_Shader; + +extern HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c b/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c index df0f1558a..e0ccfc450 100644 --- a/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,10 +29,10 @@ #include "SDL_syswm.h" #include "../SDL_sysrender.h" #include "../SDL_d3dmath.h" -/* #include "SDL_log.h" */ #include +#include "SDL_shaders_d3d11.h" #ifdef __WINRT__ @@ -88,11 +88,24 @@ typedef struct ID3D11ShaderResourceView *mainTextureResourceViewU; ID3D11Texture2D *mainTextureV; ID3D11ShaderResourceView *mainTextureResourceViewV; + + /* NV12 texture support */ + SDL_bool nv12; + ID3D11Texture2D *mainTextureNV; + ID3D11ShaderResourceView *mainTextureResourceViewNV; + Uint8 *pixels; int pitch; SDL_Rect locked_rect; } D3D11_TextureData; +/* Blend mode data */ +typedef struct +{ + SDL_BlendMode blendMode; + ID3D11BlendState *blendState; +} D3D11_BlendMode; + /* Private renderer data */ typedef struct { @@ -109,12 +122,9 @@ typedef struct ID3D11InputLayout *inputLayout; ID3D11Buffer *vertexBuffer; ID3D11VertexShader *vertexShader; - ID3D11PixelShader *colorPixelShader; - ID3D11PixelShader *texturePixelShader; - ID3D11PixelShader *yuvPixelShader; - ID3D11BlendState *blendModeBlend; - ID3D11BlendState *blendModeAdd; - ID3D11BlendState *blendModeMod; + ID3D11PixelShader *pixelShaders[NUM_SHADERS]; + int blendModesCount; + D3D11_BlendMode *blendModes; ID3D11SamplerState *nearestPixelSampler; ID3D11SamplerState *linearSampler; D3D_FEATURE_LEVEL featureLevel; @@ -164,558 +174,12 @@ static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x #pragma GCC diagnostic pop #endif -/* Direct3D 11.x shaders - - SDL's shaders are compiled into SDL itself, to simplify distribution. - - All Direct3D 11.x shaders were compiled with the following: - - fxc /E"main" /T "" /Fo"" "" - - Variables: - - : the type of shader. A table of utilized shader types is - listed below. - - : where to store compiled output - - : where to read shader source code from - - Shader types: - - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT - - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT - - ps_4_0_level_9_3: Pixel shader for Windows Phone 8 - - vs_4_0_level_9_3: Vertex shader for Windows Phone 8 - - - Shader object code was converted to a list of DWORDs via the following - *nix style command (available separately from Windows + MSVC): - - hexdump -v -e '6/4 "0x%08.8x, " "\n"' - */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -#define D3D11_USE_SHADER_MODEL_4_0_level_9_3 -#else -#define D3D11_USE_SHADER_MODEL_4_0_level_9_1 -#endif - -/* The color-only-rendering pixel shader: - - --- D3D11_PixelShader_Colors.hlsl --- - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - return input.color; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_Colors[] = { - 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001, - 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, - 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, - 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, - 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, - 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, - 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, - 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, - 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, - 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_Colors[] = { - 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001, - 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, - 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, - 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, - 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, - 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, - 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, - 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, - 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, - 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'colors' pixel shader is not defined." -#endif - -/* The texture-rendering pixel shader: - - --- D3D11_PixelShader_Textures.hlsl --- - Texture2D theTexture : register(t0); - SamplerState theSampler : register(s0); - - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - return theTexture.Sample(theSampler, input.tex) * input.color; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_Textures[] = { - 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001, - 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, - 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, - 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, - 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000, - 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, - 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, - 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, - 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, - 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, - 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, - 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_Textures[] = { - 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001, - 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, - 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, - 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, - 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000, - 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, - 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, - 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, - 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, - 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, - 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, - 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'textures' pixel shader is not defined" -#endif - -/* The yuv-rendering pixel shader: - - --- D3D11_PixelShader_YUV.hlsl --- - Texture2D theTextureY : register(t0); - Texture2D theTextureU : register(t1); - Texture2D theTextureV : register(t2); - SamplerState theSampler : register(s0); - - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; - const float3 Rcoeff = {1.164, 0.000, 1.596}; - const float3 Gcoeff = {1.164, -0.391, -0.813}; - const float3 Bcoeff = {1.164, 2.018, 0.000}; - - float4 Output; - - float3 yuv; - yuv.x = theTextureY.Sample(theSampler, input.tex).r; - yuv.y = theTextureU.Sample(theSampler, input.tex).r; - yuv.z = theTextureV.Sample(theSampler, input.tex).r; - - yuv += offset; - Output.r = dot(yuv, Rcoeff); - Output.g = dot(yuv, Gcoeff); - Output.b = dot(yuv, Bcoeff); - Output.a = 1.0f; - - return Output * input.color; - } - -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_YUV[] = { - 0x43425844, 0x2321c6c6, 0xf14df2d1, 0xc79d068d, 0x8e672abf, 0x00000001, - 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, - 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, - 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, - 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, - 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, - 0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, - 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x05000051, - 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, - 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, - 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, - 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, - 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, - 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, - 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, - 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, - 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, - 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, - 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, - 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, - 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, - 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, - 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, - 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, - 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, - 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, - 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, - 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f94fdf4, 0x3fcc49ba, - 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, - 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, - 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, - 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x05000036, 0x00100082, - 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, - 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, - 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, - 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, - 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, - 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, - 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, - 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, - 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_YUV[] = { - 0x43425844, 0x6ede7360, 0x45ff5f8a, 0x34ac92ba, 0xb865f5e0, 0x00000001, - 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, - 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, - 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, - 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, - 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, - 0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x400126e9, 0x05000051, - 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, - 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, - 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, - 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, - 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, - 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, - 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, - 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, - 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, - 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, - 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, - 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, - 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, - 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, - 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, - 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, - 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, - 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, - 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, - 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, - 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, - 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, - 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, - 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, - 0x00000000, 0x00004002, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, - 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, - 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, - 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, - 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, - 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, - 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, - 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, - 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, - 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, - 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, - 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, - 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, - 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, - 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, - 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'yuv' pixel shader is not defined." -#endif - -/* The sole vertex shader: - - --- D3D11_VertexShader.hlsl --- - #pragma pack_matrix( row_major ) - - cbuffer VertexShaderConstants : register(b0) - { - matrix model; - matrix projectionAndView; - }; - - struct VertexShaderInput - { - float3 pos : POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - struct VertexShaderOutput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - VertexShaderOutput main(VertexShaderInput input) - { - VertexShaderOutput output; - float4 pos = float4(input.pos, 1.0f); - - // Transform the vertex position into projected space. - pos = mul(pos, model); - pos = mul(pos, projectionAndView); - output.pos = pos; - - // Pass through texture coordinates and color values without transformation - output.tex = input.tex; - output.color = input.color; - - return output; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_VertexShader[] = { - 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001, - 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, - 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, - 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, - 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200, - 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, - 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, - 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, - 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, - 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, - 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, - 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, - 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, - 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, - 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, - 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, - 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, - 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, - 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, - 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, - 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, - 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, - 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, - 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, - 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, - 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, - 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, - 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, - 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, - 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, - 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, - 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_VertexShader[] = { - 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001, - 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, - 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, - 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, - 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201, - 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, - 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, - 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, - 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, - 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, - 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, - 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, - 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, - 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, - 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, - 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, - 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, - 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, - 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, - 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, - 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, - 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, - 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, - 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, - 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, - 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, - 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, - 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, - 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, - 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, - 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, - 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f -}; -#else -#error "An appropriate vertex shader is not defined." -#endif - /* Direct3D 11.1 renderer implementation */ static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags); static void D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); +static SDL_bool D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *srcPixels, @@ -766,12 +230,14 @@ SDL_RenderDriver D3D11_RenderDriver = { SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE ), /* flags. see SDL_RendererFlags */ - 4, /* num_texture_formats */ + 6, /* num_texture_formats */ { /* texture_formats */ SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_YV12, - SDL_PIXELFORMAT_IYUV + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21 }, 0, /* max_texture_width: will be filled in later */ 0 /* max_texture_height: will be filled in later */ @@ -780,7 +246,8 @@ SDL_RenderDriver D3D11_RenderDriver = { Uint32 -D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) { +D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) +{ switch (dxgiFormat) { case DXGI_FORMAT_B8G8R8A8_UNORM: return SDL_PIXELFORMAT_ARGB8888; @@ -801,6 +268,8 @@ SDLPixelFormatToDXGIFormat(Uint32 sdlFormat) return DXGI_FORMAT_B8G8R8X8_UNORM; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: /* For the Y texture */ + case SDL_PIXELFORMAT_NV21: /* For the Y texture */ return DXGI_FORMAT_R8_UNORM; default: return DXGI_FORMAT_UNKNOWN; @@ -826,6 +295,7 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D11_WindowEvent; + renderer->SupportsBlendMode = D3D11_SupportsBlendMode; renderer->CreateTexture = D3D11_CreateTexture; renderer->UpdateTexture = D3D11_UpdateTexture; renderer->UpdateTextureYUV = D3D11_UpdateTextureYUV; @@ -898,6 +368,8 @@ D3D11_ReleaseAll(SDL_Renderer * renderer) /* Release/reset everything else */ if (data) { + int i; + SAFE_RELEASE(data->dxgiFactory); SAFE_RELEASE(data->dxgiAdapter); SAFE_RELEASE(data->d3dDevice); @@ -908,12 +380,17 @@ D3D11_ReleaseAll(SDL_Renderer * renderer) SAFE_RELEASE(data->inputLayout); SAFE_RELEASE(data->vertexBuffer); SAFE_RELEASE(data->vertexShader); - SAFE_RELEASE(data->colorPixelShader); - SAFE_RELEASE(data->texturePixelShader); - SAFE_RELEASE(data->yuvPixelShader); - SAFE_RELEASE(data->blendModeBlend); - SAFE_RELEASE(data->blendModeAdd); - SAFE_RELEASE(data->blendModeMod); + for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) { + SAFE_RELEASE(data->pixelShaders[i]); + } + if (data->blendModesCount > 0) { + for (i = 0; i < data->blendModesCount; ++i) { + SAFE_RELEASE(data->blendModes[i].blendState); + } + SDL_free(data->blendModes); + + data->blendModesCount = 0; + } SAFE_RELEASE(data->nearestPixelSampler); SAFE_RELEASE(data->linearSampler); SAFE_RELEASE(data->mainRasterizer); @@ -954,37 +431,96 @@ D3D11_DestroyRenderer(SDL_Renderer * renderer) SDL_free(renderer); } -static HRESULT -D3D11_CreateBlendMode(SDL_Renderer * renderer, - BOOL enableBlending, - D3D11_BLEND srcBlend, - D3D11_BLEND destBlend, - D3D11_BLEND srcBlendAlpha, - D3D11_BLEND destBlendAlpha, - ID3D11BlendState ** blendStateOutput) +static D3D11_BLEND GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return D3D11_BLEND_ZERO; + case SDL_BLENDFACTOR_ONE: + return D3D11_BLEND_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return D3D11_BLEND_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return D3D11_BLEND_INV_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return D3D11_BLEND_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return D3D11_BLEND_INV_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return D3D11_BLEND_DEST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return D3D11_BLEND_INV_DEST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return D3D11_BLEND_DEST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return D3D11_BLEND_INV_DEST_ALPHA; + default: + return (D3D11_BLEND)0; + } +} + +static D3D11_BLEND_OP GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return D3D11_BLEND_OP_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return D3D11_BLEND_OP_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return D3D11_BLEND_OP_REV_SUBTRACT; + case SDL_BLENDOPERATION_MINIMUM: + return D3D11_BLEND_OP_MIN; + case SDL_BLENDOPERATION_MAXIMUM: + return D3D11_BLEND_OP_MAX; + default: + return (D3D11_BLEND_OP)0; + } +} + +static SDL_bool +D3D11_CreateBlendState(SDL_Renderer * renderer, SDL_BlendMode blendMode) { D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + ID3D11BlendState *blendState = NULL; + D3D11_BlendMode *blendModes; HRESULT result = S_OK; D3D11_BLEND_DESC blendDesc; SDL_zero(blendDesc); blendDesc.AlphaToCoverageEnable = FALSE; blendDesc.IndependentBlendEnable = FALSE; - blendDesc.RenderTarget[0].BlendEnable = enableBlending; - blendDesc.RenderTarget[0].SrcBlend = srcBlend; - blendDesc.RenderTarget[0].DestBlend = destBlend; - blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - blendDesc.RenderTarget[0].SrcBlendAlpha = srcBlendAlpha; - blendDesc.RenderTarget[0].DestBlendAlpha = destBlendAlpha; - blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].BlendEnable = TRUE; + blendDesc.RenderTarget[0].SrcBlend = GetBlendFunc(srcColorFactor); + blendDesc.RenderTarget[0].DestBlend = GetBlendFunc(dstColorFactor); + blendDesc.RenderTarget[0].BlendOp = GetBlendEquation(colorOperation); + blendDesc.RenderTarget[0].SrcBlendAlpha = GetBlendFunc(srcAlphaFactor); + blendDesc.RenderTarget[0].DestBlendAlpha = GetBlendFunc(dstAlphaFactor); + blendDesc.RenderTarget[0].BlendOpAlpha = GetBlendEquation(alphaOperation); blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, blendStateOutput); + result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, &blendState); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBlendState"), result); - return result; + return SDL_FALSE; } - return S_OK; + blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes)); + if (!blendModes) { + SAFE_RELEASE(blendState); + SDL_OutOfMemory(); + return SDL_FALSE; + } + blendModes[data->blendModesCount].blendMode = blendMode; + blendModes[data->blendModesCount].blendState = blendState; + data->blendModes = blendModes; + ++data->blendModesCount; + + return SDL_TRUE; } /* Create resources that depend on the device. */ @@ -1000,6 +536,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) IDXGIDevice1 *dxgiDevice = NULL; HRESULT result = S_OK; UINT creationFlags; + int i; /* This array defines the set of DirectX hardware feature levels this app will support. * Note the ordering should be preserved. @@ -1017,14 +554,6 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) D3D_FEATURE_LEVEL_9_1 }; - /* Declare how the input layout for SDL's vertex shader will be setup: */ - const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - D3D11_BUFFER_DESC constantBufferDesc; D3D11_SAMPLER_DESC samplerDesc; D3D11_RASTERIZER_DESC rasterDesc; @@ -1156,63 +685,14 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) goto done; } - /* Load in SDL's one and only vertex shader: */ - result = ID3D11Device_CreateVertexShader(data->d3dDevice, - D3D11_VertexShader, - sizeof(D3D11_VertexShader), - NULL, - &data->vertexShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result); + if (D3D11_CreateVertexShader(data->d3dDevice, &data->vertexShader, &data->inputLayout) < 0) { goto done; } - /* Create an input layout for SDL's vertex shader: */ - result = ID3D11Device_CreateInputLayout(data->d3dDevice, - vertexDesc, - ARRAYSIZE(vertexDesc), - D3D11_VertexShader, - sizeof(D3D11_VertexShader), - &data->inputLayout - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result); - goto done; - } - - /* Load in SDL's pixel shaders */ - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_Colors, - sizeof(D3D11_PixelShader_Colors), - NULL, - &data->colorPixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['color' shader]"), result); - goto done; - } - - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_Textures, - sizeof(D3D11_PixelShader_Textures), - NULL, - &data->texturePixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['textures' shader]"), result); - goto done; - } - - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_YUV, - sizeof(D3D11_PixelShader_YUV), - NULL, - &data->yuvPixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['yuv' shader]"), result); - goto done; + for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) { + if (D3D11_CreatePixelShader(data->d3dDevice, (D3D11_Shader)i, &data->pixelShaders[i]) < 0) { + goto done; + } } /* Setup space to hold vertex shader constants: */ @@ -1286,41 +766,9 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) } /* Create blending states: */ - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_SRC_ALPHA, /* srcBlend */ - D3D11_BLEND_INV_SRC_ALPHA, /* destBlend */ - D3D11_BLEND_ONE, /* srcBlendAlpha */ - D3D11_BLEND_INV_SRC_ALPHA, /* destBlendAlpha */ - &data->blendModeBlend); - if (FAILED(result)) { - /* D3D11_CreateBlendMode will set the SDL error, if it fails */ - goto done; - } - - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_SRC_ALPHA, /* srcBlend */ - D3D11_BLEND_ONE, /* destBlend */ - D3D11_BLEND_ZERO, /* srcBlendAlpha */ - D3D11_BLEND_ONE, /* destBlendAlpha */ - &data->blendModeAdd); - if (FAILED(result)) { - /* D3D11_CreateBlendMode will set the SDL error, if it fails */ - goto done; - } - - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_ZERO, /* srcBlend */ - D3D11_BLEND_SRC_COLOR, /* destBlend */ - D3D11_BLEND_ZERO, /* srcBlendAlpha */ - D3D11_BLEND_ONE, /* destBlendAlpha */ - &data->blendModeMod); - if (FAILED(result)) { + if (!D3D11_CreateBlendState(renderer, SDL_BLENDMODE_BLEND) || + !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_ADD) || + !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_MOD)) { /* D3D11_CreateBlendMode will set the SDL error, if it fails */ goto done; } @@ -1694,6 +1142,25 @@ D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } +static SDL_bool +D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || + !GetBlendEquation(colorOperation) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) || + !GetBlendEquation(alphaOperation)) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static D3D11_FILTER GetScaleQuality(void) { @@ -1768,8 +1235,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture->format == SDL_PIXELFORMAT_IYUV) { textureData->yuv = SDL_TRUE; - textureDesc.Width /= 2; - textureDesc.Height /= 2; + textureDesc.Width = (textureDesc.Width + 1) / 2; + textureDesc.Height = (textureDesc.Height + 1) / 2; result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, &textureDesc, @@ -1794,6 +1261,28 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } } + if (texture->format == SDL_PIXELFORMAT_NV12 || + texture->format == SDL_PIXELFORMAT_NV21) { + D3D11_TEXTURE2D_DESC nvTextureDesc = textureDesc; + + textureData->nv12 = SDL_TRUE; + + nvTextureDesc.Format = DXGI_FORMAT_R8G8_UNORM; + nvTextureDesc.Width = (textureDesc.Width + 1) / 2; + nvTextureDesc.Height = (textureDesc.Height + 1) / 2; + + result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, + &nvTextureDesc, + NULL, + &textureData->mainTextureNV + ); + if (FAILED(result)) { + D3D11_DestroyTexture(renderer, texture); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + return -1; + } + } + resourceViewDesc.Format = textureDesc.Format; resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceViewDesc.Texture2D.MostDetailedMip = 0; @@ -1832,6 +1321,23 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } } + if (textureData->nv12) { + D3D11_SHADER_RESOURCE_VIEW_DESC nvResourceViewDesc = resourceViewDesc; + + nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM; + + result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, + (ID3D11Resource *)textureData->mainTextureNV, + &nvResourceViewDesc, + &textureData->mainTextureResourceViewNV + ); + if (FAILED(result)) { + D3D11_DestroyTexture(renderer, texture); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + return -1; + } + } + if (texture->access & SDL_TEXTUREACCESS_TARGET) { D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; renderTargetViewDesc.Format = textureDesc.Format; @@ -1876,7 +1382,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer, } static int -D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch) +D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch) { ID3D11Texture2D *stagingTexture; const Uint8 *src; @@ -1920,7 +1426,7 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex src = (const Uint8 *)pixels; dst = textureMemory.pData; - length = w * SDL_BYTESPERPIXEL(format); + length = w * bpp; if (length == pitch && length == textureMemory.RowPitch) { SDL_memcpy(dst, src, length*h); } else { @@ -1971,7 +1477,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { return -1; } @@ -1979,13 +1485,22 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, /* Skip to the correct offset into the next texture */ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); - if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) { return -1; } /* Skip to the correct offset into the next texture */ - srcPixels = (const void*)((const Uint8*)srcPixels + (rect->h * srcPitch) / 4); - if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) { + srcPixels = (const void*)((const Uint8*)srcPixels + ((rect->h + 1) / 2) * ((srcPitch + 1) / 2)); + if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) { + return -1; + } + } + + if (textureData->nv12) { + /* Skip to the correct offset into the next texture */ + srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); + + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, srcPixels, 2*((srcPitch + 1) / 2)) < 0) { return -1; } } @@ -2007,13 +1522,13 @@ D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { return -1; } return 0; @@ -2034,7 +1549,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (textureData->yuv) { + if (textureData->yuv || textureData->nv12) { /* It's more efficient to upload directly... */ if (!textureData->pixels) { textureData->pitch = texture->w; @@ -2117,7 +1632,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) return; } - if (textureData->yuv) { + if (textureData->yuv || textureData->nv12) { const SDL_Rect *rect = &textureData->locked_rect; void *pixels = (void *) ((Uint8 *) textureData->pixels + rect->y * textureData->pitch + @@ -2443,19 +1958,21 @@ D3D11_RenderSetBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; ID3D11BlendState *blendState = NULL; - switch (blendMode) { - case SDL_BLENDMODE_BLEND: - blendState = rendererData->blendModeBlend; - break; - case SDL_BLENDMODE_ADD: - blendState = rendererData->blendModeAdd; - break; - case SDL_BLENDMODE_MOD: - blendState = rendererData->blendModeMod; - break; - case SDL_BLENDMODE_NONE: - blendState = NULL; - break; + if (blendMode != SDL_BLENDMODE_NONE) { + int i; + for (i = 0; i < rendererData->blendModesCount; ++i) { + if (blendMode == rendererData->blendModes[i].blendMode) { + blendState = rendererData->blendModes[i].blendState; + break; + } + } + if (!blendState) { + if (D3D11_CreateBlendState(renderer, blendMode)) { + /* Successfully created the blend state, try again */ + D3D11_RenderSetBlendMode(renderer, blendMode); + } + return; + } } if (blendState != rendererData->currentBlendState) { ID3D11DeviceContext_OMSetBlendState(rendererData->d3dContext, blendState, 0, 0xFFFFFFFF); @@ -2518,7 +2035,7 @@ D3D11_RenderDrawPoints(SDL_Renderer * renderer, vertices = SDL_stack_alloc(VertexPositionColor, count); for (i = 0; i < count; ++i) { - const VertexPositionColor v = { { points[i].x, points[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; + const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; vertices[i] = v; } @@ -2531,7 +2048,7 @@ D3D11_RenderDrawPoints(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); @@ -2557,7 +2074,7 @@ D3D11_RenderDrawLines(SDL_Renderer * renderer, vertices = SDL_stack_alloc(VertexPositionColor, count); for (i = 0; i < count; ++i) { - const VertexPositionColor v = { { points[i].x, points[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; + const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; vertices[i] = v; } @@ -2570,12 +2087,18 @@ D3D11_RenderDrawLines(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, count); + + if (points[0].x != points[count - 1].x || points[0].y != points[count - 1].y) { + ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + ID3D11DeviceContext_Draw(rendererData->d3dContext, 1, count - 1); + } + SDL_stack_free(vertices); return 0; } @@ -2609,7 +2132,7 @@ D3D11_RenderFillRects(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); @@ -2620,20 +2143,91 @@ D3D11_RenderFillRects(SDL_Renderer * renderer, return 0; } -static ID3D11SamplerState * -D3D11_RenderGetSampler(SDL_Renderer * renderer, SDL_Texture * texture) +static int +D3D11_RenderSetupSampler(SDL_Renderer * renderer, SDL_Texture * texture) { D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata; D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata; + ID3D11SamplerState *textureSampler; switch (textureData->scaleMode) { case D3D11_FILTER_MIN_MAG_MIP_POINT: - return rendererData->nearestPixelSampler; + textureSampler = rendererData->nearestPixelSampler; + break; case D3D11_FILTER_MIN_MAG_MIP_LINEAR: - return rendererData->linearSampler; + textureSampler = rendererData->linearSampler; + break; default: - return NULL; + return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); } + + if (textureData->yuv) { + ID3D11ShaderResourceView *shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewU, + textureData->mainTextureResourceViewV + }; + D3D11_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = SHADER_YUV_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = SHADER_YUV_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = SHADER_YUV_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[shader], + SDL_arraysize(shaderResources), + shaderResources, + textureSampler); + + } else if (textureData->nv12) { + ID3D11ShaderResourceView *shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewNV, + }; + D3D11_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[shader], + SDL_arraysize(shaderResources), + shaderResources, + textureSampler); + + } else { + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[SHADER_RGB], + 1, + &textureData->mainTextureResourceView, + textureSampler); + } + + return 0; } static int @@ -2645,7 +2239,6 @@ D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, float minu, maxu, minv, maxv; Float4 color; VertexPositionColor vertices[4]; - ID3D11SamplerState *textureSampler; D3D11_RenderStartDrawOp(renderer); D3D11_RenderSetBlendMode(renderer, texture->blendMode); @@ -2700,26 +2293,8 @@ D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - textureSampler = D3D11_RenderGetSampler(renderer, texture); - if (textureData->yuv) { - ID3D11ShaderResourceView *shaderResources[] = { - textureData->mainTextureResourceView, - textureData->mainTextureResourceViewU, - textureData->mainTextureResourceViewV - }; - D3D11_SetPixelShader( - renderer, - rendererData->yuvPixelShader, - SDL_arraysize(shaderResources), - shaderResources, - textureSampler); - } else { - D3D11_SetPixelShader( - renderer, - rendererData->texturePixelShader, - 1, - &textureData->mainTextureResourceView, - textureSampler); + if (D3D11_RenderSetupSampler(renderer, texture) < 0) { + return -1; } D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor)); @@ -2739,7 +2314,6 @@ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, Float4X4 modelMatrix; float minx, maxx, miny, maxy; VertexPositionColor vertices[4]; - ID3D11SamplerState *textureSampler; D3D11_RenderStartDrawOp(renderer); D3D11_RenderSetBlendMode(renderer, texture->blendMode); @@ -2816,26 +2390,8 @@ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - textureSampler = D3D11_RenderGetSampler(renderer, texture); - if (textureData->yuv) { - ID3D11ShaderResourceView *shaderResources[] = { - textureData->mainTextureResourceView, - textureData->mainTextureResourceViewU, - textureData->mainTextureResourceViewV - }; - D3D11_SetPixelShader( - renderer, - rendererData->yuvPixelShader, - SDL_arraysize(shaderResources), - shaderResources, - textureSampler); - } else { - D3D11_SetPixelShader( - renderer, - rendererData->texturePixelShader, - 1, - &textureData->mainTextureResourceView, - textureSampler); + if (D3D11_RenderSetupSampler(renderer, texture) < 0) { + return -1; } D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor)); diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp index 99f2b4ea4..2f2c3e54b 100644 --- a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h index 734ebf41a..7bb8fb78b 100644 --- a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c new file mode 100644 index 000000000..f1277b9c0 --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c @@ -0,0 +1,1957 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED + +#include "SDL_stdinc.h" + +#define COBJMACROS +#include "../../core/windows/SDL_windows.h" +#include + +#include "SDL_shaders_d3d11.h" + +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str + + +/* Direct3D 11.x shaders + + SDL's shaders are compiled into SDL itself, to simplify distribution. + + All Direct3D 11.x shaders were compiled with the following: + + fxc /E"main" /T "" /Fo"" "" + + Variables: + - : the type of shader. A table of utilized shader types is + listed below. + - : where to store compiled output + - : where to read shader source code from + + Shader types: + - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT + - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT + - ps_4_0_level_9_3: Pixel shader for Windows Phone 8 + - vs_4_0_level_9_3: Vertex shader for Windows Phone 8 + + + Shader object code was converted to a list of DWORDs via the following + *nix style command (available separately from Windows + MSVC): + + hexdump -v -e '6/4 "0x%08.8x, " "\n"' + */ +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#define D3D11_USE_SHADER_MODEL_4_0_level_9_3 +#else +#define D3D11_USE_SHADER_MODEL_4_0_level_9_1 +#endif + +/* The color-only-rendering pixel shader: + + --- D3D11_PixelShader_Colors.hlsl --- + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + return input.color; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_Colors[] = { + 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001, + 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, + 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, + 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, + 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, + 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, + 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, + 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, + 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, + 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_Colors[] = { + 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001, + 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, + 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, + 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, + 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, + 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, + 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, + 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, + 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, + 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'colors' pixel shader is not defined." +#endif + +/* The texture-rendering pixel shader: + + --- D3D11_PixelShader_Textures.hlsl --- + Texture2D theTexture : register(t0); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + return theTexture.Sample(theSampler, input.tex) * input.color; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_Textures[] = { + 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001, + 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, + 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, + 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, + 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000, + 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, + 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, + 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, + 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, + 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, + 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, + 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_Textures[] = { + 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001, + 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, + 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, + 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, + 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000, + 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, + 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, + 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, + 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, + 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, + 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, + 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'textures' pixel shader is not defined" +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_JPEG[] = { + 0x43425844, 0x10359e9c, 0x92c3d2c4, 0x00bf0cd5, 0x5ce8c499, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_JPEG[] = { + 0x43425844, 0x616d6673, 0x83174178, 0x15aac25d, 0x2a340487, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, + 0xa00f0001, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, + 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_BT601[] = { + 0x43425844, 0x628ec838, 0xbe9cec6a, 0xc9ee10bb, 0x63283218, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_BT601[] = { + 0x43425844, 0x692b159b, 0xf58723cc, 0xf4ceac9e, 0x35eec738, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, + 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_BT709[] = { + 0x43425844, 0x5045fa84, 0xc2908cce, 0x278dacc3, 0xd4276f8f, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_BT709[] = { + 0x43425844, 0x72d13260, 0xf6c36f65, 0x8b9b28f5, 0x5010733c, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, + 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_JPEG[] = { + 0x43425844, 0x8fb9c77a, 0xe9e39686, 0x62b0e0e9, 0xd2bf8183, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, + 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_JPEG[] = { + 0x43425844, 0xe33e5d8b, 0x1b5f6461, 0x1afee99f, 0xcc345c04, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, + 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_BT601[] = { + 0x43425844, 0xd1d24a0c, 0x337c447a, 0x22b55cff, 0xb5c9c74b, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, + 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_BT601[] = { + 0x43425844, 0x84b8b692, 0x589b9edd, 0x51ef2f0b, 0xf7247962, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_BT709[] = { + 0x43425844, 0x40d1b8d5, 0xaf4b78b5, 0x907fd0b5, 0xa2d23686, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, + 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_BT709[] = { + 0x43425844, 0xa3bba187, 0x71b6afa9, 0x15998682, 0x2d545cae, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_JPEG[] = { + 0x43425844, 0x9c41f579, 0xfd1019d8, 0x7c27e3ae, 0x52e3a5ff, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_JPEG[] = { + 0x43425844, 0x5705ccc9, 0xeb57571d, 0x8ce556e0, 0x2adef743, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, + 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_BT601[] = { + 0x43425844, 0x7fc6cfdc, 0xba87a4ff, 0xa72685a6, 0xa051b38c, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_BT601[] = { + 0x43425844, 0x1e92bca4, 0xfeb04e20, 0x3f4226b1, 0xc89c58ad, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_BT709[] = { + 0x43425844, 0x754ba6c4, 0xe321a747, 0x23680787, 0x6bb1bdcc, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_BT709[] = { + 0x43425844, 0xb6219b20, 0xb71bbcf7, 0xf361cc45, 0xc4d5f5be, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The sole vertex shader: + + --- D3D11_VertexShader.hlsl --- + #pragma pack_matrix( row_major ) + + cbuffer VertexShaderConstants : register(b0) + { + matrix model; + matrix projectionAndView; + }; + + struct VertexShaderInput + { + float3 pos : POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + struct VertexShaderOutput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + VertexShaderOutput main(VertexShaderInput input) + { + VertexShaderOutput output; + float4 pos = float4(input.pos, 1.0f); + + // Transform the vertex position into projected space. + pos = mul(pos, model); + pos = mul(pos, projectionAndView); + output.pos = pos; + + // Pass through texture coordinates and color values without transformation + output.tex = input.tex; + output.color = input.color; + + return output; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_VertexShader[] = { + 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001, + 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, + 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, + 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, + 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200, + 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, + 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, + 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, + 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, + 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, + 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, + 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, + 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, + 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, + 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, + 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, + 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, + 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, + 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, + 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, + 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, + 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, + 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, + 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, + 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, + 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, + 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, + 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, + 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, + 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, + 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, + 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, + 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, + 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, + 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, + 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, + 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, + 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_VertexShader[] = { + 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001, + 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, + 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, + 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, + 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201, + 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, + 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, + 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, + 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, + 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, + 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, + 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, + 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, + 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, + 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, + 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, + 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, + 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, + 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, + 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, + 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, + 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, + 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, + 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, + 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, + 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, + 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, + 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, + 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, + 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, + 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, + 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, + 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, + 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, + 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, + 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, + 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, + 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f +}; +#else +#error "An appropriate vertex shader is not defined." +#endif + +static struct +{ + const void *shader_data; + SIZE_T shader_size; +} D3D11_shaders[] = { + { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) }, + { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) }, + { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) }, + { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) }, + { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) }, + { D3D11_PixelShader_NV12_JPEG, sizeof(D3D11_PixelShader_NV12_JPEG) }, + { D3D11_PixelShader_NV12_BT601, sizeof(D3D11_PixelShader_NV12_BT601) }, + { D3D11_PixelShader_NV12_BT709, sizeof(D3D11_PixelShader_NV12_BT709) }, + { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) }, + { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) }, + { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) }, +}; + +int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout) +{ + /* Declare how the input layout for SDL's vertex shader will be setup: */ + const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + HRESULT result; + + /* Load in SDL's one and only vertex shader: */ + result = ID3D11Device_CreateVertexShader(d3dDevice, + D3D11_VertexShader, + sizeof(D3D11_VertexShader), + NULL, + vertexShader + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result); + } + + /* Create an input layout for SDL's vertex shader: */ + result = ID3D11Device_CreateInputLayout(d3dDevice, + vertexDesc, + ARRAYSIZE(vertexDesc), + D3D11_VertexShader, + sizeof(D3D11_VertexShader), + inputLayout + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result); + } + return 0; +} + +int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader) +{ + HRESULT result; + + result = ID3D11Device_CreatePixelShader(d3dDevice, + D3D11_shaders[shader].shader_data, + D3D11_shaders[shader].shader_size, + NULL, + pixelShader + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader"), result); + } + return 0; +} + +#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h new file mode 100644 index 000000000..b28b5728f --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h @@ -0,0 +1,43 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* D3D11 shader implementation */ + +typedef enum { + SHADER_SOLID, + SHADER_RGB, + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + SHADER_NV12_JPEG, + SHADER_NV12_BT601, + SHADER_NV12_BT709, + SHADER_NV21_JPEG, + SHADER_NV21_BT601, + SHADER_NV21_BT709, + NUM_SHADERS +} D3D11_Shader; + +extern int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout); +extern int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/metal/SDL_render_metal.m b/Engine/lib/sdl/src/render/metal/SDL_render_metal.m new file mode 100644 index 000000000..f7af72d42 --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_render_metal.m @@ -0,0 +1,1429 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED + +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_assert.h" +#include "SDL_syswm.h" +#include "../SDL_sysrender.h" + +#ifdef __MACOSX__ +#include "../../video/cocoa/SDL_cocoametalview.h" +#else +#include "../../video/uikit/SDL_uikitmetalview.h" +#endif +#include +#import +#import + +/* Regenerate these with build-metal-shaders.sh */ +#ifdef __MACOSX__ +#include "SDL_shaders_metal_osx.h" +#else +#include "SDL_shaders_metal_ios.h" +#endif + +/* Apple Metal renderer implementation */ + +static SDL_Renderer *METAL_CreateRenderer(SDL_Window * window, Uint32 flags); +static void METAL_WindowEvent(SDL_Renderer * renderer, + const SDL_WindowEvent *event); +static int METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); +static int METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, + int pitch); +static int METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch); +static int METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch); +static void METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_UpdateViewport(SDL_Renderer * renderer); +static int METAL_UpdateClipRect(SDL_Renderer * renderer); +static int METAL_RenderClear(SDL_Renderer * renderer); +static int METAL_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int METAL_RenderDrawLines(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int METAL_RenderFillRects(SDL_Renderer * renderer, + const SDL_FRect * rects, int count); +static int METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect); +static int METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect, + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip); +static int METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch); +static void METAL_RenderPresent(SDL_Renderer * renderer); +static void METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static void METAL_DestroyRenderer(SDL_Renderer * renderer); +static void *METAL_GetMetalLayer(SDL_Renderer * renderer); +static void *METAL_GetMetalCommandEncoder(SDL_Renderer * renderer); + +SDL_RenderDriver METAL_RenderDriver = { + METAL_CreateRenderer, + { + "metal", + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), + 6, + { + SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21 + }, + 0, 0, + } +}; + +/* macOS requires constants in a buffer to have a 256 byte alignment. */ +#ifdef __MACOSX__ +#define CONSTANT_ALIGN 256 +#else +#define CONSTANT_ALIGN 4 +#endif + +#define ALIGN_CONSTANTS(size) ((size + CONSTANT_ALIGN - 1) & (~(CONSTANT_ALIGN - 1))) + +static const size_t CONSTANTS_OFFSET_IDENTITY = 0; +static const size_t CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM = ALIGN_CONSTANTS(CONSTANTS_OFFSET_IDENTITY + sizeof(float) * 16); +static const size_t CONSTANTS_OFFSET_DECODE_JPEG = ALIGN_CONSTANTS(CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM + sizeof(float) * 16); +static const size_t CONSTANTS_OFFSET_DECODE_BT601 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_JPEG + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_OFFSET_DECODE_BT709 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT601 + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_OFFSET_CLEAR_VERTS = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT709 + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_LENGTH = CONSTANTS_OFFSET_CLEAR_VERTS + sizeof(float) * 6; + +typedef enum SDL_MetalVertexFunction +{ + SDL_METAL_VERTEX_SOLID, + SDL_METAL_VERTEX_COPY, +} SDL_MetalVertexFunction; + +typedef enum SDL_MetalFragmentFunction +{ + SDL_METAL_FRAGMENT_SOLID = 0, + SDL_METAL_FRAGMENT_COPY, + SDL_METAL_FRAGMENT_YUV, + SDL_METAL_FRAGMENT_NV12, + SDL_METAL_FRAGMENT_NV21, + SDL_METAL_FRAGMENT_COUNT, +} SDL_MetalFragmentFunction; + +typedef struct METAL_PipelineState +{ + SDL_BlendMode blendMode; + void *pipe; +} METAL_PipelineState; + +typedef struct METAL_PipelineCache +{ + METAL_PipelineState *states; + int count; + SDL_MetalVertexFunction vertexFunction; + SDL_MetalFragmentFunction fragmentFunction; + MTLPixelFormat renderTargetFormat; + const char *label; +} METAL_PipelineCache; + +/* Each shader combination used by drawing functions has a separate pipeline + * cache, and we have a separate list of caches for each render target pixel + * format. This is more efficient than iterating over a global cache to find + * the pipeline based on the specified shader combination and RT pixel format, + * since we know what the RT pixel format is when we set the render target, and + * we know what the shader combination is inside each drawing function's code. */ +typedef struct METAL_ShaderPipelines +{ + MTLPixelFormat renderTargetFormat; + METAL_PipelineCache caches[SDL_METAL_FRAGMENT_COUNT]; +} METAL_ShaderPipelines; + +@interface METAL_RenderData : NSObject + @property (nonatomic, retain) id mtldevice; + @property (nonatomic, retain) id mtlcmdqueue; + @property (nonatomic, retain) id mtlcmdbuffer; + @property (nonatomic, retain) id mtlcmdencoder; + @property (nonatomic, retain) id mtllibrary; + @property (nonatomic, retain) id mtlbackbuffer; + @property (nonatomic, retain) id mtlsamplernearest; + @property (nonatomic, retain) id mtlsamplerlinear; + @property (nonatomic, retain) id mtlbufconstants; + @property (nonatomic, retain) CAMetalLayer *mtllayer; + @property (nonatomic, retain) MTLRenderPassDescriptor *mtlpassdesc; + @property (nonatomic, assign) METAL_ShaderPipelines *activepipelines; + @property (nonatomic, assign) METAL_ShaderPipelines *allpipelines; + @property (nonatomic, assign) int pipelinescount; +@end + +@implementation METAL_RenderData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtldevice release]; + [_mtlcmdqueue release]; + [_mtlcmdbuffer release]; + [_mtlcmdencoder release]; + [_mtllibrary release]; + [_mtlbackbuffer release]; + [_mtlsamplernearest release]; + [_mtlsamplerlinear release]; + [_mtlbufconstants release]; + [_mtllayer release]; + [_mtlpassdesc release]; + [super dealloc]; +} +#endif +@end + +@interface METAL_TextureData : NSObject + @property (nonatomic, retain) id mtltexture; + @property (nonatomic, retain) id mtltexture_uv; + @property (nonatomic, retain) id mtlsampler; + @property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction; + @property (nonatomic, assign) BOOL yuv; + @property (nonatomic, assign) BOOL nv12; + @property (nonatomic, assign) size_t conversionBufferOffset; +@end + +@implementation METAL_TextureData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtltexture release]; + [_mtltexture_uv release]; + [_mtlsampler release]; + [super dealloc]; +} +#endif +@end + +static int +IsMetalAvailable(const SDL_SysWMinfo *syswm) +{ + if (syswm->subsystem != SDL_SYSWM_COCOA && syswm->subsystem != SDL_SYSWM_UIKIT) { + return SDL_SetError("Metal render target only supports Cocoa and UIKit video targets at the moment."); + } + + // this checks a weak symbol. +#if (defined(__MACOSX__) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)) + if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower. + return SDL_SetError("Metal framework not available on this system"); + } +#endif + + return 0; +} + +static const MTLBlendOperation invalidBlendOperation = (MTLBlendOperation)0xFFFFFFFF; +static const MTLBlendFactor invalidBlendFactor = (MTLBlendFactor)0xFFFFFFFF; + +static MTLBlendOperation +GetBlendOperation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: return MTLBlendOperationAdd; + case SDL_BLENDOPERATION_SUBTRACT: return MTLBlendOperationSubtract; + case SDL_BLENDOPERATION_REV_SUBTRACT: return MTLBlendOperationReverseSubtract; + case SDL_BLENDOPERATION_MINIMUM: return MTLBlendOperationMin; + case SDL_BLENDOPERATION_MAXIMUM: return MTLBlendOperationMax; + default: return invalidBlendOperation; + } +} + +static MTLBlendFactor +GetBlendFactor(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: return MTLBlendFactorZero; + case SDL_BLENDFACTOR_ONE: return MTLBlendFactorOne; + case SDL_BLENDFACTOR_SRC_COLOR: return MTLBlendFactorSourceColor; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: return MTLBlendFactorOneMinusSourceColor; + case SDL_BLENDFACTOR_SRC_ALPHA: return MTLBlendFactorSourceAlpha; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: return MTLBlendFactorOneMinusSourceAlpha; + case SDL_BLENDFACTOR_DST_COLOR: return MTLBlendFactorDestinationColor; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: return MTLBlendFactorOneMinusDestinationColor; + case SDL_BLENDFACTOR_DST_ALPHA: return MTLBlendFactorDestinationAlpha; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: return MTLBlendFactorOneMinusDestinationAlpha; + default: return invalidBlendFactor; + } +} + +static NSString * +GetVertexFunctionName(SDL_MetalVertexFunction function) +{ + switch (function) { + case SDL_METAL_VERTEX_SOLID: return @"SDL_Solid_vertex"; + case SDL_METAL_VERTEX_COPY: return @"SDL_Copy_vertex"; + default: return nil; + } +} + +static NSString * +GetFragmentFunctionName(SDL_MetalFragmentFunction function) +{ + switch (function) { + case SDL_METAL_FRAGMENT_SOLID: return @"SDL_Solid_fragment"; + case SDL_METAL_FRAGMENT_COPY: return @"SDL_Copy_fragment"; + case SDL_METAL_FRAGMENT_YUV: return @"SDL_YUV_fragment"; + case SDL_METAL_FRAGMENT_NV12: return @"SDL_NV12_fragment"; + case SDL_METAL_FRAGMENT_NV21: return @"SDL_NV21_fragment"; + default: return nil; + } +} + +static id +MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache, + NSString *blendlabel, SDL_BlendMode blendmode) +{ + id mtlvertfn = [data.mtllibrary newFunctionWithName:GetVertexFunctionName(cache->vertexFunction)]; + id mtlfragfn = [data.mtllibrary newFunctionWithName:GetFragmentFunctionName(cache->fragmentFunction)]; + SDL_assert(mtlvertfn != nil); + SDL_assert(mtlfragfn != nil); + + MTLRenderPipelineDescriptor *mtlpipedesc = [[MTLRenderPipelineDescriptor alloc] init]; + mtlpipedesc.vertexFunction = mtlvertfn; + mtlpipedesc.fragmentFunction = mtlfragfn; + + MTLRenderPipelineColorAttachmentDescriptor *rtdesc = mtlpipedesc.colorAttachments[0]; + + rtdesc.pixelFormat = cache->renderTargetFormat; + + if (blendmode != SDL_BLENDMODE_NONE) { + rtdesc.blendingEnabled = YES; + rtdesc.sourceRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcColorFactor(blendmode)); + rtdesc.destinationRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeDstColorFactor(blendmode)); + rtdesc.rgbBlendOperation = GetBlendOperation(SDL_GetBlendModeColorOperation(blendmode)); + rtdesc.sourceAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcAlphaFactor(blendmode)); + rtdesc.destinationAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeDstAlphaFactor(blendmode)); + rtdesc.alphaBlendOperation = GetBlendOperation(SDL_GetBlendModeAlphaOperation(blendmode)); + } else { + rtdesc.blendingEnabled = NO; + } + + mtlpipedesc.label = [@(cache->label) stringByAppendingString:blendlabel]; + + NSError *err = nil; + id state = [data.mtldevice newRenderPipelineStateWithDescriptor:mtlpipedesc error:&err]; + SDL_assert(err == nil); + + METAL_PipelineState pipeline; + pipeline.blendMode = blendmode; + pipeline.pipe = (void *)CFBridgingRetain(state); + + METAL_PipelineState *states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline)); + +#if !__has_feature(objc_arc) + [mtlpipedesc release]; // !!! FIXME: can these be reused for each creation, or does the pipeline obtain it? + [mtlvertfn release]; + [mtlfragfn release]; + [state release]; +#endif + + if (states) { + states[cache->count++] = pipeline; + cache->states = states; + return (__bridge id)pipeline.pipe; + } else { + CFBridgingRelease(pipeline.pipe); + SDL_OutOfMemory(); + return NULL; + } +} + +static void +MakePipelineCache(METAL_RenderData *data, METAL_PipelineCache *cache, const char *label, + MTLPixelFormat rtformat, SDL_MetalVertexFunction vertfn, SDL_MetalFragmentFunction fragfn) +{ + SDL_zerop(cache); + + cache->vertexFunction = vertfn; + cache->fragmentFunction = fragfn; + cache->renderTargetFormat = rtformat; + cache->label = label; + + /* Create pipeline states for the default blend modes. Custom blend modes + * will be added to the cache on-demand. */ + MakePipelineState(data, cache, @" (blend=none)", SDL_BLENDMODE_NONE); + MakePipelineState(data, cache, @" (blend=blend)", SDL_BLENDMODE_BLEND); + MakePipelineState(data, cache, @" (blend=add)", SDL_BLENDMODE_ADD); + MakePipelineState(data, cache, @" (blend=mod)", SDL_BLENDMODE_MOD); +} + +static void +DestroyPipelineCache(METAL_PipelineCache *cache) +{ + if (cache != NULL) { + for (int i = 0; i < cache->count; i++) { + CFBridgingRelease(cache->states[i].pipe); + } + + SDL_free(cache->states); + } +} + +void +MakeShaderPipelines(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, MTLPixelFormat rtformat) +{ + SDL_zerop(pipelines); + + pipelines->renderTargetFormat = rtformat; + + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_SOLID], "SDL primitives pipeline", rtformat, SDL_METAL_VERTEX_SOLID, SDL_METAL_FRAGMENT_SOLID); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_COPY], "SDL copy pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_COPY); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_YUV], "SDL YUV pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_YUV); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV12], "SDL NV12 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV12); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV21], "SDL NV21 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV21); +} + +static METAL_ShaderPipelines * +ChooseShaderPipelines(METAL_RenderData *data, MTLPixelFormat rtformat) +{ + METAL_ShaderPipelines *allpipelines = data.allpipelines; + int count = data.pipelinescount; + + for (int i = 0; i < count; i++) { + if (allpipelines[i].renderTargetFormat == rtformat) { + return &allpipelines[i]; + } + } + + allpipelines = SDL_realloc(allpipelines, (count + 1) * sizeof(METAL_ShaderPipelines)); + + if (allpipelines == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + MakeShaderPipelines(data, &allpipelines[count], rtformat); + + data.allpipelines = allpipelines; + data.pipelinescount = count + 1; + + return &data.allpipelines[count]; +} + +static void +DestroyAllPipelines(METAL_ShaderPipelines *allpipelines, int count) +{ + if (allpipelines != NULL) { + for (int i = 0; i < count; i++) { + for (int cache = 0; cache < SDL_METAL_FRAGMENT_COUNT; cache++) { + DestroyPipelineCache(&allpipelines[i].caches[cache]); + } + } + + SDL_free(allpipelines); + } +} + +static inline id +ChoosePipelineState(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, SDL_MetalFragmentFunction fragfn, SDL_BlendMode blendmode) +{ + METAL_PipelineCache *cache = &pipelines->caches[fragfn]; + + for (int i = 0; i < cache->count; i++) { + if (cache->states[i].blendMode == blendmode) { + return (__bridge id)cache->states[i].pipe; + } + } + + return MakePipelineState(data, cache, [NSString stringWithFormat:@" (blend=custom 0x%x)", blendmode], blendmode); +} + +static SDL_Renderer * +METAL_CreateRenderer(SDL_Window * window, Uint32 flags) +{ @autoreleasepool { + SDL_Renderer *renderer = NULL; + METAL_RenderData *data = NULL; + id mtldevice = nil; + SDL_SysWMinfo syswm; + + SDL_VERSION(&syswm.version); + if (!SDL_GetWindowWMInfo(window, &syswm)) { + return NULL; + } + + if (IsMetalAvailable(&syswm) == -1) { + return NULL; + } + + renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); + if (!renderer) { + SDL_OutOfMemory(); + return NULL; + } + + // !!! FIXME: MTLCopyAllDevices() can find other GPUs on macOS... + mtldevice = MTLCreateSystemDefaultDevice(); + + if (mtldevice == nil) { + SDL_free(renderer); + SDL_SetError("Failed to obtain Metal device"); + return NULL; + } + + // !!! FIXME: error checking on all of this. + data = [[METAL_RenderData alloc] init]; + + renderer->driverdata = (void*)CFBridgingRetain(data); + renderer->window = window; + +#ifdef __MACOSX__ + NSView *view = Cocoa_Mtl_AddMetalView(window); + CAMetalLayer *layer = (CAMetalLayer *)[view layer]; + + layer.device = mtldevice; + + //layer.colorspace = nil; + +#else + UIView *view = UIKit_Mtl_AddMetalView(window); + CAMetalLayer *layer = (CAMetalLayer *)[view layer]; +#endif + + // Necessary for RenderReadPixels. + layer.framebufferOnly = NO; + + data.mtldevice = layer.device; + data.mtllayer = layer; + id mtlcmdqueue = [data.mtldevice newCommandQueue]; + data.mtlcmdqueue = mtlcmdqueue; + data.mtlcmdqueue.label = @"SDL Metal Renderer"; + data.mtlpassdesc = [MTLRenderPassDescriptor renderPassDescriptor]; + + NSError *err = nil; + + // The compiled .metallib is embedded in a static array in a header file + // but the original shader source code is in SDL_shaders_metal.metal. + dispatch_data_t mtllibdata = dispatch_data_create(sdl_metallib, sdl_metallib_len, dispatch_get_global_queue(0, 0), ^{}); + id mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err]; + data.mtllibrary = mtllibrary; + SDL_assert(err == nil); +#if !__has_feature(objc_arc) + dispatch_release(mtllibdata); +#endif + data.mtllibrary.label = @"SDL Metal renderer shader library"; + + /* Do some shader pipeline state loading up-front rather than on demand. */ + data.pipelinescount = 0; + data.allpipelines = NULL; + ChooseShaderPipelines(data, MTLPixelFormatBGRA8Unorm); + + MTLSamplerDescriptor *samplerdesc = [[MTLSamplerDescriptor alloc] init]; + + samplerdesc.minFilter = MTLSamplerMinMagFilterNearest; + samplerdesc.magFilter = MTLSamplerMinMagFilterNearest; + id mtlsamplernearest = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + data.mtlsamplernearest = mtlsamplernearest; + + samplerdesc.minFilter = MTLSamplerMinMagFilterLinear; + samplerdesc.magFilter = MTLSamplerMinMagFilterLinear; + id mtlsamplerlinear = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + data.mtlsamplerlinear = mtlsamplerlinear; + + /* Note: matrices are column major. */ + float identitytransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + + float halfpixeltransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.5f, 0.5f, 0.0f, 1.0f, + }; + + /* Metal pads float3s to 16 bytes. */ + float decodetransformJPEG[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT601[4*4] = { + -0.0627451017, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.1644, 0.0000, 1.5960, 0.0, /* Rcoeff */ + 1.1644, -0.3918, -0.8130, 0.0, /* Gcoeff */ + 1.1644, 2.0172, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT709[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; + + float clearverts[6] = {0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.0f}; + + id mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared]; + mtlbufconstantstaging.label = @"SDL constant staging data"; + + id mtlbufconstants = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModePrivate]; + data.mtlbufconstants = mtlbufconstants; + data.mtlbufconstants.label = @"SDL constant data"; + + char *constantdata = [mtlbufconstantstaging contents]; + SDL_memcpy(constantdata + CONSTANTS_OFFSET_IDENTITY, identitytransform, sizeof(identitytransform)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM, halfpixeltransform, sizeof(halfpixeltransform)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_JPEG, decodetransformJPEG, sizeof(decodetransformJPEG)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT601, decodetransformBT601, sizeof(decodetransformBT601)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT709, decodetransformBT709, sizeof(decodetransformBT709)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_CLEAR_VERTS, clearverts, sizeof(clearverts)); + + id cmdbuffer = [data.mtlcmdqueue commandBuffer]; + id blitcmd = [cmdbuffer blitCommandEncoder]; + + [blitcmd copyFromBuffer:mtlbufconstantstaging sourceOffset:0 toBuffer:data.mtlbufconstants destinationOffset:0 size:CONSTANTS_LENGTH]; + + [blitcmd endEncoding]; + [cmdbuffer commit]; + + // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed. + + renderer->WindowEvent = METAL_WindowEvent; + renderer->GetOutputSize = METAL_GetOutputSize; + renderer->SupportsBlendMode = METAL_SupportsBlendMode; + renderer->CreateTexture = METAL_CreateTexture; + renderer->UpdateTexture = METAL_UpdateTexture; + renderer->UpdateTextureYUV = METAL_UpdateTextureYUV; + renderer->LockTexture = METAL_LockTexture; + renderer->UnlockTexture = METAL_UnlockTexture; + renderer->SetRenderTarget = METAL_SetRenderTarget; + renderer->UpdateViewport = METAL_UpdateViewport; + renderer->UpdateClipRect = METAL_UpdateClipRect; + renderer->RenderClear = METAL_RenderClear; + renderer->RenderDrawPoints = METAL_RenderDrawPoints; + renderer->RenderDrawLines = METAL_RenderDrawLines; + renderer->RenderFillRects = METAL_RenderFillRects; + renderer->RenderCopy = METAL_RenderCopy; + renderer->RenderCopyEx = METAL_RenderCopyEx; + renderer->RenderReadPixels = METAL_RenderReadPixels; + renderer->RenderPresent = METAL_RenderPresent; + renderer->DestroyTexture = METAL_DestroyTexture; + renderer->DestroyRenderer = METAL_DestroyRenderer; + renderer->GetMetalLayer = METAL_GetMetalLayer; + renderer->GetMetalCommandEncoder = METAL_GetMetalCommandEncoder; + + renderer->info = METAL_RenderDriver.info; + renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); + +#if defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13) + if (@available(macOS 10.13, *)) { + data.mtllayer.displaySyncEnabled = (flags & SDL_RENDERER_PRESENTVSYNC) != 0; + } else +#endif + { + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; + } + + /* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */ + int maxtexsize = 4096; +#if defined(__MACOSX__) + maxtexsize = 16384; +#elif defined(__TVOS__) + maxtexsize = 8192; +#ifdef __TVOS_11_0 + if (@available(tvOS 11.0, *)) { + if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) { + maxtexsize = 16384; + } + } +#endif +#else +#ifdef __IPHONE_11_0 + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) { + maxtexsize = 16384; + } else +#endif +#ifdef __IPHONE_10_0 + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) { + maxtexsize = 16384; + } else +#endif + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) { + maxtexsize = 8192; + } else { + maxtexsize = 4096; + } +#endif + + renderer->info.max_texture_width = maxtexsize; + renderer->info.max_texture_height = maxtexsize; + +#if !__has_feature(objc_arc) + [mtlcmdqueue release]; + [mtllibrary release]; + [samplerdesc release]; + [mtlsamplernearest release]; + [mtlsamplerlinear release]; + [mtlbufconstants release]; + [view release]; + [data release]; + [mtldevice release]; +#endif + + return renderer; +}} + +static void +METAL_ActivateRenderCommandEncoder(SDL_Renderer * renderer, MTLLoadAction load) +{ + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + /* Our SetRenderTarget just signals that the next render operation should + * set up a new render pass. This is where that work happens. */ + if (data.mtlcmdencoder == nil) { + id mtltexture = nil; + + if (renderer->target != NULL) { + METAL_TextureData *texdata = (__bridge METAL_TextureData *)renderer->target->driverdata; + mtltexture = texdata.mtltexture; + } else { + if (data.mtlbackbuffer == nil) { + /* The backbuffer's contents aren't guaranteed to persist after + * presenting, so we can leave it undefined when loading it. */ + data.mtlbackbuffer = [data.mtllayer nextDrawable]; + if (load == MTLLoadActionLoad) { + load = MTLLoadActionDontCare; + } + } + mtltexture = data.mtlbackbuffer.texture; + } + + SDL_assert(mtltexture); + + if (load == MTLLoadActionClear) { + MTLClearColor color = MTLClearColorMake(renderer->r/255.0, renderer->g/255.0, renderer->b/255.0, renderer->a/255.0); + data.mtlpassdesc.colorAttachments[0].clearColor = color; + } + + data.mtlpassdesc.colorAttachments[0].loadAction = load; + data.mtlpassdesc.colorAttachments[0].texture = mtltexture; + + data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer]; + data.mtlcmdencoder = [data.mtlcmdbuffer renderCommandEncoderWithDescriptor:data.mtlpassdesc]; + + if (data.mtlbackbuffer != nil && mtltexture == data.mtlbackbuffer.texture) { + data.mtlcmdencoder.label = @"SDL metal renderer backbuffer"; + } else { + data.mtlcmdencoder.label = @"SDL metal renderer render target"; + } + + data.activepipelines = ChooseShaderPipelines(data, mtltexture.pixelFormat); + + /* Make sure the viewport and clip rect are set on the new render pass. */ + METAL_UpdateViewport(renderer); + METAL_UpdateClipRect(renderer); + } +} + +static void +METAL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) +{ + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->event == SDL_WINDOWEVENT_SHOWN || + event->event == SDL_WINDOWEVENT_HIDDEN) { + // !!! FIXME: write me + } +} + +static int +METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (w) { + *w = (int)data.mtllayer.drawableSize.width; + } + if (h) { + *h = (int)data.mtllayer.drawableSize.height; + } + return 0; +}} + +static SDL_bool +METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFactor(srcColorFactor) == invalidBlendFactor || + GetBlendFactor(srcAlphaFactor) == invalidBlendFactor || + GetBlendOperation(colorOperation) == invalidBlendOperation || + GetBlendFactor(dstColorFactor) == invalidBlendFactor || + GetBlendFactor(dstAlphaFactor) == invalidBlendFactor || + GetBlendOperation(alphaOperation) == invalidBlendOperation) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +static int +METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + MTLPixelFormat pixfmt; + + switch (texture->format) { + case SDL_PIXELFORMAT_ABGR8888: + pixfmt = MTLPixelFormatRGBA8Unorm; + break; + case SDL_PIXELFORMAT_ARGB8888: + pixfmt = MTLPixelFormatBGRA8Unorm; + break; + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + pixfmt = MTLPixelFormatR8Unorm; + break; + default: + return SDL_SetError("Texture format %s not supported by Metal", SDL_GetPixelFormatName(texture->format)); + } + + MTLTextureDescriptor *mtltexdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixfmt + width:(NSUInteger)texture->w height:(NSUInteger)texture->h mipmapped:NO]; + + /* Not available in iOS 8. */ + if ([mtltexdesc respondsToSelector:@selector(usage)]) { + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget; + } else { + mtltexdesc.usage = MTLTextureUsageShaderRead; + } + } + + id mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + if (mtltexture == nil) { + return SDL_SetError("Texture allocation failed"); + } + + id mtltexture_uv = nil; + + BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); + BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); + + if (yuv) { + mtltexdesc.pixelFormat = MTLPixelFormatR8Unorm; + mtltexdesc.width = (texture->w + 1) / 2; + mtltexdesc.height = (texture->h + 1) / 2; + mtltexdesc.textureType = MTLTextureType2DArray; + mtltexdesc.arrayLength = 2; + mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + } else if (nv12) { + mtltexdesc.pixelFormat = MTLPixelFormatRG8Unorm; + mtltexdesc.width = (texture->w + 1) / 2; + mtltexdesc.height = (texture->h + 1) / 2; + mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + } + + METAL_TextureData *texturedata = [[METAL_TextureData alloc] init]; + const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); + if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { + texturedata.mtlsampler = data.mtlsamplernearest; + } else { + texturedata.mtlsampler = data.mtlsamplerlinear; + } + texturedata.mtltexture = mtltexture; + texturedata.mtltexture_uv = mtltexture_uv; + + texturedata.yuv = yuv; + texturedata.nv12 = nv12; + + if (yuv) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_YUV; + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV12; + } else if (texture->format == SDL_PIXELFORMAT_NV21) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21; + } else { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY; + } + + if (yuv || nv12) { + size_t offset = 0; + SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h); + switch (mode) { + case SDL_YUV_CONVERSION_JPEG: offset = CONSTANTS_OFFSET_DECODE_JPEG; break; + case SDL_YUV_CONVERSION_BT601: offset = CONSTANTS_OFFSET_DECODE_BT601; break; + case SDL_YUV_CONVERSION_BT709: offset = CONSTANTS_OFFSET_DECODE_BT709; break; + default: offset = 0; break; + } + texturedata.conversionBufferOffset = offset; + } + + texture->driverdata = (void*)CFBridgingRetain(texturedata); + +#if !__has_feature(objc_arc) + [texturedata release]; + [mtltexture release]; + [mtltexture_uv release]; +#endif + + return 0; +}} + +static int +METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, int pitch) +{ @autoreleasepool { + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + + /* !!! FIXME: replaceRegion does not do any synchronization, so it might + * !!! FIXME: stomp on a previous frame's data that's currently being read + * !!! FIXME: by the GPU. */ + [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h) + mipmapLevel:0 + withBytes:pixels + bytesPerRow:pitch]; + + if (texturedata.yuv) { + int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; + int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; + + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Uslice + withBytes:pixels + bytesPerRow:(pitch + 1) / 2 + bytesPerImage:0]; + + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2)); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Vslice + withBytes:pixels + bytesPerRow:(pitch + 1) / 2 + bytesPerImage:0]; + } + + if (texturedata.nv12) { + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:0 + withBytes:pixels + bytesPerRow:2 * ((pitch + 1) / 2) + bytesPerImage:0]; + } + + return 0; +}} + +static int +METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch) +{ @autoreleasepool { + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; + int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; + + /* Bail out if we're supposed to update an empty rectangle */ + if (rect->w <= 0 || rect->h <= 0) { + return 0; + } + + [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h) + mipmapLevel:0 + withBytes:Yplane + bytesPerRow:Ypitch]; + + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Uslice + withBytes:Uplane + bytesPerRow:Upitch + bytesPerImage:0]; + + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Vslice + withBytes:Vplane + bytesPerRow:Vpitch + bytesPerImage:0]; + + return 0; +}} + +static int +METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch) +{ + return SDL_Unsupported(); // !!! FIXME: write me +} + +static void +METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + // !!! FIXME: write me +} + +static int +METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + if (data.mtlcmdencoder) { + /* End encoding for the previous render target so we can set up a new + * render pass for this one. */ + [data.mtlcmdencoder endEncoding]; + [data.mtlcmdbuffer commit]; + + data.mtlcmdencoder = nil; + data.mtlcmdbuffer = nil; + } + + /* We don't begin a new render pass right away - we delay it until an actual + * draw or clear happens. That way we can use hardware clears when possible, + * which are only available when beginning a new render pass. */ + return 0; +}} + +static int +METAL_SetOrthographicProjection(SDL_Renderer *renderer, int w, int h) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + float projection[4][4]; + + if (!w || !h) { + return 0; + } + + /* Prepare an orthographic projection */ + projection[0][0] = 2.0f / w; + projection[0][1] = 0.0f; + projection[0][2] = 0.0f; + projection[0][3] = 0.0f; + projection[1][0] = 0.0f; + projection[1][1] = -2.0f / h; + projection[1][2] = 0.0f; + projection[1][3] = 0.0f; + projection[2][0] = 0.0f; + projection[2][1] = 0.0f; + projection[2][2] = 0.0f; + projection[2][3] = 0.0f; + projection[3][0] = -1.0f; + projection[3][1] = 1.0f; + projection[3][2] = 0.0f; + projection[3][3] = 1.0f; + + // !!! FIXME: This should be in a buffer... + [data.mtlcmdencoder setVertexBytes:projection length:sizeof(float)*16 atIndex:2]; + return 0; +}} + +static int +METAL_UpdateViewport(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (data.mtlcmdencoder) { + MTLViewport viewport; + viewport.originX = renderer->viewport.x; + viewport.originY = renderer->viewport.y; + viewport.width = renderer->viewport.w; + viewport.height = renderer->viewport.h; + viewport.znear = 0.0; + viewport.zfar = 1.0; + [data.mtlcmdencoder setViewport:viewport]; + METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h); + } + return 0; +}} + +static int +METAL_UpdateClipRect(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (data.mtlcmdencoder) { + MTLScissorRect mtlrect; + // !!! FIXME: should this care about the viewport? + if (renderer->clipping_enabled) { + const SDL_Rect *rect = &renderer->clip_rect; + mtlrect.x = renderer->viewport.x + rect->x; + mtlrect.y = renderer->viewport.x + rect->y; + mtlrect.width = rect->w; + mtlrect.height = rect->h; + } else { + mtlrect.x = renderer->viewport.x; + mtlrect.y = renderer->viewport.y; + mtlrect.width = renderer->viewport.w; + mtlrect.height = renderer->viewport.h; + } + if (mtlrect.width > 0 && mtlrect.height > 0) { + [data.mtlcmdencoder setScissorRect:mtlrect]; + } + } + return 0; +}} + +static int +METAL_RenderClear(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + /* Since we set up the render command encoder lazily when a draw is + * requested, we can do the fast path hardware clear if no draws have + * happened since the last SetRenderTarget. */ + if (data.mtlcmdencoder == nil) { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionClear); + } else { + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + MTLViewport viewport; // RenderClear ignores the viewport state, though, so reset that. + viewport.originX = viewport.originY = 0.0; + viewport.width = data.mtlpassdesc.colorAttachments[0].texture.width; + viewport.height = data.mtlpassdesc.colorAttachments[0].texture.height; + viewport.znear = 0.0; + viewport.zfar = 1.0; + + // Slow path for clearing: draw a filled fullscreen triangle. + METAL_SetOrthographicProjection(renderer, 1, 1); + [data.mtlcmdencoder setViewport:viewport]; + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, SDL_BLENDMODE_NONE)]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_CLEAR_VERTS atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:3]; + + // reset the viewport for the rest of our usual drawing work... + viewport.originX = renderer->viewport.x; + viewport.originY = renderer->viewport.y; + viewport.width = renderer->viewport.w; + viewport.height = renderer->viewport.h; + viewport.znear = 0.0; + viewport.zfar = 1.0; + [data.mtlcmdencoder setViewport:viewport]; + METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h); + } + + return 0; +}} + +// normalize a value from 0.0f to len into 0.0f to 1.0f. +static inline float +normtex(const float _val, const float len) +{ + return _val / len; +} + +static int +DrawVerts(SDL_Renderer * renderer, const SDL_FPoint * points, int count, + const MTLPrimitiveType primtype) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + + const size_t vertlen = (sizeof (float) * 2) * count; + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + + [data.mtlcmdencoder setVertexBytes:points length:vertlen atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM atIndex:3]; + [data.mtlcmdencoder drawPrimitives:primtype vertexStart:0 vertexCount:count]; + + return 0; +}} + +static int +METAL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count) +{ + return DrawVerts(renderer, points, count, MTLPrimitiveTypePoint); +} + +static int +METAL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, int count) +{ + return DrawVerts(renderer, points, count, MTLPrimitiveTypeLineStrip); +} + +static int +METAL_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + + for (int i = 0; i < count; i++, rects++) { + if ((rects->w <= 0.0f) || (rects->h <= 0.0f)) continue; + + const float verts[] = { + rects->x, rects->y + rects->h, + rects->x, rects->y, + rects->x + rects->w, rects->y + rects->h, + rects->x + rects->w, rects->y + }; + + [data.mtlcmdencoder setVertexBytes:verts length:sizeof(verts) atIndex:0]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + } + + return 0; +}} + +static void +METAL_SetupRenderCopy(METAL_RenderData *data, SDL_Texture *texture, METAL_TextureData *texturedata) +{ + float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + if (texture->modMode) { + color[0] = ((float)texture->r) / 255.0f; + color[1] = ((float)texture->g) / 255.0f; + color[2] = ((float)texture->b) / 255.0f; + color[3] = ((float)texture->a) / 255.0f; + } + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, texturedata.fragmentFunction, texture->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder setFragmentSamplerState:texturedata.mtlsampler atIndex:0]; + + [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0]; + + if (texturedata.yuv || texturedata.nv12) { + [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1]; + [data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1]; + } +} + +static int +METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + const float texw = (float) texturedata.mtltexture.width; + const float texh = (float) texturedata.mtltexture.height; + + METAL_SetupRenderCopy(data, texture, texturedata); + + const float xy[] = { + dstrect->x, dstrect->y + dstrect->h, + dstrect->x, dstrect->y, + dstrect->x + dstrect->w, dstrect->y + dstrect->h, + dstrect->x + dstrect->w, dstrect->y + }; + + const float uv[] = { + normtex(srcrect->x, texw), normtex(srcrect->y + srcrect->h, texh), + normtex(srcrect->x, texw), normtex(srcrect->y, texh), + normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y + srcrect->h, texh), + normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y, texh) + }; + + [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0]; + [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + + return 0; +}} + +static int +METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect, + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + const float texw = (float) texturedata.mtltexture.width; + const float texh = (float) texturedata.mtltexture.height; + float transform[16]; + float minu, maxu, minv, maxv; + + METAL_SetupRenderCopy(data, texture, texturedata); + + minu = normtex(srcrect->x, texw); + maxu = normtex(srcrect->x + srcrect->w, texw); + minv = normtex(srcrect->y, texh); + maxv = normtex(srcrect->y + srcrect->h, texh); + + if (flip & SDL_FLIP_HORIZONTAL) { + float tmp = maxu; + maxu = minu; + minu = tmp; + } + if (flip & SDL_FLIP_VERTICAL) { + float tmp = maxv; + maxv = minv; + minv = tmp; + } + + const float uv[] = { + minu, maxv, + minu, minv, + maxu, maxv, + maxu, minv + }; + + const float xy[] = { + -center->x, dstrect->h - center->y, + -center->x, -center->y, + dstrect->w - center->x, dstrect->h - center->y, + dstrect->w - center->x, -center->y + }; + + { + float rads = (float)(M_PI * (float) angle / 180.0f); + float c = cosf(rads), s = sinf(rads); + SDL_memset(transform, 0, sizeof(transform)); + + transform[10] = transform[15] = 1.0f; + + /* Rotation */ + transform[0] = c; + transform[1] = s; + transform[4] = -s; + transform[5] = c; + + /* Translation */ + transform[12] = dstrect->x + center->x; + transform[13] = dstrect->y + center->y; + } + + [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0]; + [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1]; + [data.mtlcmdencoder setVertexBytes:transform length:sizeof(transform) atIndex:3]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + + return 0; +}} + +static int +METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + + // !!! FIXME: this probably needs to commit the current command buffer, and probably waitUntilCompleted + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + id mtltexture = data.mtlpassdesc.colorAttachments[0].texture; + MTLRegion mtlregion = MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h); + + // we only do BGRA8 or RGBA8 at the moment, so 4 will do. + const int temp_pitch = rect->w * 4; + void *temp_pixels = SDL_malloc(temp_pitch * rect->h); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + + [mtltexture getBytes:temp_pixels bytesPerRow:temp_pitch fromRegion:mtlregion mipmapLevel:0]; + + const Uint32 temp_format = (mtltexture.pixelFormat == MTLPixelFormatBGRA8Unorm) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_ABGR8888; + const int status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, pixel_format, pixels, pitch); + SDL_free(temp_pixels); + return status; +}} + +static void +METAL_RenderPresent(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + if (data.mtlcmdencoder != nil) { + [data.mtlcmdencoder endEncoding]; + } + if (data.mtlbackbuffer != nil) { + [data.mtlcmdbuffer presentDrawable:data.mtlbackbuffer]; + } + if (data.mtlcmdbuffer != nil) { + [data.mtlcmdbuffer commit]; + } + data.mtlcmdencoder = nil; + data.mtlcmdbuffer = nil; + data.mtlbackbuffer = nil; +}} + +static void +METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + CFBridgingRelease(texture->driverdata); + texture->driverdata = NULL; +}} + +static void +METAL_DestroyRenderer(SDL_Renderer * renderer) +{ @autoreleasepool { + if (renderer->driverdata) { + METAL_RenderData *data = CFBridgingRelease(renderer->driverdata); + + if (data.mtlcmdencoder != nil) { + [data.mtlcmdencoder endEncoding]; + } + + DestroyAllPipelines(data.allpipelines, data.pipelinescount); + } + + SDL_free(renderer); +}} + +static void * +METAL_GetMetalLayer(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + return (__bridge void*)data.mtllayer; +}} + +static void * +METAL_GetMetalCommandEncoder(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + return (__bridge void*)data.mtlcmdencoder; +}} + +#endif /* SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal new file mode 100644 index 000000000..8df3b753e --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal @@ -0,0 +1,109 @@ +#include +#include + +using namespace metal; + +struct SolidVertexOutput +{ + float4 position [[position]]; + float pointSize [[point_size]]; +}; + +vertex SolidVertexOutput SDL_Solid_vertex(const device float2 *position [[buffer(0)]], + constant float4x4 &projection [[buffer(2)]], + constant float4x4 &transform [[buffer(3)]], + uint vid [[vertex_id]]) +{ + SolidVertexOutput v; + v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f); + v.pointSize = 1.0f; + return v; +} + +fragment float4 SDL_Solid_fragment(constant float4 &col [[buffer(0)]]) +{ + return col; +} + +struct CopyVertexOutput +{ + float4 position [[position]]; + float2 texcoord; +}; + +vertex CopyVertexOutput SDL_Copy_vertex(const device float2 *position [[buffer(0)]], + const device float2 *texcoords [[buffer(1)]], + constant float4x4 &projection [[buffer(2)]], + constant float4x4 &transform [[buffer(3)]], + uint vid [[vertex_id]]) +{ + CopyVertexOutput v; + v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f); + v.texcoord = texcoords[vid]; + return v; +} + +fragment float4 SDL_Copy_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + texture2d tex [[texture(0)]], + sampler s [[sampler(0)]]) +{ + return tex.sample(s, vert.texcoord) * col; +} + +struct YUVDecode +{ + float3 offset; + float3 Rcoeff; + float3 Gcoeff; + float3 Bcoeff; +}; + +fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d_array texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.y = texUV.sample(s, vert.texcoord, 0).r; + yuv.z = texUV.sample(s, vert.texcoord, 1).r; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} + +fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.yz = texUV.sample(s, vert.texcoord).rg; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} + +fragment float4 SDL_NV21_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.yz = texUV.sample(s, vert.texcoord).gr; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} diff --git a/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h new file mode 100644 index 000000000..1c9325238 --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h @@ -0,0 +1,1899 @@ +const unsigned char sdl_metallib[] = { + 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xd8, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, + 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, + 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, + 0xa1, 0x91, 0x35, 0x76, 0xce, 0x36, 0x38, 0x71, 0xba, 0x1c, 0x81, 0x62, + 0xda, 0x7c, 0x6b, 0x94, 0xc7, 0x88, 0x39, 0xd4, 0x91, 0xc2, 0xe7, 0xf9, + 0x21, 0x8c, 0x74, 0x25, 0xa9, 0xb0, 0x81, 0x85, 0x4f, 0x46, 0x46, 0x54, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f, + 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59, + 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0x71, + 0xbb, 0x07, 0x58, 0x1b, 0x7c, 0x44, 0xaa, 0x03, 0xc8, 0xab, 0x11, 0xe4, + 0x63, 0xdb, 0xe3, 0xe6, 0xce, 0x52, 0x97, 0x34, 0x82, 0xf0, 0x46, 0x70, + 0xaa, 0xa9, 0x31, 0x51, 0x3c, 0xe8, 0x39, 0x4f, 0x46, 0x46, 0x54, 0x18, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e, + 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c, + 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00, + 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20, + 0x00, 0x4a, 0x07, 0x48, 0xd3, 0xb7, 0x7a, 0x3a, 0x01, 0x6c, 0xaa, 0x80, + 0xde, 0x84, 0x6e, 0x3c, 0x9a, 0xdd, 0x55, 0x90, 0x43, 0xa6, 0xdd, 0xbb, + 0xd6, 0xeb, 0xea, 0x81, 0x62, 0xf6, 0x50, 0x04, 0x95, 0x4f, 0x46, 0x46, + 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x16, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00, + 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, + 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x4c, 0xaa, 0x05, 0x27, 0x1a, 0x40, 0x5c, 0xe3, 0xd5, 0x46, + 0x38, 0xad, 0x07, 0xe7, 0x70, 0xdf, 0xde, 0x83, 0x74, 0x96, 0x26, 0x6e, + 0x35, 0x7b, 0xc9, 0xc5, 0x46, 0x08, 0x51, 0xb4, 0x13, 0xa8, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0xc9, 0x73, 0x33, 0x9a, 0x36, 0x6d, 0x15, 0x10, 0xa2, 0x81, + 0xaa, 0xbf, 0x27, 0xb1, 0x22, 0xc6, 0x0a, 0x7b, 0x68, 0x66, 0xdb, 0xe9, + 0xab, 0x19, 0x22, 0x40, 0x87, 0x6b, 0x10, 0x93, 0xc5, 0xf5, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x2a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, + 0x48, 0x20, 0x00, 0x59, 0x54, 0x77, 0x75, 0xe5, 0xb6, 0xd5, 0x2e, 0xf7, + 0xb1, 0x9d, 0xd1, 0x75, 0x39, 0x4c, 0x97, 0x0f, 0x40, 0x58, 0xaa, 0xc9, + 0x42, 0xe8, 0x03, 0x29, 0x1e, 0x93, 0x63, 0x0c, 0x91, 0x38, 0xc8, 0x4f, + 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, + 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, + 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, + 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, + 0x53, 0x48, 0x20, 0x00, 0x77, 0x01, 0x3e, 0x26, 0x2e, 0xc2, 0xe2, 0x34, + 0x70, 0xcf, 0x0c, 0x9e, 0x0d, 0xed, 0x69, 0xa4, 0x2a, 0x9c, 0x80, 0x06, + 0x52, 0xd1, 0x4b, 0x77, 0x6d, 0xda, 0x29, 0x27, 0x51, 0x25, 0xf4, 0x92, + 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x46, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, + 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x30, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 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, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4, + 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18, + 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0, + 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84, + 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4, + 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94, + 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30, + 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47, + 0x10, 0x50, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, + 0x25, 0x30, 0x02, 0x50, 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06, + 0xd4, 0x46, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16, + 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, + 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, + 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72, + 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, + 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61, + 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x2c, 0xcc, 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9, + 0xd1, 0x4d, 0xa5, 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a, + 0x81, 0x96, 0x6a, 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce, + 0x45, 0xac, 0xce, 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b, + 0xdb, 0xdb, 0x58, 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59, + 0x19, 0x1e, 0x91, 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, + 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc, + 0xbe, 0xe6, 0xd2, 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9, + 0x0c, 0xe1, 0x10, 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96, + 0x0d, 0x21, 0x16, 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8, + 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, + 0xa5, 0xe9, 0x95, 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3, + 0xa1, 0x02, 0x27, 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36, + 0x04, 0x0c, 0x90, 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90, + 0x60, 0xd1, 0x96, 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83, + 0x05, 0x5a, 0xc2, 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b, + 0x5c, 0xdb, 0x10, 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32, + 0xe4, 0x40, 0x82, 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c, + 0x05, 0x0c, 0x16, 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, + 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63, 0x29, 0x83, 0xc5, + 0x59, 0xcc, 0x60, 0x81, 0x96, 0x33, 0x18, 0x82, 0x2c, 0xde, 0x22, 0x06, + 0x0b, 0x19, 0x2c, 0x68, 0x30, 0xc4, 0x50, 0x80, 0xe5, 0x5a, 0xd2, 0x80, + 0xcf, 0x5b, 0x9b, 0x5b, 0x1a, 0xdc, 0x1b, 0x5d, 0x99, 0x1b, 0x1d, 0xc8, + 0x18, 0x5a, 0x98, 0x1c, 0x9f, 0xa9, 0xb4, 0x36, 0x38, 0xb6, 0x32, 0x90, + 0xa1, 0x95, 0x15, 0x10, 0x2a, 0xa1, 0xa0, 0xa0, 0x21, 0xc2, 0xc2, 0x06, + 0x43, 0x8c, 0x65, 0x0d, 0x96, 0x36, 0x68, 0x90, 0x21, 0xc6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+ 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x45, 0x44, 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x69, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x84, 0x60, 0x9a, 0x46, 0x00, + 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x98, 0x01, 0xa0, 0x31, + 0x03, 0x40, 0x62, 0x06, 0x80, 0xc2, 0x0c, 0x00, 0x81, 0x11, 0x80, 0x31, + 0x02, 0x10, 0x04, 0x41, 0xfc, 0x03, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12, + 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0xd1, 0x94, 0x4d, 0x14, + 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03, 0xe0, 0x0c, 0x86, 0x0b, + 0x9a, 0x8c, 0x47, 0x50, 0x57, 0x17, 0x50, 0x50, 0x06, 0x19, 0x82, 0x65, + 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x90, 0x42, 0x50, + 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, + 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x51, 0x76, 0x45, 0x93, 0xf1, 0x88, + 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40, 0xc8, 0xc7, 0x02, 0x04, + 0x3e, 0xa6, 0xb0, 0x01, 0x0c, 0x86, 0x1b, 0x02, 0x0e, 0x0c, 0x66, 0x19, + 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xce, 0xa0, 0x0d, 0xa2, 0xc1, 0x88, 0x80, + 0x28, 0x00, 0x9b, 0xde, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x07, 0x06, 0xb3, + 0x0c, 0x44, 0x10, 0x8c, 0x47, 0x64, 0x6a, 0x00, 0x07, 0x6a, 0x40, 0x41, + 0x19, 0x8f, 0xd8, 0xd8, 0x40, 0x0e, 0xc6, 0x80, 0x82, 0x32, 0x1e, 0xd1, + 0xb9, 0x01, 0x1d, 0x98, 0x01, 0x05, 0x65, 0x3c, 0xe2, 0x83, 0x03, 0x3b, + 0x48, 0x03, 0x0a, 0xca, 0x78, 0x04, 0x18, 0xc8, 0x01, 0x1e, 0xc8, 0xc1, + 0x60, 0x44, 0x80, 0x14, 0xc0, 0x78, 0x44, 0x18, 0xcc, 0x41, 0x1e, 0xa8, + 0xc1, 0x60, 0x44, 0x70, 0x14, 0xc0, 0x78, 0x84, 0x18, 0xd0, 0x81, 0x1e, + 0xb0, 0xc1, 0x60, 0x44, 0x60, 0x14, 0xc0, 0x78, 0xc4, 0x18, 0xd4, 0xc1, + 0x1e, 0xb8, 0xc1, 0x60, 0x44, 0x50, 0x14, 0xc0, 0xc9, 0x41, 0x8b, 0xf1, + 0x04, 0x3b, 0x08, 0x28, 0x20, 0x83, 0x0c, 0x41, 0x1b, 0xd0, 0xc1, 0x1c, + 0x43, 0xb0, 0x06, 0x7d, 0x30, 0xc7, 0x10, 0xac, 0x01, 0x1f, 0x0c, 0x32, + 0x04, 0x6e, 0x60, 0x07, 0x16, 0x48, 0xf2, 0x99, 0x25, 0x28, 0x06, 0x2a, + 0x10, 0x95, 0x20, 0xaa, 0x62, 0xa0, 0x22, 0x20, 0x88, 0xa8, 0x18, 0x43, + 0x28, 0x84, 0x39, 0x86, 0x39, 0x08, 0x4e, 0x61, 0x90, 0x21, 0xa0, 0x03, + 0x3e, 0xb8, 0xa2, 0xc9, 0x78, 0x84, 0x1c, 0x90, 0x82, 0x2a, 0x04, 0x14, + 0x14, 0x0b, 0x08, 0xf9, 0x58, 0x80, 0xc0, 0xc7, 0x94, 0x57, 0x80, 0xc1, + 0x70, 0x43, 0xf0, 0x07, 0x60, 0x30, 0xcb, 0x60, 0x14, 0xc1, 0x6c, 0x43, + 0x1f, 0x0c, 0xc0, 0x6c, 0x43, 0xb0, 0x07, 0x41, 0x06, 0x01, 0x31, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12, + 0xbc, 0xc1, 0x96, 0x61, 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0, + 0x65, 0x80, 0x83, 0xe0, 0x0d, 0xb6, 0x0c, 0x7e, 0x10, 0xbc, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x88, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0xdf, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, + 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c, + 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, + 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a, + 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72, + 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72, + 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21, + 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81, + 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73, + 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79, + 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79, + 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80, + 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0, + 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21, + 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21, + 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77, + 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, + 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77, + 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77, + 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78, + 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1, + 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1, + 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77, + 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, + 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, + 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, + 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, + 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, + 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, + 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, + 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, + 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, + 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, + 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, + 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, + 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, + 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, + 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7, + 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44, + 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16, + 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e, + 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e, + 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e, + 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c, + 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18, + 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23, + 0x08, 0x28, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, + 0x25, 0x50, 0x10, 0x23, 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06, + 0x85, 0x40, 0x6d, 0x04, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0xd3, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, + 0x04, 0x64, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, + 0x24, 0x40, 0x02, 0x64, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, + 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, + 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, + 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, + 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, + 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, + 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, + 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, + 0x5a, 0x22, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc, + 0xca, 0xe4, 0xc2, 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6, + 0xde, 0xde, 0xe4, 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98, + 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b, + 0x93, 0x23, 0x1b, 0xc2, 0x2c, 0xd3, 0x42, 0x2d, 0xce, 0x52, 0x2d, 0xd0, + 0x62, 0x0d, 0x21, 0x16, 0x69, 0xb9, 0xa8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, + 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, + 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, + 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, + 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, + 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, + 0x5c, 0x9a, 0x5e, 0xd9, 0x10, 0x0e, 0x19, 0x96, 0x6c, 0xd1, 0x90, 0x01, + 0x09, 0x96, 0x6d, 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, + 0x81, 0x96, 0x88, 0x09, 0x5d, 0x19, 0xde, 0xd8, 0xdb, 0x9b, 0x1c, 0xd9, + 0xdc, 0x10, 0x0e, 0x09, 0x96, 0x6c, 0xd1, 0x90, 0x00, 0x09, 0x96, 0x6d, + 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x8f, + 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, 0xdc, 0xd7, + 0x5c, 0x9a, 0x5e, 0x19, 0x11, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x1a, 0x3c, + 0x1a, 0x2a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0xc0, 0x00, 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4, + 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, + 0x0c, 0x16, 0x68, 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84, + 0x58, 0x34, 0xe4, 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, + 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72, + 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, + 0xd2, 0xdc, 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39, + 0x83, 0xc5, 0x59, 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde, + 0x02, 0x06, 0x0b, 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01, + 0x16, 0x6c, 0x59, 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, + 0x65, 0x6e, 0x74, 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, + 0xe0, 0xd8, 0xca, 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, + 0x86, 0x08, 0x8b, 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49, + 0x86, 0x18, 0x0b, 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60, + 0x07, 0x7b, 0x68, 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, + 0x87, 0x29, 0x41, 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, + 0x30, 0x82, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, + 0x87, 0x73, 0xa8, 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, + 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, + 0xa6, 0x70, 0x48, 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, + 0x87, 0x74, 0x60, 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, + 0x87, 0x77, 0x70, 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50, + 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e, + 0xca, 0x01, 0x1f, 0xa6, 0x04, 0x6c, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x86, + 0x80, 0xa2, 0x46, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x19, + 0x00, 0x1a, 0x33, 0x00, 0x24, 0x66, 0x00, 0x28, 0xcc, 0x00, 0x10, 0x18, + 0x23, 0x00, 0x41, 0x10, 0xc4, 0xbf, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, + 0xd0, 0x94, 0x4d, 0x14, 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03, + 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x4c, 0x57, 0x17, 0x50, 0x50, + 0x06, 0x19, 0x82, 0x45, 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, + 0x81, 0x98, 0x42, 0x50, 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, + 0x42, 0x21, 0xcc, 0x31, 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x11, 0x76, + 0x45, 0x93, 0xf1, 0x08, 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40, + 0xc8, 0xc7, 0x02, 0x04, 0x3e, 0xa6, 0xb4, 0x01, 0x0c, 0x86, 0x1b, 0x82, + 0x33, 0x00, 0x83, 0x59, 0x86, 0x41, 0x08, 0xc6, 0x23, 0xac, 0x33, 0x68, + 0x83, 0x68, 0x30, 0x22, 0x20, 0x0a, 0xc0, 0x26, 0x38, 0x80, 0xc1, 0x70, + 0x43, 0xa0, 0x06, 0x60, 0x30, 0xcb, 0x40, 0x04, 0xc1, 0x78, 0x44, 0xa6, + 0x06, 0x70, 0xa0, 0x06, 0x14, 0x94, 0xf1, 0x88, 0x8d, 0x0d, 0xe4, 0x40, + 0x0c, 0x28, 0x28, 0xe3, 0x11, 0x9d, 0x1b, 0xd0, 0x41, 0x19, 0x50, 0x50, + 0xc6, 0x23, 0x3e, 0x38, 0xb0, 0x03, 0x34, 0xa0, 0xa0, 0x8c, 0x47, 0x80, + 0x81, 0x1c, 0xe0, 0x81, 0x1c, 0x0c, 0x46, 0x04, 0x48, 0x01, 0x8c, 0x47, + 0x84, 0xc1, 0x1c, 0xe4, 0x41, 0x1a, 0x0c, 0x46, 0x04, 0x47, 0x01, 0x8c, + 0x47, 0x88, 0x01, 0x1d, 0xe8, 0xc1, 0x1a, 0x0c, 0x46, 0x04, 0x46, 0x01, + 0x8c, 0x47, 0x8c, 0x41, 0x1d, 0xec, 0x41, 0x1b, 0x0c, 0x46, 0x04, 0x45, + 0x01, 0x5c, 0x1c, 0xb4, 0x18, 0x4f, 0xb0, 0x83, 0x80, 0x02, 0x32, 0xc8, + 0x10, 0xb0, 0xc1, 0x1c, 0xcc, 0x31, 0x04, 0x6a, 0xe0, 0x07, 0x73, 0x0c, + 0x01, 0x1b, 0xf4, 0xc1, 0x20, 0x43, 0xe0, 0x06, 0x75, 0x60, 0x81, 0x24, + 0x9f, 0x59, 0x82, 0x62, 0xa0, 0x02, 0x61, 0x09, 0xa2, 0x2a, 0x06, 0x2a, + 0x02, 0x82, 0x88, 0x8a, 0x31, 0x84, 0x42, 0x98, 0x63, 0x98, 0x83, 0xe0, + 0x14, 0x06, 0x19, 0x02, 0x3a, 0xd8, 0x83, 0x2b, 0x9a, 0x8c, 0x47, 0xc8, + 0x01, 0x29, 0xa8, 0x42, 0x40, 0x41, 0xb1, 0x80, 0x90, 0x8f, 0x05, 0x08, + 0x7c, 0x4c, 0x81, 0x05, 0x18, 0x0c, 0x37, 0x04, 0xaa, 0x00, 0x06, 0xb3, + 0x0c, 0x46, 0x11, 0x8c, 0x27, 0xa0, 0x02, 0x45, 0x01, 0x99, 0x6d, 0x00, + 0x85, 0x02, 0x98, 0x6d, 0x08, 0x84, 0x20, 0x83, 0x80, 0x18, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12, + 0xc4, 0xc1, 0x96, 0x61, 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0, + 0x65, 0x80, 0x83, 0x20, 0x0e, 0xb6, 0x0c, 0x7e, 0x10, 0xc4, 0xc1, 0x96, + 0xa1, 0x14, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x08, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0x21, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40, 0x2e, 0xc2, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38, 0xbc, 0x83, 0x3c, 0xc8, + 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e, 0xb4, 0x81, 0x3c, 0xbc, + 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39, 0xb4, 0x01, 0x39, 0xa4, + 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b, 0xcc, 0x43, 0x3c, 0xc8, + 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, + 0x03, 0x3a, 0x00, 0x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50, 0x0f, 0xf2, 0x50, 0x0e, + 0xf3, 0x00, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1c, 0xd8, 0x01, 0x40, 0xd4, + 0x83, 0x3b, 0xcc, 0x43, 0x38, 0x98, 0x43, 0x39, 0xb4, 0x81, 0x39, 0xc0, + 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f, + 0xf5, 0x50, 0x0e, 0x00, 0x51, 0x0f, 0xf3, 0x50, 0x0e, 0x6d, 0x30, 0x0f, + 0xef, 0x60, 0x0e, 0xf4, 0xd0, 0x06, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, + 0xf4, 0x00, 0x98, 0x43, 0x38, 0xb0, 0xc3, 0x3c, 0x94, 0x03, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x84, 0x40, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, + 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x88, 0x10, 0x08, 0x45, + 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83, 0x39, 0x02, 0x50, 0x18, + 0x01, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x02, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2, + 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00, + 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2, + 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, + 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, + 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, + 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x8a, 0xc6, 0x08, 0x0a, 0xa7, 0x78, 0x86, + 0x08, 0x05, 0x44, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, 0xcc, 0xac, + 0x4c, 0x8e, 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, + 0xdc, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb6, + 0xb7, 0xb1, 0x30, 0xba, 0xb4, 0x37, 0xb7, 0xaf, 0x34, 0x37, 0xb2, 0x32, + 0x3c, 0x22, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x8c, 0xc2, + 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, + 0xe6, 0xd2, 0xf4, 0xca, 0x78, 0x85, 0xa5, 0xc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 0xce, 0xa1, 0x1c, + 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, 0x1d, + 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, 0x1c, + 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, 0x1d, + 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, 0x06, + 0xa2, 0x30, 0x23, 0x98, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x73, 0x90, + 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x01, + 0x07, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05, + 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x60, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19, 0xfe, 0xff, 0xff, 0xff, + 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, + 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, + 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, + 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, + 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, + 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, + 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, + 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, + 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, + 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, + 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, + 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, + 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, + 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, + 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, + 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, + 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, + 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68, 0x03, 0x7a, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, + 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xdc, 0x21, 0x1c, 0xdc, + 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, + 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0x70, 0x87, + 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70, 0x87, 0x72, 0x20, 0x87, + 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98, 0x87, 0x36, 0x30, 0x07, + 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e, 0xe8, 0x21, 0x1c, 0xc6, + 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, 0xe8, 0xa1, 0x1c, 0xc6, + 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, 0xea, 0xc1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xf4, 0xa1, 0x1c, 0x00, + 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38, 0x87, 0x72, 0xa0, 0x87, + 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x87, + 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e, 0xec, 0x00, 0x20, 0xea, + 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, + 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28, 0x87, 0x36, 0x98, 0x87, + 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60, 0x87, 0x77, 0x08, 0x07, + 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0xd8, 0x40, + 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58, 0x36, 0x20, 0xc6, 0xff, + 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40, 0x05, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x86, 0x40, 0x18, + 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x48, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x70, 0x94, + 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c, 0x13, 0x15, 0x11, 0xbf, + 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40, 0x04, 0x17, 0x49, 0x53, + 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c, 0x44, 0xf4, 0x4f, 0x63, + 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04, 0x31, 0xca, 0x21, 0x34, + 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82, 0xb0, 0x14, 0x24, 0x94, + 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c, 0x01, 0x28, 0x8c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x98, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x21, 0x8c, 0x03, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, + 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, + 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04, + 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe7, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x9e, 0x66, 0x19, + 0x1e, 0xe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 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0, 0x60, + 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e, 0x34, + 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, + 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, + 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71, 0x1e, + 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f, 0x19, + 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79, 0x03, + 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, + 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40, + 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f, 0x1c, + 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f, 0x1d, + 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, 0x30, + 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, 0x87, + 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, 0x87, + 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, 0x87, + 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, + 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, 0x07, + 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, 0x87, + 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, 0x87, + 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d, 0xe4, + 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c, 0xdc, + 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16, + 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, + 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48, + 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10, + 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93, + 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x6c, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0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0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x4e, 0x93, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2, 0x22, 0xe2, 0xb7, 0x87, + 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02, 0x60, 0x10, 0x21, 0x09, + 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, + 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45, 0x28, 0x48, 0x08, 0x62, + 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8, 0xcd, 0x11, 0x80, 0xc1, + 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09, 0x8a, 0x89, 0x28, 0xa7, + 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a, 0x40, 0x76, 0x20, 0x60, + 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e, 0x00, 0x14, 0x06, 0x11, + 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, + 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, + 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, + 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, + 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, + 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, + 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, + 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x07, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x21, 0x0c, 0x04, 0x04, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x10, 0xa6, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x08, 0x73, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x90, 0x05, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a, + 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, + 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01, + 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec, + 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, + 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, + 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, + 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b, 0x86, + 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, + 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, + 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, + 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, + 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44, + 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0x11, 0x81, + 0x49, 0xd8, 0x84, 0x51, 0x98, 0x83, 0x3d, 0x58, 0x85, 0x59, 0x94, 0xc2,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0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, + 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81, 0x41, + 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06, 0x91, + 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, + 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, + 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, + 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, + 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, + 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22, 0xb0, + 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd2, + 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62, 0x22, + 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, + 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, + 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41, 0x54, + 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41, 0x74, + 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e, 0xc0, + 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, + 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, + 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, + 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, + 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00, 0x03, + 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac, 0xc2, + 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c, 0xd9, + 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18, 0x1d, + 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba, 0x32, + 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41, 0x54, + 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76, 0xc0, + 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, + 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21, 0x52, + 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60, 0x79, + 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32, 0xc0, + 0xde, 0x00,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b8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c, 0x43, + 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f, + 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9, + 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9, + 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, + 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1, + 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44, + 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf, + 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a, + 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23, + 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30, + 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20, + 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34, + 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20, + 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8, + 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1, + 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0, + 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19, + 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23, + 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c, + 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73, + 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95, + 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x79, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x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0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, + 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, + 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, + 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, + 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, + 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, + 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, + 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, + 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, + 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, + 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, + 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, + 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, + 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, + 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, + 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00, + 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, + 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, + 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, + 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 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8e, 0x6c, 0x88, 0x04, 0x11, 0x14, + 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, 0x6d, 0x54, 0x45, 0x71, 0x54, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, + 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, + 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, + 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, + 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d, + 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40, + 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90, + 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, + 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, + 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, + 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a, + 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a, + 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, + 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49, + 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, + 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90, + 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c, + 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01, + 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, + 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, + 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, + 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, + 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88, + 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87, + 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5, + 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a, + 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26, + 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac, + 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b, + 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a, + 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1, + 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d, + 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07, + 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c, + 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9, + 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81, + 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76, + 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04, + 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, + 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70, + 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a, + 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79, + 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74, + 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76, + 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77, + 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41, + 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1, + 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48, + 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48, + 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4, + 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff, + 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06, + 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xdd, + 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04, 0x80, 0xe0, 0x0c, 0x00, + 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20, 0x10, 0x99, 0x01, 0xa0, + 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41, 0x10, 0xff, 0x46, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, 0x88, 0x01, 0xe4, 0x4c, + 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c, 0x01, 0xf4, 0x50, 0xca, + 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32, 0x08, 0x86, 0x33, 0xc8, + 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77, 0x8d, 0xa5, 0xa0, 0xd8, + 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34, 0xcf, 0x78, 0x03, 0x07, + 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20, 0x43, 0x10, 0x4d, 0x23, + 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31, 0x4c, 0x41, 0x1c, 0x8c, + 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07, 0x4b, 0x30, 0xc7, 0x60, + 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20, 0x07, 0x17, 0x8c, 0xa5, + 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50, 0x10, 0x81, 0x1f, 0x44, + 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43, 0xf0, 0xe1, 0x81, 0x05, + 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x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e0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, + 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, + 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, + 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, + 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, + 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, + 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, + 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, + 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, + 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, + 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, + 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, + 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, + 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, + 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00, + 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, + 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, + 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, + 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xa8, 0x06, 0x1a, + 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, + 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, + 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, + 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, + 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, 0x51, 0x94, 0x43, 0x3d, 0x54, + 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, + 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, + 0xb9, 0x95, 0xc9, 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, + 0x8d, 0xbd, 0xbd, 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, + 0x09, 0x4b, 0x93, 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, + 0x4b, 0xb3, 0x2b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, + 0xae, 0x0c, 0x6f, 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x04, 0x11, 0x14, + 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, 0x6d, 0x54, 0x45, 0x71, 0x54, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, + 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, + 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, + 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, + 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d, + 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40, + 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90, + 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, + 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, + 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, + 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a, + 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a, + 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, + 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49, + 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, + 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90, + 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c, + 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01, + 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, + 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, + 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, + 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, + 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88, + 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87, + 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5, + 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a, + 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26, + 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac, + 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b, + 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a, + 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1, + 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d, + 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07, + 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c, + 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9, + 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81, + 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76, + 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04, + 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, + 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70, + 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a, + 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79, + 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74, + 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76, + 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77, + 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41, + 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1, + 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48, + 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48, + 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4, + 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff, + 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06, + 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xde, + 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20, 0xd0, 0xab, 0x81, 0x11, + 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6, 0x12, 0x02, 0x80, 0xc8, + 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40, + 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, + 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23, 0x06, 0xca, 0x10, 0x94, + 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c, 0x41, 0x81, 0x0c, 0x32, + 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20, 0x83, 0x10, 0x4c, 0x83, + 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62, 0x43, 0x00, 0x1f, 0xf2, + 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf, 0x18, 0xb8, 0xc1, 0x05, + 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d, 0x18, 0x14, 0x44, 0x50, + 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30, 0xde, 0x50, 0x06, 0x69, + 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x18, 0x18, 0x8c, + 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x79, 0x30, + 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, + 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10, 0x0a, 0x51, 0x30, 0xc7, + 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1, 0x1e, 0x58, 0x50, 0xc9, + 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x25, 0x08, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +const unsigned int sdl_metallib_len = 22744; diff --git a/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h new file mode 100644 index 000000000..787c6fe21 --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h @@ -0,0 +1,1903 @@ +const unsigned char sdl_metallib[] = { + 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x80, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, + 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, + 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, + 0xcb, 0x86, 0x8e, 0x78, 0x90, 0x1d, 0xa9, 0xc3, 0xb9, 0xec, 0xcd, 0xec, + 0x69, 0xba, 0x3d, 0x7e, 0x97, 0xb5, 0xa9, 0x05, 0x01, 0xbe, 0x87, 0xd8, + 0x0c, 0xca, 0x1a, 0xb4, 0x91, 0x54, 0x7e, 0x29, 0x4f, 0x46, 0x46, 0x54, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f, + 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59, + 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0xf5, + 0xc6, 0xe3, 0x26, 0x71, 0xe3, 0x1c, 0x45, 0x4d, 0xb1, 0xdb, 0x0e, 0x1a, + 0x29, 0x85, 0x9d, 0xa7, 0x04, 0x40, 0x91, 0x18, 0x99, 0x5c, 0x9f, 0xdb, + 0x7c, 0x30, 0xd1, 0x67, 0x59, 0xd8, 0xa4, 0x4f, 0x46, 0x46, 0x54, 0x18, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e, + 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c, + 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00, + 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20, + 0x00, 0x31, 0xa8, 0x6b, 0xb7, 0x4d, 0x8a, 0x56, 0xc7, 0x91, 0xa4, 0x37, + 0xfd, 0xa6, 0xbf, 0x79, 0xd1, 0x55, 0x8c, 0xd5, 0x1b, 0x88, 0x69, 0x8e, + 0x6c, 0xf0, 0x53, 0x1b, 0xd3, 0x35, 0xfe, 0x3f, 0x01, 0x4f, 0x46, 0x46, + 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00, + 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, + 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x52, 0xe7, 0xfc, 0x67, 0x4e, 0xed, 0x7a, 0xa8, 0x44, 0x82, + 0xb2, 0x41, 0x3c, 0xdb, 0x9e, 0xe8, 0x5b, 0xbb, 0x30, 0x60, 0xf8, 0xa1, + 0x94, 0xac, 0xb4, 0x80, 0xaa, 0x08, 0xa6, 0xa0, 0xe6, 0xfd, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x28, 0x59, 0x9d, 0x20, 0x32, 0xc7, 0x94, 0x63, 0xa8, 0xda, + 0x9c, 0xac, 0x28, 0xb8, 0x01, 0xc3, 0x5f, 0x48, 0xf6, 0x74, 0x09, 0x1a, + 0xd9, 0x84, 0x91, 0x19, 0xc6, 0xe7, 0x4e, 0x94, 0x47, 0xce, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, + 0x48, 0x20, 0x00, 0x08, 0x35, 0xd4, 0x21, 0x2f, 0xca, 0x8d, 0x22, 0xb2, + 0xa3, 0x9a, 0xd8, 0xd9, 0x46, 0x6d, 0x01, 0x7d, 0x06, 0x95, 0x04, 0x7a, + 0x94, 0xdf, 0x2b, 0xd2, 0x21, 0xea, 0x99, 0x9f, 0x2b, 0xda, 0x65, 0x4f, + 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, + 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, + 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, + 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, + 0x53, 0x48, 0x20, 0x00, 0xe0, 0x53, 0xda, 0x06, 0xef, 0x80, 0x49, 0x61, + 0xf6, 0x9e, 0xee, 0xfe, 0x49, 0xb6, 0xd2, 0xce, 0xb8, 0xea, 0x5f, 0x9a, + 0xf4, 0x77, 0x35, 0xe7, 0xd3, 0xfc, 0x0f, 0xf6, 0x01, 0xe5, 0x90, 0xd6, + 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x46, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, + 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x38, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xcb, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0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0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4, + 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18, + 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0, + 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84, + 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4, + 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94, + 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30, + 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47, + 0x10, 0x50, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, + 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, + 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, + 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, + 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, + 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, + 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, + 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, + 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, + 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x30, 0x02, 0x50, + 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06, 0xd4, 0x46, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00, + 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69, + 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2, + 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, + 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90, + 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, + 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59, + 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61, 0x69, 0x72, 0x2e, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x2c, 0xcc, + 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9, 0xd1, 0x4d, 0xa5, + 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a, 0x81, 0x96, 0x6a, + 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, + 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b, 0xdb, 0xdb, 0x58, + 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59, 0x19, 0x1e, 0x91, + 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc, 0xbe, 0xe6, 0xd2, + 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x0c, 0xe1, 0x10, + 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96, 0x0d, 0x21, 0x16, + 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8, 0x84, 0xa5, 0xc9, + 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, + 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3, 0xa1, 0x02, 0x27, + 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x04, 0x0c, 0x90, + 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90, 0x60, 0xd1, 0x96, + 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83, 0x05, 0x5a, 0xc2, + 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b, 0x5c, 0xdb, 0x10, + 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32, 0xe4, 0x40, 0x82, + 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c, 0x05, 0x0c, 0x16, + 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, + 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8, 0x38, 0xd8, + 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63, 0x29, 0x83, 0xc5, 0x59, 0xcc, 0x60, + 0x81, 0x96, 0x33, 0x18, 0x82, 0x2c, 0xde, 0x22, 0x06, 0x0b, 0x19, 0x2c, + 0x68, 0x30, 0xc4, 0x50, 0x80, 0xe5, 0x5a, 0xd2, 0x80, 0xcf, 0x5b, 0x9b, + 0x5b, 0x1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0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, 0x0c, 0x7f, 0x45, 0x44, + 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x20, + 0x31, 0x03, 0x40, 0x61, 0x06, 0x80, 0xc0, 0x08, 0xc0, 0x18, 0x01, 0x08, + 0x82, 0x20, 0xfe, 0x01, 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c, + 0x12, 0x14, 0xe3, 0x11, 0x0e, 0x64, 0x41, 0x14, 0x94, 0x59, 0x82, 0x60, + 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x44, + 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x25, 0xb2, 0xc0, 0x90, 0xcf, + 0x2c, 0x81, 0x30, 0x50, 0x81, 0xf8, 0x41, 0x50, 0x09, 0x03, 0x15, 0x01, + 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, 0x40, 0x41, 0x18, 0x0c, + 0x32, 0x04, 0xd1, 0x75, 0x45, 0x93, 0xf1, 0x08, 0xce, 0x23, 0x83, 0x80, + 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8, 0x98, 0x92, 0x06, 0x30, + 0x18, 0x6e, 0x08, 0x34, 0x30, 0x98, 0x65, 0x18, 0x84, 0x60, 0x3c, 0xc2, + 0x22, 0x03, 0x35, 0x88, 0x06, 0x23, 0x02, 0xa2, 0x00, 0x6c, 0x62, 0x03, + 0x18, 0x0c, 0x37, 0x04, 0x1d, 0x18, 0xcc, 0x32, 0x10, 0x41, 0x30, 0x1e, + 0x91, 0x9d, 0x41, 0x1b, 0x9c, 0x01, 0x05, 0x65, 0x3c, 0x62, 0x4b, 0x83, + 0x37, 0x08, 0x03, 0x0a, 0xca, 0x78, 0x44, 0xb7, 0x06, 0x71, 0x40, 0x06, + 0x14, 0x94, 0xf1, 0x88, 0xaf, 0x0d, 0xe6, 0xe0, 0x0c, 0x28, 0x28, 0xe3, + 0x11, 0x60, 0xf0, 0x06, 0x75, 0xf0, 0x06, 0x83, 0x11, 0x01, 0x52, 0x00, + 0xe3, 0x11, 0x61, 0x00, 0x07, 0x76, 0x80, 0x06, 0x83, 0x11, 0xc1, 0x51, + 0x00, 0xe3, 0x11, 0x62, 0x10, 0x07, 0x77, 0xa0, 0x06, 0x83, 0x11, 0x81, + 0x51, 0x00, 0xe3, 0x11, 0x63, 0x20, 0x07, 0x78, 0xc0, 0x06, 0x83, 0x11, + 0x41, 0x51, 0x00, 0xf7, 0x06, 0x2d, 0xc6, 0x13, 0xe6, 0x20, 0xa0, 0x80, + 0x8c, 0x21, 0x04, 0x7c, 0x30, 0xc7, 0xc0, 0x06, 0x41, 0x1f, 0x8c, 0x21, + 0x0c, 0x7f, 0x30, 0xc7, 0x20, 0x04, 0xa0, 0x30, 0xc7, 0x10, 0xb8, 0x41, + 0x1f, 0xcc, 0x31, 0x04, 0x6e, 0xc0, 0x07, 0x83, 0x0c, 0x41, 0x1c, 0xdc, + 0x81, 0x05, 0x95, 0x7c, 0x66, 0x09, 0x8a, 0x81, 0x0a, 0x44, 0x25, 0x88, + 0xaa, 0x18, 0xa8, 0x08, 0x08, 0x22, 0x2a, 0xc6, 0x10, 0x0a, 0x61, 0x8e, + 0xc1, 0x0e, 0x82, 0x53, 0x18, 0x64, 0x08, 0xee, 0xa0, 0x0f, 0xae, 0x68, + 0x32, 0x1e, 0x51, 0x07, 0xa4, 0xa0, 0x0a, 0x01, 0x05, 0xc5, 0x02, 0x42, + 0x3e, 0x16, 0x20, 0xf0, 0x31, 0xe5, 0x15, 0x60, 0x30, 0xdc, 0x10, 0x80, + 0x02, 0x18, 0xcc, 0x32, 0x18, 0x45, 0x30, 0xdb, 0x00, 0x0a, 0x03, 0x30, + 0xdb, 0x10, 0xf8, 0x41, 0x90, 0x41, 0x40, 0x0c, 0x08, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12, 0xbc, 0xc1, 0x96, 0x61, + 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0, 0x65, 0x80, 0x83, 0xe0, + 0x0d, 0xb6, 0x0c, 0xa1, 0x10, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0xe1, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, + 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c, + 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, + 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a, + 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72, + 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72, + 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21, + 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81, + 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73, + 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79, + 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79, + 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80, + 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0, + 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21, + 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21, + 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77, + 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, + 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77, + 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77, + 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78, + 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1, + 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1, + 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77, + 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, + 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, + 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, + 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, + 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, + 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, + 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, + 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, + 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, + 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, + 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, + 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, + 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, + 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, + 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7, + 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44, + 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16, + 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e, + 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e, + 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e, + 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c, + 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18, + 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23, + 0x08, 0x28, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, + 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, + 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, + 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, + 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, + 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, + 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, + 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, + 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, + 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x50, 0x10, 0x23, + 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06, 0x85, 0x40, 0x6d, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x04, 0x64, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x64, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe5, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, + 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, + 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, + 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, + 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, + 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, + 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x46, + 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x6f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc, 0xca, 0xe4, 0xc2, + 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6, 0xde, 0xde, 0xe4, + 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98, 0xb1, 0xbd, 0x85, + 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b, 0x93, 0x23, 0x1b, + 0xc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x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0xc0, 0x00, + 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4, 0x40, 0x82, 0x65, + 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68, + 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, + 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xe4, + 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, + 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8, + 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39, 0x83, 0xc5, 0x59, + 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde, 0x02, 0x06, 0x0b, + 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01, 0x16, 0x6c, 0x59, + 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, + 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, + 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8b, + 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49, 0x86, 0x18, 0x0b, + 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, + 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, + 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, + 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, + 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, + 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, + 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, + 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e, 0xca, 0x01, 0x1f, + 0xa6, 0x04, 0x6c, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d, 0xf9, 0x73, 0xce, 0x83, + 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, + 0x00, 0x8d, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40, 0x10, + 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12, + 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0x0d, 0x64, 0x41, 0x14, + 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b, + 0x9a, 0x8c, 0x47, 0x40, 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x05, + 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x80, 0x42, 0x50, + 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, + 0x40, 0x41, 0x18, 0x0c, 0x32, 0x04, 0x91, 0x75, 0x45, 0x93, 0xf1, 0x88, + 0xcd, 0x23, 0x83, 0x80, 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8, + 0x98, 0xa2, 0x06, 0x30, 0x18, 0x6e, 0x08, 0xc8, 0x00, 0x0c, 0x66, 0x19, + 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xc8, 0x40, 0x0d, 0xa2, 0xc1, 0x88, 0x80, + 0x28, 0x00, 0x9b, 0xda, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x19, 0x80, 0xc1, + 0x2c, 0x03, 0x11, 0x04, 0xe3, 0x11, 0xd9, 0x19, 0xb4, 0xc1, 0x19, 0x50, + 0x50, 0xc6, 0x23, 0xb6, 0x34, 0x78, 0x03, 0x30, 0xa0, 0xa0, 0x8c, 0x47, + 0x74, 0x6b, 0x10, 0x07, 0x63, 0x40, 0x41, 0x19, 0x8f, 0xf8, 0xda, 0x60, + 0x0e, 0xcc, 0x80, 0x82, 0x32, 0x1e, 0x01, 0x06, 0x6f, 0x50, 0x07, 0x6f, + 0x30, 0x18, 0x11, 0x20, 0x05, 0x30, 0x1e, 0x11, 0x06, 0x70, 0x60, 0x07, + 0x67, 0x30, 0x18, 0x11, 0x1c, 0x05, 0x30, 0x1e, 0x21, 0x06, 0x71, 0x70, + 0x07, 0x69, 0x30, 0x18, 0x11, 0x18, 0x05, 0x30, 0x1e, 0x31, 0x06, 0x72, + 0x80, 0x07, 0x6b, 0x30, 0x18, 0x11, 0x14, 0x05, 0x70, 0x6e, 0xd0, 0x62, + 0x3c, 0x61, 0x0e, 0x02, 0x0a, 0xc8, 0x18, 0x42, 0xc0, 0x07, 0x73, 0x0c, + 0x6c, 0x10, 0xf4, 0xc1, 0x18, 0xc2, 0x00, 0x0a, 0x73, 0x0c, 0x42, 0x10, + 0x0a, 0x73, 0x0c, 0x41, 0x1b, 0xf8, 0xc1, 0x1c, 0x43, 0xf0, 0x06, 0x7d, + 0x30, 0xc8, 0x10, 0xc4, 0x81, 0x1d, 0x58, 0x50, 0xc9, 0x67, 0x96, 0xa0, + 0x18, 0xa8, 0x40, 0x58, 0x82, 0xa8, 0x8a, 0x81, 0x8a, 0x80, 0x20, 0xa2, + 0x62, 0x0c, 0xa1, 0x10, 0xe6, 0x18, 0xec, 0x20, 0x38, 0x85, 0x41, 0x86, + 0xe0, 0x0e, 0xf8, 0xe0, 0x8a, 0x26, 0xe3, 0x11, 0x75, 0x40, 0x0a, 0xaa, + 0x10, 0x50, 0x50, 0x2c, 0x20, 0xe4, 0x63, 0x01, 0x02, 0x1f, 0x53, 0x60, + 0x01, 0x06, 0xc3, 0x0d, 0x81, 0x2a, 0x80, 0xc1, 0x2c, 0x83, 0x51, 0x04, + 0xe3, 0x09, 0xa8, 0x70, 0x51, 0x40, 0x66, 0x1b, 0x44, 0xa1, 0x00, 0x66, + 0x1b, 0x02, 0x21, 0xc8, 0x20, 0x20, 0x06, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12, 0xc4, 0xc1, 0x96, 0x61, + 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0, 0x65, 0x80, 0x83, 0x20, + 0x0e, 0xb6, 0x0c, 0xa1, 0x10, 0xc4, 0xc1, 0x96, 0x01, 0x15, 0x82, 0x38, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x98, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x81, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40, + 0x2e, 0xc2, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38, + 0xbc, 0x83, 0x3c, 0xc8, 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e, + 0xb4, 0x81, 0x3c, 0xbc, 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39, + 0xb4, 0x01, 0x39, 0xa4, 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b, + 0xcc, 0x43, 0x3c, 0xc8, 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, + 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x10, 0xe4, 0x90, 0x0e, 0xf3, 0x10, 0x0e, 0xe2, 0xc0, + 0x0e, 0xe5, 0xd0, 0x06, 0xf4, 0x10, 0x0e, 0xe9, 0xc0, 0x0e, 0x6d, 0x30, + 0x0e, 0xe1, 0xc0, 0x0e, 0xec, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x3b, 0x94, 0xc3, 0x3c, 0xcc, 0x43, 0x1b, + 0xc0, 0x83, 0x3c, 0x94, 0xc3, 0x38, 0xa4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, + 0x98, 0x03, 0x3c, 0xb4, 0x43, 0x38, 0x90, 0x03, 0x40, 0x0f, 0xf2, 0x50, + 0x0f, 0xe5, 0x00, 0x10, 0xee, 0xf0, 0x0e, 0x6d, 0x60, 0x0e, 0xf2, 0x10, + 0x0e, 0xed, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0xef, 0x90, 0x0e, 0xee, 0x40, + 0x0f, 0xe5, 0x20, 0x0f, 0x6d, 0x50, 0x0e, 0xec, 0x90, 0x0e, 0xed, 0x00, + 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x83, 0x3b, 0xbc, 0x43, 0x1b, + 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, + 0xa4, 0x83, 0x3b,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0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xb4, 0x81, 0x38, + 0xd4, 0x83, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0xcc, 0x43, 0x3a, + 0xe8, 0x43, 0x39, 0x00, 0x78, 0x00, 0x10, 0xf4, 0x10, 0x0e, 0xf2, 0x70, + 0x0e, 0xe5, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xe5, 0x10, 0x0e, 0xf4, 0x50, + 0x0f, 0xf2, 0x50, 0x0e, 0xf3, 0x00, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1c, + 0xd8, 0x01, 0x40, 0xd4, 0x83, 0x3b, 0xcc, 0x43, 0x38, 0x98, 0x43, 0x39, + 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, + 0x00, 0xf4, 0x20, 0x0f, 0xf5, 0x50, 0x0e, 0x00, 0x51, 0x0f, 0xf3, 0x50, + 0x0e, 0x6d, 0x30, 0x0f, 0xef, 0x60, 0x0e, 0xf4, 0xd0, 0x06, 0xe6, 0xc0, + 0x0e, 0xef, 0x10, 0x0e, 0xf4, 0x00, 0x98, 0x43, 0x38, 0xb0, 0xc3, 0x3c, + 0x94, 0x03, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x13, 0x84, 0x40, 0x00, 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, + 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, + 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, + 0x88, 0x10, 0x08, 0x45, 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83, + 0x39, 0x02, 0x50, 0x18, 0x01, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x21, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, + 0x02, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2, + 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00, + 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69, + 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, + 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, + 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x8a, 0xc6, 0x08, 0x0a, 0xa7, 0x78, + 0x86, 0x08, 0x05, 0x44, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, 0xcc, + 0xac, 0x4c, 0x8e, 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, + 0x99, 0xdc, 0xd7, 0x5c, 0x9a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da, 0xc1, 0x0d, 0xd2, 0x81, + 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21, + 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1, + 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, + 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1, + 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, + 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, + 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, + 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, + 0x06, 0xa2, 0x30, 0x23, 0x98, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x73, + 0x90, 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, + 0x01, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05, + 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x68, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x97, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19, + 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c, + 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, + 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, + 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, + 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, + 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, + 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, + 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, + 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, + 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, + 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, + 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, + 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, + 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, + 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, + 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, + 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, + 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, + 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, + 0x08, 0x77, 0x78, 0x87, 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68, + 0x03, 0x7a, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c, + 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, + 0xdc, 0x21, 0x1c, 0xdc, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, + 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, + 0x07, 0x80, 0x70, 0x87, 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70, + 0x87, 0x72, 0x20, 0x87, 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98, + 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e, + 0xe8, 0x21, 0x1c, 0xc6, 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, + 0xe8, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, + 0xea, 0xc1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, + 0xf4, 0xa1, 0x1c, 0x00, 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38, + 0x87, 0x72, 0xa0, 0x87, 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8, + 0x07, 0x79, 0x28, 0x87, 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e, + 0xec, 0x00, 0x20, 0xea, 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28, + 0x87, 0x36, 0x98, 0x87, 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60, + 0x87, 0x77, 0x08, 0x07, 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, + 0xca, 0x01, 0xd8, 0x40, 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58, + 0x36, 0x20, 0xc6, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40, + 0x05, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x13, 0x86, 0x40, 0x18, 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x48, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x70, 0x94, 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c, + 0x13, 0x15, 0x11, 0xbf, 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40, + 0x04, 0x17, 0x49, 0x53, 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c, + 0x44, 0xf4, 0x4f, 0x63, 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04, + 0x31, 0xca, 0x21, 0x34, 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82, + 0xb0, 0x14, 0x24, 0x94, 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c, + 0x01, 0x28, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x49, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, + 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04, + 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe7, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61, + 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, + 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, + 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 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, + 0x70, 0x09, 0x4b, 0x93, 0x73, 0xa1, 0x2b, 0xc3, 0xa3, 0xab, 0x93, 0x2b, + 0xa3, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x46, + 0x8c, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x8c, 0xc7, 0x8c, + 0xed, 0x2d, 0x8c, 0x8e, 0x05, 0x64, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0xcc, + 0x87, 0x03, 0x5d, 0x19, 0xde, 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0, + 0x60, 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e, + 0x34, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71, + 0x1e, 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f, + 0x19, 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79, + 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, + 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, + 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f, + 0x1c, 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f, + 0x1d, 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, + 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, + 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, + 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, + 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, + 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, + 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, + 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c, + 0xdc, 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16, + 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, + 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48, + 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10, + 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93, + 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x74, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x9a, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3,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 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x4e, 0x93, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2, + 0x22, 0xe2, 0xb7, 0x87, 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02, + 0x60, 0x10, 0x21, 0x09, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, + 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45, + 0x28, 0x48, 0x08, 0x62, 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8, + 0xcd, 0x11, 0x80, 0xc1, 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09, + 0x8a, 0x89, 0x28, 0xa7, 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a, + 0x40, 0x76, 0x20, 0x60, 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e, + 0x00, 0x14, 0x06, 0x11, 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, + 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, + 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, + 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, + 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, + 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, + 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, + 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, + 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, + 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x71, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0xc2, 0x40, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x61, 0x2a, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x86, 0x30, 0x17, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a, + 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, + 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01, + 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69, + 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, + 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, + 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b, + 0x86, 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, + 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, + 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, + 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0x11, + 0x81, 0x49, 0xd8, 0x84, 0x51, 0x98, 0x83, 0x3d, 0x58, 0x85, 0x59, 0x94, + 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, + 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, + 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, + 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, + 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, + 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, + 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x14, 0x15, 0x18, 0x86, 0x65, 0xd8, + 0x84, 0x69, 0x98, 0x83, 0x6d, 0x58, 0x85, 0x71, 0x54, 0xc2, 0xd2, 0xe4, + 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, + 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, + 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, + 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, + 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, + 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, + 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, + 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, + 0x37, 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81, + 0x41, 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06, + 0x91, 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93, + 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, + 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, + 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, + 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, + 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22, + 0xb0, 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, + 0xd2, 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62, + 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, + 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, + 0xb2, 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41, + 0x54, 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41, + 0x74, 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e, + 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, + 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, + 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, + 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, + 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00, + 0x03, 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac, + 0xc2, 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c, + 0xd9, 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18, + 0x1d, 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba, + 0x32, 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41, + 0x54, 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76, + 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, + 0x8e, 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21, + 0x52, 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60, + 0x79, 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32, + 0xc0, 0xde, 0x00, 0xa3, 0x03, 0xec, 0x0e, 0xb0, 0x3d, 0x18, 0x62, 0x38, + 0x00, 0x16, 0x61, 0x7c, 0xc0, 0xe7, 0xad, 0xcd, 0x2d, 0x0d, 0xee, 0x8d, + 0xae, 0xcc, 0x8d, 0x0e, 0x64, 0x0c, 0x2d, 0x4c, 0x8e, 0xcf, 0x54, 0x5a, + 0x1b, 0x1c, 0x5b, 0x19, 0xc8, 0xd0, 0xca, 0x0a, 0x08, 0x95, 0x50, 0x50, + 0xd0, 0x10, 0x01, 0xfb, 0x83, 0x21, 0x06, 0xe6, 0x07, 0x18, 0x28, 0x6c, + 0xd0, 0x10, 0x03, 0x0b, 0x05, 0x2c, 0x14, 0x36, 0x68, 0x84, 0xc2, 0x0e, + 0xec, 0x60, 0x0f, 0xed, 0xe0, 0x06, 0xe9, 0x40, 0x0e, 0xe5, 0xe0, 0x0e, + 0xf4, 0x30, 0x25, 0x08, 0x46, 0x2c, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, + 0xf6, 0x50, 0x0e, 0xf2, 0x30, 0x0f, 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x25, + 0x10, 0x46, 0x50, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xec, 0x10, 0x0e, + 0xee, 0x70, 0x0e, 0xf5, 0x10, 0x0e, 0xe7, 0x50, 0x0e, 0xbf, 0x60, 0x0f, + 0xe5, 0x20, 0x0f, 0xf3, 0x90, 0x0e, 0xef, 0xe0, 0x0e, 0x53, 0x02, 0x62, + 0xc4, 0x14, 0x0e, 0xe9, 0x20, 0x0f, 0x6e, 0x30, 0x0e, 0xef, 0xd0, 0x0e, + 0xf0, 0x90, 0x0e, 0xec, 0x50, 0x0e, 0xbf, 0xf0, 0x0e, 0xf0, 0x40, 0x0f, + 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x0f, 0x53, 0x08, 0x03, 0x51, 0x98, 0x11, + 0x4c, 0x38, 0xa4, 0x83, 0x3c, 0xb8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c, + 0x43, 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f, + 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9, + 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9, + 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, + 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1, + 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44, + 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf, + 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a, + 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23, + 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30, + 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20, + 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34, + 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20, + 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8, + 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1, + 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0, + 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19, + 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23, + 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c, + 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73, + 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95, + 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38, + 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b, + 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, + 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0, + 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0, + 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd0, 0x83, 0x3c, + 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, 0x1b, 0x98, 0x83, 0x3c, + 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, 0x3b, 0xa4, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xc8, 0x43, 0x1b, 0x94, 0x03, 0x3b, 0xa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, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, + 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14, + 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30, + 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10, + 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83, + 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61, + 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, + 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, + 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, + 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, + 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, + 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, + 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, + 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, + 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, + 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, + 0x0c, 0x41, 0xa8, 0x06, 0x1a, 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, + 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, + 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, + 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, + 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, + 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, + 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, + 0x51, 0x94, 0x43, 0x3d, 0x54, 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, + 0xcc, 0xe4, 0xc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x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, + 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, + 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, + 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, + 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, + 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, + 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, + 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, + 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, + 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, + 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, + 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, + 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, + 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, + 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, + 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, + 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, + 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, + 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, + 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, + 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, + 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, + 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, + 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, + 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, + 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, + 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, + 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, + 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, + 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, + 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, + 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, + 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, + 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, + 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, + 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, + 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, + 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, + 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, + 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, + 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, + 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, + 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10, + 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x64, 0xe7, 0x20, 0x06, 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, + 0xc7, 0x30, 0x10, 0xdd, 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04, + 0x80, 0xe0, 0x0c, 0x00, 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20, + 0x10, 0x99, 0x01, 0xa0, 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41, + 0x10, 0xff, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, + 0x88, 0x01, 0xe4, 0x4c, 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c, + 0x01, 0xf4, 0x50, 0xca, 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32, + 0x08, 0x86, 0x33, 0xc8, 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77, + 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34, + 0xcf, 0x78, 0x03, 0x07, 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20, + 0x43, 0x10, 0x4d, 0x23, 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31, + 0x4c, 0x41, 0x1c, 0x8c, 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63, + 0x29, 0x28, 0x83, 0x0c, 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07, + 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20, + 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50, + 0x10, 0x81, 0x1f, 0x44, 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43, + 0xf0, 0xe1, 0x81, 0x05, 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x7d, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38, + 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b, + 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, + 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0, + 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0, + 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, 0x00, 0xd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, 0x30, + 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, + 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14, + 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30, + 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10, + 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83, + 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61, + 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, + 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, + 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, + 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, + 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, + 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, + 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, + 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, + 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, + 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, + 0x0c, 0x41, 0xa8, 0x06, 0x1a, 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, + 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, + 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, + 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, + 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, + 0x61, 0x72, 0x67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x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, + 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, + 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, + 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, + 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, + 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, + 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, + 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, + 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, + 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, + 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, + 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, + 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, + 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, + 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, + 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, + 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, + 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, + 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, + 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, + 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, + 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, + 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, + 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, + 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, + 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, + 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, + 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, + 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, + 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, + 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, + 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, + 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, + 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, + 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, + 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, + 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, + 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, + 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, + 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, + 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, + 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, + 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, + 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, + 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, + 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10, + 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x64, 0xe7, 0x20, 0x06, 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, + 0xc7, 0x30, 0x10, 0xde, 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20, + 0xd0, 0xab, 0x81, 0x11, 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6, + 0x12, 0x02, 0x80, 0xc8, 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00, + 0x04, 0xc6, 0x08, 0x40, 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23, + 0x06, 0xca, 0x10, 0x94, 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c, + 0x41, 0x81, 0x0c, 0x32, 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20, + 0x83, 0x10, 0x4c, 0x83, 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62, + 0x43, 0x00, 0x1f, 0xf2, 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf, + 0x18, 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d, + 0x18, 0x14, 0x44, 0x50, 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30, + 0xde, 0x50, 0x06, 0x69, 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, + 0x04, 0x18, 0x18, 0x8c, 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7, + 0x60, 0x04, 0x79, 0x30, 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c, + 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10, + 0x0a, 0x51, 0x30, 0xc7, 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1, + 0x1e, 0x58, 0x50, 0xc9, 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x25, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +const unsigned int sdl_metallib_len = 22792; diff --git a/Engine/lib/sdl/src/render/metal/build-metal-shaders.sh b/Engine/lib/sdl/src/render/metal/build-metal-shaders.sh new file mode 100755 index 000000000..8ebf63eab --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/build-metal-shaders.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -x +set -e +cd `dirname "$0"` + +generate_shaders() +{ + platform=$1 + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=$platform-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal || exit $? + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $? + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $? + xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h + rm -f sdl.air sdl.metalar sdl.metallib +} + +generate_shaders osx +generate_shaders ios diff --git a/Engine/lib/sdl/src/render/mmx.h b/Engine/lib/sdl/src/render/mmx.h deleted file mode 100644 index 3bd00ac23..000000000 --- a/Engine/lib/sdl/src/render/mmx.h +++ /dev/null @@ -1,642 +0,0 @@ -/* mmx.h - - MultiMedia eXtensions GCC interface library for IA32. - - To use this library, simply include this header file - and compile with GCC. You MUST have inlining enabled - in order for mmx_ok() to work; this can be done by - simply using -O on the GCC command line. - - Compiling with -DMMX_TRACE will cause detailed trace - output to be sent to stderr for each mmx operation. - This adds lots of code, and obviously slows execution to - a crawl, but can be very useful for debugging. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT - LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR ANY PARTICULAR PURPOSE. - - 1997-99 by H. Dietz and R. Fisher - - Notes: - It appears that the latest gas has the pand problem fixed, therefore - I'll undefine BROKEN_PAND by default. -*/ - -#ifndef _MMX_H -#define _MMX_H - - -/* Warning: at this writing, the version of GAS packaged - with most Linux distributions does not handle the - parallel AND operation mnemonic correctly. If the - symbol BROKEN_PAND is defined, a slower alternative - coding will be used. If execution of mmxtest results - in an illegal instruction fault, define this symbol. -*/ -#undef BROKEN_PAND - - -/* The type of an value that fits in an MMX register - (note that long long constant values MUST be suffixed - by LL and unsigned long long values by ULL, lest - they be truncated by the compiler) -*/ -typedef union -{ - long long q; /* Quadword (64-bit) value */ - unsigned long long uq; /* Unsigned Quadword */ - int d[2]; /* 2 Doubleword (32-bit) values */ - unsigned int ud[2]; /* 2 Unsigned Doubleword */ - short w[4]; /* 4 Word (16-bit) values */ - unsigned short uw[4]; /* 4 Unsigned Word */ - char b[8]; /* 8 Byte (8-bit) values */ - unsigned char ub[8]; /* 8 Unsigned Byte */ - float s[2]; /* Single-precision (32-bit) value */ -} __attribute__ ((aligned(8))) mmx_t; /* On an 8-byte (64-bit) boundary */ - - -#if 0 -/* Function to test if multimedia instructions are supported... -*/ -inline extern int -mm_support(void) -{ - /* Returns 1 if MMX instructions are supported, - 3 if Cyrix MMX and Extended MMX instructions are supported - 5 if AMD MMX and 3DNow! instructions are supported - 0 if hardware does not support any of these - */ - register int rval = 0; - - __asm__ __volatile__( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into eax and ecx */ - "pushf\n\t" - "popl %%eax\n\t" "movl %%eax, %%ecx\n\t" - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xorl $0x200000, %%eax\n\t" - "push %%eax\n\t" "popf\n\t" - /* ... Get the (hopefully modified) EFLAGS */ - "pushf\n\t" "popl %%eax\n\t" - /* ... Compare and test result */ - "xorl %%eax, %%ecx\n\t" "testl $0x200000, %%ecx\n\t" "jz NotSupported1\n\t" /* CPUID not supported */ - /* Get standard CPUID information, and - go to a specific vendor section */ - "movl $0, %%eax\n\t" "cpuid\n\t" - /* Check for Intel */ - "cmpl $0x756e6547, %%ebx\n\t" - "jne TryAMD\n\t" - "cmpl $0x49656e69, %%edx\n\t" - "jne TryAMD\n\t" - "cmpl $0x6c65746e, %%ecx\n" - "jne TryAMD\n\t" "jmp Intel\n\t" - /* Check for AMD */ - "\nTryAMD:\n\t" - "cmpl $0x68747541, %%ebx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x69746e65, %%edx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x444d4163, %%ecx\n" - "jne TryCyrix\n\t" "jmp AMD\n\t" - /* Check for Cyrix */ - "\nTryCyrix:\n\t" - "cmpl $0x69727943, %%ebx\n\t" - "jne NotSupported2\n\t" - "cmpl $0x736e4978, %%edx\n\t" - "jne NotSupported3\n\t" - "cmpl $0x64616574, %%ecx\n\t" - "jne NotSupported4\n\t" - /* Drop through to Cyrix... */ - /* Cyrix Section */ - /* See if extended CPUID level 80000001 is supported */ - /* The value of CPUID/80000001 for the 6x86MX is undefined - according to the Cyrix CPU Detection Guide (Preliminary - Rev. 1.01 table 1), so we'll check the value of eax for - CPUID/0 to see if standard CPUID level 2 is supported. - According to the table, the only CPU which supports level - 2 is also the only one which supports extended CPUID levels. - */ - "cmpl $0x2, %%eax\n\t" "jne MMXtest\n\t" /* Use standard CPUID instead */ - /* Extended CPUID supported (in theory), so get extended - features */ - "movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%eax\n\t" /* Test for MMX */ - "jz NotSupported5\n\t" /* MMX not supported */ - "testl $0x01000000, %%eax\n\t" /* Test for Ext'd MMX */ - "jnz EMMXSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" "EMMXSupported:\n\t" "movl $3, %0:\n\n\t" /* EMMX and MMX Supported */ - "jmp Return\n\t" - /* AMD Section */ - "AMD:\n\t" - /* See if extended CPUID is supported */ - "movl $0x80000000, %%eax\n\t" "cpuid\n\t" "cmpl $0x80000000, %%eax\n\t" "jl MMXtest\n\t" /* Use standard CPUID instead */ - /* Extended CPUID supported, so get extended features */ - "movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported6\n\t" /* MMX not supported */ - "testl $0x80000000, %%edx\n\t" /* Test for 3DNow! */ - "jnz ThreeDNowSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" "ThreeDNowSupported:\n\t" "movl $5, %0:\n\n\t" /* 3DNow! and MMX Supported */ - "jmp Return\n\t" - /* Intel Section */ - "Intel:\n\t" - /* Check for MMX */ - "MMXtest:\n\t" "movl $1, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported7\n\t" /* MMX Not supported */ - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\t" - /* Nothing supported */ - "\nNotSupported1:\n\t" "#movl $101, %0:\n\n\t" "\nNotSupported2:\n\t" "#movl $102, %0:\n\n\t" "\nNotSupported3:\n\t" "#movl $103, %0:\n\n\t" "\nNotSupported4:\n\t" "#movl $104, %0:\n\n\t" "\nNotSupported5:\n\t" "#movl $105, %0:\n\n\t" "\nNotSupported6:\n\t" "#movl $106, %0:\n\n\t" "\nNotSupported7:\n\t" "#movl $107, %0:\n\n\t" "movl $0, %0:\n\n\t" "Return:\n\t":"=a"(rval): /* no input */ - :"eax", "ebx", "ecx", "edx"); - - /* Return */ - return (rval); -} - -/* Function to test if mmx instructions are supported... -*/ -inline extern int -mmx_ok(void) -{ - /* Returns 1 if MMX instructions are supported, 0 otherwise */ - return (mm_support() & 0x1); -} -#endif - -/* Helper functions for the instruction macros that follow... - (note that memory-to-register, m2r, instructions are nearly - as efficient as register-to-register, r2r, instructions; - however, memory-to-memory instructions are really simulated - as a convenience, and are only 1/3 as efficient) -*/ -#ifdef MMX_TRACE - -/* Include the stuff for printing a trace to stderr... -*/ - -#define mmx_i2r(op, imm, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace.uq = (imm); \ - printf(#op "_i2r(" #imm "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2r(op, mem, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mem); \ - printf(#op "_m2r(" #mem "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2m(op, reg, mem) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2m(" #reg "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2r(op, regs, regd) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #regs ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2r(" #regs "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2m(op, mems, memd) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mems); \ - printf(#op "_m2m(" #mems "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#else - -/* These macros are a lot simpler without the tracing... -*/ - -#define mmx_i2r(op, imm, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm) ) - -#define mmx_m2r(op, mem, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "m" (mem)) - -#define mmx_r2m(op, reg, mem) \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=m" (mem) \ - : /* nothing */ ) - -#define mmx_r2r(op, regs, regd) \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd) - -#define mmx_m2m(op, mems, memd) \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)) - -#endif - - -/* 1x64 MOVe Quadword - (this is both a load and a store... - in fact, it is the only way to store) -*/ -#define movq_m2r(var, reg) mmx_m2r(movq, var, reg) -#define movq_r2m(reg, var) mmx_r2m(movq, reg, var) -#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd) -#define movq(vars, vard) \ - __asm__ __volatile__ ("movq %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 1x32 MOVe Doubleword - (like movq, this is both load and store... - but is most useful for moving things between - mmx registers and ordinary registers) -*/ -#define movd_m2r(var, reg) mmx_m2r(movd, var, reg) -#define movd_r2m(reg, var) mmx_r2m(movd, reg, var) -#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd) -#define movd(vars, vard) \ - __asm__ __volatile__ ("movd %1, %%mm0\n\t" \ - "movd %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 2x32, 4x16, and 8x8 Parallel ADDs -*/ -#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg) -#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd) -#define paddd(vars, vard) mmx_m2m(paddd, vars, vard) - -#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg) -#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd) -#define paddw(vars, vard) mmx_m2m(paddw, vars, vard) - -#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg) -#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd) -#define paddb(vars, vard) mmx_m2m(paddb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic -*/ -#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg) -#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd) -#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard) - -#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg) -#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd) -#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic -*/ -#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg) -#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd) -#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard) - -#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg) -#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd) -#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel SUBs -*/ -#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg) -#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd) -#define psubd(vars, vard) mmx_m2m(psubd, vars, vard) - -#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg) -#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd) -#define psubw(vars, vard) mmx_m2m(psubw, vars, vard) - -#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg) -#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd) -#define psubb(vars, vard) mmx_m2m(psubb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic -*/ -#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg) -#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd) -#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard) - -#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg) -#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd) -#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic -*/ -#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg) -#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd) -#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard) - -#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg) -#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd) -#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard) - - -/* 4x16 Parallel MULs giving Low 4x16 portions of results -*/ -#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg) -#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd) -#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard) - - -/* 4x16 Parallel MULs giving High 4x16 portions of results -*/ -#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg) -#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd) -#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard) - - -/* 4x16->2x32 Parallel Mul-ADD - (muls like pmullw, then adds adjacent 16-bit fields - in the multiply result to make the final 2x32 result) -*/ -#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg) -#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd) -#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard) - - -/* 1x64 bitwise AND -*/ -#ifdef BROKEN_PAND -#define pand_m2r(var, reg) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, reg); \ - mmx_m2r(pandn, var, reg); \ - } -#define pand_r2r(regs, regd) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, regd); \ - mmx_r2r(pandn, regs, regd) \ - } -#define pand(vars, vard) \ - { \ - movq_m2r(vard, mm0); \ - mmx_m2r(pandn, (mmx_t) -1LL, mm0); \ - mmx_m2r(pandn, vars, mm0); \ - movq_r2m(mm0, vard); \ - } -#else -#define pand_m2r(var, reg) mmx_m2r(pand, var, reg) -#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd) -#define pand(vars, vard) mmx_m2m(pand, vars, vard) -#endif - - -/* 1x64 bitwise AND with Not the destination -*/ -#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg) -#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd) -#define pandn(vars, vard) mmx_m2m(pandn, vars, vard) - - -/* 1x64 bitwise OR -*/ -#define por_m2r(var, reg) mmx_m2r(por, var, reg) -#define por_r2r(regs, regd) mmx_r2r(por, regs, regd) -#define por(vars, vard) mmx_m2m(por, vars, vard) - - -/* 1x64 bitwise eXclusive OR -*/ -#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg) -#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd) -#define pxor(vars, vard) mmx_m2m(pxor, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality - (resulting fields are either 0 or -1) -*/ -#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg) -#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd) -#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard) - -#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg) -#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd) -#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard) - -#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg) -#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd) -#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than - (resulting fields are either 0 or -1) -*/ -#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg) -#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd) -#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard) - -#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg) -#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd) -#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard) - -#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg) -#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd) -#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical -*/ -#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg) -#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg) -#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd) -#define psllq(vars, vard) mmx_m2m(psllq, vars, vard) - -#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg) -#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg) -#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd) -#define pslld(vars, vard) mmx_m2m(pslld, vars, vard) - -#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg) -#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg) -#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd) -#define psllw(vars, vard) mmx_m2m(psllw, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical -*/ -#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg) -#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg) -#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd) -#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard) - -#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg) -#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg) -#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd) -#define psrld(vars, vard) mmx_m2m(psrld, vars, vard) - -#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg) -#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg) -#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd) -#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard) - - -/* 2x32 and 4x16 Parallel Shift Right Arithmetic -*/ -#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg) -#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg) -#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd) -#define psrad(vars, vard) mmx_m2m(psrad, vars, vard) - -#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg) -#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg) -#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd) -#define psraw(vars, vard) mmx_m2m(psraw, vars, vard) - - -/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate - (packs source and dest fields into dest in that order) -*/ -#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg) -#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd) -#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard) - -#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg) -#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd) -#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard) - - -/* 4x16->8x8 PACK and Unsigned Saturate - (packs source and dest fields into dest in that order) -*/ -#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg) -#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd) -#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low - (interleaves low half of dest with low half of source - as padding in each result field) -*/ -#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg) -#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd) -#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard) - -#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg) -#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd) -#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard) - -#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg) -#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd) -#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High - (interleaves high half of dest with high half of source - as padding in each result field) -*/ -#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg) -#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd) -#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard) - -#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg) -#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd) -#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard) - -#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg) -#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd) -#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard) - - -/* Empty MMx State - (used to clean-up when going from mmx to float use - of the registers that are shared by both; note that - there is no float-to-mmx operation needed, because - only the float tag word info is corruptible) -*/ -#ifdef MMX_TRACE - -#define emms() \ - { \ - printf("emms()\n"); \ - __asm__ __volatile__ ("emms"); \ - } - -#else - -#define emms() __asm__ __volatile__ ("emms") - -#endif - -#endif -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h b/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h index c8eba583c..02be0e157 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h +++ b/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,8 @@ SDL_PROC(void, glBindTexture, (GLenum, GLuint)) SDL_PROC_UNUSED(void, glBitmap, (GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *)) -SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC(void, glBlendEquation, (GLenum)) +SDL_PROC_UNUSED(void, glBlendFunc, (GLenum, GLenum)) SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC_UNUSED(void, glCallList, (GLuint)) SDL_PROC_UNUSED(void, glCallLists, (GLsizei, GLenum, const GLvoid *)) diff --git a/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c b/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c index 1ca2cb5c4..1c379eb25 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c +++ b/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags); static void GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, @@ -126,7 +127,7 @@ typedef struct struct { GL_Shader shader; Uint32 color; - int blendMode; + SDL_BlendMode blendMode; } current; SDL_bool GL_EXT_framebuffer_object_supported; @@ -259,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, #if 0 #define GL_CheckError(prefix, renderer) -#elif defined(_MSC_VER) -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__) #else -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__) +#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION) #endif static int @@ -275,7 +274,7 @@ GL_LoadFunctions(GL_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -320,8 +319,8 @@ GL_ResetState(SDL_Renderer *renderer) } data->current.shader = SHADER_NONE; - data->current.color = 0; - data->current.blendMode = -1; + data->current.color = 0xffffffff; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->glDisable(GL_DEPTH_TEST); data->glDisable(GL_CULL_FACE); @@ -428,6 +427,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->WindowEvent = GL_WindowEvent; renderer->GetOutputSize = GL_GetOutputSize; + renderer->SupportsBlendMode = GL_SupportsBlendMode; renderer->CreateTexture = GL_CreateTexture; renderer->UpdateTexture = GL_UpdateTexture; renderer->UpdateTextureYUV = GL_UpdateTextureYUV; @@ -493,7 +493,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); data->GL_ARB_debug_output_supported = SDL_TRUE; - data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)&data->next_error_callback); + data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)(char *)&data->next_error_callback); data->glGetPointerv(GL_DEBUG_CALLBACK_USER_PARAM_ARB, &data->next_error_userparam); glDebugMessageCallbackARBFunc(GL_HandleDebugMessage, renderer); @@ -595,6 +595,72 @@ GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + if (colorOperation != alphaOperation) { + return SDL_FALSE; + } + return SDL_TRUE; +} + SDL_FORCE_INLINE int power_of_2(int input) { @@ -684,12 +750,12 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { /* Need to add size for the U and V planes */ - size += (2 * (texture->h * data->pitch) / 4); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } if (texture->format == SDL_PIXELFORMAT_NV12 || texture->format == SDL_PIXELFORMAT_NV21) { /* Need to add size for the U/V plane */ - size += ((texture->h * data->pitch) / 2); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } data->pixels = SDL_calloc(1, size); if (!data->pixels) { @@ -807,8 +873,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2, - texture_h/2, 0, format, type, NULL); + renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2, + (texture_h+1)/2, 0, format, type, NULL); renderdata->glBindTexture(data->type, data->vtexture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, @@ -819,8 +885,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2, - texture_h/2, 0, format, type, NULL); + renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2, + (texture_h+1)/2, 0, format, type, NULL); renderdata->glDisable(data->type); } @@ -841,8 +907,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, texture_w/2, - texture_h/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); + renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, (texture_w+1)/2, + (texture_h+1)/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); renderdata->glDisable(data->type); } @@ -869,7 +935,7 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, rect->h, data->format, data->formattype, pixels); if (data->yuv) { - renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); + renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2)); /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); @@ -879,29 +945,29 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, renderdata->glBindTexture(data->type, data->utexture); } renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w+1)/2, (rect->h+1)/2, data->format, data->formattype, pixels); /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2)); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->utexture); } else { renderdata->glBindTexture(data->type, data->vtexture); } renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w+1)/2, (rect->h+1)/2, data->format, data->formattype, pixels); } if (data->nv12) { - renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); + renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2)); /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); renderdata->glBindTexture(data->type, data->utexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, pixels); } renderdata->glDisable(data->type); @@ -932,13 +998,13 @@ GL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Upitch); renderdata->glBindTexture(data->type, data->utexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, data->format, data->formattype, Uplane); renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Vpitch); renderdata->glBindTexture(data->type, data->vtexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, data->format, data->formattype, Vplane); renderdata->glDisable(data->type); @@ -1041,6 +1107,8 @@ GL_UpdateViewport(SDL_Renderer * renderer) 0.0, 1.0); } } + data->glMatrixMode(GL_MODELVIEW); + return GL_CheckError("", renderer); } @@ -1090,25 +1158,18 @@ GL_SetColor(GL_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) } static void -GL_SetBlendMode(GL_RenderData * data, int blendMode) +GL_SetBlendMode(GL_RenderData * data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: + } else { data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - break; - case SDL_BLENDMODE_ADD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - break; - case SDL_BLENDMODE_MOD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - break; + data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); + data->glBlendEquation(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode))); } data->current.blendMode = blendMode; } @@ -1286,13 +1347,37 @@ GL_SetupCopy(SDL_Renderer * renderer, SDL_Texture * texture) GL_SetBlendMode(data, texture->blendMode); - if (texturedata->yuv) { - GL_SetShader(data, SHADER_YUV); - } else if (texturedata->nv12) { - if (texture->format == SDL_PIXELFORMAT_NV12) { - GL_SetShader(data, SHADER_NV12); - } else { - GL_SetShader(data, SHADER_NV21); + if (texturedata->yuv || texturedata->nv12) { + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_JPEG); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_JPEG); + } else { + GL_SetShader(data, SHADER_NV21_JPEG); + } + break; + case SDL_YUV_CONVERSION_BT601: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_BT601); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_BT601); + } else { + GL_SetShader(data, SHADER_NV21_BT601); + } + break; + case SDL_YUV_CONVERSION_BT709: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_BT709); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_BT709); + } else { + GL_SetShader(data, SHADER_NV21_BT709); + } + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); } } else { GL_SetShader(data, SHADER_RGB); @@ -1430,18 +1515,21 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, GL_ActivateRenderer(renderer); + if (!convert_format(data, temp_format, &internalFormat, &format, &type)) { + return SDL_SetError("Texture format %s not supported by OpenGL", + SDL_GetPixelFormatName(temp_format)); + } + + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { return SDL_OutOfMemory(); } - if (!convert_format(data, temp_format, &internalFormat, &format, &type)) { - SDL_free(temp_pixels); - return SDL_SetError("Texture format %s not supported by OpenGL", - SDL_GetPixelFormatName(temp_format)); - } - SDL_GetRendererOutputSize(renderer, &w, &h); data->glPixelStorei(GL_PACK_ALIGNMENT, 1); @@ -1518,6 +1606,11 @@ GL_DestroyRenderer(SDL_Renderer * renderer) GL_RenderData *data = (GL_RenderData *) renderer->driverdata; if (data) { + if (data->context != NULL) { + /* make sure we delete the right resources! */ + GL_ActivateRenderer(renderer); + } + GL_ClearErrors(renderer); if (data->GL_ARB_debug_output_supported) { PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); diff --git a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c index bcf7b4315..251b54d13 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c +++ b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -62,6 +62,151 @@ struct GL_ShaderContext GL_ShaderData shaders[NUM_SHADERS]; }; +#define COLOR_VERTEX_SHADER \ +"varying vec4 v_color;\n" \ +"\n" \ +"void main()\n" \ +"{\n" \ +" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \ +" v_color = gl_Color;\n" \ +"}" \ + +#define TEXTURE_VERTEX_SHADER \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"\n" \ +"void main()\n" \ +"{\n" \ +" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \ +" v_color = gl_Color;\n" \ +" v_texCoord = vec2(gl_MultiTexCoord0);\n" \ +"}" \ + +#define JPEG_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1, 0.000, 1.402);\n" \ +"const vec3 Gcoeff = vec3(1, -0.3441, -0.7141);\n" \ +"const vec3 Bcoeff = vec3(1, 1.772, 0.000);\n" \ + +#define BT601_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.596);\n" \ +"const vec3 Gcoeff = vec3(1.1644, -0.3918, -0.813);\n" \ +"const vec3 Bcoeff = vec3(1.1644, 2.0172, 0.000);\n" \ + +#define BT709_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.7927);\n" \ +"const vec3 Gcoeff = vec3(1.1644, -0.2132, -0.5329);\n" \ +"const vec3 Bcoeff = vec3(1.1644, 2.1124, 0.000);\n" \ + +#define YUV_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U \n" \ +"uniform sampler2D tex2; // V \n" \ +"\n" \ + +#define YUV_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.y = texture2D(tex1, tcoord).r;\n" \ +" yuv.z = texture2D(tex2, tcoord).r;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + +#define NV12_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U/V \n" \ +"\n" \ + +#define NV12_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.yz = texture2D(tex1, tcoord).ra;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + +#define NV21_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U/V \n" \ +"\n" \ + +#define NV21_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.yz = texture2D(tex1, tcoord).ar;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + /* * NOTE: Always use sampler2D, etc here. We'll #define them to the * texture_rectangle versions if we choose to use that extension. @@ -74,13 +219,7 @@ static const char *shader_source[NUM_SHADERS][2] = /* SHADER_SOLID */ { /* vertex shader */ -"varying vec4 v_color;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -"}", + COLOR_VERTEX_SHADER, /* fragment shader */ "varying vec4 v_color;\n" "\n" @@ -93,15 +232,7 @@ static const char *shader_source[NUM_SHADERS][2] = /* SHADER_RGB */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ "varying vec4 v_color;\n" "varying vec2 v_texCoord;\n" @@ -113,156 +244,86 @@ static const char *shader_source[NUM_SHADERS][2] = "}" }, - /* SHADER_YUV */ + /* SHADER_YUV_JPEG */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U \n" -"uniform sampler2D tex2; // V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.y = texture2D(tex1, tcoord).r;\n" -" yuv.z = texture2D(tex2, tcoord).r;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" + YUV_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + YUV_SHADER_BODY }, - - /* SHADER_NV12 */ + /* SHADER_YUV_BT601 */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U/V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.yz = texture2D(tex1, tcoord).ra;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" + YUV_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + YUV_SHADER_BODY }, - - /* SHADER_NV21 */ + /* SHADER_YUV_BT709 */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U/V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.yz = texture2D(tex1, tcoord).ar;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" + YUV_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + YUV_SHADER_BODY + }, + /* SHADER_NV12_JPEG */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV12_BT601 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV12_BT709 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV21_JPEG */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + NV21_SHADER_BODY + }, + /* SHADER_NV21_BT601 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + NV21_SHADER_BODY + }, + /* SHADER_NV21_BT709 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + NV21_SHADER_BODY }, }; @@ -369,7 +430,7 @@ DestroyShaderProgram(GL_ShaderContext *ctx, GL_ShaderData *data) } GL_ShaderContext * -GL_CreateShaderContext() +GL_CreateShaderContext(void) { GL_ShaderContext *ctx; SDL_bool shaders_supported; diff --git a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h index 261627cc7..9805c599c 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h +++ b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,15 +26,21 @@ typedef enum { SHADER_NONE, SHADER_SOLID, SHADER_RGB, - SHADER_YUV, - SHADER_NV12, - SHADER_NV21, + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + SHADER_NV12_JPEG, + SHADER_NV12_BT601, + SHADER_NV12_BT709, + SHADER_NV21_JPEG, + SHADER_NV21_BT601, + SHADER_NV21_BT709, NUM_SHADERS } GL_Shader; typedef struct GL_ShaderContext GL_ShaderContext; -extern GL_ShaderContext * GL_CreateShaderContext(); +extern GL_ShaderContext * GL_CreateShaderContext(void); extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader); extern void GL_DestroyShaderContext(GL_ShaderContext *ctx); diff --git a/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h b/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h index a15d76d49..e00982b15 100644 --- a/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h +++ b/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,8 @@ SDL_PROC(void, glBindTexture, (GLenum, GLuint)) SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC_OES(void, glBlendEquationOES, (GLenum)) +SDL_PROC_OES(void, glBlendEquationSeparateOES, (GLenum, GLenum)) SDL_PROC_OES(void, glBlendFuncSeparateOES, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC(void, glClear, (GLbitfield)) SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) diff --git a/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c b/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c index 71f5b3a7a..d6bfca5d0 100644 --- a/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c +++ b/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,6 +56,7 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags); static void GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, @@ -116,7 +117,7 @@ typedef struct SDL_GLContext context; struct { Uint32 color; - int blendMode; + SDL_BlendMode blendMode; SDL_bool tex_coords; } current; @@ -130,6 +131,8 @@ typedef struct GLuint window_framebuffer; SDL_bool GL_OES_blend_func_separate_supported; + SDL_bool GL_OES_blend_equation_separate_supported; + SDL_bool GL_OES_blend_subtract_supported; } GLES_RenderData; typedef struct @@ -197,7 +200,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #define SDL_PROC_OES(ret,func,params) \ @@ -214,7 +217,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data) static SDL_GLContext SDL_CurrentContext = NULL; -GLES_FBOList * +static GLES_FBOList * GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h) { GLES_FBOList *result = data->framebuffers; @@ -261,8 +264,8 @@ GLES_ResetState(SDL_Renderer *renderer) GLES_ActivateRenderer(renderer); } - data->current.color = 0; - data->current.blendMode = -1; + data->current.color = 0xffffffff; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->current.tex_coords = SDL_FALSE; data->glDisable(GL_DEPTH_TEST); @@ -319,6 +322,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->WindowEvent = GLES_WindowEvent; renderer->GetOutputSize = GLES_GetOutputSize; + renderer->SupportsBlendMode = GLES_SupportsBlendMode; renderer->CreateTexture = GLES_CreateTexture; renderer->UpdateTexture = GLES_UpdateTexture; renderer->LockTexture = GLES_LockTexture; @@ -388,6 +392,12 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) if (SDL_GL_ExtensionSupported("GL_OES_blend_func_separate")) { data->GL_OES_blend_func_separate_supported = SDL_TRUE; } + if (SDL_GL_ExtensionSupported("GL_OES_blend_equation_separate")) { + data->GL_OES_blend_equation_separate_supported = SDL_TRUE; + } + if (SDL_GL_ExtensionSupported("GL_OES_blend_subtract")) { + data->GL_OES_blend_subtract_supported = SDL_TRUE; + } /* Set up parameters for rendering */ GLES_ResetState(renderer); @@ -430,6 +440,79 @@ GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD_OES; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT_OES; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT_OES; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->GL_OES_blend_func_separate_supported) { + return SDL_FALSE; + } + if (colorOperation != alphaOperation && !data->GL_OES_blend_equation_separate_supported) { + return SDL_FALSE; + } + if (colorOperation != SDL_BLENDOPERATION_ADD && !data->GL_OES_blend_subtract_supported) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static SDL_INLINE int power_of_2(int input) { @@ -633,8 +716,6 @@ GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) GLES_TextureData *texturedata = NULL; GLenum status; - GLES_ActivateRenderer(renderer); - if (!data->GL_OES_framebuffer_object_supported) { return SDL_SetError("Can't enable render target support in this renderer"); } @@ -694,6 +775,8 @@ GLES_UpdateViewport(SDL_Renderer * renderer) 0.0, 1.0); } } + data->glMatrixMode(GL_MODELVIEW); + return 0; } @@ -739,37 +822,28 @@ GLES_SetColor(GLES_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) } static void -GLES_SetBlendMode(GLES_RenderData * data, int blendMode) +GLES_SetBlendMode(GLES_RenderData * data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: + } else { data->glEnable(GL_BLEND); if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + data->glBlendFuncSeparateOES(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); } else { - data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + data->glBlendFunc(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode))); } - break; - case SDL_BLENDMODE_ADD: - data->glEnable(GL_BLEND); - if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - } else { - data->glBlendFunc(GL_SRC_ALPHA, GL_ONE); + if (data->GL_OES_blend_equation_separate_supported) { + data->glBlendEquationSeparateOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)), + GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode))); + } else if (data->GL_OES_blend_subtract_supported) { + data->glBlendEquationOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode))); } - break; - case SDL_BLENDMODE_MOD: - data->glEnable(GL_BLEND); - if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - } else { - data->glBlendFunc(GL_ZERO, GL_SRC_COLOR); - } - break; } data->current.blendMode = blendMode; } diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h b/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h index 0ecfa7f94..b6a143618 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h +++ b/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ SDL_PROC(void, glActiveTexture, (GLenum)) SDL_PROC(void, glAttachShader, (GLuint, GLuint)) SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *)) SDL_PROC(void, glBindTexture, (GLenum, GLuint)) +SDL_PROC(void, glBlendEquationSeparate, (GLenum, GLenum)) SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC(void, glClear, (GLbitfield)) SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) @@ -53,7 +54,11 @@ SDL_PROC(void, glPixelStorei, (GLenum, GLint)) SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei)) SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) +#if __NACL__ || __ANDROID__ +SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *)) +#else SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *)) +#endif SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *)) SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint)) SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c b/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c index c846a7b39..0cd388c37 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c +++ b/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,7 @@ #if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED +#include "SDL_assert.h" #include "SDL_hints.h" #include "SDL_opengles2.h" #include "../SDL_sysrender.h" @@ -122,7 +123,6 @@ typedef struct GLES2_ShaderCache typedef struct GLES2_ProgramCacheEntry { GLuint id; - SDL_BlendMode blend_mode; GLES2_ShaderCacheEntry *vertex_shader; GLES2_ShaderCacheEntry *fragment_shader; GLuint uniform_locations[16]; @@ -167,7 +167,8 @@ typedef enum GLES2_IMAGESOURCE_TEXTURE_BGR, GLES2_IMAGESOURCE_TEXTURE_YUV, GLES2_IMAGESOURCE_TEXTURE_NV12, - GLES2_IMAGESOURCE_TEXTURE_NV21 + GLES2_IMAGESOURCE_TEXTURE_NV21, + GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES } GLES2_ImageSource; typedef struct GLES2_DriverContext @@ -177,7 +178,7 @@ typedef struct GLES2_DriverContext SDL_bool debug_enabled; struct { - int blendMode; + SDL_BlendMode blendMode; SDL_bool tex_coords; } current; @@ -259,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, #if 0 #define GL_CheckError(prefix, renderer) -#elif defined(_MSC_VER) -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__) #else -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__) +#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION) #endif @@ -297,7 +296,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -307,7 +306,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data) return 0; } -GLES2_FBOList * +static GLES2_FBOList * GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h) { GLES2_FBOList *result = data->framebuffers; @@ -372,6 +371,69 @@ GLES2_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GLES2_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static int GLES2_UpdateViewport(SDL_Renderer * renderer) { @@ -531,17 +593,32 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) format = GL_LUMINANCE; type = GL_UNSIGNED_BYTE; break; +#ifdef GL_TEXTURE_EXTERNAL_OES + case SDL_PIXELFORMAT_EXTERNAL_OES: + format = GL_NONE; + type = GL_NONE; + break; +#endif default: return SDL_SetError("Texture format not supported"); } + if (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES && + texture->access != SDL_TEXTUREACCESS_STATIC) { + return SDL_SetError("Unsupported texture access for SDL_PIXELFORMAT_EXTERNAL_OES"); + } + /* Allocate a texture struct */ data = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData)); if (!data) { return SDL_OutOfMemory(); } data->texture = 0; +#ifdef GL_TEXTURE_EXTERNAL_OES + data->texture_type = (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES) ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; +#else data->texture_type = GL_TEXTURE_2D; +#endif data->pixel_format = format; data->pixel_type = type; data->yuv = ((texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12)); @@ -557,11 +634,11 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) size = texture->h * data->pitch; if (data->yuv) { /* Need to add size for the U and V planes */ - size += (2 * (texture->h * data->pitch) / 4); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } if (data->nv12) { /* Need to add size for the U/V plane */ - size += ((texture->h * data->pitch) / 2); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } data->pixel_data = SDL_calloc(1, size); if (!data->pixel_data) { @@ -584,7 +661,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w / 2, texture->h / 2, 0, format, type, NULL); + renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); renderdata->glGenTextures(1, &data->texture_u); if (GL_CheckError("glGenTexures()", renderer) < 0) { @@ -596,7 +673,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w / 2, texture->h / 2, 0, format, type, NULL); + renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); if (GL_CheckError("glTexImage2D()", renderer) < 0) { return -1; } @@ -613,7 +690,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, texture->w / 2, texture->h / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); + renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); if (GL_CheckError("glTexImage2D()", renderer) < 0) { return -1; } @@ -630,9 +707,11 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); - if (GL_CheckError("glTexImage2D()", renderer) < 0) { - return -1; + if (texture->format != SDL_PIXELFORMAT_EXTERNAL_OES) { + renderdata->glTexImage2D(data->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); + if (GL_CheckError("glTexImage2D()", renderer) < 0) { + return -1; + } } if (texture->access == SDL_TEXTUREACCESS_TARGET) { @@ -713,14 +792,15 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, - pixels, pitch / 2, 1); + pixels, (pitch + 1) / 2, 1); + /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2)); if (texture->format == SDL_PIXELFORMAT_YV12) { data->glBindTexture(tdata->texture_type, tdata->texture_u); } else { @@ -729,11 +809,11 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, - pixels, pitch / 2, 1); + pixels, (pitch + 1) / 2, 1); } if (tdata->nv12) { @@ -743,11 +823,11 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, - pixels, pitch, 2); + pixels, 2 * ((pitch + 1) / 2), 2); } return GL_CheckError("glTexSubImage2D()", renderer); @@ -774,8 +854,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, Vplane, Vpitch, 1); @@ -784,8 +864,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, Uplane, Upitch, 1); @@ -882,19 +962,16 @@ GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) * Shader management functions * *************************************************************************************************/ -static GLES2_ShaderCacheEntry *GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, - SDL_BlendMode blendMode); +static GLES2_ShaderCacheEntry *GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type); static void GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry); static GLES2_ProgramCacheEntry *GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, - GLES2_ShaderCacheEntry *fragment, - SDL_BlendMode blendMode); -static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, - SDL_BlendMode blendMode); + GLES2_ShaderCacheEntry *fragment); +static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h); static GLES2_ProgramCacheEntry * GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, - GLES2_ShaderCacheEntry *fragment, SDL_BlendMode blendMode) + GLES2_ShaderCacheEntry *fragment) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_ProgramCacheEntry *entry; @@ -933,7 +1010,6 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, } entry->vertex_shader = vertex; entry->fragment_shader = fragment; - entry->blend_mode = blendMode; /* Create the program and link it */ entry->id = data->glCreateProgram(); @@ -1011,7 +1087,7 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, } static GLES2_ShaderCacheEntry * -GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode blendMode) +GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; const GLES2_Shader *shader; @@ -1021,7 +1097,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b int i, j; /* Find the corresponding shader */ - shader = GLES2_GetShader(type, blendMode); + shader = GLES2_GetShader(type); if (!shader) { SDL_SetError("No shader matching the requested characteristics was found"); return NULL; @@ -1068,7 +1144,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b /* Compile or load the selected shader instance */ entry->id = data->glCreateShader(instance->type); if (instance->format == (GLenum)-1) { - data->glShaderSource(entry->id, 1, (const char **)&instance->data, NULL); + data->glShaderSource(entry->id, 1, (const char **)(char *)&instance->data, NULL); data->glCompileShader(entry->id); data->glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful); } else { @@ -1130,7 +1206,7 @@ GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry) } static int -GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendMode blendMode) +GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_ShaderCacheEntry *vertex = NULL; @@ -1157,24 +1233,66 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC; break; case GLES2_IMAGESOURCE_TEXTURE_YUV: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } break; case GLES2_IMAGESOURCE_TEXTURE_NV12: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } break; case GLES2_IMAGESOURCE_TEXTURE_NV21: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } + break; + case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC; break; default: goto fault; } /* Load the requested shaders */ - vertex = GLES2_CacheShader(renderer, vtype, blendMode); + vertex = GLES2_CacheShader(renderer, vtype); if (!vertex) { goto fault; } - fragment = GLES2_CacheShader(renderer, ftype, blendMode); + fragment = GLES2_CacheShader(renderer, ftype); if (!fragment) { goto fault; } @@ -1187,7 +1305,7 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM } /* Generate a matching program */ - program = GLES2_CacheProgram(renderer, vertex, fragment, blendMode); + program = GLES2_CacheProgram(renderer, vertex, fragment); if (!program) { goto fault; } @@ -1341,26 +1459,19 @@ GLES2_RenderClear(SDL_Renderer * renderer) } static void -GLES2_SetBlendMode(GLES2_DriverContext *data, int blendMode) +GLES2_SetBlendMode(GLES2_DriverContext *data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - default: - case SDL_BLENDMODE_NONE: + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: + } else { data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - break; - case SDL_BLENDMODE_ADD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - break; - case SDL_BLENDMODE_MOD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - break; + data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); + data->glBlendEquationSeparate(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)), + GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode))); } data->current.blendMode = blendMode; } @@ -1383,18 +1494,17 @@ static int GLES2_SetDrawingState(SDL_Renderer * renderer) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; - const int blendMode = renderer->blendMode; GLES2_ProgramCacheEntry *program; Uint8 r, g, b, a; GLES2_ActivateRenderer(renderer); - GLES2_SetBlendMode(data, blendMode); + GLES2_SetBlendMode(data, renderer->blendMode); GLES2_SetTexCoords(data, SDL_FALSE); /* Activate an appropriate shader and set the projection matrix */ - if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, blendMode) < 0) { + if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, 0, 0) < 0) { return -1; } @@ -1555,12 +1665,10 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata; GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; - SDL_BlendMode blendMode; GLES2_ProgramCacheEntry *program; Uint8 r, g, b, a; /* Activate an appropriate shader and set the projection matrix */ - blendMode = texture->blendMode; if (renderer->target) { /* Check if we need to do color mapping between the source and render target textures */ if (renderer->target->format != texture->format) { @@ -1623,6 +1731,9 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; + case SDL_PIXELFORMAT_EXTERNAL_OES: + sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; + break; default: return SDL_SetError("Unsupported texture format"); } @@ -1653,12 +1764,15 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; + case SDL_PIXELFORMAT_EXTERNAL_OES: + sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; + break; default: return SDL_SetError("Unsupported texture format"); } } - if (GLES2_SelectProgram(renderer, sourceType, blendMode) < 0) { + if (GLES2_SelectProgram(renderer, sourceType, texture->w, texture->h) < 0) { return -1; } @@ -1705,7 +1819,7 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) } /* Configure texture blending */ - GLES2_SetBlendMode(data, blendMode); + GLES2_SetBlendMode(data, texture->blendMode); GLES2_SetTexCoords(data, SDL_TRUE); return 0; @@ -1923,7 +2037,9 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) * Renderer instantiation * *************************************************************************************************/ +#ifdef ZUNE_HD #define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B +#endif static void GLES2_ResetState(SDL_Renderer *renderer) @@ -1936,7 +2052,7 @@ GLES2_ResetState(SDL_Renderer *renderer) GLES2_ActivateRenderer(renderer); } - data->current.blendMode = -1; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->current.tex_coords = SDL_FALSE; data->glActiveTexture(GL_TEXTURE0); @@ -1963,7 +2079,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) #ifndef ZUNE_HD GLboolean hasCompiler; #endif - Uint32 window_flags; + Uint32 window_flags = 0; /* -Wconditional-uninitialized */ GLint window_framebuffer; GLint value; int profile_mask = 0, major = 0, minor = 0; @@ -1980,8 +2096,9 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) } window_flags = SDL_GetWindowFlags(window); + /* OpenGL ES 3.0 is a superset of OpenGL ES 2.0 */ if (!(window_flags & SDL_WINDOW_OPENGL) || - profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) { + profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major < RENDERER_CONTEXT_MAJOR) { changed_window = SDL_TRUE; SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); @@ -2089,33 +2206,37 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) data->window_framebuffer = (GLuint)window_framebuffer; /* Populate the function pointers for the module */ - renderer->WindowEvent = &GLES2_WindowEvent; - renderer->GetOutputSize = &GLES2_GetOutputSize; - renderer->CreateTexture = &GLES2_CreateTexture; - renderer->UpdateTexture = &GLES2_UpdateTexture; - renderer->UpdateTextureYUV = &GLES2_UpdateTextureYUV; - renderer->LockTexture = &GLES2_LockTexture; - renderer->UnlockTexture = &GLES2_UnlockTexture; - renderer->SetRenderTarget = &GLES2_SetRenderTarget; - renderer->UpdateViewport = &GLES2_UpdateViewport; - renderer->UpdateClipRect = &GLES2_UpdateClipRect; - renderer->RenderClear = &GLES2_RenderClear; - renderer->RenderDrawPoints = &GLES2_RenderDrawPoints; - renderer->RenderDrawLines = &GLES2_RenderDrawLines; - renderer->RenderFillRects = &GLES2_RenderFillRects; - renderer->RenderCopy = &GLES2_RenderCopy; - renderer->RenderCopyEx = &GLES2_RenderCopyEx; - renderer->RenderReadPixels = &GLES2_RenderReadPixels; - renderer->RenderPresent = &GLES2_RenderPresent; - renderer->DestroyTexture = &GLES2_DestroyTexture; - renderer->DestroyRenderer = &GLES2_DestroyRenderer; - renderer->GL_BindTexture = &GLES2_BindTexture; - renderer->GL_UnbindTexture = &GLES2_UnbindTexture; + renderer->WindowEvent = GLES2_WindowEvent; + renderer->GetOutputSize = GLES2_GetOutputSize; + renderer->SupportsBlendMode = GLES2_SupportsBlendMode; + renderer->CreateTexture = GLES2_CreateTexture; + renderer->UpdateTexture = GLES2_UpdateTexture; + renderer->UpdateTextureYUV = GLES2_UpdateTextureYUV; + renderer->LockTexture = GLES2_LockTexture; + renderer->UnlockTexture = GLES2_UnlockTexture; + renderer->SetRenderTarget = GLES2_SetRenderTarget; + renderer->UpdateViewport = GLES2_UpdateViewport; + renderer->UpdateClipRect = GLES2_UpdateClipRect; + renderer->RenderClear = GLES2_RenderClear; + renderer->RenderDrawPoints = GLES2_RenderDrawPoints; + renderer->RenderDrawLines = GLES2_RenderDrawLines; + renderer->RenderFillRects = GLES2_RenderFillRects; + renderer->RenderCopy = GLES2_RenderCopy; + renderer->RenderCopyEx = GLES2_RenderCopyEx; + renderer->RenderReadPixels = GLES2_RenderReadPixels; + renderer->RenderPresent = GLES2_RenderPresent; + renderer->DestroyTexture = GLES2_DestroyTexture; + renderer->DestroyRenderer = GLES2_DestroyRenderer; + renderer->GL_BindTexture = GLES2_BindTexture; + renderer->GL_UnbindTexture = GLES2_UnbindTexture; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; +#ifdef GL_TEXTURE_EXTERNAL_OES + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; +#endif GLES2_ResetState(renderer); diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c index 0c01a8c64..b0bcdff25 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c +++ b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -126,70 +126,166 @@ static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \ } \ "; +#define JPEG_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1, 1, 1,\n" \ +" 0, -0.3441, 1.772,\n" \ +" 1.402, -0.7141, 0);\n" \ + +#define BT601_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \ +" 0, -0.3918, 2.0172,\n" \ +" 1.596, -0.813, 0);\n" \ + +#define BT709_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \ +" 0, -0.2132, 2.1124,\n" \ +" 1.7927, -0.5329, 0);\n" \ + + +#define YUV_SHADER_PROLOGUE \ +"precision mediump float;\n" \ +"uniform sampler2D u_texture;\n" \ +"uniform sampler2D u_texture_u;\n" \ +"uniform sampler2D u_texture_v;\n" \ +"uniform vec4 u_modulation;\n" \ +"varying vec2 v_texCoord;\n" \ +"\n" \ + +#define YUV_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.y = texture2D(u_texture_u, v_texCoord).r;\n" \ +" yuv.z = texture2D(u_texture_v, v_texCoord).r;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + +#define NV12_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.yz = texture2D(u_texture_u, v_texCoord).ra;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + +#define NV21_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.yz = texture2D(u_texture_u, v_texCoord).ar;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + /* YUV to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureYUVSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ - uniform sampler2D u_texture_v; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.y = texture2D(u_texture_u, v_texCoord).r - 0.5; \ - yuv.z = texture2D(u_texture_v, v_texCoord).r - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ - gl_FragColor *= u_modulation; \ - } \ -"; +static const Uint8 GLES2_FragmentSrc_TextureYUVJPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureYUVBT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureYUVBT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; /* NV12 to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureNV12Src_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.yz = texture2D(u_texture_u, v_texCoord).ra - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ - gl_FragColor *= u_modulation; \ - } \ -"; +static const Uint8 GLES2_FragmentSrc_TextureNV12JPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV12BT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV12BT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; /* NV21 to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureNV21Src_[] = " \ +static const Uint8 GLES2_FragmentSrc_TextureNV21JPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV21BT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV21BT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; + +/* Custom Android video format texture */ +static const Uint8 GLES2_FragmentSrc_TextureExternalOESSrc_[] = " \ + #extension GL_OES_EGL_image_external : require\n\ precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ + uniform samplerExternalOES u_texture; \ uniform vec4 u_modulation; \ varying vec2 v_texCoord; \ \ void main() \ { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.yz = texture2D(u_texture_u, v_texCoord).ar - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ + gl_FragColor = texture2D(u_texture, v_texCoord); \ gl_FragColor *= u_modulation; \ } \ "; @@ -236,570 +332,190 @@ static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = { GLES2_FragmentSrc_TextureBGRSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVJPEGSrc = { GL_FRAGMENT_SHADER, GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureYUVSrc_), - GLES2_FragmentSrc_TextureYUVSrc_ + sizeof(GLES2_FragmentSrc_TextureYUVJPEGSrc_), + GLES2_FragmentSrc_TextureYUVJPEGSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12Src = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT601Src = { GL_FRAGMENT_SHADER, GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureNV12Src_), - GLES2_FragmentSrc_TextureNV12Src_ + sizeof(GLES2_FragmentSrc_TextureYUVBT601Src_), + GLES2_FragmentSrc_TextureYUVBT601Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21Src = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT709Src = { GL_FRAGMENT_SHADER, GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureNV21Src_), - GLES2_FragmentSrc_TextureNV21Src_ + sizeof(GLES2_FragmentSrc_TextureYUVBT709Src_), + GLES2_FragmentSrc_TextureYUVBT709Src_ }; - -/************************************************************************************************* - * Vertex/fragment shader binaries (NVIDIA Tegra 1/2) * - *************************************************************************************************/ - -#if GLES2_INCLUDE_NVIDIA_SHADERS - -#define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B - -static const Uint8 GLES2_VertexTegra_Default_[] = { - 243, 193, 1, 142, 31, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 46, 0, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 85, 0, 0, 0, 2, 0, 0, 0, 24, 0, 0, 0, 3, 0, 0, 0, - 91, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 5, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 95, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, - 13, 0, 0, 0, 102, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 16, 0, 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 32, 0, 0, 0, 17, 0, 0, 0, 112, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 112, 0, 0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 19, 0, 0, 0, 132, 0, - 0, 0, 104, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, - 95, 112, 111, 115, 105, 116, 105, 111, 110, 0, 97, 95, 116, 101, 120, 67, 111, 111, 114, 100, - 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 0, 0, 0, 0, 0, 0, 82, 139, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 80, 139, 0, - 0, 1, 0, 0, 0, 22, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 33, 0, 0, 0, 92, 139, 0, 0, - 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 240, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 64, 0, 0, 0, 80, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 193, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 66, 24, 0, 6, 34, 108, 28, - 0, 0, 42, 16, 128, 0, 195, 192, 6, 129, 252, 255, 65, 96, 108, 28, 0, 0, 0, 0, 0, 1, 195, 192, - 6, 1, 252, 255, 33, 96, 108, 156, 31, 64, 8, 1, 64, 0, 131, 192, 6, 1, 156, 159, 65, 96, 108, - 28, 0, 0, 85, 32, 0, 1, 195, 192, 6, 1, 252, 255, 33, 96, 108, 156, 31, 64, 0, 64, 64, 0, 131, - 192, 134, 1, 152, 31, 65, 96, 108, 156, 31, 64, 127, 48, 0, 1, 195, 192, 6, 129, 129, 255, 33, - 96 -}; - -static const Uint8 GLES2_FragmentTegra_None_SolidSrc_[] = { - 155, 191, 159, 1, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 108, 0, 0, 0, 108, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 241, 0, 0, 0, 240, 0, 0, - 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, - 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 0, 0, 0, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, 0, 0, - 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 0, 40, 0, 0, 0, 242, 65, 63, - 192, 200, 0, 0, 0, 242, 65, 63, 128, 168, 0, 0, 0, 242, 65, 63, 64, 72, 0, 0, 0, 242, 65, 63, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Alpha_SolidSrc_[] = { - 169, 153, 195, 28, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 220, 0, 0, 0, 220, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 118, 118, 17, 241, 0, 0, 0, 240, 0, - 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 21, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, - 1, 0, 0, 0, 3, 0, 0, 0, 3, 0, 65, 37, 8, 0, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 21, 0, - 0, 0, 0, 3, 0, 1, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 39, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, 9, 0, 0, 0, 24, 0, 4, 40, 232, 231, 15, - 0, 0, 242, 65, 62, 194, 72, 1, 0, 0, 250, 65, 63, 194, 40, 1, 0, 0, 250, 65, 63, 192, 168, 1, - 0, 0, 242, 1, 64, 192, 168, 1, 0, 0, 242, 1, 68, 168, 32, 0, 0, 0, 50, 64, 0, 192, 168, 15, - 0, 0, 242, 1, 66, 168, 64, 0, 16, 0, 242, 65, 1, 232, 231, 15, 0, 0, 242, 65, 62, 168, 160, - 0, 0, 0, 50, 64, 2, 104, 192, 0, 0, 36, 48, 66, 4, 232, 231, 15, 0, 0, 242, 65, 62, 3, 0, 6, - 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 41, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Additive_SolidSrc_[] = { - 59, 71, 42, 17, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, 0, - 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 108, 0, 0, 0, 108, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 22, 22, 17, 241, 0, 0, 0, 240, 0, - 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, - 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, - 0, 0, 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 192, 200, 0, 0, 0, 26, - 0, 70, 192, 40, 0, 0, 0, 2, 0, 64, 192, 72, 0, 0, 0, 10, 0, 66, 192, 168, 0, 0, 0, 18, 0, 68, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Modulated_SolidSrc_[] = { - 37, 191, 49, 17, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, 0, - 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0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 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, - 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, - 0, 0, 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 104, 192, 0, 0, 0, 242, - 1, 70, 8, 32, 0, 0, 0, 242, 1, 64, 40, 64, 0, 0, 0, 242, 1, 66, 72, 160, 0, 0, 0, 242, 1, 68, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_None_TextureSrc_[] = { - 220, 217, 41, 211, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 0, 0, 0, 0, 1, 0, - 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 1, 0, 0, 0, 2, 0, 4, 38, 186, 81, 78, 16, 2, 1, 0, 0, 1, 0, - 1, 39, 0, 4, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 104, 192, 0, 0, 0, 242, 1, 70, 8, 32, - 0, 0, 0, 242, 1, 64, 40, 64, 0, 0, 0, 242, 1, 66, 72, 160, 0, 0, 0, 242, 1, 68, 1, 0, 6, 40, - 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Alpha_TextureSrc_[] = { - 71, 202, 114, 229, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 118, 118, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, - 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, - 1, 0, 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, - 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, - 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, - 81, 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, - 0, 0, 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 8, 192, 1, 0, 0, 242, 1, 64, 104, 32, 1, 0, - 0, 242, 1, 70, 72, 64, 1, 0, 0, 242, 1, 68, 154, 192, 0, 0, 37, 34, 64, 3, 8, 32, 0, 0, 5, 58, - 208, 4, 40, 64, 0, 0, 5, 50, 208, 4, 72, 160, 0, 0, 37, 42, 208, 4, 2, 0, 6, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Additive_TextureSrc_[] = { - 161, 234, 193, 234, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 22, 22, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, 8, 0, - 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, 81, - 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, - 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 104, 32, 1, 0, 0, 242, 1, 70, 8, 192, 1, 0, 0, 242, - 1, 64, 72, 64, 1, 0, 0, 242, 1, 68, 136, 192, 0, 0, 0, 26, 64, 4, 136, 32, 0, 0, 0, 2, 64, 7, - 136, 64, 0, 0, 0, 10, 64, 6, 136, 160, 0, 0, 0, 18, 64, 5, 2, 0, 6, 40, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Modulated_TextureSrc_[] = { - 75, 132, 201, 227, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 32, 32, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, 8, 0, - 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, 81, - 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, - 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 8, 192, 1, 0, 0, 242, 1, 64, 104, 32, 1, 0, 0, 242, - 1, 70, 72, 64, 1, 0, 0, 242, 1, 68, 104, 192, 0, 0, 0, 242, 65, 4, 232, 32, 0, 0, 0, 242, 65, - 0, 40, 64, 0, 0, 0, 242, 65, 6, 72, 160, 0, 0, 0, 242, 65, 5, 2, 0, 6, 40, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const GLES2_ShaderInstance GLES2_VertexTegra_Default = { - GL_VERTEX_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_VertexTegra_Default_), - GLES2_VertexTegra_Default_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_None_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12JPEGSrc = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_None_SolidSrc_), - GLES2_FragmentTegra_None_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12JPEGSrc_), + GLES2_FragmentSrc_TextureNV12JPEGSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Alpha_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT601Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Alpha_SolidSrc_), - GLES2_FragmentTegra_Alpha_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12BT601Src_), + GLES2_FragmentSrc_TextureNV12BT601Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Additive_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT709Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Additive_SolidSrc_), - GLES2_FragmentTegra_Additive_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21BT709Src_), + GLES2_FragmentSrc_TextureNV21BT709Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Modulated_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21JPEGSrc = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Modulated_SolidSrc_), - GLES2_FragmentTegra_Modulated_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21JPEGSrc_), + GLES2_FragmentSrc_TextureNV21JPEGSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_None_TextureSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT601Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_None_TextureSrc_), - GLES2_FragmentTegra_None_TextureSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21BT601Src_), + GLES2_FragmentSrc_TextureNV21BT601Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Alpha_TextureSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT709Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Alpha_TextureSrc_), - GLES2_FragmentTegra_Alpha_TextureSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12BT709Src_), + GLES2_FragmentSrc_TextureNV12BT709Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Additive_TextureSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureExternalOESSrc = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Additive_TextureSrc_), - GLES2_FragmentTegra_Additive_TextureSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureExternalOESSrc_), + GLES2_FragmentSrc_TextureExternalOESSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Modulated_TextureSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Modulated_TextureSrc_), - GLES2_FragmentTegra_Modulated_TextureSrc_ -}; - -#endif /* GLES2_INCLUDE_NVIDIA_SHADERS */ /************************************************************************************************* * Vertex/fragment shader definitions * *************************************************************************************************/ static GLES2_Shader GLES2_VertexShader_Default = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else 1, -#endif { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_VertexTegra_Default, -#endif &GLES2_VertexSrc_Default } }; -static GLES2_Shader GLES2_FragmentShader_None_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else +static GLES2_Shader GLES2_FragmentShader_SolidSrc = { 1, -#endif { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_None_SolidSrc, -#endif &GLES2_FragmentSrc_SolidSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else +static GLES2_Shader GLES2_FragmentShader_TextureABGRSrc = { 1, -#endif { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Alpha_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Additive_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Modulated_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_None_TextureSrc, -#endif &GLES2_FragmentSrc_TextureABGRSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Alpha_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Additive_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Modulated_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureARGBSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureARGBSrc = { 1, { &GLES2_FragmentSrc_TextureARGBSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureRGBSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureRGBSrc = { 1, { &GLES2_FragmentSrc_TextureRGBSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureBGRSrc = { 1, { &GLES2_FragmentSrc_TextureBGRSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureYUVJPEGSrc = { 1, { - &GLES2_FragmentSrc_TextureBGRSrc + &GLES2_FragmentSrc_TextureYUVJPEGSrc } }; -static GLES2_Shader GLES2_FragmentShader_Additive_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureYUVBT601Src = { 1, { - &GLES2_FragmentSrc_TextureBGRSrc + &GLES2_FragmentSrc_TextureYUVBT601Src } }; -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureYUVBT709Src = { 1, { - &GLES2_FragmentSrc_TextureBGRSrc + &GLES2_FragmentSrc_TextureYUVBT709Src } }; -static GLES2_Shader GLES2_FragmentShader_TextureYUVSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureNV12JPEGSrc = { 1, { - &GLES2_FragmentSrc_TextureYUVSrc + &GLES2_FragmentSrc_TextureNV12JPEGSrc } }; -static GLES2_Shader GLES2_FragmentShader_TextureNV12Src = { +static GLES2_Shader GLES2_FragmentShader_TextureNV12BT601Src = { 1, { - &GLES2_FragmentSrc_TextureNV12Src + &GLES2_FragmentSrc_TextureNV12BT601Src } }; -static GLES2_Shader GLES2_FragmentShader_TextureNV21Src = { +static GLES2_Shader GLES2_FragmentShader_TextureNV12BT709Src = { 1, { - &GLES2_FragmentSrc_TextureNV21Src + &GLES2_FragmentSrc_TextureNV12BT709Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21JPEGSrc = { + 1, + { + &GLES2_FragmentSrc_TextureNV21JPEGSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21BT601Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV21BT601Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21BT709Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV21BT709Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureExternalOESSrc = { + 1, + { + &GLES2_FragmentSrc_TextureExternalOESSrc } }; @@ -808,94 +524,41 @@ static GLES2_Shader GLES2_FragmentShader_TextureNV21Src = { * Shader selector * *************************************************************************************************/ -const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMode) +const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type) { switch (type) { case GLES2_SHADER_VERTEX_DEFAULT: return &GLES2_VertexShader_Default; case GLES2_SHADER_FRAGMENT_SOLID_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_SolidSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_SolidSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_SolidSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_SolidSrc; - default: - return NULL; - } + return &GLES2_FragmentShader_SolidSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureABGRSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureABGRSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureABGRSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureABGRSrc; - default: - return NULL; - } + return &GLES2_FragmentShader_TextureABGRSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureARGBSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureARGBSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureARGBSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureARGBSrc; - default: - return NULL; - } - + return &GLES2_FragmentShader_TextureARGBSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureRGBSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureRGBSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureRGBSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureRGBSrc; - default: - return NULL; - } - + return &GLES2_FragmentShader_TextureRGBSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureBGRSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureBGRSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureBGRSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureBGRSrc; - default: - return NULL; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC: - { - return &GLES2_FragmentShader_TextureYUVSrc; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC: - { - return &GLES2_FragmentShader_TextureNV12Src; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC: - { - return &GLES2_FragmentShader_TextureNV21Src; - } - + return &GLES2_FragmentShader_TextureBGRSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC: + return &GLES2_FragmentShader_TextureYUVJPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC: + return &GLES2_FragmentShader_TextureYUVBT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC: + return &GLES2_FragmentShader_TextureYUVBT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC: + return &GLES2_FragmentShader_TextureNV12JPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC: + return &GLES2_FragmentShader_TextureNV12BT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC: + return &GLES2_FragmentShader_TextureNV12BT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC: + return &GLES2_FragmentShader_TextureNV21JPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC: + return &GLES2_FragmentShader_TextureNV21BT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC: + return &GLES2_FragmentShader_TextureNV21BT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC: + return &GLES2_FragmentShader_TextureExternalOESSrc; default: return NULL; } diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h index 3958ae00d..c16ce127e 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h +++ b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,10 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES2 +#ifndef SDL_shaders_gles2_h_ +#define SDL_shaders_gles2_h_ -#ifndef SDL_shaderdata_h_ -#define SDL_shaderdata_h_ +#if SDL_VIDEO_RENDER_OGL_ES2 typedef struct GLES2_ShaderInstance { @@ -47,17 +47,24 @@ typedef enum GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC, GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC, GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC } GLES2_ShaderType; #define GLES2_SOURCE_SHADER (GLenum)-1 -const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMode); - -#endif /* SDL_shaderdata_h_ */ +const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type); #endif /* SDL_VIDEO_RENDER_OGL_ES2 */ +#endif /* SDL_shaders_gles2_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/psp/SDL_render_psp.c b/Engine/lib/sdl/src/render/psp/SDL_render_psp.c index f2851319e..38f893e8f 100644 --- a/Engine/lib/sdl/src/render/psp/SDL_render_psp.c +++ b/Engine/lib/sdl/src/render/psp/SDL_render_psp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -949,11 +949,11 @@ PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, vertices[3].y = y + sw - ch; vertices[3].z = 0; - if (flip & SDL_FLIP_HORIZONTAL) { + if (flip & SDL_FLIP_VERTICAL) { Swap(&vertices[0].v, &vertices[2].v); Swap(&vertices[1].v, &vertices[3].v); } - if (flip & SDL_FLIP_VERTICAL) { + if (flip & SDL_FLIP_HORIZONTAL) { Swap(&vertices[0].u, &vertices[2].u); Swap(&vertices[1].u, &vertices[3].u); } diff --git a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c index 7cfb274ae..8a3f7500e 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c +++ b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -245,7 +245,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, } else { return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a); } - break; + /* break; -Wunreachable-code-break */ } break; default: diff --git a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h index 88bb2e2c4..262210f77 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h +++ b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_blendline.c b/Engine/lib/sdl/src/render/software/SDL_blendline.c index ef0d58531..0ed0ccd20 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendline.c +++ b/Engine/lib/sdl/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -685,7 +685,7 @@ SDL_CalculateBlendLineFunc(const SDL_PixelFormat * fmt) } else { return SDL_BlendLine_RGB2; } - break; + /* break; -Wunreachable-code-break */ case 4: if (fmt->Rmask == 0x00FF0000) { if (fmt->Amask) { diff --git a/Engine/lib/sdl/src/render/software/SDL_blendline.h b/Engine/lib/sdl/src/render/software/SDL_blendline.h index c0b545f34..82072cb00 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendline.h +++ b/Engine/lib/sdl/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_blendpoint.c b/Engine/lib/sdl/src/render/software/SDL_blendpoint.c index fc42dfe76..37fb49862 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendpoint.c +++ b/Engine/lib/sdl/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -235,13 +235,11 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r switch (dst->format->Rmask) { case 0x00FF0000: if (!dst->format->Amask) { - return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, - a); + return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, a); } else { - return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, - a); + return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a); } - break; + /* break; -Wunreachable-code-break */ } break; default: diff --git a/Engine/lib/sdl/src/render/software/SDL_blendpoint.h b/Engine/lib/sdl/src/render/software/SDL_blendpoint.h index 58ddec7ee..dd9e49c1c 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendpoint.h +++ b/Engine/lib/sdl/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_draw.h b/Engine/lib/sdl/src/render/software/SDL_draw.h index 3a5e7cf11..945f2bcd0 100644 --- a/Engine/lib/sdl/src/render/software/SDL_draw.h +++ b/Engine/lib/sdl/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -562,10 +562,10 @@ do { \ while (height--) { \ { int n = (width+3)/4; \ switch (width & 3) { \ - case 0: do { op; pixel++; \ - case 3: op; pixel++; \ - case 2: op; pixel++; \ - case 1: op; pixel++; \ + case 0: do { op; pixel++; /* fallthrough */ \ + case 3: op; pixel++; /* fallthrough */ \ + case 2: op; pixel++; /* fallthrough */ \ + case 1: op; pixel++; /* fallthrough */ \ } while ( --n > 0 ); \ } \ } \ diff --git a/Engine/lib/sdl/src/render/software/SDL_drawline.c b/Engine/lib/sdl/src/render/software/SDL_drawline.c index fd50ea748..eeb54ed3a 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawline.c +++ b/Engine/lib/sdl/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_drawline.h b/Engine/lib/sdl/src/render/software/SDL_drawline.h index 40721c3fc..9395d5050 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawline.h +++ b/Engine/lib/sdl/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_drawpoint.c b/Engine/lib/sdl/src/render/software/SDL_drawpoint.c index 98f0d83c0..64a4e52a9 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawpoint.c +++ b/Engine/lib/sdl/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_drawpoint.h b/Engine/lib/sdl/src/render/software/SDL_drawpoint.h index e77857ac9..c36670007 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawpoint.h +++ b/Engine/lib/sdl/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_render_sw.c b/Engine/lib/sdl/src/render/software/SDL_render_sw.c index e7a6cd88d..89e54b859 100644 --- a/Engine/lib/sdl/src/render/software/SDL_render_sw.c +++ b/Engine/lib/sdl/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -239,7 +239,10 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a); SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode); - if (texture->access == SDL_TEXTUREACCESS_STATIC) { + /* Only RLE encode textures without an alpha channel since the RLE coder + * discards the color values of pixels with an alpha value of zero. + */ + if (texture->access == SDL_TEXTUREACCESS_STATIC && !Amask) { SDL_SetSurfaceRLE(texture->driverdata, 1); } @@ -368,9 +371,14 @@ SW_UpdateClipRect(SDL_Renderer * renderer) SDL_Surface *surface = data->surface; if (surface) { if (renderer->clipping_enabled) { - SDL_SetClipRect(surface, &renderer->clip_rect); + SDL_Rect clip_rect; + clip_rect = renderer->clip_rect; + clip_rect.x += renderer->viewport.x; + clip_rect.y += renderer->viewport.y; + SDL_IntersectRect(&renderer->viewport, &clip_rect, &clip_rect); + SDL_SetClipRect(surface, &clip_rect); } else { - SDL_SetClipRect(surface, NULL); + SDL_SetClipRect(surface, &renderer->viewport); } } return 0; @@ -599,9 +607,15 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, SDL_Surface *surface = SW_ActivateRenderer(renderer); SDL_Surface *src = (SDL_Surface *) texture->driverdata; SDL_Rect final_rect, tmp_rect; - SDL_Surface *surface_rotated, *surface_scaled; - int retval, dstwidth, dstheight, abscenterx, abscentery; + SDL_Surface *src_clone, *src_rotated, *src_scaled; + SDL_Surface *mask = NULL, *mask_rotated = NULL; + int retval = 0, dstwidth, dstheight, abscenterx, abscentery; double cangle, sangle, px, py, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y; + SDL_BlendMode blendmode; + Uint8 alphaMod, rMod, gMod, bMod; + int applyModulation = SDL_FALSE; + int blitRequired = SDL_FALSE; + int isOpaque = SDL_FALSE; if (!surface) { return -1; @@ -617,69 +631,104 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, final_rect.w = (int)dstrect->w; final_rect.h = (int)dstrect->h; - /* SDLgfx_rotateSurface doesn't accept a source rectangle, so crop and scale if we need to */ tmp_rect = final_rect; tmp_rect.x = 0; tmp_rect.y = 0; - if (srcrect->w == final_rect.w && srcrect->h == final_rect.h && srcrect->x == 0 && srcrect->y == 0) { - surface_scaled = src; /* but if we don't need to, just use the original */ - retval = 0; - } else { - SDL_Surface *blit_src = src; - Uint32 colorkey; - SDL_BlendMode blendMode; - Uint8 alphaMod, r, g, b; - SDL_bool cloneSource = SDL_FALSE; - surface_scaled = SDL_CreateRGBSurface(SDL_SWSURFACE, final_rect.w, final_rect.h, src->format->BitsPerPixel, - src->format->Rmask, src->format->Gmask, - src->format->Bmask, src->format->Amask ); - if (!surface_scaled) { - return -1; + /* It is possible to encounter an RLE encoded surface here and locking it is + * necessary because this code is going to access the pixel buffer directly. + */ + if (SDL_MUSTLOCK(src)) { + SDL_LockSurface(src); + } + + /* Clone the source surface but use its pixel buffer directly. + * The original source surface must be treated as read-only. + */ + src_clone = SDL_CreateRGBSurfaceFrom(src->pixels, src->w, src->h, src->format->BitsPerPixel, src->pitch, + src->format->Rmask, src->format->Gmask, + src->format->Bmask, src->format->Amask); + if (src_clone == NULL) { + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); } + return -1; + } - /* copy the color key, alpha mod, blend mode, and color mod so the scaled surface behaves like the source */ - if (SDL_GetColorKey(src, &colorkey) == 0) { - SDL_SetColorKey(surface_scaled, SDL_TRUE, colorkey); - cloneSource = SDL_TRUE; - } - SDL_GetSurfaceAlphaMod(src, &alphaMod); /* these will be copied to surface_scaled below if necessary */ - SDL_GetSurfaceBlendMode(src, &blendMode); - SDL_GetSurfaceColorMod(src, &r, &g, &b); + SDL_GetSurfaceBlendMode(src, &blendmode); + SDL_GetSurfaceAlphaMod(src, &alphaMod); + SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod); - /* now we need to blit the src into surface_scaled. since we want to copy the colors from the source to - * surface_scaled rather than blend them, etc. we'll need to disable the blend mode, alpha mod, etc. - * but we don't want to modify src (in case it's being used on other threads), so we'll need to clone it - * before changing the blend options - */ - cloneSource |= blendMode != SDL_BLENDMODE_NONE || (alphaMod & r & g & b) != 255; - if (cloneSource) { - blit_src = SDL_ConvertSurface(src, src->format, src->flags); /* clone src */ - if (!blit_src) { - SDL_FreeSurface(surface_scaled); - return -1; - } - SDL_SetSurfaceAlphaMod(blit_src, 255); /* disable all blending options in blit_src */ - SDL_SetSurfaceBlendMode(blit_src, SDL_BLENDMODE_NONE); - SDL_SetColorKey(blit_src, 0, 0); - SDL_SetSurfaceColorMod(blit_src, 255, 255, 255); - SDL_SetSurfaceRLE(blit_src, 0); /* don't RLE encode a surface we'll only use once */ + /* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */ + if (src->format->BitsPerPixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) { + blitRequired = SDL_TRUE; + } - SDL_SetSurfaceAlphaMod(surface_scaled, alphaMod); /* copy blending options to surface_scaled */ - SDL_SetSurfaceBlendMode(surface_scaled, blendMode); - SDL_SetSurfaceColorMod(surface_scaled, r, g, b); - } + /* If scaling and cropping is necessary, it has to be taken care of before the rotation. */ + if (!(srcrect->w == final_rect.w && srcrect->h == final_rect.h && srcrect->x == 0 && srcrect->y == 0)) { + blitRequired = SDL_TRUE; + } - retval = SDL_BlitScaled(blit_src, srcrect, surface_scaled, &tmp_rect); - if (blit_src != src) { - SDL_FreeSurface(blit_src); + /* The color and alpha modulation has to be applied before the rotation when using the NONE and MOD blend modes. */ + if ((blendmode == SDL_BLENDMODE_NONE || blendmode == SDL_BLENDMODE_MOD) && (alphaMod & rMod & gMod & bMod) != 255) { + applyModulation = SDL_TRUE; + SDL_SetSurfaceAlphaMod(src_clone, alphaMod); + SDL_SetSurfaceColorMod(src_clone, rMod, gMod, bMod); + } + + /* Opaque surfaces are much easier to handle with the NONE blend mode. */ + if (blendmode == SDL_BLENDMODE_NONE && !src->format->Amask && alphaMod == 255) { + isOpaque = SDL_TRUE; + } + + /* The NONE blend mode requires a mask for non-opaque surfaces. This mask will be used + * to clear the pixels in the destination surface. The other steps are explained below. + */ + if (blendmode == SDL_BLENDMODE_NONE && !isOpaque) { + mask = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + if (mask == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(mask, SDL_BLENDMODE_MOD); } } + /* Create a new surface should there be a format mismatch or if scaling, cropping, + * or modulation is required. It's possible to use the source surface directly otherwise. + */ + if (!retval && (blitRequired || applyModulation)) { + SDL_Rect scale_rect = tmp_rect; + src_scaled = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + if (src_scaled == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(src_clone, SDL_BLENDMODE_NONE); + retval = SDL_BlitScaled(src_clone, srcrect, src_scaled, &scale_rect); + SDL_FreeSurface(src_clone); + src_clone = src_scaled; + src_scaled = NULL; + } + } + + /* SDLgfx_rotateSurface is going to make decisions depending on the blend mode. */ + SDL_SetSurfaceBlendMode(src_clone, blendmode); + if (!retval) { SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle); - surface_rotated = SDLgfx_rotateSurface(surface_scaled, angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); - if(surface_rotated) { + src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); + if (src_rotated == NULL) { + retval = -1; + } + if (!retval && mask != NULL) { + /* The mask needed for the NONE blend mode gets rotated with the same parameters. */ + mask_rotated = SDLgfx_rotateSurface(mask, angle, dstwidth/2, dstheight/2, SDL_FALSE, 0, 0, dstwidth, dstheight, cangle, sangle); + if (mask_rotated == NULL) { + retval = -1; + } + } + if (!retval) { /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */ abscenterx = final_rect.x + (int)center->x; abscentery = final_rect.y + (int)center->y; @@ -715,13 +764,69 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, tmp_rect.w = dstwidth; tmp_rect.h = dstheight; - retval = SDL_BlitSurface(surface_rotated, NULL, surface, &tmp_rect); - SDL_FreeSurface(surface_rotated); + /* The NONE blend mode needs some special care with non-opaque surfaces. + * Other blend modes or opaque surfaces can be blitted directly. + */ + if (blendmode != SDL_BLENDMODE_NONE || isOpaque) { + if (applyModulation == SDL_FALSE) { + /* If the modulation wasn't already applied, make it happen now. */ + SDL_SetSurfaceAlphaMod(src_rotated, alphaMod); + SDL_SetSurfaceColorMod(src_rotated, rMod, gMod, bMod); + } + retval = SDL_BlitSurface(src_rotated, NULL, surface, &tmp_rect); + } else { + /* The NONE blend mode requires three steps to get the pixels onto the destination surface. + * First, the area where the rotated pixels will be blitted to get set to zero. + * This is accomplished by simply blitting a mask with the NONE blend mode. + * The colorkey set by the rotate function will discard the correct pixels. + */ + SDL_Rect mask_rect = tmp_rect; + SDL_SetSurfaceBlendMode(mask_rotated, SDL_BLENDMODE_NONE); + retval = SDL_BlitSurface(mask_rotated, NULL, surface, &mask_rect); + if (!retval) { + /* The next step copies the alpha value. This is done with the BLEND blend mode and + * by modulating the source colors with 0. Since the destination is all zeros, this + * will effectively set the destination alpha to the source alpha. + */ + SDL_SetSurfaceColorMod(src_rotated, 0, 0, 0); + mask_rect = tmp_rect; + retval = SDL_BlitSurface(src_rotated, NULL, surface, &mask_rect); + if (!retval) { + /* The last step gets the color values in place. The ADD blend mode simply adds them to + * the destination (where the color values are all zero). However, because the ADD blend + * mode modulates the colors with the alpha channel, a surface without an alpha mask needs + * to be created. This makes all source pixels opaque and the colors get copied correctly. + */ + SDL_Surface *src_rotated_rgb; + src_rotated_rgb = SDL_CreateRGBSurfaceFrom(src_rotated->pixels, src_rotated->w, src_rotated->h, + src_rotated->format->BitsPerPixel, src_rotated->pitch, + src_rotated->format->Rmask, src_rotated->format->Gmask, + src_rotated->format->Bmask, 0); + if (src_rotated_rgb == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD); + retval = SDL_BlitSurface(src_rotated_rgb, NULL, surface, &tmp_rect); + SDL_FreeSurface(src_rotated_rgb); + } + } + } + SDL_FreeSurface(mask_rotated); + } + if (src_rotated != NULL) { + SDL_FreeSurface(src_rotated); + } } } - if (surface_scaled != src) { - SDL_FreeSurface(surface_scaled); + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); + } + if (mask != NULL) { + SDL_FreeSurface(mask); + } + if (src_clone != NULL) { + SDL_FreeSurface(src_clone); } return retval; } @@ -733,19 +838,14 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Surface *surface = SW_ActivateRenderer(renderer); Uint32 src_format; void *src_pixels; - SDL_Rect final_rect; if (!surface) { return -1; } - if (renderer->viewport.x || renderer->viewport.y) { - final_rect.x = renderer->viewport.x + rect->x; - final_rect.y = renderer->viewport.y + rect->y; - final_rect.w = rect->w; - final_rect.h = rect->h; - rect = &final_rect; - } + /* NOTE: The rect is already adjusted according to the viewport by + * SDL_RenderReadPixels. + */ if (rect->x < 0 || rect->x+rect->w > surface->w || rect->y < 0 || rect->y+rect->h > surface->h) { diff --git a/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h b/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h index 89b4e8acc..8f065de7f 100644 --- a/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h +++ b/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_rotate.c b/Engine/lib/sdl/src/render/software/SDL_rotate.c index 0141d174d..44762048f 100644 --- a/Engine/lib/sdl/src/render/software/SDL_rotate.c +++ b/Engine/lib/sdl/src/render/software/SDL_rotate.c @@ -76,11 +76,6 @@ to a situation where the program can segfault. */ #define GUARD_ROWS (2) -/* ! -\brief Lower limit of absolute zoom factor or rotation degrees. -*/ -#define VALUE_LIMIT 0.001 - /* ! \brief Returns colorkey info for a surface */ @@ -142,7 +137,7 @@ SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, cy = *cangle * y; sx = *sangle * x; sy = *sangle * y; - + dstwidthhalf = MAX((int) SDL_ceil(MAX(MAX(MAX(SDL_fabs(cx + sy), SDL_fabs(cx - sy)), SDL_fabs(-cx + sy)), SDL_fabs(-cx - sy))), 1); dstheighthalf = MAX((int) @@ -262,7 +257,7 @@ _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int dy = (sdy >> 16); if (flipx) dx = sw - dx; if (flipy) dy = sh - dy; - if ((unsigned)dx < (unsigned)sw && (unsigned)dy < (unsigned)sh) { + if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy) + dx; c00 = *sp; sp += 1; @@ -390,10 +385,14 @@ transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin /* ! \brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. -Rotates a 32bit or 8bit 'src' surface to newly created 'dst' surface. +Rotates a 32-bit or 8-bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'centerx' and 'centery' the rotation center. If 'smooth' is set -then the destination 32bit surface is anti-aliased. If the surface is not 8bit -or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. +then the destination 32-bit surface is anti-aliased. 8-bit surfaces must have a colorkey. 32-bit +surfaces must have a 8888 layout with red, green, blue and alpha masks (any ordering goes). +The blend mode of the 'src' surface has some effects on generation of the 'dst' surface: The NONE +mode will set the BLEND mode on the 'dst' surface. The MOD mode either generates a white 'dst' +surface and sets the colorkey or fills the it with the colorkey before copying the pixels. +When using the NONE and MOD modes, color and alpha modulation must be applied before using this function. \param src The surface to rotozoom. \param angle The angle to rotate in degrees. @@ -413,69 +412,47 @@ or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. SDL_Surface * SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle) { - SDL_Surface *rz_src; SDL_Surface *rz_dst; - int is32bit, angle90; + int is8bit, angle90; int i; - Uint8 r = 0, g = 0, b = 0; + SDL_BlendMode blendmode; Uint32 colorkey = 0; - int colorKeyAvailable = 0; + int colorKeyAvailable = SDL_FALSE; double sangleinv, cangleinv; - /* - * Sanity check - */ + /* Sanity check */ if (src == NULL) - return (NULL); + return NULL; - if (src->flags & SDL_TRUE/* SDL_SRCCOLORKEY */) - { - colorkey = _colorkey(src); - SDL_GetRGB(colorkey, src->format, &r, &g, &b); - colorKeyAvailable = 1; - } - /* - * Determine if source surface is 32bit or 8bit - */ - is32bit = (src->format->BitsPerPixel == 32); - if ((is32bit) || (src->format->BitsPerPixel == 8)) { - /* - * Use source surface 'as is' - */ - rz_src = src; - } else { - rz_src = SDL_ConvertSurfaceFormat(src, SDL_PIXELFORMAT_ARGB32, src->flags); - if (rz_src == NULL) { - return NULL; - } - is32bit = 1; + if (SDL_GetColorKey(src, &colorkey) == 0) { + colorKeyAvailable = SDL_TRUE; } - /* Determine target size */ - /* _rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, &dstwidth, &dstheight, &cangle, &sangle); */ + /* This function requires a 32-bit surface or 8-bit surface with a colorkey */ + is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable; + if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) + return NULL; - /* - * Calculate target factors from sin/cos and zoom - */ + /* Calculate target factors from sin/cos and zoom */ sangleinv = sangle*65536.0; cangleinv = cangle*65536.0; - /* - * Alloc space to completely contain the rotated surface - */ - if (is32bit) { - /* - * Target surface is 32bit with source RGBA/ABGR ordering - */ - rz_dst = - SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32, - rz_src->format->Rmask, rz_src->format->Gmask, - rz_src->format->Bmask, rz_src->format->Amask); + /* Alloc space to completely contain the rotated surface */ + rz_dst = NULL; + if (is8bit) { + /* Target surface is 8 bit */ + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); + if (rz_dst != NULL) { + for (i = 0; i < src->format->palette->ncolors; i++) { + rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; + } + rz_dst->format->palette->ncolors = src->format->palette->ncolors; + } } else { - /* - * Target surface is 8bit - */ - rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); + /* Target surface is 32 bit with source RGBA ordering */ + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 32, + src->format->Rmask, src->format->Gmask, + src->format->Bmask, src->format->Amask); } /* Check target */ @@ -485,17 +462,32 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, /* Adjust for guard rows */ rz_dst->h = dstheight; - if (colorKeyAvailable == 1){ - colorkey = SDL_MapRGB(rz_dst->format, r, g, b); + SDL_GetSurfaceBlendMode(src, &blendmode); - SDL_FillRect(rz_dst, NULL, colorkey ); + if (colorKeyAvailable == SDL_TRUE) { + /* If available, the colorkey will be used to discard the pixels that are outside of the rotated area. */ + SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey); + SDL_FillRect(rz_dst, NULL, colorkey); + } else if (blendmode == SDL_BLENDMODE_NONE) { + blendmode = SDL_BLENDMODE_BLEND; + } else if (blendmode == SDL_BLENDMODE_MOD) { + /* Without a colorkey, the target texture has to be white for the MOD blend mode so + * that the pixels outside the rotated area don't affect the destination surface. + */ + colorkey = SDL_MapRGBA(rz_dst->format, 255, 255, 255, 0); + SDL_FillRect(rz_dst, NULL, colorkey); + /* Setting a white colorkey for the destination surface makes the final blit discard + * all pixels outside of the rotated area. This doesn't interfere with anything because + * white pixels are already a no-op and the MOD blend mode does not interact with alpha. + */ + SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey); } - /* - * Lock source surface - */ - if (SDL_MUSTLOCK(rz_src)) { - SDL_LockSurface(rz_src); + SDL_SetSurfaceBlendMode(rz_dst, blendmode); + + /* Lock source surface */ + if (SDL_MUSTLOCK(src)) { + SDL_LockSurface(src); } /* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce @@ -510,70 +502,29 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, angle90 = -1; } - /* - * Check which kind of surface we have - */ - if (is32bit) { - /* - * Call the 32bit transformation routine to do the rotation (using alpha) - */ - if (angle90 >= 0) { - transformSurfaceRGBA90(rz_src, rz_dst, angle90, flipx, flipy); - } else { - _transformSurfaceRGBA(rz_src, rz_dst, centerx, centery, (int) (sangleinv), (int) (cangleinv), flipx, flipy, smooth); - } - /* - * Turn on source-alpha support - */ - /* SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); */ - SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src)); - } else { - /* - * Copy palette and colorkey info - */ - for (i = 0; i < rz_src->format->palette->ncolors; i++) { - rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i]; - } - rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors; - /* - * Call the 8bit transformation routine to do the rotation - */ + if (is8bit) { + /* Call the 8-bit transformation routine to do the rotation */ if(angle90 >= 0) { - transformSurfaceY90(rz_src, rz_dst, angle90, flipx, flipy); + transformSurfaceY90(src, rz_dst, angle90, flipx, flipy); } else { - transformSurfaceY(rz_src, rz_dst, centerx, centery, (int)(sangleinv), (int)(cangleinv), flipx, flipy); + transformSurfaceY(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy); + } + } else { + /* Call the 32-bit transformation routine to do the rotation */ + if (angle90 >= 0) { + transformSurfaceRGBA90(src, rz_dst, angle90, flipx, flipy); + } else { + _transformSurfaceRGBA(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy, smooth); } - SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src)); } - /* copy alpha mod, color mod, and blend mode */ - { - SDL_BlendMode blendMode; - Uint8 alphaMod, cr, cg, cb; - SDL_GetSurfaceAlphaMod(src, &alphaMod); - SDL_GetSurfaceBlendMode(src, &blendMode); - SDL_GetSurfaceColorMod(src, &cr, &cg, &cb); - SDL_SetSurfaceAlphaMod(rz_dst, alphaMod); - SDL_SetSurfaceBlendMode(rz_dst, blendMode); - SDL_SetSurfaceColorMod(rz_dst, cr, cg, cb); + /* Unlock source surface */ + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); } - /* - * Unlock source surface - */ - if (SDL_MUSTLOCK(rz_src)) { - SDL_UnlockSurface(rz_src); - } - - /* - * Cleanup temp surface - */ - if (rz_src != src) { - SDL_FreeSurface(rz_src); - } - - /* - * Return destination surface - */ - return (rz_dst); + /* Return rotated surface */ + return rz_dst; } diff --git a/Engine/lib/sdl/src/render/software/SDL_rotate.h b/Engine/lib/sdl/src/render/software/SDL_rotate.h index 338109fc0..2bf2ea82e 100644 --- a/Engine/lib/sdl/src/render/software/SDL_rotate.h +++ b/Engine/lib/sdl/src/render/software/SDL_rotate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/stdlib/SDL_getenv.c b/Engine/lib/sdl/src/stdlib/SDL_getenv.c index 3fc4119fd..591a314f6 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_getenv.c +++ b/Engine/lib/sdl/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,10 @@ #include "../core/windows/SDL_windows.h" #endif +#if defined(__ANDROID__) +#include "../core/android/SDL_android.h" +#endif + #include "SDL_stdinc.h" #if defined(__WIN32__) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) @@ -60,9 +64,7 @@ SDL_setenv(const char *name, const char *value, int overwrite) } if (!overwrite) { - char ch = 0; - const size_t len = GetEnvironmentVariableA(name, &ch, sizeof (ch)); - if (len > 0) { + if (GetEnvironmentVariableA(name, NULL, 0) > 0) { return 0; /* asked not to overwrite existing value. */ } } @@ -173,8 +175,13 @@ SDL_setenv(const char *name, const char *value, int overwrite) char * SDL_getenv(const char *name) { +#if defined(__ANDROID__) + /* Make sure variables from the application manifest are available */ + Android_JNI_GetManifestEnvironmentVariables(); +#endif + /* Input validation */ - if (!name || SDL_strlen(name)==0) { + if (!name || !*name) { return NULL; } diff --git a/Engine/lib/sdl/src/stdlib/SDL_iconv.c b/Engine/lib/sdl/src/stdlib/SDL_iconv.c index 34bcd8431..f8dbc9fa7 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_iconv.c +++ b/Engine/lib/sdl/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,7 @@ If we get this wrong, it's just a warning, so no big deal. */ #if defined(_XGP6) || defined(__APPLE__) || \ + defined(__EMSCRIPTEN__) || \ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \ (defined(_NEWLIB_VERSION))) #define ICONV_INBUF_NONCONST @@ -797,6 +798,7 @@ SDL_iconv(SDL_iconv_t cd, if (ch > 0x10FFFF) { ch = UNKNOWN_UNICODE; } + /* fallthrough */ case ENCODING_UCS4BE: if (ch > 0x7FFFFFFF) { ch = UNKNOWN_UNICODE; @@ -818,6 +820,7 @@ SDL_iconv(SDL_iconv_t cd, if (ch > 0x10FFFF) { ch = UNKNOWN_UNICODE; } + /* fallthrough */ case ENCODING_UCS4LE: if (ch > 0x7FFFFFFF) { ch = UNKNOWN_UNICODE; diff --git a/Engine/lib/sdl/src/stdlib/SDL_malloc.c b/Engine/lib/sdl/src/stdlib/SDL_malloc.c index d640c8fad..ace76bf70 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_malloc.c +++ b/Engine/lib/sdl/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,33 +26,11 @@ #include "../SDL_internal.h" /* This file contains portable memory management functions for SDL */ - #include "SDL_stdinc.h" +#include "SDL_atomic.h" +#include "SDL_error.h" -#if defined(HAVE_MALLOC) - -void *SDL_malloc(size_t size) -{ - return malloc(size); -} - -void *SDL_calloc(size_t nmemb, size_t size) -{ - return calloc(nmemb, size); -} - -void *SDL_realloc(void *ptr, size_t size) -{ - return realloc(ptr, size); -} - -void SDL_free(void *ptr) -{ - free(ptr); -} - -#else /* the rest of this is a LOT of tapdancing to implement malloc. :) */ - +#ifndef HAVE_MALLOC #define LACKS_SYS_TYPES_H #define LACKS_STDIO_H #define LACKS_STRINGS_H @@ -60,6 +38,7 @@ void SDL_free(void *ptr) #define LACKS_STDLIB_H #define ABORT #define USE_LOCKS 1 +#define USE_DL_PREFIX /* This is a version (aka dlmalloc) of malloc/free/realloc written by @@ -636,12 +615,12 @@ DEFAULT_MMAP_THRESHOLD default: 256K #define MALLINFO_FIELD_TYPE size_t #endif /* MALLINFO_FIELD_TYPE */ +#ifndef memset #define memset SDL_memset +#endif +#ifndef memcpy #define memcpy SDL_memcpy -#define malloc SDL_malloc -#define calloc SDL_calloc -#define realloc SDL_realloc -#define free SDL_free +#endif /* mallopt tuning options. SVID/XPG defines four standard parameter @@ -2946,13 +2925,17 @@ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { +#ifndef LACKS_STDIO_H size_t maxfp = 0; +#endif size_t fp = 0; size_t used = 0; check_malloc_state(m); if (is_initialized(m)) { msegmentptr s = &m->seg; +#ifndef LACKS_STDIO_H maxfp = m->max_footprint; +#endif fp = m->footprint; used = fp - (m->topsize + TOP_FOOT_SIZE); @@ -5261,4 +5244,133 @@ History: #endif /* !HAVE_MALLOC */ +#ifdef HAVE_MALLOC +#define real_malloc malloc +#define real_calloc calloc +#define real_realloc realloc +#define real_free free +#else +#define real_malloc dlmalloc +#define real_calloc dlcalloc +#define real_realloc dlrealloc +#define real_free dlfree +#endif + +/* Memory functions used by SDL that can be replaced by the application */ +static struct +{ + SDL_malloc_func malloc_func; + SDL_calloc_func calloc_func; + SDL_realloc_func realloc_func; + SDL_free_func free_func; + SDL_atomic_t num_allocations; +} s_mem = { + real_malloc, real_calloc, real_realloc, real_free, { 0 } +}; + +void SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func) +{ + if (malloc_func) { + *malloc_func = s_mem.malloc_func; + } + if (calloc_func) { + *calloc_func = s_mem.calloc_func; + } + if (realloc_func) { + *realloc_func = s_mem.realloc_func; + } + if (free_func) { + *free_func = s_mem.free_func; + } +} + +int SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func) +{ + if (!malloc_func) { + return SDL_InvalidParamError("malloc_func"); + } + if (!calloc_func) { + return SDL_InvalidParamError("calloc_func"); + } + if (!realloc_func) { + return SDL_InvalidParamError("realloc_func"); + } + if (!free_func) { + return SDL_InvalidParamError("free_func"); + } + + s_mem.malloc_func = malloc_func; + s_mem.calloc_func = calloc_func; + s_mem.realloc_func = realloc_func; + s_mem.free_func = free_func; + return 0; +} + +int SDL_GetNumAllocations(void) +{ + return SDL_AtomicGet(&s_mem.num_allocations); +} + +void *SDL_malloc(size_t size) +{ + void *mem; + + if (!size) { + size = 1; + } + + mem = s_mem.malloc_func(size); + if (mem) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void *SDL_calloc(size_t nmemb, size_t size) +{ + void *mem; + + if (!nmemb || !size) { + nmemb = 1; + size = 1; + } + + mem = s_mem.calloc_func(nmemb, size); + if (mem) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void *SDL_realloc(void *ptr, size_t size) +{ + void *mem; + + if (!ptr && !size) { + size = 1; + } + + mem = s_mem.realloc_func(ptr, size); + if (mem && !ptr) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void SDL_free(void *ptr) +{ + if (!ptr) { + return; + } + + s_mem.free_func(ptr); + (void)SDL_AtomicDecRef(&s_mem.num_allocations); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/stdlib/SDL_qsort.c b/Engine/lib/sdl/src/stdlib/SDL_qsort.c index 2ef33b15e..700b9da91 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_qsort.c +++ b/Engine/lib/sdl/src/stdlib/SDL_qsort.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -275,7 +275,7 @@ typedef struct { char * first; char * last; } stack_entry; /* and so is the pivoting logic (note: last is inclusive): */ #define Pivot(swapper,sz) \ - if (last-first>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ + if ((size_t)(last-first)>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ else { \ if (compare(first,mid)<0) { \ if (compare(mid,last)>0) { \ @@ -362,7 +362,7 @@ typedef struct { char * first; char * last; } stack_entry; static char * pivot_big(char *first, char *mid, char *last, size_t size, int compare(const void *, const void *)) { - int d=(((last-first)/size)>>3)*size; + size_t d=(((last-first)/size)>>3)*size; #ifdef DEBUG_QSORT fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size)); #endif @@ -413,7 +413,7 @@ static void qsort_nonaligned(void *base, size_t nmemb, size_t size, first=(char*)base; last=first+(nmemb-1)*size; - if (last-first>=trunc) { + if ((size_t)(last-first)>=trunc) { char *ffirst=first, *llast=last; while (1) { /* Select pivot */ @@ -444,7 +444,7 @@ static void qsort_aligned(void *base, size_t nmemb, size_t size, first=(char*)base; last=first+(nmemb-1)*size; - if (last-first>=trunc) { + if ((size_t)(last-first)>=trunc) { char *ffirst=first,*llast=last; while (1) { /* Select pivot */ @@ -519,7 +519,7 @@ extern void qsortG(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) { if (nmemb<=1) return; - if (((int)base|size)&(WORD_BYTES-1)) + if (((size_t)base|size)&(WORD_BYTES-1)) qsort_nonaligned(base,nmemb,size,compare); else if (size!=WORD_BYTES) qsort_aligned(base,nmemb,size,compare); diff --git a/Engine/lib/sdl/src/stdlib/SDL_stdlib.c b/Engine/lib/sdl/src/stdlib/SDL_stdlib.c index f5a152b49..b36d83c79 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_stdlib.c +++ b/Engine/lib/sdl/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,17 @@ SDL_atan(double x) return atan(x); #else return SDL_uclibc_atan(x); -#endif /* HAVE_ATAN */ +#endif +} + +float +SDL_atanf(float x) +{ +#if defined(HAVE_ATANF) + return atanf(x); +#else + return (float)SDL_atan((double)x); +#endif } double @@ -48,7 +58,17 @@ SDL_atan2(double x, double y) return atan2(x, y); #else return SDL_uclibc_atan2(x, y); -#endif /* HAVE_ATAN2 */ +#endif +} + +float +SDL_atan2f(float x, float y) +{ +#if defined(HAVE_ATAN2F) + return atan2f(x, y); +#else + return (float)SDL_atan2((double)x, (double)y); +#endif } double @@ -71,6 +91,16 @@ SDL_acos(double val) #endif } +float +SDL_acosf(float val) +{ +#if defined(HAVE_ACOSF) + return acosf(val); +#else + return (float)SDL_acos((double)val); +#endif +} + double SDL_asin(double val) { @@ -87,6 +117,16 @@ SDL_asin(double val) #endif } +float +SDL_asinf(float val) +{ +#if defined(HAVE_ASINF) + return asinf(val); +#else + return (float)SDL_asin((double)val); +#endif +} + double SDL_ceil(double x) { @@ -102,6 +142,16 @@ SDL_ceil(double x) #endif /* HAVE_CEIL */ } +float +SDL_ceilf(float x) +{ +#if defined(HAVE_CEILF) + return ceilf(x); +#else + return (float)SDL_ceil((float)x); +#endif +} + double SDL_copysign(double x, double y) { @@ -109,11 +159,27 @@ SDL_copysign(double x, double y) return copysign(x, y); #elif defined(HAVE__COPYSIGN) return _copysign(x, y); +#elif defined(__WATCOMC__) && defined(__386__) + /* this is nasty as hell, but it works.. */ + unsigned int *xi = (unsigned int *) &x, + *yi = (unsigned int *) &y; + xi[1] = (yi[1] & 0x80000000) | (xi[1] & 0x7fffffff); + return x; #else return SDL_uclibc_copysign(x, y); #endif /* HAVE_COPYSIGN */ } +float +SDL_copysignf(float x, float y) +{ +#if defined(HAVE_COPYSIGNF) + return copysignf(x, y); +#else + return (float)SDL_copysign((double)x, (double)y); +#endif +} + double SDL_cos(double x) { @@ -121,7 +187,7 @@ SDL_cos(double x) return cos(x); #else return SDL_uclibc_cos(x); -#endif /* HAVE_COS */ +#endif } float @@ -141,7 +207,17 @@ SDL_fabs(double x) return fabs(x); #else return SDL_uclibc_fabs(x); -#endif /* HAVE_FABS */ +#endif +} + +float +SDL_fabsf(float x) +{ +#if defined(HAVE_FABSF) + return fabsf(x); +#else + return (float)SDL_fabs((double)x); +#endif } double @@ -151,7 +227,37 @@ SDL_floor(double x) return floor(x); #else return SDL_uclibc_floor(x); -#endif /* HAVE_FLOOR */ +#endif +} + +float +SDL_floorf(float x) +{ +#if defined(HAVE_FLOORF) + return floorf(x); +#else + return (float)SDL_floor((double)x); +#endif +} + +double +SDL_fmod(double x, double y) +{ +#if defined(HAVE_FMOD) + return fmod(x, y); +#else + return SDL_uclibc_fmod(x, y); +#endif +} + +float +SDL_fmodf(float x, float y) +{ +#if defined(HAVE_FMODF) + return fmodf(x, y); +#else + return (float)SDL_fmod((double)x, (double)y); +#endif } double @@ -161,7 +267,37 @@ SDL_log(double x) return log(x); #else return SDL_uclibc_log(x); -#endif /* HAVE_LOG */ +#endif +} + +float +SDL_logf(float x) +{ +#if defined(HAVE_LOGF) + return logf(x); +#else + return (float)SDL_log((double)x); +#endif +} + +double +SDL_log10(double x) +{ +#if defined(HAVE_LOG10) + return log10(x); +#else + return SDL_uclibc_log10(x); +#endif +} + +float +SDL_log10f(float x) +{ +#if defined(HAVE_LOG10F) + return log10f(x); +#else + return (float)SDL_log10((double)x); +#endif } double @@ -171,7 +307,17 @@ SDL_pow(double x, double y) return pow(x, y); #else return SDL_uclibc_pow(x, y); -#endif /* HAVE_POW */ +#endif +} + +float +SDL_powf(float x, float y) +{ +#if defined(HAVE_POWF) + return powf(x, y); +#else + return (float)SDL_pow((double)x, (double)y); +#endif } double @@ -181,9 +327,23 @@ SDL_scalbn(double x, int n) return scalbn(x, n); #elif defined(HAVE__SCALB) return _scalb(x, n); +#elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2) +/* from scalbn(3): If FLT_RADIX equals 2 (which is + * usual), then scalbn() is equivalent to ldexp(3). */ + return ldexp(x, n); #else return SDL_uclibc_scalbn(x, n); -#endif /* HAVE_SCALBN */ +#endif +} + +float +SDL_scalbnf(float x, int n) +{ +#if defined(HAVE_SCALBNF) + return scalbnf(x, n); +#else + return (float)SDL_scalbn((double)x, n); +#endif } double @@ -193,7 +353,7 @@ SDL_sin(double x) return sin(x); #else return SDL_uclibc_sin(x); -#endif /* HAVE_SIN */ +#endif } float @@ -203,7 +363,7 @@ SDL_sinf(float x) return sinf(x); #else return (float)SDL_sin((double)x); -#endif /* HAVE_SINF */ +#endif } double @@ -914,8 +1074,8 @@ _allshr() { /* *INDENT-OFF* */ __asm { - cmp cl,40h - jae RETZERO + cmp cl,3Fh + jae RETSIGN cmp cl,20h jae MORE32 shrd eax,edx,cl @@ -923,13 +1083,13 @@ _allshr() ret MORE32: mov eax,edx - xor edx,edx + sar edx,1Fh and cl,1Fh sar eax,cl ret -RETZERO: - xor eax,eax - xor edx,edx +RETSIGN: + sar edx,1Fh + mov eax,edx ret } /* *INDENT-ON* */ diff --git a/Engine/lib/sdl/src/stdlib/SDL_string.c b/Engine/lib/sdl/src/stdlib/SDL_string.c index debbebaed..444ae6d52 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_string.c +++ b/Engine/lib/sdl/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,24 +18,20 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - -#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) +#if defined(__clang_analyzer__) #define SDL_DISABLE_ANALYZE_MACROS 1 #endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - #include "../SDL_internal.h" /* This file contains portable string manipulation functions for SDL */ #include "SDL_stdinc.h" - +#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) || !defined(HAVE_STRTOD) #define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) #define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f')) +#endif #define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4) #define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF) @@ -82,7 +78,7 @@ SDL_ScanLong(const char *text, int radix, long *valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -118,7 +114,7 @@ SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -150,7 +146,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -187,7 +183,7 @@ SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -223,7 +219,7 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -255,7 +251,7 @@ SDL_ScanFloat(const char *text, double *valuep) ++text; } } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -465,6 +461,22 @@ SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t max #endif /* HAVE_WCSLCAT */ } +int +SDL_wcscmp(const wchar_t *str1, const wchar_t *str2) +{ +#if defined(HAVE_WCSCMP) + return wcscmp(str1, str2); +#else + while (*str1 && *str2) { + if (*str1 != *str2) + break; + ++str1; + ++str2; + } + return (int)(*str1 - *str2); +#endif /* HAVE_WCSCMP */ +} + size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { @@ -481,7 +493,8 @@ SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) #endif /* HAVE_STRLCPY */ } -size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes) +size_t +SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes) { size_t src_bytes = SDL_strlen(src); size_t bytes = SDL_min(src_bytes, dst_bytes - 1); @@ -513,6 +526,23 @@ size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size return bytes; } +size_t +SDL_utf8strlen(const char *str) +{ + size_t retval = 0; + const char *p = str; + char ch; + + while ((ch = *(p++))) { + /* if top two bits are 1 and 0, it's a continuation byte. */ + if ((ch & 0xc0) != 0x80) { + retval++; + } + } + + return retval; +} + size_t SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { @@ -531,16 +561,12 @@ SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) char * SDL_strdup(const char *string) { -#if defined(HAVE_STRDUP) - return strdup(string); -#else size_t len = SDL_strlen(string) + 1; char *newstr = SDL_malloc(len); if (newstr) { - SDL_strlcpy(newstr, string, len); + SDL_memcpy(newstr, string, len); } return newstr; -#endif /* HAVE_STRDUP */ } char * @@ -789,7 +815,7 @@ SDL_strtol(const char *string, char **endp, int base) return strtol(string, endp, base); #else size_t len; - long value; + long value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -814,7 +840,7 @@ SDL_strtoul(const char *string, char **endp, int base) return strtoul(string, endp, base); #else size_t len; - unsigned long value; + unsigned long value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -839,7 +865,7 @@ SDL_strtoll(const char *string, char **endp, int base) return strtoll(string, endp, base); #else size_t len; - Sint64 value; + Sint64 value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -864,7 +890,7 @@ SDL_strtoull(const char *string, char **endp, int base) return strtoull(string, endp, base); #else size_t len; - Uint64 value; + Uint64 value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -889,7 +915,7 @@ SDL_strtod(const char *string, char **endp) return strtod(string, endp); #else size_t len; - double value; + double value = 0.0; len = SDL_ScanFloat(string, &value); if (endp) { @@ -911,7 +937,7 @@ SDL_strcmp(const char *str1, const char *str2) ++str1; ++str2; } - return (int) ((unsigned char) *str1 - (unsigned char) *str2); + return (int)((unsigned char) *str1 - (unsigned char) *str2); #endif /* HAVE_STRCMP */ } @@ -1011,6 +1037,10 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) { int retval = 0; + if (!text || !*text) { + return -1; + } + while (*fmt) { if (*fmt == ' ') { while (SDL_isspace((unsigned char) *text)) { @@ -1030,6 +1060,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) DO_LONG, DO_LONGLONG } inttype = DO_INT; + size_t advance; SDL_bool suppress = SDL_FALSE; ++fmt; @@ -1109,16 +1140,18 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) case 'd': if (inttype == DO_LONGLONG) { Sint64 value; - text += SDL_ScanLongLong(text, radix, &value); - if (!suppress) { + advance = SDL_ScanLongLong(text, radix, &value); + text += advance; + if (advance && !suppress) { Sint64 *valuep = va_arg(ap, Sint64 *); *valuep = value; ++retval; } } else { long value; - text += SDL_ScanLong(text, radix, &value); - if (!suppress) { + advance = SDL_ScanLong(text, radix, &value); + text += advance; + if (advance && !suppress) { switch (inttype) { case DO_SHORT: { @@ -1160,17 +1193,19 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) /* Fall through to unsigned handling */ case 'u': if (inttype == DO_LONGLONG) { - Uint64 value; - text += SDL_ScanUnsignedLongLong(text, radix, &value); - if (!suppress) { + Uint64 value = 0; + advance = SDL_ScanUnsignedLongLong(text, radix, &value); + text += advance; + if (advance && !suppress) { Uint64 *valuep = va_arg(ap, Uint64 *); *valuep = value; ++retval; } } else { - unsigned long value; - text += SDL_ScanUnsignedLong(text, radix, &value); - if (!suppress) { + unsigned long value = 0; + advance = SDL_ScanUnsignedLong(text, radix, &value); + text += advance; + if (advance && !suppress) { switch (inttype) { case DO_SHORT: { @@ -1201,9 +1236,10 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) break; case 'p': { - uintptr_t value; - text += SDL_ScanUintPtrT(text, 16, &value); - if (!suppress) { + uintptr_t value = 0; + advance = SDL_ScanUintPtrT(text, 16, &value); + text += advance; + if (advance && !suppress) { void **valuep = va_arg(ap, void **); *valuep = (void *) value; ++retval; @@ -1214,8 +1250,9 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) case 'f': { double value; - text += SDL_ScanFloat(text, &value); - if (!suppress) { + advance = SDL_ScanFloat(text, &value); + text += advance; + if (advance && !suppress) { float *valuep = va_arg(ap, float *); *valuep = (float) value; ++retval; @@ -1317,6 +1354,10 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str size_t length = 0; size_t slen; + if (string == NULL) { + string = "(null)"; + } + if (info && info->width && (size_t)info->width > SDL_strlen(string)) { char fill = info->pad_zeroes ? '0' : ' '; size_t width = info->width - SDL_strlen(string); @@ -1488,7 +1529,7 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, if (!fmt) { fmt = ""; } - while (*fmt) { + while (*fmt && left > 1) { if (*fmt == '%') { SDL_bool done = SDL_FALSE; size_t len = 0; @@ -1632,6 +1673,16 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, len = SDL_PrintFloat(text, left, &info, va_arg(ap, double)); done = SDL_TRUE; break; + case 'S': + { + /* In practice this is used on Windows for WCHAR strings */ + wchar_t *wide_arg = va_arg(ap, wchar_t *); + char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg)); + len = SDL_PrintString(text, left, &info, arg); + SDL_free(arg); + done = SDL_TRUE; + } + break; case 's': len = SDL_PrintString(text, left, &info, va_arg(ap, char *)); done = SDL_TRUE; @@ -1650,12 +1701,8 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, left -= len; } } else { - if (left > 1) { - *text = *fmt; - --left; - } - ++fmt; - ++text; + *text++ = *fmt++; + --left; } } if (left > 0) { diff --git a/Engine/lib/sdl/src/test/SDL_test_assert.c b/Engine/lib/sdl/src/test/SDL_test_assert.c index ee2f13248..4b5728560 100644 --- a/Engine/lib/sdl/src/test/SDL_test_assert.c +++ b/Engine/lib/sdl/src/test/SDL_test_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -148,3 +148,5 @@ int SDLTest_AssertSummaryToTestResult() } } } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_common.c b/Engine/lib/sdl/src/test/SDL_test_common.c index 1d0b005b5..b7e294af7 100644 --- a/Engine/lib/sdl/src/test/SDL_test_common.c +++ b/Engine/lib/sdl/src/test/SDL_test_common.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,10 +32,33 @@ #define AUDIO_USAGE \ "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" +static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) +{ + size_t length = SDL_strlen(text); + va_list ap; + + va_start(ap, fmt); + text += length; + maxlen -= length; + SDL_vsnprintf(text, maxlen, fmt, ap); + va_end(ap); +} + SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags) { - SDLTest_CommonState *state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); + int i; + SDLTest_CommonState *state; + + /* Do this first so we catch all allocations */ + for (i = 1; argv[i]; ++i) { + if (SDL_strcasecmp(argv[i], "--trackmem") == 0) { + SDLTest_TrackAllocations(); + break; + } + } + + state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); if (!state) { SDL_OutOfMemory(); return NULL; @@ -435,6 +458,10 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) state->audiospec.samples = (Uint16) SDL_atoi(argv[index]); return 2; } + if (SDL_strcasecmp(argv[index], "--trackmem") == 0) { + /* Already handled in SDLTest_CommonCreateState() */ + return 1; + } if ((SDL_strcasecmp(argv[index], "-h") == 0) || (SDL_strcasecmp(argv[index], "--help") == 0)) { /* Print the usage message */ @@ -452,134 +479,140 @@ SDLTest_CommonUsage(SDLTest_CommonState * state) { switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { case SDL_INIT_VIDEO: - return VIDEO_USAGE; + return "[--trackmem] " VIDEO_USAGE; case SDL_INIT_AUDIO: - return AUDIO_USAGE; + return "[--trackmem] " AUDIO_USAGE; case (SDL_INIT_VIDEO | SDL_INIT_AUDIO): - return VIDEO_USAGE " " AUDIO_USAGE; + return "[--trackmem] " VIDEO_USAGE " " AUDIO_USAGE; default: - return ""; + return "[--trackmem]"; } } static void -SDLTest_PrintRendererFlag(Uint32 flag) +SDLTest_PrintRendererFlag(char *text, size_t maxlen, Uint32 flag) { switch (flag) { - case SDL_RENDERER_PRESENTVSYNC: - fprintf(stderr, "PresentVSync"); + case SDL_RENDERER_SOFTWARE: + SDL_snprintfcat(text, maxlen, "Software"); break; case SDL_RENDERER_ACCELERATED: - fprintf(stderr, "Accelerated"); + SDL_snprintfcat(text, maxlen, "Accelerated"); + break; + case SDL_RENDERER_PRESENTVSYNC: + SDL_snprintfcat(text, maxlen, "PresentVSync"); + break; + case SDL_RENDERER_TARGETTEXTURE: + SDL_snprintfcat(text, maxlen, "TargetTexturesSupported"); break; default: - fprintf(stderr, "0x%8.8x", flag); + SDL_snprintfcat(text, maxlen, "0x%8.8x", flag); break; } } static void -SDLTest_PrintPixelFormat(Uint32 format) +SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format) { switch (format) { case SDL_PIXELFORMAT_UNKNOWN: - fprintf(stderr, "Unknwon"); + SDL_snprintfcat(text, maxlen, "Unknown"); break; case SDL_PIXELFORMAT_INDEX1LSB: - fprintf(stderr, "Index1LSB"); + SDL_snprintfcat(text, maxlen, "Index1LSB"); break; case SDL_PIXELFORMAT_INDEX1MSB: - fprintf(stderr, "Index1MSB"); + SDL_snprintfcat(text, maxlen, "Index1MSB"); break; case SDL_PIXELFORMAT_INDEX4LSB: - fprintf(stderr, "Index4LSB"); + SDL_snprintfcat(text, maxlen, "Index4LSB"); break; case SDL_PIXELFORMAT_INDEX4MSB: - fprintf(stderr, "Index4MSB"); + SDL_snprintfcat(text, maxlen, "Index4MSB"); break; case SDL_PIXELFORMAT_INDEX8: - fprintf(stderr, "Index8"); + SDL_snprintfcat(text, maxlen, "Index8"); break; case SDL_PIXELFORMAT_RGB332: - fprintf(stderr, "RGB332"); + SDL_snprintfcat(text, maxlen, "RGB332"); break; case SDL_PIXELFORMAT_RGB444: - fprintf(stderr, "RGB444"); + SDL_snprintfcat(text, maxlen, "RGB444"); break; case SDL_PIXELFORMAT_RGB555: - fprintf(stderr, "RGB555"); + SDL_snprintfcat(text, maxlen, "RGB555"); break; case SDL_PIXELFORMAT_BGR555: - fprintf(stderr, "BGR555"); + SDL_snprintfcat(text, maxlen, "BGR555"); break; case SDL_PIXELFORMAT_ARGB4444: - fprintf(stderr, "ARGB4444"); + SDL_snprintfcat(text, maxlen, "ARGB4444"); break; case SDL_PIXELFORMAT_ABGR4444: - fprintf(stderr, "ABGR4444"); + SDL_snprintfcat(text, maxlen, "ABGR4444"); break; case SDL_PIXELFORMAT_ARGB1555: - fprintf(stderr, "ARGB1555"); + SDL_snprintfcat(text, maxlen, "ARGB1555"); break; case SDL_PIXELFORMAT_ABGR1555: - fprintf(stderr, "ABGR1555"); + SDL_snprintfcat(text, maxlen, "ABGR1555"); break; case SDL_PIXELFORMAT_RGB565: - fprintf(stderr, "RGB565"); + SDL_snprintfcat(text, maxlen, "RGB565"); break; case SDL_PIXELFORMAT_BGR565: - fprintf(stderr, "BGR565"); + SDL_snprintfcat(text, maxlen, "BGR565"); break; case SDL_PIXELFORMAT_RGB24: - fprintf(stderr, "RGB24"); + SDL_snprintfcat(text, maxlen, "RGB24"); break; case SDL_PIXELFORMAT_BGR24: - fprintf(stderr, "BGR24"); + SDL_snprintfcat(text, maxlen, "BGR24"); break; case SDL_PIXELFORMAT_RGB888: - fprintf(stderr, "RGB888"); + SDL_snprintfcat(text, maxlen, "RGB888"); break; case SDL_PIXELFORMAT_BGR888: - fprintf(stderr, "BGR888"); + SDL_snprintfcat(text, maxlen, "BGR888"); break; case SDL_PIXELFORMAT_ARGB8888: - fprintf(stderr, "ARGB8888"); + SDL_snprintfcat(text, maxlen, "ARGB8888"); break; case SDL_PIXELFORMAT_RGBA8888: - fprintf(stderr, "RGBA8888"); + SDL_snprintfcat(text, maxlen, "RGBA8888"); break; case SDL_PIXELFORMAT_ABGR8888: - fprintf(stderr, "ABGR8888"); + SDL_snprintfcat(text, maxlen, "ABGR8888"); break; case SDL_PIXELFORMAT_BGRA8888: - fprintf(stderr, "BGRA8888"); + SDL_snprintfcat(text, maxlen, "BGRA8888"); break; case SDL_PIXELFORMAT_ARGB2101010: - fprintf(stderr, "ARGB2101010"); + SDL_snprintfcat(text, maxlen, "ARGB2101010"); break; case SDL_PIXELFORMAT_YV12: - fprintf(stderr, "YV12"); + SDL_snprintfcat(text, maxlen, "YV12"); break; case SDL_PIXELFORMAT_IYUV: - fprintf(stderr, "IYUV"); + SDL_snprintfcat(text, maxlen, "IYUV"); break; case SDL_PIXELFORMAT_YUY2: - fprintf(stderr, "YUY2"); + SDL_snprintfcat(text, maxlen, "YUY2"); break; case SDL_PIXELFORMAT_UYVY: - fprintf(stderr, "UYVY"); + SDL_snprintfcat(text, maxlen, "UYVY"); break; case SDL_PIXELFORMAT_YVYU: - fprintf(stderr, "YVYU"); + SDL_snprintfcat(text, maxlen, "YVYU"); break; case SDL_PIXELFORMAT_NV12: - fprintf(stderr, "NV12"); + SDL_snprintfcat(text, maxlen, "NV12"); break; case SDL_PIXELFORMAT_NV21: - fprintf(stderr, "NV21"); + SDL_snprintfcat(text, maxlen, "NV21"); break; default: - fprintf(stderr, "0x%8.8x", format); + SDL_snprintfcat(text, maxlen, "0x%8.8x", format); break; } } @@ -588,35 +621,37 @@ static void SDLTest_PrintRenderer(SDL_RendererInfo * info) { int i, count; + char text[1024]; - fprintf(stderr, " Renderer %s:\n", info->name); + SDL_Log(" Renderer %s:\n", info->name); - fprintf(stderr, " Flags: 0x%8.8X", info->flags); - fprintf(stderr, " ("); + SDL_snprintf(text, sizeof(text), " Flags: 0x%8.8X", info->flags); + SDL_snprintfcat(text, sizeof(text), " ("); count = 0; for (i = 0; i < sizeof(info->flags) * 8; ++i) { Uint32 flag = (1 << i); if (info->flags & flag) { if (count > 0) { - fprintf(stderr, " | "); + SDL_snprintfcat(text, sizeof(text), " | "); } - SDLTest_PrintRendererFlag(flag); + SDLTest_PrintRendererFlag(text, sizeof(text), flag); ++count; } } - fprintf(stderr, ")\n"); + SDL_snprintfcat(text, sizeof(text), ")"); + SDL_Log("%s\n", text); - fprintf(stderr, " Texture formats (%d): ", info->num_texture_formats); + SDL_snprintf(text, sizeof(text), " Texture formats (%d): ", info->num_texture_formats); for (i = 0; i < (int) info->num_texture_formats; ++i) { if (i > 0) { - fprintf(stderr, ", "); + SDL_snprintfcat(text, sizeof(text), ", "); } - SDLTest_PrintPixelFormat(info->texture_formats[i]); + SDLTest_PrintPixelFormat(text, sizeof(text), info->texture_formats[i]); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); if (info->max_texture_width || info->max_texture_height) { - fprintf(stderr, " Max Texture Size: %dx%d\n", + SDL_Log(" Max Texture Size: %dx%d\n", info->max_texture_width, info->max_texture_height); } } @@ -629,7 +664,7 @@ SDLTest_LoadIcon(const char *file) /* Load the icon surface */ icon = SDL_LoadBMP(file); if (icon == NULL) { - fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError()); + SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError()); return (NULL); } @@ -641,35 +676,82 @@ SDLTest_LoadIcon(const char *file) return (icon); } +static SDL_HitTestResult SDLCALL +SDLTest_ExampleHitTestCallback(SDL_Window *win, const SDL_Point *area, void *data) +{ + int w, h; + const int RESIZE_BORDER = 8; + const int DRAGGABLE_TITLE = 32; + + /*SDL_Log("Hit test point %d,%d\n", area->x, area->y);*/ + + SDL_GetWindowSize(win, &w, &h); + + if (area->x < RESIZE_BORDER) { + if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT\n"); + return SDL_HITTEST_RESIZE_TOPLEFT; + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT\n"); + return SDL_HITTEST_RESIZE_BOTTOMLEFT; + } else { + SDL_Log("SDL_HITTEST_RESIZE_LEFT\n"); + return SDL_HITTEST_RESIZE_LEFT; + } + } else if (area->x >= (w-RESIZE_BORDER)) { + if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT\n"); + return SDL_HITTEST_RESIZE_TOPRIGHT; + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT\n"); + return SDL_HITTEST_RESIZE_BOTTOMRIGHT; + } else { + SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n"); + return SDL_HITTEST_RESIZE_RIGHT; + } + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOM\n"); + return SDL_HITTEST_RESIZE_BOTTOM; + } else if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOP\n"); + return SDL_HITTEST_RESIZE_TOP; + } else if (area->y < DRAGGABLE_TITLE) { + SDL_Log("SDL_HITTEST_DRAGGABLE\n"); + return SDL_HITTEST_DRAGGABLE; + } + return SDL_HITTEST_NORMAL; +} + SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state) { int i, j, m, n, w, h; SDL_DisplayMode fullscreen_mode; + char text[1024]; if (state->flags & SDL_INIT_VIDEO) { if (state->verbose & VERBOSE_VIDEO) { n = SDL_GetNumVideoDrivers(); if (n == 0) { - fprintf(stderr, "No built-in video drivers\n"); + SDL_Log("No built-in video drivers\n"); } else { - fprintf(stderr, "Built-in video drivers:"); + SDL_snprintf(text, sizeof(text), "Built-in video drivers:"); for (i = 0; i < n; ++i) { if (i > 0) { - fprintf(stderr, ","); + SDL_snprintfcat(text, sizeof(text), ","); } - fprintf(stderr, " %s", SDL_GetVideoDriver(i)); + SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i)); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); } } if (SDL_VideoInit(state->videodriver) < 0) { - fprintf(stderr, "Couldn't initialize video driver: %s\n", + SDL_Log("Couldn't initialize video driver: %s\n", SDL_GetError()); return SDL_FALSE; } if (state->verbose & VERBOSE_VIDEO) { - fprintf(stderr, "Video driver: %s\n", + SDL_Log("Video driver: %s\n", SDL_GetCurrentVideoDriver()); } @@ -706,75 +788,82 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } if (state->verbose & VERBOSE_MODES) { - SDL_Rect bounds; + SDL_Rect bounds, usablebounds; + float hdpi = 0; + float vdpi = 0; SDL_DisplayMode mode; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; #if SDL_VIDEO_DRIVER_WINDOWS - int adapterIndex = 0; - int outputIndex = 0; + int adapterIndex = 0; + int outputIndex = 0; #endif n = SDL_GetNumVideoDisplays(); - fprintf(stderr, "Number of displays: %d\n", n); + SDL_Log("Number of displays: %d\n", n); for (i = 0; i < n; ++i) { - fprintf(stderr, "Display %d: %s\n", i, SDL_GetDisplayName(i)); + SDL_Log("Display %d: %s\n", i, SDL_GetDisplayName(i)); SDL_zero(bounds); SDL_GetDisplayBounds(i, &bounds); - fprintf(stderr, "Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); + + SDL_zero(usablebounds); + SDL_GetDisplayUsableBounds(i, &usablebounds); + + SDL_GetDisplayDPI(i, NULL, &hdpi, &vdpi); + + SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); + SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y); + SDL_Log("DPI: %fx%f\n", hdpi, vdpi); SDL_GetDesktopDisplayMode(i, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - fprintf(stderr, - " Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n", mode.w, mode.h, mode.refresh_rate, bpp, SDL_GetPixelFormatName(mode.format)); if (Rmask || Gmask || Bmask) { - fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask); - fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask); - fprintf(stderr, " Blue Mask = 0x%.8x\n", Bmask); + SDL_Log(" Red Mask = 0x%.8x\n", Rmask); + SDL_Log(" Green Mask = 0x%.8x\n", Gmask); + SDL_Log(" Blue Mask = 0x%.8x\n", Bmask); if (Amask) - fprintf(stderr, " Alpha Mask = 0x%.8x\n", Amask); + SDL_Log(" Alpha Mask = 0x%.8x\n", Amask); } /* Print available fullscreen video modes */ m = SDL_GetNumDisplayModes(i); if (m == 0) { - fprintf(stderr, "No available fullscreen video modes\n"); + SDL_Log("No available fullscreen video modes\n"); } else { - fprintf(stderr, " Fullscreen video modes:\n"); + SDL_Log(" Fullscreen video modes:\n"); for (j = 0; j < m; ++j) { SDL_GetDisplayMode(i, j, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - fprintf(stderr, - " Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n", j, mode.w, mode.h, mode.refresh_rate, bpp, SDL_GetPixelFormatName(mode.format)); if (Rmask || Gmask || Bmask) { - fprintf(stderr, " Red Mask = 0x%.8x\n", + SDL_Log(" Red Mask = 0x%.8x\n", Rmask); - fprintf(stderr, " Green Mask = 0x%.8x\n", + SDL_Log(" Green Mask = 0x%.8x\n", Gmask); - fprintf(stderr, " Blue Mask = 0x%.8x\n", + SDL_Log(" Blue Mask = 0x%.8x\n", Bmask); if (Amask) - fprintf(stderr, - " Alpha Mask = 0x%.8x\n", + SDL_Log(" Alpha Mask = 0x%.8x\n", Amask); } } } #if SDL_VIDEO_DRIVER_WINDOWS - /* Print the D3D9 adapter index */ - adapterIndex = SDL_Direct3D9GetAdapterIndex( i ); - fprintf( stderr, "D3D9 Adapter Index: %d", adapterIndex ); + /* Print the D3D9 adapter index */ + adapterIndex = SDL_Direct3D9GetAdapterIndex( i ); + SDL_Log("D3D9 Adapter Index: %d", adapterIndex); - /* Print the DXGI adapter and output indices */ - SDL_DXGIGetOutputInfo(i, &adapterIndex, &outputIndex); - fprintf( stderr, "DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex ); + /* Print the DXGI adapter and output indices */ + SDL_DXGIGetOutputInfo(i, &adapterIndex, &outputIndex); + SDL_Log("DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex); #endif } } @@ -784,9 +873,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state) n = SDL_GetNumRenderDrivers(); if (n == 0) { - fprintf(stderr, "No built-in render drivers\n"); + SDL_Log("No built-in render drivers\n"); } else { - fprintf(stderr, "Built-in render drivers:\n"); + SDL_Log("Built-in render drivers:\n"); for (i = 0; i < n; ++i) { SDL_GetRenderDriverInfo(i, &info); SDLTest_PrintRenderer(&info); @@ -815,16 +904,16 @@ SDLTest_CommonInit(SDLTest_CommonState * state) fullscreen_mode.refresh_rate = state->refresh_rate; state->windows = - (SDL_Window **) SDL_malloc(state->num_windows * + (SDL_Window **) SDL_calloc(state->num_windows, sizeof(*state->windows)); state->renderers = - (SDL_Renderer **) SDL_malloc(state->num_windows * + (SDL_Renderer **) SDL_calloc(state->num_windows, sizeof(*state->renderers)); state->targets = - (SDL_Texture **) SDL_malloc(state->num_windows * + (SDL_Texture **) SDL_calloc(state->num_windows, sizeof(*state->targets)); if (!state->windows || !state->renderers) { - fprintf(stderr, "Out of memory!\n"); + SDL_Log("Out of memory!\n"); return SDL_FALSE; } for (i = 0; i < state->num_windows; ++i) { @@ -841,7 +930,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->window_w, state->window_h, state->window_flags); if (!state->windows[i]) { - fprintf(stderr, "Couldn't create window: %s\n", + SDL_Log("Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; } @@ -859,11 +948,17 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->window_h = h; } if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) { - fprintf(stderr, "Can't set up fullscreen display mode: %s\n", + SDL_Log("Can't set up fullscreen display mode: %s\n", SDL_GetError()); return SDL_FALSE; } + /* Add resize/drag areas for windows that are borderless and resizable */ + if ((state->window_flags & (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) == + (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) { + SDL_SetWindowHitTest(state->windows[i], SDLTest_ExampleHitTestCallback, NULL); + } + if (state->window_icon) { SDL_Surface *icon = SDLTest_LoadIcon(state->window_icon); if (icon) { @@ -874,12 +969,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state) SDL_ShowWindow(state->windows[i]); - state->renderers[i] = NULL; - state->targets[i] = NULL; - if (!state->skip_renderer && (state->renderdriver - || !(state->window_flags & SDL_WINDOW_OPENGL))) { + || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) { m = -1; if (state->renderdriver) { SDL_RendererInfo info; @@ -893,8 +985,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } } if (m == -1) { - fprintf(stderr, - "Couldn't find render driver named %s", + SDL_Log("Couldn't find render driver named %s", state->renderdriver); return SDL_FALSE; } @@ -902,7 +993,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->renderers[i] = SDL_CreateRenderer(state->windows[i], m, state->render_flags); if (!state->renderers[i]) { - fprintf(stderr, "Couldn't create renderer: %s\n", + SDL_Log("Couldn't create renderer: %s\n", SDL_GetError()); return SDL_FALSE; } @@ -914,7 +1005,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) if (state->verbose & VERBOSE_RENDER) { SDL_RendererInfo info; - fprintf(stderr, "Current renderer:\n"); + SDL_Log("Current renderer:\n"); SDL_GetRendererInfo(state->renderers[i], &info); SDLTest_PrintRenderer(&info); } @@ -926,30 +1017,30 @@ SDLTest_CommonInit(SDLTest_CommonState * state) if (state->verbose & VERBOSE_AUDIO) { n = SDL_GetNumAudioDrivers(); if (n == 0) { - fprintf(stderr, "No built-in audio drivers\n"); + SDL_Log("No built-in audio drivers\n"); } else { - fprintf(stderr, "Built-in audio drivers:"); + SDL_snprintf(text, sizeof(text), "Built-in audio drivers:"); for (i = 0; i < n; ++i) { if (i > 0) { - fprintf(stderr, ","); + SDL_snprintfcat(text, sizeof(text), ","); } - fprintf(stderr, " %s", SDL_GetAudioDriver(i)); + SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i)); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); } } if (SDL_AudioInit(state->audiodriver) < 0) { - fprintf(stderr, "Couldn't initialize audio driver: %s\n", + SDL_Log("Couldn't initialize audio driver: %s\n", SDL_GetError()); return SDL_FALSE; } if (state->verbose & VERBOSE_VIDEO) { - fprintf(stderr, "Audio driver: %s\n", + SDL_Log("Audio driver: %s\n", SDL_GetCurrentAudioDriver()); } if (SDL_OpenAudio(&state->audiospec, NULL) < 0) { - fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); + SDL_Log("Couldn't open audio: %s\n", SDL_GetError()); return SDL_FALSE; } } @@ -1071,7 +1162,7 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: Window %d hit test", event->window.windowID); break; default: - SDL_Log("SDL EVENT: Window %d got unknown event %d", + SDL_Log("SDL EVENT: Window %d got unknown event 0x%4.4x", event->window.windowID, event->window.event); break; } @@ -1090,10 +1181,17 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_GetScancodeName(event->key.keysym.scancode), event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); break; + case SDL_TEXTEDITING: + SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %d", + event->edit.text, event->edit.windowID); + break; case SDL_TEXTINPUT: SDL_Log("SDL EVENT: Keyboard: text input \"%s\" in window %d", event->text.text, event->text.windowID); break; + case SDL_KEYMAPCHANGED: + SDL_Log("SDL EVENT: Keymap changed"); + break; case SDL_MOUSEMOTION: SDL_Log("SDL EVENT: Mouse: moved to %d,%d (%d,%d) in window %d", event->motion.x, event->motion.y, @@ -1200,6 +1298,13 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: Clipboard updated"); break; + case SDL_FINGERMOTION: + SDL_Log("SDL EVENT: Finger: motion touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", + (long) event->tfinger.touchId, + (long) event->tfinger.fingerId, + event->tfinger.x, event->tfinger.y, + event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure); + break; case SDL_FINGERDOWN: case SDL_FINGERUP: SDL_Log("SDL EVENT: Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", @@ -1210,10 +1315,10 @@ SDLTest_PrintEvent(SDL_Event * event) event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure); break; case SDL_DOLLARGESTURE: - SDL_Log("SDL_EVENT: Dollar gesture detect: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId); + SDL_Log("SDL_EVENT: Dollar gesture detect: %ld", (long) event->dgesture.gestureId); break; case SDL_DOLLARRECORD: - SDL_Log("SDL_EVENT: Dollar gesture record: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId); + SDL_Log("SDL_EVENT: Dollar gesture record: %ld", (long) event->dgesture.gestureId); break; case SDL_MULTIGESTURE: SDL_Log("SDL_EVENT: Multi gesture fingers: %d", event->mgesture.numFingers); @@ -1226,6 +1331,25 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: render targets reset"); break; + case SDL_APP_TERMINATING: + SDL_Log("SDL EVENT: App terminating"); + break; + case SDL_APP_LOWMEMORY: + SDL_Log("SDL EVENT: App running low on memory"); + break; + case SDL_APP_WILLENTERBACKGROUND: + SDL_Log("SDL EVENT: App will enter the background"); + break; + case SDL_APP_DIDENTERBACKGROUND: + SDL_Log("SDL EVENT: App entered the background"); + break; + case SDL_APP_WILLENTERFOREGROUND: + SDL_Log("SDL EVENT: App will enter the foreground"); + break; + case SDL_APP_DIDENTERFOREGROUND: + SDL_Log("SDL EVENT: App entered the foreground"); + break; + case SDL_QUIT: SDL_Log("SDL EVENT: Quit requested"); break; @@ -1233,7 +1357,7 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: User event %d", event->user.code); break; default: - SDL_Log("Unknown event %04x", event->type); + SDL_Log("Unknown event 0x%4.4x", event->type); break; } } @@ -1257,19 +1381,19 @@ SDLTest_ScreenShot(SDL_Renderer *renderer) #endif 0x00000000); if (!surface) { - fprintf(stderr, "Couldn't create surface: %s\n", SDL_GetError()); + SDL_Log("Couldn't create surface: %s\n", SDL_GetError()); return; } if (SDL_RenderReadPixels(renderer, NULL, surface->format->format, surface->pixels, surface->pitch) < 0) { - fprintf(stderr, "Couldn't read screen: %s\n", SDL_GetError()); + SDL_Log("Couldn't read screen: %s\n", SDL_GetError()); SDL_free(surface); return; } if (SDL_SaveBMP(surface, "screenshot.bmp") < 0) { - fprintf(stderr, "Couldn't save screenshot.bmp: %s\n", SDL_GetError()); + SDL_Log("Couldn't save screenshot.bmp: %s\n", SDL_GetError()); SDL_free(surface); return; } @@ -1374,6 +1498,49 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) } } break; + case SDLK_UP: + case SDLK_DOWN: + case SDLK_LEFT: + case SDLK_RIGHT: + if (withAlt) { + /* Alt-Up/Down/Left/Right switches between displays */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + int currentIndex = SDL_GetWindowDisplayIndex(window); + int numDisplays = SDL_GetNumVideoDisplays(); + + if (currentIndex >= 0 && numDisplays >= 1) { + int dest; + if (event->key.keysym.sym == SDLK_UP || event->key.keysym.sym == SDLK_LEFT) { + dest = (currentIndex + numDisplays - 1) % numDisplays; + } else { + dest = (currentIndex + numDisplays + 1) % numDisplays; + } + SDL_Log("Centering on display %d\n", dest); + SDL_SetWindowPosition(window, + SDL_WINDOWPOS_CENTERED_DISPLAY(dest), + SDL_WINDOWPOS_CENTERED_DISPLAY(dest)); + } + } + } + if (withShift) { + /* Shift-Up/Down/Left/Right shift the window by 100px */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + const int delta = 100; + int x, y; + SDL_GetWindowPosition(window, &x, &y); + + if (event->key.keysym.sym == SDLK_UP) y -= delta; + if (event->key.keysym.sym == SDLK_DOWN) y += delta; + if (event->key.keysym.sym == SDLK_LEFT) x -= delta; + if (event->key.keysym.sym == SDLK_RIGHT) x += delta; + + SDL_Log("Setting position to (%d, %d)\n", x, y); + SDL_SetWindowPosition(window, x, y); + } + } + break; case SDLK_o: if (withControl) { /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */ @@ -1610,6 +1777,7 @@ SDLTest_CommonQuit(SDLTest_CommonState * state) } SDL_free(state); SDL_Quit(); + SDLTest_LogAllocations(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_compare.c b/Engine/lib/sdl/src/test/SDL_test_compare.c index d06ead9f7..d4e3e71f0 100644 --- a/Engine/lib/sdl/src/test/SDL_test_compare.c +++ b/Engine/lib/sdl/src/test/SDL_test_compare.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,3 +113,5 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, return ret; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_crc32.c b/Engine/lib/sdl/src/test/SDL_test_crc32.c index 6e1220881..ea6b0a85b 100644 --- a/Engine/lib/sdl/src/test/SDL_test_crc32.c +++ b/Engine/lib/sdl/src/test/SDL_test_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,7 +69,6 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext) } /* Complete CRC32 calculation on a memory block */ - int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32) { if (SDLTest_Crc32CalcStart(crcContext,crc32)) { @@ -163,3 +162,5 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext) return 0; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_font.c b/Engine/lib/sdl/src/test/SDL_test_font.c index afd35c6c2..7825cc66f 100644 --- a/Engine/lib/sdl/src/test/SDL_test_font.c +++ b/Engine/lib/sdl/src/test/SDL_test_font.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -3116,9 +3116,9 @@ static SDL_Texture *SDLTest_CharTextureCache[256]; int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) { - const Uint32 charWidth = FONT_CHARACTER_SIZE; - const Uint32 charHeight = FONT_CHARACTER_SIZE; - const Uint32 charSize = FONT_CHARACTER_SIZE; + const Uint32 charWidth = FONT_CHARACTER_SIZE; + const Uint32 charHeight = FONT_CHARACTER_SIZE; + const Uint32 charSize = FONT_CHARACTER_SIZE; SDL_Rect srect; SDL_Rect drect; int result; @@ -3133,16 +3133,16 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) Uint8 r, g, b, a; /* - * Setup source rectangle - */ + * Setup source rectangle + */ srect.x = 0; srect.y = 0; srect.w = charWidth; srect.h = charHeight; /* - * Setup destination rectangle - */ + * Setup destination rectangle + */ drect.x = x; drect.y = y; drect.w = charWidth; @@ -3152,12 +3152,12 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) ci = (unsigned char)c; /* - * Create new charWidth x charHeight bitmap surface if not already present. - */ + * Create new charWidth x charHeight bitmap surface if not already present. + */ if (SDLTest_CharTextureCache[ci] == NULL) { /* - * Redraw character into surface - */ + * Redraw character into surface + */ character = SDL_CreateRGBSurface(SDL_SWSURFACE, charWidth, charHeight, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); @@ -3170,8 +3170,8 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) pitch = character->pitch; /* - * Drawing loop - */ + * Drawing loop + */ patt = 0; for (iy = 0; iy < charWidth; iy++) { mask = 0x00; @@ -3196,24 +3196,24 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) SDL_FreeSurface(character); /* - * Check pointer - */ + * Check pointer + */ if (SDLTest_CharTextureCache[ci] == NULL) { return (-1); } } /* - * Set color - */ + * Set color + */ result = 0; result |= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a); result |= SDL_SetTextureColorMod(SDLTest_CharTextureCache[ci], r, g, b); result |= SDL_SetTextureAlphaMod(SDLTest_CharTextureCache[ci], a); /* - * Draw texture onto destination - */ + * Draw texture onto destination + */ result |= SDL_RenderCopy(renderer, SDLTest_CharTextureCache[ci], &srect, &drect); return (result); @@ -3221,7 +3221,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s) { - const Uint32 charWidth = FONT_CHARACTER_SIZE; + const Uint32 charWidth = FONT_CHARACTER_SIZE; int result = 0; int curx = x; int cury = y; @@ -3236,3 +3236,15 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s) return (result); } +void SDLTest_CleanupTextDrawing(void) +{ + unsigned int i; + for (i = 0; i < SDL_arraysize(SDLTest_CharTextureCache); ++i) { + if (SDLTest_CharTextureCache[i]) { + SDL_DestroyTexture(SDLTest_CharTextureCache[i]); + SDLTest_CharTextureCache[i] = NULL; + } + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_fuzzer.c b/Engine/lib/sdl/src/test/SDL_test_fuzzer.c index 1bd8dfa18..eee56a9fe 100644 --- a/Engine/lib/sdl/src/test/SDL_test_fuzzer.c +++ b/Engine/lib/sdl/src/test/SDL_test_fuzzer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,19 +27,20 @@ #include "SDL_config.h" +#include /* Visual Studio 2008 doesn't have stdint.h */ #if defined(_MSC_VER) && _MSC_VER <= 1500 -#define UINT8_MAX ~(Uint8)0 -#define UINT16_MAX ~(Uint16)0 -#define UINT32_MAX ~(Uint32)0 -#define UINT64_MAX ~(Uint64)0 +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define INT64_MIN _I64_MIN +#define INT64_MAX _I64_MAX +#define UINT64_MAX _UI64_MAX #else -#define _GNU_SOURCE #include #endif #include #include -#include #include #include "SDL_test.h" @@ -125,29 +126,35 @@ SDLTest_RandomUint32() Uint64 SDLTest_RandomUint64() { - Uint64 value = 0; - Uint32 *vp = (void *)&value; + union { + Uint64 v64; + Uint32 v32[2]; + } value; + value.v64 = 0; fuzzerInvocationCounter++; - vp[0] = SDLTest_RandomSint32(); - vp[1] = SDLTest_RandomSint32(); + value.v32[0] = SDLTest_RandomSint32(); + value.v32[1] = SDLTest_RandomSint32(); - return value; + return value.v64; } Sint64 SDLTest_RandomSint64() { - Uint64 value = 0; - Uint32 *vp = (void *)&value; + union { + Uint64 v64; + Uint32 v32[2]; + } value; + value.v64 = 0; fuzzerInvocationCounter++; - vp[0] = SDLTest_RandomSint32(); - vp[1] = SDLTest_RandomSint32(); + value.v32[0] = SDLTest_RandomSint32(); + value.v32[1] = SDLTest_RandomSint32(); - return value; + return (Sint64)value.v64; } @@ -197,7 +204,7 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax) * * \returns Returns a random boundary value for the domain or 0 in case of error */ -Uint64 +static Uint64 SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { Uint64 b1, b2; @@ -298,7 +305,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { /* max value for Uint64 */ - const Uint64 maxValue = ULLONG_MAX; + const Uint64 maxValue = UINT64_MAX; return SDLTest_GenerateUnsignedBoundaryValues(maxValue, (Uint64) boundary1, (Uint64) boundary2, validDomain); @@ -329,7 +336,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v * * \returns Returns a random boundary value for the domain or 0 in case of error */ -Sint64 +static Sint64 SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { Sint64 b1, b2; @@ -434,8 +441,8 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { /* min & max values for Sint64 */ - const Sint64 maxValue = LLONG_MAX; - const Sint64 minValue = LLONG_MIN; + const Sint64 maxValue = INT64_MAX; + const Sint64 minValue = INT64_MIN; return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, boundary1, boundary2, validDomain); @@ -444,7 +451,7 @@ SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool v float SDLTest_RandomUnitFloat() { - return (float) SDLTest_RandomUint32() / UINT_MAX; + return SDLTest_RandomUint32() / (float) UINT_MAX; } float @@ -523,3 +530,5 @@ SDLTest_RandomAsciiStringOfSize(int size) return string; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_harness.c b/Engine/lib/sdl/src/test/SDL_test_harness.c index 4b86c7a0d..15021c6fd 100644 --- a/Engine/lib/sdl/src/test/SDL_test_harness.c +++ b/Engine/lib/sdl/src/test/SDL_test_harness.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,17 +97,17 @@ SDLTest_GenerateRunSeed(const int length) * \returns The generated execution key to initialize the fuzzer with. * */ -Uint64 -SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration) +static Uint64 +SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration) { SDLTest_Md5Context md5Context; Uint64 *keys; char iterationString[16]; - Uint32 runSeedLength; - Uint32 suiteNameLength; - Uint32 testNameLength; - Uint32 iterationStringLength; - Uint32 entireStringLength; + size_t runSeedLength; + size_t suiteNameLength; + size_t testNameLength; + size_t iterationStringLength; + size_t entireStringLength; char *buffer; if (runSeed == NULL || runSeed[0] == '\0') { @@ -150,7 +150,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter /* Hash string and use half of the digest as 64bit exec key */ SDLTest_Md5Init(&md5Context); - SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, entireStringLength); + SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, (unsigned int) entireStringLength); SDLTest_Md5Final(&md5Context); SDL_free(buffer); keys = (Uint64 *)md5Context.digest; @@ -168,7 +168,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter * * \return Timer id or -1 on failure. */ -SDL_TimerID +static SDL_TimerID SDLTest_SetTestTimeout(int timeout, void (*callback)()) { Uint32 timeoutInMilliseconds; @@ -206,8 +206,8 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)()) /** * \brief Timeout handler. Aborts test run and exits harness process. */ -void - SDLTest_BailOut() +static SDL_NORETURN void +SDLTest_BailOut() { SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); exit(TEST_ABORTED); /* bail out from the test */ @@ -223,8 +223,8 @@ void * * \returns Test case result. */ -int -SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun) +static int +SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun) { SDL_TimerID timer = 0; int testCaseResult = 0; @@ -313,7 +313,8 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference } /* Prints summary of all suites/tests contained in the given reference */ -void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) +#if 0 +static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) { int suiteCounter; int testCounter; @@ -340,12 +341,13 @@ void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) } } } +#endif /* Gets a timer value in seconds */ -float GetClock() +static float GetClock() { - float currentClock = (float)clock(); - return currentClock / (float)CLOCKS_PER_SEC; + float currentClock = clock() / (float) CLOCKS_PER_SEC; + return currentClock; } /** @@ -370,7 +372,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user int testCounter; int iterationCounter; SDLTest_TestSuiteReference *testSuite; - SDLTest_TestCaseReference *testCase; + const SDLTest_TestCaseReference *testCase; const char *runSeed = NULL; char *currentSuiteName; char *currentTestName; @@ -396,7 +398,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user Uint32 testPassedCount = 0; Uint32 testSkippedCount = 0; Uint32 countSum = 0; - SDLTest_TestCaseReference **failedTests; + const SDLTest_TestCaseReference **failedTests; /* Sanitize test iterations */ if (testIterations < 1) { @@ -440,7 +442,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user } /* Pre-allocate an array for tracking failed tests (potentially all test cases) */ - failedTests = (SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); + failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); if (failedTests == NULL) { SDLTest_LogError("Unable to allocate cache for failed tests"); SDL_Error(SDL_ENOMEM); @@ -466,7 +468,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user testCounter = 0; while (testSuite->testCases[testCounter] && testFilter == 0) { - testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; + testCase = testSuite->testCases[testCounter]; testCounter++; if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) { /* Matched a test name */ @@ -483,7 +485,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (suiteFilter == 0 && testFilter == 0) { SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter); SDLTest_Log("Exit code: 2"); - SDL_free(failedTests); + SDL_free((void *) failedTests); return 2; } } @@ -521,7 +523,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user testCounter = 0; while(testSuite->testCases[testCounter]) { - testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; + testCase = testSuite->testCases[testCounter]; currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT); testCounter++; @@ -562,7 +564,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (userExecKey != 0) { execKey = userExecKey; } else { - execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter); + execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter); } SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey); @@ -669,8 +671,10 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user SDLTest_Log(" --seed %s --filter %s", runSeed, failedTests[testCounter]->name); } } - SDL_free(failedTests); + SDL_free((void *) failedTests); SDLTest_Log("Exit code: %d", runResult); return runResult; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imageBlit.c b/Engine/lib/sdl/src/test/SDL_test_imageBlit.c index 5896ca099..f5c251a97 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imageBlit.c +++ b/Engine/lib/sdl/src/test/SDL_test_imageBlit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (blit.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageBlit = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlit = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -561,7 +561,7 @@ SDL_Surface *SDLTest_ImageBlit() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1044,7 +1044,7 @@ SDL_Surface *SDLTest_ImageBlitColor() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1555,3 +1555,5 @@ SDL_Surface *SDLTest_ImageBlitAlpha() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c b/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c index 6e8c2f1b4..cf2d4afc1 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c +++ b/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (alpha.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -601,7 +601,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1131,7 +1131,7 @@ SDL_Surface *SDLTest_ImageBlitBlend() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1561,7 +1561,7 @@ SDL_Surface *SDLTest_ImageBlitBlendMod() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { 80, 60, 3, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" @@ -2374,7 +2374,7 @@ SDL_Surface *SDLTest_ImageBlitBlendNone() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -2841,3 +2841,5 @@ SDL_Surface *SDLTest_ImageBlitBlendAll() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imageFace.c b/Engine/lib/sdl/src/test/SDL_test_imageFace.c index 84f5037f4..9b436378d 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imageFace.c +++ b/Engine/lib/sdl/src/test/SDL_test_imageFace.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGBA C-Source image dump (face.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageFace = { +static const SDLTest_SurfaceImage_t SDLTest_imageFace = { 32, 32, 4, "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" @@ -244,3 +244,4 @@ SDL_Surface *SDLTest_ImageFace() return surface; } +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c b/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c index 4ab48d2de..17597c614 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c +++ b/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (primitives.c) */ -const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { +static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { 80, 60, 3, "\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -510,3 +510,5 @@ SDL_Surface *SDLTest_ImagePrimitives() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c b/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c index 5e538628e..aa5066261 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c +++ b/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (alpha.c) */ -const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { +static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { 80, 60, 3, "\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321" ",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377" @@ -692,3 +692,5 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_log.c b/Engine/lib/sdl/src/test/SDL_test_log.c index a2f857f26..5d6ff2425 100644 --- a/Engine/lib/sdl/src/test/SDL_test_log.c +++ b/Engine/lib/sdl/src/test/SDL_test_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,9 @@ */ /* quiet windows compiler warnings */ -#define _CRT_SECURE_NO_WARNINGS +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS +#endif #include "SDL_config.h" @@ -39,6 +41,19 @@ #include "SDL_test.h" +/* work around compiler warning on older GCCs. */ +#if (defined(__GNUC__) && (__GNUC__ <= 2)) +static size_t +strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm) +{ + return strftime(s, max, fmt, tm); +} +#ifdef strftime +#undef strftime +#endif +#define strftime strftime_gcc2_workaround +#endif + /* ! * Converts unix timestamp to its ascii representation in localtime * @@ -50,7 +65,7 @@ * * \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02' */ -char *SDLTest_TimestampToString(const time_t timestamp) +static char *SDLTest_TimestampToString(const time_t timestamp) { time_t copy; static char buffer[64]; @@ -99,3 +114,5 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) /* Log with timestamp and newline */ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_md5.c b/Engine/lib/sdl/src/test/SDL_test_md5.c index 7cc356757..c0d05a492 100644 --- a/Engine/lib/sdl/src/test/SDL_test_md5.c +++ b/Engine/lib/sdl/src/test/SDL_test_md5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -334,3 +334,5 @@ static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in) buf[2] += c; buf[3] += d; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_memory.c b/Engine/lib/sdl/src/test/SDL_test_memory.c new file mode 100644 index 000000000..6ce72f64d --- /dev/null +++ b/Engine/lib/sdl/src/test/SDL_test_memory.c @@ -0,0 +1,274 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" +#include "SDL_assert.h" +#include "SDL_stdinc.h" +#include "SDL_log.h" +#include "SDL_test_crc32.h" +#include "SDL_test_memory.h" + +#ifdef HAVE_LIBUNWIND_H +#include +#endif + +/* This is a simple tracking allocator to demonstrate the use of SDL's + memory allocation replacement functionality. + + It gets slow with large numbers of allocations and shouldn't be used + for production code. +*/ + +typedef struct SDL_tracked_allocation +{ + void *mem; + size_t size; + Uint64 stack[10]; + char stack_names[10][256]; + struct SDL_tracked_allocation *next; +} SDL_tracked_allocation; + +static SDLTest_Crc32Context s_crc32_context; +static SDL_malloc_func SDL_malloc_orig = NULL; +static SDL_calloc_func SDL_calloc_orig = NULL; +static SDL_realloc_func SDL_realloc_orig = NULL; +static SDL_free_func SDL_free_orig = NULL; +static int s_previous_allocations = 0; +static SDL_tracked_allocation *s_tracked_allocations[256]; + +static unsigned int get_allocation_bucket(void *mem) +{ + CrcUint32 crc_value; + unsigned int index; + SDLTest_Crc32Calc(&s_crc32_context, (CrcUint8 *)&mem, sizeof(mem), &crc_value); + index = (crc_value & (SDL_arraysize(s_tracked_allocations) - 1)); + return index; +} + +static SDL_bool SDL_IsAllocationTracked(void *mem) +{ + SDL_tracked_allocation *entry; + int index = get_allocation_bucket(mem); + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + if (mem == entry->mem) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void SDL_TrackAllocation(void *mem, size_t size) +{ + SDL_tracked_allocation *entry; + int index = get_allocation_bucket(mem); + + if (SDL_IsAllocationTracked(mem)) { + return; + } + entry = (SDL_tracked_allocation *)SDL_malloc_orig(sizeof(*entry)); + if (!entry) { + return; + } + entry->mem = mem; + entry->size = size; + + /* Generate the stack trace for the allocation */ + SDL_zero(entry->stack); +#ifdef HAVE_LIBUNWIND_H + { + int stack_index; + unw_cursor_t cursor; + unw_context_t context; + + unw_getcontext(&context); + unw_init_local(&cursor, &context); + + stack_index = 0; + while (unw_step(&cursor) > 0) { + unw_word_t offset, pc; + char sym[256]; + + unw_get_reg(&cursor, UNW_REG_IP, &pc); + entry->stack[stack_index] = pc; + + if (unw_get_proc_name(&cursor, sym, sizeof(sym), &offset) == 0) { + snprintf(entry->stack_names[stack_index], sizeof(entry->stack_names[stack_index]), "%s+0x%llx", sym, offset); + } + ++stack_index; + + if (stack_index == SDL_arraysize(entry->stack)) { + break; + } + } + } +#endif /* HAVE_LIBUNWIND_H */ + + entry->next = s_tracked_allocations[index]; + s_tracked_allocations[index] = entry; +} + +static void SDL_UntrackAllocation(void *mem) +{ + SDL_tracked_allocation *entry, *prev; + int index = get_allocation_bucket(mem); + + prev = NULL; + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + if (mem == entry->mem) { + if (prev) { + prev->next = entry->next; + } else { + s_tracked_allocations[index] = entry->next; + } + SDL_free_orig(entry); + return; + } + prev = entry; + } +} + +static void * SDLCALL SDLTest_TrackedMalloc(size_t size) +{ + void *mem; + + mem = SDL_malloc_orig(size); + if (mem) { + SDL_TrackAllocation(mem, size); + } + return mem; +} + +static void * SDLCALL SDLTest_TrackedCalloc(size_t nmemb, size_t size) +{ + void *mem; + + mem = SDL_calloc_orig(nmemb, size); + if (mem) { + SDL_TrackAllocation(mem, nmemb * size); + } + return mem; +} + +static void * SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size) +{ + void *mem; + + SDL_assert(!ptr || SDL_IsAllocationTracked(ptr)); + mem = SDL_realloc_orig(ptr, size); + if (mem && mem != ptr) { + if (ptr) { + SDL_UntrackAllocation(ptr); + } + SDL_TrackAllocation(mem, size); + } + return mem; +} + +static void SDLCALL SDLTest_TrackedFree(void *ptr) +{ + if (!ptr) { + return; + } + + if (!s_previous_allocations) { + SDL_assert(SDL_IsAllocationTracked(ptr)); + } + SDL_UntrackAllocation(ptr); + SDL_free_orig(ptr); +} + +int SDLTest_TrackAllocations() +{ + if (SDL_malloc_orig) { + return 0; + } + + SDLTest_Crc32Init(&s_crc32_context); + + s_previous_allocations = SDL_GetNumAllocations(); + if (s_previous_allocations != 0) { + SDL_Log("SDLTest_TrackAllocations(): There are %d previous allocations, disabling free() validation", s_previous_allocations); + } + + SDL_GetMemoryFunctions(&SDL_malloc_orig, + &SDL_calloc_orig, + &SDL_realloc_orig, + &SDL_free_orig); + + SDL_SetMemoryFunctions(SDLTest_TrackedMalloc, + SDLTest_TrackedCalloc, + SDLTest_TrackedRealloc, + SDLTest_TrackedFree); + return 0; +} + +void SDLTest_LogAllocations() +{ + char *message = NULL; + size_t message_size = 0; + char line[128], *tmp; + SDL_tracked_allocation *entry; + int index, count, stack_index; + Uint64 total_allocated; + + if (!SDL_malloc_orig) { + return; + } + +#define ADD_LINE() \ + message_size += (SDL_strlen(line) + 1); \ + tmp = (char *)SDL_realloc_orig(message, message_size); \ + if (!tmp) { \ + return; \ + } \ + message = tmp; \ + SDL_strlcat(message, line, message_size) + + SDL_strlcpy(line, "Memory allocations:\n", sizeof(line)); + ADD_LINE(); + SDL_strlcpy(line, "Expect 2 allocations from within SDL_GetErrBuf()\n", sizeof(line)); + ADD_LINE(); + + count = 0; + total_allocated = 0; + for (index = 0; index < SDL_arraysize(s_tracked_allocations); ++index) { + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + SDL_snprintf(line, sizeof(line), "Allocation %d: %d bytes\n", count, (int)entry->size); + ADD_LINE(); + /* Start at stack index 1 to skip our tracking functions */ + for (stack_index = 1; stack_index < SDL_arraysize(entry->stack); ++stack_index) { + if (!entry->stack[stack_index]) { + break; + } + SDL_snprintf(line, sizeof(line), "\t0x%"SDL_PRIx64": %s\n", entry->stack[stack_index], entry->stack_names[stack_index]); + ADD_LINE(); + } + total_allocated += entry->size; + ++count; + } + } + SDL_snprintf(line, sizeof(line), "Total: %.2f Kb in %d allocations\n", (float)total_allocated / 1024, count); + ADD_LINE(); +#undef ADD_LINE + + SDL_Log("%s", message); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_random.c b/Engine/lib/sdl/src/test/SDL_test_random.c index c5baaa640..9e0f1df57 100644 --- a/Engine/lib/sdl/src/test/SDL_test_random.c +++ b/Engine/lib/sdl/src/test/SDL_test_random.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -70,7 +70,7 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext) srand((unsigned int)time(NULL)); a=rand(); - srand(clock()); + srand((unsigned int)clock()); b=rand(); SDLTest_RandomInit(rndContext, a, b); } @@ -92,3 +92,5 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext) rndContext->c++; return (rndContext->x); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/SDL_systhread.h b/Engine/lib/sdl/src/thread/SDL_systhread.h index 05a012536..1862b239b 100644 --- a/Engine/lib/sdl/src/thread/SDL_systhread.h +++ b/Engine/lib/sdl/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,8 +22,8 @@ /* These are functions that need to be implemented by a port of SDL */ -#ifndef _SDL_systhread_h -#define _SDL_systhread_h +#ifndef SDL_systhread_h_ +#define SDL_systhread_h_ #include "SDL_thread.h" #include "SDL_thread_c.h" @@ -55,7 +55,7 @@ extern void SDL_SYS_WaitThread(SDL_Thread * thread); extern void SDL_SYS_DetachThread(SDL_Thread * thread); /* Get the thread local storage for this thread */ -extern SDL_TLSData *SDL_SYS_GetTLSData(); +extern SDL_TLSData *SDL_SYS_GetTLSData(void); /* Set the thread local storage for this thread */ extern int SDL_SYS_SetTLSData(SDL_TLSData *data); @@ -65,6 +65,6 @@ extern SDL_Thread * SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name, const size_t stacksize, void *data); -#endif /* _SDL_systhread_h */ +#endif /* SDL_systhread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/SDL_thread.c b/Engine/lib/sdl/src/thread/SDL_thread.c index ae865790a..84b72d577 100644 --- a/Engine/lib/sdl/src/thread/SDL_thread.c +++ b/Engine/lib/sdl/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,7 +50,7 @@ SDL_TLSGet(SDL_TLSID id) } int -SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void *)) +SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *)) { SDL_TLSData *storage; @@ -121,7 +121,7 @@ static SDL_TLSEntry *SDL_generic_TLS; SDL_TLSData * -SDL_Generic_GetTLSData() +SDL_Generic_GetTLSData(void) { SDL_threadID thread = SDL_ThreadID(); SDL_TLSEntry *entry; diff --git a/Engine/lib/sdl/src/thread/SDL_thread_c.h b/Engine/lib/sdl/src/thread/SDL_thread_c.h index 554325d6d..b68f90e91 100644 --- a/Engine/lib/sdl/src/thread/SDL_thread_c.h +++ b/Engine/lib/sdl/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_thread_c_h -#define _SDL_thread_c_h +#ifndef SDL_thread_c_h_ +#define SDL_thread_c_h_ #include "SDL_thread.h" @@ -71,7 +71,7 @@ typedef struct { unsigned int limit; struct { void *data; - void (*destructor)(void*); + void (SDLCALL *destructor)(void*); } array[1]; } SDL_TLSData; @@ -82,7 +82,7 @@ typedef struct { This is only intended as a fallback if getting real thread-local storage fails or isn't supported on this platform. */ -extern SDL_TLSData *SDL_Generic_GetTLSData(); +extern SDL_TLSData *SDL_Generic_GetTLSData(void); /* Set cross-platform, slow, thread local storage for this thread. This is only intended as a fallback if getting real thread-local @@ -90,6 +90,6 @@ extern SDL_TLSData *SDL_Generic_GetTLSData(); */ extern int SDL_Generic_SetTLSData(SDL_TLSData *data); -#endif /* _SDL_thread_c_h */ +#endif /* SDL_thread_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/generic/SDL_syscond.c b/Engine/lib/sdl/src/thread/generic/SDL_syscond.c index e2ccd88ef..34b9893b3 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_syscond.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c index f2f668970..df78ca9ed 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h index 9dba5e16c..2979437b5 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_syssem.c b/Engine/lib/sdl/src/thread/generic/SDL_syssem.c index 92afcb0c0..30ff82441 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_systhread.c b/Engine/lib/sdl/src/thread/generic/SDL_systhread.c index 7a81a6201..7a19b781c 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h index ea9b71460..13db579d0 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_systls.c b/Engine/lib/sdl/src/thread/generic/SDL_systls.c index e29c19818..241862e83 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_systls.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { return SDL_Generic_GetTLSData(); } diff --git a/Engine/lib/sdl/src/thread/psp/SDL_syscond.c b/Engine/lib/sdl/src/thread/psp/SDL_syscond.c index a84b206c8..4ed73e0ec 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_syscond.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c index 78129fa69..e2db5eb11 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h index 9dba5e16c..2979437b5 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_syssem.c b/Engine/lib/sdl/src/thread/psp/SDL_syssem.c index 643406c46..0c3643409 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -108,7 +108,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) case SCE_KERNEL_ERROR_WAIT_TIMEOUT: return SDL_MUTEX_TIMEDOUT; default: - return SDL_SetError("WaitForSingleObject() failed"); + return SDL_SetError("sceKernelWaitSema() failed"); } } diff --git a/Engine/lib/sdl/src/thread/psp/SDL_systhread.c b/Engine/lib/sdl/src/thread/psp/SDL_systhread.c index c6003b8ed..9286be59e 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h index 4f74df06a..ea26f81d2 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c b/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c index 998ac55b3..d23578038 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ SDL_CreateCond(void) cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond)); if (cond) { - if (pthread_cond_init(&cond->cond, NULL) < 0) { + if (pthread_cond_init(&cond->cond, NULL) != 0) { SDL_SetError("pthread_cond_init() failed"); SDL_free(cond); cond = NULL; @@ -129,7 +129,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) switch (retval) { case EINTR: goto tryagain; - break; + /* break; -Wunreachable-code-break */ case ETIMEDOUT: retval = SDL_MUTEX_TIMEDOUT; break; diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c index f24cfdab0..e7b5b5cec 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,6 @@ */ #include "../../SDL_internal.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include @@ -108,7 +105,7 @@ SDL_LockMutex(SDL_mutex * mutex) } } #else - if (pthread_mutex_lock(&mutex->id) < 0) { + if (pthread_mutex_lock(&mutex->id) != 0) { return SDL_SetError("pthread_mutex_lock() failed"); } #endif @@ -137,7 +134,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) We set the locking thread id after we obtain the lock so unlocks from other threads will fail. */ - if (pthread_mutex_lock(&mutex->id) == 0) { + if (pthread_mutex_trylock(&mutex->id) == 0) { mutex->owner = this_thread; mutex->recursive = 0; } else if (errno == EBUSY) { @@ -184,7 +181,7 @@ SDL_UnlockMutex(SDL_mutex * mutex) } #else - if (pthread_mutex_unlock(&mutex->id) < 0) { + if (pthread_mutex_unlock(&mutex->id) != 0) { return SDL_SetError("pthread_mutex_unlock() failed"); } #endif /* FAKE_RECURSIVE_MUTEX */ diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h index ee60ca041..27ac1da61 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_mutex_c_h -#define _SDL_mutex_c_h +#ifndef SDL_mutex_c_h_ +#define SDL_mutex_c_h_ struct SDL_mutex { pthread_mutex_t id; }; -#endif /* _SDL_mutex_c_h */ +#endif /* SDL_mutex_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c b/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c index b7547e699..bdebf1311 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,6 @@ */ #include "../../SDL_internal.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include #include @@ -94,7 +91,10 @@ SDL_SemWait(SDL_sem * sem) return SDL_SetError("Passed a NULL semaphore"); } - retval = sem_wait(&sem->sem); + do { + retval = sem_wait(&sem->sem); + } while (retval < 0 && errno == EINTR); + if (retval < 0) { retval = SDL_SetError("sem_wait() failed"); } diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c b/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c index 4958f6fb9..035484085 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ #endif #ifdef __HAIKU__ -#include +#include #endif #include "SDL_assert.h" @@ -212,7 +212,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) int policy; pthread_t thread = pthread_self(); - if (pthread_getschedparam(thread, &policy, &sched) < 0) { + if (pthread_getschedparam(thread, &policy, &sched) != 0) { return SDL_SetError("pthread_getschedparam() failed"); } if (priority == SDL_THREAD_PRIORITY_LOW) { @@ -224,7 +224,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) int max_priority = sched_get_priority_max(policy); sched.sched_priority = (min_priority + (max_priority - min_priority) / 2); } - if (pthread_setschedparam(thread, policy, &sched) < 0) { + if (pthread_setschedparam(thread, policy, &sched) != 0) { return SDL_SetError("pthread_setschedparam() failed"); } return 0; diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h index 4ad188443..898c219fd 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_systls.c b/Engine/lib/sdl/src/thread/pthread/SDL_systls.c index 622ad0297..c580595bd 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_systls.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ */ #include "../../SDL_internal.h" #include "SDL_thread.h" +#include "../SDL_systhread.h" #include "../SDL_thread_c.h" #include @@ -31,7 +32,7 @@ static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY; static SDL_bool generic_local_storage = SDL_FALSE; SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) { static SDL_SpinLock lock; diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp b/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp index 976bff487..32c7c4bc3 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp index 04028627d..667d36b48 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h index ab0f2dd83..000288f29 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp index 6e5ef473e..3020f1c1b 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -153,7 +153,7 @@ SDL_SYS_DetachThread(SDL_Thread * thread) extern "C" SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { return SDL_Generic_GetTLSData(); } diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h index c3cc507c3..ee4764de6 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c index 413cb6703..119e62b67 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/windows/SDL_syssem.c b/Engine/lib/sdl/src/thread/windows/SDL_syssem.c index 86b58882d..dcb36fa0f 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,11 +90,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) } else { dwMilliseconds = (DWORD) timeout; } -#if __WINRT__ switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) { -#else - switch (WaitForSingleObject(sem->id, dwMilliseconds)) { -#endif case WAIT_OBJECT_0: InterlockedDecrement(&sem->count); retval = 0; diff --git a/Engine/lib/sdl/src/thread/windows/SDL_systhread.c b/Engine/lib/sdl/src/thread/windows/SDL_systhread.c index 20a4bd6e2..90036c920 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -164,26 +164,55 @@ typedef struct tagTHREADNAME_INFO } THREADNAME_INFO; #pragma pack(pop) + +typedef HRESULT (WINAPI *pfnSetThreadDescription)(HANDLE, PCWSTR); + void SDL_SYS_SetupThread(const char *name) { - if ((name != NULL) && IsDebuggerPresent()) { - THREADNAME_INFO inf; + if (name != NULL) { + #ifndef __WINRT__ /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */ + static pfnSetThreadDescription pSetThreadDescription = NULL; + static HMODULE kernel32 = 0; - /* C# and friends will try to catch this Exception, let's avoid it. */ - if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_FALSE)) { - return; + if (!kernel32) { + kernel32 = LoadLibraryW(L"kernel32.dll"); + if (kernel32) { + pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription"); + } } - /* This magic tells the debugger to name a thread if it's listening. */ - SDL_zero(inf); - inf.dwType = 0x1000; - inf.szName = name; - inf.dwThreadID = (DWORD) -1; - inf.dwFlags = 0; + if (pSetThreadDescription != NULL) { + WCHAR *strw = WIN_UTF8ToString(name); + if (strw) { + pSetThreadDescription(GetCurrentThread(), strw); + SDL_free(strw); + } + } + #endif - /* The debugger catches this, renames the thread, continues on. */ - RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf); + /* Presumably some version of Visual Studio will understand SetThreadDescription(), + but we still need to deal with older OSes and debuggers. Set it with the arcane + exception magic, too. */ + + if (IsDebuggerPresent()) { + THREADNAME_INFO inf; + + /* C# and friends will try to catch this Exception, let's avoid it. */ + if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_TRUE)) { + return; + } + + /* This magic tells the debugger to name a thread if it's listening. */ + SDL_zero(inf); + inf.dwType = 0x1000; + inf.szName = name; + inf.dwThreadID = (DWORD) -1; + inf.dwFlags = 0; + + /* The debugger catches this, renames the thread, continues on. */ + RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf); + } } } diff --git a/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h index 90866a7bb..65d5a1b8c 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_systhread_c_h -#define _SDL_systhread_c_h +#ifndef SDL_systhread_c_h_ +#define SDL_systhread_c_h_ #include "../../core/windows/SDL_windows.h" typedef HANDLE SYS_ThreadHandle; -#endif /* _SDL_systhread_c_h */ +#endif /* SDL_systhread_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/windows/SDL_systls.c b/Engine/lib/sdl/src/thread/windows/SDL_systls.c index 7ec630e8f..888fd747a 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_systls.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ static DWORD thread_local_storage = TLS_OUT_OF_INDEXES; static SDL_bool generic_local_storage = SDL_FALSE; SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) { static SDL_SpinLock lock; diff --git a/Engine/lib/sdl/src/timer/SDL_timer.c b/Engine/lib/sdl/src/timer/SDL_timer.c index abe968e86..f4a13f4bd 100644 --- a/Engine/lib/sdl/src/timer/SDL_timer.c +++ b/Engine/lib/sdl/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,7 +97,7 @@ SDL_AddTimerInternal(SDL_TimerData *data, SDL_Timer *timer) timer->next = curr; } -static int +static int SDLCALL SDL_TimerThread(void *_data) { SDL_TimerData *data = (SDL_TimerData *)_data; @@ -168,6 +168,7 @@ SDL_TimerThread(void *_data) if (interval > 0) { /* Reschedule this timer */ + current->interval = interval; current->scheduled = tick + interval; SDL_AddTimerInternal(data, current); } else { diff --git a/Engine/lib/sdl/src/timer/SDL_timer_c.h b/Engine/lib/sdl/src/timer/SDL_timer_c.h index 6ae817058..f83bdded0 100644 --- a/Engine/lib/sdl/src/timer/SDL_timer_c.h +++ b/Engine/lib/sdl/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c b/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c index 1174d2241..aff145b29 100644 --- a/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c b/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c index f45aa64d7..16f49c05c 100644 --- a/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #ifdef SDL_TIMER_HAIKU -#include +#include #include "SDL_timer.h" diff --git a/Engine/lib/sdl/src/timer/psp/SDL_systimer.c b/Engine/lib/sdl/src/timer/psp/SDL_systimer.c index 1e8802cf1..e39d8007f 100644 --- a/Engine/lib/sdl/src/timer/psp/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/psp/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/timer/unix/SDL_systimer.c b/Engine/lib/sdl/src/timer/unix/SDL_systimer.c index 217fe327f..5045996f3 100644 --- a/Engine/lib/sdl/src/timer/unix/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_timer.h" #include "SDL_assert.h" +#include "../SDL_timer_c.h" /* The clock_gettime provides monotonous time, so we should use it if it's available. The clock_gettime function is behind ifdef diff --git a/Engine/lib/sdl/src/timer/windows/SDL_systimer.c b/Engine/lib/sdl/src/timer/windows/SDL_systimer.c index 5c9121a51..3f5413b26 100644 --- a/Engine/lib/sdl/src/timer/windows/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -60,7 +60,7 @@ SDL_SetSystemTimerResolution(const UINT uPeriod) #endif } -static void +static void SDLCALL SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { UINT uPeriod; diff --git a/Engine/lib/sdl/src/video/SDL_RLEaccel.c b/Engine/lib/sdl/src/video/SDL_RLEaccel.c index 67baaf664..661cb1f53 100644 --- a/Engine/lib/sdl/src/video/SDL_RLEaccel.c +++ b/Engine/lib/sdl/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,9 +90,6 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif @@ -448,7 +445,7 @@ RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst, /* blit a colorkeyed RLE surface */ -int +int SDLCALL SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_Surface * surf_dst, SDL_Rect * dstrect) { @@ -726,7 +723,7 @@ RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst, } /* blit a pixel-alpha RLE surface */ -int +int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_Surface * surf_dst, SDL_Rect * dstrect) { @@ -1280,7 +1277,7 @@ RLEColorkeySurface(SDL_Surface * surface) int y; Uint8 *srcbuf, *lastline; int maxsize = 0; - int bpp = surface->format->BytesPerPixel; + const int bpp = surface->format->BytesPerPixel; getpix_func getpix; Uint32 ckey, rgbmask; int w, h; @@ -1303,6 +1300,9 @@ RLEColorkeySurface(SDL_Surface * surface) maxsize = surface->h * (4 * (surface->w / 65535 + 1) + surface->w * 4) + 4; break; + + default: + return -1; } rlebuf = (Uint8 *) SDL_malloc(maxsize); @@ -1396,7 +1396,7 @@ RLEColorkeySurface(SDL_Surface * surface) surface->map->data = p; } - return (0); + return 0; } int diff --git a/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h b/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h index c04fc1527..fe418358b 100644 --- a/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h +++ b/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,9 +23,9 @@ /* Useful functions and variables from SDL_RLEaccel.c */ extern int SDL_RLESurface(SDL_Surface * surface); -extern int SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); -extern int SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); +extern int SDLCALL SDL_RLEBlit (SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); +extern int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); extern void SDL_UnRLESurface(SDL_Surface * surface, int recode); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_blit.c b/Engine/lib/sdl/src/video/SDL_blit.c index 90aa87898..0d4e2fdb9 100644 --- a/Engine/lib/sdl/src/video/SDL_blit.c +++ b/Engine/lib/sdl/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ #include "SDL_pixels_c.h" /* The general purpose software blit routine */ -static int +static int SDLCALL SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect) { @@ -219,6 +219,12 @@ SDL_CalculateBlit(SDL_Surface * surface) SDL_BlitMap *map = surface->map; SDL_Surface *dst = map->dst; + /* We don't currently support blitting to < 8 bpp surfaces */ + if (dst->format->BitsPerPixel < 8) { + SDL_InvalidateMap(map); + return SDL_SetError("Blit combination not supported"); + } + /* Clean everything out to start */ if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { SDL_UnRLESurface(surface, 1); @@ -239,6 +245,10 @@ SDL_CalculateBlit(SDL_Surface * surface) /* Choose a standard blit function */ if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) { blit = SDL_BlitCopy; + } else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) { + /* Greater than 8 bits per channel not supported yet */ + SDL_InvalidateMap(map); + return SDL_SetError("Blit combination not supported"); } else if (surface->format->BitsPerPixel < 8 && SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { blit = SDL_CalculateBlit0(surface); diff --git a/Engine/lib/sdl/src/video/SDL_blit.h b/Engine/lib/sdl/src/video/SDL_blit.h index e30f8afec..ca1053445 100644 --- a/Engine/lib/sdl/src/video/SDL_blit.h +++ b/Engine/lib/sdl/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_blit_h -#define _SDL_blit_h +#ifndef SDL_blit_h_ +#define SDL_blit_h_ #include "SDL_cpuinfo.h" #include "SDL_endian.h" @@ -70,7 +70,8 @@ typedef struct Uint8 r, g, b, a; } SDL_BlitInfo; -typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info); +typedef void (*SDL_BlitFunc) (SDL_BlitInfo *info); + typedef struct { @@ -443,19 +444,19 @@ do { \ /* Blend the RGB values of two pixels with an alpha value */ #define ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB) \ do { \ - dR = ((((unsigned)(sR-dR)*(unsigned)A)/255)+dR); \ - dG = ((((unsigned)(sG-dG)*(unsigned)A)/255)+dG); \ - dB = ((((unsigned)(sB-dB)*(unsigned)A)/255)+dB); \ + dR = (Uint8)((((int)(sR-dR)*(int)A)/255)+dR); \ + dG = (Uint8)((((int)(sG-dG)*(int)A)/255)+dG); \ + dB = (Uint8)((((int)(sB-dB)*(int)A)/255)+dB); \ } while(0) /* Blend the RGBA values of two pixels */ #define ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA) \ do { \ - dR = ((((unsigned)(sR-dR)*(unsigned)sA)/255)+dR); \ - dG = ((((unsigned)(sG-dG)*(unsigned)sA)/255)+dG); \ - dB = ((((unsigned)(sB-dB)*(unsigned)sA)/255)+dB); \ - dA = ((unsigned)sA+(unsigned)dA-((unsigned)sA*dA)/255); \ + dR = (Uint8)((((int)(sR-dR)*(int)sA)/255)+dR); \ + dG = (Uint8)((((int)(sG-dG)*(int)sA)/255)+dG); \ + dB = (Uint8)((((int)(sB-dB)*(int)sA)/255)+dB); \ + dA = (Uint8)((int)sA+dA-((int)sA*dA)/255); \ } while(0) @@ -471,14 +472,14 @@ do { \ #define DUFFS_LOOP8(pixel_copy_increment, width) \ { int n = (width+7)/8; \ switch (width & 7) { \ - case 0: do { pixel_copy_increment; \ - case 7: pixel_copy_increment; \ - case 6: pixel_copy_increment; \ - case 5: pixel_copy_increment; \ - case 4: pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ + case 0: do { pixel_copy_increment; /* fallthrough */ \ + case 7: pixel_copy_increment; /* fallthrough */ \ + case 6: pixel_copy_increment; /* fallthrough */ \ + case 5: pixel_copy_increment; /* fallthrough */ \ + case 4: pixel_copy_increment; /* fallthrough */ \ + case 3: pixel_copy_increment; /* fallthrough */ \ + case 2: pixel_copy_increment; /* fallthrough */ \ + case 1: pixel_copy_increment; /* fallthrough */ \ } while ( --n > 0 ); \ } \ } @@ -487,10 +488,10 @@ do { \ #define DUFFS_LOOP4(pixel_copy_increment, width) \ { int n = (width+3)/4; \ switch (width & 3) { \ - case 0: do { pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ + case 0: do { pixel_copy_increment; /* fallthrough */ \ + case 3: pixel_copy_increment; /* fallthrough */ \ + case 2: pixel_copy_increment; /* fallthrough */ \ + case 1: pixel_copy_increment; /* fallthrough */ \ } while (--n > 0); \ } \ } @@ -547,6 +548,6 @@ do { \ #pragma warning(disable: 4550) #endif -#endif /* _SDL_blit_h */ +#endif /* SDL_blit_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_blit_0.c b/Engine/lib/sdl/src/video/SDL_blit_0.c index fe7330d78..b5c8efb3c 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_0.c +++ b/Engine/lib/sdl/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_1.c b/Engine/lib/sdl/src/video/SDL_blit_1.c index 69c15d08d..b7c5412ee 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_1.c +++ b/Engine/lib/sdl/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -70,12 +70,14 @@ Blit1to1(SDL_BlitInfo * info) } /* This is now endian dependent */ -#if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) -#define HI 1 -#define LO 0 -#else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ -#define HI 0 -#define LO 1 +#ifndef USE_DUFFS_LOOP +# if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) +# define HI 1 +# define LO 0 +# else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ +# define HI 0 +# define LO 1 +# endif #endif static void Blit1to2(SDL_BlitInfo * info) diff --git a/Engine/lib/sdl/src/video/SDL_blit_A.c b/Engine/lib/sdl/src/video/SDL_blit_A.c index 0190ffddd..1e9c9d89b 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_A.c +++ b/Engine/lib/sdl/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1317,9 +1317,9 @@ SDL_CalculateBlitA(SDL_Surface * surface) case 3: default: - return BlitNtoNPixelAlpha; + break; } - break; + return BlitNtoNPixelAlpha; case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: if (sf->Amask == 0) { diff --git a/Engine/lib/sdl/src/video/SDL_blit_N.c b/Engine/lib/sdl/src/video/SDL_blit_N.c index 94894a78c..441cd9a21 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_N.c +++ b/Engine/lib/sdl/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,12 +118,6 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 16, 8, 0, 24, 0, NULL }; - if (!srcfmt) { - srcfmt = &default_pixel_format; - } - if (!dstfmt) { - dstfmt = &default_pixel_format; - } const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, @@ -131,11 +125,20 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 0x0C); vector unsigned char vswiz; vector unsigned int srcvec; + Uint32 rmask, gmask, bmask, amask; + + if (!srcfmt) { + srcfmt = &default_pixel_format; + } + if (!dstfmt) { + dstfmt = &default_pixel_format; + } + #define RESHIFT(X) (3 - ((X) >> 3)) - Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); - Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); - Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); - Uint32 amask; + rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); + gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); + bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); + /* Use zero for alpha if either surface doesn't have alpha */ if (dstfmt->Amask) { amask = @@ -147,6 +150,7 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 0xFFFFFFFF); } #undef RESHIFT + ((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask); vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0)); return (vswiz); @@ -1109,6 +1113,7 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) (((*src)&0x0000F800)>>6)| \ (((*src)&0x000000F8)>>3)); \ } +#ifndef USE_DUFFS_LOOP #define RGB888_RGB555_TWO(dst, src) { \ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \ (((src[HI])&0x0000F800)>>6)| \ @@ -1117,6 +1122,7 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) (((src[LO])&0x0000F800)>>6)| \ (((src[LO])&0x000000F8)>>3); \ } +#endif static void Blit_RGB888_RGB555(SDL_BlitInfo * info) { @@ -1233,6 +1239,7 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) (((*src)&0x0000FC00)>>5)| \ (((*src)&0x000000F8)>>3)); \ } +#ifndef USE_DUFFS_LOOP #define RGB888_RGB565_TWO(dst, src) { \ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \ (((src[HI])&0x0000FC00)>>5)| \ @@ -1241,6 +1248,7 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) (((src[LO])&0x0000FC00)>>5)| \ (((src[LO])&0x000000F8)>>3); \ } +#endif static void Blit_RGB888_RGB565(SDL_BlitInfo * info) { @@ -2455,6 +2463,9 @@ BlitNto2101010(SDL_BlitInfo * info) } /* Normal N to N optimized blitters */ +#define NO_ALPHA 1 +#define SET_ALPHA 2 +#define COPY_ALPHA 4 struct blit_table { Uint32 srcR, srcG, srcB; @@ -2462,8 +2473,7 @@ struct blit_table Uint32 dstR, dstG, dstB; Uint32 blit_features; SDL_BlitFunc blitfunc; - enum - { NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha; + Uint32 alpha; /* bitwise NO_ALPHA, SET_ALPHA, COPY_ALPHA */ }; static const struct blit_table normal_blit_1[] = { /* Default for 8-bit RGB source, never optimized */ diff --git a/Engine/lib/sdl/src/video/SDL_blit_auto.c b/Engine/lib/sdl/src/video/SDL_blit_auto.c index f12281913..d9d266f9b 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_auto.c +++ b/Engine/lib/sdl/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_auto.h b/Engine/lib/sdl/src/video/SDL_blit_auto.h index 58a532db0..41a6a3208 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_auto.h +++ b/Engine/lib/sdl/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_copy.c b/Engine/lib/sdl/src/video/SDL_blit_copy.c index 674650dd9..e86289845 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_copy.c +++ b/Engine/lib/sdl/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_copy.h b/Engine/lib/sdl/src/video/SDL_blit_copy.h index 060026d8a..46651791e 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_copy.h +++ b/Engine/lib/sdl/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_slow.c b/Engine/lib/sdl/src/video/SDL_blit_slow.c index 02ab41de7..20ca8ab81 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_slow.c +++ b/Engine/lib/sdl/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_slow.h b/Engine/lib/sdl/src/video/SDL_blit_slow.h index 75005fc53..02d360a6e 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_slow.h +++ b/Engine/lib/sdl/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_bmp.c b/Engine/lib/sdl/src/video/SDL_bmp.c index 2d9cf240b..ba908a659 100644 --- a/Engine/lib/sdl/src/video/SDL_bmp.c +++ b/Engine/lib/sdl/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -124,6 +124,9 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) Uint32 biClrUsed = 0; /* Uint32 biClrImportant = 0; */ + (void) haveRGBMasks; + (void) haveAlphaMask; + /* Make sure we are passed a valid data source */ surface = NULL; was_error = SDL_FALSE; diff --git a/Engine/lib/sdl/src/video/SDL_clipboard.c b/Engine/lib/sdl/src/video/SDL_clipboard.c index 91d1eeea0..0dd6a05b9 100644 --- a/Engine/lib/sdl/src/video/SDL_clipboard.c +++ b/Engine/lib/sdl/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_egl.c b/Engine/lib/sdl/src/video/SDL_egl.c index c90380566..0daf98ac1 100644 --- a/Engine/lib/sdl/src/video/SDL_egl.c +++ b/Engine/lib/sdl/src/video/SDL_egl.c @@ -1,6 +1,6 @@ /* * Simple DirectMedia Layer - * Copyright (C) 1997-2016 Sam Lantinga + * Copyright (C) 1997-2018 Sam Lantinga * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,12 @@ #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT #include "../core/windows/SDL_windows.h" #endif +#if SDL_VIDEO_DRIVER_ANDROID +#include +#endif #include "SDL_sysvideo.h" +#include "SDL_log.h" #include "SDL_egl_c.h" #include "SDL_loadso.h" #include "SDL_hints.h" @@ -40,10 +44,12 @@ #if SDL_VIDEO_DRIVER_RPI /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */ -#define DEFAULT_EGL "/opt/vc/lib/libEGL.so" -#define DEFAULT_OGL_ES2 "/opt/vc/lib/libGLESv2.so" -#define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so" -#define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so" +#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" ) +#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so" ) +#define ALT_EGL "libEGL.so" +#define ALT_OGL_ES2 "libGLESv2.so" +#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so" ) +#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so" ) #elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE /* Android */ @@ -59,6 +65,13 @@ #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll" #define DEFAULT_OGL_ES "libGLESv1_CM.dll" +#elif SDL_VIDEO_DRIVER_COCOA +/* EGL AND OpenGL ES support via ANGLE */ +#define DEFAULT_EGL "libEGL.dylib" +#define DEFAULT_OGL_ES2 "libGLESv2.dylib" +#define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //??? +#define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //??? + #else /* Desktop Linux */ #define DEFAULT_OGL "libGL.so.1" @@ -68,46 +81,130 @@ #define DEFAULT_OGL_ES "libGLESv1_CM.so.1" #endif /* SDL_VIDEO_DRIVER_RPI */ +#ifdef SDL_VIDEO_STATIC_ANGLE +#define LOAD_FUNC(NAME) \ +_this->egl_data->NAME = (void *)NAME; +#else #define LOAD_FUNC(NAME) \ _this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ if (!_this->egl_data->NAME) \ { \ return SDL_SetError("Could not retrieve EGL function " #NAME); \ } - -/* EGL implementation of SDL OpenGL ES support */ -#ifdef EGL_KHR_create_context -static int SDL_EGL_HasExtension(_THIS, const char *ext) +#endif + +static const char * SDL_EGL_GetErrorName(EGLint eglErrorCode) +{ +#define SDL_EGL_ERROR_TRANSLATE(e) case e: return #e; + switch (eglErrorCode) { + SDL_EGL_ERROR_TRANSLATE(EGL_SUCCESS); + SDL_EGL_ERROR_TRANSLATE(EGL_NOT_INITIALIZED); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ACCESS); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ALLOC); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ATTRIBUTE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONTEXT); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONFIG); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CURRENT_SURFACE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_DISPLAY); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_SURFACE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_MATCH); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_PARAMETER); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_PIXMAP); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_WINDOW); + SDL_EGL_ERROR_TRANSLATE(EGL_CONTEXT_LOST); + } + return ""; +} + +int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode) +{ + const char * errorText = SDL_EGL_GetErrorName(eglErrorCode); + char altErrorText[32]; + if (errorText[0] == '\0') { + /* An unknown-to-SDL error code was reported. Report its hexadecimal value, instead of its name. */ + SDL_snprintf(altErrorText, SDL_arraysize(altErrorText), "0x%x", (unsigned int)eglErrorCode); + errorText = altErrorText; + } + return SDL_SetError("%s (call to %s failed, reporting an error of %s)", message, eglFunctionName, errorText); +} + +/* EGL implementation of SDL OpenGL ES support */ +typedef enum { + SDL_EGL_DISPLAY_EXTENSION, + SDL_EGL_CLIENT_EXTENSION +} SDL_EGL_ExtensionType; + +static SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext) { - int i; - int len = 0; size_t ext_len; - const char *exts; - const char *ext_word; + const char *ext_override; + const char *egl_extstr; + const char *ext_start; + + /* Invalid extensions can be rejected early */ + if (ext == NULL || *ext == 0 || SDL_strchr(ext, ' ') != NULL) { + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid EGL extension"); */ + return SDL_FALSE; + } + + /* Extensions can be masked with an environment variable. + * Unlike the OpenGL override, this will use the set bits of an integer + * to disable the extension. + * Bit Action + * 0 If set, the display extension is masked and not present to SDL. + * 1 If set, the client extension is masked and not present to SDL. + */ + ext_override = SDL_getenv(ext); + if (ext_override != NULL) { + int disable_ext = SDL_atoi(ext_override); + if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) { + return SDL_FALSE; + } else if (disable_ext & 0x02 && type == SDL_EGL_CLIENT_EXTENSION) { + return SDL_FALSE; + } + } ext_len = SDL_strlen(ext); - exts = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_EXTENSIONS); + switch (type) { + case SDL_EGL_DISPLAY_EXTENSION: + egl_extstr = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_EXTENSIONS); + break; + case SDL_EGL_CLIENT_EXTENSION: + /* EGL_EXT_client_extensions modifies eglQueryString to return client extensions + * if EGL_NO_DISPLAY is passed. Implementations without it are required to return NULL. + * This behavior is included in EGL 1.5. + */ + egl_extstr = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + break; + default: + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid extension type"); */ + return SDL_FALSE; + } - if (exts) { - ext_word = exts; + if (egl_extstr != NULL) { + ext_start = egl_extstr; - for (i = 0; exts[i] != 0; i++) { - if (exts[i] == ' ') { - if (ext_len == len && !SDL_strncmp(ext_word, ext, len)) { - return 1; + while (*ext_start) { + ext_start = SDL_strstr(ext_start, ext); + if (ext_start == NULL) { + return SDL_FALSE; + } + /* Check if the match is not just a substring of one of the extensions */ + if (ext_start == egl_extstr || *(ext_start - 1) == ' ') { + if (ext_start[ext_len] == ' ' || ext_start[ext_len] == 0) { + return SDL_TRUE; } - - len = 0; - ext_word = &exts[i + 1]; - } else { - len++; + } + /* If the search stopped in the middle of an extension, skip to the end of it */ + ext_start += ext_len; + while (*ext_start != ' ' && *ext_start != 0) { + ext_start++; } } } - return 0; + return SDL_FALSE; } -#endif /* EGL_KHR_create_context */ void * SDL_EGL_GetProcAddress(_THIS, const char *proc) @@ -116,7 +213,7 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc) void *retval; /* eglGetProcAddress is busted on Android http://code.google.com/p/android/issues/detail?id=7681 */ -#if !defined(SDL_VIDEO_DRIVER_ANDROID) && !defined(SDL_VIDEO_DRIVER_MIR) +#if !defined(SDL_VIDEO_DRIVER_ANDROID) if (_this->egl_data->eglGetProcAddress) { retval = _this->egl_data->eglGetProcAddress(proc); if (retval) { @@ -158,16 +255,20 @@ SDL_EGL_UnloadLibrary(_THIS) } int -SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display) +SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display, EGLenum platform) { void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */ const char *path = NULL; + int egl_version_major = 0, egl_version_minor = 0; #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT const char *d3dcompiler; #endif +#if SDL_VIDEO_DRIVER_RPI + SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK)); +#endif if (_this->egl_data) { - return SDL_SetError("OpenGL ES context already created"); + return SDL_SetError("EGL context already created"); } _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData)); @@ -185,10 +286,13 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } } if (SDL_strcasecmp(d3dcompiler, "none") != 0) { - SDL_LoadObject(d3dcompiler); + if (SDL_LoadObject(d3dcompiler) == NULL) { + SDL_ClearError(); + } } #endif +#ifndef SDL_VIDEO_STATIC_ANGLE /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */ path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); if (path != NULL) { @@ -200,6 +304,13 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa if (_this->gl_config.major_version > 1) { path = DEFAULT_OGL_ES2; egl_dll_handle = SDL_LoadObject(path); +#ifdef ALT_OGL_ES2 + if (egl_dll_handle == NULL && !vc4) { + path = ALT_OGL_ES2; + egl_dll_handle = SDL_LoadObject(path); + } +#endif + } else { path = DEFAULT_OGL_ES; egl_dll_handle = SDL_LoadObject(path); @@ -207,6 +318,12 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa path = DEFAULT_OGL_ES_PVR; egl_dll_handle = SDL_LoadObject(path); } +#ifdef ALT_OGL_ES2 + if (egl_dll_handle == NULL && !vc4) { + path = ALT_OGL_ES2; + egl_dll_handle = SDL_LoadObject(path); + } +#endif } } #ifdef DEFAULT_OGL @@ -236,6 +353,14 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa path = DEFAULT_EGL; } dll_handle = SDL_LoadObject(path); + +#ifdef ALT_EGL + if (dll_handle == NULL && !vc4) { + path = ALT_EGL; + dll_handle = SDL_LoadObject(path); + } +#endif + if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { if (dll_handle != NULL) { SDL_UnloadObject(dll_handle); @@ -244,6 +369,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } SDL_ClearError(); } +#endif _this->egl_data->dll_handle = dll_handle; @@ -256,6 +382,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa LOAD_FUNC(eglGetConfigAttrib); LOAD_FUNC(eglCreateContext); LOAD_FUNC(eglDestroyContext); + LOAD_FUNC(eglCreatePbufferSurface); LOAD_FUNC(eglCreateWindowSurface); LOAD_FUNC(eglDestroySurface); LOAD_FUNC(eglMakeCurrent); @@ -265,10 +392,43 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa LOAD_FUNC(eglWaitGL); LOAD_FUNC(eglBindAPI); LOAD_FUNC(eglQueryString); - + LOAD_FUNC(eglGetError); + + if (_this->egl_data->eglQueryString) { + /* EGL 1.5 allows querying for client version */ + const char *egl_version = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_VERSION); + if (egl_version != NULL) { + if (SDL_sscanf(egl_version, "%d.%d", &egl_version_major, &egl_version_minor) != 2) { + egl_version_major = 0; + egl_version_minor = 0; + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not parse EGL version string: %s", egl_version); + } + } + } + + if (egl_version_major == 1 && egl_version_minor == 5) { + LOAD_FUNC(eglGetPlatformDisplay); + } + + _this->egl_data->egl_display = EGL_NO_DISPLAY; #if !defined(__WINRT__) - _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); - if (!_this->egl_data->egl_display) { + if (platform) { + if (egl_version_major == 1 && egl_version_minor == 5) { + _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(size_t)native_display, NULL); + } else { + if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) { + _this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT"); + if (_this->egl_data->eglGetPlatformDisplayEXT) { + _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(size_t)native_display, NULL); + } + } + } + } + /* Try the implementation-specific eglGetDisplay even if eglGetPlatformDisplay fails */ + if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { + _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); + } + if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { return SDL_SetError("Could not get EGL display"); } @@ -277,8 +437,6 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } #endif - _this->gl_config.driver_loaded = 1; - if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); } else { @@ -291,13 +449,19 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa int SDL_EGL_ChooseConfig(_THIS) { - /* 64 seems nice. */ +/* 64 seems nice. */ EGLint attribs[64]; EGLint found_configs = 0, value; +#ifdef SDL_VIDEO_DRIVER_KMSDRM + /* Intel EGL on KMS/DRM (al least) returns invalid configs that confuse the bitdiff search used */ + /* later in this function, so we simply use the first one when using the KMSDRM driver for now. */ + EGLConfig configs[1]; +#else /* 128 seems even nicer here */ EGLConfig configs[128]; +#endif int i, j, best_bitdiff = -1, bitdiff; - + if (!_this->egl_data) { /* The EGL library wasn't loaded, SDL_GetError() should have info */ return -1; @@ -340,23 +504,11 @@ SDL_EGL_ChooseConfig(_THIS) attribs[i++] = _this->gl_config.multisamplesamples; } - if (_this->gl_config.framebuffer_srgb_capable) { -#ifdef EGL_KHR_gl_colorspace - if (SDL_EGL_HasExtension(_this, "EGL_KHR_gl_colorspace")) { - attribs[i++] = EGL_GL_COLORSPACE_KHR; - attribs[i++] = EGL_GL_COLORSPACE_SRGB_KHR; - } else -#endif - { - return SDL_SetError("EGL implementation does not support sRGB system framebuffers"); - } - } - attribs[i++] = EGL_RENDERABLE_TYPE; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { #ifdef EGL_KHR_create_context if (_this->gl_config.major_version >= 3 && - SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) { + SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) { attribs[i++] = EGL_OPENGL_ES3_BIT_KHR; } else #endif @@ -371,6 +523,11 @@ SDL_EGL_ChooseConfig(_THIS) _this->egl_data->eglBindAPI(EGL_OPENGL_API); } + if (_this->egl_data->egl_surfacetype) { + attribs[i++] = EGL_SURFACE_TYPE; + attribs[i++] = _this->egl_data->egl_surfacetype; + } + attribs[i++] = EGL_NONE; if (_this->egl_data->eglChooseConfig(_this->egl_data->egl_display, @@ -378,7 +535,7 @@ SDL_EGL_ChooseConfig(_THIS) configs, SDL_arraysize(configs), &found_configs) == EGL_FALSE || found_configs == 0) { - return SDL_SetError("Couldn't find matching EGL config"); + return SDL_EGL_SetError("Couldn't find matching EGL config", "eglChooseConfig"); } /* eglChooseConfig returns a number of configurations that match or exceed the requested attribs. */ @@ -458,7 +615,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) /* The Major/minor version, context profiles, and context flags can * only be specified when this extension is available. */ - if (SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) { + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) { attribs[attr++] = EGL_CONTEXT_MAJOR_VERSION_KHR; attribs[attr++] = major_version; attribs[attr++] = EGL_CONTEXT_MINOR_VERSION_KHR; @@ -483,6 +640,19 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) } } + if (_this->gl_config.no_error) { +#ifdef EGL_KHR_create_context_no_error + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context_no_error")) { + attribs[attr++] = EGL_CONTEXT_OPENGL_NO_ERROR_KHR; + attribs[attr++] = _this->gl_config.no_error; + } else +#endif + { + SDL_SetError("EGL implementation does not support no_error contexts"); + return NULL; + } + } + attribs[attr++] = EGL_NONE; /* Bind the API */ @@ -497,15 +667,23 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) share_context, attribs); if (egl_context == EGL_NO_CONTEXT) { - SDL_SetError("Could not create EGL context"); + SDL_EGL_SetError("Could not create EGL context", "eglCreateContext"); return NULL; } _this->egl_data->egl_swapinterval = 0; if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) { + /* Save the SDL error set by SDL_EGL_MakeCurrent */ + char errorText[1024]; + SDL_strlcpy(errorText, SDL_GetError(), SDL_arraysize(errorText)); + + /* Delete the context, which may alter the value returned by SDL_GetError() */ SDL_EGL_DeleteContext(_this, egl_context); - SDL_SetError("Could not make EGL context current"); + + /* Restore the SDL error */ + SDL_SetError("%s", errorText); + return NULL; } @@ -529,7 +707,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context) } else { if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, egl_surface, egl_surface, egl_context)) { - return SDL_SetError("Unable to make EGL context current"); + return SDL_EGL_SetError("Unable to make EGL context current", "eglMakeCurrent"); } } @@ -551,7 +729,7 @@ SDL_EGL_SetSwapInterval(_THIS, int interval) return 0; } - return SDL_SetError("Unable to set the EGL swap interval"); + return SDL_EGL_SetError("Unable to set the EGL swap interval", "eglSwapInterval"); } int @@ -565,10 +743,13 @@ SDL_EGL_GetSwapInterval(_THIS) return _this->egl_data->egl_swapinterval; } -void +int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface) { - _this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface); + if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface)) { + return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers"); + } + return 0; } void @@ -591,11 +772,17 @@ SDL_EGL_DeleteContext(_THIS, SDL_GLContext context) EGLSurface * SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) { + /* max 2 values plus terminator. */ + EGLint attribs[3]; + int attr = 0; + + EGLSurface * surface; + if (SDL_EGL_ChooseConfig(_this) != 0) { return EGL_NO_SURFACE; } -#if __ANDROID__ +#if SDL_VIDEO_DRIVER_ANDROID { /* Android docs recommend doing this! * Ref: http://developer.android.com/reference/android/app/NativeActivity.html @@ -608,11 +795,29 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) ANativeWindow_setBuffersGeometry(nw, 0, 0, format); } #endif + if (_this->gl_config.framebuffer_srgb_capable) { +#ifdef EGL_KHR_gl_colorspace + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_gl_colorspace")) { + attribs[attr++] = EGL_GL_COLORSPACE_KHR; + attribs[attr++] = EGL_GL_COLORSPACE_SRGB_KHR; + } else +#endif + { + SDL_SetError("EGL implementation does not support sRGB system framebuffers"); + return EGL_NO_SURFACE; + } + } + + attribs[attr++] = EGL_NONE; - return _this->egl_data->eglCreateWindowSurface( + surface = _this->egl_data->eglCreateWindowSurface( _this->egl_data->egl_display, _this->egl_data->egl_config, - nw, NULL); + nw, &attribs[0]); + if (surface == EGL_NO_SURFACE) { + SDL_EGL_SetError("unable to create an EGL window surface", "eglCreateWindowSurface"); + } + return surface; } void @@ -630,4 +835,4 @@ SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface) #endif /* SDL_VIDEO_OPENGL_EGL */ /* vi: set ts=4 sw=4 expandtab: */ - + diff --git a/Engine/lib/sdl/src/video/SDL_egl_c.h b/Engine/lib/sdl/src/video/SDL_egl_c.h index c683dffa7..80b13192e 100644 --- a/Engine/lib/sdl/src/video/SDL_egl_c.h +++ b/Engine/lib/sdl/src/video/SDL_egl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_egl_h -#define _SDL_egl_h +#ifndef SDL_egl_h_ +#define SDL_egl_h_ #if SDL_VIDEO_OPENGL_EGL @@ -35,8 +35,15 @@ typedef struct SDL_EGL_VideoData EGLDisplay egl_display; EGLConfig egl_config; int egl_swapinterval; + int egl_surfacetype; EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display); + EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform, + void *native_display, + const EGLint *attrib_list); + EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplayEXT) (EGLenum platform, + void *native_display, + const EGLint *attrib_list); EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major, EGLint * minor); EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy); @@ -55,6 +62,9 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); + EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, + EGLint const* attrib_list); + EGLSurface(EGLAPIENTRY *eglCreateWindowSurface) (EGLDisplay dpy, EGLConfig config, NativeWindowType window, @@ -79,11 +89,16 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum); + EGLint(EGLAPIENTRY *eglGetError)(void); + } SDL_EGL_VideoData; /* OpenGLES functions */ extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value); -extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display); +/* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*) + * or, if 0 is passed, let the implementation decide. + */ +extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform); extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc); extern void SDL_EGL_UnloadLibrary(_THIS); extern int SDL_EGL_ChooseConfig(_THIS); @@ -96,14 +111,18 @@ extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface); /* These need to be wrapped to get the surface for the window by the platform GLES implementation */ extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface); extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context); -extern void SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); +extern int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); + +/* SDL Error-reporting */ +extern int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode); +#define SDL_EGL_SetError(message, eglFunctionName) SDL_EGL_SetErrorEx(message, eglFunctionName, _this->egl_data->eglGetError()) /* A few of useful macros */ -#define SDL_EGL_SwapWindow_impl(BACKEND) void \ +#define SDL_EGL_SwapWindow_impl(BACKEND) int \ BACKEND ## _GLES_SwapWindow(_THIS, SDL_Window * window) \ {\ - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ } #define SDL_EGL_MakeCurrent_impl(BACKEND) int \ @@ -125,6 +144,6 @@ BACKEND ## _GLES_CreateContext(_THIS, SDL_Window * window) \ #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_egl_h */ +#endif /* SDL_egl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_fillrect.c b/Engine/lib/sdl/src/video/SDL_fillrect.c index e34a43c44..63f5fcb30 100644 --- a/Engine/lib/sdl/src/video/SDL_fillrect.c +++ b/Engine/lib/sdl/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -144,13 +144,13 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) switch ((uintptr_t) p & 3) { case 1: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 2: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 3: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ } SDL_memset4(p, color, (n >> 2)); } @@ -158,11 +158,11 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) p += (n & ~3); switch (n & 3) { case 3: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 2: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 1: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ } } pixels += pitch; diff --git a/Engine/lib/sdl/src/video/SDL_pixels.c b/Engine/lib/sdl/src/video/SDL_pixels.c index d905656ca..2e263955c 100644 --- a/Engine/lib/sdl/src/video/SDL_pixels.c +++ b/Engine/lib/sdl/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -326,7 +326,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, if (Rmask == 0) { return SDL_PIXELFORMAT_RGB555; } - /* Fall through to 16-bit checks */ + /* fallthrough */ case 16: if (Rmask == 0) { return SDL_PIXELFORMAT_RGB565; @@ -403,6 +403,13 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Amask == 0x0000) { return SDL_PIXELFORMAT_BGR565; } + if (Rmask == 0x003F && + Gmask == 0x07C0 && + Bmask == 0xF800 && + Amask == 0x0000) { + /* Technically this would be BGR556, but Witek says this works in bug 3158 */ + return SDL_PIXELFORMAT_RGB565; + } break; case 24: switch (Rmask) { @@ -483,16 +490,20 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, } static SDL_PixelFormat *formats; +static SDL_SpinLock formats_lock = 0; SDL_PixelFormat * SDL_AllocFormat(Uint32 pixel_format) { SDL_PixelFormat *format; + SDL_AtomicLock(&formats_lock); + /* Look it up in our list of previously allocated formats */ for (format = formats; format; format = format->next) { if (pixel_format == format->format) { ++format->refcount; + SDL_AtomicUnlock(&formats_lock); return format; } } @@ -500,10 +511,12 @@ SDL_AllocFormat(Uint32 pixel_format) /* Allocate an empty pixel format structure, and initialize it */ format = SDL_malloc(sizeof(*format)); if (format == NULL) { + SDL_AtomicUnlock(&formats_lock); SDL_OutOfMemory(); return NULL; } if (SDL_InitFormat(format, pixel_format) < 0) { + SDL_AtomicUnlock(&formats_lock); SDL_free(format); SDL_InvalidParamError("format"); return NULL; @@ -514,6 +527,9 @@ SDL_AllocFormat(Uint32 pixel_format) format->next = formats; formats = format; } + + SDL_AtomicUnlock(&formats_lock); + return format; } @@ -591,7 +607,11 @@ SDL_FreeFormat(SDL_PixelFormat *format) SDL_InvalidParamError("format"); return; } + + SDL_AtomicLock(&formats_lock); + if (--format->refcount > 0) { + SDL_AtomicUnlock(&formats_lock); return; } @@ -607,6 +627,8 @@ SDL_FreeFormat(SDL_PixelFormat *format) } } + SDL_AtomicUnlock(&formats_lock); + if (format->palette) { SDL_FreePalette(format->palette); } @@ -651,7 +673,7 @@ SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette) return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format"); } - if (palette && palette->ncolors != (1 << format->BitsPerPixel)) { + if (palette && palette->ncolors > (1 << format->BitsPerPixel)) { return SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format"); } @@ -741,30 +763,6 @@ SDL_DitherColors(SDL_Color * colors, int bpp) } } -/* - * Calculate the pad-aligned scanline width of a surface - */ -int -SDL_CalculatePitch(SDL_Surface * surface) -{ - int pitch; - - /* Surface should be 4-byte aligned for speed */ - pitch = surface->w * surface->format->BytesPerPixel; - switch (surface->format->BitsPerPixel) { - case 1: - pitch = (pitch + 7) / 8; - break; - case 4: - pitch = (pitch + 1) / 2; - break; - default: - break; - } - pitch = (pitch + 3) & ~3; /* 4-byte aligning */ - return (pitch); -} - /* * Match an RGB value to a particular palette index */ diff --git a/Engine/lib/sdl/src/video/SDL_pixels_c.h b/Engine/lib/sdl/src/video/SDL_pixels_c.h index 4ee91b8a3..900f0b080 100644 --- a/Engine/lib/sdl/src/video/SDL_pixels_c.h +++ b/Engine/lib/sdl/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,6 @@ extern int SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst); extern void SDL_FreeBlitMap(SDL_BlitMap * map); /* Miscellaneous functions */ -extern int SDL_CalculatePitch(SDL_Surface * surface); extern void SDL_DitherColors(SDL_Color * colors, int bpp); extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a); diff --git a/Engine/lib/sdl/src/video/SDL_rect.c b/Engine/lib/sdl/src/video/SDL_rect.c index 2b29451c7..8c6ff2da7 100644 --- a/Engine/lib/sdl/src/video/SDL_rect.c +++ b/Engine/lib/sdl/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "SDL_rect.h" #include "SDL_rect_c.h" - +#include "SDL_assert.h" SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B) @@ -441,9 +441,15 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, y = recty2; x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); } else if (outcode2 & CODE_LEFT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx1; y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); } else if (outcode2 & CODE_RIGHT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx2; y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); } diff --git a/Engine/lib/sdl/src/video/SDL_rect_c.h b/Engine/lib/sdl/src/video/SDL_rect_c.h index aa5fbde79..d67e49348 100644 --- a/Engine/lib/sdl/src/video/SDL_rect_c.h +++ b/Engine/lib/sdl/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_shape.c b/Engine/lib/sdl/src/video/SDL_shape.c index 4a2e5465b..6f029bceb 100644 --- a/Engine/lib/sdl/src/video/SDL_shape.c +++ b/Engine/lib/sdl/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,10 @@ SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned SDL_Window *result = NULL; result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /* & (~SDL_WINDOW_SHOWN) */); if(result != NULL) { + if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) { + SDL_DestroyWindow(result); + return NULL; + } result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result); if(result->shaper != NULL) { result->shaper->userx = x; @@ -70,11 +74,14 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm int y = 0; Uint8 r = 0,g = 0,b = 0,alpha = 0; Uint8* pixel = NULL; - Uint32 bitmap_pixel,pixel_value = 0,mask_value = 0; + Uint32 pixel_value = 0,mask_value = 0; + int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb; + Uint8 *bitmap_scanline; SDL_Color key; if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); for(y = 0;yh;y++) { + bitmap_scanline = bitmap + y * bytes_per_scanline; for(x=0;xw;x++) { alpha = 0; pixel_value = 0; @@ -94,7 +101,6 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm break; } SDL_GetRGBA(pixel_value,shape->format,&r,&g,&b,&alpha); - bitmap_pixel = y*shape->w + x; switch(mode.mode) { case(ShapeModeDefault): mask_value = (alpha >= 1 ? 1 : 0); @@ -110,7 +116,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm mask_value = ((key.r != r || key.g != g || key.b != b) ? 1 : 0); break; } - bitmap[bitmap_pixel / ppb] |= mask_value << (7 - ((ppb - 1) - (bitmap_pixel % ppb))); + bitmap_scanline[x / ppb] |= mask_value << (x % ppb); } } if(SDL_MUSTLOCK(shape)) @@ -206,8 +212,14 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) { - SDL_Rect dimensions = {0,0,shape->w,shape->h}; + SDL_Rect dimensions; SDL_ShapeTree* result = NULL; + + dimensions.x = 0; + dimensions.y = 0; + dimensions.w = shape->w; + dimensions.h = shape->h; + if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); result = RecursivelyCalculateShapeTree(mode,shape,dimensions); @@ -234,10 +246,10 @@ void SDL_FreeShapeTree(SDL_ShapeTree** shape_tree) { if((*shape_tree)->kind == QuadShape) { - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upleft); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upright); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.downleft); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.downright); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upleft); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upright); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downleft); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downright); } SDL_free(*shape_tree); *shape_tree = NULL; diff --git a/Engine/lib/sdl/src/video/SDL_shape_internals.h b/Engine/lib/sdl/src/video/SDL_shape_internals.h index bdb0ee91b..3af175cdf 100644 --- a/Engine/lib/sdl/src/video/SDL_shape_internals.h +++ b/Engine/lib/sdl/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_shape_internals_h -#define _SDL_shape_internals_h +#ifndef SDL_shape_internals_h_ +#define SDL_shape_internals_h_ #include "SDL_rect.h" #include "SDL_shape.h" diff --git a/Engine/lib/sdl/src/video/SDL_stretch.c b/Engine/lib/sdl/src/video/SDL_stretch.c index bb34dffb7..8cc6bf30b 100644 --- a/Engine/lib/sdl/src/video/SDL_stretch.c +++ b/Engine/lib/sdl/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ into the general blitting mechanism. */ -#if ((defined(_MFC_VER) && defined(_M_IX86)) || \ - defined(__WATCOMC__) || \ +#if ((defined(_MSC_VER) && defined(_M_IX86)) || \ + (defined(__WATCOMC__) && defined(__386__)) || \ (defined(__GNUC__) && defined(__i386__))) && SDL_ASSEMBLY_ROUTINES /* There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct * value after the first scanline. FIXME? */ @@ -53,7 +53,7 @@ #define PAGE_ALIGNED #endif -#if defined(_M_IX86) || defined(i386) +#if defined(_M_IX86) || defined(__i386__) || defined(__386__) #define PREFIX16 0x66 #define STORE_BYTE 0xAA #define STORE_WORD 0xAB @@ -102,7 +102,7 @@ generate_rowbytes(int src_w, int dst_w, int bpp) store = STORE_WORD; break; default: - return SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp); + return SDL_SetError("ASM stretch of %d bytes isn't supported", bpp); } #ifdef HAVE_MPROTECT /* Make the code writeable */ diff --git a/Engine/lib/sdl/src/video/SDL_surface.c b/Engine/lib/sdl/src/video/SDL_surface.c index 9d52e5ca4..719f831e8 100644 --- a/Engine/lib/sdl/src/video/SDL_surface.c +++ b/Engine/lib/sdl/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,9 +25,39 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" #include "SDL_pixels_c.h" +#include "SDL_yuv_c.h" + + +/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */ +SDL_COMPILE_TIME_ASSERT(surface_size_assumptions, + sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32)); /* Public routines */ +/* + * Calculate the pad-aligned scanline width of a surface + */ +int +SDL_CalculatePitch(Uint32 format, int width) +{ + int pitch; + + /* Surface should be 4-byte aligned for speed */ + pitch = width * SDL_BYTESPERPIXEL(format); + switch (SDL_BITSPERPIXEL(format)) { + case 1: + pitch = (pitch + 7) / 8; + break; + case 4: + pitch = (pitch + 1) / 2; + break; + default: + break; + } + pitch = (pitch + 3) & ~3; /* 4-byte aligning */ + return pitch; +} + /* * Create an empty RGB surface of the appropriate depth using the given * enum SDL_PIXELFORMAT_* format @@ -55,7 +85,7 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, } surface->w = width; surface->h = height; - surface->pitch = SDL_CalculatePitch(surface); + surface->pitch = SDL_CalculatePitch(format, width); SDL_SetClipRect(surface, NULL); if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { @@ -80,7 +110,16 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, /* Get the pixels */ if (surface->w && surface->h) { - surface->pixels = SDL_malloc(surface->h * surface->pitch); + /* Assumptions checked in surface_size_assumptions assert above */ + Sint64 size = ((Sint64)surface->h * surface->pitch); + if (size < 0 || size > SDL_MAX_SINT32) { + /* Overflow... */ + SDL_FreeSurface(surface); + SDL_OutOfMemory(); + return NULL; + } + + surface->pixels = SDL_malloc((size_t)size); if (!surface->pixels) { SDL_FreeSurface(surface); SDL_OutOfMemory(); @@ -257,11 +296,11 @@ int SDL_GetColorKey(SDL_Surface * surface, Uint32 * key) { if (!surface) { - return -1; + return SDL_InvalidParamError("surface"); } if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) { - return -1; + return SDL_SetError("Surface doesn't have a colorkey"); } if (key) { @@ -778,8 +817,8 @@ SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, final_src.x = (int)SDL_floor(src_x0 + 0.5); final_src.y = (int)SDL_floor(src_y0 + 0.5); - final_src.w = (int)SDL_floor(src_x1 - src_x0 + 1.5); - final_src.h = (int)SDL_floor(src_y1 - src_y0 + 1.5); + final_src.w = (int)SDL_floor(src_x1 + 1 + 0.5) - (int)SDL_floor(src_x0 + 0.5); + final_src.h = (int)SDL_floor(src_y1 + 1 + 0.5) - (int)SDL_floor(src_y0 + 0.5); final_dst.x = (int)SDL_floor(dst_x0 + 0.5); final_dst.y = (int)SDL_floor(dst_y0 + 0.5); @@ -870,6 +909,15 @@ SDL_UnlockSurface(SDL_Surface * surface) } } +/* + * Creates a new surface identical to the existing surface + */ +SDL_Surface * +SDL_DuplicateSurface(SDL_Surface * surface) +{ + return SDL_ConvertSurface(surface, surface->format, surface->flags); +} + /* * Convert a surface into the specified pixel format. */ @@ -882,6 +930,15 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, SDL_Color copy_color; SDL_Rect bounds; + if (!surface) { + SDL_InvalidParamError("surface"); + return NULL; + } + if (!format) { + SDL_InvalidParamError("format"); + return NULL; + } + /* Check for empty destination palette! (results in empty image) */ if (format->palette != NULL) { int i; @@ -970,13 +1027,37 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, } if (set_colorkey_by_color) { - /* Set the colorkey by color, which needs to be unique */ - Uint8 keyR, keyG, keyB, keyA; + SDL_Surface *tmp; + SDL_Surface *tmp2; + int converted_colorkey = 0; + + /* Create a dummy surface to get the colorkey converted */ + tmp = SDL_CreateRGBSurface(0, 1, 1, + surface->format->BitsPerPixel, surface->format->Rmask, + surface->format->Gmask, surface->format->Bmask, + surface->format->Amask); + + /* Share the palette, if any */ + if (surface->format->palette) { + SDL_SetSurfacePalette(tmp, surface->format->palette); + } + + SDL_FillRect(tmp, NULL, surface->map->info.colorkey); + + tmp->map->info.flags &= ~SDL_COPY_COLORKEY; + + /* Convertion of the colorkey */ + tmp2 = SDL_ConvertSurface(tmp, format, 0); + + /* Get the converted colorkey */ + SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->BytesPerPixel); + + SDL_FreeSurface(tmp); + SDL_FreeSurface(tmp2); + + /* Set the converted colorkey on the new surface */ + SDL_SetColorKey(convert, 1, converted_colorkey); - SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR, - &keyG, &keyB, &keyA); - SDL_SetColorKey(convert, 1, - SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA)); /* This is needed when converting for 3D texture upload */ SDL_ConvertColorkeyToAlpha(convert); } @@ -986,7 +1067,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, /* Enable alpha blending by default if the new surface has an * alpha channel or alpha modulation */ if ((surface->format->Amask && format->Amask) || - (copy_flags & (SDL_COPY_COLORKEY|SDL_COPY_MODULATE_ALPHA))) { + (copy_flags & SDL_COPY_MODULATE_ALPHA)) { SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND); } if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) { @@ -1072,57 +1153,24 @@ int SDL_ConvertPixels(int width, int height, return SDL_InvalidParamError("dst_pitch"); } + if (SDL_ISPIXELFORMAT_FOURCC(src_format) && SDL_ISPIXELFORMAT_FOURCC(dst_format)) { + return SDL_ConvertPixels_YUV_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (SDL_ISPIXELFORMAT_FOURCC(src_format)) { + return SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (SDL_ISPIXELFORMAT_FOURCC(dst_format)) { + return SDL_ConvertPixels_RGB_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } + /* Fast path for same format copy */ if (src_format == dst_format) { - int bpp, i; - - if (SDL_ISPIXELFORMAT_FOURCC(src_format)) { - switch (src_format) { - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - bpp = 2; - break; - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - case SDL_PIXELFORMAT_NV12: - case SDL_PIXELFORMAT_NV21: - bpp = 1; - break; - default: - return SDL_SetError("Unknown FOURCC pixel format"); - } - } else { - bpp = SDL_BYTESPERPIXEL(src_format); - } + int i; + const int bpp = SDL_BYTESPERPIXEL(src_format); width *= bpp; - for (i = height; i--;) { SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; + src = (const Uint8*)src + src_pitch; dst = (Uint8*)dst + dst_pitch; } - - if (src_format == SDL_PIXELFORMAT_YV12 || src_format == SDL_PIXELFORMAT_IYUV) { - /* U and V planes are a quarter the size of the Y plane */ - width /= 2; - height /= 2; - src_pitch /= 2; - dst_pitch /= 2; - for (i = height * 2; i--;) { - SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; - dst = (Uint8*)dst + dst_pitch; - } - } else if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) { - /* U/V plane is half the height of the Y plane */ - height /= 2; - for (i = height; i--;) { - SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; - dst = (Uint8*)dst + dst_pitch; - } - } return 0; } @@ -1156,6 +1204,8 @@ SDL_FreeSurface(SDL_Surface * surface) if (surface->flags & SDL_DONTFREE) { return; } + SDL_InvalidateMap(surface->map); + if (--surface->refcount > 0) { return; } @@ -1170,13 +1220,12 @@ SDL_FreeSurface(SDL_Surface * surface) SDL_FreeFormat(surface->format); surface->format = NULL; } - if (surface->map != NULL) { - SDL_FreeBlitMap(surface->map); - surface->map = NULL; - } if (!(surface->flags & SDL_PREALLOC)) { SDL_free(surface->pixels); } + if (surface->map) { + SDL_FreeBlitMap(surface->map); + } SDL_free(surface); } diff --git a/Engine/lib/sdl/src/video/SDL_sysvideo.h b/Engine/lib/sdl/src/video/SDL_sysvideo.h index cd2ed2a7e..9df71c9aa 100644 --- a/Engine/lib/sdl/src/video/SDL_sysvideo.h +++ b/Engine/lib/sdl/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,15 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysvideo_h -#define _SDL_sysvideo_h +#ifndef SDL_sysvideo_h_ +#define SDL_sysvideo_h_ #include "SDL_messagebox.h" #include "SDL_shape.h" #include "SDL_thread.h" +#include "SDL_vulkan_internal.h" + /* The SDL video driver */ typedef struct SDL_WindowShaper SDL_WindowShaper; @@ -163,6 +165,11 @@ struct SDL_VideoDevice */ void (*VideoQuit) (_THIS); + /* + * Reinitialize the touch devices -- called if an unknown touch ID occurs. + */ + void (*ResetTouch) (_THIS); + /* * * */ /* * Display functions @@ -200,8 +207,8 @@ struct SDL_VideoDevice /* * Window functions */ - int (*CreateWindow) (_THIS, SDL_Window * window); - int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data); + int (*CreateSDLWindow) (_THIS, SDL_Window * window); + int (*CreateSDLWindowFrom) (_THIS, SDL_Window * window, const void *data); void (*SetWindowTitle) (_THIS, SDL_Window * window); void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon); void (*SetWindowPosition) (_THIS, SDL_Window * window); @@ -252,8 +259,19 @@ struct SDL_VideoDevice void (*GL_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h); int (*GL_SetSwapInterval) (_THIS, int interval); int (*GL_GetSwapInterval) (_THIS); - void (*GL_SwapWindow) (_THIS, SDL_Window * window); + int (*GL_SwapWindow) (_THIS, SDL_Window * window); void (*GL_DeleteContext) (_THIS, SDL_GLContext context); + void (*GL_DefaultProfileConfig) (_THIS, int *mask, int *major, int *minor); + + /* * * */ + /* + * Vulkan support + */ + int (*Vulkan_LoadLibrary) (_THIS, const char *path); + void (*Vulkan_UnloadLibrary) (_THIS); + SDL_bool (*Vulkan_GetInstanceExtensions) (_THIS, SDL_Window *window, unsigned *count, const char **names); + SDL_bool (*Vulkan_CreateSurface) (_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface); + void (*Vulkan_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h); /* * * */ /* @@ -288,6 +306,7 @@ struct SDL_VideoDevice /* * * */ /* Data common to all drivers */ + SDL_bool is_dummy; SDL_bool suspend_screensaver; int num_displays; SDL_VideoDisplay *displays; @@ -295,7 +314,7 @@ struct SDL_VideoDevice SDL_Window *grabbed_window; Uint8 window_magic; Uint32 next_object_id; - char * clipboard_text; + char *clipboard_text; /* * * */ /* Data used by the GL drivers */ @@ -323,7 +342,9 @@ struct SDL_VideoDevice int profile_mask; int share_with_current_context; int release_behavior; + int reset_notification; int framebuffer_srgb_capable; + int no_error; int retained_backing; int driver_loaded; char driver_path[256]; @@ -340,6 +361,17 @@ struct SDL_VideoDevice SDL_TLSID current_glwin_tls; SDL_TLSID current_glctx_tls; + /* * * */ + /* Data used by the Vulkan drivers */ + struct + { + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties; + int loader_loaded; + char loader_path[256]; + void *loader_handle; + } vulkan_config; + /* * * */ /* Data private to this driver */ void *driverdata; @@ -366,57 +398,26 @@ typedef struct VideoBootStrap SDL_VideoDevice *(*create) (int devindex); } VideoBootStrap; -#if SDL_VIDEO_DRIVER_COCOA +/* Not all of these are available in a given build. Use #ifdefs, etc. */ extern VideoBootStrap COCOA_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_X11 extern VideoBootStrap X11_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_MIR extern VideoBootStrap MIR_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_DIRECTFB extern VideoBootStrap DirectFB_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WINDOWS extern VideoBootStrap WINDOWS_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WINRT extern VideoBootStrap WINRT_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_HAIKU extern VideoBootStrap HAIKU_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_PANDORA extern VideoBootStrap PND_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_UIKIT extern VideoBootStrap UIKIT_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_ANDROID extern VideoBootStrap Android_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_PSP extern VideoBootStrap PSP_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_RPI extern VideoBootStrap RPI_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_DUMMY +extern VideoBootStrap KMSDRM_bootstrap; extern VideoBootStrap DUMMY_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WAYLAND extern VideoBootStrap Wayland_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_NACL extern VideoBootStrap NACL_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_VIVANTE extern VideoBootStrap VIVANTE_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_EMSCRIPTEN extern VideoBootStrap Emscripten_bootstrap; -#endif +extern VideoBootStrap QNX_bootstrap; extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); @@ -425,7 +426,10 @@ extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayM extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window); extern void *SDL_GetDisplayDriverData( int displayIndex ); +extern void SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor); + extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); +extern SDL_bool SDL_HasWindows(void); extern void SDL_OnWindowShown(SDL_Window * window); extern void SDL_OnWindowHidden(SDL_Window * window); @@ -443,6 +447,13 @@ extern SDL_bool SDL_ShouldAllowTopmost(void); extern float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches); -#endif /* _SDL_sysvideo_h */ +extern void SDL_OnApplicationWillTerminate(void); +extern void SDL_OnApplicationDidReceiveMemoryWarning(void); +extern void SDL_OnApplicationWillResignActive(void); +extern void SDL_OnApplicationDidEnterBackground(void); +extern void SDL_OnApplicationWillEnterForeground(void); +extern void SDL_OnApplicationDidBecomeActive(void); + +#endif /* SDL_sysvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_video.c b/Engine/lib/sdl/src/video/SDL_video.c index 0a21ef5fc..8cf195d1a 100644 --- a/Engine/lib/sdl/src/video/SDL_video.c +++ b/Engine/lib/sdl/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,13 +46,10 @@ #include "SDL_opengles2.h" #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ +#if !SDL_VIDEO_OPENGL #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB #endif - -/* On Windows, windows.h defines CreateWindow */ -#ifdef CreateWindow -#undef CreateWindow #endif #ifdef __EMSCRIPTEN__ @@ -100,15 +97,21 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_PSP &PSP_bootstrap, #endif +#if SDL_VIDEO_DRIVER_KMSDRM + &KMSDRM_bootstrap, +#endif #if SDL_VIDEO_DRIVER_RPI &RPI_bootstrap, -#endif +#endif #if SDL_VIDEO_DRIVER_NACL &NACL_bootstrap, #endif #if SDL_VIDEO_DRIVER_EMSCRIPTEN &Emscripten_bootstrap, #endif +#if SDL_VIDEO_DRIVER_QNX + &QNX_bootstrap, +#endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, #endif @@ -122,6 +125,7 @@ static SDL_VideoDevice *_this = NULL; SDL_UninitializedVideo(); \ return retval; \ } \ + SDL_assert(window && window->magic == &_this->window_magic); \ if (!window || window->magic != &_this->window_magic) { \ SDL_SetError("Invalid window"); \ return retval; \ @@ -133,6 +137,7 @@ static SDL_VideoDevice *_this = NULL; return retval; \ } \ SDL_assert(_this->displays != NULL); \ + SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \ if (displayIndex < 0 || displayIndex >= _this->num_displays) { \ SDL_SetError("displayIndex must be in the range 0 - %d", \ _this->num_displays - 1); \ @@ -170,6 +175,11 @@ ShouldUseTextureFramebuffer() return SDL_TRUE; } + /* If this is the dummy driver there is no texture support */ + if (_this->is_dummy) { + return SDL_FALSE; + } + /* If the user has specified a software renderer we can't use a texture framebuffer, or renderer creation will go recursive. */ @@ -195,7 +205,7 @@ ShouldUseTextureFramebuffer() return SDL_FALSE; #elif defined(__MACOSX__) - /* Mac OS X uses OpenGL as the native fast path */ + /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */ return SDL_TRUE; #elif defined(__LINUX__) @@ -336,9 +346,14 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f /* Create framebuffer data */ data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format); data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3); - data->pixels = SDL_malloc(window->h * data->pitch); - if (!data->pixels) { - return SDL_OutOfMemory(); + + { + /* Make static analysis happy about potential malloc(0) calls. */ + const size_t allocsize = window->h * data->pitch; + data->pixels = SDL_malloc((allocsize > 0) ? allocsize : 1); + if (!data->pixels) { + return SDL_OutOfMemory(); + } } *pixels = data->pixels; @@ -707,21 +722,21 @@ int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi) { - SDL_VideoDisplay *display; + SDL_VideoDisplay *display; CHECK_DISPLAY_INDEX(displayIndex, -1); display = &_this->displays[displayIndex]; - if (_this->GetDisplayDPI) { - if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) { - return 0; - } + if (_this->GetDisplayDPI) { + if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) { + return 0; + } } else { return SDL_Unsupported(); } - return -1; + return -1; } SDL_bool @@ -1157,35 +1172,38 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) CHECK_WINDOW_MAGIC(window,-1); /* if we are in the process of hiding don't go back to fullscreen */ - if ( window->is_hiding && fullscreen ) + if (window->is_hiding && fullscreen) { return 0; + } #ifdef __MACOSX__ /* if the window is going away and no resolution change is necessary, - do nothing, or else we may trigger an ugly double-transition + do nothing, or else we may trigger an ugly double-transition */ - if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) - return 0; + if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ + if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) + return 0; - /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ - if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { - if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { - return -1; + /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ + if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { + if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { + return -1; + } + } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { + display = SDL_GetDisplayForWindow(window); + SDL_SetDisplayModeForDisplay(display, NULL); + if (_this->SetWindowFullscreen) { + _this->SetWindowFullscreen(_this, window, display, SDL_FALSE); + } } - } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { - display = SDL_GetDisplayForWindow(window); - SDL_SetDisplayModeForDisplay(display, NULL); - if (_this->SetWindowFullscreen) { - _this->SetWindowFullscreen(_this, window, display, SDL_FALSE); - } - } - if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) { - if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) { - return -1; + if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) { + if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) { + return -1; + } + window->last_fullscreen_flags = window->flags; + return 0; } - window->last_fullscreen_flags = window->flags; - return 0; } #elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen @@ -1304,7 +1322,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) } #define CREATE_FLAGS \ - (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP) + (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN) static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags) @@ -1338,7 +1356,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } - if ( (((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1 ) { + if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) { SDL_SetError("Conflicting window flags specified"); return NULL; } @@ -1359,7 +1377,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) /* Some platforms have OpenGL enabled by default */ #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__ - if (SDL_strcmp(_this->name, "dummy") != 0) { + if (!_this->is_dummy && !(flags & SDL_WINDOW_VULKAN)) { flags |= SDL_WINDOW_OPENGL; } #endif @@ -1373,6 +1391,21 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } + if (flags & SDL_WINDOW_VULKAN) { + if (!_this->Vulkan_CreateSurface) { + SDL_SetError("Vulkan support is either not configured in SDL " + "or not available in video driver"); + return NULL; + } + if (flags & SDL_WINDOW_OPENGL) { + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return NULL; + } + if (SDL_Vulkan_LoadLibrary(NULL) < 0) { + return NULL; + } + } + /* Unless the user has specified the high-DPI disabling hint, respect the * SDL_WINDOW_ALLOW_HIGHDPI flag. */ @@ -1439,7 +1472,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } _this->windows = window; - if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) { + if (_this->CreateSDLWindow && _this->CreateSDLWindow(_this, window) < 0) { SDL_DestroyWindow(window); return NULL; } @@ -1476,7 +1509,7 @@ SDL_CreateWindowFrom(const void *data) SDL_UninitializedVideo(); return NULL; } - if (!_this->CreateWindowFrom) { + if (!_this->CreateSDLWindowFrom) { SDL_Unsupported(); return NULL; } @@ -1498,7 +1531,7 @@ SDL_CreateWindowFrom(const void *data) } _this->windows = window; - if (_this->CreateWindowFrom(_this, window, data) < 0) { + if (_this->CreateSDLWindowFrom(_this, window, data) < 0) { SDL_DestroyWindow(window); return NULL; } @@ -1548,12 +1581,22 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } } + if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) { + SDL_SetError("Can't change SDL_WINDOW_VULKAN window flag"); + return -1; + } + + if ((window->flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) { + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return -1; + } + window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; - if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) { - if (_this->CreateWindow(_this, window) < 0) { + if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) { + if (_this->CreateSDLWindow(_this, window) < 0) { if (loaded_opengl) { SDL_GL_UnloadLibrary(); window->flags &= ~SDL_WINDOW_OPENGL; @@ -1583,6 +1626,12 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) return 0; } +SDL_bool +SDL_HasWindows(void) +{ + return (_this && _this->windows != NULL); +} + Uint32 SDL_GetWindowID(SDL_Window * window) { @@ -1738,7 +1787,7 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y) if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) { int displayIndex = (x & 0xFFFF); SDL_Rect bounds; - if (displayIndex > _this->num_displays) { + if (displayIndex >= _this->num_displays) { displayIndex = 0; } @@ -1867,20 +1916,16 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h) } /* Make sure we don't exceed any window size limits */ - if (window->min_w && w < window->min_w) - { + if (window->min_w && w < window->min_w) { w = window->min_w; } - if (window->max_w && w > window->max_w) - { + if (window->max_w && w > window->max_w) { w = window->max_w; } - if (window->min_h && h < window->min_h) - { + if (window->min_h && h < window->min_h) { h = window->min_h; } - if (window->max_h && h > window->max_h) - { + if (window->max_h && h > window->max_h) { h = window->max_h; } @@ -1917,30 +1962,6 @@ SDL_GetWindowSize(SDL_Window * window, int *w, int *h) } } -void -SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) -{ - CHECK_WINDOW_MAGIC(window,); - if (min_w <= 0) { - SDL_InvalidParamError("min_w"); - return; - } - if (min_h <= 0) { - SDL_InvalidParamError("min_h"); - return; - } - - if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { - window->min_w = min_w; - window->min_h = min_h; - if (_this->SetWindowMinimumSize) { - _this->SetWindowMinimumSize(_this, window); - } - /* Ensure that window is not smaller than minimal size */ - SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h)); - } -} - int SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right) { @@ -1963,6 +1984,37 @@ SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, return _this->GetWindowBordersSize(_this, window, top, left, bottom, right); } +void +SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) +{ + CHECK_WINDOW_MAGIC(window,); + if (min_w <= 0) { + SDL_InvalidParamError("min_w"); + return; + } + if (min_h <= 0) { + SDL_InvalidParamError("min_h"); + return; + } + + if ((window->max_w && min_w >= window->max_w) || + (window->max_h && min_h >= window->max_h)) { + SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size"); + return; + } + + window->min_w = min_w; + window->min_h = min_h; + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if (_this->SetWindowMinimumSize) { + _this->SetWindowMinimumSize(_this, window); + } + /* Ensure that window is not smaller than minimal size */ + SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h)); + } +} + void SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h) { @@ -1988,9 +2040,15 @@ SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h) return; } + if (max_w <= window->min_w || max_h <= window->min_h) { + SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size"); + return; + } + + window->max_w = max_w; + window->max_h = max_h; + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { - window->max_w = max_w; - window->max_h = max_h; if (_this->SetWindowMaximumSize) { _this->SetWindowMaximumSize(_this, window); } @@ -2035,13 +2093,13 @@ SDL_HideWindow(SDL_Window * window) return; } - window->is_hiding = SDL_TRUE; + window->is_hiding = SDL_TRUE; SDL_UpdateFullscreenMode(window, SDL_FALSE); if (_this->HideWindow) { _this->HideWindow(_this, window); } - window->is_hiding = SDL_FALSE; + window->is_hiding = SDL_FALSE; SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } @@ -2506,8 +2564,10 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window) } #ifdef __MACOSX__ - if (Cocoa_IsWindowInFullscreenSpace(window)) { - return SDL_FALSE; + if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ + if (Cocoa_IsWindowInFullscreenSpace(window)) { + return SDL_FALSE; + } } #endif @@ -2586,6 +2646,9 @@ SDL_DestroyWindow(SDL_Window * window) if (window->flags & SDL_WINDOW_OPENGL) { SDL_GL_UnloadLibrary(); } + if (window->flags & SDL_WINDOW_VULKAN) { + SDL_Vulkan_UnloadLibrary(); + } display = SDL_GetDisplayForWindow(window); if (display->fullscreen_window == window) { @@ -2777,11 +2840,13 @@ SDL_GL_UnloadLibrary(void) } } +#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) { return (verstr && (SDL_atoi(verstr) >= 3)); } +#endif SDL_bool SDL_GL_ExtensionSupported(const char *extension) @@ -2855,7 +2920,7 @@ SDL_GL_ExtensionSupported(const char *extension) break; terminator = where + SDL_strlen(extension); - if (where == start || *(where - 1) == ' ') + if (where == extensions || *(where - 1) == ' ') if (*terminator == ' ' || *terminator == '\0') return SDL_TRUE; @@ -2867,6 +2932,37 @@ SDL_GL_ExtensionSupported(const char *extension) #endif } +/* Deduce supported ES profile versions from the supported + ARB_ES*_compatibility extensions. There is no direct query. + + This is normally only called when the OpenGL driver supports + {GLX,WGL}_EXT_create_context_es2_profile. + */ +void +SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor) +{ +/* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */ +/* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */ +#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + /* XXX This is fragile; it will break in the event of release of + * new versions of OpenGL ES. + */ + if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) { + *major = 3; + *minor = 2; + } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) { + *major = 3; + *minor = 1; + } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) { + *major = 3; + *minor = 0; + } else { + *major = 2; + *minor = 0; + } +#endif +} + void SDL_GL_ResetAttributes() { @@ -2891,22 +2987,32 @@ SDL_GL_ResetAttributes() _this->gl_config.multisamplesamples = 0; _this->gl_config.retained_backing = 1; _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */ - _this->gl_config.profile_mask = 0; + + if (_this->GL_DefaultProfileConfig) { + _this->GL_DefaultProfileConfig(_this, &_this->gl_config.profile_mask, + &_this->gl_config.major_version, + &_this->gl_config.minor_version); + } else { #if SDL_VIDEO_OPENGL - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 1; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 1; + _this->gl_config.profile_mask = 0; #elif SDL_VIDEO_OPENGL_ES2 - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 0; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 0; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; #elif SDL_VIDEO_OPENGL_ES - _this->gl_config.major_version = 1; - _this->gl_config.minor_version = 1; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + _this->gl_config.major_version = 1; + _this->gl_config.minor_version = 1; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; #endif + } + _this->gl_config.flags = 0; _this->gl_config.framebuffer_srgb_capable = 0; + _this->gl_config.no_error = 0; _this->gl_config.release_behavior = SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH; + _this->gl_config.reset_notification = SDL_GL_CONTEXT_RESET_NO_NOTIFICATION; _this->gl_config.share_with_current_context = 0; } @@ -3016,6 +3122,12 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value) case SDL_GL_CONTEXT_RELEASE_BEHAVIOR: _this->gl_config.release_behavior = value; break; + case SDL_GL_CONTEXT_RESET_NOTIFICATION: + _this->gl_config.reset_notification = value; + break; + case SDL_GL_CONTEXT_NO_ERROR: + _this->gl_config.no_error = value; + break; default: retval = SDL_SetError("Unknown OpenGL attribute"); break; @@ -3047,9 +3159,17 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) GLenum attachmentattrib = 0; #endif + if (!value) { + return SDL_InvalidParamError("value"); + } + /* Clear value in any case */ *value = 0; + if (!_this) { + return SDL_UninitializedVideo(); + } + switch (attr) { case SDL_GL_RED_SIZE: #if SDL_VIDEO_OPENGL @@ -3212,6 +3332,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) *value = _this->gl_config.framebuffer_srgb_capable; return 0; } + case SDL_GL_CONTEXT_NO_ERROR: + { + *value = _this->gl_config.no_error; + return 0; + } default: return SDL_SetError("Unknown OpenGL attribute"); } @@ -3219,7 +3344,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) #if SDL_VIDEO_OPENGL glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { - return SDL_SetError("Failed getting OpenGL glGetString entry point"); + return -1; } if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) { @@ -3228,7 +3353,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) if (glGetFramebufferAttachmentParameterivFunc) { glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value); } else { - return SDL_SetError("Failed getting OpenGL glGetFramebufferAttachmentParameteriv entry point"); + return -1; } } else #endif @@ -3238,13 +3363,13 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) if (glGetIntegervFunc) { glGetIntegervFunc(attrib, (GLint *) value); } else { - return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point"); + return -1; } } glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); if (!glGetErrorFunc) { - return SDL_SetError("Failed getting OpenGL glGetError entry point"); + return -1; } error = glGetErrorFunc(); @@ -3617,8 +3742,9 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "x11/SDL_x11messagebox.h" #endif -// This function will be unused if none of the above video drivers are present. -SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) + +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 +static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; SDL_Window *window = messageboxdata->window; @@ -3634,6 +3760,7 @@ SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData return (info.subsystem == drivertype); } } +#endif int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) @@ -3780,15 +3907,171 @@ SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, void *userdata) return 0; } -float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches) +float +SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches) { - float den2 = hinches * hinches + vinches * vinches; - if ( den2 <= 0.0f ) { - return 0.0f; - } - - return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) / - SDL_sqrt((double)den2)); + float den2 = hinches * hinches + vinches * vinches; + if (den2 <= 0.0f) { + return 0.0f; + } + + return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) / + SDL_sqrt((double)den2)); +} + +/* + * Functions used by iOS application delegates + */ +void SDL_OnApplicationWillTerminate(void) +{ + SDL_SendAppEvent(SDL_APP_TERMINATING); +} + +void SDL_OnApplicationDidReceiveMemoryWarning(void) +{ + SDL_SendAppEvent(SDL_APP_LOWMEMORY); +} + +void SDL_OnApplicationWillResignActive(void) +{ + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + } + } + SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); +} + +void SDL_OnApplicationDidEnterBackground(void) +{ + SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); +} + +void SDL_OnApplicationWillEnterForeground(void) +{ + SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); +} + +void SDL_OnApplicationDidBecomeActive(void) +{ + SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); + + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); + } + } +} + +#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window" + +int SDL_Vulkan_LoadLibrary(const char *path) +{ + int retval; + if (!_this) { + SDL_UninitializedVideo(); + return -1; + } + if (_this->vulkan_config.loader_loaded) { + if (path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0) { + return SDL_SetError("Vulkan loader library already loaded"); + } + retval = 0; + } else { + if (!_this->Vulkan_LoadLibrary) { + return SDL_SetError("No Vulkan support in video driver"); + } + retval = _this->Vulkan_LoadLibrary(_this, path); + } + if (retval == 0) { + _this->vulkan_config.loader_loaded++; + } + return retval; +} + +void *SDL_Vulkan_GetVkGetInstanceProcAddr(void) +{ + if (!_this) { + SDL_UninitializedVideo(); + return NULL; + } + if (!_this->vulkan_config.loader_loaded) { + SDL_SetError("No Vulkan loader has been loaded"); + return NULL; + } + return _this->vulkan_config.vkGetInstanceProcAddr; +} + +void SDL_Vulkan_UnloadLibrary(void) +{ + if (!_this) { + SDL_UninitializedVideo(); + return; + } + if (_this->vulkan_config.loader_loaded > 0) { + if (--_this->vulkan_config.loader_loaded > 0) { + return; + } + if (_this->Vulkan_UnloadLibrary) { + _this->Vulkan_UnloadLibrary(_this); + } + } +} + +SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names) +{ + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (!(window->flags & SDL_WINDOW_VULKAN)) { + SDL_SetError(NOT_A_VULKAN_WINDOW); + return SDL_FALSE; + } + + if (!count) { + SDL_InvalidParamError("count"); + return SDL_FALSE; + } + + return _this->Vulkan_GetInstanceExtensions(_this, window, count, names); +} + +SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (!(window->flags & SDL_WINDOW_VULKAN)) { + SDL_SetError(NOT_A_VULKAN_WINDOW); + return SDL_FALSE; + } + + if (!instance) { + SDL_InvalidParamError("instance"); + return SDL_FALSE; + } + + if (!surface) { + SDL_InvalidParamError("surface"); + return SDL_FALSE; + } + + return _this->Vulkan_CreateSurface(_this, window, instance, surface); +} + +void SDL_Vulkan_GetDrawableSize(SDL_Window * window, int *w, int *h) +{ + CHECK_WINDOW_MAGIC(window,); + + if (_this->Vulkan_GetDrawableSize) { + _this->Vulkan_GetDrawableSize(_this, window, w, h); + } else { + SDL_GetWindowSize(window, w, h); + } } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_vulkan_internal.h b/Engine/lib/sdl/src/video/SDL_vulkan_internal.h new file mode 100644 index 000000000..cdf464ee0 --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_vulkan_internal.h @@ -0,0 +1,91 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_vulkan_internal_h_ +#define SDL_vulkan_internal_h_ + +#include "../SDL_internal.h" + +#include "SDL_stdinc.h" + +#if defined(SDL_LOADSO_DISABLED) +#undef SDL_VIDEO_VULKAN +#define SDL_VIDEO_VULKAN 0 +#endif + +#if SDL_VIDEO_VULKAN + +#if SDL_VIDEO_DRIVER_ANDROID +#define VK_USE_PLATFORM_ANDROID_KHR +#endif +#if SDL_VIDEO_DRIVER_COCOA +#define VK_USE_PLATFORM_MACOS_MVK +#endif +#if SDL_VIDEO_DRIVER_MIR +#define VK_USE_PLATFORM_MIR_KHR +#endif +#if SDL_VIDEO_DRIVER_UIKIT +#define VK_USE_PLATFORM_IOS_MVK +#endif +#if SDL_VIDEO_DRIVER_WAYLAND +#define VK_USE_PLATFORM_WAYLAND_KHR +#include "wayland/SDL_waylanddyn.h" +#endif +#if SDL_VIDEO_DRIVER_WINDOWS +#define VK_USE_PLATFORM_WIN32_KHR +#include "../core/windows/SDL_windows.h" +#endif +#if SDL_VIDEO_DRIVER_X11 +#define VK_USE_PLATFORM_XLIB_KHR +#define VK_USE_PLATFORM_XCB_KHR +#endif + +#define VK_NO_PROTOTYPES +#include "./khronos/vulkan/vulkan.h" + +#include "SDL_vulkan.h" + + +extern const char *SDL_Vulkan_GetResultString(VkResult result); + +extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties, + Uint32 *extensionCount); /* free returned list with SDL_free */ + +/* Implements functionality of SDL_Vulkan_GetInstanceExtensions for a list of + * names passed in nameCount and names. */ +extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, + const char **userNames, + unsigned nameCount, + const char *const *names); + +#else + +/* No SDL Vulkan support, just include the header for typedefs */ +#include "SDL_vulkan.h" + +typedef void (*PFN_vkGetInstanceProcAddr) (void); +typedef int (*PFN_vkEnumerateInstanceExtensionProperties) (void); + +#endif /* SDL_VIDEO_VULKAN */ + +#endif /* SDL_vulkan_internal_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_vulkan_utils.c b/Engine/lib/sdl/src/video/SDL_vulkan_utils.c new file mode 100644 index 000000000..d4cbed4d9 --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_vulkan_utils.c @@ -0,0 +1,172 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_vulkan_internal.h" +#include "SDL_error.h" + +#if SDL_VIDEO_VULKAN + +const char *SDL_Vulkan_GetResultString(VkResult result) +{ + switch((int)result) + { + case VK_SUCCESS: + return "VK_SUCCESS"; + case VK_NOT_READY: + return "VK_NOT_READY"; + case VK_TIMEOUT: + return "VK_TIMEOUT"; + case VK_EVENT_SET: + return "VK_EVENT_SET"; + case VK_EVENT_RESET: + return "VK_EVENT_RESET"; + case VK_INCOMPLETE: + return "VK_INCOMPLETE"; + case VK_ERROR_OUT_OF_HOST_MEMORY: + return "VK_ERROR_OUT_OF_HOST_MEMORY"; + case VK_ERROR_OUT_OF_DEVICE_MEMORY: + return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; + case VK_ERROR_INITIALIZATION_FAILED: + return "VK_ERROR_INITIALIZATION_FAILED"; + case VK_ERROR_DEVICE_LOST: + return "VK_ERROR_DEVICE_LOST"; + case VK_ERROR_MEMORY_MAP_FAILED: + return "VK_ERROR_MEMORY_MAP_FAILED"; + case VK_ERROR_LAYER_NOT_PRESENT: + return "VK_ERROR_LAYER_NOT_PRESENT"; + case VK_ERROR_EXTENSION_NOT_PRESENT: + return "VK_ERROR_EXTENSION_NOT_PRESENT"; + case VK_ERROR_FEATURE_NOT_PRESENT: + return "VK_ERROR_FEATURE_NOT_PRESENT"; + case VK_ERROR_INCOMPATIBLE_DRIVER: + return "VK_ERROR_INCOMPATIBLE_DRIVER"; + case VK_ERROR_TOO_MANY_OBJECTS: + return "VK_ERROR_TOO_MANY_OBJECTS"; + case VK_ERROR_FORMAT_NOT_SUPPORTED: + return "VK_ERROR_FORMAT_NOT_SUPPORTED"; + case VK_ERROR_FRAGMENTED_POOL: + return "VK_ERROR_FRAGMENTED_POOL"; + case VK_ERROR_SURFACE_LOST_KHR: + return "VK_ERROR_SURFACE_LOST_KHR"; + case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: + return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; + case VK_SUBOPTIMAL_KHR: + return "VK_SUBOPTIMAL_KHR"; + case VK_ERROR_OUT_OF_DATE_KHR: + return "VK_ERROR_OUT_OF_DATE_KHR"; + case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: + return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; + case VK_ERROR_VALIDATION_FAILED_EXT: + return "VK_ERROR_VALIDATION_FAILED_EXT"; + case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: + return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; + case VK_ERROR_INVALID_SHADER_NV: + return "VK_ERROR_INVALID_SHADER_NV"; + case VK_RESULT_MAX_ENUM: + case VK_RESULT_RANGE_SIZE: + break; + } + if(result < 0) + return "VK_ERROR_"; + return "VK_"; +} + +VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties, + Uint32 *extensionCount) +{ + Uint32 count = 0; + VkResult result = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL); + VkExtensionProperties *retval; + if(result == VK_ERROR_INCOMPATIBLE_DRIVER) + { + /* Avoid the ERR_MAX_STRLEN limit by passing part of the message + * as a string argument. + */ + SDL_SetError( + "You probably don't have a working Vulkan driver installed. %s %s %s(%d)", + "Getting Vulkan extensions failed:", + "vkEnumerateInstanceExtensionProperties returned", + SDL_Vulkan_GetResultString(result), + (int)result); + return NULL; + } + else if(result != VK_SUCCESS) + { + SDL_SetError( + "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned " + "%s(%d)", + SDL_Vulkan_GetResultString(result), + (int)result); + return NULL; + } + if(count == 0) + { + retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null + } + else + { + retval = SDL_calloc(count, sizeof(VkExtensionProperties)); + } + if(!retval) + { + SDL_OutOfMemory(); + return NULL; + } + result = vkEnumerateInstanceExtensionProperties(NULL, &count, retval); + if(result != VK_SUCCESS) + { + SDL_SetError( + "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned " + "%s(%d)", + SDL_Vulkan_GetResultString(result), + (int)result); + SDL_free(retval); + return NULL; + } + *extensionCount = count; + return retval; +} + +SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, + const char **userNames, + unsigned nameCount, + const char *const *names) +{ + if (userNames) { + unsigned i; + + if (*userCount < nameCount) { + SDL_SetError("Output array for SDL_Vulkan_GetInstanceExtensions needs to be at least %d big", nameCount); + return SDL_FALSE; + } + for (i = 0; i < nameCount; i++) { + userNames[i] = names[i]; + } + } + *userCount = nameCount; + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_yuv.c b/Engine/lib/sdl/src/video/SDL_yuv.c new file mode 100644 index 000000000..50910a5f7 --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_yuv.c @@ -0,0 +1,1834 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_endian.h" +#include "SDL_video.h" +#include "SDL_pixels_c.h" + +#include "yuv2rgb/yuv_rgb.h" + +#define SDL_YUV_SD_THRESHOLD 576 + + +static SDL_YUV_CONVERSION_MODE SDL_YUV_ConversionMode = SDL_YUV_CONVERSION_BT601; + + +void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode) +{ + SDL_YUV_ConversionMode = mode; +} + +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode() +{ + return SDL_YUV_ConversionMode; +} + +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int height) +{ + SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionMode(); + if (mode == SDL_YUV_CONVERSION_AUTOMATIC) { + if (height <= SDL_YUV_SD_THRESHOLD) { + mode = SDL_YUV_CONVERSION_BT601; + } else { + mode = SDL_YUV_CONVERSION_BT709; + } + } + return mode; +} + +static int GetYUVConversionType(int width, int height, YCbCrType *yuv_type) +{ + switch (SDL_GetYUVConversionModeForResolution(width, height)) { + case SDL_YUV_CONVERSION_JPEG: + *yuv_type = YCBCR_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + *yuv_type = YCBCR_601; + break; + case SDL_YUV_CONVERSION_BT709: + *yuv_type = YCBCR_709; + break; + default: + return SDL_SetError("Unexpected YUV conversion mode"); + } + return 0; +} + +static SDL_bool IsPlanar2x2Format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YV12 || + format == SDL_PIXELFORMAT_IYUV || + format == SDL_PIXELFORMAT_NV12 || + format == SDL_PIXELFORMAT_NV21); +} + +static SDL_bool IsPacked4Format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YUY2 || + format == SDL_PIXELFORMAT_UYVY || + format == SDL_PIXELFORMAT_YVYU); +} + +static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch, + const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride) +{ + const Uint8 *planes[3] = { NULL, NULL, NULL }; + int pitches[3] = { 0, 0, 0 }; + + switch (format) { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + pitches[0] = yuv_pitch; + pitches[1] = (pitches[0] + 1) / 2; + pitches[2] = (pitches[0] + 1) / 2; + planes[0] = (const Uint8 *)yuv; + planes[1] = planes[0] + pitches[0] * height; + planes[2] = planes[1] + pitches[1] * ((height + 1) / 2); + break; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + pitches[0] = yuv_pitch; + planes[0] = (const Uint8 *)yuv; + break; + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + pitches[0] = yuv_pitch; + pitches[1] = 2 * ((pitches[0] + 1) / 2); + planes[0] = (const Uint8 *)yuv; + planes[1] = planes[0] + pitches[0] * height; + break; + default: + return SDL_SetError("GetYUVPlanes(): Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); + } + + switch (format) { + case SDL_PIXELFORMAT_YV12: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[1]; + *u = planes[2]; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_IYUV: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[2]; + *u = planes[1]; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_YUY2: + *y = planes[0]; + *y_stride = pitches[0]; + *v = *y + 3; + *u = *y + 1; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_UYVY: + *y = planes[0] + 1; + *y_stride = pitches[0]; + *v = *y + 1; + *u = *y - 1; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_YVYU: + *y = planes[0]; + *y_stride = pitches[0]; + *v = *y + 1; + *u = *y + 3; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_NV12: + *y = planes[0]; + *y_stride = pitches[0]; + *u = planes[1]; + *v = *u + 1; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_NV21: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[1]; + *u = *v + 1; + *uv_stride = pitches[1]; + break; + default: + /* Should have caught this above */ + return SDL_SetError("GetYUVPlanes[2]: Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); + } + return 0; +} + +static SDL_bool yuv_rgb_sse( + Uint32 src_format, Uint32 dst_format, + Uint32 width, Uint32 height, + const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, + Uint8 *rgb, Uint32 rgb_stride, + YCbCrType yuv_type) +{ +#ifdef __SSE2__ + if (!SDL_HasSSE2()) { + return SDL_FALSE; + } + + if (src_format == SDL_PIXELFORMAT_YV12 || + src_format == SDL_PIXELFORMAT_IYUV) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv420_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv420_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv420_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv420_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv420_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv420_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_YUY2 || + src_format == SDL_PIXELFORMAT_UYVY || + src_format == SDL_PIXELFORMAT_YVYU) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv422_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv422_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv422_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv422_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv422_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv422_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_NV12 || + src_format == SDL_PIXELFORMAT_NV21) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuvnv12_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuvnv12_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuvnv12_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuvnv12_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuvnv12_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuvnv12_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } +#endif + return SDL_FALSE; +} + +static SDL_bool yuv_rgb_std( + Uint32 src_format, Uint32 dst_format, + Uint32 width, Uint32 height, + const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, + Uint8 *rgb, Uint32 rgb_stride, + YCbCrType yuv_type) +{ + if (src_format == SDL_PIXELFORMAT_YV12 || + src_format == SDL_PIXELFORMAT_IYUV) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv420_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv420_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv420_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv420_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv420_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv420_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_YUY2 || + src_format == SDL_PIXELFORMAT_UYVY || + src_format == SDL_PIXELFORMAT_YVYU) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv422_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv422_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv422_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv422_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv422_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv422_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_NV12 || + src_format == SDL_PIXELFORMAT_NV21) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuvnv12_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuvnv12_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuvnv12_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuvnv12_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuvnv12_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuvnv12_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + return SDL_FALSE; +} + +int +SDL_ConvertPixels_YUV_to_RGB(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + const Uint8 *y = NULL; + const Uint8 *u = NULL; + const Uint8 *v = NULL; + Uint32 y_stride = 0; + Uint32 uv_stride = 0; + YCbCrType yuv_type = YCBCR_601; + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, &y, &u, &v, &y_stride, &uv_stride) < 0) { + return -1; + } + + if (GetYUVConversionType(width, height, &yuv_type) < 0) { + return -1; + } + + if (yuv_rgb_sse(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { + return 0; + } + + if (yuv_rgb_std(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { + return 0; + } + + /* No fast path for the RGB format, instead convert using an intermediate buffer */ + if (dst_format != SDL_PIXELFORMAT_ARGB8888) { + int ret; + void *tmp; + int tmp_pitch = (width * sizeof(Uint32)); + + tmp = SDL_malloc(tmp_pitch * height); + if (tmp == NULL) { + return SDL_OutOfMemory(); + } + + /* convert src/src_format to tmp/ARGB8888 */ + ret = SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch); + if (ret < 0) { + SDL_free(tmp); + return ret; + } + + /* convert tmp/ARGB8888 to dst/RGB */ + ret = SDL_ConvertPixels(width, height, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch, dst_format, dst, dst_pitch); + SDL_free(tmp); + return ret; + } + + return SDL_SetError("Unsupported YUV conversion"); +} + +struct RGB2YUVFactors +{ + int y_offset; + float y[3]; /* Rfactor, Gfactor, Bfactor */ + float u[3]; /* Rfactor, Gfactor, Bfactor */ + float v[3]; /* Rfactor, Gfactor, Bfactor */ +}; + +static int +SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch) +{ + const int src_pitch_x_2 = src_pitch * 2; + const int height_half = height / 2; + const int height_remainder = (height & 0x1); + const int width_half = width / 2; + const int width_remainder = (width & 0x1); + int i, j; + + static struct RGB2YUVFactors RGB2YUVFactorTables[SDL_YUV_CONVERSION_BT709 + 1] = + { + /* ITU-T T.871 (JPEG) */ + { + 0, + { 0.2990f, 0.5870f, 0.1140f }, + { -0.1687f, -0.3313f, 0.5000f }, + { 0.5000f, -0.4187f, -0.0813f }, + }, + /* ITU-R BT.601-7 */ + { + 16, + { 0.2568f, 0.5041f, 0.0979f }, + { -0.1482f, -0.2910f, 0.4392f }, + { 0.4392f, -0.3678f, -0.0714f }, + }, + /* ITU-R BT.709-6 */ + { + 16, + { 0.1826f, 0.6142f, 0.0620f }, + {-0.1006f, -0.3386f, 0.4392f }, + { 0.4392f, -0.3989f, -0.0403f }, + }, + }; + const struct RGB2YUVFactors *cvt = &RGB2YUVFactorTables[SDL_GetYUVConversionModeForResolution(width, height)]; + +#define MAKE_Y(r, g, b) (Uint8)((int)(cvt->y[0] * (r) + cvt->y[1] * (g) + cvt->y[2] * (b) + 0.5f) + cvt->y_offset) +#define MAKE_U(r, g, b) (Uint8)((int)(cvt->u[0] * (r) + cvt->u[1] * (g) + cvt->u[2] * (b) + 0.5f) + 128) +#define MAKE_V(r, g, b) (Uint8)((int)(cvt->v[0] * (r) + cvt->v[1] * (g) + cvt->v[2] * (b) + 0.5f) + 128) + +#define READ_2x2_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 p3 = ((const Uint32 *)next_row)[2 * i]; \ + const Uint32 p4 = ((const Uint32 *)next_row)[2 * i + 1]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000) + (p3 & 0x00ff0000) + (p4 & 0x00ff0000)) >> 18; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00) + (p3 & 0x0000ff00) + (p4 & 0x0000ff00)) >> 10; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff) + (p3 & 0x000000ff) + (p4 & 0x000000ff)) >> 2; \ + +#define READ_2x1_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)next_row)[2 * i]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \ + +#define READ_1x2_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \ + +#define READ_1x1_PIXEL \ + const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 r = (p & 0x00ff0000) >> 16; \ + const Uint32 g = (p & 0x0000ff00) >> 8; \ + const Uint32 b = (p & 0x000000ff); \ + +#define READ_TWO_RGB_PIXELS \ + const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 r = (p & 0x00ff0000) >> 16; \ + const Uint32 g = (p & 0x0000ff00) >> 8; \ + const Uint32 b = (p & 0x000000ff); \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 r1 = (p1 & 0x00ff0000) >> 16; \ + const Uint32 g1 = (p1 & 0x0000ff00) >> 8; \ + const Uint32 b1 = (p1 & 0x000000ff); \ + const Uint32 R = (r + r1)/2; \ + const Uint32 G = (g + g1)/2; \ + const Uint32 B = (b + b1)/2; \ + +#define READ_ONE_RGB_PIXEL READ_1x1_PIXEL + + switch (dst_format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + { + const Uint8 *curr_row, *next_row; + + Uint8 *plane_y; + Uint8 *plane_u; + Uint8 *plane_v; + Uint8 *plane_interleaved_uv; + Uint32 y_stride, uv_stride, y_skip, uv_skip; + + GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v, + &y_stride, &uv_stride); + plane_interleaved_uv = (plane_y + height * y_stride); + y_skip = (y_stride - width); + + curr_row = (const Uint8*)src; + + /* Write Y plane */ + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { + const Uint32 p1 = ((const Uint32 *)curr_row)[i]; + const Uint32 r = (p1 & 0x00ff0000) >> 16; + const Uint32 g = (p1 & 0x0000ff00) >> 8; + const Uint32 b = (p1 & 0x000000ff); + *plane_y++ = MAKE_Y(r, g, b); + } + plane_y += y_skip; + curr_row += src_pitch; + } + + curr_row = (const Uint8*)src; + next_row = (const Uint8*)src; + next_row += src_pitch; + + if (dst_format == SDL_PIXELFORMAT_YV12 || dst_format == SDL_PIXELFORMAT_IYUV) + { + /* Write UV planes, not interleaved */ + uv_skip = (uv_stride - (width + 1)/2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + plane_u += uv_skip; + plane_v += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + plane_u += uv_skip; + plane_v += uv_skip; + } + } + else if (dst_format == SDL_PIXELFORMAT_NV12) + { + uv_skip = (uv_stride - ((width + 1)/2)*2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + plane_interleaved_uv += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + } + } + else /* dst_format == SDL_PIXELFORMAT_NV21 */ + { + uv_skip = (uv_stride - ((width + 1)/2)*2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + plane_interleaved_uv += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + } + } + } + break; + + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + { + const Uint8 *curr_row = (const Uint8*) src; + Uint8 *plane = (Uint8*) dst; + const int row_size = (4 * ((width + 1) / 2)); + int plane_skip; + + if (dst_pitch < row_size) { + return SDL_SetError("Destination pitch is too small, expected at least %d\n", row_size); + } + plane_skip = (dst_pitch - row_size); + + /* Write YUV plane, packed */ + if (dst_format == SDL_PIXELFORMAT_YUY2) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* Y U Y1 V */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + *plane++ = MAKE_V(R, G, B); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* Y U Y V */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + else if (dst_format == SDL_PIXELFORMAT_UYVY) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* U Y V Y1 */ + *plane++ = MAKE_U(R, G, B); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* U Y V Y */ + *plane++ = MAKE_U(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + *plane++ = MAKE_Y(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + else if (dst_format == SDL_PIXELFORMAT_YVYU) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* Y V Y1 U */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + *plane++ = MAKE_U(R, G, B); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* Y V Y U */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + } + break; + + default: + return SDL_SetError("Unsupported YUV destination format: %s", SDL_GetPixelFormatName(dst_format)); + } +#undef MAKE_Y +#undef MAKE_U +#undef MAKE_V +#undef READ_2x2_PIXELS +#undef READ_2x1_PIXELS +#undef READ_1x2_PIXELS +#undef READ_1x1_PIXEL +#undef READ_TWO_RGB_PIXELS +#undef READ_ONE_RGB_PIXEL + return 0; +} + +int +SDL_ConvertPixels_RGB_to_YUV(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ +#if 0 /* Doesn't handle odd widths */ + /* RGB24 to FOURCC */ + if (src_format == SDL_PIXELFORMAT_RGB24) { + Uint8 *y; + Uint8 *u; + Uint8 *v; + Uint32 y_stride; + Uint32 uv_stride; + YCbCrType yuv_type; + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, (const Uint8 **)&y, (const Uint8 **)&u, (const Uint8 **)&v, &y_stride, &uv_stride) < 0) { + return -1; + } + + if (GetYUVConversionType(width, height, &yuv_type) < 0) { + return -1; + } + + rgb24_yuv420_std(width, height, src, src_pitch, y, u, v, y_stride, uv_stride, yuv_type); + return 0; + } +#endif + + /* ARGB8888 to FOURCC */ + if (src_format == SDL_PIXELFORMAT_ARGB8888) { + return SDL_ConvertPixels_ARGB8888_to_YUV(width, height, src, src_pitch, dst_format, dst, dst_pitch); + } + + /* not ARGB8888 to FOURCC : need an intermediate conversion */ + { + int ret; + void *tmp; + int tmp_pitch = (width * sizeof(Uint32)); + + tmp = SDL_malloc(tmp_pitch * height); + if (tmp == NULL) { + return SDL_OutOfMemory(); + } + + /* convert src/src_format to tmp/ARGB8888 */ + ret = SDL_ConvertPixels(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch); + if (ret == -1) { + SDL_free(tmp); + return ret; + } + + /* convert tmp/ARGB8888 to dst/FOURCC */ + ret = SDL_ConvertPixels_ARGB8888_to_YUV(width, height, tmp, tmp_pitch, dst_format, dst, dst_pitch); + SDL_free(tmp); + return ret; + } +} + +static int +SDL_ConvertPixels_YUV_to_YUV_Copy(int width, int height, Uint32 format, + const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int i; + + if (IsPlanar2x2Format(format)) { + /* Y plane */ + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + + if (format == SDL_PIXELFORMAT_YV12 || format == SDL_PIXELFORMAT_IYUV) { + /* U and V planes are a quarter the size of the Y plane, rounded up */ + width = (width + 1) / 2; + height = (height + 1) / 2; + src_pitch = (src_pitch + 1) / 2; + dst_pitch = (dst_pitch + 1) / 2; + for (i = height * 2; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + } else if (format == SDL_PIXELFORMAT_NV12 || format == SDL_PIXELFORMAT_NV21) { + /* U/V plane is half the height of the Y plane, rounded up */ + height = (height + 1) / 2; + width = ((width + 1) / 2)*2; + src_pitch = ((src_pitch + 1) / 2)*2; + dst_pitch = ((dst_pitch + 1) / 2)*2; + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + } + return 0; + } + + if (IsPacked4Format(format)) { + /* Packed planes */ + width = 4 * ((width + 1) / 2); + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + return 0; + } + + return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV_Copy: Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); +} + +static int +SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + int UVpitch = (dst_pitch + 1)/2; + Uint8 *tmp; + Uint8 *row1 = dst; + Uint8 *row2 = (Uint8 *)dst + UVheight * UVpitch; + + /* Allocate a temporary row for the swap */ + tmp = (Uint8 *)SDL_malloc(UVwidth); + if (!tmp) { + return SDL_OutOfMemory(); + } + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(tmp, row1, UVwidth); + SDL_memcpy(row1, row2, UVwidth); + SDL_memcpy(row2, tmp, UVwidth); + row1 += UVpitch; + row2 += UVpitch; + } + SDL_free(tmp); + } else { + const Uint8 *srcUV; + Uint8 *dstUV; + int srcUVPitch = ((src_pitch + 1)/2); + int dstUVPitch = ((dst_pitch + 1)/2); + + /* Copy the first plane */ + srcUV = (const Uint8 *)src; + dstUV = (Uint8 *)dst + UVheight * dstUVPitch; + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(dstUV, srcUV, UVwidth); + srcUV += srcUVPitch; + dstUV += dstUVPitch; + } + + /* Copy the second plane */ + dstUV = (Uint8 *)dst; + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(dstUV, srcUV, UVwidth); + srcUV += srcUVPitch; + dstUV += dstUVPitch; + } + } + return 0; +} + +static int +SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2); + const int srcUVPitchLeft = srcUVPitch - UVwidth; + const int dstUVPitch = ((dst_pitch + 1)/2)*2; + const int dstUVPitchLeft = dstUVPitch - UVwidth*2; + const Uint8 *src1, *src2; + Uint8 *dstUV; + Uint8 *tmp = NULL; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + /* Need to make a copy of the buffer so we don't clobber it while converting */ + tmp = (Uint8 *)SDL_malloc(2*UVheight*srcUVPitch); + if (!tmp) { + return SDL_OutOfMemory(); + } + SDL_memcpy(tmp, src, 2*UVheight*srcUVPitch); + src = tmp; + } + + if (reverseUV) { + src2 = (const Uint8 *)src; + src1 = src2 + UVheight * srcUVPitch; + } else { + src1 = (const Uint8 *)src; + src2 = src1 + UVheight * srcUVPitch; + } + dstUV = (Uint8 *)dst; + + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + while (x >= 16) { + __m128i u = _mm_loadu_si128((__m128i *)src1); + __m128i v = _mm_loadu_si128((__m128i *)src2); + __m128i uv1 = _mm_unpacklo_epi8(u, v); + __m128i uv2 = _mm_unpackhi_epi8(u, v); + _mm_storeu_si128((__m128i*)dstUV, uv1); + _mm_storeu_si128((__m128i*)(dstUV + 16), uv2); + src1 += 16; + src2 += 16; + dstUV += 32; + x -= 16; + } + } +#endif + while (x--) { + *dstUV++ = *src1++; + *dstUV++ = *src2++; + } + src1 += srcUVPitchLeft; + src2 += srcUVPitchLeft; + dstUV += dstUVPitchLeft; + } + + if (tmp) { + SDL_free(tmp); + } + return 0; +} + +static int +SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2)*2; + const int srcUVPitchLeft = srcUVPitch - UVwidth*2; + const int dstUVPitch = ((dst_pitch + 1)/2); + const int dstUVPitchLeft = dstUVPitch - UVwidth; + const Uint8 *srcUV; + Uint8 *dst1, *dst2; + Uint8 *tmp = NULL; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + /* Need to make a copy of the buffer so we don't clobber it while converting */ + tmp = (Uint8 *)SDL_malloc(UVheight*srcUVPitch); + if (!tmp) { + return SDL_OutOfMemory(); + } + SDL_memcpy(tmp, src, UVheight*srcUVPitch); + src = tmp; + } + + if (reverseUV) { + dst2 = (Uint8 *)dst; + dst1 = dst2 + UVheight * dstUVPitch; + } else { + dst1 = (Uint8 *)dst; + dst2 = dst1 + UVheight * dstUVPitch; + } + srcUV = (const Uint8 *)src; + + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + __m128i mask = _mm_set1_epi16(0x00FF); + while (x >= 16) { + __m128i uv1 = _mm_loadu_si128((__m128i*)srcUV); + __m128i uv2 = _mm_loadu_si128((__m128i*)(srcUV+16)); + __m128i u1 = _mm_and_si128(uv1, mask); + __m128i u2 = _mm_and_si128(uv2, mask); + __m128i u = _mm_packus_epi16(u1, u2); + __m128i v1 = _mm_srli_epi16(uv1, 8); + __m128i v2 = _mm_srli_epi16(uv2, 8); + __m128i v = _mm_packus_epi16(v1, v2); + _mm_storeu_si128((__m128i*)dst1, u); + _mm_storeu_si128((__m128i*)dst2, v); + srcUV += 32; + dst1 += 16; + dst2 += 16; + x -= 16; + } + } +#endif + while (x--) { + *dst1++ = *srcUV++; + *dst2++ = *srcUV++; + } + srcUV += srcUVPitchLeft; + dst1 += dstUVPitchLeft; + dst2 += dstUVPitchLeft; + } + + if (tmp) { + SDL_free(tmp); + } + return 0; +} + +static int +SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2)*2; + const int srcUVPitchLeft = (srcUVPitch - UVwidth*2)/sizeof(Uint16); + const int dstUVPitch = ((dst_pitch + 1)/2)*2; + const int dstUVPitchLeft = (dstUVPitch - UVwidth*2)/sizeof(Uint16); + const Uint16 *srcUV; + Uint16 *dstUV; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + srcUV = (const Uint16 *)src; + dstUV = (Uint16 *)dst; + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + while (x >= 8) { + __m128i uv = _mm_loadu_si128((__m128i*)srcUV); + __m128i v = _mm_slli_epi16(uv, 8); + __m128i u = _mm_srli_epi16(uv, 8); + __m128i vu = _mm_or_si128(v, u); + _mm_storeu_si128((__m128i*)dstUV, vu); + srcUV += 8; + dstUV += 8; + x -= 8; + } + } +#endif + while (x--) { + *dstUV++ = SDL_Swap16(*srcUV++); + } + srcUV += srcUVPitchLeft; + dstUV += dstUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + if (src != dst) { + /* Copy Y plane */ + int i; + const Uint8 *srcY = (const Uint8 *)src; + Uint8 *dstY = (Uint8 *)dst; + for (i = height; i--; ) { + SDL_memcpy(dstY, srcY, width); + srcY += src_pitch; + dstY += dst_pitch; + } + } + + switch (src_format) { + case SDL_PIXELFORMAT_YV12: + switch (dst_format) { + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + default: + break; + } + break; + case SDL_PIXELFORMAT_IYUV: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + default: + break; + } + break; + case SDL_PIXELFORMAT_NV12: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_NV21: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + default: + break; + } + return SDL_SetError("SDL_ConvertPixels_Planar2x2_to_Planar2x2: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); +} + +#define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \ + while (x >= 4) { \ + __m128i yuv = _mm_loadu_si128((__m128i*)srcYUV); \ + __m128i lo = _mm_unpacklo_epi8(yuv, _mm_setzero_si128()); \ + __m128i hi = _mm_unpackhi_epi8(yuv, _mm_setzero_si128()); \ + lo = _mm_shufflelo_epi16(lo, shuffle); \ + lo = _mm_shufflehi_epi16(lo, shuffle); \ + hi = _mm_shufflelo_epi16(hi, shuffle); \ + hi = _mm_shufflehi_epi16(hi, shuffle); \ + yuv = _mm_packus_epi16(lo, hi); \ + _mm_storeu_si128((__m128i*)dstYUV, yuv); \ + srcYUV += 16; \ + dstYUV += 16; \ + x -= 4; \ + } \ + +static int +SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + U = srcYUV[1]; + Y2 = srcYUV[2]; + V = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = U; + dstYUV[1] = Y1; + dstYUV[2] = V; + dstYUV[3] = Y2; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + U = srcYUV[1]; + Y2 = srcYUV[2]; + V = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = V; + dstYUV[2] = Y2; + dstYUV[3] = U; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + U = srcYUV[0]; + Y1 = srcYUV[1]; + V = srcYUV[2]; + Y2 = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = U; + dstYUV[2] = Y2; + dstYUV[3] = V; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(0, 3, 2, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + U = srcYUV[0]; + Y1 = srcYUV[1]; + V = srcYUV[2]; + Y2 = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = V; + dstYUV[2] = Y2; + dstYUV[3] = U; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + V = srcYUV[1]; + Y2 = srcYUV[2]; + U = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = U; + dstYUV[2] = Y2; + dstYUV[3] = V; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 1, 0, 3)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + V = srcYUV[1]; + Y2 = srcYUV[2]; + U = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = U; + dstYUV[1] = Y1; + dstYUV[2] = V; + dstYUV[3] = Y2; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_Packed4_to_Packed4(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + switch (src_format) { + case SDL_PIXELFORMAT_YUY2: + switch (dst_format) { + case SDL_PIXELFORMAT_UYVY: + return SDL_ConvertPixels_YUY2_to_UYVY(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_YVYU: + return SDL_ConvertPixels_YUY2_to_YVYU(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_UYVY: + switch (dst_format) { + case SDL_PIXELFORMAT_YUY2: + return SDL_ConvertPixels_UYVY_to_YUY2(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_YVYU: + return SDL_ConvertPixels_UYVY_to_YVYU(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_YVYU: + switch (dst_format) { + case SDL_PIXELFORMAT_YUY2: + return SDL_ConvertPixels_YVYU_to_YUY2(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_UYVY: + return SDL_ConvertPixels_YVYU_to_UYVY(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + default: + break; + } + return SDL_SetError("SDL_ConvertPixels_Packed4_to_Packed4: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); +} + +static int +SDL_ConvertPixels_Planar2x2_to_Packed4(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + int x, y; + const Uint8 *srcY1, *srcY2, *srcU, *srcV; + Uint32 srcY_pitch, srcUV_pitch; + Uint32 srcY_pitch_left, srcUV_pitch_left, srcUV_pixel_stride; + Uint8 *dstY1, *dstY2, *dstU1, *dstU2, *dstV1, *dstV2; + Uint32 dstY_pitch, dstUV_pitch; + Uint32 dst_pitch_left; + + if (src == dst) { + return SDL_SetError("Can't change YUV plane types in-place"); + } + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, + &srcY1, &srcU, &srcV, &srcY_pitch, &srcUV_pitch) < 0) { + return -1; + } + srcY2 = srcY1 + srcY_pitch; + srcY_pitch_left = (srcY_pitch - width); + + if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) { + srcUV_pixel_stride = 2; + srcUV_pitch_left = (srcUV_pitch - 2*((width + 1)/2)); + } else { + srcUV_pixel_stride = 1; + srcUV_pitch_left = (srcUV_pitch - ((width + 1)/2)); + } + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&dstY1, (const Uint8 **)&dstU1, (const Uint8 **)&dstV1, + &dstY_pitch, &dstUV_pitch) < 0) { + return -1; + } + dstY2 = dstY1 + dstY_pitch; + dstU2 = dstU1 + dstUV_pitch; + dstV2 = dstV1 + dstUV_pitch; + dst_pitch_left = (dstY_pitch - 4*((width + 1)/2)); + + /* Copy 2x2 blocks of pixels at a time */ + for (y = 0; y < (height - 1); y += 2) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1 = *srcY1++; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + /* Row 2 */ + *dstY2 = *srcY2++; + dstY2 += 2; + *dstY2 = *srcY2++; + dstY2 += 2; + *dstU2 = *srcU; + *dstV2 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstU2 += 4; + dstV1 += 4; + dstV2 += 4; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + /* Row 2 */ + *dstY2 = *srcY2; + dstY2 += 2; + *dstY2 = *srcY2++; + dstY2 += 2; + *dstU2 = *srcU; + *dstV2 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstU2 += 4; + dstV1 += 4; + dstV2 += 4; + } + + srcY1 += srcY_pitch_left + srcY_pitch; + srcY2 += srcY_pitch_left + srcY_pitch; + srcU += srcUV_pitch_left; + srcV += srcUV_pitch_left; + dstY1 += dst_pitch_left + dstY_pitch; + dstY2 += dst_pitch_left + dstY_pitch; + dstU1 += dst_pitch_left + dstUV_pitch; + dstU2 += dst_pitch_left + dstUV_pitch; + dstV1 += dst_pitch_left + dstUV_pitch; + dstV2 += dst_pitch_left + dstUV_pitch; + } + + /* Last row */ + if (y == (height - 1)) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1 = *srcY1++; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstV1 += 4; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstV1 += 4; + } + } + return 0; +} + +static int +SDL_ConvertPixels_Packed4_to_Planar2x2(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + int x, y; + const Uint8 *srcY1, *srcY2, *srcU1, *srcU2, *srcV1, *srcV2; + Uint32 srcY_pitch, srcUV_pitch; + Uint32 src_pitch_left; + Uint8 *dstY1, *dstY2, *dstU, *dstV; + Uint32 dstY_pitch, dstUV_pitch; + Uint32 dstY_pitch_left, dstUV_pitch_left, dstUV_pixel_stride; + + if (src == dst) { + return SDL_SetError("Can't change YUV plane types in-place"); + } + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, + &srcY1, &srcU1, &srcV1, &srcY_pitch, &srcUV_pitch) < 0) { + return -1; + } + srcY2 = srcY1 + srcY_pitch; + srcU2 = srcU1 + srcUV_pitch; + srcV2 = srcV1 + srcUV_pitch; + src_pitch_left = (srcY_pitch - 4*((width + 1)/2)); + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&dstY1, (const Uint8 **)&dstU, (const Uint8 **)&dstV, + &dstY_pitch, &dstUV_pitch) < 0) { + return -1; + } + dstY2 = dstY1 + dstY_pitch; + dstY_pitch_left = (dstY_pitch - width); + + if (dst_format == SDL_PIXELFORMAT_NV12 || dst_format == SDL_PIXELFORMAT_NV21) { + dstUV_pixel_stride = 2; + dstUV_pitch_left = (dstUV_pitch - 2*((width + 1)/2)); + } else { + dstUV_pixel_stride = 1; + dstUV_pitch_left = (dstUV_pitch - ((width + 1)/2)); + } + + /* Copy 2x2 blocks of pixels at a time */ + for (y = 0; y < (height - 1); y += 2) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1++ = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + /* Row 2 */ + *dstY2++ = *srcY2; + srcY2 += 2; + *dstY2++ = *srcY2; + srcY2 += 2; + + *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2); + *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2); + + srcU1 += 4; + srcU2 += 4; + srcV1 += 4; + srcV2 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + /* Row 2 */ + *dstY2 = *srcY2; + srcY2 += 2; + *dstY2++ = *srcY2; + srcY2 += 2; + + *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2); + *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2); + + srcU1 += 4; + srcU2 += 4; + srcV1 += 4; + srcV2 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + srcY1 += src_pitch_left + srcY_pitch; + srcY2 += src_pitch_left + srcY_pitch; + srcU1 += src_pitch_left + srcUV_pitch; + srcU2 += src_pitch_left + srcUV_pitch; + srcV1 += src_pitch_left + srcUV_pitch; + srcV2 += src_pitch_left + srcUV_pitch; + dstY1 += dstY_pitch_left + dstY_pitch; + dstY2 += dstY_pitch_left + dstY_pitch; + dstU += dstUV_pitch_left; + dstV += dstUV_pitch_left; + } + + /* Last row */ + if (y == (height - 1)) { + for (x = 0; x < (width - 1); x += 2) { + *dstY1++ = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + *dstU = *srcU1; + *dstV = *srcV1; + + srcU1 += 4; + srcV1 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + /* Last column */ + if (x == (width - 1)) { + *dstY1 = *srcY1; + *dstU = *srcU1; + *dstV = *srcV1; + } + } + return 0; +} + +int +SDL_ConvertPixels_YUV_to_YUV(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + if (src_format == dst_format) { + if (src == dst) { + /* Nothing to do */ + return 0; + } + return SDL_ConvertPixels_YUV_to_YUV_Copy(width, height, src_format, src, src_pitch, dst, dst_pitch); + } + + if (IsPlanar2x2Format(src_format) && IsPlanar2x2Format(dst_format)) { + return SDL_ConvertPixels_Planar2x2_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPacked4Format(src_format) && IsPacked4Format(dst_format)) { + return SDL_ConvertPixels_Packed4_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPlanar2x2Format(src_format) && IsPacked4Format(dst_format)) { + return SDL_ConvertPixels_Planar2x2_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPacked4Format(src_format) && IsPlanar2x2Format(dst_format)) { + return SDL_ConvertPixels_Packed4_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else { + return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_yuv_c.h b/Engine/lib/sdl/src/video/SDL_yuv_c.h new file mode 100644 index 000000000..6fe02b0fc --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_yuv_c.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + + +/* YUV conversion functions */ + +extern int SDL_ConvertPixels_YUV_to_RGB(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); +extern int SDL_ConvertPixels_RGB_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); +extern int SDL_ConvertPixels_YUV_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c index b996e7a40..c913af513 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidvideo.h" - +#include "SDL_androidclipboard.h" #include "../../core/android/SDL_android.h" int diff --git a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h index a61045ae8..7f48b0e46 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidclipboard_h -#define _SDL_androidclipboard_h +#ifndef SDL_androidclipboard_h_ +#define SDL_androidclipboard_h_ extern int Android_SetClipboardText(_THIS, const char *text); extern char *Android_GetClipboardText(_THIS); extern SDL_bool Android_HasClipboardText(_THIS); -#endif /* _SDL_androidclipboard_h */ +#endif /* SDL_androidclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidevents.c b/Engine/lib/sdl/src/video/android/SDL_androidevents.c index c3cd4cc1b..6cf9af216 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidevents.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,19 +29,17 @@ #include "SDL_events.h" #include "SDL_androidwindow.h" - -void android_egl_context_backup(); -void android_egl_context_restore(); - -#if SDL_AUDIO_DRIVER_ANDROID -void ANDROIDAUDIO_ResumeDevices(void); -void ANDROIDAUDIO_PauseDevices(void); +#if !SDL_AUDIO_DISABLED +/* Can't include sysaudio "../../audio/android/SDL_androidaudio.h" + * because of THIS redefinition */ +extern void ANDROIDAUDIO_ResumeDevices(void); +extern void ANDROIDAUDIO_PauseDevices(void); #else static void ANDROIDAUDIO_ResumeDevices(void) {} static void ANDROIDAUDIO_PauseDevices(void) {} #endif -void +static void android_egl_context_restore() { SDL_Event event; @@ -55,7 +53,7 @@ android_egl_context_restore() } } -void +static void android_egl_context_backup() { /* Keep a copy of the EGL Context so we can try to restore it when we resume */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidevents.h b/Engine/lib/sdl/src/video/android/SDL_androidevents.h index 4a2230e20..00e742751 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidevents.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidgl.c b/Engine/lib/sdl/src/video/android/SDL_androidgl.c index 4cfe86357..859b46e9f 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidgl.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_androidwindow.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "../../core/android/SDL_android.h" #include @@ -38,7 +39,7 @@ SDL_EGL_CreateContext_impl(Android) SDL_EGL_MakeCurrent_impl(Android) -void +int Android_GLES_SwapWindow(_THIS, SDL_Window * window) { /* The following two calls existed in the original Java code @@ -48,12 +49,12 @@ Android_GLES_SwapWindow(_THIS, SDL_Window * window) /*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE); _this->egl_data->eglWaitGL();*/ - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); } int Android_GLES_LoadLibrary(_THIS, const char *path) { - return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0); + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0, 0); } #endif /* SDL_VIDEO_DRIVER_ANDROID */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidgl.h b/Engine/lib/sdl/src/video/android/SDL_androidgl.h new file mode 100644 index 000000000..1dab5a6d1 --- /dev/null +++ b/Engine/lib/sdl/src/video/android/SDL_androidgl.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_androidgl_h_ +#define SDL_androidgl_h_ + +SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); +int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int Android_GLES_SwapWindow(_THIS, SDL_Window * window); +int Android_GLES_LoadLibrary(_THIS, const char *path); + + +#endif /* SDL_androidgl_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c index 652e0cca7..6c94caca6 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -129,8 +129,8 @@ static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_AUDIOSTOP, /* AKEYCODE_MEDIA_STOP */ SDL_SCANCODE_AUDIONEXT, /* AKEYCODE_MEDIA_NEXT */ SDL_SCANCODE_AUDIOPREV, /* AKEYCODE_MEDIA_PREVIOUS */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_REWIND */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_FAST_FORWARD */ + SDL_SCANCODE_AUDIOREWIND, /* AKEYCODE_MEDIA_REWIND */ + SDL_SCANCODE_AUDIOFASTFORWARD, /* AKEYCODE_MEDIA_FAST_FORWARD */ SDL_SCANCODE_MUTE, /* AKEYCODE_MUTE */ SDL_SCANCODE_PAGEUP, /* AKEYCODE_PAGE_UP */ SDL_SCANCODE_PAGEDOWN, /* AKEYCODE_PAGE_DOWN */ @@ -357,7 +357,7 @@ Android_HasScreenKeyboardSupport(_THIS) SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window * window) { - return SDL_IsTextInputActive(); + return Android_JNI_IsScreenKeyboardShown(); } void diff --git a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h index ced9bc24e..a1a10f569 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c index 61f67636a..171602481 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,12 +23,12 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_messagebox.h" +#include "SDL_androidmessagebox.h" +#include "../../core/android/SDL_android.h" int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { - int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); - return Android_JNI_ShowMessageBox(messageboxdata, buttonid); } diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h index 3c680c62f..2c3a44f5d 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmouse.c b/Engine/lib/sdl/src/video/android/SDL_androidmouse.c index 883fa8d22..1c075fb4a 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmouse.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,7 @@ #include "../../core/android/SDL_android.h" +/* See Android's MotionEvent class for constants */ #define ACTION_DOWN 0 #define ACTION_UP 1 #define ACTION_MOVE 2 @@ -41,41 +42,59 @@ #define BUTTON_BACK 8 #define BUTTON_FORWARD 16 -static Uint8 SDLButton; +/* Last known Android mouse button state (includes all buttons) */ +static int last_state; void Android_InitMouse(void) { - SDLButton = 0; + last_state = 0; } -void Android_OnMouse( int androidButton, int action, float x, float y) { +/* Translate Android mouse button state to SDL mouse button */ +static Uint8 +TranslateButton(int state) +{ + if (state & BUTTON_PRIMARY) { + return SDL_BUTTON_LEFT; + } else if (state & BUTTON_SECONDARY) { + return SDL_BUTTON_RIGHT; + } else if (state & BUTTON_TERTIARY) { + return SDL_BUTTON_MIDDLE; + } else if (state & BUTTON_FORWARD) { + return SDL_BUTTON_X1; + } else if (state & BUTTON_BACK) { + return SDL_BUTTON_X2; + } else { + return 0; + } +} + +void +Android_OnMouse(int state, int action, float x, float y) +{ + int changes; + Uint8 button; + if (!Android_Window) { return; } switch(action) { case ACTION_DOWN: - // Determine which button originated the event, and store it for ACTION_UP - SDLButton = SDL_BUTTON_LEFT; - if (androidButton == BUTTON_SECONDARY) { - SDLButton = SDL_BUTTON_RIGHT; - } else if (androidButton == BUTTON_TERTIARY) { - SDLButton = SDL_BUTTON_MIDDLE; - } else if (androidButton == BUTTON_FORWARD) { - SDLButton = SDL_BUTTON_X1; - } else if (androidButton == BUTTON_BACK) { - SDLButton = SDL_BUTTON_X2; - } + changes = state & ~last_state; + button = TranslateButton(changes); + last_state = state; SDL_SendMouseMotion(Android_Window, 0, 0, x, y); - SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, SDLButton); + SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, button); break; case ACTION_UP: - // Android won't give us the button that originated the ACTION_DOWN event, so we'll - // assume it's the one we stored + changes = last_state & ~state; + button = TranslateButton(changes); + last_state = state; SDL_SendMouseMotion(Android_Window, 0, 0, x, y); - SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, SDLButton); + SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, button); break; case ACTION_MOVE: diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmouse.h b/Engine/lib/sdl/src/video/android/SDL_androidmouse.h index a64e06d51..f201fad97 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmouse.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,14 +19,14 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_androidmouse_h -#define _SDL_androidmouse_h +#ifndef SDL_androidmouse_h_ +#define SDL_androidmouse_h_ #include "SDL_androidvideo.h" extern void Android_InitMouse(void); extern void Android_OnMouse( int button, int action, float x, float y); -#endif /* _SDL_androidmouse_h */ +#endif /* SDL_androidmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidtouch.c b/Engine/lib/sdl/src/video/android/SDL_androidtouch.c index 0ff11ef57..5c3e4aacc 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidtouch.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,16 +52,13 @@ static void Android_GetWindowCoordinates(float x, float y, static SDL_bool separate_mouse_and_touch = SDL_FALSE; -static void +static void SDLCALL SeparateEventsHintWatcher(void *userdata, const char *name, const char *oldValue, const char *newValue) { - jclass mActivityClass = Android_JNI_GetActivityClass(); - JNIEnv *env = Android_JNI_GetEnv(); - jfieldID fid = (*env)->GetStaticFieldID(env, mActivityClass, "mSeparateMouseAndTouch", "Z"); - separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0)); - (*env)->SetStaticBooleanField(env, mActivityClass, fid, separate_mouse_and_touch ? JNI_TRUE : JNI_FALSE); + + Android_JNI_SetSeparateMouseAndTouch(separate_mouse_and_touch); } void Android_InitTouch(void) diff --git a/Engine/lib/sdl/src/video/android/SDL_androidtouch.h b/Engine/lib/sdl/src/video/android/SDL_androidtouch.h index 2ad096ce8..e10be4f99 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidtouch.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvideo.c b/Engine/lib/sdl/src/video/android/SDL_androidvideo.c index 178a3e691..357f5cf17 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidvideo.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,25 +33,23 @@ #include "../../events/SDL_windowevents_c.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "SDL_androidclipboard.h" #include "SDL_androidevents.h" #include "SDL_androidkeyboard.h" #include "SDL_androidmouse.h" #include "SDL_androidtouch.h" #include "SDL_androidwindow.h" +#include "SDL_androidvulkan.h" #define ANDROID_VID_DRIVER_NAME "Android" /* Initialization/Query functions */ static int Android_VideoInit(_THIS); static void Android_VideoQuit(_THIS); +int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); #include "../SDL_egl_c.h" -/* GL functions (SDL_androidgl.c) */ -extern SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); -extern int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -extern void Android_GLES_SwapWindow(_THIS, SDL_Window * window); -extern int Android_GLES_LoadLibrary(_THIS, const char *path); #define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress #define Android_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define Android_GLES_SetSwapInterval SDL_EGL_SetSwapInterval @@ -65,7 +63,7 @@ extern int Android_GLES_LoadLibrary(_THIS, const char *path); int Android_ScreenWidth = 0; int Android_ScreenHeight = 0; Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN; -int Android_ScreenRate = 0; +static int Android_ScreenRate = 0; SDL_sem *Android_PauseSem = NULL, *Android_ResumeSem = NULL; @@ -118,8 +116,11 @@ Android_CreateDevice(int devindex) device->VideoQuit = Android_VideoQuit; device->PumpEvents = Android_PumpEvents; - device->CreateWindow = Android_CreateWindow; + device->GetDisplayDPI = Android_GetDisplayDPI; + + device->CreateSDLWindow = Android_CreateWindow; device->SetWindowTitle = Android_SetWindowTitle; + device->SetWindowFullscreen = Android_SetWindowFullscreen; device->DestroyWindow = Android_DestroyWindow; device->GetWindowWMInfo = Android_GetWindowWMInfo; @@ -136,6 +137,13 @@ Android_CreateDevice(int devindex) device->GL_SwapWindow = Android_GLES_SwapWindow; device->GL_DeleteContext = Android_GLES_DeleteContext; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Android_Vulkan_CreateSurface; +#endif + /* Screensaver */ device->SuspendScreenSaver = Android_SuspendScreenSaver; @@ -194,9 +202,17 @@ Android_VideoQuit(_THIS) Android_QuitTouch(); } +int +Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) +{ + return Android_JNI_GetDisplayDPI(ddpi, hdpi, vdpi); +} + void Android_SetScreenResolution(int width, int height, Uint32 format, float rate) { + SDL_VideoDevice* device; + SDL_VideoDisplay *display; Android_ScreenWidth = width; Android_ScreenHeight = height; Android_ScreenFormat = format; @@ -205,13 +221,13 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate) /* Update the resolution of the desktop mode, so that the window can be properly resized. The screen resolution change can for - example happen when the Activity enters or exists immersive mode, + example happen when the Activity enters or exits immersive mode, which can happen after VideoInit(). */ - SDL_VideoDevice* device = SDL_GetVideoDevice(); + device = SDL_GetVideoDevice(); if (device && device->num_displays > 0) { - SDL_VideoDisplay* display = &device->displays[0]; + display = &device->displays[0]; display->desktop_mode.format = Android_ScreenFormat; display->desktop_mode.w = Android_ScreenWidth; display->desktop_mode.h = Android_ScreenHeight; @@ -219,16 +235,17 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate) } if (Android_Window) { - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height); - /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event * will fall back to the old mode */ - SDL_VideoDisplay *display = SDL_GetDisplayForWindow(Android_Window); + display = SDL_GetDisplayForWindow(Android_Window); - display->current_mode.format = format; - display->current_mode.w = width; - display->current_mode.h = height; - display->current_mode.refresh_rate = rate; + display->display_modes[0].format = format; + display->display_modes[0].w = width; + display->display_modes[0].h = height; + display->display_modes[0].refresh_rate = rate; + display->current_mode = display->display_modes[0]; + + SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height); } } diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvideo.h b/Engine/lib/sdl/src/video/android/SDL_androidvideo.h index 0f76a91b1..a62c98383 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidvideo.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidvideo_h -#define _SDL_androidvideo_h +#ifndef SDL_androidvideo_h_ +#define SDL_androidvideo_h_ #include "SDL_mutex.h" #include "SDL_rect.h" @@ -44,6 +44,6 @@ extern SDL_sem *Android_PauseSem, *Android_ResumeSem; extern SDL_Window *Android_Window; -#endif /* _SDL_androidvideo_h */ +#endif /* SDL_androidvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvulkan.c b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.c new file mode 100644 index 000000000..e0130349e --- /dev/null +++ b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.c @@ -0,0 +1,175 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID + +#include "SDL_androidvideo.h" +#include "SDL_androidwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_androidvulkan.h" +#include "SDL_syswm.h" + +int Android_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 i, extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasAndroidSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasAndroidSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasAndroidSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Android_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForAndroid[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForAndroid), + extensionsForAndroid); +} + +SDL_bool Android_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR = + (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateAndroidSurfaceKHR"); + VkAndroidSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateAndroidSurfaceKHR) + { + SDL_SetError(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.window = windowData->native_window; + result = vkCreateAndroidSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateAndroidSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvulkan.h b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.h new file mode 100644 index 000000000..2634c61f9 --- /dev/null +++ b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_androidvulkan_h_ +#define SDL_androidvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID + +int Android_Vulkan_LoadLibrary(_THIS, const char *path); +void Android_Vulkan_UnloadLibrary(_THIS); +SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Android_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_androidvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidwindow.c b/Engine/lib/sdl/src/video/android/SDL_androidwindow.c index 37a928faf..f1cbf5861 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidwindow.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_androidvideo.h" #include "SDL_androidwindow.h" +#include "SDL_hints.h" int Android_CreateWindow(_THIS, SDL_Window * window) @@ -42,6 +43,9 @@ Android_CreateWindow(_THIS, SDL_Window * window) Android_PauseSem = SDL_CreateSemaphore(0); Android_ResumeSem = SDL_CreateSemaphore(0); + /* Set orientation */ + Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS)); + /* Adjust the window data to match the screen */ window->x = 0; window->y = 0; @@ -49,7 +53,6 @@ Android_CreateWindow(_THIS, SDL_Window * window) window->h = Android_ScreenHeight; window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ - window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ window->flags &= ~SDL_WINDOW_HIDDEN; window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ @@ -69,13 +72,17 @@ Android_CreateWindow(_THIS, SDL_Window * window) SDL_free(data); return SDL_SetError("Could not fetch native window"); } - - data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); - if (data->egl_surface == EGL_NO_SURFACE) { - ANativeWindow_release(data->native_window); - SDL_free(data); - return SDL_SetError("Could not create GLES window surface"); + /* Do not create EGLSurface for Vulkan window since it will then make the window + incompatible with vkCreateAndroidSurfaceKHR */ + if ((window->flags & SDL_WINDOW_VULKAN) == 0) { + data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); + + if (data->egl_surface == EGL_NO_SURFACE) { + ANativeWindow_release(data->native_window); + SDL_free(data); + return SDL_SetError("Could not create GLES window surface"); + } } window->driverdata = data; @@ -90,6 +97,12 @@ Android_SetWindowTitle(_THIS, SDL_Window * window) Android_JNI_SetActivityTitle(window->title); } +void +Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) +{ + Android_JNI_SetWindowStyle(fullscreen); +} + void Android_DestroyWindow(_THIS, SDL_Window * window) { @@ -128,7 +141,7 @@ Android_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.android.surface = data->egl_surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/android/SDL_androidwindow.h b/Engine/lib/sdl/src/video/android/SDL_androidwindow.h index 3ac99f42b..df99567ac 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidwindow.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidwindow_h -#define _SDL_androidwindow_h +#ifndef SDL_androidwindow_h_ +#define SDL_androidwindow_h_ #include "../../core/android/SDL_android.h" #include "../SDL_egl_c.h" extern int Android_CreateWindow(_THIS, SDL_Window * window); extern void Android_SetWindowTitle(_THIS, SDL_Window * window); +extern void Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern void Android_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info); @@ -39,6 +40,6 @@ typedef struct } SDL_WindowData; -#endif /* _SDL_androidwindow_h */ +#endif /* SDL_androidwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h index 871b394f5..54e4c8813 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaclipboard_h -#define _SDL_cocoaclipboard_h +#ifndef SDL_cocoaclipboard_h_ +#define SDL_cocoaclipboard_h_ /* Forward declaration */ struct SDL_VideoData; @@ -31,6 +31,6 @@ extern char *Cocoa_GetClipboardText(_THIS); extern SDL_bool Cocoa_HasClipboardText(_THIS); extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data); -#endif /* _SDL_cocoaclipboard_h */ +#endif /* SDL_cocoaclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m index fd8680925..9c966342e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h index ea40e5317..986168ea3 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaevents_h -#define _SDL_cocoaevents_h +#ifndef SDL_cocoaevents_h_ +#define SDL_cocoaevents_h_ extern void Cocoa_RegisterApp(void); extern void Cocoa_PumpEvents(_THIS); extern void Cocoa_SuspendScreenSaver(_THIS); -#endif /* _SDL_cocoaevents_h */ +#endif /* SDL_cocoaevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m index 17a3183b7..38f4ba676 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,8 @@ - (void)terminate:(id)sender; - (void)sendEvent:(NSEvent *)theEvent; ++ (void)registerUserDefaults; + @end @implementation SDLApplication @@ -55,22 +57,22 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) SDL_VideoDevice *_this = SDL_GetVideoDevice(); switch ([theEvent type]) { - case NSLeftMouseDown: - case NSOtherMouseDown: - case NSRightMouseDown: - case NSLeftMouseUp: - case NSOtherMouseUp: - case NSRightMouseUp: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: /* usually middle mouse dragged */ - case NSMouseMoved: - case NSScrollWheel: + case NSEventTypeLeftMouseDown: + case NSEventTypeOtherMouseDown: + case NSEventTypeRightMouseDown: + case NSEventTypeLeftMouseUp: + case NSEventTypeOtherMouseUp: + case NSEventTypeRightMouseUp: + case NSEventTypeLeftMouseDragged: + case NSEventTypeRightMouseDragged: + case NSEventTypeOtherMouseDragged: /* usually middle mouse dragged */ + case NSEventTypeMouseMoved: + case NSEventTypeScrollWheel: Cocoa_HandleMouseEvent(_this, theEvent); break; - case NSKeyDown: - case NSKeyUp: - case NSFlagsChanged: + case NSEventTypeKeyDown: + case NSEventTypeKeyUp: + case NSEventTypeFlagsChanged: Cocoa_HandleKeyEvent(_this, theEvent); break; default: @@ -90,6 +92,17 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) [super sendEvent:theEvent]; } ++ (void)registerUserDefaults +{ + NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys: + [NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported", + [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", + [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", + nil]; + [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; + [appDefaults release]; +} + @end // SDLApplication /* setAppleMenu disappeared from the headers in 10.4 */ @@ -216,6 +229,22 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) { return (BOOL)SDL_SendDropFile(NULL, [filename UTF8String]) && SDL_SendDropComplete(NULL); } + +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + /* The menu bar of SDL apps which don't have the typical .app bundle + * structure fails to work the first time a window is created (until it's + * de-focused and re-focused), if this call is in Cocoa_RegisterApp instead + * of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051 + */ + if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { + [NSApp activateIgnoringOtherApps:YES]; + } + + /* If we call this before NSApp activation, macOS might print a complaint + * about ApplePersistenceIgnoreState. */ + [SDLApplication registerUserDefaults]; +} @end static SDLAppDelegate *appDelegate = nil; @@ -289,7 +318,7 @@ CreateApplicationMenus(void) [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)]; [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; @@ -335,7 +364,7 @@ CreateApplicationMenus(void) /* Add menu items */ menuItem = [viewMenu addItemWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; - [menuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask]; + [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""]; @@ -361,20 +390,18 @@ Cocoa_RegisterApp(void) if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - [NSApp activateIgnoringOtherApps:YES]; } if ([NSApp mainMenu] == nil) { CreateApplicationMenus(); } [NSApp finishLaunching]; - NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported", - [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", - [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", - nil]; - [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; - [appDefaults release]; + if ([NSApp delegate]) { + /* The SDL app delegate calls this in didFinishLaunching if it's + * attached to the NSApp, otherwise we need to call it manually. + */ + [SDLApplication registerUserDefaults]; + } } if (NSApp && !appDelegate) { appDelegate = [[SDLAppDelegate alloc] init]; @@ -394,6 +421,7 @@ void Cocoa_PumpEvents(_THIS) { @autoreleasepool { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 /* Update activity every 30 seconds to prevent screensaver */ SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; if (_this->suspend_screensaver && !data->screensaver_use_iopm) { @@ -404,9 +432,10 @@ Cocoa_PumpEvents(_THIS) data->screensaver_activity = now; } } +#endif for ( ; ; ) { - NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; + NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; if ( event == nil ) { break; } diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h index 4f9da0185..7d8952381 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoakeyboard_h -#define _SDL_cocoakeyboard_h +#ifndef SDL_cocoakeyboard_h_ +#define SDL_cocoakeyboard_h_ extern void Cocoa_InitKeyboard(_THIS); extern void Cocoa_HandleKeyEvent(_THIS, NSEvent * event); @@ -31,6 +31,6 @@ extern void Cocoa_StartTextInput(_THIS); extern void Cocoa_StopTextInput(_THIS); extern void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect); -#endif /* _SDL_cocoakeyboard_h */ +#endif /* SDL_cocoakeyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m index 8b2ed91c2..8436047f9 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -93,7 +93,7 @@ return _selectedRange; } -- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange; +- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { if ([aString isKindOfClass:[NSAttributedString class]]) { aString = [aString string]; @@ -127,7 +127,7 @@ SDL_SendEditingText("", 0, 0); } -- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; +- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { NSWindow *window = [self window]; NSRect contentRect = [window contentRectForFrameRect:[window frame]]; @@ -143,16 +143,19 @@ aRange.location, aRange.length, windowHeight, NSStringFromRect(rect)); - if ([window respondsToSelector:@selector(convertRectToScreen:)]) { - rect = [window convertRectToScreen:rect]; - } else { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + if (![window respondsToSelector:@selector(convertRectToScreen:)]) { rect.origin = [window convertBaseToScreen:rect.origin]; + } else +#endif + { + rect = [window convertRectToScreen:rect]; } return rect; } -- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; +- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { DEBUG_IME(@"attributedSubstringFromRange: (%d, %d)", aRange.location, aRange.length); return nil; @@ -460,7 +463,7 @@ DoSidedModifiers(unsigned short scancode, unsigned int i, bit; /* Iterate through the bits, testing each against the old modifiers */ - for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) { + for (i = 0, bit = NSEventModifierFlagShift; bit <= NSEventModifierFlagCommand; bit <<= 1, ++i) { unsigned int oldMask, newMask; oldMask = oldMods & bit; @@ -581,7 +584,7 @@ Cocoa_InitKeyboard(_THIS) SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); data->modifierFlags = [NSEvent modifierFlags]; - SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSAlphaShiftKeyMask) != 0); + SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSEventModifierFlagCapsLock) != 0); InitHIDCallback(); } @@ -646,7 +649,7 @@ Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL; if (!data) { return; /* can happen when returning from fullscreen Space on shutdown */ } @@ -670,7 +673,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) } switch ([event type]) { - case NSKeyDown: + case NSEventTypeKeyDown: if (![event isARepeat]) { /* See if we need to rebuild the keyboard layout */ UpdateKeymap(data, SDL_TRUE); @@ -679,7 +682,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) SDL_SendKeyboardKey(SDL_PRESSED, code); #if 1 if (code == SDL_SCANCODE_UNKNOWN) { - fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); + fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); } #endif if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { @@ -694,10 +697,10 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) #endif } break; - case NSKeyUp: + case NSEventTypeKeyUp: SDL_SendKeyboardKey(SDL_RELEASED, code); break; - case NSFlagsChanged: + case NSEventTypeFlagsChanged: /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */ HandleModifiers(_this, scancode, [event modifierFlags]); break; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h index d1ca7882e..74a815ad6 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m index ed59e728c..a98237f45 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,11 +57,24 @@ - (void)showAlert:(NSAlert*)alert { if (nswindow) { - [alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; +#ifdef MAC_OS_X_VERSION_10_9 + if ([alert respondsToSelector:@selector(beginSheetModalForWindow:completionHandler:)]) { + [alert beginSheetModalForWindow:nswindow completionHandler:^(NSModalResponse returnCode) { + clicked = returnCode; + }]; + } else +#endif + { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 + [alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; +#endif + } + while (clicked < 0) { SDL_PumpEvents(); SDL_Delay(100); } + [nswindow release]; } else { clicked = [alert runModal]; @@ -86,11 +99,11 @@ Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) NSAlert* alert = [[[NSAlert alloc] init] autorelease]; if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; } else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; } else { - [alert setAlertStyle:NSInformationalAlertStyle]; + [alert setAlertStyle:NSAlertStyleInformational]; } [alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]]; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h new file mode 100644 index 000000000..c0a582ff4 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h @@ -0,0 +1,63 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#ifndef SDL_cocoametalview_h_ +#define SDL_cocoametalview_h_ + +#import "../SDL_sysvideo.h" +#import "SDL_cocoawindow.h" + +#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) + +#import +#import +#import + +#define METALVIEW_TAG 255 + +@interface SDL_cocoametalview : NSView { + NSInteger _tag; +} + +- (instancetype)initWithFrame:(NSRect)frame + scale:(CGFloat)scale; + +/* Override superclass tag so this class can set it. */ +@property (assign, readonly) NSInteger tag; + +@end + +SDL_cocoametalview* Cocoa_Mtl_AddMetalView(SDL_Window* window); + +void Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h); + +#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */ + +#endif /* SDL_cocoametalview_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m new file mode 100644 index 000000000..e9c08a007 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m @@ -0,0 +1,135 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#import "SDL_cocoametalview.h" + +#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) + +#include "SDL_assert.h" + +@implementation SDL_cocoametalview + +/* The synthesized getter should be called by super's viewWithTag. */ +@synthesize tag = _tag; + +/* Return a Metal-compatible layer. */ ++ (Class)layerClass +{ + return NSClassFromString(@"CAMetalLayer"); +} + +/* Indicate the view wants to draw using a backing layer instead of drawRect. */ +- (BOOL)wantsUpdateLayer +{ + return YES; +} + +/* When the wantsLayer property is set to YES, this method will be invoked to + * return a layer instance. + */ +- (CALayer*)makeBackingLayer +{ + return [self.class.layerClass layer]; +} + +- (instancetype)initWithFrame:(NSRect)frame + scale:(CGFloat)scale +{ + if ((self = [super initWithFrame:frame])) { + _tag = METALVIEW_TAG; + self.wantsLayer = YES; + + /* Allow resize. */ + self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + + /* Set the desired scale. The default drawableSize of a CAMetalLayer + * is its bounds x its scale so nothing further needs to be done. + */ + self.layer.contentsScale = scale; + } + + return self; +} + +/* Set the size of the metal drawables when the view is resized. */ +- (void)resizeWithOldSuperviewSize:(NSSize)oldSize +{ + [super resizeWithOldSuperviewSize:oldSize]; +} + +@end + +SDL_cocoametalview* +Cocoa_Mtl_AddMetalView(SDL_Window* window) +{ + SDL_WindowData* data = (__bridge SDL_WindowData *)window->driverdata; + NSView *view = data->nswindow.contentView; + CGFloat scale = 1.0; + + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + /* Set the scale to the natural scale factor of the screen - then + * the backing dimensions of the Metal view will match the pixel + * dimensions of the screen rather than the dimensions in points + * yielding high resolution on retine displays. + * + * N.B. In order for backingScaleFactor to be > 1, + * NSHighResolutionCapable must be set to true in the app's Info.plist. + */ + NSWindow* nswindow = data->nswindow; + if ([nswindow.screen respondsToSelector:@selector(backingScaleFactor)]) + scale = data->nswindow.screen.backingScaleFactor; + } + + SDL_cocoametalview *metalview + = [[SDL_cocoametalview alloc] initWithFrame:view.frame scale:scale]; + [view addSubview:metalview]; + return metalview; +} + +void +Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h) +{ + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + NSView *view = data->nswindow.contentView; + SDL_cocoametalview* metalview = [view viewWithTag:METALVIEW_TAG]; + if (metalview) { + CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; + assert(layer != NULL); + if (w) { + *w = layer.drawableSize.width; + } + if (h) { + *h = layer.drawableSize.height; + } + } else { + SDL_GetWindowSize(window, w, h); + } +} + +#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h index ce8601cba..05482e891 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamodes_h -#define _SDL_cocoamodes_h +#ifndef SDL_cocoamodes_h_ +#define SDL_cocoamodes_h_ typedef struct { @@ -41,6 +41,6 @@ extern int Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void Cocoa_QuitModes(_THIS); -#endif /* _SDL_cocoamodes_h */ +#endif /* SDL_cocoamodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m index 6ae9decbc..97ccd945d 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -340,27 +340,53 @@ void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; - CFArrayRef modes = CGDisplayCopyAllDisplayModes(data->display, NULL); + CVDisplayLinkRef link = NULL; + CGDisplayModeRef desktopmoderef; + SDL_DisplayMode desktopmode; + CFArrayRef modes; + + CVDisplayLinkCreateWithCGDisplay(data->display, &link); + + desktopmoderef = CGDisplayCopyDisplayMode(data->display); + + /* CopyAllDisplayModes won't always contain the desktop display mode (if + * NULL is passed in) - for example on a retina 15" MBP, System Preferences + * allows choosing 1920x1200 but it's not in the list. AddDisplayMode makes + * sure there are no duplicates so it's safe to always add the desktop mode + * even in cases where it is in the CopyAllDisplayModes list. + */ + if (desktopmoderef && GetDisplayMode(_this, desktopmoderef, link, &desktopmode)) { + if (!SDL_AddDisplayMode(display, &desktopmode)) { + CGDisplayModeRelease(desktopmoderef); + SDL_free(desktopmode.driverdata); + } + } else { + CGDisplayModeRelease(desktopmoderef); + } + + modes = CGDisplayCopyAllDisplayModes(data->display, NULL); if (modes) { - CVDisplayLinkRef link = NULL; - const CFIndex count = CFArrayGetCount(modes); CFIndex i; - - CVDisplayLinkCreateWithCGDisplay(data->display, &link); + const CFIndex count = CFArrayGetCount(modes); for (i = 0; i < count; i++) { CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); SDL_DisplayMode mode; + if (GetDisplayMode(_this, moderef, link, &mode)) { - CGDisplayModeRetain(moderef); - SDL_AddDisplayMode(display, &mode); + if (SDL_AddDisplayMode(display, &mode)) { + CGDisplayModeRetain(moderef); + } else { + SDL_free(mode.driverdata); + } } } - CVDisplayLinkRelease(link); CFRelease(modes); } + + CVDisplayLinkRelease(link); } int diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h index 4f60c8372..b79a3cf98 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamouse_h -#define _SDL_cocoamouse_h +#ifndef SDL_cocoamouse_h_ +#define SDL_cocoamouse_h_ #include "SDL_cocoavideo.h" @@ -47,6 +47,6 @@ typedef struct { + (NSCursor *)invisibleCursor; @end -#endif /* _SDL_cocoamouse_h */ +#endif /* SDL_cocoamouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m index 0a27549ae..029a31832 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_events.h" #include "SDL_cocoamouse.h" #include "SDL_cocoamousetap.h" +#include "SDL_cocoavideo.h" #include "../../events/SDL_mouse_c.h" @@ -363,10 +364,10 @@ void Cocoa_HandleMouseEvent(_THIS, NSEvent *event) { switch ([event type]) { - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: + case NSEventTypeMouseMoved: + case NSEventTypeLeftMouseDragged: + case NSEventTypeRightMouseDragged: + case NSEventTypeOtherMouseDragged: break; default: @@ -431,17 +432,7 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) } } - if (x > 0) { - x = SDL_ceil(x); - } else if (x < 0) { - x = SDL_floor(x); - } - if (y > 0) { - y = SDL_ceil(y); - } else if (y < 0) { - y = SDL_floor(y); - } - SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction); + SDL_SendMouseWheel(window, mouse->mouseID, x, y, direction); } void diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h index af92314b6..40ce3861f 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamousetap_h -#define _SDL_cocoamousetap_h +#ifndef SDL_cocoamousetap_h_ +#define SDL_cocoamousetap_h_ #include "SDL_cocoamouse.h" extern void Cocoa_InitMouseEventTap(SDL_MouseData *driverdata); +extern void Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled); extern void Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata); -#endif /* _SDL_cocoamousetap_h */ +#endif /* SDL_cocoamousetap_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m index 48abbca9c..3c4fcf23e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,11 +69,14 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event switch (type) { case kCGEventTapDisabledByTimeout: - case kCGEventTapDisabledByUserInput: { CGEventTapEnable(tapdata->tap, true); return NULL; } + case kCGEventTapDisabledByUserInput: + { + return NULL; + } default: break; } @@ -142,15 +145,12 @@ Cocoa_MouseTapThread(void *data) { SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)data; - /* Create a tap. */ - CFMachPortRef eventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, - kCGEventTapOptionDefault, allGrabbedEventsMask, - &Cocoa_MouseTapCallback, tapdata); + /* Tap was created on main thread but we own it now. */ + CFMachPortRef eventTap = tapdata->tap; if (eventTap) { /* Try to create a runloop source we can schedule. */ CFRunLoopSourceRef runloopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0); if (runloopSource) { - tapdata->tap = eventTap; tapdata->runloopSource = runloopSource; } else { CFRelease(eventTap); @@ -202,15 +202,32 @@ Cocoa_InitMouseEventTap(SDL_MouseData* driverdata) tapdata->runloopStartedSemaphore = SDL_CreateSemaphore(0); if (tapdata->runloopStartedSemaphore) { - tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata); - if (!tapdata->thread) { - SDL_DestroySemaphore(tapdata->runloopStartedSemaphore); + tapdata->tap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, + kCGEventTapOptionDefault, allGrabbedEventsMask, + &Cocoa_MouseTapCallback, tapdata); + if (tapdata->tap) { + /* Tap starts disabled, until app requests mouse grab */ + CGEventTapEnable(tapdata->tap, false); + tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata); + if (tapdata->thread) { + /* Success - early out. Ownership transferred to thread. */ + return; + } + CFRelease(tapdata->tap); } + SDL_DestroySemaphore(tapdata->runloopStartedSemaphore); } + SDL_free(driverdata->tapdata); + driverdata->tapdata = NULL; +} - if (!tapdata->thread) { - SDL_free(driverdata->tapdata); - driverdata->tapdata = NULL; +void +Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled) +{ + SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata; + if (tapdata && tapdata->tap) + { + CGEventTapEnable(tapdata->tap, !!enabled); } } @@ -245,6 +262,11 @@ Cocoa_InitMouseEventTap(SDL_MouseData *unused) { } +void +Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled) +{ +} + void Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata) { diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h index 1f7bd57f0..81ca5edd5 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaopengl_h -#define _SDL_cocoaopengl_h +#ifndef SDL_cocoaopengl_h_ +#define SDL_cocoaopengl_h_ #if SDL_VIDEO_OPENGL_CGL @@ -58,11 +58,11 @@ extern void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); extern int Cocoa_GL_SetSwapInterval(_THIS, int interval); extern int Cocoa_GL_GetSwapInterval(_THIS); -extern void Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); +extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_CGL */ -#endif /* _SDL_cocoaopengl_h */ +#endif /* SDL_cocoaopengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m index 645e5ba45..5f18a2ee8 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ #if SDL_VIDEO_OPENGL_CGL #include "SDL_cocoavideo.h" #include "SDL_cocoaopengl.h" +#include "SDL_cocoaopengles.h" #include #include @@ -165,8 +166,27 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) int glversion_minor; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { - SDL_SetError ("OpenGL ES is not supported on this platform"); +#if SDL_VIDEO_OPENGL_EGL + /* Switch to EGL based functions */ + Cocoa_GL_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GLES_CreateContext; + _this->GL_MakeCurrent = Cocoa_GLES_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GLES_SwapWindow; + _this->GL_DeleteContext = Cocoa_GLES_DeleteContext; + + if (Cocoa_GLES_LoadLibrary(_this, NULL) != 0) { + return NULL; + } + return Cocoa_GLES_CreateContext(_this, window); +#else + SDL_SetError("SDL not configured with EGL support"); return NULL; +#endif } if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) { SDL_SetError ("OpenGL Core Profile is not supported on this platform version"); @@ -383,13 +403,14 @@ Cocoa_GL_GetSwapInterval(_THIS) return status; }} -void +int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); [nscontext flushBuffer]; [nscontext updateIfNeeded]; + return 0; }} void diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h new file mode 100644 index 000000000..fc7f5c054 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h @@ -0,0 +1,49 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_cocoaopengles_h_ +#define SDL_cocoaopengles_h_ + +#if SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../SDL_egl_c.h" + +/* OpenGLES functions */ +#define Cocoa_GLES_GetAttribute SDL_EGL_GetAttribute +#define Cocoa_GLES_GetProcAddress SDL_EGL_GetProcAddress +#define Cocoa_GLES_UnloadLibrary SDL_EGL_UnloadLibrary +#define Cocoa_GLES_GetSwapInterval SDL_EGL_GetSwapInterval +#define Cocoa_GLES_SetSwapInterval SDL_EGL_SetSwapInterval + +extern int Cocoa_GLES_LoadLibrary(_THIS, const char *path); +extern SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window); +extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context); +extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window); + +#endif /* SDL_VIDEO_OPENGL_EGL */ + +#endif /* SDL_cocoaopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m new file mode 100644 index 000000000..e0a05a1a3 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m @@ -0,0 +1,132 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL + +#include "SDL_cocoavideo.h" +#include "SDL_cocoaopengles.h" +#include "SDL_cocoaopengl.h" +#include "SDL_log.h" + +/* EGL implementation of SDL OpenGL support */ + +int +Cocoa_GLES_LoadLibrary(_THIS, const char *path) { + + /* If the profile requested is not GL ES, switch over to WIN_GL functions */ + if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { +#if SDL_VIDEO_OPENGL_CGL + Cocoa_GLES_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GL_CreateContext; + _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GL_SwapWindow; + _this->GL_DeleteContext = Cocoa_GL_DeleteContext; + return Cocoa_GL_LoadLibrary(_this, path); +#else + return SDL_SetError("SDL not configured with OpenGL/CGL support"); +#endif + } + + if (_this->egl_data == NULL) { + return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0); + } + + return 0; +} + +SDL_GLContext +Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) +{ + SDL_GLContext context; + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + +#if SDL_VIDEO_OPENGL_CGL + if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { + /* Switch to CGL based functions */ + Cocoa_GLES_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GL_CreateContext; + _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GL_SwapWindow; + _this->GL_DeleteContext = Cocoa_GL_DeleteContext; + + if (Cocoa_GL_LoadLibrary(_this, NULL) != 0) { + return NULL; + } + + return Cocoa_GL_CreateContext(_this, window); + } +#endif + + context = SDL_EGL_CreateContext(_this, data->egl_surface); + return context; +} + +void +Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context) +{ + SDL_EGL_DeleteContext(_this, context); + Cocoa_GLES_UnloadLibrary(_this); +} + +SDL_EGL_SwapWindow_impl(Cocoa) +SDL_EGL_MakeCurrent_impl(Cocoa) + +int +Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window) +{ + /* The current context is lost in here; save it and reset it. */ + SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; + SDL_Window *current_win = SDL_GL_GetCurrentWindow(); + SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); + + + if (_this->egl_data == NULL) { + if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) { + SDL_EGL_UnloadLibrary(_this); + return -1; + } + } + + /* Create the GLES window surface */ + NSView* v = windowdata->nswindow.contentView; + windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)[v layer]); + + if (windowdata->egl_surface == EGL_NO_SURFACE) { + return SDL_SetError("Could not create GLES window surface"); + } + + return Cocoa_GLES_MakeCurrent(_this, current_win, current_ctx); +} + +#endif /* SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h index f64b59178..da1b5eb8e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_cocoashape_h -#define _SDL_cocoashape_h +#ifndef SDL_cocoashape_h_ +#define SDL_cocoashape_h_ #include "SDL_stdinc.h" #include "SDL_video.h" @@ -40,4 +40,6 @@ extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window); extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); extern int Cocoa_ResizeWindowShape(SDL_Window *window); -#endif +#endif /* SDL_cocoashape_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m index fc8a2775c..7a2f04f6e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ Cocoa_CreateShaper(SDL_Window* window) SDL_WindowData* windata = (SDL_WindowData*)window->driverdata; [windata->nswindow setOpaque:NO]; - [windata->nswindow setStyleMask:NSBorderlessWindowMask]; + [windata->nswindow setStyleMask:NSWindowStyleMaskBorderless]; SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper)); result->window = window; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h index 498ce6cca..05bbd3483 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoavideo_h -#define _SDL_cocoavideo_h +#ifndef SDL_cocoavideo_h_ +#define SDL_cocoavideo_h_ #include "SDL_opengl.h" @@ -40,6 +40,59 @@ #include "SDL_cocoaopengl.h" #include "SDL_cocoawindow.h" +#ifndef MAC_OS_X_VERSION_10_12 +#define DECLARE_EVENT(name) static const NSEventType NSEventType##name = NS##name +DECLARE_EVENT(LeftMouseDown); +DECLARE_EVENT(LeftMouseUp); +DECLARE_EVENT(RightMouseDown); +DECLARE_EVENT(RightMouseUp); +DECLARE_EVENT(OtherMouseDown); +DECLARE_EVENT(OtherMouseUp); +DECLARE_EVENT(MouseMoved); +DECLARE_EVENT(LeftMouseDragged); +DECLARE_EVENT(RightMouseDragged); +DECLARE_EVENT(OtherMouseDragged); +DECLARE_EVENT(ScrollWheel); +DECLARE_EVENT(KeyDown); +DECLARE_EVENT(KeyUp); +DECLARE_EVENT(FlagsChanged); +#undef DECLARE_EVENT + +static const NSEventMask NSEventMaskAny = NSAnyEventMask; + +#define DECLARE_MODIFIER_FLAG(name) static const NSUInteger NSEventModifierFlag##name = NS##name##KeyMask +DECLARE_MODIFIER_FLAG(Shift); +DECLARE_MODIFIER_FLAG(Control); +DECLARE_MODIFIER_FLAG(Command); +DECLARE_MODIFIER_FLAG(NumericPad); +DECLARE_MODIFIER_FLAG(Help); +DECLARE_MODIFIER_FLAG(Function); +#undef DECLARE_MODIFIER_FLAG +static const NSUInteger NSEventModifierFlagCapsLock = NSAlphaShiftKeyMask; +static const NSUInteger NSEventModifierFlagOption = NSAlternateKeyMask; + +#define DECLARE_WINDOW_MASK(name) static const unsigned int NSWindowStyleMask##name = NS##name##WindowMask +DECLARE_WINDOW_MASK(Borderless); +DECLARE_WINDOW_MASK(Titled); +DECLARE_WINDOW_MASK(Closable); +DECLARE_WINDOW_MASK(Miniaturizable); +DECLARE_WINDOW_MASK(Resizable); +DECLARE_WINDOW_MASK(TexturedBackground); +DECLARE_WINDOW_MASK(UnifiedTitleAndToolbar); +DECLARE_WINDOW_MASK(FullScreen); +/*DECLARE_WINDOW_MASK(FullSizeContentView);*/ /* Not used, fails compile on older SDKs */ +static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask; +static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask; +static const unsigned int NSWindowStyleMaskHUDWindow = NSHUDWindowMask; +#undef DECLARE_WINDOW_MASK + +#define DECLARE_ALERT_STYLE(name) static const NSUInteger NSAlertStyle##name = NS##name##AlertStyle +DECLARE_ALERT_STYLE(Warning); +DECLARE_ALERT_STYLE(Informational); +DECLARE_ALERT_STYLE(Critical); +#undef DECLARE_ALERT_STYLE +#endif + /* Private display data */ @class SDLTranslatorResponder; @@ -60,6 +113,6 @@ typedef struct SDL_VideoData /* Utility functions */ extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); -#endif /* _SDL_cocoavideo_h */ +#endif /* SDL_cocoavideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m index e436e6521..545dc1ed9 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_endian.h" #include "SDL_cocoavideo.h" #include "SDL_cocoashape.h" +#include "SDL_cocoavulkan.h" #include "SDL_assert.h" /* Initialization/Query functions */ @@ -80,8 +81,8 @@ Cocoa_CreateDevice(int devindex) device->PumpEvents = Cocoa_PumpEvents; device->SuspendScreenSaver = Cocoa_SuspendScreenSaver; - device->CreateWindow = Cocoa_CreateWindow; - device->CreateWindowFrom = Cocoa_CreateWindowFrom; + device->CreateSDLWindow = Cocoa_CreateWindow; + device->CreateSDLWindowFrom = Cocoa_CreateWindowFrom; device->SetWindowTitle = Cocoa_SetWindowTitle; device->SetWindowIcon = Cocoa_SetWindowIcon; device->SetWindowPosition = Cocoa_SetWindowPosition; @@ -120,6 +121,24 @@ Cocoa_CreateDevice(int devindex) device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; device->GL_SwapWindow = Cocoa_GL_SwapWindow; device->GL_DeleteContext = Cocoa_GL_DeleteContext; +#elif SDL_VIDEO_OPENGL_EGL + device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; + device->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; + device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; + device->GL_CreateContext = Cocoa_GLES_CreateContext; + device->GL_MakeCurrent = Cocoa_GLES_MakeCurrent; + device->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval; + device->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval; + device->GL_SwapWindow = Cocoa_GLES_SwapWindow; + device->GL_DeleteContext = Cocoa_GLES_DeleteContext; +#endif + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Cocoa_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Cocoa_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = Cocoa_Vulkan_GetDrawableSize; #endif device->StartTextInput = Cocoa_StartTextInput; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h new file mode 100644 index 000000000..a49c148c1 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h @@ -0,0 +1,55 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + + +#include "../../SDL_internal.h" + +#ifndef SDL_cocoavulkan_h_ +#define SDL_cocoavulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA + +int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path); +void Cocoa_Vulkan_UnloadLibrary(_THIS); +SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Cocoa_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); + +#endif + +#endif /* SDL_cocoavulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m new file mode 100644 index 000000000..2cf55bb5a --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m @@ -0,0 +1,231 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA + +#include "SDL_cocoavideo.h" +#include "SDL_cocoawindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_cocoametalview.h" +#include "SDL_cocoavulkan.h" +#include "SDL_syswm.h" + +#include + +const char* defaultPaths[] = { + "vulkan.framework/vulkan", + "libvulkan.1.dylib", + "MoltenVK.framework/MoltenVK", + "libMoltenVK.dylib" +}; + +/* Since libSDL is most likely a .dylib, need RTLD_DEFAULT not RTLD_SELF. */ +#define DEFAULT_HANDLE RTLD_DEFAULT + +int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasMacOSSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + + if (_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan/MoltenVK already loaded"); + return -1; + } + + /* Load the Vulkan loader library */ + if (!path) { + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + } + + if (!path) { + /* MoltenVK framework, currently, v0.17.0, has a static library and is + * the recommended way to use the package. There is likely no object to + * load. */ + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, + "vkGetInstanceProcAddr"); + } + + if (vkGetInstanceProcAddr) { + _this->vulkan_config.loader_handle = DEFAULT_HANDLE; + } else { + const char** paths; + int numPaths; + int i; + + if (path) { + paths = &path; + numPaths = 1; + } else { + /* Look for framework or .dylib packaged with the application + * instead. */ + paths = defaultPaths; + numPaths = SDL_arraysize(defaultPaths); + } + + for (i=0; i < numPaths; i++) { + _this->vulkan_config.loader_handle = SDL_LoadObject(paths[i]); + if (_this->vulkan_config.loader_handle) + break; + else + continue; + } + if (i == numPaths) + return -1; + + SDL_strlcpy(_this->vulkan_config.loader_path, paths[i], + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + } + + if (!vkGetInstanceProcAddr) { + SDL_SetError("Failed to find %s in either executable or %s: %s", + "vkGetInstanceProcAddr", + _this->vulkan_config.loader_path, + (const char *) dlerror()); + goto fail; + } + + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) { + goto fail; + } + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if (!extensions) { + goto fail; + } + for (Uint32 i = 0; i < extensionCount; i++) { + if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasSurfaceExtension = SDL_TRUE; + } else if (SDL_strcmp(VK_MVK_MACOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasMacOSSurfaceExtension = SDL_TRUE; + } + } + SDL_free(extensions); + if (!hasSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } else if (!hasMacOSSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_MVK_MACOS_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Cocoa_Vulkan_UnloadLibrary(_THIS) +{ + if (_this->vulkan_config.loader_handle) { + if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + } + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForCocoa[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_MACOS_SURFACE_EXTENSION_NAME + }; + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForCocoa), + extensionsForCocoa); +} + +SDL_bool Cocoa_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK = + (PFN_vkCreateMacOSSurfaceMVK)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateMacOSSurfaceMVK"); + VkMacOSSurfaceCreateInfoMVK createInfo = {}; + VkResult result; + + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if (!vkCreateMacOSSurfaceMVK) { + SDL_SetError(VK_MVK_MACOS_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.pView = Cocoa_Mtl_AddMetalView(window); + result = vkCreateMacOSSurfaceMVK(instance, &createInfo, + NULL, surface); + if (result != VK_SUCCESS) { + SDL_SetError("vkCreateMacOSSurfaceMVK failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + Cocoa_Mtl_GetDrawableSize(window, w, h); +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h index a32de8387..df6f173a7 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoawindow_h -#define _SDL_cocoawindow_h +#ifndef SDL_cocoawindow_h_ +#define SDL_cocoawindow_h_ #import +#if SDL_VIDEO_OPENGL_EGL +#include "../SDL_egl_c.h" +#endif + typedef struct SDL_WindowData SDL_WindowData; typedef enum @@ -114,6 +118,9 @@ struct SDL_WindowData SDL_bool inWindowMove; Cocoa_WindowListener *listener; struct SDL_VideoData *videodata; +#if SDL_VIDEO_OPENGL_EGL + EGLSurface egl_surface; +#endif }; extern int Cocoa_CreateWindow(_THIS, SDL_Window * window); @@ -142,6 +149,6 @@ extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_cocoawindow_h */ +#endif /* SDL_cocoawindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m index cfad54854..b1a5b465d 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,9 @@ #include "SDL_cocoavideo.h" #include "SDL_cocoashape.h" #include "SDL_cocoamouse.h" +#include "SDL_cocoamousetap.h" #include "SDL_cocoaopengl.h" +#include "SDL_cocoaopengles.h" #include "SDL_assert.h" /* #define DEBUG_COCOAWINDOW */ @@ -64,10 +66,31 @@ - (NSDragOperation)draggingEntered:(id )sender; - (BOOL)performDragOperation:(id )sender; - (BOOL)wantsPeriodicDraggingUpdates; +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem; + +- (SDL_Window*)findSDLWindow; @end @implementation SDLWindow +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + /* Only allow using the macOS native fullscreen toggle menubar item if the + * window is resizable and not in a SDL fullscreen mode. + */ + if ([menuItem action] == @selector(toggleFullScreen:)) { + SDL_Window *window = [self findSDLWindow]; + if (window == NULL) { + return NO; + } else if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) { + return NO; + } else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) { + return NO; + } + } + return [super validateMenuItem:menuItem]; +} + - (BOOL)canBecomeKeyWindow { return YES; @@ -82,7 +105,7 @@ { [super sendEvent:event]; - if ([event type] != NSLeftMouseUp) { + if ([event type] != NSEventTypeLeftMouseUp) { return; } @@ -116,11 +139,10 @@ - (BOOL)performDragOperation:(id )sender { @autoreleasepool { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); NSPasteboard *pasteboard = [sender draggingPasteboard]; NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; NSString *desiredType = [pasteboard availableTypeFromArray:types]; - SDL_Window *sdlwindow = nil; + SDL_Window *sdlwindow = [self findSDLWindow]; if (desiredType == nil) { return NO; /* can't accept anything that's being dropped here. */ @@ -157,16 +179,6 @@ } } - /* !!! FIXME: is there a better way to do this? */ - if (_this) { - for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { - NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; - if (nswindow == self) { - break; - } - } - } - if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) { return NO; } @@ -181,6 +193,24 @@ return NO; } +- (SDL_Window*)findSDLWindow +{ + SDL_Window *sdlwindow = NULL; + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + + /* !!! FIXME: is there a better way to do this? */ + if (_this) { + for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { + NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; + if (nswindow == self) { + break; + } + } + } + + return sdlwindow; +} + @end @@ -220,15 +250,15 @@ GetWindowStyle(SDL_Window * window) NSUInteger style = 0; if (window->flags & SDL_WINDOW_FULLSCREEN) { - style = NSBorderlessWindowMask; + style = NSWindowStyleMaskBorderless; } else { if (window->flags & SDL_WINDOW_BORDERLESS) { - style = NSBorderlessWindowMask; + style = NSWindowStyleMaskBorderless; } else { - style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask); + style = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable); } if (window->flags & SDL_WINDOW_RESIZABLE) { - style |= NSResizableWindowMask; + style |= NSWindowStyleMaskResizable; } } return style; @@ -491,6 +521,11 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; ConvertNSRect([nswindow screen], fullscreen, &rect); + if (inFullscreenTransition) { + /* We'll take care of this at the end of the transition */ + return; + } + if (s_moveHack) { SDL_bool blockMove = ((SDL_GetTicks() - s_moveHack) < 500); @@ -594,8 +629,8 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) [NSMenu setMenuBarVisible:NO]; } - const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask; - _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags; + const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; + _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; SDL_ToggleModState(KMOD_CAPS, newflags != 0); } @@ -641,7 +676,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) { SDL_Window *window = _data->window; - SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask)); + SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); isFullscreenSpace = YES; inFullscreenTransition = YES; @@ -666,6 +701,8 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)windowDidEnterFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; inFullscreenTransition = NO; @@ -673,6 +710,11 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) pendingWindowOperation = PENDING_OPERATION_NONE; [self setFullscreenSpace:NO]; } else { + /* Unset the resizable flag. + This is a workaround for https://bugzilla.libsdl.org/show_bug.cgi?id=3697 + */ + SetWindowStyle(window, [nswindow styleMask] & (~NSWindowStyleMaskResizable)); + if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { [NSMenu setMenuBarVisible:NO]; } @@ -683,6 +725,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) */ window->w = 0; window->h = 0; + [self windowDidMove:aNotification]; [self windowDidResize:aNotification]; } } @@ -691,13 +734,13 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) { SDL_Window *window = _data->window; + isFullscreenSpace = NO; + inFullscreenTransition = YES; + /* As of OS X 10.11, the window seems to need to be resizable when exiting a Space, in order for it to resize back to its windowed-mode size. */ - SetWindowStyle(window, GetWindowStyle(window) | NSResizableWindowMask); - - isFullscreenSpace = NO; - inFullscreenTransition = YES; + SetWindowStyle(window, GetWindowStyle(window) | NSWindowStyleMaskResizable); } - (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification @@ -708,7 +751,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) return; } - SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask)); + SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); isFullscreenSpace = YES; inFullscreenTransition = NO; @@ -744,11 +787,36 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) [NSMenu setMenuBarVisible:YES]; pendingWindowOperation = PENDING_OPERATION_NONE; + +#if 0 +/* This fixed bug 3719, which is that changing window size while fullscreen + doesn't take effect when leaving fullscreen, but introduces bug 3809, + which is that a maximized window doesn't go back to normal size when + restored, so this code is disabled until we can properly handle the + beginning and end of maximize and restore. + */ + /* Restore windowed size and position in case it changed while fullscreen */ + { + NSRect rect; + rect.origin.x = window->windowed.x; + rect.origin.y = window->windowed.y; + rect.size.width = window->windowed.w; + rect.size.height = window->windowed.h; + ConvertNSRect([nswindow screen], NO, &rect); + + s_moveHack = 0; + [nswindow setContentSize:rect.size]; + [nswindow setFrameOrigin:rect.origin]; + s_moveHack = SDL_GetTicks(); + } +#endif /* 0 */ + /* Force the size change event in case it was delivered earlier while the window was still animating into place. */ window->w = 0; window->h = 0; + [self windowDidMove:aNotification]; [self windowDidResize:aNotification]; /* FIXME: Why does the window get hidden? */ @@ -839,7 +907,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) switch ([theEvent buttonNumber]) { case 0: - if (([theEvent modifierFlags] & NSControlKeyMask) && + if (([theEvent modifierFlags] & NSEventModifierFlagControl) && GetHintCtrlClickEmulateRightClick()) { wasCtrlLeft = YES; button = SDL_BUTTON_RIGHT; @@ -1085,6 +1153,11 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)drawRect:(NSRect)dirtyRect { + /* Force the graphics context to clear to black so we don't get a flash of + white until the app is ready to draw. In practice on modern macOS, this + only gets called for window creation and other extraordinary events. */ + [[NSColor blackColor] setFill]; + NSRectFill(dirtyRect); SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0); } @@ -1168,12 +1241,12 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created { unsigned long style = [nswindow styleMask]; - if (style == NSBorderlessWindowMask) { + if (style == NSWindowStyleMaskBorderless) { window->flags |= SDL_WINDOW_BORDERLESS; } else { window->flags &= ~SDL_WINDOW_BORDERLESS; } - if (style & NSResizableWindowMask) { + if (style & NSWindowStyleMaskResizable) { window->flags |= SDL_WINDOW_RESIZABLE; } else { window->flags &= ~SDL_WINDOW_RESIZABLE; @@ -1249,7 +1322,6 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) @catch (NSException *e) { return SDL_SetError("%s", [[e reason] UTF8String]); } - [nswindow setBackgroundColor:[NSColor blackColor]]; if (videodata->allow_spaces) { SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); @@ -1271,7 +1343,14 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) [contentView setWantsBestResolutionOpenGLSurface:YES]; } } - +#if SDL_VIDEO_OPENGL_ES2 +#if SDL_VIDEO_OPENGL_EGL + if ((window->flags & SDL_WINDOW_OPENGL) && + _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { + [contentView setWantsLayer:TRUE]; + } +#endif /* SDL_VIDEO_OPENGL_EGL */ +#endif /* SDL_VIDEO_OPENGL_ES2 */ [nswindow setContentView:contentView]; [contentView release]; @@ -1282,6 +1361,25 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) [nswindow release]; return -1; } + + if (!(window->flags & SDL_WINDOW_OPENGL)) { + return 0; + } + + /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ +#if SDL_VIDEO_OPENGL_ES2 + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { +#if SDL_VIDEO_OPENGL_EGL + if (Cocoa_GLES_SetupWindow(_this, window) < 0) { + Cocoa_DestroyWindow(_this, window); + return -1; + } + return 0; +#else + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); +#endif /* SDL_VIDEO_OPENGL_EGL */ + } +#endif /* SDL_VIDEO_OPENGL_ES2 */ return 0; }} @@ -1534,7 +1632,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display rect.origin.y += (screenRect.size.height - rect.size.height); } - [nswindow setStyleMask:NSBorderlessWindowMask]; + [nswindow setStyleMask:NSWindowStyleMaskBorderless]; } else { rect.origin.x = window->windowed.x; rect.origin.y = window->windowed.y; @@ -1634,8 +1732,13 @@ Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) void Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { - /* Move the cursor to the nearest point in the window */ + SDL_Mouse *mouse = SDL_GetMouse(); SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + /* Enable or disable the event tap as necessary */ + Cocoa_EnableMouseEventTap(mouse->driverdata, grabbed); + + /* Move the cursor to the nearest point in the window */ if (grabbed && data && ![data->listener isMoving]) { int x, y; CGPoint cgpoint; @@ -1700,7 +1803,7 @@ Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.cocoa.window = nswindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c index 4b979f36c..d9d0c3a03 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h index f5f9a46fd..98d943fa3 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_wm_h -#define _SDL_directfb_wm_h +#ifndef SDL_directfb_wm_h_ +#define SDL_directfb_wm_h_ #include "SDL_DirectFB_video.h" @@ -51,6 +51,6 @@ extern DFBResult DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch); -#endif /* _SDL_directfb_wm_h */ +#endif /* SDL_directfb_wm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c index 52a4b5367..12cf21af5 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h index bd99a3faf..1a370c641 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_dyn_h -#define _SDL_DirectFB_dyn_h +#ifndef SDL_DirectFB_dyn_h_ +#define SDL_DirectFB_dyn_h_ #define DFB_SYMS \ DFB_SYM(DFBResult, DirectFBError, (const char *msg, DFBResult result), (msg, result), return) \ @@ -36,4 +36,6 @@ int SDL_DirectFB_LoadLibrary(void); void SDL_DirectFB_UnLoadLibrary(void); -#endif +#endif /* SDL_DirectFB_dyn_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c index 0bf9fdba5..27cf19f91 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -743,9 +743,6 @@ void DirectFB_QuitKeyboard(_THIS) { /* SDL_DFB_DEVICEDATA(_this); */ - - SDL_KeyboardQuit(); - } #endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h index 2931ad2a1..ccbdb0ac9 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_events_h -#define _SDL_DirectFB_events_h +#ifndef SDL_DirectFB_events_h_ +#define SDL_DirectFB_events_h_ #include "../SDL_sysvideo.h" @@ -29,4 +29,6 @@ extern void DirectFB_InitKeyboard(_THIS); extern void DirectFB_QuitKeyboard(_THIS); extern void DirectFB_PumpEventsWindow(_THIS); -#endif +#endif /* SDL_DirectFB_events_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c index 9d0abf560..a3b8b45bf 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h index 9911eff56..75d8bbfd9 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_modes_h -#define _SDL_directfb_modes_h +#ifndef SDL_directfb_modes_h_ +#define SDL_directfb_modes_h_ #include @@ -54,6 +54,6 @@ extern void DirectFB_QuitModes(_THIS); extern void DirectFB_SetContext(_THIS, SDL_Window *window); -#endif /* _SDL_directfb_modes_h */ +#endif /* SDL_directfb_modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c index 0657d2f06..a2b3e416e 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,10 +36,8 @@ static SDL_Cursor *DirectFB_CreateDefaultCursor(void); static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y); static int DirectFB_ShowCursor(SDL_Cursor * cursor); -static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_FreeCursor(SDL_Cursor * cursor); static void DirectFB_WarpMouse(SDL_Window * window, int x, int y); -static void DirectFB_FreeMouse(SDL_Mouse * mouse); static const char *arrow[] = { /* pixels */ @@ -84,11 +82,9 @@ DirectFB_CreateDefaultCursor(void) SDL_DFB_DEVICEDATA(dev); DFB_CursorData *curdata; - DFBResult ret; DFBSurfaceDescription dsc; SDL_Cursor *cursor; Uint32 *dest; - Uint32 *p; int pitch, i, j; SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor)); @@ -139,7 +135,6 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) SDL_DFB_DEVICEDATA(dev); DFB_CursorData *curdata; - DFBResult ret; DFBSurfaceDescription dsc; SDL_Cursor *cursor; Uint32 *dest; @@ -184,7 +179,6 @@ static int DirectFB_ShowCursor(SDL_Cursor * cursor) { SDL_DFB_CURSORDATA(cursor); - DFBResult ret; SDL_Window *window; window = SDL_GetFocusWindow(); @@ -239,7 +233,6 @@ DirectFB_WarpMouse(SDL_Window * window, int x, int y) SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_WindowData *windata = (DFB_WindowData *) window->driverdata; - DFBResult ret; int cx, cy; SDL_DFB_CHECKERR(windata->dfbwin->GetPosition(windata->dfbwin, &cx, &cy)); @@ -253,8 +246,10 @@ DirectFB_WarpMouse(SDL_Window * window, int x, int y) #if USE_MULTI_API +static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y); +static void DirectFB_FreeMouse(SDL_Mouse * mouse); static int id_mask; diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h index 4e2f27a92..e1236a07e 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_mouse_h -#define _SDL_DirectFB_mouse_h +#ifndef SDL_DirectFB_mouse_h_ +#define SDL_DirectFB_mouse_h_ #include @@ -39,6 +39,6 @@ struct _DFB_CursorData extern void DirectFB_InitMouse(_THIS); extern void DirectFB_QuitMouse(_THIS); -#endif /* _SDL_DirectFB_mouse_h */ +#endif /* SDL_DirectFB_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c index 065854a08..93d2fdeff 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,9 +117,9 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path) if (path == NULL) { - path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); + path = SDL_getenv("SDL_OPENGL_LIBRARY"); if (path == NULL) { - path = "libGL.so"; + path = "libGL.so.1"; } } @@ -133,7 +133,6 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path) SDL_DFB_DEBUG("Loaded library: %s\n", path); _this->gl_config.dll_handle = handle; - _this->gl_config.driver_loaded = 1; if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path)); @@ -151,16 +150,10 @@ static void DirectFB_GL_UnloadLibrary(_THIS) { #if 0 - int ret; - - if (_this->gl_config.driver_loaded) { - - ret = GL_UnloadObject(_this->gl_config.dll_handle); - if (ret) - SDL_DFB_ERR("Error #%d trying to unload library.\n", ret); - _this->gl_config.dll_handle = NULL; - _this->gl_config.driver_loaded = 0; - } + int ret = GL_UnloadObject(_this->gl_config.dll_handle); + if (ret) + SDL_DFB_ERR("Error #%d trying to unload library.\n", ret); + _this->gl_config.dll_handle = NULL; #endif /* Free OpenGL memory */ SDL_free(_this->gl_data); @@ -246,18 +239,12 @@ DirectFB_GL_GetSwapInterval(_THIS) return 0; } -void +int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) { SDL_DFB_WINDOWDATA(window); - DFBRegion region; DirectFB_GLContext *p; - region.x1 = 0; - region.y1 = 0; - region.x2 = window->w; - region.y2 = window->h; - #if 0 if (devdata->glFinish) devdata->glFinish(); @@ -273,9 +260,9 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) } SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL, DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC )); - return; + return 0; error: - return; + return -1; } void diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h index 6391ee4f3..9463e1bba 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ -#ifndef _SDL_directfb_opengl_h -#define _SDL_directfb_opengl_h +#ifndef SDL_directfb_opengl_h_ +#define SDL_directfb_opengl_h_ #include "SDL_DirectFB_video.h" @@ -50,7 +50,7 @@ extern int DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int DirectFB_GL_SetSwapInterval(_THIS, int interval); extern int DirectFB_GL_GetSwapInterval(_THIS); -extern void DirectFB_GL_SwapWindow(_THIS, SDL_Window * window); +extern int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window); extern void DirectFB_GL_DeleteContext(_THIS, SDL_GLContext context); extern void DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window); @@ -59,6 +59,6 @@ extern void DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window); #endif /* SDL_DIRECTFB_OPENGL */ -#endif /* _SDL_directfb_opengl_h */ +#endif /* SDL_directfb_opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c index 4a1bf46b8..4054f732a 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -217,7 +217,9 @@ static SDL_INLINE IDirectFBSurface *get_dfb_surface(SDL_Window *window) SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + if (!SDL_GetWindowWMInfo(window, &wm_info)) { + return NULL; + } return wm_info.info.dfb.surface; } @@ -228,7 +230,9 @@ static SDL_INLINE IDirectFBWindow *get_dfb_window(SDL_Window *window) SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + if (!SDL_GetWindowWMInfo(window, &wm_info)) { + return NULL; + } return wm_info.info.dfb.window; } @@ -332,7 +336,7 @@ DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -int +static int DirectFB_RenderClear(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; @@ -344,7 +348,6 @@ DirectFB_RenderClear(SDL_Renderer * renderer) destsurf->Clear(destsurf, renderer->r, renderer->g, renderer->b, renderer->a); - return 0; } @@ -357,6 +360,10 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) DirectFB_RenderData *data = NULL; DFBSurfaceCapabilities scaps; + if (!winsurf) { + return NULL; + } + SDL_DFB_ALLOC_CLEAR(renderer, sizeof(*renderer)); SDL_DFB_ALLOC_CLEAR(data, sizeof(*data)); @@ -530,7 +537,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) /* find the right pixelformat */ pixelformat = DirectFB_SDLToDFBPixelFormat(texture->format); if (pixelformat == DSPF_UNKNOWN) { - SDL_SetError("Unknown pixel format %d\n", data->format); + SDL_SetError("Unknown pixel format %d", data->format); goto error; } @@ -1273,7 +1280,7 @@ DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void * pixels, int pitch) { Uint32 sdl_format; - void * laypixels; + unsigned char* laypixels; int laypitch; DFBSurfacePixelFormat dfb_format; DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; @@ -1303,7 +1310,7 @@ DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Window *window = renderer->window; SDL_DFB_WINDOWDATA(window); Uint32 sdl_format; - void * laypixels; + unsigned char* laypixels; int laypitch; DFBSurfacePixelFormat dfb_format; diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h index be016b084..bc3c07595 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c index 3239e3021..36559319f 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,25 +29,22 @@ #include "../SDL_shape_internals.h" -SDL_Window* -DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { - return SDL_CreateWindow(title,x,y,w,h,flags /* | SDL_DFB_WINDOW_SHAPED */); -} - SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window) { SDL_WindowShaper* result = NULL; + SDL_ShapeData* data; + int resized_properly; result = malloc(sizeof(SDL_WindowShaper)); result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; - SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData)); + data = SDL_malloc(sizeof(SDL_ShapeData)); result->driverdata = data; data->surface = NULL; window->shaper = result; - int resized_properly = DirectFB_ResizeWindowShape(window); + resized_properly = DirectFB_ResizeWindowShape(window); SDL_assert(resized_properly == 0); return result; diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h index 46be39fbf..f0a418df5 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_shape_h -#define _SDL_DirectFB_shape_h +#ifndef SDL_DirectFB_shape_h_ +#define SDL_DirectFB_shape_h_ #include @@ -31,9 +31,8 @@ typedef struct { IDirectFBSurface *surface; } SDL_ShapeData; -extern SDL_Window* DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); extern SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window); extern int DirectFB_ResizeWindowShape(SDL_Window* window); extern int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); -#endif /* _SDL_DirectFB_shape_h */ +#endif /* SDL_DirectFB_shape_h_ */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c index d339dd78e..45fa81dc1 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,14 +22,10 @@ #if SDL_VIDEO_DRIVER_DIRECTFB -#include "SDL_DirectFB_video.h" - -#include "SDL_DirectFB_events.h" /* * #include "SDL_DirectFB_keyboard.h" */ #include "SDL_DirectFB_modes.h" -#include "SDL_DirectFB_mouse.h" #include "SDL_DirectFB_opengl.h" #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_WM.h" @@ -107,16 +103,14 @@ DirectFB_CreateDevice(int devindex) /* Initialize all variables that we clean on shutdown */ SDL_DFB_ALLOC_CLEAR(device, sizeof(SDL_VideoDevice)); - /* Set the function pointers */ - /* Set the function pointers */ device->VideoInit = DirectFB_VideoInit; device->VideoQuit = DirectFB_VideoQuit; device->GetDisplayModes = DirectFB_GetDisplayModes; device->SetDisplayMode = DirectFB_SetDisplayMode; device->PumpEvents = DirectFB_PumpEventsWindow; - device->CreateWindow = DirectFB_CreateWindow; - device->CreateWindowFrom = DirectFB_CreateWindowFrom; + device->CreateSDLWindow = DirectFB_CreateWindow; + device->CreateSDLWindowFrom = DirectFB_CreateWindowFrom; device->SetWindowTitle = DirectFB_SetWindowTitle; device->SetWindowIcon = DirectFB_SetWindowIcon; device->SetWindowPosition = DirectFB_SetWindowPosition; @@ -178,7 +172,7 @@ DirectFB_DeviceInformation(IDirectFB * dfb) SDL_DFB_LOG( "Driver Version: %d.%d", desc.driver.major, desc.driver.minor); - SDL_DFB_LOG( "Video memoory: %d", desc.video_memory); + SDL_DFB_LOG( "Video memory: %d", desc.video_memory); SDL_DFB_LOG( "Blitting flags:"); for (n = 0; blitting_flags[n].flag; n++) { @@ -234,8 +228,7 @@ DirectFB_VideoInit(_THIS) DirectFBSetOption("disable-module", "x11input"); } - /* FIXME: Reenable as default once multi kbd/mouse interface is sorted out */ - devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 0); /* default: on */ + devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 1); /* default: on */ if (!devdata->use_linux_input) { diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h index b36ace0dd..f019031cf 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_DirectFB_video_h -#define _SDL_DirectFB_video_h +#ifndef SDL_DirectFB_video_h_ +#define SDL_DirectFB_video_h_ #include #include @@ -167,4 +167,4 @@ DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format); void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri); -#endif /* _SDL_DirectFB_video_h */ +#endif /* SDL_DirectFB_video_h_ */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c index 40bbe6aee..55171ed1d 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -458,9 +458,29 @@ SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info) { + const Uint32 version = ((((Uint32) info->version.major) * 1000000) + + (((Uint32) info->version.minor) * 10000) + + (((Uint32) info->version.patch))); + SDL_DFB_DEVICEDATA(_this); SDL_DFB_WINDOWDATA(window); + /* Before 2.0.6, it was possible to build an SDL with DirectFB support + (SDL_SysWMinfo will be large enough to hold DirectFB info), but build + your app against SDL headers that didn't have DirectFB support + (SDL_SysWMinfo could be smaller than DirectFB needs. This would lead + to an app properly using SDL_GetWindowWMInfo() but we'd accidentally + overflow memory on the stack or heap. To protect against this, we've + padded out the struct unconditionally in the headers and DirectFB will + just return an error for older apps using this function. Those apps + will need to be recompiled against newer headers or not use DirectFB, + maybe by forcing SDL_VIDEODRIVER=x11. */ + if (version < 2000006) { + info->subsystem = SDL_SYSWM_UNKNOWN; + SDL_SetError("Version must be 2.0.6 or newer"); + return SDL_FALSE; + } + if (info->version.major == SDL_MAJOR_VERSION && info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_DIRECTFB; @@ -469,7 +489,7 @@ DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, info->info.dfb.surface = windata->surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h index 4b9970812..f03aab2e5 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_window_h -#define _SDL_directfb_window_h +#ifndef SDL_directfb_window_h_ +#define SDL_directfb_window_h_ #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_WM.h" @@ -77,6 +77,6 @@ extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, extern void DirectFB_AdjustWindowSurface(SDL_Window * window); extern int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); -#endif /* _SDL_directfb_window_h */ +#endif /* SDL_directfb_window_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c b/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c index a5a944304..e9918bd8e 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h b/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h index d2f78698d..a5636be53 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c index 01c8a5abb..64c77810e 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h index 37d198f90..5d6b7aed5 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c index 96f47813a..317faf4fd 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,6 +84,7 @@ DUMMY_CreateDevice(int devindex) SDL_OutOfMemory(); return (0); } + device->is_dummy = SDL_TRUE; /* Set the function pointers */ device->VideoInit = DUMMY_VideoInit; diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h index 0126ba183..c77034935 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_nullvideo_h -#define _SDL_nullvideo_h +#ifndef SDL_nullvideo_h_ +#define SDL_nullvideo_h_ #include "../SDL_sysvideo.h" -#endif /* _SDL_nullvideo_h */ +#endif /* SDL_nullvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c index a4720e402..14bc24030 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -270,7 +270,7 @@ static const SDL_Scancode emscripten_scancode_table[] = { /* "borrowed" from SDL_windowsevents.c */ -int +static int Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text) { if (codepoint <= 0x7F) { @@ -297,13 +297,23 @@ Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text) return SDL_TRUE; } -EM_BOOL +static EM_BOOL +Emscripten_HandlePointerLockChange(int eventType, const EmscriptenPointerlockChangeEvent *changeEvent, void *userData) +{ + SDL_WindowData *window_data = (SDL_WindowData *) userData; + /* keep track of lock losses, so we can regrab if/when appropriate. */ + window_data->has_pointer_lock = changeEvent->isActive; + return 0; +} + + +static EM_BOOL Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; + const int isPointerLocked = window_data->has_pointer_lock; int mx, my; static double residualx = 0, residualy = 0; - EmscriptenPointerlockChangeEvent pointerlock_status; /* rescale (in case canvas is being scaled)*/ double client_w, client_h, xscale, yscale; @@ -311,10 +321,6 @@ Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent xscale = window_data->window->w / client_w; yscale = window_data->window->h / client_h; - /* check for pointer lock */ - int isPointerLockSupported = emscripten_get_pointerlock_status(&pointerlock_status); - int isPointerLocked = isPointerLockSupported == EMSCRIPTEN_RESULT_SUCCESS ? pointerlock_status.isActive : SDL_FALSE; - if (isPointerLocked) { residualx += mouseEvent->movementX * xscale; residualy += mouseEvent->movementY * yscale; @@ -332,11 +338,14 @@ Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; - uint32_t sdl_button; + Uint8 sdl_button; + Uint8 sdl_button_state; + SDL_EventType sdl_event_type; + switch (mouseEvent->button) { case 0: sdl_button = SDL_BUTTON_LEFT; @@ -351,22 +360,27 @@ Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEve return 0; } - SDL_EventType sdl_event_type = (eventType == EMSCRIPTEN_EVENT_MOUSEDOWN ? SDL_PRESSED : SDL_RELEASED); - SDL_SendMouseButton(window_data->window, 0, sdl_event_type, sdl_button); + if (eventType == EMSCRIPTEN_EVENT_MOUSEDOWN) { + if (SDL_GetMouse()->relative_mode && !window_data->has_pointer_lock) { + emscripten_request_pointerlock(NULL, 0); /* try to regrab lost pointer lock. */ + } + sdl_button_state = SDL_PRESSED; + sdl_event_type = SDL_MOUSEBUTTONDOWN; + } else { + sdl_button_state = SDL_RELEASED; + sdl_event_type = SDL_MOUSEBUTTONUP; + } + SDL_SendMouseButton(window_data->window, 0, sdl_button_state, sdl_button); return SDL_GetEventState(sdl_event_type) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; int mx = mouseEvent->canvasX, my = mouseEvent->canvasY; - EmscriptenPointerlockChangeEvent pointerlock_status; - - /* check for pointer lock */ - int isPointerLockSupported = emscripten_get_pointerlock_status(&pointerlock_status); - int isPointerLocked = isPointerLockSupported == EMSCRIPTEN_RESULT_SUCCESS ? pointerlock_status.isActive : SDL_FALSE; + const int isPointerLocked = window_data->has_pointer_lock; if (!isPointerLocked) { /* rescale (in case canvas is being scaled)*/ @@ -382,15 +396,15 @@ Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEven return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData) { SDL_WindowData *window_data = userData; - SDL_SendMouseWheel(window_data->window, 0, wheelEvent->deltaX, -wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, (float)-wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL); return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -405,7 +419,7 @@ Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, vo return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -423,6 +437,7 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo for (i = 0; i < touchEvent->numTouches; i++) { SDL_FingerID id; float x, y; + int mx, my; if (!touchEvent->touches[i].isChanged) continue; @@ -431,11 +446,14 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo x = touchEvent->touches[i].canvasX / client_w; y = touchEvent->touches[i].canvasY / client_h; + mx = x * window_data->window->w; + my = y * window_data->window->h; + if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) { if (!window_data->finger_touching) { window_data->finger_touching = SDL_TRUE; window_data->first_finger = id; - SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y); + SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); } SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f); @@ -445,7 +463,7 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo } } else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) { if ((window_data->finger_touching) && (window_data->first_finger == id)) { - SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y); + SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); } SDL_SendTouchMotion(deviceId, id, x, y, 1.0f); @@ -468,10 +486,12 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo return preventDefault; } -EM_BOOL +static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { Uint32 scancode; + SDL_bool prevent_default; + SDL_bool is_nav_key; /* .keyCode is deprecated, but still the most reliable way to get keys */ if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) { @@ -499,18 +519,25 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi } } - SDL_bool prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE; + prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE; /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress * we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX */ - if (eventType == EMSCRIPTEN_EVENT_KEYDOWN && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE && keyEvent->keyCode != 8 /* backspace */ && keyEvent->keyCode != 9 /* tab */) + is_nav_key = keyEvent->keyCode == 8 /* backspace */ || + keyEvent->keyCode == 9 /* tab */ || + keyEvent->keyCode == 37 /* left */ || + keyEvent->keyCode == 38 /* up */ || + keyEvent->keyCode == 39 /* right */ || + keyEvent->keyCode == 40 /* down */; + + if (eventType == EMSCRIPTEN_EVENT_KEYDOWN && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE && !is_nav_key) prevent_default = SDL_FALSE; return prevent_default; } -EM_BOOL +static EM_BOOL Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { char text[5]; @@ -520,7 +547,7 @@ Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent return SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -541,13 +568,15 @@ Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChang return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData) { SDL_WindowData *window_data = userData; /* update pixel ratio */ - window_data->pixel_ratio = emscripten_get_device_pixel_ratio(); + if (window_data->window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + window_data->pixel_ratio = emscripten_get_device_pixel_ratio(); + } if(!(window_data->window->flags & FULLSCREEN_MASK)) { @@ -591,7 +620,7 @@ Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userDat return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChangeEvent *visEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -602,6 +631,8 @@ Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChang void Emscripten_RegisterEventHandlers(SDL_WindowData *data) { + const char *keyElement; + /* There is only one window and that window is the canvas */ emscripten_set_mousemove_callback("#canvas", data, 0, Emscripten_HandleMouseMove); @@ -621,8 +652,10 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data) emscripten_set_touchmove_callback("#canvas", data, 0, Emscripten_HandleTouch); emscripten_set_touchcancel_callback("#canvas", data, 0, Emscripten_HandleTouch); + emscripten_set_pointerlockchange_callback("#document", data, 0, Emscripten_HandlePointerLockChange); + /* Keyboard events are awkward */ - const char *keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); + keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); if (!keyElement) keyElement = "#window"; emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey); @@ -639,6 +672,8 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data) void Emscripten_UnregisterEventHandlers(SDL_WindowData *data) { + const char *target; + /* only works due to having one window */ emscripten_set_mousemove_callback("#canvas", NULL, 0, NULL); @@ -658,14 +693,15 @@ Emscripten_UnregisterEventHandlers(SDL_WindowData *data) emscripten_set_touchmove_callback("#canvas", NULL, 0, NULL); emscripten_set_touchcancel_callback("#canvas", NULL, 0, NULL); - const char *target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); + emscripten_set_pointerlockchange_callback("#document", NULL, 0, NULL); + + target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); if (!target) { target = "#window"; } emscripten_set_keydown_callback(target, NULL, 0, NULL); emscripten_set_keyup_callback(target, NULL, 0, NULL); - emscripten_set_keypress_callback(target, NULL, 0, NULL); emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL); diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h index 089ff60da..3a4e05832 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ -#ifndef _SDL_emscriptenevents_h -#define _SDL_emscriptenevents_h +#ifndef SDL_emscriptenevents_h_ +#define SDL_emscriptenevents_h_ #include "SDL_emscriptenvideo.h" @@ -31,9 +31,10 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data); extern void Emscripten_UnregisterEventHandlers(SDL_WindowData *data); -extern int +extern EM_BOOL Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userData); -#endif /* _SDL_emscriptenevents_h */ + +#endif /* SDL_emscriptenevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c index 8a6a465d9..bfdec3b56 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h index b2a6d3b37..49a215a2a 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenframebuffer_h -#define _SDL_emscriptenframebuffer_h +#ifndef SDL_emscriptenframebuffer_h_ +#define SDL_emscriptenframebuffer_h_ extern int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); extern int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window * window); -#endif /* _SDL_emscriptenframebuffer_h */ +#endif /* SDL_emscriptenframebuffer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c index 512ad2220..490f5b05d 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,9 +32,8 @@ #include "../../events/SDL_mouse_c.h" #include "SDL_assert.h" - static SDL_Cursor* -Emscripten_CreateDefaultCursor() +Emscripten_CreateCursorFromString(const char* cursor_str, SDL_bool is_custom) { SDL_Cursor* cursor; Emscripten_CursorData *curdata; @@ -48,7 +47,8 @@ Emscripten_CreateDefaultCursor() return NULL; } - curdata->system_cursor = "default"; + curdata->system_cursor = cursor_str; + curdata->is_custom = is_custom; cursor->driverdata = curdata; } else { @@ -58,19 +58,82 @@ Emscripten_CreateDefaultCursor() return cursor; } -/* static SDL_Cursor* -Emscripten_CreateCursor(SDL_Surface* sruface, int hot_x, int hot_y) +Emscripten_CreateDefaultCursor() { - return Emscripten_CreateDefaultCursor(); + return Emscripten_CreateCursorFromString("default", SDL_FALSE); +} + +static SDL_Cursor* +Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) +{ + const char *cursor_url = NULL; + SDL_Surface *conv_surf; + + conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0); + + if (!conv_surf) { + return NULL; + } + + cursor_url = (const char *)EM_ASM_INT({ + var w = $0; + var h = $1; + var hot_x = $2; + var hot_y = $3; + var pixels = $4; + + var canvas = document.createElement("canvas"); + canvas.width = w; + canvas.height = h; + + var ctx = canvas.getContext("2d"); + + var image = ctx.createImageData(w, h); + var data = image.data; + var src = pixels >> 2; + var dst = 0; + var num; + if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { + // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray, + // not UInt8ClampedArray. These don't have buffers, so we need to revert + // to copying a byte at a time. We do the undefined check because modern + // browsers do not define CanvasPixelArray anymore. + num = data.length; + while (dst < num) { + var val = HEAP32[src]; // This is optimized. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; + data[dst ] = val & 0xff; + data[dst+1] = (val >> 8) & 0xff; + data[dst+2] = (val >> 16) & 0xff; + data[dst+3] = (val >> 24) & 0xff; + src++; + dst += 4; + } + } else { + var data32 = new Int32Array(data.buffer); + num = data32.length; + data32.set(HEAP32.subarray(src, src + num)); + } + + ctx.putImageData(image, 0, 0); + var url = hot_x === 0 && hot_y === 0 + ? "url(" + canvas.toDataURL() + "), auto" + : "url(" + canvas.toDataURL() + ") " + hot_x + " " + hot_y + ", auto"; + + var urlBuf = _malloc(url.length + 1); + stringToUTF8(url, urlBuf, url.length + 1); + + return urlBuf; + }, surface->w, surface->h, hot_x, hot_y, conv_surf->pixels); + + SDL_FreeSurface(conv_surf); + + return Emscripten_CreateCursorFromString(cursor_url, SDL_TRUE); } -*/ static SDL_Cursor* Emscripten_CreateSystemCursor(SDL_SystemCursor id) { - SDL_Cursor *cursor; - Emscripten_CursorData *curdata; const char *cursor_name = NULL; switch(id) { @@ -114,22 +177,7 @@ Emscripten_CreateSystemCursor(SDL_SystemCursor id) return NULL; } - cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); - if (!cursor) { - SDL_OutOfMemory(); - return NULL; - } - curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata)); - if (!curdata) { - SDL_OutOfMemory(); - SDL_free(cursor); - return NULL; - } - - curdata->system_cursor = cursor_name; - cursor->driverdata = curdata; - - return cursor; + return Emscripten_CreateCursorFromString(cursor_name, SDL_FALSE); } static void @@ -140,6 +188,9 @@ Emscripten_FreeCursor(SDL_Cursor* cursor) curdata = (Emscripten_CursorData *) cursor->driverdata; if (curdata != NULL) { + if (curdata->is_custom) { + SDL_free((char *)curdata->system_cursor); + } SDL_free(cursor->driverdata); } @@ -202,9 +253,7 @@ Emscripten_InitMouse() { SDL_Mouse* mouse = SDL_GetMouse(); -/* mouse->CreateCursor = Emscripten_CreateCursor; -*/ mouse->ShowCursor = Emscripten_ShowCursor; mouse->FreeCursor = Emscripten_FreeCursor; mouse->WarpMouse = Emscripten_WarpMouse; @@ -217,17 +266,6 @@ Emscripten_InitMouse() void Emscripten_FiniMouse() { - SDL_Mouse* mouse = SDL_GetMouse(); - - Emscripten_FreeCursor(mouse->def_cursor); - mouse->def_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->CreateSystemCursor = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h index 76ea849ed..d6cd4927e 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,15 @@ */ -#ifndef _SDL_emscriptenmouse_h -#define _SDL_emscriptenmouse_h +#ifndef SDL_emscriptenmouse_h_ +#define SDL_emscriptenmouse_h_ + +#include "SDL_stdinc.h" typedef struct _Emscripten_CursorData { const char *system_cursor; + SDL_bool is_custom; } Emscripten_CursorData; extern void @@ -34,6 +37,6 @@ Emscripten_InitMouse(); extern void Emscripten_FiniMouse(); -#endif /* _SDL_emscriptenmouse_h */ +#endif /* SDL_emscriptenmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c index 12a37c604..a6609edc0 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,11 +39,15 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { if (!_this->egl_data) { return SDL_OutOfMemory(); } - + + /* Emscripten forces you to manually cast eglGetProcAddress to the real + function type; grep for "__eglMustCastToProperFunctionPointerType" in + Emscripten's egl.h for details. */ + _this->egl_data->eglGetProcAddress = (void *(EGLAPIENTRY *)(const char *)) eglGetProcAddress; + LOAD_FUNC(eglGetDisplay); LOAD_FUNC(eglInitialize); LOAD_FUNC(eglTerminate); - LOAD_FUNC(eglGetProcAddress); LOAD_FUNC(eglChooseConfig); LOAD_FUNC(eglGetConfigAttrib); LOAD_FUNC(eglCreateContext); @@ -66,8 +70,6 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { return SDL_SetError("Could not initialize EGL"); } - _this->gl_config.driver_loaded = 1; - if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); } else { diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h index edafed822..fbd93cbbb 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenopengles_h -#define _SDL_emscriptenopengles_h +#ifndef SDL_emscriptenopengles_h_ +#define SDL_emscriptenopengles_h_ #if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL @@ -38,12 +38,12 @@ extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path); extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context); extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window); -extern void Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_emscriptenopengles_h */ +#endif /* SDL_emscriptenopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c index 847bb4cf8..cbb933de8 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -91,8 +91,7 @@ Emscripten_CreateDevice(int devindex) device->PumpEvents = Emscripten_PumpEvents; - device->CreateWindow = Emscripten_CreateWindow; - /*device->CreateWindowFrom = Emscripten_CreateWindowFrom;*/ + device->CreateSDLWindow = Emscripten_CreateWindow; device->SetWindowTitle = Emscripten_SetWindowTitle; /*device->SetWindowIcon = Emscripten_SetWindowIcon; device->SetWindowPosition = Emscripten_SetWindowPosition;*/ @@ -111,6 +110,7 @@ Emscripten_CreateDevice(int devindex) device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer; +#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary; device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress; device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary; @@ -121,6 +121,7 @@ Emscripten_CreateDevice(int devindex) device->GL_SwapWindow = Emscripten_GLES_SwapWindow; device->GL_DeleteContext = Emscripten_GLES_DeleteContext; device->GL_GetDrawableSize = Emscripten_GLES_GetDrawableSize; +#endif device->free = Emscripten_DeleteDevice; @@ -228,6 +229,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) } } +#if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { if (!_this->egl_data) { if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -240,6 +242,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } } +#endif wdata->window = window; @@ -263,7 +266,9 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window) if (window->driverdata) { data = (SDL_WindowData *) window->driverdata; /* update pixel ratio */ - data->pixel_ratio = emscripten_get_device_pixel_ratio(); + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + data->pixel_ratio = emscripten_get_device_pixel_ratio(); + } emscripten_set_canvas_size(window->w * data->pixel_ratio, window->h * data->pixel_ratio); /*scale canvas down*/ @@ -282,10 +287,12 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window) data = (SDL_WindowData *) window->driverdata; Emscripten_UnregisterEventHandlers(data); +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } +#endif SDL_free(window->driverdata); window->driverdata = NULL; } diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h index 7618ab6cc..c2001b006 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,15 +20,17 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenvideo_h -#define _SDL_emscriptenvideo_h +#ifndef SDL_emscriptenvideo_h_ +#define SDL_emscriptenvideo_h_ #include "../SDL_sysvideo.h" #include "../../events/SDL_touch_c.h" #include #include +#if SDL_VIDEO_OPENGL_EGL #include +#endif typedef struct SDL_WindowData { @@ -47,8 +49,10 @@ typedef struct SDL_WindowData SDL_bool finger_touching; /* for mapping touch events to mice */ SDL_FingerID first_finger; + + SDL_bool has_pointer_lock; } SDL_WindowData; -#endif /* _SDL_emscriptenvideo_h */ +#endif /* SDL_emscriptenvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h index a353e1aca..3e6188860 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_BWin_h -#define _SDL_BWin_h +#ifndef SDL_BWin_h_ +#define SDL_BWin_h_ #ifdef __cplusplus extern "C" { @@ -38,9 +38,9 @@ extern "C" { #include #include #include -#include +#include #if SDL_VIDEO_OPENGL -#include +#include #endif #include "SDL_events.h" #include "../../main/haiku/SDL_BApp.h" @@ -72,6 +72,7 @@ class SDL_BWin:public BDirectWindow #if SDL_VIDEO_OPENGL _SDL_GLView = NULL; + _gl_type = 0; #endif _shown = false; _inhibit_resize = false; @@ -114,6 +115,8 @@ class SDL_BWin:public BDirectWindow } #endif + delete _prev_frame; + /* Clean up framebuffer stuff */ _buffer_locker->Lock(); #ifdef DRAWTHREAD @@ -133,6 +136,7 @@ class SDL_BWin:public BDirectWindow B_FOLLOW_ALL_SIDES, (B_WILL_DRAW | B_FRAME_EVENTS), gl_flags); + _gl_type = gl_flags; } AddChild(_SDL_GLView); _SDL_GLView->EnableDirectMode(true); @@ -250,6 +254,7 @@ class SDL_BWin:public BDirectWindow virtual void WindowActivated(bool active) { BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */ + msg.AddBool("focusGained", active); _PostWindowEvent(msg); } @@ -442,6 +447,7 @@ class SDL_BWin:public BDirectWindow BBitmap *GetBitmap() { return _bitmap; } #if SDL_VIDEO_OPENGL BGLView *GetGLView() { return _SDL_GLView; } + Uint32 GetGLType() { return _gl_type; } #endif /* Setter methods */ @@ -585,7 +591,7 @@ private: if(msg->FindBool("window-border", &bEnabled) != B_OK) { return; } - SetLook(bEnabled ? B_BORDERED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); + SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); } void _SetResizable(BMessage *msg) { @@ -624,6 +630,7 @@ private: /* Members */ #if SDL_VIDEO_OPENGL BGLView * _SDL_GLView; + Uint32 _gl_type; #endif int32 _last_buttons; @@ -667,4 +674,6 @@ private: * through a draw cycle. Occurs when the previous * buffer provided by DirectConnected() is invalidated. */ -#endif +#endif /* SDL_BWin_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc index fcd1caa26..e7d01b9be 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #if SDL_VIDEO_DRIVER_HAIKU -/* BWindow based framebuffer implementation */ +/* BWindow based clipboard implementation */ #include #include @@ -43,7 +43,7 @@ int BE_SetClipboardText(_THIS, const char *text) { /* Presumably the string of characters is ascii-format */ ssize_t asciiLength = 0; for(; text[asciiLength] != 0; ++asciiLength) {} - clip->AddData("text/plain", B_MIME_TYPE, &text, asciiLength); + clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength); be_clipboard->Commit(); } be_clipboard->Unlock(); @@ -61,8 +61,6 @@ char *BE_GetClipboardText(_THIS) { /* Presumably the string of characters is ascii-format */ clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text, &length); - } else { - be_clipboard->Unlock(); } be_clipboard->Unlock(); } @@ -71,8 +69,8 @@ char *BE_GetClipboardText(_THIS) { result = SDL_strdup(""); } else { /* Copy the data and pass on to SDL */ - result = (char*)SDL_calloc(1, sizeof(char*)*length); - SDL_strlcpy(result, text, length); + result = (char *)SDL_malloc((length + 1) * sizeof(char)); + SDL_strlcpy(result, text, length + 1); } return result; @@ -93,3 +91,5 @@ SDL_bool BE_HasClipboardText(_THIS) { #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h index dd31f19a5..2f7a1c243 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,3 +29,5 @@ extern char *BE_GetClipboardText(_THIS); extern SDL_bool BE_HasClipboardText(_THIS); #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc b/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc index 36513a3b2..c716731a4 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,3 +37,5 @@ void BE_PumpEvents(_THIS) { #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bevents.h b/Engine/lib/sdl/src/video/haiku/SDL_bevents.h index cb756c967..3c090c89e 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bevents.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,3 +35,5 @@ extern void BE_PumpEvents(_THIS); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc index 5e6a300e8..f53c50019 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,9 @@ extern "C" { #endif -int32 BE_UpdateOnce(SDL_Window *window); +#ifndef DRAWTHREAD +static int32 BE_UpdateOnce(SDL_Window *window); +#endif static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { return ((SDL_BWin*)(window->driverdata)); @@ -76,7 +78,8 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window, true); /* Contiguous memory required */ if(bitmap->InitCheck() != B_OK) { - return SDL_SetError("Could not initialize back buffer!\n"); + delete bitmap; + return SDL_SetError("Could not initialize back buffer!"); } @@ -143,7 +146,6 @@ int32 BE_DrawThread(void *data) { /* Blit each clipping rectangle */ bscreen.WaitForRetrace(); for(i = 0; i < numClips; ++i) { - clipping_rect rc = clips[i]; /* Get addresses of the start of each clipping rectangle */ int32 width = clips[i].right - clips[i].left + 1; int32 height = clips[i].bottom - clips[i].top + 1; @@ -199,7 +201,8 @@ void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { * The specific issues have since become rare enough that they may have been * solved, but I doubt it- they were pretty sporadic before now. */ -int32 BE_UpdateOnce(SDL_Window *window) { +#ifndef DRAWTHREAD +static int32 BE_UpdateOnce(SDL_Window *window) { SDL_BWin *bwin = _ToBeWin(window); BScreen bscreen; if(!bscreen.IsValid()) { @@ -224,7 +227,6 @@ int32 BE_UpdateOnce(SDL_Window *window) { /* Blit each clipping rectangle */ bscreen.WaitForRetrace(); for(i = 0; i < numClips; ++i) { - clipping_rect rc = clips[i]; /* Get addresses of the start of each clipping rectangle */ int32 width = clips[i].right - clips[i].left + 1; int32 height = clips[i].bottom - clips[i].top + 1; @@ -246,9 +248,12 @@ int32 BE_UpdateOnce(SDL_Window *window) { } return 0; } +#endif #ifdef __cplusplus } #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h index d6be21f4d..ce0fc6284 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,3 +43,5 @@ extern int32 BE_DrawThread(void *data); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc index 0ae3d3fc1..5c72ecf98 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,7 +41,7 @@ extern "C" { static SDL_Scancode keymap[KEYMAP_SIZE]; static int8 keystate[KEYMAP_SIZE]; -void BE_InitOSKeymap() { +void BE_InitOSKeymap(void) { for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) { keymap[i] = SDL_SCANCODE_UNKNOWN; } @@ -186,3 +186,5 @@ void BE_SetKeyState(int32 bkey, int8 state) { #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h index 632799421..9620c9bdd 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ extern "C" { #include "../../../include/SDL_keyboard.h" -extern void BE_InitOSKeymap(); +extern void BE_InitOSKeymap(void); extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey); extern int8 BE_GetKeyState(int32 bkey); extern void BE_SetKeyState(int32 bkey, int8 state); @@ -40,3 +40,5 @@ extern void BE_SetKeyState(int32 bkey, int8 state); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc index 84aeb1f07..110534280 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ extern "C" { #if WRAP_BMODE /* This wrapper is here so that the driverdata can be freed without freeing the display_mode structure */ -typedef struct SDL_DisplayModeData { +struct SDL_DisplayModeData { display_mode *bmode; }; #endif @@ -310,7 +310,7 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ } if(bscreen.SetMode(bmode) != B_OK) { - return SDL_SetError("Bad video mode\n"); + return SDL_SetError("Bad video mode"); } free(bmode_list); @@ -329,3 +329,5 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h index c3882ba58..38f4b5843 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,3 +44,5 @@ extern int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc index 15454f100..3456932ce 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL #include "SDL_bopengl.h" @@ -35,43 +35,41 @@ extern "C" { #endif -#define BGL_FLAGS BGL_RGB | BGL_DOUBLE - static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { - return ((SDL_BWin*)(window->driverdata)); + return ((SDL_BWin*)(window->driverdata)); } static SDL_INLINE SDL_BApp *_GetBeApp() { - return ((SDL_BApp*)be_app); + return ((SDL_BApp*)be_app); } /* Passing a NULL path means load pointers from the application */ int BE_GL_LoadLibrary(_THIS, const char *path) { /* FIXME: Is this working correctly? */ - image_info info; - int32 cookie = 0; - while (get_next_image_info(0, &cookie, &info) == B_OK) { - void *location = NULL; - if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, - &location) == B_OK) { + image_info info; + int32 cookie = 0; + while (get_next_image_info(0, &cookie, &info) == B_OK) { + void *location = NULL; + if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, + &location) == B_OK) { - _this->gl_config.dll_handle = (void *) info.id; - _this->gl_config.driver_loaded = 1; - SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", - SDL_arraysize(_this->gl_config.driver_path)); - } - } - return 0; + _this->gl_config.dll_handle = (void *) (size_t) info.id; + _this->gl_config.driver_loaded = 1; + SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", + SDL_arraysize(_this->gl_config.driver_path)); + } + } + return 0; } void *BE_GL_GetProcAddress(_THIS, const char *proc) { - if (_this->gl_config.dll_handle != NULL) { - void *location = NULL; - status_t err; - if ((err = - get_image_symbol((image_id) _this->gl_config.dll_handle, + if (_this->gl_config.dll_handle != NULL) { + void *location = NULL; + status_t err; + if ((err = + get_image_symbol((image_id) (size_t) _this->gl_config.dll_handle, proc, B_SYMBOL_TYPE_ANY, &location)) == B_OK) { return location; @@ -79,52 +77,75 @@ void *BE_GL_GetProcAddress(_THIS, const char *proc) SDL_SetError("Couldn't find OpenGL symbol"); return NULL; } - } else { - SDL_SetError("OpenGL library not loaded"); - return NULL; - } + } else { + SDL_SetError("OpenGL library not loaded"); + return NULL; + } } -void BE_GL_SwapWindow(_THIS, SDL_Window * window) { +int BE_GL_SwapWindow(_THIS, SDL_Window * window) { _ToBeWin(window)->SwapBuffers(); + return 0; } int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView()); - return 0; + SDL_BWin* win = (SDL_BWin*)context; + _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL); + return 0; } SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) { - /* FIXME: Not sure what flags should be included here; may want to have - most of them */ - SDL_BWin *bwin = _ToBeWin(window); - bwin->CreateGLView(BGL_FLAGS); - return (SDL_GLContext)(bwin); + /* FIXME: Not sure what flags should be included here; may want to have + most of them */ + SDL_BWin *bwin = _ToBeWin(window); + Uint32 gl_flags = BGL_RGB; + if (_this->gl_config.alpha_size) { + gl_flags |= BGL_ALPHA; + } + if (_this->gl_config.depth_size) { + gl_flags |= BGL_DEPTH; + } + if (_this->gl_config.stencil_size) { + gl_flags |= BGL_STENCIL; + } + if (_this->gl_config.double_buffer) { + gl_flags |= BGL_DOUBLE; + } else { + gl_flags |= BGL_SINGLE; + } + if (_this->gl_config.accum_red_size || + _this->gl_config.accum_green_size || + _this->gl_config.accum_blue_size || + _this->gl_config.accum_alpha_size) { + gl_flags |= BGL_ACCUM; + } + bwin->CreateGLView(gl_flags); + return (SDL_GLContext)(bwin); } void BE_GL_DeleteContext(_THIS, SDL_GLContext context) { - /* Currently, automatically unlocks the view */ - ((SDL_BWin*)context)->RemoveGLView(); + /* Currently, automatically unlocks the view */ + ((SDL_BWin*)context)->RemoveGLView(); } int BE_GL_SetSwapInterval(_THIS, int interval) { - /* TODO: Implement this, if necessary? */ - return 0; + /* TODO: Implement this, if necessary? */ + return SDL_Unsupported(); } int BE_GL_GetSwapInterval(_THIS) { - /* TODO: Implement this, if necessary? */ - return 0; + /* TODO: Implement this, if necessary? */ + return 0; } void BE_GL_UnloadLibrary(_THIS) { - /* TODO: Implement this, if necessary? */ + /* TODO: Implement this, if necessary? */ } @@ -132,88 +153,24 @@ void BE_GL_UnloadLibrary(_THIS) { mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not currently in use. */ void BE_GL_RebootContexts(_THIS) { - SDL_Window *window = _this->windows; - while(window) { - SDL_BWin *bwin = _ToBeWin(window); - if(bwin->GetGLView()) { - bwin->LockLooper(); - bwin->RemoveGLView(); - bwin->CreateGLView(BGL_FLAGS); - bwin->UnlockLooper(); - } - window = window->next; - } -} - - -#if 0 /* Functions from 1.2 that do not appear to be used in 1.3 */ - - int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value) - { - /* - FIXME? Right now BE_GL_GetAttribute shouldn't be called between glBegin() and glEnd() - it doesn't use "cached" values - */ - switch (attrib) { - case SDL_GL_RED_SIZE: - glGetIntegerv(GL_RED_BITS, (GLint *) value); - break; - case SDL_GL_GREEN_SIZE: - glGetIntegerv(GL_GREEN_BITS, (GLint *) value); - break; - case SDL_GL_BLUE_SIZE: - glGetIntegerv(GL_BLUE_BITS, (GLint *) value); - break; - case SDL_GL_ALPHA_SIZE: - glGetIntegerv(GL_ALPHA_BITS, (GLint *) value); - break; - case SDL_GL_DOUBLEBUFFER: - glGetBooleanv(GL_DOUBLEBUFFER, (GLboolean *) value); - break; - case SDL_GL_BUFFER_SIZE: - int v; - glGetIntegerv(GL_RED_BITS, (GLint *) & v); - *value = v; - glGetIntegerv(GL_GREEN_BITS, (GLint *) & v); - *value += v; - glGetIntegerv(GL_BLUE_BITS, (GLint *) & v); - *value += v; - glGetIntegerv(GL_ALPHA_BITS, (GLint *) & v); - *value += v; - break; - case SDL_GL_DEPTH_SIZE: - glGetIntegerv(GL_DEPTH_BITS, (GLint *) value); /* Mesa creates 16 only? r5 always 32 */ - break; - case SDL_GL_STENCIL_SIZE: - glGetIntegerv(GL_STENCIL_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_RED_SIZE: - glGetIntegerv(GL_ACCUM_RED_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_GREEN_SIZE: - glGetIntegerv(GL_ACCUM_GREEN_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_BLUE_SIZE: - glGetIntegerv(GL_ACCUM_BLUE_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_ALPHA_SIZE: - glGetIntegerv(GL_ACCUM_ALPHA_BITS, (GLint *) value); - break; - case SDL_GL_STEREO: - case SDL_GL_MULTISAMPLEBUFFERS: - case SDL_GL_MULTISAMPLESAMPLES: - default: - *value = 0; - return (-1); + SDL_Window *window = _this->windows; + while(window) { + SDL_BWin *bwin = _ToBeWin(window); + if(bwin->GetGLView()) { + bwin->LockLooper(); + bwin->RemoveGLView(); + bwin->CreateGLView(bwin->GetGLType()); + bwin->UnlockLooper(); } - return 0; + window = window->next; } - -#endif - +} #ifdef __cplusplus } #endif -#endif /* SDL_VIDEO_DRIVER_HAIKU */ +#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h index e7d475dfb..bc0798c93 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,8 @@ #ifndef SDL_BOPENGL_H #define SDL_BOPENGL_H +#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL + #ifdef __cplusplus extern "C" { #endif @@ -36,7 +38,7 @@ extern int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int BE_GL_SetSwapInterval(_THIS, int interval); /* TODO */ extern int BE_GL_GetSwapInterval(_THIS); /* TODO */ -extern void BE_GL_SwapWindow(_THIS, SDL_Window * window); +extern int BE_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window); extern void BE_GL_DeleteContext(_THIS, SDL_GLContext context); @@ -46,4 +48,8 @@ extern void BE_GL_RebootContexts(_THIS); } #endif +#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */ + #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc index 8986c609c..afe20e3b8 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,8 +68,8 @@ BE_CreateDevice(int devindex) device->SetDisplayMode = BE_SetDisplayMode; device->PumpEvents = BE_PumpEvents; - device->CreateWindow = BE_CreateWindow; - device->CreateWindowFrom = BE_CreateWindowFrom; + device->CreateSDLWindow = BE_CreateWindow; + device->CreateSDLWindowFrom = BE_CreateWindowFrom; device->SetWindowTitle = BE_SetWindowTitle; device->SetWindowIcon = BE_SetWindowIcon; device->SetWindowPosition = BE_SetWindowPosition; @@ -96,7 +96,7 @@ BE_CreateDevice(int devindex) device->shape_driver.SetWindowShape = NULL; device->shape_driver.ResizeWindowShape = NULL; - +#if SDL_VIDEO_OPENGL device->GL_LoadLibrary = BE_GL_LoadLibrary; device->GL_GetProcAddress = BE_GL_GetProcAddress; device->GL_UnloadLibrary = BE_GL_UnloadLibrary; @@ -106,6 +106,7 @@ BE_CreateDevice(int devindex) device->GL_GetSwapInterval = BE_GL_GetSwapInterval; device->GL_SwapWindow = BE_GL_SwapWindow; device->GL_DeleteContext = BE_GL_DeleteContext; +#endif device->StartTextInput = BE_StartTextInput; device->StopTextInput = BE_StopTextInput; @@ -173,3 +174,5 @@ void BE_VideoQuit(_THIS) #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h index ef5c74032..0e28220d9 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,3 +40,5 @@ extern int BE_Available(void); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc index a35471df5..0931abe9a 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,7 +41,7 @@ static SDL_INLINE SDL_BApp *_GetBeApp() { static int _InitWindow(_THIS, SDL_Window *window) { uint32 flags = 0; - window_look look = B_BORDERED_WINDOW_LOOK; + window_look look = B_TITLED_WINDOW_LOOK; BRect bounds( window->x, @@ -66,7 +66,7 @@ static int _InitWindow(_THIS, SDL_Window *window) { SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags); if(bwin == NULL) - return ENOMEM; + return -1; window->driverdata = bwin; int32 winID = _GetBeApp()->GetID(window); @@ -76,8 +76,9 @@ static int _InitWindow(_THIS, SDL_Window *window) { } int BE_CreateWindow(_THIS, SDL_Window *window) { - if(_InitWindow(_this, window) == ENOMEM) - return ENOMEM; + if (_InitWindow(_this, window) < 0) { + return -1; + } /* Start window loop */ _ToBeWin(window)->Show(); @@ -102,8 +103,9 @@ int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { } /* If we are out of memory, return the error code */ - if(_InitWindow(_this, window) == ENOMEM) - return ENOMEM; + if (_InitWindow(_this, window) < 0) { + return -1; + } /* TODO: Add any other SDL-supported window attributes here */ _ToBeWin(window)->SetTitle(otherBWin->Title()); @@ -227,3 +229,5 @@ SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window, #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h index 388443dac..100ffed1a 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,3 +52,4 @@ extern SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window, #endif +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/khronos/EGL/egl.h b/Engine/lib/sdl/src/video/khronos/EGL/egl.h new file mode 100644 index 000000000..93a21873c --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/EGL/egl.h @@ -0,0 +1,303 @@ +#ifndef __egl_h_ +#define __egl_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 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 +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.khronos.org/registry/egl +** +** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $ +*/ + +#include + +/* Generated on date 20170627 */ + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_VERSION_1_0 +#define EGL_VERSION_1_0 1 +typedef unsigned int EGLBoolean; +typedef void *EGLDisplay; +#include +#include +typedef void *EGLConfig; +typedef void *EGLSurface; +typedef void *EGLContext; +typedef void (*__eglMustCastToProperFunctionPointerType)(void); +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_BLUE_SIZE 0x3022 +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_CORE_NATIVE_ENGINE 0x305B +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_DONT_CARE EGL_CAST(EGLint,-1) +#define EGL_DRAW 0x3059 +#define EGL_EXTENSIONS 0x3055 +#define EGL_FALSE 0 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_HEIGHT 0x3056 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_NONE 0x3038 +#define EGL_NON_CONFORMANT_CONFIG 0x3051 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0) +#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0) +#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0) +#define EGL_PBUFFER_BIT 0x0001 +#define EGL_PIXMAP_BIT 0x0002 +#define EGL_READ 0x305A +#define EGL_RED_SIZE 0x3024 +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SLOW_CONFIG 0x3050 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_SUCCESS 0x3000 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_TRANSPARENT_RGB 0x3052 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRUE 1 +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_WIDTH 0x3057 +#define EGL_WINDOW_BIT 0x0004 +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); +EGLAPI EGLint EGLAPIENTRY eglGetError (void); +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); +#endif /* EGL_VERSION_1_0 */ + +#ifndef EGL_VERSION_1_1 +#define EGL_VERSION_1_1 1 +#define EGL_BACK_BUFFER 0x3084 +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_CONTEXT_LOST 0x300E +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_2D 0x305F +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_TARGET 0x3081 +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); +#endif /* EGL_VERSION_1_1 */ + +#ifndef EGL_VERSION_1_2 +#define EGL_VERSION_1_2 1 +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; +#define EGL_ALPHA_FORMAT 0x3088 +#define EGL_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_ALPHA_FORMAT_PRE 0x308C +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_BUFFER_PRESERVED 0x3094 +#define EGL_BUFFER_DESTROYED 0x3095 +#define EGL_CLIENT_APIS 0x308D +#define EGL_COLORSPACE 0x3087 +#define EGL_COLORSPACE_sRGB 0x3089 +#define EGL_COLORSPACE_LINEAR 0x308A +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 +#define EGL_DISPLAY_SCALING 10000 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_LUMINANCE_BUFFER 0x308F +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_OPENGL_ES_BIT 0x0001 +#define EGL_OPENVG_BIT 0x0002 +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENVG_IMAGE 0x3096 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_RGB_BUFFER 0x308E +#define EGL_SINGLE_BUFFER 0x3085 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_UNKNOWN EGL_CAST(EGLint,-1) +#define EGL_VERTICAL_RESOLUTION 0x3091 +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); +#endif /* EGL_VERSION_1_2 */ + +#ifndef EGL_VERSION_1_3 +#define EGL_VERSION_1_3 1 +#define EGL_CONFORMANT 0x3042 +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 +#define EGL_OPENGL_ES2_BIT 0x0004 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_COLORSPACE_sRGB 0x3089 +#define EGL_VG_COLORSPACE_LINEAR 0x308A +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 +#endif /* EGL_VERSION_1_3 */ + +#ifndef EGL_VERSION_1_4 +#define EGL_VERSION_1_4 1 +#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0) +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B +#define EGL_OPENGL_API 0x30A2 +#define EGL_OPENGL_BIT 0x0008 +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); +#endif /* EGL_VERSION_1_4 */ + +#ifndef EGL_VERSION_1_5 +#define EGL_VERSION_1_5 1 +typedef void *EGLSync; +typedef intptr_t EGLAttrib; +typedef khronos_utime_nanoseconds_t EGLTime; +typedef void *EGLImage; +#define EGL_CONTEXT_MAJOR_VERSION 0x3098 +#define EGL_CONTEXT_MINOR_VERSION 0x30FB +#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD +#define EGL_NO_RESET_NOTIFICATION 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 +#define EGL_OPENGL_ES3_BIT 0x00000040 +#define EGL_CL_EVENT_HANDLE 0x309C +#define EGL_SYNC_CL_EVENT 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 +#define EGL_SYNC_TYPE 0x30F7 +#define EGL_SYNC_STATUS 0x30F1 +#define EGL_SYNC_CONDITION 0x30F8 +#define EGL_SIGNALED 0x30F2 +#define EGL_UNSIGNALED 0x30F3 +#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 +#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull +#define EGL_TIMEOUT_EXPIRED 0x30F5 +#define EGL_CONDITION_SATISFIED 0x30F6 +#define EGL_NO_SYNC EGL_CAST(EGLSync,0) +#define EGL_SYNC_FENCE 0x30F9 +#define EGL_GL_COLORSPACE 0x309D +#define EGL_GL_COLORSPACE_SRGB 0x3089 +#define EGL_GL_COLORSPACE_LINEAR 0x308A +#define EGL_GL_RENDERBUFFER 0x30B9 +#define EGL_GL_TEXTURE_2D 0x30B1 +#define EGL_GL_TEXTURE_LEVEL 0x30BC +#define EGL_GL_TEXTURE_3D 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET 0x30BD +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 +#define EGL_IMAGE_PRESERVED 0x30D2 +#define EGL_NO_IMAGE EGL_CAST(EGLImage,0) +EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); +#endif /* EGL_VERSION_1_5 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/EGL/eglext.h b/Engine/lib/sdl/src/video/khronos/EGL/eglext.h new file mode 100644 index 000000000..d2def032d --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/EGL/eglext.h @@ -0,0 +1,1241 @@ +#ifndef __eglext_h_ +#define __eglext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 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 +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.khronos.org/registry/egl +** +** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $ +*/ + +#include + +#define EGL_EGLEXT_VERSION 20170627 + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: _nomatch_^ + * Default extensions included: egl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_KHR_cl_event +#define EGL_KHR_cl_event 1 +#define EGL_CL_EVENT_HANDLE_KHR 0x309C +#define EGL_SYNC_CL_EVENT_KHR 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF +#endif /* EGL_KHR_cl_event */ + +#ifndef EGL_KHR_cl_event2 +#define EGL_KHR_cl_event2 1 +typedef void *EGLSyncKHR; +typedef intptr_t EGLAttribKHR; +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#endif +#endif /* EGL_KHR_cl_event2 */ + +#ifndef EGL_KHR_client_get_all_proc_addresses +#define EGL_KHR_client_get_all_proc_addresses 1 +#endif /* EGL_KHR_client_get_all_proc_addresses */ + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 +#endif /* EGL_KHR_config_attribs */ + +#ifndef EGL_KHR_context_flush_control +#define EGL_KHR_context_flush_control 1 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 +#endif /* EGL_KHR_context_flush_control */ + +#ifndef EGL_KHR_create_context +#define EGL_KHR_create_context 1 +#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD +#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 +#endif /* EGL_KHR_create_context */ + +#ifndef EGL_KHR_create_context_no_error +#define EGL_KHR_create_context_no_error 1 +#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 +#endif /* EGL_KHR_create_context_no_error */ + +#ifndef EGL_KHR_debug +#define EGL_KHR_debug 1 +typedef void *EGLLabelKHR; +typedef void *EGLObjectKHR; +typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); +#define EGL_OBJECT_THREAD_KHR 0x33B0 +#define EGL_OBJECT_DISPLAY_KHR 0x33B1 +#define EGL_OBJECT_CONTEXT_KHR 0x33B2 +#define EGL_OBJECT_SURFACE_KHR 0x33B3 +#define EGL_OBJECT_IMAGE_KHR 0x33B4 +#define EGL_OBJECT_SYNC_KHR 0x33B5 +#define EGL_OBJECT_STREAM_KHR 0x33B6 +#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9 +#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA +#define EGL_DEBUG_MSG_WARN_KHR 0x33BB +#define EGL_DEBUG_MSG_INFO_KHR 0x33BC +#define EGL_DEBUG_CALLBACK_KHR 0x33B8 +typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value); +typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value); +EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#endif +#endif /* EGL_KHR_debug */ + +#ifndef EGL_KHR_display_reference +#define EGL_KHR_display_reference 1 +#define EGL_TRACK_REFERENCES_KHR 0x3352 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value); +#endif +#endif /* EGL_KHR_display_reference */ + +#ifndef EGL_KHR_fence_sync +#define EGL_KHR_fence_sync 1 +typedef khronos_utime_nanoseconds_t EGLTimeKHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 +#define EGL_SYNC_CONDITION_KHR 0x30F8 +#define EGL_SYNC_FENCE_KHR 0x30F9 +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_fence_sync */ + +#ifndef EGL_KHR_get_all_proc_addresses +#define EGL_KHR_get_all_proc_addresses 1 +#endif /* EGL_KHR_get_all_proc_addresses */ + +#ifndef EGL_KHR_gl_colorspace +#define EGL_KHR_gl_colorspace 1 +#define EGL_GL_COLORSPACE_KHR 0x309D +#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 +#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A +#endif /* EGL_KHR_gl_colorspace */ + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 +#endif /* EGL_KHR_gl_renderbuffer_image */ + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC +#endif /* EGL_KHR_gl_texture_2D_image */ + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD +#endif /* EGL_KHR_gl_texture_3D_image */ + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 +#endif /* EGL_KHR_gl_texture_cubemap_image */ + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +typedef void *EGLImageKHR; +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 +#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0) +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif +#endif /* EGL_KHR_image */ + +#ifndef EGL_KHR_image_base +#define EGL_KHR_image_base 1 +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 +#endif /* EGL_KHR_image_base */ + +#ifndef EGL_KHR_image_pixmap +#define EGL_KHR_image_pixmap 1 +#endif /* EGL_KHR_image_pixmap */ + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 +#define EGL_MATCH_FORMAT_KHR 0x3043 +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 +#define EGL_FORMAT_RGB_565_KHR 0x30C1 +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 +#define EGL_BITMAP_POINTER_KHR 0x30C6 +#define EGL_BITMAP_PITCH_KHR 0x30C7 +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD +#define EGL_LOWER_LEFT_KHR 0x30CE +#define EGL_UPPER_LEFT_KHR 0x30CF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); +#endif +#endif /* EGL_KHR_lock_surface */ + +#ifndef EGL_KHR_lock_surface2 +#define EGL_KHR_lock_surface2 1 +#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 +#endif /* EGL_KHR_lock_surface2 */ + +#ifndef EGL_KHR_lock_surface3 +#define EGL_KHR_lock_surface3 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#endif +#endif /* EGL_KHR_lock_surface3 */ + +#ifndef EGL_KHR_mutable_render_buffer +#define EGL_KHR_mutable_render_buffer 1 +#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000 +#endif /* EGL_KHR_mutable_render_buffer */ + +#ifndef EGL_KHR_no_config_context +#define EGL_KHR_no_config_context 1 +#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0) +#endif /* EGL_KHR_no_config_context */ + +#ifndef EGL_KHR_partial_update +#define EGL_KHR_partial_update 1 +#define EGL_BUFFER_AGE_KHR 0x313D +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_partial_update */ + +#ifndef EGL_KHR_platform_android +#define EGL_KHR_platform_android 1 +#define EGL_PLATFORM_ANDROID_KHR 0x3141 +#endif /* EGL_KHR_platform_android */ + +#ifndef EGL_KHR_platform_gbm +#define EGL_KHR_platform_gbm 1 +#define EGL_PLATFORM_GBM_KHR 0x31D7 +#endif /* EGL_KHR_platform_gbm */ + +#ifndef EGL_KHR_platform_wayland +#define EGL_KHR_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 +#endif /* EGL_KHR_platform_wayland */ + +#ifndef EGL_KHR_platform_x11 +#define EGL_KHR_platform_x11 1 +#define EGL_PLATFORM_X11_KHR 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 +#endif /* EGL_KHR_platform_x11 */ + +#ifndef EGL_KHR_reusable_sync +#define EGL_KHR_reusable_sync 1 +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_REUSABLE_KHR 0x30FA +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0) +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_reusable_sync */ + +#ifndef EGL_KHR_stream +#define EGL_KHR_stream 1 +typedef void *EGLStreamKHR; +typedef khronos_uint64_t EGLuint64KHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0) +#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 +#define EGL_PRODUCER_FRAME_KHR 0x3212 +#define EGL_CONSUMER_FRAME_KHR 0x3213 +#define EGL_STREAM_STATE_KHR 0x3214 +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 +#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 +#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A +#define EGL_BAD_STREAM_KHR 0x321B +#define EGL_BAD_STATE_KHR 0x321C +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_stream */ + +#ifndef EGL_KHR_stream_attrib +#define EGL_KHR_stream_attrib 1 +#ifdef KHRONOS_SUPPORT_INT64 +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_stream_attrib */ + +#ifndef EGL_KHR_stream_consumer_gltexture +#define EGL_KHR_stream_consumer_gltexture 1 +#ifdef EGL_KHR_stream +#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_consumer_gltexture */ + +#ifndef EGL_KHR_stream_cross_process_fd +#define EGL_KHR_stream_cross_process_fd 1 +typedef int EGLNativeFileDescriptorKHR; +#ifdef EGL_KHR_stream +#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1) +typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_cross_process_fd */ + +#ifndef EGL_KHR_stream_fifo +#define EGL_KHR_stream_fifo 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#define EGL_STREAM_TIME_NOW_KHR 0x31FD +#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE +#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_fifo */ + +#ifndef EGL_KHR_stream_producer_aldatalocator +#define EGL_KHR_stream_producer_aldatalocator 1 +#ifdef EGL_KHR_stream +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_aldatalocator */ + +#ifndef EGL_KHR_stream_producer_eglsurface +#define EGL_KHR_stream_producer_eglsurface 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_BIT_KHR 0x0800 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_eglsurface */ + +#ifndef EGL_KHR_surfaceless_context +#define EGL_KHR_surfaceless_context 1 +#endif /* EGL_KHR_surfaceless_context */ + +#ifndef EGL_KHR_swap_buffers_with_damage +#define EGL_KHR_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_swap_buffers_with_damage */ + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA +#endif /* EGL_KHR_vg_parent_image */ + +#ifndef EGL_KHR_wait_sync +#define EGL_KHR_wait_sync 1 +typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#endif +#endif /* EGL_KHR_wait_sync */ + +#ifndef EGL_ANDROID_blob_cache +#define EGL_ANDROID_blob_cache 1 +typedef khronos_ssize_t EGLsizeiANDROID; +typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); +typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); +typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#endif +#endif /* EGL_ANDROID_blob_cache */ + +#ifndef EGL_ANDROID_create_native_client_buffer +#define EGL_ANDROID_create_native_client_buffer 1 +#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143 +#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001 +#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002 +#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004 +typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list); +#endif +#endif /* EGL_ANDROID_create_native_client_buffer */ + +#ifndef EGL_ANDROID_framebuffer_target +#define EGL_ANDROID_framebuffer_target 1 +#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 +#endif /* EGL_ANDROID_framebuffer_target */ + +#ifndef EGL_ANDROID_front_buffer_auto_refresh +#define EGL_ANDROID_front_buffer_auto_refresh 1 +#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C +#endif /* EGL_ANDROID_front_buffer_auto_refresh */ + +#ifndef EGL_ANDROID_image_native_buffer +#define EGL_ANDROID_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_ANDROID 0x3140 +#endif /* EGL_ANDROID_image_native_buffer */ + +#ifndef EGL_ANDROID_native_fence_sync +#define EGL_ANDROID_native_fence_sync 1 +#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 +#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 +#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 +#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 +typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); +#endif +#endif /* EGL_ANDROID_native_fence_sync */ + +#ifndef EGL_ANDROID_presentation_time +#define EGL_ANDROID_presentation_time 1 +typedef khronos_stime_nanoseconds_t EGLnsecsANDROID; +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); +#endif +#endif /* EGL_ANDROID_presentation_time */ + +#ifndef EGL_ANDROID_recordable +#define EGL_ANDROID_recordable 1 +#define EGL_RECORDABLE_ANDROID 0x3142 +#endif /* EGL_ANDROID_recordable */ + +#ifndef EGL_ANGLE_d3d_share_handle_client_buffer +#define EGL_ANGLE_d3d_share_handle_client_buffer 1 +#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 +#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ + +#ifndef EGL_ANGLE_device_d3d +#define EGL_ANGLE_device_d3d 1 +#define EGL_D3D9_DEVICE_ANGLE 0x33A0 +#define EGL_D3D11_DEVICE_ANGLE 0x33A1 +#endif /* EGL_ANGLE_device_d3d */ + +#ifndef EGL_ANGLE_query_surface_pointer +#define EGL_ANGLE_query_surface_pointer 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#endif +#endif /* EGL_ANGLE_query_surface_pointer */ + +#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle +#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 +#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ + +#ifndef EGL_ANGLE_window_fixed_size +#define EGL_ANGLE_window_fixed_size 1 +#define EGL_FIXED_SIZE_ANGLE 0x3201 +#endif /* EGL_ANGLE_window_fixed_size */ + +#ifndef EGL_ARM_implicit_external_sync +#define EGL_ARM_implicit_external_sync 1 +#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A +#endif /* EGL_ARM_implicit_external_sync */ + +#ifndef EGL_ARM_pixmap_multisample_discard +#define EGL_ARM_pixmap_multisample_discard 1 +#define EGL_DISCARD_SAMPLES_ARM 0x3286 +#endif /* EGL_ARM_pixmap_multisample_discard */ + +#ifndef EGL_EXT_bind_to_front +#define EGL_EXT_bind_to_front 1 +#define EGL_FRONT_BUFFER_EXT 0x3464 +#endif /* EGL_EXT_bind_to_front */ + +#ifndef EGL_EXT_buffer_age +#define EGL_EXT_buffer_age 1 +#define EGL_BUFFER_AGE_EXT 0x313D +#endif /* EGL_EXT_buffer_age */ + +#ifndef EGL_EXT_client_extensions +#define EGL_EXT_client_extensions 1 +#endif /* EGL_EXT_client_extensions */ + +#ifndef EGL_EXT_compositor +#define EGL_EXT_compositor 1 +#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460 +#define EGL_EXTERNAL_REF_ID_EXT 0x3461 +#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462 +#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy); +#endif +#endif /* EGL_EXT_compositor */ + +#ifndef EGL_EXT_create_context_robustness +#define EGL_EXT_create_context_robustness 1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 +#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF +#endif /* EGL_EXT_create_context_robustness */ + +#ifndef EGL_EXT_device_base +#define EGL_EXT_device_base 1 +typedef void *EGLDeviceEXT; +#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0) +#define EGL_BAD_DEVICE_EXT 0x322B +#define EGL_DEVICE_EXT 0x322C +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#endif +#endif /* EGL_EXT_device_base */ + +#ifndef EGL_EXT_device_drm +#define EGL_EXT_device_drm 1 +#define EGL_DRM_DEVICE_FILE_EXT 0x3233 +#endif /* EGL_EXT_device_drm */ + +#ifndef EGL_EXT_device_enumeration +#define EGL_EXT_device_enumeration 1 +#endif /* EGL_EXT_device_enumeration */ + +#ifndef EGL_EXT_device_openwf +#define EGL_EXT_device_openwf 1 +#define EGL_OPENWF_DEVICE_ID_EXT 0x3237 +#endif /* EGL_EXT_device_openwf */ + +#ifndef EGL_EXT_device_query +#define EGL_EXT_device_query 1 +#endif /* EGL_EXT_device_query */ + +#ifndef EGL_EXT_gl_colorspace_bt2020_linear +#define EGL_EXT_gl_colorspace_bt2020_linear 1 +#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F +#endif /* EGL_EXT_gl_colorspace_bt2020_linear */ + +#ifndef EGL_EXT_gl_colorspace_bt2020_pq +#define EGL_EXT_gl_colorspace_bt2020_pq 1 +#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340 +#endif /* EGL_EXT_gl_colorspace_bt2020_pq */ + +#ifndef EGL_EXT_gl_colorspace_display_p3 +#define EGL_EXT_gl_colorspace_display_p3 1 +#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363 +#endif /* EGL_EXT_gl_colorspace_display_p3 */ + +#ifndef EGL_EXT_gl_colorspace_display_p3_linear +#define EGL_EXT_gl_colorspace_display_p3_linear 1 +#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362 +#endif /* EGL_EXT_gl_colorspace_display_p3_linear */ + +#ifndef EGL_EXT_gl_colorspace_scrgb +#define EGL_EXT_gl_colorspace_scrgb 1 +#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351 +#endif /* EGL_EXT_gl_colorspace_scrgb */ + +#ifndef EGL_EXT_gl_colorspace_scrgb_linear +#define EGL_EXT_gl_colorspace_scrgb_linear 1 +#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350 +#endif /* EGL_EXT_gl_colorspace_scrgb_linear */ + +#ifndef EGL_EXT_image_dma_buf_import +#define EGL_EXT_image_dma_buf_import 1 +#define EGL_LINUX_DMA_BUF_EXT 0x3270 +#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 +#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 +#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 +#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 +#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 +#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 +#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 +#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 +#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 +#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A +#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B +#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C +#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D +#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E +#define EGL_ITU_REC601_EXT 0x327F +#define EGL_ITU_REC709_EXT 0x3280 +#define EGL_ITU_REC2020_EXT 0x3281 +#define EGL_YUV_FULL_RANGE_EXT 0x3282 +#define EGL_YUV_NARROW_RANGE_EXT 0x3283 +#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 +#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 +#endif /* EGL_EXT_image_dma_buf_import */ + +#ifndef EGL_EXT_image_dma_buf_import_modifiers +#define EGL_EXT_image_dma_buf_import_modifiers 1 +#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440 +#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441 +#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442 +#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443 +#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444 +#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445 +#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446 +#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447 +#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448 +#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 +#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); +#endif +#endif /* EGL_EXT_image_dma_buf_import_modifiers */ + +#ifndef EGL_EXT_image_implicit_sync_control +#define EGL_EXT_image_implicit_sync_control 1 +#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470 +#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471 +#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472 +#endif /* EGL_EXT_image_implicit_sync_control */ + +#ifndef EGL_EXT_multiview_window +#define EGL_EXT_multiview_window 1 +#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 +#endif /* EGL_EXT_multiview_window */ + +#ifndef EGL_EXT_output_base +#define EGL_EXT_output_base 1 +typedef void *EGLOutputLayerEXT; +typedef void *EGLOutputPortEXT; +#define EGL_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0) +#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0) +#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D +#define EGL_BAD_OUTPUT_PORT_EXT 0x322E +#define EGL_SWAP_INTERVAL_EXT 0x322F +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#endif +#endif /* EGL_EXT_output_base */ + +#ifndef EGL_EXT_output_drm +#define EGL_EXT_output_drm 1 +#define EGL_DRM_CRTC_EXT 0x3234 +#define EGL_DRM_PLANE_EXT 0x3235 +#define EGL_DRM_CONNECTOR_EXT 0x3236 +#endif /* EGL_EXT_output_drm */ + +#ifndef EGL_EXT_output_openwf +#define EGL_EXT_output_openwf 1 +#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238 +#define EGL_OPENWF_PORT_ID_EXT 0x3239 +#endif /* EGL_EXT_output_openwf */ + +#ifndef EGL_EXT_pixel_format_float +#define EGL_EXT_pixel_format_float 1 +#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339 +#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A +#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B +#endif /* EGL_EXT_pixel_format_float */ + +#ifndef EGL_EXT_platform_base +#define EGL_EXT_platform_base 1 +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#endif +#endif /* EGL_EXT_platform_base */ + +#ifndef EGL_EXT_platform_device +#define EGL_EXT_platform_device 1 +#define EGL_PLATFORM_DEVICE_EXT 0x313F +#endif /* EGL_EXT_platform_device */ + +#ifndef EGL_EXT_platform_wayland +#define EGL_EXT_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_EXT 0x31D8 +#endif /* EGL_EXT_platform_wayland */ + +#ifndef EGL_EXT_platform_x11 +#define EGL_EXT_platform_x11 1 +#define EGL_PLATFORM_X11_EXT 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 +#endif /* EGL_EXT_platform_x11 */ + +#ifndef EGL_EXT_protected_content +#define EGL_EXT_protected_content 1 +#define EGL_PROTECTED_CONTENT_EXT 0x32C0 +#endif /* EGL_EXT_protected_content */ + +#ifndef EGL_EXT_protected_surface +#define EGL_EXT_protected_surface 1 +#endif /* EGL_EXT_protected_surface */ + +#ifndef EGL_EXT_stream_consumer_egloutput +#define EGL_EXT_stream_consumer_egloutput 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#endif +#endif /* EGL_EXT_stream_consumer_egloutput */ + +#ifndef EGL_EXT_surface_CTA861_3_metadata +#define EGL_EXT_surface_CTA861_3_metadata 1 +#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360 +#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361 +#endif /* EGL_EXT_surface_CTA861_3_metadata */ + +#ifndef EGL_EXT_surface_SMPTE2086_metadata +#define EGL_EXT_surface_SMPTE2086_metadata 1 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346 +#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347 +#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348 +#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349 +#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A +#define EGL_METADATA_SCALING_EXT 50000 +#endif /* EGL_EXT_surface_SMPTE2086_metadata */ + +#ifndef EGL_EXT_swap_buffers_with_damage +#define EGL_EXT_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_EXT_swap_buffers_with_damage */ + +#ifndef EGL_EXT_yuv_surface +#define EGL_EXT_yuv_surface 1 +#define EGL_YUV_ORDER_EXT 0x3301 +#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311 +#define EGL_YUV_SUBSAMPLE_EXT 0x3312 +#define EGL_YUV_DEPTH_RANGE_EXT 0x3317 +#define EGL_YUV_CSC_STANDARD_EXT 0x330A +#define EGL_YUV_PLANE_BPP_EXT 0x331A +#define EGL_YUV_BUFFER_EXT 0x3300 +#define EGL_YUV_ORDER_YUV_EXT 0x3302 +#define EGL_YUV_ORDER_YVU_EXT 0x3303 +#define EGL_YUV_ORDER_YUYV_EXT 0x3304 +#define EGL_YUV_ORDER_UYVY_EXT 0x3305 +#define EGL_YUV_ORDER_YVYU_EXT 0x3306 +#define EGL_YUV_ORDER_VYUY_EXT 0x3307 +#define EGL_YUV_ORDER_AYUV_EXT 0x3308 +#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313 +#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314 +#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315 +#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318 +#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319 +#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B +#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C +#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D +#define EGL_YUV_PLANE_BPP_0_EXT 0x331B +#define EGL_YUV_PLANE_BPP_8_EXT 0x331C +#define EGL_YUV_PLANE_BPP_10_EXT 0x331D +#endif /* EGL_EXT_yuv_surface */ + +#ifndef EGL_HI_clientpixmap +#define EGL_HI_clientpixmap 1 +struct EGLClientPixmapHI { + void *pData; + EGLint iWidth; + EGLint iHeight; + EGLint iStride; +}; +#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#endif +#endif /* EGL_HI_clientpixmap */ + +#ifndef EGL_HI_colorformats +#define EGL_HI_colorformats 1 +#define EGL_COLOR_FORMAT_HI 0x8F70 +#define EGL_COLOR_RGB_HI 0x8F71 +#define EGL_COLOR_RGBA_HI 0x8F72 +#define EGL_COLOR_ARGB_HI 0x8F73 +#endif /* EGL_HI_colorformats */ + +#ifndef EGL_IMG_context_priority +#define EGL_IMG_context_priority 1 +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 +#endif /* EGL_IMG_context_priority */ + +#ifndef EGL_IMG_image_plane_attribs +#define EGL_IMG_image_plane_attribs 1 +#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105 +#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106 +#endif /* EGL_IMG_image_plane_attribs */ + +#ifndef EGL_MESA_drm_image +#define EGL_MESA_drm_image 1 +#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 +#define EGL_DRM_BUFFER_USE_MESA 0x31D1 +#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 +#define EGL_DRM_BUFFER_MESA 0x31D3 +#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 +#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 +#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif +#endif /* EGL_MESA_drm_image */ + +#ifndef EGL_MESA_image_dma_buf_export +#define EGL_MESA_image_dma_buf_export 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#endif +#endif /* EGL_MESA_image_dma_buf_export */ + +#ifndef EGL_MESA_platform_gbm +#define EGL_MESA_platform_gbm 1 +#define EGL_PLATFORM_GBM_MESA 0x31D7 +#endif /* EGL_MESA_platform_gbm */ + +#ifndef EGL_MESA_platform_surfaceless +#define EGL_MESA_platform_surfaceless 1 +#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD +#endif /* EGL_MESA_platform_surfaceless */ + +#ifndef EGL_NOK_swap_region +#define EGL_NOK_swap_region 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region */ + +#ifndef EGL_NOK_swap_region2 +#define EGL_NOK_swap_region2 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region2 */ + +#ifndef EGL_NOK_texture_from_pixmap +#define EGL_NOK_texture_from_pixmap 1 +#define EGL_Y_INVERTED_NOK 0x307F +#endif /* EGL_NOK_texture_from_pixmap */ + +#ifndef EGL_NV_3dvision_surface +#define EGL_NV_3dvision_surface 1 +#define EGL_AUTO_STEREO_NV 0x3136 +#endif /* EGL_NV_3dvision_surface */ + +#ifndef EGL_NV_coverage_sample +#define EGL_NV_coverage_sample 1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#endif /* EGL_NV_coverage_sample */ + +#ifndef EGL_NV_coverage_sample_resolve +#define EGL_NV_coverage_sample_resolve 1 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 +#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 +#endif /* EGL_NV_coverage_sample_resolve */ + +#ifndef EGL_NV_cuda_event +#define EGL_NV_cuda_event 1 +#define EGL_CUDA_EVENT_HANDLE_NV 0x323B +#define EGL_SYNC_CUDA_EVENT_NV 0x323C +#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D +#endif /* EGL_NV_cuda_event */ + +#ifndef EGL_NV_depth_nonlinear +#define EGL_NV_depth_nonlinear 1 +#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NONE_NV 0 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#endif /* EGL_NV_depth_nonlinear */ + +#ifndef EGL_NV_device_cuda +#define EGL_NV_device_cuda 1 +#define EGL_CUDA_DEVICE_NV 0x323A +#endif /* EGL_NV_device_cuda */ + +#ifndef EGL_NV_native_query +#define EGL_NV_native_query 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#endif +#endif /* EGL_NV_native_query */ + +#ifndef EGL_NV_post_convert_rounding +#define EGL_NV_post_convert_rounding 1 +#endif /* EGL_NV_post_convert_rounding */ + +#ifndef EGL_NV_post_sub_buffer +#define EGL_NV_post_sub_buffer 1 +#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#endif +#endif /* EGL_NV_post_sub_buffer */ + +#ifndef EGL_NV_robustness_video_memory_purge +#define EGL_NV_robustness_video_memory_purge 1 +#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C +#endif /* EGL_NV_robustness_video_memory_purge */ + +#ifndef EGL_NV_stream_consumer_gltexture_yuv +#define EGL_NV_stream_consumer_gltexture_yuv 1 +#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C +#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D +#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list); +#endif +#endif /* EGL_NV_stream_consumer_gltexture_yuv */ + +#ifndef EGL_NV_stream_cross_display +#define EGL_NV_stream_cross_display 1 +#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E +#endif /* EGL_NV_stream_cross_display */ + +#ifndef EGL_NV_stream_cross_object +#define EGL_NV_stream_cross_object 1 +#define EGL_STREAM_CROSS_OBJECT_NV 0x334D +#endif /* EGL_NV_stream_cross_object */ + +#ifndef EGL_NV_stream_cross_partition +#define EGL_NV_stream_cross_partition 1 +#define EGL_STREAM_CROSS_PARTITION_NV 0x323F +#endif /* EGL_NV_stream_cross_partition */ + +#ifndef EGL_NV_stream_cross_process +#define EGL_NV_stream_cross_process 1 +#define EGL_STREAM_CROSS_PROCESS_NV 0x3245 +#endif /* EGL_NV_stream_cross_process */ + +#ifndef EGL_NV_stream_cross_system +#define EGL_NV_stream_cross_system 1 +#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F +#endif /* EGL_NV_stream_cross_system */ + +#ifndef EGL_NV_stream_fifo_next +#define EGL_NV_stream_fifo_next 1 +#define EGL_PENDING_FRAME_NV 0x3329 +#define EGL_STREAM_TIME_PENDING_NV 0x332A +#endif /* EGL_NV_stream_fifo_next */ + +#ifndef EGL_NV_stream_fifo_synchronous +#define EGL_NV_stream_fifo_synchronous 1 +#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336 +#endif /* EGL_NV_stream_fifo_synchronous */ + +#ifndef EGL_NV_stream_frame_limits +#define EGL_NV_stream_frame_limits 1 +#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337 +#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338 +#endif /* EGL_NV_stream_frame_limits */ + +#ifndef EGL_NV_stream_metadata +#define EGL_NV_stream_metadata 1 +#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250 +#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251 +#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252 +#define EGL_PRODUCER_METADATA_NV 0x3253 +#define EGL_CONSUMER_METADATA_NV 0x3254 +#define EGL_PENDING_METADATA_NV 0x3328 +#define EGL_METADATA0_SIZE_NV 0x3255 +#define EGL_METADATA1_SIZE_NV 0x3256 +#define EGL_METADATA2_SIZE_NV 0x3257 +#define EGL_METADATA3_SIZE_NV 0x3258 +#define EGL_METADATA0_TYPE_NV 0x3259 +#define EGL_METADATA1_TYPE_NV 0x325A +#define EGL_METADATA2_TYPE_NV 0x325B +#define EGL_METADATA3_TYPE_NV 0x325C +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); +#endif +#endif /* EGL_NV_stream_metadata */ + +#ifndef EGL_NV_stream_remote +#define EGL_NV_stream_remote 1 +#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240 +#define EGL_STREAM_TYPE_NV 0x3241 +#define EGL_STREAM_PROTOCOL_NV 0x3242 +#define EGL_STREAM_ENDPOINT_NV 0x3243 +#define EGL_STREAM_LOCAL_NV 0x3244 +#define EGL_STREAM_PRODUCER_NV 0x3247 +#define EGL_STREAM_CONSUMER_NV 0x3248 +#define EGL_STREAM_PROTOCOL_FD_NV 0x3246 +#endif /* EGL_NV_stream_remote */ + +#ifndef EGL_NV_stream_reset +#define EGL_NV_stream_reset 1 +#define EGL_SUPPORT_RESET_NV 0x3334 +#define EGL_SUPPORT_REUSE_NV 0x3335 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif /* EGL_NV_stream_reset */ + +#ifndef EGL_NV_stream_socket +#define EGL_NV_stream_socket 1 +#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B +#define EGL_SOCKET_HANDLE_NV 0x324C +#define EGL_SOCKET_TYPE_NV 0x324D +#endif /* EGL_NV_stream_socket */ + +#ifndef EGL_NV_stream_socket_inet +#define EGL_NV_stream_socket_inet 1 +#define EGL_SOCKET_TYPE_INET_NV 0x324F +#endif /* EGL_NV_stream_socket_inet */ + +#ifndef EGL_NV_stream_socket_unix +#define EGL_NV_stream_socket_unix 1 +#define EGL_SOCKET_TYPE_UNIX_NV 0x324E +#endif /* EGL_NV_stream_socket_unix */ + +#ifndef EGL_NV_stream_sync +#define EGL_NV_stream_sync 1 +#define EGL_SYNC_NEW_FRAME_NV 0x321F +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#endif +#endif /* EGL_NV_stream_sync */ + +#ifndef EGL_NV_sync +#define EGL_NV_sync 1 +typedef void *EGLSyncNV; +typedef khronos_utime_nanoseconds_t EGLTimeNV; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 +#define EGL_SYNC_STATUS_NV 0x30E7 +#define EGL_SIGNALED_NV 0x30E8 +#define EGL_UNSIGNALED_NV 0x30E9 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull +#define EGL_ALREADY_SIGNALED_NV 0x30EA +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB +#define EGL_CONDITION_SATISFIED_NV 0x30EC +#define EGL_SYNC_TYPE_NV 0x30ED +#define EGL_SYNC_CONDITION_NV 0x30EE +#define EGL_SYNC_FENCE_NV 0x30EF +#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0) +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); +EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_sync */ + +#ifndef EGL_NV_system_time +#define EGL_NV_system_time 1 +typedef khronos_utime_nanoseconds_t EGLuint64NV; +#ifdef KHRONOS_SUPPORT_INT64 +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_system_time */ + +#ifndef EGL_TIZEN_image_native_buffer +#define EGL_TIZEN_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_TIZEN 0x32A0 +#endif /* EGL_TIZEN_image_native_buffer */ + +#ifndef EGL_TIZEN_image_native_surface +#define EGL_TIZEN_image_native_surface 1 +#define EGL_NATIVE_SURFACE_TIZEN 0x32A1 +#endif /* EGL_TIZEN_image_native_surface */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h b/Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h new file mode 100644 index 000000000..c77c3338d --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h @@ -0,0 +1,132 @@ +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright (c) 2007-2016 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 +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Platform-specific types and definitions for egl.h + * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $ + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "EGL" component "Registry". + */ + +#include + +/* Macros used in EGL function prototype declarations. + * + * EGL functions should be prototyped as: + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h + */ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + * + * Khronos STRONGLY RECOMMENDS that you use the default definitions + * provided below, since these changes affect both binary and source + * portability of applications using EGL running on different EGL + * implementations. + */ + +#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include + +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; + +#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativeWindowType; +typedef void *EGLNativePixmapType; + +#elif defined(__ANDROID__) || defined(ANDROID) + +struct ANativeWindow; +struct egl_native_pixmap_t; + +typedef struct ANativeWindow* EGLNativeWindowType; +typedef struct egl_native_pixmap_t* EGLNativePixmapType; +typedef void* EGLNativeDisplayType; + +#elif defined(__unix__) + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain + * all legal attribute names and values passed into and out of EGL, whether + * their type is boolean, bitmask, enumerant (symbolic constant), integer, + * handle, or other. While in general a 32-bit integer will suffice, if + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit + * integer type. + */ +typedef khronos_int32_t EGLint; + + +/* C++ / C typecast macros for special EGL handle values */ +#if defined(__cplusplus) +#define EGL_CAST(type, value) (static_cast(value)) +#else +#define EGL_CAST(type, value) ((type) (value)) +#endif + +#endif /* __eglplatform_h */ diff --git a/Engine/lib/sdl/src/video/khronos/GLES2/gl2.h b/Engine/lib/sdl/src/video/khronos/GLES2/gl2.h new file mode 100644 index 000000000..8ba164229 --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/GLES2/gl2.h @@ -0,0 +1,675 @@ +#ifndef __gl2_h_ +#define __gl2_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 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 +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#include + +#ifndef GL_APIENTRYP +#define GL_APIENTRYP GL_APIENTRY* +#endif + +#ifndef GL_GLES_PROTOTYPES +#define GL_GLES_PROTOTYPES 1 +#endif + +/* Generated on date 20170817 */ + +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_ES_VERSION_2_0 +#define GL_ES_VERSION_2_0 1 +#include +typedef khronos_int8_t GLbyte; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; +typedef short GLshort; +typedef unsigned short GLushort; +typedef void GLvoid; +typedef struct __GLsync *GLsync; +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef unsigned int GLenum; +typedef unsigned int GLuint; +typedef char GLchar; +typedef khronos_float_t GLfloat; +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_intptr_t GLintptr; +typedef unsigned int GLbitfield; +typedef int GLint; +typedef unsigned char GLboolean; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE 0x1702 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 +#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_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#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_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_NONE 0 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); +typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); +typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); +typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); +typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); +typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); +typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void); +typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); +typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); +typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); +typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); +typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); +typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +#if GL_GLES_PROTOTYPES +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_ES_VERSION_2_0 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h b/Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h new file mode 100644 index 000000000..4e1488c62 --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h @@ -0,0 +1,3505 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 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 +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#ifndef GL_APIENTRYP +#define GL_APIENTRYP GL_APIENTRY* +#endif + +/* Generated on date 20170817 */ + +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: _nomatch_^ + * Default extensions included: gles2 + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC +#endif /* GL_KHR_context_flush_control */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_SAMPLER 0x82E6 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 +#define GL_DEBUG_SOURCE_API_KHR 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A +#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B +#define GL_DEBUG_TYPE_ERROR_KHR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 +#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 +#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D +#define GL_BUFFER_KHR 0x82E0 +#define GL_SHADER_KHR 0x82E1 +#define GL_PROGRAM_KHR 0x82E2 +#define GL_VERTEX_ARRAY_KHR 0x8074 +#define GL_QUERY_KHR 0x82E3 +#define GL_PROGRAM_PIPELINE_KHR 0x82E4 +#define GL_SAMPLER_KHR 0x82E6 +#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 +#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 +#define GL_DEBUG_OUTPUT_KHR 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 +#define GL_STACK_OVERFLOW_KHR 0x0503 +#define GL_STACK_UNDERFLOW_KHR 0x0504 +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam); +typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam); +GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void); +GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params); +#endif +#endif /* GL_KHR_debug */ + +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ + +#ifndef GL_KHR_parallel_shader_compile +#define GL_KHR_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 +typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count); +#endif +#endif /* GL_KHR_parallel_shader_compile */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3 +#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252 +#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256 +#define GL_NO_RESET_NOTIFICATION_KHR 0x8261 +#define GL_CONTEXT_LOST_KHR 0x0507 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void); +GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#endif +#endif /* GL_KHR_robustness */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_hdr */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif /* GL_KHR_texture_compression_astc_ldr */ + +#ifndef GL_KHR_texture_compression_astc_sliced_3d +#define GL_KHR_texture_compression_astc_sliced_3d 1 +#endif /* GL_KHR_texture_compression_astc_sliced_3d */ + +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +typedef void *GLeglImageOES; +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +#endif /* GL_OES_EGL_image */ + +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#endif /* GL_OES_EGL_image_external */ + +#ifndef GL_OES_EGL_image_external_essl3 +#define GL_OES_EGL_image_external_essl3 1 +#endif /* GL_OES_EGL_image_external_essl3 */ + +#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture +#define GL_OES_compressed_ETC1_RGB8_sub_texture 1 +#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */ + +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#define GL_ETC1_RGB8_OES 0x8D64 +#endif /* GL_OES_compressed_ETC1_RGB8_texture */ + +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif /* GL_OES_compressed_paletted_texture */ + +#ifndef GL_OES_copy_image +#define GL_OES_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAOESPROC) (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 srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataOES (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 srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif +#endif /* GL_OES_copy_image */ + +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif /* GL_OES_depth24 */ + +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif /* GL_OES_depth32 */ + +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif /* GL_OES_depth_texture */ + +#ifndef GL_OES_draw_buffers_indexed +#define GL_OES_draw_buffers_indexed 1 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +typedef void (GL_APIENTRYP PFNGLENABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiOES (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiOES (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciOES (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiOES (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiOES (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index); +#endif +#endif /* GL_OES_draw_buffers_indexed */ + +#ifndef GL_OES_draw_elements_base_vertex +#define GL_OES_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +#endif +#endif /* GL_OES_draw_elements_base_vertex */ + +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif /* GL_OES_element_index_uint */ + +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif /* GL_OES_fbo_render_mipmap */ + +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif /* GL_OES_fragment_precision_high */ + +#ifndef GL_OES_geometry_point_size +#define GL_OES_geometry_point_size 1 +#endif /* GL_OES_geometry_point_size */ + +#ifndef GL_OES_geometry_shader +#define GL_OES_geometry_shader 1 +#define GL_GEOMETRY_SHADER_OES 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F +#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E +#define GL_LINES_ADJACENCY_OES 0x000A +#define GL_LINE_STRIP_ADJACENCY_OES 0x000B +#define GL_TRIANGLES_ADJACENCY_OES 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E +#define GL_UNDEFINED_VERTEX_OES 0x8260 +#define GL_PRIMITIVES_GENERATED_OES 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureOES (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_OES_geometry_shader */ + +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#endif +#endif /* GL_OES_get_program_binary */ + +#ifndef GL_OES_gpu_shader5 +#define GL_OES_gpu_shader5 1 +#endif /* GL_OES_gpu_shader5 */ + +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_OES_mapbuffer */ + +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif /* GL_OES_packed_depth_stencil */ + +#ifndef GL_OES_primitive_bounding_box +#define GL_OES_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxOES (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_OES_primitive_bounding_box */ + +#ifndef GL_OES_required_internalformat +#define GL_OES_required_internalformat 1 +#define GL_ALPHA8_OES 0x803C +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_LUMINANCE4_ALPHA4_OES 0x8043 +#define GL_LUMINANCE8_ALPHA8_OES 0x8045 +#define GL_LUMINANCE8_OES 0x8040 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB10_A2_EXT 0x8059 +#endif /* GL_OES_required_internalformat */ + +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif /* GL_OES_rgb8_rgba8 */ + +#ifndef GL_OES_sample_shading +#define GL_OES_sample_shading 1 +#define GL_SAMPLE_SHADING_OES 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 +typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value); +#endif +#endif /* GL_OES_sample_shading */ + +#ifndef GL_OES_sample_variables +#define GL_OES_sample_variables 1 +#endif /* GL_OES_sample_variables */ + +#ifndef GL_OES_shader_image_atomic +#define GL_OES_shader_image_atomic 1 +#endif /* GL_OES_shader_image_atomic */ + +#ifndef GL_OES_shader_io_blocks +#define GL_OES_shader_io_blocks 1 +#endif /* GL_OES_shader_io_blocks */ + +#ifndef GL_OES_shader_multisample_interpolation +#define GL_OES_shader_multisample_interpolation 1 +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D +#endif /* GL_OES_shader_multisample_interpolation */ + +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif /* GL_OES_standard_derivatives */ + +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif /* GL_OES_stencil1 */ + +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif /* GL_OES_stencil4 */ + +#ifndef GL_OES_surfaceless_context +#define GL_OES_surfaceless_context 1 +#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 +#endif /* GL_OES_surfaceless_context */ + +#ifndef GL_OES_tessellation_point_size +#define GL_OES_tessellation_point_size 1 +#endif /* GL_OES_tessellation_point_size */ + +#ifndef GL_OES_tessellation_shader +#define GL_OES_tessellation_shader 1 +#define GL_PATCHES_OES 0x000E +#define GL_PATCH_VERTICES_OES 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75 +#define GL_TESS_GEN_MODE_OES 0x8E76 +#define GL_TESS_GEN_SPACING_OES 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78 +#define GL_TESS_GEN_POINT_MODE_OES 0x8E79 +#define GL_ISOLINES_OES 0x8E7A +#define GL_QUADS_OES 0x0007 +#define GL_FRACTIONAL_ODD_OES 0x8E7B +#define GL_FRACTIONAL_EVEN_OES 0x8E7C +#define GL_MAX_PATCH_VERTICES_OES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221 +#define GL_IS_PER_PATCH_OES 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308 +#define GL_TESS_CONTROL_SHADER_OES 0x8E88 +#define GL_TESS_EVALUATION_SHADER_OES 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriOES (GLenum pname, GLint value); +#endif +#endif /* GL_OES_tessellation_shader */ + +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +#endif /* GL_OES_texture_3D */ + +#ifndef GL_OES_texture_border_clamp +#define GL_OES_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_OES 0x1004 +#define GL_CLAMP_TO_BORDER_OES 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivOES (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivOES (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivOES (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivOES (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivOES (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivOES (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOES (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOES (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_OES_texture_border_clamp */ + +#ifndef GL_OES_texture_buffer +#define GL_OES_texture_buffer 1 +#define GL_TEXTURE_BUFFER_OES 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F +#define GL_SAMPLER_BUFFER_OES 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8 +#define GL_IMAGE_BUFFER_OES 0x9051 +#define GL_INT_IMAGE_BUFFER_OES 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D +#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferOES (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeOES (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_OES_texture_buffer */ + +#ifndef GL_OES_texture_compression_astc +#define GL_OES_texture_compression_astc 1 +#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 +#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 +#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 +#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 +#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 +#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 +#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 +#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 +#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 +#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 +#endif /* GL_OES_texture_compression_astc */ + +#ifndef GL_OES_texture_cube_map_array +#define GL_OES_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A +#endif /* GL_OES_texture_cube_map_array */ + +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif /* GL_OES_texture_float */ + +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif /* GL_OES_texture_float_linear */ + +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#define GL_HALF_FLOAT_OES 0x8D61 +#endif /* GL_OES_texture_half_float */ + +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif /* GL_OES_texture_half_float_linear */ + +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif /* GL_OES_texture_npot */ + +#ifndef GL_OES_texture_stencil8 +#define GL_OES_texture_stencil8 1 +#define GL_STENCIL_INDEX_OES 0x1901 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif /* GL_OES_texture_stencil8 */ + +#ifndef GL_OES_texture_storage_multisample_2d_array +#define GL_OES_texture_storage_multisample_2d_array 1 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif +#endif /* GL_OES_texture_storage_multisample_2d_array */ + +#ifndef GL_OES_texture_view +#define GL_OES_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewOES (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif +#endif /* GL_OES_texture_view */ + +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +#endif /* GL_OES_vertex_array_object */ + +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif /* GL_OES_vertex_half_float */ + +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif /* GL_OES_vertex_type_10_10_10_2 */ + +#ifndef GL_OES_viewport_array +#define GL_OES_viewport_array 1 +#define GL_MAX_VIEWPORTS_OES 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data); +#endif +#endif /* GL_OES_viewport_array */ + +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif /* GL_AMD_compressed_3DC_texture */ + +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif /* GL_AMD_compressed_ATC_texture */ + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); +GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +#endif /* GL_AMD_performance_monitor */ + +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#define GL_Z400_BINARY_AMD 0x8740 +#endif /* GL_AMD_program_binary_Z400 */ + +#ifndef GL_ANDROID_extension_pack_es31a +#define GL_ANDROID_extension_pack_es31a 1 +#endif /* GL_ANDROID_extension_pack_es31a */ + +#ifndef GL_ANGLE_depth_texture +#define GL_ANGLE_depth_texture 1 +#endif /* GL_ANGLE_depth_texture */ + +#ifndef GL_ANGLE_framebuffer_blit +#define GL_ANGLE_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_ANGLE_framebuffer_blit */ + +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_ANGLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_ANGLE_framebuffer_multisample */ + +#ifndef GL_ANGLE_instanced_arrays +#define GL_ANGLE_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); +#endif +#endif /* GL_ANGLE_instanced_arrays */ + +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_ANGLE_pack_reverse_row_order 1 +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif /* GL_ANGLE_pack_reverse_row_order */ + +#ifndef GL_ANGLE_program_binary +#define GL_ANGLE_program_binary 1 +#define GL_PROGRAM_BINARY_ANGLE 0x93A6 +#endif /* GL_ANGLE_program_binary */ + +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_ANGLE_texture_compression_dxt3 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#endif /* GL_ANGLE_texture_compression_dxt3 */ + +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_ANGLE_texture_compression_dxt5 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#endif /* GL_ANGLE_texture_compression_dxt5 */ + +#ifndef GL_ANGLE_texture_usage +#define GL_ANGLE_texture_usage 1 +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif /* GL_ANGLE_texture_usage */ + +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif +#endif /* GL_ANGLE_translated_shader_source */ + +#ifndef GL_APPLE_clip_distance +#define GL_APPLE_clip_distance 1 +#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32 +#define GL_CLIP_DISTANCE0_APPLE 0x3000 +#define GL_CLIP_DISTANCE1_APPLE 0x3001 +#define GL_CLIP_DISTANCE2_APPLE 0x3002 +#define GL_CLIP_DISTANCE3_APPLE 0x3003 +#define GL_CLIP_DISTANCE4_APPLE 0x3004 +#define GL_CLIP_DISTANCE5_APPLE 0x3005 +#define GL_CLIP_DISTANCE6_APPLE 0x3006 +#define GL_CLIP_DISTANCE7_APPLE 0x3007 +#endif /* GL_APPLE_clip_distance */ + +#ifndef GL_APPLE_color_buffer_packed_float +#define GL_APPLE_color_buffer_packed_float 1 +#endif /* GL_APPLE_color_buffer_packed_float */ + +#ifndef GL_APPLE_copy_texture_levels +#define GL_APPLE_copy_texture_levels 1 +typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#endif +#endif /* GL_APPLE_copy_texture_levels */ + +#ifndef GL_APPLE_framebuffer_multisample +#define GL_APPLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif +#endif /* GL_APPLE_framebuffer_multisample */ + +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_RGB_RAW_422_APPLE 0x8A51 +#endif /* GL_APPLE_rgb_422 */ + +#ifndef GL_APPLE_sync +#define GL_APPLE_sync 1 +#define GL_SYNC_OBJECT_APPLE 0x8A53 +#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 +#define GL_OBJECT_TYPE_APPLE 0x9112 +#define GL_SYNC_CONDITION_APPLE 0x9113 +#define GL_SYNC_STATUS_APPLE 0x9114 +#define GL_SYNC_FLAGS_APPLE 0x9115 +#define GL_SYNC_FENCE_APPLE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 +#define GL_UNSIGNALED_APPLE 0x9118 +#define GL_SIGNALED_APPLE 0x9119 +#define GL_ALREADY_SIGNALED_APPLE 0x911A +#define GL_TIMEOUT_EXPIRED_APPLE 0x911B +#define GL_CONDITION_SATISFIED_APPLE 0x911C +#define GL_WAIT_FAILED_APPLE 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 +#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull +typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); +typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); +typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); +GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); +GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); +GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif +#endif /* GL_APPLE_sync */ + +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_APPLE_texture_format_BGRA8888 1 +#define GL_BGRA_EXT 0x80E1 +#define GL_BGRA8_EXT 0x93A1 +#endif /* GL_APPLE_texture_format_BGRA8888 */ + +#ifndef GL_APPLE_texture_max_level +#define GL_APPLE_texture_max_level 1 +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif /* GL_APPLE_texture_max_level */ + +#ifndef GL_APPLE_texture_packed_float +#define GL_APPLE_texture_packed_float 1 +#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B +#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E +#define GL_R11F_G11F_B10F_APPLE 0x8C3A +#define GL_RGB9_E5_APPLE 0x8C3D +#endif /* GL_APPLE_texture_packed_float */ + +#ifndef GL_ARM_mali_program_binary +#define GL_ARM_mali_program_binary 1 +#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 +#endif /* GL_ARM_mali_program_binary */ + +#ifndef GL_ARM_mali_shader_binary +#define GL_ARM_mali_shader_binary 1 +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif /* GL_ARM_mali_shader_binary */ + +#ifndef GL_ARM_rgba8 +#define GL_ARM_rgba8 1 +#endif /* GL_ARM_rgba8 */ + +#ifndef GL_ARM_shader_framebuffer_fetch +#define GL_ARM_shader_framebuffer_fetch 1 +#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 +#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66 +#endif /* GL_ARM_shader_framebuffer_fetch */ + +#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil +#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 +#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ + +#ifndef GL_DMP_program_binary +#define GL_DMP_program_binary 1 +#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 +#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252 +#define GL_DMP_PROGRAM_BINARY_DMP 0x9253 +#endif /* GL_DMP_program_binary */ + +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 +#define GL_SHADER_BINARY_DMP 0x9250 +#endif /* GL_DMP_shader_binary */ + +#ifndef GL_EXT_EGL_image_array +#define GL_EXT_EGL_image_array 1 +#endif /* GL_EXT_EGL_image_array */ + +#ifndef GL_EXT_YUV_target +#define GL_EXT_YUV_target 1 +#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7 +#endif /* GL_EXT_YUV_target */ + +#ifndef GL_EXT_base_instance +#define GL_EXT_base_instance 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceEXT (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#endif +#endif /* GL_EXT_base_instance */ + +#ifndef GL_EXT_blend_func_extended +#define GL_EXT_blend_func_extended 1 +#define GL_SRC1_COLOR_EXT 0x88F9 +#define GL_SRC1_ALPHA_EXT 0x8589 +#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB +#define GL_SRC_ALPHA_SATURATE_EXT 0x0308 +#define GL_LOCATION_INDEX_EXT 0x930F +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT (GLuint program, GLenum programInterface, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLuint program, const GLchar *name); +#endif +#endif /* GL_EXT_blend_func_extended */ + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif /* GL_EXT_blend_minmax */ + +#ifndef GL_EXT_buffer_storage +#define GL_EXT_buffer_storage 1 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_PERSISTENT_BIT_EXT 0x0040 +#define GL_MAP_COHERENT_BIT_EXT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100 +#define GL_CLIENT_STORAGE_BIT_EXT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F +#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220 +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +#endif +#endif /* GL_EXT_buffer_storage */ + +#ifndef GL_EXT_clear_texture +#define GL_EXT_clear_texture 1 +typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#endif +#endif /* GL_EXT_clear_texture */ + +#ifndef GL_EXT_clip_control +#define GL_EXT_clip_control 1 +#define GL_LOWER_LEFT_EXT 0x8CA1 +#define GL_UPPER_LEFT_EXT 0x8CA2 +#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E +#define GL_ZERO_TO_ONE_EXT 0x935F +#define GL_CLIP_ORIGIN_EXT 0x935C +#define GL_CLIP_DEPTH_MODE_EXT 0x935D +typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth); +#endif +#endif /* GL_EXT_clip_control */ + +#ifndef GL_EXT_clip_cull_distance +#define GL_EXT_clip_cull_distance 1 +#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32 +#define GL_MAX_CULL_DISTANCES_EXT 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA +#define GL_CLIP_DISTANCE0_EXT 0x3000 +#define GL_CLIP_DISTANCE1_EXT 0x3001 +#define GL_CLIP_DISTANCE2_EXT 0x3002 +#define GL_CLIP_DISTANCE3_EXT 0x3003 +#define GL_CLIP_DISTANCE4_EXT 0x3004 +#define GL_CLIP_DISTANCE5_EXT 0x3005 +#define GL_CLIP_DISTANCE6_EXT 0x3006 +#define GL_CLIP_DISTANCE7_EXT 0x3007 +#endif /* GL_EXT_clip_cull_distance */ + +#ifndef GL_EXT_color_buffer_float +#define GL_EXT_color_buffer_float 1 +#endif /* GL_EXT_color_buffer_float */ + +#ifndef GL_EXT_color_buffer_half_float +#define GL_EXT_color_buffer_half_float 1 +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif /* GL_EXT_color_buffer_half_float */ + +#ifndef GL_EXT_conservative_depth +#define GL_EXT_conservative_depth 1 +#endif /* GL_EXT_conservative_depth */ + +#ifndef GL_EXT_copy_image +#define GL_EXT_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (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 srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (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 srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif +#endif /* GL_EXT_copy_image */ + +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_EXT_debug_label */ + +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +#endif /* GL_EXT_debug_marker */ + +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +#endif /* GL_EXT_discard_framebuffer */ + +#ifndef GL_EXT_disjoint_timer_query +#define GL_EXT_disjoint_timer_query 1 +#define GL_QUERY_COUNTER_BITS_EXT 0x8864 +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_TIME_ELAPSED_EXT 0x88BF +#define GL_TIMESTAMP_EXT 0x8E28 +#define GL_GPU_DISJOINT_EXT 0x8FBB +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +#endif +#endif /* GL_EXT_disjoint_timer_query */ + +#ifndef GL_EXT_draw_buffers +#define GL_EXT_draw_buffers 1 +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 +#define GL_DRAW_BUFFER0_EXT 0x8825 +#define GL_DRAW_BUFFER1_EXT 0x8826 +#define GL_DRAW_BUFFER2_EXT 0x8827 +#define GL_DRAW_BUFFER3_EXT 0x8828 +#define GL_DRAW_BUFFER4_EXT 0x8829 +#define GL_DRAW_BUFFER5_EXT 0x882A +#define GL_DRAW_BUFFER6_EXT 0x882B +#define GL_DRAW_BUFFER7_EXT 0x882C +#define GL_DRAW_BUFFER8_EXT 0x882D +#define GL_DRAW_BUFFER9_EXT 0x882E +#define GL_DRAW_BUFFER10_EXT 0x882F +#define GL_DRAW_BUFFER11_EXT 0x8830 +#define GL_DRAW_BUFFER12_EXT 0x8831 +#define GL_DRAW_BUFFER13_EXT 0x8832 +#define GL_DRAW_BUFFER14_EXT 0x8833 +#define GL_DRAW_BUFFER15_EXT 0x8834 +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_EXT_draw_buffers */ + +#ifndef GL_EXT_draw_buffers_indexed +#define GL_EXT_draw_buffers_indexed 1 +typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index); +#endif +#endif /* GL_EXT_draw_buffers_indexed */ + +#ifndef GL_EXT_draw_elements_base_vertex +#define GL_EXT_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#endif +#endif /* GL_EXT_draw_elements_base_vertex */ + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_EXT_draw_instanced */ + +#ifndef GL_EXT_draw_transform_feedback +#define GL_EXT_draw_transform_feedback 1 +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id); +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id); +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount); +#endif +#endif /* GL_EXT_draw_transform_feedback */ + +#ifndef GL_EXT_external_buffer +#define GL_EXT_external_buffer 1 +typedef void *GLeglClientBufferEXT; +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#endif +#endif /* GL_EXT_external_buffer */ + +#ifndef GL_EXT_float_blend +#define GL_EXT_float_blend 1 +#endif /* GL_EXT_float_blend */ + +#ifndef GL_EXT_geometry_point_size +#define GL_EXT_geometry_point_size 1 +#endif /* GL_EXT_geometry_point_size */ + +#ifndef GL_EXT_geometry_shader +#define GL_EXT_geometry_shader 1 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F +#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_UNDEFINED_VERTEX_EXT 0x8260 +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_EXT_geometry_shader */ + +#ifndef GL_EXT_gpu_shader5 +#define GL_EXT_gpu_shader5 1 +#endif /* GL_EXT_gpu_shader5 */ + +#ifndef GL_EXT_instanced_arrays +#define GL_EXT_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor); +#endif +#endif /* GL_EXT_instanced_arrays */ + +#ifndef GL_EXT_map_buffer_range +#define GL_EXT_map_buffer_range 1 +#define GL_MAP_READ_BIT_EXT 0x0001 +#define GL_MAP_WRITE_BIT_EXT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 +typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); +#endif +#endif /* GL_EXT_map_buffer_range */ + +#ifndef GL_EXT_memory_object +#define GL_EXT_memory_object 1 +#define GL_TEXTURE_TILING_EXT 0x9580 +#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581 +#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B +#define GL_NUM_TILING_TYPES_EXT 0x9582 +#define GL_TILING_TYPES_EXT 0x9583 +#define GL_OPTIMAL_TILING_EXT 0x9584 +#define GL_LINEAR_TILING_EXT 0x9585 +#define GL_NUM_DEVICE_UUIDS_EXT 0x9596 +#define GL_DEVICE_UUID_EXT 0x9597 +#define GL_DRIVER_UUID_EXT 0x9598 +#define GL_UUID_SIZE_EXT 16 +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects); +typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject); +typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects); +typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data); +GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data); +GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects); +GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject); +GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects); +GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#endif +#endif /* GL_EXT_memory_object */ + +#ifndef GL_EXT_memory_object_fd +#define GL_EXT_memory_object_fd 1 +#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586 +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_memory_object_fd */ + +#ifndef GL_EXT_memory_object_win32 +#define GL_EXT_memory_object_win32 1 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588 +#define GL_DEVICE_LUID_EXT 0x9599 +#define GL_DEVICE_NODE_MASK_EXT 0x959A +#define GL_LUID_SIZE_EXT 8 +#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589 +#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A +#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B +#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_memory_object_win32 */ + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#endif +#endif /* GL_EXT_multi_draw_arrays */ + +#ifndef GL_EXT_multi_draw_indirect +#define GL_EXT_multi_draw_indirect 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysIndirectEXT (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GL_APICALL void GL_APIENTRY glMultiDrawElementsIndirectEXT (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif +#endif /* GL_EXT_multi_draw_indirect */ + +#ifndef GL_EXT_multisampled_compatibility +#define GL_EXT_multisampled_compatibility 1 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#endif /* GL_EXT_multisampled_compatibility */ + +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +#endif /* GL_EXT_multisampled_render_to_texture */ + +#ifndef GL_EXT_multiview_draw_buffers +#define GL_EXT_multiview_draw_buffers 1 +#define GL_COLOR_ATTACHMENT_EXT 0x90F0 +#define GL_MULTIVIEW_EXT 0x90F1 +#define GL_DRAW_BUFFER_EXT 0x0C01 +#define GL_READ_BUFFER_EXT 0x0C02 +#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 +typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); +typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); +GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); +GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); +#endif +#endif /* GL_EXT_multiview_draw_buffers */ + +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#endif /* GL_EXT_occlusion_query_boolean */ + +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + +#ifndef GL_EXT_primitive_bounding_box +#define GL_EXT_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_EXT_primitive_bounding_box */ + +#ifndef GL_EXT_protected_textures +#define GL_EXT_protected_textures 1 +#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010 +#define GL_TEXTURE_PROTECTED_EXT 0x8BFA +#endif /* GL_EXT_protected_textures */ + +#ifndef GL_EXT_pvrtc_sRGB +#define GL_EXT_pvrtc_sRGB 1 +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 +#endif /* GL_EXT_pvrtc_sRGB */ + +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (GL_APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); +#endif +#endif /* GL_EXT_raster_multisample */ + +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif /* GL_EXT_read_format_bgra */ + +#ifndef GL_EXT_render_snorm +#define GL_EXT_render_snorm 1 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM_EXT 0x8F98 +#define GL_RG16_SNORM_EXT 0x8F99 +#define GL_RGBA16_SNORM_EXT 0x8F9B +#endif /* GL_EXT_render_snorm */ + +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_EXT_robustness */ + +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif /* GL_EXT_sRGB */ + +#ifndef GL_EXT_sRGB_write_control +#define GL_EXT_sRGB_write_control 1 +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#endif /* GL_EXT_sRGB_write_control */ + +#ifndef GL_EXT_semaphore +#define GL_EXT_semaphore 1 +#define GL_LAYOUT_GENERAL_EXT 0x958D +#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E +#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F +#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590 +#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591 +#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592 +#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593 +typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores); +typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores); +typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore); +typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores); +GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores); +GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore); +GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params); +GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params); +GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#endif +#endif /* GL_EXT_semaphore */ + +#ifndef GL_EXT_semaphore_fd +#define GL_EXT_semaphore_fd 1 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_semaphore_fd */ + +#ifndef GL_EXT_semaphore_win32 +#define GL_EXT_semaphore_win32 1 +#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594 +#define GL_D3D12_FENCE_VALUE_EXT 0x9595 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_semaphore_win32 */ + +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); +GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); +GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_EXT_separate_shader_objects */ + +#ifndef GL_EXT_shader_framebuffer_fetch +#define GL_EXT_shader_framebuffer_fetch 1 +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +#endif /* GL_EXT_shader_framebuffer_fetch */ + +#ifndef GL_EXT_shader_group_vote +#define GL_EXT_shader_group_vote 1 +#endif /* GL_EXT_shader_group_vote */ + +#ifndef GL_EXT_shader_implicit_conversions +#define GL_EXT_shader_implicit_conversions 1 +#endif /* GL_EXT_shader_implicit_conversions */ + +#ifndef GL_EXT_shader_integer_mix +#define GL_EXT_shader_integer_mix 1 +#endif /* GL_EXT_shader_integer_mix */ + +#ifndef GL_EXT_shader_io_blocks +#define GL_EXT_shader_io_blocks 1 +#endif /* GL_EXT_shader_io_blocks */ + +#ifndef GL_EXT_shader_non_constant_global_initializers +#define GL_EXT_shader_non_constant_global_initializers 1 +#endif /* GL_EXT_shader_non_constant_global_initializers */ + +#ifndef GL_EXT_shader_pixel_local_storage +#define GL_EXT_shader_pixel_local_storage 1 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67 +#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64 +#endif /* GL_EXT_shader_pixel_local_storage */ + +#ifndef GL_EXT_shader_pixel_local_storage2 +#define GL_EXT_shader_pixel_local_storage2 1 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651 +#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size); +typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target); +typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size); +GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target); +GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values); +#endif +#endif /* GL_EXT_shader_pixel_local_storage2 */ + +#ifndef GL_EXT_shader_texture_lod +#define GL_EXT_shader_texture_lod 1 +#endif /* GL_EXT_shader_texture_lod */ + +#ifndef GL_EXT_shadow_samplers +#define GL_EXT_shadow_samplers 1 +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif /* GL_EXT_shadow_samplers */ + +#ifndef GL_EXT_sparse_texture +#define GL_EXT_sparse_texture 1 +#define GL_TEXTURE_SPARSE_EXT 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7 +#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA +#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_TEXTURE_3D 0x806F +#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9 +typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#endif +#endif /* GL_EXT_sparse_texture */ + +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + +#ifndef GL_EXT_tessellation_point_size +#define GL_EXT_tessellation_point_size 1 +#endif /* GL_EXT_tessellation_point_size */ + +#ifndef GL_EXT_tessellation_shader +#define GL_EXT_tessellation_shader 1 +#define GL_PATCHES_EXT 0x000E +#define GL_PATCH_VERTICES_EXT 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 +#define GL_TESS_GEN_MODE_EXT 0x8E76 +#define GL_TESS_GEN_SPACING_EXT 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 +#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 +#define GL_ISOLINES_EXT 0x8E7A +#define GL_QUADS_EXT 0x0007 +#define GL_FRACTIONAL_ODD_EXT 0x8E7B +#define GL_FRACTIONAL_EVEN_EXT 0x8E7C +#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_IS_PER_PATCH_EXT 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 +#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 +#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value); +#endif +#endif /* GL_EXT_tessellation_shader */ + +#ifndef GL_EXT_texture_border_clamp +#define GL_EXT_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 +#define GL_CLAMP_TO_BORDER_EXT 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_EXT_texture_border_clamp */ + +#ifndef GL_EXT_texture_buffer +#define GL_EXT_texture_buffer 1 +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D +#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_EXT_texture_buffer */ + +#ifndef GL_EXT_texture_compression_astc_decode_mode +#define GL_EXT_texture_compression_astc_decode_mode 1 +#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69 +#endif /* GL_EXT_texture_compression_astc_decode_mode */ + +#ifndef GL_EXT_texture_compression_bptc +#define GL_EXT_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F +#endif /* GL_EXT_texture_compression_bptc */ + +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif /* GL_EXT_texture_compression_dxt1 */ + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif /* GL_EXT_texture_compression_rgtc */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif /* GL_EXT_texture_compression_s3tc */ + +#ifndef GL_EXT_texture_compression_s3tc_srgb +#define GL_EXT_texture_compression_s3tc_srgb 1 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif /* GL_EXT_texture_compression_s3tc_srgb */ + +#ifndef GL_EXT_texture_cube_map_array +#define GL_EXT_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#endif /* GL_EXT_texture_cube_map_array */ + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif /* GL_EXT_texture_filter_anisotropic */ + +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#endif /* GL_EXT_texture_filter_minmax */ + +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif /* GL_EXT_texture_format_BGRA8888 */ + +#ifndef GL_EXT_texture_norm16 +#define GL_EXT_texture_norm16 1 +#define GL_R16_EXT 0x822A +#define GL_RG16_EXT 0x822C +#define GL_RGBA16_EXT 0x805B +#define GL_RGB16_EXT 0x8054 +#define GL_RGB16_SNORM_EXT 0x8F9A +#endif /* GL_EXT_texture_norm16 */ + +#ifndef GL_EXT_texture_rg +#define GL_EXT_texture_rg 1 +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif /* GL_EXT_texture_rg */ + +#ifndef GL_EXT_texture_sRGB_R8 +#define GL_EXT_texture_sRGB_R8 1 +#define GL_SR8_EXT 0x8FBD +#endif /* GL_EXT_texture_sRGB_R8 */ + +#ifndef GL_EXT_texture_sRGB_RG8 +#define GL_EXT_texture_sRGB_RG8 1 +#define GL_SRG8_EXT 0x8FBE +#endif /* GL_EXT_texture_sRGB_RG8 */ + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif /* GL_EXT_texture_sRGB_decode */ + +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_EXT_texture_storage */ + +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif /* GL_EXT_texture_type_2_10_10_10_REV */ + +#ifndef GL_EXT_texture_view +#define GL_EXT_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif +#endif /* GL_EXT_texture_view */ + +#ifndef GL_EXT_unpack_subimage +#define GL_EXT_unpack_subimage 1 +#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 +#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 +#endif /* GL_EXT_unpack_subimage */ + +#ifndef GL_EXT_win32_keyed_mutex +#define GL_EXT_win32_keyed_mutex 1 +typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout); +typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout); +GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key); +#endif +#endif /* GL_EXT_win32_keyed_mutex */ + +#ifndef GL_EXT_window_rectangles +#define GL_EXT_window_rectangles 1 +#define GL_INCLUSIVE_EXT 0x8F10 +#define GL_EXCLUSIVE_EXT 0x8F11 +#define GL_WINDOW_RECTANGLE_EXT 0x8F12 +#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13 +#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14 +#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15 +typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box); +#endif +#endif /* GL_EXT_window_rectangles */ + +#ifndef GL_FJ_shader_binary_GCCSO +#define GL_FJ_shader_binary_GCCSO 1 +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 +#endif /* GL_FJ_shader_binary_GCCSO */ + +#ifndef GL_IMG_bindless_texture +#define GL_IMG_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#endif +#endif /* GL_IMG_bindless_texture */ + +#ifndef GL_IMG_framebuffer_downsample +#define GL_IMG_framebuffer_downsample 1 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C +#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D +#define GL_DOWNSAMPLE_SCALES_IMG 0x913E +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); +#endif +#endif /* GL_IMG_framebuffer_downsample */ + +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +#endif /* GL_IMG_multisampled_render_to_texture */ + +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif /* GL_IMG_program_binary */ + +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif /* GL_IMG_read_format */ + +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 +#define GL_SGX_BINARY_IMG 0x8C0A +#endif /* GL_IMG_shader_binary */ + +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif /* GL_IMG_texture_compression_pvrtc */ + +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_IMG_texture_compression_pvrtc2 1 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 +#endif /* GL_IMG_texture_compression_pvrtc2 */ + +#ifndef GL_IMG_texture_filter_cubic +#define GL_IMG_texture_filter_cubic 1 +#define GL_CUBIC_IMG 0x9139 +#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A +#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B +#endif /* GL_IMG_texture_filter_cubic */ + +#ifndef GL_INTEL_conservative_rasterization +#define GL_INTEL_conservative_rasterization 1 +#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE +#endif /* GL_INTEL_conservative_rasterization */ + +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 +typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); +#endif +#endif /* GL_INTEL_framebuffer_CMAA */ + +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 +typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); +typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); +typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); +GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); +GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#endif +#endif /* GL_INTEL_performance_query */ + +#ifndef GL_MESA_shader_integer_functions +#define GL_MESA_shader_integer_functions 1 +#endif /* GL_MESA_shader_integer_functions */ + +#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers +#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1 +#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */ + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef GLuint64 (GL_APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (GL_APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleNV (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); +GL_APICALL GLuint64 GL_APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GL_APICALL void GL_APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); +GL_APICALL void GL_APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GL_APICALL GLboolean GL_APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); +GL_APICALL GLboolean GL_APIENTRY glIsImageHandleResidentNV (GLuint64 handle); +#endif +#endif /* GL_NV_bindless_texture */ + +#ifndef GL_NV_blend_equation_advanced +#define GL_NV_blend_equation_advanced 1 +#define GL_BLEND_OVERLAP_NV 0x9281 +#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLUE_NV 0x1905 +#define GL_COLORBURN_NV 0x929A +#define GL_COLORDODGE_NV 0x9299 +#define GL_CONJOINT_NV 0x9284 +#define GL_CONTRAST_NV 0x92A1 +#define GL_DARKEN_NV 0x9297 +#define GL_DIFFERENCE_NV 0x929E +#define GL_DISJOINT_NV 0x9283 +#define GL_DST_ATOP_NV 0x928F +#define GL_DST_IN_NV 0x928B +#define GL_DST_NV 0x9287 +#define GL_DST_OUT_NV 0x928D +#define GL_DST_OVER_NV 0x9289 +#define GL_EXCLUSION_NV 0x92A0 +#define GL_GREEN_NV 0x1904 +#define GL_HARDLIGHT_NV 0x929B +#define GL_HARDMIX_NV 0x92A9 +#define GL_HSL_COLOR_NV 0x92AF +#define GL_HSL_HUE_NV 0x92AD +#define GL_HSL_LUMINOSITY_NV 0x92B0 +#define GL_HSL_SATURATION_NV 0x92AE +#define GL_INVERT_OVG_NV 0x92B4 +#define GL_INVERT_RGB_NV 0x92A3 +#define GL_LIGHTEN_NV 0x9298 +#define GL_LINEARBURN_NV 0x92A5 +#define GL_LINEARDODGE_NV 0x92A4 +#define GL_LINEARLIGHT_NV 0x92A7 +#define GL_MINUS_CLAMPED_NV 0x92B3 +#define GL_MINUS_NV 0x929F +#define GL_MULTIPLY_NV 0x9294 +#define GL_OVERLAY_NV 0x9296 +#define GL_PINLIGHT_NV 0x92A8 +#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 +#define GL_PLUS_CLAMPED_NV 0x92B1 +#define GL_PLUS_DARKER_NV 0x9292 +#define GL_PLUS_NV 0x9291 +#define GL_RED_NV 0x1903 +#define GL_SCREEN_NV 0x9295 +#define GL_SOFTLIGHT_NV 0x929C +#define GL_SRC_ATOP_NV 0x928E +#define GL_SRC_IN_NV 0x928A +#define GL_SRC_NV 0x9286 +#define GL_SRC_OUT_NV 0x928C +#define GL_SRC_OVER_NV 0x9288 +#define GL_UNCORRELATED_NV 0x9282 +#define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_XOR_NV 0x1506 +typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glBlendBarrierNV (void); +#endif +#endif /* GL_NV_blend_equation_advanced */ + +#ifndef GL_NV_blend_equation_advanced_coherent +#define GL_NV_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 +#endif /* GL_NV_blend_equation_advanced_coherent */ + +#ifndef GL_NV_blend_minmax_factor +#define GL_NV_blend_minmax_factor 1 +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D +#endif /* GL_NV_blend_minmax_factor */ + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +typedef void (GL_APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (GL_APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); +GL_APICALL void GL_APIENTRY glEndConditionalRenderNV (void); +#endif +#endif /* GL_NV_conditional_render */ + +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (GL_APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); +#endif +#endif /* GL_NV_conservative_raster */ + +#ifndef GL_NV_conservative_raster_pre_snap_triangles +#define GL_NV_conservative_raster_pre_snap_triangles 1 +#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D +#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F +typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param); +#endif +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ + +#ifndef GL_NV_copy_buffer +#define GL_NV_copy_buffer 1 +#define GL_COPY_READ_BUFFER_NV 0x8F36 +#define GL_COPY_WRITE_BUFFER_NV 0x8F37 +typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif +#endif /* GL_NV_copy_buffer */ + +#ifndef GL_NV_coverage_sample +#define GL_NV_coverage_sample 1 +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); +GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); +#endif +#endif /* GL_NV_coverage_sample */ + +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif /* GL_NV_depth_nonlinear */ + +#ifndef GL_NV_draw_buffers +#define GL_NV_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_NV_draw_buffers */ + +#ifndef GL_NV_draw_instanced +#define GL_NV_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_NV_draw_instanced */ + +#ifndef GL_NV_draw_vulkan_image +#define GL_NV_draw_vulkan_image 1 +typedef void (GL_APIENTRY *GLVULKANPROCNV)(void); +typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name); +typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name); +GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence); +#endif +#endif /* GL_NV_draw_vulkan_image */ + +#ifndef GL_NV_explicit_attrib_location +#define GL_NV_explicit_attrib_location 1 +#endif /* GL_NV_explicit_attrib_location */ + +#ifndef GL_NV_fbo_color_attachments +#define GL_NV_fbo_color_attachments 1 +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +#endif /* GL_NV_fbo_color_attachments */ + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence); +GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition); +#endif +#endif /* GL_NV_fence */ + +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (GL_APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color); +#endif +#endif /* GL_NV_fragment_coverage_to_color */ + +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ + +#ifndef GL_NV_framebuffer_blit +#define GL_NV_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_NV 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_NV_framebuffer_blit */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components); +#endif +#endif /* GL_NV_framebuffer_mixed_samples */ + +#ifndef GL_NV_framebuffer_multisample +#define GL_NV_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 +#define GL_MAX_SAMPLES_NV 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_NV_framebuffer_multisample */ + +#ifndef GL_NV_generate_mipmap_sRGB +#define GL_NV_generate_mipmap_sRGB 1 +#endif /* GL_NV_generate_mipmap_sRGB */ + +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 +typedef khronos_int64_t GLint64EXT; +typedef khronos_uint64_t GLuint64EXT; +#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 +#define GL_PATCHES 0x000E +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_NV_gpu_shader5 */ + +#ifndef GL_NV_image_formats +#define GL_NV_image_formats 1 +#endif /* GL_NV_image_formats */ + +#ifndef GL_NV_instanced_arrays +#define GL_NV_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); +#endif +#endif /* GL_NV_instanced_arrays */ + +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + +#ifndef GL_NV_non_square_matrices +#define GL_NV_non_square_matrices 1 +#define GL_FLOAT_MAT2x3_NV 0x8B65 +#define GL_FLOAT_MAT2x4_NV 0x8B66 +#define GL_FLOAT_MAT3x2_NV 0x8B67 +#define GL_FLOAT_MAT3x4_NV 0x8B68 +#define GL_FLOAT_MAT4x2_NV 0x8B69 +#define GL_FLOAT_MAT4x3_NV 0x8B6A +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_NV_non_square_matrices */ + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_BOLD_BIT_NV 0x01 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 +#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 +#define GL_FONT_ASCENDER_BIT_NV 0x00200000 +#define GL_FONT_DESCENDER_BIT_NV 0x00400000 +#define GL_FONT_HEIGHT_BIT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 +#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D +typedef GLuint (GL_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (GL_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLboolean (GL_APIENTRYP PFNGLISPATHNVPROC) (GLuint path); +typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +typedef void (GL_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (GL_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef void (GL_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (GL_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); +typedef void (GL_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); +typedef void (GL_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); +typedef void (GL_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef GLfloat (GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef GLboolean (GL_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint GL_APIENTRY glGenPathsNV (GLsizei range); +GL_APICALL void GL_APIENTRY glDeletePathsNV (GLuint path, GLsizei range); +GL_APICALL GLboolean GL_APIENTRY glIsPathNV (GLuint path); +GL_APICALL void GL_APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString); +GL_APICALL void GL_APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +GL_APICALL void GL_APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); +GL_APICALL void GL_APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +GL_APICALL void GL_APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); +GL_APICALL void GL_APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); +GL_APICALL void GL_APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); +GL_APICALL void GL_APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathCoverDepthFuncNV (GLenum func); +GL_APICALL void GL_APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); +GL_APICALL void GL_APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); +GL_APICALL void GL_APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); +GL_APICALL void GL_APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); +GL_APICALL void GL_APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +GL_APICALL GLboolean GL_APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); +GL_APICALL GLboolean GL_APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); +GL_APICALL GLfloat GL_APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); +GL_APICALL GLboolean GL_APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GL_APICALL void GL_APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +#endif +#endif /* GL_NV_path_rendering */ + +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + +#ifndef GL_NV_pixel_buffer_object +#define GL_NV_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_NV 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF +#endif /* GL_NV_pixel_buffer_object */ + +#ifndef GL_NV_polygon_mode +#define GL_NV_polygon_mode 1 +#define GL_POLYGON_MODE_NV 0x0B40 +#define GL_POLYGON_OFFSET_POINT_NV 0x2A01 +#define GL_POLYGON_OFFSET_LINE_NV 0x2A02 +#define GL_POINT_NV 0x1B00 +#define GL_LINE_NV 0x1B01 +#define GL_FILL_NV 0x1B02 +typedef void (GL_APIENTRYP PFNGLPOLYGONMODENVPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode); +#endif +#endif /* GL_NV_polygon_mode */ + +#ifndef GL_NV_read_buffer +#define GL_NV_read_buffer 1 +#define GL_READ_BUFFER_NV 0x0C02 +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); +#endif +#endif /* GL_NV_read_buffer */ + +#ifndef GL_NV_read_buffer_front +#define GL_NV_read_buffer_front 1 +#endif /* GL_NV_read_buffer_front */ + +#ifndef GL_NV_read_depth +#define GL_NV_read_depth 1 +#endif /* GL_NV_read_depth */ + +#ifndef GL_NV_read_depth_stencil +#define GL_NV_read_depth_stencil 1 +#endif /* GL_NV_read_depth_stencil */ + +#ifndef GL_NV_read_stencil +#define GL_NV_read_stencil 1 +#endif /* GL_NV_read_stencil */ + +#ifndef GL_NV_sRGB_formats +#define GL_NV_sRGB_formats 1 +#define GL_SLUMINANCE_NV 0x8C46 +#define GL_SLUMINANCE_ALPHA_NV 0x8C44 +#define GL_SRGB8_NV 0x8C41 +#define GL_SLUMINANCE8_NV 0x8C47 +#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F +#define GL_ETC1_SRGB8_NV 0x88EE +#endif /* GL_NV_sRGB_formats */ + +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + +#ifndef GL_NV_shader_noperspective_interpolation +#define GL_NV_shader_noperspective_interpolation 1 +#endif /* GL_NV_shader_noperspective_interpolation */ + +#ifndef GL_NV_shadow_samplers_array +#define GL_NV_shadow_samplers_array 1 +#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 +#endif /* GL_NV_shadow_samplers_array */ + +#ifndef GL_NV_shadow_samplers_cube +#define GL_NV_shadow_samplers_cube 1 +#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 +#endif /* GL_NV_shadow_samplers_cube */ + +#ifndef GL_NV_texture_border_clamp +#define GL_NV_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 +#define GL_CLAMP_TO_BORDER_NV 0x812D +#endif /* GL_NV_texture_border_clamp */ + +#ifndef GL_NV_texture_compression_s3tc_update +#define GL_NV_texture_compression_s3tc_update 1 +#endif /* GL_NV_texture_compression_s3tc_update */ + +#ifndef GL_NV_texture_npot_2D_mipmap +#define GL_NV_texture_npot_2D_mipmap 1 +#endif /* GL_NV_texture_npot_2D_mipmap */ + +#ifndef GL_NV_viewport_array +#define GL_NV_viewport_array 1 +#define GL_MAX_VIEWPORTS_NV 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVNVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDNVPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVNVPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFNVPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VNVPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLENABLEINVPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEINVPROC) (GLenum target, GLuint index); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDINVPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfNV (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvNV (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvNV (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedNV (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvNV (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfNV (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vNV (GLenum target, GLuint index, GLfloat *data); +GL_APICALL void GL_APIENTRY glEnableiNV (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiNV (GLenum target, GLuint index); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index); +#endif +#endif /* GL_NV_viewport_array */ + +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 +#endif /* GL_NV_viewport_array2 */ + +#ifndef GL_NV_viewport_swizzle +#define GL_NV_viewport_swizzle 1 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 +#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358 +#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359 +#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A +#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B +typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#endif +#endif /* GL_NV_viewport_swizzle */ + +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview */ + +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 +#endif /* GL_OVR_multiview2 */ + +#ifndef GL_OVR_multiview_multisampled_render_to_texture +#define GL_OVR_multiview_multisampled_render_to_texture 1 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview_multisampled_render_to_texture */ + +#ifndef GL_QCOM_alpha_test +#define GL_QCOM_alpha_test 1 +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); +#endif +#endif /* GL_QCOM_alpha_test */ + +#ifndef GL_QCOM_binning_control +#define GL_QCOM_binning_control 1 +#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 +#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 +#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 +#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 +#endif /* GL_QCOM_binning_control */ + +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +#endif /* GL_QCOM_driver_control */ + +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params); +#endif +#endif /* GL_QCOM_extended_get */ + +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +#endif /* GL_QCOM_extended_get2 */ + +#ifndef GL_QCOM_framebuffer_foveated +#define GL_QCOM_framebuffer_foveated 1 +#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001 +#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#endif +#endif /* GL_QCOM_framebuffer_foveated */ + +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif /* GL_QCOM_perfmon_global_mode */ + +#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent +#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1 +#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void); +#endif +#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */ + +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +#endif /* GL_QCOM_tiled_rendering */ + +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif /* GL_QCOM_writeonly_rendering */ + +#ifndef GL_VIV_shader_binary +#define GL_VIV_shader_binary 1 +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif /* GL_VIV_shader_binary */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h b/Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h new file mode 100644 index 000000000..eb318dc3a --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h @@ -0,0 +1,38 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* +** Copyright (c) 2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * Please contribute modifications back to Khronos as pull requests on the + * public github repository: + * https://github.com/KhronosGroup/OpenGL-Registry + */ + +#include + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ diff --git a/Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h b/Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h new file mode 100644 index 000000000..1ad3554a7 --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h @@ -0,0 +1,284 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 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 +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h b/Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h new file mode 100644 index 000000000..72f80493c --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h @@ -0,0 +1,120 @@ +// +// File: vk_platform.h +// +/* +** Copyright (c) 2014-2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + + +#ifndef VK_PLATFORM_H_ +#define VK_PLATFORM_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/* +*************************************************************************************************** +* Platform-specific directives and type declarations +*************************************************************************************************** +*/ + +/* Platform-specific calling convention macros. + * + * Platforms should define these so that Vulkan clients call Vulkan commands + * with the same calling conventions that the Vulkan implementation expects. + * + * VKAPI_ATTR - Placed before the return type in function declarations. + * Useful for C++11 and GCC/Clang-style function attribute syntax. + * VKAPI_CALL - Placed after the return type in function declarations. + * Useful for MSVC-style calling convention syntax. + * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. + * + * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); + * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); + */ +#if defined(_WIN32) + // On Windows, Vulkan commands use the stdcall convention + #define VKAPI_ATTR + #define VKAPI_CALL __stdcall + #define VKAPI_PTR VKAPI_CALL +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error "Vulkan isn't supported for the 'armeabi' NDK ABI" +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) + // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" + // calling convention, i.e. float parameters are passed in registers. This + // is true even if the rest of the application passes floats on the stack, + // as it does by default when compiling for the armeabi-v7a NDK ABI. + #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) + #define VKAPI_CALL + #define VKAPI_PTR VKAPI_ATTR +#else + // On other platforms, use the default calling convention + #define VKAPI_ATTR + #define VKAPI_CALL + #define VKAPI_PTR +#endif + +#include + +#if !defined(VK_NO_STDINT_H) + #if defined(_MSC_VER) && (_MSC_VER < 1600) + typedef signed __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef signed __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef signed __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef signed __int64 int64_t; + typedef unsigned __int64 uint64_t; + #else + #include + #endif +#endif // !defined(VK_NO_STDINT_H) + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +// Platform-specific headers required by platform window system extensions. +// These are enabled prior to #including "vulkan.h". The same enable then +// controls inclusion of the extension interfaces in vulkan.h. + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_MIR_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XCB_KHR +#include +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h b/Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h new file mode 100644 index 000000000..04495fa0c --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h @@ -0,0 +1,6458 @@ +#ifndef VULKAN_H_ +#define VULKAN_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2015-2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#define VK_VERSION_1_0 1 +#include "./vk_platform.h" + +#define VK_MAKE_VERSION(major, minor, patch) \ + (((major) << 22) | ((minor) << 12) | (patch)) + +// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. +//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 + +// Vulkan 1.0 version number +#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)// Patch version should always be set to 0 + +#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) +#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) +// Version of this file +#define VK_HEADER_VERSION 59 + + +#define VK_NULL_HANDLE 0 + + + +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + + +#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE) +#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif +#endif + + + +typedef uint32_t VkFlags; +typedef uint32_t VkBool32; +typedef uint64_t VkDeviceSize; +typedef uint32_t VkSampleMask; + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_HANDLE(VkPhysicalDevice) +VK_DEFINE_HANDLE(VkDevice) +VK_DEFINE_HANDLE(VkQueue) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) +VK_DEFINE_HANDLE(VkCommandBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) + +#define VK_LOD_CLAMP_NONE 1000.0f +#define VK_REMAINING_MIP_LEVELS (~0U) +#define VK_REMAINING_ARRAY_LAYERS (~0U) +#define VK_WHOLE_SIZE (~0ULL) +#define VK_ATTACHMENT_UNUSED (~0U) +#define VK_TRUE 1 +#define VK_FALSE 0 +#define VK_QUEUE_FAMILY_IGNORED (~0U) +#define VK_SUBPASS_EXTERNAL (~0U) +#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 +#define VK_UUID_SIZE 16 +#define VK_MAX_MEMORY_TYPES 32 +#define VK_MAX_MEMORY_HEAPS 16 +#define VK_MAX_EXTENSION_NAME_SIZE 256 +#define VK_MAX_DESCRIPTION_SIZE 256 + + +typedef enum VkPipelineCacheHeaderVersion { + VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, + VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = (VK_PIPELINE_CACHE_HEADER_VERSION_ONE - VK_PIPELINE_CACHE_HEADER_VERSION_ONE + 1), + VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCacheHeaderVersion; + +typedef enum VkResult { + VK_SUCCESS = 0, + VK_NOT_READY = 1, + VK_TIMEOUT = 2, + VK_EVENT_SET = 3, + VK_EVENT_RESET = 4, + VK_INCOMPLETE = 5, + VK_ERROR_OUT_OF_HOST_MEMORY = -1, + VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, + VK_ERROR_INITIALIZATION_FAILED = -3, + VK_ERROR_DEVICE_LOST = -4, + VK_ERROR_MEMORY_MAP_FAILED = -5, + VK_ERROR_LAYER_NOT_PRESENT = -6, + VK_ERROR_EXTENSION_NOT_PRESENT = -7, + VK_ERROR_FEATURE_NOT_PRESENT = -8, + VK_ERROR_INCOMPATIBLE_DRIVER = -9, + VK_ERROR_TOO_MANY_OBJECTS = -10, + VK_ERROR_FORMAT_NOT_SUPPORTED = -11, + VK_ERROR_FRAGMENTED_POOL = -12, + VK_ERROR_SURFACE_LOST_KHR = -1000000000, + VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, + VK_SUBOPTIMAL_KHR = 1000001003, + VK_ERROR_OUT_OF_DATE_KHR = -1000001004, + VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, + VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, + VK_ERROR_INVALID_SHADER_NV = -1000012000, + VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000, + VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = -1000072003, + VK_RESULT_BEGIN_RANGE = VK_ERROR_FRAGMENTED_POOL, + VK_RESULT_END_RANGE = VK_INCOMPLETE, + VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FRAGMENTED_POOL + 1), + VK_RESULT_MAX_ENUM = 0x7FFFFFFF +} VkResult; + +typedef enum VkStructureType { + VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, + VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, + VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, + VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, + VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, + VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, + VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, + VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, + VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, + VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, + VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, + VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, + VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, + VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, + VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, + VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, + VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, + VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, + VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, + VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, + VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, + VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, + VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, + VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, + VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, + VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, + VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, + VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, + VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, + VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, + VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, + VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, + VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000, + VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, + VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, + VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, + VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, + VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHX = 1000053000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHX = 1000053001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHX = 1000053002, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001, + VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = 1000059000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = 1000059001, + VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = 1000059002, + VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = 1000059004, + VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000059005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = 1000059006, + VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHX = 1000060000, + VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX = 1000060001, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX = 1000060002, + VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHX = 1000060003, + VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHX = 1000060004, + VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHX = 1000060005, + VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHX = 1000060006, + VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHX = 1000060007, + VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHX = 1000060008, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHX = 1000060009, + VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHX = 1000060010, + VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHX = 1000060011, + VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHX = 1000060012, + VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, + VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX = 1000070000, + VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHX = 1000070001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = 1000071000, + VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = 1000071001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = 1000071002, + VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = 1000071003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = 1000071004, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = 1000072000, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = 1000072001, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = 1000072002, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, + VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, + VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000, + VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001, + VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002, + VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = 1000076000, + VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = 1000076001, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = 1000077000, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001, + VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = 1000083000, + VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, + VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = 1000085000, + VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000, + VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001, + VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002, + VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = 1000086003, + VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004, + VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000, + VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000, + VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001, + VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002, + VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = 1000091003, + VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = 1000097000, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, + VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, + VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, + VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = 1000112000, + VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = 1000112001, + VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = 1000113000, + VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, + VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, + VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002, + VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000, + VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, + VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000, + VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, + VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = 1000130000, + VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = 1000130001, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146000, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146001, + VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146002, + VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = 1000146003, + VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = 1000146004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, + VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO, + VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO, + VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), + VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkStructureType; + +typedef enum VkSystemAllocationScope { + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, + VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, + VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, + VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_COMMAND, + VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE, + VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = (VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND + 1), + VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF +} VkSystemAllocationScope; + +typedef enum VkInternalAllocationType { + VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, + VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = (VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE + 1), + VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkInternalAllocationType; + +typedef enum VkFormat { + VK_FORMAT_UNDEFINED = 0, + VK_FORMAT_R4G4_UNORM_PACK8 = 1, + VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, + VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, + VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, + VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, + VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, + VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, + VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, + VK_FORMAT_R8_UNORM = 9, + VK_FORMAT_R8_SNORM = 10, + VK_FORMAT_R8_USCALED = 11, + VK_FORMAT_R8_SSCALED = 12, + VK_FORMAT_R8_UINT = 13, + VK_FORMAT_R8_SINT = 14, + VK_FORMAT_R8_SRGB = 15, + VK_FORMAT_R8G8_UNORM = 16, + VK_FORMAT_R8G8_SNORM = 17, + VK_FORMAT_R8G8_USCALED = 18, + VK_FORMAT_R8G8_SSCALED = 19, + VK_FORMAT_R8G8_UINT = 20, + VK_FORMAT_R8G8_SINT = 21, + VK_FORMAT_R8G8_SRGB = 22, + VK_FORMAT_R8G8B8_UNORM = 23, + VK_FORMAT_R8G8B8_SNORM = 24, + VK_FORMAT_R8G8B8_USCALED = 25, + VK_FORMAT_R8G8B8_SSCALED = 26, + VK_FORMAT_R8G8B8_UINT = 27, + VK_FORMAT_R8G8B8_SINT = 28, + VK_FORMAT_R8G8B8_SRGB = 29, + VK_FORMAT_B8G8R8_UNORM = 30, + VK_FORMAT_B8G8R8_SNORM = 31, + VK_FORMAT_B8G8R8_USCALED = 32, + VK_FORMAT_B8G8R8_SSCALED = 33, + VK_FORMAT_B8G8R8_UINT = 34, + VK_FORMAT_B8G8R8_SINT = 35, + VK_FORMAT_B8G8R8_SRGB = 36, + VK_FORMAT_R8G8B8A8_UNORM = 37, + VK_FORMAT_R8G8B8A8_SNORM = 38, + VK_FORMAT_R8G8B8A8_USCALED = 39, + VK_FORMAT_R8G8B8A8_SSCALED = 40, + VK_FORMAT_R8G8B8A8_UINT = 41, + VK_FORMAT_R8G8B8A8_SINT = 42, + VK_FORMAT_R8G8B8A8_SRGB = 43, + VK_FORMAT_B8G8R8A8_UNORM = 44, + VK_FORMAT_B8G8R8A8_SNORM = 45, + VK_FORMAT_B8G8R8A8_USCALED = 46, + VK_FORMAT_B8G8R8A8_SSCALED = 47, + VK_FORMAT_B8G8R8A8_UINT = 48, + VK_FORMAT_B8G8R8A8_SINT = 49, + VK_FORMAT_B8G8R8A8_SRGB = 50, + VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, + VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, + VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, + VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, + VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, + VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, + VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, + VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, + VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, + VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, + VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, + VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, + VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, + VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, + VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, + VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, + VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, + VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, + VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, + VK_FORMAT_R16_UNORM = 70, + VK_FORMAT_R16_SNORM = 71, + VK_FORMAT_R16_USCALED = 72, + VK_FORMAT_R16_SSCALED = 73, + VK_FORMAT_R16_UINT = 74, + VK_FORMAT_R16_SINT = 75, + VK_FORMAT_R16_SFLOAT = 76, + VK_FORMAT_R16G16_UNORM = 77, + VK_FORMAT_R16G16_SNORM = 78, + VK_FORMAT_R16G16_USCALED = 79, + VK_FORMAT_R16G16_SSCALED = 80, + VK_FORMAT_R16G16_UINT = 81, + VK_FORMAT_R16G16_SINT = 82, + VK_FORMAT_R16G16_SFLOAT = 83, + VK_FORMAT_R16G16B16_UNORM = 84, + VK_FORMAT_R16G16B16_SNORM = 85, + VK_FORMAT_R16G16B16_USCALED = 86, + VK_FORMAT_R16G16B16_SSCALED = 87, + VK_FORMAT_R16G16B16_UINT = 88, + VK_FORMAT_R16G16B16_SINT = 89, + VK_FORMAT_R16G16B16_SFLOAT = 90, + VK_FORMAT_R16G16B16A16_UNORM = 91, + VK_FORMAT_R16G16B16A16_SNORM = 92, + VK_FORMAT_R16G16B16A16_USCALED = 93, + VK_FORMAT_R16G16B16A16_SSCALED = 94, + VK_FORMAT_R16G16B16A16_UINT = 95, + VK_FORMAT_R16G16B16A16_SINT = 96, + VK_FORMAT_R16G16B16A16_SFLOAT = 97, + VK_FORMAT_R32_UINT = 98, + VK_FORMAT_R32_SINT = 99, + VK_FORMAT_R32_SFLOAT = 100, + VK_FORMAT_R32G32_UINT = 101, + VK_FORMAT_R32G32_SINT = 102, + VK_FORMAT_R32G32_SFLOAT = 103, + VK_FORMAT_R32G32B32_UINT = 104, + VK_FORMAT_R32G32B32_SINT = 105, + VK_FORMAT_R32G32B32_SFLOAT = 106, + VK_FORMAT_R32G32B32A32_UINT = 107, + VK_FORMAT_R32G32B32A32_SINT = 108, + VK_FORMAT_R32G32B32A32_SFLOAT = 109, + VK_FORMAT_R64_UINT = 110, + VK_FORMAT_R64_SINT = 111, + VK_FORMAT_R64_SFLOAT = 112, + VK_FORMAT_R64G64_UINT = 113, + VK_FORMAT_R64G64_SINT = 114, + VK_FORMAT_R64G64_SFLOAT = 115, + VK_FORMAT_R64G64B64_UINT = 116, + VK_FORMAT_R64G64B64_SINT = 117, + VK_FORMAT_R64G64B64_SFLOAT = 118, + VK_FORMAT_R64G64B64A64_UINT = 119, + VK_FORMAT_R64G64B64A64_SINT = 120, + VK_FORMAT_R64G64B64A64_SFLOAT = 121, + VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, + VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, + VK_FORMAT_D16_UNORM = 124, + VK_FORMAT_X8_D24_UNORM_PACK32 = 125, + VK_FORMAT_D32_SFLOAT = 126, + VK_FORMAT_S8_UINT = 127, + VK_FORMAT_D16_UNORM_S8_UINT = 128, + VK_FORMAT_D24_UNORM_S8_UINT = 129, + VK_FORMAT_D32_SFLOAT_S8_UINT = 130, + VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, + VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, + VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, + VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, + VK_FORMAT_BC2_UNORM_BLOCK = 135, + VK_FORMAT_BC2_SRGB_BLOCK = 136, + VK_FORMAT_BC3_UNORM_BLOCK = 137, + VK_FORMAT_BC3_SRGB_BLOCK = 138, + VK_FORMAT_BC4_UNORM_BLOCK = 139, + VK_FORMAT_BC4_SNORM_BLOCK = 140, + VK_FORMAT_BC5_UNORM_BLOCK = 141, + VK_FORMAT_BC5_SNORM_BLOCK = 142, + VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, + VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, + VK_FORMAT_BC7_UNORM_BLOCK = 145, + VK_FORMAT_BC7_SRGB_BLOCK = 146, + VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, + VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, + VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, + VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, + VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, + VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, + VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, + VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, + VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, + VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, + VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, + VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, + VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, + VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, + VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, + VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, + VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, + VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, + VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, + VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, + VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, + VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, + VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, + VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, + VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, + VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, + VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, + VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, + VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, + VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, + VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, + VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, + VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, + VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, + VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, + VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, + VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, + VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, + VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, + VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, + VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, + VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, + VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, + VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, + VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, + VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, + VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED, + VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK, + VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1), + VK_FORMAT_MAX_ENUM = 0x7FFFFFFF +} VkFormat; + +typedef enum VkImageType { + VK_IMAGE_TYPE_1D = 0, + VK_IMAGE_TYPE_2D = 1, + VK_IMAGE_TYPE_3D = 2, + VK_IMAGE_TYPE_BEGIN_RANGE = VK_IMAGE_TYPE_1D, + VK_IMAGE_TYPE_END_RANGE = VK_IMAGE_TYPE_3D, + VK_IMAGE_TYPE_RANGE_SIZE = (VK_IMAGE_TYPE_3D - VK_IMAGE_TYPE_1D + 1), + VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageType; + +typedef enum VkImageTiling { + VK_IMAGE_TILING_OPTIMAL = 0, + VK_IMAGE_TILING_LINEAR = 1, + VK_IMAGE_TILING_BEGIN_RANGE = VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_TILING_END_RANGE = VK_IMAGE_TILING_LINEAR, + VK_IMAGE_TILING_RANGE_SIZE = (VK_IMAGE_TILING_LINEAR - VK_IMAGE_TILING_OPTIMAL + 1), + VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF +} VkImageTiling; + +typedef enum VkPhysicalDeviceType { + VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, + VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, + VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, + VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, + VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = VK_PHYSICAL_DEVICE_TYPE_OTHER, + VK_PHYSICAL_DEVICE_TYPE_END_RANGE = VK_PHYSICAL_DEVICE_TYPE_CPU, + VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = (VK_PHYSICAL_DEVICE_TYPE_CPU - VK_PHYSICAL_DEVICE_TYPE_OTHER + 1), + VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkPhysicalDeviceType; + +typedef enum VkQueryType { + VK_QUERY_TYPE_OCCLUSION = 0, + VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, + VK_QUERY_TYPE_TIMESTAMP = 2, + VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION, + VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_TIMESTAMP, + VK_QUERY_TYPE_RANGE_SIZE = (VK_QUERY_TYPE_TIMESTAMP - VK_QUERY_TYPE_OCCLUSION + 1), + VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkQueryType; + +typedef enum VkSharingMode { + VK_SHARING_MODE_EXCLUSIVE = 0, + VK_SHARING_MODE_CONCURRENT = 1, + VK_SHARING_MODE_BEGIN_RANGE = VK_SHARING_MODE_EXCLUSIVE, + VK_SHARING_MODE_END_RANGE = VK_SHARING_MODE_CONCURRENT, + VK_SHARING_MODE_RANGE_SIZE = (VK_SHARING_MODE_CONCURRENT - VK_SHARING_MODE_EXCLUSIVE + 1), + VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSharingMode; + +typedef enum VkImageLayout { + VK_IMAGE_LAYOUT_UNDEFINED = 0, + VK_IMAGE_LAYOUT_GENERAL = 1, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, + VK_IMAGE_LAYOUT_PREINITIALIZED = 8, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, + VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_END_RANGE = VK_IMAGE_LAYOUT_PREINITIALIZED, + VK_IMAGE_LAYOUT_RANGE_SIZE = (VK_IMAGE_LAYOUT_PREINITIALIZED - VK_IMAGE_LAYOUT_UNDEFINED + 1), + VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF +} VkImageLayout; + +typedef enum VkImageViewType { + VK_IMAGE_VIEW_TYPE_1D = 0, + VK_IMAGE_VIEW_TYPE_2D = 1, + VK_IMAGE_VIEW_TYPE_3D = 2, + VK_IMAGE_VIEW_TYPE_CUBE = 3, + VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, + VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, + VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + VK_IMAGE_VIEW_TYPE_BEGIN_RANGE = VK_IMAGE_VIEW_TYPE_1D, + VK_IMAGE_VIEW_TYPE_END_RANGE = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, + VK_IMAGE_VIEW_TYPE_RANGE_SIZE = (VK_IMAGE_VIEW_TYPE_CUBE_ARRAY - VK_IMAGE_VIEW_TYPE_1D + 1), + VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageViewType; + +typedef enum VkComponentSwizzle { + VK_COMPONENT_SWIZZLE_IDENTITY = 0, + VK_COMPONENT_SWIZZLE_ZERO = 1, + VK_COMPONENT_SWIZZLE_ONE = 2, + VK_COMPONENT_SWIZZLE_R = 3, + VK_COMPONENT_SWIZZLE_G = 4, + VK_COMPONENT_SWIZZLE_B = 5, + VK_COMPONENT_SWIZZLE_A = 6, + VK_COMPONENT_SWIZZLE_BEGIN_RANGE = VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_END_RANGE = VK_COMPONENT_SWIZZLE_A, + VK_COMPONENT_SWIZZLE_RANGE_SIZE = (VK_COMPONENT_SWIZZLE_A - VK_COMPONENT_SWIZZLE_IDENTITY + 1), + VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF +} VkComponentSwizzle; + +typedef enum VkVertexInputRate { + VK_VERTEX_INPUT_RATE_VERTEX = 0, + VK_VERTEX_INPUT_RATE_INSTANCE = 1, + VK_VERTEX_INPUT_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_RATE_VERTEX, + VK_VERTEX_INPUT_RATE_END_RANGE = VK_VERTEX_INPUT_RATE_INSTANCE, + VK_VERTEX_INPUT_RATE_RANGE_SIZE = (VK_VERTEX_INPUT_RATE_INSTANCE - VK_VERTEX_INPUT_RATE_VERTEX + 1), + VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF +} VkVertexInputRate; + +typedef enum VkPrimitiveTopology { + VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, + VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE = VK_PRIMITIVE_TOPOLOGY_POINT_LIST, + VK_PRIMITIVE_TOPOLOGY_END_RANGE = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, + VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = (VK_PRIMITIVE_TOPOLOGY_PATCH_LIST - VK_PRIMITIVE_TOPOLOGY_POINT_LIST + 1), + VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF +} VkPrimitiveTopology; + +typedef enum VkPolygonMode { + VK_POLYGON_MODE_FILL = 0, + VK_POLYGON_MODE_LINE = 1, + VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, + VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL, + VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT, + VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1), + VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF +} VkPolygonMode; + +typedef enum VkFrontFace { + VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, + VK_FRONT_FACE_CLOCKWISE = 1, + VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_COUNTER_CLOCKWISE, + VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CLOCKWISE, + VK_FRONT_FACE_RANGE_SIZE = (VK_FRONT_FACE_CLOCKWISE - VK_FRONT_FACE_COUNTER_CLOCKWISE + 1), + VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF +} VkFrontFace; + +typedef enum VkCompareOp { + VK_COMPARE_OP_NEVER = 0, + VK_COMPARE_OP_LESS = 1, + VK_COMPARE_OP_EQUAL = 2, + VK_COMPARE_OP_LESS_OR_EQUAL = 3, + VK_COMPARE_OP_GREATER = 4, + VK_COMPARE_OP_NOT_EQUAL = 5, + VK_COMPARE_OP_GREATER_OR_EQUAL = 6, + VK_COMPARE_OP_ALWAYS = 7, + VK_COMPARE_OP_BEGIN_RANGE = VK_COMPARE_OP_NEVER, + VK_COMPARE_OP_END_RANGE = VK_COMPARE_OP_ALWAYS, + VK_COMPARE_OP_RANGE_SIZE = (VK_COMPARE_OP_ALWAYS - VK_COMPARE_OP_NEVER + 1), + VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF +} VkCompareOp; + +typedef enum VkStencilOp { + VK_STENCIL_OP_KEEP = 0, + VK_STENCIL_OP_ZERO = 1, + VK_STENCIL_OP_REPLACE = 2, + VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, + VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, + VK_STENCIL_OP_INVERT = 5, + VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, + VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, + VK_STENCIL_OP_BEGIN_RANGE = VK_STENCIL_OP_KEEP, + VK_STENCIL_OP_END_RANGE = VK_STENCIL_OP_DECREMENT_AND_WRAP, + VK_STENCIL_OP_RANGE_SIZE = (VK_STENCIL_OP_DECREMENT_AND_WRAP - VK_STENCIL_OP_KEEP + 1), + VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF +} VkStencilOp; + +typedef enum VkLogicOp { + VK_LOGIC_OP_CLEAR = 0, + VK_LOGIC_OP_AND = 1, + VK_LOGIC_OP_AND_REVERSE = 2, + VK_LOGIC_OP_COPY = 3, + VK_LOGIC_OP_AND_INVERTED = 4, + VK_LOGIC_OP_NO_OP = 5, + VK_LOGIC_OP_XOR = 6, + VK_LOGIC_OP_OR = 7, + VK_LOGIC_OP_NOR = 8, + VK_LOGIC_OP_EQUIVALENT = 9, + VK_LOGIC_OP_INVERT = 10, + VK_LOGIC_OP_OR_REVERSE = 11, + VK_LOGIC_OP_COPY_INVERTED = 12, + VK_LOGIC_OP_OR_INVERTED = 13, + VK_LOGIC_OP_NAND = 14, + VK_LOGIC_OP_SET = 15, + VK_LOGIC_OP_BEGIN_RANGE = VK_LOGIC_OP_CLEAR, + VK_LOGIC_OP_END_RANGE = VK_LOGIC_OP_SET, + VK_LOGIC_OP_RANGE_SIZE = (VK_LOGIC_OP_SET - VK_LOGIC_OP_CLEAR + 1), + VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF +} VkLogicOp; + +typedef enum VkBlendFactor { + VK_BLEND_FACTOR_ZERO = 0, + VK_BLEND_FACTOR_ONE = 1, + VK_BLEND_FACTOR_SRC_COLOR = 2, + VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, + VK_BLEND_FACTOR_DST_COLOR = 4, + VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, + VK_BLEND_FACTOR_SRC_ALPHA = 6, + VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, + VK_BLEND_FACTOR_DST_ALPHA = 8, + VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, + VK_BLEND_FACTOR_CONSTANT_COLOR = 10, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, + VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, + VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, + VK_BLEND_FACTOR_SRC1_COLOR = 15, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, + VK_BLEND_FACTOR_SRC1_ALPHA = 17, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, + VK_BLEND_FACTOR_BEGIN_RANGE = VK_BLEND_FACTOR_ZERO, + VK_BLEND_FACTOR_END_RANGE = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA, + VK_BLEND_FACTOR_RANGE_SIZE = (VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA - VK_BLEND_FACTOR_ZERO + 1), + VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF +} VkBlendFactor; + +typedef enum VkBlendOp { + VK_BLEND_OP_ADD = 0, + VK_BLEND_OP_SUBTRACT = 1, + VK_BLEND_OP_REVERSE_SUBTRACT = 2, + VK_BLEND_OP_MIN = 3, + VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_ZERO_EXT = 1000148000, + VK_BLEND_OP_SRC_EXT = 1000148001, + VK_BLEND_OP_DST_EXT = 1000148002, + VK_BLEND_OP_SRC_OVER_EXT = 1000148003, + VK_BLEND_OP_DST_OVER_EXT = 1000148004, + VK_BLEND_OP_SRC_IN_EXT = 1000148005, + VK_BLEND_OP_DST_IN_EXT = 1000148006, + VK_BLEND_OP_SRC_OUT_EXT = 1000148007, + VK_BLEND_OP_DST_OUT_EXT = 1000148008, + VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, + VK_BLEND_OP_DST_ATOP_EXT = 1000148010, + VK_BLEND_OP_XOR_EXT = 1000148011, + VK_BLEND_OP_MULTIPLY_EXT = 1000148012, + VK_BLEND_OP_SCREEN_EXT = 1000148013, + VK_BLEND_OP_OVERLAY_EXT = 1000148014, + VK_BLEND_OP_DARKEN_EXT = 1000148015, + VK_BLEND_OP_LIGHTEN_EXT = 1000148016, + VK_BLEND_OP_COLORDODGE_EXT = 1000148017, + VK_BLEND_OP_COLORBURN_EXT = 1000148018, + VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, + VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, + VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, + VK_BLEND_OP_EXCLUSION_EXT = 1000148022, + VK_BLEND_OP_INVERT_EXT = 1000148023, + VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, + VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, + VK_BLEND_OP_LINEARBURN_EXT = 1000148026, + VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, + VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, + VK_BLEND_OP_PINLIGHT_EXT = 1000148029, + VK_BLEND_OP_HARDMIX_EXT = 1000148030, + VK_BLEND_OP_HSL_HUE_EXT = 1000148031, + VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, + VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, + VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, + VK_BLEND_OP_PLUS_EXT = 1000148035, + VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, + VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, + VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, + VK_BLEND_OP_MINUS_EXT = 1000148039, + VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, + VK_BLEND_OP_CONTRAST_EXT = 1000148041, + VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, + VK_BLEND_OP_RED_EXT = 1000148043, + VK_BLEND_OP_GREEN_EXT = 1000148044, + VK_BLEND_OP_BLUE_EXT = 1000148045, + VK_BLEND_OP_BEGIN_RANGE = VK_BLEND_OP_ADD, + VK_BLEND_OP_END_RANGE = VK_BLEND_OP_MAX, + VK_BLEND_OP_RANGE_SIZE = (VK_BLEND_OP_MAX - VK_BLEND_OP_ADD + 1), + VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF +} VkBlendOp; + +typedef enum VkDynamicState { + VK_DYNAMIC_STATE_VIEWPORT = 0, + VK_DYNAMIC_STATE_SCISSOR = 1, + VK_DYNAMIC_STATE_LINE_WIDTH = 2, + VK_DYNAMIC_STATE_DEPTH_BIAS = 3, + VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, + VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, + VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, + VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, + VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, + VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, + VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, + VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE, + VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1), + VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF +} VkDynamicState; + +typedef enum VkFilter { + VK_FILTER_NEAREST = 0, + VK_FILTER_LINEAR = 1, + VK_FILTER_CUBIC_IMG = 1000015000, + VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST, + VK_FILTER_END_RANGE = VK_FILTER_LINEAR, + VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1), + VK_FILTER_MAX_ENUM = 0x7FFFFFFF +} VkFilter; + +typedef enum VkSamplerMipmapMode { + VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, + VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, + VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = VK_SAMPLER_MIPMAP_MODE_NEAREST, + VK_SAMPLER_MIPMAP_MODE_END_RANGE = VK_SAMPLER_MIPMAP_MODE_LINEAR, + VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = (VK_SAMPLER_MIPMAP_MODE_LINEAR - VK_SAMPLER_MIPMAP_MODE_NEAREST + 1), + VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerMipmapMode; + +typedef enum VkSamplerAddressMode { + VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, + VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT, + VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1), + VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerAddressMode; + +typedef enum VkBorderColor { + VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, + VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, + VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, + VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, + VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, + VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, + VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_INT_OPAQUE_WHITE, + VK_BORDER_COLOR_RANGE_SIZE = (VK_BORDER_COLOR_INT_OPAQUE_WHITE - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK + 1), + VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF +} VkBorderColor; + +typedef enum VkDescriptorType { + VK_DESCRIPTOR_TYPE_SAMPLER = 0, + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, + VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, + VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, + VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + VK_DESCRIPTOR_TYPE_BEGIN_RANGE = VK_DESCRIPTOR_TYPE_SAMPLER, + VK_DESCRIPTOR_TYPE_END_RANGE = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, + VK_DESCRIPTOR_TYPE_RANGE_SIZE = (VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT - VK_DESCRIPTOR_TYPE_SAMPLER + 1), + VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorType; + +typedef enum VkAttachmentLoadOp { + VK_ATTACHMENT_LOAD_OP_LOAD = 0, + VK_ATTACHMENT_LOAD_OP_CLEAR = 1, + VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE = VK_ATTACHMENT_LOAD_OP_LOAD, + VK_ATTACHMENT_LOAD_OP_END_RANGE = VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = (VK_ATTACHMENT_LOAD_OP_DONT_CARE - VK_ATTACHMENT_LOAD_OP_LOAD + 1), + VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentLoadOp; + +typedef enum VkAttachmentStoreOp { + VK_ATTACHMENT_STORE_OP_STORE = 0, + VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + VK_ATTACHMENT_STORE_OP_BEGIN_RANGE = VK_ATTACHMENT_STORE_OP_STORE, + VK_ATTACHMENT_STORE_OP_END_RANGE = VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_RANGE_SIZE = (VK_ATTACHMENT_STORE_OP_DONT_CARE - VK_ATTACHMENT_STORE_OP_STORE + 1), + VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentStoreOp; + +typedef enum VkPipelineBindPoint { + VK_PIPELINE_BIND_POINT_GRAPHICS = 0, + VK_PIPELINE_BIND_POINT_COMPUTE = 1, + VK_PIPELINE_BIND_POINT_BEGIN_RANGE = VK_PIPELINE_BIND_POINT_GRAPHICS, + VK_PIPELINE_BIND_POINT_END_RANGE = VK_PIPELINE_BIND_POINT_COMPUTE, + VK_PIPELINE_BIND_POINT_RANGE_SIZE = (VK_PIPELINE_BIND_POINT_COMPUTE - VK_PIPELINE_BIND_POINT_GRAPHICS + 1), + VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF +} VkPipelineBindPoint; + +typedef enum VkCommandBufferLevel { + VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, + VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, + VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE = VK_COMMAND_BUFFER_LEVEL_PRIMARY, + VK_COMMAND_BUFFER_LEVEL_END_RANGE = VK_COMMAND_BUFFER_LEVEL_SECONDARY, + VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = (VK_COMMAND_BUFFER_LEVEL_SECONDARY - VK_COMMAND_BUFFER_LEVEL_PRIMARY + 1), + VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferLevel; + +typedef enum VkIndexType { + VK_INDEX_TYPE_UINT16 = 0, + VK_INDEX_TYPE_UINT32 = 1, + VK_INDEX_TYPE_BEGIN_RANGE = VK_INDEX_TYPE_UINT16, + VK_INDEX_TYPE_END_RANGE = VK_INDEX_TYPE_UINT32, + VK_INDEX_TYPE_RANGE_SIZE = (VK_INDEX_TYPE_UINT32 - VK_INDEX_TYPE_UINT16 + 1), + VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkIndexType; + +typedef enum VkSubpassContents { + VK_SUBPASS_CONTENTS_INLINE = 0, + VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_BEGIN_RANGE = VK_SUBPASS_CONTENTS_INLINE, + VK_SUBPASS_CONTENTS_END_RANGE = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS, + VK_SUBPASS_CONTENTS_RANGE_SIZE = (VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS - VK_SUBPASS_CONTENTS_INLINE + 1), + VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF +} VkSubpassContents; + +typedef enum VkObjectType { + VK_OBJECT_TYPE_UNKNOWN = 0, + VK_OBJECT_TYPE_INSTANCE = 1, + VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, + VK_OBJECT_TYPE_DEVICE = 3, + VK_OBJECT_TYPE_QUEUE = 4, + VK_OBJECT_TYPE_SEMAPHORE = 5, + VK_OBJECT_TYPE_COMMAND_BUFFER = 6, + VK_OBJECT_TYPE_FENCE = 7, + VK_OBJECT_TYPE_DEVICE_MEMORY = 8, + VK_OBJECT_TYPE_BUFFER = 9, + VK_OBJECT_TYPE_IMAGE = 10, + VK_OBJECT_TYPE_EVENT = 11, + VK_OBJECT_TYPE_QUERY_POOL = 12, + VK_OBJECT_TYPE_BUFFER_VIEW = 13, + VK_OBJECT_TYPE_IMAGE_VIEW = 14, + VK_OBJECT_TYPE_SHADER_MODULE = 15, + VK_OBJECT_TYPE_PIPELINE_CACHE = 16, + VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, + VK_OBJECT_TYPE_RENDER_PASS = 18, + VK_OBJECT_TYPE_PIPELINE = 19, + VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, + VK_OBJECT_TYPE_SAMPLER = 21, + VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, + VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, + VK_OBJECT_TYPE_FRAMEBUFFER = 24, + VK_OBJECT_TYPE_COMMAND_POOL = 25, + VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, + VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, + VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, + VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000, + VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000, + VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001, + VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_UNKNOWN, + VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_COMMAND_POOL, + VK_OBJECT_TYPE_RANGE_SIZE = (VK_OBJECT_TYPE_COMMAND_POOL - VK_OBJECT_TYPE_UNKNOWN + 1), + VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkObjectType; + +typedef VkFlags VkInstanceCreateFlags; + +typedef enum VkFormatFeatureFlagBits { + VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, + VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, + VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, + VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, + VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, + VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, + VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, + VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, + VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, + VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = 0x00010000, + VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFormatFeatureFlagBits; +typedef VkFlags VkFormatFeatureFlags; + +typedef enum VkImageUsageFlagBits { + VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, + VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, + VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, + VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, + VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, + VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, + VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageUsageFlagBits; +typedef VkFlags VkImageUsageFlags; + +typedef enum VkImageCreateFlagBits { + VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, + VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, + VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, + VK_IMAGE_CREATE_BIND_SFR_BIT_KHX = 0x00000040, + VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = 0x00000020, + VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageCreateFlagBits; +typedef VkFlags VkImageCreateFlags; + +typedef enum VkSampleCountFlagBits { + VK_SAMPLE_COUNT_1_BIT = 0x00000001, + VK_SAMPLE_COUNT_2_BIT = 0x00000002, + VK_SAMPLE_COUNT_4_BIT = 0x00000004, + VK_SAMPLE_COUNT_8_BIT = 0x00000008, + VK_SAMPLE_COUNT_16_BIT = 0x00000010, + VK_SAMPLE_COUNT_32_BIT = 0x00000020, + VK_SAMPLE_COUNT_64_BIT = 0x00000040, + VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSampleCountFlagBits; +typedef VkFlags VkSampleCountFlags; + +typedef enum VkQueueFlagBits { + VK_QUEUE_GRAPHICS_BIT = 0x00000001, + VK_QUEUE_COMPUTE_BIT = 0x00000002, + VK_QUEUE_TRANSFER_BIT = 0x00000004, + VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, + VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueueFlagBits; +typedef VkFlags VkQueueFlags; + +typedef enum VkMemoryPropertyFlagBits { + VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001, + VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002, + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, + VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, + VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, + VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkMemoryPropertyFlagBits; +typedef VkFlags VkMemoryPropertyFlags; + +typedef enum VkMemoryHeapFlagBits { + VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, + VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHX = 0x00000002, + VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkMemoryHeapFlagBits; +typedef VkFlags VkMemoryHeapFlags; +typedef VkFlags VkDeviceCreateFlags; +typedef VkFlags VkDeviceQueueCreateFlags; + +typedef enum VkPipelineStageFlagBits { + VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, + VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, + VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, + VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, + VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, + VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, + VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, + VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, + VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, + VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, + VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000, + VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, + VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, + VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX = 0x00020000, + VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineStageFlagBits; +typedef VkFlags VkPipelineStageFlags; +typedef VkFlags VkMemoryMapFlags; + +typedef enum VkImageAspectFlagBits { + VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, + VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, + VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, + VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, + VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageAspectFlagBits; +typedef VkFlags VkImageAspectFlags; + +typedef enum VkSparseImageFormatFlagBits { + VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, + VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, + VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, + VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSparseImageFormatFlagBits; +typedef VkFlags VkSparseImageFormatFlags; + +typedef enum VkSparseMemoryBindFlagBits { + VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, + VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSparseMemoryBindFlagBits; +typedef VkFlags VkSparseMemoryBindFlags; + +typedef enum VkFenceCreateFlagBits { + VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, + VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFenceCreateFlagBits; +typedef VkFlags VkFenceCreateFlags; +typedef VkFlags VkSemaphoreCreateFlags; +typedef VkFlags VkEventCreateFlags; +typedef VkFlags VkQueryPoolCreateFlags; + +typedef enum VkQueryPipelineStatisticFlagBits { + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, + VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, + VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, + VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, + VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryPipelineStatisticFlagBits; +typedef VkFlags VkQueryPipelineStatisticFlags; + +typedef enum VkQueryResultFlagBits { + VK_QUERY_RESULT_64_BIT = 0x00000001, + VK_QUERY_RESULT_WAIT_BIT = 0x00000002, + VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, + VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, + VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryResultFlagBits; +typedef VkFlags VkQueryResultFlags; + +typedef enum VkBufferCreateFlagBits { + VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, + VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkBufferCreateFlagBits; +typedef VkFlags VkBufferCreateFlags; + +typedef enum VkBufferUsageFlagBits { + VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, + VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, + VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, + VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, + VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, + VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, + VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkBufferUsageFlagBits; +typedef VkFlags VkBufferUsageFlags; +typedef VkFlags VkBufferViewCreateFlags; +typedef VkFlags VkImageViewCreateFlags; +typedef VkFlags VkShaderModuleCreateFlags; +typedef VkFlags VkPipelineCacheCreateFlags; + +typedef enum VkPipelineCreateFlagBits { + VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, + VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, + VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, + VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHX = 0x00000008, + VK_PIPELINE_CREATE_DISPATCH_BASE_KHX = 0x00000010, + VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCreateFlagBits; +typedef VkFlags VkPipelineCreateFlags; +typedef VkFlags VkPipelineShaderStageCreateFlags; + +typedef enum VkShaderStageFlagBits { + VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, + VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, + VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, + VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, + VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, + VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, + VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, + VK_SHADER_STAGE_ALL = 0x7FFFFFFF, + VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkShaderStageFlagBits; +typedef VkFlags VkPipelineVertexInputStateCreateFlags; +typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; +typedef VkFlags VkPipelineTessellationStateCreateFlags; +typedef VkFlags VkPipelineViewportStateCreateFlags; +typedef VkFlags VkPipelineRasterizationStateCreateFlags; + +typedef enum VkCullModeFlagBits { + VK_CULL_MODE_NONE = 0, + VK_CULL_MODE_FRONT_BIT = 0x00000001, + VK_CULL_MODE_BACK_BIT = 0x00000002, + VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, + VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCullModeFlagBits; +typedef VkFlags VkCullModeFlags; +typedef VkFlags VkPipelineMultisampleStateCreateFlags; +typedef VkFlags VkPipelineDepthStencilStateCreateFlags; +typedef VkFlags VkPipelineColorBlendStateCreateFlags; + +typedef enum VkColorComponentFlagBits { + VK_COLOR_COMPONENT_R_BIT = 0x00000001, + VK_COLOR_COMPONENT_G_BIT = 0x00000002, + VK_COLOR_COMPONENT_B_BIT = 0x00000004, + VK_COLOR_COMPONENT_A_BIT = 0x00000008, + VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkColorComponentFlagBits; +typedef VkFlags VkColorComponentFlags; +typedef VkFlags VkPipelineDynamicStateCreateFlags; +typedef VkFlags VkPipelineLayoutCreateFlags; +typedef VkFlags VkShaderStageFlags; +typedef VkFlags VkSamplerCreateFlags; + +typedef enum VkDescriptorSetLayoutCreateFlagBits { + VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorSetLayoutCreateFlagBits; +typedef VkFlags VkDescriptorSetLayoutCreateFlags; + +typedef enum VkDescriptorPoolCreateFlagBits { + VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, + VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorPoolCreateFlagBits; +typedef VkFlags VkDescriptorPoolCreateFlags; +typedef VkFlags VkDescriptorPoolResetFlags; +typedef VkFlags VkFramebufferCreateFlags; +typedef VkFlags VkRenderPassCreateFlags; + +typedef enum VkAttachmentDescriptionFlagBits { + VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, + VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentDescriptionFlagBits; +typedef VkFlags VkAttachmentDescriptionFlags; + +typedef enum VkSubpassDescriptionFlagBits { + VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = 0x00000001, + VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = 0x00000002, + VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSubpassDescriptionFlagBits; +typedef VkFlags VkSubpassDescriptionFlags; + +typedef enum VkAccessFlagBits { + VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001, + VK_ACCESS_INDEX_READ_BIT = 0x00000002, + VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004, + VK_ACCESS_UNIFORM_READ_BIT = 0x00000008, + VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010, + VK_ACCESS_SHADER_READ_BIT = 0x00000020, + VK_ACCESS_SHADER_WRITE_BIT = 0x00000040, + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080, + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400, + VK_ACCESS_TRANSFER_READ_BIT = 0x00000800, + VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000, + VK_ACCESS_HOST_READ_BIT = 0x00002000, + VK_ACCESS_HOST_WRITE_BIT = 0x00004000, + VK_ACCESS_MEMORY_READ_BIT = 0x00008000, + VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, + VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 0x00020000, + VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 0x00040000, + VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000, + VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkAccessFlagBits; +typedef VkFlags VkAccessFlags; + +typedef enum VkDependencyFlagBits { + VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, + VK_DEPENDENCY_VIEW_LOCAL_BIT_KHX = 0x00000002, + VK_DEPENDENCY_DEVICE_GROUP_BIT_KHX = 0x00000004, + VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDependencyFlagBits; +typedef VkFlags VkDependencyFlags; + +typedef enum VkCommandPoolCreateFlagBits { + VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, + VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, + VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandPoolCreateFlagBits; +typedef VkFlags VkCommandPoolCreateFlags; + +typedef enum VkCommandPoolResetFlagBits { + VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, + VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandPoolResetFlagBits; +typedef VkFlags VkCommandPoolResetFlags; + +typedef enum VkCommandBufferUsageFlagBits { + VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, + VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, + VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, + VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferUsageFlagBits; +typedef VkFlags VkCommandBufferUsageFlags; + +typedef enum VkQueryControlFlagBits { + VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, + VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryControlFlagBits; +typedef VkFlags VkQueryControlFlags; + +typedef enum VkCommandBufferResetFlagBits { + VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, + VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferResetFlagBits; +typedef VkFlags VkCommandBufferResetFlags; + +typedef enum VkStencilFaceFlagBits { + VK_STENCIL_FACE_FRONT_BIT = 0x00000001, + VK_STENCIL_FACE_BACK_BIT = 0x00000002, + VK_STENCIL_FRONT_AND_BACK = 0x00000003, + VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkStencilFaceFlagBits; +typedef VkFlags VkStencilFaceFlags; + +typedef struct VkApplicationInfo { + VkStructureType sType; + const void* pNext; + const char* pApplicationName; + uint32_t applicationVersion; + const char* pEngineName; + uint32_t engineVersion; + uint32_t apiVersion; +} VkApplicationInfo; + +typedef struct VkInstanceCreateInfo { + VkStructureType sType; + const void* pNext; + VkInstanceCreateFlags flags; + const VkApplicationInfo* pApplicationInfo; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; +} VkInstanceCreateInfo; + +typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( + void* pUserData, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)( + void* pUserData, + void* pOriginal, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkFreeFunction)( + void* pUserData, + void* pMemory); + +typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef struct VkAllocationCallbacks { + void* pUserData; + PFN_vkAllocationFunction pfnAllocation; + PFN_vkReallocationFunction pfnReallocation; + PFN_vkFreeFunction pfnFree; + PFN_vkInternalAllocationNotification pfnInternalAllocation; + PFN_vkInternalFreeNotification pfnInternalFree; +} VkAllocationCallbacks; + +typedef struct VkPhysicalDeviceFeatures { + VkBool32 robustBufferAccess; + VkBool32 fullDrawIndexUint32; + VkBool32 imageCubeArray; + VkBool32 independentBlend; + VkBool32 geometryShader; + VkBool32 tessellationShader; + VkBool32 sampleRateShading; + VkBool32 dualSrcBlend; + VkBool32 logicOp; + VkBool32 multiDrawIndirect; + VkBool32 drawIndirectFirstInstance; + VkBool32 depthClamp; + VkBool32 depthBiasClamp; + VkBool32 fillModeNonSolid; + VkBool32 depthBounds; + VkBool32 wideLines; + VkBool32 largePoints; + VkBool32 alphaToOne; + VkBool32 multiViewport; + VkBool32 samplerAnisotropy; + VkBool32 textureCompressionETC2; + VkBool32 textureCompressionASTC_LDR; + VkBool32 textureCompressionBC; + VkBool32 occlusionQueryPrecise; + VkBool32 pipelineStatisticsQuery; + VkBool32 vertexPipelineStoresAndAtomics; + VkBool32 fragmentStoresAndAtomics; + VkBool32 shaderTessellationAndGeometryPointSize; + VkBool32 shaderImageGatherExtended; + VkBool32 shaderStorageImageExtendedFormats; + VkBool32 shaderStorageImageMultisample; + VkBool32 shaderStorageImageReadWithoutFormat; + VkBool32 shaderStorageImageWriteWithoutFormat; + VkBool32 shaderUniformBufferArrayDynamicIndexing; + VkBool32 shaderSampledImageArrayDynamicIndexing; + VkBool32 shaderStorageBufferArrayDynamicIndexing; + VkBool32 shaderStorageImageArrayDynamicIndexing; + VkBool32 shaderClipDistance; + VkBool32 shaderCullDistance; + VkBool32 shaderFloat64; + VkBool32 shaderInt64; + VkBool32 shaderInt16; + VkBool32 shaderResourceResidency; + VkBool32 shaderResourceMinLod; + VkBool32 sparseBinding; + VkBool32 sparseResidencyBuffer; + VkBool32 sparseResidencyImage2D; + VkBool32 sparseResidencyImage3D; + VkBool32 sparseResidency2Samples; + VkBool32 sparseResidency4Samples; + VkBool32 sparseResidency8Samples; + VkBool32 sparseResidency16Samples; + VkBool32 sparseResidencyAliased; + VkBool32 variableMultisampleRate; + VkBool32 inheritedQueries; +} VkPhysicalDeviceFeatures; + +typedef struct VkFormatProperties { + VkFormatFeatureFlags linearTilingFeatures; + VkFormatFeatureFlags optimalTilingFeatures; + VkFormatFeatureFlags bufferFeatures; +} VkFormatProperties; + +typedef struct VkExtent3D { + uint32_t width; + uint32_t height; + uint32_t depth; +} VkExtent3D; + +typedef struct VkImageFormatProperties { + VkExtent3D maxExtent; + uint32_t maxMipLevels; + uint32_t maxArrayLayers; + VkSampleCountFlags sampleCounts; + VkDeviceSize maxResourceSize; +} VkImageFormatProperties; + +typedef struct VkPhysicalDeviceLimits { + uint32_t maxImageDimension1D; + uint32_t maxImageDimension2D; + uint32_t maxImageDimension3D; + uint32_t maxImageDimensionCube; + uint32_t maxImageArrayLayers; + uint32_t maxTexelBufferElements; + uint32_t maxUniformBufferRange; + uint32_t maxStorageBufferRange; + uint32_t maxPushConstantsSize; + uint32_t maxMemoryAllocationCount; + uint32_t maxSamplerAllocationCount; + VkDeviceSize bufferImageGranularity; + VkDeviceSize sparseAddressSpaceSize; + uint32_t maxBoundDescriptorSets; + uint32_t maxPerStageDescriptorSamplers; + uint32_t maxPerStageDescriptorUniformBuffers; + uint32_t maxPerStageDescriptorStorageBuffers; + uint32_t maxPerStageDescriptorSampledImages; + uint32_t maxPerStageDescriptorStorageImages; + uint32_t maxPerStageDescriptorInputAttachments; + uint32_t maxPerStageResources; + uint32_t maxDescriptorSetSamplers; + uint32_t maxDescriptorSetUniformBuffers; + uint32_t maxDescriptorSetUniformBuffersDynamic; + uint32_t maxDescriptorSetStorageBuffers; + uint32_t maxDescriptorSetStorageBuffersDynamic; + uint32_t maxDescriptorSetSampledImages; + uint32_t maxDescriptorSetStorageImages; + uint32_t maxDescriptorSetInputAttachments; + uint32_t maxVertexInputAttributes; + uint32_t maxVertexInputBindings; + uint32_t maxVertexInputAttributeOffset; + uint32_t maxVertexInputBindingStride; + uint32_t maxVertexOutputComponents; + uint32_t maxTessellationGenerationLevel; + uint32_t maxTessellationPatchSize; + uint32_t maxTessellationControlPerVertexInputComponents; + uint32_t maxTessellationControlPerVertexOutputComponents; + uint32_t maxTessellationControlPerPatchOutputComponents; + uint32_t maxTessellationControlTotalOutputComponents; + uint32_t maxTessellationEvaluationInputComponents; + uint32_t maxTessellationEvaluationOutputComponents; + uint32_t maxGeometryShaderInvocations; + uint32_t maxGeometryInputComponents; + uint32_t maxGeometryOutputComponents; + uint32_t maxGeometryOutputVertices; + uint32_t maxGeometryTotalOutputComponents; + uint32_t maxFragmentInputComponents; + uint32_t maxFragmentOutputAttachments; + uint32_t maxFragmentDualSrcAttachments; + uint32_t maxFragmentCombinedOutputResources; + uint32_t maxComputeSharedMemorySize; + uint32_t maxComputeWorkGroupCount[3]; + uint32_t maxComputeWorkGroupInvocations; + uint32_t maxComputeWorkGroupSize[3]; + uint32_t subPixelPrecisionBits; + uint32_t subTexelPrecisionBits; + uint32_t mipmapPrecisionBits; + uint32_t maxDrawIndexedIndexValue; + uint32_t maxDrawIndirectCount; + float maxSamplerLodBias; + float maxSamplerAnisotropy; + uint32_t maxViewports; + uint32_t maxViewportDimensions[2]; + float viewportBoundsRange[2]; + uint32_t viewportSubPixelBits; + size_t minMemoryMapAlignment; + VkDeviceSize minTexelBufferOffsetAlignment; + VkDeviceSize minUniformBufferOffsetAlignment; + VkDeviceSize minStorageBufferOffsetAlignment; + int32_t minTexelOffset; + uint32_t maxTexelOffset; + int32_t minTexelGatherOffset; + uint32_t maxTexelGatherOffset; + float minInterpolationOffset; + float maxInterpolationOffset; + uint32_t subPixelInterpolationOffsetBits; + uint32_t maxFramebufferWidth; + uint32_t maxFramebufferHeight; + uint32_t maxFramebufferLayers; + VkSampleCountFlags framebufferColorSampleCounts; + VkSampleCountFlags framebufferDepthSampleCounts; + VkSampleCountFlags framebufferStencilSampleCounts; + VkSampleCountFlags framebufferNoAttachmentsSampleCounts; + uint32_t maxColorAttachments; + VkSampleCountFlags sampledImageColorSampleCounts; + VkSampleCountFlags sampledImageIntegerSampleCounts; + VkSampleCountFlags sampledImageDepthSampleCounts; + VkSampleCountFlags sampledImageStencilSampleCounts; + VkSampleCountFlags storageImageSampleCounts; + uint32_t maxSampleMaskWords; + VkBool32 timestampComputeAndGraphics; + float timestampPeriod; + uint32_t maxClipDistances; + uint32_t maxCullDistances; + uint32_t maxCombinedClipAndCullDistances; + uint32_t discreteQueuePriorities; + float pointSizeRange[2]; + float lineWidthRange[2]; + float pointSizeGranularity; + float lineWidthGranularity; + VkBool32 strictLines; + VkBool32 standardSampleLocations; + VkDeviceSize optimalBufferCopyOffsetAlignment; + VkDeviceSize optimalBufferCopyRowPitchAlignment; + VkDeviceSize nonCoherentAtomSize; +} VkPhysicalDeviceLimits; + +typedef struct VkPhysicalDeviceSparseProperties { + VkBool32 residencyStandard2DBlockShape; + VkBool32 residencyStandard2DMultisampleBlockShape; + VkBool32 residencyStandard3DBlockShape; + VkBool32 residencyAlignedMipSize; + VkBool32 residencyNonResidentStrict; +} VkPhysicalDeviceSparseProperties; + +typedef struct VkPhysicalDeviceProperties { + uint32_t apiVersion; + uint32_t driverVersion; + uint32_t vendorID; + uint32_t deviceID; + VkPhysicalDeviceType deviceType; + char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; + uint8_t pipelineCacheUUID[VK_UUID_SIZE]; + VkPhysicalDeviceLimits limits; + VkPhysicalDeviceSparseProperties sparseProperties; +} VkPhysicalDeviceProperties; + +typedef struct VkQueueFamilyProperties { + VkQueueFlags queueFlags; + uint32_t queueCount; + uint32_t timestampValidBits; + VkExtent3D minImageTransferGranularity; +} VkQueueFamilyProperties; + +typedef struct VkMemoryType { + VkMemoryPropertyFlags propertyFlags; + uint32_t heapIndex; +} VkMemoryType; + +typedef struct VkMemoryHeap { + VkDeviceSize size; + VkMemoryHeapFlags flags; +} VkMemoryHeap; + +typedef struct VkPhysicalDeviceMemoryProperties { + uint32_t memoryTypeCount; + VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; + uint32_t memoryHeapCount; + VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]; +} VkPhysicalDeviceMemoryProperties; + +typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); +typedef struct VkDeviceQueueCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceQueueCreateFlags flags; + uint32_t queueFamilyIndex; + uint32_t queueCount; + const float* pQueuePriorities; +} VkDeviceQueueCreateInfo; + +typedef struct VkDeviceCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceCreateFlags flags; + uint32_t queueCreateInfoCount; + const VkDeviceQueueCreateInfo* pQueueCreateInfos; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; + const VkPhysicalDeviceFeatures* pEnabledFeatures; +} VkDeviceCreateInfo; + +typedef struct VkExtensionProperties { + char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; +} VkExtensionProperties; + +typedef struct VkLayerProperties { + char layerName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; + uint32_t implementationVersion; + char description[VK_MAX_DESCRIPTION_SIZE]; +} VkLayerProperties; + +typedef struct VkSubmitInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + const VkPipelineStageFlags* pWaitDstStageMask; + uint32_t commandBufferCount; + const VkCommandBuffer* pCommandBuffers; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkSubmitInfo; + +typedef struct VkMemoryAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceSize allocationSize; + uint32_t memoryTypeIndex; +} VkMemoryAllocateInfo; + +typedef struct VkMappedMemoryRange { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkDeviceSize offset; + VkDeviceSize size; +} VkMappedMemoryRange; + +typedef struct VkMemoryRequirements { + VkDeviceSize size; + VkDeviceSize alignment; + uint32_t memoryTypeBits; +} VkMemoryRequirements; + +typedef struct VkSparseImageFormatProperties { + VkImageAspectFlags aspectMask; + VkExtent3D imageGranularity; + VkSparseImageFormatFlags flags; +} VkSparseImageFormatProperties; + +typedef struct VkSparseImageMemoryRequirements { + VkSparseImageFormatProperties formatProperties; + uint32_t imageMipTailFirstLod; + VkDeviceSize imageMipTailSize; + VkDeviceSize imageMipTailOffset; + VkDeviceSize imageMipTailStride; +} VkSparseImageMemoryRequirements; + +typedef struct VkSparseMemoryBind { + VkDeviceSize resourceOffset; + VkDeviceSize size; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseMemoryBind; + +typedef struct VkSparseBufferMemoryBindInfo { + VkBuffer buffer; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseBufferMemoryBindInfo; + +typedef struct VkSparseImageOpaqueMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseImageOpaqueMemoryBindInfo; + +typedef struct VkImageSubresource { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t arrayLayer; +} VkImageSubresource; + +typedef struct VkOffset3D { + int32_t x; + int32_t y; + int32_t z; +} VkOffset3D; + +typedef struct VkSparseImageMemoryBind { + VkImageSubresource subresource; + VkOffset3D offset; + VkExtent3D extent; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseImageMemoryBind; + +typedef struct VkSparseImageMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseImageMemoryBind* pBinds; +} VkSparseImageMemoryBindInfo; + +typedef struct VkBindSparseInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t bufferBindCount; + const VkSparseBufferMemoryBindInfo* pBufferBinds; + uint32_t imageOpaqueBindCount; + const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds; + uint32_t imageBindCount; + const VkSparseImageMemoryBindInfo* pImageBinds; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkBindSparseInfo; + +typedef struct VkFenceCreateInfo { + VkStructureType sType; + const void* pNext; + VkFenceCreateFlags flags; +} VkFenceCreateInfo; + +typedef struct VkSemaphoreCreateInfo { + VkStructureType sType; + const void* pNext; + VkSemaphoreCreateFlags flags; +} VkSemaphoreCreateInfo; + +typedef struct VkEventCreateInfo { + VkStructureType sType; + const void* pNext; + VkEventCreateFlags flags; +} VkEventCreateInfo; + +typedef struct VkQueryPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkQueryPoolCreateFlags flags; + VkQueryType queryType; + uint32_t queryCount; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkQueryPoolCreateInfo; + +typedef struct VkBufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkDeviceSize size; + VkBufferUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; +} VkBufferCreateInfo; + +typedef struct VkBufferViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferViewCreateFlags flags; + VkBuffer buffer; + VkFormat format; + VkDeviceSize offset; + VkDeviceSize range; +} VkBufferViewCreateInfo; + +typedef struct VkImageCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageCreateFlags flags; + VkImageType imageType; + VkFormat format; + VkExtent3D extent; + uint32_t mipLevels; + uint32_t arrayLayers; + VkSampleCountFlagBits samples; + VkImageTiling tiling; + VkImageUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkImageLayout initialLayout; +} VkImageCreateInfo; + +typedef struct VkSubresourceLayout { + VkDeviceSize offset; + VkDeviceSize size; + VkDeviceSize rowPitch; + VkDeviceSize arrayPitch; + VkDeviceSize depthPitch; +} VkSubresourceLayout; + +typedef struct VkComponentMapping { + VkComponentSwizzle r; + VkComponentSwizzle g; + VkComponentSwizzle b; + VkComponentSwizzle a; +} VkComponentMapping; + +typedef struct VkImageSubresourceRange { + VkImageAspectFlags aspectMask; + uint32_t baseMipLevel; + uint32_t levelCount; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceRange; + +typedef struct VkImageViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageViewCreateFlags flags; + VkImage image; + VkImageViewType viewType; + VkFormat format; + VkComponentMapping components; + VkImageSubresourceRange subresourceRange; +} VkImageViewCreateInfo; + +typedef struct VkShaderModuleCreateInfo { + VkStructureType sType; + const void* pNext; + VkShaderModuleCreateFlags flags; + size_t codeSize; + const uint32_t* pCode; +} VkShaderModuleCreateInfo; + +typedef struct VkPipelineCacheCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCacheCreateFlags flags; + size_t initialDataSize; + const void* pInitialData; +} VkPipelineCacheCreateInfo; + +typedef struct VkSpecializationMapEntry { + uint32_t constantID; + uint32_t offset; + size_t size; +} VkSpecializationMapEntry; + +typedef struct VkSpecializationInfo { + uint32_t mapEntryCount; + const VkSpecializationMapEntry* pMapEntries; + size_t dataSize; + const void* pData; +} VkSpecializationInfo; + +typedef struct VkPipelineShaderStageCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineShaderStageCreateFlags flags; + VkShaderStageFlagBits stage; + VkShaderModule module; + const char* pName; + const VkSpecializationInfo* pSpecializationInfo; +} VkPipelineShaderStageCreateInfo; + +typedef struct VkVertexInputBindingDescription { + uint32_t binding; + uint32_t stride; + VkVertexInputRate inputRate; +} VkVertexInputBindingDescription; + +typedef struct VkVertexInputAttributeDescription { + uint32_t location; + uint32_t binding; + VkFormat format; + uint32_t offset; +} VkVertexInputAttributeDescription; + +typedef struct VkPipelineVertexInputStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineVertexInputStateCreateFlags flags; + uint32_t vertexBindingDescriptionCount; + const VkVertexInputBindingDescription* pVertexBindingDescriptions; + uint32_t vertexAttributeDescriptionCount; + const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; +} VkPipelineVertexInputStateCreateInfo; + +typedef struct VkPipelineInputAssemblyStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineInputAssemblyStateCreateFlags flags; + VkPrimitiveTopology topology; + VkBool32 primitiveRestartEnable; +} VkPipelineInputAssemblyStateCreateInfo; + +typedef struct VkPipelineTessellationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineTessellationStateCreateFlags flags; + uint32_t patchControlPoints; +} VkPipelineTessellationStateCreateInfo; + +typedef struct VkViewport { + float x; + float y; + float width; + float height; + float minDepth; + float maxDepth; +} VkViewport; + +typedef struct VkOffset2D { + int32_t x; + int32_t y; +} VkOffset2D; + +typedef struct VkExtent2D { + uint32_t width; + uint32_t height; +} VkExtent2D; + +typedef struct VkRect2D { + VkOffset2D offset; + VkExtent2D extent; +} VkRect2D; + +typedef struct VkPipelineViewportStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineViewportStateCreateFlags flags; + uint32_t viewportCount; + const VkViewport* pViewports; + uint32_t scissorCount; + const VkRect2D* pScissors; +} VkPipelineViewportStateCreateInfo; + +typedef struct VkPipelineRasterizationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineRasterizationStateCreateFlags flags; + VkBool32 depthClampEnable; + VkBool32 rasterizerDiscardEnable; + VkPolygonMode polygonMode; + VkCullModeFlags cullMode; + VkFrontFace frontFace; + VkBool32 depthBiasEnable; + float depthBiasConstantFactor; + float depthBiasClamp; + float depthBiasSlopeFactor; + float lineWidth; +} VkPipelineRasterizationStateCreateInfo; + +typedef struct VkPipelineMultisampleStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineMultisampleStateCreateFlags flags; + VkSampleCountFlagBits rasterizationSamples; + VkBool32 sampleShadingEnable; + float minSampleShading; + const VkSampleMask* pSampleMask; + VkBool32 alphaToCoverageEnable; + VkBool32 alphaToOneEnable; +} VkPipelineMultisampleStateCreateInfo; + +typedef struct VkStencilOpState { + VkStencilOp failOp; + VkStencilOp passOp; + VkStencilOp depthFailOp; + VkCompareOp compareOp; + uint32_t compareMask; + uint32_t writeMask; + uint32_t reference; +} VkStencilOpState; + +typedef struct VkPipelineDepthStencilStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDepthStencilStateCreateFlags flags; + VkBool32 depthTestEnable; + VkBool32 depthWriteEnable; + VkCompareOp depthCompareOp; + VkBool32 depthBoundsTestEnable; + VkBool32 stencilTestEnable; + VkStencilOpState front; + VkStencilOpState back; + float minDepthBounds; + float maxDepthBounds; +} VkPipelineDepthStencilStateCreateInfo; + +typedef struct VkPipelineColorBlendAttachmentState { + VkBool32 blendEnable; + VkBlendFactor srcColorBlendFactor; + VkBlendFactor dstColorBlendFactor; + VkBlendOp colorBlendOp; + VkBlendFactor srcAlphaBlendFactor; + VkBlendFactor dstAlphaBlendFactor; + VkBlendOp alphaBlendOp; + VkColorComponentFlags colorWriteMask; +} VkPipelineColorBlendAttachmentState; + +typedef struct VkPipelineColorBlendStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineColorBlendStateCreateFlags flags; + VkBool32 logicOpEnable; + VkLogicOp logicOp; + uint32_t attachmentCount; + const VkPipelineColorBlendAttachmentState* pAttachments; + float blendConstants[4]; +} VkPipelineColorBlendStateCreateInfo; + +typedef struct VkPipelineDynamicStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDynamicStateCreateFlags flags; + uint32_t dynamicStateCount; + const VkDynamicState* pDynamicStates; +} VkPipelineDynamicStateCreateInfo; + +typedef struct VkGraphicsPipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + uint32_t stageCount; + const VkPipelineShaderStageCreateInfo* pStages; + const VkPipelineVertexInputStateCreateInfo* pVertexInputState; + const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; + const VkPipelineTessellationStateCreateInfo* pTessellationState; + const VkPipelineViewportStateCreateInfo* pViewportState; + const VkPipelineRasterizationStateCreateInfo* pRasterizationState; + const VkPipelineMultisampleStateCreateInfo* pMultisampleState; + const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; + const VkPipelineColorBlendStateCreateInfo* pColorBlendState; + const VkPipelineDynamicStateCreateInfo* pDynamicState; + VkPipelineLayout layout; + VkRenderPass renderPass; + uint32_t subpass; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkGraphicsPipelineCreateInfo; + +typedef struct VkComputePipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + VkPipelineShaderStageCreateInfo stage; + VkPipelineLayout layout; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkComputePipelineCreateInfo; + +typedef struct VkPushConstantRange { + VkShaderStageFlags stageFlags; + uint32_t offset; + uint32_t size; +} VkPushConstantRange; + +typedef struct VkPipelineLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineLayoutCreateFlags flags; + uint32_t setLayoutCount; + const VkDescriptorSetLayout* pSetLayouts; + uint32_t pushConstantRangeCount; + const VkPushConstantRange* pPushConstantRanges; +} VkPipelineLayoutCreateInfo; + +typedef struct VkSamplerCreateInfo { + VkStructureType sType; + const void* pNext; + VkSamplerCreateFlags flags; + VkFilter magFilter; + VkFilter minFilter; + VkSamplerMipmapMode mipmapMode; + VkSamplerAddressMode addressModeU; + VkSamplerAddressMode addressModeV; + VkSamplerAddressMode addressModeW; + float mipLodBias; + VkBool32 anisotropyEnable; + float maxAnisotropy; + VkBool32 compareEnable; + VkCompareOp compareOp; + float minLod; + float maxLod; + VkBorderColor borderColor; + VkBool32 unnormalizedCoordinates; +} VkSamplerCreateInfo; + +typedef struct VkDescriptorSetLayoutBinding { + uint32_t binding; + VkDescriptorType descriptorType; + uint32_t descriptorCount; + VkShaderStageFlags stageFlags; + const VkSampler* pImmutableSamplers; +} VkDescriptorSetLayoutBinding; + +typedef struct VkDescriptorSetLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorSetLayoutCreateFlags flags; + uint32_t bindingCount; + const VkDescriptorSetLayoutBinding* pBindings; +} VkDescriptorSetLayoutCreateInfo; + +typedef struct VkDescriptorPoolSize { + VkDescriptorType type; + uint32_t descriptorCount; +} VkDescriptorPoolSize; + +typedef struct VkDescriptorPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPoolCreateFlags flags; + uint32_t maxSets; + uint32_t poolSizeCount; + const VkDescriptorPoolSize* pPoolSizes; +} VkDescriptorPoolCreateInfo; + +typedef struct VkDescriptorSetAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPool descriptorPool; + uint32_t descriptorSetCount; + const VkDescriptorSetLayout* pSetLayouts; +} VkDescriptorSetAllocateInfo; + +typedef struct VkDescriptorImageInfo { + VkSampler sampler; + VkImageView imageView; + VkImageLayout imageLayout; +} VkDescriptorImageInfo; + +typedef struct VkDescriptorBufferInfo { + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize range; +} VkDescriptorBufferInfo; + +typedef struct VkWriteDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + const VkDescriptorImageInfo* pImageInfo; + const VkDescriptorBufferInfo* pBufferInfo; + const VkBufferView* pTexelBufferView; +} VkWriteDescriptorSet; + +typedef struct VkCopyDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet srcSet; + uint32_t srcBinding; + uint32_t srcArrayElement; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; +} VkCopyDescriptorSet; + +typedef struct VkFramebufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkFramebufferCreateFlags flags; + VkRenderPass renderPass; + uint32_t attachmentCount; + const VkImageView* pAttachments; + uint32_t width; + uint32_t height; + uint32_t layers; +} VkFramebufferCreateInfo; + +typedef struct VkAttachmentDescription { + VkAttachmentDescriptionFlags flags; + VkFormat format; + VkSampleCountFlagBits samples; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkAttachmentLoadOp stencilLoadOp; + VkAttachmentStoreOp stencilStoreOp; + VkImageLayout initialLayout; + VkImageLayout finalLayout; +} VkAttachmentDescription; + +typedef struct VkAttachmentReference { + uint32_t attachment; + VkImageLayout layout; +} VkAttachmentReference; + +typedef struct VkSubpassDescription { + VkSubpassDescriptionFlags flags; + VkPipelineBindPoint pipelineBindPoint; + uint32_t inputAttachmentCount; + const VkAttachmentReference* pInputAttachments; + uint32_t colorAttachmentCount; + const VkAttachmentReference* pColorAttachments; + const VkAttachmentReference* pResolveAttachments; + const VkAttachmentReference* pDepthStencilAttachment; + uint32_t preserveAttachmentCount; + const uint32_t* pPreserveAttachments; +} VkSubpassDescription; + +typedef struct VkSubpassDependency { + uint32_t srcSubpass; + uint32_t dstSubpass; + VkPipelineStageFlags srcStageMask; + VkPipelineStageFlags dstStageMask; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkDependencyFlags dependencyFlags; +} VkSubpassDependency; + +typedef struct VkRenderPassCreateInfo { + VkStructureType sType; + const void* pNext; + VkRenderPassCreateFlags flags; + uint32_t attachmentCount; + const VkAttachmentDescription* pAttachments; + uint32_t subpassCount; + const VkSubpassDescription* pSubpasses; + uint32_t dependencyCount; + const VkSubpassDependency* pDependencies; +} VkRenderPassCreateInfo; + +typedef struct VkCommandPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPoolCreateFlags flags; + uint32_t queueFamilyIndex; +} VkCommandPoolCreateInfo; + +typedef struct VkCommandBufferAllocateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPool commandPool; + VkCommandBufferLevel level; + uint32_t commandBufferCount; +} VkCommandBufferAllocateInfo; + +typedef struct VkCommandBufferInheritanceInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + uint32_t subpass; + VkFramebuffer framebuffer; + VkBool32 occlusionQueryEnable; + VkQueryControlFlags queryFlags; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkCommandBufferInheritanceInfo; + +typedef struct VkCommandBufferBeginInfo { + VkStructureType sType; + const void* pNext; + VkCommandBufferUsageFlags flags; + const VkCommandBufferInheritanceInfo* pInheritanceInfo; +} VkCommandBufferBeginInfo; + +typedef struct VkBufferCopy { + VkDeviceSize srcOffset; + VkDeviceSize dstOffset; + VkDeviceSize size; +} VkBufferCopy; + +typedef struct VkImageSubresourceLayers { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceLayers; + +typedef struct VkImageCopy { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageCopy; + +typedef struct VkImageBlit { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffsets[2]; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffsets[2]; +} VkImageBlit; + +typedef struct VkBufferImageCopy { + VkDeviceSize bufferOffset; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkBufferImageCopy; + +typedef union VkClearColorValue { + float float32[4]; + int32_t int32[4]; + uint32_t uint32[4]; +} VkClearColorValue; + +typedef struct VkClearDepthStencilValue { + float depth; + uint32_t stencil; +} VkClearDepthStencilValue; + +typedef union VkClearValue { + VkClearColorValue color; + VkClearDepthStencilValue depthStencil; +} VkClearValue; + +typedef struct VkClearAttachment { + VkImageAspectFlags aspectMask; + uint32_t colorAttachment; + VkClearValue clearValue; +} VkClearAttachment; + +typedef struct VkClearRect { + VkRect2D rect; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkClearRect; + +typedef struct VkImageResolve { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageResolve; + +typedef struct VkMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; +} VkMemoryBarrier; + +typedef struct VkBufferMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} VkBufferMemoryBarrier; + +typedef struct VkImageMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkImageLayout oldLayout; + VkImageLayout newLayout; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} VkImageMemoryBarrier; + +typedef struct VkRenderPassBeginInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + VkFramebuffer framebuffer; + VkRect2D renderArea; + uint32_t clearValueCount; + const VkClearValue* pClearValues; +} VkRenderPassBeginInfo; + +typedef struct VkDispatchIndirectCommand { + uint32_t x; + uint32_t y; + uint32_t z; +} VkDispatchIndirectCommand; + +typedef struct VkDrawIndexedIndirectCommand { + uint32_t indexCount; + uint32_t instanceCount; + uint32_t firstIndex; + int32_t vertexOffset; + uint32_t firstInstance; +} VkDrawIndexedIndirectCommand; + +typedef struct VkDrawIndirectCommand { + uint32_t vertexCount; + uint32_t instanceCount; + uint32_t firstVertex; + uint32_t firstInstance; +} VkDrawIndirectCommand; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); +typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice); +typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue); +typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); +typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory); +typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData); +typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); +typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes); +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore); +typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent); +typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool); +typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage); +typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule); +typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches); +typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler); +typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets); +typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets); +typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); +typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); +typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool); +typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers); +typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); +typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo); +typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); +typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports); +typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors); +typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); +typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants[4]); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); +typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); +typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects); +typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); +typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues); +typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); +typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( + const VkInstanceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkInstance* pInstance); + +VKAPI_ATTR void VKAPI_CALL vkDestroyInstance( + VkInstance instance, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices( + VkInstance instance, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures* pFeatures); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties* pFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkImageFormatProperties* pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties* pQueueFamilyProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties* pMemoryProperties); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr( + VkInstance instance, + const char* pName); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr( + VkDevice device, + const char* pName); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( + VkPhysicalDevice physicalDevice, + const VkDeviceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDevice* pDevice); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDevice( + VkDevice device, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties( + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties( + VkPhysicalDevice physicalDevice, + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue( + VkDevice device, + uint32_t queueFamilyIndex, + uint32_t queueIndex, + VkQueue* pQueue); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit( + VkQueue queue, + uint32_t submitCount, + const VkSubmitInfo* pSubmits, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle( + VkQueue queue); + +VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle( + VkDevice device); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory( + VkDevice device, + const VkMemoryAllocateInfo* pAllocateInfo, + const VkAllocationCallbacks* pAllocator, + VkDeviceMemory* pMemory); + +VKAPI_ATTR void VKAPI_CALL vkFreeMemory( + VkDevice device, + VkDeviceMemory memory, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize offset, + VkDeviceSize size, + VkMemoryMapFlags flags, + void** ppData); + +VKAPI_ATTR void VKAPI_CALL vkUnmapMemory( + VkDevice device, + VkDeviceMemory memory); + +VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize* pCommittedMemoryInBytes); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory( + VkDevice device, + VkBuffer buffer, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory( + VkDevice device, + VkImage image, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements( + VkDevice device, + VkBuffer buffer, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements( + VkDevice device, + VkImage image, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements( + VkDevice device, + VkImage image, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements* pSparseMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkSampleCountFlagBits samples, + VkImageUsageFlags usage, + VkImageTiling tiling, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse( + VkQueue queue, + uint32_t bindInfoCount, + const VkBindSparseInfo* pBindInfo, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence( + VkDevice device, + const VkFenceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFence( + VkDevice device, + VkFence fence, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus( + VkDevice device, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences, + VkBool32 waitAll, + uint64_t timeout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore( + VkDevice device, + const VkSemaphoreCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSemaphore* pSemaphore); + +VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore( + VkDevice device, + VkSemaphore semaphore, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent( + VkDevice device, + const VkEventCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkEvent* pEvent); + +VKAPI_ATTR void VKAPI_CALL vkDestroyEvent( + VkDevice device, + VkEvent event, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool( + VkDevice device, + const VkQueryPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkQueryPool* pQueryPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool( + VkDevice device, + VkQueryPool queryPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults( + VkDevice device, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + size_t dataSize, + void* pData, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer( + VkDevice device, + const VkBufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBuffer* pBuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer( + VkDevice device, + VkBuffer buffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView( + VkDevice device, + const VkBufferViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBufferView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView( + VkDevice device, + VkBufferView bufferView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage( + VkDevice device, + const VkImageCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImage* pImage); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImage( + VkDevice device, + VkImage image, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout( + VkDevice device, + VkImage image, + const VkImageSubresource* pSubresource, + VkSubresourceLayout* pLayout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView( + VkDevice device, + const VkImageViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImageView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImageView( + VkDevice device, + VkImageView imageView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule( + VkDevice device, + const VkShaderModuleCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkShaderModule* pShaderModule); + +VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule( + VkDevice device, + VkShaderModule shaderModule, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache( + VkDevice device, + const VkPipelineCacheCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineCache* pPipelineCache); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache( + VkDevice device, + VkPipelineCache pipelineCache, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData( + VkDevice device, + VkPipelineCache pipelineCache, + size_t* pDataSize, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches( + VkDevice device, + VkPipelineCache dstCache, + uint32_t srcCacheCount, + const VkPipelineCache* pSrcCaches); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkComputePipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline( + VkDevice device, + VkPipeline pipeline, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout( + VkDevice device, + const VkPipelineLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineLayout* pPipelineLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout( + VkDevice device, + VkPipelineLayout pipelineLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler( + VkDevice device, + const VkSamplerCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSampler* pSampler); + +VKAPI_ATTR void VKAPI_CALL vkDestroySampler( + VkDevice device, + VkSampler sampler, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout( + VkDevice device, + const VkDescriptorSetLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorSetLayout* pSetLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout( + VkDevice device, + VkDescriptorSetLayout descriptorSetLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool( + VkDevice device, + const VkDescriptorPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorPool* pDescriptorPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + VkDescriptorPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets( + VkDevice device, + const VkDescriptorSetAllocateInfo* pAllocateInfo, + VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets( + VkDevice device, + VkDescriptorPool descriptorPool, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets( + VkDevice device, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites, + uint32_t descriptorCopyCount, + const VkCopyDescriptorSet* pDescriptorCopies); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer( + VkDevice device, + const VkFramebufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFramebuffer* pFramebuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer( + VkDevice device, + VkFramebuffer framebuffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass( + VkDevice device, + const VkRenderPassCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkRenderPass* pRenderPass); + +VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass( + VkDevice device, + VkRenderPass renderPass, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity( + VkDevice device, + VkRenderPass renderPass, + VkExtent2D* pGranularity); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool( + VkDevice device, + const VkCommandPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCommandPool* pCommandPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool( + VkDevice device, + VkCommandPool commandPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool( + VkDevice device, + VkCommandPool commandPool, + VkCommandPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers( + VkDevice device, + const VkCommandBufferAllocateInfo* pAllocateInfo, + VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers( + VkDevice device, + VkCommandPool commandPool, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer( + VkCommandBuffer commandBuffer, + const VkCommandBufferBeginInfo* pBeginInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer( + VkCommandBuffer commandBuffer, + VkCommandBufferResetFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewport* pViewports); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor( + VkCommandBuffer commandBuffer, + uint32_t firstScissor, + uint32_t scissorCount, + const VkRect2D* pScissors); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth( + VkCommandBuffer commandBuffer, + float lineWidth); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias( + VkCommandBuffer commandBuffer, + float depthBiasConstantFactor, + float depthBiasClamp, + float depthBiasSlopeFactor); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants( + VkCommandBuffer commandBuffer, + const float blendConstants[4]); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds( + VkCommandBuffer commandBuffer, + float minDepthBounds, + float maxDepthBounds); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t compareMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t writeMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t reference); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t firstSet, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets, + uint32_t dynamicOffsetCount, + const uint32_t* pDynamicOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkIndexType indexType); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers( + VkCommandBuffer commandBuffer, + uint32_t firstBinding, + uint32_t bindingCount, + const VkBuffer* pBuffers, + const VkDeviceSize* pOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdDraw( + VkCommandBuffer commandBuffer, + uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed( + VkCommandBuffer commandBuffer, + uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, + int32_t vertexOffset, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatch( + VkCommandBuffer commandBuffer, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageBlit* pRegions, + VkFilter filter); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize dataSize, + const void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize size, + uint32_t data); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearColorValue* pColor, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearDepthStencilValue* pDepthStencil, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments( + VkCommandBuffer commandBuffer, + uint32_t attachmentCount, + const VkClearAttachment* pAttachments, + uint32_t rectCount, + const VkClearRect* pRects); + +VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageResolve* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents( + VkCommandBuffer commandBuffer, + uint32_t eventCount, + const VkEvent* pEvents, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier( + VkCommandBuffer commandBuffer, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + VkDependencyFlags dependencyFlags, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query, + VkQueryControlFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount); + +VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp( + VkCommandBuffer commandBuffer, + VkPipelineStageFlagBits pipelineStage, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants( + VkCommandBuffer commandBuffer, + VkPipelineLayout layout, + VkShaderStageFlags stageFlags, + uint32_t offset, + uint32_t size, + const void* pValues); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass( + VkCommandBuffer commandBuffer, + const VkRenderPassBeginInfo* pRenderPassBegin, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass( + VkCommandBuffer commandBuffer, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands( + VkCommandBuffer commandBuffer, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); +#endif + +#define VK_KHR_surface 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#define VK_KHR_SURFACE_SPEC_VERSION 25 +#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" +#define VK_COLORSPACE_SRGB_NONLINEAR_KHR VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + + +typedef enum VkColorSpaceKHR { + VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, + VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001, + VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002, + VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104003, + VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004, + VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005, + VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006, + VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007, + VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008, + VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009, + VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010, + VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, + VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, + VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, + VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, + VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1), + VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkColorSpaceKHR; + +typedef enum VkPresentModeKHR { + VK_PRESENT_MODE_IMMEDIATE_KHR = 0, + VK_PRESENT_MODE_MAILBOX_KHR = 1, + VK_PRESENT_MODE_FIFO_KHR = 2, + VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, + VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, + VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR, + VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_RELAXED_KHR, + VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1), + VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkPresentModeKHR; + + +typedef enum VkSurfaceTransformFlagBitsKHR { + VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001, + VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002, + VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004, + VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, + VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSurfaceTransformFlagBitsKHR; +typedef VkFlags VkSurfaceTransformFlagsKHR; + +typedef enum VkCompositeAlphaFlagBitsKHR { + VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, + VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, + VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, + VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkCompositeAlphaFlagBitsKHR; +typedef VkFlags VkCompositeAlphaFlagsKHR; + +typedef struct VkSurfaceCapabilitiesKHR { + uint32_t minImageCount; + uint32_t maxImageCount; + VkExtent2D currentExtent; + VkExtent2D minImageExtent; + VkExtent2D maxImageExtent; + uint32_t maxImageArrayLayers; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkSurfaceTransformFlagBitsKHR currentTransform; + VkCompositeAlphaFlagsKHR supportedCompositeAlpha; + VkImageUsageFlags supportedUsageFlags; +} VkSurfaceCapabilitiesKHR; + +typedef struct VkSurfaceFormatKHR { + VkFormat format; + VkColorSpaceKHR colorSpace; +} VkSurfaceFormatKHR; + + +typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR( + VkInstance instance, + VkSurfaceKHR surface, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + VkSurfaceKHR surface, + VkBool32* pSupported); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormatKHR* pSurfaceFormats); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pPresentModeCount, + VkPresentModeKHR* pPresentModes); +#endif + +#define VK_KHR_swapchain 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) + +#define VK_KHR_SWAPCHAIN_SPEC_VERSION 68 +#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" + + +typedef enum VkSwapchainCreateFlagBitsKHR { + VK_SWAPCHAIN_CREATE_BIND_SFR_BIT_KHX = 0x00000001, + VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSwapchainCreateFlagBitsKHR; +typedef VkFlags VkSwapchainCreateFlagsKHR; + +typedef struct VkSwapchainCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkSwapchainCreateFlagsKHR flags; + VkSurfaceKHR surface; + uint32_t minImageCount; + VkFormat imageFormat; + VkColorSpaceKHR imageColorSpace; + VkExtent2D imageExtent; + uint32_t imageArrayLayers; + VkImageUsageFlags imageUsage; + VkSharingMode imageSharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkSurfaceTransformFlagBitsKHR preTransform; + VkCompositeAlphaFlagBitsKHR compositeAlpha; + VkPresentModeKHR presentMode; + VkBool32 clipped; + VkSwapchainKHR oldSwapchain; +} VkSwapchainCreateInfoKHR; + +typedef struct VkPresentInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t swapchainCount; + const VkSwapchainKHR* pSwapchains; + const uint32_t* pImageIndices; + VkResult* pResults; +} VkPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain); +typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex); +typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR( + VkDevice device, + const VkSwapchainCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchain); + +VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR( + VkDevice device, + VkSwapchainKHR swapchain, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pSwapchainImageCount, + VkImage* pSwapchainImages); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint64_t timeout, + VkSemaphore semaphore, + VkFence fence, + uint32_t* pImageIndex); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( + VkQueue queue, + const VkPresentInfoKHR* pPresentInfo); +#endif + +#define VK_KHR_display 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) + +#define VK_KHR_DISPLAY_SPEC_VERSION 21 +#define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display" + + +typedef enum VkDisplayPlaneAlphaFlagBitsKHR { + VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008, + VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkDisplayPlaneAlphaFlagBitsKHR; +typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; +typedef VkFlags VkDisplayModeCreateFlagsKHR; +typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; + +typedef struct VkDisplayPropertiesKHR { + VkDisplayKHR display; + const char* displayName; + VkExtent2D physicalDimensions; + VkExtent2D physicalResolution; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkBool32 planeReorderPossible; + VkBool32 persistentContent; +} VkDisplayPropertiesKHR; + +typedef struct VkDisplayModeParametersKHR { + VkExtent2D visibleRegion; + uint32_t refreshRate; +} VkDisplayModeParametersKHR; + +typedef struct VkDisplayModePropertiesKHR { + VkDisplayModeKHR displayMode; + VkDisplayModeParametersKHR parameters; +} VkDisplayModePropertiesKHR; + +typedef struct VkDisplayModeCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplayModeCreateFlagsKHR flags; + VkDisplayModeParametersKHR parameters; +} VkDisplayModeCreateInfoKHR; + +typedef struct VkDisplayPlaneCapabilitiesKHR { + VkDisplayPlaneAlphaFlagsKHR supportedAlpha; + VkOffset2D minSrcPosition; + VkOffset2D maxSrcPosition; + VkExtent2D minSrcExtent; + VkExtent2D maxSrcExtent; + VkOffset2D minDstPosition; + VkOffset2D maxDstPosition; + VkExtent2D minDstExtent; + VkExtent2D maxDstExtent; +} VkDisplayPlaneCapabilitiesKHR; + +typedef struct VkDisplayPlanePropertiesKHR { + VkDisplayKHR currentDisplay; + uint32_t currentStackIndex; +} VkDisplayPlanePropertiesKHR; + +typedef struct VkDisplaySurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplaySurfaceCreateFlagsKHR flags; + VkDisplayModeKHR displayMode; + uint32_t planeIndex; + uint32_t planeStackIndex; + VkSurfaceTransformFlagBitsKHR transform; + float globalAlpha; + VkDisplayPlaneAlphaFlagBitsKHR alphaMode; + VkExtent2D imageExtent; +} VkDisplaySurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPlanePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR( + VkPhysicalDevice physicalDevice, + uint32_t planeIndex, + uint32_t* pDisplayCount, + VkDisplayKHR* pDisplays); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + uint32_t* pPropertyCount, + VkDisplayModePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDisplayModeKHR* pMode); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayModeKHR mode, + uint32_t planeIndex, + VkDisplayPlaneCapabilitiesKHR* pCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( + VkInstance instance, + const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif + +#define VK_KHR_display_swapchain 1 +#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9 +#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" + +typedef struct VkDisplayPresentInfoKHR { + VkStructureType sType; + const void* pNext; + VkRect2D srcRect; + VkRect2D dstRect; + VkBool32 persistent; +} VkDisplayPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainCreateInfoKHR* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchains); +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#define VK_KHR_xlib_surface 1 +#include + +#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" + +typedef VkFlags VkXlibSurfaceCreateFlagsKHR; + +typedef struct VkXlibSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXlibSurfaceCreateFlagsKHR flags; + Display* dpy; + Window window; +} VkXlibSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( + VkInstance instance, + const VkXlibSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + Display* dpy, + VisualID visualID); +#endif +#endif /* VK_USE_PLATFORM_XLIB_KHR */ + +#ifdef VK_USE_PLATFORM_XCB_KHR +#define VK_KHR_xcb_surface 1 +#include + +#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" + +typedef VkFlags VkXcbSurfaceCreateFlagsKHR; + +typedef struct VkXcbSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXcbSurfaceCreateFlagsKHR flags; + xcb_connection_t* connection; + xcb_window_t window; +} VkXcbSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( + VkInstance instance, + const VkXcbSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + xcb_connection_t* connection, + xcb_visualid_t visual_id); +#endif +#endif /* VK_USE_PLATFORM_XCB_KHR */ + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#define VK_KHR_wayland_surface 1 +#include + +#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 +#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" + +typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; + +typedef struct VkWaylandSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWaylandSurfaceCreateFlagsKHR flags; + struct wl_display* display; + struct wl_surface* surface; +} VkWaylandSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( + VkInstance instance, + const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + struct wl_display* display); +#endif +#endif /* VK_USE_PLATFORM_WAYLAND_KHR */ + +#ifdef VK_USE_PLATFORM_MIR_KHR +#define VK_KHR_mir_surface 1 +#include + +#define VK_KHR_MIR_SURFACE_SPEC_VERSION 4 +#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface" + +typedef VkFlags VkMirSurfaceCreateFlagsKHR; + +typedef struct VkMirSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkMirSurfaceCreateFlagsKHR flags; + MirConnection* connection; + MirSurface* mirSurface; +} VkMirSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR( + VkInstance instance, + const VkMirSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + MirConnection* connection); +#endif +#endif /* VK_USE_PLATFORM_MIR_KHR */ + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#define VK_KHR_android_surface 1 +#include + +#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 +#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface" + +typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; + +typedef struct VkAndroidSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkAndroidSurfaceCreateFlagsKHR flags; + ANativeWindow* window; +} VkAndroidSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( + VkInstance instance, + const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_surface 1 +#include + +#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 +#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" + +typedef VkFlags VkWin32SurfaceCreateFlagsKHR; + +typedef struct VkWin32SurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWin32SurfaceCreateFlagsKHR flags; + HINSTANCE hinstance; + HWND hwnd; +} VkWin32SurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( + VkInstance instance, + const VkWin32SurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_sampler_mirror_clamp_to_edge 1 +#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1 +#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" + + +#define VK_KHR_get_physical_device_properties2 1 +#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" + +typedef struct VkPhysicalDeviceFeatures2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceFeatures features; +} VkPhysicalDeviceFeatures2KHR; + +typedef struct VkPhysicalDeviceProperties2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceProperties properties; +} VkPhysicalDeviceProperties2KHR; + +typedef struct VkFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkFormatProperties formatProperties; +} VkFormatProperties2KHR; + +typedef struct VkImageFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkImageFormatProperties imageFormatProperties; +} VkImageFormatProperties2KHR; + +typedef struct VkPhysicalDeviceImageFormatInfo2KHR { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageType type; + VkImageTiling tiling; + VkImageUsageFlags usage; + VkImageCreateFlags flags; +} VkPhysicalDeviceImageFormatInfo2KHR; + +typedef struct VkQueueFamilyProperties2KHR { + VkStructureType sType; + void* pNext; + VkQueueFamilyProperties queueFamilyProperties; +} VkQueueFamilyProperties2KHR; + +typedef struct VkPhysicalDeviceMemoryProperties2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceMemoryProperties memoryProperties; +} VkPhysicalDeviceMemoryProperties2KHR; + +typedef struct VkSparseImageFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkSparseImageFormatProperties properties; +} VkSparseImageFormatProperties2KHR; + +typedef struct VkPhysicalDeviceSparseImageFormatInfo2KHR { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageType type; + VkSampleCountFlagBits samples; + VkImageUsageFlags usage; + VkImageTiling tiling; +} VkPhysicalDeviceSparseImageFormatInfo2KHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR* pFeatures); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2KHR* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, VkImageFormatProperties2KHR* pImageFormatProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR* pQueueFamilyProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2KHR* pProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2KHR* pFeatures); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2KHR* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties2KHR* pFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, + VkImageFormatProperties2KHR* pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties2KHR* pQueueFamilyProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties2KHR* pProperties); +#endif + +#define VK_KHR_shader_draw_parameters 1 +#define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1 +#define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters" + + +#define VK_KHR_maintenance1 1 +#define VK_KHR_MAINTENANCE1_SPEC_VERSION 1 +#define VK_KHR_MAINTENANCE1_EXTENSION_NAME "VK_KHR_maintenance1" + +typedef VkFlags VkCommandPoolTrimFlagsKHR; + +typedef void (VKAPI_PTR *PFN_vkTrimCommandPoolKHR)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR( + VkDevice device, + VkCommandPool commandPool, + VkCommandPoolTrimFlagsKHR flags); +#endif + +#define VK_KHR_external_memory_capabilities 1 +#define VK_LUID_SIZE_KHR 8 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" + + +typedef enum VkExternalMemoryHandleTypeFlagBitsKHR { + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = 0x00000008, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR; + +typedef enum VkExternalMemoryFeatureFlagBitsKHR { + VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryFeatureFlagBitsKHR; +typedef VkFlags VkExternalMemoryFeatureFlagsKHR; + +typedef struct VkExternalMemoryPropertiesKHR { + VkExternalMemoryFeatureFlagsKHR externalMemoryFeatures; + VkExternalMemoryHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalMemoryHandleTypeFlagsKHR compatibleHandleTypes; +} VkExternalMemoryPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalImageFormatInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalImageFormatInfoKHR; + +typedef struct VkExternalImageFormatPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalImageFormatPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalBufferInfoKHR { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkBufferUsageFlags usage; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalBufferInfoKHR; + +typedef struct VkExternalBufferPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalBufferPropertiesKHR; + +typedef struct VkPhysicalDeviceIDPropertiesKHR { + VkStructureType sType; + void* pNext; + uint8_t deviceUUID[VK_UUID_SIZE]; + uint8_t driverUUID[VK_UUID_SIZE]; + uint8_t deviceLUID[VK_LUID_SIZE_KHR]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; +} VkPhysicalDeviceIDPropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, VkExternalBufferPropertiesKHR* pExternalBufferProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, + VkExternalBufferPropertiesKHR* pExternalBufferProperties); +#endif + +#define VK_KHR_external_memory 1 +#define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" +#define VK_QUEUE_FAMILY_EXTERNAL_KHR (~0U-1) + +typedef struct VkExternalMemoryImageCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryImageCreateInfoKHR; + +typedef struct VkExternalMemoryBufferCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryBufferCreateInfoKHR; + +typedef struct VkExportMemoryAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExportMemoryAllocateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_memory_win32 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" + +typedef struct VkImportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportMemoryWin32HandleInfoKHR; + +typedef struct VkExportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportMemoryWin32HandleInfoKHR; + +typedef struct VkMemoryWin32HandlePropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryWin32HandlePropertiesKHR; + +typedef struct VkMemoryGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR( + VkDevice device, + const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + HANDLE handle, + VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_memory_fd 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd" + +typedef struct VkImportMemoryFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportMemoryFdInfoKHR; + +typedef struct VkMemoryFdPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryFdPropertiesKHR; + +typedef struct VkMemoryGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdKHR)(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdPropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR( + VkDevice device, + const VkMemoryGetFdInfoKHR* pGetFdInfo, + int* pFd); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + int fd, + VkMemoryFdPropertiesKHR* pMemoryFdProperties); +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_keyed_mutex 1 +#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" + +typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t acquireCount; + const VkDeviceMemory* pAcquireSyncs; + const uint64_t* pAcquireKeys; + const uint32_t* pAcquireTimeouts; + uint32_t releaseCount; + const VkDeviceMemory* pReleaseSyncs; + const uint64_t* pReleaseKeys; +} VkWin32KeyedMutexAcquireReleaseInfoKHR; + + +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_capabilities 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" + + +typedef enum VkExternalSemaphoreHandleTypeFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = 0x00000008, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000010, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreHandleTypeFlagsKHR; + +typedef enum VkExternalSemaphoreFeatureFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreFeatureFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalSemaphoreInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalSemaphoreInfoKHR; + +typedef struct VkExternalSemaphorePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalSemaphoreHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalSemaphoreFeatureFlagsKHR externalSemaphoreFeatures; +} VkExternalSemaphorePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, + VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); +#endif + +#define VK_KHR_external_semaphore 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" + + +typedef enum VkSemaphoreImportFlagBitsKHR { + VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSemaphoreImportFlagBitsKHR; +typedef VkFlags VkSemaphoreImportFlagsKHR; + +typedef struct VkExportSemaphoreCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR handleTypes; +} VkExportSemaphoreCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_semaphore_win32 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" + +typedef struct VkImportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportSemaphoreWin32HandleInfoKHR; + +typedef struct VkExportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportSemaphoreWin32HandleInfoKHR; + +typedef struct VkD3D12FenceSubmitInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreValuesCount; + const uint64_t* pWaitSemaphoreValues; + uint32_t signalSemaphoreValuesCount; + const uint64_t* pSignalSemaphoreValues; +} VkD3D12FenceSubmitInfoKHR; + +typedef struct VkSemaphoreGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR( + VkDevice device, + const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( + VkDevice device, + const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_fd 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd" + +typedef struct VkImportSemaphoreFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportSemaphoreFdInfoKHR; + +typedef struct VkSemaphoreGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFdKHR)(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFdKHR)(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR( + VkDevice device, + const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR( + VkDevice device, + const VkSemaphoreGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + +#define VK_KHR_push_descriptor 1 +#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 1 +#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" + +typedef struct VkPhysicalDevicePushDescriptorPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t maxPushDescriptors; +} VkPhysicalDevicePushDescriptorPropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetKHR)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetKHR( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t set, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites); +#endif + +#define VK_KHR_16bit_storage 1 +#define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 +#define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" + +typedef struct VkPhysicalDevice16BitStorageFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 storageBuffer16BitAccess; + VkBool32 uniformAndStorageBuffer16BitAccess; + VkBool32 storagePushConstant16; + VkBool32 storageInputOutput16; +} VkPhysicalDevice16BitStorageFeaturesKHR; + + + +#define VK_KHR_incremental_present 1 +#define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 1 +#define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" + +typedef struct VkRectLayerKHR { + VkOffset2D offset; + VkExtent2D extent; + uint32_t layer; +} VkRectLayerKHR; + +typedef struct VkPresentRegionKHR { + uint32_t rectangleCount; + const VkRectLayerKHR* pRectangles; +} VkPresentRegionKHR; + +typedef struct VkPresentRegionsKHR { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentRegionKHR* pRegions; +} VkPresentRegionsKHR; + + + +#define VK_KHR_descriptor_update_template 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplateKHR) + +#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION 1 +#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME "VK_KHR_descriptor_update_template" + + +typedef enum VkDescriptorUpdateTemplateTypeKHR { + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = 0, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE_KHR = (VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR + 1), + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkDescriptorUpdateTemplateTypeKHR; + +typedef VkFlags VkDescriptorUpdateTemplateCreateFlagsKHR; + +typedef struct VkDescriptorUpdateTemplateEntryKHR { + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + size_t offset; + size_t stride; +} VkDescriptorUpdateTemplateEntryKHR; + +typedef struct VkDescriptorUpdateTemplateCreateInfoKHR { + VkStructureType sType; + void* pNext; + VkDescriptorUpdateTemplateCreateFlagsKHR flags; + uint32_t descriptorUpdateEntryCount; + const VkDescriptorUpdateTemplateEntryKHR* pDescriptorUpdateEntries; + VkDescriptorUpdateTemplateTypeKHR templateType; + VkDescriptorSetLayout descriptorSetLayout; + VkPipelineBindPoint pipelineBindPoint; + VkPipelineLayout pipelineLayout; + uint32_t set; +} VkDescriptorUpdateTemplateCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplateKHR)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplateKHR)(VkDevice device, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateKHR)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetWithTemplateKHR)(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplateKHR( + VkDevice device, + const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplateKHR( + VkDevice device, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR( + VkDevice device, + VkDescriptorSet descriptorSet, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + const void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( + VkCommandBuffer commandBuffer, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + VkPipelineLayout layout, + uint32_t set, + const void* pData); +#endif + +#define VK_KHR_shared_presentable_image 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" + +typedef struct VkSharedPresentSurfaceCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkImageUsageFlags sharedPresentSupportedUsageFlags; +} VkSharedPresentSurfaceCapabilitiesKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( + VkDevice device, + VkSwapchainKHR swapchain); +#endif + +#define VK_KHR_external_fence_capabilities 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" + + +typedef enum VkExternalFenceHandleTypeFlagBitsKHR { + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000008, + VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalFenceHandleTypeFlagsKHR; + +typedef enum VkExternalFenceFeatureFlagBitsKHR { + VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceFeatureFlagBitsKHR; +typedef VkFlags VkExternalFenceFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalFenceInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalFenceInfoKHR; + +typedef struct VkExternalFencePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalFenceHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalFenceHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalFenceFeatureFlagsKHR externalFenceFeatures; +} VkExternalFencePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, VkExternalFencePropertiesKHR* pExternalFenceProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, + VkExternalFencePropertiesKHR* pExternalFenceProperties); +#endif + +#define VK_KHR_external_fence 1 +#define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" + + +typedef enum VkFenceImportFlagBitsKHR { + VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkFenceImportFlagBitsKHR; +typedef VkFlags VkFenceImportFlagsKHR; + +typedef struct VkExportFenceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagsKHR handleTypes; +} VkExportFenceCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_fence_win32 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" + +typedef struct VkImportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportFenceWin32HandleInfoKHR; + +typedef struct VkExportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportFenceWin32HandleInfoKHR; + +typedef struct VkFenceGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR( + VkDevice device, + const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( + VkDevice device, + const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_fence_fd 1 +#define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd" + +typedef struct VkImportFenceFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportFenceFdInfoKHR; + +typedef struct VkFenceGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceFdKHR)(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceFdKHR)(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceFdKHR( + VkDevice device, + const VkImportFenceFdInfoKHR* pImportFenceFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR( + VkDevice device, + const VkFenceGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + +#define VK_KHR_get_surface_capabilities2 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" + +typedef struct VkPhysicalDeviceSurfaceInfo2KHR { + VkStructureType sType; + const void* pNext; + VkSurfaceKHR surface; +} VkPhysicalDeviceSurfaceInfo2KHR; + +typedef struct VkSurfaceCapabilities2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceCapabilitiesKHR surfaceCapabilities; +} VkSurfaceCapabilities2KHR; + +typedef struct VkSurfaceFormat2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceFormatKHR surfaceFormat; +} VkSurfaceFormat2KHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + VkSurfaceCapabilities2KHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormat2KHR* pSurfaceFormats); +#endif + +#define VK_KHR_variable_pointers 1 +#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 +#define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" + +typedef struct VkPhysicalDeviceVariablePointerFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 variablePointersStorageBuffer; + VkBool32 variablePointers; +} VkPhysicalDeviceVariablePointerFeaturesKHR; + + + +#define VK_KHR_dedicated_allocation 1 +#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 +#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" + +typedef struct VkMemoryDedicatedRequirementsKHR { + VkStructureType sType; + void* pNext; + VkBool32 prefersDedicatedAllocation; + VkBool32 requiresDedicatedAllocation; +} VkMemoryDedicatedRequirementsKHR; + +typedef struct VkMemoryDedicatedAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkMemoryDedicatedAllocateInfoKHR; + + + +#define VK_KHR_storage_buffer_storage_class 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" + + +#define VK_KHR_relaxed_block_layout 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" + + +#define VK_KHR_get_memory_requirements2 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" + +typedef struct VkBufferMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; +} VkBufferMemoryRequirementsInfo2KHR; + +typedef struct VkImageMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageMemoryRequirementsInfo2KHR; + +typedef struct VkImageSparseMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageSparseMemoryRequirementsInfo2KHR; + +typedef struct VkMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkMemoryRequirements memoryRequirements; +} VkMemoryRequirements2KHR; + +typedef struct VkSparseImageMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkSparseImageMemoryRequirements memoryRequirements; +} VkSparseImageMemoryRequirements2KHR; + + +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2KHR)(VkDevice device, const VkImageMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2KHR)(VkDevice device, const VkBufferMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR( + VkDevice device, + const VkImageMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR( + VkDevice device, + const VkBufferMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR( + VkDevice device, + const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); +#endif + +#define VK_EXT_debug_report 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) + +#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 8 +#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" +#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT +#define VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT + + +typedef enum VkDebugReportObjectTypeEXT { + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, + VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, + VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, + VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, + VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, + VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, + VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, + VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, + VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, + VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, + VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, + VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, + VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, + VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, + VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, + VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, + VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = 31, + VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = 32, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = 1000085000, + VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1), + VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDebugReportObjectTypeEXT; + + +typedef enum VkDebugReportFlagBitsEXT { + VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, + VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, + VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, + VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, + VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, + VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDebugReportFlagBitsEXT; +typedef VkFlags VkDebugReportFlagsEXT; + +typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage, + void* pUserData); + +typedef struct VkDebugReportCallbackCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportFlagsEXT flags; + PFN_vkDebugReportCallbackEXT pfnCallback; + void* pUserData; +} VkDebugReportCallbackCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback); +typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT( + VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDebugReportCallbackEXT* pCallback); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT( + VkInstance instance, + VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( + VkInstance instance, + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage); +#endif + +#define VK_NV_glsl_shader 1 +#define VK_NV_GLSL_SHADER_SPEC_VERSION 1 +#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" + + +#define VK_EXT_depth_range_unrestricted 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" + + +#define VK_IMG_filter_cubic 1 +#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 +#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" + + +#define VK_AMD_rasterization_order 1 +#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1 +#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order" + + +typedef enum VkRasterizationOrderAMD { + VK_RASTERIZATION_ORDER_STRICT_AMD = 0, + VK_RASTERIZATION_ORDER_RELAXED_AMD = 1, + VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = VK_RASTERIZATION_ORDER_STRICT_AMD, + VK_RASTERIZATION_ORDER_END_RANGE_AMD = VK_RASTERIZATION_ORDER_RELAXED_AMD, + VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = (VK_RASTERIZATION_ORDER_RELAXED_AMD - VK_RASTERIZATION_ORDER_STRICT_AMD + 1), + VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 0x7FFFFFFF +} VkRasterizationOrderAMD; + +typedef struct VkPipelineRasterizationStateRasterizationOrderAMD { + VkStructureType sType; + const void* pNext; + VkRasterizationOrderAMD rasterizationOrder; +} VkPipelineRasterizationStateRasterizationOrderAMD; + + + +#define VK_AMD_shader_trinary_minmax 1 +#define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1 +#define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax" + + +#define VK_AMD_shader_explicit_vertex_parameter 1 +#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1 +#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter" + + +#define VK_EXT_debug_marker 1 +#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4 +#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker" + +typedef struct VkDebugMarkerObjectNameInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportObjectTypeEXT objectType; + uint64_t object; + const char* pObjectName; +} VkDebugMarkerObjectNameInfoEXT; + +typedef struct VkDebugMarkerObjectTagInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportObjectTypeEXT objectType; + uint64_t object; + uint64_t tagName; + size_t tagSize; + const void* pTag; +} VkDebugMarkerObjectTagInfoEXT; + +typedef struct VkDebugMarkerMarkerInfoEXT { + VkStructureType sType; + const void* pNext; + const char* pMarkerName; + float color[4]; +} VkDebugMarkerMarkerInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo); +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT( + VkDevice device, + const VkDebugMarkerObjectTagInfoEXT* pTagInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT( + VkDevice device, + const VkDebugMarkerObjectNameInfoEXT* pNameInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT( + VkCommandBuffer commandBuffer, + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( + VkCommandBuffer commandBuffer, + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +#endif + +#define VK_AMD_gcn_shader 1 +#define VK_AMD_GCN_SHADER_SPEC_VERSION 1 +#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" + + +#define VK_NV_dedicated_allocation 1 +#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 +#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" + +typedef struct VkDedicatedAllocationImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationImageCreateInfoNV; + +typedef struct VkDedicatedAllocationBufferCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationBufferCreateInfoNV; + +typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkDedicatedAllocationMemoryAllocateInfoNV; + + + +#define VK_AMD_draw_indirect_count 1 +#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 +#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" + +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkBuffer countBuffer, + VkDeviceSize countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkBuffer countBuffer, + VkDeviceSize countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride); +#endif + +#define VK_AMD_negative_viewport_height 1 +#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1 +#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height" + + +#define VK_AMD_gpu_shader_half_float 1 +#define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 1 +#define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float" + + +#define VK_AMD_shader_ballot 1 +#define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1 +#define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" + + +#define VK_AMD_texture_gather_bias_lod 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" + +typedef struct VkTextureLODGatherFormatPropertiesAMD { + VkStructureType sType; + void* pNext; + VkBool32 supportsTextureGatherLODBiasAMD; +} VkTextureLODGatherFormatPropertiesAMD; + + + +#define VK_KHX_multiview 1 +#define VK_KHX_MULTIVIEW_SPEC_VERSION 1 +#define VK_KHX_MULTIVIEW_EXTENSION_NAME "VK_KHX_multiview" + +typedef struct VkRenderPassMultiviewCreateInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t subpassCount; + const uint32_t* pViewMasks; + uint32_t dependencyCount; + const int32_t* pViewOffsets; + uint32_t correlationMaskCount; + const uint32_t* pCorrelationMasks; +} VkRenderPassMultiviewCreateInfoKHX; + +typedef struct VkPhysicalDeviceMultiviewFeaturesKHX { + VkStructureType sType; + void* pNext; + VkBool32 multiview; + VkBool32 multiviewGeometryShader; + VkBool32 multiviewTessellationShader; +} VkPhysicalDeviceMultiviewFeaturesKHX; + +typedef struct VkPhysicalDeviceMultiviewPropertiesKHX { + VkStructureType sType; + void* pNext; + uint32_t maxMultiviewViewCount; + uint32_t maxMultiviewInstanceIndex; +} VkPhysicalDeviceMultiviewPropertiesKHX; + + + +#define VK_IMG_format_pvrtc 1 +#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 +#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" + + +#define VK_NV_external_memory_capabilities 1 +#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities" + + +typedef enum VkExternalMemoryHandleTypeFlagBitsNV { + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkExternalMemoryHandleTypeFlagBitsNV; +typedef VkFlags VkExternalMemoryHandleTypeFlagsNV; + +typedef enum VkExternalMemoryFeatureFlagBitsNV { + VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001, + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002, + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkExternalMemoryFeatureFlagBitsNV; +typedef VkFlags VkExternalMemoryFeatureFlagsNV; + +typedef struct VkExternalImageFormatPropertiesNV { + VkImageFormatProperties imageFormatProperties; + VkExternalMemoryFeatureFlagsNV externalMemoryFeatures; + VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes; + VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes; +} VkExternalImageFormatPropertiesNV; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkExternalMemoryHandleTypeFlagsNV externalHandleType, + VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); +#endif + +#define VK_NV_external_memory 1 +#define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory" + +typedef struct VkExternalMemoryImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleTypes; +} VkExternalMemoryImageCreateInfoNV; + +typedef struct VkExportMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleTypes; +} VkExportMemoryAllocateInfoNV; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_NV_external_memory_win32 1 +#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32" + +typedef struct VkImportMemoryWin32HandleInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleType; + HANDLE handle; +} VkImportMemoryWin32HandleInfoNV; + +typedef struct VkExportMemoryWin32HandleInfoNV { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; +} VkExportMemoryWin32HandleInfoNV; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( + VkDevice device, + VkDeviceMemory memory, + VkExternalMemoryHandleTypeFlagsNV handleType, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_NV_win32_keyed_mutex 1 +#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" + +typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { + VkStructureType sType; + const void* pNext; + uint32_t acquireCount; + const VkDeviceMemory* pAcquireSyncs; + const uint64_t* pAcquireKeys; + const uint32_t* pAcquireTimeoutMilliseconds; + uint32_t releaseCount; + const VkDeviceMemory* pReleaseSyncs; + const uint64_t* pReleaseKeys; +} VkWin32KeyedMutexAcquireReleaseInfoNV; + + +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHX_device_group 1 +#define VK_MAX_DEVICE_GROUP_SIZE_KHX 32 +#define VK_KHX_DEVICE_GROUP_SPEC_VERSION 1 +#define VK_KHX_DEVICE_GROUP_EXTENSION_NAME "VK_KHX_device_group" + + +typedef enum VkPeerMemoryFeatureFlagBitsKHX { + VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHX = 0x00000001, + VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHX = 0x00000002, + VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHX = 0x00000004, + VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHX = 0x00000008, + VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkPeerMemoryFeatureFlagBitsKHX; +typedef VkFlags VkPeerMemoryFeatureFlagsKHX; + +typedef enum VkMemoryAllocateFlagBitsKHX { + VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHX = 0x00000001, + VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkMemoryAllocateFlagBitsKHX; +typedef VkFlags VkMemoryAllocateFlagsKHX; + +typedef enum VkDeviceGroupPresentModeFlagBitsKHX { + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHX = 0x00000001, + VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHX = 0x00000002, + VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHX = 0x00000004, + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHX = 0x00000008, + VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkDeviceGroupPresentModeFlagBitsKHX; +typedef VkFlags VkDeviceGroupPresentModeFlagsKHX; + +typedef struct VkMemoryAllocateFlagsInfoKHX { + VkStructureType sType; + const void* pNext; + VkMemoryAllocateFlagsKHX flags; + uint32_t deviceMask; +} VkMemoryAllocateFlagsInfoKHX; + +typedef struct VkBindBufferMemoryInfoKHX { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; +} VkBindBufferMemoryInfoKHX; + +typedef struct VkBindImageMemoryInfoKHX { + VkStructureType sType; + const void* pNext; + VkImage image; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; + uint32_t SFRRectCount; + const VkRect2D* pSFRRects; +} VkBindImageMemoryInfoKHX; + +typedef struct VkDeviceGroupRenderPassBeginInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceMask; + uint32_t deviceRenderAreaCount; + const VkRect2D* pDeviceRenderAreas; +} VkDeviceGroupRenderPassBeginInfoKHX; + +typedef struct VkDeviceGroupCommandBufferBeginInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceMask; +} VkDeviceGroupCommandBufferBeginInfoKHX; + +typedef struct VkDeviceGroupSubmitInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const uint32_t* pWaitSemaphoreDeviceIndices; + uint32_t commandBufferCount; + const uint32_t* pCommandBufferDeviceMasks; + uint32_t signalSemaphoreCount; + const uint32_t* pSignalSemaphoreDeviceIndices; +} VkDeviceGroupSubmitInfoKHX; + +typedef struct VkDeviceGroupBindSparseInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t resourceDeviceIndex; + uint32_t memoryDeviceIndex; +} VkDeviceGroupBindSparseInfoKHX; + +typedef struct VkDeviceGroupPresentCapabilitiesKHX { + VkStructureType sType; + const void* pNext; + uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE_KHX]; + VkDeviceGroupPresentModeFlagsKHX modes; +} VkDeviceGroupPresentCapabilitiesKHX; + +typedef struct VkImageSwapchainCreateInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; +} VkImageSwapchainCreateInfoKHX; + +typedef struct VkBindImageMemorySwapchainInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint32_t imageIndex; +} VkBindImageMemorySwapchainInfoKHX; + +typedef struct VkAcquireNextImageInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint64_t timeout; + VkSemaphore semaphore; + VkFence fence; + uint32_t deviceMask; +} VkAcquireNextImageInfoKHX; + +typedef struct VkDeviceGroupPresentInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const uint32_t* pDeviceMasks; + VkDeviceGroupPresentModeFlagBitsKHX mode; +} VkDeviceGroupPresentInfoKHX; + +typedef struct VkDeviceGroupSwapchainCreateInfoKHX { + VkStructureType sType; + const void* pNext; + VkDeviceGroupPresentModeFlagsKHX modes; +} VkDeviceGroupSwapchainCreateInfoKHX; + + +typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeaturesKHX)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfoKHX* pBindInfos); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfoKHX* pBindInfos); +typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMaskKHX)(VkCommandBuffer commandBuffer, uint32_t deviceMask); +typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHX)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHX)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHX* pModes); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHX)(VkDevice device, const VkAcquireNextImageInfoKHX* pAcquireInfo, uint32_t* pImageIndex); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHX)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHX)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHX( + VkDevice device, + uint32_t heapIndex, + uint32_t localDeviceIndex, + uint32_t remoteDeviceIndex, + VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHX( + VkDevice device, + uint32_t bindInfoCount, + const VkBindBufferMemoryInfoKHX* pBindInfos); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHX( + VkDevice device, + uint32_t bindInfoCount, + const VkBindImageMemoryInfoKHX* pBindInfos); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMaskKHX( + VkCommandBuffer commandBuffer, + uint32_t deviceMask); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHX( + VkDevice device, + VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHX( + VkDevice device, + VkSurfaceKHR surface, + VkDeviceGroupPresentModeFlagsKHX* pModes); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHX( + VkDevice device, + const VkAcquireNextImageInfoKHX* pAcquireInfo, + uint32_t* pImageIndex); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHX( + VkCommandBuffer commandBuffer, + uint32_t baseGroupX, + uint32_t baseGroupY, + uint32_t baseGroupZ, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHX( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pRectCount, + VkRect2D* pRects); +#endif + +#define VK_EXT_validation_flags 1 +#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1 +#define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" + + +typedef enum VkValidationCheckEXT { + VK_VALIDATION_CHECK_ALL_EXT = 0, + VK_VALIDATION_CHECK_SHADERS_EXT = 1, + VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT, + VK_VALIDATION_CHECK_END_RANGE_EXT = VK_VALIDATION_CHECK_SHADERS_EXT, + VK_VALIDATION_CHECK_RANGE_SIZE_EXT = (VK_VALIDATION_CHECK_SHADERS_EXT - VK_VALIDATION_CHECK_ALL_EXT + 1), + VK_VALIDATION_CHECK_MAX_ENUM_EXT = 0x7FFFFFFF +} VkValidationCheckEXT; + +typedef struct VkValidationFlagsEXT { + VkStructureType sType; + const void* pNext; + uint32_t disabledValidationCheckCount; + VkValidationCheckEXT* pDisabledValidationChecks; +} VkValidationFlagsEXT; + + + +#ifdef VK_USE_PLATFORM_VI_NN +#define VK_NN_vi_surface 1 +#define VK_NN_VI_SURFACE_SPEC_VERSION 1 +#define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" + +typedef VkFlags VkViSurfaceCreateFlagsNN; + +typedef struct VkViSurfaceCreateInfoNN { + VkStructureType sType; + const void* pNext; + VkViSurfaceCreateFlagsNN flags; + void* window; +} VkViSurfaceCreateInfoNN; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( + VkInstance instance, + const VkViSurfaceCreateInfoNN* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_VI_NN */ + +#define VK_EXT_shader_subgroup_ballot 1 +#define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1 +#define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot" + + +#define VK_EXT_shader_subgroup_vote 1 +#define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1 +#define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" + + +#define VK_KHX_device_group_creation 1 +#define VK_KHX_DEVICE_GROUP_CREATION_SPEC_VERSION 1 +#define VK_KHX_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHX_device_group_creation" + +typedef struct VkPhysicalDeviceGroupPropertiesKHX { + VkStructureType sType; + void* pNext; + uint32_t physicalDeviceCount; + VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE_KHX]; + VkBool32 subsetAllocation; +} VkPhysicalDeviceGroupPropertiesKHX; + +typedef struct VkDeviceGroupDeviceCreateInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t physicalDeviceCount; + const VkPhysicalDevice* pPhysicalDevices; +} VkDeviceGroupDeviceCreateInfoKHX; + + +typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroupsKHX)(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHX( + VkInstance instance, + uint32_t* pPhysicalDeviceGroupCount, + VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties); +#endif + +#define VK_NVX_device_generated_commands 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkObjectTableNVX) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNVX) + +#define VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 +#define VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NVX_device_generated_commands" + + +typedef enum VkIndirectCommandsTokenTypeNVX { + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX = 0, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX = 1, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX = 2, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX = 3, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX = 4, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX = 5, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX = 6, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX = 7, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = (VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX + 1), + VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF +} VkIndirectCommandsTokenTypeNVX; + +typedef enum VkObjectEntryTypeNVX { + VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX = 0, + VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX = 1, + VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX = 2, + VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX = 3, + VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX = 4, + VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX, + VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX, + VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = (VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX - VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX + 1), + VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF +} VkObjectEntryTypeNVX; + + +typedef enum VkIndirectCommandsLayoutUsageFlagBitsNVX { + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = 0x00000001, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = 0x00000002, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = 0x00000004, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = 0x00000008, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF +} VkIndirectCommandsLayoutUsageFlagBitsNVX; +typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNVX; + +typedef enum VkObjectEntryUsageFlagBitsNVX { + VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = 0x00000001, + VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = 0x00000002, + VK_OBJECT_ENTRY_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF +} VkObjectEntryUsageFlagBitsNVX; +typedef VkFlags VkObjectEntryUsageFlagsNVX; + +typedef struct VkDeviceGeneratedCommandsFeaturesNVX { + VkStructureType sType; + const void* pNext; + VkBool32 computeBindingPointSupport; +} VkDeviceGeneratedCommandsFeaturesNVX; + +typedef struct VkDeviceGeneratedCommandsLimitsNVX { + VkStructureType sType; + const void* pNext; + uint32_t maxIndirectCommandsLayoutTokenCount; + uint32_t maxObjectEntryCounts; + uint32_t minSequenceCountBufferOffsetAlignment; + uint32_t minSequenceIndexBufferOffsetAlignment; + uint32_t minCommandsTokenBufferOffsetAlignment; +} VkDeviceGeneratedCommandsLimitsNVX; + +typedef struct VkIndirectCommandsTokenNVX { + VkIndirectCommandsTokenTypeNVX tokenType; + VkBuffer buffer; + VkDeviceSize offset; +} VkIndirectCommandsTokenNVX; + +typedef struct VkIndirectCommandsLayoutTokenNVX { + VkIndirectCommandsTokenTypeNVX tokenType; + uint32_t bindingUnit; + uint32_t dynamicCount; + uint32_t divisor; +} VkIndirectCommandsLayoutTokenNVX; + +typedef struct VkIndirectCommandsLayoutCreateInfoNVX { + VkStructureType sType; + const void* pNext; + VkPipelineBindPoint pipelineBindPoint; + VkIndirectCommandsLayoutUsageFlagsNVX flags; + uint32_t tokenCount; + const VkIndirectCommandsLayoutTokenNVX* pTokens; +} VkIndirectCommandsLayoutCreateInfoNVX; + +typedef struct VkCmdProcessCommandsInfoNVX { + VkStructureType sType; + const void* pNext; + VkObjectTableNVX objectTable; + VkIndirectCommandsLayoutNVX indirectCommandsLayout; + uint32_t indirectCommandsTokenCount; + const VkIndirectCommandsTokenNVX* pIndirectCommandsTokens; + uint32_t maxSequencesCount; + VkCommandBuffer targetCommandBuffer; + VkBuffer sequencesCountBuffer; + VkDeviceSize sequencesCountOffset; + VkBuffer sequencesIndexBuffer; + VkDeviceSize sequencesIndexOffset; +} VkCmdProcessCommandsInfoNVX; + +typedef struct VkCmdReserveSpaceForCommandsInfoNVX { + VkStructureType sType; + const void* pNext; + VkObjectTableNVX objectTable; + VkIndirectCommandsLayoutNVX indirectCommandsLayout; + uint32_t maxSequencesCount; +} VkCmdReserveSpaceForCommandsInfoNVX; + +typedef struct VkObjectTableCreateInfoNVX { + VkStructureType sType; + const void* pNext; + uint32_t objectCount; + const VkObjectEntryTypeNVX* pObjectEntryTypes; + const uint32_t* pObjectEntryCounts; + const VkObjectEntryUsageFlagsNVX* pObjectEntryUsageFlags; + uint32_t maxUniformBuffersPerDescriptor; + uint32_t maxStorageBuffersPerDescriptor; + uint32_t maxStorageImagesPerDescriptor; + uint32_t maxSampledImagesPerDescriptor; + uint32_t maxPipelineLayouts; +} VkObjectTableCreateInfoNVX; + +typedef struct VkObjectTableEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; +} VkObjectTableEntryNVX; + +typedef struct VkObjectTablePipelineEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipeline pipeline; +} VkObjectTablePipelineEntryNVX; + +typedef struct VkObjectTableDescriptorSetEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipelineLayout pipelineLayout; + VkDescriptorSet descriptorSet; +} VkObjectTableDescriptorSetEntryNVX; + +typedef struct VkObjectTableVertexBufferEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkBuffer buffer; +} VkObjectTableVertexBufferEntryNVX; + +typedef struct VkObjectTableIndexBufferEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkBuffer buffer; + VkIndexType indexType; +} VkObjectTableIndexBufferEntryNVX; + +typedef struct VkObjectTablePushConstantEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipelineLayout pipelineLayout; + VkShaderStageFlags stageFlags; +} VkObjectTablePushConstantEntryNVX; + + +typedef void (VKAPI_PTR *PFN_vkCmdProcessCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo); +typedef void (VKAPI_PTR *PFN_vkCmdReserveSpaceForCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCreateIndirectCommandsLayoutNVX)(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyIndirectCommandsLayoutNVX)(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateObjectTableNVX)(VkDevice device, const VkObjectTableCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkObjectTableNVX* pObjectTable); +typedef void (VKAPI_PTR *PFN_vkDestroyObjectTableNVX)(VkDevice device, VkObjectTableNVX objectTable, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectTableEntryNVX* const* ppObjectTableEntries, const uint32_t* pObjectIndices); +typedef VkResult (VKAPI_PTR *PFN_vkUnregisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectEntryTypeNVX* pObjectEntryTypes, const uint32_t* pObjectIndices); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)(VkPhysicalDevice physicalDevice, VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, VkDeviceGeneratedCommandsLimitsNVX* pLimits); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdProcessCommandsNVX( + VkCommandBuffer commandBuffer, + const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdReserveSpaceForCommandsNVX( + VkCommandBuffer commandBuffer, + const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNVX( + VkDevice device, + const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNVX( + VkDevice device, + VkIndirectCommandsLayoutNVX indirectCommandsLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateObjectTableNVX( + VkDevice device, + const VkObjectTableCreateInfoNVX* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkObjectTableNVX* pObjectTable); + +VKAPI_ATTR void VKAPI_CALL vkDestroyObjectTableNVX( + VkDevice device, + VkObjectTableNVX objectTable, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterObjectsNVX( + VkDevice device, + VkObjectTableNVX objectTable, + uint32_t objectCount, + const VkObjectTableEntryNVX* const* ppObjectTableEntries, + const uint32_t* pObjectIndices); + +VKAPI_ATTR VkResult VKAPI_CALL vkUnregisterObjectsNVX( + VkDevice device, + VkObjectTableNVX objectTable, + uint32_t objectCount, + const VkObjectEntryTypeNVX* pObjectEntryTypes, + const uint32_t* pObjectIndices); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX( + VkPhysicalDevice physicalDevice, + VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, + VkDeviceGeneratedCommandsLimitsNVX* pLimits); +#endif + +#define VK_NV_clip_space_w_scaling 1 +#define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1 +#define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling" + +typedef struct VkViewportWScalingNV { + float xcoeff; + float ycoeff; +} VkViewportWScalingNV; + +typedef struct VkPipelineViewportWScalingStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 viewportWScalingEnable; + uint32_t viewportCount; + const VkViewportWScalingNV* pViewportWScalings; +} VkPipelineViewportWScalingStateCreateInfoNV; + + +typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV* pViewportWScalings); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewportWScalingNV* pViewportWScalings); +#endif + +#define VK_EXT_direct_mode_display 1 +#define VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION 1 +#define VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME "VK_EXT_direct_mode_display" + +typedef VkResult (VKAPI_PTR *PFN_vkReleaseDisplayEXT)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display); +#endif + +#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#define VK_EXT_acquire_xlib_display 1 +#include + +#define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 +#define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" + +typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); +typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( + VkPhysicalDevice physicalDevice, + Display* dpy, + VkDisplayKHR display); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( + VkPhysicalDevice physicalDevice, + Display* dpy, + RROutput rrOutput, + VkDisplayKHR* pDisplay); +#endif +#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ + +#define VK_EXT_display_surface_counter 1 +#define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1 +#define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter" +#define VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT + + +typedef enum VkSurfaceCounterFlagBitsEXT { + VK_SURFACE_COUNTER_VBLANK_EXT = 0x00000001, + VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkSurfaceCounterFlagBitsEXT; +typedef VkFlags VkSurfaceCounterFlagsEXT; + +typedef struct VkSurfaceCapabilities2EXT { + VkStructureType sType; + void* pNext; + uint32_t minImageCount; + uint32_t maxImageCount; + VkExtent2D currentExtent; + VkExtent2D minImageExtent; + VkExtent2D maxImageExtent; + uint32_t maxImageArrayLayers; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkSurfaceTransformFlagBitsKHR currentTransform; + VkCompositeAlphaFlagsKHR supportedCompositeAlpha; + VkImageUsageFlags supportedUsageFlags; + VkSurfaceCounterFlagsEXT supportedSurfaceCounters; +} VkSurfaceCapabilities2EXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT* pSurfaceCapabilities); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilities2EXT* pSurfaceCapabilities); +#endif + +#define VK_EXT_display_control 1 +#define VK_EXT_DISPLAY_CONTROL_SPEC_VERSION 1 +#define VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME "VK_EXT_display_control" + + +typedef enum VkDisplayPowerStateEXT { + VK_DISPLAY_POWER_STATE_OFF_EXT = 0, + VK_DISPLAY_POWER_STATE_SUSPEND_EXT = 1, + VK_DISPLAY_POWER_STATE_ON_EXT = 2, + VK_DISPLAY_POWER_STATE_BEGIN_RANGE_EXT = VK_DISPLAY_POWER_STATE_OFF_EXT, + VK_DISPLAY_POWER_STATE_END_RANGE_EXT = VK_DISPLAY_POWER_STATE_ON_EXT, + VK_DISPLAY_POWER_STATE_RANGE_SIZE_EXT = (VK_DISPLAY_POWER_STATE_ON_EXT - VK_DISPLAY_POWER_STATE_OFF_EXT + 1), + VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDisplayPowerStateEXT; + +typedef enum VkDeviceEventTypeEXT { + VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = 0, + VK_DEVICE_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT, + VK_DEVICE_EVENT_TYPE_END_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT, + VK_DEVICE_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT - VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT + 1), + VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDeviceEventTypeEXT; + +typedef enum VkDisplayEventTypeEXT { + VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = 0, + VK_DISPLAY_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT, + VK_DISPLAY_EVENT_TYPE_END_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT, + VK_DISPLAY_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT - VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT + 1), + VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDisplayEventTypeEXT; + +typedef struct VkDisplayPowerInfoEXT { + VkStructureType sType; + const void* pNext; + VkDisplayPowerStateEXT powerState; +} VkDisplayPowerInfoEXT; + +typedef struct VkDeviceEventInfoEXT { + VkStructureType sType; + const void* pNext; + VkDeviceEventTypeEXT deviceEvent; +} VkDeviceEventInfoEXT; + +typedef struct VkDisplayEventInfoEXT { + VkStructureType sType; + const void* pNext; + VkDisplayEventTypeEXT displayEvent; +} VkDisplayEventInfoEXT; + +typedef struct VkSwapchainCounterCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkSurfaceCounterFlagsEXT surfaceCounters; +} VkSwapchainCounterCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkDisplayPowerControlEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayPowerInfoEXT* pDisplayPowerInfo); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterDeviceEventEXT)(VkDevice device, const VkDeviceEventInfoEXT* pDeviceEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterDisplayEventEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayEventInfoEXT* pDisplayEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainCounterEXT)(VkDevice device, VkSwapchainKHR swapchain, VkSurfaceCounterFlagBitsEXT counter, uint64_t* pCounterValue); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkDisplayPowerControlEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayPowerInfoEXT* pDisplayPowerInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDeviceEventEXT( + VkDevice device, + const VkDeviceEventInfoEXT* pDeviceEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDisplayEventEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayEventInfoEXT* pDisplayEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT( + VkDevice device, + VkSwapchainKHR swapchain, + VkSurfaceCounterFlagBitsEXT counter, + uint64_t* pCounterValue); +#endif + +#define VK_GOOGLE_display_timing 1 +#define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1 +#define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing" + +typedef struct VkRefreshCycleDurationGOOGLE { + uint64_t refreshDuration; +} VkRefreshCycleDurationGOOGLE; + +typedef struct VkPastPresentationTimingGOOGLE { + uint32_t presentID; + uint64_t desiredPresentTime; + uint64_t actualPresentTime; + uint64_t earliestPresentTime; + uint64_t presentMargin; +} VkPastPresentationTimingGOOGLE; + +typedef struct VkPresentTimeGOOGLE { + uint32_t presentID; + uint64_t desiredPresentTime; +} VkPresentTimeGOOGLE; + +typedef struct VkPresentTimesInfoGOOGLE { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentTimeGOOGLE* pTimes; +} VkPresentTimesInfoGOOGLE; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetRefreshCycleDurationGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPastPresentationTimingGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE( + VkDevice device, + VkSwapchainKHR swapchain, + VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pPresentationTimingCount, + VkPastPresentationTimingGOOGLE* pPresentationTimings); +#endif + +#define VK_NV_sample_mask_override_coverage 1 +#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1 +#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage" + + +#define VK_NV_geometry_shader_passthrough 1 +#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1 +#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough" + + +#define VK_NV_viewport_array2 1 +#define VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION 1 +#define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME "VK_NV_viewport_array2" + + +#define VK_NVX_multiview_per_view_attributes 1 +#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION 1 +#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME "VK_NVX_multiview_per_view_attributes" + +typedef struct VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX { + VkStructureType sType; + void* pNext; + VkBool32 perViewPositionAllComponents; +} VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX; + + + +#define VK_NV_viewport_swizzle 1 +#define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1 +#define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle" + + +typedef enum VkViewportCoordinateSwizzleNV { + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7, + VK_VIEWPORT_COORDINATE_SWIZZLE_BEGIN_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV, + VK_VIEWPORT_COORDINATE_SWIZZLE_END_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV, + VK_VIEWPORT_COORDINATE_SWIZZLE_RANGE_SIZE_NV = (VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV + 1), + VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = 0x7FFFFFFF +} VkViewportCoordinateSwizzleNV; + +typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV; + +typedef struct VkViewportSwizzleNV { + VkViewportCoordinateSwizzleNV x; + VkViewportCoordinateSwizzleNV y; + VkViewportCoordinateSwizzleNV z; + VkViewportCoordinateSwizzleNV w; +} VkViewportSwizzleNV; + +typedef struct VkPipelineViewportSwizzleStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineViewportSwizzleStateCreateFlagsNV flags; + uint32_t viewportCount; + const VkViewportSwizzleNV* pViewportSwizzles; +} VkPipelineViewportSwizzleStateCreateInfoNV; + + + +#define VK_EXT_discard_rectangles 1 +#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1 +#define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles" + + +typedef enum VkDiscardRectangleModeEXT { + VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0, + VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1, + VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT, + VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT, + VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT = (VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT - VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT + 1), + VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDiscardRectangleModeEXT; + +typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT; + +typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t maxDiscardRectangles; +} VkPhysicalDeviceDiscardRectanglePropertiesEXT; + +typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkPipelineDiscardRectangleStateCreateFlagsEXT flags; + VkDiscardRectangleModeEXT discardRectangleMode; + uint32_t discardRectangleCount; + const VkRect2D* pDiscardRectangles; +} VkPipelineDiscardRectangleStateCreateInfoEXT; + + +typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( + VkCommandBuffer commandBuffer, + uint32_t firstDiscardRectangle, + uint32_t discardRectangleCount, + const VkRect2D* pDiscardRectangles); +#endif + +#define VK_EXT_swapchain_colorspace 1 +#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 3 +#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" + + +#define VK_EXT_hdr_metadata 1 +#define VK_EXT_HDR_METADATA_SPEC_VERSION 1 +#define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" + +typedef struct VkXYColorEXT { + float x; + float y; +} VkXYColorEXT; + +typedef struct VkHdrMetadataEXT { + VkStructureType sType; + const void* pNext; + VkXYColorEXT displayPrimaryRed; + VkXYColorEXT displayPrimaryGreen; + VkXYColorEXT displayPrimaryBlue; + VkXYColorEXT whitePoint; + float maxLuminance; + float minLuminance; + float maxContentLightLevel; + float maxFrameAverageLightLevel; +} VkHdrMetadataEXT; + + +typedef void (VKAPI_PTR *PFN_vkSetHdrMetadataEXT)(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainKHR* pSwapchains, + const VkHdrMetadataEXT* pMetadata); +#endif + +#ifdef VK_USE_PLATFORM_IOS_MVK +#define VK_MVK_ios_surface 1 +#define VK_MVK_IOS_SURFACE_SPEC_VERSION 2 +#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" + +typedef VkFlags VkIOSSurfaceCreateFlagsMVK; + +typedef struct VkIOSSurfaceCreateInfoMVK { + VkStructureType sType; + const void* pNext; + VkIOSSurfaceCreateFlagsMVK flags; + const void* pView; +} VkIOSSurfaceCreateInfoMVK; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( + VkInstance instance, + const VkIOSSurfaceCreateInfoMVK* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_IOS_MVK */ + +#ifdef VK_USE_PLATFORM_MACOS_MVK +#define VK_MVK_macos_surface 1 +#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2 +#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" + +typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; + +typedef struct VkMacOSSurfaceCreateInfoMVK { + VkStructureType sType; + const void* pNext; + VkMacOSSurfaceCreateFlagsMVK flags; + const void* pView; +} VkMacOSSurfaceCreateInfoMVK; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( + VkInstance instance, + const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_MACOS_MVK */ + +#define VK_EXT_sampler_filter_minmax 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" + + +typedef enum VkSamplerReductionModeEXT { + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = 0, + VK_SAMPLER_REDUCTION_MODE_MIN_EXT = 1, + VK_SAMPLER_REDUCTION_MODE_MAX_EXT = 2, + VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, + VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_MAX_EXT, + VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT = (VK_SAMPLER_REDUCTION_MODE_MAX_EXT - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT + 1), + VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkSamplerReductionModeEXT; + +typedef struct VkSamplerReductionModeCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkSamplerReductionModeEXT reductionMode; +} VkSamplerReductionModeCreateInfoEXT; + +typedef struct VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; +} VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; + + + +#define VK_AMD_gpu_shader_int16 1 +#define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 1 +#define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" + + +#define VK_AMD_mixed_attachment_samples 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" + + +#define VK_EXT_shader_stencil_export 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" + + +#define VK_EXT_blend_operation_advanced 1 +#define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 +#define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" + + +typedef enum VkBlendOverlapEXT { + VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, + VK_BLEND_OVERLAP_DISJOINT_EXT = 1, + VK_BLEND_OVERLAP_CONJOINT_EXT = 2, + VK_BLEND_OVERLAP_BEGIN_RANGE_EXT = VK_BLEND_OVERLAP_UNCORRELATED_EXT, + VK_BLEND_OVERLAP_END_RANGE_EXT = VK_BLEND_OVERLAP_CONJOINT_EXT, + VK_BLEND_OVERLAP_RANGE_SIZE_EXT = (VK_BLEND_OVERLAP_CONJOINT_EXT - VK_BLEND_OVERLAP_UNCORRELATED_EXT + 1), + VK_BLEND_OVERLAP_MAX_ENUM_EXT = 0x7FFFFFFF +} VkBlendOverlapEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 advancedBlendCoherentOperations; +} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t advancedBlendMaxColorAttachments; + VkBool32 advancedBlendIndependentBlend; + VkBool32 advancedBlendNonPremultipliedSrcColor; + VkBool32 advancedBlendNonPremultipliedDstColor; + VkBool32 advancedBlendCorrelatedOverlap; + VkBool32 advancedBlendAllOperations; +} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; + +typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 srcPremultiplied; + VkBool32 dstPremultiplied; + VkBlendOverlapEXT blendOverlap; +} VkPipelineColorBlendAdvancedStateCreateInfoEXT; + + + +#define VK_NV_fragment_coverage_to_color 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" + +typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV; + +typedef struct VkPipelineCoverageToColorStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageToColorStateCreateFlagsNV flags; + VkBool32 coverageToColorEnable; + uint32_t coverageToColorLocation; +} VkPipelineCoverageToColorStateCreateInfoNV; + + + +#define VK_NV_framebuffer_mixed_samples 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" + + +typedef enum VkCoverageModulationModeNV { + VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, + VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, + VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, + VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, + VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV = VK_COVERAGE_MODULATION_MODE_NONE_NV, + VK_COVERAGE_MODULATION_MODE_END_RANGE_NV = VK_COVERAGE_MODULATION_MODE_RGBA_NV, + VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV = (VK_COVERAGE_MODULATION_MODE_RGBA_NV - VK_COVERAGE_MODULATION_MODE_NONE_NV + 1), + VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = 0x7FFFFFFF +} VkCoverageModulationModeNV; + +typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV; + +typedef struct VkPipelineCoverageModulationStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageModulationStateCreateFlagsNV flags; + VkCoverageModulationModeNV coverageModulationMode; + VkBool32 coverageModulationTableEnable; + uint32_t coverageModulationTableCount; + const float* pCoverageModulationTable; +} VkPipelineCoverageModulationStateCreateInfoNV; + + + +#define VK_NV_fill_rectangle 1 +#define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 +#define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" + + +#define VK_EXT_post_depth_coverage 1 +#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 +#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" + + +#define VK_EXT_shader_viewport_index_layer 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c new file mode 100644 index 000000000..c79f372bf --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c @@ -0,0 +1,171 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#define DEBUG_DYNAMIC_KMSDRM 0 + +#include "SDL_kmsdrmdyn.h" + +#if DEBUG_DYNAMIC_KMSDRM +#include "SDL_log.h" +#endif + +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + +#include "SDL_name.h" +#include "SDL_loadso.h" + +typedef struct +{ + void *lib; + const char *libname; +} kmsdrmdynlib; + +#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC NULL +#endif +#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM NULL +#endif + +static kmsdrmdynlib kmsdrmlibs[] = { + {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC}, + {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM} +}; + +static void * +KMSDRM_GetSym(const char *fnname, int *pHasModule) +{ + int i; + void *fn = NULL; + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].lib != NULL) { + fn = SDL_LoadFunction(kmsdrmlibs[i].lib, fnname); + if (fn != NULL) + break; + } + } + +#if DEBUG_DYNAMIC_KMSDRM + if (fn != NULL) + SDL_Log("KMSDRM: Found '%s' in %s (%p)\n", fnname, kmsdrmlibs[i].libname, fn); + else + SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname); +#endif + + if (fn == NULL) + *pHasModule = 0; /* kill this module. */ + + return fn; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */ + +/* Define all the function pointers and wrappers... */ +#define SDL_KMSDRM_MODULE(modname) int SDL_KMSDRM_HAVE_##modname = 0; +#define SDL_KMSDRM_SYM(rc,fn,params) SDL_DYNKMSDRMFN_##fn KMSDRM_##fn = NULL; +#define SDL_KMSDRM_SYM_CONST(type,name) SDL_DYNKMSDRMCONST_##name KMSDRM_##name = NULL; +#include "SDL_kmsdrmsym.h" + +static int kmsdrm_load_refcount = 0; + +void +SDL_KMSDRM_UnloadSymbols(void) +{ + /* Don't actually unload if more than one module is using the libs... */ + if (kmsdrm_load_refcount > 0) { + if (--kmsdrm_load_refcount == 0) { +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + int i; +#endif + + /* set all the function pointers to NULL. */ +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 0; +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = NULL; +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = NULL; +#include "SDL_kmsdrmsym.h" + + +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].lib != NULL) { + SDL_UnloadObject(kmsdrmlibs[i].lib); + kmsdrmlibs[i].lib = NULL; + } + } +#endif + } + } +} + +/* returns non-zero if all needed symbols were loaded. */ +int +SDL_KMSDRM_LoadSymbols(void) +{ + int rc = 1; /* always succeed if not using Dynamic KMSDRM stuff. */ + + /* deal with multiple modules needing these symbols... */ + if (kmsdrm_load_refcount++ == 0) { +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + int i; + int *thismod = NULL; + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].libname != NULL) { + kmsdrmlibs[i].lib = SDL_LoadObject(kmsdrmlibs[i].libname); + } + } + +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */ +#include "SDL_kmsdrmsym.h" + +#define SDL_KMSDRM_MODULE(modname) thismod = &SDL_KMSDRM_HAVE_##modname; +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = (SDL_DYNKMSDRMFN_##fn) KMSDRM_GetSym(#fn,thismod); +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = *(SDL_DYNKMSDRMCONST_##name*) KMSDRM_GetSym(#name,thismod); +#include "SDL_kmsdrmsym.h" + + if ((SDL_KMSDRM_HAVE_LIBDRM) && (SDL_KMSDRM_HAVE_GBM)) { + /* all required symbols loaded. */ + SDL_ClearError(); + } else { + /* in case something got loaded... */ + SDL_KMSDRM_UnloadSymbols(); + rc = 0; + } + +#else /* no dynamic KMSDRM */ + +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */ +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = fn; +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = name; +#include "SDL_kmsdrmsym.h" + +#endif + } + + return rc; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h new file mode 100644 index 000000000..578b088d8 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h @@ -0,0 +1,53 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_kmsdrmdyn_h_ +#define SDL_kmsdrmdyn_h_ + +#include "../../SDL_internal.h" + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int SDL_KMSDRM_LoadSymbols(void); +void SDL_KMSDRM_UnloadSymbols(void); + +/* Declare all the function pointers and wrappers... */ +#define SDL_KMSDRM_SYM(rc,fn,params) \ + typedef rc (*SDL_DYNKMSDRMFN_##fn) params; \ + extern SDL_DYNKMSDRMFN_##fn KMSDRM_##fn; +#define SDL_KMSDRM_SYM_CONST(type, name) \ + typedef type SDL_DYNKMSDRMCONST_##name; \ + extern SDL_DYNKMSDRMCONST_##name KMSDRM_##name; +#include "SDL_kmsdrmsym.h" + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_kmsdrmdyn_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c new file mode 100644 index 000000000..5a611f697 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c @@ -0,0 +1,42 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmevents.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +void KMSDRM_PumpEvents(_THIS) +{ +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Poll(); +#endif + +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h new file mode 100644 index 000000000..3b88c281d --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_kmsdrmevents_h_ +#define SDL_kmsdrmevents_h_ + +extern void KMSDRM_PumpEvents(_THIS); +extern void KMSDRM_EventInit(_THIS); +extern void KMSDRM_EventQuit(_THIS); + +#endif /* SDL_kmsdrmevents_h_ */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c new file mode 100644 index 000000000..e23dd1310 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -0,0 +1,501 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmmouse.h" +#include "SDL_kmsdrmdyn.h" + +#include "../../events/SDL_mouse_c.h" +#include "../../events/default_cursor.h" + +static SDL_Cursor *KMSDRM_CreateDefaultCursor(void); +static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y); +static int KMSDRM_ShowCursor(SDL_Cursor * cursor); +static void KMSDRM_MoveCursor(SDL_Cursor * cursor); +static void KMSDRM_FreeCursor(SDL_Cursor * cursor); +static void KMSDRM_WarpMouse(SDL_Window * window, int x, int y); +static int KMSDRM_WarpMouseGlobal(int x, int y); + +static SDL_Cursor * +KMSDRM_CreateDefaultCursor(void) +{ + return SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY); +} + +/* Evaluate if a given cursor size is supported or not. Notably, current Intel gfx only support 64x64 and up. */ +static SDL_bool +KMSDRM_IsCursorSizeSupported (int w, int h, uint32_t bo_format) { + + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + int ret; + uint32_t bo_handle; + struct gbm_bo *bo = KMSDRM_gbm_bo_create(vdata->gbm, w, h, bo_format, + GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); + + if (bo == NULL) { + SDL_SetError("Could not create GBM cursor BO width size %dx%d for size testing", w, h); + goto cleanup; + } + + bo_handle = KMSDRM_gbm_bo_get_handle(bo).u32; + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, vdata->crtc_id, bo_handle, w, h); + + if (ret) { + goto cleanup; + } + else { + KMSDRM_gbm_bo_destroy(bo); + return SDL_TRUE; + } + +cleanup: + if (bo != NULL) { + KMSDRM_gbm_bo_destroy(bo); + } + return SDL_FALSE; +} + +/* Create a cursor from a surface */ +static SDL_Cursor * +KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) +{ + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + SDL_PixelFormat *pixlfmt = surface->format; + KMSDRM_CursorData *curdata; + SDL_Cursor *cursor; + SDL_bool cursor_supported = SDL_FALSE; + int i, ret, usable_cursor_w, usable_cursor_h; + uint32_t bo_format, bo_stride; + char *buffer = NULL; + size_t bufsize; + + switch(pixlfmt->format) { + case SDL_PIXELFORMAT_RGB332: + bo_format = GBM_FORMAT_RGB332; + break; + case SDL_PIXELFORMAT_ARGB4444: + bo_format = GBM_FORMAT_ARGB4444; + break; + case SDL_PIXELFORMAT_RGBA4444: + bo_format = GBM_FORMAT_RGBA4444; + break; + case SDL_PIXELFORMAT_ABGR4444: + bo_format = GBM_FORMAT_ABGR4444; + break; + case SDL_PIXELFORMAT_BGRA4444: + bo_format = GBM_FORMAT_BGRA4444; + break; + case SDL_PIXELFORMAT_ARGB1555: + bo_format = GBM_FORMAT_ARGB1555; + break; + case SDL_PIXELFORMAT_RGBA5551: + bo_format = GBM_FORMAT_RGBA5551; + break; + case SDL_PIXELFORMAT_ABGR1555: + bo_format = GBM_FORMAT_ABGR1555; + break; + case SDL_PIXELFORMAT_BGRA5551: + bo_format = GBM_FORMAT_BGRA5551; + break; + case SDL_PIXELFORMAT_RGB565: + bo_format = GBM_FORMAT_RGB565; + break; + case SDL_PIXELFORMAT_BGR565: + bo_format = GBM_FORMAT_BGR565; + break; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_RGB24: + bo_format = GBM_FORMAT_RGB888; + break; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_BGR24: + bo_format = GBM_FORMAT_BGR888; + break; + case SDL_PIXELFORMAT_RGBX8888: + bo_format = GBM_FORMAT_RGBX8888; + break; + case SDL_PIXELFORMAT_BGRX8888: + bo_format = GBM_FORMAT_BGRX8888; + break; + case SDL_PIXELFORMAT_ARGB8888: + bo_format = GBM_FORMAT_ARGB8888; + break; + case SDL_PIXELFORMAT_RGBA8888: + bo_format = GBM_FORMAT_RGBA8888; + break; + case SDL_PIXELFORMAT_ABGR8888: + bo_format = GBM_FORMAT_ABGR8888; + break; + case SDL_PIXELFORMAT_BGRA8888: + bo_format = GBM_FORMAT_BGRA8888; + break; + case SDL_PIXELFORMAT_ARGB2101010: + bo_format = GBM_FORMAT_ARGB2101010; + break; + default: + SDL_SetError("Unsupported pixel format for cursor"); + return NULL; + } + + if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, bo_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE)) { + SDL_SetError("Unsupported pixel format for cursor"); + return NULL; + } + + cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); + if (cursor == NULL) { + SDL_OutOfMemory(); + return NULL; + } + curdata = (KMSDRM_CursorData *) SDL_calloc(1, sizeof(*curdata)); + if (curdata == NULL) { + SDL_OutOfMemory(); + SDL_free(cursor); + return NULL; + } + + /* We have to know beforehand if a cursor with the same size as the surface is supported. + * If it's not, we have to find an usable cursor size and use an intermediate and clean buffer. + * If we can't find a cursor size supported by the hardware, we won't go on trying to + * call SDL_SetCursor() later. */ + + usable_cursor_w = surface->w; + usable_cursor_h = surface->h; + + while (usable_cursor_w <= MAX_CURSOR_W && usable_cursor_h <= MAX_CURSOR_H) { + if (KMSDRM_IsCursorSizeSupported(usable_cursor_w, usable_cursor_h, bo_format)) { + cursor_supported = SDL_TRUE; + break; + } + usable_cursor_w += usable_cursor_w; + usable_cursor_h += usable_cursor_h; + } + + if (!cursor_supported) { + SDL_SetError("Could not find a cursor size supported by the kernel driver"); + goto cleanup; + } + + curdata->hot_x = hot_x; + curdata->hot_y = hot_y; + curdata->w = usable_cursor_w; + curdata->h = usable_cursor_h; + + curdata->bo = KMSDRM_gbm_bo_create(vdata->gbm, usable_cursor_w, usable_cursor_h, bo_format, + GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); + + if (curdata->bo == NULL) { + SDL_SetError("Could not create GBM cursor BO"); + goto cleanup; + } + + bo_stride = KMSDRM_gbm_bo_get_stride(curdata->bo); + bufsize = bo_stride * curdata->h; + + if (surface->pitch != bo_stride) { + /* pitch doesn't match stride, must be copied to temp buffer */ + buffer = SDL_malloc(bufsize); + if (buffer == NULL) { + SDL_OutOfMemory(); + goto cleanup; + } + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + /* Could not lock surface */ + goto cleanup; + } + } + + /* Clean the whole temporary buffer */ + SDL_memset(buffer, 0x00, bo_stride * curdata->h); + + /* Copy to temporary buffer */ + for (i = 0; i < surface->h; i++) { + SDL_memcpy(buffer + (i * bo_stride), + ((char *)surface->pixels) + (i * surface->pitch), + surface->w * pixlfmt->BytesPerPixel); + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + if (KMSDRM_gbm_bo_write(curdata->bo, buffer, bufsize)) { + SDL_SetError("Could not write to GBM cursor BO"); + goto cleanup; + } + + /* Free temporary buffer */ + SDL_free(buffer); + buffer = NULL; + } else { + /* surface matches BO format */ + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + /* Could not lock surface */ + goto cleanup; + } + } + + ret = KMSDRM_gbm_bo_write(curdata->bo, surface->pixels, bufsize); + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + if (ret) { + SDL_SetError("Could not write to GBM cursor BO"); + goto cleanup; + } + } + + cursor->driverdata = curdata; + + return cursor; + +cleanup: + if (buffer != NULL) { + SDL_free(buffer); + } + if (cursor != NULL) { + SDL_free(cursor); + } + if (curdata != NULL) { + if (curdata->bo != NULL) { + KMSDRM_gbm_bo_destroy(curdata->bo); + } + SDL_free(curdata); + } + return NULL; +} + +/* Show the specified cursor, or hide if cursor is NULL */ +static int +KMSDRM_ShowCursor(SDL_Cursor * cursor) +{ + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + SDL_Mouse *mouse; + KMSDRM_CursorData *curdata; + SDL_VideoDisplay *display = NULL; + SDL_DisplayData *ddata = NULL; + int ret; + uint32_t bo_handle; + + mouse = SDL_GetMouse(); + if (mouse == NULL) { + return SDL_SetError("No mouse."); + } + + if (mouse->focus != NULL) { + display = SDL_GetDisplayForWindow(mouse->focus); + if (display != NULL) { + ddata = (SDL_DisplayData*) display->driverdata; + } + } + + if (cursor == NULL) { + /* Hide current cursor */ + if ( mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + + if (curdata->crtc_id != 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, curdata->crtc_id, 0, 0, 0); + if (ret) { + SDL_SetError("Could not hide current cursor with drmModeSetCursor()."); + return ret; + } + /* Mark previous cursor as not-displayed */ + curdata->crtc_id = 0; + + return 0; + } + } + /* otherwise if possible, hide global cursor */ + if (ddata != NULL && ddata->crtc_id != 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, 0, 0, 0); + if (ret) { + SDL_SetError("Could not hide display's cursor with drmModeSetCursor()."); + return ret; + } + return 0; + } + + return SDL_SetError("Couldn't find cursor to hide."); + } + /* If cursor != NULL, show new cursor on display */ + if (display == NULL) { + return SDL_SetError("Could not get display for mouse."); + } + if (ddata == NULL) { + return SDL_SetError("Could not get display driverdata."); + } + + curdata = (KMSDRM_CursorData *) cursor->driverdata; + if (curdata == NULL || curdata->bo == NULL) { + return SDL_SetError("Cursor not initialized properly."); + } + + bo_handle = KMSDRM_gbm_bo_get_handle(curdata->bo).u32; + if (curdata->hot_x == 0 && curdata->hot_y == 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, bo_handle, + curdata->w, curdata->h); + } else { + ret = KMSDRM_drmModeSetCursor2(vdata->drm_fd, ddata->crtc_id, bo_handle, + curdata->w, curdata->h, + curdata->hot_x, curdata->hot_y); + } + if (ret) { + SDL_SetError("drmModeSetCursor failed."); + return ret; + } + + curdata->crtc_id = ddata->crtc_id; + + return 0; +} + +/* Free a window manager cursor */ +static void +KMSDRM_FreeCursor(SDL_Cursor * cursor) +{ + KMSDRM_CursorData *curdata; + int drm_fd; + + if (cursor != NULL) { + curdata = (KMSDRM_CursorData *) cursor->driverdata; + + if (curdata != NULL) { + if (curdata->bo != NULL) { + if (curdata->crtc_id != 0) { + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + /* Hide the cursor if previously shown on a CRTC */ + KMSDRM_drmModeSetCursor(drm_fd, curdata->crtc_id, 0, 0, 0); + curdata->crtc_id = 0; + } + KMSDRM_gbm_bo_destroy(curdata->bo); + curdata->bo = NULL; + } + SDL_free(cursor->driverdata); + } + SDL_free(cursor); + } +} + +/* Warp the mouse to (x,y) */ +static void +KMSDRM_WarpMouse(SDL_Window * window, int x, int y) +{ + /* Only one global/fullscreen window is supported */ + KMSDRM_WarpMouseGlobal(x, y); +} + +/* Warp the mouse to (x,y) */ +static int +KMSDRM_WarpMouseGlobal(int x, int y) +{ + KMSDRM_CursorData *curdata; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + /* Update internal mouse position. */ + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y); + + /* And now update the cursor graphic position on screen. */ + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + if (curdata->bo != NULL) { + + if (curdata->crtc_id != 0) { + int ret, drm_fd; + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, x, y); + + if (ret) { + SDL_SetError("drmModeMoveCursor() failed."); + } + + return ret; + } else { + return SDL_SetError("Cursor is not currently shown."); + } + } else { + return SDL_SetError("Cursor not initialized properly."); + } + } else { + return SDL_SetError("No mouse or current cursor."); + } +} + +void +KMSDRM_InitMouse(_THIS) +{ + /* FIXME: Using UDEV it should be possible to scan all mice + * but there's no point in doing so as there's no multimice support...yet! + */ + SDL_Mouse *mouse = SDL_GetMouse(); + + mouse->CreateCursor = KMSDRM_CreateCursor; + mouse->ShowCursor = KMSDRM_ShowCursor; + mouse->MoveCursor = KMSDRM_MoveCursor; + mouse->FreeCursor = KMSDRM_FreeCursor; + mouse->WarpMouse = KMSDRM_WarpMouse; + mouse->WarpMouseGlobal = KMSDRM_WarpMouseGlobal; + + SDL_SetDefaultCursor(KMSDRM_CreateDefaultCursor()); +} + +void +KMSDRM_QuitMouse(_THIS) +{ + /* TODO: ? */ +} + +/* This is called when a mouse motion event occurs */ +static void +KMSDRM_MoveCursor(SDL_Cursor * cursor) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + KMSDRM_CursorData *curdata; + int drm_fd, ret; + + /* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity! + That's why we move the cursor graphic ONLY. */ + if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y); + + if (ret) { + SDL_SetError("drmModeMoveCursor() failed."); + } + } +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h new file mode 100644 index 000000000..754417de5 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_KMSDRM_mouse_h_ +#define SDL_KMSDRM_mouse_h_ + +#include + +#define MAX_CURSOR_W 512 +#define MAX_CURSOR_H 512 + +typedef struct _KMSDRM_CursorData +{ + struct gbm_bo *bo; + uint32_t crtc_id; + int hot_x, hot_y; + int w, h; +} KMSDRM_CursorData; + +extern void KMSDRM_InitMouse(_THIS); +extern void KMSDRM_QuitMouse(_THIS); + +#endif /* SDL_KMSDRM_mouse_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c new file mode 100644 index 000000000..7a0b079ff --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -0,0 +1,189 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL + +#include "SDL_log.h" + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmopengles.h" +#include "SDL_kmsdrmdyn.h" + +#ifndef EGL_PLATFORM_GBM_MESA +#define EGL_PLATFORM_GBM_MESA 0x31D7 +#endif + +/* EGL implementation of SDL OpenGL support */ + +int +KMSDRM_GLES_LoadLibrary(_THIS, const char *path) { + return SDL_EGL_LoadLibrary(_this, path, ((SDL_VideoData *)_this->driverdata)->gbm, EGL_PLATFORM_GBM_MESA); +} + +SDL_EGL_CreateContext_impl(KMSDRM) + +SDL_bool +KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup"); + return SDL_FALSE; + } + + wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->next_bo == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup"); + return SDL_FALSE; + } + + fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo); + if (fb_info == NULL) { + return SDL_FALSE; + } + + if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC to a GBM buffer"); + return SDL_FALSE; + + } + + wdata->crtc_ready = SDL_TRUE; + return SDL_TRUE; +} + +int KMSDRM_GLES_SetSwapInterval(_THIS, int interval) { + if (!_this->egl_data) { + return SDL_SetError("EGL not initialized"); + } + + if (interval == 0 || interval == 1) { + _this->egl_data->egl_swapinterval = interval; + } else { + return SDL_SetError("Only swap intervals of 0 or 1 are supported"); + } + + return 0; +} + +int +KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + int ret; + + /* Do we still need to wait for a flip? */ + int timeout = 0; + if (_this->egl_data->egl_swapinterval == 1) { + timeout = -1; + } + if (!KMSDRM_WaitPageFlip(_this, wdata, timeout)) { + return 0; + } + + /* Release previously displayed buffer (which is now the backbuffer) and lock a new one */ + if (wdata->next_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(wdata->gs, wdata->current_bo); + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Released GBM surface %p", (void *)wdata->next_bo); */ + + wdata->current_bo = wdata->next_bo; + wdata->next_bo = NULL; + } + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed."); + return 0; + } + + if (wdata->current_bo == NULL) { + wdata->current_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->current_bo == NULL) { + return 0; + } + } + + wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->next_bo == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer"); + return 0; + /* } else { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Locked GBM surface %p", (void *)wdata->next_bo); */ + } + + fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo); + if (fb_info == NULL) { + return 0; + } + if (_this->egl_data->egl_swapinterval == 0) { + /* Swap buffers instantly, possible tearing */ + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModeSetCrtc(%d, %u, %u, 0, 0, &%u, 1, &%ux%u@%u)", + vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, vdata->saved_conn_id, + displaydata->cur_mode.hdisplay, displaydata->cur_mode.vdisplay, displaydata->cur_mode.vrefresh); */ + ret = KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode); + if(ret != 0) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not pageflip with drmModeSetCrtc: %d", ret); + } + } else { + /* Queue page flip at vsync */ + + /* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not, + or FlipPage won't work in some cases. */ + if (!wdata->crtc_ready) { + if(!KMSDRM_GLES_SetupCrtc(_this, window)) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips"); + return 0; + } + } + + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModePageFlip(%d, %u, %u, DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip)", + vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id); */ + ret = KMSDRM_drmModePageFlip(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip); + if (ret == 0) { + wdata->waiting_for_flip = SDL_TRUE; + } else { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not queue pageflip: %d", ret); + } + + /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios. + Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 " to enable this. */ + if (wdata->double_buffer) { + KMSDRM_WaitPageFlip(_this, wdata, -1); + } + } + + return 0; +} + +SDL_EGL_MakeCurrent_impl(KMSDRM) + +#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h new file mode 100644 index 000000000..d0a7bfaf8 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_kmsdrmopengles_h_ +#define SDL_kmsdrmopengles_h_ + +#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../SDL_egl_c.h" + +/* OpenGLES functions */ +#define KMSDRM_GLES_GetAttribute SDL_EGL_GetAttribute +#define KMSDRM_GLES_GetProcAddress SDL_EGL_GetProcAddress +#define KMSDRM_GLES_UnloadLibrary SDL_EGL_UnloadLibrary +#define KMSDRM_GLES_DeleteContext SDL_EGL_DeleteContext +#define KMSDRM_GLES_GetSwapInterval SDL_EGL_GetSwapInterval + +extern int KMSDRM_GLES_SetSwapInterval(_THIS, int interval); +extern int KMSDRM_GLES_LoadLibrary(_THIS, const char *path); +extern SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window); +extern int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); + +#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */ + +#endif /* SDL_kmsdrmopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h new file mode 100644 index 000000000..3ab231896 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h @@ -0,0 +1,99 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* *INDENT-OFF* */ + +#ifndef SDL_KMSDRM_MODULE +#define SDL_KMSDRM_MODULE(modname) +#endif + +#ifndef SDL_KMSDRM_SYM +#define SDL_KMSDRM_SYM(rc,fn,params) +#endif + +#ifndef SDL_KMSDRM_SYM_CONST +#define SDL_KMSDRM_SYM_CONST(type, name) +#endif + + +SDL_KMSDRM_MODULE(LIBDRM) +SDL_KMSDRM_SYM(void,drmModeFreeResources,(drmModeResPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeFB,(drmModeFBPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeCrtc,(drmModeCrtcPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeConnector,(drmModeConnectorPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeEncoder,(drmModeEncoderPtr ptr)) +SDL_KMSDRM_SYM(drmModeResPtr,drmModeGetResources,(int fd)) +SDL_KMSDRM_SYM(int,drmModeAddFB,(int fd, uint32_t width, uint32_t height, uint8_t depth, + uint8_t bpp, uint32_t pitch, uint32_t bo_handle, + uint32_t *buf_id)) +SDL_KMSDRM_SYM(int,drmModeRmFB,(int fd, uint32_t bufferId)) +SDL_KMSDRM_SYM(drmModeFBPtr,drmModeGetFB,(int fd, uint32_t buf)) +SDL_KMSDRM_SYM(drmModeCrtcPtr,drmModeGetCrtc,(int fd, uint32_t crtcId)) +SDL_KMSDRM_SYM(int,drmModeSetCrtc,(int fd, uint32_t crtcId, uint32_t bufferId, + uint32_t x, uint32_t y, uint32_t *connectors, int count, + drmModeModeInfoPtr mode)) +SDL_KMSDRM_SYM(int,drmModeSetCursor,(int fd, uint32_t crtcId, uint32_t bo_handle, + uint32_t width, uint32_t height)) +SDL_KMSDRM_SYM(int,drmModeSetCursor2,(int fd, uint32_t crtcId, uint32_t bo_handle, + uint32_t width, uint32_t height, + int32_t hot_x, int32_t hot_y)) +SDL_KMSDRM_SYM(int,drmModeMoveCursor,(int fd, uint32_t crtcId, int x, int y)) +SDL_KMSDRM_SYM(drmModeEncoderPtr,drmModeGetEncoder,(int fd, uint32_t encoder_id)) +SDL_KMSDRM_SYM(drmModeConnectorPtr,drmModeGetConnector,(int fd, uint32_t connector_id)) +SDL_KMSDRM_SYM(int,drmHandleEvent,(int fd,drmEventContextPtr evctx)) +SDL_KMSDRM_SYM(int,drmModePageFlip,(int fd, uint32_t crtc_id, uint32_t fb_id, + uint32_t flags, void *user_data)) + + +SDL_KMSDRM_MODULE(GBM) +SDL_KMSDRM_SYM(int,gbm_device_get_fd,(struct gbm_device *gbm)) +SDL_KMSDRM_SYM(int,gbm_device_is_format_supported,(struct gbm_device *gbm, + uint32_t format, uint32_t usage)) +SDL_KMSDRM_SYM(void,gbm_device_destroy,(struct gbm_device *gbm)) +SDL_KMSDRM_SYM(struct gbm_device *,gbm_create_device,(int fd)) +SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_width,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_height,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_stride,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(union gbm_bo_handle,gbm_bo_get_handle,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(int,gbm_bo_write,(struct gbm_bo *bo, const void *buf, size_t count)) +SDL_KMSDRM_SYM(struct gbm_device *,gbm_bo_get_device,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(void,gbm_bo_set_user_data,(struct gbm_bo *bo, void *data, + void (*destroy_user_data)(struct gbm_bo *, void *))) +SDL_KMSDRM_SYM(void *,gbm_bo_get_user_data,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(void,gbm_bo_destroy,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(struct gbm_bo *,gbm_bo_create,(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t usage)) +SDL_KMSDRM_SYM(struct gbm_surface *,gbm_surface_create,(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t flags)) +SDL_KMSDRM_SYM(void,gbm_surface_destroy,(struct gbm_surface *surf)) +SDL_KMSDRM_SYM(struct gbm_bo *,gbm_surface_lock_front_buffer,(struct gbm_surface *surf)) +SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct gbm_bo *bo)) + + +#undef SDL_KMSDRM_MODULE +#undef SDL_KMSDRM_SYM +#undef SDL_KMSDRM_SYM_CONST + +/* *INDENT-ON* */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c new file mode 100644 index 000000000..7855eeddb --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -0,0 +1,664 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +/* SDL internals */ +#include "../SDL_sysvideo.h" +#include "SDL_syswm.h" +#include "SDL_log.h" +#include "SDL_hints.h" +#include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_keyboard_c.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +/* KMS/DRM declarations */ +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmevents.h" +#include "SDL_kmsdrmopengles.h" +#include "SDL_kmsdrmmouse.h" +#include "SDL_kmsdrmdyn.h" + +#define KMSDRM_DRI_CARD_0 "/dev/dri/card0" + +static int +KMSDRM_Available(void) +{ + int available = 0; + + int drm_fd = open(KMSDRM_DRI_CARD_0, O_RDWR | O_CLOEXEC); + if (drm_fd >= 0) { + if (SDL_KMSDRM_LoadSymbols()) { + drmModeRes *resources = KMSDRM_drmModeGetResources(drm_fd); + if (resources != NULL) { + available = 1; + KMSDRM_drmModeFreeResources(resources); + } + SDL_KMSDRM_UnloadSymbols(); + } + close(drm_fd); + } + + return available; +} + +static void +KMSDRM_Destroy(SDL_VideoDevice * device) +{ + if (device->driverdata != NULL) { + SDL_free(device->driverdata); + device->driverdata = NULL; + } + + SDL_free(device); + SDL_KMSDRM_UnloadSymbols(); +} + +static SDL_VideoDevice * +KMSDRM_Create(int devindex) +{ + SDL_VideoDevice *device; + SDL_VideoData *vdata; + + if (devindex < 0 || devindex > 99) { + SDL_SetError("devindex (%d) must be between 0 and 99.\n", devindex); + return NULL; + } + + if (!SDL_KMSDRM_LoadSymbols()) { + return NULL; + } + + /* Initialize SDL_VideoDevice structure */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + /* Initialize internal data */ + vdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + if (vdata == NULL) { + SDL_OutOfMemory(); + goto cleanup; + } + vdata->devindex = devindex; + vdata->drm_fd = -1; + + device->driverdata = vdata; + + /* Setup amount of available displays and current display */ + device->num_displays = 0; + + /* Set device free function */ + device->free = KMSDRM_Destroy; + + /* Setup all functions which we can handle */ + device->VideoInit = KMSDRM_VideoInit; + device->VideoQuit = KMSDRM_VideoQuit; + device->GetDisplayModes = KMSDRM_GetDisplayModes; + device->SetDisplayMode = KMSDRM_SetDisplayMode; + device->CreateSDLWindow = KMSDRM_CreateWindow; + device->CreateSDLWindowFrom = KMSDRM_CreateWindowFrom; + device->SetWindowTitle = KMSDRM_SetWindowTitle; + device->SetWindowIcon = KMSDRM_SetWindowIcon; + device->SetWindowPosition = KMSDRM_SetWindowPosition; + device->SetWindowSize = KMSDRM_SetWindowSize; + device->ShowWindow = KMSDRM_ShowWindow; + device->HideWindow = KMSDRM_HideWindow; + device->RaiseWindow = KMSDRM_RaiseWindow; + device->MaximizeWindow = KMSDRM_MaximizeWindow; + device->MinimizeWindow = KMSDRM_MinimizeWindow; + device->RestoreWindow = KMSDRM_RestoreWindow; + device->SetWindowGrab = KMSDRM_SetWindowGrab; + device->DestroyWindow = KMSDRM_DestroyWindow; + device->GetWindowWMInfo = KMSDRM_GetWindowWMInfo; +#if SDL_VIDEO_OPENGL_EGL + device->GL_LoadLibrary = KMSDRM_GLES_LoadLibrary; + device->GL_GetProcAddress = KMSDRM_GLES_GetProcAddress; + device->GL_UnloadLibrary = KMSDRM_GLES_UnloadLibrary; + device->GL_CreateContext = KMSDRM_GLES_CreateContext; + device->GL_MakeCurrent = KMSDRM_GLES_MakeCurrent; + device->GL_SetSwapInterval = KMSDRM_GLES_SetSwapInterval; + device->GL_GetSwapInterval = KMSDRM_GLES_GetSwapInterval; + device->GL_SwapWindow = KMSDRM_GLES_SwapWindow; + device->GL_DeleteContext = KMSDRM_GLES_DeleteContext; +#endif + + device->PumpEvents = KMSDRM_PumpEvents; + + return device; + +cleanup: + if (device != NULL) + SDL_free(device); + if (vdata != NULL) + SDL_free(vdata); + return NULL; +} + +VideoBootStrap KMSDRM_bootstrap = { + "KMSDRM", + "KMS/DRM Video Driver", + KMSDRM_Available, + KMSDRM_Create +}; + + +static void +KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data) +{ + KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data; + + if (fb_info && fb_info->drm_fd > 0 && fb_info->fb_id != 0) { + KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id); + } + + free(fb_info); +} + +KMSDRM_FBInfo * +KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo) +{ + uint32_t w, h, stride, handle; + int ret; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + + fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo); + if (fb_info != NULL) { + /* Have a previously used framebuffer, return it */ + return fb_info; + } + + /* Here a new DRM FB must be created */ + fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo)); + if (fb_info == NULL) { + SDL_OutOfMemory(); + return NULL; + } + fb_info->drm_fd = vdata->drm_fd; + + w = KMSDRM_gbm_bo_get_width(bo); + h = KMSDRM_gbm_bo_get_height(bo); + stride = KMSDRM_gbm_bo_get_stride(bo); + handle = KMSDRM_gbm_bo_get_handle(bo).u32; + + ret = KMSDRM_drmModeAddFB(vdata->drm_fd, w, h, 24, 32, stride, handle, &fb_info->fb_id); + if (ret < 0) { + free(fb_info); + return NULL; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "New DRM FB (%u): %ux%u, stride %u from BO %p", fb_info->fb_id, w, h, stride, (void *)bo); + + /* Associate our DRM framebuffer with this buffer object */ + KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback); + return fb_info; +} + +SDL_bool +KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout) { + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + + while (wdata->waiting_for_flip) { + vdata->drm_pollfd.revents = 0; + if (poll(&vdata->drm_pollfd, 1, timeout) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll error"); + return SDL_FALSE; + } + + if (vdata->drm_pollfd.revents & (POLLHUP | POLLERR)) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll hup or error"); + return SDL_FALSE; + } + + if (vdata->drm_pollfd.revents & POLLIN) { + /* Page flip? If so, drmHandleEvent will unset wdata->waiting_for_flip */ + KMSDRM_drmHandleEvent(vdata->drm_fd, &vdata->drm_evctx); + } else { + /* Timed out and page flip didn't happen */ + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Dropping frame while waiting_for_flip"); + return SDL_FALSE; + } + } + return SDL_TRUE; +} + +static void +KMSDRM_FlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) +{ + *((SDL_bool *) data) = SDL_FALSE; +} + + +/*****************************************************************************/ +/* SDL Video and Display initialization/handling functions */ +/* _this is a SDL_VideoDevice * */ +/*****************************************************************************/ +int +KMSDRM_VideoInit(_THIS) +{ + int i; + int ret = 0; + char *devname; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + drmModeRes *resources = NULL; + drmModeConnector *connector = NULL; + drmModeEncoder *encoder = NULL; + SDL_DisplayMode current_mode; + SDL_VideoDisplay display; + + /* Allocate display internal data */ + SDL_DisplayData *data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData)); + if (data == NULL) { + return SDL_OutOfMemory(); + } + + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()"); + + /* Open /dev/dri/cardNN */ + devname = (char *) SDL_calloc(1, 16); + if (devname == NULL) { + ret = SDL_OutOfMemory(); + goto cleanup; + } + SDL_snprintf(devname, 16, "/dev/dri/card%d", vdata->devindex); + vdata->drm_fd = open(devname, O_RDWR | O_CLOEXEC); + SDL_free(devname); + + if (vdata->drm_fd < 0) { + ret = SDL_SetError("Could not open /dev/dri/card%d.", vdata->devindex); + goto cleanup; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opened DRM FD (%d)", vdata->drm_fd); + + vdata->gbm = KMSDRM_gbm_create_device(vdata->drm_fd); + if (vdata->gbm == NULL) { + ret = SDL_SetError("Couldn't create gbm device."); + goto cleanup; + } + + /* Find the first available connector with modes */ + resources = KMSDRM_drmModeGetResources(vdata->drm_fd); + if (!resources) { + ret = SDL_SetError("drmModeGetResources(%d) failed", vdata->drm_fd); + goto cleanup; + } + + for (i = 0; i < resources->count_connectors; i++) { + connector = KMSDRM_drmModeGetConnector(vdata->drm_fd, resources->connectors[i]); + if (connector == NULL) + continue; + + if (connector->connection == DRM_MODE_CONNECTED && + connector->count_modes > 0) { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found connector %d with %d modes.", + connector->connector_id, connector->count_modes); + vdata->saved_conn_id = connector->connector_id; + break; + } + + KMSDRM_drmModeFreeConnector(connector); + connector = NULL; + } + + if (i == resources->count_connectors) { + ret = SDL_SetError("No currently active connector found."); + goto cleanup; + } + + for (i = 0; i < resources->count_encoders; i++) { + encoder = KMSDRM_drmModeGetEncoder(vdata->drm_fd, resources->encoders[i]); + + if (encoder == NULL) + continue; + + if (encoder->encoder_id == connector->encoder_id) { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found encoder %d.", encoder->encoder_id); + data->encoder_id = encoder->encoder_id; + break; + } + + KMSDRM_drmModeFreeEncoder(encoder); + encoder = NULL; + } + + if (i == resources->count_encoders) { + ret = SDL_SetError("No connected encoder found."); + goto cleanup; + } + + vdata->saved_crtc = KMSDRM_drmModeGetCrtc(vdata->drm_fd, encoder->crtc_id); + if (vdata->saved_crtc == NULL) { + ret = SDL_SetError("No CRTC found."); + goto cleanup; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Saved crtc_id %u, fb_id %u, (%u,%u), %ux%u", + vdata->saved_crtc->crtc_id, vdata->saved_crtc->buffer_id, vdata->saved_crtc->x, + vdata->saved_crtc->y, vdata->saved_crtc->width, vdata->saved_crtc->height); + data->crtc_id = encoder->crtc_id; + data->cur_mode = vdata->saved_crtc->mode; + vdata->crtc_id = encoder->crtc_id; + + SDL_zero(current_mode); + + current_mode.w = vdata->saved_crtc->mode.hdisplay; + current_mode.h = vdata->saved_crtc->mode.vdisplay; + current_mode.refresh_rate = vdata->saved_crtc->mode.vrefresh; + + /* FIXME ? + drmModeFB *fb = drmModeGetFB(vdata->drm_fd, vdata->saved_crtc->buffer_id); + current_mode.format = drmToSDLPixelFormat(fb->bpp, fb->depth); + drmModeFreeFB(fb); + */ + current_mode.format = SDL_PIXELFORMAT_ARGB8888; + + current_mode.driverdata = NULL; + + SDL_zero(display); + display.desktop_mode = current_mode; + display.current_mode = current_mode; + + display.driverdata = data; + /* SDL_VideoQuit will later SDL_free(display.driverdata) */ + SDL_AddVideoDisplay(&display); + + /* Setup page flip handler */ + vdata->drm_pollfd.fd = vdata->drm_fd; + vdata->drm_pollfd.events = POLLIN; + vdata->drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; + vdata->drm_evctx.page_flip_handler = KMSDRM_FlipHandler; + +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Init(); +#endif + + KMSDRM_InitMouse(_this); + +cleanup: + if (encoder != NULL) + KMSDRM_drmModeFreeEncoder(encoder); + if (connector != NULL) + KMSDRM_drmModeFreeConnector(connector); + if (resources != NULL) + KMSDRM_drmModeFreeResources(resources); + + if (ret != 0) { + /* Error (complete) cleanup */ + SDL_free(data); + if(vdata->saved_crtc != NULL) { + KMSDRM_drmModeFreeCrtc(vdata->saved_crtc); + vdata->saved_crtc = NULL; + } + if (vdata->gbm != NULL) { + KMSDRM_gbm_device_destroy(vdata->gbm); + vdata->gbm = NULL; + } + if (vdata->drm_fd >= 0) { + close(vdata->drm_fd); + vdata->drm_fd = -1; + } + } + return ret; +} + +void +KMSDRM_VideoQuit(_THIS) +{ + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoQuit()"); + + if (_this->gl_config.driver_loaded) { + SDL_GL_UnloadLibrary(); + } + + if(vdata->saved_crtc != NULL) { + if(vdata->drm_fd > 0 && vdata->saved_conn_id > 0) { + /* Restore saved CRTC settings */ + drmModeCrtc *crtc = vdata->saved_crtc; + if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id, + crtc->x, crtc->y, &vdata->saved_conn_id, 1, + &crtc->mode) != 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not restore original CRTC mode"); + } + } + KMSDRM_drmModeFreeCrtc(vdata->saved_crtc); + vdata->saved_crtc = NULL; + } + if (vdata->gbm != NULL) { + KMSDRM_gbm_device_destroy(vdata->gbm); + vdata->gbm = NULL; + } + if (vdata->drm_fd >= 0) { + close(vdata->drm_fd); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Closed DRM FD %d", vdata->drm_fd); + vdata->drm_fd = -1; + } +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Quit(); +#endif +} + +void +KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display) +{ + /* Only one display mode available, the current one */ + SDL_AddDisplayMode(display, &display->current_mode); +} + +int +KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) +{ + return 0; +} + +int +KMSDRM_CreateWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *wdata; + SDL_VideoDisplay *display; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + Uint32 surface_fmt, surface_flags; + + /* Allocate window internal data */ + wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); + if (wdata == NULL) { + SDL_OutOfMemory(); + goto error; + } + + wdata->waiting_for_flip = SDL_FALSE; + display = SDL_GetDisplayForWindow(window); + + /* Windows have one size for now */ + window->w = display->desktop_mode.w; + window->h = display->desktop_mode.h; + + /* Maybe you didn't ask for a fullscreen OpenGL window, but that's what you get */ + window->flags |= (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL); + + surface_fmt = GBM_FORMAT_XRGB8888; + surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; + + if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, surface_fmt, surface_flags)) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "GBM surface format not supported. Trying anyway."); + } + wdata->gs = KMSDRM_gbm_surface_create(vdata->gbm, window->w, window->h, surface_fmt, surface_flags); + +#if SDL_VIDEO_OPENGL_EGL + if (!_this->egl_data) { + if (SDL_GL_LoadLibrary(NULL) < 0) { + goto error; + } + } + wdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) wdata->gs); + + if (wdata->egl_surface == EGL_NO_SURFACE) { + SDL_SetError("Could not create EGL window surface"); + goto error; + } +#endif /* SDL_VIDEO_OPENGL_EGL */ + + /* In case we want low-latency, double-buffer video, we take note here */ + wdata->double_buffer = SDL_FALSE; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) { + wdata->double_buffer = SDL_TRUE; + } + + /* Window is created, but we have yet to set up CRTC to one of the GBM buffers if we want + drmModePageFlip to work, and we can't do it until EGL is completely setup, because we + need to do eglSwapBuffers so we can get a valid GBM buffer object to call + drmModeSetCrtc on it. */ + wdata->crtc_ready = SDL_FALSE; + + /* Setup driver data for this window */ + window->driverdata = wdata; + + /* One window, it always has focus */ + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); + + /* Window has been successfully created */ + return 0; + +error: + if (wdata != NULL) { +#if SDL_VIDEO_OPENGL_EGL + if (wdata->egl_surface != EGL_NO_SURFACE) + SDL_EGL_DestroySurface(_this, wdata->egl_surface); +#endif /* SDL_VIDEO_OPENGL_EGL */ + if (wdata->gs != NULL) + KMSDRM_gbm_surface_destroy(wdata->gs); + SDL_free(wdata); + } + return -1; +} + +void +KMSDRM_DestroyWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if(data) { + /* Wait for any pending page flips and unlock buffer */ + KMSDRM_WaitPageFlip(_this, data, -1); + if (data->next_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(data->gs, data->next_bo); + data->next_bo = NULL; + } + if (data->current_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(data->gs, data->current_bo); + data->current_bo = NULL; + } +#if SDL_VIDEO_OPENGL_EGL + SDL_EGL_MakeCurrent(_this, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (data->egl_surface != EGL_NO_SURFACE) { + SDL_EGL_DestroySurface(_this, data->egl_surface); + } +#endif /* SDL_VIDEO_OPENGL_EGL */ + if (data->gs != NULL) { + KMSDRM_gbm_surface_destroy(data->gs); + data->gs = NULL; + } + SDL_free(data); + window->driverdata = NULL; + } +} + +int +KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) +{ + return -1; +} + +void +KMSDRM_SetWindowTitle(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) +{ +} +void +KMSDRM_SetWindowPosition(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowSize(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_ShowWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_HideWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_RaiseWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_MaximizeWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_MinimizeWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_RestoreWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) +{ + +} + +/*****************************************************************************/ +/* SDL Window Manager function */ +/*****************************************************************************/ +SDL_bool +KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) +{ + if (info->version.major <= SDL_MAJOR_VERSION) { + return SDL_TRUE; + } else { + SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + return SDL_FALSE; + } + + /* Failed to get window manager information */ + return SDL_FALSE; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h new file mode 100644 index 000000000..5f00f0ebc --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h @@ -0,0 +1,124 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef __SDL_KMSDRMVIDEO_H__ +#define __SDL_KMSDRMVIDEO_H__ + +#include "../SDL_sysvideo.h" + +#include +#include +#include +#include +#include +#include +#if SDL_VIDEO_OPENGL_EGL +#include +#endif + +typedef struct SDL_VideoData +{ + int devindex; /* device index that was passed on creation */ + int drm_fd; /* DRM file desc */ + struct gbm_device *gbm; + drmEventContext drm_evctx; /* DRM event context */ + struct pollfd drm_pollfd; /* pollfd containing DRM file desc */ + drmModeCrtc *saved_crtc; /* Saved CRTC to restore on quit */ + uint32_t saved_conn_id; /* Saved DRM connector ID */ + uint32_t crtc_id; /* CRTC in use */ +} SDL_VideoData; + + +typedef struct SDL_DisplayData +{ + uint32_t encoder_id; + uint32_t crtc_id; + drmModeModeInfo cur_mode; +} SDL_DisplayData; + + +typedef struct SDL_WindowData +{ + struct gbm_surface *gs; + struct gbm_bo *current_bo; + struct gbm_bo *next_bo; + SDL_bool waiting_for_flip; + SDL_bool crtc_ready; + SDL_bool double_buffer; +#if SDL_VIDEO_OPENGL_EGL + EGLSurface egl_surface; +#endif +} SDL_WindowData; + +typedef struct KMSDRM_FBInfo +{ + int drm_fd; /* DRM file desc */ + uint32_t fb_id; /* DRM framebuffer ID */ +} KMSDRM_FBInfo; + +/* Helper functions */ +KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo); +SDL_bool KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout); + +/****************************************************************************/ +/* SDL_VideoDevice functions declaration */ +/****************************************************************************/ + +/* Display and window functions */ +int KMSDRM_VideoInit(_THIS); +void KMSDRM_VideoQuit(_THIS); +void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); +int KMSDRM_CreateWindow(_THIS, SDL_Window * window); +int KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); +void KMSDRM_SetWindowTitle(_THIS, SDL_Window * window); +void KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); +void KMSDRM_SetWindowPosition(_THIS, SDL_Window * window); +void KMSDRM_SetWindowSize(_THIS, SDL_Window * window); +void KMSDRM_ShowWindow(_THIS, SDL_Window * window); +void KMSDRM_HideWindow(_THIS, SDL_Window * window); +void KMSDRM_RaiseWindow(_THIS, SDL_Window * window); +void KMSDRM_MaximizeWindow(_THIS, SDL_Window * window); +void KMSDRM_MinimizeWindow(_THIS, SDL_Window * window); +void KMSDRM_RestoreWindow(_THIS, SDL_Window * window); +void KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); +void KMSDRM_DestroyWindow(_THIS, SDL_Window * window); + +/* Window manager function */ +SDL_bool KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, + struct SDL_SysWMinfo *info); + +/* OpenGL/OpenGL ES functions */ +int KMSDRM_GLES_LoadLibrary(_THIS, const char *path); +void *KMSDRM_GLES_GetProcAddress(_THIS, const char *proc); +void KMSDRM_GLES_UnloadLibrary(_THIS); +SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window); +int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int KMSDRM_GLES_SetSwapInterval(_THIS, int interval); +int KMSDRM_GLES_GetSwapInterval(_THIS); +int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window); +void KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context); + +#endif /* __SDL_KMSDRMVIDEO_H__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c index 6bbe53759..71dc73c8b 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h index a3638cf05..32364aaf0 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_mirdyn_h -#define _SDL_mirdyn_h +#ifndef SDL_mirdyn_h_ +#define SDL_mirdyn_h_ #include "../../SDL_internal.h" @@ -48,6 +48,6 @@ void SDL_MIR_UnloadSymbols(void); } #endif -#endif /* !defined _SDL_mirdyn_h */ +#endif /* !defined SDL_mirdyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirevents.c b/Engine/lib/sdl/src/video/mir/SDL_mirevents.c index e36986835..df92799f3 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirevents.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -141,7 +141,7 @@ HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure } static void -HandleMouseScroll(SDL_Window* sdl_window, int hscroll, int vscroll) +HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll) { SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL); } @@ -205,7 +205,7 @@ HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window) break; case mir_pointer_action_motion: { int x, y; - int hscroll, vscroll; + float hscroll, vscroll; SDL_Mouse* mouse = SDL_GetMouse(); x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x); y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y); @@ -237,7 +237,7 @@ HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window) } static void -MIR_HandleInput(MirInputEvent const* input_event, SDL_Window* window) +HandleInput(MirInputEvent const* input_event, SDL_Window* window) { switch (MIR_mir_input_event_get_type(input_event)) { case (mir_input_event_type_key): @@ -257,7 +257,7 @@ MIR_HandleInput(MirInputEvent const* input_event, SDL_Window* window) } static void -MIR_HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) +HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) { int new_w = MIR_mir_resize_event_get_width (resize_event); int new_h = MIR_mir_resize_event_get_height(resize_event); @@ -270,23 +270,28 @@ MIR_HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) } static void -MIR_HandleSurface(MirSurfaceEvent const* surface_event, SDL_Window* window) +HandleWindow(MirWindowEvent const* event, SDL_Window* window) { - MirSurfaceAttrib attrib = MIR_mir_surface_event_get_attribute(surface_event); - int value = MIR_mir_surface_event_get_attribute_value(surface_event); + MirWindowAttrib attrib = MIR_mir_window_event_get_attribute(event); + int value = MIR_mir_window_event_get_attribute_value(event); - if (attrib == mir_surface_attrib_focus) { - if (value == mir_surface_focused) { + if (attrib == mir_window_attrib_focus) { + if (value == mir_window_focus_state_focused) { SDL_SetKeyboardFocus(window); } - else if (value == mir_surface_unfocused) { + else if (value == mir_window_focus_state_unfocused) { SDL_SetKeyboardFocus(NULL); } } } +static void +MIR_HandleClose(SDL_Window* window) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + void -MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context) +MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context) { MirEventType event_type = MIR_mir_event_get_type(ev); SDL_Window* window = (SDL_Window*)context; @@ -294,13 +299,16 @@ MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context) if (window) { switch (event_type) { case (mir_event_type_input): - MIR_HandleInput(MIR_mir_event_get_input_event(ev), window); + HandleInput(MIR_mir_event_get_input_event(ev), window); break; case (mir_event_type_resize): - MIR_HandleResize(MIR_mir_event_get_resize_event(ev), window); + HandleResize(MIR_mir_event_get_resize_event(ev), window); break; - case (mir_event_type_surface): - MIR_HandleSurface(MIR_mir_event_get_surface_event(ev), window); + case (mir_event_type_window): + HandleWindow(MIR_mir_event_get_window_event(ev), window); + break; + case (mir_event_type_close_window): + MIR_HandleClose(window); break; default: break; diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirevents.h b/Engine/lib/sdl/src/video/mir/SDL_mirevents.h index 121c4b365..4b0f209cd 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirevents.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,15 +23,15 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirevents_h -#define _SDL_mirevents_h +#ifndef SDL_mirevents_h_ +#define SDL_mirevents_h_ #include extern void -MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context); +MIR_HandleEvent(MirWindow*, MirEvent const* ev, void* context); -#endif /* _SDL_mirevents_h */ +#endif /* SDL_mirevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c index 775bc0797..d678fff1f 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format, mir_data->software = SDL_TRUE; if (MIR_CreateWindow(_this, window) < 0) - return SDL_SetError("Failed to created a mir window."); + return SDL_SetError("Failed to create a mir window."); *format = MIR_GetSDLPixelFormat(mir_data->pixel_format); if (*format == SDL_PIXELFORMAT_UNKNOWN) @@ -70,7 +70,7 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window, char* s_dest; char* pixels; - bs = MIR_mir_surface_get_buffer_stream(mir_window->surface); + bs = MIR_mir_window_get_buffer_stream(mir_window->window); MIR_mir_buffer_stream_get_graphics_region(bs, ®ion); s_dest = region.vaddr; diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h index 22a579c03..502337c32 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirframebuffer_h -#define _SDL_mirframebuffer_h +#ifndef SDL_mirframebuffer_h_ +#define SDL_mirframebuffer_h_ #include "../SDL_sysvideo.h" @@ -41,7 +41,7 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* sdl_window, extern void MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* sdl_window); -#endif /* _SDL_mirframebuffer_h */ +#endif /* SDL_mirframebuffer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c index 1a22b28e8..5f6e38c9d 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,6 +41,7 @@ typedef struct { MirCursorConfiguration* conf; MirBufferStream* stream; + char const* name; } MIR_Cursor; static SDL_Cursor* @@ -55,6 +56,7 @@ MIR_CreateDefaultCursor() if (mir_cursor) { mir_cursor->conf = NULL; mir_cursor->stream = NULL; + mir_cursor->name = NULL; cursor->driverdata = mir_cursor; } else { @@ -137,12 +139,8 @@ static SDL_Cursor* MIR_CreateSystemCursor(SDL_SystemCursor id) { char const* cursor_name = NULL; - SDL_Cursor* cursor = MIR_CreateDefaultCursor(); - MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; - - if (!cursor) { - return NULL; - } + SDL_Cursor* cursor; + MIR_Cursor* mir_cursor; switch(id) { case SDL_SYSTEM_CURSOR_ARROW: @@ -188,7 +186,13 @@ MIR_CreateSystemCursor(SDL_SystemCursor id) return NULL; } - mir_cursor->conf = MIR_mir_cursor_configuration_from_name(cursor_name); + cursor = MIR_CreateDefaultCursor(); + if (!cursor) { + return NULL; + } + + mir_cursor = (MIR_Cursor*)cursor->driverdata; + mir_cursor->name = cursor_name; return cursor; } @@ -220,18 +224,25 @@ MIR_ShowCursor(SDL_Cursor* cursor) MIR_Window* mir_window = mir_data->current_window; if (cursor && cursor->driverdata) { - if (mir_window && MIR_mir_surface_is_valid(mir_window->surface)) { + if (mir_window && MIR_mir_window_is_valid(mir_window->window)) { MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; + if (mir_cursor->name != NULL) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_cursor_name(spec, mir_cursor->name); + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); + } + if (mir_cursor->conf) { - MIR_mir_surface_configure_cursor(mir_window->surface, mir_cursor->conf); + MIR_mir_window_configure_cursor(mir_window->window, mir_cursor->conf); } } } - else if(mir_window && MIR_mir_surface_is_valid(mir_window->surface)) { - MIR_mir_surface_configure_cursor(mir_window->surface, NULL); + else if(mir_window && MIR_mir_window_is_valid(mir_window->window)) { + MIR_mir_window_configure_cursor(mir_window->window, NULL); } - + return 0; } @@ -273,17 +284,6 @@ MIR_InitMouse() void MIR_FiniMouse() { - SDL_Mouse* mouse = SDL_GetMouse(); - - MIR_FreeCursor(mouse->def_cursor); - mouse->def_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->CreateSystemCursor = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_MIR */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h index 94dd08561..de3261087 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirmouse_h -#define _SDL_mirmouse_h +#ifndef SDL_mirmouse_h_ +#define SDL_mirmouse_h_ extern void MIR_InitMouse(); @@ -32,6 +32,6 @@ MIR_InitMouse(); extern void MIR_FiniMouse(); -#endif /* _SDL_mirmouse_h */ +#endif /* SDL_mirmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_miropengl.c b/Engine/lib/sdl/src/video/mir/SDL_miropengl.c index 23fabb267..7795f97a6 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_miropengl.c +++ b/Engine/lib/sdl/src/video/mir/SDL_miropengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,12 +31,12 @@ #include "SDL_mirdyn.h" -void +int MIR_GL_SwapWindow(_THIS, SDL_Window* window) { MIR_Window* mir_wind = window->driverdata; - SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface); + return SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface); } int @@ -66,31 +66,13 @@ MIR_GL_LoadLibrary(_THIS, const char* path) { MIR_Data* mir_data = _this->driverdata; - SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection)); + SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection), 0); SDL_EGL_ChooseConfig(_this); return 0; } -void -MIR_GL_UnloadLibrary(_THIS) -{ - SDL_EGL_UnloadLibrary(_this); -} - -void* -MIR_GL_GetProcAddress(_THIS, const char* proc) -{ - void* proc_addr = SDL_EGL_GetProcAddress(_this, proc); - - if (!proc_addr) { - SDL_SetError("Failed to find proc address!"); - } - - return proc_addr; -} - #endif /* SDL_VIDEO_DRIVER_MIR */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_miropengl.h b/Engine/lib/sdl/src/video/mir/SDL_miropengl.h index 96bb40a6d..2168f966c 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_miropengl.h +++ b/Engine/lib/sdl/src/video/mir/SDL_miropengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_miropengl_h -#define _SDL_miropengl_h +#ifndef SDL_miropengl_h_ +#define SDL_miropengl_h_ #include "SDL_mirwindow.h" @@ -33,8 +33,10 @@ #define MIR_GL_DeleteContext SDL_EGL_DeleteContext #define MIR_GL_GetSwapInterval SDL_EGL_GetSwapInterval #define MIR_GL_SetSwapInterval SDL_EGL_SetSwapInterval +#define MIR_GL_UnloadLibrary SDL_EGL_UnloadLibrary +#define MIR_GL_GetProcAddress SDL_EGL_GetProcAddress -extern void +extern int MIR_GL_SwapWindow(_THIS, SDL_Window* window); extern int @@ -46,13 +48,6 @@ MIR_GL_CreateContext(_THIS, SDL_Window* window); extern int MIR_GL_LoadLibrary(_THIS, const char* path); -extern void -MIR_GL_UnloadLibrary(_THIS); - -extern void* -MIR_GL_GetProcAddress(_THIS, const char* proc); - -#endif /* _SDL_miropengl_h */ +#endif /* SDL_miropengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirsym.h b/Engine/lib/sdl/src/video/mir/SDL_mirsym.h index 4f97ed96c..6e18b535b 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirsym.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,28 +34,30 @@ #endif SDL_MIR_MODULE(MIR_CLIENT) -SDL_MIR_SYM(MirSurface *,mir_surface_create_sync,(MirSurfaceSpec* spec)) +SDL_MIR_SYM(MirWindow *,mir_create_window_sync,(MirWindowSpec* spec)) SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface)) -SDL_MIR_SYM(void,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region)) +SDL_MIR_SYM(bool,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region)) SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream)) -SDL_MIR_SYM(void,mir_surface_set_event_handler,(MirSurface *surface, mir_surface_event_callback callback, void* context)) -SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_normal_surface,(MirConnection *connection, int width, int height, MirPixelFormat format)) -SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_changes,(MirConnection *connection)) -SDL_MIR_SYM(void,mir_surface_spec_set_buffer_usage,(MirSurfaceSpec *spec, MirBufferUsage usage)) -SDL_MIR_SYM(void,mir_surface_spec_set_name,(MirSurfaceSpec *spec, char const *name)) -SDL_MIR_SYM(void,mir_surface_spec_release,(MirSurfaceSpec *spec)) -SDL_MIR_SYM(void,mir_surface_spec_set_width,(MirSurfaceSpec *spec, unsigned width)) -SDL_MIR_SYM(void,mir_surface_spec_set_height,(MirSurfaceSpec *spec, unsigned height)) -SDL_MIR_SYM(void,mir_surface_spec_set_min_width,(MirSurfaceSpec *spec, unsigned min_width)) -SDL_MIR_SYM(void,mir_surface_spec_set_min_height,(MirSurfaceSpec *spec, unsigned min_height)) -SDL_MIR_SYM(void,mir_surface_spec_set_max_width,(MirSurfaceSpec *spec, unsigned max_width)) -SDL_MIR_SYM(void,mir_surface_spec_set_max_height,(MirSurfaceSpec *spec, unsigned max_height)) -SDL_MIR_SYM(void,mir_surface_spec_set_type,(MirSurfaceSpec *spec, MirSurfaceType type)) -SDL_MIR_SYM(void,mir_surface_spec_set_state,(MirSurfaceSpec *spec, MirSurfaceState state)) -SDL_MIR_SYM(void,mir_surface_spec_set_pointer_confinement,(MirSurfaceSpec *spec, MirPointerConfinementState state)) -SDL_MIR_SYM(void,mir_surface_apply_spec,(MirSurface *surface, MirSurfaceSpec *spec)) -SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *params)) -SDL_MIR_SYM(MirBufferStream*,mir_surface_get_buffer_stream,(MirSurface *surface)) +SDL_MIR_SYM(void,mir_window_set_event_handler,(MirWindow* window, MirWindowEventCallback callback, void* context)) +SDL_MIR_SYM(MirWindowSpec*,mir_create_normal_window_spec,(MirConnection *connection, int width, int height)) +SDL_MIR_SYM(MirWindowSpec*,mir_create_window_spec,(MirConnection *connection)) +SDL_MIR_SYM(void,mir_window_spec_set_buffer_usage,(MirWindowSpec *spec, MirBufferUsage usage)) +SDL_MIR_SYM(void,mir_window_spec_set_name,(MirWindowSpec *spec, char const *name)) +SDL_MIR_SYM(void,mir_window_spec_release,(MirWindowSpec *spec)) +SDL_MIR_SYM(void,mir_window_spec_set_width,(MirWindowSpec *spec, unsigned width)) +SDL_MIR_SYM(void,mir_window_spec_set_height,(MirWindowSpec *spec, unsigned height)) +SDL_MIR_SYM(void,mir_window_spec_set_min_width,(MirWindowSpec *spec, unsigned min_width)) +SDL_MIR_SYM(void,mir_window_spec_set_min_height,(MirWindowSpec *spec, unsigned min_height)) +SDL_MIR_SYM(void,mir_window_spec_set_max_width,(MirWindowSpec *spec, unsigned max_width)) +SDL_MIR_SYM(void,mir_window_spec_set_max_height,(MirWindowSpec *spec, unsigned max_height)) +SDL_MIR_SYM(void,mir_window_spec_set_type,(MirWindowSpec *spec, MirWindowType type)) +SDL_MIR_SYM(void,mir_window_spec_set_state,(MirWindowSpec *spec, MirWindowState state)) +SDL_MIR_SYM(void,mir_window_spec_set_pointer_confinement,(MirWindowSpec *spec, MirPointerConfinementState state)) +SDL_MIR_SYM(void,mir_window_spec_set_pixel_format,(MirWindowSpec *spec, MirPixelFormat pixel_format)) +SDL_MIR_SYM(void,mir_window_spec_set_cursor_name,(MirWindowSpec *spec, char const* cursor_name)) +SDL_MIR_SYM(void,mir_window_apply_spec,(MirWindow* window, MirWindowSpec* spec)) +SDL_MIR_SYM(void,mir_window_get_parameters,(MirWindow *window, MirWindowParameters *params)) +SDL_MIR_SYM(MirBufferStream*,mir_window_get_buffer_stream,(MirWindow* window)) SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y)) SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage)) SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event)) @@ -76,7 +78,7 @@ SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *ev SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event)) SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event)) SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event)) -SDL_MIR_SYM(MirSurfaceEvent const*,mir_event_get_surface_event,(MirEvent const *event)) +SDL_MIR_SYM(MirWindowEvent const*,mir_event_get_window_event,(MirEvent const *event)) SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event)) SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats)) SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection)) @@ -84,24 +86,23 @@ SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection)) SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection)) SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig)) SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name)) -SDL_MIR_SYM(char const *,mir_surface_get_error_message,(MirSurface *surface)) -SDL_MIR_SYM(bool,mir_surface_is_valid,(MirSurface *surface)) -SDL_MIR_SYM(void,mir_surface_release_sync,(MirSurface *surface)) +SDL_MIR_SYM(char const *,mir_window_get_error_message,(MirWindow *window)) +SDL_MIR_SYM(bool,mir_window_is_valid,(MirWindow *window)) +SDL_MIR_SYM(void,mir_window_release_sync,(MirWindow* window)) SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream)) -SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_name,(char const* cursor_name)) -SDL_MIR_SYM(MirWaitHandle*,mir_surface_configure_cursor,(MirSurface* surface, MirCursorConfiguration const* conf)) +SDL_MIR_SYM(void,mir_window_configure_cursor,(MirWindow* window, MirCursorConfiguration const* conf)) SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf)) SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event)) SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event)) SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection)) -SDL_MIR_SYM(MirSurfaceAttrib,mir_surface_event_get_attribute,(MirSurfaceEvent const* surface_event)) -SDL_MIR_SYM(int,mir_surface_event_get_attribute_value,(MirSurfaceEvent const* surface_event)) -SDL_MIR_SYM(void,mir_wait_for,(MirWaitHandle* handle)) +SDL_MIR_SYM(MirWindowAttrib,mir_window_event_get_attribute,(MirWindowEvent const* event)) +SDL_MIR_SYM(int,mir_window_event_get_attribute_value,(MirWindowEvent const* window_event)) SDL_MIR_SYM(MirDisplayConfig*,mir_connection_create_display_configuration,(MirConnection* connection)) SDL_MIR_SYM(void,mir_display_config_release,(MirDisplayConfig* config)) SDL_MIR_SYM(int,mir_display_config_get_num_outputs,(MirDisplayConfig const* config)) SDL_MIR_SYM(MirOutput*,mir_display_config_get_mutable_output,(MirDisplayConfig* config, size_t index)) SDL_MIR_SYM(int,mir_output_get_num_modes,(MirOutput const* output)) +SDL_MIR_SYM(MirOutputMode const*,mir_output_get_current_mode,(MirOutput const* output)) SDL_MIR_SYM(MirPixelFormat,mir_output_get_current_pixel_format,(MirOutput const* output)) SDL_MIR_SYM(int,mir_output_get_position_x,(MirOutput const* output)) SDL_MIR_SYM(int,mir_output_get_position_y,(MirOutput const* output)) @@ -115,7 +116,7 @@ SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, s SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode)) SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode)) SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode)) -SDL_MIR_SYM(MirOutputGammaSupported,mir_output_is_gamma_supported,(MirOutput const* output)) +SDL_MIR_SYM(bool,mir_output_is_gamma_supported,(MirOutput const* output)) SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output)) SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size)) SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size)) diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c index 6a8f9e482..8f3a368cf 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,9 @@ #if SDL_VIDEO_DRIVER_MIR +#include "SDL_assert.h" +#include "SDL_log.h" + #include "SDL_mirwindow.h" #include "SDL_video.h" @@ -34,6 +37,7 @@ #include "SDL_mirmouse.h" #include "SDL_miropengl.h" #include "SDL_mirvideo.h" +#include "SDL_mirvulkan.h" #include "SDL_mirdyn.h" @@ -98,7 +102,19 @@ MIR_Available() int available = 0; if (SDL_MIR_LoadSymbols()) { - /* !!! FIXME: try to make a MirConnection here. */ + + /* Lets ensure we can connect to the mir server */ + MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); + + if (!MIR_mir_connection_is_valid(connection)) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s", + MIR_mir_connection_get_error_message(connection)); + + return available; + } + + MIR_mir_connection_release(connection); + available = 1; SDL_MIR_UnloadSymbols(); } @@ -165,7 +181,7 @@ MIR_CreateDevice(int device_index) device->GL_GetProcAddress = MIR_GL_GetProcAddress; /* mirwindow */ - device->CreateWindow = MIR_CreateWindow; + device->CreateSDLWindow = MIR_CreateWindow; device->DestroyWindow = MIR_DestroyWindow; device->GetWindowWMInfo = MIR_GetWindowWMInfo; device->SetWindowFullscreen = MIR_SetWindowFullscreen; @@ -182,7 +198,7 @@ MIR_CreateDevice(int device_index) device->SetWindowGammaRamp = MIR_SetWindowGammaRamp; device->GetWindowGammaRamp = MIR_GetWindowGammaRamp; - device->CreateWindowFrom = NULL; + device->CreateSDLWindowFrom = NULL; device->SetWindowIcon = NULL; device->RaiseWindow = NULL; device->SetWindowBordered = NULL; @@ -218,6 +234,13 @@ MIR_CreateDevice(int device_index) device->ShowMessageBox = NULL; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface; +#endif + return device; } @@ -255,7 +278,7 @@ MIR_InitDisplayFromOutput(_THIS, MirOutput* output) MirPixelFormat format = MIR_mir_output_get_current_pixel_format(output); int num_modes = MIR_mir_output_get_num_modes(output); - SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(mir_output_get_current_mode(output), format); + SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(MIR_mir_output_get_current_mode(output), format); SDL_zero(display); @@ -297,7 +320,7 @@ MIR_VideoInit(_THIS) { MIR_Data* mir_data = _this->driverdata; - mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__); + mir_data->connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); mir_data->current_window = NULL; mir_data->software = SDL_FALSE; mir_data->pixel_format = mir_pixel_format_invalid; diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h index 71ef4ecc1..6850bac52 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,11 +23,12 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirvideo_h_ -#define _SDL_mirvideo_h_ +#ifndef SDL_mirvideo_h__ +#define SDL_mirvideo_h__ #include #include +#include "SDL_stdinc.h" typedef struct MIR_Window MIR_Window; @@ -43,6 +44,6 @@ typedef struct extern Uint32 MIR_GetSDLPixelFormat(MirPixelFormat format); -#endif /* _SDL_mirvideo_h_ */ +#endif /* SDL_mirvideo_h__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c new file mode 100644 index 000000000..6ba3fa3cd --- /dev/null +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR + +#include "SDL_mirvideo.h" +#include "SDL_mirwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_mirvulkan.h" +#include "SDL_syswm.h" + +int MIR_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasMIRSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(Uint32 i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_MIR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasMIRSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasMIRSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_MIR_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void MIR_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForMir[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_MIR_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForMir), + extensionsForMir); +} + +SDL_bool MIR_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + MIR_Window *windowData = (MIR_Window *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR = + (PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateMirSurfaceKHR"); + VkMirSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateMirSurfaceKHR) + { + SDL_SetError(VK_KHR_MIR_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.connection = windowData->mir_data->connection; + createInfo.mirSurface = windowData->window; + result = vkCreateMirSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateMirSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h new file mode 100644 index 000000000..6f40d5b50 --- /dev/null +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_mirvulkan_h_ +#define SDL_mirvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR + +int MIR_Vulkan_LoadLibrary(_THIS, const char *path); +void MIR_Vulkan_UnloadLibrary(_THIS); +SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool MIR_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_mirvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c index 1bf9016a0..80877eef4 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,18 +36,18 @@ #include "SDL_mirdyn.h" -int -IsSurfaceValid(MIR_Window* mir_window) +static int +IsMirWindowValid(MIR_Window* mir_window) { - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - const char* error = MIR_mir_surface_get_error_message(mir_window->surface); - return SDL_SetError("Failed to created a mir surface: %s", error); + if (!MIR_mir_window_is_valid(mir_window->window)) { + const char* error = MIR_mir_window_get_error_message(mir_window->window); + return SDL_SetError("Failed to create a mir surface: %s", error); } - return 0; + return 1; } -MirPixelFormat +static MirPixelFormat FindValidPixelFormat(MIR_Data* mir_data) { unsigned int pf_size = 32; @@ -81,7 +81,7 @@ MIR_CreateWindow(_THIS, SDL_Window* window) MirPixelFormat pixel_format; MirBufferUsage buffer_usage; - MirSurfaceSpec* spec; + MirWindowSpec* spec; mir_window = SDL_calloc(1, sizeof(MIR_Window)); if (!mir_window) @@ -117,36 +117,36 @@ MIR_CreateWindow(_THIS, SDL_Window* window) if (mir_data->software) buffer_usage = mir_buffer_usage_software; - spec = MIR_mir_connection_create_spec_for_normal_surface(mir_data->connection, - window->w, - window->h, - pixel_format); + spec = MIR_mir_create_normal_window_spec(mir_data->connection, + window->w, + window->h); - MIR_mir_surface_spec_set_buffer_usage(spec, buffer_usage); - MIR_mir_surface_spec_set_name(spec, "Mir surface"); + MIR_mir_window_spec_set_buffer_usage(spec, buffer_usage); + MIR_mir_window_spec_set_name(spec, "Mir surface"); + MIR_mir_window_spec_set_pixel_format(spec, pixel_format); if (window->flags & SDL_WINDOW_INPUT_FOCUS) SDL_SetKeyboardFocus(window); - mir_window->surface = MIR_mir_surface_create_sync(spec); - MIR_mir_surface_set_event_handler(mir_window->surface, MIR_HandleEvent, window); + mir_window->window = MIR_mir_create_window_sync(spec); + MIR_mir_window_set_event_handler(mir_window->window, MIR_HandleEvent, window); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_spec_release(spec); - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - return SDL_SetError("Failed to created a mir surface: %s", - MIR_mir_surface_get_error_message(mir_window->surface)); + if (!MIR_mir_window_is_valid(mir_window->window)) { + return SDL_SetError("Failed to create a mir surface: %s", + MIR_mir_window_get_error_message(mir_window->window)); } if (window->flags & SDL_WINDOW_OPENGL) { EGLNativeWindowType egl_native_window = (EGLNativeWindowType)MIR_mir_buffer_stream_get_egl_native_window( - MIR_mir_surface_get_buffer_stream(mir_window->surface)); + MIR_mir_window_get_buffer_stream(mir_window->window)); mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window); if (mir_window->egl_surface == EGL_NO_SURFACE) { - return SDL_SetError("Failed to created a window surface %p", + return SDL_SetError("Failed to create a window surface %p", _this->egl_data->egl_display); } } @@ -167,7 +167,7 @@ MIR_DestroyWindow(_THIS, SDL_Window* window) if (mir_data) { SDL_EGL_DestroySurface(_this, mir_window->egl_surface); - MIR_mir_surface_release_sync(mir_window->surface); + MIR_mir_window_release_sync(mir_window->window); mir_data->current_window = NULL; @@ -185,7 +185,8 @@ MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info) info->subsystem = SDL_SYSWM_MIR; info->info.mir.connection = mir_window->mir_data->connection; - info->info.mir.surface = mir_window->surface; + // Cannot change this to window due to it being in the public API + info->info.mir.surface = mir_window->window; return SDL_TRUE; } @@ -193,153 +194,104 @@ MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info) return SDL_FALSE; } +static void +UpdateMirWindowState(MIR_Data* mir_data, MIR_Window* mir_window, MirWindowState window_state) +{ + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_state(spec, window_state); + + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); + } +} + void MIR_SetWindowFullscreen(_THIS, SDL_Window* window, SDL_VideoDisplay* display, SDL_bool fullscreen) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - MirSurfaceState state; + if (IsMirWindowValid(window->driverdata)) { + MirWindowState state; - if (IsSurfaceValid(mir_window) < 0) - return; + if (fullscreen) { + state = mir_window_state_fullscreen; + } + else { + state = mir_window_state_restored; + } - if (fullscreen) { - state = mir_surface_state_fullscreen; - } else { - state = mir_surface_state_restored; + UpdateMirWindowState(_this->driverdata, window->driverdata, state); } - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, state); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); } void MIR_MaximizeWindow(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_maximized); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_maximized); } void MIR_MinimizeWindow(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_minimized); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_minimized); } void MIR_RestoreWindow(_THIS, SDL_Window * window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_restored); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_restored); } void MIR_HideWindow(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_hidden); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden); } void MIR_SetWindowSize(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - if (IsSurfaceValid(mir_window) < 0) - return; + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_width (spec, window->w); + MIR_mir_window_spec_set_height(spec, window->h); - /* You cannot set the x/y of a mir window! So only update w/h */ - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_width (spec, window->w); - MIR_mir_surface_spec_set_height(spec, window->h); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + } } void MIR_SetWindowMinimumSize(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - if (IsSurfaceValid(mir_window) < 0) - return; + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_min_width (spec, window->min_w); + MIR_mir_window_spec_set_min_height(spec, window->min_h); - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_min_width (spec, window->min_w); - MIR_mir_surface_spec_set_min_height(spec, window->min_h); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + } } void MIR_SetWindowMaximumSize(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - if (IsSurfaceValid(mir_window) < 0) - return; + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_max_width (spec, window->max_w); + MIR_mir_window_spec_set_max_height(spec, window->max_h); - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_max_width (spec, window->max_w); - MIR_mir_surface_spec_set_max_height(spec, window->max_h); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + } } void @@ -348,16 +300,16 @@ MIR_SetWindowTitle(_THIS, SDL_Window* window) MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; char const* title = window->title ? window->title : ""; - MirSurfaceSpec* spec; + MirWindowSpec* spec; - if (IsSurfaceValid(mir_window) < 0) + if (IsMirWindowValid(mir_window) < 0) return; - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_name(spec, title); + spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_name(spec, title); - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); } void @@ -366,16 +318,16 @@ MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed) MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; MirPointerConfinementState confined = mir_pointer_unconfined; - MirSurfaceSpec* spec; + MirWindowSpec* spec; if (grabbed) - confined = mir_pointer_confined_to_surface; + confined = mir_pointer_confined_to_window; - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_pointer_confinement(spec, confined); + spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_pointer_confinement(spec, confined); - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); } int diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h index c4084aa4e..af618f50c 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirwindow_h -#define _SDL_mirwindow_h +#ifndef SDL_mirwindow_h_ +#define SDL_mirwindow_h_ #include "../SDL_sysvideo.h" #include "SDL_syswm.h" @@ -35,7 +35,7 @@ struct MIR_Window { SDL_Window* sdl_window; MIR_Data* mir_data; - MirSurface* surface; + MirWindow* window; EGLSurface egl_surface; }; @@ -87,7 +87,7 @@ MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp); extern int MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp); -#endif /* _SDL_mirwindow_h */ +#endif /* SDL_mirwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c b/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c index d6ebbdf87..812df2bf2 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -298,7 +298,7 @@ static Uint8 SDL_NACL_translate_mouse_button(int32_t button) { return SDL_BUTTON_MIDDLE; case PP_INPUTEVENT_MOUSEBUTTON_RIGHT: return SDL_BUTTON_RIGHT; - + case PP_INPUTEVENT_MOUSEBUTTON_NONE: default: return 0; @@ -314,14 +314,14 @@ SDL_NACL_translate_keycode(int keycode) scancode = NACL_Keycodes[keycode]; } if (scancode == SDL_SCANCODE_UNKNOWN) { - SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list NACL KeyCode %d \n", keycode); + SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list NACL KeyCode %d", keycode); } return scancode; } void NACL_PumpEvents(_THIS) { PSEvent* ps_event; - PP_Resource event; + PP_Resource event; PP_InputEvent_Type type; PP_InputEvent_Modifier modifiers; struct PP_Rect rect; @@ -329,11 +329,11 @@ void NACL_PumpEvents(_THIS) { struct PP_Point location; struct PP_Var var; const char *str; - char text[64]; + char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; Uint32 str_len; SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; SDL_Mouse *mouse = SDL_GetMouse(); - + if (driverdata->window) { while ((ps_event = PSEventTryAcquire()) != NULL) { event = ps_event->as_resource; @@ -344,9 +344,9 @@ void NACL_PumpEvents(_THIS) { NACL_SetScreenResolution(rect.size.width, rect.size.height, SDL_PIXELFORMAT_UNKNOWN); // FIXME: Rebuild context? See life.c UpdateContext break; - + /* From HandleInputEvent, contains an input resource. */ - case PSE_INSTANCE_HANDLEINPUT: + case PSE_INSTANCE_HANDLEINPUT: type = driverdata->ppb_input_event->GetType(event); modifiers = driverdata->ppb_input_event->GetModifiers(event); switch(type) { @@ -359,35 +359,35 @@ void NACL_PumpEvents(_THIS) { case PP_INPUTEVENT_TYPE_WHEEL: /* FIXME: GetTicks provides high resolution scroll events */ fp = driverdata->ppb_wheel_input_event->GetDelta(event); - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, (int) fp.x, (int) fp.y, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(mouse->focus, mouse->mouseID, fp.x, fp.y, SDL_MOUSEWHEEL_NORMAL); break; - + case PP_INPUTEVENT_TYPE_MOUSEENTER: case PP_INPUTEVENT_TYPE_MOUSELEAVE: /* FIXME: Mouse Focus */ break; - - - case PP_INPUTEVENT_TYPE_MOUSEMOVE: + + + case PP_INPUTEVENT_TYPE_MOUSEMOVE: location = driverdata->ppb_mouse_input_event->GetPosition(event); SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, location.x, location.y); break; - + case PP_INPUTEVENT_TYPE_TOUCHSTART: case PP_INPUTEVENT_TYPE_TOUCHMOVE: case PP_INPUTEVENT_TYPE_TOUCHEND: case PP_INPUTEVENT_TYPE_TOUCHCANCEL: /* FIXME: Touch events */ break; - + case PP_INPUTEVENT_TYPE_KEYDOWN: SDL_SendKeyboardKey(SDL_PRESSED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event))); break; - + case PP_INPUTEVENT_TYPE_KEYUP: SDL_SendKeyboardKey(SDL_RELEASED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event))); break; - + case PP_INPUTEVENT_TYPE_CHAR: var = driverdata->ppb_keyboard_input_event->GetCharacterText(event); str = driverdata->ppb_var->VarToUtf8(var, &str_len); @@ -397,17 +397,17 @@ void NACL_PumpEvents(_THIS) { } SDL_strlcpy(text, str, str_len ); text[str_len] = '\0'; - + SDL_SendKeyboardText(text); /* FIXME: Do we have to handle ref counting? driverdata->ppb_var->Release(var);*/ break; - + default: break; } break; - - + + /* From HandleMessage, contains a PP_Var. */ case PSE_INSTANCE_HANDLEMESSAGE: break; @@ -419,7 +419,7 @@ void NACL_PumpEvents(_THIS) { /* When the 3D context is lost, no resource. */ case PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST: break; - + /* When the mouse lock is lost. */ case PSE_MOUSELOCK_MOUSELOCKLOST: break; @@ -427,7 +427,7 @@ void NACL_PumpEvents(_THIS) { default: break; } - + PSEventRelease(ps_event); } } diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h b/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h index 3255578c3..8059ea557 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclevents_c_h -#define _SDL_naclevents_c_h +#ifndef SDL_naclevents_c_h_ +#define SDL_naclevents_c_h_ #include "SDL_naclvideo.h" extern void NACL_PumpEvents(_THIS); -#endif /* _SDL_naclevents_c_h */ +#endif /* SDL_naclevents_c_h_ */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c b/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c index 79f5b0f90..544cc6fd5 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c index e11245135..98b9ad3f6 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -141,7 +141,7 @@ int NACL_GLES_SetSwapInterval(_THIS, int interval) { /* STUB */ - return 0; + return SDL_Unsupported(); } int @@ -151,12 +151,15 @@ NACL_GLES_GetSwapInterval(_THIS) return 0; } -void +int NACL_GLES_SwapWindow(_THIS, SDL_Window * window) { SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; struct PP_CompletionCallback callback = { NULL, 0, PP_COMPLETIONCALLBACK_FLAG_NONE }; - driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ); + if (driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ) != 0) { + return SDL_SetError("SwapBuffers failed"); + } + return 0; } void diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h index 1845e8191..744c0e533 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclgl_h -#define _SDL_naclgl_h +#ifndef SDL_naclopengles_h_ +#define SDL_naclopengles_h_ extern int NACL_GLES_LoadLibrary(_THIS, const char *path); extern void *NACL_GLES_GetProcAddress(_THIS, const char *proc); @@ -30,9 +30,9 @@ extern SDL_GLContext NACL_GLES_CreateContext(_THIS, SDL_Window * window); extern int NACL_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int NACL_GLES_SetSwapInterval(_THIS, int interval); extern int NACL_GLES_GetSwapInterval(_THIS); -extern void NACL_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int NACL_GLES_SwapWindow(_THIS, SDL_Window * window); extern void NACL_GLES_DeleteContext(_THIS, SDL_GLContext context); -#endif /* _SDL_naclgl_h */ +#endif /* SDL_naclopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c index 467155c67..24dda2c15 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -81,7 +81,7 @@ static int NACL_Available(void) { static void NACL_DeleteDevice(SDL_VideoDevice *device) { SDL_VideoData *driverdata = (SDL_VideoData*) device->driverdata; driverdata->ppb_core->ReleaseResource((PP_Resource) driverdata->ppb_message_loop); - SDL_free(device->driverdata); + /* device->driverdata is not freed because it points to static memory */ SDL_free(device); } @@ -107,7 +107,7 @@ static SDL_VideoDevice *NACL_CreateDevice(int devindex) { device->VideoQuit = NACL_VideoQuit; device->PumpEvents = NACL_PumpEvents; - device->CreateWindow = NACL_CreateWindow; + device->CreateSDLWindow = NACL_CreateWindow; device->SetWindowTitle = NACL_SetWindowTitle; device->DestroyWindow = NACL_DestroyWindow; diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h index 174a6e77c..6986aa83c 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclvideo_h -#define _SDL_naclvideo_h +#ifndef SDL_naclvideo_h_ +#define SDL_naclvideo_h_ #include "../SDL_sysvideo.h" #include "ppapi_simple/ps_interface.h" @@ -64,4 +64,4 @@ typedef struct SDL_VideoData { extern void NACL_SetScreenResolution(int width, int height, Uint32 format); -#endif /* _SDL_naclvideo_h */ +#endif /* SDL_naclvideo_h_ */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c index 32d1e6d7e..71933313c 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h index 617bfc3ab..412b15f2e 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclwindow_h -#define _SDL_naclwindow_h +#ifndef SDL_naclwindow_h_ +#define SDL_naclwindow_h_ extern int NACL_CreateWindow(_THIS, SDL_Window * window); extern void NACL_SetWindowTitle(_THIS, SDL_Window * window); extern void NACL_DestroyWindow(_THIS, SDL_Window * window); -#endif /* _SDL_naclwindow_h */ +#endif /* SDL_naclwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora.c b/Engine/lib/sdl/src/video/pandora/SDL_pandora.c index 7afa54306..b319b164c 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora.c +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -102,8 +102,8 @@ PND_create() device->VideoQuit = PND_videoquit; device->GetDisplayModes = PND_getdisplaymodes; device->SetDisplayMode = PND_setdisplaymode; - device->CreateWindow = PND_createwindow; - device->CreateWindowFrom = PND_createwindowfrom; + device->CreateSDLWindow = PND_createwindow; + device->CreateSDLWindowFrom = PND_createwindowfrom; device->SetWindowTitle = PND_setwindowtitle; device->SetWindowIcon = PND_setwindowicon; device->SetWindowPosition = PND_setwindowposition; @@ -116,7 +116,9 @@ PND_create() device->RestoreWindow = PND_restorewindow; device->SetWindowGrab = PND_setwindowgrab; device->DestroyWindow = PND_destroywindow; +#if 0 device->GetWindowWMInfo = PND_getwindowwminfo; +#endif device->GL_LoadLibrary = PND_gl_loadlibrary; device->GL_GetProcAddress = PND_gl_getprocaddres; device->GL_UnloadLibrary = PND_gl_unloadlibrary; @@ -298,13 +300,14 @@ PND_destroywindow(_THIS, SDL_Window * window) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -312,6 +315,7 @@ PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif /*****************************************************************************/ /* SDL OpenGL/OpenGL ES functions */ @@ -637,7 +641,7 @@ PND_gl_createcontext(_THIS, SDL_Window * window) if (wdata->gles_surface == 0) { - SDL_SetError("Error : eglCreateWindowSurface failed;\n"); + SDL_SetError("Error : eglCreateWindowSurface failed;"); return NULL; } @@ -774,15 +778,14 @@ PND_gl_getswapinterval(_THIS) return ((SDL_VideoData *) _this->driverdata)->swapinterval; } -void +int PND_gl_swapwindow(_THIS, SDL_Window * window) { SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; if (phdata->egl_initialized != SDL_TRUE) { - SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); - return; + return SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); } /* Many applications do not uses glFinish(), so we call it for them */ @@ -792,6 +795,7 @@ PND_gl_swapwindow(_THIS, SDL_Window * window) eglWaitGL(); eglSwapBuffers(phdata->egl_display, wdata->gles_surface); + return 0; } void diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora.h b/Engine/lib/sdl/src/video/pandora/SDL_pandora.h index 859b7ee5d..9e460e764 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora.h +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,7 +92,7 @@ SDL_GLContext PND_gl_createcontext(_THIS, SDL_Window * window); int PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context); int PND_gl_setswapinterval(_THIS, int interval); int PND_gl_getswapinterval(_THIS); -void PND_gl_swapwindow(_THIS, SDL_Window * window); +int PND_gl_swapwindow(_THIS, SDL_Window * window); void PND_gl_deletecontext(_THIS, SDL_GLContext context); diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c index d22d0c759..bff7a36b4 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h index e9f8d7cfa..f714384cd 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspevents.c b/Engine/lib/sdl/src/video/psp/SDL_pspevents.c index 71267272d..14277b3bf 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspevents.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -260,12 +260,12 @@ void PSP_EventInit(_THIS) #endif /* Start thread to read data */ if((event_sem = SDL_CreateSemaphore(1)) == NULL) { - SDL_SetError("Can't create input semaphore\n"); + SDL_SetError("Can't create input semaphore"); return; } running = 1; if((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) { - SDL_SetError("Can't create input thread\n"); + SDL_SetError("Can't create input thread"); return; } } diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h b/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h index e1929d237..e98beb4a4 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspgl.c b/Engine/lib/sdl/src/video/psp/SDL_pspgl.c index e4f81e9ee..644fb34e6 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspgl.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,10 +47,6 @@ int PSP_GL_LoadLibrary(_THIS, const char *path) { - if (!_this->gl_config.driver_loaded) { - _this->gl_config.driver_loaded = 1; - } - return 0; } @@ -174,10 +170,13 @@ PSP_GL_GetSwapInterval(_THIS) return _this->gl_data->swapinterval; } -void +int PSP_GL_SwapWindow(_THIS, SDL_Window * window) { - eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface); + if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) { + return SDL_SetError("eglSwapBuffers() failed"); + } + return 0; } void diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h b/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h index 308b02729..49300fb38 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspgl_c_h -#define _SDL_pspgl_c_h +#ifndef SDL_pspgl_c_h_ +#define SDL_pspgl_c_h_ #include @@ -40,7 +40,7 @@ extern void * PSP_GL_GetProcAddress(_THIS, const char *proc); extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); extern void PSP_GL_SwapBuffers(_THIS); -extern void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +extern int PSP_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); extern int PSP_GL_LoadLibrary(_THIS, const char *path); @@ -49,4 +49,6 @@ extern int PSP_GL_SetSwapInterval(_THIS, int interval); extern int PSP_GL_GetSwapInterval(_THIS); -#endif /* _SDL_pspgl_c_h */ +#endif /* SDL_pspgl_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c b/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c index b7c3d2b99..bd34dfaec 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h b/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h index 2a3df68ef..2d2640eb0 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c index 381e4899e..82317793f 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,8 +113,8 @@ PSP_Create() device->VideoQuit = PSP_VideoQuit; device->GetDisplayModes = PSP_GetDisplayModes; device->SetDisplayMode = PSP_SetDisplayMode; - device->CreateWindow = PSP_CreateWindow; - device->CreateWindowFrom = PSP_CreateWindowFrom; + device->CreateSDLWindow = PSP_CreateWindow; + device->CreateSDLWindowFrom = PSP_CreateWindowFrom; device->SetWindowTitle = PSP_SetWindowTitle; device->SetWindowIcon = PSP_SetWindowIcon; device->SetWindowPosition = PSP_SetWindowPosition; @@ -127,7 +127,9 @@ PSP_Create() device->RestoreWindow = PSP_RestoreWindow; device->SetWindowGrab = PSP_SetWindowGrab; device->DestroyWindow = PSP_DestroyWindow; +#if 0 device->GetWindowWMInfo = PSP_GetWindowWMInfo; +#endif device->GL_LoadLibrary = PSP_GL_LoadLibrary; device->GL_GetProcAddress = PSP_GL_GetProcAddress; device->GL_UnloadLibrary = PSP_GL_UnloadLibrary; @@ -291,13 +293,14 @@ PSP_DestroyWindow(_THIS, SDL_Window * window) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -305,6 +308,7 @@ PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif /* TO Write Me */ diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h index f5705a944..741bad1ed 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspvideo_h -#define _SDL_pspvideo_h +#ifndef SDL_pspvideo_h_ +#define SDL_pspvideo_h_ #include @@ -88,7 +88,7 @@ SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); int PSP_GL_SetSwapInterval(_THIS, int interval); int PSP_GL_GetSwapInterval(_THIS); -void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +int PSP_GL_SwapWindow(_THIS, SDL_Window * window); void PSP_GL_DeleteContext(_THIS, SDL_GLContext context); /* PSP on screen keyboard */ @@ -97,6 +97,6 @@ void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window); void PSP_HideScreenKeyboard(_THIS, SDL_Window *window); SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window); -#endif /* _SDL_pspvideo_h */ +#endif /* SDL_pspvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/qnx/gl.c b/Engine/lib/sdl/src/video/qnx/gl.c new file mode 100644 index 000000000..19e1bd4f7 --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/gl.c @@ -0,0 +1,285 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" +#include "sdl_qnx.h" + +static EGLDisplay egl_disp; + +/** + * Detertmines the pixel format to use based on the current display and EGL + * configuration. + * @param egl_conf EGL configuration to use + * @return A SCREEN_FORMAT* constant for the pixel format to use + */ +static int +chooseFormat(EGLConfig egl_conf) +{ + EGLint buffer_bit_depth; + EGLint alpha_bit_depth; + + eglGetConfigAttrib(egl_disp, egl_conf, EGL_BUFFER_SIZE, &buffer_bit_depth); + eglGetConfigAttrib(egl_disp, egl_conf, EGL_ALPHA_SIZE, &alpha_bit_depth); + + switch (buffer_bit_depth) { + case 32: + return SCREEN_FORMAT_RGBX8888; + case 24: + return SCREEN_FORMAT_RGB888; + case 16: + switch (alpha_bit_depth) { + case 4: + return SCREEN_FORMAT_RGBX4444; + case 1: + return SCREEN_FORMAT_RGBA5551; + default: + return SCREEN_FORMAT_RGB565; + } + default: + return 0; + } +} + +/** + * Enumerates the supported EGL configurations and chooses a suitable one. + * @param[out] pconf The chosen configuration + * @param[out] pformat The chosen pixel format + * @return 0 if successful, -1 on error + */ +int +glGetConfig(EGLConfig *pconf, int *pformat) +{ + EGLConfig egl_conf = (EGLConfig)0; + EGLConfig *egl_configs; + EGLint egl_num_configs; + EGLint val; + EGLBoolean rc; + EGLint i; + + // Determine the numbfer of configurations. + rc = eglGetConfigs(egl_disp, NULL, 0, &egl_num_configs); + if (rc != EGL_TRUE) { + return -1; + } + + if (egl_num_configs == 0) { + return -1; + } + + // Allocate enough memory for all configurations. + egl_configs = malloc(egl_num_configs * sizeof(*egl_configs)); + if (egl_configs == NULL) { + return -1; + } + + // Get the list of configurations. + rc = eglGetConfigs(egl_disp, egl_configs, egl_num_configs, + &egl_num_configs); + if (rc != EGL_TRUE) { + free(egl_configs); + return -1; + } + + // Find a good configuration. + for (i = 0; i < egl_num_configs; i++) { + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_SURFACE_TYPE, &val); + if (!(val & EGL_WINDOW_BIT)) { + continue; + } + + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_RENDERABLE_TYPE, &val); + if (!(val & EGL_OPENGL_ES2_BIT)) { + continue; + } + + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_DEPTH_SIZE, &val); + if (val == 0) { + continue; + } + + egl_conf = egl_configs[i]; + break; + } + + free(egl_configs); + *pconf = egl_conf; + *pformat = chooseFormat(egl_conf); + + return 0; +} + +/** + * Initializes the EGL library. + * @param _THIS + * @param name unused + * @return 0 if successful, -1 on error + */ +int +glLoadLibrary(_THIS, const char *name) +{ + EGLNativeDisplayType disp_id = EGL_DEFAULT_DISPLAY; + + egl_disp = eglGetDisplay(disp_id); + if (egl_disp == EGL_NO_DISPLAY) { + return -1; + } + + if (eglInitialize(egl_disp, NULL, NULL) == EGL_FALSE) { + return -1; + } + + return 0; +} + +/** + * Finds the address of an EGL extension function. + * @param proc Function name + * @return Function address + */ +void * +glGetProcAddress(_THIS, const char *proc) +{ + return eglGetProcAddress(proc); +} + +/** + * Associates the given window with the necessary EGL structures for drawing and + * displaying content. + * @param _THIS + * @param window The SDL window to create the context for + * @return A pointer to the created context, if successful, NULL on error + */ +SDL_GLContext +glCreateContext(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + EGLContext context; + EGLSurface surface; + + struct { + EGLint client_version[2]; + EGLint none; + } egl_ctx_attr = { + .client_version = { EGL_CONTEXT_CLIENT_VERSION, 2 }, + .none = EGL_NONE + }; + + struct { + EGLint render_buffer[2]; + EGLint none; + } egl_surf_attr = { + .render_buffer = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER }, + .none = EGL_NONE + }; + + context = eglCreateContext(egl_disp, impl->conf, EGL_NO_CONTEXT, + (EGLint *)&egl_ctx_attr); + if (context == EGL_NO_CONTEXT) { + return NULL; + } + + surface = eglCreateWindowSurface(egl_disp, impl->conf, impl->window, + (EGLint *)&egl_surf_attr); + if (surface == EGL_NO_SURFACE) { + return NULL; + } + + eglMakeCurrent(egl_disp, surface, surface, context); + + impl->surface = surface; + return context; +} + +/** + * Sets a new value for the number of frames to display before swapping buffers. + * @param _THIS + * @param interval New interval value + * @return 0 if successful, -1 on error + */ +int +glSetSwapInterval(_THIS, int interval) +{ + if (eglSwapInterval(egl_disp, interval) != EGL_TRUE) { + return -1; + } + + return 0; +} + +/** + * Swaps the EGL buffers associated with the given window + * @param _THIS + * @param window Window to swap buffers for + * @return 0 if successful, -1 on error + */ +int +glSwapWindow(_THIS, SDL_Window *window) +{ + /* !!! FIXME: should we migrate this all over to use SDL_egl.c? */ + window_impl_t *impl = (window_impl_t *)window->driverdata; + return eglSwapBuffers(egl_disp, impl->surface) == EGL_TRUE ? 0 : -1; +} + +/** + * Makes the given context the current one for drawing operations. + * @param _THIS + * @param window SDL window associated with the context (maybe NULL) + * @param context The context to activate + * @return 0 if successful, -1 on error + */ +int +glMakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context) +{ + window_impl_t *impl; + EGLSurface surface = NULL; + + if (window) { + impl = (window_impl_t *)window->driverdata; + surface = impl->surface; + } + + if (eglMakeCurrent(egl_disp, surface, surface, context) != EGL_TRUE) { + return -1; + } + + return 0; +} + +/** + * Destroys a context. + * @param _THIS + * @param context The context to destroy + */ +void +glDeleteContext(_THIS, SDL_GLContext context) +{ + eglDestroyContext(egl_disp, context); +} + +/** + * Terminates access to the EGL library. + * @param _THIS + */ +void +glUnloadLibrary(_THIS) +{ + eglTerminate(egl_disp); +} diff --git a/Engine/lib/sdl/src/video/qnx/keyboard.c b/Engine/lib/sdl/src/video/qnx/keyboard.c new file mode 100644 index 000000000..86c6395ba --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/keyboard.c @@ -0,0 +1,133 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" +#include "../../events/SDL_keyboard_c.h" +#include "SDL_scancode.h" +#include "SDL_events.h" +#include "sdl_qnx.h" +#include + +/** + * A map thta translates Screen key names to SDL scan codes. + * This map is incomplete, but should include most major keys. + */ +static int key_to_sdl[] = { + [KEYCODE_SPACE] = SDL_SCANCODE_SPACE, + [KEYCODE_APOSTROPHE] = SDL_SCANCODE_APOSTROPHE, + [KEYCODE_COMMA] = SDL_SCANCODE_COMMA, + [KEYCODE_MINUS] = SDL_SCANCODE_MINUS, + [KEYCODE_PERIOD] = SDL_SCANCODE_PERIOD, + [KEYCODE_SLASH] = SDL_SCANCODE_SLASH, + [KEYCODE_ZERO] = SDL_SCANCODE_0, + [KEYCODE_ONE] = SDL_SCANCODE_1, + [KEYCODE_TWO] = SDL_SCANCODE_2, + [KEYCODE_THREE] = SDL_SCANCODE_3, + [KEYCODE_FOUR] = SDL_SCANCODE_4, + [KEYCODE_FIVE] = SDL_SCANCODE_5, + [KEYCODE_SIX] = SDL_SCANCODE_6, + [KEYCODE_SEVEN] = SDL_SCANCODE_7, + [KEYCODE_EIGHT] = SDL_SCANCODE_8, + [KEYCODE_NINE] = SDL_SCANCODE_9, + [KEYCODE_SEMICOLON] = SDL_SCANCODE_SEMICOLON, + [KEYCODE_EQUAL] = SDL_SCANCODE_EQUALS, + [KEYCODE_LEFT_BRACKET] = SDL_SCANCODE_LEFTBRACKET, + [KEYCODE_BACK_SLASH] = SDL_SCANCODE_BACKSLASH, + [KEYCODE_RIGHT_BRACKET] = SDL_SCANCODE_RIGHTBRACKET, + [KEYCODE_GRAVE] = SDL_SCANCODE_GRAVE, + [KEYCODE_A] = SDL_SCANCODE_A, + [KEYCODE_B] = SDL_SCANCODE_B, + [KEYCODE_C] = SDL_SCANCODE_C, + [KEYCODE_D] = SDL_SCANCODE_D, + [KEYCODE_E] = SDL_SCANCODE_E, + [KEYCODE_F] = SDL_SCANCODE_F, + [KEYCODE_G] = SDL_SCANCODE_G, + [KEYCODE_H] = SDL_SCANCODE_H, + [KEYCODE_I] = SDL_SCANCODE_I, + [KEYCODE_J] = SDL_SCANCODE_J, + [KEYCODE_K] = SDL_SCANCODE_K, + [KEYCODE_L] = SDL_SCANCODE_L, + [KEYCODE_M] = SDL_SCANCODE_M, + [KEYCODE_N] = SDL_SCANCODE_N, + [KEYCODE_O] = SDL_SCANCODE_O, + [KEYCODE_P] = SDL_SCANCODE_P, + [KEYCODE_Q] = SDL_SCANCODE_Q, + [KEYCODE_R] = SDL_SCANCODE_R, + [KEYCODE_S] = SDL_SCANCODE_S, + [KEYCODE_T] = SDL_SCANCODE_T, + [KEYCODE_U] = SDL_SCANCODE_U, + [KEYCODE_V] = SDL_SCANCODE_V, + [KEYCODE_W] = SDL_SCANCODE_W, + [KEYCODE_X] = SDL_SCANCODE_X, + [KEYCODE_Y] = SDL_SCANCODE_Y, + [KEYCODE_Z] = SDL_SCANCODE_Z, + [KEYCODE_UP] = SDL_SCANCODE_UP, + [KEYCODE_DOWN] = SDL_SCANCODE_DOWN, + [KEYCODE_LEFT] = SDL_SCANCODE_LEFT, + [KEYCODE_PG_UP] = SDL_SCANCODE_PAGEUP, + [KEYCODE_PG_DOWN] = SDL_SCANCODE_PAGEDOWN, + [KEYCODE_RIGHT] = SDL_SCANCODE_RIGHT, + [KEYCODE_RETURN] = SDL_SCANCODE_RETURN, + [KEYCODE_TAB] = SDL_SCANCODE_TAB, + [KEYCODE_ESCAPE] = SDL_SCANCODE_ESCAPE, +}; + +/** + * Called from the event dispatcher when a keyboard event is encountered. + * Translates the event such that it can be handled by SDL. + * @param event Screen keyboard event + */ +void +handleKeyboardEvent(screen_event_t event) +{ + int val; + SDL_Scancode scancode; + + // Get the key value. + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &val) < 0) { + return; + } + + // Skip unrecognized keys. + if ((val < 0) || (val >= SDL_TABLESIZE(key_to_sdl))) { + return; + } + + // Translate to an SDL scan code. + scancode = key_to_sdl[val]; + if (scancode == 0) { + return; + } + + // Get event flags (key state). + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &val) < 0) { + return; + } + + // Propagate the event to SDL. + // FIXME: + // Need to handle more key states (such as key combinations). + if (val & KEY_DOWN) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } else { + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } +} diff --git a/Engine/lib/sdl/src/video/qnx/sdl_qnx.h b/Engine/lib/sdl/src/video/qnx/sdl_qnx.h new file mode 100644 index 000000000..65e07988e --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/sdl_qnx.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef __SDL_QNX_H__ +#define __SDL_QNX_H__ + +#include "../SDL_sysvideo.h" +#include +#include + +typedef struct +{ + screen_window_t window; + EGLSurface surface; + EGLConfig conf; +} window_impl_t; + +extern void handleKeyboardEvent(screen_event_t event); + +extern int glGetConfig(EGLConfig *pconf, int *pformat); +extern int glLoadLibrary(_THIS, const char *name); +void *glGetProcAddress(_THIS, const char *proc); +extern SDL_GLContext glCreateContext(_THIS, SDL_Window *window); +extern int glSetSwapInterval(_THIS, int interval); +extern int glSwapWindow(_THIS, SDL_Window *window); +extern int glMakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void glDeleteContext(_THIS, SDL_GLContext context); +extern void glUnloadLibrary(_THIS); + +#endif diff --git a/Engine/lib/sdl/src/video/qnx/video.c b/Engine/lib/sdl/src/video/qnx/video.c new file mode 100644 index 000000000..ff8223c77 --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/video.c @@ -0,0 +1,364 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" +#include "../SDL_sysvideo.h" +#include "sdl_qnx.h" + +static screen_context_t context; +static screen_event_t event; + +/** + * Initializes the QNX video plugin. + * Creates the Screen context and event handles used for all window operations + * by the plugin. + * @param _THIS + * @return 0 if successful, -1 on error + */ +static int +videoInit(_THIS) +{ + SDL_VideoDisplay display; + + if (screen_create_context(&context, 0) < 0) { + return -1; + } + + if (screen_create_event(&event) < 0) { + return -1; + } + + SDL_zero(display); + + if (SDL_AddVideoDisplay(&display) < 0) { + return -1; + } + + _this->num_displays = 1; + return 0; +} + +static void +videoQuit(_THIS) +{ +} + +/** + * Creates a new native Screen window and associates it with the given SDL + * window. + * @param _THIS + * @param window SDL window to initialize + * @return 0 if successful, -1 on error + */ +static int +createWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl; + int size[2]; + int numbufs; + int format; + int usage; + + impl = SDL_calloc(1, sizeof(*impl)); + if (impl == NULL) { + return -1; + } + + // Create a native window. + if (screen_create_window(&impl->window, context) < 0) { + goto fail; + } + + // Set the native window's size to match the SDL window. + size[0] = window->w; + size[1] = window->h; + + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, + size) < 0) { + goto fail; + } + + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE, + size) < 0) { + goto fail; + } + + // Create window buffer(s). + if (window->flags & SDL_WINDOW_OPENGL) { + if (glGetConfig(&impl->conf, &format) < 0) { + goto fail; + } + numbufs = 2; + + usage = SCREEN_USAGE_OPENGL_ES2; + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_USAGE, + &usage) < 0) { + return -1; + } + } else { + format = SCREEN_FORMAT_RGBX8888; + numbufs = 1; + } + + // Set pixel format. + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_FORMAT, + &format) < 0) { + goto fail; + } + + // Create buffer(s). + if (screen_create_window_buffers(impl->window, numbufs) < 0) { + goto fail; + } + + window->driverdata = impl; + return 0; + +fail: + if (impl->window) { + screen_destroy_window(impl->window); + } + + SDL_free(impl); + return -1; +} + +/** + * Gets a pointer to the Screen buffer associated with the given window. Note + * that the buffer is actually created in createWindow(). + * @param _THIS + * @param window SDL window to get the buffer for + * @param[out] pixles Holds a pointer to the window's buffer + * @param[out] format Holds the pixel format for the buffer + * @param[out] pitch Holds the number of bytes per line + * @return 0 if successful, -1 on error + */ +static int +createWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, + void ** pixels, int *pitch) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + screen_buffer_t buffer; + + // Get a pointer to the buffer's memory. + if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS, + (void **)&buffer) < 0) { + return -1; + } + + if (screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, + pixels) < 0) { + return -1; + } + + // Set format and pitch. + if (screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, + pitch) < 0) { + return -1; + } + + *format = SDL_PIXELFORMAT_RGB888; + return 0; +} + +/** + * Informs the window manager that the window needs to be updated. + * @param _THIS + * @param window The window to update + * @param rects An array of reectangular areas to update + * @param numrects Rect array length + * @return 0 if successful, -1 on error + */ +static int +updateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, + int numrects) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + screen_buffer_t buffer; + + if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS, + (void **)&buffer) < 0) { + return -1; + } + + screen_post_window(impl->window, buffer, numrects, (int *)rects, 0); + screen_flush_context(context, 0); + return 0; +} + +/** + * Runs the main event loop. + * @param _THIS + */ +static void +pumpEvents(_THIS) +{ + int type; + + for (;;) { + if (screen_get_event(context, event, 0) < 0) { + break; + } + + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type) + < 0) { + break; + } + + if (type == SCREEN_EVENT_NONE) { + break; + } + + switch (type) { + case SCREEN_EVENT_KEYBOARD: + handleKeyboardEvent(event); + break; + + default: + break; + } + } +} + +/** + * Updates the size of the native window using the geometry of the SDL window. + * @param _THIS + * @param window SDL window to update + */ +static void +setWindowSize(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + int size[2]; + + size[0] = window->w; + size[1] = window->h; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, size); + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE, + size); +} + +/** + * Makes the native window associated with the given SDL window visible. + * @param _THIS + * @param window SDL window to update + */ +static void +showWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + const int visible = 1; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE, + &visible); +} + +/** + * Makes the native window associated with the given SDL window invisible. + * @param _THIS + * @param window SDL window to update + */ +static void +hideWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + const int visible = 0; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE, + &visible); +} + +/** + * Destroys the native window associated with the given SDL window. + * @param _THIS + * @param window SDL window that is being destroyed + */ +static void +destroyWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + + if (impl) { + screen_destroy_window(impl->window); + window->driverdata = NULL; + } +} + +/** + * Frees the plugin object created by createDevice(). + * @param device Plugin object to free + */ +static void +deleteDevice(SDL_VideoDevice *device) +{ + SDL_free(device); +} + +/** + * Creates the QNX video plugin used by SDL. + * @param devindex Unused + * @return Initialized device if successful, NULL otherwise + */ +static SDL_VideoDevice * +createDevice(int devindex) +{ + SDL_VideoDevice *device; + + device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + return NULL; + } + + device->driverdata = NULL; + device->VideoInit = videoInit; + device->VideoQuit = videoQuit; + device->CreateSDLWindow = createWindow; + device->CreateWindowFramebuffer = createWindowFramebuffer; + device->UpdateWindowFramebuffer = updateWindowFramebuffer; + device->SetWindowSize = setWindowSize; + device->ShowWindow = showWindow; + device->HideWindow = hideWindow; + device->PumpEvents = pumpEvents; + device->DestroyWindow = destroyWindow; + + device->GL_LoadLibrary = glLoadLibrary; + device->GL_GetProcAddress = glGetProcAddress; + device->GL_CreateContext = glCreateContext; + device->GL_SetSwapInterval = glSetSwapInterval; + device->GL_SwapWindow = glSwapWindow; + device->GL_MakeCurrent = glMakeCurrent; + device->GL_DeleteContext = glDeleteContext; + device->GL_UnloadLibrary = glUnloadLibrary; + + device->free = deleteDevice; + return device; +} + +static int +available() +{ + return 1; +} + +VideoBootStrap QNX_bootstrap = { + "qnx", "QNX Screen", + available, createDevice +}; diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c index 4104568cc..406435511 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h index 54fc196e4..8b1737f13 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_rpievents_c_h -#define _SDL_rpievents_c_h +#ifndef SDL_rpievents_c_h_ +#define SDL_rpievents_c_h_ #include "SDL_rpivideo.h" @@ -28,4 +28,4 @@ void RPI_PumpEvents(_THIS); void RPI_EventInit(_THIS); void RPI_EventQuit(_THIS); -#endif /* _SDL_rpievents_c_h */ +#endif /* SDL_rpievents_c_h_ */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c index ae9bdfd5c..4ea976b3b 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -165,7 +165,7 @@ RPI_ShowCursor(SDL_Cursor * cursor) if (curdata->element == DISPMANX_NO_HANDLE) { vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16); - vc_dispmanx_rect_set(&dst_rect, 0, 0, curdata->w, curdata->h); + vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h); update = vc_dispmanx_update_start(10); SDL_assert(update); @@ -247,6 +247,65 @@ RPI_WarpMouseGlobal(int x, int y) return 0; } + /* Update internal mouse position. */ + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y); + + curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; + if (curdata->element == DISPMANX_NO_HANDLE) { + return 0; + } + + update = vc_dispmanx_update_start(10); + if (!update) { + return 0; + } + + src_rect.x = 0; + src_rect.y = 0; + src_rect.width = curdata->w << 16; + src_rect.height = curdata->h << 16; + dst_rect.x = x; + dst_rect.y = y; + dst_rect.width = curdata->w; + dst_rect.height = curdata->h; + + ret = vc_dispmanx_element_change_attributes( + update, + curdata->element, + 0, + 0, + 0, + &dst_rect, + &src_rect, + DISPMANX_NO_HANDLE, + DISPMANX_NO_ROTATE); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_element_change_attributes() failed"); + } + + /* Submit asynchronously, otherwise the peformance suffers a lot */ + ret = vc_dispmanx_update_submit(update, 0, NULL); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_update_submit() failed"); + } + return 0; +} + +/* Warp the mouse to (x,y) */ +static int +RPI_WarpMouseGlobalGraphicOnly(int x, int y) +{ + RPI_CursorData *curdata; + DISPMANX_UPDATE_HANDLE_T update; + int ret; + VC_RECT_T dst_rect; + VC_RECT_T src_rect; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) { + return 0; + } + curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; if (curdata->element == DISPMANX_NO_HANDLE) { return 0; @@ -317,7 +376,9 @@ static void RPI_MoveCursor(SDL_Cursor * cursor) { SDL_Mouse *mouse = SDL_GetMouse(); - RPI_WarpMouse(mouse->focus, mouse->x, mouse->y); + /* We must NOT call SDL_SendMouseMotion() on the next call or we will enter recursivity, + * so we create a version of WarpMouseGlobal without it. */ + RPI_WarpMouseGlobalGraphicOnly(mouse->x, mouse->y); } #endif /* SDL_VIDEO_DRIVER_RPI */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h index 6a4e70511..919f8115b 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_RPI_mouse_h -#define _SDL_RPI_mouse_h +#ifndef SDL_RPI_mouse_h_ +#define SDL_RPI_mouse_h_ #include "../SDL_sysvideo.h" @@ -38,6 +38,6 @@ struct _RPI_CursorData extern void RPI_InitMouse(_THIS); extern void RPI_QuitMouse(_THIS); -#endif /* _SDL_RPI_mouse_h */ +#endif /* SDL_RPI_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c index 0881dbde8..b7630075b 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" +#include "SDL_hints.h" +#include "SDL_log.h" #if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL @@ -27,13 +29,40 @@ /* EGL implementation of SDL OpenGL support */ +void +RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor) +{ + *mask = SDL_GL_CONTEXT_PROFILE_ES; + *major = 2; + *minor = 0; +} + int RPI_GLES_LoadLibrary(_THIS, const char *path) { - return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY); + return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0); +} + +int +RPI_GLES_SwapWindow(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed."); + return 0; + } + + /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios. + * Run your SDL2 program with "SDL_RPI_DOUBLE_BUFFER=1 " to enable this. */ + if (wdata->double_buffer) { + SDL_LockMutex(wdata->vsync_cond_mutex); + SDL_CondWait(wdata->vsync_cond, wdata->vsync_cond_mutex); + SDL_UnlockMutex(wdata->vsync_cond_mutex); + } + + return 0; } SDL_EGL_CreateContext_impl(RPI) -SDL_EGL_SwapWindow_impl(RPI) SDL_EGL_MakeCurrent_impl(RPI) #endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h index 83c800067..9724a5f73 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_rpiopengles_h -#define _SDL_rpiopengles_h +#ifndef SDL_rpiopengles_h_ +#define SDL_rpiopengles_h_ #if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL @@ -38,11 +38,12 @@ extern int RPI_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window); -extern void RPI_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int RPI_GLES_SwapWindow(_THIS, SDL_Window * window); extern int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor); #endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_rpiopengles_h */ +#endif /* SDL_rpiopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c index 67dc77b1c..e3863803a 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,11 +59,25 @@ RPI_Available(void) static void RPI_Destroy(SDL_VideoDevice * device) { - /* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */ + SDL_free(device->driverdata); + SDL_free(device); +} - if (device->driverdata != NULL) { - device->driverdata = NULL; - } +static int +RPI_GetRefreshRate() +{ + TV_DISPLAY_STATE_T tvstate; + if (vc_tv_get_display_state( &tvstate ) == 0) { + //The width/height parameters are in the same position in the union + //for HDMI and SDTV + HDMI_PROPERTY_PARAM_T property; + property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE; + vc_tv_hdmi_get_property(&property); + return property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ? + tvstate.display.hdmi.frame_rate * (1000.0f/1001.0f) : + tvstate.display.hdmi.frame_rate; + } + return 60; /* Failed to get display state, default to 60 */ } static SDL_VideoDevice * @@ -100,8 +114,8 @@ RPI_Create() device->VideoQuit = RPI_VideoQuit; device->GetDisplayModes = RPI_GetDisplayModes; device->SetDisplayMode = RPI_SetDisplayMode; - device->CreateWindow = RPI_CreateWindow; - device->CreateWindowFrom = RPI_CreateWindowFrom; + device->CreateSDLWindow = RPI_CreateWindow; + device->CreateSDLWindowFrom = RPI_CreateWindowFrom; device->SetWindowTitle = RPI_SetWindowTitle; device->SetWindowIcon = RPI_SetWindowIcon; device->SetWindowPosition = RPI_SetWindowPosition; @@ -114,7 +128,9 @@ RPI_Create() device->RestoreWindow = RPI_RestoreWindow; device->SetWindowGrab = RPI_SetWindowGrab; device->DestroyWindow = RPI_DestroyWindow; +#if 0 device->GetWindowWMInfo = RPI_GetWindowWMInfo; +#endif device->GL_LoadLibrary = RPI_GLES_LoadLibrary; device->GL_GetProcAddress = RPI_GLES_GetProcAddress; device->GL_UnloadLibrary = RPI_GLES_UnloadLibrary; @@ -124,6 +140,7 @@ RPI_Create() device->GL_GetSwapInterval = RPI_GLES_GetSwapInterval; device->GL_SwapWindow = RPI_GLES_SwapWindow; device->GL_DeleteContext = RPI_GLES_DeleteContext; + device->GL_DefaultProfileConfig = RPI_GLES_DefaultProfileConfig; device->PumpEvents = RPI_PumpEvents; @@ -159,8 +176,7 @@ RPI_VideoInit(_THIS) current_mode.w = w; current_mode.h = h; - /* FIXME: Is there a way to tell the actual refresh rate? */ - current_mode.refresh_rate = 60; + current_mode.refresh_rate = RPI_GetRefreshRate(); /* 32 bpp for default */ current_mode.format = SDL_PIXELFORMAT_ABGR8888; @@ -183,7 +199,9 @@ RPI_VideoInit(_THIS) SDL_AddVideoDisplay(&display); #ifdef SDL_INPUT_LINUXEV - SDL_EVDEV_Init(); + if (SDL_EVDEV_Init() < 0) { + return -1; + } #endif RPI_InitMouse(_this); @@ -212,6 +230,16 @@ RPI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) return 0; } +static void +RPI_vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data) +{ + SDL_WindowData *wdata = ((SDL_WindowData *) data); + + SDL_LockMutex(wdata->vsync_cond_mutex); + SDL_CondSignal(wdata->vsync_cond); + SDL_UnlockMutex(wdata->vsync_cond_mutex); +} + int RPI_CreateWindow(_THIS, SDL_Window * window) { @@ -287,9 +315,18 @@ RPI_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } + /* Start generating vsync callbacks if necesary */ + wdata->double_buffer = SDL_FALSE; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) { + wdata->vsync_cond = SDL_CreateCond(); + wdata->vsync_cond_mutex = SDL_CreateMutex(); + wdata->double_buffer = SDL_TRUE; + vc_dispmanx_vsync_callback(displaydata->dispman_display, RPI_vsync_callback, (void*)wdata); + } + /* Setup driver data for this window */ window->driverdata = wdata; - + /* One window, it always has focus */ SDL_SetMouseFocus(window); SDL_SetKeyboardFocus(window); @@ -302,7 +339,22 @@ void RPI_DestroyWindow(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; + if(data) { + if (data->double_buffer) { + /* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */ + SDL_LockMutex(data->vsync_cond_mutex); + SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex); + SDL_UnlockMutex(data->vsync_cond_mutex); + + vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL); + + SDL_DestroyCond(data->vsync_cond); + SDL_DestroyMutex(data->vsync_cond_mutex); + } + #if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); @@ -368,13 +420,14 @@ RPI_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -382,6 +435,7 @@ RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif #endif /* SDL_VIDEO_DRIVER_RPI */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h index 74dcf9414..b2eb670ae 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "../../SDL_internal.h" #include "../SDL_sysvideo.h" -#include "bcm_host.h" +#include #include "GLES/gl.h" #include "EGL/egl.h" #include "EGL/eglext.h" @@ -48,6 +48,12 @@ typedef struct SDL_WindowData #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif + + /* Vsync callback cond and mutex */ + SDL_cond *vsync_cond; + SDL_mutex *vsync_cond_mutex; + SDL_bool double_buffer; + } SDL_WindowData; #define SDL_RPI_VIDEOLAYER 10000 /* High enough so to occlude everything */ @@ -90,7 +96,7 @@ SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window); int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); int RPI_GLES_SetSwapInterval(_THIS, int interval); int RPI_GLES_GetSwapInterval(_THIS); -void RPI_GLES_SwapWindow(_THIS, SDL_Window * window); +int RPI_GLES_SwapWindow(_THIS, SDL_Window * window); void RPI_GLES_DeleteContext(_THIS, SDL_GLContext context); #endif /* __SDL_RPIVIDEO_H__ */ diff --git a/Engine/lib/sdl/src/video/sdlgenblit.pl b/Engine/lib/sdl/src/video/sdlgenblit.pl index 9ebffafc4..d89ae2a8c 100755 --- a/Engine/lib/sdl/src/video/sdlgenblit.pl +++ b/Engine/lib/sdl/src/video/sdlgenblit.pl @@ -92,7 +92,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h index edf09f50f..34b01384d 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,12 @@ - (void)hideLaunchScreen; +/* This property is marked as optional, and is only intended to be used when + * the app's UI is storyboard-based. SDL is not storyboard-based, however + * several major third-party ad APIs (e.g. Google admob) incorrectly assume this + * property always exists, and will crash if it doesn't. */ +@property (nonatomic) UIWindow *window; + @end /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m index c94c78a41..a942dfde0 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,7 +69,7 @@ int main(int argc, char **argv) return exit_status; } -static void +static void SDLCALL SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { BOOL disable = (hint && *hint != '0'); @@ -422,14 +422,24 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) return YES; } -- (void)applicationWillTerminate:(UIApplication *)application +- (UIWindow *)window { - SDL_SendAppEvent(SDL_APP_TERMINATING); + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (_this) { + SDL_Window *window = NULL; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + if (data != nil) { + return data.uiwindow; + } + } + } + return nil; } -- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application +- (void)setWindow:(UIWindow *)window { - SDL_SendAppEvent(SDL_APP_LOWMEMORY); + /* Do nothing. */ } #if !TARGET_OS_TV @@ -462,41 +472,34 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) } #endif +- (void)applicationWillTerminate:(UIApplication *)application +{ + SDL_OnApplicationWillTerminate(); +} + +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application +{ + SDL_OnApplicationDidReceiveMemoryWarning(); +} + - (void)applicationWillResignActive:(UIApplication*)application { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this) { - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } - } - SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); + SDL_OnApplicationWillResignActive(); } - (void)applicationDidEnterBackground:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); + SDL_OnApplicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); + SDL_OnApplicationWillEnterForeground(); } - (void)applicationDidBecomeActive:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); - - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this) { - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); - } - } + SDL_OnApplicationDidBecomeActive(); } - (void)sendDropFileForURL:(NSURL *)url @@ -510,23 +513,24 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) SDL_SendDropComplete(NULL); } -#if TARGET_OS_TV -/* TODO: Use this on iOS 9+ as well? */ +#if TARGET_OS_TV || (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0) + - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { /* TODO: Handle options */ [self sendDropFileForURL:url]; return YES; } -#endif /* TARGET_OS_TV */ -#if !TARGET_OS_TV +#else + - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { [self sendDropFileForURL:url]; return YES; } -#endif /* !TARGET_OS_TV */ + +#endif @end diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h index 7d1c35f99..c4b689dbe 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitclipboard_h -#define _SDL_uikitclipboard_h +#ifndef SDL_uikitclipboard_h_ +#define SDL_uikitclipboard_h_ #include "../SDL_sysvideo.h" @@ -30,6 +30,6 @@ extern SDL_bool UIKit_HasClipboardText(_THIS); extern void UIKit_InitClipboard(_THIS); extern void UIKit_QuitClipboard(_THIS); -#endif /* _SDL_uikitclipboard_h */ +#endif /* SDL_uikitclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m index 050d5885f..b1d4f6d01 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h index 9b1d60c59..0c488291b 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,13 +18,13 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitevents_h -#define _SDL_uikitevents_h +#ifndef SDL_uikitevents_h_ +#define SDL_uikitevents_h_ #include "../SDL_sysvideo.h" extern void UIKit_PumpEvents(_THIS); -#endif /* _SDL_uikitevents_h */ +#endif /* SDL_uikitevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m index 7083e204b..d64e3301c 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h index 528072413..a766b577c 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #if SDL_VIDEO_DRIVER_UIKIT -extern SDL_bool UIKit_ShowingMessageBox(); +extern SDL_bool UIKit_ShowingMessageBox(void); extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m index 5778032a0..7950c8e69 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,7 @@ static SDL_bool s_showingMessageBox = SDL_FALSE; SDL_bool -UIKit_ShowingMessageBox() +UIKit_ShowingMessageBox(void) { return s_showingMessageBox; } @@ -109,6 +109,18 @@ UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, in alertwindow.hidden = YES; } + /* Force the main SDL window to re-evaluate home indicator state */ + SDL_Window *focus = SDL_GetFocusWindow(); + if (focus) { + SDL_WindowData *data = (__bridge SDL_WindowData *) focus->driverdata; + if (data != nil) { + if (@available(iOS 11.0, *)) { + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO]; + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO]; + } + } + } + *buttonid = messageboxdata->buttons[clickedindex].buttonid; return YES; #else diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h new file mode 100644 index 000000000..bc977781f --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h @@ -0,0 +1,58 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#ifndef SDL_uikitmetalview_h_ +#define SDL_uikitmetalview_h_ + +#import "../SDL_sysvideo.h" +#import "SDL_uikitwindow.h" + +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) + +#import +#import +#import + +#define METALVIEW_TAG 255 + +@interface SDL_uikitmetalview : SDL_uikitview + +- (instancetype)initWithFrame:(CGRect)frame + scale:(CGFloat)scale; + +@end + +SDL_uikitmetalview* UIKit_Mtl_AddMetalView(SDL_Window* window); + +void UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h); + +#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */ + +#endif /* SDL_uikitmetalview_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m new file mode 100644 index 000000000..104189d8c --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m @@ -0,0 +1,124 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) + +#import "../SDL_sysvideo.h" +#import "SDL_uikitwindow.h" +#import "SDL_uikitmetalview.h" + +#include "SDL_assert.h" + +@implementation SDL_uikitmetalview + +/* Returns a Metal-compatible layer. */ ++ (Class)layerClass +{ + return [CAMetalLayer class]; +} + +- (instancetype)initWithFrame:(CGRect)frame + scale:(CGFloat)scale +{ + if ((self = [super initWithFrame:frame])) { + self.tag = METALVIEW_TAG; + /* Set the desired scale. The default drawableSize of a CAMetalLayer + * is its bounds x its scale so nothing further needs to be done. */ + self.layer.contentsScale = scale; + } + + return self; +} + +/* Set the size of the metal drawables when the view is resized. */ +- (void)layoutSubviews +{ + [super layoutSubviews]; +} + +@end + +SDL_uikitmetalview* +UIKit_Mtl_AddMetalView(SDL_Window* window) +{ + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view; + CGFloat scale = 1.0; + + if ([view isKindOfClass:[SDL_uikitmetalview class]]) { + return (SDL_uikitmetalview *)view; + } + + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + /* Set the scale to the natural scale factor of the screen - then + * the backing dimensions of the Metal view will match the pixel + * dimensions of the screen rather than the dimensions in points + * yielding high resolution on retine displays. + */ +#ifdef __IPHONE_8_0 + if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) { + scale = data.uiwindow.screen.nativeScale; + } else +#endif + { + scale = data.uiwindow.screen.scale; + } + } + SDL_uikitmetalview *metalview + = [[SDL_uikitmetalview alloc] initWithFrame:view.frame + scale:scale]; + [metalview setSDLWindow:window]; + + return metalview; +} + +void +UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h) +{ + @autoreleasepool { + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view; + SDL_uikitmetalview* metalview = [view viewWithTag:METALVIEW_TAG]; + if (metalview) { + CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; + assert(layer != NULL); + if (w) { + *w = layer.drawableSize.width; + } + if (h) { + *h = layer.drawableSize.height; + } + } else { + SDL_GetWindowSize(window, w, h); + } + } +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h index b936df616..a1df0d496 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_uikitmodes_h -#define _SDL_uikitmodes_h +#ifndef SDL_uikitmodes_h_ +#define SDL_uikitmodes_h_ #include "SDL_uikitvideo.h" @@ -45,6 +45,6 @@ extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMo extern void UIKit_QuitModes(_THIS); extern int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); -#endif /* _SDL_uikitmodes_h */ +#endif /* SDL_uikitmodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m index cd3b8d08e..75e256bbf 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,21 +68,33 @@ UIKit_FreeDisplayModeData(SDL_DisplayMode * mode) } } +static NSUInteger +UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen) +{ +#ifdef __IPHONE_10_3 + if ([uiscreen respondsToSelector:@selector(maximumFramesPerSecond)]) { + return uiscreen.maximumFramesPerSecond; + } +#endif + return 0; +} + static int UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h, - UIScreenMode * uiscreenmode) + UIScreen * uiscreen, UIScreenMode * uiscreenmode) { SDL_DisplayMode mode; SDL_zero(mode); - mode.format = SDL_PIXELFORMAT_ABGR8888; - mode.refresh_rate = 0; if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) { return -1; } + mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen); mode.w = w; mode.h = h; + if (SDL_AddDisplayMode(display, &mode)) { return 0; } else { @@ -92,16 +104,16 @@ UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h, } static int -UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, +UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, UIScreen * uiscreen, UIScreenMode * uiscreenmode, SDL_bool addRotation) { - if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode) < 0) { + if (UIKit_AddSingleDisplayMode(display, w, h, uiscreen, uiscreenmode) < 0) { return -1; } if (addRotation) { /* Add the rotated version */ - if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode) < 0) { + if (UIKit_AddSingleDisplayMode(display, h, w, uiscreen, uiscreenmode) < 0) { return -1; } } @@ -112,7 +124,11 @@ UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, static int UIKit_AddDisplay(UIScreen *uiscreen) { + UIScreenMode *uiscreenmode = uiscreen.currentMode; CGSize size = uiscreen.bounds.size; + SDL_VideoDisplay display; + SDL_DisplayMode mode; + SDL_zero(mode); /* Make sure the width/height are oriented correctly */ if (UIKit_IsDisplayLandscape(uiscreen) != (size.width > size.height)) { @@ -121,15 +137,11 @@ UIKit_AddDisplay(UIScreen *uiscreen) size.height = height; } - SDL_VideoDisplay display; - SDL_DisplayMode mode; - SDL_zero(mode); mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen); mode.w = (int) size.width; mode.h = (int) size.height; - UIScreenMode *uiscreenmode = uiscreen.currentMode; - if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) { return -1; } @@ -220,7 +232,7 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) h = tmp; } - UIKit_AddDisplayMode(display, w, h, uimode, addRotation); + UIKit_AddDisplayMode(display, w, h, data.uiscreen, uimode, addRotation); } } } @@ -261,6 +273,7 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) @autoreleasepool { int displayIndex = (int) (display - _this->displays); SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata; + CGRect frame = data.uiscreen.bounds; /* the default function iterates displays to make a fake offset, as if all the displays were side-by-side, which is fine for iOS. */ @@ -268,9 +281,7 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return -1; } - CGRect frame = data.uiscreen.bounds; - -#if !TARGET_OS_TV +#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 if (!UIKit_IsSystemVersionAtLeast(7.0)) { frame = [data.uiscreen applicationFrame]; } diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h index b52e42913..6b57289ff 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitopengles -#define _SDL_uikitopengles +#ifndef SDL_uikitopengles_ +#define SDL_uikitopengles_ #include "../SDL_sysvideo.h" @@ -27,14 +27,14 @@ extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void UIKit_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); -extern void UIKit_GL_SwapWindow(_THIS, SDL_Window * window); +extern int UIKit_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window); extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context); extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc); extern int UIKit_GL_LoadLibrary(_THIS, const char *path); -extern void UIKit_GL_RestoreCurrentContext(); +extern void UIKit_GL_RestoreCurrentContext(void); -#endif +#endif /* SDL_uikitopengles_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m index 461ff9b80..2f6dec45e 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -111,7 +111,7 @@ UIKit_GL_LoadLibrary(_THIS, const char *path) return 0; } -void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) +int UIKit_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { SDLEAGLContext *context = (__bridge SDLEAGLContext *) SDL_GL_GetCurrentContext(); @@ -127,6 +127,7 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) * We don't pump events here because we don't want iOS application events * (low memory, terminate, etc.) to happen inside low level rendering. */ } + return 0; } SDL_GLContext @@ -227,7 +228,7 @@ UIKit_GL_DeleteContext(_THIS, SDL_GLContext context) } void -UIKit_GL_RestoreCurrentContext() +UIKit_GL_RestoreCurrentContext(void) { @autoreleasepool { /* Some iOS system functionality (such as Dictation on the on-screen diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h index 86fb5e12e..8d12c9ff8 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m index aae7ee8f2..b0628bfdb 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h index aafb714d7..e24183a0b 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitvideo_h -#define _SDL_uikitvideo_h +#ifndef SDL_uikitvideo_h_ +#define SDL_uikitvideo_h_ #include "../SDL_sysvideo.h" @@ -29,7 +29,7 @@ @interface SDL_VideoData : NSObject -@property (nonatomic) id pasteboardObserver; +@property (nonatomic, assign) id pasteboardObserver; @end @@ -41,6 +41,6 @@ void UIKit_SuspendScreenSaver(_THIS); SDL_bool UIKit_IsSystemVersionAtLeast(double version); -#endif /* _SDL_uikitvideo_h */ +#endif /* SDL_uikitvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m index 88d461751..e74339f42 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,7 @@ #include "SDL_uikitwindow.h" #include "SDL_uikitopengles.h" #include "SDL_uikitclipboard.h" +#include "SDL_uikitvulkan.h" #define UIKITVID_DRIVER_NAME "uikit" @@ -90,7 +91,7 @@ UIKit_CreateDevice(int devindex) device->SetDisplayMode = UIKit_SetDisplayMode; device->PumpEvents = UIKit_PumpEvents; device->SuspendScreenSaver = UIKit_SuspendScreenSaver; - device->CreateWindow = UIKit_CreateWindow; + device->CreateSDLWindow = UIKit_CreateWindow; device->SetWindowTitle = UIKit_SetWindowTitle; device->ShowWindow = UIKit_ShowWindow; device->HideWindow = UIKit_HideWindow; @@ -101,13 +102,13 @@ UIKit_CreateDevice(int devindex) device->GetWindowWMInfo = UIKit_GetWindowWMInfo; device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds; - #if SDL_IPHONE_KEYBOARD +#if SDL_IPHONE_KEYBOARD device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; device->HideScreenKeyboard = UIKit_HideScreenKeyboard; device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; device->SetTextInputRect = UIKit_SetTextInputRect; - #endif +#endif device->SetClipboardText = UIKit_SetClipboardText; device->GetClipboardText = UIKit_GetClipboardText; @@ -123,6 +124,15 @@ UIKit_CreateDevice(int devindex) device->GL_LoadLibrary = UIKit_GL_LoadLibrary; device->free = UIKit_DeleteDevice; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions + = UIKit_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize; +#endif + device->gl_config.accelerated = 1; return device; @@ -176,18 +186,39 @@ UIKit_IsSystemVersionAtLeast(double version) CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) { + CGRect frame = screen.bounds; + #if !TARGET_OS_TV && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0) BOOL hasiOS7 = UIKit_IsSystemVersionAtLeast(7.0); - if (hasiOS7 || (window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) { - /* The view should always show behind the status bar in iOS 7+. */ - return screen.bounds; - } else { - return screen.applicationFrame; + /* The view should always show behind the status bar in iOS 7+. */ + if (!hasiOS7 && !(window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) { + frame = screen.applicationFrame; } -#else - return screen.bounds; #endif + +#if !TARGET_OS_TV + /* iOS 10 seems to have a bug where, in certain conditions, putting the + * device to sleep with the a landscape-only app open, re-orienting the + * device to portrait, and turning it back on will result in the screen + * bounds returning portrait orientation despite the app being in landscape. + * This is a workaround until a better solution can be found. + * https://bugzilla.libsdl.org/show_bug.cgi?id=3505 + * https://bugzilla.libsdl.org/show_bug.cgi?id=3465 + * https://forums.developer.apple.com/thread/65337 */ + if (UIKit_IsSystemVersionAtLeast(8.0)) { + UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation; + BOOL isLandscape = UIInterfaceOrientationIsLandscape(orient); + + if (isLandscape != (frame.size.width > frame.size.height)) { + float height = frame.size.width; + frame.size.width = frame.size.height; + frame.size.height = height; + } + } +#endif + + return frame; } /* diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h index 18fa78f36..4457f6c25 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m index c7d9f51d9..bd60c552f 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_uikitview.h" +#include "SDL_hints.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/SDL_events_c.h" @@ -32,6 +33,9 @@ #import "SDL_uikitmodes.h" #import "SDL_uikitwindow.h" +/* This is defined in SDL_sysjoystick.m */ +extern int SDL_AppleTVRemoteOpenedAsJoystick; + @implementation SDL_uikitview { SDL_Window *sdlwindow; @@ -42,6 +46,25 @@ - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { +#if TARGET_OS_TV + /* Apple TV Remote touchpad swipe gestures. */ + UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeUp.direction = UISwipeGestureRecognizerDirectionUp; + [self addGestureRecognizer:swipeUp]; + + UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeDown.direction = UISwipeGestureRecognizerDirectionDown; + [self addGestureRecognizer:swipeDown]; + + UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft; + [self addGestureRecognizer:swipeLeft]; + + UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeRight.direction = UISwipeGestureRecognizerDirectionRight; + [self addGestureRecognizer:swipeRight]; +#endif + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.autoresizesSubviews = YES; @@ -215,10 +238,10 @@ return SDL_SCANCODE_RIGHT; case UIPressTypeSelect: /* HIG says: "primary button behavior" */ - return SDL_SCANCODE_SELECT; + return SDL_SCANCODE_RETURN; case UIPressTypeMenu: /* HIG says: "returns to previous screen" */ - return SDL_SCANCODE_MENU; + return SDL_SCANCODE_ESCAPE; case UIPressTypePlayPause: /* HIG says: "secondary button behavior" */ return SDL_SCANCODE_PAUSE; @@ -229,31 +252,34 @@ - (void)pressesBegan:(NSSet *)presses withEvent:(UIPressesEvent *)event { - for (UIPress *press in presses) { - SDL_Scancode scancode = [self scancodeFromPressType:press.type]; - SDL_SendKeyboardKey(SDL_PRESSED, scancode); - } - + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } + } [super pressesBegan:presses withEvent:event]; } - (void)pressesEnded:(NSSet *)presses withEvent:(UIPressesEvent *)event { - for (UIPress *press in presses) { - SDL_Scancode scancode = [self scancodeFromPressType:press.type]; - SDL_SendKeyboardKey(SDL_RELEASED, scancode); - } - + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } + } [super pressesEnded:presses withEvent:event]; } - (void)pressesCancelled:(NSSet *)presses withEvent:(UIPressesEvent *)event { - for (UIPress *press in presses) { - SDL_Scancode scancode = [self scancodeFromPressType:press.type]; - SDL_SendKeyboardKey(SDL_RELEASED, scancode); - } - + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } + } [super pressesCancelled:presses withEvent:event]; } @@ -264,6 +290,37 @@ } #endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */ +#if TARGET_OS_TV +-(void)swipeGesture:(UISwipeGestureRecognizer *)gesture +{ + /* Swipe gestures don't trigger begin states. */ + if (gesture.state == UIGestureRecognizerStateEnded) { + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + /* Send arrow key presses for now, as we don't have an external API + * which better maps to swipe gestures. */ + switch (gesture.direction) { + case UISwipeGestureRecognizerDirectionUp: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_UP); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_UP); + break; + case UISwipeGestureRecognizerDirectionDown: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DOWN); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DOWN); + break; + case UISwipeGestureRecognizerDirectionLeft: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LEFT); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LEFT); + break; + case UISwipeGestureRecognizerDirectionRight: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RIGHT); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RIGHT); + break; + } + } + } +} +#endif /* TARGET_OS_TV */ + @end #endif /* SDL_VIDEO_DRIVER_UIKIT */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h index 860852441..fffb14223 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,6 +58,10 @@ #if !TARGET_OS_TV - (NSUInteger)supportedInterfaceOrientations; - (BOOL)prefersStatusBarHidden; +- (BOOL)prefersHomeIndicatorAutoHidden; +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures; + +@property (nonatomic, assign) int homeIndicatorHidden; #endif #if SDL_IPHONE_KEYBOARD diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m index e6e903ee4..296274235 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ #endif #if TARGET_OS_TV -static void +static void SDLCALL SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { @autoreleasepool { @@ -50,6 +50,21 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char } #endif +#if !TARGET_OS_TV +static void SDLCALL +SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + @autoreleasepool { + SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *) userdata; + viewcontroller.homeIndicatorHidden = (hint && *hint) ? SDL_atoi(hint) : -1; + if (@available(iOS 11.0, *)) { + [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden]; + [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; + } + } +} +#endif + @implementation SDL_uikitviewcontroller { CADisplayLink *displayLink; int animationInterval; @@ -58,6 +73,7 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char #if SDL_IPHONE_KEYBOARD UITextField *textField; + BOOL rotatingOrientation; #endif } @@ -70,6 +86,7 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char #if SDL_IPHONE_KEYBOARD [self initKeyboard]; + rotatingOrientation = FALSE; #endif #if TARGET_OS_TV @@ -77,6 +94,12 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char SDL_AppleTVControllerUIHintChanged, (__bridge void *) self); #endif + +#if !TARGET_OS_TV + SDL_AddHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR, + SDL_HideHomeIndicatorHintChanged, + (__bridge void *) self); +#endif } return self; } @@ -92,6 +115,12 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char SDL_AppleTVControllerUIHintChanged, (__bridge void *) self); #endif + +#if !TARGET_OS_TV + SDL_DelHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR, + SDL_HideHomeIndicatorHintChanged, + (__bridge void *) self); +#endif } - (void)setAnimationCallback:(int)interval @@ -112,7 +141,22 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char - (void)startAnimation { displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(doLoop:)]; - [displayLink setFrameInterval:animationInterval]; + +#ifdef __IPHONE_10_3 + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + + if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] + && data != nil && data.uiwindow != nil + && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) { + displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval; + } else +#endif + { +#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100300 + [displayLink setFrameInterval:animationInterval]; +#endif + } + [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; } @@ -153,14 +197,44 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char return UIKit_GetSupportedOrientations(window); } +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient { return ([self supportedInterfaceOrientations] & (1 << orient)) != 0; } +#endif - (BOOL)prefersStatusBarHidden { - return (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0; + BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0; + return hidden; +} + +- (BOOL)prefersHomeIndicatorAutoHidden +{ + BOOL hidden = NO; + if (self.homeIndicatorHidden == 1) { + hidden = YES; + } + return hidden; +} + +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + if (self.homeIndicatorHidden >= 0) { + if (self.homeIndicatorHidden == 2) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } + } + + /* By default, fullscreen and borderless windows get all screen gestures */ + if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } } #endif @@ -211,6 +285,29 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char } } +/* willRotateToInterfaceOrientation and didRotateFromInterfaceOrientation are deprecated in iOS 8+ in favor of viewWillTransitionToSize */ +#if TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator +{ + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + rotatingOrientation = TRUE; + [coordinator animateAlongsideTransition:^(id context) {} + completion:^(id context) { + rotatingOrientation = FALSE; + }]; +} +#else +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { + [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; + rotatingOrientation = TRUE; +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { + [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + rotatingOrientation = FALSE; +} +#endif /* TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 */ + - (void)deinitKeyboard { #if !TARGET_OS_TV @@ -239,7 +336,7 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char - (void)keyboardWillShow:(NSNotification *)notification { #if !TARGET_OS_TV - CGRect kbrect = [[notification userInfo][UIKeyboardFrameBeginUserInfoKey] CGRectValue]; + CGRect kbrect = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; /* The keyboard rect is in the coordinate space of the screen/window, but we * want its height in the coordinate space of the view. */ @@ -251,7 +348,9 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char - (void)keyboardWillHide:(NSNotification *)notification { - SDL_StopTextInput(); + if (!rotatingOrientation) { + SDL_StopTextInput(); + } [self setKeyboardHeight:0]; } @@ -343,7 +442,9 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN); - SDL_StopTextInput(); + if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { + SDL_StopTextInput(); + } return YES; } diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h new file mode 100644 index 000000000..e3ec350d8 --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h @@ -0,0 +1,54 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_uikitvulkan_h_ +#define SDL_uikitvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT + +int UIKit_Vulkan_LoadLibrary(_THIS, const char *path); +void UIKit_Vulkan_UnloadLibrary(_THIS); +SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool UIKit_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); + +#endif + +#endif /* SDL_uikitvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m new file mode 100644 index 000000000..771c7a475 --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m @@ -0,0 +1,222 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT + +#include "SDL_uikitvideo.h" +#include "SDL_uikitwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_uikitvulkan.h" +#include "SDL_uikitmetalview.h" +#include "SDL_syswm.h" + +#include + +#define DEFAULT_MOLTENVK "libMoltenVK.dylib" +/* Since libSDL is static, could use RTLD_SELF. Using RTLD_DEFAULT is future + * proofing. */ +#define DEFAULT_HANDLE RTLD_DEFAULT + +int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasIOSSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + + if (_this->vulkan_config.loader_handle) { + return SDL_SetError("MoltenVK/Vulkan already loaded"); + } + + /* Load the Vulkan loader library */ + if (!path) { + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + } + + if (!path) { + /* MoltenVK framework, currently, v0.17.0, has a static library and is + * the recommended way to use the package. There is likely no object to + * load. */ + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, + "vkGetInstanceProcAddr"); + } + + if (vkGetInstanceProcAddr) { + _this->vulkan_config.loader_handle = DEFAULT_HANDLE; + } else { + if (!path) { + /* Look for the .dylib packaged with the application instead. */ + path = DEFAULT_MOLTENVK; + } + + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if (!_this->vulkan_config.loader_handle) { + return -1; + } + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, + "vkGetInstanceProcAddr"); + } + + if (!vkGetInstanceProcAddr) { + SDL_SetError("Failed to find %s in either executable or %s: %s", + "vkGetInstanceProcAddr", + DEFAULT_MOLTENVK, + (const char *) dlerror()); + goto fail; + } + + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + + if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) { + SDL_SetError("No vkEnumerateInstanceExtensionProperties found."); + goto fail; + } + + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + + if (!extensions) { + goto fail; + } + + for (Uint32 i = 0; i < extensionCount; i++) { + if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasSurfaceExtension = SDL_TRUE; + } else if (SDL_strcmp(VK_MVK_IOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasIOSSurfaceExtension = SDL_TRUE; + } + } + + SDL_free(extensions); + + if (!hasSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } else if (!hasIOSSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_MVK_IOS_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + + return 0; + +fail: + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void UIKit_Vulkan_UnloadLibrary(_THIS) +{ + if (_this->vulkan_config.loader_handle) { + if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + } + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForUIKit[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_IOS_SURFACE_EXTENSION_NAME + }; + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForUIKit), + extensionsForUIKit); +} + +SDL_bool UIKit_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK = + (PFN_vkCreateIOSSurfaceMVK)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateIOSSurfaceMVK"); + VkIOSSurfaceCreateInfoMVK createInfo = {}; + VkResult result; + + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if (!vkCreateIOSSurfaceMVK) { + SDL_SetError(VK_MVK_IOS_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + + createInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.pView = (__bridge void *)UIKit_Mtl_AddMetalView(window); + result = vkCreateIOSSurfaceMVK(instance, &createInfo, + NULL, surface); + if (result != VK_SUCCESS) { + SDL_SetError("vkCreateIOSSurfaceMVK failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + + return SDL_TRUE; +} + +void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + UIKit_Mtl_GetDrawableSize(window, w, h); +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h index ed08c55d4..46073eef0 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitwindow_h -#define _SDL_uikitwindow_h +#ifndef SDL_uikitwindow_h_ +#define SDL_uikitwindow_h_ #include "../SDL_sysvideo.h" #import "SDL_uikitvideo.h" @@ -51,6 +51,6 @@ extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window); @end -#endif /* _SDL_uikitwindow_h */ +#endif /* SDL_uikitwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m index 35c549b43..d01cff349 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,6 +107,14 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo #if !TARGET_OS_TV if (displaydata.uiscreen == [UIScreen mainScreen]) { + /* SDL_CreateWindow sets the window w&h to the display's bounds if the + * fullscreen flag is set. But the display bounds orientation might not + * match what we want, and GetSupportedOrientations call below uses the + * window w&h. They're overridden below anyway, so we'll just set them + * to the requested size for the purposes of determining orientation. */ + window->w = window->windowed.w; + window->h = window->windowed.h; + NSUInteger orients = UIKit_GetSupportedOrientations(window); BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0; BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0; @@ -360,7 +368,7 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/uikit/keyinfotable.h b/Engine/lib/sdl/src/video/uikit/keyinfotable.h index 962dbd922..3b2383747 100644 --- a/Engine/lib/sdl/src/video/uikit/keyinfotable.h +++ b/Engine/lib/sdl/src/video/uikit/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c index 687cc6a73..135e83881 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ VIVANTE_GLES_LoadLibrary(_THIS, const char *path) displaydata = SDL_GetDisplayDriverData(0); - return SDL_EGL_LoadLibrary(_this, path, displaydata->native_display); + return SDL_EGL_LoadLibrary(_this, path, displaydata->native_display, 0); } SDL_EGL_CreateContext_impl(VIVANTE) diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h index f47bf7797..162d61ab9 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_vivanteopengles_h -#define _SDL_vivanteopengles_h +#ifndef SDL_vivanteopengles_h_ +#define SDL_vivanteopengles_h_ #if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL @@ -38,11 +38,11 @@ extern int VIVANTE_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext VIVANTE_GLES_CreateContext(_THIS, SDL_Window * window); -extern void VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window); extern int VIVANTE_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); #endif /* SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_vivanteopengles_h */ +#endif /* SDL_vivanteopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c index 76233417e..67ea63350 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,16 @@ VIVANTE_SetupPlatform(_THIS) return 0; } +char *VIVANTE_GetDisplayName(_THIS) +{ + return NULL; +} + +void +VIVANTE_UpdateDisplayScale(_THIS) +{ +} + void VIVANTE_CleanupPlatform(_THIS) { diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h index 6e11cce62..59fbf6064 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_vivanteplatform_h -#define _SDL_vivanteplatform_h +#ifndef SDL_vivanteplatform_h_ +#define SDL_vivanteplatform_h_ #if SDL_VIDEO_DRIVER_VIVANTE @@ -36,10 +36,12 @@ #endif extern int VIVANTE_SetupPlatform(_THIS); +extern char *VIVANTE_GetDisplayName(_THIS); +extern void VIVANTE_UpdateDisplayScale(_THIS); extern void VIVANTE_CleanupPlatform(_THIS); #endif /* SDL_VIDEO_DRIVER_VIVANTE */ -#endif /* _SDL_vivanteplatform_h */ +#endif /* SDL_vivanteplatform_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c index 0372de5c3..656ab5567 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -88,7 +88,7 @@ VIVANTE_Create() device->VideoQuit = VIVANTE_VideoQuit; device->GetDisplayModes = VIVANTE_GetDisplayModes; device->SetDisplayMode = VIVANTE_SetDisplayMode; - device->CreateWindow = VIVANTE_CreateWindow; + device->CreateSDLWindow = VIVANTE_CreateWindow; device->SetWindowTitle = VIVANTE_SetWindowTitle; device->SetWindowPosition = VIVANTE_SetWindowPosition; device->SetWindowSize = VIVANTE_SetWindowSize; @@ -97,6 +97,7 @@ VIVANTE_Create() device->DestroyWindow = VIVANTE_DestroyWindow; device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo; +#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary; device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress; device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary; @@ -106,6 +107,7 @@ VIVANTE_Create() device->GL_GetSwapInterval = VIVANTE_GLES_GetSwapInterval; device->GL_SwapWindow = VIVANTE_GLES_SwapWindow; device->GL_DeleteContext = VIVANTE_GLES_DeleteContext; +#endif device->PumpEvents = VIVANTE_PumpEvents; @@ -152,6 +154,9 @@ VIVANTE_AddVideoDisplays(_THIS) switch (bpp) { default: /* Is another format used? */ + case 32: + current_mode.format = SDL_PIXELFORMAT_ARGB8888; + break; case 16: current_mode.format = SDL_PIXELFORMAT_RGB565; break; @@ -160,6 +165,7 @@ VIVANTE_AddVideoDisplays(_THIS) current_mode.refresh_rate = 60; SDL_zero(display); + display.name = VIVANTE_GetDisplayName(_this); display.desktop_mode = current_mode; display.current_mode = current_mode; display.driverdata = data; @@ -208,6 +214,8 @@ VIVANTE_VideoInit(_THIS) return -1; } + VIVANTE_UpdateDisplayScale(_this); + #ifdef SDL_INPUT_LINUXEV if (SDL_EVDEV_Init() < 0) { return -1; @@ -281,6 +289,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("VIVANTE: Can't create native window"); } +#if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window); if (data->egl_surface == EGL_NO_SURFACE) { @@ -289,6 +298,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window) } else { data->egl_surface = EGL_NO_SURFACE; } +#endif /* Window has been successfully created */ return 0; @@ -302,9 +312,11 @@ VIVANTE_DestroyWindow(_THIS, SDL_Window * window) data = window->driverdata; if (data) { +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } +#endif if (data->native_window) { #if SDL_VIDEO_DRIVER_VIVANTE_VDK @@ -376,7 +388,7 @@ VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) info->info.vivante.window = data->native_window; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h index b99c73375..d33556487 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_vivantevideo_h -#define _SDL_vivantevideo_h +#ifndef SDL_vivantevideo_h_ +#define SDL_vivantevideo_h_ #include "../../SDL_internal.h" #include "../SDL_sysvideo.h" @@ -86,6 +86,6 @@ SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, /* Event functions */ void VIVANTE_PumpEvents(_THIS); -#endif /* _SDL_vivantevideo_h */ +#endif /* SDL_vivantevideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c new file mode 100644 index 000000000..5fd826b9b --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c @@ -0,0 +1,123 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND + +#include "SDL_waylanddatamanager.h" +#include "SDL_waylandevents_c.h" + +int +Wayland_SetClipboardText(_THIS, const char *text) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + int status = 0; + + if (_this == NULL || _this->driverdata == NULL) { + status = SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + /* TODO: Support more than one seat */ + data_device = Wayland_get_data_device(video_data->input); + if (text[0] != '\0') { + SDL_WaylandDataSource* source = Wayland_data_source_create(_this); + Wayland_data_source_add_data(source, TEXT_MIME, text, + strlen(text) + 1); + + status = Wayland_data_device_set_selection(data_device, source); + if (status != 0) { + Wayland_data_source_destroy(source); + } + } else { + status = Wayland_data_device_clear_selection(data_device); + } + } + + return status; +} + +char * +Wayland_GetClipboardText(_THIS) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + char *text = NULL; + + void *buffer = NULL; + size_t length = 0; + + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + /* TODO: Support more than one seat */ + data_device = Wayland_get_data_device(video_data->input); + if (data_device->selection_offer != NULL) { + buffer = Wayland_data_offer_receive(data_device->selection_offer, + &length, TEXT_MIME, SDL_TRUE); + if (length > 0) { + text = (char*) buffer; + } + } else if (data_device->selection_source != NULL) { + buffer = Wayland_data_source_get_data(data_device->selection_source, + &length, TEXT_MIME, SDL_TRUE); + if (length > 0) { + text = (char*) buffer; + } + } + } + + if (text == NULL) { + text = SDL_strdup(""); + } + + return text; +} + +SDL_bool +Wayland_HasClipboardText(_THIS) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + SDL_bool result = SDL_FALSE; + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + data_device = Wayland_get_data_device(video_data->input); + if (data_device != NULL && Wayland_data_offer_has_mime( + data_device->selection_offer, TEXT_MIME)) { + result = SDL_TRUE; + } else if(data_device != NULL && Wayland_data_source_has_mime( + data_device->selection_source, TEXT_MIME)) { + result = SDL_TRUE; + } + } + return result; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h new file mode 100644 index 000000000..467e1c77f --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_waylandclipboard_h_ +#define SDL_waylandclipboard_h_ + +extern int Wayland_SetClipboardText(_THIS, const char *text); +extern char *Wayland_GetClipboardText(_THIS); +extern SDL_bool Wayland_HasClipboardText(_THIS); + +#endif /* SDL_waylandclipboard_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c new file mode 100644 index 000000000..f1b9742ce --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c @@ -0,0 +1,468 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND + +#include +#include +#include +#include + +#include "SDL_stdinc.h" +#include "SDL_assert.h" +#include "../../core/unix/SDL_poll.h" + +#include "SDL_waylandvideo.h" +#include "SDL_waylanddatamanager.h" + +#include "SDL_waylanddyn.h" + +static ssize_t +write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos) +{ + int ready = 0; + ssize_t bytes_written = 0; + ssize_t length = total_length - *pos; + + sigset_t sig_set; + sigset_t old_sig_set; + struct timespec zerotime = {0}; + + ready = SDL_IOReady(fd, SDL_TRUE, 1 * 1000); + + sigemptyset(&sig_set); + sigaddset(&sig_set, SIGPIPE); + + pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); + + if (ready == 0) { + bytes_written = SDL_SetError("Pipe timeout"); + } else if (ready < 0) { + bytes_written = SDL_SetError("Pipe select error"); + } else { + if (length > 0) { + bytes_written = write(fd, (Uint8*)buffer + *pos, SDL_min(length, PIPE_BUF)); + } + + if (bytes_written > 0) { + *pos += bytes_written; + } + } + + sigtimedwait(&sig_set, 0, &zerotime); + pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL); + + return bytes_written; +} + +static ssize_t +read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate) +{ + int ready = 0; + void* output_buffer = NULL; + char temp[PIPE_BUF]; + size_t new_buffer_length = 0; + ssize_t bytes_read = 0; + size_t pos = 0; + + ready = SDL_IOReady(fd, SDL_FALSE, 1 * 1000); + + if (ready == 0) { + bytes_read = SDL_SetError("Pipe timeout"); + } else if (ready < 0) { + bytes_read = SDL_SetError("Pipe select error"); + } else { + bytes_read = read(fd, temp, sizeof(temp)); + } + + if (bytes_read > 0) { + pos = *total_length; + *total_length += bytes_read; + + if (null_terminate == SDL_TRUE) { + new_buffer_length = *total_length + 1; + } else { + new_buffer_length = *total_length; + } + + if (*buffer == NULL) { + output_buffer = SDL_malloc(new_buffer_length); + } else { + output_buffer = SDL_realloc(*buffer, new_buffer_length); + } + + if (output_buffer == NULL) { + bytes_read = SDL_OutOfMemory(); + } else { + SDL_memcpy((Uint8*)output_buffer + pos, temp, bytes_read); + + if (null_terminate == SDL_TRUE) { + SDL_memset((Uint8*)output_buffer + (new_buffer_length - 1), 0, 1); + } + + *buffer = output_buffer; + } + } + + return bytes_read; +} + +#define MIME_LIST_SIZE 4 + +static const char* mime_conversion_list[MIME_LIST_SIZE][2] = { + {"text/plain", TEXT_MIME}, + {"TEXT", TEXT_MIME}, + {"UTF8_STRING", TEXT_MIME}, + {"STRING", TEXT_MIME} +}; + +const char* +Wayland_convert_mime_type(const char *mime_type) +{ + const char *found = mime_type; + + size_t index = 0; + + for (index = 0; index < MIME_LIST_SIZE; ++index) { + if (strcmp(mime_conversion_list[index][0], mime_type) == 0) { + found = mime_conversion_list[index][1]; + break; + } + } + + return found; +} + +static SDL_MimeDataList* +mime_data_list_find(struct wl_list* list, + const char* mime_type) +{ + SDL_MimeDataList *found = NULL; + + SDL_MimeDataList *mime_list = NULL; + wl_list_for_each(mime_list, list, link) { + if (strcmp(mime_list->mime_type, mime_type) == 0) { + found = mime_list; + break; + } + } + return found; +} + +static int +mime_data_list_add(struct wl_list* list, + const char* mime_type, + void* buffer, size_t length) +{ + int status = 0; + size_t mime_type_length = 0; + + SDL_MimeDataList *mime_data = NULL; + + mime_data = mime_data_list_find(list, mime_type); + + if (mime_data == NULL) { + mime_data = SDL_calloc(1, sizeof(*mime_data)); + if (mime_data == NULL) { + status = SDL_OutOfMemory(); + } else { + WAYLAND_wl_list_insert(list, &(mime_data->link)); + + mime_type_length = strlen(mime_type) + 1; + mime_data->mime_type = SDL_malloc(mime_type_length); + if (mime_data->mime_type == NULL) { + status = SDL_OutOfMemory(); + } else { + SDL_memcpy(mime_data->mime_type, mime_type, mime_type_length); + } + } + } + + if (mime_data != NULL && buffer != NULL && length > 0) { + if (mime_data->data != NULL) { + SDL_free(mime_data->data); + } + mime_data->data = buffer; + mime_data->length = length; + } + + return status; +} + +static void +mime_data_list_free(struct wl_list *list) +{ + SDL_MimeDataList *mime_data = NULL; + SDL_MimeDataList *next = NULL; + + wl_list_for_each_safe(mime_data, next, list, link) { + if (mime_data->data != NULL) { + SDL_free(mime_data->data); + } + if (mime_data->mime_type != NULL) { + SDL_free(mime_data->mime_type); + } + SDL_free(mime_data); + } +} + +ssize_t +Wayland_data_source_send(SDL_WaylandDataSource *source, + const char *mime_type, int fd) +{ + size_t written_bytes = 0; + ssize_t status = 0; + SDL_MimeDataList *mime_data = NULL; + + mime_type = Wayland_convert_mime_type(mime_type); + mime_data = mime_data_list_find(&source->mimes, + mime_type); + + if (mime_data == NULL || mime_data->data == NULL) { + status = SDL_SetError("Invalid mime type"); + close(fd); + } else { + while (write_pipe(fd, mime_data->data, mime_data->length, + &written_bytes) > 0); + close(fd); + status = written_bytes; + } + return status; +} + +int Wayland_data_source_add_data(SDL_WaylandDataSource *source, + const char *mime_type, + const void *buffer, + size_t length) +{ + int status = 0; + if (length > 0) { + void *internal_buffer = SDL_malloc(length); + if (internal_buffer == NULL) { + status = SDL_OutOfMemory(); + } else { + SDL_memcpy(internal_buffer, buffer, length); + status = mime_data_list_add(&source->mimes, mime_type, + internal_buffer, length); + } + } + return status; +} + +SDL_bool +Wayland_data_source_has_mime(SDL_WaylandDataSource *source, + const char *mime_type) +{ + SDL_bool found = SDL_FALSE; + + if (source != NULL) { + found = mime_data_list_find(&source->mimes, mime_type) != NULL; + } + return found; +} + +void* +Wayland_data_source_get_data(SDL_WaylandDataSource *source, + size_t *length, const char* mime_type, + SDL_bool null_terminate) +{ + SDL_MimeDataList *mime_data = NULL; + void *buffer = NULL; + *length = 0; + + if (source == NULL) { + SDL_SetError("Invalid data source"); + } else { + mime_data = mime_data_list_find(&source->mimes, mime_type); + if (mime_data != NULL && mime_data->length > 0) { + buffer = SDL_malloc(mime_data->length); + if (buffer == NULL) { + *length = SDL_OutOfMemory(); + } else { + *length = mime_data->length; + SDL_memcpy(buffer, mime_data->data, mime_data->length); + } + } + } + + return buffer; +} + +void +Wayland_data_source_destroy(SDL_WaylandDataSource *source) +{ + if (source != NULL) { + wl_data_source_destroy(source->source); + mime_data_list_free(&source->mimes); + SDL_free(source); + } +} + +void* +Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, + size_t *length, const char* mime_type, + SDL_bool null_terminate) +{ + SDL_WaylandDataDevice *data_device = NULL; + + int pipefd[2]; + void *buffer = NULL; + *length = 0; + + if (offer == NULL) { + SDL_SetError("Invalid data offer"); + } else if ((data_device = offer->data_device) == NULL) { + SDL_SetError("Data device not initialized"); + } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + SDL_SetError("Could not read pipe"); + } else { + wl_data_offer_receive(offer->offer, mime_type, pipefd[1]); + + /* TODO: Needs pump and flush? */ + WAYLAND_wl_display_flush(data_device->video_data->display); + + close(pipefd[1]); + + while (read_pipe(pipefd[0], &buffer, length, null_terminate) > 0); + close(pipefd[0]); + } + return buffer; +} + +int +Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer, + const char* mime_type) +{ + return mime_data_list_add(&offer->mimes, mime_type, NULL, 0); +} + + +SDL_bool +Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, + const char *mime_type) +{ + SDL_bool found = SDL_FALSE; + + if (offer != NULL) { + found = mime_data_list_find(&offer->mimes, mime_type) != NULL; + } + return found; +} + +void +Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer) +{ + if (offer != NULL) { + wl_data_offer_destroy(offer->offer); + mime_data_list_free(&offer->mimes); + SDL_free(offer); + } +} + +int +Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device) +{ + int status = 0; + + if (data_device == NULL || data_device->data_device == NULL) { + status = SDL_SetError("Invalid Data Device"); + } else if (data_device->selection_source != 0) { + wl_data_device_set_selection(data_device->data_device, NULL, 0); + data_device->selection_source = NULL; + } + return status; +} + +int +Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device, + SDL_WaylandDataSource *source) +{ + int status = 0; + size_t num_offers = 0; + size_t index = 0; + + if (data_device == NULL) { + status = SDL_SetError("Invalid Data Device"); + } else if (source == NULL) { + status = SDL_SetError("Invalid source"); + } else { + SDL_MimeDataList *mime_data = NULL; + + wl_list_for_each(mime_data, &(source->mimes), link) { + wl_data_source_offer(source->source, + mime_data->mime_type); + + /* TODO - Improve system for multiple mime types to same data */ + for (index = 0; index < MIME_LIST_SIZE; ++index) { + if (strcmp(mime_conversion_list[index][1], mime_data->mime_type) == 0) { + wl_data_source_offer(source->source, + mime_conversion_list[index][0]); + } + } + /* */ + + ++num_offers; + } + + if (num_offers == 0) { + Wayland_data_device_clear_selection(data_device); + status = SDL_SetError("No mime data"); + } else { + /* Only set if there is a valid serial if not set it later */ + if (data_device->selection_serial != 0) { + wl_data_device_set_selection(data_device->data_device, + source->source, + data_device->selection_serial); + } + data_device->selection_source = source; + } + } + + return status; +} + +int +Wayland_data_device_set_serial(SDL_WaylandDataDevice *data_device, + uint32_t serial) +{ + int status = -1; + if (data_device != NULL) { + status = 0; + + /* If there was no serial and there is a pending selection set it now. */ + if (data_device->selection_serial == 0 + && data_device->selection_source != NULL) { + wl_data_device_set_selection(data_device->data_device, + data_device->selection_source->source, + serial); + } + + data_device->selection_serial = serial; + } + + return status; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h new file mode 100644 index 000000000..9b13e64d5 --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h @@ -0,0 +1,103 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_waylanddatamanager_h_ +#define SDL_waylanddatamanager_h_ + +#include "SDL_waylandvideo.h" +#include "SDL_waylandwindow.h" + +#define TEXT_MIME "text/plain;charset=utf-8" +#define FILE_MIME "text/uri-list" + +typedef struct { + char *mime_type; + void *data; + size_t length; + struct wl_list link; +} SDL_MimeDataList; + +typedef struct { + struct wl_data_source *source; + struct wl_list mimes; +} SDL_WaylandDataSource; + +typedef struct { + struct wl_data_offer *offer; + struct wl_list mimes; + void *data_device; +} SDL_WaylandDataOffer; + +typedef struct { + struct wl_data_device *data_device; + SDL_VideoData *video_data; + + /* Drag and Drop */ + uint32_t drag_serial; + SDL_WaylandDataOffer *drag_offer; + SDL_WaylandDataOffer *selection_offer; + + /* Clipboard */ + uint32_t selection_serial; + SDL_WaylandDataSource *selection_source; +} SDL_WaylandDataDevice; + +extern const char* Wayland_convert_mime_type(const char *mime_type); + +/* Wayland Data Source - (Sending) */ +extern SDL_WaylandDataSource* Wayland_data_source_create(_THIS); +extern ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source, + const char *mime_type, int fd); +extern int Wayland_data_source_add_data(SDL_WaylandDataSource *source, + const char *mime_type, + const void *buffer, + size_t length); +extern SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source, + const char *mime_type); +extern void* Wayland_data_source_get_data(SDL_WaylandDataSource *source, + size_t *length, + const char *mime_type, + SDL_bool null_terminate); +extern void Wayland_data_source_destroy(SDL_WaylandDataSource *source); + +/* Wayland Data Offer - (Receiving) */ +extern void* Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, + size_t *length, + const char *mime_type, + SDL_bool null_terminate); +extern SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, + const char *mime_type); +extern int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer, + const char *mime_type); +extern void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer); + +/* Clipboard */ +extern int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device); +extern int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device, + SDL_WaylandDataSource *source); +extern int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device, + uint32_t serial); +#endif /* SDL_waylanddatamanager_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c index 14674fbe2..98cc51887 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h index f1f652566..720427ea7 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_waylanddyn_h -#define _SDL_waylanddyn_h +#ifndef SDL_waylanddyn_h_ +#define SDL_waylanddyn_h_ #include "../../SDL_internal.h" @@ -91,6 +91,10 @@ void SDL_WAYLAND_UnloadSymbols(void); #define wl_output_interface (*WAYLAND_wl_output_interface) #define wl_shell_interface (*WAYLAND_wl_shell_interface) #define wl_shm_interface (*WAYLAND_wl_shm_interface) +#define wl_data_device_interface (*WAYLAND_wl_data_device_interface) +#define wl_data_offer_interface (*WAYLAND_wl_data_offer_interface) +#define wl_data_source_interface (*WAYLAND_wl_data_source_interface) +#define wl_data_device_manager_interface (*WAYLAND_wl_data_device_manager_interface) #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ @@ -98,6 +102,6 @@ void SDL_WAYLAND_UnloadSymbols(void); #include "wayland-client-protocol.h" #include "wayland-egl.h" -#endif /* !defined _SDL_waylanddyn_h */ +#endif /* SDL_waylanddyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c index 2443aef7a..53453a239 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #include "SDL_assert.h" #include "SDL_log.h" +#include "../../core/unix/SDL_poll.h" #include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" #include "../../events/scancodes_xfree86.h" @@ -39,6 +40,7 @@ #include "pointer-constraints-unstable-v1-client-protocol.h" #include "relative-pointer-unstable-v1-client-protocol.h" +#include "xdg-shell-unstable-v6-client-protocol.h" #include #include @@ -51,7 +53,9 @@ struct SDL_WaylandInput { SDL_VideoData *display; struct wl_seat *seat; struct wl_pointer *pointer; + struct wl_touch *touch; struct wl_keyboard *keyboard; + SDL_WaylandDataDevice *data_device; struct zwp_relative_pointer_v1 *relative_pointer; SDL_WindowData *pointer_focus; SDL_WindowData *keyboard_focus; @@ -69,20 +73,117 @@ struct SDL_WaylandInput { } xkb; }; +struct SDL_WaylandTouchPoint { + SDL_TouchID id; + float x; + float y; + struct wl_surface* surface; + + struct SDL_WaylandTouchPoint* prev; + struct SDL_WaylandTouchPoint* next; +}; + +struct SDL_WaylandTouchPointList { + struct SDL_WaylandTouchPoint* head; + struct SDL_WaylandTouchPoint* tail; +}; + +static struct SDL_WaylandTouchPointList touch_points = {NULL, NULL}; + +static void +touch_add(SDL_TouchID id, float x, float y, struct wl_surface *surface) +{ + struct SDL_WaylandTouchPoint* tp = SDL_malloc(sizeof(struct SDL_WaylandTouchPoint)); + + tp->id = id; + tp->x = x; + tp->y = y; + tp->surface = surface; + + if (touch_points.tail) { + touch_points.tail->next = tp; + tp->prev = touch_points.tail; + } else { + touch_points.head = tp; + tp->prev = NULL; + } + + touch_points.tail = tp; + tp->next = NULL; +} + +static void +touch_update(SDL_TouchID id, float x, float y) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + tp->x = x; + tp->y = y; + } + + tp = tp->next; + } +} + +static void +touch_del(SDL_TouchID id, float* x, float* y) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + *x = tp->x; + *y = tp->y; + + if (tp->prev) { + tp->prev->next = tp->next; + } else { + touch_points.head = tp->next; + } + + if (tp->next) { + tp->next->prev = tp->prev; + } else { + touch_points.tail = tp->prev; + } + + SDL_free(tp); + } + + tp = tp->next; + } +} + +static struct wl_surface* +touch_surface(SDL_TouchID id) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + return tp->surface; + } + + tp = tp->next; + } + + return NULL; +} + void Wayland_PumpEvents(_THIS) { SDL_VideoData *d = _this->driverdata; - struct pollfd pfd[1]; - pfd[0].fd = WAYLAND_wl_display_get_fd(d->display); - pfd[0].events = POLLIN; - poll(pfd, 1, 0); - - if (pfd[0].revents & POLLIN) + if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_FALSE, 0)) { WAYLAND_wl_display_dispatch(d->display); + } else + { WAYLAND_wl_display_dispatch_pending(d->display); + } } static void @@ -97,7 +198,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, /* enter event for a window we've just destroyed */ return; } - + /* This handler will be called twice in Wayland 1.4 * Once for the window surface which has valid user data * and again for the mouse cursor surface which does not have valid user data @@ -105,7 +206,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, */ window = (SDL_WindowData *)wl_surface_get_user_data(surface); - + if (window) { input->pointer_focus = window; SDL_SetMouseFocus(window->sdlwindow); @@ -148,15 +249,25 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) if (window->hit_test) { const SDL_Point point = { wl_fixed_to_int(input->sx_w), wl_fixed_to_int(input->sy_w) }; const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); - static const uint32_t directions[] = { + + static const uint32_t directions_wl[] = { WL_SHELL_SURFACE_RESIZE_TOP_LEFT, WL_SHELL_SURFACE_RESIZE_TOP, WL_SHELL_SURFACE_RESIZE_TOP_RIGHT, WL_SHELL_SURFACE_RESIZE_RIGHT, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, WL_SHELL_SURFACE_RESIZE_BOTTOM, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT, WL_SHELL_SURFACE_RESIZE_LEFT }; + + /* the names are different (ZXDG_TOPLEVEL_V6_RESIZE_EDGE_* vs + WL_SHELL_SURFACE_RESIZE_*), but the values are the same. */ + const uint32_t *directions_zxdg = directions_wl; + switch (rc) { case SDL_HITTEST_DRAGGABLE: - wl_shell_surface_move(window_data->shell_surface, input->seat, serial); + if (input->display->shell.zxdg) { + zxdg_toplevel_v6_move(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial); + } else { + wl_shell_surface_move(window_data->shell_surface.wl, input->seat, serial); + } return SDL_TRUE; case SDL_HITTEST_RESIZE_TOPLEFT: @@ -167,7 +278,11 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) case SDL_HITTEST_RESIZE_BOTTOM: case SDL_HITTEST_RESIZE_BOTTOMLEFT: case SDL_HITTEST_RESIZE_LEFT: - wl_shell_surface_resize(window_data->shell_surface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + if (input->display->shell.zxdg) { + zxdg_toplevel_v6_resize(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial, directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + } else { + wl_shell_surface_resize(window_data->shell_surface.wl, input->seat, serial, directions_wl[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + } return SDL_TRUE; default: return SDL_FALSE; @@ -184,7 +299,7 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, SDL_WindowData *window = input->pointer_focus; enum wl_pointer_button_state state = state_w; uint32_t sdl_button; - + if (input->pointer_focus) { switch (button) { case BTN_LEFT: @@ -208,6 +323,8 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, default: return; } + + Wayland_data_device_set_serial(input->data_device, serial); SDL_SendMouseButton(window->sdlwindow, 0, state ? SDL_PRESSED : SDL_RELEASED, sdl_button); @@ -229,16 +346,16 @@ pointer_handle_axis_common(struct SDL_WaylandInput *input, { SDL_WindowData *window = input->pointer_focus; enum wl_pointer_axis a = axis; - int x, y; + float x, y; if (input->pointer_focus) { switch (a) { case WL_POINTER_AXIS_VERTICAL_SCROLL: x = 0; - y = wl_fixed_to_int(value); + y = 0 - (float)wl_fixed_to_double(value); break; case WL_POINTER_AXIS_HORIZONTAL_SCROLL: - x = wl_fixed_to_int(value); + x = 0 - (float)wl_fixed_to_double(value); y = 0; break; default: @@ -264,6 +381,75 @@ static const struct wl_pointer_listener pointer_listener = { pointer_handle_motion, pointer_handle_button, pointer_handle_axis, + NULL, /* frame */ + NULL, /* axis_source */ + NULL, /* axis_stop */ + NULL, /* axis_discrete */ +}; + +static void +touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial, + unsigned int timestamp, struct wl_surface *surface, + int id, wl_fixed_t fx, wl_fixed_t fy) +{ + float x, y; + SDL_WindowData* window; + + window = (SDL_WindowData *)wl_surface_get_user_data(surface); + + x = wl_fixed_to_double(fx) / window->sdlwindow->w; + y = wl_fixed_to_double(fy) / window->sdlwindow->h; + + touch_add(id, x, y, surface); + SDL_SendTouch(1, (SDL_FingerID)id, SDL_TRUE, x, y, 1.0f); +} + +static void +touch_handler_up(void *data, struct wl_touch *touch, unsigned int serial, + unsigned int timestamp, int id) +{ + float x = 0, y = 0; + + touch_del(id, &x, &y); + SDL_SendTouch(1, (SDL_FingerID)id, SDL_FALSE, x, y, 0.0f); +} + +static void +touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp, + int id, wl_fixed_t fx, wl_fixed_t fy) +{ + float x, y; + SDL_WindowData* window; + + window = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id)); + + x = wl_fixed_to_double(fx) / window->sdlwindow->w; + y = wl_fixed_to_double(fy) / window->sdlwindow->h; + + touch_update(id, x, y); + SDL_SendTouchMotion(1, (SDL_FingerID)id, x, y, 1.0f); +} + +static void +touch_handler_frame(void *data, struct wl_touch *touch) +{ + +} + +static void +touch_handler_cancel(void *data, struct wl_touch *touch) +{ + +} + +static const struct wl_touch_listener touch_listener = { + touch_handler_down, + touch_handler_up, + touch_handler_motion, + touch_handler_frame, + touch_handler_cancel, + NULL, /* shape */ + NULL, /* orientation */ }; static void @@ -322,7 +508,7 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, /* enter event for a window we've just destroyed */ return; } - + window = wl_surface_get_user_data(surface); if (window) { @@ -373,6 +559,9 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, if (size > 0) { text[size] = 0; + + Wayland_data_device_set_serial(input->data_device, serial); + SDL_SendKeyboardText(text); } } @@ -396,6 +585,7 @@ static const struct wl_keyboard_listener keyboard_listener = { keyboard_handle_leave, keyboard_handle_key, keyboard_handle_modifiers, + NULL, /* repeat_info */ }; static void @@ -413,6 +603,19 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { wl_pointer_destroy(input->pointer); input->pointer = NULL; + input->display->pointer = NULL; + } + + if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { + SDL_AddTouch(1, "wayland_touch"); + input->touch = wl_seat_get_touch(seat); + wl_touch_set_user_data(input->touch, input); + wl_touch_add_listener(input->touch, &touch_listener, + input); + } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { + SDL_DelTouch(1); + wl_touch_destroy(input->touch); + input->touch = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) { @@ -428,12 +631,248 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, static const struct wl_seat_listener seat_listener = { seat_handle_capabilities, + NULL, /* name */ +}; + +static void +data_source_handle_target(void *data, struct wl_data_source *wl_data_source, + const char *mime_type) +{ +} + +static void +data_source_handle_send(void *data, struct wl_data_source *wl_data_source, + const char *mime_type, int32_t fd) +{ + Wayland_data_source_send((SDL_WaylandDataSource *)data, mime_type, fd); +} + +static void +data_source_handle_cancelled(void *data, struct wl_data_source *wl_data_source) +{ + Wayland_data_source_destroy(data); +} + +static void +data_source_handle_dnd_drop_performed(void *data, struct wl_data_source *wl_data_source) +{ +} + +static void +data_source_handle_dnd_finished(void *data, struct wl_data_source *wl_data_source) +{ +} + +static void +data_source_handle_action(void *data, struct wl_data_source *wl_data_source, + uint32_t dnd_action) +{ +} + +static const struct wl_data_source_listener data_source_listener = { + data_source_handle_target, + data_source_handle_send, + data_source_handle_cancelled, + data_source_handle_dnd_drop_performed, // Version 3 + data_source_handle_dnd_finished, // Version 3 + data_source_handle_action, // Version 3 +}; + +SDL_WaylandDataSource* +Wayland_data_source_create(_THIS) +{ + SDL_WaylandDataSource *data_source = NULL; + SDL_VideoData *driver_data = NULL; + struct wl_data_source *id = NULL; + + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + driver_data = _this->driverdata; + + if (driver_data->data_device_manager != NULL) { + id = wl_data_device_manager_create_data_source( + driver_data->data_device_manager); + } + + if (id == NULL) { + SDL_SetError("Wayland unable to create data source"); + } else { + data_source = SDL_calloc(1, sizeof *data_source); + if (data_source == NULL) { + SDL_OutOfMemory(); + wl_data_source_destroy(id); + } else { + WAYLAND_wl_list_init(&(data_source->mimes)); + data_source->source = id; + wl_data_source_set_user_data(id, data_source); + wl_data_source_add_listener(id, &data_source_listener, + data_source); + } + } + } + return data_source; +} + +static void +data_offer_handle_offer(void *data, struct wl_data_offer *wl_data_offer, + const char *mime_type) +{ + SDL_WaylandDataOffer *offer = data; + Wayland_data_offer_add_mime(offer, mime_type); +} + +static void +data_offer_handle_source_actions(void *data, struct wl_data_offer *wl_data_offer, + uint32_t source_actions) +{ +} + +static void +data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_offer, + uint32_t dnd_action) +{ +} + +static const struct wl_data_offer_listener data_offer_listener = { + data_offer_handle_offer, + data_offer_handle_source_actions, // Version 3 + data_offer_handle_actions, // Version 3 +}; + +static void +data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device, + struct wl_data_offer *id) +{ + SDL_WaylandDataOffer *data_offer = NULL; + + data_offer = SDL_calloc(1, sizeof *data_offer); + if (data_offer == NULL) { + SDL_OutOfMemory(); + } else { + data_offer->offer = id; + data_offer->data_device = data; + WAYLAND_wl_list_init(&(data_offer->mimes)); + wl_data_offer_set_user_data(id, data_offer); + wl_data_offer_add_listener(id, &data_offer_listener, data_offer); + } +} + +static void +data_device_handle_enter(void *data, struct wl_data_device *wl_data_device, + uint32_t serial, struct wl_surface *surface, + wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_bool has_mime = SDL_FALSE; + uint32_t dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE; + + data_device->drag_serial = serial; + + if (id != NULL) { + data_device->drag_offer = wl_data_offer_get_user_data(id); + + /* TODO: SDL Support more mime types */ + has_mime = Wayland_data_offer_has_mime( + data_device->drag_offer, FILE_MIME); + + /* If drag_mime is NULL this will decline the offer */ + wl_data_offer_accept(id, serial, + (has_mime == SDL_TRUE) ? FILE_MIME : NULL); + + /* SDL only supports "copy" style drag and drop */ + if (has_mime == SDL_TRUE) { + dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; + } + wl_data_offer_set_actions(data_device->drag_offer->offer, + dnd_action, dnd_action); + } +} + +static void +data_device_handle_leave(void *data, struct wl_data_device *wl_data_device) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_WaylandDataOffer *offer = NULL; + + if (data_device->selection_offer != NULL) { + data_device->selection_offer = NULL; + Wayland_data_offer_destroy(offer); + } +} + +static void +data_device_handle_motion(void *data, struct wl_data_device *wl_data_device, + uint32_t time, wl_fixed_t x, wl_fixed_t y) +{ +} + +static void +data_device_handle_drop(void *data, struct wl_data_device *wl_data_device) +{ + SDL_WaylandDataDevice *data_device = data; + void *buffer = NULL; + size_t length = 0; + + const char *current_uri = NULL; + const char *last_char = NULL; + char *current_char = NULL; + + if (data_device->drag_offer != NULL) { + /* TODO: SDL Support more mime types */ + buffer = Wayland_data_offer_receive(data_device->drag_offer, + &length, FILE_MIME, SDL_FALSE); + + /* uri-list */ + current_uri = (const char *)buffer; + last_char = (const char *)buffer + length; + for (current_char = buffer; current_char < last_char; ++current_char) { + if (*current_char == '\n' || *current_char == 0) { + if (*current_uri != 0 && *current_uri != '#') { + *current_char = 0; + SDL_SendDropFile(NULL, current_uri); + } + current_uri = (const char *)current_char + 1; + } + } + + SDL_free(buffer); + } +} + +static void +data_device_handle_selection(void *data, struct wl_data_device *wl_data_device, + struct wl_data_offer *id) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_WaylandDataOffer *offer = NULL; + + if (id != NULL) { + offer = wl_data_offer_get_user_data(id); + } + + if (data_device->selection_offer != offer) { + Wayland_data_offer_destroy(data_device->selection_offer); + data_device->selection_offer = offer; + } + + SDL_SendClipboardUpdate(); +} + +static const struct wl_data_device_listener data_device_listener = { + data_device_handle_data_offer, + data_device_handle_enter, + data_device_handle_leave, + data_device_handle_motion, + data_device_handle_drop, + data_device_handle_selection }; void Wayland_display_add_input(SDL_VideoData *d, uint32_t id) { struct SDL_WaylandInput *input; + SDL_WaylandDataDevice *data_device = NULL; input = SDL_calloc(1, sizeof *input); if (input == NULL) @@ -444,6 +883,27 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id) input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); d->input = input; + + if (d->data_device_manager != NULL) { + data_device = SDL_calloc(1, sizeof *data_device); + if (data_device == NULL) { + return; + } + + data_device->data_device = wl_data_device_manager_get_data_device( + d->data_device_manager, input->seat + ); + data_device->video_data = d; + + if (data_device->data_device == NULL) { + SDL_free(data_device); + } else { + wl_data_device_set_user_data(data_device->data_device, data_device); + wl_data_device_add_listener(data_device->data_device, + &data_device_listener, data_device); + input->data_device = data_device; + } + } wl_seat_add_listener(input->seat, &seat_listener, input); wl_seat_set_user_data(input->seat, input); @@ -458,12 +918,31 @@ void Wayland_display_destroy_input(SDL_VideoData *d) if (!input) return; + if (input->data_device != NULL) { + Wayland_data_device_clear_selection(input->data_device); + if (input->data_device->selection_offer != NULL) { + Wayland_data_offer_destroy(input->data_device->selection_offer); + } + if (input->data_device->drag_offer != NULL) { + Wayland_data_offer_destroy(input->data_device->drag_offer); + } + if (input->data_device->data_device != NULL) { + wl_data_device_release(input->data_device->data_device); + } + SDL_free(input->data_device); + } + if (input->keyboard) wl_keyboard_destroy(input->keyboard); if (input->pointer) wl_pointer_destroy(input->pointer); + if (input->touch) { + SDL_DelTouch(1); + wl_touch_destroy(input->touch); + } + if (input->seat) wl_seat_destroy(input->seat); @@ -477,6 +956,16 @@ void Wayland_display_destroy_input(SDL_VideoData *d) d->input = NULL; } +SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input) +{ + if (input == NULL) { + return NULL; + } + + return input->data_device; +} + +/* !!! FIXME: just merge these into display_handle_global(). */ void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id) { d->relative_pointer_manager = diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h index 56d12ec27..1c5ffe517 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,17 +21,22 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandevents_h -#define _SDL_waylandevents_h +#ifndef SDL_waylandevents_h_ +#define SDL_waylandevents_h_ #include "SDL_waylandvideo.h" #include "SDL_waylandwindow.h" +#include "SDL_waylanddatamanager.h" + +struct SDL_WaylandInput; extern void Wayland_PumpEvents(_THIS); extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id); extern void Wayland_display_destroy_input(SDL_VideoData *d); +extern SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input); + extern void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id); extern void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d); @@ -41,6 +46,6 @@ extern int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input); extern void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id); extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d); -#endif /* _SDL_waylandevents_h */ +#endif /* SDL_waylandevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c index 8dfc9eea3..c77b53eb7 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,10 +23,6 @@ #if SDL_VIDEO_DRIVER_WAYLAND -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - #include #include #include @@ -396,23 +392,5 @@ Wayland_FiniMouse(void) /* This effectively assumes that nobody else * touches SDL_Mouse which is effectively * a singleton */ - - SDL_Mouse *mouse = SDL_GetMouse(); - - /* Free the current cursor if not the same pointer as - * the default cursor */ - if (mouse->def_cursor != mouse->cur_cursor) - Wayland_FreeCursor (mouse->cur_cursor); - - Wayland_FreeCursor (mouse->def_cursor); - mouse->def_cursor = NULL; - mouse->cur_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->CreateSystemCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_WAYLAND */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h index 129990ded..2c50e5ff1 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c index 6803dbe63..9c0b84595 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ Wayland_GLES_LoadLibrary(_THIS, const char *path) { int ret; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display); + ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0); Wayland_PumpEvents(_this); WAYLAND_wl_display_flush(data->display); @@ -54,14 +54,16 @@ Wayland_GLES_CreateContext(_THIS, SDL_Window * window) return context; } -void +int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) { - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + if (SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface) < 0) { + return -1; + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); + return 0; } - int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h index 6c3f1f384..58d7f9b08 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_waylandopengles_h -#define _SDL_waylandopengles_h +#ifndef SDL_waylandopengles_h_ +#define SDL_waylandopengles_h_ #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" typedef struct SDL_PrivateGLESData { + int dummy; } SDL_PrivateGLESData; /* OpenGLES functions */ @@ -39,8 +40,10 @@ typedef struct SDL_PrivateGLESData extern int Wayland_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext Wayland_GLES_CreateContext(_THIS, SDL_Window * window); -extern void Wayland_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context); -#endif /* _SDL_waylandopengles_h */ +#endif /* SDL_waylandopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h index aea3cb129..77783df81 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -83,6 +83,10 @@ SDL_WAYLAND_INTERFACE(wl_compositor_interface) SDL_WAYLAND_INTERFACE(wl_output_interface) SDL_WAYLAND_INTERFACE(wl_shell_interface) SDL_WAYLAND_INTERFACE(wl_shm_interface) +SDL_WAYLAND_INTERFACE(wl_data_device_interface) +SDL_WAYLAND_INTERFACE(wl_data_source_interface) +SDL_WAYLAND_INTERFACE(wl_data_offer_interface) +SDL_WAYLAND_INTERFACE(wl_data_device_manager_interface) SDL_WAYLAND_MODULE(WAYLAND_EGL) SDL_WAYLAND_SYM(struct wl_egl_window *, wl_egl_window_create, (struct wl_surface *, int, int)) diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c index 4cae42594..005b47f58 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h index 5f2a05813..9efc5a54a 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH -#ifndef _SDL_waylandtouch_h -#define _SDL_waylandtouch_h +#ifndef SDL_waylandtouch_h_ +#define SDL_waylandtouch_h_ #include "SDL_waylandvideo.h" #include @@ -347,6 +347,6 @@ qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t re QT_WINDOWMANAGER_OPEN_URL, remaining, url); } -#endif /* _SDL_waylandtouch_h */ +#endif /* SDL_waylandtouch_h_ */ #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c index 554b0ecad..8401a0884 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,6 +34,8 @@ #include "SDL_waylandopengles.h" #include "SDL_waylandmouse.h" #include "SDL_waylandtouch.h" +#include "SDL_waylandclipboard.h" +#include "SDL_waylandvulkan.h" #include #include @@ -43,6 +45,8 @@ #include "SDL_waylanddyn.h" #include +#include "xdg-shell-unstable-v6-client-protocol.h" + #define WAYLANDVID_DRIVER_NAME "wayland" /* Initialization/Query functions */ @@ -62,6 +66,12 @@ Wayland_VideoQuit(_THIS); static char * get_classname() { +/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec: + "The surface class identifies the general class of applications + to which the surface belongs. A common convention is to use the + file name (or the full path if it is a non-standard location) of + the application's .desktop file as the class." */ + char *spot; #if defined(__LINUX__) || defined(__FREEBSD__) char procfile[1024]; @@ -166,7 +176,7 @@ Wayland_CreateDevice(int devindex) device->GL_GetProcAddress = Wayland_GLES_GetProcAddress; device->GL_DeleteContext = Wayland_GLES_DeleteContext; - device->CreateWindow = Wayland_CreateWindow; + device->CreateSDLWindow = Wayland_CreateWindow; device->ShowWindow = Wayland_ShowWindow; device->SetWindowFullscreen = Wayland_SetWindowFullscreen; device->MaximizeWindow = Wayland_MaximizeWindow; @@ -176,6 +186,17 @@ Wayland_CreateDevice(int devindex) device->DestroyWindow = Wayland_DestroyWindow; device->SetWindowHitTest = Wayland_SetWindowHitTest; + device->SetClipboardText = Wayland_SetClipboardText; + device->GetClipboardText = Wayland_GetClipboardText; + device->HasClipboardText = Wayland_HasClipboardText; + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface; +#endif + device->free = Wayland_DeleteDevice; return device; @@ -216,9 +237,11 @@ display_handle_mode(void *data, SDL_DisplayMode mode; SDL_zero(mode); + mode.format = SDL_PIXELFORMAT_RGB888; mode.w = width; mode.h = height; mode.refresh_rate = refresh / 1000; // mHz to Hz + mode.driverdata = display->driverdata; SDL_AddDisplayMode(display, &mode); if (flags & WL_OUTPUT_MODE_CURRENT) { @@ -266,6 +289,7 @@ Wayland_add_display(SDL_VideoData *d, uint32_t id) output = wl_registry_bind(d->registry, id, &wl_output_interface, 2); if (!output) { SDL_SetError("Failed to retrieve output."); + SDL_free(display); return; } @@ -291,6 +315,18 @@ static const struct qt_windowmanager_listener windowmanager_listener = { }; #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + +static void +handle_ping_zxdg_shell(void *data, struct zxdg_shell_v6 *zxdg, uint32_t serial) +{ + zxdg_shell_v6_pong(zxdg, serial); +} + +static const struct zxdg_shell_v6_listener shell_listener_zxdg = { + handle_ping_zxdg_shell +}; + + static void display_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) @@ -303,8 +339,11 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, Wayland_add_display(d, id); } else if (strcmp(interface, "wl_seat") == 0) { Wayland_display_add_input(d, id); + } else if (strcmp(interface, "zxdg_shell_v6") == 0) { + d->shell.zxdg = wl_registry_bind(d->registry, id, &zxdg_shell_v6_interface, 1); + zxdg_shell_v6_add_listener(d->shell.zxdg, &shell_listener_zxdg, NULL); } else if (strcmp(interface, "wl_shell") == 0) { - d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1); + d->shell.wl = wl_registry_bind(d->registry, id, &wl_shell_interface, 1); } else if (strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm); @@ -312,6 +351,9 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, Wayland_display_add_relative_pointer_manager(d, id); } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { Wayland_display_add_pointer_constraints(d, id); + } else if (strcmp(interface, "wl_data_device_manager") == 0) { + d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, 3); + #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH } else if (strcmp(interface, "qt_touch_extension") == 0) { Wayland_touch_create(d, id); @@ -327,7 +369,8 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, } static const struct wl_registry_listener registry_listener = { - display_handle_global + display_handle_global, + NULL, /* global_remove */ }; int @@ -390,7 +433,7 @@ void Wayland_VideoQuit(_THIS) { SDL_VideoData *data = _this->driverdata; - int i; + int i, j; Wayland_FiniMouse (); @@ -398,6 +441,11 @@ Wayland_VideoQuit(_THIS) SDL_VideoDisplay *display = &_this->displays[i]; wl_output_destroy(display->driverdata); display->driverdata = NULL; + + for (j = display->num_display_modes; j--;) { + display->display_modes[j].driverdata = NULL; + } + display->desktop_mode.driverdata = NULL; } Wayland_display_destroy_input(data); @@ -424,8 +472,11 @@ Wayland_VideoQuit(_THIS) if (data->cursor_theme) WAYLAND_wl_cursor_theme_destroy(data->cursor_theme); - if (data->shell) - wl_shell_destroy(data->shell); + if (data->shell.wl) + wl_shell_destroy(data->shell.wl); + + if (data->shell.zxdg) + zxdg_shell_v6_destroy(data->shell.zxdg); if (data->compositor) wl_compositor_destroy(data->compositor); @@ -439,7 +490,7 @@ Wayland_VideoQuit(_THIS) } SDL_free(data->classname); - free(data); + SDL_free(data); _this->driverdata = NULL; } diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h index ccd7ecf92..6ad68de48 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandvideo_h -#define _SDL_waylandvideo_h +#ifndef SDL_waylandvideo_h_ +#define SDL_waylandvideo_h_ #include #include "wayland-util.h" @@ -43,9 +43,14 @@ typedef struct { struct wl_shm *shm; struct wl_cursor_theme *cursor_theme; struct wl_pointer *pointer; - struct wl_shell *shell; + struct { + /* !!! FIXME: add stable xdg_shell from 1.12 */ + struct zxdg_shell_v6 *zxdg; + struct wl_shell *wl; + } shell; struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; struct zwp_pointer_constraints_v1 *pointer_constraints; + struct wl_data_device_manager *data_device_manager; EGLDisplay edpy; EGLContext context; @@ -65,6 +70,6 @@ typedef struct { int relative_mouse_mode; } SDL_VideoData; -#endif /* _SDL_waylandvideo_h */ +#endif /* SDL_waylandvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c new file mode 100644 index 000000000..d67472cdc --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND + +#include "SDL_waylandvideo.h" +#include "SDL_waylandwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_waylandvulkan.h" +#include "SDL_syswm.h" + +int Wayland_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 i, extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasWaylandSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasWaylandSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasWaylandSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Wayland_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForWayland[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForWayland), + extensionsForWayland); +} + +SDL_bool Wayland_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR = + (PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateWaylandSurfaceKHR"); + VkWaylandSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateWaylandSurfaceKHR) + { + SDL_SetError(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.display = windowData->waylandData->display; + createInfo.surface = windowData->surface; + result = vkCreateWaylandSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateWaylandSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h new file mode 100644 index 000000000..5ad3a466c --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_waylandvulkan_h_ +#define SDL_waylandvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND + +int Wayland_Vulkan_LoadLibrary(_THIS, const char *path); +void Wayland_Vulkan_UnloadLibrary(_THIS); +SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Wayland_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_waylandvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c index 85fca8de6..684022a79 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,16 +31,24 @@ #include "SDL_waylandvideo.h" #include "SDL_waylandtouch.h" #include "SDL_waylanddyn.h" +#include "SDL_hints.h" + +#include "xdg-shell-unstable-v6-client-protocol.h" + +/* On modern desktops, we probably will use the xdg-shell protocol instead + of wl_shell, but wl_shell might be useful on older Wayland installs that + don't have the newer protocol, or embedded things that don't have a full + window manager. */ static void -handle_ping(void *data, struct wl_shell_surface *shell_surface, +handle_ping_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface, uint32_t serial) { wl_shell_surface_pong(shell_surface, serial); } static void -handle_configure(void *data, struct wl_shell_surface *shell_surface, +handle_configure_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface, uint32_t edges, int32_t width, int32_t height) { SDL_WindowData *wind = (SDL_WindowData *)data; @@ -86,16 +94,94 @@ handle_configure(void *data, struct wl_shell_surface *shell_surface, } static void -handle_popup_done(void *data, struct wl_shell_surface *shell_surface) +handle_popup_done_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface) { } -static const struct wl_shell_surface_listener shell_surface_listener = { - handle_ping, - handle_configure, - handle_popup_done +static const struct wl_shell_surface_listener shell_surface_listener_wl = { + handle_ping_wl_shell_surface, + handle_configure_wl_shell_surface, + handle_popup_done_wl_shell_surface }; + + + +static void +handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, uint32_t serial) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + struct wl_region *region; + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + + region = wl_compositor_create_region(wind->waylandData->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, window->w, window->h); + zxdg_surface_v6_ack_configure(zxdg, serial); +} + +static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = { + handle_configure_zxdg_shell_surface +}; + + +static void +handle_configure_zxdg_toplevel(void *data, + struct zxdg_toplevel_v6 *zxdg_toplevel_v6, + int32_t width, + int32_t height, + struct wl_array *states) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + + /* wl_shell_surface spec states that this is a suggestion. + Ignore if less than or greater than max/min size. */ + + if (width == 0 || height == 0) { + return; + } + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if ((window->flags & SDL_WINDOW_RESIZABLE)) { + if (window->max_w > 0) { + width = SDL_min(width, window->max_w); + } + width = SDL_max(width, window->min_w); + + if (window->max_h > 0) { + height = SDL_min(height, window->max_h); + } + height = SDL_max(height, window->min_h); + } else { + return; + } + } + + if (width == window->w && height == window->h) { + return; + } + + window->w = width; + window->h = height; +} + +static void +handle_close_zxdg_toplevel(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel_v6) +{ + SDL_WindowData *window = (SDL_WindowData *)data; + SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + +static const struct zxdg_toplevel_v6_listener toplevel_listener_zxdg = { + handle_configure_zxdg_toplevel, + handle_close_zxdg_toplevel +}; + + #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH static void handle_onscreen_visibility(void *data, @@ -128,10 +214,29 @@ SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + const Uint32 version = ((((Uint32) info->version.major) * 1000000) + + (((Uint32) info->version.minor) * 10000) + + (((Uint32) info->version.patch))); + + /* Before 2.0.6, it was possible to build an SDL with Wayland support + (SDL_SysWMinfo will be large enough to hold Wayland info), but build + your app against SDL headers that didn't have Wayland support + (SDL_SysWMinfo could be smaller than Wayland needs. This would lead + to an app properly using SDL_GetWindowWMInfo() but we'd accidentally + overflow memory on the stack or heap. To protect against this, we've + padded out the struct unconditionally in the headers and Wayland will + just return an error for older apps using this function. Those apps + will need to be recompiled against newer headers or not use Wayland, + maybe by forcing SDL_VIDEODRIVER=x11. */ + if (version < 2000006) { + info->subsystem = SDL_SYSWM_UNKNOWN; + SDL_SetError("Version must be 2.0.6 or newer"); + return SDL_FALSE; + } info->info.wl.display = data->waylandData->display; info->info.wl.surface = data->surface; - info->info.wl.shell_surface = data->shell_surface; + info->info.wl.shell_surface = data->shell_surface.wl; info->subsystem = SDL_SYSWM_WAYLAND; return SDL_TRUE; @@ -143,42 +248,121 @@ Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) return 0; /* just succeed, the real work is done elsewhere. */ } -void Wayland_ShowWindow(_THIS, SDL_Window *window) +static void +SetFullscreen(_THIS, SDL_Window * window, struct wl_output *output) { + const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; SDL_WindowData *wind = window->driverdata; - if (window->flags & SDL_WINDOW_FULLSCREEN) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, - 0, (struct wl_output *)window->fullscreen_mode.driverdata); - else - wl_shell_surface_set_toplevel(wind->shell_surface); + if (viddata->shell.zxdg) { + if (output) { + zxdg_toplevel_v6_set_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel, output); + } else { + zxdg_toplevel_v6_unset_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel); + } + } else { + if (output) { + wl_shell_surface_set_fullscreen(wind->shell_surface.wl, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, + 0, output); + } else { + wl_shell_surface_set_toplevel(wind->shell_surface.wl); + } + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); } +void Wayland_ShowWindow(_THIS, SDL_Window *window) +{ + struct wl_output *output = (struct wl_output *) window->fullscreen_mode.driverdata; + SetFullscreen(_this, window, (window->flags & SDL_WINDOW_FULLSCREEN) ? output : NULL); +} + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH +static void SDLCALL +QtExtendedSurface_OnHintChanged(void *userdata, const char *name, + const char *oldValue, const char *newValue) +{ + struct qt_extended_surface *qt_extended_surface = userdata; + + if (name == NULL) { + return; + } + + if (strcmp(name, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION) == 0) { + int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; + + if (newValue != NULL) { + if (strcmp(newValue, "portrait") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; + } else if (strcmp(newValue, "landscape") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; + } else if (strcmp(newValue, "inverted-portrait") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; + } else if (strcmp(newValue, "inverted-landscape") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; + } + } + + qt_extended_surface_set_content_orientation(qt_extended_surface, orientation); + } else if (strcmp(name, SDL_HINT_QTWAYLAND_WINDOW_FLAGS) == 0) { + uint32_t flags = 0; + + if (newValue != NULL) { + char *tmp = strdup(newValue); + char *saveptr = NULL; + + char *flag = strtok_r(tmp, " ", &saveptr); + while (flag) { + if (strcmp(flag, "OverridesSystemGestures") == 0) { + flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES; + } else if (strcmp(flag, "StaysOnTop") == 0) { + flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP; + } else if (strcmp(flag, "BypassWindowManager") == 0) { + // See https://github.com/qtproject/qtwayland/commit/fb4267103d + flags |= 4 /* QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER */; + } + + flag = strtok_r(NULL, " ", &saveptr); + } + + free(tmp); + } + + qt_extended_surface_set_window_flags(qt_extended_surface, flags); + } +} + +static void QtExtendedSurface_Subscribe(struct qt_extended_surface *surface, const char *name) +{ + SDL_AddHintCallback(name, QtExtendedSurface_OnHintChanged, surface); +} + +static void QtExtendedSurface_Unsubscribe(struct qt_extended_surface *surface, const char *name) +{ + SDL_DelHintCallback(name, QtExtendedSurface_OnHintChanged, surface); +} +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + void Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { - SDL_WindowData *wind = window->driverdata; - - if (fullscreen) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, - 0, (struct wl_output *)_display->driverdata); - else - wl_shell_surface_set_toplevel(wind->shell_surface); - - WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); + struct wl_output *output = (struct wl_output *) _display->driverdata; + SetFullscreen(_this, window, fullscreen ? output : NULL); } void Wayland_RestoreWindow(_THIS, SDL_Window * window) { SDL_WindowData *wind = window->driverdata; + const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; - wl_shell_surface_set_toplevel(wind->shell_surface); + if (viddata->shell.zxdg) { + } else { + wl_shell_surface_set_toplevel(wind->shell_surface.wl); + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); } @@ -187,10 +371,15 @@ void Wayland_MaximizeWindow(_THIS, SDL_Window * window) { SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - wl_shell_surface_set_maximized(wind->shell_surface, NULL); + if (viddata->shell.zxdg) { + zxdg_toplevel_v6_set_maximized(wind->shell_surface.zxdg.roleobj.toplevel); + } else { + wl_shell_surface_set_maximized(wind->shell_surface.wl, NULL); + } - WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); + WAYLAND_wl_display_flush( viddata->display ); } int Wayland_CreateWindow(_THIS, SDL_Window *window) @@ -224,13 +413,25 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) data->surface = wl_compositor_create_surface(c->compositor); wl_surface_set_user_data(data->surface, data); - data->shell_surface = wl_shell_get_shell_surface(c->shell, - data->surface); - wl_shell_surface_set_class (data->shell_surface, c->classname); -#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH + + if (c->shell.zxdg) { + data->shell_surface.zxdg.surface = zxdg_shell_v6_get_xdg_surface(c->shell.zxdg, data->surface); + /* !!! FIXME: add popup role */ + data->shell_surface.zxdg.roleobj.toplevel = zxdg_surface_v6_get_toplevel(data->shell_surface.zxdg.surface); + zxdg_toplevel_v6_add_listener(data->shell_surface.zxdg.roleobj.toplevel, &toplevel_listener_zxdg, data); + zxdg_toplevel_v6_set_app_id(data->shell_surface.zxdg.roleobj.toplevel, c->classname); + } else { + data->shell_surface.wl = wl_shell_get_shell_surface(c->shell.wl, data->surface); + wl_shell_surface_set_class(data->shell_surface.wl, c->classname); + } + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH if (c->surface_extension) { data->extended_surface = qt_surface_extension_get_extended_surface( c->surface_extension, data->surface); + + QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION); + QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS); } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ @@ -244,10 +445,16 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) return SDL_SetError("failed to create a window surface"); } - if (data->shell_surface) { - wl_shell_surface_set_user_data(data->shell_surface, data); - wl_shell_surface_add_listener(data->shell_surface, - &shell_surface_listener, data); + if (c->shell.zxdg) { + if (data->shell_surface.zxdg.surface) { + zxdg_surface_v6_set_user_data(data->shell_surface.zxdg.surface, data); + zxdg_surface_v6_add_listener(data->shell_surface.zxdg.surface, &shell_surface_listener_zxdg, data); + } + } else { + if (data->shell_surface.wl) { + wl_shell_surface_set_user_data(data->shell_surface.wl, data); + wl_shell_surface_add_listener(data->shell_surface.wl, &shell_surface_listener_wl, data); + } } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @@ -267,6 +474,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) Wayland_input_lock_pointer(c->input); } + wl_surface_commit(data->surface); WAYLAND_wl_display_flush(c->display); return 0; @@ -289,9 +497,14 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) void Wayland_SetWindowTitle(_THIS, SDL_Window * window) { SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; if (window->title != NULL) { - wl_shell_surface_set_title(wind->shell_surface, window->title); + if (viddata->shell.zxdg) { + zxdg_toplevel_v6_set_title(wind->shell_surface.zxdg.roleobj.toplevel, window->title); + } else { + wl_shell_surface_set_title(wind->shell_surface.wl, window->title); + } } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); @@ -306,12 +519,25 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_EGL_DestroySurface(_this, wind->egl_surface); WAYLAND_wl_egl_window_destroy(wind->egl_window); - if (wind->shell_surface) - wl_shell_surface_destroy(wind->shell_surface); + if (data->shell.zxdg) { + if (wind->shell_surface.zxdg.roleobj.toplevel) { + zxdg_toplevel_v6_destroy(wind->shell_surface.zxdg.roleobj.toplevel); + } + if (wind->shell_surface.zxdg.surface) { + zxdg_surface_v6_destroy(wind->shell_surface.zxdg.surface); + } + } else { + if (wind->shell_surface.wl) { + wl_shell_surface_destroy(wind->shell_surface.wl); + } + } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH - if (wind->extended_surface) + if (wind->extended_surface) { + QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION); + QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS); qt_extended_surface_destroy(wind->extended_surface); + } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ wl_surface_destroy(wind->surface); diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h index 319a573dc..80d4f3138 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandwindow_h -#define _SDL_waylandwindow_h +#ifndef SDL_waylandwindow_h_ +#define SDL_waylandwindow_h_ #include "../SDL_sysvideo.h" #include "SDL_syswm.h" @@ -31,11 +31,23 @@ struct SDL_WaylandInput; +typedef struct { + struct zxdg_surface_v6 *surface; + union { + struct zxdg_toplevel_v6 *toplevel; + struct zxdg_popup_v6 *popup; + } roleobj; +} SDL_zxdg_shell_surface; + typedef struct { SDL_Window *sdlwindow; SDL_VideoData *waylandData; struct wl_surface *surface; - struct wl_shell_surface *shell_surface; + union { + /* !!! FIXME: add stable xdg_shell from 1.12 */ + SDL_zxdg_shell_surface zxdg; + struct wl_shell_surface *wl; + } shell_surface; struct wl_egl_window *egl_window; struct SDL_WaylandInput *keyboard_device; EGLSurface egl_surface; @@ -61,6 +73,6 @@ extern SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info); extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_waylandwindow_h */ +#endif /* SDL_waylandwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_msctf.h b/Engine/lib/sdl/src/video/windows/SDL_msctf.h index 74e22f107..53cec3d13 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_msctf.h +++ b/Engine/lib/sdl/src/video/windows/SDL_msctf.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_msctf_h -#define _SDL_msctf_h +#ifndef SDL_msctf_h_ +#define SDL_msctf_h_ #include @@ -239,4 +239,4 @@ struct ITfSource const struct ITfSourceVtbl *lpVtbl; }; -#endif /* _SDL_msctf_h */ +#endif /* SDL_msctf_h_ */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_vkeys.h b/Engine/lib/sdl/src/video/windows/SDL_vkeys.h index fd6520419..a38e3a281 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_vkeys.h +++ b/Engine/lib/sdl/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c index b57a66a7b..4e61d7ab0 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h index d86cd97ec..937b7d0a5 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsclipboard_h -#define _SDL_windowsclipboard_h +#ifndef SDL_windowsclipboard_h_ +#define SDL_windowsclipboard_h_ /* Forward declaration */ struct SDL_VideoData; @@ -31,6 +31,6 @@ extern char *WIN_GetClipboardText(_THIS); extern SDL_bool WIN_HasClipboardText(_THIS); extern void WIN_CheckClipboardUpdate(struct SDL_VideoData * data); -#endif /* _SDL_windowsclipboard_h */ +#endif /* SDL_windowsclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c index 02768fb68..a5fd00689 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ #include "SDL_syswm.h" #include "SDL_timer.h" #include "SDL_vkeys.h" +#include "SDL_hints.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/scancodes_windows.h" @@ -81,120 +82,136 @@ #define WM_UNICHAR 0x0109 #endif +static SDL_Scancode +VKeytoScancode(WPARAM vkey) +{ + switch (vkey) { + case VK_CLEAR: return SDL_SCANCODE_CLEAR; + case VK_MODECHANGE: return SDL_SCANCODE_MODE; + case VK_SELECT: return SDL_SCANCODE_SELECT; + case VK_EXECUTE: return SDL_SCANCODE_EXECUTE; + case VK_HELP: return SDL_SCANCODE_HELP; + case VK_PAUSE: return SDL_SCANCODE_PAUSE; + case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR; + + case VK_F13: return SDL_SCANCODE_F13; + case VK_F14: return SDL_SCANCODE_F14; + case VK_F15: return SDL_SCANCODE_F15; + case VK_F16: return SDL_SCANCODE_F16; + case VK_F17: return SDL_SCANCODE_F17; + case VK_F18: return SDL_SCANCODE_F18; + case VK_F19: return SDL_SCANCODE_F19; + case VK_F20: return SDL_SCANCODE_F20; + case VK_F21: return SDL_SCANCODE_F21; + case VK_F22: return SDL_SCANCODE_F22; + case VK_F23: return SDL_SCANCODE_F23; + case VK_F24: return SDL_SCANCODE_F24; + + case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS; + case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK; + case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD; + case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH; + case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP; + case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH; + case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS; + case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME; + case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE; + case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN; + case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP; + + case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT; + case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV; + case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP; + case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY; + case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL; + case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT; + + case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH; + + case VK_ATTN: return SDL_SCANCODE_SYSREQ; + case VK_CRSEL: return SDL_SCANCODE_CRSEL; + case VK_EXSEL: return SDL_SCANCODE_EXSEL; + case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR; + + case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1; + case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2; + + default: return SDL_SCANCODE_UNKNOWN; + } +} + static SDL_Scancode WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam) { SDL_Scancode code; - char bIsExtended; int nScanCode = (lParam >> 16) & 0xFF; + SDL_bool bIsExtended = (lParam & (1 << 24)) != 0; - /* 0x45 here to work around both pause and numlock sharing the same scancode, so use the VK key to tell them apart */ - if (nScanCode == 0 || nScanCode == 0x45) { - switch(wParam) { - case VK_CLEAR: return SDL_SCANCODE_CLEAR; - case VK_MODECHANGE: return SDL_SCANCODE_MODE; - case VK_SELECT: return SDL_SCANCODE_SELECT; - case VK_EXECUTE: return SDL_SCANCODE_EXECUTE; - case VK_HELP: return SDL_SCANCODE_HELP; - case VK_PAUSE: return SDL_SCANCODE_PAUSE; - case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR; + code = VKeytoScancode(wParam); - case VK_F13: return SDL_SCANCODE_F13; - case VK_F14: return SDL_SCANCODE_F14; - case VK_F15: return SDL_SCANCODE_F15; - case VK_F16: return SDL_SCANCODE_F16; - case VK_F17: return SDL_SCANCODE_F17; - case VK_F18: return SDL_SCANCODE_F18; - case VK_F19: return SDL_SCANCODE_F19; - case VK_F20: return SDL_SCANCODE_F20; - case VK_F21: return SDL_SCANCODE_F21; - case VK_F22: return SDL_SCANCODE_F22; - case VK_F23: return SDL_SCANCODE_F23; - case VK_F24: return SDL_SCANCODE_F24; + if (code == SDL_SCANCODE_UNKNOWN && nScanCode <= 127) { + code = windows_scancode_table[nScanCode]; - case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS; - case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK; - case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD; - case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH; - case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP; - case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH; - case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS; - case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME; - case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE; - case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN; - case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP; - - case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT; - case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV; - case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP; - case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY; - case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL; - case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT; - - case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH; - - case VK_ATTN: return SDL_SCANCODE_SYSREQ; - case VK_CRSEL: return SDL_SCANCODE_CRSEL; - case VK_EXSEL: return SDL_SCANCODE_EXSEL; - case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR; - - case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1; - case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2; - - default: return SDL_SCANCODE_UNKNOWN; + if (bIsExtended) { + switch (code) { + case SDL_SCANCODE_RETURN: + code = SDL_SCANCODE_KP_ENTER; + break; + case SDL_SCANCODE_LALT: + code = SDL_SCANCODE_RALT; + break; + case SDL_SCANCODE_LCTRL: + code = SDL_SCANCODE_RCTRL; + break; + case SDL_SCANCODE_SLASH: + code = SDL_SCANCODE_KP_DIVIDE; + break; + case SDL_SCANCODE_CAPSLOCK: + code = SDL_SCANCODE_KP_PLUS; + break; + default: + break; + } + } else { + switch (code) { + case SDL_SCANCODE_HOME: + code = SDL_SCANCODE_KP_7; + break; + case SDL_SCANCODE_UP: + code = SDL_SCANCODE_KP_8; + break; + case SDL_SCANCODE_PAGEUP: + code = SDL_SCANCODE_KP_9; + break; + case SDL_SCANCODE_LEFT: + code = SDL_SCANCODE_KP_4; + break; + case SDL_SCANCODE_RIGHT: + code = SDL_SCANCODE_KP_6; + break; + case SDL_SCANCODE_END: + code = SDL_SCANCODE_KP_1; + break; + case SDL_SCANCODE_DOWN: + code = SDL_SCANCODE_KP_2; + break; + case SDL_SCANCODE_PAGEDOWN: + code = SDL_SCANCODE_KP_3; + break; + case SDL_SCANCODE_INSERT: + code = SDL_SCANCODE_KP_0; + break; + case SDL_SCANCODE_DELETE: + code = SDL_SCANCODE_KP_PERIOD; + break; + case SDL_SCANCODE_PRINTSCREEN: + code = SDL_SCANCODE_KP_MULTIPLY; + break; + default: + break; + } } } - - if (nScanCode > 127) - return SDL_SCANCODE_UNKNOWN; - - code = windows_scancode_table[nScanCode]; - - bIsExtended = (lParam & (1 << 24)) != 0; - if (!bIsExtended) { - switch (code) { - case SDL_SCANCODE_HOME: - return SDL_SCANCODE_KP_7; - case SDL_SCANCODE_UP: - return SDL_SCANCODE_KP_8; - case SDL_SCANCODE_PAGEUP: - return SDL_SCANCODE_KP_9; - case SDL_SCANCODE_LEFT: - return SDL_SCANCODE_KP_4; - case SDL_SCANCODE_RIGHT: - return SDL_SCANCODE_KP_6; - case SDL_SCANCODE_END: - return SDL_SCANCODE_KP_1; - case SDL_SCANCODE_DOWN: - return SDL_SCANCODE_KP_2; - case SDL_SCANCODE_PAGEDOWN: - return SDL_SCANCODE_KP_3; - case SDL_SCANCODE_INSERT: - return SDL_SCANCODE_KP_0; - case SDL_SCANCODE_DELETE: - return SDL_SCANCODE_KP_PERIOD; - case SDL_SCANCODE_PRINTSCREEN: - return SDL_SCANCODE_KP_MULTIPLY; - default: - break; - } - } else { - switch (code) { - case SDL_SCANCODE_RETURN: - return SDL_SCANCODE_KP_ENTER; - case SDL_SCANCODE_LALT: - return SDL_SCANCODE_RALT; - case SDL_SCANCODE_LCTRL: - return SDL_SCANCODE_RCTRL; - case SDL_SCANCODE_SLASH: - return SDL_SCANCODE_KP_DIVIDE; - case SDL_SCANCODE_CAPSLOCK: - return SDL_SCANCODE_KP_PLUS; - default: - break; - } - } - return code; } @@ -204,7 +221,7 @@ WIN_ShouldIgnoreFocusClick() return !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE); } -void +static void WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button, SDL_MouseID mouseID) { if (data->focus_click_pending & SDL_BUTTON(button)) { @@ -231,7 +248,7 @@ WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePress * Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also * so this funciton reconciles our view of the world with the current buttons reported by windows */ -void +static void WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mouseID) { if (wParam != data->mouse_button_flags) { @@ -246,7 +263,7 @@ WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mou } -void +static void WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data) { if (rawButtons != data->mouse_button_flags) { @@ -275,7 +292,7 @@ WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data) } } -void +static void WIN_CheckAsyncMouseRelease(SDL_WindowData *data) { Uint32 mouseFlags; @@ -309,7 +326,7 @@ WIN_CheckAsyncMouseRelease(SDL_WindowData *data) data->mouse_button_flags = 0; } -BOOL +static BOOL WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text) { if (codepoint <= 0x7F) { @@ -342,6 +359,11 @@ ShouldGenerateWindowCloseOnAltF4(void) return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE); } +/* Win10 "Fall Creators Update" introduced the bug that SetCursorPos() (as used by SDL_WarpMouseInWindow()) + doesn't reliably generate WM_MOUSEMOVE events anymore (see #3931) which breaks relative mouse mode via warping. + This is used to implement a workaround.. */ +static SDL_bool isWin10FCUorNewer = SDL_FALSE; + LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -423,11 +445,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (SDL_GetKeyboardFocus() != data->window) { SDL_SetKeyboardFocus(data->window); } - + GetCursorPos(&cursorPos); ScreenToClient(hwnd, &cursorPos); SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y); - + WIN_CheckAsyncMouseRelease(data); /* @@ -459,6 +481,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!mouse->relative_mode || mouse->relative_mode_warp) { SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0); SDL_SendMouseMotion(data->window, mouseID, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + if (isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { + /* To work around #3931, Win10 bug introduced in Fall Creators Update, where + SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore, + after each windows mouse event generate a fake event for the middle of the window + if relative_mode_warp is used */ + int center_x = 0, center_y = 0; + SDL_GetWindowSize(data->window, ¢er_x, ¢er_y); + center_x /= 2; + center_y /= 2; + SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y); + } } } /* don't break here, fall through to check the wParam like the button presses */ @@ -515,7 +548,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) initialMousePoint.y = rawmouse->lLastY; } - SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y) ); + SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y)); initialMousePoint.x = rawmouse->lLastX; initialMousePoint.y = rawmouse->lLastY; @@ -524,10 +557,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } else if (isCapture) { /* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */ POINT pt; + RECT hwndRect; + HWND currentHnd; + GetCursorPos(&pt); - if (WindowFromPoint(pt) != hwnd) { /* if in the window, WM_MOUSEMOVE, etc, will cover it. */ - ScreenToClient(hwnd, &pt); - SDL_SendMouseMotion(data->window, 0, 0, (int) pt.x, (int) pt.y); + currentHnd = WindowFromPoint(pt); + ScreenToClient(hwnd, &pt); + GetClientRect(hwnd, &hwndRect); + + /* if in the window, WM_MOUSEMOVE, etc, will cover it. */ + if(currentHnd != hwnd || pt.x < 0 || pt.y < 0 || pt.x > hwndRect.right || pt.y > hwndRect.right) { + SDL_SendMouseMotion(data->window, 0, 0, (int)pt.x, (int)pt.y); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_MBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_MIDDLE); @@ -542,40 +582,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_MOUSEWHEEL: - { - static short s_AccumulatedMotion; - - s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam); - if (s_AccumulatedMotion > 0) { - while (s_AccumulatedMotion >= WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 0, 1, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion -= WHEEL_DELTA; - } - } else { - while (s_AccumulatedMotion <= -WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 0, -1, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion += WHEEL_DELTA; - } - } - } - break; - case WM_MOUSEHWHEEL: { - static short s_AccumulatedMotion; - - s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam); - if (s_AccumulatedMotion > 0) { - while (s_AccumulatedMotion >= WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 1, 0, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion -= WHEEL_DELTA; - } - } else { - while (s_AccumulatedMotion <= -WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, -1, 0, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion += WHEEL_DELTA; - } - } + short amount = GET_WHEEL_DELTA_WPARAM(wParam); + float fAmount = (float) amount / WHEEL_DELTA; + if (msg == WM_MOUSEWHEEL) + SDL_SendMouseWheel(data->window, 0, 0.0f, fAmount, SDL_MOUSEWHEEL_NORMAL); + else + SDL_SendMouseWheel(data->window, 0, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL); } break; @@ -612,7 +626,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_SendKeyboardKey(SDL_PRESSED, code); } } - + returnCode = 0; break; @@ -683,8 +697,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int w, h; int min_w, min_h; int max_w, max_h; - int style; - BOOL menu; BOOL constrain_max_size; if (SDL_IsShapedWindow(data->window)) @@ -717,21 +729,23 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) constrain_max_size = FALSE; } - size.top = 0; - size.left = 0; - size.bottom = h; - size.right = w; + if (!(SDL_GetWindowFlags(data->window) & SDL_WINDOW_BORDERLESS)) { + LONG style = GetWindowLong(hwnd, GWL_STYLE); + /* DJM - according to the docs for GetMenu(), the + return value is undefined if hwnd is a child window. + Apparently it's too difficult for MS to check + inside their function, so I have to do it here. + */ + BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + size.top = 0; + size.left = 0; + size.bottom = h; + size.right = w; - style = GetWindowLong(hwnd, GWL_STYLE); - /* DJM - according to the docs for GetMenu(), the - return value is undefined if hwnd is a child window. - Apparently it's too difficult for MS to check - inside their function, so I have to do it here. - */ - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&size, style, menu, 0); - w = size.right - size.left; - h = size.bottom - size.top; + AdjustWindowRectEx(&size, style, menu, 0); + w = size.right - size.left; + h = size.bottom - size.top; + } /* Fix our size to the current size */ info = (MINMAXINFO *) lParam; @@ -769,7 +783,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT rect; int x, y; int w, h; - + if (data->initializing || data->in_border_change) { break; } @@ -800,6 +814,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (wParam) { case SIZE_MAXIMIZED: + SDL_SendWindowEvent(data->window, + SDL_WINDOWEVENT_RESTORED, 0, 0); SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); break; @@ -875,7 +891,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_TOUCH: - { + if (data->videodata->GetTouchInputInfo && data->videodata->CloseTouchInputHandle) { UINT i, num_inputs = LOWORD(wParam); PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs); if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) { @@ -949,11 +965,29 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; + case WM_NCCALCSIZE: + { + Uint32 window_flags = SDL_GetWindowFlags(data->window); + if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) { + /* When borderless, need to tell windows that the size of the non-client area is 0 */ + if (!(window_flags & SDL_WINDOW_RESIZABLE)) { + int w, h; + NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam; + w = data->window->windowed.w; + h = data->window->windowed.h; + params->rgrc[0].right = params->rgrc[0].left + w; + params->rgrc[0].bottom = params->rgrc[0].top + h; + } + return 0; + } + } + break; + case WM_NCHITTEST: { SDL_Window *window = data->window; if (window->hit_test) { - POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) }; + POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if (ScreenToClient(hwnd, &winpoint)) { const SDL_Point point = { (int) winpoint.x, (int) winpoint.y }; const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); @@ -976,7 +1010,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } break; - } /* If there's a window proc, assume it's going to handle messages */ @@ -1036,6 +1069,43 @@ WIN_PumpEvents(_THIS) } } +/* to work around #3931, a bug introduced in Win10 Fall Creators Update (build nr. 16299) + we need to detect the windows version. this struct and the function below does that. + usually this struct and the corresponding function (RtlGetVersion) are in + but here we just load it dynamically */ +struct SDL_WIN_OSVERSIONINFOW { + ULONG dwOSVersionInfoSize; + ULONG dwMajorVersion; + ULONG dwMinorVersion; + ULONG dwBuildNumber; + ULONG dwPlatformId; + WCHAR szCSDVersion[128]; +}; + +static SDL_bool +IsWin10FCUorNewer(void) +{ + HMODULE handle = GetModuleHandleW(L"ntdll.dll"); + if (handle) { + typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*); + RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion"); + if (getVersionPtr != NULL) { + struct SDL_WIN_OSVERSIONINFOW info; + SDL_zero(info); + info.dwOSVersionInfoSize = sizeof(info); + if (getVersionPtr(&info) == 0) { /* STATUS_SUCCESS == 0 */ + if ( (info.dwMajorVersion == 10 && info.dwMinorVersion == 0 && info.dwBuildNumber >= 16299) + || (info.dwMajorVersion == 10 && info.dwMinorVersion > 0) + || (info.dwMajorVersion > 10) ) + { + return SDL_TRUE; + } + } + } + } + return SDL_FALSE; +} + static int app_registered = 0; LPTSTR SDL_Appname = NULL; Uint32 SDL_Appstyle = 0; @@ -1045,6 +1115,7 @@ HINSTANCE SDL_Instance = NULL; int SDL_RegisterApp(char *name, Uint32 style, void *hInst) { + const char *hint; WNDCLASSEX wcex; TCHAR path[MAX_PATH]; @@ -1081,14 +1152,26 @@ SDL_RegisterApp(char *name, Uint32 style, void *hInst) wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; - /* Use the first icon as a default icon, like in the Explorer */ - GetModuleFileName(SDL_Instance, path, MAX_PATH); - ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); + hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON); + if (hint && *hint) { + wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); + + hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL); + if (hint && *hint) { + wcex.hIconSm = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); + } + } else { + /* Use the first icon as a default icon, like in the Explorer */ + GetModuleFileName(SDL_Instance, path, MAX_PATH); + ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); + } if (!RegisterClassEx(&wcex)) { return SDL_SetError("Couldn't register application class"); } + isWin10FCUorNewer = IsWin10FCUorNewer(); + app_registered = 1; return 0; } diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h index dcd3118a4..1ce2fb482 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsevents_h -#define _SDL_windowsevents_h +#ifndef SDL_windowsevents_h_ +#define SDL_windowsevents_h_ extern LPTSTR SDL_Appname; extern Uint32 SDL_Appstyle; @@ -31,6 +31,6 @@ extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern void WIN_PumpEvents(_THIS); -#endif /* _SDL_windowsevents_h */ +#endif /* SDL_windowsevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c index 7bb07ed2e..e07d9c431 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h index 0c825f9da..a83cca52b 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c index 8271b0421..c7f357b59 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -268,7 +268,7 @@ void IME_Present(SDL_VideoData *videodata) #else -#ifdef _SDL_msctf_h +#ifdef SDL_msctf_h_ #define USE_INIT_GUID #elif defined(__GNUC__) #define USE_INIT_GUID @@ -295,11 +295,11 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define IMEID_VER(id) ((id) & 0xffff0000) #define IMEID_LANG(id) ((id) & 0x0000ffff) -#define CHT_HKL_DAYI ((HKL)0xE0060404) -#define CHT_HKL_NEW_PHONETIC ((HKL)0xE0080404) -#define CHT_HKL_NEW_CHANG_JIE ((HKL)0xE0090404) -#define CHT_HKL_NEW_QUICK ((HKL)0xE00A0404) -#define CHT_HKL_HK_CANTONESE ((HKL)0xE00B0404) +#define CHT_HKL_DAYI ((HKL)(UINT_PTR)0xE0060404) +#define CHT_HKL_NEW_PHONETIC ((HKL)(UINT_PTR)0xE0080404) +#define CHT_HKL_NEW_CHANG_JIE ((HKL)(UINT_PTR)0xE0090404) +#define CHT_HKL_NEW_QUICK ((HKL)(UINT_PTR)0xE00A0404) +#define CHT_HKL_HK_CANTONESE ((HKL)(UINT_PTR)0xE00B0404) #define CHT_IMEFILENAME1 "TINTLGNT.IME" #define CHT_IMEFILENAME2 "CINTLGNT.IME" #define CHT_IMEFILENAME3 "MSTCIPHA.IME" @@ -312,7 +312,7 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define IMEID_CHT_VER60 (LANG_CHT | MAKEIMEVERSION(6, 0)) #define IMEID_CHT_VER_VISTA (LANG_CHT | MAKEIMEVERSION(7, 0)) -#define CHS_HKL ((HKL)0xE00E0804) +#define CHS_HKL ((HKL)(UINT_PTR)0xE00E0804) #define CHS_IMEFILENAME1 "PINTLGNT.IME" #define CHS_IMEFILENAME2 "MSSCIPYA.IME" #define IMEID_CHS_VER41 (LANG_CHS | MAKEIMEVERSION(4, 1)) @@ -331,9 +331,6 @@ static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex); static void IME_SendEditingEvent(SDL_VideoData *videodata); static void IME_DestroyTextures(SDL_VideoData *videodata); -#define SDL_IsEqualIID(riid1, riid2) SDL_IsEqualGUID(riid1, riid2) -#define SDL_IsEqualGUID(rguid1, rguid2) (!SDL_memcmp(rguid1, rguid2, sizeof(GUID))) - static SDL_bool UILess_SetupSinks(SDL_VideoData *videodata); static void UILess_ReleaseSinks(SDL_VideoData *videodata); static void UILess_EnableUIUpdates(SDL_VideoData *videodata); @@ -354,6 +351,7 @@ IME_Init(SDL_VideoData *videodata, HWND hwnd) videodata->ime_himm32 = SDL_LoadObject("imm32.dll"); if (!videodata->ime_himm32) { videodata->ime_available = SDL_FALSE; + SDL_ClearError(); return; } videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC"); @@ -448,16 +446,12 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) INT err = 0; BOOL vertical = FALSE; UINT maxuilen = 0; - static OSVERSIONINFOA osversion; if (videodata->ime_uiless) return; videodata->ime_readingstring[0] = 0; - if (!osversion.dwOSVersionInfoSize) { - osversion.dwOSVersionInfoSize = sizeof(osversion); - GetVersionExA(&osversion); - } + id = IME_GetId(videodata, 0); if (!id) return; @@ -518,9 +512,6 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) } break; case IMEID_CHS_VER42: - if (osversion.dwPlatformId != VER_PLATFORM_WIN32_NT) - break; - p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 1*4 + 1*4 + 6*4); if (!p) break; @@ -837,7 +828,11 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata) videodata->ime_candpgsize = i - page_start; } else { videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST); - page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + if (videodata->ime_candpgsize > 0) { + page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + } else { + page_start = 0; + } } SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) { @@ -1036,7 +1031,7 @@ STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink) return ++sink->refcount; } -STDMETHODIMP_(ULONG)TSFSink_Release(TSFSink *sink) +STDMETHODIMP_(ULONG) TSFSink_Release(TSFSink *sink) { --sink->refcount; if (sink->refcount == 0) { @@ -1052,9 +1047,9 @@ STDMETHODIMP UIElementSink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv return E_INVALIDARG; *ppv = 0; - if (SDL_IsEqualIID(riid, &IID_IUnknown)) + if (WIN_IsEqualIID(riid, &IID_IUnknown)) *ppv = (IUnknown *)sink; - else if (SDL_IsEqualIID(riid, &IID_ITfUIElementSink)) + else if (WIN_IsEqualIID(riid, &IID_ITfUIElementSink)) *ppv = (ITfUIElementSink *)sink; if (*ppv) { @@ -1158,9 +1153,9 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) return E_INVALIDARG; *ppv = 0; - if (SDL_IsEqualIID(riid, &IID_IUnknown)) + if (WIN_IsEqualIID(riid, &IID_IUnknown)) *ppv = (IUnknown *)sink; - else if (SDL_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) + else if (WIN_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) *ppv = (ITfInputProcessorProfileActivationSink *)sink; if (*ppv) { @@ -1174,8 +1169,8 @@ STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID lan { static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } }; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - videodata->ime_candlistindexbase = SDL_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; - if (SDL_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) + videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; + if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) IME_InputLangChanged((SDL_VideoData *)sink->data); IME_HideCandidateList(videodata); diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h index 84654d7b8..49a1b8788 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowskeyboard_h -#define _SDL_windowskeyboard_h +#ifndef SDL_windowskeyboard_h_ +#define SDL_windowskeyboard_h_ extern void WIN_InitKeyboard(_THIS); extern void WIN_UpdateKeymap(void); @@ -35,6 +35,6 @@ extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect); extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata); -#endif /* _SDL_windowskeyboard_h */ +#endif /* SDL_windowskeyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c index 689e5bbc3..924b4121b 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -346,7 +346,6 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { WIN_DialogData *dialog; int i, x, y; - UINT_PTR which; const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; HFONT DialogFont; SIZE Size; @@ -354,6 +353,7 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) wchar_t* wmessage; TEXTMETRIC TM; + HWND ParentWindow = NULL; const int ButtonWidth = 88; const int ButtonHeight = 26; @@ -411,14 +411,24 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { /* Get the metrics to try and figure our DLU conversion. */ GetTextMetrics(FontDC, &TM); - s_BaseUnitsX = TM.tmAveCharWidth + 1; + + /* Calculation from the following documentation: + * https://support.microsoft.com/en-gb/help/125681/how-to-calculate-dialog-base-units-with-non-system-based-font + * This fixes bug 2137, dialog box calculation with a fixed-width system font + */ + { + SIZE extent; + GetTextExtentPoint32A(FontDC, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &extent); + s_BaseUnitsX = (extent.cx / 26 + 1) / 2; + } + /*s_BaseUnitsX = TM.tmAveCharWidth + 1;*/ s_BaseUnitsY = TM.tmHeight; } /* Measure the *pixel* size of the string. */ wmessage = WIN_UTF8ToString(messageboxdata->message); SDL_zero(TextSize); - Size.cx = DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT); + DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT); /* Add some padding for hangs, etc. */ TextSize.right += 2; @@ -462,16 +472,20 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } else { isDefault = SDL_FALSE; } - if (!AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttons[i].text, i, isDefault)) { + if (!AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttons[i].text, buttons[i].buttonid, isDefault)) { FreeDialogData(dialog); return -1; } x += ButtonWidth + ButtonMargin; } - /* FIXME: If we have a parent window, get the Instance and HWND for them */ - which = DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, NULL, (DLGPROC)MessageBoxDialogProc); - *buttonid = buttons[which].buttonid; + /* If we have a parent window, get the Instance and HWND for them + * so that our little dialog gets exclusive focus at all times. */ + if (messageboxdata->window) { + ParentWindow = ((SDL_WindowData*)messageboxdata->window->driverdata)->hwnd; + } + + *buttonid = (int)DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, ParentWindow, (DLGPROC)MessageBoxDialogProc); FreeDialogData(dialog); return 0; diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h index e9c692546..2cb29beb6 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c index f172f9a3d..7425d9ab3 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,56 +24,18 @@ #include "SDL_windowsvideo.h" #include "../../../include/SDL_assert.h" +#include "../../../include/SDL_log.h" /* Windows CE compatibility */ #ifndef CDS_FULLSCREEN #define CDS_FULLSCREEN 0 #endif -typedef struct _WIN_GetMonitorDPIData { - SDL_VideoData *vid_data; - SDL_DisplayMode *mode; - SDL_DisplayModeData *mode_data; -} WIN_GetMonitorDPIData; - -static BOOL CALLBACK -WIN_GetMonitorDPI(HMONITOR hMonitor, - HDC hdcMonitor, - LPRECT lprcMonitor, - LPARAM dwData) -{ - WIN_GetMonitorDPIData *data = (WIN_GetMonitorDPIData*) dwData; - UINT hdpi, vdpi; - - if (data->vid_data->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK && - hdpi > 0 && - vdpi > 0) { - float hsize, vsize; - - data->mode_data->HorzDPI = (float)hdpi; - data->mode_data->VertDPI = (float)vdpi; - - // Figure out the monitor size and compute the diagonal DPI. - hsize = data->mode->w / data->mode_data->HorzDPI; - vsize = data->mode->h / data->mode_data->VertDPI; - - data->mode_data->DiagDPI = SDL_ComputeDiagonalDPI( data->mode->w, - data->mode->h, - hsize, - vsize ); - - // We can only handle one DPI per display mode so end the enumeration. - return FALSE; - } - - // We didn't get DPI information so keep going. - return TRUE; -} +/* #define DEBUG_MODES */ static void WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) { - SDL_VideoData *vid_data = (SDL_VideoData *) _this->driverdata; SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; HDC hdc; @@ -89,39 +51,8 @@ WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * int logical_width = GetDeviceCaps( hdc, HORZRES ); int logical_height = GetDeviceCaps( hdc, VERTRES ); - data->ScaleX = (float)logical_width / data->DeviceMode.dmPelsWidth; - data->ScaleY = (float)logical_height / data->DeviceMode.dmPelsHeight; mode->w = logical_width; mode->h = logical_height; - - // WIN_GetMonitorDPI needs mode->w and mode->h - // so only call after those are set. - if (vid_data->GetDpiForMonitor) { - WIN_GetMonitorDPIData dpi_data; - RECT monitor_rect; - - dpi_data.vid_data = vid_data; - dpi_data.mode = mode; - dpi_data.mode_data = data; - monitor_rect.left = data->DeviceMode.dmPosition.x; - monitor_rect.top = data->DeviceMode.dmPosition.y; - monitor_rect.right = monitor_rect.left + 1; - monitor_rect.bottom = monitor_rect.top + 1; - EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data); - } else { - // We don't have the Windows 8.1 routine so just - // get system DPI. - data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX ); - data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY ); - if (data->HorzDPI == data->VertDPI) { - data->DiagDPI = data->HorzDPI; - } else { - data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w, - mode->h, - (float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f, - (float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f ); - } - } SDL_zero(bmi_data); bmi = (LPBITMAPINFO) bmi_data; @@ -199,13 +130,6 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod mode->driverdata = data; data->DeviceMode = devmode; - /* Default basic information */ - data->ScaleX = 1.0f; - data->ScaleY = 1.0f; - data->DiagDPI = 0.0f; - data->HorzDPI = 0.0f; - data->VertDPI = 0.0f; - mode->format = SDL_PIXELFORMAT_UNKNOWN; mode->w = data->DeviceMode.dmPelsWidth; mode->h = data->DeviceMode.dmPelsHeight; @@ -217,7 +141,7 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod } static SDL_bool -WIN_AddDisplay(_THIS, LPTSTR DeviceName) +WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEX *info) { SDL_VideoDisplay display; SDL_DisplayData *displaydata; @@ -225,9 +149,10 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) DISPLAY_DEVICE device; #ifdef DEBUG_MODES - printf("Display: %s\n", WIN_StringToUTF8(DeviceName)); + SDL_Log("Display: %s\n", WIN_StringToUTF8(info->szDevice)); #endif - if (!WIN_GetDisplayMode(_this, DeviceName, ENUM_CURRENT_SETTINGS, &mode)) { + + if (!WIN_GetDisplayMode(_this, info->szDevice, ENUM_CURRENT_SETTINGS, &mode)) { return SDL_FALSE; } @@ -235,12 +160,13 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) if (!displaydata) { return SDL_FALSE; } - SDL_memcpy(displaydata->DeviceName, DeviceName, + SDL_memcpy(displaydata->DeviceName, info->szDevice, sizeof(displaydata->DeviceName)); + displaydata->MonitorHandle = hMonitor; SDL_zero(display); device.cb = sizeof(device); - if (EnumDisplayDevices(DeviceName, 0, &device, 0)) { + if (EnumDisplayDevices(info->szDevice, 0, &device, 0)) { display.name = WIN_StringToUTF8(device.DeviceString); } display.desktop_mode = mode; @@ -251,63 +177,53 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) return SDL_TRUE; } +typedef struct _WIN_AddDisplaysData { + SDL_VideoDevice *video_device; + SDL_bool want_primary; +} WIN_AddDisplaysData; + +static BOOL CALLBACK +WIN_AddDisplaysCallback(HMONITOR hMonitor, + HDC hdcMonitor, + LPRECT lprcMonitor, + LPARAM dwData) +{ + WIN_AddDisplaysData *data = (WIN_AddDisplaysData*)dwData; + MONITORINFOEX info; + + SDL_zero(info); + info.cbSize = sizeof(info); + + if (GetMonitorInfo(hMonitor, (LPMONITORINFO)&info) != 0) { + const SDL_bool is_primary = ((info.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY); + + if (is_primary == data->want_primary) { + WIN_AddDisplay(data->video_device, hMonitor, &info); + } + } + + // continue enumeration + return TRUE; +} + +static void +WIN_AddDisplays(_THIS) +{ + WIN_AddDisplaysData callback_data; + callback_data.video_device = _this; + + callback_data.want_primary = SDL_TRUE; + EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data); + + callback_data.want_primary = SDL_FALSE; + EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data); +} + int WIN_InitModes(_THIS) { - int pass; - DWORD i, j, count; - DISPLAY_DEVICE device; + WIN_AddDisplays(_this); - device.cb = sizeof(device); - - /* Get the primary display in the first pass */ - for (pass = 0; pass < 2; ++pass) { - for (i = 0; ; ++i) { - TCHAR DeviceName[32]; - - if (!EnumDisplayDevices(NULL, i, &device, 0)) { - break; - } - if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { - continue; - } - if (pass == 0) { - if (!(device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)) { - continue; - } - } else { - if (device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { - continue; - } - } - SDL_memcpy(DeviceName, device.DeviceName, sizeof(DeviceName)); -#ifdef DEBUG_MODES - printf("Device: %s\n", WIN_StringToUTF8(DeviceName)); -#endif - count = 0; - for (j = 0; ; ++j) { - if (!EnumDisplayDevices(DeviceName, j, &device, 0)) { - break; - } - if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { - continue; - } - if (pass == 0) { - if (!(device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)) { - continue; - } - } else { - if (device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { - continue; - } - } - count += WIN_AddDisplay(_this, device.DeviceName); - } - if (count == 0) { - WIN_AddDisplay(_this, DeviceName); - } - } - } if (_this->num_displays == 0) { return SDL_SetError("No displays available"); } @@ -317,67 +233,104 @@ WIN_InitModes(_THIS) int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { - SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; - - rect->x = (int)SDL_ceil(data->DeviceMode.dmPosition.x * data->ScaleX); - rect->y = (int)SDL_ceil(data->DeviceMode.dmPosition.y * data->ScaleY); - rect->w = (int)SDL_ceil(data->DeviceMode.dmPelsWidth * data->ScaleX); - rect->h = (int)SDL_ceil(data->DeviceMode.dmPelsHeight * data->ScaleY); - - return 0; -} - -int -WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) -{ - SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; - - if (ddpi) { - *ddpi = data->DiagDPI; - } - if (hdpi) { - *hdpi = data->HorzDPI; - } - if (vdpi) { - *vdpi = data->VertDPI; - } - - return data->DiagDPI != 0.0f ? 0 : SDL_SetError("Couldn't get DPI"); -} - -int -WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) -{ - const SDL_DisplayModeData *data = (const SDL_DisplayModeData *) display->current_mode.driverdata; - const DEVMODE *pDevMode = &data->DeviceMode; - POINT pt = { - /* !!! FIXME: no scale, right? */ - (LONG) (pDevMode->dmPosition.x + (pDevMode->dmPelsWidth / 2)), - (LONG) (pDevMode->dmPosition.y + (pDevMode->dmPelsHeight / 2)) - }; - HMONITOR hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; MONITORINFO minfo; - const RECT *work; - BOOL rc = FALSE; + BOOL rc; - SDL_assert(hmon != NULL); - - if (hmon != NULL) { - SDL_zero(minfo); - minfo.cbSize = sizeof (MONITORINFO); - rc = GetMonitorInfo(hmon, &minfo); - SDL_assert(rc); - } + SDL_zero(minfo); + minfo.cbSize = sizeof(MONITORINFO); + rc = GetMonitorInfo(data->MonitorHandle, &minfo); if (!rc) { return SDL_SetError("Couldn't find monitor data"); } - work = &minfo.rcWork; - rect->x = (int)SDL_ceil(work->left * data->ScaleX); - rect->y = (int)SDL_ceil(work->top * data->ScaleY); - rect->w = (int)SDL_ceil((work->right - work->left) * data->ScaleX); - rect->h = (int)SDL_ceil((work->bottom - work->top) * data->ScaleY); + rect->x = minfo.rcMonitor.left; + rect->y = minfo.rcMonitor.top; + rect->w = minfo.rcMonitor.right - minfo.rcMonitor.left; + rect->h = minfo.rcMonitor.bottom - minfo.rcMonitor.top; + + return 0; +} + +int +WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, float * hdpi_out, float * vdpi_out) +{ + const SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; + const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata; + float hdpi = 0, vdpi = 0, ddpi = 0; + + if (videodata->GetDpiForMonitor) { + UINT hdpi_uint, vdpi_uint; + // Windows 8.1+ codepath + if (videodata->GetDpiForMonitor(displaydata->MonitorHandle, MDT_EFFECTIVE_DPI, &hdpi_uint, &vdpi_uint) == S_OK) { + // GetDpiForMonitor docs promise to return the same hdpi/vdpi + hdpi = (float)hdpi_uint; + vdpi = (float)hdpi_uint; + ddpi = (float)hdpi_uint; + } else { + return SDL_SetError("GetDpiForMonitor failed"); + } + } else { + // Window 8.0 and below: same DPI for all monitors. + HDC hdc; + int hdpi_int, vdpi_int, hpoints, vpoints, hpix, vpix; + float hinches, vinches; + + hdc = GetDC(NULL); + if (hdc == NULL) { + return SDL_SetError("GetDC failed"); + } + hdpi_int = GetDeviceCaps(hdc, LOGPIXELSX); + vdpi_int = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(NULL, hdc); + + hpoints = GetSystemMetrics(SM_CXVIRTUALSCREEN); + vpoints = GetSystemMetrics(SM_CYVIRTUALSCREEN); + + hpix = MulDiv(hpoints, hdpi_int, 96); + vpix = MulDiv(vpoints, vdpi_int, 96); + + hinches = (float)hpoints / 96.0f; + vinches = (float)vpoints / 96.0f; + + hdpi = (float)hdpi_int; + vdpi = (float)vdpi_int; + ddpi = SDL_ComputeDiagonalDPI(hpix, vpix, hinches, vinches); + } + + if (ddpi_out) { + *ddpi_out = ddpi; + } + if (hdpi_out) { + *hdpi_out = hdpi; + } + if (vdpi_out) { + *vdpi_out = vdpi; + } + + return ddpi != 0.0f ? 0 : SDL_SetError("Couldn't get DPI"); +} + +int +WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; + MONITORINFO minfo; + BOOL rc; + + SDL_zero(minfo); + minfo.cbSize = sizeof(MONITORINFO); + rc = GetMonitorInfo(data->MonitorHandle, &minfo); + + if (!rc) { + return SDL_SetError("Couldn't find monitor data"); + } + + rect->x = minfo.rcWork.left; + rect->y = minfo.rcWork.top; + rect->w = minfo.rcWork.right - minfo.rcWork.left; + rect->h = minfo.rcWork.bottom - minfo.rcWork.top; return 0; } diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h index 6aa293d21..a5c19b7b5 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,22 +20,18 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsmodes_h -#define _SDL_windowsmodes_h +#ifndef SDL_windowsmodes_h_ +#define SDL_windowsmodes_h_ typedef struct { TCHAR DeviceName[32]; + HMONITOR MonitorHandle; } SDL_DisplayData; typedef struct { DEVMODE DeviceMode; - float ScaleX; - float ScaleY; - float DiagDPI; - float HorzDPI; - float VertDPI; } SDL_DisplayModeData; extern int WIN_InitModes(_THIS); @@ -46,6 +42,6 @@ extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void WIN_QuitModes(_THIS); -#endif /* _SDL_windowsmodes_h */ +#endif /* SDL_windowsmodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c index 72d7892d4..1ddeae24b 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -311,13 +311,6 @@ WIN_InitMouse(_THIS) void WIN_QuitMouse(_THIS) { - SDL_Mouse *mouse = SDL_GetMouse(); - if ( mouse->def_cursor ) { - SDL_free(mouse->def_cursor); - mouse->def_cursor = NULL; - mouse->cur_cursor = NULL; - } - if (rawInputEnableCount) { /* force RAWINPUT off here. */ rawInputEnableCount = 1; ToggleRawInput(SDL_FALSE); diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h index 60672e6bb..775c32c36 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsmouse_h -#define _SDL_windowsmouse_h +#ifndef SDL_windowsmouse_h_ +#define SDL_windowsmouse_h_ extern HCURSOR SDL_cursor; extern void WIN_InitMouse(_THIS); extern void WIN_QuitMouse(_THIS); -#endif /* _SDL_windowsmouse_h */ +#endif /* SDL_windowsmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c index d30d838fd..c3ba56c0e 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_loadso.h" #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" +#include "SDL_hints.h" /* WGL implementation of SDL OpenGL support */ @@ -81,6 +82,11 @@ #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 #endif +#ifndef WGL_ARB_create_context_no_error +#define WGL_ARB_create_context_no_error +#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif + typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, @@ -131,6 +137,44 @@ WIN_GL_LoadLibrary(_THIS, const char *path) return SDL_SetError("Could not retrieve OpenGL functions"); } + /* XXX Too sleazy? WIN_GL_InitExtensions looks for certain OpenGL + extensions via SDL_GL_DeduceMaxSupportedESProfile. This uses + SDL_GL_ExtensionSupported which in turn calls SDL_GL_GetProcAddress. + However SDL_GL_GetProcAddress will fail if the library is not + loaded; it checks for gl_config.driver_loaded > 0. To avoid this + test failing, increment driver_loaded around the call to + WIN_GLInitExtensions. + + Successful loading of the library is normally indicated by + SDL_GL_LoadLibrary incrementing driver_loaded immediately after + this function returns 0 to it. + + Alternatives to this are: + - moving SDL_GL_DeduceMaxSupportedESProfile to both the WIN and + X11 platforms while adding a function equivalent to + SDL_GL_ExtensionSupported but which directly calls + glGetProcAddress(). Having 3 copies of the + SDL_GL_ExtensionSupported makes this alternative unattractive. + - moving SDL_GL_DeduceMaxSupportedESProfile to a new file shared + by the WIN and X11 platforms while adding a function equivalent + to SDL_GL_ExtensionSupported. This is unattractive due to the + number of project files that will need updating, plus there + will be 2 copies of the SDL_GL_ExtensionSupported code. + - Add a private equivalent of SDL_GL_ExtensionSupported to + SDL_video.c. + - Move the call to WIN_GL_InitExtensions back to WIN_CreateWindow + and add a flag to gl_data to avoid multiple calls to this + expensive function. This is probably the least objectionable + alternative if this increment/decrement trick is unacceptable. + + Note that the driver_loaded > 0 check needs to remain in + SDL_GL_ExtensionSupported and SDL_GL_GetProcAddress as they are + public API functions. + */ + ++_this->gl_config.driver_loaded; + WIN_GL_InitExtensions(_this); + --_this->gl_config.driver_loaded; + return 0; } @@ -407,16 +451,28 @@ WIN_GL_InitExtensions(_THIS) } /* Check for WGL_EXT_create_context_es2_profile */ - _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_FALSE; if (HasExtension("WGL_EXT_create_context_es2_profile", extensions)) { - _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE; + SDL_GL_DeduceMaxSupportedESProfile( + &_this->gl_data->es_profile_max_supported_version.major, + &_this->gl_data->es_profile_max_supported_version.minor + ); } - /* Check for GLX_ARB_context_flush_control */ + /* Check for WGL_ARB_context_flush_control */ if (HasExtension("WGL_ARB_context_flush_control", extensions)) { _this->gl_data->HAS_WGL_ARB_context_flush_control = SDL_TRUE; } + /* Check for WGL_ARB_create_context_robustness */ + if (HasExtension("WGL_ARB_create_context_robustness", extensions)) { + _this->gl_data->HAS_WGL_ARB_create_context_robustness = SDL_TRUE; + } + + /* Check for WGL_ARB_create_context_no_error */ + if (HasExtension("WGL_ARB_create_context_no_error", extensions)) { + _this->gl_data->HAS_WGL_ARB_create_context_no_error = SDL_TRUE; + } + _this->gl_data->wglMakeCurrent(hdc, NULL); _this->gl_data->wglDeleteContext(hglrc); ReleaseDC(hwnd, hdc); @@ -593,14 +649,26 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window) return retval; } +SDL_bool +WIN_GL_UseEGL(_THIS) +{ + SDL_assert(_this->gl_data != NULL); + SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); + + return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) + || _this->gl_config.major_version == 1 /* No WGL extension for OpenGL ES 1.x profiles. */ + || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major + || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major + && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor)); +} + SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window) { HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; HGLRC context, share_context; - if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && - !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) { + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && WIN_GL_UseEGL(_this)) { #if SDL_VIDEO_OPENGL_EGL /* Switch to EGL based functions */ WIN_GL_UnloadLibrary(_this); @@ -660,13 +728,13 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) SDL_SetError("GL 3.x is not supported"); context = temp_context; } else { - /* max 10 attributes plus terminator */ - int attribs[11] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, - WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, - 0 - }; - int iattr = 4; + int attribs[15]; /* max 14 attributes plus terminator */ + int iattr = 0; + + attribs[iattr++] = WGL_CONTEXT_MAJOR_VERSION_ARB; + attribs[iattr++] = _this->gl_config.major_version; + attribs[iattr++] = WGL_CONTEXT_MINOR_VERSION_ARB; + attribs[iattr++] = _this->gl_config.minor_version; /* SDL profile bits match WGL profile bits */ if (_this->gl_config.profile_mask != 0) { @@ -688,6 +756,20 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; } + /* only set if wgl extension is available */ + if (_this->gl_data->HAS_WGL_ARB_create_context_robustness) { + attribs[iattr++] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; + attribs[iattr++] = _this->gl_config.reset_notification ? + WGL_LOSE_CONTEXT_ON_RESET_ARB : + WGL_NO_RESET_NOTIFICATION_ARB; + } + + /* only set if wgl extension is available */ + if (_this->gl_data->HAS_WGL_ARB_create_context_no_error) { + attribs[iattr++] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB; + attribs[iattr++] = _this->gl_config.no_error; + } + attribs[iattr++] = 0; /* Create the GL 3.x context */ @@ -766,12 +848,15 @@ WIN_GL_GetSwapInterval(_THIS) return retval; } -void +int WIN_GL_SwapWindow(_THIS, SDL_Window * window) { HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; - SwapBuffers(hdc); + if (!SwapBuffers(hdc)) { + return WIN_SetError("SwapBuffers()"); + } + return 0; } void diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h index 7b95cc8d9..75b4898c3 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsopengl_h -#define _SDL_windowsopengl_h +#ifndef SDL_windowsopengl_h_ +#define SDL_windowsopengl_h_ #if SDL_VIDEO_OPENGL_WGL @@ -29,10 +29,20 @@ struct SDL_GLDriverData { SDL_bool HAS_WGL_ARB_pixel_format; SDL_bool HAS_WGL_EXT_swap_control_tear; - SDL_bool HAS_WGL_EXT_create_context_es2_profile; SDL_bool HAS_WGL_ARB_context_flush_control; + SDL_bool HAS_WGL_ARB_create_context_robustness; + SDL_bool HAS_WGL_ARB_create_context_no_error; - void *(WINAPI * wglGetProcAddress) (const char *proc); + /* Max version of OpenGL ES context that can be created if the + implementation supports WGL_EXT_create_context_es2_profile. + major = minor = 0 when unsupported. + */ + struct { + int major; + int minor; + } es_profile_max_supported_version; + + void *(WINAPI * wglGetProcAddress) (const char *proc); HGLRC(WINAPI * wglCreateContext) (HDC hdc); BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc); BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc); @@ -56,13 +66,14 @@ struct SDL_GLDriverData extern int WIN_GL_LoadLibrary(_THIS, const char *path); extern void *WIN_GL_GetProcAddress(_THIS, const char *proc); extern void WIN_GL_UnloadLibrary(_THIS); +extern SDL_bool WIN_GL_UseEGL(_THIS); extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window); extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window); extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int WIN_GL_SetSwapInterval(_THIS, int interval); extern int WIN_GL_GetSwapInterval(_THIS); -extern void WIN_GL_SwapWindow(_THIS, SDL_Window * window); +extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window); extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context); extern void WIN_GL_InitExtensions(_THIS); extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Window * toWindow); @@ -126,6 +137,6 @@ extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Wi #endif /* SDL_VIDEO_OPENGL_WGL */ -#endif /* _SDL_windowsopengl_h */ +#endif /* SDL_windowsopengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c index f66cc088a..0ff61c3d0 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) { } if (_this->egl_data == NULL) { - return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY); + return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0); } return 0; @@ -110,7 +110,7 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window) if (_this->egl_data == NULL) { - if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY) < 0) { + if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) { SDL_EGL_UnloadLibrary(_this); return -1; } @@ -126,17 +126,6 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window) return WIN_GLES_MakeCurrent(_this, current_win, current_ctx); } -int -WIN_GLES_SetSwapInterval(_THIS, int interval) -{ - /* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this - * from working if we do (the window contents freeze and don't swap properly). So, we ignore - * the request for now. - */ - SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug"); - return 0; -} - #endif /* SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h index dbdf5f6a1..86844292a 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_winopengles_h -#define _SDL_winopengles_h +#ifndef SDL_winopengles_h_ +#define SDL_winopengles_h_ #if SDL_VIDEO_OPENGL_EGL @@ -33,19 +33,17 @@ #define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddress #define WIN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define WIN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval -/* See the WIN_GLES_GetSwapInterval implementation to see why this is commented out */ -/*#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval*/ -extern int WIN_GLES_SetSwapInterval(_THIS, int interval); +#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval extern int WIN_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window); -extern void WIN_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context); extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window); #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_winopengles_h */ +#endif /* SDL_winopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c index 0a50985a2..bed4588c5 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ Win32_CreateShaper(SDL_Window * window) { return result; } -void +static void CombineRectRegions(SDL_ShapeTree* node,void* closure) { HRGN mask_region = *((HRGN*)closure),temp_region = NULL; if(node->kind == OpaqueShape) { diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h index ddd8f49ba..eb1a887e9 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_windowsshape_h -#define _SDL_windowsshape_h +#ifndef SDL_windowsshape_h_ +#define SDL_windowsshape_h_ #include "SDL_video.h" #include "SDL_shape.h" @@ -37,4 +37,4 @@ extern SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window); extern int Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); extern int Win32_ResizeWindowShape(SDL_Window *window); -#endif /* _SDL_windowsshape_h */ +#endif /* SDL_windowsshape_h_ */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c index 21f63a018..8d45b721e 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include "SDL_windowsvideo.h" #include "SDL_windowsframebuffer.h" #include "SDL_windowsshape.h" +#include "SDL_windowsvulkan.h" /* Initialization/Query functions */ static int WIN_VideoInit(_THIS); @@ -42,7 +43,8 @@ static void WIN_VideoQuit(_THIS); SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE; SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE; -static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue) { if (newValue && *newValue == '0') { g_WindowsEnableMessageLoop = SDL_FALSE; @@ -51,7 +53,8 @@ static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, con } } -static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue) { if (newValue && *newValue == '0') { g_WindowFrameUsableWhileCursorHidden = SDL_FALSE; @@ -113,11 +116,15 @@ WIN_CreateDevice(int devindex) data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle"); data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo"); data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow"); + } else { + SDL_ClearError(); } data->shcoreDLL = SDL_LoadObject("SHCORE.DLL"); if (data->shcoreDLL) { data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor"); + } else { + SDL_ClearError(); } /* Set the function pointers */ @@ -130,13 +137,13 @@ WIN_CreateDevice(int devindex) device->SetDisplayMode = WIN_SetDisplayMode; device->PumpEvents = WIN_PumpEvents; -#undef CreateWindow - device->CreateWindow = WIN_CreateWindow; - device->CreateWindowFrom = WIN_CreateWindowFrom; + device->CreateSDLWindow = WIN_CreateWindow; + device->CreateSDLWindowFrom = WIN_CreateWindowFrom; device->SetWindowTitle = WIN_SetWindowTitle; device->SetWindowIcon = WIN_SetWindowIcon; device->SetWindowPosition = WIN_SetWindowPosition; device->SetWindowSize = WIN_SetWindowSize; + device->GetWindowBordersSize = WIN_GetWindowBordersSize; device->SetWindowOpacity = WIN_SetWindowOpacity; device->ShowWindow = WIN_ShowWindow; device->HideWindow = WIN_HideWindow; @@ -184,6 +191,13 @@ WIN_CreateDevice(int devindex) device->GL_SwapWindow = WIN_GLES_SwapWindow; device->GL_DeleteContext = WIN_GLES_DeleteContext; #endif +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = WIN_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface; +#endif + device->StartTextInput = WIN_StartTextInput; device->StopTextInput = WIN_StopTextInput; device->SetTextInputRect = WIN_SetTextInputRect; diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h index 912d8763d..13037544f 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsvideo_h -#define _SDL_windowsvideo_h +#ifndef SDL_windowsvideo_h_ +#define SDL_windowsvideo_h_ #include "../../core/windows/SDL_windows.h" @@ -194,6 +194,6 @@ extern SDL_bool g_WindowFrameUsableWhileCursorHidden; typedef struct IDirect3D9 IDirect3D9; extern SDL_bool D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface ); -#endif /* _SDL_windowsvideo_h */ +#endif /* SDL_windowsvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c new file mode 100644 index 000000000..c4b34f0db --- /dev/null +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS + +#include "SDL_windowsvideo.h" +#include "SDL_windowswindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_windowsvulkan.h" +#include "SDL_syswm.h" + +int WIN_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + Uint32 i; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasWin32SurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "vulkan-1.dll"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasWin32SurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasWin32SurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_WIN32_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void WIN_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForWin32[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForWin32), + extensionsForWin32); +} + +SDL_bool WIN_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR = + (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateWin32SurfaceKHR"); + VkWin32SurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateWin32SurfaceKHR) + { + SDL_SetError(VK_KHR_WIN32_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.hinstance = windowData->hinstance; + createInfo.hwnd = windowData->hwnd; + result = vkCreateWin32SurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateWin32SurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h new file mode 100644 index 000000000..0acc0a9f5 --- /dev/null +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_windowsvulkan_h_ +#define SDL_windowsvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS + +int WIN_Vulkan_LoadLibrary(_THIS, const char *path); +void WIN_Vulkan_UnloadLibrary(_THIS); +SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool WIN_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_windowsvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c index 5ce40e6ba..b08244389 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,9 +51,17 @@ static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); static ATOM SDL_HelperWindowClass = 0; +/* For borderless Windows, still want the following flags: + - WS_CAPTION: this seems to enable the Windows minimize animation + - WS_SYSMENU: enables system context menu on task bar + - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. + This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen + */ + #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) #define STYLE_FULLSCREEN (WS_POPUP) #define STYLE_BORDERLESS (WS_POPUP) +#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX) #define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE) @@ -67,10 +75,25 @@ GetWindowStyle(SDL_Window * window) style |= STYLE_FULLSCREEN; } else { if (window->flags & SDL_WINDOW_BORDERLESS) { - style |= STYLE_BORDERLESS; + /* SDL 2.1: + This behavior more closely matches other platform where the window is borderless + but still interacts with the window manager (e.g. task bar shows above it, it can + be resized to fit within usable desktop area, etc.) so this should be the behavior + for a future SDL release. + + If you want a borderless window the size of the desktop that looks like a fullscreen + window, then you should use the SDL_WINDOW_FULLSCREEN_DESKTOP flag. + */ + if (SDL_GetHintBoolean("SDL_BORDERLESS_WINDOWED_STYLE", SDL_FALSE)) { + style |= STYLE_BORDERLESS_WINDOWED; + } else { + style |= STYLE_BORDERLESS; + } } else { style |= STYLE_NORMAL; } + + /* You can have a borderless resizable window */ if (window->flags & SDL_WINDOW_RESIZABLE) { style |= STYLE_RESIZABLE; } @@ -78,35 +101,58 @@ GetWindowStyle(SDL_Window * window) return style; } +static void +WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x, int *y, int *width, int *height, SDL_bool use_current) +{ + RECT rect; + + rect.left = 0; + rect.top = 0; + rect.right = (use_current ? window->w : window->windowed.w); + rect.bottom = (use_current ? window->h : window->windowed.h); + + /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message + expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles. + */ + if (!(window->flags & SDL_WINDOW_BORDERLESS)) + AdjustWindowRectEx(&rect, style, menu, 0); + + *x = (use_current ? window->x : window->windowed.x) + rect.left; + *y = (use_current ? window->y : window->windowed.y) + rect.top; + *width = (rect.right - rect.left); + *height = (rect.bottom - rect.top); +} + +static void +WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height, SDL_bool use_current) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + HWND hwnd = data->hwnd; + DWORD style; + BOOL menu; + + style = GetWindowLong(hwnd, GWL_STYLE); + menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current); +} + static void WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - RECT rect; - DWORD style; HWND top; - BOOL menu; int x, y; int w, h; /* Figure out what the window area will be */ - if (SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || (window->flags & SDL_WINDOW_ALWAYS_ON_TOP))) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; } - style = GetWindowLong(hwnd, GWL_STYLE); - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->x + rect.left; - y = window->y + rect.top; + + WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_TRUE); data->expected_resize = SDL_TRUE; SetWindowPos(hwnd, top, x, y, w, h, flags); @@ -114,7 +160,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) } static int -SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) +SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool created) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *data; @@ -126,7 +172,9 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) } data->window = window; data->hwnd = hwnd; + data->parent = parent; data->hdc = GetDC(hwnd); + data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE); data->created = created; data->mouse_button_flags = 0; data->videodata = videodata; @@ -164,27 +212,13 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) if (GetClientRect(hwnd, &rect)) { int w = rect.right; int h = rect.bottom; - if ((window->w && window->w != w) || (window->h && window->h != h)) { + if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) { /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */ - RECT rect; - DWORD style; - BOOL menu; int x, y; int w, h; /* Figure out what the window area will be */ - style = GetWindowLong(hwnd, GWL_STYLE); - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->x + rect.left; - y = window->y + rect.top; - + WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE); SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); } else { window->w = w; @@ -208,10 +242,10 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) } else { window->flags &= ~SDL_WINDOW_SHOWN; } - if (style & (WS_BORDER | WS_THICKFRAME)) { - window->flags &= ~SDL_WINDOW_BORDERLESS; - } else { + if (style & WS_POPUP) { window->flags |= SDL_WINDOW_BORDERLESS; + } else { + window->flags &= ~SDL_WINDOW_BORDERLESS; } if (style & WS_THICKFRAME) { window->flags |= SDL_WINDOW_RESIZABLE; @@ -262,30 +296,27 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) return 0; } + + int WIN_CreateWindow(_THIS, SDL_Window * window) { - HWND hwnd; - RECT rect; + HWND hwnd, parent = NULL; DWORD style = STYLE_BASIC; int x, y; int w, h; + if (window->flags & SDL_WINDOW_SKIP_TASKBAR) { + parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL); + } + style |= GetWindowStyle(window); /* Figure out what the window area will be */ - rect.left = window->x; - rect.top = window->y; - rect.right = window->x + window->w; - rect.bottom = window->y + window->h; - AdjustWindowRectEx(&rect, style, FALSE, 0); - x = rect.left; - y = rect.top; - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); + WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE); hwnd = - CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, + CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL, SDL_Instance, NULL); if (!hwnd) { return WIN_SetError("Couldn't create window"); @@ -293,43 +324,47 @@ WIN_CreateWindow(_THIS, SDL_Window * window) WIN_PumpEvents(_this); - if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { + if (SetupWindowData(_this, window, hwnd, parent, SDL_TRUE) < 0) { DestroyWindow(hwnd); + if (parent) { + DestroyWindow(parent); + } return -1; } -#if SDL_VIDEO_OPENGL_WGL - /* We need to initialize the extensions before deciding how to create ES profiles */ - if (window->flags & SDL_WINDOW_OPENGL) { - WIN_GL_InitExtensions(_this); - } -#endif + /* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */ + SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + if (!(window->flags & SDL_WINDOW_OPENGL)) { + return 0; + } + + /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ #if SDL_VIDEO_OPENGL_ES2 - if ((window->flags & SDL_WINDOW_OPENGL) && - _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES -#if SDL_VIDEO_OPENGL_WGL - && (!_this->gl_data || !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) -#endif - ) { -#if SDL_VIDEO_OPENGL_EGL + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES +#if SDL_VIDEO_OPENGL_WGL + && (!_this->gl_data || WIN_GL_UseEGL(_this)) +#endif /* SDL_VIDEO_OPENGL_WGL */ + ) { +#if SDL_VIDEO_OPENGL_EGL if (WIN_GLES_SetupWindow(_this, window) < 0) { WIN_DestroyWindow(_this, window); return -1; } + return 0; #else - return SDL_SetError("Could not create GLES window surface (no EGL support available)"); -#endif /* SDL_VIDEO_OPENGL_EGL */ - } else + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); +#endif /* SDL_VIDEO_OPENGL_EGL */ + } #endif /* SDL_VIDEO_OPENGL_ES2 */ #if SDL_VIDEO_OPENGL_WGL - if (window->flags & SDL_WINDOW_OPENGL) { - if (WIN_GL_SetupWindow(_this, window) < 0) { - WIN_DestroyWindow(_this, window); - return -1; - } + if (WIN_GL_SetupWindow(_this, window) < 0) { + WIN_DestroyWindow(_this, window); + return -1; } +#else + return SDL_SetError("Could not create GL window (WGL support not configured)"); #endif return 0; @@ -357,7 +392,7 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) SDL_stack_free(title); } - if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) { + if (SetupWindowData(_this, window, hwnd, GetParent(hwnd), SDL_FALSE) < 0) { return -1; } @@ -404,11 +439,12 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HICON hicon = NULL; BYTE *icon_bmp; - int icon_len, y; + int icon_len, mask_len, y; SDL_RWops *dst; - /* Create temporary bitmap buffer */ - icon_len = 40 + icon->h * icon->w * 4; + /* Create temporary buffer for ICONIMAGE structure */ + mask_len = (icon->h * (icon->w + 7)/8); + icon_len = 40 + icon->h * icon->w * sizeof(Uint32) + mask_len; icon_bmp = SDL_stack_alloc(BYTE, icon_len); dst = SDL_RWFromMem(icon_bmp, icon_len); if (!dst) { @@ -423,7 +459,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) SDL_WriteLE16(dst, 1); SDL_WriteLE16(dst, 32); SDL_WriteLE32(dst, BI_RGB); - SDL_WriteLE32(dst, icon->h * icon->w * 4); + SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32)); SDL_WriteLE32(dst, 0); SDL_WriteLE32(dst, 0); SDL_WriteLE32(dst, 0); @@ -434,9 +470,12 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) y = icon->h; while (y--) { Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch; - SDL_RWwrite(dst, src, icon->pitch, 1); + SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1); } + /* Write the mask */ + SDL_memset(icon_bmp + icon_len - mask_len, 0xFF, mask_len); + hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); SDL_RWclose(dst); @@ -461,6 +500,49 @@ WIN_SetWindowSize(_THIS, SDL_Window * window) WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE); } +int +WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right) +{ + HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; + RECT rcClient, rcWindow; + POINT ptDiff; + + /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left + * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */ + GetClientRect(hwnd, &rcClient); + GetWindowRect(hwnd, &rcWindow); + + /* convert the top/left values to make them relative to + * the window; they will end up being slightly negative */ + ptDiff.y = rcWindow.top; + ptDiff.x = rcWindow.left; + + ScreenToClient(hwnd, &ptDiff); + + rcWindow.top = ptDiff.y; + rcWindow.left = ptDiff.x; + + /* convert the bottom/right values to make them relative to the window, + * these will be slightly bigger than the inner width/height */ + ptDiff.y = rcWindow.bottom; + ptDiff.x = rcWindow.right; + + ScreenToClient(hwnd, &ptDiff); + + rcWindow.bottom = ptDiff.y; + rcWindow.right = ptDiff.x; + + /* Now that both the inner and outer rects use the same coordinate system we can substract them to get the border size. + * Keep in mind that the top/left coordinates of rcWindow are negative because the border lies slightly before {0,0}, + * so switch them around because SDL2 wants them in positive. */ + *top = rcClient.top - rcWindow.top; + *left = rcClient.left - rcWindow.left; + *bottom = rcWindow.bottom - rcClient.bottom; + *right = rcWindow.right - rcClient.right; + + return 0; +} + void WIN_ShowWindow(_THIS, SDL_Window * window) { @@ -504,15 +586,11 @@ WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - DWORD style = GetWindowLong(hwnd, GWL_STYLE); + DWORD style; - if (bordered) { - style &= ~STYLE_BORDERLESS; - style |= STYLE_NORMAL; - } else { - style &= ~STYLE_NORMAL; - style |= STYLE_BORDERLESS; - } + style = GetWindowLong(hwnd, GWL_STYLE); + style &= ~STYLE_MASK; + style |= GetWindowStyle(window); data->in_border_change = SDL_TRUE; SetWindowLong(hwnd, GWL_STYLE, style); @@ -525,13 +603,11 @@ WIN_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - DWORD style = GetWindowLong(hwnd, GWL_STYLE); + DWORD style; - if (resizable) { - style |= STYLE_RESIZABLE; - } else { - style &= ~STYLE_RESIZABLE; - } + style = GetWindowLong(hwnd, GWL_STYLE); + style &= ~STYLE_MASK; + style |= GetWindowStyle(window); SetWindowLong(hwnd, GWL_STYLE, style); } @@ -551,15 +627,13 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; - RECT rect; SDL_Rect bounds; DWORD style; HWND top; - BOOL menu; int x, y; int w, h; - if (SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; @@ -585,6 +659,8 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, style &= ~WS_MAXIMIZE; } } else { + BOOL menu; + /* Restore window-maximization state, as applicable. Special care is taken to *not* do this if and when we're alt-tab'ing away (to some other window; as indicated by @@ -595,16 +671,9 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, style |= WS_MAXIMIZE; data->windowed_mode_was_maximized = SDL_FALSE; } - rect.left = 0; - rect.top = 0; - rect.right = window->windowed.w; - rect.bottom = window->windowed.h; + menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->windowed.x + rect.left; - y = window->windowed.y + rect.top; + WIN_AdjustWindowRectWithStyle(window, style, menu, &x, &y, &w, &h, SDL_FALSE); } SetWindowLong(hwnd, GWL_STYLE, style); data->expected_resize = SDL_TRUE; @@ -675,6 +744,9 @@ WIN_DestroyWindow(_THIS, SDL_Window * window) RemoveProp(data->hwnd, TEXT("SDL_WindowData")); if (data->created) { DestroyWindow(data->hwnd); + if (data->parent) { + DestroyWindow(data->parent); + } } else { /* Restore any original event handler... */ if (data->wndproc != NULL) { @@ -697,12 +769,22 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata; if (info->version.major <= SDL_MAJOR_VERSION) { + int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch); + info->subsystem = SDL_SYSWM_WINDOWS; info->info.win.window = data->hwnd; - info->info.win.hdc = data->hdc; + + if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) { + info->info.win.hdc = data->hdc; + } + + if (versionnum >= SDL_VERSIONNUM(2, 0, 5)) { + info->info.win.hinstance = data->hinstance; + } + return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -780,20 +862,27 @@ SDL_HelperWindowDestroy(void) void WIN_OnWindowEnter(_THIS, SDL_Window * window) { -#ifdef WM_MOUSELEAVE SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - TRACKMOUSEEVENT trackMouseEvent; if (!data || !data->hwnd) { /* The window wasn't fully initialized */ return; } - trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); - trackMouseEvent.dwFlags = TME_LEAVE; - trackMouseEvent.hwndTrack = data->hwnd; + if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { + WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE); + } - TrackMouseEvent(&trackMouseEvent); +#ifdef WM_MOUSELEAVE + { + TRACKMOUSEEVENT trackMouseEvent; + + trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + trackMouseEvent.dwFlags = TME_LEAVE; + trackMouseEvent.hwndTrack = data->hwnd; + + TrackMouseEvent(&trackMouseEvent); + } #endif /* WM_MOUSELEAVE */ } diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h index 7d50ba66e..0325abb8e 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowswindow_h -#define _SDL_windowswindow_h +#ifndef SDL_windowswindow_h_ +#define SDL_windowswindow_h_ #if SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" @@ -31,8 +31,10 @@ typedef struct { SDL_Window *window; HWND hwnd; + HWND parent; HDC hdc; HDC mdc; + HINSTANCE hinstance; HBITMAP hbm; WNDPROC wndproc; SDL_bool created; @@ -56,6 +58,7 @@ extern void WIN_SetWindowTitle(_THIS, SDL_Window * window); extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void WIN_SetWindowPosition(_THIS, SDL_Window * window); extern void WIN_SetWindowSize(_THIS, SDL_Window * window); +extern int WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern void WIN_ShowWindow(_THIS, SDL_Window * window); extern void WIN_HideWindow(_THIS, SDL_Window * window); @@ -76,6 +79,6 @@ extern void WIN_OnWindowEnter(_THIS, SDL_Window * window); extern void WIN_UpdateClipCursor(SDL_Window *window); extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_windowswindow_h */ +#endif /* SDL_windowswindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/wmmsg.h b/Engine/lib/sdl/src/video/windows/wmmsg.h index 8c1351fe9..19c1bf432 100644 --- a/Engine/lib/sdl/src/video/windows/wmmsg.h +++ b/Engine/lib/sdl/src/video/windows/wmmsg.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp index 30cf01633..370e8c514 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -105,7 +105,7 @@ WINRT_XAMLThreadMain(void * userdata) } void -WINRT_CycleXAMLThread() +WINRT_CycleXAMLThread(void) { switch (_threadState) { case ThreadState_NotLaunched: diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h index 05a90a3bf..8b346ec22 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -75,7 +75,7 @@ extern SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window); #endif // NTDDI_VERSION >= ... /* XAML Thread Management */ -extern void WINRT_CycleXAMLThread(); +extern void WINRT_CycleXAMLThread(void); #endif // ifdef __cplusplus_winrt diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp index 215dfcc83..961711115 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h index afcef37b2..a3e477798 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtgamebar_h -#define _SDL_winrtgamebar_h +#ifndef SDL_winrtgamebar_h_ +#define SDL_winrtgamebar_h_ #ifdef __cplusplus /* These are exported as C++ functions, rather than C, to fix a compilation @@ -30,6 +30,6 @@ extern void WINRT_InitGameBar(_THIS); extern void WINRT_QuitGameBar(_THIS); #endif -#endif /* _SDL_winrtmouse_h */ +#endif /* SDL_winrtgamebar_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp index affcae62b..34f2421a7 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ /* SDL-specific includes */ -#include +#include "SDL.h" #include "SDL_winrtevents_c.h" extern "C" { diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp index ca958107c..3576a3f1c 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h index 4184aa5ee..204cf4a01 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp index 9997d6ea4..093a1b91f 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h index 464ba4d47..22a80fc86 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtmouse_h -#define _SDL_winrtmouse_h +#ifndef SDL_winrtmouse_h_ +#define SDL_winrtmouse_h_ #ifdef __cplusplus extern "C" { @@ -35,6 +35,6 @@ extern SDL_bool WINRT_UsingRelativeMouseMode; } #endif -#endif /* _SDL_winrtmouse_h */ +#endif /* SDL_winrtmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp index cca07fa1b..7874501e9 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ extern "C" { #include "SDL_winrtopengles.h" #include "SDL_loadso.h" +#include "../SDL_egl_c.h" } /* Windows includes */ @@ -57,7 +58,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) { SDL_VideoData *video_data = (SDL_VideoData *)_this->driverdata; - if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY) != 0) { + if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0) != 0) { return -1; } @@ -87,11 +88,11 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) Microsoft::WRL::ComPtr cpp_display = video_data->winrtEglWindow; _this->egl_data->egl_display = ((eglGetDisplay_Old_Function)_this->egl_data->eglGetDisplay)(cpp_display); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get Windows 8.0 EGL display"); + return SDL_EGL_SetError("Could not get Windows 8.0 EGL display", "eglGetDisplay"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { - return SDL_SetError("Could not initialize Windows 8.0 EGL"); + return SDL_EGL_SetError("Could not initialize Windows 8.0 EGL", "eglInitialize"); } } else { /* Declare some ANGLE/EGL initialization property-sets, as suggested by @@ -132,7 +133,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ eglGetPlatformDisplayEXT_Function eglGetPlatformDisplayEXT = (eglGetPlatformDisplayEXT_Function)_this->egl_data->eglGetProcAddress("eglGetPlatformDisplayEXT"); if (!eglGetPlatformDisplayEXT) { - return SDL_SetError("Could not retrieve ANGLE/WinRT display function(s)"); + return SDL_EGL_SetError("Could not retrieve ANGLE/WinRT display function(s)", "eglGetProcAddress"); } #if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) @@ -141,7 +142,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get 10_0+ EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D 10_0+", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) @@ -153,7 +154,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get 9_3 EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D 9_3", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { @@ -162,11 +163,11 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get WARP EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D WARP", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { - return SDL_SetError("Could not initialize WinRT 8.x+ EGL"); + return SDL_EGL_SetError("Could not initialize WinRT 8.x+ EGL", "eglInitialize"); } } } diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h index 1da757b6c..a222c2b6e 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtopengles_h -#define _SDL_winrtopengles_h +#ifndef SDL_winrtopengles_h_ +#define SDL_winrtopengles_h_ #if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL @@ -38,7 +38,7 @@ extern int WINRT_GLES_LoadLibrary(_THIS, const char *path); extern void WINRT_GLES_UnloadLibrary(_THIS); extern SDL_GLContext WINRT_GLES_CreateContext(_THIS, SDL_Window * window); -extern void WINRT_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int WINRT_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WINRT_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); @@ -65,6 +65,6 @@ typedef EGLDisplay (EGLAPIENTRY *eglGetPlatformDisplayEXT_Function)(EGLenum, voi #endif /* SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_winrtopengles_h */ +#endif /* SDL_winrtopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp index 1d648f966..bc438f275 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -295,7 +295,7 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P } WINRT_LeftFingerDown = 0; } - + SDL_SendTouch( WINRT_TouchID, (SDL_FingerID) pointerPoint->PointerId, @@ -335,9 +335,8 @@ WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::Po return; } - // FIXME: This may need to accumulate deltas up to WHEEL_DELTA - short motion = pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA; - SDL_SendMouseWheel(window, 0, 0, motion, SDL_MOUSEWHEEL_NORMAL); + float motion = (float) pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA; + SDL_SendMouseWheel(window, 0, 0, (float) motion, SDL_MOUSEWHEEL_NORMAL); } void @@ -369,7 +368,7 @@ WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::Mouse // http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.mouseeventargs.mousedelta ), // does not seem to indicate (to me) that its values should be so large. It // says that its values should be a "change in screen location". I could - // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see: + // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see: // http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/09a9868e-95bb-4858-ba1a-cb4d2c298d62 ), // indicates that these values are in DIPs, which is the same unit used // by CoreWindow's PointerMoved events (via the Position field in its CurrentPoint diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp index 9a26705ad..99bfd07b3 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,7 +140,7 @@ WINRT_CreateDevice(int devindex) /* Set the function pointers */ device->VideoInit = WINRT_VideoInit; device->VideoQuit = WINRT_VideoQuit; - device->CreateWindow = WINRT_CreateWindow; + device->CreateSDLWindow = WINRT_CreateWindow; device->SetWindowSize = WINRT_SetWindowSize; device->SetWindowFullscreen = WINRT_SetWindowFullscreen; device->DestroyWindow = WINRT_DestroyWindow; @@ -621,7 +621,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) _this->egl_data->egl_config, cpp_winrtEglWindow, NULL); if (data->egl_surface == NULL) { - return SDL_SetError("eglCreateWindowSurface failed"); + return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface"); } } else if (data->coreWindow.Get() != nullptr) { /* Attempt to create a window surface using newer versions of @@ -634,7 +634,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) coreWindowAsIInspectable, NULL); if (data->egl_surface == NULL) { - return SDL_SetError("eglCreateWindowSurface failed"); + return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface"); } } else { return SDL_SetError("No supported means to create an EGL window surface are available"); @@ -771,7 +771,7 @@ WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.winrt.window = reinterpret_cast(data->coreWindow.Get()); return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h index 7d5ce13e0..91e967e0d 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c index 34c0a71c6..fad8c9cbf 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,13 +40,23 @@ static Window GetWindow(_THIS) { - SDL_Window *window; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - window = _this->windows; - if (window) { - return ((SDL_WindowData *) window->driverdata)->xwindow; + /* We create an unmapped window that exists just to manage the clipboard, + since X11 selection data is tied to a specific window and dies with it. + We create the window on demand, so apps that don't use the clipboard + don't have to keep an unnecessary resource around. */ + if (data->clipboard_window == None) { + Display *dpy = data->display; + Window parent = RootWindow(dpy, DefaultScreen(dpy)); + XSetWindowAttributes xattr; + data->clipboard_window = X11_XCreateWindow(dpy, parent, -10, -10, 1, 1, 0, + CopyFromParent, InputOnly, + CopyFromParent, 0, &xattr); + X11_XFlush(data->display); } - return None; + + return data->clipboard_window; } /* We use our own cut-buffer for intermediate storage instead of diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h index 15dae7dfd..97aff1b73 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11clipboard_h -#define _SDL_x11clipboard_h +#ifndef SDL_x11clipboard_h_ +#define SDL_x11clipboard_h_ extern int X11_SetClipboardText(_THIS, const char *text); extern char *X11_GetClipboardText(_THIS); extern SDL_bool X11_HasClipboardText(_THIS); extern Atom X11_GetSDLCutBufferClipboardType(Display *display); -#endif /* _SDL_x11clipboard_h */ +#endif /* SDL_x11clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c index d07fda740..89f736acf 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h index be1ddaa1c..d3866e70c 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11dyn_h -#define _SDL_x11dyn_h +#ifndef SDL_x11dyn_h_ +#define SDL_x11dyn_h_ #include #include @@ -107,5 +107,5 @@ extern SDL_DYNX11FN_XGetICValues X11_XGetICValues; } #endif -#endif /* !defined _SDL_x11dyn_h */ +#endif /* !defined SDL_x11dyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11events.c b/Engine/lib/sdl/src/video/x11/SDL_x11events.c index 56d2368a0..d293a5efc 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11events.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,7 @@ #include "SDL_x11video.h" #include "SDL_x11touch.h" #include "SDL_x11xinput2.h" +#include "../../core/unix/SDL_poll.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_touch_c.h" @@ -38,6 +39,7 @@ #include "SDL_hints.h" #include "SDL_timer.h" #include "SDL_syswm.h" +#include "SDL_assert.h" #include @@ -201,7 +203,7 @@ X11_IsWheelEvent(Display * display,XEvent * event,int * xticks,int * yticks) On error, -1 is returned. */ -int X11_URIDecode(char *buf, int len) { +static int X11_URIDecode(char *buf, int len) { int ri, wi, di; char decode = '\0'; if (buf == NULL || len < 0) { @@ -301,10 +303,10 @@ static char* X11_URIToLocal(char* uri) { } #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS -static void X11_HandleGenericEvent(SDL_VideoData *videodata,XEvent event) +static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev) { /* event is a union, so cookie == &event, but this is type safe. */ - XGenericEventCookie *cookie = &event.xcookie; + XGenericEventCookie *cookie = &xev->xcookie; if (X11_XGetEventData(videodata->display, cookie)) { X11_HandleXinput2Event(videodata, cookie); X11_XFreeEventData(videodata->display, cookie); @@ -348,6 +350,7 @@ X11_ReconcileKeyboardState(_THIS) Window junk_window; int x, y; unsigned int mask; + const Uint8 *keyboardState; X11_XQueryKeymap(display, keys); @@ -357,11 +360,16 @@ X11_ReconcileKeyboardState(_THIS) SDL_ToggleModState(KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0); } + keyboardState = SDL_GetKeyboardState(0); for (keycode = 0; keycode < 256; ++keycode) { - if (keys[keycode / 8] & (1 << (keycode % 8))) { - SDL_SendKeyboardKey(SDL_PRESSED, viddata->key_layout[keycode]); - } else { - SDL_SendKeyboardKey(SDL_RELEASED, viddata->key_layout[keycode]); + SDL_Scancode scancode = viddata->key_layout[keycode]; + SDL_bool x11KeyPressed = (keys[keycode / 8] & (1 << (keycode % 8))) != 0; + SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED; + + if (x11KeyPressed && !sdlKeyPressed) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } else if (!x11KeyPressed && sdlKeyPressed) { + SDL_SendKeyboardKey(SDL_RELEASED, scancode); } } } @@ -531,6 +539,95 @@ X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest) } } +static void +X11_HandleClipboardEvent(_THIS, const XEvent *xevent) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + Display *display = videodata->display; + + SDL_assert(videodata->clipboard_window != None); + SDL_assert(xevent->xany.window == videodata->clipboard_window); + + switch (xevent->type) { + /* Copy the selection from our own CUTBUFFER to the requested property */ + case SelectionRequest: { + const XSelectionRequestEvent *req = &xevent->xselectionrequest; + XEvent sevent; + int seln_format; + unsigned long nbytes; + unsigned long overflow; + unsigned char *seln_data; + +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionRequest (requestor = %ld, target = %ld)\n", + req->requestor, req->target); +#endif + + SDL_zero(sevent); + sevent.xany.type = SelectionNotify; + sevent.xselection.selection = req->selection; + sevent.xselection.target = None; + sevent.xselection.property = None; /* tell them no by default */ + sevent.xselection.requestor = req->requestor; + sevent.xselection.time = req->time; + + /* !!! FIXME: We were probably storing this on the root window + because an SDL window might go away...? but we don't have to do + this now (or ever, really). */ + if (X11_XGetWindowProperty(display, DefaultRootWindow(display), + X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target, + &sevent.xselection.target, &seln_format, &nbytes, + &overflow, &seln_data) == Success) { + /* !!! FIXME: cache atoms */ + Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0); + if (sevent.xselection.target == req->target) { + X11_XChangeProperty(display, req->requestor, req->property, + sevent.xselection.target, seln_format, PropModeReplace, + seln_data, nbytes); + sevent.xselection.property = req->property; + } else if (XA_TARGETS == req->target) { + Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target }; + X11_XChangeProperty(display, req->requestor, req->property, + XA_ATOM, 32, PropModeReplace, + (unsigned char*)SupportedFormats, + SDL_arraysize(SupportedFormats)); + sevent.xselection.property = req->property; + sevent.xselection.target = XA_TARGETS; + } + X11_XFree(seln_data); + } + X11_XSendEvent(display, req->requestor, False, 0, &sevent); + X11_XSync(display, False); + } + break; + + case SelectionNotify: { +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionNotify (requestor = %ld, target = %ld)\n", + xevent->xselection.requestor, xevent->xselection.target); +#endif + videodata->selection_waiting = SDL_FALSE; + } + break; + + case SelectionClear: { + /* !!! FIXME: cache atoms */ + Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); + +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionClear (requestor = %ld, target = %ld)\n", + xevent->xselection.requestor, xevent->xselection.target); +#endif + + if (xevent->xselectionclear.selection == XA_PRIMARY || + (XA_CLIPBOARD != None && xevent->xselectionclear.selection == XA_CLIPBOARD)) { + SDL_SendClipboardUpdate(); + } + } + break; + } +} + static void X11_DispatchEvent(_THIS) @@ -568,14 +665,21 @@ X11_DispatchEvent(_THIS) printf("Filtered event type = %d display = %d window = %d\n", xevent.type, xevent.xany.display, xevent.xany.window); #endif + /* Make sure dead key press/release events are sent */ + /* But only if we're using one of the DBus IMEs, otherwise + some XIM IMEs will generate duplicate events */ if (orig_keycode) { - /* Make sure dead key press/release events are sent */ +#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) SDL_Scancode scancode = videodata->key_layout[orig_keycode]; + videodata->filter_code = orig_keycode; + videodata->filter_time = xevent.xkey.time; + if (orig_event_type == KeyPress) { SDL_SendKeyboardKey(SDL_PRESSED, scancode); } else { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } +#endif } return; } @@ -592,7 +696,7 @@ X11_DispatchEvent(_THIS) #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS if(xevent.type == GenericEvent) { - X11_HandleGenericEvent(videodata,xevent); + X11_HandleGenericEvent(videodata, &xevent); return; } #endif @@ -602,6 +706,12 @@ X11_DispatchEvent(_THIS) xevent.type, xevent.xany.display, xevent.xany.window); #endif + if ((videodata->clipboard_window != None) && + (videodata->clipboard_window == xevent.xany.window)) { + X11_HandleClipboardEvent(_this, &xevent); + return; + } + data = NULL; if (videodata && videodata->windowlist) { for (i = 0; i < videodata->numwindows; ++i) { @@ -768,7 +878,7 @@ X11_DispatchEvent(_THIS) X11_XDisplayKeycodes(display, &min_keycode, &max_keycode); keysym = X11_KeyCodeToSym(_this, keycode, xevent.xkey.state >> 13); fprintf(stderr, - "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", + "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", keycode, keycode - min_keycode, keysym, X11_XKeysymToString(keysym)); } @@ -792,7 +902,10 @@ X11_DispatchEvent(_THIS) } #endif if (!handled_by_ime) { - SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */ + if (xevent.xkey.keycode != videodata->filter_code || xevent.xkey.time != videodata->filter_time) { + SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + } if(*text) { SDL_SendKeyboardText(text); } @@ -892,7 +1005,7 @@ X11_DispatchEvent(_THIS) printf("Protocol version to use : %d\n", xdnd_version); printf("More then 3 data types : %d\n", (int) use_list); #endif - + if (use_list) { /* fetch conversion targets */ SDL_x11Prop p; @@ -906,7 +1019,7 @@ X11_DispatchEvent(_THIS) } } else if (xevent.xclient.message_type == videodata->XdndPosition) { - + #ifdef DEBUG_XEVENTS Atom act= videodata->XdndActionCopy; if(xdnd_version >= 2) { @@ -914,7 +1027,7 @@ X11_DispatchEvent(_THIS) } printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act)); #endif - + /* reply with status */ memset(&m, 0, sizeof(XClientMessageEvent)); @@ -1017,7 +1130,7 @@ X11_DispatchEvent(_THIS) printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button); #endif if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) { - SDL_SendMouseWheel(data->window, 0, xticks, yticks, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL); } else { SDL_bool ignore_click = SDL_FALSE; int button = xevent.xbutton.button; @@ -1207,55 +1320,6 @@ X11_DispatchEvent(_THIS) } break; - /* Copy the selection from our own CUTBUFFER to the requested property */ - case SelectionRequest: { - XSelectionRequestEvent *req; - XEvent sevent; - int seln_format; - unsigned long nbytes; - unsigned long overflow; - unsigned char *seln_data; - - req = &xevent.xselectionrequest; -#ifdef DEBUG_XEVENTS - printf("window %p: SelectionRequest (requestor = %ld, target = %ld)\n", data, - req->requestor, req->target); -#endif - - SDL_zero(sevent); - sevent.xany.type = SelectionNotify; - sevent.xselection.selection = req->selection; - sevent.xselection.target = None; - sevent.xselection.property = None; - sevent.xselection.requestor = req->requestor; - sevent.xselection.time = req->time; - - if (X11_XGetWindowProperty(display, DefaultRootWindow(display), - X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target, - &sevent.xselection.target, &seln_format, &nbytes, - &overflow, &seln_data) == Success) { - Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0); - if (sevent.xselection.target == req->target) { - X11_XChangeProperty(display, req->requestor, req->property, - sevent.xselection.target, seln_format, PropModeReplace, - seln_data, nbytes); - sevent.xselection.property = req->property; - } else if (XA_TARGETS == req->target) { - Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target }; - X11_XChangeProperty(display, req->requestor, req->property, - XA_ATOM, 32, PropModeReplace, - (unsigned char*)SupportedFormats, - SDL_arraysize(SupportedFormats)); - sevent.xselection.property = req->property; - sevent.xselection.target = XA_TARGETS; - } - X11_XFree(seln_data); - } - X11_XSendEvent(display, req->requestor, False, 0, &sevent); - X11_XSync(display, False); - } - break; - case SelectionNotify: { Atom target = xevent.xselection.target; #ifdef DEBUG_XEVENTS @@ -1299,19 +1363,6 @@ X11_DispatchEvent(_THIS) X11_XSendEvent(display, data->xdnd_source, False, NoEventMask, (XEvent*)&m); X11_XSync(display, False); - - } else { - videodata->selection_waiting = SDL_FALSE; - } - } - break; - - case SelectionClear: { - Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); - - if (xevent.xselectionclear.selection == XA_PRIMARY || - (XA_CLIPBOARD != None && xevent.xselectionclear.selection == XA_CLIPBOARD)) { - SDL_SendClipboardUpdate(); } } break; @@ -1359,17 +1410,8 @@ X11_Pending(Display * display) } /* More drastic measures are required -- see if X is ready to talk */ - { - static struct timeval zero_time; /* static == 0 */ - int x11_fd; - fd_set fdset; - - x11_fd = ConnectionNumber(display); - FD_ZERO(&fdset); - FD_SET(x11_fd, &fdset); - if (select(x11_fd + 1, &fdset, NULL, NULL, &zero_time) == 1) { - return (X11_XPending(display)); - } + if (SDL_IOReady(ConnectionNumber(display), SDL_FALSE, 0)) { + return (X11_XPending(display)); } /* Oh well, nothing is ready .. */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11events.h b/Engine/lib/sdl/src/video/x11/SDL_x11events.h index 024fca3f4..53c69a5a1 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11events.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11events_h -#define _SDL_x11events_h +#ifndef SDL_x11events_h_ +#define SDL_x11events_h_ extern void X11_PumpEvents(_THIS); extern void X11_SuspendScreenSaver(_THIS); -#endif /* _SDL_x11events_h */ +#endif /* SDL_x11events_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c index a4886169f..ad58170bc 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,7 +97,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, shm_error = False; X_handler = X11_XSetErrorHandler(shm_errhandler); X11_XShmAttach(display, shminfo); - X11_XSync(display, True); + X11_XSync(display, False); X11_XSetErrorHandler(X_handler); if ( shm_error ) shmdt(shminfo->shmaddr); diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h index 7326e7da9..61bb0c55c 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c index b888bff35..d667c7b22 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,10 @@ #include "imKStoUCS.h" +#ifdef X_HAVE_UTF8_STRING +#include +#endif + /* *INDENT-OFF* */ static const struct { KeySym keysym; @@ -262,19 +266,82 @@ X11_InitKeyboard(_THIS) int best_distance; int best_index; int distance; - + BOOL xkb_repeat = 0; + X11_XAutoRepeatOn(data->display); #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM { - int xkb_major = XkbMajorVersion; - int xkb_minor = XkbMinorVersion; - if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) { - data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd); - } - } -#endif + int xkb_major = XkbMajorVersion; + int xkb_minor = XkbMinorVersion; + if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) { + data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd); + } + + /* This will remove KeyRelease events for held keys */ + X11_XkbSetDetectableAutoRepeat(data->display, True, &xkb_repeat); + } +#endif + + /* Open a connection to the X input manager */ +#ifdef X_HAVE_UTF8_STRING + if (SDL_X11_HAVE_UTF8) { + /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that + Compose keys will work correctly. */ + char *prev_locale = setlocale(LC_ALL, NULL); + char *prev_xmods = X11_XSetLocaleModifiers(NULL); + const char *new_xmods = ""; +#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) + const char *env_xmods = SDL_getenv("XMODIFIERS"); +#endif + SDL_bool has_dbus_ime_support = SDL_FALSE; + + if (prev_locale) { + prev_locale = SDL_strdup(prev_locale); + } + + if (prev_xmods) { + prev_xmods = SDL_strdup(prev_xmods); + } + + /* IBus resends some key events that were filtered by XFilterEvents + when it is used via XIM which causes issues. Prevent this by forcing + @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via + the DBus implementation, which also has support for pre-editing. */ +#ifdef HAVE_IBUS_IBUS_H + if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) { + has_dbus_ime_support = SDL_TRUE; + } +#endif +#ifdef HAVE_FCITX_FRONTEND_H + if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) { + has_dbus_ime_support = SDL_TRUE; + } +#endif + if (has_dbus_ime_support || !xkb_repeat) { + new_xmods = "@im=none"; + } + + setlocale(LC_ALL, ""); + X11_XSetLocaleModifiers(new_xmods); + + data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname); + + /* Reset the locale + X locale modifiers back to how they were, + locale first because the X locale modifiers depend on it. */ + setlocale(LC_ALL, prev_locale); + X11_XSetLocaleModifiers(prev_xmods); + + if (prev_locale) { + SDL_free(prev_locale); + } + + if (prev_xmods) { + SDL_free(prev_xmods); + } + } +#endif /* Try to determine which scancodes are being used based on fingerprint */ best_distance = SDL_arraysize(fingerprint) + 1; best_index = -1; @@ -313,7 +380,7 @@ X11_InitKeyboard(_THIS) SDL_Keycode keymap[SDL_NUM_SCANCODES]; printf - ("Keyboard layout unknown, please send the following to the SDL mailing list (sdl@libsdl.org):\n"); + ("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n"); /* Determine key_layout - only works on US QWERTY layout */ SDL_GetDefaultKeymap(keymap); @@ -417,7 +484,7 @@ X11_QuitKeyboard(_THIS) #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { - X11_XkbFreeClientMap(data->xkb, 0, True); + X11_XkbFreeKeyboard(data->xkb, 0, True); data->xkb = NULL; } #endif diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h index 6ce3c9cce..c1cc69c96 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11keyboard_h -#define _SDL_x11keyboard_h +#ifndef SDL_x11keyboard_h_ +#define SDL_x11keyboard_h_ extern int X11_InitKeyboard(_THIS); extern void X11_UpdateKeymap(_THIS); @@ -31,6 +31,6 @@ extern void X11_StopTextInput(_THIS); extern void X11_SetTextInputRect(_THIS, SDL_Rect *rect); extern KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group); -#endif /* _SDL_x11keyboard_h */ +#endif /* SDL_x11keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c index fc8b1b26b..fe6ab199e 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #include "SDL_x11video.h" #include "SDL_x11dyn.h" #include "SDL_assert.h" +#include "SDL_x11messagebox.h" #include #include @@ -49,7 +50,7 @@ #define MIN_DIALOG_HEIGHT 100 /* Minimum dialog height */ static const char g_MessageBoxFontLatin1[] = "-*-*-medium-r-normal--0-120-*-*-p-0-iso8859-1"; -static const char g_MessageBoxFont[] = "-*-*-*-*-*-*-*-120-*-*-*-*-*-*"; +static const char g_MessageBoxFont[] = "-*-*-medium-r-normal--*-120-*-*-*-*-*-*"; static const SDL_MessageBoxColor g_default_colors[ SDL_MESSAGEBOX_COLOR_MAX ] = { { 56, 54, 53 }, /* SDL_MESSAGEBOX_COLOR_BACKGROUND, */ @@ -377,10 +378,11 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) int x, y; XSizeHints *sizehints; XSetWindowAttributes wnd_attr; - Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME, UTF8_STRING; + Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME; Display *display = data->display; SDL_WindowData *windowdata = NULL; const SDL_MessageBoxData *messageboxdata = data->messageboxdata; + char *title_locale = NULL; if ( messageboxdata->window ) { SDL_DisplayData *displaydata = @@ -413,10 +415,30 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) X11_XStoreName( display, data->window, messageboxdata->title ); _NET_WM_NAME = X11_XInternAtom(display, "_NET_WM_NAME", False); - UTF8_STRING = X11_XInternAtom(display, "UTF8_STRING", False); - X11_XChangeProperty(display, data->window, _NET_WM_NAME, UTF8_STRING, 8, - PropModeReplace, (unsigned char *) messageboxdata->title, - strlen(messageboxdata->title) + 1 ); + + title_locale = SDL_iconv_utf8_locale(messageboxdata->title); + if (title_locale) { + XTextProperty titleprop; + Status status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop); + SDL_free(title_locale); + if (status) { + X11_XSetTextProperty(display, data->window, &titleprop, XA_WM_NAME); + X11_XFree(titleprop.value); + } + } + +#ifdef X_HAVE_UTF8_STRING + if (SDL_X11_HAVE_UTF8) { + XTextProperty titleprop; + Status status = X11_Xutf8TextListToTextProperty(display, (char **) &messageboxdata->title, 1, + XUTF8StringStyle, &titleprop); + if (status == Success) { + X11_XSetTextProperty(display, data->window, &titleprop, + _NET_WM_NAME); + X11_XFree(titleprop.value); + } + } +#endif /* Let the window manager know this is a dialog box */ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h index c77c57fb1..cab407b2d 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11modes.c b/Engine/lib/sdl/src/video/x11/SDL_x11modes.c index 29307b3a6..5eafe7343 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11modes.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -134,23 +134,20 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo) } else { return SDL_PIXELFORMAT_INDEX4MSB; } - break; + /* break; -Wunreachable-code-break */ case 1: if (BitmapBitOrder(display) == LSBFirst) { return SDL_PIXELFORMAT_INDEX1LSB; } else { return SDL_PIXELFORMAT_INDEX1MSB; } - break; + /* break; -Wunreachable-code-break */ } } return SDL_PIXELFORMAT_UNKNOWN; } -/* Global for the error handler */ -int vm_event, vm_error = -1; - #if SDL_VIDEO_DRIVER_X11_XINERAMA static SDL_bool CheckXinerama(Display * display, int *major, int *minor) @@ -349,7 +346,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, } -int +static int X11_InitModes_XRandR(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; @@ -396,9 +393,16 @@ X11_InitModes_XRandR(_THIS) X11_XFree(pixmapformats); } - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (!res) { - continue; + res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); + if (!res || res->noutput == 0) { + if (res) { + X11_XRRFreeScreenResources(res); + } + + res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); + if (!res) { + continue; + } } for (output = 0; output < res->noutput; output++) { @@ -464,8 +468,8 @@ X11_InitModes_XRandR(_THIS) displaydata->screen = screen; displaydata->visual = vinfo.visual; displaydata->depth = vinfo.depth; - displaydata->hdpi = ((float) mode.w) * 25.4f / display_mm_width; - displaydata->vdpi = ((float) mode.h) * 25.4f / display_mm_height; + displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; + displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); displaydata->scanline_pad = scanline_pad; displaydata->x = display_x; @@ -502,6 +506,7 @@ X11_InitModes_XRandR(_THIS) static SDL_bool CheckVidMode(Display * display, int *major, int *minor) { + int vm_event, vm_error = -1; /* Default the extension not available */ *major = *minor = 0; @@ -521,7 +526,6 @@ CheckVidMode(Display * display, int *major, int *minor) } /* Query the extension version */ - vm_error = -1; if (!X11_XF86VidModeQueryExtension(display, &vm_event, &vm_error) || !X11_XF86VidModeQueryVersion(display, major, minor)) { #ifdef X11MODES_DEBUG @@ -569,7 +573,7 @@ CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info) info->vtotal)) : 0; } -SDL_bool +static SDL_bool SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode) { mode->w = info->hdisplay; @@ -584,7 +588,7 @@ int X11_InitModes(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - int snum, screen, screencount; + int snum, screen, screencount = 0; #if SDL_VIDEO_DRIVER_X11_XINERAMA int xinerama_major, xinerama_minor; int use_xinerama = 0; @@ -604,7 +608,8 @@ X11_InitModes(_THIS) /* require at least XRandR v1.3 */ if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { - return X11_InitModes_XRandR(_this); + if (X11_InitModes_XRandR(_this) == 0) + return 0; } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ @@ -741,9 +746,9 @@ X11_InitModes(_THIS) displaydata->visual = vinfo.visual; displaydata->depth = vinfo.depth; - // We use the displaydata screen index here so that this works - // for both the Xinerama case, where we get the overall DPI, - // and the regular X11 screen info case. + /* We use the displaydata screen index here so that this works + for both the Xinerama case, where we get the overall DPI, + and the regular X11 screen info case. */ displaydata->hdpi = (float)DisplayWidth(data->display, displaydata->screen) * 25.4f / DisplayWidthMM(data->display, displaydata->screen); displaydata->vdpi = (float)DisplayHeight(data->display, displaydata->screen) * 25.4f / @@ -824,8 +829,6 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) int nmodes; XF86VidModeModeInfo ** modes; #endif - int screen_w; - int screen_h; SDL_DisplayMode mode; /* Unfortunately X11 requires the window to be created with the correct @@ -837,11 +840,14 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) mode.format = sdl_display->current_mode.format; mode.driverdata = NULL; - screen_w = DisplayWidth(display, data->screen); - screen_h = DisplayHeight(display, data->screen); - #if SDL_VIDEO_DRIVER_X11_XINERAMA if (data->use_xinerama) { + int screen_w; + int screen_h; + + screen_w = DisplayWidth(display, data->screen); + screen_h = DisplayHeight(display, data->screen); + if (data->use_vidmode && !data->xinerama_info.x_org && !data->xinerama_info.y_org && (screen_w > data->xinerama_info.width || screen_h > data->xinerama_info.height)) { SDL_DisplayModeData *modedata; diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11modes.h b/Engine/lib/sdl/src/video/x11/SDL_x11modes.h index 4f47f3b5c..7d3ff3ef9 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11modes.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11modes_h -#define _SDL_x11modes_h +#ifndef SDL_x11modes_h_ +#define SDL_x11modes_h_ typedef struct { @@ -80,6 +80,6 @@ extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); -#endif /* _SDL_x11modes_h */ +#endif /* SDL_x11modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c index e1a16c225..3b98726d0 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -308,23 +308,27 @@ X11_ShowCursor(SDL_Cursor * cursor) return 0; } +static void +WarpMouseInternal(Window xwindow, const int x, const int y) +{ + SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; + Display *display = videodata->display; + X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y); + X11_XSync(display, False); + videodata->global_mouse_changed = SDL_TRUE; +} + static void X11_WarpMouse(SDL_Window * window, int x, int y) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display = data->videodata->display; - - X11_XWarpPointer(display, None, data->xwindow, 0, 0, 0, 0, x, y); - X11_XSync(display, False); + WarpMouseInternal(data->xwindow, x, y); } static int X11_WarpMouseGlobal(int x, int y) { - Display *display = GetDisplay(); - - X11_XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, x, y); - X11_XSync(display, False); + WarpMouseInternal(DefaultRootWindow(GetDisplay()), x, y); return 0; } diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h index d31d6b722..104185832 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11mouse_h -#define _SDL_x11mouse_h +#ifndef SDL_x11mouse_h_ +#define SDL_x11mouse_h_ extern void X11_InitMouse(_THIS); extern void X11_QuitMouse(_THIS); -#endif /* _SDL_x11mouse_h */ +#endif /* SDL_x11mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c index abc699dd4..7c3cb339d 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_x11video.h" #include "SDL_assert.h" +#include "SDL_hints.h" /* GLX implementation of SDL OpenGL support */ @@ -113,6 +114,13 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, #endif #endif +#ifndef GLX_ARB_create_context_no_error +#define GLX_ARB_create_context_no_error +#ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB +#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif +#endif + #ifndef GLX_EXT_swap_control #define GLX_SWAP_INTERVAL_EXT 0x20F1 #define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 @@ -143,7 +151,6 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, static void X11_GL_InitExtensions(_THIS); - int X11_GL_LoadLibrary(_THIS, const char *path) { @@ -222,13 +229,17 @@ X11_GL_LoadLibrary(_THIS, const char *path) } /* Initialize extensions */ + /* See lengthy comment about the inc/dec in + ../windows/SDL_windowsopengl.c. */ + ++_this->gl_config.driver_loaded; X11_GL_InitExtensions(_this); + --_this->gl_config.driver_loaded; /* If we need a GL ES context and there's no * GLX_EXT_create_context_es2_profile extension, switch over to X11_GLES functions */ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && - ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) { + X11_GL_UseEGL(_this) ) { #if SDL_VIDEO_OPENGL_EGL X11_GL_UnloadLibrary(_this); /* Better avoid conflicts! */ @@ -320,9 +331,48 @@ X11_GL_InitExtensions(_THIS) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; const int screen = DefaultScreen(display); + XVisualInfo *vinfo = NULL; + Window w = 0; + GLXContext prev_ctx = 0; + GLXDrawable prev_drawable = 0; + GLXContext context = 0; const char *(*glXQueryExtensionsStringFunc) (Display *, int); const char *extensions; + vinfo = X11_GL_GetVisual(_this, display, screen); + if (vinfo) { + GLXContext (*glXGetCurrentContextFunc) (void) = + (GLXContext(*)(void)) + X11_GL_GetProcAddress(_this, "glXGetCurrentContext"); + + GLXDrawable (*glXGetCurrentDrawableFunc) (void) = + (GLXDrawable(*)(void)) + X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable"); + + if (glXGetCurrentContextFunc && glXGetCurrentDrawableFunc) { + XSetWindowAttributes xattr; + prev_ctx = glXGetCurrentContextFunc(); + prev_drawable = glXGetCurrentDrawableFunc(); + + xattr.background_pixel = 0; + xattr.border_pixel = 0; + xattr.colormap = + X11_XCreateColormap(display, RootWindow(display, screen), + vinfo->visual, AllocNone); + w = X11_XCreateWindow(display, RootWindow(display, screen), 0, 0, + 32, 32, 0, vinfo->depth, InputOutput, vinfo->visual, + (CWBackPixel | CWBorderPixel | CWColormap), &xattr); + + context = _this->gl_data->glXCreateContext(display, vinfo, + NULL, True); + if (context) { + _this->gl_data->glXMakeCurrent(display, w, context); + } + } + + X11_XFree(vinfo); + } + glXQueryExtensionsStringFunc = (const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this, "glXQueryExtensionsString"); @@ -380,23 +430,58 @@ X11_GL_InitExtensions(_THIS) /* Check for GLX_EXT_create_context_es2_profile */ if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) { - _this->gl_data->HAS_GLX_EXT_create_context_es2_profile = SDL_TRUE; + /* this wants to call glGetString(), so it needs a context. */ + /* !!! FIXME: it would be nice not to make a context here though! */ + if (context) { + SDL_GL_DeduceMaxSupportedESProfile( + &_this->gl_data->es_profile_max_supported_version.major, + &_this->gl_data->es_profile_max_supported_version.minor + ); + } } /* Check for GLX_ARB_context_flush_control */ if (HasExtension("GLX_ARB_context_flush_control", extensions)) { _this->gl_data->HAS_GLX_ARB_context_flush_control = SDL_TRUE; } + + /* Check for GLX_ARB_create_context_robustness */ + if (HasExtension("GLX_ARB_create_context_robustness", extensions)) { + _this->gl_data->HAS_GLX_ARB_create_context_robustness = SDL_TRUE; + } + + /* Check for GLX_ARB_create_context_no_error */ + if (HasExtension("GLX_ARB_create_context_no_error", extensions)) { + _this->gl_data->HAS_GLX_ARB_create_context_no_error = SDL_TRUE; + } + + if (context) { + _this->gl_data->glXMakeCurrent(display, None, NULL); + _this->gl_data->glXDestroyContext(display, context); + if (prev_ctx && prev_drawable) { + _this->gl_data->glXMakeCurrent(display, prev_drawable, prev_ctx); + } + } + + if (w) { + X11_XDestroyWindow(display, w); + } + X11_PumpEvents(_this); } /* glXChooseVisual and glXChooseFBConfig have some small differences in * the attribute encoding, it can be chosen with the for_FBConfig parameter. + * Some targets fail if you use GLX_X_VISUAL_TYPE_EXT/GLX_DIRECT_COLOR_EXT, + * so it gets specified last if used and is pointed to by *_pvistypeattr. + * In case of failure, if that pointer is not NULL, set that pointer to None + * and try again. */ static int -X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig) +X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig, int **_pvistypeattr) { int i = 0; const int MAX_ATTRIBUTES = 64; + int *pvistypeattr = NULL; /* assert buffer is large enough to hold all SDL attributes. */ SDL_assert(size >= MAX_ATTRIBUTES); @@ -488,6 +573,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si EXT_visual_info extension, then add GLX_X_VISUAL_TYPE_EXT. */ if (X11_UseDirectColorVisuals() && _this->gl_data->HAS_GLX_EXT_visual_info) { + pvistypeattr = &attribs[i]; attribs[i++] = GLX_X_VISUAL_TYPE_EXT; attribs[i++] = GLX_DIRECT_COLOR_EXT; } @@ -496,6 +582,10 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si SDL_assert(i <= MAX_ATTRIBUTES); + if (_pvistypeattr) { + *_pvistypeattr = pvistypeattr; + } + return i; } @@ -505,29 +595,27 @@ X11_GL_GetVisual(_THIS, Display * display, int screen) /* 64 seems nice. */ int attribs[64]; XVisualInfo *vinfo; + int *pvistypeattr = NULL; if (!_this->gl_data) { /* The OpenGL library wasn't loaded, SDL_GetError() should have info */ return NULL; } - X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE); + X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE, &pvistypeattr); vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); + + if (!vinfo && (pvistypeattr != NULL)) { + *pvistypeattr = None; + vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); + } + if (!vinfo) { SDL_SetError("Couldn't find matching GLX visual"); } return vinfo; } -#ifndef GLXBadContext -#define GLXBadContext 0 -#endif -#ifndef GLXBadFBConfig -#define GLXBadFBConfig 9 -#endif -#ifndef GLXBadProfileARB -#define GLXBadProfileARB 13 -#endif static int (*handler) (Display *, XErrorEvent *) = NULL; static const char *errorHandlerOperation = NULL; static int errorBase = 0; @@ -551,12 +639,25 @@ X11_GL_ErrorHandler(Display * d, XErrorEvent * e) } else { - SDL_SetError("Could not %s: %i (Base %i)\n", errorHandlerOperation, errorCode, errorBase); + SDL_SetError("Could not %s: %i (Base %i)", errorHandlerOperation, errorCode, errorBase); } return (0); } +SDL_bool +X11_GL_UseEGL(_THIS) +{ + SDL_assert(_this->gl_data != NULL); + SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); + + return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) + || _this->gl_config.major_version == 1 /* No GLX extension for OpenGL ES 1.x profiles. */ + || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major + || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major + && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor)); +} + SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window) { @@ -593,8 +694,8 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) context = _this->gl_data->glXCreateContext(display, vinfo, share_context, True); } else { - /* max 10 attributes plus terminator */ - int attribs[11] = { + /* max 14 attributes plus terminator */ + int attribs[15] = { GLX_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, GLX_CONTEXT_MINOR_VERSION_ARB, @@ -624,6 +725,21 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; } + /* only set if glx extension is available */ + if( _this->gl_data->HAS_GLX_ARB_create_context_robustness ) { + attribs[iattr++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; + attribs[iattr++] = + _this->gl_config.reset_notification ? + GLX_LOSE_CONTEXT_ON_RESET_ARB : + GLX_NO_RESET_NOTIFICATION_ARB; + } + + /* only set if glx extension is available */ + if( _this->gl_data->HAS_GLX_ARB_create_context_no_error ) { + attribs[iattr++] = GLX_CONTEXT_OPENGL_NO_ERROR_ARB; + attribs[iattr++] = _this->gl_config.no_error; + } + attribs[iattr++] = 0; /* Get a pointer to the context creation function for GL 3.0 */ @@ -635,19 +751,28 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) /* Create a GL 3.x context */ GLXFBConfig *framebuffer_config = NULL; int fbcount = 0; + int *pvistypeattr = NULL; - X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE); + X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE,&pvistypeattr); - if (!_this->gl_data->glXChooseFBConfig - || !(framebuffer_config = - _this->gl_data->glXChooseFBConfig(display, + if (_this->gl_data->glXChooseFBConfig) { + framebuffer_config = _this->gl_data->glXChooseFBConfig(display, DefaultScreen(display), glxAttribs, - &fbcount))) { - SDL_SetError("No good framebuffers found. OpenGL 3.0 and later unavailable"); - } else { - context = _this->gl_data->glXCreateContextAttribsARB(display, - framebuffer_config[0], - share_context, True, attribs); + &fbcount); + + if (!framebuffer_config && (pvistypeattr != NULL)) { + *pvistypeattr = None; + framebuffer_config = _this->gl_data->glXChooseFBConfig(display, + DefaultScreen(display), glxAttribs, + &fbcount); + } + + if (framebuffer_config) { + context = _this->gl_data->glXCreateContextAttribsARB(display, + framebuffer_config[0], + share_context, True, attribs); + X11_XFree(framebuffer_config); + } } } } @@ -791,13 +916,14 @@ X11_GL_GetSwapInterval(_THIS) } } -void +int X11_GL_SwapWindow(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; _this->gl_data->glXSwapBuffers(display, data->xwindow); + return 0; } void diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h index 86e77d7da..1a26ea099 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11opengl_h -#define _SDL_x11opengl_h +#ifndef SDL_x11opengl_h_ +#define SDL_x11opengl_h_ #if SDL_VIDEO_OPENGL_GLX #include "SDL_opengl.h" @@ -34,8 +34,18 @@ struct SDL_GLDriverData SDL_bool HAS_GLX_EXT_visual_rating; SDL_bool HAS_GLX_EXT_visual_info; SDL_bool HAS_GLX_EXT_swap_control_tear; - SDL_bool HAS_GLX_EXT_create_context_es2_profile; SDL_bool HAS_GLX_ARB_context_flush_control; + SDL_bool HAS_GLX_ARB_create_context_robustness; + SDL_bool HAS_GLX_ARB_create_context_no_error; + + /* Max version of OpenGL ES context that can be created if the + implementation supports GLX_EXT_create_context_es2_profile. + major = minor = 0 when unsupported. + */ + struct { + int major; + int minor; + } es_profile_max_supported_version; Bool (*glXQueryExtension) (Display*,int*,int*); void *(*glXGetProcAddress) (const GLubyte*); @@ -57,17 +67,18 @@ struct SDL_GLDriverData extern int X11_GL_LoadLibrary(_THIS, const char *path); extern void *X11_GL_GetProcAddress(_THIS, const char *proc); extern void X11_GL_UnloadLibrary(_THIS); +extern SDL_bool X11_GL_UseEGL(_THIS); extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen); extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window); extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int X11_GL_SetSwapInterval(_THIS, int interval); extern int X11_GL_GetSwapInterval(_THIS); -extern void X11_GL_SwapWindow(_THIS, SDL_Window * window); +extern int X11_GL_SwapWindow(_THIS, SDL_Window * window); extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_GLX */ -#endif /* _SDL_x11opengl_h */ +#endif /* SDL_x11opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c index 531172200..76b6cd788 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) #endif } - return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display); + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0); } XVisualInfo * diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h index 716e6e688..b189b7689 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11opengles_h -#define _SDL_x11opengles_h +#ifndef SDL_x11opengles_h_ +#define SDL_x11opengles_h_ #if SDL_VIDEO_OPENGL_EGL @@ -30,6 +30,9 @@ typedef struct SDL_PrivateGLESData { + /* 1401 If the struct-declaration-list contains no named members, the behavior is undefined. */ + /* warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat] */ + int dummy; } SDL_PrivateGLESData; /* OpenGLES functions */ @@ -43,11 +46,11 @@ typedef struct SDL_PrivateGLESData extern int X11_GLES_LoadLibrary(_THIS, const char *path); extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen); extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window); -extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int X11_GLES_SwapWindow(_THIS, SDL_Window * window); extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_x11opengles_h */ +#endif /* SDL_x11opengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11shape.c b/Engine/lib/sdl/src/video/x11/SDL_x11shape.c index 4f78ae899..4d68fe0ee 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11shape.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,11 +28,6 @@ #include "SDL_x11window.h" #include "../SDL_shape_internals.h" -SDL_Window* -X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { - return SDL_CreateWindow(title,x,y,w,h,flags); -} - SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) { SDL_WindowShaper* result = NULL; @@ -118,4 +113,3 @@ X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMo } #endif /* SDL_VIDEO_DRIVER_X11 */ - diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11shape.h b/Engine/lib/sdl/src/video/x11/SDL_x11shape.h index cd88ab70f..a8c2e2c94 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11shape.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11shape_h -#define _SDL_x11shape_h +#ifndef SDL_x11shape_h_ +#define SDL_x11shape_h_ #include "SDL_video.h" #include "SDL_shape.h" @@ -32,9 +32,8 @@ typedef struct { Uint32 bitmapsize; } SDL_ShapeData; -extern SDL_Window* X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); extern SDL_WindowShaper* X11_CreateShaper(SDL_Window* window); extern int X11_ResizeWindowShape(SDL_Window* window); extern int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); -#endif /* _SDL_x11shape_h */ +#endif /* SDL_x11shape_h_ */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h index 7290412b7..a07a0309c 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -179,6 +179,8 @@ SDL_X11_SYM(Status,XkbGetState,(Display* a,unsigned int b,XkbStatePtr c),(a,b,c) SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return) SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return) SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) +SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) +SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return) #endif #if NeedWidePrototypes @@ -290,6 +292,7 @@ SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(confi SDL_X11_SYM(void,XRRSetScreenSize,(Display *dpy, Window window,int width, int height,int mmWidth, int mmHeight),(dpy,window,width,height,mmWidth,mmHeight),) SDL_X11_SYM(Status,XRRGetScreenSizeRange,(Display *dpy, Window window,int *minWidth, int *minHeight, int *maxWidth, int *maxHeight),(dpy,window,minWidth,minHeight,maxWidth,maxHeight),return) SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResources,(Display *dpy, Window window),(dpy, window),return) +SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResourcesCurrent,(Display *dpy, Window window),(dpy, window),return) SDL_X11_SYM(void,XRRFreeScreenResources,(XRRScreenResources *resources),(resources),) SDL_X11_SYM(XRROutputInfo *,XRRGetOutputInfo,(Display *dpy, XRRScreenResources *resources, RROutput output),(dpy,resources,output),return) SDL_X11_SYM(void,XRRFreeOutputInfo,(XRROutputInfo *outputInfo),(outputInfo),) diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11touch.c b/Engine/lib/sdl/src/video/x11/SDL_x11touch.c index c19e80a67..2d0e73b8b 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11touch.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,6 +42,13 @@ X11_QuitTouch(_THIS) SDL_TouchQuit(); } +void +X11_ResetTouch(_THIS) +{ + X11_QuitTouch(_this); + X11_InitTouch(_this); +} + #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11touch.h b/Engine/lib/sdl/src/video/x11/SDL_x11touch.h index 7f8d18e1c..5a59af028 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11touch.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11touch_h -#define _SDL_x11touch_h +#ifndef SDL_x11touch_h_ +#define SDL_x11touch_h_ extern void X11_InitTouch(_THIS); extern void X11_QuitTouch(_THIS); +extern void X11_ResetTouch(_THIS); -#endif /* _SDL_x11touch_h */ +#endif /* SDL_x11touch_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11video.c b/Engine/lib/sdl/src/video/x11/SDL_x11video.c index 38b34de34..b8f8edff7 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11video.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_video.h" #include "SDL_mouse.h" +#include "SDL_timer.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" @@ -39,9 +40,7 @@ #include "SDL_x11opengles.h" #endif -#ifdef X_HAVE_UTF8_STRING -#include -#endif +#include "SDL_x11vulkan.h" /* Initialization/Query functions */ static int X11_VideoInit(_THIS); @@ -110,6 +109,9 @@ static void X11_DeleteDevice(SDL_VideoDevice * device) { SDL_VideoData *data = (SDL_VideoData *) device->driverdata; + if (device->vulkan_config.loader_handle) { + device->Vulkan_UnloadLibrary(device); + } if (data->display) { X11_XCloseDisplay(data->display); } @@ -190,8 +192,8 @@ X11_CreateDevice(int devindex) } */ data->display = X11_XOpenDisplay(display); -#if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC) - /* On Tru64 if linking without -lX11, it fails and you get following message. +#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC + /* On some systems if linking without -lX11, it fails and you get following message. * Xlib: connection to ":0.0" refused by server * Xlib: XDM authorization key matches an existing client! * @@ -220,6 +222,7 @@ X11_CreateDevice(int devindex) /* Set the function pointers */ device->VideoInit = X11_VideoInit; device->VideoQuit = X11_VideoQuit; + device->ResetTouch = X11_ResetTouch; device->GetDisplayModes = X11_GetDisplayModes; device->GetDisplayBounds = X11_GetDisplayBounds; device->GetDisplayUsableBounds = X11_GetDisplayUsableBounds; @@ -228,8 +231,8 @@ X11_CreateDevice(int devindex) device->SuspendScreenSaver = X11_SuspendScreenSaver; device->PumpEvents = X11_PumpEvents; - device->CreateWindow = X11_CreateWindow; - device->CreateWindowFrom = X11_CreateWindowFrom; + device->CreateSDLWindow = X11_CreateWindow; + device->CreateSDLWindowFrom = X11_CreateWindowFrom; device->SetWindowTitle = X11_SetWindowTitle; device->SetWindowIcon = X11_SetWindowIcon; device->SetWindowPosition = X11_SetWindowPosition; @@ -293,6 +296,13 @@ X11_CreateDevice(int devindex) device->free = X11_DeleteDevice; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface; +#endif + return device; } @@ -388,65 +398,6 @@ X11_VideoInit(_THIS) /* I have no idea how random this actually is, or has to be. */ data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this)); - /* Open a connection to the X input manager */ -#ifdef X_HAVE_UTF8_STRING - if (SDL_X11_HAVE_UTF8) { - /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that - Compose keys will work correctly. */ - char *prev_locale = setlocale(LC_ALL, NULL); - char *prev_xmods = X11_XSetLocaleModifiers(NULL); - const char *new_xmods = ""; -#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) - const char *env_xmods = SDL_getenv("XMODIFIERS"); -#endif - SDL_bool has_dbus_ime_support = SDL_FALSE; - - if (prev_locale) { - prev_locale = SDL_strdup(prev_locale); - } - - if (prev_xmods) { - prev_xmods = SDL_strdup(prev_xmods); - } - - /* IBus resends some key events that were filtered by XFilterEvents - when it is used via XIM which causes issues. Prevent this by forcing - @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via - the DBus implementation, which also has support for pre-editing. */ -#ifdef HAVE_IBUS_IBUS_H - if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) { - has_dbus_ime_support = SDL_TRUE; - } -#endif -#ifdef HAVE_FCITX_FRONTEND_H - if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) { - has_dbus_ime_support = SDL_TRUE; - } -#endif - if (has_dbus_ime_support) { - new_xmods = "@im=none"; - } - - setlocale(LC_ALL, ""); - X11_XSetLocaleModifiers(new_xmods); - - data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname); - - /* Reset the locale + X locale modifiers back to how they were, - locale first because the X locale modifiers depend on it. */ - setlocale(LC_ALL, prev_locale); - X11_XSetLocaleModifiers(prev_xmods); - - if (prev_locale) { - SDL_free(prev_locale); - } - - if (prev_xmods) { - SDL_free(prev_xmods); - } - } -#endif - /* Look up some useful Atoms */ #define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False) GET_ATOM(WM_PROTOCOLS); @@ -511,6 +462,10 @@ X11_VideoQuit(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + if (data->clipboard_window) { + X11_XDestroyWindow(data->display, data->clipboard_window); + } + SDL_free(data->classname); #ifdef X_HAVE_UTF8_STRING if (data->im) { @@ -523,6 +478,8 @@ X11_VideoQuit(_THIS) X11_QuitMouse(_this); X11_QuitTouch(_this); +/* !!! FIXME: other subsystems use D-Bus, so we shouldn't quit it here; + have SDL.c do this at a higher level, or add refcounting. */ #if SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11video.h b/Engine/lib/sdl/src/video/x11/SDL_x11video.h index a3324ff53..c0dc08efe 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11video.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11video_h -#define _SDL_x11video_h +#ifndef SDL_x11video_h_ +#define SDL_x11video_h_ #include "SDL_keycode.h" @@ -68,6 +68,7 @@ #include "SDL_x11mouse.h" #include "SDL_x11opengl.h" #include "SDL_x11window.h" +#include "SDL_x11vulkan.h" /* Private display data */ @@ -82,6 +83,7 @@ typedef struct SDL_VideoData SDL_WindowData **windowlist; int windowlistlength; XID window_group; + Window clipboard_window; /* This is true for ICCCM2.0-compliant window managers */ SDL_bool net_wm; @@ -124,6 +126,8 @@ typedef struct SDL_VideoData SDL_Scancode key_layout[256]; SDL_bool selection_waiting; + SDL_bool broken_pointer_grab; /* true if XGrabPointer seems unreliable. */ + Uint32 last_mode_change_deadline; SDL_bool global_mouse_changed; @@ -133,10 +137,20 @@ typedef struct SDL_VideoData #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM XkbDescPtr xkb; #endif + + KeyCode filter_code; + Time filter_time; + +#if SDL_VIDEO_VULKAN + /* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */ + void *vulkan_xlib_xcb_library; + PFN_XGetXCBConnection vulkan_XGetXCBConnection; +#endif + } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); -#endif /* _SDL_x11video_h */ +#endif /* SDL_x11video_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c new file mode 100644 index 000000000..ec43aef9b --- /dev/null +++ b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c @@ -0,0 +1,243 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 + +#include "SDL_x11video.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_x11vulkan.h" + +#include +/*#include */ +/* +typedef uint32_t xcb_window_t; +typedef uint32_t xcb_visualid_t; +*/ + +int X11_Vulkan_LoadLibrary(_THIS, const char *path) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasXlibSurfaceExtension = SDL_FALSE; + SDL_bool hasXCBSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + Uint32 i; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasXCBSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasXlibSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + if(hasXlibSurfaceExtension) + { + videoData->vulkan_xlib_xcb_library = NULL; + } + else if(!hasXCBSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement either the " + VK_KHR_XCB_SURFACE_EXTENSION_NAME "extension or the " + VK_KHR_XLIB_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else + { + const char *libX11XCBLibraryName = SDL_getenv("SDL_X11_XCB_LIBRARY"); + if(!libX11XCBLibraryName) + libX11XCBLibraryName = "libX11-xcb.so"; + videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName); + if(!videoData->vulkan_xlib_xcb_library) + goto fail; + videoData->vulkan_XGetXCBConnection = + SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection"); + if(!videoData->vulkan_XGetXCBConnection) + { + SDL_UnloadObject(videoData->vulkan_xlib_xcb_library); + goto fail; + } + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void X11_Vulkan_UnloadLibrary(_THIS) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + if(_this->vulkan_config.loader_handle) + { + if(videoData->vulkan_xlib_xcb_library) + SDL_UnloadObject(videoData->vulkan_xlib_xcb_library); + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + if(videoData->vulkan_xlib_xcb_library) + { + static const char *const extensionsForXCB[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_EXTENSION_NAME, + }; + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForXCB), extensionsForXCB); + } + else + { + static const char *const extensionsForXlib[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME, + }; + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForXlib), extensionsForXlib); + } +} + +SDL_bool X11_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + if(videoData->vulkan_xlib_xcb_library) + { + PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR = + (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance, + "vkCreateXcbSurfaceKHR"); + VkXcbSurfaceCreateInfoKHR createInfo; + VkResult result; + if(!vkCreateXcbSurfaceKHR) + { + SDL_SetError(VK_KHR_XCB_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; + createInfo.connection = videoData->vulkan_XGetXCBConnection(videoData->display); + if(!createInfo.connection) + { + SDL_SetError("XGetXCBConnection failed"); + return SDL_FALSE; + } + createInfo.window = (xcb_window_t)windowData->xwindow; + result = vkCreateXcbSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateXcbSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; + } + else + { + PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR = + (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance, + "vkCreateXlibSurfaceKHR"); + VkXlibSurfaceCreateInfoKHR createInfo; + VkResult result; + if(!vkCreateXlibSurfaceKHR) + { + SDL_SetError(VK_KHR_XLIB_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; + createInfo.dpy = videoData->display; + createInfo.window = (xcb_window_t)windowData->xwindow; + result = vkCreateXlibSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateXlibSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; + } +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h new file mode 100644 index 000000000..152d9d79e --- /dev/null +++ b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_x11vulkan_h_ +#define SDL_x11vulkan_h_ + +#include "../SDL_vulkan_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 + +/*typedef struct xcb_connection_t xcb_connection_t;*/ +typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy); + +int X11_Vulkan_LoadLibrary(_THIS, const char *path); +void X11_Vulkan_UnloadLibrary(_THIS); +SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool X11_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_x11vulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11window.c b/Engine/lib/sdl/src/video/x11/SDL_x11window.c index 668bce225..be03aa6de 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11window.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,11 +40,10 @@ #include "SDL_timer.h" #include "SDL_syswm.h" -#include "SDL_assert.h" +#include "SDL_log.h" #define _NET_WM_STATE_REMOVE 0l #define _NET_WM_STATE_ADD 1l -#define _NET_WM_STATE_TOGGLE 2l static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win) { @@ -226,6 +225,19 @@ X11_GetNetWMState(_THIS, Window xwindow) if (fullscreen == 1) { flags |= SDL_WINDOW_FULLSCREEN; } + + /* If the window is unmapped, numItems will be zero and _NET_WM_STATE_HIDDEN + * will not be set. Do an additional check to see if the window is unmapped + * and mark it as SDL_WINDOW_HIDDEN if it is. + */ + { + XWindowAttributes attr; + SDL_memset(&attr,0,sizeof(attr)); + X11_XGetWindowAttributes(videodata->display, xwindow, &attr); + if (attr.map_state == IsUnmapped) { + flags |= SDL_WINDOW_HIDDEN; + } + } X11_XFree(propertyValue); } @@ -376,7 +388,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) Atom _NET_WM_WINDOW_TYPE; Atom wintype; const char *wintype_name = NULL; - int compositor = 1; + long compositor = 1; Atom _NET_WM_PID; Atom XdndAware, xdnd_version = 5; long fevent = 0; @@ -389,7 +401,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) #if SDL_VIDEO_OPENGL_EGL if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES #if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) + && ( !_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { vinfo = X11_GLES_GetVisual(_this, display, screen); @@ -567,11 +579,12 @@ X11_CreateWindow(_THIS, SDL_Window * window) wintype = X11_XInternAtom(display, wintype_name, False); X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wintype, 1); - - _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); - X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, - PropModeReplace, - (unsigned char *)&compositor, 1); + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, SDL_TRUE)) { + _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); + X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, + PropModeReplace, + (unsigned char *)&compositor, 1); + } { Atom protocols[3]; @@ -600,7 +613,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) if ((window->flags & SDL_WINDOW_OPENGL) && _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES #if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) + && ( !_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { #if SDL_VIDEO_OPENGL_EGL @@ -617,7 +630,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } #else - return SDL_SetError("Could not create GLES window surface (no EGL support available)"); + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); #endif /* SDL_VIDEO_OPENGL_EGL */ } #endif @@ -1029,7 +1042,8 @@ X11_ShowWindow(_THIS, SDL_Window * window) /* Blocking wait for "MapNotify" event. * We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type, * and XCheckTypedWindowEvent doesn't block */ - X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); + if(!(window->flags & SDL_WINDOW_FOREIGN)) + X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); X11_XFlush(display); } @@ -1051,7 +1065,8 @@ X11_HideWindow(_THIS, SDL_Window * window) if (X11_IsWindowMapped(_this, window)) { X11_XWithdrawWindow(display, data->xwindow, displaydata->screen); /* Blocking wait for "UnmapNotify" event */ - X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); + if(!(window->flags & SDL_WINDOW_FOREIGN)) + X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); X11_XFlush(display); } } @@ -1484,14 +1499,25 @@ X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) if (oldstyle_fullscreen || grabbed) { /* Try to grab the mouse */ - for (;;) { - int result = - X11_XGrabPointer(display, data->xwindow, True, 0, GrabModeAsync, - GrabModeAsync, data->xwindow, None, CurrentTime); - if (result == GrabSuccess) { - break; + if (!data->videodata->broken_pointer_grab) { + const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask; + int attempts; + int result; + + /* Try for up to 5000ms (5s) to grab. If it still fails, stop trying. */ + for (attempts = 0; attempts < 100; attempts++) { + result = X11_XGrabPointer(display, data->xwindow, True, mask, GrabModeAsync, + GrabModeAsync, data->xwindow, None, CurrentTime); + if (result == GrabSuccess) { + break; + } + SDL_Delay(50); + } + + if (result != GrabSuccess) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "The X server refused to let us grab the mouse. You might experience input bugs."); + data->videodata->broken_pointer_grab = SDL_TRUE; /* don't try again. */ } - SDL_Delay(50); } /* Raise the window if we grab the mouse */ @@ -1566,7 +1592,7 @@ X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.x11.window = data->xwindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11window.h b/Engine/lib/sdl/src/video/x11/SDL_x11window.h index 50a739dad..7c4c6c5e5 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11window.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11window_h -#define _SDL_x11window_h +#ifndef SDL_x11window_h_ +#define SDL_x11window_h_ /* We need to queue the focus in/out changes because they may occur during video mode changes and we can respond to them by triggering more mode @@ -105,6 +105,6 @@ extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_x11window_h */ +#endif /* SDL_x11window_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c index bed4234f0..06a8937cf 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,6 +73,35 @@ xinput2_version_atleast(const int version, const int wantmajor, const int wantmi { return ( version >= ((wantmajor * 1000) + wantminor) ); } + +#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +static void +xinput2_normalize_touch_coordinates(SDL_VideoData *videodata, Window window, + double in_x, double in_y, float *out_x, float *out_y) +{ + int i; + for (i = 0; i < videodata->numwindows; i++) { + SDL_WindowData *d = videodata->windowlist[i]; + if (d->xwindow == window) { + if (d->window->w == 1) { + *out_x = 0.5f; + } else { + *out_x = in_x / (d->window->w - 1); + } + if (d->window->h == 1) { + *out_y = 0.5f; + } else { + *out_y = in_y / (d->window->h - 1); + } + return; + } + } + // couldn't find the window... + *out_x = in_x; + *out_y = in_y; +} +#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ + #endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */ void @@ -171,22 +200,28 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouch(xev->sourceid,xev->detail, - SDL_TRUE, xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouch(xev->sourceid,xev->detail, SDL_TRUE, x, y, 1.0); return 1; } break; case XI_TouchEnd: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouch(xev->sourceid,xev->detail, - SDL_FALSE, xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouch(xev->sourceid,xev->detail, SDL_FALSE, x, y, 1.0); return 1; } break; case XI_TouchUpdate: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouchMotion(xev->sourceid,xev->detail, - xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouchMotion(xev->sourceid,xev->detail, x, y, 1.0); return 1; } break; diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h index ed8dd1a4a..4780fbb93 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11xinput2_h -#define _SDL_x11xinput2_h +#ifndef SDL_x11xinput2_h_ +#define SDL_x11xinput2_h_ #ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS /* Define XGenericEventCookie as forward declaration when @@ -37,6 +37,6 @@ extern int X11_Xinput2IsInitialized(void); extern int X11_Xinput2IsMultitouchSupported(void); extern void X11_Xinput2SelectTouch(_THIS, SDL_Window *window); -#endif /* _SDL_x11xinput2_h */ +#endif /* SDL_x11xinput2_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/edid-parse.c b/Engine/lib/sdl/src/video/x11/edid-parse.c index 57f225b85..e22324f2c 100644 --- a/Engine/lib/sdl/src/video/x11/edid-parse.c +++ b/Engine/lib/sdl/src/video/x11/edid-parse.c @@ -140,14 +140,14 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) }; bits = get_bits (edid[0x14], 4, 6); - info->digital.bits_per_primary = bit_depth[bits]; + info->ad.digital.bits_per_primary = bit_depth[bits]; bits = get_bits (edid[0x14], 0, 3); if (bits <= 5) - info->digital.interface = interfaces[bits]; + info->ad.digital.interface = interfaces[bits]; else - info->digital.interface = UNDEFINED; + info->ad.digital.interface = UNDEFINED; } else { @@ -161,17 +161,17 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) { 0.7, 0.0, 0.7 }, }; - info->analog.video_signal_level = levels[bits][0]; - info->analog.sync_signal_level = levels[bits][1]; - info->analog.total_signal_level = levels[bits][2]; + info->ad.analog.video_signal_level = levels[bits][0]; + info->ad.analog.sync_signal_level = levels[bits][1]; + info->ad.analog.total_signal_level = levels[bits][2]; - info->analog.blank_to_black = get_bit (edid[0x14], 4); + info->ad.analog.blank_to_black = get_bit (edid[0x14], 4); - info->analog.separate_hv_sync = get_bit (edid[0x14], 3); - info->analog.composite_sync_on_h = get_bit (edid[0x14], 2); - info->analog.composite_sync_on_green = get_bit (edid[0x14], 1); + info->ad.analog.separate_hv_sync = get_bit (edid[0x14], 3); + info->ad.analog.composite_sync_on_h = get_bit (edid[0x14], 2); + info->ad.analog.composite_sync_on_green = get_bit (edid[0x14], 1); - info->analog.serration_on_vsync = get_bit (edid[0x14], 0); + info->ad.analog.serration_on_vsync = get_bit (edid[0x14], 0); } /* Screen Size / Aspect Ratio */ @@ -213,11 +213,11 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) if (info->is_digital) { - info->digital.rgb444 = TRUE; + info->ad.digital.rgb444 = TRUE; if (get_bit (edid[0x18], 3)) - info->digital.ycrcb444 = 1; + info->ad.digital.ycrcb444 = 1; if (get_bit (edid[0x18], 4)) - info->digital.ycrcb422 = 1; + info->ad.digital.ycrcb422 = 1; } else { @@ -227,7 +227,7 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR }; - info->analog.color_type = color_type[bits]; + info->ad.analog.color_type = color_type[bits]; } info->srgb_is_standard = get_bit (edid[0x18], 2); @@ -455,26 +455,26 @@ decode_detailed_timing (const uchar *timing, detailed->digital_sync = get_bit (bits, 4); if (detailed->digital_sync) { - detailed->digital.composite = !get_bit (bits, 3); + detailed->ad.digital.composite = !get_bit (bits, 3); - if (detailed->digital.composite) + if (detailed->ad.digital.composite) { - detailed->digital.serrations = get_bit (bits, 2); - detailed->digital.negative_vsync = FALSE; + detailed->ad.digital.serrations = get_bit (bits, 2); + detailed->ad.digital.negative_vsync = FALSE; } else { - detailed->digital.serrations = FALSE; - detailed->digital.negative_vsync = !get_bit (bits, 2); + detailed->ad.digital.serrations = FALSE; + detailed->ad.digital.negative_vsync = !get_bit (bits, 2); } - detailed->digital.negative_hsync = !get_bit (bits, 0); + detailed->ad.digital.negative_hsync = !get_bit (bits, 0); } else { - detailed->analog.bipolar = get_bit (bits, 3); - detailed->analog.serrations = get_bit (bits, 2); - detailed->analog.sync_on_green = !get_bit (bits, 1); + detailed->ad.analog.bipolar = get_bit (bits, 3); + detailed->ad.analog.serrations = get_bit (bits, 2); + detailed->ad.analog.sync_on_green = !get_bit (bits, 1); } } @@ -579,12 +579,12 @@ dump_monitor_info (MonitorInfo *info) if (info->is_digital) { const char *interface; - if (info->digital.bits_per_primary != -1) - printf ("Bits Per Primary: %d\n", info->digital.bits_per_primary); + if (info->ad.digital.bits_per_primary != -1) + printf ("Bits Per Primary: %d\n", info->ad.digital.bits_per_primary); else printf ("Bits Per Primary: undefined\n"); - switch (info->digital.interface) + switch (info->ad.digital.interface) { case DVI: interface = "DVI"; break; case HDMI_A: interface = "HDMI-a"; break; @@ -596,27 +596,27 @@ dump_monitor_info (MonitorInfo *info) } printf ("Interface: %s\n", interface); - printf ("RGB 4:4:4: %s\n", yesno (info->digital.rgb444)); - printf ("YCrCb 4:4:4: %s\n", yesno (info->digital.ycrcb444)); - printf ("YCrCb 4:2:2: %s\n", yesno (info->digital.ycrcb422)); + printf ("RGB 4:4:4: %s\n", yesno (info->ad.digital.rgb444)); + printf ("YCrCb 4:4:4: %s\n", yesno (info->ad.digital.ycrcb444)); + printf ("YCrCb 4:2:2: %s\n", yesno (info->ad.digital.ycrcb422)); } else { const char *s; - printf ("Video Signal Level: %f\n", info->analog.video_signal_level); - printf ("Sync Signal Level: %f\n", info->analog.sync_signal_level); - printf ("Total Signal Level: %f\n", info->analog.total_signal_level); + printf ("Video Signal Level: %f\n", info->ad.analog.video_signal_level); + printf ("Sync Signal Level: %f\n", info->ad.analog.sync_signal_level); + printf ("Total Signal Level: %f\n", info->ad.analog.total_signal_level); printf ("Blank to Black: %s\n", - yesno (info->analog.blank_to_black)); + yesno (info->ad.analog.blank_to_black)); printf ("Separate HV Sync: %s\n", - yesno (info->analog.separate_hv_sync)); + yesno (info->ad.analog.separate_hv_sync)); printf ("Composite Sync on H: %s\n", - yesno (info->analog.composite_sync_on_h)); + yesno (info->ad.analog.composite_sync_on_h)); printf ("Serration on VSync: %s\n", - yesno (info->analog.serration_on_vsync)); + yesno (info->ad.analog.serration_on_vsync)); - switch (info->analog.color_type) + switch (info->ad.analog.color_type) { case UNDEFINED_COLOR: s = "undefined"; break; case MONOCHROME: s = "monochrome"; break; @@ -729,20 +729,20 @@ dump_monitor_info (MonitorInfo *info) if (timing->digital_sync) { printf (" Digital Sync:\n"); - printf (" composite: %s\n", yesno (timing->digital.composite)); - printf (" serrations: %s\n", yesno (timing->digital.serrations)); + printf (" composite: %s\n", yesno (timing->ad.digital.composite)); + printf (" serrations: %s\n", yesno (timing->ad.digital.serrations)); printf (" negative vsync: %s\n", - yesno (timing->digital.negative_vsync)); + yesno (timing->ad.digital.negative_vsync)); printf (" negative hsync: %s\n", - yesno (timing->digital.negative_hsync)); + yesno (timing->ad.digital.negative_hsync)); } else { printf (" Analog Sync:\n"); - printf (" bipolar: %s\n", yesno (timing->analog.bipolar)); - printf (" serrations: %s\n", yesno (timing->analog.serrations)); + printf (" bipolar: %s\n", yesno (timing->ad.analog.bipolar)); + printf (" serrations: %s\n", yesno (timing->ad.analog.serrations)); printf (" sync on green: %s\n", yesno ( - timing->analog.sync_on_green)); + timing->ad.analog.sync_on_green)); } } diff --git a/Engine/lib/sdl/src/video/x11/edid.h b/Engine/lib/sdl/src/video/x11/edid.h index 8c217eba2..cb9f0e87e 100644 --- a/Engine/lib/sdl/src/video/x11/edid.h +++ b/Engine/lib/sdl/src/video/x11/edid.h @@ -74,7 +74,7 @@ struct DetailedTiming int negative_vsync; int negative_hsync; } digital; - }; + } ad; }; struct MonitorInfo @@ -118,7 +118,7 @@ struct MonitorInfo int serration_on_vsync; ColorType color_type; } analog; - }; + } ad; int width_mm; /* -1 if not specified */ int height_mm; /* -1 if not specified */ diff --git a/Engine/lib/sdl/src/video/yuv2rgb/LICENSE b/Engine/lib/sdl/src/video/yuv2rgb/LICENSE new file mode 100644 index 000000000..a76efd7be --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2016, Adrien Descamps +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 yuv2rgb 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 HOLDER 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. diff --git a/Engine/lib/sdl/src/video/yuv2rgb/README.md b/Engine/lib/sdl/src/video/yuv2rgb/README.md new file mode 100644 index 000000000..21191e979 --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/README.md @@ -0,0 +1,63 @@ +From: https://github.com/descampsa/yuv2rgb +# yuv2rgb +C library for fast image conversion between yuv420p and rgb24. + +This is a simple library for optimized image conversion between YUV420p and rgb24. +It was done mainly as an exercise to learn to use sse intrinsics, so there may still be room for optimization. + +For each conversion, a standard c optimized function and two sse function (with aligned and unaligned memory) are implemented. +The sse version requires only SSE2, which is available on any reasonably recent CPU. +The library also supports the three different YUV (YCrCb to be correct) color spaces that exist (see comments in code), and others can be added simply. + +There is a simple test program, that convert a raw YUV file to rgb ppm format, and measure computation time. +Optionally, it also compares the result and computation time with the ffmpeg implementation (that uses MMX), and with the IPP functions. + +To compile, simply do : + + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make + +The test program only support raw YUV files for the YUV420 format, and ppm for the RGB24 format. +To generate a raw yuv file, you can use avconv: + + avconv -i example.jpg -c:v rawvideo -pix_fmt yuv420p example.yuv + +To generate the rgb file, you can use the ImageMagick convert program: + + convert example.jpg example.ppm + +Then, for YUV420 to RGB24 conversion, use the test program like that: + + ./test_yuv_rgb yuv2rgb image.yuv 4096 2160 image + +The second and third parameters are image width and height (that are needed because not available in the raw YUV file), and fourth parameter is the output filename template (several output files will be generated, named for example output_sse.ppm, output_av.ppm, etc.) + +Similarly, for RGB24 to YUV420 conversion: + + ./test_yuv_rgb yuv2rgb image.ppm image + +On my computer, the test program on a 4K image give the following for yuv2rgb: + + Time will be measured in each configuration for 100 iterations... + Processing time (std) : 2.630193 sec + Processing time (sse2_unaligned) : 0.704394 sec + Processing time (ffmpeg_unaligned) : 1.221432 sec + Processing time (ipp_unaligned) : 0.636274 sec + Processing time (sse2_aligned) : 0.606648 sec + Processing time (ffmpeg_aligned) : 1.227100 sec + Processing time (ipp_aligned) : 0.636951 sec + +And for rgb2yuv: + + Time will be measured in each configuration for 100 iterations... + Processing time (std) : 2.588675 sec + Processing time (sse2_unaligned) : 0.676625 sec + Processing time (ffmpeg_unaligned) : 3.385816 sec + Processing time (ipp_unaligned) : 0.593890 sec + Processing time (sse2_aligned) : 0.640630 sec + Processing time (ffmpeg_aligned) : 3.397952 sec + Processing time (ipp_aligned) : 0.579043 sec + +configuration : gcc 4.9.2, swscale 3.0.0, IPP 9.0.1, intel i7-5500U diff --git a/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c new file mode 100644 index 000000000..891dae229 --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c @@ -0,0 +1,687 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License +#include "../../SDL_internal.h" + +#include "yuv_rgb.h" + +#include "SDL_cpuinfo.h" +/*#include */ + +#define PRECISION 6 +#define PRECISION_FACTOR (1<[0-255]) +// for ITU-R BT.709-6 values are derived from equations in sections 3.2-3.4, assuming RGB is encoded using full range ([0-1]<->[0-255]) +// all values are rounded to the fourth decimal + +static const YUV2RGBParam YUV2RGB[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.y_factor=*/ V(1.0), /*.v_r_factor=*/ V(1.402), /*.u_g_factor=*/ -V(0.3441), /*.v_g_factor=*/ -V(0.7141), /*.u_b_factor=*/ V(1.772)}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.596), /*.u_g_factor=*/ -V(0.3918), /*.v_g_factor=*/ -V(0.813), /*.u_b_factor=*/ V(2.0172)}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.7927), /*.u_g_factor=*/ -V(0.2132), /*.v_g_factor=*/ -V(0.5329), /*.u_b_factor=*/ V(2.1124)} +}; + +static const RGB2YUVParam RGB2YUV[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.matrix=*/ {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}} +}; + +/* The various layouts of YUV data we support */ +#define YUV_FORMAT_420 1 +#define YUV_FORMAT_422 2 +#define YUV_FORMAT_NV12 3 + +/* The various formats of RGB pixel that we support */ +#define RGB_FORMAT_RGB565 1 +#define RGB_FORMAT_RGB24 2 +#define RGB_FORMAT_RGBA 3 +#define RGB_FORMAT_BGRA 4 +#define RGB_FORMAT_ARGB 5 +#define RGB_FORMAT_ABGR 6 + +// divide by PRECISION_FACTOR and clamp to [0:255] interval +// input must be in the [-128*PRECISION_FACTOR:384*PRECISION_FACTOR] range +static uint8_t clampU8(int32_t v) +{ + static const uint8_t lut[512] = + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, + 47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90, + 91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, + 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, + 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224, + 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 + }; + return lut[(v+128*PRECISION_FACTOR)>>PRECISION]; +} + + +#define STD_FUNCTION_NAME yuv420_rgb565_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgb24_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgba_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_bgra_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_argb_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_abgr_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb565_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb24_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgba_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_bgra_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_argb_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_abgr_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb565_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb24_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgba_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_bgra_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_argb_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_abgr_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *RGB, uint32_t RGB_stride, + uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + YCbCrType yuv_type) +{ + const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]); + + uint32_t x, y; + for(y=0; y<(height-1); y+=2) + { + const uint8_t *rgb_ptr1=RGB+y*RGB_stride, + *rgb_ptr2=RGB+(y+1)*RGB_stride; + + uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, + *u_ptr=U+(y/2)*UV_stride, + *v_ptr=V+(y/2)*UV_stride; + + for(x=0; x<(width-1); x+=2) + { + // compute yuv for the four pixels, u and v values are summed + int32_t y_tmp, u_tmp, v_tmp; + + y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2]; + u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2]; + v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2]; + y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5]; + u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5]; + v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5]; + y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2]; + u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2]; + v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2]; + y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5]; + u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5]; + v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5]; + y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[0][1]))); \ +Y = _mm_add_epi16(Y, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[0][2]))); \ +Y = _mm_add_epi16(Y, _mm_set1_epi16((param->y_shift)<matrix[1][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[1][1]))); \ +U = _mm_add_epi16(U, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[1][2]))); \ +U = _mm_add_epi16(U, _mm_set1_epi16(128<matrix[2][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[2][1]))); \ +V = _mm_add_epi16(V, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[2][2]))); \ +V = _mm_add_epi16(V, _mm_set1_epi16(128<*/ + +typedef enum +{ + YCBCR_JPEG, + YCBCR_601, + YCBCR_709 +} YCbCrType; + +// yuv to rgb, standard c implementation +void yuv420_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers must be 16 byte aligned, and strides must be divisable by 16 +void yuv420_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers do not need to be 16 byte aligned +void yuv420_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + + +// rgb to yuv, standard c implementation +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers must be 16 byte aligned, and strides must be divisible by 16 +void rgb24_yuv420_sse( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers do not need to be 16 byte aligned +void rgb24_yuv420_sseu( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + diff --git a/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h new file mode 100644 index 000000000..f81140e18 --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h @@ -0,0 +1,498 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +/* You need to define the following macros before including this file: + SSE_FUNCTION_NAME + STD_FUNCTION_NAME + YUV_FORMAT + RGB_FORMAT +*/ +/* You may define the following macro, which affects generated code: + SSE_ALIGNED +*/ + +#ifdef SSE_ALIGNED +/* Unaligned instructions seem faster, even on aligned data? */ +/* +#define LOAD_SI128 _mm_load_si128 +#define SAVE_SI128 _mm_stream_si128 +*/ +#define LOAD_SI128 _mm_loadu_si128 +#define SAVE_SI128 _mm_storeu_si128 +#else +#define LOAD_SI128 _mm_loadu_si128 +#define SAVE_SI128 _mm_storeu_si128 +#endif + +#define UV2RGB_16(U,V,R1,G1,B1,R2,G2,B2) \ + r_tmp = _mm_mullo_epi16(V, _mm_set1_epi16(param->v_r_factor)); \ + g_tmp = _mm_add_epi16( \ + _mm_mullo_epi16(U, _mm_set1_epi16(param->u_g_factor)), \ + _mm_mullo_epi16(V, _mm_set1_epi16(param->v_g_factor))); \ + b_tmp = _mm_mullo_epi16(U, _mm_set1_epi16(param->u_b_factor)); \ + R1 = _mm_unpacklo_epi16(r_tmp, r_tmp); \ + G1 = _mm_unpacklo_epi16(g_tmp, g_tmp); \ + B1 = _mm_unpacklo_epi16(b_tmp, b_tmp); \ + R2 = _mm_unpackhi_epi16(r_tmp, r_tmp); \ + G2 = _mm_unpackhi_epi16(g_tmp, g_tmp); \ + B2 = _mm_unpackhi_epi16(b_tmp, b_tmp); \ + +#define ADD_Y2RGB_16(Y1,Y2,R1,G1,B1,R2,G2,B2) \ + Y1 = _mm_mullo_epi16(_mm_sub_epi16(Y1, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \ + Y2 = _mm_mullo_epi16(_mm_sub_epi16(Y2, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \ + \ + R1 = _mm_srai_epi16(_mm_add_epi16(R1, Y1), PRECISION); \ + G1 = _mm_srai_epi16(_mm_add_epi16(G1, Y1), PRECISION); \ + B1 = _mm_srai_epi16(_mm_add_epi16(B1, Y1), PRECISION); \ + R2 = _mm_srai_epi16(_mm_add_epi16(R2, Y2), PRECISION); \ + G2 = _mm_srai_epi16(_mm_add_epi16(G2, Y2), PRECISION); \ + B2 = _mm_srai_epi16(_mm_add_epi16(B2, Y2), PRECISION); \ + +#define PACK_RGB565_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4) \ +{ \ + __m128i red_mask, tmp1, tmp2, tmp3, tmp4; \ +\ + red_mask = _mm_set1_epi16((short)0xF800); \ + RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \ + RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \ + RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \ + RGB4 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R2), red_mask); \ + tmp1 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G1, _mm_setzero_si128()), 2), 5); \ + tmp2 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G1, _mm_setzero_si128()), 2), 5); \ + tmp3 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G2, _mm_setzero_si128()), 2), 5); \ + tmp4 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G2, _mm_setzero_si128()), 2), 5); \ + RGB1 = _mm_or_si128(RGB1, tmp1); \ + RGB2 = _mm_or_si128(RGB2, tmp2); \ + RGB3 = _mm_or_si128(RGB3, tmp3); \ + RGB4 = _mm_or_si128(RGB4, tmp4); \ + tmp1 = _mm_srli_epi16(_mm_unpacklo_epi8(B1, _mm_setzero_si128()), 3); \ + tmp2 = _mm_srli_epi16(_mm_unpackhi_epi8(B1, _mm_setzero_si128()), 3); \ + tmp3 = _mm_srli_epi16(_mm_unpacklo_epi8(B2, _mm_setzero_si128()), 3); \ + tmp4 = _mm_srli_epi16(_mm_unpackhi_epi8(B2, _mm_setzero_si128()), 3); \ + RGB1 = _mm_or_si128(RGB1, tmp1); \ + RGB2 = _mm_or_si128(RGB2, tmp2); \ + RGB3 = _mm_or_si128(RGB3, tmp3); \ + RGB4 = _mm_or_si128(RGB4, tmp4); \ +} + +#define PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +RGB1 = _mm_packus_epi16(_mm_and_si128(R1,_mm_set1_epi16(0xFF)), _mm_and_si128(R2,_mm_set1_epi16(0xFF))); \ +RGB2 = _mm_packus_epi16(_mm_and_si128(G1,_mm_set1_epi16(0xFF)), _mm_and_si128(G2,_mm_set1_epi16(0xFF))); \ +RGB3 = _mm_packus_epi16(_mm_and_si128(B1,_mm_set1_epi16(0xFF)), _mm_and_si128(B2,_mm_set1_epi16(0xFF))); \ +RGB4 = _mm_packus_epi16(_mm_srli_epi16(R1,8), _mm_srli_epi16(R2,8)); \ +RGB5 = _mm_packus_epi16(_mm_srli_epi16(G1,8), _mm_srli_epi16(G2,8)); \ +RGB6 = _mm_packus_epi16(_mm_srli_epi16(B1,8), _mm_srli_epi16(B2,8)); \ + +#define PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +R1 = _mm_packus_epi16(_mm_and_si128(RGB1,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB2,_mm_set1_epi16(0xFF))); \ +R2 = _mm_packus_epi16(_mm_and_si128(RGB3,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB4,_mm_set1_epi16(0xFF))); \ +G1 = _mm_packus_epi16(_mm_and_si128(RGB5,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB6,_mm_set1_epi16(0xFF))); \ +G2 = _mm_packus_epi16(_mm_srli_epi16(RGB1,8), _mm_srli_epi16(RGB2,8)); \ +B1 = _mm_packus_epi16(_mm_srli_epi16(RGB3,8), _mm_srli_epi16(RGB4,8)); \ +B2 = _mm_packus_epi16(_mm_srli_epi16(RGB5,8), _mm_srli_epi16(RGB6,8)); \ + +#define PACK_RGB24_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ + +#define PACK_RGBA_32(R1, R2, G1, G2, B1, B2, A1, A2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, RGB7, RGB8) \ +{ \ + __m128i lo_ab, hi_ab, lo_gr, hi_gr; \ +\ + lo_ab = _mm_unpacklo_epi8( A1, B1 ); \ + hi_ab = _mm_unpackhi_epi8( A1, B1 ); \ + lo_gr = _mm_unpacklo_epi8( G1, R1 ); \ + hi_gr = _mm_unpackhi_epi8( G1, R1 ); \ + RGB1 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \ + RGB2 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \ + RGB3 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \ + RGB4 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \ +\ + lo_ab = _mm_unpacklo_epi8( A2, B2 ); \ + hi_ab = _mm_unpackhi_epi8( A2, B2 ); \ + lo_gr = _mm_unpacklo_epi8( G2, R2 ); \ + hi_gr = _mm_unpackhi_epi8( G2, R2 ); \ + RGB5 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \ + RGB6 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \ + RGB7 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \ + RGB8 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \ +} + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + \ + PACK_RGB565_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4) \ + \ + PACK_RGB565_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_5, rgb_6, rgb_7, rgb_8) \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6; \ + __m128i rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12; \ + \ + PACK_RGB24_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6) \ + \ + PACK_RGB24_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12) \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_BGRA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ARGB + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(a, a, r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ABGR + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(a, a, b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#else +#error PACK_PIXEL unimplemented +#endif + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_6); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_8); \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_8); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_9); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_10); \ + SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_11); \ + SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_12); \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \ + SAVE_SI128((__m128i*)(rgb_ptr1+96), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr1+112), rgb_8); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_9); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_10); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_11); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_12); \ + SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_13); \ + SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_14); \ + SAVE_SI128((__m128i*)(rgb_ptr2+96), rgb_15); \ + SAVE_SI128((__m128i*)(rgb_ptr2+112), rgb_16); \ + +#else +#error SAVE_LINE unimplemented +#endif + +#if YUV_FORMAT == YUV_FORMAT_420 + +#define READ_Y(y_ptr) \ + y = LOAD_SI128((const __m128i*)(y_ptr)); \ + +#define READ_UV \ + u = LOAD_SI128((const __m128i*)(u_ptr)); \ + v = LOAD_SI128((const __m128i*)(v_ptr)); \ + +#elif YUV_FORMAT == YUV_FORMAT_422 + +#define READ_Y(y_ptr) \ +{ \ + __m128i y1, y2; \ + y1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr)), 8), 8); \ + y2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr+16)), 8), 8); \ + y = _mm_packus_epi16(y1, y2); \ +} + +#define READ_UV \ +{ \ + __m128i u1, u2, u3, u4, v1, v2, v3, v4; \ + u1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr)), 24), 24); \ + u2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+16)), 24), 24); \ + u3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+32)), 24), 24); \ + u4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+48)), 24), 24); \ + u = _mm_packus_epi16(_mm_packs_epi32(u1, u2), _mm_packs_epi32(u3, u4)); \ + v1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr)), 24), 24); \ + v2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+16)), 24), 24); \ + v3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+32)), 24), 24); \ + v4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+48)), 24), 24); \ + v = _mm_packus_epi16(_mm_packs_epi32(v1, v2), _mm_packs_epi32(v3, v4)); \ +} + +#elif YUV_FORMAT == YUV_FORMAT_NV12 + +#define READ_Y(y_ptr) \ + y = LOAD_SI128((const __m128i*)(y_ptr)); \ + +#define READ_UV \ +{ \ + __m128i u1, u2, v1, v2; \ + u1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr)), 8), 8); \ + u2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr+16)), 8), 8); \ + u = _mm_packus_epi16(u1, u2); \ + v1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr)), 8), 8); \ + v2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr+16)), 8), 8); \ + v = _mm_packus_epi16(v1, v2); \ +} + +#else +#error READ_UV unimplemented +#endif + +#define YUV2RGB_32 \ + __m128i r_tmp, g_tmp, b_tmp; \ + __m128i r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2; \ + __m128i r_uv_16_1, g_uv_16_1, b_uv_16_1, r_uv_16_2, g_uv_16_2, b_uv_16_2; \ + __m128i y_16_1, y_16_2; \ + __m128i y, u, v, u_16, v_16; \ + __m128i r_8_11, g_8_11, b_8_11, r_8_21, g_8_21, b_8_21; \ + __m128i r_8_12, g_8_12, b_8_12, r_8_22, g_8_22, b_8_22; \ + \ + READ_UV \ + \ + /* process first 16 pixels of first line */\ + u_16 = _mm_unpacklo_epi8(u, _mm_setzero_si128()); \ + v_16 = _mm_unpacklo_epi8(v, _mm_setzero_si128()); \ + u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \ + v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \ + \ + UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \ + r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \ + \ + READ_Y(y_ptr1) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_11 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_11 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_11 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process first 16 pixels of second line */\ + r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \ + r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \ + \ + READ_Y(y_ptr2) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_21 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_21 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_21 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process last 16 pixels of first line */\ + u_16 = _mm_unpackhi_epi8(u, _mm_setzero_si128()); \ + v_16 = _mm_unpackhi_epi8(v, _mm_setzero_si128()); \ + u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \ + v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \ + \ + UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \ + r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \ + \ + READ_Y(y_ptr1+16*y_pixel_stride) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_12 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_12 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_12 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process last 16 pixels of second line */\ + r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \ + r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \ + \ + READ_Y(y_ptr2+16*y_pixel_stride) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_22 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_22 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_22 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + + +void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, + const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + uint8_t *RGB, uint32_t RGB_stride, + YCbCrType yuv_type) +{ + const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); +#if YUV_FORMAT == YUV_FORMAT_420 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 1; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#elif YUV_FORMAT == YUV_FORMAT_422 + const int y_pixel_stride = 2; + const int uv_pixel_stride = 4; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 1; +#elif YUV_FORMAT == YUV_FORMAT_NV12 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 2; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#endif +#if RGB_FORMAT == RGB_FORMAT_RGB565 + const int rgb_pixel_stride = 2; +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + const int rgb_pixel_stride = 3; +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR + const int rgb_pixel_stride = 4; +#else +#error Unknown RGB pixel size +#endif + + if (width >= 32) { + uint32_t xpos, ypos; + for(ypos=0; ypos<(height-(uv_y_sample_interval-1)); ypos+=uv_y_sample_interval) + { + const uint8_t *y_ptr1=Y+ypos*Y_stride, + *y_ptr2=Y+(ypos+1)*Y_stride, + *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+ypos*RGB_stride, + *rgb_ptr2=RGB+(ypos+1)*RGB_stride; + + for(xpos=0; xpos<(width-31); xpos+=32) + { + YUV2RGB_32 + { + PACK_PIXEL + SAVE_LINE1 + if (uv_y_sample_interval > 1) + { + SAVE_LINE2 + } + } + + y_ptr1+=32*y_pixel_stride; + y_ptr2+=32*y_pixel_stride; + u_ptr+=32*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=32*uv_pixel_stride/uv_x_sample_interval; + rgb_ptr1+=32*rgb_pixel_stride; + rgb_ptr2+=32*rgb_pixel_stride; + } + } + + /* Catch the last line, if needed */ + if (uv_y_sample_interval == 2 && ypos == (height-1)) + { + const uint8_t *y_ptr=Y+ypos*Y_stride, + *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr=RGB+ypos*RGB_stride; + + STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } + + /* Catch the right column, if needed */ + { + int converted = (width & ~31); + if (converted != width) + { + const uint8_t *y_ptr=Y+converted*y_pixel_stride, + *u_ptr=U+converted*uv_pixel_stride/uv_x_sample_interval, + *v_ptr=V+converted*uv_pixel_stride/uv_x_sample_interval; + + uint8_t *rgb_ptr=RGB+converted*rgb_pixel_stride; + + STD_FUNCTION_NAME(width-converted, height, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } +} + +#undef SSE_FUNCTION_NAME +#undef STD_FUNCTION_NAME +#undef YUV_FORMAT +#undef RGB_FORMAT +#undef SSE_ALIGNED +#undef LOAD_SI128 +#undef SAVE_SI128 +#undef UV2RGB_16 +#undef ADD_Y2RGB_16 +#undef PACK_RGB24_32_STEP1 +#undef PACK_RGB24_32_STEP2 +#undef PACK_RGB24_32 +#undef PACK_RGBA_32 +#undef PACK_PIXEL +#undef SAVE_LINE1 +#undef SAVE_LINE2 +#undef READ_Y +#undef READ_UV +#undef YUV2RGB_32 diff --git a/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h new file mode 100644 index 000000000..bf4f48eab --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h @@ -0,0 +1,220 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +/* You need to define the following macros before including this file: + STD_FUNCTION_NAME + YUV_FORMAT + RGB_FORMAT +*/ + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint16 *)rgb_ptr = \ + ((((Uint16)clampU8(y_tmp+r_tmp)) << 8 ) & 0xF800) | \ + ((((Uint16)clampU8(y_tmp+g_tmp)) << 3) & 0x07E0) | \ + (((Uint16)clampU8(y_tmp+b_tmp)) >> 3); \ + rgb_ptr += 2; \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define PACK_PIXEL(rgb_ptr) \ + rgb_ptr[0] = clampU8(y_tmp+r_tmp); \ + rgb_ptr[1] = clampU8(y_tmp+g_tmp); \ + rgb_ptr[2] = clampU8(y_tmp+b_tmp); \ + rgb_ptr += 3; \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 24) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 8) | \ + 0x000000FF; \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_BGRA + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 24) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 8) | \ + 0x000000FF; \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_ARGB + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + 0xFF000000 | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 0); \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_ABGR + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + 0xFF000000 | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 0); \ + rgb_ptr += 4; \ + +#else +#error PACK_PIXEL unimplemented +#endif + + +void STD_FUNCTION_NAME( + uint32_t width, uint32_t height, + const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + uint8_t *RGB, uint32_t RGB_stride, + YCbCrType yuv_type) +{ + const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); +#if YUV_FORMAT == YUV_FORMAT_420 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 1; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#elif YUV_FORMAT == YUV_FORMAT_422 + const int y_pixel_stride = 2; + const int uv_pixel_stride = 4; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 1; +#elif YUV_FORMAT == YUV_FORMAT_NV12 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 2; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#endif + + uint32_t x, y; + for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval) + { + const uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, + *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+y*RGB_stride, + *rgb_ptr2=RGB+(y+1)*RGB_stride; + + for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + if (uv_y_sample_interval > 1) { + y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + + y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + } + + y_ptr1+=2*y_pixel_stride; + y_ptr2+=2*y_pixel_stride; + u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + } + + /* Catch the last pixel, if needed */ + if (uv_x_sample_interval == 2 && x == (width-1)) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + if (uv_y_sample_interval > 1) { + y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + } + } + } + + /* Catch the last line, if needed */ + if (uv_y_sample_interval == 2 && y == (height-1)) + { + const uint8_t *y_ptr1=Y+y*Y_stride, + *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+y*RGB_stride; + + for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_ptr1+=2*y_pixel_stride; + u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + } + + /* Catch the last pixel, if needed */ + if (uv_x_sample_interval == 2 && x == (width-1)) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + } + } +} + +#undef STD_FUNCTION_NAME +#undef YUV_FORMAT +#undef RGB_FORMAT +#undef PACK_PIXEL diff --git a/Engine/lib/sdl/test/CMakeLists.txt b/Engine/lib/sdl/test/CMakeLists.txt new file mode 100644 index 000000000..3c25c5c7c --- /dev/null +++ b/Engine/lib/sdl/test/CMakeLists.txt @@ -0,0 +1,122 @@ +cmake_minimum_required(VERSION 2.8.11) +project(SDL2 C) + +# Global settings for all of the test targets +# FIXME: is this wrong? +remove_definitions(-DUSING_GENERATED_CONFIG_H) +link_libraries(SDL2_test SDL2-static) + +# FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin, +# but we need them for VS as well. +if(WINDOWS) + link_libraries(SDL2main) + add_definitions(-Dmain=SDL_main) +endif() + +add_executable(checkkeys checkkeys.c) +add_executable(loopwave loopwave.c) +add_executable(loopwavequeue loopwavequeue.c) +add_executable(testresample testresample.c) +add_executable(testaudioinfo testaudioinfo.c) + +file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) +add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) + +add_executable(testmultiaudio testmultiaudio.c) +add_executable(testaudiohotplug testaudiohotplug.c) +add_executable(testaudiocapture testaudiocapture.c) +add_executable(testatomic testatomic.c) +add_executable(testintersections testintersections.c) +add_executable(testrelative testrelative.c) +add_executable(testhittesting testhittesting.c) +add_executable(testdraw2 testdraw2.c) +add_executable(testdrawchessboard testdrawchessboard.c) +add_executable(testdropfile testdropfile.c) +add_executable(testerror testerror.c) +add_executable(testfile testfile.c) +add_executable(testgamecontroller testgamecontroller.c) +add_executable(testgesture testgesture.c) +add_executable(testgl2 testgl2.c) +add_executable(testgles testgles.c) +add_executable(testgles2 testgles2.c) +add_executable(testhaptic testhaptic.c) +add_executable(testhotplug testhotplug.c) +add_executable(testrumble testrumble.c) +add_executable(testthread testthread.c) +add_executable(testiconv testiconv.c) +add_executable(testime testime.c) +add_executable(testjoystick testjoystick.c) +add_executable(testkeys testkeys.c) +add_executable(testloadso testloadso.c) +add_executable(testlock testlock.c) + +if(APPLE) + add_executable(testnative testnative.c + testnativecocoa.m + testnativex11.c) +elseif(WINDOWS) + add_executable(testnative testnative.c testnativew32.c) +elseif(UNIX) + add_executable(testnative testnative.c testnativex11.c) +endif() + +add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c) +add_executable(testplatform testplatform.c) +add_executable(testpower testpower.c) +add_executable(testfilesystem testfilesystem.c) +add_executable(testrendertarget testrendertarget.c) +add_executable(testscale testscale.c) +add_executable(testsem testsem.c) +add_executable(testshader testshader.c) +add_executable(testshape testshape.c) +add_executable(testsprite2 testsprite2.c) +add_executable(testspriteminimal testspriteminimal.c) +add_executable(teststreaming teststreaming.c) +add_executable(testtimer testtimer.c) +add_executable(testver testver.c) +add_executable(testviewport testviewport.c) +add_executable(testwm2 testwm2.c) +add_executable(testyuv testyuv.c testyuv_cvt.c) +add_executable(torturethread torturethread.c) +add_executable(testrendercopyex testrendercopyex.c) +add_executable(testmessage testmessage.c) +add_executable(testdisplayinfo testdisplayinfo.c) +add_executable(testqsort testqsort.c) +add_executable(testbounds testbounds.c) +add_executable(testcustomcursor testcustomcursor.c) +add_executable(controllermap controllermap.c) +add_executable(testvulkan testvulkan.c) + +# HACK: Dummy target to cause the resource files to be copied to the build directory. +# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression. +# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n") +add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c) + +file(GLOB RESOURCE_FILES *.bmp *.wav) +foreach(RESOURCE_FILE ${RESOURCE_FILES}) + add_custom_command(TARGET SDL2_test_resoureces POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) +endforeach(RESOURCE_FILE) + +file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +# TODO: Might be easier to make all targets depend on the resources...? +add_dependencies(testscale SDL2_test_resoureces) +add_dependencies(testrendercopyex SDL2_test_resoureces) +add_dependencies(controllermap SDL2_test_resoureces) +add_dependencies(testyuv SDL2_test_resoureces) +add_dependencies(testgamecontroller SDL2_test_resoureces) +add_dependencies(testshape SDL2_test_resoureces) +add_dependencies(testshader SDL2_test_resoureces) +add_dependencies(testnative SDL2_test_resoureces) +add_dependencies(testspriteminimal SDL2_test_resoureces) +add_dependencies(testautomation SDL2_test_resoureces) +add_dependencies(testcustomcursor SDL2_test_resoureces) +add_dependencies(testrendertarget SDL2_test_resoureces) +add_dependencies(testsprite2 SDL2_test_resoureces) + +add_dependencies(loopwave SDL2_test_resoureces) +add_dependencies(loopwavequeue SDL2_test_resoureces) +add_dependencies(testresample SDL2_test_resoureces) +add_dependencies(testaudiohotplug SDL2_test_resoureces) +add_dependencies(testmultiaudio SDL2_test_resoureces) diff --git a/Engine/lib/sdl/test/Makefile.in b/Engine/lib/sdl/test/Makefile.in index 68f0d3dab..bc9c24ab9 100644 --- a/Engine/lib/sdl/test/Makefile.in +++ b/Engine/lib/sdl/test/Makefile.in @@ -9,19 +9,23 @@ LIBS = @LIBS@ TARGETS = \ checkkeys$(EXE) \ + controllermap$(EXE) \ loopwave$(EXE) \ loopwavequeue$(EXE) \ testatomic$(EXE) \ - testaudioinfo$(EXE) \ testaudiocapture$(EXE) \ + testaudiohotplug$(EXE) \ + testaudioinfo$(EXE) \ testautomation$(EXE) \ testbounds$(EXE) \ testcustomcursor$(EXE) \ + testdisplayinfo$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ testerror$(EXE) \ testfile$(EXE) \ + testfilesystem$(EXE) \ testgamecontroller$(EXE) \ testgesture$(EXE) \ testgl2$(EXE) \ @@ -29,26 +33,26 @@ TARGETS = \ testgles2$(EXE) \ testhaptic$(EXE) \ testhittesting$(EXE) \ - testrumble$(EXE) \ testhotplug$(EXE) \ - testthread$(EXE) \ testiconv$(EXE) \ testime$(EXE) \ testintersections$(EXE) \ - testrelative$(EXE) \ testjoystick$(EXE) \ testkeys$(EXE) \ testloadso$(EXE) \ testlock$(EXE) \ + testmessage$(EXE) \ testmultiaudio$(EXE) \ - testaudiohotplug$(EXE) \ testnative$(EXE) \ testoverlay2$(EXE) \ testplatform$(EXE) \ testpower$(EXE) \ - testfilesystem$(EXE) \ + testqsort$(EXE) \ + testrelative$(EXE) \ + testrendercopyex$(EXE) \ testrendertarget$(EXE) \ testresample$(EXE) \ + testrumble$(EXE) \ testscale$(EXE) \ testsem$(EXE) \ testshader$(EXE) \ @@ -56,18 +60,16 @@ TARGETS = \ testsprite2$(EXE) \ testspriteminimal$(EXE) \ teststreaming$(EXE) \ + testthread$(EXE) \ testtimer$(EXE) \ testver$(EXE) \ testviewport$(EXE) \ + testvulkan$(EXE) \ testwm2$(EXE) \ + testyuv$(EXE) \ torturethread$(EXE) \ - testrendercopyex$(EXE) \ - testmessage$(EXE) \ - testdisplayinfo$(EXE) \ - testqsort$(EXE) \ - controllermap$(EXE) \ -all: Makefile $(TARGETS) +all: Makefile $(TARGETS) copydatafiles Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -217,7 +219,7 @@ endif endif endif -testoverlay2$(EXE): $(srcdir)/testoverlay2.c +testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testplatform$(EXE): $(srcdir)/testplatform.c @@ -265,6 +267,9 @@ testviewport$(EXE): $(srcdir)/testviewport.c testwm2$(EXE): $(srcdir)/testwm2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testyuv$(EXE): $(srcdir)/testyuv.c $(srcdir)/testyuv_cvt.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + torturethread$(EXE): $(srcdir)/torturethread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @@ -289,6 +294,9 @@ testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testvulkan$(EXE): $(srcdir)/testvulkan.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + clean: rm -f $(TARGETS) @@ -297,3 +305,20 @@ distclean: clean rm -f Makefile rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* + + +%.bmp: $(srcdir)/%.bmp + cp $< $@ + +%.wav: $(srcdir)/%.wav + cp $< $@ + +copydatafiles: copybmpfiles copywavfiles +.PHONY : copydatafiles + +copybmpfiles: $(foreach bmp,$(wildcard $(srcdir)/*.bmp),$(notdir $(bmp))) +.PHONY : copybmpfiles + +copywavfiles: $(foreach wav,$(wildcard $(srcdir)/*.wav),$(notdir $(wav))) +.PHONY : copywavfiles + diff --git a/Engine/lib/sdl/test/axis.bmp b/Engine/lib/sdl/test/axis.bmp index c7addd3ed9372e59d11d874dace91bb64840e066..2b3a7c8af6aa0bbefe26885523d7eb4387841606 100644 GIT binary patch literal 10138 zcmeHKF;2uV5cC~T(ID}GD-g7ZCtO1V4PT+9L_(sYTx0k4ePezWeBoAZ$9^B!{^9~;HIBJ3;oFX^oO!hKaUHK*E&}y-w|H(J+c2i= zWd+eY?9=YY{(m5*%Ya=@@i@{;Ao6DGd+-liV?A&mvCIPo44CoCgn9sLwf}b zu*x&+N8}mC8Q7SAnYX#6ULzM6JWs^#XHagJ^)8G9Y)CK2fdK=|h*^$h9@1^Y#{1mo z18K<3t5zp^FYtH(DYMk`gjnQ&6*1~C%tw6&IkQ+Vh(T&I8?12em>$4hH;VuxzyOr-(+#82FZ8o*$bB~tz TTyt+)M&qkJSr72>Nc{*u97*TN literal 3746 zcmd6pWmH>R6NcZqP^GT4rL>d?1PK8Ov`ABTcc*U9LX?Dr1d9>^Az1N3-GI7KcXxMp zZ*T4nRG^oBUwePuv(`ClubKUvnb~L0d$v!%^m-_{xK)8UWaRkuu7sK;cH7!OBa6}- zm57PlKJ3APCC)#1RIXrdrAn1hxpHMxsZs@1t5!v|YSmD^dUe#OQ3Ew=)eZ`<`t|FhL4yWp*sviiEiKWgQ6n^N+!#%oG(pp*P0_4bGc<4B z94%V3K+Bdb(W+G|v~JxRZQ8U!+qP|CWo3nS?b@Mz`}XM2p#!X~t(&k3yLX3=j}Lr(ec|Wl2Y-Km z^ytw8Y&IJ`d-g=HUcJz}cW?CR(+7R~_C>#b{m{REe+(Ef00RdO#G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W}8=w12r~m)} diff --git a/Engine/lib/sdl/test/checkkeys.c b/Engine/lib/sdl/test/checkkeys.c index 771369fa3..4452acaba 100644 --- a/Engine/lib/sdl/test/checkkeys.c +++ b/Engine/lib/sdl/test/checkkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -168,7 +168,19 @@ loop() PrintText("INPUT", event.text.text); break; case SDL_MOUSEBUTTONDOWN: - /* Any button press quits the app... */ + /* Left button quits the app, other buttons toggles text input */ + if (event.button.button == SDL_BUTTON_LEFT) { + done = 1; + } else { + if (SDL_IsTextInputActive()) { + SDL_Log("Stopping text input\n"); + SDL_StopTextInput(); + } else { + SDL_Log("Starting text input\n"); + SDL_StartTextInput(); + } + } + break; case SDL_QUIT: done = 1; break; diff --git a/Engine/lib/sdl/test/controllermap.c b/Engine/lib/sdl/test/controllermap.c index d626f9f89..2ca53518a 100644 --- a/Engine/lib/sdl/test/controllermap.c +++ b/Engine/lib/sdl/test/controllermap.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,16 +32,124 @@ #define MARKER_BUTTON 1 #define MARKER_AXIS 2 -typedef struct MappingStep +enum +{ + SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_BINDING_AXIS_MAX, +}; + +#define BINDING_COUNT (SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_MAX) + +static struct { int x, y; double angle; int marker; - char *field; - int axis, button, hat, hat_value; - char mapping[4096]; -}MappingStep; +} s_arrBindingDisplay[BINDING_COUNT] = { + { 387, 167, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_A */ + { 431, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_B */ + { 342, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_X */ + { 389, 101, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_Y */ + { 174, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_BACK */ + { 233, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_GUIDE */ + { 289, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_START */ + { 75, 154, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_LEFTSTICK */ + { 305, 230, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_RIGHTSTICK */ + { 77, 40, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_LEFTSHOULDER */ + { 396, 36, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER */ + { 154, 188, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_UP */ + { 154, 249, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_DOWN */ + { 116, 217, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_LEFT */ + { 186, 217, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_RIGHT */ + { 74, 153, 270.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE */ + { 74, 153, 90.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE */ + { 74, 153, 0.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE */ + { 74, 153, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE */ + { 306, 231, 270.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE */ + { 306, 231, 90.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE */ + { 306, 231, 0.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE */ + { 306, 231, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE */ + { 91, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT */ + { 375, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT */ +}; + +static int s_arrBindingOrder[BINDING_COUNT] = { + SDL_CONTROLLER_BUTTON_A, + SDL_CONTROLLER_BUTTON_B, + SDL_CONTROLLER_BUTTON_Y, + SDL_CONTROLLER_BUTTON_X, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE, + SDL_CONTROLLER_BUTTON_LEFTSTICK, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE, + SDL_CONTROLLER_BUTTON_RIGHTSTICK, + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_BACK, + SDL_CONTROLLER_BUTTON_GUIDE, + SDL_CONTROLLER_BUTTON_START, +}; + +typedef struct +{ + SDL_GameControllerBindType bindType; + union + { + int button; + + struct { + int axis; + int axis_min; + int axis_max; + } axis; + + struct { + int hat; + int hat_mask; + } hat; + + } value; + + SDL_bool committed; + +} SDL_GameControllerExtendedBind; + +static SDL_GameControllerExtendedBind s_arrBindings[BINDING_COUNT]; + +typedef struct +{ + SDL_bool m_bMoving; + int m_nStartingValue; + int m_nFarthestValue; +} AxisState; + +static int s_nNumAxes; +static AxisState *s_arrAxisState; + +static int s_iCurrentBinding; +static Uint32 s_unPendingAdvanceTime; +static SDL_bool s_bBindingComplete; SDL_Texture * LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) @@ -60,23 +168,6 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) if (transparent) { if (temp->format->palette) { SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } } } @@ -93,45 +184,186 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) return texture; } +static int +StandardizeAxisValue(int nValue) +{ + if (nValue > SDL_JOYSTICK_AXIS_MAX/2) { + return SDL_JOYSTICK_AXIS_MAX; + } else if (nValue < SDL_JOYSTICK_AXIS_MIN/2) { + return SDL_JOYSTICK_AXIS_MIN; + } else { + return 0; + } +} + +static void +SetCurrentBinding(int iBinding) +{ + int iIndex; + SDL_GameControllerExtendedBind *pBinding; + + if (iBinding < 0) { + return; + } + + if (iBinding == BINDING_COUNT) { + s_bBindingComplete = SDL_TRUE; + return; + } + + s_iCurrentBinding = iBinding; + + pBinding = &s_arrBindings[s_arrBindingOrder[s_iCurrentBinding]]; + SDL_zerop(pBinding); + + for (iIndex = 0; iIndex < s_nNumAxes; ++iIndex) { + s_arrAxisState[iIndex].m_nFarthestValue = s_arrAxisState[iIndex].m_nStartingValue; + } + + s_unPendingAdvanceTime = 0; +} + static SDL_bool +BBindingContainsBinding(const SDL_GameControllerExtendedBind *pBindingA, const SDL_GameControllerExtendedBind *pBindingB) +{ + if (pBindingA->bindType != pBindingB->bindType) + { + return SDL_FALSE; + } + switch (pBindingA->bindType) + { + case SDL_CONTROLLER_BINDTYPE_AXIS: + if (pBindingA->value.axis.axis != pBindingB->value.axis.axis) { + return SDL_FALSE; + } + if (!pBindingA->committed) { + return SDL_FALSE; + } + { + int minA = SDL_min(pBindingA->value.axis.axis_min, pBindingA->value.axis.axis_max); + int maxA = SDL_max(pBindingA->value.axis.axis_min, pBindingA->value.axis.axis_max); + int minB = SDL_min(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max); + int maxB = SDL_max(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max); + return (minA <= minB && maxA >= maxB); + } + /* Not reached */ + default: + return SDL_memcmp(pBindingA, pBindingB, sizeof(*pBindingA)) == 0; + } +} + +static void +ConfigureBinding(const SDL_GameControllerExtendedBind *pBinding) +{ + SDL_GameControllerExtendedBind *pCurrent; + int iIndex; + int iCurrentElement = s_arrBindingOrder[s_iCurrentBinding]; + + /* Do we already have this binding? */ + for (iIndex = 0; iIndex < SDL_arraysize(s_arrBindings); ++iIndex) { + pCurrent = &s_arrBindings[iIndex]; + if (BBindingContainsBinding(pCurrent, pBinding)) { + if (iIndex == SDL_CONTROLLER_BUTTON_A && iCurrentElement != SDL_CONTROLLER_BUTTON_B) { + /* Skip to the next binding */ + SetCurrentBinding(s_iCurrentBinding + 1); + return; + } + + if (iIndex == SDL_CONTROLLER_BUTTON_B) { + /* Go back to the previous binding */ + SetCurrentBinding(s_iCurrentBinding - 1); + return; + } + + /* Already have this binding, ignore it */ + return; + } + } + +#ifdef DEBUG_CONTROLLERMAP + switch ( pBinding->bindType ) + { + case SDL_CONTROLLER_BINDTYPE_NONE: + break; + case SDL_CONTROLLER_BINDTYPE_BUTTON: + SDL_Log("Configuring button binding for button %d\n", pBinding->value.button); + break; + case SDL_CONTROLLER_BINDTYPE_AXIS: + SDL_Log("Configuring axis binding for axis %d %d/%d committed = %s\n", pBinding->value.axis.axis, pBinding->value.axis.axis_min, pBinding->value.axis.axis_max, pBinding->committed ? "true" : "false"); + break; + case SDL_CONTROLLER_BINDTYPE_HAT: + SDL_Log("Configuring hat binding for hat %d %d\n", pBinding->value.hat.hat, pBinding->value.hat.hat_mask); + break; + } +#endif /* DEBUG_CONTROLLERMAP */ + + /* Should the new binding override the existing one? */ + pCurrent = &s_arrBindings[iCurrentElement]; + if (pCurrent->bindType != SDL_CONTROLLER_BINDTYPE_NONE) { + SDL_bool bNativeDPad, bCurrentDPad; + SDL_bool bNativeAxis, bCurrentAxis; + + bNativeDPad = (iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_UP || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_DOWN || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_LEFT || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_RIGHT); + bCurrentDPad = (pCurrent->bindType == SDL_CONTROLLER_BINDTYPE_HAT); + if (bNativeDPad && bCurrentDPad) { + /* We already have a binding of the type we want, ignore the new one */ + return; + } + + bNativeAxis = (iCurrentElement >= SDL_CONTROLLER_BUTTON_MAX); + bCurrentAxis = (pCurrent->bindType == SDL_CONTROLLER_BINDTYPE_AXIS); + if (bNativeAxis == bCurrentAxis && + (pBinding->bindType != SDL_CONTROLLER_BINDTYPE_AXIS || + pBinding->value.axis.axis != pCurrent->value.axis.axis)) { + /* We already have a binding of the type we want, ignore the new one */ + return; + } + } + + *pCurrent = *pBinding; + + if (pBinding->committed) { + s_unPendingAdvanceTime = SDL_GetTicks(); + } else { + s_unPendingAdvanceTime = 0; + } +} + +static SDL_bool +BMergeAxisBindings(int iIndex) +{ + SDL_GameControllerExtendedBind *pBindingA = &s_arrBindings[iIndex]; + SDL_GameControllerExtendedBind *pBindingB = &s_arrBindings[iIndex+1]; + if (pBindingA->bindType == SDL_CONTROLLER_BINDTYPE_AXIS && + pBindingB->bindType == SDL_CONTROLLER_BINDTYPE_AXIS && + pBindingA->value.axis.axis == pBindingB->value.axis.axis) { + if (pBindingA->value.axis.axis_min == pBindingB->value.axis.axis_min) { + pBindingA->value.axis.axis_min = pBindingA->value.axis.axis_max; + pBindingA->value.axis.axis_max = pBindingB->value.axis.axis_max; + pBindingB->bindType = SDL_CONTROLLER_BINDTYPE_NONE; + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void WatchJoystick(SDL_Joystick * joystick) { SDL_Window *window = NULL; SDL_Renderer *screen = NULL; SDL_Texture *background, *button, *axis, *marker; const char *name = NULL; - SDL_bool retval = SDL_FALSE; - SDL_bool done = SDL_FALSE, next=SDL_FALSE; + SDL_bool done = SDL_FALSE; SDL_Event event; SDL_Rect dst; - int s, _s; Uint8 alpha=200, alpha_step = -1; Uint32 alpha_ticks = 0; - char mapping[4096], temp[4096]; - MappingStep *step, *prev_step; - MappingStep steps[] = { - {342, 132, 0.0, MARKER_BUTTON, "x", -1, -1, -1, -1, ""}, - {387, 167, 0.0, MARKER_BUTTON, "a", -1, -1, -1, -1, ""}, - {431, 132, 0.0, MARKER_BUTTON, "b", -1, -1, -1, -1, ""}, - {389, 101, 0.0, MARKER_BUTTON, "y", -1, -1, -1, -1, ""}, - {174, 132, 0.0, MARKER_BUTTON, "back", -1, -1, -1, -1, ""}, - {233, 132, 0.0, MARKER_BUTTON, "guide", -1, -1, -1, -1, ""}, - {289, 132, 0.0, MARKER_BUTTON, "start", -1, -1, -1, -1, ""}, - {116, 217, 0.0, MARKER_BUTTON, "dpleft", -1, -1, -1, -1, ""}, - {154, 249, 0.0, MARKER_BUTTON, "dpdown", -1, -1, -1, -1, ""}, - {186, 217, 0.0, MARKER_BUTTON, "dpright", -1, -1, -1, -1, ""}, - {154, 188, 0.0, MARKER_BUTTON, "dpup", -1, -1, -1, -1, ""}, - {77, 40, 0.0, MARKER_BUTTON, "leftshoulder", -1, -1, -1, -1, ""}, - {91, 0, 0.0, MARKER_BUTTON, "lefttrigger", -1, -1, -1, -1, ""}, - {396, 36, 0.0, MARKER_BUTTON, "rightshoulder", -1, -1, -1, -1, ""}, - {375, 0, 0.0, MARKER_BUTTON, "righttrigger", -1, -1, -1, -1, ""}, - {75, 154, 0.0, MARKER_BUTTON, "leftstick", -1, -1, -1, -1, ""}, - {305, 230, 0.0, MARKER_BUTTON, "rightstick", -1, -1, -1, -1, ""}, - {75, 154, 0.0, MARKER_AXIS, "leftx", -1, -1, -1, -1, ""}, - {75, 154, 90.0, MARKER_AXIS, "lefty", -1, -1, -1, -1, ""}, - {305, 230, 0.0, MARKER_AXIS, "rightx", -1, -1, -1, -1, ""}, - {305, 230, 90.0, MARKER_AXIS, "righty", -1, -1, -1, -1, ""}, - }; + SDL_JoystickID nJoystickID; + int iIndex; /* Create a window to display joystick axis position */ window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED, @@ -139,14 +371,14 @@ WatchJoystick(SDL_Joystick * joystick) SCREEN_HEIGHT, 0); if (window == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); - return SDL_FALSE; + return; } screen = SDL_CreateRenderer(window, -1, 0); if (screen == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); - return SDL_FALSE; + return; } background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); @@ -173,23 +405,24 @@ WatchJoystick(SDL_Joystick * joystick) To skip a button, press SPACE or click/touch the screen\n\ To exit, press ESC\n\ ====================================================================================\n"); - - /* Initialize mapping with GUID and name */ - SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), temp, SDL_arraysize(temp)); - SDL_snprintf(mapping, SDL_arraysize(mapping), "%s,%s,platform:%s,", - temp, name ? name : "Unknown Joystick", SDL_GetPlatform()); + + nJoystickID = SDL_JoystickInstanceID(joystick); + + s_nNumAxes = SDL_JoystickNumAxes(joystick); + s_arrAxisState = (AxisState *)SDL_calloc(s_nNumAxes, sizeof(*s_arrAxisState)); + for (iIndex = 0; iIndex < s_nNumAxes; ++iIndex) { + AxisState *pAxisState = &s_arrAxisState[iIndex]; + Sint16 nInitialValue; + pAxisState->m_bMoving = SDL_JoystickGetAxisInitialState(joystick, iIndex, &nInitialValue); + pAxisState->m_nStartingValue = nInitialValue; + pAxisState->m_nFarthestValue = nInitialValue; + } /* Loop, getting joystick events! */ - for(s=0; smapping, mapping, SDL_arraysize(step->mapping)); - step->axis = -1; - step->button = -1; - step->hat = -1; - step->hat_value = -1; - - switch(step->marker) { + while (!done && !s_bBindingComplete) { + int iElement = s_arrBindingOrder[s_iCurrentBinding]; + + switch (s_arrBindingDisplay[iElement].marker) { case MARKER_AXIS: marker = axis; break; @@ -200,137 +433,271 @@ WatchJoystick(SDL_Joystick * joystick) break; } - dst.x = step->x; - dst.y = step->y; + dst.x = s_arrBindingDisplay[iElement].x; + dst.y = s_arrBindingDisplay[iElement].y; SDL_QueryTexture(marker, NULL, NULL, &dst.w, &dst.h); - next=SDL_FALSE; - SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); - - while (!done && !next) { - if (SDL_GetTicks() - alpha_ticks > 5) { - alpha_ticks = SDL_GetTicks(); - alpha += alpha_step; - if (alpha == 255) { - alpha_step = -1; - } - if (alpha < 128) { - alpha_step = 1; - } + if (SDL_GetTicks() - alpha_ticks > 5) { + alpha_ticks = SDL_GetTicks(); + alpha += alpha_step; + if (alpha == 255) { + alpha_step = -1; } - - SDL_RenderClear(screen); - SDL_RenderCopy(screen, background, NULL, NULL); - SDL_SetTextureAlphaMod(marker, alpha); - SDL_SetTextureColorMod(marker, 10, 255, 21); - SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, SDL_FLIP_NONE); - SDL_RenderPresent(screen); - - if (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_JOYAXISMOTION: - if ((event.jaxis.value > 20000 || event.jaxis.value < -20000) && event.jaxis.value != -32768) { - for (_s = 0; _s < s; _s++) { - if (steps[_s].axis == event.jaxis.axis) { - break; - } - } - if (_s == s) { - step->axis = event.jaxis.axis; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":a%u,", event.jaxis.axis); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - } - - break; - case SDL_JOYHATMOTION: - if (event.jhat.value == SDL_HAT_CENTERED) { - break; /* ignore centering, we're probably just coming back to the center from the previous item we set. */ - } - for (_s = 0; _s < s; _s++) { - if (steps[_s].hat == event.jhat.hat && steps[_s].hat_value == event.jhat.value) { - break; - } - } - if (_s == s) { - step->hat = event.jhat.hat; - step->hat_value = event.jhat.value; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":h%u.%u,", event.jhat.hat, event.jhat.value ); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - break; - case SDL_JOYBALLMOTION: - break; - case SDL_JOYBUTTONUP: - for (_s = 0; _s < s; _s++) { - if (steps[_s].button == event.jbutton.button) { - break; - } - } - if (_s == s) { - step->button = event.jbutton.button; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":b%u,", event.jbutton.button); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - break; - case SDL_FINGERDOWN: - case SDL_MOUSEBUTTONDOWN: - /* Skip this step */ - s++; - next=SDL_TRUE; - break; - case SDL_KEYDOWN: - if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) { - /* Undo! */ - if (s > 0) { - prev_step = &steps[--s]; - SDL_strlcpy(mapping, prev_step->mapping, SDL_arraysize(prev_step->mapping)); - next = SDL_TRUE; - } - break; - } - if (event.key.keysym.sym == SDLK_SPACE) { - /* Skip this step */ - s++; - next=SDL_TRUE; - break; - } - - if ((event.key.keysym.sym != SDLK_ESCAPE)) { - break; - } - /* Fall through to signal quit */ - case SDL_QUIT: - done = SDL_TRUE; - break; - default: - break; - } + if (alpha < 128) { + alpha_step = 1; } } + SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); + SDL_RenderClear(screen); + SDL_RenderCopy(screen, background, NULL, NULL); + SDL_SetTextureAlphaMod(marker, alpha); + SDL_SetTextureColorMod(marker, 10, 255, 21); + SDL_RenderCopyEx(screen, marker, NULL, &dst, s_arrBindingDisplay[iElement].angle, NULL, SDL_FLIP_NONE); + SDL_RenderPresent(screen); + + while (SDL_PollEvent(&event) > 0) { + switch (event.type) { + case SDL_JOYDEVICEREMOVED: + if (event.jaxis.which == nJoystickID) { + done = SDL_TRUE; + } + break; + case SDL_JOYAXISMOTION: + if (event.jaxis.which == nJoystickID) { + AxisState *pAxisState = &s_arrAxisState[event.jaxis.axis]; + int nValue = event.jaxis.value; + int nCurrentDistance, nFarthestDistance; + if (!pAxisState->m_bMoving) { + pAxisState->m_bMoving = SDL_TRUE; + pAxisState->m_nStartingValue = nValue; + pAxisState->m_nFarthestValue = nValue; + } + nCurrentDistance = SDL_abs(nValue - pAxisState->m_nStartingValue); + nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); + if (nCurrentDistance > nFarthestDistance) { + pAxisState->m_nFarthestValue = nValue; + nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); + } + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d\n", event.jaxis.axis, nValue, nCurrentDistance, nFarthestDistance); +#endif + if (nFarthestDistance >= 16000) { + /* If we've gone out far enough and started to come back, let's bind this axis */ + SDL_bool bCommitBinding = (nCurrentDistance <= 10000) ? SDL_TRUE : SDL_FALSE; + SDL_GameControllerExtendedBind binding; + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; + binding.value.axis.axis = event.jaxis.axis; + binding.value.axis.axis_min = StandardizeAxisValue(pAxisState->m_nStartingValue); + binding.value.axis.axis_max = StandardizeAxisValue(pAxisState->m_nFarthestValue); + binding.committed = bCommitBinding; + ConfigureBinding(&binding); + } + } + break; + case SDL_JOYHATMOTION: + if (event.jhat.which == nJoystickID) { + if (event.jhat.value != SDL_HAT_CENTERED) { + SDL_GameControllerExtendedBind binding; + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("HAT %d %d\n", event.jhat.hat, event.jhat.value); +#endif + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_HAT; + binding.value.hat.hat = event.jhat.hat; + binding.value.hat.hat_mask = event.jhat.value; + binding.committed = SDL_TRUE; + ConfigureBinding(&binding); + } + } + break; + case SDL_JOYBALLMOTION: + break; + case SDL_JOYBUTTONDOWN: + if (event.jbutton.which == nJoystickID) { + SDL_GameControllerExtendedBind binding; + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("BUTTON %d\n", event.jbutton.button); +#endif + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; + binding.value.button = event.jbutton.button; + binding.committed = SDL_TRUE; + ConfigureBinding(&binding); + } + break; + case SDL_FINGERDOWN: + case SDL_MOUSEBUTTONDOWN: + /* Skip this step */ + SetCurrentBinding(s_iCurrentBinding + 1); + break; + case SDL_KEYDOWN: + if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) { + SetCurrentBinding(s_iCurrentBinding - 1); + break; + } + if (event.key.keysym.sym == SDLK_SPACE) { + SetCurrentBinding(s_iCurrentBinding + 1); + break; + } + + if ((event.key.keysym.sym != SDLK_ESCAPE)) { + break; + } + /* Fall through to signal quit */ + case SDL_QUIT: + done = SDL_TRUE; + break; + default: + break; + } + } + + SDL_Delay(15); + + /* Wait 100 ms for joystick events to stop coming in, + in case a controller sends multiple events for a single control (e.g. axis and button for trigger) + */ + if (s_unPendingAdvanceTime && SDL_GetTicks() - s_unPendingAdvanceTime >= 100) { + SetCurrentBinding(s_iCurrentBinding + 1); + } } - if (s == SDL_arraysize(steps) ) { + if (s_bBindingComplete) { + char mapping[1024]; + char trimmed_name[128]; + char *spot; + int iIndex; + char pszElement[12]; + + SDL_strlcpy(trimmed_name, name, SDL_arraysize(trimmed_name)); + while (SDL_isspace(trimmed_name[0])) { + SDL_memmove(&trimmed_name[0], &trimmed_name[1], SDL_strlen(trimmed_name)); + } + while (trimmed_name[0] && SDL_isspace(trimmed_name[SDL_strlen(trimmed_name) - 1])) { + trimmed_name[SDL_strlen(trimmed_name) - 1] = '\0'; + } + while ((spot = SDL_strchr(trimmed_name, ',')) != NULL) { + SDL_memmove(spot, spot + 1, SDL_strlen(spot)); + } + + /* Initialize mapping with GUID and name */ + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), mapping, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + SDL_strlcat(mapping, trimmed_name, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + SDL_strlcat(mapping, "platform:", SDL_arraysize(mapping)); + SDL_strlcat(mapping, SDL_GetPlatform(), SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + + for (iIndex = 0; iIndex < SDL_arraysize(s_arrBindings); ++iIndex) { + SDL_GameControllerExtendedBind *pBinding = &s_arrBindings[iIndex]; + if (pBinding->bindType == SDL_CONTROLLER_BINDTYPE_NONE) { + continue; + } + + if (iIndex < SDL_CONTROLLER_BUTTON_MAX) { + SDL_GameControllerButton eButton = (SDL_GameControllerButton)iIndex; + SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping)); + } else { + const char *pszAxisName; + switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) { + case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT: + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERLEFT); + break; + case SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT: + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT); + break; + } + SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping)); + } + SDL_strlcat(mapping, ":", SDL_arraysize(mapping)); + + pszElement[0] = '\0'; + switch (pBinding->bindType) { + case SDL_CONTROLLER_BINDTYPE_BUTTON: + SDL_snprintf(pszElement, sizeof(pszElement), "b%d", pBinding->value.button); + break; + case SDL_CONTROLLER_BINDTYPE_AXIS: + if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MIN) { + /* The negative half axis */ + SDL_snprintf(pszElement, sizeof(pszElement), "-a%d", pBinding->value.axis.axis); + } else if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MAX) { + /* The positive half axis */ + SDL_snprintf(pszElement, sizeof(pszElement), "+a%d", pBinding->value.axis.axis); + } else { + SDL_snprintf(pszElement, sizeof(pszElement), "a%d", pBinding->value.axis.axis); + if (pBinding->value.axis.axis_min > pBinding->value.axis.axis_max) { + /* Invert the axis */ + SDL_strlcat(pszElement, "~", SDL_arraysize(pszElement)); + } + } + break; + case SDL_CONTROLLER_BINDTYPE_HAT: + SDL_snprintf(pszElement, sizeof(pszElement), "h%d.%d", pBinding->value.hat.hat, pBinding->value.hat.hat_mask); + break; + default: + SDL_assert(!"Unknown bind type"); + break; + } + SDL_strlcat(mapping, pszElement, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + } + SDL_Log("Mapping:\n\n%s\n\n", mapping); /* Print to stdout as well so the user can cat the output somewhere */ printf("%s\n", mapping); } - - while(SDL_PollEvent(&event)) {}; + + SDL_free(s_arrAxisState); + s_arrAxisState = NULL; SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); - return retval; } int @@ -368,6 +735,7 @@ main(int argc, char *argv[]) SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); SDL_Log(" guid: %s\n", guid); + SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); SDL_JoystickClose(joystick); } } @@ -377,9 +745,6 @@ main(int argc, char *argv[]) #else if (argv[1]) { #endif - SDL_bool reportederror = SDL_FALSE; - SDL_bool keepGoing = SDL_TRUE; - SDL_Event event; int device; #ifdef __ANDROID__ device = 0; @@ -387,34 +752,11 @@ main(int argc, char *argv[]) device = atoi(argv[1]); #endif joystick = SDL_JoystickOpen(device); - - while ( keepGoing ) { - if (joystick == NULL) { - if ( !reportederror ) { - SDL_Log("Couldn't open joystick %d: %s\n", device, SDL_GetError()); - keepGoing = SDL_FALSE; - reportederror = SDL_TRUE; - } - } else { - reportederror = SDL_FALSE; - keepGoing = WatchJoystick(joystick); - SDL_JoystickClose(joystick); - } - - joystick = NULL; - if (keepGoing) { - SDL_Log("Waiting for attach\n"); - } - while (keepGoing) { - SDL_WaitEvent(&event); - if ((event.type == SDL_QUIT) || (event.type == SDL_FINGERDOWN) - || (event.type == SDL_MOUSEBUTTONDOWN)) { - keepGoing = SDL_FALSE; - } else if (event.type == SDL_JOYDEVICEADDED) { - joystick = SDL_JoystickOpen(device); - break; - } - } + if (joystick == NULL) { + SDL_Log("Couldn't open joystick %d: %s\n", device, SDL_GetError()); + } else { + WatchJoystick(joystick); + SDL_JoystickClose(joystick); } } else { @@ -435,3 +777,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/loopwave.c b/Engine/lib/sdl/test/loopwave.c index ec9f52819..88d8fc871 100644 --- a/Engine/lib/sdl/test/loopwave.c +++ b/Engine/lib/sdl/test/loopwave.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,17 +20,13 @@ #include #include -#if HAVE_SIGNAL_H -#include -#endif - #ifdef __EMSCRIPTEN__ #include #endif #include "SDL.h" -struct +static struct { SDL_AudioSpec spec; Uint8 *sound; /* Pointer to wave data */ @@ -38,6 +34,7 @@ struct int soundpos; /* Current play position */ } wave; +static SDL_AudioDeviceID device; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -47,6 +44,37 @@ quit(int rc) exit(rc); } +static void +close_audio() +{ + if (device != 0) { + SDL_CloseAudioDevice(device); + device = 0; + } +} + +static void +open_audio() +{ + /* Initialize fillerup() variables */ + device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0); + if (!device) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); + SDL_FreeWAV(wave.sound); + quit(2); + } + + + /* Let the audio run */ + SDL_PauseAudioDevice(device, SDL_FALSE); +} + +static void reopen_audio() +{ + close_audio(); + open_audio(); +} + void SDLCALL fillerup(void *unused, Uint8 * stream, int len) @@ -72,17 +100,12 @@ fillerup(void *unused, Uint8 * stream, int len) } static int done = 0; -void -poked(int sig) -{ - done = 1; -} #ifdef __EMSCRIPTEN__ void loop() { - if(done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)) + if(done || (SDL_GetAudioDeviceStatus(device) != SDL_AUDIO_PLAYING)) emscripten_cancel_main_loop(); } #endif @@ -97,7 +120,7 @@ main(int argc, char *argv[]) SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); /* Load the SDL library */ - if (SDL_Init(SDL_INIT_AUDIO) < 0) { + if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_EVENTS) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); return (1); } @@ -114,17 +137,6 @@ main(int argc, char *argv[]) } wave.spec.callback = fillerup; -#if HAVE_SIGNAL_H - /* Set the signals */ -#ifdef SIGHUP - signal(SIGHUP, poked); -#endif - signal(SIGINT, poked); -#ifdef SIGQUIT - signal(SIGQUIT, poked); -#endif - signal(SIGTERM, poked); -#endif /* HAVE_SIGNAL_H */ /* Show the list of available drivers */ SDL_Log("Available audio drivers:"); @@ -132,27 +144,33 @@ main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } - /* Initialize fillerup() variables */ - if (SDL_OpenAudio(&wave.spec, NULL) < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); - SDL_FreeWAV(wave.sound); - quit(2); - } - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); - /* Let the audio run */ - SDL_PauseAudio(0); + open_audio(); + + SDL_FlushEvents(SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING)) - SDL_Delay(1000); + while (!done) { + SDL_Event event; + + while (SDL_PollEvent(&event) > 0) { + if (event.type == SDL_QUIT) { + done = 1; + } + if ((event.type == SDL_AUDIODEVICEADDED && !event.adevice.iscapture) || + (event.type == SDL_AUDIODEVICEREMOVED && !event.adevice.iscapture && event.adevice.which == device)) { + reopen_audio(); + } + } + SDL_Delay(100); + } #endif /* Clean up on signal */ - SDL_CloseAudio(); + close_audio(); SDL_FreeWAV(wave.sound); SDL_Quit(); return (0); diff --git a/Engine/lib/sdl/test/loopwavequeue.c b/Engine/lib/sdl/test/loopwavequeue.c index 85f5bd579..3f0a69e15 100644 --- a/Engine/lib/sdl/test/loopwavequeue.c +++ b/Engine/lib/sdl/test/loopwavequeue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,12 +25,11 @@ #include #endif -struct +static struct { SDL_AudioSpec spec; Uint8 *sound; /* Pointer to wave data */ Uint32 soundlen; /* Length of wave data */ - int soundpos; /* Current play position */ } wave; diff --git a/Engine/lib/sdl/test/nacl/common.js b/Engine/lib/sdl/test/nacl/common.js index a108fad32..a70001551 100644 --- a/Engine/lib/sdl/test/nacl/common.js +++ b/Engine/lib/sdl/test/nacl/common.js @@ -39,7 +39,7 @@ var common = (function() { mimetype = 'application/x-ppapi-release'; else mimetype = 'application/x-ppapi-debug'; - } else if (tool == 'pnacl' && isRelease) { + } else if (tool == 'pnacl') { mimetype = 'application/x-pnacl'; } return mimetype; @@ -147,6 +147,11 @@ var common = (function() { var listenerDiv = document.getElementById('listener'); listenerDiv.appendChild(moduleEl); + // Request the offsetTop property to force a relayout. As of Apr 10, 2014 + // this is needed if the module is being loaded on a Chrome App's + // background page (see crbug.com/350445). + moduleEl.offsetTop; + // Host plugins don't send a moduleDidLoad message. We'll fake it here. var isHost = isHostToolchain(tool); if (isHost) { diff --git a/Engine/lib/sdl/test/testatomic.c b/Engine/lib/sdl/test/testatomic.c index d371ef31f..6af9d4bf6 100644 --- a/Engine/lib/sdl/test/testatomic.c +++ b/Engine/lib/sdl/test/testatomic.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,7 +103,10 @@ void RunBasicTest() #define NInter (CountTo/CountInc/NThreads) #define Expect (CountTo-NInter*CountInc*NThreads) -SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */ +enum { + CountTo_GreaterThanZero = CountTo > 0, +}; +SDL_COMPILE_TIME_ASSERT(size, CountTo_GreaterThanZero); /* check for rollover */ static SDL_atomic_t good = { 42 }; @@ -114,7 +117,7 @@ static SDL_atomic_t threadsRunning; static SDL_sem *threadDone; static -int adder(void* junk) +int SDLCALL adder(void* junk) { unsigned long N=NInter; SDL_Log("Thread subtracting %d %lu times\n",CountInc,N); @@ -492,7 +495,7 @@ typedef struct char padding[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%SDL_CACHELINE_SIZE]; } ReaderData; -static int FIFO_Writer(void* _data) +static int SDLCALL FIFO_Writer(void* _data) { WriterData *data = (WriterData *)_data; SDL_EventQueue *queue = data->queue; @@ -527,7 +530,7 @@ static int FIFO_Writer(void* _data) return 0; } -static int FIFO_Reader(void* _data) +static int SDLCALL FIFO_Reader(void* _data) { ReaderData *data = (ReaderData *)_data; SDL_EventQueue *queue = data->queue; @@ -567,7 +570,7 @@ static int FIFO_Reader(void* _data) #ifdef TEST_SPINLOCK_FIFO /* This thread periodically locks the queue for no particular reason */ -static int FIFO_Watcher(void* _data) +static int SDLCALL FIFO_Watcher(void* _data) { SDL_EventQueue *queue = (SDL_EventQueue *)_data; @@ -597,7 +600,7 @@ static void RunFIFOTest(SDL_bool lock_free) int i, j; int grand_total; char textBuffer[1024]; - int len; + size_t len; SDL_Log("\nFIFO test---------------------------------------\n\n"); SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex"); diff --git a/Engine/lib/sdl/test/testaudiocapture.c b/Engine/lib/sdl/test/testaudiocapture.c index 26321a71c..a418d123c 100644 --- a/Engine/lib/sdl/test/testaudiocapture.c +++ b/Engine/lib/sdl/test/testaudiocapture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testaudiohotplug.c b/Engine/lib/sdl/test/testaudiohotplug.c index 73d480505..374cbb27b 100644 --- a/Engine/lib/sdl/test/testaudiohotplug.c +++ b/Engine/lib/sdl/test/testaudiohotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testaudioinfo.c b/Engine/lib/sdl/test/testaudioinfo.c index 485fd0a38..adecce9b7 100644 --- a/Engine/lib/sdl/test/testaudioinfo.c +++ b/Engine/lib/sdl/test/testaudioinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testautomation.c b/Engine/lib/sdl/test/testautomation.c index eea74b3b8..bb799ea43 100644 --- a/Engine/lib/sdl/test/testautomation.c +++ b/Engine/lib/sdl/test/testautomation.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testautomation_audio.c b/Engine/lib/sdl/test/testautomation_audio.c index bef838dde..be0f15e3d 100644 --- a/Engine/lib/sdl/test/testautomation_audio.c +++ b/Engine/lib/sdl/test/testautomation_audio.c @@ -46,7 +46,7 @@ int _audio_testCallbackLength; /* Test callback function */ -void _audio_testCallback(void *userdata, Uint8 *stream, int len) +void SDLCALL _audio_testCallback(void *userdata, Uint8 *stream, int len) { /* track that callback was called */ _audio_testCallbackCounter++; diff --git a/Engine/lib/sdl/test/testautomation_clipboard.c b/Engine/lib/sdl/test/testautomation_clipboard.c index f943ffee7..417d95746 100644 --- a/Engine/lib/sdl/test/testautomation_clipboard.c +++ b/Engine/lib/sdl/test/testautomation_clipboard.c @@ -121,7 +121,7 @@ clipboard_testClipboardTextFunctions(void *arg) SDLTest_AssertCheck( charResult[0] == '\0', "Verify SDL_GetClipboardText returned string with length 0, got length %i", - SDL_strlen(charResult)); + (int) SDL_strlen(charResult)); intResult = SDL_SetClipboardText((const char *)text); SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded"); SDLTest_AssertCheck( diff --git a/Engine/lib/sdl/test/testautomation_events.c b/Engine/lib/sdl/test/testautomation_events.c index a0119bdbe..09004da52 100644 --- a/Engine/lib/sdl/test/testautomation_events.c +++ b/Engine/lib/sdl/test/testautomation_events.c @@ -25,7 +25,7 @@ int _userdataValue1 = 1; int _userdataValue2 = 2; /* Event filter that sets some flags and optionally checks userdata */ -int _events_sampleNullEventFilter(void *userdata, SDL_Event *event) +int SDLCALL _events_sampleNullEventFilter(void *userdata, SDL_Event *event) { _eventFilterCalled = 1; diff --git a/Engine/lib/sdl/test/testautomation_keyboard.c b/Engine/lib/sdl/test/testautomation_keyboard.c index b2c3b9ae1..6f25bb76c 100644 --- a/Engine/lib/sdl/test/testautomation_keyboard.c +++ b/Engine/lib/sdl/test/testautomation_keyboard.c @@ -312,7 +312,7 @@ keyboard_getSetModState(void *arg) /* Get state, cache for later reset */ result = SDL_GetModState(); SDLTest_AssertPass("Call to SDL_GetModState()"); - SDLTest_AssertCheck(result >=0 && result <= allStates, "Verify result from call is valid, expected: 0 <= result <= %i, got: %i", allStates, result); + SDLTest_AssertCheck(/*result >= 0 &&*/ result <= allStates, "Verify result from call is valid, expected: 0 <= result <= %i, got: %i", allStates, result); currentState = result; /* Set random state */ diff --git a/Engine/lib/sdl/test/testautomation_mouse.c b/Engine/lib/sdl/test/testautomation_mouse.c index 57cadee2e..ed30f2604 100644 --- a/Engine/lib/sdl/test/testautomation_mouse.c +++ b/Engine/lib/sdl/test/testautomation_mouse.c @@ -447,11 +447,23 @@ mouse_warpMouseInWindow(void *arg) { const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT; int numPositions = 6; - int xPositions[] = {-1, 0, 1, w-1, w, w+1 }; - int yPositions[] = {-1, 0, 1, h-1, h, h+1 }; + int xPositions[6]; + int yPositions[6]; int x, y, i, j; SDL_Window *window; + xPositions[0] = -1; + xPositions[1] = 0; + xPositions[2] = 1; + xPositions[3] = w-1; + xPositions[4] = w; + xPositions[5] = w+1; + yPositions[0] = -1; + yPositions[1] = 0; + yPositions[2] = 1; + yPositions[3] = h-1; + yPositions[4] = h; + yPositions[5] = h+1; /* Create test window */ window = _createMouseSuiteTestWindow(); if (window == NULL) return TEST_ABORTED; diff --git a/Engine/lib/sdl/test/testautomation_platform.c b/Engine/lib/sdl/test/testautomation_platform.c index 5211a4a70..7cc732a7b 100644 --- a/Engine/lib/sdl/test/testautomation_platform.c +++ b/Engine/lib/sdl/test/testautomation_platform.c @@ -112,7 +112,7 @@ int platform_testGetFunctions (void *arg) char *platform; char *revision; int ret; - int len; + size_t len; platform = (char *)SDL_GetPlatform(); SDLTest_AssertPass("SDL_GetPlatform()"); @@ -122,7 +122,7 @@ int platform_testGetFunctions (void *arg) SDLTest_AssertCheck(len > 0, "SDL_GetPlatform(): expected non-empty platform, was platform: '%s', len: %i", platform, - len); + (int) len); } ret = SDL_GetCPUCount(); @@ -282,7 +282,7 @@ int platform_testGetSetClearError(void *arg) int result; const char *testError = "Testing"; char *lastError; - int len; + size_t len; SDL_ClearError(); SDLTest_AssertPass("SDL_ClearError()"); @@ -295,7 +295,7 @@ int platform_testGetSetClearError(void *arg) { len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, - "SDL_GetError(): no message expected, len: %i", len); + "SDL_GetError(): no message expected, len: %i", (int) len); } result = SDL_SetError("%s", testError); @@ -309,8 +309,8 @@ int platform_testGetSetClearError(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(testError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(testError), - len); + (int) SDL_strlen(testError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0, "SDL_GetError(): expected message %s, was message: %s", testError, @@ -334,7 +334,7 @@ int platform_testSetErrorEmptyInput(void *arg) int result; const char *testError = ""; char *lastError; - int len; + size_t len; result = SDL_SetError("%s", testError); SDLTest_AssertPass("SDL_SetError()"); @@ -347,8 +347,8 @@ int platform_testSetErrorEmptyInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(testError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(testError), - len); + (int) SDL_strlen(testError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0, "SDL_GetError(): expected message '%s', was message: '%s'", testError, @@ -373,14 +373,14 @@ int platform_testSetErrorInvalidInput(void *arg) const char *invalidError = NULL; const char *probeError = "Testing"; char *lastError; - int len; + size_t len; /* Reset */ SDL_ClearError(); SDLTest_AssertPass("SDL_ClearError()"); /* Check for no-op */ - result = SDL_SetError(invalidError); + result = SDL_SetError("%s", invalidError); SDLTest_AssertPass("SDL_SetError()"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -391,16 +391,16 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, "SDL_GetError(): expected message len 0, was len: %i", - len); + (int) len); } /* Set */ - result = SDL_SetError(probeError); + result = SDL_SetError("%s", probeError); SDLTest_AssertPass("SDL_SetError('%s')", probeError); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); /* Check for no-op */ - result = SDL_SetError(invalidError); + result = SDL_SetError("%s", invalidError); SDLTest_AssertPass("SDL_SetError(NULL)"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -411,7 +411,7 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, "SDL_GetError(): expected message len 0, was len: %i", - len); + (int) len); } /* Reset */ @@ -419,7 +419,7 @@ int platform_testSetErrorInvalidInput(void *arg) SDLTest_AssertPass("SDL_ClearError()"); /* Set and check */ - result = SDL_SetError(probeError); + result = SDL_SetError("%s", probeError); SDLTest_AssertPass("SDL_SetError()"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -430,8 +430,8 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(probeError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(probeError), - len); + (int) SDL_strlen(probeError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, probeError) == 0, "SDL_GetError(): expected message '%s', was message: '%s'", probeError, diff --git a/Engine/lib/sdl/test/testautomation_rwops.c b/Engine/lib/sdl/test/testautomation_rwops.c index 16f2161fe..9a1a29a72 100644 --- a/Engine/lib/sdl/test/testautomation_rwops.c +++ b/Engine/lib/sdl/test/testautomation_rwops.c @@ -32,9 +32,9 @@ static const char RWopsAlphabetString[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; void RWopsSetUp(void *arg) { - int fileLen; + size_t fileLen; FILE *handle; - int writtenLen; + size_t writtenLen; int result; /* Clean up from previous runs (if any); ignore errors */ @@ -49,8 +49,8 @@ RWopsSetUp(void *arg) /* Write some known text into it */ fileLen = SDL_strlen(RWopsHelloWorldTestString); - writtenLen = (int)fwrite(RWopsHelloWorldTestString, 1, fileLen, handle); - SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen); + writtenLen = fwrite(RWopsHelloWorldTestString, 1, fileLen, handle); + SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int) fileLen, (int) writtenLen); result = fclose(handle); SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result); @@ -61,8 +61,8 @@ RWopsSetUp(void *arg) /* Write alphabet text into it */ fileLen = SDL_strlen(RWopsAlphabetString); - writtenLen = (int)fwrite(RWopsAlphabetString, 1, fileLen, handle); - SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen); + writtenLen = fwrite(RWopsAlphabetString, 1, fileLen, handle); + SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int) fileLen, (int) writtenLen); result = fclose(handle); SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result); @@ -111,10 +111,10 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1, 1); SDLTest_AssertPass("Call to SDL_RWwrite succeeded"); if (write) { - SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", s); + SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", (int) s); } else { - SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", s); + SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int) s); } /* Test seek to random position */ @@ -133,8 +133,8 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) SDLTest_AssertCheck( s == (size_t)(sizeof(RWopsHelloWorldTestString)-1), "Verify result from SDL_RWread, expected %i, got %i", - sizeof(RWopsHelloWorldTestString)-1, - s); + (int) (sizeof(RWopsHelloWorldTestString)-1), + (int) s); SDLTest_AssertCheck( SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1 ) == 0, "Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf); @@ -144,25 +144,25 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded"); SDLTest_AssertCheck( i == (Sint64)(sizeof(RWopsHelloWorldTestString)-5), - "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %"SDL_PRIs64, - sizeof(RWopsHelloWorldTestString)-5, - i); + "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i", + (int) (sizeof(RWopsHelloWorldTestString)-5), + (int) i); i = SDL_RWseek( rw, -1, RW_SEEK_END ); SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded"); SDLTest_AssertCheck( i == (Sint64)(sizeof(RWopsHelloWorldTestString)-2), - "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %"SDL_PRIs64, - sizeof(RWopsHelloWorldTestString)-2, - i); + "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i", + (int) (sizeof(RWopsHelloWorldTestString)-2), + (int) i); /* Invalid whence seek */ i = SDL_RWseek( rw, 0, 999 ); SDLTest_AssertPass("Call to SDL_RWseek(...,0,invalid_whence) succeeded"); SDLTest_AssertCheck( i == (Sint64)(-1), - "Verify seek with SDL_RWseek (invalid_whence); expected: -1, got %"SDL_PRIs64, - i); + "Verify seek with SDL_RWseek (invalid_whence); expected: -1, got %i", + (int) i); } /* ! @@ -559,8 +559,8 @@ rwops_testCompareRWFromMemWithRWFromFile(void) SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result); /* Compare */ - SDLTest_AssertCheck(rv_mem == rv_file, "Verify returned read blocks matches for mem and file reads; got: rv_mem=%d rv_file=%d", rv_mem, rv_file); - SDLTest_AssertCheck(sv_mem == sv_file, "Verify SEEK_END position matches for mem and file seeks; got: sv_mem=%"SDL_PRIu64" sv_file=%"SDL_PRIu64, sv_mem, sv_file); + SDLTest_AssertCheck(rv_mem == rv_file, "Verify returned read blocks matches for mem and file reads; got: rv_mem=%d rv_file=%d", (int) rv_mem, (int) rv_file); + SDLTest_AssertCheck(sv_mem == sv_file, "Verify SEEK_END position matches for mem and file seeks; got: sv_mem=%d sv_file=%d", (int) sv_mem, (int) sv_file); SDLTest_AssertCheck(buffer_mem[slen] == 0, "Verify mem buffer termination; expected: 0, got: %d", buffer_mem[slen]); SDLTest_AssertCheck(buffer_file[slen] == 0, "Verify file buffer termination; expected: 0, got: %d", buffer_file[slen]); SDLTest_AssertCheck( @@ -648,27 +648,27 @@ rwops_testFileWriteReadEndian(void) /* Write test data */ objectsWritten = SDL_WriteBE16(rw, BE16value); SDLTest_AssertPass("Call to SDL_WriteBE16()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteBE32(rw, BE32value); SDLTest_AssertPass("Call to SDL_WriteBE32()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteBE64(rw, BE64value); SDLTest_AssertPass("Call to SDL_WriteBE64()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE16(rw, LE16value); SDLTest_AssertPass("Call to SDL_WriteLE16()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE32(rw, LE32value); SDLTest_AssertPass("Call to SDL_WriteLE32()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE64(rw, LE64value); SDLTest_AssertPass("Call to SDL_WriteLE64()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); /* Test seek to start */ result = SDL_RWseek( rw, 0, RW_SEEK_SET ); SDLTest_AssertPass("Call to SDL_RWseek succeeded"); - SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %"SDL_PRIs64, result); + SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %i", (int) result); /* Read test data */ BE16test = SDL_ReadBE16(rw); diff --git a/Engine/lib/sdl/test/testautomation_sdltest.c b/Engine/lib/sdl/test/testautomation_sdltest.c index 54cd6e257..979756adc 100644 --- a/Engine/lib/sdl/test/testautomation_sdltest.c +++ b/Engine/lib/sdl/test/testautomation_sdltest.c @@ -2,17 +2,20 @@ * SDL_test test suite */ +#include /* Visual Studio 2008 doesn't have stdint.h */ #if defined(_MSC_VER) && _MSC_VER <= 1500 -#define UINT8_MAX ~(Uint8)0 -#define UINT16_MAX ~(Uint16)0 -#define UINT32_MAX ~(Uint32)0 -#define UINT64_MAX ~(Uint64)0 +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define INT64_MIN _I64_MIN +#define INT64_MAX _I64_MAX +#define UINT64_MAX _UI64_MAX #else #include #endif + #include -#include #include #include @@ -31,7 +34,8 @@ int sdltest_generateRunSeed(void *arg) { char* result; - int i, l; + size_t i, l; + int j; for (i = 1; i <= 10; i += 3) { result = SDLTest_GenerateRunSeed((const int)i); @@ -39,14 +43,14 @@ sdltest_generateRunSeed(void *arg) SDLTest_AssertCheck(result != NULL, "Verify returned value is not NULL"); if (result != NULL) { l = SDL_strlen(result); - SDLTest_AssertCheck(l == i, "Verify length of returned value is %d, got: %d", i, l); + SDLTest_AssertCheck(l == i, "Verify length of returned value is %d, got: %d", (int) i, (int) l); SDL_free(result); } } /* Negative cases */ - for (i = -2; i <= 0; i++) { - result = SDLTest_GenerateRunSeed((const int)i); + for (j = -2; j <= 0; j++) { + result = SDLTest_GenerateRunSeed((const int)j); SDLTest_AssertPass("Call to SDLTest_GenerateRunSeed()"); SDLTest_AssertCheck(result == NULL, "Verify returned value is not NULL"); } @@ -988,38 +992,38 @@ sdltest_randomBoundaryNumberSint64(void *arg) "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, sresult); /* RandomSintXBoundaryValue(LLONG_MIN, 99, SDL_FALSE) returns 100 */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, 99, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, 99, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( sresult == 100, "Validate result value for parameters (LLONG_MIN,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, sresult); /* RandomSintXBoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE) returns LLONG_MIN (no error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN + 1, INT64_MAX, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MIN, - "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MIN, sresult); + sresult == INT64_MIN, + "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX - 1, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MAX, - "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MAX, sresult); + sresult == INT64_MAX, + "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MAX, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MIN, - "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MIN, sresult); + sresult == INT64_MIN, + "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, @@ -1116,16 +1120,16 @@ int sdltest_randomAsciiString(void *arg) { char* result; - int len; + size_t len; int nonAsciiCharacters; - int i; + size_t i; result = SDLTest_RandomAsciiString(); SDLTest_AssertPass("Call to SDLTest_RandomAsciiString()"); SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL"); if (result != NULL) { len = SDL_strlen(result); - SDLTest_AssertCheck(len >= 0 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", len); + SDLTest_AssertCheck(len >= 1 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", (int) len); nonAsciiCharacters = 0; for (i=0; i= 0 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", targetLen, len); + SDLTest_AssertCheck(len >= 1 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", (int) targetLen, (int) len); nonAsciiCharacters = 0; for (i=0; i + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testcustomcursor.c b/Engine/lib/sdl/test/testcustomcursor.c index 88b5c322d..b99a10bba 100644 --- a/Engine/lib/sdl/test/testcustomcursor.c +++ b/Engine/lib/sdl/test/testcustomcursor.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testdisplayinfo.c b/Engine/lib/sdl/test/testdisplayinfo.c index f06722e88..0cc5fbdd7 100644 --- a/Engine/lib/sdl/test/testdisplayinfo.c +++ b/Engine/lib/sdl/test/testdisplayinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testdraw2.c b/Engine/lib/sdl/test/testdraw2.c index 77bd8c1fe..91ee7eea2 100644 --- a/Engine/lib/sdl/test/testdraw2.c +++ b/Engine/lib/sdl/test/testdraw2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testdrawchessboard.c b/Engine/lib/sdl/test/testdrawchessboard.c index af929e9c3..3dd78e1ac 100644 --- a/Engine/lib/sdl/test/testdrawchessboard.c +++ b/Engine/lib/sdl/test/testdrawchessboard.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ SDL_Window *window; SDL_Renderer *renderer; +SDL_Surface *surface; int done; void @@ -59,7 +60,20 @@ loop() { SDL_Event e; while (SDL_PollEvent(&e)) { - if (e.type == SDL_QUIT) { + + /* Re-create when window has been resized */ + if ((e.type == SDL_WINDOWEVENT) && (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)) { + + SDL_DestroyRenderer(renderer); + + surface = SDL_GetWindowSurface(window); + renderer = SDL_CreateSoftwareRenderer(surface); + /* Clear the rendering surface with the specified color */ + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + SDL_RenderClear(renderer); + } + + if (e.type == SDL_QUIT) { done = 1; #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); @@ -86,8 +100,6 @@ loop() int main(int argc, char *argv[]) { - SDL_Surface *surface; - /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -100,7 +112,7 @@ main(int argc, char *argv[]) /* Create window and renderer for given surface */ - window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0); + window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE); if(!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError()); diff --git a/Engine/lib/sdl/test/testdropfile.c b/Engine/lib/sdl/test/testdropfile.c index b729b2f64..1c2a3f0e6 100644 --- a/Engine/lib/sdl/test/testdropfile.c +++ b/Engine/lib/sdl/test/testdropfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testerror.c b/Engine/lib/sdl/test/testerror.c index b5fa3fbc0..87fcab21b 100644 --- a/Engine/lib/sdl/test/testerror.c +++ b/Engine/lib/sdl/test/testerror.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -14,7 +14,6 @@ #include #include -#include #include "SDL.h" diff --git a/Engine/lib/sdl/test/testfile.c b/Engine/lib/sdl/test/testfile.c index b45795f63..e563d77be 100644 --- a/Engine/lib/sdl/test/testfile.c +++ b/Engine/lib/sdl/test/testfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testfilesystem.c b/Engine/lib/sdl/test/testfilesystem.c index 61a6d5a5a..ada4e864c 100644 --- a/Engine/lib/sdl/test/testfilesystem.c +++ b/Engine/lib/sdl/test/testfilesystem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,6 +46,15 @@ main(int argc, char *argv[]) SDL_Log("pref path: '%s'\n", pref_path); SDL_free(pref_path); + pref_path = SDL_GetPrefPath(NULL, "testfilesystem"); + if(pref_path == NULL){ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", + SDL_GetError()); + return 1; + } + SDL_Log("pref path: '%s'\n", pref_path); + SDL_free(pref_path); + SDL_Quit(); return 0; } diff --git a/Engine/lib/sdl/test/testgamecontroller.c b/Engine/lib/sdl/test/testgamecontroller.c index 38d2f7708..ef3a02b2f 100644 --- a/Engine/lib/sdl/test/testgamecontroller.c +++ b/Engine/lib/sdl/test/testgamecontroller.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,12 +53,12 @@ static const struct { int x; int y; } button_positions[] = { /* This is indexed by SDL_GameControllerAxis. */ static const struct { int x; int y; double angle; } axis_positions[] = { - {75, 154, 0.0}, /* LEFTX */ - {75, 154, 90.0}, /* LEFTY */ - {305, 230, 0.0}, /* RIGHTX */ - {305, 230, 90.0}, /* RIGHTY */ - {91, 0, 90.0}, /* TRIGGERLEFT */ - {375, 0, 90.0}, /* TRIGGERRIGHT */ + {74, 153, 270.0}, /* LEFTX */ + {74, 153, 0.0}, /* LEFTY */ + {306, 231, 270.0}, /* RIGHTX */ + {306, 231, 0.0}, /* RIGHTY */ + {91, -20, 0.0}, /* TRIGGERLEFT */ + {375, -20, 0.0}, /* TRIGGERRIGHT */ }; SDL_Renderer *screen = NULL; @@ -80,10 +80,6 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) if (transparent) { if (temp->format->BytesPerPixel == 1) { SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); - } else { - SDL_assert(!temp->format->palette); - SDL_assert(temp->format->BitsPerPixel == 24); - SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *)temp->pixels) & 0x00FFFFFF); } } @@ -112,6 +108,13 @@ loop(void *arg) while (SDL_PollEvent(&event)) { switch (event.type) { + case SDL_CONTROLLERAXISMOTION: + SDL_Log("Controller axis %s changed to %d\n", SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value); + break; + case SDL_CONTROLLERBUTTONDOWN: + case SDL_CONTROLLERBUTTONUP: + SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); + break; case SDL_KEYDOWN: if (event.key.keysym.sym != SDLK_ESCAPE) { break; @@ -259,6 +262,19 @@ main(int argc, char *argv[]) SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt"); + /* Print information about the mappings */ + if (!argv[1]) { + SDL_Log("Supported mappings:\n"); + for (i = 0; i < SDL_GameControllerNumMappings(); ++i) { + char *mapping = SDL_GameControllerMappingForIndex(i); + if (mapping) { + SDL_Log("\t%s\n", mapping); + SDL_free(mapping); + } + } + SDL_Log("\n"); + } + /* Print information about the controller */ for (i = 0; i < SDL_NumJoysticks(); ++i) { const char *name; @@ -276,7 +292,9 @@ main(int argc, char *argv[]) name = SDL_JoystickNameForIndex(i); description = "Joystick"; } - SDL_Log("%s %d: %s (guid %s)\n", description, i, name ? name : "Unknown", guid); + SDL_Log("%s %d: %s (guid %s, VID 0x%.4x, PID 0x%.4x)\n", + description, i, name ? name : "Unknown", guid, + SDL_JoystickGetDeviceVendor(i), SDL_JoystickGetDeviceProduct(i)); } SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", nController, SDL_NumJoysticks()); @@ -348,3 +366,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testgesture.c b/Engine/lib/sdl/test/testgesture.c index a289ce133..f4b254a65 100644 --- a/Engine/lib/sdl/test/testgesture.c +++ b/Engine/lib/sdl/test/testgesture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,6 @@ #define WIDTH 640 #define HEIGHT 480 #define BPP 4 -#define DEPTH 32 /* MUST BE A POWER OF 2! */ #define EVENT_BUF_SIZE 256 diff --git a/Engine/lib/sdl/test/testgl2.c b/Engine/lib/sdl/test/testgl2.c index 74147f9fb..dd01d0e29 100644 --- a/Engine/lib/sdl/test/testgl2.c +++ b/Engine/lib/sdl/test/testgl2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,7 +56,7 @@ static int LoadContext(GL_Context * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ diff --git a/Engine/lib/sdl/test/testgles.c b/Engine/lib/sdl/test/testgles.c index 5be48ac56..96895da0f 100644 --- a/Engine/lib/sdl/test/testgles.c +++ b/Engine/lib/sdl/test/testgles.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testgles2.c b/Engine/lib/sdl/test/testgles2.c index 45b3d79a3..c4578a5cc 100644 --- a/Engine/lib/sdl/test/testgles2.c +++ b/Engine/lib/sdl/test/testgles2.c @@ -1,5 +1,5 @@ /* - Copyright (r) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,8 @@ #include "SDL_test_common.h" -#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) +#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) \ + || defined(__WINDOWS__) || defined(__LINUX__) #define HAVE_OPENGLES2 #endif @@ -58,7 +59,7 @@ static int LoadContext(GLES2_Context * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ diff --git a/Engine/lib/sdl/test/testhittesting.c b/Engine/lib/sdl/test/testhittesting.c index 5e32be42d..c5223a983 100644 --- a/Engine/lib/sdl/test/testhittesting.c +++ b/Engine/lib/sdl/test/testhittesting.c @@ -14,7 +14,7 @@ const SDL_Rect drag_areas[] = { static const SDL_Rect *areas = drag_areas; static int numareas = SDL_arraysize(drag_areas); -static SDL_HitTestResult +static SDL_HitTestResult SDLCALL hitTest(SDL_Window *window, const SDL_Point *pt, void *data) { int i; diff --git a/Engine/lib/sdl/test/testhotplug.c b/Engine/lib/sdl/test/testhotplug.c index 1fa963754..72c90e8d9 100644 --- a/Engine/lib/sdl/test/testhotplug.c +++ b/Engine/lib/sdl/test/testhotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testiconv.c b/Engine/lib/sdl/test/testiconv.c index 79efec8aa..47e8c377a 100644 --- a/Engine/lib/sdl/test/testiconv.c +++ b/Engine/lib/sdl/test/testiconv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testime.c b/Engine/lib/sdl/test/testime.c index 39a40f82f..77bb86962 100644 --- a/Engine/lib/sdl/test/testime.c +++ b/Engine/lib/sdl/test/testime.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,7 +99,7 @@ static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np) return 1; } -static void unifont_init(const char *fontname) +static int unifont_init(const char *fontname) { Uint8 hexBuffer[65]; Uint32 numGlyphs = 0; @@ -114,7 +114,7 @@ static void unifont_init(const char *fontname) if (unifontGlyph == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024); - exit(-1); + return -1; } SDL_memset(unifontGlyph, 0, unifontGlyphSize); @@ -123,7 +123,7 @@ static void unifont_init(const char *fontname) if (unifontTexture == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024); - exit(-1); + return -1; } SDL_memset(unifontTexture, 0, unifontTextureSize); @@ -131,7 +131,7 @@ static void unifont_init(const char *fontname) if (hexFile == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); - exit(-1); + return -1; } /* Read all the glyph data into memory to make it accessible later when textures are created. */ @@ -146,8 +146,8 @@ static void unifont_init(const char *fontname) break; /* EOF */ if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unfiont: Unexpected end of hex file.\n"); - exit(-1); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + return -1; } /* Looking for the colon that separates the codepoint and glyph data at position 2, 4, 6 and 8. */ @@ -162,13 +162,13 @@ static void unifont_init(const char *fontname) else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.\n", lineNumber); - exit(-1); + return -1; } if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.\n", lineNumber); - exit(-1); + return -1; } if (codepoint > UNIFONT_MAX_CODEPOINT) SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.\n", lineNumber, UNIFONT_MAX_CODEPOINT); @@ -181,7 +181,7 @@ static void unifont_init(const char *fontname) if (bytesRead < (33 - bytesOverread)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); - exit(-1); + return -1; } if (hexBuffer[32] == '\n') glyphWidth = 8; @@ -192,14 +192,14 @@ static void unifont_init(const char *fontname) if (bytesRead < 32) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); - exit(-1); + return -1; } } if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.\n", lineNumber); - exit(-1); + return -1; } if (codepoint <= UNIFONT_MAX_CODEPOINT) @@ -221,6 +221,7 @@ static void unifont_init(const char *fontname) SDL_RWclose(hexFile); SDL_Log("unifont: Loaded %u glyphs.\n", numGlyphs); + return 0; } static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width) @@ -259,7 +260,7 @@ static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width) } } -static void unifont_load_texture(Uint32 textureID) +static int unifont_load_texture(Uint32 textureID) { int i; Uint8 * textureRGBA; @@ -267,14 +268,14 @@ static void unifont_load_texture(Uint32 textureID) if (textureID >= UNIFONT_NUM_TEXTURES) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %u.\n", textureID); - exit(-1); + return -1; } textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE); if (textureRGBA == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024); - exit(-1); + return -1; } SDL_memset(textureRGBA, 0, UNIFONT_TEXTURE_SIZE); @@ -301,7 +302,7 @@ static void unifont_load_texture(Uint32 textureID) if (tex == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %u for renderer %d.\n", textureID, i); - exit(-1); + return -1; } unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex; SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); @@ -313,6 +314,7 @@ static void unifont_load_texture(Uint32 textureID) SDL_free(textureRGBA); unifontTextureLoaded[textureID] = 1; + return 0; } static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dstrect) @@ -321,10 +323,14 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dst const Uint32 textureID = codepoint / UNIFONT_GLYPHS_IN_TEXTURE; SDL_Rect srcrect; srcrect.w = srcrect.h = 16; - if (codepoint > UNIFONT_MAX_CODEPOINT) + if (codepoint > UNIFONT_MAX_CODEPOINT) { return 0; - if (!unifontTextureLoaded[textureID]) - unifont_load_texture(textureID); + } + if (!unifontTextureLoaded[textureID]) { + if (unifont_load_texture(textureID) < 0) { + return 0; + } + } texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID]; if (texture != NULL) { @@ -430,12 +436,10 @@ Uint32 utf8_decode(char *p, size_t len) void usage() { SDL_Log("usage: testime [--font fontfile]\n"); - exit(0); } void InitInput() { - /* Prepare a rect for text input */ textRect.x = textRect.y = 100; textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x; @@ -459,7 +463,8 @@ void CleanupVideo() #endif } -void _Redraw(int rendererID) { +void _Redraw(int rendererID) +{ SDL_Renderer * renderer = state->renderers[rendererID]; SDL_Rect drawnTextRect, cursorRect, underlineRect; drawnTextRect = textRect; @@ -607,7 +612,8 @@ void _Redraw(int rendererID) { SDL_SetTextInputRect(&markedRect); } -void Redraw() { +void Redraw() +{ int i; for (i = 0; i < state->num_windows; ++i) { SDL_Renderer *renderer = state->renderers[i]; @@ -623,7 +629,8 @@ void Redraw() { } } -int main(int argc, char *argv[]) { +int main(int argc, char *argv[]) +{ int i, done; SDL_Event event; const char *fontname = DEFAULT_FONT; @@ -673,14 +680,15 @@ int main(int argc, char *argv[]) { if (! font) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError()); - exit(-1); + return -1; } #else - unifont_init(fontname); + if (unifont_init(fontname) < 0) { + return -1; + } #endif SDL_Log("Using font: %s\n", fontname); - atexit(SDL_Quit); InitInput(); /* Create the windows and initialize the renderers */ diff --git a/Engine/lib/sdl/test/testintersections.c b/Engine/lib/sdl/test/testintersections.c index 82aae6338..619df0640 100644 --- a/Engine/lib/sdl/test/testintersections.c +++ b/Engine/lib/sdl/test/testintersections.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testjoystick.c b/Engine/lib/sdl/test/testjoystick.c index bed27212e..d2d1c4e2c 100644 --- a/Engine/lib/sdl/test/testjoystick.c +++ b/Engine/lib/sdl/test/testjoystick.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -239,7 +239,7 @@ WatchJoystick(SDL_Joystick * joystick) int main(int argc, char *argv[]) { - const char *name; + const char *name, *type; int i; SDL_Joystick *joystick; @@ -268,12 +268,46 @@ main(int argc, char *argv[]) SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick); SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), guid, sizeof (guid)); + switch (SDL_JoystickGetType(joystick)) { + case SDL_JOYSTICK_TYPE_GAMECONTROLLER: + type = "Game Controller"; + break; + case SDL_JOYSTICK_TYPE_WHEEL: + type = "Wheel"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_STICK: + type = "Arcade Stick"; + break; + case SDL_JOYSTICK_TYPE_FLIGHT_STICK: + type = "Flight Stick"; + break; + case SDL_JOYSTICK_TYPE_DANCE_PAD: + type = "Dance Pad"; + break; + case SDL_JOYSTICK_TYPE_GUITAR: + type = "Guitar"; + break; + case SDL_JOYSTICK_TYPE_DRUM_KIT: + type = "Drum Kit"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_PAD: + type = "Arcade Pad"; + break; + case SDL_JOYSTICK_TYPE_THROTTLE: + type = "Throttle"; + break; + default: + type = "Unknown"; + break; + } + SDL_Log(" type: %s\n", type); SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick)); SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick)); SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick)); SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); SDL_Log(" guid: %s\n", guid); + SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); SDL_JoystickClose(joystick); } } @@ -320,6 +354,7 @@ main(int argc, char *argv[]) || (event.type == SDL_MOUSEBUTTONDOWN)) { keepGoing = SDL_FALSE; } else if (event.type == SDL_JOYDEVICEADDED) { + device = event.jdevice.which; joystick = SDL_JoystickOpen(device); if (joystick != NULL) { SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick); @@ -344,3 +379,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testkeys.c b/Engine/lib/sdl/test/testkeys.c index aea496caa..73f880e13 100644 --- a/Engine/lib/sdl/test/testkeys.c +++ b/Engine/lib/sdl/test/testkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testloadso.c b/Engine/lib/sdl/test/testloadso.c index fb87fbed7..c6fa33106 100644 --- a/Engine/lib/sdl/test/testloadso.c +++ b/Engine/lib/sdl/test/testloadso.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testlock.c b/Engine/lib/sdl/test/testlock.c index 113ba0d4c..8299a9a67 100644 --- a/Engine/lib/sdl/test/testlock.c +++ b/Engine/lib/sdl/test/testlock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testmessage.c b/Engine/lib/sdl/test/testmessage.c index 91968c322..8488d8eda 100644 --- a/Engine/lib/sdl/test/testmessage.c +++ b/Engine/lib/sdl/test/testmessage.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -14,7 +14,6 @@ #include #include -#include #include "SDL.h" @@ -26,7 +25,7 @@ quit(int rc) exit(rc); } -static int +static int SDLCALL button_messagebox(void *eventNumber) { const SDL_MessageBoxButtonData buttons[] = { @@ -47,12 +46,13 @@ button_messagebox(void *eventNumber) "Custom MessageBox", "This is a custom messagebox", 2, - buttons, + NULL,/* buttons */ NULL /* Default color scheme */ }; int button = -1; int success = 0; + data.buttons = buttons; if (eventNumber) { data.message = "This is a custom messagebox from a background thread."; } diff --git a/Engine/lib/sdl/test/testmultiaudio.c b/Engine/lib/sdl/test/testmultiaudio.c index 1b07ba9fc..52a4cac7d 100644 --- a/Engine/lib/sdl/test/testmultiaudio.c +++ b/Engine/lib/sdl/test/testmultiaudio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnative.c b/Engine/lib/sdl/test/testnative.c index 049c4c83e..674d9d3b4 100644 --- a/Engine/lib/sdl/test/testnative.c +++ b/Engine/lib/sdl/test/testnative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnative.h b/Engine/lib/sdl/test/testnative.h index ed2bf7e52..29d85fb32 100644 --- a/Engine/lib/sdl/test/testnative.h +++ b/Engine/lib/sdl/test/testnative.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnativew32.c b/Engine/lib/sdl/test/testnativew32.c index aaea267d2..7e96bc697 100644 --- a/Engine/lib/sdl/test/testnativew32.c +++ b/Engine/lib/sdl/test/testnativew32.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnativex11.c b/Engine/lib/sdl/test/testnativex11.c index 69fa37bbf..386c25e9e 100644 --- a/Engine/lib/sdl/test/testnativex11.c +++ b/Engine/lib/sdl/test/testnativex11.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testoverlay2.c b/Engine/lib/sdl/test/testoverlay2.c index 453f0f443..daf07d3e9 100644 --- a/Engine/lib/sdl/test/testoverlay2.c +++ b/Engine/lib/sdl/test/testoverlay2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -16,16 +16,14 @@ * * ********************************************************************************/ -#include -#include -#include - #ifdef __EMSCRIPTEN__ #include #endif #include "SDL.h" +#include "testyuv_cvt.h" + #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -33,110 +31,110 @@ #define MOOSEFRAMES_COUNT 10 SDL_Color MooseColors[84] = { - {49, 49, 49} - , {66, 24, 0} - , {66, 33, 0} - , {66, 66, 66} + {49, 49, 49, SDL_ALPHA_OPAQUE} + , {66, 24, 0, SDL_ALPHA_OPAQUE} + , {66, 33, 0, SDL_ALPHA_OPAQUE} + , {66, 66, 66, SDL_ALPHA_OPAQUE} , - {66, 115, 49} - , {74, 33, 0} - , {74, 41, 16} - , {82, 33, 8} + {66, 115, 49, SDL_ALPHA_OPAQUE} + , {74, 33, 0, SDL_ALPHA_OPAQUE} + , {74, 41, 16, SDL_ALPHA_OPAQUE} + , {82, 33, 8, SDL_ALPHA_OPAQUE} , - {82, 41, 8} - , {82, 49, 16} - , {82, 82, 82} - , {90, 41, 8} + {82, 41, 8, SDL_ALPHA_OPAQUE} + , {82, 49, 16, SDL_ALPHA_OPAQUE} + , {82, 82, 82, SDL_ALPHA_OPAQUE} + , {90, 41, 8, SDL_ALPHA_OPAQUE} , - {90, 41, 16} - , {90, 57, 24} - , {99, 49, 16} - , {99, 66, 24} + {90, 41, 16, SDL_ALPHA_OPAQUE} + , {90, 57, 24, SDL_ALPHA_OPAQUE} + , {99, 49, 16, SDL_ALPHA_OPAQUE} + , {99, 66, 24, SDL_ALPHA_OPAQUE} , - {99, 66, 33} - , {99, 74, 33} - , {107, 57, 24} - , {107, 82, 41} + {99, 66, 33, SDL_ALPHA_OPAQUE} + , {99, 74, 33, SDL_ALPHA_OPAQUE} + , {107, 57, 24, SDL_ALPHA_OPAQUE} + , {107, 82, 41, SDL_ALPHA_OPAQUE} , - {115, 57, 33} - , {115, 66, 33} - , {115, 66, 41} - , {115, 74, 0} + {115, 57, 33, SDL_ALPHA_OPAQUE} + , {115, 66, 33, SDL_ALPHA_OPAQUE} + , {115, 66, 41, SDL_ALPHA_OPAQUE} + , {115, 74, 0, SDL_ALPHA_OPAQUE} , - {115, 90, 49} - , {115, 115, 115} - , {123, 82, 0} - , {123, 99, 57} + {115, 90, 49, SDL_ALPHA_OPAQUE} + , {115, 115, 115, SDL_ALPHA_OPAQUE} + , {123, 82, 0, SDL_ALPHA_OPAQUE} + , {123, 99, 57, SDL_ALPHA_OPAQUE} , - {132, 66, 41} - , {132, 74, 41} - , {132, 90, 8} - , {132, 99, 33} + {132, 66, 41, SDL_ALPHA_OPAQUE} + , {132, 74, 41, SDL_ALPHA_OPAQUE} + , {132, 90, 8, SDL_ALPHA_OPAQUE} + , {132, 99, 33, SDL_ALPHA_OPAQUE} , - {132, 99, 66} - , {132, 107, 66} - , {140, 74, 49} - , {140, 99, 16} + {132, 99, 66, SDL_ALPHA_OPAQUE} + , {132, 107, 66, SDL_ALPHA_OPAQUE} + , {140, 74, 49, SDL_ALPHA_OPAQUE} + , {140, 99, 16, SDL_ALPHA_OPAQUE} , - {140, 107, 74} - , {140, 115, 74} - , {148, 107, 24} - , {148, 115, 82} + {140, 107, 74, SDL_ALPHA_OPAQUE} + , {140, 115, 74, SDL_ALPHA_OPAQUE} + , {148, 107, 24, SDL_ALPHA_OPAQUE} + , {148, 115, 82, SDL_ALPHA_OPAQUE} , - {148, 123, 74} - , {148, 123, 90} - , {156, 115, 33} - , {156, 115, 90} + {148, 123, 74, SDL_ALPHA_OPAQUE} + , {148, 123, 90, SDL_ALPHA_OPAQUE} + , {156, 115, 33, SDL_ALPHA_OPAQUE} + , {156, 115, 90, SDL_ALPHA_OPAQUE} , - {156, 123, 82} - , {156, 132, 82} - , {156, 132, 99} - , {156, 156, 156} + {156, 123, 82, SDL_ALPHA_OPAQUE} + , {156, 132, 82, SDL_ALPHA_OPAQUE} + , {156, 132, 99, SDL_ALPHA_OPAQUE} + , {156, 156, 156, SDL_ALPHA_OPAQUE} , - {165, 123, 49} - , {165, 123, 90} - , {165, 132, 82} - , {165, 132, 90} + {165, 123, 49, SDL_ALPHA_OPAQUE} + , {165, 123, 90, SDL_ALPHA_OPAQUE} + , {165, 132, 82, SDL_ALPHA_OPAQUE} + , {165, 132, 90, SDL_ALPHA_OPAQUE} , - {165, 132, 99} - , {165, 140, 90} - , {173, 132, 57} - , {173, 132, 99} + {165, 132, 99, SDL_ALPHA_OPAQUE} + , {165, 140, 90, SDL_ALPHA_OPAQUE} + , {173, 132, 57, SDL_ALPHA_OPAQUE} + , {173, 132, 99, SDL_ALPHA_OPAQUE} , - {173, 140, 107} - , {173, 140, 115} - , {173, 148, 99} - , {173, 173, 173} + {173, 140, 107, SDL_ALPHA_OPAQUE} + , {173, 140, 115, SDL_ALPHA_OPAQUE} + , {173, 148, 99, SDL_ALPHA_OPAQUE} + , {173, 173, 173, SDL_ALPHA_OPAQUE} , - {181, 140, 74} - , {181, 148, 115} - , {181, 148, 123} - , {181, 156, 107} + {181, 140, 74, SDL_ALPHA_OPAQUE} + , {181, 148, 115, SDL_ALPHA_OPAQUE} + , {181, 148, 123, SDL_ALPHA_OPAQUE} + , {181, 156, 107, SDL_ALPHA_OPAQUE} , - {189, 148, 123} - , {189, 156, 82} - , {189, 156, 123} - , {189, 156, 132} + {189, 148, 123, SDL_ALPHA_OPAQUE} + , {189, 156, 82, SDL_ALPHA_OPAQUE} + , {189, 156, 123, SDL_ALPHA_OPAQUE} + , {189, 156, 132, SDL_ALPHA_OPAQUE} , - {189, 189, 189} - , {198, 156, 123} - , {198, 165, 132} - , {206, 165, 99} + {189, 189, 189, SDL_ALPHA_OPAQUE} + , {198, 156, 123, SDL_ALPHA_OPAQUE} + , {198, 165, 132, SDL_ALPHA_OPAQUE} + , {206, 165, 99, SDL_ALPHA_OPAQUE} , - {206, 165, 132} - , {206, 173, 140} - , {206, 206, 206} - , {214, 173, 115} + {206, 165, 132, SDL_ALPHA_OPAQUE} + , {206, 173, 140, SDL_ALPHA_OPAQUE} + , {206, 206, 206, SDL_ALPHA_OPAQUE} + , {214, 173, 115, SDL_ALPHA_OPAQUE} , - {214, 173, 140} - , {222, 181, 148} - , {222, 189, 132} - , {222, 189, 156} + {214, 173, 140, SDL_ALPHA_OPAQUE} + , {222, 181, 148, SDL_ALPHA_OPAQUE} + , {222, 189, 132, SDL_ALPHA_OPAQUE} + , {222, 189, 156, SDL_ALPHA_OPAQUE} , - {222, 222, 222} - , {231, 198, 165} - , {231, 231, 231} - , {239, 206, 173} + {222, 222, 222, SDL_ALPHA_OPAQUE} + , {231, 198, 165, SDL_ALPHA_OPAQUE} + , {231, 231, 231, SDL_ALPHA_OPAQUE} + , {239, 206, 173, SDL_ALPHA_OPAQUE} }; Uint8 MooseFrame[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE*2]; @@ -149,8 +147,7 @@ SDL_Renderer *renderer; int paused = 0; int i; SDL_bool done = SDL_FALSE; -Uint32 pixel_format = SDL_PIXELFORMAT_YV12; -int fpsdelay; +static int fpsdelay; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -160,91 +157,6 @@ quit(int rc) exit(rc); } -/* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */ - -/* NOTE: These RGB conversion functions are not intended for speed, - only as examples. -*/ - -void -RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance) -{ - if (monochrome) { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = 128; - yuv[2] = 128; -#else - yuv[0] = (int)(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128; - yuv[2] = 128; -#endif - } else { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); - yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); -#else - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); - yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]); -#endif - } - - if (luminance != 100) { - yuv[0] = yuv[0] * luminance / 100; - if (yuv[0] > 255) - yuv[0] = 255; - } -} - -void -ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[3]; - - op[0] = out; - op[1] = op[0] + w*h; - op[2] = op[1] + w*h/4; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[2]; - *(op[2]++) = yuv[1]; - } - rgb += 3; - } - } -} - -void -ConvertRGBtoNV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[2]; - - op[0] = out; - op[1] = op[0] + w*h; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[1]; - *(op[1]++) = yuv[2]; - } - rgb += 3; - } - } -} - static void PrintUsage(char *argv0) { @@ -307,7 +219,7 @@ loop() if (!paused) { i = (i + 1) % MOOSEFRAMES_COUNT; - SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format)); + SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W); } SDL_RenderClear(renderer); SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect); @@ -328,13 +240,7 @@ main(int argc, char **argv) SDL_Window *window; int j; int fps = 12; - int fpsdelay; int nodelay = 0; -#ifdef TEST_NV12 - Uint32 pixel_format = SDL_PIXELFORMAT_NV12; -#else - Uint32 pixel_format = SDL_PIXELFORMAT_YV12; -#endif int scale = 5; /* Enable standard application logging */ @@ -348,7 +254,7 @@ main(int argc, char **argv) while (argc > 1) { if (strcmp(argv[1], "-fps") == 0) { if (argv[2]) { - fps = atoi(argv[2]); + fps = SDL_atoi(argv[2]); if (fps == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); @@ -372,7 +278,7 @@ main(int argc, char **argv) argc -= 1; } else if (strcmp(argv[1], "-scale") == 0) { if (argv[2]) { - scale = atoi(argv[2]); + scale = SDL_atoi(argv[2]); if (scale == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -scale option requires an argument [from 1 to 50], default is 5.\n"); @@ -404,7 +310,6 @@ main(int argc, char **argv) RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); if (RawMooseData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n"); - free(RawMooseData); quit(1); } @@ -441,7 +346,7 @@ main(int argc, char **argv) quit(4); } - MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); + MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); if (!MooseTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); free(RawMooseData); @@ -463,17 +368,9 @@ main(int argc, char **argv) rgb[2] = MooseColors[frame[j]].b; rgb += 3; } - switch (pixel_format) { - case SDL_PIXELFORMAT_YV12: - ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - case SDL_PIXELFORMAT_NV12: - ConvertRGBtoNV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - default: - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n"); - break; - } + ConvertRGBtoYUV(SDL_PIXELFORMAT_YV12, MooseFrameRGB, MOOSEPIC_W*3, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, + SDL_GetYUVConversionModeForResolution(MOOSEPIC_W, MOOSEPIC_H), + 0, 100); } free(RawMooseData); diff --git a/Engine/lib/sdl/test/testplatform.c b/Engine/lib/sdl/test/testplatform.c index 14acac4b1..84efab319 100644 --- a/Engine/lib/sdl/test/testplatform.c +++ b/Engine/lib/sdl/test/testplatform.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,26 @@ TestTypes(SDL_bool verbose) { int error = 0; + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT8, SDL_MAX_SINT8 == 127); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT8, SDL_MIN_SINT8 == -128); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT8, SDL_MAX_UINT8 == 255); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT8, SDL_MIN_UINT8 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT16, SDL_MAX_SINT16 == 32767); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT16, SDL_MIN_SINT16 == -32768); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT16, SDL_MAX_UINT16 == 65535); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT16, SDL_MIN_UINT16 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT32, SDL_MAX_SINT32 == 2147483647); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT32, SDL_MIN_SINT32 == ~0x7fffffff); /* Instead of -2147483648, which is treated as unsigned by some compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT32, SDL_MAX_UINT32 == 4294967295u); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT32, SDL_MIN_UINT32 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT64, SDL_MAX_SINT64 == 9223372036854775807ll); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT64, SDL_MIN_SINT64 == ~0x7fffffffffffffffll); /* Instead of -9223372036854775808, which is treated as unsigned by compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT64, SDL_MAX_UINT64 == 18446744073709551615ull); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT64, SDL_MIN_UINT64 == 0); + if (badsize(sizeof(Uint8), 1)) { if (verbose) SDL_Log("sizeof(Uint8) != 1, instead = %u\n", @@ -128,6 +148,220 @@ TestEndian(SDL_bool verbose) return (error ? 1 : 0); } +static int TST_allmul (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) * (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_alldiv (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) / (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_allrem (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) % (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_ualldiv (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = ((*(unsigned long long *)a) / (*(unsigned long long *)b)); + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_uallrem (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = ((*(unsigned long long *)a) % (*(unsigned long long *)b)); + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_allshl (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = (*(long long *)a) << arg; + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_aullshl (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = (*(unsigned long long *)a) << arg; + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_allshr (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = (*(long long *)a) >> arg; + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_aullshr (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = (*(unsigned long long *)a) >> arg; + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + + +typedef int (*LL_Intrinsic)(void *a, void *b, int arg, void *result, void *expected); + +typedef struct { + const char *operation; + LL_Intrinsic routine; + unsigned long long a, b; + int arg; + unsigned long long expected_result; +} LL_Test; + +static LL_Test LL_Tests[] = +{ + /* UNDEFINED {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFEll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFF00000000ll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFE00000000ll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + {"_allshr", &TST_allshr, 0xAAAAAAAA55555555ll, 0ll, 63, 0xFFFFFFFFFFFFFFFFll}, + /* UNDEFINED {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0xFFFFFFFFFFFFFFFFll}, */ + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + /* UNDEFINED {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 65, 0x0000000000000000ll}, */ + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 1, 0x2FAFAFAFAFAFAFAFll}, + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 32, 0x000000005F5F5F5Fll}, + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 33, 0x000000002FAFAFAFll}, + + /* UNDEFINED {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFEll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFF00000000ll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFE00000000ll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + /* UNDEFINED {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0x7FFFFFFFFFFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0x00000000FFFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0x000000007FFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000000ll, 0, 0x0000000000000000ll}, + {"_allmul", &TST_allmul, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_allmul", &TST_allmul, 0x0000000000000001ll, 0x000000000FFFFFFFll, 0, 0x000000000FFFFFFFll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x0000000000000010ll, 0x000000000FFFFFFFll, 0, 0x00000000FFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000100ll, 0, 0x0000000FFFFFFF00ll}, + {"_allmul", &TST_allmul, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000FFFFFFF00ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000010000000ll, 0, 0x00FFFFFFF0000000ll}, + {"_allmul", &TST_allmul, 0x0000000010000000ll, 0x000000000FFFFFFFll, 0, 0x00FFFFFFF0000000ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000080000000ll, 0, 0x07FFFFFF80000000ll}, + {"_allmul", &TST_allmul, 0x0000000080000000ll, 0x000000000FFFFFFFll, 0, 0x07FFFFFF80000000ll}, + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0xFFFFFFFF00000000ll}, + {"_allmul", &TST_allmul, 0x0000000080000000ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFF00000000ll}, + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000008ll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x0000000080000008ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x00000000FFFFFFFFll, 0x00000000FFFFFFFFll, 0, 0xFFFFFFFE00000001ll}, + + {"_alldiv", &TST_alldiv, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000001ll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_alldiv", &TST_alldiv, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000080000008ll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xC000000080000008ll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000000000007FFFll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000001ll}, + + {"_allrem", &TST_allrem, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x000000000000000Fll}, + {"_allrem", &TST_allrem, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000100ll}, + {"_allrem", &TST_allrem, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0xFFFFFFFFFFFFFFFEll}, + {"_allrem", &TST_allrem, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000FFFF0000FFEEll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000000ll}, + + + {"_ualldiv", &TST_ualldiv, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000001ll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_ualldiv", &TST_ualldiv, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x00000001FFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000000000007FFFll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000001ll}, + + {"_uallrem", &TST_uallrem, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x000000000000000Fll}, + {"_uallrem", &TST_uallrem, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000100ll}, + {"_uallrem", &TST_uallrem, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x000000007FFFFFFEll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x7FFFFFFEFFFFFFF0ll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000FFFF0000FFEEll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000000ll}, + + {NULL} +}; + +int +Test64Bit (SDL_bool verbose) +{ + LL_Test *t; + int failed = 0; + + for (t = LL_Tests; t->routine != NULL; t++) { + unsigned long long result = 0; + unsigned int *al = (unsigned int *)&t->a; + unsigned int *bl = (unsigned int *)&t->b; + unsigned int *el = (unsigned int *)&t->expected_result; + unsigned int *rl = (unsigned int *)&result; + + if (!t->routine(&t->a, &t->b, t->arg, &result, &t->expected_result)) { + if (verbose) + SDL_Log("%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X\n", + t->operation, al[1], al[0], bl[1], bl[0], t->arg, rl[1], rl[0], el[1], el[0]); + ++failed; + } + } + if (verbose && (failed == 0)) + SDL_Log("All 64bit instrinsic tests passed\n"); + return (failed ? 1 : 0); +} int TestCPUInfo(SDL_bool verbose) @@ -145,6 +379,8 @@ TestCPUInfo(SDL_bool verbose) SDL_Log("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected"); SDL_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected"); SDL_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected"); + SDL_Log("AVX2 %s\n", SDL_HasAVX2()? "detected" : "not detected"); + SDL_Log("NEON %s\n", SDL_HasNEON()? "detected" : "not detected"); SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM()); } return (0); @@ -197,6 +433,7 @@ main(int argc, char *argv[]) status += TestTypes(verbose); status += TestEndian(verbose); + status += Test64Bit(verbose); status += TestCPUInfo(verbose); status += TestAssertions(verbose); diff --git a/Engine/lib/sdl/test/testpower.c b/Engine/lib/sdl/test/testpower.c index 300d21a24..adb58832a 100644 --- a/Engine/lib/sdl/test/testpower.c +++ b/Engine/lib/sdl/test/testpower.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testqsort.c b/Engine/lib/sdl/test/testqsort.c index 48659f307..e83b0731e 100644 --- a/Engine/lib/sdl/test/testqsort.c +++ b/Engine/lib/sdl/test/testqsort.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testrelative.c b/Engine/lib/sdl/test/testrelative.c index 59d23f638..816329ff5 100644 --- a/Engine/lib/sdl/test/testrelative.c +++ b/Engine/lib/sdl/test/testrelative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testrendercopyex.c b/Engine/lib/sdl/test/testrendercopyex.c index e34890245..209a35157 100644 --- a/Engine/lib/sdl/test/testrendercopyex.c +++ b/Engine/lib/sdl/test/testrendercopyex.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testrendertarget.c b/Engine/lib/sdl/test/testrendertarget.c index c5e1dce05..7d24d8aea 100644 --- a/Engine/lib/sdl/test/testrendertarget.c +++ b/Engine/lib/sdl/test/testrendertarget.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testresample.c b/Engine/lib/sdl/test/testresample.c index 0e92bbe11..bcdaa669a 100644 --- a/Engine/lib/sdl/test/testresample.c +++ b/Engine/lib/sdl/test/testresample.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ main(int argc, char **argv) Uint32 len = 0; Uint8 *data = NULL; int cvtfreq = 0; + int cvtchans = 0; int bitsize = 0; int blockalign = 0; int avgbytes = 0; @@ -28,12 +29,13 @@ main(int argc, char **argv) /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - if (argc != 4) { - SDL_Log("USAGE: %s in.wav out.wav newfreq\n", argv[0]); + if (argc != 5) { + SDL_Log("USAGE: %s in.wav out.wav newfreq newchans\n", argv[0]); return 1; } cvtfreq = SDL_atoi(argv[3]); + cvtchans = SDL_atoi(argv[4]); if (SDL_Init(SDL_INIT_AUDIO) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError()); @@ -47,7 +49,7 @@ main(int argc, char **argv) } if (SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq, - spec.format, spec.channels, cvtfreq) == -1) { + spec.format, cvtchans, cvtfreq) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to build CVT: %s\n", SDL_GetError()); SDL_FreeWAV(data); SDL_Quit(); @@ -83,16 +85,16 @@ main(int argc, char **argv) } bitsize = SDL_AUDIO_BITSIZE(spec.format); - blockalign = (bitsize / 8) * spec.channels; + blockalign = (bitsize / 8) * cvtchans; avgbytes = cvtfreq * blockalign; SDL_WriteLE32(io, 0x46464952); /* RIFF */ - SDL_WriteLE32(io, len * cvt.len_mult + 36); + SDL_WriteLE32(io, cvt.len_cvt + 36); SDL_WriteLE32(io, 0x45564157); /* WAVE */ SDL_WriteLE32(io, 0x20746D66); /* fmt */ SDL_WriteLE32(io, 16); /* chunk size */ SDL_WriteLE16(io, 1); /* uncompressed */ - SDL_WriteLE16(io, spec.channels); /* channels */ + SDL_WriteLE16(io, cvtchans); /* channels */ SDL_WriteLE32(io, cvtfreq); /* sample rate */ SDL_WriteLE32(io, avgbytes); /* average bytes per second */ SDL_WriteLE16(io, blockalign); /* block align */ diff --git a/Engine/lib/sdl/test/testrumble.c b/Engine/lib/sdl/test/testrumble.c index ea7466d2d..908a6aafb 100644 --- a/Engine/lib/sdl/test/testrumble.c +++ b/Engine/lib/sdl/test/testrumble.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,7 @@ main(int argc, char **argv) name = NULL; index = -1; if (argc > 1) { + size_t l; name = argv[1]; if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) { SDL_Log("USAGE: %s [device]\n" @@ -63,9 +64,9 @@ main(int argc, char **argv) return 0; } - i = strlen(name); - if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) { - index = atoi(name); + l = SDL_strlen(name); + if ((l < 3) && SDL_isdigit(name[0]) && ((l == 1) || SDL_isdigit(name[1]))) { + index = SDL_atoi(name); name = NULL; } } diff --git a/Engine/lib/sdl/test/testscale.c b/Engine/lib/sdl/test/testscale.c index 9f5fdbff1..e1b46fcc8 100644 --- a/Engine/lib/sdl/test/testscale.c +++ b/Engine/lib/sdl/test/testscale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testsem.c b/Engine/lib/sdl/test/testsem.c index b8d3b2749..884763e6a 100644 --- a/Engine/lib/sdl/test/testsem.c +++ b/Engine/lib/sdl/test/testsem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testshader.c b/Engine/lib/sdl/test/testshader.c index fc6da2987..ee0ccdad2 100644 --- a/Engine/lib/sdl/test/testshader.c +++ b/Engine/lib/sdl/test/testshader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testshape.c b/Engine/lib/sdl/test/testshape.c index 476fac21e..7e451e667 100644 --- a/Engine/lib/sdl/test/testshape.c +++ b/Engine/lib/sdl/test/testshape.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,7 +48,6 @@ int main(int argc,char** argv) SDL_Renderer *renderer; SDL_Color black = {0,0,0,0xff}; SDL_Event event; - int event_pending = 0; int should_exit = 0; unsigned int current_picture; int button_down; @@ -81,7 +80,6 @@ int main(int argc,char** argv) pictures[i].surface = SDL_LoadBMP(argv[i+1]); pictures[i].name = argv[i+1]; if(pictures[i].surface == NULL) { - j = 0; for(j=0;j + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,7 +99,12 @@ LoadSprite(const char *file) SDL_FreeSurface(temp); return (-1); } - SDL_SetTextureBlendMode(sprites[i], blendMode); + if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + SDL_DestroyTexture(sprites[i]); + return (-1); + } } SDL_FreeSurface(temp); @@ -295,6 +300,9 @@ main(int argc, char *argv[]) } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) { blendMode = SDL_BLENDMODE_MOD; consumed = 2; + } else if (SDL_strcasecmp(argv[i + 1], "sub") == 0) { + blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT); + consumed = 2; } } } else if (SDL_strcasecmp(argv[i], "--iterations") == 0) { diff --git a/Engine/lib/sdl/test/testspriteminimal.c b/Engine/lib/sdl/test/testspriteminimal.c index 05f97309c..92560002a 100644 --- a/Engine/lib/sdl/test/testspriteminimal.c +++ b/Engine/lib/sdl/test/testspriteminimal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/teststreaming.c b/Engine/lib/sdl/test/teststreaming.c index 86cc13917..7ec689106 100644 --- a/Engine/lib/sdl/test/teststreaming.c +++ b/Engine/lib/sdl/test/teststreaming.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testthread.c b/Engine/lib/sdl/test/testthread.c index 90e2c60c5..cdccfc499 100644 --- a/Engine/lib/sdl/test/testthread.c +++ b/Engine/lib/sdl/test/testthread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testtimer.c b/Engine/lib/sdl/test/testtimer.c index 32b749098..34764c1c9 100644 --- a/Engine/lib/sdl/test/testtimer.c +++ b/Engine/lib/sdl/test/testtimer.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testver.c b/Engine/lib/sdl/test/testver.c index f0e3bcf3c..1ae008345 100644 --- a/Engine/lib/sdl/test/testver.c +++ b/Engine/lib/sdl/test/testver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testviewport.c b/Engine/lib/sdl/test/testviewport.c index 7ed4e6ec3..4b8d20e76 100644 --- a/Engine/lib/sdl/test/testviewport.c +++ b/Engine/lib/sdl/test/testviewport.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testvulkan.c b/Engine/lib/sdl/test/testvulkan.c new file mode 100644 index 000000000..73a21859a --- /dev/null +++ b/Engine/lib/sdl/test/testvulkan.c @@ -0,0 +1,1201 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include +#include +#include + +#include "SDL_test_common.h" + +#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) + +int main(int argc, char *argv[]) +{ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Vulkan support on this system\n"); + return 1; +} + +#else + +#define VK_NO_PROTOTYPES +#ifdef HAVE_VULKAN_H +#include +#else +/* SDL includes a copy for building on systems without the Vulkan SDK */ +#include "../src/video/khronos/vulkan/vulkan.h" +#endif +#include "SDL_vulkan.h" + +#ifndef UINT64_MAX /* VS2008 */ +#define UINT64_MAX 18446744073709551615 +#endif + +#define VULKAN_FUNCTIONS() \ + VULKAN_DEVICE_FUNCTION(vkAcquireNextImageKHR) \ + VULKAN_DEVICE_FUNCTION(vkAllocateCommandBuffers) \ + VULKAN_DEVICE_FUNCTION(vkBeginCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkCmdClearColorImage) \ + VULKAN_DEVICE_FUNCTION(vkCmdPipelineBarrier) \ + VULKAN_DEVICE_FUNCTION(vkCreateCommandPool) \ + VULKAN_DEVICE_FUNCTION(vkCreateFence) \ + VULKAN_DEVICE_FUNCTION(vkCreateImageView) \ + VULKAN_DEVICE_FUNCTION(vkCreateSemaphore) \ + VULKAN_DEVICE_FUNCTION(vkCreateSwapchainKHR) \ + VULKAN_DEVICE_FUNCTION(vkDestroyCommandPool) \ + VULKAN_DEVICE_FUNCTION(vkDestroyDevice) \ + VULKAN_DEVICE_FUNCTION(vkDestroyFence) \ + VULKAN_DEVICE_FUNCTION(vkDestroyImageView) \ + VULKAN_DEVICE_FUNCTION(vkDestroySemaphore) \ + VULKAN_DEVICE_FUNCTION(vkDestroySwapchainKHR) \ + VULKAN_DEVICE_FUNCTION(vkDeviceWaitIdle) \ + VULKAN_DEVICE_FUNCTION(vkEndCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkFreeCommandBuffers) \ + VULKAN_DEVICE_FUNCTION(vkGetDeviceQueue) \ + VULKAN_DEVICE_FUNCTION(vkGetFenceStatus) \ + VULKAN_DEVICE_FUNCTION(vkGetSwapchainImagesKHR) \ + VULKAN_DEVICE_FUNCTION(vkQueuePresentKHR) \ + VULKAN_DEVICE_FUNCTION(vkQueueSubmit) \ + VULKAN_DEVICE_FUNCTION(vkResetCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkResetFences) \ + VULKAN_DEVICE_FUNCTION(vkWaitForFences) \ + VULKAN_GLOBAL_FUNCTION(vkCreateInstance) \ + VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceExtensionProperties) \ + VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceLayerProperties) \ + VULKAN_INSTANCE_FUNCTION(vkCreateDevice) \ + VULKAN_INSTANCE_FUNCTION(vkDestroyInstance) \ + VULKAN_INSTANCE_FUNCTION(vkDestroySurfaceKHR) \ + VULKAN_INSTANCE_FUNCTION(vkEnumerateDeviceExtensionProperties) \ + VULKAN_INSTANCE_FUNCTION(vkEnumeratePhysicalDevices) \ + VULKAN_INSTANCE_FUNCTION(vkGetDeviceProcAddr) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceFeatures) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceProperties) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceQueueFamilyProperties) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR) + +#define VULKAN_DEVICE_FUNCTION(name) static PFN_##name name = NULL; +#define VULKAN_GLOBAL_FUNCTION(name) static PFN_##name name = NULL; +#define VULKAN_INSTANCE_FUNCTION(name) static PFN_##name name = NULL; +VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +static PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + +/* Based on the headers found in + * https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers + */ +#if VK_HEADER_VERSION < 22 +enum +{ + VK_ERROR_FRAGMENTED_POOL = -12, +}; +#endif +#if VK_HEADER_VERSION < 38 +enum { + VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000 +}; +#endif + +static const char *getVulkanResultString(VkResult result) +{ + switch((int)result) + { + case VK_SUCCESS: + return "VK_SUCCESS"; + case VK_NOT_READY: + return "VK_NOT_READY"; + case VK_TIMEOUT: + return "VK_TIMEOUT"; + case VK_EVENT_SET: + return "VK_EVENT_SET"; + case VK_EVENT_RESET: + return "VK_EVENT_RESET"; + case VK_INCOMPLETE: + return "VK_INCOMPLETE"; + case VK_ERROR_OUT_OF_HOST_MEMORY: + return "VK_ERROR_OUT_OF_HOST_MEMORY"; + case VK_ERROR_OUT_OF_DEVICE_MEMORY: + return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; + case VK_ERROR_INITIALIZATION_FAILED: + return "VK_ERROR_INITIALIZATION_FAILED"; + case VK_ERROR_DEVICE_LOST: + return "VK_ERROR_DEVICE_LOST"; + case VK_ERROR_MEMORY_MAP_FAILED: + return "VK_ERROR_MEMORY_MAP_FAILED"; + case VK_ERROR_LAYER_NOT_PRESENT: + return "VK_ERROR_LAYER_NOT_PRESENT"; + case VK_ERROR_EXTENSION_NOT_PRESENT: + return "VK_ERROR_EXTENSION_NOT_PRESENT"; + case VK_ERROR_FEATURE_NOT_PRESENT: + return "VK_ERROR_FEATURE_NOT_PRESENT"; + case VK_ERROR_INCOMPATIBLE_DRIVER: + return "VK_ERROR_INCOMPATIBLE_DRIVER"; + case VK_ERROR_TOO_MANY_OBJECTS: + return "VK_ERROR_TOO_MANY_OBJECTS"; + case VK_ERROR_FORMAT_NOT_SUPPORTED: + return "VK_ERROR_FORMAT_NOT_SUPPORTED"; + case VK_ERROR_FRAGMENTED_POOL: + return "VK_ERROR_FRAGMENTED_POOL"; + case VK_ERROR_SURFACE_LOST_KHR: + return "VK_ERROR_SURFACE_LOST_KHR"; + case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: + return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; + case VK_SUBOPTIMAL_KHR: + return "VK_SUBOPTIMAL_KHR"; + case VK_ERROR_OUT_OF_DATE_KHR: + return "VK_ERROR_OUT_OF_DATE_KHR"; + case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: + return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; + case VK_ERROR_VALIDATION_FAILED_EXT: + return "VK_ERROR_VALIDATION_FAILED_EXT"; + case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: + return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; + case VK_ERROR_INVALID_SHADER_NV: + return "VK_ERROR_INVALID_SHADER_NV"; + case VK_RESULT_MAX_ENUM: + case VK_RESULT_RANGE_SIZE: + break; + } + if(result < 0) + return "VK_ERROR_"; + return "VK_"; +} + +typedef struct VulkanContext +{ + VkInstance instance; + VkDevice device; + VkSurfaceKHR surface; + VkSwapchainKHR swapchain; + VkPhysicalDeviceProperties physicalDeviceProperties; + VkPhysicalDeviceFeatures physicalDeviceFeatures; + uint32_t graphicsQueueFamilyIndex; + uint32_t presentQueueFamilyIndex; + VkPhysicalDevice physicalDevice; + VkQueue graphicsQueue; + VkQueue presentQueue; + VkSemaphore imageAvailableSemaphore; + VkSemaphore renderingFinishedSemaphore; + VkSurfaceCapabilitiesKHR surfaceCapabilities; + VkSurfaceFormatKHR *surfaceFormats; + uint32_t surfaceFormatsAllocatedCount; + uint32_t surfaceFormatsCount; + uint32_t swapchainDesiredImageCount; + VkSurfaceFormatKHR surfaceFormat; + VkExtent2D swapchainSize; + VkCommandPool commandPool; + uint32_t swapchainImageCount; + VkImage *swapchainImages; + VkCommandBuffer *commandBuffers; + VkFence *fences; +} VulkanContext; + +static SDLTest_CommonState *state; +static VulkanContext vulkanContext = {0}; + +static void shutdownVulkan(void); + +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ +static void quit(int rc) +{ + shutdownVulkan(); + SDLTest_CommonQuit(state); + exit(rc); +} + +static void loadGlobalFunctions(void) +{ + vkGetInstanceProcAddr = SDL_Vulkan_GetVkGetInstanceProcAddr(); + if(!vkGetInstanceProcAddr) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetVkGetInstanceProcAddr(): %s\n", + SDL_GetError()); + quit(2); + } + +#define VULKAN_DEVICE_FUNCTION(name) +#define VULKAN_GLOBAL_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(VK_NULL_HANDLE, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(VK_NULL_HANDLE, \"" #name "\") failed\n"); \ + quit(2); \ + } +#define VULKAN_INSTANCE_FUNCTION(name) + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +static void createInstance(void) +{ + VkApplicationInfo appInfo = {0}; + VkInstanceCreateInfo instanceCreateInfo = {0}; + const char **extensions = NULL; + unsigned extensionCount = 0; + VkResult result; + + + appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + appInfo.apiVersion = VK_API_VERSION_1_0; + instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + instanceCreateInfo.pApplicationInfo = &appInfo; + if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, NULL)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetInstanceExtensions(): %s\n", + SDL_GetError()); + quit(2); + } + extensions = SDL_malloc(sizeof(const char *) * extensionCount); + if(!extensions) + { + SDL_OutOfMemory(); + quit(2); + } + if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, extensions)) + { + SDL_free((void*)extensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetInstanceExtensions(): %s\n", + SDL_GetError()); + quit(2); + } + instanceCreateInfo.enabledExtensionCount = extensionCount; + instanceCreateInfo.ppEnabledExtensionNames = extensions; + result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext.instance); + SDL_free((void*)extensions); + if(result != VK_SUCCESS) + { + vulkanContext.instance = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateInstance(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void loadInstanceFunctions(void) +{ +#define VULKAN_DEVICE_FUNCTION(name) +#define VULKAN_GLOBAL_FUNCTION(name) +#define VULKAN_INSTANCE_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(vulkanContext.instance, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(instance, \"" #name "\") failed\n"); \ + quit(2); \ + } + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +static void createSurface(void) +{ + if(!SDL_Vulkan_CreateSurface(state->windows[0], + vulkanContext.instance, + &vulkanContext.surface)) + { + vulkanContext.surface = VK_NULL_HANDLE; + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_CreateSurface(): %s\n", SDL_GetError()); + quit(2); + } +} + +static void findPhysicalDevice(void) +{ + uint32_t physicalDeviceCount = 0; + VkPhysicalDevice *physicalDevices; + VkQueueFamilyProperties *queueFamiliesProperties = NULL; + uint32_t queueFamiliesPropertiesAllocatedSize = 0; + VkExtensionProperties *deviceExtensions = NULL; + uint32_t deviceExtensionsAllocatedSize = 0; + uint32_t physicalDeviceIndex; + + VkResult result = + vkEnumeratePhysicalDevices(vulkanContext.instance, &physicalDeviceCount, NULL); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(physicalDeviceCount == 0) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): no physical devices\n"); + quit(2); + } + physicalDevices = SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount); + if(!physicalDevices) + { + SDL_OutOfMemory(); + quit(2); + } + result = + vkEnumeratePhysicalDevices(vulkanContext.instance, &physicalDeviceCount, physicalDevices); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): %s\n", + getVulkanResultString(result)); + quit(2); + } + vulkanContext.physicalDevice = NULL; + for(physicalDeviceIndex = 0; physicalDeviceIndex < physicalDeviceCount; + physicalDeviceIndex++) + { + uint32_t queueFamiliesCount = 0; + uint32_t queueFamilyIndex; + uint32_t deviceExtensionCount = 0; + SDL_bool hasSwapchainExtension = SDL_FALSE; + uint32_t i; + + + VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex]; + vkGetPhysicalDeviceProperties(physicalDevice, &vulkanContext.physicalDeviceProperties); + if(VK_VERSION_MAJOR(vulkanContext.physicalDeviceProperties.apiVersion) < 1) + continue; + vkGetPhysicalDeviceFeatures(physicalDevice, &vulkanContext.physicalDeviceFeatures); + vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamiliesCount, NULL); + if(queueFamiliesCount == 0) + continue; + if(queueFamiliesPropertiesAllocatedSize < queueFamiliesCount) + { + SDL_free(queueFamiliesProperties); + queueFamiliesPropertiesAllocatedSize = queueFamiliesCount; + queueFamiliesProperties = + SDL_malloc(sizeof(VkQueueFamilyProperties) * queueFamiliesPropertiesAllocatedSize); + if(!queueFamiliesProperties) + { + SDL_free(physicalDevices); + SDL_free(deviceExtensions); + SDL_OutOfMemory(); + quit(2); + } + } + vkGetPhysicalDeviceQueueFamilyProperties( + physicalDevice, &queueFamiliesCount, queueFamiliesProperties); + vulkanContext.graphicsQueueFamilyIndex = queueFamiliesCount; + vulkanContext.presentQueueFamilyIndex = queueFamiliesCount; + for(queueFamilyIndex = 0; queueFamilyIndex < queueFamiliesCount; + queueFamilyIndex++) + { + VkBool32 supported = 0; + + if(queueFamiliesProperties[queueFamilyIndex].queueCount == 0) + continue; + if(queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) + vulkanContext.graphicsQueueFamilyIndex = queueFamilyIndex; + result = vkGetPhysicalDeviceSurfaceSupportKHR( + physicalDevice, queueFamilyIndex, vulkanContext.surface, &supported); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceSupportKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(supported) + { + vulkanContext.presentQueueFamilyIndex = queueFamilyIndex; + if(queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) + break; // use this queue because it can present and do graphics + } + } + if(vulkanContext.graphicsQueueFamilyIndex == queueFamiliesCount) // no good queues found + continue; + if(vulkanContext.presentQueueFamilyIndex == queueFamiliesCount) // no good queues found + continue; + result = + vkEnumerateDeviceExtensionProperties(physicalDevice, NULL, &deviceExtensionCount, NULL); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumerateDeviceExtensionProperties(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(deviceExtensionCount == 0) + continue; + if(deviceExtensionsAllocatedSize < deviceExtensionCount) + { + SDL_free(deviceExtensions); + deviceExtensionsAllocatedSize = deviceExtensionCount; + deviceExtensions = + SDL_malloc(sizeof(VkExtensionProperties) * deviceExtensionsAllocatedSize); + if(!deviceExtensions) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_OutOfMemory(); + quit(2); + } + } + result = vkEnumerateDeviceExtensionProperties( + physicalDevice, NULL, &deviceExtensionCount, deviceExtensions); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumerateDeviceExtensionProperties(): %s\n", + getVulkanResultString(result)); + quit(2); + } + for(i = 0; i < deviceExtensionCount; i++) + { + if(0 == SDL_strcmp(deviceExtensions[i].extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME)) + { + hasSwapchainExtension = SDL_TRUE; + break; + } + } + if(!hasSwapchainExtension) + continue; + vulkanContext.physicalDevice = physicalDevice; + break; + } + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + if(!vulkanContext.physicalDevice) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Vulkan: no viable physical devices found"); + quit(2); + } +} + +static void createDevice(void) +{ + VkDeviceQueueCreateInfo deviceQueueCreateInfo[1] = {0}; + static const float queuePriority[] = {1.0f}; + VkDeviceCreateInfo deviceCreateInfo = {0}; + static const char *const deviceExtensionNames[] = { + VK_KHR_SWAPCHAIN_EXTENSION_NAME, + }; + VkResult result; + + deviceQueueCreateInfo->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; + deviceQueueCreateInfo->queueFamilyIndex = vulkanContext.graphicsQueueFamilyIndex; + deviceQueueCreateInfo->queueCount = 1; + deviceQueueCreateInfo->pQueuePriorities = &queuePriority[0]; + + deviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; + deviceCreateInfo.queueCreateInfoCount = 1; + deviceCreateInfo.pQueueCreateInfos = deviceQueueCreateInfo; + deviceCreateInfo.pEnabledFeatures = NULL; + deviceCreateInfo.enabledExtensionCount = SDL_arraysize(deviceExtensionNames); + deviceCreateInfo.ppEnabledExtensionNames = deviceExtensionNames; + result = vkCreateDevice( + vulkanContext.physicalDevice, &deviceCreateInfo, NULL, &vulkanContext.device); + if(result != VK_SUCCESS) + { + vulkanContext.device = VK_NULL_HANDLE; + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkCreateDevice(): %s\n", getVulkanResultString(result)); + quit(2); + } +} + +static void loadDeviceFunctions(void) +{ +#define VULKAN_DEVICE_FUNCTION(name) \ + name = (PFN_##name)vkGetDeviceProcAddr(vulkanContext.device, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetDeviceProcAddr(device, \"" #name "\") failed\n"); \ + quit(2); \ + } +#define VULKAN_GLOBAL_FUNCTION(name) +#define VULKAN_INSTANCE_FUNCTION(name) + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +#undef VULKAN_FUNCTIONS + +static void getQueues(void) +{ + vkGetDeviceQueue(vulkanContext.device, + vulkanContext.graphicsQueueFamilyIndex, + 0, + &vulkanContext.graphicsQueue); + if(vulkanContext.graphicsQueueFamilyIndex != vulkanContext.presentQueueFamilyIndex) + vkGetDeviceQueue(vulkanContext.device, + vulkanContext.presentQueueFamilyIndex, + 0, + &vulkanContext.presentQueue); + else + vulkanContext.presentQueue = vulkanContext.graphicsQueue; +} + +static void createSemaphore(VkSemaphore *semaphore) +{ + VkResult result; + + VkSemaphoreCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + result = vkCreateSemaphore(vulkanContext.device, &createInfo, NULL, semaphore); + if(result != VK_SUCCESS) + { + *semaphore = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateSemaphore(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createSemaphores(void) +{ + createSemaphore(&vulkanContext.imageAvailableSemaphore); + createSemaphore(&vulkanContext.renderingFinishedSemaphore); +} + +static void getSurfaceCaps(void) +{ + VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + vulkanContext.physicalDevice, vulkanContext.surface, &vulkanContext.surfaceCapabilities); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + + // check surface usage + if(!(vulkanContext.surfaceCapabilities.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_DST_BIT)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Vulkan surface doesn't support VK_IMAGE_USAGE_TRANSFER_DST_BIT\n"); + quit(2); + } +} + +static void getSurfaceFormats(void) +{ + VkResult result = vkGetPhysicalDeviceSurfaceFormatsKHR(vulkanContext.physicalDevice, + vulkanContext.surface, + &vulkanContext.surfaceFormatsCount, + NULL); + if(result != VK_SUCCESS) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(vulkanContext.surfaceFormatsCount > vulkanContext.surfaceFormatsAllocatedCount) + { + vulkanContext.surfaceFormatsAllocatedCount = vulkanContext.surfaceFormatsCount; + SDL_free(vulkanContext.surfaceFormats); + vulkanContext.surfaceFormats = + SDL_malloc(sizeof(VkSurfaceFormatKHR) * vulkanContext.surfaceFormatsAllocatedCount); + if(!vulkanContext.surfaceFormats) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_OutOfMemory(); + quit(2); + } + } + result = vkGetPhysicalDeviceSurfaceFormatsKHR(vulkanContext.physicalDevice, + vulkanContext.surface, + &vulkanContext.surfaceFormatsCount, + vulkanContext.surfaceFormats); + if(result != VK_SUCCESS) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void getSwapchainImages(void) +{ + VkResult result; + + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; + result = vkGetSwapchainImagesKHR( + vulkanContext.device, vulkanContext.swapchain, &vulkanContext.swapchainImageCount, NULL); + if(result != VK_SUCCESS) + { + vulkanContext.swapchainImageCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetSwapchainImagesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + vulkanContext.swapchainImages = SDL_malloc(sizeof(VkImage) * vulkanContext.swapchainImageCount); + if(!vulkanContext.swapchainImages) + { + SDL_OutOfMemory(); + quit(2); + } + result = vkGetSwapchainImagesKHR(vulkanContext.device, + vulkanContext.swapchain, + &vulkanContext.swapchainImageCount, + vulkanContext.swapchainImages); + if(result != VK_SUCCESS) + { + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; + vulkanContext.swapchainImageCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetSwapchainImagesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static SDL_bool createSwapchain(void) +{ + uint32_t i; + int w, h; + VkSwapchainCreateInfoKHR createInfo = {0}; + VkResult result; + + // pick an image count + vulkanContext.swapchainDesiredImageCount = vulkanContext.surfaceCapabilities.minImageCount + 1; + if(vulkanContext.swapchainDesiredImageCount > vulkanContext.surfaceCapabilities.maxImageCount + && vulkanContext.surfaceCapabilities.maxImageCount > 0) + vulkanContext.swapchainDesiredImageCount = vulkanContext.surfaceCapabilities.maxImageCount; + + // pick a format + if(vulkanContext.surfaceFormatsCount == 1 + && vulkanContext.surfaceFormats[0].format == VK_FORMAT_UNDEFINED) + { + // aren't any preferred formats, so we pick + vulkanContext.surfaceFormat.colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR; + vulkanContext.surfaceFormat.format = VK_FORMAT_R8G8B8A8_UNORM; + } + else + { + vulkanContext.surfaceFormat = vulkanContext.surfaceFormats[0]; + for(i = 0; i < vulkanContext.surfaceFormatsCount; i++) + { + if(vulkanContext.surfaceFormats[i].format == VK_FORMAT_R8G8B8A8_UNORM) + { + vulkanContext.surfaceFormat = vulkanContext.surfaceFormats[i]; + break; + } + } + } + + // get size + SDL_Vulkan_GetDrawableSize(state->windows[0], &w, &h); + vulkanContext.swapchainSize.width = w; + vulkanContext.swapchainSize.height = h; + if(w == 0 || h == 0) + return SDL_FALSE; + + createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + createInfo.surface = vulkanContext.surface; + createInfo.minImageCount = vulkanContext.swapchainDesiredImageCount; + createInfo.imageFormat = vulkanContext.surfaceFormat.format; + createInfo.imageColorSpace = vulkanContext.surfaceFormat.colorSpace; + createInfo.imageExtent = vulkanContext.swapchainSize; + createInfo.imageArrayLayers = 1; + createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; + createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; + createInfo.preTransform = vulkanContext.surfaceCapabilities.currentTransform; + createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; + createInfo.presentMode = VK_PRESENT_MODE_FIFO_KHR; + createInfo.clipped = VK_TRUE; + createInfo.oldSwapchain = vulkanContext.swapchain; + result = + vkCreateSwapchainKHR(vulkanContext.device, &createInfo, NULL, &vulkanContext.swapchain); + if(createInfo.oldSwapchain) + vkDestroySwapchainKHR(vulkanContext.device, createInfo.oldSwapchain, NULL); + if(result != VK_SUCCESS) + { + vulkanContext.swapchain = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateSwapchainKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + getSwapchainImages(); + return SDL_TRUE; +} + +static void destroySwapchain(void) +{ + if(vulkanContext.swapchain) + vkDestroySwapchainKHR(vulkanContext.device, vulkanContext.swapchain, NULL); + vulkanContext.swapchain = VK_NULL_HANDLE; + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; +} + +static void destroyCommandBuffers(void) +{ + if(vulkanContext.commandBuffers) + vkFreeCommandBuffers(vulkanContext.device, + vulkanContext.commandPool, + vulkanContext.swapchainImageCount, + vulkanContext.commandBuffers); + SDL_free(vulkanContext.commandBuffers); + vulkanContext.commandBuffers = NULL; +} + +static void destroyCommandPool(void) +{ + if(vulkanContext.commandPool) + vkDestroyCommandPool(vulkanContext.device, vulkanContext.commandPool, NULL); + vulkanContext.commandPool = VK_NULL_HANDLE; +} + +static void createCommandPool(void) +{ + VkResult result; + + VkCommandPoolCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; + createInfo.flags = + VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT; + createInfo.queueFamilyIndex = vulkanContext.graphicsQueueFamilyIndex; + result = + vkCreateCommandPool(vulkanContext.device, &createInfo, NULL, &vulkanContext.commandPool); + if(result != VK_SUCCESS) + { + vulkanContext.commandPool = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateCommandPool(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createCommandBuffers(void) +{ + VkResult result; + + VkCommandBufferAllocateInfo allocateInfo = {0}; + allocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; + allocateInfo.commandPool = vulkanContext.commandPool; + allocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + allocateInfo.commandBufferCount = vulkanContext.swapchainImageCount; + vulkanContext.commandBuffers = + SDL_malloc(sizeof(VkCommandBuffer) * vulkanContext.swapchainImageCount); + result = + vkAllocateCommandBuffers(vulkanContext.device, &allocateInfo, vulkanContext.commandBuffers); + if(result != VK_SUCCESS) + { + SDL_free(vulkanContext.commandBuffers); + vulkanContext.commandBuffers = NULL; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkAllocateCommandBuffers(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createFences(void) +{ + uint32_t i; + + vulkanContext.fences = SDL_malloc(sizeof(VkFence) * vulkanContext.swapchainImageCount); + if(!vulkanContext.fences) + { + SDL_OutOfMemory(); + quit(2); + } + for(i = 0; i < vulkanContext.swapchainImageCount; i++) + { + VkResult result; + + VkFenceCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; + createInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT; + result = + vkCreateFence(vulkanContext.device, &createInfo, NULL, &vulkanContext.fences[i]); + if(result != VK_SUCCESS) + { + for(; i > 0; i--) + { + vkDestroyFence(vulkanContext.device, vulkanContext.fences[i - 1], NULL); + } + SDL_free(vulkanContext.fences); + vulkanContext.fences = NULL; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateFence(): %s\n", + getVulkanResultString(result)); + quit(2); + } + } +} + +static void destroyFences(void) +{ + uint32_t i; + + if(!vulkanContext.fences) + return; + for(i = 0; i < vulkanContext.swapchainImageCount; i++) + { + vkDestroyFence(vulkanContext.device, vulkanContext.fences[i], NULL); + } + SDL_free(vulkanContext.fences); + vulkanContext.fences = NULL; +} + +static void recordPipelineImageBarrier(VkCommandBuffer commandBuffer, + VkAccessFlags sourceAccessMask, + VkAccessFlags destAccessMask, + VkImageLayout sourceLayout, + VkImageLayout destLayout, + VkImage image) +{ + VkImageMemoryBarrier barrier = {0}; + barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barrier.srcAccessMask = sourceAccessMask; + barrier.dstAccessMask = destAccessMask; + barrier.oldLayout = sourceLayout; + barrier.newLayout = destLayout; + barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.image = image; + barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barrier.subresourceRange.baseMipLevel = 0; + barrier.subresourceRange.levelCount = 1; + barrier.subresourceRange.baseArrayLayer = 0; + barrier.subresourceRange.layerCount = 1; + vkCmdPipelineBarrier(commandBuffer, + VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, + 0, + 0, + NULL, + 0, + NULL, + 1, + &barrier); +} + +static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue *clearColor) +{ + VkCommandBuffer commandBuffer = vulkanContext.commandBuffers[frameIndex]; + VkImage image = vulkanContext.swapchainImages[frameIndex]; + VkCommandBufferBeginInfo beginInfo = {0}; + VkImageSubresourceRange clearRange = {0}; + + VkResult result = vkResetCommandBuffer(commandBuffer, 0); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkResetCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } + beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; + beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; + result = vkBeginCommandBuffer(commandBuffer, &beginInfo); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkBeginCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } + recordPipelineImageBarrier(commandBuffer, + 0, + VK_ACCESS_TRANSFER_WRITE_BIT, + VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + image); + clearRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + clearRange.baseMipLevel = 0; + clearRange.levelCount = 1; + clearRange.baseArrayLayer = 0; + clearRange.layerCount = 1; + vkCmdClearColorImage( + commandBuffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, clearColor, 1, &clearRange); + recordPipelineImageBarrier(commandBuffer, + VK_ACCESS_TRANSFER_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, + image); + result = vkEndCommandBuffer(commandBuffer); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEndCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void destroySwapchainAndSwapchainSpecificStuff(SDL_bool doDestroySwapchain) +{ + destroyFences(); + destroyCommandBuffers(); + destroyCommandPool(); + if(doDestroySwapchain) + destroySwapchain(); +} + +static SDL_bool createNewSwapchainAndSwapchainSpecificStuff(void) +{ + destroySwapchainAndSwapchainSpecificStuff(SDL_FALSE); + getSurfaceCaps(); + getSurfaceFormats(); + if(!createSwapchain()) + return SDL_FALSE; + createCommandPool(); + createCommandBuffers(); + createFences(); + return SDL_TRUE; +} + +static void initVulkan(void) +{ + SDL_Vulkan_LoadLibrary(NULL); + SDL_memset(&vulkanContext, 0, sizeof(VulkanContext)); + loadGlobalFunctions(); + createInstance(); + loadInstanceFunctions(); + createSurface(); + findPhysicalDevice(); + createDevice(); + loadDeviceFunctions(); + getQueues(); + createSemaphores(); + createNewSwapchainAndSwapchainSpecificStuff(); +} + +static void shutdownVulkan(void) +{ + if(vulkanContext.device && vkDeviceWaitIdle) + vkDeviceWaitIdle(vulkanContext.device); + destroySwapchainAndSwapchainSpecificStuff(SDL_TRUE); + if(vulkanContext.imageAvailableSemaphore && vkDestroySemaphore) + vkDestroySemaphore(vulkanContext.device, vulkanContext.imageAvailableSemaphore, NULL); + if(vulkanContext.renderingFinishedSemaphore && vkDestroySemaphore) + vkDestroySemaphore(vulkanContext.device, vulkanContext.renderingFinishedSemaphore, NULL); + if(vulkanContext.device && vkDestroyDevice) + vkDestroyDevice(vulkanContext.device, NULL); + if(vulkanContext.surface && vkDestroySurfaceKHR) + vkDestroySurfaceKHR(vulkanContext.instance, vulkanContext.surface, NULL); + if(vulkanContext.instance && vkDestroyInstance) + vkDestroyInstance(vulkanContext.instance, NULL); + SDL_free(vulkanContext.surfaceFormats); + SDL_Vulkan_UnloadLibrary(); +} + +static SDL_bool render(void) +{ + uint32_t frameIndex; + VkResult result; + double currentTime; + VkClearColorValue clearColor = {0}; + VkPipelineStageFlags waitDestStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; + VkSubmitInfo submitInfo = {0}; + VkPresentInfoKHR presentInfo = {0}; + int w, h; + + if(!vulkanContext.swapchain) + { + SDL_bool retval = createNewSwapchainAndSwapchainSpecificStuff(); + if(!retval) + SDL_Delay(100); + return retval; + } + result = vkAcquireNextImageKHR(vulkanContext.device, + vulkanContext.swapchain, + UINT64_MAX, + vulkanContext.imageAvailableSemaphore, + VK_NULL_HANDLE, + &frameIndex); + if(result == VK_ERROR_OUT_OF_DATE_KHR) + return createNewSwapchainAndSwapchainSpecificStuff(); + if(result != VK_SUBOPTIMAL_KHR && result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkAcquireNextImageKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + result = vkWaitForFences( + vulkanContext.device, 1, &vulkanContext.fences[frameIndex], VK_FALSE, UINT64_MAX); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkWaitForFences(): %s\n", getVulkanResultString(result)); + quit(2); + } + result = vkResetFences(vulkanContext.device, 1, &vulkanContext.fences[frameIndex]); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkResetFences(): %s\n", getVulkanResultString(result)); + quit(2); + } + currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency(); + clearColor.float32[0] = (float)(0.5 + 0.5 * SDL_sin(currentTime)); + clearColor.float32[1] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 2 / 3)); + clearColor.float32[2] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 4 / 3)); + clearColor.float32[3] = 1; + rerecordCommandBuffer(frameIndex, &clearColor); + submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; + submitInfo.waitSemaphoreCount = 1; + submitInfo.pWaitSemaphores = &vulkanContext.imageAvailableSemaphore; + submitInfo.pWaitDstStageMask = &waitDestStageMask; + submitInfo.commandBufferCount = 1; + submitInfo.pCommandBuffers = &vulkanContext.commandBuffers[frameIndex]; + submitInfo.signalSemaphoreCount = 1; + submitInfo.pSignalSemaphores = &vulkanContext.renderingFinishedSemaphore; + result = vkQueueSubmit( + vulkanContext.graphicsQueue, 1, &submitInfo, vulkanContext.fences[frameIndex]); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkQueueSubmit(): %s\n", getVulkanResultString(result)); + quit(2); + } + presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; + presentInfo.waitSemaphoreCount = 1; + presentInfo.pWaitSemaphores = &vulkanContext.renderingFinishedSemaphore; + presentInfo.swapchainCount = 1; + presentInfo.pSwapchains = &vulkanContext.swapchain; + presentInfo.pImageIndices = &frameIndex; + result = vkQueuePresentKHR(vulkanContext.presentQueue, &presentInfo); + if(result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR) + { + return createNewSwapchainAndSwapchainSpecificStuff(); + } + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkQueuePresentKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + SDL_Vulkan_GetDrawableSize(state->windows[0], &w, &h); + if(w != (int)vulkanContext.swapchainSize.width || h != (int)vulkanContext.swapchainSize.height) + { + return createNewSwapchainAndSwapchainSpecificStuff(); + } + return SDL_TRUE; +} + +int main(int argc, char *argv[]) +{ + int fsaa, accel; + int i, done; + SDL_DisplayMode mode; + SDL_Event event; + Uint32 then, now, frames; + int dw, dh; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Initialize parameters */ + fsaa = 0; + accel = -1; + + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if(!state) + { + return 1; + } + for(i = 1; i < argc;) + { + int consumed; + + consumed = SDLTest_CommonArg(state, i); + if(consumed < 0) + { + SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); + quit(1); + } + i += consumed; + } + + /* Set Vulkan parameters */ + state->window_flags |= SDL_WINDOW_VULKAN; + state->num_windows = 1; + state->skip_renderer = 1; + + if(!SDLTest_CommonInit(state)) + { + quit(2); + } + + SDL_GetCurrentDisplayMode(0, &mode); + SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format)); + SDL_GetWindowSize(state->windows[0], &dw, &dh); + SDL_Log("Window Size : %d,%d\n", dw, dh); + SDL_Vulkan_GetDrawableSize(state->windows[0], &dw, &dh); + SDL_Log("Draw Size : %d,%d\n", dw, dh); + SDL_Log("\n"); + + initVulkan(); + + /* Main render loop */ + frames = 0; + then = SDL_GetTicks(); + done = 0; + while(!done) + { + /* Check for events */ + ++frames; + while(SDL_PollEvent(&event)) + { + SDLTest_CommonEvent(state, &event, &done); + } + + if(!done) + render(); + } + + /* Print out some timing information */ + now = SDL_GetTicks(); + if(now > then) + { + SDL_Log("%2.2f frames per second\n", ((double)frames * 1000) / (now - then)); + } + quit(0); + return 0; +} + +#endif diff --git a/Engine/lib/sdl/test/testwm2.c b/Engine/lib/sdl/test/testwm2.c index cd19e9f19..74a0fe028 100644 --- a/Engine/lib/sdl/test/testwm2.c +++ b/Engine/lib/sdl/test/testwm2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testyuv.bmp b/Engine/lib/sdl/test/testyuv.bmp new file mode 100644 index 0000000000000000000000000000000000000000..af32034b6b5b858be470f9ef3bb023bc199bf96e GIT binary patch literal 739398 zcma&P1(?<46SwcrmJpE?q(Ma`6$Fz|5D;lW#7@M(z{Kt@#O}ZVMCtCXU04>D*j;w% z?$&uf_nb59(ZBEYf4P|J`F5SNXYTK3W}c^6+ZIoIJa(%f@9XK zRYlWPtj>97TK$G+Yug%b=QldnF1qYIUv|Mob*$0Fb$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UbS1xZ)u7A4E|MvL$r`mlrj`^u)H}vBs z_S?O8>NmdCnPuq(7xZ|SpWlCPuj`va_pSc7Vw_*K-#l`AdtmidZS%7$+pC+;tZ)CF z(7(NdPxyesC33N{5-yqNls|7?G%Lp{f7rBW5}#7M690~T7gnh{>SaCu&m{2&l|E8T zf>Dx2R*7~JjU}uy>MkjZt}@$x$|GTw@JhA~tAtO+dVSna#hZ-UO7xHL$@n{*A`g#5 zQ^6x|mnLztxFhV5$}_l#QzopN&0ET*|1W?2cJR zRv9@3lZ>pg{x^rV4G$dFS>=82->YjW{6FGV!YYY%4KrW>@9_DKVUJZQzm9knz8~5O z-_PNnIlSj$ZGD^2T(#=bRm5L-cG6WOHk=MD-h*C(F(#by(Op;tgT(fRRlM7K&yTiZ zTlMgXI)39H9K&xRm+(on6fA;e#HB=Q!74`-cc?>4@T|%=guIK>fW#~s=Yvz^eJ;4- z8P8|WIq#L`y)aHD=c)a(d4TuYtL;-vu~)H2XNls6cVdWvPu_BQWQ{$FVdj6Qj9&7d zJzLjEs!r#Wx7vSgvu82QzWeUmK2os;(ti8x*FIP*)LE);ho|=F^LXel{igqDAvAyX z3CrOX{eOEdvfWyCmz?C z2Itt$HmMgMSC2>e`s6s6i+{)*{#S~Tz4-_IdqcjFXii-7KKswQU*)c=zcE4gq z-waq@`}uXvsdE1l54JVWu4`*I{kA>2Zf$SJK?^4H9Jp^5f4+R*U;1(})#RI*#yG*&VCQ>nh<6tP-D27z3M(%VCw2&GM<95(dE}JuYRs{j0yN zxS5J!vEK5(KeMnW^Uq3HV@w$2rFBQlw2*Om jBt=sRzu=VUD&v?R8p_Bke$VsC_&b`4JUWW?1FQTWq4AQd literal 0 HcmV?d00001 diff --git a/Engine/lib/sdl/test/testyuv.c b/Engine/lib/sdl/test/testyuv.c new file mode 100644 index 000000000..f52ab9f72 --- /dev/null +++ b/Engine/lib/sdl/test/testyuv.c @@ -0,0 +1,455 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include +#include + +#include "SDL.h" +#include "SDL_test_font.h" +#include "testyuv_cvt.h" + + +/* 422 (YUY2, etc) formats are the largest */ +#define MAX_YUV_SURFACE_SIZE(W, H, P) (H*4*(W+P+1)/2) + + +/* Return true if the YUV format is packed pixels */ +static SDL_bool is_packed_yuv_format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YUY2 || + format == SDL_PIXELFORMAT_UYVY || + format == SDL_PIXELFORMAT_YVYU); +} + +/* Create a surface with a good pattern for verifying YUV conversion */ +static SDL_Surface *generate_test_pattern(int pattern_size) +{ + SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(0, pattern_size, pattern_size, 0, SDL_PIXELFORMAT_RGB24); + + if (pattern) { + int i, x, y; + Uint8 *p, c; + const int thickness = 2; /* Important so 2x2 blocks of color are the same, to avoid Cr/Cb interpolation over pixels */ + + /* R, G, B in alternating horizontal bands */ + for (y = 0; y < pattern->h; y += thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (y + i) * pattern->pitch + ((y/thickness) % 3); + for (x = 0; x < pattern->w; ++x) { + *p = 0xFF; + p += 3; + } + } + } + + /* Black and white in alternating vertical bands */ + c = 0xFF; + for (x = 1*thickness; x < pattern->w; x += 2*thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (x + i)*3; + for (y = 0; y < pattern->h; ++y) { + SDL_memset(p, c, 3); + p += pattern->pitch; + } + } + if (c) { + c = 0x00; + } else { + c = 0xFF; + } + } + } + return pattern; +} + +static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_Surface *surface) +{ + const int tolerance = 20; + const int size = (surface->h * surface->pitch); + Uint8 *rgb; + SDL_bool result = SDL_FALSE; + + rgb = (Uint8 *)SDL_malloc(size); + if (!rgb) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); + return SDL_FALSE; + } + + if (SDL_ConvertPixels(surface->w, surface->h, format, yuv, yuv_pitch, surface->format->format, rgb, surface->pitch) == 0) { + int x, y; + result = SDL_TRUE; + for (y = 0; y < surface->h; ++y) { + const Uint8 *actual = rgb + y * surface->pitch; + const Uint8 *expected = (const Uint8 *)surface->pixels + y * surface->pitch; + for (x = 0; x < surface->w; ++x) { + int deltaR = (int)actual[0] - expected[0]; + int deltaG = (int)actual[1] - expected[1]; + int deltaB = (int)actual[2] - expected[2]; + int distance = (deltaR * deltaR + deltaG * deltaG + deltaB * deltaB); + if (distance > tolerance) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d\n", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance); + result = SDL_FALSE; + } + actual += 3; + expected += 3; + } + } + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format->format), SDL_GetError()); + } + SDL_free(rgb); + + return result; +} + +static int run_automated_tests(int pattern_size, int extra_pitch) +{ + const Uint32 formats[] = { + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21, + SDL_PIXELFORMAT_YUY2, + SDL_PIXELFORMAT_UYVY, + SDL_PIXELFORMAT_YVYU + }; + int i, j; + SDL_Surface *pattern = generate_test_pattern(pattern_size); + const int yuv_len = MAX_YUV_SURFACE_SIZE(pattern->w, pattern->h, extra_pitch); + Uint8 *yuv1 = (Uint8 *)SDL_malloc(yuv_len); + Uint8 *yuv2 = (Uint8 *)SDL_malloc(yuv_len); + int yuv1_pitch, yuv2_pitch; + int result = -1; + + if (!pattern || !yuv1 || !yuv2) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces"); + goto done; + } + + /* Verify conversion from YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + if (!ConvertRGBtoYUV(formats[i], pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, SDL_GetYUVConversionModeForResolution(pattern->w, pattern->h), 0, 100)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w); + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion to YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion between YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv2, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv2, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + /* Verify conversion between YUV formats in-place */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + if (is_packed_yuv_format(formats[i]) != is_packed_yuv_format(formats[j])) { + /* Can't change plane vs packed pixel layout in-place */ + continue; + } + + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv1, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv1, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + + result = 0; + +done: + SDL_free(yuv1); + SDL_free(yuv2); + SDL_FreeSurface(pattern); + return result; +} + +int +main(int argc, char **argv) +{ + struct { + SDL_bool enable_intrinsics; + int pattern_size; + int extra_pitch; + } automated_test_params[] = { + /* Test: even width and height */ + { SDL_FALSE, 2, 0 }, + { SDL_FALSE, 4, 0 }, + /* Test: odd width and height */ + { SDL_FALSE, 1, 0 }, + { SDL_FALSE, 3, 0 }, + /* Test: even width and height, extra pitch */ + { SDL_FALSE, 2, 3 }, + { SDL_FALSE, 4, 3 }, + /* Test: odd width and height, extra pitch */ + { SDL_FALSE, 1, 3 }, + { SDL_FALSE, 3, 3 }, + /* Test: even width and height with intrinsics */ + { SDL_TRUE, 32, 0 }, + /* Test: odd width and height with intrinsics */ + { SDL_TRUE, 33, 0 }, + { SDL_TRUE, 37, 0 }, + /* Test: even width and height with intrinsics, extra pitch */ + { SDL_TRUE, 32, 3 }, + /* Test: odd width and height with intrinsics, extra pitch */ + { SDL_TRUE, 33, 3 }, + { SDL_TRUE, 37, 3 }, + }; + int arg = 1; + const char *filename; + SDL_Surface *original; + SDL_Surface *converted; + SDL_Window *window; + SDL_Renderer *renderer; + SDL_Texture *output[3]; + const char *titles[3] = { "ORIGINAL", "SOFTWARE", "HARDWARE" }; + char title[128]; + const char *yuv_name; + const char *yuv_mode; + Uint32 rgb_format = SDL_PIXELFORMAT_RGBX8888; + Uint32 yuv_format = SDL_PIXELFORMAT_YV12; + int current = 0; + int pitch; + Uint8 *raw_yuv; + Uint32 then, now, i, iterations = 100; + SDL_bool should_run_automated_tests = SDL_FALSE; + + while (argv[arg] && *argv[arg] == '-') { + if (SDL_strcmp(argv[arg], "--jpeg") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_JPEG); + } else if (SDL_strcmp(argv[arg], "--bt601") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT601); + } else if (SDL_strcmp(argv[arg], "--bt709") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT709); + } else if (SDL_strcmp(argv[arg], "--auto") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_AUTOMATIC); + } else if (SDL_strcmp(argv[arg], "--yv12") == 0) { + yuv_format = SDL_PIXELFORMAT_YV12; + } else if (SDL_strcmp(argv[arg], "--iyuv") == 0) { + yuv_format = SDL_PIXELFORMAT_IYUV; + } else if (SDL_strcmp(argv[arg], "--yuy2") == 0) { + yuv_format = SDL_PIXELFORMAT_YUY2; + } else if (SDL_strcmp(argv[arg], "--uyvy") == 0) { + yuv_format = SDL_PIXELFORMAT_UYVY; + } else if (SDL_strcmp(argv[arg], "--yvyu") == 0) { + yuv_format = SDL_PIXELFORMAT_YVYU; + } else if (SDL_strcmp(argv[arg], "--nv12") == 0) { + yuv_format = SDL_PIXELFORMAT_NV12; + } else if (SDL_strcmp(argv[arg], "--nv21") == 0) { + yuv_format = SDL_PIXELFORMAT_NV21; + } else if (SDL_strcmp(argv[arg], "--rgb555") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB555; + } else if (SDL_strcmp(argv[arg], "--rgb565") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB565; + } else if (SDL_strcmp(argv[arg], "--rgb24") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB24; + } else if (SDL_strcmp(argv[arg], "--argb") == 0) { + rgb_format = SDL_PIXELFORMAT_ARGB8888; + } else if (SDL_strcmp(argv[arg], "--abgr") == 0) { + rgb_format = SDL_PIXELFORMAT_ABGR8888; + } else if (SDL_strcmp(argv[arg], "--rgba") == 0) { + rgb_format = SDL_PIXELFORMAT_RGBA8888; + } else if (SDL_strcmp(argv[arg], "--bgra") == 0) { + rgb_format = SDL_PIXELFORMAT_BGRA8888; + } else if (SDL_strcmp(argv[arg], "--automated") == 0) { + should_run_automated_tests = SDL_TRUE; + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--jpeg|--bt601|-bt709|--auto] [--yv12|--iyuv|--yuy2|--uyvy|--yvyu|--nv12|--nv21] [--rgb555|--rgb565|--rgb24|--argb|--abgr|--rgba|--bgra] [image_filename]\n", argv[0]); + return 1; + } + ++arg; + } + + /* Run automated tests */ + if (should_run_automated_tests) { + for (i = 0; i < SDL_arraysize(automated_test_params); ++i) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s\n", + automated_test_params[i].pattern_size, + automated_test_params[i].extra_pitch, + automated_test_params[i].enable_intrinsics ? "enabled" : "disabled"); + if (run_automated_tests(automated_test_params[i].pattern_size, automated_test_params[i].extra_pitch) < 0) { + return 2; + } + } + return 0; + } + + if (argv[arg]) { + filename = argv[arg]; + } else { + filename = "testyuv.bmp"; + } + original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0); + if (!original) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); + return 3; + } + + raw_yuv = SDL_calloc(1, MAX_YUV_SURFACE_SIZE(original->w, original->h, 0)); + ConvertRGBtoYUV(yuv_format, original->pixels, original->pitch, raw_yuv, original->w, original->h, + SDL_GetYUVConversionModeForResolution(original->w, original->h), + 0, 100); + pitch = CalculateYUVPitch(yuv_format, original->w); + + converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format); + if (!converted) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError()); + return 3; + } + + then = SDL_GetTicks(); + for ( i = 0; i < iterations; ++i ) { + SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch); + } + now = SDL_GetTicks(); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations); + + window = SDL_CreateWindow("YUV test", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + original->w, original->h, + 0); + if (!window) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + return 4; + } + + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + return 4; + } + + output[0] = SDL_CreateTextureFromSurface(renderer, original); + output[1] = SDL_CreateTextureFromSurface(renderer, converted); + output[2] = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, original->w, original->h); + if (!output[0] || !output[1] || !output[2]) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); + return 5; + } + SDL_UpdateTexture(output[2], NULL, raw_yuv, pitch); + + yuv_name = SDL_GetPixelFormatName(yuv_format); + if (SDL_strncmp(yuv_name, "SDL_PIXELFORMAT_", 16) == 0) { + yuv_name += 16; + } + + switch (SDL_GetYUVConversionModeForResolution(original->w, original->h)) { + case SDL_YUV_CONVERSION_JPEG: + yuv_mode = "JPEG"; + break; + case SDL_YUV_CONVERSION_BT601: + yuv_mode = "BT.601"; + break; + case SDL_YUV_CONVERSION_BT709: + yuv_mode = "BT.709"; + break; + default: + yuv_mode = "UNKNOWN"; + break; + } + + { int done = 0; + while ( !done ) + { + SDL_Event event; + while (SDL_PollEvent(&event) > 0) { + if (event.type == SDL_QUIT) { + done = 1; + } + if (event.type == SDL_KEYDOWN) { + if (event.key.keysym.sym == SDLK_ESCAPE) { + done = 1; + } else if (event.key.keysym.sym == SDLK_LEFT) { + --current; + } else if (event.key.keysym.sym == SDLK_RIGHT) { + ++current; + } + } + if (event.type == SDL_MOUSEBUTTONDOWN) { + if (event.button.x < (original->w/2)) { + --current; + } else { + ++current; + } + } + } + + /* Handle wrapping */ + if (current < 0) { + current += SDL_arraysize(output); + } + if (current >= SDL_arraysize(output)) { + current -= SDL_arraysize(output); + } + + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, output[current], NULL, NULL); + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + if (current == 0) { + SDLTest_DrawString(renderer, 4, 4, titles[current]); + } else { + SDL_snprintf(title, sizeof(title), "%s %s %s", titles[current], yuv_name, yuv_mode); + SDLTest_DrawString(renderer, 4, 4, title); + } + SDL_RenderPresent(renderer); + SDL_Delay(10); + } + } + SDL_Quit(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testyuv_cvt.c b/Engine/lib/sdl/test/testyuv_cvt.c new file mode 100644 index 000000000..553a3fa18 --- /dev/null +++ b/Engine/lib/sdl/test/testyuv_cvt.c @@ -0,0 +1,300 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL.h" + +#include "testyuv_cvt.h" + + +static float clip3(float x, float y, float z) +{ + return ((z < x) ? x : ((z > y) ? y : z)); +} + +static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + if (mode == SDL_YUV_CONVERSION_JPEG) { + /* Full range YUV */ + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); + yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); + yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); + } else { + // This formula is from Microsoft's documentation: + // https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx + // L = Kr * R + Kb * B + (1 - Kr - Kb) * G + // Y = floor(2^(M-8) * (219*(L-Z)/S + 16) + 0.5); + // U = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(B-L) / ((1-Kb)*S) + 128) + 0.5)); + // V = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(R-L) / ((1-Kr)*S) + 128) + 0.5)); + float S, Z, R, G, B, L, Kr, Kb, Y, U, V; + + if (mode == SDL_YUV_CONVERSION_BT709) { + /* BT.709 */ + Kr = 0.2126f; + Kb = 0.0722f; + } else { + /* BT.601 */ + Kr = 0.299f; + Kb = 0.114f; + } + + S = 255.0f; + Z = 0.0f; + R = rgb[0]; + G = rgb[1]; + B = rgb[2]; + L = Kr * R + Kb * B + (1 - Kr - Kb) * G; + Y = (Uint8)SDL_floorf((219*(L-Z)/S + 16) + 0.5f); + U = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(B-L) / ((1.0f-Kb)*S) + 128) + 0.5f)); + V = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(R-L) / ((1.0f-Kr)*S) + 128) + 0.5f)); + + yuv[0] = (Uint8)Y; + yuv[1] = (Uint8)U; + yuv[2] = (Uint8)V; + } + + if (monochrome) { + yuv[1] = 128; + yuv[2] = 128; + } + + if (luminance != 100) { + yuv[0] = yuv[0] * luminance / 100; + if (yuv[0] > 255) + yuv[0] = 255; + } +} + +static void ConvertRGBtoPlanar2x2(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[4][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb1, *rgb2; + int rgb_row_advance = (pitch - w*3) + pitch; + int UV_advance; + + rgb1 = src; + rgb2 = src + pitch; + + Y1 = out; + Y2 = Y1 + w; + switch (format) { + case SDL_PIXELFORMAT_YV12: + V = (Y1 + h * w); + U = V + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_IYUV: + U = (Y1 + h * w); + V = U + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_NV12: + U = (Y1 + h * w); + V = U + 1; + UV_advance = 2; + break; + case SDL_PIXELFORMAT_NV21: + V = (Y1 + h * w); + U = V + 1; + UV_advance = 2; + break; + default: + SDL_assert(!"Unsupported planar YUV format"); + return; + } + + for (y = 0; y < (h - 1); y += 2) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + RGBtoYUV(rgb2, yuv[3], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[3][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1] + yuv[2][1] + yuv[3][1])/4.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2] + yuv[2][2] + yuv[3][2])/4.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[2][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[2][2])/2.0f + 0.5f); + V += UV_advance; + } + Y1 += w; + Y2 += w; + rgb1 += rgb_row_advance; + rgb2 += rgb_row_advance; + } + /* Last row */ + if (y == (h - 1)) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + *Y1++ = (Uint8)yuv[0][0]; + + *U = (Uint8)yuv[0][1]; + U += UV_advance; + + *V = (Uint8)yuv[0][2]; + V += UV_advance; + } + } +} + +static void ConvertRGBtoPacked4(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[2][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb; + int rgb_row_advance = (pitch - w*3); + + rgb = src; + + switch (format) { + case SDL_PIXELFORMAT_YUY2: + Y1 = out; + U = out+1; + Y2 = out+2; + V = out+3; + break; + case SDL_PIXELFORMAT_UYVY: + U = out; + Y1 = out+1; + V = out+2; + Y2 = out+3; + break; + case SDL_PIXELFORMAT_YVYU: + Y1 = out; + V = out+1; + Y2 = out+2; + U = out+3; + break; + default: + SDL_assert(!"Unsupported packed YUV format"); + return; + } + + for (y = 0; y < h; ++y) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + + RGBtoYUV(rgb, yuv[1], mode, monochrome, luminance); + rgb += 3; + *Y2 = (Uint8)yuv[1][0]; + Y2 += 4; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += 4; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += 4; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y2 = *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + Y2 += 4; + + *U = (Uint8)yuv[0][1]; + U += 4; + + *V = (Uint8)yuv[0][2]; + V += 4; + } + rgb += rgb_row_advance; + } +} + +SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + ConvertRGBtoPlanar2x2(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + ConvertRGBtoPacked4(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + default: + return SDL_FALSE; + } +} + +int CalculateYUVPitch(Uint32 format, int width) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + return width; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + return 4*((width + 1)/2); + default: + return 0; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testyuv_cvt.h b/Engine/lib/sdl/test/testyuv_cvt.h new file mode 100644 index 000000000..bd845878f --- /dev/null +++ b/Engine/lib/sdl/test/testyuv_cvt.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +/* These functions are designed for testing correctness, not for speed */ + +extern SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance); +extern int CalculateYUVPitch(Uint32 format, int width); diff --git a/Engine/lib/sdl/test/torturethread.c b/Engine/lib/sdl/test/torturethread.c index 6b98a0a9f..9b1a407ee 100644 --- a/Engine/lib/sdl/test/torturethread.c +++ b/Engine/lib/sdl/test/torturethread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages From ad5d781cef486397dce38110acaeaca8bf5ea6b0 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 9 May 2018 23:09:32 +1000 Subject: [PATCH 291/312] cmake fix for apple sdl --- Tools/CMake/torque3d.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index d746913fb..0d29dcf38 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -701,7 +701,13 @@ endif() if(TORQUE_SDL) addDef(TORQUE_SDL) addInclude(${libDir}/sdl/include) - addLib(SDL2) + if(APPLE) + addLib(SDL2main) + addLib(SDL2-static) + add_dependencies(${TORQUE_APP_NAME} SDL2main SDL2-static) + else() + addLib(SDL2) + endif() SET(VIDEO_WAYLAND OFF CACHE BOOL "" FORCE) mark_as_advanced(3DNOW) From f4be184d3339ff7f6309a435fa1ebd1fb7019c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Monta=C3=B1=C3=A9s=20Garc=C3=ADa?= Date: Wed, 9 May 2018 18:08:33 +0200 Subject: [PATCH 292/312] Particles should go downwind (while windCoefficient >0) --- Engine/source/T3D/fx/particleEmitter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index cab153574..5a1fbe094 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -1390,7 +1390,7 @@ void ParticleEmitter::emitParticles(const Point3F& start, Point3F a = last_part->acc; a -= last_part->vel * last_part->dataBlock->dragCoefficient; - a -= mWindVelocity * last_part->dataBlock->windCoefficient; + a += mWindVelocity * last_part->dataBlock->windCoefficient; //a += Point3F(0.0f, 0.0f, -9.81f) * last_part->dataBlock->gravityCoefficient; a.z += -9.81f*last_part->dataBlock->gravityCoefficient; // as long as gravity is a constant, this is faster @@ -1750,7 +1750,7 @@ void ParticleEmitter::update( U32 ms ) { Point3F a = part->acc; a -= part->vel * part->dataBlock->dragCoefficient; - a -= mWindVelocity * part->dataBlock->windCoefficient; + a += mWindVelocity * part->dataBlock->windCoefficient; a.z += -9.81f*part->dataBlock->gravityCoefficient; // AFX -- as long as gravity is a constant, this is faster part->vel += a * t; From 82338fa9f40828f0e31bb0793d29047ded29849c Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Fri, 8 Jun 2018 20:32:38 -0400 Subject: [PATCH 293/312] Changes TSStatic::castRayRendered to used passed texcoord argument. This fixes a bug where TSStatic::castRayRendered() ignored the state of generateTexCoord in the passed RayInfo structure and never returned texture coordinates if requested. --- Engine/source/T3D/tsStatic.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 7797795a5..58925b29e 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1007,6 +1007,8 @@ bool TSStatic::castRayRendered(const Point3F &start, const Point3F &end, RayInfo // Cast the ray against the currently visible detail RayInfo localInfo; + if (info && info->generateTexCoord) + localInfo.generateTexCoord = true; bool res = mShapeInstance->castRayOpcode( mShapeInstance->getCurrentDetail(), start, end, &localInfo ); if ( res ) From a95f678602dea6634f59e7a1bf2ea4b70228f765 Mon Sep 17 00:00:00 2001 From: rextimmy Date: Sat, 23 Jun 2018 12:20:07 +1000 Subject: [PATCH 294/312] physx support for vs 2017 round 2 --- Tools/CMake/modules/module_physx3.cmake | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Tools/CMake/modules/module_physx3.cmake b/Tools/CMake/modules/module_physx3.cmake index e8065740f..a53075441 100644 --- a/Tools/CMake/modules/module_physx3.cmake +++ b/Tools/CMake/modules/module_physx3.cmake @@ -46,14 +46,11 @@ set(PHYSX3_PATH "${PHYSX3_BASE_PATH}/PhysX_3.4") # Windows/ Visual Studio if(MSVC) if(TORQUE_CPU_X32) - if(MSVC11) - set(PHYSX3_LIBPATH_PREFIX vc11win32) - elseif(MSVC12) + if(MSVC_VERSION EQUAL 1800 ) set(PHYSX3_LIBPATH_PREFIX vc12win32) - elseif(MSVC14) + elseif(MSVC_VERSION EQUAL 1900) set(PHYSX3_LIBPATH_PREFIX vc14win32) - #VS 2017 uses 14.x toolchain so can't use MSVC15 - elseif(MSVC_VERSION GREATER_OR_EQUAL_TO 1910) + elseif(MSVC_VERSION GREATER_EQUAL 1910) set(PHYSX3_LIBPATH_PREFIX vc15win32) else() message(FATAL_ERROR "This version of VS is not supported") @@ -62,14 +59,11 @@ if(TORQUE_CPU_X32) set(PHYSX3_LIBNAME_POSTFIX _x86) elseif(TORQUE_CPU_X64) - if(MSVC11) - set(PHYSX3_LIBPATH_PREFIX vc11win64) - elseif(MSVC12) + if(MSVC_VERSION EQUAL 1800 ) set(PHYSX3_LIBPATH_PREFIX vc12win64) - elseif(MSVC14) + elseif(MSVC_VERSION EQUAL 1900) set(PHYSX3_LIBPATH_PREFIX vc14win64) - #VS 2017 uses 14.x toolchain so can't use MSVC15 - elseif(MSVC_VERSION GREATER_OR_EQUAL_TO 1910) + elseif(MSVC_VERSION GREATER_EQUAL 1910) set(PHYSX3_LIBPATH_PREFIX vc15win64) else() message(FATAL_ERROR "This version of VS is not supported") From b0b2b1314a129d3ad6750277f4172e5505ab69bb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 4 Jul 2018 18:26:14 -0500 Subject: [PATCH 295/312] member var conversion error that oddly didn't crop up till mac testing. --- Engine/source/math/mPolyhedron.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/math/mPolyhedron.h b/Engine/source/math/mPolyhedron.h index 8888d531d..3da780e0c 100644 --- a/Engine/source/math/mPolyhedron.h +++ b/Engine/source/math/mPolyhedron.h @@ -267,7 +267,7 @@ struct PolyhedronFixedVectorData : public PolyhedronData Point3F* getPoints() const { return mPointList.address(); } /// Return the number of edges that this polyhedron has. - U32 getNumEdges() const { return edgeList.size(); } + U32 getNumEdges() const { return mEdgeList.size(); } /// Edge* getEdges() const { return mEdgeList.address(); } From 38237bfb6244584b7efc4cef7d56a180b1c4e71c Mon Sep 17 00:00:00 2001 From: chaigler Date: Thu, 5 Jul 2018 14:19:05 -0400 Subject: [PATCH 296/312] _GFXInitGetInitialRes() cleanup Removes unnecessary code that sets default video mode params. This is already handled by the GFXVideoMode constructor. The settings are also immediately overwritten by vm.parseFromString(). Resolves #740 --- Engine/source/gfx/gfxInit.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/Engine/source/gfx/gfxInit.cpp b/Engine/source/gfx/gfxInit.cpp index 21572b957..1c7f1f42a 100644 --- a/Engine/source/gfx/gfxInit.cpp +++ b/Engine/source/gfx/gfxInit.cpp @@ -84,28 +84,15 @@ inline static void _GFXInitReportAdapters(Vector &adapters) } } -inline static void _GFXInitGetInitialRes(GFXVideoMode &vm, const Point2I &initialSize) +inline static void _GFXInitGetInitialRes(GFXVideoMode &vm) { - const U32 kDefaultWindowSizeX = 800; - const U32 kDefaultWindowSizeY = 600; - const bool kDefaultFullscreen = false; - const U32 kDefaultBitDepth = 32; - const U32 kDefaultRefreshRate = 60; - // cache the desktop size of the main screen GFXVideoMode desktopVm = GFXInit::getDesktopResolution(); // load pref variables, properly choose windowed / fullscreen const String resString = Con::getVariable("$pref::Video::mode"); - // Set defaults into the video mode, then have it parse the user string. - vm.resolution.x = kDefaultWindowSizeX; - vm.resolution.y = kDefaultWindowSizeY; - vm.fullScreen = kDefaultFullscreen; - vm.bitDepth = kDefaultBitDepth; - vm.refreshRate = kDefaultRefreshRate; - vm.wideScreen = false; - + // Parse video mode settings from pref string vm.parseFromString(resString); } @@ -365,7 +352,7 @@ GFXAdapter *GFXInit::getBestAdapterChoice() GFXVideoMode GFXInit::getInitialVideoMode() { GFXVideoMode vm; - _GFXInitGetInitialRes(vm, Point2I(800,600)); + _GFXInitGetInitialRes(vm); return vm; } From bab3d9d5f3d06a441e07eaa162a0e6b6e4ff7785 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Sat, 7 Jul 2018 02:23:59 -0400 Subject: [PATCH 297/312] Fix for bug in GFXVideoMode::parseFromString() When testing PR #2264 I discovered that GFXVideoMode::parseFromString() will never assign false to the fullScreen value. That value must be initialized to false going in. I found it hard to believe that that could be the case and not have caused a problem before now, so I dropped: ```c++ GFXVideoMode vmTest = GFXInit::getDesktopResolution(); vmTest.fullScreen = true; vmTest.parseFromString("800 600 false 32 60"); Con::printf("%s becomes %s", "800 600 false 32 60", vmTest.toString().c_str()); ``` into the end of _GFXInitGetInitialRes() and the output string is: 800 600 false 32 60 becomes 800 600 true 32 60 0 None of the values get assigned by the macro [here](https://github.com/GarageGames/Torque3D/blob/development/Engine/source/gfx/gfxStructs.cpp#L46-L48) if their function evaluates to zero or the token is missing from the string. This commit corrects that for the boolean case to only skip the assignment if the string token is not found. --- Engine/source/gfx/gfxStructs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/gfx/gfxStructs.cpp b/Engine/source/gfx/gfxStructs.cpp index 7f64c6ee6..a8e6444bf 100644 --- a/Engine/source/gfx/gfxStructs.cpp +++ b/Engine/source/gfx/gfxStructs.cpp @@ -49,7 +49,9 @@ void GFXVideoMode::parseFromString( const char *str ) PARSE_ELEM(S32, resolution.x, dAtoi, tempBuf, " x\0") PARSE_ELEM(S32, resolution.y, dAtoi, NULL, " x\0") - PARSE_ELEM(S32, fullScreen, dAtob, NULL, " \0") + const char *boolptr = dStrtok(NULL, " \0"); + if (boolptr) + fullScreen = dAtob(boolptr); PARSE_ELEM(S32, bitDepth, dAtoi, NULL, " \0") PARSE_ELEM(S32, refreshRate, dAtoi, NULL, " \0") PARSE_ELEM(S32, antialiasLevel, dAtoi, NULL, " \0") From cc77e6d3017f7260141284bea81d8126e3cbf1b5 Mon Sep 17 00:00:00 2001 From: chaigler Date: Sat, 7 Jul 2018 13:16:46 -0400 Subject: [PATCH 298/312] Fix for ScatterSky zOffset zOffset was mistakenly applied to wrong transform matrix. Fixes #1721. --- Engine/source/environment/scatterSky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/environment/scatterSky.cpp b/Engine/source/environment/scatterSky.cpp index 2f8d17d00..3220c46d1 100644 --- a/Engine/source/environment/scatterSky.cpp +++ b/Engine/source/environment/scatterSky.cpp @@ -955,8 +955,9 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat Point3F camPos2 = state->getCameraPosition(); MatrixF xfm(true); - + xfm.setPosition(camPos2 - Point3F(0, 0, mZOffset)); GFX->multWorld(xfm); + MatrixF xform(proj);//GFX->getProjectionMatrix()); xform *= GFX->getViewMatrix(); xform *= GFX->getWorldMatrix(); @@ -968,7 +969,6 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat rotMat.set(EulerF(M_PI_F, 0.0, 0.0)); xform.mul(rotMat); } - xform.setPosition(xform.getPosition() - Point3F(0, 0, mZOffset)); mShaderConsts->setSafe( mModelViewProjSC, xform ); mShaderConsts->setSafe( mMiscSC, miscParams ); From c54c8ed6893032507524b34cac85324e47ea208c Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 9 Jul 2018 15:17:48 -0500 Subject: [PATCH 299/312] Create .travis.yml Initial travis CI config file push. Further calibration will be required to dial the settings in. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..8e5970686 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: cpp +compiler: + - clang + - gcc From a48b70d5b1a86d63c14e3eabf3f85fbde82af467 Mon Sep 17 00:00:00 2001 From: rextimmy Date: Tue, 10 Jul 2018 14:13:22 +1000 Subject: [PATCH 300/312] d3d11 copyToBmp fix for new lock/unlock function --- .../gfx/D3D11/gfxD3D11TextureObject.cpp | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp index 7c33e1c16..d35eb1b34 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp @@ -183,10 +183,10 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) PROFILE_START(GFXD3D11TextureObject_copyToBmp); - AssertFatal(bmp->getWidth() == getWidth(), "doh"); - AssertFatal(bmp->getHeight() == getHeight(), "doh"); - U32 width = getWidth(); - U32 height = getHeight(); + AssertFatal(bmp->getWidth() == getWidth(), "GFXD3D11TextureObject::copyToBmp - source/dest width does not match"); + AssertFatal(bmp->getHeight() == getHeight(), "GFXD3D11TextureObject::copyToBmp - source/dest height does not match"); + const U32 width = getWidth(); + const U32 height = getHeight(); bmp->setHasTransparency(mHasTransparency); @@ -201,21 +201,47 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) destBytesPerPixel = 3; else // unsupported - AssertFatal(false, "unsupported bitmap format"); + AssertFatal(false, "GFXD3D11TextureObject::copyToBmp - unsupported bitmap format"); + PROFILE_START(GFXD3D11TextureObject_copyToBmp_pixCopy); - // lock the texture - DXGI_MAPPED_RECT* lockRect = (DXGI_MAPPED_RECT*) lock(); + //create temp staging texture + D3D11_TEXTURE2D_DESC desc; + static_cast(mD3DTexture)->GetDesc(&desc); + desc.BindFlags = 0; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + desc.Usage = D3D11_USAGE_STAGING; + + ID3D11Texture2D* pStagingTexture = NULL; + HRESULT hr = D3D11DEVICE->CreateTexture2D(&desc, NULL, &pStagingTexture); + if (FAILED(hr)) + { + Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to create staging texture"); + return false; + } + + //copy the classes texture to the staging texture + D3D11DEVICECONTEXT->CopyResource(pStagingTexture, mD3DTexture); + + //map the staging resource + D3D11_MAPPED_SUBRESOURCE mappedRes; + hr = D3D11DEVICECONTEXT->Map(pStagingTexture, 0, D3D11_MAP_READ, 0, &mappedRes); + if (FAILED(hr)) + { + //cleanup + SAFE_RELEASE(pStagingTexture); + Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to map staging texture"); + return false; + } // set pointers - U8* srcPtr = (U8*)lockRect->pBits; + const U8* srcPtr = (U8*)mappedRes.pData; U8* destPtr = bmp->getWritableBits(); // we will want to skip over any D3D cache data in the source texture - const S32 sourceCacheSize = lockRect->Pitch - width * sourceBytesPerPixel; - AssertFatal(sourceCacheSize >= 0, "copyToBmp: cache size is less than zero?"); + const S32 sourceCacheSize = mappedRes.RowPitch - width * sourceBytesPerPixel; + AssertFatal(sourceCacheSize >= 0, "GFXD3D11TextureObject::copyToBmp - cache size is less than zero?"); - PROFILE_START(GFXD3D11TextureObject_copyToBmp_pixCopy); // copy data into bitmap for (U32 row = 0; row < height; ++row) { @@ -236,14 +262,14 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) // skip past the cache data for this row (if any) srcPtr += sourceCacheSize; } - PROFILE_END(); // assert if we stomped or underran memory - AssertFatal(U32(destPtr - bmp->getWritableBits()) == width * height * destBytesPerPixel, "copyToBmp: doh, memory error"); - AssertFatal(U32(srcPtr - (U8*)lockRect->pBits) == height * lockRect->Pitch, "copyToBmp: doh, memory error"); + AssertFatal(U32(destPtr - bmp->getWritableBits()) == width * height * destBytesPerPixel, "GFXD3D11TextureObject::copyToBmp - memory error"); + AssertFatal(U32(srcPtr - (U8*)mappedRes.pData) == height * mappedRes.RowPitch, "GFXD3D11TextureObject::copyToBmp - memory error"); - // unlock - unlock(); + D3D11DEVICECONTEXT->Unmap(pStagingTexture, 0); + + SAFE_RELEASE(pStagingTexture); PROFILE_END(); From cf156f505689bd764688ee0e96a2051e8ac57b00 Mon Sep 17 00:00:00 2001 From: Calvin Balke Date: Sun, 15 Jul 2018 11:50:09 -0700 Subject: [PATCH 301/312] Network Code Fixes This should be backwards compatible with existing network code, however it fixes a bug. --- Engine/source/core/stream/bitStream.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index 1a5ab3202..4a8553927 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -140,7 +140,7 @@ class HuffmanProcessor static HuffmanProcessor g_huffProcessor; - bool readHuffBuffer(BitStream* pStream, char* out_pBuffer); + bool readHuffBuffer(BitStream* pStream, char* out_pBuffer, S32 maxLen); bool writeHuffBuffer(BitStream* pStream, const char* out_pBuffer, S32 maxLen); }; @@ -667,12 +667,12 @@ void BitStream::readString(char buf[256]) if(readFlag()) { S32 offset = readInt(8); - HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, stringBuffer + offset); + HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, stringBuffer + offset, 256 - offset); dStrcpy(buf, stringBuffer, 256); return; } } - HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, buf); + HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, buf, 256); if(stringBuffer) dStrcpy(stringBuffer, buf, 256); } @@ -812,13 +812,16 @@ S16 HuffmanProcessor::determineIndex(HuffWrap& rWrap) } } -bool HuffmanProcessor::readHuffBuffer(BitStream* pStream, char* out_pBuffer) +bool HuffmanProcessor::readHuffBuffer(BitStream* pStream, char* out_pBuffer, S32 maxLen=256) { if (m_tablesBuilt == false) buildTables(); if (pStream->readFlag()) { S32 len = pStream->readInt(8); + if (len >= maxLen) { + len = maxLen; + } for (S32 i = 0; i < len; i++) { S32 index = 0; while (true) { @@ -839,6 +842,9 @@ bool HuffmanProcessor::readHuffBuffer(BitStream* pStream, char* out_pBuffer) } else { // Uncompressed string... U32 len = pStream->readInt(8); + if (len >= maxLen) { + len = maxLen; + } pStream->read(len, out_pBuffer); out_pBuffer[len] = '\0'; return true; From ae5fce616939c0416f122f1d90000a1fdc3d1195 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 27 Jul 2018 22:00:49 -0500 Subject: [PATCH 302/312] alternative to #2268 : remove secondary profiling --- Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp index d35eb1b34..d827b7a17 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp @@ -202,9 +202,7 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) else // unsupported AssertFatal(false, "GFXD3D11TextureObject::copyToBmp - unsupported bitmap format"); - - PROFILE_START(GFXD3D11TextureObject_copyToBmp_pixCopy); - + //create temp staging texture D3D11_TEXTURE2D_DESC desc; static_cast(mD3DTexture)->GetDesc(&desc); @@ -216,7 +214,7 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) HRESULT hr = D3D11DEVICE->CreateTexture2D(&desc, NULL, &pStagingTexture); if (FAILED(hr)) { - Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to create staging texture"); + Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to create staging texture"); return false; } @@ -270,7 +268,6 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) D3D11DEVICECONTEXT->Unmap(pStagingTexture, 0); SAFE_RELEASE(pStagingTexture); - PROFILE_END(); return true; From ee64270a2d498507a039b610b0ed85140b683240 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 7 Aug 2018 13:14:25 -0500 Subject: [PATCH 303/312] micro patch to the nativefiledialogues library to mirror file type name folks with 'hide extensions for known file types' on windows weren't seeing any entries in thier drop-down lists for file types. --- Engine/lib/nativeFileDialogs/nfd_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/lib/nativeFileDialogs/nfd_win.cpp b/Engine/lib/nativeFileDialogs/nfd_win.cpp index a73fd8a46..1187fc84b 100644 --- a/Engine/lib/nativeFileDialogs/nfd_win.cpp +++ b/Engine/lib/nativeFileDialogs/nfd_win.cpp @@ -183,7 +183,7 @@ static nfdresult_t AddFiltersToDialog( ::IFileDialog *fileOpenDialog, const char /* end of filter -- add it to specList */ // Empty filter name -- Windows describes them by extension. - specList[specIdx].pszName = EMPTY_WSTR; + CopyNFDCharToWChar(specbuf, (wchar_t**)&specList[specIdx].pszName); CopyNFDCharToWChar( specbuf, (wchar_t**)&specList[specIdx].pszSpec ); memset( specbuf, 0, sizeof(char)*NFD_MAX_STRLEN ); @@ -203,7 +203,7 @@ static nfdresult_t AddFiltersToDialog( ::IFileDialog *fileOpenDialog, const char /* Add wildcard */ specList[specIdx].pszSpec = WILDCARD; - specList[specIdx].pszName = EMPTY_WSTR; + specList[specIdx].pszName = WILDCARD; fileOpenDialog->SetFileTypes( filterCount+1, specList ); From 02972b5961da8be4b8fbb7a8b62f258bb9422145 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 2 Sep 2018 03:50:31 -0500 Subject: [PATCH 304/312] Clear out old core structure before adding the new module-ified structure. --- .../BaseGame/game/core/CoreComponents.cs | 10 - .../BaseGame/game/core/CoreComponents.module | 19 - Templates/BaseGame/game/core/audio.cs | 436 --- Templates/BaseGame/game/core/canvas.cs | 162 - .../components/RigidBodyComponent.asset.taml | 8 - .../components/animationComponent.asset.taml | 8 - .../cameraOrbiterComponent.asset.taml | 8 - .../components/collisionComponent.asset.taml | 8 - .../core/components/game/camera.asset.taml | 9 - .../game/core/components/game/camera.cs | 185 -- .../components/game/controlObject.asset.taml | 10 - .../core/components/game/controlObject.cs | 89 - .../components/game/itemRotate.asset.taml | 10 - .../game/core/components/game/itemRotate.cs | 49 - .../components/game/playerSpawner.asset.taml | 10 - .../core/components/game/playerSpawner.cs | 78 - .../components/input/fpsControls.asset.taml | 9 - .../game/core/components/input/fpsControls.cs | 247 -- .../core/components/input/inputManager.cs | 82 - .../core/components/meshComponent.asset.taml | 8 - .../playerControllerComponent.asset.taml | 8 - .../core/components/soundComponent.asset.taml | 8 - .../stateMachineComponent.asset.taml | 8 - .../BaseGame/game/core/console/console.gui | 191 -- Templates/BaseGame/game/core/console/main.cs | 140 - .../BaseGame/game/core/console/profiles.cs | 70 - Templates/BaseGame/game/core/cursor.cs | 102 - .../game/core/fonts/Arial 10 (ansi).uft | Bin 412 -> 0 bytes .../game/core/fonts/Arial 12 (ansi).uft | Bin 62 -> 0 bytes .../game/core/fonts/Arial 14 (ansi).uft | Bin 5160 -> 0 bytes .../game/core/fonts/Arial 16 (ansi).uft | Bin 13112 -> 0 bytes .../game/core/fonts/Arial 36 (ansi).uft | Bin 1046 -> 0 bytes .../game/core/fonts/Arial Bold 14 (ansi).uft | Bin 3227 -> 0 bytes .../game/core/fonts/Arial Bold 16 (ansi).uft | Bin 1254 -> 0 bytes .../game/core/fonts/Arial Bold 18 (ansi).uft | Bin 5276 -> 0 bytes .../game/core/fonts/ArialBold 14 (ansi).uft | Bin 2276 -> 0 bytes .../game/core/fonts/ArialItalic 14 (ansi).uft | Bin 2951 -> 0 bytes .../core/fonts/Lucida Console 12 (ansi).uft | Bin 5897 -> 0 bytes .../BaseGame/game/core/gfxData/clouds.cs | 55 - .../game/core/gfxData/commonMaterialData.cs | 79 - .../BaseGame/game/core/gfxData/scatterSky.cs | 48 - .../BaseGame/game/core/gfxData/shaders.cs | 152 - .../game/core/gfxData/terrainBlock.cs | 36 - Templates/BaseGame/game/core/gfxData/water.cs | 208 -- .../gfxprofile/D3D9.ATITechnologiesInc.cs | 36 - .../gfxprofile/D3D9.NVIDIA.GeForce8600.cs | 36 - .../gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs | 39 - .../game/core/gfxprofile/D3D9.NVIDIA.cs | 36 - .../BaseGame/game/core/gfxprofile/D3D9.cs | 26 - Templates/BaseGame/game/core/globals.cs | 102 - .../BaseGame/game/core/helperFunctions.cs | 1158 ------- .../BaseGame/game/core/images/AreaMap33.dds | Bin 109028 -> 0 bytes .../BaseGame/game/core/images/button.png | Bin 1153 -> 0 bytes .../BaseGame/game/core/images/caustics_1.png | Bin 34398 -> 0 bytes .../BaseGame/game/core/images/caustics_2.png | Bin 33963 -> 0 bytes .../BaseGame/game/core/images/checkbox.png | Bin 3943 -> 0 bytes .../game/core/images/group-border.png | Bin 1273 -> 0 bytes .../game/core/images/inactive-overlay.png | Bin 131 -> 0 bytes .../BaseGame/game/core/images/loadingbar.png | Bin 635 -> 0 bytes .../BaseGame/game/core/images/materials.cs | 32 - .../game/core/images/missingTexture.png | Bin 10645 -> 0 bytes Templates/BaseGame/game/core/images/noise.png | Bin 14610 -> 0 bytes .../game/core/images/null_color_ramp.png | Bin 2843 -> 0 bytes .../BaseGame/game/core/images/scrollBar.png | Bin 3332 -> 0 bytes .../BaseGame/game/core/images/textEdit.png | Bin 250 -> 0 bytes .../game/core/images/thumbHighlightButton.png | Bin 778 -> 0 bytes .../BaseGame/game/core/images/unavailable.png | Bin 26528 -> 0 bytes .../BaseGame/game/core/images/warnMat.dds | Bin 699192 -> 0 bytes .../BaseGame/game/core/images/window.png | Bin 2559 -> 0 bytes Templates/BaseGame/game/core/lighting.cs | 74 - .../core/lighting/advanced/deferredShading.cs | 71 - .../game/core/lighting/advanced/init.cs | 68 - .../game/core/lighting/advanced/shaders.cs | 276 -- .../BaseGame/game/core/lighting/basic/init.cs | 92 - .../game/core/lighting/basic/shadowFilter.cs | 76 - .../game/core/lighting/shadowMaps/init.cs | 32 - Templates/BaseGame/game/core/main.cs | 99 - Templates/BaseGame/game/core/oculusVR.cs | 248 -- .../BaseGame/game/core/oculusVROverlay.gui | 19 - Templates/BaseGame/game/core/parseArgs.cs | 392 --- .../BaseGame/game/core/postFX/GammaPostFX.cs | 73 - Templates/BaseGame/game/core/postFX/MLAA.cs | 186 -- .../BaseGame/game/core/postFX/MotionBlurFx.cs | 53 - .../BaseGame/game/core/postFX/caustics.cs | 64 - .../game/core/postFX/chromaticLens.cs | 77 - .../game/core/postFX/default.postfxpreset.cs | 72 - Templates/BaseGame/game/core/postFX/dof.cs | 599 ---- Templates/BaseGame/game/core/postFX/edgeAA.cs | 113 - Templates/BaseGame/game/core/postFX/flash.cs | 63 - Templates/BaseGame/game/core/postFX/fog.cs | 135 - Templates/BaseGame/game/core/postFX/fxaa.cs | 64 - Templates/BaseGame/game/core/postFX/glow.cs | 184 -- Templates/BaseGame/game/core/postFX/hdr.cs | 529 ---- .../BaseGame/game/core/postFX/lightRay.cs | 110 - .../game/core/postFX/ovrBarrelDistortion.cs | 167 - .../game/core/postFX/postFxManager.gui | 2755 ----------------- .../game/core/postFX/postFxManager.gui.cs | 446 --- .../core/postFX/postFxManager.gui.settings.cs | 439 --- .../core/postFX/postFxManager.persistance.cs | 79 - Templates/BaseGame/game/core/postFX/ssao.cs | 302 -- .../BaseGame/game/core/postFX/turbulence.cs | 57 - .../BaseGame/game/core/postFX/vignette.cs | 55 - Templates/BaseGame/game/core/postFx.cs | 88 - Templates/BaseGame/game/core/profiles.cs | 226 -- Templates/BaseGame/game/core/renderManager.cs | 136 - .../BaseGame/game/core/sfx/audioAmbience.cs | 44 - Templates/BaseGame/game/core/sfx/audioData.cs | 42 - .../game/core/sfx/audioDescriptions.cs | 143 - .../game/core/sfx/audioEnvironments.cs | 916 ------ .../BaseGame/game/core/sfx/audioStates.cs | 158 - .../core/shaders/VolumetricFog/VFogP.hlsl | 87 - .../core/shaders/VolumetricFog/VFogPreP.hlsl | 40 - .../core/shaders/VolumetricFog/VFogPreV.hlsl | 44 - .../core/shaders/VolumetricFog/VFogRefl.hlsl | 38 - .../core/shaders/VolumetricFog/VFogV.hlsl | 46 - .../core/shaders/VolumetricFog/gl/VFogP.glsl | 87 - .../shaders/VolumetricFog/gl/VFogPreP.glsl | 37 - .../shaders/VolumetricFog/gl/VFogPreV.glsl | 42 - .../shaders/VolumetricFog/gl/VFogRefl.glsl | 33 - .../core/shaders/VolumetricFog/gl/VFogV.glsl | 38 - .../game/core/shaders/basicCloudsP.hlsl | 37 - .../game/core/shaders/basicCloudsV.hlsl | 58 - .../game/core/shaders/cloudLayerP.hlsl | 146 - .../game/core/shaders/cloudLayerV.hlsl | 106 - .../fixedFunction/addColorTextureP.hlsl | 37 - .../fixedFunction/addColorTextureV.hlsl | 48 - .../core/shaders/fixedFunction/colorP.hlsl | 34 - .../core/shaders/fixedFunction/colorV.hlsl | 45 - .../fixedFunction/gl/addColorTextureP.glsl | 32 - .../fixedFunction/gl/addColorTextureV.glsl | 38 - .../core/shaders/fixedFunction/gl/colorP.glsl | 30 - .../core/shaders/fixedFunction/gl/colorV.glsl | 35 - .../fixedFunction/gl/modColorTextureP.glsl | 32 - .../fixedFunction/gl/modColorTextureV.glsl | 38 - .../fixedFunction/gl/targetRestoreP.glsl | 31 - .../fixedFunction/gl/targetRestoreV.glsl | 22 - .../shaders/fixedFunction/gl/textureP.glsl | 31 - .../shaders/fixedFunction/gl/textureV.glsl | 35 - .../fixedFunction/modColorTextureP.hlsl | 37 - .../fixedFunction/modColorTextureV.hlsl | 48 - .../shaders/fixedFunction/targetRestoreP.hlsl | 31 - .../shaders/fixedFunction/targetRestoreV.hlsl | 26 - .../core/shaders/fixedFunction/textureP.hlsl | 36 - .../core/shaders/fixedFunction/textureV.hlsl | 46 - .../BaseGame/game/core/shaders/foliage.hlsl | 186 -- .../core/shaders/fxFoliageReplicatorP.hlsl | 60 - .../core/shaders/fxFoliageReplicatorV.hlsl | 129 - .../game/core/shaders/gl/basicCloudsP.glsl | 39 - .../game/core/shaders/gl/basicCloudsV.glsl | 53 - .../BaseGame/game/core/shaders/gl/blurP.glsl | 39 - .../BaseGame/game/core/shaders/gl/blurV.glsl | 48 - .../game/core/shaders/gl/cloudLayerP.glsl | 147 - .../game/core/shaders/gl/cloudLayerV.glsl | 106 - .../game/core/shaders/gl/foliage.glsl | 186 -- .../core/shaders/gl/fxFoliageReplicatorP.glsl | 42 - .../core/shaders/gl/fxFoliageReplicatorV.glsl | 99 - .../game/core/shaders/gl/guiMaterialV.glsl | 39 - .../game/core/shaders/gl/hlslCompat.glsl | 101 - .../game/core/shaders/gl/imposter.glsl | 161 - .../game/core/shaders/gl/lighting.glsl | 249 -- .../core/shaders/gl/particleCompositeP.glsl | 62 - .../core/shaders/gl/particleCompositeV.glsl | 48 - .../game/core/shaders/gl/particlesP.glsl | 113 - .../game/core/shaders/gl/particlesV.glsl | 54 - .../core/shaders/gl/planarReflectBumpP.glsl | 70 - .../core/shaders/gl/planarReflectBumpV.glsl | 51 - .../game/core/shaders/gl/planarReflectP.glsl | 43 - .../game/core/shaders/gl/planarReflectV.glsl | 51 - .../game/core/shaders/gl/precipP.glsl | 39 - .../game/core/shaders/gl/precipV.glsl | 54 - .../core/shaders/gl/projectedShadowP.glsl | 37 - .../core/shaders/gl/projectedShadowV.glsl | 49 - .../game/core/shaders/gl/scatterSkyP.glsl | 72 - .../game/core/shaders/gl/scatterSkyV.glsl | 154 - .../BaseGame/game/core/shaders/gl/torque.glsl | 339 -- .../BaseGame/game/core/shaders/gl/wavesP.glsl | 57 - .../BaseGame/game/core/shaders/gl/wind.glsl | 101 - .../game/core/shaders/guiMaterialV.hlsl | 45 - .../BaseGame/game/core/shaders/hlslStructs.h | 116 - .../game/core/shaders/hlslStructs.hlsl | 114 - .../BaseGame/game/core/shaders/imposter.hlsl | 149 - .../BaseGame/game/core/shaders/lighting.hlsl | 249 -- .../lighting/advanced/convexGeometryV.hlsl | 54 - .../advanced/deferredClearGBufferP.hlsl | 54 - .../advanced/deferredClearGBufferV.hlsl | 43 - .../advanced/deferredColorShaderP.hlsl | 46 - .../lighting/advanced/deferredShadingP.hlsl | 54 - .../lighting/advanced/farFrustumQuad.hlsl | 47 - .../lighting/advanced/farFrustumQuadV.hlsl | 43 - .../lighting/advanced/gl/convexGeometryV.glsl | 52 - .../advanced/gl/deferredClearGBufferP.glsl | 40 - .../advanced/gl/deferredColorShaderP.glsl | 37 - .../advanced/gl/deferredShadingP.glsl | 59 - .../lighting/advanced/gl/farFrustumQuad.glsl | 30 - .../lighting/advanced/gl/farFrustumQuadV.glsl | 51 - .../lighting/advanced/gl/lightingUtils.glsl | 79 - .../lighting/advanced/gl/pointLightP.glsl | 273 -- .../lighting/advanced/gl/softShadow.glsl | 159 - .../lighting/advanced/gl/spotLightP.glsl | 210 -- .../lighting/advanced/gl/vectorLightP.glsl | 327 -- .../lighting/advanced/lightingUtils.hlsl | 51 - .../advanced/particlePointLightP.hlsl | 76 - .../advanced/particlePointLightV.hlsl | 48 - .../lighting/advanced/pointLightP.hlsl | 277 -- .../shaders/lighting/advanced/softShadow.hlsl | 158 - .../shaders/lighting/advanced/spotLightP.hlsl | 209 -- .../lighting/advanced/vectorLightP.hlsl | 328 -- .../lighting/basic/gl/shadowFilterP.glsl | 46 - .../lighting/basic/gl/shadowFilterV.glsl | 37 - .../shaders/lighting/basic/shadowFilterP.hlsl | 50 - .../shaders/lighting/basic/shadowFilterV.hlsl | 42 - .../lighting/shadowMap/boxFilterP.hlsl | 82 - .../lighting/shadowMap/boxFilterV.hlsl | 57 - .../lighting/shadowMap/gl/boxFilterP.glsl | 49 - .../lighting/shadowMap/gl/boxFilterV.glsl | 34 - .../shaders/lighting/shadowMap/shadowMapIO.h | 50 - .../lighting/shadowMap/shadowMapIO_GLSL.h | 50 - .../lighting/shadowMap/shadowMapIO_HLSL.h | 50 - .../game/core/shaders/particleCompositeP.hlsl | 61 - .../game/core/shaders/particleCompositeV.hlsl | 53 - .../game/core/shaders/particlesP.hlsl | 109 - .../game/core/shaders/particlesV.hlsl | 55 - .../game/core/shaders/planarReflectBumpP.hlsl | 87 - .../game/core/shaders/planarReflectBumpV.hlsl | 67 - .../game/core/shaders/planarReflectP.hlsl | 58 - .../game/core/shaders/planarReflectV.hlsl | 57 - .../game/core/shaders/postFX/VolFogGlowP.hlsl | 74 - .../shaders/postFX/caustics/causticsP.hlsl | 77 - .../shaders/postFX/caustics/gl/causticsP.glsl | 87 - .../core/shaders/postFX/chromaticLens.hlsl | 60 - .../shaders/postFX/dof/DOF_CalcCoC_P.hlsl | 53 - .../shaders/postFX/dof/DOF_CalcCoC_V.hlsl | 70 - .../shaders/postFX/dof/DOF_DownSample_P.hlsl | 143 - .../shaders/postFX/dof/DOF_DownSample_V.hlsl | 61 - .../core/shaders/postFX/dof/DOF_Final_P.hlsl | 145 - .../core/shaders/postFX/dof/DOF_Final_V.hlsl | 72 - .../shaders/postFX/dof/DOF_Gausian_P.hlsl | 63 - .../shaders/postFX/dof/DOF_Gausian_V.hlsl | 80 - .../shaders/postFX/dof/DOF_Passthrough_V.hlsl | 70 - .../shaders/postFX/dof/DOF_SmallBlur_P.hlsl | 46 - .../shaders/postFX/dof/DOF_SmallBlur_V.hlsl | 56 - .../shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl | 55 - .../shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl | 69 - .../postFX/dof/gl/DOF_DownSample_P.glsl | 143 - .../postFX/dof/gl/DOF_DownSample_V.glsl | 67 - .../shaders/postFX/dof/gl/DOF_Final_P.glsl | 147 - .../shaders/postFX/dof/gl/DOF_Final_V.glsl | 71 - .../shaders/postFX/dof/gl/DOF_Gausian_P.glsl | 68 - .../shaders/postFX/dof/gl/DOF_Gausian_V.glsl | 91 - .../postFX/dof/gl/DOF_Passthrough_V.glsl | 69 - .../postFX/dof/gl/DOF_SmallBlur_P.glsl | 46 - .../postFX/dof/gl/DOF_SmallBlur_V.glsl | 54 - .../postFX/edgeaa/dbgEdgeDisplayP.hlsl | 30 - .../core/shaders/postFX/edgeaa/edgeAAP.hlsl | 66 - .../core/shaders/postFX/edgeaa/edgeAAV.hlsl | 45 - .../shaders/postFX/edgeaa/edgeDetectP.hlsl | 93 - .../postFX/edgeaa/gl/dbgEdgeDisplayP.glsl | 36 - .../shaders/postFX/edgeaa/gl/edgeAAP.glsl | 70 - .../shaders/postFX/edgeaa/gl/edgeAAV.glsl | 43 - .../shaders/postFX/edgeaa/gl/edgeDetectP.glsl | 96 - .../game/core/shaders/postFX/flashP.hlsl | 36 - .../game/core/shaders/postFX/fogP.hlsl | 47 - .../game/core/shaders/postFX/fxaa/Fxaa3_11.h | 2047 ------------ .../game/core/shaders/postFX/fxaa/fxaaP.hlsl | 143 - .../game/core/shaders/postFX/fxaa/fxaaV.hlsl | 42 - .../core/shaders/postFX/fxaa/gl/fxaaP.glsl | 125 - .../core/shaders/postFX/fxaa/gl/fxaaV.glsl | 40 - .../game/core/shaders/postFX/gammaP.hlsl | 50 - .../core/shaders/postFX/gl/VolFogGlowP.glsl | 67 - .../core/shaders/postFX/gl/chromaticLens.glsl | 62 - .../game/core/shaders/postFX/gl/flashP.glsl | 39 - .../game/core/shaders/postFX/gl/fogP.glsl | 52 - .../game/core/shaders/postFX/gl/gammaP.glsl | 54 - .../core/shaders/postFX/gl/glowBlurP.glsl | 59 - .../core/shaders/postFX/gl/glowBlurV.glsl | 59 - .../core/shaders/postFX/gl/motionBlurP.glsl | 78 - .../core/shaders/postFX/gl/passthruP.glsl | 33 - .../game/core/shaders/postFX/gl/postFX.glsl | 63 - .../game/core/shaders/postFX/gl/postFxV.glsl | 52 - .../core/shaders/postFX/gl/turbulenceP.glsl | 52 - .../shaders/postFX/gl/underwaterFogP.glsl | 140 - .../game/core/shaders/postFX/glowBlurP.hlsl | 63 - .../game/core/shaders/postFX/glowBlurV.hlsl | 63 - .../shaders/postFX/hdr/bloomGaussBlurHP.hlsl | 68 - .../shaders/postFX/hdr/bloomGaussBlurVP.hlsl | 67 - .../shaders/postFX/hdr/brightPassFilterP.hlsl | 62 - .../postFX/hdr/calculateAdaptedLumP.hlsl | 44 - .../shaders/postFX/hdr/downScale4x4P.hlsl | 53 - .../shaders/postFX/hdr/downScale4x4V.hlsl | 138 - .../shaders/postFX/hdr/finalPassCombineP.hlsl | 92 - .../postFX/hdr/gl/bloomGaussBlurHP.glsl | 72 - .../postFX/hdr/gl/bloomGaussBlurVP.glsl | 71 - .../postFX/hdr/gl/brightPassFilterP.glsl | 65 - .../postFX/hdr/gl/calculateAdaptedLumP.glsl | 48 - .../shaders/postFX/hdr/gl/downScale4x4P.glsl | 50 - .../shaders/postFX/hdr/gl/downScale4x4V.glsl | 141 - .../postFX/hdr/gl/finalPassCombineP.glsl | 97 - .../shaders/postFX/hdr/gl/luminanceVisP.glsl | 42 - .../postFX/hdr/gl/sampleLumInitialP.glsl | 62 - .../postFX/hdr/gl/sampleLumIterativeP.glsl | 52 - .../shaders/postFX/hdr/luminanceVisP.hlsl | 39 - .../shaders/postFX/hdr/sampleLumInitialP.hlsl | 59 - .../postFX/hdr/sampleLumIterativeP.hlsl | 50 - .../postFX/lightRay/gl/lightRayOccludeP.glsl | 55 - .../shaders/postFX/lightRay/gl/lightRayP.glsl | 94 - .../postFX/lightRay/lightRayOccludeP.hlsl | 53 - .../shaders/postFX/lightRay/lightRayP.hlsl | 89 - .../postFX/mlaa/blendWeightCalculationP.hlsl | 78 - .../shaders/postFX/mlaa/edgeDetectionP.hlsl | 72 - .../core/shaders/postFX/mlaa/functions.hlsl | 145 - .../mlaa/gl/blendWeightCalculationP.glsl | 83 - .../postFX/mlaa/gl/edgeDetectionP.glsl | 76 - .../shaders/postFX/mlaa/gl/functions.glsl | 145 - .../postFX/mlaa/gl/neighborhoodBlendingP.glsl | 88 - .../core/shaders/postFX/mlaa/gl/offsetV.glsl | 57 - .../shaders/postFX/mlaa/gl/passthruV.glsl | 52 - .../postFX/mlaa/neighborhoodBlendingP.hlsl | 84 - .../core/shaders/postFX/mlaa/offsetV.hlsl | 42 - .../core/shaders/postFX/mlaa/passthruV.hlsl | 37 - .../game/core/shaders/postFX/motionBlurP.hlsl | 70 - .../oculusvr/barrelDistortionChromaP.hlsl | 95 - .../postFX/oculusvr/barrelDistortionP.hlsl | 80 - .../oculusvr/gl/barrelDistortionChromaP.glsl | 95 - .../postFX/oculusvr/gl/barrelDistortionP.glsl | 81 - .../postFX/oculusvr/gl/monoToStereoP.glsl | 60 - .../postFX/oculusvr/monoToStereoP.hlsl | 59 - .../game/core/shaders/postFX/passthruP.hlsl | 30 - .../game/core/shaders/postFX/postFx.hlsl | 40 - .../game/core/shaders/postFX/postFxV.glsl | 51 - .../game/core/shaders/postFX/postFxV.hlsl | 45 - .../core/shaders/postFX/ssao/SSAO_Blur_P.hlsl | 106 - .../core/shaders/postFX/ssao/SSAO_Blur_V.hlsl | 86 - .../game/core/shaders/postFX/ssao/SSAO_P.hlsl | 272 -- .../postFX/ssao/SSAO_PowerTable_P.hlsl | 29 - .../postFX/ssao/SSAO_PowerTable_V.hlsl | 45 - .../shaders/postFX/ssao/gl/SSAO_Blur_P.glsl | 108 - .../shaders/postFX/ssao/gl/SSAO_Blur_V.glsl | 96 - .../core/shaders/postFX/ssao/gl/SSAO_P.glsl | 278 -- .../postFX/ssao/gl/SSAO_PowerTable_P.glsl | 34 - .../postFX/ssao/gl/SSAO_PowerTable_V.glsl | 38 - .../game/core/shaders/postFX/turbulenceP.hlsl | 44 - .../core/shaders/postFX/underwaterFogP.hlsl | 138 - .../shaders/postFX/vignette/VignetteP.hlsl | 35 - .../shaders/postFX/vignette/gl/VignetteP.glsl | 41 - .../BaseGame/game/core/shaders/precipP.hlsl | 53 - .../BaseGame/game/core/shaders/precipV.hlsl | 71 - .../game/core/shaders/projectedShadowP.hlsl | 40 - .../game/core/shaders/projectedShadowV.hlsl | 60 - .../shaders/ribbons/basicRibbonShaderP.hlsl | 19 - .../shaders/ribbons/basicRibbonShaderV.hlsl | 35 - .../ribbons/gl/basicRibbonShaderP.glsl | 20 - .../ribbons/gl/basicRibbonShaderV.glsl | 37 - .../shaders/ribbons/gl/texRibbonShaderP.glsl | 22 - .../shaders/ribbons/gl/texRibbonShaderV.glsl | 37 - .../shaders/ribbons/texRibbonShaderP.hlsl | 21 - .../shaders/ribbons/texRibbonShaderV.hlsl | 35 - .../game/core/shaders/scatterSkyP.hlsl | 69 - .../game/core/shaders/scatterSkyV.hlsl | 157 - .../game/core/shaders/shaderModel.hlsl | 97 - .../game/core/shaders/shaderModelAutoGen.hlsl | 35 - .../BaseGame/game/core/shaders/shdrConsts.h | 117 - .../game/core/shaders/terrain/blendP.hlsl | 48 - .../game/core/shaders/terrain/blendV.hlsl | 52 - .../game/core/shaders/terrain/gl/blendP.glsl | 48 - .../game/core/shaders/terrain/gl/blendV.glsl | 41 - .../game/core/shaders/terrain/terrain.glsl | 52 - .../game/core/shaders/terrain/terrain.hlsl | 55 - .../BaseGame/game/core/shaders/torque.hlsl | 342 -- .../core/shaders/water/gl/waterBasicP.glsl | 216 -- .../core/shaders/water/gl/waterBasicV.glsl | 243 -- .../game/core/shaders/water/gl/waterP.glsl | 396 --- .../game/core/shaders/water/gl/waterV.glsl | 241 -- .../game/core/shaders/water/waterBasicP.hlsl | 213 -- .../game/core/shaders/water/waterBasicV.hlsl | 237 -- .../game/core/shaders/water/waterP.hlsl | 383 --- .../game/core/shaders/water/waterV.hlsl | 216 -- .../BaseGame/game/core/shaders/wavesP.hlsl | 89 - .../BaseGame/game/core/shaders/wavesV.hlsl | 90 - .../BaseGame/game/core/shaders/wind.hlsl | 101 - .../game/data/clientServer/ClientServer.cs | 112 - .../data/clientServer/ClientServer.module | 9 - .../clientServer/scripts/client/client.cs | 29 - .../scripts/client/connectionToServer.cs | 130 - .../scripts/client/levelDownload.cs | 185 -- .../clientServer/scripts/client/levelLoad.cs | 92 - .../clientServer/scripts/client/message.cs | 94 - .../data/clientServer/scripts/server/audio.cs | 40 - .../clientServer/scripts/server/commands.cs | 35 - .../scripts/server/connectionToClient.cs | 178 -- .../clientServer/scripts/server/defaults.cs | 62 - .../clientServer/scripts/server/kickban.cs | 41 - .../scripts/server/levelDownload.cs | 187 -- .../clientServer/scripts/server/levelInfo.cs | 197 -- .../clientServer/scripts/server/levelLoad.cs | 181 -- .../clientServer/scripts/server/message.cs | 50 - .../clientServer/scripts/server/server.cs | 303 -- 396 files changed, 39611 deletions(-) delete mode 100644 Templates/BaseGame/game/core/CoreComponents.cs delete mode 100644 Templates/BaseGame/game/core/CoreComponents.module delete mode 100644 Templates/BaseGame/game/core/audio.cs delete mode 100644 Templates/BaseGame/game/core/canvas.cs delete mode 100644 Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/animationComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/collisionComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/camera.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/camera.cs delete mode 100644 Templates/BaseGame/game/core/components/game/controlObject.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/controlObject.cs delete mode 100644 Templates/BaseGame/game/core/components/game/itemRotate.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/itemRotate.cs delete mode 100644 Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/playerSpawner.cs delete mode 100644 Templates/BaseGame/game/core/components/input/fpsControls.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/input/fpsControls.cs delete mode 100644 Templates/BaseGame/game/core/components/input/inputManager.cs delete mode 100644 Templates/BaseGame/game/core/components/meshComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/soundComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/console/console.gui delete mode 100644 Templates/BaseGame/game/core/console/main.cs delete mode 100644 Templates/BaseGame/game/core/console/profiles.cs delete mode 100644 Templates/BaseGame/game/core/cursor.cs delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial Bold 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial Bold 16 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial Bold 18 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/ArialBold 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/ArialItalic 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Lucida Console 12 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/gfxData/clouds.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/commonMaterialData.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/scatterSky.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/shaders.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/terrainBlock.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/water.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.cs delete mode 100644 Templates/BaseGame/game/core/globals.cs delete mode 100644 Templates/BaseGame/game/core/helperFunctions.cs delete mode 100644 Templates/BaseGame/game/core/images/AreaMap33.dds delete mode 100644 Templates/BaseGame/game/core/images/button.png delete mode 100644 Templates/BaseGame/game/core/images/caustics_1.png delete mode 100644 Templates/BaseGame/game/core/images/caustics_2.png delete mode 100644 Templates/BaseGame/game/core/images/checkbox.png delete mode 100644 Templates/BaseGame/game/core/images/group-border.png delete mode 100644 Templates/BaseGame/game/core/images/inactive-overlay.png delete mode 100644 Templates/BaseGame/game/core/images/loadingbar.png delete mode 100644 Templates/BaseGame/game/core/images/materials.cs delete mode 100644 Templates/BaseGame/game/core/images/missingTexture.png delete mode 100644 Templates/BaseGame/game/core/images/noise.png delete mode 100644 Templates/BaseGame/game/core/images/null_color_ramp.png delete mode 100644 Templates/BaseGame/game/core/images/scrollBar.png delete mode 100644 Templates/BaseGame/game/core/images/textEdit.png delete mode 100644 Templates/BaseGame/game/core/images/thumbHighlightButton.png delete mode 100644 Templates/BaseGame/game/core/images/unavailable.png delete mode 100644 Templates/BaseGame/game/core/images/warnMat.dds delete mode 100644 Templates/BaseGame/game/core/images/window.png delete mode 100644 Templates/BaseGame/game/core/lighting.cs delete mode 100644 Templates/BaseGame/game/core/lighting/advanced/deferredShading.cs delete mode 100644 Templates/BaseGame/game/core/lighting/advanced/init.cs delete mode 100644 Templates/BaseGame/game/core/lighting/advanced/shaders.cs delete mode 100644 Templates/BaseGame/game/core/lighting/basic/init.cs delete mode 100644 Templates/BaseGame/game/core/lighting/basic/shadowFilter.cs delete mode 100644 Templates/BaseGame/game/core/lighting/shadowMaps/init.cs delete mode 100644 Templates/BaseGame/game/core/main.cs delete mode 100644 Templates/BaseGame/game/core/oculusVR.cs delete mode 100644 Templates/BaseGame/game/core/oculusVROverlay.gui delete mode 100644 Templates/BaseGame/game/core/parseArgs.cs delete mode 100644 Templates/BaseGame/game/core/postFX/GammaPostFX.cs delete mode 100644 Templates/BaseGame/game/core/postFX/MLAA.cs delete mode 100644 Templates/BaseGame/game/core/postFX/MotionBlurFx.cs delete mode 100644 Templates/BaseGame/game/core/postFX/caustics.cs delete mode 100644 Templates/BaseGame/game/core/postFX/chromaticLens.cs delete mode 100644 Templates/BaseGame/game/core/postFX/default.postfxpreset.cs delete mode 100644 Templates/BaseGame/game/core/postFX/dof.cs delete mode 100644 Templates/BaseGame/game/core/postFX/edgeAA.cs delete mode 100644 Templates/BaseGame/game/core/postFX/flash.cs delete mode 100644 Templates/BaseGame/game/core/postFX/fog.cs delete mode 100644 Templates/BaseGame/game/core/postFX/fxaa.cs delete mode 100644 Templates/BaseGame/game/core/postFX/glow.cs delete mode 100644 Templates/BaseGame/game/core/postFX/hdr.cs delete mode 100644 Templates/BaseGame/game/core/postFX/lightRay.cs delete mode 100644 Templates/BaseGame/game/core/postFX/ovrBarrelDistortion.cs delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.gui delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.gui.cs delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.gui.settings.cs delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.persistance.cs delete mode 100644 Templates/BaseGame/game/core/postFX/ssao.cs delete mode 100644 Templates/BaseGame/game/core/postFX/turbulence.cs delete mode 100644 Templates/BaseGame/game/core/postFX/vignette.cs delete mode 100644 Templates/BaseGame/game/core/postFx.cs delete mode 100644 Templates/BaseGame/game/core/profiles.cs delete mode 100644 Templates/BaseGame/game/core/renderManager.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioAmbience.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioData.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioDescriptions.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioEnvironments.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioStates.cs delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogRefl.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogPreP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogPreV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogRefl.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/basicCloudsP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/basicCloudsV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/cloudLayerP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/cloudLayerV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/addColorTextureP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/addColorTextureV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/colorP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/colorV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/addColorTextureP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/addColorTextureV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/colorP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/colorV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/modColorTextureP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/modColorTextureV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/targetRestoreP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/targetRestoreV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/textureP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/textureV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/modColorTextureP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/modColorTextureV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/targetRestoreP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/targetRestoreV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/textureP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/textureV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/foliage.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fxFoliageReplicatorP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fxFoliageReplicatorV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/basicCloudsP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/basicCloudsV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/blurP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/blurV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/cloudLayerP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/cloudLayerV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/foliage.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/fxFoliageReplicatorP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/fxFoliageReplicatorV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/guiMaterialV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/hlslCompat.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/imposter.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/lighting.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particleCompositeP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particleCompositeV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particlesP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particlesV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectBumpP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectBumpV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/precipP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/precipV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/projectedShadowP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/projectedShadowV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/scatterSkyP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/scatterSkyV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/torque.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/wavesP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/wind.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/guiMaterialV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/hlslStructs.h delete mode 100644 Templates/BaseGame/game/core/shaders/hlslStructs.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/imposter.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/convexGeometryV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredColorShaderP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredShadingP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/farFrustumQuad.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/farFrustumQuadV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/convexGeometryV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredColorShaderP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredShadingP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/farFrustumQuad.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/farFrustumQuadV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/lightingUtils.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/pointLightP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/softShadow.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/spotLightP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/vectorLightP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/lightingUtils.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/pointLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/softShadow.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/spotLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/vectorLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/gl/shadowFilterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/gl/shadowFilterV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/shadowFilterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/shadowFilterV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/boxFilterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/boxFilterV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/gl/boxFilterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/gl/boxFilterV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/shadowMapIO.h delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/shadowMapIO_GLSL.h delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/shadowMapIO_HLSL.h delete mode 100644 Templates/BaseGame/game/core/shaders/particleCompositeP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/particleCompositeV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/particlesP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/particlesV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectBumpP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectBumpV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/VolFogGlowP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/caustics/causticsP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/caustics/gl/causticsP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/chromaticLens.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_CalcCoC_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_CalcCoC_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_DownSample_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_DownSample_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Final_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Final_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Gausian_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Gausian_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Passthrough_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_SmallBlur_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_SmallBlur_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Gausian_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Gausian_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeAAP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeAAV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeDetectP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeAAP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeAAV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeDetectP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/flashP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fogP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/Fxaa3_11.h delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/gl/fxaaP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/gl/fxaaV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gammaP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/VolFogGlowP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/chromaticLens.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/flashP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/fogP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/gammaP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/glowBlurP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/glowBlurV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/motionBlurP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/passthruP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/postFX.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/postFxV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/turbulenceP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/underwaterFogP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/glowBlurP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/glowBlurV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/bloomGaussBlurHP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/bloomGaussBlurVP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/brightPassFilterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/calculateAdaptedLumP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/downScale4x4P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/downScale4x4V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/finalPassCombineP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/brightPassFilterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/downScale4x4P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/downScale4x4V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/finalPassCombineP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/luminanceVisP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/sampleLumInitialP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/luminanceVisP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/sampleLumInitialP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/sampleLumIterativeP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayOccludeP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/blendWeightCalculationP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/edgeDetectionP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/functions.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/edgeDetectionP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/functions.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/offsetV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/passthruV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/offsetV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/passthruV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/motionBlurP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/barrelDistortionChromaP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/barrelDistortionP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/gl/barrelDistortionChromaP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/gl/barrelDistortionP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/gl/monoToStereoP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/monoToStereoP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/passthruP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/postFx.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/postFxV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/postFxV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/turbulenceP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/underwaterFogP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/vignette/VignetteP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/vignette/gl/VignetteP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/precipP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/precipV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/projectedShadowP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/projectedShadowV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/basicRibbonShaderP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/basicRibbonShaderV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/basicRibbonShaderP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/basicRibbonShaderV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/texRibbonShaderP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/texRibbonShaderV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/texRibbonShaderP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/texRibbonShaderV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/scatterSkyP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/scatterSkyV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/shaderModel.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/shaderModelAutoGen.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/shdrConsts.h delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/blendP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/blendV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/gl/blendP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/gl/blendV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/terrain.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/terrain.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/torque.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterBasicP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterBasicV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterBasicP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterBasicV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/wavesP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/wavesV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/wind.hlsl delete mode 100644 Templates/BaseGame/game/data/clientServer/ClientServer.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/ClientServer.module delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/client.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/connectionToServer.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/levelDownload.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/levelLoad.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/message.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/audio.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/commands.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/defaults.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/kickban.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/levelInfo.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/levelLoad.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/message.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/server.cs diff --git a/Templates/BaseGame/game/core/CoreComponents.cs b/Templates/BaseGame/game/core/CoreComponents.cs deleted file mode 100644 index 5bdca8cd3..000000000 --- a/Templates/BaseGame/game/core/CoreComponents.cs +++ /dev/null @@ -1,10 +0,0 @@ - -function CoreComponentsModule::onCreate(%this) -{ - %classList = enumerateConsoleClasses( "Component" ); - - foreach$( %componentClass in %classList ) - { - echo("Native Component of type: " @ %componentClass); - } -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/CoreComponents.module b/Templates/BaseGame/game/core/CoreComponents.module deleted file mode 100644 index 0636e3bb5..000000000 --- a/Templates/BaseGame/game/core/CoreComponents.module +++ /dev/null @@ -1,19 +0,0 @@ - - - - \ No newline at end of file diff --git a/Templates/BaseGame/game/core/audio.cs b/Templates/BaseGame/game/core/audio.cs deleted file mode 100644 index a5932de8f..000000000 --- a/Templates/BaseGame/game/core/audio.cs +++ /dev/null @@ -1,436 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Source groups. -//----------------------------------------------------------------------------- - -singleton SFXDescription( AudioMaster ); -singleton SFXSource( AudioChannelMaster ) -{ - description = AudioMaster; -}; - -singleton SFXDescription( AudioChannel ) -{ - sourceGroup = AudioChannelMaster; -}; - -singleton SFXSource( AudioChannelDefault ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelGui ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelEffects ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelMessages ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelMusic ) -{ - description = AudioChannel; -}; - -// Set default playback states of the channels. - -AudioChannelMaster.play(); -AudioChannelDefault.play(); - -AudioChannelGui.play(); -AudioChannelMusic.play(); -AudioChannelMessages.play(); - -// Stop in-game effects channels. -AudioChannelEffects.stop(); - -//----------------------------------------------------------------------------- -// Master SFXDescriptions. -//----------------------------------------------------------------------------- - -// Master description for interface audio. -singleton SFXDescription( AudioGui ) -{ - volume = 1.0; - sourceGroup = AudioChannelGui; -}; - -// Master description for game effects audio. -singleton SFXDescription( AudioEffect ) -{ - volume = 1.0; - sourceGroup = AudioChannelEffects; -}; - -// Master description for audio in notifications. -singleton SFXDescription( AudioMessage ) -{ - volume = 1.0; - sourceGroup = AudioChannelMessages; -}; - -// Master description for music. -singleton SFXDescription( AudioMusic ) -{ - volume = 1.0; - sourceGroup = AudioChannelMusic; -}; - -//----------------------------------------------------------------------------- -// SFX Functions. -//----------------------------------------------------------------------------- - -/// This initializes the sound system device from -/// the defaults in the $pref::SFX:: globals. -function sfxStartup() -{ - echo( "\nsfxStartup..." ); - - // If we have a provider set, try initialize a device now. - - if( $pref::SFX::provider !$= "" ) - { - if( sfxInit() ) - return; - else - { - // Force auto-detection. - $pref::SFX::autoDetect = true; - } - } - - // If enabled autodetect a safe device. - - if( ( !isDefined( "$pref::SFX::autoDetect" ) || $pref::SFX::autoDetect ) && - sfxAutodetect() ) - return; - - // Failure. - - error( " Failed to initialize device!\n\n" ); - - $pref::SFX::provider = ""; - $pref::SFX::device = ""; - - return; -} - - -/// This initializes the sound system device from -/// the defaults in the $pref::SFX:: globals. -function sfxInit() -{ - // If already initialized, shut down the current device first. - - if( sfxGetDeviceInfo() !$= "" ) - sfxShutdown(); - - // Start it up! - %maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers; - if ( !sfxCreateDevice( $pref::SFX::provider, $pref::SFX::device, $pref::SFX::useHardware, %maxBuffers ) ) - return false; - - // This returns a tab seperated string with - // the initialized system info. - %info = sfxGetDeviceInfo(); - $pref::SFX::provider = getField( %info, 0 ); - $pref::SFX::device = getField( %info, 1 ); - $pref::SFX::useHardware = getField( %info, 2 ); - %useHardware = $pref::SFX::useHardware ? "Yes" : "No"; - %maxBuffers = getField( %info, 3 ); - - echo( " Provider: " @ $pref::SFX::provider ); - echo( " Device: " @ $pref::SFX::device ); - echo( " Hardware: " @ %useHardware ); - echo( " Max Buffers: " @ %maxBuffers ); - echo( " " ); - - if( isDefined( "$pref::SFX::distanceModel" ) ) - sfxSetDistanceModel( $pref::SFX::distanceModel ); - if( isDefined( "$pref::SFX::dopplerFactor" ) ) - sfxSetDopplerFactor( $pref::SFX::dopplerFactor ); - if( isDefined( "$pref::SFX::rolloffFactor" ) ) - sfxSetRolloffFactor( $pref::SFX::rolloffFactor ); - - // Restore master volume. - - sfxSetMasterVolume( $pref::SFX::masterVolume ); - - // Restore channel volumes. - - for( %channel = 0; %channel <= 8; %channel ++ ) - sfxSetChannelVolume( %channel, $pref::SFX::channelVolume[ %channel ] ); - - return true; -} - - -/// Destroys the current sound system device. -function sfxShutdown() -{ - // Store volume prefs. - - $pref::SFX::masterVolume = sfxGetMasterVolume(); - - for( %channel = 0; %channel <= 8; %channel ++ ) - $pref::SFX::channelVolume[ %channel ] = sfxGetChannelVolume( %channel ); - - // We're assuming here that a null info - // string means that no device is loaded. - if( sfxGetDeviceInfo() $= "" ) - return; - - sfxDeleteDevice(); -} - - -/// Determines which of the two SFX providers is preferable. -function sfxCompareProvider( %providerA, %providerB ) -{ - if( %providerA $= %providerB ) - return 0; - - switch$( %providerA ) - { - // Always prefer FMOD over anything else. - case "FMOD": - return 1; - - // Prefer OpenAL over anything but FMOD. - case "OpenAL": - if( %providerB $= "FMOD" ) - return -1; - else - return 1; - - // choose XAudio over DirectSound - case "XAudio": - if( %providerB $= "FMOD" || %providerB $= "OpenAL" ) - return -1; - else - return 0; - - case "DirectSound": - if( %providerB !$= "FMOD" && %providerB !$= "OpenAL" && %providerB !$= "XAudio" ) - return 1; - else - return -1; - - default: - return -1; - } -} - - -/// Try to detect and initalize the best SFX device available. -function sfxAutodetect() -{ - // Get all the available devices. - - %devices = sfxGetAvailableDevices(); - - // Collect and sort the devices by preferentiality. - - %deviceTrySequence = new ArrayObject(); - %bestMatch = -1; - %count = getRecordCount( %devices ); - for( %i = 0; %i < %count; %i ++ ) - { - %info = getRecord( %devices, %i ); - %provider = getField( %info, 0 ); - - %deviceTrySequence.push_back( %provider, %info ); - } - - %deviceTrySequence.sortfkd( "sfxCompareProvider" ); - - // Try the devices in order. - - %count = %deviceTrySequence.count(); - for( %i = 0; %i < %count; %i ++ ) - { - %provider = %deviceTrySequence.getKey( %i ); - %info = %deviceTrySequence.getValue( %i ); - - $pref::SFX::provider = %provider; - $pref::SFX::device = getField( %info, 1 ); - $pref::SFX::useHardware = getField( %info, 2 ); - - // By default we've decided to avoid hardware devices as - // they are buggy and prone to problems. - $pref::SFX::useHardware = false; - - if( sfxInit() ) - { - $pref::SFX::autoDetect = false; - %deviceTrySequence.delete(); - return true; - } - } - - // Found no suitable device. - - error( "sfxAutodetect - Could not initialize a valid SFX device." ); - - $pref::SFX::provider = ""; - $pref::SFX::device = ""; - $pref::SFX::useHardware = ""; - - %deviceTrySequence.delete(); - - return false; -} - - -//----------------------------------------------------------------------------- -// Backwards-compatibility with old channel system. -//----------------------------------------------------------------------------- - -// Volume channel IDs for backwards-compatibility. - -$GuiAudioType = 1; // Interface. -$SimAudioType = 2; // Game. -$MessageAudioType = 3; // Notifications. -$MusicAudioType = 4; // Music. - -$AudioChannels[ 0 ] = AudioChannelDefault; -$AudioChannels[ $GuiAudioType ] = AudioChannelGui; -$AudioChannels[ $SimAudioType ] = AudioChannelEffects; -$AudioChannels[ $MessageAudioType ] = AudioChannelMessages; -$AudioChannels[ $MusicAudioType ] = AudioChannelMusic; - -function sfxOldChannelToGroup( %channel ) -{ - return $AudioChannels[ %channel ]; -} - -function sfxGroupToOldChannel( %group ) -{ - %id = %group.getId(); - for( %i = 0;; %i ++ ) - if( !isObject( $AudioChannels[ %i ] ) ) - return -1; - else if( $AudioChannels[ %i ].getId() == %id ) - return %i; - - return -1; -} - -function sfxSetMasterVolume( %volume ) -{ - AudioChannelMaster.setVolume( %volume ); -} - -function sfxGetMasterVolume( %volume ) -{ - return AudioChannelMaster.getVolume(); -} - -function sfxStopAll( %channel ) -{ - // Don't stop channel itself since that isn't quite what the function - // here intends. - - %channel = sfxOldChannelToGroup( %channel ); - if (isObject(%channel)) - { - foreach( %source in %channel ) - %source.stop(); - } -} - -function sfxGetChannelVolume( %channel ) -{ - %obj = sfxOldChannelToGroup( %channel ); - if( isObject( %obj ) ) - return %obj.getVolume(); -} - -function sfxSetChannelVolume( %channel, %volume ) -{ - %obj = sfxOldChannelToGroup( %channel ); - if( isObject( %obj ) ) - %obj.setVolume( %volume ); -} - -/*singleton SimSet( SFXPausedSet ); - - -/// Pauses the playback of active sound sources. -/// -/// @param %channels An optional word list of channel indices or an empty -/// string to pause sources on all channels. -/// @param %pauseSet An optional SimSet which is filled with the paused -/// sources. If not specified the global SfxSourceGroup -/// is used. -/// -/// @deprecated -/// -function sfxPause( %channels, %pauseSet ) -{ - // Did we get a set to populate? - if ( !isObject( %pauseSet ) ) - %pauseSet = SFXPausedSet; - - %count = SFXSourceSet.getCount(); - for ( %i = 0; %i < %count; %i++ ) - { - %source = SFXSourceSet.getObject( %i ); - - %channel = sfxGroupToOldChannel( %source.getGroup() ); - if( %channels $= "" || findWord( %channels, %channel ) != -1 ) - { - %source.pause(); - %pauseSet.add( %source ); - } - } -} - - -/// Resumes the playback of paused sound sources. -/// -/// @param %pauseSet An optional SimSet which contains the paused sound -/// sources to be resumed. If not specified the global -/// SfxSourceGroup is used. -/// @deprecated -/// -function sfxResume( %pauseSet ) -{ - if ( !isObject( %pauseSet ) ) - %pauseSet = SFXPausedSet; - - %count = %pauseSet.getCount(); - for ( %i = 0; %i < %count; %i++ ) - { - %source = %pauseSet.getObject( %i ); - %source.play(); - } - - // Clear our pause set... the caller is left - // to clear his own if he passed one. - %pauseSet.clear(); -}*/ diff --git a/Templates/BaseGame/game/core/canvas.cs b/Templates/BaseGame/game/core/canvas.cs deleted file mode 100644 index b38cdccca..000000000 --- a/Templates/BaseGame/game/core/canvas.cs +++ /dev/null @@ -1,162 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function createCanvas(%windowTitle) -{ - if ($isDedicated) - { - GFXInit::createNullDevice(); - return true; - } - - // Create the Canvas - $GameCanvas = new GuiCanvas(Canvas) - { - displayWindow = $platform !$= "windows"; - }; - - // Set the window title - if (isObject(Canvas)) - { - Canvas.setWindowTitle(%windowTitle @ " - " @ $pref::Video::displayDevice); - configureCanvas(); - } - else - { - error("Canvas creation failed. Shutting down."); - quit(); - } -} - -// Constants for referencing video resolution preferences -$WORD::RES_X = 0; -$WORD::RES_Y = 1; -$WORD::FULLSCREEN = 2; -$WORD::BITDEPTH = 3; -$WORD::REFRESH = 4; -$WORD::AA = 5; - -function configureCanvas() -{ - // Setup a good default if we don't have one already. - if ($pref::Video::Resolution $= "") - $pref::Video::Resolution = "800 600"; - if ($pref::Video::FullScreen $= "") - $pref::Video::FullScreen = false; - if ($pref::Video::BitDepth $= "") - $pref::Video::BitDepth = "32"; - if ($pref::Video::RefreshRate $= "") - $pref::Video::RefreshRate = "60"; - if ($pref::Video::AA $= "") - $pref::Video::AA = "4"; - - %resX = $pref::Video::Resolution.x; - %resY = $pref::Video::Resolution.y; - %fs = $pref::Video::FullScreen; - %bpp = $pref::Video::BitDepth; - %rate = $pref::Video::RefreshRate; - %aa = $pref::Video::AA; - - if($cliFullscreen !$= "") { - %fs = $cliFullscreen; - $cliFullscreen = ""; - } - - echo("--------------"); - echo("Attempting to set resolution to \"" @ %resX SPC %resY SPC %fs SPC %bpp SPC %rate SPC %aa @ "\""); - - %deskRes = getDesktopResolution(); - %deskResX = getWord(%deskRes, $WORD::RES_X); - %deskResY = getWord(%deskRes, $WORD::RES_Y); - %deskResBPP = getWord(%deskRes, 2); - - // We shouldn't be getting this any more but just in case... - if (%bpp $= "Default") - %bpp = %deskResBPP; - - // Make sure we are running at a valid resolution - if (%fs $= "0" || %fs $= "false") - { - // Windowed mode has to use the same bit depth as the desktop - %bpp = %deskResBPP; - - // Windowed mode also has to run at a smaller resolution than the desktop - if ((%resX >= %deskResX) || (%resY >= %deskResY)) - { - warn("Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution"); - - %resCount = Canvas.getModeCount(); - for (%i = (%resCount - 1); %i >= 0; %i--) - { - %testRes = Canvas.getMode(%i); - %testResX = getWord(%testRes, $WORD::RES_X); - %testResY = getWord(%testRes, $WORD::RES_Y); - %testBPP = getWord(%testRes, $WORD::BITDEPTH); - - if (%testBPP != %bpp) - continue; - - if ((%testResX < %deskResX) && (%testResY < %deskResY)) - { - // This will work as our new resolution - %resX = %testResX; - %resY = %testResY; - - warn("Warning: Switching to \"" @ %resX SPC %resY SPC %bpp @ "\""); - - break; - } - } - } - } - - $pref::Video::Resolution = %resX SPC %resY; - $pref::Video::FullScreen = %fs; - $pref::Video::BitDepth = %bpp; - $pref::Video::RefreshRate = %rate; - $pref::Video::AA = %aa; - - if (%fs == 1 || %fs $= "true") - %fsLabel = "Yes"; - else - %fsLabel = "No"; - - echo("Accepted Mode: " NL - "--Resolution : " @ %resX SPC %resY NL - "--Full Screen : " @ %fsLabel NL - "--Bits Per Pixel : " @ %bpp NL - "--Refresh Rate : " @ %rate NL - "--AA TypeXLevel : " @ %aa NL - "--------------"); - - // Actually set the new video mode - Canvas.setVideoMode(%resX, %resY, %fs, %bpp, %rate, %aa); - - commandToServer('setClientAspectRatio', %resX, %resY); - - // AA piggybacks on the AA setting in $pref::Video::mode. - // We need to parse the setting between AA modes, and then it's level - // It's formatted as AATypexAALevel - // So, FXAAx4 or MLAAx2 - if ( isObject( FXAA_PostEffect ) ) - FXAA_PostEffect.isEnabled = ( %aa > 0 ) ? true : false; -} diff --git a/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml deleted file mode 100644 index 8e60db364..000000000 --- a/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/animationComponent.asset.taml b/Templates/BaseGame/game/core/components/animationComponent.asset.taml deleted file mode 100644 index 771d38e02..000000000 --- a/Templates/BaseGame/game/core/components/animationComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml deleted file mode 100644 index b615f2348..000000000 --- a/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/collisionComponent.asset.taml b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml deleted file mode 100644 index 1a4f99a0d..000000000 --- a/Templates/BaseGame/game/core/components/collisionComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/camera.asset.taml b/Templates/BaseGame/game/core/components/game/camera.asset.taml deleted file mode 100644 index f59e429e2..000000000 --- a/Templates/BaseGame/game/core/components/game/camera.asset.taml +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/camera.cs b/Templates/BaseGame/game/core/components/game/camera.cs deleted file mode 100644 index b6f510c9d..000000000 --- a/Templates/BaseGame/game/core/components/game/camera.cs +++ /dev/null @@ -1,185 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function CameraComponent::onAdd(%this) -{ - %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", ""); - - %test = %this.clientOwner; - - %barf = ClientGroup.getCount(); - - %clientID = %this.getClientID(); - if(%clientID && !isObject(%clientID.camera)) - { - %this.scopeToClient(%clientID); - %this.setDirty(); - - %clientID.setCameraObject(%this.owner); - %clientID.setControlCameraFov(%this.FOV); - - %clientID.camera = %this.owner; - } - - %res = $pref::Video::mode; - %derp = 0; -} - -function CameraComponent::onRemove(%this) -{ - %clientID = %this.getClientID(); - if(%clientID) - %clientID.clearCameraObject(); -} - -function CameraComponent::onInspectorUpdate(%this) -{ - //if(%this.clientOwner) - //%this.clientOwner.setCameraObject(%this.owner); -} - -function CameraComponent::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} - -function CameraComponent::isClientCamera(%this, %client) -{ - %clientID = ClientGroup.getObject(%this.clientOwner-1); - - if(%client.getID() == %clientID) - return true; - else - return false; -} - -function CameraComponent::onClientConnect(%this, %client) -{ - //if(%this.isClientCamera(%client) && !isObject(%client.camera)) - //{ - %this.scopeToClient(%client); - %this.setDirty(); - - %client.setCameraObject(%this.owner); - %client.setControlCameraFov(%this.FOV); - - %client.camera = %this.owner; - //} - //else - //{ - // echo("CONNECTED CLIENT IS NOT CAMERA OWNER!"); - //} -} - -function CameraComponent::onClientDisconnect(%this, %client) -{ - Parent::onClientDisconnect(%this, %client); - - if(isClientCamera(%client)){ - %this.clearScopeToClient(%client); - %client.clearCameraObject(); - } -} - -/// -/// -/// - -function VRCameraComponent::onAdd(%this) -{ - %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", ""); - - %test = %this.clientOwner; - - %barf = ClientGroup.getCount(); - - %clientID = %this.getClientID(); - if(%clientID && !isObject(%clientID.camera)) - { - %this.scopeToClient(%clientID); - %this.setDirty(); - - %clientID.setCameraObject(%this.owner); - %clientID.setControlCameraFov(%this.FOV); - - %clientID.camera = %this.owner; - } - - %res = $pref::Video::mode; - %derp = 0; -} - -function VRCameraComponent::onRemove(%this) -{ - %clientID = %this.getClientID(); - if(%clientID) - %clientID.clearCameraObject(); -} - -function CameraComponent::onInspectorUpdate(%this) -{ - //if(%this.clientOwner) - //%this.clientOwner.setCameraObject(%this.owner); -} - -function VRCameraComponent::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} - -function VRCameraComponent::isClientCamera(%this, %client) -{ - %clientID = ClientGroup.getObject(%this.clientOwner-1); - - if(%client.getID() == %clientID) - return true; - else - return false; -} - -function VRCameraComponent::onClientConnect(%this, %client) -{ - //if(%this.isClientCamera(%client) && !isObject(%client.camera)) - //{ - %this.scopeToClient(%client); - %this.setDirty(); - - %client.setCameraObject(%this.owner); - %client.setControlCameraFov(%this.FOV); - - %client.camera = %this.owner; - //} - //else - //{ - // echo("CONNECTED CLIENT IS NOT CAMERA OWNER!"); - //} -} - -function VRCameraComponent::onClientDisconnect(%this, %client) -{ - Parent::onClientDisconnect(%this, %client); - - if(isClientCamera(%client)){ - %this.clearScopeToClient(%client); - %client.clearCameraObject(); - } -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/game/controlObject.asset.taml b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml deleted file mode 100644 index 19515e833..000000000 --- a/Templates/BaseGame/game/core/components/game/controlObject.asset.taml +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/controlObject.cs b/Templates/BaseGame/game/core/components/game/controlObject.cs deleted file mode 100644 index 7f477ecca..000000000 --- a/Templates/BaseGame/game/core/components/game/controlObject.cs +++ /dev/null @@ -1,89 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("ControlObjectComponent", "Component", "Control Object", "Game", false, "Allows the behavior owner to operate as a camera."); - -function ControlObjectComponent::onAdd(%this) -{ - %this.addComponentField(clientOwner, "The shape to use for rendering", "int", "1", ""); - - %clientID = %this.getClientID(); - - if(%clientID && !isObject(%clientID.getControlObject())) - %clientID.setControlObject(%this.owner); -} - -function ControlObjectComponent::onRemove(%this) -{ - %clientID = %this.getClientID(); - - if(%clientID) - %clientID.setControlObject(0); -} - -function ControlObjectComponent::onClientConnect(%this, %client) -{ - if(%this.isControlClient(%client) && !isObject(%client.getControlObject())) - %client.setControlObject(%this.owner); -} - -function ControlObjectComponent::onClientDisconnect(%this, %client) -{ - if(%this.isControlClient(%client)) - %client.setControlObject(0); -} - -function ControlObjectComponent::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} - -function ControlObjectComponent::isControlClient(%this, %client) -{ - %clientID = ClientGroup.getObject(%this.clientOwner-1); - - if(%client.getID() == %clientID) - return true; - else - return false; -} - -function ControlObjectComponent::onInspectorUpdate(%this, %field) -{ - %clientID = %this.getClientID(); - - if(%clientID && !isObject(%clientID.getControlObject())) - %clientID.setControlObject(%this.owner); -} - -function switchControlObject(%client, %newControlEntity) -{ - if(!isObject(%client) || !isObject(%newControlEntity)) - return error("SwitchControlObject: No client or target controller!"); - - %control = %newControlEntity.getComponent(ControlObjectComponent); - - if(!isObject(%control)) - return error("SwitchControlObject: Target controller has no conrol object behavior!"); - - %client.setControlObject(%newControlEntity); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml deleted file mode 100644 index 4c0c1bec4..000000000 --- a/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/itemRotate.cs b/Templates/BaseGame/game/core/components/game/itemRotate.cs deleted file mode 100644 index 947d19214..000000000 --- a/Templates/BaseGame/game/core/components/game/itemRotate.cs +++ /dev/null @@ -1,49 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("ItemRotationComponent", "Component", "Item Rotation", "Game", false, "Rotates the entity around the z axis, like an item pickup."); - -function ItemRotationComponent::onAdd(%this) -{ - %this.addComponentField(rotationsPerMinute, "Number of rotations per minute", "float", "5", ""); - %this.addComponentField(forward, "Rotate forward or backwards", "bool", "1", ""); - %this.addComponentField(horizontal, "Rotate horizontal or verticle, true for horizontal", "bool", "1", ""); -} - -function ItemRotationComponent::Update(%this) -{ - %tickRate = 0.032; - - //Rotations per second is calculated based on a standard update tick being 32ms. So we scale by the tick speed, then add that to our rotation to - //get a nice rotation speed. - if(%this.horizontal) - { - if(%this.forward) - %this.owner.rotation.z += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate; - else - %this.owner.rotation.z -= ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate; - } - else - { - %this.owner.rotation.x += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate; - } -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml deleted file mode 100644 index 8a597aca4..000000000 --- a/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/playerSpawner.cs b/Templates/BaseGame/game/core/components/game/playerSpawner.cs deleted file mode 100644 index a7387eaf1..000000000 --- a/Templates/BaseGame/game/core/components/game/playerSpawner.cs +++ /dev/null @@ -1,78 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("PlayerSpawner", "Component", -// "Player Spawner", "Game", false, "When a client connects, it spawns a player object for them and attaches them to it"); - -function PlayerSpawner::onAdd(%this) -{ - %this.clientCount = 1; - %this.friendlyName = "Player Spawner"; - %this.componentType = "Spawner"; - - %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject"); -} - -function PlayerSpawner::onClientConnect(%this, %client) -{ - %playerObj = spawnGameObject(%this.GameObjectName, false); - - if(!isObject(%playerObj)) - return; - - %playerObj.position = %this.owner.position; - - %playerObj.notify("onClientConnect", %client); - - switchControlObject(%client, %playerObj); - switchCamera(%client, %playerObj); - - %client.player = %playerObj; - %client.camera = %playerObj; - - %inventory = %playerObj.getComponent(InventoryController); - - if(isObject(%inventory)) - { - for(%i=0; %i<5; %i++) - { - %arrow = spawnGameObject(ArrowProjectile, false); - - %inventory.addItem(%arrow); - } - } - - %playerObj.position = %this.owner.position; - %playerObj.rotation = "0 0 0"; - - %this.clientCount++; -} - -function PlayerSpawner::onClientDisConnect(%this, %client) -{ - -} - -function PlayerSpawner::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml deleted file mode 100644 index cd0440055..000000000 --- a/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/input/fpsControls.cs b/Templates/BaseGame/game/core/components/input/fpsControls.cs deleted file mode 100644 index 8331e409d..000000000 --- a/Templates/BaseGame/game/core/components/input/fpsControls.cs +++ /dev/null @@ -1,247 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("FPSControls", "Component", "FPS Controls", "Input", false, "First Person Shooter-type controls"); - -function FPSControls::onAdd(%this) -{ - // - %this.beginGroup("Keys"); - %this.addComponentField(forwardKey, "Key to bind to vertical thrust", keybind, "keyboard w"); - %this.addComponentField(backKey, "Key to bind to vertical thrust", keybind, "keyboard s"); - %this.addComponentField(leftKey, "Key to bind to horizontal thrust", keybind, "keyboard a"); - %this.addComponentField(rightKey, "Key to bind to horizontal thrust", keybind, "keyboard d"); - - %this.addComponentField(jump, "Key to bind to horizontal thrust", keybind, "keyboard space"); - %this.endGroup(); - - %this.beginGroup("Mouse"); - %this.addComponentField(pitchAxis, "Key to bind to horizontal thrust", keybind, "mouse yaxis"); - %this.addComponentField(yawAxis, "Key to bind to horizontal thrust", keybind, "mouse xaxis"); - %this.endGroup(); - - %this.addComponentField(moveSpeed, "Horizontal thrust force", float, 300.0); - %this.addComponentField(jumpStrength, "Vertical thrust force", float, 3.0); - // - - %control = %this.owner.getComponent( ControlObjectComponent ); - if(!%control) - return echo("SPECTATOR CONTROLS: No Control Object behavior!"); - - //%this.Physics = %this.owner.getComponent( PlayerPhysicsComponent ); - - //%this.Animation = %this.owner.getComponent( AnimationComponent ); - - //%this.Camera = %this.owner.getComponent( MountedCameraComponent ); - - //%this.Animation.playThread(0, "look"); - - %this.setupControls(%control.getClientID()); -} - -function FPSControls::onRemove(%this) -{ - Parent::onBehaviorRemove(%this); - - commandToClient(%control.clientOwnerID, 'removeInput', %this.forwardKey); - commandToClient(%control.clientOwnerID, 'removeInput', %this.backKey); - commandToClient(%control.clientOwnerID, 'removeInput', %this.leftKey); - commandToClient(%control.clientOwnerID, 'removeInput', %this.rightKey); - - commandToClient(%control.clientOwnerID, 'removeInput', %this.pitchAxis); - commandToClient(%control.clientOwnerID, 'removeInput', %this.yawAxis); -} - -function FPSControls::onBehaviorFieldUpdate(%this, %field) -{ - %controller = %this.owner.getBehavior( ControlObjectBehavior ); - commandToClient(%controller.clientOwnerID, 'updateInput', %this.getFieldValue(%field), %field); -} - -function FPSControls::onClientConnect(%this, %client) -{ - %this.setupControls(%client); -} - - -function FPSControls::setupControls(%this, %client) -{ - %control = %this.owner.getComponent( ControlObjectComponent ); - if(!%control.isControlClient(%client)) - { - echo("FPS CONTROLS: Client Did Not Match"); - return; - } - - %inputCommand = "FPSControls"; - - %test = %this.forwardKey; - - /*SetInput(%client, %this.forwardKey.x, %this.forwardKey.y, %inputCommand@"_forwardKey"); - SetInput(%client, %this.backKey.x, %this.backKey.y, %inputCommand@"_backKey"); - SetInput(%client, %this.leftKey.x, %this.leftKey.y, %inputCommand@"_leftKey"); - SetInput(%client, %this.rightKey.x, %this.rightKey.y, %inputCommand@"_rightKey"); - - SetInput(%client, %this.jump.x, %this.jump.y, %inputCommand@"_jump"); - - SetInput(%client, %this.pitchAxis.x, %this.pitchAxis.y, %inputCommand@"_pitchAxis"); - SetInput(%client, %this.yawAxis.x, %this.yawAxis.y, %inputCommand@"_yawAxis");*/ - - SetInput(%client, "keyboard", "w", %inputCommand@"_forwardKey"); - SetInput(%client, "keyboard", "s", %inputCommand@"_backKey"); - SetInput(%client, "keyboard", "a", %inputCommand@"_leftKey"); - SetInput(%client, "keyboard", "d", %inputCommand@"_rightKey"); - - SetInput(%client, "keyboard", "space", %inputCommand@"_jump"); - - SetInput(%client, "mouse", "yaxis", %inputCommand@"_pitchAxis"); - SetInput(%client, "mouse", "xaxis", %inputCommand@"_yawAxis"); - - SetInput(%client, "keyboard", "f", %inputCommand@"_flashlight"); - -} - -function FPSControls::onMoveTrigger(%this, %triggerID) -{ - //check if our jump trigger was pressed! - if(%triggerID == 2) - { - %this.owner.applyImpulse("0 0 0", "0 0 " @ %this.jumpStrength); - } -} - -function FPSControls::Update(%this) -{ - return; - - %moveVector = %this.owner.getMoveVector(); - %moveRotation = %this.owner.getMoveRotation(); - - %this.Physics.moveVector = "0 0 0"; - - if(%moveVector.x != 0) - { - %fv = VectorNormalize(%this.owner.getRightVector()); - - %forMove = VectorScale(%fv, (%moveVector.x));// * (%this.moveSpeed * 0.032))); - - //%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - - %this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove); - - //if(%forMove > 0) - // %this.Animation.playThread(1, "run"); - } - /*else - { - %fv = VectorNormalize(%this.owner.getRightVector()); - - %forMove = VectorScale(%fv, (%moveVector.x * (%this.moveSpeed * 0.032))); - - if(%forMove <= 0) - %this.Animation.stopThread(1); - - }*/ - - if(%moveVector.y != 0) - { - %fv = VectorNormalize(%this.owner.getForwardVector()); - - %forMove = VectorScale(%fv, (%moveVector.y));// * (%this.moveSpeed * 0.032))); - - //%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - - %this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove); - - //if(VectorLen(%this.Physics.velocity) < 2) - // %this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - } - - /*if(%moveVector.z) - { - %fv = VectorNormalize(%this.owner.getUpVector()); - - %forMove = VectorScale(%fv, (%moveVector.z * (%this.moveSpeed * 0.032))); - - %this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - }*/ - - if(%moveRotation.x != 0) - { - %look = mRadToDeg(%moveRotation.x) / 180; - - //%this.Animation.setThreadPos(0, %look); - - %this.owner.getComponent( MountedCameraComponent ).rotationOffset.x += mRadToDeg(%moveRotation.x); - - //%this.Camera.rotationOffset.x += mRadToDeg(%moveRotation.x); - } - // %this.owner.rotation.x += mRadToDeg(%moveRotation.x); - - if(%moveRotation.z != 0) - { - %zrot = mRadToDeg(%moveRotation.z); - %this.owner.getComponent( MountedCameraComponent ).rotationOffset.z += %zrot; - //%this.owner.rotation.z += %zrot; - } -} - -// -function FPSControls_forwardKey(%val) -{ - $mvForwardAction = %val; -} - -function FPSControls_backKey(%val) -{ - $mvBackwardAction = %val; -} - -function FPSControls_leftKey(%val) -{ - $mvLeftAction = %val; -} - -function FPSControls_rightKey(%val) -{ - $mvRightAction = %val; -} - -function FPSControls_yawAxis(%val) -{ - $mvYaw += getMouseAdjustAmount(%val); -} - -function FPSControls_pitchAxis(%val) -{ - $mvPitch += getMouseAdjustAmount(%val); -} - -function FPSControls_jump(%val) -{ - $mvTriggerCount2++; -} - -function FPSControls_flashLight(%val) -{ - $mvTriggerCount3++; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/input/inputManager.cs b/Templates/BaseGame/game/core/components/input/inputManager.cs deleted file mode 100644 index c8123d1e3..000000000 --- a/Templates/BaseGame/game/core/components/input/inputManager.cs +++ /dev/null @@ -1,82 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function SetInput(%client, %device, %key, %command, %bindMap, %behav) -{ - commandToClient(%client, 'SetInput', %device, %key, %command, %bindMap, %behav); -} - -function RemoveInput(%client, %device, %key, %command, %bindMap) -{ - commandToClient(%client, 'removeInput', %device, %key, %command, %bindMap); -} - -function clientCmdSetInput(%device, %key, %command, %bindMap, %behav) -{ - //if we're requesting a custom bind map, set that up - if(%bindMap $= "") - %bindMap = moveMap; - - if (!isObject(%bindMap)){ - new ActionMap(moveMap); - moveMap.push(); - } - - //get our local - //%localID = ServerConnection.resolveGhostID(%behav); - - //%tmpl = %localID.getTemplate(); - //%tmpl.insantiateNamespace(%tmpl.getName()); - - //first, check if we have an existing command - %oldBind = %bindMap.getBinding(%command); - if(%oldBind !$= "") - %bindMap.unbind(getField(%oldBind, 0), getField(%oldBind, 1)); - - //now, set the requested bind - %bindMap.bind(%device, %key, %command); -} - -function clientCmdRemoveSpecCtrlInput(%device, %key, %bindMap) -{ - //if we're requesting a custom bind map, set that up - if(%bindMap $= "") - %bindMap = moveMap; - - if (!isObject(%bindMap)) - return; - - %bindMap.unbind(%device, %key); -} - -function clientCmdSetupClientBehavior(%bhvrGstID) -{ - %localID = ServerConnection.resolveGhostID(%bhvrGstID); - %tmpl = %localID.getTemplate(); - %tmpl.insantiateNamespace(%tmpl.getName()); -} - -function getMouseAdjustAmount(%val) -{ - // based on a default camera FOV of 90' - return(%val * ($cameraFov / 90) * 0.01) * $pref::Input::LinkMouseSensitivity; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/meshComponent.asset.taml b/Templates/BaseGame/game/core/components/meshComponent.asset.taml deleted file mode 100644 index b41de171a..000000000 --- a/Templates/BaseGame/game/core/components/meshComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml deleted file mode 100644 index 417f409e0..000000000 --- a/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/soundComponent.asset.taml b/Templates/BaseGame/game/core/components/soundComponent.asset.taml deleted file mode 100644 index a29bcc9ff..000000000 --- a/Templates/BaseGame/game/core/components/soundComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml deleted file mode 100644 index ff1d53cd8..000000000 --- a/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/console/console.gui b/Templates/BaseGame/game/core/console/console.gui deleted file mode 100644 index c2f21eba9..000000000 --- a/Templates/BaseGame/game/core/console/console.gui +++ /dev/null @@ -1,191 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -%guiContent = new GuiControl(ConsoleDlg) { - position = "0 0"; - extent = "1024 768"; - minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "1"; - helpTag = "0"; - - new GuiConsoleEditCtrl(ConsoleEntry) { - useSiblingScroller = "1"; - historySize = "40"; - tabComplete = "0"; - sinkAllKeyEvents = "1"; - password = "0"; - passwordMask = "*"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 750"; - extent = "1024 18"; - minExtent = "8 8"; - horizSizing = "width"; - vertSizing = "top"; - profile = "ConsoleTextEditProfile"; - visible = "1"; - active = "1"; - altCommand = "ConsoleEntry::eval();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiContainer() { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1 728"; - extent = "1024 22"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "top"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiBitmapCtrl() { - bitmap = "data/ui/art/hudfill.png"; - color = "255 255 255 255"; - wrap = "0"; - position = "0 0"; - extent = "1024 22"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiCheckBoxCtrl(ConsoleDlgErrorFilterBtn) { - text = "Errors"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - position = "2 2"; - extent = "113 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiCheckBoxProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiCheckBoxCtrl(ConsoleDlgWarnFilterBtn) { - text = "Warnings"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - position = "119 2"; - extent = "113 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiCheckBoxProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiCheckBoxCtrl(ConsoleDlgNormalFilterBtn) { - text = "Normal Messages"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - position = "236 2"; - extent = "113 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiCheckBoxProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiScrollCtrl() { - willFirstRespond = "1"; - hScrollBar = "alwaysOn"; - vScrollBar = "alwaysOn"; - lockHorizScroll = "0"; - lockVertScroll = "0"; - constantThumbHeight = "0"; - childMargin = "0 0"; - mouseWheelScrollSpeed = "-1"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1024 730"; - minExtent = "8 8"; - horizSizing = "width"; - vertSizing = "height"; - profile = "ConsoleScrollProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "Scroll"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiConsole(ConsoleMessageLogView) { - position = "1 1"; - extent = "622 324"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiConsoleProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; -}; -//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/BaseGame/game/core/console/main.cs b/Templates/BaseGame/game/core/console/main.cs deleted file mode 100644 index 3d89234b8..000000000 --- a/Templates/BaseGame/game/core/console/main.cs +++ /dev/null @@ -1,140 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -exec("./profiles.cs"); -exec("./console.gui"); - -GlobalActionMap.bind("keyboard", "tilde", "toggleConsole"); - -function ConsoleEntry::eval() -{ - %text = trim(ConsoleEntry.getValue()); - if(%text $= "") - return; - - // If it's missing a trailing () and it's not a variable, - // append the parentheses. - if(strpos(%text, "(") == -1 && !isDefined(%text)) { - if(strpos(%text, "=") == -1 && strpos(%text, " ") == -1) { - if(strpos(%text, "{") == -1 && strpos(%text, "}") == -1) { - %text = %text @ "()"; - } - } - } - - // Append a semicolon if need be. - %pos = strlen(%text) - 1; - if(strpos(%text, ";", %pos) == -1 && strpos(%text, "}") == -1) { - %text = %text @ ";"; - } - - // Turn off warnings for assigning from void - // and evaluate the snippet. - if(!isDefined("$Con::warnVoidAssignment")) - %oldWarnVoidAssignment = true; - else - %oldWarnVoidAssignment = $Con::warnVoidAssignment; - $Con::warnVoidAssignment = false; - - echo("==>" @ %text); - if( !startsWith(%text, "function ") - && !startsWith(%text, "datablock ") - && !startsWith(%text, "foreach(") - && !startsWith(%text, "foreach$(") - && !startsWith(%text, "if(") - && !startsWith(%text, "while(") - && !startsWith(%text, "for(") - && !startsWith(%text, "switch(") - && !startsWith(%text, "switch$(")) - eval("%result = " @ %text); - else - eval(%text); - $Con::warnVoidAssignment = %oldWarnVoidAssignment; - - ConsoleEntry.setValue(""); - - // Echo result. - if(%result !$= "") - echo(%result); -} - -function ToggleConsole(%make) -{ - if (%make) { - if (ConsoleDlg.isAwake()) { - // Deactivate the console. - Canvas.popDialog(ConsoleDlg); - } else { - Canvas.pushDialog(ConsoleDlg, 99); - } - } -} - -function ConsoleDlg::hideWindow(%this) -{ - %this-->Scroll.setVisible(false); -} - -function ConsoleDlg::showWindow(%this) -{ - %this-->Scroll.setVisible(true); -} - -function ConsoleDlg::onWake(%this) -{ - ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); - ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); - ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); - - ConsoleMessageLogView.refresh(); -} - -function ConsoleDlg::setAlpha( %this, %alpha) -{ - if (%alpha $= "") - ConsoleScrollProfile.fillColor = $ConsoleDefaultFillColor; - else - ConsoleScrollProfile.fillColor = getWords($ConsoleDefaultFillColor, 0, 2) SPC %alpha * 255.0; -} - -function ConsoleDlgErrorFilterBtn::onClick(%this) -{ - ConsoleMessageLogView.toggleErrorFilter(); -} - -function ConsoleDlgWarnFilterBtn::onClick(%this) -{ - - ConsoleMessageLogView.toggleWarnFilter(); -} - -function ConsoleDlgNormalFilterBtn::onClick(%this) -{ - ConsoleMessageLogView.toggleNormalFilter(); -} - -function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount) -{ - ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors"); - ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings"); - ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages"); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/console/profiles.cs b/Templates/BaseGame/game/core/console/profiles.cs deleted file mode 100644 index b83dd4fa7..000000000 --- a/Templates/BaseGame/game/core/console/profiles.cs +++ /dev/null @@ -1,70 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -if(!isObject(GuiConsoleProfile)) -new GuiControlProfile(GuiConsoleProfile) -{ - fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console"; - fontSize = ($platform $= "macos") ? 13 : 12; - fontColor = "255 255 255"; - fontColorHL = "0 255 255"; - fontColorNA = "255 0 0"; - fontColors[6] = "100 100 100"; - fontColors[7] = "100 100 0"; - fontColors[8] = "0 0 100"; - fontColors[9] = "0 100 0"; - category = "Core"; -}; - -if(!isObject(GuiConsoleTextProfile)) -new GuiControlProfile(GuiConsoleTextProfile) -{ - fontColor = "0 0 0"; - autoSizeWidth = true; - autoSizeHeight = true; - textOffset = "2 2"; - opaque = true; - fillColor = "255 255 255"; - border = true; - borderThickness = 1; - borderColor = "0 0 0"; - category = "Core"; -}; - -if(!isObject(ConsoleScrollProfile)) -new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile) -{ - opaque = true; - fillColor = "0 0 0 175"; - border = 1; - //borderThickness = 0; - borderColor = "0 0 0"; - category = "Core"; -}; - -if(!isObject(ConsoleTextEditProfile)) -new GuiControlProfile(ConsoleTextEditProfile : GuiTextEditProfile) -{ - fillColor = "242 241 240 255"; - fillColorHL = "255 255 255"; - category = "Core"; -}; diff --git a/Templates/BaseGame/game/core/cursor.cs b/Templates/BaseGame/game/core/cursor.cs deleted file mode 100644 index f71bc023a..000000000 --- a/Templates/BaseGame/game/core/cursor.cs +++ /dev/null @@ -1,102 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//--------------------------------------------------------------------------------------------- -// Cursor toggle functions. -//--------------------------------------------------------------------------------------------- -$cursorControlled = true; -function showCursor() -{ - if ($cursorControlled) - lockMouse(false); - Canvas.cursorOn(); -} - -function hideCursor() -{ - if ($cursorControlled) - lockMouse(true); - Canvas.cursorOff(); -} - -//--------------------------------------------------------------------------------------------- -// In the CanvasCursor package we add some additional functionality to the built-in GuiCanvas -// class, of which the global Canvas object is an instance. In this case, the behavior we want -// is for the cursor to automatically display, except when the only guis visible want no -// cursor - usually the in game interface. -//--------------------------------------------------------------------------------------------- -package CanvasCursorPackage -{ - -//--------------------------------------------------------------------------------------------- -// checkCursor -// The checkCursor method iterates through all the root controls on the canvas checking each -// ones noCursor property. If the noCursor property exists as anything other than false or an -// empty string on every control, the cursor will be hidden. -//--------------------------------------------------------------------------------------------- -function GuiCanvas::checkCursor(%this) -{ - %count = %this.getCount(); - for(%i = 0; %i < %count; %i++) - { - %control = %this.getObject(%i); - if ((%control.noCursor $= "") || !%control.noCursor) - { - showCursor(); - return; - } - } - // If we get here, every control requested a hidden cursor, so we oblige. - hideCursor(); -} - -//--------------------------------------------------------------------------------------------- -// The following functions override the GuiCanvas defaults that involve changing the content -// of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one. -//--------------------------------------------------------------------------------------------- -function GuiCanvas::setContent(%this, %ctrl) -{ - Parent::setContent(%this, %ctrl); - %this.checkCursor(); -} - -function GuiCanvas::pushDialog(%this, %ctrl, %layer, %center) -{ - Parent::pushDialog(%this, %ctrl, %layer, %center); - %this.checkCursor(); -} - -function GuiCanvas::popDialog(%this, %ctrl) -{ - Parent::popDialog(%this, %ctrl); - %this.checkCursor(); -} - -function GuiCanvas::popLayer(%this, %layer) -{ - Parent::popLayer(%this, %layer); - %this.checkCursor(); -} - -}; - -activatePackage(CanvasCursorPackage); diff --git a/Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft deleted file mode 100644 index 2b564950050cfca995e66f048e0523428ff493b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 412 zcmZQ(U|?W%EXqvG;R3Qi07P>@F%ytx24VyN@mQf;5Dk%qsR4%?)Qy83;)lEIri7m zFZoExihWaFY>GaAyHfb_#$7>4rhD3-7VX{JcRHkY<;8EhWjEc^(!MS|x7jKnT~tu; z`y-fhfi55e9MJ#4lvSq~c?$DU2jYrb$q5Y1ZVG9@ Ja2IA^0RUczP(}a% diff --git a/Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft deleted file mode 100644 index 67a177016766c6f06b5b601c3336b9fea2ac75ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 62 jcmZQ(U|?W%EXqvG;Q_Kh07P>_F*8U23jU*ldXO*xH#ZTF diff --git a/Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft deleted file mode 100644 index 159010c6850f3424dbc7456533d0e2ae6f82e9bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5160 zcmd6pc{o(vAHeU7u@_Q^vc{WI)@VUSrcmBQq%2v6&B<*H&b$_|0+eJl&@>fB()r=brDqpYvVMx%Uhk1VQY&Uat0Td<+RRF!Cau zjWOCV`p?GA5V;tAfziMSIs}2Ips_PL$D#y}Oc{Cf%K)sy{=m4j?n;0djg!%t*1!n+ z6$6OTfG+$5?N@S$2)1@{nSym*D6rF9P=6kX?^F`KibmP=6JACAEm zp&&*O33H9$nC%g|be)f}q$GrbjL;okeK(XYx>j&hClLyE9h$}tNh5qKiQN^GrIwP2#N9fP`plfvnq0Cia+%Cop zdr3m*(ovFz=pz82@2WJFiP``)+`}LReh=Bx` z8yXNy;injQ@A!&NGtMNgm4*aeGoR}t@0Fru{uZnGGG=X==MsdM65zsNRj{yd<1r7; zLlxZY$-`$JR;i0?qpVoxLtUXDKv}`nfeY#q#9fuLWc(QS>nzR2OKx17eV{qruUI@r zEB-jkg>66eW7fpRhP`6_EUtFY?(cxjw2Rhq!S)WRac+B`w+PosXp0ik@-z44XI;;R z2oO%7ML5GSv8Qg|g-FUJjc<3PLPH7aL?;XH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{d_sY*K9(^r3Qmet&!<9@`r<(hDcp&rwfB z@SY4R^i=dz<`9)Txm;qxQQ~FFEn0HkNE*=$cRN$NBN~d2X_i<`YRGJmya36ITLw3F z)nIRrP~-6ZDiF`85}WU`2?hIshK*(trIan?+`D&6f_$4M@A@01ldsNqVj9!MbcuwV zNkKCIOoYOn0{3jiZ(UgmCH%=!u9qg$a+^zDU?kb^{WpJj;9wu6D)_EOB951)XBGc- zYsDGm?VPW??+z(dPu!c`9q&PvonMOF$Pa%E-CSN8i$Mw6Yyy?MXKmAe^F zPgn2pZK^M^P7>Rlk^;^jaR}Ya zw;{J-JLjecb!&%8a_coazl3*2t5pgRqc7Tr+uw?JB(G>(cE3`n$?;SFMcy-YU#i5X zzjWvgQ{QLhHSJq-`nhRx)PB?9xKz5BrAu=7u{jr6T{@qzYtN<*zd4MRREXaH0IB1e A=Kufz diff --git a/Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft deleted file mode 100644 index 058fbb305a81a9670c8a346f4384647711e5f8ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13112 zcmc(kc|29y+rYPDDnm$y6i$dxC|xPxC`yx%3{f? zsTC%5z@$V>dLNTM#-z_M>2pk)fJxIa>3^8C1e2Cy($AQ*36pkV(g93L!lWqtqoVma zGKY?Xa|_Naxdta3g64nz3qhaqgf(1~rWwI`~VIYVf7C^x$WmGu04?%cX00jhiA?qUR75t6D-JkvuDvVMP zGctluWWC}j1uFmoEQ1JvK+qmoD5C<=fEkD#X_S)Vg}XlqLS;}2=2Hqn_n{Q@DD#X^ zIh4}=(5|DabQf_t);-?=geiLC_DBg1MA2gSU>V5&Mr99=;9&ul$oim0 zbiu8HhXqg&Gg%j*?(hg6mbG>7QP4kiy(#FQejlUs_go>TERaH%Z24Er!D~=33yC=b zrR0^6Ys7LSNn7ag+kfloYYN8>L_cKpzy~0a-72b0eT5lzx%60!qPL=#N`X}n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u9P1v#zA*$faSf;)SZQ6;gch(lWimA=f+q2mLv4SO5S3 diff --git a/Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft deleted file mode 100644 index 968441ce3b27703632299ab9837977bb7ee35234..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1046 zcmZQ(U|?W%EXqvGQ30|*07T0|F*}fE0b&H;1Tw{em>Eh7fu%sAARqw5AX!Ez4Uv@u z@<0H)tR_Sft1QTz&Hz7mUM?vvAd}bA!zBn}IwJ!INMEJo_gz58@OZj7hE&XXdqdGj zIaA`;NA=lVT$5HigeVAfbaAmTH99B=XbW;2iEVOF2m?X^QFT9s2^>I)h(e}9ri~y4 zT0533TEt|yXwjmR|6Q!N+$>nW&gAx=`mA~R`+V;GOuO|xd$P(&GnJKc_r5Nu-W@O5 z8`l4xo6UdiRF#uPmp28xiuI6s`{~`SUX`0~dLBP8@!Td}&KP#fA?xnRw_mePhSg6x zKUqfq4bz)13`Kk~xglE8*AHY)+jSw|R6El0&4KkNS!-sNuiPA9EzcD2_VB}u7b3eX z8~^>%xNiMr)z0?0Kc`w6r?c{$Z#e(KMsD?%#Mg5BrcLHcuwNfAJ9y$|7MonQAI#@Y z9W?&2w_&T1{^6%ad(JF9bo1Ag{q?siJSL@mis-Xbd%a&J-~7)kli4SO-@bm_aBur2 zU%i&QDx4pTz8<;$AeF&8HLmTP;h(Qod5rzp?_*vrXA=pQ|0wlke!}`Q?FWvQ2){9X z7X19opBuLu#r9lrU-^;i4zqc*_ezsKs|)MSEx!<1na=pC_Jzz^wX>V;4!lm04tRg) zqRpu}bIZjPeor?4$JKWEa{q&W&DwJ|UMxRwd-^>gk&|(Oc`e!(X3pEkbhQ1tMX-Z( z*y$ZsuYP{Lc6q|Nr&UrPK0N-zzpmg|gMH%mp4|oJwZ9njmKU?K$%o$RsjafE^1F8W z@z*DnRoCJ^)moWP{&vRucff&nSF-(i7UduV4x37tJ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zxGRlv3kX7`bkOCe*vAy BNb3Lq diff --git a/Templates/BaseGame/game/core/gfxData/clouds.cs b/Templates/BaseGame/game/core/gfxData/clouds.cs deleted file mode 100644 index 00d56d6d3..000000000 --- a/Templates/BaseGame/game/core/gfxData/clouds.cs +++ /dev/null @@ -1,55 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------ -// CloudLayer -//------------------------------------------------------------------------------ - -singleton ShaderData( CloudLayerShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/cloudLayerV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/cloudLayerP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerP.glsl"; - - samplerNames[0] = "$normalHeightMap"; - - pixVersion = 2.0; -}; - -//------------------------------------------------------------------------------ -// BasicClouds -//------------------------------------------------------------------------------ - -singleton ShaderData( BasicCloudsShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/basicCloudsV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/basicCloudsP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsP.glsl"; - - samplerNames[0] = "$diffuseMap"; - - pixVersion = 2.0; -}; diff --git a/Templates/BaseGame/game/core/gfxData/commonMaterialData.cs b/Templates/BaseGame/game/core/gfxData/commonMaterialData.cs deleted file mode 100644 index c5d8ef5bc..000000000 --- a/Templates/BaseGame/game/core/gfxData/commonMaterialData.cs +++ /dev/null @@ -1,79 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Anim flag settings - must match material.h -// These cannot be enumed through script becuase it cannot -// handle the "|" operation for combining them together -// ie. Scroll | Wave does not work. -//----------------------------------------------------------------------------- -$scroll = 1; -$rotate = 2; -$wave = 4; -$scale = 8; -$sequence = 16; - - -// Common stateblock definitions -new GFXSamplerStateData(SamplerClampLinear) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXAddressClamp; - addressModeV = GFXAddressClamp; - addressModeW = GFXAddressClamp; - magFilter = GFXTextureFilterLinear; - minFilter = GFXTextureFilterLinear; - mipFilter = GFXTextureFilterLinear; -}; - -new GFXSamplerStateData(SamplerClampPoint) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXAddressClamp; - addressModeV = GFXAddressClamp; - addressModeW = GFXAddressClamp; - magFilter = GFXTextureFilterPoint; - minFilter = GFXTextureFilterPoint; - mipFilter = GFXTextureFilterPoint; -}; - -new GFXSamplerStateData(SamplerWrapLinear) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXTextureAddressWrap; - addressModeV = GFXTextureAddressWrap; - addressModeW = GFXTextureAddressWrap; - magFilter = GFXTextureFilterLinear; - minFilter = GFXTextureFilterLinear; - mipFilter = GFXTextureFilterLinear; -}; - -new GFXSamplerStateData(SamplerWrapPoint) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXTextureAddressWrap; - addressModeV = GFXTextureAddressWrap; - addressModeW = GFXTextureAddressWrap; - magFilter = GFXTextureFilterPoint; - minFilter = GFXTextureFilterPoint; - mipFilter = GFXTextureFilterPoint; -}; diff --git a/Templates/BaseGame/game/core/gfxData/scatterSky.cs b/Templates/BaseGame/game/core/gfxData/scatterSky.cs deleted file mode 100644 index 5add01d8b..000000000 --- a/Templates/BaseGame/game/core/gfxData/scatterSky.cs +++ /dev/null @@ -1,48 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -new GFXStateBlockData( ScatterSkySBData ) -{ - cullMode = "GFXCullNone"; - - zDefined = true; - zEnable = true; - zWriteEnable = false; - - samplersDefined = true; - samplerStates[0] = SamplerClampLinear; - samplerStates[1] = SamplerClampLinear; - vertexColorEnable = true; -}; - -singleton ShaderData( ScatterSkyShaderData ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/scatterSkyV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/scatterSkyP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyP.glsl"; - - samplerNames[0] = "$nightSky"; - - pixVersion = 2.0; -}; diff --git a/Templates/BaseGame/game/core/gfxData/shaders.cs b/Templates/BaseGame/game/core/gfxData/shaders.cs deleted file mode 100644 index da3b7c864..000000000 --- a/Templates/BaseGame/game/core/gfxData/shaders.cs +++ /dev/null @@ -1,152 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// This file contains shader data necessary for various engine utility functions -//----------------------------------------------------------------------------- - - -singleton ShaderData( ParticlesShaderData ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/particlesV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/particlesP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particlesV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particlesP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$deferredTex"; - samplerNames[2] = "$paraboloidLightMap"; - - pixVersion = 2.0; -}; - -singleton ShaderData( OffscreenParticleCompositeShaderData ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/particleCompositeV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/particleCompositeP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeP.glsl"; - - samplerNames[0] = "$colorSource"; - samplerNames[1] = "$edgeSource"; - - pixVersion = 2.0; -}; - -//----------------------------------------------------------------------------- -// Planar Reflection -//----------------------------------------------------------------------------- -new ShaderData( ReflectBump ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$refractMap"; - samplerNames[2] = "$bumpMap"; - - pixVersion = 2.0; -}; - -new ShaderData( Reflect ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$refractMap"; - - pixVersion = 1.4; -}; - -//----------------------------------------------------------------------------- -// fxFoliageReplicator -//----------------------------------------------------------------------------- -new ShaderData( fxFoliageReplicatorShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$alphaMap"; - - pixVersion = 1.4; -}; - -singleton ShaderData( VolumetricFogDeferredShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreP.glsl"; - - pixVersion = 3.0; -}; -singleton ShaderData( VolumetricFogShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogP.glsl"; - - samplerNames[0] = "$deferredTex"; - samplerNames[1] = "$depthBuffer"; - samplerNames[2] = "$frontBuffer"; - samplerNames[3] = "$density"; - - pixVersion = 3.0; -}; -singleton ShaderData( VolumetricFogReflectionShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogRefl.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogRefl.glsl"; - - pixVersion = 3.0; -}; -singleton ShaderData( CubemapSaveShader ) -{ - DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl"; - DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl"; - - OGLVertexShaderFile = "shaders/common/gl/cubemapSaveV.glsl"; - OGLPixelShaderFile = "shaders/common/gl/cubemapSaveP.glsl"; - - samplerNames[0] = "$cubemapTex"; - - pixVersion = 3.0; -}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/gfxData/terrainBlock.cs b/Templates/BaseGame/game/core/gfxData/terrainBlock.cs deleted file mode 100644 index 69802b1da..000000000 --- a/Templates/BaseGame/game/core/gfxData/terrainBlock.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -/// Used when generating the blended base texture. -singleton ShaderData( TerrainBlendShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/terrain/blendV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/terrain/blendP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendP.glsl"; - - samplerNames[0] = "layerTex"; - samplerNames[1] = "textureMap"; - - pixVersion = 2.0; -}; diff --git a/Templates/BaseGame/game/core/gfxData/water.cs b/Templates/BaseGame/game/core/gfxData/water.cs deleted file mode 100644 index ec5e4be71..000000000 --- a/Templates/BaseGame/game/core/gfxData/water.cs +++ /dev/null @@ -1,208 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - - - -//----------------------------------------------------------------------------- -// Water -//----------------------------------------------------------------------------- - -singleton ShaderData( WaterShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterP.glsl"; - - samplerNames[0] = "$bumpMap"; // noise - samplerNames[1] = "$deferredTex"; // #deferred - samplerNames[2] = "$reflectMap"; // $reflectbuff - samplerNames[3] = "$refractBuff"; // $backbuff - samplerNames[4] = "$skyMap"; // $cubemap - samplerNames[5] = "$foamMap"; // foam - samplerNames[6] = "$depthGradMap"; // depthMap ( color gradient ) - - pixVersion = 3.0; -}; - -new GFXSamplerStateData(WaterSampler) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXAddressWrap; - addressModeV = GFXAddressWrap; - addressModeW = GFXAddressWrap; - magFilter = GFXTextureFilterLinear; - minFilter = GFXTextureFilterAnisotropic; - mipFilter = GFXTextureFilterLinear; - maxAnisotropy = 4; -}; - -singleton GFXStateBlockData( WaterStateBlock ) -{ - samplersDefined = true; - samplerStates[0] = WaterSampler; // noise - samplerStates[1] = SamplerClampPoint; // #deferred - samplerStates[2] = SamplerClampLinear; // $reflectbuff - samplerStates[3] = SamplerClampPoint; // $backbuff - samplerStates[4] = SamplerWrapLinear; // $cubemap - samplerStates[5] = SamplerWrapLinear; // foam - samplerStates[6] = SamplerClampLinear; // depthMap ( color gradient ) - cullDefined = true; - cullMode = "GFXCullCCW"; -}; - -singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock ) -{ - cullMode = "GFXCullCW"; -}; - -singleton CustomMaterial( WaterMat ) -{ - sampler["deferredTex"] = "#deferred"; - sampler["reflectMap"] = "$reflectbuff"; - sampler["refractBuff"] = "$backbuff"; - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = ""; - //sampler["skyMap"] = ""; - //sampler["foamMap"] = ""; - //sampler["depthGradMap"] = ""; - - shader = WaterShader; - stateBlock = WaterStateBlock; - version = 3.0; - - useAnisotropic[0] = true; -}; - -//----------------------------------------------------------------------------- -// Underwater -//----------------------------------------------------------------------------- - -singleton ShaderData( UnderWaterShader : WaterShader ) -{ - defines = "UNDERWATER"; -}; - -singleton CustomMaterial( UnderwaterMat ) -{ - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = "core/art/water/noise02"; - //sampler["foamMap"] = "core/art/water/foam"; - - sampler["deferredTex"] = "#deferred"; - sampler["refractBuff"] = "$backbuff"; - - shader = UnderWaterShader; - stateBlock = UnderWaterStateBlock; - specular = "0.75 0.75 0.75 1.0"; - specularPower = 48.0; - version = 3.0; -}; - -//----------------------------------------------------------------------------- -// Basic Water -//----------------------------------------------------------------------------- - -singleton ShaderData( WaterBasicShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterBasicV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterBasicP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicP.glsl"; - - samplerNames[0] = "$bumpMap"; - samplerNames[2] = "$reflectMap"; - samplerNames[3] = "$refractBuff"; - samplerNames[4] = "$skyMap"; - samplerNames[5] = "$depthGradMap"; - - pixVersion = 2.0; -}; - -singleton GFXStateBlockData( WaterBasicStateBlock ) -{ - samplersDefined = true; - samplerStates[0] = WaterSampler; // noise - samplerStates[2] = SamplerClampLinear; // $reflectbuff - samplerStates[3] = SamplerClampPoint; // $backbuff - samplerStates[4] = SamplerWrapLinear; // $cubemap - cullDefined = true; - cullMode = "GFXCullCCW"; -}; - -singleton GFXStateBlockData( UnderWaterBasicStateBlock : WaterBasicStateBlock ) -{ - cullMode = "GFXCullCW"; -}; - -singleton CustomMaterial( WaterBasicMat ) -{ - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = "core/art/water/noise02"; - //sampler["skyMap"] = "$cubemap"; - - //sampler["deferredTex"] = "#deferred"; - sampler["reflectMap"] = "$reflectbuff"; - sampler["refractBuff"] = "$backbuff"; - - cubemap = NewLevelSkyCubemap; - shader = WaterBasicShader; - stateBlock = WaterBasicStateBlock; - version = 2.0; -}; - -//----------------------------------------------------------------------------- -// Basic UnderWater -//----------------------------------------------------------------------------- - -singleton ShaderData( UnderWaterBasicShader : WaterBasicShader) -{ - defines = "UNDERWATER"; -}; - -singleton CustomMaterial( UnderwaterBasicMat ) -{ - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = "core/art/water/noise02"; - //samplers["skyMap"] = "$cubemap"; - - //sampler["deferredTex"] = "#deferred"; - sampler["refractBuff"] = "$backbuff"; - - shader = UnderWaterBasicShader; - stateBlock = UnderWaterBasicStateBlock; - version = 2.0; -}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs deleted file mode 100644 index 10c6bdf5b..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// ATI Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 64.44) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs deleted file mode 100644 index 328788dac..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// nVidia Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 1.2) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs deleted file mode 100644 index 5681b2f6d..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs +++ /dev/null @@ -1,39 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// nVidia Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 53.82) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} - -// Silly card has trouble with this! -GFXCardProfiler::setCapability("autoMipmapLevel", false); diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs deleted file mode 100644 index b33b8d5d3..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// nVidia Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 56.72) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.cs deleted file mode 100644 index e1e299341..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.cs +++ /dev/null @@ -1,26 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// Direct3D 9 Renderer Profile Script -// -// This script is responsible for setting global -// capability strings based on the D3D9 renderer type. \ No newline at end of file diff --git a/Templates/BaseGame/game/core/globals.cs b/Templates/BaseGame/game/core/globals.cs deleted file mode 100644 index d4e4f1ca3..000000000 --- a/Templates/BaseGame/game/core/globals.cs +++ /dev/null @@ -1,102 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// DInput keyboard, mouse, and joystick prefs -// ---------------------------------------------------------------------------- - -$pref::Input::MouseEnabled = 1; -$pref::Input::LinkMouseSensitivity = 1; -$pref::Input::KeyboardEnabled = 1; -$pref::Input::KeyboardTurnSpeed = 0.1; -$pref::Input::JoystickEnabled = 0; - -// ---------------------------------------------------------------------------- -// Video Preferences -// ---------------------------------------------------------------------------- - -// Set directory paths for various data or default images. -$pref::Video::ProfilePath = "core/gfxprofile"; -$pref::Video::missingTexturePath = "core/images/missingTexture.png"; -$pref::Video::unavailableTexturePath = "core/images/unavailable.png"; -$pref::Video::warningTexturePath = "core/images/warnMat.dds"; - -$pref::Video::disableVerticalSync = 1; -$pref::Video::mode = "800 600 false 32 60 4"; -$pref::Video::defaultFenceCount = 0; - -// This disables the hardware FSAA/MSAA so that we depend completely on the FXAA -// post effect which works on all cards and in deferred mode. Note that the new -// Intel Hybrid graphics on laptops will fail to initialize when hardware AA is -// enabled... so you've been warned. -$pref::Video::disableHardwareAA = true; - -$pref::Video::disableNormalmapping = false; -$pref::Video::disablePixSpecular = false; -$pref::Video::disableCubemapping = false; -$pref::Video::disableParallaxMapping = false; - -// The number of mipmap levels to drop on loaded textures to reduce video memory -// usage. It will skip any textures that have been defined as not allowing down -// scaling. -$pref::Video::textureReductionLevel = 0; - -$pref::Video::defaultAnisotropy = 1; -//$pref::Video::Gamma = 1.0; - -/// AutoDetect graphics quality levels the next startup. -$pref::Video::autoDetect = 1; - -// ---------------------------------------------------------------------------- -// Shader stuff -// ---------------------------------------------------------------------------- - -// This is the path used by ShaderGen to cache procedural shaders. If left -// blank ShaderGen will only cache shaders to memory and not to disk. -$shaderGen::cachePath = "data/shaderCache"; - -// Uncomment to disable ShaderGen, useful when debugging -//$ShaderGen::GenNewShaders = false; - -// Uncomment to dump disassembly for any shader that is compiled to disk. These -// will appear as shadername_dis.txt in the same path as the shader file. -//$gfx::disassembleAllShaders = true; - -// ---------------------------------------------------------------------------- -// Lighting and shadowing -// ---------------------------------------------------------------------------- - -// Uncomment to enable AdvancedLighting on the Mac (T3D 2009 Beta 3) -//$pref::machax::enableAdvancedLighting = true; - -$sceneLighting::cacheSize = 20000; -$sceneLighting::purgeMethod = "lastCreated"; -$sceneLighting::cacheLighting = 1; - -$pref::Shadows::textureScalar = 1.0; -$pref::Shadows::disable = false; - -// Sets the shadow filtering mode. -// None - Disables filtering. -// SoftShadow - Does a simple soft shadow -// SoftShadowHighQuality -$pref::Shadows::filterMode = "SoftShadow"; diff --git a/Templates/BaseGame/game/core/helperFunctions.cs b/Templates/BaseGame/game/core/helperFunctions.cs deleted file mode 100644 index 1b98f1ea5..000000000 --- a/Templates/BaseGame/game/core/helperFunctions.cs +++ /dev/null @@ -1,1158 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - - -//------------------------------------------------------------------------------ -// Check if a script file exists, compiled or not. -function isScriptFile(%path) -{ - if( isFile(%path @ ".dso") || isFile(%path) ) - return true; - - return false; -} - -function loadMaterials() -{ - // Load any materials files for which we only have DSOs. - - for( %file = findFirstFile( "*/materials.cs.dso" ); - %file !$= ""; - %file = findNextFile( "*/materials.cs.dso" )) - { - // Only execute, if we don't have the source file. - %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); - if( !isFile( %csFileName ) ) - exec( %csFileName ); - } - - // Load all source material files. - - for( %file = findFirstFile( "*/materials.cs" ); - %file !$= ""; - %file = findNextFile( "*/materials.cs" )) - { - exec( %file ); - } - - // Load all materials created by the material editor if - // the folder exists - if( IsDirectory( "materialEditor" ) ) - { - for( %file = findFirstFile( "materialEditor/*.cs.dso" ); - %file !$= ""; - %file = findNextFile( "materialEditor/*.cs.dso" )) - { - // Only execute, if we don't have the source file. - %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); - if( !isFile( %csFileName ) ) - exec( %csFileName ); - } - - for( %file = findFirstFile( "materialEditor/*.cs" ); - %file !$= ""; - %file = findNextFile( "materialEditor/*.cs" )) - { - exec( %file ); - } - } -} - -function reloadMaterials() -{ - reloadTextures(); - loadMaterials(); - reInitMaterials(); -} - -function loadDatablockFiles( %datablockFiles, %recurse ) -{ - if ( %recurse ) - { - recursiveLoadDatablockFiles( %datablockFiles, 9999 ); - return; - } - - %count = %datablockFiles.count(); - for ( %i=0; %i < %count; %i++ ) - { - %file = %datablockFiles.getKey( %i ); - if ( !isFile(%file @ ".dso") && !isFile(%file) ) - continue; - - exec( %file ); - } - - // Destroy the incoming list. - //%datablockFiles.delete(); -} - -function recursiveLoadDatablockFiles( %datablockFiles, %previousErrors ) -{ - %reloadDatablockFiles = new ArrayObject(); - - // Keep track of the number of datablocks that - // failed during this pass. - %failedDatablocks = 0; - - // Try re-executing the list of datablock files. - %count = %datablockFiles.count(); - for ( %i=0; %i < %count; %i++ ) - { - %file = %datablockFiles.getKey( %i ); - if ( !isFile(%file @ ".dso") && !isFile(%file) ) - continue; - - // Start counting copy constructor creation errors. - $Con::objectCopyFailures = 0; - - exec( %file ); - - // If errors occured then store this file for re-exec later. - if ( $Con::objectCopyFailures > 0 ) - { - %reloadDatablockFiles.add( %file ); - %failedDatablocks = %failedDatablocks + $Con::objectCopyFailures; - } - } - - // Clear the object copy failure counter so that - // we get console error messages again. - $Con::objectCopyFailures = -1; - - // Delete the old incoming list... we're done with it. - //%datablockFiles.delete(); - - // If we still have datablocks to retry. - %newCount = %reloadDatablockFiles.count(); - if ( %newCount > 0 ) - { - // If the datablock failures have not been reduced - // from the last pass then we must have a real syntax - // error and not just a bad dependancy. - if ( %previousErrors > %failedDatablocks ) - recursiveLoadDatablockFiles( %reloadDatablockFiles, %failedDatablocks ); - - else - { - // Since we must have real syntax errors do one - // last normal exec to output error messages. - loadDatablockFiles( %reloadDatablockFiles, false ); - } - - return; - } - - // Cleanup the empty reload list. - %reloadDatablockFiles.delete(); -} - -function getUserPath() -{ - %temp = getUserHomeDirectory(); - echo(%temp); - if(!isDirectory(%temp)) - { - %temp = getUserDataDirectory(); - echo(%temp); - if(!isDirectory(%temp)) - { - %userPath = "data"; - } - else - { - //put it in appdata/roaming - %userPath = %temp @ "/" @ $appName; - } - } - else - { - //put it in user/documents - %userPath = %temp @ "/" @ $appName; - } - return %userPath; -} - -function getPrefpath() -{ - $prefPath = getUserPath() @ "/preferences"; - return $prefPath; -} - -function updateTSShapeLoadProgress(%progress, %msg) -{ - // Check if the loading GUI is visible and use that instead of the - // separate import progress GUI if possible - /* if ( isObject(LoadingGui) && LoadingGui.isAwake() ) - { - // Save/Restore load progress at the start/end of the import process - if ( %progress == 0 ) - { - ColladaImportProgress.savedProgress = LoadingProgress.getValue(); - ColladaImportProgress.savedText = LoadingProgressTxt.getValue(); - - ColladaImportProgress.msgPrefix = "Importing " @ %msg; - %msg = "Reading file into memory..."; - } - else if ( %progress == 1.0 ) - { - LoadingProgress.setValue( ColladaImportProgress.savedProgress ); - LoadingProgressTxt.setValue( ColladaImportProgress.savedText ); - } - - %msg = ColladaImportProgress.msgPrefix @ ": " @ %msg; - - %progressCtrl = LoadingProgress; - %textCtrl = LoadingProgressTxt; - } - else - { - //it's probably the editors using it - if(isFunction("updateToolTSShapeLoadProgress")) - { - updateToolTSShapeLoadProgress(%progress, %msg); - } - } - - // Update progress indicators - if (%progress == 0) - { - %progressCtrl.setValue(0.001); - %textCtrl.setText(%msg); - } - else if (%progress != 1.0) - { - %progressCtrl.setValue(%progress); - %textCtrl.setText(%msg); - } - - Canvas.repaint(33);*/ -} - -/// A helper function which will return the ghosted client object -/// from a server object when connected to a local server. -function serverToClientObject( %serverObject ) -{ - assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); - assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); - - %ghostId = LocalClientConnection.getGhostId( %serverObject ); - if ( %ghostId == -1 ) - return 0; - - return ServerConnection.resolveGhostID( %ghostId ); -} - -//---------------------------------------------------------------------------- -// Debug commands -//---------------------------------------------------------------------------- - -function netSimulateLag( %msDelay, %packetLossPercent ) -{ - if ( %packetLossPercent $= "" ) - %packetLossPercent = 0; - - commandToServer( 'NetSimulateLag', %msDelay, %packetLossPercent ); -} - -//Various client functions - -function validateDatablockName(%name) -{ - // remove whitespaces at beginning and end - %name = trim( %name ); - - // remove numbers at the beginning - %numbers = "0123456789"; - while( strlen(%name) > 0 ) - { - // the first character - %firstChar = getSubStr( %name, 0, 1 ); - // if the character is a number remove it - if( strpos( %numbers, %firstChar ) != -1 ) - { - %name = getSubStr( %name, 1, strlen(%name) -1 ); - %name = ltrim( %name ); - } - else - break; - } - - // replace whitespaces with underscores - %name = strreplace( %name, " ", "_" ); - - // remove any other invalid characters - %invalidCharacters = "-+*/%$&§=()[].?\"#,;!~<>|°^{}"; - %name = stripChars( %name, %invalidCharacters ); - - if( %name $= "" ) - %name = "Unnamed"; - - return %name; -} - -//-------------------------------------------------------------------------- -// Finds location of %word in %text, starting at %start. Works just like strPos -//-------------------------------------------------------------------------- - -function wordPos(%text, %word, %start) -{ - if (%start $= "") %start = 0; - - if (strpos(%text, %word, 0) == -1) return -1; - %count = getWordCount(%text); - if (%start >= %count) return -1; - for (%i = %start; %i < %count; %i++) - { - if (getWord( %text, %i) $= %word) return %i; - } - return -1; -} - -//-------------------------------------------------------------------------- -// Finds location of %field in %text, starting at %start. Works just like strPos -//-------------------------------------------------------------------------- - -function fieldPos(%text, %field, %start) -{ - if (%start $= "") %start = 0; - - if (strpos(%text, %field, 0) == -1) return -1; - %count = getFieldCount(%text); - if (%start >= %count) return -1; - for (%i = %start; %i < %count; %i++) - { - if (getField( %text, %i) $= %field) return %i; - } - return -1; -} - -//-------------------------------------------------------------------------- -// returns the text in a file with "\n" at the end of each line -//-------------------------------------------------------------------------- - -function loadFileText( %file) -{ - %fo = new FileObject(); - %fo.openForRead(%file); - %text = ""; - while(!%fo.isEOF()) - { - %text = %text @ %fo.readLine(); - if (!%fo.isEOF()) %text = %text @ "\n"; - } - - %fo.delete(); - return %text; -} - -function setValueSafe(%dest, %val) -{ - %cmd = %dest.command; - %alt = %dest.altCommand; - %dest.command = ""; - %dest.altCommand = ""; - - %dest.setValue(%val); - - %dest.command = %cmd; - %dest.altCommand = %alt; -} - -function shareValueSafe(%source, %dest) -{ - setValueSafe(%dest, %source.getValue()); -} - -function shareValueSafeDelay(%source, %dest, %delayMs) -{ - schedule(%delayMs, 0, shareValueSafe, %source, %dest); -} - - -//------------------------------------------------------------------------------ -// An Aggregate Control is a plain GuiControl that contains other controls, -// which all share a single job or represent a single value. -//------------------------------------------------------------------------------ - -// AggregateControl.setValue( ) propagates the value to any control that has an -// internal name. -function AggregateControl::setValue(%this, %val, %child) -{ - for(%i = 0; %i < %this.getCount(); %i++) - { - %obj = %this.getObject(%i); - if( %obj == %child ) - continue; - - if(%obj.internalName !$= "") - setValueSafe(%obj, %val); - } -} - -// AggregateControl.getValue() uses the value of the first control that has an -// internal name, if it has not cached a value via .setValue -function AggregateControl::getValue(%this) -{ - for(%i = 0; %i < %this.getCount(); %i++) - { - %obj = %this.getObject(%i); - if(%obj.internalName !$= "") - { - //error("obj = " @ %obj.getId() @ ", " @ %obj.getName() @ ", " @ %obj.internalName ); - //error(" value = " @ %obj.getValue()); - return %obj.getValue(); - } - } -} - -// AggregateControl.updateFromChild( ) is called by child controls to propagate -// a new value, and to trigger the onAction() callback. -function AggregateControl::updateFromChild(%this, %child) -{ - %val = %child.getValue(); - if(%val == mCeil(%val)){ - %val = mCeil(%val); - }else{ - if ( %val <= -100){ - %val = mCeil(%val); - }else if ( %val <= -10){ - %val = mFloatLength(%val, 1); - }else if ( %val < 0){ - %val = mFloatLength(%val, 2); - }else if ( %val >= 1000){ - %val = mCeil(%val); - }else if ( %val >= 100){ - %val = mFloatLength(%val, 1); - }else if ( %val >= 10){ - %val = mFloatLength(%val, 2); - }else if ( %val > 0){ - %val = mFloatLength(%val, 3); - } - } - %this.setValue(%val, %child); - %this.onAction(); -} - -// default onAction stub, here only to prevent console spam warnings. -function AggregateControl::onAction(%this) -{ -} - -// call a method on all children that have an internalName and that implement the method. -function AggregateControl::callMethod(%this, %method, %args) -{ - for(%i = 0; %i < %this.getCount(); %i++) - { - %obj = %this.getObject(%i); - if(%obj.internalName !$= "" && %obj.isMethod(%method)) - eval(%obj @ "." @ %method @ "( " @ %args @ " );"); - } - -} - -//------------------------------------------------------------------------------ -// Altered Version of TGB's QuickEditDropDownTextEditCtrl -//------------------------------------------------------------------------------ -function QuickEditDropDownTextEditCtrl::onRenameItem( %this ) -{ -} - -function QuickEditDropDownTextEditCtrl::updateFromChild( %this, %ctrl ) -{ - if( %ctrl.internalName $= "PopUpMenu" ) - { - %this->TextEdit.setText( %ctrl.getText() ); - } - else if ( %ctrl.internalName $= "TextEdit" ) - { - %popup = %this->PopupMenu; - %popup.changeTextById( %popup.getSelected(), %ctrl.getText() ); - %this.onRenameItem(); - } -} - -// Writes out all script functions to a file. -function writeOutFunctions() -{ - new ConsoleLogger(logger, "scriptFunctions.txt", false); - dumpConsoleFunctions(); - logger.delete(); -} - -// Writes out all script classes to a file. -function writeOutClasses() -{ - new ConsoleLogger(logger, "scriptClasses.txt", false); - dumpConsoleClasses(); - logger.delete(); -} - -// -function compileFiles(%pattern) -{ - %path = filePath(%pattern); - - %saveDSO = $Scripts::OverrideDSOPath; - %saveIgnore = $Scripts::ignoreDSOs; - - $Scripts::OverrideDSOPath = %path; - $Scripts::ignoreDSOs = false; - %mainCsFile = makeFullPath("main.cs"); - - for (%file = findFirstFileMultiExpr(%pattern); %file !$= ""; %file = findNextFileMultiExpr(%pattern)) - { - // we don't want to try and compile the primary main.cs - if(%mainCsFile !$= %file) - compile(%file, true); - } - - $Scripts::OverrideDSOPath = %saveDSO; - $Scripts::ignoreDSOs = %saveIgnore; - -} - -function displayHelp() -{ - // Notes on logmode: console logging is written to console.log. - // -log 0 disables console logging. - // -log 1 appends to existing logfile; it also closes the file - // (flushing the write buffer) after every write. - // -log 2 overwrites any existing logfile; it also only closes - // the logfile when the application shuts down. (default) - - error( - "Torque Demo command line options:\n"@ - " -log Logging behavior; see main.cs comments for details\n"@ - " -game Reset list of mods to only contain \n"@ - " Works like the -game argument\n"@ - " -dir Add to list of directories\n"@ - " -console Open a separate console\n"@ - " -jSave Record a journal\n"@ - " -jPlay Play back a journal\n"@ - " -help Display this help message\n" - ); -} - -// Execute startup scripts for each mod, starting at base and working up -function loadDir(%dir) -{ - pushback($userDirs, %dir, ";"); - - if (isScriptFile(%dir @ "/main.cs")) - exec(%dir @ "/main.cs"); -} - -function loadDirs(%dirPath) -{ - %dirPath = nextToken(%dirPath, token, ";"); - if (%dirPath !$= "") - loadDirs(%dirPath); - - if(exec(%token @ "/main.cs") != true) - { - error("Error: Unable to find specified directory: " @ %token ); - $dirCount--; - } -} - -//------------------------------------------------------------------------------ -// Utility remap functions: -//------------------------------------------------------------------------------ - -function ActionMap::copyBind( %this, %otherMap, %command ) -{ - if ( !isObject( %otherMap ) ) - { - error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" ); - return; - } - - %bind = %otherMap.getBinding( %command ); - if ( %bind !$= "" ) - { - %device = getField( %bind, 0 ); - %action = getField( %bind, 1 ); - %flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD"; - %deadZone = %otherMap.getDeadZone( %device, %action ); - %scale = %otherMap.getScale( %device, %action ); - %this.bind( %device, %action, %flags, %deadZone, %scale, %command ); - } -} - -//------------------------------------------------------------------------------ -function ActionMap::blockBind( %this, %otherMap, %command ) -{ - if ( !isObject( %otherMap ) ) - { - error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" ); - return; - } - - %bind = %otherMap.getBinding( %command ); - if ( %bind !$= "" ) - %this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" ); -} - -//Dev helpers -/// Shortcut for typing dbgSetParameters with the default values torsion uses. -function dbgTorsion() -{ - dbgSetParameters( 6060, "password", false ); -} - -/// Reset the input state to a default of all-keys-up. -/// A helpful remedy for when Torque misses a button up event do to your breakpoints -/// and can't stop shooting / jumping / strafing. -function mvReset() -{ - for ( %i = 0; %i < 6; %i++ ) - setVariable( "mvTriggerCount" @ %i, 0 ); - - $mvUpAction = 0; - $mvDownAction = 0; - $mvLeftAction = 0; - $mvRightAction = 0; - - // There are others. -} - -//Persistance Manager tests - -new PersistenceManager(TestPManager); - -function runPManTest(%test) -{ - if (!isObject(TestPManager)) - return; - - if (%test $= "") - %test = 100; - - switch(%test) - { - case 0: - TestPManager.testFieldUpdates(); - case 1: - TestPManager.testObjectRename(); - case 2: - TestPManager.testNewObject(); - case 3: - TestPManager.testNewGroup(); - case 4: - TestPManager.testMoveObject(); - case 5: - TestPManager.testObjectRemove(); - case 100: - TestPManager.testFieldUpdates(); - TestPManager.testObjectRename(); - TestPManager.testNewObject(); - TestPManager.testNewGroup(); - TestPManager.testMoveObject(); - TestPManager.testObjectRemove(); - } -} - -function TestPManager::testFieldUpdates(%doNotSave) -{ - // Set some objects as dirty - TestPManager.setDirty(AudioGui); - TestPManager.setDirty(AudioSim); - TestPManager.setDirty(AudioMessage); - - // Alter some of the existing fields - AudioEffect.isLooping = true; - AudioMessage.isLooping = true; - AudioEffect.is3D = true; - - // Test removing a field - TestPManager.removeField(AudioGui, "isLooping"); - - // Alter some of the persistent fields - AudioGui.referenceDistance = 0.8; - AudioMessage.referenceDistance = 0.8; - - // Add some new dynamic fields - AudioGui.foo = "bar"; - AudioEffect.foo = "bar"; - - // Remove an object from the dirty list - // It shouldn't get updated in the file - TestPManager.removeDirty(AudioEffect); - - // Dirty an object in another file as well - TestPManager.setDirty(WarningMaterial); - - // Update a field that doesn't exist - WarningMaterial.glow[0] = true; - - // Drity another object to test for crashes - // when a dirty object is deleted - TestPManager.setDirty(SFXPausedSet); - - // Delete the object - SFXPausedSet.delete(); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testObjectRename(%doNotSave) -{ - // Flag an object as dirty - if (isObject(AudioGui)) - TestPManager.setDirty(AudioGui); - else if (isObject(AudioGuiFoo)) - TestPManager.setDirty(AudioGuiFoo); - - // Rename it - if (isObject(AudioGui)) - AudioGui.setName(AudioGuiFoo); - else if (isObject(AudioGuiFoo)) - AudioGuiFoo.setName(AudioGui); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testNewObject(%doNotSave) -{ - // Test adding a new named object - new SFXDescription(AudioNew) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 2; - }; - - // Flag it as dirty - TestPManager.setDirty(AudioNew, "core/scripts/client/audio.cs"); - - // Test adding a new unnamed object - %obj = new SFXDescription() - { - volume = 0.75; - isLooping = true; - bar = 3; - }; - - // Flag it as dirty - TestPManager.setDirty(%obj, "core/scripts/client/audio.cs"); - - // Test adding an "empty" object - new SFXDescription(AudioEmpty); - - TestPManager.setDirty(AudioEmpty, "core/scripts/client/audio.cs"); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testNewGroup(%doNotSave) -{ - // Test adding a new named SimGroup - new SimGroup(TestGroup) - { - foo = "bar"; - - new SFXDescription(TestObject) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 1; - }; - new SimGroup(SubGroup) - { - foo = 2; - - new SFXDescription(SubObject) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 3; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(TestGroup, "core/scripts/client/audio.cs"); - - // Test adding a new unnamed SimGroup - %group = new SimGroup() - { - foo = "bar"; - - new SFXDescription() - { - volume = 0.75; - channel = $GuiAudioType; - foo = 4; - }; - new SimGroup() - { - foo = 5; - - new SFXDescription() - { - volume = 0.75; - isLooping = true; - channel = $GuiAudioType; - foo = 6; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(%group, "core/scripts/client/audio.cs"); - - // Test adding a new unnamed SimSet - %set = new SimSet() - { - foo = "bar"; - - new SFXDescription() - { - volume = 0.75; - channel = $GuiAudioType; - foo = 7; - }; - new SimGroup() - { - foo = 8; - - new SFXDescription() - { - volume = 0.75; - isLooping = true; - channel = $GuiAudioType; - foo = 9; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(%set, "core/scripts/client/audio.cs"); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testMoveObject(%doNotSave) -{ - // First add a couple of groups to the file - new SimGroup(MoveGroup1) - { - foo = "bar"; - - new SFXDescription(MoveObject1) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 1; - }; - - new SimSet(SubGroup1) - { - new SFXDescription(SubObject1) - { - volume = 0.75; - isLooping = true; - channel = $GuiAudioType; - foo = 2; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(MoveGroup1, "core/scripts/client/audio.cs"); - - new SimGroup(MoveGroup2) - { - foo = "bar"; - - new SFXDescription(MoveObject2) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 3; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(MoveGroup2, "core/scripts/client/audio.cs"); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); - - // Set them as dirty again - TestPManager.setDirty(MoveGroup1); - TestPManager.setDirty(MoveGroup2); - - // Give the subobject an new value - MoveObject1.foo = 4; - - // Move it into the other group - MoveGroup1.add(MoveObject2); - - // Switch the other subobject - MoveGroup2.add(MoveObject1); - - // Also add a new unnamed object to one of the groups - %obj = new SFXDescription() - { - volume = 0.75; - isLooping = true; - bar = 5; - }; - - MoveGroup1.add(%obj); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testObjectRemove(%doNotSave) -{ - TestPManager.removeObjectFromFile(AudioSim); -} - -//Game Object management -function findGameObject(%name) -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return 0; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %assetName = AssetDatabase.getAssetName(%assetId); - - if(%assetName $= %name) - { - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - %assetQuery.delete(); - return %gameObjectAsset; - } - } - - %assetQuery.delete(); - return 0; -} - -function spawnGameObject(%name, %addToMissionGroup) -{ - if(%addToMissionGroup $= "") - %addToMissionGroup = true; - - //First, check if this already exists in our GameObjectPool - if(isObject(GameObjectPool)) - { - %goCount = GameObjectPool.countKey(%name); - - //if we have some already in the pool, pull it out and use that - if(%goCount != 0) - { - %goIdx = GameObjectPool.getIndexFromKey(%name); - %go = GameObjectPool.getValue(%goIdx); - - %go.setHidden(false); - %go.setScopeAlways(); - - if(%addToMissionGroup == true) //save instance when saving level - MissionGroup.add(%go); - else // clear instance on level exit - MissionCleanup.add(%go); - - //remove from the object pool's list - GameObjectPool.erase(%goIdx); - - return %go; - } - } - - //We have no existing pool, or no existing game objects of this type, so spawn a new one - - %gameObjectAsset = findGameObject(%name); - - if(isObject(%gameObjectAsset)) - { - %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); - - if(%addToMissionGroup == true) //save instance when saving level - MissionGroup.add(%newSGOObject); - else // clear instance on level exit - MissionCleanup.add(%newSGOObject); - - return %newSGOObject; - } - - return 0; -} - -function saveGameObject(%name, %tamlPath, %scriptPath) -{ - %gameObjectAsset = findGameObject(%name); - - //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset - if(isObject(%gameObjectAsset)) - { - %assetID = %gameObjectAsset.getAssetId(); - - %gameObjectAsset.TAMLFilePath = %tamlPath; - %gameObjectAsset.scriptFilePath = %scriptPath; - - TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); - AssetDatabase.refreshAsset(%assetID); - } - else - { - //Doesn't exist, so make a new one - %gameObjectAsset = new GameObjectAsset() - { - assetName = %name @ "Asset"; - gameObjectName = %name; - TAMLFilePath = %tamlPath; - scriptFilePath = %scriptPath; - }; - - //Save it alongside the taml file - %path = filePath(%tamlPath); - - TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); - AssetDatabase.refreshAllAssets(true); - } -} - -//Allocates a number of a game object into a pool to be pulled from as needed -function allocateGameObjects(%name, %amount) -{ - //First, we need to make sure our pool exists - if(!isObject(GameObjectPool)) - { - new ArrayObject(GameObjectPool); - } - - //Next, we loop and generate our game objects, and add them to the pool - for(%i=0; %i < %amount; %i++) - { - %go = spawnGameObject(%name, false); - - //When our object is in the pool, it's not "real", so we need to make sure - //that we don't ghost it to clients untill we actually spawn it. - %go.clearScopeAlways(); - - //We also hide it, so that we don't 'exist' in the scene until we spawn - %go.hidden = true; - - //Lastly, add us to the pool, with the key being our game object type - GameObjectPool.add(%name, %go); - } -} - -function Entity::delete(%this) -{ - //we want to intercept the delete call, and add it to our GameObjectPool - //if it's a game object - if(%this.gameObjectAsset !$= "") - { - %this.setHidden(true); - %this.clearScopeAlways(); - - if(!isObject(GameObjectPool)) - { - new ArrayObject(GameObjectPool); - } - - GameObjectPool.add(%this.gameObjectAsset, %this); - - %missionSet = %this.getGroup(); - %missionSet.remove(%this); - } - else - { - %this.superClass.delete(); - } -} - -function clearGameObjectPool() -{ - if(isObject(GameObjectPool)) - { - %count = GameObjectPool.count(); - - for(%i=0; %i < %count; %i++) - { - %go = GameObjectPool.getValue(%i); - - %go.superClass.delete(); - } - - GameObjectPool.empty(); - } -} - -// -function switchCamera(%client, %newCamEntity) -{ - if(!isObject(%client) || !isObject(%newCamEntity)) - return error("SwitchCamera: No client or target camera!"); - - %cam = %newCamEntity.getComponent(CameraComponent); - - if(!isObject(%cam)) - return error("SwitchCamera: Target camera doesn't have a camera behavior!"); - - //TODO: Cleanup clientOwner for previous camera! - if(%cam.clientOwner == 0 || %cam.clientOwner $= "") - %cam.clientOwner = 0; - - %cam.scopeToClient(%client); - %cam.setDirty(); - - %client.setCameraObject(%newCamEntity); - %client.setControlCameraFov(%cam.FOV); - - %client.camera = %newCamEntity; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/images/AreaMap33.dds b/Templates/BaseGame/game/core/images/AreaMap33.dds deleted file mode 100644 index e01982a94528594a375ae6e61c44780a8e1c0b68..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 109028 zcmeI5iFZ_0wuhNfX$3`^L4AY}f-Hm>Xh5K`9}tMZLI^Ab84N>Ylu2fN|IYh6-}}Bw zcDP(BWU8uj2UP(;v<48Z{Gf$v}=tOI*XXYs`_r*&BzL4@;I&oE;IoO1@@ z-_Q@=g7eNAu(w_h~o^*6)9TxpEUY z?^wgX0B4?$V9x2XID)9=v0h?^AFEw~GvMcp*6%&g2j)umhN6bsTRQWo%Q^MgcyR;~ z&0`sgdoT>nIrfx?z`aWMg(6ov?^wfEf&cqtXCC)1=Zr3k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$9guHb|EEO~vTgeEsd-))phvlrfhvyc8wy@s@`l?YTStu|?^ltTW`e{YnT ze%C-Uvj%HWe)Mx59rI`ua#WCt>|Oj|kUocONkX>xFQeSi+bmmWsui-x;DD3$qQ|`t zj|+kiz&P|tTd>(<%C>YT61+3mOM-=}EHk8iFZ{u1I!Bc@;<*I*1{QMvPXOdpdLhf_ zQe#j7=An=F^6AE@B~`fPo(?DehjuVqkZ;PxhnZ{OLDSfeu3#_K1p`Aj*s{N4Y4{ z!Vgv1zJ2Bjd#gAhevIGrZ=#E)VAG5h=KdYzV5QXMl30nQY1b;`M={Kt($ZnIP4?Q4 z^#HPE55#6xuH@fDLh#b5n26`qXHkXWKL(8#uAdw-*r!UfahzaO7fKhawG4TQiHV!Q zc3brQ^Kww4V_(mc!xQ5+=;3Z&+s!JbMt{tC?PZ3mB$xg_rge$j7%KneTdQ2v7dh5U z6Q*s?&k>5`DV3&P93=JZWzRxZw-IFhehInIP~D$XDW-KqUO$)R)~Z-K$xG{4B@FE% zFCR>V()tJg6J#phqAh$Sb7;|f5wHQg_$cedz#H@hg({hs-; z_*3YUg*@kswbl*&a|M9owN#|nX$w%n+6vy~IJ3^3%`IIj?oN2+_y^Wn@VntaP}lFe z&0k-M(GzHl=SYO1eK&6z=AcxyG>A|ipMz7QxcyRMoIiRFg|7aJx^_ft9$#yL@azb0 RBF+E+002ovPDHLkV1nj@91s8i diff --git a/Templates/BaseGame/game/core/images/caustics_2.png b/Templates/BaseGame/game/core/images/caustics_2.png deleted file mode 100644 index 99097fa0ed112c28958363f2951478a0955218ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33963 zcmXt91yGw^(+y53?yfEF?$Dy8g%+3M!L7Kv7cIrzrC6ZAi$fsA-5r9v75D$?H}i+d z1Tq8M+}(Tk>^Wz@e^F7u!XU>0fk0Rv6lK*wAOzrB1Q0qZ@S^WrW&ymQntoJ}1-<{B*J+^mJH=Z0)c2jA7tNYcrK2# zpW1?TQ{H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m>?;*L#%mhG-9|{+^^i z*kZ!NfoFjweR|iAm`4CYuH2oX=uKn6!#$`Tlo2m+vdXn?zyT5*Wc4wWtNhZ&lwRTi zty0lQ*g0ypk7FMD+a(;N+D%`ALqRBVb=R|wFuwBfuKofSq|61>6|gCJlo5meX>mU)oM1L=X=D0pK~g%Rj*Ee8CdEMjQ*? zEb*y46&I=j%MTK}-Fugso}?zYZak*Fh&jFFg>q8;VCG)>@d};1@yMJ#Msun!mnt*H zT}_U`Jcu?`IY)=rYdQq?hB)c#$^4fcIX>A8JO`n9Unb!k-KfpL>t?_6vRD~ty zI`z^`%QC1ps2GHdxeR1u`OES?&b#->z-&qrb9|)p*W2^vQ3x&8)0}QDQ_2s6c`q%d z2?{OHd-8q3L_1nAcsKKVaD`@nLdoLUvJtrn$ni7}{15!@``@5(`}uS!^hUcA>8twJ zKyCH!rfv43R%KZkPmh>PYpHyl)5*a$t~upzVimJ|Y95SKIW`K_{pZf%{~3LLL%xlU&$iTp;`M%rCDs{K4s{ zreRM&rh^Sz1dfj{(X%-qoY6kadboymM_%SabQ#?(#)R)tHBrbU^nq}{>?}Srq;jcz z{Au-Z8@0JYkvcPblir5GY|9c) zT0hc)Q89O(Jz`07Vj(OrOx(a|8f~!;rq3jcFK|ns9|1Pbv%o0x`>vSasOW}5*ZNkx wPx6^^W}6!C?24m_)Od^3pro&j&sU!PHBsYjs7~_SLBQ81DMiWhkA{K&2MO=rQ2+n{ diff --git a/Templates/BaseGame/game/core/images/checkbox.png b/Templates/BaseGame/game/core/images/checkbox.png deleted file mode 100644 index 46e0ac959fc26d224015f316df050c2f137af4d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3943 zcmZuzc|25Y*gp0x3}Z=&AtF1;79rAP-!jNDl2Di_WF0g1HKD9w?4nnaWNQprBgU3e zLYC~i7-N}lruY5*zVDCkk8_^q+|P4g=X$RDzRvH&o15NXXFbCT008?6x2*Ap8)%9tb4lrk)-I`3P~()5{G20&{aS0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uZBV5 zTyg+f=GRN@hXM48#$X+w?J^Fv69b9yq-BOQl)>bkK^+Pv01f@u-PI+lh|^^(5X^K= zJ}rZ=R&W$p`}!~i>24`A^N9K__h=iGvvAT$l5OZD;%WV{i2tK zHtruD8mb=udvYpZ&o)(8y^Z-q{y;X~6iu03fU;Bc6lFz9hMIIofHJKFsL@JB>U5M^ z6Bg$}+IFh;`ZjrN|Ec_+o_|pd=P64WSW4ESHHTC$ypW;+y_Nb)j}|m}lI+@@{IQS1 zgCZ*yFe|3ea;< zEge8{qB($5W^=atDR~Ny?vB^phWJDN05nlW@u2@28>@}x{@d948UOl%fk!OruNMlJ zzMB2p=PAm^qJRAnCqu0Qb)%^Cb$}j3Cn+0#8Uki^`PX>=wxzS5z#a!@^F;V2R|&zU>Vi_MX3m8=ee-7ki2fzW?yy138vc zm@#t=#QxHg^Ir;>BihQRI*!73*?XvPAyQ1yqJxbMmg+h{YPu-3QLQ;ZaA2H6C#g8Q S3QYOT0XMIk>c74QkN6*F=2BAt diff --git a/Templates/BaseGame/game/core/images/group-border.png b/Templates/BaseGame/game/core/images/group-border.png deleted file mode 100644 index 61234ae1fb3dee29eda38a371165d36b060ee426..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1273 zcmVRq)0SqBM&U{ zK~RE8k;)fTv@rNVFsUphN-&N10jmTOk|LETicKV_m54TpVAK!`|L<7|`4E(7K4ARB zDus5>J(HaE?!4W7v&qH}czMI@+&44#&Ye5=o}G2_O1ZzkpGs6d@8oj17WcW!E!8%I zG7SwXm(AMBn08BdCX>0T948-RoKK$0X0t6*Q&aiH#l^fexw~LXm>2UyPMmS3yc8^% zPN&txvs=#V2iKgriKmXs^9tJFqjWWIBOj#Opr!-61IK}Xx1-s?{L4G0_&?_ilXv4x zqfZ_btu8MwSK|-wsQY~v)cnk(&+H?8J(|C{sz$fn!M^&){#~l$>@n5f-deC_;MX2J zsxZHFtA)8SUGF$_vOr$N_B~qGz~m2~oD@4WwsorNs!FYtyCThVSEZ(BX4T=g^Lm1w z!FRq%(Y|`AS3jc65Sso~f)<#1w-6X-QZF0;z1&IJw>OAO*=w$5nIM949%2g^Yzljy(oWy)Hf= zKP~7s_`nZIkS{YqF~l(je$;4#Z=xBAo(3O1_wqgCBii5tJte9r;~AA?zGq4`(Ts_n zWQL)#a^A!gm6r6qM+nP?0Sc)kNm@4Xtw-=SGYrxowl6GaQ(5@5B&1Y;X$f*x_i`5k zxlG?JMp&eYe3Cfrf#}H=#@X;~|BtO`5XzBM3_XQWv3X-F3LkUd8np$mW$;ZD@}tlb z@grOWzKMePX$!hz`6y0z95fS#p0K!L8Eqx>`_a=%75$H%65feFik{-gOB_87-@a&t zo=kbNraT|vFoAMIeOeI8_0#*bHBgfWlms3M{F=|;vk&HAk-V?7qf70j+dSQteXuCB zxme0WXRY7zZQiQU6W{Gki*a6ad*$6z80sP_3%q+`TtsI83dY1J6eRh$8vuYoz-JP{ zd_mbs-aVmUVdndNBq%XE#kqTuz$8gP5_U;MoS^NwxEOTzWZpMPmn%SJ z?(zSC4+0292nh@kvId`u$uPqZCPNED8bgi@LmbC`Ql1P|ln1?_pHA~@{Z%BXuPKfW j%4_?bDUt6}KLr>7B{DrC{G$C100000NkvXXu0mjfaJE^D diff --git a/Templates/BaseGame/game/core/images/inactive-overlay.png b/Templates/BaseGame/game/core/images/inactive-overlay.png deleted file mode 100644 index feab83209cc442c5ad8dc73c2b86e0a8115c4743..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!foRZkbkkcwMLfBw9D?8~Obq{gPz9LVg>D`Q%4bP0l+XkKL$W0) diff --git a/Templates/BaseGame/game/core/images/loadingbar.png b/Templates/BaseGame/game/core/images/loadingbar.png deleted file mode 100644 index 34f5944030dce5a174233bcef11b7d7210bbeac8..0000000000000000000000000000000000000000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Nn!8LZNK~iW7gJ zde&!XOj(Q(Us4g>lK`oI_mJ{g7#nIvBPl%!^F;$up%;XqmpU+b<1;+Yn1Jrza&S|h zj#d3p7~%K>qh}hT?Ux7?0-7M=QjN2nPIxx?29__Lf^U86;3ISfK3&RCKQ$4bC079b zTTU~sK$9|gTX?2pB5h!HjAIpM;%AByRl@-}9IZ@V!^2Pfo9{nagOX9mjU# z4ZJ7-D24qK=wtDY9lMNa+~mo93;s~&h8n*ed%@zFIxN$e$3vCPR5&=E+dfX_BH79G zAL7O_jth7-xQ9~H=27B)BJb7d^5=P1Y7|AY-P)ano=p@I+IW(K)D-bnND6OlyFjse z3=O&qiH_s&a$W`V(<12K+=d5xE}}EA7UPZO#QZH8#l zXaqaEqrvnO-j2)17fB)bx$Q&cC1c!DP(!v$8%m39u_y2lj)x7#@LYjv58V!lBlGZQ zcOP`cmOyEH8}{fefKs6ogvX`g==O!EbJ>gFd{=C$Iu0#^04(sRL8Rwq=mf;zS!)5T z=l;fns0*-&-j8aWhFw!FI!X;8F7ge(#xKCP#jCMHu?go~?n1wNGPeCozz>&X3>WW% z$jX;)XsfYdY;jzdEpAUV5j@1IRjg!VO z0|`t!cMc!lreIn5U--%{!8dPDyfZ$B+jmbuWZ*~W9SahKoUJfS48r_O16++l zPnwwTM`-Va%1V@TU+ zP0V{%%ak@JhD%RlFxs3fKQVtGntklu5JR@I>BQih3;N+y-OT>dj|Cb{-#| z?523~R>r$aP-M+oPPsmYRsteh@=%n!ul6w~uAaJ$Yk0g`l?ijCxzlY3<(@e(Pkt4z zyw+#U{s!vkMzGrS1@)#Cuy^wnj!C`24-rlRt2Ly3sXjX=ZsjhQU)uZ>J(3=xOl(0QP-!(>N?>&;S4c07*qo IM6N<$f@#CI-2eap diff --git a/Templates/BaseGame/game/core/images/null_color_ramp.png b/Templates/BaseGame/game/core/images/null_color_ramp.png deleted file mode 100644 index 5f5a52186eb93cb7ace739e645e5e8f8e6b8050d..0000000000000000000000000000000000000000 GIT binary patch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KdCUjy1xJXsWE znAx*ux2K+D`2Jx+ck@Rk#fmp?-lW5a54WpDwOtRsGCpq%!8$1@@9io6?0Rb#Tc7lk zCr=XojYoS*RM+E^-Kx7^y?RCS=g$}25H%UW|2(2S#h+c@o)&Yv_kRJO_n_Zf_&8bs O0000(_@_GbJ<_dZw^Q+&I7EPrEnI(eqE51YbYz7T13zwEE$$n>MSVv_3!WR xqwIV#4BRgm4JXvHMKX&S7St`!IKaTf!=UB9TBWi;$P?&J22WQ%mvv4FO#lthVzU4M diff --git a/Templates/BaseGame/game/core/images/thumbHighlightButton.png b/Templates/BaseGame/game/core/images/thumbHighlightButton.png deleted file mode 100644 index 9d83b75f31b965b79ff082e3a0f6e37e4c757c1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 778 zcmV+l1NHogP)^%4Aj<$I1_}WqRRR$d z1~4y>8i*8ofd!i&&^88q;$hSbL@LC>f3!$o1Vs!3BNnyT#Q(FzWmcoc0=>O348mYE z7Di)XG#${gULYk9sZ%c;*}t7K1LT!85hAQlXK)Rq9_nInN)!ayOp3q3h5+?ZB@mfF0rU0$f5zPxzJM_-aIs(% zaacePd~O^y0Gb=Qf!I}_n|uR62^f})T}Q)U#D)ReA_iudz%LMg;eTdyg}>q%QN>TK zMd@&GqN(S^VIe239t#(mI2R5BxNsT3gC@>{!vG#!2JoSY^WiXn50?SFXyUv$4B(}@ z3n;D^SU}}Ft66XpQhe_P#$P)N-;>uu0ogpTEtG2ypD`}kb`^|A zTPQ=eg`y=V3C3g_aP84^23RtV84ZIG8wR5-l+hN-XbXi3Efk;Vaufm3qytH#c_6Z< zE(Ia9w3GDg3<4Lg-UZX@LvA#W$v3*3@#f9jjG!4Dq}d&UEfkp8X#0Q~5|tAdDOXK#LK`1pomC0NWAfc{C??-~a#s07*qo IM6N<$f>^aj6#xJL diff --git a/Templates/BaseGame/game/core/images/unavailable.png b/Templates/BaseGame/game/core/images/unavailable.png deleted file mode 100644 index 9d818a3765d48243d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ULFWYRz-B%CmJ@_hdZfd%3~`RmT4qI38Yg6POid zBb9F-#lZ{OQ^~Y-y^=d7O6UD_w_Y8VHU&a^>rYBNVm;5i_1f=$GQeO16s^Gud(#5) zq<{p|OpiXZ+7Sy=myMHyK(5^%z(IWdVRrqI^$#4Jufh}r7;tVh`hUNG;s~_bzySc0 z|2hW5$Kd$Cy=TJg`b+=%tN+vS|NgB0^X2{P-~adH{|{Hy`p@%mNe l814Vh^#9YDKE&YBKxnPL?nJ&?puN6t$_nc8<+5fW{|kT=cUJ%a diff --git a/Templates/BaseGame/game/core/images/warnMat.dds b/Templates/BaseGame/game/core/images/warnMat.dds deleted file mode 100644 index ea99dcbd74a8b2ae49c5cff5a69743498a66e937..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 699192 zcmeFaPi$M+p67Q(#Rw%q$lVCxuCM)|w4M~V{T2fJ7L9l5=?1EHs%~9T&ZsR?vxyfI zsJbygxsX^C8(DbKi&_Xl?Ia2f*klZ%fGCLvqZVm(77oyhDio(NUSwqH4PbCKf$})> zK(x$!f9LR!6h(@c5=l|gmq67qMe^Qr&pE%(@6Y+2bN=K{{@nQ=Ez9~Z?NQ76FYpif z&kD-_tTFX}|NnFFRr&d!EYAO`*{_1Od*;t>$tlSnS+X5C4k!oY069PokOSlZIY17O z1LOcXKn{=tbP?mEh4x0G{HM%>a}6jFwRD81ID`aV8azt6j+Y!2Ta>0>S?>#-q__zuK?WeVjr#I665w zc~jc8`_Ccz-TFrP=kceWh4zA)_i}DHIFIpvT8|g^R&40;d^w{^DEb86pH#|nIj!D{ z{+GX(_fn&(Or@-j%Fn4+>igz8<&wJIGA_I#_cx_i{%m~+2gfRQf;E=cc8V3)>3%zr zuifA)`-S6ZkjGJY9o)l9`78O82bwo~6|QOCm8-n#-us*zQ+|)~w*o`s*IiDa|1GHh zsL>y)9Z$+>;d-$L?I+i5)-U2WLj6h6oWt{TUZF(&Gsybq zx^w@!*Wc)W;mKYmJuSRRk6Ma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elW3pdwrDv_N<1Fpu$Yecx1G3FwwrRv zW*E;mo8AW8oZag$`ZV7Dl5-V;lfi8_fxCnHUX*hb7-#2`xGP;>Yxy?qZt$=1VGPa- z<2?XV9yRIQTfmjVMf^(Qk`^!2m+>!gr-*9-el_?uI6;eWLJ&7_UjBpkyw8A>!8ii% z9u6YoNf3^RaUpTDi{#!~IV|Vj;9oG#Nyp)oiD!?vn^Kr@Sd-}>6+3qe}jMqp3N6++&s+J;~<6HKw*8kLF;`SRp7$?*90Q@WPpH8Rm;WaXD1l2dO zzs=?MsB&1&Kll!kf8f(403)Xu&*OQiH1R5rLSZ%kckeDA|Fjp$!Hnn!`=7WnT7ODB zAEt?2<9RfNOy*=c$hcyImreT{2xz>Vr!oH7kD7lY?>h0>vJ2zjj_Kd!{1ZQq@=`V8 zMHqe8?B!GIW3dy!Pr*1+FJT^N zb-$bPYwmV!r+RkN4$aqk_Q-v$C!wE*5#9;=r{<_q!s_4|E zbJf7%56~YGRo-)exIt>q$QQF$albbaS5=%({m#2vh-0Rro)Mb5+BCt z+S}pl&A@R+oTy*^KF$4MAn92=uWW+_Whs_Gc^>ga54_&J+q6(sq0( zVY^r6&!XSz&aprT^al1kMtv%;zYgGk=Gz6wGwjM%^POQ?{^JD~UovJw108=HRI0jp z;G1jzz+Q&>-@Gx7`_R_VS2vJ9z8~KyJ66{JNb-NE{}<7I$#?(pI(G@(;;L#rqAq+3 z`xfeVQdh2^9|rK5pE!#}H(MyEs=xP3H9bu}Q_gvmJ9nu~a2Sn!27e2BVQ7ck6R+_! raGdj4Z)`w+6{m>%2LJK#4dUl7PN}gm$ggc?divbC*=z9`o}2kEfiE*! diff --git a/Templates/BaseGame/game/core/images/window.png b/Templates/BaseGame/game/core/images/window.png deleted file mode 100644 index d9e8006e473974be6c97716e9ab9abc2e0e373e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2559 zcmZ{mYar7N8^-^0n3-mBX2X<}2W6Q#PUci744;zge=T4 z5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Hr!Bl(quZU34PWn{l{=8Jow`mDubt{-#iH18 z8mX&%Art`E>G4is6t7)JdqnF zTQ{Ikk}k)E6-v_O$=*DXcE(HIdgj!iH}mZ9Z6_!B?Z}atAEOE->2fHjP?9cB#4^d& z^)Dz%_7`Wmoo_5^VDG1sH4sUD!e1e9l7Sz8obiXr@Qttc&B~q5qToJHnKFgOefF7b zTeB1JoR=+IM&-N`?Y735a_lLxXE`S3g#FBjOTps0m=oerh)ZQ9_7odyQpbo#sU70F zm=oerUUq}0W9o{4lDL?YWiHUgoDh%7mP8bdjX7E8EM3eA@u+M`1U>0uPFD038*@TD zDq9lJ#heh2Qlg7FAs&@23Fu-@h({^W#hmQEuahaoedFu>r|5?ob5cVopo=+Kw*={8 zPKZY#E|m?@q9+8;7A#mm13vml>+7N9`t|GSHykF3+Fsfd5jlj}TcX9f=zv}*>dx>;V=&NpN9e@jtbDyKdCUjy1xJXsWE znAx*ux2K+D`2Jx+ck@Rk#fmp?-lW5a54WpDwOtRsGCpq%!8$1@@9io6?0Rb#Tc7lk zCr=XojYoS*RM+E^-Kx7^y?RCS=g$}25H%UW|2(2S#h+c@o)&Yv_kRJO_n_Zf_&8bs O0000(_@_GbJ<_dZw^Q+&I7EPrEnI(eqE51YbYz7T13zwEE$$n>MSVv_3!WR xqwIV#4BRgm4JXvHMKX&S7St`!IKaTf!=UB9TBWi;$P?&J22WQ%mvv4FO#lthVzU4M literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/images/thumbHighlightButton.png b/Templates/BaseGame/game/core/gui/images/thumbHighlightButton.png new file mode 100644 index 0000000000000000000000000000000000000000..9d83b75f31b965b79ff082e3a0f6e37e4c757c1b GIT binary patch literal 778 zcmV+l1NHogP)^%4Aj<$I1_}WqRRR$d z1~4y>8i*8ofd!i&&^88q;$hSbL@LC>f3!$o1Vs!3BNnyT#Q(FzWmcoc0=>O348mYE z7Di)XG#${gULYk9sZ%c;*}t7K1LT!85hAQlXK)Rq9_nInN)!ayOp3q3h5+?ZB@mfF0rU0$f5zPxzJM_-aIs(% zaacePd~O^y0Gb=Qf!I}_n|uR62^f})T}Q)U#D)ReA_iudz%LMg;eTdyg}>q%QN>TK zMd@&GqN(S^VIe239t#(mI2R5BxNsT3gC@>{!vG#!2JoSY^WiXn50?SFXyUv$4B(}@ z3n;D^SU}}Ft66XpQhe_P#$P)N-;>uu0ogpTEtG2ypD`}kb`^|A zTPQ=eg`y=V3C3g_aP84^23RtV84ZIG8wR5-l+hN-XbXi3Efk;Vaufm3qytH#c_6Z< zE(Ia9w3GDg3<4Lg-UZX@LvA#W$v3*3@#f9jjG!4Dq}d&UEfkp8X#0Q~5|tAdDOXK#LK`1pomC0NWAfc{C??-~a#s07*qo IM6N<$f>^aj6#xJL literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/images/window.png b/Templates/BaseGame/game/core/gui/images/window.png new file mode 100644 index 0000000000000000000000000000000000000000..d9e8006e473974be6c97716e9ab9abc2e0e373e3 GIT binary patch literal 2559 zcmZ{mYar7N8^-^0n3-mBX2X<}2W6Q#PUci744;zge=T4 z5k(9UPm0LtaSnMs-`+3phx@v&PxpuW{(ZRaS(;yjK_#I80KiNx8Co5=-qDaC;3FlQ zW&|FY1kuQzXdUE540jFj1n?d~Zk{NU09S8MD^FJs%B^>vIsm|1WMYW7A&>uZx=j!^ z5{`~wa)DqRolydXYLUCguOF_#i>-tNAG-(-mZm;X3<Rf@P<9j9v>EuN;g0EIf36edixyxLB1@M1kf)pOMx0{`p`tsOCY~Xf1u3+f$GgG( z{W^Ffc}Cwvg+0?5%9vdh6&1-iCat3pz%={M*$iSBiCVEqYe4SS-IKm=oWwXDe&K~U zSM=}rm>8;yJ5K5A?aa)Jk3%|_o*e(^gIO{dJSzaPu>_D-or6UNgGrx84Bl9VUyI8C zH0%cscg9GoOIiz#GXb~CU_D`)3PA=gmN%pQ2uK>l@C17D)3|Ad)8l*{ir~#Gv_Yfs zo;W~BVVK7E|2g0({abU$d1AtKE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a^${AM z>%?|}%qqt{P``v^4gO&E+0lZe+G4wxM<~G-c)jkUU3jg1K$n9*j!pS_zGvC18+9C^#c>H#^Vw*%H9!%-`$X0=Jm5( zx$=?dhd^}r$e2+D_*GumpfxP)o+iTNIa5{vW(B$n{0dE@0P<#JmY^c31Bio>z)@%n zhH7nNk;pDg^=Gutbc92GxzRNS7+O@hdiA@w56Kp~zYBE{a&y!@I`ri5J&^Gp-N#)K zVOSFpBw!R2Eg(_EKH_N*jJ;$pRV%okOe<4UcO~jAWF72ReN$Ss0*4Vw+5@<`<3wVM z9#z`d*#-6{t28DoFIU!IUSKQp3;HTTp?u1_!TUG%Be5mkInx8Pa&3uLj;dxuhCpI= z6cD9b{_veDfm2T&tui!)_J2SM(dqK4;OSXYCY0;wB~KjXyRxY3zd*ICG$o!^H~3vI zCXZoXN&PTp6a%D|T3saT*@4?`6o6IVE&s`pZ9R{7(B|^E?+tS3<50&REA#^ag$bZX zy6y5@f_$>o5MWauQY#1`Ip&|$asxC!h{w*c9Dza!+4u7*SJZpQ%oqy5eDNK=>x81x|C8J|60)fxq7JVAD}M%lR`)>ZJy36^2CCZ#Kmk2r z02YJ&Bt+U!S8K~?`ST=!_2Jd1&vwfuuz!ljIBoe)znsEX)7(XpSyX{VV9+6K^)R#3 zIiu){wbNrM8{5f!>-mVJqz2=MW9U&EE= %deskResX) || (%resY >= %deskResY)) + { + warn("Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution"); + + %resCount = Canvas.getModeCount(); + for (%i = (%resCount - 1); %i >= 0; %i--) + { + %testRes = Canvas.getMode(%i); + %testResX = getWord(%testRes, $WORD::RES_X); + %testResY = getWord(%testRes, $WORD::RES_Y); + %testBPP = getWord(%testRes, $WORD::BITDEPTH); + + if (%testBPP != %bpp) + continue; + + if ((%testResX < %deskResX) && (%testResY < %deskResY)) + { + // This will work as our new resolution + %resX = %testResX; + %resY = %testResY; + + warn("Warning: Switching to \"" @ %resX SPC %resY SPC %bpp @ "\""); + + break; + } + } + } + } + + $pref::Video::Resolution = %resX SPC %resY; + $pref::Video::FullScreen = %fs; + $pref::Video::BitDepth = %bpp; + $pref::Video::RefreshRate = %rate; + $pref::Video::AA = %aa; + + if (%fs == 1 || %fs $= "true") + %fsLabel = "Yes"; + else + %fsLabel = "No"; + + echo("Accepted Mode: " NL + "--Resolution : " @ %resX SPC %resY NL + "--Full Screen : " @ %fsLabel NL + "--Bits Per Pixel : " @ %bpp NL + "--Refresh Rate : " @ %rate NL + "--AA TypeXLevel : " @ %aa NL + "--------------"); + + // Actually set the new video mode + Canvas.setVideoMode(%resX, %resY, %fs, %bpp, %rate, %aa); + + commandToServer('setClientAspectRatio', %resX, %resY); + + // AA piggybacks on the AA setting in $pref::Video::mode. + // We need to parse the setting between AA modes, and then it's level + // It's formatted as AATypexAALevel + // So, FXAAx4 or MLAAx2 + if ( isObject( FXAA_PostEffect ) ) + FXAA_PostEffect.isEnabled = ( %aa > 0 ) ? true : false; +} diff --git a/Templates/BaseGame/game/core/gui/scripts/cursor.cs b/Templates/BaseGame/game/core/gui/scripts/cursor.cs new file mode 100644 index 000000000..f71bc023a --- /dev/null +++ b/Templates/BaseGame/game/core/gui/scripts/cursor.cs @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------------------- +// Cursor toggle functions. +//--------------------------------------------------------------------------------------------- +$cursorControlled = true; +function showCursor() +{ + if ($cursorControlled) + lockMouse(false); + Canvas.cursorOn(); +} + +function hideCursor() +{ + if ($cursorControlled) + lockMouse(true); + Canvas.cursorOff(); +} + +//--------------------------------------------------------------------------------------------- +// In the CanvasCursor package we add some additional functionality to the built-in GuiCanvas +// class, of which the global Canvas object is an instance. In this case, the behavior we want +// is for the cursor to automatically display, except when the only guis visible want no +// cursor - usually the in game interface. +//--------------------------------------------------------------------------------------------- +package CanvasCursorPackage +{ + +//--------------------------------------------------------------------------------------------- +// checkCursor +// The checkCursor method iterates through all the root controls on the canvas checking each +// ones noCursor property. If the noCursor property exists as anything other than false or an +// empty string on every control, the cursor will be hidden. +//--------------------------------------------------------------------------------------------- +function GuiCanvas::checkCursor(%this) +{ + %count = %this.getCount(); + for(%i = 0; %i < %count; %i++) + { + %control = %this.getObject(%i); + if ((%control.noCursor $= "") || !%control.noCursor) + { + showCursor(); + return; + } + } + // If we get here, every control requested a hidden cursor, so we oblige. + hideCursor(); +} + +//--------------------------------------------------------------------------------------------- +// The following functions override the GuiCanvas defaults that involve changing the content +// of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one. +//--------------------------------------------------------------------------------------------- +function GuiCanvas::setContent(%this, %ctrl) +{ + Parent::setContent(%this, %ctrl); + %this.checkCursor(); +} + +function GuiCanvas::pushDialog(%this, %ctrl, %layer, %center) +{ + Parent::pushDialog(%this, %ctrl, %layer, %center); + %this.checkCursor(); +} + +function GuiCanvas::popDialog(%this, %ctrl) +{ + Parent::popDialog(%this, %ctrl); + %this.checkCursor(); +} + +function GuiCanvas::popLayer(%this, %layer) +{ + Parent::popLayer(%this, %layer); + %this.checkCursor(); +} + +}; + +activatePackage(CanvasCursorPackage); diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 10 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 10 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..2b564950050cfca995e66f048e0523428ff493b0 GIT binary patch literal 412 zcmZQ(U|?W%EXqvG;R3Qi07P>@F%ytx24VyN@mQf;5Dk%qsR4%?)Qy83;)lEIri7m zFZoExihWaFY>GaAyHfb_#$7>4rhD3-7VX{JcRHkY<;8EhWjEc^(!MS|x7jKnT~tu; z`y-fhfi55e9MJ#4lvSq~c?$DU2jYrb$q5Y1ZVG9@ Ja2IA^0RUczP(}a% literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 12 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 12 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..67a177016766c6f06b5b601c3336b9fea2ac75ba GIT binary patch literal 62 jcmZQ(U|?W%EXqvG;Q_Kh07P>_F*8U23jU*ldXO*xH#ZTF literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 14 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 14 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..f4f19745fb7ea405e3c544ab4380b665efbfde9c GIT binary patch literal 4631 zcmchZdpwj`AHbi%49ayYx7>GaDnwH*A*w;jW!)p|8k)v+*M=sG)LQ8xS-0Fm*=0h8 zX`@1JWnETfa@S>zlA8?{>~}&I~UELHKLNkFH5Q z)}%ft1)i{;L6#6iS$Y4juPzv+t5+0;vHh~5(-_K)3uYlRV^F$!R&f~HFFjwtP_Abn zk(pQ4q$w!H#sxZJn~75H3FUs1$T`Yc({lmFGvW=qzeOlr{hKUa({mY0!HL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w z`VG#Il2qhoU!ADu4__=khnA)V756qY7)_Sbf4a*0_#A5D6=3zLu2-yn+n0D*{yVqc zJXd!=QMD$!C_x&*dUhykP|nZBb)t9V+4gvGPWEkff6~sz5#_>bXQW-n*<@0vE6?CO z=YjL{4mM=ta#}y=jFL^uZ@=lbwf}i&rtpUT7B6PKYfvb@`(}Vcf>{Q4OwGVo%=ho zqnTmZRnEn@_Sd#?@8xTm4iEu8=z@~Ce!l~1!mV+nrgv>^AM+y(q9@cBsZ;Iq@5X#~ zP|vu12>JQeqB~VRk&0K~xvoQ`>oXc@(?{+fmXlB`O1tVsydj=;ej|=xo?_VA|fvF_OXed%M;S_u2^+-7m>&hfU=h2}XA8@#HE*5xixzxKHHu zx*9S58_vdMkMp+o$tNehP>zncI`};$&|^NmhR%^~9ImH|{4gmrX=KV5P6;15O$pJc zKj@OP!8q*n`hNct&$QbW-*i|Vtqs{=Aji_4>%PIzy`x2T=lgr`S<#GTy_L1eSNx6S zusuR~)07aoNLT!>!Sbvr@0KAWim0ONIVh_kNyL{m)KaLfxG?@ITp)Dp#0m5H*P@m9 z5e4sD`t8DNqk7RTEsU_s^W=;NtSzZVJy4KvCTGH{g_9#u8`V=etzdDC`qSRl!WuK^ z)2Pn5sKVvWu3u`*A?5#nt4T0|__x>m5h6Eb4gcCg<|bC8lKmcMF2g$b8vq*kIgf-N z8vKO!R<<`=@fdH!|829eI`>E&;m~azKI#rtRraz%Z1XXRhO+l6TR1+xKM6^Hb97t}y)L|5*TVNW${+Aw~ z_<)nIs`VYyU!Es2!o6Z-sk?sP*}hfb-i$2O%`3Y()8pbMiS!$fc17IOeR0;Z#bW3F b6sM#M<#jvpb9awrZFUL$u!K`tU*`B9%GMUT literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 16 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 16 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..ec996019dfe8c0fdc39ecd2cb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Qm3lwzlj~FNh#o(AzHR2OEz$M+=i7vY)~=gXa@F%{;clP5R_j--Qt3aL z7;fVuH(NDJ>7-HQ{o2J(cBamed%H%ia(Cq0@_W|*KEBz;cVQOWnsEQn>bq6zU#;|< z^DkFw!-`w)ul)}FKkLZL`^y;nLtob)SiCBCC!0C%jD0_USgxD3ulmnnucCQ2CAU3` zE*km$pTsl$CP6vE1OkHH{9`Qc@}LdxGI$SRgSIj z?QJt3WHV>|cw9G8=bircH>{wDAP;<4_y6I9{U^J!7Tbah@O1TaS?83{B#C620g!D7 U#C$+paVt3?At42ntauri09vTq4gdfE literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 14 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 14 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..4dbbddede62addac380eca861535ac39d2f3819b GIT binary patch literal 2669 zcmc(gdpMM76u`eR7mNrosa-n?>zZ;YOU01exP>&9T87ny+|sOTB}BQ@Xb^?RrC6a@ zk;|6sPMeg5by+*2MLRCz5(+7?^ZLGdnrB!3-Sa%}oO9maIp=-P`+nayXb6JvCc!?Q zehQ|6e%=y17YNW|$UyV7CU1ORK*T2j9v*Q;cp9@}^J8#456l7qT6o10UHOF|K*0b4 zG)&j8_z)z-(}KBhO(}$8d0H?Rwh00h1ZfjDi02QnZ=N?^?`XLnLfx*9DIG2Xd)$cb1p&(XpUD!T@ zP{Gpx1g;#rCQU#n|E&1Cf-5uD%*{mT>buHaGq(_-t3MkhYvxw0nOlv}fA0!Djr*UW zaKB81f?EIs2+;8J{M(8TLHs@Q&kBA+pCVN77Jv<}+lEjO3ub`;4QfG9=gKeqgbGsd zWrLuX2<3MK)&)^;BnP3ugS&t=yzZDlE{G7!Me+Ou2YX9#{ATcKh?A|%oFE9yqTov5 zo963zA0T_OnTc~)_Cyzvrg#WynkHg!LUE=Fk|G#uu)6gn-_pZAG9CzQ8VUALv$UZ|egBK6=a zDO#3NXrKz$l54r+W^0f^(j#1m;6%dq_Si@xbs`gK$L3yQUb zj-$F67$>@_TwCmm0^yPPa`Wlr>ZL);HV!t;QR|l@8KT*_rZo}|44YLZe`uYZlc3u! zgy==}b&w5G(}cWJhC(3|Ysr)$I(s1GLx7CpU=LHes)*^PRw&&VQ8ryKLbcyjXVBLw z)%j#{vNE1ZuE`uVI;Uc>s9Lg7&-oatBNnnxNGc%d_AES^cy-mPlV0ji4 z&yMuqxU_RmLK^BGR>F3L7{)zRaae*0iIJh9Dcdd6tt44ihY`=zaj;f{OF!UmIPx_P@zT;YGCD zu#%bT@b;B|X|lP!*&S1A%na|N!xsgf5zZT-yb;!OiN%(P*&%a&AQ3MVb8!$?+n?C5 z{3dJQh3*4oOVTCdwg5uWH1NiayW=7ziIAv--bWF zx$%f{1}lucoHHMaj!H^D#gW;s^zPRa6RfFdI@X>0*Po5%iRtf&T--+E`VapAtP-Jh literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 16 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 16 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..fb096776f37c76773bef44144599604436e1c8bb GIT binary patch literal 1198 zcmZQ(U|`^KEXqvGQE$SaLNPOx52T=g4M=kVF(Z`b0E>e}K>$Rv12ISz zL_=hGfGiNeE-M6)1j}NYECH2e0@BE`EMRddB)ypSDj>$^|@K978JRyuG5B zFYPJ8_JCgk2t*{r*hE-FWH>Y|Bm@!y1R$W`fkR?rJZ0y`T zKp-X&QN^DVv->Z5-#qulv6*Eiv) z*N4?xwX5UJ&N`=0+#dScWNy`L*H5L>=D#|zMg8BD*|TeA@xG3o_BLnIpVDbhlh?^j z%5o3&E&6M?csb8&laraepQps^xjD6N4WrJb_vwM@kALp#TM~a#Ywy2@=VO;%Kl{k; z@vhTW<))`_ElB4ebe{K=1iZfwl|jHxTI6{v%tK(Pv4E+ z=TH86e%X32wVkuxFiC`bnsNL4%l9g(Ar{7*sI`_#Qy-9cW<$SJUn(^e< z=Y8{@?JJ*F|GMb&-{}nZR9{|KIQjCl*>ULu@6+XN*029oEdDuX|J*Iw{ExGYR7`6g@ft;7yps<;JgQ$Wwo=o=d4Dp<5KmV>mvv4FO@T-zDgfCfKx_xZ6}OTT5)%IV zvjNEm|NWI2OlI@<%P@03D-d4U$Ju$7=SWO|nY2JLlOgvc8~rJ1tVwPvg>o8a85wpk H3YP!?K^+@u literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 18 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 18 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..1f8fdedd3337dae3859867addedafffcd75bd980 GIT binary patch literal 3066 zcmchYdpwle8poG0VJ0I}Y>jdYT~tz&OJW;xnMrO#ZhIF>ndm|;C4^yj)KoNEDM#|b zPTO_Mt&mHhWI}2bN}?o}+(L-XyS(Gmd(PJW^E{u=TF-jdcm1CAtY^LNj4%LzXn6dP z+hIkcV~5?BB9G9Zmk=~O;@2VVyNMyg#Yhtpc;Xy_v(Ruz!&0b6Hks=I5Jfy(3ANA@ zkOlyGu1D#-_B&lJpbJNq#c2N?SqVe`9(gT>VzqD#z$OfZT4<2KGXS79*8{K!@mQ_M z-28R{h3A{!7kV^~v4BGDd}W}A&p$S_k_^ED7#YnITS=yX!W`#wh8|t%grV4+(OYm8 zP?!nS%-^s0+`OlN!t-IZXk>2zo!@s}i$*?yp;#?SPyb`&NQ@Sn6{_V3C<*b9LW3SY z18{Y&|L^w-QdE0GKw(C3c0OnHM$!ay;cDaxD2#;F!Z85FbN!FLg;D{9`=ZrDJvy$! zP;6v0E1rPqR;sQNo3Uc>2Ty^S9bpPD-w5p_cJr&;&l^7 zT7OUOij(Aq=MS&Ee}}{wRBd$CDnDBnLUm@=>oGY_PM(Ik%RjhJw56+sWyRF^$Z9!l z){n+V^dIq!DIcV<=$`nP=eXvdq|?$arFL~XcmN^#sfz71nXuQL)9s5Z>|Tg(b;S=Q z{Q~Zn(atqBS}Uj8w3G>haerGo@04{Fb)G;!Z18LM_sUN20jN`nvW%;6 zfe&z(R9I{DinhPCz#UnTH6Sst&Kck}g zD0#4fniz*;1>-dqB|7uAx<#L5I?wQJW+ojE1eI3~*@A*)H*uFk8{KXxU0;=Brtf{{ zR;sDGiHEP)ivqPULfljSJ|dmn*TZ(V>;tLmnd&qc_|-V&R>c&> zUzP3?UwOp;yihe^ow~K2l>c~pc*0FxTH2QbvmZ07D5K5=XAI2bapEAZ7jroY%&GJ8!iSF5Ik?YyT+^#wQSrnAqAgn+H;s|RCz z`rPE@Wr`{4{h)cTTFs57#NvPM_+y-|40ad09bcBY>7lP$53k)m@T=n%2$b!;6= zGwkPeA>oB}_=(40oRJ!9xYGaH?k-B8$KG967h_JMTh zSOPUvw{Z~HctF#%E@a1T+Qm{dG)X`QZlhAzu3jkSx)Vbo5c3c2@URuW$T=v)lfX z-rMC#w96rQHIg_d23mbz&eRQj-A|JV{$>W=N*N{oMq+roWPJ|SPnw!8Ezn)mo5pi3 zqrPKQe||Z0JC1!kYv`GY2ChdfUTS@mRo-x%1Z_#Ch@?WCxltRhm)%V%3C+C_YM1N0 z-357P_Xf-Rs5VYDookS>{XF{F798`ix$BGr? z^6vr|CYHw8My~7)$Qb@9LQ_OqAktV!JK1`#zE*+_#7&-VsZH7vfqR@e^35PhJ9n{t zm9&Lr{J5%x$-CR~)~jy!y9@6X)9AcNx!g@MD!r8aF!H2t%4HXQo4)L?quLHZ7gwyj gzEMiUZ??izbQ#$)evm%<0A^7=iU0rr literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..5bac0316eb5a91b60214d283e613e06abf22c7a6 GIT binary patch literal 777 zcmZQ(U|`^OE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^cD^c^p$CkTBaQgMyX3H?;{F3xq7^k$!`eX=oM$5 + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs new file mode 100644 index 000000000..c7d357bb8 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +// Default Prefs + +/* +$pref::LightManager::sgAtlasMaxDynamicLights = "16"; +$pref::LightManager::sgDynamicShadowDetailSize = "0"; +$pref::LightManager::sgDynamicShadowQuality = "0"; +$pref::LightManager::sgLightingProfileAllowShadows = "1"; +$pref::LightManager::sgLightingProfileQuality = "0"; +$pref::LightManager::sgMaxBestLights = "10"; +$pref::LightManager::sgMultipleDynamicShadows = "1"; +$pref::LightManager::sgShowCacheStats = "0"; +$pref::LightManager::sgUseBloom = ""; +$pref::LightManager::sgUseDRLHighDynamicRange = "0"; +$pref::LightManager::sgUseDynamicRangeLighting = "0"; +$pref::LightManager::sgUseDynamicShadows = "1"; +$pref::LightManager::sgUseToneMapping = ""; +*/ + +//exec( "./shaders.cs" ); +//exec( "./deferredShading.cs" ); + +function onActivateAdvancedLM() +{ + // Enable the offscreen target so that AL will work + // with MSAA back buffers and for HDR rendering. + AL_FormatToken.enable(); + + // Activate Deferred Shading + AL_DeferredShading.enable(); +} + +function onDeactivateAdvancedLM() +{ + // Disable the offscreen render target. + AL_FormatToken.disable(); + + // Deactivate Deferred Shading + AL_DeferredShading.disable(); +} + +function setAdvancedLighting() +{ + setLightManager( "Advanced Lighting" ); +} + diff --git a/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs new file mode 100644 index 000000000..a73598d9b --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs @@ -0,0 +1,276 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +// Vector Light State +new GFXStateBlockData( AL_VectorLightState ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; + blendOp = GFXBlendOpAdd; + + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; // G-buffer + mSamplerNames[0] = "deferredBuffer"; + samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.) + mSamplerNames[1] = "shadowMap"; + samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.) + mSamplerNames[2] = "dynamicShadowMap"; + samplerStates[3] = SamplerClampLinear; // SSAO Mask + mSamplerNames[3] = "ssaoMask"; + samplerStates[4] = SamplerWrapPoint; // Random Direction Map + + cullDefined = true; + cullMode = GFXCullNone; + + stencilDefined = true; + stencilEnable = true; + stencilFailOp = GFXStencilOpKeep; + stencilZFailOp = GFXStencilOpKeep; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpLess; + stencilRef = 0; +}; + +// Vector Light Material +new ShaderData( AL_VectorLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/farFrustumQuadV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/vectorLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/farFrustumQuadV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/vectorLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + samplerNames[1] = "$shadowMap"; + samplerNames[2] = "$dynamicShadowMap"; + samplerNames[3] = "$ssaoMask"; + samplerNames[4] = "$gTapRotationTex"; + samplerNames[5] = "$lightBuffer"; + samplerNames[6] = "$colorBuffer"; + samplerNames[7] = "$matInfoBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_VectorLightMaterial ) +{ + shader = AL_VectorLightShader; + stateBlock = AL_VectorLightState; + + sampler["deferredBuffer"] = "#deferred"; + sampler["shadowMap"] = "$dynamiclight"; + sampler["dynamicShadowMap"] = "$dynamicShadowMap"; + sampler["ssaoMask"] = "#ssaoMask"; + sampler["lightBuffer"] = "#lightinfo"; + sampler["colorBuffer"] = "#color"; + sampler["matInfoBuffer"] = "#matinfo"; + + target = "lightinfo"; + + pixVersion = 3.0; +}; + +//------------------------------------------------------------------------------ + +// Convex-geometry light states +new GFXStateBlockData( AL_ConvexLightState ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; + blendOp = GFXBlendOpAdd; + + zDefined = true; + zEnable = true; + zWriteEnable = false; + zFunc = GFXCmpGreaterEqual; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; // G-buffer + mSamplerNames[0] = "deferredBuffer"; + samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections) + mSamplerNames[1] = "shadowMap"; + samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections) + mSamplerNames[2] = "dynamicShadowMap"; + samplerStates[3] = SamplerClampLinear; // Cookie Map + samplerStates[4] = SamplerWrapPoint; // Random Direction Map + + cullDefined = true; + cullMode = GFXCullCW; + + stencilDefined = true; + stencilEnable = true; + stencilFailOp = GFXStencilOpKeep; + stencilZFailOp = GFXStencilOpKeep; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpLess; + stencilRef = 0; +}; + +// Point Light Material +new ShaderData( AL_PointLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/pointLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + samplerNames[1] = "$shadowMap"; + samplerNames[2] = "$dynamicShadowMap"; + samplerNames[3] = "$cookieMap"; + samplerNames[4] = "$gTapRotationTex"; + samplerNames[5] = "$lightBuffer"; + samplerNames[6] = "$colorBuffer"; + samplerNames[7] = "$matInfoBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_PointLightMaterial ) +{ + shader = AL_PointLightShader; + stateBlock = AL_ConvexLightState; + + sampler["deferredBuffer"] = "#deferred"; + sampler["shadowMap"] = "$dynamiclight"; + sampler["dynamicShadowMap"] = "$dynamicShadowMap"; + sampler["cookieMap"] = "$dynamiclightmask"; + sampler["lightBuffer"] = "#lightinfo"; + sampler["colorBuffer"] = "#color"; + sampler["matInfoBuffer"] = "#matinfo"; + + target = "lightinfo"; + + pixVersion = 3.0; +}; + +// Spot Light Material +new ShaderData( AL_SpotLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/spotLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/spotLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + samplerNames[1] = "$shadowMap"; + samplerNames[2] = "$dynamicShadowMap"; + samplerNames[3] = "$cookieMap"; + samplerNames[4] = "$gTapRotationTex"; + samplerNames[5] = "$lightBuffer"; + samplerNames[6] = "$colorBuffer"; + samplerNames[7] = "$matInfoBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_SpotLightMaterial ) +{ + shader = AL_SpotLightShader; + stateBlock = AL_ConvexLightState; + + sampler["deferredBuffer"] = "#deferred"; + sampler["shadowMap"] = "$dynamiclight"; + sampler["dynamicShadowMap"] = "$dynamicShadowMap"; + sampler["cookieMap"] = "$dynamiclightmask"; + sampler["lightBuffer"] = "#lightinfo"; + sampler["colorBuffer"] = "#color"; + sampler["matInfoBuffer"] = "#matinfo"; + + target = "lightinfo"; + + pixVersion = 3.0; +}; + +/// This material is used for generating deferred +/// materials for objects that do not have materials. +new Material( AL_DefaultDeferredMaterial ) +{ + // We need something in the first pass else it + // won't create a proper material instance. + // + // We use color here because some objects may not + // have texture coords in their vertex format... + // for example like terrain. + // + diffuseColor[0] = "1 1 1 1"; +}; + +/// This material is used for generating shadow +/// materials for objects that do not have materials. +new Material( AL_DefaultShadowMaterial ) +{ + // We need something in the first pass else it + // won't create a proper material instance. + // + // We use color here because some objects may not + // have texture coords in their vertex format... + // for example like terrain. + // + diffuseColor[0] = "1 1 1 1"; + + // This is here mostly for terrain which uses + // this material to create its shadow material. + // + // At sunset/sunrise the sun is looking thru + // backsides of the terrain which often are not + // closed. By changing the material to be double + // sided we avoid holes in the shadowed geometry. + // + doubleSided = true; +}; + +// Particle System Point Light Material +new ShaderData( AL_ParticlePointLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_ParticlePointLightMaterial ) +{ + shader = AL_ParticlePointLightShader; + stateBlock = AL_ConvexLightState; + + sampler["deferredBuffer"] = "#deferred"; + target = "lightinfo"; + + pixVersion = 3.0; +}; diff --git a/Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs new file mode 100644 index 000000000..99be20c5c --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs @@ -0,0 +1,92 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//exec( "./shadowFilter.cs" ); + +singleton GFXStateBlockData( BL_ProjectedShadowSBData ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendDestColor; + blendDest = GFXBlendZero; + + zDefined = true; + zEnable = true; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + vertexColorEnable = true; +}; + +singleton ShaderData( BL_ProjectedShadowShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/projectedShadowV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/projectedShadowP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/projectedShadowV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/projectedShadowP.glsl"; + + samplerNames[0] = "inputTex"; + + pixVersion = 2.0; +}; + +singleton CustomMaterial( BL_ProjectedShadowMaterial ) +{ + sampler["inputTex"] = "$miscbuff"; + + shader = BL_ProjectedShadowShaderData; + stateBlock = BL_ProjectedShadowSBData; + version = 2.0; + forwardLit = true; +}; + +function onActivateBasicLM() +{ + // If HDR is enabled... enable the special format token. + if ( $platform !$= "macos" && HDRPostFx.isEnabled ) + AL_FormatToken.enable(); + + // Create render pass for projected shadow. + new RenderPassManager( BL_ProjectedShadowRPM ); + + // Create the mesh bin and add it to the manager. + %meshBin = new RenderMeshMgr(); + BL_ProjectedShadowRPM.addManager( %meshBin ); + + // Add both to the root group so that it doesn't + // end up in the MissionCleanup instant group. + RootGroup.add( BL_ProjectedShadowRPM ); + RootGroup.add( %meshBin ); +} + +function onDeactivateBasicLM() +{ + // Delete the pass manager which also deletes the bin. + BL_ProjectedShadowRPM.delete(); +} + +function setBasicLighting() +{ + setLightManager( "Basic Lighting" ); +} diff --git a/Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs new file mode 100644 index 000000000..5aea7b607 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs @@ -0,0 +1,76 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +singleton ShaderData( BL_ShadowFilterShaderV ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/basic/shadowFilterV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/basic/shadowFilterP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterP.glsl"; + + samplerNames[0] = "$diffuseMap"; + + defines = "BLUR_DIR=float2(1.0,0.0)"; + + pixVersion = 2.0; +}; + +singleton ShaderData( BL_ShadowFilterShaderH : BL_ShadowFilterShaderV ) +{ + defines = "BLUR_DIR=float2(0.0,1.0)"; +}; + + +singleton GFXStateBlockData( BL_ShadowFilterSB : PFX_DefaultStateBlock ) +{ + colorWriteDefined=true; + colorWriteRed=false; + colorWriteGreen=false; + colorWriteBlue=false; + blendDefined = true; + blendEnable = true; +}; + +// NOTE: This is ONLY used in Basic Lighting, and +// only directly by the ProjectedShadow. It is not +// meant to be manually enabled like other PostEffects. +singleton PostEffect( BL_ShadowFilterPostFx ) +{ + // Blur vertically + shader = BL_ShadowFilterShaderV; + stateBlock = PFX_DefaultStateBlock; + targetClear = "PFXTargetClear_OnDraw"; + targetClearColor = "0 0 0 0"; + texture[0] = "$inTex"; + target = "$outTex"; + + // Blur horizontal + new PostEffect() + { + shader = BL_ShadowFilterShaderH; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + }; +}; diff --git a/Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs b/Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs new file mode 100644 index 000000000..5dbacd2e3 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs @@ -0,0 +1,71 @@ +singleton ShaderData( ClearGBufferShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredClearGBufferP.glsl"; + + pixVersion = 2.0; +}; + +singleton ShaderData( DeferredColorShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredColorShaderP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredColorShaderP.glsl"; + + pixVersion = 2.0; +}; + +// Primary Deferred Shader +new GFXStateBlockData( AL_DeferredShadingState : PFX_DefaultStateBlock ) +{ + cullMode = GFXCullNone; + + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendSrcAlpha; + blendDest = GFXBlendInvSrcAlpha; + + samplersDefined = true; + samplerStates[0] = SamplerWrapLinear; + samplerStates[1] = SamplerWrapLinear; + samplerStates[2] = SamplerWrapLinear; + samplerStates[3] = SamplerWrapLinear; + samplerStates[4] = SamplerWrapLinear; +}; + +new ShaderData( AL_DeferredShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredShadingP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredShadingP.glsl"; + + samplerNames[0] = "colorBufferTex"; + samplerNames[1] = "lightDeferredTex"; + samplerNames[2] = "matInfoTex"; + samplerNames[3] = "deferredTex"; + + pixVersion = 2.0; +}; + +singleton PostEffect( AL_DeferredShading ) +{ + renderTime = "PFXAfterBin"; + renderBin = "SkyBin"; + shader = AL_DeferredShader; + stateBlock = AL_DeferredShadingState; + texture[0] = "#color"; + texture[1] = "#lightinfo"; + texture[2] = "#matinfo"; + texture[3] = "#deferred"; + + target = "$backBuffer"; + renderPriority = 10000; + allowReflectPass = true; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/lighting/scripts/lighting.cs b/Templates/BaseGame/game/core/lighting/scripts/lighting.cs new file mode 100644 index 000000000..b7d4034ff --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/lighting.cs @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +function initLightingSystems(%manager) +{ + echo( "\nInitializing Lighting Systems" ); + + // First exec the scripts for the different light managers + // in the lighting folder. + /*%pattern = "./lighting/*//*init.cs"; + %file = findFirstFile( %pattern ); + if ( %file $= "" ) + { + // Try for DSOs next. + %pattern = "./lighting/*//*init.cs.dso"; + %file = findFirstFile( %pattern ); + } + + while( %file !$= "" ) + { + exec( %file ); + %file = findNextFile( %pattern ); + }*/ + + // Try the perfered one first. + %success = setLightManager(%manager); + + // Did we completely fail to initialize a light manager? + if (!%success) + { + // If we completely failed to initialize a light + // manager then the 3d scene cannot be rendered. + quitWithErrorMessage( "Failed to set a light manager!" ); + } +} + +//--------------------------------------------------------------------------------------------- + +function onLightManagerActivate( %lmName ) +{ + // Call activation callbacks. + %activateNewFn = "onActivate" @ getWord( %lmName, 0 ) @ "LM"; + if( isFunction( %activateNewFn ) ) + eval( %activateNewFn @ "();" ); +} + +//--------------------------------------------------------------------------------------------- + +function onLightManagerDeactivate( %lmName ) +{ + // Call deactivation callback. + %deactivateOldFn = "onDeactivate" @ getWord( %lmName, 0 ) @ "LM"; + if( isFunction( %deactivateOldFn ) ) + eval( %deactivateOldFn @ "();" ); +} diff --git a/Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs b/Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs new file mode 100644 index 000000000..f4875bf08 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +new ShaderData(BlurDepthShader) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterP.glsl"; + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/postFX/Core_PostFX.cs b/Templates/BaseGame/game/core/postFX/Core_PostFX.cs new file mode 100644 index 000000000..d36d912ab --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/Core_PostFX.cs @@ -0,0 +1,33 @@ + +function Core_PostFX::onCreate(%this) +{ + // + exec("./scripts/postFx.cs"); + /*exec("./scripts/postFxManager.gui.cs"); + exec("./scripts/postFxManager.gui.settings.cs"); + exec("./scripts/postFxManager.persistance.cs"); + + exec("./scripts/default.postfxpreset.cs"); + + exec("./scripts/caustics.cs"); + exec("./scripts/chromaticLens.cs"); + exec("./scripts/dof.cs"); + exec("./scripts/edgeAA.cs"); + exec("./scripts/flash.cs"); + exec("./scripts/fog.cs"); + exec("./scripts/fxaa.cs"); + exec("./scripts/GammaPostFX.cs"); + exec("./scripts/glow.cs"); + exec("./scripts/hdr.cs"); + exec("./scripts/lightRay.cs"); + exec("./scripts/MLAA.cs"); + exec("./scripts/MotionBlurFx.cs"); + exec("./scripts/ovrBarrelDistortion.cs"); + exec("./scripts/ssao.cs"); + exec("./scripts/turbulence.cs"); + exec("./scripts/vignette.cs");*/ +} + +function Core_PostFX::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/Core_PostFX.module b/Templates/BaseGame/game/core/postFX/Core_PostFX.module new file mode 100644 index 000000000..627a32d94 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/Core_PostFX.module @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/guis/postFxManager.gui b/Templates/BaseGame/game/core/postFX/guis/postFxManager.gui new file mode 100644 index 000000000..6a704eb65 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/guis/postFxManager.gui @@ -0,0 +1,2755 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(PostFXManager) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiModelessDialogProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new DbgFileView() { + position = "0 0"; + extent = "8 2"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiWindowCtrl(ppOptionsWindow) { + text = "PostFX Manager"; + resizeWidth = "0"; + resizeHeight = "0"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(PostFXManager);"; + edgeSnap = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "306 216"; + extent = "411 336"; + minExtent = "8 8"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "11 77"; + extent = "390 216"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTabBookCtrl(ppOptionsTabBook) { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "32"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "1"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "11 58"; + extent = "394 233"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsSSAOTab) { + fitBook = "0"; + text = "SSAO"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Screen Space Ambient Occlusion postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "12 30"; + extent = "365 170"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "1"; + }; + new GuiTabBookCtrl(ppOptionsSSAOOptions) { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "64"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "2"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 11"; + extent = "362 185"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsSSAOGeneralTab) { + fitBook = "0"; + text = "General"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "362 165"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains general overall settings for the SSAO postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl(ppOptionsSSAOOverallStrengthLabel) { + text = "Overall Strength"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "31 57"; + extent = "77 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the overall strength of the Ambient Occlusion effect."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOBlurDepthLabel) { + text = "Blur (Softness)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "38 85"; + extent = "73 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the amount of softness in the SSAO, overall."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOBlurNormalLabel) { + text = "Blur (Normal Maps)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "19 112"; + extent = "92 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the amount of softness in the SSAO, in the normal maps."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrl(ppOptionsSSAOQuality) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + text = "Low"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "120 28"; + extent = "211 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiPopUpMenuProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOQualityLabel) { + text = "Quality"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "76 29"; + extent = "32 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOOverallStrength) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "120 56"; + extent = "211 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOBlurDepth) { + range = "0 0.3"; + ticks = "1000"; + snap = "0"; + value = "0.001"; + position = "120 86"; + extent = "211 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOBlurNormal) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.95"; + position = "119 113"; + extent = "212 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsSSAONearTab) { + fitBook = "0"; + text = "Near"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "362 165"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings for the near range ambient occlusion aspect of the SSAO postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsSSAONearRadius) { + range = "0.001 5"; + ticks = "1000"; + snap = "0"; + value = "0.1"; + position = "122 17"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearDepthMin) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.1"; + position = "122 62"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearStrength) { + range = "0 20"; + ticks = "1000"; + snap = "0"; + value = "6"; + position = "122 39"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearRadiusLabel) { + text = "Radius"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "80 16"; + extent = "34 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO reach."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearStrengthLabel) { + text = "Strength"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "73 38"; + extent = "41 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO strength."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearDepthMinLabel) { + text = "Depth Min"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "66 61"; + extent = "48 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO minimum depth value."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearDepthMaxLabel) { + text = "Depth Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "62 85"; + extent = "52 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO maximum depth value."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearDepthMax) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "1"; + position = "122 86"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearToleranceNormal) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "122 133"; + extent = "103 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearTolerancePower) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "1"; + position = "246 133"; + extent = "97 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearToleranceLabel2) { + text = "Tolerance / Power"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "24 132"; + extent = "92 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearToleranceLabel1) { + text = "Normal Maps : "; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "19 113"; + extent = "71 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsSSAOFarTab) { + fitBook = "0"; + text = "Far"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "362 165"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings for the far range ambient occlusion aspect of the SSAO postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl(ppOptionsSSAOFarRadiusLabel) { + text = "Radius"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "80 16"; + extent = "34 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO reach."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarRadius) { + range = "0.001 5"; + ticks = "1000"; + snap = "0"; + value = "1"; + position = "122 17"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarStrengthLabel) { + text = "Strength"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "73 38"; + extent = "41 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO strength."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarStrength) { + range = "0 20"; + ticks = "1000"; + snap = "0"; + value = "10"; + position = "122 39"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarDepthMinLabel) { + text = "Depth Min"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "66 61"; + extent = "48 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO minimum depth."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarDepthMin) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.2"; + position = "122 62"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarDepthMaxLabel) { + text = "Depth Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "62 85"; + extent = "52 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO maximum."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarDepthMax) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "122 86"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarToleranceLabel1) { + text = "Normal Maps :"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "6 113"; + extent = "72 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Tolerance / Power"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "24 132"; + extent = "90 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarToleranceNormal) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "122 133"; + extent = "100 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarTolerancePower) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "239 133"; + extent = "104 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiCheckBoxCtrl(ppOptionsEnableSSAO) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the SSAO postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsHDRTab) { + fitBook = "0"; + text = "HDR"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the High Definition Range Lighting postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "12 30"; + extent = "363 172"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "1"; + }; + new GuiTabBookCtrl(ppOptionsHDROptions) { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "64"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "0"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 11"; + extent = "365 195"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsHDRBrightnessTab) { + fitBook = "0"; + text = "Brightness"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "365 175"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the brightness of the HDR postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsHDRMinLuminance) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "132 77"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRKeyValue) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.0459184"; + position = "132 50"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.0459184"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRKeyValueLabel) { + text = "Key Value"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "69 50"; + extent = "52 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The tone mapping middle grey or exposure value used to adjust the overall \"balance\" of the image."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRMinLuminanceLabel) { + text = "Minimum Luminance"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "25 77"; + extent = "96 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The minimum luminance value to allow when tone mapping the scene. This is particularly useful if your scene is very dark or has a black ambient color in places."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRWhiteCutoffLabel) { + text = "White Cutoff"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "56 104"; + extent = "65 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The cutoff level for the white levels in the brightness."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRWhiteCutoff) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.52551"; + position = "132 104"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.52551"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBrightnessAdaptRate) { + range = "0.1 10"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "132 132"; + extent = "205 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBrightnessAdaptRateLabel) { + text = "Brightness Adapt Rate"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 132"; + extent = "109 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The speed at which the view adjusts to the new lighting in the environment."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRKeyValueLabel1) { + text = "Tone Mapping Contrast"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "10 24"; + extent = "111 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Tone mapping contrast is the amount of scene to blend, with the tone mapped HDR scene. Lower values are recommended but higher values give a strong contrasted darker shadowed look."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRToneMappingAmount) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.265306"; + position = "132 24"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "value : 0.265306"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsHDRBloomTab) { + fitBook = "0"; + text = "Bloom"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "365 175"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the blooming aspect of the HDR postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsHDRBloomBlurMultiplier) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.502645"; + position = "132 70"; + extent = "199 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.502645"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBloomBlurMean) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.510526"; + position = "132 97"; + extent = "200 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.510526"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBloomBlurStdDev) { + range = "0 3"; + ticks = "1000"; + snap = "0"; + value = "1.4127"; + position = "132 123"; + extent = "199 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 1.4127"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBlurMultiplierLabel) { + text = "Blur Multiplier"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "59 70"; + extent = "63 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The amount of blur to apply to the bloomed areas in the HDR."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBlurMeanLabel) { + text = "Blur \"mean\" value"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "38 97"; + extent = "84 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBlurStandardDevianceLabel) { + text = "Blur \"Std Dev\" value"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "23 123"; + extent = "99 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBloomBrightPassThresholdLabel) { + text = "Bright pass threshold"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "19 43"; + extent = "103 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The bright pass threshold controls how bright the brightest areas of the scene are in the HDR."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBloomBlurBrightPassThreshold) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "1.60526"; + position = "132 43"; + extent = "200 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 1.60526"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsHDRBloom) { + useInactiveState = "0"; + text = " Enable Bloom"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "250 9"; + extent = "85 24"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enables or disables the bloom (glowing effect) of the HDR PostFX."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsHDRBloomEffectsTab) { + fitBook = "0"; + text = "Effects"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "365 175"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the effects the HDR postFX can offer"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiCheckBoxCtrl(ppOptionsHDREffectsBlueShift) { + useInactiveState = "0"; + text = " Enable Color Shift"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "11 4"; + extent = "117 24"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enables a scene tinting/Blue shift based on the color selected below."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiColorPickerCtrl(ppOptionsHDREffectsBlueShiftColorBlend) { + baseColor = "1 0 0.0235294 1"; + pickColor = "0 0 0 1"; + selectorGap = "1"; + displayMode = "BlendColor"; + actionOnMove = "1"; + showReticle = "1"; + position = "10 29"; + extent = "344 110"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Select a color"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiColorPickerCtrl(ppOptionsHDREffectsBlueShiftColorBaseColor) { + baseColor = "1 0 0.0235294 1"; + pickColor = "0 0 0 1"; + selectorGap = "1"; + displayMode = "HorizColor"; + actionOnMove = "1"; + showReticle = "1"; + position = "10 142"; + extent = "343 21"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Select a color"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiCheckBoxCtrl(ppOptionsHDRToneMapping) { + useInactiveState = "0"; + text = " Enable Tone Mapping"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "18 8"; + extent = "120 24"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enables or disabled tone mapping on the HDR. The tone mapping balanced the brightness levels during the HDR process. Recommended"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnableHDR) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the HDR postFX (takes some time to initialise, be patient)"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnableHDRDebug) { + useInactiveState = "0"; + text = "Debug"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "262 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsLightRaysTab) { + fitBook = "0"; + text = "Light Rays"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Light Rays postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsLightRaysBrightScalar) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.75"; + position = "96 46"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsLightRaysBrightnessScalarLabel) { + text = "Brightness"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 48"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls how bright the rays and the object casting them are in the scene."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiSliderCtrl(ppOptionsLightRaysSampleScalar) { + range = "20 512"; + ticks = "512"; + snap = "0"; + value = "40"; + position = "96 75"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysSampleScalarLabel) { + text = "Samples"; + maxLength = "512"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 76"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the number of samples for the shader."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiSliderCtrl(ppOptionsLightRaysDensityScalar) { + range = "0.01 1"; + ticks = "1000"; + snap = "0"; + value = "0.94"; + position = "96 105"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysDensityScalarLabel) { + text = "Density"; + maxLength = "1000"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 106"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the density of the rays."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiSliderCtrl(ppOptionsLightRaysWeightScalar) { + range = "0.1 10"; + ticks = "1000"; + snap = "0"; + value = "5.65"; + position = "96 135"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysWeightScalarLabel) { + text = "Weight"; + maxLength = "1000"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 136"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the weight of the rays."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + + new GuiSliderCtrl(ppOptionsLightRaysDecayScalar) { + range = "0.01 1"; + ticks = "1000"; + snap = "0"; + value = "1.0"; + position = "96 165"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysDecayScalarLabel) { + text = "Decay"; + maxLength = "1000"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 166"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the decay of the rays."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnableLightRays) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the light rays postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsDOFTab) { + fitBook = "0"; + text = "DOF"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Depth Of Field postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "14 28"; + extent = "362 170"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "1"; + }; + new GuiTabBookCtrl() { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "64"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "1"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "14 9"; + extent = "360 189"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsDOFGeneralTab) { + fitBook = "0"; + text = "General"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "360 169"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains general settings related to the DOF system"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + //new GuiCheckBoxCtrl(ppOptionsDOFEnableDOF) { + //useInactiveState = "0"; + //text = "Enable DOF"; + //groupNum = "-1"; + //buttonType = "ToggleButton"; + //useMouseEvents = "0"; + //position = "31 43"; + //extent = "140 30"; + //minExtent = "8 2"; + //horizSizing = "right"; + //vertSizing = "bottom"; + //profile = "GuiCheckBoxProfile"; + //visible = "1"; + //active = "1"; + //tooltipProfile = "GuiToolTipProfile"; + //hovertime = "1000"; + //isContainer = "0"; + //canSave = "1"; + //canSaveDynamicFields = "0"; + //}; + new GuiCheckBoxCtrl(ppOptionsDOFEnableAutoFocus) { + useInactiveState = "0"; + text = "Enable Auto Focus"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "31 8"; + extent = "140 30"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsDOFAutoFocusTab) { + fitBook = "0"; + text = "Auto Focus"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "360 169"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the fine control of the auto focus system"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl(ppOptionsDOFNearBlurMaxLabel) { + text = "Near Blur Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "36 8"; + extent = "67 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The max allowed value of near blur"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFarBlurMinSlider) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "120 8"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFFarBlurMaxLabel) { + text = "Far Blur Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "43 34"; + extent = "60 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The max allowed value of far blur"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFarBlurMaxSlider) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "120 34"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFFocusRangeMinLabel) { + text = "Focus Range (Min)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "13 61"; + extent = "90 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The distance range around the focal distance that remains in focus (in meters, minimum distance in focus) focal distance it is\r\ndependant on the visible distance set in your level"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFocusRangeMinSlider) { + range = "0.01 1e+003"; + ticks = "1000"; + snap = "0"; + value = "0.01"; + position = "120 61"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFFocusRangeMaxLabel) { + text = "Focus Range (Max)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 88"; + extent = "95 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The distance range around the focal distance that remains in focus (in meters, maximum distance in focus) focal distance it is\r\ndependant on the visible distance set in your level"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFocusRangeMaxSlider) { + range = "0.01 1e+003"; + ticks = "1000"; + snap = "0"; + value = "0.01"; + position = "119 87"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFBurCurveNearLabel) { + text = "Blur Curve Near"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "27 114"; + extent = "77 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "A small number causes bluriness to increase gradually\r\nat distances closer than the focal distance. A large number causes bluriness to \r\nincrease quickly"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFBlurCurveNearSlider) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "119 114"; + extent = "225 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFBlurCurveFarLabel) { + text = "Blur Curve Far"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "33 139"; + extent = "70 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "A small number causes bluriness to increase gradually\r\nat distances closer than the focal distance. A large number causes bluriness to \r\nincrease quickly"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFBlurCurveFarSlider) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "119 141"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiCheckBoxCtrl(ppOptionsEnableDOF) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the Depth of field postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsVignetteTab) { + fitBook = "0"; + text = "Vignette"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 40"; + extent = "394 193"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Vignette postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + Enabled = "1"; + + new GuiCheckBoxCtrl(ppOptionsEnableVignette) { + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the vignette postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsVignetteVMax) { + range = "0.001 5"; + ticks = "1000"; + snap = "0"; + value = "0.6"; + position = "96 46"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + variable = "$VignettePostEffect::VMax"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsVignetteVMaxLabel) { + text = "Radius"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 48"; + extent = "41 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the maximum exposure of vignetting."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl() { + fitBook = "0"; + text = "Color Correction"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "8 27"; + extent = "376 200"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "ColorCorrectionTab"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Color Correction Ramp"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "6 7"; + extent = "118 13"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + text = "core/postFX/images/null_color_ramp.png"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "6 29"; + extent = "365 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + altCommand = "ppColorCorrection_selectFileHandler( $thisControl.getText() );"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "ColorCorrectionFileName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select..."; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "252 54"; + extent = "56 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ppColorCorrection_selectFile();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ColorCorrectionButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Reset"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "315 54"; + extent = "56 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ppColorCorrection_selectFileHandler( \"\" );"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ColorCorrectionReset"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiButtonCtrl(ppOptionsApply) { + text = "Apply"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "309 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "PostFXManager.settingsApplyAll(); Canvas.popDialog(PostFXManager);"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Apply the settings and close this dialog"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ppOptionsSavePreset) { + text = "Save Preset..."; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "111 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "PostFXManager.savePresetFile();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Save the preset to a file to disk for later use (use postfx::applyPreset)"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ppOptionsLoadPreset) { + text = "Load Preset..."; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "12 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "PostFXManager.loadPresetFile();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Load a post FX preset file from disk"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnable) { + useInactiveState = "0"; + text = "Enable PostFX System"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "13 24"; + extent = "127 30"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable or Disable the postFX system"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrl(ppOptionsQuality) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "278 30"; + extent = "122 21"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiPopUpMenuProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Used to adjust the quality/performance settings of the PostFX system. Some PostFX may not adhere to the settings in this dialog."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsQualityLabel) { + text = "Quality"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "238 32"; + extent = "39 12"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Used to adjust the quality/performance settings of the PostFX system. Some PostFX may not adhere to the settings in this dialog."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ppOptionsOk1) { + text = "Revert"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "210 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "postProcessOptionsDlg.applySettings(); Canvas.popDialog(postProcessOptionsDlg);"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Revert any changes made since opening the dialog"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/core/postFX/images/AreaMap33.dds b/Templates/BaseGame/game/core/postFX/images/AreaMap33.dds new file mode 100644 index 0000000000000000000000000000000000000000..e01982a94528594a375ae6e61c44780a8e1c0b68 GIT binary patch literal 109028 zcmeI5iFZ_0wuhNfX$3`^L4AY}f-Hm>Xh5K`9}tMZLI^Ab84N>Ylu2fN|IYh6-}}Bw zcDP(BWU8uj2UP(;v<48Z{Gf$v}=tOI*XXYs`_r*&BzL4@;I&oE;IoO1@@ z-_Q@=g7eNAu(w_h~o^*6)9TxpEUY z?^wgX0B4?$V9x2XID)9=v0h?^AFEw~GvMcp*6%&g2j)umhN6bsTRQWo%Q^MgcyR;~ z&0`sgdoT>nIrfx?z`aWMg(6ov?^wfEf&cqtXCC)1=Zr3kBZy`m%TW9Q*Weehr}Q(O z1K_L^xzfF%Z(t3$Kjh3ar*v5yK}7RduQ202xJP*bPJw$u*6$x+2W$oZ_ZeN_=Z>qv z-qM-JS=>GK_dZ`1M-at4mZ5k6H{c?;cYX}4-}}K?XFF^GbEWf6)Np%CXP!Bs%i;(k zna7Gyj9|_sI1Bca17Q7j*6D}HmF^8i4R?RY-cntTDmLiQJyJOVZO8#w3KQ@ST~5Uk(3 z;d_W&+0Aj(@PBe_Zy7U>dqnT0E{h|GTplYz;b%F+a2`&>aX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{n9pt}`DrhhDY^>y4aZKoe<9H%{|r zK9l(=S}$9guHb|EEO~vTgeEsd-))phvlrfhvyc8wy@s@`l?YTStu|?^ltTW`e{YnT ze%C-Uvj%HWe)Mx59rI`ua#WCt>|Oj|kUocONkX>xFQeSi+bmmWsui-x;DD3$qQ|`t zj|+kiz&P|tTd>(<%C>YT61+3mOM-=}EHk8iFZ{u1I!Bc@;<*I*1{QMvPXOdpdLhf_ zQe#j7=An=F^6AE@B~`fPo(?DehjuVqkZ;PxhnZ{OLDSfeu3#_K1p`Aj*s{N4Y4{ z!Vgv1zJ2Bjd#gAhevIGrZ=#E)VAG5h=KdYzV5QXMl30nQY1b;`M={Kt($ZnIP4?Q4 z^#HPE55#6xuH@fDLh#b5n26`qXHkXWKL(8#uAdw-*r!UfahzaO7fKhawG4TQiHV!Q zc3brQ^Kww4V_(mc!xQ5+=;3Z&+s!JbMt{tC?PZ3mB$xg_rge$j7%KneTdQ2v7dh5U z6Q*s?&k>5`DV3&P93=JZWzRxZw-IFhehInIP~D$XDW-KqUO$)R)~Z-K$xG{4B@FE% zFCR>V()tJg6J#phqAh$Sb7;|f5wHQg_$cedz#H@hg({hs-; z_*3YUg*@kswbl*&a|M9owN#|nX$w%n+6vy~IJ3^3%`IIj?oN2+_y^Wn@VntaP}lFe z&0k-M(GzHl=SYO1eK&6z=AcxyG>A|ipMz7QxcyRMoIiRFg|7aJx^_ft9$#yL@azb0 RBF+E+002ovPDHLkV1nj@91s8i literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/caustics_2.png b/Templates/BaseGame/game/core/postFX/images/caustics_2.png new file mode 100644 index 0000000000000000000000000000000000000000..99097fa0ed112c28958363f2951478a0955218ec GIT binary patch literal 33963 zcmXt91yGw^(+y53?yfEF?$Dy8g%+3M!L7Kv7cIrzrC6ZAi$fsA-5r9v75D$?H}i+d z1Tq8M+}(Tk>^Wz@e^F7u!XU>0fk0Rv6lK*wAOzrB1Q0qZ@S^WrW&ymQntoJ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|KOW%7)>j`?}7n3P}%v zvX>+j12{er{fgeCFBt`b*p?tm>?;*L#%mhG-9|{+^^i z*kZ!NfoFjweR|iAm`4CYuH2oX=uKn6!#$`Tlo2m+vdXn?zyT5*Wc4wWtNhZ&lwRTi zty0lQ*g0ypk7FMD+a(;N+D%`ALqRBVb=R|wFuwBfuKofSq|61>6|gCJlo5meX>mU)oM1L=X=D0pK~g%Rj*Ee8CdEMjQ*? zEb*y46&I=j%MTK}-Fugso}?zYZak*Fh&jFFg>q8;VCG)>@d};1@yMJ#Msun!mnt*H zT}_U`Jcu?`IY)=rYdQq?hB)c#$^4fcIX>A8JO`n9Unb!k-KfpL>t?_6vRD~ty zI`z^`%QC1ps2GHdxeR1u`OES?&b#->z-&qrb9|)p*W2^vQ3x&8)0}QDQ_2s6c`q%d z2?{OHd-8q3L_1nAcsKKVaD`@nLdoLUvJtrn$ni7}{15!@``@5(`}uS!^hUcA>8twJ zKyCH!rfv43R%KZkPmh>PYpHyl)5*a$t~upzVimJ|Y95SKIW`K_{pZf%{~3LLL%xlU&$iTp;`M%rCDs{K4s{ zreRM&rh^Sz1dfj{(X%-qoY6kadboymM_%SabQ#?(#)R)tHBrbU^nq}{>?}Srq;jcz z{Au-Z8@0JYkvcPblir5GY|9c) zT0hc)Q89O(Jz`07Vj(OrOx(a|8f~!;rq3jcFK|ns9|1Pbv%o0x`>vSasOW}5*ZNkx wPx6^^W}6!C?24m_)Od^3pro&j&sU!PHBsYjs7~_SLBQ81DMiWhkA{K&2MO=rQ2+n{ literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/inactive-overlay.png b/Templates/BaseGame/game/core/postFX/images/inactive-overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..feab83209cc442c5ad8dc73c2b86e0a8115c4743 GIT binary patch literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!foRZkbkkcwMLfBw9D?8~Obq{gPz9LVg>D`Q%4bP0l+XkKL$W0) literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/materials.cs b/Templates/BaseGame/game/core/postFX/images/materials.cs new file mode 100644 index 000000000..a13c751b3 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/images/materials.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton Material( Empty ) +{ +}; + +singleton Material(WarningMaterial) { + detailMap[0] = "missingTexture"; + diffuseColor[0] = "25 16 0"; + emissive[0] = false; + translucent = false; +}; diff --git a/Templates/BaseGame/game/core/postFX/images/missingTexture.png b/Templates/BaseGame/game/core/postFX/images/missingTexture.png new file mode 100644 index 0000000000000000000000000000000000000000..80a7874da967ad523e1a3308f3f14c66d4eed503 GIT binary patch literal 10645 zcmeHt_g_=nv-S>MP*4G}5D zE)M{}2HO)>E&w0_UP=IR;uB`OWifby#JJe}1(b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U--%{!8dPDyfZ$B+jmbuWZ*~W9SahKoUJfS48r_O16++l zPnwwTM`-Va%1V@TU+ zP0V{%%ak@JhD%RlFxs3fKQVtGntklu5JR@I>BQih3;N+y-OT>dj|Cb{-#| z?523~R>r$aP-M+oPPsmYRsteh@=%n!ul6w~uAaJ$Yk0g`l?ijCxzlY3<(@e(Pkt4z zyw+#U{s!vkMzGrS1@)#Cuy^wnj!C`24-rlRt2Ly3sXjX=ZsjhQU)uZ>J(3=xOl(0QP-!(>N?>&;S4c07*qo IM6N<$f@#CI-2eap literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/null_color_ramp.png b/Templates/BaseGame/game/core/postFX/images/null_color_ramp.png new file mode 100644 index 0000000000000000000000000000000000000000..5f5a52186eb93cb7ace739e645e5e8f8e6b8050d GIT binary patch literal 2843 zcmV+$3*_{PP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya?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Sy=myMHyK(5^%z(IWdVRrqI^$#4Jufh}r7;tVh`hUNG;s~_bzySc0 z|2hW5$Kd$Cy=TJg`b+=%tN+vS|NgB0^X2{P-~adH{|{Hy`p@%mNe l814Vh^#9YDKE&YBKxnPL?nJ&?puN6t$_nc8<+5fW{|kT=cUJ%a literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/warnMat.dds b/Templates/BaseGame/game/core/postFX/images/warnMat.dds new file mode 100644 index 0000000000000000000000000000000000000000..ea99dcbd74a8b2ae49c5cff5a69743498a66e937 GIT binary patch literal 699192 zcmeFaPi$M+p67Q(#Rw%q$lVCxuCM)|w4M~V{T2fJ7L9l5=?1EHs%~9T&ZsR?vxyfI zsJbygxsX^C8(DbKi&_Xl?Ia2f*klZ%fGCLvqZVm(77oyhDio(NUSwqH4PbCKf$})> zK(x$!f9LR!6h(@c5=l|gmq67qMe^Qr&pE%(@6Y+2bN=K{{@nQ=Ez9~Z?NQ76FYpif z&kD-_tTFX}|NnFFRr&d!EYAO`*{_1Od*;t>$tlSnS+X5C4k!oY069PokOSlZIY17O z1LOcXKn{=tbP?mEh4x0G{HM%>a}6jFwRD81ID`aV8azt6j+Y!2Ta>0>S?>#-q__zuK?WeVjr#I665w zc~jc8`_Ccz-TFrP=kceWh4zA)_i}DHIFIpvT8|g^R&40;d^w{^DEb86pH#|nIj!D{ z{+GX(_fn&(Or@-j%Fn4+>igz8<&wJIGA_I#_cx_i{%m~+2gfRQf;E=cc8V3)>3%zr zuifA)`-S6ZkjGJY9o)l9`78O82bwo~6|QOCm8-n#-us*zQ+|)~w*o`s*IiDa|1GHh zsL>y)9Z$+>;d-$L?I+i5)-U2WLj6h6oWt{TUZF(&Gsybq zx^w@!*Wc)W;mKYmJuSRRk6Ma%aBr;bP)x-)ds7xtZYdF(oDe@o@p|a`wr9*<#Y@`p zq`a5WdSf)8+bx~yP5Y(JT-P~H+*18t)%QUw{*9W4{|0`&vBz{gzNq~8s-EAI@g5Fl zQln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jVMf^(Qk`^!2m+>!gr-*9-el_?uI6;eWLJ&7_UjBpkyw8A>!8ii% z9u6YoNf3^RaUpTDi{#!~IV|Vj;9oG#Nyp)oiD!?vn^Kr@Sd-}>6+3qe}jMqp3N6++&s+J;~<6HKw*8kLF;`SRp7$?*90Q@WPpH8Rm;WaXD1l2dO zzs=?MsB&1&Kll!kf8f(403)Xu&*OQiH1R5rLSZ%kckeDA|Fjp$!Hnn!`=7WnT7ODB zAEt?2<9RfNOy*=c$hcyImreT{2xz>Vr!oH7kD7lY?>h0>vJ2zjj_Kd!{1ZQq@=`V8 zMHqe8?B!GIW3dy!Pr*1+FJT^N zb-$bPYwmV!r+RkN4$aqk_Q-v$C!wE*5#9;=r{<_q!s_4|E zbJf7%56~YGRo-)exIt>q$QQF$albbaS5=%({m#2vh-0Rro)Mb5+BCt z+S}pl&A@R+oTy*^KF$4MAn92=uWW+_Whs_Gc^>ga54_&J+q6(sq0( zVY^r6&!XSz&aprT^al1kMtv%;zYgGk=Gz6wGwjM%^POQ?{^JD~UovJw108=HRI0jp z;G1jzz+Q&>-@Gx7`_R_VS2vJ9z8~KyJ66{JNb-NE{}<7I$#?(pI(G@(;;L#rqAq+3 z`xfeVQdh2^9|rK5pE!#}H(MyEs=xP3H9bu}Q_gvmJ9nu~a2Sn!27e2BVQ7ck6R+_! raGdj4Z)`w+6{m>%2LJK#4dUl7PN}gm$ggc?divbC*=z9`o}2kEfiE*! literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/scripts/GammaPostFX.cs b/Templates/BaseGame/game/core/postFX/scripts/GammaPostFX.cs new file mode 100644 index 000000000..293d44714 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/GammaPostFX.cs @@ -0,0 +1,73 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( GammaShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gammaP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/gammaP.glsl"; + + samplerNames[0] = "$backBuffer"; + samplerNames[1] = "$colorCorrectionTex"; + + pixVersion = 2.0; +}; + +singleton GFXStateBlockData( GammaStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton PostEffect( GammaPostFX ) +{ + isEnabled = true; + allowReflectPass = true; + + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 9998; + + shader = GammaShader; + stateBlock = GammaStateBlock; + + texture[0] = "$backBuffer"; + texture[1] = $HDRPostFX::colorCorrectionRamp; + textureSRGB[1] = true; +}; + +function GammaPostFX::preProcess( %this ) +{ + if ( %this.texture[1] !$= $HDRPostFX::colorCorrectionRamp ) + %this.setTexture( 1, $HDRPostFX::colorCorrectionRamp ); +} + +function GammaPostFX::setShaderConsts( %this ) +{ + %clampedGamma = mClamp( $pref::Video::Gamma, 2.0, 2.5); + %this.setShaderConst( "$OneOverGamma", 1 / %clampedGamma ); + %this.setShaderConst( "$Brightness", $pref::Video::Brightness ); + %this.setShaderConst( "$Contrast", $pref::Video::Contrast ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/MLAA.cs b/Templates/BaseGame/game/core/postFX/scripts/MLAA.cs new file mode 100644 index 000000000..491c98e4e --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/MLAA.cs @@ -0,0 +1,186 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +// NOTE: This is currently disabled in favor of FXAA. See +// core\scripts\client\canvas.cs if you want to re-enable it. + +singleton GFXStateBlockData( MLAA_EdgeDetectStateBlock : PFX_DefaultStateBlock ) +{ + // Mark the edge pixels in stencil. + stencilDefined = true; + stencilEnable = true; + stencilPassOp = GFXStencilOpReplace; + stencilFunc = GFXCmpAlways; + stencilRef = 1; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton ShaderData( MLAA_EdgeDetectionShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/offsetV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/edgeDetectionP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/offsetV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/edgeDetectionP.glsl"; + + samplerNames[0] = "$colorMapG"; + samplerNames[1] = "$deferredMap"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( MLAA_BlendWeightCalculationStateBlock : PFX_DefaultStateBlock ) +{ + // Here we want to process only marked pixels. + stencilDefined = true; + stencilEnable = true; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpEqual; + stencilRef = 1; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampPoint; +}; + +singleton ShaderData( MLAA_BlendWeightCalculationShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/passthruV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/blendWeightCalculationP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/passthruV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/blendWeightCalculationP.glsl"; + + samplerNames[0] = "$edgesMap"; + samplerNames[1] = "$edgesMapL"; + samplerNames[2] = "$areaMap"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( MLAA_NeighborhoodBlendingStateBlock : PFX_DefaultStateBlock ) +{ + // Here we want to process only marked pixels too. + stencilDefined = true; + stencilEnable = true; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpEqual; + stencilRef = 1; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampPoint; +}; + +singleton ShaderData( MLAA_NeighborhoodBlendingShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/offsetV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/neighborhoodBlendingP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/offsetV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/neighborhoodBlendingP.glsl"; + + samplerNames[0] = "$blendMap"; + samplerNames[1] = "$colorMapL"; + samplerNames[2] = "$colorMap"; + + pixVersion = 3.0; +}; + + +singleton PostEffect( MLAAFx ) +{ + isEnabled = false; + + allowReflectPass = false; + renderTime = "PFXAfterDiffuse"; + + texture[0] = "$backBuffer"; //colorMapG + texture[1] = "#deferred"; // Used for depth detection + + target = "$outTex"; + targetClear = PFXTargetClear_OnDraw; + targetClearColor = "0 0 0 0"; + + stateBlock = MLAA_EdgeDetectStateBlock; + shader = MLAA_EdgeDetectionShader; + + // The luma calculation weights which can be user adjustable + // per-scene if nessasary. The default value of... + // + // 0.2126 0.7152 0.0722 + // + // ... is the HDTV ITU-R Recommendation BT. 709. + lumaCoefficients = "0.2126 0.7152 0.0722"; + + // The tweakable color threshold used to select + // the range of edge pixels to blend. + threshold = 0.1; + + // The depth delta threshold used to select + // the range of edge pixels to blend. + depthThreshold = 0.01; + + new PostEffect() + { + internalName = "blendingWeightsCalculation"; + + target = "$outTex"; + targetClear = PFXTargetClear_OnDraw; + + shader = MLAA_BlendWeightCalculationShader; + stateBlock = MLAA_BlendWeightCalculationStateBlock; + + texture[0] = "$inTex"; // Edges mask + texture[1] = "$inTex"; // Edges mask + texture[2] = "core/postFX/images/AreaMap33.dds"; + }; + + new PostEffect() + { + internalName = "neighborhoodBlending"; + + shader = MLAA_NeighborhoodBlendingShader; + stateBlock = MLAA_NeighborhoodBlendingStateBlock; + + texture[0] = "$inTex"; // Blend weights + texture[1] = "$backBuffer"; + texture[2] = "$backBuffer"; + }; +}; + +function MLAAFx::setShaderConsts(%this) +{ + %this.setShaderConst("$lumaCoefficients", %this.lumaCoefficients); + %this.setShaderConst("$threshold", %this.threshold); + %this.setShaderConst("$depthThreshold", %this.depthThreshold); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/MotionBlurFx.cs b/Templates/BaseGame/game/core/postFX/scripts/MotionBlurFx.cs new file mode 100644 index 000000000..6919cc5a7 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/MotionBlurFx.cs @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( PFX_MotionBlurShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; //we use the bare-bones postFxV.hlsl + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/motionBlurP.hlsl"; //new pixel shader + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/motionBlurP.glsl"; + + samplerNames[0] = "$backBuffer"; + samplerNames[1] = "$deferredTex"; + + pixVersion = 3.0; +}; + +singleton PostEffect(MotionBlurFX) +{ + isEnabled = false; + + renderTime = "PFXAfterDiffuse"; + + shader = PFX_MotionBlurShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backbuffer"; + texture[1] = "#deferred"; + target = "$backBuffer"; +}; + +function MotionBlurFX::setShaderConsts(%this) +{ + %this.setShaderConst( "$velocityMultiplier", 3000 ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/caustics.cs b/Templates/BaseGame/game/core/postFX/scripts/caustics.cs new file mode 100644 index 000000000..7dcea20a5 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/caustics.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( PFX_CausticsStateBlock : PFX_DefaultStateBlock ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerWrapLinear; + samplerStates[2] = SamplerWrapLinear; +}; + +singleton ShaderData( PFX_CausticsShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/causticsP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/gl/causticsP.glsl"; + + samplerNames[0] = "$deferredTex"; + samplerNames[1] = "$causticsTex0"; + samplerNames[2] = "$causticsTex1"; + + pixVersion = 3.0; +}; + +singleton PostEffect( CausticsPFX ) +{ + isEnabled = false; + renderTime = "PFXAfterDiffuse"; + renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + + shader = PFX_CausticsShader; + stateBlock = PFX_CausticsStateBlock; + texture[0] = "#deferred"; + texture[1] = "core/postFX/images/caustics_1"; + texture[2] = "core/postFX/images/caustics_2"; + target = "$backBuffer"; +}; diff --git a/Templates/BaseGame/game/core/postFX/scripts/chromaticLens.cs b/Templates/BaseGame/game/core/postFX/scripts/chromaticLens.cs new file mode 100644 index 000000000..06b8d3988 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/chromaticLens.cs @@ -0,0 +1,77 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// +$CAPostFx::enabled = false; + +/// The lens distortion coefficient. +$CAPostFx::distCoeffecient = -0.05; + +/// The cubic distortion value. +$CAPostFx::cubeDistortionFactor = -0.1; + +/// The amount and direction of the maxium shift for +/// the red, green, and blue channels. +$CAPostFx::colorDistortionFactor = "0.005 -0.005 0.01"; + + +singleton GFXStateBlockData( PFX_DefaultChromaticLensStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; +}; + +singleton ShaderData( PFX_ChromaticLensShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/chromaticLens.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/chromaticLens.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 3.0; +}; + +singleton PostEffect( ChromaticLensPostFX ) +{ + renderTime = "PFXAfterDiffuse"; + renderPriority = 0.2; + isEnabled = false; + allowReflectPass = false; + + shader = PFX_ChromaticLensShader; + stateBlock = PFX_DefaultChromaticLensStateBlock; + texture[0] = "$backBuffer"; + target = "$backBuffer"; +}; + +function ChromaticLensPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$distCoeff", $CAPostFx::distCoeffecient ); + %this.setShaderConst( "$cubeDistort", $CAPostFx::cubeDistortionFactor ); + %this.setShaderConst( "$colorDistort", $CAPostFx::colorDistortionFactor ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.cs b/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.cs new file mode 100644 index 000000000..6054d52ee --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.cs @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +$PostFXManager::Settings::EnableVignette = "1"; +$PostFXManager::Settings::EnableDOF = "1"; +$PostFXManager::Settings::EnabledSSAO = "1"; +$PostFXManager::Settings::EnableHDR = "1"; +$PostFXManager::Settings::EnableLightRays = "1"; +$PostFXManager::Settings::EnablePostFX = "1"; +$PostFXManager::Settings::Vignette::VMax = "0.6"; +$PostFXManager::Settings::DOF::BlurCurveFar = ""; +$PostFXManager::Settings::DOF::BlurCurveNear = ""; +$PostFXManager::Settings::DOF::BlurMax = ""; +$PostFXManager::Settings::DOF::BlurMin = ""; +$PostFXManager::Settings::DOF::EnableAutoFocus = ""; +$PostFXManager::Settings::DOF::EnableDOF = ""; +$PostFXManager::Settings::DOF::FocusRangeMax = ""; +$PostFXManager::Settings::DOF::FocusRangeMin = ""; +$PostFXManager::Settings::HDR::adaptRate = "2"; +$PostFXManager::Settings::HDR::blueShiftColor = "1.05 0.97 1.27"; +$PostFXManager::Settings::HDR::brightPassThreshold = "1"; +$PostFXManager::Settings::HDR::enableBloom = "1"; +$PostFXManager::Settings::HDR::enableBlueShift = "0"; +$PostFXManager::Settings::HDR::enableToneMapping = "0.5"; +$PostFXManager::Settings::HDR::gaussMean = "0"; +$PostFXManager::Settings::HDR::gaussMultiplier = "0.3"; +$PostFXManager::Settings::HDR::gaussStdDev = "0.8"; +$PostFXManager::Settings::HDR::keyValue = "0.18"; +$PostFXManager::Settings::HDR::minLuminace = "0.001"; +$PostFXManager::Settings::HDR::whiteCutoff = "1"; +$PostFXManager::Settings::LightRays::brightScalar = "0.75"; +$PostFXManager::Settings::LightRays::decay = "1.0"; +$PostFXManager::Settings::LightRays::density = "0.94"; +$PostFXManager::Settings::LightRays::numSamples = "40"; +$PostFXManager::Settings::LightRays::weight = "5.65"; +$PostFXManager::Settings::SSAO::blurDepthTol = "0.001"; +$PostFXManager::Settings::SSAO::blurNormalTol = "0.95"; +$PostFXManager::Settings::SSAO::lDepthMax = "2"; +$PostFXManager::Settings::SSAO::lDepthMin = "0.2"; +$PostFXManager::Settings::SSAO::lDepthPow = "0.2"; +$PostFXManager::Settings::SSAO::lNormalPow = "2"; +$PostFXManager::Settings::SSAO::lNormalTol = "-0.5"; +$PostFXManager::Settings::SSAO::lRadius = "1"; +$PostFXManager::Settings::SSAO::lStrength = "10"; +$PostFXManager::Settings::SSAO::overallStrength = "2"; +$PostFXManager::Settings::SSAO::quality = "0"; +$PostFXManager::Settings::SSAO::sDepthMax = "1"; +$PostFXManager::Settings::SSAO::sDepthMin = "0.1"; +$PostFXManager::Settings::SSAO::sDepthPow = "1"; +$PostFXManager::Settings::SSAO::sNormalPow = "1"; +$PostFXManager::Settings::SSAO::sNormalTol = "0"; +$PostFXManager::Settings::SSAO::sRadius = "0.1"; +$PostFXManager::Settings::SSAO::sStrength = "6"; +$PostFXManager::Settings::ColorCorrectionRamp = "core/postFX/images/null_color_ramp.png"; diff --git a/Templates/BaseGame/game/core/postFX/scripts/dof.cs b/Templates/BaseGame/game/core/postFX/scripts/dof.cs new file mode 100644 index 000000000..736c288b2 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/dof.cs @@ -0,0 +1,599 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/* + +================================================================================ + The DOFPostEffect API +================================================================================ + +DOFPostEffect::setFocalDist( %dist ) + +@summary +This method is for manually controlling the focus distance. It will have no +effect if auto focus is currently enabled. Makes use of the parameters set by +setFocusParams. + +@param dist +float distance in meters + +-------------------------------------------------------------------------------- + +DOFPostEffect::setAutoFocus( %enabled ) + +@summary +This method sets auto focus enabled or disabled. Makes use of the parameters set +by setFocusParams. When auto focus is enabled it determines the focal depth +by performing a raycast at the screen-center. + +@param enabled +bool + +-------------------------------------------------------------------------------- + +DOFPostEffect::setFocusParams( %nearBlurMax, %farBlurMax, %minRange, %maxRange, %nearSlope, %farSlope ) + +Set the parameters that control how the near and far equations are calculated +from the focal distance. If you are not using auto focus you will need to call +setFocusParams PRIOR to calling setFocalDist. + +@param nearBlurMax +float between 0.0 and 1.0 +The max allowed value of near blur. + +@param farBlurMax +float between 0.0 and 1.0 +The max allowed value of far blur. + +@param minRange/maxRange +float in meters +The distance range around the focal distance that remains in focus is a lerp +between the min/maxRange using the normalized focal distance as the parameter. +The point is to allow the focal range to expand as you focus farther away since this is +visually appealing. + +Note: since min/maxRange are lerped by the "normalized" focal distance it is +dependant on the visible distance set in your level. + +@param nearSlope +float less than zero +The slope of the near equation. A small number causes bluriness to increase gradually +at distances closer than the focal distance. A large number causes bluriness to +increase quickly. + +@param farSlope +float greater than zero +The slope of the far equation. A small number causes bluriness to increase gradually +at distances farther than the focal distance. A large number causes bluriness to +increase quickly. + +Note: To rephrase, the min/maxRange parameters control how much area around the +focal distance is completely in focus where the near/farSlope parameters control +how quickly or slowly bluriness increases at distances outside of that range. + +================================================================================ + Examples +================================================================================ + +Example1: Turn on DOF while zoomed in with a weapon. + +NOTE: These are not real callbacks! Hook these up to your code where appropriate! + +function onSniperZoom() +{ + // Parameterize how you want DOF to look. + DOFPostEffect.setFocusParams( 0.3, 0.3, 50, 500, -5, 5 ); + + // Turn on auto focus + DOFPostEffect.setAutoFocus( true ); + + // Turn on the PostEffect + DOFPostEffect.enable(); +} + +function onSniperUnzoom() +{ + // Turn off the PostEffect + DOFPostEffect.disable(); +} + +Example2: Manually control DOF with the mouse wheel. + +// Somewhere on startup... + +// Parameterize how you want DOF to look. +DOFPostEffect.setFocusParams( 0.3, 0.3, 50, 500, -5, 5 ); + +// Turn off auto focus +DOFPostEffect.setAutoFocus( false ); + +// Turn on the PostEffect +DOFPostEffect.enable(); + + +NOTE: These are not real callbacks! Hook these up to your code where appropriate! + +function onMouseWheelUp() +{ + // Since setFocalDist is really just a wrapper to assign to the focalDist + // dynamic field we can shortcut and increment it directly. + DOFPostEffect.focalDist += 8; +} + +function onMouseWheelDown() +{ + DOFPostEffect.focalDist -= 8; +} +*/ + +/// This method is for manually controlling the focal distance. It will have no +/// effect if auto focus is currently enabled. Makes use of the parameters set by +/// setFocusParams. +function DOFPostEffect::setFocalDist( %this, %dist ) +{ + %this.focalDist = %dist; +} + +/// This method sets auto focus enabled or disabled. Makes use of the parameters set +/// by setFocusParams. When auto focus is enabled it determine the focal depth +/// by performing a raycast at the screen-center. +function DOFPostEffect::setAutoFocus( %this, %enabled ) +{ + %this.autoFocusEnabled = %enabled; +} + +/// Set the parameters that control how the near and far equations are calculated +/// from the focal distance. If you are not using auto focus you will need to call +/// setFocusParams PRIOR to calling setFocalDist. +function DOFPostEffect::setFocusParams( %this, %nearBlurMax, %farBlurMax, %minRange, %maxRange, %nearSlope, %farSlope ) +{ + %this.nearBlurMax = %nearBlurMax; + %this.farBlurMax = %farBlurMax; + %this.minRange = %minRange; + %this.maxRange = %maxRange; + %this.nearSlope = %nearSlope; + %this.farSlope = %farSlope; +} + +/* + +More information... + +This DOF technique is based on this paper: +http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html + +================================================================================ +1. Overview of how we represent "Depth of Field" +================================================================================ + +DOF is expressed as an amount of bluriness per pixel according to its depth. +We represented this by a piecewise linear curve depicted below. + +Note: we also refer to "bluriness" as CoC ( circle of confusion ) which is the term +used in the basis paper and in photography. + + +X-axis (depth) +x = 0.0----------------------------------------------x = 1.0 + +Y-axis (bluriness) +y = 1.0 + | + | ____(x1,y1) (x4,y4)____ + | (ns,nb)\ <--Line1 line2---> /(fe,fb) + | \ / + | \(x2,y2) (x3,y3)/ + | (ne,0)------(fs,0) +y = 0.0 + + +I have labeled the "corners" of this graph with (Xn,Yn) to illustrate that +this is in fact a collection of line segments where the x/y of each point +corresponds to the key below. + +key: +ns - (n)ear blur (s)tart distance +nb - (n)ear (b)lur amount (max value) +ne - (n)ear blur (e)nd distance +fs - (f)ar blur (s)tart distance +fe - (f)ar blur (e)nd distance +fb - (f)ar (b)lur amount (max value) + +Of greatest importance in this graph is Line1 and Line2. Where... +L1 { (x1,y1), (x2,y2) } +L2 { (x3,y3), (x4,y4) } + +Line one represents the amount of "near" blur given a pixels depth and line two +represents the amount of "far" blur at that depth. + +Both these equations are evaluated for each pixel and then the larger of the two +is kept. Also the output blur (for each equation) is clamped between 0 and its +maximum allowable value. + +Therefore, to specify a DOF "qualify" you need to specify the near-blur-line, +far-blur-line, and maximum near and far blur value. + +================================================================================ +2. Abstracting a "focal depth" +================================================================================ + +Although the shader(s) work in terms of a near and far equation it is more +useful to express DOF as an adjustable focal depth and derive the other parameters +"under the hood". + +Given a maximum near/far blur amount and a near/far slope we can calculate the +near/far equations for any focal depth. We extend this to also support a range +of depth around the focal depth that is also in focus and for that range to +shrink or grow as the focal depth moves closer or farther. + +Keep in mind this is only one implementation and depending on the effect you +desire you may which to express the relationship between focal depth and +the shader paramaters different. + +*/ + +//----------------------------------------------------------------------------- +// GFXStateBlockData / ShaderData +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( PFX_DefaultDOFStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( PFX_DOFCalcCoCStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( PFX_DOFDownSampleStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( PFX_DOFBlurStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( PFX_DOFFinalStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampLinear; + samplerStates[3] = SamplerClampPoint; + + blendDefined = true; + blendEnable = true; + blendDest = GFXBlendInvSrcAlpha; + blendSrc = GFXBlendOne; +}; + +singleton ShaderData( PFX_DOFDownSampleShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_DownSample_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_DownSample_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_DownSample_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_DownSample_P.glsl"; + + samplerNames[0] = "$colorSampler"; + samplerNames[1] = "$depthSampler"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_DOFBlurYShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Gausian_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Gausian_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Gausian_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Gausian_P.glsl"; + + samplerNames[0] = "$diffuseMap"; + + pixVersion = 2.0; + defines = "BLUR_DIR=float2(0.0,1.0)"; +}; + +singleton ShaderData( PFX_DOFBlurXShader : PFX_DOFBlurYShader ) +{ + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + +singleton ShaderData( PFX_DOFCalcCoCShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_CalcCoC_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_CalcCoC_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_CalcCoC_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_CalcCoC_P.glsl"; + + samplerNames[0] = "$shrunkSampler"; + samplerNames[1] = "$blurredSampler"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_DOFSmallBlurShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_SmallBlur_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_SmallBlur_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_SmallBlur_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_SmallBlur_P.glsl"; + + samplerNames[0] = "$colorSampler"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_DOFFinalShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Final_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Final_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Final_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Final_P.glsl"; + + samplerNames[0] = "$colorSampler"; + samplerNames[1] = "$smallBlurSampler"; + samplerNames[2] = "$largeBlurSampler"; + samplerNames[3] = "$depthSampler"; + + pixVersion = 3.0; +}; + +//----------------------------------------------------------------------------- +// PostEffects +//----------------------------------------------------------------------------- + +function DOFPostEffect::onAdd( %this ) +{ + // The weighted distribution of CoC value to the three blur textures + // in the order small, medium, large. Most likely you will not need to + // change this value. + %this.setLerpDist( 0.2, 0.3, 0.5 ); + + // Fill out some default values but DOF really should not be turned on + // without actually specifying your own parameters! + %this.autoFocusEnabled = false; + %this.focalDist = 0.0; + %this.nearBlurMax = 0.5; + %this.farBlurMax = 0.5; + %this.minRange = 50; + %this.maxRange = 500; + %this.nearSlope = -5.0; + %this.farSlope = 5.0; +} + +function DOFPostEffect::setLerpDist( %this, %d0, %d1, %d2 ) +{ + %this.lerpScale = -1.0 / %d0 SPC -1.0 / %d1 SPC -1.0 / %d2 SPC 1.0 / %d2; + %this.lerpBias = 1.0 SPC ( 1.0 - %d2 ) / %d1 SPC 1.0 / %d2 SPC ( %d2 - 1.0 ) / %d2; +} + +singleton PostEffect( DOFPostEffect ) +{ + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + renderPriority = 0.1; + + shader = PFX_DOFDownSampleShader; + stateBlock = PFX_DOFDownSampleStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#deferred"; + target = "#shrunk"; + targetScale = "0.25 0.25"; + + isEnabled = false; +}; + +singleton PostEffect( DOFBlurY ) +{ + shader = PFX_DOFBlurYShader; + stateBlock = PFX_DOFBlurStateBlock; + texture[0] = "#shrunk"; + target = "$outTex"; +}; + +DOFPostEffect.add( DOFBlurY ); + +singleton PostEffect( DOFBlurX ) +{ + shader = PFX_DOFBlurXShader; + stateBlock = PFX_DOFBlurStateBlock; + texture[0] = "$inTex"; + target = "#largeBlur"; +}; + +DOFPostEffect.add( DOFBlurX ); + +singleton PostEffect( DOFCalcCoC ) +{ + shader = PFX_DOFCalcCoCShader; + stateBlock = PFX_DOFCalcCoCStateBlock; + texture[0] = "#shrunk"; + texture[1] = "#largeBlur"; + target = "$outTex"; +}; + +DOFPostEffect.add( DOFCalcCoc ); + +singleton PostEffect( DOFSmallBlur ) +{ + shader = PFX_DOFSmallBlurShader; + stateBlock = PFX_DefaultDOFStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; +}; + +DOFPostEffect.add( DOFSmallBlur ); + +singleton PostEffect( DOFFinalPFX ) +{ + shader = PFX_DOFFinalShader; + stateBlock = PFX_DOFFinalStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "$inTex"; + texture[2] = "#largeBlur"; + texture[3] = "#deferred"; + target = "$backBuffer"; +}; + +DOFPostEffect.add( DOFFinalPFX ); + + +//----------------------------------------------------------------------------- +// Scripts +//----------------------------------------------------------------------------- + +function DOFPostEffect::setShaderConsts( %this ) +{ + if ( %this.autoFocusEnabled ) + %this.autoFocus(); + + %fd = %this.focalDist / $Param::FarDist; + + %range = mLerp( %this.minRange, %this.maxRange, %fd ) / $Param::FarDist * 0.5; + + // We work in "depth" space rather than real-world units for the + // rest of this method... + + // Given the focal distance and the range around it we want in focus + // we can determine the near-end-distance and far-start-distance + + %ned = getMax( %fd - %range, 0.0 ); + %fsd = getMin( %fd + %range, 1.0 ); + + // near slope + %nsl = %this.nearSlope; + + // Given slope of near blur equation and the near end dist and amount (x2,y2) + // solve for the y-intercept + // y = mx + b + // so... + // y - mx = b + + %b = 0.0 - %nsl * %ned; + + %eqNear = %nsl SPC %b SPC 0.0; + + // Do the same for the far blur equation... + + %fsl = %this.farSlope; + + %b = 0.0 - %fsl * %fsd; + + %eqFar = %fsl SPC %b SPC 1.0; + + %this.setShaderConst( "$dofEqWorld", %eqNear ); + DOFFinalPFX.setShaderConst( "$dofEqFar", %eqFar ); + + %this.setShaderConst( "$maxWorldCoC", %this.nearBlurMax ); + DOFFinalPFX.setShaderConst( "$maxFarCoC", %this.farBlurMax ); + + DOFFinalPFX.setShaderConst( "$dofLerpScale", %this.lerpScale ); + DOFFinalPFX.setShaderConst( "$dofLerpBias", %this.lerpBias ); +} + +function DOFPostEffect::autoFocus( %this ) +{ + if ( !isObject( ServerConnection ) || + !isObject( ServerConnection.getCameraObject() ) ) + { + return; + } + + %mask = $TypeMasks::StaticObjectType | $TypeMasks::TerrainObjectType; + %control = ServerConnection.getCameraObject(); + + %fvec = %control.getForwardVector(); + %start = %control.getPosition(); + + %end = VectorAdd( %start, VectorScale( %fvec, $Param::FarDist ) ); + + // Use the client container for this ray cast. + %result = containerRayCast( %start, %end, %mask, %control, true ); + + %hitPos = getWords( %result, 1, 3 ); + + if ( %hitPos $= "" ) + %focDist = $Param::FarDist; + else + %focDist = VectorDist( %hitPos, %start ); + + // For debuging + //$DOF::debug_dist = %focDist; + //$DOF::debug_depth = %focDist / $Param::FarDist; + //echo( "F: " @ %focDist SPC "D: " @ %delta ); + + %this.focalDist = %focDist; +} + + +// For debugging +/* +function reloadDOF() +{ + exec( "./dof.cs" ); + DOFPostEffect.reload(); + DOFPostEffect.disable(); + DOFPostEffect.enable(); +} + +function dofMetricsCallback() +{ + return " | DOF |" @ + " Dist: " @ $DOF::debug_dist @ + " Depth: " @ $DOF::debug_depth; +} +*/ \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/edgeAA.cs b/Templates/BaseGame/game/core/postFX/scripts/edgeAA.cs new file mode 100644 index 000000000..c3b4263fa --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/edgeAA.cs @@ -0,0 +1,113 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +singleton GFXStateBlockData( PFX_DefaultEdgeAAStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + //samplerStates[1] = SamplerWrapPoint; +}; + +singleton ShaderData( PFX_EdgeAADetectShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeDetectP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeDetectP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_EdgeAAShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeAAV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeAAP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeAAV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeAAP.glsl"; + + samplerNames[0] = "$edgeBuffer"; + samplerNames[1] = "$backBuffer"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_EdgeAADebugShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/dbgEdgeDisplayP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl"; + + samplerNames[0] = "$edgeBuffer"; + + pixVersion = 3.0; +}; + +singleton PostEffect( EdgeDetectPostEffect ) +{ + renderTime = "PFXBeforeBin"; + renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + targetScale = "0.5 0.5"; + + shader = PFX_EdgeAADetectShader; + stateBlock = PFX_DefaultEdgeAAStateBlock; + texture[0] = "#deferred"; + target = "#edge"; + + isEnabled = true; +}; + +singleton PostEffect( EdgeAAPostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + //renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + + shader = PFX_EdgeAAShader; + stateBlock = PFX_DefaultEdgeAAStateBlock; + texture[0] = "#edge"; + texture[1] = "$backBuffer"; + target = "$backBuffer"; +}; + +singleton PostEffect( Debug_EdgeAAPostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + //renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + + shader = PFX_EdgeAADebugShader; + stateBlock = PFX_DefaultEdgeAAStateBlock; + texture[0] = "#edge"; + target = "$backBuffer"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/flash.cs b/Templates/BaseGame/game/core/postFX/scripts/flash.cs new file mode 100644 index 000000000..1c97c6411 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/flash.cs @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( PFX_FlashShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/flashP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/flashP.glsl"; + + samplerNames[0] = "$backBuffer"; + + defines = "WHITE_COLOR=float4(1.0,1.0,1.0,0.0);MUL_COLOR=float4(1.0,0.25,0.25,0.0)"; + + pixVersion = 2.0; +}; + +singleton PostEffect( FlashFx ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + + shader = PFX_FlashShader; + texture[0] = "$backBuffer"; + renderPriority = 10; + stateBlock = PFX_DefaultStateBlock; +}; + +function FlashFx::setShaderConsts( %this ) +{ + if ( isObject( ServerConnection ) ) + { + %this.setShaderConst( "$damageFlash", ServerConnection.getDamageFlash() ); + %this.setShaderConst( "$whiteOut", ServerConnection.getWhiteOut() ); + } + else + { + %this.setShaderConst( "$damageFlash", 0 ); + %this.setShaderConst( "$whiteOut", 0 ); + } +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/fog.cs b/Templates/BaseGame/game/core/postFX/scripts/fog.cs new file mode 100644 index 000000000..4b9bfc663 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/fog.cs @@ -0,0 +1,135 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +// Fog +//------------------------------------------------------------------------------ + +singleton ShaderData( FogPassShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fogP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/fogP.glsl"; + + samplerNames[0] = "$deferredTex"; + + pixVersion = 2.0; +}; + + +singleton GFXStateBlockData( FogPassStateBlock : PFX_DefaultStateBlock ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendSrcAlpha; + blendDest = GFXBlendInvSrcAlpha; +}; + + +singleton PostEffect( FogPostFx ) +{ + // We forward render the reflection pass + // so it does its own fogging. + allowReflectPass = false; + + renderTime = "PFXBeforeBin"; + renderBin = "ObjTranslucentBin"; + + shader = FogPassShader; + stateBlock = FogPassStateBlock; + texture[0] = "#deferred"; + + renderPriority = 5; + + targetFormat = getBestHDRFormat(); + isEnabled = true; +}; + + +//------------------------------------------------------------------------------ +// UnderwaterFog +//------------------------------------------------------------------------------ + +singleton ShaderData( UnderwaterFogPassShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/underwaterFogP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/underwaterFogP.glsl"; + + samplerNames[0] = "$deferredTex"; + samplerNames[1] = "$backbuffer"; + samplerNames[2] = "$waterDepthGradMap"; + + pixVersion = 2.0; +}; + + +singleton GFXStateBlockData( UnderwaterFogPassStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampPoint; + samplerStates[2] = SamplerClampLinear; +}; + + +singleton PostEffect( UnderwaterFogPostFx ) +{ + oneFrameOnly = true; + onThisFrame = false; + + // Let the fog effect render during the + // reflection pass. + allowReflectPass = true; + + renderTime = "PFXBeforeBin"; + renderBin = "ObjTranslucentBin"; + + shader = UnderwaterFogPassShader; + stateBlock = UnderwaterFogPassStateBlock; + texture[0] = "#deferred"; + texture[1] = "$backBuffer"; + texture[2] = "#waterDepthGradMap"; + + // Needs to happen after the FogPostFx + renderPriority = 4; + + isEnabled = true; +}; + +function UnderwaterFogPostFx::onEnabled( %this ) +{ + TurbulenceFx.enable(); + CausticsPFX.enable(); + return true; +} + +function UnderwaterFogPostFx::onDisabled( %this ) +{ + TurbulenceFx.disable(); + CausticsPFX.disable(); + return false; +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/fxaa.cs b/Templates/BaseGame/game/core/postFX/scripts/fxaa.cs new file mode 100644 index 000000000..4b81c6e19 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/fxaa.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "NVIDIA FXAA 3.11" by TIMOTHY LOTTES +// +// http://timothylottes.blogspot.com/ +// +// The shader is tuned for the defaul quality and good performance. +// See shaders\common\postFx\fxaa\fxaaP.hlsl to tweak the internal +// quality and performance settings. + +singleton GFXStateBlockData( FXAA_StateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton ShaderData( FXAA_ShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/fxaaV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/fxaaP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/gl/fxaaV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/gl/fxaaP.glsl"; + + samplerNames[0] = "$colorTex"; + + pixVersion = 3.0; +}; + +singleton PostEffect( FXAA_PostEffect ) +{ + isEnabled = false; + + allowReflectPass = false; + renderTime = "PFXAfterDiffuse"; + + texture[0] = "$backBuffer"; + + target = "$backBuffer"; + + stateBlock = FXAA_StateBlock; + shader = FXAA_ShaderData; +}; + diff --git a/Templates/BaseGame/game/core/postFX/scripts/glow.cs b/Templates/BaseGame/game/core/postFX/scripts/glow.cs new file mode 100644 index 000000000..0f062f6f7 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/glow.cs @@ -0,0 +1,184 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +singleton ShaderData( PFX_GlowBlurVertShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurP.glsl"; + + defines = "BLUR_DIR=float2(0.0,1.0)"; + + samplerNames[0] = "$diffuseMap"; + + pixVersion = 2.0; +}; + + +singleton ShaderData( PFX_GlowBlurHorzShader : PFX_GlowBlurVertShader ) +{ + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + + +singleton GFXStateBlockData( PFX_GlowCombineStateBlock : PFX_DefaultStateBlock ) +{ + // Use alpha test to save some fillrate + // on the non-glowing areas of the scene. + alphaDefined = true; + alphaTestEnable = true; + alphaTestRef = 1; + alphaTestFunc = GFXCmpGreaterEqual; + + // Do a one to one blend. + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; +}; + + +singleton PostEffect( GlowPostFx ) +{ + // Do not allow the glow effect to work in reflection + // passes by default so we don't do the extra drawing. + allowReflectPass = false; + + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + renderPriority = 1; + + // First we down sample the glow buffer. + shader = PFX_PassthruShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "#glowbuffer"; + target = "$outTex"; + targetScale = "0.5 0.5"; + + isEnabled = true; + + // Blur vertically + new PostEffect() + { + shader = PFX_GlowBlurVertShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + }; + + // Blur horizontally + new PostEffect() + { + shader = PFX_GlowBlurHorzShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + }; + + // Upsample and combine with the back buffer. + new PostEffect() + { + shader = PFX_PassthruShader; + stateBlock = PFX_GlowCombineStateBlock; + texture[0] = "$inTex"; + target = "$backBuffer"; + }; +}; + +singleton ShaderData( PFX_VolFogGlowBlurVertShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/VolFogGlowP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/VolFogGlowP.glsl"; + + defines = "BLUR_DIR=float2(0.0,1.0)"; + samplerNames[0] = "$diffuseMap"; + pixVersion = 2.0; +}; +singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/VolFogGlowP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/VolFogGlowP.glsl"; + + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + +$VolFogGlowPostFx::glowStrength = 0.3; + +singleton PostEffect( VolFogGlowPostFx ) +{ + // Do not allow the glow effect to work in reflection + // passes by default so we don't do the extra drawing. + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "FogBin"; + renderPriority = 1; + // First we down sample the glow buffer. + shader = PFX_PassthruShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backbuffer"; + target = "$outTex"; + targetScale = "0.5 0.5"; + isEnabled = true; + // Blur vertically + new PostEffect() + { + shader = PFX_VolFogGlowBlurVertShader; + stateBlock = PFX_DefaultStateBlock; + internalName = "vert"; + texture[0] = "$inTex"; + target = "$outTex"; + }; + // Blur horizontally + new PostEffect() + { + shader = PFX_VolFogGlowBlurHorzShader; + stateBlock = PFX_DefaultStateBlock; + internalName = "hor"; + texture[0] = "$inTex"; + target = "$outTex"; + }; + // Upsample and combine with the back buffer. + new PostEffect() + { + shader = PFX_PassthruShader; + stateBlock = PFX_GlowCombineStateBlock; + texture[0] = "$inTex"; + target = "$backBuffer"; + }; +}; + +function VolFogGlowPostFx::setShaderConsts( %this ) +{ + %vp=%this-->vert; + %vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength ); + %vp=%this-->hor; + %vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/hdr.cs b/Templates/BaseGame/game/core/postFX/scripts/hdr.cs new file mode 100644 index 000000000..3b2de8b7b --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/hdr.cs @@ -0,0 +1,529 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +/// Blends between the scene and the tone mapped scene. +$HDRPostFX::enableToneMapping = 0.5; + +/// The tone mapping middle grey or exposure value used +/// to adjust the overall "balance" of the image. +/// +/// 0.18 is fairly common value. +/// +$HDRPostFX::keyValue = 0.18; + +/// The minimum luninace value to allow when tone mapping +/// the scene. Is particularly useful if your scene very +/// dark or has a black ambient color in places. +$HDRPostFX::minLuminace = 0.001; + +/// The lowest luminance value which is mapped to white. This +/// is usually set to the highest visible luminance in your +/// scene. By setting this to smaller values you get a contrast +/// enhancement. +$HDRPostFX::whiteCutoff = 1.0; + +/// The rate of adaptation from the previous and new +/// average scene luminance. +$HDRPostFX::adaptRate = 2.0; + +/// Blends between the scene and the blue shifted version +/// of the scene for a cinematic desaturated night effect. +$HDRPostFX::enableBlueShift = 0.0; + +/// The blue shift color value. +$HDRPostFX::blueShiftColor = "1.05 0.97 1.27"; + + +/// Blends between the scene and the bloomed scene. +$HDRPostFX::enableBloom = 1.0; + +/// The threshold luminace value for pixels which are +/// considered "bright" and need to be bloomed. +$HDRPostFX::brightPassThreshold = 1.0; + +/// These are used in the gaussian blur of the +/// bright pass for the bloom effect. +$HDRPostFX::gaussMultiplier = 0.3; +$HDRPostFX::gaussMean = 0.0; +$HDRPostFX::gaussStdDev = 0.8; + +/// The 1x255 color correction ramp texture used +/// by both the HDR shader and the GammaPostFx shader +/// for doing full screen color correction. +$HDRPostFX::colorCorrectionRamp = "core/postFX/images/null_color_ramp.png"; + + +singleton ShaderData( HDR_BrightPassShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/brightPassFilterP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/brightPassFilterP.glsl"; + + samplerNames[0] = "$inputTex"; + samplerNames[1] = "$luminanceTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_DownScale4x4Shader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/downScale4x4V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/downScale4x4P.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/downScale4x4V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/downScale4x4P.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 2.0; +}; + +singleton ShaderData( HDR_BloomGaussBlurHShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurHP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurHP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_BloomGaussBlurVShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurVP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurVP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_SampleLumShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/sampleLumInitialP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumInitialP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_DownSampleLumShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/sampleLumIterativeP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumIterativeP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_CalcAdaptedLumShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/calculateAdaptedLumP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/calculateAdaptedLumP.glsl"; + + samplerNames[0] = "$currLum"; + samplerNames[1] = "$lastAdaptedLum"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_CombineShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/finalPassCombineP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/finalPassCombineP.glsl"; + + samplerNames[0] = "$sceneTex"; + samplerNames[1] = "$luminanceTex"; + samplerNames[2] = "$bloomTex"; + samplerNames[3] = "$colorCorrectionTex"; + samplerNames[4] = "deferredTex"; + + pixVersion = 3.0; +}; + + +singleton GFXStateBlockData( HDR_SampleStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( HDR_DownSampleStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( HDR_CombineStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampLinear; + samplerStates[3] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( HDRStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampLinear; + samplerStates[3] = SamplerClampLinear; + + blendDefined = true; + blendDest = GFXBlendOne; + blendSrc = GFXBlendZero; + + zDefined = true; + zEnable = false; + zWriteEnable = false; + + cullDefined = true; + cullMode = GFXCullNone; +}; + + +function HDRPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$brightPassThreshold", $HDRPostFX::brightPassThreshold ); + %this.setShaderConst( "$g_fMiddleGray", $HDRPostFX::keyValue ); + + %bloomH = %this-->bloomH; + %bloomH.setShaderConst( "$gaussMultiplier", $HDRPostFX::gaussMultiplier ); + %bloomH.setShaderConst( "$gaussMean", $HDRPostFX::gaussMean ); + %bloomH.setShaderConst( "$gaussStdDev", $HDRPostFX::gaussStdDev ); + + %bloomV = %this-->bloomV; + %bloomV.setShaderConst( "$gaussMultiplier", $HDRPostFX::gaussMultiplier ); + %bloomV.setShaderConst( "$gaussMean", $HDRPostFX::gaussMean ); + %bloomV.setShaderConst( "$gaussStdDev", $HDRPostFX::gaussStdDev ); + + %minLuminace = $HDRPostFX::minLuminace; + if ( %minLuminace <= 0.0 ) + { + // The min should never be pure zero else the + // log() in the shader will generate INFs. + %minLuminace = 0.00001; + } + %this-->adaptLum.setShaderConst( "$g_fMinLuminace", %minLuminace ); + + %this-->finalLum.setShaderConst( "$adaptRate", $HDRPostFX::adaptRate ); + + %combinePass = %this-->combinePass; + %combinePass.setShaderConst( "$g_fEnableToneMapping", $HDRPostFX::enableToneMapping ); + %combinePass.setShaderConst( "$g_fMiddleGray", $HDRPostFX::keyValue ); + %combinePass.setShaderConst( "$g_fBloomScale", $HDRPostFX::enableBloom ); + %combinePass.setShaderConst( "$g_fEnableBlueShift", $HDRPostFX::enableBlueShift ); + %combinePass.setShaderConst( "$g_fBlueShiftColor", $HDRPostFX::blueShiftColor ); + + %clampedGamma = mClamp( $pref::Video::Gamma, 2.0, 2.5); + %combinePass.setShaderConst( "$g_fOneOverGamma", 1 / %clampedGamma ); + %combinePass.setShaderConst( "$Brightness", $pref::Video::Brightness ); + %combinePass.setShaderConst( "$Contrast", $pref::Video::Contrast ); + + %whiteCutoff = ( $HDRPostFX::whiteCutoff * $HDRPostFX::whiteCutoff ) * + ( $HDRPostFX::whiteCutoff * $HDRPostFX::whiteCutoff ); + %combinePass.setShaderConst( "$g_fWhiteCutoff", %whiteCutoff ); +} + +function HDRPostFX::preProcess( %this ) +{ + %combinePass = %this-->combinePass; + + if ( %combinePass.texture[3] !$= $HDRPostFX::colorCorrectionRamp ) + %combinePass.setTexture( 3, $HDRPostFX::colorCorrectionRamp ); +} + +function HDRPostFX::onEnabled( %this ) +{ + // See what HDR format would be best. + %format = getBestHDRFormat(); + if ( %format $= "" || %format $= "GFXFormatR8G8B8A8" ) + { + // We didn't get a valid HDR format... so fail. + return false; + } + + // HDR does it's own gamma calculation so + // disable this postFx. + GammaPostFX.disable(); + + // Set the right global shader define for HDR. + if ( %format $= "GFXFormatR10G10B10A2" ) + addGlobalShaderMacro( "TORQUE_HDR_RGB10" ); + else if ( %format $= "GFXFormatR16G16B16A16" ) + addGlobalShaderMacro( "TORQUE_HDR_RGB16" ); + + echo( "HDR FORMAT: " @ %format ); + + // Change the format of the offscreen surface + // to an HDR compatible format. + AL_FormatToken.format = %format; + setReflectFormat( %format ); + + // Reset the light manager which will ensure the new + // hdr encoding takes effect in all the shaders and + // that the offscreen surface is enabled. + resetLightManager(); + + return true; +} + +function HDRPostFX::onDisabled( %this ) +{ + // Enable a special GammaCorrection PostFX when this is disabled. + GammaPostFX.enable(); + + // Restore the non-HDR offscreen surface format. + %format = getBestHDRFormat(); + AL_FormatToken.format = %format; + setReflectFormat( %format ); + + removeGlobalShaderMacro( "TORQUE_HDR_RGB10" ); + removeGlobalShaderMacro( "TORQUE_HDR_RGB16" ); + + // Reset the light manager which will ensure the new + // hdr encoding takes effect in all the shaders. + resetLightManager(); +} + +singleton PostEffect( HDRPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + // Resolve the HDR before we render any editor stuff + // and before we resolve the scene to the backbuffer. + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 9999; + + // The bright pass generates a bloomed version of + // the scene for pixels which are brighter than a + // fixed threshold value. + // + // This is then used in the final HDR combine pass + // at the end of this post effect chain. + // + + shader = HDR_BrightPassShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#adaptedLum"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + targetScale = "0.5 0.5"; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownScale4x4Shader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + targetScale = "0.25 0.25"; + }; + + new PostEffect() + { + allowReflectPass = false; + internalName = "bloomH"; + + shader = HDR_BloomGaussBlurHShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + }; + + new PostEffect() + { + allowReflectPass = false; + internalName = "bloomV"; + + shader = HDR_BloomGaussBlurVShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "#bloomFinal"; + targetFormat = "GFXFormatR16G16B16A16F"; + }; + + // BrightPass End + + // Now calculate the adapted luminance. + new PostEffect() + { + allowReflectPass = false; + internalName = "adaptLum"; + + shader = HDR_SampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$backBuffer"; + target = "$outTex"; + targetScale = "0.0625 0.0625"; // 1/16th + targetFormat = "GFXFormatR16F"; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownSampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetScale = "0.25 0.25"; // 1/4 + targetFormat = "GFXFormatR16F"; + }; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownSampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetScale = "0.25 0.25"; // 1/4 + targetFormat = "GFXFormatR16F"; + }; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownSampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetScale = "0.25 0.25"; // At this point the target should be 1x1. + targetFormat = "GFXFormatR16F"; + }; + + // Note that we're reading the adapted luminance + // from the previous frame when generating this new + // one... PostEffect takes care to manage that. + new PostEffect() + { + allowReflectPass = false; + internalName = "finalLum"; + shader = HDR_CalcAdaptedLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + texture[1] = "#adaptedLum"; + target = "#adaptedLum"; + targetFormat = "GFXFormatR16F"; + targetClear = "PFXTargetClear_OnCreate"; + targetClearColor = "1 1 1 1"; + }; + }; + + // Output the combined bloom and toned mapped + // version of the scene. + new PostEffect() + { + allowReflectPass = false; + internalName = "combinePass"; + + shader = HDR_CombineShader; + stateBlock = HDR_CombineStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#adaptedLum"; + texture[2] = "#bloomFinal"; + texture[3] = $HDRPostFX::colorCorrectionRamp; + target = "$backBuffer"; + }; +}; + +singleton ShaderData( LuminanceVisShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/luminanceVisP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/luminanceVisP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( LuminanceVisStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +function LuminanceVisPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$brightPassThreshold", $HDRPostFX::brightPassThreshold ); +} + +singleton PostEffect( LuminanceVisPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + // Render before we do any editor rendering. + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 9999; + + shader = LuminanceVisShader; + stateBlock = LuminanceVisStateBlock; + texture[0] = "$backBuffer"; + target = "$backBuffer"; + //targetScale = "0.0625 0.0625"; // 1/16th + //targetFormat = "GFXFormatR16F"; +}; + +function LuminanceVisPostFX::onEnabled( %this ) +{ + if ( !HDRPostFX.isEnabled() ) + { + HDRPostFX.enable(); + } + + HDRPostFX.skip = true; + + return true; +} + +function LuminanceVisPostFX::onDisabled( %this ) +{ + HDRPostFX.skip = false; +} + diff --git a/Templates/BaseGame/game/core/postFX/scripts/lightRay.cs b/Templates/BaseGame/game/core/postFX/scripts/lightRay.cs new file mode 100644 index 000000000..523b9bdea --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/lightRay.cs @@ -0,0 +1,110 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +$LightRayPostFX::brightScalar = 0.75; +$LightRayPostFX::numSamples = 40; +$LightRayPostFX::density = 0.94; +$LightRayPostFX::weight = 5.65; +$LightRayPostFX::decay = 1.0; +$LightRayPostFX::exposure = 0.0005; +$LightRayPostFX::resolutionScale = 1.0; + + +singleton ShaderData( LightRayOccludeShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/lightRayOccludeP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayOccludeP.glsl"; + + samplerNames[0] = "$backBuffer"; + samplerNames[1] = "$deferredTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( LightRayShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/lightRayP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayP.glsl"; + + samplerNames[0] = "$frameSampler"; + samplerNames[1] = "$backBuffer"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( LightRayStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton PostEffect( LightRayPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 10; + + shader = LightRayOccludeShader; + stateBlock = LightRayStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#deferred"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + + new PostEffect() + { + shader = LightRayShader; + stateBlock = LightRayStateBlock; + internalName = "final"; + texture[0] = "$inTex"; + texture[1] = "$backBuffer"; + target = "$backBuffer"; + }; +}; + +function LightRayPostFX::preProcess( %this ) +{ + %this.targetScale = $LightRayPostFX::resolutionScale SPC $LightRayPostFX::resolutionScale; +} + +function LightRayPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$brightScalar", $LightRayPostFX::brightScalar ); + + %pfx = %this-->final; + %pfx.setShaderConst( "$numSamples", $LightRayPostFX::numSamples ); + %pfx.setShaderConst( "$density", $LightRayPostFX::density ); + %pfx.setShaderConst( "$weight", $LightRayPostFX::weight ); + %pfx.setShaderConst( "$decay", $LightRayPostFX::decay ); + %pfx.setShaderConst( "$exposure", $LightRayPostFX::exposure ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/ovrBarrelDistortion.cs b/Templates/BaseGame/game/core/postFX/scripts/ovrBarrelDistortion.cs new file mode 100644 index 000000000..1ea280863 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/ovrBarrelDistortion.cs @@ -0,0 +1,167 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Only load these shaders if an Oculus VR device is present +if(!isFunction(isOculusVRDeviceActive)) + return; + +//----------------------------------------------------------------------------- +// Shader data +//----------------------------------------------------------------------------- + +singleton ShaderData( OVRMonoToStereoShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/monoToStereoP.hlsl"; + + //OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.hlsl"; + //OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/gl/monoToStereoP.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 2.0; +}; + +singleton ShaderData( OVRBarrelDistortionShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/barrelDistortionP.hlsl"; + + //OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + //OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/gl/barrelDistortionP.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 2.0; +}; + +singleton ShaderData( OVRBarrelDistortionChromaShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/barrelDistortionChromaP.hlsl"; + + pixVersion = 2.0; +}; + +//----------------------------------------------------------------------------- +// GFX state blocks +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( OVRBarrelDistortionStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +//----------------------------------------------------------------------------- +// Barrel Distortion PostFx +// +// To be used with the Oculus Rift. +// Expects a stereo pair to exist on the back buffer and then applies the +// appropriate barrel distortion. +//----------------------------------------------------------------------------- +singleton BarrelDistortionPostEffect( OVRBarrelDistortionPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + renderPriority = 100; + + // The barrel distortion + shader = OVRBarrelDistortionShader; + stateBlock = OVRBarrelDistortionStateBlock; + + texture[0] = "$backBuffer"; + + scaleOutput = 1.25; +}; + +//----------------------------------------------------------------------------- +// Barrel Distortion with Chromatic Aberration Correction PostFx +// +// To be used with the Oculus Rift. +// Expects a stereo pair to exist on the back buffer and then applies the +// appropriate barrel distortion. +// This version applies a chromatic aberration correction during the +// barrel distortion. +//----------------------------------------------------------------------------- +singleton BarrelDistortionPostEffect( OVRBarrelDistortionChromaPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + renderPriority = 100; + + // The barrel distortion + shader = OVRBarrelDistortionChromaShader; + stateBlock = OVRBarrelDistortionStateBlock; + + texture[0] = "$backBuffer"; + + scaleOutput = 1.25; +}; + +//----------------------------------------------------------------------------- +// Barrel Distortion Mono PostFx +// +// To be used with the Oculus Rift. +// Takes a non-stereo image and turns it into a stereo pair with barrel +// distortion applied. Only a vertical slice around the center of the back +// buffer is used to generate the pseudo stereo pair. +//----------------------------------------------------------------------------- +singleton PostEffect( OVRBarrelDistortionMonoPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + renderPriority = 100; + + // Converts the mono display to a stereo one + shader = OVRMonoToStereoShader; + stateBlock = OVRBarrelDistortionStateBlock; + + texture[0] = "$backBuffer"; + target = "$outTex"; + + // The actual barrel distortion + new BarrelDistortionPostEffect(OVRBarrelDistortionMonoStage2PostFX) + { + shader = OVRBarrelDistortionShader; + stateBlock = OVRBarrelDistortionStateBlock; + texture[0] = "$inTex"; + target = "$backBuffer"; + + scaleOutput = 1.25; + }; + +}; + +function OVRBarrelDistortionMonoPostFX::setShaderConsts( %this ) +{ + %HMDIndex = 0; + + %xOffsets = getOVRHMDEyeXOffsets(%HMDIndex); + %this.setShaderConst( "$LensXOffsets", %xOffsets ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFx.cs b/Templates/BaseGame/game/core/postFX/scripts/postFx.cs new file mode 100644 index 000000000..fe931a994 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFx.cs @@ -0,0 +1,88 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( PFX_PassthruShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/passthruP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/passthruP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 2.0; +}; + +function postFXInit() +{ + exec("core/postFX/guis/postFxManager.gui"); + + //Load the core postFX files themselves + if (!$Server::Dedicated) + { + //init the postFX + %pattern = "./*.cs"; + %file = findFirstFile( %pattern ); + if ( %file $= "" ) + { + // Try for DSOs next. + %pattern = "core/postFX/*.cs.dso"; + %file = findFirstFile( %pattern ); + } + + while( %file !$= "" ) + { + exec( %file ); + %file = findNextFile( %pattern ); + } + } +} + +function PostEffect::inspectVars( %this ) +{ + %name = %this.getName(); + %globals = "$" @ %name @ "::*"; + inspectVars( %globals ); +} + +function PostEffect::viewDisassembly( %this ) +{ + %file = %this.dumpShaderDisassembly(); + + if ( %file $= "" ) + { + echo( "PostEffect::viewDisassembly - no shader disassembly found." ); + } + else + { + echo( "PostEffect::viewDisassembly - shader disassembly file dumped ( " @ %file @ " )." ); + openFile( %file ); + } +} + +// Return true if we really want the effect enabled. +// By default this is the case. +function PostEffect::onEnabled( %this ) +{ + return true; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.cs b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.cs new file mode 100644 index 000000000..a6b0f0f01 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.cs @@ -0,0 +1,446 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$PostFXManager::vebose = true; +function postVerbose(%string) +{ + if($PostFXManager::vebose == true) + { + echo(%string); + } +} + +function PostFXManager::onDialogPush( %this ) +{ + //Apply the settings to the controls + postVerbose("% - PostFX Manager - Loading GUI."); + + %this.settingsRefreshAll(); +} + +// :: Controls for the overall postFX manager dialog +function ppOptionsEnable::onAction(%this) +{ + //Disable / Enable all PostFX + + if(ppOptionsEnable.getValue()) + { + %toEnable = true; + } + else + { + %toEnable = false; + } + + PostFXManager.settingsSetEnabled(%toEnable); + +} + +function PostFXManager::getEnableResultFromControl(%this, %control) +{ + %toEnable = -1; + %bTest = %control.getValue(); + if(%bTest == 1) + { + %toEnable = true; + } + else + { + %toEnable = false; + } + + return %toEnable; +} + +function ppOptionsEnableSSAO::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("SSAO", %toEnable); +} + +function ppOptionsEnableHDR::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("HDR", %toEnable); +} + +function ppOptionsEnableLightRays::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("LightRays", %toEnable); +} + +function ppOptionsEnableDOF::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("DOF", %toEnable); +} + +function ppOptionsEnableVignette::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("Vignette", %toEnable); +} + +function ppOptionsSavePreset::onClick(%this) +{ + //Stores the current settings into a preset file for loading and use later on +} + +function ppOptionsLoadPreset::onClick(%this) +{ + //Loads and applies the settings from a postfxpreset file +} + + +//Other controls, Quality dropdown +function ppOptionsSSAOQuality::onSelect( %this, %id, %text ) +{ + if(%id > -1 && %id < 3) + { + $SSAOPostFx::quality = %id; + } +} + +//SSAO Slider controls +//General Tab +function ppOptionsSSAOOverallStrength::onMouseDragged(%this) +{ + $SSAOPostFx::overallStrength = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAOBlurDepth::onMouseDragged(%this) +{ + $SSAOPostFx::blurDepthTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAOBlurNormal::onMouseDragged(%this) +{ + $SSAOPostFx::blurNormalTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//Near Tab +function ppOptionsSSAONearRadius::onMouseDragged(%this) +{ + $SSAOPostFx::sRadius = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearStrength::onMouseDragged(%this) +{ + $SSAOPostFx::sStrength = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearDepthMin::onMouseDragged(%this) +{ + $SSAOPostFx::sDepthMin = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearDepthMax::onMouseDragged(%this) +{ + $SSAOPostFx::sDepthMax = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearToleranceNormal::onMouseDragged(%this) +{ + $SSAOPostFx::sNormalTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearTolerancePower::onMouseDragged(%this) +{ + $SSAOPostFx::sNormalPow = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//Far Tab +function ppOptionsSSAOFarRadius::onMouseDragged(%this) +{ + $SSAOPostFx::lRadius = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarStrength::onMouseDragged(%this) +{ + $SSAOPostFx::lStrength = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarDepthMin::onMouseDragged(%this) +{ + $SSAOPostFx::lDepthMin = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarDepthMax::onMouseDragged(%this) +{ + $SSAOPostFx::lDepthMax = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarToleranceNormal::onMouseDragged(%this) +{ + $SSAOPostFx::lNormalTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarTolerancePower::onMouseDragged(%this) +{ + $SSAOPostFx::lNormalPow = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//HDR Slider Controls +//Brighness tab + +function ppOptionsHDRToneMappingAmount::onMouseDragged(%this) +{ + + $HDRPostFX::enableToneMapping = %this.value; + %this.ToolTip = "value : " @ %this.value; +} + +function ppOptionsHDRKeyValue::onMouseDragged(%this) +{ + $HDRPostFX::keyValue = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRMinLuminance::onMouseDragged(%this) +{ + $HDRPostFX::minLuminace = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRWhiteCutoff::onMouseDragged(%this) +{ + $HDRPostFX::whiteCutoff = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBrightnessAdaptRate::onMouseDragged(%this) +{ + $HDRPostFX::adaptRate = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//Blur tab +function ppOptionsHDRBloomBlurBrightPassThreshold::onMouseDragged(%this) +{ + $HDRPostFX::brightPassThreshold = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloomBlurMultiplier::onMouseDragged(%this) +{ + $HDRPostFX::gaussMultiplier = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloomBlurMean::onMouseDragged(%this) +{ + $HDRPostFX::gaussMean = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloomBlurStdDev::onMouseDragged(%this) +{ + $HDRPostFX::gaussStdDev = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloom::onAction(%this) +{ + $HDRPostFX::enableBloom = %this.getValue(); +} + +function ppOptionsHDRToneMapping::onAction(%this) +{ + //$HDRPostFX::enableToneMapping = %this.getValue(); +} + +function ppOptionsHDREffectsBlueShift::onAction(%this) +{ + $HDRPostFX::enableBlueShift = %this.getValue(); +} + + +//Controls for color range in blue Shift dialog + +function ppOptionsHDREffectsBlueShiftColorBlend::onAction(%this) +{ + $HDRPostFX::blueShiftColor = %this.PickColor; + %this.ToolTip = "Color Values : " @ %this.PickColor; +} + +function ppOptionsHDREffectsBlueShiftColorBaseColor::onAction(%this) +{ + //This one feeds the one above + ppOptionsHDREffectsBlueShiftColorBlend.baseColor = %this.PickColor; + %this.ToolTip = "Color Values : " @ %this.PickColor; +} + + +//Light rays Brightness Slider Controls +function ppOptionsLightRaysBrightScalar::onMouseDragged(%this) +{ + $LightRayPostFX::brightScalar = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Number of Samples Slider Control +function ppOptionsLightRaysSampleScalar::onMouseDragged(%this) +{ + $LightRayPostFX::numSamples = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Density Slider Control +function ppOptionsLightRaysDensityScalar::onMouseDragged(%this) +{ + $LightRayPostFX::density = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Weight Slider Control +function ppOptionsLightRaysWeightScalar::onMouseDragged(%this) +{ + $LightRayPostFX::weight = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Decay Slider Control +function ppOptionsLightRaysDecayScalar::onMouseDragged(%this) +{ + $LightRayPostFX::decay = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + + +function ppOptionsUpdateDOFSettings() +{ + DOFPostEffect.setFocusParams( $DOFPostFx::BlurMin, $DOFPostFx::BlurMax, $DOFPostFx::FocusRangeMin, $DOFPostFx::FocusRangeMax, -($DOFPostFx::BlurCurveNear), $DOFPostFx::BlurCurveFar ); + + DOFPostEffect.setAutoFocus( $DOFPostFx::EnableAutoFocus ); + DOFPostEffect.setFocalDist(0); + + if($PostFXManager::PostFX::EnableDOF) + { + DOFPostEffect.enable(); + } + else + { + DOFPostEffect.disable(); + } +} + +//DOF General Tab +//DOF Toggles +function ppOptionsDOFEnableDOF::onAction(%this) +{ + $PostFXManager::PostFX::EnableDOF = %this.getValue(); + ppOptionsUpdateDOFSettings(); +} + + +function ppOptionsDOFEnableAutoFocus::onAction(%this) +{ + $DOFPostFx::EnableAutoFocus = %this.getValue(); + DOFPostEffect.setAutoFocus( %this.getValue() ); +} + +//DOF AutoFocus Slider controls +function ppOptionsDOFFarBlurMinSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurMin = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFFarBlurMaxSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurMax = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFFocusRangeMinSlider::onMouseDragged(%this) +{ + $DOFPostFx::FocusRangeMin = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFFocusRangeMaxSlider::onMouseDragged(%this) +{ + $DOFPostFx::FocusRangeMax = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFBlurCurveNearSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurCurveNear = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFBlurCurveFarSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurCurveFar = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsEnableHDRDebug::onAction(%this) +{ + if ( %this.getValue() ) + LuminanceVisPostFX.enable(); + else + LuminanceVisPostFX.disable(); +} + +function ppOptionsUpdateVignetteSettings() +{ + if($PostFXManager::PostFX::EnableVignette) + { + VignettePostEffect.enable(); + } + else + { + VignettePostEffect.disable(); + } +} + +function ppOptionsVignetteEnableVignette::onAction(%this) +{ + $PostFXManager::PostFX::EnableVignette = %this.getValue(); + ppOptionsUpdateVignetteSettings(); +} + +function ppColorCorrection_selectFile() +{ + %filter = "Image Files (*.png, *.jpg, *.dds, *.bmp, *.gif, *.jng. *.tga)|*.png;*.jpg;*.dds;*.bmp;*.gif;*.jng;*.tga|All Files (*.*)|*.*|"; + getLoadFilename( %filter, "ppColorCorrection_selectFileHandler"); +} + +function ppColorCorrection_selectFileHandler( %filename ) +{ + if ( %filename $= "" || !isFile( %filename ) ) + %filename = "core/postFX/images/null_color_ramp.png"; + else + %filename = makeRelativePath( %filename, getMainDotCsDir() ); + + $HDRPostFX::colorCorrectionRamp = %filename; + PostFXManager-->ColorCorrectionFileName.Text = %filename; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.settings.cs b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.settings.cs new file mode 100644 index 000000000..eefcd9b7e --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.settings.cs @@ -0,0 +1,439 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$PostFXManager::defaultPreset = "./default.postfxpreset.cs"; + +function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX) +{ + $PostFXManager::PostFX::Enabled = %bEnablePostFX; + + //if to enable the postFX, apply the ones that are enabled + if ( %bEnablePostFX ) + { + //SSAO, HDR, LightRays, DOF + + if ( $PostFXManager::PostFX::EnableSSAO ) + SSAOPostFx.enable(); + else + SSAOPostFx.disable(); + + if ( $PostFXManager::PostFX::EnableHDR ) + HDRPostFX.enable(); + else + HDRPostFX.disable(); + + if ( $PostFXManager::PostFX::EnableLightRays ) + LightRayPostFX.enable(); + else + LightRayPostFX.disable(); + + if ( $PostFXManager::PostFX::EnableDOF ) + DOFPostEffect.enable(); + else + DOFPostEffect.disable(); + + if ( $PostFXManager::PostFX::EnableVignette ) + VignettePostEffect.enable(); + else + VignettePostEffect.disable(); + + postVerbose("% - PostFX Manager - PostFX enabled"); + } + else + { + //Disable all postFX + + SSAOPostFx.disable(); + HDRPostFX.disable(); + LightRayPostFX.disable(); + DOFPostEffect.disable(); + VignettePostEffect.disable(); + + postVerbose("% - PostFX Manager - PostFX disabled"); + } + + VolFogGlowPostFx.disable(); +} + +function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable) +{ + %postEffect = 0; + + //Determine the postFX to enable, and apply the boolean + if(%sName $= "SSAO") + { + %postEffect = SSAOPostFx; + $PostFXManager::PostFX::EnableSSAO = %bEnable; + //$pref::PostFX::SSAO::Enabled = %bEnable; + } + else if(%sName $= "HDR") + { + %postEffect = HDRPostFX; + $PostFXManager::PostFX::EnableHDR = %bEnable; + //$pref::PostFX::HDR::Enabled = %bEnable; + } + else if(%sName $= "LightRays") + { + %postEffect = LightRayPostFX; + $PostFXManager::PostFX::EnableLightRays = %bEnable; + //$pref::PostFX::LightRays::Enabled = %bEnable; + } + else if(%sName $= "DOF") + { + %postEffect = DOFPostEffect; + $PostFXManager::PostFX::EnableDOF = %bEnable; + //$pref::PostFX::DOF::Enabled = %bEnable; + } + else if(%sName $= "Vignette") + { + %postEffect = VignettePostEffect; + $PostFXManager::PostFX::EnableVignette = %bEnable; + //$pref::PostFX::Vignette::Enabled = %bEnable; + } + + // Apply the change + if ( %bEnable == true ) + { + %postEffect.enable(); + postVerbose("% - PostFX Manager - " @ %sName @ " enabled"); + } + else + { + %postEffect.disable(); + postVerbose("% - PostFX Manager - " @ %sName @ " disabled"); + } +} + +function PostFXManager::settingsRefreshSSAO(%this) +{ + //Apply the enabled flag + ppOptionsEnableSSAO.setValue($PostFXManager::PostFX::EnableSSAO); + + //Add the items we need to display + ppOptionsSSAOQuality.clear(); + ppOptionsSSAOQuality.add("Low", 0); + ppOptionsSSAOQuality.add("Medium", 1); + ppOptionsSSAOQuality.add("High", 2); + + //Set the selected, after adding the items! + ppOptionsSSAOQuality.setSelected($SSAOPostFx::quality); + + //SSAO - Set the values of the sliders, General Tab + ppOptionsSSAOOverallStrength.setValue($SSAOPostFx::overallStrength); + ppOptionsSSAOBlurDepth.setValue($SSAOPostFx::blurDepthTol); + ppOptionsSSAOBlurNormal.setValue($SSAOPostFx::blurNormalTol); + + //SSAO - Set the values for the near tab + ppOptionsSSAONearDepthMax.setValue($SSAOPostFx::sDepthMax); + ppOptionsSSAONearDepthMin.setValue($SSAOPostFx::sDepthMin); + ppOptionsSSAONearRadius.setValue($SSAOPostFx::sRadius); + ppOptionsSSAONearStrength.setValue($SSAOPostFx::sStrength); + ppOptionsSSAONearToleranceNormal.setValue($SSAOPostFx::sNormalTol); + ppOptionsSSAONearTolerancePower.setValue($SSAOPostFx::sNormalPow); + + //SSAO - Set the values for the far tab + ppOptionsSSAOFarDepthMax.setValue($SSAOPostFx::lDepthMax); + ppOptionsSSAOFarDepthMin.setValue($SSAOPostFx::lDepthMin); + ppOptionsSSAOFarRadius.setValue($SSAOPostFx::lRadius); + ppOptionsSSAOFarStrength.setValue($SSAOPostFx::lStrength); + ppOptionsSSAOFarToleranceNormal.setValue($SSAOPostFx::lNormalTol); + ppOptionsSSAOFarTolerancePower.setValue($SSAOPostFx::lNormalPow); +} + +function PostFXManager::settingsRefreshHDR(%this) +{ + //Apply the enabled flag + ppOptionsEnableHDR.setValue($PostFXManager::PostFX::EnableHDR); + + ppOptionsHDRBloom.setValue($HDRPostFX::enableBloom); + ppOptionsHDRBloomBlurBrightPassThreshold.setValue($HDRPostFX::brightPassThreshold); + ppOptionsHDRBloomBlurMean.setValue($HDRPostFX::gaussMean); + ppOptionsHDRBloomBlurMultiplier.setValue($HDRPostFX::gaussMultiplier); + ppOptionsHDRBloomBlurStdDev.setValue($HDRPostFX::gaussStdDev); + ppOptionsHDRBrightnessAdaptRate.setValue($HDRPostFX::adaptRate); + ppOptionsHDREffectsBlueShift.setValue($HDRPostFX::enableBlueShift); + ppOptionsHDREffectsBlueShiftColor.BaseColor = $HDRPostFX::blueShiftColor; + ppOptionsHDREffectsBlueShiftColor.PickColor = $HDRPostFX::blueShiftColor; + ppOptionsHDRKeyValue.setValue($HDRPostFX::keyValue); + ppOptionsHDRMinLuminance.setValue($HDRPostFX::minLuminace); + ppOptionsHDRToneMapping.setValue($HDRPostFX::enableToneMapping); + ppOptionsHDRToneMappingAmount.setValue($HDRPostFX::enableToneMapping); + ppOptionsHDRWhiteCutoff.setValue($HDRPostFX::whiteCutoff); + + %this-->ColorCorrectionFileName.Text = $HDRPostFX::colorCorrectionRamp; +} + +function PostFXManager::settingsRefreshLightrays(%this) +{ + //Apply the enabled flag + ppOptionsEnableLightRays.setValue($PostFXManager::PostFX::EnableLightRays); + + ppOptionsLightRaysBrightScalar.setValue($LightRayPostFX::brightScalar); + + ppOptionsLightRaysSampleScalar.setValue($LightRayPostFX::numSamples); + ppOptionsLightRaysDensityScalar.setValue($LightRayPostFX::density); + ppOptionsLightRaysWeightScalar.setValue($LightRayPostFX::weight); + ppOptionsLightRaysDecayScalar.setValue($LightRayPostFX::decay); +} + +function PostFXManager::settingsRefreshDOF(%this) +{ + //Apply the enabled flag + ppOptionsEnableDOF.setValue($PostFXManager::PostFX::EnableDOF); + + + //ppOptionsDOFEnableDOF.setValue($PostFXManager::PostFX::EnableDOF); + ppOptionsDOFEnableAutoFocus.setValue($DOFPostFx::EnableAutoFocus); + + ppOptionsDOFFarBlurMinSlider.setValue($DOFPostFx::BlurMin); + ppOptionsDOFFarBlurMaxSlider.setValue($DOFPostFx::BlurMax); + + ppOptionsDOFFocusRangeMinSlider.setValue($DOFPostFx::FocusRangeMin); + ppOptionsDOFFocusRangeMaxSlider.setValue($DOFPostFx::FocusRangeMax); + + ppOptionsDOFBlurCurveNearSlider.setValue($DOFPostFx::BlurCurveNear); + ppOptionsDOFBlurCurveFarSlider.setValue($DOFPostFx::BlurCurveFar); + +} + +function PostFXManager::settingsRefreshVignette(%this) +{ + //Apply the enabled flag + ppOptionsEnableVignette.setValue($PostFXManager::PostFX::EnableVignette); + +} + +function PostFXManager::settingsRefreshAll(%this) +{ + $PostFXManager::PostFX::Enabled = $pref::enablePostEffects; + $PostFXManager::PostFX::EnableSSAO = SSAOPostFx.isEnabled(); + $PostFXManager::PostFX::EnableHDR = HDRPostFX.isEnabled(); + $PostFXManager::PostFX::EnableLightRays = LightRayPostFX.isEnabled(); + $PostFXManager::PostFX::EnableDOF = DOFPostEffect.isEnabled(); + $PostFXManager::PostFX::EnableVignette = VignettePostEffect.isEnabled(); + + //For all the postFX here, apply the active settings in the system + //to the gui controls. + + %this.settingsRefreshSSAO(); + %this.settingsRefreshHDR(); + %this.settingsRefreshLightrays(); + %this.settingsRefreshDOF(); + %this.settingsRefreshVignette(); + + ppOptionsEnable.setValue($PostFXManager::PostFX::Enabled); + + postVerbose("% - PostFX Manager - GUI values updated."); +} + +function PostFXManager::settingsApplyFromPreset(%this) +{ + postVerbose("% - PostFX Manager - Applying from preset"); + + //SSAO Settings + $SSAOPostFx::blurDepthTol = $PostFXManager::Settings::SSAO::blurDepthTol; + $SSAOPostFx::blurNormalTol = $PostFXManager::Settings::SSAO::blurNormalTol; + $SSAOPostFx::lDepthMax = $PostFXManager::Settings::SSAO::lDepthMax; + $SSAOPostFx::lDepthMin = $PostFXManager::Settings::SSAO::lDepthMin; + $SSAOPostFx::lDepthPow = $PostFXManager::Settings::SSAO::lDepthPow; + $SSAOPostFx::lNormalPow = $PostFXManager::Settings::SSAO::lNormalPow; + $SSAOPostFx::lNormalTol = $PostFXManager::Settings::SSAO::lNormalTol; + $SSAOPostFx::lRadius = $PostFXManager::Settings::SSAO::lRadius; + $SSAOPostFx::lStrength = $PostFXManager::Settings::SSAO::lStrength; + $SSAOPostFx::overallStrength = $PostFXManager::Settings::SSAO::overallStrength; + $SSAOPostFx::quality = $PostFXManager::Settings::SSAO::quality; + $SSAOPostFx::sDepthMax = $PostFXManager::Settings::SSAO::sDepthMax; + $SSAOPostFx::sDepthMin = $PostFXManager::Settings::SSAO::sDepthMin; + $SSAOPostFx::sDepthPow = $PostFXManager::Settings::SSAO::sDepthPow; + $SSAOPostFx::sNormalPow = $PostFXManager::Settings::SSAO::sNormalPow; + $SSAOPostFx::sNormalTol = $PostFXManager::Settings::SSAO::sNormalTol; + $SSAOPostFx::sRadius = $PostFXManager::Settings::SSAO::sRadius; + $SSAOPostFx::sStrength = $PostFXManager::Settings::SSAO::sStrength; + + //HDR settings + $HDRPostFX::adaptRate = $PostFXManager::Settings::HDR::adaptRate; + $HDRPostFX::blueShiftColor = $PostFXManager::Settings::HDR::blueShiftColor; + $HDRPostFX::brightPassThreshold = $PostFXManager::Settings::HDR::brightPassThreshold; + $HDRPostFX::enableBloom = $PostFXManager::Settings::HDR::enableBloom; + $HDRPostFX::enableBlueShift = $PostFXManager::Settings::HDR::enableBlueShift; + $HDRPostFX::enableToneMapping = $PostFXManager::Settings::HDR::enableToneMapping; + $HDRPostFX::gaussMean = $PostFXManager::Settings::HDR::gaussMean; + $HDRPostFX::gaussMultiplier = $PostFXManager::Settings::HDR::gaussMultiplier; + $HDRPostFX::gaussStdDev = $PostFXManager::Settings::HDR::gaussStdDev; + $HDRPostFX::keyValue = $PostFXManager::Settings::HDR::keyValue; + $HDRPostFX::minLuminace = $PostFXManager::Settings::HDR::minLuminace; + $HDRPostFX::whiteCutoff = $PostFXManager::Settings::HDR::whiteCutoff; + $HDRPostFX::colorCorrectionRamp = $PostFXManager::Settings::ColorCorrectionRamp; + + //Light rays settings + $LightRayPostFX::brightScalar = $PostFXManager::Settings::LightRays::brightScalar; + + $LightRayPostFX::numSamples = $PostFXManager::Settings::LightRays::numSamples; + $LightRayPostFX::density = $PostFXManager::Settings::LightRays::density; + $LightRayPostFX::weight = $PostFXManager::Settings::LightRays::weight; + $LightRayPostFX::decay = $PostFXManager::Settings::LightRays::decay; + + //DOF settings + $DOFPostFx::EnableAutoFocus = $PostFXManager::Settings::DOF::EnableAutoFocus; + $DOFPostFx::BlurMin = $PostFXManager::Settings::DOF::BlurMin; + $DOFPostFx::BlurMax = $PostFXManager::Settings::DOF::BlurMax; + $DOFPostFx::FocusRangeMin = $PostFXManager::Settings::DOF::FocusRangeMin; + $DOFPostFx::FocusRangeMax = $PostFXManager::Settings::DOF::FocusRangeMax; + $DOFPostFx::BlurCurveNear = $PostFXManager::Settings::DOF::BlurCurveNear; + $DOFPostFx::BlurCurveFar = $PostFXManager::Settings::DOF::BlurCurveFar; + + //Vignette settings + $VignettePostEffect::VMax = $PostFXManager::Settings::Vignette::VMax; + $VignettePostEffect::VMin = $PostFXManager::Settings::Vignette::VMin; + + if ( $PostFXManager::forceEnableFromPresets ) + { + $PostFXManager::PostFX::Enabled = $PostFXManager::Settings::EnablePostFX; + $PostFXManager::PostFX::EnableDOF = $pref::PostFX::EnableDOF ? $PostFXManager::Settings::EnableDOF : false; + $PostFXManager::PostFX::EnableVignette = $pref::PostFX::EnableVignette ? $PostFXManager::Settings::EnableVignette : false; + $PostFXManager::PostFX::EnableLightRays = $pref::PostFX::EnableLightRays ? $PostFXManager::Settings::EnableLightRays : false; + $PostFXManager::PostFX::EnableHDR = $pref::PostFX::EnableHDR ? $PostFXManager::Settings::EnableHDR : false; + $PostFXManager::PostFX::EnableSSAO = $pref::PostFX::EnabledSSAO ? $PostFXManager::Settings::EnableSSAO : false; + + %this.settingsSetEnabled( true ); + } + + //make sure we apply the correct settings to the DOF + ppOptionsUpdateDOFSettings(); + + // Update the actual GUI controls if its awake ( otherwise it will when opened ). + if ( PostFXManager.isAwake() ) + %this.settingsRefreshAll(); +} + +function PostFXManager::settingsApplySSAO(%this) +{ + $PostFXManager::Settings::SSAO::blurDepthTol = $SSAOPostFx::blurDepthTol; + $PostFXManager::Settings::SSAO::blurNormalTol = $SSAOPostFx::blurNormalTol; + $PostFXManager::Settings::SSAO::lDepthMax = $SSAOPostFx::lDepthMax; + $PostFXManager::Settings::SSAO::lDepthMin = $SSAOPostFx::lDepthMin; + $PostFXManager::Settings::SSAO::lDepthPow = $SSAOPostFx::lDepthPow; + $PostFXManager::Settings::SSAO::lNormalPow = $SSAOPostFx::lNormalPow; + $PostFXManager::Settings::SSAO::lNormalTol = $SSAOPostFx::lNormalTol; + $PostFXManager::Settings::SSAO::lRadius = $SSAOPostFx::lRadius; + $PostFXManager::Settings::SSAO::lStrength = $SSAOPostFx::lStrength; + $PostFXManager::Settings::SSAO::overallStrength = $SSAOPostFx::overallStrength; + $PostFXManager::Settings::SSAO::quality = $SSAOPostFx::quality; + $PostFXManager::Settings::SSAO::sDepthMax = $SSAOPostFx::sDepthMax; + $PostFXManager::Settings::SSAO::sDepthMin = $SSAOPostFx::sDepthMin; + $PostFXManager::Settings::SSAO::sDepthPow = $SSAOPostFx::sDepthPow; + $PostFXManager::Settings::SSAO::sNormalPow = $SSAOPostFx::sNormalPow; + $PostFXManager::Settings::SSAO::sNormalTol = $SSAOPostFx::sNormalTol; + $PostFXManager::Settings::SSAO::sRadius = $SSAOPostFx::sRadius; + $PostFXManager::Settings::SSAO::sStrength = $SSAOPostFx::sStrength; + + postVerbose("% - PostFX Manager - Settings Saved - SSAO"); + +} + +function PostFXManager::settingsApplyHDR(%this) +{ + $PostFXManager::Settings::HDR::adaptRate = $HDRPostFX::adaptRate; + $PostFXManager::Settings::HDR::blueShiftColor = $HDRPostFX::blueShiftColor; + $PostFXManager::Settings::HDR::brightPassThreshold = $HDRPostFX::brightPassThreshold; + $PostFXManager::Settings::HDR::enableBloom = $HDRPostFX::enableBloom; + $PostFXManager::Settings::HDR::enableBlueShift = $HDRPostFX::enableBlueShift; + $PostFXManager::Settings::HDR::enableToneMapping = $HDRPostFX::enableToneMapping; + $PostFXManager::Settings::HDR::gaussMean = $HDRPostFX::gaussMean; + $PostFXManager::Settings::HDR::gaussMultiplier = $HDRPostFX::gaussMultiplier; + $PostFXManager::Settings::HDR::gaussStdDev = $HDRPostFX::gaussStdDev; + $PostFXManager::Settings::HDR::keyValue = $HDRPostFX::keyValue; + $PostFXManager::Settings::HDR::minLuminace = $HDRPostFX::minLuminace; + $PostFXManager::Settings::HDR::whiteCutoff = $HDRPostFX::whiteCutoff; + $PostFXManager::Settings::ColorCorrectionRamp = $HDRPostFX::colorCorrectionRamp; + + postVerbose("% - PostFX Manager - Settings Saved - HDR"); +} + +function PostFXManager::settingsApplyLightRays(%this) +{ + $PostFXManager::Settings::LightRays::brightScalar = $LightRayPostFX::brightScalar; + + $PostFXManager::Settings::LightRays::numSamples = $LightRayPostFX::numSamples; + $PostFXManager::Settings::LightRays::density = $LightRayPostFX::density; + $PostFXManager::Settings::LightRays::weight = $LightRayPostFX::weight; + $PostFXManager::Settings::LightRays::decay = $LightRayPostFX::decay; + + postVerbose("% - PostFX Manager - Settings Saved - Light Rays"); + +} + +function PostFXManager::settingsApplyDOF(%this) +{ + $PostFXManager::Settings::DOF::EnableAutoFocus = $DOFPostFx::EnableAutoFocus; + $PostFXManager::Settings::DOF::BlurMin = $DOFPostFx::BlurMin; + $PostFXManager::Settings::DOF::BlurMax = $DOFPostFx::BlurMax; + $PostFXManager::Settings::DOF::FocusRangeMin = $DOFPostFx::FocusRangeMin; + $PostFXManager::Settings::DOF::FocusRangeMax = $DOFPostFx::FocusRangeMax; + $PostFXManager::Settings::DOF::BlurCurveNear = $DOFPostFx::BlurCurveNear; + $PostFXManager::Settings::DOF::BlurCurveFar = $DOFPostFx::BlurCurveFar; + + postVerbose("% - PostFX Manager - Settings Saved - DOF"); + +} + +function PostFXManager::settingsApplyVignette(%this) +{ + $PostFXManager::Settings::Vignette::VMax = $VignettePostEffect::VMax; + $PostFXManager::Settings::Vignette::VMin = $VignettePostEffect::VMin; + + postVerbose("% - PostFX Manager - Settings Saved - Vignette"); + +} + +function PostFXManager::settingsApplyAll(%this, %sFrom) +{ + // Apply settings which control if effects are on/off altogether. + $PostFXManager::Settings::EnablePostFX = $PostFXManager::PostFX::Enabled; + $PostFXManager::Settings::EnableDOF = $PostFXManager::PostFX::EnableDOF; + $PostFXManager::Settings::EnableVignette = $PostFXManager::PostFX::EnableVignette; + $PostFXManager::Settings::EnableLightRays = $PostFXManager::PostFX::EnableLightRays; + $PostFXManager::Settings::EnableHDR = $PostFXManager::PostFX::EnableHDR; + $PostFXManager::Settings::EnableSSAO = $PostFXManager::PostFX::EnableSSAO; + + // Apply settings should save the values in the system to the + // the preset structure ($PostFXManager::Settings::*) + + // SSAO Settings + %this.settingsApplySSAO(); + // HDR settings + %this.settingsApplyHDR(); + // Light rays settings + %this.settingsApplyLightRays(); + // DOF + %this.settingsApplyDOF(); + // Vignette + %this.settingsApplyVignette(); + + postVerbose("% - PostFX Manager - All Settings applied to $PostFXManager::Settings"); +} + +function PostFXManager::settingsApplyDefaultPreset(%this) +{ + PostFXManager::loadPresetHandler($PostFXManager::defaultPreset); +} + diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFxManager.persistance.cs b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.persistance.cs new file mode 100644 index 000000000..31fec95f1 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.persistance.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +// Used to name the saved files. +$PostFXManager::fileExtension = ".postfxpreset.cs"; + +// The filter string for file open/save dialogs. +$PostFXManager::fileFilter = "Post Effect Presets|*.postfxpreset.cs"; + +// Enable / disable PostFX when loading presets or just apply the settings? +$PostFXManager::forceEnableFromPresets = true; + +//Load a preset file from the disk, and apply the settings to the +//controls. If bApplySettings is true - the actual values in the engine +//will be changed to reflect the settings from the file. +function PostFXManager::loadPresetFile() +{ + //Show the dialog and set the flag + getLoadFilename($PostFXManager::fileFilter, "PostFXManager::loadPresetHandler"); +} + +function PostFXManager::loadPresetHandler( %filename ) +{ + //Check the validity of the file + if ( isScriptFile( %filename ) ) + { + %filename = expandFilename(%filename); + postVerbose("% - PostFX Manager - Executing " @ %filename); + exec(%filename); + + PostFXManager.settingsApplyFromPreset(); + } +} + +//Save a preset file to the specified file. The extension used +//is specified by $PostFXManager::fileExtension for on the fly +//name changes to the extension used. + +function PostFXManager::savePresetFile(%this) +{ + %defaultFile = filePath($Client::MissionFile) @ "/" @ fileBase($Client::MissionFile); + getSaveFilename($PostFXManager::fileFilter, "PostFXManager::savePresetHandler", %defaultFile); +} + +//Called from the PostFXManager::savePresetFile() function +function PostFXManager::savePresetHandler( %filename ) +{ + %filename = makeRelativePath( %filename, getMainDotCsDir() ); + if(strStr(%filename, ".") == -1) + %filename = %filename @ $PostFXManager::fileExtension; + + //Apply the current settings to the preset + PostFXManager.settingsApplyAll(); + + export("$PostFXManager::Settings::*", %filename, false); + + postVerbose("% - PostFX Manager - Save complete. Preset saved at : " @ %filename); +} + diff --git a/Templates/BaseGame/game/core/postFX/scripts/ssao.cs b/Templates/BaseGame/game/core/postFX/scripts/ssao.cs new file mode 100644 index 000000000..5fe405a82 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/ssao.cs @@ -0,0 +1,302 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +/// +$SSAOPostFx::overallStrength = 2.0; + +// TODO: Add small/large param docs. + +// The small radius SSAO settings. +$SSAOPostFx::sRadius = 0.1; +$SSAOPostFx::sStrength = 6.0; +$SSAOPostFx::sDepthMin = 0.1; +$SSAOPostFx::sDepthMax = 1.0; +$SSAOPostFx::sDepthPow = 1.0; +$SSAOPostFx::sNormalTol = 0.0; +$SSAOPostFx::sNormalPow = 1.0; + +// The large radius SSAO settings. +$SSAOPostFx::lRadius = 1.0; +$SSAOPostFx::lStrength = 10.0; +$SSAOPostFx::lDepthMin = 0.2; +$SSAOPostFx::lDepthMax = 2.0; +$SSAOPostFx::lDepthPow = 0.2; +$SSAOPostFx::lNormalTol = -0.5; +$SSAOPostFx::lNormalPow = 2.0; + +/// Valid values: 0, 1, 2 +$SSAOPostFx::quality = 0; + +/// +$SSAOPostFx::blurDepthTol = 0.001; + +/// +$SSAOPostFx::blurNormalTol = 0.95; + +/// +$SSAOPostFx::targetScale = "0.5 0.5"; + + +function SSAOPostFx::onAdd( %this ) +{ + %this.wasVis = "Uninitialized"; + %this.quality = "Uninitialized"; +} + +function SSAOPostFx::preProcess( %this ) +{ + if ( $SSAOPostFx::quality !$= %this.quality ) + { + %this.quality = mClamp( mRound( $SSAOPostFx::quality ), 0, 2 ); + + %this.setShaderMacro( "QUALITY", %this.quality ); + } + + %this.targetScale = $SSAOPostFx::targetScale; +} + +function SSAOPostFx::setShaderConsts( %this ) +{ + %this.setShaderConst( "$overallStrength", $SSAOPostFx::overallStrength ); + + // Abbreviate is s-small l-large. + + %this.setShaderConst( "$sRadius", $SSAOPostFx::sRadius ); + %this.setShaderConst( "$sStrength", $SSAOPostFx::sStrength ); + %this.setShaderConst( "$sDepthMin", $SSAOPostFx::sDepthMin ); + %this.setShaderConst( "$sDepthMax", $SSAOPostFx::sDepthMax ); + %this.setShaderConst( "$sDepthPow", $SSAOPostFx::sDepthPow ); + %this.setShaderConst( "$sNormalTol", $SSAOPostFx::sNormalTol ); + %this.setShaderConst( "$sNormalPow", $SSAOPostFx::sNormalPow ); + + %this.setShaderConst( "$lRadius", $SSAOPostFx::lRadius ); + %this.setShaderConst( "$lStrength", $SSAOPostFx::lStrength ); + %this.setShaderConst( "$lDepthMin", $SSAOPostFx::lDepthMin ); + %this.setShaderConst( "$lDepthMax", $SSAOPostFx::lDepthMax ); + %this.setShaderConst( "$lDepthPow", $SSAOPostFx::lDepthPow ); + %this.setShaderConst( "$lNormalTol", $SSAOPostFx::lNormalTol ); + %this.setShaderConst( "$lNormalPow", $SSAOPostFx::lNormalPow ); + + %blur = %this->blurY; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); + + %blur = %this->blurX; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); + + %blur = %this->blurY2; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); + + %blur = %this->blurX2; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); +} + +function SSAOPostFx::onEnabled( %this ) +{ + // This tells the AL shaders to reload and sample + // from our #ssaoMask texture target. + $AL::UseSSAOMask = true; + + return true; +} + +function SSAOPostFx::onDisabled( %this ) +{ + $AL::UseSSAOMask = false; +} + + +//----------------------------------------------------------------------------- +// GFXStateBlockData / ShaderData +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( SSAOStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerWrapLinear; + samplerStates[2] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( SSAOBlurStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampPoint; +}; + +singleton ShaderData( SSAOShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_P.glsl"; + + samplerNames[0] = "$deferredMap"; + samplerNames[1] = "$randNormalTex"; + samplerNames[2] = "$powTable"; + + pixVersion = 3.0; +}; + +singleton ShaderData( SSAOBlurYShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_Blur_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_Blur_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_P.glsl"; + + samplerNames[0] = "$occludeMap"; + samplerNames[1] = "$deferredMap"; + + pixVersion = 3.0; + + defines = "BLUR_DIR=float2(0.0,1.0)"; +}; + +singleton ShaderData( SSAOBlurXShader : SSAOBlurYShader ) +{ + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + +//----------------------------------------------------------------------------- +// PostEffects +//----------------------------------------------------------------------------- + +singleton PostEffect( SSAOPostFx ) +{ + allowReflectPass = false; + + renderTime = "PFXBeforeBin"; + renderBin = "AL_LightBinMgr"; + renderPriority = 10; + + shader = SSAOShader; + stateBlock = SSAOStateBlock; + + texture[0] = "#deferred"; + texture[1] = "core/postFX/images/noise.png"; + texture[2] = "#ssao_pow_table"; + + target = "$outTex"; + targetScale = "0.5 0.5"; + targetViewport = "PFXTargetViewport_NamedInTexture0"; + + singleton PostEffect() + { + internalName = "blurY"; + + shader = SSAOBlurYShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + target = "$outTex"; + }; + + singleton PostEffect() + { + internalName = "blurX"; + + shader = SSAOBlurXShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + target = "$outTex"; + }; + + singleton PostEffect() + { + internalName = "blurY2"; + + shader = SSAOBlurYShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + target = "$outTex"; + }; + + singleton PostEffect() + { + internalName = "blurX2"; + + shader = SSAOBlurXShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + // We write to a mask texture which is then + // read by the lighting shaders to mask ambient. + target = "#ssaoMask"; + }; +}; + + +/// Just here for debug visualization of the +/// SSAO mask texture used during lighting. +singleton PostEffect( SSAOVizPostFx ) +{ + allowReflectPass = false; + + shader = PFX_PassthruShader; + stateBlock = PFX_DefaultStateBlock; + + texture[0] = "#ssaoMask"; + + target = "$backbuffer"; +}; + +singleton ShaderData( SSAOPowTableShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_PowerTable_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_PowerTable_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_PowerTable_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_PowerTable_P.glsl"; + + pixVersion = 2.0; +}; + +singleton PostEffect( SSAOPowTablePostFx ) +{ + shader = SSAOPowTableShader; + stateBlock = PFX_DefaultStateBlock; + + renderTime = "PFXTexGenOnDemand"; + + target = "#ssao_pow_table"; + + targetFormat = "GFXFormatR16F"; + targetSize = "256 1"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/turbulence.cs b/Templates/BaseGame/game/core/postFX/scripts/turbulence.cs new file mode 100644 index 000000000..967c3b2bf --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/turbulence.cs @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( PFX_TurbulenceStateBlock : PFX_DefaultStateBlock) +{ + zDefined = false; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton ShaderData( PFX_TurbulenceShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/turbulenceP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/turbulenceP.glsl"; + + samplerNames[0] = "$inputTex"; + pixVersion = 3.0; +}; + +singleton PostEffect( TurbulenceFx ) +{ + isEnabled = false; + allowReflectPass = true; + + renderTime = "PFXAfterDiffuse"; + renderBin = "GlowBin"; + renderPriority = 0.5; // Render after the glows themselves + + shader = PFX_TurbulenceShader; + stateBlock=PFX_TurbulenceStateBlock; + texture[0] = "$backBuffer"; + }; diff --git a/Templates/BaseGame/game/core/postFX/scripts/vignette.cs b/Templates/BaseGame/game/core/postFX/scripts/vignette.cs new file mode 100644 index 000000000..d22f7d14a --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/vignette.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$VignettePostEffect::VMax = 0.6; +$VignettePostEffect::VMin = 0.2; + +singleton ShaderData( VignetteShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/vignette/VignetteP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/vignette/gl/VignetteP.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 2.0; +}; + +singleton PostEffect( VignettePostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = VignetteShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function VignettePostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$Vmax", $VignettePostEffect::VMax); + %this.setShaderConst("$Vmin", $VignettePostEffect::VMin); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/Core_Rendering.cs b/Templates/BaseGame/game/core/rendering/Core_Rendering.cs new file mode 100644 index 000000000..d09e0cbe3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/Core_Rendering.cs @@ -0,0 +1,20 @@ + +function Core_Rendering::onCreate(%this) +{ + $Core::MissingTexturePath = "core/rendering/images/missingTexture"; + $Core::UnAvailableTexturePath = "core/rendering/images/unavailable"; + $Core::WarningTexturePath = "core/rendering/images/warnMat"; + $Core::CommonShaderPath = "core/rendering/shaders"; + + exec("./scripts/renderManager.cs"); + exec("./scripts/gfxData/clouds.cs"); + exec("./scripts/gfxData/commonMaterialData.cs"); + exec("./scripts/gfxData/scatterSky.cs"); + exec("./scripts/gfxData/shaders.cs"); + exec("./scripts/gfxData/terrainBlock.cs"); + exec("./scripts/gfxData/water.cs"); +} + +function Core_Rendering::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/Core_Rendering.module b/Templates/BaseGame/game/core/rendering/Core_Rendering.module new file mode 100644 index 000000000..9dbbfc33a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/Core_Rendering.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/images/materials.cs b/Templates/BaseGame/game/core/rendering/images/materials.cs new file mode 100644 index 000000000..a13c751b3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/images/materials.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton Material( Empty ) +{ +}; + +singleton Material(WarningMaterial) { + detailMap[0] = "missingTexture"; + diffuseColor[0] = "25 16 0"; + emissive[0] = false; + translucent = false; +}; diff --git a/Templates/BaseGame/game/core/rendering/images/missingTexture.png b/Templates/BaseGame/game/core/rendering/images/missingTexture.png new file mode 100644 index 0000000000000000000000000000000000000000..80a7874da967ad523e1a3308f3f14c66d4eed503 GIT binary patch literal 10645 zcmeHt_g_=nv-S>MP*4G}5D zE)M{}2HO)>E&w0_UP=IR;uB`OWifby#JJe}1(bZ=$pUYrf{!^I1Ay{Og|)NN;Jrq` z2^R+dNYVlT{1pIL1%JX%0zljW0ATwAz>!A)pca`+I&~C$ur=1&Bla{ZC>DJ-IuLL^ z8xj$#?`VBSBi=~g$mHe34;TRG%-UKVJCoqY8R)nTt4Wj@8hvs%d{1KNr?xiU)_B0| z+7+EhAVlIH#XmZ9|CID_(Qv5yDZOXu@y5f{V}%$}%egGwEtKGbJP%!*l4r70&kBpO zHi%9chC(Eya@_q?(O0*?p4!+(o;xCRQ=&;Y;#LgNMEO9jm0 zw}{`q`1Ct2eq-c!zW6_Lr@r3Y%m6t>I4~;|)=&gvH`G!D?kNuhvyDpT%hMtec4+{e zt=~VykQXQAAhi<=?Dr{)s%IsBk-+%(|fnO4tz)x-~$ zcAw2-a%xb_wdH0DecftgWwrtG^PBTw#Zp22La(0q0bG(4;=ArRgjEyMae9QAwYC;) zG1ctS8Pk!YZ`v5o zYUJDYch3JMVHA;~_G8Mp8;V>0d+kSm&wNLYXmM3Gkje=q`6Ofy zD_zR&n+?%K@M_94S*HU13tQRHJ{CgTl0%r1n1ES&cD_1U19(;Q>v8{&UR^?kmcn>)s426(+T;E$x zxm@3o^_?CvxwRVhj(VVvwyvmC!?o?8o_js@i@$RjLa$qqC=0l?bX*e$ zbzTsYADRrT$8GFJoi+>n3%)|ncitA+R-t?NCGhA>!Qhq^ADZT1)s(w$>r)g%ixVMe z^DLTBro?u}lhmfdJ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.dds b/Templates/BaseGame/game/core/rendering/images/warnMat.dds new file mode 100644 index 0000000000000000000000000000000000000000..ea99dcbd74a8b2ae49c5cff5a69743498a66e937 GIT binary patch literal 699192 zcmeFaPi$M+p67Q(#Rw%q$lVCxuCM)|w4M~V{T2fJ7L9l5=?1EHs%~9T&ZsR?vxyfI zsJbygxsX^C8(DbKi&_Xl?Ia2f*klZ%fGCLvqZVm(77oyhDio(NUSwqH4PbCKf$})> zK(x$!f9LR!6h(@c5=l|gmq67qMe^Qr&pE%(@6Y+2bN=K{{@nQ=Ez9~Z?NQ76FYpif z&kD-_tTFX}|NnFFRr&d!EYAO`*{_1Od*;t>$tlSnS+X5C4k!oY069PokOSlZIY17O z1LOcXKn{=tbP?mEh4x0G{HM%>a}6jFwRD81ID`aV8azt6j+Y!2Ta>0>S?>#-q__zuK?WeVjr#I665w zc~jc8`_Ccz-TFrP=kceWh4zA)_i}DHIFIpvT8|g^R&40;d^w{^DEb86pH#|nIj!D{ z{+GX(_fn&(Or@-j%Fn4+>igz8<&wJIGA_I#_cx_i{%m~+2gfRQf;E=cc8V3)>3%zr zuifA)`-S6ZkjGJY9o)l9`78O82bwo~6|QOCm8-n#-us*zQ+|)~w*o`s*IiDa|1GHh zsL>y)9Z$+>;d-$L?I+i5)-U2WLj6h6oWt{TUZF(&Gsybq zx^w@!*Wc)W;mKYmJuSRRk6Ma%aBr;bP)x-)ds7xtZYdF(oDe@o@p|a`wr9*<#Y@`p zq`a5WdSf)8+bx~yP5Y(JT-P~H+*18t)%QUw{*9W4{|0`&vBz{gzNq~8s-EAI@g5Fl zQlnbG!+%%$7j~PJQ14ogr&0lVpT_t0LrIjDDp6QRq3w|9dsU{T+z%oAU-n<(_od43 z)%}uoDz2|zQuj&NrPM2BZ67%#jI?9%WG^En^ak_?xZc(FYkocFc-y{B{=dv4SypsO{NL4u z27QlsR>dAuahN?g@-oh$-Z8$#f8SGj9{#*~Z}dCdeXZAxJ};J2zjgLQc?4XfL~*A4 z(_dOv3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rLSZ%kckeDA|Fjp$!Hnn!`=7WnT7ODB zAEt?2<9RfNOy*=c$hcyImreT{2xz>Vr!oH7kD7lY?>h0>vJ2zjj_Kd!{1ZQq@=`V8 zMHqe8?B!GIW3dy!Pr*1+FJT^N zb-$bPYwmV!r+RkN4$aqk_Q-v$C!wE*5#9;=r{<_q!s_4|E zbJf7%56~YGRo-)exIt>q$QQF$albbaS5=%({m#2vh-0Rro)Mb5+BCt z+S}pl&A@R+oTy*^KF$4MAn92=uWW+_Whs_Gc^>ga54_&J+q6(sq0( zVY^r6&!XSz&aprT^al1kMtv%;zYgGk=Gz6wGwjM%^POQ?{^JD~UovJw108=HRI0jp z;G1jzz+Q&>-@Gx7`_R_VS2vJ9z8~KyJ66{JNb-NE{}<7I$#?(pI(G@(;;L#rqAq+3 z`xfeVQdh2^9|rK5pE!#}H(MyEs=xP3H9bu}Q_gvmJ9nu~a2Sn!27e2BVQ7ck6R+_! raGdj4Z)`w+6{m>%2LJK#4dUl7PN}gm$ggc?divbC*=z9`o}2kEfiE*! literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/clouds.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/clouds.cs new file mode 100644 index 000000000..00d56d6d3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/clouds.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +// CloudLayer +//------------------------------------------------------------------------------ + +singleton ShaderData( CloudLayerShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/cloudLayerV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/cloudLayerP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerP.glsl"; + + samplerNames[0] = "$normalHeightMap"; + + pixVersion = 2.0; +}; + +//------------------------------------------------------------------------------ +// BasicClouds +//------------------------------------------------------------------------------ + +singleton ShaderData( BasicCloudsShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/basicCloudsV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/basicCloudsP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsP.glsl"; + + samplerNames[0] = "$diffuseMap"; + + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/commonMaterialData.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/commonMaterialData.cs new file mode 100644 index 000000000..c5d8ef5bc --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/commonMaterialData.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Anim flag settings - must match material.h +// These cannot be enumed through script becuase it cannot +// handle the "|" operation for combining them together +// ie. Scroll | Wave does not work. +//----------------------------------------------------------------------------- +$scroll = 1; +$rotate = 2; +$wave = 4; +$scale = 8; +$sequence = 16; + + +// Common stateblock definitions +new GFXSamplerStateData(SamplerClampLinear) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXAddressClamp; + addressModeV = GFXAddressClamp; + addressModeW = GFXAddressClamp; + magFilter = GFXTextureFilterLinear; + minFilter = GFXTextureFilterLinear; + mipFilter = GFXTextureFilterLinear; +}; + +new GFXSamplerStateData(SamplerClampPoint) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXAddressClamp; + addressModeV = GFXAddressClamp; + addressModeW = GFXAddressClamp; + magFilter = GFXTextureFilterPoint; + minFilter = GFXTextureFilterPoint; + mipFilter = GFXTextureFilterPoint; +}; + +new GFXSamplerStateData(SamplerWrapLinear) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXTextureAddressWrap; + addressModeV = GFXTextureAddressWrap; + addressModeW = GFXTextureAddressWrap; + magFilter = GFXTextureFilterLinear; + minFilter = GFXTextureFilterLinear; + mipFilter = GFXTextureFilterLinear; +}; + +new GFXSamplerStateData(SamplerWrapPoint) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXTextureAddressWrap; + addressModeV = GFXTextureAddressWrap; + addressModeW = GFXTextureAddressWrap; + magFilter = GFXTextureFilterPoint; + minFilter = GFXTextureFilterPoint; + mipFilter = GFXTextureFilterPoint; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/scatterSky.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/scatterSky.cs new file mode 100644 index 000000000..5add01d8b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/scatterSky.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +new GFXStateBlockData( ScatterSkySBData ) +{ + cullMode = "GFXCullNone"; + + zDefined = true; + zEnable = true; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; + vertexColorEnable = true; +}; + +singleton ShaderData( ScatterSkyShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/scatterSkyV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/scatterSkyP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyP.glsl"; + + samplerNames[0] = "$nightSky"; + + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.cs new file mode 100644 index 000000000..da3b7c864 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.cs @@ -0,0 +1,152 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// This file contains shader data necessary for various engine utility functions +//----------------------------------------------------------------------------- + + +singleton ShaderData( ParticlesShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/particlesV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/particlesP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particlesV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particlesP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$deferredTex"; + samplerNames[2] = "$paraboloidLightMap"; + + pixVersion = 2.0; +}; + +singleton ShaderData( OffscreenParticleCompositeShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/particleCompositeV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/particleCompositeP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeP.glsl"; + + samplerNames[0] = "$colorSource"; + samplerNames[1] = "$edgeSource"; + + pixVersion = 2.0; +}; + +//----------------------------------------------------------------------------- +// Planar Reflection +//----------------------------------------------------------------------------- +new ShaderData( ReflectBump ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$refractMap"; + samplerNames[2] = "$bumpMap"; + + pixVersion = 2.0; +}; + +new ShaderData( Reflect ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$refractMap"; + + pixVersion = 1.4; +}; + +//----------------------------------------------------------------------------- +// fxFoliageReplicator +//----------------------------------------------------------------------------- +new ShaderData( fxFoliageReplicatorShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$alphaMap"; + + pixVersion = 1.4; +}; + +singleton ShaderData( VolumetricFogDeferredShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreP.glsl"; + + pixVersion = 3.0; +}; +singleton ShaderData( VolumetricFogShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogP.glsl"; + + samplerNames[0] = "$deferredTex"; + samplerNames[1] = "$depthBuffer"; + samplerNames[2] = "$frontBuffer"; + samplerNames[3] = "$density"; + + pixVersion = 3.0; +}; +singleton ShaderData( VolumetricFogReflectionShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogRefl.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogRefl.glsl"; + + pixVersion = 3.0; +}; +singleton ShaderData( CubemapSaveShader ) +{ + DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl"; + DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl"; + + OGLVertexShaderFile = "shaders/common/gl/cubemapSaveV.glsl"; + OGLPixelShaderFile = "shaders/common/gl/cubemapSaveP.glsl"; + + samplerNames[0] = "$cubemapTex"; + + pixVersion = 3.0; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/terrainBlock.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/terrainBlock.cs new file mode 100644 index 000000000..69802b1da --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/terrainBlock.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// Used when generating the blended base texture. +singleton ShaderData( TerrainBlendShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/terrain/blendV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/terrain/blendP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendP.glsl"; + + samplerNames[0] = "layerTex"; + samplerNames[1] = "textureMap"; + + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/water.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/water.cs new file mode 100644 index 000000000..ec5e4be71 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/water.cs @@ -0,0 +1,208 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + + +//----------------------------------------------------------------------------- +// Water +//----------------------------------------------------------------------------- + +singleton ShaderData( WaterShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterP.glsl"; + + samplerNames[0] = "$bumpMap"; // noise + samplerNames[1] = "$deferredTex"; // #deferred + samplerNames[2] = "$reflectMap"; // $reflectbuff + samplerNames[3] = "$refractBuff"; // $backbuff + samplerNames[4] = "$skyMap"; // $cubemap + samplerNames[5] = "$foamMap"; // foam + samplerNames[6] = "$depthGradMap"; // depthMap ( color gradient ) + + pixVersion = 3.0; +}; + +new GFXSamplerStateData(WaterSampler) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXAddressWrap; + addressModeV = GFXAddressWrap; + addressModeW = GFXAddressWrap; + magFilter = GFXTextureFilterLinear; + minFilter = GFXTextureFilterAnisotropic; + mipFilter = GFXTextureFilterLinear; + maxAnisotropy = 4; +}; + +singleton GFXStateBlockData( WaterStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = WaterSampler; // noise + samplerStates[1] = SamplerClampPoint; // #deferred + samplerStates[2] = SamplerClampLinear; // $reflectbuff + samplerStates[3] = SamplerClampPoint; // $backbuff + samplerStates[4] = SamplerWrapLinear; // $cubemap + samplerStates[5] = SamplerWrapLinear; // foam + samplerStates[6] = SamplerClampLinear; // depthMap ( color gradient ) + cullDefined = true; + cullMode = "GFXCullCCW"; +}; + +singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock ) +{ + cullMode = "GFXCullCW"; +}; + +singleton CustomMaterial( WaterMat ) +{ + sampler["deferredTex"] = "#deferred"; + sampler["reflectMap"] = "$reflectbuff"; + sampler["refractBuff"] = "$backbuff"; + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = ""; + //sampler["skyMap"] = ""; + //sampler["foamMap"] = ""; + //sampler["depthGradMap"] = ""; + + shader = WaterShader; + stateBlock = WaterStateBlock; + version = 3.0; + + useAnisotropic[0] = true; +}; + +//----------------------------------------------------------------------------- +// Underwater +//----------------------------------------------------------------------------- + +singleton ShaderData( UnderWaterShader : WaterShader ) +{ + defines = "UNDERWATER"; +}; + +singleton CustomMaterial( UnderwaterMat ) +{ + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = "core/art/water/noise02"; + //sampler["foamMap"] = "core/art/water/foam"; + + sampler["deferredTex"] = "#deferred"; + sampler["refractBuff"] = "$backbuff"; + + shader = UnderWaterShader; + stateBlock = UnderWaterStateBlock; + specular = "0.75 0.75 0.75 1.0"; + specularPower = 48.0; + version = 3.0; +}; + +//----------------------------------------------------------------------------- +// Basic Water +//----------------------------------------------------------------------------- + +singleton ShaderData( WaterBasicShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterBasicV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterBasicP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicP.glsl"; + + samplerNames[0] = "$bumpMap"; + samplerNames[2] = "$reflectMap"; + samplerNames[3] = "$refractBuff"; + samplerNames[4] = "$skyMap"; + samplerNames[5] = "$depthGradMap"; + + pixVersion = 2.0; +}; + +singleton GFXStateBlockData( WaterBasicStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = WaterSampler; // noise + samplerStates[2] = SamplerClampLinear; // $reflectbuff + samplerStates[3] = SamplerClampPoint; // $backbuff + samplerStates[4] = SamplerWrapLinear; // $cubemap + cullDefined = true; + cullMode = "GFXCullCCW"; +}; + +singleton GFXStateBlockData( UnderWaterBasicStateBlock : WaterBasicStateBlock ) +{ + cullMode = "GFXCullCW"; +}; + +singleton CustomMaterial( WaterBasicMat ) +{ + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = "core/art/water/noise02"; + //sampler["skyMap"] = "$cubemap"; + + //sampler["deferredTex"] = "#deferred"; + sampler["reflectMap"] = "$reflectbuff"; + sampler["refractBuff"] = "$backbuff"; + + cubemap = NewLevelSkyCubemap; + shader = WaterBasicShader; + stateBlock = WaterBasicStateBlock; + version = 2.0; +}; + +//----------------------------------------------------------------------------- +// Basic UnderWater +//----------------------------------------------------------------------------- + +singleton ShaderData( UnderWaterBasicShader : WaterBasicShader) +{ + defines = "UNDERWATER"; +}; + +singleton CustomMaterial( UnderwaterBasicMat ) +{ + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = "core/art/water/noise02"; + //samplers["skyMap"] = "$cubemap"; + + //sampler["deferredTex"] = "#deferred"; + sampler["refractBuff"] = "$backbuff"; + + shader = UnderWaterBasicShader; + stateBlock = UnderWaterBasicStateBlock; + version = 2.0; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.ATITechnologiesInc.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.ATITechnologiesInc.cs new file mode 100644 index 000000000..10c6bdf5b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.ATITechnologiesInc.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// ATI Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 64.44) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.GeForce8600.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.GeForce8600.cs new file mode 100644 index 000000000..328788dac --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.GeForce8600.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// nVidia Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 1.2) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs new file mode 100644 index 000000000..5681b2f6d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// nVidia Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 53.82) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} + +// Silly card has trouble with this! +GFXCardProfiler::setCapability("autoMipmapLevel", false); diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.cs new file mode 100644 index 000000000..b33b8d5d3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// nVidia Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 56.72) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.cs new file mode 100644 index 000000000..e1e299341 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.cs @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Direct3D 9 Renderer Profile Script +// +// This script is responsible for setting global +// capability strings based on the D3D9 renderer type. \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/scripts/renderManager.cs b/Templates/BaseGame/game/core/rendering/scripts/renderManager.cs new file mode 100644 index 000000000..4a80a45b1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/renderManager.cs @@ -0,0 +1,126 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +function initRenderManager() +{ + assert( !isObject( DiffuseRenderPassManager ), "initRenderManager() - DiffuseRenderPassManager already initialized!" ); + + new RenderPassManager( DiffuseRenderPassManager ); + + // This token, and the associated render managers, ensure that driver MSAA + // does not get used for Advanced Lighting renders. The 'AL_FormatResolve' + // PostEffect copies the result to the backbuffer. + new RenderFormatToken(AL_FormatToken) + { + enabled = "false"; + + //When hdr is enabled this will be changed to the appropriate format + format = "GFXFormatR8G8B8A8_SRGB"; + depthFormat = "GFXFormatD24S8"; + aaLevel = 0; // -1 = match backbuffer + + // The contents of the back buffer before this format token is executed + // is provided in $inTex + copyEffect = "AL_FormatCopy"; + + // The contents of the render target created by this format token is + // provided in $inTex + resolveEffect = "AL_FormatCopy"; + }; + DiffuseRenderPassManager.addManager( new RenderPassStateBin() { renderOrder = 0.001; stateToken = AL_FormatToken; } ); + + // We really need to fix the sky to render after all the + // meshes... but that causes issues in reflections. + DiffuseRenderPassManager.addManager( new RenderObjectMgr(SkyBin) { bintype = "Sky"; renderOrder = 0.1; processAddOrder = 0.1; } ); + + //DiffuseRenderPassManager.addManager( new RenderVistaMgr() { bintype = "Vista"; renderOrder = 0.15; processAddOrder = 0.15; } ); + + DiffuseRenderPassManager.addManager( new RenderObjectMgr(BeginBin) { bintype = "Begin"; renderOrder = 0.2; processAddOrder = 0.2; } ); + // Normal mesh rendering. + DiffuseRenderPassManager.addManager( new RenderTerrainMgr(TerrainBin) { renderOrder = 0.4; processAddOrder = 0.4; basicOnly = true; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(MeshBin) { bintype = "Mesh"; renderOrder = 0.5; processAddOrder = 0.5; basicOnly = true; } ); + DiffuseRenderPassManager.addManager( new RenderImposterMgr(ImposterBin) { renderOrder = 0.56; processAddOrder = 0.56; } ); + DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } ); + + DiffuseRenderPassManager.addManager( new RenderObjectMgr(ShadowBin) { bintype = "Shadow"; renderOrder = 0.7; processAddOrder = 0.7; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81; } ); + DiffuseRenderPassManager.addManager( new RenderOcclusionMgr(OccluderBin){ bintype = "Occluder"; renderOrder = 0.9; processAddOrder = 0.9; } ); + + // We now render translucent objects that should handle + // their own fogging and lighting. + + // Note that the fog effect is triggered before this bin. + DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjTranslucentBin) { bintype = "ObjectTranslucent"; renderOrder = 1.0; processAddOrder = 1.0; } ); + + DiffuseRenderPassManager.addManager( new RenderObjectMgr(WaterBin) { bintype = "Water"; renderOrder = 1.2; processAddOrder = 1.2; } ); + DiffuseRenderPassManager.addManager( new RenderObjectMgr(FoliageBin) { bintype = "Foliage"; renderOrder = 1.3; processAddOrder = 1.3; } ); + DiffuseRenderPassManager.addManager( new RenderParticleMgr(ParticleBin) { renderOrder = 1.35; processAddOrder = 1.35; } ); + DiffuseRenderPassManager.addManager( new RenderTranslucentMgr(TranslucentBin){ renderOrder = 1.4; processAddOrder = 1.4; } ); + + DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } ); + + // Note that the GlowPostFx is triggered after this bin. + DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } ); + + // We render any editor stuff from this bin. Note that the HDR is + // completed before this bin to keep editor elements from tone mapping. + DiffuseRenderPassManager.addManager( new RenderObjectMgr(EditorBin) { bintype = "Editor"; renderOrder = 1.6; processAddOrder = 1.6; } ); + + // Resolve format change token last. + DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } ); +} + +/// This is the Default PostFX state block. Put here to prevent any missing object +/// errors for below dependencies +singleton GFXStateBlockData( PFX_DefaultStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +/// This post effect is used to copy data from the non-MSAA back-buffer to the +/// device back buffer (which could be MSAA). It must be declared here so that +/// it is initialized when 'AL_FormatToken' is initialzed. +singleton GFXStateBlockData( AL_FormatTokenState : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; +}; + +singleton PostEffect( AL_FormatCopy ) +{ + // This PostEffect is used by 'AL_FormatToken' directly. It is never added to + // the PostEffectManager. Do not call enable() on it. + isEnabled = false; + allowReflectPass = true; + + shader = PFX_PassthruShader; + stateBlock = AL_FormatTokenState; + + texture[0] = "$inTex"; + target = "$backbuffer"; +}; diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogP.hlsl new file mode 100644 index 000000000..7de14a87d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogP.hlsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog final pixel shader V2.00 +#include "../shaderModel.hlsl" +#include "../shaderModelAutoGen.hlsl" +#include "../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1); +TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2); +TORQUE_UNIFORM_SAMPLER2D(density, 3); + +uniform float3 ambientColor; +uniform float accumTime; +uniform float4 fogColor; +uniform float4 modspeed;//xy speed layer 1, zw speed layer 2 +uniform float2 viewpoint; +uniform float2 texscale; +uniform float fogDensity; +uniform float preBias; +uniform float textured; +uniform float modstrength; +uniform float numtiles; +uniform float fadesize; +uniform float2 PixelSize; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 htpos : TEXCOORD0; + float2 uv0 : TEXCOORD1; +}; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0; + uvscreen.y = 1.0 - uvscreen.y; + + float obj_test = TORQUE_DEFERRED_UNCONDITION(deferredTex, uvscreen).w * preBias; + float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r; + float front = TORQUE_TEX2D(frontBuffer, uvscreen).r; + + if (depth <= front) + return float4(0,0,0,0); + else if ( obj_test < depth ) + depth = obj_test; + if ( front >= 0.0) + depth -= front; + + float diff = 1.0; + float3 col = fogColor.rgb; + if (textured != 0.0) + { + float2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles); + + float2 mod1 = TORQUE_TEX2D(density, (offset + (modspeed.xy*accumTime))).rg; + float2 mod2 = TORQUE_TEX2D(density, (offset + (modspeed.zw*accumTime))).rg; + diff = (mod2.r + mod1.r) * modstrength; + col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0; + } + + col *= ambientColor; + + float4 resultColor = float4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize))); + + return hdrEncode(resultColor); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreP.hlsl new file mode 100644 index 000000000..9d5060935 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreP.hlsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog deferred pixel shader V1.00 +#include "../shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 pos : TEXCOORD0; +}; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float OUT; + + clip( IN.pos.w ); + OUT = IN.pos.w; + + return float4(OUT,0,0,1); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreV.hlsl new file mode 100644 index 000000000..b736e0d0d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreV.hlsl @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog deferred vertex shader V1.00 + +#include "../shaderModel.hlsl" +#include "../hlslStructs.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 pos : TEXCOORD0; +}; + +uniform float4x4 modelView; + +ConnectData main( VertexIn_P IN) +{ + ConnectData OUT; + + OUT.hpos = mul(modelView, float4(IN.pos, 1.0)); + OUT.pos = OUT.hpos; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogRefl.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogRefl.hlsl new file mode 100644 index 000000000..380233b5f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogRefl.hlsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog Reflection pixel shader V1.00 +#include "../shaderModel.hlsl" +uniform float4 fogColor; +uniform float fogDensity; +uniform float reflStrength; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 pos : TEXCOORD0; +}; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + return float4(fogColor.rgb,saturate(fogDensity*reflStrength)); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogV.hlsl new file mode 100644 index 000000000..167f83946 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogV.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog final vertex shader V1.00 + +#include "../shaderModel.hlsl" +#include "../hlslStructs.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 htpos : TEXCOORD0; + float2 uv0 : TEXCOORD1; +}; + +uniform float4x4 modelView; + +ConnectData main( VertexIn_PNTT IN) +{ + ConnectData OUT; + + OUT.hpos = mul(modelView, float4(IN.pos,1.0)); + OUT.htpos = OUT.hpos; + OUT.uv0 = IN.uv0; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogP.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogP.glsl new file mode 100644 index 000000000..fcfa31244 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogP.glsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/torque.glsl" + +uniform sampler2D deferredTex; +uniform sampler2D depthBuffer; +uniform sampler2D frontBuffer; +uniform sampler2D density; + +uniform float accumTime; +uniform vec4 fogColor; +uniform float fogDensity; +uniform float preBias; +uniform float textured; +uniform float modstrength; +uniform vec4 modspeed;//xy speed layer 1, zw speed layer 2 +uniform vec2 viewpoint; +uniform vec2 texscale; +uniform vec3 ambientColor; +uniform float numtiles; +uniform float fadesize; +uniform vec2 PixelSize; + +in vec4 _hpos; +#define IN_hpos _hpos +out vec4 OUT_col; + +void main() +{ + vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0; + uvscreen.y = 1.0 - uvscreen.y; + + float obj_test = deferredUncondition( deferredTex, uvscreen).w * preBias; + float depth = tex2D(depthBuffer,uvscreen).r; + float front = tex2D(frontBuffer,uvscreen).r; + + if (depth <= front) + { + OUT_col = vec4(0,0,0,0); + return; + } + + else if ( obj_test < depth ) + depth = obj_test; + if ( front >= 0.0) + depth -= front; + + float diff = 1.0; + vec3 col = fogColor.rgb; + if (textured != 0.0) + { + vec2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles); + + vec2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg; + vec2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg; + diff = (mod2.r + mod1.r) * modstrength; + col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0; + } + + col *= ambientColor; + + vec4 returnColor = vec4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize))); + + OUT_col = hdrEncode(returnColor); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreP.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreP.glsl new file mode 100644 index 000000000..017ea6ef8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreP.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +in vec4 _hpos; +#define IN_hpos _hpos + +out vec4 OUT_col; + +void main() +{ + float OUT; + clip( IN_hpos.w ); + OUT = IN_hpos.w; + + OUT_col = vec4(OUT,0,0,1); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreV.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreV.glsl new file mode 100644 index 000000000..2f2a1318a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreV.glsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +#define IN_position vPosition + +out vec4 _hpos; +#define OUT_hpos _hpos + +uniform mat4 modelView; + +void main() +{ + vec4 inPos = IN_position; + inPos.w = 1.0; + + OUT_hpos = tMul( modelView, inPos ); + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogRefl.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogRefl.glsl new file mode 100644 index 000000000..78e149fbf --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogRefl.glsl @@ -0,0 +1,33 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +uniform vec4 fogColor; +uniform float fogDensity; +uniform float reflStrength; +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4(fogColor.rgb,saturate(fogDensity*reflStrength)); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogV.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogV.glsl new file mode 100644 index 000000000..57b3ba87e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogV.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +#define IN_position vPosition + +out vec4 _hpos; +#define OUT_hpos _hpos + +uniform mat4 modelView; + +void main() +{ + OUT_hpos = tMul(modelView, IN_position); + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/basicCloudsP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsP.hlsl new file mode 100644 index 000000000..4b40e5e8c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsP.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float4 col = TORQUE_TEX2D(diffuseMap, IN.texCoord); + return hdrEncode( col ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/basicCloudsV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsV.hlsl new file mode 100644 index 000000000..a176fdbcd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsV.hlsl @@ -0,0 +1,58 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct CloudVert +{ + float3 pos : POSITION; + float2 uv0 : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; +uniform float2 texDirection; +uniform float2 texOffset; +uniform float accumTime; +uniform float texScale; + + +ConnectData main( CloudVert IN ) +{ + ConnectData OUT; + + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + + float2 uv = IN.uv0; + uv += texOffset; + uv *= texScale; + uv += accumTime * texDirection; + + OUT.texCoord = uv; + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/cloudLayerP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerP.hlsl new file mode 100644 index 000000000..efa8fe0b4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerP.hlsl @@ -0,0 +1,146 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" +#include "torque.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 texCoord12 : TEXCOORD0; + float4 texCoord34 : TEXCOORD1; + float3 vLightTS : TEXCOORD2; // light vector in tangent space, denormalized + float3 vViewTS : TEXCOORD3; // view vector in tangent space, denormalized + float worldDist : TEXCOORD4; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +TORQUE_UNIFORM_SAMPLER2D(normalHeightMap, 0); +uniform float3 ambientColor; +uniform float3 sunColor; +uniform float cloudCoverage; +uniform float3 cloudBaseColor; +uniform float cloudExposure; + +//----------------------------------------------------------------------------- +// Globals +//----------------------------------------------------------------------------- +// The per-color weighting to be used for luminance calculations in RGB order. +static const float3 LUMINANCE_VECTOR = float3(0.2125f, 0.7154f, 0.0721f); + + +//----------------------------------------------------------------------------- +// Functions +//----------------------------------------------------------------------------- + +// Calculates the Rayleigh phase function +float getRayleighPhase( float angle ) +{ + return 0.75 * ( 1.0 + pow( angle, 2 ) ); +} + +// Returns the output rgb color given a texCoord and parameters it uses +// for lighting calculation. +float3 ComputeIllumination( float2 texCoord, + float3 vLightTS, + float3 vViewTS, + float3 vNormalTS ) +{ + //return noiseNormal; + //return vNormalTS; + + float3 vLightTSAdj = float3( -vLightTS.x, -vLightTS.y, vLightTS.z ); + + float dp = dot( vNormalTS, vLightTSAdj ); + + // Calculate the amount of illumination (lightTerm)... + + // We do both a rim lighting effect and a halfLambertian lighting effect + // and combine the result. + float halfLambertTerm = saturate( pow( dp * 0.5 + 0.5, 1 ) ); + float rimLightTerm = pow( ( 1.0 - dp ), 1.0 ); + float lightTerm = saturate( halfLambertTerm * 1.0 + rimLightTerm * dp ); + lightTerm *= 0.5; + + // Use a simple RayleighPhase function to simulate single scattering towards + // the camera. + float angle = dot( vLightTS, vViewTS ); + lightTerm *= getRayleighPhase( angle ); + + // Combine terms and colors into the output color. + //float3 lightColor = ( lightTerm * sunColor * fOcclusionShadow ) + ambientColor; + float3 lightColor = lerp( ambientColor, sunColor, lightTerm ); + //lightColor = lerp( lightColor, ambientColor, cloudCoverage ); + float3 finalColor = cloudBaseColor * lightColor; + + return finalColor; +} + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // Normalize the interpolated vectors: + float3 vViewTS = normalize( IN.vViewTS ); + float3 vLightTS = normalize( IN.vLightTS ); + + float4 cResultColor = float4( 0, 0, 0, 1 ); + + float2 texSample = IN.texCoord12.xy; + + float4 noise1 = TORQUE_TEX2D( normalHeightMap, IN.texCoord12.zw ); + noise1 = normalize( ( noise1 - 0.5 ) * 2.0 ); + //return noise1; + + float4 noise2 = TORQUE_TEX2D(normalHeightMap, IN.texCoord34.xy); + noise2 = normalize( ( noise2 - 0.5 ) * 2.0 ); + //return noise2; + + float3 noiseNormal = normalize( noise1 + noise2 ).xyz; + //return float4( noiseNormal, 1.0 ); + + float noiseHeight = noise1.a * noise2.a * ( cloudCoverage / 2.0 + 0.5 ); + + float3 vNormalTS = normalize( TORQUE_TEX2D(normalHeightMap, texSample).xyz * 2.0 - 1.0); + vNormalTS += noiseNormal; + vNormalTS = normalize( vNormalTS ); + + // Compute resulting color for the pixel: + cResultColor.rgb = ComputeIllumination( texSample, vLightTS, vViewTS, vNormalTS ); + + float coverage = ( cloudCoverage - 0.5 ) * 2.0; + cResultColor.a = TORQUE_TEX2D(normalHeightMap, texSample).a + coverage + noiseHeight; + + if ( cloudCoverage > -1.0 ) + cResultColor.a /= 1.0 + coverage; + + cResultColor.a = saturate( cResultColor.a * pow( saturate(cloudCoverage), 0.25 ) ); + + cResultColor.a = lerp( cResultColor.a, 0.0, 1.0 - pow(IN.worldDist,2.0) ); + + cResultColor.rgb *= cloudExposure; + + return hdrEncode( cResultColor ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/cloudLayerV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerV.hlsl new file mode 100644 index 000000000..d60dd251d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerV.hlsl @@ -0,0 +1,106 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +#include "shaderModel.hlsl" + +struct CloudVert +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float3 binormal : BINORMAL; + float3 tangent : TANGENT; + float2 uv0 : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 texCoord12 : TEXCOORD0; + float4 texCoord34 : TEXCOORD1; + float3 vLightTS : TEXCOORD2; // light vector in tangent space, denormalized + float3 vViewTS : TEXCOORD3; // view vector in tangent space, denormalized + float worldDist : TEXCOORD4; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform float4x4 modelview; +uniform float3 eyePosWorld; +uniform float3 sunVec; +uniform float2 texOffset0; +uniform float2 texOffset1; +uniform float2 texOffset2; +uniform float3 texScale; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( CloudVert IN ) +{ + ConnectData OUT; + + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + // Offset the uv so we don't have a seam directly over our head. + float2 uv = IN.uv0 + float2( 0.5, 0.5 ); + + OUT.texCoord12.xy = uv * texScale.x; + OUT.texCoord12.xy += texOffset0; + + OUT.texCoord12.zw = uv * texScale.y; + OUT.texCoord12.zw += texOffset1; + + OUT.texCoord34.xy = uv * texScale.z; + OUT.texCoord34.xy += texOffset2; + + OUT.texCoord34.z = IN.pos.z; + OUT.texCoord34.w = 0.0; + + // Transform the normal, tangent and binormal vectors from object space to + // homogeneous projection space: + float3 vNormalWS = -IN.normal; + float3 vTangentWS = -IN.tangent; + float3 vBinormalWS = -IN.binormal; + + // Compute position in world space: + float4 vPositionWS = float4(IN.pos, 1.0) + float4(eyePosWorld, 1); //mul( IN.pos, objTrans ); + + // Compute and output the world view vector (unnormalized): + float3 vViewWS = eyePosWorld - vPositionWS.xyz; + + // Compute denormalized light vector in world space: + float3 vLightWS = -sunVec; + + // Normalize the light and view vectors and transform it to the tangent space: + float3x3 mWorldToTangent = float3x3( vTangentWS, vBinormalWS, vNormalWS ); + + // Propagate the view and the light vectors (in tangent space): + OUT.vLightTS = mul( vLightWS, mWorldToTangent ); + OUT.vViewTS = mul( mWorldToTangent, vViewWS ); + + OUT.worldDist = saturate( pow( max( IN.pos.z, 0 ), 2 ) ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureP.hlsl new file mode 100644 index 000000000..d0577428f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureP.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + return float4(IN.color.rgb, IN.color.a * TORQUE_TEX2D(diffuseMap, IN.texCoord).a); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureV.hlsl new file mode 100644 index 000000000..8bf4e88d8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureV.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.HPOS = mul(modelview, float4(In.position,1.0)); + Out.color = In.color; + Out.texCoord = In.texCoord; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorP.hlsl new file mode 100644 index 000000000..dd9990e07 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorP.hlsl @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; +}; + +float4 main(Conn IN) : TORQUE_TARGET0 +{ + return IN.color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorV.hlsl new file mode 100644 index 000000000..d16dfb863 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorV.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; +}; + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.HPOS = mul(modelview, float4(In.position,1.0)); + Out.color = In.color; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureP.glsl new file mode 100644 index 000000000..b9a10adf3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureP.glsl @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffuseMap; +in vec4 color; +in vec2 texCoord; + +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4(color.rgb, color.a * texture(diffuseMap, texCoord).a); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureV.glsl new file mode 100644 index 000000000..5d7f10168 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureV.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +uniform mat4 modelview; +out vec4 color; +out vec2 texCoord; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + color = vColor; + texCoord = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorP.glsl new file mode 100644 index 000000000..f9dfc3d4f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorP.glsl @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec4 color; + +out vec4 OUT_col; + +void main() +{ + OUT_col = color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorV.glsl new file mode 100644 index 000000000..895917b55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorV.glsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; + +uniform mat4 modelview; +out vec4 color; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + color = vColor; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureP.glsl new file mode 100644 index 000000000..c24b9db12 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureP.glsl @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffuseMap; +in vec4 color; +in vec2 texCoord; + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture(diffuseMap, texCoord) * color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureV.glsl new file mode 100644 index 000000000..5d7f10168 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureV.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +uniform mat4 modelview; +out vec4 color; +out vec2 texCoord; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + color = vColor; + texCoord = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreP.glsl new file mode 100644 index 000000000..770f8904d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreP.glsl @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D colorTarget0Texture ; + +vec4 main( vec2 ScreenPos : VPOS ) : COLOR0 +{ + vec2 TexCoord = ScreenPos; + vec4 diffuse; + asm { tfetch2D diffuse, TexCoord, colorTarget0Texture, UnnormalizedTextureCoords = true }; + return diffuse; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreV.glsl new file mode 100644 index 000000000..e99d2e537 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreV.glsl @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureP.glsl new file mode 100644 index 000000000..50cef4bda --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureP.glsl @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffuseMap; +in vec2 texCoord; + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture(diffuseMap, texCoord); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureV.glsl new file mode 100644 index 000000000..20dbb6f10 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureV.glsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; +out vec2 texCoord; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + texCoord = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureP.hlsl new file mode 100644 index 000000000..63afec2a4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureP.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + return TORQUE_TEX2D(diffuseMap, IN.texCoord) * IN.color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureV.hlsl new file mode 100644 index 000000000..8bf4e88d8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureV.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.HPOS = mul(modelview, float4(In.position,1.0)); + Out.color = In.color; + Out.texCoord = In.texCoord; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreP.hlsl new file mode 100644 index 000000000..9ef44f426 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreP.hlsl @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D colorTarget0Texture : register(s0); + +float4 main( float2 ScreenPos : VPOS ) : COLOR0 +{ + float2 TexCoord = ScreenPos; + float4 diffuse; + asm { tfetch2D diffuse, TexCoord, colorTarget0Texture, UnnormalizedTextureCoords = true }; + return diffuse; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreV.hlsl new file mode 100644 index 000000000..3c4aefaec --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreV.hlsl @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +float4 main( const float2 inPosition : POSITION ) : POSITION +{ + return float4( inPosition, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureP.hlsl new file mode 100644 index 000000000..82dbd4ce9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureP.hlsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +float4 main(Conn IN) : TORQUE_TARGET0 +{ + return TORQUE_TEX2D(diffuseMap, IN.texCoord); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureV.hlsl new file mode 100644 index 000000000..204cf9514 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureV.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.hpos = mul(modelview, float4(In.position, 1.0)); + Out.texCoord = In.texCoord; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/foliage.hlsl b/Templates/BaseGame/game/core/rendering/shaders/foliage.hlsl new file mode 100644 index 000000000..9952c29d6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/foliage.hlsl @@ -0,0 +1,186 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// CornerId corresponds to this arrangement +// from the perspective of the camera. +// +// 3 ---- 2 +// | | +// 0 ---- 1 +// + +#define MAX_COVERTYPES 8 + +uniform float2 gc_fadeParams; +uniform float2 gc_windDir; +uniform float3 gc_camRight; +uniform float3 gc_camUp; +uniform float4 gc_typeRects[MAX_COVERTYPES]; + +// .x = gust length +// .y = premultiplied simulation time and gust frequency +// .z = gust strength +uniform float3 gc_gustInfo; + +// .x = premultiplied simulation time and turbulance frequency +// .y = turbulance strength +uniform float2 gc_turbInfo; + + +static float sCornerRight[4] = { -0.5, 0.5, 0.5, -0.5 }; + +static float sCornerUp[4] = { 0, 0, 1, 1 }; + +static float sMovableCorner[4] = { 0, 0, 1, 1 }; + +static float2 sUVCornerExtent[4] = +{ + float2( 0, 1 ), + float2( 1, 1 ), + float2( 1, 0 ), + float2( 0, 0 ) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// The following wind effect was derived from the GPU Gems 3 chapter... +// +// "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa, Crytek +// + +float2 smoothCurve( float2 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +float2 triangleWave( float2 x ) +{ + return abs( frac( x + 0.5 ) * 2.0 - 1.0 ); +} + +float2 smoothTriangleWave( float2 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +float windTurbulence( float bbPhase, float frequency, float strength ) +{ + // We create the input value for wave generation from the frequency and phase. + float2 waveIn = bbPhase.xx + frequency.xx; + + // We use two square waves to generate the effect which + // is then scaled by the overall strength. + float2 waves = ( frac( waveIn.xy * float2( 1.975, 0.793 ) ) * 2.0 - 1.0 ); + waves = smoothTriangleWave( waves ); + + // Sum up the two waves into a single wave. + return ( waves.x + waves.y ) * strength; +} + +float2 windEffect( float bbPhase, + float2 windDirection, + float gustLength, + float gustFrequency, + float gustStrength, + float turbFrequency, + float turbStrength ) +{ + // Calculate the ambient wind turbulence. + float turbulence = windTurbulence( bbPhase, turbFrequency, turbStrength ); + + // We simulate the overall gust via a sine wave. + float gustPhase = clamp( sin( ( bbPhase - gustFrequency ) / gustLength ) , 0, 1 ); + float gustOffset = ( gustPhase * gustStrength ) + ( ( 0.2 + gustPhase ) * turbulence ); + + // Return the final directional wind effect. + return gustOffset.xx * windDirection.xy; +} + +void foliageProcessVert( inout float3 position, + inout float4 diffuse, + inout float4 texCoord, + inout float3 normal, + inout float3 T, + in float3 eyePos ) +{ + // Assign the normal and tagent values. + //normal = float3( 0, 0, 1 );//cross( gc_camUp, gc_camRight ); + T = gc_camRight; + + // Pull out local vars we need for work. + int corner = ( diffuse.a * 255.0f ) + 0.5f; + float2 size = texCoord.xy; + int type = texCoord.z; + + // The billboarding is based on the camera direction. + float3 rightVec = gc_camRight * sCornerRight[corner]; + float3 upVec = gc_camUp * sCornerUp[corner]; + + // Figure out the corner position. + float3 outPos = ( upVec * size.y ) + ( rightVec * size.x ); + float len = length( outPos.xyz ); + + // We derive the billboard phase used for wind calculations from its position. + float bbPhase = dot( position.xyz, 1 ); + + // Get the overall wind gust and turbulence effects. + float3 wind; + wind.xy = windEffect( bbPhase, + gc_windDir, + gc_gustInfo.x, gc_gustInfo.y, gc_gustInfo.z, + gc_turbInfo.x, gc_turbInfo.y ); + wind.z = 0; + + // Add the summed wind effect into the point. + outPos.xyz += wind.xyz * texCoord.w; + + // Do a simple spherical clamp to keep the foliage + // from stretching too much by wind effect. + outPos.xyz = normalize( outPos.xyz ) * len; + + // Move the point into world space. + position += outPos; + + // Grab the uv set and setup the texture coord. + float4 uvSet = gc_typeRects[type]; + texCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + texCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Animate the normal to get lighting changes + // across the the wind swept foliage. + // + // TODO: Expose the 10x as a factor to control + // how much the wind effects the lighting on the grass. + // + normal.xy += wind.xy * ( 10.0 * texCoord.w ); + normal = normalize( normal ); + + // Get the alpha fade value. + + float fadeStart = gc_fadeParams.x; + float fadeEnd = gc_fadeParams.y; + const float fadeRange = fadeEnd - fadeStart; + + float dist = distance( eyePos, position.xyz ) - fadeStart; + diffuse.a = 1 - clamp( dist / fadeRange, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorP.hlsl new file mode 100644 index 000000000..a8bb68e28 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorP.hlsl @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shdrConsts.h" +#include "shaderModel.hlsl" +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 outTexCoord : TEXCOORD0; + float4 color : COLOR0; + float4 groundAlphaCoeff : COLOR1; + float2 alphaLookup : TEXCOORD1; +}; + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); +TORQUE_UNIFORM_SAMPLER2D(alphaMap, 1); + +uniform float4 groundAlpha; +uniform float4 ambient; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ConnectData IN ) +{ + Fragout OUT; + + float4 alpha = TORQUE_TEX2D(alphaMap, IN.alphaLookup); + OUT.col = float4( ambient.rgb * IN.lum.rgb, 1.0 ) * TORQUE_TEX2D(diffuseMap, IN.texCoord); + OUT.col.a = OUT.col.a * min(alpha, groundAlpha + IN.groundAlphaCoeff.x).x; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorV.hlsl new file mode 100644 index 000000000..70ec9ff4c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorV.hlsl @@ -0,0 +1,129 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 texCoord : TEXCOORD0; + float2 waveScale : TEXCOORD1; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 outTexCoord : TEXCOORD0; + float4 color : COLOR0; + float4 groundAlphaCoeff : COLOR1; + float2 alphaLookup : TEXCOORD1; +}; + +uniform float4x4 projection : register(C0); +uniform float4x4 world : register(C4); +uniform float GlobalSwayPhase : register(C8); +uniform float SwayMagnitudeSide : register(C9); +uniform float SwayMagnitudeFront : register(C10); +uniform float GlobalLightPhase : register(C11); +uniform float LuminanceMagnitude : register(C12); +uniform float LuminanceMidpoint : register(C13); +uniform float DistanceRange : register(C14); +uniform float3 CameraPos : register(C15); +uniform float TrueBillboard : register(C16); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + // Init a transform matrix to be used in the following steps + float4x4 trans = 0; + trans[0][0] = 1; + trans[1][1] = 1; + trans[2][2] = 1; + trans[3][3] = 1; + trans[0][3] = IN.position.x; + trans[1][3] = IN.position.y; + trans[2][3] = IN.position.z; + + // Billboard transform * world matrix + float4x4 o = world; + o = mul(o, trans); + + // Keep only the up axis result and position transform. + // This gives us "cheating" cylindrical billboarding. + o[0][0] = 1; + o[1][0] = 0; + o[2][0] = 0; + o[3][0] = 0; + o[0][1] = 0; + o[1][1] = 1; + o[2][1] = 0; + o[3][1] = 0; + + // Unless the user specified TrueBillboard, + // in which case we want the z axis to also be camera facing. + +#ifdef TRUE_BILLBOARD + + o[0][2] = 0; + o[1][2] = 0; + o[2][2] = 1; + o[3][2] = 0; + +#endif + + // Handle sway. Sway is stored in a texture coord. The x coordinate is the sway phase multiplier, + // the y coordinate determines if this vertex actually sways or not. + float xSway, ySway; + float wavePhase = GlobalSwayPhase * IN.waveScale.x; + sincos(wavePhase, ySway, xSway); + xSway = xSway * IN.waveScale.y * SwayMagnitudeSide; + ySway = ySway * IN.waveScale.y * SwayMagnitudeFront; + float4 p; + p = mul(o, float4(IN.normal.x + xSway, ySway, IN.normal.z, 1)); + + // Project the point + OUT.hpos = mul(projection, p); + + // Lighting + float Luminance = LuminanceMidpoint + LuminanceMagnitude * cos(GlobalLightPhase + IN.normal.y); + + // Alpha + float3 worldPos = IN.position; + float alpha = abs(distance(worldPos, CameraPos)) / DistanceRange; + alpha = clamp(alpha, 0.0f, 1.0f); //pass it through + + OUT.alphaLookup = float2(alpha, 0.0f); + OUT.groundAlphaCoeff = all(IN.normal.z); + OUT.outTexCoord = IN.texCoord; + OUT.color = float4(Luminance, Luminance, Luminance, 1.0f); + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsP.glsl new file mode 100644 index 000000000..5b3f50519 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + +//ConnectData +in vec2 texCoord; +#define IN_texCoord texCoord + + +uniform sampler2D diffuseMap ; + +out vec4 OUT_col; + +void main() +{ + vec4 col = texture( diffuseMap, IN_texCoord ); + OUT_col = hdrEncode( col ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsV.glsl new file mode 100644 index 000000000..cccbafa8c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsV.glsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +//CloudVert +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_pos vPosition +#define IN_uv0 vTexCoord0 + +uniform mat4 modelview; +uniform float accumTime; +uniform float texScale; +uniform vec2 texDirection; +uniform vec2 texOffset; + +out vec2 texCoord; +#define OUT_texCoord texCoord + +void main() +{ + gl_Position = tMul(modelview, IN_pos); + + vec2 uv = IN_uv0; + uv += texOffset; + uv *= texScale; + uv += accumTime * texDirection; + + OUT_texCoord = uv; + + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/blurP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/blurP.glsl new file mode 100644 index 000000000..a27538762 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/blurP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Glow Shader +//***************************************************************************** +uniform vec4 kernel; +uniform sampler2D diffuseMap; + +in vec2 texc0, texc1, texc2, texc3; + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture(diffuseMap, texc0) * kernel.x; + OUT_col += texture(diffuseMap, texc1) * kernel.y; + OUT_col += texture(diffuseMap, texc2) * kernel.z; + OUT_col += texture(diffuseMap, texc3) * kernel.w; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/blurV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/blurV.glsl new file mode 100644 index 000000000..1bfb0cd1b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/blurV.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Glow shader +//***************************************************************************** + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +uniform mat4 modelview; +uniform vec2 offset0, offset1, offset2, offset3; + +out vec2 texc0, texc1, texc2, texc3; + +void main() +{ + gl_Position = modelview * vPosition; + + vec2 tc = vTexCoord0.st; + tc.y = 1.0 - tc.y; + + texc0 = tc + offset0; + texc1 = tc + offset1; + texc2 = tc + offset2; + texc3 = tc + offset3; + gl_Position.y *= -1; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerP.glsl new file mode 100644 index 000000000..877a132da --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerP.glsl @@ -0,0 +1,147 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" +#include "torque.glsl" +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +//ConnectData +in vec4 texCoord12; +#define IN_texCoord12 texCoord12 +in vec4 texCoord34; +#define IN_texCoord34 texCoord34 +in vec3 vLightTS; // light vector in tangent space, denormalized +#define IN_vLightTS vLightTS +in vec3 vViewTS; // view vector in tangent space, denormalized +#define IN_vViewTS vViewTS +in float worldDist; +#define IN_worldDist worldDist + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform sampler2D normalHeightMap; +uniform vec3 ambientColor; +uniform vec3 sunColor; +uniform float cloudCoverage; +uniform vec3 cloudBaseColor; +uniform float cloudExposure; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Globals +//----------------------------------------------------------------------------- +// The per-color weighting to be used for luminance calculations in RGB order. +const vec3 LUMINANCE_VECTOR = vec3(0.2125f, 0.7154f, 0.0721f); + + +//----------------------------------------------------------------------------- +// Functions +//----------------------------------------------------------------------------- + +// Calculates the Rayleigh phase function +float getRayleighPhase( float angle ) +{ + return 0.75 * ( 1.0 + pow( angle, 2.0 ) ); +} + +// Returns the output rgb color given a texCoord and parameters it uses +// for lighting calculation. +vec3 ComputeIllumination( vec2 texCoord, + vec3 vLightTS, + vec3 vViewTS, + vec3 vNormalTS ) +{ + //return noiseNormal; + //return vNormalTS; + + vec3 vLightTSAdj = vec3( -vLightTS.x, -vLightTS.y, vLightTS.z ); + + float dp = dot( vNormalTS, vLightTSAdj ); + + // Calculate the amount of illumination (lightTerm)... + + // We do both a rim lighting effect and a halfLambertian lighting effect + // and combine the result. + float halfLambertTerm = clamp( pow( dp * 0.5 + 0.5, 1.0 ), 0.0, 1.0 ); + float rimLightTerm = pow( ( 1.0 - dp ), 1.0 ); + float lightTerm = clamp( halfLambertTerm * 1.0 + rimLightTerm * dp, 0.0, 1.0 ); + lightTerm *= 0.5; + + // Use a simple RayleighPhase function to simulate single scattering towards + // the camera. + float angle = dot( vLightTS, vViewTS ); + lightTerm *= getRayleighPhase( angle ); + + // Combine terms and colors into the output color. + //vec3 lightColor = ( lightTerm * sunColor * fOcclusionShadow ) + ambientColor; + vec3 lightColor = mix( ambientColor, sunColor, lightTerm ); + //lightColor = mix( lightColor, ambientColor, cloudCoverage ); + vec3 finalColor = cloudBaseColor * lightColor; + + return finalColor; +} + +void main() +{ + // Normalize the interpolated vectors: + vec3 vViewTS = normalize( vViewTS ); + vec3 vLightTS = normalize( vLightTS ); + + vec4 cResultColor = vec4( 0, 0, 0, 1 ); + + vec2 texSample = IN_texCoord12.xy; + + vec4 noise1 = texture( normalHeightMap, IN_texCoord12.zw ); + noise1 = normalize( ( noise1 - 0.5 ) * 2.0 ); + //return noise1; + + vec4 noise2 = texture( normalHeightMap, IN_texCoord34.xy ); + noise2 = normalize( ( noise2 - 0.5 ) * 2.0 ); + //return noise2; + + vec3 noiseNormal = normalize( noise1 + noise2 ).xyz; + //return vec4( noiseNormal, 1.0 ); + + float noiseHeight = noise1.a * noise2.a * ( cloudCoverage / 2.0 + 0.5 ); + + vec3 vNormalTS = normalize( texture( normalHeightMap, texSample ).xyz * 2.0 - 1.0 ); + vNormalTS += noiseNormal; + vNormalTS = normalize( vNormalTS ); + + // Compute resulting color for the pixel: + cResultColor.rgb = ComputeIllumination( texSample, vLightTS, vViewTS, vNormalTS ); + + float coverage = ( cloudCoverage - 0.5 ) * 2.0; + cResultColor.a = texture( normalHeightMap, texSample ).a + coverage + noiseHeight; + + if ( cloudCoverage > -1.0 ) + cResultColor.a /= 1.0 + coverage; + + cResultColor.a = clamp( cResultColor.a * pow( saturate(cloudCoverage), 0.25 ), 0.0, 1.0 ); + + cResultColor.a = mix( cResultColor.a, 0.0, 1.0 - pow(IN_worldDist,2.0) ); + + OUT_col = hdrEncode(cResultColor); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerV.glsl new file mode 100644 index 000000000..395c6f286 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerV.glsl @@ -0,0 +1,106 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec4 vPosition; +in vec3 vNormal; +in vec3 vBinormal; +in vec3 vTangent; +in vec2 vTexCoord0; + +out vec4 texCoord12; +#define OUT_texCoord12 texCoord12 +out vec4 texCoord34; +#define OUT_texCoord34 texCoord34 +out vec3 vLightTS; // light vector in tangent space, denormalized +#define OUT_vLightTS vLightTS +out vec3 vViewTS; // view vector in tangent space, denormalized +#define OUT_vViewTS vViewTS +out float worldDist; +#define OUT_worldDist worldDist + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform mat4 modelview; +uniform vec3 eyePosWorld; +uniform vec3 sunVec; +uniform vec2 texOffset0; +uniform vec2 texOffset1; +uniform vec2 texOffset2; +uniform vec3 texScale; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 IN_pos = vPosition; + vec3 IN_normal = vNormal; + vec3 IN_binormal = vBinormal; + vec3 IN_tangent = vTangent; + vec2 IN_uv0 = vTexCoord0.st; + + gl_Position = modelview * IN_pos; + + // Offset the uv so we don't have a seam directly over our head. + vec2 uv = IN_uv0 + vec2( 0.5, 0.5 ); + + OUT_texCoord12.xy = uv * texScale.x; + OUT_texCoord12.xy += texOffset0; + + OUT_texCoord12.zw = uv * texScale.y; + OUT_texCoord12.zw += texOffset1; + + OUT_texCoord34.xy = uv * texScale.z; + OUT_texCoord34.xy += texOffset2; + + OUT_texCoord34.z = IN_pos.z; + OUT_texCoord34.w = 0.0; + + // Transform the normal, tangent and binormal vectors from object space to + // homogeneous projection space: + vec3 vNormalWS = -IN_normal; + vec3 vTangentWS = -IN_tangent; + vec3 vBinormalWS = -IN_binormal; + + // Compute position in world space: + vec4 vPositionWS = IN_pos + vec4( eyePosWorld, 1 ); //tMul( IN_pos, objTrans ); + + // Compute and output the world view vector (unnormalized): + vec3 vViewWS = eyePosWorld - vPositionWS.xyz; + + // Compute denormalized light vector in world space: + vec3 vLightWS = -sunVec; + + // Normalize the light and view vectors and transform it to the IN_tangent space: + mat3 mWorldToTangent = mat3( vTangentWS, vBinormalWS, vNormalWS ); + + // Propagate the view and the light vectors (in tangent space): + OUT_vLightTS = vLightWS * mWorldToTangent; + OUT_vViewTS = mWorldToTangent * vViewWS; + + OUT_worldDist = clamp( pow( max( IN_pos.z, 0 ), 2 ), 0.0, 1.0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/foliage.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/foliage.glsl new file mode 100644 index 000000000..38b66e767 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/foliage.glsl @@ -0,0 +1,186 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// CornerId corresponds to this arrangement +// from the perspective of the camera. +// +// 3 ---- 2 +// | | +// 0 ---- 1 +// + +#define MAX_COVERTYPES 8 + +uniform vec3 gc_camRight; +uniform vec3 gc_camUp; +uniform vec4 gc_typeRects[MAX_COVERTYPES]; +uniform vec2 gc_fadeParams; +uniform vec2 gc_windDir; + +// .x = gust length +// .y = premultiplied simulation time and gust frequency +// .z = gust strength +uniform vec3 gc_gustInfo; + +// .x = premultiplied simulation time and turbulance frequency +// .y = turbulance strength +uniform vec2 gc_turbInfo; + + +const float sCornerRight[4] = float[]( -0.5, 0.5, 0.5, -0.5 ); + +const float sCornerUp[4] = float[]( 0, 0, 1, 1 ); + +const float sMovableCorner[4] = float[]( 0, 0, 1, 1 ); + +const vec2 sUVCornerExtent[4] = vec2[] +( + vec2( 0, 1 ), + vec2( 1, 1 ), + vec2( 1, 0 ), + vec2( 0, 0 ) +); + + +/////////////////////////////////////////////////////////////////////////////// +// The following wind effect was derived from the GPU Gems 3 chapter... +// +// "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa, Crytek +// + +vec2 smoothCurve( vec2 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +vec2 triangleWave( vec2 x ) +{ + return abs( fract( x + 0.5 ) * 2.0 - 1.0 ); +} + +vec2 smoothTriangleWave( vec2 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +float windTurbulence( float bbPhase, float frequency, float strength ) +{ + // We create the input value for wave generation from the frequency and phase. + vec2 waveIn = vec2( bbPhase + frequency ); + + // We use two square waves to generate the effect which + // is then scaled by the overall strength. + vec2 waves = ( fract( waveIn.xy * vec2( 1.975, 0.793 ) ) * 2.0 - 1.0 ); + waves = smoothTriangleWave( waves ); + + // Sum up the two waves into a single wave. + return ( waves.x + waves.y ) * strength; +} + +vec2 windEffect( float bbPhase, + vec2 windDirection, + float gustLength, + float gustFrequency, + float gustStrength, + float turbFrequency, + float turbStrength ) +{ + // Calculate the ambient wind turbulence. + float turbulence = windTurbulence( bbPhase, turbFrequency, turbStrength ); + + // We simulate the overall gust via a sine wave. + float gustPhase = clamp( sin( ( bbPhase - gustFrequency ) / gustLength ) , 0.0, 1.0 ); + float gustOffset = ( gustPhase * gustStrength ) + ( ( 0.2 + gustPhase ) * turbulence ); + + // Return the final directional wind effect. + return vec2(gustOffset) * windDirection.xy; +} + +void foliageProcessVert( inout vec3 position, + inout vec4 diffuse, + inout vec4 texCoord, + inout vec3 normal, + inout vec3 T, + in vec3 eyePos ) +{ + // Assign the normal and tagent values. + //normal = vec3( 0, 0, 1 );//cross( gc_camUp, gc_camRight ); + T = gc_camRight; + + // Pull out local vars we need for work. + int corner = int( ( diffuse.a * 255.0 ) + 0.5 ); + vec2 size = texCoord.xy; + int type = int( texCoord.z ); + + // The billboarding is based on the camera direction. + vec3 rightVec = gc_camRight * sCornerRight[corner]; + vec3 upVec = gc_camUp * sCornerUp[corner]; + + // Figure out the corner position. + vec3 outPos = ( upVec * size.y ) + ( rightVec * size.x ); + float len = length( outPos.xyz ); + + // We derive the billboard phase used for wind calculations from its position. + float bbPhase = dot( position.xyz, vec3( 1.0 ) ); + + // Get the overall wind gust and turbulence effects. + vec3 wind; + wind.xy = windEffect( bbPhase, + gc_windDir, + gc_gustInfo.x, gc_gustInfo.y, gc_gustInfo.z, + gc_turbInfo.x, gc_turbInfo.y ); + wind.z = 0.0; + + // Add the summed wind effect into the point. + outPos.xyz += wind.xyz * texCoord.w; + + // Do a simple spherical clamp to keep the foliage + // from stretching too much by wind effect. + outPos.xyz = normalize( outPos.xyz ) * len; + + // Move the point into world space. + position += outPos; + + // Grab the uv set and setup the texture coord. + vec4 uvSet = gc_typeRects[type]; + texCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + texCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Animate the normal to get lighting changes + // across the the wind swept foliage. + // + // TODO: Expose the 10x as a factor to control + // how much the wind effects the lighting on the grass. + // + normal.xy += wind.xy * ( 10.0 * texCoord.w ); + normal = normalize( normal ); + + // Get the alpha fade value. + + float fadeStart = gc_fadeParams.x; + float fadeEnd = gc_fadeParams.y; + float fadeRange = fadeEnd - fadeStart; + + float dist = distance( eyePos, position.xyz ) - fadeStart; + diffuse.a = 1.0 - clamp( dist / fadeRange, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorP.glsl new file mode 100644 index 000000000..b4d591486 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorP.glsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap, alphaMap; +uniform vec4 groundAlpha; + +in vec4 color, groundAlphaCoeff; +in vec2 outTexCoord, alphaLookup; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 alpha = texture(alphaMap, alphaLookup); + OUT_col = color * texture(diffuseMap, outTexCoord); + OUT_col.a = OUT_col.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorV.glsl new file mode 100644 index 000000000..c8dcf1ddb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorV.glsl @@ -0,0 +1,99 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec3 vNormal; +in vec4 vColor; +in vec2 vTexCoord0; +in vec2 vTexCoord1; +in vec2 vTexCoord2; + +uniform mat4 projection, world; +uniform vec3 CameraPos; +uniform float GlobalSwayPhase, SwayMagnitudeSide, SwayMagnitudeFront, + GlobalLightPhase, LuminanceMagnitude, LuminanceMidpoint, DistanceRange; + +out vec4 color, groundAlphaCoeff; +out vec2 outTexCoord, alphaLookup; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Init a transform matrix to be used in the following steps + mat4 trans = mat4(0.0); + trans[0][0] = 1.0; + trans[1][1] = 1.0; + trans[2][2] = 1.0; + trans[3][3] = 1.0; + trans[3][0] = vPosition.x; + trans[3][1] = vPosition.y; + trans[3][2] = vPosition.z; + + // Billboard transform * world matrix + mat4 o = world; + o = o * trans; + + // Keep only the up axis result and position transform. + // This gives us "cheating" cylindrical billboarding. + o[0][0] = 1.0; + o[0][1] = 0.0; + o[0][2] = 0.0; + o[0][3] = 0.0; + o[1][0] = 0.0; + o[1][1] = 1.0; + o[1][2] = 0.0; + o[1][3] = 0.0; + + // Handle sway. Sway is stored in a texture coord. The x coordinate is the sway phase multiplier, + // the y coordinate determines if this vertex actually sways or not. + float xSway, ySway; + float wavePhase = GlobalSwayPhase * vTexCoord1.x; + ySway = sin(wavePhase); + xSway = cos(wavePhase); + xSway = xSway * vTexCoord1.y * SwayMagnitudeSide; + ySway = ySway * vTexCoord1.y * SwayMagnitudeFront; + vec4 p; + p = o * vec4(vNormal.x + xSway, ySway, vNormal.z, 1.0); + + // Project the point + gl_Position = projection * p; + + // Lighting + float Luminance = LuminanceMidpoint + LuminanceMagnitude * cos(GlobalLightPhase + vNormal.y); + + // Alpha + vec3 worldPos = vec3(vPosition.x, vPosition.y, vPosition.z); + float alpha = abs(distance(worldPos, CameraPos)) / DistanceRange; + alpha = clamp(alpha, 0.0, 1.0); //pass it through + + alphaLookup = vec2(alpha, 0.0); + bool alphaCoeff = bool(vNormal.z); + groundAlphaCoeff = vec4(float(alphaCoeff)); + outTexCoord = vTexCoord0.st; + color = vec4(Luminance, Luminance, Luminance, 1.0); + gl_Position.y *= -1; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/guiMaterialV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/guiMaterialV.glsl new file mode 100644 index 000000000..de3845ee7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/guiMaterialV.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4x4 modelview; + +out vec4 hpos; +out vec2 uv0; + + +void main() +{ + hpos = vec4( modelview * vPosition ); + gl_Position = hpos; + + uv0 = vTexCoord0.st; + gl_Position.y *= -1; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/hlslCompat.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/hlslCompat.glsl new file mode 100644 index 000000000..b9a6e76d7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/hlslCompat.glsl @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// These are some simple wrappers for simple +// HLSL compatibility. + +#define float4 vec4 +#define float3 vec3 +#define float2 vec2 + +#define half float +#define half2 vec2 +#define half3 vec3 +#define half4 vec4 + +#define float4x4 mat4 +#define float3x3 mat3 +#define float2x2 mat2 + +#define texCUBE texture +#define tex2D texture +#define tex1D texture +#define tex2Dproj textureProj +#define tex2Dlod( sampler, texCoord ) textureLod(sampler, texCoord.xy, texCoord.w) + +#define samplerCUBE samplerCube + +#define frac fract + +#define lerp mix + +void tSetMatrixRow(inout float3x3 m, int row, float3 value) +{ + m[0][row] = value.x; + m[1][row] = value.y; + m[2][row] = value.z; +} + +void tSetMatrixRow(inout float4x4 m, int row, float4 value) +{ + m[0][row] = value.x; + m[1][row] = value.y; + m[2][row] = value.z; + m[3][row] = value.w; +} + +#define tGetMatrix3Row(matrix, row) float3(matrix[0][row], matrix[1][row], matrix[2][row]) +#define tGetMatrix4Row(matrix, row) float4(matrix[0][row], matrix[1][row], matrix[2][row], matrix[3][row]) + +float3x3 float4x4to3x3(float4x4 m) +{ + return float3x3( vec3(m[0]).xyz, m[1].xyz, m[2].xyz); +} + +float3x3 float4x4to3x3_(float4x4 m) +{ + return float3x3( vec3(m[0]), m[1].xyz, m[2].xyz); +} + +mat4 mat4FromRow( float r0c0, float r0c1, float r0c2, float r0c3, + float r1c0, float r1c1, float r1c2, float r1c3, + float r2c0, float r2c1, float r2c2, float r2c3, + float r3c0, float r3c1, float r3c2, float r3c3 ) +{ + return mat4( r0c0, r1c0, r2c0, r3c0, + r0c1, r1c1, r2c1, r3c1, + r0c2, r1c2, r2c2, r3c2, + r0c3, r1c3, r2c3, r3c3 ); +} + + +#define saturate( val ) clamp( val, 0.0, 1.0 ) + +#define round( n ) (sign( n ) * floor( abs( n ) + 0.5 )) + +#define tMul(a, b) (a*b) + +#define correctSSP(vec) vec.y *= -1 + +#ifdef TORQUE_PIXEL_SHADER + void clip(float a) { if(a < 0) discard;} +#endif diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/imposter.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/imposter.glsl new file mode 100644 index 000000000..20bc62688 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/imposter.glsl @@ -0,0 +1,161 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" + + +#define IMPOSTER_MAX_UVS 64 + + +void imposter_v( + // These parameters usually come from the vertex. + vec3 center, + int corner, + float halfSize, + vec3 imposterUp, + vec3 imposterRight, + + // These are from the imposter shader constant. + int numEquatorSteps, + int numPolarSteps, + float polarAngle, + bool includePoles, + + // Other shader constants. + vec3 camPos, + vec4 uvs[IMPOSTER_MAX_UVS], + + // The outputs of this function. + out vec3 outWsPosition, + out vec2 outTexCoord, + out mat3 outWorldToTangent + ) +{ + + float M_HALFPI_F = 1.57079632679489661923; + float M_PI_F = 3.14159265358979323846; + float M_2PI_F = 6.28318530717958647692; + + + float sCornerRight[4];// = float[]( -1.0, 1.0, 1.0, -1.0 ); + sCornerRight[0] = -1.0; + sCornerRight[1] = 1.0; + sCornerRight[2] = 1.0; + sCornerRight[3] = -1.0; + float sCornerUp[4];// = float[]( -1.0, -1.0, 1.0, 1.0 ); + sCornerUp[0] = -1.0; + sCornerUp[1] = -1.0; + sCornerUp[2] = 1.0; + sCornerUp[3] = 1.0; + vec2 sUVCornerExtent[4];// = vec2[](vec2( 0.0, 1.0 ), vec2( 1.0, 1.0 ), vec2( 1.0, 0.0 ), vec2( 0.0, 0.0 )); + sUVCornerExtent[0] = vec2( 0.0, 1.0 ); + sUVCornerExtent[1] = vec2( 1.0, 1.0 ); + sUVCornerExtent[2] = vec2( 1.0, 0.0 ); + sUVCornerExtent[3] = vec2( 0.0, 0.0 ); + + // TODO: This could all be calculated on the CPU. + float equatorStepSize = M_2PI_F / float( numEquatorSteps ); + float equatorHalfStep = ( equatorStepSize / 2.0 ) - 0.0001; + float polarStepSize = M_PI_F / float( numPolarSteps ); + float polarHalfStep = ( polarStepSize / 2.0 ) - 0.0001; + + // The vector between the camera and the billboard. + vec3 lookVec = normalize( camPos - center ); + + // Generate the camera up and right vectors from + // the object transform and camera forward. + vec3 camUp = imposterUp; + vec3 camRight = cross( -lookVec, camUp ); + + // The billboarding is based on the camera directions. + vec3 rightVec = camRight * sCornerRight[corner]; + vec3 upVec = camUp * sCornerUp[corner]; + + float lookPitch = acos( dot( imposterUp, lookVec ) ); + + // First check to see if we need to render the top billboard. + int index; + /* + if ( includePoles && ( lookPitch < polarAngle || lookPitch > sPi - polarAngle ) ) + { + index = numEquatorSteps * 3; + + // When we render the top/bottom billboard we always use + // a fixed vector that matches the rotation of the object. + rightVec = vec3( 1, 0, 0 ) * sCornerRight[corner]; + upVec = vec3( 0, 1, 0 ) * sCornerUp[corner]; + + if ( lookPitch > sPi - polarAngle ) + { + upVec = -upVec; + index++; + } + } + else + */ + { + // Calculate the rotation around the z axis then add the + // equator half step. This gets the images to switch a + // half step before the captured angle is met. + float lookAzimuth = atan( lookVec.y, lookVec.x ); + float azimuth = atan( imposterRight.y, imposterRight.x ); + float rotZ = ( lookAzimuth - azimuth ) + equatorHalfStep; + + // The y rotation is calculated from the look vector and + // the object up vector. + float rotY = lookPitch - polarHalfStep; + + // TODO: How can we do this without conditionals? + // Normalize the result to 0 to 2PI. + if ( rotZ < 0.0 ) + rotZ += M_2PI_F; + if ( rotZ > M_2PI_F ) + rotZ -= M_2PI_F; + if ( rotY < 0.0 ) + rotY += M_2PI_F; + if ( rotY > M_PI_F ) // Not M_2PI_F? + rotY -= M_2PI_F; + + float polarIdx = round( abs( rotY ) / polarStepSize ); + + // Get the index to the start of the right polar + // images for this viewing angle. + int numPolarOffset = int( float( numEquatorSteps ) * polarIdx ); + + // Calculate the final image index for lookup + // of the texture coords. + index = int( rotZ / equatorStepSize ) + numPolarOffset; + } + + // Generate the final world space position. + outWsPosition = center + ( upVec * halfSize ) + ( rightVec * halfSize ); + + // Grab the uv set and setup the texture coord. + vec4 uvSet = uvs[index]; + outTexCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + outTexCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Needed for normal mapping and lighting. + outWorldToTangent[0] = vec3( 1, 0, 0 ); + outWorldToTangent[1] = vec3( 0, 1, 0 ); + outWorldToTangent[2] = vec3( 0, 0, -1 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl new file mode 100644 index 000000000..804ab1e3b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl @@ -0,0 +1,249 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./torque.glsl" + +#ifndef TORQUE_SHADERGEN + +// These are the uniforms used by most lighting shaders. + +uniform vec4 inLightPos[3]; +uniform vec4 inLightInvRadiusSq; +uniform vec4 inLightColor[4]; + +#ifndef TORQUE_BL_NOSPOTLIGHT + uniform vec4 inLightSpotDir[3]; + uniform vec4 inLightSpotAngle; + uniform vec4 inLightSpotFalloff; +#endif + +uniform vec4 ambient; +#define ambientCameraFactor 0.3 +uniform float specularPower; +uniform vec4 specularColor; + +#endif // !TORQUE_SHADERGEN + + +void compute4Lights( vec3 wsView, + vec3 wsPosition, + vec3 wsNormal, + vec4 shadowMask, + + #ifdef TORQUE_SHADERGEN + + vec4 inLightPos[3], + vec4 inLightInvRadiusSq, + vec4 inLightColor[4], + vec4 inLightSpotDir[3], + vec4 inLightSpotAngle, + vec4 inLightSpotFalloff, + float specularPower, + vec4 specularColor, + + #endif // TORQUE_SHADERGEN + + out vec4 outDiffuse, + out vec4 outSpecular ) +{ + // NOTE: The light positions and spotlight directions + // are stored in SoA order, so inLightPos[0] is the + // x coord for all 4 lights... inLightPos[1] is y... etc. + // + // This is the key to fully utilizing the vector units and + // saving a huge amount of instructions. + // + // For example this change saved more than 10 instructions + // over a simple for loop for each light. + + int i; + + vec4 lightVectors[3]; + for ( i = 0; i < 3; i++ ) + lightVectors[i] = wsPosition[i] - inLightPos[i]; + + vec4 squareDists = vec4(0); + for ( i = 0; i < 3; i++ ) + squareDists += lightVectors[i] * lightVectors[i]; + + // Accumulate the dot product between the light + // vector and the normal. + // + // The normal is negated because it faces away from + // the surface and the light faces towards the + // surface... this keeps us from needing to flip + // the light vector direction which complicates + // the spot light calculations. + // + // We normalize the result a little later. + // + vec4 nDotL = vec4(0); + for ( i = 0; i < 3; i++ ) + nDotL += lightVectors[i] * -wsNormal[i]; + + vec4 rDotL = vec4(0); + #ifndef TORQUE_BL_NOSPECULAR + + // We're using the Phong specular reflection model + // here where traditionally Torque has used Blinn-Phong + // which has proven to be more accurate to real materials. + // + // We do so because its cheaper as do not need to + // calculate the half angle for all 4 lights. + // + // Advanced Lighting still uses Blinn-Phong, but the + // specular reconstruction it does looks fairly similar + // to this. + // + vec3 R = reflect( wsView, -wsNormal ); + + for ( i = 0; i < 3; i++ ) + rDotL += lightVectors[i] * R[i]; + + #endif + + // Normalize the dots. + // + // Notice we're using the half type here to get a + // much faster sqrt via the rsq_pp instruction at + // the loss of some precision. + // + // Unless we have some extremely large point lights + // i don't believe the precision loss will matter. + // + half4 correction = half4(inversesqrt( squareDists )); + nDotL = saturate( nDotL * correction ); + rDotL = clamp( rDotL * correction, 0.00001, 1.0 ); + + // First calculate a simple point light linear + // attenuation factor. + // + // If this is a directional light the inverse + // radius should be greater than the distance + // causing the attenuation to have no affect. + // + vec4 atten = saturate( 1.0 - ( squareDists * inLightInvRadiusSq ) ); + + #ifndef TORQUE_BL_NOSPOTLIGHT + + // The spotlight attenuation factor. This is really + // fast for what it does... 6 instructions for 4 spots. + + vec4 spotAtten = vec4(0); + for ( i = 0; i < 3; i++ ) + spotAtten += lightVectors[i] * inLightSpotDir[i]; + + vec4 cosAngle = ( spotAtten * correction ) - inLightSpotAngle; + atten *= saturate( cosAngle * inLightSpotFalloff ); + + #endif + + // Finally apply the shadow masking on the attenuation. + atten *= shadowMask; + + // Get the final light intensity. + vec4 intensity = nDotL * atten; + + // Combine the light colors for output. + outDiffuse = vec4(0); + for ( i = 0; i < 4; i++ ) + outDiffuse += intensity[i] * inLightColor[i]; + + // Output the specular power. + vec4 specularIntensity = pow( rDotL, vec4(specularPower) ) * atten; + + // Apply the per-light specular attenuation. + vec4 specular = vec4(0,0,0,1); + for ( i = 0; i < 4; i++ ) + specular += vec4( inLightColor[i].rgb * inLightColor[i].a * specularIntensity[i], 1 ); + + // Add the final specular intensity values together + // using a single dot product operation then get the + // final specular lighting color. + outSpecular = specularColor * specular; +} + + +// This value is used in AL as a constant power to raise specular values +// to, before storing them into the light info buffer. The per-material +// specular value is then computer by using the integer identity of +// exponentiation: +// +// (a^m)^n = a^(m*n) +// +// or +// +// (specular^constSpecular)^(matSpecular/constSpecular) = specular^(matSpecular*constSpecular) +// +#define AL_ConstantSpecularPower 12.0f + +/// The specular calculation used in Advanced Lighting. +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +float AL_CalcSpecular( vec3 toLight, vec3 normal, vec3 toEye ) +{ + // (R.V)^c + float specVal = dot( normalize( -reflect( toLight, normal ) ), toEye ); + + // Return the specular factor. + return pow( max( specVal, 0.00001f ), AL_ConstantSpecularPower ); +} + +/// The output for Deferred Lighting +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +vec4 AL_DeferredOutput( + vec3 lightColor, + vec3 diffuseColor, + vec4 matInfo, + vec4 ambient, + float specular, + float shadowAttenuation) +{ + vec3 specularColor = vec3(specular); + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + specularColor = 0.04 * (1 - specular) + diffuseColor * specular; + } + + //specular = color * map * spec^gloss + float specularOut = (specularColor * matInfo.b * min(pow(max(specular,1.0f), max((matInfo.a / AL_ConstantSpecularPower),1.0f)),matInfo.a)).r; + + lightColor *= vec3(shadowAttenuation); + lightColor += ambient.rgb; + return vec4(lightColor.rgb, specularOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeP.glsl new file mode 100644 index 000000000..e33c9bd97 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeP.glsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + +in vec4 offscreenPos; +in vec4 backbufferPos; + +#define IN_offscreenPos offscreenPos +#define IN_backbufferPos backbufferPos + +uniform sampler2D colorSource; +uniform vec4 offscreenTargetParams; + +#ifdef TORQUE_LINEAR_DEPTH +#define REJECT_EDGES +uniform sampler2D edgeSource; +uniform vec4 edgeTargetParams; +#endif + +out vec4 OUT_col; + +void main() +{ + // Off-screen particle source screenspace position in XY + // Back-buffer screenspace position in ZW + vec4 ssPos = vec4(offscreenPos.xy / offscreenPos.w, backbufferPos.xy / backbufferPos.w); + + vec4 uvScene = ( ssPos + 1.0 ) / 2.0; + uvScene.yw = 1.0 - uvScene.yw; + uvScene.xy = viewportCoordToRenderTarget(uvScene.xy, offscreenTargetParams); + +#ifdef REJECT_EDGES + // Cut out particles along the edges, this will create the stencil mask + uvScene.zw = viewportCoordToRenderTarget(uvScene.zw, edgeTargetParams); + float edge = texture( edgeSource, uvScene.zw ).r; + clip( -edge ); +#endif + + // Sample offscreen target and return + OUT_col = texture( colorSource, uvScene.xy ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeV.glsl new file mode 100644 index 000000000..8c8f840d1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeV.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec2 vTexCoord0; +#define uvCoord vTexCoord0 + +out vec4 offscreenPos; +out vec4 backbufferPos; + +#define OUT_hpos gl_Position +#define OUT_offscreenPos offscreenPos +#define OUT_backbufferPos backbufferPos + +uniform vec4 screenRect; // point, extent + +void main() +{ + OUT_hpos = vec4(uvCoord.xy, 1.0, 1.0); + OUT_hpos.xy *= screenRect.zw; + OUT_hpos.xy += screenRect.xy; + + OUT_backbufferPos = OUT_hpos; + OUT_offscreenPos = OUT_hpos; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particlesP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesP.glsl new file mode 100644 index 000000000..cf35e5f1b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesP.glsl @@ -0,0 +1,113 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + +// With advanced lighting we get soft particles. +#ifdef TORQUE_LINEAR_DEPTH + #define SOFTPARTICLES +#endif + +#ifdef SOFTPARTICLES + + #include "shadergen:/autogenConditioners.h" + + uniform float oneOverSoftness; + uniform float oneOverFar; + uniform sampler2D deferredTex; + //uniform vec3 vEye; + uniform vec4 deferredTargetParams; +#endif + +#define CLIP_Z // TODO: Make this a proper macro + +in vec4 color; +in vec2 uv0; +in vec4 pos; + +#define IN_color color +#define IN_uv0 uv0 +#define IN_pos pos + +uniform sampler2D diffuseMap; + +uniform sampler2D paraboloidLightMap; + +vec4 lmSample( vec3 nrm ) +{ + bool calcBack = (nrm.z < 0.0); + if ( calcBack ) + nrm.z = nrm.z * -1.0; + + vec2 lmCoord; + lmCoord.x = (nrm.x / (2*(1 + nrm.z))) + 0.5; + lmCoord.y = 1-((nrm.y / (2*(1 + nrm.z))) + 0.5); + + + // If this is the back, offset in the atlas + if ( calcBack ) + lmCoord.x += 1.0; + + // Atlasing front and back maps, so scale + lmCoord.x *= 0.5; + + return texture(paraboloidLightMap, lmCoord); +} + + +uniform float alphaFactor; +uniform float alphaScale; + +out vec4 OUT_col; + +void main() +{ + float softBlend = 1; + + #ifdef SOFTPARTICLES + vec2 tc = IN_pos.xy * vec2(1.0, -1.0) / IN_pos.w; + tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams); + + float sceneDepth = deferredUncondition( deferredTex, tc ).w; + float depth = IN_pos.w * oneOverFar; + float diff = sceneDepth - depth; + #ifdef CLIP_Z + // If drawing offscreen, this acts as the depth test, since we don't line up with the z-buffer + // When drawing high-res, though, we want to be able to take advantage of hi-z + // so this is #ifdef'd out + //clip(diff); + #endif + softBlend = saturate( diff * oneOverSoftness ); + #endif + + vec4 diffuse = texture( diffuseMap, IN_uv0 ); + + //OUT_col = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale); + + // Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha) + vec3 colorScale = ( alphaFactor < 0.0 ? IN_color.rgb * diffuse.rgb : vec3( alphaFactor > 0.0 ? IN_color.a * diffuse.a * alphaFactor * softBlend : softBlend ) ); + + OUT_col = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale, + IN_color.a * diffuse.a * softBlend * alphaScale ) ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particlesV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesV.glsl new file mode 100644 index 000000000..3d75a6fb6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesV.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +#define In_pos vPosition +#define In_color vColor +#define In_uv0 vTexCoord0 + +out vec4 color; +out vec2 uv0; +out vec4 pos; + +#define OUT_hpos gl_Position +#define OUT_color color +#define OUT_uv0 uv0 +#define OUT_pos pos + +uniform mat4 modelViewProj; +uniform mat4 fsModelViewProj; + +void main() +{ + OUT_hpos = tMul( modelViewProj, In_pos ); + OUT_pos = tMul( fsModelViewProj, In_pos ); + OUT_color = In_color; + OUT_uv0 = In_uv0; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpP.glsl new file mode 100644 index 000000000..db4250487 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpP.glsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap, refractMap, bumpMap; +uniform vec4 shadeColor; + +in vec2 TEX0; +in vec4 TEX1; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Fade edges of axis for texcoord passed in +//----------------------------------------------------------------------------- +float fadeAxis( float val ) +{ + // Fades from 1.0 to 0.0 when less than 0.1 + float fadeLow = clamp( val * 10.0, 0.0, 1.0 ); + + // Fades from 1.0 to 0.0 when greater than 0.9 + float fadeHigh = 1.0 - clamp( (val - 0.9) * 10.0, 0.0, 1.0 ); + + return fadeLow * fadeHigh; +} + + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec3 bumpNorm = texture( bumpMap, TEX0 ).rgb * 2.0 - 1.0; + vec2 offset = vec2( bumpNorm.x, bumpNorm.y ); + vec4 texIndex = TEX1; + + // The fadeVal is used to "fade" the distortion at the edges of the screen. + // This is done so it won't sample the reflection texture out-of-bounds and create artifacts + // Note - this can be done more efficiently with a texture lookup + float fadeVal = fadeAxis( texIndex.x / texIndex.w ) * fadeAxis( texIndex.y / texIndex.w ); + + const float distortion = 0.2; + texIndex.xy += offset * distortion * fadeVal; + + vec4 diffuseColor = texture( diffuseMap, TEX0 ); + vec4 reflectColor = textureProj( refractMap, texIndex ); + + OUT_col = diffuseColor + reflectColor * diffuseColor.a; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpV.glsl new file mode 100644 index 000000000..90bcd27d8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpV.glsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; + +out vec2 TEX0; +out vec4 TEX1; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + mat4 texGenTest = mat4(0.5, 0.0, 0.0, 0.0, + 0.0, -0.5, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.5, 0.5, 0.0, 1.0); + + gl_Position = modelview * vPosition; + + TEX0 = vTexCoord0.st; + + TEX1 = texGenTest * gl_Position; + TEX1.y = -TEX1.y; + gl_Position.y *= -1; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectP.glsl new file mode 100644 index 000000000..384c16188 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectP.glsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap, refractMap; +uniform vec4 shadeColor; + +in vec2 TEX0; +in vec4 TEX1; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 diffuseColor = texture( diffuseMap, TEX0 ); + vec4 reflectColor = textureProj( refractMap, TEX1 ); + + OUT_col = diffuseColor + reflectColor * diffuseColor.a; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectV.glsl new file mode 100644 index 000000000..ba2484f66 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectV.glsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; + +out vec2 TEX0; +out vec4 TEX1; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + mat4 texGenTest = mat4(0.5, 0.0, 0.0, 0.0, + 0.0, -0.5, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.5, 0.5, 0.0, 1.0); + + gl_Position = modelview * vPosition; + + TEX0 = vTexCoord0; + + TEX1 = texGenTest * gl_Position; + TEX1.y = -TEX1.y; + +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/precipP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/precipP.glsl new file mode 100644 index 000000000..102d0b0aa --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/precipP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap; + +in vec4 color; +in vec2 texCoord; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + OUT_col = texture(diffuseMap, texCoord) * color; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/precipV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/precipV.glsl new file mode 100644 index 000000000..29f921630 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/precipV.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; +uniform vec3 cameraPos, ambient; +uniform vec2 fadeStartEnd; + +out vec4 color; +out vec2 texCoord; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + gl_Position = modelview * vPosition; + texCoord = vTexCoord0.st; + color = vec4( ambient.r, ambient.g, ambient.b, 1.0 ); + + // Do we need to do a distance fade? + if ( fadeStartEnd.x < fadeStartEnd.y ) + { + + float distance = length( cameraPos - vPosition.xyz ); + color.a = abs( clamp( ( distance - fadeStartEnd.x ) / ( fadeStartEnd.y - fadeStartEnd.x ), 0.0, 1.0 ) - 1.0 ); + } + gl_Position.y *= -1; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowP.glsl new file mode 100644 index 000000000..9b0ff0d0b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowP.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec2 texCoord; +in vec4 color; +in float fade; + +out vec4 OUT_col; + +uniform sampler2D inputTex; +uniform vec4 ambient; + + +void main() +{ + float shadow = texture( inputTex, texCoord ).a * color.a; + OUT_col = ( ambient * shadow ) + ( 1 - shadow ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowV.glsl new file mode 100644 index 000000000..c8b6d2a92 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowV.glsl @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; +in vec2 vTexCoord1; + +out vec2 texCoord; +out vec4 color; +out float fade; + +uniform mat4 modelview; +uniform float shadowLength; +uniform vec3 shadowCasterPosition; + +void main() +{ + gl_Position = modelview * vec4(vPosition.xyz, 1.0); + + color = vColor; + texCoord = vTexCoord0.st; + + float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; + fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyP.glsl new file mode 100644 index 000000000..6d4e3ea75 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyP.glsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + + +// Conn +in vec4 rayleighColor; +#define IN_rayleighColor rayleighColor +in vec4 mieColor; +#define IN_mieColor mieColor +in vec3 v3Direction; +#define IN_v3Direction v3Direction +in vec3 pos; +#define IN_pos pos + +uniform samplerCube nightSky ; +uniform vec4 nightColor; +uniform vec2 nightInterpAndExposure; +uniform float useCubemap; +uniform vec3 lightDir; +uniform vec3 sunDir; + +out vec4 OUT_col; + +void main() +{ + + float fCos = dot( lightDir, IN_v3Direction ) / length(IN_v3Direction); + float fCos2 = fCos*fCos; + + float g = -0.991; + float g2 = -0.991 * -0.991; + + float fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) / pow(abs(1.0 + g2 - 2.0*g*fCos), 1.5); + + vec4 color = IN_rayleighColor + fMiePhase * IN_mieColor; + color.a = color.b; + + vec4 nightSkyColor = texture(nightSky, -v3Direction); + nightSkyColor = mix(nightColor, nightSkyColor, useCubemap); + + float fac = dot( normalize( pos ), sunDir ); + fac = max( nightInterpAndExposure.y, pow( clamp( fac, 0.0, 1.0 ), 2 ) ); + OUT_col = mix( color, nightSkyColor, nightInterpAndExposure.y ); + + OUT_col.a = 1; + + OUT_col = clamp(OUT_col, 0.0, 1.0); + + OUT_col = hdrEncode( OUT_col ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyV.glsl new file mode 100644 index 000000000..5780d2df9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyV.glsl @@ -0,0 +1,154 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +// The scale equation calculated by Vernier's Graphical Analysis +float vernierScale(float fCos) +{ + float x = 1.0 - fCos; + float x5 = x * 5.25; + float x5p6 = (-6.80 + x5); + float xnew = (3.83 + x * x5p6); + float xfinal = (0.459 + x * xnew); + float xfinal2 = -0.00287 + x * xfinal; + float outx = exp( xfinal2 ); + return 0.25 * outx; +} + +in vec4 vPosition; + +// This is the shader input vertex structure. +#define IN_position vPosition + +// This is the shader output data. +out vec4 rayleighColor; +#define OUT_rayleighColor rayleighColor +out vec4 mieColor; +#define OUT_mieColor mieColor +out vec3 v3Direction; +#define OUT_v3Direction v3Direction +out vec3 pos; +#define OUT_pos pos + +uniform mat4 modelView; +uniform vec4 misc; +uniform vec4 sphereRadii; +uniform vec4 scatteringCoeffs; +uniform vec3 camPos; +uniform vec3 lightDir; +uniform vec4 invWaveLength; +uniform vec4 colorize; + +vec3 desaturate(const vec3 color, const float desaturation) +{ + const vec3 gray_conv = vec3 (0.30, 0.59, 0.11); + return mix(color, vec3(dot(gray_conv , color)), desaturation); +} + +void main() +{ + // Pull some variables out: + float camHeight = misc.x; + float camHeightSqr = misc.y; + + float scale = misc.z; + float scaleOverScaleDepth = misc.w; + + float outerRadius = sphereRadii.x; + float outerRadiusSqr = sphereRadii.y; + + float innerRadius = sphereRadii.z; + float innerRadiusSqr = sphereRadii.w; + + float rayleighBrightness = scatteringCoeffs.x; // Kr * ESun + float rayleigh4PI = scatteringCoeffs.y; // Kr * 4 * PI + + float mieBrightness = scatteringCoeffs.z; // Km * ESun + float mie4PI = scatteringCoeffs.w; // Km * 4 * PI + + // Get the ray from the camera to the vertex, + // and its length (which is the far point of the ray + // passing through the atmosphere). + vec3 v3Pos = vec3(IN_position / 6378000.0);// / outerRadius; + vec3 newCamPos = vec3( 0, 0, camHeight ); + v3Pos.z += innerRadius; + vec3 v3Ray = v3Pos.xyz - newCamPos; + float fFar = length(v3Ray); + v3Ray /= fFar; + + // Calculate the ray's starting position, + // then calculate its scattering offset. + vec3 v3Start = newCamPos; + float fHeight = length(v3Start); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - camHeight)); + float fStartAngle = dot(v3Ray, v3Start) / fHeight; + + float fStartOffset = fDepth * vernierScale( fStartAngle ); + + // Initialize the scattering loop variables. + float fSampleLength = fFar / 2.0; + float fScaledLength = fSampleLength * scale; + vec3 v3SampleRay = v3Ray * fSampleLength; + vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5; + + // Now loop through the sample rays + vec3 v3FrontColor = vec3(0.0, 0.0, 0.0); + for(int i=0; i<2; i++) + { + float fHeight = length(v3SamplePoint); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - fHeight)); + float fLightAngle = dot(lightDir, v3SamplePoint) / fHeight; + float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight; + + float vscale3 = vernierScale( fCameraAngle ); + float vscale2 = vernierScale( fLightAngle ); + + float fScatter = (fStartOffset + fDepth*(vscale2 - vscale3)); + vec3 v3Attenuate = exp(-fScatter * (invWaveLength.xyz * rayleigh4PI + mie4PI)); + v3FrontColor += v3Attenuate * (fDepth * fScaledLength); + v3SamplePoint += v3SampleRay; + } + + // Finally, scale the Mie and Rayleigh colors + // and set up the varying variables for the pixel shader. + gl_Position = modelView * IN_position; + OUT_mieColor.rgb = v3FrontColor * mieBrightness; + OUT_mieColor.a = 1.0; + OUT_rayleighColor.rgb = v3FrontColor * (invWaveLength.xyz * rayleighBrightness); + OUT_rayleighColor.a = 1.0; + OUT_v3Direction = newCamPos - v3Pos.xyz; + OUT_pos = IN_position.xyz; + +#ifdef USE_COLORIZE + + OUT_rayleighColor.rgb = desaturate(OUT_rayleighColor.rgb, 1) * colorize.a; + + OUT_rayleighColor.r *= colorize.r; + OUT_rayleighColor.g *= colorize.g; + OUT_rayleighColor.b *= colorize.b; + +#endif + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl new file mode 100644 index 000000000..6e369bd5e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl @@ -0,0 +1,339 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_GLSL_ +#define _TORQUE_GLSL_ + + +float M_HALFPI_F = 1.57079632679489661923; +float M_PI_F = 3.14159265358979323846; +float M_2PI_F = 6.28318530717958647692; + +/// Calculate fog based on a start and end positions in worldSpace. +float computeSceneFog( vec3 startPos, + vec3 endPos, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( endPos.z * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a start and end position and a height. +/// Positions do not need to be in worldSpace but height does. +float computeSceneFog( vec3 startPos, + vec3 endPos, + float height, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( height * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a distance, height is not used. +float computeSceneFog( float dist, float fogDensity, float fogDensityOffset ) +{ + float f = dist - fogDensityOffset; + return exp( -fogDensity * f ); +} + + +/// Convert a vec4 uv in viewport space to render target space. +vec2 viewportCoordToRenderTarget( vec4 inCoord, vec4 rtParams ) +{ + vec2 outCoord = inCoord.xy / inCoord.w; + outCoord = ( outCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a vec2 uv in viewport space to render target space. +vec2 viewportCoordToRenderTarget( vec2 inCoord, vec4 rtParams ) +{ + vec2 outCoord = ( inCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a vec4 quaternion into a 3x3 matrix. +mat3x3 quatToMat( vec4 quat ) +{ + float xs = quat.x * 2.0; + float ys = quat.y * 2.0; + float zs = quat.z * 2.0; + + float wx = quat.w * xs; + float wy = quat.w * ys; + float wz = quat.w * zs; + + float xx = quat.x * xs; + float xy = quat.x * ys; + float xz = quat.x * zs; + + float yy = quat.y * ys; + float yz = quat.y * zs; + float zz = quat.z * zs; + + mat3x3 mat; + + mat[0][0] = 1.0 - (yy + zz); + mat[1][0] = xy - wz; + mat[2][0] = xz + wy; + + mat[0][1] = xy + wz; + mat[1][1] = 1.0 - (xx + zz); + mat[2][1] = yz - wx; + + mat[0][2] = xz - wy; + mat[1][2] = yz + wx; + mat[2][2] = 1.0 - (xx + yy); + + return mat; +} + + +/// The number of additional substeps we take when refining +/// the results of the offset parallax mapping function below. +/// +/// You should turn down the number of steps if your needing +/// more performance out of your parallax surfaces. Increasing +/// the number doesn't yeild much better results and is rarely +/// worth the additional cost. +/// +#define PARALLAX_REFINE_STEPS 3 + +/// Performs fast parallax offset mapping using +/// multiple refinement steps. +/// +/// @param texMap The texture map whos alpha channel we sample the parallax depth. +/// @param texCoord The incoming texture coordinate for sampling the parallax depth. +/// @param negViewTS The negative view vector in tangent space. +/// @param depthScale The parallax factor used to scale the depth result. +/// +vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale ) +{ + float depth = texture( texMap, texCoord ).a/(PARALLAX_REFINE_STEPS*2); + vec2 offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2); + + for ( int i=0; i < PARALLAX_REFINE_STEPS; i++ ) + { + depth = ( depth + texture( texMap, texCoord + offset ).a )/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2); + } + + return offset; +} + +/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha +vec2 parallaxOffsetDxtnm(sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale) +{ + float depth = texture(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2); + vec2 offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2); + + for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) + { + depth = (depth + texture(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2); + } + + return offset; +} + + +/// The maximum value for 16bit per component integer HDR encoding. +const float HDR_RGB16_MAX = 100.0; +/// The maximum value for 10bit per component integer HDR encoding. +const float HDR_RGB10_MAX = 4.0; + +/// Encodes an HDR color for storage into a target. +vec3 hdrEncode( vec3 _sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return _sample / HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return _sample / HDR_RGB10_MAX; + + #else + + // No encoding. + return _sample; + + #endif +} + +/// Encodes an HDR color for storage into a target. +vec4 hdrEncode( vec4 _sample ) +{ + return vec4( hdrEncode( _sample.rgb ), _sample.a ); +} + +/// Decodes an HDR color from a target. +vec3 hdrDecode( vec3 _sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return _sample * HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return _sample * HDR_RGB10_MAX; + + #else + + // No encoding. + return _sample; + + #endif +} + +/// Decodes an HDR color from a target. +vec4 hdrDecode( vec4 _sample ) +{ + return vec4( hdrDecode( _sample.rgb ), _sample.a ); +} + +/// Returns the luminance for an HDR pixel. +float hdrLuminance( vec3 _sample ) +{ + // There are quite a few different ways to + // calculate luminance from an rgb value. + // + // If you want to use a different technique + // then plug it in here. + // + + //////////////////////////////////////////////////////////////////////////// + // + // Max component luminance. + // + //float lum = max( _sample.r, max( _sample.g, _sample.b ) ); + + //////////////////////////////////////////////////////////////////////////// + // The perceptual relative luminance. + // + // See http://en.wikipedia.org/wiki/Luminance_(relative) + // + const vec3 RELATIVE_LUMINANCE = vec3( 0.2126, 0.7152, 0.0722 ); + float lum = dot( _sample, RELATIVE_LUMINANCE ); + + //////////////////////////////////////////////////////////////////////////// + // + // The average component luminance. + // + //const vec3 AVERAGE_LUMINANCE = vec3( 0.3333, 0.3333, 0.3333 ); + //float lum = dot( _sample, AVERAGE_LUMINANCE ); + + return lum; +} + +#ifdef TORQUE_PIXEL_SHADER +/// Called from the visibility feature to do screen +/// door transparency for fading of objects. +void fizzle(vec2 vpos, float visibility) +{ + // NOTE: The magic values below are what give us + // the nice even pattern during the fizzle. + // + // These values can be changed to get different + // patterns... some better than others. + // + // Horizontal Blinds - { vpos.x, 0.916, vpos.y, 0 } + // Vertical Lines - { vpos.x, 12.9898, vpos.y, 78.233 } + // + // I'm sure there are many more patterns here to + // discover for different effects. + + mat2x2 m = mat2x2( vpos.x, vpos.y, 0.916, 0.350 ); + if( (visibility - fract( determinant( m ) )) < 0 ) //if(a < 0) discard; + discard; +} +#endif //TORQUE_PIXEL_SHADER + +/// Basic assert macro. If the condition fails, then the shader will output color. +/// @param condition This should be a bvec[2-4]. If any items is false, condition is considered to fail. +/// @param color The color that should be outputted if the condition fails. +/// @note This macro will only work in the void main() method of a pixel shader. +#define assert(condition, color) { if(!any(condition)) { OUT_col = color; return; } } + +// Deferred Shading: Material Info Flag Check +bool getFlag(float flags, float num) +{ + float process = round(flags * 255); + float squareNum = pow(2.0, num); + return (mod(process, pow(2.0, squareNum)) >= squareNum); +} + +// #define TORQUE_STOCK_GAMMA +#ifdef TORQUE_STOCK_GAMMA +// Sample in linear space. Decodes gamma. +vec4 toLinear(vec4 tex) +{ + return tex; +} +// Encodes gamma. +vec4 toGamma(vec4 tex) +{ + return tex; +} +vec3 toLinear(vec3 tex) +{ + return tex; +} +// Encodes gamma. +vec3 toGamma(vec3 tex) +{ + return tex; +} +#else +// Sample in linear space. Decodes gamma. +vec4 toLinear(vec4 tex) +{ + return vec4(pow(abs(tex.rgb), vec3(2.2)), tex.a); +} +// Encodes gamma. +vec4 toGamma(vec4 tex) +{ + return vec4(pow(abs(tex.rgb), vec3(1.0/2.2)), tex.a); +} +// Sample in linear space. Decodes gamma. +vec3 toLinear(vec3 tex) +{ + return pow(abs(tex), vec3(2.2)); +} +// Encodes gamma. +vec3 toGamma(vec3 tex) +{ + return pow(abs(tex), vec3(1.0/2.2)); +} +#endif // + +#endif // _TORQUE_GLSL_ diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/wavesP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/wavesP.glsl new file mode 100644 index 000000000..06c8a1a28 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/wavesP.glsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffMap; +uniform sampler2D bumpMap; +uniform samplerCube cubeMap; +uniform vec4 specularColor; +uniform float specularPower; +uniform vec4 ambient; +uniform float accumTime; + +in vec2 TEX0; +in vec4 outLightVec; +in vec3 outPos; +in vec3 outEyePos; + +out vec4 OUT_col; + +void main() +{ + vec2 texOffset; + float sinOffset1 = sin( accumTime * 1.5 + TEX0.y * 6.28319 * 3.0 ) * 0.03; + float sinOffset2 = sin( accumTime * 3.0 + TEX0.y * 6.28319 ) * 0.04; + + texOffset.x = TEX0.x + sinOffset1 + sinOffset2; + texOffset.y = TEX0.y + cos( accumTime * 3.0 + TEX0.x * 6.28319 * 2.0 ) * 0.05; + + vec4 bumpNorm = texture(bumpMap, texOffset) * 2.0 - 1.0; + vec4 diffuse = texture(diffMap, texOffset); + + OUT_col = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient); + + vec3 eyeVec = normalize(outEyePos - outPos); + vec3 halfAng = normalize(eyeVec + outLightVec.xyz); + float specular = clamp(dot(bumpNorm.xyz, halfAng), 0.0, 1.0) * outLightVec.w; + specular = pow(specular, specularPower); + OUT_col += specularColor * specular; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/wind.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/wind.glsl new file mode 100644 index 000000000..0ddb492b9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/wind.glsl @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// +// A tip of the hat.... +// +// The following wind effects were derived from the GPU Gems +// 3 chapter "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa of Crytek. +// + +vec4 smoothCurve( vec4 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +vec4 triangleWave( vec4 x ) +{ + return abs( fract( x + 0.5 ) * 2.0 - 1.0 ); +} + +vec4 smoothTriangleWave( vec4 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +vec3 windTrunkBending( vec3 vPos, vec2 vWind, float fBendFactor ) +{ + // Smooth the bending factor and increase + // the near by height limit. + fBendFactor += 1.0; + fBendFactor *= fBendFactor; + fBendFactor = fBendFactor * fBendFactor - fBendFactor; + + // Displace the vert. + vec3 vNewPos = vPos; + vNewPos.xy += vWind * fBendFactor; + + // Limit the length which makes the bend more + // spherical and prevents stretching. + float fLength = length( vPos ); + vPos = normalize( vNewPos ) * fLength; + + return vPos; +} + +vec3 windBranchBending( vec3 vPos, + vec3 vNormal, + + float fTime, + float fWindSpeed, + + float fBranchPhase, + float fBranchAmp, + float fBranchAtten, + + float fDetailPhase, + float fDetailAmp, + float fDetailFreq, + + float fEdgeAtten ) +{ + float fVertPhase = dot( vPos, vec3( fDetailPhase + fBranchPhase ) ); + + vec2 vWavesIn = fTime + vec2( fVertPhase, fBranchPhase ); + + vec4 vWaves = ( fract( vWavesIn.xxyy * + vec4( 1.975, 0.793, 0.375, 0.193 ) ) * + 2.0 - 1.0 ) * fWindSpeed * fDetailFreq; + + vWaves = smoothTriangleWave( vWaves ); + + vec2 vWavesSum = vWaves.xz + vWaves.yw; + + // We want the branches to bend both up and down. + vWavesSum.y = 1.0 - ( vWavesSum.y * 2.0 ); + + vPos += vWavesSum.xxy * vec3( fEdgeAtten * fDetailAmp * vNormal.xy, + fBranchAtten * fBranchAmp ); + + return vPos; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/guiMaterialV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/guiMaterialV.hlsl new file mode 100644 index 000000000..5d725338f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/guiMaterialV.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslStructs.hlsl" +#include "shaderModel.hlsl" + +struct MaterialDecoratorConnectV +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; +}; + +uniform float4x4 modelview : register(C0); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +MaterialDecoratorConnectV main( VertexIn_PCT IN ) +{ + MaterialDecoratorConnectV OUT; + + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + OUT.uv0 = IN.uv0; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.h b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.h new file mode 100644 index 000000000..6a57e4db7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.h @@ -0,0 +1,116 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// The purpose of this file is to get all of our HLSL structures into one place. +// Please use the structures here instead of redefining input and output structures +// in each shader file. If structures are added, please adhere to the naming convention. + +//------------------------------------------------------------------------------ +// Vertex Input Structures +// +// These structures map to FVFs/Vertex Declarations in Torque. See gfxStructs.h +//------------------------------------------------------------------------------ + +// Notes +// +// Position should be specified as a float4. Right now our vertex structures in +// the engine output float3s for position. This does NOT mean that the POSITION +// binding should be float3, because it will assign 0 to the w coordinate, which +// results in the vertex not getting translated when it is transformed. + +struct VertexIn_P +{ + float4 pos : POSITION; +}; + +struct VertexIn_PT +{ + float4 pos : POSITION; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PTTT +{ + float4 pos : POSITION; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; +}; + +struct VertexIn_PC +{ + float4 pos : POSITION; + float4 color : DIFFUSE; +}; + +struct VertexIn_PNC +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; +}; + +struct VertexIn_PCT +{ + float4 pos : POSITION; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PN +{ + float4 pos : POSITION; + float3 normal : NORMAL; +}; + +struct VertexIn_PNT +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTT +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float3 tangent : TANGENT; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNCT +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTTTB +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float3 T : TEXCOORD2; + float3 B : TEXCOORD3; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.hlsl b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.hlsl new file mode 100644 index 000000000..ce0ca305c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.hlsl @@ -0,0 +1,114 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// The purpose of this file is to get all of our HLSL structures into one place. +// Please use the structures here instead of redefining input and output structures +// in each shader file. If structures are added, please adhere to the naming convention. + +//------------------------------------------------------------------------------ +// Vertex Input Structures +// +// These structures map to FVFs/Vertex Declarations in Torque. See gfxStructs.h +//------------------------------------------------------------------------------ + +// Notes +// +// Position should be specified as a float3 as our vertex structures in +// the engine output float3s for position. + +struct VertexIn_P +{ + float3 pos : POSITION; +}; + +struct VertexIn_PT +{ + float3 pos : POSITION; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PTTT +{ + float3 pos : POSITION; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; +}; + +struct VertexIn_PC +{ + float3 pos : POSITION; + float4 color : DIFFUSE; +}; + +struct VertexIn_PNC +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; +}; + +struct VertexIn_PCT +{ + float3 pos : POSITION; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PN +{ + float3 pos : POSITION; + float3 normal : NORMAL; +}; + +struct VertexIn_PNT +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTT +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float3 tangent : TANGENT; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNCT +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTTTB +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float3 T : TEXCOORD2; + float3 B : TEXCOORD3; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/imposter.hlsl b/Templates/BaseGame/game/core/rendering/shaders/imposter.hlsl new file mode 100644 index 000000000..bc700ba03 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/imposter.hlsl @@ -0,0 +1,149 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.hlsl" + + +static float sCornerRight[4] = { -1, 1, 1, -1 }; +static float sCornerUp[4] = { -1, -1, 1, 1 }; +static float2 sUVCornerExtent[4] = +{ + float2( 0, 1 ), + float2( 1, 1 ), + float2( 1, 0 ), + float2( 0, 0 ) +}; + +#define IMPOSTER_MAX_UVS 64 + + +void imposter_v( + // These parameters usually come from the vertex. + float3 center, + int corner, + float halfSize, + float3 imposterUp, + float3 imposterRight, + + // These are from the imposter shader constant. + int numEquatorSteps, + int numPolarSteps, + float polarAngle, + bool includePoles, + + // Other shader constants. + float3 camPos, + float4 uvs[IMPOSTER_MAX_UVS], + + // The outputs of this function. + out float3 outWsPosition, + out float2 outTexCoord, + out float3x3 outWorldToTangent + ) +{ + // TODO: This could all be calculated on the CPU. + float equatorStepSize = M_2PI_F / numEquatorSteps; + float equatorHalfStep = ( equatorStepSize / 2.0 ) - 0.0001; + float polarStepSize = M_PI_F / numPolarSteps; + float polarHalfStep = ( polarStepSize / 2.0 ) - 0.0001; + + // The vector between the camera and the billboard. + float3 lookVec = normalize( camPos - center ); + + // Generate the camera up and right vectors from + // the object transform and camera forward. + float3 camUp = imposterUp; + float3 camRight = normalize( cross( -lookVec, camUp ) ); + + // The billboarding is based on the camera directions. + float3 rightVec = camRight * sCornerRight[corner]; + float3 upVec = camUp * sCornerUp[corner]; + + float lookPitch = acos( dot( imposterUp, lookVec ) ); + + // First check to see if we need to render the top billboard. + int index; + /* + if ( includePoles && ( lookPitch < polarAngle || lookPitch > sPi - polarAngle ) ) + { + index = numEquatorSteps * 3; + + // When we render the top/bottom billboard we always use + // a fixed vector that matches the rotation of the object. + rightVec = float3( 1, 0, 0 ) * sCornerRight[corner]; + upVec = float3( 0, 1, 0 ) * sCornerUp[corner]; + + if ( lookPitch > sPi - polarAngle ) + { + upVec = -upVec; + index++; + } + } + else + */ + { + // Calculate the rotation around the z axis then add the + // equator half step. This gets the images to switch a + // half step before the captured angle is met. + float lookAzimuth = atan2( lookVec.y, lookVec.x ); + float azimuth = atan2( imposterRight.y, imposterRight.x ); + float rotZ = ( lookAzimuth - azimuth ) + equatorHalfStep; + + // The y rotation is calculated from the look vector and + // the object up vector. + float rotY = lookPitch - polarHalfStep; + + // TODO: How can we do this without conditionals? + // Normalize the result to 0 to 2PI. + if ( rotZ < 0 ) + rotZ += M_2PI_F; + if ( rotZ > M_2PI_F ) + rotZ -= M_2PI_F; + if ( rotY < 0 ) + rotY += M_2PI_F; + if ( rotY > M_PI_F ) // Not M_2PI_F? + rotY -= M_2PI_F; + + float polarIdx = round( abs( rotY ) / polarStepSize ); + + // Get the index to the start of the right polar + // images for this viewing angle. + int numPolarOffset = numEquatorSteps * polarIdx; + + // Calculate the final image index for lookup + // of the texture coords. + index = ( rotZ / equatorStepSize ) + numPolarOffset; + } + + // Generate the final world space position. + outWsPosition = center + ( upVec * halfSize ) + ( rightVec * halfSize ); + + // Grab the uv set and setup the texture coord. + float4 uvSet = uvs[index]; + outTexCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + outTexCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Needed for normal mapping and lighting. + outWorldToTangent[0] = float3( 1, 0, 0 ); + outWorldToTangent[1] = float3( 0, 1, 0 ); + outWorldToTangent[2] = float3( 0, 0, -1 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl new file mode 100644 index 000000000..a41b8a873 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl @@ -0,0 +1,249 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./torque.hlsl" + +#ifndef TORQUE_SHADERGEN + +// These are the uniforms used by most lighting shaders. + +uniform float4 inLightPos[3]; +uniform float4 inLightInvRadiusSq; +uniform float4 inLightColor[4]; + +#ifndef TORQUE_BL_NOSPOTLIGHT + uniform float4 inLightSpotDir[3]; + uniform float4 inLightSpotAngle; + uniform float4 inLightSpotFalloff; +#endif + +uniform float4 ambient; +#define ambientCameraFactor 0.3 +uniform float specularPower; +uniform float4 specularColor; + +#endif // !TORQUE_SHADERGEN + + +void compute4Lights( float3 wsView, + float3 wsPosition, + float3 wsNormal, + float4 shadowMask, + + #ifdef TORQUE_SHADERGEN + + float4 inLightPos[3], + float4 inLightInvRadiusSq, + float4 inLightColor[4], + float4 inLightSpotDir[3], + float4 inLightSpotAngle, + float4 inLightSpotFalloff, + float specularPower, + float4 specularColor, + + #endif // TORQUE_SHADERGEN + + out float4 outDiffuse, + out float4 outSpecular ) +{ + // NOTE: The light positions and spotlight directions + // are stored in SoA order, so inLightPos[0] is the + // x coord for all 4 lights... inLightPos[1] is y... etc. + // + // This is the key to fully utilizing the vector units and + // saving a huge amount of instructions. + // + // For example this change saved more than 10 instructions + // over a simple for loop for each light. + + int i; + + float4 lightVectors[3]; + for ( i = 0; i < 3; i++ ) + lightVectors[i] = wsPosition[i] - inLightPos[i]; + + float4 squareDists = 0; + for ( i = 0; i < 3; i++ ) + squareDists += lightVectors[i] * lightVectors[i]; + + // Accumulate the dot product between the light + // vector and the normal. + // + // The normal is negated because it faces away from + // the surface and the light faces towards the + // surface... this keeps us from needing to flip + // the light vector direction which complicates + // the spot light calculations. + // + // We normalize the result a little later. + // + float4 nDotL = 0; + for ( i = 0; i < 3; i++ ) + nDotL += lightVectors[i] * -wsNormal[i]; + + float4 rDotL = 0; + #ifndef TORQUE_BL_NOSPECULAR + + // We're using the Phong specular reflection model + // here where traditionally Torque has used Blinn-Phong + // which has proven to be more accurate to real materials. + // + // We do so because its cheaper as do not need to + // calculate the half angle for all 4 lights. + // + // Advanced Lighting still uses Blinn-Phong, but the + // specular reconstruction it does looks fairly similar + // to this. + // + float3 R = reflect( wsView, -wsNormal ); + + for ( i = 0; i < 3; i++ ) + rDotL += lightVectors[i] * R[i]; + + #endif + + // Normalize the dots. + // + // Notice we're using the half type here to get a + // much faster sqrt via the rsq_pp instruction at + // the loss of some precision. + // + // Unless we have some extremely large point lights + // i don't believe the precision loss will matter. + // + half4 correction = (half4)rsqrt( squareDists ); + nDotL = saturate( nDotL * correction ); + rDotL = clamp( rDotL * correction, 0.00001, 1.0 ); + + // First calculate a simple point light linear + // attenuation factor. + // + // If this is a directional light the inverse + // radius should be greater than the distance + // causing the attenuation to have no affect. + // + float4 atten = saturate( 1.0 - ( squareDists * inLightInvRadiusSq ) ); + + #ifndef TORQUE_BL_NOSPOTLIGHT + + // The spotlight attenuation factor. This is really + // fast for what it does... 6 instructions for 4 spots. + + float4 spotAtten = 0; + for ( i = 0; i < 3; i++ ) + spotAtten += lightVectors[i] * inLightSpotDir[i]; + + float4 cosAngle = ( spotAtten * correction ) - inLightSpotAngle; + atten *= saturate( cosAngle * inLightSpotFalloff ); + + #endif + + // Finally apply the shadow masking on the attenuation. + atten *= shadowMask; + + // Get the final light intensity. + float4 intensity = nDotL * atten; + + // Combine the light colors for output. + outDiffuse = 0; + for ( i = 0; i < 4; i++ ) + outDiffuse += intensity[i] * inLightColor[i]; + + // Output the specular power. + float4 specularIntensity = pow( rDotL, specularPower.xxxx ) * atten; + + // Apply the per-light specular attenuation. + float4 specular = float4(0,0,0,1); + for ( i = 0; i < 4; i++ ) + specular += float4( inLightColor[i].rgb * inLightColor[i].a * specularIntensity[i], 1 ); + + // Add the final specular intensity values together + // using a single dot product operation then get the + // final specular lighting color. + outSpecular = specularColor * specular; +} + + +// This value is used in AL as a constant power to raise specular values +// to, before storing them into the light info buffer. The per-material +// specular value is then computer by using the integer identity of +// exponentiation: +// +// (a^m)^n = a^(m*n) +// +// or +// +// (specular^constSpecular)^(matSpecular/constSpecular) = specular^(matSpecular*constSpecular) +// +#define AL_ConstantSpecularPower 12.0f + +/// The specular calculation used in Advanced Lighting. +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +float AL_CalcSpecular( float3 toLight, float3 normal, float3 toEye ) +{ + // (R.V)^c + float specVal = dot( normalize( -reflect( toLight, normal ) ), toEye ); + + // Return the specular factor. + return pow( max( specVal, 0.00001f ), AL_ConstantSpecularPower ); +} + +/// The output for Deferred Lighting +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +float4 AL_DeferredOutput( + float3 lightColor, + float3 diffuseColor, + float4 matInfo, + float4 ambient, + float specular, + float shadowAttenuation) +{ + float3 specularColor = float3(specular, specular, specular); + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + specularColor = 0.04 * (1 - specular) + diffuseColor * specular; + } + + //specular = color * map * spec^gloss + float specularOut = (specularColor * matInfo.b * min(pow(abs(specular), max(( matInfo.a/ AL_ConstantSpecularPower),1.0f)),matInfo.a)).r; + + lightColor *= shadowAttenuation; + lightColor += ambient.rgb; + return float4(lightColor.rgb, specularOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/convexGeometryV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/convexGeometryV.hlsl new file mode 100644 index 000000000..064fcffa6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/convexGeometryV.hlsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../hlslStructs.hlsl" +#include "../../shaderModel.hlsl" + +struct VertData +{ + float3 pos : POSITION; + float4 color : COLOR; +}; + +struct ConvexConnectV +{ + float4 hpos : TORQUE_POSITION; + float4 wsEyeDir : TEXCOORD0; + float4 ssPos : TEXCOORD1; + float4 vsEyeDir : TEXCOORD2; +}; + +ConvexConnectV main( VertData IN, + uniform float4x4 modelview, + uniform float4x4 objTrans, + uniform float4x4 worldViewOnly, + uniform float3 eyePosWorld ) +{ + ConvexConnectV OUT; + + OUT.hpos = mul( modelview, float4(IN.pos,1.0) ); + OUT.wsEyeDir = mul(objTrans, float4(IN.pos, 1.0)) - float4(eyePosWorld, 0.0); + OUT.vsEyeDir = mul(worldViewOnly, float4(IN.pos, 1.0)); + OUT.ssPos = OUT.hpos; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferP.hlsl new file mode 100644 index 000000000..5ae05896e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferP.hlsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +struct Conn +{ + float4 hpos : TORQUE_POSITION; +}; + +struct Fragout +{ + float4 col : TORQUE_TARGET0; + float4 col1 : TORQUE_TARGET1; + float4 col2 : TORQUE_TARGET2; +}; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( Conn IN ) +{ + Fragout OUT; + + // Clear Deferred Buffer ( Normals/Depth ); + OUT.col = float4(1.0, 1.0, 1.0, 1.0); + + // Clear Color Buffer. + OUT.col1 = float4(0.0, 0.0, 0.0, 1.0); + + // Clear Material Info Buffer. + OUT.col2 = float4(0.0, 0.0, 0.0, 1.0); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferV.hlsl new file mode 100644 index 000000000..20ba4d509 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferV.hlsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +struct Appdata +{ + float3 pos : POSITION; + float4 color : COLOR; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.hpos = float4(In.pos,1.0); + return Out; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredColorShaderP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredColorShaderP.hlsl new file mode 100644 index 000000000..d91d2eb38 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredColorShaderP.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +struct Fragout +{ + float4 col : TORQUE_TARGET0; + float4 col1 : TORQUE_TARGET1; + float4 col2 : TORQUE_TARGET2; +}; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ) +{ + Fragout OUT; + + OUT.col = float4(0.0, 0.0, 0.0, 0.0); + OUT.col1 = float4(1.0, 1.0, 1.0, 1.0); + + // Draw on color buffer. + OUT.col2 = float4(1.0, 0.0, 0.0, 1.0); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredShadingP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredShadingP.hlsl new file mode 100644 index 000000000..ebd9ed72b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredShadingP.hlsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "../../postfx/postFx.hlsl" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0); +TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,1); +TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2); +TORQUE_UNIFORM_SAMPLER2D(deferredTex,3); + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 lightBuffer = TORQUE_TEX2D( lightDeferredTex, IN.uv0 ); + float4 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 ); + float4 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 ); + float specular = saturate(lightBuffer.a); + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + + if (depth>0.9999) + return float4(0,0,0,0); + + // Diffuse Color Altered by Metalness + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + colorBuffer *= (1.0 - colorBuffer.a); + } + + colorBuffer += float4(specular, specular, specular, 1.0); + colorBuffer *= float4(lightBuffer.rgb, 1.0); + + return hdrEncode( float4(colorBuffer.rgb, 1.0) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuad.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuad.hlsl new file mode 100644 index 000000000..543e21677 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuad.hlsl @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../shaderModel.hlsl" + +struct FarFrustumQuadConnectV +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; + float3 vsEyeRay : TEXCOORD2; +}; + +struct FarFrustumQuadConnectP +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; + float3 vsEyeRay : TEXCOORD2; +}; + + +float2 getUVFromSSPos( float3 ssPos, float4 rtParams ) +{ + float2 outPos = ( ssPos.xy + 1.0 ) / 2.0; + outPos.y = 1.0 - outPos.y; + outPos = ( outPos * rtParams.zw ) + rtParams.xy; + return outPos; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuadV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuadV.hlsl new file mode 100644 index 000000000..0167d901a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuadV.hlsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../hlslStructs.hlsl" +#include "farFrustumQuad.hlsl" + + +FarFrustumQuadConnectV main( VertexIn_PNTT IN, + uniform float4 rtParams0 ) +{ + FarFrustumQuadConnectV OUT; + + OUT.hpos = float4( IN.uv0, 0, 1 ); + + // Get a RT-corrected UV from the SS coord + OUT.uv0 = getUVFromSSPos( OUT.hpos.xyz, rtParams0 ); + + // Interpolators will generate eye rays the + // from far-frustum corners. + OUT.wsEyeRay = IN.tangent; + OUT.vsEyeRay = IN.normal; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/convexGeometryV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/convexGeometryV.glsl new file mode 100644 index 000000000..1807ac43f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/convexGeometryV.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; + +#define IN_pos vPosition + +out vec4 wsEyeDir; +out vec4 ssPos; +out vec4 vsEyeDir; + +#define OUT_hpos gl_Position +#define OUT_wsEyeDir wsEyeDir +#define OUT_ssPos ssPos +#define OUT_vsEyeDir vsEyeDir + +uniform mat4 modelview; +uniform mat4 objTrans; +uniform mat4 worldViewOnly; +uniform vec3 eyePosWorld; + +void main() +{ + OUT_hpos = tMul( modelview, IN_pos ); + OUT_wsEyeDir = tMul( objTrans, IN_pos ) - vec4( eyePosWorld, 0.0 ); + OUT_vsEyeDir = tMul( worldViewOnly, IN_pos ); + OUT_ssPos = OUT_hpos; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl new file mode 100644 index 000000000..b58f347bb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +out vec4 OUT_col; +out vec4 OUT_col1; +out vec4 OUT_col2; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Clear Deferred Buffer ( Normals/Depth ); + OUT_col = vec4(1.0, 1.0, 1.0, 1.0); + + // Clear Color Buffer. + OUT_col1 = vec4(0.0, 0.0, 0.0, 1.0); + + // Clear Material Info Buffer. + OUT_col2 = vec4(0.0, 0.0, 0.0, 1.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredColorShaderP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredColorShaderP.glsl new file mode 100644 index 000000000..85c553089 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredColorShaderP.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +layout (location = 0) out vec4 col; +layout (location = 1) out vec4 col1; +layout (location = 2) out vec4 col2; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + col = vec4(0.0, 0.0, 0.0, 0.0); + col1 = vec4(1.0, 1.0, 1.0, 1.0); + + // Draw on color buffer. + col2 = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredShadingP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredShadingP.glsl new file mode 100644 index 000000000..0234d5fd1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredShadingP.glsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../../postFx/gl/postFX.glsl" +#include "../../../gl/torque.glsl" + +uniform sampler2D colorBufferTex; +uniform sampler2D lightDeferredTex; +uniform sampler2D matInfoTex; +uniform sampler2D deferredTex; + +out vec4 OUT_col; + +void main() +{ + float depth = deferredUncondition( deferredTex, uv0 ).w; + if (depth>0.9999) + { + OUT_col = vec4(0.0); + return; + } + vec4 lightBuffer = texture( lightDeferredTex, uv0 ); + vec4 colorBuffer = texture( colorBufferTex, uv0 ); + vec4 matInfo = texture( matInfoTex, uv0 ); + float specular = clamp(lightBuffer.a,0.0,1.0); + + // Diffuse Color Altered by Metalness + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + colorBuffer *= (1.0 - colorBuffer.a); + } + + colorBuffer += vec4(specular, specular, specular, 1.0); + colorBuffer *= vec4(lightBuffer.rgb, 1.0); + + OUT_col = hdrEncode( vec4(colorBuffer.rgb, 1.0) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuad.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuad.glsl new file mode 100644 index 000000000..76054eb09 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuad.glsl @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +vec2 getUVFromSSPos( vec3 ssPos, vec4 rtParams ) +{ + vec2 outPos = ( ssPos.xy + 1.0 ) / 2.0; + outPos.y = 1.0 - outPos.y; + outPos = ( outPos * rtParams.zw ) + rtParams.xy; + return outPos; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuadV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuadV.glsl new file mode 100644 index 000000000..a80e856ed --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuadV.glsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "farFrustumQuad.glsl" + +in vec4 vPosition; +in vec3 vNormal; +in vec3 vTangent; +in vec2 vTexCoord0; + +uniform vec4 rtParams0; +out vec4 hpos; +out vec2 uv0; +out vec3 wsEyeRay; +out vec3 vsEyeRay; + +void main() +{ + hpos = vec4( vTexCoord0, 0, 1 ); + + // Get a RT-corrected UV from the SS coord + uv0 = getUVFromSSPos( hpos.xyz, rtParams0 ); + gl_Position = hpos; + + // Interpolators will generate eye rays the + // from far-frustum corners. + wsEyeRay = vTangent; + vsEyeRay = vNormal; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/lightingUtils.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/lightingUtils.glsl new file mode 100644 index 000000000..08af9231b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/lightingUtils.glsl @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float attenuate( vec4 lightColor, vec2 attParams, float dist ) +{ + // We're summing the results of a scaled constant, + // linear, and quadratic attenuation. + + #ifdef ACCUMULATE_LUV + return lightColor.w * ( 1.0 - dot( attParams, vec2( dist, dist * dist ) ) ); + #else + return 1.0 - dot( attParams, vec2( dist, dist * dist ) ); + #endif +} + +// Calculate the specular coefficent +// +// pxlToLight - Normalized vector representing direction from the pixel being lit, to the light source, in world space +// normal - Normalized surface normal +// pxlToEye - Normalized vector representing direction from pixel being lit, to the camera, in world space +// specPwr - Specular exponent +// specularScale - A scalar on the specular output used in RGB accumulation. +// +float calcSpecular( vec3 pxlToLight, vec3 normal, vec3 pxlToEye, float specPwr, float specularScale ) +{ +#ifdef PHONG_SPECULAR + // (R.V)^c + float specVal = dot( normalize( -reflect( pxlToLight, normal ) ), pxlToEye ); +#else + // (N.H)^c [Blinn-Phong, TGEA style, default] + float specVal = dot( normal, normalize( pxlToLight + pxlToEye ) ); +#endif + +#ifdef ACCUMULATE_LUV + return pow( max( specVal, 0.00001f ), specPwr ); +#else + // If this is RGB accumulation, than there is no facility for the luminance + // of the light to play in to the specular intensity. In LUV, the luminance + // of the light color gets rolled into N.L * Attenuation + return specularScale * pow( max( specVal, 0.00001f ), specPwr ); +#endif +} + +vec3 getDistanceVectorToPlane( vec3 origin, vec3 direction, vec4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float num = dot( plane, vec4( origin, 1.0 ) ); + float t = -num / denum; + + return direction.xyz * t; +} + +vec3 getDistanceVectorToPlane( float negFarPlaneDotEye, vec3 direction, vec4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float t = negFarPlaneDotEye / denum; + + return direction.xyz * t; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/pointLightP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/pointLightP.glsl new file mode 100644 index 000000000..80869de25 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/pointLightP.glsl @@ -0,0 +1,273 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +#include "farFrustumQuad.glsl" +#include "lightingUtils.glsl" +#include "../../../gl/lighting.glsl" +#include "../../shadowMap/shadowMapIO_GLSL.h" +#include "softShadow.glsl" +#include "../../../gl/torque.glsl" + +in vec4 wsEyeDir; +in vec4 ssPos; +in vec4 vsEyeDir; +in vec4 color; + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +uniform samplerCube cookieMap ; + +#endif + + +#ifdef SHADOW_CUBE + + vec3 decodeShadowCoord( vec3 shadowCoord ) + { + return shadowCoord; + } + + vec4 shadowSample( samplerCube shadowMap, vec3 shadowCoord ) + { + return texture( shadowMap, shadowCoord ); + } + +#else + + vec3 decodeShadowCoord( vec3 paraVec ) + { + // Flip y and z + paraVec = paraVec.xzy; + + #ifndef SHADOW_PARABOLOID + + bool calcBack = (paraVec.z < 0.0); + if ( calcBack ) + { + paraVec.z = paraVec.z * -1.0; + + #ifdef SHADOW_DUALPARABOLOID + paraVec.x = -paraVec.x; + #endif + } + + #endif + + vec3 shadowCoord; + shadowCoord.x = (paraVec.x / (2*(1 + paraVec.z))) + 0.5; + shadowCoord.y = 1-((paraVec.y / (2*(1 + paraVec.z))) + 0.5); + shadowCoord.z = 0; + + // adjust the co-ordinate slightly if it is near the extent of the paraboloid + // this value was found via experementation + // NOTE: this is wrong, it only biases in one direction, not towards the uv + // center ( 0.5 0.5 ). + //shadowCoord.xy *= 0.997; + + #ifndef SHADOW_PARABOLOID + + // If this is the back, offset in the atlas + if ( calcBack ) + shadowCoord.x += 1.0; + + // Atlasing front and back maps, so scale + shadowCoord.x *= 0.5; + + #endif + + return shadowCoord; + } + +#endif + +uniform sampler2D deferredBuffer; + +#ifdef SHADOW_CUBE + uniform samplerCube shadowMap; +#else + uniform sampler2D shadowMap; + uniform sampler2D dynamicShadowMap; +#endif + +uniform sampler2D lightBuffer; +uniform sampler2D colorBuffer; +uniform sampler2D matInfoBuffer; + +uniform vec4 rtParams0; + +uniform vec3 lightPosition; +uniform vec4 lightColor; +uniform float lightBrightness; +uniform float lightRange; +uniform vec2 lightAttenuation; +uniform vec4 lightMapParams; +uniform vec4 vsFarPlane; +uniform mat3 viewToLightProj; +uniform mat3 dynamicViewToLightProj; +uniform vec4 lightParams; +uniform float shadowSoftness; + +out vec4 OUT_col; + +void main() +{ + // Compute scene UV + vec3 ssPos = ssPos.xyz / ssPos.w; + vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + vec4 matInfo = texture( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + OUT_col = vec4(0.0, 0.0, 0.0, 0.0); + return; + } + + vec4 colorSample = texture( colorBuffer, uvScene ); + vec3 subsurface = vec3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = vec3(0.772549, 0.337255, 0.262745); + else + subsurface = vec3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane ); + vec3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + vec3 lightVec = lightPosition - viewSpacePos; + float lenLightV = length( lightVec ); + clip( lightRange - lenLightV ); + + // Get the attenuated falloff. + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + clip( atten - 1e-6 ); + + // Normalize lightVec + lightVec /= lenLightV; + + // If we can do dynamic branching then avoid wasting + // fillrate on pixels that are backfacing to the light. + float nDotL = dot( lightVec, normal ); + //DB_CLIP( nDotL < 0 ); + + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = lenLightV / lightRange; + + #ifdef SHADOW_CUBE + + // TODO: We need to fix shadow cube to handle soft shadows! + float occ = texture( shadowMap, tMul( viewToLightProj, -lightVec ) ).r; + float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) ); + + #else + + vec2 shadowCoord = decodeShadowCoord( tMul( viewToLightProj, -lightVec ) ).xy; + + float static_shadowed = softShadow_filter( shadowMap, + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + vec2 dynamicShadowCoord = decodeShadowCoord( tMul( dynamicViewToLightProj, -lightVec ) ).xy; + float dynamic_shadowed = softShadow_filter( dynamicShadowMap, + ssPos.xy, + dynamicShadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float shadowed = min(static_shadowed, dynamic_shadowed); + #endif + + #endif // !NO_SHADOW + + vec3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + vec4 cookie = texture( cookieMap, tMul( viewToLightProj, -lightVec ) ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( lightVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + vec3 lightColorOut = lightMapParams.rgb * lightcol; + vec4 addToResult = vec4(0.0); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = mix( 1.0f, shadowed, atten ); + lightColorOut = vec3(shadowed); + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/softShadow.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/softShadow.glsl new file mode 100644 index 000000000..a14213946 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/softShadow.glsl @@ -0,0 +1,159 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +#if defined( SOFTSHADOW ) && defined( SOFTSHADOW_HIGH_QUALITY ) + +#define NUM_PRE_TAPS 4 +#define NUM_TAPS 12 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +vec2 sNonUniformTaps[NUM_TAPS] = vec2[] +( + // These first 4 taps are located around the edges + // of the disk and are used to predict fully shadowed + // or unshadowed areas. + vec2( 0.992833, 0.979309 ), + vec2( -0.998585, 0.985853 ), + vec2( 0.949299, -0.882562 ), + vec2( -0.941358, -0.893924 ), + + // The rest of the samples. + vec2( 0.545055, -0.589072 ), + vec2( 0.346526, 0.385821 ), + vec2( -0.260183, 0.334412 ), + vec2( 0.248676, -0.679605 ), + vec2( -0.569502, -0.390637 ), + vec2( -0.614096, 0.212577 ), + vec2( -0.259178, 0.876272 ), + vec2( 0.649526, 0.864333 ) +); + +#else + +#define NUM_PRE_TAPS 5 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +vec2 sNonUniformTaps[NUM_PRE_TAPS] = vec2[] +( + vec2( 0.892833, 0.959309 ), + vec2( -0.941358, -0.873924 ), + vec2( -0.260183, 0.334412 ), + vec2( 0.348676, -0.679605 ), + vec2( -0.569502, -0.390637 ) +); + +#endif + + +/// The texture used to do per-pixel pseudorandom +/// rotations of the filter taps. +uniform sampler2D gTapRotationTex ; + + +float softShadow_sampleTaps( sampler2D shadowMap, + vec2 sinCos, + vec2 shadowPos, + float filterRadius, + float distToLight, + float esmFactor, + int startTap, + int endTap ) +{ + float shadow = 0; + + vec2 tap = vec2(0); + for ( int t = startTap; t < endTap; t++ ) + { + tap.x = ( sNonUniformTaps[t].x * sinCos.y - sNonUniformTaps[t].y * sinCos.x ) * filterRadius; + tap.y = ( sNonUniformTaps[t].y * sinCos.y + sNonUniformTaps[t].x * sinCos.x ) * filterRadius; + float occluder = tex2Dlod( shadowMap, vec4( shadowPos + tap, 0, 0 ) ).r; + + float esm = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + shadow += esm / float( endTap - startTap ); + } + + return shadow; +} + + +float softShadow_filter( sampler2D shadowMap, + vec2 vpos, + vec2 shadowPos, + float filterRadius, + float distToLight, + float dotNL, + float esmFactor ) +{ + #ifndef SOFTSHADOW + + // If softshadow is undefined then we skip any complex + // filtering... just do a single sample ESM. + + float occluder = tex2Dlod( shadowMap, vec4( shadowPos, 0, 0 ) ).r; + float shadow = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + + #else + + // Lookup the random rotation for this screen pixel. + vec2 sinCos = ( tex2Dlod( gTapRotationTex, vec4( vpos * 16, 0, 0 ) ).rg - 0.5 ) * 2; + + // Do the prediction taps first. + float shadow = softShadow_sampleTaps( shadowMap, + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + 0, + NUM_PRE_TAPS ); + + // We live with only the pretap results if we don't + // have high quality shadow filtering enabled. + #ifdef SOFTSHADOW_HIGH_QUALITY + + // Only do the expensive filtering if we're really + // in a partially shadowed area. + if ( shadow * ( 1.0 - shadow ) * max( dotNL, 0 ) > 0.06 ) + { + shadow += softShadow_sampleTaps( shadowMap, + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + NUM_PRE_TAPS, + NUM_TAPS ); + + // This averages the taps above with the results + // of the prediction samples. + shadow *= 0.5; + } + + #endif // SOFTSHADOW_HIGH_QUALITY + + #endif // SOFTSHADOW + + return shadow; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl new file mode 100644 index 000000000..5fcf1b19c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl @@ -0,0 +1,210 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "farFrustumQuad.glsl" +#include "lightingUtils.glsl" +#include "../../shadowMap/shadowMapIO_GLSL.h" +#include "shadergen:/autogenConditioners.h" +#include "softShadow.glsl" +#include "../../../gl/lighting.glsl" +#include "../../../gl/torque.glsl" + +in vec4 wsEyeDir; +in vec4 ssPos; +in vec4 vsEyeDir; +in vec4 color; + +#define IN_wsEyeDir wsEyeDir +#define IN_ssPos ssPos +#define IN_vsEyeDir vsEyeDir +#define IN_color color + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +uniform sampler2D cookieMap; + +#endif + +uniform sampler2D deferredBuffer; +uniform sampler2D shadowMap; +uniform sampler2D dynamicShadowMap; + +uniform sampler2D lightBuffer; +uniform sampler2D colorBuffer; +uniform sampler2D matInfoBuffer; + +uniform vec4 rtParams0; + +uniform vec3 lightPosition; +uniform vec4 lightColor; +uniform float lightBrightness; +uniform float lightRange; +uniform vec2 lightAttenuation; +uniform vec3 lightDirection; +uniform vec4 lightSpotParams; +uniform vec4 lightMapParams; + +uniform vec4 vsFarPlane; +uniform mat4 viewToLightProj; +uniform mat4 dynamicViewToLightProj; + +uniform vec4 lightParams; +uniform float shadowSoftness; + +out vec4 OUT_col; + +void main() +{ + // Compute scene UV + vec3 ssPos = IN_ssPos.xyz / IN_ssPos.w; + vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + vec4 matInfo = texture( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + OUT_col = vec4(0.0, 0.0, 0.0, 0.0); + return; + } + + vec4 colorSample = texture( colorBuffer, uvScene ); + vec3 subsurface = vec3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = vec3(0.772549, 0.337255, 0.262745); + else + subsurface = vec3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN_vsEyeDir.xyz, vsFarPlane ); + vec3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + vec3 lightToPxlVec = viewSpacePos - lightPosition; + float lenLightV = length( lightToPxlVec ); + lightToPxlVec /= lenLightV; + + //lightDirection = vec3( -lightDirection.xy, lightDirection.z ); //vec3( 0, 0, -1 ); + float cosAlpha = dot( lightDirection, lightToPxlVec ); + clip( cosAlpha - lightSpotParams.x ); + clip( lightRange - lenLightV ); + + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + atten *= ( cosAlpha - lightSpotParams.x ) / lightSpotParams.y; + clip( atten - 1e-6 ); + atten = saturate( atten ); + + float nDotL = dot( normal, -lightToPxlVec ); + + // Get the shadow texture coordinate + vec4 pxlPosLightProj = tMul( viewToLightProj, vec4( viewSpacePos, 1 ) ); + vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 ); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Get the dynamic shadow texture coordinate + vec4 dynpxlPosLightProj = tMul( dynamicViewToLightProj, vec4( viewSpacePos, 1 ) ); + vec2 dynshadowCoord = ( ( dynpxlPosLightProj.xy / dynpxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 ); + dynshadowCoord.y = 1.0f - dynshadowCoord.y; + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = pxlPosLightProj.z / lightRange; + + float static_shadowed = softShadow_filter( shadowMap, + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float dynamic_shadowed = softShadow_filter( dynamicShadowMap, + ssPos.xy, + dynshadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + float shadowed = min(static_shadowed, dynamic_shadowed); + #endif // !NO_SHADOW + + vec3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + vec4 cookie = texture( cookieMap, shadowCoord ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( -lightToPxlVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + vec3 lightColorOut = lightMapParams.rgb * lightcol; + vec4 addToResult = vec4(0.0); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = mix( 1.0f, shadowed, atten ); + lightColorOut = vec3(shadowed); + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/vectorLightP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/vectorLightP.glsl new file mode 100644 index 000000000..142e58b10 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/vectorLightP.glsl @@ -0,0 +1,327 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "farFrustumQuad.glsl" +#include "../../../gl/torque.glsl" +#include "../../../gl/lighting.glsl" +#include "lightingUtils.glsl" +#include "../../shadowMap/shadowMapIO_GLSL.h" +#include "softShadow.glsl" + +in vec4 hpos; +in vec2 uv0; +in vec3 wsEyeRay; +in vec3 vsEyeRay; + +uniform sampler2D shadowMap; +uniform sampler2D dynamicShadowMap; + +#ifdef USE_SSAO_MASK +uniform sampler2D ssaoMask ; +uniform vec4 rtParams3; +#endif + +uniform sampler2D deferredBuffer; +uniform sampler2D lightBuffer; +uniform sampler2D colorBuffer; +uniform sampler2D matInfoBuffer; +uniform vec3 lightDirection; +uniform vec4 lightColor; +uniform float lightBrightness; +uniform vec4 lightAmbient; +uniform vec3 eyePosWorld; +uniform mat4x4 eyeMat; +uniform vec4 atlasXOffset; +uniform vec4 atlasYOffset; +uniform vec2 atlasScale; +uniform vec4 zNearFarInvNearFar; +uniform vec4 lightMapParams; +uniform vec2 fadeStartLength; +uniform vec4 overDarkPSSM; +uniform float shadowSoftness; + +//static shadowMap +uniform mat4x4 worldToLightProj; +uniform vec4 scaleX; +uniform vec4 scaleY; +uniform vec4 offsetX; +uniform vec4 offsetY; +uniform vec4 farPlaneScalePSSM; + +//dynamic shadowMap +uniform mat4x4 dynamicWorldToLightProj; +uniform vec4 dynamicScaleX; +uniform vec4 dynamicScaleY; +uniform vec4 dynamicOffsetX; +uniform vec4 dynamicOffsetY; +uniform vec4 dynamicFarPlaneScalePSSM; + +vec4 AL_VectorLightShadowCast( sampler2D _sourceshadowMap, + vec2 _texCoord, + mat4 _worldToLightProj, + vec4 _worldPos, + vec4 _scaleX, vec4 _scaleY, + vec4 _offsetX, vec4 _offsetY, + vec4 _farPlaneScalePSSM, + vec4 _atlasXOffset, vec4 _atlasYOffset, + vec2 _atlasScale, + float _shadowSoftness, + float _dotNL , + vec4 _overDarkPSSM +) +{ + + // Compute shadow map coordinate + vec4 pxlPosLightProj = tMul(_worldToLightProj, _worldPos); + vec2 baseShadowCoord = pxlPosLightProj.xy / pxlPosLightProj.w; + + // Distance to light, in shadowMap space + float distToLight = pxlPosLightProj.z / pxlPosLightProj.w; + + // Figure out which split to sample from. Basically, we compute the shadowMap sample coord + // for all of the splits and then check if its valid. + vec4 shadowCoordX = vec4( baseShadowCoord.x ); + vec4 shadowCoordY = vec4( baseShadowCoord.y ); + vec4 farPlaneDists = vec4( distToLight ); + shadowCoordX *= _scaleX; + shadowCoordY *= _scaleY; + shadowCoordX += _offsetX; + shadowCoordY += _offsetY; + farPlaneDists *= _farPlaneScalePSSM; + + // If the shadow sample is within -1..1 and the distance + // to the light for this pixel is less than the far plane + // of the split, use it. + vec4 finalMask; + if ( shadowCoordX.x > -0.99 && shadowCoordX.x < 0.99 && + shadowCoordY.x > -0.99 && shadowCoordY.x < 0.99 && + farPlaneDists.x < 1.0 ) + finalMask = vec4(1, 0, 0, 0); + + else if ( shadowCoordX.y > -0.99 && shadowCoordX.y < 0.99 && + shadowCoordY.y > -0.99 && shadowCoordY.y < 0.99 && + farPlaneDists.y < 1.0 ) + finalMask = vec4(0, 1, 0, 0); + + else if ( shadowCoordX.z > -0.99 && shadowCoordX.z < 0.99 && + shadowCoordY.z > -0.99 && shadowCoordY.z < 0.99 && + farPlaneDists.z < 1.0 ) + finalMask = vec4(0, 0, 1, 0); + + else + finalMask = vec4(0, 0, 0, 1); + + vec3 debugColor = vec3(0); + + #ifdef NO_SHADOW + debugColor = vec3(1.0); + #endif + + #ifdef PSSM_DEBUG_RENDER + if ( finalMask.x > 0 ) + debugColor += vec3( 1, 0, 0 ); + else if ( finalMask.y > 0 ) + debugColor += vec3( 0, 1, 0 ); + else if ( finalMask.z > 0 ) + debugColor += vec3( 0, 0, 1 ); + else if ( finalMask.w > 0 ) + debugColor += vec3( 1, 1, 0 ); + #endif + + // Here we know what split we're sampling from, so recompute the _texCoord location + // Yes, we could just use the result from above, but doing it this way actually saves + // shader instructions. + vec2 finalScale; + finalScale.x = dot(finalMask, _scaleX); + finalScale.y = dot(finalMask, _scaleY); + + vec2 finalOffset; + finalOffset.x = dot(finalMask, _offsetX); + finalOffset.y = dot(finalMask, _offsetY); + + vec2 shadowCoord; + shadowCoord = baseShadowCoord * finalScale; + shadowCoord += finalOffset; + + // Convert to _texCoord space + shadowCoord = 0.5 * shadowCoord + vec2(0.5, 0.5); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Move around inside of atlas + vec2 aOffset; + aOffset.x = dot(finalMask, _atlasXOffset); + aOffset.y = dot(finalMask, _atlasYOffset); + + shadowCoord *= _atlasScale; + shadowCoord += aOffset; + + // Each split has a different far plane, take this into account. + float farPlaneScale = dot( _farPlaneScalePSSM, finalMask ); + distToLight *= farPlaneScale; + + return vec4(debugColor, + softShadow_filter( _sourceshadowMap, + _texCoord, + shadowCoord, + farPlaneScale * _shadowSoftness, + distToLight, + _dotNL, + dot( finalMask, _overDarkPSSM ) ) ); +} + +out vec4 OUT_col; +void main() +{ + // Emissive. + float4 matInfo = texture( matInfoBuffer, uv0 ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + OUT_col = vec4(1.0, 1.0, 1.0, 0.0); + return; + } + + vec4 colorSample = texture( colorBuffer, uv0 ); + vec3 subsurface = vec3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = vec3(0.772549, 0.337255, 0.262745); + else + subsurface = vec3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + vec4 deferredSample = deferredUncondition( deferredBuffer, uv0 ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Use eye ray to get ws pos + vec4 worldPos = vec4(eyePosWorld + wsEyeRay * depth, 1.0f); + + // Get the light attenuation. + float dotNL = dot(-lightDirection, normal); + + #ifdef PSSM_DEBUG_RENDER + vec3 debugColor = vec3(0); + #endif + + #ifdef NO_SHADOW + + // Fully unshadowed. + float shadowed = 1.0; + + #ifdef PSSM_DEBUG_RENDER + debugColor = vec3(1.0); + #endif + + #else + + vec4 static_shadowed_colors = AL_VectorLightShadowCast( shadowMap, + uv0.xy, + worldToLightProj, + worldPos, + scaleX, scaleY, + offsetX, offsetY, + farPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + vec4 dynamic_shadowed_colors = AL_VectorLightShadowCast( dynamicShadowMap, + uv0.xy, + dynamicWorldToLightProj, + worldPos, + dynamicScaleX, dynamicScaleY, + dynamicOffsetX, dynamicOffsetY, + dynamicFarPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + float static_shadowed = static_shadowed_colors.a; + float dynamic_shadowed = dynamic_shadowed_colors.a; + + #ifdef PSSM_DEBUG_RENDER + debugColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5; + #endif + + // Fade out the shadow at the end of the range. + vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth); + float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y; + + static_shadowed = mix( static_shadowed, 1.0, saturate( fadeOutAmt ) ); + dynamic_shadowed = mix( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) ); + + // temp for debugging. uncomment one or the other. + //float shadowed = static_shadowed; + //float shadowed = dynamic_shadowed; + float shadowed = min(static_shadowed, dynamic_shadowed); + + #ifdef PSSM_DEBUG_RENDER + if ( fadeOutAmt > 1.0 ) + debugColor = vec3(1.0); + #endif + + #endif // !NO_SHADOW + + // Specular term + float specular = AL_CalcSpecular( -lightDirection, + normal, + normalize(-vsEyeRay) ) * lightBrightness * shadowed; + + float Sat_NL_Att = saturate( dotNL * shadowed ) * lightBrightness; + vec3 lightColorOut = lightMapParams.rgb * lightColor.rgb; + vec4 addToResult = (lightAmbient * (1 - ambientCameraFactor)) + ( lightAmbient * ambientCameraFactor * saturate(dot(normalize(-vsEyeRay), normal)) ); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = dotNL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + lightColorOut = vec3(shadowed); + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + // Sample the AO texture. + #ifdef USE_SSAO_MASK + float ao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( uv0.xy, rtParams3 ) ).r; + addToResult *= ao; + #endif + + #ifdef PSSM_DEBUG_RENDER + lightColorOut = debugColor; + #endif + + OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/lightingUtils.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/lightingUtils.hlsl new file mode 100644 index 000000000..2bff18999 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/lightingUtils.hlsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float attenuate( float4 lightColor, float2 attParams, float dist ) +{ + // We're summing the results of a scaled constant, + // linear, and quadratic attenuation. + + #ifdef ACCUMULATE_LUV + return lightColor.w * ( 1.0 - dot( attParams, float2( dist, dist * dist ) ) ); + #else + return 1.0 - dot( attParams, float2( dist, dist * dist ) ); + #endif +} + +float3 getDistanceVectorToPlane( float3 origin, float3 direction, float4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float num = dot( plane, float4( origin, 1.0 ) ); + float t = -num / denum; + + return direction.xyz * t; +} + +float3 getDistanceVectorToPlane( float negFarPlaneDotEye, float3 direction, float4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float t = negFarPlaneDotEye / denum; + + return direction.xyz * t; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightP.hlsl new file mode 100644 index 000000000..a0156eb85 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightP.hlsl @@ -0,0 +1,76 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "farFrustumQuad.hlsl" +#include "lightingUtils.hlsl" +#include "../../lighting.hlsl" +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + + +struct ConvexConnectP +{ + float4 pos : TORQUE_POSITION; + float4 ssPos : TEXCOORD0; + float3 vsEyeDir : TEXCOORD1; +}; + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); + +uniform float4 lightPosition; +uniform float4 lightColor; +uniform float lightRange; +uniform float4 vsFarPlane; +uniform float4 rtParams0; + +float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 +{ + // Compute scene UV + float3 ssPos = IN.ssPos.xyz / IN.ssPos.w; + float2 uvScene = getUVFromSSPos(ssPos, rtParams0); + + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION(deferredBuffer, uvScene); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir, vsFarPlane); + float3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + float3 lightVec = lightPosition.xyz - viewSpacePos; + float lenLightV = length(lightVec); + clip(lightRange - lenLightV); + + // Do a very simple falloff instead of real attenuation + float atten = 1.0 - saturate(lenLightV / lightRange); + + // Normalize lightVec + lightVec /= lenLightV; + + // N.L * Attenuation + float Sat_NL_Att = saturate(dot(lightVec, normal)) * atten; + + // Output, no specular + return lightinfoCondition(lightColor.rgb, Sat_NL_Att, 0.0, 0.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightV.hlsl new file mode 100644 index 000000000..faa2ec115 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightV.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../hlslStructs.hlsl" +#include "../../shaderModel.hlsl" + +struct ConvexConnectV +{ + float4 hpos : TORQUE_POSITION; + float4 ssPos : TEXCOORD0; + float3 vsEyeDir : TEXCOORD1; +}; + +uniform float4x4 viewProj; +uniform float4x4 view; +uniform float3 particlePosWorld; +uniform float lightRange; + +ConvexConnectV main( VertexIn_P IN ) +{ + ConvexConnectV OUT; + float4 pos = float4(IN.pos, 0.0); + float4 vPosWorld = pos + float4(particlePosWorld, 0.0) + pos * lightRange; + OUT.hpos = mul(viewProj, vPosWorld); + OUT.vsEyeDir = mul(view, vPosWorld); + OUT.ssPos = OUT.hpos; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/pointLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/pointLightP.hlsl new file mode 100644 index 000000000..317feb0b3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/pointLightP.hlsl @@ -0,0 +1,277 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" + +#include "farFrustumQuad.hlsl" +#include "lightingUtils.hlsl" +#include "../../lighting.hlsl" +#include "../shadowMap/shadowMapIO_HLSL.h" +#include "softShadow.hlsl" +#include "../../torque.hlsl" + +struct ConvexConnectP +{ + float4 pos : TORQUE_POSITION; + float4 wsEyeDir : TEXCOORD0; + float4 ssPos : TEXCOORD1; + float4 vsEyeDir : TEXCOORD2; +}; + + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +TORQUE_UNIFORM_SAMPLERCUBE(cookieMap, 3); + +#endif + + +#ifdef SHADOW_CUBE + + float3 decodeShadowCoord( float3 shadowCoord ) + { + return shadowCoord; + } + + float4 shadowSample( TORQUE_SAMPLERCUBE(shadowMap), float3 shadowCoord ) + { + return TORQUE_TEXCUBE( shadowMap, shadowCoord ); + } + +#else + + float3 decodeShadowCoord( float3 paraVec ) + { + // Flip y and z + paraVec = paraVec.xzy; + + #ifndef SHADOW_PARABOLOID + + bool calcBack = (paraVec.z < 0.0); + if ( calcBack ) + { + paraVec.z = paraVec.z * -1.0; + + #ifdef SHADOW_DUALPARABOLOID + paraVec.x = -paraVec.x; + #endif + } + + #endif + + float3 shadowCoord; + shadowCoord.x = (paraVec.x / (2*(1 + paraVec.z))) + 0.5; + shadowCoord.y = 1-((paraVec.y / (2*(1 + paraVec.z))) + 0.5); + shadowCoord.z = 0; + + // adjust the co-ordinate slightly if it is near the extent of the paraboloid + // this value was found via experementation + // NOTE: this is wrong, it only biases in one direction, not towards the uv + // center ( 0.5 0.5 ). + //shadowCoord.xy *= 0.997; + + #ifndef SHADOW_PARABOLOID + + // If this is the back, offset in the atlas + if ( calcBack ) + shadowCoord.x += 1.0; + + // Atlasing front and back maps, so scale + shadowCoord.x *= 0.5; + + #endif + + return shadowCoord; + } + +#endif + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); + +#ifdef SHADOW_CUBE +TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1); +#else +TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); +TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2); +#endif + +TORQUE_UNIFORM_SAMPLER2D(lightBuffer, 5); +TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 6); +TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 7); + +uniform float4 rtParams0; +uniform float4 lightColor; + +uniform float lightBrightness; +uniform float3 lightPosition; + +uniform float4 lightMapParams; +uniform float4 vsFarPlane; +uniform float4 lightParams; + +uniform float lightRange; +uniform float shadowSoftness; +uniform float2 lightAttenuation; + +uniform float3x3 viewToLightProj; +uniform float3x3 dynamicViewToLightProj; + +float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 +{ + // Compute scene UV + float3 ssPos = IN.ssPos.xyz / IN.ssPos.w; + float2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + float4 matInfo = TORQUE_TEX2D( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + return float4(0.0, 0.0, 0.0, 0.0); + } + float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene ); + float3 subsurface = float3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = float3(0.772549, 0.337255, 0.262745); + else + subsurface = float3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); + float3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + float3 lightVec = lightPosition - viewSpacePos; + float lenLightV = length( lightVec ); + clip( lightRange - lenLightV ); + + // Get the attenuated falloff. + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + clip( atten - 1e-6 ); + + // Normalize lightVec + lightVec /= lenLightV; + + // If we can do dynamic branching then avoid wasting + // fillrate on pixels that are backfacing to the light. + float nDotL = dot( lightVec, normal ); + //DB_CLIP( nDotL < 0 ); + + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = lenLightV / lightRange; + + #ifdef SHADOW_CUBE + + // TODO: We need to fix shadow cube to handle soft shadows! + float occ = TORQUE_TEXCUBE( shadowMap, mul( viewToLightProj, -lightVec ) ).r; + float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) ); + + #else + + // Static + float2 shadowCoord = decodeShadowCoord( mul( viewToLightProj, -lightVec ) ).xy; + float static_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + // Dynamic + float2 dynamicShadowCoord = decodeShadowCoord( mul( dynamicViewToLightProj, -lightVec ) ).xy; + float dynamic_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), + ssPos.xy, + dynamicShadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float shadowed = min(static_shadowed, dynamic_shadowed); + + #endif + + #endif // !NO_SHADOW + + float3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + float4 cookie = TORQUE_TEXCUBE( cookieMap, mul( viewToLightProj, -lightVec ) ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( lightVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + float3 lightColorOut = lightMapParams.rgb * lightcol; + float4 addToResult = 0.0; + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = lerp( 1.0f, shadowed, atten ); + lightColorOut = shadowed; + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/softShadow.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/softShadow.hlsl new file mode 100644 index 000000000..0faf3e1fb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/softShadow.hlsl @@ -0,0 +1,158 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +#if defined( SOFTSHADOW ) && defined( SOFTSHADOW_HIGH_QUALITY ) + +#define NUM_PRE_TAPS 4 +#define NUM_TAPS 12 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +static float2 sNonUniformTaps[NUM_TAPS] = +{ + // These first 4 taps are located around the edges + // of the disk and are used to predict fully shadowed + // or unshadowed areas. + { 0.992833, 0.979309 }, + { -0.998585, 0.985853 }, + { 0.949299, -0.882562 }, + { -0.941358, -0.893924 }, + + // The rest of the samples. + { 0.545055, -0.589072 }, + { 0.346526, 0.385821 }, + { -0.260183, 0.334412 }, + { 0.248676, -0.679605 }, + { -0.569502, -0.390637 }, + { -0.614096, 0.212577 }, + { -0.259178, 0.876272 }, + { 0.649526, 0.864333 }, +}; + +#else + +#define NUM_PRE_TAPS 5 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +static float2 sNonUniformTaps[NUM_PRE_TAPS] = +{ + { 0.892833, 0.959309 }, + { -0.941358, -0.873924 }, + { -0.260183, 0.334412 }, + { 0.348676, -0.679605 }, + { -0.569502, -0.390637 }, +}; + +#endif + + +/// The texture used to do per-pixel pseudorandom +/// rotations of the filter taps. +TORQUE_UNIFORM_SAMPLER2D(gTapRotationTex, 4); + +float softShadow_sampleTaps( TORQUE_SAMPLER2D(shadowMap1), + float2 sinCos, + float2 shadowPos, + float filterRadius, + float distToLight, + float esmFactor, + int startTap, + int endTap ) +{ + float shadow = 0; + + float2 tap = 0; + for ( int t = startTap; t < endTap; t++ ) + { + tap.x = ( sNonUniformTaps[t].x * sinCos.y - sNonUniformTaps[t].y * sinCos.x ) * filterRadius; + tap.y = ( sNonUniformTaps[t].y * sinCos.y + sNonUniformTaps[t].x * sinCos.x ) * filterRadius; + float occluder = TORQUE_TEX2DLOD( shadowMap1, float4( shadowPos + tap, 0, 0 ) ).r; + + float esm = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + shadow += esm / float( endTap - startTap ); + } + + return shadow; +} + + +float softShadow_filter( TORQUE_SAMPLER2D(shadowMap), + float2 vpos, + float2 shadowPos, + float filterRadius, + float distToLight, + float dotNL, + float esmFactor ) +{ + #ifndef SOFTSHADOW + + // If softshadow is undefined then we skip any complex + // filtering... just do a single sample ESM. + + float occluder = TORQUE_TEX2DLOD(shadowMap, float4(shadowPos, 0, 0)).r; + float shadow = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + + #else + // Lookup the random rotation for this screen pixel. + float2 sinCos = ( TORQUE_TEX2DLOD(gTapRotationTex, float4(vpos * 16, 0, 0)).rg - 0.5) * 2; + + // Do the prediction taps first. + float shadow = softShadow_sampleTaps( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + 0, + NUM_PRE_TAPS ); + + // We live with only the pretap results if we don't + // have high quality shadow filtering enabled. + #ifdef SOFTSHADOW_HIGH_QUALITY + + // Only do the expensive filtering if we're really + // in a partially shadowed area. + if ( shadow * ( 1.0 - shadow ) * max( dotNL, 0 ) > 0.06 ) + { + shadow += softShadow_sampleTaps( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + NUM_PRE_TAPS, + NUM_TAPS ); + + // This averages the taps above with the results + // of the prediction samples. + shadow *= 0.5; + } + + #endif // SOFTSHADOW_HIGH_QUALITY + + #endif // SOFTSHADOW + + return shadow; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl new file mode 100644 index 000000000..196286dc2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl @@ -0,0 +1,209 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +#include "farFrustumQuad.hlsl" +#include "lightingUtils.hlsl" +#include "../../lighting.hlsl" +#include "../shadowMap/shadowMapIO_HLSL.h" +#include "softShadow.hlsl" +#include "../../torque.hlsl" + +struct ConvexConnectP +{ + float4 pos : TORQUE_POSITION; + float4 wsEyeDir : TEXCOORD0; + float4 ssPos : TEXCOORD1; + float4 vsEyeDir : TEXCOORD2; +}; + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); +TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap,2); + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +TORQUE_UNIFORM_SAMPLER2D(cookieMap, 3); + +#endif + +TORQUE_UNIFORM_SAMPLER2D(lightBuffer, 5); +TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 6); +TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 7); + +uniform float4 rtParams0; + +uniform float lightBrightness; +uniform float3 lightPosition; + +uniform float4 lightColor; + +uniform float lightRange; +uniform float3 lightDirection; + +uniform float4 lightSpotParams; +uniform float4 lightMapParams; +uniform float4 vsFarPlane; +uniform float4x4 viewToLightProj; +uniform float4 lightParams; +uniform float4x4 dynamicViewToLightProj; + +uniform float2 lightAttenuation; +uniform float shadowSoftness; + +float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 +{ + // Compute scene UV + float3 ssPos = IN.ssPos.xyz / IN.ssPos.w; + float2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + float4 matInfo = TORQUE_TEX2D( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + return float4(0.0, 0.0, 0.0, 0.0); + } + + float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene ); + float3 subsurface = float3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = float3(0.772549, 0.337255, 0.262745); + else + subsurface = float3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); + float3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + float3 lightToPxlVec = viewSpacePos - lightPosition; + float lenLightV = length( lightToPxlVec ); + lightToPxlVec /= lenLightV; + + //lightDirection = float3( -lightDirection.xy, lightDirection.z ); //float3( 0, 0, -1 ); + float cosAlpha = dot( lightDirection, lightToPxlVec ); + clip( cosAlpha - lightSpotParams.x ); + clip( lightRange - lenLightV ); + + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + atten *= ( cosAlpha - lightSpotParams.x ) / lightSpotParams.y; + clip( atten - 1e-6 ); + atten = saturate( atten ); + + float nDotL = dot( normal, -lightToPxlVec ); + + // Get the shadow texture coordinate + float4 pxlPosLightProj = mul( viewToLightProj, float4( viewSpacePos, 1 ) ); + float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 ); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Get the dynamic shadow texture coordinate + float4 dynpxlPosLightProj = mul( dynamicViewToLightProj, float4( viewSpacePos, 1 ) ); + float2 dynshadowCoord = ( ( dynpxlPosLightProj.xy / dynpxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 ); + dynshadowCoord.y = 1.0f - dynshadowCoord.y; + + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = pxlPosLightProj.z / lightRange; + + float static_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float dynamic_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), + ssPos.xy, + dynshadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + float shadowed = min(static_shadowed, dynamic_shadowed); + #endif // !NO_SHADOW + + float3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + float4 cookie = TORQUE_TEX2D( cookieMap, shadowCoord ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( -lightToPxlVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + float3 lightColorOut = lightMapParams.rgb * lightcol; + float4 addToResult = 0.0; + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = lerp( 1.0f, shadowed, atten ); + lightColorOut = shadowed; + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/vectorLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/vectorLightP.hlsl new file mode 100644 index 000000000..c5efde242 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/vectorLightP.hlsl @@ -0,0 +1,328 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +#include "farFrustumQuad.hlsl" +#include "../../torque.hlsl" +#include "../../lighting.hlsl" +#include "lightingUtils.hlsl" +#include "../shadowMap/shadowMapIO_HLSL.h" +#include "softShadow.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); +TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2); + +#ifdef USE_SSAO_MASK +TORQUE_UNIFORM_SAMPLER2D(ssaoMask, 3); +uniform float4 rtParams3; +#endif +//register 4? +TORQUE_UNIFORM_SAMPLER2D(lightBuffer, 5); +TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 6); +TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 7); + +uniform float lightBrightness; +uniform float3 lightDirection; + +uniform float4 lightColor; +uniform float4 lightAmbient; + +uniform float shadowSoftness; +uniform float3 eyePosWorld; + +uniform float4 atlasXOffset; +uniform float4 atlasYOffset; +uniform float4 zNearFarInvNearFar; +uniform float4 lightMapParams; +uniform float4 farPlaneScalePSSM; +uniform float4 overDarkPSSM; + +uniform float2 fadeStartLength; +uniform float2 atlasScale; + +uniform float4x4 eyeMat; + +// Static Shadows +uniform float4x4 worldToLightProj; +uniform float4 scaleX; +uniform float4 scaleY; +uniform float4 offsetX; +uniform float4 offsetY; +// Dynamic Shadows +uniform float4x4 dynamicWorldToLightProj; +uniform float4 dynamicScaleX; +uniform float4 dynamicScaleY; +uniform float4 dynamicOffsetX; +uniform float4 dynamicOffsetY; +uniform float4 dynamicFarPlaneScalePSSM; + +float4 AL_VectorLightShadowCast( TORQUE_SAMPLER2D(sourceShadowMap), + float2 texCoord, + float4x4 worldToLightProj, + float4 worldPos, + float4 scaleX, + float4 scaleY, + float4 offsetX, + float4 offsetY, + float4 farPlaneScalePSSM, + float4 atlasXOffset, + float4 atlasYOffset, + float2 atlasScale, + float shadowSoftness, + float dotNL , + float4 overDarkPSSM) +{ + // Compute shadow map coordinate + float4 pxlPosLightProj = mul(worldToLightProj, worldPos); + float2 baseShadowCoord = pxlPosLightProj.xy / pxlPosLightProj.w; + + // Distance to light, in shadowmap space + float distToLight = pxlPosLightProj.z / pxlPosLightProj.w; + + // Figure out which split to sample from. Basically, we compute the shadowmap sample coord + // for all of the splits and then check if its valid. + float4 shadowCoordX = baseShadowCoord.xxxx; + float4 shadowCoordY = baseShadowCoord.yyyy; + float4 farPlaneDists = distToLight.xxxx; + shadowCoordX *= scaleX; + shadowCoordY *= scaleY; + shadowCoordX += offsetX; + shadowCoordY += offsetY; + farPlaneDists *= farPlaneScalePSSM; + + // If the shadow sample is within -1..1 and the distance + // to the light for this pixel is less than the far plane + // of the split, use it. + float4 finalMask; + if ( shadowCoordX.x > -0.99 && shadowCoordX.x < 0.99 && + shadowCoordY.x > -0.99 && shadowCoordY.x < 0.99 && + farPlaneDists.x < 1.0 ) + finalMask = float4(1, 0, 0, 0); + + else if ( shadowCoordX.y > -0.99 && shadowCoordX.y < 0.99 && + shadowCoordY.y > -0.99 && shadowCoordY.y < 0.99 && + farPlaneDists.y < 1.0 ) + finalMask = float4(0, 1, 0, 0); + + else if ( shadowCoordX.z > -0.99 && shadowCoordX.z < 0.99 && + shadowCoordY.z > -0.99 && shadowCoordY.z < 0.99 && + farPlaneDists.z < 1.0 ) + finalMask = float4(0, 0, 1, 0); + + else + finalMask = float4(0, 0, 0, 1); + + float3 debugColor = float3(0,0,0); + + #ifdef NO_SHADOW + debugColor = float3(1.0,1.0,1.0); + #endif + + #ifdef PSSM_DEBUG_RENDER + if ( finalMask.x > 0 ) + debugColor += float3( 1, 0, 0 ); + else if ( finalMask.y > 0 ) + debugColor += float3( 0, 1, 0 ); + else if ( finalMask.z > 0 ) + debugColor += float3( 0, 0, 1 ); + else if ( finalMask.w > 0 ) + debugColor += float3( 1, 1, 0 ); + #endif + + // Here we know what split we're sampling from, so recompute the texcoord location + // Yes, we could just use the result from above, but doing it this way actually saves + // shader instructions. + float2 finalScale; + finalScale.x = dot(finalMask, scaleX); + finalScale.y = dot(finalMask, scaleY); + + float2 finalOffset; + finalOffset.x = dot(finalMask, offsetX); + finalOffset.y = dot(finalMask, offsetY); + + float2 shadowCoord; + shadowCoord = baseShadowCoord * finalScale; + shadowCoord += finalOffset; + + // Convert to texcoord space + shadowCoord = 0.5 * shadowCoord + float2(0.5, 0.5); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Move around inside of atlas + float2 aOffset; + aOffset.x = dot(finalMask, atlasXOffset); + aOffset.y = dot(finalMask, atlasYOffset); + + shadowCoord *= atlasScale; + shadowCoord += aOffset; + + // Each split has a different far plane, take this into account. + float farPlaneScale = dot( farPlaneScalePSSM, finalMask ); + distToLight *= farPlaneScale; + + return float4(debugColor, + softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(sourceShadowMap), + texCoord, + shadowCoord, + farPlaneScale * shadowSoftness, + distToLight, + dotNL, + dot( finalMask, overDarkPSSM ) ) ); +}; + +float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0 +{ + // Emissive. + float4 matInfo = TORQUE_TEX2D( matInfoBuffer, IN.uv0 ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + return float4(1.0, 1.0, 1.0, 0.0); + } + + float4 colorSample = TORQUE_TEX2D( colorBuffer, IN.uv0 ); + float3 subsurface = float3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = float3(0.772549, 0.337255, 0.262745); + else + subsurface = float3(0.337255, 0.772549, 0.262745); + } + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, IN.uv0 ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Use eye ray to get ws pos + float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f); + + // Get the light attenuation. + float dotNL = dot(-lightDirection, normal); + + #ifdef PSSM_DEBUG_RENDER + float3 debugColor = float3(0,0,0); + #endif + + #ifdef NO_SHADOW + + // Fully unshadowed. + float shadowed = 1.0; + + #ifdef PSSM_DEBUG_RENDER + debugColor = float3(1.0,1.0,1.0); + #endif + + #else + + float4 static_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + IN.uv0.xy, + worldToLightProj, + worldPos, + scaleX, scaleY, + offsetX, offsetY, + farPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + float4 dynamic_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), + IN.uv0.xy, + dynamicWorldToLightProj, + worldPos, + dynamicScaleX, dynamicScaleY, + dynamicOffsetX, dynamicOffsetY, + dynamicFarPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + + float static_shadowed = static_shadowed_colors.a; + float dynamic_shadowed = dynamic_shadowed_colors.a; + + #ifdef PSSM_DEBUG_RENDER + debugColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5; + #endif + + // Fade out the shadow at the end of the range. + float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth); + float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y; + + static_shadowed = lerp( static_shadowed, 1.0, saturate( fadeOutAmt ) ); + dynamic_shadowed = lerp( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) ); + + // temp for debugging. uncomment one or the other. + //float shadowed = static_shadowed; + //float shadowed = dynamic_shadowed; + float shadowed = min(static_shadowed, dynamic_shadowed); + + #ifdef PSSM_DEBUG_RENDER + if ( fadeOutAmt > 1.0 ) + debugColor = 1.0; + #endif + + #endif // !NO_SHADOW + + // Specular term + float specular = AL_CalcSpecular( -lightDirection, + normal, + normalize(-IN.vsEyeRay) ) * lightBrightness * shadowed; + + float Sat_NL_Att = saturate( dotNL * shadowed ) * lightBrightness; + float3 lightColorOut = lightMapParams.rgb * lightColor.rgb; + + float4 addToResult = (lightAmbient * (1 - ambientCameraFactor)) + ( lightAmbient * ambientCameraFactor * saturate(dot(normalize(-IN.vsEyeRay), normal)) ); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = dotNL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + lightColorOut = shadowed; + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + // Sample the AO texture. + #ifdef USE_SSAO_MASK + float ao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams3 ) ).r; + addToResult *= ao; + #endif + + #ifdef PSSM_DEBUG_RENDER + lightColorOut = debugColor; + #endif + + return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterP.glsl new file mode 100644 index 000000000..9b510e0cf --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterP.glsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" + +uniform sampler2D diffuseMap; + +in vec2 uv; + +uniform vec2 oneOverTargetSize; + +const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); +const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture( diffuseMap, uv ) * weight[0]; + + for ( int i=1; i < 3; i++ ) + { + vec2 _sample = (BLUR_DIR * offset[i]) * oneOverTargetSize; + OUT_col += texture( diffuseMap, uv + _sample ) * weight[i]; + OUT_col += texture( diffuseMap, uv - _sample ) * weight[i]; + } +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterV.glsl new file mode 100644 index 000000000..67b5f1378 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterV.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform vec4 rtParams0; + +out vec2 uv; + +void main() +{ + gl_Position = vPosition; + uv = viewportCoordToRenderTarget( vTexCoord0.st, rtParams0 ); + gl_Position.y *= -1; //correct ssp +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterP.hlsl new file mode 100644 index 000000000..cf819eed3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterP.hlsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../postFx/postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv : TEXCOORD0; +}; + +static float offset[3] = { 0.0, 1.3846153846, 3.2307692308 }; +static float weight[3] = { 0.2270270270, 0.3162162162, 0.0702702703 }; + +uniform float2 oneOverTargetSize; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 OUT = TORQUE_TEX2D( diffuseMap, IN.uv ) * weight[0]; + + for ( int i=1; i < 3; i++ ) + { + float2 sample = (BLUR_DIR * offset[i]) * oneOverTargetSize; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv + sample ) * weight[i]; + OUT += TORQUE_TEX2D(diffuseMap, IN.uv - sample) * weight[i]; + } + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterV.hlsl new file mode 100644 index 000000000..d0838016b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterV.hlsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../postFx/postFx.hlsl" +#include "../../torque.hlsl" + +float4 rtParams0; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv : TEXCOORD0; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterP.hlsl new file mode 100644 index 000000000..a187c3c63 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterP.hlsl @@ -0,0 +1,82 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Box Filter +//***************************************************************************** +#include "../ShaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 tex0 : TEXCOORD0; +}; + +// If not defined from ShaderData then define +// the default blur kernel size here. +//#ifndef blurSamples +// #define blurSamples 4 +//#endif + +float log_conv ( float x0, float X, float y0, float Y ) +{ + return (X + log(x0 + (y0 * exp(Y - X)))); +} + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap0, 0); +uniform float texSize : register(C0); +uniform float2 blurDimension : register(C2); +uniform float2 blurBoundaries : register(C3); + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // 5x5 + if (IN.tex0.x <= blurBoundaries.x) + { + float texelSize = 1.2f / texSize; + float2 sampleOffset = texelSize * blurDimension; + //float2 offset = 0.5 * float( blurSamples ) * sampleOffset; + + float2 texCoord = IN.tex0; + + float accum = log_conv(0.3125, TORQUE_TEX2D(diffuseMap0, texCoord - sampleOffset), 0.375, tex2D(diffuseMap0, texCoord)); + accum = log_conv(1, accum, 0.3125, TORQUE_TEX2D(diffuseMap0, texCoord + sampleOffset)); + + return accum; + } else { + // 3x3 + if (IN.tex0.x <= blurBoundaries.y) + { + float texelSize = 1.3f / texSize; + float2 sampleOffset = texelSize * blurDimension; + //float2 offset = 0.5 * float( blurSamples ) * sampleOffset; + + float2 texCoord = IN.tex0; + float accum = log_conv(0.5, tex2D(diffuseMap0, texCoord - sampleOffset), 0.5, tex2D(diffuseMap0, texCoord + sampleOffset)); + + return accum; + } else { + return TORQUE_TEX2D(diffuseMap0, IN.tex0); + } + } +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterV.hlsl new file mode 100644 index 000000000..3679e41bb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterV.hlsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Box Filter +//***************************************************************************** +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "../ShaderModel.hlsl" + +struct VertData +{ + float3 position : POSITION; + float2 texCoord : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 tex0 : TEXCOORD0; +}; + + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN, + uniform float4x4 modelview : register(C0)) +{ + ConnectData OUT; + + OUT.hpos = mul(modelview, float4(IN.position,1.0)); + OUT.tex0 = IN.texCoord; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterP.glsl new file mode 100644 index 000000000..d4e05132b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterP.glsl @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define blurSamples 4.0 + +uniform sampler2D diffuseMap0; +uniform float texSize; +uniform vec2 blurDimension; + +in vec2 tex0; + +out vec4 OUT_col; + +void main() +{ + // Preshader + float TexelSize = 1.0 / texSize; + vec2 SampleOffset = TexelSize * blurDimension; + vec2 Offset = 0.5 * float(blurSamples - 1.0) * SampleOffset; + + vec2 BaseTexCoord = tex0 - Offset; + + vec4 accum = vec4(0.0, 0.0, 0.0, 0.0); + for(int i = 0; i < int(blurSamples); i++) + { + accum += texture(diffuseMap0, BaseTexCoord + float(i) * SampleOffset); + } + accum /= blurSamples; + OUT_col = accum; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterV.glsl new file mode 100644 index 000000000..9fc436f6c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterV.glsl @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; + +out vec2 tex0; + +void main() +{ + gl_Position = modelview * vPosition; + tex0 = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO.h b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO.h new file mode 100644 index 000000000..84ef6b6a8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO.h @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//#define SM_Fmt_R8G8B8A8 + +#define pkDepthBitShft 65536.0 +#define pkDepthChanMax 256.0 +#define bias -0.5/255.0 +#define coeff 0.9999991 +//#define coeff 1.0 + +float4 encodeShadowMap( float depth ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return frac( float4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + bias; + + //float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0)); + //return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256)); +#else + return depth; +#endif +} + +float decodeShadowMap( float4 smSample ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return dot( smSample, float4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) ); +#else + return smSample.x; +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_GLSL.h b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_GLSL.h new file mode 100644 index 000000000..10d69b834 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_GLSL.h @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//#define SM_Fmt_R8G8B8A8 + +#define pkDepthBitShft 65536.0 +#define pkDepthChanMax 256.0 +#define bias -0.5/255.0 +#define coeff 0.9999991 +//#define coeff 1.0 + +vec4 encodeShadowMap( float depth ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return frac( vec4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + vec4(bias); + + //float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0)); + //return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256)); +#else + return vec4(depth); +#endif +} + +float decodeShadowMap( vec4 smSample ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return dot( smSample, vec4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) ); +#else + return smSample.x; +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_HLSL.h b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_HLSL.h new file mode 100644 index 000000000..84ef6b6a8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_HLSL.h @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//#define SM_Fmt_R8G8B8A8 + +#define pkDepthBitShft 65536.0 +#define pkDepthChanMax 256.0 +#define bias -0.5/255.0 +#define coeff 0.9999991 +//#define coeff 1.0 + +float4 encodeShadowMap( float depth ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return frac( float4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + bias; + + //float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0)); + //return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256)); +#else + return depth; +#endif +} + +float decodeShadowMap( float4 smSample ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return dot( smSample, float4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) ); +#else + return smSample.x; +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/particleCompositeP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeP.hlsl new file mode 100644 index 000000000..6e26ddbdb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeP.hlsl @@ -0,0 +1,61 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "torque.hlsl" +#include "shaderModel.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorSource, 0); +uniform float4 offscreenTargetParams; + +#ifdef TORQUE_LINEAR_DEPTH +#define REJECT_EDGES +TORQUE_UNIFORM_SAMPLER2D(edgeSource, 1); +uniform float4 edgeTargetParams; +#endif + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 offscreenPos : TEXCOORD0; + float4 backbufferPos : TEXCOORD1; +}; + + +float4 main(Conn IN) : TORQUE_TARGET0 +{ + // Off-screen particle source screenspace position in XY + // Back-buffer screenspace position in ZW + float4 ssPos = float4(IN.offscreenPos.xy / IN.offscreenPos.w, IN.backbufferPos.xy / IN.backbufferPos.w); + + float4 uvScene = ( ssPos + 1.0 ) / 2.0; + uvScene.yw = 1.0 - uvScene.yw; + uvScene.xy = viewportCoordToRenderTarget(uvScene.xy, offscreenTargetParams); + +#ifdef REJECT_EDGES + // Cut out particles along the edges, this will create the stencil mask + uvScene.zw = viewportCoordToRenderTarget(uvScene.zw, edgeTargetParams); + float edge = TORQUE_TEX2D( edgeSource, uvScene.zw ).r; + clip( -edge ); +#endif + + // Sample offscreen target and return + return TORQUE_TEX2D( colorSource, uvScene.xy ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/particleCompositeV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeV.hlsl new file mode 100644 index 000000000..c4c51204a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeV.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vertex +{ + float3 pos : POSITION; + float4 uvCoord : COLOR0; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 offscreenPos : TEXCOORD0; + float4 backbufferPos : TEXCOORD1; +}; + +uniform float4 screenRect; // point, extent + +Conn main(Vertex IN) +{ + Conn OUT; + + OUT.hpos = float4(IN.uvCoord.xy, 1.0, 1.0); + OUT.hpos.xy *= screenRect.zw; + OUT.hpos.xy += screenRect.xy; + + OUT.backbufferPos = OUT.hpos; + OUT.offscreenPos = OUT.hpos; + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/particlesP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particlesP.hlsl new file mode 100644 index 000000000..155107d8b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particlesP.hlsl @@ -0,0 +1,109 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.hlsl" +#include "shaderModel.hlsl" +// With advanced lighting we get soft particles. +#ifdef TORQUE_LINEAR_DEPTH + #define SOFTPARTICLES +#endif + +#ifdef SOFTPARTICLES + + #include "shaderModelAutoGen.hlsl" + + uniform float oneOverSoftness; + uniform float oneOverFar; + TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); + //uniform float3 vEye; + uniform float4 deferredTargetParams; +#endif + +#define CLIP_Z // TODO: Make this a proper macro + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 color : TEXCOORD0; + float2 uv0 : TEXCOORD1; + float4 pos : TEXCOORD2; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); +TORQUE_UNIFORM_SAMPLER2D(paraboloidLightMap, 2); + +float4 lmSample( float3 nrm ) +{ + bool calcBack = (nrm.z < 0.0); + if ( calcBack ) + nrm.z = nrm.z * -1.0; + + float2 lmCoord; + lmCoord.x = (nrm.x / (2*(1 + nrm.z))) + 0.5; + lmCoord.y = 1-((nrm.y / (2*(1 + nrm.z))) + 0.5); + + + // If this is the back, offset in the atlas + if ( calcBack ) + lmCoord.x += 1.0; + + // Atlasing front and back maps, so scale + lmCoord.x *= 0.5; + + return TORQUE_TEX2D(paraboloidLightMap, lmCoord); +} + + +uniform float alphaFactor; +uniform float alphaScale; + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + float softBlend = 1; + + #ifdef SOFTPARTICLES + float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w; + tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams); + + float sceneDepth = TORQUE_DEFERRED_UNCONDITION(deferredTex, tc).w; + float depth = IN.pos.w * oneOverFar; + float diff = sceneDepth - depth; + #ifdef CLIP_Z + // If drawing offscreen, this acts as the depth test, since we don't line up with the z-buffer + // When drawing high-res, though, we want to be able to take advantage of hi-z + // so this is #ifdef'd out + //clip(diff); + #endif + softBlend = saturate( diff * oneOverSoftness ); + #endif + + float4 diffuse = TORQUE_TEX2D( diffuseMap, IN.uv0 ); + + //return float4( lmSample(float3(0, 0, -1)).rgb, IN.color.a * diffuse.a * softBlend * alphaScale); + + // Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha) + float3 colorScale = ( alphaFactor < 0.0 ? IN.color.rgb * diffuse.rgb : ( alphaFactor > 0.0 ? IN.color.a * diffuse.a * alphaFactor * softBlend : softBlend ) ); + + return hdrEncode( float4( IN.color.rgb * diffuse.rgb * colorScale, + IN.color.a * diffuse.a * softBlend * alphaScale ) ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/particlesV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particlesV.hlsl new file mode 100644 index 000000000..dbeff0cc2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particlesV.hlsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vertex +{ + float3 pos : POSITION; + float4 color : COLOR0; + float2 uv0 : TEXCOORD0; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 color : TEXCOORD0; + float2 uv0 : TEXCOORD1; + float4 pos : TEXCOORD2; +}; + + +uniform float4x4 modelViewProj; +uniform float4x4 fsModelViewProj; + +Conn main( Vertex In ) +{ + Conn Out; + + Out.hpos = mul( modelViewProj, float4(In.pos,1.0) ); + Out.pos = mul(fsModelViewProj, float4(In.pos, 1.0) ); + Out.color = In.color; + Out.uv0 = In.uv0; + + return Out; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpP.hlsl new file mode 100644 index 000000000..d18331fb6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpP.hlsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 tex2 : TEXCOORD1; +}; + + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(texMap, 0); +TORQUE_UNIFORM_SAMPLER2D(refractMap, 1); +TORQUE_UNIFORM_SAMPLER2D(bumpMap, 2); + + +//----------------------------------------------------------------------------- +// Fade edges of axis for texcoord passed in +//----------------------------------------------------------------------------- +float fadeAxis( float val ) +{ + // Fades from 1.0 to 0.0 when less than 0.1 + float fadeLow = saturate( val * 10.0 ); + + // Fades from 1.0 to 0.0 when greater than 0.9 + float fadeHigh = 1.0 - saturate( (val - 0.9) * 10.0 ); + + return fadeLow * fadeHigh; +} + + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ConnectData IN ) +{ + Fragout OUT; + + float3 bumpNorm = TORQUE_TEX2D( bumpMap, IN.tex2 ) * 2.0 - 1.0; + float2 offset = float2( bumpNorm.x, bumpNorm.y ); + float4 texIndex = IN.texCoord; + + // The fadeVal is used to "fade" the distortion at the edges of the screen. + // This is done so it won't sample the reflection texture out-of-bounds and create artifacts + // Note - this can be done more efficiently with a texture lookup + float fadeVal = fadeAxis( texIndex.x / texIndex.w ) * fadeAxis( texIndex.y / texIndex.w ); + + const float distortion = 0.2; + texIndex.xy += offset * distortion * fadeVal; + + float4 reflectColor = TORQUE_TEX2DPROJ( refractMap, texIndex ); + float4 diffuseColor = TORQUE_TEX2D( texMap, IN.tex2 ); + + OUT.col = diffuseColor + reflectColor * diffuseColor.a; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpV.hlsl new file mode 100644 index 000000000..d45adb574 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpV.hlsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "shdrConsts.h" +#include "shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 texCoord : TEXCOORD0; + float2 lmCoord : TEXCOORD1; + float3 T : TEXCOORD2; + float3 B : TEXCOORD3; +}; + + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 texCoord : TEXCOORD0; + float2 tex2 : TEXCOORD1; +}; + +uniform float4x4 modelview; +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + OUT.hpos = mul(modelview, float4(IN.position,1.0)); + + float4x4 texGenTest = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + OUT.texCoord = mul( texGenTest, OUT.hpos ); + + OUT.tex2 = IN.texCoord; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectP.hlsl new file mode 100644 index 000000000..43b420544 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectP.hlsl @@ -0,0 +1,58 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 tex2 : TEXCOORD1; +}; + + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(texMap, 0); +TORQUE_UNIFORM_SAMPLER2D(refractMap, 1); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ConnectData IN ) +{ + Fragout OUT; + + float4 diffuseColor = TORQUE_TEX2D( texMap, IN.texCoord ); + float4 reflectColor = TORQUE_TEX2DPROJ(refractMap, IN.tex2); + + OUT.col = diffuseColor + reflectColor * diffuseColor.a; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectV.hlsl new file mode 100644 index 000000000..1f2ca9d4f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectV.hlsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "hlslStructs.hlsl" +#include "shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 tex2 : TEXCOORD1; +}; + +uniform float4x4 modelview; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertexIn_PNTTTB IN ) +{ + ConnectData OUT; + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + + float4x4 texGenTest = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + OUT.texCoord = IN.uv0; + OUT.tex2 = mul( texGenTest, OUT.hpos ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/VolFogGlowP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/VolFogGlowP.hlsl new file mode 100644 index 000000000..c3adb3b55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/VolFogGlowP.hlsl @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands +// http://www.richardsgamestudio.com/ +// +// If you find this code useful or you are feeling particularly generous I +// would ask that you please go to http://www.richardsgamestudio.com/ then +// choose Donations from the menu on the left side and make a donation to +// Richards Game Studio. It will be highly appreciated. +// +// The MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog Glow postFx pixel shader V1.00 + +#include "./postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); +uniform float strength; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * strength; + + float4 OUT = 0; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv0 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv1 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv2 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv3 ) * kernel.w; + + OUT += TORQUE_TEX2D( diffuseMap, IN.uv4 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv5 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv6 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + float3 rgb2lum = float3( 0.30, 0.59, 0.11 ); + OUT.a = dot( OUT.rgb, rgb2lum ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/causticsP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/causticsP.hlsl new file mode 100644 index 000000000..8c8abd480 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/causticsP.hlsl @@ -0,0 +1,77 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +uniform float accumTime; +uniform float3 eyePosWorld; +uniform float4 rtParams0; +uniform float4 waterFogPlane; + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +TORQUE_UNIFORM_SAMPLER2D(causticsTex0, 1); +TORQUE_UNIFORM_SAMPLER2D(causticsTex1, 2); + +float distanceToPlane(float4 plane, float3 pos) +{ + return (plane.x * pos.x + plane.y * pos.y + plane.z * pos.z) + plane.w; +} + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //Sample the pre-pass + float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ); + + //Get depth + float depth = deferred.w; + if(depth > 0.9999) + return float4(0,0,0,0); + + //Get world position + float3 pos = eyePosWorld + IN.wsEyeRay * depth; + + // Check the water depth + float waterDepth = -distanceToPlane(waterFogPlane, pos); + if(waterDepth < 0) + return float4(0,0,0,0); + waterDepth = saturate(waterDepth); + + //Use world position X and Y to calculate caustics UV + float2 causticsUV0 = (abs(pos.xy * 0.25) % float2(1, 1)); + float2 causticsUV1 = (abs(pos.xy * 0.2) % float2(1, 1)); + + //Animate uvs + float timeSin = sin(accumTime); + causticsUV0.xy += float2(accumTime*0.1, timeSin*0.2); + causticsUV1.xy -= float2(accumTime*0.15, timeSin*0.15); + + //Sample caustics texture + float4 caustics = TORQUE_TEX2D(causticsTex0, causticsUV0); + caustics *= TORQUE_TEX2D(causticsTex1, causticsUV1); + + //Use normal Z to modulate caustics + //float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1); + caustics *= saturate(deferred.z) * pow(abs(1-depth), 64) * waterDepth; + + return caustics; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/gl/causticsP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/gl/causticsP.glsl new file mode 100644 index 000000000..d002fd7e1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/gl/causticsP.glsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform vec3 eyePosWorld; +uniform vec4 rtParams0; +uniform vec4 waterFogPlane; +uniform float accumTime; + +uniform sampler2D deferredTex; +uniform sampler2D causticsTex0; +uniform sampler2D causticsTex1; +uniform vec2 targetSize; + +out vec4 OUT_col; + +float distanceToPlane(vec4 plane, vec3 pos) +{ + return (plane.x * pos.x + plane.y * pos.y + plane.z * pos.z) + plane.w; +} + +void main() +{ + //Sample the pre-pass + vec4 deferred = deferredUncondition( deferredTex, IN_uv0 ); + + //Get depth + float depth = deferred.w; + if(depth > 0.9999) + { + OUT_col = vec4(0,0,0,0); + return; + } + + //Get world position + vec3 pos = eyePosWorld + IN_wsEyeRay * depth; + + // Check the water depth + float waterDepth = -distanceToPlane(waterFogPlane, pos); + if(waterDepth < 0) + { + OUT_col = vec4(0,0,0,0); + return; + } + waterDepth = saturate(waterDepth); + + //Use world position X and Y to calculate caustics UV + vec2 causticsUV0 = mod(abs(pos.xy * 0.25), vec2(1, 1)); + vec2 causticsUV1 = mod(abs(pos.xy * 0.2), vec2(1, 1)); + + //Animate uvs + float timeSin = sin(accumTime); + causticsUV0.xy += vec2(accumTime*0.1, timeSin*0.2); + causticsUV1.xy -= vec2(accumTime*0.15, timeSin*0.15); + + //Sample caustics texture + vec4 caustics = texture(causticsTex0, causticsUV0); + caustics *= texture(causticsTex1, causticsUV1); + + //Use normal Z to modulate caustics + //float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1); + caustics *= saturate(deferred.z) * pow(1-depth, 64) * waterDepth; + + OUT_col = caustics; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/chromaticLens.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/chromaticLens.hlsl new file mode 100644 index 000000000..8fdca72b7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/chromaticLens.hlsl @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier +// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader + +#include "./postFx.hlsl" +#include "./../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float distCoeff; +uniform float cubeDistort; +uniform float3 colorDistort; + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 tex = IN.uv0; + + float f = 0; + float r2 = (tex.x - 0.5) * (tex.x - 0.5) + (tex.y - 0.5) * (tex.y - 0.5); + + // Only compute the cubic distortion if necessary. + if ( cubeDistort == 0.0 ) + f = 1 + r2 * distCoeff; + else + f = 1 + r2 * (distCoeff + cubeDistort * sqrt(r2)); + + // Distort each color channel seperately to get a chromatic distortion effect. + float3 outColor; + float3 distort = f.xxx + colorDistort; + + for ( int i=0; i < 3; i++ ) + { + float x = distort[i] * ( tex.x - 0.5 ) + 0.5; + float y = distort[i] * ( tex.y - 0.5 ) + 0.5; + outColor[i] = TORQUE_TEX2DLOD( backBuffer, float4(x,y,0,0) )[i]; + } + + return float4( outColor.rgb, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_P.hlsl new file mode 100644 index 000000000..2f5835fc2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_P.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" + +// These are set by the game engine. +TORQUE_UNIFORM_SAMPLER2D(shrunkSampler, 0); // Output of DofDownsample() +TORQUE_UNIFORM_SAMPLER2D(blurredSampler, 1); // Blurred version of the shrunk sampler + + +// This is the pixel shader function that calculates the actual +// value used for the near circle of confusion. +// "texCoords" are 0 at the bottom left pixel and 1 at the top right. +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float3 color; + float coc; + half4 blurred; + half4 shrunk; + + shrunk = half4(TORQUE_TEX2D( shrunkSampler, IN.uv0 )); + blurred = half4(TORQUE_TEX2D( blurredSampler, IN.uv1 )); + color = shrunk.rgb; + //coc = shrunk.a; + //coc = blurred.a; + //coc = max( blurred.a, shrunk.a ); + coc = 2 * max( blurred.a, shrunk.a ) - shrunk.a; + + + //return float4( coc.rrr, 1.0 ); + //return float4( color, 1.0 ); + return float4( color, coc ); + //return float4( 1.0, 0.0, 1.0, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_V.hlsl new file mode 100644 index 000000000..8131e45cd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_V.hlsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv; + OUT.uv1 = IN.uv; + OUT.uv2 = IN.uv; + OUT.uv3 = IN.uv; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv + rtParams0.xy; + OUT.uv1 = IN.uv + rtParams1.xy; + OUT.uv2 = IN.uv + rtParams2.xy; + OUT.uv3 = IN.uv + rtParams3.xy; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv * rtParams0.zw; + OUT.uv1 = IN.uv * rtParams1.zw; + OUT.uv2 = IN.uv * rtParams2.zw; + OUT.uv3 = IN.uv * rtParams3.zw; + */ + + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_P.hlsl new file mode 100644 index 000000000..907c3d122 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_P.hlsl @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +// These are set by the game engine. +// The render target size is one-quarter the scene rendering size. +TORQUE_UNIFORM_SAMPLER2D(colorSampler, 0); +TORQUE_UNIFORM_SAMPLER2D(depthSampler, 1); +uniform float2 dofEqWorld; +uniform float2 targetSize; +uniform float depthOffset; +uniform float maxWorldCoC; +//uniform float2 dofEqWeapon; +//uniform float2 dofRowDelta; // float2( 0, 0.25 / renderTargetHeight ) + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float2 tcColor0 : TEXCOORD0; + float2 tcColor1 : TEXCOORD1; + float2 tcDepth0 : TEXCOORD2; + float2 tcDepth1 : TEXCOORD3; + float2 tcDepth2 : TEXCOORD4; + float2 tcDepth3 : TEXCOORD5; +}; + +half4 main( Pixel IN ) : TORQUE_TARGET0 +{ + //return float4( 1.0, 0.0, 1.0, 1.0 ); + + float2 dofRowDelta = float2( 0, 0.25 / targetSize.y ); + + //float2 dofEqWorld = float2( -60, 1.0 ); + + half3 color; + half maxCoc; + float4 depth; + half4 viewCoc; + half4 sceneCoc; + half4 curCoc; + half4 coc; + float2 rowOfs[4]; + + // "rowOfs" reduces how many moves PS2.0 uses to emulate swizzling. + rowOfs[0] = 0; + rowOfs[1] = dofRowDelta.xy; + rowOfs[2] = dofRowDelta.xy * 2; + rowOfs[3] = dofRowDelta.xy * 3; + + // Use bilinear filtering to average 4 color samples for free. + color = 0; + color += half3(TORQUE_TEX2D( colorSampler, IN.tcColor0.xy + rowOfs[0] ).rgb); + color += half3(TORQUE_TEX2D(colorSampler, IN.tcColor1.xy + rowOfs[0]).rgb); + color += half3(TORQUE_TEX2D(colorSampler, IN.tcColor0.xy + rowOfs[2]).rgb); + color += half3(TORQUE_TEX2D(colorSampler, IN.tcColor1.xy + rowOfs[2]).rgb); + color /= 4; + + //declare thse here to save doing it in each loop below + half4 zero4 = half4(0, 0, 0, 0); + coc = zero4; + half4 dofEqWorld4X = half4(dofEqWorld.xxxx); + half4 dofEqWorld4Y = half4(dofEqWorld.yyyy); + half4 maxWorldCoC4 = half4(maxWorldCoC, maxWorldCoC, maxWorldCoC, maxWorldCoC); + // Process 4 samples at a time to use vector hardware efficiently. + // The CoC will be 1 if the depth is negative, so use "min" to pick + // between "sceneCoc" and "viewCoc". + [unroll] // coc[i] causes this anyway + for (int i = 0; i < 4; i++) + { + depth[0] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth0.xy + rowOfs[i])).w; + depth[1] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth1.xy + rowOfs[i])).w; + depth[2] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth2.xy + rowOfs[i])).w; + depth[3] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth3.xy + rowOfs[i])).w; + + coc = max(coc, clamp(dofEqWorld4X * half4(depth)+dofEqWorld4Y, zero4, maxWorldCoC4)); + } + + /* + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[0] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[0] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[0] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[0] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = curCoc; + + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[1] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[1] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[1] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[1] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[2] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[2] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[2] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[2] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[3] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[3] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[3] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[3] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + */ + + maxCoc = max( max( coc[0], coc[1] ), max( coc[2], coc[3] ) ); + + //return half4( 1.0, 0.0, 1.0, 1.0 ); + return half4( color, maxCoc ); + //return half4( color, 1.0f ); + //return half4( maxCoc.rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_V.hlsl new file mode 100644 index 000000000..0b3ec01e2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_V.hlsl @@ -0,0 +1,61 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +struct Vert +{ + float3 pos : POSITION; + float2 tc : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; +}; + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float2 tcColor0 : TEXCOORD0; + float2 tcColor1 : TEXCOORD1; + float2 tcDepth0 : TEXCOORD2; + float2 tcDepth1 : TEXCOORD3; + float2 tcDepth2 : TEXCOORD4; + float2 tcDepth3 : TEXCOORD5; +}; + +uniform float4 rtParams0; +uniform float2 oneOverTargetSize; + +Pixel main( Vert IN ) +{ + Pixel OUT; + OUT.position = float4(IN.pos,1.0); + + float2 uv = viewportCoordToRenderTarget( IN.tc, rtParams0 ); + //OUT.position = mul( IN.pos, modelView ); + OUT.tcColor1 = uv + float2( +1.0, -0.0 ) * oneOverTargetSize; + OUT.tcColor0 = uv + float2( -1.0, -0.0 ) * oneOverTargetSize; + OUT.tcDepth0 = uv + float2( -0.5, -0.0 ) * oneOverTargetSize; + OUT.tcDepth1 = uv + float2( -1.5, -0.0 ) * oneOverTargetSize; + OUT.tcDepth2 = uv + float2( +1.5, -0.0 ) * oneOverTargetSize; + OUT.tcDepth3 = uv + float2( +2.5, -0.0 ) * oneOverTargetSize; + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_P.hlsl new file mode 100644 index 000000000..9a7cb3d5e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_P.hlsl @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "./../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorSampler,0); // Original source image +TORQUE_UNIFORM_SAMPLER2D(smallBlurSampler,1); // Output of SmallBlurPS() +TORQUE_UNIFORM_SAMPLER2D(largeBlurSampler,2); // Blurred output of DofDownsample() +TORQUE_UNIFORM_SAMPLER2D(depthSampler,3); + +uniform float2 oneOverTargetSize; +uniform float4 dofLerpScale; +uniform float4 dofLerpBias; +uniform float3 dofEqFar; +uniform float maxFarCoC; + +//static float d0 = 0.1; +//static float d1 = 0.1; +//static float d2 = 0.8; +//static float4 dofLerpScale = float4( -1.0 / d0, -1.0 / d1, -1.0 / d2, 1.0 / d2 ); +//static float4 dofLerpBias = float4( 1.0, (1.0 - d2) / d1, 1.0 / d2, (d2 - 1.0) / d2 ); +//static float3 dofEqFar = float3( 2.0, 0.0, 1.0 ); + +float4 tex2Doffset(TORQUE_SAMPLER2D(s), float2 tc, float2 offset) +{ + return TORQUE_TEX2D( s, tc + offset * oneOverTargetSize ); +} + +half3 GetSmallBlurSample( float2 tc ) +{ + half3 sum; + const half weight = 4.0 / 17; + sum = 0; // Unblurred sample done by alpha blending + //sum += weight * tex2Doffset( colorSampler, tc, float2( 0, 0 ) ).rgb; + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(+0.5, -1.5)).rgb); + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(-1.5, -0.5)).rgb); + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(-0.5, +1.5)).rgb); + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(+1.5, +0.5)).rgb); + return sum; +} + +half4 InterpolateDof( half3 small, half3 med, half3 large, half t ) +{ + //t = 2; + half4 weights; + half3 color; + half alpha; + + // Efficiently calculate the cross-blend weights for each sample. + // Let the unblurred sample to small blur fade happen over distance + // d0, the small to medium blur over distance d1, and the medium to + // large blur over distance d2, where d0 + d1 + d2 = 1. + //float4 dofLerpScale = float4( -1 / d0, -1 / d1, -1 / d2, 1 / d2 ); + //float4 dofLerpBias = float4( 1, (1 � d2) / d1, 1 / d2, (d2 � 1) / d2 ); + + weights = half4(saturate( t * dofLerpScale + dofLerpBias )); + weights.yz = min( weights.yz, 1 - weights.xy ); + + // Unblurred sample with weight "weights.x" done by alpha blending + color = weights.y * small + weights.z * med + weights.w * large; + //color = med; + alpha = dot( weights.yzw, half3( 16.0 / 17, 1.0, 1.0 ) ); + //alpha = 0.0; + + return half4( color, alpha ); +} + +half4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //return half4( 1,0,1,1 ); + //return half4( TORQUE_TEX2D( colorSampler, IN.uv0 ).rgb, 1.0 ); + //return half4( TORQUE_TEX2D( colorSampler, texCoords ).rgb, 0 ); + half3 small; + half4 med; + half3 large; + half depth; + half nearCoc; + half farCoc; + half coc; + + small = GetSmallBlurSample( IN.uv0 ); + //small = half3( 1,0,0 ); + //return half4( small, 1.0 ); + med = half4(TORQUE_TEX2D( smallBlurSampler, IN.uv1 )); + //med.rgb = half3( 0,1,0 ); + //return half4(med.rgb, 0.0); + large = half3(TORQUE_TEX2D(largeBlurSampler, IN.uv2).rgb); + //large = half3( 0,0,1 ); + //return large; + //return half4(large.rgb,1.0); + nearCoc = med.a; + + // Since the med blur texture is screwed up currently + // replace it with the large, but this needs to be fixed. + //med.rgb = large; + + //nearCoc = 0; + depth = half(TORQUE_DEFERRED_UNCONDITION( depthSampler, IN.uv3 ).w); + //return half4(depth.rrr,1); + //return half4(nearCoc.rrr,1.0); + + if (depth > 0.999 ) + { + coc = nearCoc; // We don't want to blur the sky. + //coc = 0; + } + else + { + // dofEqFar.x and dofEqFar.y specify the linear ramp to convert + // to depth for the distant out-of-focus region. + // dofEqFar.z is the ratio of the far to the near blur radius. + farCoc = half(clamp( dofEqFar.x * depth + dofEqFar.y, 0.0, maxFarCoC )); + coc = half(max( nearCoc, farCoc * dofEqFar.z )); + //coc = nearCoc; + } + + //coc = nearCoc; + //coc = farCoc; + //return half4(coc.rrr,0.5); + //return half4(farCoc.rrr,1); + //return half4(nearCoc.rrr,1); + + //return half4( 1,0,1,0 ); + return InterpolateDof( small, med.rgb, large, coc ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_V.hlsl new file mode 100644 index 000000000..86c93701a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_V.hlsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; +uniform float2 oneOverTargetSize; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv; + OUT.uv1 = IN.uv; + OUT.uv2 = IN.uv; + OUT.uv3 = IN.uv; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv + rtParams0.xy; + OUT.uv1 = IN.uv + rtParams1.xy; + OUT.uv2 = IN.uv + rtParams2.xy; + OUT.uv3 = IN.uv + rtParams3.xy; + */ + + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv * rtParams0.zw; + OUT.uv1 = IN.uv * rtParams1.zw; + OUT.uv2 = IN.uv * rtParams2.zw; + OUT.uv3 = IN.uv * rtParams3.zw; + */ + + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); // + float2( -5, 1 ) * oneOverTargetSize; + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_P.hlsl new file mode 100644 index 000000000..f4d29f3e1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_P.hlsl @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * 0.5 / 1.3; //25f; + + float4 OUT = 0; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv0 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv1 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv2 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv3 ) * kernel.w; + + OUT += TORQUE_TEX2D( diffuseMap, IN.uv4 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv5 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv6 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + //float3 rgb2lum = float3( 0.30, 0.59, 0.11 ); + //OUT.a = dot( OUT.rgb, rgb2lum ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_V.hlsl new file mode 100644 index 000000000..b2d4582e0 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_V.hlsl @@ -0,0 +1,80 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float4 rtParams0; +uniform float2 texSize0; +uniform float2 oneOverTargetSize; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + + IN.uv = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + // I don't know why this offset is necessary, but it is. + //IN.uv = IN.uv * oneOverTargetSize; + + OUT.uv0 = IN.uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv1 = IN.uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv2 = IN.uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv3 = IN.uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + OUT.uv4 = IN.uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv5 = IN.uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv6 = IN.uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv7 = IN.uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + /* + OUT.uv0 = viewportCoordToRenderTarget( OUT.uv0, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( OUT.uv1, rtParams0 ); + OUT.uv2 = viewportCoordToRenderTarget( OUT.uv2, rtParams0 ); + OUT.uv3 = viewportCoordToRenderTarget( OUT.uv3, rtParams0 ); + + OUT.uv4 = viewportCoordToRenderTarget( OUT.uv4, rtParams0 ); + OUT.uv5 = viewportCoordToRenderTarget( OUT.uv5, rtParams0 ); + OUT.uv6 = viewportCoordToRenderTarget( OUT.uv6, rtParams0 ); + OUT.uv7 = viewportCoordToRenderTarget( OUT.uv7, rtParams0 ); + */ + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Passthrough_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Passthrough_V.hlsl new file mode 100644 index 000000000..8131e45cd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Passthrough_V.hlsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv; + OUT.uv1 = IN.uv; + OUT.uv2 = IN.uv; + OUT.uv3 = IN.uv; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv + rtParams0.xy; + OUT.uv1 = IN.uv + rtParams1.xy; + OUT.uv2 = IN.uv + rtParams2.xy; + OUT.uv3 = IN.uv + rtParams3.xy; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv * rtParams0.zw; + OUT.uv1 = IN.uv * rtParams1.zw; + OUT.uv2 = IN.uv * rtParams2.zw; + OUT.uv3 = IN.uv * rtParams3.zw; + */ + + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_P.hlsl new file mode 100644 index 000000000..175525a91 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_P.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. +#include "../../shaderModel.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorSampler, 0); // Output of DofNearCoc() + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float4 texCoords : TEXCOORD0; +}; + +float4 main( Pixel IN ) : TORQUE_TARGET0 +{ + float4 color; + color = 0.0; + color += TORQUE_TEX2D( colorSampler, IN.texCoords.xz ); + color += TORQUE_TEX2D( colorSampler, IN.texCoords.yz ); + color += TORQUE_TEX2D( colorSampler, IN.texCoords.xw ); + color += TORQUE_TEX2D( colorSampler, IN.texCoords.yw ); + return color / 4.0; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_V.hlsl new file mode 100644 index 000000000..3edb1ec2a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_V.hlsl @@ -0,0 +1,56 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +struct Vert +{ + float3 position : POSITION; + float2 texCoords : TEXCOORD0; +}; + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float4 texCoords : TEXCOORD0; +}; + +uniform float2 oneOverTargetSize; +uniform float4 rtParams0; + +Pixel main( Vert IN ) +{ + Pixel OUT; + const float4 halfPixel = { -0.5, 0.5, -0.5, 0.5 }; + OUT.position = float4(IN.position,1.0); //Transform_ObjectToClip( IN.position ); + + //float2 uv = IN.texCoords + rtParams0.xy; + float2 uv = viewportCoordToRenderTarget( IN.texCoords, rtParams0 ); + OUT.texCoords = uv.xxyy + halfPixel * oneOverTargetSize.xxyy; + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl new file mode 100644 index 000000000..38cb099c4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +// These are set by the game engine. +uniform sampler2D shrunkSampler; // Output of DofDownsample() +uniform sampler2D blurredSampler; // Blurred version of the shrunk sampler + +out vec4 OUT_col; + +// This is the pixel shader function that calculates the actual +// value used for the near circle of confusion. +// "texCoords" are 0 at the bottom left pixel and 1 at the top right. +void main() +{ + vec3 color; + float coc; + half4 blurred; + half4 shrunk; + + shrunk = texture( shrunkSampler, IN_uv0 ); + blurred = texture( blurredSampler, IN_uv1 ); + color = shrunk.rgb; + //coc = shrunk.a; + //coc = blurred.a; + //coc = max( blurred.a, shrunk.a ); + coc = 2 * max( blurred.a, shrunk.a ) - shrunk.a; + + + //OUT_col = vec4( coc.rrr, 1.0 ); + //OUT_col = vec4( color, 1.0 ); + OUT_col = vec4( color, coc ); + //OUT_col = vec4( 1.0, 0.0, 1.0, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl new file mode 100644 index 000000000..d02ce6551 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; + +void main() +{ + /* + OUT_hpos = IN.pos; + OUT_uv0 = IN_uv; + OUT_uv1 = IN_uv; + OUT_uv2 = IN_uv; + OUT_uv3 = IN_uv; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv + rtParams0.xy; + OUT_uv1 = IN_uv + rtParams1.xy; + OUT_uv2 = IN_uv + rtParams2.xy; + OUT_uv3 = IN_uv + rtParams3.xy; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv * rtParams0.zw; + OUT_uv1 = IN_uv * rtParams1.zw; + OUT_uv2 = IN_uv * rtParams2.zw; + OUT_uv3 = IN_uv * rtParams3.zw; + */ + + + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position);; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_P.glsl new file mode 100644 index 000000000..f3c093f31 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_P.glsl @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +// These are set by the game engine. +// The render target size is one-quarter the scene rendering size. +uniform sampler2D colorSampler; +uniform sampler2D depthSampler; +uniform vec2 dofEqWorld; +uniform float depthOffset; +uniform vec2 targetSize; +uniform float maxWorldCoC; +//uniform vec2 dofEqWeapon; +//uniform vec2 dofRowDelta; // vec2( 0, 0.25 / renderTargetHeight ) + +in vec2 tcColor0; +#define IN_tcColor0 tcColor0 +in vec2 tcColor1; +#define IN_tcColor1 tcColor1 +in vec2 tcDepth0; +#define IN_tcDepth0 tcDepth0 +in vec2 tcDepth1; +#define IN_tcDepth1 tcDepth1 +in vec2 tcDepth2; +#define IN_tcDepth2 tcDepth2 +in vec2 tcDepth3; +#define IN_tcDepth3 tcDepth3 + +out vec4 OUT_col; + +void main() +{ + //return vec4( 1.0, 0.0, 1.0, 1.0 ); + + vec2 dofRowDelta = vec2( 0, 0.25 / targetSize.y ); + + //vec2 dofEqWorld = vec2( -60, 1.0 ); + + half3 color; + half maxCoc; + vec4 depth; + half4 viewCoc; + half4 sceneCoc; + half4 curCoc; + half4 coc; + vec2 rowOfs[4]; + + // "rowOfs" reduces how many moves PS2.0 uses to emulate swizzling. + rowOfs[0] = vec2(0); + rowOfs[1] = dofRowDelta.xy; + rowOfs[2] = dofRowDelta.xy * 2; + rowOfs[3] = dofRowDelta.xy * 3; + + // Use bilinear filtering to average 4 color samples for free. + color = half3(0); + color += texture( colorSampler, IN_tcColor0.xy + rowOfs[0] ).rgb; + color += texture( colorSampler, IN_tcColor1.xy + rowOfs[0] ).rgb; + color += texture( colorSampler, IN_tcColor0.xy + rowOfs[2] ).rgb; + color += texture( colorSampler, IN_tcColor1.xy + rowOfs[2] ).rgb; + color /= 4; + + // Process 4 samples at a time to use vector hardware efficiently. + // The CoC will be 1 if the depth is negative, so use "min" to pick + // between "sceneCoc" and "viewCoc". + + coc = half4(0); + for ( int i = 0; i < 4; i++ ) + { + depth[0] = deferredUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w; + depth[1] = deferredUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w; + depth[2] = deferredUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w; + depth[3] = deferredUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w; + + // @todo OPENGL INTEL need review + coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) ); + } + + /* + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[0] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[0] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[0] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[0] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = curCoc; + + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[1] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[1] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[1] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[1] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[2] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[2] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[2] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[2] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[3] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[3] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[3] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[3] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + */ + + maxCoc = max( max( coc[0], coc[1] ), max( coc[2], coc[3] ) ); + + //OUT_col = half4( 1.0, 0.0, 1.0, 1.0 ); + OUT_col = half4( color, maxCoc ); + //OUT_col = half4( color, 1.0f ); + //OUT_col = half4( maxCoc.rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_V.glsl new file mode 100644 index 000000000..b8e840c9e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_V.glsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; +in vec3 vTexCoord1; + +#define IN_pos vPosition +#define IN_tc vTexCoord0 +#define IN_wsEyeRay vTexCoord1 + +#define OUT_position gl_Position + +out vec2 tcColor0; +#define OUT_tcColor0 tcColor0 +out vec2 tcColor1; +#define OUT_tcColor1 tcColor1 +out vec2 tcDepth0; +#define OUT_tcDepth0 tcDepth0 +out vec2 tcDepth1; +#define OUT_tcDepth1 tcDepth1 +out vec2 tcDepth2; +#define OUT_tcDepth2 tcDepth2 +out vec2 tcDepth3; +#define OUT_tcDepth3 tcDepth3 + + +uniform vec4 rtParams0; +uniform vec2 oneOverTargetSize; + +void main() +{ + OUT_position = IN_pos; + + vec2 uv = viewportCoordToRenderTarget( IN_tc, rtParams0 ); + //OUT_position = tMul( IN_pos, modelView ); + OUT_tcColor1 = uv + vec2( +1.0, -0.0 ) * oneOverTargetSize; + OUT_tcColor0 = uv + vec2( -1.0, -0.0 ) * oneOverTargetSize; + OUT_tcDepth0 = uv + vec2( -0.5, -0.0 ) * oneOverTargetSize; + OUT_tcDepth1 = uv + vec2( -1.5, -0.0 ) * oneOverTargetSize; + OUT_tcDepth2 = uv + vec2( +1.5, -0.0 ) * oneOverTargetSize; + OUT_tcDepth3 = uv + vec2( +2.5, -0.0 ) * oneOverTargetSize; + + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_P.glsl new file mode 100644 index 000000000..9b976ba1e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_P.glsl @@ -0,0 +1,147 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D colorSampler; // Original source image +uniform sampler2D smallBlurSampler; // Output of SmallBlurPS() +uniform sampler2D largeBlurSampler; // Blurred output of DofDownsample() +uniform sampler2D depthSampler; // +uniform vec2 oneOverTargetSize; +uniform vec4 dofLerpScale; +uniform vec4 dofLerpBias; +uniform vec3 dofEqFar; +uniform float maxFarCoC; + +//static float d0 = 0.1; +//static float d1 = 0.1; +//static float d2 = 0.8; +//static vec4 dofLerpScale = vec4( -1.0 / d0, -1.0 / d1, -1.0 / d2, 1.0 / d2 ); +//static vec4 dofLerpBias = vec4( 1.0, (1.0 - d2) / d1, 1.0 / d2, (d2 - 1.0) / d2 ); +//static vec3 dofEqFar = vec3( 2.0, 0.0, 1.0 ); + +out vec4 OUT_col; + +vec4 tex2Doffset( sampler2D s, vec2 tc, vec2 offset ) +{ + return texture( s, tc + offset * oneOverTargetSize ); +} + +half3 GetSmallBlurSample( vec2 tc ) +{ + half3 sum; + const half weight = 4.0 / 17; + sum = half3(0); // Unblurred sample done by alpha blending + //sum += weight * tex2Doffset( colorSampler, tc, vec2( 0, 0 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( +0.5, -1.5 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( -1.5, -0.5 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( -0.5, +1.5 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( +1.5, +0.5 ) ).rgb; + return sum; +} + +half4 InterpolateDof( half3 small, half3 med, half3 large, half t ) +{ + //t = 2; + half4 weights; + half3 color; + half alpha; + + // Efficiently calculate the cross-blend weights for each sample. + // Let the unblurred sample to small blur fade happen over distance + // d0, the small to medium blur over distance d1, and the medium to + // large blur over distance d2, where d0 + d1 + d2 = 1. + //vec4 dofLerpScale = vec4( -1 / d0, -1 / d1, -1 / d2, 1 / d2 ); + //vec4 dofLerpBias = vec4( 1, (1 – d2) / d1, 1 / d2, (d2 – 1) / d2 ); + + weights = saturate( t * dofLerpScale + dofLerpBias ); + weights.yz = min( weights.yz, 1 - weights.xy ); + + // Unblurred sample with weight "weights.x" done by alpha blending + color = weights.y * small + weights.z * med + weights.w * large; + //color = med; + alpha = dot( weights.yzw, half3( 16.0 / 17, 1.0, 1.0 ) ); + //alpha = 0.0; + + return half4( color, alpha ); +} + +void main() +{ + //return half4( 1,0,1,1 ); + //return half4( texture( colorSampler, IN_uv0 ).rgb, 1.0 ); + //return half4( texture( colorSampler, texCoords ).rgb, 0 ); + half3 small; + half4 med; + half3 large; + half depth; + half nearCoc; + half farCoc; + half coc; + + small = GetSmallBlurSample( IN_uv0 ); + //small = half3( 1,0,0 ); + //return half4( small, 1.0 ); + med = texture( smallBlurSampler, IN_uv1 ); + //med.rgb = half3( 0,1,0 ); + //return half4(med.rgb, 0.0); + large = texture( largeBlurSampler, IN_uv2 ).rgb; + //large = half3( 0,0,1 ); + //return large; + //return half4(large.rgb,1.0); + nearCoc = med.a; + + // Since the med blur texture is screwed up currently + // replace it with the large, but this needs to be fixed. + //med.rgb = large; + + //nearCoc = 0; + depth = deferredUncondition( depthSampler, IN_uv3 ).w; + //return half4(depth.rrr,1); + //return half4(nearCoc.rrr,1.0); + + if (depth > 0.999 ) + { + coc = nearCoc; // We don't want to blur the sky. + //coc = 0; + } + else + { + // dofEqFar.x and dofEqFar.y specify the linear ramp to convert + // to depth for the distant out-of-focus region. + // dofEqFar.z is the ratio of the far to the near blur radius. + farCoc = clamp( dofEqFar.x * depth + dofEqFar.y, 0.0, maxFarCoC ); + coc = max( nearCoc, farCoc * dofEqFar.z ); + //coc = nearCoc; + } + + //coc = nearCoc; + //coc = farCoc; + //return half4(coc.rrr,0.5); + //return half4(farCoc.rrr,1); + //return half4(nearCoc.rrr,1); + + //return half4( 1,0,1,0 ); + OUT_col = InterpolateDof( small, med.rgb, large, coc ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_V.glsl new file mode 100644 index 000000000..abc91246e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_V.glsl @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; +uniform vec2 oneOverTargetSize; + +void main() +{ + /* + OUT.hpos = IN_pos; + OUT_uv0 = IN_uv; + OUT_uv1 = IN_uv; + OUT_uv2 = IN_uv; + OUT_uv3 = IN_uv; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv + rtParams0.xy; + OUT_uv1 = IN_uv + rtParams1.xy; + OUT_uv2 = IN_uv + rtParams2.xy; + OUT_uv3 = IN_uv + rtParams3.xy; + */ + + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv * rtParams0.zw; + OUT_uv1 = IN_uv * rtParams1.zw; + OUT_uv2 = IN_uv * rtParams2.zw; + OUT_uv3 = IN_uv * rtParams3.zw; + */ + + + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); // + vec2( -5, 1 ) * oneOverTargetSize; + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_P.glsl new file mode 100644 index 000000000..61e7697af --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_P.glsl @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec3 wsEyeRay; +#define IN_wsEyeRay wsEyeRay +in vec2 uv0; +#define IN_uv0 uv0 +in vec2 uv1; +#define IN_uv1 uv1 +in vec2 uv2; +#define IN_uv2 uv2 +in vec2 uv3; +#define IN_uv3 uv3 +in vec2 uv4; +#define IN_uv4 uv4 +in vec2 uv5; +#define IN_uv5 uv5 +in vec2 uv6; +#define IN_uv6 uv6 +in vec2 uv7; +#define IN_uv7 uv7 + +out vec4 OUT_col; + +uniform sampler2D diffuseMap; + +void main() +{ + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5 / 1.3; //25f; + + OUT_col = vec4(0); + OUT_col += texture( diffuseMap, IN_uv0 ) * kernel.x; + OUT_col += texture( diffuseMap, IN_uv1 ) * kernel.y; + OUT_col += texture( diffuseMap, IN_uv2 ) * kernel.z; + OUT_col += texture( diffuseMap, IN_uv3 ) * kernel.w; + + OUT_col += texture( diffuseMap, IN_uv4 ) * kernel.x; + OUT_col += texture( diffuseMap, IN_uv5 ) * kernel.y; + OUT_col += texture( diffuseMap, IN_uv6 ) * kernel.z; + OUT_col += texture( diffuseMap, IN_uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + //vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 ); + //OUT_col.a = dot( OUT_col.rgb, rgb2lum ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_V.glsl new file mode 100644 index 000000000..c77e23c53 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_V.glsl @@ -0,0 +1,91 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; +in vec3 vTexCoord1; + +#define IN_pos vPosition +#define _IN_uv vTexCoord0 +#define IN_wsEyeRay vTexCoord1 + +#define OUT_hpos gl_Position +out vec3 wsEyeRay; +#define OUT_wsEyeRay wsEyeRay +out vec2 uv0; +#define OUT_uv0 uv0 +out vec2 uv1; +#define OUT_uv1 uv1 +out vec2 uv2; +#define OUT_uv2 uv2 +out vec2 uv3; +#define OUT_uv3 uv3 +out vec2 uv4; +#define OUT_uv4 uv4 +out vec2 uv5; +#define OUT_uv5 uv5 +out vec2 uv6; +#define OUT_uv6 uv6 +out vec2 uv7; +#define OUT_uv7 uv7 + +uniform vec2 texSize0; +uniform vec4 rtParams0; +uniform vec2 oneOverTargetSize; + + +void main() +{ + OUT_hpos = IN_pos; + + vec2 IN_uv = viewportCoordToRenderTarget( _IN_uv, rtParams0 ); + + // I don't know why this offset is necessary, but it is. + //IN_uv = IN_uv * oneOverTargetSize; + + OUT_uv0 = IN_uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT_uv1 = IN_uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT_uv2 = IN_uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT_uv3 = IN_uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + OUT_uv4 = IN_uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT_uv5 = IN_uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT_uv6 = IN_uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT_uv7 = IN_uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + /* + OUT_uv0 = viewportCoordToRenderTarget( OUT_uv0, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( OUT_uv1, rtParams0 ); + OUT_uv2 = viewportCoordToRenderTarget( OUT_uv2, rtParams0 ); + OUT_uv3 = viewportCoordToRenderTarget( OUT_uv3, rtParams0 ); + + OUT_uv4 = viewportCoordToRenderTarget( OUT_uv4, rtParams0 ); + OUT_uv5 = viewportCoordToRenderTarget( OUT_uv5, rtParams0 ); + OUT_uv6 = viewportCoordToRenderTarget( OUT_uv6, rtParams0 ); + OUT_uv7 = viewportCoordToRenderTarget( OUT_uv7, rtParams0 ); + */ + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl new file mode 100644 index 000000000..bd02fb7d4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; + +void main() +{ + /* + OUT.hpos = IN_pos; + OUT_uv0 = IN_uv; + OUT_uv1 = IN_uv; + OUT_uv2 = IN_uv; + OUT_uv3 = IN_uv; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv + rtParams0.xy; + OUT_uv1 = IN_uv + rtParams1.xy; + OUT_uv2 = IN_uv + rtParams2.xy; + OUT_uv3 = IN_uv + rtParams3.xy; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv * rtParams0.zw; + OUT_uv1 = IN_uv * rtParams1.zw; + OUT_uv2 = IN_uv * rtParams2.zw; + OUT_uv3 = IN_uv * rtParams3.zw; + */ + + + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl new file mode 100644 index 000000000..ae94edd78 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. + +#include "../../../gl/hlslCompat.glsl" + +uniform sampler2D colorSampler; // Output of DofNearCoc() + +in vec4 texCoords; +#define IN_texCoords texCoords + +out vec4 OUT_col; + +void main() +{ + vec4 color; + color = vec4(0.0); + color += texture( colorSampler, IN_texCoords.xz ); + color += texture( colorSampler, IN_texCoords.yz ); + color += texture( colorSampler, IN_texCoords.xw ); + color += texture( colorSampler, IN_texCoords.yw ); + OUT_col = color / 4.0; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl new file mode 100644 index 000000000..413abd352 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_position vPosition +#define IN_texCoords vTexCoord0 + +#define OUT_position gl_Position +out vec4 texCoords; +#define OUT_texCoords texCoords + +uniform vec2 oneOverTargetSize; +uniform vec4 rtParams0; + +void main() +{ + const vec4 halfPixel = vec4( -0.5, 0.5, -0.5, 0.5 ); + OUT_position = IN_position; //Transform_ObjectToClip( IN_position ); + + //vec2 uv = IN_texCoords + rtParams0.xy; + vec2 uv = viewportCoordToRenderTarget( IN_texCoords, rtParams0 ); + OUT_texCoords = uv.xxyy + halfPixel * oneOverTargetSize.xxyy; + + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl new file mode 100644 index 000000000..fbd529031 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(edgeBuffer); + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + return float4( TORQUE_TEX2D( edgeBuffer, IN.uv0 ).rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAP.hlsl new file mode 100644 index 000000000..f5a71687d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAP.hlsl @@ -0,0 +1,66 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(edgeBuffer,0); +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 1); +uniform float2 targetSize; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 pixelSize = 1.0 / targetSize; + + // Sample edge buffer, bail if not on an edge + float edgeSample = TORQUE_TEX2D(edgeBuffer, IN.uv0).r; + clip(edgeSample - 1e-6); + + // Ok we're on an edge, so multi-tap sample, average, and return + float2 offsets[9] = { + float2( 0.0, 0.0), + float2(-1.0, -1.0), + float2( 0.0, -1.0), + float2( 1.0, -1.0), + float2( 1.0, 0.0), + float2( 1.0, 1.0), + float2( 0.0, 1.0), + float2(-1.0, 1.0), + float2(-1.0, 0.0), + }; + + float4 accumColor = 0; + for(int i = 0; i < 9; i++) + { + // Multiply the intensity of the edge, by the UV, so that things which maybe + // aren't quite full edges get sub-pixel sampling to reduce artifacts + + // Scaling offsets by 0.5 to reduce the range bluriness from extending to + // far outward from the edge. + + float2 offsetUV = IN.uv1 + edgeSample * ( offsets[i] * 0.5 ) * pixelSize;//rtWidthHeightInvWidthNegHeight.zw; + //offsetUV *= 0.999; + accumColor += TORQUE_TEX2D(backBuffer, offsetUV); + } + accumColor /= 9.0; + + return accumColor; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAV.hlsl new file mode 100644 index 000000000..4718b40f5 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAV.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + OUT.hpos = IN.pos; + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeDetectP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeDetectP.hlsl new file mode 100644 index 000000000..c8bfb2153 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeDetectP.hlsl @@ -0,0 +1,93 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer,0); + +// GPU Gems 3, pg 443-444 +float GetEdgeWeight(float2 uv0, in float2 targetSize) +{ + float2 offsets[9] = { + float2( 0.0, 0.0), + float2(-1.0, -1.0), + float2( 0.0, -1.0), + float2( 1.0, -1.0), + float2( 1.0, 0.0), + float2( 1.0, 1.0), + float2( 0.0, 1.0), + float2(-1.0, 1.0), + float2(-1.0, 0.0), + }; + + + float2 PixelSize = 1.0 / targetSize; + + float Depth[9]; + float3 Normal[9]; + + [unroll] //no getting around this, may as well save the annoying warning message + for(int i = 0; i < 9; i++) + { + float2 uv = uv0 + offsets[i] * PixelSize; + float4 gbSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uv ); + Depth[i] = gbSample.a; + Normal[i] = gbSample.rgb; + } + + float4 Deltas1 = float4(Depth[1], Depth[2], Depth[3], Depth[4]); + float4 Deltas2 = float4(Depth[5], Depth[6], Depth[7], Depth[8]); + + Deltas1 = abs(Deltas1 - Depth[0]); + Deltas2 = abs(Depth[0] - Deltas2); + + float4 maxDeltas = max(Deltas1, Deltas2); + float4 minDeltas = max(min(Deltas1, Deltas2), 0.00001); + + float4 depthResults = step(minDeltas * 25.0, maxDeltas); + + Deltas1.x = dot(Normal[1], Normal[0]); + Deltas1.y = dot(Normal[2], Normal[0]); + Deltas1.z = dot(Normal[3], Normal[0]); + Deltas1.w = dot(Normal[4], Normal[0]); + + Deltas2.x = dot(Normal[5], Normal[0]); + Deltas2.y = dot(Normal[6], Normal[0]); + Deltas2.z = dot(Normal[7], Normal[0]); + Deltas2.w = dot(Normal[8], Normal[0]); + + Deltas1 = abs(Deltas1 - Deltas2); + + float4 normalResults = step(0.4, Deltas1); + + normalResults = max(normalResults, depthResults); + + return dot(normalResults, float4(1.0, 1.0, 1.0, 1.0)) * 0.25; +} + +uniform float2 targetSize; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + return GetEdgeWeight(IN.uv0, targetSize);//rtWidthHeightInvWidthNegHeight.zw); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl new file mode 100644 index 000000000..ccc3b8ba5 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec2 uv0; +#define IN_uv0 uv0 + +uniform sampler2D edgeBuffer; + +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4( texture( edgeBuffer, IN_uv0 ).rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAP.glsl new file mode 100644 index 000000000..216dc8725 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAP.glsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D edgeBuffer; +uniform sampler2D backBuffer; +uniform vec2 targetSize; + +out vec4 OUT_col; + +void main() +{ + vec2 pixelSize = 1.0 / targetSize; + + // Sample edge buffer, bail if not on an edge + float edgeSample = texture(edgeBuffer, IN_uv0).r; + clip(edgeSample - 1e-6); + + // Ok we're on an edge, so multi-tap sample, average, and return + vec2 offsets[9] = vec2[]( + vec2( 0.0, 0.0), + vec2(-1.0, -1.0), + vec2( 0.0, -1.0), + vec2( 1.0, -1.0), + vec2( 1.0, 0.0), + vec2( 1.0, 1.0), + vec2( 0.0, 1.0), + vec2(-1.0, 1.0), + vec2(-1.0, 0.0) + ); + + vec4 accumColor = vec4(0.0); + for(int i = 0; i < 9; i++) + { + // Multiply the intensity of the edge, by the UV, so that things which maybe + // aren't quite full edges get sub-pixel sampling to reduce artifacts + + // Scaling offsets by 0.5 to reduce the range bluriness from extending to + // far outward from the edge. + + vec2 offsetUV = IN_uv1 + edgeSample * ( offsets[i] * 0.5 ) * pixelSize;//rtWidthHeightInvWidthNegHeight.zw; + //offsetUV *= 0.999; + accumColor+= texture(backBuffer, offsetUV); + } + accumColor /= 9.0; + + OUT_col = accumColor; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAV.glsl new file mode 100644 index 000000000..975532272 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAV.glsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; + +void main() +{ + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeDetectP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeDetectP.glsl new file mode 100644 index 000000000..02507eee8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeDetectP.glsl @@ -0,0 +1,96 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +// GPU Gems 3, pg 443-444 +float GetEdgeWeight(vec2 uv0, in sampler2D deferredBuffer, in vec2 targetSize) +{ + vec2 offsets[9] = vec2[]( + vec2( 0.0, 0.0), + vec2(-1.0, -1.0), + vec2( 0.0, -1.0), + vec2( 1.0, -1.0), + vec2( 1.0, 0.0), + vec2( 1.0, 1.0), + vec2( 0.0, 1.0), + vec2(-1.0, 1.0), + vec2(-1.0, 0.0) + ); + + + vec2 PixelSize = 1.0 / targetSize; + + float Depth[9]; + vec3 Normal[9]; + + for(int i = 0; i < 9; i++) + { + vec2 uv = uv0 + offsets[i] * PixelSize; + vec4 gbSample = deferredUncondition( deferredBuffer, uv ); + Depth[i] = gbSample.a; + Normal[i] = gbSample.rgb; + } + + vec4 Deltas1 = vec4(Depth[1], Depth[2], Depth[3], Depth[4]); + vec4 Deltas2 = vec4(Depth[5], Depth[6], Depth[7], Depth[8]); + + Deltas1 = abs(Deltas1 - Depth[0]); + Deltas2 = abs(Depth[0] - Deltas2); + + vec4 maxDeltas = max(Deltas1, Deltas2); + vec4 minDeltas = max(min(Deltas1, Deltas2), 0.00001); + + vec4 depthResults = step(minDeltas * 25.0, maxDeltas); + + Deltas1.x = dot(Normal[1], Normal[0]); + Deltas1.y = dot(Normal[2], Normal[0]); + Deltas1.z = dot(Normal[3], Normal[0]); + Deltas1.w = dot(Normal[4], Normal[0]); + + Deltas2.x = dot(Normal[5], Normal[0]); + Deltas2.y = dot(Normal[6], Normal[0]); + Deltas2.z = dot(Normal[7], Normal[0]); + Deltas2.w = dot(Normal[8], Normal[0]); + + Deltas1 = abs(Deltas1 - Deltas2); + + vec4 normalResults = step(0.4, Deltas1); + + normalResults = max(normalResults, depthResults); + + return dot(normalResults, vec4(1.0, 1.0, 1.0, 1.0)) * 0.25; +} + +in vec2 uv0; +#define IN_uv0 uv0 + +uniform sampler2D deferredBuffer; +uniform vec2 targetSize; + +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4( GetEdgeWeight(IN_uv0, deferredBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/flashP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/flashP.hlsl new file mode 100644 index 000000000..93daf3c26 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/flashP.hlsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "../torque.hlsl" + +uniform float damageFlash; +uniform float whiteOut; +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 color1 = TORQUE_TEX2D(backBuffer, IN.uv0); + float4 color2 = color1 * MUL_COLOR; + float4 damage = lerp(color1,color2,damageFlash); + return lerp(damage,WHITE_COLOR,whiteOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fogP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fogP.hlsl new file mode 100644 index 000000000..9f3500f67 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fogP.hlsl @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +#include "./postFx.hlsl" +#include "./../torque.hlsl" +#include "./../shaderModelAutoGen.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +uniform float3 eyePosWorld; +uniform float4 fogColor; +uniform float3 fogData; +uniform float4 rtParams0; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //float2 deferredCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + //return float4( depth, 0, 0, 0.7 ); + + float factor = computeSceneFog( eyePosWorld, + eyePosWorld + ( IN.wsEyeRay * depth ), + fogData.x, + fogData.y, + fogData.z ); + + return hdrEncode( float4( fogColor.rgb, 1.0 - saturate( factor ) ) ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/Fxaa3_11.h b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/Fxaa3_11.h new file mode 100644 index 000000000..9ca7627d4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/Fxaa3_11.h @@ -0,0 +1,2047 @@ +/*============================================================================ + + + NVIDIA FXAA 3.11 by TIMOTHY LOTTES + + +------------------------------------------------------------------------------ +COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED. +------------------------------------------------------------------------------ +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED +*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR +CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR +LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, +OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE +THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +------------------------------------------------------------------------------ + INTEGRATION CHECKLIST +------------------------------------------------------------------------------ +(1.) +In the shader source, setup defines for the desired configuration. +When providing multiple shaders (for different presets), +simply setup the defines differently in multiple files. +Example, + + #define FXAA_PC 1 + #define FXAA_HLSL_5 1 + #define FXAA_QUALITY__PRESET 12 + +Or, + + #define FXAA_360 1 + +Or, + + #define FXAA_PS3 1 + +Etc. + +(2.) +Then include this file, + + include "Fxaa3_11.h" + +(3.) +Then call the FXAA pixel shader from within your desired shader. +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. +As for FXAA 3.11 all inputs for all shaders are the same +to enable easy porting between platforms. + + return FxaaPixelShader(...); + +(4.) +Insure pass prior to FXAA outputs RGBL (see next section). +Or use, + + #define FXAA_GREEN_AS_LUMA 1 + +(5.) +Setup engine to provide the following constants +which are used in the FxaaPixelShader() inputs, + + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir + +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. + +(6.) +Have FXAA vertex shader run as a full screen triangle, +and output "pos" and "fxaaConsolePosPos" +such that inputs in the pixel shader provide, + + // {xy} = center of pixel + FxaaFloat2 pos, + + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + +(7.) +Insure the texture sampler(s) used by FXAA are set to bilinear filtering. + + +------------------------------------------------------------------------------ + INTEGRATION - RGBL AND COLORSPACE +------------------------------------------------------------------------------ +FXAA3 requires RGBL as input unless the following is set, + + #define FXAA_GREEN_AS_LUMA 1 + +In which case the engine uses green in place of luma, +and requires RGB input is in a non-linear colorspace. + +RGB should be LDR (low dynamic range). +Specifically do FXAA after tonemapping. + +RGB data as returned by a texture fetch can be non-linear, +or linear when FXAA_GREEN_AS_LUMA is not set. +Note an "sRGB format" texture counts as linear, +because the result of a texture fetch is linear data. +Regular "RGBA8" textures in the sRGB colorspace are non-linear. + +If FXAA_GREEN_AS_LUMA is not set, +luma must be stored in the alpha channel prior to running FXAA. +This luma should be in a perceptual space (could be gamma 2.0). +Example pass before FXAA where output is gamma 2.0 encoded, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + color.a = dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114)); // compute luma + return color; + +Another example where output is linear encoded, +say for instance writing to an sRGB formated render target, +where the render target does the conversion back to sRGB after blending, + + color.rgb = ToneMap(color.rgb); // linear color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.a = sqrt(dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114))); // compute luma + return color; + +Getting luma correct is required for the algorithm to work correctly. + + +------------------------------------------------------------------------------ + BEING LINEARLY CORRECT? +------------------------------------------------------------------------------ +Applying FXAA to a framebuffer with linear RGB color will look worse. +This is very counter intuitive, but happends to be true in this case. +The reason is because dithering artifacts will be more visiable +in a linear colorspace. + + +------------------------------------------------------------------------------ + COMPLEX INTEGRATION +------------------------------------------------------------------------------ +Q. What if the engine is blending into RGB before wanting to run FXAA? + +A. In the last opaque pass prior to FXAA, + have the pass write out luma into alpha. + Then blend into RGB only. + FXAA should be able to run ok + assuming the blending pass did not any add aliasing. + This should be the common case for particles and common blending passes. + +A. Or use FXAA_GREEN_AS_LUMA. + +============================================================================*/ + +/*============================================================================ + + INTEGRATION KNOBS + +============================================================================*/ +// +// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE). +// FXAA_360_OPT is a prototype for the new optimized 360 version. +// +// 1 = Use API. +// 0 = Don't use API. +// +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PS3 + #define FXAA_PS3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360 + #define FXAA_360 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360_OPT + #define FXAA_360_OPT 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_PC + // + // FXAA Quality + // The high quality PC algorithm. + // + #define FXAA_PC 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PC_CONSOLE + // + // The console algorithm for PC is included + // for developers targeting really low spec machines. + // Likely better to just run FXAA_PC, and use a really low preset. + // + #define FXAA_PC_CONSOLE 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_120 + #define FXAA_GLSL_120 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_130 + #define FXAA_GLSL_130 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_3 + #define FXAA_HLSL_3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_4 + #define FXAA_HLSL_4 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_5 + #define FXAA_HLSL_5 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_GREEN_AS_LUMA + // + // For those using non-linear color, + // and either not able to get luma in alpha, or not wanting to, + // this enables FXAA to run using green as a proxy for luma. + // So with this enabled, no need to pack luma in alpha. + // + // This will turn off AA on anything which lacks some amount of green. + // Pure red and blue or combination of only R and B, will get no AA. + // + // Might want to lower the settings for both, + // fxaaConsoleEdgeThresholdMin + // fxaaQualityEdgeThresholdMin + // In order to insure AA does not get turned off on colors + // which contain a minor amount of green. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_GREEN_AS_LUMA 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_EARLY_EXIT + // + // Controls algorithm's early exit path. + // On PS3 turning this ON adds 2 cycles to the shader. + // On 360 turning this OFF adds 10ths of a millisecond to the shader. + // Turning this off on console will result in a more blurry image. + // So this defaults to on. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_EARLY_EXIT 1 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_DISCARD + // + // Only valid for PC OpenGL currently. + // Probably will not work when FXAA_GREEN_AS_LUMA = 1. + // + // 1 = Use discard on pixels which don't need AA. + // For APIs which enable concurrent TEX+ROP from same surface. + // 0 = Return unchanged color on pixels which don't need AA. + // + #define FXAA_DISCARD 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_FAST_PIXEL_OFFSET + // + // Used for GLSL 120 only. + // + // 1 = GL API supports fast pixel offsets + // 0 = do not use fast pixel offsets + // + #ifdef GL_EXT_gpu_shader4 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifndef FXAA_FAST_PIXEL_OFFSET + #define FXAA_FAST_PIXEL_OFFSET 0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GATHER4_ALPHA + // + // 1 = API supports gather4 on alpha channel. + // 0 = API does not support gather4 on alpha channel. + // + #if (FXAA_HLSL_5 == 1) + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifndef FXAA_GATHER4_ALPHA + #define FXAA_GATHER4_ALPHA 0 + #endif +#endif + +/*============================================================================ + FXAA CONSOLE PS3 - TUNING KNOBS +============================================================================*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS + // + // Consoles the sharpness of edges on PS3 only. + // Non-PS3 tuning is done with shader input. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 8.0 is sharper + // 4.0 is softer + // 2.0 is really soft (good for vector graphics inputs) + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD + // + // Only effects PS3. + // Non-PS3 tuning is done with shader input. + // + // The minimum amount of local contrast required to apply algorithm. + // The console setting has a different mapping than the quality setting. + // + // This only applies when FXAA_EARLY_EXIT is 1. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 0.25 and 0.125. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 0.125 leaves less aliasing, but is softer + // 0.25 leaves more aliasing, and is sharper + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125 + #else + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25 + #endif +#endif + +/*============================================================================ + FXAA QUALITY - TUNING KNOBS +------------------------------------------------------------------------------ +NOTE the other tuning knobs are now in the shader function inputs! +============================================================================*/ +#ifndef FXAA_QUALITY__PRESET + // + // Choose the quality preset. + // This needs to be compiled into the shader as it effects code. + // Best option to include multiple presets is to + // in each shader define the preset, then include this file. + // + // OPTIONS + // ----------------------------------------------------------------------- + // 10 to 15 - default medium dither (10=fastest, 15=highest quality) + // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality) + // 39 - no dither, very expensive + // + // NOTES + // ----------------------------------------------------------------------- + // 12 = slightly faster then FXAA 3.9 and higher edge quality (default) + // 13 = about same speed as FXAA 3.9 and better than 12 + // 23 = closest to FXAA 3.9 visually and performance wise + // _ = the lowest digit is directly related to performance + // _ = the highest digit is directly related to style + // + #define FXAA_QUALITY__PRESET 12 +#endif + + +/*============================================================================ + + FXAA QUALITY - PRESETS + +============================================================================*/ + +/*============================================================================ + FXAA QUALITY - MEDIUM DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 10) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 3.0 + #define FXAA_QUALITY__P2 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 11) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 3.0 + #define FXAA_QUALITY__P3 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 12) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 4.0 + #define FXAA_QUALITY__P4 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 13) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 4.0 + #define FXAA_QUALITY__P5 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 14) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 4.0 + #define FXAA_QUALITY__P6 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 15) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 12.0 +#endif + +/*============================================================================ + FXAA QUALITY - LOW DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 20) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 2.0 + #define FXAA_QUALITY__P2 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 21) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 22) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 23) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 24) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 3.0 + #define FXAA_QUALITY__P6 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 25) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 26) + #define FXAA_QUALITY__PS 9 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 4.0 + #define FXAA_QUALITY__P8 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 27) + #define FXAA_QUALITY__PS 10 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 4.0 + #define FXAA_QUALITY__P9 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 28) + #define FXAA_QUALITY__PS 11 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 4.0 + #define FXAA_QUALITY__P10 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 29) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif + +/*============================================================================ + FXAA QUALITY - EXTREME QUALITY +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 39) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.0 + #define FXAA_QUALITY__P2 1.0 + #define FXAA_QUALITY__P3 1.0 + #define FXAA_QUALITY__P4 1.0 + #define FXAA_QUALITY__P5 1.5 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif + + + +/*============================================================================ + + API PORTING + +============================================================================*/ +#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1) + #define FxaaBool bool + #define FxaaDiscard discard + #define FxaaFloat float + #define FxaaFloat2 vec2 + #define FxaaFloat3 vec3 + #define FxaaFloat4 vec4 + #define FxaaHalf float + #define FxaaHalf2 vec2 + #define FxaaHalf3 vec3 + #define FxaaHalf4 vec4 + #define FxaaInt2 ivec2 + #define FxaaSat(x) clamp(x, 0.0, 1.0) + #define FxaaTex sampler2D +#else + #define FxaaBool bool + #define FxaaDiscard clip(-1) + #define FxaaFloat float + #define FxaaFloat2 float2 + #define FxaaFloat3 float3 + #define FxaaFloat4 float4 + #define FxaaHalf half + #define FxaaHalf2 half2 + #define FxaaHalf3 half3 + #define FxaaHalf4 half4 + #define FxaaSat(x) saturate(x) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_120 == 1) + // Requires, + // #version 120 + // And at least, + // #extension GL_EXT_gpu_shader4 : enable + // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9) + #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0) + #if (FXAA_FAST_PIXEL_OFFSET == 1) + #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o) + #else + #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0) + #endif + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_130 == 1) + // Requires "#version 130" or better + #define FxaaTexTop(t, p) textureLod(t, p, 0.0) + #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o) + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1) + #define FxaaInt2 float2 + #define FxaaTex sampler2D + #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0)) + #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0)) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_4 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_5 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) + #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p) + #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o) + #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p) + #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o) +#endif + + +/*============================================================================ + GREEN AS LUMA OPTION SUPPORT FUNCTION +============================================================================*/ +#if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; } +#else + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; } +#endif + + + + +/*============================================================================ + + FXAA3 QUALITY - PC + +============================================================================*/ +#if (FXAA_PC == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy} = center of pixel + FxaaFloat2 pos, + // + // Used only for FXAA Console, and not used on the 360 version. + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + // + // Input color texture. + // {rgb_} = color in linear or perceptual color space + // if (FXAA_GREEN_AS_LUMA == 0) + // {___a} = luma in perceptual color space (not linear) + FxaaTex tex, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 2nd sampler. + // This sampler needs to have an exponent bias of -1. + FxaaTex fxaaConsole360TexExpBiasNegOne, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 3nd sampler. + // This sampler needs to have an exponent bias of -2. + FxaaTex fxaaConsole360TexExpBiasNegTwo, + // + // Only used on FXAA Quality. + // This must be from a constant/uniform. + // {x_} = 1.0/screenWidthInPixels + // {_y} = 1.0/screenHeightInPixels + FxaaFloat2 fxaaQualityRcpFrame, + // + // Only used on FXAA Console. + // This must be from a constant/uniform. + // This effects sub-pixel AA quality and inversely sharpness. + // Where N ranges between, + // N = 0.50 (default) + // N = 0.33 (sharper) + // {x___} = -N/screenWidthInPixels + // {_y__} = -N/screenHeightInPixels + // {__z_} = N/screenWidthInPixels + // {___w} = N/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt, + // + // Only used on FXAA Console. + // Not used on 360, but used on PS3 and PC. + // This must be from a constant/uniform. + // {x___} = -2.0/screenWidthInPixels + // {_y__} = -2.0/screenHeightInPixels + // {__z_} = 2.0/screenWidthInPixels + // {___w} = 2.0/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + // + // Only used on FXAA Console. + // Only used on 360 in place of fxaaConsoleRcpFrameOpt2. + // This must be from a constant/uniform. + // {x___} = 8.0/screenWidthInPixels + // {_y__} = 8.0/screenHeightInPixels + // {__z_} = -4.0/screenWidthInPixels + // {___w} = -4.0/screenHeightInPixels + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + FxaaFloat fxaaQualitySubpix, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + FxaaFloat fxaaQualityEdgeThreshold, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaQualityEdgeThresholdMin, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // there are only three safe values here: 2 and 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + FxaaFloat fxaaConsoleEdgeSharpness, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3. + // Due to the PS3 being ALU bound, + // there are only two safe values here: 1/4 and 1/8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // The console setting has a different mapping than the quality setting. + // Other platforms can use other values. + // 0.125 leaves less aliasing, but is softer (default!!!) + // 0.25 leaves more aliasing, and is sharper + FxaaFloat fxaaConsoleEdgeThreshold, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // The console setting has a different mapping than the quality setting. + // This only applies when FXAA_EARLY_EXIT is 1. + // This does not apply to PS3, + // PS3 was simplified to avoid more shader instructions. + // 0.06 - faster but more aliasing in darks + // 0.05 - default + // 0.04 - slower and less aliasing in darks + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaConsoleEdgeThresholdMin, + // + // Extra constants for 360 FXAA Console only. + // Use zeros or anything else for other platforms. + // These must be in physical constant registers and NOT immedates. + // Immedates will result in compiler un-optimizing. + // {xyzw} = float4(1.0, -1.0, 0.25, -0.25) + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posM; + posM.x = pos.x; + posM.y = pos.y; + #if (FXAA_GATHER4_ALPHA == 1) + #if (FXAA_DISCARD == 0) + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + #endif + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1)); + #else + FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1)); + #endif + #if (FXAA_DISCARD == 1) + #define lumaM luma4A.w + #endif + #define lumaE luma4A.z + #define lumaS luma4A.x + #define lumaSE luma4A.y + #define lumaNW luma4B.w + #define lumaN luma4B.z + #define lumaW luma4B.x + #else + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat maxSM = max(lumaS, lumaM); + FxaaFloat minSM = min(lumaS, lumaM); + FxaaFloat maxESM = max(lumaE, maxSM); + FxaaFloat minESM = min(lumaE, minSM); + FxaaFloat maxWN = max(lumaN, lumaW); + FxaaFloat minWN = min(lumaN, lumaW); + FxaaFloat rangeMax = max(maxWN, maxESM); + FxaaFloat rangeMin = min(minWN, minESM); + FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold; + FxaaFloat range = rangeMax - rangeMin; + FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled); + FxaaBool earlyExit = range < rangeMaxClamped; +/*--------------------------------------------------------------------------*/ + if(earlyExit) + #if (FXAA_DISCARD == 1) + FxaaDiscard; + #else + return rgbyM; + #endif +/*--------------------------------------------------------------------------*/ + #if (FXAA_GATHER4_ALPHA == 0) + FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #else + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNS = lumaN + lumaS; + FxaaFloat lumaWE = lumaW + lumaE; + FxaaFloat subpixRcpRange = 1.0/range; + FxaaFloat subpixNSWE = lumaNS + lumaWE; + FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS; + FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNESE = lumaNE + lumaSE; + FxaaFloat lumaNWNE = lumaNW + lumaNE; + FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE; + FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNWSW = lumaNW + lumaSW; + FxaaFloat lumaSWSE = lumaSW + lumaSE; + FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2); + FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2); + FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW; + FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE; + FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4; + FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4; +/*--------------------------------------------------------------------------*/ + FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE; + FxaaFloat lengthSign = fxaaQualityRcpFrame.x; + FxaaBool horzSpan = edgeHorz >= edgeVert; + FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE; +/*--------------------------------------------------------------------------*/ + if(!horzSpan) lumaN = lumaW; + if(!horzSpan) lumaS = lumaE; + if(horzSpan) lengthSign = fxaaQualityRcpFrame.y; + FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM; +/*--------------------------------------------------------------------------*/ + FxaaFloat gradientN = lumaN - lumaM; + FxaaFloat gradientS = lumaS - lumaM; + FxaaFloat lumaNN = lumaN + lumaM; + FxaaFloat lumaSS = lumaS + lumaM; + FxaaBool pairN = abs(gradientN) >= abs(gradientS); + FxaaFloat gradient = max(abs(gradientN), abs(gradientS)); + if(pairN) lengthSign = -lengthSign; + FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange); +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posB; + posB.x = posM.x; + posB.y = posM.y; + FxaaFloat2 offNP; + offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x; + offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y; + if(!horzSpan) posB.x += lengthSign * 0.5; + if( horzSpan) posB.y += lengthSign * 0.5; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posN; + posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; + posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; + FxaaFloat2 posP; + posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; + posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; + FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; + FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); + FxaaFloat subpixE = subpixC * subpixC; + FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP)); +/*--------------------------------------------------------------------------*/ + if(!pairN) lumaNN = lumaSS; + FxaaFloat gradientScaled = gradient * 1.0/4.0; + FxaaFloat lumaMM = lumaM - lumaNN * 0.5; + FxaaFloat subpixF = subpixD * subpixE; + FxaaBool lumaMLTZero = lumaMM < 0.0; +/*--------------------------------------------------------------------------*/ + lumaEndN -= lumaNN * 0.5; + lumaEndP -= lumaNN * 0.5; + FxaaBool doneN = abs(lumaEndN) >= gradientScaled; + FxaaBool doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; + FxaaBool doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; +/*--------------------------------------------------------------------------*/ + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 3) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 4) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 5) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 6) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 7) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 8) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 9) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 10) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 11) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 12) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } +/*--------------------------------------------------------------------------*/ + FxaaFloat dstN = posM.x - posN.x; + FxaaFloat dstP = posP.x - posM.x; + if(!horzSpan) dstN = posM.y - posN.y; + if(!horzSpan) dstP = posP.y - posM.y; +/*--------------------------------------------------------------------------*/ + FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero; + FxaaFloat spanLength = (dstP + dstN); + FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero; + FxaaFloat spanLengthRcp = 1.0/spanLength; +/*--------------------------------------------------------------------------*/ + FxaaBool directionN = dstN < dstP; + FxaaFloat dst = min(dstN, dstP); + FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP; + FxaaFloat subpixG = subpixF * subpixF; + FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5; + FxaaFloat subpixH = subpixG * fxaaQualitySubpix; +/*--------------------------------------------------------------------------*/ + FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0; + FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH); + if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign; + if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign; + #if (FXAA_DISCARD == 1) + return FxaaTexTop(tex, posM); + #else + return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM); + #endif +} +/*==========================================================================*/ +#endif + + + + +/*============================================================================ + + FXAA3 CONSOLE - PC VERSION + +------------------------------------------------------------------------------ +Instead of using this on PC, I'd suggest just using FXAA Quality with + #define FXAA_QUALITY__PRESET 10 +Or + #define FXAA_QUALITY__PRESET 20 +Either are higher qualilty and almost as fast as this on modern PC GPUs. +============================================================================*/ +#if (FXAA_PC_CONSOLE == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy)); + FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw)); + FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy)); + FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw)); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy); + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat lumaM = rgbyM.w; + #else + FxaaFloat lumaM = rgbyM.y; + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw); + lumaNe += 1.0/384.0; + FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe); + FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw); + FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMinM = min(lumaMin, lumaM); + FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled); + FxaaFloat lumaMaxM = max(lumaMax, lumaM); + FxaaFloat dirSwMinusNe = lumaSw - lumaNe; + FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM; + FxaaFloat dirSeMinusNw = lumaSe - lumaNw; + if(lumaMaxSubMinM < lumaMaxScaledClamped) return rgbyM; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir; + dir.x = dirSwMinusNe + dirSeMinusNw; + dir.y = dirSwMinusNe - dirSeMinusNw; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir1 = normalize(dir.xy); + FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw); + FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness; + FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * fxaaConsoleRcpFrameOpt2.zw); + FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * fxaaConsoleRcpFrameOpt2.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyA = rgbyN1 + rgbyP1; + FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25); +/*--------------------------------------------------------------------------*/ + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaBool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax); + #else + FxaaBool twoTap = (rgbyB.y < lumaMin) || (rgbyB.y > lumaMax); + #endif + if(twoTap) rgbyB.xyz = rgbyA.xyz * 0.5; + return rgbyB; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - 360 PIXEL SHADER + +------------------------------------------------------------------------------ +This optimized version thanks to suggestions from Andy Luedke. +Should be fully tex bound in all cases. +As of the FXAA 3.11 release, I have still not tested this code, +however I fixed a bug which was in both FXAA 3.9 and FXAA 3.10. +And note this is replacing the old unoptimized version. +If it does not work, please let me know so I can fix it. +============================================================================*/ +#if (FXAA_360 == 1) +/*--------------------------------------------------------------------------*/ +[reduceTempRegUsage(4)] +float4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + float4 lumaNwNeSwSe; + #if (FXAA_GREEN_AS_LUMA == 0) + asm { + tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #else + asm { + tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___y, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #endif +/*--------------------------------------------------------------------------*/ + lumaNwNeSwSe.y += 1.0/384.0; + float2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float lumaMin = min(lumaMinTemp.x, lumaMinTemp.y); + float lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y); +/*--------------------------------------------------------------------------*/ + float4 rgbyM = tex2Dlod(tex, float4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + float lumaMinM = min(lumaMin, rgbyM.w); + float lumaMaxM = max(lumaMax, rgbyM.w); + #else + float lumaMinM = min(lumaMin, rgbyM.y); + float lumaMaxM = max(lumaMax, rgbyM.y); + #endif + if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM; +/*--------------------------------------------------------------------------*/ + float2 dir; + dir.x = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.yyxx); + dir.y = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.xyxy); + dir = normalize(dir); +/*--------------------------------------------------------------------------*/ + float4 dir1 = dir.xyxy * fxaaConsoleRcpFrameOpt.xyzw; +/*--------------------------------------------------------------------------*/ + float4 dir2; + float dirAbsMinTimesC = min(abs(dir.x), abs(dir.y)) * fxaaConsoleEdgeSharpness; + dir2 = saturate(fxaaConsole360ConstDir.zzww * dir.xyxy / dirAbsMinTimesC + 0.5); + dir2 = dir2 * fxaaConsole360RcpFrameOpt2.xyxy + fxaaConsole360RcpFrameOpt2.zwzw; +/*--------------------------------------------------------------------------*/ + float4 rgbyN1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.xy, 0.0, 0.0)); + float4 rgbyP1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.zw, 0.0, 0.0)); + float4 rgbyN2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.xy, 0.0, 0.0)); + float4 rgbyP2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.zw, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ + float4 rgbyA = rgbyN1 + rgbyP1; + float4 rgbyB = rgbyN2 + rgbyP2 + rgbyA * 0.5; +/*--------------------------------------------------------------------------*/ + float4 rgbyR = ((FxaaLuma(rgbyB) - lumaMax) > 0.0) ? rgbyA : rgbyB; + rgbyR = ((FxaaLuma(rgbyB) - lumaMin) > 0.0) ? rgbyR : rgbyA; + return rgbyR; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT) + +============================================================================== +The code below does not exactly match the assembly. +I have a feeling that 12 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h0.w(TRUE), v5.xwxx, #0 + 6: addh h0.z(TRUE), -h2, h0.w + 7: texpkb h1.w(TRUE), v5, #0 + 9: addh h0.x(TRUE), h0.z, -h1.w + 10: addh h3.w(TRUE), h0.z, h1 + 11: texpkb h2.w(TRUE), v5.zwzz, #0 + 13: addh h0.z(TRUE), h3.w, -h2.w + 14: addh h0.x(TRUE), h2.w, h0 + 15: nrmh h1.xz(TRUE), h0_n + 16: minh_m8 h0.x(TRUE), |h1|, |h1.z| + 17: maxh h4.w(TRUE), h0, h1 + 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n + 19: movr r1.zw(TRUE), v4.xxxy + 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww + 22: minh h5.w(TRUE), h0, h1 + 23: texpkb h0(TRUE), r2.xzxx, #0 + 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1 + 27: maxh h4.x(TRUE), h2.z, h2.w + 28: texpkb h1(TRUE), r0.zwzz, #0 + 30: addh_d2 h1(TRUE), h0, h1 + 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 33: texpkb h0(TRUE), r0, #0 + 35: minh h4.z(TRUE), h2, h2.w + 36: fenct TRUE + 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 39: texpkb h2(TRUE), r1, #0 + 41: addh_d2 h0(TRUE), h0, h2 + 42: maxh h2.w(TRUE), h4, h4.x + 43: minh h2.x(TRUE), h5.w, h4.z + 44: addh_d2 h0(TRUE), h0, h1 + 45: slth h2.x(TRUE), h0.w, h2 + 46: sgth h2.w(TRUE), h0, h2 + 47: movh h0(TRUE), h0 + 48: addx.c0 rc(TRUE), h2, h2.w + 49: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB1 | add | 2: ADDh h2.z, h0.--w-, const.--x-; + | | | + 2 | SCT0/1 | mov | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB1 | add | 6: ADDh h0.z,-h2, h0.--w-; + | | | + 3 | SCT0/1 | mov | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 9: ADDh h0.x, h0.z---,-h1.w---; + | SCB1 | add | 10: ADDh h3.w, h0.---z, h1; + | | | + 4 | SCT0/1 | mov | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h2.w---, h0; + | SCB1 | add | 13: ADDh h0.z, h3.--w-,-h2.--w-; + | | | + 5 | SCT1 | mov | 15: NRMh h1.xz, h0; + | SRB | nrm | 15: NRMh h1.xz, h0; + | SCB0 | min | 16: MINh*8 h0.x, |h1|, |h1.z---|; + | SCB1 | max | 17: MAXh h4.w, h0, h1; + | | | + 6 | SCT0 | div | 18: DIVx h2.xy, h1.xz--, h0; + | SCT1 | mov | 19: MOVr r1.zw, g[TEX0].--xy; + | SCB0 | mad | 20: MADr r2.xz,-h1, const.z-w-, r1.z-w-; + | SCB1 | min | 22: MINh h5.w, h0, h1; + | | | + 7 | SCT0/1 | mov | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | TEX | txl | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | SCB0 | max | 27: MAXh h4.x, h2.z---, h2.w---; + | SCB1 | mad | 25: MADr r0.zw, h1.--xz, const, r1; + | | | + 8 | SCT0/1 | mov | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | TEX | txl | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | SCB0/1 | add | 30: ADDh/2 h1, h0, h1; + | | | + 9 | SCT0 | mad | 31: MADr r0.xy,-h2, const.xy--, r1.zw--; + | SCT1 | mov | 33: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 33: TXLr h0, r0, const.zzzz, TEX0; + | SCB1 | min | 35: MINh h4.z, h2, h2.--w-; + | | | + 10 | SCT0 | mad | 37: MADr r1.xy, h2, const.xy--, r1.zw--; + | SCT1 | mov | 39: TXLr h2, r1, const.zzzz, TEX0; + | TEX | txl | 39: TXLr h2, r1, const.zzzz, TEX0; + | SCB0/1 | add | 41: ADDh/2 h0, h0, h2; + | | | + 11 | SCT0 | min | 43: MINh h2.x, h5.w---, h4.z---; + | SCT1 | max | 42: MAXh h2.w, h4, h4.---x; + | SCB0/1 | add | 44: ADDh/2 h0, h0, h1; + | | | + 12 | SCT0 | set | 45: SLTh h2.x, h0.w---, h2; + | SCT1 | set | 46: SGTh h2.w, h0, h2; + | SCB0/1 | mul | 47: MOVh h0, h0; + | | | + 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---; + | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1; + +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 0% 0% 50% + 6: 100% 0% 75% + 7: 0% 100% 75% + 8: 0% 100% 100% + 9: 0% 100% 25% + 10: 0% 100% 100% + 11: 50% 0% 100% + 12: 50% 0% 100% + 13: 25% 0% 100% + +MEAN: 17% 61% 67% + +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 0% 100% + 2: 0% 0% 100% 0% 100% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 0% 0% 0% 100% 100% + 6: 100% 100% 0% 100% 100% + 7: 0% 0% 100% 100% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 0% 100% + 10: 0% 0% 100% 100% 100% + 11: 100% 100% 0% 100% 100% + 12: 100% 100% 0% 100% 100% + 13: 100% 0% 0% 100% 100% + +MEAN: 30% 23% 61% 76% 100% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 13 cycles, 3 r regs, 923,076,923 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O3 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 dir; + half4 lumaNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + lumaNe.w += half(1.0/512.0); + dir.x = -lumaNe.w; + dir.z = -lumaNe.w; + #else + lumaNe.y += half(1.0/512.0); + dir.x = -lumaNe.y; + dir.z = -lumaNe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSw.w; + dir.z += lumaSw.w; + #else + dir.x += lumaSw.y; + dir.z += lumaSw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x -= lumaNw.w; + dir.z += lumaNw.w; + #else + dir.x -= lumaNw.y; + dir.z += lumaNw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSe.w; + dir.z -= lumaSe.w; + #else + dir.x += lumaSe.y; + dir.z -= lumaSe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half4 dir1_pos; + dir1_pos.xy = normalize(dir.xyz).xz; + half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (7) + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (8) + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (9) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (11) + // compilier moves these scalar ops up to other cycles + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w)); + half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w)); + #else + half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y)); + half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y)); + #endif + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (12) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif +/*--------------------------------------------------------------------------*/ +// (13) + if(twoTapLt || twoTapGt) rgby2 = rgby1; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT) + +============================================================================== +The code mostly matches the assembly. +I have a feeling that 14 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +Use of FXAA_GREEN_AS_LUMA currently adds a cycle (16 clks). +Will look at fixing this for FXAA 3.12. +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h1.w(TRUE), v5.xwxx, #0 + 6: addh h0.x(TRUE), h1.w, -h2.y + 7: texpkb h2.w(TRUE), v5.zwzz, #0 + 9: minh h4.w(TRUE), h2.y, h2 + 10: maxh h5.x(TRUE), h2.y, h2.w + 11: texpkb h0.w(TRUE), v5, #0 + 13: addh h3.w(TRUE), -h0, h0.x + 14: addh h0.x(TRUE), h0.w, h0 + 15: addh h0.z(TRUE), -h2.w, h0.x + 16: addh h0.x(TRUE), h2.w, h3.w + 17: minh h5.y(TRUE), h0.w, h1.w + 18: nrmh h2.xz(TRUE), h0_n + 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z| + 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w + 21: movr r1.zw(TRUE), v4.xxxy + 22: maxh h2.w(TRUE), h0, h1 + 23: fenct TRUE + 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 26: texpkb h0(TRUE), r0, #0 + 28: maxh h5.x(TRUE), h2.w, h5 + 29: minh h5.w(TRUE), h5.y, h4 + 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 32: texpkb h2(TRUE), r1, #0 + 34: addh_d2 h2(TRUE), h0, h2 + 35: texpkb h1(TRUE), v4, #0 + 37: maxh h5.y(TRUE), h5.x, h1.w + 38: minh h4.w(TRUE), h1, h5 + 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 41: texpkb h0(TRUE), r0, #0 + 43: addh_m8 h5.z(TRUE), h5.y, -h4.w + 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 46: texpkb h3(TRUE), r2, #0 + 48: addh_d2 h0(TRUE), h0, h3 + 49: addh_d2 h3(TRUE), h0, h2 + 50: movh h0(TRUE), h3 + 51: slth h3.x(TRUE), h3.w, h5.w + 52: sgth h3.w(TRUE), h3, h5.x + 53: addx.c0 rc(TRUE), h3.x, h3 + 54: slth.c0 rc(TRUE), h5.z, h5 + 55: movh h0(c0.NE.w), h2 + 56: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB0 | add | 2: ADDh h2.y, h0.-w--, const.-x--; + | | | + 2 | SCT0/1 | mov | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB0 | add | 6: ADDh h0.x, h1.w---,-h2.y---; + | | | + 3 | SCT0/1 | mov | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | max | 10: MAXh h5.x, h2.y---, h2.w---; + | SCB1 | min | 9: MINh h4.w, h2.---y, h2; + | | | + 4 | SCT0/1 | mov | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h0.w---, h0; + | SCB1 | add | 13: ADDh h3.w,-h0, h0.---x; + | | | + 5 | SCT0 | mad | 16: ADDh h0.x, h2.w---, h3.w---; + | SCT1 | mad | 15: ADDh h0.z,-h2.--w-, h0.--x-; + | SCB0 | min | 17: MINh h5.y, h0.-w--, h1.-w--; + | | | + 6 | SCT1 | mov | 18: NRMh h2.xz, h0; + | SRB | nrm | 18: NRMh h2.xz, h0; + | SCB1 | min | 19: MINh*8 h2.w, |h2.---x|, |h2.---z|; + | | | + 7 | SCT0 | div | 20: DIVx h4.xy, h2.xz--, h2.ww--; + | SCT1 | mov | 21: MOVr r1.zw, g[TEX0].--xy; + | SCB1 | max | 22: MAXh h2.w, h0, h1; + | | | + 8 | SCT0 | mad | 24: MADr r0.xy,-h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 26: TXLr h0, r0, const.xxxx, TEX0; + | TEX | txl | 26: TXLr h0, r0, const.xxxx, TEX0; + | SCB0 | max | 28: MAXh h5.x, h2.w---, h5; + | SCB1 | min | 29: MINh h5.w, h5.---y, h4; + | | | + 9 | SCT0 | mad | 30: MADr r1.xy, h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 32: TXLr h2, r1, const.xxxx, TEX0; + | TEX | txl | 32: TXLr h2, r1, const.xxxx, TEX0; + | SCB0/1 | add | 34: ADDh/2 h2, h0, h2; + | | | + 10 | SCT0/1 | mov | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | TEX | txl | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | SCB0 | max | 37: MAXh h5.y, h5.-x--, h1.-w--; + | SCB1 | min | 38: MINh h4.w, h1, h5; + | | | + 11 | SCT0 | mad | 39: MADr r0.xy,-h4, const.xy--, r1.zw--; + | SCT1 | mov | 41: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 41: TXLr h0, r0, const.zzzz, TEX0; + | SCB0 | mad | 44: MADr r2.xy, h4, const.xy--, r1.zw--; + | SCB1 | add | 43: ADDh*8 h5.z, h5.--y-,-h4.--w-; + | | | + 12 | SCT0/1 | mov | 46: TXLr h3, r2, const.xxxx, TEX0; + | TEX | txl | 46: TXLr h3, r2, const.xxxx, TEX0; + | SCB0/1 | add | 48: ADDh/2 h0, h0, h3; + | | | + 13 | SCT0/1 | mad | 49: ADDh/2 h3, h0, h2; + | SCB0/1 | mul | 50: MOVh h0, h3; + | | | + 14 | SCT0 | set | 51: SLTh h3.x, h3.w---, h5.w---; + | SCT1 | set | 52: SGTh h3.w, h3, h5.---x; + | SCB0 | set | 54: SLThc0 rc, h5.z---, h5; + | SCB1 | add | 53: ADDxc0_s rc, h3.---x, h3; + | | | + 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2; + | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1; + +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 50% 0% 25% + 6: 0% 0% 25% + 7: 100% 0% 25% + 8: 0% 100% 50% + 9: 0% 100% 100% + 10: 0% 100% 50% + 11: 0% 100% 75% + 12: 0% 100% 100% + 13: 100% 0% 100% + 14: 50% 0% 50% + 15: 100% 0% 100% + +MEAN: 26% 60% 56% + +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 100% 0% + 2: 0% 0% 100% 100% 0% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 100% 100% 0% 100% 0% + 6: 0% 0% 0% 0% 100% + 7: 100% 100% 0% 0% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 100% 100% + 10: 0% 0% 100% 100% 100% + 11: 0% 0% 100% 100% 100% + 12: 0% 0% 100% 100% 100% + 13: 100% 100% 0% 100% 100% + 14: 100% 100% 0% 100% 100% + 15: 100% 100% 0% 100% 100% + +MEAN: 33% 33% 60% 86% 80% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 15 cycles, 3 r regs, 800,000,000 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O2 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 rgbyNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaNe = rgbyNe.w + half(1.0/512.0); + #else + half lumaNe = rgbyNe.y + half(1.0/512.0); + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaSwNegNe = lumaSw.w - lumaNe; + #else + half lumaSwNegNe = lumaSw.y - lumaNe; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNwSw = max(lumaNw.w, lumaSw.w); + half lumaMinNwSw = min(lumaNw.w, lumaSw.w); + #else + half lumaMaxNwSw = max(lumaNw.y, lumaSw.y); + half lumaMinNwSw = min(lumaNw.y, lumaSw.y); + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half dirZ = lumaNw.w + lumaSwNegNe; + half dirX = -lumaNw.w + lumaSwNegNe; + #else + half dirZ = lumaNw.y + lumaSwNegNe; + half dirX = -lumaNw.y + lumaSwNegNe; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half3 dir; + dir.y = 0.0; + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x = lumaSe.w + dirX; + dir.z = -lumaSe.w + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.w); + #else + dir.x = lumaSe.y + dirX; + dir.z = -lumaSe.y + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir1_pos; + dir1_pos.xy = normalize(dir).xz; + half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (7) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNeSe = max(lumaNe, lumaSe.w); + #else + half lumaMaxNeSe = max(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (8) + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe); + half lumaMin = min(lumaMinNwSw, lumaMinNeSe); +/*--------------------------------------------------------------------------*/ +// (9) + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxM = max(lumaMax, rgbyM.w); + half lumaMinM = min(lumaMin, rgbyM.w); + #else + half lumaMaxM = max(lumaMax, rgbyM.y); + half lumaMinM = min(lumaMin, rgbyM.y); + #endif +/*--------------------------------------------------------------------------*/ +// (11) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD; +/*--------------------------------------------------------------------------*/ +// (12) + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (13) + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (14) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif + bool earlyExit = lumaRangeM < lumaMax; + bool twoTap = twoTapLt || twoTapGt; +/*--------------------------------------------------------------------------*/ +// (15) + if(twoTap) rgby2 = rgby1; + if(earlyExit) rgby2 = rgbyM; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaP.hlsl new file mode 100644 index 000000000..269bfea67 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaP.hlsl @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +#define FXAA_PC 1 +#if (TORQUE_SM <= 30) +#define FXAA_HLSL_3 1 +#elif TORQUE_SM < 49 +#define FXAA_HLSL_4 1 +#elif TORQUE_SM >=50 +#define FXAA_HLSL_5 1 +#endif +#define FXAA_QUALITY__PRESET 12 +#define FXAA_GREEN_AS_LUMA 1 + +#include "Fxaa3_11.h" + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(colorTex, 0); + +uniform float2 oneOverTargetSize; + + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ +#if (TORQUE_SM >= 10 && TORQUE_SM <=30) + FxaaTex tex = colorTex; +#elif TORQUE_SM >=40 + FxaaTex tex; + tex.smpl = colorTex; + tex.tex = texture_colorTex; +#endif + + return FxaaPixelShader( + + IN.uv0, // vertex position + + 0, // Unused... console stuff + + tex, // The color back buffer + + tex, // Used for 360 optimization + + tex, // Used for 360 optimization + + oneOverTargetSize, + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + 0.75, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + 0.166, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + 0, + + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // there are only three safe values here: 2 and 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + 8, + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + 0 // Unused... console stuff + + ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaV.hlsl new file mode 100644 index 000000000..f2974c587 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaV.hlsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../../torque.hlsl" +#include "./../postFx.hlsl" + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; +}; + +uniform float4 rtParams0; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaP.glsl new file mode 100644 index 000000000..19d76ef42 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaP.glsl @@ -0,0 +1,125 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define FXAA_PC 1 +#define FXAA_GLSL_130 1 +#define FXAA_QUALITY__PRESET 12 +#define FXAA_GREEN_AS_LUMA 1 + +#include "../Fxaa3_11.h" +#include "../../../gl/hlslCompat.glsl" + +uniform sampler2D colorTex ; +uniform vec2 oneOverTargetSize; + +in vec4 hpos; +in vec2 uv0; + +out vec4 OUT_col; + +void main() +{ + OUT_col = FxaaPixelShader( + + uv0, // vertex position + + vec4(0), // Unused... console stuff + + colorTex, // The color back buffer + + colorTex, // Used for 360 optimization + + colorTex, // Used for 360 optimization + + oneOverTargetSize, + + vec4(0), // Unused... console stuff + + vec4(0), // Unused... console stuff + + vec4(0), // Unused... console stuff + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + 0.75, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + 0.166, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + 0, + + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // there are only three safe values here: 2 and 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + 8, + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + vec4(0) // Unused... console stuff + + ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaV.glsl new file mode 100644 index 000000000..55d445d91 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaV.glsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform vec4 rtParams0; + +out vec4 hpos; +out vec2 uv0; + +void main() +{ + gl_Position = vPosition; + hpos = gl_Position; + uv0 = viewportCoordToRenderTarget( vTexCoord0, rtParams0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gammaP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gammaP.hlsl new file mode 100644 index 000000000..1e13d068b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gammaP.hlsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shadergen:/autogenConditioners.h" +#include "./postFx.hlsl" +#include "../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +TORQUE_UNIFORM_SAMPLER1D(colorCorrectionTex, 1); + +uniform float OneOverGamma; +uniform float Brightness; +uniform float Contrast; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 color = TORQUE_TEX2D(backBuffer, IN.uv0.xy); + + // Apply the color correction. + color.r = TORQUE_TEX1D( colorCorrectionTex, color.r ).r; + color.g = TORQUE_TEX1D( colorCorrectionTex, color.g ).g; + color.b = TORQUE_TEX1D( colorCorrectionTex, color.b ).b; + + // Apply contrast + color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f; + + // Apply brightness + color.rgb += Brightness; + + return color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/VolFogGlowP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/VolFogGlowP.glsl new file mode 100644 index 000000000..01b072dd9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/VolFogGlowP.glsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands +// http://www.richardsgamestudio.com/ +// +// If you find this code useful or you are feeling particularly generous I +// would ask that you please go to http://www.richardsgamestudio.com/ then +// choose Donations from the menu on the left side and make a donation to +// Richards Game Studio. It will be highly appreciated. +// +// The MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog Glow postFx pixel shader V1.00 + +uniform sampler2D diffuseMap; +uniform float strength; + +out vec4 OUT_col; + +in vec2 uv0; +in vec2 uv1; +in vec2 uv2; +in vec2 uv3; + +in vec2 uv4; +in vec2 uv5; +in vec2 uv6; +in vec2 uv7; + +void main() +{ + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * strength; + + OUT_col = vec4(0); + OUT_col += texture( diffuseMap, uv0 ) * kernel.x; + OUT_col += texture( diffuseMap, uv1 ) * kernel.y; + OUT_col += texture( diffuseMap, uv2 ) * kernel.z; + OUT_col += texture( diffuseMap, uv3 ) * kernel.w; + + OUT_col += texture( diffuseMap, uv4 ) * kernel.x; + OUT_col += texture( diffuseMap, uv5 ) * kernel.y; + OUT_col += texture( diffuseMap, uv6 ) * kernel.z; + OUT_col += texture( diffuseMap, uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 ); + OUT_col.a = dot( OUT_col.rgb, rgb2lum ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/chromaticLens.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/chromaticLens.glsl new file mode 100644 index 000000000..fdb85ba00 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/chromaticLens.glsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier +// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader + +#include "./postFX.glsl" +#include "../../gl/torque.glsl" +#include "../../gl/hlslCompat.glsl" + +uniform sampler2D backBuffer; +uniform float distCoeff; +uniform float cubeDistort; +uniform vec3 colorDistort; + +out vec4 OUT_col; + +void main() +{ + vec2 tex = IN_uv0; + + float f = 0; + float r2 = (tex.x - 0.5) * (tex.x - 0.5) + (tex.y - 0.5) * (tex.y - 0.5); + + // Only compute the cubic distortion if necessary. + if ( cubeDistort == 0.0 ) + f = 1 + r2 * distCoeff; + else + f = 1 + r2 * (distCoeff + cubeDistort * sqrt(r2)); + + // Distort each color channel seperately to get a chromatic distortion effect. + vec3 outColor; + vec3 distort = vec3(f) + colorDistort; + + for ( int i=0; i < 3; i++ ) + { + float x = distort[i] * ( tex.x - 0.5 ) + 0.5; + float y = distort[i] * ( tex.y - 0.5 ) + 0.5; + outColor[i] = tex2Dlod( backBuffer, vec4(x,y,0,0) )[i]; + } + + OUT_col = vec4( outColor.rgb, 1 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/flashP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/flashP.glsl new file mode 100644 index 000000000..fc5072e6d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/flashP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFX.glsl" +#include "../../gl/torque.glsl" +#include "../../gl/hlslCompat.glsl" + +uniform float damageFlash; +uniform float whiteOut; +uniform sampler2D backBuffer; + +out vec4 OUT_col; + +void main() +{ + vec4 color1 = texture(backBuffer, IN_uv0); + vec4 color2 = color1 * MUL_COLOR; + vec4 damage = mix(color1,color2,damageFlash); + OUT_col = mix(damage,WHITE_COLOR,whiteOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/fogP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/fogP.glsl new file mode 100644 index 000000000..c2fe32fe4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/fogP.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +#include "shadergen:/autogenConditioners.h" +#include "../../gl/torque.glsl" + +uniform sampler2D deferredTex ; +uniform vec3 eyePosWorld; +uniform vec4 fogColor; +uniform vec3 fogData; +uniform vec4 rtParams0; + +in vec2 uv0; +in vec3 wsEyeRay; + +out vec4 OUT_col; + +void main() +{ + //vec2 deferredCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = deferredUncondition( deferredTex, uv0 ).w; + //return vec4( depth, 0, 0, 0.7 ); + + float factor = computeSceneFog( eyePosWorld, + eyePosWorld + ( wsEyeRay * depth ), + fogData.x, + fogData.y, + fogData.z ); + + OUT_col = hdrEncode( vec4( fogColor.rgb, 1.0 - saturate( factor ) ) ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/gammaP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/gammaP.glsl new file mode 100644 index 000000000..04533e494 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/gammaP.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D backBuffer; +uniform sampler1D colorCorrectionTex; + +uniform float OneOverGamma; +uniform float Brightness; +uniform float Contrast; + +in vec2 uv0; + +out vec4 OUT_col; + +void main() +{ + vec4 color = texture(backBuffer, uv0.xy); + + // Apply the color correction. + color.r = texture( colorCorrectionTex, color.r ).r; + color.g = texture( colorCorrectionTex, color.g ).g; + color.b = texture( colorCorrectionTex, color.b ).b; + + // Apply contrast + color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f; + + // Apply brightness + color.rgb += Brightness; + + OUT_col = color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurP.glsl new file mode 100644 index 000000000..9ebca32fa --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurP.glsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +uniform sampler2D diffuseMap ; + +in vec4 hpos; //POSITION; +in vec2 uv0; //TEXCOORD0; +in vec2 uv1; //TEXCOORD1; +in vec2 uv2; //TEXCOORD2; +in vec2 uv3; //TEXCOORD3; +in vec2 uv4; //TEXCOORD4; +in vec2 uv5; //TEXCOORD5; +in vec2 uv6; //TEXCOORD6; +in vec2 uv7; //TEXCOORD7; + +out vec4 OUT_col; + +void main() +{ + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f; + + OUT_col = vec4(0); + OUT_col += texture( diffuseMap, uv0 ) * kernel.x; + OUT_col += texture( diffuseMap, uv1 ) * kernel.y; + OUT_col += texture( diffuseMap, uv2 ) * kernel.z; + OUT_col += texture( diffuseMap, uv3 ) * kernel.w; + + OUT_col += texture( diffuseMap, uv4 ) * kernel.x; + OUT_col += texture( diffuseMap, uv5 ) * kernel.y; + OUT_col += texture( diffuseMap, uv6 ) * kernel.z; + OUT_col += texture( diffuseMap, uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 ); + OUT_col.a = dot( OUT_col.rgb, rgb2lum ); + +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurV.glsl new file mode 100644 index 000000000..70445d7fe --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurV.glsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform vec2 texSize0; + +out vec4 hpos; //POSITION; +out vec2 uv0; //TEXCOORD0; +out vec2 uv1; //TEXCOORD1; +out vec2 uv2; //TEXCOORD2; +out vec2 uv3; //TEXCOORD3; +out vec2 uv4; //TEXCOORD4; +out vec2 uv5; //TEXCOORD5; +out vec2 uv6; //TEXCOORD6; +out vec2 uv7; //TEXCOORD7; + +void main() +{ + gl_Position = vPosition; + hpos = gl_Position; + + vec2 uv = vTexCoord0 + (0.5f / texSize0); + + uv0 = uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + uv1 = uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + uv2 = uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + uv3 = uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + uv4 = uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + uv5 = uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + uv6 = uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + uv7 = uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/motionBlurP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/motionBlurP.glsl new file mode 100644 index 000000000..8077d4124 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/motionBlurP.glsl @@ -0,0 +1,78 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" +#include "shadergen:/autogenConditioners.h" +#include "postFX.glsl" + +#undef IN_uv0 +#define _IN_uv0 uv0 + +uniform mat4 matPrevScreenToWorld; +uniform mat4 matWorldToScreen; + +// Passed in from setShaderConsts() +uniform float velocityMultiplier; + +uniform sampler2D backBuffer; +uniform sampler2D deferredTex; + +out vec4 OUT_col; + +void main() +{ + vec2 IN_uv0 = _IN_uv0; + float samples = 5; + + // First get the deferred texture for uv channel 0 + vec4 deferred = deferredUncondition( deferredTex, IN_uv0 ); + + // Next extract the depth + float depth = deferred.a; + + // Create the screen position + vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1); + + // Calculate the world position + vec4 D = tMul(screenPos, matWorldToScreen); + vec4 worldPos = D / D.w; + + // Now calculate the previous screen position + vec4 previousPos = tMul( worldPos, matPrevScreenToWorld ); + previousPos /= previousPos.w; + + // Calculate the XY velocity + vec2 velocity = ((screenPos - previousPos) / velocityMultiplier).xy; + + // Generate the motion blur + vec4 color = texture(backBuffer, IN_uv0); + IN_uv0 += velocity; + + for(int i = 1; i 0 ) + { + rayStart.z -= ( startSide ); + //return vec4( 1, 0, 0, 1 ); + } + + vec3 hitPos; + vec3 ray = rayEnd - rayStart; + float rayLen = length( ray ); + vec3 rayDir = normalize( ray ); + + float endSide = dot( plane.xyz, rayEnd ) + plane.w; + float planeDist; + + if ( endSide < -0.005 ) + { + //return vec4( 0, 0, 1, 1 ); + hitPos = rayEnd; + planeDist = endSide; + } + else + { + //return vec4( 0, 0, 0, 0 ); + float den = dot( ray, plane.xyz ); + + // Parallal to the plane, return the endPnt. + //if ( den == 0.0f ) + // return endPnt; + + float dist = -( dot( plane.xyz, rayStart ) + plane.w ) / den; + if ( dist < 0.0 ) + dist = 0.0; + //return vec4( 1, 0, 0, 1 ); + //return vec4( ( dist ).rrr, 1 ); + + + hitPos = mix( rayStart, rayEnd, dist ); + + planeDist = dist; + } + + float delta = length( hitPos - rayStart ); + + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * ( delta - FOG_DENSITY_OFFSET ) ) ); + //return vec4( fogAmt.rrr, 1 ); + + // Calculate the water "base" color based on depth. + vec4 fogColor = waterColor * texture( waterDepthGradMap, saturate( delta / waterDepthGradMax ) ); + // Modulate baseColor by the ambientColor. + fogColor *= vec4( ambientColor.rgb, 1 ); + + vec3 inColor = hdrDecode( texture( backbuffer, IN_uv0 ).rgb ); + inColor.rgb *= 1.0 - saturate( abs( planeDist ) / WET_DEPTH ) * WET_DARKENING; + //return vec4( inColor, 1 ); + + vec3 outColor = mix( inColor, fogColor.rgb, fogAmt ); + + OUT_col = vec4( hdrEncode( outColor ), 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurP.hlsl new file mode 100644 index 000000000..80f8ed02d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurP.hlsl @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f; + + float4 OUT = 0; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv0 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv1 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv2 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv3 ) * kernel.w; + + OUT += TORQUE_TEX2D( diffuseMap, IN.uv4 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv5 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv6 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + float3 rgb2lum = float3( 0.30, 0.59, 0.11 ); + OUT.a = dot( OUT.rgb, rgb2lum ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurV.hlsl new file mode 100644 index 000000000..b8f5cf9c2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurV.hlsl @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "./../torque.hlsl" + + +uniform float2 texSize0; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + + float2 uv = IN.uv + (0.5f / texSize0); + + OUT.uv0 = uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv1 = uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv2 = uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv3 = uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + OUT.uv4 = uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv5 = uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv6 = uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv7 = uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurHP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurHP.hlsl new file mode 100644 index 000000000..77f4b9915 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurHP.hlsl @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +#define PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + + float tmp = ( 1.0f / sqrt( 2.0f * PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 color = { 0.0f, 0.0f, 0.0f, 0.0f }; + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = (float)i; + offset = (i - 4.0) * oneOverTargetSize.x; + x = (i - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (TORQUE_TEX2D( inputTex, IN.uv0 + float2( offset, 0.0f ) ) * weight ); + } + + return float4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurVP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurVP.hlsl new file mode 100644 index 000000000..8381f6a5d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurVP.hlsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +#define D3DX_PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + float tmp = ( 1.0f / sqrt( 2.0f * D3DX_PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 color = { 0.0f, 0.0f, 0.0f, 0.0f }; + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = (float)i; + offset = (fI - 4.0) * oneOverTargetSize.y; + x = (fI - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (TORQUE_TEX2D( inputTex, IN.uv0 + float2( 0.0f, offset ) ) * weight ); + } + + return float4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/brightPassFilterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/brightPassFilterP.hlsl new file mode 100644 index 000000000..9a8a93e97 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/brightPassFilterP.hlsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../torque.hlsl" + + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +TORQUE_UNIFORM_SAMPLER2D(luminanceTex, 1); +uniform float2 oneOverTargetSize; +uniform float brightPassThreshold; +uniform float g_fMiddleGray; + +static const float3 LUMINANCE_VECTOR = float3(0.3125f, 0.6154f, 0.0721f); + + +static float2 gTapOffsets[4] = +{ + { -0.5, 0.5 }, { 0.5, -0.5 }, + { -0.5, -0.5 }, { 0.5, 0.5 } +}; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 average = { 0.0f, 0.0f, 0.0f, 0.0f }; + + // Combine and average 4 samples from the source HDR texture. + for( int i = 0; i < 4; i++ ) + average += hdrDecode( TORQUE_TEX2D( inputTex, IN.uv0 + ( gTapOffsets[i] * oneOverTargetSize ) ) ); + average *= 0.25f; + + // Determine the brightness of this particular pixel. + float adaptedLum = TORQUE_TEX2D( luminanceTex, float2( 0.5f, 0.5f ) ).r; + float lum = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( average.rgb ); + //float lum = hdrLuminance( average.rgb ); + + // Determine whether this pixel passes the test... + if ( lum < brightPassThreshold ) + average = float4( 0.0f, 0.0f, 0.0f, 1.0f ); + + // Write the colour to the bright-pass render target + return hdrEncode( average ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/calculateAdaptedLumP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/calculateAdaptedLumP.hlsl new file mode 100644 index 000000000..0f895070a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/calculateAdaptedLumP.hlsl @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(currLum, 0); +TORQUE_UNIFORM_SAMPLER2D(lastAdaptedLum, 1); + +uniform float adaptRate; +uniform float deltaTime; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float fAdaptedLum = TORQUE_TEX2D( lastAdaptedLum, float2(0.5f, 0.5f) ).r; + float fCurrentLum = TORQUE_TEX2D( currLum, float2(0.5f, 0.5f) ).r; + + // The user's adapted luminance level is simulated by closing the gap between + // adapted luminance and current luminance by 2% every frame, based on a + // 30 fps rate. This is not an accurate model of human adaptation, which can + // take longer than half an hour. + float diff = fCurrentLum - fAdaptedLum; + float fNewAdaptation = fAdaptedLum + ( diff * ( 1.0 - exp( -deltaTime * adaptRate ) ) ); + + return float4( fNewAdaptation, 0.0, 0.0, 1.0f ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4P.hlsl new file mode 100644 index 000000000..01998af0b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4P.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "../../shdrConsts.h" +#include "../postFx.hlsl" + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +struct VertIn +{ + float4 hpos : TORQUE_POSITION; + float4 texCoords[8] : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +float4 main( VertIn IN) : TORQUE_TARGET0 +{ + // We calculate the texture coords + // in the vertex shader as an optimization. + float4 sample = 0.0f; + for ( int i = 0; i < 8; i++ ) + { + sample += TORQUE_TEX2D( inputTex, IN.texCoords[i].xy ); + sample += TORQUE_TEX2D( inputTex, IN.texCoords[i].zw ); + } + + return sample / 16; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4V.hlsl new file mode 100644 index 000000000..c9a34b7f4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4V.hlsl @@ -0,0 +1,138 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "../../shdrConsts.h" +#include "../postFx.hlsl" +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 texCoords[8] : TEXCOORD0; +}; + +uniform float2 targetSize; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Conn main( PFXVert In ) +{ + Conn Out; + + Out.hpos = float4(In.pos,1.0); + + // Sample from the 16 surrounding points. Since the center point will be in + // the exact center of 16 texels, a 0.5f offset is needed to specify a texel + // center. + float2 texSize = float2( 1.0 / (targetSize.x - 1.0), 1.0 / (targetSize.y - 1.0) ); + + float4 uv; + uv.xy = In.uv.xy; + uv.zw = In.uv.xy; + + Out.texCoords[0] = uv; + Out.texCoords[0].x += texSize.x; + Out.texCoords[0].y += texSize.y; + Out.texCoords[0].z += texSize.x; + Out.texCoords[0].w += texSize.y; + Out.texCoords[0].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[0].y += ( 0 - 1.5 ) * texSize.y; + Out.texCoords[0].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[0].w += ( 0 - 1.5 ) * texSize.y; + + Out.texCoords[1] = uv; + Out.texCoords[1].x += texSize.x; + Out.texCoords[1].y += texSize.y; + Out.texCoords[1].z += texSize.x; + Out.texCoords[1].w += texSize.y; + Out.texCoords[1].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[1].y += ( 0 - 1.5 ) * texSize.y; + Out.texCoords[1].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[1].w += ( 0 - 1.5 ) * texSize.y; + + Out.texCoords[2] = uv; + Out.texCoords[2].x += texSize.x; + Out.texCoords[2].y += texSize.y; + Out.texCoords[2].z += texSize.x; + Out.texCoords[2].w += texSize.y; + Out.texCoords[2].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[2].y += ( 1 - 1.5 ) * texSize.y; + Out.texCoords[2].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[2].w += ( 1 - 1.5 ) * texSize.y; + + Out.texCoords[3] = uv; + Out.texCoords[3].x += texSize.x; + Out.texCoords[3].y += texSize.y; + Out.texCoords[3].z += texSize.x; + Out.texCoords[3].w += texSize.y; + Out.texCoords[3].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[3].y += ( 1 - 1.5 ) * texSize.y; + Out.texCoords[3].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[3].w += ( 1 - 1.5 ) * texSize.y; + + Out.texCoords[4] = uv; + Out.texCoords[4].x += texSize.x; + Out.texCoords[4].y += texSize.y; + Out.texCoords[4].z += texSize.x; + Out.texCoords[4].w += texSize.y; + Out.texCoords[4].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[4].y += ( 2 - 1.5 ) * texSize.y; + Out.texCoords[4].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[4].w += ( 2 - 1.5 ) * texSize.y; + + Out.texCoords[5] = uv; + Out.texCoords[5].x += texSize.x; + Out.texCoords[5].y += texSize.y; + Out.texCoords[5].z += texSize.x; + Out.texCoords[5].w += texSize.y; + Out.texCoords[5].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[5].y += ( 2 - 1.5 ) * texSize.y; + Out.texCoords[5].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[5].w += ( 2 - 1.5 ) * texSize.y; + + Out.texCoords[6] = uv; + Out.texCoords[6].x += texSize.x; + Out.texCoords[6].y += texSize.y; + Out.texCoords[6].z += texSize.x; + Out.texCoords[6].w += texSize.y; + Out.texCoords[6].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[6].y += ( 3 - 1.5 ) * texSize.y; + Out.texCoords[6].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[6].w += ( 3 - 1.5 ) * texSize.y; + + Out.texCoords[7] = uv; + Out.texCoords[7].x += texSize.x; + Out.texCoords[7].y += texSize.y; + Out.texCoords[7].z += texSize.x; + Out.texCoords[7].w += texSize.y; + Out.texCoords[7].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[7].y += ( 3 - 1.5 ) * texSize.y; + Out.texCoords[7].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[7].w += ( 3 - 1.5 ) * texSize.y; + + return Out; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/finalPassCombineP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/finalPassCombineP.hlsl new file mode 100644 index 000000000..07f7276c3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/finalPassCombineP.hlsl @@ -0,0 +1,92 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../torque.hlsl" +#include "../postFx.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(sceneTex, 0); +TORQUE_UNIFORM_SAMPLER2D(luminanceTex, 1); +TORQUE_UNIFORM_SAMPLER2D(bloomTex, 2); +TORQUE_UNIFORM_SAMPLER1D(colorCorrectionTex, 3); + +uniform float2 texSize0; +uniform float2 texSize2; + +uniform float g_fEnableToneMapping; +uniform float g_fMiddleGray; +uniform float g_fWhiteCutoff; +uniform float g_fEnableBlueShift; + +uniform float3 g_fBlueShiftColor; +uniform float g_fBloomScale; +uniform float g_fOneOverGamma; +uniform float Brightness; +uniform float Contrast; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 sample = hdrDecode( TORQUE_TEX2D( sceneTex, IN.uv0 ) ); + float adaptedLum = TORQUE_TEX2D( luminanceTex, float2( 0.5f, 0.5f ) ).r; + float4 bloom = TORQUE_TEX2D( bloomTex, IN.uv0 ); + + // For very low light conditions, the rods will dominate the perception + // of light, and therefore color will be desaturated and shifted + // towards blue. + if ( g_fEnableBlueShift > 0.0f ) + { + const float3 LUMINANCE_VECTOR = float3(0.2125f, 0.7154f, 0.0721f); + + // Define a linear blending from -1.5 to 2.6 (log scale) which + // determines the lerp amount for blue shift + float coef = 1.0f - ( adaptedLum + 1.5 ) / 4.1; + coef = saturate( coef * g_fEnableBlueShift ); + + // Lerp between current color and blue, desaturated copy + float3 rodColor = dot( sample.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + sample.rgb = lerp( sample.rgb, rodColor, coef ); + + rodColor = dot( bloom.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + bloom.rgb = lerp( bloom.rgb, rodColor, coef ); + } + + // Add the bloom effect. + sample += g_fBloomScale * bloom; + + // Map the high range of color values into a range appropriate for + // display, taking into account the user's adaptation level, + // white point, and selected value for for middle gray. + if ( g_fEnableToneMapping > 0.0f ) + { + float Lp = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( sample.rgb ); + //float toneScalar = ( Lp * ( 1.0 + ( Lp / ( g_fWhiteCutoff ) ) ) ) / ( 1.0 + Lp ); + float toneScalar = Lp; + sample.rgb = lerp( sample.rgb, sample.rgb * toneScalar, g_fEnableToneMapping ); + } + + // Apply the color correction. + sample.r = TORQUE_TEX1D( colorCorrectionTex, sample.r ).r; + sample.g = TORQUE_TEX1D( colorCorrectionTex, sample.g ).g; + sample.b = TORQUE_TEX1D( colorCorrectionTex, sample.b ).b; + + return sample; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl new file mode 100644 index 000000000..1d9a2df3e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex ; +uniform vec2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +out vec4 OUT_col; + +#define PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + + float tmp = ( 1.0f / sqrt( 2.0f * PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +void main() +{ + vec4 color = vec4( 0.0f, 0.0f, 0.0f, 0.0f ); + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = float(i); + offset = (i - 4.0) * oneOverTargetSize.x; + x = (i - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (texture( inputTex, IN_uv0 + vec2( offset, 0.0f ) ) * weight ); + } + + OUT_col = vec4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl new file mode 100644 index 000000000..68f34b164 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex ; +uniform vec2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +out vec4 OUT_col; + +#define D3DX_PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + float tmp = ( 1.0f / sqrt( 2.0f * D3DX_PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +void main() +{ + vec4 color = vec4( 0.0f, 0.0f, 0.0f, 0.0f ); + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = float(i); + offset = (fI - 4.0) * oneOverTargetSize.y; + x = (fI - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (texture( inputTex, IN_uv0 + vec2( 0.0f, offset ) ) * weight ); + } + + OUT_col = vec4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/brightPassFilterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/brightPassFilterP.glsl new file mode 100644 index 000000000..f220ca1e7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/brightPassFilterP.glsl @@ -0,0 +1,65 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex ; +uniform sampler2D luminanceTex ; +uniform vec2 oneOverTargetSize; +uniform float brightPassThreshold; +uniform float g_fMiddleGray; + +const vec3 LUMINANCE_VECTOR = vec3(0.3125f, 0.6154f, 0.0721f); + +out vec4 OUT_col; + + +const vec2 gTapOffsets[4] = vec2[] +( + vec2( -0.5, 0.5 ), vec2( 0.5, -0.5 ), + vec2( -0.5, -0.5 ), vec2( 0.5, 0.5 ) +); + +void main() +{ + vec4 average = vec4( 0.0f, 0.0f, 0.0f, 0.0f ); + + // Combine and average 4 samples from the source HDR texture. + for( int i = 0; i < 4; i++ ) + average += hdrDecode( texture( inputTex, IN_uv0 + ( gTapOffsets[i] * oneOverTargetSize ) ) ); + average *= 0.25f; + + // Determine the brightness of this particular pixel. + float adaptedLum = texture( luminanceTex, vec2( 0.5f, 0.5f ) ).r; + float lum = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( average.rgb ); + //float lum = hdrLuminance( average.rgb ); + + // Determine whether this pixel passes the test... + if ( lum < brightPassThreshold ) + average = vec4( 0.0f, 0.0f, 0.0f, 1.0f ); + + // Write the colour to the bright-pass render target + OUT_col = hdrEncode( average ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl new file mode 100644 index 000000000..96ee9d6df --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D currLum; +uniform sampler2D lastAdaptedLum; + +uniform float adaptRate; +uniform float deltaTime; + +out vec4 OUT_col; + +void main() +{ + float fAdaptedLum = texture( lastAdaptedLum, vec2(0.5f, 0.5f) ).r; + float fCurrentLum = texture( currLum, vec2(0.5f, 0.5f) ).r; + + // The user's adapted luminance level is simulated by closing the gap between + // adapted luminance and current luminance by 2% every frame, based on a + // 30 fps rate. This is not an accurate model of human adaptation, which can + // take longer than half an hour. + float diff = fCurrentLum - fAdaptedLum; + float fNewAdaptation = fAdaptedLum + ( diff * ( 1.0 - exp( -deltaTime * adaptRate ) ) ); + + OUT_col = vec4( fNewAdaptation, 0.0, 0.0, 1.0f ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4P.glsl new file mode 100644 index 000000000..131671760 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4P.glsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_GLSL +#include "../../../shdrConsts.h" +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec4 texCoords[8]; +#define IN_texCoords texCoords + +uniform sampler2D inputTex; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // We calculate the texture coords + // in the vertex shader as an optimization. + vec4 _sample = vec4(0.0f); + for ( int i = 0; i < 8; i++ ) + { + _sample += texture( inputTex, IN_texCoords[i].xy ); + _sample += texture( inputTex, IN_texCoords[i].zw ); + } + + OUT_col = _sample / 16; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4V.glsl new file mode 100644 index 000000000..51f1da896 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4V.glsl @@ -0,0 +1,141 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_GLSL +#include "../../../shdrConsts.h" +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define In_pos vPosition +#define In_uv vTexCoord0 + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- +out vec4 texCoords[8]; +#define Out_texCoords texCoords + +#define Out_hpos gl_Position + +uniform vec2 targetSize; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + Out_hpos = In_pos; + + // Sample from the 16 surrounding points. Since the center point will be in + // the exact center of 16 texels, a 0.5f offset is needed to specify a texel + // center. + vec2 texSize = vec2( 1.0 / (targetSize.x - 1.0), 1.0 / (targetSize.y - 1.0) ); + + vec4 uv; + uv.xy = In_uv.xy; + uv.zw = In_uv.xy; + + Out_texCoords[0] = uv; + Out_texCoords[0].x += texSize.x; + Out_texCoords[0].y += texSize.y; + Out_texCoords[0].z += texSize.x; + Out_texCoords[0].w += texSize.y; + Out_texCoords[0].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[0].y += ( 0 - 1.5 ) * texSize.y; + Out_texCoords[0].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[0].w += ( 0 - 1.5 ) * texSize.y; + + Out_texCoords[1] = uv; + Out_texCoords[1].x += texSize.x; + Out_texCoords[1].y += texSize.y; + Out_texCoords[1].z += texSize.x; + Out_texCoords[1].w += texSize.y; + Out_texCoords[1].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[1].y += ( 0 - 1.5 ) * texSize.y; + Out_texCoords[1].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[1].w += ( 0 - 1.5 ) * texSize.y; + + Out_texCoords[2] = uv; + Out_texCoords[2].x += texSize.x; + Out_texCoords[2].y += texSize.y; + Out_texCoords[2].z += texSize.x; + Out_texCoords[2].w += texSize.y; + Out_texCoords[2].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[2].y += ( 1 - 1.5 ) * texSize.y; + Out_texCoords[2].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[2].w += ( 1 - 1.5 ) * texSize.y; + + Out_texCoords[3] = uv; + Out_texCoords[3].x += texSize.x; + Out_texCoords[3].y += texSize.y; + Out_texCoords[3].z += texSize.x; + Out_texCoords[3].w += texSize.y; + Out_texCoords[3].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[3].y += ( 1 - 1.5 ) * texSize.y; + Out_texCoords[3].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[3].w += ( 1 - 1.5 ) * texSize.y; + + Out_texCoords[4] = uv; + Out_texCoords[4].x += texSize.x; + Out_texCoords[4].y += texSize.y; + Out_texCoords[4].z += texSize.x; + Out_texCoords[4].w += texSize.y; + Out_texCoords[4].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[4].y += ( 2 - 1.5 ) * texSize.y; + Out_texCoords[4].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[4].w += ( 2 - 1.5 ) * texSize.y; + + Out_texCoords[5] = uv; + Out_texCoords[5].x += texSize.x; + Out_texCoords[5].y += texSize.y; + Out_texCoords[5].z += texSize.x; + Out_texCoords[5].w += texSize.y; + Out_texCoords[5].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[5].y += ( 2 - 1.5 ) * texSize.y; + Out_texCoords[5].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[5].w += ( 2 - 1.5 ) * texSize.y; + + Out_texCoords[6] = uv; + Out_texCoords[6].x += texSize.x; + Out_texCoords[6].y += texSize.y; + Out_texCoords[6].z += texSize.x; + Out_texCoords[6].w += texSize.y; + Out_texCoords[6].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[6].y += ( 3 - 1.5 ) * texSize.y; + Out_texCoords[6].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[6].w += ( 3 - 1.5 ) * texSize.y; + + Out_texCoords[7] = uv; + Out_texCoords[7].x += texSize.x; + Out_texCoords[7].y += texSize.y; + Out_texCoords[7].z += texSize.x; + Out_texCoords[7].w += texSize.y; + Out_texCoords[7].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[7].y += ( 3 - 1.5 ) * texSize.y; + Out_texCoords[7].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[7].w += ( 3 - 1.5 ) * texSize.y; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/finalPassCombineP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/finalPassCombineP.glsl new file mode 100644 index 000000000..4b173d4d3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/finalPassCombineP.glsl @@ -0,0 +1,97 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D sceneTex; +uniform sampler2D luminanceTex; +uniform sampler2D bloomTex; +uniform sampler1D colorCorrectionTex; + +uniform vec2 texSize0; +uniform vec2 texSize2; + +uniform float g_fEnableToneMapping; +uniform float g_fMiddleGray; +uniform float g_fWhiteCutoff; + +uniform float g_fEnableBlueShift; +uniform vec3 g_fBlueShiftColor; + +uniform float g_fBloomScale; + +uniform float g_fOneOverGamma; +uniform float Brightness; +uniform float Contrast; + +out vec4 OUT_col; + +void main() +{ + vec4 _sample = hdrDecode( texture( sceneTex, IN_uv0 ) ); + float adaptedLum = texture( luminanceTex, vec2( 0.5f, 0.5f ) ).r; + vec4 bloom = texture( bloomTex, IN_uv0 ); + + // For very low light conditions, the rods will dominate the perception + // of light, and therefore color will be desaturated and shifted + // towards blue. + if ( g_fEnableBlueShift > 0.0f ) + { + const vec3 LUMINANCE_VECTOR = vec3(0.2125f, 0.7154f, 0.0721f); + + // Define a linear blending from -1.5 to 2.6 (log scale) which + // determines the mix amount for blue shift + float coef = 1.0f - ( adaptedLum + 1.5 ) / 4.1; + coef = saturate( coef * g_fEnableBlueShift ); + + // Lerp between current color and blue, desaturated copy + vec3 rodColor = dot( _sample.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + _sample.rgb = mix( _sample.rgb, rodColor, coef ); + + rodColor = dot( bloom.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + bloom.rgb = mix( bloom.rgb, rodColor, coef ); + } + + // Add the bloom effect. + _sample += g_fBloomScale * bloom; + + // Map the high range of color values into a range appropriate for + // display, taking into account the user's adaptation level, + // white point, and selected value for for middle gray. + if ( g_fEnableToneMapping > 0.0f ) + { + float Lp = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( _sample.rgb ); + //float toneScalar = ( Lp * ( 1.0 + ( Lp / ( g_fWhiteCutoff ) ) ) ) / ( 1.0 + Lp ); + float toneScalar = Lp; + _sample.rgb = mix( _sample.rgb, _sample.rgb * toneScalar, g_fEnableToneMapping ); + } + + // Apply the color correction. + _sample.r = texture( colorCorrectionTex, _sample.r ).r; + _sample.g = texture( colorCorrectionTex, _sample.g ).g; + _sample.b = texture( colorCorrectionTex, _sample.b ).b; + + OUT_col = _sample; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/luminanceVisP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/luminanceVisP.glsl new file mode 100644 index 000000000..ee9c28c87 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/luminanceVisP.glsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex; +uniform float brightPassThreshold; + +out vec4 OUT_col; + +void main() +{ + vec4 _sample = hdrDecode( texture( inputTex, IN_uv0 ) ); + + // Determine the brightness of this particular pixel. + float lum = hdrLuminance( _sample.rgb ); + + // Write the colour to the bright-pass render target + OUT_col = ( vec4( lum.rrr, 1 ) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumInitialP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumInitialP.glsl new file mode 100644 index 000000000..8a2b9b318 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumInitialP.glsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex; +uniform vec2 texSize0; + +uniform float g_fMinLuminace; + +out vec4 OUT_col; + +const vec2 gTapOffsets[9] = vec2[] +( + vec2( -1.0, -1.0 ), vec2( 0.0, -1.0 ), vec2( 1.0, -1.0 ), + vec2( -1.0, 0.0 ), vec2( 0.0, 0.0 ), vec2( 1.0, 0.0 ), + vec2( -1.0, 1.0 ), vec2( 0.0, 1.0 ), vec2( 1.0, 1.0 ) +); + + +void main() +{ + vec2 tsize = 1.0 / texSize0; + + vec3 _sample; + float average = 0.0; + + for ( int i = 0; i < 9; i++ ) + { + // Decode the hdr value. + _sample = hdrDecode( texture( inputTex, IN_uv0 + ( gTapOffsets[i] * tsize ) ).rgb ); + + // Get the luminance and add it to the average. + float lum = max( hdrLuminance( _sample ), g_fMinLuminace ); + average += log( lum ); + } + + average = exp( average / 9.0 ); + + OUT_col = vec4( average, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl new file mode 100644 index 000000000..2e800d612 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex; +uniform vec2 oneOverTargetSize; + +out vec4 OUT_col; + +const vec2 gTapOffsets[16] = vec2[] +( + vec2( -1.5, -1.5 ), vec2( -0.5, -1.5 ), vec2( 0.5, -1.5 ), vec2( 1.5, -1.5 ), + vec2( -1.5, -0.5 ), vec2( -0.5, -0.5 ), vec2( 0.5, -0.5 ), vec2( 1.5, -0.5 ), + vec2( -1.5, 0.5 ), vec2( -0.5, 0.5 ), vec2( 0.5, 0.5 ), vec2( 1.5, 0.5 ), + vec2( -1.5, 1.5 ), vec2( -0.5, 1.5 ), vec2( 0.5, 1.5 ), vec2( 1.5, 1.5 ) +); + +void main() +{ + vec2 pixelSize = oneOverTargetSize; + + float average = 0.0; + + for ( int i = 0; i < 16; i++ ) + { + float lum = texture( inputTex, IN_uv0 + ( gTapOffsets[i] * pixelSize ) ).r; + average += lum; + } + + OUT_col = vec4( average / 16.0, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/luminanceVisP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/luminanceVisP.hlsl new file mode 100644 index 000000000..505d1b825 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/luminanceVisP.hlsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../torque.hlsl" + + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float brightPassThreshold; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 sample = hdrDecode( TORQUE_TEX2D( inputTex, IN.uv0 ) ); + + // Determine the brightness of this particular pixel. + float lum = hdrLuminance( sample.rgb ); + + // Write the colour to the bright-pass render target + return ( float4( lum.rrr, 1 ) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumInitialP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumInitialP.hlsl new file mode 100644 index 000000000..2e23ece1f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumInitialP.hlsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../torque.hlsl" +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 texSize0; + +uniform float g_fMinLuminace; + +static float2 gTapOffsets[9] = +{ + { -1.0, -1.0 }, { 0.0, -1.0 }, { 1.0, -1.0 }, + { -1.0, 0.0 }, { 0.0, 0.0 }, { 1.0, 0.0 }, + { -1.0, 1.0 }, { 0.0, 1.0 }, { 1.0, 1.0 } +}; + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 tsize = 1.0 / texSize0; + + float3 sample; + float average = 0.0; + + for ( int i = 0; i < 9; i++ ) + { + // Decode the hdr value. + sample = hdrDecode( TORQUE_TEX2D( inputTex, IN.uv0 + ( gTapOffsets[i] * tsize ) ).rgb ); + + // Get the luminance and add it to the average. + float lum = max( hdrLuminance( sample ), g_fMinLuminace ); + average += log( lum ); + } + + average = exp( average / 9.0 ); + + return float4( average, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumIterativeP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumIterativeP.hlsl new file mode 100644 index 000000000..46ed6fc70 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumIterativeP.hlsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 oneOverTargetSize; + + +static float2 gTapOffsets[16] = +{ + { -1.5, -1.5 }, { -0.5, -1.5 }, { 0.5, -1.5 }, { 1.5, -1.5 }, + { -1.5, -0.5 }, { -0.5, -0.5 }, { 0.5, -0.5 }, { 1.5, -0.5 }, + { -1.5, 0.5 }, { -0.5, 0.5 }, { 0.5, 0.5 }, { 1.5, 0.5 }, + { -1.5, 1.5 }, { -0.5, 1.5 }, { 0.5, 1.5 }, { 1.5, 1.5 } +}; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 pixelSize = oneOverTargetSize; + + float average = 0.0; + + for ( int i = 0; i < 16; i++ ) + { + float lum = TORQUE_TEX2D( inputTex, IN.uv0 + ( gTapOffsets[i] * pixelSize ) ).r; + average += lum; + } + + return float4( average / 16.0, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl new file mode 100644 index 000000000..59f5f4bbf --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D backBuffer; // The original backbuffer. +uniform sampler2D deferredTex; // The pre-pass depth and normals. + +uniform float brightScalar; + +const vec3 LUMINANCE_VECTOR = vec3(0.3125f, 0.6154f, 0.0721f); + +out vec4 OUT_col; + +void main() +{ + vec4 col = vec4( 0, 0, 0, 1 ); + + // Get the depth at this pixel. + float depth = deferredUncondition( deferredTex, IN_uv0 ).w; + + // If the depth is equal to 1.0, read from the backbuffer + // and perform the exposure calculation on the result. + if ( depth >= 0.999 ) + { + col = texture( backBuffer, IN_uv0 ); + + //col = 1 - exp(-120000 * col); + col += dot( vec3(col), LUMINANCE_VECTOR ) + 0.0001f; + col *= brightScalar; + } + + OUT_col = col; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayP.glsl new file mode 100644 index 000000000..6d78f4eae --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayP.glsl @@ -0,0 +1,94 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +uniform sampler2D frameSampler; +uniform sampler2D backBuffer; + +uniform vec3 camForward; +uniform vec3 lightDirection; +uniform vec2 screenSunPos; +uniform vec2 oneOverTargetSize; +uniform int numSamples; +uniform float density; +uniform float weight; +uniform float decay; +uniform float exposure; + +out vec4 OUT_col; + +void main() +{ + vec4 texCoord = vec4( IN_uv0.xy, 0, 0 ); + + // Store initial sample. + half3 color = half3(texture( frameSampler, texCoord.xy ).rgb); + + // Store original bb color. + vec4 bbCol = texture( backBuffer, IN_uv1 ); + + // Set up illumination decay factor. + half illuminationDecay = 1.0; + + float amount = saturate( dot( -lightDirection, camForward ) ); + + int samples = int(numSamples * amount); + + if ( samples <= 0 ) + { + OUT_col = bbCol; + return; + } + + // Calculate vector from pixel to light source in screen space. + half2 deltaTexCoord = half2( texCoord.xy - screenSunPos ); + + // Divide by number of samples and scale by control factor. + deltaTexCoord *= 1.0 / half(samples * density); + + // Evaluate summation from Equation 3 NUM_SAMPLES iterations. + for ( int i = 0; i < samples; i++ ) + { + // Step sample location along ray. + texCoord.xy -= deltaTexCoord; + + // Retrieve sample at new location. + half3 sample_ = half3(tex2Dlod( frameSampler, texCoord )); + + // Apply sample attenuation scale/decay factors. + sample_ *= illuminationDecay * weight; + + // Accumulate combined color. + color += sample_; + + // Update exponential decay factor. + illuminationDecay *= decay; + } + + //return saturate( amount ) * color * Exposure; + //return bbCol * decay; + + // Output final color with a further scale control factor. + OUT_col = saturate( amount ) * vec4( color * exposure, 1 ) + bbCol; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayOccludeP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayOccludeP.hlsl new file mode 100644 index 000000000..5db6ecb5b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayOccludeP.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); + +uniform float brightScalar; + +static const float3 LUMINANCE_VECTOR = float3(0.3125f, 0.6154f, 0.0721f); + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 col = float4( 0, 0, 0, 1 ); + + // Get the depth at this pixel. + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + + // If the depth is equal to 1.0, read from the backbuffer + // and perform the exposure calculation on the result. + if ( depth >= 0.999 ) + { + col = TORQUE_TEX2D( backBuffer, IN.uv0 ); + + //col = 1 - exp(-120000 * col); + col += dot( col.rgb, LUMINANCE_VECTOR ) + 0.0001f; + col *= brightScalar; + } + + return col; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayP.hlsl new file mode 100644 index 000000000..032894710 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayP.hlsl @@ -0,0 +1,89 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(frameSampler, 0); +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 1); + + +uniform float3 camForward; +uniform int numSamples; +uniform float3 lightDirection; +uniform float density; +uniform float2 screenSunPos; +uniform float2 oneOverTargetSize; +uniform float weight; +uniform float decay; +uniform float exposure; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 texCoord = float4( IN.uv0.xy, 0, 0 ); + + // Store initial sample. + half3 color = (half3)TORQUE_TEX2D( frameSampler, texCoord.xy ).rgb; + + // Store original bb color. + float4 bbCol = TORQUE_TEX2D( backBuffer, IN.uv1 ); + + // Set up illumination decay factor. + half illuminationDecay = 1.0; + + float amount = saturate( dot( -lightDirection, camForward ) ); + + int samples = numSamples * amount; + + if ( samples <= 0 ) + return bbCol; + + // Calculate vector from pixel to light source in screen space. + half2 deltaTexCoord = (half2)( texCoord.xy - screenSunPos ); + + // Divide by number of samples and scale by control factor. + deltaTexCoord *= (half)(1.0 / samples * density); + + // Evaluate summation from Equation 3 NUM_SAMPLES iterations. + for ( int i = 0; i < samples; i++ ) + { + // Step sample location along ray. + texCoord.xy -= deltaTexCoord; + + // Retrieve sample at new location. + half3 sample = (half3)TORQUE_TEX2DLOD( frameSampler, texCoord ); + + // Apply sample attenuation scale/decay factors. + sample *= half(illuminationDecay * weight); + + // Accumulate combined color. + color += sample; + + // Update exponential decay factor. + illuminationDecay *= half(decay); + } + + //return saturate( amount ) * color * Exposure; + //return bbCol * decay; + + // Output final color with a further scale control factor. + return saturate( amount ) * float4( color * exposure, 1 ) + bbCol; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/blendWeightCalculationP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/blendWeightCalculationP.hlsl new file mode 100644 index 000000000..2c4777c36 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/blendWeightCalculationP.hlsl @@ -0,0 +1,78 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform sampler2D edgesMap : register(S0); +uniform sampler2D edgesMapL : register(S1); +uniform sampler2D areaMap : register(S2); + +#include "./functions.hlsl" + + +float4 main(float2 texcoord : TEXCOORD0) : COLOR0 +{ + float4 areas = 0.0; + + float2 e = tex2D(edgesMap, texcoord).rg; + + [branch] + if (e.g) // Edge at north + { + // Search distances to the left and to the right: + float2 d = float2(SearchXLeft(texcoord), SearchXRight(texcoord)); + + // Now fetch the crossing edges. Instead of sampling between edgels, we + // sample at -0.25, to be able to discern what value has each edgel: + float4 coords = mad(float4(d.x, -0.25, d.y + 1.0, -0.25), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).r; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).r; + + // Ok, we know how this pattern looks like, now it is time for getting + // the actual area: + areas.rg = Area(abs(d), e1, e2); + } + + [branch] + if (e.r) // Edge at west + { + // Search distances to the top and to the bottom: + float2 d = float2(SearchYUp(texcoord), SearchYDown(texcoord)); + + // Now fetch the crossing edges (yet again): + float4 coords = mad(float4(-0.25, d.x, -0.25, d.y + 1.0), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).g; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).g; + + // Get the area for this direction: + areas.ba = Area(abs(d), e1, e2); + } + + return areas; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/edgeDetectionP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/edgeDetectionP.hlsl new file mode 100644 index 000000000..7d5c7f057 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/edgeDetectionP.hlsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D colorMapG : register(S0); +uniform sampler2D deferredMap : register(S1); + +uniform float3 lumaCoefficients; +uniform float threshold; +uniform float depthThreshold; + + +float4 main( float2 texcoord : TEXCOORD0, + float4 offset[2]: TEXCOORD1) : COLOR0 +{ + // Luma calculation requires gamma-corrected colors (texture 'colorMapG'). + // + // Note that there is a lot of overlapped luma calculations; performance + // can be improved if this luma calculation is performed in the main pass, + // which may give you an edge if used in conjunction with a z deferred. + + float L = dot(tex2D(colorMapG, texcoord).rgb, lumaCoefficients); + + float Lleft = dot(tex2D(colorMapG, offset[0].xy).rgb, lumaCoefficients); + float Ltop = dot(tex2D(colorMapG, offset[0].zw).rgb, lumaCoefficients); + float Lright = dot(tex2D(colorMapG, offset[1].xy).rgb, lumaCoefficients); + float Lbottom = dot(tex2D(colorMapG, offset[1].zw).rgb, lumaCoefficients); + + float4 delta = abs(L.xxxx - float4(Lleft, Ltop, Lright, Lbottom)); + float4 edges = step(threshold, delta); + + // Add depth edges to color edges + float D = deferredUncondition(deferredMap, texcoord).w; + float Dleft = deferredUncondition(deferredMap, offset[0].xy).w; + float Dtop = deferredUncondition(deferredMap, offset[0].zw).w; + float Dright = deferredUncondition(deferredMap, offset[1].xy).w; + float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w; + + delta = abs(D.xxxx - float4(Dleft, Dtop, Dright, Dbottom)); + edges += step(depthThreshold, delta); + + if (dot(edges, 1.0) == 0.0) + discard; + + return edges; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/functions.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/functions.hlsl new file mode 100644 index 000000000..9935a5e30 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/functions.hlsl @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform float2 texSize0; + +#if !defined(PIXEL_SIZE) +#define PIXEL_SIZE (1.0 / texSize0) +#define MAX_SEARCH_STEPS 8 +#define MAX_DISTANCE 33 +#endif + +// Typical Multiply-Add operation to ease translation to assembly code. + +float4 mad(float4 m, float4 a, float4 b) +{ + #if defined(XBOX) + float4 result; + asm { + mad result, m, a, b + }; + return result; + #else + return m * a + b; + #endif +} + + +// This one just returns the first level of a mip map chain, which allow us to +// avoid the nasty ddx/ddy warnings, even improving the performance a little +// bit. +float4 tex2Dlevel0(sampler2D map, float2 texcoord) +{ + return tex2Dlod(map, float4(texcoord, 0.0, 0.0)); +} + + +// Same as above, this eases translation to assembly code; +float4 tex2Doffset(sampler2D map, float2 texcoord, float2 offset) +{ + #if defined(XBOX) && MAX_SEARCH_STEPS < 6 + float4 result; + float x = offset.x; + float y = offset.y; + asm { + tfetch2D result, texcoord, map, OffsetX = x, OffsetY = y + }; + return result; + #else + return tex2Dlevel0(map, texcoord + PIXEL_SIZE * offset); + #endif +} + + +// Ok, we have the distance and both crossing edges, can you please return +// the float2 blending weights? +float2 Area(float2 distance, float e1, float e2) +{ + // * By dividing by areaSize - 1.0 below we are implicitely offsetting to + // always fall inside of a pixel + // * Rounding prevents bilinear access precision problems + float areaSize = MAX_DISTANCE * 5.0; + float2 pixcoord = MAX_DISTANCE * round(4.0 * float2(e1, e2)) + distance; + float2 texcoord = pixcoord / (areaSize - 1.0); + return tex2Dlevel0(areaMap, texcoord).rg; +} + + +// Search functions for the 2nd pass. +float SearchXLeft(float2 texcoord) +{ + // We compare with 0.9 to prevent bilinear access precision problems. + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0)).g; + [flatten] if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchXRight(float2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0)).g; + [flatten] if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYUp(float2 texcoord) +{ + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0).yx).r; + [flatten] if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYDown(float2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0).yx).r; + [flatten] if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl new file mode 100644 index 000000000..af01ce6f9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl @@ -0,0 +1,83 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec2 texcoord; + +uniform sampler2D edgesMap; +uniform sampler2D edgesMapL; +uniform sampler2D areaMap; + +out vec4 OUT_col; + +#include "./functions.glsl" + + +void main() +{ + vec4 areas = vec4(0.0); + + vec2 e = texture(edgesMap, texcoord).rg; + + //[branch] + if (bool(e.g)) // Edge at north + { + // Search distances to the left and to the right: + vec2 d = vec2(SearchXLeft(texcoord), SearchXRight(texcoord)); + + // Now fetch the crossing edges. Instead of sampling between edgels, we + // sample at -0.25, to be able to discern what value has each edgel: + vec4 coords = mad(vec4(d.x, -0.25, d.y + 1.0, -0.25), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).r; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).r; + + // Ok, we know how this pattern looks like, now it is time for getting + // the actual area: + areas.rg = Area(abs(d), e1, e2); + } + + //[branch] + if (bool(e.r)) // Edge at west + { + // Search distances to the top and to the bottom: + vec2 d = vec2(SearchYUp(texcoord), SearchYDown(texcoord)); + + // Now fetch the crossing edges (yet again): + vec4 coords = mad(vec4(-0.25, d.x, -0.25, d.y + 1.0), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).g; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).g; + + // Get the area for this direction: + areas.ba = Area(abs(d), e1, e2); + } + + OUT_col = areas; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/edgeDetectionP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/edgeDetectionP.glsl new file mode 100644 index 000000000..d964a28a4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/edgeDetectionP.glsl @@ -0,0 +1,76 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D colorMapG; +uniform sampler2D deferredMap; + +uniform vec3 lumaCoefficients; +uniform float threshold; +uniform float depthThreshold; + +in vec2 texcoord; +in vec4 offset[2]; + +out vec4 OUT_col; + +void main() +{ + // Luma calculation requires gamma-corrected colors (texture 'colorMapG'). + // + // Note that there is a lot of overlapped luma calculations; performance + // can be improved if this luma calculation is performed in the main pass, + // which may give you an edge if used in conjunction with a z deferred. + + float L = dot(texture(colorMapG, texcoord).rgb, lumaCoefficients); + + float Lleft = dot(texture(colorMapG, offset[0].xy).rgb, lumaCoefficients); + float Ltop = dot(texture(colorMapG, offset[0].zw).rgb, lumaCoefficients); + float Lright = dot(texture(colorMapG, offset[1].xy).rgb, lumaCoefficients); + float Lbottom = dot(texture(colorMapG, offset[1].zw).rgb, lumaCoefficients); + + vec4 delta = abs(vec4(L) - vec4(Lleft, Ltop, Lright, Lbottom)); + vec4 edges = step(threshold, delta); + + // Add depth edges to color edges + float D = deferredUncondition(deferredMap, texcoord).w; + float Dleft = deferredUncondition(deferredMap, offset[0].xy).w; + float Dtop = deferredUncondition(deferredMap, offset[0].zw).w; + float Dright = deferredUncondition(deferredMap, offset[1].xy).w; + float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w; + + delta = abs(vec4(D) - vec4(Dleft, Dtop, Dright, Dbottom)); + edges += step(depthThreshold, delta); + + if (dot(edges, vec4(1.0)) == 0.0) + discard; + + OUT_col = edges; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/functions.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/functions.glsl new file mode 100644 index 000000000..3ff56fb1a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/functions.glsl @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform vec2 texSize0; + +#if !defined(PIXEL_SIZE) +#define PIXEL_SIZE (1.0 / texSize0) +#define MAX_SEARCH_STEPS 8 +#define MAX_DISTANCE 33 +#endif + +// Typical Multiply-Add operation to ease translation to assembly code. + +vec4 mad(vec4 m, vec4 a, vec4 b) +{ + #if defined(XBOX) + vec4 result; + asm { + mad result, m, a, b + }; + return result; + #else + return m * a + b; + #endif +} + + +// This one just returns the first level of a mip map chain, which allow us to +// avoid the nasty ddx/ddy warnings, even improving the performance a little +// bit. +vec4 tex2Dlevel0(sampler2D map, vec2 texcoord) +{ + return tex2Dlod(map, vec4(texcoord, 0.0, 0.0)); +} + + +// Same as above, this eases translation to assembly code; +vec4 tex2Doffset(sampler2D map, vec2 texcoord, vec2 offset) +{ + #if defined(XBOX) && MAX_SEARCH_STEPS < 6 + vec4 result; + float x = offset.x; + float y = offset.y; + asm { + tfetch2D result, texcoord, map, OffsetX = x, OffsetY = y + }; + return result; + #else + return tex2Dlevel0(map, texcoord + PIXEL_SIZE * offset); + #endif +} + + +// Ok, we have the distance and both crossing edges, can you please return +// the vec2 blending weights? +vec2 Area(vec2 distance, float e1, float e2) +{ + // * By dividing by areaSize - 1.0 below we are implicitely offsetting to + // always fall inside of a pixel + // * Rounding prevents bilinear access precision problems + float areaSize = MAX_DISTANCE * 5.0; + vec2 pixcoord = MAX_DISTANCE * round(4.0 * vec2(e1, e2)) + distance; + vec2 texcoord = pixcoord / (areaSize - 1.0); + return tex2Dlevel0(areaMap, texcoord).rg; +} + + +// Search functions for the 2nd pass. +float SearchXLeft(vec2 texcoord) +{ + // We compare with 0.9 to prevent bilinear access precision problems. + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0)).g; + /*[flatten]*/ if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchXRight(vec2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0)).g; + /*[flatten]*/ if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYUp(vec2 texcoord) +{ + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0).yx).r; + /*[flatten]*/ if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYDown(vec2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0).yx).r; + /*[flatten]*/ if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl new file mode 100644 index 000000000..eddbcc47c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl @@ -0,0 +1,88 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec2 texcoord; +in vec4 offset[2]; + +uniform sampler2D blendMap; +uniform sampler2D colorMapL; +uniform sampler2D colorMap; + +// Dummy sampers to please include. +uniform sampler2D areaMap; +uniform sampler2D edgesMapL; +#include "./functions.glsl" + +out vec4 OUT_col; + +void main() +{ + // Fetch the blending weights for current pixel: + vec4 topLeft = texture(blendMap, texcoord); + float bottom = texture(blendMap, offset[1].zw).g; + float right = texture(blendMap, offset[1].xy).a; + vec4 a = vec4(topLeft.r, bottom, topLeft.b, right); + + // Up to 4 lines can be crossing a pixel (one in each edge). So, we perform + // a weighted average, where the weight of each line is 'a' cubed, which + // favors blending and works well in practice. + vec4 w = a * a * a; + + // There is some blending weight with a value greater than 0.0? + float sum = dot(w, vec4(1.0)); + if (sum < 1e-5) + discard; + + vec4 color = vec4(0.0); + + // Add the contributions of the possible 4 lines that can cross this pixel: + #ifdef BILINEAR_FILTER_TRICK + vec4 coords = mad(vec4( 0.0, -a.r, 0.0, a.g), PIXEL_SIZE.yyyy, texcoord.xyxy); + color = mad(texture(colorMapL, coords.xy), vec4(w.r), color); + color = mad(texture(colorMapL, coords.zw), vec4(w.g), color); + + coords = mad(vec4(-a.b, 0.0, a.a, 0.0), PIXEL_SIZE.xxxx, texcoord.xyxy); + color = mad(texture(colorMapL, coords.xy), vec4(w.b), color); + color = mad(texture(colorMapL, coords.zw), vec4(w.a), color); + #else + vec4 C = texture(colorMap, texcoord); + vec4 Cleft = texture(colorMap, offset[0].xy); + vec4 Ctop = texture(colorMap, offset[0].zw); + vec4 Cright = texture(colorMap, offset[1].xy); + vec4 Cbottom = texture(colorMap, offset[1].zw); + color = mad(mix(C, Ctop, a.r), vec4(w.r), color); + color = mad(mix(C, Cbottom, a.g), vec4(w.g), color); + color = mad(mix(C, Cleft, a.b), vec4(w.b), color); + color = mad(mix(C, Cright, a.a), vec4(w.a), color); + #endif + + // Normalize the resulting color and we are finished! + OUT_col = color / sum; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/offsetV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/offsetV.glsl new file mode 100644 index 000000000..53d927c29 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/offsetV.glsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_position vPosition +#define IN_texcoord vTexCoord0 + +#define OUT_position gl_Position +out vec2 texcoord; +#define OUT_texcoord texcoord +out vec4 offset[2]; +#define OUT_offset offset + +uniform vec2 texSize0; + +void main() +{ + OUT_position = IN_position; + vec2 PIXEL_SIZE = 1.0 / texSize0; + + OUT_texcoord = IN_texcoord; + OUT_texcoord.xy += PIXEL_SIZE * 0.5; + + OUT_offset[0] = OUT_texcoord.xyxy + PIXEL_SIZE.xyxy * vec4(-1.0, 0.0, 0.0, -1.0); + OUT_offset[1] = OUT_texcoord.xyxy + PIXEL_SIZE.xyxy * vec4( 1.0, 0.0, 0.0, 1.0); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/passthruV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/passthruV.glsl new file mode 100644 index 000000000..1aa64112c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/passthruV.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_position vPosition +#define IN_texcoord vTexCoord0 + +#define OUT_position gl_Position +out vec2 texcoord; +#define OUT_texcoord texcoord + +uniform vec2 texSize0; + +void main() +{ + OUT_position = IN_position; + vec2 PIXEL_SIZE = 1.0 / texSize0; + + OUT_texcoord = IN_texcoord; + texcoord.xy += PIXEL_SIZE * 0.5; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl new file mode 100644 index 000000000..aaaacafe2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl @@ -0,0 +1,84 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform sampler2D blendMap : register(S0); +uniform sampler2D colorMapL : register(S1); +uniform sampler2D colorMap : register(S2); + +// Dummy sampers to please include. +sampler2D areaMap; +sampler2D edgesMapL; +#include "./functions.hlsl" + + +float4 main( float2 texcoord : TEXCOORD0, + float4 offset[2]: TEXCOORD1 ) : COLOR0 +{ + // Fetch the blending weights for current pixel: + float4 topLeft = tex2D(blendMap, texcoord); + float bottom = tex2D(blendMap, offset[1].zw).g; + float right = tex2D(blendMap, offset[1].xy).a; + float4 a = float4(topLeft.r, bottom, topLeft.b, right); + + // Up to 4 lines can be crossing a pixel (one in each edge). So, we perform + // a weighted average, where the weight of each line is 'a' cubed, which + // favors blending and works well in practice. + float4 w = a * a * a; + + // There is some blending weight with a value greater than 0.0? + float sum = dot(w, 1.0); + if (sum < 1e-5) + discard; + + float4 color = 0.0; + + // Add the contributions of the possible 4 lines that can cross this pixel: + #ifdef BILINEAR_FILTER_TRICK + float4 coords = mad(float4( 0.0, -a.r, 0.0, a.g), PIXEL_SIZE.yyyy, texcoord.xyxy); + color = mad(tex2D(colorMapL, coords.xy), w.r, color); + color = mad(tex2D(colorMapL, coords.zw), w.g, color); + + coords = mad(float4(-a.b, 0.0, a.a, 0.0), PIXEL_SIZE.xxxx, texcoord.xyxy); + color = mad(tex2D(colorMapL, coords.xy), w.b, color); + color = mad(tex2D(colorMapL, coords.zw), w.a, color); + #else + float4 C = tex2D(colorMap, texcoord); + float4 Cleft = tex2D(colorMap, offset[0].xy); + float4 Ctop = tex2D(colorMap, offset[0].zw); + float4 Cright = tex2D(colorMap, offset[1].xy); + float4 Cbottom = tex2D(colorMap, offset[1].zw); + color = mad(lerp(C, Ctop, a.r), w.r, color); + color = mad(lerp(C, Cbottom, a.g), w.g, color); + color = mad(lerp(C, Cleft, a.b), w.b, color); + color = mad(lerp(C, Cright, a.a), w.a, color); + #endif + + // Normalize the resulting color and we are finished! + return color / sum; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/offsetV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/offsetV.hlsl new file mode 100644 index 000000000..d9c922afd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/offsetV.hlsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform float2 texSize0; + +void main( inout float4 position : POSITION0, + inout float2 texcoord : TEXCOORD0, + out float4 offset[2] : TEXCOORD1 ) +{ + float2 PIXEL_SIZE = 1.0 / texSize0; + + texcoord.xy += PIXEL_SIZE * 0.5; + + offset[0] = texcoord.xyxy + PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0); + offset[1] = texcoord.xyxy + PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0, 1.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/passthruV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/passthruV.hlsl new file mode 100644 index 000000000..24ef534fd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/passthruV.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform float2 texSize0; + +void main( inout float4 position : POSITION0, + inout float2 texcoord : TEXCOORD0) +{ + float2 PIXEL_SIZE = 1.0 / texSize0; + texcoord.xy += PIXEL_SIZE * 0.5; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/motionBlurP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/motionBlurP.hlsl new file mode 100644 index 000000000..90b8f6f25 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/motionBlurP.hlsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "../torque.hlsl" +#include "../shaderModelAutoGen.hlsl" + +uniform float4x4 matPrevScreenToWorld; +uniform float4x4 matWorldToScreen; + +// Passed in from setShaderConsts() +uniform float velocityMultiplier; +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float samples = 5; + + // First get the deferred texture for uv channel 0 + float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ); + + // Next extract the depth + float depth = deferred.a; + + // Create the screen position + float4 screenPos = float4(IN.uv0.x*2-1, IN.uv0.y*2-1, depth*2-1, 1); + + // Calculate the world position + float4 D = mul(screenPos, matWorldToScreen); + float4 worldPos = D / D.w; + + // Now calculate the previous screen position + float4 previousPos = mul( worldPos, matPrevScreenToWorld ); + previousPos /= previousPos.w; + + // Calculate the XY velocity + float2 velocity = ((screenPos - previousPos) / velocityMultiplier).xy; + + // Generate the motion blur + float4 color = TORQUE_TEX2D(backBuffer, IN.uv0); + IN.uv0 += velocity; + + for(int i = 1; i blurNormalTol ) + { + usedCount++; + total += weight; + occlusion += TORQUE_TEX2D( occludeMap, uv ).r * weight; + } + } +} + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + //float4 centerTap; + float4 centerTap = TORQUE_DEFERRED_UNCONDITION( deferredMap, IN.uv0.zw ); + + //return centerTap; + + //float centerOcclude = TORQUE_TEX2D( occludeMap, IN.uv0.zw ).r; + //return float4( centerOcclude.rrr, 1 ); + + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ); //25f; + + float occlusion = 0; + int usedCount = 0; + float total = 0.0; + + sample( IN.uv0.xy, kernel.x, centerTap, usedCount, occlusion, total ); + sample( IN.uv1, kernel.y, centerTap, usedCount, occlusion, total ); + sample( IN.uv2, kernel.z, centerTap, usedCount, occlusion, total ); + sample( IN.uv3, kernel.w, centerTap, usedCount, occlusion, total ); + + sample( IN.uv4, kernel.x, centerTap, usedCount, occlusion, total ); + sample( IN.uv5, kernel.y, centerTap, usedCount, occlusion, total ); + sample( IN.uv6, kernel.z, centerTap, usedCount, occlusion, total ); + sample( IN.uv7, kernel.w, centerTap, usedCount, occlusion, total ); + + occlusion += TORQUE_TEX2D( occludeMap, IN.uv0.zw ).r * 0.5; + total += 0.5; + //occlusion /= 3.0; + + //occlusion /= (float)usedCount / 8.0; + occlusion /= total; + + return float4( occlusion.rrr, 1 ); + + + //return float4( 0,0,0,occlusion ); + + //float3 color = TORQUE_TEX2D( colorMap, IN.uv0.zw ); + + //return float4( color, occlusion ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_Blur_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_Blur_V.hlsl new file mode 100644 index 000000000..6ab278900 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_Blur_V.hlsl @@ -0,0 +1,86 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float2 texSize0; +uniform float2 oneOverTargetSize; +uniform float4 rtParams0; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float4 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + + IN.uv = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + //float4 step = float4( 3.5, 2.5, 1.5, 0.5 ); + //float4 step = float4( 4.0, 3.0, 2.0, 1.0 ); + float4 step = float4( 9.0, 5.0, 2.5, 0.5 ); + + // I don't know why this offset is necessary, but it is. + //IN.uv = IN.uv * oneOverTargetSize; + + OUT.uv0.xy = IN.uv + ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT.uv1 = IN.uv + ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT.uv2 = IN.uv + ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT.uv3 = IN.uv + ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT.uv4 = IN.uv - ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT.uv5 = IN.uv - ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT.uv6 = IN.uv - ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT.uv7 = IN.uv - ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT.uv0.zw = IN.uv; + + /* + OUT.uv0 = viewportCoordToRenderTarget( OUT.uv0, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( OUT.uv1, rtParams0 ); + OUT.uv2 = viewportCoordToRenderTarget( OUT.uv2, rtParams0 ); + OUT.uv3 = viewportCoordToRenderTarget( OUT.uv3, rtParams0 ); + + OUT.uv4 = viewportCoordToRenderTarget( OUT.uv4, rtParams0 ); + OUT.uv5 = viewportCoordToRenderTarget( OUT.uv5, rtParams0 ); + OUT.uv6 = viewportCoordToRenderTarget( OUT.uv6, rtParams0 ); + OUT.uv7 = viewportCoordToRenderTarget( OUT.uv7, rtParams0 ); + */ + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_P.hlsl new file mode 100644 index 000000000..ff31a4b8b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_P.hlsl @@ -0,0 +1,272 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "./../postFx.hlsl" + +#define DOSMALL +#define DOLARGE + +TORQUE_UNIFORM_SAMPLER2D(deferredMap,0); +TORQUE_UNIFORM_SAMPLER2D(randNormalTex,1); +TORQUE_UNIFORM_SAMPLER1D(powTable,2); + +uniform float2 nearFar; +uniform float2 worldToScreenScale; +uniform float2 texSize0; +uniform float2 texSize1; +uniform float2 targetSize; + +// Script-set constants. + +uniform float overallStrength; + +uniform float sRadius; +uniform float sStrength; +uniform float sDepthMin; +uniform float sDepthMax; +uniform float sDepthPow; +uniform float sNormalTol; +uniform float sNormalPow; + +uniform float lRadius; +uniform float lStrength; +uniform float lDepthMin; +uniform float lDepthMax; +uniform float lDepthPow; +uniform float lNormalTol; +uniform float lNormalPow; + + +#ifndef QUALITY + #define QUALITY 2 +#endif + + +#if QUALITY == 0 + #define sSampleCount 4 + #define totalSampleCount 12 +#elif QUALITY == 1 + #define sSampleCount 6 + #define totalSampleCount 24 +#elif QUALITY == 2 + #define sSampleCount 8 + #define totalSampleCount 32 +#endif + + +float getOcclusion( float depthDiff, float depthMin, float depthMax, float depthPow, + float normalDiff, float dt, float normalTol, float normalPow ) +{ + if ( depthDiff < 0.0 ) + return 0.0; + + float delta = abs( depthDiff ); + + if ( delta < depthMin || delta > depthMax ) + return 0.0; + + delta = saturate( delta / depthMax ); + + if ( dt > 0.0 ) + normalDiff *= dt; + else + normalDiff = 1.0; + + + normalDiff *= 1.0 - ( dt * 0.5 + 0.5 ); + + return ( 1.0 - TORQUE_TEX1D( powTable, delta ).r ) * normalDiff; +} + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float3 ptSphere[32] = + { + float3( 0.295184, 0.077723, 0.068429 ), + float3( -0.271976, -0.365221, -0.838363 ), + float3( 0.547713, 0.467576, 0.488515 ), + float3( 0.662808, -0.031733, -0.584758 ), + float3( -0.025717, 0.218955, -0.657094 ), + float3( -0.310153, -0.365223, -0.370701 ), + float3( -0.101407, -0.006313, -0.747665 ), + float3( -0.769138, 0.360399, -0.086847 ), + float3( -0.271988, -0.275140, -0.905353 ), + float3( 0.096740, -0.566901, 0.700151 ), + float3( 0.562872, -0.735136, -0.094647 ), + float3( 0.379877, 0.359278, 0.190061 ), + float3( 0.519064, -0.023055, 0.405068 ), + float3( -0.301036, 0.114696, -0.088885 ), + float3( -0.282922, 0.598305, 0.487214 ), + float3( -0.181859, 0.251670, -0.679702 ), + float3( -0.191463, -0.635818, -0.512919 ), + float3( -0.293655, 0.427423, 0.078921 ), + float3( -0.267983, 0.680534, -0.132880 ), + float3( 0.139611, 0.319637, 0.477439 ), + float3( -0.352086, 0.311040, 0.653913 ), + float3( 0.321032, 0.805279, 0.487345 ), + float3( 0.073516, 0.820734, -0.414183 ), + float3( -0.155324, 0.589983, -0.411460 ), + float3( 0.335976, 0.170782, -0.527627 ), + float3( 0.463460, -0.355658, -0.167689 ), + float3( 0.222654, 0.596550, -0.769406 ), + float3( 0.922138, -0.042070, 0.147555 ), + float3( -0.727050, -0.329192, 0.369826 ), + float3( -0.090731, 0.533820, 0.463767 ), + float3( -0.323457, -0.876559, -0.238524 ), + float3( -0.663277, -0.372384, -0.342856 ) + }; + + // Sample a random normal for reflecting the + // sphere vector later in our loop. + float4 noiseMapUV = float4( ( IN.uv1 * ( targetSize / texSize1 ) ).xy, 0, 0 ); + float3 reflectNormal = normalize( TORQUE_TEX2DLOD( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); + //return float4( reflectNormal, 1 ); + + float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredMap, IN.uv0 ); + float3 normal = deferred.xyz; + float depth = deferred.a; + //return float4( ( depth ).xxx, 1 ); + + // Early out if too far away. + if ( depth > 0.99999999 ) + return float4( 0,0,0,0 ); + + // current fragment coords in screen space + float3 ep = float3( IN.uv0, depth ); + + float bl; + float3 baseRay, ray, se, occNorm, projRadius; + float normalDiff = 0; + float depthMin, depthMax, dt, depthDiff; + float4 occluderFragment; + int i; + float sOcclusion = 0.0; + float lOcclusion = 0.0; + + //------------------------------------------------------------ + // Small radius + //------------------------------------------------------------ + +#ifdef DOSMALL + + bl = 0.0; + + projRadius.xy = ( float2( sRadius.rr ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = sRadius / nearFar.y; + + depthMin = projRadius.z * sDepthMin; + depthMax = projRadius.z * sDepthMax; + + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + [unroll] + for ( i = 0; i < sSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = TORQUE_DEFERRED_UNCONDITION( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + dt = dot( occluderFragment.xyz, baseRay.xyz ); + normalDiff = dot( occluderFragment.xyz, normal ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, sDepthPow, normalDiff, dt, sNormalTol, sNormalPow ); + } + + sOcclusion = sStrength * ( bl / (float)sSampleCount ); + +#endif // DOSMALL + + + //------------------------------------------------------------ + // Large radius + //------------------------------------------------------------ + +#ifdef DOLARGE + + bl = 0.0; + + projRadius.xy = ( float2( lRadius.rr ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = lRadius / nearFar.y; + + depthMin = projRadius.z * lDepthMin; + depthMax = projRadius.z * lDepthMax; + + //projRadius.xy = clamp( projRadius.xy, 0.0, 0.01 ); + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + [unroll] + for ( i = sSampleCount; i < totalSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = TORQUE_DEFERRED_UNCONDITION( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + normalDiff = dot( occluderFragment.xyz, normal ); + dt = dot( occluderFragment.xyz, baseRay.xyz ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, lDepthPow, normalDiff, dt, lNormalTol, lNormalPow ); + } + + lOcclusion = lStrength * ( bl / (float)( totalSampleCount - sSampleCount ) ); + +#endif // DOLARGE + + float occlusion = saturate( max( sOcclusion, lOcclusion ) * overallStrength ); + + // Note black is unoccluded and white is fully occluded. This + // seems backwards, but it makes it simple to deal with the SSAO + // being disabled in the lighting shaders. + + return occlusion; +} + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl new file mode 100644 index 000000000..696947d3e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl @@ -0,0 +1,29 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float power = pow( max( IN.uv0.x, 0 ), 0.1 ); + return float4( power, 0, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl new file mode 100644 index 000000000..76f67e711 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl new file mode 100644 index 000000000..cae920af8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl @@ -0,0 +1,108 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec4 uv0; +#define IN_uv0 uv0 +in vec2 uv1; +#define IN_uv1 uv1 +in vec2 uv2; +#define IN_uv2 uv2 +in vec2 uv3; +#define IN_uv3 uv3 + +in vec2 uv4; +#define IN_uv4 uv4 +in vec2 uv5; +#define IN_uv5 uv5 +in vec2 uv6; +#define IN_uv6 uv6 +in vec2 uv7; +#define IN_uv7 uv7 + +uniform sampler2D occludeMap ; +uniform sampler2D deferredMap ; +uniform float blurDepthTol; +uniform float blurNormalTol; + +out vec4 OUT_col; + +void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout float occlusion, inout float total ) +{ + //return; + vec4 tap = deferredUncondition( deferredMap, uv ); + + if ( abs( tap.a - centerTap.a ) < blurDepthTol ) + { + if ( dot( tap.xyz, centerTap.xyz ) > blurNormalTol ) + { + usedCount++; + total += weight; + occlusion += texture( occludeMap, uv ).r * weight; + } + } +} + +void main() +{ + //vec4 centerTap; + vec4 centerTap = deferredUncondition( deferredMap, IN_uv0.zw ); + + //return centerTap; + + //float centerOcclude = texture( occludeMap, IN_uv0.zw ).r; + //return vec4( centerOcclude.rrr, 1 ); + + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ); //25f; + + float occlusion = 0; + int usedCount = 0; + float total = 0.0; + + _sample( IN_uv0.xy, kernel.x, centerTap, usedCount, occlusion, total ); + _sample( IN_uv1, kernel.y, centerTap, usedCount, occlusion, total ); + _sample( IN_uv2, kernel.z, centerTap, usedCount, occlusion, total ); + _sample( IN_uv3, kernel.w, centerTap, usedCount, occlusion, total ); + + _sample( IN_uv4, kernel.x, centerTap, usedCount, occlusion, total ); + _sample( IN_uv5, kernel.y, centerTap, usedCount, occlusion, total ); + _sample( IN_uv6, kernel.z, centerTap, usedCount, occlusion, total ); + _sample( IN_uv7, kernel.w, centerTap, usedCount, occlusion, total ); + + occlusion += texture( occludeMap, IN_uv0.zw ).r * 0.5; + total += 0.5; + //occlusion /= 3.0; + + //occlusion /= (float)usedCount / 8.0; + occlusion /= total; + + OUT_col = vec4( vec3(occlusion), 1 ); + + + //return vec4( 0,0,0,occlusion ); + + //vec3 color = texture( colorMap, IN_uv0.zw ); + + //return vec4( color, occlusion ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl new file mode 100644 index 000000000..45a52e890 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl @@ -0,0 +1,96 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_pos vPosition +#define _IN_uv vTexCoord0 + +uniform vec2 texSize0; +uniform vec4 rtParams0; +uniform vec2 oneOverTargetSize; + +#define OUT_hpos gl_Position + +out vec4 uv0; +#define OUT_uv0 uv0 +out vec2 uv1; +#define OUT_uv1 uv1 +out vec2 uv2; +#define OUT_uv2 uv2 +out vec2 uv3; +#define OUT_uv3 uv3 + +out vec2 uv4; +#define OUT_uv4 uv4 +out vec2 uv5; +#define OUT_uv5 uv5 +out vec2 uv6; +#define OUT_uv6 uv6 +out vec2 uv7; +#define OUT_uv7 uv7 + + +void main() +{ + OUT_hpos = IN_pos; + + vec2 IN_uv = viewportCoordToRenderTarget( _IN_uv, rtParams0 ); + + //vec4 step = vec4( 3.5, 2.5, 1.5, 0.5 ); + //vec4 step = vec4( 4.0, 3.0, 2.0, 1.0 ); + vec4 step = vec4( 9.0, 5.0, 2.5, 0.5 ); + + // I don't know why this offset is necessary, but it is. + //IN_uv = IN_uv * oneOverTargetSize; + + OUT_uv0.xy = IN_uv + ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT_uv1 = IN_uv + ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT_uv2 = IN_uv + ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT_uv3 = IN_uv + ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT_uv4 = IN_uv - ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT_uv5 = IN_uv - ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT_uv6 = IN_uv - ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT_uv7 = IN_uv - ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT_uv0.zw = IN_uv; + + /* + OUT_uv0 = viewportCoordToRenderTarget( OUT_uv0, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( OUT_uv1, rtParams0 ); + OUT_uv2 = viewportCoordToRenderTarget( OUT_uv2, rtParams0 ); + OUT_uv3 = viewportCoordToRenderTarget( OUT_uv3, rtParams0 ); + + OUT_uv4 = viewportCoordToRenderTarget( OUT_uv4, rtParams0 ); + OUT_uv5 = viewportCoordToRenderTarget( OUT_uv5, rtParams0 ); + OUT_uv6 = viewportCoordToRenderTarget( OUT_uv6, rtParams0 ); + OUT_uv7 = viewportCoordToRenderTarget( OUT_uv7, rtParams0 ); + */ + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_P.glsl new file mode 100644 index 000000000..cfff88381 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_P.glsl @@ -0,0 +1,278 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +#define DOSMALL +#define DOLARGE + +uniform sampler2D deferredMap ; +uniform sampler2D randNormalTex ; +uniform sampler1D powTable ; + +uniform vec2 nearFar; +uniform vec2 worldToScreenScale; +uniform vec2 texSize0; +uniform vec2 texSize1; +uniform vec2 targetSize; + +// Script-set constants. + +uniform float overallStrength; + +uniform float sRadius; +uniform float sStrength; +uniform float sDepthMin; +uniform float sDepthMax; +uniform float sDepthPow; +uniform float sNormalTol; +uniform float sNormalPow; + +uniform float lRadius; +uniform float lStrength; +uniform float lDepthMin; +uniform float lDepthMax; +uniform float lDepthPow; +uniform float lNormalTol; +uniform float lNormalPow; + +out vec4 OUT_col; + + +#ifndef QUALITY + #define QUALITY 2 +#endif + + +#if QUALITY == 0 + #define sSampleCount 4 + #define totalSampleCount 12 +#elif QUALITY == 1 + #define sSampleCount 6 + #define totalSampleCount 24 +#elif QUALITY == 2 + #define sSampleCount 8 + #define totalSampleCount 32 +#endif + + +float getOcclusion( float depthDiff, float depthMin, float depthMax, float depthPow, + float normalDiff, float dt, float normalTol, float normalPow ) +{ + if ( depthDiff < 0.0 ) + return 0.0; + + float delta = abs( depthDiff ); + + if ( delta < depthMin || delta > depthMax ) + return 0.0; + + delta = saturate( delta / depthMax ); + + if ( dt > 0.0 ) + normalDiff *= dt; + else + normalDiff = 1.0; + + + normalDiff *= 1.0 - ( dt * 0.5 + 0.5 ); + + return ( 1.0 - texture( powTable, delta ).r ) * normalDiff; +} + + +void main() +{ + const vec3 ptSphere[32] = vec3[] + ( + vec3( 0.295184, 0.077723, 0.068429 ), + vec3( -0.271976, -0.365221, -0.838363 ), + vec3( 0.547713, 0.467576, 0.488515 ), + vec3( 0.662808, -0.031733, -0.584758 ), + vec3( -0.025717, 0.218955, -0.657094 ), + vec3( -0.310153, -0.365223, -0.370701 ), + vec3( -0.101407, -0.006313, -0.747665 ), + vec3( -0.769138, 0.360399, -0.086847 ), + vec3( -0.271988, -0.275140, -0.905353 ), + vec3( 0.096740, -0.566901, 0.700151 ), + vec3( 0.562872, -0.735136, -0.094647 ), + vec3( 0.379877, 0.359278, 0.190061 ), + vec3( 0.519064, -0.023055, 0.405068 ), + vec3( -0.301036, 0.114696, -0.088885 ), + vec3( -0.282922, 0.598305, 0.487214 ), + vec3( -0.181859, 0.251670, -0.679702 ), + vec3( -0.191463, -0.635818, -0.512919 ), + vec3( -0.293655, 0.427423, 0.078921 ), + vec3( -0.267983, 0.680534, -0.132880 ), + vec3( 0.139611, 0.319637, 0.477439 ), + vec3( -0.352086, 0.311040, 0.653913 ), + vec3( 0.321032, 0.805279, 0.487345 ), + vec3( 0.073516, 0.820734, -0.414183 ), + vec3( -0.155324, 0.589983, -0.411460 ), + vec3( 0.335976, 0.170782, -0.527627 ), + vec3( 0.463460, -0.355658, -0.167689 ), + vec3( 0.222654, 0.596550, -0.769406 ), + vec3( 0.922138, -0.042070, 0.147555 ), + vec3( -0.727050, -0.329192, 0.369826 ), + vec3( -0.090731, 0.533820, 0.463767 ), + vec3( -0.323457, -0.876559, -0.238524 ), + vec3( -0.663277, -0.372384, -0.342856 ) + ); + + // Sample a random normal for reflecting the + // sphere vector later in our loop. + vec4 noiseMapUV = vec4( ( IN_uv1 * ( targetSize / texSize1 ) ).xy, 0, 0 ); + vec3 reflectNormal = normalize( tex2Dlod( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); + //return vec4( reflectNormal, 1 ); + + vec4 deferred = deferredUncondition( deferredMap, IN_uv0 ); + vec3 normal = deferred.xyz; + float depth = deferred.a; + //return vec4( ( depth ).xxx, 1 ); + + // Early out if too far away. + if ( depth > 0.99999999 ) + { + OUT_col = vec4( 0,0,0,0 ); + return; + } + + // current fragment coords in screen space + vec3 ep = vec3( IN_uv0, depth ); + + float bl; + vec3 baseRay, ray, se, occNorm, projRadius; + float normalDiff = 0; + float depthMin, depthMax, dt, depthDiff; + vec4 occluderFragment; + int i; + float sOcclusion = 0.0; + float lOcclusion = 0.0; + + //------------------------------------------------------------ + // Small radius + //------------------------------------------------------------ + +#ifdef DOSMALL + + bl = 0.0; + + projRadius.xy = ( vec2( sRadius ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = sRadius / nearFar.y; + + depthMin = projRadius.z * sDepthMin; + depthMax = projRadius.z * sDepthMax; + + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + + for ( i = 0; i < sSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = deferredUncondition( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + dt = dot( occluderFragment.xyz, baseRay.xyz ); + normalDiff = dot( occluderFragment.xyz, normal ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, sDepthPow, normalDiff, dt, sNormalTol, sNormalPow ); + } + + sOcclusion = sStrength * ( bl / float(sSampleCount) ); + +#endif // DOSMALL + + + //------------------------------------------------------------ + // Large radius + //------------------------------------------------------------ + +#ifdef DOLARGE + + bl = 0.0; + + projRadius.xy = ( vec2( lRadius ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = lRadius / nearFar.y; + + depthMin = projRadius.z * lDepthMin; + depthMax = projRadius.z * lDepthMax; + + //projRadius.xy = clamp( projRadius.xy, 0.0, 0.01 ); + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + + for ( i = sSampleCount; i < totalSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = deferredUncondition( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + normalDiff = dot( occluderFragment.xyz, normal ); + dt = dot( occluderFragment.xyz, baseRay.xyz ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, lDepthPow, normalDiff, dt, lNormalTol, lNormalPow ); + } + + lOcclusion = lStrength * ( bl / float( totalSampleCount - sSampleCount ) ); + +#endif // DOLARGE + + float occlusion = saturate( max( sOcclusion, lOcclusion ) * overallStrength ); + + // Note black is unoccluded and white is fully occluded. This + // seems backwards, but it makes it simple to deal with the SSAO + // being disabled in the lighting shaders. + + OUT_col = vec4(occlusion, vec3(0.0)); +} + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl new file mode 100644 index 000000000..4f49479ba --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" + +in vec2 uv0; +#define IN_uv0 uv0 + +out vec4 OUT_col; + +void main() +{ + float power = pow( max( IN_uv0.x, 0 ), 0.1 ); + OUT_col = vec4( power, 0, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl new file mode 100644 index 000000000..a193f63ce --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +void main() +{ + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/turbulenceP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/turbulenceP.hlsl new file mode 100644 index 000000000..c8c572ae7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/turbulenceP.hlsl @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" + +uniform float accumTime; +uniform float2 projectionOffset; +uniform float4 targetViewport; +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float speed = 2.0; + float distortion = 6.0; + + float y = IN.uv0.y + (cos((IN.uv0.y+projectionOffset.y) * distortion + accumTime * speed) * 0.01); + float x = IN.uv0.x + (sin((IN.uv0.x+projectionOffset.x) * distortion + accumTime * speed) * 0.01); + + // Clamp the calculated uv values to be within the target's viewport + y = clamp(y, targetViewport.y, targetViewport.w); + x = clamp(x, targetViewport.x, targetViewport.z); + + return TORQUE_TEX2D(inputTex, float2(x, y)); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/underwaterFogP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/underwaterFogP.hlsl new file mode 100644 index 000000000..aab43c45c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/underwaterFogP.hlsl @@ -0,0 +1,138 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "../torque.hlsl" +#include "../shaderModelAutoGen.hlsl" +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// oceanFogData +#define FOG_DENSITY waterFogData[0] +#define FOG_DENSITY_OFFSET waterFogData[1] +#define WET_DEPTH waterFogData[2] +#define WET_DARKENING waterFogData[3] + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +TORQUE_UNIFORM_SAMPLER2D(backbuffer, 1); +TORQUE_UNIFORM_SAMPLER1D(waterDepthGradMap, 2); + +uniform float3 eyePosWorld; +uniform float waterDepthGradMax; +uniform float3 ambientColor; +uniform float4 waterColor; +uniform float4 waterFogData; +uniform float4 waterFogPlane; +uniform float2 nearFar; +uniform float4 rtParams0; + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //float2 deferredCoord = IN.uv0; + //IN.uv0 = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + //return float4( depth.rrr, 1 ); + + // Skip fogging the extreme far plane so that + // the canvas clear color always appears. + //clip( 0.9 - depth ); + + // We assume that the eye position is below water because + // otherwise this shader/posteffect should not be active. + + depth *= nearFar.y; + + float3 eyeRay = normalize( IN.wsEyeRay ); + + float3 rayStart = eyePosWorld; + float3 rayEnd = eyePosWorld + ( eyeRay * depth ); + //return float4( rayEnd, 1 ); + + float4 plane = waterFogPlane; //float4( 0, 0, 1, -waterHeight ); + //plane.w -= 0.15; + + float startSide = dot( plane.xyz, rayStart ) + plane.w; + if ( startSide > 0 ) + { + rayStart.z -= ( startSide ); + //return float4( 1, 0, 0, 1 ); + } + + float3 hitPos; + float3 ray = rayEnd - rayStart; + float rayLen = length( ray ); + float3 rayDir = normalize( ray ); + + float endSide = dot( plane.xyz, rayEnd ) + plane.w; + float planeDist; + + if ( endSide < -0.005 ) + { + //return float4( 0, 0, 1, 1 ); + hitPos = rayEnd; + planeDist = endSide; + } + else + { + //return float4( 0, 0, 0, 0 ); + float den = dot( ray, plane.xyz ); + + // Parallal to the plane, return the endPnt. + //if ( den == 0.0f ) + // return endPnt; + + float dist = -( dot( plane.xyz, rayStart ) + plane.w ) / den; + if ( dist < 0.0 ) + dist = 0.0; + //return float4( 1, 0, 0, 1 ); + //return float4( ( dist ).rrr, 1 ); + + + hitPos = lerp( rayStart, rayEnd, dist ); + + planeDist = dist; + } + + float delta = length( hitPos - rayStart ); + + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * ( delta - FOG_DENSITY_OFFSET ) ) ); + //return float4( fogAmt.rrr, 1 ); + + // Calculate the water "base" color based on depth. + float4 fogColor = waterColor * TORQUE_TEX1D( waterDepthGradMap, saturate( delta / waterDepthGradMax ) ); + // Modulate baseColor by the ambientColor. + fogColor *= float4( ambientColor.rgb, 1 ); + + float3 inColor = hdrDecode( TORQUE_TEX2D( backbuffer, IN.uv0 ).rgb ); + inColor.rgb *= 1.0 - saturate( abs( planeDist ) / WET_DEPTH ) * WET_DARKENING; + //return float4( inColor, 1 ); + + float3 outColor = lerp( inColor, fogColor.rgb, fogAmt ); + + return float4( hdrEncode( outColor ), 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/VignetteP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/VignetteP.hlsl new file mode 100644 index 000000000..c518a2145 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/VignetteP.hlsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float Vmax; +uniform float Vmin; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + float dist = distance(IN.uv0, float2(0.5,0.5)); + base.rgb *= smoothstep(Vmax, Vmin, dist); + return base; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/gl/VignetteP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/gl/VignetteP.glsl new file mode 100644 index 000000000..35de95c34 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/gl/VignetteP.glsl @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D backBuffer; +uniform float Vmax; +uniform float Vmin; + +in vec2 uv0; +#define IN_uv0 uv0 + +out vec4 OUT_col; + +void main() +{ + vec4 base = texture(backBuffer, IN_uv0); + float dist = distance(IN_uv0, vec2(0.5,0.5)); + base.rgb *= smoothstep(Vmax, Vmin, dist); + OUT_col = base; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/precipP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/precipP.hlsl new file mode 100644 index 000000000..069ba4992 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/precipP.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Conn +{ + float4 position : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 color : COLOR0; +}; + +struct Frag +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Frag main( Conn In) +{ + Frag Out; + + Out.col = TORQUE_TEX2D(diffuseMap, In.texCoord) * In.color; + + return Out; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/precipV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/precipV.hlsl new file mode 100644 index 000000000..3c40942c7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/precipV.hlsl @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Precipitation vertex shader +//***************************************************************************** +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vert +{ + float3 position : POSITION; + float2 texCoord : TEXCOORD0; + float4 color : COLOR0; +}; + +struct Conn +{ + float4 position : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 color : COLOR0; +}; + +uniform float4x4 modelview : register(C0); +uniform float2 fadeStartEnd : register(C4); +uniform float3 cameraPos : register(C5); +uniform float3 ambient : register(C6); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Conn main( Vert In ) +{ + Conn Out; + + Out.position = mul(modelview, float4(In.position,1.0)); + Out.texCoord = In.texCoord; + Out.color = float4( ambient.r, ambient.g, ambient.b, 1 ); + + // Do we need to do a distance fade? + if ( fadeStartEnd.x < fadeStartEnd.y ) { + + float distance = length( cameraPos - In.position ); + Out.color.a = abs( clamp( ( distance - fadeStartEnd.x ) / ( fadeStartEnd.y - fadeStartEnd.x ), 0, 1 ) - 1 ); + } + + return Out; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/projectedShadowP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowP.hlsl new file mode 100644 index 000000000..88713bd52 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowP.hlsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Conn +{ + float4 position : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float fade : TEXCOORD1; +}; + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float4 ambient; + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + float shadow = TORQUE_TEX2D( inputTex, IN.texCoord ).a * IN.color.a; + return ( ambient * shadow ) + ( 1 - shadow ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/projectedShadowV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowV.hlsl new file mode 100644 index 000000000..38b1bd3e2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowV.hlsl @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vert +{ + float3 position : POSITION; + float3 normal : NORMAL; + float3 T : TANGENT; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 position : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float fade : TEXCOORD1; +}; + +uniform float4x4 modelview; +uniform float shadowLength; +uniform float3 shadowCasterPosition; + +Conn main( Vert In ) +{ + Conn Out; + + // Decals are in world space. + Out.position = mul( modelview, float4( In.position, 1.0 ) ); + + Out.color = In.color; + Out.texCoord = In.texCoord; + + float fromCasterDist = length( In.position - shadowCasterPosition ) - shadowLength; + Out.fade = 1.0 - saturate( fromCasterDist / shadowLength ); + + return Out; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderP.hlsl new file mode 100644 index 000000000..f4c6c7b04 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderP.hlsl @@ -0,0 +1,19 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../shaderModel.hlsl" + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +float4 main(v2f IN) : TORQUE_TARGET0 +{ + float fade = 1.0 - abs(IN.shiftdata.y - 0.5) * 2.0; + IN.color.xyz = IN.color.xyz + pow(fade, 4) / 10; + IN.color.a = IN.color.a * fade; + return IN.color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderV.hlsl new file mode 100644 index 000000000..1a6bc85e4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderV.hlsl @@ -0,0 +1,35 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../shaderModel.hlsl" + +struct a2v +{ + float3 position : POSITION; + float3 normal : NORMAL; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +uniform float4x4 modelview; +uniform float3 eyePos; + +v2f main(a2v IN) +{ + v2f OUT; + + OUT.hpos = mul(modelview, float4(IN.position, 1.0)); + OUT.color = IN.color; + OUT.texCoord = IN.texCoord; + OUT.shiftdata = IN.shiftdata; + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderP.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderP.glsl new file mode 100644 index 000000000..f3f83ce30 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderP.glsl @@ -0,0 +1,20 @@ +#include "../../gl/hlslCompat.glsl" + +in float4 _hpos; +in float2 _texCoord; +in float2 _shiftdata; +in float4 _color; + +#define IN_hpos _hpos +#define IN_texCoord _texCoord +#define IN_shiftdata _shiftdata +#define IN_color _color + +out float4 OUT_col; + +void main() +{ + float fade = 1.0 - abs(IN_shiftdata.y - 0.5) * 2.0; + OUT_col.xyz = IN_color.xyz + pow(fade, 4) / 10; + OUT_col.a = IN_color.a * fade; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderV.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderV.glsl new file mode 100644 index 000000000..9f6826d55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderV.glsl @@ -0,0 +1,37 @@ +#include "../../gl/hlslCompat.glsl" + +in float2 vTexCoord0; +in float2 vTexCoord1; +in float3 vNormal; +in float4 vPosition; +in float4 vColor; + +#define IN_texCoord vTexCoord0 +#define IN_shiftdata vTexCoord1 +#define IN_normal vNormal +#define IN_position vPosition +#define IN_color vColor + +out float4 _hpos; +out float2 _texCoord; +out float2 _shiftdata; +out float4 _color; + +#define OUT_hpos _hpos +#define OUT_texCoord _texCoord +#define OUT_shiftdata _shiftdata +#define OUT_color _color + +uniform float4x4 modelview; +uniform float3 eyePos; + +void main() +{ + OUT_hpos = tMul(modelview, IN_position); + OUT_color = IN_color; + OUT_texCoord = IN_texCoord; + OUT_shiftdata = IN_shiftdata; + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderP.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderP.glsl new file mode 100644 index 000000000..cd3e72d43 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderP.glsl @@ -0,0 +1,22 @@ +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" + +in float4 _hpos; +in float2 _texCoord; +in float2 _shiftdata; +in float4 _color; + +#define IN_hpos _hpos +#define IN_texCoord _texCoord +#define IN_shiftdata _shiftdata +#define IN_color _color + +out float4 OUT_col; +uniform sampler2D ribTex; + +void main() +{ + float4 Tex = tex2D(ribTex,IN_texCoord); + Tex.a *= IN_color.a; + OUT_col = hdrEncode(Tex); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderV.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderV.glsl new file mode 100644 index 000000000..9f6826d55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderV.glsl @@ -0,0 +1,37 @@ +#include "../../gl/hlslCompat.glsl" + +in float2 vTexCoord0; +in float2 vTexCoord1; +in float3 vNormal; +in float4 vPosition; +in float4 vColor; + +#define IN_texCoord vTexCoord0 +#define IN_shiftdata vTexCoord1 +#define IN_normal vNormal +#define IN_position vPosition +#define IN_color vColor + +out float4 _hpos; +out float2 _texCoord; +out float2 _shiftdata; +out float4 _color; + +#define OUT_hpos _hpos +#define OUT_texCoord _texCoord +#define OUT_shiftdata _shiftdata +#define OUT_color _color + +uniform float4x4 modelview; +uniform float3 eyePos; + +void main() +{ + OUT_hpos = tMul(modelview, IN_position); + OUT_color = IN_color; + OUT_texCoord = IN_texCoord; + OUT_shiftdata = IN_shiftdata; + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderP.hlsl new file mode 100644 index 000000000..55bae76fd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderP.hlsl @@ -0,0 +1,21 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../torque.hlsl" + + +TORQUE_UNIFORM_SAMPLER2D(ribTex, 0); + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +float4 main(v2f IN) : TORQUE_TARGET0 +{ + float4 Tex = TORQUE_TEX2D(ribTex,IN.texCoord); + Tex.a *= IN.color.a; + return hdrEncode(Tex); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderV.hlsl new file mode 100644 index 000000000..2ce4f62fd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderV.hlsl @@ -0,0 +1,35 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../shaderModel.hlsl" + +struct a2v +{ + float3 position : POSITION; + float4 color : COLOR0; + float3 normal : NORMAL; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +uniform float4x4 modelview; +uniform float3 eyePos; + +v2f main(a2v IN) +{ + v2f OUT; + + OUT.hpos = mul(modelview, float4(IN.position,1.0)); + OUT.color = IN.color; + OUT.texCoord = IN.texCoord; + OUT.shiftdata = IN.shiftdata; + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/scatterSkyP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyP.hlsl new file mode 100644 index 000000000..84e0854e0 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyP.hlsl @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" +#include "torque.hlsl" + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 rayleighColor : TEXCOORD0; + float4 mieColor : TEXCOORD1; + float3 v3Direction : TEXCOORD2; + float3 pos : TEXCOORD3; +}; + +TORQUE_UNIFORM_SAMPLERCUBE(nightSky, 0); +uniform float4 nightColor; +uniform float2 nightInterpAndExposure; +uniform float useCubemap; +uniform float3 lightDir; +uniform float3 sunDir; + +float4 main( Conn In ) : TORQUE_TARGET0 +{ + + float fCos = dot( lightDir, In.v3Direction ) / length(In.v3Direction); + float fCos2 = fCos*fCos; + + float g = -0.991; + float g2 = -0.991 * -0.991; + + float fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) / pow(abs(1.0 + g2 - 2.0*g*fCos), 1.5); + + float4 color = In.rayleighColor + fMiePhase * In.mieColor; + color.a = color.b; + + float4 Out; + + float4 nightSkyColor = TORQUE_TEXCUBE(nightSky, -In.v3Direction); + nightSkyColor = lerp( nightColor, nightSkyColor, useCubemap ); + + float fac = dot( normalize( In.pos ), sunDir ); + fac = max( nightInterpAndExposure.y, pow( saturate( fac ), 2 ) ); + Out = lerp( color, nightSkyColor, nightInterpAndExposure.y ); + + Out.a = 1; + Out = saturate(Out); + + return hdrEncode( Out ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/scatterSkyV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyV.hlsl new file mode 100644 index 000000000..2052448db --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyV.hlsl @@ -0,0 +1,157 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +// The scale equation calculated by Vernier's Graphical Analysis +float vernierScale(float fCos) +{ + float x = 1.0 - fCos; + float x5 = x * 5.25; + float x5p6 = (-6.80 + x5); + float xnew = (3.83 + x * x5p6); + float xfinal = (0.459 + x * xnew); + float xfinal2 = -0.00287 + x * xfinal; + float outx = exp( xfinal2 ); + return 0.25 * outx; +} + +// This is the shader input vertex structure. +struct Vert +{ + // .xyz = point + float3 position : POSITION; +}; + +// This is the shader output data. +struct Conn +{ + float4 position : TORQUE_POSITION; + float4 rayleighColor : TEXCOORD0; + float4 mieColor : TEXCOORD1; + float3 v3Direction : TEXCOORD2; + float3 pos : TEXCOORD3; +}; + +float3 desaturate(const float3 color, const float desaturation) +{ + const float3 gray_conv = float3 (0.30, 0.59, 0.11); + return lerp(color, dot(gray_conv , color), desaturation); +} + +uniform float4x4 modelView; +uniform float4 misc; +uniform float4 sphereRadii; +uniform float4 scatteringCoeffs; +uniform float4 colorize; +uniform float3 camPos; +uniform float3 lightDir; +uniform float4 invWaveLength; + +Conn main( Vert In ) +{ + // Pull some variables out: + float camHeight = misc.x; + float camHeightSqr = misc.y; + + float scale = misc.z; + float scaleOverScaleDepth = misc.w; + + float outerRadius = sphereRadii.x; + float outerRadiusSqr = sphereRadii.y; + + float innerRadius = sphereRadii.z; + float innerRadiusSqr = sphereRadii.w; + + float rayleighBrightness = scatteringCoeffs.x; // Kr * ESun + float rayleigh4PI = scatteringCoeffs.y; // Kr * 4 * PI + + float mieBrightness = scatteringCoeffs.z; // Km * ESun + float mie4PI = scatteringCoeffs.w; // Km * 4 * PI + + // Get the ray from the camera to the vertex, + // and its length (which is the far point of the ray + // passing through the atmosphere). + float4 v3Pos = float4(In.position,1.0) / 6378000.0; // outerRadius; + float3 newCamPos = float3( 0, 0, camHeight ); + v3Pos.z += innerRadius; + float3 v3Ray = v3Pos.xyz - newCamPos; + float fFar = length(v3Ray); + v3Ray /= fFar; + + // Calculate the ray's starting position, + // then calculate its scattering offset. + float3 v3Start = newCamPos; + float fHeight = length(v3Start); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - camHeight)); + float fStartAngle = dot(v3Ray, v3Start) / fHeight; + + float fStartOffset = fDepth * vernierScale( fStartAngle ); + + // Initialize the scattering loop variables. + float fSampleLength = fFar / 2; + float fScaledLength = fSampleLength * scale; + float3 v3SampleRay = v3Ray * fSampleLength; + float3 v3SamplePoint = v3Start + v3SampleRay * 0.5; + + // Now loop through the sample rays + float3 v3FrontColor = float3(0.0, 0.0, 0.0); + for(int i=0; i<2; i++) + { + float fHeight = length(v3SamplePoint); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - fHeight)); + float fLightAngle = dot(lightDir, v3SamplePoint) / fHeight; + float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight; + + float vscale3 = vernierScale( fCameraAngle ); + float vscale2 = vernierScale( fLightAngle ); + + float fScatter = (fStartOffset + fDepth*(vscale2 - vscale3)); + float3 v3Attenuate = exp(-fScatter * (invWaveLength.xyz * rayleigh4PI + mie4PI)); + v3FrontColor += v3Attenuate * (fDepth * fScaledLength); + v3SamplePoint += v3SampleRay; + } + + Conn Out; + + // Finally, scale the Mie and Rayleigh colors + // and set up the varying variables for the pixel shader. + Out.position = mul( modelView, float4(In.position,1.0) ); + Out.mieColor.rgb = v3FrontColor * mieBrightness; + Out.mieColor.a = 1.0f; + Out.rayleighColor.rgb = v3FrontColor * (invWaveLength.xyz * rayleighBrightness); + Out.rayleighColor.a = 1.0f; + Out.v3Direction = newCamPos - v3Pos.xyz; + Out.pos = In.position; + +#ifdef USE_COLORIZE + + Out.rayleighColor.rgb = desaturate(Out.rayleighColor.rgb, 1) * colorize.a; + + Out.rayleighColor.r *= colorize.r; + Out.rayleighColor.g *= colorize.g; + Out.rayleighColor.b *= colorize.b; + +#endif + + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/shaderModel.hlsl b/Templates/BaseGame/game/core/rendering/shaders/shaderModel.hlsl new file mode 100644 index 000000000..70ce3a02d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/shaderModel.hlsl @@ -0,0 +1,97 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2015 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_SHADERMODEL_ +#define _TORQUE_SHADERMODEL_ + +// Portability helpers for different shader models +//Shader model 1.0 - 3.0 +#if (TORQUE_SM >= 10 && TORQUE_SM <=30) + // Semantics + #define TORQUE_POSITION POSITION + #define TORQUE_DEPTH DEPTH + #define TORQUE_TARGET0 COLOR0 + #define TORQUE_TARGET1 COLOR1 + #define TORQUE_TARGET2 COLOR2 + #define TORQUE_TARGET3 COLOR3 + + // Sampler uniforms + #define TORQUE_UNIFORM_SAMPLER1D(tex,regist) uniform sampler1D tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER2D(tex,regist) uniform sampler2D tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER3D(tex,regist) uniform sampler3D tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLERCUBE(tex,regist) uniform samplerCUBE tex : register(S##regist) + // Sampling functions + #define TORQUE_TEX1D(tex,coords) tex1D(tex,coords) + #define TORQUE_TEX2D(tex,coords) tex2D(tex,coords) + #define TORQUE_TEX2DPROJ(tex,coords) tex2Dproj(tex,coords) //this really is sm 2 or later + #define TORQUE_TEX3D(tex,coords) tex3D(tex,coords) + #define TORQUE_TEXCUBE(tex,coords) texCUBE(tex,coords) + + //Shader model 3.0 only + #if TORQUE_SM == 30 + #define TORQUE_VPOS VPOS // This is a float2 + // The mipmap LOD is specified in coord.w + #define TORQUE_TEX2DLOD(tex,coords) tex2Dlod(tex,coords) + #endif + + //helper if you want to pass sampler/texture in a function + //2D + #define TORQUE_SAMPLER2D(tex) sampler2D tex + #define TORQUE_SAMPLER2D_MAKEARG(tex) tex + //Cube + #define TORQUE_SAMPLERCUBE(tex) samplerCUBE tex + #define TORQUE_SAMPLERCUBE_MAKEARG(tex) tex +// Shader model 4.0+ +#elif TORQUE_SM >= 40 + #define TORQUE_POSITION SV_Position + #define TORQUE_DEPTH SV_Depth + #define TORQUE_VPOS SV_Position //note float4 compared to SM 3 where it is a float2 + #define TORQUE_TARGET0 SV_Target0 + #define TORQUE_TARGET1 SV_Target1 + #define TORQUE_TARGET2 SV_Target2 + #define TORQUE_TARGET3 SV_Target3 + // Sampler uniforms + //1D is emulated to a 2D for now + #define TORQUE_UNIFORM_SAMPLER1D(tex,regist) uniform Texture2D texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER2D(tex,regist) uniform Texture2D texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER3D(tex,regist) uniform Texture3D texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLERCUBE(tex,regist) uniform TextureCube texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + // Sampling functions + #define TORQUE_TEX1D(tex,coords) texture_##tex.Sample(tex,coords) + #define TORQUE_TEX2D(tex,coords) texture_##tex.Sample(tex,coords) + #define TORQUE_TEX2DPROJ(tex,coords) texture_##tex.Sample(tex,coords.xy / coords.w) + #define TORQUE_TEX3D(tex,coords) texture_##tex.Sample(tex,coords) + #define TORQUE_TEXCUBE(tex,coords) texture_##tex.Sample(tex,coords) + // The mipmap LOD is specified in coord.w + #define TORQUE_TEX2DLOD(tex,coords) texture_##tex.SampleLevel(tex,coords.xy,coords.w) + + //helper if you want to pass sampler/texture in a function + //2D + #define TORQUE_SAMPLER2D(tex) Texture2D texture_##tex, SamplerState tex + #define TORQUE_SAMPLER2D_MAKEARG(tex) texture_##tex, tex + //Cube + #define TORQUE_SAMPLERCUBE(tex) TextureCube texture_##tex, SamplerState tex + #define TORQUE_SAMPLERCUBE_MAKEARG(tex) texture_##tex, tex +#endif + +#endif // _TORQUE_SHADERMODEL_ + diff --git a/Templates/BaseGame/game/core/rendering/shaders/shaderModelAutoGen.hlsl b/Templates/BaseGame/game/core/rendering/shaders/shaderModelAutoGen.hlsl new file mode 100644 index 000000000..d70847e46 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/shaderModelAutoGen.hlsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2015 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_SHADERMODEL_AUTOGEN_ +#define _TORQUE_SHADERMODEL_AUTOGEN_ + +#include "shadergen:/autogenConditioners.h" + +// Portability helpers for autogenConditioners +#if (TORQUE_SM >= 10 && TORQUE_SM <=30) + #define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, coords) +#elif TORQUE_SM >= 40 + #define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords) +#endif + +#endif //_TORQUE_SHADERMODEL_AUTOGEN_ diff --git a/Templates/BaseGame/game/core/rendering/shaders/shdrConsts.h b/Templates/BaseGame/game/core/rendering/shaders/shdrConsts.h new file mode 100644 index 000000000..8c262b76a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/shdrConsts.h @@ -0,0 +1,117 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifdef IN_HLSL + +#define VC_WORLD_PROJ C0 + +#define VC_TEX_TRANS1 C4 +#define VC_LIGHT_TRANS C8 +#define VC_OBJ_TRANS C12 + +#define VC_CUBE_TRANS C16 +#define VC_CUBE_EYE_POS C19 // in cubemap space +#define VC_EYE_POS C20 // in object space +#define VC_MAT_SPECPOWER C21 + +#define VC_FOGDATA C22 + +#define VC_LIGHT_POS1 C23 +#define VC_LIGHT_DIR1 C24 +#define VC_LIGHT_DIFFUSE1 C25 +#define VC_LIGHT_SPEC1 C26 + +#define VC_LIGHT_POS2 C27 +//#define VC_LIGHT_DIR2 C28 +//#define VC_LIGHT_DIFFUSE2 C29 +//#define VC_LIGHT_SPEC2 C30 +#define VC_LIGHT_TRANS2 C31 + +//#define VC_LIGHT_POS4 C35 +//#define VC_LIGHT_DIR4 C36 +//#define VC_LIGHT_DIFFUSE4 C37 +//#define VC_LIGHT_SPEC4 C38 + +#define VC_DETAIL_SCALE C40 + + +#define PC_MAT_SPECCOLOR C0 +#define PC_MAT_SPECPOWER C1 +#define PC_DIFF_COLOR C2 +#define PC_AMBIENT_COLOR C3 +#define PC_ACCUM_TIME C4 +#define PC_DIFF_COLOR2 C5 +#define PC_VISIBILITY C6 +#define PC_COLORMULTIPLY C7 + +#define PC_USERDEF1 C8 + +// Mirror of above. Couldn't be cleaner because HLSL doesn't support function macros +#else + +#define VC_WORLD_PROJ 0 + +#define VC_TEX_TRANS1 4 +#define VC_LIGHT_TRANS 8 +#define VC_OBJ_TRANS 12 + +#define VC_CUBE_TRANS 16 +#define VC_CUBE_EYE_POS 19 // in cubemap space +#define VC_EYE_POS 20 // in object space +#define VC_MAT_SPECPOWER 21 + +#define VC_FOGDATA 22 + +#define VC_LIGHT_POS1 23 +#define VC_LIGHT_DIR1 24 +#define VC_LIGHT_DIFFUSE1 25 +#define VC_LIGHT_SPEC1 26 + +#define VC_LIGHT_POS2 27 +//#define VC_LIGHT_DIR2 28 +//#define VC_LIGHT_DIFFUSE2 29 +//#define VC_LIGHT_SPEC2 30 +#define VC_LIGHT_TRANS2 31 + +//#define VC_LIGHT_POS4 35 +//#define VC_LIGHT_DIR4 36 +//#define VC_LIGHT_DIFFUSE4 37 +//#define VC_LIGHT_SPEC4 38 + +#define VC_DETAIL_SCALE 40 + + + +#define PC_MAT_SPECCOLOR 0 +#define PC_MAT_SPECPOWER 1 +#define PC_DIFF_COLOR 2 +#define PC_AMBIENT_COLOR 3 +#define PC_ACCUM_TIME 4 +#define PC_DIFF_COLOR2 5 +#define PC_VISIBILITY 6 +#define PC_COLORMULTIPLY 7 + +#define PC_USERDEF1 8 + +#endif + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/blendP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendP.hlsl new file mode 100644 index 000000000..aeef9d6e3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendP.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "terrain.hlsl" +#include "../shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 layerCoord : TEXCOORD0; + float2 texCoord : TEXCOORD1; +}; + +TORQUE_UNIFORM_SAMPLER2D(layerTex, 0); +TORQUE_UNIFORM_SAMPLER2D(textureMap, 1); + +uniform float texId; +uniform float layerSize; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float4 layerSample = round( TORQUE_TEX2D( layerTex, IN.layerCoord ) * 255.0f ); + + float blend = calcBlend( texId, IN.layerCoord, layerSize, layerSample ); + + clip( blend - 0.0001 ); + + return float4( TORQUE_TEX2D(textureMap, IN.texCoord).rgb, blend); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/blendV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendV.hlsl new file mode 100644 index 000000000..9ccd33301 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendV.hlsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// The vertex shader used in the generation and caching of the +/// base terrain texture. + +#include "../shaderModel.hlsl" + +struct VertData +{ + float3 position : POSITION; + float2 texCoord : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 layerCoord : TEXCOORD0; + float2 texCoord : TEXCOORD1; +}; + +uniform float2 texScale; + +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + OUT.hpos = float4( IN.position, 1 ); + OUT.layerCoord = IN.texCoord; + OUT.texCoord = IN.texCoord * texScale; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendP.glsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendP.glsl new file mode 100644 index 000000000..3189ea01d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendP.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../terrain.glsl" +#include "../../gl/hlslCompat.glsl" + +in vec2 layerCoord; +#define IN_layerCoord layerCoord +in vec2 texCoord; +#define IN_texCoord texCoord + +uniform sampler2D layerTex; +uniform sampler2D textureMap; +uniform float texId; +uniform float layerSize; + +out vec4 OUT_col; + +void main() +{ + vec4 layerSample = round(texture( layerTex, IN_layerCoord ) * 255.0); + + float blend = calcBlend( texId, IN_layerCoord, layerSize, layerSample ); + + if(blend - 0.0001 < 0.0) + discard; + + OUT_col = vec4( texture( textureMap, IN_texCoord ).rgb, blend ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendV.glsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendV.glsl new file mode 100644 index 000000000..dc7b7befa --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendV.glsl @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// The vertex shader used in the generation and caching of the +/// base terrain texture. + +in vec4 vPosition; +in vec2 vTexCoord0; + +out vec2 layerCoord; +out vec2 texCoord; + +uniform vec2 texScale; + +void main() +{ + gl_Position = vec4(vPosition.xyz, 1.0); + layerCoord = vTexCoord0.st; + texCoord = vTexCoord0.st * texScale; + + gl_Position.y *= -1; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.glsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.glsl new file mode 100644 index 000000000..756edd553 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float calcBlend( float texId, vec2 layerCoord, float layerSize, vec4 layerSample ) +{ + // This is here to disable the blend if none of + // the neighbors equal the current id. + // + // We depend on the input layer samples being + // rounded to the correct integer ids. + // + vec4 diff = clamp( abs( layerSample - texId ), 0.0, 1.0 ); + float noBlend = float(any( bvec4(1 - diff) )); + + // Check if any of the layer samples + // match the current texture id. + vec4 factors = vec4(0); + for(int i = 0; i < 4; i++) + factors[i] = (layerSample[i] == texId) ? 1 : 0; // workaround for Intel + + // This is a custom bilinear filter. + + vec2 uv = layerCoord * layerSize; + vec2 xy = floor( uv ); + vec2 ratio = uv - xy; + vec2 opposite = 1 - ratio; + + float blend = ( factors.b * opposite.x + factors.g * ratio.x ) * opposite.y + + ( factors.r * opposite.x + factors.a * ratio.x ) * ratio.y; + + return noBlend * blend; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.hlsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.hlsl new file mode 100644 index 000000000..b7c87e618 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.hlsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float calcBlend( float texId, float2 layerCoord, float layerSize, float4 layerSample ) +{ + // This is here to disable the blend if none of + // the neighbors equal the current id. + // + // We depend on the input layer samples being + // rounded to the correct integer ids. + // + float4 diff = saturate( abs( layerSample - texId ) ); + float noBlend = any( 1 - diff ); + + // Check if any of the layer samples + // match the current texture id. + float4 factors = 0; + [unroll] + for(int i = 0; i < 4; i++) + if(layerSample[i] == texId) + factors[i] = 1; + + // This is a custom bilinear filter. + + float2 uv = layerCoord * layerSize; + float2 xy = floor( uv ); + float2 ratio = uv - xy; + float2 opposite = 1 - ratio; + + // NOTE: This will optimize down to two lerp operations. + float blend = ( factors.b * opposite.x + factors.g * ratio.x ) * opposite.y + + ( factors.r * opposite.x + factors.a * ratio.x ) * ratio.y; + + return noBlend * blend; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/torque.hlsl b/Templates/BaseGame/game/core/rendering/shaders/torque.hlsl new file mode 100644 index 000000000..7081c7153 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/torque.hlsl @@ -0,0 +1,342 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_HLSL_ +#define _TORQUE_HLSL_ + +#include "./shaderModel.hlsl" + +static float M_HALFPI_F = 1.57079632679489661923f; +static float M_PI_F = 3.14159265358979323846f; +static float M_2PI_F = 6.28318530717958647692f; + + +/// Calculate fog based on a start and end positions in worldSpace. +float computeSceneFog( float3 startPos, + float3 endPos, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( endPos.z * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a start and end position and a height. +/// Positions do not need to be in worldSpace but height does. +float computeSceneFog( float3 startPos, + float3 endPos, + float height, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( height * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a distance, height is not used. +float computeSceneFog( float dist, float fogDensity, float fogDensityOffset ) +{ + float f = dist - fogDensityOffset; + return exp( -fogDensity * f ); +} + + +/// Convert a float4 uv in viewport space to render target space. +float2 viewportCoordToRenderTarget( float4 inCoord, float4 rtParams ) +{ + float2 outCoord = inCoord.xy / inCoord.w; + outCoord = ( outCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a float2 uv in viewport space to render target space. +float2 viewportCoordToRenderTarget( float2 inCoord, float4 rtParams ) +{ + float2 outCoord = ( inCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a float4 quaternion into a 3x3 matrix. +float3x3 quatToMat( float4 quat ) +{ + float xs = quat.x * 2.0f; + float ys = quat.y * 2.0f; + float zs = quat.z * 2.0f; + + float wx = quat.w * xs; + float wy = quat.w * ys; + float wz = quat.w * zs; + + float xx = quat.x * xs; + float xy = quat.x * ys; + float xz = quat.x * zs; + + float yy = quat.y * ys; + float yz = quat.y * zs; + float zz = quat.z * zs; + + float3x3 mat; + + mat[0][0] = 1.0f - (yy + zz); + mat[0][1] = xy - wz; + mat[0][2] = xz + wy; + + mat[1][0] = xy + wz; + mat[1][1] = 1.0f - (xx + zz); + mat[1][2] = yz - wx; + + mat[2][0] = xz - wy; + mat[2][1] = yz + wx; + mat[2][2] = 1.0f - (xx + yy); + + return mat; +} + + +/// The number of additional substeps we take when refining +/// the results of the offset parallax mapping function below. +/// +/// You should turn down the number of steps if your needing +/// more performance out of your parallax surfaces. Increasing +/// the number doesn't yeild much better results and is rarely +/// worth the additional cost. +/// +#define PARALLAX_REFINE_STEPS 3 + +/// Performs fast parallax offset mapping using +/// multiple refinement steps. +/// +/// @param texMap The texture map whos alpha channel we sample the parallax depth. +/// @param texCoord The incoming texture coordinate for sampling the parallax depth. +/// @param negViewTS The negative view vector in tangent space. +/// @param depthScale The parallax factor used to scale the depth result. +/// +float2 parallaxOffset(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale) +{ + float depth = TORQUE_TEX2D(texMap, texCoord).a/(PARALLAX_REFINE_STEPS*2); + float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS); + + for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) + { + depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).a)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS); + } + + return offset; +} + +/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha +float2 parallaxOffsetDxtnm(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale) +{ + float depth = TORQUE_TEX2D(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2); + float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2); + + for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) + { + depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2); + } + + return offset; +} + + +/// The maximum value for 16bit per component integer HDR encoding. +static const float HDR_RGB16_MAX = 100.0; + +/// The maximum value for 10bit per component integer HDR encoding. +static const float HDR_RGB10_MAX = 4.0; + +/// Encodes an HDR color for storage into a target. +float3 hdrEncode( float3 sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return sample / HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return sample / HDR_RGB10_MAX; + + #else + + // No encoding. + return sample; + + #endif +} + +/// Encodes an HDR color for storage into a target. +float4 hdrEncode( float4 sample ) +{ + return float4( hdrEncode( sample.rgb ), sample.a ); +} + +/// Decodes an HDR color from a target. +float3 hdrDecode( float3 sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return sample * HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return sample * HDR_RGB10_MAX; + + #else + + // No encoding. + return sample; + + #endif +} + +/// Decodes an HDR color from a target. +float4 hdrDecode( float4 sample ) +{ + return float4( hdrDecode( sample.rgb ), sample.a ); +} + +/// Returns the luminance for an HDR pixel. +float hdrLuminance( float3 sample ) +{ + // There are quite a few different ways to + // calculate luminance from an rgb value. + // + // If you want to use a different technique + // then plug it in here. + // + + //////////////////////////////////////////////////////////////////////////// + // + // Max component luminance. + // + //float lum = max( sample.r, max( sample.g, sample.b ) ); + + //////////////////////////////////////////////////////////////////////////// + // The perceptual relative luminance. + // + // See http://en.wikipedia.org/wiki/Luminance_(relative) + // + const float3 RELATIVE_LUMINANCE = float3( 0.2126, 0.7152, 0.0722 ); + float lum = dot( sample, RELATIVE_LUMINANCE ); + + //////////////////////////////////////////////////////////////////////////// + // + // The average component luminance. + // + //const float3 AVERAGE_LUMINANCE = float3( 0.3333, 0.3333, 0.3333 ); + //float lum = dot( sample, AVERAGE_LUMINANCE ); + + return lum; +} + +/// Called from the visibility feature to do screen +/// door transparency for fading of objects. +void fizzle(float2 vpos, float visibility) +{ + // NOTE: The magic values below are what give us + // the nice even pattern during the fizzle. + // + // These values can be changed to get different + // patterns... some better than others. + // + // Horizontal Blinds - { vpos.x, 0.916, vpos.y, 0 } + // Vertical Lines - { vpos.x, 12.9898, vpos.y, 78.233 } + // + // I'm sure there are many more patterns here to + // discover for different effects. + + float2x2 m = { vpos.x, 0.916, vpos.y, 0.350 }; + clip( visibility - frac( determinant( m ) ) ); +} + +// Deferred Shading: Material Info Flag Check +bool getFlag(float flags, int num) +{ + int process = round(flags * 255); + int squareNum = pow(2, num); + return (fmod(process, pow(2, squareNum)) >= squareNum); +} + +// #define TORQUE_STOCK_GAMMA +#ifdef TORQUE_STOCK_GAMMA +// Sample in linear space. Decodes gamma. +float4 toLinear(float4 tex) +{ + return tex; +} +// Encodes gamma. +float4 toGamma(float4 tex) +{ + return tex; +} +float3 toLinear(float3 tex) +{ + return tex; +} +// Encodes gamma. +float3 toGamma(float3 tex) +{ + return tex; +} +float3 toLinear(float3 tex) +{ + return tex; +} +// Encodes gamma. +float3 toLinear(float3 tex) +{ + return tex; +} +#else +// Sample in linear space. Decodes gamma. +float4 toLinear(float4 tex) +{ + return float4(pow(abs(tex.rgb), 2.2), tex.a); +} +// Encodes gamma. +float4 toGamma(float4 tex) +{ + return float4(pow(abs(tex.rgb), 1.0/2.2), tex.a); +} +// Sample in linear space. Decodes gamma. +float3 toLinear(float3 tex) +{ + return pow(abs(tex.rgb), 2.2); +} +// Encodes gamma. +float3 toGamma(float3 tex) +{ + return pow(abs(tex.rgb), 1.0/2.2); +} +#endif // + +#endif // _TORQUE_HLSL_ diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicP.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicP.glsl new file mode 100644 index 000000000..91bdb4137 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicP.glsl @@ -0,0 +1,216 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/torque.glsl" +#include "../../gl/hlslCompat.glsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +#define CLARITY miscParams[2] +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// ConnectData.misc +#define LIGHT_VEC IN_misc.xyz +#define WORLD_Z IN_objPos.w + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +in vec4 rippleTexCoord01; +#define IN_rippleTexCoord01 rippleTexCoord01 + +// TexCoord 2 for ripple texture lookup +in vec2 rippleTexCoord2; +#define IN_rippleTexCoord2 rippleTexCoord2 + +// Screenspace vert position BEFORE wave transformation +in vec4 posPreWave; +#define IN_posPreWave posPreWave + +// Screenspace vert position AFTER wave transformation +in vec4 posPostWave; +#define IN_posPostWave posPostWave + +// Worldspace unit distance/depth of this vertex/pixel +in float pixelDist; +#define IN_pixelDist pixelDist + +in vec4 objPos; +#define IN_objPos objPos + +in vec3 misc; +#define IN_misc misc + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform sampler2D bumpMap; +//uniform sampler2D deferredTex; +uniform sampler2D reflectMap; +uniform sampler2D refractBuff; +uniform samplerCube skyMap; +//uniform sampler2D foamMap; +uniform vec4 baseColor; +uniform vec4 miscParams; +uniform vec4 reflectParams; +uniform vec3 ambientColor; +uniform vec3 eyePos; +uniform vec3 distortionParams; +uniform vec3 fogData; +uniform vec4 fogColor; +uniform vec4 rippleMagnitude; +uniform vec4 specularParams; +uniform mat4 modelMat; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Modulate baseColor by the ambientColor. + vec4 waterBaseColor = baseColor * vec4( ambientColor.rgb, 1 ); + + // Get the bumpNorm... + vec3 bumpNorm = ( texture( bumpMap, IN_rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord2 ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = mix( bumpNorm, vec3(0,0,1), 1.0 - rippleMagnitude.w ); + + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( IN_pixelDist / 1.0 ) * 0.8; + + vec4 distortPos = IN_posPostWave; + distortPos.xy += bumpNorm.xy * distortAmt; + + #ifdef UNDERWATER + OUT_col = hdrEncode( textureProj( refractBuff, distortPos ) ); + #else + + vec3 eyeVec = IN_objPos.xyz - eyePos; + eyeVec = tMul( mat3(modelMat), eyeVec ); + vec3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Color that replaces the reflection color when we do not + // have one that is appropriate. + vec4 fakeColor = vec4(ambientColor,1); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // Get reflection map color + vec4 refMapColor = hdrDecode( textureProj( reflectMap, distortPos ) ); + // If we do not have a reflection texture then we use the cubemap. + refMapColor = mix( refMapColor, texture( skyMap, reflectionVec ), NO_REFLECT ); + + // Combine reflection color and fakeColor. + vec4 reflectColor = mix( refMapColor, fakeColor, fakeColorAmt ); + //return refMapColor; + + // Get refract color + vec4 refractColor = hdrDecode( textureProj( refractBuff, distortPos ) ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + vec4 diffuseColor = mix( refractColor, waterBaseColor, 1.0f - CLARITY ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + //return vec4( fresnelTerm.rrr, 1 ); + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( IN_pixelDist - 0.1 ); + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + vec4 OUT = mix( diffuseColor, reflectColor, fresnelTerm ); + + #ifdef WATER_SPEC + + // Get some specular reflection. + vec3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( bumpNorm ); + half3 halfAng = normalize( eyeVec + -LIGHT_VEC ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + OUT.rgb = OUT.rgb + ( SPEC_COLOR * specular.xxx ); + + #else // Disable fogging if spec is on because otherwise we run out of instructions. + + // Fog it. + float factor = computeSceneFog( eyePos, + IN_objPos.xyz, + WORLD_Z, + fogData.x, + fogData.y, + fogData.z ); + + //OUT.rgb = mix( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + #endif + + OUT_col = hdrEncode( OUT ); + +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicV.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicV.glsl new file mode 100644 index 000000000..e92c948e9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicV.glsl @@ -0,0 +1,243 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +out vec4 rippleTexCoord01; +#define OUT_rippleTexCoord01 rippleTexCoord01 + +// TexCoord 2 for ripple texture lookup +out vec2 rippleTexCoord2; +#define OUT_rippleTexCoord2 rippleTexCoord2 + +// Screenspace vert position BEFORE wave transformation +out vec4 posPreWave; +#define OUT_posPreWave posPreWave + +// Screenspace vert position AFTER wave transformation +out vec4 posPostWave; +#define OUT_posPostWave posPostWave + +// Worldspace unit distance/depth of this vertex/pixel +out float pixelDist; +#define OUT_pixelDist pixelDist + +out vec4 objPos; +#define OUT_objPos objPos + +out vec3 misc; +#define OUT_misc misc + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform mat4 modelMat; +uniform mat4 modelview; +uniform vec4 rippleMat[3]; +uniform vec3 eyePos; +uniform vec2 waveDir[3]; +uniform vec2 waveData[3]; +uniform vec2 rippleDir[3]; +uniform vec2 rippleTexScale[3]; +uniform vec3 rippleSpeed; +uniform vec3 inLightVec; +uniform vec3 reflectNormal; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +in vec4 vPosition; +in vec3 vNormal; +in vec2 vTexCoord0; +in vec4 vTexCoord1; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 IN_position = vPosition; + vec3 IN_normal = vNormal; + vec2 IN_undulateData = vTexCoord0; + vec4 IN_horizonFactor = vTexCoord1; + vec4 OUT_hpos = vec4(0); + + // use projection matrix for reflection / refraction texture coords + mat4 texGen = mat4FromRow( 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 ); + + // Move the vertex based on the horizonFactor if specified to do so for this vert. + // if ( IN_horizonFactor.z > 0 ) + // { + // vec2 offsetXY = eyePos.xy - eyePos.xy % gridElementSize; + // IN_position.xy += offsetXY; + // IN_undulateData += offsetXY; + // } + + vec4 worldPos = tMul( modelMat, IN_position ); + + IN_position.z = mix( IN_position.z, eyePos.z, IN_horizonFactor.x ); + + //OUT_objPos = worldPos; + OUT_objPos.xyz = IN_position.xyz; + OUT_objPos.w = worldPos.z; + + // Send pre-undulation screenspace position + OUT_posPreWave = tMul( modelview, IN_position ); + OUT_posPreWave = tMul( texGen, OUT_posPreWave ); + + // Calculate the undulation amount for this vertex. + vec2 undulatePos = tMul( modelMat, vec4( IN_undulateData.xy, 0, 1 ) ).xy; + //if ( undulatePos.x < 0 ) + // undulatePos = IN_position.xy; + + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN_position.xyz, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN_position.xyz, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + //#endif + //undulateAmt = 0; + + // Apply wave undulation to the vertex. + OUT_posPostWave = IN_position; + OUT_posPostWave.xyz += IN_normal.xyz * undulateAmt; + + // Save worldSpace position of this pixel/vert + //OUT_worldPos = OUT_posPostWave.xyz; + //OUT_worldPos = tMul( modelMat, OUT_posPostWave.xyz ); + //OUT_worldPos.z += objTrans[2][2]; //91.16; + + // OUT_misc.w = tMul( modelMat, OUT_fogPos ).z; + // if ( IN_horizonFactor.x > 0 ) + // { + // vec3 awayVec = normalize( OUT_fogPos.xyz - eyePos ); + // OUT_fogPos.xy += awayVec.xy * 1000.0; + // } + + // Convert to screen + OUT_posPostWave = tMul( modelview, OUT_posPostWave ); // tMul( modelview, vec4( OUT_posPostWave.xyz, 1 ) ); + + // Setup the OUT position symantic variable + OUT_hpos = OUT_posPostWave; // tMul( modelview, vec4( IN_position.xyz, 1 ) ); //vec4( OUT_posPostWave.xyz, 1 ); + //OUT_hpos.z = mix( OUT_hpos.z, OUT_hpos.w, IN_horizonFactor.x ); + + // Save world space camera dist/depth of the outgoing pixel + OUT_pixelDist = OUT_hpos.z; + + // Convert to reflection texture space + OUT_posPostWave = tMul( texGen, OUT_posPostWave ); + + vec2 txPos = undulatePos; + if ( bool(IN_horizonFactor.x) ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT_rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT_rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + mat2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[1][0] = rippleMat[0].y; + texMat[0][1] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT_rippleTexCoord01.xy = tMul( texMat, OUT_rippleTexCoord01.xy ); + + OUT_rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT_rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[1][0] = rippleMat[1].y; + texMat[0][1] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT_rippleTexCoord01.zw = tMul( texMat, OUT_rippleTexCoord01.zw ); + + OUT_rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT_rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[1][0] = rippleMat[2].y; + texMat[0][1] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT_rippleTexCoord2.xy = tMul( texMat, OUT_rippleTexCoord2.xy ); + +#ifdef WATER_SPEC + + vec3 binormal = vec3( 1, 0, 0 ); + vec3 tangent = vec3( 0, 1, 0 ); + vec3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * IN_undulateData.x + waveDir[i].y * IN_undulateData.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * IN_undulateData.x + waveDir[i].y * IN_undulateData.y + elapsedTime * waveData[i].x ); + } + + binormal = normalize( binormal ); + tangent = normalize( tangent ); + normal = cross( binormal, tangent ); + + mat3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + worldToTangent = transpose(worldToTangent); + + OUT_misc.xyz = tMul( inLightVec, modelMat ); + OUT_misc.xyz = tMul( worldToTangent, OUT_misc.xyz ); + +#else + + OUT_misc.xyz = inLightVec; + +#endif + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterP.glsl new file mode 100644 index 000000000..d4804245a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterP.glsl @@ -0,0 +1,396 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/torque.glsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +#define PIXEL_DIST IN_rippleTexCoord2.z +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +// miscParams[2] is unused +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// fogParams +#define FOG_DENSITY fogParams[0] +#define FOG_DENSITY_OFFSET fogParams[1] + +// wetnessParams +#define WET_DEPTH wetnessParams[0] +#define WET_COLOR_FACTOR wetnessParams[1] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// foamParams +#define FOAM_OPACITY foamParams[0] +#define FOAM_MAX_DEPTH foamParams[1] +#define FOAM_AMBIENT_LERP foamParams[2] +#define FOAM_RIPPLE_INFLUENCE foamParams[3] + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +//ConnectData IN + +in vec4 hpos; + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +in vec4 rippleTexCoord01; + +// xy is TexCoord 2 for ripple texture lookup +// z is the Worldspace unit distance/depth of this vertex/pixel +// w is amount of the crestFoam ( more at crest of waves ). +in vec4 rippleTexCoord2; + +// Screenspace vert position BEFORE wave transformation +in vec4 posPreWave; + +// Screenspace vert position AFTER wave transformation +in vec4 posPostWave; + +// Objectspace vert position BEFORE wave transformation +// w coord is world space z position. +in vec4 objPos; + +in vec4 foamTexCoords; + +in mat3 tangentMat; + + +#define IN_hpos hpos +#define IN_rippleTexCoord01 rippleTexCoord01 +#define IN_rippleTexCoord2 rippleTexCoord2 +#define IN_posPreWave posPreWave +#define IN_posPostWave posPostWave +#define IN_objPos objPos +#define IN_foamTexCoords foamTexCoords +#define IN_tangentMat tangentMat + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform sampler2D bumpMap; +uniform sampler2D deferredTex; +uniform sampler2D reflectMap; +uniform sampler2D refractBuff; +uniform samplerCube skyMap; +uniform sampler2D foamMap; +uniform sampler1D depthGradMap; +uniform vec4 specularParams; +uniform vec4 baseColor; +uniform vec4 miscParams; +uniform vec2 fogParams; +uniform vec4 reflectParams; +uniform vec3 reflectNormal; +uniform vec2 wetnessParams; +uniform float farPlaneDist; +uniform vec3 distortionParams; +uniform vec4 foamParams; +uniform vec3 ambientColor; +uniform vec3 eyePos; // This is in object space! +uniform vec3 fogData; +uniform vec4 fogColor; +uniform vec4 rippleMagnitude; +uniform vec4 rtParams1; +uniform float depthGradMax; +uniform vec3 inLightVec; +uniform mat4 modelMat; +uniform vec4 sunColor; +uniform float sunBrightness; +uniform float reflectivity; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Get the bumpNorm... + vec3 bumpNorm = ( texture( bumpMap, IN_rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord2.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = mix( bumpNorm, vec3(0,0,1), 1.0 - rippleMagnitude.w ); + bumpNorm = tMul( bumpNorm, IN_tangentMat ); + + // Get depth of the water surface (this pixel). + // Convert from WorldSpace to EyeSpace. + float pixelDepth = PIXEL_DIST / farPlaneDist; + + vec2 deferredCoord = viewportCoordToRenderTarget( IN_posPostWave, rtParams1 ); + + float startDepth = deferredUncondition( deferredTex, deferredCoord ).w; + + // The water depth in world units of the undistorted pixel. + float startDelta = ( startDepth - pixelDepth ); + startDelta = max( startDelta, 0.0 ); + startDelta *= farPlaneDist; + + // Calculate the distortion amount for the water surface. + // + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + + // Scale down distortion in shallow water. + distortAmt *= saturate( startDelta / DISTORT_FULL_DEPTH ); + + // Do the intial distortion... we might remove it below. + vec2 distortDelta = bumpNorm.xy * distortAmt; + vec4 distortPos = IN_posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + float deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + + float delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + + if ( delta < 0.0 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN_posPostWave; + delta = startDelta; + distortAmt = 0; + } + else + { + float diff = ( deferredDepth - startDepth ) * farPlaneDist; + + if ( diff < 0 ) + { + distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + distortAmt *= saturate( delta / DISTORT_FULL_DEPTH ); + + distortDelta = bumpNorm.xy * distortAmt; + + distortPos = IN_posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + } + + if ( delta < 0.1 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN_posPostWave; + delta = startDelta; + distortAmt = 0; + } + } + + vec4 temp = IN_posPreWave; + temp.xy += bumpNorm.xy * distortAmt; + vec2 reflectCoord = viewportCoordToRenderTarget( temp, rtParams1 ); + + vec2 refractCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + vec4 fakeColor = vec4(ambientColor,1); + vec3 eyeVec = IN_objPos.xyz - eyePos; + eyeVec = tMul( mat3(modelMat), eyeVec ); + eyeVec = tMul( IN_tangentMat, eyeVec ); + vec3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // for verts far from the reflect plane z position + float rplaneDist = abs( REFLECT_PLANE_Z - IN_objPos.w ); + rplaneDist = saturate( ( rplaneDist - 1.0 ) / 2.0 ); + rplaneDist *= ISRIVER; + fakeColorAmt = max( fakeColorAmt, rplaneDist ); + +#ifndef UNDERWATER + + // Get foam color and amount + vec2 foamRippleOffset = bumpNorm.xy * FOAM_RIPPLE_INFLUENCE; + vec4 IN_foamTexCoords = IN_foamTexCoords; + IN_foamTexCoords.xy += foamRippleOffset; + IN_foamTexCoords.zw += foamRippleOffset; + + vec4 foamColor = texture( foamMap, IN_foamTexCoords.xy ); + foamColor += texture( foamMap, IN_foamTexCoords.zw ); + foamColor = saturate( foamColor ); + + // Modulate foam color by ambient color + // so we don't have glowing white foam at night. + foamColor.rgb = mix( foamColor.rgb, ambientColor.rgb, FOAM_AMBIENT_LERP ); + + float foamDelta = saturate( delta / FOAM_MAX_DEPTH ); + float foamAmt = 1 - pow( foamDelta, 2 ); + + // Fade out the foam in very very low depth, + // this improves the shoreline a lot. + float diff = 0.8 - foamAmt; + if ( diff < 0.0 ) + foamAmt -= foamAmt * abs( diff ) / 0.2; + + foamAmt *= FOAM_OPACITY * foamColor.a; + + foamColor.rgb *= FOAM_OPACITY * foamAmt * foamColor.a; + + // Get reflection map color. + vec4 refMapColor = texture( reflectMap, reflectCoord ); + + // If we do not have a reflection texture then we use the cubemap. + refMapColor = mix( refMapColor, texture( skyMap, reflectionVec ), NO_REFLECT ); + + fakeColor = ( texture( skyMap, reflectionVec ) ); + fakeColor.a = 1; + // Combine reflection color and fakeColor. + vec4 reflectColor = mix( refMapColor, fakeColor, fakeColorAmt ); + + // Get refract color + vec4 refractColor = hdrDecode( texture( refractBuff, refractCoord ) ); + + // We darken the refraction color a bit to make underwater + // elements look wet. We fade out this darkening near the + // surface in order to not have hard water edges. + // @param WET_DEPTH The depth in world units at which full darkening will be recieved. + // @param WET_COLOR_FACTOR The refract color is scaled down by this amount when at WET_DEPTH + refractColor.rgb *= 1.0f - ( saturate( delta / WET_DEPTH ) * WET_COLOR_FACTOR ); + + // Add Water fog/haze. + float fogDelta = delta - FOG_DENSITY_OFFSET; + + if ( fogDelta < 0.0 ) + fogDelta = 0.0; + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * fogDelta ) ); + + // Calculate the water "base" color based on depth. + vec4 waterBaseColor = baseColor * texture( depthGradMap, saturate( delta / depthGradMax ) ); + + // Modulate baseColor by the ambientColor. + waterBaseColor *= vec4( ambientColor.rgb, 1 ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + vec4 diffuseColor = mix( refractColor, waterBaseColor, fogAmt ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + + // Scale the frensel strength by fog amount + // so that parts that are very clear get very little reflection. + fresnelTerm *= fogAmt; + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( PIXEL_DIST - 0.1 ); + + fresnelTerm *= reflectivity; + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + vec4 OUT = mix( diffuseColor, reflectColor, fresnelTerm ); + + vec3 lightVec = inLightVec; + + // Get some specular reflection. + vec3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( newbump ); + vec3 halfAng = normalize( eyeVec + -lightVec ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + // Scale down specularity in very shallow water to improve the transparency of the shoreline. + specular *= saturate( delta / 2 ); + OUT.rgb = OUT.rgb + ( SPEC_COLOR * vec3(specular) ); + +#else + + vec4 refractColor = hdrDecode( texture( refractBuff, refractCoord ) ); + vec4 OUT = refractColor; + +#endif + +#ifndef UNDERWATER + + OUT.rgb = OUT.rgb + foamColor.rgb; + + float factor = computeSceneFog( eyePos, + IN_objPos.xyz, + IN_objPos.w, + fogData.x, + fogData.y, + fogData.z ); + + OUT.rgb = mix( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + //OUT.rgb = fogColor.rgb; + +#endif + + OUT.a = 1.0; + + //return OUT; + + OUT_col = hdrEncode( OUT ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterV.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterV.glsl new file mode 100644 index 000000000..490af63a7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterV.glsl @@ -0,0 +1,241 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + vec4 position ;// POSITION; + vec3 normal ;// NORMAL; + vec2 undulateData ;// TEXCOORD0; + vec4 horizonFactor ;// TEXCOORD1; +}; + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- +//VertData IN +in vec4 vPosition; +in vec3 vNormal; +in vec2 vTexCoord0; +in vec4 vTexCoord1; + +#define IN_position_ vPosition +#define IN_normal vNormal +#define IN_undulateData vTexCoord0 +#define IN_horizonFactor vTexCoord1 + +//ConnectData OUT +// + out vec4 hpos ; + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +out vec4 rippleTexCoord01; + + // xy is TexCoord 2 for ripple texture lookup + // z is the Worldspace unit distance/depth of this vertex/pixel + // w is amount of the crestFoam ( more at crest of waves ). + out vec4 rippleTexCoord2 ; + +// Screenspace vert position BEFORE wave transformation +out vec4 posPreWave; + +// Screenspace vert position AFTER wave transformation +out vec4 posPostWave; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + out vec4 objPos ; + + out vec4 foamTexCoords ; + + out mat3 tangentMat ; +// + +#define OUT_hpos hpos +#define OUT_rippleTexCoord01 rippleTexCoord01 +#define OUT_rippleTexCoord2 rippleTexCoord2 +#define OUT_posPreWave posPreWave +#define OUT_posPostWave posPostWave +#define OUT_objPos objPos +#define OUT_foamTexCoords foamTexCoords +#define OUT_tangentMat tangentMat + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform mat4 modelMat; +uniform mat4 modelview; +uniform vec4 rippleMat[3]; +uniform vec3 eyePos; +uniform vec2 waveDir[3]; +uniform vec2 waveData[3]; +uniform vec2 rippleDir[3]; +uniform vec2 rippleTexScale[3]; +uniform vec3 rippleSpeed; +uniform vec4 foamDir; +uniform vec4 foamTexScale; +uniform vec2 foamSpeed; +uniform vec3 inLightVec; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 IN_position = IN_position_; + + // use projection matrix for reflection / refraction texture coords + mat4 texGen = mat4FromRow( 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 ); + + IN_position.z = mix( IN_position.z, eyePos.z, IN_horizonFactor.x ); + + OUT_objPos = IN_position; + OUT_objPos.w = tMul( modelMat, IN_position ).z; + + // Send pre-undulation screenspace position + OUT_posPreWave = tMul( modelview, IN_position ); + OUT_posPreWave = tMul( texGen, OUT_posPreWave ); + + // Calculate the undulation amount for this vertex. + vec2 undulatePos = tMul( modelMat, vec4 ( IN_undulateData.xy, 0, 1 ) ).xy; + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN_position.xyz, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN_position.xyz, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + OUT_rippleTexCoord2.w = undulateAmt / ( waveData[0].y + waveData[1].y + waveData[2].y ); + OUT_rippleTexCoord2.w = saturate( OUT_rippleTexCoord2.w - 0.2 ) / 0.8; + + // Apply wave undulation to the vertex. + OUT_posPostWave = IN_position; + OUT_posPostWave.xyz += IN_normal.xyz * undulateAmt; + + // Convert to screen + OUT_posPostWave = tMul( modelview, OUT_posPostWave ); + + // Setup the OUT position symantic variable + OUT_hpos = OUT_posPostWave; + //OUT_hpos.z = mix( OUT_hpos.z, OUT_hpos.w, IN_horizonFactor.x ); + + // if ( IN_horizonFactor.x > 0 ) + // { + // vec3 awayVec = normalize( OUT_objPos.xyz - eyePos ); + // OUT_objPos.xy += awayVec.xy * 1000.0; + // } + + // Save world space camera dist/depth of the outgoing pixel + OUT_rippleTexCoord2.z = OUT_hpos.z; + + // Convert to reflection texture space + OUT_posPostWave = tMul( texGen, OUT_posPostWave ); + + vec2 txPos = undulatePos; + if ( bool(IN_horizonFactor.x) ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT_rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT_rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + mat2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[1][0] = rippleMat[0].y; + texMat[0][1] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT_rippleTexCoord01.xy = tMul( texMat, OUT_rippleTexCoord01.xy ); + + OUT_rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT_rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[1][0] = rippleMat[1].y; + texMat[0][1] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT_rippleTexCoord01.zw = tMul( texMat, OUT_rippleTexCoord01.zw ); + + OUT_rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT_rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[1][0] = rippleMat[2].y; + texMat[0][1] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT_rippleTexCoord2.xy = tMul( texMat, OUT_rippleTexCoord2.xy ); + + OUT_foamTexCoords.xy = txPos * foamTexScale.xy + foamDir.xy * foamSpeed.x * elapsedTime; + OUT_foamTexCoords.zw = txPos * foamTexScale.zw + foamDir.zw * foamSpeed.y * elapsedTime; + + + vec3 binormal = vec3 ( 1, 0, 0 ); + vec3 tangent = vec3 ( 0, 1, 0 ); + vec3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + } + + binormal = binormal; + tangent = tangent; + normal = cross( binormal, tangent ); + + mat3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + OUT_tangentMat = transpose(worldToTangent); + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicP.hlsl new file mode 100644 index 000000000..9cacfdf7a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicP.hlsl @@ -0,0 +1,213 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../torque.hlsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +#define CLARITY miscParams[2] +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// ConnectData.misc +#define LIGHT_VEC IN.misc.xyz +#define WORLD_Z IN.objPos.w + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // TexCoord 2 for ripple texture lookup + float2 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Worldspace unit distance/depth of this vertex/pixel + float pixelDist : TEXCOORD4; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD5; + + float3 misc : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); +//uniform sampler2D deferredTex : register( S1 ); +TORQUE_UNIFORM_SAMPLER2D(reflectMap,2); +TORQUE_UNIFORM_SAMPLER2D(refractBuff,3); +TORQUE_UNIFORM_SAMPLERCUBE(skyMap,4); +//uniform sampler foamMap : register( S5 ); +uniform float4 baseColor; +uniform float4 miscParams; +uniform float4 reflectParams; +uniform float3 ambientColor; +uniform float3 eyePos; +uniform float3 distortionParams; +uniform float3 fogData; +uniform float4 fogColor; +uniform float4 rippleMagnitude; +uniform float4 specularParams; +uniform float4x4 modelMat; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // Modulate baseColor by the ambientColor. + float4 waterBaseColor = baseColor * float4( ambientColor.rgb, 1 ); + + // Get the bumpNorm... + float3 bumpNorm = ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord2 ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = lerp( bumpNorm, float3(0,0,1), 1.0 - rippleMagnitude.w ); + + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( IN.pixelDist / 1.0 ) * 0.8; + + float4 distortPos = IN.posPostWave; + distortPos.xy += bumpNorm.xy * distortAmt; + + #ifdef UNDERWATER + return hdrEncode( TORQUE_TEX2DPROJ( refractBuff, distortPos ) ); + #else + + float3 eyeVec = IN.objPos.xyz - eyePos; + eyeVec = mul( (float3x3)modelMat, eyeVec ); + float3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Color that replaces the reflection color when we do not + // have one that is appropriate. + float4 fakeColor = float4(ambientColor,1); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // Get reflection map color + float4 refMapColor = hdrDecode( TORQUE_TEX2DPROJ( reflectMap, distortPos ) ); + // If we do not have a reflection texture then we use the cubemap. + refMapColor = lerp( refMapColor, TORQUE_TEXCUBE( skyMap, reflectionVec ), NO_REFLECT ); + + // Combine reflection color and fakeColor. + float4 reflectColor = lerp( refMapColor, fakeColor, fakeColorAmt ); + //return refMapColor; + + // Get refract color + float4 refractColor = hdrDecode( TORQUE_TEX2DPROJ( refractBuff, distortPos ) ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + float4 diffuseColor = lerp( refractColor, waterBaseColor, 1.0f - CLARITY ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + //return float4( fresnelTerm.rrr, 1 ); + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( IN.pixelDist - 0.1 ); + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + float4 OUT = lerp( diffuseColor, reflectColor, fresnelTerm ); + + #ifdef WATER_SPEC + + // Get some specular reflection. + float3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( bumpNorm ); + half3 halfAng = normalize( eyeVec + -LIGHT_VEC ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + OUT.rgb = OUT.rgb + ( SPEC_COLOR * specular.xxx ); + + #else // Disable fogging if spec is on because otherwise we run out of instructions. + + // Fog it. + float factor = computeSceneFog( eyePos, + IN.objPos.xyz, + WORLD_Z, + fogData.x, + fogData.y, + fogData.z ); + + //OUT.rgb = lerp( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + #endif + + return hdrEncode( OUT ); + +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicV.hlsl new file mode 100644 index 000000000..310647c90 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicV.hlsl @@ -0,0 +1,237 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 undulateData : TEXCOORD0; + float4 horizonFactor : TEXCOORD1; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // TexCoord 2 for ripple texture lookup + float2 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Worldspace unit distance/depth of this vertex/pixel + float pixelDist : TEXCOORD4; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD5; + + float3 misc : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform float4x4 modelMat; +uniform float4x4 modelview; +uniform float4 rippleMat[3]; +uniform float3 eyePos; +uniform float2 waveDir[3]; +uniform float2 waveData[3]; +uniform float2 rippleDir[3]; +uniform float2 rippleTexScale[3]; +uniform float3 rippleSpeed; +uniform float3 inLightVec; +uniform float3 reflectNormal; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + // use projection matrix for reflection / refraction texture coords + float4x4 texGen = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + // Move the vertex based on the horizonFactor if specified to do so for this vert. + // if ( IN.horizonFactor.z > 0 ) + // { + // float2 offsetXY = eyePos.xy - eyePos.xy % gridElementSize; + // IN.position.xy += offsetXY; + // IN.undulateData += offsetXY; + // } + float4 inPos = float4(IN.position, 1.0); + float4 worldPos = mul(modelMat, inPos); + + IN.position.z = lerp( IN.position.z, eyePos.z, IN.horizonFactor.x ); + + //OUT.objPos = worldPos; + OUT.objPos.xyz = IN.position; + OUT.objPos.w = worldPos.z; + + // Send pre-undulation screenspace position + OUT.posPreWave = mul( modelview, inPos ); + OUT.posPreWave = mul( texGen, OUT.posPreWave ); + + // Calculate the undulation amount for this vertex. + float2 undulatePos = mul( modelMat, float4( IN.undulateData.xy, 0, 1 )).xy; + //if ( undulatePos.x < 0 ) + // undulatePos = IN.position.xy; + + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN.position, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN.position, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + //#endif + //undulateAmt = 0; + + // Apply wave undulation to the vertex. + OUT.posPostWave = inPos; + OUT.posPostWave.xyz += IN.normal.xyz * undulateAmt; + + // Save worldSpace position of this pixel/vert + //OUT.worldPos = OUT.posPostWave.xyz; + //OUT.worldPos = mul( modelMat, OUT.posPostWave.xyz ); + //OUT.worldPos.z += objTrans[2][2]; //91.16; + + // OUT.misc.w = mul( modelMat, OUT.fogPos ).z; + // if ( IN.horizonFactor.x > 0 ) + // { + // float3 awayVec = normalize( OUT.fogPos.xyz - eyePos ); + // OUT.fogPos.xy += awayVec.xy * 1000.0; + // } + + // Convert to screen + OUT.posPostWave = mul( modelview, OUT.posPostWave ); // mul( modelview, float4( OUT.posPostWave.xyz, 1 ) ); + + // Setup the OUT position symantic variable + OUT.hpos = OUT.posPostWave; // mul( modelview, float4( IN.position.xyz, 1 ) ); //float4( OUT.posPostWave.xyz, 1 ); + //OUT.hpos.z = lerp( OUT.hpos.z, OUT.hpos.w, IN.horizonFactor.x ); + + // Save world space camera dist/depth of the outgoing pixel + OUT.pixelDist = OUT.hpos.z; + + // Convert to reflection texture space + OUT.posPostWave = mul( texGen, OUT.posPostWave ); + + float2 txPos = undulatePos; + if ( IN.horizonFactor.x ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT.rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT.rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + float2x2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[0][1] = rippleMat[0].y; + texMat[1][0] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT.rippleTexCoord01.xy = mul( texMat, OUT.rippleTexCoord01.xy ); + + OUT.rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT.rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[0][1] = rippleMat[1].y; + texMat[1][0] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT.rippleTexCoord01.zw = mul( texMat, OUT.rippleTexCoord01.zw ); + + OUT.rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT.rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[0][1] = rippleMat[2].y; + texMat[1][0] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT.rippleTexCoord2.xy = mul( texMat, OUT.rippleTexCoord2.xy ); + +#ifdef WATER_SPEC + + float3 binormal = float3( 1, 0, 0 ); + float3 tangent = float3( 0, 1, 0 ); + float3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * IN.undulateData.x + waveDir[i].y * IN.undulateData.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * IN.undulateData.x + waveDir[i].y * IN.undulateData.y + elapsedTime * waveData[i].x ); + } + + binormal = normalize( binormal ); + tangent = normalize( tangent ); + normal = cross( binormal, tangent ); + + float3x3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + OUT.misc.xyz = mul( inLightVec, modelMat ); + OUT.misc.xyz = mul( worldToTangent, OUT.misc.xyz ); + +#else + + OUT.misc.xyz = inLightVec; + +#endif + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterP.hlsl new file mode 100644 index 000000000..59bdad05d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterP.hlsl @@ -0,0 +1,383 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModelAutoGen.hlsl" +#include "../torque.hlsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +#define PIXEL_DIST IN.rippleTexCoord2.z +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +// miscParams[2] is unused +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// fogParams +#define FOG_DENSITY fogParams[0] +#define FOG_DENSITY_OFFSET fogParams[1] + +// wetnessParams +#define WET_DEPTH wetnessParams[0] +#define WET_COLOR_FACTOR wetnessParams[1] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// foamParams +#define FOAM_OPACITY foamParams[0] +#define FOAM_MAX_DEPTH foamParams[1] +#define FOAM_AMBIENT_LERP foamParams[2] +#define FOAM_RIPPLE_INFLUENCE foamParams[3] + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // xy is TexCoord 2 for ripple texture lookup + // z is the Worldspace unit distance/depth of this vertex/pixel + // w is amount of the crestFoam ( more at crest of waves ). + float4 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD4; + + float4 foamTexCoords : TEXCOORD5; + + float3x3 tangentMat : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); +TORQUE_UNIFORM_SAMPLER2D(reflectMap, 2); +TORQUE_UNIFORM_SAMPLER2D(refractBuff, 3); +TORQUE_UNIFORM_SAMPLERCUBE(skyMap, 4); +TORQUE_UNIFORM_SAMPLER2D(foamMap, 5); +TORQUE_UNIFORM_SAMPLER1D(depthGradMap, 6); +uniform float4 specularParams; +uniform float4 baseColor; +uniform float4 miscParams; +uniform float2 fogParams; +uniform float4 reflectParams; +uniform float3 reflectNormal; +uniform float2 wetnessParams; +uniform float farPlaneDist; +uniform float3 distortionParams; +uniform float4 foamParams; +uniform float3 ambientColor; +uniform float3 eyePos; // This is in object space! +uniform float3 fogData; +uniform float4 fogColor; +uniform float4 rippleMagnitude; +uniform float4 rtParams1; +uniform float depthGradMax; +uniform float3 inLightVec; +uniform float4x4 modelMat; +uniform float4 sunColor; +uniform float sunBrightness; +uniform float reflectivity; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // Get the bumpNorm... + float3 bumpNorm = ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord2.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = lerp( bumpNorm, float3(0,0,1), 1.0 - rippleMagnitude.w ); + bumpNorm = mul( bumpNorm, IN.tangentMat ); + + // Get depth of the water surface (this pixel). + // Convert from WorldSpace to EyeSpace. + float pixelDepth = PIXEL_DIST / farPlaneDist; + + float2 deferredCoord = viewportCoordToRenderTarget( IN.posPostWave, rtParams1 ); + + float startDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w; + + // The water depth in world units of the undistorted pixel. + float startDelta = ( startDepth - pixelDepth ); + startDelta = max( startDelta, 0.0 ); + startDelta *= farPlaneDist; + + // Calculate the distortion amount for the water surface. + // + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + + // Scale down distortion in shallow water. + distortAmt *= saturate( startDelta / DISTORT_FULL_DEPTH ); + + // Do the intial distortion... we might remove it below. + float2 distortDelta = bumpNorm.xy * distortAmt; + float4 distortPos = IN.posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + float deferredDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + + float delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + + if ( delta < 0.0 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN.posPostWave; + delta = startDelta; + distortAmt = 0; + } + else + { + float diff = ( deferredDepth - startDepth ) * farPlaneDist; + + if ( diff < 0 ) + { + distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + distortAmt *= saturate( delta / DISTORT_FULL_DEPTH ); + + distortDelta = bumpNorm.xy * distortAmt; + + distortPos = IN.posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + deferredDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + } + + if ( delta < 0.1 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN.posPostWave; + delta = startDelta; + distortAmt = 0; + } + } + + float4 temp = IN.posPreWave; + temp.xy += bumpNorm.xy * distortAmt; + float2 reflectCoord = viewportCoordToRenderTarget( temp, rtParams1 ); + + float2 refractCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + float4 fakeColor = float4(ambientColor,1); + float3 eyeVec = IN.objPos.xyz - eyePos; + eyeVec = mul( (float3x3)modelMat, eyeVec ); + eyeVec = mul( IN.tangentMat, eyeVec ); + float3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // for verts far from the reflect plane z position + float rplaneDist = abs( REFLECT_PLANE_Z - IN.objPos.w ); + rplaneDist = saturate( ( rplaneDist - 1.0 ) / 2.0 ); + rplaneDist *= ISRIVER; + fakeColorAmt = max( fakeColorAmt, rplaneDist ); + +#ifndef UNDERWATER + + // Get foam color and amount + float2 foamRippleOffset = bumpNorm.xy * FOAM_RIPPLE_INFLUENCE; + IN.foamTexCoords.xy += foamRippleOffset; + IN.foamTexCoords.zw += foamRippleOffset; + + float4 foamColor = TORQUE_TEX2D( foamMap, IN.foamTexCoords.xy ); + foamColor += TORQUE_TEX2D( foamMap, IN.foamTexCoords.zw ); + foamColor = saturate( foamColor ); + + // Modulate foam color by ambient color + // so we don't have glowing white foam at night. + foamColor.rgb = lerp( foamColor.rgb, ambientColor.rgb, FOAM_AMBIENT_LERP ); + + float foamDelta = saturate( delta / FOAM_MAX_DEPTH ); + float foamAmt = 1 - pow( foamDelta, 2 ); + + // Fade out the foam in very very low depth, + // this improves the shoreline a lot. + float diff = 0.8 - foamAmt; + if ( diff < 0.0 ) + foamAmt -= foamAmt * abs( diff ) / 0.2; + + foamAmt *= FOAM_OPACITY * foamColor.a; + + foamColor.rgb *= FOAM_OPACITY * foamAmt * foamColor.a; + + // Get reflection map color. + float4 refMapColor = TORQUE_TEX2D( reflectMap, reflectCoord ); + + // If we do not have a reflection texture then we use the cubemap. + refMapColor = lerp( refMapColor, TORQUE_TEXCUBE( skyMap, reflectionVec ), NO_REFLECT ); + + fakeColor = ( TORQUE_TEXCUBE( skyMap, reflectionVec ) ); + fakeColor.a = 1; + // Combine reflection color and fakeColor. + float4 reflectColor = lerp( refMapColor, fakeColor, fakeColorAmt ); + + // Get refract color + float4 refractColor = hdrDecode( TORQUE_TEX2D( refractBuff, refractCoord ) ); + + // We darken the refraction color a bit to make underwater + // elements look wet. We fade out this darkening near the + // surface in order to not have hard water edges. + // @param WET_DEPTH The depth in world units at which full darkening will be recieved. + // @param WET_COLOR_FACTOR The refract color is scaled down by this amount when at WET_DEPTH + refractColor.rgb *= 1.0f - ( saturate( delta / WET_DEPTH ) * WET_COLOR_FACTOR ); + + // Add Water fog/haze. + float fogDelta = delta - FOG_DENSITY_OFFSET; + + if ( fogDelta < 0.0 ) + fogDelta = 0.0; + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * fogDelta ) ); + + // Calculate the water "base" color based on depth. + float4 waterBaseColor = baseColor * TORQUE_TEX1D( depthGradMap, saturate( delta / depthGradMax ) ); + + // Modulate baseColor by the ambientColor. + waterBaseColor *= float4( ambientColor.rgb, 1 ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + float4 diffuseColor = lerp( refractColor, waterBaseColor, fogAmt ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + + // Scale the frensel strength by fog amount + // so that parts that are very clear get very little reflection. + fresnelTerm *= fogAmt; + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( PIXEL_DIST - 0.1 ); + + fresnelTerm *= reflectivity; + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + float4 OUT = lerp( diffuseColor, reflectColor, fresnelTerm ); + + float3 lightVec = inLightVec; + + // Get some specular reflection. + float3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( newbump ); + float3 halfAng = normalize( eyeVec + -lightVec ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + // Scale down specularity in very shallow water to improve the transparency of the shoreline. + specular *= saturate( delta / 2 ); + OUT.rgb = OUT.rgb + ( SPEC_COLOR * specular.xxx ); + +#else + + float4 refractColor = hdrDecode( TORQUE_TEX2D( refractBuff, refractCoord ) ); + float4 OUT = refractColor; + +#endif + +#ifndef UNDERWATER + + OUT.rgb = OUT.rgb + foamColor.rgb; + + float factor = computeSceneFog( eyePos, + IN.objPos.xyz, + IN.objPos.w, + fogData.x, + fogData.y, + fogData.z ); + + OUT.rgb = lerp( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + //OUT.rgb = fogColor.rgb; + +#endif + + OUT.a = 1.0; + + //return OUT; + + return hdrEncode( OUT ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterV.hlsl new file mode 100644 index 000000000..c869f0e9f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterV.hlsl @@ -0,0 +1,216 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 undulateData : TEXCOORD0; + float4 horizonFactor : TEXCOORD1; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // xy is TexCoord 2 for ripple texture lookup + // z is the Worldspace unit distance/depth of this vertex/pixel + // w is amount of the crestFoam ( more at crest of waves ). + float4 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD4; + + float4 foamTexCoords : TEXCOORD5; + + float3x3 tangentMat : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform float4x4 modelMat; +uniform float4x4 modelview; +uniform float4 rippleMat[3]; +uniform float3 eyePos; +uniform float2 waveDir[3]; +uniform float2 waveData[3]; +uniform float2 rippleDir[3]; +uniform float2 rippleTexScale[3]; +uniform float3 rippleSpeed; +uniform float4 foamDir; +uniform float4 foamTexScale; +uniform float2 foamSpeed; +uniform float3 inLightVec; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + // use projection matrix for reflection / refraction texture coords + float4x4 texGen = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + IN.position.z = lerp( IN.position.z, eyePos.z, IN.horizonFactor.x ); + float4 inPos = float4( IN.position, 1.0); + OUT.objPos = inPos; + OUT.objPos.w = mul( modelMat, inPos ).z; + + // Send pre-undulation screenspace position + OUT.posPreWave = mul( modelview, inPos ); + OUT.posPreWave = mul( texGen, OUT.posPreWave ); + + // Calculate the undulation amount for this vertex. + float2 undulatePos = mul( modelMat, float4( IN.undulateData.xy, 0, 1 ) ).xy; + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN.position.xyz, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN.position.xyz, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + OUT.rippleTexCoord2.w = undulateAmt / ( waveData[0].y + waveData[1].y + waveData[2].y ); + OUT.rippleTexCoord2.w = saturate( OUT.rippleTexCoord2.w - 0.2 ) / 0.8; + + // Apply wave undulation to the vertex. + OUT.posPostWave = inPos; + OUT.posPostWave.xyz += IN.normal.xyz * undulateAmt; + + // Convert to screen + OUT.posPostWave = mul( modelview, OUT.posPostWave ); + + // Setup the OUT position symantic variable + OUT.hpos = OUT.posPostWave; + //OUT.hpos.z = lerp( OUT.hpos.z, OUT.hpos.w, IN.horizonFactor.x ); + + // if ( IN.horizonFactor.x > 0 ) + // { + // float3 awayVec = normalize( OUT.objPos.xyz - eyePos ); + // OUT.objPos.xy += awayVec.xy * 1000.0; + // } + + // Save world space camera dist/depth of the outgoing pixel + OUT.rippleTexCoord2.z = OUT.hpos.z; + + // Convert to reflection texture space + OUT.posPostWave = mul( texGen, OUT.posPostWave ); + + float2 txPos = undulatePos; + if ( IN.horizonFactor.x ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT.rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT.rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + float2x2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[0][1] = rippleMat[0].y; + texMat[1][0] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT.rippleTexCoord01.xy = mul( texMat, OUT.rippleTexCoord01.xy ); + + OUT.rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT.rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[0][1] = rippleMat[1].y; + texMat[1][0] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT.rippleTexCoord01.zw = mul( texMat, OUT.rippleTexCoord01.zw ); + + OUT.rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT.rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[0][1] = rippleMat[2].y; + texMat[1][0] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT.rippleTexCoord2.xy = mul( texMat, OUT.rippleTexCoord2.xy ); + + OUT.foamTexCoords.xy = txPos * foamTexScale.xy + foamDir.xy * foamSpeed.x * elapsedTime; + OUT.foamTexCoords.zw = txPos * foamTexScale.zw + foamDir.zw * foamSpeed.y * elapsedTime; + + + float3 binormal = float3( 1, 0, 0 ); + float3 tangent = float3( 0, 1, 0 ); + float3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + } + + binormal = binormal; + tangent = tangent; + normal = cross( binormal, tangent ); + + float3x3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + OUT.tangentMat = worldToTangent; + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/wavesP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/wavesP.hlsl new file mode 100644 index 000000000..c51eb4b89 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/wavesP.hlsl @@ -0,0 +1,89 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "shdrConsts.h" +#include "shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +struct v2f +{ + float4 HPOS : TORQUE_POSITION; + float2 TEX0 : TEXCOORD0; + float4 tangentToCube0 : TEXCOORD1; + float4 tangentToCube1 : TEXCOORD2; + float4 tangentToCube2 : TEXCOORD3; + float4 lightVec : TEXCOORD4; + float3 pixPos : TEXCOORD5; + float3 eyePos : TEXCOORD6; +}; + + + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +// Uniforms +TORQUE_UNIFORM_SAMPLER2D(diffMap,0); +//TORQUE_UNIFORM_SAMPLERCUBE(cubeMap, 1); not used? +TORQUE_UNIFORM_SAMPLER2D(bumpMap,2); + +uniform float4 specularColor : register(PC_MAT_SPECCOLOR); +uniform float4 ambient : register(PC_AMBIENT_COLOR); +uniform float specularPower : register(PC_MAT_SPECPOWER); +uniform float accumTime : register(PC_ACCUM_TIME); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main(v2f IN) +{ + Fragout OUT; + + float2 texOffset; + float sinOffset1 = sin( accumTime * 1.5 + IN.TEX0.y * 6.28319 * 3.0 ) * 0.03; + float sinOffset2 = sin( accumTime * 3.0 + IN.TEX0.y * 6.28319 ) * 0.04; + + texOffset.x = IN.TEX0.x + sinOffset1 + sinOffset2; + texOffset.y = IN.TEX0.y + cos( accumTime * 3.0 + IN.TEX0.x * 6.28319 * 2.0 ) * 0.05; + + + float4 bumpNorm = TORQUE_TEX2D( bumpMap, texOffset ) * 2.0 - 1.0; + float4 diffuse = TORQUE_TEX2D( diffMap, texOffset ); + + OUT.col = diffuse * (saturate( dot( IN.lightVec, bumpNorm.xyz ) ) + ambient); + + float3 eyeVec = normalize(IN.eyePos - IN.pixPos); + float3 halfAng = normalize(eyeVec + IN.lightVec.xyz); + float specular = saturate( dot(bumpNorm, halfAng) ) * IN.lightVec.w; + specular = pow(abs(specular), specularPower); + OUT.col += specularColor * specular; + + + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/wavesV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/wavesV.hlsl new file mode 100644 index 000000000..fccef9d25 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/wavesV.hlsl @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "shdrConsts.h" +#include "hlslStructs.hlsl" + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +struct Conn +{ + float4 HPOS : POSITION; + float2 TEX0 : TEXCOORD0; + float4 tangentToCube0 : TEXCOORD1; + float4 tangentToCube1 : TEXCOORD2; + float4 tangentToCube2 : TEXCOORD3; + float4 outLightVec : TEXCOORD4; + float3 pos : TEXCOORD5; + float3 outEyePos : TEXCOORD6; + +}; + + +uniform float4x4 modelview : register(VC_WORLD_PROJ); +uniform float3x3 cubeTrans : register(VC_CUBE_TRANS); +uniform float3 cubeEyePos : register(VC_CUBE_EYE_POS); +uniform float3 inLightVec : register(VC_LIGHT_DIR1); +uniform float3 eyePos : register(VC_EYE_POS); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Conn main( VertexIn_PNTTTB In) +{ + Conn Out; + + Out.HPOS = mul(modelview, float4(In.pos,1.0)); + Out.TEX0 = In.uv0; + + + float3x3 objToTangentSpace; + objToTangentSpace[0] = In.T; + objToTangentSpace[1] = In.B; + objToTangentSpace[2] = In.normal; + + + Out.tangentToCube0.xyz = mul( objToTangentSpace, cubeTrans[0].xyz ); + Out.tangentToCube1.xyz = mul( objToTangentSpace, cubeTrans[1].xyz ); + Out.tangentToCube2.xyz = mul( objToTangentSpace, cubeTrans[2].xyz ); + + float3 pos = mul( cubeTrans, In.pos ).xyz; + float3 eye = cubeEyePos - pos; + normalize( eye ); + + Out.tangentToCube0.w = eye.x; + Out.tangentToCube1.w = eye.y; + Out.tangentToCube2.w = eye.z; + + Out.outLightVec.xyz = -inLightVec; + Out.outLightVec.xyz = mul(objToTangentSpace, Out.outLightVec); + Out.pos = mul(objToTangentSpace, In.pos.xyz / 100.0); + Out.outEyePos.xyz = mul(objToTangentSpace, eyePos.xyz / 100.0); + Out.outLightVec.w = step( 0.0, dot( -inLightVec, In.normal ) ); + + + return Out; +} + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/wind.hlsl b/Templates/BaseGame/game/core/rendering/shaders/wind.hlsl new file mode 100644 index 000000000..b3fee7721 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/wind.hlsl @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// +// A tip of the hat.... +// +// The following wind effects were derived from the GPU Gems +// 3 chapter "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa of Crytek. +// + +float4 smoothCurve( float4 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +float4 triangleWave( float4 x ) +{ + return abs( frac( x + 0.5 ) * 2.0 - 1.0 ); +} + +float4 smoothTriangleWave( float4 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +float3 windTrunkBending( float3 vPos, float2 vWind, float fBendFactor ) +{ + // Smooth the bending factor and increase + // the near by height limit. + fBendFactor += 1.0; + fBendFactor *= fBendFactor; + fBendFactor = fBendFactor * fBendFactor - fBendFactor; + + // Displace the vert. + float3 vNewPos = vPos; + vNewPos.xy += vWind * fBendFactor; + + // Limit the length which makes the bend more + // spherical and prevents stretching. + float fLength = length( vPos ); + vPos = normalize( vNewPos ) * fLength; + + return vPos; +} + +float3 windBranchBending( float3 vPos, + float3 vNormal, + + float fTime, + float fWindSpeed, + + float fBranchPhase, + float fBranchAmp, + float fBranchAtten, + + float fDetailPhase, + float fDetailAmp, + float fDetailFreq, + + float fEdgeAtten ) +{ + float fVertPhase = dot( vPos, fDetailPhase + fBranchPhase ); + + float2 vWavesIn = fTime + float2( fVertPhase, fBranchPhase ); + + float4 vWaves = ( frac( vWavesIn.xxyy * + float4( 1.975, 0.793, 0.375, 0.193 ) ) * + 2.0 - 1.0 ) * fWindSpeed * fDetailFreq; + + vWaves = smoothTriangleWave( vWaves ); + + float2 vWavesSum = vWaves.xz + vWaves.yw; + + // We want the branches to bend both up and down. + vWavesSum.y = 1 - ( vWavesSum.y * 2 ); + + vPos += vWavesSum.xxy * float3( fEdgeAtten * fDetailAmp * vNormal.xy, + fBranchAtten * fBranchAmp ); + + return vPos; +} diff --git a/Templates/BaseGame/game/core/sfx/Core_SFX.cs b/Templates/BaseGame/game/core/sfx/Core_SFX.cs new file mode 100644 index 000000000..acd5c6e08 --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/Core_SFX.cs @@ -0,0 +1,15 @@ + +function Core_SFX::onCreate(%this) +{ + exec("./scripts/audio.cs"); + exec("./scripts/audioData.cs"); + exec("./scripts/audioAmbience.cs"); + exec("./scripts/audioDescriptions.cs"); + exec("./scripts/audioEnvironments.cs"); + exec("./scripts/audioStates.cs"); + +} + +function Core_SFX::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/sfx/Core_SFX.module b/Templates/BaseGame/game/core/sfx/Core_SFX.module new file mode 100644 index 000000000..855fe2a11 --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/Core_SFX.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/sfx/scripts/audio.cs b/Templates/BaseGame/game/core/sfx/scripts/audio.cs new file mode 100644 index 000000000..a5932de8f --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audio.cs @@ -0,0 +1,436 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Source groups. +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioMaster ); +singleton SFXSource( AudioChannelMaster ) +{ + description = AudioMaster; +}; + +singleton SFXDescription( AudioChannel ) +{ + sourceGroup = AudioChannelMaster; +}; + +singleton SFXSource( AudioChannelDefault ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelGui ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelEffects ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelMessages ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelMusic ) +{ + description = AudioChannel; +}; + +// Set default playback states of the channels. + +AudioChannelMaster.play(); +AudioChannelDefault.play(); + +AudioChannelGui.play(); +AudioChannelMusic.play(); +AudioChannelMessages.play(); + +// Stop in-game effects channels. +AudioChannelEffects.stop(); + +//----------------------------------------------------------------------------- +// Master SFXDescriptions. +//----------------------------------------------------------------------------- + +// Master description for interface audio. +singleton SFXDescription( AudioGui ) +{ + volume = 1.0; + sourceGroup = AudioChannelGui; +}; + +// Master description for game effects audio. +singleton SFXDescription( AudioEffect ) +{ + volume = 1.0; + sourceGroup = AudioChannelEffects; +}; + +// Master description for audio in notifications. +singleton SFXDescription( AudioMessage ) +{ + volume = 1.0; + sourceGroup = AudioChannelMessages; +}; + +// Master description for music. +singleton SFXDescription( AudioMusic ) +{ + volume = 1.0; + sourceGroup = AudioChannelMusic; +}; + +//----------------------------------------------------------------------------- +// SFX Functions. +//----------------------------------------------------------------------------- + +/// This initializes the sound system device from +/// the defaults in the $pref::SFX:: globals. +function sfxStartup() +{ + echo( "\nsfxStartup..." ); + + // If we have a provider set, try initialize a device now. + + if( $pref::SFX::provider !$= "" ) + { + if( sfxInit() ) + return; + else + { + // Force auto-detection. + $pref::SFX::autoDetect = true; + } + } + + // If enabled autodetect a safe device. + + if( ( !isDefined( "$pref::SFX::autoDetect" ) || $pref::SFX::autoDetect ) && + sfxAutodetect() ) + return; + + // Failure. + + error( " Failed to initialize device!\n\n" ); + + $pref::SFX::provider = ""; + $pref::SFX::device = ""; + + return; +} + + +/// This initializes the sound system device from +/// the defaults in the $pref::SFX:: globals. +function sfxInit() +{ + // If already initialized, shut down the current device first. + + if( sfxGetDeviceInfo() !$= "" ) + sfxShutdown(); + + // Start it up! + %maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers; + if ( !sfxCreateDevice( $pref::SFX::provider, $pref::SFX::device, $pref::SFX::useHardware, %maxBuffers ) ) + return false; + + // This returns a tab seperated string with + // the initialized system info. + %info = sfxGetDeviceInfo(); + $pref::SFX::provider = getField( %info, 0 ); + $pref::SFX::device = getField( %info, 1 ); + $pref::SFX::useHardware = getField( %info, 2 ); + %useHardware = $pref::SFX::useHardware ? "Yes" : "No"; + %maxBuffers = getField( %info, 3 ); + + echo( " Provider: " @ $pref::SFX::provider ); + echo( " Device: " @ $pref::SFX::device ); + echo( " Hardware: " @ %useHardware ); + echo( " Max Buffers: " @ %maxBuffers ); + echo( " " ); + + if( isDefined( "$pref::SFX::distanceModel" ) ) + sfxSetDistanceModel( $pref::SFX::distanceModel ); + if( isDefined( "$pref::SFX::dopplerFactor" ) ) + sfxSetDopplerFactor( $pref::SFX::dopplerFactor ); + if( isDefined( "$pref::SFX::rolloffFactor" ) ) + sfxSetRolloffFactor( $pref::SFX::rolloffFactor ); + + // Restore master volume. + + sfxSetMasterVolume( $pref::SFX::masterVolume ); + + // Restore channel volumes. + + for( %channel = 0; %channel <= 8; %channel ++ ) + sfxSetChannelVolume( %channel, $pref::SFX::channelVolume[ %channel ] ); + + return true; +} + + +/// Destroys the current sound system device. +function sfxShutdown() +{ + // Store volume prefs. + + $pref::SFX::masterVolume = sfxGetMasterVolume(); + + for( %channel = 0; %channel <= 8; %channel ++ ) + $pref::SFX::channelVolume[ %channel ] = sfxGetChannelVolume( %channel ); + + // We're assuming here that a null info + // string means that no device is loaded. + if( sfxGetDeviceInfo() $= "" ) + return; + + sfxDeleteDevice(); +} + + +/// Determines which of the two SFX providers is preferable. +function sfxCompareProvider( %providerA, %providerB ) +{ + if( %providerA $= %providerB ) + return 0; + + switch$( %providerA ) + { + // Always prefer FMOD over anything else. + case "FMOD": + return 1; + + // Prefer OpenAL over anything but FMOD. + case "OpenAL": + if( %providerB $= "FMOD" ) + return -1; + else + return 1; + + // choose XAudio over DirectSound + case "XAudio": + if( %providerB $= "FMOD" || %providerB $= "OpenAL" ) + return -1; + else + return 0; + + case "DirectSound": + if( %providerB !$= "FMOD" && %providerB !$= "OpenAL" && %providerB !$= "XAudio" ) + return 1; + else + return -1; + + default: + return -1; + } +} + + +/// Try to detect and initalize the best SFX device available. +function sfxAutodetect() +{ + // Get all the available devices. + + %devices = sfxGetAvailableDevices(); + + // Collect and sort the devices by preferentiality. + + %deviceTrySequence = new ArrayObject(); + %bestMatch = -1; + %count = getRecordCount( %devices ); + for( %i = 0; %i < %count; %i ++ ) + { + %info = getRecord( %devices, %i ); + %provider = getField( %info, 0 ); + + %deviceTrySequence.push_back( %provider, %info ); + } + + %deviceTrySequence.sortfkd( "sfxCompareProvider" ); + + // Try the devices in order. + + %count = %deviceTrySequence.count(); + for( %i = 0; %i < %count; %i ++ ) + { + %provider = %deviceTrySequence.getKey( %i ); + %info = %deviceTrySequence.getValue( %i ); + + $pref::SFX::provider = %provider; + $pref::SFX::device = getField( %info, 1 ); + $pref::SFX::useHardware = getField( %info, 2 ); + + // By default we've decided to avoid hardware devices as + // they are buggy and prone to problems. + $pref::SFX::useHardware = false; + + if( sfxInit() ) + { + $pref::SFX::autoDetect = false; + %deviceTrySequence.delete(); + return true; + } + } + + // Found no suitable device. + + error( "sfxAutodetect - Could not initialize a valid SFX device." ); + + $pref::SFX::provider = ""; + $pref::SFX::device = ""; + $pref::SFX::useHardware = ""; + + %deviceTrySequence.delete(); + + return false; +} + + +//----------------------------------------------------------------------------- +// Backwards-compatibility with old channel system. +//----------------------------------------------------------------------------- + +// Volume channel IDs for backwards-compatibility. + +$GuiAudioType = 1; // Interface. +$SimAudioType = 2; // Game. +$MessageAudioType = 3; // Notifications. +$MusicAudioType = 4; // Music. + +$AudioChannels[ 0 ] = AudioChannelDefault; +$AudioChannels[ $GuiAudioType ] = AudioChannelGui; +$AudioChannels[ $SimAudioType ] = AudioChannelEffects; +$AudioChannels[ $MessageAudioType ] = AudioChannelMessages; +$AudioChannels[ $MusicAudioType ] = AudioChannelMusic; + +function sfxOldChannelToGroup( %channel ) +{ + return $AudioChannels[ %channel ]; +} + +function sfxGroupToOldChannel( %group ) +{ + %id = %group.getId(); + for( %i = 0;; %i ++ ) + if( !isObject( $AudioChannels[ %i ] ) ) + return -1; + else if( $AudioChannels[ %i ].getId() == %id ) + return %i; + + return -1; +} + +function sfxSetMasterVolume( %volume ) +{ + AudioChannelMaster.setVolume( %volume ); +} + +function sfxGetMasterVolume( %volume ) +{ + return AudioChannelMaster.getVolume(); +} + +function sfxStopAll( %channel ) +{ + // Don't stop channel itself since that isn't quite what the function + // here intends. + + %channel = sfxOldChannelToGroup( %channel ); + if (isObject(%channel)) + { + foreach( %source in %channel ) + %source.stop(); + } +} + +function sfxGetChannelVolume( %channel ) +{ + %obj = sfxOldChannelToGroup( %channel ); + if( isObject( %obj ) ) + return %obj.getVolume(); +} + +function sfxSetChannelVolume( %channel, %volume ) +{ + %obj = sfxOldChannelToGroup( %channel ); + if( isObject( %obj ) ) + %obj.setVolume( %volume ); +} + +/*singleton SimSet( SFXPausedSet ); + + +/// Pauses the playback of active sound sources. +/// +/// @param %channels An optional word list of channel indices or an empty +/// string to pause sources on all channels. +/// @param %pauseSet An optional SimSet which is filled with the paused +/// sources. If not specified the global SfxSourceGroup +/// is used. +/// +/// @deprecated +/// +function sfxPause( %channels, %pauseSet ) +{ + // Did we get a set to populate? + if ( !isObject( %pauseSet ) ) + %pauseSet = SFXPausedSet; + + %count = SFXSourceSet.getCount(); + for ( %i = 0; %i < %count; %i++ ) + { + %source = SFXSourceSet.getObject( %i ); + + %channel = sfxGroupToOldChannel( %source.getGroup() ); + if( %channels $= "" || findWord( %channels, %channel ) != -1 ) + { + %source.pause(); + %pauseSet.add( %source ); + } + } +} + + +/// Resumes the playback of paused sound sources. +/// +/// @param %pauseSet An optional SimSet which contains the paused sound +/// sources to be resumed. If not specified the global +/// SfxSourceGroup is used. +/// @deprecated +/// +function sfxResume( %pauseSet ) +{ + if ( !isObject( %pauseSet ) ) + %pauseSet = SFXPausedSet; + + %count = %pauseSet.getCount(); + for ( %i = 0; %i < %count; %i++ ) + { + %source = %pauseSet.getObject( %i ); + %source.play(); + } + + // Clear our pause set... the caller is left + // to clear his own if he passed one. + %pauseSet.clear(); +}*/ diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.cs b/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.cs new file mode 100644 index 000000000..8c2bf270c --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.cs @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton SFXAmbience( AudioAmbienceDefault ) +{ + environment = AudioEnvOff; +}; + +singleton SFXAmbience( AudioAmbienceOutside ) +{ + environment = AudioEnvPlain; + states[ 0 ] = AudioLocationOutside; +}; + +singleton SFXAmbience( AudioAmbienceInside ) +{ + environment = AudioEnvRoom; + states[ 0 ] = AudioLocationInside; +}; + +singleton SFXAmbience( AudioAmbienceUnderwater ) +{ + environment = AudioEnvUnderwater; + states[ 0 ] = AudioLocationUnderwater; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioData.cs b/Templates/BaseGame/game/core/sfx/scripts/audioData.cs new file mode 100644 index 000000000..8584ce50e --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioData.cs @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Game specific audio descriptions. Always declare SFXDescription's (the type of sound) +// before SFXProfile's (the sound itself) when creating new ones + +singleton SFXDescription(BulletFireDesc : AudioEffect ) +{ + isLooping = false; + is3D = true; + ReferenceDistance = 10.0; + MaxDistance = 60.0; +}; + +singleton SFXDescription(BulletImpactDesc : AudioEffect ) +{ + isLooping = false; + is3D = true; + ReferenceDistance = 10.0; + MaxDistance = 30.0; + volume = 0.4; + pitch = 1.4; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioDescriptions.cs b/Templates/BaseGame/game/core/sfx/scripts/audioDescriptions.cs new file mode 100644 index 000000000..d682461cf --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioDescriptions.cs @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Always declare SFXDescription's (the type of sound) before SFXProfile's (the +// sound itself) when creating new ones + +//----------------------------------------------------------------------------- +// 3D Sounds +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Single shot sounds +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioDefault3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 20.0; + MaxDistance = 100.0; +}; + +singleton SFXDescription( AudioSoft3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 20.0; + MaxDistance = 100.0; + volume = 0.4; +}; + +singleton SFXDescription( AudioClose3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 10.0; + MaxDistance = 60.0; +}; + +singleton SFXDescription( AudioClosest3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 5.0; + MaxDistance = 10.0; +}; + +//----------------------------------------------------------------------------- +// Looping sounds +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioDefaultLoop3D : AudioEffect ) +{ + isLooping = true; + is3D = true; + ReferenceDistance = 20.0; + MaxDistance = 100.0; +}; + +singleton SFXDescription( AudioCloseLoop3D : AudioEffect ) +{ + isLooping = true; + is3D = true; + ReferenceDistance = 18.0; + MaxDistance = 25.0; +}; + +singleton SFXDescription( AudioClosestLoop3D : AudioEffect ) +{ + isLooping = true; + is3D = true; + ReferenceDistance = 5.0; + MaxDistance = 10.0; +}; + +//----------------------------------------------------------------------------- +// 2d sounds +//----------------------------------------------------------------------------- + +// Used for non-looping environmental sounds (like power on, power off) +singleton SFXDescription( Audio2D : AudioEffect ) +{ + isLooping = false; +}; + +// Used for Looping Environmental Sounds +singleton SFXDescription( AudioLoop2D : AudioEffect ) +{ + isLooping = true; +}; + +singleton SFXDescription( AudioStream2D : AudioEffect ) +{ + isStreaming = true; +}; +singleton SFXDescription( AudioStreamLoop2D : AudioEffect ) +{ + isLooping = true; + isStreaming = true; +}; + +//----------------------------------------------------------------------------- +// Music +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioMusic2D : AudioMusic ) +{ + isStreaming = true; +}; + +singleton SFXDescription( AudioMusicLoop2D : AudioMusic ) +{ + isLooping = true; + isStreaming = true; +}; + +singleton SFXDescription( AudioMusic3D : AudioMusic ) +{ + isStreaming = true; + is3D = true; +}; + +singleton SFXDescription( AudioMusicLoop3D : AudioMusic ) +{ + isStreaming = true; + is3D = true; + isLooping = true; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.cs b/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.cs new file mode 100644 index 000000000..671825b6b --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.cs @@ -0,0 +1,916 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Reverb environment presets. +// +// For customized presets, best derive from one of these presets. + +singleton SFXEnvironment( AudioEnvOff ) +{ + envSize = "7.5"; + envDiffusion = "1.0"; + room = "-10000"; + roomHF = "-10000"; + roomLF = "0"; + decayTime = "1.0"; + decayHFRatio = "1.0"; + decayLFRatio = "1.0"; + reflections = "-2602"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "200"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "0.0"; + density = "0.0"; + flags = 0x33; +}; + +singleton SFXEnvironment( AudioEnvGeneric ) +{ + envSize = "7.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-100"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.83"; + decayLFRatio = "1.0"; + reflections = "-2602"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "200"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvRoom ) +{ + envSize = "1.9"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-454"; + roomLF = "0"; + decayTime = "0.4"; + decayHFRatio = "0.83"; + decayLFRatio = "1.0"; + reflections = "-1646"; + reflectionsDelay = "0.002"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "53"; + reverbDelay = "0.003"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvPaddedCell ) +{ + envSize = "1.4"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-6000"; + roomLF = "0"; + decayTime = "0.17"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-1204"; + reflectionsDelay = "0.001"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "207"; + reverbDelay = "0.002"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvBathroom ) +{ + envSize = "1.4"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-1200"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.54"; + decayLFRatio = "1.0"; + reflections = "-370"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "1030"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "60.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvLivingRoom ) +{ + envSize = "2.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-6000"; + roomLF = "0"; + decayTime = "0.5"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-1376"; + reflectionsDelay = "0.003"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1104"; + reverbDelay = "0.004"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvStoneRoom ) +{ + envSize = "11.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "300"; + roomLF = "0"; + decayTime = "2.31"; + decayHFRatio = "0.64"; + decayLFRatio = "1.0"; + reflections = "-711"; + reflectionsDelay = "0.012"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "83"; + reverbDelay = "0.017"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "-5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvAuditorium ) +{ + envSize = "21.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-476"; + roomLF = "0"; + decayTime = "4.32"; + decayHFRatio = "0.59"; + decayLFRatio = "1.0"; + reflections = "1"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-289"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvConcertHall ) +{ + envSize = "19.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-500"; + roomLF = "0"; + decayTime = "3.92"; + decayHFRatio = "0.7"; + decayLFRatio = "1.0"; + reflections = "-1230"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-2"; + reverbDelay = "0.029"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvCave ) +{ + envSize = "14.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "0"; + roomLF = "0"; + decayTime = "2.91"; + decayHFRatio = "1.3"; + decayLFRatio = "1.0"; + reflections = "-602"; + reflectionsDelay = "0.015"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-302"; + reverbDelay = "0.022"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvArena ) +{ + envSize = "36.2f"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-698"; + roomLF = "0"; + decayTime = "7.24"; + decayHFRatio = "0.33"; + decayLFRatio = "1.0"; + reflections = "-1166"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "16"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvHangar ) +{ + envSize = "50.3"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-1000"; + roomLF = "0"; + decayTime = "10.05"; + decayHFRatio = "0.23"; + decayLFRatio = "1.0"; + reflections = "-602"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "198"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvCarpettedHallway ) +{ + envSize = "1.9"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-4000"; + roomLF = "0"; + decayTime = "0.3"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-1831"; + reflectionsDelay = "0.002"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1630"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvHallway ) +{ + envSize = "1.8"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-300"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.59"; + decayLFRatio = "1.0"; + reflections = "-1219"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "441"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvStoneCorridor ) +{ + envSize = "13.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-237"; + roomLF = "0"; + decayTime = "2.7"; + decayHFRatio = "0.79"; + decayLFRatio = "1.0"; + reflections = "-1214"; + reflectionsDelay = "0.013"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "395"; + reverbDelay = "0.02"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvAlley ) +{ + envSize = "7.5"; + envDiffusion = "0.3"; + room = "-1000"; + roomHF = "-270"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.86"; + decayLFRatio = "1.0"; + reflections = "-1204"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-4"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.125"; + echoDepth = "0.95"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvForest ) +{ + envSize = "38.0"; + envDiffusion = "0.3"; + room = "-1000"; + roomHF = "-3300"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.54"; + decayLFRatio = "1.0"; + reflections = "-2560"; + reflectionsDelay = "0.162"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-229"; + reverbDelay = "0.088"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.125"; + echoDepth = "1.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "79.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvCity ) +{ + envSize = "7.5"; + envDiffusion = "0.5"; + room = "-1000"; + roomHF = "-800"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.67"; + decayLFRatio = "1.0"; + reflections = "-2273"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1691"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "50.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvMountains ) +{ + envSize = "100.0"; + envDiffusion = "0.27"; + room = "-1000"; + roomHF = "-2500"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.21"; + decayLFRatio = "1.0"; + reflections = "-2780"; + reflectionsDelay = "0.3"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1434"; + reverbDelay = "0.1"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "1.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "27.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvQuary ) +{ + envSize = "17.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-1000"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.83"; + decayLFRatio = "1.0"; + reflections = "-10000"; + reflectionsDelay = "0.061"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "500"; + reverbDelay = "0.025"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.125"; + echoDepth = "0.7"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvPlain ) +{ + envSize = "42.5"; + envDiffusion = "0.21"; + room = "-1000"; + roomHF = "-2000"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.5"; + decayLFRatio = "1.0"; + reflections = "-2466"; + reflectionsDelay = "0.179"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1926"; + reverbDelay = "0.1"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "1.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "21.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvParkingLot ) +{ + envSize = "8.3"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "0"; + roomLF = "0"; + decayTime = "1.65"; + decayHFRatio = "1.5"; + decayLFRatio = "1.0"; + reflections = "-1363"; + reflectionsDelay = "0.008"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1153"; + reverbDelay = "0.012"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvSewerPipe ) +{ + envSize = "1.7"; + envDiffusion = "0.8"; + room = "-1000"; + roomHF = "-1000"; + roomLF = "0"; + decayTime = "2.81"; + decayHFRatio = "0.14"; + decayLFRatio = "1.0"; + reflections = "429"; + reflectionsDelay = "0.014"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "1023"; + reverbDelay = "0.21"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "80.0"; + density = "60.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvUnderwater ) +{ + envSize = "1.8"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-4000"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-449"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "1700"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "1.18"; + modulationDepth = "0.348"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvDrugged ) +{ + envSize = "1.9"; + envDiffusion = "0.5"; + room = "-1000"; + roomHF = "0"; + roomLF = "0"; + decayTime = "8.39"; + decayHFRatio = "1.39"; + decayLFRatio = "1.0"; + reflections = "-115"; + reflectionsDelay = "0.002"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "985"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "1.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvDizzy ) +{ + envSize = "1.8"; + envDiffusion = "0.6"; + room = "-1000.0"; + roomHF = "-400"; + roomLF = "0"; + decayTime = "17.23"; + decayHFRatio = "0.56"; + decayLFRatio = "1.0"; + reflections = "-1713"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-613"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "1.0"; + modulationTime = "0.81"; + modulationDepth = "0.31"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvPsychotic ) +{ + envSize = "1.0"; + envDiffusion = "0.5"; + room = "-1000"; + roomHF = "-151"; + roomLF = "0"; + decayTime = "7.56"; + decayHFRatio = "0.91"; + decayLFRatio = "1.0"; + reflections = "-626"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "774"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "4.0"; + modulationDepth = "1.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioStates.cs b/Templates/BaseGame/game/core/sfx/scripts/audioStates.cs new file mode 100644 index 000000000..3ab55cf78 --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioStates.cs @@ -0,0 +1,158 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Some state presets. + + +/// Return the first active SFXState in the given SimSet/SimGroup. +function sfxGetActiveStateInGroup( %group ) +{ + %count = %group.getCount(); + for( %i = 0; %i < %count; %i ++ ) + { + %obj = %group.getObject( %i ); + if( !%obj.isMemberOfClass( "SFXState" ) ) + continue; + + if( %obj.isActive() ) + return %obj; + } + + return 0; +} + + +//----------------------------------------------------------------------------- +// Special audio state that will always and only be active when no other +// state is active. Useful for letting slots apply specifically when no +// other slot in a list applies. + +singleton SFXState( AudioStateNone ) {}; + +AudioStateNone.activate(); + +function SFXState::onActivate( %this ) +{ + if( %this.getId() != AudioStateNone.getId() ) + AudioStateNone.disable(); +} + +function SFXState::onDeactivate( %this ) +{ + if( %this.getId() != AudioStateNone.getId() ) + AudioStateNone.enable(); +} + +//----------------------------------------------------------------------------- +// AudioStateExclusive class. +// +// Automatically deactivates sibling SFXStates in its parent SimGroup +// when activated. + +function AudioStateExclusive::onActivate( %this ) +{ + Parent::onActivate( %this ); + + %group = %this.parentGroup; + %count = %group.getCount(); + + for( %i = 0; %i < %count; %i ++ ) + { + %obj = %group.getObject( %i ); + + if( %obj != %this && %obj.isMemberOfClass( "SFXState" ) && %obj.isActive() ) + %obj.deactivate(); + } +} + +//----------------------------------------------------------------------------- +// Location-dependent states. + +singleton SimGroup( AudioLocation ); + +/// State when the listener is outside. +singleton SFXState( AudioLocationOutside ) +{ + parentGroup = AudioLocation; + className = "AudioStateExclusive"; +}; + +/// State when the listener is submerged. +singleton SFXState( AudioLocationUnderwater ) +{ + parentGroup = AudioLocation; + className = "AudioStateExclusive"; +}; + +/// State when the listener is indoors. +singleton SFXState( AudioLocationInside ) +{ + parentGroup = AudioLocation; + className = "AudioStateExclusive"; +}; + +/// Return the currently active SFXState in AudioLocation. +function sfxGetLocation() +{ + return sfxGetActiveStateInGroup( AudioLocation ); +} + +//----------------------------------------------------------------------------- +// Mood-dependent states. + +singleton SimGroup( AudioMood ); + +singleton SFXState( AudioMoodNeutral ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodAggressive ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodTense ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodVictory ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodCalm ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +/// Return the currently active SFXState in AudioMood. +function sfxGetMood() +{ + return sfxGetActiveStateInGroup( AudioMood ); +} diff --git a/Templates/BaseGame/game/core/utility/Core_Utility.cs b/Templates/BaseGame/game/core/utility/Core_Utility.cs new file mode 100644 index 000000000..d412f3544 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/Core_Utility.cs @@ -0,0 +1,11 @@ + +function Core_Utility::onCreate(%this) +{ + exec("./scripts/parseArgs.cs"); + exec("./scripts/globals.cs"); + exec("./scripts/helperFunctions.cs"); +} + +function Core_Utility::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/Core_Utility.module b/Templates/BaseGame/game/core/utility/Core_Utility.module new file mode 100644 index 000000000..cb6539040 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/Core_Utility.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/scripts/globals.cs b/Templates/BaseGame/game/core/utility/scripts/globals.cs new file mode 100644 index 000000000..fcf52390a --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/globals.cs @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// DInput keyboard, mouse, and joystick prefs +// ---------------------------------------------------------------------------- + +$pref::Input::MouseEnabled = 1; +$pref::Input::LinkMouseSensitivity = 1; +$pref::Input::KeyboardEnabled = 1; +$pref::Input::KeyboardTurnSpeed = 0.1; +$pref::Input::JoystickEnabled = 0; + +// ---------------------------------------------------------------------------- +// Video Preferences +// ---------------------------------------------------------------------------- + +// Set directory paths for various data or default images. +$pref::Video::ProfilePath = "core/rendering/scripts/gfxprofile"; +/*$pref::Video::missingTexturePath = "core/images/missingTexture.png"; +$pref::Video::unavailableTexturePath = "core/images/unavailable.png"; +$pref::Video::warningTexturePath = "core/images/warnMat.dds";*/ + +$pref::Video::disableVerticalSync = 1; +$pref::Video::mode = "800 600 false 32 60 4"; +$pref::Video::defaultFenceCount = 0; + +// This disables the hardware FSAA/MSAA so that we depend completely on the FXAA +// post effect which works on all cards and in deferred mode. Note that the new +// Intel Hybrid graphics on laptops will fail to initialize when hardware AA is +// enabled... so you've been warned. +$pref::Video::disableHardwareAA = true; + +$pref::Video::disableNormalmapping = false; +$pref::Video::disablePixSpecular = false; +$pref::Video::disableCubemapping = false; +$pref::Video::disableParallaxMapping = false; + +// The number of mipmap levels to drop on loaded textures to reduce video memory +// usage. It will skip any textures that have been defined as not allowing down +// scaling. +$pref::Video::textureReductionLevel = 0; + +$pref::Video::defaultAnisotropy = 1; +//$pref::Video::Gamma = 1.0; + +/// AutoDetect graphics quality levels the next startup. +$pref::Video::autoDetect = 1; + +// ---------------------------------------------------------------------------- +// Shader stuff +// ---------------------------------------------------------------------------- + +// This is the path used by ShaderGen to cache procedural shaders. If left +// blank ShaderGen will only cache shaders to memory and not to disk. +$shaderGen::cachePath = "data/shaderCache"; + +// Uncomment to disable ShaderGen, useful when debugging +//$ShaderGen::GenNewShaders = false; + +// Uncomment to dump disassembly for any shader that is compiled to disk. These +// will appear as shadername_dis.txt in the same path as the shader file. +//$gfx::disassembleAllShaders = true; + +// ---------------------------------------------------------------------------- +// Lighting and shadowing +// ---------------------------------------------------------------------------- + +// Uncomment to enable AdvancedLighting on the Mac (T3D 2009 Beta 3) +//$pref::machax::enableAdvancedLighting = true; + +$sceneLighting::cacheSize = 20000; +$sceneLighting::purgeMethod = "lastCreated"; +$sceneLighting::cacheLighting = 1; + +$pref::Shadows::textureScalar = 1.0; +$pref::Shadows::disable = false; + +// Sets the shadow filtering mode. +// None - Disables filtering. +// SoftShadow - Does a simple soft shadow +// SoftShadowHighQuality +$pref::Shadows::filterMode = "SoftShadow"; diff --git a/Templates/BaseGame/game/core/utility/scripts/helperFunctions.cs b/Templates/BaseGame/game/core/utility/scripts/helperFunctions.cs new file mode 100644 index 000000000..8abe3e6e6 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/helperFunctions.cs @@ -0,0 +1,1158 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------ +// Check if a script file exists, compiled or not. +function isScriptFile(%path) +{ + if( isFile(%path @ ".dso") || isFile(%path) ) + return true; + + return false; +} + +function loadMaterials() +{ + // Load any materials files for which we only have DSOs. + + for( %file = findFirstFile( "*/materials.cs.dso" ); + %file !$= ""; + %file = findNextFile( "*/materials.cs.dso" )) + { + // Only execute, if we don't have the source file. + %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); + if( !isFile( %csFileName ) ) + exec( %csFileName ); + } + + // Load all source material files. + + for( %file = findFirstFile( "*/materials.cs" ); + %file !$= ""; + %file = findNextFile( "*/materials.cs" )) + { + exec( %file ); + } + + // Load all materials created by the material editor if + // the folder exists + if( IsDirectory( "materialEditor" ) ) + { + for( %file = findFirstFile( "materialEditor/*.cs.dso" ); + %file !$= ""; + %file = findNextFile( "materialEditor/*.cs.dso" )) + { + // Only execute, if we don't have the source file. + %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); + if( !isFile( %csFileName ) ) + exec( %csFileName ); + } + + for( %file = findFirstFile( "materialEditor/*.cs" ); + %file !$= ""; + %file = findNextFile( "materialEditor/*.cs" )) + { + exec( %file ); + } + } +} + +function reloadMaterials() +{ + reloadTextures(); + loadMaterials(); + reInitMaterials(); +} + +function loadDatablockFiles( %datablockFiles, %recurse ) +{ + if ( %recurse ) + { + recursiveLoadDatablockFiles( %datablockFiles, 9999 ); + return; + } + + %count = %datablockFiles.count(); + for ( %i=0; %i < %count; %i++ ) + { + %file = %datablockFiles.getKey( %i ); + if ( !isFile(%file @ ".dso") && !isFile(%file) ) + continue; + + exec( %file ); + } + + // Destroy the incoming list. + //%datablockFiles.delete(); +} + +function recursiveLoadDatablockFiles( %datablockFiles, %previousErrors ) +{ + %reloadDatablockFiles = new ArrayObject(); + + // Keep track of the number of datablocks that + // failed during this pass. + %failedDatablocks = 0; + + // Try re-executing the list of datablock files. + %count = %datablockFiles.count(); + for ( %i=0; %i < %count; %i++ ) + { + %file = %datablockFiles.getKey( %i ); + if ( !isFile(%file @ ".dso") && !isFile(%file) ) + continue; + + // Start counting copy constructor creation errors. + $Con::objectCopyFailures = 0; + + exec( %file ); + + // If errors occured then store this file for re-exec later. + if ( $Con::objectCopyFailures > 0 ) + { + %reloadDatablockFiles.add( %file ); + %failedDatablocks = %failedDatablocks + $Con::objectCopyFailures; + } + } + + // Clear the object copy failure counter so that + // we get console error messages again. + $Con::objectCopyFailures = -1; + + // Delete the old incoming list... we're done with it. + //%datablockFiles.delete(); + + // If we still have datablocks to retry. + %newCount = %reloadDatablockFiles.count(); + if ( %newCount > 0 ) + { + // If the datablock failures have not been reduced + // from the last pass then we must have a real syntax + // error and not just a bad dependancy. + if ( %previousErrors > %failedDatablocks ) + recursiveLoadDatablockFiles( %reloadDatablockFiles, %failedDatablocks ); + + else + { + // Since we must have real syntax errors do one + // last normal exec to output error messages. + loadDatablockFiles( %reloadDatablockFiles, false ); + } + + return; + } + + // Cleanup the empty reload list. + %reloadDatablockFiles.delete(); +} + +function getUserPath() +{ + %temp = getUserHomeDirectory(); + echo(%temp); + if(!isDirectory(%temp)) + { + %temp = getUserDataDirectory(); + echo(%temp); + if(!isDirectory(%temp)) + { + %userPath = "data"; + } + else + { + //put it in appdata/roaming + %userPath = %temp @ "/" @ $appName; + } + } + else + { + //put it in user/documents + %userPath = %temp @ "/" @ $appName; + } + return %userPath; +} + +function getPrefpath() +{ + $prefPath = getUserPath() @ "/preferences"; + return $prefPath; +} + +function updateTSShapeLoadProgress(%progress, %msg) +{ + // Check if the loading GUI is visible and use that instead of the + // separate import progress GUI if possible + /* if ( isObject(LoadingGui) && LoadingGui.isAwake() ) + { + // Save/Restore load progress at the start/end of the import process + if ( %progress == 0 ) + { + ColladaImportProgress.savedProgress = LoadingProgress.getValue(); + ColladaImportProgress.savedText = LoadingProgressTxt.getValue(); + + ColladaImportProgress.msgPrefix = "Importing " @ %msg; + %msg = "Reading file into memory..."; + } + else if ( %progress == 1.0 ) + { + LoadingProgress.setValue( ColladaImportProgress.savedProgress ); + LoadingProgressTxt.setValue( ColladaImportProgress.savedText ); + } + + %msg = ColladaImportProgress.msgPrefix @ ": " @ %msg; + + %progressCtrl = LoadingProgress; + %textCtrl = LoadingProgressTxt; + } + else + { + //it's probably the editors using it + if(isFunction("updateToolTSShapeLoadProgress")) + { + updateToolTSShapeLoadProgress(%progress, %msg); + } + } + + // Update progress indicators + if (%progress == 0) + { + %progressCtrl.setValue(0.001); + %textCtrl.setText(%msg); + } + else if (%progress != 1.0) + { + %progressCtrl.setValue(%progress); + %textCtrl.setText(%msg); + } + + Canvas.repaint(33);*/ +} + +/// A helper function which will return the ghosted client object +/// from a server object when connected to a local server. +function serverToClientObject( %serverObject ) +{ + assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); + assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); + + %ghostId = LocalClientConnection.getGhostId( %serverObject ); + if ( %ghostId == -1 ) + return 0; + + return ServerConnection.resolveGhostID( %ghostId ); +} + +//---------------------------------------------------------------------------- +// Debug commands +//---------------------------------------------------------------------------- + +function netSimulateLag( %msDelay, %packetLossPercent ) +{ + if ( %packetLossPercent $= "" ) + %packetLossPercent = 0; + + commandToServer( 'NetSimulateLag', %msDelay, %packetLossPercent ); +} + +//Various client functions + +function validateDatablockName(%name) +{ + // remove whitespaces at beginning and end + %name = trim( %name ); + + // remove numbers at the beginning + %numbers = "0123456789"; + while( strlen(%name) > 0 ) + { + // the first character + %firstChar = getSubStr( %name, 0, 1 ); + // if the character is a number remove it + if( strpos( %numbers, %firstChar ) != -1 ) + { + %name = getSubStr( %name, 1, strlen(%name) -1 ); + %name = ltrim( %name ); + } + else + break; + } + + // replace whitespaces with underscores + %name = strreplace( %name, " ", "_" ); + + // remove any other invalid characters + %invalidCharacters = "-+*/%$&§=()[].?\"#,;!~<>|°^{}"; + %name = stripChars( %name, %invalidCharacters ); + + if( %name $= "" ) + %name = "Unnamed"; + + return %name; +} + +//-------------------------------------------------------------------------- +// Finds location of %word in %text, starting at %start. Works just like strPos +//-------------------------------------------------------------------------- + +function wordPos(%text, %word, %start) +{ + if (%start $= "") %start = 0; + + if (strpos(%text, %word, 0) == -1) return -1; + %count = getWordCount(%text); + if (%start >= %count) return -1; + for (%i = %start; %i < %count; %i++) + { + if (getWord( %text, %i) $= %word) return %i; + } + return -1; +} + +//-------------------------------------------------------------------------- +// Finds location of %field in %text, starting at %start. Works just like strPos +//-------------------------------------------------------------------------- + +function fieldPos(%text, %field, %start) +{ + if (%start $= "") %start = 0; + + if (strpos(%text, %field, 0) == -1) return -1; + %count = getFieldCount(%text); + if (%start >= %count) return -1; + for (%i = %start; %i < %count; %i++) + { + if (getField( %text, %i) $= %field) return %i; + } + return -1; +} + +//-------------------------------------------------------------------------- +// returns the text in a file with "\n" at the end of each line +//-------------------------------------------------------------------------- + +function loadFileText( %file) +{ + %fo = new FileObject(); + %fo.openForRead(%file); + %text = ""; + while(!%fo.isEOF()) + { + %text = %text @ %fo.readLine(); + if (!%fo.isEOF()) %text = %text @ "\n"; + } + + %fo.delete(); + return %text; +} + +function setValueSafe(%dest, %val) +{ + %cmd = %dest.command; + %alt = %dest.altCommand; + %dest.command = ""; + %dest.altCommand = ""; + + %dest.setValue(%val); + + %dest.command = %cmd; + %dest.altCommand = %alt; +} + +function shareValueSafe(%source, %dest) +{ + setValueSafe(%dest, %source.getValue()); +} + +function shareValueSafeDelay(%source, %dest, %delayMs) +{ + schedule(%delayMs, 0, shareValueSafe, %source, %dest); +} + + +//------------------------------------------------------------------------------ +// An Aggregate Control is a plain GuiControl that contains other controls, +// which all share a single job or represent a single value. +//------------------------------------------------------------------------------ + +// AggregateControl.setValue( ) propagates the value to any control that has an +// internal name. +function AggregateControl::setValue(%this, %val, %child) +{ + for(%i = 0; %i < %this.getCount(); %i++) + { + %obj = %this.getObject(%i); + if( %obj == %child ) + continue; + + if(%obj.internalName !$= "") + setValueSafe(%obj, %val); + } +} + +// AggregateControl.getValue() uses the value of the first control that has an +// internal name, if it has not cached a value via .setValue +function AggregateControl::getValue(%this) +{ + for(%i = 0; %i < %this.getCount(); %i++) + { + %obj = %this.getObject(%i); + if(%obj.internalName !$= "") + { + //error("obj = " @ %obj.getId() @ ", " @ %obj.getName() @ ", " @ %obj.internalName ); + //error(" value = " @ %obj.getValue()); + return %obj.getValue(); + } + } +} + +// AggregateControl.updateFromChild( ) is called by child controls to propagate +// a new value, and to trigger the onAction() callback. +function AggregateControl::updateFromChild(%this, %child) +{ + %val = %child.getValue(); + if(%val == mCeil(%val)){ + %val = mCeil(%val); + }else{ + if ( %val <= -100){ + %val = mCeil(%val); + }else if ( %val <= -10){ + %val = mFloatLength(%val, 1); + }else if ( %val < 0){ + %val = mFloatLength(%val, 2); + }else if ( %val >= 1000){ + %val = mCeil(%val); + }else if ( %val >= 100){ + %val = mFloatLength(%val, 1); + }else if ( %val >= 10){ + %val = mFloatLength(%val, 2); + }else if ( %val > 0){ + %val = mFloatLength(%val, 3); + } + } + %this.setValue(%val, %child); + %this.onAction(); +} + +// default onAction stub, here only to prevent console spam warnings. +function AggregateControl::onAction(%this) +{ +} + +// call a method on all children that have an internalName and that implement the method. +function AggregateControl::callMethod(%this, %method, %args) +{ + for(%i = 0; %i < %this.getCount(); %i++) + { + %obj = %this.getObject(%i); + if(%obj.internalName !$= "" && %obj.isMethod(%method)) + eval(%obj @ "." @ %method @ "( " @ %args @ " );"); + } + +} + +//------------------------------------------------------------------------------ +// Altered Version of TGB's QuickEditDropDownTextEditCtrl +//------------------------------------------------------------------------------ +function QuickEditDropDownTextEditCtrl::onRenameItem( %this ) +{ +} + +function QuickEditDropDownTextEditCtrl::updateFromChild( %this, %ctrl ) +{ + if( %ctrl.internalName $= "PopUpMenu" ) + { + %this->TextEdit.setText( %ctrl.getText() ); + } + else if ( %ctrl.internalName $= "TextEdit" ) + { + %popup = %this->PopupMenu; + %popup.changeTextById( %popup.getSelected(), %ctrl.getText() ); + %this.onRenameItem(); + } +} + +// Writes out all script functions to a file. +function writeOutFunctions() +{ + new ConsoleLogger(logger, "scriptFunctions.txt", false); + dumpConsoleFunctions(); + logger.delete(); +} + +// Writes out all script classes to a file. +function writeOutClasses() +{ + new ConsoleLogger(logger, "scriptClasses.txt", false); + dumpConsoleClasses(); + logger.delete(); +} + +// +function compileFiles(%pattern) +{ + %path = filePath(%pattern); + + %saveDSO = $Scripts::OverrideDSOPath; + %saveIgnore = $Scripts::ignoreDSOs; + + $Scripts::OverrideDSOPath = %path; + $Scripts::ignoreDSOs = false; + %mainCsFile = makeFullPath("main.cs"); + + for (%file = findFirstFileMultiExpr(%pattern); %file !$= ""; %file = findNextFileMultiExpr(%pattern)) + { + // we don't want to try and compile the primary main.cs + if(%mainCsFile !$= %file) + compile(%file, true); + } + + $Scripts::OverrideDSOPath = %saveDSO; + $Scripts::ignoreDSOs = %saveIgnore; + +} + +function displayHelp() +{ + // Notes on logmode: console logging is written to console.log. + // -log 0 disables console logging. + // -log 1 appends to existing logfile; it also closes the file + // (flushing the write buffer) after every write. + // -log 2 overwrites any existing logfile; it also only closes + // the logfile when the application shuts down. (default) + + error( + "Torque Demo command line options:\n"@ + " -log Logging behavior; see main.cs comments for details\n"@ + " -game Reset list of mods to only contain \n"@ + " Works like the -game argument\n"@ + " -dir Add to list of directories\n"@ + " -console Open a separate console\n"@ + " -jSave Record a journal\n"@ + " -jPlay Play back a journal\n"@ + " -help Display this help message\n" + ); +} + +// Execute startup scripts for each mod, starting at base and working up +function loadDir(%dir) +{ + pushback($userDirs, %dir, ";"); + + if (isScriptFile(%dir @ "/main.cs")) + exec(%dir @ "/main.cs"); +} + +function loadDirs(%dirPath) +{ + %dirPath = nextToken(%dirPath, token, ";"); + if (%dirPath !$= "") + loadDirs(%dirPath); + + if(exec(%token @ "/main.cs") != true) + { + error("Error: Unable to find specified directory: " @ %token ); + $dirCount--; + } +} + +//------------------------------------------------------------------------------ +// Utility remap functions: +//------------------------------------------------------------------------------ + +function ActionMap::copyBind( %this, %otherMap, %command ) +{ + if ( !isObject( %otherMap ) ) + { + error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" ); + return; + } + + %bind = %otherMap.getBinding( %command ); + if ( %bind !$= "" ) + { + %device = getField( %bind, 0 ); + %action = getField( %bind, 1 ); + %flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD"; + %deadZone = %otherMap.getDeadZone( %device, %action ); + %scale = %otherMap.getScale( %device, %action ); + %this.bind( %device, %action, %flags, %deadZone, %scale, %command ); + } +} + +//------------------------------------------------------------------------------ +function ActionMap::blockBind( %this, %otherMap, %command ) +{ + if ( !isObject( %otherMap ) ) + { + error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" ); + return; + } + + %bind = %otherMap.getBinding( %command ); + if ( %bind !$= "" ) + %this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" ); +} + +//Dev helpers +/// Shortcut for typing dbgSetParameters with the default values torsion uses. +function dbgTorsion() +{ + dbgSetParameters( 6060, "password", false ); +} + +/// Reset the input state to a default of all-keys-up. +/// A helpful remedy for when Torque misses a button up event do to your breakpoints +/// and can't stop shooting / jumping / strafing. +function mvReset() +{ + for ( %i = 0; %i < 6; %i++ ) + setVariable( "mvTriggerCount" @ %i, 0 ); + + $mvUpAction = 0; + $mvDownAction = 0; + $mvLeftAction = 0; + $mvRightAction = 0; + + // There are others. +} + +//Persistance Manager tests + +new PersistenceManager(TestPManager); + +function runPManTest(%test) +{ + if (!isObject(TestPManager)) + return; + + if (%test $= "") + %test = 100; + + switch(%test) + { + case 0: + TestPManager.testFieldUpdates(); + case 1: + TestPManager.testObjectRename(); + case 2: + TestPManager.testNewObject(); + case 3: + TestPManager.testNewGroup(); + case 4: + TestPManager.testMoveObject(); + case 5: + TestPManager.testObjectRemove(); + case 100: + TestPManager.testFieldUpdates(); + TestPManager.testObjectRename(); + TestPManager.testNewObject(); + TestPManager.testNewGroup(); + TestPManager.testMoveObject(); + TestPManager.testObjectRemove(); + } +} + +function TestPManager::testFieldUpdates(%doNotSave) +{ + // Set some objects as dirty + TestPManager.setDirty(AudioGui); + TestPManager.setDirty(AudioSim); + TestPManager.setDirty(AudioMessage); + + // Alter some of the existing fields + AudioEffect.isLooping = true; + AudioMessage.isLooping = true; + AudioEffect.is3D = true; + + // Test removing a field + TestPManager.removeField(AudioGui, "isLooping"); + + // Alter some of the persistent fields + AudioGui.referenceDistance = 0.8; + AudioMessage.referenceDistance = 0.8; + + // Add some new dynamic fields + AudioGui.foo = "bar"; + AudioEffect.foo = "bar"; + + // Remove an object from the dirty list + // It shouldn't get updated in the file + TestPManager.removeDirty(AudioEffect); + + // Dirty an object in another file as well + TestPManager.setDirty(WarningMaterial); + + // Update a field that doesn't exist + WarningMaterial.glow[0] = true; + + // Drity another object to test for crashes + // when a dirty object is deleted + TestPManager.setDirty(SFXPausedSet); + + // Delete the object + SFXPausedSet.delete(); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testObjectRename(%doNotSave) +{ + // Flag an object as dirty + if (isObject(AudioGui)) + TestPManager.setDirty(AudioGui); + else if (isObject(AudioGuiFoo)) + TestPManager.setDirty(AudioGuiFoo); + + // Rename it + if (isObject(AudioGui)) + AudioGui.setName(AudioGuiFoo); + else if (isObject(AudioGuiFoo)) + AudioGuiFoo.setName(AudioGui); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testNewObject(%doNotSave) +{ + // Test adding a new named object + new SFXDescription(AudioNew) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 2; + }; + + // Flag it as dirty + TestPManager.setDirty(AudioNew, "core/scripts/client/audio.cs"); + + // Test adding a new unnamed object + %obj = new SFXDescription() + { + volume = 0.75; + isLooping = true; + bar = 3; + }; + + // Flag it as dirty + TestPManager.setDirty(%obj, "core/scripts/client/audio.cs"); + + // Test adding an "empty" object + new SFXDescription(AudioEmpty); + + TestPManager.setDirty(AudioEmpty, "core/scripts/client/audio.cs"); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testNewGroup(%doNotSave) +{ + // Test adding a new named SimGroup + new SimGroup(TestGroup) + { + foo = "bar"; + + new SFXDescription(TestObject) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 1; + }; + new SimGroup(SubGroup) + { + foo = 2; + + new SFXDescription(SubObject) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 3; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(TestGroup, "core/scripts/client/audio.cs"); + + // Test adding a new unnamed SimGroup + %group = new SimGroup() + { + foo = "bar"; + + new SFXDescription() + { + volume = 0.75; + channel = $GuiAudioType; + foo = 4; + }; + new SimGroup() + { + foo = 5; + + new SFXDescription() + { + volume = 0.75; + isLooping = true; + channel = $GuiAudioType; + foo = 6; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(%group, "core/scripts/client/audio.cs"); + + // Test adding a new unnamed SimSet + %set = new SimSet() + { + foo = "bar"; + + new SFXDescription() + { + volume = 0.75; + channel = $GuiAudioType; + foo = 7; + }; + new SimGroup() + { + foo = 8; + + new SFXDescription() + { + volume = 0.75; + isLooping = true; + channel = $GuiAudioType; + foo = 9; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(%set, "core/scripts/client/audio.cs"); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testMoveObject(%doNotSave) +{ + // First add a couple of groups to the file + new SimGroup(MoveGroup1) + { + foo = "bar"; + + new SFXDescription(MoveObject1) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 1; + }; + + new SimSet(SubGroup1) + { + new SFXDescription(SubObject1) + { + volume = 0.75; + isLooping = true; + channel = $GuiAudioType; + foo = 2; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(MoveGroup1, "core/scripts/client/audio.cs"); + + new SimGroup(MoveGroup2) + { + foo = "bar"; + + new SFXDescription(MoveObject2) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 3; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(MoveGroup2, "core/scripts/client/audio.cs"); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); + + // Set them as dirty again + TestPManager.setDirty(MoveGroup1); + TestPManager.setDirty(MoveGroup2); + + // Give the subobject an new value + MoveObject1.foo = 4; + + // Move it into the other group + MoveGroup1.add(MoveObject2); + + // Switch the other subobject + MoveGroup2.add(MoveObject1); + + // Also add a new unnamed object to one of the groups + %obj = new SFXDescription() + { + volume = 0.75; + isLooping = true; + bar = 5; + }; + + MoveGroup1.add(%obj); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testObjectRemove(%doNotSave) +{ + TestPManager.removeObjectFromFile(AudioSim); +} + +//Game Object management +function findGameObject(%name) +{ + //find all GameObjectAssets + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) + return 0; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); + + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //%assetName = AssetDatabase.getAssetName(%assetId); + + if(%assetId $= %name) + { + %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); + + %assetQuery.delete(); + return %gameObjectAsset; + } + } + + %assetQuery.delete(); + return 0; +} + +function spawnGameObject(%name, %addToMissionGroup) +{ + if(%addToMissionGroup $= "") + %addToMissionGroup = true; + + //First, check if this already exists in our GameObjectPool + if(isObject(GameObjectPool)) + { + %goCount = GameObjectPool.countKey(%name); + + //if we have some already in the pool, pull it out and use that + if(%goCount != 0) + { + %goIdx = GameObjectPool.getIndexFromKey(%name); + %go = GameObjectPool.getValue(%goIdx); + + %go.setHidden(false); + %go.setScopeAlways(); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%go); + else // clear instance on level exit + MissionCleanup.add(%go); + + //remove from the object pool's list + GameObjectPool.erase(%goIdx); + + return %go; + } + } + + //We have no existing pool, or no existing game objects of this type, so spawn a new one + + %gameObjectAsset = findGameObject(%name); + + if(isObject(%gameObjectAsset)) + { + %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%newSGOObject); + else // clear instance on level exit + MissionCleanup.add(%newSGOObject); + + return %newSGOObject; + } + + return 0; +} + +function saveGameObject(%name, %tamlPath, %scriptPath) +{ + %gameObjectAsset = findGameObject(%name); + + //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset + if(isObject(%gameObjectAsset)) + { + %assetID = %gameObjectAsset.getAssetId(); + + %gameObjectAsset.TAMLFilePath = %tamlPath; + %gameObjectAsset.scriptFilePath = %scriptPath; + + TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); + AssetDatabase.refreshAsset(%assetID); + } + else + { + //Doesn't exist, so make a new one + %gameObjectAsset = new GameObjectAsset() + { + assetName = %name @ "Asset"; + gameObjectName = %name; + TAMLFilePath = %tamlPath; + scriptFilePath = %scriptPath; + }; + + //Save it alongside the taml file + %path = filePath(%tamlPath); + + TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); + AssetDatabase.refreshAllAssets(true); + } +} + +//Allocates a number of a game object into a pool to be pulled from as needed +function allocateGameObjects(%name, %amount) +{ + //First, we need to make sure our pool exists + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + //Next, we loop and generate our game objects, and add them to the pool + for(%i=0; %i < %amount; %i++) + { + %go = spawnGameObject(%name, false); + + //When our object is in the pool, it's not "real", so we need to make sure + //that we don't ghost it to clients untill we actually spawn it. + %go.clearScopeAlways(); + + //We also hide it, so that we don't 'exist' in the scene until we spawn + %go.hidden = true; + + //Lastly, add us to the pool, with the key being our game object type + GameObjectPool.add(%name, %go); + } +} + +function Entity::delete(%this) +{ + //we want to intercept the delete call, and add it to our GameObjectPool + //if it's a game object + if(%this.gameObjectAsset !$= "") + { + %this.setHidden(true); + %this.clearScopeAlways(); + + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + GameObjectPool.add(%this.gameObjectAsset, %this); + + %missionSet = %this.getGroup(); + %missionSet.remove(%this); + } + else + { + %this.superClass.delete(); + } +} + +function clearGameObjectPool() +{ + if(isObject(GameObjectPool)) + { + %count = GameObjectPool.count(); + + for(%i=0; %i < %count; %i++) + { + %go = GameObjectPool.getValue(%i); + + %go.superClass.delete(); + } + + GameObjectPool.empty(); + } +} + +// +function switchCamera(%client, %newCamEntity) +{ + if(!isObject(%client) || !isObject(%newCamEntity)) + return error("SwitchCamera: No client or target camera!"); + + %cam = %newCamEntity.getComponent(CameraComponent); + + if(!isObject(%cam)) + return error("SwitchCamera: Target camera doesn't have a camera behavior!"); + + //TODO: Cleanup clientOwner for previous camera! + if(%cam.clientOwner == 0 || %cam.clientOwner $= "") + %cam.clientOwner = 0; + + %cam.scopeToClient(%client); + %cam.setDirty(); + + %client.setCameraObject(%newCamEntity); + %client.setControlCameraFov(%cam.FOV); + + %client.camera = %newCamEntity; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/scripts/parseArgs.cs b/Templates/BaseGame/game/core/utility/scripts/parseArgs.cs new file mode 100644 index 000000000..811cee00c --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/parseArgs.cs @@ -0,0 +1,392 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Support functions used to manage the directory list +function pushFront(%list, %token, %delim) +{ + if (%list !$= "") + return %token @ %delim @ %list; + return %token; +} + +function pushBack(%list, %token, %delim) +{ + if (%list !$= "") + return %list @ %delim @ %token; + return %token; +} + +function popFront(%list, %delim) +{ + return nextToken(%list, unused, %delim); +} + +function parseArgs() +{ + for ($i = 1; $i < $Game::argc ; $i++) + { + $arg = $Game::argv[$i]; + $nextArg = $Game::argv[$i+1]; + $hasNextArg = $Game::argc - $i > 1; + $logModeSpecified = false; + + // Check for dedicated run + /*if( stricmp($arg,"-dedicated") == 0 ) + { + $userDirs = $defaultGame; + $dirCount = 1; + $isDedicated = true; + }*/ + + switch$ ($arg) + { + //-------------------- + case "-dedicated": + $userDirs = $defaultGame; + $dirCount = 1; + $isDedicated = true; + $Server::Dedicated = true; + enableWinConsole(true); + $argUsed[%i]++; + + //-------------------- + case "-mission": + $argUsed[%i]++; + if ($hasNextArg) + { + $missionArg = $nextArg; + $argUsed[%i+1]++; + %i++; + } + else + error("Error: Missing Command Line argument. Usage: -mission "); + + //-------------------- + case "-connect": + $argUsed[%i]++; + if ($hasNextArg) + { + $JoinGameAddress = $nextArg; + $argUsed[%i+1]++; + %i++; + } + else + error("Error: Missing Command Line argument. Usage: -connect "); + + + //-------------------- + case "-log": + $argUsed[$i]++; + if ($hasNextArg) + { + // Turn on console logging + if ($nextArg != 0) + { + // Dump existing console to logfile first. + $nextArg += 4; + } + setLogMode($nextArg); + $logModeSpecified = true; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -log "); + + //-------------------- + case "-dir": + $argUsed[$i]++; + if ($hasNextArg) + { + // Append the mod to the end of the current list + $userDirs = strreplace($userDirs, $nextArg, ""); + $userDirs = pushFront($userDirs, $nextArg, ";"); + $argUsed[$i+1]++; + $i++; + $dirCount++; + } + else + error("Error: Missing Command Line argument. Usage: -dir "); + + //-------------------- + // changed the default behavior of this command line arg. It now + // defaults to ONLY loading the game, not tools + // default auto-run already loads in tools --SRZ 11/29/07 + case "-game": + $argUsed[$i]++; + if ($hasNextArg) + { + // Set the selected dir --NOTE: we no longer allow tools with this argument + /* + if( $isDedicated ) + { + $userDirs = $nextArg; + $dirCount = 1; + } + else + { + $userDirs = "tools;" @ $nextArg; + $dirCount = 2; + } + */ + $userDirs = $nextArg; + $dirCount = 1; + $argUsed[$i+1]++; + $i++; + error($userDirs); + } + else + error("Error: Missing Command Line argument. Usage: -game "); + + //-------------------- + case "-console": + enableWinConsole(true); + $argUsed[$i]++; + + //-------------------- + case "-jSave": + $argUsed[$i]++; + if ($hasNextArg) + { + echo("Saving event log to journal: " @ $nextArg); + saveJournal($nextArg); + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -jSave "); + + //-------------------- + case "-jPlay": + $argUsed[$i]++; + if ($hasNextArg) + { + playJournal($nextArg); + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -jPlay "); + + //-------------------- + case "-jPlayToVideo": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::journalName = $nextArg; + $VideoCapture::captureFromJournal = true; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -jPlayToVideo "); + + //-------------------- + case "-vidCapFile": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::fileName = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapFile "); + + //-------------------- + case "-vidCapFPS": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::fps = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapFPS "); + + //-------------------- + case "-vidCapEncoder": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::encoder = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapEncoder "); + + //-------------------- + case "-vidCapWidth": + $argUsed[$i]++; + if ($hasNextArg) + { + $videoCapture::width = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapWidth "); + + //-------------------- + case "-vidCapHeight": + $argUsed[$i]++; + if ($hasNextArg) + { + $videoCapture::height = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapHeight "); + + //-------------------- + case "-level": + $argUsed[$i]++; + if ($hasNextArg) + { + %hasExt = strpos($nextArg, ".mis"); + if(%hasExt == -1) + { + $levelToLoad = $nextArg @ " "; + + for(%i = $i + 2; %i < $Game::argc; %i++) + { + $arg = $Game::argv[%i]; + %hasExt = strpos($arg, ".mis"); + + if(%hasExt == -1) + { + $levelToLoad = $levelToLoad @ $arg @ " "; + } else + { + $levelToLoad = $levelToLoad @ $arg; + break; + } + } + } + else + { + $levelToLoad = $nextArg; + } + + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -level "); + + //------------------- + case "-worldeditor": + $startWorldEditor = true; + $argUsed[$i]++; + + //------------------- + case "-guieditor": + $startGUIEditor = true; + $argUsed[$i]++; + + //------------------- + case "-help": + $displayHelp = true; + $argUsed[$i]++; + + //------------------- + case "-compileAll": + $compileAll = true; + $argUsed[$i]++; + + //------------------- + case "-compileTools": + $compileTools = true; + $argUsed[$i]++; + + //------------------- + case "-genScript": + $genScript = true; + $argUsed[$i]++; + + case "-fullscreen": + $cliFullscreen = true; + $argUsed[%i]++; + + case "-windowed": + $cliFullscreen = false; + $argUsed[%i]++; + + case "-openGL": + $pref::Video::displayDevice = "OpenGL"; + $argUsed[%i]++; + + case "-directX": + $pref::Video::displayDevice = "D3D"; + $argUsed[%i]++; + + case "-autoVideo": + $pref::Video::displayDevice = ""; + $argUsed[%i]++; + + case "-prefs": + $argUsed[%i]++; + if ($hasNextArg) { + exec($nextArg, true, true); + $argUsed[%i+1]++; + %i++; + } + else + error("Error: Missing Command Line argument. Usage: -prefs "); + + + //------------------- + default: + $argUsed[$i]++; + if($userDirs $= "") + $userDirs = $arg; + } + } + + //----------------------------------------------- + // Play journal to video file? + if ($VideoCapture::captureFromJournal && $VideoCapture::journalName !$= "") + { + if ($VideoCapture::fileName $= "") + $VideoCapture::fileName = $VideoCapture::journalName; + + if ($VideoCapture::encoder $= "") + $VideoCapture::encoder = "THEORA"; + + if ($VideoCapture::fps $= "") + $VideoCapture::fps = 30; + + if ($videoCapture::width $= "") + $videoCapture::width = 0; + + if ($videoCapture::height $= "") + $videoCapture::height = 0; + + playJournalToVideo( $VideoCapture::journalName, $VideoCapture::fileName, + $VideoCapture::encoder, $VideoCapture::fps, + $videoCapture::width SPC $videoCapture::height ); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/Core_VR.cs b/Templates/BaseGame/game/core/vr/Core_VR.cs new file mode 100644 index 000000000..42b2df7e0 --- /dev/null +++ b/Templates/BaseGame/game/core/vr/Core_VR.cs @@ -0,0 +1,9 @@ + +function Core_VR::onCreate(%this) +{ + exec("./scripts/oculusVR.cs"); +} + +function Core_VR::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/Core_VR.module b/Templates/BaseGame/game/core/vr/Core_VR.module new file mode 100644 index 000000000..960a5a85a --- /dev/null +++ b/Templates/BaseGame/game/core/vr/Core_VR.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui b/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui new file mode 100644 index 000000000..62a9f719c --- /dev/null +++ b/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui @@ -0,0 +1,19 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = singleton GuiControl(OculusVROverlay) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "GuiContentProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Position = "0 0"; + Extent = "512 512"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "GuiToolTipProfile"; + hovertime = "1000"; + useVariable = "0"; + tile = "0"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs b/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs new file mode 100644 index 000000000..fa9562c18 --- /dev/null +++ b/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs @@ -0,0 +1,248 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Only load these functions if an Oculus VR device is present +if(!isFunction(isOculusVRDeviceActive)) + return; + +function setupOculusActionMaps() +{ + if (isObject(OculusWarningMap)) + return; + + new ActionMap(OculusWarningMap); + new ActionMap(OculusCanvasMap); + + OculusWarningMap.bind(keyboard, space, dismissOculusVRWarnings); + + OculusCanvasMap.bind( mouse, xaxis, oculusYaw ); + OculusCanvasMap.bind( mouse, yaxis, oculusPitch ); + OculusCanvasMap.bind( mouse, button0, oculusClick ); +} + +function oculusYaw(%val) +{ + OculusCanvas.cursorNudge(%val * 0.10, 0); +} + +function oculusPitch(%val) +{ + OculusCanvas.cursorNudge(0, %val * 0.10); +} + +function oculusClick(%active) +{ + OculusCanvas.cursorClick(0, %active); +} + +function GuiOffscreenCanvas::checkCursor(%this) +{ + %count = %this.getCount(); + for(%i = 0; %i < %count; %i++) + { + %control = %this.getObject(%i); + if ((%control.noCursor $= "") || !%control.noCursor) + { + %this.cursorOn(); + return true; + } + } + // If we get here, every control requested a hidden cursor, so we oblige. + + %this.cursorOff(); + return false; +} + +function GuiOffscreenCanvas::pushDialog(%this, %ctrl, %layer, %center) +{ + Parent::pushDialog(%this, %ctrl, %layer, %center); + %cursorVisible = %this.checkCursor(); + + if (%cursorVisible) + { + echo("OffscreenCanvas visible"); + OculusCanvasMap.pop(); + OculusCanvasMap.push(); + } + else + { + echo("OffscreenCanvas not visible"); + OculusCanvasMap.pop(); + } +} + +function GuiOffscreenCanvas::popDialog(%this, %ctrl) +{ + Parent::popDialog(%this, %ctrl); + %cursorVisible = %this.checkCursor(); + + if (%cursorVisible) + { + echo("OffscreenCanvas visible"); + OculusCanvasMap.pop(); + OculusCanvasMap.push(); + } + else + { + echo("OffscreenCanvas not visible"); + OculusCanvasMap.pop(); + } +} + + +//----------------------------------------------------------------------------- + +function oculusSensorMetricsCallback() +{ + return ovrDumpMetrics(0); +} + + +//----------------------------------------------------------------------------- +function onOculusStatusUpdate(%status) +{ + $LastOculusTrackingState = %status; +} + +//----------------------------------------------------------------------------- + +// Call this function from createCanvas() to have the Canvas attach itself +// to the Rift's display. The Canvas' window will still open on the primary +// display if that is different from the Rift, but it will move to the Rift +// when it goes full screen. If the Rift is not connected then nothing +// will happen. +function pointCanvasToOculusVRDisplay() +{ + $pref::Video::displayOutputDevice = getOVRHMDDisplayDeviceName(0); +} + +//----------------------------------------------------------------------------- + +// Call this function from GameConnection::initialControlSet() just before +// your "Canvas.setContent(PlayGui);" call, or at any time you wish to switch +// to a side-by-side rendering and the appropriate barrel distortion. This +// will turn on side-by-side rendering and tell the GameConnection to use the +// Rift as its display device. +// Parameters: +// %gameConnection - The client GameConnection instance +// %trueStereoRendering - If true will enable stereo rendering with an eye +// offset for each viewport. This will render each frame twice. If false +// then a pseudo stereo rendering is done with only a single render per frame. +function enableOculusVRDisplay(%gameConnection, %trueStereoRendering) +{ + setOVRHMDAsGameConnectionDisplayDevice(%gameConnection); + PlayGui.renderStyle = "stereo side by side"; + setOptimalOVRCanvasSize(Canvas); + + if (!isObject(OculusCanvas)) + { + new GuiOffscreenCanvas(OculusCanvas) { + targetSize = "512 512"; + targetName = "oculusCanvas"; + dynamicTarget = true; + }; + } + + if (!isObject(OculusVROverlay)) + { + exec("core/vr/guis/oculusVROverlay.gui"); + } + + OculusCanvas.setContent(OculusVROverlay); + OculusCanvas.setCursor(DefaultCursor); + PlayGui.setStereoGui(OculusCanvas); + OculusCanvas.setCursorPos("128 128"); + OculusCanvas.cursorOff(); + $GameCanvas = OculusCanvas; + + %ext = Canvas.getExtent(); + $OculusMouseScaleX = 512.0 / 1920.0; + $OculusMouseScaleY = 512.0 / 1060.0; + + //$gfx::wireframe = true; + // Reset all sensors + ovrResetAllSensors(); +} + +// Call this function when ever you wish to turn off the stereo rendering +// and barrel distortion for the Rift. +function disableOculusVRDisplay(%gameConnection) +{ + OculusCanvas.popDialog(); + OculusWarningMap.pop(); + $GameCanvas = Canvas; + + if (isObject(gameConnection)) + { + %gameConnection.clearDisplayDevice(); + } + PlayGui.renderStyle = "standard"; +} + +// Helper function to set the standard Rift control scheme. You could place +// this function in GameConnection::initialControlSet() at the same time +// you call enableOculusVRDisplay(). +function setStandardOculusVRControlScheme(%gameConnection) +{ + if($OculusVR::SimulateInput) + { + // We are simulating a HMD so allow the mouse and gamepad to control + // both yaw and pitch. + %gameConnection.setControlSchemeParameters(true, true, true); + } + else + { + // A HMD is connected so have the mouse and gamepad only add to yaw + %gameConnection.setControlSchemeParameters(true, true, false); + } +} + +//----------------------------------------------------------------------------- + +// Helper function to set the resolution for the Rift. +// Parameters: +// %fullscreen - If true then the display will be forced to full screen. If +// pointCanvasToOculusVRDisplay() was called before the Canvas was created, then +// the full screen display will appear on the Rift. +function setVideoModeForOculusVRDisplay(%fullscreen) +{ + %res = getOVRHMDResolution(0); + Canvas.setVideoMode(%res.x, %res.y, %fullscreen, 32, 4); +} + +//----------------------------------------------------------------------------- + +// Reset all Oculus Rift sensors. This will make the Rift's current heading +// be considered the origin. +function resetOculusVRSensors() +{ + ovrResetAllSensors(); +} + +function dismissOculusVRWarnings(%value) +{ + //if (%value) + //{ + ovrDismissWarnings(); + OculusWarningMap.pop(); + //} +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs b/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs index 8b616a84a..23a6c3ced 100644 --- a/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs +++ b/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs @@ -1,4 +1,4 @@ -$PostFXManager::Settings::ColorCorrectionRamp = "core/images/null_color_ramp.png"; +$PostFXManager::Settings::ColorCorrectionRamp = "core/postFX/images/null_color_ramp.png"; $PostFXManager::Settings::DOF::BlurCurveFar = ""; $PostFXManager::Settings::DOF::BlurCurveNear = ""; $PostFXManager::Settings::DOF::BlurMax = ""; From 5037d7e046a9dba9bcafe4f8e33eb809453d8fc4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 2 Sep 2018 04:49:58 -0500 Subject: [PATCH 306/312] Updated the main.cs.in file to account for core module-ification. --- Templates/BaseGame/game/main.cs.in | 47 ++++-------------------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/Templates/BaseGame/game/main.cs.in b/Templates/BaseGame/game/main.cs.in index 3eed267df..1e3e37c44 100644 --- a/Templates/BaseGame/game/main.cs.in +++ b/Templates/BaseGame/game/main.cs.in @@ -16,39 +16,12 @@ $appName = "@TORQUE_APP_NAME@"; //----------------------------------------------------------------------------- // Load up scripts to initialise subsystems. -exec("core/main.cs"); - -// Parse the command line arguments -echo("\n--------- Parsing Arguments ---------"); -parseArgs(); - -// The canvas needs to be initialized before any gui scripts are run since -// some of the controls assume that the canvas exists at load time. -createCanvas($appName); +ModuleDatabase.setModuleExtension("module"); +ModuleDatabase.scanModules( "core", false ); +ModuleDatabase.LoadExplicit( "CoreModule" ); //----------------------------------------------------------------------------- -// Load console. -exec("core/console/main.cs"); - -// Init the physics plugin. -physicsInit(); - -sfxStartup(); - -// Set up networking. -setNetPort(0); - -// Start processing file change events. -startFileChangeNotifications(); - -// If we have editors, initialize them here as well -if (isToolBuild()) -{ - if(isFile("tools/main.cs") && !$isDedicated) - exec("tools/main.cs"); -} - -ModuleDatabase.setModuleExtension("module"); +// Load any gameplay modules ModuleDatabase.scanModules( "data", false ); ModuleDatabase.LoadGroup( "Game" ); @@ -85,14 +58,4 @@ else closeSplashWindow(); } -echo("Engine initialized..."); - -//----------------------------------------------------------------------------- -// Called when the engine is shutting down. -function onExit() -{ - // Stop file change events. - stopFileChangeNotifications(); - - ModuleDatabase.UnloadExplicit( "Game" ); -} \ No newline at end of file +echo("Engine initialized..."); \ No newline at end of file From c17ae947456ecd0b6172ad56dbb3cafa5b6650ce Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 19 Sep 2018 16:03:58 -0500 Subject: [PATCH 307/312] Moved VR module from core to a regular module, as not all games are necessarily going to use VR. Also corrected some of the default posteffect settings for the levels. --- Templates/BaseGame/game/core/Core.cs | 2 -- Templates/BaseGame/game/core/vr/Core_VR.cs | 9 --------- Templates/Modules/vr/VR.cs | 9 +++++++++ .../game/core/vr/Core_VR.module => Modules/vr/VR.module} | 6 +++--- .../game/core => Modules}/vr/guis/oculusVROverlay.gui | 0 .../game/core => Modules}/vr/scripts/oculusVR.cs | 0 6 files changed, 12 insertions(+), 14 deletions(-) delete mode 100644 Templates/BaseGame/game/core/vr/Core_VR.cs create mode 100644 Templates/Modules/vr/VR.cs rename Templates/{BaseGame/game/core/vr/Core_VR.module => Modules/vr/VR.module} (75%) rename Templates/{BaseGame/game/core => Modules}/vr/guis/oculusVROverlay.gui (100%) rename Templates/{BaseGame/game/core => Modules}/vr/scripts/oculusVR.cs (100%) diff --git a/Templates/BaseGame/game/core/Core.cs b/Templates/BaseGame/game/core/Core.cs index 480c0331c..5559760ae 100644 --- a/Templates/BaseGame/game/core/Core.cs +++ b/Templates/BaseGame/game/core/Core.cs @@ -24,8 +24,6 @@ function CoreModule::onCreate(%this) ModuleDatabase.LoadExplicit( "Core_Lighting" ); ModuleDatabase.LoadExplicit( "Core_SFX" ); ModuleDatabase.LoadExplicit( "Core_PostFX" ); - ModuleDatabase.LoadExplicit( "Core_VR" ); - ModuleDatabase.LoadExplicit( "Core_VR" ); ModuleDatabase.LoadExplicit( "Core_ClientServer" ); %prefPath = getPrefpath(); diff --git a/Templates/BaseGame/game/core/vr/Core_VR.cs b/Templates/BaseGame/game/core/vr/Core_VR.cs deleted file mode 100644 index 42b2df7e0..000000000 --- a/Templates/BaseGame/game/core/vr/Core_VR.cs +++ /dev/null @@ -1,9 +0,0 @@ - -function Core_VR::onCreate(%this) -{ - exec("./scripts/oculusVR.cs"); -} - -function Core_VR::onDestroy(%this) -{ -} \ No newline at end of file diff --git a/Templates/Modules/vr/VR.cs b/Templates/Modules/vr/VR.cs new file mode 100644 index 000000000..ea0ffd7a5 --- /dev/null +++ b/Templates/Modules/vr/VR.cs @@ -0,0 +1,9 @@ + +function VR::onCreate(%this) +{ + exec("./scripts/oculusVR.cs"); +} + +function VR::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/Core_VR.module b/Templates/Modules/vr/VR.module similarity index 75% rename from Templates/BaseGame/game/core/vr/Core_VR.module rename to Templates/Modules/vr/VR.module index 960a5a85a..14ccec0e0 100644 --- a/Templates/BaseGame/game/core/vr/Core_VR.module +++ b/Templates/Modules/vr/VR.module @@ -1,9 +1,9 @@ + Group="Game"> \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui b/Templates/Modules/vr/guis/oculusVROverlay.gui similarity index 100% rename from Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui rename to Templates/Modules/vr/guis/oculusVROverlay.gui diff --git a/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs b/Templates/Modules/vr/scripts/oculusVR.cs similarity index 100% rename from Templates/BaseGame/game/core/vr/scripts/oculusVR.cs rename to Templates/Modules/vr/scripts/oculusVR.cs From 2ed30ffeaecf3062c67ae352d4385351be942b4c Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Mon, 24 Sep 2018 18:56:46 -0400 Subject: [PATCH 308/312] Adds Clamp to QuatF::dot() Clamps output of QuatF::dot() to [-1, 1]. --- Engine/source/math/mQuat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/math/mQuat.h b/Engine/source/math/mQuat.h index ca6ed5d82..261b66a88 100644 --- a/Engine/source/math/mQuat.h +++ b/Engine/source/math/mQuat.h @@ -222,7 +222,7 @@ inline QuatF& QuatF::neg() inline F32 QuatF::dot( const QuatF &q ) const { - return (w*q.w + x*q.x + y*q.y + z*q.z); + return mClampF(w*q.w + x*q.x + y*q.y + z*q.z, -1.0f, 1.0f); } inline F32 QuatF::angleBetween( const QuatF & q ) From 2c0a57449e05a4246cc1622aa576fba0970b9e09 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 26 Sep 2018 06:49:36 -0500 Subject: [PATCH 309/312] filter out pixel shader normalmap calcs when not in deferred mode. --- Engine/source/terrain/glsl/terrFeatureGLSL.cpp | 3 +++ Engine/source/terrain/hlsl/terrFeatureHLSL.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 2acd40871..6eb0c8c1a 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -927,6 +927,9 @@ void TerrainNormalMapFeatGLSL::processVert( Vector &component void TerrainNormalMapFeatGLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine; diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index f4a0b7d5d..3b05a30f7 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -908,6 +908,9 @@ void TerrainNormalMapFeatHLSL::processVert( Vector &component void TerrainNormalMapFeatHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine; From e3793184b6bd9956f32486fffe566dba0c9e3985 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Sat, 6 Oct 2018 03:29:15 -0400 Subject: [PATCH 310/312] Improved BitStream writeQuat/readQuat methods. Replaces the writeQuat/readQuat implementations with one that utilizes smallest three compression. --- Engine/source/core/stream/bitStream.cpp | 53 +++++++++++++++++++------ Engine/source/core/stream/bitStream.h | 8 ++-- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index 1a5ab3202..704da2b11 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -488,24 +488,51 @@ void BitStream::readAffineTransform(MatrixF* matrix) void BitStream::writeQuat( const QuatF& quat, U32 bitCount ) { - writeSignedFloat( quat.x, bitCount ); - writeSignedFloat( quat.y, bitCount ); - writeSignedFloat( quat.z, bitCount ); - writeFlag( quat.w < 0.0f ); + F32 quatVals[4] = { quat.x, quat.y, quat.z, quat.w }; + bool flipQuat = (quatVals[0] < 0); + F32 maxVal = mFabs(quatVals[0]); + S32 idxMax = 0; + + for (S32 i = 1; i < 4; ++i) + { + if (mFabs(quatVals[i]) > maxVal) + { + idxMax = i; + maxVal = mFabs(quatVals[i]); + flipQuat = (quatVals[i] < 0); + } + } + writeInt(idxMax, 2); + + for (S32 i = 0; i < 4; ++i) + { + if (i == idxMax) + continue; + F32 curValue = (flipQuat ? -quatVals[i] : quatVals[i]) * (F32) M_SQRT2; + writeSignedFloat( curValue, bitCount ); + } } void BitStream::readQuat( QuatF *outQuat, U32 bitCount ) { - outQuat->x = readSignedFloat( bitCount ); - outQuat->y = readSignedFloat( bitCount ); - outQuat->z = readSignedFloat( bitCount ); + F32 quatVals[4]; + F32 sum = 0.0f; - outQuat->w = mSqrt( 1.0 - getMin( mSquared( outQuat->x ) + - mSquared( outQuat->y ) + - mSquared( outQuat->z ), - 1.0f ) ); - if ( readFlag() ) - outQuat->w = -outQuat->w; + S32 idxMax = readInt( 2 ); + for (S32 i = 0; i < 4; ++i) + { + if (i == idxMax) + continue; + quatVals[i] = readSignedFloat( bitCount ) * M_SQRTHALF_F; + sum += quatVals[i] * quatVals[i]; + } + + if (sum > 1.0f) + quatVals[idxMax] = 1.0f; + else + quatVals[idxMax] = mSqrt(1.0f - sum); + + outQuat->set(quatVals[0], quatVals[1], quatVals[2], quatVals[3]); } void BitStream::writeBits( const BitVector &bitvec ) diff --git a/Engine/source/core/stream/bitStream.h b/Engine/source/core/stream/bitStream.h index b0bb2f22a..bd81f3b1b 100644 --- a/Engine/source/core/stream/bitStream.h +++ b/Engine/source/core/stream/bitStream.h @@ -207,18 +207,18 @@ public: void readAffineTransform(MatrixF*); /// Writes a quaternion in a lossy compressed format that - /// is ( bitCount * 3 ) + 1 bits in size. + /// is ( bitCount * 3 ) + 2 bits in size. /// /// @param quat The normalized quaternion to write. - /// @param bitCount The the storage space for the xyz component of + /// @param bitCount The the storage space for the packed components of /// the quaternion. /// void writeQuat( const QuatF& quat, U32 bitCount = 9 ); /// Reads a quaternion written with writeQuat. /// - /// @param quat The normalized quaternion to write. - /// @param bitCount The the storage space for the xyz component of + /// @param quat The quaternion that was read. + /// @param bitCount The the storage space for the packed components of /// the quaternion. Must match the bitCount at write. /// @see writeQuat /// From 6ba442bf07372db555f9fd2073ec95d1d801925c Mon Sep 17 00:00:00 2001 From: Brian Roberts Date: Mon, 29 Oct 2018 13:21:42 -0500 Subject: [PATCH 311/312] Update terrFeatureGLSL.cpp --- Engine/source/terrain/glsl/terrFeatureGLSL.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 6eb0c8c1a..7a4755d03 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -927,9 +927,9 @@ void TerrainNormalMapFeatGLSL::processVert( Vector &component void TerrainNormalMapFeatGLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { - // We only need to process normals during the deferred. - if (!fd.features.hasFeature(MFT_DeferredConditioner)) - return; + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine; From 4453a4ad4b2117e726fe972a39a8562de5f2f38f Mon Sep 17 00:00:00 2001 From: Brian Roberts Date: Mon, 29 Oct 2018 13:22:16 -0500 Subject: [PATCH 312/312] Update terrFeatureHLSL.cpp --- Engine/source/terrain/hlsl/terrFeatureHLSL.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index 3b05a30f7..e0039f8af 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -908,9 +908,9 @@ void TerrainNormalMapFeatHLSL::processVert( Vector &component void TerrainNormalMapFeatHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { - // We only need to process normals during the deferred. - if (!fd.features.hasFeature(MFT_DeferredConditioner)) - return; + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine;

V>)K)rm&t6~*^h8PO|YKnWM1Pt?;8sE&q|$0o`qBH*FV~}!^DA(qlW9Oko%jF{u+(ljpD$Iv*#n5^&KD8==QfA6AgMB(~0wQ^0``C zKph=Yw>$ZuRXMHm9;;O!Ci8f|p$)56G_lW}%!_3%V{8Ubg z-rJ6GsqU4k`91-MukSFxf8N9Ea$$;e(Y`|a;|HtZ45RuqZ7VmIq}Zj)I`#d-*>~r( zo@9YWE$UU<^uCyznLqV%9l7S65rLi6k65Tjf9U=@FpU7H#Ns3&#Er9b1v7ElSQ?3$ zutQ9K9_N_sMLpDQ45%$X*oRkC6sufT0C~L@Pc9#xHz?;3Z&BgYSCgJ$z1ZMH%u{4~N}T6521j%Y< zA5QL74&6cVy{G`)-}7q+=KdY!k8+gBt-^t25iLI8#}(bY8ot1^w#mJ-3c}QzBh_;o zXzQ7>42vROrA(){!!M!PC6;*}A5jl7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CRfDrd(A}$A3 MK~ug`)-vS(0P0TN6#xJL literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/componentIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..cbaf5699025862b2147fd972708158f0bb255e5b GIT binary patch literal 9050 zcmeHt2~bm6w{C2^oe*h6M38_o7&J1;JOyn~L}U_WkV!tnJ6eI zQ@Ue&8q>g==6-e<49*V=2Z z^?fJS#>!0ifYbpH2qbKN+4LF+^b=703AAqya9Ir*+5#?nZd;g{f&@FiH%$evfSUae zFFOT*Ktf_W|6QPrtYbjs-avE9i+jKA`&Dd@s?*^!aX=Lqe%&$9#NXG~%P$bP1%XT+ zd3gkS-8q4T2i`kjW^QS7N5yL|2y_BuZhGN*2x*ZLnneymao8JFq;|M}Z~!(lv-N;n z>b`v!F50$)U5grGIuteE_bsVeyZ2tC8oEw zW)GFf68W*Q+Y29l=k6_|^`~FXQ{|(vxG1&hm;=itq{}lV*n&r;G|Kl3|Q#pZN`#}GvZ&!XYa?egSm6%GU}=bnJ-R8&;vA3=J`KZe1&*iMyv~@10BO-6uW!ZgFx_=;FdhmNjIEl_5u|$}4 zZ8=i#MlTYepr1d-%IiQ4R0`dWI%s8y23)zXaSn~5__Fhwnq#q=xTK^fGV%vOyB->5 zs|UF?daqwp&#SxdGBesg37({EpO5hGd)BWpw^p-Otu#F-vaxX~g)>@G+l~|QUGCle?RWK$=%3P@93|b|*fj{j za#YRMmyhhP?G93KkmGJOnWLB?qOs~GU8xT$)4#oU?_N(7F~>3dj`xGvvE$(lB1C>p z&8*aHd`=6#qpvqHH;eZ{IqmSE5cKv1b5xc+%;0FskeO9Y-sxSxf{2u-w0h1$vd$&A z+f>Z30$x0CiW+Q8~y^W}A*3g!rNHpJfk`)yd|J05^^eopE zFQug2aPc+Wbpn(WT}V!@3ueD=jod_TY!ITB>UHq7jFwq+i+Uf+Cd!*!w$W1O(f17D zcEirah@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WTyd@ZQD?WK3+Yz?F1B@6Q;e%zkyka)0my>9 zfU+G5W5*xta8BqN-}nOk%%%zSvxeTShn*AG7LBsRMJ>AWiIR4V_Adil0GlOl2Y^*d zIsn(OMF--Gg?ZQ!fX`@q7OhR3Utc78jq1@KM%?&*l=u+{hye1STctF%o_E^zrNiOp zpEh4gjQ2}C>mQ#4D>s45YYUWXf@ETZ0oQ2BO;Tqa?EJ0>`u6id(BrFJHU9#Go0M3z z>!-(Be~145FFf&oQn&xC?lI_ZkgMl`MmL+3k^!2!V&_|ce~ZTbTO<8b8u#C(n}Kft v{-0v=|As35{{n$d0M__-P2%#8s9h;;Uv2iBGhzYVK;{>%OiO>e_4I!M4mK_o literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/gameObjectIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..6b285daae9fb35e85d132522a3ec28b00f8364b2 GIT binary patch literal 14773 zcmeHuS5%W-v~2(tMFAB7>0$xtNR_Sv0@8a8NSBV3(2FRbB3*j#5SsK7AOZr?rFSB| zcL+7f+5G1`obzzU9cPUH;Xd2}8SEq}!|a(VYaMov-1jMJPD0(k(D zlX|J)KDjmH_SRr2We3;K*ZYod9a>&wq8p1K4uX*6-dDf%_%?p_mVH!j)D_r}K<6t@ zUq<8T3wwbiCv|}&Slo+O!4ZE<9N!6y*HU&y6-S)xEEgqEPu;R*pu}|Vk_zU z3wT$Y`#e&2OzU5|NnM3Nl-Mj_co4`Hu(lVM3;Y)b*TFRYmvj9KgWH$$fb~KCg~5Z% zxh{A2Ul_aq)BGE@x}3)!@{{x5vzR}a@!zu8KlA)c7W>EY|HA2daryl&=lNfqF15BU z&KIoDor+nZ+iI#lvE|*gPB9iw^M*N-h8`xhJ}jJJk8aCWc~B(#0PfGs-Y=_?I_J-H z=1pyNY`s`3BU!9Ybe^@T0*=lDx`bjT&60lAnbWIqVK(JD@`U#o z^Pfy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hcE3gb3rA z=n3TM+LW-3t=n{iVn6b`IlywDYc&m|*Yh|fmja%lFsCrlLIIx!EqSg~FRQ;zkD@2B zDO$w*UV|o6cYAf;4JGVA0WnG0of?x|^7?;BKN^3ce`)jQ=4%<~!jE%$l3C2?VYLq+yM0V5Ssl9+*&d<)}B-CNPnNWaGYu{ z?CQwre*Pr~+85WZW;o$c0`8gtP2`BOS5+&N3RBTu!l3M_!Zpo)!j0$YL)=3FF&fk> z4f@jafs{~g(Np{}(T_E|1ZuiI{VW$vm$e^uMI8&x2aU%;9BpuM=6*-1S4DrP%I$Py z=r@%0u6s8I)GL5csI{jSw@+c-rTZ=#G{O{urktZiZ^BD%`R!A;NXezbic1w!sZJ88 z9OlcDX3jch@8it`637n&$qz5db*s#=(mgW6&`Pgiw?D-LBs&2fuhgm-m6vRsG;}sJ z>_N9^oMyE`NM>X{e(I0uj{qgQ4|_RY-i*LEK_lB)pCb=(m%Q&7uhGzxQ@%9ORobfo zD}a{VMQn106u~Ok1u7oS{M6wwK`{n@H1h?u?Azu}$2MQCl&%3fK+;3he(B!! zT7HeviAVw6wh(r{*R8`$XBV4~FE7ntF@gMANgviOb3GWar5tj+5?dlu#m%N1NBd z6@Og@!2Jm%;(t2A0QC=1q68%N(Mep=_nx(2ydH@|JP1WTh$O8@2G9j9QgWRPa=FNx z7cC57a7^HxEi7nDpiMCe2AUP*=GH5QeHjpZyToq)0c~rS;{soya?6!Zr0>~q& z#P|@$#0)ZUF);1r2mULA|J9u}|CfvZh5NR^rvB&sUk@(7A3k{e3xgM6n*VP!V1xgS rJ^xLk`Ge2C^lhL3{vQVq6fcajuB3!_Jc|*&yh=`5Nvh=4+kpQ7P1wGO literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/guiIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..ffeb015f1fa198083840d9870738f5f59766abd5 GIT binary patch literal 5789 zcmds5c{r5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!j+liWp{-m+$9w9;6fe4djx>P#<78GW&SuV3(b8A{^)$kQP zwLydQh8&EG3y464pV>h%U1iNN(R}DPn-8*ox}!O&t95KFh@N$zIaSajGD{q zir=Q;!xbCny)8%=(^?d@Lxjy7;{7F%@~tA8c_3!;Fodnz5yHN*Ya++9jC;j~NusHrPZW130}+0_ zcS3C5{7lN&NTqDmI`(^3|*Of_k! zNd*wJ4wZ1D$lzgo=jf52kNVG#N;VDDM|Su%*!wYrmRZ6uQAQ(};WIORg;6@bp<1xT z;Yy9DyDe4i@bl*HeADd|x82;%MsYqEn3dAyq9JGiJviV&ERztY!^1Zj*q+A1hzhY> z9FZT))VR0=R&jCa>#Ct$UiIZM$n`>9R_kic%eNn0?aRpYM*K2s0R(j6f0S=N$^~JB zLD0}+zXWY94n0CUg7G;yciJgtif@3qiuCi-0xyF}99bn29NwC_6}6HsM%7sNNy=N8 zN%4+X;J7t|B@)ovPN@l<^KmHY*64n=8%$=^KM*JBlWSO{c|_=l^=zVe0tT?_ zQ>;kLoGN4#Q#v-*v+x_$#eK($l}l&vy5OZ@9@7wDZ{klVA2{mhdzCX1vvaZG&Kc=k zP&=HLeIi-3q~d@Fm{N^VZLVFy66`J;xEV*tHiNF$u82z!P#7B>YFS8_}6fT&V}*cnzCGaZ?Pd92Mcy zE8=3WB(>!mGu=~Z{L|K_8WAhyQB_s)>o$i5kuTx8m%NwHsXE8~!4o6ny3E^Bm#p_$ zcXlqJAO>JN#HLy2N4pEs02qfK?53bWLV+I=4EgTnoir#5r266Z3)sW^9~R%)PXVb6 nK-oVe7!4Bs|8UUT_-&XFRPTLrN=pW46mZ4(ni1CU&cFT(d`#xQ literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/levelIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..7fdb61d1b1cfd9e2af585bcded85a68824021509 GIT binary patch literal 6797 zcmd^DXIPWjwvOe9=%7-h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?=pAkQ*7)p6KM;6#4eBu>DSqV9}8@L zm;-KSV=CdTMlS)?@+*FVNCU4h^vUm$-E_|tWIZ5?lxH4Tt)CT9eu&>nLwk%0U~9?#l^UNf{- zM!gqXnQngo^NUbsLA^PwN~Y;VcTwiVZa@sgK@6SK{&snQtdy!b&u<#t5#NRBH4BQR`jmwHSe;J;wMtfY0xU@$}8H>-FFtI3h*vnf#4RV!vpB zxBru}jjoFP+;gf!YIyFAq~7$hC$qi^F9C9OPrp8$5})s^DEK7SMpn>S4$Jr08tLpA zuK4JVAUPJtp!bq|nV$Eg58Odg95|8%^joyTzWv{-$NyfX_**IPKPpjkHu+}aJFBtZ zIsMe%tDJvbtNa)5^q<$p{~uJhWB!iuRiO8sl=x$Mi`@nrRCJXjvtVg-2QUIM&@;J? J(z*N7e*q&EOz;2z literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png b/Templates/BaseGame/game/tools/assetBrowser/art/materialIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..0e6c456a644cf50a23d8fd1abf5609681bcda256 GIT binary patch literal 7889 zcmeHsXH=6}+ivU*7MhCEqJZE~rT5?rAShKK6e&?4fKp;06bS*HIS8Suj6guh2u?6m z0YL~5Ktm#3YG?sWXraZ3kkHS=th3g9->>()-?z?>bJqFstiAJOKlk4I-gmj~Yh&$g zElvrD3xGhNQ#UNlZi7Gvf$l-j@uNWVBXVF9XpVYWS(pLs7Z3>+Gr$0PKRvW`4F!Qt zi0(fJK-sU(122!EZrGR~`+8LTh@9?94IvMBC3WA?1!al|3W5itfS(|cX$brt3hr|; z;y%j%qQwmxdmmN!F%U>v`-a&sj*+9w40M)HgvZoZ1az&GRKGc4{2?zuLlZ}N*7ht* z=+|jQe|x-#&@U~wobJW7UK2S25Bs!vaZBjq4_CMxYES(2CQO*%|O`Il-@4^6a6N>33hQ=re3u3B;K+TCS-v0!; z2CNcLfe;Av80Z}afi42g0TAdo=wJNxZw~(tll<>U{}03eS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